Added support for display of dock widget icons in DockArea tab menus

This commit is contained in:
Uwe Kindler 2018-08-27 15:40:01 +02:00
parent 3f40c997e5
commit 9cd2584de5
3 changed files with 14 additions and 2 deletions

View File

@ -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);

View File

@ -431,6 +431,13 @@ void CDockWidget::setIcon(const QIcon& Icon)
}
//============================================================================
QIcon CDockWidget::icon() const
{
return d->TitleWidget->icon();
}
} // namespace ads

View File

@ -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.