void DialogPreferences::on_listAdvancedOptions_itemChanged(QTreeWidgetItem* item, int col) { if (col != CN_CURVALUE) return; onSettingChanged(); std::string curval = Q2S(item->text(CN_CURVALUE)); bool isvalid = false; try { std::string normval = settings->getVariable(Q2S(item->text(CN_KEY)))->isValid(curval); if (curval != normval) { item->setText(CN_CURVALUE, S2Q(normval)); return; } isvalid = true; } catch (...) {}; bool bold = item->text(CN_CURVALUE) != item->text(CN_DEFAULT); QFont tfont = item->font(CN_DEFAULT); tfont.setBold(bold); item->setFont(CN_CURVALUE, tfont); item->setFont(CN_KEY , tfont); QColor tcolor = item->textColor(CN_DEFAULT); if (!isvalid) tcolor = QColor("red"); item->setTextColor(CN_CURVALUE, tcolor); item->setTextColor(CN_KEY , tcolor); }
void QtSettingsProvider::storeSetting(const Setting<int>& setting, const int& settingValue) { bool changed = false; if (getSetting(setting) != settingValue) { changed = true; } settings_.setValue(setting.getKey().c_str(), settingValue); if (changed) { onSettingChanged(setting.getKey()); } updatePermissions(); }