Update of QT samples for problems: 1. Mouse selection issue is repeatable 2. Display...
authorbugmaster <>
Thu, 21 Apr 2011 10:01:21 +0000 (10:01 +0000)
committerbugmaster <bugmaster@opencascade.com>
Mon, 5 Mar 2012 15:27:41 +0000 (19:27 +0400)
samples/qt/Common/src/View.cxx
samples/qt/Common/src/View.h
samples/qt/voxeldemo/inc/Viewer.h
samples/qt/voxeldemo/src/Viewer.cpp

index c862324..ce7b137 100755 (executable)
@@ -146,6 +146,13 @@ myViewActions( 0 )
 
     initViewActions();
     initCursors();
+
+       setBackgroundRole( QPalette::NoRole );//NoBackground );
+       // set focus policy to threat QContextMenuEvent from keyboard  
+       setFocusPolicy( Qt::StrongFocus );
+       setAttribute( Qt::WA_PaintOnScreen );
+       setAttribute( Qt::WA_NoSystemBackground );
+
 }
 
 View::~View()
@@ -349,6 +356,14 @@ QList<QAction*>* View::getViewActions()
     return myViewActions;
 }
 
+/*!
+  Get paint engine for the OpenGL viewer. [ virtual public ]
+*/
+QPaintEngine* View::paintEngine() const
+{
+  return 0;
+}
+
 void View::initViewActions()
 {
   if ( myViewActions )
@@ -754,7 +769,7 @@ void View::DragEvent( const int x, const int y, const int TheState )
         theButtonDownY = y;
     }
 
-    if ( TheState == 0 )
+    if ( TheState == 1 )
     {
         myContext->Select( theButtonDownX, theButtonDownY, x, y, myView );
         emit selectionChanged();
index 5cdd36d..3d097b0 100755 (executable)
@@ -47,6 +47,7 @@ public:
                                                       Standard_Integer&,
                                                                              TopAbs_ShapeEnum& SelectionMode,
                                                                              Standard_Boolean& );
+       virtual QPaintEngine*          paintEngine() const;
 signals:
     void                          selectionChanged();
 
index dbd71fb..ee57227 100755 (executable)
@@ -27,6 +27,7 @@ public:
        Handle(V3d_View) getView() const { return myView; }
     Voxel_Selector& getSelector() { return mySelector; }
     void setPrs(const Handle(Voxel_Prs)& prs) { myPrs = prs; }
+       virtual QPaintEngine*          paintEngine() const;
 
 signals:
        
index d8a9a5a..d0304bf 100755 (executable)
@@ -63,6 +63,12 @@ Viewer::Viewer(QWidget* parent):QWidget(parent)
     myView->TriedronDisplay(Aspect_TOTP_LEFT_LOWER, Quantity_NOC_BLACK, 0.1, V3d_ZBUFFER);
 
     mySelector.Init(myView);
+
+       setBackgroundRole( QPalette::NoRole );//NoBackground );
+       // set focus policy to threat QContextMenuEvent from keyboard  
+       setFocusPolicy( Qt::StrongFocus );
+       setAttribute( Qt::WA_PaintOnScreen );
+       setAttribute( Qt::WA_NoSystemBackground );
 }
 
 Viewer::~Viewer()
@@ -77,6 +83,14 @@ void Viewer::paintEvent(QPaintEvent * pEvent)
 }
 
 
+/*!
+  Get paint engine for the OpenGL viewer. [ virtual public ]
+*/
+QPaintEngine* Viewer::paintEngine() const
+{
+  return 0;
+}
+
 void Viewer::resizeEvent(QResizeEvent * e)
 {
     if (!myView.IsNull())