1 // File: PartSet_WidgetSketchLabel.cpp
2 // Created: 07 July 2014
3 // Author: Vitaly SMETANNIKOV
5 #include "PartSet_WidgetSketchLabel.h"
6 #include "PartSet_OperationSketch.h"
8 #include <ModuleBase_Operation.h>
9 #include <XGUI_OperationMgr.h>
11 #include <Config_WidgetAPI.h>
15 PartSet_WidgetSketchLabel::PartSet_WidgetSketchLabel(QWidget* theParent,
16 const Config_WidgetAPI* theData,
17 const std::string& theParentId)
18 : ModuleBase_ModelWidget(theParent, theData, theParentId)
20 myText = QString::fromStdString(theData->getProperty("title"));
21 myLabel = new QLabel("", theParent);
22 myLabel->setWordWrap(true);
23 myTooltip = QString::fromStdString(theData->getProperty("tooltip"));
24 myLabel->setToolTip("");
25 myLabel->setIndent(5);
28 QList<QWidget*> PartSet_WidgetSketchLabel::getControls() const
35 QWidget* PartSet_WidgetSketchLabel::getControl() const
40 void PartSet_WidgetSketchLabel::setOperationsMgr(XGUI_OperationMgr* theMgr)
42 ModuleBase_Operation* aOperation = theMgr->currentOperation();
43 if (aOperation->inherits("PartSet_OperationSketch")) {
44 PartSet_OperationSketch* aSketchOpe = static_cast<PartSet_OperationSketch*>(aOperation);
45 updateLabel(aSketchOpe);
46 connect(aSketchOpe, SIGNAL(updatePropPanel()), this,
47 SLOT(onPlaneSelected()));
51 void PartSet_WidgetSketchLabel::onPlaneSelected()
53 PartSet_OperationSketch* aSketchOpe = static_cast<PartSet_OperationSketch*>(sender());
54 updateLabel(aSketchOpe);
57 void PartSet_WidgetSketchLabel::updateLabel(PartSet_OperationSketch* theSketchOpe)
59 if (theSketchOpe->hasSketchPlane()) {
61 myLabel->setToolTip("");
63 myLabel->setText(myText);
64 myLabel->setToolTip(myTooltip);