X-Git-Url: http://git.salome-platform.org/gitweb/?a=blobdiff_plain;f=src%2FXGUI%2FXGUI_ViewWindow.cpp;h=5a1a9ba4097ed64aeef7c13082fce24c09e0f8ae;hb=25df988cd1b0b85f45355f2c21c2642cd0ea1d74;hp=f02499857f78df73bddb95ad02a5685d725d5ed2;hpb=d0056935c51ba5ac91467176f37e2c359bb902f6;p=modules%2Fshaper.git diff --git a/src/XGUI/XGUI_ViewWindow.cpp b/src/XGUI/XGUI_ViewWindow.cpp index f02499857..5a1a9ba40 100644 --- a/src/XGUI/XGUI_ViewWindow.cpp +++ b/src/XGUI/XGUI_ViewWindow.cpp @@ -112,6 +112,8 @@ void ViewerToolbar::paintEvent(QPaintEvent* theEvent) style->drawPrimitive(QStyle::PE_IndicatorToolBarHandle, &aOpt, &aPainter, this); } + + //************************************************************************** ViewerLabel::ViewerLabel(QWidget* theParent, XGUI_ViewPort* thePort) : QLabel(theParent), myVPort(thePort), myResize(false) @@ -131,6 +133,7 @@ void ViewerLabel::paintEvent(QPaintEvent* theEvent) QImage aImg = myVPort->dumpView(aImgRect, myResize); if (!aImg.isNull()) QPainter(this).drawImage(aRect, aImg); + myResize = false; QLabel::paintEvent(theEvent); } @@ -154,7 +157,7 @@ XGUI_ViewWindow::XGUI_ViewWindow(XGUI_Viewer* theViewer, V3d_TypeOfView theType) myRotationPointSelection(false), myClosable(true), myStartX(0), myStartY(0), myCurrX(0), myCurrY(0), myCurScale(0.0), myCurSketch(0), - myDrawRect(false), myEnableDrawMode(true), myCursorIsHand(false), myEventStarted(false), + myDrawRect(false), myEnableDrawMode(false), myCursorIsHand(false), myEventStarted(false), myIsActive(false), myLastState(WindowNormalState), myOperation(NOTHING) { @@ -292,7 +295,6 @@ XGUI_ViewWindow::XGUI_ViewWindow(XGUI_Viewer* theViewer, V3d_TypeOfView theType) connect(myViewPort, SIGNAL(vpUpdated()), this, SLOT(updateToolBar())); connect(this, SIGNAL(vpTransformationFinished(XGUI_ViewWindow::OperationType)), this, SLOT(updateToolBar())); - } //**************************************************************** @@ -530,6 +532,10 @@ bool XGUI_ViewWindow::eventFilter(QObject *theObj, QEvent *theEvent) if (processViewPort(theEvent)) { return true; } + if (theEvent->type() == QEvent::KeyRelease) { + emit keyReleased(this, (QKeyEvent*) theEvent); + return true; + } } return QFrame::eventFilter(theObj, theEvent); } @@ -670,6 +676,16 @@ void XGUI_ViewWindow::vpMousePressEvent(QMouseEvent* theEvent) l_mbPressEvent = new QMouseEvent( *theEvent );*/ } +//**************************************************************** +void XGUI_ViewWindow::contextMenuEvent(QContextMenuEvent* theEvent) +{ + if (theEvent->modifiers() == Qt::NoModifier) { + // Temporary: has to be removed when viewer popup will be defined + //QFrame::contextMenuEvent(theEvent); + emit contextMenuRequested(theEvent); + } +} + //**************************************************************** void XGUI_ViewWindow::vpMouseReleaseEvent(QMouseEvent* theEvent) { @@ -686,10 +702,6 @@ void XGUI_ViewWindow::vpMouseReleaseEvent(QMouseEvent* theEvent) } */ emit mouseReleased(this, theEvent); - if (theEvent->button() == Qt::RightButton && prevState == -1) { - QContextMenuEvent aEvent(QContextMenuEvent::Mouse, theEvent->pos(), theEvent->globalPos()); - emit contextMenuRequested(&aEvent); - } } break; case ROTATE: @@ -1166,13 +1178,13 @@ void XGUI_ViewWindow::updateToolBar() myGripWgt->update(); myViewBar->update(); myWindowBar->update(); - //QTimer::singleShot(50, Qt::VeryCoarseTimer, this, SLOT(repaintToolBar())); } -/*void XGUI_ViewWindow::repaintToolBar() +/*! + \brief Update state of enable draw mode state. +*/ +void XGUI_ViewWindow::updateEnabledDrawMode() { - QApplication::sync(); - myGripWgt->repaint(); - myViewBar->repaint(); - myWindowBar->repaint(); -}*/ + myEnableDrawMode = myViewer->isSelectionEnabled() && + myViewer->isMultiSelectionEnabled(); +}