ProjectExplorer: Allow labels with pixmaps in string based aspects

Can be used to show warning icons etc.

Change-Id: I3ec845c11ea8147482ed90a0fac3c008bcffdec3
Reviewed-by: Tobias Hunger <tobias.hunger@qt.io>
This commit is contained in:
hjk
2018-09-03 17:14:58 +02:00
parent 37a8c901d2
commit 0a265ce266
2 changed files with 10 additions and 0 deletions

View File

@@ -350,6 +350,13 @@ void BaseStringAspect::setLabelText(const QString &labelText)
m_label->setText(labelText); m_label->setText(labelText);
} }
void BaseStringAspect::setLabelPixmap(const QPixmap &labelPixmap)
{
m_labelPixmap = labelPixmap;
if (m_label)
m_label->setPixmap(labelPixmap);
}
QString BaseStringAspect::labelText() const QString BaseStringAspect::labelText() const
{ {
return m_labelText; return m_labelText;
@@ -406,6 +413,7 @@ void BaseStringAspect::addToConfigurationLayout(QFormLayout *layout)
QWidget *parent = layout->parentWidget(); QWidget *parent = layout->parentWidget();
m_label = new QLabel(parent); m_label = new QLabel(parent);
m_label->setTextInteractionFlags(Qt::TextSelectableByMouse); m_label->setTextInteractionFlags(Qt::TextSelectableByMouse);
m_label->setPixmap(m_labelPixmap);
auto hbox = new QHBoxLayout; auto hbox = new QHBoxLayout;
switch (m_displayStyle) { switch (m_displayStyle) {

View File

@@ -173,6 +173,7 @@ public:
QString labelText() const; QString labelText() const;
void setLabelText(const QString &labelText); void setLabelText(const QString &labelText);
void setLabelPixmap(const QPixmap &labelPixmap);
void setDisplayFilter(const std::function<QString (const QString &)> &displayFilter); void setDisplayFilter(const std::function<QString (const QString &)> &displayFilter);
void setPlaceHolderText(const QString &placeHolderText); void setPlaceHolderText(const QString &placeHolderText);
@@ -209,6 +210,7 @@ private:
QPointer<QLabel> m_labelDisplay; QPointer<QLabel> m_labelDisplay;
QPointer<Utils::FancyLineEdit> m_lineEditDisplay; QPointer<Utils::FancyLineEdit> m_lineEditDisplay;
QPointer<Utils::PathChooser> m_pathChooserDisplay; QPointer<Utils::PathChooser> m_pathChooserDisplay;
QPixmap m_labelPixmap;
}; };
class PROJECTEXPLORER_EXPORT ExecutableAspect : public IRunConfigurationAspect class PROJECTEXPLORER_EXPORT ExecutableAspect : public IRunConfigurationAspect