Merge pull request #129 from mateoconlechuga/master

Add support for setting toggle action icon
This commit is contained in:
Sergio Martins
2021-01-07 16:09:34 +00:00
committed by GitHub
2 changed files with 10 additions and 3 deletions

View File

@@ -393,6 +393,9 @@ void DockWidgetBase::setIcon(const QIcon &icon, IconPlaces places)
if (places & IconPlace::TabBar)
d->tabBarIcon = icon;
if (places & IconPlace::ToggleAction)
d->toggleAction->setIcon(icon);
Q_EMIT iconChanged();
}
@@ -404,6 +407,9 @@ QIcon DockWidgetBase::icon(IconPlace place) const
if (place == IconPlace::TabBar)
return d->tabBarIcon;
if (place == IconPlace::ToggleAction)
return d->toggleAction->icon();
return {};
}

View File

@@ -82,7 +82,8 @@ public:
enum class IconPlace {
TitleBar = 1,
TabBar = 2,
All = TitleBar | TabBar
ToggleAction = 4,
All = ToggleAction | TitleBar | TabBar
};
Q_ENUM(IconPlace)
Q_DECLARE_FLAGS(IconPlaces, IconPlace)
@@ -229,7 +230,7 @@ public:
/**
* @brief Sets an icon to show on title bars and tab bars.
* @param places Specifies where the icon will be shown (TitleBar, TabBar or both)
* @param places Specifies where the icon will be shown (TitleBar, TabBar, ToggleAction, or All)
*
* By default there's no icon set.
*
@@ -238,7 +239,7 @@ public:
void setIcon(const QIcon &icon, IconPlaces places = IconPlace::All);
/**
* @brief Returns the dock widget's titlebar or tabbar icon (depending on the passed @p place)
* @brief Returns the dock widget's titlebar, tabbar, or toggle action icon (depending on the passed @p place)
*
* By default it's null.
*