]> SALOME platform Git repositories - modules/gui.git/commitdiff
Salome HOME
Porting to Qt4.
authormkr <mkr@opencascade.com>
Tue, 29 May 2007 08:33:19 +0000 (08:33 +0000)
committermkr <mkr@opencascade.com>
Tue, 29 May 2007 08:33:19 +0000 (08:33 +0000)
21 files changed:
src/Makefile.am
src/OCCViewer/OCCViewer.pro [new file with mode: 0644]
src/OCCViewer/OCCViewer_AISSelector.h
src/OCCViewer/OCCViewer_ClippingDlg.cxx
src/OCCViewer/OCCViewer_ClippingDlg.h
src/OCCViewer/OCCViewer_CreateRestoreViewDlg.cxx
src/OCCViewer/OCCViewer_CreateRestoreViewDlg.h
src/OCCViewer/OCCViewer_SetRotationPointDlg.cxx
src/OCCViewer/OCCViewer_SetRotationPointDlg.h
src/OCCViewer/OCCViewer_ViewManager.cxx
src/OCCViewer/OCCViewer_ViewManager.h
src/OCCViewer/OCCViewer_ViewModel.cxx
src/OCCViewer/OCCViewer_ViewModel.h
src/OCCViewer/OCCViewer_ViewPort.cxx
src/OCCViewer/OCCViewer_ViewPort.h
src/OCCViewer/OCCViewer_ViewPort3d.cxx
src/OCCViewer/OCCViewer_ViewPort3d.h
src/OCCViewer/OCCViewer_ViewWindow.cxx
src/OCCViewer/OCCViewer_ViewWindow.h
src/Qtx/QtxListBox.h
src/src.pro

index cba9f1f8d3216d1ac2a435694c75e3beffc12674..687fde263a2970c4d86256fd03fd872558b627dd 100755 (executable)
@@ -56,7 +56,7 @@ if ENABLE_OCCVIEWER
 # VSR: this is the original packages list
 #  SUBDIRS += OCCViewer
 # VSR: already migrated to Qt4 packages
-  SUBDIRS += 
+  SUBDIRS += OCCViewer
 if ENABLE_SALOMEOBJECT
 # VSR: this is the original packages list
 #    SUBDIRS += SOCC
diff --git a/src/OCCViewer/OCCViewer.pro b/src/OCCViewer/OCCViewer.pro
new file mode 100644 (file)
index 0000000..319c23b
--- /dev/null
@@ -0,0 +1,61 @@
+TEMPLATE = lib
+TARGET = OCCViewer
+DESTDIR = ../../lib
+MOC_DIR = ../../moc
+OBJECTS_DIR = ../../obj/$$TARGET
+
+OGL_INCLUDES = 
+
+OGL_LIBS = -lGL -L/usr/X11R6/lib -lGLU
+
+CASROOT = $$(CASROOT)
+CAS_CPPFLAGS = $${CASROOT}/inc
+
+CAS_KERNEL = -L$${CASROOT}/Linux/lib -lTKernel
+
+CAS_VIEWER = -L$${CASROOT}/Linux/lib -lTKV3d -lTKService
+
+INCLUDEPATH += ../../include $${OGL_INCLUDES} $${CAS_CPPFLAGS} ../Qtx ../SUIT
+LIBS += -L../../lib -lsuit $${OGL_LIBS} $${CAS_KERNEL} $${CAS_VIEWER}
+
+CONFIG -= debug release debug_and_release
+CONFIG += qt thread debug dll shared
+
+win32:DEFINES += WIN32 
+DEFINES += OCCVIEWER_EXPORTS OCC_VERSION_MAJOR=6 OCC_VERSION_MINOR=1 OCC_VERSION_MAINTENANCE=1 LIN LINTEL CSFDB No_exception HAVE_CONFIG_H HAVE_LIMITS_H HAVE_WOK_CONFIG_H OCC_CONVERT_SIGNALS
+
+HEADERS  = OCCViewer_AISSelector.h
+HEADERS += OCCViewer_ViewManager.h
+HEADERS += OCCViewer_ViewModel.h
+HEADERS += OCCViewer_ViewPort3d.h
+HEADERS += OCCViewer_ViewPort.h
+HEADERS += OCCViewer_ViewWindow.h
+HEADERS += OCCViewer_VService.h
+HEADERS += OCCViewer_CreateRestoreViewDlg.h
+HEADERS += OCCViewer.h
+HEADERS += OCCViewer_ClippingDlg.h
+HEADERS += OCCViewer_SetRotationPointDlg.h
+
+SOURCES  = OCCViewer_AISSelector.cxx
+SOURCES += OCCViewer_ViewManager.cxx
+SOURCES += OCCViewer_ViewModel.cxx
+SOURCES += OCCViewer_ViewPort3d.cxx
+SOURCES += OCCViewer_ViewPort.cxx
+SOURCES += OCCViewer_ViewWindow.cxx
+SOURCES += OCCViewer_VService.cxx
+SOURCES += OCCViewer_CreateRestoreViewDlg.cxx
+SOURCES += OCCViewer_SetRotationPointDlg.cxx
+SOURCES += OCCViewer_ClippingDlg.cxx
+
+TRANSLATIONS = resources/OCCViewer_images.ts \
+               resources/OCCViewer_msg_en.ts
+
+ICONS   = resources/*.png
+
+includes.files = $$HEADERS
+includes.path = ../../include
+
+resources.files = $$ICONS resources/*.qm
+resources.path = ../../resources
+
+INSTALLS += includes resources
index 740c8f01322207e21159533d8d1e4eb911e33c70..66267f938b7705dd56b01c6285d232fe4834b65a 100755 (executable)
@@ -20,7 +20,7 @@
 #define OCCVIEWER_AISSELECTOR_H
 
 #include "OCCViewer.h"
-#include <qobject.h>
+#include <QObject>
 
 #include <Quantity_NameOfColor.hxx>
 #include <AIS_InteractiveContext.hxx>
index 106e28b8f936830b36ecdabc02cf7ed7b8e78423..ed96b68df9f46561a5433fe1d39ca58d5e1695d6 100644 (file)
 
 #include "SUIT_Session.h"
 #include "SUIT_ViewWindow.h"
+#include "SUIT_ViewManager.h"
 #include "OCCViewer_ViewWindow.h"
 #include "OCCViewer_ViewPort3d.h"
 
 #include <V3d_View.hxx>
-//#include <V3d.hxx>
 #include <Geom_Plane.hxx>
 #include <Prs3d_Presentation.hxx>
 #include <AIS_ListIteratorOfListOfInteractive.hxx>
 #include <gp_Pln.hxx>
 
 // QT Includes
-#include <qapplication.h>
-#include <qgroupbox.h>
-#include <qlayout.h>
-#include <qlabel.h>
-#include <qpushbutton.h>
-#include <qcombobox.h>
-#include <qcheckbox.h>
+#include <QApplication>
+#include <QGroupBox>
+#include <QHBoxLayout>
+#include <QVBoxLayout>
+#include <QGridLayout>
+#include <QLabel>
+#include <QPushButton>
+#include <QComboBox>
+#include <QCheckBox>
 
 /*!
   Constructor
   \param modal - is this dialog modal
   \param fl - flags
 */
