@@ -97,6 +97,23 @@ struct DockAreaTitleBarPrivate
97
97
{
98
98
return DockArea->dockManager ()->configFlags ().testFlag (Flag);
99
99
}
100
+
101
+ /* *
102
+ * Helper class to set title bar burron icons depending on operating system
103
+ * and to avoid duplicated code
104
+ */
105
+ void setTitleBarButtonIcon (tTileBarButton* Button, QStyle::StandardPixmap StandarPixmap)
106
+ {
107
+ #ifdef Q_OS_LINUX
108
+ Button->setIcon (_this->style ()->standardIcon (StandarPixmap));
109
+ #else
110
+ QIcon Icon;
111
+ QPixmap normalPixmap = _this->style ()->standardPixmap (StandarPixmap, 0 , Button);
112
+ Icon.addPixmap (internal::createTransparentPixmap (normalPixmap, 0.25 ), QIcon::Disabled);
113
+ Icon.addPixmap (normalPixmap, QIcon::Normal);
114
+ Button->setIcon (Icon);
115
+ #endif
116
+ }
100
117
};// struct DockAreaTitleBarPrivate
101
118
102
119
@@ -112,18 +129,12 @@ DockAreaTitleBarPrivate::DockAreaTitleBarPrivate(CDockAreaTitleBar* _public) :
112
129
// ============================================================================
113
130
void DockAreaTitleBarPrivate::createButtons ()
114
131
{
132
+ // Tabs menu button
115
133
TabsMenuButton = new tTileBarButton ();
116
134
TabsMenuButton->setObjectName (" tabsMenuButton" );
117
135
TabsMenuButton->setAutoRaise (true );
118
136
TabsMenuButton->setPopupMode (QToolButton::InstantPopup);
119
-
120
- QIcon MenuIcon;
121
- QPixmap normalPixmap = _this->style ()->standardPixmap (
122
- QStyle::SP_TitleBarUnshadeButton, 0 , TabsMenuButton);
123
- MenuIcon.addPixmap (internal::createTransparentPixmap (normalPixmap, 0.25 ), QIcon::Disabled);
124
- MenuIcon.addPixmap (normalPixmap, QIcon::Normal);
125
- TabsMenuButton->setIcon (MenuIcon);
126
-
137
+ setTitleBarButtonIcon (TabsMenuButton, QStyle::SP_TitleBarUnshadeButton);
127
138
QMenu* TabsMenu = new QMenu (TabsMenuButton);
128
139
#ifndef QT_NO_TOOLTIP
129
140
TabsMenu->setToolTipsVisible (true );
@@ -138,33 +149,25 @@ void DockAreaTitleBarPrivate::createButtons()
138
149
_this->connect (TabsMenuButton->menu (), SIGNAL (triggered (QAction*)),
139
150
SLOT (onTabsMenuActionTriggered (QAction*)));
140
151
152
+
141
153
// Undock button
142
154
UndockButton = new tTileBarButton ();
143
155
UndockButton->setObjectName (" undockButton" );
144
156
UndockButton->setAutoRaise (true );
145
157
#ifndef QT_NO_TOOLTIP
146
158
UndockButton->setToolTip (QObject::tr (" Detach Group" ));
147
159
#endif
148
- QIcon UndockIcon;
149
- normalPixmap = _this->style ()->standardPixmap (QStyle::SP_TitleBarNormalButton, 0 , UndockButton);
150
- UndockIcon.addPixmap (internal::createTransparentPixmap (normalPixmap, 0.25 ), QIcon::Disabled);
151
- UndockIcon.addPixmap (normalPixmap, QIcon::Normal);
152
- UndockButton->setIcon (UndockIcon);
153
- UndockButton->setSizePolicy (QSizePolicy::Fixed, QSizePolicy::Expanding);
160
+ setTitleBarButtonIcon (UndockButton, QStyle::SP_TitleBarNormalButton);
161
+ UndockButton->setSizePolicy (QSizePolicy::Fixed, QSizePolicy::Expanding);
154
162
TopLayout->addWidget (UndockButton, 0 );
155
163
_this->connect (UndockButton, SIGNAL (clicked ()), SLOT (onUndockButtonClicked ()));
156
164
165
+
166
+ // Close button
157
167
CloseButton = new tTileBarButton ();
158
168
CloseButton->setObjectName (" closeButton" );
159
169
CloseButton->setAutoRaise (true );
160
-
161
- // The standard icons does not look good on high DPI screens
162
- QIcon CloseIcon;// = _this->style()->standardIcon(QStyle::SP_TitleBarCloseButton);
163
- normalPixmap = _this->style ()->standardPixmap (QStyle::SP_TitleBarCloseButton, 0 , CloseButton);
164
- CloseIcon.addPixmap (internal::createTransparentPixmap (normalPixmap, 0.25 ), QIcon::Disabled);
165
- CloseIcon.addPixmap (normalPixmap, QIcon::Normal);
166
-
167
- CloseButton->setIcon (CloseIcon);
170
+ setTitleBarButtonIcon (CloseButton, QStyle::SP_TitleBarCloseButton);
168
171
#ifndef QT_NO_TOOLTIP
169
172
if (testConfigFlag (CDockManager::DockAreaCloseButtonClosesTab))
170
173
{
0 commit comments