From fe1e40c7e78468509e75e285ef392527118065d3 Mon Sep 17 00:00:00 2001 From: mkr Date: Wed, 11 Jul 2007 12:19:50 +0000 Subject: [PATCH] Porting to Qt4. --- .../OCCViewer_SetRotationPointDlg.cxx | 2 +- src/OCCViewer/OCCViewer_ViewPort3d.cxx | 10 +++---- src/OCCViewer/OCCViewer_ViewWindow.cxx | 26 +++++++++---------- src/SVTK/SVTK_CubeAxesDlg.cxx | 12 ++++----- src/SVTK/SVTK_SetRotationPointDlg.cxx | 6 ++--- 5 files changed, 27 insertions(+), 29 deletions(-) diff --git a/src/OCCViewer/OCCViewer_SetRotationPointDlg.cxx b/src/OCCViewer/OCCViewer_SetRotationPointDlg.cxx index c102afdb4..db26945f3 100644 --- a/src/OCCViewer/OCCViewer_SetRotationPointDlg.cxx +++ b/src/OCCViewer/OCCViewer_SetRotationPointDlg.cxx @@ -55,7 +55,7 @@ OCCViewer_SetRotationPointDlg::OCCViewer_SetRotationPointDlg( OCCViewer_ViewWind layoutDlg->setMargin(11); // Create check box "Use Bounding Box Center" - QHBoxLayout* aCheckBox = new QHBoxLayout(this); + QHBoxLayout* aCheckBox = new QHBoxLayout; myIsBBCenter = new QCheckBox(tr("USE_BBCENTER")); myIsBBCenter->setChecked(true); diff --git a/src/OCCViewer/OCCViewer_ViewPort3d.cxx b/src/OCCViewer/OCCViewer_ViewPort3d.cxx index 0c5471704..487c81d33 100755 --- a/src/OCCViewer/OCCViewer_ViewPort3d.cxx +++ b/src/OCCViewer/OCCViewer_ViewPort3d.cxx @@ -256,10 +256,10 @@ void OCCViewer_ViewPort3d::setBackgroundColor( const QColor& color ) { if ( !activeView().IsNull() ) { - activeView()->SetBackgroundColor( Quantity_TOC_RGB, color.red()/255., - color.green()/255., color.blue()/255.); - activeView()->Update(); - emit vpChangeBGColor( color ); + activeView()->SetBackgroundColor( Quantity_TOC_RGB, color.red()/255., + color.green()/255., color.blue()/255.); + activeView()->Update(); + emit vpChangeBGColor( color ); } } @@ -466,7 +466,7 @@ void OCCViewer_ViewPort3d::resizeEvent( QResizeEvent* e ) */ void OCCViewer_ViewPort3d::fitAll( bool keepScale, bool withZ, bool upd ) { - if ( activeView().IsNull() ) + if ( activeView().IsNull() ) return; diff --git a/src/OCCViewer/OCCViewer_ViewWindow.cxx b/src/OCCViewer/OCCViewer_ViewWindow.cxx index ae7bb38b0..8ca50a10f 100755 --- a/src/OCCViewer/OCCViewer_ViewWindow.cxx +++ b/src/OCCViewer/OCCViewer_ViewWindow.cxx @@ -689,7 +689,7 @@ void OCCViewer_ViewWindow::vpMouseMoveEvent(QMouseEvent* theEvent) else { int aState = theEvent->modifiers(); - int aButton = theEvent->button(); + int aButton = theEvent->buttons(); if ( aButton == Qt::LeftButton || ( aButton == Qt::LeftButton && aState == Qt::ShiftModifier ) ) { myDrawRect = myEnableDrawMode; @@ -703,9 +703,8 @@ void OCCViewer_ViewWindow::vpMouseMoveEvent(QMouseEvent* theEvent) } } } - else { + else emit mouseMoving( this, theEvent ); - } } } } @@ -739,20 +738,22 @@ void OCCViewer_ViewWindow::vpMouseReleaseEvent(QMouseEvent* theEvent) case PANGLOBAL: if ( theEvent->button() == Qt::LeftButton ) { - myViewPort->setCenter( theEvent->x(), theEvent->y() ); + myViewPort->setCenter( theEvent->x(), theEvent->y() ); myViewPort->getView()->SetScale(myCurScale); - resetState(); - } + resetState(); + } break; case WINDOWFIT: if ( theEvent->button() == Qt::LeftButton ) { - myCurrX = theEvent->x(); - myCurrY = theEvent->y(); - QRect rect = SUIT_Tools::makeRect(myStartX, myStartY, myCurrX, myCurrY); - if ( !rect.isEmpty() ) myViewPort->fitRect(rect); - resetState(); - } + myCurrX = theEvent->x(); + myCurrY = theEvent->y(); + drawRect(); + QRect rect = SUIT_Tools::makeRect(myStartX, myStartY, myCurrX, myCurrY); + if ( !rect.isEmpty() ) myViewPort->fitRect(rect); + endDrawRect(); + resetState(); + } break; } @@ -760,7 +761,6 @@ void OCCViewer_ViewWindow::vpMouseReleaseEvent(QMouseEvent* theEvent) // so we must emit it BEFORE resetting the selection rectangle if ( theEvent->button() == Qt::LeftButton && myDrawRect ) { - myDrawRect = false; drawRect(); endDrawRect(); resetState(); diff --git a/src/SVTK/SVTK_CubeAxesDlg.cxx b/src/SVTK/SVTK_CubeAxesDlg.cxx index a69b9a388..1258e98ed 100644 --- a/src/SVTK/SVTK_CubeAxesDlg.cxx +++ b/src/SVTK/SVTK_CubeAxesDlg.cxx @@ -68,7 +68,7 @@ SVTK_AxisWidget::SVTK_AxisWidget (QWidget* theParent) myIsNameVisible = new QCheckBox(tr("IS_VISIBLE"), myNameGrp); aVBox->addWidget(myIsNameVisible); - QHBoxLayout* aHBox = new QHBoxLayout(myNameGrp); + QHBoxLayout* aHBox = new QHBoxLayout; aHBox->setSpacing(5); QLabel* aLabel = new QLabel(tr("NAME")); aHBox->addWidget(aLabel); @@ -77,7 +77,7 @@ SVTK_AxisWidget::SVTK_AxisWidget (QWidget* theParent) aLabels.append(aLabel); aVBox->addLayout(aHBox); - aHBox = new QHBoxLayout(myNameGrp); + aHBox = new QHBoxLayout; aHBox->setSpacing(5); aLabel = new QLabel(tr("FONT")); aHBox->addWidget(aLabel); @@ -96,7 +96,7 @@ SVTK_AxisWidget::SVTK_AxisWidget (QWidget* theParent) myIsLabelsVisible = new QCheckBox(tr("IS_VISIBLE"), myLabelsGrp); aVBox->addWidget(myIsLabelsVisible); - aHBox = new QHBoxLayout(myLabelsGrp); + aHBox = new QHBoxLayout; aHBox->setSpacing(5); aLabel = new QLabel(tr("NUMBER")); aHBox->addWidget(aLabel); @@ -106,7 +106,7 @@ SVTK_AxisWidget::SVTK_AxisWidget (QWidget* theParent) aLabels.append(aLabel); aVBox->addLayout(aHBox); - aHBox = new QHBoxLayout(myLabelsGrp); + aHBox = new QHBoxLayout; aHBox->setSpacing(5); aLabel = new QLabel(tr("OFFSET")); aHBox->addWidget(aLabel); @@ -116,7 +116,7 @@ SVTK_AxisWidget::SVTK_AxisWidget (QWidget* theParent) aLabels.append(aLabel); aVBox->addLayout(aHBox); - aHBox = new QHBoxLayout(myLabelsGrp); + aHBox = new QHBoxLayout; aHBox->setSpacing(5); aLabel = new QLabel(tr("FONT")); aHBox->addWidget(aLabel); @@ -135,7 +135,7 @@ SVTK_AxisWidget::SVTK_AxisWidget (QWidget* theParent) myIsTicksVisible = new QCheckBox(tr("IS_VISIBLE"), myTicksGrp); aVBox->addWidget(myIsTicksVisible); - aHBox = new QHBoxLayout(myTicksGrp); + aHBox = new QHBoxLayout; aHBox->setSpacing(5); aLabel = new QLabel(tr("LENGTH")); aHBox->addWidget(aLabel); diff --git a/src/SVTK/SVTK_SetRotationPointDlg.cxx b/src/SVTK/SVTK_SetRotationPointDlg.cxx index 50f8f69e8..f6202845d 100755 --- a/src/SVTK/SVTK_SetRotationPointDlg.cxx +++ b/src/SVTK/SVTK_SetRotationPointDlg.cxx @@ -72,7 +72,7 @@ SVTK_SetRotationPointDlg layoutDlg->setMargin(11); // Create check box "Use Bounding Box Center" - QHBoxLayout* aCheckBox = new QHBoxLayout(this); + QHBoxLayout* aCheckBox = new QHBoxLayout; myIsBBCenter = new QCheckBox(tr("USE_BBCENTER")); myIsBBCenter->setChecked(true); @@ -81,7 +81,7 @@ SVTK_SetRotationPointDlg // Create croup button with radio buttons myGroupBoxSel = new QGroupBox( "", this ); - QVBoxLayout *vbox = new QVBoxLayout; + QVBoxLayout *vbox = new QVBoxLayout( myGroupBoxSel ); vbox->setMargin(11); vbox->addStretch(1); @@ -98,8 +98,6 @@ SVTK_SetRotationPointDlg vbox->addWidget(mySelectPoint); connect(mySelectPoint, SIGNAL(clicked()), this, SLOT(onSelectPoint())); - myGroupBoxSel->setLayout(vbox); - // Create croup box with grid layout myGroupBoxCoord = new QGroupBox(this); myGroupBoxCoord->setObjectName("GroupBox"); -- 2.39.2