From f3acf35aeac63e63c845368115686393b4bb09ad Mon Sep 17 00:00:00 2001 From: leo78913 Date: Fri, 30 Dec 2022 21:08:10 -0300 Subject: refactor: Port the main window to a .ui file some stuff still needs to be done in the c++ side because qt designer is dumb >:( the instance toolbar icon and instance name buttons are still added manually inside MainWindow.cpp looks almost identical, with some minor tweaks: - the instance toolbar is now a WideBar, so you can customize what actions you want :D - the instance toolbar buttons are now fullwidth - the close window button is now at the end of the file menu - the help menu has some layout changes this also fixes some stuff: - menus not having tooltips - the top toolbar not connecting to the title bar in kde - the instance toolbar separators looking weird after you move the toolbar Signed-off-by: leo78913 --- launcher/ui/widgets/WideBar.cpp | 7 +++++++ 1 file changed, 7 insertions(+) (limited to 'launcher/ui/widgets') diff --git a/launcher/ui/widgets/WideBar.cpp b/launcher/ui/widgets/WideBar.cpp index cee2038f..a029b0a8 100644 --- a/launcher/ui/widgets/WideBar.cpp +++ b/launcher/ui/widgets/WideBar.cpp @@ -10,6 +10,9 @@ class ActionButton : public QToolButton { ActionButton(QAction* action, QWidget* parent = nullptr) : QToolButton(parent), m_action(action) { setSizePolicy(QSizePolicy::Expanding, QSizePolicy::Preferred); + setToolButtonStyle(Qt::ToolButtonTextBesideIcon); + // workaround for breeze and breeze forks + setProperty("_kde_toolButton_alignment", Qt::AlignLeft); connect(action, &QAction::changed, this, &ActionButton::actionChanged); connect(this, &ActionButton::clicked, action, &QAction::trigger); @@ -21,6 +24,10 @@ class ActionButton : public QToolButton { { setEnabled(m_action->isEnabled()); setChecked(m_action->isChecked()); + setMenu(m_action->menu()); + if (menu()) { + setPopupMode(QToolButton::MenuButtonPopup); + } setCheckable(m_action->isCheckable()); setText(m_action->text()); setIcon(m_action->icon()); -- cgit