From c556183e8ff8a576a352c9b31ab19f6fdd7b279d Mon Sep 17 00:00:00 2001 From: vsr Date: Tue, 3 Jul 2007 11:41:41 +0000 Subject: [PATCH] Porting to Qt 4 --- src/CAM/CAM_Module.cxx | 2 +- src/LightApp/LightApp_Application.cxx | 4 +- src/Qtx/QtxActionMenuMgr.cxx | 64 ++++++------------------- src/Qtx/QtxActionMenuMgr.h | 5 +- src/STD/STD_Application.cxx | 10 ++-- src/SalomeApp/SalomeApp_Application.cxx | 6 +-- src/TOOLSGUI/ToolsGUI_RegWidget.h | 3 +- 7 files changed, 29 insertions(+), 65 deletions(-) diff --git a/src/CAM/CAM_Module.cxx b/src/CAM/CAM_Module.cxx index d753c7f90..a53c7e1cb 100755 --- a/src/CAM/CAM_Module.cxx +++ b/src/CAM/CAM_Module.cxx @@ -862,7 +862,7 @@ QAction* CAM_Module::createAction( const int id, const QString& text, const QIco a->setStatusTip( tip ); if ( reciever && member ) - connect( a, SIGNAL( activated() ), reciever, member ); + connect( a, SIGNAL( triggered( bool ) ), reciever, member ); registerAction( id, a ); diff --git a/src/LightApp/LightApp_Application.cxx b/src/LightApp/LightApp_Application.cxx index 7f29c1cd7..0b9a534c1 100644 --- a/src/LightApp/LightApp_Application.cxx +++ b/src/LightApp/LightApp_Application.cxx @@ -615,8 +615,8 @@ void LightApp_Application::createActions() createMenu( RenameId, windowMenu, -1 ); int fileMenu = createMenu( tr( "MEN_DESK_FILE" ), -1 ); - createMenu( PreferencesId, fileMenu, 15, -1 ); - createMenu( separator(), fileMenu, -1, 15, -1 ); + createMenu( PreferencesId, fileMenu, 50, -1 ); + createMenu( separator(), fileMenu, -1, 50, -1 ); /* createMenu( separator(), fileMenu, -1, 100, -1 ); diff --git a/src/Qtx/QtxActionMenuMgr.cxx b/src/Qtx/QtxActionMenuMgr.cxx index dce08b4ac..dea19a613 100644 --- a/src/Qtx/QtxActionMenuMgr.cxx +++ b/src/Qtx/QtxActionMenuMgr.cxx @@ -28,11 +28,6 @@ #include #include -// VSR: Uncomment this #define in order to allow dynamic menus support -// (emit signals when popup menu is pre-activated) -// Currently this support is disabled. -//#define ENABLE_DYNAMIC_MENU - /*! \class QtxActionMenuMgr::MenuNode \internal @@ -115,10 +110,6 @@ QtxActionMenuMgr::QtxActionMenuMgr( QMainWindow* p ) { if ( myMenu ) { connect( myMenu, SIGNAL( destroyed( QObject* ) ), this, SLOT( onDestroyed( QObject* ) ) ); -#ifdef ENABLE_DYNAMIC_MENU - if ( myMenu->inherits( "QMenuBar" ) ) - connect( myMenu, SIGNAL( hovered( QAction* ) ), this, SLOT( onHighlighted( QAction* ) ) ); -#endif } } @@ -134,10 +125,6 @@ QtxActionMenuMgr::QtxActionMenuMgr( QWidget* mw, QObject* p ) { if ( myMenu ) { connect( myMenu, SIGNAL( destroyed( QObject* ) ), this, SLOT( onDestroyed( QObject* ) ) ); -#ifdef ENABLE_DYNAMIC_MENU - if ( myMenu->inherits( "QMenuBar" ) ) - connect( myMenu, SIGNAL( hovered( QAction* ) ), this, SLOT( onHighlighted( QAction* ) ) ); -#endif } } @@ -339,9 +326,6 @@ int QtxActionMenuMgr::insert( const QString& title, const int pId, const int gro connect( ma->menu(), SIGNAL( aboutToShow() ), this, SLOT( onAboutToShow() ) ); connect( ma->menu(), SIGNAL( aboutToHide() ), this, SLOT( onAboutToHide() ) ); -#ifdef ENABLE_DYNAMIC_MENU - connect( ma->menu(), SIGNAL( hovered( QAction* ) ), this, SLOT( onHighlighted( QAction* ) ) ); -#endif MenuNode* node = new MenuNode( pNode, myMenus.insert( gid, ma ).key(), idx, group ); @@ -602,35 +586,6 @@ void QtxActionMenuMgr::onDestroyed( QObject* obj ) myMenu = 0; } -/*! - \brief Called when menu item is highlighted. - \param id menu item being highlighted ID -*/ -void QtxActionMenuMgr::onHighlighted( QAction* a ) -{ - const QObject* snd = sender(); - int pid = 0; - if ( myMenu && snd == myMenu ) - pid = -1; - else - { - for ( MenuMap::Iterator itr = myMenus.begin(); itr != myMenus.end(); ++itr ) - { - if ( itr.value()->menu() && itr.value()->menu() == snd ) - pid = itr.key(); - } - } - if ( pid ) - { - int realId = menuActionId( a ); - if ( realId != -1 ) - { - emit menuHighlighted( pid, realId ); - triggerUpdate( realId ); - } - } -} - /*! \brief Returns the menu widget. */ @@ -1063,6 +1018,20 @@ bool QtxActionMenuMgr::containsMenu( const int id, const int pid ) const return (bool)find( id, pid, false ); } +/*! + \brief Get menu by the specified identifier. + \param id menu item ID + \return \c menu poiter or 0 if menu is not found +*/ +QMenu* QtxActionMenuMgr::findMenu( const int id ) const +{ + QMenu* m = 0; + QAction* a = menuAction( id ); + if ( a ) + m = a->menu(); + return m; +} + /*! \brief Perform delayed menu update. \param id menu item ID @@ -1196,8 +1165,3 @@ int QtxActionMenuMgr::MenuCreator::append( const QString& tag, const bool subMen \brief Emitted when the menu is about to be hidden. \param m menu being hidden */ - -/*! - \fn void QtxActionMenuMgr::menuHighlighted( int, int ) - \brief Emitted when the menu is hightlighted [obsolete]. -*/ diff --git a/src/Qtx/QtxActionMenuMgr.h b/src/Qtx/QtxActionMenuMgr.h index bff1fbaf7..5bc0c800a 100644 --- a/src/Qtx/QtxActionMenuMgr.h +++ b/src/Qtx/QtxActionMenuMgr.h @@ -93,18 +93,17 @@ public: bool containsMenu( const QString&, const int ) const; bool containsMenu( const int, const int ) const; + QMenu* findMenu( const int ) const; + private slots: void onAboutToShow(); void onAboutToHide(); - void onHighlighted( QAction* ); void onDestroyed( QObject* ); signals: void menuAboutToShow( QMenu* ); void menuAboutToHide( QMenu* ); - void menuHighlighted( int, int ); - protected: void setMenuWidget( QWidget* ); diff --git a/src/STD/STD_Application.cxx b/src/STD/STD_Application.cxx index 5c554f9a1..46522f56e 100755 --- a/src/STD/STD_Application.cxx +++ b/src/STD/STD_Application.cxx @@ -218,11 +218,11 @@ void STD_Application::createActions() createMenu( FileNewId, fileMenu, 0 ); createMenu( FileOpenId, fileMenu, 0 ); - createMenu( FileCloseId, fileMenu, 0 ); - createMenu( separator(), fileMenu, -1, 0 ); - createMenu( FileSaveId, fileMenu, 0 ); - createMenu( FileSaveAsId, fileMenu, 0 ); - createMenu( separator(), fileMenu, -1, 0 ); + createMenu( FileCloseId, fileMenu, 5 ); + createMenu( separator(), fileMenu, -1, 5 ); + createMenu( FileSaveId, fileMenu, 5 ); + createMenu( FileSaveAsId, fileMenu, 5 ); + createMenu( separator(), fileMenu, -1, 5 ); createMenu( separator(), fileMenu ); createMenu( FileExitId, fileMenu ); diff --git a/src/SalomeApp/SalomeApp_Application.cxx b/src/SalomeApp/SalomeApp_Application.cxx index 50c7a9315..dce4fc577 100644 --- a/src/SalomeApp/SalomeApp_Application.cxx +++ b/src/SalomeApp/SalomeApp_Application.cxx @@ -271,11 +271,11 @@ void SalomeApp_Application::createActions() createMenu( FileLoadId, fileMenu, 0 ); //SRN: BugID IPAL9021, add a menu item "Load" createMenu( DumpStudyId, fileMenu, 10, -1 ); - createMenu( separator(), fileMenu, -1, 15, -1 ); + createMenu( separator(), fileMenu, -1, 10, -1 ); createMenu( LoadScriptId, fileMenu, 10, -1 ); - createMenu( separator(), fileMenu, -1, 15, -1 ); + createMenu( separator(), fileMenu, -1, 10, -1 ); createMenu( PropertiesId, fileMenu, 10, -1 ); - createMenu( separator(), fileMenu, -1, 15, -1 ); + createMenu( separator(), fileMenu, -1, 10, -1 ); int toolsMenu = createMenu( tr( "MEN_DESK_TOOLS" ), -1, MenuToolsId, 50 ); createMenu( CatalogGenId, toolsMenu, 10, -1 ); diff --git a/src/TOOLSGUI/ToolsGUI_RegWidget.h b/src/TOOLSGUI/ToolsGUI_RegWidget.h index 00ba8c8d5..560a09a77 100755 --- a/src/TOOLSGUI/ToolsGUI_RegWidget.h +++ b/src/TOOLSGUI/ToolsGUI_RegWidget.h @@ -49,8 +49,9 @@ class TOOLSGUI_EXPORT ToolsGUI_RegWidget : public QMainWindow class ToolsGUI_IntervalWindow; class ToolsGUI_InfoWindow; -public: ToolsGUI_RegWidget( CORBA::ORB_var& orb, QWidget* parent = 0 ); + +public: ~ToolsGUI_RegWidget(); void SetListe(); -- 2.39.2