From 84d0f4fb6fa6753cf700a1d19fd336128efd7b3d Mon Sep 17 00:00:00 2001 From: wmayer Date: Thu, 10 Nov 2022 21:09:03 +0100 Subject: [PATCH] Gui: fix regression: show commands of selected category in Toolbar tab --- src/Gui/DlgKeyboardImp.h | 3 +-- src/Gui/DlgToolbarsImp.cpp | 11 +++++++++++ src/Gui/DlgToolbarsImp.h | 2 ++ 3 files changed, 14 insertions(+), 2 deletions(-) diff --git a/src/Gui/DlgKeyboardImp.h b/src/Gui/DlgKeyboardImp.h index 24b8f79fd2..04acbfbff9 100644 --- a/src/Gui/DlgKeyboardImp.h +++ b/src/Gui/DlgKeyboardImp.h @@ -85,8 +85,6 @@ public: AccelLineEdit *currentShortcut = nullptr); protected: - void showEvent(QShowEvent* e) override; - /** @name Internal helper function for handling command list widgets */ //@{ @@ -115,6 +113,7 @@ protected Q_SLOTS: void onModifyMacroAction(const QByteArray&) override; protected: + void showEvent(QShowEvent* e) override; void changeEvent(QEvent *e) override; void setShortcutOfCurrentAction(const QString&); diff --git a/src/Gui/DlgToolbarsImp.cpp b/src/Gui/DlgToolbarsImp.cpp index 5da2271086..6d4470aa32 100644 --- a/src/Gui/DlgToolbarsImp.cpp +++ b/src/Gui/DlgToolbarsImp.cpp @@ -782,6 +782,17 @@ void DlgCustomToolbarsImp::moveDownCustomCommand(const QString& name, const QByt } } +void DlgCustomToolbarsImp::showEvent(QShowEvent* event) +{ + Q_UNUSED(event); + // If we did this already in the constructor we wouldn't get the vertical scrollbar if needed. + // The problem was noticed with Qt 4.1.4 but may arise with any later version. + if (firstShow) { + ui->categoryBox->activated(ui->categoryBox->currentIndex()); + firstShow = false; + } +} + void DlgCustomToolbarsImp::changeEvent(QEvent *e) { DlgCustomToolbars::changeEvent(e); diff --git a/src/Gui/DlgToolbarsImp.h b/src/Gui/DlgToolbarsImp.h index 27ba121dd4..8a341f6636 100644 --- a/src/Gui/DlgToolbarsImp.h +++ b/src/Gui/DlgToolbarsImp.h @@ -102,6 +102,7 @@ public: ~DlgCustomToolbarsImp() override; protected: + void showEvent(QShowEvent* e) override; void changeEvent(QEvent *e) override; void addCustomToolbar(const QString&) override; void removeCustomToolbar(const QString&) override; @@ -114,6 +115,7 @@ protected: private: QList getActionGroup(QAction*); void setActionGroup(QAction*, const QList& group); + bool firstShow = true; }; /** This class implements the creation of user defined toolbox bars.