From: sbh Date: Thu, 21 Aug 2014 11:38:59 +0000 (+0400) Subject: Refresh menu size after chnges in preferences X-Git-Tag: V_0.4.4~99 X-Git-Url: http://git.salome-platform.org/gitweb/?a=commitdiff_plain;h=4224f4dbe7ceaefe74b5d6b79a5840a9f5df2d7a;p=modules%2Fshaper.git Refresh menu size after chnges in preferences --- diff --git a/src/XGUI/XGUI_MainMenu.cpp b/src/XGUI/XGUI_MainMenu.cpp index 1bd8d8eb0..fb5fbce21 100644 --- a/src/XGUI/XGUI_MainMenu.cpp +++ b/src/XGUI/XGUI_MainMenu.cpp @@ -32,7 +32,7 @@ XGUI_MainMenu::XGUI_MainMenu(XGUI_MainWindow *parent) aMainLayout->setContentsMargins(0, 2, 2, 0); aMainLayout->setSpacing(2); setLayout(aMainLayout); - setFixedHeight(menuHeight()); + updateFromResources(); } XGUI_MainMenu::~XGUI_MainMenu(void) @@ -122,16 +122,14 @@ QList XGUI_MainMenu::features() const int XGUI_MainMenu::menuItemSize() const { const int kDefaultItemSize = 25; - int anItemSize = XGUI_Preferences::resourceMgr()->integerValue( - XGUI_Preferences::MENU_SECTION, "item_size", kDefaultItemSize); - return anItemSize; + return kDefaultItemSize; } int XGUI_MainMenu::menuHeight() const { // Default group has no tabs above --> one extra row int rows = menuItemRowsCount() + 1; - const int kMarginsSpacings = 4; + const int kMarginsSpacings = 5; return rows * menuItemSize() + kMarginsSpacings; } @@ -145,4 +143,6 @@ int XGUI_MainMenu::menuItemRowsCount() const void XGUI_MainMenu::updateFromResources() { + setFixedHeight(menuHeight()); + repaint(); } diff --git a/src/XGUI/XGUI_MainMenu.h b/src/XGUI/XGUI_MainMenu.h index 4f3168548..4c3f0ec67 100644 --- a/src/XGUI/XGUI_MainMenu.h +++ b/src/XGUI/XGUI_MainMenu.h @@ -26,14 +26,6 @@ class XGUI_EXPORT XGUI_MainMenu: public QWidget { Q_OBJECT - //! Size of menu item - //TODO(sbh, vsv): Move to the settings - //enum ItemSize { - // Small = 20, - // Medium = 25, - // Large = 30 - //}; - public: XGUI_MainMenu(XGUI_MainWindow *parent); virtual ~XGUI_MainMenu(); diff --git a/src/XGUI/XGUI_Preferences.cpp b/src/XGUI/XGUI_Preferences.cpp index 266580799..4df3d1296 100644 --- a/src/XGUI/XGUI_Preferences.cpp +++ b/src/XGUI/XGUI_Preferences.cpp @@ -154,19 +154,7 @@ void XGUI_PreferencesDlg::createMenuPage(int thePageId) int aMenuTab = myPreferences->addItem(tr("Main menu"), thePageId ); int aSizeGroup = myPreferences->addItem(tr("Size"), aMenuTab ); - myPreferences->setItemProperty( "columns", 2, aSizeGroup ); - - int aItemSizeItem = myPreferences->addItem( tr( "Item size" ), - aSizeGroup, - SUIT_PreferenceMgr::Selector, - XGUI_Preferences::MENU_SECTION, - "item_size" ); - QStringList aValuesList; - QList anIndicesList; - aValuesList << tr("Small") << tr("Medium") << tr("Large"); - anIndicesList << 20 << 25 << 30; - myPreferences->setItemProperty( "strings", aValuesList, aItemSizeItem ); - myPreferences->setItemProperty( "indexes", anIndicesList, aItemSizeItem ); + myPreferences->setItemProperty( "columns", 1, aSizeGroup ); int aRowsNb = myPreferences->addItem( tr( "Number of rows" ), aSizeGroup, @@ -174,7 +162,7 @@ void XGUI_PreferencesDlg::createMenuPage(int thePageId) XGUI_Preferences::MENU_SECTION, "rows_number" ); myPreferences->setItemProperty( "min", 1, aRowsNb ); - myPreferences->setItemProperty( "max", 10, aRowsNb ); + myPreferences->setItemProperty( "max", 6, aRowsNb ); }