QString QtGradientUtils::saveState(const QtGradientManager *manager) { QDomDocument doc; QDomElement rootElem = doc.createElement(QLatin1String("gradients")); QMap<QString, QGradient> grads = manager->gradients(); QMapIterator<QString, QGradient> itGrad(grads); while (itGrad.hasNext()) { itGrad.next(); QDomElement idElem = doc.createElement(QLatin1String("gradient")); idElem.setAttribute(QLatin1String("name"), itGrad.key()); QDomElement gradElem = saveGradient(doc, itGrad.value()); idElem.appendChild(gradElem); rootElem.appendChild(idElem); } doc.appendChild(rootElem); return doc.toString(); }
void DkTransferToolBar::createIcons() { // user needs to decide... //this->setIconSize(QSize(16,16)); toolBarIcons.resize(icon_toolbar_end); toolBarIcons[icon_toolbar_reset] = ICON("", ":/nomacs/img/gradient-reset.png"); toolBarIcons[icon_toolbar_pipette] = ICON("", ":/nomacs/img/pipette.png"); toolBarIcons[icon_toolbar_save] = ICON("", ":/nomacs/img/save.png"); if (!DkSettings::display.defaultIconColor || DkSettings::app.privateMode) { // now colorize the icons toolBarIcons[icon_toolbar_reset].addPixmap(DkImage::colorizePixmap(toolBarIcons[icon_toolbar_reset].pixmap(100, QIcon::Normal, QIcon::Off), DkSettings::display.iconColor), QIcon::Normal, QIcon::Off); toolBarIcons[icon_toolbar_pipette].addPixmap(DkImage::colorizePixmap(toolBarIcons[icon_toolbar_pipette].pixmap(100, QIcon::Normal, QIcon::Off), DkSettings::display.iconColor), QIcon::Normal, QIcon::Off); toolBarIcons[icon_toolbar_save].addPixmap(DkImage::colorizePixmap(toolBarIcons[icon_toolbar_save].pixmap(100, QIcon::Normal, QIcon::Off), DkSettings::display.iconColor), QIcon::Normal, QIcon::Off); } toolBarActions.resize(toolbar_end); toolBarActions[toolbar_reset] = new QAction(toolBarIcons[icon_toolbar_reset], tr("Reset"), this); toolBarActions[toolbar_reset]->setStatusTip(tr("Resets the Pseudo Color function")); connect(toolBarActions[toolbar_reset], SIGNAL(triggered()), this, SLOT(resetGradient())); //toolBarActions[toolbar_reset]->setToolTip("was geht?"); toolBarActions[toolbar_pipette] = new QAction(toolBarIcons[icon_toolbar_pipette], tr("Select Color"), this); toolBarActions[toolbar_pipette]->setStatusTip(tr("Adds a slider at the selected color value")); toolBarActions[toolbar_pipette]->setCheckable(true); toolBarActions[toolbar_pipette]->setChecked(false); connect(toolBarActions[toolbar_pipette], SIGNAL(triggered(bool)), this, SLOT(pickColor(bool))); toolBarActions[toolbar_save] = new QAction(toolBarIcons[icon_toolbar_save], tr("Save Gradient"), this); toolBarActions[toolbar_save]->setStatusTip(tr("Saves the current Gradient")); connect(toolBarActions[toolbar_save], SIGNAL(triggered()), this, SLOT(saveGradient())); addActions(toolBarActions.toList()); }