forked from qt-creator/qt-creator
CppEditor: Introduce QuickFix settings and unify getter/setter generation
Introduces a QuickFix settings page where the generation of getters and setters can be customized. The settings can be saved into a file that can go into a VCS. All QuickFixes that generate getter/setter/signals/ Q_PROPERTIES now use the same backend. QuickFixes that generate getters/ setters are now extended to also generate signals and Q_PROPERTIES. Fixes: QTCREATORBUG-1532 Fixes: QTCREATORBUG-17941 Fixes: QTCREATORBUG-12678 Fixes: QTCREATORBUG-15779 Fixes: QTCREATORBUG-11620 Fixes: QTCREATORBUG-22707 Fixes: QTCREATORBUG-20157 Fixes: QTCREATORBUG-21804 Fixes: QTCREATORBUG-19814 Fixes: QTCREATORBUG-14622 Fixes: QTCREATORBUG-19803 Change-Id: I50ed2dad9b4a637fbd87b3e1f2856060ad0ad920 Reviewed-by: Christian Kandeler <christian.kandeler@qt.io>
This commit is contained in:
@@ -83,6 +83,8 @@ public:
|
||||
// b
|
||||
bool alignAssignments = false;
|
||||
|
||||
// TODO only kept to allow conversion to the new setting getterNameTemplate in
|
||||
// CppEditor/QuickFixSetting. Remove in 4.16
|
||||
bool preferGetterNameWithoutGetPrefix = true;
|
||||
|
||||
void toSettings(const QString &category, QSettings *s) const;
|
||||
|
||||
@@ -157,8 +157,6 @@ CppCodeStylePreferencesWidget::CppCodeStylePreferencesWidget(QWidget *parent)
|
||||
this, &CppCodeStylePreferencesWidget::slotCodeStyleSettingsChanged);
|
||||
connect(m_ui->bindStarToRightSpecifier, &QCheckBox::toggled,
|
||||
this, &CppCodeStylePreferencesWidget::slotCodeStyleSettingsChanged);
|
||||
connect(m_ui->preferGetterNamesWithoutGet, &QCheckBox::toggled,
|
||||
this, &CppCodeStylePreferencesWidget::slotCodeStyleSettingsChanged);
|
||||
|
||||
m_ui->categoryTab->setCurrentIndex(0);
|
||||
}
|
||||
@@ -216,7 +214,6 @@ CppCodeStyleSettings CppCodeStylePreferencesWidget::cppCodeStyleSettings() const
|
||||
set.bindStarToRightSpecifier = m_ui->bindStarToRightSpecifier->isChecked();
|
||||
set.extraPaddingForConditionsIfConfusingAlign = m_ui->extraPaddingConditions->isChecked();
|
||||
set.alignAssignments = m_ui->alignAssignments->isChecked();
|
||||
set.preferGetterNameWithoutGetPrefix = m_ui->preferGetterNamesWithoutGet->isChecked();
|
||||
|
||||
return set;
|
||||
}
|
||||
@@ -250,7 +247,6 @@ void CppCodeStylePreferencesWidget::setCodeStyleSettings(const CppCodeStyleSetti
|
||||
m_ui->bindStarToRightSpecifier->setChecked(s.bindStarToRightSpecifier);
|
||||
m_ui->extraPaddingConditions->setChecked(s.extraPaddingForConditionsIfConfusingAlign);
|
||||
m_ui->alignAssignments->setChecked(s.alignAssignments);
|
||||
m_ui->preferGetterNamesWithoutGet->setChecked(s.preferGetterNameWithoutGetPrefix);
|
||||
m_blockUpdates = wasBlocked;
|
||||
if (preview)
|
||||
updatePreview();
|
||||
|
||||
@@ -433,33 +433,6 @@ if they would align to the next line</string>
|
||||
</item>
|
||||
</layout>
|
||||
</widget>
|
||||
<widget class="QWidget" name="getterSetterTab">
|
||||
<attribute name="title">
|
||||
<string>Getter and Setter</string>
|
||||
</attribute>
|
||||
<layout class="QVBoxLayout" name="verticalLayout_7">
|
||||
<item>
|
||||
<widget class="QCheckBox" name="preferGetterNamesWithoutGet">
|
||||
<property name="text">
|
||||
<string>Prefer getter names without "get"</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item>
|
||||
<spacer name="verticalSpacer_7">
|
||||
<property name="orientation">
|
||||
<enum>Qt::Vertical</enum>
|
||||
</property>
|
||||
<property name="sizeHint" stdset="0">
|
||||
<size>
|
||||
<width>20</width>
|
||||
<height>40</height>
|
||||
</size>
|
||||
</property>
|
||||
</spacer>
|
||||
</item>
|
||||
</layout>
|
||||
</widget>
|
||||
</widget>
|
||||
</item>
|
||||
</layout>
|
||||
|
||||
Reference in New Issue
Block a user