void PartSet_WidgetSketchLabel::activateCustom()
{
+ QWidget* aTopWidget = window();
+ if (aTopWidget)
+ aTopWidget->installEventFilter(this);
+
PartSet_Module* aModule = dynamic_cast<PartSet_Module*>(myWorkshop->module());
if (aModule) {
bool isBlocked = myAutoConstraints->blockSignals(true);
QTimer::singleShot(10, this, SLOT(onShowPanel()));
}
+void PartSet_WidgetSketchLabel::hideEvent(QHideEvent* theEvent)
+{
+ ModuleBase_WidgetValidated::hideEvent(theEvent);
+ if (myPartSetMessage->isVisible())
+ myPartSetMessage->hide();
+ if (mySizeMessage->isVisible())
+ mySizeMessage->hide();
+}
+
+
void PartSet_WidgetSketchLabel::onShowPanel()
{
//if (mySizeOfViewWidget->isVisible()) {
void PartSet_WidgetSketchLabel::deactivate()
{
+ QWidget* aTopWidget = window();
+ if (aTopWidget)
+ aTopWidget->removeEventFilter(this);
+
if (myTmpPlane.get()) {
setSketchPlane(myTmpPlane);
myTmpPlane.reset();
Events_Loop::loop()->flush(anEvent);
}
}
+
+bool PartSet_WidgetSketchLabel::eventFilter(QObject* theObj, QEvent* theEvent)
+{
+ if (theObj == window()) {
+ int aType = theEvent->type();
+ if ((aType == QEvent::Hide) || (aType == QEvent::WindowDeactivate)) {
+ if (myPartSetMessage->isVisible())
+ myPartSetMessage->hide();
+ if (mySizeMessage->isVisible())
+ mySizeMessage->hide();
+ }
+ else if ((aType == QEvent::Show) || (aType == QEvent::WindowActivate))
+ onShowPanel();
+ }
+ return ModuleBase_WidgetValidated::eventFilter(theObj, theEvent);
+}
\ No newline at end of file
/// \param thePrs a presentation
bool fillSketchPlaneBySelection(const std::shared_ptr<ModuleBase_ViewerPrs>& thePrs);
-
+ /// Redefinition of a virtual function
virtual void showEvent(QShowEvent* theEvent);
+ /// Redefinition of a virtual function
+ virtual void hideEvent(QHideEvent* theEvent);
+
+ /// Redefinition of a virtual function
+ virtual bool eventFilter(QObject* theObj, QEvent* theEvent);
+
private slots:
/// A slot called on set sketch plane view
void onSetPlaneView();