From dc1fafd699d49eea9be6862eb0fd5b79521a7a0d Mon Sep 17 00:00:00 2001 From: mkr Date: Tue, 5 Jun 2007 13:05:42 +0000 Subject: [PATCH] Porting to Qt4. --- src/GLViewer/GLViewer_AspectLine.cxx | 3 +- src/GLViewer/GLViewer_AspectLine.h | 2 +- src/GLViewer/GLViewer_BaseDrawers.cxx | 26 ++-- src/GLViewer/GLViewer_BaseDrawers.h | 6 +- src/GLViewer/GLViewer_BaseObjects.cxx | 98 ++++++------ src/GLViewer/GLViewer_BaseObjects.h | 39 +++-- src/GLViewer/GLViewer_Compass.h | 4 +- src/GLViewer/GLViewer_Context.cxx | 26 ++-- src/GLViewer/GLViewer_Context.h | 4 +- src/GLViewer/GLViewer_Defs.h | 6 +- src/GLViewer/GLViewer_Drawer.cxx | 34 +++-- src/GLViewer/GLViewer_Drawer.h | 11 +- src/GLViewer/GLViewer_Geom.h | 8 +- src/GLViewer/GLViewer_Grid.cxx | 1 - ...r_MimeSource.cxx => GLViewer_MimeData.cxx} | 41 ++--- ...iewer_MimeSource.h => GLViewer_MimeData.h} | 26 ++-- src/GLViewer/GLViewer_Object.cxx | 18 ++- src/GLViewer/GLViewer_Object.h | 11 +- src/GLViewer/GLViewer_Selector.cxx | 2 +- src/GLViewer/GLViewer_Selector.h | 6 +- src/GLViewer/GLViewer_Selector2d.cxx | 3 +- src/GLViewer/GLViewer_Text.cxx | 12 +- src/GLViewer/GLViewer_Text.h | 7 +- src/GLViewer/GLViewer_ToolTip.cxx | 25 +-- src/GLViewer/GLViewer_ToolTip.h | 4 +- src/GLViewer/GLViewer_Tools.h | 3 - src/GLViewer/GLViewer_ViewFrame.cxx | 80 +++++----- src/GLViewer/GLViewer_ViewFrame.h | 4 +- src/GLViewer/GLViewer_ViewManager.cxx | 3 +- src/GLViewer/GLViewer_ViewManager.h | 2 +- src/GLViewer/GLViewer_ViewPort.cxx | 105 +++++++------ src/GLViewer/GLViewer_ViewPort.h | 10 +- src/GLViewer/GLViewer_ViewPort2d.cxx | 99 ++++++------ src/GLViewer/GLViewer_ViewPort2d.h | 13 +- src/GLViewer/GLViewer_Viewer.cxx | 143 ++++++++++++------ src/GLViewer/GLViewer_Viewer.h | 30 +++- src/GLViewer/GLViewer_Viewer2d.cxx | 116 +++++++------- src/GLViewer/GLViewer_Viewer2d.h | 19 ++- src/GLViewer/GLViewer_Widget.cxx | 47 ++++-- src/GLViewer/GLViewer_Widget.h | 7 +- src/GLViewer/Makefile.am | 4 +- src/Makefile.am | 2 +- src/OCCViewer/OCCViewer_ViewWindow.cxx | 6 +- src/SVTK/SVTK_InteractorStyle.cxx | 6 +- src/VTKViewer/VTKViewer_InteractorStyle.cxx | 6 +- src/src.pro | 1 + 46 files changed, 640 insertions(+), 489 deletions(-) rename src/GLViewer/{GLViewer_MimeSource.cxx => GLViewer_MimeData.cxx} (84%) rename src/GLViewer/{GLViewer_MimeSource.h => GLViewer_MimeData.h} (72%) diff --git a/src/GLViewer/GLViewer_AspectLine.cxx b/src/GLViewer/GLViewer_AspectLine.cxx index 6a91af84c..591fdff32 100644 --- a/src/GLViewer/GLViewer_AspectLine.cxx +++ b/src/GLViewer/GLViewer_AspectLine.cxx @@ -127,7 +127,8 @@ QByteArray GLViewer_AspectLine::getByteCopy() const int aHR = myHColor.red(), aHG = myHColor.green(), aHB = myHColor.blue(); int aSR = mySColor.red(), aSG = mySColor.green(), aSB = mySColor.blue(); - QByteArray aResult( anISize * 10 + aFSize ); + QByteArray aResult; + aResult.resize( anISize * 10 + aFSize ); int i = 0; diff --git a/src/GLViewer/GLViewer_AspectLine.h b/src/GLViewer/GLViewer_AspectLine.h index 866a96909..69b8d987b 100644 --- a/src/GLViewer/GLViewer_AspectLine.h +++ b/src/GLViewer/GLViewer_AspectLine.h @@ -27,7 +27,7 @@ #include "GLViewer.h" -#include +#include #ifdef WIN32 #pragma warning( disable:4251 ) diff --git a/src/GLViewer/GLViewer_BaseDrawers.cxx b/src/GLViewer/GLViewer_BaseDrawers.cxx index 80dfa1329..279ee513b 100644 --- a/src/GLViewer/GLViewer_BaseDrawers.cxx +++ b/src/GLViewer/GLViewer_BaseDrawers.cxx @@ -29,6 +29,10 @@ #include "GLViewer_AspectLine.h" #include "GLViewer_BaseObjects.h" +// Qt includes +#include + + #ifndef WIN32 #include #endif @@ -66,10 +70,10 @@ GLViewer_MarkerDrawer::~GLViewer_MarkerDrawer() */ void GLViewer_MarkerDrawer::create( float xScale, float yScale, bool onlyUpdate ) { - QValueList::Iterator it; - QValueList::Iterator EndIt; - QValueList::Iterator anObjectIt = myObjects.begin(); - QValueList::Iterator anEndObjectIt = myObjects.end(); + QList::Iterator it; + QList::Iterator EndIt; + QList::Iterator anObjectIt = myObjects.begin(); + QList::Iterator anEndObjectIt = myObjects.end(); myXScale = xScale; myYScale = yScale; @@ -89,7 +93,7 @@ void GLViewer_MarkerDrawer::create( float xScale, float yScale, bool onlyUpdate float* anYCoord = aMarkerSet->getYCoord(); float aRadius = aMarkerSet->getMarkerSize(); - QValueList aHNumbers, anUHNumbers, aSelNumbers, anUSelNumbers; + QList aHNumbers, anUHNumbers, aSelNumbers, anUSelNumbers; aMarkerSet->exportNumbers( aHNumbers, anUHNumbers, aSelNumbers, anUSelNumbers ); if( onlyUpdate ) @@ -189,8 +193,8 @@ GLViewer_PolylineDrawer::~GLViewer_PolylineDrawer() */ void GLViewer_PolylineDrawer::create( float xScale, float yScale, bool onlyUpdate ) { - QValueList::Iterator aObjectIt = myObjects.begin(); - QValueList::Iterator aObjectEndIt = myObjects.end(); + QList::Iterator aObjectIt = myObjects.begin(); + QList::Iterator aObjectEndIt = myObjects.end(); myXScale = xScale; myYScale = yScale; @@ -278,8 +282,8 @@ GLViewer_TextDrawer::~GLViewer_TextDrawer() */ void GLViewer_TextDrawer::create( float xScale, float yScale, bool onlyUpdate ) { - QValueList::Iterator aObjectIt = myObjects.begin(); - QValueList::Iterator aObjectEndIt = myObjects.end(); + QList::Iterator aObjectIt = myObjects.begin(); + QList::Iterator aObjectEndIt = myObjects.end(); myXScale = xScale; myYScale = yScale; @@ -322,8 +326,8 @@ void GLViewer_TextDrawer::create( float xScale, float yScale, bool onlyUpdate ) */ void GLViewer_TextDrawer::updateObjects() { - QValueList::Iterator aObjectIt = myObjects.begin(); - QValueList::Iterator aObjectEndIt = myObjects.end(); + QList::Iterator aObjectIt = myObjects.begin(); + QList::Iterator aObjectEndIt = myObjects.end(); for( ; aObjectIt != aObjectEndIt; aObjectIt++ ) (*aObjectIt)->compute(); } diff --git a/src/GLViewer/GLViewer_BaseDrawers.h b/src/GLViewer/GLViewer_BaseDrawers.h index 37c7a898f..c0e1abedf 100644 --- a/src/GLViewer/GLViewer_BaseDrawers.h +++ b/src/GLViewer/GLViewer_BaseDrawers.h @@ -25,11 +25,7 @@ #ifndef GLVIEWER_BASEDRAWERS_H #define GLVIEWER_BASEDRAWERS_H -#include -#include -#include -#include -#include +class QColor; #include "GLViewer.h" #include "GLViewer_Drawer.h" diff --git a/src/GLViewer/GLViewer_BaseObjects.cxx b/src/GLViewer/GLViewer_BaseObjects.cxx index 338543ee3..ad1190e0a 100644 --- a/src/GLViewer/GLViewer_BaseObjects.cxx +++ b/src/GLViewer/GLViewer_BaseObjects.cxx @@ -29,6 +29,8 @@ #include "GLViewer_Drawer.h" +#include + //#include //using namespace std; @@ -214,7 +216,7 @@ bool GLViewer_MarkerSet::translateToPS( QFile& hFile, GLViewer_CoordSystem* aVie } aBuffer+="closepath\nstroke\n"; - hFile.writeBlock( aBuffer.ascii(), aBuffer.length() ); + hFile.write( aBuffer.toAscii() ); return true; } @@ -252,7 +254,7 @@ bool GLViewer_MarkerSet::translateToHPGL( QFile& hFile, GLViewer_CoordSystem* aV } aBuffer+="PU;\n"; - hFile.writeBlock( aBuffer.ascii(), aBuffer.length() ); + hFile.write( aBuffer.toAscii() ); } return true; @@ -313,10 +315,10 @@ void GLViewer_MarkerSet::compute() for ( int i = 0; i < myNumber; i++ ) { - xa = QMIN( xa, myXCoord[i] ); - xb = QMAX( xb, myXCoord[i] ); - ya = QMIN( ya, myYCoord[i] ); - yb = QMAX( yb, myYCoord[i] ); + xa = qMin( xa, myXCoord[i] ); + xb = qMax( xb, myXCoord[i] ); + ya = qMin( ya, myYCoord[i] ); + yb = qMax( yb, myYCoord[i] ); } myXGap = ( xb - xa ) / 10; @@ -352,8 +354,8 @@ GLboolean GLViewer_MarkerSet::highlight( GLfloat x, GLfloat y, GLfloat tol, GLbo // cout << "GLViewer_MarkerSet::highlight " << x <<" " << y << " " << tol << endl; int count = 0; GLfloat xdist, ydist, radius; - QValueList::Iterator it; - QValueList curHNumbers; + QList::Iterator it; + QList curHNumbers; bool isFound; GLboolean update; int cnt = 0; @@ -432,10 +434,10 @@ GLboolean GLViewer_MarkerSet::select( GLfloat x, GLfloat y, GLfloat tol, GLViewe // cout << "GLViewer_MarkerSet::select " << x << " " << y << endl; int count = 0; GLfloat xdist, ydist, radius; - QValueList::Iterator it; - QValueList::Iterator it1; - QValueList::Iterator remIt; - QValueList::Iterator curIt; + QList::Iterator it; + QList::Iterator it1; + QList::Iterator remIt; + QList::Iterator curIt; radius = tol - myMarkerSize / 2.; @@ -481,35 +483,35 @@ GLboolean GLViewer_MarkerSet::select( GLfloat x, GLfloat y, GLfloat tol, GLViewe for ( it1 = myHNumbers.begin(); it1 != myHNumbers.end(); ++it1 ) if( i == *it1 ) { - myHNumbers.remove( it1 ); + myHNumbers.erase( it1 ); break; } for ( it1 = myUHNumbers.begin(); it1 != myUHNumbers.end(); ++it1 ) if( i == *it1 ) { - myUHNumbers.remove( it1 ); + myUHNumbers.erase( it1 ); break; } } else { - mySelNumbers.remove( remIt ); + mySelNumbers.erase( remIt ); for ( curIt = myCurSelNumbers.begin(); curIt != myCurSelNumbers.end(); ++curIt ) if( *curIt == *remIt) { - myCurSelNumbers.remove( curIt ); + myCurSelNumbers.erase( curIt ); break; } for ( it1 = myHNumbers.begin(); it1 != myHNumbers.end(); ++it1 ) if( i == *it1 ) { - myHNumbers.remove( it1 ); + myHNumbers.erase( it1 ); break; } for ( it1 = myUHNumbers.begin(); it1 != myUHNumbers.end(); ++it1 ) if( i == *it1 ) { - myUHNumbers.remove( it1 ); + myUHNumbers.erase( it1 ); break; } } @@ -521,13 +523,13 @@ GLboolean GLViewer_MarkerSet::select( GLfloat x, GLfloat y, GLfloat tol, GLViewe for ( it1 = myHNumbers.begin(); it1 != myHNumbers.end(); ++it1 ) if( i == *it1 ) { - myHNumbers.remove( it1 ); + myHNumbers.erase( it1 ); break; } for ( it1 = myUHNumbers.begin(); it1 != myUHNumbers.end(); ++it1 ) if( i == *it1 ) { - myUHNumbers.remove( it1 ); + myUHNumbers.erase( it1 ); break; } } @@ -538,7 +540,7 @@ GLboolean GLViewer_MarkerSet::select( GLfloat x, GLfloat y, GLfloat tol, GLViewe for( it1 = myUSelNumbers.begin(); it1 != myUSelNumbers.end(); ++it1 ) if( *it == *it1 ) { - it1 = myUSelNumbers.remove( it1 ); + it1 = myUSelNumbers.erase( it1 ); it1--; } @@ -633,10 +635,10 @@ void GLViewer_MarkerSet::setNumMarkers( GLint number ) /*! Export numbers of highlighted/selected lines */ -void GLViewer_MarkerSet::exportNumbers( QValueList& highlight, - QValueList& unhighlight, - QValueList& select, - QValueList& unselect ) +void GLViewer_MarkerSet::exportNumbers( QList& highlight, + QList& unhighlight, + QList& select, + QList& unselect ) { highlight = myHNumbers; unhighlight = myUHNumbers; @@ -655,14 +657,12 @@ bool GLViewer_MarkerSet::addOrRemoveSelected( int index ) if( index < 0 || index > myNumber ) return FALSE; - int n = mySelNumbers.findIndex( index ); + int n = mySelNumbers.indexOf( index ); if( n == -1 ) mySelNumbers.append( index ); else { - QValueList::Iterator it; - it = mySelNumbers.at( n ); - mySelNumbers.remove( it ); + mySelNumbers.removeAt(n); myUSelNumbers.append( index ); } return TRUE; @@ -675,7 +675,7 @@ bool GLViewer_MarkerSet::addOrRemoveSelected( int index ) void GLViewer_MarkerSet::addSelected( const TColStd_SequenceOfInteger& seq ) { for ( int i = 1; i <= seq.Length(); i++ ) - if( mySelNumbers.findIndex( seq.Value( i ) ) == -1 ) + if( mySelNumbers.indexOf( seq.Value( i ) ) == -1 ) mySelNumbers.append( seq.Value( i ) - 1 ); } @@ -685,7 +685,7 @@ void GLViewer_MarkerSet::addSelected( const TColStd_SequenceOfInteger& seq ) */ void GLViewer_MarkerSet::setSelected( const TColStd_SequenceOfInteger& seq ) { -// for( QValueList::Iterator it = mySelNumbers.begin(); it != mySelNumbers.end(); ++it ) +// for( QList::Iterator it = mySelNumbers.begin(); it != mySelNumbers.end(); ++it ) // if( myUSelNumbers.findIndex( *it ) == -1 ) // myUSelNumbers.append( *it ); @@ -728,7 +728,8 @@ QByteArray GLViewer_MarkerSet::getByteCopy() QByteArray aObject = GLViewer_Object::getByteCopy(); - QByteArray aResult( anISize + 2*aFSize*myNumber + aFSize + aObject.size()); + QByteArray aResult; + aResult.resize( anISize + 2*aFSize*myNumber + aFSize + aObject.size()); char* aPointer = (char*)&myNumber; for( i = 0; i < anISize; i++, aPointer++ ) @@ -784,7 +785,8 @@ bool GLViewer_MarkerSet::initializeFromByteCopy( QByteArray theArray ) *aPointer = theArray[i]; int aCurIndex = anISize + 2*aFSize*myNumber + aFSize; - QByteArray aObject( aSize - aCurIndex ); + QByteArray aObject; + aObject.resize( aSize - aCurIndex ); for( ; i < aSize; i++ ) aObject[i - aCurIndex] = theArray[i]; @@ -871,7 +873,7 @@ bool GLViewer_Polyline::translateToPS( QFile& hFile, GLViewer_CoordSystem* aView aBuffer+="closepath\nstroke\n"; - hFile.writeBlock( aBuffer.ascii(), aBuffer.length() ); + hFile.write( aBuffer.toAscii() ); return true; } @@ -897,7 +899,7 @@ bool GLViewer_Polyline::translateToHPGL( QFile& hFile, GLViewer_CoordSystem* aVi aBuffer+="PU;\n"; - hFile.writeBlock( aBuffer.ascii(), aBuffer.length() ); + hFile.write( aBuffer.toAscii() ); return true; } @@ -958,10 +960,10 @@ void GLViewer_Polyline::compute() for ( int i = 0; i < myNumber; i++ ) { - xa = QMIN( xa, myXCoord[i] ); - xb = QMAX( xb, myXCoord[i] ); - ya = QMIN( ya, myYCoord[i] ); - yb = QMAX( yb, myYCoord[i] ); + xa = qMin( xa, myXCoord[i] ); + xb = qMax( xb, myXCoord[i] ); + ya = qMin( ya, myYCoord[i] ); + yb = qMax( yb, myYCoord[i] ); } GLfloat xGap = ( xb - xa ) / 10; @@ -1219,10 +1221,10 @@ void GLViewer_Polyline::setNumber( GLint number ) /*! Export numbers of highlighted/selected lines */ -void GLViewer_Polyline::exportNumbers( QValueList& highlight, - QValueList& unhighlight, - QValueList& select, - QValueList& unselect ) +void GLViewer_Polyline::exportNumbers( QList& highlight, + QList& unhighlight, + QList& select, + QList& unselect ) { highlight = myHNumbers; unhighlight = myUHNumbers; @@ -1264,7 +1266,8 @@ QByteArray GLViewer_Polyline::getByteCopy() QByteArray aObject = GLViewer_Object::getByteCopy(); - QByteArray aResult( aFSize*myNumber*2 + anISize + 2*aBSize + aObject.size()); + QByteArray aResult; + aResult.resize( aFSize*myNumber*2 + anISize + 2*aBSize + aObject.size()); char* aPointer = (char*)&myNumber; for( i = 0; i < anISize; i++, aPointer++ ) @@ -1327,7 +1330,8 @@ bool GLViewer_Polyline::initializeFromByteCopy( QByteArray theArray ) *aPointer = theArray[i]; int aCurIndex = anISize + 2*aFSize*myNumber + 2*aBSize; - QByteArray aObject( aSize - aCurIndex ); + QByteArray aObject; + aObject.resize( aSize - aCurIndex ); for( ; i < aSize; i++ ) aObject[i - aCurIndex] = theArray[i]; @@ -1394,7 +1398,7 @@ bool GLViewer_TextObject::translateToPS( QFile& hFile, GLViewer_CoordSystem* aVi AddCoordsToPS( aBuffer, "moveto", aViewerCS, aPSCS, double(xPos), double(yPos) ); aBuffer += "(" + aText + ") show\n"; - hFile.writeBlock( aBuffer.ascii(), aBuffer.length() ); + hFile.write( aBuffer.toAscii() ); return true; } @@ -1416,7 +1420,7 @@ bool GLViewer_TextObject::translateToHPGL( QFile& hFile, GLViewer_CoordSystem* a aBuffer = "LB" + aText + "#;"; - hFile.writeBlock( aBuffer.ascii(), aBuffer.length() ); + hFile.write( aBuffer.toAscii() ); return true; } diff --git a/src/GLViewer/GLViewer_BaseObjects.h b/src/GLViewer/GLViewer_BaseObjects.h index 8070664d5..051e13f9f 100644 --- a/src/GLViewer/GLViewer_BaseObjects.h +++ b/src/GLViewer/GLViewer_BaseObjects.h @@ -28,8 +28,7 @@ #include "GLViewer.h" #include "GLViewer_Object.h" -#include -#include +#include #include @@ -92,11 +91,11 @@ public: float getMarkerSize() const { return myMarkerSize; } //! Export numbers of heghlighted/selected markers - void exportNumbers( QValueList& high, QValueList& unhigh, - QValueList& sel, QValueList& unsel ); + void exportNumbers( QList& high, QList& unhigh, + QList& sel, QList& unsel ); //! Returns selected numbers - QValueList getSelectedElements() { return mySelNumbers; } + QList getSelectedElements() { return mySelNumbers; } //! Adds or remove selected number bool addOrRemoveSelected( int index ); //! Adds selected numbers @@ -109,12 +108,12 @@ protected: GLfloat* myXCoord; GLfloat* myYCoord; GLfloat myMarkerSize; - QValueList myHNumbers; - QValueList myUHNumbers; - QValueList mySelNumbers; - QValueList myCurSelNumbers; - QValueList myUSelNumbers; - QValueList myPrevHNumbers; + QList myHNumbers; + QList myUHNumbers; + QList mySelNumbers; + QList myCurSelNumbers; + QList myUSelNumbers; + QList myPrevHNumbers; TColStd_SequenceOfInteger mySelectedIndexes; }; @@ -177,11 +176,11 @@ public: GLboolean isHighSelAll() const { return myHighSelAll; } //! Export numbers of highlighted/selected lines - void exportNumbers( QValueList& high, QValueList& unhigh, - QValueList& sel, QValueList& unsel ); + void exportNumbers( QList& high, QList& unhigh, + QList& sel, QList& unsel ); //! Returns numbers of selected lines - QValueList getSelectedElements() { return mySelNumbers; } + QList getSelectedElements() { return mySelNumbers; } protected: GLfloat* myXCoord; @@ -190,12 +189,12 @@ protected: GLboolean myIsClosed; GLboolean myHighSelAll; - QValueList myHNumbers; - QValueList myUHNumbers; - QValueList mySelNumbers; - QValueList myUSelNumbers; - QValueList myCurSelNumbers; - QValueList myPrevHNumbers; + QList myHNumbers; + QList myUHNumbers; + QList mySelNumbers; + QList myUSelNumbers; + QList myCurSelNumbers; + QList myPrevHNumbers; TColStd_SequenceOfInteger mySelectedIndexes; GLboolean myHighFlag; diff --git a/src/GLViewer/GLViewer_Compass.h b/src/GLViewer/GLViewer_Compass.h index 9870ccf82..ee52be281 100644 --- a/src/GLViewer/GLViewer_Compass.h +++ b/src/GLViewer/GLViewer_Compass.h @@ -27,7 +27,9 @@ #include "GLViewer.h" -#include +#include + +class QFont; #ifdef WIN32 #pragma warning( disable:4251 ) diff --git a/src/GLViewer/GLViewer_Context.cxx b/src/GLViewer/GLViewer_Context.cxx index 0383b0325..496d79bed 100644 --- a/src/GLViewer/GLViewer_Context.cxx +++ b/src/GLViewer/GLViewer_Context.cxx @@ -33,6 +33,10 @@ #include "GLViewer_Object.h" #include "GLViewer_Viewer2d.h" #include "GLViewer_ViewPort2d.h" +#include "GLViewer_ViewFrame.h" + +//QT includes +#include #include @@ -222,7 +226,7 @@ int GLViewer_Context::Select( bool Append, bool byCircle ) } else if( myLastPicked->isSelected() && status != SS_LocalChanged ) { - mySelectedObjects.remove( myLastPicked ); + mySelectedObjects.removeAll( myLastPicked ); myLastPicked->unselect(); myGLViewer2d->updateAll(); @@ -233,7 +237,7 @@ int GLViewer_Context::Select( bool Append, bool byCircle ) } if ( myLastPicked->select( myXhigh, myYhigh, myTolerance, GLViewer_Rect(), false, byCircle, Append ) - && mySelectedObjects.findIndex( myLastPicked ) == -1 ) + && mySelectedObjects.indexOf( myLastPicked ) == -1 ) { mySelectedObjects.append( myLastPicked ); myGLViewer2d->activateDrawer( myLastPicked, TRUE, TRUE ); @@ -370,7 +374,7 @@ int GLViewer_Context::SelectByRect( const QRect& theRect, bool Append ) isSel = (*it)->isSelected(); } - if( isSel && mySelectedObjects.findIndex( *it ) == -1 ) + if( isSel && mySelectedObjects.indexOf( *it ) == -1 ) { aList.append( *it ); mySelectedObjects.append( *it ); @@ -527,14 +531,14 @@ bool GLViewer_Context::replaceObject( GLViewer_Object* oldObject, GLViewer_Objec if( myActiveObjects.contains( oldObject ) ) { - myActiveObjects.remove( oldObject ); + myActiveObjects.removeAll( oldObject ); myActiveObjects.append( newObject ); return true; } if( myInactiveObjects.contains( oldObject ) ) { - myInactiveObjects.remove( oldObject ); + myInactiveObjects.removeAll( oldObject ); myInactiveObjects.append( newObject ); return true; } @@ -626,7 +630,7 @@ void GLViewer_Context::remSelected( GLViewer_Object* object, bool updateViewer ) if( !object || !mySelectedObjects.contains( object ) ) return; - mySelectedObjects.remove( object ); + mySelectedObjects.removeAll( object ); object->unselect(); if( updateViewer ) @@ -661,14 +665,14 @@ void GLViewer_Context::deleteObject( GLViewer_Object* theObject, bool updateView return; if( myActiveObjects.contains( theObject ) ) - myActiveObjects.remove( theObject ); + myActiveObjects.removeAll( theObject ); else if( myInactiveObjects.contains( theObject ) ) - myInactiveObjects.remove( theObject ); + myInactiveObjects.removeAll( theObject ); else return; if( mySelectedObjects.contains( theObject ) ) - mySelectedObjects.remove( theObject ); + mySelectedObjects.removeAll( theObject ); GLViewer_Group* aGroup = theObject->getGroup(); if( aGroup ) @@ -690,7 +694,7 @@ bool GLViewer_Context::setActive( GLViewer_Object* theObject ) if( !theObject || !myInactiveObjects.contains( theObject ) ) return false; - myInactiveObjects.remove( theObject ); + myInactiveObjects.removeAll( theObject ); myActiveObjects.append( theObject ); return true; } @@ -704,7 +708,7 @@ bool GLViewer_Context::setInactive( GLViewer_Object* theObject ) if( !theObject || !myActiveObjects.contains( theObject ) ) return false; - myActiveObjects.remove( theObject ); + myActiveObjects.removeAll( theObject ); myInactiveObjects.append( theObject ); return true; } diff --git a/src/GLViewer/GLViewer_Context.h b/src/GLViewer/GLViewer_Context.h index 2ec1a0ccf..aa367366c 100644 --- a/src/GLViewer/GLViewer_Context.h +++ b/src/GLViewer/GLViewer_Context.h @@ -33,9 +33,7 @@ #include "GLViewer_Defs.h" #include "GLViewer_Object.h" -#include -#include -#include +class QRect; #include #include diff --git a/src/GLViewer/GLViewer_Defs.h b/src/GLViewer/GLViewer_Defs.h index 411fb4a7a..c11455d3d 100644 --- a/src/GLViewer/GLViewer_Defs.h +++ b/src/GLViewer/GLViewer_Defs.h @@ -25,8 +25,8 @@ #ifndef GLVIEWER_DEFS_H #define GLVIEWER_DEFS_H -#include -#include +#include +#include class GLViewer_Object; //Selection staus @@ -57,7 +57,7 @@ enum SelectionStatus }; typedef QMap ObjectMap; -typedef QValueList ObjList; +typedef QList ObjList; #define SEGMENTS 32 #define PI 3.14159265359 diff --git a/src/GLViewer/GLViewer_Drawer.cxx b/src/GLViewer/GLViewer_Drawer.cxx index d0001a49c..433074a46 100644 --- a/src/GLViewer/GLViewer_Drawer.cxx +++ b/src/GLViewer/GLViewer_Drawer.cxx @@ -29,15 +29,17 @@ #include "GLViewer_ViewFrame.h" #include "GLViewer_ViewPort2d.h" +#include +#include +#include +#include + #ifndef WIN32 #include #endif #include -#include -#include - #define TEXT_GAP 5 // Two texture components for texmapped fonts: luminance and alpha #define NB_TEX_COMP 2 @@ -73,7 +75,7 @@ void GLViewer_TexFont::clearTextBases() GLViewer_TexFont::GLViewer_TexFont() : myMaxRowWidth( 0 ), myFontHeight( 0 ) { - myQFont = QFont::defaultFont(); + myQFont = QApplication::font();//QFont::defaultFont(); mySeparator = 2; myIsResizeable = false; myMinMagFilter = GL_LINEAR; @@ -204,7 +206,7 @@ bool GLViewer_TexFont::generateTexture() aPainter.drawText( myPositions[l], ( row + 1 ) * aRowPixelHeight - aDescent, aLetter ); } - QImage aImage = aPixmap.convertToImage(); + QImage aImage = aPixmap.toImage(); //int qqq = 0; //if (qqq) @@ -308,7 +310,7 @@ void GLViewer_TexFont::drawString( QString theStr, GLdouble theX , GLdouble theY int aLettIndex, row; for ( int i = 0; i < (int)theStr.length(); i++ ) { - aLetter = theStr.data()[i]; + aLetter = theStr.data()[i].toLatin1(); aLettIndex = (int)aLetter - FirstSymbolNumber; row = aLettIndex / TEX_ROW_LEN; @@ -340,7 +342,7 @@ int GLViewer_TexFont::getStringWidth( QString theStr ) int aWidth = 0; for ( int i = 0; i < (int)theStr.length(); i ++ ) { - char aLetter = theStr.data()[i]; + char aLetter = theStr.data()[i].toLatin1(); int aLettIndex = (int)aLetter - FirstSymbolNumber; aWidth += myWidths[aLettIndex] + mySeparator; } @@ -429,19 +431,19 @@ static GLuint displayListBase( QFont* theFont ) QMap::iterator it = GLViewer_TexFont::BitmapFontCache.begin(); for ( ; it != GLViewer_TexFont::BitmapFontCache.end(); ++it ) { - if ( it.key().myViewPortId == size_t(aCont) && it.data() > listBase ) - listBase = it.data(); + if ( it.key().myViewPortId == size_t(aCont) && it.value() > listBase ) + listBase = it.value(); } listBase += 256; //glXUseXFont( (Font)(theFont->handle()), 0, 256, listBase ); int aFontCont = 0; QString aFontDef = theFont->toString(); - char** xFontList = XListFonts( aDisp, aFontDef.latin1()/*aFindFont.myFontString.data()*/, 1, &aFontCont ); + char** xFontList = XListFonts( aDisp, aFontDef.toLatin1()/*aFindFont.myFontString.data()*/, 1, &aFontCont ); if( !theFont->handle() ) { #ifdef _DEBUG_ - printf( "Can't load font %s. loading default font....\n", aFontDef.latin1()/*aFindFont.myFontString.data()*/ ); + printf( "Can't load font %s. loading default font....\n", aFontDef.toLatin1().data()/*aFindFont.myFontString.data()*/ ); #endif QString aFontMask ("-*-*-*-r-*-*-"); aFontMask += aFontDef/*aFindFont.myFontString*/.section( ',', 1, 1 ); @@ -449,7 +451,7 @@ static GLuint displayListBase( QFont* theFont ) printf( "Height of Default font: %s\n", aFontDef/*aFindFont.myFontString*/.section( ',', 1, 1 ).data() ); #endif aFontMask += "-*-*-*-m-*-*-*"; - xFontList = XListFonts( aDisp, aFontMask.data()/*"-*-*-*-r-*-*-12-*-*-*-m-*-*-*"*/, 1, &aFontCont ); + xFontList = XListFonts( aDisp, aFontMask.toLatin1().constData()/*"-*-*-*-r-*-*-12-*-*-*-m-*-*-*"*/, 1, &aFontCont ); if( aFontCont == 0 ) { #ifdef _DEBUG_ @@ -504,7 +506,7 @@ void GLViewer_Drawer::destroyAllTextures() QMap::Iterator anEndIt= GLViewer_TexFont::TexFontBase.end(); for( ; anIt != anEndIt; anIt++ ) - glDeleteTextures( 1, &(anIt.data().myTexFontId) ); + glDeleteTextures( 1, &(anIt.value().myTexFontId) ); } /*! @@ -785,7 +787,7 @@ void GLViewer_Drawer::drawText( const QString& text, GLfloat xPos, GLfloat yPos, { glRasterPos2f( xPos, yPos ); glListBase( displayListBase( theFont ) ); - glCallLists( text.length(), GL_UNSIGNED_BYTE, text.local8Bit().data() ); + glCallLists( text.length(), GL_UNSIGNED_BYTE, text.toLocal8Bit().data() ); } } @@ -996,7 +998,7 @@ void GLViewer_Drawer::drawContour( const GLViewer_PntList& pntList, QColor color glLineWidth( lineWidth ); glBegin( GL_LINES ); - QValueList::const_iterator it = pntList.begin(); + QList::const_iterator it = pntList.begin(); for( ; it != pntList.end(); ++it ) glVertex2f( (*it).x(), (*it).y() ); glEnd(); @@ -1051,7 +1053,7 @@ void GLViewer_Drawer::drawPolygon( const GLViewer_PntList& pntList, QColor color ( GLfloat )color.green() / 255, ( GLfloat )color.blue() / 255 ); glBegin( GL_POLYGON ); - QValueList::const_iterator it = pntList.begin(); + QList::const_iterator it = pntList.begin(); for( ; it != pntList.end(); ++it ) glVertex2f( (*it).x(), (*it).y() ); glEnd(); diff --git a/src/GLViewer/GLViewer_Drawer.h b/src/GLViewer/GLViewer_Drawer.h index 9cfae081a..859eecbc3 100644 --- a/src/GLViewer/GLViewer_Drawer.h +++ b/src/GLViewer/GLViewer_Drawer.h @@ -29,11 +29,10 @@ #include "windows.h" #endif -#include -#include -#include -#include -#include +#include +#include + +class QFile; #include @@ -424,7 +423,7 @@ protected: float myYScale; //! List of objects - QValueList myObjects; + QList myObjects; //! List generated textures GLuint myTextList; diff --git a/src/GLViewer/GLViewer_Geom.h b/src/GLViewer/GLViewer_Geom.h index 524eafa39..13397fce4 100644 --- a/src/GLViewer/GLViewer_Geom.h +++ b/src/GLViewer/GLViewer_Geom.h @@ -27,11 +27,11 @@ #include "GLViewer.h" -#include -#include -#include +#include +#include #include +//using namespace QGL; #ifdef WIN32 #pragma warning( disable:4251 ) @@ -59,7 +59,7 @@ private: GLfloat myY; }; -typedef QValueList GLViewer_PntList; +typedef QList GLViewer_PntList; /*! Class GLViewer_Rect * Substitution of QRect for OpenGL diff --git a/src/GLViewer/GLViewer_Grid.cxx b/src/GLViewer/GLViewer_Grid.cxx index 13a661caf..9420de128 100644 --- a/src/GLViewer/GLViewer_Grid.cxx +++ b/src/GLViewer/GLViewer_Grid.cxx @@ -27,7 +27,6 @@ #include "GLViewer_Defs.h" #include -#include /*! Default constructor diff --git a/src/GLViewer/GLViewer_MimeSource.cxx b/src/GLViewer/GLViewer_MimeData.cxx similarity index 84% rename from src/GLViewer/GLViewer_MimeSource.cxx rename to src/GLViewer/GLViewer_MimeData.cxx index ca82fbacd..d669475f9 100644 --- a/src/GLViewer/GLViewer_MimeSource.cxx +++ b/src/GLViewer/GLViewer_MimeData.cxx @@ -20,7 +20,7 @@ // //#include -#include "GLViewer_MimeSource.h" +#include "GLViewer_MimeData.h" #include "GLViewer_BaseObjects.h" //#include @@ -29,7 +29,7 @@ /*! Destructor */ -GLViewer_MimeSource::~GLViewer_MimeSource() +GLViewer_MimeData::~GLViewer_MimeData() { } @@ -37,14 +37,14 @@ GLViewer_MimeSource::~GLViewer_MimeSource() Translate objects to byte array \param theObjects - list of objects */ -bool GLViewer_MimeSource::setObjects( QValueList theObjects ) +bool GLViewer_MimeData::setObjects( QList theObjects ) { if( !theObjects.empty() ) { QStringList aObjectsType; - QValueList aObjects; - QValueList::const_iterator anIt = theObjects.begin(); - QValueList::const_iterator anEndIt = theObjects.end(); + QList aObjects; + QList::const_iterator anIt = theObjects.begin(); + QList::const_iterator anEndIt = theObjects.end(); int aObjByteSize = 0; for( ; anIt != anEndIt; anIt++ ) @@ -59,7 +59,7 @@ bool GLViewer_MimeSource::setObjects( QValueList theObjects ) int aStrByteSize = aTypes.length(); int aObjNum = aObjects.count(); - myByteArray = QByteArray( anISize * (1 + 2*aObjNum) + aStrByteSize + aObjByteSize ); + myByteArray.resize( anISize * (1 + 2*aObjNum) + aStrByteSize + aObjByteSize ); int anIndex = 0, j = 0; char* aPointer = (char*)&aObjNum; @@ -77,14 +77,14 @@ bool GLViewer_MimeSource::setObjects( QValueList theObjects ) } int aCurIndex = anIndex; - const char* aStr = aTypes.data(); + const char* aStr = aTypes.toLatin1().constData(); for( j = 0 ; anIndex < aCurIndex + aStrByteSize; aPointer++, anIndex++, j++ ) myByteArray[anIndex] = aStr[j]; aCurIndex = anIndex; - QValueList::iterator anObjIt = aObjects.begin(); - QValueList::iterator anEndObjIt = aObjects.end(); + QList::iterator anObjIt = aObjects.begin(); + QList::iterator anEndObjIt = aObjects.end(); for( j = 1; anObjIt != anEndObjIt; anObjIt++, j++ ) { int aObjLen = (int)((*anObjIt).size()); @@ -115,7 +115,7 @@ bool GLViewer_MimeSource::setObjects( QValueList theObjects ) \param theArray - byte array \param theType - type of object */ -GLViewer_Object* GLViewer_MimeSource::getObject( QByteArray theArray, QString theType ) +GLViewer_Object* GLViewer_MimeData::getObject( QByteArray theArray, QString theType ) { if( !theArray.isEmpty() ) { @@ -147,7 +147,7 @@ GLViewer_Object* GLViewer_MimeSource::getObject( QByteArray theArray, QString th \param theArray - byte array \param theType - type of object */ -QValueList GLViewer_MimeSource::getObjects( QByteArray theArray, QString theType ) +QList GLViewer_MimeData::getObjects( QByteArray theArray, QString theType ) { if( !theArray.isEmpty() ) { @@ -155,11 +155,11 @@ QValueList GLViewer_MimeSource::getObjects( QByteArray theArra if( theType == "GLViewer_Objects" ) { QStringList aTypeList; - QValueList aObjects; - QValueList aObjectList; + QList aObjects; + QList aObjectList; - QValueList aTypeSizeList; - QValueList aObjSizeList; + QList aTypeSizeList; + QList aObjSizeList; int aObjNum = 0; char* aPointer = (char*)&aObjNum; @@ -201,7 +201,8 @@ QValueList GLViewer_MimeSource::getObjects( QByteArray theArra aCurIndex = anIndex; for( j = 0; j < aObjNum; j++ ) { - QByteArray aTempArray(aObjSizeList[j]); + QByteArray aTempArray; + aTempArray.resize(aObjSizeList[j]); for( ; anIndex < aCurIndex + aObjSizeList[j]; anIndex++ ) aTempArray[anIndex-aCurIndex] = theArray[anIndex]; aObjects.append( aTempArray ); @@ -215,14 +216,14 @@ QValueList GLViewer_MimeSource::getObjects( QByteArray theArra } } - return QValueList(); + return QList(); } /*! \return format by index \param theIndex - index */ -const char* GLViewer_MimeSource::format( int theIndex ) const +const char* GLViewer_MimeData::format( int theIndex ) const { switch( theIndex ) { @@ -238,7 +239,7 @@ const char* GLViewer_MimeSource::format( int theIndex ) const /*! \return internal byte array */ -QByteArray GLViewer_MimeSource::encodedData( const char* theObjectType ) const +QByteArray GLViewer_MimeData::encodedData( const char* theObjectType ) const { if( theObjectType == "GLViewer_Objects" ) return myByteArray; diff --git a/src/GLViewer/GLViewer_MimeSource.h b/src/GLViewer/GLViewer_MimeData.h similarity index 72% rename from src/GLViewer/GLViewer_MimeSource.h rename to src/GLViewer/GLViewer_MimeData.h index 7b79bfd3f..1a5f816fb 100644 --- a/src/GLViewer/GLViewer_MimeSource.h +++ b/src/GLViewer/GLViewer_MimeData.h @@ -19,11 +19,11 @@ // Author : OPEN CASCADE // -// File: GLViewer_MimeSource.h +// File: GLViewer_MimeData.h // Created: November, 2004 -#ifndef GLVIEWER_MIMESOURCE_H -#define GLVIEWER_MIMESOURCE_H +#ifndef GLVIEWER_MIMEDATA_H +#define GLVIEWER_MIMEDATA_H #ifdef WIN32 #include @@ -31,8 +31,7 @@ #include "GLViewer.h" -#include -#include +#include #ifdef WIN32 #pragma warning( disable:4251 ) @@ -41,27 +40,26 @@ class GLViewer_Object; /*! - \class GLViewer_MimeSource + \class GLViewer_MimeData Needs for a work with QClipboard */ -class GLVIEWER_API GLViewer_MimeSource: public QMimeSource +class GLVIEWER_API GLViewer_MimeData: public QMimeData { public: - GLViewer_MimeSource():QMimeSource(){}; - ~GLViewer_MimeSource(); + GLViewer_MimeData():QMimeData(){}; + ~GLViewer_MimeData(); //! Translate objects to byte array - bool setObjects( QValueList ); + bool setObjects( QList ); //! Gets objects from byte array /*If you want to use new class, following two method must be redefined*/ - static QValueList getObjects( QByteArray, QString theType); + static QList getObjects( QByteArray, QString theType); //! Get object from byte array /*If you want to use new class, following two method must be redefined*/ static GLViewer_Object* getObject( QByteArray, QString theType); - // Redefined methods - virtual const char* format( int theIndex = 0 ) const; - virtual QByteArray encodedData( const char* ) const; + const char* format( int theIndex = 0 ) const; + QByteArray encodedData( const char* ) const; private: QByteArray myByteArray; diff --git a/src/GLViewer/GLViewer_Object.cxx b/src/GLViewer/GLViewer_Object.cxx index 7de98ed37..c6a920c81 100644 --- a/src/GLViewer/GLViewer_Object.cxx +++ b/src/GLViewer/GLViewer_Object.cxx @@ -23,10 +23,11 @@ #include "GLViewer_Object.h" #include "GLViewer_Drawer.h" #include "GLViewer_AspectLine.h" -#include "GLViewer_Geom.h" #include "GLViewer_Text.h" #include "GLViewer_Group.h" +#include + //#include //using namespace std; @@ -141,8 +142,8 @@ QByteArray GLViewer_Object::getByteCopy() int i = 0; int anISize = sizeof( int ); - const char* aTypeStr = myType.data(); - const char* aToolTipStr = myToolTipText.data(); + const char* aTypeStr = myType.toLatin1().constData(); + const char* aToolTipStr = myToolTipText.toLatin1().constData(); int aTypeLength = myType.length(); int aToolTipLength = myToolTipText.length(); @@ -163,9 +164,10 @@ QByteArray GLViewer_Object::getByteCopy() int sizeOf8Float = sizeof( aRectData ); - QByteArray aResult( 2*anISize + sizeOf8Float + - aTypeLength + aToolTipLength + - aGLText.size() + aAspect.size() ); + QByteArray aResult; + aResult.resize( 2*anISize + sizeOf8Float + + aTypeLength + aToolTipLength + + aGLText.size() + aAspect.size() ); // puts 8 float values into the byte array char* aPointer = (char*)&aRectData; for( i = 0; i < sizeOf8Float; i++, aPointer++ ) @@ -225,7 +227,9 @@ bool GLViewer_Object::initializeFromByteCopy( QByteArray theArray ) GLViewer_AspectLine* aAspectLine = new GLViewer_AspectLine(); int aGLAspLineSize = (aAspectLine->getByteCopy()).size(); - QByteArray aGLTextArray, aAspect( aGLAspLineSize ); + QByteArray aGLTextArray, aAspect; + aGLTextArray.resize( aGLAspLineSize ); + aAspect.resize( aGLAspLineSize ); if( aSize < 2*anISize + 8*aFSize + aGLTextMinSize + aGLAspLineSize ) return false; diff --git a/src/GLViewer/GLViewer_Object.h b/src/GLViewer/GLViewer_Object.h index f3d3215b2..503a5a038 100644 --- a/src/GLViewer/GLViewer_Object.h +++ b/src/GLViewer/GLViewer_Object.h @@ -30,16 +30,13 @@ #endif #include "GLViewer.h" -#include "GLViewer_Defs.h" #include "GLViewer_Geom.h" -#include - #include -#include -#include -#include +#include + +class QFile; #ifdef WIN32 #pragma warning( disable:4251 ) @@ -52,6 +49,8 @@ class GLViewer_CoordSystem; class GLViewer_Text; //class GLViewer_Owner; +class SUIT_DataOwner; + /*! * Class GLViewer_Object * Base Object for all GLViewer objects diff --git a/src/GLViewer/GLViewer_Selector.cxx b/src/GLViewer/GLViewer_Selector.cxx index 4e4c91aea..82b9834e5 100644 --- a/src/GLViewer/GLViewer_Selector.cxx +++ b/src/GLViewer/GLViewer_Selector.cxx @@ -27,7 +27,7 @@ #include "GLViewer_Viewer.h" -int GLViewer_Selector::apppendKey = Qt::ShiftButton; +int GLViewer_Selector::apppendKey = Qt::ShiftModifier; /*! Constructor diff --git a/src/GLViewer/GLViewer_Selector.h b/src/GLViewer/GLViewer_Selector.h index 6c0672843..ff044848d 100644 --- a/src/GLViewer/GLViewer_Selector.h +++ b/src/GLViewer/GLViewer_Selector.h @@ -28,8 +28,10 @@ #include "GLViewer.h" #include "GLViewer_Defs.h" -#include -#include +#include +#include + +class QRect; #include diff --git a/src/GLViewer/GLViewer_Selector2d.cxx b/src/GLViewer/GLViewer_Selector2d.cxx index 067b29541..362f9625c 100644 --- a/src/GLViewer/GLViewer_Selector2d.cxx +++ b/src/GLViewer/GLViewer_Selector2d.cxx @@ -26,7 +26,8 @@ #include "GLViewer_Selector2d.h" #include "GLViewer_Viewer2d.h" #include "GLViewer_Context.h" -#include "GLViewer_ViewPort2d.h" +#include "GLViewer_ViewPort.h" +#include "GLViewer_ViewFrame.h" /*! Constructor diff --git a/src/GLViewer/GLViewer_Text.cxx b/src/GLViewer/GLViewer_Text.cxx index f4dba3a47..24631871d 100644 --- a/src/GLViewer/GLViewer_Text.cxx +++ b/src/GLViewer/GLViewer_Text.cxx @@ -22,6 +22,9 @@ //#include #include "GLViewer_Text.h" +#include +#include + /*! Constructor */ @@ -31,7 +34,7 @@ GLViewer_Text::GLViewer_Text( const QString& text, float xPos, float yPos, const myXPos = xPos; myYPos = yPos; myColor = color; - myQFont = QFont::defaultFont(); + myQFont = QApplication::font();//QFont::defaultFont(); mySeparator = 2; myDTF = DTF_BITMAP; } @@ -90,10 +93,11 @@ QByteArray GLViewer_Text::getByteCopy() const int aR = myColor.red(); int aG = myColor.green(); int aB = myColor.blue(); - const char* aStr = myText.data(); + const char* aStr = myText.toLatin1().constData(); int anISize = sizeof( int ); - QByteArray aResult( aSize ); + QByteArray aResult; + aResult.resize( aSize ); char* aPointer = (char*)&myXPos; for( i = 0; i < anISize; i++, aPointer++ ) @@ -124,7 +128,7 @@ QByteArray GLViewer_Text::getByteCopy() const for( ; i < 7*anISize + aTextSize; i++, aPointer++ ) aResult[i] = *aPointer; - const char* aFontStr = myQFont.toString().data(); + const char* aFontStr = myQFont.toString().toLatin1().constData(); int aFontSize = myQFont.toString().length(); for( i = 0; i < aFontSize; i++ ) diff --git a/src/GLViewer/GLViewer_Text.h b/src/GLViewer/GLViewer_Text.h index 597a61375..fefe786b5 100644 --- a/src/GLViewer/GLViewer_Text.h +++ b/src/GLViewer/GLViewer_Text.h @@ -34,10 +34,9 @@ #include -#include -#include -#include -#include +#include +#include +#include #ifdef WIN32 #pragma warning( disable:4251 ) diff --git a/src/GLViewer/GLViewer_ToolTip.cxx b/src/GLViewer/GLViewer_ToolTip.cxx index c4449265c..e246f163d 100644 --- a/src/GLViewer/GLViewer_ToolTip.cxx +++ b/src/GLViewer/GLViewer_ToolTip.cxx @@ -27,12 +27,14 @@ #include "GLViewer_ToolTip.h" #include "GLViewer_Viewer2d.h" #include "GLViewer_ViewPort2d.h" +#include "GLViewer_ViewFrame.h" -#include -#include -#include -#include -#include +#include +#include +#include +#include +#include +#include /*! constructor @@ -44,15 +46,16 @@ GLViewer_ObjectTip::GLViewer_ObjectTip( GLViewer_ViewPort2d* theParent ) { mypViewPort = theParent; //mypLabel = NULL; - mypLabel = new QLabel( "Test", NULL, "ObjectTipText", - WStyle_StaysOnTop | WStyle_Customize | WStyle_NoBorder | WStyle_Tool | WX11BypassWM ); - mypLabel->setMargin( 1 ); - mypLabel->setAutoMask( FALSE ); + mypLabel = new QLabel( "Test", NULL, + Qt::WindowStaysOnTopHint | Qt::FramelessWindowHint | Qt::Tool | Qt::X11BypassWindowManagerHint ); + mypLabel->setObjectName("ObjectTipText"); + mypLabel->setMargin( 1 ); + //mypLabel->setAutoMask( FALSE ); mypLabel->setFrameStyle( QFrame::Plain | QFrame::Box ); mypLabel->setLineWidth( 1 ); - mypLabel->setAlignment( AlignAuto | AlignTop ); + mypLabel->setAlignment( Qt::AlignAbsolute | Qt::AlignTop ); mypLabel->setIndent( 0 ); - mypLabel->polish(); + mypLabel->ensurePolished(); //mypLabel->setPalette( QToolTip::palette() ); diff --git a/src/GLViewer/GLViewer_ToolTip.h b/src/GLViewer/GLViewer_ToolTip.h index 508679b6a..ee01466cc 100644 --- a/src/GLViewer/GLViewer_ToolTip.h +++ b/src/GLViewer/GLViewer_ToolTip.h @@ -29,12 +29,14 @@ //#include //#include -#include +#include +#include #define TIP_TIME 1000 class GLViewer_ViewPort2d; class QLabel; +class QTimer; /*! \class GLViewer_ObjectTip ToolTip of GLViewer_Objects diff --git a/src/GLViewer/GLViewer_Tools.h b/src/GLViewer/GLViewer_Tools.h index ce7aa9db0..2ec85061e 100644 --- a/src/GLViewer/GLViewer_Tools.h +++ b/src/GLViewer/GLViewer_Tools.h @@ -30,9 +30,6 @@ #endif #include "GLViewer.h" -#include "GLViewer_Defs.h" - -class GLViewer_LineField; /*! \class GLViewer_Tools diff --git a/src/GLViewer/GLViewer_ViewFrame.cxx b/src/GLViewer/GLViewer_ViewFrame.cxx index c0b63bb6c..11e1229da 100644 --- a/src/GLViewer/GLViewer_ViewFrame.cxx +++ b/src/GLViewer/GLViewer_ViewFrame.cxx @@ -25,7 +25,6 @@ //#include #include "GLViewer_ViewFrame.h" #include "GLViewer_Viewer.h" -#include "GLViewer_Viewer2d.h" #include "GLViewer_ViewPort2d.h" #include @@ -34,11 +33,16 @@ #include #include -#include -#include -#include -#include -#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include /*! Constructor @@ -51,8 +55,9 @@ myVP( 0 ) QFrame* client = new QFrame( this ); setCentralWidget( client ); - QBoxLayout* layout = new QHBoxLayout( client, 1, 1 ); - layout->setAutoAdd( true ); + QBoxLayout* layout = new QHBoxLayout( client ); + layout->setMargin(1); + layout->setSpacing(1); GLViewer_ViewPort2d* vp = new GLViewer_ViewPort2d( client, this ); //vp->turnGrid( true ); @@ -60,10 +65,11 @@ myVP( 0 ) //vp->enablePopup( false ); setViewPort( vp ); setBackgroundColor( Qt::white ); + layout->addWidget( vp ); myToolBar = new QToolBar(this); - myToolBar->setCloseMode(QDockWindow::Undocked); - myToolBar->setLabel(tr("LBL_TOOLBAR_LABEL")); + //myToolBar->setCloseMode(QDockWindow::Undocked); + myToolBar->setWindowTitle(tr("LBL_TOOLBAR_LABEL")); createActions(); createToolBar(); } @@ -82,59 +88,59 @@ void GLViewer_ViewFrame::createActions() { if (!myActionsMap.isEmpty()) return; SUIT_ResourceMgr* aResMgr = SUIT_Session::session()->resourceMgr(); - QAction* aAction; + QtxAction* aAction; // Dump view - aAction = new QAction(tr("MNU_DUMP_VIEW"), aResMgr->loadPixmap( "GLViewer", tr( "ICON_GL_DUMP" ) ), - tr( "MNU_DUMP_VIEW" ), 0, this); + aAction = new QtxAction(tr("MNU_DUMP_VIEW"), aResMgr->loadPixmap( "GLViewer", tr( "ICON_GL_DUMP" ) ), + tr( "MNU_DUMP_VIEW" ), 0, this); aAction->setStatusTip(tr("DSC_DUMP_VIEW")); connect(aAction, SIGNAL(activated()), this, SLOT(onViewDump())); myActionsMap[ DumpId ] = aAction; // FitAll - aAction = new QAction(tr("MNU_FITALL"), aResMgr->loadPixmap( "GLViewer", tr( "ICON_GL_FITALL" ) ), - tr( "MNU_FITALL" ), 0, this); + aAction = new QtxAction(tr("MNU_FITALL"), aResMgr->loadPixmap( "GLViewer", tr( "ICON_GL_FITALL" ) ), + tr( "MNU_FITALL" ), 0, this); aAction->setStatusTip(tr("DSC_FITALL")); connect(aAction, SIGNAL(activated()), this, SLOT(onViewFitAll())); myActionsMap[ FitAllId ] = aAction; // FitRect - aAction = new QAction(tr("MNU_FITRECT"), aResMgr->loadPixmap( "GLViewer", tr( "ICON_GL_FITAREA" ) ), - tr( "MNU_FITRECT" ), 0, this); + aAction = new QtxAction(tr("MNU_FITRECT"), aResMgr->loadPixmap( "GLViewer", tr( "ICON_GL_FITAREA" ) ), + tr( "MNU_FITRECT" ), 0, this); aAction->setStatusTip(tr("DSC_FITRECT")); connect(aAction, SIGNAL(activated()), this, SLOT(onViewFitArea())); myActionsMap[ FitRectId ] = aAction; // FitSelect - aAction = new QAction(tr("MNU_FITSELECT"), aResMgr->loadPixmap( "GLViewer", tr( "ICON_GL_FITSELECT" ) ), - tr( "MNU_FITSELECT" ), 0, this); + aAction = new QtxAction(tr("MNU_FITSELECT"), aResMgr->loadPixmap( "GLViewer", tr( "ICON_GL_FITSELECT" ) ), + tr( "MNU_FITSELECT" ), 0, this); aAction->setStatusTip(tr("DSC_FITSELECT")); connect(aAction, SIGNAL(activated()), this, SLOT(onViewFitSelect())); myActionsMap[ FitSelectId ] = aAction; // Zoom - aAction = new QAction(tr("MNU_ZOOM_VIEW"), aResMgr->loadPixmap( "GLViewer", tr( "ICON_GL_ZOOM" ) ), - tr( "MNU_ZOOM_VIEW" ), 0, this); + aAction = new QtxAction(tr("MNU_ZOOM_VIEW"), aResMgr->loadPixmap( "GLViewer", tr( "ICON_GL_ZOOM" ) ), + tr( "MNU_ZOOM_VIEW" ), 0, this); aAction->setStatusTip(tr("DSC_ZOOM_VIEW")); connect(aAction, SIGNAL(activated()), this, SLOT(onViewZoom())); myActionsMap[ ZoomId ] = aAction; // Panning - aAction = new QAction(tr("MNU_PAN_VIEW"), aResMgr->loadPixmap( "GLViewer", tr( "ICON_GL_PAN" ) ), - tr( "MNU_PAN_VIEW" ), 0, this); + aAction = new QtxAction(tr("MNU_PAN_VIEW"), aResMgr->loadPixmap( "GLViewer", tr( "ICON_GL_PAN" ) ), + tr( "MNU_PAN_VIEW" ), 0, this); aAction->setStatusTip(tr("DSC_PAN_VIEW")); connect(aAction, SIGNAL(activated()), this, SLOT(onViewPan())); myActionsMap[ PanId ] = aAction; // Global Panning - aAction = new QAction(tr("MNU_GLOBALPAN_VIEW"), aResMgr->loadPixmap( "GLViewer", tr( "ICON_GL_GLOBALPAN" ) ), - tr( "MNU_GLOBALPAN_VIEW" ), 0, this); + aAction = new QtxAction(tr("MNU_GLOBALPAN_VIEW"), aResMgr->loadPixmap( "GLViewer", tr( "ICON_GL_GLOBALPAN" ) ), + tr( "MNU_GLOBALPAN_VIEW" ), 0, this); aAction->setStatusTip(tr("DSC_GLOBALPAN_VIEW")); connect(aAction, SIGNAL(activated()), this, SLOT(onViewGlobalPan())); myActionsMap[ GlobalPanId ] = aAction; - aAction = new QAction(tr("MNU_RESET_VIEW"), aResMgr->loadPixmap( "GLViewer", tr( "ICON_GL_RESET" ) ), - tr( "MNU_RESET_VIEW" ), 0, this); + aAction = new QtxAction(tr("MNU_RESET_VIEW"), aResMgr->loadPixmap( "GLViewer", tr( "ICON_GL_RESET" ) ), + tr( "MNU_RESET_VIEW" ), 0, this); aAction->setStatusTip(tr("DSC_RESET_VIEW")); connect(aAction, SIGNAL(activated()), this, SLOT(onViewReset())); myActionsMap[ ResetId ] = aAction; @@ -213,7 +219,7 @@ QColor GLViewer_ViewFrame::backgroundColor() const { if ( myVP ) return myVP->backgroundColor(); - return QMainWindow::backgroundColor(); + return palette().color( backgroundRole() ); } /*! @@ -380,7 +386,7 @@ void GLViewer_ViewFrame::onViewDump() #endif unsigned int* aPix = NULL; - QImage anImage( width, height, 32 ); + QImage anImage( width, height, QImage::Format_RGB32 ); for( int i = 0; i < height; i++ ) { memset( anImage.scanLine( i ), 0, sizeof(unsigned int)*width ); @@ -397,14 +403,16 @@ void GLViewer_ViewFrame::onViewDump() QString aFilter( "*.bmp\n*.png" ); - QFileDialog aFileDlg( QDir::current().absPath(), aFilter, this ); - aFileDlg.setCaption( tr( "DUMP_VIEW_SAVE_FILE_DLG_CAPTION" ) ); - aFileDlg.setMode( QFileDialog::AnyFile ); + QFileDialog aFileDlg( this, tr( "DUMP_VIEW_SAVE_FILE_DLG_CAPTION" ), QDir::current().absolutePath(), aFilter ); + aFileDlg.setFileMode( QFileDialog::AnyFile ); if( !aFileDlg.exec() ) return; - QString aFileName = aFileDlg.selectedFile(); + QStringList files = aFileDlg.selectedFiles(); + QString aFileName; + if ( !files.isEmpty() ) aFileName = files[0]; + QString aFileExt = aFileDlg.selectedFilter(); if( aFileName.isEmpty() ) @@ -415,7 +423,7 @@ void GLViewer_ViewFrame::onViewDump() } QString aSaveOp = "BMP"; - QString aTypedFileExt = QFileInfo( aFileName ).extension( false ).lower(); + QString aTypedFileExt = QFileInfo( aFileName ).suffix().toLower(); if( aFileExt == "*.bmp" ) { @@ -431,7 +439,7 @@ void GLViewer_ViewFrame::onViewDump() //#ifdef WIN32 // if( !anImage.save( aFileName, aSaveOp ) ) //#else - if( !aWidget->grabFrameBuffer().save( aFileName, aSaveOp ) ) + if( !aWidget->grabFrameBuffer().save( aFileName, aSaveOp.toLatin1().constData() ) ) //#endif { SUIT_MessageBox::critical( this, @@ -582,7 +590,7 @@ QString GLViewer_ViewFrame::getVisualParameters() */ void GLViewer_ViewFrame::setVisualParameters( const QString& parameters ) { - QStringList paramsLst = QStringList::split( '*', parameters, true ); + QStringList paramsLst = parameters.split( '*' ); if ( myVP && myVP->inherits( "GLViewer_ViewPort2d" ) && paramsLst.size() == 4) { GLViewer_ViewPort2d* vp2d = (GLViewer_ViewPort2d*)myVP; diff --git a/src/GLViewer/GLViewer_ViewFrame.h b/src/GLViewer/GLViewer_ViewFrame.h index ceb3f5be9..00b83e334 100644 --- a/src/GLViewer/GLViewer_ViewFrame.h +++ b/src/GLViewer/GLViewer_ViewFrame.h @@ -35,7 +35,7 @@ class SUIT_Desktop; class GLViewer_Viewer; class GLViewer_ViewPort; -#include +#include #ifdef WIN32 #pragma warning( disable:4251 ) @@ -113,7 +113,7 @@ private: private: //! Actions ID enum { DumpId, FitAllId, FitRectId, FitSelectId, ZoomId, PanId, GlobalPanId, ResetId }; - typedef QMap ActionsMap; + typedef QMap ActionsMap; private: ActionsMap myActionsMap; diff --git a/src/GLViewer/GLViewer_ViewManager.cxx b/src/GLViewer/GLViewer_ViewManager.cxx index 8e1f1e860..e1df3666a 100644 --- a/src/GLViewer/GLViewer_ViewManager.cxx +++ b/src/GLViewer/GLViewer_ViewManager.cxx @@ -24,7 +24,6 @@ //#include #include "GLViewer_ViewManager.h" -#include "GLViewer_ViewFrame.h" #include "GLViewer_Viewer2d.h" #include "SUIT_Desktop.h" @@ -41,7 +40,7 @@ GLViewer_ViewManager::~GLViewer_ViewManager() } /*!Context menu popup for \a popup.*/ -void GLViewer_ViewManager::contextMenuPopup( QPopupMenu* popup ) +void GLViewer_ViewManager::contextMenuPopup( QMenu* popup ) { SUIT_ViewManager::contextMenuPopup( popup ); // if it is necessary invoke method CreatePopup of ViewPort diff --git a/src/GLViewer/GLViewer_ViewManager.h b/src/GLViewer/GLViewer_ViewManager.h index 3542d63f3..c29525678 100644 --- a/src/GLViewer/GLViewer_ViewManager.h +++ b/src/GLViewer/GLViewer_ViewManager.h @@ -40,7 +40,7 @@ public: GLViewer_Viewer* getGLViewer() { return (GLViewer_Viewer*) myViewModel; } - virtual void contextMenuPopup( QPopupMenu* ); + virtual void contextMenuPopup( QMenu* ); }; #endif // GLVIEWER_VIEWMANAGER_H diff --git a/src/GLViewer/GLViewer_ViewPort.cxx b/src/GLViewer/GLViewer_ViewPort.cxx index 090af2381..5f9a48434 100644 --- a/src/GLViewer/GLViewer_ViewPort.cxx +++ b/src/GLViewer/GLViewer_ViewPort.cxx @@ -29,13 +29,16 @@ #include "SUIT_ResourceMgr.h" #include "SUIT_Session.h" -#include -#include -#include -#include -#include -#include -#include +#include +#include +#include +#include +//#include +#include +#include +#include +#include +#include #include @@ -79,17 +82,19 @@ CMapEntry::CMapEntry() CMapEntry::~CMapEntry() { if ( alloc ) - XFreeColormap( QPaintDevice::x11AppDisplay(), cmap ); + XFreeColormap( QX11Info::display(), cmap ); } -static QIntDict *cmap_dict = 0; +static QMultiHash *cmap_dict = 0; static bool mesa_gl = false; static void cleanup_cmaps() { if ( !cmap_dict ) return; - cmap_dict->setAutoDelete( true ); + //while (!cmap_dict->isEmpty()) + // cmap_dict->erase(cmap_dict->begin()); + cmap_dict->clear(); delete cmap_dict; cmap_dict = 0; } @@ -98,17 +103,17 @@ static Colormap choose_cmap( Display *dpy, XVisualInfo *vi ) { if ( !cmap_dict ) { - cmap_dict = new QIntDict; + cmap_dict = new QMultiHash; const char *v = glXQueryServerString( dpy, vi->screen, GLX_VERSION ); mesa_gl = strstr( v,"Mesa" ) != 0; qAddPostRoutine( cleanup_cmaps ); } - CMapEntry *x = cmap_dict->find( (long)vi->visualid ); - if ( x ) // found colormap for visual - return x->cmap; + QHash::iterator itH = cmap_dict->find( (long)vi->visualid ); + if ( itH != cmap_dict->end() ) // found colormap for visual + return itH.value().cmap; - x = new CMapEntry(); + CMapEntry x; XStandardColormap *c; int n, i; @@ -117,12 +122,12 @@ static Colormap choose_cmap( Display *dpy, XVisualInfo *vi ) cout << "Choosing cmap for vID = " << vi->visualid << endl; #endif - if ( vi->visualid == XVisualIDFromVisual( (Visual*)QPaintDevice::x11AppVisual() ) ) + if ( vi->visualid == XVisualIDFromVisual( (Visual*)QX11Info::appVisual() ) ) { #ifdef DEBUG cout << "Using x11AppColormap" << endl; #endif - return QPaintDevice::x11AppColormap(); + return QX11Info::appColormap(); } if ( mesa_gl ) @@ -133,12 +138,12 @@ static Colormap choose_cmap( Display *dpy, XVisualInfo *vi ) if ( XGetRGBColormaps( dpy, RootWindow( dpy, vi->screen ), &c, &n, hp_cmaps ) ) { i = 0; - while ( i < n && x->cmap == 0 ) + while ( i < n && x.cmap == 0 ) { if ( c[i].visualid == vi->visual->visualid ) { - x->cmap = c[i].colormap; - x->scmap = c[i]; + x.cmap = c[i].colormap; + x.scmap = c[i]; } i++; } @@ -147,19 +152,19 @@ static Colormap choose_cmap( Display *dpy, XVisualInfo *vi ) } } #if !defined( _OS_SOLARIS_ ) - if ( !x->cmap ) + if ( !x.cmap ) { if ( XmuLookupStandardColormap( dpy, vi->screen, vi->visualid, vi->depth, XA_RGB_DEFAULT_MAP, false, true ) ) { if ( XGetRGBColormaps( dpy, RootWindow( dpy, vi->screen ), &c, &n, XA_RGB_DEFAULT_MAP ) ) { i = 0; - while ( i < n && x->cmap == 0 ) + while ( i < n && x.cmap == 0 ) { if ( c[i].visualid == vi->visualid ) { - x->cmap = c[i].colormap; - x->scmap = c[i]; + x.cmap = c[i].colormap; + x.scmap = c[i]; } i++; } @@ -168,15 +173,15 @@ static Colormap choose_cmap( Display *dpy, XVisualInfo *vi ) } } #endif - if ( !x->cmap ) + if ( !x.cmap ) { // no shared cmap found - x->cmap = XCreateColormap( dpy, RootWindow( dpy, vi->screen ), vi->visual, AllocNone ); - x->alloc = true; + x.cmap = XCreateColormap( dpy, RootWindow( dpy, vi->screen ), vi->visual, AllocNone ); + x.alloc = true; } cmap_dict->insert( (long)vi->visualid, x ); // associate cmap with visualid - return x->cmap; + return x.cmap; } #endif @@ -194,10 +199,10 @@ QCursor* GLViewer_ViewPort::sketchCursor = 0; */ void GLViewer_ViewPort::createCursors () { - defCursor = new QCursor( ArrowCursor ); - panglCursor = new QCursor( CrossCursor ); - handCursor = new QCursor( PointingHandCursor ); - panCursor = new QCursor( SizeAllCursor ); + defCursor = new QCursor( Qt::ArrowCursor ); + panglCursor = new QCursor( Qt::CrossCursor ); + handCursor = new QCursor( Qt::PointingHandCursor ); + panCursor = new QCursor( Qt::SizeAllCursor ); SUIT_ResourceMgr* rmgr = SUIT_Session::session()->resourceMgr(); zoomCursor = new QCursor( rmgr->loadPixmap( "GLViewer", tr( "ICON_GL_CURSOR_ZOOM" ) ) ); @@ -293,7 +298,7 @@ void GLViewer_ViewPort::setSketchCursor( const QCursor& newCursor ) Constructor */ GLViewer_ViewPort::GLViewer_ViewPort( QWidget* parent ) -: QWidget( parent, 0, WRepaintNoErase | WResizeNoErase ) +: QWidget( parent, 0 ) { initialize(); } @@ -320,9 +325,9 @@ void GLViewer_ViewPort::initialize() myEnableTransform = true; setMouseTracking( true ); - setBackgroundMode( NoBackground ); + setBackgroundRole( QPalette::NoRole );//NoBackground ); - setFocusPolicy( StrongFocus ); + setFocusPolicy( Qt::StrongFocus ); } /*! @@ -341,7 +346,7 @@ void GLViewer_ViewPort::selectVisualId( ViewType type ) { #if !defined WIN32 XVisualInfo* pVisualInfo; - if ( x11Display() ) + if ( QX11Info::display() ) { /* Initialization with the default VisualID */ //Visual *v = DefaultVisual( x11Display(), DefaultScreen( x11Display() ) ); @@ -351,17 +356,17 @@ void GLViewer_ViewPort::selectVisualId( ViewType type ) int visualAttr[] = { GLX_RGBA, GLX_DEPTH_SIZE, 1, GLX_RED_SIZE, 1, GLX_GREEN_SIZE, 1, GLX_BLUE_SIZE, 1, GLX_DOUBLEBUFFER, None }; - pVisualInfo = ::glXChooseVisual( x11Display(), DefaultScreen( x11Display() ), visualAttr ); + pVisualInfo = ::glXChooseVisual( QX11Info::display(), DefaultScreen( QX11Info::display() ), visualAttr ); if ( isVisible() ) hide(); XSetWindowAttributes a; - a.colormap = choose_cmap( x11Display(), pVisualInfo ); /* find best colormap */ - a.background_pixel = backgroundColor().pixel(); - a.border_pixel = black.pixel(); - Window p = RootWindow( x11Display(), DefaultScreen( x11Display() ) ); + a.colormap = choose_cmap( QX11Info::display(), pVisualInfo ); /* find best colormap */ + a.background_pixel = QColormap::instance().pixel( backgroundColor() ); + a.border_pixel = QColormap::instance().pixel( Qt::black ); + Window p = RootWindow( QX11Info::display(), DefaultScreen( QX11Info::display() ) ); if ( parentWidget() ) p = parentWidget()->winId(); @@ -369,16 +374,16 @@ void GLViewer_ViewPort::selectVisualId( ViewType type ) if ( type == Type2D ) // creating simple X window for 2d { unsigned long xbackground = - BlackPixel( x11Display(), DefaultScreen( x11Display() ) ); + BlackPixel( QX11Info::display(), DefaultScreen( QX11Info::display() ) ); unsigned long xforeground = - WhitePixel( x11Display(), DefaultScreen( x11Display() ) ); + WhitePixel( QX11Info::display(), DefaultScreen( QX11Info::display() ) ); - w = XCreateSimpleWindow ( x11Display(), p, x(), y(), width(), + w = XCreateSimpleWindow ( QX11Info::display(), p, x(), y(), width(), height(), 0, xforeground, xbackground ); } else if ( type == Type3D ) { - w = XCreateWindow( x11Display(), p, x(), y(), width(), height(), + w = XCreateWindow( QX11Info::display(), p, x(), y(), width(), height(), 0, pVisualInfo->depth, InputOutput, pVisualInfo->visual, CWBackPixel | CWBorderPixel | CWColormap, &a ); } @@ -388,7 +393,7 @@ void GLViewer_ViewPort::selectVisualId( ViewType type ) Window *cmw; Window *cmwret; int count; - if ( XGetWMColormapWindows( x11Display(), topLevelWidget()->winId(), &cmwret, &count ) ) + if ( XGetWMColormapWindows( QX11Info::display(), topLevelWidget()->winId(), &cmwret, &count ) ) { cmw = new Window[count+1]; memcpy( (char*)cmw, (char*)cmwret, sizeof(Window) * count ); @@ -416,7 +421,7 @@ void GLViewer_ViewPort::selectVisualId( ViewType type ) /* Creating new window (with good VisualID) for this widget */ create(w); - XSetWMColormapWindows( x11Display(), topLevelWidget()->winId(), cmw, count ); + XSetWMColormapWindows( QX11Info::display(), topLevelWidget()->winId(), cmw, count ); delete[] cmw; if ( isVisible() ) @@ -426,7 +431,7 @@ void GLViewer_ViewPort::selectVisualId( ViewType type ) { XFree( (char *)pVisualInfo ); } - XFlush( x11Display() ); + XFlush( QX11Info::display() ); } #endif } @@ -437,7 +442,7 @@ void GLViewer_ViewPort::selectVisualId( ViewType type ) void GLViewer_ViewPort::setBackgroundColor( const QColor& color ) { QPalette pal = palette(); - pal.setColor( QColorGroup::Background, color ); + pal.setColor( QPalette::Background, color ); setPalette( pal ); repaint(); } @@ -447,7 +452,7 @@ void GLViewer_ViewPort::setBackgroundColor( const QColor& color ) */ QColor GLViewer_ViewPort::backgroundColor() const { - return palette().active().background(); + return palette().color( QPalette::Active, QPalette::Background ); } /*! diff --git a/src/GLViewer/GLViewer_ViewPort.h b/src/GLViewer/GLViewer_ViewPort.h index f6c3cee51..524f8d3d0 100644 --- a/src/GLViewer/GLViewer_ViewPort.h +++ b/src/GLViewer/GLViewer_ViewPort.h @@ -27,12 +27,12 @@ #include "GLViewer.h" -#include -#include -#include -#include +//#include +#include +//#include +#include -#include +//#include class QRect; class QCursor; diff --git a/src/GLViewer/GLViewer_ViewPort2d.cxx b/src/GLViewer/GLViewer_ViewPort2d.cxx index 3055726ec..25fd15ac6 100644 --- a/src/GLViewer/GLViewer_ViewPort2d.cxx +++ b/src/GLViewer/GLViewer_ViewPort2d.cxx @@ -28,23 +28,25 @@ #include "GLViewer_ViewPort2d.h" #include "GLViewer_Viewer2d.h" #include "GLViewer_ViewFrame.h" -#include "GLViewer_MimeSource.h" +#include "GLViewer_MimeData.h" #include "GLViewer_Context.h" #include "GLViewer_Compass.h" #include "GLViewer_Grid.h" +#include "GLViewer_Drawer.h" #include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include +#include +#include +#include +//#include +//#include +#include +#include +#include +#include +#include +#include #define WIDTH 640 #define HEIGHT 480 @@ -71,7 +73,8 @@ GLViewer_ViewPort2d::GLViewer_ViewPort2d( QWidget* parent, GLViewer_ViewFrame* t myMargin( MARGIN ), myWidth( WIDTH ), myHeight( HEIGHT ), myXScale( 1.0 ), myYScale( 1.0 ), myXOldScale( 1.0 ), myYOldScale( 1.0 ), myXPan( 0.0 ), myYPan( 0.0 ), - myIsMouseReleaseBlock( false ) + myIsMouseReleaseBlock( false ), + myRectBand(0) { if( theViewFrame == NULL ) myViewFrame = ( GLViewer_ViewFrame* )parent; @@ -121,6 +124,9 @@ GLViewer_ViewPort2d::~GLViewer_ViewPort2d() delete myBorder; delete myGLWidget; + + if ( myRectBand ) myRectBand->hide(); + delete myRectBand; } /*! @@ -162,17 +168,17 @@ void GLViewer_ViewPort2d::onCutObject() int aObjNum = aContext->NbSelected(); if( aObjNum > 0 ) { - QValueList aObjects; - GLViewer_MimeSource* aMimeSource = new GLViewer_MimeSource(); + QList aObjects; + GLViewer_MimeData* aMimeData = new GLViewer_MimeData(); aContext->InitSelected(); for( ; aContext->MoreSelected(); aContext->NextSelected() ) aObjects.append( aContext->SelectedObject() ); - //aMimeSource->setObjects( aObjects ); ouv 6.05.04 + //aMimeData->setObjects( aObjects ); ouv 6.05.04 QClipboard *aClipboard = QApplication::clipboard(); aClipboard->clear(); - aClipboard->setData( aMimeSource ); + aClipboard->setMimeData( aMimeData ); for( int i = 0; i < aObjNum; i++ ) aContext->deleteObject( aObjects[i] ); @@ -199,17 +205,17 @@ void GLViewer_ViewPort2d::onCopyObject() int aObjNum = aContext->NbSelected(); if( aObjNum > 0 ) { - QValueList aObjects; - GLViewer_MimeSource* aMimeSource = new GLViewer_MimeSource(); + QList aObjects; + GLViewer_MimeData* aMimeData = new GLViewer_MimeData(); aContext->InitSelected(); for( ; aContext->MoreSelected(); aContext->NextSelected() ) aObjects.append( aContext->SelectedObject() ); - //aMimeSource->setObjects( aObjects ); ouv 6.05.04 + //aMimeData->setObjects( aObjects ); ouv 6.05.04 QClipboard *aClipboard = QApplication::clipboard(); aClipboard->clear(); - aClipboard->setData( aMimeSource ); + aClipboard->setMimeData( aMimeData ); } } @@ -251,7 +257,7 @@ void GLViewer_ViewPort2d::onPasteObject() if( aMimeSource->provides( "GLViewer_Objects" ) ) { QByteArray anArray = aMimeSource->encodedData( "GLViewer_Objects" ); - QValueList aObjects = GLViewer_MimeSource::getObjects( anArray, "GLViewer_Objects" ); + QList aObjects = GLViewer_MimeSource::getObjects( anArray, "GLViewer_Objects" ); if( aObjects.empty() ) return; GLViewer_Context* aContext = ((GLViewer_Viewer2d*)getViewFrame()->getViewer())->getGLContext(); @@ -288,7 +294,7 @@ void GLViewer_ViewPort2d::onDragObject( QMouseEvent* e ) //QPoint aNewPos = e->pos(); //GLViewer_Viewer2d* aViewer = (GLViewer_Viewer2d*)getViewFrame()->getViewer(); - if( anObject && (e->state() & LeftButton ) ) + if( anObject && (e->buttons() & Qt::LeftButton ) ) { if( aContext->isSelected( anObject ) ) { @@ -302,7 +308,7 @@ void GLViewer_ViewPort2d::onDragObject( QMouseEvent* e ) else anObject->moveObject( aX - *myCurDragPosX, anY - *myCurDragPosY); } - else if( aContext->NbSelected() && (e->state() & MidButton ) ) + else if( aContext->NbSelected() && (e->buttons() & Qt::MidButton ) ) for( aContext->InitSelected(); aContext->MoreSelected(); aContext->NextSelected() ) (aContext->SelectedObject())->moveObject( aX - *myCurDragPosX, anY - *myCurDragPosY); @@ -328,7 +334,7 @@ void GLViewer_ViewPort2d::mousePressEvent( QMouseEvent* e ) if( aContext ) anObject = aContext->getCurrentObject(); - bool accel = e->state() & GLViewer_ViewTransformer::accelKey(); + bool accel = e->modifiers() & GLViewer_ViewTransformer::accelKey(); if( ( anObject && !( accel || e->button() == Qt::RightButton ) ) || ( aContext->NbSelected() && !accel && e->button() == Qt::MidButton ) ) { @@ -819,7 +825,7 @@ void GLViewer_ViewPort2d::fitAll( bool keepScale, bool withZ ) float dx, dy, zm; float xScale, yScale; - myMargin = QMAX( myBorder->width(), myBorder->height() ) / 5; + myMargin = qMax( myBorder->width(), myBorder->height() ) / 5; xa = myBorder->left() - myMargin; xb = myBorder->right() + myMargin; @@ -1156,6 +1162,14 @@ void GLViewer_ViewPort2d::startSelectByRect( int x, int y ) mypFirstPoint = new QPoint( x, y ); mypLastPoint = new QPoint( x, y ); } + + if ( !myRectBand ) { + myRectBand = new QRubberBand( QRubberBand::Rectangle, this ); + QPalette palette; + palette.setColor(myRectBand->foregroundRole(), Qt::white); + myRectBand->setPalette(palette); + } + myRectBand->hide(); } /*! @@ -1166,17 +1180,14 @@ void GLViewer_ViewPort2d::drawSelectByRect( int x, int y ) { if( mypFirstPoint && mypLastPoint ) { - - QPainter p( getPaintDevice() ); - p.setPen( Qt::white ); - p.setRasterOp( Qt::XorROP ); - - p.drawRect( selectionRect() ); /* erase */ - - mypLastPoint->setX( x ); + myRectBand->hide(); /* erase */ + + mypLastPoint->setX( x ); mypLastPoint->setY( y ); - p.drawRect( selectionRect() ); /* draw */ + QRect aRect = selectionRect(); + myRectBand->setGeometry( aRect ); /* draw */ + myRectBand->setVisible( aRect.isValid() ); } } @@ -1189,17 +1200,17 @@ void GLViewer_ViewPort2d::finishSelectByRect() if( mypFirstPoint && mypLastPoint ) { - QPainter p( getPaintDevice() ); - p.setPen( Qt::white ); - p.setRasterOp( Qt::XorROP ); - p.drawRect( selectionRect() ); /* erase */ + if ( myRectBand ) myRectBand->hide(); /* erase */ delete mypFirstPoint; delete mypLastPoint; mypFirstPoint = NULL; mypLastPoint = NULL; + + delete myRectBand; + myRectBand = 0; } } @@ -1211,10 +1222,10 @@ QRect GLViewer_ViewPort2d::selectionRect() QRect aRect; if( mypFirstPoint && mypLastPoint ) { - aRect.setLeft( QMIN( mypFirstPoint->x(), mypLastPoint->x() ) ); - aRect.setTop( QMIN( mypFirstPoint->y(), mypLastPoint->y() ) ); - aRect.setRight( QMAX( mypFirstPoint->x(), mypLastPoint->x() ) ); - aRect.setBottom( QMAX( mypFirstPoint->y(), mypLastPoint->y() ) ); + aRect.setLeft( qMin( mypFirstPoint->x(), mypLastPoint->x() ) ); + aRect.setTop( qMin( mypFirstPoint->y(), mypLastPoint->y() ) ); + aRect.setRight( qMax( mypFirstPoint->x(), mypLastPoint->x() ) ); + aRect.setBottom( qMax( mypFirstPoint->y(), mypLastPoint->y() ) ); } return aRect; @@ -1357,9 +1368,9 @@ void GLViewer_ViewPort2d::onMaybeTip( QPoint thePoint, QString& theText, QFont& QStringList aList; if( anObj->isTooTipHTML() ) - aList = QStringList::split( "
", theText ); + aList = theText.split( "
", QString::SkipEmptyParts ); else - aList = QStringList::split( "\n", theText ); + aList = theText.split( "\n", QString::SkipEmptyParts ); if( !aList.isEmpty() ) { diff --git a/src/GLViewer/GLViewer_ViewPort2d.h b/src/GLViewer/GLViewer_ViewPort2d.h index cf534f8a4..03a4b149f 100644 --- a/src/GLViewer/GLViewer_ViewPort2d.h +++ b/src/GLViewer/GLViewer_ViewPort2d.h @@ -36,10 +36,9 @@ #include "GLViewer_Widget.h" #include "GLViewer_Geom.h" -#include -#include -#include -#include +#include +#include +#include #ifdef WIN32 #pragma warning( disable:4251 ) @@ -51,6 +50,10 @@ class GLViewer_Object; class GLViewer_ViewFrame; class QtxToolTip; + +class QWidget; +class QRubberBand; + /*! * Class GLViewer_ViewPort * 2D visualisation canvas of GLViewer @@ -237,6 +240,8 @@ protected: QtxToolTip* myObjectTip; //! flag to block mouse release event just after mouse double-click bool myIsMouseReleaseBlock; + + QRubberBand* myRectBand; //!< selection rectangle rubber band }; #ifdef WIN32 diff --git a/src/GLViewer/GLViewer_Viewer.cxx b/src/GLViewer/GLViewer_Viewer.cxx index 3363add16..f850eeb41 100644 --- a/src/GLViewer/GLViewer_Viewer.cxx +++ b/src/GLViewer/GLViewer_Viewer.cxx @@ -28,13 +28,17 @@ #include "GLViewer_ViewPort.h" #include "GLViewer_ViewFrame.h" -#include "SUIT_Desktop.h" +//#include "SUIT_Desktop.h" #include "SUIT_ViewWindow.h" +#include "SUIT_ViewManager.h" -#include -#include -#include -#include +#include +#include +#include +#include +#include +#include +#include /* used for sketching */ static QEvent* l_mbPressEvent = 0; @@ -85,12 +89,12 @@ void GLViewer_Viewer::setViewManager(SUIT_ViewManager* theViewManager) /*! Builds popup for GL viewer */ -void GLViewer_Viewer::contextMenuPopup( QPopupMenu* thePopup ) +void GLViewer_Viewer::contextMenuPopup( QMenu* thePopup ) { - if( thePopup->count() > 0 ) - thePopup->insertSeparator(); + if( thePopup->actions().count() > 0 ) + thePopup->addSeparator(); - thePopup->insertItem( tr( "CHANGE_BGCOLOR" ), this, SLOT( onChangeBgColor() ) ); + thePopup->addAction( tr( "CHANGE_BGCOLOR" ), this, SLOT( onChangeBgColor() ) ); } /*! @@ -389,7 +393,7 @@ void GLViewer_Viewer::onWheelEvent( SUIT_ViewWindow*, QWheelEvent* e ) void GLViewer_Viewer::onSelectionModeChanged() { bool enable = ( mySelMode == Multiple ); - QPtrVector views = getViewManager()->getViews(); + QVector views = getViewManager()->getViews(); for ( int i = 0, n = views.count(); i < n; i++ ) { GLViewer_ViewPort* vp = ((GLViewer_ViewFrame*)views[i])->getViewPort(); @@ -403,7 +407,7 @@ void GLViewer_Viewer::onSelectionModeChanged() */ void GLViewer_Viewer::update( int flags ) { - QPtrVector views = getViewManager()->getViews(); + QVector views = getViewManager()->getViews(); for ( int i = 0, n = views.count(); i < n; i++ ) ((GLViewer_ViewFrame*)views[i])->onUpdate( flags ); } @@ -424,9 +428,9 @@ void GLViewer_Viewer::unhilightDetected() void GLViewer_Viewer::handleMousePress( QMouseEvent* e ) { /* test accel for transforms */ - if ( e->state() & GLViewer_ViewTransformer::accelKey() ) + if ( e->modifiers() & GLViewer_ViewTransformer::accelKey() ) { - ButtonState bs = e->button(); + Qt::MouseButton bs = e->button(); if ( bs == GLViewer_ViewTransformer::zoomButton() ) activateTransform( Zoom ); else if ( bs == GLViewer_ViewTransformer::panButton() ) @@ -458,7 +462,7 @@ void GLViewer_Viewer::handleMousePress( QMouseEvent* e ) void GLViewer_Viewer::handleMouseMove( QMouseEvent* e ) { /* Highlight for selection */ - bool dragged = ( e->state() & ( LeftButton | MidButton | RightButton ) ); + bool dragged = ( e->buttons() & ( Qt::LeftButton | Qt::MidButton | Qt::RightButton ) ); if ( !dragged ) { if ( getSelector() ) @@ -466,7 +470,7 @@ void GLViewer_Viewer::handleMouseMove( QMouseEvent* e ) } /* Try to activate default sketching */ - else if ( e->state() == GLViewer_ViewSketcher::sketchButton() ) + else if ( e->button() == GLViewer_ViewSketcher::sketchButton() ) { activateSketching( Rect ); if ( mySketcher ) @@ -495,11 +499,11 @@ void GLViewer_Viewer::handleMouseRelease( QMouseEvent* e ) { /* selection */ /* tmp - in handleMousePress*/ - if( e->button() == LeftButton && !(getActiveView()->getViewPort()->currentBlock() & BS_Selection) ) + if( e->button() == Qt::LeftButton && !(getActiveView()->getViewPort()->currentBlock() & BS_Selection) ) { if ( getSelector() ) { - bool append = bool ( e->state() & GLViewer_Selector::appendKey() ); + bool append = bool ( e->modifiers() & GLViewer_Selector::appendKey() ); getSelector()->select( append ); } } @@ -526,7 +530,7 @@ int GLViewer_ViewTransformer::panBtn = Qt::MidButton; int GLViewer_ViewTransformer::zoomBtn = Qt::LeftButton; int GLViewer_ViewTransformer::fitRectBtn = Qt::LeftButton; int GLViewer_ViewTransformer::panGlobalBtn = Qt::LeftButton; -int GLViewer_ViewTransformer::acccelKey = Qt::ControlButton; +int GLViewer_ViewTransformer::acccelKey = Qt::ControlModifier; /*! Constructor @@ -535,8 +539,9 @@ GLViewer_ViewTransformer::GLViewer_ViewTransformer( GLViewer_Viewer* v, int type : QObject( 0 ), myViewer( v ), myType( type ), -myMajorBtn( NoButton ), -myButtonState( 0 ) +myMajorBtn( Qt::NoButton ), +myButtonState( 0 ), +myRectBand( 0 ) { if ( myType == GLViewer_Viewer::Pan || myType == GLViewer_Viewer::Zoom || @@ -563,6 +568,8 @@ GLViewer_ViewTransformer::~GLViewer_ViewTransformer() } //QAD_Application::getDesktop()->clearInfo(); + + endDrawRect(); } /*! @@ -645,11 +652,11 @@ bool GLViewer_ViewTransformer::eventFilter( QObject* o, QEvent* e ) TransformState state = EnTrain; QMouseEvent* me = ( QMouseEvent* )e; - myButtonState = me->state(); + myButtonState = me->modifiers(); if ( e->type() == QEvent::MouseButtonPress ) myButtonState |= me->button(); /* add pressed button */ - int mouseOnlyState = ( myButtonState & ( LeftButton | MidButton | RightButton ) ); + int mouseOnlyState = ( myButtonState & ( Qt::LeftButton | Qt::MidButton | Qt::RightButton ) ); if ( myStart.isNull() ) { state = Debut; @@ -704,8 +711,8 @@ void GLViewer_ViewTransformer::onTransform( TransformState state ) { if ( doTrsf ) { - QRect rect( QMIN( myStart.x(), myCurr.x() ), QMIN( myStart.y(), myCurr.y() ), - QABS( myStart.x() - myCurr.x() ), QABS( myStart.y() - myCurr.y() ) ); + QRect rect( qMin( myStart.x(), myCurr.x() ), qMin( myStart.y(), myCurr.y() ), + qAbs( myStart.x() - myCurr.x() ), qAbs( myStart.y() - myCurr.y() ) ); if ( !rect.isEmpty() ) { switch ( state ) @@ -715,13 +722,7 @@ void GLViewer_ViewTransformer::onTransform( TransformState state ) break; default: { - QPainter p( avp->getPaintDevice() ); // for QAD_GLWidget - p.setPen( Qt::white ); - p.setRasterOp( Qt::XorROP ); - if ( !myDrawRect.isEmpty() ) - p.drawRect( myDrawRect ); /* erase */ - p.drawRect( rect ); - myDrawRect = rect; + drawRect( rect ); break; } } @@ -737,6 +738,34 @@ void GLViewer_ViewTransformer::onTransform( TransformState state ) myViewer->activateTransform( GLViewer_Viewer::NoTransform ); } +/*! + Draws rectangle by starting and current points +*/ +void GLViewer_ViewTransformer::drawRect(const QRect& theRect) +{ + if ( !myRectBand ) { + myRectBand = new QRubberBand( QRubberBand::Rectangle, myViewer->getActiveView()->getViewPort() ); + QPalette palette; + palette.setColor(myRectBand->foregroundRole(), Qt::white); + myRectBand->setPalette(palette); + } + myRectBand->hide(); + + myRectBand->setGeometry( theRect ); + myRectBand->setVisible( theRect.isValid() ); +} + +/*! + \brief Delete rubber band on the end on the dragging operation. +*/ +void GLViewer_ViewTransformer::endDrawRect() +{ + if ( myRectBand ) myRectBand->hide(); + + delete myRectBand; + myRectBand = 0; +} + /*! Returns the type of the transformer. [ public ] */ @@ -746,7 +775,7 @@ int GLViewer_ViewTransformer::type() const } -int GLViewer_ViewSketcher::sketchBtn = LeftButton; +int GLViewer_ViewSketcher::sketchBtn = Qt::LeftButton; /*! Constructor @@ -755,7 +784,8 @@ GLViewer_ViewSketcher::GLViewer_ViewSketcher( GLViewer_Viewer* viewer, int type : QObject( 0 ), myViewer( viewer ), myData( 0 ), -myType( type ) +myType( type ), +myRectBand( 0 ) { if( !myViewer ) return; @@ -782,6 +812,8 @@ GLViewer_ViewSketcher::~GLViewer_ViewSketcher() if ( myType == GLViewer_Viewer::Rect ) delete ( QRect* ) myData; + + endDrawRect(); } /*! @@ -798,7 +830,7 @@ bool GLViewer_ViewSketcher::eventFilter( QObject* o, QEvent* e ) SketchState state = EnTrain; QMouseEvent* me = (QMouseEvent*)e; - myButtonState = me->state(); + myButtonState = me->modifiers(); if ( e->type() == QEvent::MouseButtonPress ) myButtonState |= me->button(); /* add pressed button */ @@ -808,7 +840,7 @@ bool GLViewer_ViewSketcher::eventFilter( QObject* o, QEvent* e ) myStart = me->pos(); } - int mouseOnlyState = ( myButtonState & ( LeftButton | MidButton | RightButton ) ); + int mouseOnlyState = ( myButtonState & ( Qt::LeftButton | Qt::MidButton | Qt::RightButton ) ); if ( e->type() == QEvent::MouseButtonRelease && mouseOnlyState == sketchButton() ) { state = Fin; @@ -836,18 +868,15 @@ void GLViewer_ViewSketcher::onSketch( SketchState state ) QRect* sketchRect = ( QRect* )data(); if ( myButtonState & sketchButton() ) { - QRect rect( QMIN( myStart.x(), myCurr.x() ), QMIN( myStart.y(), myCurr.y() ), - QABS( myStart.x() - myCurr.x() ), QABS( myStart.y() - myCurr.y() ) ); + QRect rect( qMin( myStart.x(), myCurr.x() ), qMin( myStart.y(), myCurr.y() ), + qAbs( myStart.x() - myCurr.x() ), qAbs( myStart.y() - myCurr.y() ) ); if ( !rect.isEmpty() ) { - QPainter p( avp ); - p.setPen( Qt::white ); - p.setRasterOp( Qt::XorROP ); - if ( !sketchRect->isEmpty() ) - p.drawRect( *sketchRect ); /* erase */ + if ( !sketchRect->isEmpty() && myRectBand ) + myRectBand->hide(); /* erase */ *sketchRect = rect; if ( state != Fin ) - p.drawRect( *sketchRect ); + drawRect( *sketchRect ); } } } @@ -858,3 +887,31 @@ void GLViewer_ViewSketcher::onSketch( SketchState state ) myViewer->activateSketching( GLViewer_Viewer::NoSketching ); } } + +/*! + Draws rectangle by starting and current points +*/ +void GLViewer_ViewSketcher::drawRect(const QRect& theRect) +{ + if ( !myRectBand ) { + myRectBand = new QRubberBand( QRubberBand::Rectangle, myViewer->getActiveView()->getViewPort() ); + QPalette palette; + palette.setColor(myRectBand->foregroundRole(), Qt::white); + myRectBand->setPalette(palette); + } + myRectBand->hide(); + + myRectBand->setGeometry( theRect ); + myRectBand->setVisible( theRect.isValid() ); +} + +/*! + \brief Delete rubber band on the end on the dragging operation. +*/ +void GLViewer_ViewSketcher::endDrawRect() +{ + if ( myRectBand ) myRectBand->hide(); + + delete myRectBand; + myRectBand = 0; +} diff --git a/src/GLViewer/GLViewer_Viewer.h b/src/GLViewer/GLViewer_Viewer.h index a17664bcb..c12d5f901 100644 --- a/src/GLViewer/GLViewer_Viewer.h +++ b/src/GLViewer/GLViewer_Viewer.h @@ -25,20 +25,25 @@ #ifndef GLVIEWER_VIEWER_H #define GLVIEWER_VIEWER_H +#include "GLViewer.h" #include "GLViewer_Defs.h" -#include "GLViewer_ViewFrame.h" #include -#include -#include -#include -#include +#include +#include + +class QMouseEvent; +class QKeyEvent; +class QWheelEvent; +class QRect; +class QRubberBand; class GLViewer_Selector; class GLViewer_ViewSketcher; class GLViewer_ViewTransformer; +class GLViewer_ViewFrame; -class SUIT_Desktop; +//class SUIT_Desktop; class SUIT_ViewWindow; #ifdef WIN32 @@ -68,7 +73,7 @@ public: virtual QString getType() const { return Type(); } static QString Type() { return "GLViewer_ViewModel"; } - virtual void contextMenuPopup( QPopupMenu* ); + virtual void contextMenuPopup( QMenu* ); public: void setSelectionMode( SelectionMode ); @@ -166,6 +171,9 @@ protected: virtual void onTransform( TransformState ); void initTransform( bool ); + void drawRect(const QRect& theRect); + void endDrawRect(); + protected: static int panBtn; static int zoomBtn; @@ -180,8 +188,9 @@ protected: bool mySavedMouseTrack; QPoint myStart, myCurr; int myButtonState; - QRect myDrawRect; int myMajorBtn; + + QRubberBand* myRectBand; //!< selection rectangle rubber band }; class GLVIEWER_API GLViewer_ViewSketcher : public QObject @@ -210,6 +219,9 @@ protected: enum SketchState { Debut, EnTrain, Fin }; virtual void onSketch( SketchState ); + void drawRect(const QRect& theRect); + void endDrawRect(); + protected: static int sketchBtn; GLViewer_Viewer* myViewer; @@ -218,6 +230,8 @@ protected: QCursor mySavedCursor; QPoint myStart, myCurr; int myButtonState; + + QRubberBand* myRectBand; //!< selection rectangle rubber band }; #ifdef WIN32 diff --git a/src/GLViewer/GLViewer_Viewer2d.cxx b/src/GLViewer/GLViewer_Viewer2d.cxx index 7d03218ba..0f69c54e1 100644 --- a/src/GLViewer/GLViewer_Viewer2d.cxx +++ b/src/GLViewer/GLViewer_Viewer2d.cxx @@ -25,6 +25,7 @@ //#include #include "GLViewer_Viewer2d.h" #include "GLViewer_Object.h" +#include "GLViewer_ViewFrame.h" #include "GLViewer_BaseObjects.h" #include "GLViewer_CoordSystem.h" #include "GLViewer_Context.h" @@ -35,13 +36,14 @@ #include "SUIT_Desktop.h" #include "SUIT_ViewWindow.h" +#include "SUIT_ViewManager.h" -#include "OSD_Timer.hxx" -#include - -#include -#include -#include +#include +#include +#include +#include +#include +#include /*! Constructor @@ -83,14 +85,14 @@ SUIT_ViewWindow* GLViewer_Viewer2d::createView( SUIT_Desktop* theDesktop ) Adds item for change background color \param thePopup - menu */ -void GLViewer_Viewer2d::addPopupItems( QPopupMenu* thePopup ) +void GLViewer_Viewer2d::addPopupItems( QMenu* thePopup ) { // CTH8434. "Change background color" menu item is available if there are no selected objects if ( getSelector() == 0 || getSelector()->numSelected() == 0 ) { - if( thePopup->count() > 0 ) - thePopup->insertSeparator(); - thePopup->insertItem( tr( "CHANGE_BGCOLOR" ), this, SLOT( onChangeBgColor() ) ); + if( thePopup->actions().count() > 0 ) + thePopup->addSeparator(); + thePopup->addAction( tr( "CHANGE_BGCOLOR" ), this, SLOT( onChangeBgColor() ) ); } } @@ -145,15 +147,15 @@ void GLViewer_Viewer2d::updateColors( QColor colorH, QColor colorS ) */ void GLViewer_Viewer2d::updateBorders( GLViewer_Rect* theRect ) { - QPtrVector views = getViewManager()->getViews(); + QVector views = getViewManager()->getViews(); for ( int i = 0, n = views.count(); i < n; i++ ) { GLViewer_Rect* border = ( ( GLViewer_ViewPort2d* )((GLViewer_ViewFrame*)views[i])->getViewPort() )->getBorder(); - border->setLeft( QMIN( border->left(), theRect->left() ) ); - border->setRight( QMAX( border->right(), theRect->right() ) ); - border->setBottom( QMIN( border->bottom(), theRect->bottom() ) ); - border->setTop( QMAX( border->top(), theRect->top() ) ); + border->setLeft( qMin( border->left(), theRect->left() ) ); + border->setRight( qMax( border->right(), theRect->right() ) ); + border->setBottom( qMin( border->bottom(), theRect->bottom() ) ); + border->setTop( qMax( border->top(), theRect->top() ) ); } } @@ -162,7 +164,7 @@ void GLViewer_Viewer2d::updateBorders( GLViewer_Rect* theRect ) */ void GLViewer_Viewer2d::updateBorders() { - QPtrVector views = getViewManager()->getViews(); + QVector views = getViewManager()->getViews(); ObjList anObjects = myGLContext->getObjects(); ObjList::Iterator beginIt = anObjects.begin(); @@ -189,10 +191,10 @@ void GLViewer_Viewer2d::updateBorders() } else { - border->setLeft( QMIN( border->left(), aRect->left() ) ); - border->setRight( QMAX( border->right(), aRect->right() ) ); - border->setBottom( QMIN( border->bottom(), aRect->bottom() ) ); - border->setTop( QMAX( border->top(), aRect->top() ) ); + border->setLeft( qMin( border->left(), aRect->left() ) ); + border->setRight( qMax( border->right(), aRect->right() ) ); + border->setBottom( qMin( border->bottom(), aRect->bottom() ) ); + border->setTop( qMax( border->top(), aRect->top() ) ); } } } @@ -206,7 +208,7 @@ void GLViewer_Viewer2d::updateAll() if ( !getActiveView() ) return; - QPtrVector views = getViewManager()->getViews(); + QVector views = getViewManager()->getViews(); for ( int i = 0, n = views.count(); i < n; i++ ) ( ( GLViewer_ViewPort2d* )( ( GLViewer_ViewFrame* )views[i] )->getViewPort() )->getGLWidget()->updateGL(); } @@ -226,18 +228,18 @@ void GLViewer_Viewer2d::updateDrawers( GLboolean update, GLfloat scX, GLfloat sc /*! Activates drawers for objects from list \param theObjects only */ -void GLViewer_Viewer2d::activateDrawers( QValueList& theObjects, bool onlyUpdate, GLboolean swap ) +void GLViewer_Viewer2d::activateDrawers( QList& theObjects, bool onlyUpdate, GLboolean swap ) { //cout << "GLViewer_Viewer2d::activateDrawers " << (int)onlyUpdate << " " << (int)swap << endl; - QValueList::Iterator anIt = myDrawers.begin(); - QValueList::Iterator endDIt = myDrawers.end(); + QList::Iterator anIt = myDrawers.begin(); + QList::Iterator endDIt = myDrawers.end(); for( ; anIt != endDIt; anIt++ ) (*anIt)->clear(); - QValueList anActiveDrawers; - QValueList::Iterator endOIt = theObjects.end(); + QList anActiveDrawers; + QList::Iterator endOIt = theObjects.end(); - for( QValueList::Iterator oit = theObjects.begin(); oit != endOIt; ++oit ) + for( QList::Iterator oit = theObjects.begin(); oit != endOIt; ++oit ) { GLViewer_Drawer* aDrawer = (*oit)->getDrawer(); if( !aDrawer ) @@ -265,11 +267,11 @@ void GLViewer_Viewer2d::activateDrawers( QValueList& theObject int aPriority = aDrawer->getPriority(); - if( anActiveDrawers.findIndex( aDrawer ) != -1 ) + if( anActiveDrawers.indexOf( aDrawer ) != -1 ) continue; - QValueList::Iterator aDIt = anActiveDrawers.begin(); - QValueList::Iterator aDEndIt = anActiveDrawers.end(); + QList::Iterator aDIt = anActiveDrawers.begin(); + QList::Iterator aDEndIt = anActiveDrawers.end(); for( ; aDIt != aDEndIt; ++aDIt ) if( (*aDIt)->getPriority() > aPriority ) break; @@ -277,10 +279,10 @@ void GLViewer_Viewer2d::activateDrawers( QValueList& theObject anActiveDrawers.insert( aDIt, aDrawer ); } - QValueList::Iterator aDIt = anActiveDrawers.begin(); - QValueList::Iterator aDEndIt = anActiveDrawers.end(); + QList::Iterator aDIt = anActiveDrawers.begin(); + QList::Iterator aDEndIt = anActiveDrawers.end(); - QPtrVector views = getViewManager()->getViews(); + QVector views = getViewManager()->getViews(); for ( int i = 0, n = views.count(); i < n; i++ ) { float xScale, yScale; @@ -523,7 +525,7 @@ QRect* GLViewer_Viewer2d::getWinObjectRect( GLViewer_Object* theObject ) GLfloat anAngle = curvp->getGLWidget()->getRotationAngle() * PI / 180.; - QPointArray aPointArray(4); + QPolygon aPointArray(4); aPointArray[0] = QPoint( (int)(aLeft*cos(anAngle) - aTop*sin(anAngle)), (int)(aLeft*sin(anAngle) + aTop*cos(anAngle)) ); aPointArray[1] = QPoint( (int)(aRight*cos(anAngle) - aTop*sin(anAngle)), @@ -539,10 +541,10 @@ QRect* GLViewer_Viewer2d::getWinObjectRect( GLViewer_Object* theObject ) { int x = aPointArray[i].x(); int y = aPointArray[i].y(); - aMinLeft = QMIN( aMinLeft,x ); - aMaxRight = QMAX( aMaxRight, x ); - aMinTop = QMIN( aMinTop, y ); - aMaxBottom = QMAX( aMaxBottom, y ); + aMinLeft = qMin( aMinLeft,x ); + aMaxRight = qMax( aMaxRight, x ); + aMinTop = qMin( aMinTop, y ); + aMaxBottom = qMax( aMaxBottom, y ); } aLeft = (aMinLeft/* + xPan*/)*xScale + aWidth / 2; @@ -640,7 +642,7 @@ bool GLViewer_Viewer2d::testRotation( QMouseEvent* e ) { if ( ( e->button() == GLViewer_View2dTransformer::rotateButton() ) && ( e->type() == QEvent::MouseButtonPress ) && - ( e->state() & GLViewer_ViewTransformer::accelKey() ) ) + ( e->modifiers() & GLViewer_ViewTransformer::accelKey() ) ) { activateTransform( GLViewer_Viewer::Rotate ); return true; @@ -667,7 +669,7 @@ void GLViewer_Viewer2d::insertHeader( VectorFileType aType, QFile& hFile ) header += "%%Pages: 1\n"; header += "%%Page: 1\n\n"; - hFile.writeBlock( header.ascii(), header.length() ); + hFile.write( header.toAscii() ); } else if( aType == HPGL ) { @@ -681,7 +683,7 @@ void GLViewer_Viewer2d::insertHeader( VectorFileType aType, QFile& hFile ) header += "LT;\n"; header += "VS36;\n"; - hFile.writeBlock( header.ascii(), header.length() ); + hFile.write( header.toAscii() ); } } @@ -695,12 +697,12 @@ void GLViewer_Viewer2d::insertEnding( VectorFileType aType, QFile& hFile ) if( aType == POST_SCRIPT ) { QString ending = "showpage\n\n%%EOF"; - hFile.writeBlock( ending.ascii(), ending.length() ); + hFile.write( ending.toAscii() ); } else if( aType == HPGL ) { QString ending = "PU;PA0,0;SP;EC;PG1;EC1;OE\n"; - hFile.writeBlock( ending.ascii(), ending.length() ); + hFile.write( ending.toAscii() ); } } @@ -730,7 +732,7 @@ bool GLViewer_Viewer2d::translateTo( VectorFileType aType, QString FileName, Pap if ( !getActiveView() ) return false; - QFile hFile( FileName.ascii() ); + QFile hFile( FileName.toAscii() ); #ifdef WIN32 HDC hMetaFileDC; @@ -779,8 +781,8 @@ bool GLViewer_Viewer2d::translateTo( VectorFileType aType, QString FileName, Pap if( aType==POST_SCRIPT || aType==HPGL ) { - hFile.open( IO_ReadWrite | IO_Truncate ); - hFile.at( 0 ); + hFile.open( QIODevice::ReadWrite | QIODevice::Truncate ); + hFile.seek( 0 ); insertHeader( aType, hFile ); } #ifdef WIN32 @@ -818,7 +820,7 @@ bool GLViewer_Viewer2d::translateTo( VectorFileType aType, QString FileName, Pap arg( AW-mmLeft-mmRight ).arg( AH-mmBottom-mmTop ); //It is set clipping path - hFile.writeBlock( aBuffer.ascii(), aBuffer.length() ); + hFile.write( aBuffer.toAscii() ); aCurVP->getGLWidget()->translateBackgroundToPS( hFile, &aViewerCS, &aPaperCS ); } @@ -874,15 +876,15 @@ void GLViewer_Viewer2d::repaintView( GLViewer_ViewFrame* theView, bool makeCurre float xScale; float yScale; - QValueList::Iterator anIt = myDrawers.begin(); - QValueList::Iterator endDIt = myDrawers.end(); + QList::Iterator anIt = myDrawers.begin(); + QList::Iterator endDIt = myDrawers.end(); for( ; anIt != endDIt; anIt++ ) (*anIt)->clear(); - QValueList anActiveDrawers; - QValueList::Iterator endOIt = anActiveObjs.end(); + QList anActiveDrawers; + QList::Iterator endOIt = anActiveObjs.end(); - for( QValueList::Iterator oit = anActiveObjs.begin(); oit != endOIt; ++oit ) + for( QList::Iterator oit = anActiveObjs.begin(); oit != endOIt; ++oit ) { GLViewer_Drawer* aDrawer = (*oit)->getDrawer(); if( !aDrawer ) @@ -904,12 +906,12 @@ void GLViewer_Viewer2d::repaintView( GLViewer_ViewFrame* theView, bool makeCurre } } aDrawer->addObject( (*oit) ); - if( anActiveDrawers.findIndex( aDrawer ) == -1 ) + if( anActiveDrawers.indexOf( aDrawer ) == -1 ) anActiveDrawers.append( aDrawer ); } - QValueList::Iterator aDIt = anActiveDrawers.begin(); - QValueList::Iterator aDEndIt = anActiveDrawers.end(); + QList::Iterator aDIt = anActiveDrawers.begin(); + QList::Iterator aDEndIt = anActiveDrawers.end(); GLViewer_ViewPort2d* vp = ( GLViewer_ViewPort2d* )aCurView->getViewPort(); vp->getScale( xScale, yScale ); @@ -991,7 +993,7 @@ void GLViewer_Viewer2d::finishOperations( QMouseEvent* e ) vp->finishSelectByRect(); if ( getSelector() && !aSelRect.isNull() ) { - bool append = bool ( e->state() & GLViewer_Selector::appendKey() ); + bool append = bool ( e->modifiers() & GLViewer_Selector::appendKey() ); getSelector()->select( aSelRect, append ); } } @@ -1017,7 +1019,7 @@ void GLViewer_Viewer2d::startOperations( QWheelEvent* e ) } -int GLViewer_View2dTransformer::rotateBtn = RightButton; +int GLViewer_View2dTransformer::rotateBtn = Qt::RightButton; /*! Constructor diff --git a/src/GLViewer/GLViewer_Viewer2d.h b/src/GLViewer/GLViewer_Viewer2d.h index 141a6071a..b31a4430a 100644 --- a/src/GLViewer/GLViewer_Viewer2d.h +++ b/src/GLViewer/GLViewer_Viewer2d.h @@ -29,21 +29,20 @@ #include #endif -#include -#include +class QRect; +class QFile; #include "GLViewer_Viewer.h" -#include "GLViewer_Object.h" -#include "GLViewer_ViewFrame.h" -#include "GLViewer_Drawer.h" #include #include class GLViewer_Object; +class GLViewer_ViewFrame; +class GLViewer_Drawer; class GLViewer_Context; -class GLViewer_Selector2d; +class GLViewer_Rect; //class GLViewer_Sketcher; class SUIT_Desktop; @@ -115,12 +114,12 @@ public: virtual SUIT_ViewWindow* createView( SUIT_Desktop* ); //! Adds item for change background color - void addPopupItems( QPopupMenu* ); + void addPopupItems( QMenu* ); //void activateGLSketching( int ); //! Returns all drawers - const QValueList& getDrawers() const { return myDrawers; } + const QList& getDrawers() const { return myDrawers; } //! Returns context GLViewer_Context* getGLContext() const { return myGLContext; } @@ -138,7 +137,7 @@ public: /* \param onlyUpdate is passed to method activateAllDrawersdrawers*/ void updateDrawers( GLboolean onlyUpdate, GLfloat scX = 0.0, GLfloat scY = 0.0 ); //! Activates drawers for objects from list \param theObjects only - void activateDrawers( QValueList& theObjects, bool onlyUpdate, GLboolean swap = GL_FALSE ); + void activateDrawers( QList& theObjects, bool onlyUpdate, GLboolean swap = GL_FALSE ); //! Activates drawer for \param theObject void activateDrawer( GLViewer_Object* theObject, bool onlyUpdate, GLboolean swap = GL_FALSE ); //! Updates all drawers with new scale factor @@ -224,7 +223,7 @@ protected: //! Current context GLViewer_Context* myGLContext; //! Map of active drawers - QValueList myDrawers; + QList myDrawers; //GLViewer_Sketcher* myGLSketcher; }; diff --git a/src/GLViewer/GLViewer_Widget.cxx b/src/GLViewer/GLViewer_Widget.cxx index 1fc069d20..5ad81e29c 100644 --- a/src/GLViewer/GLViewer_Widget.cxx +++ b/src/GLViewer/GLViewer_Widget.cxx @@ -25,24 +25,27 @@ #include "GLViewer_Widget.h" #include "GLViewer_ViewPort2d.h" #include "GLViewer_Viewer2d.h" -#include "GLViewer_Compass.h" +//#include "GLViewer_Compass.h" #include "GLViewer_Grid.h" -#include "GLViewer_Object.h" +//#include "GLViewer_Object.h" #include "GLViewer_CoordSystem.h" +#include "GLViewer_ViewFrame.h" #include using namespace std; -#include -#include +#include +#include +#include -#include -#include -#include -#include -#include -#include -#include +#include +//#include +#include +#include +//#include +//#include +//#include +#include /*! A constructor @@ -248,7 +251,8 @@ void GLViewer_Widget::setBackground( QString filename ) void GLViewer_Widget::addToolTip( QString theString, QRect theRect ) { myToolTipRect = theRect; - QToolTip::add( this, myToolTipRect, theString ); + setToolTip(theString); + //QToolTip::add( this, myToolTipRect, theString ); } /*! @@ -256,7 +260,8 @@ void GLViewer_Widget::addToolTip( QString theString, QRect theRect ) */ void GLViewer_Widget::removeToolTip() { - QToolTip::remove( this, myToolTipRect ); + setToolTip(""); + //QToolTip::remove( this, myToolTipRect ); } /*! @@ -419,6 +424,18 @@ void GLViewer_Widget::leaveEvent( QEvent* e ) updateGL(); } +/*! + Custom leave event handler +*/ +bool GLViewer_Widget::event ( QEvent* e ) +{ + if (e->type() == QEvent::ToolTip) { + QHelpEvent *helpEvent = static_cast(e); + if ( myToolTipRect.contains(helpEvent->pos()) ) + QToolTip::showText(helpEvent->globalPos(), toolTip()); + } + return QGLWidget::event(e); +} /*! \return the hex code of digit < 16 @@ -488,7 +505,7 @@ void AddImagePart( QFile& hFile, QImage& image, int w1, int w2, int h1, int h2, aBuffer += "> false 3 colorimage\n\n"; - hFile.writeBlock( aBuffer.ascii(), aBuffer.length() ); + hFile.write( aBuffer.toAscii() ); } } @@ -548,7 +565,7 @@ void GLViewer_Widget::translateBackgroundToPS( QFile& hFile, GLViewer_CoordSyste const int max = 133000; //The maximum length of string in PS int dh = int( floor( double( max ) / ( 3.0*2.0*width ) ) ); for( int k=buf.height()-1; k>=0; k-=dh ) - AddImagePart( hFile, buf, 0, buf.width()-1, QMAX( k-dh+1, 0 ), k, + AddImagePart( hFile, buf, 0, buf.width()-1, qMax( k-dh+1, 0 ), k, aViewerCS, aPSCS, a, b, c, d, dx, dy-(buf.height()-1-k) ); } } diff --git a/src/GLViewer/GLViewer_Widget.h b/src/GLViewer/GLViewer_Widget.h index 637beb5fb..c1edf7efe 100644 --- a/src/GLViewer/GLViewer_Widget.h +++ b/src/GLViewer/GLViewer_Widget.h @@ -27,8 +27,9 @@ #include "GLViewer.h" -#include -#include +#include + +class QFile; class GLViewer_ViewPort2d; class GLViewer_CoordSystem; @@ -153,6 +154,8 @@ protected: virtual void enterEvent( QEvent* ); /* Needs to redefine because Window must be updated highlight presentation when mouse leave window */ virtual void leaveEvent( QEvent* ); + + virtual bool event ( QEvent* ); private: //! width of window diff --git a/src/GLViewer/Makefile.am b/src/GLViewer/Makefile.am index e20fde4eb..ad2589024 100644 --- a/src/GLViewer/Makefile.am +++ b/src/GLViewer/Makefile.am @@ -38,7 +38,7 @@ salomeinclude_HEADERS= \ GLViewer_Geom.h \ GLViewer_Grid.h \ GLViewer_Group.h \ - GLViewer_MimeSource.h \ + GLViewer_MimeData.h \ GLViewer_Object.h \ GLViewer_Selector.h \ GLViewer_Selector2d.h \ @@ -64,7 +64,7 @@ dist_libGLViewer_la_SOURCES= \ GLViewer_Geom.cxx \ GLViewer_Grid.cxx \ GLViewer_Group.cxx \ - GLViewer_MimeSource.cxx \ + GLViewer_MimeData.cxx \ GLViewer_Object.cxx \ GLViewer_Selector.cxx \ GLViewer_Selector2d.cxx \ diff --git a/src/Makefile.am b/src/Makefile.am index 6ac4cc202..deb432835 100755 --- a/src/Makefile.am +++ b/src/Makefile.am @@ -37,7 +37,7 @@ if ENABLE_GLVIEWER # VSR: this is the original packages list # SUBDIRS += GLViewer # VSR: already migrated to Qt4 packages - SUBDIRS += + SUBDIRS += GLViewer endif if ENABLE_VTKVIEWER diff --git a/src/OCCViewer/OCCViewer_ViewWindow.cxx b/src/OCCViewer/OCCViewer_ViewWindow.cxx index 631dc6e92..69485ba30 100755 --- a/src/OCCViewer/OCCViewer_ViewWindow.cxx +++ b/src/OCCViewer/OCCViewer_ViewWindow.cxx @@ -802,8 +802,12 @@ void OCCViewer_ViewWindow::resetState() */ void OCCViewer_ViewWindow::drawRect() { - if ( !myRectBand ) + if ( !myRectBand ) { myRectBand = new QRubberBand( QRubberBand::Rectangle, myViewPort ); + QPalette palette; + palette.setColor(myRectBand->foregroundRole(), Qt::white); + myRectBand->setPalette(palette); + } myRectBand->hide(); QRect aRect = SUIT_Tools::makeRect(myStartX, myStartY, myCurrX, myCurrY); diff --git a/src/SVTK/SVTK_InteractorStyle.cxx b/src/SVTK/SVTK_InteractorStyle.cxx index 38f2de0fa..f9fffd606 100644 --- a/src/SVTK/SVTK_InteractorStyle.cxx +++ b/src/SVTK/SVTK_InteractorStyle.cxx @@ -1494,8 +1494,12 @@ void SVTK_InteractorStyle ::drawRect() { - if ( !myRectBand ) + if ( !myRectBand ) { myRectBand = new QRubberBand( QRubberBand::Rectangle, GetRenderWidget() ); + QPalette palette; + palette.setColor(myRectBand->foregroundRole(), Qt::white); + myRectBand->setPalette(palette); + } myRectBand->hide(); QRect aRect(myPoint, myOtherPoint); diff --git a/src/VTKViewer/VTKViewer_InteractorStyle.cxx b/src/VTKViewer/VTKViewer_InteractorStyle.cxx index 8e7e64b3b..f5c387693 100644 --- a/src/VTKViewer/VTKViewer_InteractorStyle.cxx +++ b/src/VTKViewer/VTKViewer_InteractorStyle.cxx @@ -781,8 +781,12 @@ void VTKViewer_InteractorStyle::setCursor(const int operation) */ void VTKViewer_InteractorStyle::drawRect() { - if ( !myRectBand ) + if ( !myRectBand ) { myRectBand = new QRubberBand( QRubberBand::Rectangle, myGUIWindow ); + QPalette palette; + palette.setColor(myRectBand->foregroundRole(), Qt::white); + myRectBand->setPalette(palette); + } myRectBand->hide(); QRect aRect(myPoint, myOtherPoint); diff --git a/src/src.pro b/src/src.pro index 6167bb22d..8036e1463 100644 --- a/src/src.pro +++ b/src/src.pro @@ -14,6 +14,7 @@ SUBDIRS += PyInterp SUBDIRS += PyConsole SUBDIRS += Prs SUBDIRS += OBJECT +SUBDIRS += GLViewer SUBDIRS += VTKViewer SUBDIRS += SVTK SUBDIRS += OCCViewer -- 2.39.2