From 457ce361f17154c25755624bd0aacda1c6cffb62 Mon Sep 17 00:00:00 2001 From: asl Date: Tue, 19 May 2015 15:56:59 +0300 Subject: [PATCH] refs #534: creation of a new region via popup --- src/HYDROGUI/HYDROGUI_CalculationDlg.cxx | 8 +++++++- src/HYDROGUI/HYDROGUI_CalculationDlg.h | 3 +++ src/HYDROGUI/HYDROGUI_DataBrowser.cxx | 11 +++++++++-- src/HYDROGUI/HYDROGUI_DataBrowser.h | 7 ++++++- src/HYDROGUI/resources/HYDROGUI_msg_en.ts | 4 ++++ 5 files changed, 29 insertions(+), 4 deletions(-) diff --git a/src/HYDROGUI/HYDROGUI_CalculationDlg.cxx b/src/HYDROGUI/HYDROGUI_CalculationDlg.cxx index 8bd9bfa8..49d61888 100644 --- a/src/HYDROGUI/HYDROGUI_CalculationDlg.cxx +++ b/src/HYDROGUI/HYDROGUI_CalculationDlg.cxx @@ -334,6 +334,7 @@ QWizardPage* HYDROGUI_CalculationDlg::createZonesPage() { connect( myBrowser, SIGNAL( dropped( const QList&, SUIT_DataObject*, int, Qt::DropAction ) ), SLOT( onZonesDropped( const QList&, SUIT_DataObject*, int, Qt::DropAction ) ) ); + connect( myBrowser, SIGNAL( newRegion() ), this, SLOT( OnNewRegion() ) ); return aPage; } @@ -408,6 +409,11 @@ void HYDROGUI_CalculationDlg::onZonesDropped( const QList& the } } +void HYDROGUI_CalculationDlg::OnNewRegion() +{ + emit createRegion( myBrowser->getSelected() ); +} + void HYDROGUI_CalculationDlg::onMergeTypeSelected( int theIndex ) { int aType = myBathymetryChoice->itemData( theIndex ).toInt(); @@ -733,4 +739,4 @@ void HYDROGUI_CalculationDlg::setRules( const HYDROData_ListOfRules& theRules ) void HYDROGUI_CalculationDlg::onOrderChanged() { myPriorityWidget->setObjects( getGeometryObjects() ); -} \ No newline at end of file +} diff --git a/src/HYDROGUI/HYDROGUI_CalculationDlg.h b/src/HYDROGUI/HYDROGUI_CalculationDlg.h index ba2fb2cb..3578ec12 100644 --- a/src/HYDROGUI/HYDROGUI_CalculationDlg.h +++ b/src/HYDROGUI/HYDROGUI_CalculationDlg.h @@ -123,6 +123,9 @@ protected: virtual bool acceptCurrent() const; +protected slots: + void OnNewRegion(); + private: QList getGeometryObjects(); diff --git a/src/HYDROGUI/HYDROGUI_DataBrowser.cxx b/src/HYDROGUI/HYDROGUI_DataBrowser.cxx index e213ea2e..4a553e04 100644 --- a/src/HYDROGUI/HYDROGUI_DataBrowser.cxx +++ b/src/HYDROGUI/HYDROGUI_DataBrowser.cxx @@ -39,6 +39,7 @@ #include #include +#include class SUIT_DataBrowser; class LightApp_DataObject; @@ -274,7 +275,7 @@ HYDROGUI_DataBrowser::HYDROGUI_DataBrowser( HYDROGUI_Module* theModule, SUIT_Dat treeView()->setColumnWidth(SUIT_DataObject::VisibilityId, VISIBILITY_COLUMN_WIDTH); treeView()->hideColumn( SUIT_DataObject::VisibilityId ); treeView()->hideColumn( LightApp_DataObject::EntryId ); - //RKV: connectPopupRequest( theModule->getApp(), SLOT( onConnectPopupRequest( SUIT_PopupClient*, QContextMenuEvent* ) ) ); + connectPopupRequest( theModule->getApp(), SLOT( onConnectPopupRequest( SUIT_PopupClient*, QContextMenuEvent* ) ) ); } HYDROGUI_DataBrowser::~HYDROGUI_DataBrowser() @@ -316,4 +317,10 @@ void HYDROGUI_DataBrowser::setReadOnly( const bool theIsReadOnly ) aShortcut->setEnabled( !theIsReadOnly ); } } -} \ No newline at end of file +} + +void HYDROGUI_DataBrowser::createPopupMenu( QMenu* theMenu ) +{ + theMenu->clear(); + theMenu->addAction( tr( "ZONE_TO_NEW_REGION" ), this, SIGNAL( newRegion() ) ); +} diff --git a/src/HYDROGUI/HYDROGUI_DataBrowser.h b/src/HYDROGUI/HYDROGUI_DataBrowser.h index adbf77d7..decdcbed 100644 --- a/src/HYDROGUI/HYDROGUI_DataBrowser.h +++ b/src/HYDROGUI/HYDROGUI_DataBrowser.h @@ -49,8 +49,13 @@ public: signals: void dropped( const QList& theList, - SUIT_DataObject* theTargetParent, int theTargetRow, Qt::DropAction theDropAction ); + SUIT_DataObject* theTargetParent, + int theTargetRow, Qt::DropAction theDropAction ); void dataChanged(); + void newRegion(); + +protected: + virtual void createPopupMenu( QMenu* ); private: HYDROGUI_Module* myModule; diff --git a/src/HYDROGUI/resources/HYDROGUI_msg_en.ts b/src/HYDROGUI/resources/HYDROGUI_msg_en.ts index 996a948d..180ef842 100644 --- a/src/HYDROGUI/resources/HYDROGUI_msg_en.ts +++ b/src/HYDROGUI/resources/HYDROGUI_msg_en.ts @@ -349,6 +349,10 @@ All supported formats (*.brep *.iges *.igs *.step *.stp) ALTITUDE_COLUMN Altitude.Object + + ZONE_TO_NEW_REGION + Create a new region + -- 2.39.2