From: Clarisse Genrault Date: Thu, 17 Nov 2016 10:16:05 +0000 (+0100) Subject: Add an icon for the widget "label". X-Git-Tag: V_2.6.0~81^2~2 X-Git-Url: http://git.salome-platform.org/gitweb/?a=commitdiff_plain;h=de8c05207ffd2dbc70569d3f29c1b08e4ffb7190;p=modules%2Fshaper.git Add an icon for the widget "label". --- diff --git a/src/ModuleBase/ModuleBase_WidgetLabel.cpp b/src/ModuleBase/ModuleBase_WidgetLabel.cpp index 170fb7c50..e111aa883 100644 --- a/src/ModuleBase/ModuleBase_WidgetLabel.cpp +++ b/src/ModuleBase/ModuleBase_WidgetLabel.cpp @@ -1,13 +1,16 @@ -// Copyright (C) 2014-20xx CEA/DEN, EDF R&D +// Copyright (C) 2014-2016 CEA/DEN, EDF R&D // File: ModuleBase_WidgetLabel.cpp // Created: 03 Dec 2014 // Author: Vitaly SMETANNIKOV +// Modified by Clarisse Genrault (CEA) : 17 Nov 2016 + #include "ModuleBase_WidgetLabel.h" #include #include +#include #include #include @@ -21,10 +24,16 @@ ModuleBase_WidgetLabel::ModuleBase_WidgetLabel(QWidget* theParent, : ModuleBase_ModelWidget(theParent, theData) { QString aText = QString::fromStdString(theData->getProperty("title")); + 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);