From: akl Date: Fri, 20 Sep 2013 12:10:32 +0000 (+0000) Subject: Modify creation of curves: 1) using QDockWidget instead of QDialog; 2) selection... X-Git-Tag: BR_hydro_v_0_1~9 X-Git-Url: http://git.salome-platform.org/gitweb/?a=commitdiff_plain;h=a502bc91af765db8df39ed99c321af63631ec2c4;p=modules%2Fhydro.git Modify creation of curves: 1) using QDockWidget instead of QDialog; 2) selection of new point coordinates by click in viewer. --- diff --git a/CMakeLists.txt b/CMakeLists.txt index ffb6e673..f68683cd 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -2,9 +2,9 @@ cmake_minimum_required (VERSION 2.6) project (HYDRO) -IF(WINDOWS) +IF(WIN32) ADD_DEFINITIONS(-DWNT) -ENDIF(WINDOWS) +ENDIF(WIN32) SET(KERNEL_ROOT_DIR $ENV{KERNEL_ROOT_DIR} CACHE PATH "Path to the Salome KERNEL") IF(EXISTS ${KERNEL_ROOT_DIR}) diff --git a/src/HYDROGUI/CMakeLists.txt b/src/HYDROGUI/CMakeLists.txt index c8316fea..73ac8c89 100644 --- a/src/HYDROGUI/CMakeLists.txt +++ b/src/HYDROGUI/CMakeLists.txt @@ -114,7 +114,7 @@ include_directories( add_library(HYDROGUI SHARED ${PROJECT_SOURCES} ${PROJECT_HEADERS} ${PROJECT_HEADERS_MOC}) target_link_libraries(HYDROGUI HYDROData - ${CAS_TKV3d} ${CAS_TKTopAlgo} + ${CAS_TKV3d} ${CAS_TKTopAlgo} ${CAS_TKBRep} ${LightApp} ${CAM} ${suit} ${qtx} ${ObjBrowser} ${GraphicsView} ${std} ${Event} ${OCCViewer} ${CurveCreator} ) diff --git a/src/HYDROGUI/HYDROGUI_InputPanel.cxx b/src/HYDROGUI/HYDROGUI_InputPanel.cxx index 68c084a2..a20c755b 100644 --- a/src/HYDROGUI/HYDROGUI_InputPanel.cxx +++ b/src/HYDROGUI/HYDROGUI_InputPanel.cxx @@ -28,6 +28,7 @@ #include #include +#include HYDROGUI_InputPanel::HYDROGUI_InputPanel( HYDROGUI_Module* theModule, const QString& theTitle ) : QDockWidget( theModule->application()->desktop() ), @@ -42,19 +43,23 @@ HYDROGUI_InputPanel::HYDROGUI_InputPanel( HYDROGUI_Module* theModule, const QStr QVBoxLayout* aLayout = new QVBoxLayout( aFrame ); myMainFrame = new QFrame( aFrame ); - QBoxLayout* aMainLayout = new QVBoxLayout( myMainFrame ); + QVBoxLayout* aMainLayout = new QVBoxLayout( myMainFrame ); aMainLayout->setMargin( 0 ); aMainLayout->setSpacing( 5 ); + myStackedLayout = new QStackedLayout(); + myBtnFrame = new QFrame( aFrame ); - aLayout->addWidget( myMainFrame, 1 ); - aLayout->addWidget( myBtnFrame, 0 ); + activateWidget( myBtnFrame ); + + aLayout->addWidget( myMainFrame, 3 ); + aLayout->addLayout( myStackedLayout, 1 ); QHBoxLayout* aBtnsLayout = new QHBoxLayout( myBtnFrame ); aBtnsLayout->setMargin( 5 ); aBtnsLayout->setSpacing( 5 ); - myApply = new QPushButton( tr( "APPLY" ), myBtnFrame ), + myApply = new QPushButton( tr( "APPLY" ), myBtnFrame ); myCancel = new QPushButton( tr( "CANCEL" ), myBtnFrame ); myHelp = new QPushButton( tr( "HELP" ), myBtnFrame ); @@ -114,3 +119,14 @@ QFrame* HYDROGUI_InputPanel::mainFrame() const return myMainFrame; } +void HYDROGUI_InputPanel::activateWidget( QWidget* theWidget ) +{ + if (theWidget == 0) { + myStackedLayout->setCurrentIndex( 0 ); + } + else { + if ( myStackedLayout->indexOf( theWidget ) == -1 ) + myStackedLayout->addWidget( theWidget ); + myStackedLayout->setCurrentWidget( theWidget ); + } +} diff --git a/src/HYDROGUI/HYDROGUI_InputPanel.h b/src/HYDROGUI/HYDROGUI_InputPanel.h index 3321f56d..7c3c829b 100644 --- a/src/HYDROGUI/HYDROGUI_InputPanel.h +++ b/src/HYDROGUI/HYDROGUI_InputPanel.h @@ -28,6 +28,7 @@ class QFrame; class QPushButton; class QLayout; +class QStackedLayout; class HYDROGUI_Module; @@ -46,6 +47,8 @@ public: void addLayout( QLayout* theLayout ); void addStretch(); + void addToStackedLayout( QWidget* ); + void activateWidget( QWidget* ); HYDROGUI_Module* module() const; signals: @@ -67,6 +70,7 @@ private: QPushButton* myApply; QPushButton* myCancel; QPushButton* myHelp; + QStackedLayout* myStackedLayout; }; #endif diff --git a/src/HYDROGUI/HYDROGUI_PolylineDlg.cxx b/src/HYDROGUI/HYDROGUI_PolylineDlg.cxx index 7deeb6fd..40a831d8 100755 --- a/src/HYDROGUI/HYDROGUI_PolylineDlg.cxx +++ b/src/HYDROGUI/HYDROGUI_PolylineDlg.cxx @@ -21,6 +21,8 @@ // #include "HYDROGUI_PolylineDlg.h" + +#include "HYDROGUI_Module.h" #include #include @@ -40,17 +42,31 @@ HYDROGUI_PolylineDlg::HYDROGUI_PolylineDlg( HYDROGUI_Module* theModule, const QS addLayout(aNameLayout); myEditorWidget = - new CurveCreator_Widget( this, NULL); + new CurveCreator_Widget( this, NULL ); addWidget( myEditorWidget ); connect( myEditorWidget, SIGNAL( selectionChanged() ), this, SIGNAL( selectionChanged() ) ); + connect( myEditorWidget, SIGNAL( subOperationStarted(QWidget*) ), this, SLOT( processStartedSubOperation(QWidget*) ) ); + connect( myEditorWidget, SIGNAL( subOperationFinished(QWidget*) ), this, SLOT( processFinishedSubOperation(QWidget*) ) ); } HYDROGUI_PolylineDlg::~HYDROGUI_PolylineDlg() { } +void HYDROGUI_PolylineDlg::processStartedSubOperation( QWidget* theWidget ) +{ + myEditorWidget->setEnabled( false ); + activateWidget( theWidget ); +} + +void HYDROGUI_PolylineDlg::processFinishedSubOperation( QWidget* theWidget ) +{ + myEditorWidget->setEnabled( true ); + activateWidget( 0 ); +} + void HYDROGUI_PolylineDlg::reset() { } diff --git a/src/HYDROGUI/HYDROGUI_PolylineDlg.h b/src/HYDROGUI/HYDROGUI_PolylineDlg.h index 059bc2fd..4ca803fa 100755 --- a/src/HYDROGUI/HYDROGUI_PolylineDlg.h +++ b/src/HYDROGUI/HYDROGUI_PolylineDlg.h @@ -49,10 +49,14 @@ public: QList< QPair< int, int > > getSelectedPoints(); protected slots: - + void processStartedSubOperation( QWidget* ); + void processFinishedSubOperation( QWidget* ); signals: void createPreview( QString ); void selectionChanged(); + void widgetCreated(QWidget*); + void subOperationStarted(QWidget*); + void subOperationFinished(QWidget*); private: QLineEdit* myName; CurveCreator_Widget* myEditorWidget; diff --git a/src/HYDROGUI/HYDROGUI_PolylineOp.cxx b/src/HYDROGUI/HYDROGUI_PolylineOp.cxx index f5334fe8..2e3ad922 100755 --- a/src/HYDROGUI/HYDROGUI_PolylineOp.cxx +++ b/src/HYDROGUI/HYDROGUI_PolylineOp.cxx @@ -39,6 +39,7 @@ #include #include +#include #include @@ -127,6 +128,9 @@ void HYDROGUI_PolylineOp::onCreatePreview() aViewer->enableMultiselection(true); Handle_AIS_InteractiveContext aCtx = aViewer->getAISContext(); + OCCViewer_ViewWindow* vw = (OCCViewer_ViewWindow*)myPreviewViewManager->getActiveView(); + vw->onTopView(); + myAISCurve = new HYDROGUI_AISCurve(myCurve, aCtx); myAISCurve->Display(); @@ -171,7 +175,7 @@ void HYDROGUI_PolylineOp::startOperation() } else{ - myCurve = new CurveCreator_Curve(CurveCreator::Dim3d); + myCurve = new CurveCreator_Curve(CurveCreator::Dim2d); aPanel->setCurve(myCurve); QString aNewName = HYDROGUI_Tool::GenerateObjectName( module(), "Polyline" ); aPanel->setPolylineName(aNewName);