Skip to content

Commit 9cd2584

Browse files
author
Uwe Kindler
committed
Added support for display of dock widget icons in DockArea tab menus
1 parent 3f40c99 commit 9cd2584

File tree

3 files changed

+14
-2
lines changed

3 files changed

+14
-2
lines changed

src/DockAreaWidget.cpp

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -224,12 +224,12 @@ void DockAreaWidgetPrivate::addTabsMenuEntry(CDockWidget* DockWidget,
224224
QAction* Action;
225225
if (Index >= 0 && Index < menu->actions().count())
226226
{
227-
Action = new QAction(DockWidget->windowTitle());
227+
Action = new QAction(DockWidget->icon(), DockWidget->windowTitle());
228228
menu->insertAction(menu->actions().at(Index), Action);
229229
}
230230
else
231231
{
232-
Action = menu->addAction(DockWidget->windowTitle());
232+
Action = menu->addAction(DockWidget->icon(), DockWidget->windowTitle());
233233
}
234234
QVariant vAction = QVariant::fromValue(Action);
235235
DockWidget->setProperty(ACTION_PROPERTY, vAction);

src/DockWidget.cpp

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -431,6 +431,13 @@ void CDockWidget::setIcon(const QIcon& Icon)
431431
}
432432

433433

434+
//============================================================================
435+
QIcon CDockWidget::icon() const
436+
{
437+
return d->TitleWidget->icon();
438+
}
439+
440+
434441

435442
} // namespace ads
436443

src/DockWidget.h

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -227,6 +227,11 @@ class ADS_EXPORT CDockWidget : public QFrame
227227
*/
228228
void setIcon(const QIcon& Icon);
229229

230+
/**
231+
* Returns tzhe icon that has been assigned to the dock widget
232+
*/
233+
QIcon icon() const;
234+
230235
public slots:
231236
/**
232237
* This property controls whether the dock widget is open or closed.

0 commit comments

Comments
 (0)