From: Clarisse Genrault Date: Mon, 12 Sep 2016 06:57:13 +0000 (+0200) Subject: Adding the ability to have an icon for the label. X-Git-Url: http://git.salome-platform.org/gitweb/?a=commitdiff_plain;h=aed62e92417cd58184b2d03382e770ae700e99c5;p=modules%2Fshaper.git Adding the ability to have an icon for the label. --- diff --git a/src/ModuleBase/ModuleBase_WidgetLabel.cpp b/src/ModuleBase/ModuleBase_WidgetLabel.cpp index bab0894cb..dc194ea2e 100644 --- a/src/ModuleBase/ModuleBase_WidgetLabel.cpp +++ b/src/ModuleBase/ModuleBase_WidgetLabel.cpp @@ -9,6 +9,7 @@ #include #include #include +#include #include @@ -21,10 +22,17 @@ ModuleBase_WidgetLabel::ModuleBase_WidgetLabel(QWidget* theParent, : ModuleBase_ModelWidget(theParent, theData) { QString aText = QString::fromStdString(theData->getProperty("title")); - myLabel = new QLabel(aText, theParent); + QString aLabelIcon = QString::fromStdString(theData->getProperty("icon")); + + myLabel = new QLabel(aText, theParent); + if (!aLabelIcon.isEmpty()) { + myLabel->setPixmap(ModuleBase_IconFactory::loadPixmap(aLabelIcon)); + myLabel->setAlignment(Qt::AlignHCenter | Qt::AlignTop); + } else { + myLabel->setAlignment(Qt::AlignLeft | Qt::AlignTop); + } myLabel->setWordWrap(true); myLabel->setIndent(5); - myLabel->setAlignment(Qt::AlignLeft | Qt::AlignTop); myLabel->setContentsMargins(0,0,0,4); QVBoxLayout* aLayout = new QVBoxLayout(this);