-OCCViewer_ClippingDlg::OCCViewer_ClippingDlg( OCCViewer_ViewWindow* view, QWidget* parent, const char* name, bool modal, WFlags fl )
-: QDialog( parent, "OCCViewer_ClippingDlg", modal, WStyle_Customize | WStyle_NormalBorder | WStyle_Title | WStyle_SysMenu ),
+OCCViewer_ClippingDlg::OCCViewer_ClippingDlg( OCCViewer_ViewWindow* view, QWidget* parent, const char* name, bool modal, Qt::WindowFlags fl )
+: QDialog( parent, Qt::WindowTitleHint | Qt::WindowSystemMenuHint ),
   myView( view )
 {
-  setCaption( tr( "Clipping" ) );
+  setObjectName( "OCCViewer_ClippingDlg" );
+  setModal( modal );
+
+  setWindowTitle( tr( "Clipping" ) );
   
   QVBoxLayout* topLayout = new QVBoxLayout( this );
   topLayout->setMargin( 11 ); topLayout->setSpacing( 6 );
   
   /***************************************************************/
-  GroupPoint = new QGroupBox( this, "GroupPoint" );
+  GroupPoint = new QGroupBox( this );
+  GroupPoint->setObjectName( "GroupPoint" );
   GroupPoint->setTitle( tr("Base point") );
-  GroupPoint->setColumnLayout(0, Qt::Vertical );
-  GroupPoint->layout()->setSpacing( 0 );
-  GroupPoint->layout()->setMargin( 0 );
-  QGridLayout* GroupPointLayout = new QGridLayout( GroupPoint->layout() );
+  QGridLayout* GroupPointLayout = new QGridLayout( GroupPoint );
   GroupPointLayout->setAlignment( Qt::AlignTop );
   GroupPointLayout->setSpacing( 6 );
   GroupPointLayout->setMargin( 11 );
@@ -82,7 +85,8 @@ OCCViewer_ClippingDlg::OCCViewer_ClippingDlg( OCCViewer_ViewWindow* view, QWidge
   const int precision = -6; // PAL12789. Minus is for using 'g' double->string conversion specifier,
   //                          see QtxDblSpinBox::mapValueToText( double v )
 
-  TextLabelX = new QLabel( GroupPoint, "TextLabelX" );
+  TextLabelX = new QLabel( GroupPoint );
+  TextLabelX->setObjectName( "TextLabelX" );
   TextLabelX->setText( tr("X:") );
   GroupPointLayout->addWidget( TextLabelX, 0, 0 );
   
@@ -90,7 +94,8 @@ OCCViewer_ClippingDlg::OCCViewer_ClippingDlg( OCCViewer_ViewWindow* view, QWidge
   SpinBox_X->setPrecision( precision );
   GroupPointLayout->addWidget( SpinBox_X, 0, 1 );
 
-  TextLabelY = new QLabel( GroupPoint, "TextLabelY" );
+  TextLabelY = new QLabel( GroupPoint );
+  TextLabelY->setObjectName( "TextLabelY" );
   TextLabelY->setText( tr("Y:") );
   GroupPointLayout->addWidget( TextLabelY, 0, 2 );
 
@@ -98,7 +103,8 @@ OCCViewer_ClippingDlg::OCCViewer_ClippingDlg( OCCViewer_ViewWindow* view, QWidge
   SpinBox_Y->setPrecision( precision );
   GroupPointLayout->addWidget( SpinBox_Y, 0, 3 );
 
-  TextLabelZ = new QLabel( GroupPoint, "TextLabelZ" );
+  TextLabelZ = new QLabel( GroupPoint );
+  TextLabelZ->setObjectName( "TextLabelZ" );
   TextLabelZ->setText( tr("Z:") );
   GroupPointLayout->addWidget( TextLabelZ, 0, 4 );
 
@@ -106,23 +112,25 @@ OCCViewer_ClippingDlg::OCCViewer_ClippingDlg( OCCViewer_ViewWindow* view, QWidge
   SpinBox_Z->setPrecision( precision );
   GroupPointLayout->addWidget( SpinBox_Z, 0, 5 );
 
-  resetButton  = new QPushButton( GroupPoint, "resetButton" );
+  resetButton  = new QPushButton( GroupPoint );
+  resetButton->setObjectName( "resetButton" );
   resetButton->setText( tr( "Reset"  ) );
   GroupPointLayout->addWidget( resetButton, 0, 6 );
 
+  GroupPoint->setLayout(GroupPointLayout);
+
   /***************************************************************/
-  GroupDirection = new QGroupBox( this, "GroupDirection" );
+  GroupDirection = new QGroupBox( this );
+  GroupDirection->setObjectName( "GroupDirection" );
   GroupDirection->setTitle( tr("Direction") );
-  GroupDirection->setColumnLayout(0, Qt::Vertical );
-  GroupDirection->layout()->setSpacing( 0 );
-  GroupDirection->layout()->setMargin( 0 );
-  QGridLayout* GroupDirectionLayout = new QGridLayout( GroupDirection->layout() );
+  QGridLayout* GroupDirectionLayout = new QGridLayout( GroupDirection );
   GroupDirectionLayout->setAlignment( Qt::AlignTop );
   GroupDirectionLayout->setSpacing( 6 );
   GroupDirectionLayout->setMargin( 11 );
   
   // Controls
-  TextLabelDx = new QLabel( GroupDirection, "TextLabelDx" );
+  TextLabelDx = new QLabel( GroupDirection );
+  TextLabelDx->setObjectName( "TextLabelDx" );
   TextLabelDx->setText( tr("Dx:") );
   GroupDirectionLayout->addWidget( TextLabelDx, 0, 0 );
   
@@ -130,7 +138,8 @@ OCCViewer_ClippingDlg::OCCViewer_ClippingDlg( OCCViewer_ViewWindow* view, QWidge
   SpinBox_Dx->setPrecision( precision );
   GroupDirectionLayout->addWidget( SpinBox_Dx, 0, 1 );
 
-  TextLabelDy = new QLabel( GroupDirection, "TextLabelDy" );
+  TextLabelDy = new QLabel( GroupDirection );
+  TextLabelDy->setObjectName( "TextLabelDy" );
   TextLabelDy->setText( tr("Dy:") );
   GroupDirectionLayout->addWidget( TextLabelDy, 0, 2 );
   
@@ -138,7 +147,8 @@ OCCViewer_ClippingDlg::OCCViewer_ClippingDlg( OCCViewer_ViewWindow* view, QWidge
   SpinBox_Dy->setPrecision( precision );
   GroupDirectionLayout->addWidget( SpinBox_Dy, 0, 3 );
 
-  TextLabelDz = new QLabel( GroupDirection, "TextLabelDz" );
+  TextLabelDz = new QLabel( GroupDirection );
+  TextLabelDz->setObjectName( "TextLabelDz" );
   TextLabelDz->setText( tr("Dz:") );
   GroupDirectionLayout->addWidget( TextLabelDz, 0, 4 );
   
@@ -146,31 +156,36 @@ OCCViewer_ClippingDlg::OCCViewer_ClippingDlg( OCCViewer_ViewWindow* view, QWidge
   SpinBox_Dz->setPrecision( precision );
   GroupDirectionLayout->addWidget( SpinBox_Dz, 0, 5 );
 
-  invertButton  = new QPushButton( GroupDirection, "invertButton" );
+  invertButton  = new QPushButton( GroupDirection );
+  invertButton->setObjectName( "invertButton" );
   invertButton->setText( tr( "Invert"  ) );
   GroupDirectionLayout->addWidget( invertButton, 0, 6 );
  
-  DirectionCB = new QComboBox( GroupDirection, "DirectionCB" );
-  DirectionCB->insertItem(tr("CUSTOM"));
-  DirectionCB->insertItem(tr("||X-Y"));
-  DirectionCB->insertItem(tr("||Y-Z"));
-  DirectionCB->insertItem(tr("||Z-X"));
-  GroupDirectionLayout->addMultiCellWidget( DirectionCB, 1, 1, 0, 5 );
+  DirectionCB = new QComboBox( GroupDirection );
+  DirectionCB->setObjectName( "DirectionCB" );
+  DirectionCB->insertItem(DirectionCB->count(),tr("CUSTOM"));
+  DirectionCB->insertItem(DirectionCB->count(),tr("||X-Y"));
+  DirectionCB->insertItem(DirectionCB->count(),tr("||Y-Z"));
+  DirectionCB->insertItem(DirectionCB->count(),tr("||Z-X"));
+  GroupDirectionLayout->addWidget( DirectionCB, 1, 0, 1, 6 );
   
+  GroupDirection->setLayout(GroupDirectionLayout);
+
   /***************************************************************/
   
-  PreviewChB = new QCheckBox( tr("Preview") ,this, "PreviewChB" );
+  PreviewChB = new QCheckBox( tr("Preview") ,this );
+  PreviewChB->setObjectName( "PreviewChB" );
   PreviewChB->setChecked( true );
   
   /***************************************************************/
-  QGroupBox* GroupButtons = new QGroupBox( this, "GroupButtons" );
-  GroupButtons->setColumnLayout(0, Qt::Vertical );
-  GroupButtons->layout()->setMargin( 0 ); GroupButtons->layout()->setSpacing( 0 ); 
-  QHBoxLayout* GroupButtonsLayout = new QHBoxLayout( GroupButtons->layout() );
+  QGroupBox* GroupButtons = new QGroupBox( this );
+  GroupButtons->setObjectName( "GroupButtons" );
+  QHBoxLayout* GroupButtonsLayout = new QHBoxLayout( GroupButtons );
   GroupButtonsLayout->setAlignment( Qt::AlignTop );
   GroupButtonsLayout->setMargin( 11 ); GroupButtonsLayout->setSpacing( 6 );
   
-  buttonApply = new QPushButton( GroupButtons, "buttonApply" );
+  buttonApply = new QPushButton( GroupButtons );
+  buttonApply->setObjectName( "buttonApply" );
   buttonApply->setText( tr( "BUT_APPLY"  ) );
   buttonApply->setAutoDefault( TRUE ); 
   buttonApply->setDefault( TRUE );
@@ -178,10 +193,14 @@ OCCViewer_ClippingDlg::OCCViewer_ClippingDlg( OCCViewer_ViewWindow* view, QWidge
   
   GroupButtonsLayout->addStretch();
   
-  buttonClose = new QPushButton( GroupButtons, "buttonClose" );
+  buttonClose = new QPushButton( GroupButtons );
+  buttonClose->setObjectName( "buttonClose" );
   buttonClose->setText( tr( "BUT_CLOSE"  ) );
   buttonClose->setAutoDefault( TRUE );
   GroupButtonsLayout->addWidget( buttonClose );
+
+  GroupButtons->setLayout(GroupButtonsLayout);
+
   /***************************************************************/
   
   topLayout->addWidget( GroupPoint );
@@ -248,7 +267,7 @@ void OCCViewer_ClippingDlg::closeEvent( QCloseEvent* e )
     aView3d->SetPlaneOn( myClippingPlane );
   
   if (!myView->isCuttingPlane())
-    myAction->setOn( false );
+    myAction->setChecked( false );
   
   QDialog::closeEvent( e );
 }
@@ -289,7 +308,7 @@ void OCCViewer_ClippingDlg::ClickOnClose()
     aView3d->SetPlaneOn( myClippingPlane );
 
   if (!myView->isCuttingPlane())
-    myAction->setOn( false );
+    myAction->setChecked( false );
   
   reject();
 }
@@ -451,9 +470,9 @@ void OCCViewer_ClippingDlg::displayPreview()
         isFound = true;
         double xmin, ymin, zmin, xmax, ymax, zmax;
         aPrs->MinMaxValues( xmin, ymin, zmin, xmax, ymax, zmax );
-        aXMin = QMIN( aXMin, xmin );  aXMax = QMAX( aXMax, xmax );
-        aYMin = QMIN( aYMin, ymin );  aYMax = QMAX( aYMax, ymax );
-        aZMin = QMIN( aZMin, zmin );  aZMax = QMAX( aZMax, zmax );
+        aXMin = qMin( aXMin, xmin );  aXMax = qMax( aXMax, xmax );
+        aYMin = qMin( aYMin, ymin );  aYMax = qMax( aYMax, ymax );
+        aZMin = qMin( aZMin, zmin );  aZMax = qMax( aZMax, zmax );
       }
     }
   }
@@ -565,7 +584,7 @@ void OCCViewer_ClippingDlg::ReserveClippingPlane()
 
 void OCCViewer_ClippingDlg::onViewShow()
 {
-  if(myAction->isOn())
+  if(myAction->isChecked())
     show();
   else
     hide();
index bed795811b7b16abdb380a6c5bcc2b40b54f8300..00fe9c5be5636706945e922b2be11997c0dfdafc 100644 (file)
@@ -21,7 +21,7 @@
 
 #include "OCCViewer.h"
 
-#include <qdialog.h>
+#include <QDialog>
 
 #include <AIS_Plane.hxx>
 #include <V3d_Plane.hxx>
@@ -46,7 +46,7 @@ class OCCViewer_ClippingDlg : public QDialog
     Q_OBJECT
     
     public:
-    OCCViewer_ClippingDlg(OCCViewer_ViewWindow* , QWidget* parent = 0, const char* name = 0, bool modal = FALSE, WFlags fl = 0);
+    OCCViewer_ClippingDlg(OCCViewer_ViewWindow* , QWidget* parent = 0, const char* name = 0, bool modal = FALSE, Qt::WindowFlags fl = 0);
     ~OCCViewer_ClippingDlg();
 
     void SetAction( QtxAction* theAction ) { myAction = theAction; }
index e97cde8b9a9bbffcf3e3eb82050dfcf37bbcfab1..b7e09b343a4386775536ba13e74ded596513b85a 100755 (executable)
 #include "OCCViewer_ViewModel.h"
 #include "OCCViewer_ViewPort3d.h"
 
-#include <qpushbutton.h>
-#include <qlayout.h>
-#include <qpainter.h>
-#include <qimage.h>
+#include <QPushButton>
+#include <QGridLayout>
+#include <QHBoxLayout>
+#include <QListWidgetItem>
+#include <QEvent>
+#include <QKeyEvent>
 
 /*!
   Constructor
@@ -31,7 +33,7 @@
 OCCViewer_CreateRestoreViewDlg::OCCViewer_CreateRestoreViewDlg( QWidget* aWin, OCCViewer_Viewer* curModel )
 : QDialog( aWin )
 {
-  setCaption( tr( "CAPTION" ) );
+  setWindowTitle( tr( "CAPTION" ) );
 
   myParametersMap = curModel->getViewAspects();
 
@@ -41,7 +43,9 @@ OCCViewer_CreateRestoreViewDlg::OCCViewer_CreateRestoreViewDlg( QWidget* aWin, O
        
   setFixedSize( 400, 300 );
 
-  QGridLayout* aGrid = new QGridLayout( this, 2, 1, 5, 10 ); 
+  QGridLayout* aGrid = new QGridLayout( this );
+  aGrid->setMargin( 5 );
+  aGrid->setSpacing( 10 );
 
   QWidget* aWidget1 = new QWidget( this );
   QWidget* aWidget2 = new QWidget( this );
@@ -60,14 +64,14 @@ OCCViewer_CreateRestoreViewDlg::OCCViewer_CreateRestoreViewDlg( QWidget* aWin, O
   {
     myListBox->clear();
     for( int i = 0; i < aQuantityOfItems; i++ )
-      myListBox->insertItem( myParametersMap[ i ].name );
+      myListBox->insertItem( i, myParametersMap[ i ].name );
     
     changeImage( myListBox->item( 0 ) );
   }
   else
   {
     myListBox->clear();
-    myListBox->insertItem( "No Items", 0 );
+    myListBox->insertItem( 0, "No Items" );
     myListBox->setEditEnabled( 0 );
   }
 
@@ -77,7 +81,9 @@ OCCViewer_CreateRestoreViewDlg::OCCViewer_CreateRestoreViewDlg( QWidget* aWin, O
   aLayout->addWidget( myListBox );
   aLayout->addWidget( myCurViewPort, 30 );
 
-  QHBoxLayout* aButtonLayout = new QHBoxLayout( aWidget2, 0, 5 );
+  QHBoxLayout* aButtonLayout = new QHBoxLayout( aWidget2 );
+  aButtonLayout->setMargin( 0 );
+  aButtonLayout->setSpacing( 5 );
 
   QPushButton* theOk     = new QPushButton( tr( "Ok" ), aWidget2 );            theOk->setAutoDefault( false );
   QPushButton* theCancel = new QPushButton( tr( "Cancel" ), aWidget2 );                 theCancel->setAutoDefault( false );
@@ -109,18 +115,18 @@ OCCViewer_CreateRestoreViewDlg::~OCCViewer_CreateRestoreViewDlg()
   Changes image in accordance with item
   \param curItem - item contains info about view parameters
 */
-void OCCViewer_CreateRestoreViewDlg::changeImage( QListBoxItem* curItem )
+void OCCViewer_CreateRestoreViewDlg::changeImage( QListWidgetItem* curItem )
 {
        if( curItem && myListBox->isEditEnabled() )
        {
                int lowLevel  = -1;
                int highLevel = -1;
-               int index = curItem->listBox()->index( curItem );
+               int index = curItem->listWidget()->row( curItem );
                if( myKeyFlag == 2 )
                {
-                       for( int i = 0; i < (int)myListBox->count(); i++ )
+                       for( int i = 0; i < (int)myListBox->count(); i++ )
                        {
-                               if( myListBox->isSelected( i ) && i != index )
+                               if( myListBox->item( i )->isSelected() && i != index )
                                {
                                        myListBox->clearSelection();
                                        if( i > index )
@@ -134,11 +140,11 @@ void OCCViewer_CreateRestoreViewDlg::changeImage( QListBoxItem* curItem )
                                                highLevel = index;
                                        }
                                        for( int j = lowLevel; j <= highLevel; j++ )
-                                               myListBox->setSelected( j, TRUE );
+                                               myListBox->item( j )->setSelected( TRUE );
                                        break;
                                }
-                               if( myListBox->isSelected( i ) && i == index )
-                                       myListBox->setSelected( i, TRUE );
+                               if( myListBox->item( i )->isSelected() && i == index )
+                                       myListBox->item( i )->setSelected( TRUE );
                        }
                }
 
@@ -173,14 +179,15 @@ void OCCViewer_CreateRestoreViewDlg::deleteSelectedItems()
        {
                int curIndex = -1;
                for( int i = 0; i < (int)myListBox->count(); i++ )
-                       if( myListBox->isSelected( i ) )
+                       if( myListBox->item( i )->isSelected() )
                        {
-                               myListBox->removeItem( i );
+                               QListWidgetItem* anItemToDelete = myListBox->takeItem( i );
+                               delete anItemToDelete;
                                for( int j = i; j < (int)myParametersMap.count(); j++ )
                                        if( j != myParametersMap.count() - 1 )
                                                myParametersMap[ j ] = myParametersMap[ j + 1 ];
                                        else
-                                               myParametersMap.remove( myParametersMap.at(j) );
+                                               myParametersMap.removeAt( j );
                                if( i != myListBox->count() )
                                        curIndex = i;
                                else
@@ -189,14 +196,14 @@ void OCCViewer_CreateRestoreViewDlg::deleteSelectedItems()
                        }
                if( curIndex >= 0 )
                {
-                       myListBox->setCurrentItem( curIndex );
+                       myListBox->setCurrentItem( myListBox->item( curIndex ) );
                        changeImage( myListBox->item( curIndex ) );
                }
        }
        if( !myListBox->count() )
        {
                myListBox->clear();
-               myListBox->insertItem( "No Items", 0 );
+               myListBox->insertItem( 0, "No Items" );
                myListBox->setEditEnabled( 0 );
        }
 }
@@ -207,7 +214,7 @@ void OCCViewer_CreateRestoreViewDlg::deleteSelectedItems()
 void OCCViewer_CreateRestoreViewDlg::clearList()
 {
        myListBox->clear();
-       myListBox->insertItem( "No Items", 0 );
+       myListBox->insertItem( 0, "No Items" );
        myListBox->setEditEnabled( 0 );
 
        myParametersMap.clear();
@@ -225,10 +232,10 @@ const viewAspectList& OCCViewer_CreateRestoreViewDlg::parameters() const
   Renames key of view aspect map in accordance with item name
   \param anItem - item
 */
-void OCCViewer_CreateRestoreViewDlg::editItemText( QListBoxItem* anItem )
+void OCCViewer_CreateRestoreViewDlg::editItemText( QListWidgetItem* anItem )
 {
-       int index = anItem->listBox()->index( anItem );
-       myParametersMap[ index ].name = anItem->text().latin1();
+       int index = anItem->listWidget()->row( anItem );
+       myParametersMap[ index ].name = anItem->text().toLatin1();
 }
 
 /*!
@@ -242,15 +249,15 @@ bool OCCViewer_CreateRestoreViewDlg::eventFilter( QObject* anObj, QEvent* anEv )
                if( aKeyEv->key() == Qt::Key_Control )
                {
                        myKeyFlag = 1;
-                       myListBox->setSelectionMode( QListBox::Multi ); 
+                       myListBox->setSelectionMode( QAbstractItemView::MultiSelection );       
                }
                else if( aKeyEv->key() == Qt::Key_Shift )
                {
                        myKeyFlag = 2;
-                       myListBox->setSelectionMode( QListBox::Multi ); 
+                       myListBox->setSelectionMode( QAbstractItemView::MultiSelection );       
                }
                else
-                       myListBox->setSelectionMode( QListBox::Single );
+                       myListBox->setSelectionMode( QAbstractItemView::SingleSelection );
        }
        if( anEv->type() == QEvent::KeyRelease )
                myKeyFlag = 0;
@@ -258,7 +265,7 @@ bool OCCViewer_CreateRestoreViewDlg::eventFilter( QObject* anObj, QEvent* anEv )
        if( !myKeyFlag )
        {
                if( anEv->type() == QEvent::KeyPress || anEv->type() == QEvent::MouseButtonPress )
-                       myListBox->setSelectionMode( QListBox::Single );
+                       myListBox->setSelectionMode( QAbstractItemView::SingleSelection );
        }
        return QWidget::eventFilter( anObj, anEv );
 }
index fc1579ae6de261e538db8b0cea5279b1f12b4241..2fabd6649a23ce6ff6c98d3f47737928e75e2e64 100755 (executable)
 #include <QtxListBox.h> 
 #include <SUIT_Application.h>
 
-#include <qmap.h>
-#include <qvbox.h>
-#include <qdialog.h>
-#include <qlistbox.h>
-#include <qstringlist.h>
+#include <QDialog>
 
 class OCCViewer_ViewPort3d;
 
+class QListWidgetItem;
+
 #ifdef WIN32
 #pragma warning( disable:4251 )
 #endif
@@ -48,15 +46,15 @@ public:
        OCCViewer_CreateRestoreViewDlg( QWidget*, OCCViewer_Viewer* );
        virtual ~OCCViewer_CreateRestoreViewDlg();
 
-       const viewAspectList&       parameters() const;
-       viewAspect                  currentItem() const;
-       virtual bool                                                eventFilter( QObject*, QEvent* );
+       const viewAspectList&         parameters() const;
+       viewAspect                    currentItem() const;
+       virtual bool                  eventFilter( QObject*, QEvent* );
 
 public slots:
        void                          OKpressed();
        void                          clearList();
-       void                        editItemText( QListBoxItem* );
-       void                          changeImage( QListBoxItem* );
+       void                          editItemText( QListWidgetItem* );
+       void                          changeImage( QListWidgetItem* );
        void                          deleteSelectedItems();
 
 signals:
@@ -64,10 +62,10 @@ signals:
 
 private:
        int                                                                       myKeyFlag;
-       QtxListBox*                                                   myListBox;
+       QtxListBox*                   myListBox;
        OCCViewer_ViewPort3d*         myCurViewPort;
-       viewAspect                  myCurrentItem;
-       viewAspectList              myParametersMap;
+       viewAspect                    myCurrentItem;
+       viewAspectList                myParametersMap;
 };
 
 #ifdef WIN32
index 0aed2c230fd9a64bd963ae236085d65edb686f6b..c102afdb4fe9e7d3ed851b7c8c1b0e52be352b57 100644 (file)
 
 #include "OCCViewer_ViewWindow.h"
 
-#include <qlineedit.h>
-#include <qgroupbox.h>
-#include <qlabel.h>
-#include <qpushbutton.h>
-#include <qlayout.h>
-#include <qvalidator.h>
-#include <qbuttongroup.h>
-#include <qobjectlist.h>
-#include <qcheckbox.h>
-#include <qhbox.h>
+#include <QLineEdit>
+#include <QGroupBox>
+#include <QLabel>
+#include <QPushButton>
+#include <QGridLayout>
+#include <QDoubleValidator>
+#include <QCheckBox>
+#include <QHBoxLayout>
 
 /*!
   Constructor
   \param modal - is this dialog modal
   \param fl - flags
 */
-OCCViewer_SetRotationPointDlg::OCCViewer_SetRotationPointDlg( OCCViewer_ViewWindow* view, QWidget* parent, const char* name, bool modal, WFlags fl )
-: QDialog( parent, "OCCViewer_SetRotationPointDlg", modal, WStyle_Customize | WStyle_NormalBorder | WStyle_Title | WStyle_SysMenu ),
+OCCViewer_SetRotationPointDlg::OCCViewer_SetRotationPointDlg( OCCViewer_ViewWindow* view, QWidget* parent, const char* name, bool modal, Qt::WindowFlags fl )
+: QDialog( parent, Qt::WindowTitleHint | Qt::WindowSystemMenuHint ),
   myView( view )
 {
-  setCaption(tr("CAPTION"));
+  setObjectName( "OCCViewer_SetRotationPointDlg" );
+  setModal( modal );
+
+  setWindowTitle(tr("CAPTION"));
   setSizeGripEnabled(TRUE);
 
   // Create layout for this dialog
@@ -54,35 +55,42 @@ OCCViewer_SetRotationPointDlg::OCCViewer_SetRotationPointDlg( OCCViewer_ViewWind
   layoutDlg->setMargin(11);
 
   // Create check box "Use Bounding Box Center"
-  QHBox* aCheckBox = new QHBox(this);
+  QHBoxLayout* aCheckBox = new QHBoxLayout(this);
 
-  myIsBBCenter = new QCheckBox(tr("USE_BBCENTER"), aCheckBox);
+  myIsBBCenter = new QCheckBox(tr("USE_BBCENTER"));
   myIsBBCenter->setChecked(true);
+  aCheckBox->addWidget(myIsBBCenter);
   connect(myIsBBCenter, SIGNAL(stateChanged(int)), SLOT(onBBCenterChecked()));
 
   // Create croup button with radio buttons
-  myGroupSelButton = new QButtonGroup(2,Qt::Vertical,"",this);
-  myGroupSelButton->setMargin(11);
+  myGroupBoxSel = new QGroupBox( "", this );
+  QVBoxLayout *vbox = new QVBoxLayout;
+  vbox->setMargin(11);
+  vbox->addStretch(1);
   
   // Create "Set to Origin" button
-  myToOrigin = new QPushButton(myGroupSelButton);
-  myToOrigin->setText(tr("LBL_TOORIGIN"));
+  myToOrigin = new QPushButton(tr("LBL_TOORIGIN"));
+  vbox->addWidget(myToOrigin);
   connect(myToOrigin, SIGNAL(clicked()), this, SLOT(onToOrigin()));
 
   // Create "Select Point from View" button
-  mySelectPoint = new QPushButton(myGroupSelButton);
-  mySelectPoint->setText(tr("LBL_SELECTPOINT"));
-  mySelectPoint->setToggleButton(true);
+  mySelectPoint = new QPushButton(tr("LBL_SELECTPOINT"));
+  mySelectPoint->setCheckable(true);
+  vbox->addWidget(mySelectPoint);
   connect(mySelectPoint, SIGNAL(clicked()), this, SLOT(onSelectPoint()));
 
+  myGroupBoxSel->setLayout(vbox);
+
   // Create croup box with grid layout
-  myGroupBoxCoord = new QGroupBox(this, "GroupBox");
+  myGroupBoxCoord = new QGroupBox(this);
+  myGroupBoxCoord->setObjectName("GroupBox");
   QHBoxLayout* aHBoxLayout = new QHBoxLayout(myGroupBoxCoord);
   aHBoxLayout->setMargin(11);
   aHBoxLayout->setSpacing(6);
 
   // "X" coordinate
-  QLabel* TextLabelX = new QLabel (tr("LBL_X"), myGroupBoxCoord, "TextLabelX");
+  QLabel* TextLabelX = new QLabel (tr("LBL_X"), myGroupBoxCoord );
+  TextLabelX->setObjectName("TextLabelX");
   TextLabelX->setFixedWidth(15);
   myX = new QLineEdit(myGroupBoxCoord);
   myX->setValidator(new QDoubleValidator(myX));
@@ -90,7 +98,8 @@ OCCViewer_SetRotationPointDlg::OCCViewer_SetRotationPointDlg( OCCViewer_ViewWind
   connect(myX, SIGNAL(textChanged(const QString&)), this, SLOT(onCoordChanged()));
 
   // "Y" coordinate
-  QLabel* TextLabelY = new QLabel (tr("LBL_Y"), myGroupBoxCoord, "TextLabelY");
+  QLabel* TextLabelY = new QLabel (tr("LBL_Y"), myGroupBoxCoord );
+  TextLabelY->setObjectName("TextLabelY");
   TextLabelY->setFixedWidth(15);
   myY = new QLineEdit(myGroupBoxCoord);
   myY->setValidator(new QDoubleValidator(myY));
@@ -98,7 +107,8 @@ OCCViewer_SetRotationPointDlg::OCCViewer_SetRotationPointDlg( OCCViewer_ViewWind
   connect(myY, SIGNAL(textChanged(const QString&)), this, SLOT(onCoordChanged()));
 
   // "Z" coordinate
-  QLabel* TextLabelZ = new QLabel (tr("LBL_Z"), myGroupBoxCoord, "TextLabelZ");
+  QLabel* TextLabelZ = new QLabel (tr("LBL_Z"), myGroupBoxCoord );
+  TextLabelZ->setObjectName("TextLabelZ");
   TextLabelZ->setFixedWidth(15);
   myZ = new QLineEdit(myGroupBoxCoord);
   myZ->setValidator(new QDoubleValidator(myZ));
@@ -119,7 +129,8 @@ OCCViewer_SetRotationPointDlg::OCCViewer_SetRotationPointDlg( OCCViewer_ViewWind
   aHBoxLayout2->setMargin(11);
   aHBoxLayout2->setSpacing(6);
 
-  QPushButton* m_bClose = new QPushButton(tr("&Close"), aGroupBox, "m_bClose");
+  QPushButton* m_bClose = new QPushButton(tr("&Close"), aGroupBox );
+  m_bClose->setObjectName("m_bClose");
   m_bClose->setAutoDefault(TRUE);
   m_bClose->setFixedSize(m_bClose->sizeHint());
   connect(m_bClose, SIGNAL(clicked()), this, SLOT(onClickClose()));
@@ -128,12 +139,12 @@ OCCViewer_SetRotationPointDlg::OCCViewer_SetRotationPointDlg( OCCViewer_ViewWind
   aHBoxLayout2->addWidget(m_bClose);
 
   // Layout top level widgets
-  layoutDlg->addWidget(aCheckBox,0,0);
-  layoutDlg->addWidget(myGroupSelButton,1,0);
+  layoutDlg->addLayout(aCheckBox,0,0);
+  layoutDlg->addWidget(myGroupBoxSel,1,0);
   layoutDlg->addWidget(myGroupBoxCoord,2,0);
   layoutDlg->addWidget(aGroupBox,3,0);
   
-  setEnabled(myGroupSelButton,!myIsBBCenter->isChecked());
+  setEnabled(myGroupBoxSel,!myIsBBCenter->isChecked());
   setEnabled(myGroupBoxCoord,!myIsBBCenter->isChecked());
 
   this->resize(400, this->sizeHint().height());
@@ -166,10 +177,11 @@ void
 OCCViewer_SetRotationPointDlg
 ::setEnabled(QGroupBox* theGrp, const bool theState)
 {
-  QObjectList aChildren(*theGrp->children());
+  QObjectList aChildren(theGrp->children());
   QObject* anObj;
-  for(anObj = aChildren.first(); anObj !=0; anObj = aChildren.next())
+  for(int i = 0; i < aChildren.size(); i++)
   {
+    anObj = aChildren.at(i);
     if (anObj !=0 && anObj->inherits("QLineEdit"))
       ((QLineEdit*)anObj)->setReadOnly(!theState);
     if (anObj !=0 && anObj->inherits("QPushButton"))
@@ -182,12 +194,12 @@ void
 OCCViewer_SetRotationPointDlg
 ::onBBCenterChecked()
 {
-  setEnabled(myGroupSelButton,!myIsBBCenter->isChecked());
+  setEnabled(myGroupBoxSel,!myIsBBCenter->isChecked());
   setEnabled(myGroupBoxCoord,!myIsBBCenter->isChecked());
   
   if ( myIsBBCenter->isChecked() )
   {
-    if ( mySelectPoint->state() == QButton::On )
+    if ( mySelectPoint->isChecked() )
       mySelectPoint->toggle();
     myView->activateSetRotationGravity();
   }
@@ -201,7 +213,7 @@ void
 OCCViewer_SetRotationPointDlg
 ::onToOrigin()
 {
-  if ( mySelectPoint->state() == QButton::On )
+  if ( mySelectPoint->isChecked() )
     mySelectPoint->toggle();
   setCoords();
   myView->activateSetRotationSelected(myX->text().toDouble(), 
@@ -213,7 +225,7 @@ void
 OCCViewer_SetRotationPointDlg
 ::onSelectPoint()
 {
-  if ( mySelectPoint->state() == QButton::On )
+  if ( mySelectPoint->isChecked() )
     myView->activateStartPointSelection();
   else
     mySelectPoint->toggle();
@@ -225,7 +237,7 @@ OCCViewer_SetRotationPointDlg
 {
   if ( !myIsBBCenter->isChecked() )
   {
-    if ( mySelectPoint->state() == QButton::On
+    if ( mySelectPoint->isChecked()
         &&
         ( myX->hasFocus() || myY->hasFocus() || myZ->hasFocus() ) )
       mySelectPoint->toggle();
@@ -256,7 +268,7 @@ void
 OCCViewer_SetRotationPointDlg
 ::onClickClose()
 {
-  myAction->setOn( false );
+  myAction->setChecked( false );
   reject();
 }
 
@@ -264,7 +276,7 @@ void
 OCCViewer_SetRotationPointDlg
 ::onViewShow()
 {
-  if(myAction->isOn())
+  if(myAction->isChecked())
     show();
   else
     hide();
index 18c1f654e1a386edc254e9458c4a63a8b55952b6..2e3a465f81847def70b3b869996ee31f43c13214 100644 (file)
 
 #include "OCCViewer.h"
 
-#include <qdialog.h>
+#include <QDialog>
 
 class QtxAction;
 
 class QLineEdit;
 class QPushButton;
 class QGroupBox;
-class QButtonGroup;
 class QCheckBox;
 
 class OCCViewer_ViewWindow;
@@ -39,7 +38,7 @@ class OCCVIEWER_EXPORT OCCViewer_SetRotationPointDlg : public QDialog
 
 public:
   OCCViewer_SetRotationPointDlg(OCCViewer_ViewWindow* , QWidget* parent = 0, 
-                               const char* name = 0, bool modal = FALSE, WFlags fl = 0);
+                               const char* name = 0, bool modal = FALSE, Qt::WindowFlags fl = 0);
   ~OCCViewer_SetRotationPointDlg();
 
   void SetAction( QtxAction* theAction ) { myAction = theAction; }
@@ -54,7 +53,7 @@ protected:
 
   QCheckBox*    myIsBBCenter;
 
-  QButtonGroup* myGroupSelButton;
+  QGroupBox   * myGroupBoxSel;
   QPushButton*  myToOrigin;
   QPushButton*  mySelectPoint;
 
index 3d799109ff37646d6494ca4585f7c64cbfeb204d..39c740c5d4c5c61f7fe14810d843cfc669d734ff 100755 (executable)
@@ -40,7 +40,7 @@ OCCViewer_ViewManager::~OCCViewer_ViewManager()
   Fills popup menu with custom actions
  \param popup - popup menu to be filled with
 */
-void OCCViewer_ViewManager::contextMenuPopup( QPopupMenu* popup )
+void OCCViewer_ViewManager::contextMenuPopup( QMenu* popup )
 {
   SUIT_ViewManager::contextMenuPopup( popup );
   // if it is necessary invoke method CreatePopup of ViewPort
index ea88d3577790a60217be9a48ff6883391cd1a2b6..c39e43cf81a186667c94a47ab4d25fc14d29374c 100755 (executable)
@@ -35,7 +35,7 @@ public:
 
   OCCViewer_Viewer* getOCCViewer() { return (OCCViewer_Viewer*) myViewModel; }
 
-  virtual void      contextMenuPopup( QPopupMenu* );
+  virtual void      contextMenuPopup( QMenu* );
 };
 
 #endif
index a58e95624754b30669963ff04f1d12bb8d3ecde4..235ce398364e85e08bb1dbe258329071c83c7b80 100755 (executable)
 #include "OCCViewer_ViewPort3d.h"
 
 #include "SUIT_ViewWindow.h"
+#include "SUIT_ViewManager.h"
 #include "SUIT_Desktop.h"
 #include "SUIT_Session.h"
 
-#include <qpainter.h>
-#include <qapplication.h>
-#include <qcolordialog.h>
-#include <qpalette.h>
-#include <qpopupmenu.h>
+#include <QPainter>
+#include <QApplication>
+#include <QColorDialog>
+#include <QPalette>
+#include <QMenu>
+#include <QMouseEvent>
+#include <QToolBar>
 
 #include <AIS_Axis.hxx>
 #include <AIS_Drawer.hxx>
+#include <AIS_ListOfInteractive.hxx>
 #include <AIS_ListIteratorOfListOfInteractive.hxx>
 
 #include <Geom_Axis2Placement.hxx>
@@ -156,7 +160,7 @@ void OCCViewer_Viewer::setViewManager(SUIT_ViewManager* theViewManager)
   SUIT_ViewModel::setViewManager(theViewManager);
   if (theViewManager) {
     connect(theViewManager, SIGNAL(mousePress(SUIT_ViewWindow*, QMouseEvent*)), 
-            this, SLOT(onMousePress(SUIT_ViewWindow*, QMouseEvent*)));
+           this, SLOT(onMousePress(SUIT_ViewWindow*, QMouseEvent*)));
 
     connect(theViewManager, SIGNAL(mouseMove(SUIT_ViewWindow*, QMouseEvent*)), 
             this, SLOT(onMouseMove(SUIT_ViewWindow*, QMouseEvent*)));
@@ -200,7 +204,7 @@ void OCCViewer_Viewer::onMouseRelease(SUIT_ViewWindow* theWindow, QMouseEvent* t
 
   myEndPnt.setX(theEvent->x()); myEndPnt.setY(theEvent->y());
   OCCViewer_ViewWindow* aView = (OCCViewer_ViewWindow*) theWindow;
-  bool aHasShift = (theEvent->state() & Qt::ShiftButton);
+  bool aHasShift = (theEvent->modifiers() & Qt::ShiftModifier);
   
   if (!aHasShift) emit deselection();
 
@@ -251,10 +255,10 @@ void OCCViewer_Viewer::enableSelection(bool isEnabled)
   if ( !myViewManager )
     return;
 
-  QPtrVector<SUIT_ViewWindow> wins = myViewManager->getViews();
+  QVector<SUIT_ViewWindow*> wins = myViewManager->getViews();
   for ( int i = 0; i < (int)wins.count(); i++ )
   {
-    OCCViewer_ViewWindow* win = ::qt_cast<OCCViewer_ViewWindow*>( wins.at( i ) );
+    OCCViewer_ViewWindow* win = ::qobject_cast<OCCViewer_ViewWindow*>( wins.at( i ) );
     if ( win )
       win->updateEnabledDrawMode();
   }
@@ -271,10 +275,10 @@ void OCCViewer_Viewer::enableMultiselection(bool isEnable)
   if ( !myViewManager )
     return;
 
-  QPtrVector<SUIT_ViewWindow> wins = myViewManager->getViews();
+  QVector<SUIT_ViewWindow*> wins = myViewManager->getViews();
   for ( int i = 0; i < (int)wins.count(); i++ )
   {
-    OCCViewer_ViewWindow* win = ::qt_cast<OCCViewer_ViewWindow*>( wins.at( i ) );
+    OCCViewer_ViewWindow* win = ::qobject_cast<OCCViewer_ViewWindow*>( wins.at( i ) );
     if ( win )
       win->updateEnabledDrawMode();
   }
@@ -283,16 +287,16 @@ void OCCViewer_Viewer::enableMultiselection(bool isEnable)
 /*!
   Builds popup for occ viewer
 */
-void OCCViewer_Viewer::contextMenuPopup(QPopupMenu* thePopup)
+void OCCViewer_Viewer::contextMenuPopup(QMenu* thePopup)
 {
-  thePopup->insertItem( tr( "MEN_DUMP_VIEW" ), this, SLOT( onDumpView() ) );
-  thePopup->insertItem( tr( "MEN_CHANGE_BACKGROUD" ), this, SLOT( onChangeBgColor() ) );
+  thePopup->addAction( tr( "MEN_DUMP_VIEW" ), this, SLOT( onDumpView() ) );
+  thePopup->addAction( tr( "MEN_CHANGE_BACKGROUD" ), this, SLOT( onChangeBgColor() ) );
 
-  thePopup->insertSeparator();
+  thePopup->addSeparator();
 
   OCCViewer_ViewWindow* aView = (OCCViewer_ViewWindow*)(myViewManager->getActiveView());
   if ( aView && !aView->getToolBar()->isVisible() )
-    thePopup->insertItem( tr( "MEN_SHOW_TOOLBAR" ), this, SLOT( onShowToolbar() ) );
+    thePopup->addAction( tr( "MEN_SHOW_TOOLBAR" ), this, SLOT( onShowToolbar() ) );
 }
 
 /*!
index 654dec238b0a2f1a34b32ab0734876042a3b18c4..b21b1660c5ad88107e967013f05daf2bf063ea41 100755 (executable)
@@ -19,8 +19,8 @@
 #ifndef OCCVIEWER_VIEWMODEL_H
 #define OCCVIEWER_VIEWMODEL_H
 
-#include <qcolor.h>
-#include <qcursor.h>
+#include <QColor>
+#include <QPoint>
 
 #include "OCCViewer.h"
 
 
 #include <V3d_View.hxx>
 #include <AIS_Trihedron.hxx>
-#include <AIS_ListOfInteractive.hxx>
 #include <AIS_InteractiveContext.hxx>
 
+class QMouseEvent;
+
 class SUIT_ViewWindow;
 class SUIT_Desktop;
 class OCCViewer_ViewWindow;
 
+class AIS_ListOfInteractive;
+
 struct viewAspect
 {
 public:
@@ -54,7 +57,7 @@ public:
        QString    name;
 };
 
-typedef QValueList<viewAspect> viewAspectList;
+typedef QList<viewAspect> viewAspectList;
 
 #ifdef WIN32
 #pragma warning( disable:4251 )
@@ -72,17 +75,16 @@ public:
 
   void update();
 
-       virtual SUIT_ViewWindow* createView(SUIT_Desktop* theDesktop);
-
-       virtual void                    setViewManager(SUIT_ViewManager* theViewManager);
+  virtual SUIT_ViewWindow*        createView(SUIT_Desktop* theDesktop);
+  
+  virtual void                    setViewManager(SUIT_ViewManager* theViewManager);
   virtual QString                 getType() const { return Type(); }
 
-  virtual void                    contextMenuPopup(QPopupMenu*);
+  virtual void                    contextMenuPopup(QMenu*);
   
   void                            getSelectedObjects(AIS_ListOfInteractive& theList);
   void                            setObjectsSelected(const AIS_ListOfInteractive& theList);
-  void                            setSelected(const Handle(AIS_InteractiveObject)& theIO)
-  { myAISContext->SetSelected(theIO);}
+  void                            setSelected(const Handle(AIS_InteractiveObject)& theIO) { myAISContext->SetSelected(theIO);}
 
   void                            performSelectionChanged();
   // emit signal selectionChanged
@@ -115,19 +117,16 @@ public:
   Handle(AIS_Trihedron)           getTrihedron()   const { return myTrihedron; }
 
   void                            enableSelection(bool isEnabled);
-  bool                            isSelectionEnabled() const 
-  { return mySelectionEnabled; }
+  bool                            isSelectionEnabled() const { return mySelectionEnabled; }
 
   void                            enableMultiselection(bool isEnable);
-  bool                            isMultiSelectionEnabled() const 
-  { return myMultiSelectionEnabled; }
+  bool                            isMultiSelectionEnabled() const { return myMultiSelectionEnabled; }
 
-  int                             getSelectionCount() const 
-  { return (!myAISContext.IsNull())? myAISContext->NbSelected():0; }
+  int                             getSelectionCount() const { return (!myAISContext.IsNull())? myAISContext->NbSelected():0; }
 
   /* Selection management */
-  bool         highlight( const Handle(AIS_InteractiveObject)&, bool, bool=true );
-  bool         unHighlightAll( bool=true ); 
+  bool    highlight( const Handle(AIS_InteractiveObject)&, bool, bool=true );
+  bool   unHighlightAll( bool=true ); 
   bool    isInViewer( const Handle(AIS_InteractiveObject)&, bool=false );
   bool    isVisible( const Handle(AIS_InteractiveObject)& );
 
index ff4ef0551e36c7938977cd523b6cf2a944c16287..510e9b575f90f6af31f4dc4d5cf718c524dad080 100755 (executable)
 
 #include "SUIT_Session.h"
 
-#include <qrect.h>
-#include <qcursor.h>
-#include <qpixmap.h>
-#include <qpainter.h>
-#include <qintdict.h>
-#include <qpopupmenu.h>
-#include <qcolordialog.h>
+#include <QColor>
+#include <QRect>
+#include <QPixmap>
+#include <QPainter>
+#include <QMultiHash>
+#include <QMenu>
+#include <QColorDialog>
+#include <QColormap>
+#include <QCoreApplication>
+#include <QX11Info>
 
 #include <stdlib.h>
 
@@ -70,104 +73,106 @@ CMapEntry::CMapEntry()
 CMapEntry::~CMapEntry()
 {
        if ( alloc )
-        XFreeColormap( QPaintDevice::x11AppDisplay(), cmap );
+         XFreeColormap( QX11Info::display(), cmap );
 }
 
-static QIntDict<CMapEntry> *cmap_dict = 0;
+static QMultiHash<int,CMapEntry> *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;
 }
 
 static Colormap choose_cmap( Display *dpy, XVisualInfo *vi )
 {
-       if ( !cmap_dict )
-       {
-               cmap_dict = new QIntDict<CMapEntry>;
-               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;
-
-    x = new CMapEntry();
-
-    XStandardColormap *c;
-    int n, i;
+  if ( !cmap_dict )
+  {
+    cmap_dict = new QMultiHash<int,CMapEntry>;
+    const char *v = glXQueryServerString( dpy, vi->screen, GLX_VERSION );
+    mesa_gl = strstr( v,"Mesa" ) != 0;
+    qAddPostRoutine( cleanup_cmaps );
+  }
+
+  QHash<int,CMapEntry>::iterator itH = cmap_dict->find( (long)vi->visualid );
+  if ( itH != cmap_dict->end() )  // found colormap for visual
+    return itH.value().cmap;
+  
+  CMapEntry x;
+  
+  XStandardColormap *c;
+  int n, i;
 
-    //#ifdef DEBUG
-    //cout << "Choosing cmap for vID = " << vi->visualid << endl;
-    //#endif
+  //#ifdef DEBUG
+  //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;
+    cout << "Using x11AppColormap" << endl;
 #endif
-               return QPaintDevice::x11AppColormap();
-    }
+    return QX11Info::appColormap();
+  }
 
-    if ( mesa_gl )
+  if ( mesa_gl )
+  {
+    Atom hp_cmaps = XInternAtom( dpy, "_HP_RGB_SMOOTH_MAP_LIST", true );
+    if ( hp_cmaps && vi->visual->c_class == TrueColor && vi->depth == 8 )
+    {
+      if ( XGetRGBColormaps( dpy, RootWindow( dpy, vi->screen ), &c, &n, hp_cmaps ) )
+      {
+       i = 0;
+       while ( i < n && x.cmap == 0 )
        {
-               Atom hp_cmaps = XInternAtom( dpy, "_HP_RGB_SMOOTH_MAP_LIST", true );
-               if ( hp_cmaps && vi->visual->c_class == TrueColor && vi->depth == 8 )
-               {
-               if ( XGetRGBColormaps( dpy, RootWindow( dpy, vi->screen ), &c, &n, hp_cmaps ) )
-            {
-                       i = 0;
-                           while ( i < n && x->cmap == 0 )
-                {
-                               if ( c[i].visualid == vi->visual->visualid )
-                                   {
-                                       x->cmap = c[i].colormap;
-                                           x->scmap = c[i];
-                               }
-                                   i++;
-                }
-                           XFree( (char*)c );
-               }
-        }
+         if ( c[i].visualid == vi->visual->visualid )
+         {
+           x.cmap = c[i].colormap;
+           x.scmap = c[i];
+         }
+         i++;
        }
+       XFree( (char*)c );
+      }
+    }
+  }
 #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 ( 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 )
-                               {
-                                   if ( c[i].visualid == vi->visualid )
-                    {
-                                           x->cmap = c[i].colormap;
-                                               x->scmap = c[i];
-                                   }
-                                       i++;
-                }
-                               XFree( (char *)c );
-            }
-        }
-    }
-#endif
-       if ( !x->cmap )
+      if ( XGetRGBColormaps( dpy, RootWindow( dpy, vi->screen ), &c, &n, XA_RGB_DEFAULT_MAP ) )
+      {
+       i = 0;
+       while ( i < n && x.cmap == 0 )
        {
-               // no shared cmap found
-               x->cmap = XCreateColormap( dpy, RootWindow( dpy, vi->screen ), vi->visual, AllocNone );
-               x->alloc = true;
+         if ( c[i].visualid == vi->visualid )
+         {
+           x.cmap = c[i].colormap;
+           x.scmap = c[i];
+         }
+         i++;
        }
-
-       cmap_dict->insert( (long)vi->visualid, x ); // associate cmap with visualid
-       return x->cmap;
+       XFree( (char *)c );
+      }
+    }
+  }
+#endif
+  if ( !x.cmap )
+  {
+    // no shared cmap found
+    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;
 }
 #endif
 
@@ -176,7 +181,7 @@ static Colormap choose_cmap( Display *dpy, XVisualInfo *vi )
     Constructor
 */
 OCCViewer_ViewPort::OCCViewer_ViewPort( QWidget* parent )
-: QWidget( parent, 0, WRepaintNoErase | WResizeNoErase )
+: QWidget( parent )
 {
        initialize();
 }
@@ -194,15 +199,14 @@ OCCViewer_ViewPort::~OCCViewer_ViewPort()
 */
 void OCCViewer_ViewPort::initialize()
 {
-  myPopupActions.setAutoDelete( true );
   myPaintersRedrawing = false;
   myEnableSketching = false;
   myEnableTransform = true;
   
   setMouseTracking( true );
-  setBackgroundMode( NoBackground );
+  setBackgroundRole( QPalette::NoRole );//NoBackground );
   // set focus policy to threat QContextMenuEvent from keyboard  
-  setFocusPolicy( StrongFocus );
+  setFocusPolicy( Qt::StrongFocus );
 }
 
 /*!
@@ -219,57 +223,57 @@ void OCCViewer_ViewPort::selectVisualId()
 {
 #if !defined WNT
        XVisualInfo* pVisualInfo;
-       if ( x11Display() )
+       if ( QX11Info::display() )
        {
                /* Initialization with the default VisualID */
-               Visual *v = DefaultVisual( x11Display(), DefaultScreen( x11Display() ) );
+               Visual *v = DefaultVisual( QX11Info::display(), DefaultScreen( QX11Info::display() ) );
                int visualID = XVisualIDFromVisual( v );
 
                /*  Here we use the settings from Optimizer_ViewInfo::TxglCreateWindow() */
                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();
+                 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();
+                 p = parentWidget()->winId();
 
-        Window w;
+               Window w;
        /*        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 );
                }
                else
                return;*/
-       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 );
        
                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 );
@@ -297,7 +301,7 @@ void OCCViewer_ViewPort::selectVisualId()
 
                /* 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() )
@@ -307,7 +311,7 @@ void OCCViewer_ViewPort::selectVisualId()
         {
                        XFree( (char *)pVisualInfo );
                }
-               XFlush( x11Display() );
+               XFlush( QX11Info::display() );
        }
 #endif
 }
@@ -318,7 +322,7 @@ void OCCViewer_ViewPort::selectVisualId()
 void OCCViewer_ViewPort::setBackgroundColor( const QColor& color )
 {
     QPalette pal = palette();
-    pal.setColor( QColorGroup::Background, color );
+    pal.setColor( QPalette::Background, color );
     setPalette( pal );
     repaint();
     emit vpChangeBGColor( color );
@@ -329,7 +333,7 @@ void OCCViewer_ViewPort::setBackgroundColor( const QColor& color )
 */
 QColor OCCViewer_ViewPort::backgroundColor() const
 {
-    return palette().active().background();
+    return palette().color( QPalette::Active, QPalette::Background );
 }
 
 /*!
@@ -466,6 +470,8 @@ void OCCViewer_ViewPort::onUpdate()
        {
                for ( QtxAction* a = myPopupActions.first(); a; a = myPopupActions.next() )
                        a->removeFrom( popup );
+               //while (!myPopupActions.isEmpty())
+               //  delete myPopupActions.takeFirst();
                myPopupActions.clear();
        }
 }*/
index b4742b2930dcd7acfa8605f7a84e5759813478e3..49fcc855f7fee3dfe2736672b6538a05057ce963 100755 (executable)
 
 #include "QtxAction.h"
 
-#include <qlist.h>
-#include <qcolor.h>
-#include <qwidget.h>
+#include <QList>
+#include <QWidget>
 
 #include <Aspect_Window.hxx>
 
+class QColor;
 class QRect;
-class QCursor;
 class QPainter;
 class OCCViewer_ViewSketcher;
-class OCCViewer_ViewTransformer;
 
 #ifdef WIN32
 #pragma warning ( disable:4251 )
@@ -45,74 +43,74 @@ class OCCViewer_ViewTransformer;
 */
 class OCCVIEWER_EXPORT OCCViewer_ViewPort : public QWidget
 {
-       Q_OBJECT
+  Q_OBJECT
 
   friend class OCCViewer_ViewSketcher;
 
 public:
   OCCViewer_ViewPort( QWidget* parent );
-       virtual ~OCCViewer_ViewPort();
+  virtual ~OCCViewer_ViewPort();
 
 public:
-       void                             setSketchingEnabled( bool );
+  void                          setSketchingEnabled( bool );
   bool                           isSketchingEnabled() const;
   void                          setTransformEnabled( bool );
   bool                           isTransformEnabled() const;
 
-  virtual QColor                        backgroundColor() const;
-  virtual void                     setBackgroundColor( const QColor& );
+  virtual QColor                 backgroundColor() const;
+  virtual void                   setBackgroundColor( const QColor& );
 
   void                          redrawPainters();
 
-  virtual void                     onUpdate();
+  virtual void                   onUpdate();
 
 protected:
 //     enum ViewType { Type2D, Type3D };
-       void                                     selectVisualId();
+  void                          selectVisualId();
 
 // EVENTS
-       virtual void                   paintEvent( QPaintEvent *);
-       virtual void                     mouseMoveEvent( QMouseEvent *);
-       virtual void                     mouseReleaseEvent( QMouseEvent *);
-       virtual void                     mousePressEvent( QMouseEvent *);
-       virtual void                     mouseDoubleClickEvent( QMouseEvent *);
-  virtual void                     keyPressEvent( QKeyEvent *);
-  virtual void                     keyReleaseEvent( QKeyEvent *);
+  virtual void                   paintEvent( QPaintEvent *);
+  virtual void                  mouseMoveEvent( QMouseEvent *);
+  virtual void                  mouseReleaseEvent( QMouseEvent *);
+  virtual void                  mousePressEvent( QMouseEvent *);
+  virtual void                  mouseDoubleClickEvent( QMouseEvent *);
+  virtual void                   keyPressEvent( QKeyEvent *);
+  virtual void                   keyReleaseEvent( QKeyEvent *);
 
 // TO BE REDEFINED
   virtual void                  reset() = 0;
   virtual void                  pan( int, int ) = 0;
-       virtual void                     setCenter( int, int ) = 0;
-       virtual void                     fitRect( const QRect& ) = 0;
+  virtual void                  setCenter( int, int ) = 0;
+  virtual void                  fitRect( const QRect& ) = 0;
   virtual void                  zoom( int, int, int, int ) = 0;
   virtual void                  fitAll( bool keepScale = false, bool withZ = true, bool upd = true ) = 0;
 
 // POPUP
 //  void                             onCreatePopup( QPopupMenu* );
-//     void                             onDestroyPopup( QPopupMenu* );
+//  void                             onDestroyPopup( QPopupMenu* );
 
 protected slots:
   virtual void                  onChangeBgColor();
 
 signals:
-  void                                  vpKeyEvent( QKeyEvent* );
-  void                                  vpMouseEvent( QMouseEvent* );
-       void                                 vpDrawExternal( QPainter* );
+  void                          vpKeyEvent( QKeyEvent* );
+  void                          vpMouseEvent( QMouseEvent* );
+  void                          vpDrawExternal( QPainter* );
   void                           vpChangeBGColor( QColor );
 
 private:
-       void                             initialize();
-       void                             cleanup();
+  void                          initialize();
+  void                          cleanup();
 
 protected:
-  Handle(Aspect_Window)         myWindow;
-  bool                                     myEnableSketching;
-  bool                                     myEnableTransform;
-  bool                                     myPaintersRedrawing;        /* set to draw externally */
-  QPtrList<QtxAction>           myPopupActions;
+  Handle(Aspect_Window)          myWindow;
+  bool                          myEnableSketching;
+  bool                          myEnableTransform;
+  bool                          myPaintersRedrawing; /* set to draw externally */
+  QList<QtxAction*>              myPopupActions;
 
 private:
-       static int                               nCounter;                              /* objects counter */
+  static int                    nCounter; /* objects counter */
 };
 
 #ifdef WIN32
index cbeb3ce9c3a61f9b6a084eeeeaa455c9d9f20a83..0c54717047ebd6534e4876db0eecbefff1d516f0 100755 (executable)
 #include "OCCViewer_VService.h"
 #include "OCCViewer_ViewWindow.h"
 
-#include <qrect.h>
-#include <qevent.h>
-#include <qapplication.h>
+#include <QColor>
+#include <QRect>
+#include <QPaintEvent>
+#include <QResizeEvent>
+#include <QApplication>
 
 #include <Visual3d_View.hxx>
+#include <V3d_Viewer.hxx>
 #include <V3d_PerspectiveView.hxx>
 #include <V3d_OrthographicView.hxx>
 
index 4f840bd02f8a23a1759ffcfcca726078115c4a73..1eb9689f97c5321af465268ffb8bc61d5dd88254 100755 (executable)
 
 #include "OCCViewer_ViewPort.h"
 
-#include <qcolor.h>
-
 #include <V3d_View.hxx>
-#include <V3d_Viewer.hxx>
 
+class QColor;
 class QRect;
 
+class Handle(V3d_Viewer);
+
 #ifdef WIN32
 #pragma warning ( disable:4251 )
 #endif
 
 class OCCVIEWER_EXPORT OCCViewer_ViewPort3d: public OCCViewer_ViewPort
 {
-       Q_OBJECT
+  Q_OBJECT
 
   friend class OCCViewer_ViewTransformer;
 
 public:
-       OCCViewer_ViewPort3d( QWidget*, const Handle(V3d_Viewer)&, V3d_TypeOfView = V3d_ORTHOGRAPHIC );
-       virtual ~OCCViewer_ViewPort3d();
+  OCCViewer_ViewPort3d( QWidget*, const Handle(V3d_Viewer)&, V3d_TypeOfView = V3d_ORTHOGRAPHIC );
+  virtual ~OCCViewer_ViewPort3d();
 
 public:
-       Handle(V3d_View)        getView() const;
-  Handle(V3d_View)                 setView( const Handle(V3d_View)& );
-       Handle(V3d_Viewer)      getViewer() const;
+  Handle(V3d_View)        getView() const;
+  Handle(V3d_View)       setView( const Handle(V3d_View)& );
+  Handle(V3d_Viewer)      getViewer() const;
 
   void setAnimationMode(bool theDegenerated);
 
-       virtual void                    setBackgroundColor( const QColor& color);
+  virtual void         setBackgroundColor( const QColor& color);
   virtual QColor       backgroundColor() const;
 
 //   void         setActive( V3d_TypeOfView );
@@ -63,34 +63,34 @@ public:
   // TRANSFORMATIONS
   virtual void         reset();
   virtual void         pan( int , int );
-       virtual void            setCenter( int , int );
-       virtual void            fitRect( const QRect& );
-       virtual void            zoom( int, int, int, int );
+  virtual void         setCenter( int , int );
+  virtual void         fitRect( const QRect& );
+  virtual void         zoom( int, int, int, int );
   virtual void         fitAll( bool keepScale = false, bool withZ = true, bool upd = true );
 
-       void                    startRotation( int, int, int, const gp_Pnt& );
-       void                    rotate( int, int, int, const gp_Pnt& );
-       void                    endRotation();
+  void                 startRotation( int, int, int, const gp_Pnt& );
+  void                 rotate( int, int, int, const gp_Pnt& );
+  void                 endRotation();
 
 protected:
     // EVENTS
-       virtual void                    paintEvent( QPaintEvent* );
-  virtual void      resizeEvent( QResizeEvent* );
+  virtual void         paintEvent( QPaintEvent* );
+  virtual void          resizeEvent( QResizeEvent* );
 
 private:
-       Handle(V3d_View) activeView() const;
-       Handle(V3d_View) inactiveView() const;
-       bool             mapView( const Handle(V3d_View)& );
-       bool               setWindow( const Handle(V3d_View)& );
-       bool                                       mapped( const Handle(V3d_View)& ) const;
+  Handle(V3d_View) activeView() const;
+  Handle(V3d_View) inactiveView() const;
+  bool             mapView( const Handle(V3d_View)& );
+  bool            setWindow( const Handle(V3d_View)& );
+  bool            mapped( const Handle(V3d_View)& ) const;
 
 private:
-  Handle(V3d_View)             myOrthoView;
-  Handle(V3d_View)             myPerspView;
-  Handle(V3d_View)             myActiveView;
-       bool            myDegenerated;
-  bool    myAnimate;
-       double  myScale;
+  Handle(V3d_View)     myOrthoView;
+  Handle(V3d_View)     myPerspView;
+  Handle(V3d_View)     myActiveView;
+  bool                 myDegenerated;
+  bool                  myAnimate;
+  double               myScale;
 };
 
 #ifdef WIN32
index 0ec1a641d213a41b57c65d1b53e070bf467d3d61..935d4dc7809515d96605b7d6c57a3cb4519bafb4 100755 (executable)
 #include "SUIT_Desktop.h"
 #include "SUIT_Session.h"
 #include "SUIT_ToolButton.h"
+#include "SUIT_ViewManager.h"
 
 #include "SUIT_Tools.h"
 #include "SUIT_ResourceMgr.h"
 #include "SUIT_MessageBox.h"
 
-#include <qptrlist.h>
-#include <qhbox.h>
-#include <qlabel.h>
-#include <qcolor.h>
-#include <qpainter.h>
-#include <qapplication.h>
-#include <qdatetime.h>
-#include <qimage.h>
+#include <QPainter>
+#include <QTime>
+#include <QImage>
+#include <QToolBar>
+#include <QMouseEvent>
+#include <QRubberBand>
 
 #include <V3d_Plane.hxx>
 #include <gp_Dir.hxx>
 #include <gp_Pln.hxx>
 
+#include <AIS_ListOfInteractive.hxx>
 #include <AIS_ListIteratorOfListOfInteractive.hxx>
 #include <AIS_Shape.hxx>
 
@@ -197,7 +197,7 @@ OCCViewer_ViewWindow::OCCViewer_ViewWindow(SUIT_Desktop* theDesktop, OCCViewer_V
 void OCCViewer_ViewWindow::initLayout()
 {
   myViewPort = new OCCViewer_ViewPort3d( this, myModel->getViewer3d(), V3d_ORTHOGRAPHIC );
-  myViewPort->setBackgroundColor(black);
+  myViewPort->setBackgroundColor(Qt::black);
   myViewPort->installEventFilter(this);
   setCentralWidget(myViewPort);
   myOperation = NOTHING;
@@ -211,8 +211,8 @@ void OCCViewer_ViewWindow::initLayout()
   setTransformInProcess ( false );
 
   myToolBar = new QToolBar(this);
-  myToolBar->setCloseMode(QDockWindow::Undocked);
-  myToolBar->setLabel(tr("LBL_TOOLBAR_LABEL"));
+  //myToolBar->setCloseMode(QDockWindow::Undocked); // toolbar has "Close" (X) button only if it's undocked, but there is no such functionality in Qt4
+  myToolBar->setWindowTitle(tr("LBL_TOOLBAR_LABEL"));
 
   createActions();
   createToolBar();
@@ -225,13 +225,13 @@ void OCCViewer_ViewWindow::initLayout()
 OCCViewer_ViewWindow::OperationType OCCViewer_ViewWindow::getButtonState(QMouseEvent* theEvent)
 {
   OperationType aOp = NOTHING;
-  if( (theEvent->state() == SUIT_ViewModel::myStateMap[SUIT_ViewModel::ZOOM]) &&
+  if( (theEvent->modifiers() == SUIT_ViewModel::myStateMap[SUIT_ViewModel::ZOOM]) &&
       (theEvent->button() == SUIT_ViewModel::myButtonMap[SUIT_ViewModel::ZOOM]) )
     aOp = ZOOMVIEW;
-  else if( (theEvent->state() == SUIT_ViewModel::myStateMap[SUIT_ViewModel::PAN]) && 
+  else if( (theEvent->modifiers() == SUIT_ViewModel::myStateMap[SUIT_ViewModel::PAN]) && 
            (theEvent->button() == SUIT_ViewModel::myButtonMap[SUIT_ViewModel::PAN]) )
     aOp = PANVIEW;
-  else if( (theEvent->state()  == SUIT_ViewModel::myStateMap[SUIT_ViewModel::ROTATE]) &&
+  else if( (theEvent->modifiers()  == SUIT_ViewModel::myStateMap[SUIT_ViewModel::ROTATE]) &&
            (theEvent->button() == SUIT_ViewModel::myButtonMap[SUIT_ViewModel::ROTATE]) )
     aOp = ROTATE;
 
@@ -534,7 +534,7 @@ void OCCViewer_ViewWindow::activateSetRotationGravity()
 */
 void OCCViewer_ViewWindow::updateGravityCoords()
 {
-  if ( mySetRotationPointDlg && mySetRotationPointDlg->isShown() && myCurrPointType == GRAVITY )
+  if ( mySetRotationPointDlg && mySetRotationPointDlg->isVisible() && myCurrPointType == GRAVITY )
   {
     Standard_Real Xcenter, Ycenter, Zcenter;
     if ( computeGravityCenter( Xcenter, Ycenter, Zcenter ) )
@@ -680,10 +680,10 @@ void OCCViewer_ViewWindow::vpMouseMoveEvent(QMouseEvent* theEvent)
       emit mouseMoving( this, theEvent ); 
     else
     {
-      int aState = theEvent->state();
-      //int aButton = theEvent->button();
-      if ( aState == Qt::LeftButton ||
-          aState == ( Qt::LeftButton | Qt::ShiftButton) )      {
+      int aState = theEvent->modifiers();
+      int aButton = theEvent->button();
+      if ( aButton == Qt::LeftButton ||
+          ( aButton == Qt::LeftButton && aState == Qt::ShiftModifier ) )       {
        myDrawRect = myEnableDrawMode;
        if ( myDrawRect ) {
          drawRect();
@@ -711,11 +711,10 @@ void OCCViewer_ViewWindow::vpMouseReleaseEvent(QMouseEvent* theEvent)
   case NOTHING:
     {
       emit mouseReleased(this, theEvent);
-      if(theEvent->button() == RightButton)
+      if(theEvent->button() == Qt::RightButton)
       {
         QContextMenuEvent aEvent( QContextMenuEvent::Mouse,
-                                  theEvent->pos(), theEvent->globalPos(),
-                                  theEvent->state() );
+                                  theEvent->pos(), theEvent->globalPos() );
         emit contextMenuRequested( &aEvent );
       }
     }
@@ -739,7 +738,7 @@ void OCCViewer_ViewWindow::vpMouseReleaseEvent(QMouseEvent* theEvent)
     break;
       
   case WINDOWFIT:
-    if ( theEvent->state() == Qt::LeftButton ) {
+    if ( theEvent->button() == Qt::LeftButton ) {
            myCurrX = theEvent->x();
            myCurrY = theEvent->y();
            QRect rect = SUIT_Tools::makeRect(myStartX, myStartY, myCurrX, myCurrY);
@@ -797,14 +796,17 @@ void OCCViewer_ViewWindow::resetState()
 */
 void OCCViewer_ViewWindow::drawRect()
 {
-  QPainter aPainter(myViewPort);
-  aPainter.setRasterOp(Qt::XorROP);
-  aPainter.setPen(Qt::white);
+  QRubberBand* aRB = new QRubberBand( QRubberBand::Rectangle, myViewPort );
   QRect aRect = SUIT_Tools::makeRect(myStartX, myStartY, myCurrX, myCurrY);
-  if ( !myRect.isEmpty() )
-         aPainter.drawRect( myRect );
-  aPainter.drawRect(aRect);
+  if ( !myRect.isEmpty() ) {
+    aRB->setGeometry( myRect );
+    aRB->setVisible( myRect.isValid() );
+  }
+  aRB->setGeometry( aRect );
+  aRB->setVisible( aRect.isValid() );
   myRect = aRect;
+  
+  delete aRB;
 }
 
 /*!
@@ -864,7 +866,7 @@ void OCCViewer_ViewWindow::createActions()
   mySetRotationPointAction = new QtxAction(tr("MNU_CHANGINGROTATIONPOINT_VIEW"), aResMgr->loadPixmap( "OCCViewer", tr( "ICON_OCCVIEWER_VIEW_ROTATION_POINT" ) ),
                            tr( "MNU_CHANGINGROTATIONPOINT_VIEW" ), 0, this);
   mySetRotationPointAction->setStatusTip(tr("DSC_CHANGINGROTATIONPOINT_VIEW"));
-  mySetRotationPointAction->setToggleAction( true );
+  mySetRotationPointAction->setCheckable( true );
   connect(mySetRotationPointAction, SIGNAL(toggled( bool )), this, SLOT(onSetRotationPoint( bool )));
   myActionsMap[ ChangeRotationPointId ] = mySetRotationPointAction;
 
@@ -929,7 +931,7 @@ void OCCViewer_ViewWindow::createActions()
   myClippingAction = new QtxAction(tr("MNU_CLIPPING"), aResMgr->loadPixmap( "OCCViewer", tr( "ICON_OCCVIEWER_CLIPPING" ) ),
                            tr( "MNU_CLIPPING" ), 0, this);
   myClippingAction->setStatusTip(tr("DSC_CLIPPING"));
-  myClippingAction->setToggleAction( true );
+  myClippingAction->setCheckable( true );
   connect(myClippingAction, SIGNAL(toggled( bool )), this, SLOT(onClipping( bool )));
   myActionsMap[ ClippingId ] = myClippingAction;
 
@@ -1106,7 +1108,7 @@ void OCCViewer_ViewWindow::onSetRotationPoint( bool on )
          mySetRotationPointDlg->SetAction( mySetRotationPointAction );
        }
 
-      if ( !mySetRotationPointDlg->isShown() )
+      if ( !mySetRotationPointDlg->isVisible() )
       {
        if ( mySetRotationPointDlg->IsFirstShown() )
        { 
@@ -1119,7 +1121,7 @@ void OCCViewer_ViewWindow::onSetRotationPoint( bool on )
     }
   else
     {
-      if ( mySetRotationPointDlg->isShown() )
+      if ( mySetRotationPointDlg->isVisible() )
        mySetRotationPointDlg->hide();
     }
 }
@@ -1140,9 +1142,9 @@ void OCCViewer_ViewWindow::onClipping( bool on )
 {
   SUIT_ResourceMgr* aResMgr = SUIT_Session::session()->resourceMgr();
   if ( on )
-    myActionsMap[ ClippingId ]->setIconSet(aResMgr->loadPixmap( "OCCViewer", tr( "ICON_OCCVIEWER_CLIPPING_PRESSED" )));
+    myActionsMap[ ClippingId ]->setIcon(aResMgr->loadPixmap( "OCCViewer", tr( "ICON_OCCVIEWER_CLIPPING_PRESSED" )));
   else
-    myActionsMap[ ClippingId ]->setIconSet(aResMgr->loadPixmap( "OCCViewer", tr( "ICON_OCCVIEWER_CLIPPING" )));
+    myActionsMap[ ClippingId ]->setIcon(aResMgr->loadPixmap( "OCCViewer", tr( "ICON_OCCVIEWER_CLIPPING" )));
   
   if ( on )
     {
@@ -1152,12 +1154,12 @@ void OCCViewer_ViewWindow::onClipping( bool on )
          myClippingDlg->SetAction( myClippingAction );
        }
 
-      if ( !myClippingDlg->isShown() )
+      if ( !myClippingDlg->isVisible() )
        myClippingDlg->show();
     }
   else
     {
-      if ( myClippingDlg->isShown() )
+      if ( myClippingDlg->isVisible() )
        myClippingDlg->hide();
       setCuttingPlane(false);
     }
@@ -1225,7 +1227,7 @@ void OCCViewer_ViewWindow::onTrihedronShow()
 QImage OCCViewer_ViewWindow::dumpView()
 {
   QPixmap px = QPixmap::grabWindow( myViewPort->winId() );
-  return px.convertToImage();
+  return px.toImage();
 }
 
 /*!
@@ -1337,7 +1339,7 @@ QString OCCViewer_ViewWindow::getVisualParameters()
 */
 void OCCViewer_ViewWindow::setVisualParameters( const QString& parameters )
 {
-  QStringList paramsLst = QStringList::split( '*', parameters, true );
+  QStringList paramsLst = parameters.split( '*' );
   if ( paramsLst.size() == 13 ) {
     viewAspect params;
     params.scale    = paramsLst[0].toDouble();
index 9c384141227903d7d5837155ef5718bda16959af..2d3d2aa3708d99f1b8698fed5adef7d435e014f3 100755 (executable)
@@ -25,8 +25,7 @@
 
 #include "QtxAction.h"
 
-#include <qcursor.h>
-#include <qvaluelist.h>
+#include <QCursor>
 
 class SUIT_Desktop;
 class OCCViewer_ViewPort3d;
index 180d2cafb02981e7e417ebd291b41fce146b01c7..e2e9076b4330ded1beacb0a65da5431c406937d5 100755 (executable)
 
 #include "Qtx.h"
 
-#include <qlistbox.h>
+// This file isn't yet ported to Qt4 => there are some corrections for OCCViewer porting  -->
+//#include <qlistbox.h>
+#include <QListWidget>
+#include <QListWidgetItem>
+// <--
 
 #ifdef WIN32
 #pragma warning( disable:4251 )
 class QLineEdit;
 class QValidator;
 
-class QTX_EXPORT QtxListBox : public QListBox
+class QTX_EXPORT QtxListBox : public QListWidget//QListBox // This file isn't yet ported to Qt4 => there are some corrections for OCCViewer porting
 {
     Q_OBJECT
 
 public:
-    QtxListBox( QWidget* = 0, const char* = 0, WFlags = 0 );
+    QtxListBox( QWidget* = 0, const char* = 0, Qt::WindowFlags = 0 );
     virtual ~QtxListBox();
 
     bool              isEditEnabled() const;
     bool              defaultEditAction() const;
     bool              isModificationEnabled() const;
 
-    QListBoxItem*     editedItem() const;
+    QListWidgetItem*  editedItem() const;
     int               editedIndex() const;
 
     void              startEdition( const int );
-    void              startEdition( const QListBoxItem* );
+    void              startEdition( const QListWidgetItem* );
     void              endEdition( const bool );
 
     void              ensureItemVisible( const int );
-    void              ensureItemVisible( const QListBoxItem* );
+    void              ensureItemVisible( const QListWidgetItem* );
 
     virtual bool      eventFilter( QObject*, QEvent* );
 
@@ -68,7 +72,7 @@ public:
 
 signals:
     void              itemEdited( int );
-    void              itemEdited( QListBoxItem* );
+    void              itemEdited( QListWidgetItem* );
     void              itemMoved( int, int );
 
 public slots:
index 04c513cfa0017ad9f1e4173638381d1ccf26cb25..a610dcbcc6d2c4461ce862ee72a18e8e198a0547 100644 (file)
@@ -14,5 +14,6 @@ SUBDIRS += PyInterp
 SUBDIRS += PyConsole
 SUBDIRS += Prs
 SUBDIRS += OBJECT
+SUBDIRS += OCCViewer
 SUBDIRS += Event