# 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
--- /dev/null
+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
#define OCCVIEWER_AISSELECTOR_H
#include "OCCViewer.h"
-#include <qobject.h>
+#include <QObject>
#include <Quantity_NameOfColor.hxx>
#include <AIS_InteractiveContext.hxx>
#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 );
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 );
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 );
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 );
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 );
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 );
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 );
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 );
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 );
aView3d->SetPlaneOn( myClippingPlane );
if (!myView->isCuttingPlane())
- myAction->setOn( false );
+ myAction->setChecked( false );
QDialog::closeEvent( e );
}
aView3d->SetPlaneOn( myClippingPlane );
if (!myView->isCuttingPlane())
- myAction->setOn( false );
+ myAction->setChecked( false );
reject();
}
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 );
}
}
}
void OCCViewer_ClippingDlg::onViewShow()
{
- if(myAction->isOn())
+ if(myAction->isChecked())
show();
else
hide();
#include "OCCViewer.h"
-#include <qdialog.h>
+#include <QDialog>
#include <AIS_Plane.hxx>
#include <V3d_Plane.hxx>
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; }
#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
OCCViewer_CreateRestoreViewDlg::OCCViewer_CreateRestoreViewDlg( QWidget* aWin, OCCViewer_Viewer* curModel )
: QDialog( aWin )
{
- setCaption( tr( "CAPTION" ) );
+ setWindowTitle( tr( "CAPTION" ) );
myParametersMap = curModel->getViewAspects();
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 );
{
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 );
}
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 );
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 )
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 );
}
}
{
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
}
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 );
}
}
void OCCViewer_CreateRestoreViewDlg::clearList()
{
myListBox->clear();
- myListBox->insertItem( "No Items", 0 );
+ myListBox->insertItem( 0, "No Items" );
myListBox->setEditEnabled( 0 );
myParametersMap.clear();
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();
}
/*!
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;
if( !myKeyFlag )
{
if( anEv->type() == QEvent::KeyPress || anEv->type() == QEvent::MouseButtonPress )
- myListBox->setSelectionMode( QListBox::Single );
+ myListBox->setSelectionMode( QAbstractItemView::SingleSelection );
}
return QWidget::eventFilter( anObj, anEv );
}
#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
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:
private:
int myKeyFlag;
- QtxListBox* myListBox;
+ QtxListBox* myListBox;
OCCViewer_ViewPort3d* myCurViewPort;
- viewAspect myCurrentItem;
- viewAspectList myParametersMap;
+ viewAspect myCurrentItem;
+ viewAspectList myParametersMap;
};
#ifdef WIN32
#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
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));
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));
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));
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()));
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());
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"))
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();
}
OCCViewer_SetRotationPointDlg
::onToOrigin()
{
- if ( mySelectPoint->state() == QButton::On )
+ if ( mySelectPoint->isChecked() )
mySelectPoint->toggle();
setCoords();
myView->activateSetRotationSelected(myX->text().toDouble(),
OCCViewer_SetRotationPointDlg
::onSelectPoint()
{
- if ( mySelectPoint->state() == QButton::On )
+ if ( mySelectPoint->isChecked() )
myView->activateStartPointSelection();
else
mySelectPoint->toggle();
{
if ( !myIsBBCenter->isChecked() )
{
- if ( mySelectPoint->state() == QButton::On
+ if ( mySelectPoint->isChecked()
&&
( myX->hasFocus() || myY->hasFocus() || myZ->hasFocus() ) )
mySelectPoint->toggle();
OCCViewer_SetRotationPointDlg
::onClickClose()
{
- myAction->setOn( false );
+ myAction->setChecked( false );
reject();
}
OCCViewer_SetRotationPointDlg
::onViewShow()
{
- if(myAction->isOn())
+ if(myAction->isChecked())
show();
else
hide();
#include "OCCViewer.h"
-#include <qdialog.h>
+#include <QDialog>
class QtxAction;
class QLineEdit;
class QPushButton;
class QGroupBox;
-class QButtonGroup;
class QCheckBox;
class OCCViewer_ViewWindow;
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; }
QCheckBox* myIsBBCenter;
- QButtonGroup* myGroupSelButton;
+ QGroupBox * myGroupBoxSel;
QPushButton* myToOrigin;
QPushButton* mySelectPoint;
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
OCCViewer_Viewer* getOCCViewer() { return (OCCViewer_Viewer*) myViewModel; }
- virtual void contextMenuPopup( QPopupMenu* );
+ virtual void contextMenuPopup( QMenu* );
};
#endif
#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>
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*)));
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();
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();
}
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();
}
/*!
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() ) );
}
/*!
#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:
QString name;
};
-typedef QValueList<viewAspect> viewAspectList;
+typedef QList<viewAspect> viewAspectList;
#ifdef WIN32
#pragma warning( disable:4251 )
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
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)& );
#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>
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
Constructor
*/
OCCViewer_ViewPort::OCCViewer_ViewPort( QWidget* parent )
-: QWidget( parent, 0, WRepaintNoErase | WResizeNoErase )
+: QWidget( parent )
{
initialize();
}
*/
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 );
}
/*!
{
#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 );
/* 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() )
{
XFree( (char *)pVisualInfo );
}
- XFlush( x11Display() );
+ XFlush( QX11Info::display() );
}
#endif
}
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 );
*/
QColor OCCViewer_ViewPort::backgroundColor() const
{
- return palette().active().background();
+ return palette().color( QPalette::Active, QPalette::Background );
}
/*!
{
for ( QtxAction* a = myPopupActions.first(); a; a = myPopupActions.next() )
a->removeFrom( popup );
+ //while (!myPopupActions.isEmpty())
+ // delete myPopupActions.takeFirst();
myPopupActions.clear();
}
}*/
#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 )
*/
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
#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>
#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 );
// 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
#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>
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;
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();
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;
*/
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 ) )
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();
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 );
}
}
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);
*/
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;
}
/*!
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;
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;
mySetRotationPointDlg->SetAction( mySetRotationPointAction );
}
- if ( !mySetRotationPointDlg->isShown() )
+ if ( !mySetRotationPointDlg->isVisible() )
{
if ( mySetRotationPointDlg->IsFirstShown() )
{
}
else
{
- if ( mySetRotationPointDlg->isShown() )
+ if ( mySetRotationPointDlg->isVisible() )
mySetRotationPointDlg->hide();
}
}
{
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 )
{
myClippingDlg->SetAction( myClippingAction );
}
- if ( !myClippingDlg->isShown() )
+ if ( !myClippingDlg->isVisible() )
myClippingDlg->show();
}
else
{
- if ( myClippingDlg->isShown() )
+ if ( myClippingDlg->isVisible() )
myClippingDlg->hide();
setCuttingPlane(false);
}
QImage OCCViewer_ViewWindow::dumpView()
{
QPixmap px = QPixmap::grabWindow( myViewPort->winId() );
- return px.convertToImage();
+ return px.toImage();
}
/*!
*/
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();
#include "QtxAction.h"
-#include <qcursor.h>
-#include <qvaluelist.h>
+#include <QCursor>
class SUIT_Desktop;
class OCCViewer_ViewPort3d;
#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* );
signals:
void itemEdited( int );
- void itemEdited( QListBoxItem* );
+ void itemEdited( QListWidgetItem* );
void itemMoved( int, int );
public slots:
SUBDIRS += PyConsole
SUBDIRS += Prs
SUBDIRS += OBJECT
+SUBDIRS += OCCViewer
SUBDIRS += Event