CMakeProjectManager: Use Utils::InfoLabel in CMakeBuildSettingsWidget

Task-number: QTCREATORBUG-23346
Change-Id: I6f8928ad1ed8ac15d354c7105d95be941833ae0d
Reviewed-by: Cristian Adam <cristian.adam@qt.io>
This commit is contained in:
Alessandro Portale
2019-12-14 16:47:08 +01:00
parent 574174840e
commit 801275669a
2 changed files with 8 additions and 27 deletions

View File

@@ -42,10 +42,10 @@
#include <utils/detailswidget.h> #include <utils/detailswidget.h>
#include <utils/fancylineedit.h> #include <utils/fancylineedit.h>
#include <utils/headerviewstretcher.h> #include <utils/headerviewstretcher.h>
#include <utils/infolabel.h>
#include <utils/itemviews.h> #include <utils/itemviews.h>
#include <utils/pathchooser.h> #include <utils/pathchooser.h>
#include <utils/progressindicator.h> #include <utils/progressindicator.h>
#include <utils/utilsicons.h>
#include <QBoxLayout> #include <QBoxLayout>
#include <QCheckBox> #include <QCheckBox>
@@ -124,26 +124,14 @@ CMakeBuildSettingsWidget::CMakeBuildSettingsWidget(CMakeBuildConfiguration *bc)
mainLayout->addItem(new QSpacerItem(20, 10), row, 0); mainLayout->addItem(new QSpacerItem(20, 10), row, 0);
++row; ++row;
m_errorLabel = new QLabel; m_errorMessageLabel = new Utils::InfoLabel({}, Utils::InfoLabel::Error);
m_errorLabel->setPixmap(Utils::Icons::CRITICAL.pixmap());
m_errorLabel->setVisible(false);
m_errorMessageLabel = new QLabel;
m_errorMessageLabel->setVisible(false); m_errorMessageLabel->setVisible(false);
auto boxLayout = new QHBoxLayout; mainLayout->addWidget(m_errorMessageLabel, row, 0, 1, -1, Qt::AlignHCenter);
boxLayout->addWidget(m_errorLabel);
boxLayout->addWidget(m_errorMessageLabel);
mainLayout->addLayout(boxLayout, row, 0, 1, 3, Qt::AlignHCenter);
++row; ++row;
m_warningLabel = new QLabel; m_warningMessageLabel = new Utils::InfoLabel({}, Utils::InfoLabel::Warning);
m_warningLabel->setPixmap(Utils::Icons::WARNING.pixmap());
m_warningLabel->setVisible(false);
m_warningMessageLabel = new QLabel;
m_warningMessageLabel->setVisible(false); m_warningMessageLabel->setVisible(false);
auto boxLayout2 = new QHBoxLayout; mainLayout->addWidget(m_warningMessageLabel, row, 0, 1, -1, Qt::AlignHCenter);
boxLayout2->addWidget(m_warningLabel);
boxLayout2->addWidget(m_warningMessageLabel);
mainLayout->addLayout(boxLayout2, row, 0, 1, 3, Qt::AlignHCenter);
++row; ++row;
mainLayout->addItem(new QSpacerItem(20, 10), row, 0); mainLayout->addItem(new QSpacerItem(20, 10), row, 0);
@@ -345,21 +333,15 @@ CMakeBuildSettingsWidget::CMakeBuildSettingsWidget(CMakeBuildConfiguration *bc)
void CMakeBuildSettingsWidget::setError(const QString &message) void CMakeBuildSettingsWidget::setError(const QString &message)
{ {
bool showError = !message.isEmpty(); bool showError = !message.isEmpty();
m_errorLabel->setVisible(showError);
m_errorLabel->setToolTip(message);
m_errorMessageLabel->setVisible(showError); m_errorMessageLabel->setVisible(showError);
m_errorMessageLabel->setText(message); m_errorMessageLabel->setText(message);
m_errorMessageLabel->setToolTip(message);
} }
void CMakeBuildSettingsWidget::setWarning(const QString &message) void CMakeBuildSettingsWidget::setWarning(const QString &message)
{ {
bool showWarning = !message.isEmpty(); bool showWarning = !message.isEmpty();
m_warningLabel->setVisible(showWarning);
m_warningLabel->setToolTip(message);
m_warningMessageLabel->setVisible(showWarning); m_warningMessageLabel->setVisible(showWarning);
m_warningMessageLabel->setText(message); m_warningMessageLabel->setText(message);
m_warningMessageLabel->setToolTip(message);
} }
void CMakeBuildSettingsWidget::updateButtonState() void CMakeBuildSettingsWidget::updateButtonState()

View File

@@ -40,6 +40,7 @@ QT_END_NAMESPACE
namespace Utils { namespace Utils {
class CategorySortFilterModel; class CategorySortFilterModel;
class FancyLineEdit; class FancyLineEdit;
class InfoLabel;
class ProgressIndicator; class ProgressIndicator;
} // namespace Utils } // namespace Utils
@@ -86,10 +87,8 @@ private:
QPushButton *m_reconfigureButton; QPushButton *m_reconfigureButton;
QTimer m_showProgressTimer; QTimer m_showProgressTimer;
Utils::FancyLineEdit *m_filterEdit; Utils::FancyLineEdit *m_filterEdit;
QLabel *m_errorLabel; Utils::InfoLabel *m_errorMessageLabel;
QLabel *m_warningLabel; Utils::InfoLabel *m_warningMessageLabel;
QLabel *m_errorMessageLabel;
QLabel *m_warningMessageLabel;
}; };
} // namespace Internal } // namespace Internal