From: mkr Date: Fri, 1 Jun 2007 10:26:24 +0000 (+0000) Subject: Porting to Qt4. X-Git-Url: http://git.salome-platform.org/gitweb/?a=commitdiff_plain;h=23ccfbc60fc0c8869b4fc0f84873a6e250e79471;p=modules%2Fgui.git Porting to Qt4. --- diff --git a/src/Makefile.am b/src/Makefile.am index db733d24b..6ac4cc202 100755 --- a/src/Makefile.am +++ b/src/Makefile.am @@ -49,7 +49,7 @@ if ENABLE_SALOMEOBJECT # VSR: this is the original packages list # SUBDIRS += SVTK # VSR: already migrated to Qt4 packages - SUBDIRS += + SUBDIRS += SVTK endif endif if ENABLE_OCCVIEWER diff --git a/src/OCCViewer/OCCViewer_ClippingDlg.cxx b/src/OCCViewer/OCCViewer_ClippingDlg.cxx index 0a6140de1..9bfb92de5 100644 --- a/src/OCCViewer/OCCViewer_ClippingDlg.cxx +++ b/src/OCCViewer/OCCViewer_ClippingDlg.cxx @@ -18,7 +18,7 @@ // #include "OCCViewer_ClippingDlg.h" -#include +#include #include #include "SUIT_Session.h" @@ -83,15 +83,16 @@ OCCViewer_ClippingDlg::OCCViewer_ClippingDlg( OCCViewer_ViewWindow* view, QWidge const double max = 1e+16; const double step = 5; const int precision = -6; // PAL12789. Minus is for using 'g' double->string conversion specifier, - // see QtxDblSpinBox::mapValueToText( double v ) + // see QtxDoubleSpinBox::mapValueToText( double v ) TextLabelX = new QLabel( GroupPoint ); TextLabelX->setObjectName( "TextLabelX" ); TextLabelX->setText( tr("X:") ); GroupPointLayout->addWidget( TextLabelX, 0, 0 ); - SpinBox_X = new QtxDblSpinBox( min, max, step, GroupPoint, "SpinBox_X" ); - SpinBox_X->setPrecision( precision ); + SpinBox_X = new QtxDoubleSpinBox( min, max, step, GroupPoint ); + SpinBox_X->setObjectName("SpinBox_X" ); + SpinBox_X->setDecimals( precision ); GroupPointLayout->addWidget( SpinBox_X, 0, 1 ); TextLabelY = new QLabel( GroupPoint ); @@ -99,8 +100,9 @@ OCCViewer_ClippingDlg::OCCViewer_ClippingDlg( OCCViewer_ViewWindow* view, QWidge TextLabelY->setText( tr("Y:") ); GroupPointLayout->addWidget( TextLabelY, 0, 2 ); - SpinBox_Y = new QtxDblSpinBox( min, max, step, GroupPoint, "SpinBox_Y" ); - SpinBox_Y->setPrecision( precision ); + SpinBox_Y = new QtxDoubleSpinBox( min, max, step, GroupPoint ); + SpinBox_Y->setObjectName("SpinBox_Y" ); + SpinBox_Y->setDecimals( precision ); GroupPointLayout->addWidget( SpinBox_Y, 0, 3 ); TextLabelZ = new QLabel( GroupPoint ); @@ -108,8 +110,9 @@ OCCViewer_ClippingDlg::OCCViewer_ClippingDlg( OCCViewer_ViewWindow* view, QWidge TextLabelZ->setText( tr("Z:") ); GroupPointLayout->addWidget( TextLabelZ, 0, 4 ); - SpinBox_Z = new QtxDblSpinBox( min, max, step, GroupPoint, "SpinBox_Z" ); - SpinBox_Z->setPrecision( precision ); + SpinBox_Z = new QtxDoubleSpinBox( min, max, step, GroupPoint ); + SpinBox_Z->setObjectName("SpinBox_Z" ); + SpinBox_Z->setDecimals( precision ); GroupPointLayout->addWidget( SpinBox_Z, 0, 5 ); resetButton = new QPushButton( GroupPoint ); @@ -132,8 +135,9 @@ OCCViewer_ClippingDlg::OCCViewer_ClippingDlg( OCCViewer_ViewWindow* view, QWidge TextLabelDx->setText( tr("Dx:") ); GroupDirectionLayout->addWidget( TextLabelDx, 0, 0 ); - SpinBox_Dx = new QtxDblSpinBox( min, max, step, GroupDirection, "SpinBox_Dx" ); - SpinBox_Dx->setPrecision( precision ); + SpinBox_Dx = new QtxDoubleSpinBox( min, max, step, GroupDirection ); + SpinBox_Dx->setObjectName("SpinBox_Dx" ); + SpinBox_Dx->setDecimals( precision ); GroupDirectionLayout->addWidget( SpinBox_Dx, 0, 1 ); TextLabelDy = new QLabel( GroupDirection ); @@ -141,8 +145,9 @@ OCCViewer_ClippingDlg::OCCViewer_ClippingDlg( OCCViewer_ViewWindow* view, QWidge TextLabelDy->setText( tr("Dy:") ); GroupDirectionLayout->addWidget( TextLabelDy, 0, 2 ); - SpinBox_Dy = new QtxDblSpinBox( min, max, step, GroupDirection, "SpinBox_Dy" ); - SpinBox_Dy->setPrecision( precision ); + SpinBox_Dy = new QtxDoubleSpinBox( min, max, step, GroupDirection ); + SpinBox_Dy->setObjectName("SpinBox_Dy" ); + SpinBox_Dy->setDecimals( precision ); GroupDirectionLayout->addWidget( SpinBox_Dy, 0, 3 ); TextLabelDz = new QLabel( GroupDirection ); @@ -150,8 +155,9 @@ OCCViewer_ClippingDlg::OCCViewer_ClippingDlg( OCCViewer_ViewWindow* view, QWidge TextLabelDz->setText( tr("Dz:") ); GroupDirectionLayout->addWidget( TextLabelDz, 0, 4 ); - SpinBox_Dz = new QtxDblSpinBox( min, max, step, GroupDirection, "SpinBox_Dz" ); - SpinBox_Dz->setPrecision( precision ); + SpinBox_Dz = new QtxDoubleSpinBox( min, max, step, GroupDirection ); + SpinBox_Dz->setObjectName("SpinBox_Dz" ); + SpinBox_Dz->setDecimals( precision ); GroupDirectionLayout->addWidget( SpinBox_Dz, 0, 5 ); invertButton = new QPushButton( GroupDirection ); diff --git a/src/OCCViewer/OCCViewer_ClippingDlg.h b/src/OCCViewer/OCCViewer_ClippingDlg.h index 00fe9c5be..b50ff75f4 100644 --- a/src/OCCViewer/OCCViewer_ClippingDlg.h +++ b/src/OCCViewer/OCCViewer_ClippingDlg.h @@ -31,7 +31,7 @@ class QLabel; class QPushButton; class QComboBox; class QCheckBox; -class QtxDblSpinBox; +class QtxDoubleSpinBox; class QtxAction; class OCCViewer_ViewWindow; @@ -66,18 +66,18 @@ private : QLabel* TextLabelX; QLabel* TextLabelY; QLabel* TextLabelZ; - QtxDblSpinBox* SpinBox_X; - QtxDblSpinBox* SpinBox_Y; - QtxDblSpinBox* SpinBox_Z; + QtxDoubleSpinBox* SpinBox_X; + QtxDoubleSpinBox* SpinBox_Y; + QtxDoubleSpinBox* SpinBox_Z; QPushButton* resetButton; QGroupBox* GroupDirection; QLabel* TextLabelDx; QLabel* TextLabelDy; QLabel* TextLabelDz; - QtxDblSpinBox* SpinBox_Dx; - QtxDblSpinBox* SpinBox_Dy; - QtxDblSpinBox* SpinBox_Dz; + QtxDoubleSpinBox* SpinBox_Dx; + QtxDoubleSpinBox* SpinBox_Dy; + QtxDoubleSpinBox* SpinBox_Dz; QPushButton* invertButton; QComboBox* DirectionCB; diff --git a/src/SVTK/Makefile.am b/src/SVTK/Makefile.am index fb2ef1387..a00f2eb9e 100755 --- a/src/SVTK/Makefile.am +++ b/src/SVTK/Makefile.am @@ -108,7 +108,6 @@ libSVTK_la_CPPFLAGS= \ $(QT_INCLUDES) \ $(CAS_CPPFLAGS) \ $(VTK_INCLUDES) \ - $(QWT_INCLUDES) \ $(BOOST_CPPFLAGS) \ -I$(srcdir)/../Qtx -I$(srcdir)/../SUIT -I$(srcdir)/../STD \ -I$(srcdir)/../CAM -I$(srcdir)/../OBJECT -I$(srcdir)/../Prs \ @@ -117,7 +116,6 @@ libSVTK_la_CPPFLAGS= \ libSVTK_la_LDFLAGS= \ $(QT_MT_LIBS) \ $(OCC_LIBS) \ - $(QWT_LIBS) \ $(VTK_LIBS) libSVTK_la_LIBADD= ../Qtx/libqtx.la ../SUIT/libsuit.la ../STD/libstd.la \ diff --git a/src/SVTK/SALOME_Actor.cxx b/src/SVTK/SALOME_Actor.cxx index b9597c30c..7f17c2708 100644 --- a/src/SVTK/SALOME_Actor.cxx +++ b/src/SVTK/SALOME_Actor.cxx @@ -33,6 +33,7 @@ #include "SALOME_Actor.h" +#include "SALOME_InteractiveObject.hxx" #include "VTKViewer_Transform.h" #include "VTKViewer_TransformFilter.h" diff --git a/src/SVTK/SALOME_Actor.h b/src/SVTK/SALOME_Actor.h index a44acc9fd..db4e2e56e 100644 --- a/src/SVTK/SALOME_Actor.h +++ b/src/SVTK/SALOME_Actor.h @@ -33,7 +33,7 @@ #include "SVTK_Selector.h" #include "SVTK.h" -#include "SALOME_InteractiveObject.hxx" +class Handle(SALOME_InteractiveObject); // undefining min and max because CASCADE's defines them and // it clashes with std::min(), std::max() diff --git a/src/SVTK/SVTK.pro b/src/SVTK/SVTK.pro new file mode 100644 index 000000000..0e155b631 --- /dev/null +++ b/src/SVTK/SVTK.pro @@ -0,0 +1,93 @@ +TEMPLATE = lib +TARGET = SVTK +DESTDIR = ../../lib +MOC_DIR = ../../moc +OBJECTS_DIR = ../../obj/$$TARGET + +VTKHOME = $$(VTKHOME) +VTK_INCLUDES = $${VTKHOME}/include/vtk + +VTK_LIBS = -L$${VTKHOME}/lib/vtk -L$${VTKHOME}/lib/vtk/python -lvtkCommon -lvtkGraphics -lvtkImaging -lvtkFiltering -lvtkIO -lvtkRendering -lvtkHybrid -lvtkParallel -lvtkWidgets -lGL -L/usr/X11R6/lib -lGLU -L/usr/X11R6/lib -lX11 -lXt + +CASROOT = $$(CASROOT) +CAS_CPPFLAGS = $${CASROOT}/inc + +BOOST_CPPFLAGS = $$(BOOSTDIR)/include + +OCC_LIBS = + +INCLUDEPATH += ../../include $${CAS_CPPFLAGS} $${VTK_INCLUDES} $${BOOST_CPPFLAGS} ../Qtx ../SUIT ../STD ../CAM ../OBJECT ../Prs ../VTKViewer +LIBS += -L../../lib -lqtx -lsuit -lstd -lCAM -lSalomeObject -lSalomePrs -lVTKViewer $${OCC_LIBS} $${VTK_LIBS} + +CONFIG -= debug release debug_and_release +CONFIG += qt thread debug dll shared + +win32:DEFINES += WIN32 +DEFINES += SVTK_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 = SVTK.h +HEADERS += SVTK_Prs.h +HEADERS += SVTK_Actor.h +HEADERS += SALOME_Actor.h +HEADERS += SVTK_RectPicker.h +HEADERS += SVTK_DeviceActor.h +HEADERS += SVTK_DialogBase.h +HEADERS += SVTK_FontWidget.h +HEADERS += SVTK_CubeAxesActor2D.h +HEADERS += SVTK_Functor.h +HEADERS += SVTK_MainWindow.h +HEADERS += SVTK_View.h +HEADERS += SVTK_ViewManager.h +HEADERS += SVTK_ViewModel.h +HEADERS += SVTK_ViewWindow.h +HEADERS += SVTK_Renderer.h +HEADERS += SVTK_InteractorStyle.h +HEADERS += SVTK_RenderWindowInteractor.h +HEADERS += SVTK_GenericRenderWindowInteractor.h +HEADERS += SVTK_Selector.h +HEADERS += SVTK_Selection.h +HEADERS += SVTK_SelectionEvent.h +HEADERS += SVTK_SpaceMouse.h +HEADERS += SVTK_Event.h +HEADERS += SVTK_ViewModelBase.h +HEADERS += SVTK_SetRotationPointDlg.h +HEADERS += SVTK_Extension.h + +SOURCES = SVTK_Prs.cxx +SOURCES += SVTK_Actor.cxx +SOURCES += SALOME_Actor.cxx +SOURCES += SVTK_RectPicker.cxx +SOURCES += SVTK_DeviceActor.cxx +SOURCES += SVTK_CubeAxesActor2D.cxx +SOURCES += SVTK_NonIsometricDlg.cxx +SOURCES += SVTK_UpdateRateDlg.cxx +SOURCES += SVTK_CubeAxesDlg.cxx +SOURCES += SVTK_DialogBase.cxx +SOURCES += SVTK_FontWidget.cxx +SOURCES += SVTK_Trihedron.cxx +SOURCES += SVTK_MainWindow.cxx +SOURCES += SVTK_View.cxx +SOURCES += SVTK_ViewManager.cxx +SOURCES += SVTK_ViewModel.cxx +SOURCES += SVTK_Renderer.cxx +SOURCES += SVTK_ViewWindow.cxx +SOURCES += SVTK_InteractorStyle.cxx +SOURCES += SVTK_RenderWindowInteractor.cxx +SOURCES += SVTK_GenericRenderWindowInteractor.cxx +SOURCES += SVTK_SpaceMouse.cxx +SOURCES += SVTK_Selector.cxx +SOURCES += SVTK_SetRotationPointDlg.cxx +SOURCES += SVTK_Extension.cxx + +TRANSLATIONS = resources/SVTK_images.ts \ + resources/SVTK_msg_en.ts + +ICONS = resources/*.png + +includes.files = $$HEADERS +includes.path = ../../include + +resources.files = $$ICONS resources/*.qm +resources.path = ../../resources + +INSTALLS += includes resources diff --git a/src/SVTK/SVTK_Actor.cxx b/src/SVTK/SVTK_Actor.cxx index 1d32a1c2b..8ccb82a8b 100644 --- a/src/SVTK/SVTK_Actor.cxx +++ b/src/SVTK/SVTK_Actor.cxx @@ -20,6 +20,8 @@ #include "SVTK_Actor.h" #include "SALOME_Actor.h" +#include "SALOME_InteractiveObject.hxx" + // VTK Includes #include #include diff --git a/src/SVTK/SVTK_CubeAxesDlg.cxx b/src/SVTK/SVTK_CubeAxesDlg.cxx index 94e4af88f..a69b9a388 100644 --- a/src/SVTK/SVTK_CubeAxesDlg.cxx +++ b/src/SVTK/SVTK_CubeAxesDlg.cxx @@ -35,16 +35,14 @@ #include "QtxAction.h" #include "QtxIntSpinBox.h" -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include +#include +#include +#include +#include +#include +#include +#include +#include #include #include @@ -60,64 +58,100 @@ SVTK_AxisWidget::SVTK_AxisWidget (QWidget* theParent) : QFrame(theParent) { - QValueList< QLabel* > aLabels; + QList< QLabel* > aLabels; // "Name" grp - myNameGrp = new QGroupBox(3, Qt::Vertical, tr("AXIS_NAME"), this); + myNameGrp = new QGroupBox(tr("AXIS_NAME"), this); + QVBoxLayout* aVBox = new QVBoxLayout; + myIsNameVisible = new QCheckBox(tr("IS_VISIBLE"), myNameGrp); + aVBox->addWidget(myIsNameVisible); - QHBox* aHBox = new QHBox(myNameGrp); + QHBoxLayout* aHBox = new QHBoxLayout(myNameGrp); aHBox->setSpacing(5); - QLabel* aLabel = new QLabel(tr("NAME"), aHBox); - myAxisName = new QLineEdit(aHBox); + QLabel* aLabel = new QLabel(tr("NAME")); + aHBox->addWidget(aLabel); + myAxisName = new QLineEdit; + aHBox->addWidget(myAxisName); aLabels.append(aLabel); + aVBox->addLayout(aHBox); - aHBox = new QHBox(myNameGrp); + aHBox = new QHBoxLayout(myNameGrp); aHBox->setSpacing(5); - aLabel = new QLabel(tr("FONT"), aHBox); - myNameFont = new SVTK_FontWidget(aHBox); + aLabel = new QLabel(tr("FONT")); + aHBox->addWidget(aLabel); + myNameFont = new SVTK_FontWidget(myNameGrp); + aHBox->addWidget(myNameFont); aLabels.append(aLabel); + aVBox->addLayout(aHBox); + myNameGrp->setLayout(aVBox); // "Labels" grp - myLabelsGrp = new QGroupBox(4, Qt::Vertical, tr("LABELS"), this); + myLabelsGrp = new QGroupBox(tr("LABELS"), this); + aVBox = new QVBoxLayout; + myIsLabelsVisible = new QCheckBox(tr("IS_VISIBLE"), myLabelsGrp); + aVBox->addWidget(myIsLabelsVisible); - aHBox = new QHBox(myLabelsGrp); + aHBox = new QHBoxLayout(myLabelsGrp); aHBox->setSpacing(5); - aLabel = new QLabel(tr("NUMBER"), aHBox); - myLabelNumber = new QtxIntSpinBox(0,25,1,aHBox,"SpinBoxLabelNumber"); + aLabel = new QLabel(tr("NUMBER")); + aHBox->addWidget(aLabel); + myLabelNumber = new QtxIntSpinBox(0,25,1,myLabelsGrp); + myLabelNumber->setObjectName("SpinBoxLabelNumber"); + aHBox->addWidget(myLabelNumber); aLabels.append(aLabel); + aVBox->addLayout(aHBox); - aHBox = new QHBox(myLabelsGrp); + aHBox = new QHBoxLayout(myLabelsGrp); aHBox->setSpacing(5); - aLabel = new QLabel(tr("OFFSET"), aHBox); - myLabelOffset = new QtxIntSpinBox(0,100,1,aHBox,"SpinBoxLabellOffset"); + aLabel = new QLabel(tr("OFFSET")); + aHBox->addWidget(aLabel); + myLabelOffset = new QtxIntSpinBox(0,100,1,myLabelsGrp); + myLabelOffset->setObjectName("SpinBoxLabellOffset"); + aHBox->addWidget(myLabelOffset); aLabels.append(aLabel); + aVBox->addLayout(aHBox); - aHBox = new QHBox(myLabelsGrp); + aHBox = new QHBoxLayout(myLabelsGrp); aHBox->setSpacing(5); - aLabel = new QLabel(tr("FONT"), aHBox); - myLabelsFont = new SVTK_FontWidget(aHBox); + aLabel = new QLabel(tr("FONT")); + aHBox->addWidget(aLabel); + myLabelsFont = new SVTK_FontWidget(myLabelsGrp); + aHBox->addWidget(myLabelsFont); aLabels.append(aLabel); + aVBox->addLayout(aHBox); + + myLabelsGrp->setLayout(aVBox); // "Tick marks" grp - myTicksGrp = new QGroupBox(2, Qt::Vertical, tr("TICK_MARKS"), this); + myTicksGrp = new QGroupBox(tr("TICK_MARKS"), this); + aVBox = new QVBoxLayout; + myIsTicksVisible = new QCheckBox(tr("IS_VISIBLE"), myTicksGrp); + aVBox->addWidget(myIsTicksVisible); - aHBox = new QHBox(myTicksGrp); + aHBox = new QHBoxLayout(myTicksGrp); aHBox->setSpacing(5); - aLabel = new QLabel(tr("LENGTH"), aHBox); - myTickLength = new QtxIntSpinBox(0,100,1,aHBox,"SpinBoxTickLength"); - + aLabel = new QLabel(tr("LENGTH")); + aHBox->addWidget(aLabel); + myTickLength = new QtxIntSpinBox(0,100,1,myTicksGrp); + myTickLength->setObjectName("SpinBoxTickLength"); + aHBox->addWidget(myTickLength); aLabels.append(aLabel); + aVBox->addLayout(aHBox); + + myTicksGrp->setLayout(aVBox); // Layout - QVBoxLayout* aLay = new QVBoxLayout(this, 0, 5); + QVBoxLayout* aLay = new QVBoxLayout(this); + aLay->setMargin(0); + aLay->setSpacing(5); aLay->addWidget(myNameGrp); aLay->addWidget(myLabelsGrp); aLay->addWidget(myTicksGrp); @@ -129,10 +163,10 @@ SVTK_AxisWidget::SVTK_AxisWidget (QWidget* theParent) updateControlState(); // Adjust label widths - QValueList< QLabel* >::iterator anIter; + QList< QLabel* >::iterator anIter; int aMaxWidth = 0; for (anIter = aLabels.begin(); anIter != aLabels.end(); anIter++) - aMaxWidth = QMAX(aMaxWidth, (*anIter)->sizeHint().width()); + aMaxWidth = qMax(aMaxWidth, (*anIter)->sizeHint().width()); for (anIter = aLabels.begin(); anIter != aLabels.end(); anIter++) (*anIter)->setFixedWidth(aMaxWidth); @@ -158,11 +192,14 @@ void SVTK_AxisWidget::updateControlState() void SVTK_AxisWidget::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()) - if (anObj !=0 && anObj->inherits("QHBox")) - ((QHBox*)anObj)->setEnabled(theState); + for(int i = 0; i < aChildren.size(); i++) + { + anObj = aChildren.at(i); + if (anObj !=0 && anObj->inherits("QHBoxLayout")) + ((QHBoxLayout*)anObj)->setEnabled(theState); + } } void SVTK_AxisWidget::onLabelsChecked() @@ -278,7 +315,7 @@ bool SVTK_AxisWidget::Apply(vtkAxisActor2D* theActor) // Name theActor->SetTitleVisibility(myIsNameVisible->isChecked() ? 1 : 0); - theActor->SetTitle(myAxisName->text().latin1()); + theActor->SetTitle(myAxisName->text().toLatin1()); QColor aTitleColor(255, 255, 255); int aTitleFontFamily = VTK_ARIAL; @@ -360,9 +397,11 @@ SVTK_CubeAxesDlg::SVTK_CubeAxesDlg(QtxAction* theAction, theName), myMainWindow(theParent) { - setCaption(tr("CAPTION")); + setWindowTitle(tr("CAPTION")); - QVBoxLayout* aLay = new QVBoxLayout(this, 5, 5); + QVBoxLayout* aLay = new QVBoxLayout(this); + aLay->setMargin(5); + aLay->setSpacing(5); aLay->addWidget(createMainFrame(this)); aLay->addWidget(createButtonFrame(this)); @@ -387,11 +426,13 @@ QWidget* SVTK_CubeAxesDlg::createMainFrame(QWidget* theParent) myTabWg->addTab(myAxes[ 1 ], tr("Y_AXIS")); myTabWg->addTab(myAxes[ 2 ], tr("Z_AXIS")); - myTabWg->setMargin(5); + myTabWg->setContentsMargins(5,5,5,5); myIsVisible = new QCheckBox(tr("IS_VISIBLE"), aFrame); - QVBoxLayout* aLay = new QVBoxLayout(aFrame, 0, 5); + QVBoxLayout* aLay = new QVBoxLayout(aFrame); + aLay->setMargin(0); + aLay->setSpacing(5); aLay->addWidget(myTabWg); aLay->addWidget(myIsVisible); @@ -412,7 +453,9 @@ QWidget* SVTK_CubeAxesDlg::createButtonFrame(QWidget* theParent) QSpacerItem* aSpacer = new QSpacerItem(0, 0, QSizePolicy::Expanding, QSizePolicy::Minimum); - QHBoxLayout* aLay = new QHBoxLayout(aFrame, 5, 5); + QHBoxLayout* aLay = new QHBoxLayout(aFrame); + aLay->setMargin(5); + aLay->setSpacing(5); aLay->addWidget(myOkBtn); aLay->addWidget(myApplyBtn); diff --git a/src/SVTK/SVTK_CubeAxesDlg.h b/src/SVTK/SVTK_CubeAxesDlg.h index c4277db69..1428dad9d 100644 --- a/src/SVTK/SVTK_CubeAxesDlg.h +++ b/src/SVTK/SVTK_CubeAxesDlg.h @@ -29,10 +29,9 @@ #include "SVTK_DialogBase.h" -#include +#include class QWidget; -class QFrame; class QPushButton; class QTabWidget; class QCheckBox; diff --git a/src/SVTK/SVTK_DialogBase.cxx b/src/SVTK/SVTK_DialogBase.cxx index 9cf3432bf..7aeedd172 100644 --- a/src/SVTK/SVTK_DialogBase.cxx +++ b/src/SVTK/SVTK_DialogBase.cxx @@ -38,13 +38,14 @@ SVTK_DialogBase QWidget* theParent, const char* theName, bool theModal, - WFlags theWFalgs): + Qt::WindowFlags theWFalgs): QDialog(theParent, - theName, - theModal, - theWFalgs | WStyle_Customize | WStyle_NormalBorder | WStyle_Title | WStyle_SysMenu), + theWFalgs | Qt::WindowTitleHint | Qt::WindowSystemMenuHint), myAction(theAction) { + setObjectName(theName); + setModal(theModal); + connect(theParent, SIGNAL(Show( QShowEvent * )), this, SLOT(onParentShow())); connect(theParent, SIGNAL(Hide( QHideEvent * )), this, SLOT(onParentHide())); } @@ -62,7 +63,7 @@ void SVTK_DialogBase ::onParentShow() { - if(myAction->isOn()) + if(myAction->isChecked()) show(); else hide(); @@ -79,6 +80,6 @@ void SVTK_DialogBase ::done( int r ) { - myAction->setOn( false ); + myAction->setChecked( false ); QDialog::done( r ); } diff --git a/src/SVTK/SVTK_DialogBase.h b/src/SVTK/SVTK_DialogBase.h index 5c0b87eb5..8d3ae0f0d 100644 --- a/src/SVTK/SVTK_DialogBase.h +++ b/src/SVTK/SVTK_DialogBase.h @@ -31,7 +31,7 @@ #include "SVTK.h" -#include +#include class QtxAction; @@ -44,7 +44,7 @@ public: QWidget* theParent, const char* theName = "", bool theModal = FALSE, - WFlags theWFalgs = 0); + Qt::WindowFlags theWFalgs = 0); ~SVTK_DialogBase(); diff --git a/src/SVTK/SVTK_FontWidget.cxx b/src/SVTK/SVTK_FontWidget.cxx index 4269b5b6b..b32f7ab0c 100644 --- a/src/SVTK/SVTK_FontWidget.cxx +++ b/src/SVTK/SVTK_FontWidget.cxx @@ -27,10 +27,11 @@ #include "SVTK_FontWidget.h" -#include -#include -#include -#include +#include +#include +#include +#include +#include #include @@ -43,21 +44,29 @@ Constructor */ SVTK_FontWidget::SVTK_FontWidget( QWidget* theParent ) -: QHBox( theParent ) +: QWidget( theParent ) { - setSpacing( 5 ); myColorBtn = new QToolButton( this ); myColorBtn->setMinimumWidth( 20 ); myFamily = new QComboBox( this ); - myFamily->insertItem( tr( "ARIAL" ) ); - myFamily->insertItem( tr( "COURIER" ) ); - myFamily->insertItem( tr( "TIMES" ) ); + myFamily->insertItem( myFamily->count(), tr( "ARIAL" ) ); + myFamily->insertItem( myFamily->count(), tr( "COURIER" ) ); + myFamily->insertItem( myFamily->count(), tr( "TIMES" ) ); myBold = new QCheckBox( tr( "BOLD" ), this ); myItalic = new QCheckBox( tr( "ITALIC" ), this ); myShadow = new QCheckBox( tr( "SHADOW" ), this ); + QHBoxLayout* aHBLayout = new QHBoxLayout; + aHBLayout->setSpacing( 5 ); + aHBLayout->addWidget(myColorBtn); + aHBLayout->addWidget(myFamily); + aHBLayout->addWidget(myBold); + aHBLayout->addWidget(myItalic); + aHBLayout->addWidget(myShadow); + this->setLayout(aHBLayout); + connect( myColorBtn, SIGNAL( clicked() ), SLOT( onColor() ) ); } @@ -70,12 +79,14 @@ SVTK_FontWidget::~SVTK_FontWidget() void SVTK_FontWidget::SetColor( const QColor& theColor ) { - myColorBtn->setPaletteBackgroundColor( theColor ); + QPalette palette; + palette.setColor(myColorBtn->backgroundRole(), theColor); + myColorBtn->setPalette(palette); } QColor SVTK_FontWidget::GetColor() const { - return myColorBtn->paletteBackgroundColor(); + return myColorBtn->palette().color( myColorBtn->backgroundRole() ); } void SVTK_FontWidget::onColor() @@ -94,11 +105,11 @@ void SVTK_FontWidget::SetData( const QColor& theColor, SetColor( theColor ); if ( theFamily == VTK_ARIAL ) - myFamily->setCurrentItem( 0 ); + myFamily->setCurrentIndex( 0 ); else if ( theFamily == VTK_COURIER ) - myFamily->setCurrentItem( 1 ); + myFamily->setCurrentIndex( 1 ); else - myFamily->setCurrentItem( 2 ); + myFamily->setCurrentIndex( 2 ); myBold->setChecked( theBold ); myItalic->setChecked( theItalic ); @@ -113,7 +124,7 @@ void SVTK_FontWidget::GetData( QColor& theColor, { theColor = GetColor(); - int anItem =myFamily->currentItem(); + int anItem =myFamily->currentIndex(); if ( anItem == 0 ) theFamily = VTK_ARIAL; else if ( anItem == 1 ) diff --git a/src/SVTK/SVTK_FontWidget.h b/src/SVTK/SVTK_FontWidget.h index 953072a94..3c10e1a2c 100644 --- a/src/SVTK/SVTK_FontWidget.h +++ b/src/SVTK/SVTK_FontWidget.h @@ -29,7 +29,7 @@ #include "SVTK.h" -#include +#include class QToolButton; class QComboBox; @@ -41,7 +41,7 @@ class QColor; * Class : SVTK_FontWidget * Description : Dialog for specifynig font */ -class SVTK_EXPORT SVTK_FontWidget : public QHBox +class SVTK_EXPORT SVTK_FontWidget : public QWidget { Q_OBJECT diff --git a/src/SVTK/SVTK_GenericRenderWindowInteractor.cxx b/src/SVTK/SVTK_GenericRenderWindowInteractor.cxx index ecb406b1b..3dffbae50 100644 --- a/src/SVTK/SVTK_GenericRenderWindowInteractor.cxx +++ b/src/SVTK/SVTK_GenericRenderWindowInteractor.cxx @@ -32,7 +32,7 @@ #include #include -#include +#include using namespace std; @@ -80,7 +80,8 @@ QVTK_GenericRenderWindowInteractor // Start a one-shot timer for ms. // static int DELAY = 1; - myTimer->start(DELAY,TRUE); + myTimer->setSingleShot(TRUE); + myTimer->start(DELAY); return 1; } diff --git a/src/SVTK/SVTK_GenericRenderWindowInteractor.h b/src/SVTK/SVTK_GenericRenderWindowInteractor.h index ff5b6cb71..9bb7cbfcd 100644 --- a/src/SVTK/SVTK_GenericRenderWindowInteractor.h +++ b/src/SVTK/SVTK_GenericRenderWindowInteractor.h @@ -31,7 +31,7 @@ #include "SVTK.h" -#include +#include #include #include @@ -39,7 +39,7 @@ class QTimer; class QWidget; class SVTK_Selector; -class SVTK_Renderer; +//class SVTK_Renderer; #ifdef WIN32 #pragma warning ( disable:4251 ) diff --git a/src/SVTK/SVTK_InteractorStyle.cxx b/src/SVTK/SVTK_InteractorStyle.cxx index bfaac1f2b..38f2de0fa 100644 --- a/src/SVTK/SVTK_InteractorStyle.cxx +++ b/src/SVTK/SVTK_InteractorStyle.cxx @@ -58,9 +58,9 @@ #include #include -#include -#include -#include +#include +#include +#include #include #include @@ -115,7 +115,8 @@ SVTK_InteractorStyle myLastPreHighlitedActor(NULL), myControllerIncrement(SVTK_ControllerIncrement::New()), myControllerOnKeyDown(SVTK_ControllerOnKeyDown::New()), - myHighlightRotationPointActor(SVTK_Actor::New()) + myHighlightRotationPointActor(SVTK_Actor::New()), + myRectBand(0) { myPicker->Delete(); myPointPicker->Delete(); @@ -161,6 +162,7 @@ SVTK_InteractorStyle SVTK_InteractorStyle ::~SVTK_InteractorStyle() { + endDrawRect(); } /*! @@ -1033,10 +1035,7 @@ SVTK_InteractorStyle case VTK_INTERACTOR_STYLE_CAMERA_SELECT: case VTK_INTERACTOR_STYLE_CAMERA_FIT: { - QPainter p(GetRenderWidget()); - p.setPen(Qt::lightGray); - p.setRasterOp(Qt::XorROP); - p.drawRect(QRect(myPoint, myOtherPoint)); + drawRect(); break; } case VTK_INTERACTOR_STYLE_CAMERA_ZOOM: @@ -1069,12 +1068,9 @@ SVTK_InteractorStyle case VTK_INTERACTOR_STYLE_CAMERA_SELECT: case VTK_INTERACTOR_STYLE_CAMERA_FIT: { - QPainter aPainter(GetRenderWidget()); - aPainter.setPen(Qt::lightGray); - aPainter.setRasterOp(Qt::XorROP); + endDrawRect(); QRect aRect(myPoint, myOtherPoint); - aPainter.drawRect(aRect); - aRect = aRect.normalize(); + aRect = aRect.normalized(); if (State == VTK_INTERACTOR_STYLE_CAMERA_FIT) { // making fit rect opeation @@ -1210,12 +1206,7 @@ SVTK_InteractorStyle } case VTK_INTERACTOR_STYLE_CAMERA_FIT: { - QPainter p(GetRenderWidget()); - p.setPen(Qt::lightGray); - p.setRasterOp(Qt::XorROP); - p.drawRect(QRect(myPoint, myOtherPoint)); - myOtherPoint = mousePos; - p.drawRect(QRect(myPoint, myOtherPoint)); + drawRect(); break; } } @@ -1496,6 +1487,35 @@ SVTK_InteractorStyle printf( "\n--DominantCombinedSwitch() NOT IMPLEMENTED--\n" ); } +/*! + Draws rectangle by starting and current points +*/ +void +SVTK_InteractorStyle +::drawRect() +{ + if ( !myRectBand ) + myRectBand = new QRubberBand( QRubberBand::Rectangle, GetRenderWidget() ); + myRectBand->hide(); + + QRect aRect(myPoint, myOtherPoint); + myRectBand->setGeometry( aRect ); + myRectBand->setVisible( aRect.isValid() ); +} + +/*! + \brief Delete rubber band on the end on the dragging operation. +*/ +void +SVTK_InteractorStyle +::endDrawRect() +{ + if ( myRectBand ) myRectBand->hide(); + + delete myRectBand; + myRectBand = 0; +} + /*! Main process event method (reimplemented from #vtkInteractorStyle) */ diff --git a/src/SVTK/SVTK_InteractorStyle.h b/src/SVTK/SVTK_InteractorStyle.h index dec8c0a0d..8d355d79e 100644 --- a/src/SVTK/SVTK_InteractorStyle.h +++ b/src/SVTK/SVTK_InteractorStyle.h @@ -38,8 +38,7 @@ #include #include -#include -#include +#include #include @@ -103,7 +102,6 @@ class SVTK_EXPORT SVTK_ControllerOnKeyDown : public vtkObject{ void operator=(const SVTK_ControllerOnKeyDown&); //Not implemented }; -class vtkCell; class vtkPicker; class vtkPointPicker; @@ -113,6 +111,8 @@ class SVTK_Selector; class SVTK_GenericRenderWindowInteractor; class SVTK_Actor; +class QRubberBand; + #define VTK_INTERACTOR_STYLE_CAMERA_NONE 0 #define VTK_INTERACTOR_STYLE_CAMERA_ROTATE 1 #define VTK_INTERACTOR_STYLE_CAMERA_PAN 2 @@ -297,6 +297,9 @@ class SVTK_EXPORT SVTK_InteractorStyle: public vtkInteractorStyle void DominantCombinedSwitch(); + void drawRect(); + void endDrawRect(); + protected: QCursor myDefCursor; QCursor myPanCursor; @@ -343,6 +346,8 @@ class SVTK_EXPORT SVTK_InteractorStyle: public vtkInteractorStyle vtkFloatingPointType myBBCenter[3]; bool myBBFirstCheck; + + QRubberBand* myRectBand; //!< selection rectangle rubber band }; #ifdef WIN32 diff --git a/src/SVTK/SVTK_MainWindow.cxx b/src/SVTK/SVTK_MainWindow.cxx index 045a05453..1c0b5e9f5 100644 --- a/src/SVTK/SVTK_MainWindow.cxx +++ b/src/SVTK/SVTK_MainWindow.cxx @@ -52,7 +52,8 @@ #include "SVTK_Selector.h" -#include +#include +#include /*! Constructor @@ -62,12 +63,14 @@ SVTK_MainWindow const char* theName, SUIT_ResourceMgr* theResourceMgr, SUIT_ViewWindow* theViewWindow) : - QMainWindow(theParent,theName,0), + QMainWindow(theParent,0), myViewWindow(theViewWindow) { + setObjectName(theName); + 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(theResourceMgr); createToolBar(); @@ -84,9 +87,9 @@ SVTK_MainWindow SetEventDispatcher(myInteractor->GetDevice()); setCentralWidget(myInteractor); - myInteractor->setBackgroundMode(Qt::NoBackground); + myInteractor->setBackgroundRole( QPalette::NoRole );//NoBackground - myInteractor->setFocusPolicy(StrongFocus); + myInteractor->setFocusPolicy(Qt::StrongFocus); myInteractor->setFocus(); setFocusProxy(myInteractor); @@ -474,7 +477,7 @@ SVTK_MainWindow theResourceMgr->loadPixmap( "VTKViewer", tr( "ICON_VTKVIEWER_VIEW_ROTATION_POINT" ) ), tr( "MNU_CHANGINGROTATIONPOINT_VIEW" ), 0, this); anAction->setStatusTip(tr("DSC_CHANGINGROTATIONPOINT_VIEW")); - anAction->setToggleAction(true); + anAction->setCheckable(true); connect(anAction, SIGNAL(toggled(bool)), this, SLOT(onChangeRotationPoint(bool))); myActionsMap[ ChangeRotationPointId ] = anAction; @@ -550,7 +553,7 @@ SVTK_MainWindow theResourceMgr->loadPixmap( "VTKViewer", tr( "ICON_SVTK_SCALING" ) ), tr( "MNU_SVTK_SCALING" ), 0, this); anAction->setStatusTip(tr("DSC_SVTK_SCALING")); - anAction->setToggleAction(true); + anAction->setCheckable(true); connect(anAction, SIGNAL(toggled(bool)), this, SLOT(onNonIsometric(bool))); myActionsMap[ NonIsometric ] = anAction; @@ -559,7 +562,7 @@ SVTK_MainWindow theResourceMgr->loadPixmap( "VTKViewer", tr( "ICON_GRADUATED_AXES" ) ), tr( "MNU_SVTK_GRADUATED_AXES" ), 0, this); anAction->setStatusTip(tr("DSC_SVTK_GRADUATED_AXES")); - anAction->setToggleAction(true); + anAction->setCheckable(true); connect(anAction, SIGNAL(toggled(bool)), this, SLOT(onGraduatedAxes(bool))); myActionsMap[ GraduatedAxes ] = anAction; @@ -568,7 +571,7 @@ SVTK_MainWindow theResourceMgr->loadPixmap( "VTKViewer", tr( "ICON_UPDATE_RATE" ) ), tr( "MNU_SVTK_UPDATE_RATE" ), 0, this); anAction->setStatusTip(tr("DSC_SVTK_UPDATE_RATE")); - anAction->setToggleAction(true); + anAction->setCheckable(true); connect(anAction, SIGNAL(toggled(bool)), this, SLOT(onUpdateRate(bool))); myActionsMap[ UpdateRate ] = anAction; } @@ -896,5 +899,5 @@ SVTK_MainWindow ::dumpView() { QPixmap px = QPixmap::grabWindow( GetInteractor()->winId() ); - return px.convertToImage(); + return px.toImage(); } diff --git a/src/SVTK/SVTK_MainWindow.h b/src/SVTK/SVTK_MainWindow.h index 1be95b652..77157c02c 100644 --- a/src/SVTK/SVTK_MainWindow.h +++ b/src/SVTK/SVTK_MainWindow.h @@ -28,7 +28,8 @@ #include -#include +#include +#include class QtxAction; @@ -49,7 +50,6 @@ class SVTK_CubeAxesDlg; class SVTK_SetRotationPointDlg; class VTKViewer_Trihedron; -class VTKViewer_Transform; class VTKViewer_Actor; class SVTK_Renderer; diff --git a/src/SVTK/SVTK_NonIsometricDlg.cxx b/src/SVTK/SVTK_NonIsometricDlg.cxx index 7b99f2c9c..a3a2044ae 100644 --- a/src/SVTK/SVTK_NonIsometricDlg.cxx +++ b/src/SVTK/SVTK_NonIsometricDlg.cxx @@ -30,13 +30,13 @@ #include "SVTK_MainWindow.h" #include "SVTK_Renderer.h" -#include "QtxDblSpinBox.h" +#include "QtxDoubleSpinBox.h" #include "QtxAction.h" -#include -#include -#include -#include +#include +#include +#include +#include using namespace std; @@ -52,7 +52,7 @@ SVTK_NonIsometricDlg theName), m_MainWindow(theParent) { - setCaption(tr("DLG_TITLE")); + setWindowTitle(tr("DLG_TITLE")); setSizeGripEnabled(TRUE); // Create layout for this dialog @@ -61,34 +61,39 @@ SVTK_NonIsometricDlg layoutDlg->setMargin(11); // Create croup box with grid layout - QGroupBox* aGroupBox = new QGroupBox(this, "GroupBox"); + QGroupBox* aGroupBox = new QGroupBox(this); + aGroupBox->setObjectName("GroupBox"); QHBoxLayout* aHBoxLayout = new QHBoxLayout(aGroupBox); aHBoxLayout->setMargin(11); aHBoxLayout->setSpacing(6); // "X" scaling - QLabel* TextLabelX = new QLabel (tr("LBL_X"), aGroupBox, "TextLabelX"); + QLabel* TextLabelX = new QLabel (tr("LBL_X"), aGroupBox); + TextLabelX->setObjectName("TextLabelX"); TextLabelX->setFixedWidth(15); - m_sbXcoeff = new QtxDblSpinBox(-VTK_LARGE_FLOAT, VTK_LARGE_FLOAT, 0.1, aGroupBox); + m_sbXcoeff = new QtxDoubleSpinBox(-VTK_LARGE_FLOAT, VTK_LARGE_FLOAT, 0.1, aGroupBox); m_sbXcoeff->setMinimumWidth(80); m_sbXcoeff->setValue(1.0); // "Y" scaling - QLabel* TextLabelY = new QLabel (tr("LBL_Y"), aGroupBox, "TextLabelY"); + QLabel* TextLabelY = new QLabel (tr("LBL_Y"), aGroupBox); + TextLabelY->setObjectName("TextLabelY"); TextLabelY->setFixedWidth(15); - m_sbYcoeff = new QtxDblSpinBox(-VTK_LARGE_FLOAT, VTK_LARGE_FLOAT, 0.1, aGroupBox); + m_sbYcoeff = new QtxDoubleSpinBox(-VTK_LARGE_FLOAT, VTK_LARGE_FLOAT, 0.1, aGroupBox); m_sbYcoeff->setMinimumWidth(80); m_sbYcoeff->setValue(1.0); // "Z" scaling - QLabel* TextLabelZ = new QLabel (tr("LBL_Z"), aGroupBox, "TextLabelZ"); + QLabel* TextLabelZ = new QLabel (tr("LBL_Z"), aGroupBox); + TextLabelZ->setObjectName("TextLabelZ"); TextLabelZ->setFixedWidth(15); - m_sbZcoeff = new QtxDblSpinBox(-VTK_LARGE_FLOAT, VTK_LARGE_FLOAT, 0.1, aGroupBox); + m_sbZcoeff = new QtxDoubleSpinBox(-VTK_LARGE_FLOAT, VTK_LARGE_FLOAT, 0.1, aGroupBox); m_sbZcoeff->setMinimumWidth(80); m_sbZcoeff->setValue(1.0); // Create button - m_bReset = new QPushButton(tr("&Reset"), aGroupBox, "m_bReset"); + m_bReset = new QPushButton(tr("&Reset"), aGroupBox); + m_bReset->setObjectName("m_bReset"); // Layout widgets in the group box aHBoxLayout->addWidget(TextLabelX); @@ -106,14 +111,17 @@ SVTK_NonIsometricDlg aHBoxLayout2->setMargin(11); aHBoxLayout2->setSpacing(6); // Create button - QPushButton* m_bOk = new QPushButton(tr("O&K"), aGroupBox2, "m_bOk"); + QPushButton* m_bOk = new QPushButton(tr("O&K"), aGroupBox2); + m_bOk->setObjectName("m_bOk"); m_bOk->setDefault(TRUE); m_bOk->setAutoDefault(TRUE); // Create button - QPushButton* m_bApply = new QPushButton(tr("&Apply"), aGroupBox2, "m_bApply"); + QPushButton* m_bApply = new QPushButton(tr("&Apply"), aGroupBox2); + m_bApply->setObjectName("m_bApply"); m_bApply->setAutoDefault(TRUE); // Create button - QPushButton* m_bCancel = new QPushButton(tr("&Cancel"), aGroupBox2, "m_bCancel"); + QPushButton* m_bCancel = new QPushButton(tr("&Cancel"), aGroupBox2); + m_bCancel->setObjectName("m_bCancel"); m_bCancel->setAutoDefault(TRUE); // Layout buttons diff --git a/src/SVTK/SVTK_NonIsometricDlg.h b/src/SVTK/SVTK_NonIsometricDlg.h index 66be82a39..bcb730d52 100644 --- a/src/SVTK/SVTK_NonIsometricDlg.h +++ b/src/SVTK/SVTK_NonIsometricDlg.h @@ -33,7 +33,7 @@ class SVTK_MainWindow; -class QtxDblSpinBox; +class QtxDoubleSpinBox; class QtxAction; class QPushButton; @@ -55,9 +55,9 @@ public: protected: SVTK_MainWindow *m_MainWindow; - QtxDblSpinBox* m_sbXcoeff; - QtxDblSpinBox* m_sbYcoeff; - QtxDblSpinBox* m_sbZcoeff; + QtxDoubleSpinBox* m_sbXcoeff; + QtxDoubleSpinBox* m_sbYcoeff; + QtxDoubleSpinBox* m_sbZcoeff; QPushButton* m_bReset; protected slots: diff --git a/src/SVTK/SVTK_Prs.cxx b/src/SVTK/SVTK_Prs.cxx index 11e4b20f5..3e017e8f3 100644 --- a/src/SVTK/SVTK_Prs.cxx +++ b/src/SVTK/SVTK_Prs.cxx @@ -27,6 +27,9 @@ // $Header$ #include "SVTK_Prs.h" + +#include + using namespace std; /*! diff --git a/src/SVTK/SVTK_Prs.h b/src/SVTK/SVTK_Prs.h index 218a9f101..7931972d4 100644 --- a/src/SVTK/SVTK_Prs.h +++ b/src/SVTK/SVTK_Prs.h @@ -32,7 +32,8 @@ #include #include "SALOME_Prs.h" -#include +class vtkActorCollection; +class vtkActor; class SVTK_EXPORT SVTK_Prs : public SALOME_VTKPrs { diff --git a/src/SVTK/SVTK_RenderWindowInteractor.cxx b/src/SVTK/SVTK_RenderWindowInteractor.cxx index e473cdd69..a937a7cbd 100644 --- a/src/SVTK/SVTK_RenderWindowInteractor.cxx +++ b/src/SVTK/SVTK_RenderWindowInteractor.cxx @@ -27,13 +27,19 @@ // $Header$ #include "SVTK_RenderWindowInteractor.h" -#include "SVTK_GenericRenderWindowInteractor.h" +//#include "SVTK_GenericRenderWindowInteractor.h" #include "SVTK_InteractorStyle.h" #include "SVTK_Renderer.h" #include "SVTK_Functor.h" #include "SALOME_Actor.h" +// QT Includes +// Put Qt includes before the X11 includes which #define the symbol None +// (see SVTK_SpaceMouse.h) to avoid the compilation error. +#include +#include + #include "SVTK_SpaceMouse.h" #include "SVTK_Event.h" @@ -49,12 +55,6 @@ #include #include -// QT Includes -#include -#include -#include -#include - using namespace std; static bool GENERATE_SUIT_EVENTS = false; @@ -67,16 +67,18 @@ static bool FOCUS_UNDER_MOUSE = false; QVTK_RenderWindowInteractor ::QVTK_RenderWindowInteractor(QWidget* theParent, const char* theName): - QWidget(theParent,theName,Qt::WNoAutoErase), + QWidget(theParent), myRenderWindow(vtkRenderWindow::New()) { + setObjectName(theName); + setMouseTracking(true); myRenderWindow->Delete(); myRenderWindow->DoubleBufferOn(); #ifndef WIN32 - myRenderWindow->SetDisplayId((void*)x11Display()); + myRenderWindow->SetDisplayId((void*)QX11Info::display()); #endif myRenderWindow->SetWindowId((void*)winId()); } @@ -106,7 +108,7 @@ QVTK_RenderWindowInteractor #ifndef WIN32 SVTK_SpaceMouse* aSpaceMouse = SVTK_SpaceMouse::getInstance(); if ( aSpaceMouse && aSpaceMouse->isSpaceMouseOn() ) - aSpaceMouse->close( x11Display() ); + aSpaceMouse->close( QX11Info::display() ); #endif } @@ -240,8 +242,8 @@ QVTK_RenderWindowInteractor { GetDevice()->SetEventInformationFlipY(event->x(), event->y(), - event->state() & ControlButton, - event->state() & ShiftButton); + event->modifiers() & Qt::ControlModifier, + event->modifiers() & Qt::ShiftModifier); GetDevice()->MouseMoveEvent(); } @@ -255,13 +257,13 @@ QVTK_RenderWindowInteractor { GetDevice()->SetEventInformationFlipY(event->x(), event->y(), - event->state() & ControlButton, - event->state() & ShiftButton); - if( event->button() & LeftButton ) + event->modifiers() & Qt::ControlModifier, + event->modifiers() & Qt::ShiftModifier); + if( event->button() & Qt::LeftButton ) GetDevice()->LeftButtonPressEvent(); - else if( event->button() & MidButton ) + else if( event->button() & Qt::MidButton ) GetDevice()->MiddleButtonPressEvent(); - else if( event->button() & RightButton ) + else if( event->button() & Qt::RightButton ) GetDevice()->RightButtonPressEvent(); } @@ -275,14 +277,14 @@ QVTK_RenderWindowInteractor { GetDevice()->SetEventInformationFlipY(event->x(), event->y(), - event->state() & ControlButton, - event->state() & ShiftButton); + event->modifiers() & Qt::ControlModifier, + event->modifiers() & Qt::ShiftModifier); - if( event->button() & LeftButton ) + if( event->button() & Qt::LeftButton ) GetDevice()->LeftButtonReleaseEvent(); - else if( event->button() & MidButton ) + else if( event->button() & Qt::MidButton ) GetDevice()->MiddleButtonReleaseEvent(); - else if( event->button() & RightButton ) + else if( event->button() & Qt::RightButton ) GetDevice()->RightButtonReleaseEvent(); } @@ -303,7 +305,7 @@ void QVTK_RenderWindowInteractor ::wheelEvent( QWheelEvent* event ) { - setActiveWindow(); + activateWindow(); setFocus(); } @@ -315,8 +317,8 @@ void QVTK_RenderWindowInteractor ::keyPressEvent( QKeyEvent* event ) { - GetDevice()->SetKeyEventInformation(event->state() & ControlButton, - event->state() & ShiftButton, + GetDevice()->SetKeyEventInformation(event->modifiers() & Qt::ControlModifier, + event->modifiers() & Qt::ShiftModifier, event->key()); GetDevice()->KeyPressEvent(); GetDevice()->CharEvent(); @@ -329,8 +331,8 @@ void QVTK_RenderWindowInteractor ::keyReleaseEvent( QKeyEvent * event ) { - GetDevice()->SetKeyEventInformation(event->state() & ControlButton, - event->state() & ShiftButton, + GetDevice()->SetKeyEventInformation(event->modifiers() & Qt::ControlModifier, + event->modifiers() & Qt::ShiftModifier, event->key()); GetDevice()->KeyReleaseEvent(); } @@ -344,7 +346,7 @@ QVTK_RenderWindowInteractor ::enterEvent( QEvent* event ) { if(FOCUS_UNDER_MOUSE){ - setActiveWindow(); + activateWindow(); setFocus(); } GetDevice()->EnterEvent(); @@ -378,9 +380,9 @@ QVTK_RenderWindowInteractor { if ( !aSpaceMouse->isSpaceMouseOn() ) // initialize 3D space mouse driver - aSpaceMouse->initialize( x11Display(), winId() ); + aSpaceMouse->initialize( QX11Info::display(), winId() ); else - aSpaceMouse->setWindow( x11Display(), winId() ); + aSpaceMouse->setWindow( QX11Info::display(), winId() ); } #endif } @@ -399,7 +401,7 @@ QVTK_RenderWindowInteractor // unregister set space mouse events receiver SVTK_SpaceMouse* aSpaceMouse = SVTK_SpaceMouse::getInstance(); if ( aSpaceMouse && aSpaceMouse->isSpaceMouseOn() ) - aSpaceMouse->setWindow( x11Display(), 0 ); + aSpaceMouse->setWindow( QX11Info::display(), 0 ); #endif } @@ -430,7 +432,7 @@ QVTK_RenderWindowInteractor if ( aSpaceMouse->isSpaceMouseOn() && xEvent->type == ClientMessage ) { SVTK_SpaceMouse::MoveEvent anEvent; - int type = aSpaceMouse->translateEvent( x11Display(), xEvent, &anEvent, 1.0, 1.0 ); + int type = aSpaceMouse->translateEvent( QX11Info::display(), xEvent, &anEvent, 1.0, 1.0 ); switch ( type ) { case SVTK_SpaceMouse::SpaceMouseMove: @@ -778,6 +780,6 @@ void SVTK_RenderWindowInteractor ::contextMenuEvent( QContextMenuEvent* event ) { - if( !( event->state() & KeyButtonMask ) ) + if( !( event->modifiers() & Qt::KeyboardModifierMask ) ) emit contextMenuRequested( event ); } diff --git a/src/SVTK/SVTK_RenderWindowInteractor.h b/src/SVTK/SVTK_RenderWindowInteractor.h index dd6a52502..965a2a751 100644 --- a/src/SVTK/SVTK_RenderWindowInteractor.h +++ b/src/SVTK/SVTK_RenderWindowInteractor.h @@ -33,7 +33,7 @@ #include "SVTK_Selection.h" #include -#include +#include // undefining min and max because CASCADE's defines them and // it clashes with std::min(), std::max() diff --git a/src/SVTK/SVTK_Selector.cxx b/src/SVTK/SVTK_Selector.cxx index d93bd4b44..86e9bc335 100644 --- a/src/SVTK/SVTK_Selector.cxx +++ b/src/SVTK/SVTK_Selector.cxx @@ -29,6 +29,8 @@ #include "SVTK_SelectorDef.h" +#include "VTKViewer_Filter.h" + #include "SALOME_Actor.h" #include diff --git a/src/SVTK/SVTK_Selector.h b/src/SVTK/SVTK_Selector.h index 380e28b31..17ab9be70 100644 --- a/src/SVTK/SVTK_Selector.h +++ b/src/SVTK/SVTK_Selector.h @@ -32,15 +32,16 @@ #include "SVTK.h" #include "SVTK_Selection.h" #include "SALOME_ListIO.hxx" -#include "VTKViewer_Filter.h" -#include "SALOME_InteractiveObject.hxx" #include #include #include +class Handle(VTKViewer_Filter); + class SALOME_Actor; +class Handle(SALOME_InteractiveObject); //! Define an abstract interface for selection in SVTK package /*! diff --git a/src/SVTK/SVTK_SelectorDef.h b/src/SVTK/SVTK_SelectorDef.h index e20d764ec..6515a187b 100644 --- a/src/SVTK/SVTK_SelectorDef.h +++ b/src/SVTK/SVTK_SelectorDef.h @@ -36,6 +36,8 @@ #include #include +#include "SALOME_InteractiveObject.hxx" + #include "SVTK_Selector.h" class SALOME_Actor; diff --git a/src/SVTK/SVTK_SetRotationPointDlg.cxx b/src/SVTK/SVTK_SetRotationPointDlg.cxx index d98efaa21..50f8f69e8 100755 --- a/src/SVTK/SVTK_SetRotationPointDlg.cxx +++ b/src/SVTK/SVTK_SetRotationPointDlg.cxx @@ -36,16 +36,13 @@ #include "QtxAction.h" -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include +#include +#include +#include +#include +#include +#include +#include #include @@ -66,7 +63,7 @@ SVTK_SetRotationPointDlg myEventCallbackCommand(vtkCallbackCommand::New()), myRWInteractor(theParent->GetInteractor()) { - setCaption(tr("DLG_TITLE")); + setWindowTitle(tr("DLG_TITLE")); setSizeGripEnabled(TRUE); // Create layout for this dialog @@ -75,35 +72,44 @@ SVTK_SetRotationPointDlg 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 = new QPushButton(myGroupBoxSel); myToOrigin->setText(tr("LBL_TOORIGIN")); + vbox->addWidget(myToOrigin); connect(myToOrigin, SIGNAL(clicked()), this, SLOT(onToOrigin())); // Create "Select Point from View" button - mySelectPoint = new QPushButton(myGroupSelButton); + mySelectPoint = new QPushButton(myGroupBoxSel); mySelectPoint->setText(tr("LBL_SELECTPOINT")); - mySelectPoint->setToggleButton(true); + 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)); @@ -111,7 +117,8 @@ SVTK_SetRotationPointDlg 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)); @@ -119,7 +126,8 @@ SVTK_SetRotationPointDlg 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)); @@ -140,7 +148,8 @@ SVTK_SetRotationPointDlg 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())); @@ -149,12 +158,12 @@ SVTK_SetRotationPointDlg 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()); @@ -240,10 +249,11 @@ void SVTK_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")) @@ -256,12 +266,12 @@ void SVTK_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(); // activate mode : the rotation point is the center of the bounding box // send the data to the SVTK_InteractorStyle: set the type of the rotation point @@ -280,7 +290,7 @@ void SVTK_SetRotationPointDlg ::onToOrigin() { - if ( mySelectPoint->state() == QButton::On ) + if ( mySelectPoint->isChecked() ) mySelectPoint->toggle(); myX->setText(QString::number(0.0)); myY->setText(QString::number(0.0)); @@ -291,7 +301,7 @@ void SVTK_SetRotationPointDlg ::onSelectPoint() { - if ( mySelectPoint->state() == QButton::On ) + if ( mySelectPoint->isChecked() ) myMainWindow->activateStartPointSelection(); else mySelectPoint->toggle(); @@ -302,7 +312,7 @@ SVTK_SetRotationPointDlg ::onCoordChanged() { if ( !myIsBBCenter->isChecked() ) { - if ( mySelectPoint->state() == QButton::On + if ( mySelectPoint->isChecked() && ( myX->hasFocus() || myY->hasFocus() || myZ->hasFocus() ) ) mySelectPoint->toggle(); diff --git a/src/SVTK/SVTK_SetRotationPointDlg.h b/src/SVTK/SVTK_SetRotationPointDlg.h index a598affc7..57df00166 100755 --- a/src/SVTK/SVTK_SetRotationPointDlg.h +++ b/src/SVTK/SVTK_SetRotationPointDlg.h @@ -43,7 +43,6 @@ class QtxAction; class QLineEdit; class QPushButton; class QGroupBox; -class QButtonGroup; class QCheckBox; class vtkCallbackCommand; @@ -70,7 +69,7 @@ protected: QCheckBox* myIsBBCenter; - QButtonGroup* myGroupSelButton; + QGroupBox * myGroupBoxSel; QPushButton* myToOrigin; QPushButton* mySelectPoint; diff --git a/src/SVTK/SVTK_UpdateRateDlg.cxx b/src/SVTK/SVTK_UpdateRateDlg.cxx index 7f31fb2b9..4c5262ebc 100644 --- a/src/SVTK/SVTK_UpdateRateDlg.cxx +++ b/src/SVTK/SVTK_UpdateRateDlg.cxx @@ -33,16 +33,16 @@ #include "VTKViewer_Algorithm.h" #include "SALOME_Actor.h" -#include "QtxDblSpinBox.h" +#include "QtxDoubleSpinBox.h" #include "QtxAction.h" #include -#include -#include -#include -#include -#include +#include +#include +#include +#include +#include #include #include @@ -178,25 +178,26 @@ SVTK_UpdateRateDlg vtkRenderWindowInteractor* aRWI = myRWInteractor->GetDevice(); bool anIsEnabledUpdateRate = false; - setCaption(tr("DLG_TITLE")); - QVBoxLayout* aVBoxLayout = new QVBoxLayout(this, 5, 5); + setWindowTitle(tr("DLG_TITLE")); + QVBoxLayout* aVBoxLayout = new QVBoxLayout(this); + aVBoxLayout->setMargin(5); + aVBoxLayout->setSpacing(5); { QGroupBox* aGroupBox = new QGroupBox(tr("INPUT_FRAME_TITLE"), this); - aGroupBox->setColumnLayout(0, Qt::Vertical ); - aGroupBox->layout()->setSpacing( 6 ); - aGroupBox->layout()->setMargin( 11 ); aGroupBox->setCheckable(true); aGroupBox->setChecked(anIsEnabledUpdateRate); myIsEnableUpdateRateGroupBox = aGroupBox; - QGridLayout* aGridLayout = new QGridLayout(aGroupBox->layout()); + QGridLayout* aGridLayout = new QGridLayout(aGroupBox); + aGridLayout->setSpacing( 6 ); + aGridLayout->setMargin( 11 ); { QLabel* aLabel = new QLabel(tr("DESIRED"), aGroupBox); aLabel->setSizePolicy(QSizePolicy::Minimum, QSizePolicy::Fixed); aGridLayout->addWidget(aLabel, 0, 0); - QtxDblSpinBox* aDblSpinBox = new QtxDblSpinBox(OFF_UPDATE_RATE, VTK_LARGE_FLOAT, 2, aGroupBox); + QtxDoubleSpinBox* aDblSpinBox = new QtxDoubleSpinBox(OFF_UPDATE_RATE, VTK_LARGE_FLOAT, 2, aGroupBox); aDblSpinBox->setSizePolicy(QSizePolicy::Expanding, QSizePolicy::Fixed); aGridLayout->addWidget(aDblSpinBox, 0, 1); @@ -210,7 +211,7 @@ SVTK_UpdateRateDlg aLabel->setSizePolicy(QSizePolicy::Minimum, QSizePolicy::Fixed); aGridLayout->addWidget(aLabel, 1, 0); - QtxDblSpinBox* aDblSpinBox = new QtxDblSpinBox(OFF_UPDATE_RATE, VTK_LARGE_FLOAT, 2, aGroupBox); + QtxDoubleSpinBox* aDblSpinBox = new QtxDoubleSpinBox(OFF_UPDATE_RATE, VTK_LARGE_FLOAT, 2, aGroupBox); aDblSpinBox->setSizePolicy(QSizePolicy::Expanding, QSizePolicy::Fixed); aGridLayout->addWidget(aDblSpinBox, 1, 1); @@ -223,11 +224,10 @@ SVTK_UpdateRateDlg } { QGroupBox* aGroupBox = new QGroupBox(tr("INFORMATION_FRAME_TITLE"), this); - aGroupBox->setColumnLayout(0, Qt::Vertical ); - aGroupBox->layout()->setSpacing( 6 ); - aGroupBox->layout()->setMargin( 11 ); - - QGridLayout* aGridLayout = new QGridLayout(aGroupBox->layout()); + + QGridLayout* aGridLayout = new QGridLayout(aGroupBox); + aGridLayout->layout()->setSpacing( 6 ); + aGridLayout->layout()->setMargin( 11 ); { QLabel* aLabel = new QLabel(tr("CURRENT_FPS"), aGroupBox); aLabel->setSizePolicy(QSizePolicy::Minimum, QSizePolicy::Fixed); diff --git a/src/SVTK/SVTK_UpdateRateDlg.h b/src/SVTK/SVTK_UpdateRateDlg.h index 388d66600..761f75afe 100644 --- a/src/SVTK/SVTK_UpdateRateDlg.h +++ b/src/SVTK/SVTK_UpdateRateDlg.h @@ -36,7 +36,7 @@ class SVTK_MainWindow; class SVTK_RenderWindowInteractor; -class QtxDblSpinBox; +class QtxDoubleSpinBox; class QtxAction; class QGroupBox; @@ -61,8 +61,8 @@ public: protected: SVTK_RenderWindowInteractor* myRWInteractor; - QtxDblSpinBox* myDesiredUpdateRateSblSpinBox; - QtxDblSpinBox* myStillUpdateRateSblSpinBox; + QtxDoubleSpinBox* myDesiredUpdateRateSblSpinBox; + QtxDoubleSpinBox* myStillUpdateRateSblSpinBox; QGroupBox* myIsEnableUpdateRateGroupBox; QLineEdit* myCurrentUpdateRateLineEdit; diff --git a/src/SVTK/SVTK_View.cxx b/src/SVTK/SVTK_View.cxx index 882728b3a..e056d6d77 100644 --- a/src/SVTK/SVTK_View.cxx +++ b/src/SVTK/SVTK_View.cxx @@ -307,8 +307,8 @@ SVTK_View using namespace SVTK; ForEachIf(getRenderer()->GetActors(), TIsSameIObject(theIObject), - TSetFunction - (&SALOME_Actor::setName,theName.latin1())); + TSetFunction + (&SALOME_Actor::setName,theName.toLatin1().data())); } /*! diff --git a/src/SVTK/SVTK_View.h b/src/SVTK/SVTK_View.h index 4c25de9bc..af25bf5ea 100644 --- a/src/SVTK/SVTK_View.h +++ b/src/SVTK/SVTK_View.h @@ -26,7 +26,7 @@ #include "SVTK.h" #include "SALOME_InteractiveObject.hxx" -#include +#include class vtkActorCollection; class vtkRenderer; @@ -36,6 +36,13 @@ class SVTK_Renderer; class SALOME_Actor; +class QMouseEvent; +class QWheelEvent; +class QKeyEvent; +class QContextMenuEvent; +class QColor; + + //! Main purpose of the class is to provide a way to customize #SVTK_MainWindow. /*! This class is initialized by #SVTK_MainWindow and just pass Qt signals from diff --git a/src/SVTK/SVTK_ViewModel.cxx b/src/SVTK/SVTK_ViewModel.cxx index 0624c7d47..990a96ee9 100644 --- a/src/SVTK/SVTK_ViewModel.cxx +++ b/src/SVTK/SVTK_ViewModel.cxx @@ -16,14 +16,17 @@ // // See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com // -#include -#include +#include +#include +#include #include #include #include -#include "SUIT_Session.h" +//#include "SUIT_Session.h" +#include "SUIT_ViewModel.h" +#include "SUIT_ViewManager.h" #include "SVTK_Selection.h" #include "SVTK_ViewModel.h" @@ -35,7 +38,6 @@ #include "VTKViewer_ViewModel.h" #include -#include // in order NOT TO link with SalomeApp, here the code returns SALOMEDS_Study. // SalomeApp_Study::studyDS() does it as well, but -- here it is retrieved from @@ -96,7 +98,7 @@ SVTK_Viewer if ( !theColor.isValid() ) return; - QPtrVector aViews = myViewManager->getViews(); + QVector aViews = myViewManager->getViews(); for(int i = 0, iEnd = aViews.size(); i < iEnd; i++){ if(SUIT_ViewWindow* aViewWindow = aViews.at(i)){ if(TViewWindow* aView = dynamic_cast(aViewWindow)){ @@ -151,7 +153,7 @@ void SVTK_Viewer::setTrihedronSize( const vtkFloatingPointType theSize, const bo myTrihedronRelative = theRelative; if (SUIT_ViewManager* aViewManager = getViewManager()) { - QPtrVector aViews = aViewManager->getViews(); + QVector aViews = aViewManager->getViews(); for ( uint i = 0; i < aViews.count(); i++ ) { if ( TViewWindow* aView = dynamic_cast(aViews.at( i )) ) @@ -186,16 +188,16 @@ void SVTK_Viewer::setViewManager(SUIT_ViewManager* theViewManager) */ void SVTK_Viewer -::contextMenuPopup( QPopupMenu* thePopup ) +::contextMenuPopup( QMenu* thePopup ) { - thePopup->insertItem( VTKViewer_Viewer::tr( "MEN_DUMP_VIEW" ), this, SLOT( onDumpView() ) ); - thePopup->insertItem( VTKViewer_Viewer::tr( "MEN_CHANGE_BACKGROUD" ), this, SLOT( onChangeBgColor() ) ); + thePopup->addAction( VTKViewer_Viewer::tr( "MEN_DUMP_VIEW" ), this, SLOT( onDumpView() ) ); + thePopup->addAction( VTKViewer_Viewer::tr( "MEN_CHANGE_BACKGROUD" ), this, SLOT( onChangeBgColor() ) ); - thePopup->insertSeparator(); + thePopup->addSeparator(); if(TViewWindow* aView = dynamic_cast(myViewManager->getActiveView())){ if ( !aView->getMainWindow()->getToolBar()->isVisible() ){ - thePopup->insertItem( VTKViewer_Viewer::tr( "MEN_SHOW_TOOLBAR" ), this, SLOT( onShowToolbar() ) ); + thePopup->addAction( VTKViewer_Viewer::tr( "MEN_SHOW_TOOLBAR" ), this, SLOT( onShowToolbar() ) ); } aView->RefreshDumpImage(); } @@ -280,7 +282,7 @@ void SVTK_Viewer ::onShowToolbar() { - QPtrVector aViews = myViewManager->getViews(); + QVector aViews = myViewManager->getViews(); for(int i = 0, iEnd = aViews.size(); i < iEnd; i++){ if(TViewWindow* aView = dynamic_cast(aViews.at(i))){ aView->getMainWindow()->getToolBar()->show(); @@ -318,7 +320,7 @@ SVTK_Viewer // ToolsGUI::SetVisibility(aStudy,anObj->getEntry(),true,this); //} // just display the object - QPtrVector aViews = myViewManager->getViews(); + QVector aViews = myViewManager->getViews(); for(int i = 0, iEnd = aViews.size(); i < iEnd; i++){ if(SVTK_ViewWindow* aViewWindow = dynamic_cast(aViews.at(i))){ if(SVTK_View* aView = aViewWindow->getView()){ @@ -367,7 +369,7 @@ SVTK_Viewer // ToolsGUI::SetVisibility(aStudy,anObj->getEntry(),false,this); //} // just display the object - QPtrVector aViews = myViewManager->getViews(); + QVector aViews = myViewManager->getViews(); for(int i = 0, iEnd = aViews.size(); i < iEnd; i++){ if(SVTK_ViewWindow* aViewWindow = dynamic_cast(aViews.at(i))) if(SVTK_View* aView = aViewWindow->getView()) @@ -393,7 +395,7 @@ SVTK_Viewer // TODO: better mechanism of storing display/erse status in a study // should be provided... //_PTR(Study) aStudy(getStudyDS()); - QPtrVector aViews = myViewManager->getViews(); + QVector aViews = myViewManager->getViews(); for(int i = 0, iEnd = aViews.size(); i < iEnd; i++){ if(SVTK_ViewWindow* aViewWindow = dynamic_cast(aViews.at(i))) if(SVTK_View* aView = aViewWindow->getView()){ @@ -483,7 +485,7 @@ bool SVTK_Viewer ::isVisible( const Handle(SALOME_InteractiveObject)& io ) { - QPtrVector aViews = myViewManager->getViews(); + QVector aViews = myViewManager->getViews(); for(int i = 0, iEnd = aViews.size(); i < iEnd; i++) if(SUIT_ViewWindow* aViewWindow = aViews.at(i)) if(TViewWindow* aViewWnd = dynamic_cast(aViewWindow)) @@ -502,7 +504,7 @@ SVTK_Viewer ::Repaint() { // if (theUpdateTrihedron) onAdjustTrihedron(); - QPtrVector aViews = myViewManager->getViews(); + QVector aViews = myViewManager->getViews(); for(int i = 0, iEnd = aViews.size(); i < iEnd; i++) if(TViewWindow* aViewWindow = dynamic_cast(aViews.at(i))) if(SVTK_View* aView = aViewWindow->getView()) diff --git a/src/SVTK/SVTK_ViewModel.h b/src/SVTK/SVTK_ViewModel.h index ec61193b2..db6c4d79d 100644 --- a/src/SVTK/SVTK_ViewModel.h +++ b/src/SVTK/SVTK_ViewModel.h @@ -20,13 +20,14 @@ #define SVTK_VIEWMODEL_H #include "SVTK.h" -#include "SUIT_ViewModel.h" #include "SVTK_ViewModelBase.h" #include "SALOME_Prs.h" #include "SALOME_InteractiveObject.hxx" -#include +#include + +class QMouseEvent; class SVTK_ViewWindow; @@ -51,7 +52,7 @@ public: virtual void setViewManager(SUIT_ViewManager* theViewManager); //! See #SUIT_ViewModel::contextMenuPopup - virtual void contextMenuPopup( QPopupMenu* ); + virtual void contextMenuPopup( QMenu* ); //! See #SUIT_ViewModel::getType virtual QString getType() const { return Type(); } diff --git a/src/SVTK/SVTK_ViewWindow.cxx b/src/SVTK/SVTK_ViewWindow.cxx index 667f406c3..c7da479d0 100755 --- a/src/SVTK/SVTK_ViewWindow.cxx +++ b/src/SVTK/SVTK_ViewWindow.cxx @@ -18,8 +18,8 @@ // #include "SALOME_Actor.h" -#include -#include +#include +#include #include #include @@ -468,7 +468,10 @@ SVTK_ViewWindow ::setBackgroundColor( const QColor& color ) { myMainWindow->SetBackgroundColor( color ); - SUIT_ViewWindow::setBackgroundColor( color ); + + QPalette palette; + palette.setColor(backgroundRole(), color); + setPalette(palette); } /*! @@ -711,8 +714,8 @@ SVTK_ViewWindow QImage SVTK_ViewWindow ::dumpView() -{ - if ( myMainWindow->getToolBar()->hasMouse() || myDumpImage.isNull() ) +{ + if ( myMainWindow->getToolBar()->testAttribute(Qt::WA_UnderMouse) || myDumpImage.isNull() ) return myMainWindow->dumpView(); return myDumpImage; @@ -815,7 +818,7 @@ QString getGradAxisVisualParams( vtkAxisActor2D* actor ) shadow = txtProp->GetShadow(); } params.sprintf( "* Graduated Axis: * Name *%u*%s*%.2f*%.2f*%.2f*%u*%u*%u*%u", isVisible, - title.latin1(), color[0], color[1], color[2], font, bold, italic, shadow ); + title.toLatin1().data(), color[0], color[1], color[2], font, bold, italic, shadow ); // Labels isVisible = actor->GetLabelVisibility(); @@ -854,7 +857,7 @@ void setGradAxisVisualParams( vtkAxisActor2D* actor, const QString& params ) if ( !actor ) return; - QStringList paramsLst = QStringList::split( '*', params, true ); + QStringList paramsLst = params.split( '*' ); if ( paramsLst.size() == nGradAxisParams ) { // altogether name, lable, ticks parameters make up 25 values @@ -871,7 +874,7 @@ void setGradAxisVisualParams( vtkAxisActor2D* actor, const QString& params ) int shadow = paramsLst[10].toInt(); actor->SetTitleVisibility( isVisible ); - actor->SetTitle( title.latin1() ); + actor->SetTitle( title.toLatin1() ); vtkTextProperty* txtProp = actor->GetTitleTextProperty(); if ( txtProp ) { txtProp->SetColor( color ); @@ -973,7 +976,7 @@ void SVTK_ViewWindow ::doSetVisualParameters( const QString& parameters ) { - QStringList paramsLst = QStringList::split( '*', parameters, true ); + QStringList paramsLst = parameters.split( '*' ); if ( paramsLst.size() >= nNormalParams ) { // 'reading' list of parameters double pos[3], focalPnt[3], viewUp[3], parScale, scale[3]; diff --git a/src/SVTK/SVTK_ViewWindow.h b/src/SVTK/SVTK_ViewWindow.h index 809168505..86c46a116 100755 --- a/src/SVTK/SVTK_ViewWindow.h +++ b/src/SVTK/SVTK_ViewWindow.h @@ -26,9 +26,10 @@ #include "SVTK.h" #include "SVTK_Selection.h" #include "SUIT_ViewWindow.h" + #include "SALOME_InteractiveObject.hxx" -#include +#include class SUIT_Desktop; @@ -40,12 +41,8 @@ class SVTK_MainWindow; class SVTK_Selector; class SVTK_View; -class SVTK_InteractorStyle; class SVTK_CubeAxesActor2D; -class SVTK_RenderWindow; -class SVTK_RenderWindowInteractor; - class vtkRenderer; class vtkRenderWindow; class vtkRenderWindowInteractor; diff --git a/src/src.pro b/src/src.pro index 67b89f293..6167bb22d 100644 --- a/src/src.pro +++ b/src/src.pro @@ -15,6 +15,7 @@ SUBDIRS += PyConsole SUBDIRS += Prs SUBDIRS += OBJECT SUBDIRS += VTKViewer +SUBDIRS += SVTK SUBDIRS += OCCViewer SUBDIRS += SOCC SUBDIRS += Event