void DesignerSettings::setValue(const QByteArray &key, const QVariant &value) { DesignerSettings settings = QmlDesignerPlugin::instance()->settings(); settings.insert(key, value); QmlDesignerPlugin::instance()->setSettings(settings); }
DesignerSettings SettingsPageWidget::settings() const { DesignerSettings settings = QmlDesignerPlugin::instance()->settings(); settings.insert(DesignerSettingsKey::ITEMSPACING, m_ui.spinItemSpacing->value()); settings.insert(DesignerSettingsKey::CONTAINERPADDING, m_ui.spinSnapMargin->value()); settings.insert(DesignerSettingsKey::CANVASWIDTH, m_ui.spinCanvasWidth->value()); settings.insert(DesignerSettingsKey::CANVASHEIGHT, m_ui.spinCanvasHeight->value()); settings.insert(DesignerSettingsKey::WARNING_FOR_FEATURES_IN_DESIGNER, m_ui.designerWarningsCheckBox->isChecked()); settings.insert(DesignerSettingsKey::WARNING_FOR_DESIGNER_FEATURES_IN_EDITOR, m_ui.designerWarningsInEditorCheckBox->isChecked()); settings.insert(DesignerSettingsKey::SHOW_DEBUGVIEW, m_ui.designerShowDebuggerCheckBox->isChecked()); settings.insert(DesignerSettingsKey::ENABLE_DEBUGVIEW, m_ui.designerEnableDebuggerCheckBox->isChecked()); settings.insert(DesignerSettingsKey::USE_ONLY_FALLBACK_PUPPET, m_ui.useDefaultPuppetRadioButton->isChecked()); settings.insert(DesignerSettingsKey::USE_QSTR_FUNCTION, m_ui.useQsTrFunctionRadioButton->isChecked()); settings.insert(DesignerSettingsKey::CONTROLS_STYLE, m_ui.styleLineEdit->text()); settings.insert(DesignerSettingsKey::FORWARD_PUPPET_OUTPUT, m_ui.forwardPuppetOutputComboBox->currentText()); settings.insert(DesignerSettingsKey::DEBUG_PUPPET, m_ui.debugPuppetComboBox->currentText()); if (!m_ui.fallbackPuppetPathLineEdit->path().isEmpty() && m_ui.fallbackPuppetPathLineEdit->path() != PuppetCreator::defaultPuppetFallbackDirectory()) { settings.insert(DesignerSettingsKey::PUPPET_FALLBACK_DIRECTORY, m_ui.fallbackPuppetPathLineEdit->path()); } if (!m_ui.puppetBuildPathLineEdit->path().isEmpty() && m_ui.puppetBuildPathLineEdit->path() != PuppetCreator::defaultPuppetToplevelBuildDirectory()) { settings.insert(DesignerSettingsKey::PUPPET_TOPLEVEL_BUILD_DIRECTORY, m_ui.puppetBuildPathLineEdit->path()); } settings.insert(DesignerSettingsKey::ALWAYS_SAFE_IN_CRUMBLEBAR, m_ui.alwaysSaveSubcomponentsCheckBox->isChecked()); settings.insert(DesignerSettingsKey::SHOW_PROPERTYEDITOR_WARNINGS, m_ui.showPropertyEditorWarningsCheckBox->isChecked()); settings.insert(DesignerSettingsKey::ENABLE_MODEL_EXCEPTION_OUTPUT, m_ui.showWarnExceptionsCheckBox->isChecked()); return settings; }
DesignerSettings SettingsPageWidget::settings() const { DesignerSettings settings = QmlDesignerPlugin::instance()->settings(); settings.insert(DesignerSettingsKey::ITEMSPACING, m_ui.spinItemSpacing->value()); settings.insert(DesignerSettingsKey::CONTAINERPADDING, m_ui.spinSnapMargin->value()); settings.insert(DesignerSettingsKey::CANVASWIDTH, m_ui.spinCanvasWidth->value()); settings.insert(DesignerSettingsKey::CANVASHEIGHT, m_ui.spinCanvasHeight->value()); settings.insert(DesignerSettingsKey::ROOT_ELEMENT_INIT_WIDTH, m_ui.spinRootItemInitWidth->value()); settings.insert(DesignerSettingsKey::ROOT_ELEMENT_INIT_HEIGHT, m_ui.spinRootItemInitHeight->value()); settings.insert(DesignerSettingsKey::WARNING_FOR_FEATURES_IN_DESIGNER, m_ui.designerWarningsCheckBox->isChecked()); settings.insert(DesignerSettingsKey::WARNING_FOR_QML_FILES_INSTEAD_OF_UIQML_FILES, m_ui.designerWarningsUiQmlfiles->isChecked()); settings.insert(DesignerSettingsKey::WARNING_FOR_DESIGNER_FEATURES_IN_EDITOR, m_ui.designerWarningsInEditorCheckBox->isChecked()); settings.insert(DesignerSettingsKey::SHOW_DEBUGVIEW, m_ui.designerShowDebuggerCheckBox->isChecked()); settings.insert(DesignerSettingsKey::ENABLE_DEBUGVIEW, m_ui.designerEnableDebuggerCheckBox->isChecked()); settings.insert(DesignerSettingsKey::USE_ONLY_FALLBACK_PUPPET, m_ui.useDefaultPuppetRadioButton->isChecked()); int typeOfQsTrFunction; if (m_ui.useQsTrFunctionRadioButton->isChecked()) typeOfQsTrFunction = 0; else if (m_ui.useQsTrIdFunctionRadioButton->isChecked()) typeOfQsTrFunction = 1; else if (m_ui.useQsTranslateFunctionRadioButton->isChecked()) typeOfQsTrFunction = 2; else typeOfQsTrFunction = 0; settings.insert(DesignerSettingsKey::TYPE_OF_QSTR_FUNCTION, typeOfQsTrFunction); settings.insert(DesignerSettingsKey::CONTROLS_STYLE, m_ui.styleLineEdit->text()); settings.insert(DesignerSettingsKey::FORWARD_PUPPET_OUTPUT, m_ui.forwardPuppetOutputComboBox->currentText()); settings.insert(DesignerSettingsKey::DEBUG_PUPPET, m_ui.debugPuppetComboBox->currentText()); QString newFallbackPuppetPath = m_ui.fallbackPuppetPathLineEdit->path(); QTC_CHECK(PuppetCreator::defaultPuppetFallbackDirectory() == m_ui.fallbackPuppetPathLineEdit->lineEdit()->placeholderText()); if (newFallbackPuppetPath.isEmpty()) newFallbackPuppetPath = m_ui.fallbackPuppetPathLineEdit->lineEdit()->placeholderText(); QString oldFallbackPuppetPath = settings.value(DesignerSettingsKey::PUPPET_FALLBACK_DIRECTORY, PuppetCreator::defaultPuppetFallbackDirectory()).toString(); if (oldFallbackPuppetPath != newFallbackPuppetPath) { settings.insert(DesignerSettingsKey::PUPPET_FALLBACK_DIRECTORY, newFallbackPuppetPath); } if (!m_ui.puppetBuildPathLineEdit->path().isEmpty() && m_ui.puppetBuildPathLineEdit->path() != PuppetCreator::defaultPuppetToplevelBuildDirectory()) { settings.insert(DesignerSettingsKey::PUPPET_TOPLEVEL_BUILD_DIRECTORY, m_ui.puppetBuildPathLineEdit->path()); } settings.insert(DesignerSettingsKey::ALWAYS_SAFE_IN_CRUMBLEBAR, m_ui.alwaysSaveSubcomponentsCheckBox->isChecked()); settings.insert(DesignerSettingsKey::SHOW_PROPERTYEDITOR_WARNINGS, m_ui.showPropertyEditorWarningsCheckBox->isChecked()); settings.insert(DesignerSettingsKey::ENABLE_MODEL_EXCEPTION_OUTPUT, m_ui.showWarnExceptionsCheckBox->isChecked()); return settings; }