From 9cd2584de58cd98084861398fffa595efd8f5f77 Mon Sep 17 00:00:00 2001 From: Uwe Kindler Date: Mon, 27 Aug 2018 15:40:01 +0200 Subject: [PATCH] Added support for display of dock widget icons in DockArea tab menus --- src/DockAreaWidget.cpp | 4 ++-- src/DockWidget.cpp | 7 +++++++ src/DockWidget.h | 5 +++++ 3 files changed, 14 insertions(+), 2 deletions(-) diff --git a/src/DockAreaWidget.cpp b/src/DockAreaWidget.cpp index c2611bf..9d0c5ad 100644 --- a/src/DockAreaWidget.cpp +++ b/src/DockAreaWidget.cpp @@ -224,12 +224,12 @@ void DockAreaWidgetPrivate::addTabsMenuEntry(CDockWidget* DockWidget, QAction* Action; if (Index >= 0 && Index < menu->actions().count()) { - Action = new QAction(DockWidget->windowTitle()); + Action = new QAction(DockWidget->icon(), DockWidget->windowTitle()); menu->insertAction(menu->actions().at(Index), Action); } else { - Action = menu->addAction(DockWidget->windowTitle()); + Action = menu->addAction(DockWidget->icon(), DockWidget->windowTitle()); } QVariant vAction = QVariant::fromValue(Action); DockWidget->setProperty(ACTION_PROPERTY, vAction); diff --git a/src/DockWidget.cpp b/src/DockWidget.cpp index 24d10af..a1e0313 100644 --- a/src/DockWidget.cpp +++ b/src/DockWidget.cpp @@ -431,6 +431,13 @@ void CDockWidget::setIcon(const QIcon& Icon) } +//============================================================================ +QIcon CDockWidget::icon() const +{ + return d->TitleWidget->icon(); +} + + } // namespace ads diff --git a/src/DockWidget.h b/src/DockWidget.h index 7f75176..0df4318 100644 --- a/src/DockWidget.h +++ b/src/DockWidget.h @@ -227,6 +227,11 @@ public: */ void setIcon(const QIcon& Icon); + /** + * Returns tzhe icon that has been assigned to the dock widget + */ + QIcon icon() const; + public slots: /** * This property controls whether the dock widget is open or closed.