ProjectExplorer: Allow tool tips for bool aspects

Useful e.g. for Boot2Qt::PushToDeviceStep

Change-Id: I41f4a52ee7d3b0f18df8b2249232cfd0e4445ced
Reviewed-by: Christian Kandeler <christian.kandeler@qt.io>
This commit is contained in:
hjk
2018-10-22 18:34:55 +02:00
parent 0f5d5dbfe4
commit 5ebab9cd35
2 changed files with 8 additions and 0 deletions

View File

@@ -55,6 +55,7 @@ public:
bool m_value = false;
bool m_defaultValue = false;
QString m_label;
QString m_tooltip;
QPointer<QCheckBox> m_checkBox; // Owned by configuration widget
};
@@ -309,6 +310,7 @@ void BaseBoolAspect::addToConfigurationLayout(QFormLayout *layout)
QTC_CHECK(!d->m_checkBox);
d->m_checkBox = new QCheckBox(d->m_label, layout->parentWidget());
d->m_checkBox->setChecked(d->m_value);
d->m_checkBox->setToolTip(d->m_tooltip);
layout->addRow(QString(), d->m_checkBox);
connect(d->m_checkBox.data(), &QAbstractButton::clicked, this, [this] {
d->m_value = d->m_checkBox->isChecked();
@@ -353,6 +355,11 @@ void BaseBoolAspect::setLabel(const QString &label)
d->m_label = label;
}
void BaseBoolAspect::setToolTip(const QString &tooltip)
{
d->m_tooltip = tooltip;
}
/*!
\class ProjectExplorer::BaseIntegerAspect
*/

View File

@@ -58,6 +58,7 @@ public:
void setDefaultValue(bool defaultValue);
void setLabel(const QString &label);
void setToolTip(const QString &tooltip);
void fromMap(const QVariantMap &map) override;
void toMap(QVariantMap &map) const override;