From: vsv Date: Thu, 7 Nov 2019 13:50:53 +0000 (+0300) Subject: Task 5.2.5 Add some warnings (tooltips) to critical places X-Git-Tag: V9_5_0a1~166^2~20 X-Git-Url: http://git.salome-platform.org/gitweb/?a=commitdiff_plain;h=d4f8c8352b15051ed112c64a20fbd93d302dc94c;p=modules%2Fshaper.git Task 5.2.5 Add some warnings (tooltips) to critical places --- diff --git a/src/PartSet/PartSet_WidgetSketchLabel.cpp b/src/PartSet/PartSet_WidgetSketchLabel.cpp index 0dde98c1c..f4514b927 100644 --- a/src/PartSet/PartSet_WidgetSketchLabel.cpp +++ b/src/PartSet/PartSet_WidgetSketchLabel.cpp @@ -78,6 +78,7 @@ #include #include #include +#include #ifndef DBL_MAX #define DBL_MAX 1.7976931348623158e+308 @@ -112,6 +113,23 @@ myIsSelection(false) mySizeOfView->setValidator(aValidator); aSizeLayout->addWidget(mySizeOfView); + myPartSetMessage = new QDialog(this, Qt::ToolTip); + myPartSetMessage->setModal(false); + myPartSetMessage->setStyleSheet("background-color:lightyellow;"); + QVBoxLayout* aMsgLay = new QVBoxLayout(myPartSetMessage); + QString aMsg = tr("The Sketch is created in PartSet.\n" + "It will be necessary to create a Part in order to use this sketch for body creation"); + aMsgLay->addWidget(new QLabel(aMsg, myPartSetMessage)); + myPartSetMessage->hide(); + + mySizeMessage = new QDialog(mySizeOfView, Qt::ToolTip); + mySizeMessage->setModal(false); + mySizeMessage->setStyleSheet("background-color:lightyellow;"); + aMsgLay = new QVBoxLayout(mySizeMessage); + aMsg = tr("A size of Sketch view can be defined here."); + aMsgLay->addWidget(new QLabel(aMsg, mySizeMessage)); + mySizeMessage->hide(); + QString aText = translate(theData->getProperty("title")); QLabel* aLabel = new QLabel(aText, aFirstWgt); aLabel->setWordWrap(true); @@ -309,6 +327,10 @@ void PartSet_WidgetSketchLabel::updateByPlaneSelected(const ModuleBase_ViewerPrs GeomPlanePtr aPlane = plane(); if (!aPlane.get()) return; + + myPartSetMessage->hide(); + mySizeMessage->hide(); + // 1. hide main planes if they have been displayed and display sketch preview plane myPreviewPlanes->erasePreviewPlanes(myWorkshop); @@ -548,6 +570,21 @@ void PartSet_WidgetSketchLabel::activateCustom() mySizeOfViewWidget->setVisible(false); } +void PartSet_WidgetSketchLabel::showEvent(QShowEvent* theEvent) +{ + if (mySizeOfViewWidget->isVisible()) { + DocumentPtr aDoc = feature()->document(); + DocumentPtr aModDoc = ModelAPI_Session::get()->moduleDocument(); + if (aModDoc == aDoc) { + myPartSetMessage->move(mapToGlobal(geometry().bottomLeft())); + myPartSetMessage->show(); + } + mySizeMessage->move(mySizeOfView->mapToGlobal(mySizeOfView->geometry().center())); + mySizeMessage->show(); + } +} + + void PartSet_WidgetSketchLabel::deactivate() { ModuleBase_WidgetValidated::deactivate(); diff --git a/src/PartSet/PartSet_WidgetSketchLabel.h b/src/PartSet/PartSet_WidgetSketchLabel.h index fe9c14716..fbc339502 100644 --- a/src/PartSet/PartSet_WidgetSketchLabel.h +++ b/src/PartSet/PartSet_WidgetSketchLabel.h @@ -41,6 +41,7 @@ class XGUI_Workshop; class QCheckBox; class QStackedWidget; class QLineEdit; +class QDialog; /** * \ingroup Modules @@ -193,6 +194,9 @@ protected: /// \param thePrs a presentation bool fillSketchPlaneBySelection(const std::shared_ptr& thePrs); + + virtual void showEvent(QShowEvent* theEvent); + private slots: /// A slot called on set sketch plane view void onSetPlaneView(); @@ -238,6 +242,9 @@ private: bool myOpenTransaction; bool myIsSelection; + + QDialog* myPartSetMessage; + QDialog* mySizeMessage; }; #endif