czyt1988 / SARibbon

Ribbon Control for Qt
MIT License
1.06k stars 316 forks source link

Switching to classic menu bar #38

Closed yanis60 closed 2 years ago

yanis60 commented 2 years ago

Hi, Is it possible to switch to classic menu bar?

czyt1988 commented 2 years ago

Yes, the constructor of SARibbonMainWindow provides an argument : useRibbon, which defaults to true, and if set to false, it will be same as the QMainWindow.

SARibbonMainWindow(QWidget *parent = nullptr, bool useRibbon = true);

However, online switching is not supported, the software needs to be restarted, and the developer can read the user settings through the configuration file in the main function, and determine whether to use ribbon mode or traditional mode when constructing Mainwindow

yanis60 commented 2 years ago

Thank you, *could you please add function that allows to create classic menu ? I mean insert menus and actions from ribbon elements.

czyt1988 commented 2 years ago

I'm not sure what “Insert menu and actions from ribbon elements” means:add an classic menu to SARibbonPannel? SARibbonPannel provides a set of functions to add menus and actions:

void addAction(QAction* act, QToolButton::ToolButtonPopupMode popMode, SARibbonPannelItem::RowProportion rp = SARibbonPannelItem::Large);
SARibbonToolButton* addMenu(QMenu* menu,
                                SARibbonPannelItem::RowProportion rp,
                                QToolButton::ToolButtonPopupMode popMode = QToolButton::InstantPopup);
SARibbonToolButton* addActionMenu(QAction* action, QMenu* menu, SARibbonPannelItem::RowProportion rp);
yanis60 commented 2 years ago

no i mean transform ribbon and it elements to classic menu QMenubar

czyt1988 commented 2 years ago

This requirement cannot be met at present, but it can be realized in other ways. As mentioned earlier, in the main function, read the information through the configuration file to determine whether to use the ribbon mode, and then construct the menu according to the ribbon mode and menu bar mode in the construction process of MainWindow. The reason why this method is not implemented is that the ribbon bar is different from the traditional menu bar. The menu bar can be converted to the ribbon bar, but the ribbon bar cannot be converted to the menu bar, because the ribbon bar has some complex controls that the menu bar does not have

yanis60 commented 2 years ago

ok never mind, thank you so much for the best project ;)