forked from qt-creator/qt-creator
ClangTools: Allow selecting diagnostic config for project
When starting the Clazy/Tidy tool, allow to select the diagnostic configuration for the run. As a side effect, fix a race condition where the runner could end up with no diagnostic config (removed during run) - copy the diagnostic config instead of referencing/querying it by the id. Change-Id: Iedafa8f31a3bbd233d65818fe8de16add1e4d443 Reviewed-by: Ivan Donchevskii <ivan.donchevskii@qt.io>
This commit is contained in:
@@ -69,12 +69,13 @@ static void connectToClangDiagnosticConfigsDialog(QPushButton *button)
|
||||
|
||||
ClangDiagnosticConfigsSelectionWidget::ClangDiagnosticConfigsSelectionWidget(QWidget *parent)
|
||||
: QWidget(parent)
|
||||
, m_label(new QLabel(tr("Diagnostic Configuration:"), this))
|
||||
, m_selectionComboBox(new QComboBox(this))
|
||||
{
|
||||
auto *layout = new QHBoxLayout(this);
|
||||
layout->setMargin(0);
|
||||
setLayout(layout);
|
||||
layout->addWidget(new QLabel(tr("Diagnostic Configuration:"), this));
|
||||
layout->addWidget(m_label);
|
||||
layout->addWidget(m_selectionComboBox);
|
||||
auto *manageButton = new QPushButton(tr("Manage..."), this);
|
||||
layout->addWidget(manageButton);
|
||||
@@ -133,4 +134,9 @@ void ClangDiagnosticConfigsSelectionWidget::refresh(Core::Id id)
|
||||
connectToCurrentIndexChanged();
|
||||
}
|
||||
|
||||
void ClangDiagnosticConfigsSelectionWidget::showLabel(bool show)
|
||||
{
|
||||
m_label->setVisible(show);
|
||||
}
|
||||
|
||||
} // CppTools namespace
|
||||
|
||||
@@ -33,6 +33,7 @@
|
||||
|
||||
QT_BEGIN_NAMESPACE
|
||||
class QComboBox;
|
||||
class QLabel;
|
||||
QT_END_NAMESPACE
|
||||
|
||||
namespace CppTools {
|
||||
@@ -48,6 +49,8 @@ public:
|
||||
|
||||
void refresh(Core::Id id);
|
||||
|
||||
void showLabel(bool show);
|
||||
|
||||
signals:
|
||||
void currentConfigChanged(const Core::Id ¤tConfigId);
|
||||
|
||||
@@ -58,6 +61,7 @@ private:
|
||||
QMetaObject::Connection m_currentIndexChangedConnection;
|
||||
ClangDiagnosticConfigsModel m_diagnosticConfigsModel;
|
||||
|
||||
QLabel *m_label = nullptr;
|
||||
QComboBox *m_selectionComboBox = nullptr;
|
||||
};
|
||||
|
||||
|
||||
Reference in New Issue
Block a user