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(myText, theParent);
22 myLabel->setWordWrap(true);
23 myTooltip = QString::fromStdString(theData->getProperty("tooltip"));
24 myLabel->setToolTip(myTooltip);
27 QList<QWidget*> PartSet_WidgetSketchLabel::getControls() const
34 QWidget* PartSet_WidgetSketchLabel::getControl() const
39 void PartSet_WidgetSketchLabel::setOperationsMgr(XGUI_OperationMgr* theMgr)
41 ModuleBase_Operation* aOperation = theMgr->currentOperation();
42 if (aOperation->inherits("PartSet_OperationSketch")) {
43 PartSet_OperationSketch* aSketchOpe = static_cast<PartSet_OperationSketch*>(aOperation);
44 updateLabel(aSketchOpe);
45 connect(aSketchOpe, SIGNAL(planeSelected(double, double, double)), this,
46 SLOT(onPlaneSelected()));
50 void PartSet_WidgetSketchLabel::onPlaneSelected()
52 PartSet_OperationSketch* aSketchOpe = static_cast<PartSet_OperationSketch*>(sender());
53 updateLabel(aSketchOpe);
56 void PartSet_WidgetSketchLabel::updateLabel(PartSet_OperationSketch* theSketchOpe)
58 if (theSketchOpe->hasSketchPlane()) {
60 myLabel->setToolTip("");
62 myLabel->setText(myText);
63 myLabel->setToolTip(myTooltip);