forked from qt-creator/qt-creator
ClangTools: Use Utils::InfoLabel in ClangDiagnosticConfigsWidget
Task-number: QTCREATORBUG-23346 Change-Id: I39016adae451c5212643e412d5700b89915cb2e4 Reviewed-by: Cristian Adam <cristian.adam@qt.io>
This commit is contained in:
@@ -31,7 +31,6 @@
|
||||
|
||||
#include <utils/executeondestruction.h>
|
||||
#include <utils/treemodel.h>
|
||||
#include <utils/utilsicons.h>
|
||||
|
||||
#include <QInputDialog>
|
||||
#include <QPushButton>
|
||||
@@ -309,9 +308,9 @@ void ClangDiagnosticConfigsWidget::sync()
|
||||
m_clangBaseChecksWidget->setEnabled(!config.isReadOnly());
|
||||
|
||||
if (config.isReadOnly()) {
|
||||
m_ui->infoIcon->setPixmap(Utils::Icons::INFO.pixmap());
|
||||
m_ui->infoLabel->setType(Utils::InfoLabel::Information);
|
||||
m_ui->infoLabel->setText(tr("Copy this configuration to customize it."));
|
||||
m_ui->infoLabel->setStyleSheet(QString());
|
||||
m_ui->infoLabel->setFilled(false);
|
||||
}
|
||||
|
||||
syncExtraWidgets(config);
|
||||
@@ -334,21 +333,15 @@ void ClangDiagnosticConfigsWidget::setDiagnosticOptions(const QString &options)
|
||||
|
||||
void ClangDiagnosticConfigsWidget::updateValidityWidgets(const QString &errorMessage)
|
||||
{
|
||||
QString validationResult;
|
||||
const Utils::Icon *icon = nullptr;
|
||||
QString styleSheet;
|
||||
if (errorMessage.isEmpty()) {
|
||||
icon = &Utils::Icons::INFO;
|
||||
validationResult = tr("Configuration passes sanity checks.");
|
||||
m_ui->infoLabel->setType(Utils::InfoLabel::Information);
|
||||
m_ui->infoLabel->setText(tr("Configuration passes sanity checks."));
|
||||
m_ui->infoLabel->setFilled(false);
|
||||
} else {
|
||||
icon = &Utils::Icons::CRITICAL;
|
||||
validationResult = tr("%1").arg(errorMessage);
|
||||
styleSheet = "color: red;";
|
||||
m_ui->infoLabel->setType(Utils::InfoLabel::Error);
|
||||
m_ui->infoLabel->setText(tr("%1").arg(errorMessage));
|
||||
m_ui->infoLabel->setFilled(true);
|
||||
}
|
||||
|
||||
m_ui->infoIcon->setPixmap(icon->pixmap());
|
||||
m_ui->infoLabel->setText(validationResult);
|
||||
m_ui->infoLabel->setStyleSheet(styleSheet);
|
||||
}
|
||||
|
||||
void ClangDiagnosticConfigsWidget::connectClangOnlyOptionsChanged()
|
||||
|
@@ -62,35 +62,11 @@
|
||||
<item>
|
||||
<layout class="QVBoxLayout" name="verticalLayout">
|
||||
<item>
|
||||
<layout class="QHBoxLayout" name="horizontalLayout_2">
|
||||
<item>
|
||||
<widget class="QLabel" name="infoIcon">
|
||||
<property name="text">
|
||||
<string>InfoIcon</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item>
|
||||
<widget class="QLabel" name="infoLabel">
|
||||
<property name="text">
|
||||
<string>InfoText</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="Utils::InfoLabel" name="infoLabel">
|
||||
<property name="text">
|
||||
<string>InfoText</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item>
|
||||
<widget class="QTabWidget" name="tabWidget"/>
|
||||
@@ -99,6 +75,13 @@
|
||||
</item>
|
||||
</layout>
|
||||
</widget>
|
||||
<customwidgets>
|
||||
<customwidget>
|
||||
<class>Utils::InfoLabel</class>
|
||||
<extends>QLabel</extends>
|
||||
<header location="global">utils/infolabel.h</header>
|
||||
</customwidget>
|
||||
</customwidgets>
|
||||
<resources/>
|
||||
<connections/>
|
||||
</ui>
|
||||
|
Reference in New Issue
Block a user