45 m_zoomCombo(
new QComboBox)
47 m_zoomCombo->setEditable(
false);
48 const QList<
int> &zoomValues = ZoomMenu::zoomValues();
49 for (
int z : zoomValues) {
51 m_zoomCombo->addItem(QCoreApplication::translate(
"FormEditorOptionsPage",
"%1 %").arg(z), QVariant(z));
56 setTitle(QCoreApplication::translate(
"FormEditorOptionsPage",
"Preview Zoom"));
57 QFormLayout *lt =
new QFormLayout;
58 lt->addRow(QCoreApplication::translate(
"FormEditorOptionsPage",
"Default Zoom"), m_zoomCombo);
92 QWidget *optionsWidget =
new QWidget(parent);
94 const QDesignerSharedSettings settings(m_core);
95 m_previewConf =
new PreviewConfigurationWidget(m_core);
96 m_zoomSettingsWidget =
new ZoomSettingsWidget;
97 m_zoomSettingsWidget->fromSettings(settings);
99 m_defaultGridConf =
new GridPanel();
100 m_defaultGridConf->setTitle(QCoreApplication::translate(
"FormEditorOptionsPage",
"Default Grid"));
101 m_defaultGridConf->setGrid(settings.defaultGrid());
103 const QString namingTitle =
104 QCoreApplication::translate(
"FormEditorOptionsPage",
"Object Naming Convention");
105 QGroupBox *namingGroupBox =
new QGroupBox(namingTitle);
106 const QString namingToolTip =
107 QCoreApplication::translate(
"FormEditorOptionsPage",
108 "Naming convention used for generating action object names from their text");
109 namingGroupBox->setToolTip(namingToolTip);
110 QHBoxLayout *namingHLayout =
new QHBoxLayout(namingGroupBox);
111 m_namingComboBox =
new QComboBox;
112 m_namingComboBox->setToolTip(namingToolTip);
114 items << QCoreApplication::translate(
"FormEditorOptionsPage",
"Camel Case")
115 << QCoreApplication::translate(
"FormEditorOptionsPage",
"Underscore");
116 m_namingComboBox->addItems(items);
117 m_namingComboBox->setCurrentIndex(settings.objectNamingMode());
118 namingHLayout->addWidget(m_namingComboBox.data());
120 QVBoxLayout *optionsVLayout =
new QVBoxLayout();
121 optionsVLayout->addWidget(m_defaultGridConf);
122 optionsVLayout->addWidget(m_previewConf);
123 optionsVLayout->addWidget(m_zoomSettingsWidget);
124 optionsVLayout->addWidget(namingGroupBox);
125 optionsVLayout->addStretch(1);
128 QHBoxLayout *optionsHLayout =
new QHBoxLayout();
129 optionsHLayout->addLayout(optionsVLayout);
130 optionsHLayout->addStretch(1);
131 optionsWidget->setLayout(optionsHLayout);
133 return optionsWidget;
139 if (m_defaultGridConf) {
140 const Grid defaultGrid = m_defaultGridConf->grid();
141 settings.setDefaultGrid(defaultGrid);
143 FormWindowBase::setDefaultDesignerGrid(defaultGrid);
145 QDesignerFormWindowManagerInterface *fwm = m_core->formWindowManager();
146 if (
const int numWindows = fwm->formWindowCount()) {
147 for (
int i = 0; i < numWindows; i++)
148 if (qdesigner_internal::FormWindowBase *fwb
149 = qobject_cast<qdesigner_internal::FormWindowBase *>( fwm->formWindow(i)))
150 if (!fwb->hasFormGrid())
151 fwb->setDesignerGrid(defaultGrid);
155 m_previewConf->saveState();
158 if (m_zoomSettingsWidget)
159 m_zoomSettingsWidget->toSettings(settings);
161 if (m_namingComboBox) {
163 =
static_cast<ObjectNamingMode>(m_namingComboBox->currentIndex());
164 settings.setObjectNamingMode(namingMode);
165 ActionEditor::setObjectNamingMode(namingMode);