CppTools: Merge diagnostic selection widgets together

QComboBox, QLabel and QPushButton are always used
together. Therefore it makes sense to put them in one
custom widget.

Change-Id: Ie21675530fbadd7071f2a362567dadb6f09bb68d
Reviewed-by: Nikolai Kosjar <nikolai.kosjar@qt.io>
This commit is contained in:
Ivan Donchevskii
2018-05-14 10:30:09 +02:00
parent f46fb39f3c
commit 53d7906061
10 changed files with 88 additions and 177 deletions

View File

@@ -59,7 +59,7 @@ ClangProjectSettingsWidget::ClangProjectSettingsWidget(ProjectExplorer::Project
using namespace CppTools;
m_ui.generalConfigurationGroupBox->setVisible(Utils::HostOsInfo::isWindowsHost());
m_ui.delayedTemplateParse->setVisible(Utils::HostOsInfo::isWindowsHost());
m_ui.clangSettings->setCurrentIndex(m_projectSettings.useGlobalConfig() ? 0 : 1);
@@ -78,8 +78,6 @@ ClangProjectSettingsWidget::ClangProjectSettingsWidget(ProjectExplorer::Project
connect(CppTools::codeModelSettings().data(), &CppTools::CppCodeModelSettings::changed,
this, &ClangProjectSettingsWidget::syncOtherWidgetsToComboBox);
connectToClangDiagnosticConfigsDialog(m_ui.manageButton);
syncOtherWidgetsToComboBox();
}
@@ -124,9 +122,13 @@ void ClangProjectSettingsWidget::syncOtherWidgetsToComboBox()
options.contains(QLatin1String{ClangProjectSettings::DelayedTemplateParsing}));
const bool isCustom = !m_projectSettings.useGlobalConfig();
m_ui.generalConfigurationGroupBox->setEnabled(isCustom);
m_ui.clangDiagnosticsLabel->setEnabled(isCustom);
m_ui.clangDiagnosticConfigsSelectionWidget->setEnabled(isCustom);
m_ui.delayedTemplateParse->setEnabled(isCustom);
for (int i = 0; i < m_ui.clangDiagnosticConfigsSelectionWidget->layout()->count(); ++i) {
QWidget *widget = m_ui.clangDiagnosticConfigsSelectionWidget->layout()->itemAt(i)->widget();
if (widget)
widget->setEnabled(isCustom);
}
refreshDiagnosticConfigsWidgetFromSettings();
}

View File

@@ -35,64 +35,18 @@
</widget>
</item>
<item>
<widget class="QGroupBox" name="generalConfigurationGroupBox">
<property name="sizePolicy">
<sizepolicy hsizetype="Preferred" vsizetype="Minimum">
<horstretch>0</horstretch>
<verstretch>0</verstretch>
</sizepolicy>
</property>
<property name="title">
<string>General</string>
</property>
<layout class="QVBoxLayout" name="verticalLayout_3">
<item>
<widget class="QCheckBox" name="delayedTemplateParse">
<property name="toolTip">
<string>Parse templates in a MSVC-compliant way. This helps to parse headers for example from Active Template Library (ATL) or Windows Runtime Library (WRL).
<widget class="QCheckBox" name="delayedTemplateParse">
<property name="toolTip">
<string>Parse templates in a MSVC-compliant way. This helps to parse headers for example from Active Template Library (ATL) or Windows Runtime Library (WRL).
However, using the relaxed and extended rules means also that no highlighting/completion can be provided within template functions.</string>
</property>
<property name="text">
<string>Enable MSVC-compliant template parsing</string>
</property>
</widget>
</item>
</layout>
</property>
<property name="text">
<string>Enable MSVC-compliant template parsing</string>
</property>
</widget>
</item>
<item>
<layout class="QHBoxLayout" name="clangDiagnosticsLayout">
<item>
<widget class="QLabel" name="clangDiagnosticsLabel">
<property name="text">
<string>Diagnostic Configuration:</string>
</property>
</widget>
</item>
<item>
<widget class="CppTools::ClangDiagnosticConfigsSelectionWidget" name="clangDiagnosticConfigsSelectionWidget" native="true"/>
</item>
<item>
<widget class="QPushButton" name="manageButton">
<property name="text">
<string>Manage...</string>
</property>
</widget>
</item>
<item>
<spacer name="horizontalSpacer">
<property name="orientation">
<enum>Qt::Horizontal</enum>
</property>
<property name="sizeHint" stdset="0">
<size>
<width>40</width>
<height>20</height>
</size>
</property>
</spacer>
</item>
</layout>
<widget class="CppTools::ClangDiagnosticConfigsSelectionWidget" name="clangDiagnosticConfigsSelectionWidget" native="true"/>
</item>
<item>
<spacer name="verticalSpacer">