Absolute File Name: | /home/qt/qt5_coco/qt5/qtbase/src/widgets/styles/qgtkstyle.cpp |
Source code | Switch to Preprocessed file |
Line | Source | Count | ||||||||||||||||||||||||||||||||||||
---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
1 | /**************************************************************************** | - | ||||||||||||||||||||||||||||||||||||
2 | ** | - | ||||||||||||||||||||||||||||||||||||
3 | ** Copyright (C) 2015 The Qt Company Ltd. | - | ||||||||||||||||||||||||||||||||||||
4 | ** Contact: http://www.qt.io/licensing/ | - | ||||||||||||||||||||||||||||||||||||
5 | ** | - | ||||||||||||||||||||||||||||||||||||
6 | ** This file is part of the QtWidgets module of the Qt Toolkit. | - | ||||||||||||||||||||||||||||||||||||
7 | ** | - | ||||||||||||||||||||||||||||||||||||
8 | ** $QT_BEGIN_LICENSE:LGPL21$ | - | ||||||||||||||||||||||||||||||||||||
9 | ** Commercial License Usage | - | ||||||||||||||||||||||||||||||||||||
10 | ** Licensees holding valid commercial Qt licenses may use this file in | - | ||||||||||||||||||||||||||||||||||||
11 | ** accordance with the commercial license agreement provided with the | - | ||||||||||||||||||||||||||||||||||||
12 | ** Software or, alternatively, in accordance with the terms contained in | - | ||||||||||||||||||||||||||||||||||||
13 | ** a written agreement between you and The Qt Company. For licensing terms | - | ||||||||||||||||||||||||||||||||||||
14 | ** and conditions see http://www.qt.io/terms-conditions. For further | - | ||||||||||||||||||||||||||||||||||||
15 | ** information use the contact form at http://www.qt.io/contact-us. | - | ||||||||||||||||||||||||||||||||||||
16 | ** | - | ||||||||||||||||||||||||||||||||||||
17 | ** GNU Lesser General Public License Usage | - | ||||||||||||||||||||||||||||||||||||
18 | ** Alternatively, this file may be used under the terms of the GNU Lesser | - | ||||||||||||||||||||||||||||||||||||
19 | ** General Public License version 2.1 or version 3 as published by the Free | - | ||||||||||||||||||||||||||||||||||||
20 | ** Software Foundation and appearing in the file LICENSE.LGPLv21 and | - | ||||||||||||||||||||||||||||||||||||
21 | ** LICENSE.LGPLv3 included in the packaging of this file. Please review the | - | ||||||||||||||||||||||||||||||||||||
22 | ** following information to ensure the GNU Lesser General Public License | - | ||||||||||||||||||||||||||||||||||||
23 | ** requirements will be met: https://www.gnu.org/licenses/lgpl.html and | - | ||||||||||||||||||||||||||||||||||||
24 | ** http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. | - | ||||||||||||||||||||||||||||||||||||
25 | ** | - | ||||||||||||||||||||||||||||||||||||
26 | ** As a special exception, The Qt Company gives you certain additional | - | ||||||||||||||||||||||||||||||||||||
27 | ** rights. These rights are described in The Qt Company LGPL Exception | - | ||||||||||||||||||||||||||||||||||||
28 | ** version 1.1, included in the file LGPL_EXCEPTION.txt in this package. | - | ||||||||||||||||||||||||||||||||||||
29 | ** | - | ||||||||||||||||||||||||||||||||||||
30 | ** $QT_END_LICENSE$ | - | ||||||||||||||||||||||||||||||||||||
31 | ** | - | ||||||||||||||||||||||||||||||||||||
32 | ****************************************************************************/ | - | ||||||||||||||||||||||||||||||||||||
33 | #include "qgtkstyle_p.h" | - | ||||||||||||||||||||||||||||||||||||
34 | - | |||||||||||||||||||||||||||||||||||||
35 | #if !defined(QT_NO_STYLE_GTK) | - | ||||||||||||||||||||||||||||||||||||
36 | - | |||||||||||||||||||||||||||||||||||||
37 | #include <private/qapplication_p.h> | - | ||||||||||||||||||||||||||||||||||||
38 | #include <QtCore/QLibrary> | - | ||||||||||||||||||||||||||||||||||||
39 | #include <QtCore/QSettings> | - | ||||||||||||||||||||||||||||||||||||
40 | #include <QtWidgets/QDialogButtonBox> | - | ||||||||||||||||||||||||||||||||||||
41 | #include <QtWidgets/QStatusBar> | - | ||||||||||||||||||||||||||||||||||||
42 | #include <QtWidgets/QLineEdit> | - | ||||||||||||||||||||||||||||||||||||
43 | #include <QtWidgets/QWidget> | - | ||||||||||||||||||||||||||||||||||||
44 | #include <QtWidgets/QListView> | - | ||||||||||||||||||||||||||||||||||||
45 | #include <QtWidgets/QApplication> | - | ||||||||||||||||||||||||||||||||||||
46 | #include <QtWidgets/QStyleOption> | - | ||||||||||||||||||||||||||||||||||||
47 | #include <QtWidgets/QPushButton> | - | ||||||||||||||||||||||||||||||||||||
48 | #include <QtGui/QPainter> | - | ||||||||||||||||||||||||||||||||||||
49 | #include <QtWidgets/QMainWindow> | - | ||||||||||||||||||||||||||||||||||||
50 | #include <QtWidgets/QToolBar> | - | ||||||||||||||||||||||||||||||||||||
51 | #include <QtWidgets/QHeaderView> | - | ||||||||||||||||||||||||||||||||||||
52 | #include <QtWidgets/QMenuBar> | - | ||||||||||||||||||||||||||||||||||||
53 | #include <QtWidgets/QComboBox> | - | ||||||||||||||||||||||||||||||||||||
54 | #include <QtWidgets/QSpinBox> | - | ||||||||||||||||||||||||||||||||||||
55 | #include <QtWidgets/QScrollBar> | - | ||||||||||||||||||||||||||||||||||||
56 | #include <QtWidgets/QAbstractButton> | - | ||||||||||||||||||||||||||||||||||||
57 | #include <QtWidgets/QToolButton> | - | ||||||||||||||||||||||||||||||||||||
58 | #include <QtWidgets/QGroupBox> | - | ||||||||||||||||||||||||||||||||||||
59 | #include <QtWidgets/QRadioButton> | - | ||||||||||||||||||||||||||||||||||||
60 | #include <QtWidgets/QCheckBox> | - | ||||||||||||||||||||||||||||||||||||
61 | #include <QtWidgets/QTreeView> | - | ||||||||||||||||||||||||||||||||||||
62 | #include <QtWidgets/QStyledItemDelegate> | - | ||||||||||||||||||||||||||||||||||||
63 | #include <QtWidgets/QWizard> | - | ||||||||||||||||||||||||||||||||||||
64 | - | |||||||||||||||||||||||||||||||||||||
65 | #include <qpixmapcache.h> | - | ||||||||||||||||||||||||||||||||||||
66 | #include <private/qstyleanimation_p.h> | - | ||||||||||||||||||||||||||||||||||||
67 | #undef signals // Collides with GTK stymbols | - | ||||||||||||||||||||||||||||||||||||
68 | #include <private/qgtkpainter_p.h> | - | ||||||||||||||||||||||||||||||||||||
69 | #include <private/qstylehelper_p.h> | - | ||||||||||||||||||||||||||||||||||||
70 | #include <private/qgtkstyle_p_p.h> | - | ||||||||||||||||||||||||||||||||||||
71 | - | |||||||||||||||||||||||||||||||||||||
72 | QT_BEGIN_NAMESPACE | - | ||||||||||||||||||||||||||||||||||||
73 | - | |||||||||||||||||||||||||||||||||||||
74 | static GtkStateType qt_gtk_state(const QStyleOption *option) | - | ||||||||||||||||||||||||||||||||||||
75 | { | - | ||||||||||||||||||||||||||||||||||||
76 | GtkStateType state = GTK_STATE_NORMAL; | - | ||||||||||||||||||||||||||||||||||||
77 | if (!(option->state & QStyle::State_Enabled))
| 0 | ||||||||||||||||||||||||||||||||||||
78 | state = GTK_STATE_INSENSITIVE; never executed: state = GTK_STATE_INSENSITIVE; | 0 | ||||||||||||||||||||||||||||||||||||
79 | else if (option->state & QStyle::State_MouseOver)
| 0 | ||||||||||||||||||||||||||||||||||||
80 | state = GTK_STATE_PRELIGHT; never executed: state = GTK_STATE_PRELIGHT; | 0 | ||||||||||||||||||||||||||||||||||||
81 | - | |||||||||||||||||||||||||||||||||||||
82 | return state; never executed: return state; | 0 | ||||||||||||||||||||||||||||||||||||
83 | } | - | ||||||||||||||||||||||||||||||||||||
84 | - | |||||||||||||||||||||||||||||||||||||
85 | static QPixmap qt_gtk_get_icon(const char* iconName, GtkIconSize size = GTK_ICON_SIZE_BUTTON) | - | ||||||||||||||||||||||||||||||||||||
86 | { | - | ||||||||||||||||||||||||||||||||||||
87 | GtkStyle *style = QGtkStylePrivate::gtkStyle(); | - | ||||||||||||||||||||||||||||||||||||
88 | GtkIconSet* iconSet = QGtkStylePrivate::gtk_icon_factory_lookup_default (iconName); | - | ||||||||||||||||||||||||||||||||||||
89 | GdkPixbuf* icon = QGtkStylePrivate::gtk_icon_set_render_icon(iconSet, | - | ||||||||||||||||||||||||||||||||||||
90 | style, | - | ||||||||||||||||||||||||||||||||||||
91 | GTK_TEXT_DIR_LTR, | - | ||||||||||||||||||||||||||||||||||||
92 | GTK_STATE_NORMAL, | - | ||||||||||||||||||||||||||||||||||||
93 | size, | - | ||||||||||||||||||||||||||||||||||||
94 | NULL, | - | ||||||||||||||||||||||||||||||||||||
95 | "button"); | - | ||||||||||||||||||||||||||||||||||||
96 | uchar* data = (uchar*)QGtkStylePrivate::gdk_pixbuf_get_pixels(icon); | - | ||||||||||||||||||||||||||||||||||||
97 | int width = QGtkStylePrivate::gdk_pixbuf_get_width(icon); | - | ||||||||||||||||||||||||||||||||||||
98 | int height = QGtkStylePrivate::gdk_pixbuf_get_height(icon); | - | ||||||||||||||||||||||||||||||||||||
99 | QImage converted(width, height, QImage::Format_ARGB32); | - | ||||||||||||||||||||||||||||||||||||
100 | uchar* tdata = (uchar*)converted.bits(); | - | ||||||||||||||||||||||||||||||||||||
101 | - | |||||||||||||||||||||||||||||||||||||
102 | for ( int index = 0 ; index < height * width*4 ; index +=4 ) {
| 0 | ||||||||||||||||||||||||||||||||||||
103 | //int index = y * rowstride + x; | - | ||||||||||||||||||||||||||||||||||||
104 | tdata[index + QT_RED] = data[index + GTK_RED]; | - | ||||||||||||||||||||||||||||||||||||
105 | tdata[index + QT_GREEN] = data[index + GTK_GREEN]; | - | ||||||||||||||||||||||||||||||||||||
106 | tdata[index + QT_BLUE] = data[index + GTK_BLUE]; | - | ||||||||||||||||||||||||||||||||||||
107 | tdata[index + QT_ALPHA] = data[index + GTK_ALPHA]; | - | ||||||||||||||||||||||||||||||||||||
108 | } never executed: end of block | 0 | ||||||||||||||||||||||||||||||||||||
109 | - | |||||||||||||||||||||||||||||||||||||
110 | QGtkStylePrivate::gdk_pixbuf_unref(icon); | - | ||||||||||||||||||||||||||||||||||||
111 | - | |||||||||||||||||||||||||||||||||||||
112 | // should we free iconset? | - | ||||||||||||||||||||||||||||||||||||
113 | return QPixmap::fromImage(converted); never executed: return QPixmap::fromImage(converted); | 0 | ||||||||||||||||||||||||||||||||||||
114 | } | - | ||||||||||||||||||||||||||||||||||||
115 | - | |||||||||||||||||||||||||||||||||||||
116 | static void qt_gtk_draw_mdibutton(QPainter *painter, const QStyleOptionTitleBar *option, const QRect &tmp, bool hover, bool sunken) | - | ||||||||||||||||||||||||||||||||||||
117 | { | - | ||||||||||||||||||||||||||||||||||||
118 | QColor dark; | - | ||||||||||||||||||||||||||||||||||||
119 | dark.setHsv(option->palette.button().color().hue(), | - | ||||||||||||||||||||||||||||||||||||
120 | qMin(255, (int)(option->palette.button().color().saturation()*1.9)), | - | ||||||||||||||||||||||||||||||||||||
121 | qMin(255, (int)(option->palette.button().color().value()*0.7))); | - | ||||||||||||||||||||||||||||||||||||
122 | - | |||||||||||||||||||||||||||||||||||||
123 | QColor highlight = option->palette.highlight().color(); | - | ||||||||||||||||||||||||||||||||||||
124 | - | |||||||||||||||||||||||||||||||||||||
125 | bool active = (option->titleBarState & QStyle::State_Active); | - | ||||||||||||||||||||||||||||||||||||
126 | QColor titleBarHighlight(255, 255, 255, 60); | - | ||||||||||||||||||||||||||||||||||||
127 | - | |||||||||||||||||||||||||||||||||||||
128 | if (sunken)
| 0 | ||||||||||||||||||||||||||||||||||||
129 | painter->fillRect(tmp.adjusted(1, 1, -1, -1), option->palette.highlight().color().darker(120)); never executed: painter->fillRect(tmp.adjusted(1, 1, -1, -1), option->palette.highlight().color().darker(120)); | 0 | ||||||||||||||||||||||||||||||||||||
130 | else if (hover)
| 0 | ||||||||||||||||||||||||||||||||||||
131 | painter->fillRect(tmp.adjusted(1, 1, -1, -1), QColor(255, 255, 255, 20)); never executed: painter->fillRect(tmp.adjusted(1, 1, -1, -1), QColor(255, 255, 255, 20)); | 0 | ||||||||||||||||||||||||||||||||||||
132 | - | |||||||||||||||||||||||||||||||||||||
133 | QColor mdiButtonGradientStartColor; | - | ||||||||||||||||||||||||||||||||||||
134 | QColor mdiButtonGradientStopColor; | - | ||||||||||||||||||||||||||||||||||||
135 | - | |||||||||||||||||||||||||||||||||||||
136 | mdiButtonGradientStartColor = QColor(0, 0, 0, 40); | - | ||||||||||||||||||||||||||||||||||||
137 | mdiButtonGradientStopColor = QColor(255, 255, 255, 60); | - | ||||||||||||||||||||||||||||||||||||
138 | - | |||||||||||||||||||||||||||||||||||||
139 | if (sunken)
| 0 | ||||||||||||||||||||||||||||||||||||
140 | titleBarHighlight = highlight.darker(130); never executed: titleBarHighlight = highlight.darker(130); | 0 | ||||||||||||||||||||||||||||||||||||
141 | - | |||||||||||||||||||||||||||||||||||||
142 | QLinearGradient gradient(tmp.center().x(), tmp.top(), tmp.center().x(), tmp.bottom()); | - | ||||||||||||||||||||||||||||||||||||
143 | gradient.setColorAt(0, mdiButtonGradientStartColor); | - | ||||||||||||||||||||||||||||||||||||
144 | gradient.setColorAt(1, mdiButtonGradientStopColor); | - | ||||||||||||||||||||||||||||||||||||
145 | QColor mdiButtonBorderColor(active ? option->palette.highlight().color().darker(180): dark.darker(110)); | - | ||||||||||||||||||||||||||||||||||||
146 | - | |||||||||||||||||||||||||||||||||||||
147 | painter->setPen(QPen(mdiButtonBorderColor, 1)); | - | ||||||||||||||||||||||||||||||||||||
148 | const QLine lines[4] = { | - | ||||||||||||||||||||||||||||||||||||
149 | QLine(tmp.left() + 2, tmp.top(), tmp.right() - 2, tmp.top()), | - | ||||||||||||||||||||||||||||||||||||
150 | QLine(tmp.left() + 2, tmp.bottom(), tmp.right() - 2, tmp.bottom()), | - | ||||||||||||||||||||||||||||||||||||
151 | QLine(tmp.left(), tmp.top() + 2, tmp.left(), tmp.bottom() - 2), | - | ||||||||||||||||||||||||||||||||||||
152 | QLine(tmp.right(), tmp.top() + 2, tmp.right(), tmp.bottom() - 2) | - | ||||||||||||||||||||||||||||||||||||
153 | }; | - | ||||||||||||||||||||||||||||||||||||
154 | painter->drawLines(lines, 4); | - | ||||||||||||||||||||||||||||||||||||
155 | const QPoint points[4] = { | - | ||||||||||||||||||||||||||||||||||||
156 | QPoint(tmp.left() + 1, tmp.top() + 1), | - | ||||||||||||||||||||||||||||||||||||
157 | QPoint(tmp.right() - 1, tmp.top() + 1), | - | ||||||||||||||||||||||||||||||||||||
158 | QPoint(tmp.left() + 1, tmp.bottom() - 1), | - | ||||||||||||||||||||||||||||||||||||
159 | QPoint(tmp.right() - 1, tmp.bottom() - 1) | - | ||||||||||||||||||||||||||||||||||||
160 | }; | - | ||||||||||||||||||||||||||||||||||||
161 | painter->drawPoints(points, 4); | - | ||||||||||||||||||||||||||||||||||||
162 | - | |||||||||||||||||||||||||||||||||||||
163 | painter->setPen(titleBarHighlight); | - | ||||||||||||||||||||||||||||||||||||
164 | painter->drawLine(tmp.left() + 2, tmp.top() + 1, tmp.right() - 2, tmp.top() + 1); | - | ||||||||||||||||||||||||||||||||||||
165 | painter->drawLine(tmp.left() + 1, tmp.top() + 2, tmp.left() + 1, tmp.bottom() - 2); | - | ||||||||||||||||||||||||||||||||||||
166 | - | |||||||||||||||||||||||||||||||||||||
167 | painter->setPen(QPen(gradient, 1)); | - | ||||||||||||||||||||||||||||||||||||
168 | painter->drawLine(tmp.right() + 1, tmp.top() + 2, tmp.right() + 1, tmp.bottom() - 2); | - | ||||||||||||||||||||||||||||||||||||
169 | painter->drawPoint(tmp.right() , tmp.top() + 1); | - | ||||||||||||||||||||||||||||||||||||
170 | - | |||||||||||||||||||||||||||||||||||||
171 | painter->drawLine(tmp.left() + 2, tmp.bottom() + 1, tmp.right() - 2, tmp.bottom() + 1); | - | ||||||||||||||||||||||||||||||||||||
172 | painter->drawPoint(tmp.left() + 1, tmp.bottom()); | - | ||||||||||||||||||||||||||||||||||||
173 | painter->drawPoint(tmp.right() - 1, tmp.bottom()); | - | ||||||||||||||||||||||||||||||||||||
174 | painter->drawPoint(tmp.right() , tmp.bottom() - 1); | - | ||||||||||||||||||||||||||||||||||||
175 | } never executed: end of block | 0 | ||||||||||||||||||||||||||||||||||||
176 | - | |||||||||||||||||||||||||||||||||||||
177 | static const char * const dock_widget_close_xpm[] = | - | ||||||||||||||||||||||||||||||||||||
178 | { | - | ||||||||||||||||||||||||||||||||||||
179 | "11 13 5 1", | - | ||||||||||||||||||||||||||||||||||||
180 | " c None", | - | ||||||||||||||||||||||||||||||||||||
181 | ". c #D5CFCB", | - | ||||||||||||||||||||||||||||||||||||
182 | "+ c #6C6A67", | - | ||||||||||||||||||||||||||||||||||||
183 | "@ c #6C6A67", | - | ||||||||||||||||||||||||||||||||||||
184 | "$ c #B5B0AC", | - | ||||||||||||||||||||||||||||||||||||
185 | " ", | - | ||||||||||||||||||||||||||||||||||||
186 | " @@@@@@@@@ ", | - | ||||||||||||||||||||||||||||||||||||
187 | "@+ +@", | - | ||||||||||||||||||||||||||||||||||||
188 | "@ +@ @+ @", | - | ||||||||||||||||||||||||||||||||||||
189 | "@ @@@ @@@ @", | - | ||||||||||||||||||||||||||||||||||||
190 | "@ @@@@@ @", | - | ||||||||||||||||||||||||||||||||||||
191 | "@ @@@ @", | - | ||||||||||||||||||||||||||||||||||||
192 | "@ @@@@@ @", | - | ||||||||||||||||||||||||||||||||||||
193 | "@ @@@ @@@ @", | - | ||||||||||||||||||||||||||||||||||||
194 | "@ +@ @+ @", | - | ||||||||||||||||||||||||||||||||||||
195 | "@+ +@", | - | ||||||||||||||||||||||||||||||||||||
196 | " @@@@@@@@@ ", | - | ||||||||||||||||||||||||||||||||||||
197 | " " | - | ||||||||||||||||||||||||||||||||||||
198 | }; | - | ||||||||||||||||||||||||||||||||||||
199 | - | |||||||||||||||||||||||||||||||||||||
200 | static const char * const dock_widget_restore_xpm[] = | - | ||||||||||||||||||||||||||||||||||||
201 | { | - | ||||||||||||||||||||||||||||||||||||
202 | "11 13 5 1", | - | ||||||||||||||||||||||||||||||||||||
203 | " c None", | - | ||||||||||||||||||||||||||||||||||||
204 | ". c #D5CFCB", | - | ||||||||||||||||||||||||||||||||||||
205 | "+ c #6C6A67", | - | ||||||||||||||||||||||||||||||||||||
206 | "@ c #6C6A67", | - | ||||||||||||||||||||||||||||||||||||
207 | "# c #6C6A67", | - | ||||||||||||||||||||||||||||||||||||
208 | " ", | - | ||||||||||||||||||||||||||||||||||||
209 | " @@@@@@@@@ ", | - | ||||||||||||||||||||||||||||||||||||
210 | "@+ +@", | - | ||||||||||||||||||||||||||||||||||||
211 | "@ #@@@# @", | - | ||||||||||||||||||||||||||||||||||||
212 | "@ @ @ @", | - | ||||||||||||||||||||||||||||||||||||
213 | "@ #@@@# @ @", | - | ||||||||||||||||||||||||||||||||||||
214 | "@ @ @ @ @", | - | ||||||||||||||||||||||||||||||||||||
215 | "@ @ @@@ @", | - | ||||||||||||||||||||||||||||||||||||
216 | "@ @ @ @", | - | ||||||||||||||||||||||||||||||||||||
217 | "@ #@@@@ @", | - | ||||||||||||||||||||||||||||||||||||
218 | "@+ +@", | - | ||||||||||||||||||||||||||||||||||||
219 | " @@@@@@@@@ ", | - | ||||||||||||||||||||||||||||||||||||
220 | " " | - | ||||||||||||||||||||||||||||||||||||
221 | }; | - | ||||||||||||||||||||||||||||||||||||
222 | - | |||||||||||||||||||||||||||||||||||||
223 | static const char * const qt_titlebar_context_help[] = { | - | ||||||||||||||||||||||||||||||||||||
224 | "10 10 3 1", | - | ||||||||||||||||||||||||||||||||||||
225 | " c None", | - | ||||||||||||||||||||||||||||||||||||
226 | "# c #000000", | - | ||||||||||||||||||||||||||||||||||||
227 | "+ c #444444", | - | ||||||||||||||||||||||||||||||||||||
228 | " +####+ ", | - | ||||||||||||||||||||||||||||||||||||
229 | " ### ### ", | - | ||||||||||||||||||||||||||||||||||||
230 | " ## ## ", | - | ||||||||||||||||||||||||||||||||||||
231 | " +##+ ", | - | ||||||||||||||||||||||||||||||||||||
232 | " +## ", | - | ||||||||||||||||||||||||||||||||||||
233 | " ## ", | - | ||||||||||||||||||||||||||||||||||||
234 | " ## ", | - | ||||||||||||||||||||||||||||||||||||
235 | " ", | - | ||||||||||||||||||||||||||||||||||||
236 | " ## ", | - | ||||||||||||||||||||||||||||||||||||
237 | " ## "}; | - | ||||||||||||||||||||||||||||||||||||
238 | - | |||||||||||||||||||||||||||||||||||||
239 | static const char * const qt_scrollbar_button_arrow_up[] = { | - | ||||||||||||||||||||||||||||||||||||
240 | "7 4 2 1", | - | ||||||||||||||||||||||||||||||||||||
241 | " c None", | - | ||||||||||||||||||||||||||||||||||||
242 | "* c #BFBFBF", | - | ||||||||||||||||||||||||||||||||||||
243 | " * ", | - | ||||||||||||||||||||||||||||||||||||
244 | " *** ", | - | ||||||||||||||||||||||||||||||||||||
245 | " ***** ", | - | ||||||||||||||||||||||||||||||||||||
246 | "*******"}; | - | ||||||||||||||||||||||||||||||||||||
247 | - | |||||||||||||||||||||||||||||||||||||
248 | static const char * const qt_scrollbar_button_arrow_down[] = { | - | ||||||||||||||||||||||||||||||||||||
249 | "7 4 2 1", | - | ||||||||||||||||||||||||||||||||||||
250 | " c None", | - | ||||||||||||||||||||||||||||||||||||
251 | "* c #BFBFBF", | - | ||||||||||||||||||||||||||||||||||||
252 | "*******", | - | ||||||||||||||||||||||||||||||||||||
253 | " ***** ", | - | ||||||||||||||||||||||||||||||||||||
254 | " *** ", | - | ||||||||||||||||||||||||||||||||||||
255 | " * "}; | - | ||||||||||||||||||||||||||||||||||||
256 | - | |||||||||||||||||||||||||||||||||||||
257 | static const int groupBoxBottomMargin = 2; // space below the groupbox | - | ||||||||||||||||||||||||||||||||||||
258 | static const int groupBoxTitleMargin = 6; // space between contents and title | - | ||||||||||||||||||||||||||||||||||||
259 | static const int groupBoxTopMargin = 2; | - | ||||||||||||||||||||||||||||||||||||
260 | - | |||||||||||||||||||||||||||||||||||||
261 | /*! | - | ||||||||||||||||||||||||||||||||||||
262 | Returns the configuration string for \a value. | - | ||||||||||||||||||||||||||||||||||||
263 | Returns \a fallback if \a value is not found. | - | ||||||||||||||||||||||||||||||||||||
264 | */ | - | ||||||||||||||||||||||||||||||||||||
265 | QString QGtkStyle::getGConfString(const QString &value, const QString &fallback) | - | ||||||||||||||||||||||||||||||||||||
266 | { | - | ||||||||||||||||||||||||||||||||||||
267 | return QGtkStylePrivate::getGConfString(value, fallback); never executed: return QGtkStylePrivate::getGConfString(value, fallback); | 0 | ||||||||||||||||||||||||||||||||||||
268 | } | - | ||||||||||||||||||||||||||||||||||||
269 | - | |||||||||||||||||||||||||||||||||||||
270 | /*! | - | ||||||||||||||||||||||||||||||||||||
271 | Returns the configuration boolean for \a key. | - | ||||||||||||||||||||||||||||||||||||
272 | Returns \a fallback if \a key is not found. | - | ||||||||||||||||||||||||||||||||||||
273 | */ | - | ||||||||||||||||||||||||||||||||||||
274 | bool QGtkStyle::getGConfBool(const QString &key, bool fallback) | - | ||||||||||||||||||||||||||||||||||||
275 | { | - | ||||||||||||||||||||||||||||||||||||
276 | return QGtkStylePrivate::getGConfBool(key, fallback); never executed: return QGtkStylePrivate::getGConfBool(key, fallback); | 0 | ||||||||||||||||||||||||||||||||||||
277 | } | - | ||||||||||||||||||||||||||||||||||||
278 | - | |||||||||||||||||||||||||||||||||||||
279 | static QColor mergedColors(const QColor &colorA, const QColor &colorB, int factor = 50) | - | ||||||||||||||||||||||||||||||||||||
280 | { | - | ||||||||||||||||||||||||||||||||||||
281 | const int maxFactor = 100; | - | ||||||||||||||||||||||||||||||||||||
282 | QColor tmp = colorA; | - | ||||||||||||||||||||||||||||||||||||
283 | tmp.setRed((tmp.red() * factor) / maxFactor + (colorB.red() * (maxFactor - factor)) / maxFactor); | - | ||||||||||||||||||||||||||||||||||||
284 | tmp.setGreen((tmp.green() * factor) / maxFactor + (colorB.green() * (maxFactor - factor)) / maxFactor); | - | ||||||||||||||||||||||||||||||||||||
285 | tmp.setBlue((tmp.blue() * factor) / maxFactor + (colorB.blue() * (maxFactor - factor)) / maxFactor); | - | ||||||||||||||||||||||||||||||||||||
286 | return tmp; never executed: return tmp; | 0 | ||||||||||||||||||||||||||||||||||||
287 | } | - | ||||||||||||||||||||||||||||||||||||
288 | - | |||||||||||||||||||||||||||||||||||||
289 | static GdkColor fromQColor(const QColor &color) | - | ||||||||||||||||||||||||||||||||||||
290 | { | - | ||||||||||||||||||||||||||||||||||||
291 | GdkColor retval; | - | ||||||||||||||||||||||||||||||||||||
292 | retval.pixel = 0; | - | ||||||||||||||||||||||||||||||||||||
293 | retval.red = color.red() * 255; | - | ||||||||||||||||||||||||||||||||||||
294 | retval.green = color.green() * 255; | - | ||||||||||||||||||||||||||||||||||||
295 | retval.blue = color.blue() * 255; | - | ||||||||||||||||||||||||||||||||||||
296 | return retval; never executed: return retval; | 0 | ||||||||||||||||||||||||||||||||||||
297 | } | - | ||||||||||||||||||||||||||||||||||||
298 | - | |||||||||||||||||||||||||||||||||||||
299 | /*! | - | ||||||||||||||||||||||||||||||||||||
300 | \class QGtkStyle | - | ||||||||||||||||||||||||||||||||||||
301 | \brief The QGtkStyle class provides a widget style rendered by GTK+ | - | ||||||||||||||||||||||||||||||||||||
302 | \since 4.5 | - | ||||||||||||||||||||||||||||||||||||
303 | - | |||||||||||||||||||||||||||||||||||||
304 | \internal | - | ||||||||||||||||||||||||||||||||||||
305 | \inmodule QtWidgets | - | ||||||||||||||||||||||||||||||||||||
306 | - | |||||||||||||||||||||||||||||||||||||
307 | The QGtkStyle style provides a look and feel that integrates well | - | ||||||||||||||||||||||||||||||||||||
308 | into GTK-based desktop environments such as the XFCe and GNOME. | - | ||||||||||||||||||||||||||||||||||||
309 | - | |||||||||||||||||||||||||||||||||||||
310 | It does this by making use of the GTK+ theme engine, ensuring | - | ||||||||||||||||||||||||||||||||||||
311 | that Qt applications look and feel native on these platforms. | - | ||||||||||||||||||||||||||||||||||||
312 | - | |||||||||||||||||||||||||||||||||||||
313 | Note: The style requires GTK+ version 2.18 or later. | - | ||||||||||||||||||||||||||||||||||||
314 | The Qt3-based "Qt" GTK+ theme engine will not work with QGtkStyle. | - | ||||||||||||||||||||||||||||||||||||
315 | - | |||||||||||||||||||||||||||||||||||||
316 | \sa QWindowsXPStyle, QMacStyle, QWindowsStyle, QFusionStyle | - | ||||||||||||||||||||||||||||||||||||
317 | */ | - | ||||||||||||||||||||||||||||||||||||
318 | - | |||||||||||||||||||||||||||||||||||||
319 | /*! | - | ||||||||||||||||||||||||||||||||||||
320 | Constructs a QGtkStyle object. | - | ||||||||||||||||||||||||||||||||||||
321 | */ | - | ||||||||||||||||||||||||||||||||||||
322 | QGtkStyle::QGtkStyle() | - | ||||||||||||||||||||||||||||||||||||
323 | : QCommonStyle(*new QGtkStylePrivate) | - | ||||||||||||||||||||||||||||||||||||
324 | { | - | ||||||||||||||||||||||||||||||||||||
325 | Q_D(QGtkStyle); | - | ||||||||||||||||||||||||||||||||||||
326 | d->init(); | - | ||||||||||||||||||||||||||||||||||||
327 | } never executed: end of block | 0 | ||||||||||||||||||||||||||||||||||||
328 | - | |||||||||||||||||||||||||||||||||||||
329 | /*! | - | ||||||||||||||||||||||||||||||||||||
330 | \internal | - | ||||||||||||||||||||||||||||||||||||
331 | - | |||||||||||||||||||||||||||||||||||||
332 | Constructs a QGtkStyle object. | - | ||||||||||||||||||||||||||||||||||||
333 | */ | - | ||||||||||||||||||||||||||||||||||||
334 | QGtkStyle::QGtkStyle(QGtkStylePrivate &dd) | - | ||||||||||||||||||||||||||||||||||||
335 | : QCommonStyle(dd) | - | ||||||||||||||||||||||||||||||||||||
336 | { | - | ||||||||||||||||||||||||||||||||||||
337 | Q_D(QGtkStyle); | - | ||||||||||||||||||||||||||||||||||||
338 | d->init(); | - | ||||||||||||||||||||||||||||||||||||
339 | } never executed: end of block | 0 | ||||||||||||||||||||||||||||||||||||
340 | - | |||||||||||||||||||||||||||||||||||||
341 | - | |||||||||||||||||||||||||||||||||||||
342 | /*! | - | ||||||||||||||||||||||||||||||||||||
343 | Destroys the QGtkStyle object. | - | ||||||||||||||||||||||||||||||||||||
344 | */ | - | ||||||||||||||||||||||||||||||||||||
345 | QGtkStyle::~QGtkStyle() | - | ||||||||||||||||||||||||||||||||||||
346 | { | - | ||||||||||||||||||||||||||||||||||||
347 | } | - | ||||||||||||||||||||||||||||||||||||
348 | - | |||||||||||||||||||||||||||||||||||||
349 | /*! | - | ||||||||||||||||||||||||||||||||||||
350 | \reimp | - | ||||||||||||||||||||||||||||||||||||
351 | */ | - | ||||||||||||||||||||||||||||||||||||
352 | QPalette QGtkStyle::standardPalette() const | - | ||||||||||||||||||||||||||||||||||||
353 | { | - | ||||||||||||||||||||||||||||||||||||
354 | Q_D(const QGtkStyle); | - | ||||||||||||||||||||||||||||||||||||
355 | - | |||||||||||||||||||||||||||||||||||||
356 | QPalette palette = QCommonStyle::standardPalette(); | - | ||||||||||||||||||||||||||||||||||||
357 | if (d->isThemeAvailable()) {
| 0 | ||||||||||||||||||||||||||||||||||||
358 | GtkStyle *style = d->gtkStyle(); | - | ||||||||||||||||||||||||||||||||||||
359 | GtkWidget *gtkButton = d->gtkWidget("GtkButton"); | - | ||||||||||||||||||||||||||||||||||||
360 | GtkWidget *gtkEntry = d->getTextColorWidget(); | - | ||||||||||||||||||||||||||||||||||||
361 | GdkColor gdkBg, gdkBase, gdkText, gdkForeground, gdkSbg, gdkSfg, gdkaSbg, gdkaSfg; | - | ||||||||||||||||||||||||||||||||||||
362 | QColor bg, base, text, fg, highlight, highlightText, inactiveHighlight, inactiveHighlightedTExt; | - | ||||||||||||||||||||||||||||||||||||
363 | gdkBg = style->bg[GTK_STATE_NORMAL]; | - | ||||||||||||||||||||||||||||||||||||
364 | gdkForeground = d->gtk_widget_get_style(gtkButton)->fg[GTK_STATE_NORMAL]; | - | ||||||||||||||||||||||||||||||||||||
365 | - | |||||||||||||||||||||||||||||||||||||
366 | // Our base and selected color is primarily used for text | - | ||||||||||||||||||||||||||||||||||||
367 | // so we assume a gtkEntry will have the most correct value | - | ||||||||||||||||||||||||||||||||||||
368 | GtkStyle *gtkEntryStyle = d->gtk_widget_get_style(gtkEntry); | - | ||||||||||||||||||||||||||||||||||||
369 | gdkBase = gtkEntryStyle->base[GTK_STATE_NORMAL]; | - | ||||||||||||||||||||||||||||||||||||
370 | gdkText = gtkEntryStyle->text[GTK_STATE_NORMAL]; | - | ||||||||||||||||||||||||||||||||||||
371 | gdkSbg = gtkEntryStyle->base[GTK_STATE_SELECTED]; | - | ||||||||||||||||||||||||||||||||||||
372 | gdkSfg = gtkEntryStyle->text[GTK_STATE_SELECTED]; | - | ||||||||||||||||||||||||||||||||||||
373 | - | |||||||||||||||||||||||||||||||||||||
374 | // The ACTIVE base color is really used for inactive windows | - | ||||||||||||||||||||||||||||||||||||
375 | gdkaSbg = gtkEntryStyle->base[GTK_STATE_ACTIVE]; | - | ||||||||||||||||||||||||||||||||||||
376 | gdkaSfg = gtkEntryStyle->text[GTK_STATE_ACTIVE]; | - | ||||||||||||||||||||||||||||||||||||
377 | - | |||||||||||||||||||||||||||||||||||||
378 | bg = QColor(gdkBg.red>>8, gdkBg.green>>8, gdkBg.blue>>8); | - | ||||||||||||||||||||||||||||||||||||
379 | text = QColor(gdkText.red>>8, gdkText.green>>8, gdkText.blue>>8); | - | ||||||||||||||||||||||||||||||||||||
380 | fg = QColor(gdkForeground.red>>8, gdkForeground.green>>8, gdkForeground.blue>>8); | - | ||||||||||||||||||||||||||||||||||||
381 | base = QColor(gdkBase.red>>8, gdkBase.green>>8, gdkBase.blue>>8); | - | ||||||||||||||||||||||||||||||||||||
382 | highlight = QColor(gdkSbg.red>>8, gdkSbg.green>>8, gdkSbg.blue>>8); | - | ||||||||||||||||||||||||||||||||||||
383 | highlightText = QColor(gdkSfg.red>>8, gdkSfg.green>>8, gdkSfg.blue>>8); | - | ||||||||||||||||||||||||||||||||||||
384 | inactiveHighlight = QColor(gdkaSbg.red>>8, gdkaSbg.green>>8, gdkaSbg.blue>>8); | - | ||||||||||||||||||||||||||||||||||||
385 | inactiveHighlightedTExt = QColor(gdkaSfg.red>>8, gdkaSfg.green>>8, gdkaSfg.blue>>8); | - | ||||||||||||||||||||||||||||||||||||
386 | - | |||||||||||||||||||||||||||||||||||||
387 | palette.setColor(QPalette::HighlightedText, highlightText); | - | ||||||||||||||||||||||||||||||||||||
388 | - | |||||||||||||||||||||||||||||||||||||
389 | - | |||||||||||||||||||||||||||||||||||||
390 | palette.setColor(QPalette::Light, bg.lighter(125)); | - | ||||||||||||||||||||||||||||||||||||
391 | palette.setColor(QPalette::Shadow, bg.darker(130)); | - | ||||||||||||||||||||||||||||||||||||
392 | palette.setColor(QPalette::Dark, bg.darker(120)); | - | ||||||||||||||||||||||||||||||||||||
393 | palette.setColor(QPalette::Text, text); | - | ||||||||||||||||||||||||||||||||||||
394 | palette.setColor(QPalette::WindowText, fg); | - | ||||||||||||||||||||||||||||||||||||
395 | palette.setColor(QPalette::ButtonText, fg); | - | ||||||||||||||||||||||||||||||||||||
396 | palette.setColor(QPalette::Base, base); | - | ||||||||||||||||||||||||||||||||||||
397 | - | |||||||||||||||||||||||||||||||||||||
398 | QColor alternateRowColor = palette.base().color().lighter(93); // ref gtkstyle.c draw_flat_box | - | ||||||||||||||||||||||||||||||||||||
399 | GtkWidget *gtkTreeView = d->gtkWidget("GtkTreeView"); | - | ||||||||||||||||||||||||||||||||||||
400 | GdkColor *gtkAltBase = NULL; | - | ||||||||||||||||||||||||||||||||||||
401 | d->gtk_widget_style_get(gtkTreeView, "odd-row-color", >kAltBase, NULL); | - | ||||||||||||||||||||||||||||||||||||
402 | if (gtkAltBase) {
| 0 | ||||||||||||||||||||||||||||||||||||
403 | alternateRowColor = QColor(gtkAltBase->red>>8, gtkAltBase->green>>8, gtkAltBase->blue>>8); | - | ||||||||||||||||||||||||||||||||||||
404 | d->gdk_color_free(gtkAltBase); | - | ||||||||||||||||||||||||||||||||||||
405 | } never executed: end of block | 0 | ||||||||||||||||||||||||||||||||||||
406 | palette.setColor(QPalette::AlternateBase, alternateRowColor); | - | ||||||||||||||||||||||||||||||||||||
407 | - | |||||||||||||||||||||||||||||||||||||
408 | palette.setColor(QPalette::Window, bg); | - | ||||||||||||||||||||||||||||||||||||
409 | palette.setColor(QPalette::Button, bg); | - | ||||||||||||||||||||||||||||||||||||
410 | palette.setColor(QPalette::Background, bg); | - | ||||||||||||||||||||||||||||||||||||
411 | QColor disabled((fg.red() + bg.red()) / 2, | - | ||||||||||||||||||||||||||||||||||||
412 | (fg.green() + bg.green())/ 2, | - | ||||||||||||||||||||||||||||||||||||
413 | (fg.blue() + bg.blue()) / 2); | - | ||||||||||||||||||||||||||||||||||||
414 | palette.setColor(QPalette::Disabled, QPalette::Text, disabled); | - | ||||||||||||||||||||||||||||||||||||
415 | palette.setColor(QPalette::Disabled, QPalette::WindowText, disabled); | - | ||||||||||||||||||||||||||||||||||||
416 | palette.setColor(QPalette::Disabled, QPalette::Foreground, disabled); | - | ||||||||||||||||||||||||||||||||||||
417 | palette.setColor(QPalette::Disabled, QPalette::ButtonText, disabled); | - | ||||||||||||||||||||||||||||||||||||
418 | palette.setColor(QPalette::Highlight, highlight); | - | ||||||||||||||||||||||||||||||||||||
419 | // calculate disabled colors by removing saturation | - | ||||||||||||||||||||||||||||||||||||
420 | highlight.setHsv(highlight.hue(), 0, highlight.value(), highlight.alpha()); | - | ||||||||||||||||||||||||||||||||||||
421 | highlightText.setHsv(highlightText.hue(), 0, highlightText.value(), highlightText.alpha()); | - | ||||||||||||||||||||||||||||||||||||
422 | palette.setColor(QPalette::Disabled, QPalette::Highlight, highlight); | - | ||||||||||||||||||||||||||||||||||||
423 | palette.setColor(QPalette::Disabled, QPalette::HighlightedText, highlightText); | - | ||||||||||||||||||||||||||||||||||||
424 | - | |||||||||||||||||||||||||||||||||||||
425 | palette.setColor(QPalette::Inactive, QPalette::HighlightedText, inactiveHighlightedTExt); | - | ||||||||||||||||||||||||||||||||||||
426 | palette.setColor(QPalette::Inactive, QPalette::Highlight, inactiveHighlight); | - | ||||||||||||||||||||||||||||||||||||
427 | - | |||||||||||||||||||||||||||||||||||||
428 | style = d->gtk_rc_get_style_by_paths(d->gtk_settings_get_default(), "gtk-tooltips", "GtkWindow", | - | ||||||||||||||||||||||||||||||||||||
429 | d->gtk_window_get_type()); | - | ||||||||||||||||||||||||||||||||||||
430 | if (style) {
| 0 | ||||||||||||||||||||||||||||||||||||
431 | gdkText = style->fg[GTK_STATE_NORMAL]; | - | ||||||||||||||||||||||||||||||||||||
432 | text = QColor(gdkText.red>>8, gdkText.green>>8, gdkText.blue>>8); | - | ||||||||||||||||||||||||||||||||||||
433 | palette.setColor(QPalette::ToolTipText, text); | - | ||||||||||||||||||||||||||||||||||||
434 | } never executed: end of block | 0 | ||||||||||||||||||||||||||||||||||||
435 | } never executed: end of block | 0 | ||||||||||||||||||||||||||||||||||||
436 | return palette; never executed: return palette; | 0 | ||||||||||||||||||||||||||||||||||||
437 | } | - | ||||||||||||||||||||||||||||||||||||
438 | - | |||||||||||||||||||||||||||||||||||||
439 | /*! | - | ||||||||||||||||||||||||||||||||||||
440 | \reimp | - | ||||||||||||||||||||||||||||||||||||
441 | */ | - | ||||||||||||||||||||||||||||||||||||
442 | void QGtkStyle::polish(QPalette &palette) | - | ||||||||||||||||||||||||||||||||||||
443 | { | - | ||||||||||||||||||||||||||||||||||||
444 | Q_D(QGtkStyle); | - | ||||||||||||||||||||||||||||||||||||
445 | - | |||||||||||||||||||||||||||||||||||||
446 | if (!d->isThemeAvailable())
| 0 | ||||||||||||||||||||||||||||||||||||
447 | QCommonStyle::polish(palette); never executed: QCommonStyle::polish(palette); | 0 | ||||||||||||||||||||||||||||||||||||
448 | else | - | ||||||||||||||||||||||||||||||||||||
449 | palette = palette.resolve(standardPalette()); never executed: palette = palette.resolve(standardPalette()); | 0 | ||||||||||||||||||||||||||||||||||||
450 | } | - | ||||||||||||||||||||||||||||||||||||
451 | - | |||||||||||||||||||||||||||||||||||||
452 | /*! | - | ||||||||||||||||||||||||||||||||||||
453 | \reimp | - | ||||||||||||||||||||||||||||||||||||
454 | */ | - | ||||||||||||||||||||||||||||||||||||
455 | void QGtkStyle::polish(QApplication *app) | - | ||||||||||||||||||||||||||||||||||||
456 | { | - | ||||||||||||||||||||||||||||||||||||
457 | Q_D(QGtkStyle); | - | ||||||||||||||||||||||||||||||||||||
458 | - | |||||||||||||||||||||||||||||||||||||
459 | QCommonStyle::polish(app); | - | ||||||||||||||||||||||||||||||||||||
460 | // Custom fonts and palettes with QtConfig are intentionally | - | ||||||||||||||||||||||||||||||||||||
461 | // not supported as these should be entirely determined by | - | ||||||||||||||||||||||||||||||||||||
462 | // current Gtk settings | - | ||||||||||||||||||||||||||||||||||||
463 | if (app->desktopSettingsAware() && d->isThemeAvailable()) {
| 0 | ||||||||||||||||||||||||||||||||||||
464 | QApplicationPrivate::setSystemPalette(standardPalette()); | - | ||||||||||||||||||||||||||||||||||||
465 | QApplicationPrivate::setSystemFont(d->getThemeFont()); | - | ||||||||||||||||||||||||||||||||||||
466 | d->applyCustomPaletteHash(); | - | ||||||||||||||||||||||||||||||||||||
467 | if (!d->isKDE4Session())
| 0 | ||||||||||||||||||||||||||||||||||||
468 | qApp->installEventFilter(&d->filter); never executed: (static_cast<QApplication *>(QCoreApplication::instance()))->installEventFilter(&d->filter); | 0 | ||||||||||||||||||||||||||||||||||||
469 | } never executed: end of block | 0 | ||||||||||||||||||||||||||||||||||||
470 | } never executed: end of block | 0 | ||||||||||||||||||||||||||||||||||||
471 | - | |||||||||||||||||||||||||||||||||||||
472 | /*! | - | ||||||||||||||||||||||||||||||||||||
473 | \reimp | - | ||||||||||||||||||||||||||||||||||||
474 | */ | - | ||||||||||||||||||||||||||||||||||||
475 | void QGtkStyle::unpolish(QApplication *app) | - | ||||||||||||||||||||||||||||||||||||
476 | { | - | ||||||||||||||||||||||||||||||||||||
477 | Q_D(QGtkStyle); | - | ||||||||||||||||||||||||||||||||||||
478 | - | |||||||||||||||||||||||||||||||||||||
479 | QCommonStyle::unpolish(app); | - | ||||||||||||||||||||||||||||||||||||
480 | QPixmapCache::clear(); | - | ||||||||||||||||||||||||||||||||||||
481 | - | |||||||||||||||||||||||||||||||||||||
482 | if (app->desktopSettingsAware() && d->isThemeAvailable() && !d->isKDE4Session())
| 0 | ||||||||||||||||||||||||||||||||||||
483 | qApp->removeEventFilter(&d->filter); never executed: (static_cast<QApplication *>(QCoreApplication::instance()))->removeEventFilter(&d->filter); | 0 | ||||||||||||||||||||||||||||||||||||
484 | } never executed: end of block | 0 | ||||||||||||||||||||||||||||||||||||
485 | - | |||||||||||||||||||||||||||||||||||||
486 | /*! | - | ||||||||||||||||||||||||||||||||||||
487 | \reimp | - | ||||||||||||||||||||||||||||||||||||
488 | */ | - | ||||||||||||||||||||||||||||||||||||
489 | - | |||||||||||||||||||||||||||||||||||||
490 | void QGtkStyle::polish(QWidget *widget) | - | ||||||||||||||||||||||||||||||||||||
491 | { | - | ||||||||||||||||||||||||||||||||||||
492 | Q_D(QGtkStyle); | - | ||||||||||||||||||||||||||||||||||||
493 | - | |||||||||||||||||||||||||||||||||||||
494 | QCommonStyle::polish(widget); | - | ||||||||||||||||||||||||||||||||||||
495 | if (!d->isThemeAvailable())
| 0 | ||||||||||||||||||||||||||||||||||||
496 | return; never executed: return; | 0 | ||||||||||||||||||||||||||||||||||||
497 | if (qobject_cast<QAbstractButton*>(widget)
| 0 | ||||||||||||||||||||||||||||||||||||
498 | || qobject_cast<QToolButton*>(widget)
| 0 | ||||||||||||||||||||||||||||||||||||
499 | || qobject_cast<QComboBox*>(widget)
| 0 | ||||||||||||||||||||||||||||||||||||
500 | || qobject_cast<QGroupBox*>(widget)
| 0 | ||||||||||||||||||||||||||||||||||||
501 | || qobject_cast<QScrollBar*>(widget)
| 0 | ||||||||||||||||||||||||||||||||||||
502 | || qobject_cast<QSlider*>(widget)
| 0 | ||||||||||||||||||||||||||||||||||||
503 | || qobject_cast<QAbstractSpinBox*>(widget)
| 0 | ||||||||||||||||||||||||||||||||||||
504 | || qobject_cast<QSpinBox*>(widget)
| 0 | ||||||||||||||||||||||||||||||||||||
505 | || qobject_cast<QHeaderView*>(widget))
| 0 | ||||||||||||||||||||||||||||||||||||
506 | widget->setAttribute(Qt::WA_Hover); never executed: widget->setAttribute(Qt::WA_Hover); | 0 | ||||||||||||||||||||||||||||||||||||
507 | #ifndef QT_NO_TREEVIEW | - | ||||||||||||||||||||||||||||||||||||
508 | else if (QTreeView *tree = qobject_cast<QTreeView *> (widget))
| 0 | ||||||||||||||||||||||||||||||||||||
509 | tree->viewport()->setAttribute(Qt::WA_Hover); never executed: tree->viewport()->setAttribute(Qt::WA_Hover); | 0 | ||||||||||||||||||||||||||||||||||||
510 | #endif | - | ||||||||||||||||||||||||||||||||||||
511 | } never executed: end of block | 0 | ||||||||||||||||||||||||||||||||||||
512 | - | |||||||||||||||||||||||||||||||||||||
513 | /*! | - | ||||||||||||||||||||||||||||||||||||
514 | \reimp | - | ||||||||||||||||||||||||||||||||||||
515 | */ | - | ||||||||||||||||||||||||||||||||||||
516 | void QGtkStyle::unpolish(QWidget *widget) | - | ||||||||||||||||||||||||||||||||||||
517 | { | - | ||||||||||||||||||||||||||||||||||||
518 | QCommonStyle::unpolish(widget); | - | ||||||||||||||||||||||||||||||||||||
519 | } never executed: end of block | 0 | ||||||||||||||||||||||||||||||||||||
520 | - | |||||||||||||||||||||||||||||||||||||
521 | /*! | - | ||||||||||||||||||||||||||||||||||||
522 | \reimp | - | ||||||||||||||||||||||||||||||||||||
523 | */ | - | ||||||||||||||||||||||||||||||||||||
524 | int QGtkStyle::pixelMetric(PixelMetric metric, | - | ||||||||||||||||||||||||||||||||||||
525 | const QStyleOption *option, | - | ||||||||||||||||||||||||||||||||||||
526 | const QWidget *widget) const | - | ||||||||||||||||||||||||||||||||||||
527 | { | - | ||||||||||||||||||||||||||||||||||||
528 | Q_D(const QGtkStyle); | - | ||||||||||||||||||||||||||||||||||||
529 | - | |||||||||||||||||||||||||||||||||||||
530 | if (!d->isThemeAvailable())
| 0 | ||||||||||||||||||||||||||||||||||||
531 | return QCommonStyle::pixelMetric(metric, option, widget); never executed: return QCommonStyle::pixelMetric(metric, option, widget); | 0 | ||||||||||||||||||||||||||||||||||||
532 | - | |||||||||||||||||||||||||||||||||||||
533 | switch (metric) { | - | ||||||||||||||||||||||||||||||||||||
534 | case PM_DefaultFrameWidth: never executed: case PM_DefaultFrameWidth: | 0 | ||||||||||||||||||||||||||||||||||||
535 | if (qobject_cast<const QFrame*>(widget)) {
| 0 | ||||||||||||||||||||||||||||||||||||
536 | if (GtkStyle *style =
| 0 | ||||||||||||||||||||||||||||||||||||
537 | d->gtk_rc_get_style_by_paths(d->gtk_settings_get_default(),
| 0 | ||||||||||||||||||||||||||||||||||||
538 | "*.GtkScrolledWindow",
| 0 | ||||||||||||||||||||||||||||||||||||
539 | "*.GtkScrolledWindow",
| 0 | ||||||||||||||||||||||||||||||||||||
540 | d->gtk_window_get_type()))
| 0 | ||||||||||||||||||||||||||||||||||||
541 | return qMax(style->xthickness, style->ythickness); never executed: return qMax(style->xthickness, style->ythickness); | 0 | ||||||||||||||||||||||||||||||||||||
542 | } never executed: end of block | 0 | ||||||||||||||||||||||||||||||||||||
543 | return 2; never executed: return 2; | 0 | ||||||||||||||||||||||||||||||||||||
544 | - | |||||||||||||||||||||||||||||||||||||
545 | case PM_MenuButtonIndicator: never executed: case PM_MenuButtonIndicator: | 0 | ||||||||||||||||||||||||||||||||||||
546 | return 20; never executed: return 20; | 0 | ||||||||||||||||||||||||||||||||||||
547 | - | |||||||||||||||||||||||||||||||||||||
548 | case PM_TabBarBaseOverlap: never executed: case PM_TabBarBaseOverlap: | 0 | ||||||||||||||||||||||||||||||||||||
549 | return 1; never executed: return 1; | 0 | ||||||||||||||||||||||||||||||||||||
550 | - | |||||||||||||||||||||||||||||||||||||
551 | case PM_ToolBarSeparatorExtent: never executed: case PM_ToolBarSeparatorExtent: | 0 | ||||||||||||||||||||||||||||||||||||
552 | return 11; never executed: return 11; | 0 | ||||||||||||||||||||||||||||||||||||
553 | - | |||||||||||||||||||||||||||||||||||||
554 | case PM_ToolBarFrameWidth: never executed: case PM_ToolBarFrameWidth: | 0 | ||||||||||||||||||||||||||||||||||||
555 | return 1; never executed: return 1; | 0 | ||||||||||||||||||||||||||||||||||||
556 | - | |||||||||||||||||||||||||||||||||||||
557 | case PM_ToolBarItemSpacing: never executed: case PM_ToolBarItemSpacing: | 0 | ||||||||||||||||||||||||||||||||||||
558 | return 0; never executed: return 0; | 0 | ||||||||||||||||||||||||||||||||||||
559 | - | |||||||||||||||||||||||||||||||||||||
560 | case PM_ButtonShiftHorizontal: { never executed: case PM_ButtonShiftHorizontal: | 0 | ||||||||||||||||||||||||||||||||||||
561 | GtkWidget *gtkButton = d->gtkWidget("GtkButton"); | - | ||||||||||||||||||||||||||||||||||||
562 | guint horizontal_shift; | - | ||||||||||||||||||||||||||||||||||||
563 | d->gtk_widget_style_get(gtkButton, "child-displacement-x", &horizontal_shift, NULL); | - | ||||||||||||||||||||||||||||||||||||
564 | return horizontal_shift; never executed: return horizontal_shift; | 0 | ||||||||||||||||||||||||||||||||||||
565 | } | - | ||||||||||||||||||||||||||||||||||||
566 | - | |||||||||||||||||||||||||||||||||||||
567 | case PM_ButtonShiftVertical: { never executed: case PM_ButtonShiftVertical: | 0 | ||||||||||||||||||||||||||||||||||||
568 | GtkWidget *gtkButton = d->gtkWidget("GtkButton"); | - | ||||||||||||||||||||||||||||||||||||
569 | guint vertical_shift; | - | ||||||||||||||||||||||||||||||||||||
570 | d->gtk_widget_style_get(gtkButton, "child-displacement-y", &vertical_shift, NULL); | - | ||||||||||||||||||||||||||||||||||||
571 | return vertical_shift; never executed: return vertical_shift; | 0 | ||||||||||||||||||||||||||||||||||||
572 | } | - | ||||||||||||||||||||||||||||||||||||
573 | - | |||||||||||||||||||||||||||||||||||||
574 | case PM_MenuBarPanelWidth: never executed: case PM_MenuBarPanelWidth: | 0 | ||||||||||||||||||||||||||||||||||||
575 | return 0; never executed: return 0; | 0 | ||||||||||||||||||||||||||||||||||||
576 | - | |||||||||||||||||||||||||||||||||||||
577 | case PM_MenuPanelWidth: { never executed: case PM_MenuPanelWidth: | 0 | ||||||||||||||||||||||||||||||||||||
578 | GtkWidget *gtkMenu = d->gtkWidget("GtkMenu"); | - | ||||||||||||||||||||||||||||||||||||
579 | guint horizontal_padding = 0; | - | ||||||||||||||||||||||||||||||||||||
580 | // horizontal-padding is used by Maemo to get thicker borders | - | ||||||||||||||||||||||||||||||||||||
581 | if (!d->gtk_check_version(2, 10, 0))
| 0 | ||||||||||||||||||||||||||||||||||||
582 | d->gtk_widget_style_get(gtkMenu, "horizontal-padding", &horizontal_padding, NULL); never executed: d->gtk_widget_style_get(gtkMenu, "horizontal-padding", &horizontal_padding, __null); | 0 | ||||||||||||||||||||||||||||||||||||
583 | int padding = qMax<int>(d->gtk_widget_get_style(gtkMenu)->xthickness, horizontal_padding); | - | ||||||||||||||||||||||||||||||||||||
584 | return padding; never executed: return padding; | 0 | ||||||||||||||||||||||||||||||||||||
585 | } | - | ||||||||||||||||||||||||||||||||||||
586 | - | |||||||||||||||||||||||||||||||||||||
587 | case PM_ButtonIconSize: { never executed: case PM_ButtonIconSize: | 0 | ||||||||||||||||||||||||||||||||||||
588 | int retVal = 24; | - | ||||||||||||||||||||||||||||||||||||
589 | GtkSettings *settings = d->gtk_settings_get_default(); | - | ||||||||||||||||||||||||||||||||||||
590 | gchararray icon_sizes; | - | ||||||||||||||||||||||||||||||||||||
591 | g_object_get(settings, "gtk-icon-sizes", &icon_sizes, NULL); | - | ||||||||||||||||||||||||||||||||||||
592 | QStringList values = QString(QLS(icon_sizes)).split(QLatin1Char(':')); | - | ||||||||||||||||||||||||||||||||||||
593 | g_free(icon_sizes); | - | ||||||||||||||||||||||||||||||||||||
594 | QChar splitChar(QLatin1Char(',')); | - | ||||||||||||||||||||||||||||||||||||
595 | foreach (const QString &value, values) { | - | ||||||||||||||||||||||||||||||||||||
596 | if (value.startsWith(QLS("gtk-button="))) {
| 0 | ||||||||||||||||||||||||||||||||||||
597 | QString iconSize = value.right(value.size() - 11); | - | ||||||||||||||||||||||||||||||||||||
598 | - | |||||||||||||||||||||||||||||||||||||
599 | if (iconSize.contains(splitChar))
| 0 | ||||||||||||||||||||||||||||||||||||
600 | retVal = iconSize.split(splitChar)[0].toInt(); never executed: retVal = iconSize.split(splitChar)[0].toInt(); | 0 | ||||||||||||||||||||||||||||||||||||
601 | break; never executed: break; | 0 | ||||||||||||||||||||||||||||||||||||
602 | } | - | ||||||||||||||||||||||||||||||||||||
603 | } never executed: end of block | 0 | ||||||||||||||||||||||||||||||||||||
604 | return retVal; never executed: return retVal; | 0 | ||||||||||||||||||||||||||||||||||||
605 | } | - | ||||||||||||||||||||||||||||||||||||
606 | - | |||||||||||||||||||||||||||||||||||||
607 | case PM_MenuVMargin: never executed: case PM_MenuVMargin: | 0 | ||||||||||||||||||||||||||||||||||||
608 | - | |||||||||||||||||||||||||||||||||||||
609 | case PM_MenuHMargin: never executed: case PM_MenuHMargin: | 0 | ||||||||||||||||||||||||||||||||||||
610 | return 0; never executed: return 0; | 0 | ||||||||||||||||||||||||||||||||||||
611 | - | |||||||||||||||||||||||||||||||||||||
612 | case PM_DockWidgetTitleMargin: never executed: case PM_DockWidgetTitleMargin: | 0 | ||||||||||||||||||||||||||||||||||||
613 | return 0; never executed: return 0; | 0 | ||||||||||||||||||||||||||||||||||||
614 | - | |||||||||||||||||||||||||||||||||||||
615 | case PM_DockWidgetTitleBarButtonMargin: never executed: case PM_DockWidgetTitleBarButtonMargin: | 0 | ||||||||||||||||||||||||||||||||||||
616 | return 5; never executed: return 5; | 0 | ||||||||||||||||||||||||||||||||||||
617 | - | |||||||||||||||||||||||||||||||||||||
618 | case PM_TabBarTabVSpace: never executed: case PM_TabBarTabVSpace: | 0 | ||||||||||||||||||||||||||||||||||||
619 | return 12; never executed: return 12; | 0 | ||||||||||||||||||||||||||||||||||||
620 | - | |||||||||||||||||||||||||||||||||||||
621 | case PM_TabBarTabHSpace: never executed: case PM_TabBarTabHSpace: | 0 | ||||||||||||||||||||||||||||||||||||
622 | return 14; never executed: return 14; | 0 | ||||||||||||||||||||||||||||||||||||
623 | - | |||||||||||||||||||||||||||||||||||||
624 | case PM_TabBarTabShiftVertical: never executed: case PM_TabBarTabShiftVertical: | 0 | ||||||||||||||||||||||||||||||||||||
625 | return 2; never executed: return 2; | 0 | ||||||||||||||||||||||||||||||||||||
626 | - | |||||||||||||||||||||||||||||||||||||
627 | case PM_ToolBarHandleExtent: never executed: case PM_ToolBarHandleExtent: | 0 | ||||||||||||||||||||||||||||||||||||
628 | return 9; never executed: return 9; | 0 | ||||||||||||||||||||||||||||||||||||
629 | - | |||||||||||||||||||||||||||||||||||||
630 | case PM_SplitterWidth: never executed: case PM_SplitterWidth: | 0 | ||||||||||||||||||||||||||||||||||||
631 | return 6; never executed: return 6; | 0 | ||||||||||||||||||||||||||||||||||||
632 | - | |||||||||||||||||||||||||||||||||||||
633 | case PM_SliderThickness: never executed: case PM_SliderThickness: | 0 | ||||||||||||||||||||||||||||||||||||
634 | case PM_SliderControlThickness: { never executed: case PM_SliderControlThickness: | 0 | ||||||||||||||||||||||||||||||||||||
635 | GtkWidget *gtkScale = d->gtkWidget("GtkHScale"); | - | ||||||||||||||||||||||||||||||||||||
636 | gint val; | - | ||||||||||||||||||||||||||||||||||||
637 | d->gtk_widget_style_get(gtkScale, "slider-width", &val, NULL); | - | ||||||||||||||||||||||||||||||||||||
638 | if (metric == PM_SliderControlThickness)
| 0 | ||||||||||||||||||||||||||||||||||||
639 | return val + 2*d->gtk_widget_get_style(gtkScale)->ythickness; never executed: return val + 2*d->gtk_widget_get_style(gtkScale)->ythickness; | 0 | ||||||||||||||||||||||||||||||||||||
640 | return val; never executed: return val; | 0 | ||||||||||||||||||||||||||||||||||||
641 | } | - | ||||||||||||||||||||||||||||||||||||
642 | - | |||||||||||||||||||||||||||||||||||||
643 | case PM_ScrollBarExtent: { never executed: case PM_ScrollBarExtent: | 0 | ||||||||||||||||||||||||||||||||||||
644 | gint sliderLength; | - | ||||||||||||||||||||||||||||||||||||
645 | gint trough_border; | - | ||||||||||||||||||||||||||||||||||||
646 | GtkWidget *hScrollbar = d->gtkWidget("GtkHScrollbar"); | - | ||||||||||||||||||||||||||||||||||||
647 | d->gtk_widget_style_get(hScrollbar, | - | ||||||||||||||||||||||||||||||||||||
648 | "trough-border", &trough_border, | - | ||||||||||||||||||||||||||||||||||||
649 | "slider-width", &sliderLength, | - | ||||||||||||||||||||||||||||||||||||
650 | NULL); | - | ||||||||||||||||||||||||||||||||||||
651 | return sliderLength + trough_border*2; never executed: return sliderLength + trough_border*2; | 0 | ||||||||||||||||||||||||||||||||||||
652 | } | - | ||||||||||||||||||||||||||||||||||||
653 | - | |||||||||||||||||||||||||||||||||||||
654 | case PM_ScrollBarSliderMin: never executed: case PM_ScrollBarSliderMin: | 0 | ||||||||||||||||||||||||||||||||||||
655 | return 34; never executed: return 34; | 0 | ||||||||||||||||||||||||||||||||||||
656 | - | |||||||||||||||||||||||||||||||||||||
657 | case PM_SliderLength: never executed: case PM_SliderLength: | 0 | ||||||||||||||||||||||||||||||||||||
658 | gint val; | - | ||||||||||||||||||||||||||||||||||||
659 | d->gtk_widget_style_get(d->gtkWidget("GtkHScale"), "slider-length", &val, NULL); | - | ||||||||||||||||||||||||||||||||||||
660 | return val; never executed: return val; | 0 | ||||||||||||||||||||||||||||||||||||
661 | - | |||||||||||||||||||||||||||||||||||||
662 | case PM_ExclusiveIndicatorWidth: never executed: case PM_ExclusiveIndicatorWidth: | 0 | ||||||||||||||||||||||||||||||||||||
663 | case PM_ExclusiveIndicatorHeight: never executed: case PM_ExclusiveIndicatorHeight: | 0 | ||||||||||||||||||||||||||||||||||||
664 | case PM_IndicatorWidth: never executed: case PM_IndicatorWidth: | 0 | ||||||||||||||||||||||||||||||||||||
665 | case PM_IndicatorHeight: { never executed: case PM_IndicatorHeight: | 0 | ||||||||||||||||||||||||||||||||||||
666 | GtkWidget *gtkCheckButton = d->gtkWidget("GtkCheckButton"); | - | ||||||||||||||||||||||||||||||||||||
667 | gint size, spacing; | - | ||||||||||||||||||||||||||||||||||||
668 | d->gtk_widget_style_get(gtkCheckButton, "indicator-spacing", &spacing, "indicator-size", &size, NULL); | - | ||||||||||||||||||||||||||||||||||||
669 | return size + 2 * spacing; never executed: return size + 2 * spacing; | 0 | ||||||||||||||||||||||||||||||||||||
670 | } | - | ||||||||||||||||||||||||||||||||||||
671 | - | |||||||||||||||||||||||||||||||||||||
672 | case PM_MenuBarVMargin: { never executed: case PM_MenuBarVMargin: | 0 | ||||||||||||||||||||||||||||||||||||
673 | GtkWidget *gtkMenubar = d->gtkWidget("GtkMenuBar"); | - | ||||||||||||||||||||||||||||||||||||
674 | return qMax(0, d->gtk_widget_get_style(gtkMenubar)->ythickness); never executed: return qMax(0, d->gtk_widget_get_style(gtkMenubar)->ythickness); | 0 | ||||||||||||||||||||||||||||||||||||
675 | } | - | ||||||||||||||||||||||||||||||||||||
676 | case PM_ScrollView_ScrollBarSpacing: never executed: case PM_ScrollView_ScrollBarSpacing: | 0 | ||||||||||||||||||||||||||||||||||||
677 | { | - | ||||||||||||||||||||||||||||||||||||
678 | gint spacing = 3; | - | ||||||||||||||||||||||||||||||||||||
679 | GtkWidget *gtkScrollWindow = d->gtkWidget("GtkScrolledWindow"); | - | ||||||||||||||||||||||||||||||||||||
680 | Q_ASSERT(gtkScrollWindow); | - | ||||||||||||||||||||||||||||||||||||
681 | d->gtk_widget_style_get(gtkScrollWindow, "scrollbar-spacing", &spacing, NULL); | - | ||||||||||||||||||||||||||||||||||||
682 | return spacing; never executed: return spacing; | 0 | ||||||||||||||||||||||||||||||||||||
683 | } | - | ||||||||||||||||||||||||||||||||||||
684 | case PM_SubMenuOverlap: { never executed: case PM_SubMenuOverlap: | 0 | ||||||||||||||||||||||||||||||||||||
685 | gint offset = 0; | - | ||||||||||||||||||||||||||||||||||||
686 | GtkWidget *gtkMenu = d->gtkWidget("GtkMenu"); | - | ||||||||||||||||||||||||||||||||||||
687 | d->gtk_widget_style_get(gtkMenu, "horizontal-offset", &offset, NULL); | - | ||||||||||||||||||||||||||||||||||||
688 | return offset; never executed: return offset; | 0 | ||||||||||||||||||||||||||||||||||||
689 | } | - | ||||||||||||||||||||||||||||||||||||
690 | case PM_ToolTipLabelFrameWidth: never executed: case PM_ToolTipLabelFrameWidth: | 0 | ||||||||||||||||||||||||||||||||||||
691 | return 2; never executed: return 2; | 0 | ||||||||||||||||||||||||||||||||||||
692 | case PM_ButtonDefaultIndicator: never executed: case PM_ButtonDefaultIndicator: | 0 | ||||||||||||||||||||||||||||||||||||
693 | return 0; never executed: return 0; | 0 | ||||||||||||||||||||||||||||||||||||
694 | case PM_ListViewIconSize: never executed: case PM_ListViewIconSize: | 0 | ||||||||||||||||||||||||||||||||||||
695 | return 24; never executed: return 24; | 0 | ||||||||||||||||||||||||||||||||||||
696 | case PM_DialogButtonsSeparator: never executed: case PM_DialogButtonsSeparator: | 0 | ||||||||||||||||||||||||||||||||||||
697 | return 6; never executed: return 6; | 0 | ||||||||||||||||||||||||||||||||||||
698 | case PM_TitleBarHeight: never executed: case PM_TitleBarHeight: | 0 | ||||||||||||||||||||||||||||||||||||
699 | return 24; never executed: return 24; | 0 | ||||||||||||||||||||||||||||||||||||
700 | case PM_SpinBoxFrameWidth: never executed: case PM_SpinBoxFrameWidth: | 0 | ||||||||||||||||||||||||||||||||||||
701 | return 3; never executed: return 3; | 0 | ||||||||||||||||||||||||||||||||||||
702 | case PM_MenuBarItemSpacing: never executed: case PM_MenuBarItemSpacing: | 0 | ||||||||||||||||||||||||||||||||||||
703 | return 6; never executed: return 6; | 0 | ||||||||||||||||||||||||||||||||||||
704 | case PM_MenuBarHMargin: never executed: case PM_MenuBarHMargin: | 0 | ||||||||||||||||||||||||||||||||||||
705 | return 0; never executed: return 0; | 0 | ||||||||||||||||||||||||||||||||||||
706 | case PM_ToolBarItemMargin: never executed: case PM_ToolBarItemMargin: | 0 | ||||||||||||||||||||||||||||||||||||
707 | return 1; never executed: return 1; | 0 | ||||||||||||||||||||||||||||||||||||
708 | case PM_SmallIconSize: never executed: case PM_SmallIconSize: | 0 | ||||||||||||||||||||||||||||||||||||
709 | return 16; never executed: return 16; | 0 | ||||||||||||||||||||||||||||||||||||
710 | case PM_MaximumDragDistance: never executed: case PM_MaximumDragDistance: | 0 | ||||||||||||||||||||||||||||||||||||
711 | return -1; never executed: return -1; | 0 | ||||||||||||||||||||||||||||||||||||
712 | case PM_TabCloseIndicatorWidth: never executed: case PM_TabCloseIndicatorWidth: | 0 | ||||||||||||||||||||||||||||||||||||
713 | case PM_TabCloseIndicatorHeight: never executed: case PM_TabCloseIndicatorHeight: | 0 | ||||||||||||||||||||||||||||||||||||
714 | return 20; never executed: return 20; | 0 | ||||||||||||||||||||||||||||||||||||
715 | default: never executed: default: | 0 | ||||||||||||||||||||||||||||||||||||
716 | return QCommonStyle::pixelMetric(metric, option, widget); never executed: return QCommonStyle::pixelMetric(metric, option, widget); | 0 | ||||||||||||||||||||||||||||||||||||
717 | } | - | ||||||||||||||||||||||||||||||||||||
718 | } | - | ||||||||||||||||||||||||||||||||||||
719 | - | |||||||||||||||||||||||||||||||||||||
720 | /*! | - | ||||||||||||||||||||||||||||||||||||
721 | \reimp | - | ||||||||||||||||||||||||||||||||||||
722 | */ | - | ||||||||||||||||||||||||||||||||||||
723 | int QGtkStyle::styleHint(StyleHint hint, const QStyleOption *option, const QWidget *widget, | - | ||||||||||||||||||||||||||||||||||||
724 | - | |||||||||||||||||||||||||||||||||||||
725 | QStyleHintReturn *returnData = 0) const | - | ||||||||||||||||||||||||||||||||||||
726 | { | - | ||||||||||||||||||||||||||||||||||||
727 | Q_D(const QGtkStyle); | - | ||||||||||||||||||||||||||||||||||||
728 | - | |||||||||||||||||||||||||||||||||||||
729 | if (!d->isThemeAvailable())
| 0 | ||||||||||||||||||||||||||||||||||||
730 | return QCommonStyle::styleHint(hint, option, widget, returnData); never executed: return QCommonStyle::styleHint(hint, option, widget, returnData); | 0 | ||||||||||||||||||||||||||||||||||||
731 | - | |||||||||||||||||||||||||||||||||||||
732 | switch (hint) { | - | ||||||||||||||||||||||||||||||||||||
733 | case SH_ItemView_ChangeHighlightOnFocus: never executed: case SH_ItemView_ChangeHighlightOnFocus: | 0 | ||||||||||||||||||||||||||||||||||||
734 | return true; never executed: return true; | 0 | ||||||||||||||||||||||||||||||||||||
735 | case SH_ScrollBar_MiddleClickAbsolutePosition: never executed: case SH_ScrollBar_MiddleClickAbsolutePosition: | 0 | ||||||||||||||||||||||||||||||||||||
736 | return true; never executed: return true; | 0 | ||||||||||||||||||||||||||||||||||||
737 | case SH_Menu_AllowActiveAndDisabled: never executed: case SH_Menu_AllowActiveAndDisabled: | 0 | ||||||||||||||||||||||||||||||||||||
738 | return false; never executed: return false; | 0 | ||||||||||||||||||||||||||||||||||||
739 | case SH_MainWindow_SpaceBelowMenuBar: never executed: case SH_MainWindow_SpaceBelowMenuBar: | 0 | ||||||||||||||||||||||||||||||||||||
740 | return false; never executed: return false; | 0 | ||||||||||||||||||||||||||||||||||||
741 | case SH_MenuBar_MouseTracking: never executed: case SH_MenuBar_MouseTracking: | 0 | ||||||||||||||||||||||||||||||||||||
742 | return true; never executed: return true; | 0 | ||||||||||||||||||||||||||||||||||||
743 | case SH_Menu_MouseTracking: never executed: case SH_Menu_MouseTracking: | 0 | ||||||||||||||||||||||||||||||||||||
744 | return true; never executed: return true; | 0 | ||||||||||||||||||||||||||||||||||||
745 | case SH_TitleBar_AutoRaise: never executed: case SH_TitleBar_AutoRaise: | 0 | ||||||||||||||||||||||||||||||||||||
746 | return true; never executed: return true; | 0 | ||||||||||||||||||||||||||||||||||||
747 | case SH_TitleBar_NoBorder: never executed: case SH_TitleBar_NoBorder: | 0 | ||||||||||||||||||||||||||||||||||||
748 | return true; never executed: return true; | 0 | ||||||||||||||||||||||||||||||||||||
749 | case SH_ItemView_ShowDecorationSelected: never executed: case SH_ItemView_ShowDecorationSelected: | 0 | ||||||||||||||||||||||||||||||||||||
750 | return true; never executed: return true; | 0 | ||||||||||||||||||||||||||||||||||||
751 | case SH_Table_GridLineColor: never executed: case SH_Table_GridLineColor: | 0 | ||||||||||||||||||||||||||||||||||||
752 | if (option)
| 0 | ||||||||||||||||||||||||||||||||||||
753 | return option->palette.background().color().darker(120).rgb(); never executed: return option->palette.background().color().darker(120).rgb(); | 0 | ||||||||||||||||||||||||||||||||||||
754 | break; never executed: break; | 0 | ||||||||||||||||||||||||||||||||||||
755 | case SH_WindowFrame_Mask: never executed: case SH_WindowFrame_Mask: | 0 | ||||||||||||||||||||||||||||||||||||
756 | if (QStyleHintReturnMask *mask = qstyleoption_cast<QStyleHintReturnMask *>(returnData)) {
| 0 | ||||||||||||||||||||||||||||||||||||
757 | //left rounded corner | - | ||||||||||||||||||||||||||||||||||||
758 | mask->region = option->rect; | - | ||||||||||||||||||||||||||||||||||||
759 | mask->region -= QRect(option->rect.left(), option->rect.top(), 5, 1); | - | ||||||||||||||||||||||||||||||||||||
760 | mask->region -= QRect(option->rect.left(), option->rect.top() + 1, 3, 1); | - | ||||||||||||||||||||||||||||||||||||
761 | mask->region -= QRect(option->rect.left(), option->rect.top() + 2, 2, 1); | - | ||||||||||||||||||||||||||||||||||||
762 | mask->region -= QRect(option->rect.left(), option->rect.top() + 3, 1, 2); | - | ||||||||||||||||||||||||||||||||||||
763 | - | |||||||||||||||||||||||||||||||||||||
764 | //right rounded corner | - | ||||||||||||||||||||||||||||||||||||
765 | mask->region -= QRect(option->rect.right() - 4, option->rect.top(), 5, 1); | - | ||||||||||||||||||||||||||||||||||||
766 | mask->region -= QRect(option->rect.right() - 2, option->rect.top() + 1, 3, 1); | - | ||||||||||||||||||||||||||||||||||||
767 | mask->region -= QRect(option->rect.right() - 1, option->rect.top() + 2, 2, 1); | - | ||||||||||||||||||||||||||||||||||||
768 | mask->region -= QRect(option->rect.right() , option->rect.top() + 3, 1, 2); | - | ||||||||||||||||||||||||||||||||||||
769 | } never executed: end of block | 0 | ||||||||||||||||||||||||||||||||||||
770 | return QCommonStyle::styleHint(hint, option, widget, returnData); never executed: return QCommonStyle::styleHint(hint, option, widget, returnData); | 0 | ||||||||||||||||||||||||||||||||||||
771 | case SH_MessageBox_TextInteractionFlags: never executed: case SH_MessageBox_TextInteractionFlags: | 0 | ||||||||||||||||||||||||||||||||||||
772 | return Qt::TextSelectableByMouse | Qt::LinksAccessibleByMouse; never executed: return Qt::TextSelectableByMouse | Qt::LinksAccessibleByMouse; | 0 | ||||||||||||||||||||||||||||||||||||
773 | case SH_MessageBox_CenterButtons: never executed: case SH_MessageBox_CenterButtons: | 0 | ||||||||||||||||||||||||||||||||||||
774 | return false; never executed: return false; | 0 | ||||||||||||||||||||||||||||||||||||
775 | #ifndef QT_NO_WIZARD | - | ||||||||||||||||||||||||||||||||||||
776 | case SH_WizardStyle: never executed: case SH_WizardStyle: | 0 | ||||||||||||||||||||||||||||||||||||
777 | return QWizard::ClassicStyle; never executed: return QWizard::ClassicStyle; | 0 | ||||||||||||||||||||||||||||||||||||
778 | #endif | - | ||||||||||||||||||||||||||||||||||||
779 | case SH_ItemView_ArrowKeysNavigateIntoChildren: never executed: case SH_ItemView_ArrowKeysNavigateIntoChildren: | 0 | ||||||||||||||||||||||||||||||||||||
780 | return false; never executed: return false; | 0 | ||||||||||||||||||||||||||||||||||||
781 | case SH_DialogButtonLayout: { never executed: case SH_DialogButtonLayout: | 0 | ||||||||||||||||||||||||||||||||||||
782 | int ret = QDialogButtonBox::GnomeLayout; | - | ||||||||||||||||||||||||||||||||||||
783 | gboolean alternateOrder = 0; | - | ||||||||||||||||||||||||||||||||||||
784 | GtkSettings *settings = d->gtk_settings_get_default(); | - | ||||||||||||||||||||||||||||||||||||
785 | g_object_get(settings, "gtk-alternative-button-order", &alternateOrder, NULL); | - | ||||||||||||||||||||||||||||||||||||
786 | - | |||||||||||||||||||||||||||||||||||||
787 | if (alternateOrder)
| 0 | ||||||||||||||||||||||||||||||||||||
788 | ret = QDialogButtonBox::WinLayout; never executed: ret = QDialogButtonBox::WinLayout; | 0 | ||||||||||||||||||||||||||||||||||||
789 | - | |||||||||||||||||||||||||||||||||||||
790 | return ret; never executed: return ret; | 0 | ||||||||||||||||||||||||||||||||||||
791 | } | - | ||||||||||||||||||||||||||||||||||||
792 | break; dead code: break; | - | ||||||||||||||||||||||||||||||||||||
793 | - | |||||||||||||||||||||||||||||||||||||
794 | case SH_ToolButtonStyle: never executed: case SH_ToolButtonStyle: | 0 | ||||||||||||||||||||||||||||||||||||
795 | { | - | ||||||||||||||||||||||||||||||||||||
796 | if (d->isKDE4Session())
| 0 | ||||||||||||||||||||||||||||||||||||
797 | return QCommonStyle::styleHint(hint, option, widget, returnData); never executed: return QCommonStyle::styleHint(hint, option, widget, returnData); | 0 | ||||||||||||||||||||||||||||||||||||
798 | GtkWidget *gtkToolbar = d->gtkWidget("GtkToolbar"); | - | ||||||||||||||||||||||||||||||||||||
799 | GtkToolbarStyle toolbar_style = GTK_TOOLBAR_ICONS; | - | ||||||||||||||||||||||||||||||||||||
800 | g_object_get(gtkToolbar, "toolbar-style", &toolbar_style, NULL); | - | ||||||||||||||||||||||||||||||||||||
801 | switch (toolbar_style) { | - | ||||||||||||||||||||||||||||||||||||
802 | case GTK_TOOLBAR_TEXT: never executed: case GTK_TOOLBAR_TEXT: | 0 | ||||||||||||||||||||||||||||||||||||
803 | return Qt::ToolButtonTextOnly; never executed: return Qt::ToolButtonTextOnly; | 0 | ||||||||||||||||||||||||||||||||||||
804 | case GTK_TOOLBAR_BOTH: never executed: case GTK_TOOLBAR_BOTH: | 0 | ||||||||||||||||||||||||||||||||||||
805 | return Qt::ToolButtonTextUnderIcon; never executed: return Qt::ToolButtonTextUnderIcon; | 0 | ||||||||||||||||||||||||||||||||||||
806 | case GTK_TOOLBAR_BOTH_HORIZ: never executed: case GTK_TOOLBAR_BOTH_HORIZ: | 0 | ||||||||||||||||||||||||||||||||||||
807 | return Qt::ToolButtonTextBesideIcon; never executed: return Qt::ToolButtonTextBesideIcon; | 0 | ||||||||||||||||||||||||||||||||||||
808 | case GTK_TOOLBAR_ICONS: never executed: case GTK_TOOLBAR_ICONS: | 0 | ||||||||||||||||||||||||||||||||||||
809 | default: never executed: default: | 0 | ||||||||||||||||||||||||||||||||||||
810 | return Qt::ToolButtonIconOnly; never executed: return Qt::ToolButtonIconOnly; | 0 | ||||||||||||||||||||||||||||||||||||
811 | } | - | ||||||||||||||||||||||||||||||||||||
812 | } | - | ||||||||||||||||||||||||||||||||||||
813 | break; dead code: break; | - | ||||||||||||||||||||||||||||||||||||
814 | case SH_SpinControls_DisableOnBounds: never executed: case SH_SpinControls_DisableOnBounds: | 0 | ||||||||||||||||||||||||||||||||||||
815 | return int(true); never executed: return int(true); | 0 | ||||||||||||||||||||||||||||||||||||
816 | - | |||||||||||||||||||||||||||||||||||||
817 | case SH_DitherDisabledText: never executed: case SH_DitherDisabledText: | 0 | ||||||||||||||||||||||||||||||||||||
818 | return int(false); never executed: return int(false); | 0 | ||||||||||||||||||||||||||||||||||||
819 | - | |||||||||||||||||||||||||||||||||||||
820 | case SH_ComboBox_Popup: { never executed: case SH_ComboBox_Popup: | 0 | ||||||||||||||||||||||||||||||||||||
821 | GtkWidget *gtkComboBox = d->gtkWidget("GtkComboBox"); | - | ||||||||||||||||||||||||||||||||||||
822 | gboolean appears_as_list; | - | ||||||||||||||||||||||||||||||||||||
823 | d->gtk_widget_style_get((GtkWidget*)gtkComboBox, "appears-as-list", &appears_as_list, NULL); | - | ||||||||||||||||||||||||||||||||||||
824 | return appears_as_list ? 0 : 1; never executed: return appears_as_list ? 0 : 1;
| 0 | ||||||||||||||||||||||||||||||||||||
825 | } | - | ||||||||||||||||||||||||||||||||||||
826 | - | |||||||||||||||||||||||||||||||||||||
827 | case SH_MenuBar_AltKeyNavigation: never executed: case SH_MenuBar_AltKeyNavigation: | 0 | ||||||||||||||||||||||||||||||||||||
828 | return int(false); never executed: return int(false); | 0 | ||||||||||||||||||||||||||||||||||||
829 | - | |||||||||||||||||||||||||||||||||||||
830 | case SH_EtchDisabledText: never executed: case SH_EtchDisabledText: | 0 | ||||||||||||||||||||||||||||||||||||
831 | return int(false); never executed: return int(false); | 0 | ||||||||||||||||||||||||||||||||||||
832 | - | |||||||||||||||||||||||||||||||||||||
833 | case SH_Menu_SubMenuPopupDelay: { never executed: case SH_Menu_SubMenuPopupDelay: | 0 | ||||||||||||||||||||||||||||||||||||
834 | gint delay = 225; | - | ||||||||||||||||||||||||||||||||||||
835 | GtkSettings *settings = d->gtk_settings_get_default(); | - | ||||||||||||||||||||||||||||||||||||
836 | g_object_get(settings, "gtk-menu-popup-delay", &delay, NULL); | - | ||||||||||||||||||||||||||||||||||||
837 | return delay; never executed: return delay; | 0 | ||||||||||||||||||||||||||||||||||||
838 | } | - | ||||||||||||||||||||||||||||||||||||
839 | - | |||||||||||||||||||||||||||||||||||||
840 | case SH_ScrollView_FrameOnlyAroundContents: { never executed: case SH_ScrollView_FrameOnlyAroundContents: | 0 | ||||||||||||||||||||||||||||||||||||
841 | gboolean scrollbars_within_bevel = false; | - | ||||||||||||||||||||||||||||||||||||
842 | if (widget && widget->isWindow())
| 0 | ||||||||||||||||||||||||||||||||||||
843 | scrollbars_within_bevel = true; never executed: scrollbars_within_bevel = true; | 0 | ||||||||||||||||||||||||||||||||||||
844 | else if (!d->gtk_check_version(2, 12, 0)) {
| 0 | ||||||||||||||||||||||||||||||||||||
845 | GtkWidget *gtkScrollWindow = d->gtkWidget("GtkScrolledWindow"); | - | ||||||||||||||||||||||||||||||||||||
846 | d->gtk_widget_style_get(gtkScrollWindow, "scrollbars-within-bevel", &scrollbars_within_bevel, NULL); | - | ||||||||||||||||||||||||||||||||||||
847 | } never executed: end of block | 0 | ||||||||||||||||||||||||||||||||||||
848 | return !scrollbars_within_bevel; never executed: return !scrollbars_within_bevel; | 0 | ||||||||||||||||||||||||||||||||||||
849 | } | - | ||||||||||||||||||||||||||||||||||||
850 | - | |||||||||||||||||||||||||||||||||||||
851 | case SH_DialogButtonBox_ButtonsHaveIcons: { never executed: case SH_DialogButtonBox_ButtonsHaveIcons: | 0 | ||||||||||||||||||||||||||||||||||||
852 | static bool buttonsHaveIcons = d->getGConfBool(QLS("/desktop/gnome/interface/buttons_have_icons")); | - | ||||||||||||||||||||||||||||||||||||
853 | return buttonsHaveIcons; never executed: return buttonsHaveIcons; | 0 | ||||||||||||||||||||||||||||||||||||
854 | } | - | ||||||||||||||||||||||||||||||||||||
855 | - | |||||||||||||||||||||||||||||||||||||
856 | case SH_UnderlineShortcut: { never executed: case SH_UnderlineShortcut: | 0 | ||||||||||||||||||||||||||||||||||||
857 | gboolean underlineShortcut = true; | - | ||||||||||||||||||||||||||||||||||||
858 | if (!d->gtk_check_version(2, 12, 0)) {
| 0 | ||||||||||||||||||||||||||||||||||||
859 | GtkSettings *settings = d->gtk_settings_get_default(); | - | ||||||||||||||||||||||||||||||||||||
860 | g_object_get(settings, "gtk-enable-mnemonics", &underlineShortcut, NULL); | - | ||||||||||||||||||||||||||||||||||||
861 | } never executed: end of block | 0 | ||||||||||||||||||||||||||||||||||||
862 | return underlineShortcut; never executed: return underlineShortcut; | 0 | ||||||||||||||||||||||||||||||||||||
863 | } | - | ||||||||||||||||||||||||||||||||||||
864 | - | |||||||||||||||||||||||||||||||||||||
865 | default: never executed: default: | 0 | ||||||||||||||||||||||||||||||||||||
866 | break; never executed: break; | 0 | ||||||||||||||||||||||||||||||||||||
867 | } | - | ||||||||||||||||||||||||||||||||||||
868 | return QCommonStyle::styleHint(hint, option, widget, returnData); never executed: return QCommonStyle::styleHint(hint, option, widget, returnData); | 0 | ||||||||||||||||||||||||||||||||||||
869 | } | - | ||||||||||||||||||||||||||||||||||||
870 | - | |||||||||||||||||||||||||||||||||||||
871 | /*! | - | ||||||||||||||||||||||||||||||||||||
872 | \reimp | - | ||||||||||||||||||||||||||||||||||||
873 | */ | - | ||||||||||||||||||||||||||||||||||||
874 | void QGtkStyle::drawPrimitive(PrimitiveElement element, | - | ||||||||||||||||||||||||||||||||||||
875 | const QStyleOption *option, | - | ||||||||||||||||||||||||||||||||||||
876 | QPainter *painter, | - | ||||||||||||||||||||||||||||||||||||
877 | const QWidget *widget) const | - | ||||||||||||||||||||||||||||||||||||
878 | { | - | ||||||||||||||||||||||||||||||||||||
879 | Q_D(const QGtkStyle); | - | ||||||||||||||||||||||||||||||||||||
880 | - | |||||||||||||||||||||||||||||||||||||
881 | if (!d->isThemeAvailable()) {
| 0 | ||||||||||||||||||||||||||||||||||||
882 | QCommonStyle::drawPrimitive(element, option, painter, widget); | - | ||||||||||||||||||||||||||||||||||||
883 | return; never executed: return; | 0 | ||||||||||||||||||||||||||||||||||||
884 | } | - | ||||||||||||||||||||||||||||||||||||
885 | - | |||||||||||||||||||||||||||||||||||||
886 | GtkStyle* style = d->gtkStyle(); | - | ||||||||||||||||||||||||||||||||||||
887 | QGtkPainter* gtkPainter = d->gtkPainter(painter); | - | ||||||||||||||||||||||||||||||||||||
888 | - | |||||||||||||||||||||||||||||||||||||
889 | switch (element) { | - | ||||||||||||||||||||||||||||||||||||
890 | case PE_Frame: { never executed: case PE_Frame: | 0 | ||||||||||||||||||||||||||||||||||||
891 | if (widget && widget->inherits("QComboBoxPrivateContainer")){
| 0 | ||||||||||||||||||||||||||||||||||||
892 | QStyleOption copy = *option; | - | ||||||||||||||||||||||||||||||||||||
893 | copy.state |= State_Raised; | - | ||||||||||||||||||||||||||||||||||||
894 | proxy()->drawPrimitive(PE_PanelMenu, ©, painter, widget); | - | ||||||||||||||||||||||||||||||||||||
895 | break; never executed: break; | 0 | ||||||||||||||||||||||||||||||||||||
896 | } | - | ||||||||||||||||||||||||||||||||||||
897 | // Drawing the entire itemview frame is very expensive, especially on the native X11 engine | - | ||||||||||||||||||||||||||||||||||||
898 | // Instead we cheat a bit and draw a border image without the center part, hence only scaling | - | ||||||||||||||||||||||||||||||||||||
899 | // thin rectangular images | - | ||||||||||||||||||||||||||||||||||||
900 | const int pmSize = 64; | - | ||||||||||||||||||||||||||||||||||||
901 | const int border = proxy()->pixelMetric(PM_DefaultFrameWidth, option, widget); | - | ||||||||||||||||||||||||||||||||||||
902 | const QString pmKey = QLatin1String("windowframe") % HexString<uint>(option->state); | - | ||||||||||||||||||||||||||||||||||||
903 | - | |||||||||||||||||||||||||||||||||||||
904 | QPixmap pixmap; | - | ||||||||||||||||||||||||||||||||||||
905 | QRect pmRect(QPoint(0,0), QSize(pmSize, pmSize)); | - | ||||||||||||||||||||||||||||||||||||
906 | - | |||||||||||||||||||||||||||||||||||||
907 | // Only draw through style once | - | ||||||||||||||||||||||||||||||||||||
908 | if (!QPixmapCache::find(pmKey, pixmap)) {
| 0 | ||||||||||||||||||||||||||||||||||||
909 | pixmap = QPixmap(pmSize, pmSize); | - | ||||||||||||||||||||||||||||||||||||
910 | pixmap.fill(Qt::transparent); | - | ||||||||||||||||||||||||||||||||||||
911 | QPainter pmPainter(&pixmap); | - | ||||||||||||||||||||||||||||||||||||
912 | gtkPainter->reset(&pmPainter); | - | ||||||||||||||||||||||||||||||||||||
913 | gtkPainter->setUsePixmapCache(false); // Don't cache twice | - | ||||||||||||||||||||||||||||||||||||
914 | - | |||||||||||||||||||||||||||||||||||||
915 | GtkShadowType shadow_type = GTK_SHADOW_NONE; | - | ||||||||||||||||||||||||||||||||||||
916 | if (option->state & State_Sunken)
| 0 | ||||||||||||||||||||||||||||||||||||
917 | shadow_type = GTK_SHADOW_IN; never executed: shadow_type = GTK_SHADOW_IN; | 0 | ||||||||||||||||||||||||||||||||||||
918 | else if (option->state & State_Raised)
| 0 | ||||||||||||||||||||||||||||||||||||
919 | shadow_type = GTK_SHADOW_OUT; never executed: shadow_type = GTK_SHADOW_OUT; | 0 | ||||||||||||||||||||||||||||||||||||
920 | - | |||||||||||||||||||||||||||||||||||||
921 | GtkStyle *style = d->gtk_rc_get_style_by_paths(d->gtk_settings_get_default(), | - | ||||||||||||||||||||||||||||||||||||
922 | "*.GtkScrolledWindow", "*.GtkScrolledWindow", d->gtk_window_get_type()); | - | ||||||||||||||||||||||||||||||||||||
923 | if (style)
| 0 | ||||||||||||||||||||||||||||||||||||
924 | gtkPainter->paintShadow(d->gtkWidget("GtkFrame"), "viewport", pmRect, never executed: gtkPainter->paintShadow(d->gtkWidget("GtkFrame"), "viewport", pmRect, option->state & State_Enabled ? GTK_STATE_NORMAL : GTK_STATE_INSENSITIVE, shadow_type, style); | 0 | ||||||||||||||||||||||||||||||||||||
925 | option->state & State_Enabled ? GTK_STATE_NORMAL : GTK_STATE_INSENSITIVE, never executed: gtkPainter->paintShadow(d->gtkWidget("GtkFrame"), "viewport", pmRect, option->state & State_Enabled ? GTK_STATE_NORMAL : GTK_STATE_INSENSITIVE, shadow_type, style); | 0 | ||||||||||||||||||||||||||||||||||||
926 | shadow_type, style); never executed: gtkPainter->paintShadow(d->gtkWidget("GtkFrame"), "viewport", pmRect, option->state & State_Enabled ? GTK_STATE_NORMAL : GTK_STATE_INSENSITIVE, shadow_type, style); | 0 | ||||||||||||||||||||||||||||||||||||
927 | QPixmapCache::insert(pmKey, pixmap); | - | ||||||||||||||||||||||||||||||||||||
928 | gtkPainter->reset(painter); | - | ||||||||||||||||||||||||||||||||||||
929 | } never executed: end of block | 0 | ||||||||||||||||||||||||||||||||||||
930 | - | |||||||||||||||||||||||||||||||||||||
931 | QRect rect = option->rect; | - | ||||||||||||||||||||||||||||||||||||
932 | const int rw = rect.width() - border; | - | ||||||||||||||||||||||||||||||||||||
933 | const int rh = rect.height() - border; | - | ||||||||||||||||||||||||||||||||||||
934 | const int pw = pmRect.width() - border; | - | ||||||||||||||||||||||||||||||||||||
935 | const int ph = pmRect.height() - border; | - | ||||||||||||||||||||||||||||||||||||
936 | - | |||||||||||||||||||||||||||||||||||||
937 | // Sidelines | - | ||||||||||||||||||||||||||||||||||||
938 | painter->drawPixmap(rect.adjusted(border, 0, -border, -rh), pixmap, pmRect.adjusted(border, 0, -border,-ph)); | - | ||||||||||||||||||||||||||||||||||||
939 | painter->drawPixmap(rect.adjusted(border, rh, -border, 0), pixmap, pmRect.adjusted(border, ph,-border,0)); | - | ||||||||||||||||||||||||||||||||||||
940 | painter->drawPixmap(rect.adjusted(0, border, -rw, -border), pixmap, pmRect.adjusted(0, border, -pw, -border)); | - | ||||||||||||||||||||||||||||||||||||
941 | painter->drawPixmap(rect.adjusted(rw, border, 0, -border), pixmap, pmRect.adjusted(pw, border, 0, -border)); | - | ||||||||||||||||||||||||||||||||||||
942 | - | |||||||||||||||||||||||||||||||||||||
943 | // Corners | - | ||||||||||||||||||||||||||||||||||||
944 | painter->drawPixmap(rect.adjusted(0, 0, -rw, -rh), pixmap, pmRect.adjusted(0, 0, -pw,-ph)); | - | ||||||||||||||||||||||||||||||||||||
945 | painter->drawPixmap(rect.adjusted(rw, 0, 0, -rh), pixmap, pmRect.adjusted(pw, 0, 0,-ph)); | - | ||||||||||||||||||||||||||||||||||||
946 | painter->drawPixmap(rect.adjusted(0, rh, -rw, 0), pixmap, pmRect.adjusted(0, ph, -pw,0)); | - | ||||||||||||||||||||||||||||||||||||
947 | painter->drawPixmap(rect.adjusted(rw, rh, 0, 0), pixmap, pmRect.adjusted(pw, ph, 0,0)); | - | ||||||||||||||||||||||||||||||||||||
948 | } | - | ||||||||||||||||||||||||||||||||||||
949 | break; never executed: break; | 0 | ||||||||||||||||||||||||||||||||||||
950 | case PE_FrameWindow: never executed: case PE_FrameWindow: | 0 | ||||||||||||||||||||||||||||||||||||
951 | painter->save(); | - | ||||||||||||||||||||||||||||||||||||
952 | { | - | ||||||||||||||||||||||||||||||||||||
953 | QRect rect= option->rect; | - | ||||||||||||||||||||||||||||||||||||
954 | painter->setPen(QPen(option->palette.dark().color().darker(150), 0)); | - | ||||||||||||||||||||||||||||||||||||
955 | painter->drawRect(option->rect.adjusted(0, 0, -1, -1)); | - | ||||||||||||||||||||||||||||||||||||
956 | painter->setPen(QPen(option->palette.light(), 0)); | - | ||||||||||||||||||||||||||||||||||||
957 | painter->drawLine(QPoint(rect.left() + 1, rect.top() + 1), | - | ||||||||||||||||||||||||||||||||||||
958 | QPoint(rect.left() + 1, rect.bottom() - 1)); | - | ||||||||||||||||||||||||||||||||||||
959 | painter->setPen(QPen(option->palette.background().color().darker(120), 0)); | - | ||||||||||||||||||||||||||||||||||||
960 | painter->drawLine(QPoint(rect.left() + 1, rect.bottom() - 1), | - | ||||||||||||||||||||||||||||||||||||
961 | QPoint(rect.right() - 2, rect.bottom() - 1)); | - | ||||||||||||||||||||||||||||||||||||
962 | painter->drawLine(QPoint(rect.right() - 1, rect.top() + 1), | - | ||||||||||||||||||||||||||||||||||||
963 | QPoint(rect.right() - 1, rect.bottom() - 1)); | - | ||||||||||||||||||||||||||||||||||||
964 | } | - | ||||||||||||||||||||||||||||||||||||
965 | painter->restore(); | - | ||||||||||||||||||||||||||||||||||||
966 | break; never executed: break; | 0 | ||||||||||||||||||||||||||||||||||||
967 | - | |||||||||||||||||||||||||||||||||||||
968 | case PE_PanelTipLabel: { never executed: case PE_PanelTipLabel: | 0 | ||||||||||||||||||||||||||||||||||||
969 | GtkWidget *gtkWindow = d->gtkWidget("GtkWindow"); // The Murrine Engine currently assumes a widget is passed | - | ||||||||||||||||||||||||||||||||||||
970 | style = d->gtk_rc_get_style_by_paths(d->gtk_settings_get_default(), "gtk-tooltips", "GtkWindow", | - | ||||||||||||||||||||||||||||||||||||
971 | d->gtk_window_get_type()); | - | ||||||||||||||||||||||||||||||||||||
972 | gtkPainter->paintFlatBox(gtkWindow, "tooltip", option->rect, GTK_STATE_NORMAL, GTK_SHADOW_NONE, style); | - | ||||||||||||||||||||||||||||||||||||
973 | } | - | ||||||||||||||||||||||||||||||||||||
974 | break; never executed: break; | 0 | ||||||||||||||||||||||||||||||||||||
975 | - | |||||||||||||||||||||||||||||||||||||
976 | case PE_PanelStatusBar: { never executed: case PE_PanelStatusBar: | 0 | ||||||||||||||||||||||||||||||||||||
977 | if (widget && widget->testAttribute(Qt::WA_SetPalette) &&
| 0 | ||||||||||||||||||||||||||||||||||||
978 | option->palette.resolve() & (1 << QPalette::Window)) {
| 0 | ||||||||||||||||||||||||||||||||||||
979 | // Respect custom palette | - | ||||||||||||||||||||||||||||||||||||
980 | painter->fillRect(option->rect, option->palette.window()); | - | ||||||||||||||||||||||||||||||||||||
981 | break; never executed: break; | 0 | ||||||||||||||||||||||||||||||||||||
982 | } | - | ||||||||||||||||||||||||||||||||||||
983 | GtkShadowType shadow_type; | - | ||||||||||||||||||||||||||||||||||||
984 | GtkWidget *gtkStatusbarFrame = d->gtkWidget("GtkStatusbar.GtkFrame"); | - | ||||||||||||||||||||||||||||||||||||
985 | d->gtk_widget_style_get(d->gtk_widget_get_parent(gtkStatusbarFrame), "shadow-type", &shadow_type, NULL); | - | ||||||||||||||||||||||||||||||||||||
986 | gtkPainter->paintShadow(gtkStatusbarFrame, "frame", option->rect, GTK_STATE_NORMAL, | - | ||||||||||||||||||||||||||||||||||||
987 | shadow_type, d->gtk_widget_get_style(gtkStatusbarFrame)); | - | ||||||||||||||||||||||||||||||||||||
988 | } | - | ||||||||||||||||||||||||||||||||||||
989 | break; never executed: break; | 0 | ||||||||||||||||||||||||||||||||||||
990 | - | |||||||||||||||||||||||||||||||||||||
991 | case PE_IndicatorHeaderArrow: never executed: case PE_IndicatorHeaderArrow: | 0 | ||||||||||||||||||||||||||||||||||||
992 | if (const QStyleOptionHeader *header = qstyleoption_cast<const QStyleOptionHeader *>(option)) {
| 0 | ||||||||||||||||||||||||||||||||||||
993 | GtkWidget *gtkTreeHeader = d->gtkWidget("GtkTreeView.GtkButton"); | - | ||||||||||||||||||||||||||||||||||||
994 | GtkStateType state = qt_gtk_state(option); | - | ||||||||||||||||||||||||||||||||||||
995 | style = d->gtk_widget_get_style(gtkTreeHeader); | - | ||||||||||||||||||||||||||||||||||||
996 | GtkArrowType type = GTK_ARROW_UP; | - | ||||||||||||||||||||||||||||||||||||
997 | // This sorting indicator inversion is intentional, and follows the GNOME HIG. | - | ||||||||||||||||||||||||||||||||||||
998 | // See http://library.gnome.org/devel/hig-book/stable/controls-lists.html.en#controls-lists-sortable | - | ||||||||||||||||||||||||||||||||||||
999 | if (header->sortIndicator & QStyleOptionHeader::SortUp)
| 0 | ||||||||||||||||||||||||||||||||||||
1000 | type = GTK_ARROW_UP; never executed: type = GTK_ARROW_UP; | 0 | ||||||||||||||||||||||||||||||||||||
1001 | else if (header->sortIndicator & QStyleOptionHeader::SortDown)
| 0 | ||||||||||||||||||||||||||||||||||||
1002 | type = GTK_ARROW_DOWN; never executed: type = GTK_ARROW_DOWN; | 0 | ||||||||||||||||||||||||||||||||||||
1003 | - | |||||||||||||||||||||||||||||||||||||
1004 | gtkPainter->paintArrow(gtkTreeHeader, "button", option->rect.adjusted(1, 1, -1, -1), type, state, | - | ||||||||||||||||||||||||||||||||||||
1005 | GTK_SHADOW_NONE, false, style); | - | ||||||||||||||||||||||||||||||||||||
1006 | } never executed: end of block | 0 | ||||||||||||||||||||||||||||||||||||
1007 | break; never executed: break; | 0 | ||||||||||||||||||||||||||||||||||||
1008 | - | |||||||||||||||||||||||||||||||||||||
1009 | case PE_FrameDefaultButton: // fall through never executed: case PE_FrameDefaultButton: | 0 | ||||||||||||||||||||||||||||||||||||
1010 | case PE_FrameFocusRect: { never executed: case PE_FrameFocusRect: | 0 | ||||||||||||||||||||||||||||||||||||
1011 | QRect frameRect = option->rect.adjusted(1, 1, -2, -2); // ### this mess should move to subcontrolrect | - | ||||||||||||||||||||||||||||||||||||
1012 | if (qobject_cast<const QAbstractItemView*>(widget)) {
| 0 | ||||||||||||||||||||||||||||||||||||
1013 | // Don't draw anything | - | ||||||||||||||||||||||||||||||||||||
1014 | } else if (qobject_cast<const QTabBar*>(widget)) { never executed: end of block
| 0 | ||||||||||||||||||||||||||||||||||||
1015 | GtkWidget *gtkNotebook = d->gtkWidget("GtkNotebook"); | - | ||||||||||||||||||||||||||||||||||||
1016 | style = d->gtk_widget_get_style(gtkNotebook); | - | ||||||||||||||||||||||||||||||||||||
1017 | gtkPainter->paintFocus(gtkNotebook, "tab", frameRect.adjusted(-1, 1, 1, 1), GTK_STATE_ACTIVE, style); | - | ||||||||||||||||||||||||||||||||||||
1018 | } else { never executed: end of block | 0 | ||||||||||||||||||||||||||||||||||||
1019 | GtkWidget *gtkRadioButton = d->gtkWidget("GtkRadioButton"); | - | ||||||||||||||||||||||||||||||||||||
1020 | gtkPainter->paintFocus(gtkRadioButton, "radiobutton", frameRect, GTK_STATE_ACTIVE, style); | - | ||||||||||||||||||||||||||||||||||||
1021 | } never executed: end of block | 0 | ||||||||||||||||||||||||||||||||||||
1022 | } | - | ||||||||||||||||||||||||||||||||||||
1023 | break; never executed: break; | 0 | ||||||||||||||||||||||||||||||||||||
1024 | - | |||||||||||||||||||||||||||||||||||||
1025 | case PE_IndicatorBranch: never executed: case PE_IndicatorBranch: | 0 | ||||||||||||||||||||||||||||||||||||
1026 | if (option->state & State_Children) {
| 0 | ||||||||||||||||||||||||||||||||||||
1027 | QRect rect = option->rect; | - | ||||||||||||||||||||||||||||||||||||
1028 | rect = QRect(0, 0, 12, 12); | - | ||||||||||||||||||||||||||||||||||||
1029 | rect.moveCenter(option->rect.center()); | - | ||||||||||||||||||||||||||||||||||||
1030 | rect.translate(2, 0); | - | ||||||||||||||||||||||||||||||||||||
1031 | GtkExpanderStyle openState = GTK_EXPANDER_EXPANDED; | - | ||||||||||||||||||||||||||||||||||||
1032 | GtkExpanderStyle closedState = GTK_EXPANDER_COLLAPSED; | - | ||||||||||||||||||||||||||||||||||||
1033 | GtkWidget *gtkTreeView = d->gtkWidget("GtkTreeView"); | - | ||||||||||||||||||||||||||||||||||||
1034 | - | |||||||||||||||||||||||||||||||||||||
1035 | GtkStateType state = GTK_STATE_NORMAL; | - | ||||||||||||||||||||||||||||||||||||
1036 | if (!(option->state & State_Enabled))
| 0 | ||||||||||||||||||||||||||||||||||||
1037 | state = GTK_STATE_INSENSITIVE; never executed: state = GTK_STATE_INSENSITIVE; | 0 | ||||||||||||||||||||||||||||||||||||
1038 | else if (option->state & State_MouseOver)
| 0 | ||||||||||||||||||||||||||||||||||||
1039 | state = GTK_STATE_PRELIGHT; never executed: state = GTK_STATE_PRELIGHT; | 0 | ||||||||||||||||||||||||||||||||||||
1040 | - | |||||||||||||||||||||||||||||||||||||
1041 | gtkPainter->paintExpander(gtkTreeView, "treeview", rect, state, | - | ||||||||||||||||||||||||||||||||||||
1042 | option->state & State_Open ? openState : closedState , d->gtk_widget_get_style(gtkTreeView)); | - | ||||||||||||||||||||||||||||||||||||
1043 | } never executed: end of block | 0 | ||||||||||||||||||||||||||||||||||||
1044 | break; never executed: break; | 0 | ||||||||||||||||||||||||||||||||||||
1045 | - | |||||||||||||||||||||||||||||||||||||
1046 | case PE_PanelItemViewRow: never executed: case PE_PanelItemViewRow: | 0 | ||||||||||||||||||||||||||||||||||||
1047 | // This primitive is only used to draw selection behind selected expander arrows. | - | ||||||||||||||||||||||||||||||||||||
1048 | // We try not to decorate the tree branch background unless you inherit from StyledItemDelegate | - | ||||||||||||||||||||||||||||||||||||
1049 | // The reason for this is that a lot of code that relies on custom item delegates will look odd having | - | ||||||||||||||||||||||||||||||||||||
1050 | // a gradient on the branch but a flat shaded color on the item itself. | - | ||||||||||||||||||||||||||||||||||||
1051 | QCommonStyle::drawPrimitive(element, option, painter, widget); | - | ||||||||||||||||||||||||||||||||||||
1052 | if (!(option->state & State_Selected)) {
| 0 | ||||||||||||||||||||||||||||||||||||
1053 | break; never executed: break; | 0 | ||||||||||||||||||||||||||||||||||||
1054 | } else { | - | ||||||||||||||||||||||||||||||||||||
1055 | if (const QAbstractItemView *view = qobject_cast<const QAbstractItemView*>(widget)) {
| 0 | ||||||||||||||||||||||||||||||||||||
1056 | if (!qobject_cast<QStyledItemDelegate*>(view->itemDelegate()))
| 0 | ||||||||||||||||||||||||||||||||||||
1057 | break; never executed: break; | 0 | ||||||||||||||||||||||||||||||||||||
1058 | } never executed: end of block | 0 | ||||||||||||||||||||||||||||||||||||
1059 | } // fall through never executed: end of block | 0 | ||||||||||||||||||||||||||||||||||||
1060 | - | |||||||||||||||||||||||||||||||||||||
1061 | case PE_PanelItemViewItem: code before this statement never executed: case PE_PanelItemViewItem: never executed: case PE_PanelItemViewItem: | 0 | ||||||||||||||||||||||||||||||||||||
1062 | if (const QStyleOptionViewItem *vopt = qstyleoption_cast<const QStyleOptionViewItem *>(option)) {
| 0 | ||||||||||||||||||||||||||||||||||||
1063 | uint resolve_mask = vopt->palette.resolve(); | - | ||||||||||||||||||||||||||||||||||||
1064 | if (vopt->backgroundBrush.style() != Qt::NoBrush
| 0 | ||||||||||||||||||||||||||||||||||||
1065 | || (resolve_mask & (1 << QPalette::Base)))
| 0 | ||||||||||||||||||||||||||||||||||||
1066 | { | - | ||||||||||||||||||||||||||||||||||||
1067 | QPointF oldBO = painter->brushOrigin(); | - | ||||||||||||||||||||||||||||||||||||
1068 | painter->setBrushOrigin(vopt->rect.topLeft()); | - | ||||||||||||||||||||||||||||||||||||
1069 | painter->fillRect(vopt->rect, vopt->backgroundBrush); | - | ||||||||||||||||||||||||||||||||||||
1070 | painter->setBrushOrigin(oldBO); | - | ||||||||||||||||||||||||||||||||||||
1071 | if (!(option->state & State_Selected))
| 0 | ||||||||||||||||||||||||||||||||||||
1072 | break; never executed: break; | 0 | ||||||||||||||||||||||||||||||||||||
1073 | } never executed: end of block | 0 | ||||||||||||||||||||||||||||||||||||
1074 | if (GtkWidget *gtkTreeView = d->gtkWidget("GtkTreeView")) {
| 0 | ||||||||||||||||||||||||||||||||||||
1075 | const char *detail = "cell_even_ruled"; | - | ||||||||||||||||||||||||||||||||||||
1076 | if (vopt && vopt->features & QStyleOptionViewItem::Alternate)
| 0 | ||||||||||||||||||||||||||||||||||||
1077 | detail = "cell_odd_ruled"; never executed: detail = "cell_odd_ruled"; | 0 | ||||||||||||||||||||||||||||||||||||
1078 | bool isActive = option->state & State_Active; | - | ||||||||||||||||||||||||||||||||||||
1079 | QString key; | - | ||||||||||||||||||||||||||||||||||||
1080 | if (isActive ) {
| 0 | ||||||||||||||||||||||||||||||||||||
1081 | // Required for active/non-active window appearance | - | ||||||||||||||||||||||||||||||||||||
1082 | key = QLS("a"); | - | ||||||||||||||||||||||||||||||||||||
1083 | QGtkStylePrivate::gtkWidgetSetFocus(gtkTreeView, true); | - | ||||||||||||||||||||||||||||||||||||
1084 | } never executed: end of block | 0 | ||||||||||||||||||||||||||||||||||||
1085 | bool isEnabled = (widget ? widget->isEnabled() : (vopt->state & QStyle::State_Enabled));
| 0 | ||||||||||||||||||||||||||||||||||||
1086 | gtkPainter->paintFlatBox(gtkTreeView, detail, option->rect, | - | ||||||||||||||||||||||||||||||||||||
1087 | option->state & State_Selected ? GTK_STATE_SELECTED : | - | ||||||||||||||||||||||||||||||||||||
1088 | isEnabled ? GTK_STATE_NORMAL : GTK_STATE_INSENSITIVE, | - | ||||||||||||||||||||||||||||||||||||
1089 | GTK_SHADOW_OUT, d->gtk_widget_get_style(gtkTreeView), key); | - | ||||||||||||||||||||||||||||||||||||
1090 | if (isActive )
| 0 | ||||||||||||||||||||||||||||||||||||
1091 | QGtkStylePrivate::gtkWidgetSetFocus(gtkTreeView, false); never executed: QGtkStylePrivate::gtkWidgetSetFocus(gtkTreeView, false); | 0 | ||||||||||||||||||||||||||||||||||||
1092 | } never executed: end of block | 0 | ||||||||||||||||||||||||||||||||||||
1093 | } never executed: end of block | 0 | ||||||||||||||||||||||||||||||||||||
1094 | break; never executed: break; | 0 | ||||||||||||||||||||||||||||||||||||
1095 | case PE_IndicatorToolBarSeparator: never executed: case PE_IndicatorToolBarSeparator: | 0 | ||||||||||||||||||||||||||||||||||||
1096 | { | - | ||||||||||||||||||||||||||||||||||||
1097 | const int margin = 6; | - | ||||||||||||||||||||||||||||||||||||
1098 | GtkWidget *gtkSeparator = d->gtkWidget("GtkToolbar.GtkSeparatorToolItem"); | - | ||||||||||||||||||||||||||||||||||||
1099 | if (option->state & State_Horizontal) {
| 0 | ||||||||||||||||||||||||||||||||||||
1100 | const int offset = option->rect.width()/2; | - | ||||||||||||||||||||||||||||||||||||
1101 | QRect rect = option->rect.adjusted(offset, margin, 0, -margin); | - | ||||||||||||||||||||||||||||||||||||
1102 | painter->setPen(QPen(option->palette.background().color().darker(110))); | - | ||||||||||||||||||||||||||||||||||||
1103 | gtkPainter->paintVline(gtkSeparator, "vseparator", | - | ||||||||||||||||||||||||||||||||||||
1104 | rect, GTK_STATE_NORMAL, d->gtk_widget_get_style(gtkSeparator), | - | ||||||||||||||||||||||||||||||||||||
1105 | 0, rect.height(), 0); | - | ||||||||||||||||||||||||||||||||||||
1106 | } else { //Draw vertical separator never executed: end of block | 0 | ||||||||||||||||||||||||||||||||||||
1107 | const int offset = option->rect.height()/2; | - | ||||||||||||||||||||||||||||||||||||
1108 | QRect rect = option->rect.adjusted(margin, offset, -margin, 0); | - | ||||||||||||||||||||||||||||||||||||
1109 | painter->setPen(QPen(option->palette.background().color().darker(110))); | - | ||||||||||||||||||||||||||||||||||||
1110 | gtkPainter->paintHline(gtkSeparator, "hseparator", | - | ||||||||||||||||||||||||||||||||||||
1111 | rect, GTK_STATE_NORMAL, d->gtk_widget_get_style(gtkSeparator), | - | ||||||||||||||||||||||||||||||||||||
1112 | 0, rect.width(), 0); | - | ||||||||||||||||||||||||||||||||||||
1113 | } never executed: end of block | 0 | ||||||||||||||||||||||||||||||||||||
1114 | } | - | ||||||||||||||||||||||||||||||||||||
1115 | break; never executed: break; | 0 | ||||||||||||||||||||||||||||||||||||
1116 | - | |||||||||||||||||||||||||||||||||||||
1117 | case PE_IndicatorToolBarHandle: { never executed: case PE_IndicatorToolBarHandle: | 0 | ||||||||||||||||||||||||||||||||||||
1118 | GtkWidget *gtkToolbar = d->gtkWidget("GtkToolbar"); | - | ||||||||||||||||||||||||||||||||||||
1119 | GtkShadowType shadow_type; | - | ||||||||||||||||||||||||||||||||||||
1120 | d->gtk_widget_style_get(gtkToolbar, "shadow-type", &shadow_type, NULL); | - | ||||||||||||||||||||||||||||||||||||
1121 | //Note when the toolbar is horizontal, the handle is vertical | - | ||||||||||||||||||||||||||||||||||||
1122 | painter->setClipRect(option->rect); | - | ||||||||||||||||||||||||||||||||||||
1123 | gtkPainter->paintHandle(gtkToolbar, "toolbar", option->rect.adjusted(-1, -1 ,0 ,1), | - | ||||||||||||||||||||||||||||||||||||
1124 | GTK_STATE_NORMAL, shadow_type, !(option->state & State_Horizontal) ? | - | ||||||||||||||||||||||||||||||||||||
1125 | GTK_ORIENTATION_HORIZONTAL : GTK_ORIENTATION_VERTICAL, d->gtk_widget_get_style(gtkToolbar)); | - | ||||||||||||||||||||||||||||||||||||
1126 | } | - | ||||||||||||||||||||||||||||||||||||
1127 | break; never executed: break; | 0 | ||||||||||||||||||||||||||||||||||||
1128 | - | |||||||||||||||||||||||||||||||||||||
1129 | case PE_IndicatorArrowUp: never executed: case PE_IndicatorArrowUp: | 0 | ||||||||||||||||||||||||||||||||||||
1130 | case PE_IndicatorArrowDown: never executed: case PE_IndicatorArrowDown: | 0 | ||||||||||||||||||||||||||||||||||||
1131 | case PE_IndicatorArrowLeft: never executed: case PE_IndicatorArrowLeft: | 0 | ||||||||||||||||||||||||||||||||||||
1132 | case PE_IndicatorArrowRight: { never executed: case PE_IndicatorArrowRight: | 0 | ||||||||||||||||||||||||||||||||||||
1133 | - | |||||||||||||||||||||||||||||||||||||
1134 | - | |||||||||||||||||||||||||||||||||||||
1135 | GtkArrowType type = GTK_ARROW_UP; | - | ||||||||||||||||||||||||||||||||||||
1136 | - | |||||||||||||||||||||||||||||||||||||
1137 | switch (element) { | - | ||||||||||||||||||||||||||||||||||||
1138 | - | |||||||||||||||||||||||||||||||||||||
1139 | case PE_IndicatorArrowDown: never executed: case PE_IndicatorArrowDown: | 0 | ||||||||||||||||||||||||||||||||||||
1140 | type = GTK_ARROW_DOWN; | - | ||||||||||||||||||||||||||||||||||||
1141 | break; never executed: break; | 0 | ||||||||||||||||||||||||||||||||||||
1142 | - | |||||||||||||||||||||||||||||||||||||
1143 | case PE_IndicatorArrowLeft: never executed: case PE_IndicatorArrowLeft: | 0 | ||||||||||||||||||||||||||||||||||||
1144 | type = GTK_ARROW_LEFT; | - | ||||||||||||||||||||||||||||||||||||
1145 | break; never executed: break; | 0 | ||||||||||||||||||||||||||||||||||||
1146 | - | |||||||||||||||||||||||||||||||||||||
1147 | case PE_IndicatorArrowRight: never executed: case PE_IndicatorArrowRight: | 0 | ||||||||||||||||||||||||||||||||||||
1148 | type = GTK_ARROW_RIGHT; | - | ||||||||||||||||||||||||||||||||||||
1149 | break; never executed: break; | 0 | ||||||||||||||||||||||||||||||||||||
1150 | - | |||||||||||||||||||||||||||||||||||||
1151 | default: never executed: default: | 0 | ||||||||||||||||||||||||||||||||||||
1152 | break; never executed: break; | 0 | ||||||||||||||||||||||||||||||||||||
1153 | } | - | ||||||||||||||||||||||||||||||||||||
1154 | int size = qMin(option->rect.height(), option->rect.width()); | - | ||||||||||||||||||||||||||||||||||||
1155 | int border = (size > 9) ? (size/4) : 0; //Allow small arrows to have exact dimensions
| 0 | ||||||||||||||||||||||||||||||||||||
1156 | int bsx = 0, bsy = 0; | - | ||||||||||||||||||||||||||||||||||||
1157 | if (option->state & State_Sunken) {
| 0 | ||||||||||||||||||||||||||||||||||||
1158 | bsx = proxy()->pixelMetric(PM_ButtonShiftHorizontal); | - | ||||||||||||||||||||||||||||||||||||
1159 | bsy = proxy()->pixelMetric(PM_ButtonShiftVertical); | - | ||||||||||||||||||||||||||||||||||||
1160 | } never executed: end of block | 0 | ||||||||||||||||||||||||||||||||||||
1161 | QRect arrowRect = option->rect.adjusted(border + bsx, border + bsy, -border + bsx, -border + bsy); | - | ||||||||||||||||||||||||||||||||||||
1162 | GtkShadowType shadow = option->state & State_Sunken ? GTK_SHADOW_IN : GTK_SHADOW_OUT;
| 0 | ||||||||||||||||||||||||||||||||||||
1163 | GtkStateType state = qt_gtk_state(option); | - | ||||||||||||||||||||||||||||||||||||
1164 | - | |||||||||||||||||||||||||||||||||||||
1165 | QColor arrowColor = option->palette.buttonText().color(); | - | ||||||||||||||||||||||||||||||||||||
1166 | GtkWidget *gtkArrow = d->gtkWidget("GtkArrow"); | - | ||||||||||||||||||||||||||||||||||||
1167 | GdkColor color = fromQColor(arrowColor); | - | ||||||||||||||||||||||||||||||||||||
1168 | d->gtk_widget_modify_fg (gtkArrow, state, &color); | - | ||||||||||||||||||||||||||||||||||||
1169 | gtkPainter->paintArrow(gtkArrow, "button", arrowRect, | - | ||||||||||||||||||||||||||||||||||||
1170 | type, state, shadow, false, d->gtk_widget_get_style(gtkArrow), | - | ||||||||||||||||||||||||||||||||||||
1171 | QString::number(arrowColor.rgba(), 16)); | - | ||||||||||||||||||||||||||||||||||||
1172 | // Passing NULL will revert the color change | - | ||||||||||||||||||||||||||||||||||||
1173 | d->gtk_widget_modify_fg (gtkArrow, state, NULL); | - | ||||||||||||||||||||||||||||||||||||
1174 | } | - | ||||||||||||||||||||||||||||||||||||
1175 | break; never executed: break; | 0 | ||||||||||||||||||||||||||||||||||||
1176 | - | |||||||||||||||||||||||||||||||||||||
1177 | case PE_FrameGroupBox: never executed: case PE_FrameGroupBox: | 0 | ||||||||||||||||||||||||||||||||||||
1178 | // Do nothing here, the GNOME groupboxes are flat | - | ||||||||||||||||||||||||||||||||||||
1179 | break; never executed: break; | 0 | ||||||||||||||||||||||||||||||||||||
1180 | - | |||||||||||||||||||||||||||||||||||||
1181 | case PE_PanelMenu: { never executed: case PE_PanelMenu: | 0 | ||||||||||||||||||||||||||||||||||||
1182 | GtkWidget *gtkMenu = d->gtkWidget("GtkMenu"); | - | ||||||||||||||||||||||||||||||||||||
1183 | gtkPainter->setAlphaSupport(false); // Note, alpha disabled for performance reasons | - | ||||||||||||||||||||||||||||||||||||
1184 | gtkPainter->paintBox(gtkMenu, "menu", option->rect, GTK_STATE_NORMAL, GTK_SHADOW_OUT, d->gtk_widget_get_style(gtkMenu), QString()); | - | ||||||||||||||||||||||||||||||||||||
1185 | } | - | ||||||||||||||||||||||||||||||||||||
1186 | break; never executed: break; | 0 | ||||||||||||||||||||||||||||||||||||
1187 | - | |||||||||||||||||||||||||||||||||||||
1188 | case PE_FrameMenu: never executed: case PE_FrameMenu: | 0 | ||||||||||||||||||||||||||||||||||||
1189 | //This is actually done by PE_Widget due to a clipping issue | - | ||||||||||||||||||||||||||||||||||||
1190 | //Otherwise Menu items will not be able to span the entire menu width | - | ||||||||||||||||||||||||||||||||||||
1191 | - | |||||||||||||||||||||||||||||||||||||
1192 | // This is only used by floating tool bars | - | ||||||||||||||||||||||||||||||||||||
1193 | if (qobject_cast<const QToolBar *>(widget)) {
| 0 | ||||||||||||||||||||||||||||||||||||
1194 | GtkWidget *gtkMenubar = d->gtkWidget("GtkMenuBar"); | - | ||||||||||||||||||||||||||||||||||||
1195 | gtkPainter->paintBox(gtkMenubar, "toolbar", option->rect, | - | ||||||||||||||||||||||||||||||||||||
1196 | GTK_STATE_NORMAL, GTK_SHADOW_OUT, style); | - | ||||||||||||||||||||||||||||||||||||
1197 | gtkPainter->paintBox(gtkMenubar, "menu", option->rect, | - | ||||||||||||||||||||||||||||||||||||
1198 | GTK_STATE_NORMAL, GTK_SHADOW_OUT, style); | - | ||||||||||||||||||||||||||||||||||||
1199 | } never executed: end of block | 0 | ||||||||||||||||||||||||||||||||||||
1200 | break; never executed: break; | 0 | ||||||||||||||||||||||||||||||||||||
1201 | - | |||||||||||||||||||||||||||||||||||||
1202 | case PE_FrameLineEdit: { never executed: case PE_FrameLineEdit: | 0 | ||||||||||||||||||||||||||||||||||||
1203 | GtkWidget *gtkEntry = d->gtkWidget("GtkEntry"); | - | ||||||||||||||||||||||||||||||||||||
1204 | - | |||||||||||||||||||||||||||||||||||||
1205 | - | |||||||||||||||||||||||||||||||||||||
1206 | gboolean interior_focus; | - | ||||||||||||||||||||||||||||||||||||
1207 | gint focus_line_width; | - | ||||||||||||||||||||||||||||||||||||
1208 | QRect rect = option->rect; | - | ||||||||||||||||||||||||||||||||||||
1209 | d->gtk_widget_style_get(gtkEntry, | - | ||||||||||||||||||||||||||||||||||||
1210 | "interior-focus", &interior_focus, | - | ||||||||||||||||||||||||||||||||||||
1211 | "focus-line-width", &focus_line_width, NULL); | - | ||||||||||||||||||||||||||||||||||||
1212 | - | |||||||||||||||||||||||||||||||||||||
1213 | // See https://bugzilla.mozilla.org/show_bug.cgi?id=405421 for info about this hack | - | ||||||||||||||||||||||||||||||||||||
1214 | g_object_set_data(G_OBJECT(gtkEntry), "transparent-bg-hint", GINT_TO_POINTER(true)); | - | ||||||||||||||||||||||||||||||||||||
1215 | - | |||||||||||||||||||||||||||||||||||||
1216 | if (!interior_focus && option->state & State_HasFocus)
| 0 | ||||||||||||||||||||||||||||||||||||
1217 | rect.adjust(focus_line_width, focus_line_width, -focus_line_width, -focus_line_width); never executed: rect.adjust(focus_line_width, focus_line_width, -focus_line_width, -focus_line_width); | 0 | ||||||||||||||||||||||||||||||||||||
1218 | - | |||||||||||||||||||||||||||||||||||||
1219 | if (option->state & State_HasFocus)
| 0 | ||||||||||||||||||||||||||||||||||||
1220 | QGtkStylePrivate::gtkWidgetSetFocus(gtkEntry, true); never executed: QGtkStylePrivate::gtkWidgetSetFocus(gtkEntry, true); | 0 | ||||||||||||||||||||||||||||||||||||
1221 | gtkPainter->paintShadow(gtkEntry, "entry", rect, option->state & State_Enabled ? | - | ||||||||||||||||||||||||||||||||||||
1222 | GTK_STATE_NORMAL : GTK_STATE_INSENSITIVE, | - | ||||||||||||||||||||||||||||||||||||
1223 | GTK_SHADOW_IN, d->gtk_widget_get_style(gtkEntry), | - | ||||||||||||||||||||||||||||||||||||
1224 | option->state & State_HasFocus ? QLS("focus") : QString()); | - | ||||||||||||||||||||||||||||||||||||
1225 | if (!interior_focus && option->state & State_HasFocus)
| 0 | ||||||||||||||||||||||||||||||||||||
1226 | gtkPainter->paintShadow(gtkEntry, "entry", option->rect, option->state & State_Enabled ? never executed: gtkPainter->paintShadow(gtkEntry, "entry", option->rect, option->state & State_Enabled ? GTK_STATE_ACTIVE : GTK_STATE_INSENSITIVE, GTK_SHADOW_IN, d->gtk_widget_get_style(gtkEntry), QLatin1String("GtkEntryShadowIn")); | 0 | ||||||||||||||||||||||||||||||||||||
1227 | GTK_STATE_ACTIVE : GTK_STATE_INSENSITIVE, never executed: gtkPainter->paintShadow(gtkEntry, "entry", option->rect, option->state & State_Enabled ? GTK_STATE_ACTIVE : GTK_STATE_INSENSITIVE, GTK_SHADOW_IN, d->gtk_widget_get_style(gtkEntry), QLatin1String("GtkEntryShadowIn")); | 0 | ||||||||||||||||||||||||||||||||||||
1228 | GTK_SHADOW_IN, d->gtk_widget_get_style(gtkEntry), QLS("GtkEntryShadowIn")); never executed: gtkPainter->paintShadow(gtkEntry, "entry", option->rect, option->state & State_Enabled ? GTK_STATE_ACTIVE : GTK_STATE_INSENSITIVE, GTK_SHADOW_IN, d->gtk_widget_get_style(gtkEntry), QLatin1String("GtkEntryShadowIn")); | 0 | ||||||||||||||||||||||||||||||||||||
1229 | - | |||||||||||||||||||||||||||||||||||||
1230 | if (option->state & State_HasFocus)
| 0 | ||||||||||||||||||||||||||||||||||||
1231 | QGtkStylePrivate::gtkWidgetSetFocus(gtkEntry, false); never executed: QGtkStylePrivate::gtkWidgetSetFocus(gtkEntry, false); | 0 | ||||||||||||||||||||||||||||||||||||
1232 | } | - | ||||||||||||||||||||||||||||||||||||
1233 | break; never executed: break; | 0 | ||||||||||||||||||||||||||||||||||||
1234 | - | |||||||||||||||||||||||||||||||||||||
1235 | case PE_PanelLineEdit: never executed: case PE_PanelLineEdit: | 0 | ||||||||||||||||||||||||||||||||||||
1236 | if (const QStyleOptionFrame *panel = qstyleoption_cast<const QStyleOptionFrame *>(option)) {
| 0 | ||||||||||||||||||||||||||||||||||||
1237 | GtkWidget *gtkEntry = d->gtkWidget("GtkEntry"); | - | ||||||||||||||||||||||||||||||||||||
1238 | if (panel->lineWidth > 0)
| 0 | ||||||||||||||||||||||||||||||||||||
1239 | proxy()->drawPrimitive(PE_FrameLineEdit, option, painter, widget); never executed: proxy()->drawPrimitive(PE_FrameLineEdit, option, painter, widget); | 0 | ||||||||||||||||||||||||||||||||||||
1240 | uint resolve_mask = option->palette.resolve(); | - | ||||||||||||||||||||||||||||||||||||
1241 | GtkStyle *gtkEntryStyle = d->gtk_widget_get_style(gtkEntry); | - | ||||||||||||||||||||||||||||||||||||
1242 | QRect textRect = option->rect.adjusted(gtkEntryStyle->xthickness, gtkEntryStyle->ythickness, | - | ||||||||||||||||||||||||||||||||||||
1243 | -gtkEntryStyle->xthickness, -gtkEntryStyle->ythickness); | - | ||||||||||||||||||||||||||||||||||||
1244 | - | |||||||||||||||||||||||||||||||||||||
1245 | if (widget && widget->testAttribute(Qt::WA_SetPalette) &&
| 0 | ||||||||||||||||||||||||||||||||||||
1246 | resolve_mask & (1 << QPalette::Base)) // Palette overridden by user
| 0 | ||||||||||||||||||||||||||||||||||||
1247 | painter->fillRect(textRect, option->palette.base()); never executed: painter->fillRect(textRect, option->palette.base()); | 0 | ||||||||||||||||||||||||||||||||||||
1248 | else | - | ||||||||||||||||||||||||||||||||||||
1249 | gtkPainter->paintFlatBox(gtkEntry, "entry_bg", textRect, never executed: gtkPainter->paintFlatBox(gtkEntry, "entry_bg", textRect, option->state & State_Enabled ? GTK_STATE_NORMAL : GTK_STATE_INSENSITIVE, GTK_SHADOW_NONE, gtkEntryStyle); | 0 | ||||||||||||||||||||||||||||||||||||
1250 | option->state & State_Enabled ? GTK_STATE_NORMAL : GTK_STATE_INSENSITIVE, GTK_SHADOW_NONE, gtkEntryStyle); never executed: gtkPainter->paintFlatBox(gtkEntry, "entry_bg", textRect, option->state & State_Enabled ? GTK_STATE_NORMAL : GTK_STATE_INSENSITIVE, GTK_SHADOW_NONE, gtkEntryStyle); | 0 | ||||||||||||||||||||||||||||||||||||
1251 | } | - | ||||||||||||||||||||||||||||||||||||
1252 | break; never executed: break; | 0 | ||||||||||||||||||||||||||||||||||||
1253 | - | |||||||||||||||||||||||||||||||||||||
1254 | case PE_FrameTabWidget: never executed: case PE_FrameTabWidget: | 0 | ||||||||||||||||||||||||||||||||||||
1255 | if (const QStyleOptionTabWidgetFrame *frame = qstyleoption_cast<const QStyleOptionTabWidgetFrame*>(option)) {
| 0 | ||||||||||||||||||||||||||||||||||||
1256 | GtkWidget *gtkNotebook = d->gtkWidget("GtkNotebook"); | - | ||||||||||||||||||||||||||||||||||||
1257 | style = d->gtk_widget_get_style(gtkNotebook); | - | ||||||||||||||||||||||||||||||||||||
1258 | gtkPainter->setAlphaSupport(false); | - | ||||||||||||||||||||||||||||||||||||
1259 | GtkShadowType shadow = GTK_SHADOW_OUT; | - | ||||||||||||||||||||||||||||||||||||
1260 | GtkStateType state = GTK_STATE_NORMAL; // Only state supported by gtknotebook | - | ||||||||||||||||||||||||||||||||||||
1261 | bool reverse = (option->direction == Qt::RightToLeft); | - | ||||||||||||||||||||||||||||||||||||
1262 | QGtkStylePrivate::gtk_widget_set_direction(gtkNotebook, reverse ? GTK_TEXT_DIR_RTL : GTK_TEXT_DIR_LTR); | - | ||||||||||||||||||||||||||||||||||||
1263 | if (const QStyleOptionTabWidgetFrameV2 *tabframe = qstyleoption_cast<const QStyleOptionTabWidgetFrameV2*>(option)) {
| 0 | ||||||||||||||||||||||||||||||||||||
1264 | GtkPositionType frameType = GTK_POS_TOP; | - | ||||||||||||||||||||||||||||||||||||
1265 | QTabBar::Shape shape = frame->shape; | - | ||||||||||||||||||||||||||||||||||||
1266 | int gapStart = 0; | - | ||||||||||||||||||||||||||||||||||||
1267 | int gapSize = 0; | - | ||||||||||||||||||||||||||||||||||||
1268 | if (shape == QTabBar::RoundedNorth || shape == QTabBar::RoundedSouth) {
| 0 | ||||||||||||||||||||||||||||||||||||
1269 | frameType = (shape == QTabBar::RoundedNorth) ? GTK_POS_TOP : GTK_POS_BOTTOM;
| 0 | ||||||||||||||||||||||||||||||||||||
1270 | gapStart = tabframe->selectedTabRect.left(); | - | ||||||||||||||||||||||||||||||||||||
1271 | gapSize = tabframe->selectedTabRect.width(); | - | ||||||||||||||||||||||||||||||||||||
1272 | } else { never executed: end of block | 0 | ||||||||||||||||||||||||||||||||||||
1273 | frameType = (shape == QTabBar::RoundedWest) ? GTK_POS_LEFT : GTK_POS_RIGHT;
| 0 | ||||||||||||||||||||||||||||||||||||
1274 | gapStart = tabframe->selectedTabRect.y(); | - | ||||||||||||||||||||||||||||||||||||
1275 | gapSize = tabframe->selectedTabRect.height(); | - | ||||||||||||||||||||||||||||||||||||
1276 | } never executed: end of block | 0 | ||||||||||||||||||||||||||||||||||||
1277 | gtkPainter->paintBoxGap(gtkNotebook, "notebook", option->rect, state, shadow, frameType, | - | ||||||||||||||||||||||||||||||||||||
1278 | gapStart, gapSize, style); | - | ||||||||||||||||||||||||||||||||||||
1279 | break; // done never executed: break; | 0 | ||||||||||||||||||||||||||||||||||||
1280 | } | - | ||||||||||||||||||||||||||||||||||||
1281 | - | |||||||||||||||||||||||||||||||||||||
1282 | // Note this is only the fallback option | - | ||||||||||||||||||||||||||||||||||||
1283 | gtkPainter->paintBox(gtkNotebook, "notebook", option->rect, state, shadow, style); | - | ||||||||||||||||||||||||||||||||||||
1284 | } never executed: end of block | 0 | ||||||||||||||||||||||||||||||||||||
1285 | break; never executed: break; | 0 | ||||||||||||||||||||||||||||||||||||
1286 | - | |||||||||||||||||||||||||||||||||||||
1287 | case PE_PanelButtonCommand: never executed: case PE_PanelButtonCommand: | 0 | ||||||||||||||||||||||||||||||||||||
1288 | case PE_PanelButtonTool: { never executed: case PE_PanelButtonTool: | 0 | ||||||||||||||||||||||||||||||||||||
1289 | bool isDefault = false; | - | ||||||||||||||||||||||||||||||||||||
1290 | bool isTool = (element == PE_PanelButtonTool); | - | ||||||||||||||||||||||||||||||||||||
1291 | if (const QStyleOptionButton *btn = qstyleoption_cast<const QStyleOptionButton*>(option))
| 0 | ||||||||||||||||||||||||||||||||||||
1292 | isDefault = btn->features & QStyleOptionButton::DefaultButton; never executed: isDefault = btn->features & QStyleOptionButton::DefaultButton; | 0 | ||||||||||||||||||||||||||||||||||||
1293 | - | |||||||||||||||||||||||||||||||||||||
1294 | // don't draw a frame for tool buttons that have the autoRaise flag and are not enabled or on | - | ||||||||||||||||||||||||||||||||||||
1295 | if (isTool && !(option->state & State_Enabled || option->state & State_On) && (option->state & State_AutoRaise))
| 0 | ||||||||||||||||||||||||||||||||||||
1296 | break; never executed: break; | 0 | ||||||||||||||||||||||||||||||||||||
1297 | // don't draw a frame for dock widget buttons, unless we are hovering | - | ||||||||||||||||||||||||||||||||||||
1298 | if (widget && widget->inherits("QDockWidgetTitleButton") && !(option->state & State_MouseOver))
| 0 | ||||||||||||||||||||||||||||||||||||
1299 | break; never executed: break; | 0 | ||||||||||||||||||||||||||||||||||||
1300 | - | |||||||||||||||||||||||||||||||||||||
1301 | GtkStateType state = qt_gtk_state(option); | - | ||||||||||||||||||||||||||||||||||||
1302 | if (option->state & State_On || option->state & State_Sunken)
| 0 | ||||||||||||||||||||||||||||||||||||
1303 | state = GTK_STATE_ACTIVE; never executed: state = GTK_STATE_ACTIVE; | 0 | ||||||||||||||||||||||||||||||||||||
1304 | GtkWidget *gtkButton = isTool ? d->gtkWidget("GtkToolButton.GtkButton") : d->gtkWidget("GtkButton");
| 0 | ||||||||||||||||||||||||||||||||||||
1305 | gint focusWidth, focusPad; | - | ||||||||||||||||||||||||||||||||||||
1306 | gboolean interiorFocus = false; | - | ||||||||||||||||||||||||||||||||||||
1307 | d->gtk_widget_style_get (gtkButton, | - | ||||||||||||||||||||||||||||||||||||
1308 | "focus-line-width", &focusWidth, | - | ||||||||||||||||||||||||||||||||||||
1309 | "focus-padding", &focusPad, | - | ||||||||||||||||||||||||||||||||||||
1310 | "interior-focus", &interiorFocus, NULL); | - | ||||||||||||||||||||||||||||||||||||
1311 | - | |||||||||||||||||||||||||||||||||||||
1312 | style = d->gtk_widget_get_style(gtkButton); | - | ||||||||||||||||||||||||||||||||||||
1313 | - | |||||||||||||||||||||||||||||||||||||
1314 | QRect buttonRect = option->rect; | - | ||||||||||||||||||||||||||||||||||||
1315 | - | |||||||||||||||||||||||||||||||||||||
1316 | QString key; | - | ||||||||||||||||||||||||||||||||||||
1317 | if (isDefault) {
| 0 | ||||||||||||||||||||||||||||||||||||
1318 | key += QLS("def"); | - | ||||||||||||||||||||||||||||||||||||
1319 | QGtkStylePrivate::gtk_widget_set_can_default(gtkButton, true); | - | ||||||||||||||||||||||||||||||||||||
1320 | QGtkStylePrivate::gtk_window_set_default((GtkWindow*)QGtkStylePrivate::gtk_widget_get_toplevel(gtkButton), gtkButton); | - | ||||||||||||||||||||||||||||||||||||
1321 | gtkPainter->paintBox(gtkButton, "buttondefault", buttonRect, state, GTK_SHADOW_IN, | - | ||||||||||||||||||||||||||||||||||||
1322 | style, isDefault ? QLS("d") : QString()); | - | ||||||||||||||||||||||||||||||||||||
1323 | } never executed: end of block | 0 | ||||||||||||||||||||||||||||||||||||
1324 | - | |||||||||||||||||||||||||||||||||||||
1325 | bool hasFocus = option->state & State_HasFocus; | - | ||||||||||||||||||||||||||||||||||||
1326 | - | |||||||||||||||||||||||||||||||||||||
1327 | if (hasFocus) {
| 0 | ||||||||||||||||||||||||||||||||||||
1328 | key += QLS("def"); | - | ||||||||||||||||||||||||||||||||||||
1329 | QGtkStylePrivate::gtkWidgetSetFocus(gtkButton, true); | - | ||||||||||||||||||||||||||||||||||||
1330 | } never executed: end of block | 0 | ||||||||||||||||||||||||||||||||||||
1331 | - | |||||||||||||||||||||||||||||||||||||
1332 | if (!interiorFocus)
| 0 | ||||||||||||||||||||||||||||||||||||
1333 | buttonRect = buttonRect.adjusted(focusWidth, focusWidth, -focusWidth, -focusWidth); never executed: buttonRect = buttonRect.adjusted(focusWidth, focusWidth, -focusWidth, -focusWidth); | 0 | ||||||||||||||||||||||||||||||||||||
1334 | - | |||||||||||||||||||||||||||||||||||||
1335 | GtkShadowType shadow = (option->state & State_Sunken || option->state & State_On ) ?
| 0 | ||||||||||||||||||||||||||||||||||||
1336 | GTK_SHADOW_IN : GTK_SHADOW_OUT; | - | ||||||||||||||||||||||||||||||||||||
1337 | - | |||||||||||||||||||||||||||||||||||||
1338 | gtkPainter->paintBox(gtkButton, "button", buttonRect, state, shadow, | - | ||||||||||||||||||||||||||||||||||||
1339 | style, key); | - | ||||||||||||||||||||||||||||||||||||
1340 | if (isDefault)
| 0 | ||||||||||||||||||||||||||||||||||||
1341 | QGtkStylePrivate::gtk_window_set_default((GtkWindow*)QGtkStylePrivate::gtk_widget_get_toplevel(gtkButton), 0); never executed: QGtkStylePrivate::gtk_window_set_default((GtkWindow*)QGtkStylePrivate::gtk_widget_get_toplevel(gtkButton), 0); | 0 | ||||||||||||||||||||||||||||||||||||
1342 | if (hasFocus)
| 0 | ||||||||||||||||||||||||||||||||||||
1343 | QGtkStylePrivate::gtkWidgetSetFocus(gtkButton, false); never executed: QGtkStylePrivate::gtkWidgetSetFocus(gtkButton, false); | 0 | ||||||||||||||||||||||||||||||||||||
1344 | } | - | ||||||||||||||||||||||||||||||||||||
1345 | break; never executed: break; | 0 | ||||||||||||||||||||||||||||||||||||
1346 | - | |||||||||||||||||||||||||||||||||||||
1347 | case PE_IndicatorRadioButton: { never executed: case PE_IndicatorRadioButton: | 0 | ||||||||||||||||||||||||||||||||||||
1348 | GtkShadowType shadow = GTK_SHADOW_OUT; | - | ||||||||||||||||||||||||||||||||||||
1349 | GtkStateType state = qt_gtk_state(option); | - | ||||||||||||||||||||||||||||||||||||
1350 | - | |||||||||||||||||||||||||||||||||||||
1351 | if (option->state & State_Sunken)
| 0 | ||||||||||||||||||||||||||||||||||||
1352 | state = GTK_STATE_ACTIVE; never executed: state = GTK_STATE_ACTIVE; | 0 | ||||||||||||||||||||||||||||||||||||
1353 | - | |||||||||||||||||||||||||||||||||||||
1354 | if (option->state & State_NoChange)
| 0 | ||||||||||||||||||||||||||||||||||||
1355 | shadow = GTK_SHADOW_ETCHED_IN; never executed: shadow = GTK_SHADOW_ETCHED_IN; | 0 | ||||||||||||||||||||||||||||||||||||
1356 | else if (option->state & State_On)
| 0 | ||||||||||||||||||||||||||||||||||||
1357 | shadow = GTK_SHADOW_IN; never executed: shadow = GTK_SHADOW_IN; | 0 | ||||||||||||||||||||||||||||||||||||
1358 | else | - | ||||||||||||||||||||||||||||||||||||
1359 | shadow = GTK_SHADOW_OUT; never executed: shadow = GTK_SHADOW_OUT; | 0 | ||||||||||||||||||||||||||||||||||||
1360 | - | |||||||||||||||||||||||||||||||||||||
1361 | GtkWidget *gtkRadioButton = d->gtkWidget("GtkRadioButton"); | - | ||||||||||||||||||||||||||||||||||||
1362 | gint spacing; | - | ||||||||||||||||||||||||||||||||||||
1363 | d->gtk_widget_style_get(gtkRadioButton, "indicator-spacing", &spacing, NULL); | - | ||||||||||||||||||||||||||||||||||||
1364 | QRect buttonRect = option->rect.adjusted(spacing, spacing, -spacing, -spacing); | - | ||||||||||||||||||||||||||||||||||||
1365 | gtkPainter->setClipRect(option->rect); | - | ||||||||||||||||||||||||||||||||||||
1366 | // ### Note: Ubuntulooks breaks when the proper widget is passed | - | ||||||||||||||||||||||||||||||||||||
1367 | // Murrine engine requires a widget not to get RGBA check - warnings | - | ||||||||||||||||||||||||||||||||||||
1368 | GtkWidget *gtkCheckButton = d->gtkWidget("GtkCheckButton"); | - | ||||||||||||||||||||||||||||||||||||
1369 | QString key(QLS("radiobutton")); | - | ||||||||||||||||||||||||||||||||||||
1370 | if (option->state & State_HasFocus) { // Themes such as Nodoka check this flag
| 0 | ||||||||||||||||||||||||||||||||||||
1371 | key += QLatin1Char('f'); | - | ||||||||||||||||||||||||||||||||||||
1372 | QGtkStylePrivate::gtkWidgetSetFocus(gtkCheckButton, true); | - | ||||||||||||||||||||||||||||||||||||
1373 | } never executed: end of block | 0 | ||||||||||||||||||||||||||||||||||||
1374 | gtkPainter->paintOption(gtkCheckButton , buttonRect, state, shadow, d->gtk_widget_get_style(gtkRadioButton), key); | - | ||||||||||||||||||||||||||||||||||||
1375 | if (option->state & State_HasFocus)
| 0 | ||||||||||||||||||||||||||||||||||||
1376 | QGtkStylePrivate::gtkWidgetSetFocus(gtkCheckButton, false); never executed: QGtkStylePrivate::gtkWidgetSetFocus(gtkCheckButton, false); | 0 | ||||||||||||||||||||||||||||||||||||
1377 | } | - | ||||||||||||||||||||||||||||||||||||
1378 | break; never executed: break; | 0 | ||||||||||||||||||||||||||||||||||||
1379 | - | |||||||||||||||||||||||||||||||||||||
1380 | case PE_IndicatorCheckBox: { never executed: case PE_IndicatorCheckBox: | 0 | ||||||||||||||||||||||||||||||||||||
1381 | GtkShadowType shadow = GTK_SHADOW_OUT; | - | ||||||||||||||||||||||||||||||||||||
1382 | GtkStateType state = qt_gtk_state(option); | - | ||||||||||||||||||||||||||||||||||||
1383 | - | |||||||||||||||||||||||||||||||||||||
1384 | if (option->state & State_Sunken)
| 0 | ||||||||||||||||||||||||||||||||||||
1385 | state = GTK_STATE_ACTIVE; never executed: state = GTK_STATE_ACTIVE; | 0 | ||||||||||||||||||||||||||||||||||||
1386 | - | |||||||||||||||||||||||||||||||||||||
1387 | if (option->state & State_NoChange)
| 0 | ||||||||||||||||||||||||||||||||||||
1388 | shadow = GTK_SHADOW_ETCHED_IN; never executed: shadow = GTK_SHADOW_ETCHED_IN; | 0 | ||||||||||||||||||||||||||||||||||||
1389 | else if (option->state & State_On)
| 0 | ||||||||||||||||||||||||||||||||||||
1390 | shadow = GTK_SHADOW_IN; never executed: shadow = GTK_SHADOW_IN; | 0 | ||||||||||||||||||||||||||||||||||||
1391 | else | - | ||||||||||||||||||||||||||||||||||||
1392 | shadow = GTK_SHADOW_OUT; never executed: shadow = GTK_SHADOW_OUT; | 0 | ||||||||||||||||||||||||||||||||||||
1393 | - | |||||||||||||||||||||||||||||||||||||
1394 | int spacing; | - | ||||||||||||||||||||||||||||||||||||
1395 | - | |||||||||||||||||||||||||||||||||||||
1396 | GtkWidget *gtkCheckButton = d->gtkWidget("GtkCheckButton"); | - | ||||||||||||||||||||||||||||||||||||
1397 | QString key(QLS("checkbutton")); | - | ||||||||||||||||||||||||||||||||||||
1398 | if (option->state & State_HasFocus) { // Themes such as Nodoka checks this flag
| 0 | ||||||||||||||||||||||||||||||||||||
1399 | key += QLatin1Char('f'); | - | ||||||||||||||||||||||||||||||||||||
1400 | QGtkStylePrivate::gtkWidgetSetFocus(gtkCheckButton, true); | - | ||||||||||||||||||||||||||||||||||||
1401 | } never executed: end of block | 0 | ||||||||||||||||||||||||||||||||||||
1402 | - | |||||||||||||||||||||||||||||||||||||
1403 | // Some styles such as aero-clone assume they can paint in the spacing area | - | ||||||||||||||||||||||||||||||||||||
1404 | gtkPainter->setClipRect(option->rect); | - | ||||||||||||||||||||||||||||||||||||
1405 | - | |||||||||||||||||||||||||||||||||||||
1406 | d->gtk_widget_style_get(gtkCheckButton, "indicator-spacing", &spacing, NULL); | - | ||||||||||||||||||||||||||||||||||||
1407 | - | |||||||||||||||||||||||||||||||||||||
1408 | QRect checkRect = option->rect.adjusted(spacing, spacing, -spacing, -spacing); | - | ||||||||||||||||||||||||||||||||||||
1409 | - | |||||||||||||||||||||||||||||||||||||
1410 | gtkPainter->paintCheckbox(gtkCheckButton, checkRect, state, shadow, d->gtk_widget_get_style(gtkCheckButton), | - | ||||||||||||||||||||||||||||||||||||
1411 | key); | - | ||||||||||||||||||||||||||||||||||||
1412 | if (option->state & State_HasFocus)
| 0 | ||||||||||||||||||||||||||||||||||||
1413 | QGtkStylePrivate::gtkWidgetSetFocus(gtkCheckButton, false); never executed: QGtkStylePrivate::gtkWidgetSetFocus(gtkCheckButton, false); | 0 | ||||||||||||||||||||||||||||||||||||
1414 | - | |||||||||||||||||||||||||||||||||||||
1415 | } | - | ||||||||||||||||||||||||||||||||||||
1416 | break; never executed: break; | 0 | ||||||||||||||||||||||||||||||||||||
1417 | - | |||||||||||||||||||||||||||||||||||||
1418 | #ifndef QT_NO_TABBAR | - | ||||||||||||||||||||||||||||||||||||
1419 | - | |||||||||||||||||||||||||||||||||||||
1420 | case PE_FrameTabBarBase: never executed: case PE_FrameTabBarBase: | 0 | ||||||||||||||||||||||||||||||||||||
1421 | if (const QStyleOptionTabBarBase *tbb
| 0 | ||||||||||||||||||||||||||||||||||||
1422 | = qstyleoption_cast<const QStyleOptionTabBarBase *>(option)) {
| 0 | ||||||||||||||||||||||||||||||||||||
1423 | QRect tabRect = tbb->rect; | - | ||||||||||||||||||||||||||||||||||||
1424 | painter->save(); | - | ||||||||||||||||||||||||||||||||||||
1425 | painter->setPen(QPen(option->palette.dark().color().dark(110), 0)); | - | ||||||||||||||||||||||||||||||||||||
1426 | switch (tbb->shape) { | - | ||||||||||||||||||||||||||||||||||||
1427 | - | |||||||||||||||||||||||||||||||||||||
1428 | case QTabBar::RoundedNorth: never executed: case QTabBar::RoundedNorth: | 0 | ||||||||||||||||||||||||||||||||||||
1429 | painter->drawLine(tabRect.topLeft(), tabRect.topRight()); | - | ||||||||||||||||||||||||||||||||||||
1430 | break; never executed: break; | 0 | ||||||||||||||||||||||||||||||||||||
1431 | - | |||||||||||||||||||||||||||||||||||||
1432 | case QTabBar::RoundedWest: never executed: case QTabBar::RoundedWest: | 0 | ||||||||||||||||||||||||||||||||||||
1433 | painter->drawLine(tabRect.left(), tabRect.top(), tabRect.left(), tabRect.bottom()); | - | ||||||||||||||||||||||||||||||||||||
1434 | break; never executed: break; | 0 | ||||||||||||||||||||||||||||||||||||
1435 | - | |||||||||||||||||||||||||||||||||||||
1436 | case QTabBar::RoundedSouth: never executed: case QTabBar::RoundedSouth: | 0 | ||||||||||||||||||||||||||||||||||||
1437 | painter->drawLine(tbb->rect.left(), tbb->rect.bottom(), | - | ||||||||||||||||||||||||||||||||||||
1438 | tabRect.right(), tabRect.bottom()); | - | ||||||||||||||||||||||||||||||||||||
1439 | break; never executed: break; | 0 | ||||||||||||||||||||||||||||||||||||
1440 | - | |||||||||||||||||||||||||||||||||||||
1441 | case QTabBar::RoundedEast: never executed: case QTabBar::RoundedEast: | 0 | ||||||||||||||||||||||||||||||||||||
1442 | painter->drawLine(tabRect.topRight(), tabRect.bottomRight()); | - | ||||||||||||||||||||||||||||||||||||
1443 | break; never executed: break; | 0 | ||||||||||||||||||||||||||||||||||||
1444 | - | |||||||||||||||||||||||||||||||||||||
1445 | case QTabBar::TriangularNorth: never executed: case QTabBar::TriangularNorth: | 0 | ||||||||||||||||||||||||||||||||||||
1446 | case QTabBar::TriangularEast: never executed: case QTabBar::TriangularEast: | 0 | ||||||||||||||||||||||||||||||||||||
1447 | case QTabBar::TriangularWest: never executed: case QTabBar::TriangularWest: | 0 | ||||||||||||||||||||||||||||||||||||
1448 | case QTabBar::TriangularSouth: never executed: case QTabBar::TriangularSouth: | 0 | ||||||||||||||||||||||||||||||||||||
1449 | painter->restore(); | - | ||||||||||||||||||||||||||||||||||||
1450 | QCommonStyle::drawPrimitive(element, option, painter, widget); | - | ||||||||||||||||||||||||||||||||||||
1451 | return; never executed: return; | 0 | ||||||||||||||||||||||||||||||||||||
1452 | } | - | ||||||||||||||||||||||||||||||||||||
1453 | - | |||||||||||||||||||||||||||||||||||||
1454 | painter->restore(); | - | ||||||||||||||||||||||||||||||||||||
1455 | } never executed: end of block | 0 | ||||||||||||||||||||||||||||||||||||
1456 | return; never executed: return; | 0 | ||||||||||||||||||||||||||||||||||||
1457 | - | |||||||||||||||||||||||||||||||||||||
1458 | #endif // QT_NO_TABBAR | - | ||||||||||||||||||||||||||||||||||||
1459 | - | |||||||||||||||||||||||||||||||||||||
1460 | case PE_Widget: never executed: case PE_Widget: | 0 | ||||||||||||||||||||||||||||||||||||
1461 | break; never executed: break; | 0 | ||||||||||||||||||||||||||||||||||||
1462 | - | |||||||||||||||||||||||||||||||||||||
1463 | default: never executed: default: | 0 | ||||||||||||||||||||||||||||||||||||
1464 | QCommonStyle::drawPrimitive(element, option, painter, widget); | - | ||||||||||||||||||||||||||||||||||||
1465 | } never executed: end of block | 0 | ||||||||||||||||||||||||||||||||||||
1466 | } | - | ||||||||||||||||||||||||||||||||||||
1467 | - | |||||||||||||||||||||||||||||||||||||
1468 | /*! | - | ||||||||||||||||||||||||||||||||||||
1469 | \reimp | - | ||||||||||||||||||||||||||||||||||||
1470 | */ | - | ||||||||||||||||||||||||||||||||||||
1471 | void QGtkStyle::drawComplexControl(ComplexControl control, const QStyleOptionComplex *option, | - | ||||||||||||||||||||||||||||||||||||
1472 | - | |||||||||||||||||||||||||||||||||||||
1473 | QPainter *painter, const QWidget *widget) const | - | ||||||||||||||||||||||||||||||||||||
1474 | { | - | ||||||||||||||||||||||||||||||||||||
1475 | Q_D(const QGtkStyle); | - | ||||||||||||||||||||||||||||||||||||
1476 | - | |||||||||||||||||||||||||||||||||||||
1477 | if (!d->isThemeAvailable()) {
| 0 | ||||||||||||||||||||||||||||||||||||
1478 | QCommonStyle::drawComplexControl(control, option, painter, widget); | - | ||||||||||||||||||||||||||||||||||||
1479 | return; never executed: return; | 0 | ||||||||||||||||||||||||||||||||||||
1480 | } | - | ||||||||||||||||||||||||||||||||||||
1481 | - | |||||||||||||||||||||||||||||||||||||
1482 | GtkStyle* style = d->gtkStyle(); | - | ||||||||||||||||||||||||||||||||||||
1483 | QGtkPainter* gtkPainter = d->gtkPainter(painter); | - | ||||||||||||||||||||||||||||||||||||
1484 | QColor button = option->palette.button().color(); | - | ||||||||||||||||||||||||||||||||||||
1485 | QColor dark; | - | ||||||||||||||||||||||||||||||||||||
1486 | QColor grooveColor; | - | ||||||||||||||||||||||||||||||||||||
1487 | QColor darkOutline; | - | ||||||||||||||||||||||||||||||||||||
1488 | dark.setHsv(button.hue(), | - | ||||||||||||||||||||||||||||||||||||
1489 | qMin(255, (int)(button.saturation()*1.9)), | - | ||||||||||||||||||||||||||||||||||||
1490 | qMin(255, (int)(button.value()*0.7))); | - | ||||||||||||||||||||||||||||||||||||
1491 | grooveColor.setHsv(button.hue(), | - | ||||||||||||||||||||||||||||||||||||
1492 | qMin(255, (int)(button.saturation()*2.6)), | - | ||||||||||||||||||||||||||||||||||||
1493 | qMin(255, (int)(button.value()*0.9))); | - | ||||||||||||||||||||||||||||||||||||
1494 | darkOutline.setHsv(button.hue(), | - | ||||||||||||||||||||||||||||||||||||
1495 | qMin(255, (int)(button.saturation()*3.0)), | - | ||||||||||||||||||||||||||||||||||||
1496 | qMin(255, (int)(button.value()*0.6))); | - | ||||||||||||||||||||||||||||||||||||
1497 | - | |||||||||||||||||||||||||||||||||||||
1498 | QColor alphaCornerColor; | - | ||||||||||||||||||||||||||||||||||||
1499 | - | |||||||||||||||||||||||||||||||||||||
1500 | if (widget)
| 0 | ||||||||||||||||||||||||||||||||||||
1501 | alphaCornerColor = mergedColors(option->palette.color(widget->backgroundRole()), darkOutline); never executed: alphaCornerColor = mergedColors(option->palette.color(widget->backgroundRole()), darkOutline); | 0 | ||||||||||||||||||||||||||||||||||||
1502 | else | - | ||||||||||||||||||||||||||||||||||||
1503 | alphaCornerColor = mergedColors(option->palette.background().color(), darkOutline); never executed: alphaCornerColor = mergedColors(option->palette.background().color(), darkOutline); | 0 | ||||||||||||||||||||||||||||||||||||
1504 | - | |||||||||||||||||||||||||||||||||||||
1505 | switch (control) { | - | ||||||||||||||||||||||||||||||||||||
1506 | - | |||||||||||||||||||||||||||||||||||||
1507 | case CC_TitleBar: never executed: case CC_TitleBar: | 0 | ||||||||||||||||||||||||||||||||||||
1508 | painter->save(); | - | ||||||||||||||||||||||||||||||||||||
1509 | if (const QStyleOptionTitleBar *titleBar = qstyleoption_cast<const QStyleOptionTitleBar *>(option)) {
| 0 | ||||||||||||||||||||||||||||||||||||
1510 | // Since this is drawn by metacity and not Gtk we | - | ||||||||||||||||||||||||||||||||||||
1511 | // have to do custom drawing | - | ||||||||||||||||||||||||||||||||||||
1512 | - | |||||||||||||||||||||||||||||||||||||
1513 | GdkColor gdkBg = style->bg[GTK_STATE_SELECTED]; | - | ||||||||||||||||||||||||||||||||||||
1514 | QColor bgColor(gdkBg.red>>8, gdkBg.green>>8, gdkBg.blue>>8); | - | ||||||||||||||||||||||||||||||||||||
1515 | - | |||||||||||||||||||||||||||||||||||||
1516 | const int buttonMargin = 5; | - | ||||||||||||||||||||||||||||||||||||
1517 | bool active = (titleBar->titleBarState & State_Active); | - | ||||||||||||||||||||||||||||||||||||
1518 | QRect fullRect = titleBar->rect; | - | ||||||||||||||||||||||||||||||||||||
1519 | QPalette palette = option->palette; | - | ||||||||||||||||||||||||||||||||||||
1520 | QColor highlight = bgColor; | - | ||||||||||||||||||||||||||||||||||||
1521 | - | |||||||||||||||||||||||||||||||||||||
1522 | QColor titleBarFrameBorder(active ? highlight.darker(180): dark.darker(110)); | - | ||||||||||||||||||||||||||||||||||||
1523 | QColor titleBarHighlight(active ? highlight.lighter(120): palette.background().color().lighter(120)); | - | ||||||||||||||||||||||||||||||||||||
1524 | QColor textColor(active ? 0xffffff : 0xff000000); | - | ||||||||||||||||||||||||||||||||||||
1525 | QColor textAlphaColor(active ? 0xffffff : 0xff000000 ); | - | ||||||||||||||||||||||||||||||||||||
1526 | - | |||||||||||||||||||||||||||||||||||||
1527 | { | - | ||||||||||||||||||||||||||||||||||||
1528 | // Fill title bar gradient | - | ||||||||||||||||||||||||||||||||||||
1529 | QColor titlebarColor = QColor(active ? highlight: palette.background().color()); | - | ||||||||||||||||||||||||||||||||||||
1530 | QLinearGradient gradient(option->rect.center().x(), option->rect.top(), | - | ||||||||||||||||||||||||||||||||||||
1531 | option->rect.center().x(), option->rect.bottom()); | - | ||||||||||||||||||||||||||||||||||||
1532 | - | |||||||||||||||||||||||||||||||||||||
1533 | gradient.setColorAt(0, titlebarColor.lighter(114)); | - | ||||||||||||||||||||||||||||||||||||
1534 | gradient.setColorAt(0.5, titlebarColor.lighter(102)); | - | ||||||||||||||||||||||||||||||||||||
1535 | gradient.setColorAt(0.51, titlebarColor.darker(104)); | - | ||||||||||||||||||||||||||||||||||||
1536 | gradient.setColorAt(1, titlebarColor); | - | ||||||||||||||||||||||||||||||||||||
1537 | painter->fillRect(option->rect.adjusted(1, 1, -1, 0), gradient); | - | ||||||||||||||||||||||||||||||||||||
1538 | - | |||||||||||||||||||||||||||||||||||||
1539 | // Frame and rounded corners | - | ||||||||||||||||||||||||||||||||||||
1540 | painter->setPen(titleBarFrameBorder); | - | ||||||||||||||||||||||||||||||||||||
1541 | - | |||||||||||||||||||||||||||||||||||||
1542 | // top outline | - | ||||||||||||||||||||||||||||||||||||
1543 | painter->drawLine(fullRect.left() + 5, fullRect.top(), fullRect.right() - 5, fullRect.top()); | - | ||||||||||||||||||||||||||||||||||||
1544 | painter->drawLine(fullRect.left(), fullRect.top() + 4, fullRect.left(), fullRect.bottom()); | - | ||||||||||||||||||||||||||||||||||||
1545 | const QPoint points[5] = { | - | ||||||||||||||||||||||||||||||||||||
1546 | QPoint(fullRect.left() + 4, fullRect.top() + 1), | - | ||||||||||||||||||||||||||||||||||||
1547 | QPoint(fullRect.left() + 3, fullRect.top() + 1), | - | ||||||||||||||||||||||||||||||||||||
1548 | QPoint(fullRect.left() + 2, fullRect.top() + 2), | - | ||||||||||||||||||||||||||||||||||||
1549 | QPoint(fullRect.left() + 1, fullRect.top() + 3), | - | ||||||||||||||||||||||||||||||||||||
1550 | QPoint(fullRect.left() + 1, fullRect.top() + 4) | - | ||||||||||||||||||||||||||||||||||||
1551 | }; | - | ||||||||||||||||||||||||||||||||||||
1552 | painter->drawPoints(points, 5); | - | ||||||||||||||||||||||||||||||||||||
1553 | - | |||||||||||||||||||||||||||||||||||||
1554 | painter->drawLine(fullRect.right(), fullRect.top() + 4, fullRect.right(), fullRect.bottom()); | - | ||||||||||||||||||||||||||||||||||||
1555 | const QPoint points2[5] = { | - | ||||||||||||||||||||||||||||||||||||
1556 | QPoint(fullRect.right() - 3, fullRect.top() + 1), | - | ||||||||||||||||||||||||||||||||||||
1557 | QPoint(fullRect.right() - 4, fullRect.top() + 1), | - | ||||||||||||||||||||||||||||||||||||
1558 | QPoint(fullRect.right() - 2, fullRect.top() + 2), | - | ||||||||||||||||||||||||||||||||||||
1559 | QPoint(fullRect.right() - 1, fullRect.top() + 3), | - | ||||||||||||||||||||||||||||||||||||
1560 | QPoint(fullRect.right() - 1, fullRect.top() + 4) | - | ||||||||||||||||||||||||||||||||||||
1561 | }; | - | ||||||||||||||||||||||||||||||||||||
1562 | painter->drawPoints(points2, 5); | - | ||||||||||||||||||||||||||||||||||||
1563 | - | |||||||||||||||||||||||||||||||||||||
1564 | // draw bottomline | - | ||||||||||||||||||||||||||||||||||||
1565 | painter->drawLine(fullRect.right(), fullRect.bottom(), fullRect.left(), fullRect.bottom()); | - | ||||||||||||||||||||||||||||||||||||
1566 | - | |||||||||||||||||||||||||||||||||||||
1567 | // top highlight | - | ||||||||||||||||||||||||||||||||||||
1568 | painter->setPen(titleBarHighlight); | - | ||||||||||||||||||||||||||||||||||||
1569 | painter->drawLine(fullRect.left() + 6, fullRect.top() + 1, fullRect.right() - 6, fullRect.top() + 1); | - | ||||||||||||||||||||||||||||||||||||
1570 | } | - | ||||||||||||||||||||||||||||||||||||
1571 | // draw title | - | ||||||||||||||||||||||||||||||||||||
1572 | QRect textRect = proxy()->subControlRect(CC_TitleBar, titleBar, SC_TitleBarLabel, widget); | - | ||||||||||||||||||||||||||||||||||||
1573 | QFont font = painter->font(); | - | ||||||||||||||||||||||||||||||||||||
1574 | font.setBold(true); | - | ||||||||||||||||||||||||||||||||||||
1575 | painter->setFont(font); | - | ||||||||||||||||||||||||||||||||||||
1576 | painter->setPen(active? (titleBar->palette.text().color().lighter(120)) : | - | ||||||||||||||||||||||||||||||||||||
1577 | titleBar->palette.text().color() ); | - | ||||||||||||||||||||||||||||||||||||
1578 | // Note workspace also does elliding but it does not use the correct font | - | ||||||||||||||||||||||||||||||||||||
1579 | QString title = QFontMetrics(font).elidedText(titleBar->text, Qt::ElideRight, textRect.width() - 14); | - | ||||||||||||||||||||||||||||||||||||
1580 | painter->drawText(textRect.adjusted(1, 1, 1, 1), title, QTextOption(Qt::AlignHCenter | Qt::AlignVCenter)); | - | ||||||||||||||||||||||||||||||||||||
1581 | painter->setPen(Qt::white); | - | ||||||||||||||||||||||||||||||||||||
1582 | if (active)
| 0 | ||||||||||||||||||||||||||||||||||||
1583 | painter->drawText(textRect, title, QTextOption(Qt::AlignHCenter | Qt::AlignVCenter)); never executed: painter->drawText(textRect, title, QTextOption(Qt::AlignHCenter | Qt::AlignVCenter)); | 0 | ||||||||||||||||||||||||||||||||||||
1584 | // min button | - | ||||||||||||||||||||||||||||||||||||
1585 | if ((titleBar->subControls & SC_TitleBarMinButton) && (titleBar->titleBarFlags & Qt::WindowMinimizeButtonHint) &&
| 0 | ||||||||||||||||||||||||||||||||||||
1586 | !(titleBar->titleBarState& Qt::WindowMinimized)) {
| 0 | ||||||||||||||||||||||||||||||||||||
1587 | QRect minButtonRect = proxy()->subControlRect(CC_TitleBar, titleBar, SC_TitleBarMinButton, widget); | - | ||||||||||||||||||||||||||||||||||||
1588 | if (minButtonRect.isValid()) {
| 0 | ||||||||||||||||||||||||||||||||||||
1589 | bool hover = (titleBar->activeSubControls & SC_TitleBarMinButton) && (titleBar->state & State_MouseOver);
| 0 | ||||||||||||||||||||||||||||||||||||
1590 | bool sunken = (titleBar->activeSubControls & SC_TitleBarMinButton) && (titleBar->state & State_Sunken);
| 0 | ||||||||||||||||||||||||||||||||||||
1591 | qt_gtk_draw_mdibutton(painter, titleBar, minButtonRect, hover, sunken); | - | ||||||||||||||||||||||||||||||||||||
1592 | QRect minButtonIconRect = minButtonRect.adjusted(buttonMargin ,buttonMargin , -buttonMargin, -buttonMargin); | - | ||||||||||||||||||||||||||||||||||||
1593 | painter->setPen(textColor); | - | ||||||||||||||||||||||||||||||||||||
1594 | painter->drawLine(minButtonIconRect.center().x() - 2, minButtonIconRect.center().y() + 3, | - | ||||||||||||||||||||||||||||||||||||
1595 | minButtonIconRect.center().x() + 3, minButtonIconRect.center().y() + 3); | - | ||||||||||||||||||||||||||||||||||||
1596 | painter->drawLine(minButtonIconRect.center().x() - 2, minButtonIconRect.center().y() + 4, | - | ||||||||||||||||||||||||||||||||||||
1597 | minButtonIconRect.center().x() + 3, minButtonIconRect.center().y() + 4); | - | ||||||||||||||||||||||||||||||||||||
1598 | painter->setPen(textAlphaColor); | - | ||||||||||||||||||||||||||||||||||||
1599 | painter->drawLine(minButtonIconRect.center().x() - 3, minButtonIconRect.center().y() + 3, | - | ||||||||||||||||||||||||||||||||||||
1600 | minButtonIconRect.center().x() - 3, minButtonIconRect.center().y() + 4); | - | ||||||||||||||||||||||||||||||||||||
1601 | painter->drawLine(minButtonIconRect.center().x() + 4, minButtonIconRect.center().y() + 3, | - | ||||||||||||||||||||||||||||||||||||
1602 | minButtonIconRect.center().x() + 4, minButtonIconRect.center().y() + 4); | - | ||||||||||||||||||||||||||||||||||||
1603 | } never executed: end of block | 0 | ||||||||||||||||||||||||||||||||||||
1604 | } never executed: end of block | 0 | ||||||||||||||||||||||||||||||||||||
1605 | // max button | - | ||||||||||||||||||||||||||||||||||||
1606 | if ((titleBar->subControls & SC_TitleBarMaxButton) && (titleBar->titleBarFlags & Qt::WindowMaximizeButtonHint) &&
| 0 | ||||||||||||||||||||||||||||||||||||
1607 | !(titleBar->titleBarState & Qt::WindowMaximized)) {
| 0 | ||||||||||||||||||||||||||||||||||||
1608 | QRect maxButtonRect = proxy()->subControlRect(CC_TitleBar, titleBar, SC_TitleBarMaxButton, widget); | - | ||||||||||||||||||||||||||||||||||||
1609 | if (maxButtonRect.isValid()) {
| 0 | ||||||||||||||||||||||||||||||||||||
1610 | bool hover = (titleBar->activeSubControls & SC_TitleBarMaxButton) && (titleBar->state & State_MouseOver);
| 0 | ||||||||||||||||||||||||||||||||||||
1611 | bool sunken = (titleBar->activeSubControls & SC_TitleBarMaxButton) && (titleBar->state & State_Sunken);
| 0 | ||||||||||||||||||||||||||||||||||||
1612 | qt_gtk_draw_mdibutton(painter, titleBar, maxButtonRect, hover, sunken); | - | ||||||||||||||||||||||||||||||||||||
1613 | - | |||||||||||||||||||||||||||||||||||||
1614 | QRect maxButtonIconRect = maxButtonRect.adjusted(buttonMargin, buttonMargin, -buttonMargin, -buttonMargin); | - | ||||||||||||||||||||||||||||||||||||
1615 | - | |||||||||||||||||||||||||||||||||||||
1616 | painter->setPen(textColor); | - | ||||||||||||||||||||||||||||||||||||
1617 | painter->drawRect(maxButtonIconRect.adjusted(0, 0, -1, -1)); | - | ||||||||||||||||||||||||||||||||||||
1618 | painter->drawLine(maxButtonIconRect.left() + 1, maxButtonIconRect.top() + 1, | - | ||||||||||||||||||||||||||||||||||||
1619 | maxButtonIconRect.right() - 1, maxButtonIconRect.top() + 1); | - | ||||||||||||||||||||||||||||||||||||
1620 | painter->setPen(textAlphaColor); | - | ||||||||||||||||||||||||||||||||||||
1621 | const QPoint points[4] = { | - | ||||||||||||||||||||||||||||||||||||
1622 | maxButtonIconRect.topLeft(), | - | ||||||||||||||||||||||||||||||||||||
1623 | maxButtonIconRect.topRight(), | - | ||||||||||||||||||||||||||||||||||||
1624 | maxButtonIconRect.bottomLeft(), | - | ||||||||||||||||||||||||||||||||||||
1625 | maxButtonIconRect.bottomRight() | - | ||||||||||||||||||||||||||||||||||||
1626 | }; | - | ||||||||||||||||||||||||||||||||||||
1627 | painter->drawPoints(points, 4); | - | ||||||||||||||||||||||||||||||||||||
1628 | } never executed: end of block | 0 | ||||||||||||||||||||||||||||||||||||
1629 | } never executed: end of block | 0 | ||||||||||||||||||||||||||||||||||||
1630 | - | |||||||||||||||||||||||||||||||||||||
1631 | // close button | - | ||||||||||||||||||||||||||||||||||||
1632 | if ((titleBar->subControls & SC_TitleBarCloseButton) && (titleBar->titleBarFlags & Qt::WindowSystemMenuHint)) {
| 0 | ||||||||||||||||||||||||||||||||||||
1633 | QRect closeButtonRect = proxy()->subControlRect(CC_TitleBar, titleBar, SC_TitleBarCloseButton, widget); | - | ||||||||||||||||||||||||||||||||||||
1634 | if (closeButtonRect.isValid()) {
| 0 | ||||||||||||||||||||||||||||||||||||
1635 | bool hover = (titleBar->activeSubControls & SC_TitleBarCloseButton) && (titleBar->state & State_MouseOver);
| 0 | ||||||||||||||||||||||||||||||||||||
1636 | bool sunken = (titleBar->activeSubControls & SC_TitleBarCloseButton) && (titleBar->state & State_Sunken);
| 0 | ||||||||||||||||||||||||||||||||||||
1637 | qt_gtk_draw_mdibutton(painter, titleBar, closeButtonRect, hover, sunken); | - | ||||||||||||||||||||||||||||||||||||
1638 | QRect closeIconRect = closeButtonRect.adjusted(buttonMargin, buttonMargin, -buttonMargin, -buttonMargin); | - | ||||||||||||||||||||||||||||||||||||
1639 | painter->setPen(textAlphaColor); | - | ||||||||||||||||||||||||||||||||||||
1640 | const QLine lines[4] = { | - | ||||||||||||||||||||||||||||||||||||
1641 | QLine(closeIconRect.left() + 1, closeIconRect.top(), | - | ||||||||||||||||||||||||||||||||||||
1642 | closeIconRect.right(), closeIconRect.bottom() - 1), | - | ||||||||||||||||||||||||||||||||||||
1643 | QLine(closeIconRect.left(), closeIconRect.top() + 1, | - | ||||||||||||||||||||||||||||||||||||
1644 | closeIconRect.right() - 1, closeIconRect.bottom()), | - | ||||||||||||||||||||||||||||||||||||
1645 | QLine(closeIconRect.right() - 1, closeIconRect.top(), | - | ||||||||||||||||||||||||||||||||||||
1646 | closeIconRect.left(), closeIconRect.bottom() - 1), | - | ||||||||||||||||||||||||||||||||||||
1647 | QLine(closeIconRect.right(), closeIconRect.top() + 1, | - | ||||||||||||||||||||||||||||||||||||
1648 | closeIconRect.left() + 1, closeIconRect.bottom()) | - | ||||||||||||||||||||||||||||||||||||
1649 | }; | - | ||||||||||||||||||||||||||||||||||||
1650 | painter->drawLines(lines, 4); | - | ||||||||||||||||||||||||||||||||||||
1651 | const QPoint points[4] = { | - | ||||||||||||||||||||||||||||||||||||
1652 | closeIconRect.topLeft(), | - | ||||||||||||||||||||||||||||||||||||
1653 | closeIconRect.topRight(), | - | ||||||||||||||||||||||||||||||||||||
1654 | closeIconRect.bottomLeft(), | - | ||||||||||||||||||||||||||||||||||||
1655 | closeIconRect.bottomRight() | - | ||||||||||||||||||||||||||||||||||||
1656 | }; | - | ||||||||||||||||||||||||||||||||||||
1657 | painter->drawPoints(points, 4); | - | ||||||||||||||||||||||||||||||||||||
1658 | - | |||||||||||||||||||||||||||||||||||||
1659 | painter->setPen(textColor); | - | ||||||||||||||||||||||||||||||||||||
1660 | painter->drawLine(closeIconRect.left() + 1, closeIconRect.top() + 1, | - | ||||||||||||||||||||||||||||||||||||
1661 | closeIconRect.right() - 1, closeIconRect.bottom() - 1); | - | ||||||||||||||||||||||||||||||||||||
1662 | painter->drawLine(closeIconRect.left() + 1, closeIconRect.bottom() - 1, | - | ||||||||||||||||||||||||||||||||||||
1663 | closeIconRect.right() - 1, closeIconRect.top() + 1); | - | ||||||||||||||||||||||||||||||||||||
1664 | } never executed: end of block | 0 | ||||||||||||||||||||||||||||||||||||
1665 | } never executed: end of block | 0 | ||||||||||||||||||||||||||||||||||||
1666 | - | |||||||||||||||||||||||||||||||||||||
1667 | // normalize button | - | ||||||||||||||||||||||||||||||||||||
1668 | if ((titleBar->subControls & SC_TitleBarNormalButton) &&
| 0 | ||||||||||||||||||||||||||||||||||||
1669 | (((titleBar->titleBarFlags & Qt::WindowMinimizeButtonHint) &&
| 0 | ||||||||||||||||||||||||||||||||||||
1670 | (titleBar->titleBarState & Qt::WindowMinimized)) ||
| 0 | ||||||||||||||||||||||||||||||||||||
1671 | ((titleBar->titleBarFlags & Qt::WindowMaximizeButtonHint) &&
| 0 | ||||||||||||||||||||||||||||||||||||
1672 | (titleBar->titleBarState & Qt::WindowMaximized)))) {
| 0 | ||||||||||||||||||||||||||||||||||||
1673 | QRect normalButtonRect = proxy()->subControlRect(CC_TitleBar, titleBar, SC_TitleBarNormalButton, widget); | - | ||||||||||||||||||||||||||||||||||||
1674 | if (normalButtonRect.isValid()) {
| 0 | ||||||||||||||||||||||||||||||||||||
1675 | - | |||||||||||||||||||||||||||||||||||||
1676 | bool hover = (titleBar->activeSubControls & SC_TitleBarNormalButton) && (titleBar->state & State_MouseOver);
| 0 | ||||||||||||||||||||||||||||||||||||
1677 | bool sunken = (titleBar->activeSubControls & SC_TitleBarNormalButton) && (titleBar->state & State_Sunken);
| 0 | ||||||||||||||||||||||||||||||||||||
1678 | QRect normalButtonIconRect = normalButtonRect.adjusted(buttonMargin, buttonMargin, -buttonMargin, -buttonMargin); | - | ||||||||||||||||||||||||||||||||||||
1679 | qt_gtk_draw_mdibutton(painter, titleBar, normalButtonRect, hover, sunken); | - | ||||||||||||||||||||||||||||||||||||
1680 | - | |||||||||||||||||||||||||||||||||||||
1681 | QRect frontWindowRect = normalButtonIconRect.adjusted(0, 3, -3, 0); | - | ||||||||||||||||||||||||||||||||||||
1682 | painter->setPen(textColor); | - | ||||||||||||||||||||||||||||||||||||
1683 | painter->drawRect(frontWindowRect.adjusted(0, 0, -1, -1)); | - | ||||||||||||||||||||||||||||||||||||
1684 | painter->drawLine(frontWindowRect.left() + 1, frontWindowRect.top() + 1, | - | ||||||||||||||||||||||||||||||||||||
1685 | frontWindowRect.right() - 1, frontWindowRect.top() + 1); | - | ||||||||||||||||||||||||||||||||||||
1686 | painter->setPen(textAlphaColor); | - | ||||||||||||||||||||||||||||||||||||
1687 | const QPoint points[4] = { | - | ||||||||||||||||||||||||||||||||||||
1688 | frontWindowRect.topLeft(), | - | ||||||||||||||||||||||||||||||||||||
1689 | frontWindowRect.topRight(), | - | ||||||||||||||||||||||||||||||||||||
1690 | frontWindowRect.bottomLeft(), | - | ||||||||||||||||||||||||||||||||||||
1691 | frontWindowRect.bottomRight() | - | ||||||||||||||||||||||||||||||||||||
1692 | }; | - | ||||||||||||||||||||||||||||||||||||
1693 | painter->drawPoints(points, 4); | - | ||||||||||||||||||||||||||||||||||||
1694 | - | |||||||||||||||||||||||||||||||||||||
1695 | QRect backWindowRect = normalButtonIconRect.adjusted(3, 0, 0, -3); | - | ||||||||||||||||||||||||||||||||||||
1696 | QRegion clipRegion = backWindowRect; | - | ||||||||||||||||||||||||||||||||||||
1697 | clipRegion -= frontWindowRect; | - | ||||||||||||||||||||||||||||||||||||
1698 | painter->save(); | - | ||||||||||||||||||||||||||||||||||||
1699 | painter->setClipRegion(clipRegion); | - | ||||||||||||||||||||||||||||||||||||
1700 | painter->setPen(textColor); | - | ||||||||||||||||||||||||||||||||||||
1701 | painter->drawRect(backWindowRect.adjusted(0, 0, -1, -1)); | - | ||||||||||||||||||||||||||||||||||||
1702 | painter->drawLine(backWindowRect.left() + 1, backWindowRect.top() + 1, | - | ||||||||||||||||||||||||||||||||||||
1703 | backWindowRect.right() - 1, backWindowRect.top() + 1); | - | ||||||||||||||||||||||||||||||||||||
1704 | painter->setPen(textAlphaColor); | - | ||||||||||||||||||||||||||||||||||||
1705 | const QPoint points2[4] = { | - | ||||||||||||||||||||||||||||||||||||
1706 | backWindowRect.topLeft(), | - | ||||||||||||||||||||||||||||||||||||
1707 | backWindowRect.topRight(), | - | ||||||||||||||||||||||||||||||||||||
1708 | backWindowRect.bottomLeft(), | - | ||||||||||||||||||||||||||||||||||||
1709 | backWindowRect.bottomRight() | - | ||||||||||||||||||||||||||||||||||||
1710 | }; | - | ||||||||||||||||||||||||||||||||||||
1711 | painter->drawPoints(points2, 4); | - | ||||||||||||||||||||||||||||||||||||
1712 | painter->restore(); | - | ||||||||||||||||||||||||||||||||||||
1713 | } never executed: end of block | 0 | ||||||||||||||||||||||||||||||||||||
1714 | } never executed: end of block | 0 | ||||||||||||||||||||||||||||||||||||
1715 | - | |||||||||||||||||||||||||||||||||||||
1716 | // context help button | - | ||||||||||||||||||||||||||||||||||||
1717 | if (titleBar->subControls & SC_TitleBarContextHelpButton
| 0 | ||||||||||||||||||||||||||||||||||||
1718 | && (titleBar->titleBarFlags & Qt::WindowContextHelpButtonHint)) {
| 0 | ||||||||||||||||||||||||||||||||||||
1719 | QRect contextHelpButtonRect = proxy()->subControlRect(CC_TitleBar, titleBar, SC_TitleBarContextHelpButton, widget); | - | ||||||||||||||||||||||||||||||||||||
1720 | if (contextHelpButtonRect.isValid()) {
| 0 | ||||||||||||||||||||||||||||||||||||
1721 | bool hover = (titleBar->activeSubControls & SC_TitleBarContextHelpButton) && (titleBar->state & State_MouseOver);
| 0 | ||||||||||||||||||||||||||||||||||||
1722 | bool sunken = (titleBar->activeSubControls & SC_TitleBarContextHelpButton) && (titleBar->state & State_Sunken);
| 0 | ||||||||||||||||||||||||||||||||||||
1723 | qt_gtk_draw_mdibutton(painter, titleBar, contextHelpButtonRect, hover, sunken); | - | ||||||||||||||||||||||||||||||||||||
1724 | - | |||||||||||||||||||||||||||||||||||||
1725 | QColor blend; | - | ||||||||||||||||||||||||||||||||||||
1726 | QImage image(qt_titlebar_context_help); | - | ||||||||||||||||||||||||||||||||||||
1727 | QColor alpha = textColor; | - | ||||||||||||||||||||||||||||||||||||
1728 | alpha.setAlpha(128); | - | ||||||||||||||||||||||||||||||||||||
1729 | image.setColor(1, textColor.rgba()); | - | ||||||||||||||||||||||||||||||||||||
1730 | image.setColor(2, alpha.rgba()); | - | ||||||||||||||||||||||||||||||||||||
1731 | painter->setRenderHint(QPainter::SmoothPixmapTransform); | - | ||||||||||||||||||||||||||||||||||||
1732 | painter->drawImage(contextHelpButtonRect.adjusted(4, 4, -4, -4), image); | - | ||||||||||||||||||||||||||||||||||||
1733 | } never executed: end of block | 0 | ||||||||||||||||||||||||||||||||||||
1734 | } never executed: end of block | 0 | ||||||||||||||||||||||||||||||||||||
1735 | - | |||||||||||||||||||||||||||||||||||||
1736 | // shade button | - | ||||||||||||||||||||||||||||||||||||
1737 | if (titleBar->subControls & SC_TitleBarShadeButton && (titleBar->titleBarFlags & Qt::WindowShadeButtonHint)) {
| 0 | ||||||||||||||||||||||||||||||||||||
1738 | QRect shadeButtonRect = proxy()->subControlRect(CC_TitleBar, titleBar, SC_TitleBarShadeButton, widget); | - | ||||||||||||||||||||||||||||||||||||
1739 | if (shadeButtonRect.isValid()) {
| 0 | ||||||||||||||||||||||||||||||||||||
1740 | bool hover = (titleBar->activeSubControls & SC_TitleBarShadeButton) && (titleBar->state & State_MouseOver);
| 0 | ||||||||||||||||||||||||||||||||||||
1741 | bool sunken = (titleBar->activeSubControls & SC_TitleBarShadeButton) && (titleBar->state & State_Sunken);
| 0 | ||||||||||||||||||||||||||||||||||||
1742 | qt_gtk_draw_mdibutton(painter, titleBar, shadeButtonRect, hover, sunken); | - | ||||||||||||||||||||||||||||||||||||
1743 | QImage image(qt_scrollbar_button_arrow_up); | - | ||||||||||||||||||||||||||||||||||||
1744 | image.setColor(1, textColor.rgba()); | - | ||||||||||||||||||||||||||||||||||||
1745 | painter->drawImage(shadeButtonRect.adjusted(5, 7, -5, -7), image); | - | ||||||||||||||||||||||||||||||||||||
1746 | } never executed: end of block | 0 | ||||||||||||||||||||||||||||||||||||
1747 | } never executed: end of block | 0 | ||||||||||||||||||||||||||||||||||||
1748 | - | |||||||||||||||||||||||||||||||||||||
1749 | // unshade button | - | ||||||||||||||||||||||||||||||||||||
1750 | if (titleBar->subControls & SC_TitleBarUnshadeButton && (titleBar->titleBarFlags & Qt::WindowShadeButtonHint)) {
| 0 | ||||||||||||||||||||||||||||||||||||
1751 | QRect unshadeButtonRect = proxy()->subControlRect(CC_TitleBar, titleBar, SC_TitleBarUnshadeButton, widget); | - | ||||||||||||||||||||||||||||||||||||
1752 | if (unshadeButtonRect.isValid()) {
| 0 | ||||||||||||||||||||||||||||||||||||
1753 | bool hover = (titleBar->activeSubControls & SC_TitleBarUnshadeButton) && (titleBar->state & State_MouseOver);
| 0 | ||||||||||||||||||||||||||||||||||||
1754 | bool sunken = (titleBar->activeSubControls & SC_TitleBarUnshadeButton) && (titleBar->state & State_Sunken);
| 0 | ||||||||||||||||||||||||||||||||||||
1755 | qt_gtk_draw_mdibutton(painter, titleBar, unshadeButtonRect, hover, sunken); | - | ||||||||||||||||||||||||||||||||||||
1756 | QImage image(qt_scrollbar_button_arrow_down); | - | ||||||||||||||||||||||||||||||||||||
1757 | image.setColor(1, textColor.rgba()); | - | ||||||||||||||||||||||||||||||||||||
1758 | painter->drawImage(unshadeButtonRect.adjusted(5, 7, -5, -7), image); | - | ||||||||||||||||||||||||||||||||||||
1759 | } never executed: end of block | 0 | ||||||||||||||||||||||||||||||||||||
1760 | } never executed: end of block | 0 | ||||||||||||||||||||||||||||||||||||
1761 | - | |||||||||||||||||||||||||||||||||||||
1762 | if ((titleBar->subControls & SC_TitleBarSysMenu) && (titleBar->titleBarFlags & Qt::WindowSystemMenuHint)) {
| 0 | ||||||||||||||||||||||||||||||||||||
1763 | QRect iconRect = proxy()->subControlRect(CC_TitleBar, titleBar, SC_TitleBarSysMenu, widget); | - | ||||||||||||||||||||||||||||||||||||
1764 | if (iconRect.isValid()) {
| 0 | ||||||||||||||||||||||||||||||||||||
1765 | if (!titleBar->icon.isNull()) {
| 0 | ||||||||||||||||||||||||||||||||||||
1766 | titleBar->icon.paint(painter, iconRect); | - | ||||||||||||||||||||||||||||||||||||
1767 | } else { never executed: end of block | 0 | ||||||||||||||||||||||||||||||||||||
1768 | QStyleOption tool = *titleBar; | - | ||||||||||||||||||||||||||||||||||||
1769 | QPixmap pm = proxy()->standardIcon(SP_TitleBarMenuButton, &tool, widget).pixmap(16, 16); | - | ||||||||||||||||||||||||||||||||||||
1770 | tool.rect = iconRect; | - | ||||||||||||||||||||||||||||||||||||
1771 | painter->save(); | - | ||||||||||||||||||||||||||||||||||||
1772 | proxy()->drawItemPixmap(painter, iconRect, Qt::AlignCenter, pm); | - | ||||||||||||||||||||||||||||||||||||
1773 | painter->restore(); | - | ||||||||||||||||||||||||||||||||||||
1774 | } never executed: end of block | 0 | ||||||||||||||||||||||||||||||||||||
1775 | } | - | ||||||||||||||||||||||||||||||||||||
1776 | } never executed: end of block | 0 | ||||||||||||||||||||||||||||||||||||
1777 | } never executed: end of block | 0 | ||||||||||||||||||||||||||||||||||||
1778 | painter->restore(); | - | ||||||||||||||||||||||||||||||||||||
1779 | break; never executed: break; | 0 | ||||||||||||||||||||||||||||||||||||
1780 | - | |||||||||||||||||||||||||||||||||||||
1781 | #ifndef QT_NO_GROUPBOX | - | ||||||||||||||||||||||||||||||||||||
1782 | - | |||||||||||||||||||||||||||||||||||||
1783 | case CC_GroupBox: never executed: case CC_GroupBox: | 0 | ||||||||||||||||||||||||||||||||||||
1784 | painter->save(); | - | ||||||||||||||||||||||||||||||||||||
1785 | - | |||||||||||||||||||||||||||||||||||||
1786 | if (const QStyleOptionGroupBox *groupBox = qstyleoption_cast<const QStyleOptionGroupBox *>(option)) {
| 0 | ||||||||||||||||||||||||||||||||||||
1787 | QRect textRect = proxy()->subControlRect(CC_GroupBox, groupBox, SC_GroupBoxLabel, widget); | - | ||||||||||||||||||||||||||||||||||||
1788 | QRect checkBoxRect = proxy()->subControlRect(CC_GroupBox, groupBox, SC_GroupBoxCheckBox, widget); | - | ||||||||||||||||||||||||||||||||||||
1789 | // Draw title | - | ||||||||||||||||||||||||||||||||||||
1790 | - | |||||||||||||||||||||||||||||||||||||
1791 | if ((groupBox->subControls & QStyle::SC_GroupBoxLabel) && !groupBox->text.isEmpty()) {
| 0 | ||||||||||||||||||||||||||||||||||||
1792 | // Draw prelight background | - | ||||||||||||||||||||||||||||||||||||
1793 | GtkWidget *gtkCheckButton = d->gtkWidget("GtkCheckButton"); | - | ||||||||||||||||||||||||||||||||||||
1794 | - | |||||||||||||||||||||||||||||||||||||
1795 | if (option->state & State_MouseOver) {
| 0 | ||||||||||||||||||||||||||||||||||||
1796 | QRect bgRect = textRect | checkBoxRect; | - | ||||||||||||||||||||||||||||||||||||
1797 | gtkPainter->paintFlatBox(gtkCheckButton, "checkbutton", bgRect.adjusted(0, 0, 0, -2), | - | ||||||||||||||||||||||||||||||||||||
1798 | GTK_STATE_PRELIGHT, GTK_SHADOW_ETCHED_OUT, d->gtk_widget_get_style(gtkCheckButton)); | - | ||||||||||||||||||||||||||||||||||||
1799 | } never executed: end of block | 0 | ||||||||||||||||||||||||||||||||||||
1800 | - | |||||||||||||||||||||||||||||||||||||
1801 | if (!groupBox->text.isEmpty()) {
| 0 | ||||||||||||||||||||||||||||||||||||
1802 | int alignment = int(groupBox->textAlignment); | - | ||||||||||||||||||||||||||||||||||||
1803 | if (!proxy()->styleHint(QStyle::SH_UnderlineShortcut, option, widget))
| 0 | ||||||||||||||||||||||||||||||||||||
1804 | alignment |= Qt::TextHideMnemonic; never executed: alignment |= Qt::TextHideMnemonic; | 0 | ||||||||||||||||||||||||||||||||||||
1805 | QColor textColor = groupBox->textColor; // Note: custom textColor is currently ignored | - | ||||||||||||||||||||||||||||||||||||
1806 | int labelState = GTK_STATE_INSENSITIVE; | - | ||||||||||||||||||||||||||||||||||||
1807 | - | |||||||||||||||||||||||||||||||||||||
1808 | if (option->state & State_Enabled)
| 0 | ||||||||||||||||||||||||||||||||||||
1809 | labelState = (option->state & State_MouseOver) ? GTK_STATE_PRELIGHT : GTK_STATE_NORMAL; never executed: labelState = (option->state & State_MouseOver) ? GTK_STATE_PRELIGHT : GTK_STATE_NORMAL;
| 0 | ||||||||||||||||||||||||||||||||||||
1810 | - | |||||||||||||||||||||||||||||||||||||
1811 | GdkColor gdkText = d->gtk_widget_get_style(gtkCheckButton)->fg[labelState]; | - | ||||||||||||||||||||||||||||||||||||
1812 | textColor = QColor(gdkText.red>>8, gdkText.green>>8, gdkText.blue>>8); | - | ||||||||||||||||||||||||||||||||||||
1813 | painter->setPen(textColor); | - | ||||||||||||||||||||||||||||||||||||
1814 | QFont font = painter->font(); | - | ||||||||||||||||||||||||||||||||||||
1815 | font.setBold(true); | - | ||||||||||||||||||||||||||||||||||||
1816 | painter->setFont(font); | - | ||||||||||||||||||||||||||||||||||||
1817 | painter->drawText(textRect, Qt::TextShowMnemonic | Qt::AlignLeft| alignment, groupBox->text); | - | ||||||||||||||||||||||||||||||||||||
1818 | - | |||||||||||||||||||||||||||||||||||||
1819 | if (option->state & State_HasFocus)
| 0 | ||||||||||||||||||||||||||||||||||||
1820 | gtkPainter->paintFocus(gtkCheckButton, "checkbutton", textRect.adjusted(-4, -1, 0, -3), GTK_STATE_ACTIVE, style); never executed: gtkPainter->paintFocus(gtkCheckButton, "checkbutton", textRect.adjusted(-4, -1, 0, -3), GTK_STATE_ACTIVE, style); | 0 | ||||||||||||||||||||||||||||||||||||
1821 | } never executed: end of block | 0 | ||||||||||||||||||||||||||||||||||||
1822 | } never executed: end of block | 0 | ||||||||||||||||||||||||||||||||||||
1823 | - | |||||||||||||||||||||||||||||||||||||
1824 | if (groupBox->subControls & SC_GroupBoxCheckBox) {
| 0 | ||||||||||||||||||||||||||||||||||||
1825 | QStyleOptionButton box; | - | ||||||||||||||||||||||||||||||||||||
1826 | box.QStyleOption::operator=(*groupBox); | - | ||||||||||||||||||||||||||||||||||||
1827 | box.rect = checkBoxRect; | - | ||||||||||||||||||||||||||||||||||||
1828 | proxy()->drawPrimitive(PE_IndicatorCheckBox, &box, painter, widget); | - | ||||||||||||||||||||||||||||||||||||
1829 | } never executed: end of block | 0 | ||||||||||||||||||||||||||||||||||||
1830 | } never executed: end of block | 0 | ||||||||||||||||||||||||||||||||||||
1831 | - | |||||||||||||||||||||||||||||||||||||
1832 | painter->restore(); | - | ||||||||||||||||||||||||||||||||||||
1833 | break; never executed: break; | 0 | ||||||||||||||||||||||||||||||||||||
1834 | #endif // QT_NO_GROUPBOX | - | ||||||||||||||||||||||||||||||||||||
1835 | - | |||||||||||||||||||||||||||||||||||||
1836 | #ifndef QT_NO_COMBOBOX | - | ||||||||||||||||||||||||||||||||||||
1837 | - | |||||||||||||||||||||||||||||||||||||
1838 | case CC_ComboBox: never executed: case CC_ComboBox: | 0 | ||||||||||||||||||||||||||||||||||||
1839 | // See: http://live.gnome.org/GnomeArt/Tutorials/GtkThemes/GtkComboBox | - | ||||||||||||||||||||||||||||||||||||
1840 | // and http://live.gnome.org/GnomeArt/Tutorials/GtkThemes/GtkComboBoxEntry | - | ||||||||||||||||||||||||||||||||||||
1841 | if (const QStyleOptionComboBox *comboBox = qstyleoption_cast<const QStyleOptionComboBox *>(option)) {
| 0 | ||||||||||||||||||||||||||||||||||||
1842 | bool sunken = comboBox->state & State_On; // play dead, if combobox has no items | - | ||||||||||||||||||||||||||||||||||||
1843 | BEGIN_STYLE_PIXMAPCACHE(QString::fromLatin1("cb-%0-%1").arg(sunken).arg(comboBox->editable)); never executed: end of block never executed: end of block
| 0 | ||||||||||||||||||||||||||||||||||||
1844 | gtkPainter->reset(p); | - | ||||||||||||||||||||||||||||||||||||
1845 | gtkPainter->setUsePixmapCache(false); // cached externally | - | ||||||||||||||||||||||||||||||||||||
1846 | - | |||||||||||||||||||||||||||||||||||||
1847 | bool isEnabled = (comboBox->state & State_Enabled); | - | ||||||||||||||||||||||||||||||||||||
1848 | bool focus = isEnabled && (comboBox->state & State_HasFocus);
| 0 | ||||||||||||||||||||||||||||||||||||
1849 | GtkStateType state = qt_gtk_state(option); | - | ||||||||||||||||||||||||||||||||||||
1850 | int appears_as_list = !proxy()->styleHint(QStyle::SH_ComboBox_Popup, comboBox, widget); | - | ||||||||||||||||||||||||||||||||||||
1851 | QStyleOptionComboBox comboBoxCopy = *comboBox; | - | ||||||||||||||||||||||||||||||||||||
1852 | comboBoxCopy.rect = option->rect; | - | ||||||||||||||||||||||||||||||||||||
1853 | - | |||||||||||||||||||||||||||||||||||||
1854 | bool reverse = (option->direction == Qt::RightToLeft); | - | ||||||||||||||||||||||||||||||||||||
1855 | QRect rect = option->rect; | - | ||||||||||||||||||||||||||||||||||||
1856 | QRect arrowButtonRect = proxy()->subControlRect(CC_ComboBox, &comboBoxCopy, | - | ||||||||||||||||||||||||||||||||||||
1857 | SC_ComboBoxArrow, widget); | - | ||||||||||||||||||||||||||||||||||||
1858 | - | |||||||||||||||||||||||||||||||||||||
1859 | GtkShadowType shadow = (option->state & State_Sunken || option->state & State_On ) ?
| 0 | ||||||||||||||||||||||||||||||||||||
1860 | GTK_SHADOW_IN : GTK_SHADOW_OUT; | - | ||||||||||||||||||||||||||||||||||||
1861 | const QHashableLatin1Literal comboBoxPath = comboBox->editable ? QHashableLatin1Literal("GtkComboBoxEntry") : QHashableLatin1Literal("GtkComboBox");
| 0 | ||||||||||||||||||||||||||||||||||||
1862 | - | |||||||||||||||||||||||||||||||||||||
1863 | // We use the gtk widget to position arrows and separators for us | - | ||||||||||||||||||||||||||||||||||||
1864 | GtkWidget *gtkCombo = d->gtkWidget(comboBoxPath); | - | ||||||||||||||||||||||||||||||||||||
1865 | GtkAllocation geometry = {0, 0, option->rect.width(), option->rect.height()}; | - | ||||||||||||||||||||||||||||||||||||
1866 | d->gtk_widget_set_direction(gtkCombo, reverse ? GTK_TEXT_DIR_RTL : GTK_TEXT_DIR_LTR); | - | ||||||||||||||||||||||||||||||||||||
1867 | d->gtk_widget_size_allocate(gtkCombo, &geometry); | - | ||||||||||||||||||||||||||||||||||||
1868 | - | |||||||||||||||||||||||||||||||||||||
1869 | QHashableLatin1Literal buttonPath = comboBox->editable ? QHashableLatin1Literal("GtkComboBoxEntry.GtkToggleButton")
| 0 | ||||||||||||||||||||||||||||||||||||
1870 | : QHashableLatin1Literal("GtkComboBox.GtkToggleButton"); | - | ||||||||||||||||||||||||||||||||||||
1871 | GtkWidget *gtkToggleButton = d->gtkWidget(buttonPath); | - | ||||||||||||||||||||||||||||||||||||
1872 | d->gtk_widget_set_direction(gtkToggleButton, reverse ? GTK_TEXT_DIR_RTL : GTK_TEXT_DIR_LTR); | - | ||||||||||||||||||||||||||||||||||||
1873 | if (gtkToggleButton && (appears_as_list || comboBox->editable)) {
| 0 | ||||||||||||||||||||||||||||||||||||
1874 | if (focus)
| 0 | ||||||||||||||||||||||||||||||||||||
1875 | QGtkStylePrivate::gtkWidgetSetFocus(gtkToggleButton, true); never executed: QGtkStylePrivate::gtkWidgetSetFocus(gtkToggleButton, true); | 0 | ||||||||||||||||||||||||||||||||||||
1876 | // Draw the combo box as a line edit with a button next to it | - | ||||||||||||||||||||||||||||||||||||
1877 | if (comboBox->editable || appears_as_list) {
| 0 | ||||||||||||||||||||||||||||||||||||
1878 | GtkStateType frameState = (state == GTK_STATE_PRELIGHT) ? GTK_STATE_NORMAL : state;
| 0 | ||||||||||||||||||||||||||||||||||||
1879 | QHashableLatin1Literal entryPath = comboBox->editable ? QHashableLatin1Literal("GtkComboBoxEntry.GtkEntry") : QHashableLatin1Literal("GtkComboBox.GtkFrame");
| 0 | ||||||||||||||||||||||||||||||||||||
1880 | GtkWidget *gtkEntry = d->gtkWidget(entryPath); | - | ||||||||||||||||||||||||||||||||||||
1881 | d->gtk_widget_set_direction(gtkEntry, reverse ? GTK_TEXT_DIR_RTL : GTK_TEXT_DIR_LTR); | - | ||||||||||||||||||||||||||||||||||||
1882 | QRect frameRect = option->rect; | - | ||||||||||||||||||||||||||||||||||||
1883 | - | |||||||||||||||||||||||||||||||||||||
1884 | if (reverse)
| 0 | ||||||||||||||||||||||||||||||||||||
1885 | frameRect.setLeft(arrowButtonRect.right()); never executed: frameRect.setLeft(arrowButtonRect.right()); | 0 | ||||||||||||||||||||||||||||||||||||
1886 | else | - | ||||||||||||||||||||||||||||||||||||
1887 | frameRect.setRight(arrowButtonRect.left()); never executed: frameRect.setRight(arrowButtonRect.left()); | 0 | ||||||||||||||||||||||||||||||||||||
1888 | - | |||||||||||||||||||||||||||||||||||||
1889 | // Fill the line edit background | - | ||||||||||||||||||||||||||||||||||||
1890 | // We could have used flat_box with "entry_bg" but that is probably not worth the overhead | - | ||||||||||||||||||||||||||||||||||||
1891 | uint resolve_mask = option->palette.resolve(); | - | ||||||||||||||||||||||||||||||||||||
1892 | GtkStyle *gtkEntryStyle = d->gtk_widget_get_style(gtkEntry); | - | ||||||||||||||||||||||||||||||||||||
1893 | QRect contentRect = frameRect.adjusted(gtkEntryStyle->xthickness, gtkEntryStyle->ythickness, | - | ||||||||||||||||||||||||||||||||||||
1894 | -gtkEntryStyle->xthickness, -gtkEntryStyle->ythickness); | - | ||||||||||||||||||||||||||||||||||||
1895 | // Required for inner blue highlight with clearlooks | - | ||||||||||||||||||||||||||||||||||||
1896 | if (focus)
| 0 | ||||||||||||||||||||||||||||||||||||
1897 | QGtkStylePrivate::gtkWidgetSetFocus(gtkEntry, true); never executed: QGtkStylePrivate::gtkWidgetSetFocus(gtkEntry, true); | 0 | ||||||||||||||||||||||||||||||||||||
1898 | - | |||||||||||||||||||||||||||||||||||||
1899 | if (widget && widget->testAttribute(Qt::WA_SetPalette) &&
| 0 | ||||||||||||||||||||||||||||||||||||
1900 | resolve_mask & (1 << QPalette::Base)) // Palette overridden by user
| 0 | ||||||||||||||||||||||||||||||||||||
1901 | p->fillRect(contentRect, option->palette.base().color()); never executed: p->fillRect(contentRect, option->palette.base().color()); | 0 | ||||||||||||||||||||||||||||||||||||
1902 | else { | - | ||||||||||||||||||||||||||||||||||||
1903 | gtkPainter->paintFlatBox(gtkEntry, "entry_bg", contentRect, | - | ||||||||||||||||||||||||||||||||||||
1904 | option->state & State_Enabled ? GTK_STATE_NORMAL : GTK_STATE_INSENSITIVE, | - | ||||||||||||||||||||||||||||||||||||
1905 | GTK_SHADOW_NONE, gtkEntryStyle, entryPath.toString() + QString::number(focus)); | - | ||||||||||||||||||||||||||||||||||||
1906 | } never executed: end of block | 0 | ||||||||||||||||||||||||||||||||||||
1907 | - | |||||||||||||||||||||||||||||||||||||
1908 | gtkPainter->paintShadow(gtkEntry, comboBox->editable ? "entry" : "frame", frameRect, frameState, | - | ||||||||||||||||||||||||||||||||||||
1909 | GTK_SHADOW_IN, gtkEntryStyle, entryPath.toString() + | - | ||||||||||||||||||||||||||||||||||||
1910 | QString::number(focus) + QString::number(comboBox->editable) + | - | ||||||||||||||||||||||||||||||||||||
1911 | QString::number(option->direction)); | - | ||||||||||||||||||||||||||||||||||||
1912 | if (focus)
| 0 | ||||||||||||||||||||||||||||||||||||
1913 | QGtkStylePrivate::gtkWidgetSetFocus(gtkEntry, false); never executed: QGtkStylePrivate::gtkWidgetSetFocus(gtkEntry, false); | 0 | ||||||||||||||||||||||||||||||||||||
1914 | } never executed: end of block | 0 | ||||||||||||||||||||||||||||||||||||
1915 | - | |||||||||||||||||||||||||||||||||||||
1916 | GtkStateType buttonState = GTK_STATE_NORMAL; | - | ||||||||||||||||||||||||||||||||||||
1917 | - | |||||||||||||||||||||||||||||||||||||
1918 | if (!(option->state & State_Enabled))
| 0 | ||||||||||||||||||||||||||||||||||||
1919 | buttonState = GTK_STATE_INSENSITIVE; never executed: buttonState = GTK_STATE_INSENSITIVE; | 0 | ||||||||||||||||||||||||||||||||||||
1920 | else if (option->state & State_Sunken || option->state & State_On)
| 0 | ||||||||||||||||||||||||||||||||||||
1921 | buttonState = GTK_STATE_ACTIVE; never executed: buttonState = GTK_STATE_ACTIVE; | 0 | ||||||||||||||||||||||||||||||||||||
1922 | else if (option->state & State_MouseOver && comboBox->activeSubControls & SC_ComboBoxArrow)
| 0 | ||||||||||||||||||||||||||||||||||||
1923 | buttonState = GTK_STATE_PRELIGHT; never executed: buttonState = GTK_STATE_PRELIGHT; | 0 | ||||||||||||||||||||||||||||||||||||
1924 | - | |||||||||||||||||||||||||||||||||||||
1925 | Q_ASSERT(gtkToggleButton); | - | ||||||||||||||||||||||||||||||||||||
1926 | gtkPainter->paintBox(gtkToggleButton, "button", arrowButtonRect, buttonState, | - | ||||||||||||||||||||||||||||||||||||
1927 | shadow, d->gtk_widget_get_style(gtkToggleButton), buttonPath.toString() + | - | ||||||||||||||||||||||||||||||||||||
1928 | QString::number(focus) + QString::number(option->direction)); | - | ||||||||||||||||||||||||||||||||||||
1929 | if (focus)
| 0 | ||||||||||||||||||||||||||||||||||||
1930 | QGtkStylePrivate::gtkWidgetSetFocus(gtkToggleButton, false); never executed: QGtkStylePrivate::gtkWidgetSetFocus(gtkToggleButton, false); | 0 | ||||||||||||||||||||||||||||||||||||
1931 | } else { never executed: end of block | 0 | ||||||||||||||||||||||||||||||||||||
1932 | // Draw combo box as a button | - | ||||||||||||||||||||||||||||||||||||
1933 | QRect buttonRect = option->rect; | - | ||||||||||||||||||||||||||||||||||||
1934 | GtkStyle *gtkToggleButtonStyle = d->gtk_widget_get_style(gtkToggleButton); | - | ||||||||||||||||||||||||||||||||||||
1935 | - | |||||||||||||||||||||||||||||||||||||
1936 | if (focus) // Clearlooks actually check the widget for the default state
| 0 | ||||||||||||||||||||||||||||||||||||
1937 | QGtkStylePrivate::gtkWidgetSetFocus(gtkToggleButton, true); never executed: QGtkStylePrivate::gtkWidgetSetFocus(gtkToggleButton, true); | 0 | ||||||||||||||||||||||||||||||||||||
1938 | gtkPainter->paintBox(gtkToggleButton, "button", | - | ||||||||||||||||||||||||||||||||||||
1939 | buttonRect, state, | - | ||||||||||||||||||||||||||||||||||||
1940 | shadow, gtkToggleButtonStyle, | - | ||||||||||||||||||||||||||||||||||||
1941 | buttonPath.toString() + QString::number(focus)); | - | ||||||||||||||||||||||||||||||||||||
1942 | if (focus)
| 0 | ||||||||||||||||||||||||||||||||||||
1943 | QGtkStylePrivate::gtkWidgetSetFocus(gtkToggleButton, false); never executed: QGtkStylePrivate::gtkWidgetSetFocus(gtkToggleButton, false); | 0 | ||||||||||||||||||||||||||||||||||||
1944 | - | |||||||||||||||||||||||||||||||||||||
1945 | - | |||||||||||||||||||||||||||||||||||||
1946 | // Draw the separator between label and arrows | - | ||||||||||||||||||||||||||||||||||||
1947 | QHashableLatin1Literal vSeparatorPath = comboBox->editable
| 0 | ||||||||||||||||||||||||||||||||||||
1948 | ? QHashableLatin1Literal("GtkComboBoxEntry.GtkToggleButton.GtkHBox.GtkVSeparator") | - | ||||||||||||||||||||||||||||||||||||
1949 | : QHashableLatin1Literal("GtkComboBox.GtkToggleButton.GtkHBox.GtkVSeparator"); | - | ||||||||||||||||||||||||||||||||||||
1950 | - | |||||||||||||||||||||||||||||||||||||
1951 | if (GtkWidget *gtkVSeparator = d->gtkWidget(vSeparatorPath)) {
| 0 | ||||||||||||||||||||||||||||||||||||
1952 | GtkAllocation allocation; | - | ||||||||||||||||||||||||||||||||||||
1953 | d->gtk_widget_get_allocation(gtkVSeparator, &allocation); | - | ||||||||||||||||||||||||||||||||||||
1954 | QRect vLineRect(allocation.x, allocation.y, allocation.width, allocation.height); | - | ||||||||||||||||||||||||||||||||||||
1955 | - | |||||||||||||||||||||||||||||||||||||
1956 | gtkPainter->paintVline(gtkVSeparator, "vseparator", | - | ||||||||||||||||||||||||||||||||||||
1957 | vLineRect, state, d->gtk_widget_get_style(gtkVSeparator), | - | ||||||||||||||||||||||||||||||||||||
1958 | 0, vLineRect.height(), 0, vSeparatorPath.toString()); | - | ||||||||||||||||||||||||||||||||||||
1959 | - | |||||||||||||||||||||||||||||||||||||
1960 | - | |||||||||||||||||||||||||||||||||||||
1961 | gint interiorFocus = true; | - | ||||||||||||||||||||||||||||||||||||
1962 | d->gtk_widget_style_get(gtkToggleButton, "interior-focus", &interiorFocus, NULL); | - | ||||||||||||||||||||||||||||||||||||
1963 | int xt = interiorFocus ? gtkToggleButtonStyle->xthickness : 0;
| 0 | ||||||||||||||||||||||||||||||||||||
1964 | int yt = interiorFocus ? gtkToggleButtonStyle->ythickness : 0;
| 0 | ||||||||||||||||||||||||||||||||||||
1965 | if (focus && ((option->state & State_KeyboardFocusChange) || styleHint(SH_UnderlineShortcut, option, widget)))
| 0 | ||||||||||||||||||||||||||||||||||||
1966 | gtkPainter->paintFocus(gtkToggleButton, "button", never executed: gtkPainter->paintFocus(gtkToggleButton, "button", option->rect.adjusted(xt, yt, -xt, -yt), option->state & State_Sunken ? GTK_STATE_ACTIVE : GTK_STATE_NORMAL, gtkToggleButtonStyle); | 0 | ||||||||||||||||||||||||||||||||||||
1967 | option->rect.adjusted(xt, yt, -xt, -yt), never executed: gtkPainter->paintFocus(gtkToggleButton, "button", option->rect.adjusted(xt, yt, -xt, -yt), option->state & State_Sunken ? GTK_STATE_ACTIVE : GTK_STATE_NORMAL, gtkToggleButtonStyle); | 0 | ||||||||||||||||||||||||||||||||||||
1968 | option->state & State_Sunken ? GTK_STATE_ACTIVE : GTK_STATE_NORMAL, never executed: gtkPainter->paintFocus(gtkToggleButton, "button", option->rect.adjusted(xt, yt, -xt, -yt), option->state & State_Sunken ? GTK_STATE_ACTIVE : GTK_STATE_NORMAL, gtkToggleButtonStyle); | 0 | ||||||||||||||||||||||||||||||||||||
1969 | gtkToggleButtonStyle); never executed: gtkPainter->paintFocus(gtkToggleButton, "button", option->rect.adjusted(xt, yt, -xt, -yt), option->state & State_Sunken ? GTK_STATE_ACTIVE : GTK_STATE_NORMAL, gtkToggleButtonStyle); | 0 | ||||||||||||||||||||||||||||||||||||
1970 | } never executed: end of block | 0 | ||||||||||||||||||||||||||||||||||||
1971 | } never executed: end of block | 0 | ||||||||||||||||||||||||||||||||||||
1972 | - | |||||||||||||||||||||||||||||||||||||
1973 | if (comboBox->subControls & SC_ComboBoxArrow) {
| 0 | ||||||||||||||||||||||||||||||||||||
1974 | if (!isEnabled)
| 0 | ||||||||||||||||||||||||||||||||||||
1975 | state = GTK_STATE_INSENSITIVE; never executed: state = GTK_STATE_INSENSITIVE; | 0 | ||||||||||||||||||||||||||||||||||||
1976 | else if (sunken)
| 0 | ||||||||||||||||||||||||||||||||||||
1977 | state = GTK_STATE_ACTIVE; never executed: state = GTK_STATE_ACTIVE; | 0 | ||||||||||||||||||||||||||||||||||||
1978 | else if (option->state & State_MouseOver)
| 0 | ||||||||||||||||||||||||||||||||||||
1979 | state = GTK_STATE_PRELIGHT; never executed: state = GTK_STATE_PRELIGHT; | 0 | ||||||||||||||||||||||||||||||||||||
1980 | else | - | ||||||||||||||||||||||||||||||||||||
1981 | state = GTK_STATE_NORMAL; never executed: state = GTK_STATE_NORMAL; | 0 | ||||||||||||||||||||||||||||||||||||
1982 | - | |||||||||||||||||||||||||||||||||||||
1983 | QHashableLatin1Literal arrowPath(""); | - | ||||||||||||||||||||||||||||||||||||
1984 | if (comboBox->editable) {
| 0 | ||||||||||||||||||||||||||||||||||||
1985 | if (appears_as_list)
| 0 | ||||||||||||||||||||||||||||||||||||
1986 | arrowPath = QHashableLatin1Literal("GtkComboBoxEntry.GtkToggleButton.GtkArrow"); never executed: arrowPath = QHashableLatin1Literal("GtkComboBoxEntry.GtkToggleButton.GtkArrow"); | 0 | ||||||||||||||||||||||||||||||||||||
1987 | else | - | ||||||||||||||||||||||||||||||||||||
1988 | arrowPath = QHashableLatin1Literal("GtkComboBoxEntry.GtkToggleButton.GtkHBox.GtkArrow"); never executed: arrowPath = QHashableLatin1Literal("GtkComboBoxEntry.GtkToggleButton.GtkHBox.GtkArrow"); | 0 | ||||||||||||||||||||||||||||||||||||
1989 | } else { | - | ||||||||||||||||||||||||||||||||||||
1990 | if (appears_as_list)
| 0 | ||||||||||||||||||||||||||||||||||||
1991 | arrowPath = QHashableLatin1Literal("GtkComboBox.GtkToggleButton.GtkArrow"); never executed: arrowPath = QHashableLatin1Literal("GtkComboBox.GtkToggleButton.GtkArrow"); | 0 | ||||||||||||||||||||||||||||||||||||
1992 | else | - | ||||||||||||||||||||||||||||||||||||
1993 | arrowPath = QHashableLatin1Literal("GtkComboBox.GtkToggleButton.GtkHBox.GtkArrow"); never executed: arrowPath = QHashableLatin1Literal("GtkComboBox.GtkToggleButton.GtkHBox.GtkArrow"); | 0 | ||||||||||||||||||||||||||||||||||||
1994 | } | - | ||||||||||||||||||||||||||||||||||||
1995 | - | |||||||||||||||||||||||||||||||||||||
1996 | GtkWidget *gtkArrow = d->gtkWidget(arrowPath); | - | ||||||||||||||||||||||||||||||||||||
1997 | gfloat scale = 0.7; | - | ||||||||||||||||||||||||||||||||||||
1998 | gint minSize = 15; | - | ||||||||||||||||||||||||||||||||||||
1999 | QRect arrowWidgetRect; | - | ||||||||||||||||||||||||||||||||||||
2000 | - | |||||||||||||||||||||||||||||||||||||
2001 | if (gtkArrow && !d->gtk_check_version(2, 12, 0)) {
| 0 | ||||||||||||||||||||||||||||||||||||
2002 | d->gtk_widget_style_get(gtkArrow, "arrow-scaling", &scale, NULL); | - | ||||||||||||||||||||||||||||||||||||
2003 | d->gtk_widget_style_get(gtkCombo, "arrow-size", &minSize, NULL); | - | ||||||||||||||||||||||||||||||||||||
2004 | } never executed: end of block | 0 | ||||||||||||||||||||||||||||||||||||
2005 | if (gtkArrow) {
| 0 | ||||||||||||||||||||||||||||||||||||
2006 | GtkAllocation allocation; | - | ||||||||||||||||||||||||||||||||||||
2007 | d->gtk_widget_get_allocation(gtkArrow, &allocation); | - | ||||||||||||||||||||||||||||||||||||
2008 | arrowWidgetRect = QRect(allocation.x, allocation.y, allocation.width, allocation.height); | - | ||||||||||||||||||||||||||||||||||||
2009 | style = d->gtk_widget_get_style(gtkArrow); | - | ||||||||||||||||||||||||||||||||||||
2010 | } never executed: end of block | 0 | ||||||||||||||||||||||||||||||||||||
2011 | - | |||||||||||||||||||||||||||||||||||||
2012 | // Note that for some reason the arrow-size is not properly respected with Hildon | - | ||||||||||||||||||||||||||||||||||||
2013 | // Hence we enforce the minimum "arrow-size" ourselves | - | ||||||||||||||||||||||||||||||||||||
2014 | int arrowSize = qMax(qMin(rect.height() - d->gtk_widget_get_style(gtkCombo)->ythickness * 2, minSize), | - | ||||||||||||||||||||||||||||||||||||
2015 | qMin(arrowWidgetRect.width(), arrowWidgetRect.height())); | - | ||||||||||||||||||||||||||||||||||||
2016 | QRect arrowRect(0, 0, static_cast<int>(arrowSize * scale), static_cast<int>(arrowSize * scale)); | - | ||||||||||||||||||||||||||||||||||||
2017 | - | |||||||||||||||||||||||||||||||||||||
2018 | arrowRect.moveCenter(arrowWidgetRect.center()); | - | ||||||||||||||||||||||||||||||||||||
2019 | - | |||||||||||||||||||||||||||||||||||||
2020 | if (sunken) {
| 0 | ||||||||||||||||||||||||||||||||||||
2021 | int xoff, yoff; | - | ||||||||||||||||||||||||||||||||||||
2022 | const QHashableLatin1Literal toggleButtonPath = comboBox->editable
| 0 | ||||||||||||||||||||||||||||||||||||
2023 | ? QHashableLatin1Literal("GtkComboBoxEntry.GtkToggleButton") | - | ||||||||||||||||||||||||||||||||||||
2024 | : QHashableLatin1Literal("GtkComboBox.GtkToggleButton"); | - | ||||||||||||||||||||||||||||||||||||
2025 | - | |||||||||||||||||||||||||||||||||||||
2026 | GtkWidget *gtkButton = d->gtkWidget(toggleButtonPath); | - | ||||||||||||||||||||||||||||||||||||
2027 | d->gtk_widget_style_get(gtkButton, "child-displacement-x", &xoff, NULL); | - | ||||||||||||||||||||||||||||||||||||
2028 | d->gtk_widget_style_get(gtkButton, "child-displacement-y", &yoff, NULL); | - | ||||||||||||||||||||||||||||||||||||
2029 | arrowRect = arrowRect.adjusted(xoff, yoff, xoff, yoff); | - | ||||||||||||||||||||||||||||||||||||
2030 | } never executed: end of block | 0 | ||||||||||||||||||||||||||||||||||||
2031 | - | |||||||||||||||||||||||||||||||||||||
2032 | // Some styles such as Nimbus paint outside the arrowRect | - | ||||||||||||||||||||||||||||||||||||
2033 | // hence we have provide the whole widget as the cliprect | - | ||||||||||||||||||||||||||||||||||||
2034 | if (gtkArrow) {
| 0 | ||||||||||||||||||||||||||||||||||||
2035 | gtkPainter->setClipRect(option->rect); | - | ||||||||||||||||||||||||||||||||||||
2036 | gtkPainter->paintArrow(gtkArrow, "arrow", arrowRect, | - | ||||||||||||||||||||||||||||||||||||
2037 | GTK_ARROW_DOWN, state, GTK_SHADOW_NONE, true, | - | ||||||||||||||||||||||||||||||||||||
2038 | style, arrowPath.toString() + QString::number(option->direction)); | - | ||||||||||||||||||||||||||||||||||||
2039 | } never executed: end of block | 0 | ||||||||||||||||||||||||||||||||||||
2040 | } never executed: end of block | 0 | ||||||||||||||||||||||||||||||||||||
2041 | END_STYLE_PIXMAPCACHE; never executed: end of block never executed: end of block
| 0 | ||||||||||||||||||||||||||||||||||||
2042 | } | - | ||||||||||||||||||||||||||||||||||||
2043 | break; never executed: break; | 0 | ||||||||||||||||||||||||||||||||||||
2044 | #endif // QT_NO_COMBOBOX | - | ||||||||||||||||||||||||||||||||||||
2045 | #ifndef QT_NO_TOOLBUTTON | - | ||||||||||||||||||||||||||||||||||||
2046 | - | |||||||||||||||||||||||||||||||||||||
2047 | case CC_ToolButton: never executed: case CC_ToolButton: | 0 | ||||||||||||||||||||||||||||||||||||
2048 | if (const QStyleOptionToolButton *toolbutton
| 0 | ||||||||||||||||||||||||||||||||||||
2049 | = qstyleoption_cast<const QStyleOptionToolButton *>(option)) {
| 0 | ||||||||||||||||||||||||||||||||||||
2050 | QRect button, menuarea; | - | ||||||||||||||||||||||||||||||||||||
2051 | button = proxy()->subControlRect(control, toolbutton, SC_ToolButton, widget); | - | ||||||||||||||||||||||||||||||||||||
2052 | menuarea = proxy()->subControlRect(control, toolbutton, SC_ToolButtonMenu, widget); | - | ||||||||||||||||||||||||||||||||||||
2053 | State bflags = toolbutton->state & ~(State_Sunken | State_MouseOver); | - | ||||||||||||||||||||||||||||||||||||
2054 | - | |||||||||||||||||||||||||||||||||||||
2055 | if (bflags & State_AutoRaise)
| 0 | ||||||||||||||||||||||||||||||||||||
2056 | if (!(bflags & State_MouseOver))
| 0 | ||||||||||||||||||||||||||||||||||||
2057 | bflags &= ~State_Raised; never executed: bflags &= ~State_Raised; | 0 | ||||||||||||||||||||||||||||||||||||
2058 | - | |||||||||||||||||||||||||||||||||||||
2059 | State mflags = bflags; | - | ||||||||||||||||||||||||||||||||||||
2060 | - | |||||||||||||||||||||||||||||||||||||
2061 | if (toolbutton->state & State_Sunken) {
| 0 | ||||||||||||||||||||||||||||||||||||
2062 | if (toolbutton->activeSubControls & SC_ToolButton)
| 0 | ||||||||||||||||||||||||||||||||||||
2063 | bflags |= State_Sunken; never executed: bflags |= State_Sunken; | 0 | ||||||||||||||||||||||||||||||||||||
2064 | if (toolbutton->activeSubControls & SC_ToolButtonMenu)
| 0 | ||||||||||||||||||||||||||||||||||||
2065 | mflags |= State_Sunken; never executed: mflags |= State_Sunken; | 0 | ||||||||||||||||||||||||||||||||||||
2066 | } else if (toolbutton->state & State_MouseOver) { never executed: end of block
| 0 | ||||||||||||||||||||||||||||||||||||
2067 | if (toolbutton->activeSubControls & SC_ToolButton)
| 0 | ||||||||||||||||||||||||||||||||||||
2068 | bflags |= State_MouseOver; never executed: bflags |= State_MouseOver; | 0 | ||||||||||||||||||||||||||||||||||||
2069 | if (toolbutton->activeSubControls & SC_ToolButtonMenu)
| 0 | ||||||||||||||||||||||||||||||||||||
2070 | mflags |= State_MouseOver; never executed: mflags |= State_MouseOver; | 0 | ||||||||||||||||||||||||||||||||||||
2071 | } never executed: end of block | 0 | ||||||||||||||||||||||||||||||||||||
2072 | - | |||||||||||||||||||||||||||||||||||||
2073 | QStyleOption tool = *toolbutton; | - | ||||||||||||||||||||||||||||||||||||
2074 | - | |||||||||||||||||||||||||||||||||||||
2075 | if (toolbutton->subControls & SC_ToolButton) {
| 0 | ||||||||||||||||||||||||||||||||||||
2076 | if (bflags & (State_Sunken | State_On | State_Raised | State_MouseOver)) {
| 0 | ||||||||||||||||||||||||||||||||||||
2077 | tool.rect = button; | - | ||||||||||||||||||||||||||||||||||||
2078 | tool.state = bflags; | - | ||||||||||||||||||||||||||||||||||||
2079 | proxy()->drawPrimitive(PE_PanelButtonTool, &tool, painter, widget); | - | ||||||||||||||||||||||||||||||||||||
2080 | } never executed: end of block | 0 | ||||||||||||||||||||||||||||||||||||
2081 | } never executed: end of block | 0 | ||||||||||||||||||||||||||||||||||||
2082 | - | |||||||||||||||||||||||||||||||||||||
2083 | bool drawMenuArrow = toolbutton->features & QStyleOptionToolButton::HasMenu &&
| 0 | ||||||||||||||||||||||||||||||||||||
2084 | !(toolbutton->features & QStyleOptionToolButton::MenuButtonPopup);
| 0 | ||||||||||||||||||||||||||||||||||||
2085 | int popupArrowSize = drawMenuArrow ? 7 : 0;
| 0 | ||||||||||||||||||||||||||||||||||||
2086 | - | |||||||||||||||||||||||||||||||||||||
2087 | if (toolbutton->state & State_HasFocus) {
| 0 | ||||||||||||||||||||||||||||||||||||
2088 | QStyleOptionFocusRect fr; | - | ||||||||||||||||||||||||||||||||||||
2089 | fr.QStyleOption::operator=(*toolbutton); | - | ||||||||||||||||||||||||||||||||||||
2090 | fr.rect = proxy()->subControlRect(CC_ToolButton, toolbutton, SC_ToolButton, widget); | - | ||||||||||||||||||||||||||||||||||||
2091 | fr.rect.adjust(1, 1, -1, -1); | - | ||||||||||||||||||||||||||||||||||||
2092 | proxy()->drawPrimitive(PE_FrameFocusRect, &fr, painter, widget); | - | ||||||||||||||||||||||||||||||||||||
2093 | } never executed: end of block | 0 | ||||||||||||||||||||||||||||||||||||
2094 | - | |||||||||||||||||||||||||||||||||||||
2095 | QStyleOptionToolButton label = *toolbutton; | - | ||||||||||||||||||||||||||||||||||||
2096 | label.state = bflags; | - | ||||||||||||||||||||||||||||||||||||
2097 | GtkWidget *gtkButton = d->gtkWidget("GtkToolButton.GtkButton"); | - | ||||||||||||||||||||||||||||||||||||
2098 | QPalette pal = toolbutton->palette; | - | ||||||||||||||||||||||||||||||||||||
2099 | if (option->state & State_Enabled &&
| 0 | ||||||||||||||||||||||||||||||||||||
2100 | option->state & State_MouseOver && !(widget && widget->testAttribute(Qt::WA_SetPalette))) {
| 0 | ||||||||||||||||||||||||||||||||||||
2101 | GdkColor gdkText = d->gtk_widget_get_style(gtkButton)->fg[GTK_STATE_PRELIGHT]; | - | ||||||||||||||||||||||||||||||||||||
2102 | QColor textColor = QColor(gdkText.red>>8, gdkText.green>>8, gdkText.blue>>8); | - | ||||||||||||||||||||||||||||||||||||
2103 | pal.setBrush(QPalette::All, QPalette::ButtonText, textColor); | - | ||||||||||||||||||||||||||||||||||||
2104 | label.palette = pal; | - | ||||||||||||||||||||||||||||||||||||
2105 | } never executed: end of block | 0 | ||||||||||||||||||||||||||||||||||||
2106 | label.rect = button.adjusted(style->xthickness, style->ythickness, | - | ||||||||||||||||||||||||||||||||||||
2107 | -style->xthickness - popupArrowSize, -style->ythickness); | - | ||||||||||||||||||||||||||||||||||||
2108 | proxy()->drawControl(CE_ToolButtonLabel, &label, painter, widget); | - | ||||||||||||||||||||||||||||||||||||
2109 | - | |||||||||||||||||||||||||||||||||||||
2110 | if (toolbutton->subControls & SC_ToolButtonMenu) {
| 0 | ||||||||||||||||||||||||||||||||||||
2111 | tool.rect = menuarea; | - | ||||||||||||||||||||||||||||||||||||
2112 | tool.state = mflags; | - | ||||||||||||||||||||||||||||||||||||
2113 | if ((mflags & State_Enabled && (mflags & (State_Sunken | State_Raised | State_MouseOver))) || !(mflags & State_AutoRaise))
| 0 | ||||||||||||||||||||||||||||||||||||
2114 | proxy()->drawPrimitive(PE_IndicatorButtonDropDown, &tool, painter, widget); never executed: proxy()->drawPrimitive(PE_IndicatorButtonDropDown, &tool, painter, widget); | 0 | ||||||||||||||||||||||||||||||||||||
2115 | - | |||||||||||||||||||||||||||||||||||||
2116 | proxy()->drawPrimitive(PE_IndicatorArrowDown, &tool, painter, widget); | - | ||||||||||||||||||||||||||||||||||||
2117 | - | |||||||||||||||||||||||||||||||||||||
2118 | } else if (drawMenuArrow) { never executed: end of block
| 0 | ||||||||||||||||||||||||||||||||||||
2119 | QRect ir = toolbutton->rect; | - | ||||||||||||||||||||||||||||||||||||
2120 | QStyleOptionToolButton newBtn = *toolbutton; | - | ||||||||||||||||||||||||||||||||||||
2121 | newBtn.rect = QRect(ir.right() - popupArrowSize - style->xthickness - 3, ir.height()/2 - 1, popupArrowSize, popupArrowSize); | - | ||||||||||||||||||||||||||||||||||||
2122 | proxy()->drawPrimitive(PE_IndicatorArrowDown, &newBtn, painter, widget); | - | ||||||||||||||||||||||||||||||||||||
2123 | } never executed: end of block | 0 | ||||||||||||||||||||||||||||||||||||
2124 | } never executed: end of block | 0 | ||||||||||||||||||||||||||||||||||||
2125 | break; never executed: break; | 0 | ||||||||||||||||||||||||||||||||||||
2126 | - | |||||||||||||||||||||||||||||||||||||
2127 | #endif // QT_NO_TOOLBUTTON | - | ||||||||||||||||||||||||||||||||||||
2128 | #ifndef QT_NO_SCROLLBAR | - | ||||||||||||||||||||||||||||||||||||
2129 | - | |||||||||||||||||||||||||||||||||||||
2130 | case CC_ScrollBar: never executed: case CC_ScrollBar: | 0 | ||||||||||||||||||||||||||||||||||||
2131 | if (const QStyleOptionSlider *scrollBar = qstyleoption_cast<const QStyleOptionSlider *>(option)) {
| 0 | ||||||||||||||||||||||||||||||||||||
2132 | GtkWidget *gtkHScrollBar = d->gtkWidget("GtkHScrollbar"); | - | ||||||||||||||||||||||||||||||||||||
2133 | GtkWidget *gtkVScrollBar = d->gtkWidget("GtkVScrollbar"); | - | ||||||||||||||||||||||||||||||||||||
2134 | - | |||||||||||||||||||||||||||||||||||||
2135 | // Fill background in case the scrollbar is partially transparent | - | ||||||||||||||||||||||||||||||||||||
2136 | painter->fillRect(option->rect, option->palette.background()); | - | ||||||||||||||||||||||||||||||||||||
2137 | - | |||||||||||||||||||||||||||||||||||||
2138 | QRect rect = scrollBar->rect; | - | ||||||||||||||||||||||||||||||||||||
2139 | QRect scrollBarSubLine = proxy()->subControlRect(control, scrollBar, SC_ScrollBarSubLine, widget); | - | ||||||||||||||||||||||||||||||||||||
2140 | QRect scrollBarAddLine = proxy()->subControlRect(control, scrollBar, SC_ScrollBarAddLine, widget); | - | ||||||||||||||||||||||||||||||||||||
2141 | QRect scrollBarSlider = proxy()->subControlRect(control, scrollBar, SC_ScrollBarSlider, widget); | - | ||||||||||||||||||||||||||||||||||||
2142 | QRect grooveRect = proxy()->subControlRect(control, scrollBar, SC_ScrollBarGroove, widget); | - | ||||||||||||||||||||||||||||||||||||
2143 | bool horizontal = scrollBar->orientation == Qt::Horizontal; | - | ||||||||||||||||||||||||||||||||||||
2144 | GtkWidget * scrollbarWidget = horizontal ? gtkHScrollBar : gtkVScrollBar;
| 0 | ||||||||||||||||||||||||||||||||||||
2145 | style = d->gtk_widget_get_style(scrollbarWidget); | - | ||||||||||||||||||||||||||||||||||||
2146 | gboolean trough_under_steppers = true; | - | ||||||||||||||||||||||||||||||||||||
2147 | gboolean trough_side_details = false; | - | ||||||||||||||||||||||||||||||||||||
2148 | gboolean activate_slider = false; | - | ||||||||||||||||||||||||||||||||||||
2149 | gboolean stepper_size = 14; | - | ||||||||||||||||||||||||||||||||||||
2150 | gint trough_border = 1; | - | ||||||||||||||||||||||||||||||||||||
2151 | if (!d->gtk_check_version(2, 10, 0)) {
| 0 | ||||||||||||||||||||||||||||||||||||
2152 | d->gtk_widget_style_get((GtkWidget*)(scrollbarWidget), | - | ||||||||||||||||||||||||||||||||||||
2153 | "trough-border", &trough_border, | - | ||||||||||||||||||||||||||||||||||||
2154 | "trough-side-details", &trough_side_details, | - | ||||||||||||||||||||||||||||||||||||
2155 | "trough-under-steppers", &trough_under_steppers, | - | ||||||||||||||||||||||||||||||||||||
2156 | "activate-slider", &activate_slider, | - | ||||||||||||||||||||||||||||||||||||
2157 | "stepper-size", &stepper_size, NULL); | - | ||||||||||||||||||||||||||||||||||||
2158 | } never executed: end of block | 0 | ||||||||||||||||||||||||||||||||||||
2159 | if (trough_under_steppers) {
| 0 | ||||||||||||||||||||||||||||||||||||
2160 | scrollBarAddLine.adjust(trough_border, trough_border, -trough_border, -trough_border); | - | ||||||||||||||||||||||||||||||||||||
2161 | scrollBarSubLine.adjust(trough_border, trough_border, -trough_border, -trough_border); | - | ||||||||||||||||||||||||||||||||||||
2162 | scrollBarSlider.adjust(horizontal ? -trough_border : 0, horizontal ? 0 : -trough_border, | - | ||||||||||||||||||||||||||||||||||||
2163 | horizontal ? trough_border : 0, horizontal ? 0 : trough_border); | - | ||||||||||||||||||||||||||||||||||||
2164 | } never executed: end of block | 0 | ||||||||||||||||||||||||||||||||||||
2165 | - | |||||||||||||||||||||||||||||||||||||
2166 | // Some styles check the position of scrollbars in order to determine | - | ||||||||||||||||||||||||||||||||||||
2167 | // if lines should be painted when the scrollbar is in max or min positions. | - | ||||||||||||||||||||||||||||||||||||
2168 | int maximum = 2; | - | ||||||||||||||||||||||||||||||||||||
2169 | int fakePos = 0; | - | ||||||||||||||||||||||||||||||||||||
2170 | bool reverse = (option->direction == Qt::RightToLeft); | - | ||||||||||||||||||||||||||||||||||||
2171 | if (scrollBar->minimum == scrollBar->maximum)
| 0 | ||||||||||||||||||||||||||||||||||||
2172 | maximum = 0; never executed: maximum = 0; | 0 | ||||||||||||||||||||||||||||||||||||
2173 | if (scrollBar->sliderPosition == scrollBar->maximum)
| 0 | ||||||||||||||||||||||||||||||||||||
2174 | fakePos = maximum; never executed: fakePos = maximum; | 0 | ||||||||||||||||||||||||||||||||||||
2175 | else if (scrollBar->sliderPosition > scrollBar->minimum)
| 0 | ||||||||||||||||||||||||||||||||||||
2176 | fakePos = maximum - 1; never executed: fakePos = maximum - 1; | 0 | ||||||||||||||||||||||||||||||||||||
2177 | - | |||||||||||||||||||||||||||||||||||||
2178 | - | |||||||||||||||||||||||||||||||||||||
2179 | GtkRange *range = (GtkRange*)(horizontal ? gtkHScrollBar : gtkVScrollBar);
| 0 | ||||||||||||||||||||||||||||||||||||
2180 | GtkAdjustment *adjustment = 0; | - | ||||||||||||||||||||||||||||||||||||
2181 | - | |||||||||||||||||||||||||||||||||||||
2182 | if (d->gtk_adjustment_configure)
| 0 | ||||||||||||||||||||||||||||||||||||
2183 | adjustment = d->gtk_range_get_adjustment(range); never executed: adjustment = d->gtk_range_get_adjustment(range); | 0 | ||||||||||||||||||||||||||||||||||||
2184 | if (adjustment) {
| 0 | ||||||||||||||||||||||||||||||||||||
2185 | d->gtk_adjustment_configure(adjustment, fakePos, 0, maximum, 0, 0, 0); | - | ||||||||||||||||||||||||||||||||||||
2186 | } else { never executed: end of block | 0 | ||||||||||||||||||||||||||||||||||||
2187 | adjustment = (GtkAdjustment*)d->gtk_adjustment_new(fakePos, 0, maximum, 0, 0, 0); | - | ||||||||||||||||||||||||||||||||||||
2188 | d->gtk_range_set_adjustment(range, adjustment); | - | ||||||||||||||||||||||||||||||||||||
2189 | } never executed: end of block | 0 | ||||||||||||||||||||||||||||||||||||
2190 | - | |||||||||||||||||||||||||||||||||||||
2191 | if (scrollBar->subControls & SC_ScrollBarGroove) {
| 0 | ||||||||||||||||||||||||||||||||||||
2192 | GtkStateType state = GTK_STATE_ACTIVE; | - | ||||||||||||||||||||||||||||||||||||
2193 | - | |||||||||||||||||||||||||||||||||||||
2194 | if (!(option->state & State_Enabled))
| 0 | ||||||||||||||||||||||||||||||||||||
2195 | state = GTK_STATE_INSENSITIVE; never executed: state = GTK_STATE_INSENSITIVE; | 0 | ||||||||||||||||||||||||||||||||||||
2196 | - | |||||||||||||||||||||||||||||||||||||
2197 | if (trough_under_steppers)
| 0 | ||||||||||||||||||||||||||||||||||||
2198 | grooveRect = option->rect; never executed: grooveRect = option->rect; | 0 | ||||||||||||||||||||||||||||||||||||
2199 | - | |||||||||||||||||||||||||||||||||||||
2200 | gtkPainter->paintBox(scrollbarWidget, "trough", grooveRect, state, GTK_SHADOW_IN, style); | - | ||||||||||||||||||||||||||||||||||||
2201 | } never executed: end of block | 0 | ||||||||||||||||||||||||||||||||||||
2202 | - | |||||||||||||||||||||||||||||||||||||
2203 | //paint slider | - | ||||||||||||||||||||||||||||||||||||
2204 | if (scrollBar->subControls & SC_ScrollBarSlider) {
| 0 | ||||||||||||||||||||||||||||||||||||
2205 | GtkStateType state = GTK_STATE_NORMAL; | - | ||||||||||||||||||||||||||||||||||||
2206 | - | |||||||||||||||||||||||||||||||||||||
2207 | if (!(option->state & State_Enabled))
| 0 | ||||||||||||||||||||||||||||||||||||
2208 | state = GTK_STATE_INSENSITIVE; never executed: state = GTK_STATE_INSENSITIVE; | 0 | ||||||||||||||||||||||||||||||||||||
2209 | else if (activate_slider &&
| 0 | ||||||||||||||||||||||||||||||||||||
2210 | option->state & State_Sunken && (scrollBar->activeSubControls & SC_ScrollBarSlider))
| 0 | ||||||||||||||||||||||||||||||||||||
2211 | state = GTK_STATE_ACTIVE; never executed: state = GTK_STATE_ACTIVE; | 0 | ||||||||||||||||||||||||||||||||||||
2212 | else if (option->state & State_MouseOver && (scrollBar->activeSubControls & SC_ScrollBarSlider))
| 0 | ||||||||||||||||||||||||||||||||||||
2213 | state = GTK_STATE_PRELIGHT; never executed: state = GTK_STATE_PRELIGHT; | 0 | ||||||||||||||||||||||||||||||||||||
2214 | - | |||||||||||||||||||||||||||||||||||||
2215 | GtkShadowType shadow = GTK_SHADOW_OUT; | - | ||||||||||||||||||||||||||||||||||||
2216 | - | |||||||||||||||||||||||||||||||||||||
2217 | if (trough_under_steppers) {
| 0 | ||||||||||||||||||||||||||||||||||||
2218 | if (!horizontal)
| 0 | ||||||||||||||||||||||||||||||||||||
2219 | scrollBarSlider.adjust(trough_border, 0, -trough_border, 0); never executed: scrollBarSlider.adjust(trough_border, 0, -trough_border, 0); | 0 | ||||||||||||||||||||||||||||||||||||
2220 | else | - | ||||||||||||||||||||||||||||||||||||
2221 | scrollBarSlider.adjust(0, trough_border, 0, -trough_border); never executed: scrollBarSlider.adjust(0, trough_border, 0, -trough_border); | 0 | ||||||||||||||||||||||||||||||||||||
2222 | } | - | ||||||||||||||||||||||||||||||||||||
2223 | - | |||||||||||||||||||||||||||||||||||||
2224 | gtkPainter->paintSlider(scrollbarWidget, "slider", scrollBarSlider, state, shadow, style, | - | ||||||||||||||||||||||||||||||||||||
2225 | horizontal ? GTK_ORIENTATION_HORIZONTAL : GTK_ORIENTATION_VERTICAL, QString(QLS("%0%1")).arg(fakePos).arg(maximum)); | - | ||||||||||||||||||||||||||||||||||||
2226 | } never executed: end of block | 0 | ||||||||||||||||||||||||||||||||||||
2227 | - | |||||||||||||||||||||||||||||||||||||
2228 | if (scrollBar->subControls & SC_ScrollBarAddLine) {
| 0 | ||||||||||||||||||||||||||||||||||||
2229 | GtkAllocation vAllocation; | - | ||||||||||||||||||||||||||||||||||||
2230 | vAllocation.y = scrollBarAddLine.top(); | - | ||||||||||||||||||||||||||||||||||||
2231 | vAllocation.height = scrollBarAddLine.height() - rect.height() + 6; | - | ||||||||||||||||||||||||||||||||||||
2232 | d->gtk_widget_set_allocation(gtkVScrollBar, &vAllocation); | - | ||||||||||||||||||||||||||||||||||||
2233 | - | |||||||||||||||||||||||||||||||||||||
2234 | GtkAllocation hAllocation; | - | ||||||||||||||||||||||||||||||||||||
2235 | hAllocation.x = scrollBarAddLine.right(); | - | ||||||||||||||||||||||||||||||||||||
2236 | hAllocation.width = scrollBarAddLine.width() - rect.width(); | - | ||||||||||||||||||||||||||||||||||||
2237 | d->gtk_widget_set_allocation(gtkHScrollBar, &hAllocation); | - | ||||||||||||||||||||||||||||||||||||
2238 | - | |||||||||||||||||||||||||||||||||||||
2239 | GtkShadowType shadow = GTK_SHADOW_OUT; | - | ||||||||||||||||||||||||||||||||||||
2240 | GtkStateType state = GTK_STATE_NORMAL; | - | ||||||||||||||||||||||||||||||||||||
2241 | - | |||||||||||||||||||||||||||||||||||||
2242 | if (!(option->state & State_Enabled) || (fakePos == maximum))
| 0 | ||||||||||||||||||||||||||||||||||||
2243 | state = GTK_STATE_INSENSITIVE; never executed: state = GTK_STATE_INSENSITIVE; | 0 | ||||||||||||||||||||||||||||||||||||
2244 | else if (option->state & State_Sunken && (scrollBar->activeSubControls & SC_ScrollBarAddLine)) {
| 0 | ||||||||||||||||||||||||||||||||||||
2245 | state = GTK_STATE_ACTIVE; | - | ||||||||||||||||||||||||||||||||||||
2246 | shadow = GTK_SHADOW_IN; | - | ||||||||||||||||||||||||||||||||||||
2247 | - | |||||||||||||||||||||||||||||||||||||
2248 | } else if (option->state & State_MouseOver && (scrollBar->activeSubControls & SC_ScrollBarAddLine)) never executed: end of block
| 0 | ||||||||||||||||||||||||||||||||||||
2249 | state = GTK_STATE_PRELIGHT; never executed: state = GTK_STATE_PRELIGHT; | 0 | ||||||||||||||||||||||||||||||||||||
2250 | - | |||||||||||||||||||||||||||||||||||||
2251 | gtkPainter->paintBox(scrollbarWidget, | - | ||||||||||||||||||||||||||||||||||||
2252 | horizontal ? "hscrollbar" : "vscrollbar", scrollBarAddLine, | - | ||||||||||||||||||||||||||||||||||||
2253 | state, shadow, style, QLS("add")); | - | ||||||||||||||||||||||||||||||||||||
2254 | - | |||||||||||||||||||||||||||||||||||||
2255 | gtkPainter->paintArrow(scrollbarWidget, horizontal ? "hscrollbar" : "vscrollbar", scrollBarAddLine.adjusted(4, 4, -4, -4), | - | ||||||||||||||||||||||||||||||||||||
2256 | horizontal ? (reverse ? GTK_ARROW_LEFT : GTK_ARROW_RIGHT) : | - | ||||||||||||||||||||||||||||||||||||
2257 | GTK_ARROW_DOWN, state, GTK_SHADOW_NONE, false, style); | - | ||||||||||||||||||||||||||||||||||||
2258 | } never executed: end of block | 0 | ||||||||||||||||||||||||||||||||||||
2259 | - | |||||||||||||||||||||||||||||||||||||
2260 | if (scrollBar->subControls & SC_ScrollBarSubLine) {
| 0 | ||||||||||||||||||||||||||||||||||||
2261 | GtkAllocation vAllocation; | - | ||||||||||||||||||||||||||||||||||||
2262 | vAllocation.y = 0; | - | ||||||||||||||||||||||||||||||||||||
2263 | vAllocation.height = scrollBarSubLine.height(); | - | ||||||||||||||||||||||||||||||||||||
2264 | d->gtk_widget_set_allocation(gtkVScrollBar, &vAllocation); | - | ||||||||||||||||||||||||||||||||||||
2265 | - | |||||||||||||||||||||||||||||||||||||
2266 | GtkAllocation hAllocation; | - | ||||||||||||||||||||||||||||||||||||
2267 | hAllocation.x = 0; | - | ||||||||||||||||||||||||||||||||||||
2268 | hAllocation.width = scrollBarSubLine.width(); | - | ||||||||||||||||||||||||||||||||||||
2269 | d->gtk_widget_set_allocation(gtkHScrollBar, &hAllocation); | - | ||||||||||||||||||||||||||||||||||||
2270 | - | |||||||||||||||||||||||||||||||||||||
2271 | GtkShadowType shadow = GTK_SHADOW_OUT; | - | ||||||||||||||||||||||||||||||||||||
2272 | GtkStateType state = GTK_STATE_NORMAL; | - | ||||||||||||||||||||||||||||||||||||
2273 | - | |||||||||||||||||||||||||||||||||||||
2274 | if (!(option->state & State_Enabled) || (fakePos == 0))
| 0 | ||||||||||||||||||||||||||||||||||||
2275 | state = GTK_STATE_INSENSITIVE; never executed: state = GTK_STATE_INSENSITIVE; | 0 | ||||||||||||||||||||||||||||||||||||
2276 | else if (option->state & State_Sunken && (scrollBar->activeSubControls & SC_ScrollBarSubLine)) {
| 0 | ||||||||||||||||||||||||||||||||||||
2277 | shadow = GTK_SHADOW_IN; | - | ||||||||||||||||||||||||||||||||||||
2278 | state = GTK_STATE_ACTIVE; | - | ||||||||||||||||||||||||||||||||||||
2279 | - | |||||||||||||||||||||||||||||||||||||
2280 | } else if (option->state & State_MouseOver && (scrollBar->activeSubControls & SC_ScrollBarSubLine)) never executed: end of block
| 0 | ||||||||||||||||||||||||||||||||||||
2281 | state = GTK_STATE_PRELIGHT; never executed: state = GTK_STATE_PRELIGHT; | 0 | ||||||||||||||||||||||||||||||||||||
2282 | - | |||||||||||||||||||||||||||||||||||||
2283 | gtkPainter->paintBox(scrollbarWidget, horizontal ? "hscrollbar" : "vscrollbar", scrollBarSubLine, | - | ||||||||||||||||||||||||||||||||||||
2284 | state, shadow, style, QLS("sub")); | - | ||||||||||||||||||||||||||||||||||||
2285 | - | |||||||||||||||||||||||||||||||||||||
2286 | gtkPainter->paintArrow(scrollbarWidget, horizontal ? "hscrollbar" : "vscrollbar", scrollBarSubLine.adjusted(4, 4, -4, -4), | - | ||||||||||||||||||||||||||||||||||||
2287 | horizontal ? (reverse ? GTK_ARROW_RIGHT : GTK_ARROW_LEFT) : | - | ||||||||||||||||||||||||||||||||||||
2288 | GTK_ARROW_UP, state, GTK_SHADOW_NONE, false, style); | - | ||||||||||||||||||||||||||||||||||||
2289 | } never executed: end of block | 0 | ||||||||||||||||||||||||||||||||||||
2290 | } never executed: end of block | 0 | ||||||||||||||||||||||||||||||||||||
2291 | break; never executed: break; | 0 | ||||||||||||||||||||||||||||||||||||
2292 | - | |||||||||||||||||||||||||||||||||||||
2293 | #endif //QT_NO_SCROLLBAR | - | ||||||||||||||||||||||||||||||||||||
2294 | #ifndef QT_NO_SPINBOX | - | ||||||||||||||||||||||||||||||||||||
2295 | - | |||||||||||||||||||||||||||||||||||||
2296 | case CC_SpinBox: never executed: case CC_SpinBox: | 0 | ||||||||||||||||||||||||||||||||||||
2297 | if (const QStyleOptionSpinBox *spinBox = qstyleoption_cast<const QStyleOptionSpinBox *>(option)) {
| 0 | ||||||||||||||||||||||||||||||||||||
2298 | - | |||||||||||||||||||||||||||||||||||||
2299 | GtkWidget *gtkSpinButton = spinBox->buttonSymbols == QAbstractSpinBox::NoButtons
| 0 | ||||||||||||||||||||||||||||||||||||
2300 | ? d->gtkWidget("GtkEntry") | - | ||||||||||||||||||||||||||||||||||||
2301 | : d->gtkWidget("GtkSpinButton"); | - | ||||||||||||||||||||||||||||||||||||
2302 | bool isEnabled = (spinBox->state & State_Enabled); | - | ||||||||||||||||||||||||||||||||||||
2303 | bool hover = isEnabled && (spinBox->state & State_MouseOver);
| 0 | ||||||||||||||||||||||||||||||||||||
2304 | bool sunken = (spinBox->state & State_Sunken); | - | ||||||||||||||||||||||||||||||||||||
2305 | bool upIsActive = (spinBox->activeSubControls == SC_SpinBoxUp); | - | ||||||||||||||||||||||||||||||||||||
2306 | bool downIsActive = (spinBox->activeSubControls == SC_SpinBoxDown); | - | ||||||||||||||||||||||||||||||||||||
2307 | bool reverse = (spinBox->direction == Qt::RightToLeft); | - | ||||||||||||||||||||||||||||||||||||
2308 | - | |||||||||||||||||||||||||||||||||||||
2309 | QRect editArea = option->rect; | - | ||||||||||||||||||||||||||||||||||||
2310 | QRect editRect = proxy()->subControlRect(CC_SpinBox, option, SC_SpinBoxEditField, widget); | - | ||||||||||||||||||||||||||||||||||||
2311 | QRect upRect, downRect, buttonRect; | - | ||||||||||||||||||||||||||||||||||||
2312 | if (spinBox->buttonSymbols != QAbstractSpinBox::NoButtons) {
| 0 | ||||||||||||||||||||||||||||||||||||
2313 | upRect = proxy()->subControlRect(CC_SpinBox, option, SC_SpinBoxUp, widget); | - | ||||||||||||||||||||||||||||||||||||
2314 | downRect = proxy()->subControlRect(CC_SpinBox, option, SC_SpinBoxDown, widget); | - | ||||||||||||||||||||||||||||||||||||
2315 | - | |||||||||||||||||||||||||||||||||||||
2316 | //### Move this to subControlRect | - | ||||||||||||||||||||||||||||||||||||
2317 | upRect.setTop(option->rect.top()); | - | ||||||||||||||||||||||||||||||||||||
2318 | - | |||||||||||||||||||||||||||||||||||||
2319 | if (reverse)
| 0 | ||||||||||||||||||||||||||||||||||||
2320 | upRect.setLeft(option->rect.left()); never executed: upRect.setLeft(option->rect.left()); | 0 | ||||||||||||||||||||||||||||||||||||
2321 | else | - | ||||||||||||||||||||||||||||||||||||
2322 | upRect.setRight(option->rect.right()); never executed: upRect.setRight(option->rect.right()); | 0 | ||||||||||||||||||||||||||||||||||||
2323 | - | |||||||||||||||||||||||||||||||||||||
2324 | downRect.setBottom(option->rect.bottom()); | - | ||||||||||||||||||||||||||||||||||||
2325 | - | |||||||||||||||||||||||||||||||||||||
2326 | if (reverse)
| 0 | ||||||||||||||||||||||||||||||||||||
2327 | downRect.setLeft(option->rect.left()); never executed: downRect.setLeft(option->rect.left()); | 0 | ||||||||||||||||||||||||||||||||||||
2328 | else | - | ||||||||||||||||||||||||||||||||||||
2329 | downRect.setRight(option->rect.right()); never executed: downRect.setRight(option->rect.right()); | 0 | ||||||||||||||||||||||||||||||||||||
2330 | - | |||||||||||||||||||||||||||||||||||||
2331 | buttonRect = upRect | downRect; | - | ||||||||||||||||||||||||||||||||||||
2332 | - | |||||||||||||||||||||||||||||||||||||
2333 | if (reverse)
| 0 | ||||||||||||||||||||||||||||||||||||
2334 | editArea.setLeft(upRect.right()); never executed: editArea.setLeft(upRect.right()); | 0 | ||||||||||||||||||||||||||||||||||||
2335 | else | - | ||||||||||||||||||||||||||||||||||||
2336 | editArea.setRight(upRect.left()); never executed: editArea.setRight(upRect.left()); | 0 | ||||||||||||||||||||||||||||||||||||
2337 | } | - | ||||||||||||||||||||||||||||||||||||
2338 | if (spinBox->frame) {
| 0 | ||||||||||||||||||||||||||||||||||||
2339 | GtkStateType state = qt_gtk_state(option); | - | ||||||||||||||||||||||||||||||||||||
2340 | - | |||||||||||||||||||||||||||||||||||||
2341 | if (!(option->state & State_Enabled))
| 0 | ||||||||||||||||||||||||||||||||||||
2342 | state = GTK_STATE_INSENSITIVE; never executed: state = GTK_STATE_INSENSITIVE; | 0 | ||||||||||||||||||||||||||||||||||||
2343 | else if (option->state & State_HasFocus)
| 0 | ||||||||||||||||||||||||||||||||||||
2344 | state = GTK_STATE_NORMAL; never executed: state = GTK_STATE_NORMAL; | 0 | ||||||||||||||||||||||||||||||||||||
2345 | else if (state == GTK_STATE_PRELIGHT)
| 0 | ||||||||||||||||||||||||||||||||||||
2346 | state = GTK_STATE_NORMAL; never executed: state = GTK_STATE_NORMAL; | 0 | ||||||||||||||||||||||||||||||||||||
2347 | - | |||||||||||||||||||||||||||||||||||||
2348 | style = d->gtk_widget_get_style(gtkSpinButton); | - | ||||||||||||||||||||||||||||||||||||
2349 | - | |||||||||||||||||||||||||||||||||||||
2350 | - | |||||||||||||||||||||||||||||||||||||
2351 | QString key; | - | ||||||||||||||||||||||||||||||||||||
2352 | - | |||||||||||||||||||||||||||||||||||||
2353 | if (option->state & State_HasFocus) {
| 0 | ||||||||||||||||||||||||||||||||||||
2354 | key += QLatin1Char('f'); | - | ||||||||||||||||||||||||||||||||||||
2355 | QGtkStylePrivate::gtkWidgetSetFocus(gtkSpinButton, true); | - | ||||||||||||||||||||||||||||||||||||
2356 | } never executed: end of block | 0 | ||||||||||||||||||||||||||||||||||||
2357 | - | |||||||||||||||||||||||||||||||||||||
2358 | uint resolve_mask = option->palette.resolve(); | - | ||||||||||||||||||||||||||||||||||||
2359 | - | |||||||||||||||||||||||||||||||||||||
2360 | if (resolve_mask & (1 << QPalette::Base)) // Palette overridden by user
| 0 | ||||||||||||||||||||||||||||||||||||
2361 | painter->fillRect(editRect, option->palette.base().color()); never executed: painter->fillRect(editRect, option->palette.base().color()); | 0 | ||||||||||||||||||||||||||||||||||||
2362 | else | - | ||||||||||||||||||||||||||||||||||||
2363 | gtkPainter->paintFlatBox(gtkSpinButton, "entry_bg", editArea.adjusted(style->xthickness, style->ythickness, never executed: gtkPainter->paintFlatBox(gtkSpinButton, "entry_bg", editArea.adjusted(style->xthickness, style->ythickness, -style->xthickness, -style->ythickness), option->state & State_Enabled ? GTK_STATE_NORMAL : GTK_STATE_INSENSITIVE, GTK_SHADOW_NONE, style, key); | 0 | ||||||||||||||||||||||||||||||||||||
2364 | -style->xthickness, -style->ythickness), never executed: gtkPainter->paintFlatBox(gtkSpinButton, "entry_bg", editArea.adjusted(style->xthickness, style->ythickness, -style->xthickness, -style->ythickness), option->state & State_Enabled ? GTK_STATE_NORMAL : GTK_STATE_INSENSITIVE, GTK_SHADOW_NONE, style, key); | 0 | ||||||||||||||||||||||||||||||||||||
2365 | option->state & State_Enabled ? never executed: gtkPainter->paintFlatBox(gtkSpinButton, "entry_bg", editArea.adjusted(style->xthickness, style->ythickness, -style->xthickness, -style->ythickness), option->state & State_Enabled ? GTK_STATE_NORMAL : GTK_STATE_INSENSITIVE, GTK_SHADOW_NONE, style, key); | 0 | ||||||||||||||||||||||||||||||||||||
2366 | GTK_STATE_NORMAL : GTK_STATE_INSENSITIVE, GTK_SHADOW_NONE, style, key); never executed: gtkPainter->paintFlatBox(gtkSpinButton, "entry_bg", editArea.adjusted(style->xthickness, style->ythickness, -style->xthickness, -style->ythickness), option->state & State_Enabled ? GTK_STATE_NORMAL : GTK_STATE_INSENSITIVE, GTK_SHADOW_NONE, style, key); | 0 | ||||||||||||||||||||||||||||||||||||
2367 | - | |||||||||||||||||||||||||||||||||||||
2368 | gtkPainter->paintShadow(gtkSpinButton, "entry", editArea, state, GTK_SHADOW_IN, d->gtk_widget_get_style(gtkSpinButton), key); | - | ||||||||||||||||||||||||||||||||||||
2369 | if (spinBox->buttonSymbols != QAbstractSpinBox::NoButtons) {
| 0 | ||||||||||||||||||||||||||||||||||||
2370 | gtkPainter->paintBox(gtkSpinButton, "spinbutton", buttonRect, state, GTK_SHADOW_IN, style, key); | - | ||||||||||||||||||||||||||||||||||||
2371 | - | |||||||||||||||||||||||||||||||||||||
2372 | upRect.setSize(downRect.size()); | - | ||||||||||||||||||||||||||||||||||||
2373 | if (!(option->state & State_Enabled))
| 0 | ||||||||||||||||||||||||||||||||||||
2374 | gtkPainter->paintBox(gtkSpinButton, "spinbutton_up", upRect, GTK_STATE_INSENSITIVE, GTK_SHADOW_IN, style, key); never executed: gtkPainter->paintBox(gtkSpinButton, "spinbutton_up", upRect, GTK_STATE_INSENSITIVE, GTK_SHADOW_IN, style, key); | 0 | ||||||||||||||||||||||||||||||||||||
2375 | else if (upIsActive && sunken)
| 0 | ||||||||||||||||||||||||||||||||||||
2376 | gtkPainter->paintBox(gtkSpinButton, "spinbutton_up", upRect, GTK_STATE_ACTIVE, GTK_SHADOW_IN, style, key); never executed: gtkPainter->paintBox(gtkSpinButton, "spinbutton_up", upRect, GTK_STATE_ACTIVE, GTK_SHADOW_IN, style, key); | 0 | ||||||||||||||||||||||||||||||||||||
2377 | else if (upIsActive && hover)
| 0 | ||||||||||||||||||||||||||||||||||||
2378 | gtkPainter->paintBox(gtkSpinButton, "spinbutton_up", upRect, GTK_STATE_PRELIGHT, GTK_SHADOW_OUT, style, key); never executed: gtkPainter->paintBox(gtkSpinButton, "spinbutton_up", upRect, GTK_STATE_PRELIGHT, GTK_SHADOW_OUT, style, key); | 0 | ||||||||||||||||||||||||||||||||||||
2379 | else | - | ||||||||||||||||||||||||||||||||||||
2380 | gtkPainter->paintBox(gtkSpinButton, "spinbutton_up", upRect, GTK_STATE_NORMAL, GTK_SHADOW_OUT, style, key); never executed: gtkPainter->paintBox(gtkSpinButton, "spinbutton_up", upRect, GTK_STATE_NORMAL, GTK_SHADOW_OUT, style, key); | 0 | ||||||||||||||||||||||||||||||||||||
2381 | - | |||||||||||||||||||||||||||||||||||||
2382 | if (!(option->state & State_Enabled))
| 0 | ||||||||||||||||||||||||||||||||||||
2383 | gtkPainter->paintBox(gtkSpinButton, "spinbutton_down", downRect, GTK_STATE_INSENSITIVE, GTK_SHADOW_IN, style, key); never executed: gtkPainter->paintBox(gtkSpinButton, "spinbutton_down", downRect, GTK_STATE_INSENSITIVE, GTK_SHADOW_IN, style, key); | 0 | ||||||||||||||||||||||||||||||||||||
2384 | else if (downIsActive && sunken)
| 0 | ||||||||||||||||||||||||||||||||||||
2385 | gtkPainter->paintBox(gtkSpinButton, "spinbutton_down", downRect, GTK_STATE_ACTIVE, GTK_SHADOW_IN, style, key); never executed: gtkPainter->paintBox(gtkSpinButton, "spinbutton_down", downRect, GTK_STATE_ACTIVE, GTK_SHADOW_IN, style, key); | 0 | ||||||||||||||||||||||||||||||||||||
2386 | else if (downIsActive && hover)
| 0 | ||||||||||||||||||||||||||||||||||||
2387 | gtkPainter->paintBox(gtkSpinButton, "spinbutton_down", downRect, GTK_STATE_PRELIGHT, GTK_SHADOW_OUT, style, key); never executed: gtkPainter->paintBox(gtkSpinButton, "spinbutton_down", downRect, GTK_STATE_PRELIGHT, GTK_SHADOW_OUT, style, key); | 0 | ||||||||||||||||||||||||||||||||||||
2388 | else | - | ||||||||||||||||||||||||||||||||||||
2389 | gtkPainter->paintBox(gtkSpinButton, "spinbutton_down", downRect, GTK_STATE_NORMAL, GTK_SHADOW_OUT, style, key); never executed: gtkPainter->paintBox(gtkSpinButton, "spinbutton_down", downRect, GTK_STATE_NORMAL, GTK_SHADOW_OUT, style, key); | 0 | ||||||||||||||||||||||||||||||||||||
2390 | - | |||||||||||||||||||||||||||||||||||||
2391 | if (option->state & State_HasFocus)
| 0 | ||||||||||||||||||||||||||||||||||||
2392 | QGtkStylePrivate::gtkWidgetSetFocus(gtkSpinButton, false); never executed: QGtkStylePrivate::gtkWidgetSetFocus(gtkSpinButton, false); | 0 | ||||||||||||||||||||||||||||||||||||
2393 | } never executed: end of block | 0 | ||||||||||||||||||||||||||||||||||||
2394 | } never executed: end of block | 0 | ||||||||||||||||||||||||||||||||||||
2395 | - | |||||||||||||||||||||||||||||||||||||
2396 | if (spinBox->buttonSymbols == QAbstractSpinBox::PlusMinus) {
| 0 | ||||||||||||||||||||||||||||||||||||
2397 | int centerX = upRect.center().x(); | - | ||||||||||||||||||||||||||||||||||||
2398 | int centerY = upRect.center().y(); | - | ||||||||||||||||||||||||||||||||||||
2399 | // plus/minus | - | ||||||||||||||||||||||||||||||||||||
2400 | - | |||||||||||||||||||||||||||||||||||||
2401 | if (spinBox->activeSubControls == SC_SpinBoxUp && sunken) {
| 0 | ||||||||||||||||||||||||||||||||||||
2402 | painter->drawLine(1 + centerX - 2, 1 + centerY, 1 + centerX + 2, 1 + centerY); | - | ||||||||||||||||||||||||||||||||||||
2403 | painter->drawLine(1 + centerX, 1 + centerY - 2, 1 + centerX, 1 + centerY + 2); | - | ||||||||||||||||||||||||||||||||||||
2404 | - | |||||||||||||||||||||||||||||||||||||
2405 | } else { never executed: end of block | 0 | ||||||||||||||||||||||||||||||||||||
2406 | painter->drawLine(centerX - 2, centerY, centerX + 2, centerY); | - | ||||||||||||||||||||||||||||||||||||
2407 | painter->drawLine(centerX, centerY - 2, centerX, centerY + 2); | - | ||||||||||||||||||||||||||||||||||||
2408 | } never executed: end of block | 0 | ||||||||||||||||||||||||||||||||||||
2409 | centerX = downRect.center().x(); | - | ||||||||||||||||||||||||||||||||||||
2410 | centerY = downRect.center().y(); | - | ||||||||||||||||||||||||||||||||||||
2411 | - | |||||||||||||||||||||||||||||||||||||
2412 | if (spinBox->activeSubControls == SC_SpinBoxDown && sunken) {
| 0 | ||||||||||||||||||||||||||||||||||||
2413 | painter->drawLine(1 + centerX - 2, 1 + centerY, 1 + centerX + 2, 1 + centerY); | - | ||||||||||||||||||||||||||||||||||||
2414 | } else { never executed: end of block | 0 | ||||||||||||||||||||||||||||||||||||
2415 | painter->drawLine(centerX - 2, centerY, centerX + 2, centerY); | - | ||||||||||||||||||||||||||||||||||||
2416 | } never executed: end of block | 0 | ||||||||||||||||||||||||||||||||||||
2417 | - | |||||||||||||||||||||||||||||||||||||
2418 | } else if (spinBox->buttonSymbols == QAbstractSpinBox::UpDownArrows) {
| 0 | ||||||||||||||||||||||||||||||||||||
2419 | int size = d->getSpinboxArrowSize(); | - | ||||||||||||||||||||||||||||||||||||
2420 | int w = size / 2 - 1; | - | ||||||||||||||||||||||||||||||||||||
2421 | w -= w % 2 - 1; // force odd | - | ||||||||||||||||||||||||||||||||||||
2422 | int h = (w + 1)/2; | - | ||||||||||||||||||||||||||||||||||||
2423 | QRect arrowRect(0, 0, w, h); | - | ||||||||||||||||||||||||||||||||||||
2424 | arrowRect.moveCenter(upRect.center()); | - | ||||||||||||||||||||||||||||||||||||
2425 | // arrows | - | ||||||||||||||||||||||||||||||||||||
2426 | GtkStateType state = GTK_STATE_NORMAL; | - | ||||||||||||||||||||||||||||||||||||
2427 | - | |||||||||||||||||||||||||||||||||||||
2428 | if (!(option->state & State_Enabled) || !(spinBox->stepEnabled & QAbstractSpinBox::StepUpEnabled))
| 0 | ||||||||||||||||||||||||||||||||||||
2429 | state = GTK_STATE_INSENSITIVE; never executed: state = GTK_STATE_INSENSITIVE; | 0 | ||||||||||||||||||||||||||||||||||||
2430 | - | |||||||||||||||||||||||||||||||||||||
2431 | gtkPainter->paintArrow(gtkSpinButton, "spinbutton", arrowRect, GTK_ARROW_UP, state, | - | ||||||||||||||||||||||||||||||||||||
2432 | GTK_SHADOW_NONE, false, style); | - | ||||||||||||||||||||||||||||||||||||
2433 | - | |||||||||||||||||||||||||||||||||||||
2434 | arrowRect.moveCenter(downRect.center()); | - | ||||||||||||||||||||||||||||||||||||
2435 | - | |||||||||||||||||||||||||||||||||||||
2436 | if (!(option->state & State_Enabled) || !(spinBox->stepEnabled & QAbstractSpinBox::StepDownEnabled))
| 0 | ||||||||||||||||||||||||||||||||||||
2437 | state = GTK_STATE_INSENSITIVE; never executed: state = GTK_STATE_INSENSITIVE; | 0 | ||||||||||||||||||||||||||||||||||||
2438 | - | |||||||||||||||||||||||||||||||||||||
2439 | gtkPainter->paintArrow(gtkSpinButton, "spinbutton", arrowRect, GTK_ARROW_DOWN, state, | - | ||||||||||||||||||||||||||||||||||||
2440 | GTK_SHADOW_NONE, false, style); | - | ||||||||||||||||||||||||||||||||||||
2441 | } never executed: end of block | 0 | ||||||||||||||||||||||||||||||||||||
2442 | } never executed: end of block | 0 | ||||||||||||||||||||||||||||||||||||
2443 | break; never executed: break; | 0 | ||||||||||||||||||||||||||||||||||||
2444 | - | |||||||||||||||||||||||||||||||||||||
2445 | #endif // QT_NO_SPINBOX | - | ||||||||||||||||||||||||||||||||||||
2446 | - | |||||||||||||||||||||||||||||||||||||
2447 | #ifndef QT_NO_SLIDER | - | ||||||||||||||||||||||||||||||||||||
2448 | - | |||||||||||||||||||||||||||||||||||||
2449 | case CC_Slider: never executed: case CC_Slider: | 0 | ||||||||||||||||||||||||||||||||||||
2450 | if (const QStyleOptionSlider *slider = qstyleoption_cast<const QStyleOptionSlider *>(option)) {
| 0 | ||||||||||||||||||||||||||||||||||||
2451 | GtkWidget *hScaleWidget = d->gtkWidget("GtkHScale"); | - | ||||||||||||||||||||||||||||||||||||
2452 | GtkWidget *vScaleWidget = d->gtkWidget("GtkVScale"); | - | ||||||||||||||||||||||||||||||||||||
2453 | - | |||||||||||||||||||||||||||||||||||||
2454 | QRect groove = proxy()->subControlRect(CC_Slider, option, SC_SliderGroove, widget); | - | ||||||||||||||||||||||||||||||||||||
2455 | QRect handle = proxy()->subControlRect(CC_Slider, option, SC_SliderHandle, widget); | - | ||||||||||||||||||||||||||||||||||||
2456 | - | |||||||||||||||||||||||||||||||||||||
2457 | bool horizontal = slider->orientation == Qt::Horizontal; | - | ||||||||||||||||||||||||||||||||||||
2458 | bool ticksAbove = slider->tickPosition & QSlider::TicksAbove; | - | ||||||||||||||||||||||||||||||||||||
2459 | bool ticksBelow = slider->tickPosition & QSlider::TicksBelow; | - | ||||||||||||||||||||||||||||||||||||
2460 | - | |||||||||||||||||||||||||||||||||||||
2461 | QBrush oldBrush = painter->brush(); | - | ||||||||||||||||||||||||||||||||||||
2462 | QPen oldPen = painter->pen(); | - | ||||||||||||||||||||||||||||||||||||
2463 | - | |||||||||||||||||||||||||||||||||||||
2464 | QColor shadowAlpha(Qt::black); | - | ||||||||||||||||||||||||||||||||||||
2465 | shadowAlpha.setAlpha(10); | - | ||||||||||||||||||||||||||||||||||||
2466 | QColor highlightAlpha(Qt::white); | - | ||||||||||||||||||||||||||||||||||||
2467 | highlightAlpha.setAlpha(80); | - | ||||||||||||||||||||||||||||||||||||
2468 | - | |||||||||||||||||||||||||||||||||||||
2469 | QGtkStylePrivate::gtk_widget_set_direction(hScaleWidget, slider->upsideDown ? | - | ||||||||||||||||||||||||||||||||||||
2470 | GTK_TEXT_DIR_RTL : GTK_TEXT_DIR_LTR); | - | ||||||||||||||||||||||||||||||||||||
2471 | GtkWidget *scaleWidget = horizontal ? hScaleWidget : vScaleWidget;
| 0 | ||||||||||||||||||||||||||||||||||||
2472 | style = d->gtk_widget_get_style(scaleWidget); | - | ||||||||||||||||||||||||||||||||||||
2473 | - | |||||||||||||||||||||||||||||||||||||
2474 | if ((option->subControls & SC_SliderGroove) && groove.isValid()) {
| 0 | ||||||||||||||||||||||||||||||||||||
2475 | - | |||||||||||||||||||||||||||||||||||||
2476 | GtkRange *range = (GtkRange*)scaleWidget; | - | ||||||||||||||||||||||||||||||||||||
2477 | GtkAdjustment *adjustment = 0; | - | ||||||||||||||||||||||||||||||||||||
2478 | if (d->gtk_adjustment_configure)
| 0 | ||||||||||||||||||||||||||||||||||||
2479 | adjustment = d->gtk_range_get_adjustment(range); never executed: adjustment = d->gtk_range_get_adjustment(range); | 0 | ||||||||||||||||||||||||||||||||||||
2480 | if (adjustment) {
| 0 | ||||||||||||||||||||||||||||||||||||
2481 | d->gtk_adjustment_configure(adjustment, | - | ||||||||||||||||||||||||||||||||||||
2482 | slider->sliderPosition, | - | ||||||||||||||||||||||||||||||||||||
2483 | slider->minimum, | - | ||||||||||||||||||||||||||||||||||||
2484 | slider->maximum, | - | ||||||||||||||||||||||||||||||||||||
2485 | slider->singleStep, | - | ||||||||||||||||||||||||||||||||||||
2486 | slider->singleStep, | - | ||||||||||||||||||||||||||||||||||||
2487 | slider->pageStep); | - | ||||||||||||||||||||||||||||||||||||
2488 | } else { never executed: end of block | 0 | ||||||||||||||||||||||||||||||||||||
2489 | adjustment = (GtkAdjustment*)d->gtk_adjustment_new(slider->sliderPosition, | - | ||||||||||||||||||||||||||||||||||||
2490 | slider->minimum, | - | ||||||||||||||||||||||||||||||||||||
2491 | slider->maximum, | - | ||||||||||||||||||||||||||||||||||||
2492 | slider->singleStep, | - | ||||||||||||||||||||||||||||||||||||
2493 | slider->singleStep, | - | ||||||||||||||||||||||||||||||||||||
2494 | slider->pageStep); | - | ||||||||||||||||||||||||||||||||||||
2495 | d->gtk_range_set_adjustment(range, adjustment); | - | ||||||||||||||||||||||||||||||||||||
2496 | } never executed: end of block | 0 | ||||||||||||||||||||||||||||||||||||
2497 | - | |||||||||||||||||||||||||||||||||||||
2498 | int outerSize; | - | ||||||||||||||||||||||||||||||||||||
2499 | d->gtk_range_set_inverted(range, !horizontal); | - | ||||||||||||||||||||||||||||||||||||
2500 | d->gtk_widget_style_get(scaleWidget, "trough-border", &outerSize, NULL); | - | ||||||||||||||||||||||||||||||||||||
2501 | outerSize++; | - | ||||||||||||||||||||||||||||||||||||
2502 | - | |||||||||||||||||||||||||||||||||||||
2503 | GtkStateType state = qt_gtk_state(option); | - | ||||||||||||||||||||||||||||||||||||
2504 | int focusFrameMargin = 2; | - | ||||||||||||||||||||||||||||||||||||
2505 | QRect grooveRect = option->rect.adjusted(focusFrameMargin, outerSize + focusFrameMargin, | - | ||||||||||||||||||||||||||||||||||||
2506 | -focusFrameMargin, -outerSize - focusFrameMargin); | - | ||||||||||||||||||||||||||||||||||||
2507 | - | |||||||||||||||||||||||||||||||||||||
2508 | gboolean trough_side_details = false; // Indicates if the upper or lower scale background differs | - | ||||||||||||||||||||||||||||||||||||
2509 | if (!d->gtk_check_version(2, 10, 0))
| 0 | ||||||||||||||||||||||||||||||||||||
2510 | d->gtk_widget_style_get((GtkWidget*)(scaleWidget), "trough-side-details", &trough_side_details, NULL); never executed: d->gtk_widget_style_get((GtkWidget*)(scaleWidget), "trough-side-details", &trough_side_details, __null); | 0 | ||||||||||||||||||||||||||||||||||||
2511 | - | |||||||||||||||||||||||||||||||||||||
2512 | if (!trough_side_details) {
| 0 | ||||||||||||||||||||||||||||||||||||
2513 | gtkPainter->paintBox(scaleWidget, "trough", grooveRect, state, | - | ||||||||||||||||||||||||||||||||||||
2514 | GTK_SHADOW_IN, style, QString(QLS("p%0")).arg(slider->sliderPosition)); | - | ||||||||||||||||||||||||||||||||||||
2515 | } else { never executed: end of block | 0 | ||||||||||||||||||||||||||||||||||||
2516 | QRect upperGroove = grooveRect; | - | ||||||||||||||||||||||||||||||||||||
2517 | QRect lowerGroove = grooveRect; | - | ||||||||||||||||||||||||||||||||||||
2518 | - | |||||||||||||||||||||||||||||||||||||
2519 | if (horizontal) {
| 0 | ||||||||||||||||||||||||||||||||||||
2520 | if (slider->upsideDown) {
| 0 | ||||||||||||||||||||||||||||||||||||
2521 | lowerGroove.setLeft(handle.center().x()); | - | ||||||||||||||||||||||||||||||||||||
2522 | upperGroove.setRight(handle.center().x()); | - | ||||||||||||||||||||||||||||||||||||
2523 | } else { never executed: end of block | 0 | ||||||||||||||||||||||||||||||||||||
2524 | upperGroove.setLeft(handle.center().x()); | - | ||||||||||||||||||||||||||||||||||||
2525 | lowerGroove.setRight(handle.center().x()); | - | ||||||||||||||||||||||||||||||||||||
2526 | } never executed: end of block | 0 | ||||||||||||||||||||||||||||||||||||
2527 | } else { | - | ||||||||||||||||||||||||||||||||||||
2528 | if (!slider->upsideDown) {
| 0 | ||||||||||||||||||||||||||||||||||||
2529 | lowerGroove.setBottom(handle.center().y()); | - | ||||||||||||||||||||||||||||||||||||
2530 | upperGroove.setTop(handle.center().y()); | - | ||||||||||||||||||||||||||||||||||||
2531 | } else { never executed: end of block | 0 | ||||||||||||||||||||||||||||||||||||
2532 | upperGroove.setBottom(handle.center().y()); | - | ||||||||||||||||||||||||||||||||||||
2533 | lowerGroove.setTop(handle.center().y()); | - | ||||||||||||||||||||||||||||||||||||
2534 | } never executed: end of block | 0 | ||||||||||||||||||||||||||||||||||||
2535 | } | - | ||||||||||||||||||||||||||||||||||||
2536 | - | |||||||||||||||||||||||||||||||||||||
2537 | gtkPainter->paintBox(scaleWidget, "trough-upper", upperGroove, state, | - | ||||||||||||||||||||||||||||||||||||
2538 | GTK_SHADOW_IN, style, QString(QLS("p%0")).arg(slider->sliderPosition)); | - | ||||||||||||||||||||||||||||||||||||
2539 | gtkPainter->paintBox(scaleWidget, "trough-lower", lowerGroove, state, | - | ||||||||||||||||||||||||||||||||||||
2540 | GTK_SHADOW_IN, style, QString(QLS("p%0")).arg(slider->sliderPosition)); | - | ||||||||||||||||||||||||||||||||||||
2541 | } never executed: end of block | 0 | ||||||||||||||||||||||||||||||||||||
2542 | } | - | ||||||||||||||||||||||||||||||||||||
2543 | - | |||||||||||||||||||||||||||||||||||||
2544 | if (option->subControls & SC_SliderTickmarks) {
| 0 | ||||||||||||||||||||||||||||||||||||
2545 | painter->setPen(darkOutline); | - | ||||||||||||||||||||||||||||||||||||
2546 | int tickSize = proxy()->pixelMetric(PM_SliderTickmarkOffset, option, widget); | - | ||||||||||||||||||||||||||||||||||||
2547 | int available = proxy()->pixelMetric(PM_SliderSpaceAvailable, slider, widget); | - | ||||||||||||||||||||||||||||||||||||
2548 | int interval = slider->tickInterval; | - | ||||||||||||||||||||||||||||||||||||
2549 | - | |||||||||||||||||||||||||||||||||||||
2550 | if (interval <= 0) {
| 0 | ||||||||||||||||||||||||||||||||||||
2551 | interval = slider->singleStep; | - | ||||||||||||||||||||||||||||||||||||
2552 | - | |||||||||||||||||||||||||||||||||||||
2553 | if (QStyle::sliderPositionFromValue(slider->minimum, slider->maximum, interval,
| 0 | ||||||||||||||||||||||||||||||||||||
2554 | available)
| 0 | ||||||||||||||||||||||||||||||||||||
2555 | - QStyle::sliderPositionFromValue(slider->minimum, slider->maximum,
| 0 | ||||||||||||||||||||||||||||||||||||
2556 | 0, available) < 3)
| 0 | ||||||||||||||||||||||||||||||||||||
2557 | interval = slider->pageStep; never executed: interval = slider->pageStep; | 0 | ||||||||||||||||||||||||||||||||||||
2558 | } never executed: end of block | 0 | ||||||||||||||||||||||||||||||||||||
2559 | - | |||||||||||||||||||||||||||||||||||||
2560 | if (interval <= 0)
| 0 | ||||||||||||||||||||||||||||||||||||
2561 | interval = 1; never executed: interval = 1; | 0 | ||||||||||||||||||||||||||||||||||||
2562 | - | |||||||||||||||||||||||||||||||||||||
2563 | int v = slider->minimum; | - | ||||||||||||||||||||||||||||||||||||
2564 | int len = proxy()->pixelMetric(PM_SliderLength, slider, widget); | - | ||||||||||||||||||||||||||||||||||||
2565 | while (v <= slider->maximum + 1) {
| 0 | ||||||||||||||||||||||||||||||||||||
2566 | if (v == slider->maximum + 1 && interval == 1)
| 0 | ||||||||||||||||||||||||||||||||||||
2567 | break; never executed: break; | 0 | ||||||||||||||||||||||||||||||||||||
2568 | const int v_ = qMin(v, slider->maximum); | - | ||||||||||||||||||||||||||||||||||||
2569 | int pos = sliderPositionFromValue(slider->minimum, slider->maximum, | - | ||||||||||||||||||||||||||||||||||||
2570 | v_, (horizontal | - | ||||||||||||||||||||||||||||||||||||
2571 | ? slider->rect.width() | - | ||||||||||||||||||||||||||||||||||||
2572 | : slider->rect.height()) - len, | - | ||||||||||||||||||||||||||||||||||||
2573 | slider->upsideDown) + len / 2; | - | ||||||||||||||||||||||||||||||||||||
2574 | int extra = 2 - ((v_ == slider->minimum || v_ == slider->maximum) ? 1 : 0);
| 0 | ||||||||||||||||||||||||||||||||||||
2575 | if (horizontal) {
| 0 | ||||||||||||||||||||||||||||||||||||
2576 | if (ticksAbove)
| 0 | ||||||||||||||||||||||||||||||||||||
2577 | painter->drawLine(pos, slider->rect.top() + extra, never executed: painter->drawLine(pos, slider->rect.top() + extra, pos, slider->rect.top() + tickSize); | 0 | ||||||||||||||||||||||||||||||||||||
2578 | pos, slider->rect.top() + tickSize); never executed: painter->drawLine(pos, slider->rect.top() + extra, pos, slider->rect.top() + tickSize); | 0 | ||||||||||||||||||||||||||||||||||||
2579 | if (ticksBelow)
| 0 | ||||||||||||||||||||||||||||||||||||
2580 | painter->drawLine(pos, slider->rect.bottom() - extra, never executed: painter->drawLine(pos, slider->rect.bottom() - extra, pos, slider->rect.bottom() - tickSize); | 0 | ||||||||||||||||||||||||||||||||||||
2581 | pos, slider->rect.bottom() - tickSize); never executed: painter->drawLine(pos, slider->rect.bottom() - extra, pos, slider->rect.bottom() - tickSize); | 0 | ||||||||||||||||||||||||||||||||||||
2582 | - | |||||||||||||||||||||||||||||||||||||
2583 | } else { never executed: end of block | 0 | ||||||||||||||||||||||||||||||||||||
2584 | if (ticksAbove)
| 0 | ||||||||||||||||||||||||||||||||||||
2585 | painter->drawLine(slider->rect.left() + extra, pos, never executed: painter->drawLine(slider->rect.left() + extra, pos, slider->rect.left() + tickSize, pos); | 0 | ||||||||||||||||||||||||||||||||||||
2586 | slider->rect.left() + tickSize, pos); never executed: painter->drawLine(slider->rect.left() + extra, pos, slider->rect.left() + tickSize, pos); | 0 | ||||||||||||||||||||||||||||||||||||
2587 | if (ticksBelow)
| 0 | ||||||||||||||||||||||||||||||||||||
2588 | painter->drawLine(slider->rect.right() - extra, pos, never executed: painter->drawLine(slider->rect.right() - extra, pos, slider->rect.right() - tickSize, pos); | 0 | ||||||||||||||||||||||||||||||||||||
2589 | slider->rect.right() - tickSize, pos); never executed: painter->drawLine(slider->rect.right() - extra, pos, slider->rect.right() - tickSize, pos); | 0 | ||||||||||||||||||||||||||||||||||||
2590 | } never executed: end of block | 0 | ||||||||||||||||||||||||||||||||||||
2591 | - | |||||||||||||||||||||||||||||||||||||
2592 | // In the case where maximum is max int | - | ||||||||||||||||||||||||||||||||||||
2593 | int nextInterval = v + interval; | - | ||||||||||||||||||||||||||||||||||||
2594 | if (nextInterval < v)
| 0 | ||||||||||||||||||||||||||||||||||||
2595 | break; never executed: break; | 0 | ||||||||||||||||||||||||||||||||||||
2596 | v = nextInterval; | - | ||||||||||||||||||||||||||||||||||||
2597 | } never executed: end of block | 0 | ||||||||||||||||||||||||||||||||||||
2598 | } never executed: end of block | 0 | ||||||||||||||||||||||||||||||||||||
2599 | - | |||||||||||||||||||||||||||||||||||||
2600 | // Draw slider handle | - | ||||||||||||||||||||||||||||||||||||
2601 | if (option->subControls & SC_SliderHandle) {
| 0 | ||||||||||||||||||||||||||||||||||||
2602 | GtkShadowType shadow = GTK_SHADOW_OUT; | - | ||||||||||||||||||||||||||||||||||||
2603 | GtkStateType state = GTK_STATE_NORMAL; | - | ||||||||||||||||||||||||||||||||||||
2604 | - | |||||||||||||||||||||||||||||||||||||
2605 | if (!(option->state & State_Enabled))
| 0 | ||||||||||||||||||||||||||||||||||||
2606 | state = GTK_STATE_INSENSITIVE; never executed: state = GTK_STATE_INSENSITIVE; | 0 | ||||||||||||||||||||||||||||||||||||
2607 | else if (option->state & State_MouseOver && option->activeSubControls & SC_SliderHandle)
| 0 | ||||||||||||||||||||||||||||||||||||
2608 | state = GTK_STATE_PRELIGHT; never executed: state = GTK_STATE_PRELIGHT; | 0 | ||||||||||||||||||||||||||||||||||||
2609 | - | |||||||||||||||||||||||||||||||||||||
2610 | bool horizontal = option->state & State_Horizontal; | - | ||||||||||||||||||||||||||||||||||||
2611 | - | |||||||||||||||||||||||||||||||||||||
2612 | if (slider->state & State_HasFocus) {
| 0 | ||||||||||||||||||||||||||||||||||||
2613 | QStyleOptionFocusRect fropt; | - | ||||||||||||||||||||||||||||||||||||
2614 | fropt.QStyleOption::operator=(*slider); | - | ||||||||||||||||||||||||||||||||||||
2615 | fropt.rect = slider->rect.adjusted(-1, -1 ,1, 1); | - | ||||||||||||||||||||||||||||||||||||
2616 | - | |||||||||||||||||||||||||||||||||||||
2617 | if (horizontal) {
| 0 | ||||||||||||||||||||||||||||||||||||
2618 | fropt.rect.setTop(handle.top() - 3); | - | ||||||||||||||||||||||||||||||||||||
2619 | fropt.rect.setBottom(handle.bottom() + 4); | - | ||||||||||||||||||||||||||||||||||||
2620 | - | |||||||||||||||||||||||||||||||||||||
2621 | } else { never executed: end of block | 0 | ||||||||||||||||||||||||||||||||||||
2622 | fropt.rect.setLeft(handle.left() - 3); | - | ||||||||||||||||||||||||||||||||||||
2623 | fropt.rect.setRight(handle.right() + 3); | - | ||||||||||||||||||||||||||||||||||||
2624 | } never executed: end of block | 0 | ||||||||||||||||||||||||||||||||||||
2625 | proxy()->drawPrimitive(PE_FrameFocusRect, &fropt, painter, widget); | - | ||||||||||||||||||||||||||||||||||||
2626 | } never executed: end of block | 0 | ||||||||||||||||||||||||||||||||||||
2627 | gtkPainter->paintSlider(scaleWidget, horizontal ? "hscale" : "vscale", handle, state, shadow, style, | - | ||||||||||||||||||||||||||||||||||||
2628 | horizontal ? GTK_ORIENTATION_HORIZONTAL : GTK_ORIENTATION_VERTICAL); | - | ||||||||||||||||||||||||||||||||||||
2629 | } never executed: end of block | 0 | ||||||||||||||||||||||||||||||||||||
2630 | painter->setBrush(oldBrush); | - | ||||||||||||||||||||||||||||||||||||
2631 | painter->setPen(oldPen); | - | ||||||||||||||||||||||||||||||||||||
2632 | } never executed: end of block | 0 | ||||||||||||||||||||||||||||||||||||
2633 | break; never executed: break; | 0 | ||||||||||||||||||||||||||||||||||||
2634 | case CC_Dial: never executed: case CC_Dial: | 0 | ||||||||||||||||||||||||||||||||||||
2635 | if (const QStyleOptionSlider *dial = qstyleoption_cast<const QStyleOptionSlider *>(option))
| 0 | ||||||||||||||||||||||||||||||||||||
2636 | QStyleHelper::drawDial(dial, painter); never executed: QStyleHelper::drawDial(dial, painter); | 0 | ||||||||||||||||||||||||||||||||||||
2637 | break; never executed: break; | 0 | ||||||||||||||||||||||||||||||||||||
2638 | - | |||||||||||||||||||||||||||||||||||||
2639 | #endif // QT_NO_SLIDER | - | ||||||||||||||||||||||||||||||||||||
2640 | - | |||||||||||||||||||||||||||||||||||||
2641 | default: never executed: default: | 0 | ||||||||||||||||||||||||||||||||||||
2642 | QCommonStyle::drawComplexControl(control, option, painter, widget); | - | ||||||||||||||||||||||||||||||||||||
2643 | - | |||||||||||||||||||||||||||||||||||||
2644 | break; never executed: break; | 0 | ||||||||||||||||||||||||||||||||||||
2645 | } | - | ||||||||||||||||||||||||||||||||||||
2646 | } | - | ||||||||||||||||||||||||||||||||||||
2647 | - | |||||||||||||||||||||||||||||||||||||
2648 | - | |||||||||||||||||||||||||||||||||||||
2649 | /*! | - | ||||||||||||||||||||||||||||||||||||
2650 | \reimp | - | ||||||||||||||||||||||||||||||||||||
2651 | */ | - | ||||||||||||||||||||||||||||||||||||
2652 | void QGtkStyle::drawControl(ControlElement element, | - | ||||||||||||||||||||||||||||||||||||
2653 | const QStyleOption *option, | - | ||||||||||||||||||||||||||||||||||||
2654 | QPainter *painter, | - | ||||||||||||||||||||||||||||||||||||
2655 | const QWidget *widget) const | - | ||||||||||||||||||||||||||||||||||||
2656 | { | - | ||||||||||||||||||||||||||||||||||||
2657 | Q_D(const QGtkStyle); | - | ||||||||||||||||||||||||||||||||||||
2658 | - | |||||||||||||||||||||||||||||||||||||
2659 | if (!d->isThemeAvailable()) {
| 0 | ||||||||||||||||||||||||||||||||||||
2660 | QCommonStyle::drawControl(element, option, painter, widget); | - | ||||||||||||||||||||||||||||||||||||
2661 | return; never executed: return; | 0 | ||||||||||||||||||||||||||||||||||||
2662 | } | - | ||||||||||||||||||||||||||||||||||||
2663 | - | |||||||||||||||||||||||||||||||||||||
2664 | GtkStyle* style = d->gtkStyle(); | - | ||||||||||||||||||||||||||||||||||||
2665 | QGtkPainter* gtkPainter = d->gtkPainter(painter); | - | ||||||||||||||||||||||||||||||||||||
2666 | - | |||||||||||||||||||||||||||||||||||||
2667 | switch (element) { | - | ||||||||||||||||||||||||||||||||||||
2668 | case CE_ProgressBarLabel: never executed: case CE_ProgressBarLabel: | 0 | ||||||||||||||||||||||||||||||||||||
2669 | if (const QStyleOptionProgressBar *bar = qstyleoption_cast<const QStyleOptionProgressBar *>(option)) {
| 0 | ||||||||||||||||||||||||||||||||||||
2670 | GtkWidget *gtkProgressBar = d->gtkWidget("GtkProgressBar"); | - | ||||||||||||||||||||||||||||||||||||
2671 | if (!gtkProgressBar)
| 0 | ||||||||||||||||||||||||||||||||||||
2672 | return; never executed: return; | 0 | ||||||||||||||||||||||||||||||||||||
2673 | - | |||||||||||||||||||||||||||||||||||||
2674 | QRect leftRect; | - | ||||||||||||||||||||||||||||||||||||
2675 | QRect rect = bar->rect; | - | ||||||||||||||||||||||||||||||||||||
2676 | GtkStyle *gtkProgressBarStyle = d->gtk_widget_get_style(gtkProgressBar); | - | ||||||||||||||||||||||||||||||||||||
2677 | GdkColor gdkText = gtkProgressBarStyle->fg[GTK_STATE_NORMAL]; | - | ||||||||||||||||||||||||||||||||||||
2678 | QColor textColor = QColor(gdkText.red>>8, gdkText.green>>8, gdkText.blue>>8); | - | ||||||||||||||||||||||||||||||||||||
2679 | gdkText = gtkProgressBarStyle->fg[GTK_STATE_PRELIGHT]; | - | ||||||||||||||||||||||||||||||||||||
2680 | QColor alternateTextColor= QColor(gdkText.red>>8, gdkText.green>>8, gdkText.blue>>8); | - | ||||||||||||||||||||||||||||||||||||
2681 | - | |||||||||||||||||||||||||||||||||||||
2682 | painter->save(); | - | ||||||||||||||||||||||||||||||||||||
2683 | bool vertical = false, inverted = false; | - | ||||||||||||||||||||||||||||||||||||
2684 | if (const QStyleOptionProgressBarV2 *bar2 = qstyleoption_cast<const QStyleOptionProgressBarV2 *>(option)) {
| 0 | ||||||||||||||||||||||||||||||||||||
2685 | vertical = (bar2->orientation == Qt::Vertical); | - | ||||||||||||||||||||||||||||||||||||
2686 | inverted = bar2->invertedAppearance; | - | ||||||||||||||||||||||||||||||||||||
2687 | } never executed: end of block | 0 | ||||||||||||||||||||||||||||||||||||
2688 | if (vertical)
| 0 | ||||||||||||||||||||||||||||||||||||
2689 | rect = QRect(rect.left(), rect.top(), rect.height(), rect.width()); // flip width and height never executed: rect = QRect(rect.left(), rect.top(), rect.height(), rect.width()); | 0 | ||||||||||||||||||||||||||||||||||||
2690 | const int progressIndicatorPos = (bar->progress - qreal(bar->minimum)) * rect.width() / | - | ||||||||||||||||||||||||||||||||||||
2691 | qMax(qreal(1.0), qreal(bar->maximum) - bar->minimum); | - | ||||||||||||||||||||||||||||||||||||
2692 | if (progressIndicatorPos >= 0 && progressIndicatorPos <= rect.width())
| 0 | ||||||||||||||||||||||||||||||||||||
2693 | leftRect = QRect(rect.left(), rect.top(), progressIndicatorPos, rect.height()); never executed: leftRect = QRect(rect.left(), rect.top(), progressIndicatorPos, rect.height()); | 0 | ||||||||||||||||||||||||||||||||||||
2694 | if (vertical)
| 0 | ||||||||||||||||||||||||||||||||||||
2695 | leftRect.translate(rect.width() - progressIndicatorPos, 0); never executed: leftRect.translate(rect.width() - progressIndicatorPos, 0); | 0 | ||||||||||||||||||||||||||||||||||||
2696 | - | |||||||||||||||||||||||||||||||||||||
2697 | bool flip = (!vertical && (((bar->direction == Qt::RightToLeft) && !inverted) ||
| 0 | ||||||||||||||||||||||||||||||||||||
2698 | ((bar->direction == Qt::LeftToRight) && inverted)));
| 0 | ||||||||||||||||||||||||||||||||||||
2699 | - | |||||||||||||||||||||||||||||||||||||
2700 | QRegion rightRect = rect; | - | ||||||||||||||||||||||||||||||||||||
2701 | rightRect = rightRect.subtracted(leftRect); | - | ||||||||||||||||||||||||||||||||||||
2702 | painter->setClipRegion(rightRect); | - | ||||||||||||||||||||||||||||||||||||
2703 | painter->setPen(flip ? alternateTextColor : textColor); | - | ||||||||||||||||||||||||||||||||||||
2704 | painter->drawText(rect, bar->text, QTextOption(Qt::AlignAbsolute | Qt::AlignHCenter | Qt::AlignVCenter)); | - | ||||||||||||||||||||||||||||||||||||
2705 | if (!leftRect.isNull()) {
| 0 | ||||||||||||||||||||||||||||||||||||
2706 | painter->setPen(flip ? textColor : alternateTextColor); | - | ||||||||||||||||||||||||||||||||||||
2707 | painter->setClipRect(leftRect); | - | ||||||||||||||||||||||||||||||||||||
2708 | painter->drawText(rect, bar->text, QTextOption(Qt::AlignAbsolute | Qt::AlignHCenter | Qt::AlignVCenter)); | - | ||||||||||||||||||||||||||||||||||||
2709 | } never executed: end of block | 0 | ||||||||||||||||||||||||||||||||||||
2710 | painter->restore(); | - | ||||||||||||||||||||||||||||||||||||
2711 | } never executed: end of block | 0 | ||||||||||||||||||||||||||||||||||||
2712 | break; never executed: break; | 0 | ||||||||||||||||||||||||||||||||||||
2713 | case CE_PushButtonLabel: never executed: case CE_PushButtonLabel: | 0 | ||||||||||||||||||||||||||||||||||||
2714 | if (const QStyleOptionButton *button = qstyleoption_cast<const QStyleOptionButton *>(option)) {
| 0 | ||||||||||||||||||||||||||||||||||||
2715 | QRect ir = button->rect; | - | ||||||||||||||||||||||||||||||||||||
2716 | uint tf = Qt::AlignVCenter | Qt::TextShowMnemonic; | - | ||||||||||||||||||||||||||||||||||||
2717 | QPoint buttonShift; | - | ||||||||||||||||||||||||||||||||||||
2718 | - | |||||||||||||||||||||||||||||||||||||
2719 | if (option->state & State_Sunken)
| 0 | ||||||||||||||||||||||||||||||||||||
2720 | buttonShift = QPoint(pixelMetric(PM_ButtonShiftHorizontal, option, widget), never executed: buttonShift = QPoint(pixelMetric(PM_ButtonShiftHorizontal, option, widget), proxy()->pixelMetric(PM_ButtonShiftVertical, option, widget)); | 0 | ||||||||||||||||||||||||||||||||||||
2721 | proxy()->pixelMetric(PM_ButtonShiftVertical, option, widget)); never executed: buttonShift = QPoint(pixelMetric(PM_ButtonShiftHorizontal, option, widget), proxy()->pixelMetric(PM_ButtonShiftVertical, option, widget)); | 0 | ||||||||||||||||||||||||||||||||||||
2722 | - | |||||||||||||||||||||||||||||||||||||
2723 | if (proxy()->styleHint(SH_UnderlineShortcut, button, widget))
| 0 | ||||||||||||||||||||||||||||||||||||
2724 | tf |= Qt::TextShowMnemonic; never executed: tf |= Qt::TextShowMnemonic; | 0 | ||||||||||||||||||||||||||||||||||||
2725 | else | - | ||||||||||||||||||||||||||||||||||||
2726 | tf |= Qt::TextHideMnemonic; never executed: tf |= Qt::TextHideMnemonic; | 0 | ||||||||||||||||||||||||||||||||||||
2727 | - | |||||||||||||||||||||||||||||||||||||
2728 | if (!button->icon.isNull()) {
| 0 | ||||||||||||||||||||||||||||||||||||
2729 | //Center both icon and text | - | ||||||||||||||||||||||||||||||||||||
2730 | QPoint point; | - | ||||||||||||||||||||||||||||||||||||
2731 | - | |||||||||||||||||||||||||||||||||||||
2732 | QIcon::Mode mode = button->state & State_Enabled ? QIcon::Normal : QIcon::Disabled;
| 0 | ||||||||||||||||||||||||||||||||||||
2733 | if (mode == QIcon::Normal && button->state & State_HasFocus)
| 0 | ||||||||||||||||||||||||||||||||||||
2734 | mode = QIcon::Active; never executed: mode = QIcon::Active; | 0 | ||||||||||||||||||||||||||||||||||||
2735 | - | |||||||||||||||||||||||||||||||||||||
2736 | QIcon::State state = QIcon::Off; | - | ||||||||||||||||||||||||||||||||||||
2737 | - | |||||||||||||||||||||||||||||||||||||
2738 | if (button->state & State_On)
| 0 | ||||||||||||||||||||||||||||||||||||
2739 | state = QIcon::On; never executed: state = QIcon::On; | 0 | ||||||||||||||||||||||||||||||||||||
2740 | - | |||||||||||||||||||||||||||||||||||||
2741 | QPixmap pixmap = button->icon.pixmap(button->iconSize, mode, state); | - | ||||||||||||||||||||||||||||||||||||
2742 | int w = pixmap.width(); | - | ||||||||||||||||||||||||||||||||||||
2743 | int h = pixmap.height(); | - | ||||||||||||||||||||||||||||||||||||
2744 | - | |||||||||||||||||||||||||||||||||||||
2745 | if (!button->text.isEmpty())
| 0 | ||||||||||||||||||||||||||||||||||||
2746 | w += button->fontMetrics.boundingRect(option->rect, tf, button->text).width() + 4; never executed: w += button->fontMetrics.boundingRect(option->rect, tf, button->text).width() + 4; | 0 | ||||||||||||||||||||||||||||||||||||
2747 | - | |||||||||||||||||||||||||||||||||||||
2748 | point = QPoint(ir.x() + ir.width() / 2 - w / 2, | - | ||||||||||||||||||||||||||||||||||||
2749 | ir.y() + ir.height() / 2 - h / 2); | - | ||||||||||||||||||||||||||||||||||||
2750 | - | |||||||||||||||||||||||||||||||||||||
2751 | if (button->direction == Qt::RightToLeft)
| 0 | ||||||||||||||||||||||||||||||||||||
2752 | point.rx() += pixmap.width(); never executed: point.rx() += pixmap.width(); | 0 | ||||||||||||||||||||||||||||||||||||
2753 | - | |||||||||||||||||||||||||||||||||||||
2754 | painter->drawPixmap(visualPos(button->direction, button->rect, point + buttonShift), pixmap); | - | ||||||||||||||||||||||||||||||||||||
2755 | - | |||||||||||||||||||||||||||||||||||||
2756 | if (button->direction == Qt::RightToLeft)
| 0 | ||||||||||||||||||||||||||||||||||||
2757 | ir.translate(-point.x() - 2, 0); never executed: ir.translate(-point.x() - 2, 0); | 0 | ||||||||||||||||||||||||||||||||||||
2758 | else | - | ||||||||||||||||||||||||||||||||||||
2759 | ir.translate(point.x() + pixmap.width() + 2, 0); never executed: ir.translate(point.x() + pixmap.width() + 2, 0); | 0 | ||||||||||||||||||||||||||||||||||||
2760 | - | |||||||||||||||||||||||||||||||||||||
2761 | // left-align text if there is | - | ||||||||||||||||||||||||||||||||||||
2762 | if (!button->text.isEmpty())
| 0 | ||||||||||||||||||||||||||||||||||||
2763 | tf |= Qt::AlignLeft; never executed: tf |= Qt::AlignLeft; | 0 | ||||||||||||||||||||||||||||||||||||
2764 | - | |||||||||||||||||||||||||||||||||||||
2765 | } else { never executed: end of block | 0 | ||||||||||||||||||||||||||||||||||||
2766 | tf |= Qt::AlignHCenter; | - | ||||||||||||||||||||||||||||||||||||
2767 | } never executed: end of block | 0 | ||||||||||||||||||||||||||||||||||||
2768 | - | |||||||||||||||||||||||||||||||||||||
2769 | ir.translate(buttonShift); | - | ||||||||||||||||||||||||||||||||||||
2770 | - | |||||||||||||||||||||||||||||||||||||
2771 | if (button->features & QStyleOptionButton::HasMenu)
| 0 | ||||||||||||||||||||||||||||||||||||
2772 | ir = ir.adjusted(0, 0, -pixelMetric(PM_MenuButtonIndicator, button, widget), 0); never executed: ir = ir.adjusted(0, 0, -pixelMetric(PM_MenuButtonIndicator, button, widget), 0); | 0 | ||||||||||||||||||||||||||||||||||||
2773 | - | |||||||||||||||||||||||||||||||||||||
2774 | GtkWidget *gtkButton = d->gtkWidget("GtkButton"); | - | ||||||||||||||||||||||||||||||||||||
2775 | QPalette pal = button->palette; | - | ||||||||||||||||||||||||||||||||||||
2776 | int labelState = GTK_STATE_INSENSITIVE; | - | ||||||||||||||||||||||||||||||||||||
2777 | if (option->state & State_Enabled)
| 0 | ||||||||||||||||||||||||||||||||||||
2778 | labelState = (option->state & State_MouseOver && !(option->state & State_Sunken)) ? never executed: labelState = (option->state & State_MouseOver && !(option->state & State_Sunken)) ? GTK_STATE_PRELIGHT : GTK_STATE_NORMAL;
| 0 | ||||||||||||||||||||||||||||||||||||
2779 | GTK_STATE_PRELIGHT : GTK_STATE_NORMAL; never executed: labelState = (option->state & State_MouseOver && !(option->state & State_Sunken)) ? GTK_STATE_PRELIGHT : GTK_STATE_NORMAL; | 0 | ||||||||||||||||||||||||||||||||||||
2780 | - | |||||||||||||||||||||||||||||||||||||
2781 | GdkColor gdkText = d->gtk_widget_get_style(gtkButton)->fg[labelState]; | - | ||||||||||||||||||||||||||||||||||||
2782 | QColor textColor = QColor(gdkText.red>>8, gdkText.green>>8, gdkText.blue>>8); | - | ||||||||||||||||||||||||||||||||||||
2783 | pal.setBrush(QPalette::ButtonText, textColor); | - | ||||||||||||||||||||||||||||||||||||
2784 | proxy()->drawItemText(painter, ir, tf, pal, (button->state & State_Enabled), | - | ||||||||||||||||||||||||||||||||||||
2785 | button->text, QPalette::ButtonText); | - | ||||||||||||||||||||||||||||||||||||
2786 | } never executed: end of block | 0 | ||||||||||||||||||||||||||||||||||||
2787 | break; never executed: break; | 0 | ||||||||||||||||||||||||||||||||||||
2788 | - | |||||||||||||||||||||||||||||||||||||
2789 | case CE_RadioButton: // Fall through never executed: case CE_RadioButton: | 0 | ||||||||||||||||||||||||||||||||||||
2790 | case CE_CheckBox: never executed: case CE_CheckBox: | 0 | ||||||||||||||||||||||||||||||||||||
2791 | if (const QStyleOptionButton *btn = qstyleoption_cast<const QStyleOptionButton *>(option)) {
| 0 | ||||||||||||||||||||||||||||||||||||
2792 | bool isRadio = (element == CE_RadioButton); | - | ||||||||||||||||||||||||||||||||||||
2793 | - | |||||||||||||||||||||||||||||||||||||
2794 | // Draw prelight background | - | ||||||||||||||||||||||||||||||||||||
2795 | GtkWidget *gtkRadioButton = d->gtkWidget("GtkRadioButton"); | - | ||||||||||||||||||||||||||||||||||||
2796 | - | |||||||||||||||||||||||||||||||||||||
2797 | if (option->state & State_MouseOver) {
| 0 | ||||||||||||||||||||||||||||||||||||
2798 | gtkPainter->paintFlatBox(gtkRadioButton, "checkbutton", option->rect, | - | ||||||||||||||||||||||||||||||||||||
2799 | GTK_STATE_PRELIGHT, GTK_SHADOW_ETCHED_OUT, d->gtk_widget_get_style(gtkRadioButton)); | - | ||||||||||||||||||||||||||||||||||||
2800 | } never executed: end of block | 0 | ||||||||||||||||||||||||||||||||||||
2801 | - | |||||||||||||||||||||||||||||||||||||
2802 | QStyleOptionButton subopt = *btn; | - | ||||||||||||||||||||||||||||||||||||
2803 | subopt.rect = subElementRect(isRadio ? SE_RadioButtonIndicator | - | ||||||||||||||||||||||||||||||||||||
2804 | : SE_CheckBoxIndicator, btn, widget); | - | ||||||||||||||||||||||||||||||||||||
2805 | proxy()->drawPrimitive(isRadio ? PE_IndicatorRadioButton : PE_IndicatorCheckBox, | - | ||||||||||||||||||||||||||||||||||||
2806 | &subopt, painter, widget); | - | ||||||||||||||||||||||||||||||||||||
2807 | subopt.rect = subElementRect(isRadio ? SE_RadioButtonContents | - | ||||||||||||||||||||||||||||||||||||
2808 | : SE_CheckBoxContents, btn, widget); | - | ||||||||||||||||||||||||||||||||||||
2809 | // Get label text color | - | ||||||||||||||||||||||||||||||||||||
2810 | QPalette pal = subopt.palette; | - | ||||||||||||||||||||||||||||||||||||
2811 | int labelState = GTK_STATE_INSENSITIVE; | - | ||||||||||||||||||||||||||||||||||||
2812 | if (option->state & State_Enabled)
| 0 | ||||||||||||||||||||||||||||||||||||
2813 | labelState = (option->state & State_MouseOver) ? GTK_STATE_PRELIGHT : GTK_STATE_NORMAL; never executed: labelState = (option->state & State_MouseOver) ? GTK_STATE_PRELIGHT : GTK_STATE_NORMAL;
| 0 | ||||||||||||||||||||||||||||||||||||
2814 | - | |||||||||||||||||||||||||||||||||||||
2815 | GdkColor gdkText = d->gtk_widget_get_style(gtkRadioButton)->fg[labelState]; | - | ||||||||||||||||||||||||||||||||||||
2816 | QColor textColor = QColor(gdkText.red>>8, gdkText.green>>8, gdkText.blue>>8); | - | ||||||||||||||||||||||||||||||||||||
2817 | pal.setBrush(QPalette::WindowText, textColor); | - | ||||||||||||||||||||||||||||||||||||
2818 | subopt.palette = pal; | - | ||||||||||||||||||||||||||||||||||||
2819 | proxy()->drawControl(isRadio ? CE_RadioButtonLabel : CE_CheckBoxLabel, &subopt, painter, widget); | - | ||||||||||||||||||||||||||||||||||||
2820 | - | |||||||||||||||||||||||||||||||||||||
2821 | if (btn->state & State_HasFocus) {
| 0 | ||||||||||||||||||||||||||||||||||||
2822 | QStyleOptionFocusRect fropt; | - | ||||||||||||||||||||||||||||||||||||
2823 | fropt.QStyleOption::operator=(*btn); | - | ||||||||||||||||||||||||||||||||||||
2824 | fropt.rect = subElementRect(isRadio ? SE_RadioButtonFocusRect | - | ||||||||||||||||||||||||||||||||||||
2825 | : SE_CheckBoxFocusRect, btn, widget); | - | ||||||||||||||||||||||||||||||||||||
2826 | proxy()->drawPrimitive(PE_FrameFocusRect, &fropt, painter, widget); | - | ||||||||||||||||||||||||||||||||||||
2827 | } never executed: end of block | 0 | ||||||||||||||||||||||||||||||||||||
2828 | } never executed: end of block | 0 | ||||||||||||||||||||||||||||||||||||
2829 | break; never executed: break; | 0 | ||||||||||||||||||||||||||||||||||||
2830 | - | |||||||||||||||||||||||||||||||||||||
2831 | #ifndef QT_NO_COMBOBOX | - | ||||||||||||||||||||||||||||||||||||
2832 | - | |||||||||||||||||||||||||||||||||||||
2833 | case CE_ComboBoxLabel: never executed: case CE_ComboBoxLabel: | 0 | ||||||||||||||||||||||||||||||||||||
2834 | if (const QStyleOptionComboBox *cb = qstyleoption_cast<const QStyleOptionComboBox *>(option)) {
| 0 | ||||||||||||||||||||||||||||||||||||
2835 | QRect editRect = proxy()->subControlRect(CC_ComboBox, cb, SC_ComboBoxEditField, widget); | - | ||||||||||||||||||||||||||||||||||||
2836 | bool appearsAsList = !proxy()->styleHint(QStyle::SH_ComboBox_Popup, cb, widget); | - | ||||||||||||||||||||||||||||||||||||
2837 | painter->save(); | - | ||||||||||||||||||||||||||||||||||||
2838 | painter->setClipRect(editRect); | - | ||||||||||||||||||||||||||||||||||||
2839 | - | |||||||||||||||||||||||||||||||||||||
2840 | if (!cb->currentIcon.isNull()) {
| 0 | ||||||||||||||||||||||||||||||||||||
2841 | QIcon::Mode mode = cb->state & State_Enabled ? QIcon::Normal
| 0 | ||||||||||||||||||||||||||||||||||||
2842 | : QIcon::Disabled; | - | ||||||||||||||||||||||||||||||||||||
2843 | QPixmap pixmap = cb->currentIcon.pixmap(cb->iconSize, mode); | - | ||||||||||||||||||||||||||||||||||||
2844 | QRect iconRect(editRect); | - | ||||||||||||||||||||||||||||||||||||
2845 | iconRect.setWidth(cb->iconSize.width() + 4); | - | ||||||||||||||||||||||||||||||||||||
2846 | - | |||||||||||||||||||||||||||||||||||||
2847 | iconRect = alignedRect(cb->direction, | - | ||||||||||||||||||||||||||||||||||||
2848 | Qt::AlignLeft | Qt::AlignVCenter, | - | ||||||||||||||||||||||||||||||||||||
2849 | iconRect.size(), editRect); | - | ||||||||||||||||||||||||||||||||||||
2850 | - | |||||||||||||||||||||||||||||||||||||
2851 | if (cb->editable)
| 0 | ||||||||||||||||||||||||||||||||||||
2852 | painter->fillRect(iconRect, option->palette.brush(QPalette::Base)); never executed: painter->fillRect(iconRect, option->palette.brush(QPalette::Base)); | 0 | ||||||||||||||||||||||||||||||||||||
2853 | - | |||||||||||||||||||||||||||||||||||||
2854 | proxy()->drawItemPixmap(painter, iconRect, Qt::AlignCenter, pixmap); | - | ||||||||||||||||||||||||||||||||||||
2855 | - | |||||||||||||||||||||||||||||||||||||
2856 | if (cb->direction == Qt::RightToLeft)
| 0 | ||||||||||||||||||||||||||||||||||||
2857 | editRect.translate(-4 - cb->iconSize.width(), 0); never executed: editRect.translate(-4 - cb->iconSize.width(), 0); | 0 | ||||||||||||||||||||||||||||||||||||
2858 | else | - | ||||||||||||||||||||||||||||||||||||
2859 | editRect.translate(cb->iconSize.width() + 4, 0); never executed: editRect.translate(cb->iconSize.width() + 4, 0); | 0 | ||||||||||||||||||||||||||||||||||||
2860 | } | - | ||||||||||||||||||||||||||||||||||||
2861 | - | |||||||||||||||||||||||||||||||||||||
2862 | if (!cb->currentText.isEmpty() && !cb->editable) {
| 0 | ||||||||||||||||||||||||||||||||||||
2863 | GtkWidget *gtkCombo = d->gtkWidget("GtkComboBox"); | - | ||||||||||||||||||||||||||||||||||||
2864 | QPalette pal = cb->palette; | - | ||||||||||||||||||||||||||||||||||||
2865 | int labelState = GTK_STATE_INSENSITIVE; | - | ||||||||||||||||||||||||||||||||||||
2866 | - | |||||||||||||||||||||||||||||||||||||
2867 | if (option->state & State_Enabled)
| 0 | ||||||||||||||||||||||||||||||||||||
2868 | labelState = (option->state & State_MouseOver && !appearsAsList) ? GTK_STATE_PRELIGHT : GTK_STATE_NORMAL; never executed: labelState = (option->state & State_MouseOver && !appearsAsList) ? GTK_STATE_PRELIGHT : GTK_STATE_NORMAL;
| 0 | ||||||||||||||||||||||||||||||||||||
2869 | - | |||||||||||||||||||||||||||||||||||||
2870 | GdkColor gdkText = d->gtk_widget_get_style(gtkCombo)->fg[labelState]; | - | ||||||||||||||||||||||||||||||||||||
2871 | - | |||||||||||||||||||||||||||||||||||||
2872 | QColor textColor = QColor(gdkText.red>>8, gdkText.green>>8, gdkText.blue>>8); | - | ||||||||||||||||||||||||||||||||||||
2873 | - | |||||||||||||||||||||||||||||||||||||
2874 | pal.setBrush(QPalette::ButtonText, textColor); | - | ||||||||||||||||||||||||||||||||||||
2875 | - | |||||||||||||||||||||||||||||||||||||
2876 | proxy()->drawItemText(painter, editRect.adjusted(1, 0, -1, 0), | - | ||||||||||||||||||||||||||||||||||||
2877 | visualAlignment(cb->direction, Qt::AlignLeft | Qt::AlignVCenter), | - | ||||||||||||||||||||||||||||||||||||
2878 | pal, cb->state & State_Enabled, cb->currentText, QPalette::ButtonText); | - | ||||||||||||||||||||||||||||||||||||
2879 | } never executed: end of block | 0 | ||||||||||||||||||||||||||||||||||||
2880 | - | |||||||||||||||||||||||||||||||||||||
2881 | painter->restore(); | - | ||||||||||||||||||||||||||||||||||||
2882 | } never executed: end of block | 0 | ||||||||||||||||||||||||||||||||||||
2883 | break; never executed: break; | 0 | ||||||||||||||||||||||||||||||||||||
2884 | - | |||||||||||||||||||||||||||||||||||||
2885 | #endif // QT_NO_COMBOBOX | - | ||||||||||||||||||||||||||||||||||||
2886 | - | |||||||||||||||||||||||||||||||||||||
2887 | case CE_DockWidgetTitle: never executed: case CE_DockWidgetTitle: | 0 | ||||||||||||||||||||||||||||||||||||
2888 | painter->save(); | - | ||||||||||||||||||||||||||||||||||||
2889 | if (const QStyleOptionDockWidget *dwOpt = qstyleoption_cast<const QStyleOptionDockWidget *>(option)) {
| 0 | ||||||||||||||||||||||||||||||||||||
2890 | const QStyleOptionDockWidgetV2 *v2 | - | ||||||||||||||||||||||||||||||||||||
2891 | = qstyleoption_cast<const QStyleOptionDockWidgetV2*>(dwOpt); | - | ||||||||||||||||||||||||||||||||||||
2892 | bool verticalTitleBar = v2 == 0 ? false : v2->verticalTitleBar;
| 0 | ||||||||||||||||||||||||||||||||||||
2893 | - | |||||||||||||||||||||||||||||||||||||
2894 | QRect rect = dwOpt->rect; | - | ||||||||||||||||||||||||||||||||||||
2895 | QRect titleRect = subElementRect(SE_DockWidgetTitleBarText, option, widget).adjusted(-2, 0, -2, 0); | - | ||||||||||||||||||||||||||||||||||||
2896 | QRect r = rect.adjusted(0, 0, -1, -1); | - | ||||||||||||||||||||||||||||||||||||
2897 | if (verticalTitleBar)
| 0 | ||||||||||||||||||||||||||||||||||||
2898 | r.adjust(0, 0, 0, -1); never executed: r.adjust(0, 0, 0, -1); | 0 | ||||||||||||||||||||||||||||||||||||
2899 | - | |||||||||||||||||||||||||||||||||||||
2900 | if (verticalTitleBar) {
| 0 | ||||||||||||||||||||||||||||||||||||
2901 | QRect r = rect; | - | ||||||||||||||||||||||||||||||||||||
2902 | r.setSize(r.size().transposed()); | - | ||||||||||||||||||||||||||||||||||||
2903 | - | |||||||||||||||||||||||||||||||||||||
2904 | titleRect = QRect(r.left() + rect.bottom() | - | ||||||||||||||||||||||||||||||||||||
2905 | - titleRect.bottom(), | - | ||||||||||||||||||||||||||||||||||||
2906 | r.top() + titleRect.left() - rect.left(), | - | ||||||||||||||||||||||||||||||||||||
2907 | titleRect.height(), titleRect.width()); | - | ||||||||||||||||||||||||||||||||||||
2908 | - | |||||||||||||||||||||||||||||||||||||
2909 | painter->translate(r.left(), r.top() + r.width()); | - | ||||||||||||||||||||||||||||||||||||
2910 | painter->rotate(-90); | - | ||||||||||||||||||||||||||||||||||||
2911 | painter->translate(-r.left(), -r.top()); | - | ||||||||||||||||||||||||||||||||||||
2912 | - | |||||||||||||||||||||||||||||||||||||
2913 | rect = r; | - | ||||||||||||||||||||||||||||||||||||
2914 | } never executed: end of block | 0 | ||||||||||||||||||||||||||||||||||||
2915 | - | |||||||||||||||||||||||||||||||||||||
2916 | if (!dwOpt->title.isEmpty()) {
| 0 | ||||||||||||||||||||||||||||||||||||
2917 | QString titleText | - | ||||||||||||||||||||||||||||||||||||
2918 | = painter->fontMetrics().elidedText(dwOpt->title, | - | ||||||||||||||||||||||||||||||||||||
2919 | Qt::ElideRight, titleRect.width()); | - | ||||||||||||||||||||||||||||||||||||
2920 | proxy()->drawItemText(painter, | - | ||||||||||||||||||||||||||||||||||||
2921 | titleRect, | - | ||||||||||||||||||||||||||||||||||||
2922 | Qt::AlignLeft | Qt::AlignVCenter | Qt::TextShowMnemonic, dwOpt->palette, | - | ||||||||||||||||||||||||||||||||||||
2923 | dwOpt->state & State_Enabled, titleText, | - | ||||||||||||||||||||||||||||||||||||
2924 | QPalette::WindowText); | - | ||||||||||||||||||||||||||||||||||||
2925 | } never executed: end of block | 0 | ||||||||||||||||||||||||||||||||||||
2926 | } never executed: end of block | 0 | ||||||||||||||||||||||||||||||||||||
2927 | painter->restore(); | - | ||||||||||||||||||||||||||||||||||||
2928 | break; never executed: break; | 0 | ||||||||||||||||||||||||||||||||||||
2929 | - | |||||||||||||||||||||||||||||||||||||
2930 | - | |||||||||||||||||||||||||||||||||||||
2931 | - | |||||||||||||||||||||||||||||||||||||
2932 | case CE_HeaderSection: never executed: case CE_HeaderSection: | 0 | ||||||||||||||||||||||||||||||||||||
2933 | painter->save(); | - | ||||||||||||||||||||||||||||||||||||
2934 | - | |||||||||||||||||||||||||||||||||||||
2935 | // Draws the header in tables. | - | ||||||||||||||||||||||||||||||||||||
2936 | if (const QStyleOptionHeader *header = qstyleoption_cast<const QStyleOptionHeader *>(option)) {
| 0 | ||||||||||||||||||||||||||||||||||||
2937 | Q_UNUSED(header); | - | ||||||||||||||||||||||||||||||||||||
2938 | GtkWidget *gtkTreeView = d->gtkWidget("GtkTreeView"); | - | ||||||||||||||||||||||||||||||||||||
2939 | // Get the middle column | - | ||||||||||||||||||||||||||||||||||||
2940 | GtkTreeViewColumn *column = d->gtk_tree_view_get_column((GtkTreeView*)gtkTreeView, 1); | - | ||||||||||||||||||||||||||||||||||||
2941 | Q_ASSERT(column); | - | ||||||||||||||||||||||||||||||||||||
2942 | - | |||||||||||||||||||||||||||||||||||||
2943 | GtkWidget *gtkTreeHeader = column->button; | - | ||||||||||||||||||||||||||||||||||||
2944 | GtkStateType state = qt_gtk_state(option); | - | ||||||||||||||||||||||||||||||||||||
2945 | GtkShadowType shadow = GTK_SHADOW_OUT; | - | ||||||||||||||||||||||||||||||||||||
2946 | - | |||||||||||||||||||||||||||||||||||||
2947 | if (option->state & State_Sunken)
| 0 | ||||||||||||||||||||||||||||||||||||
2948 | shadow = GTK_SHADOW_IN; never executed: shadow = GTK_SHADOW_IN; | 0 | ||||||||||||||||||||||||||||||||||||
2949 | - | |||||||||||||||||||||||||||||||||||||
2950 | gtkPainter->paintBox(gtkTreeHeader, "button", option->rect.adjusted(-1, 0, 0, 0), state, shadow, d->gtk_widget_get_style(gtkTreeHeader)); | - | ||||||||||||||||||||||||||||||||||||
2951 | } never executed: end of block | 0 | ||||||||||||||||||||||||||||||||||||
2952 | - | |||||||||||||||||||||||||||||||||||||
2953 | painter->restore(); | - | ||||||||||||||||||||||||||||||||||||
2954 | break; never executed: break; | 0 | ||||||||||||||||||||||||||||||||||||
2955 | - | |||||||||||||||||||||||||||||||||||||
2956 | #ifndef QT_NO_SIZEGRIP | - | ||||||||||||||||||||||||||||||||||||
2957 | - | |||||||||||||||||||||||||||||||||||||
2958 | case CE_SizeGrip: { never executed: case CE_SizeGrip: | 0 | ||||||||||||||||||||||||||||||||||||
2959 | GtkWidget *gtkStatusbar = d->gtkWidget("GtkStatusbar.GtkFrame"); | - | ||||||||||||||||||||||||||||||||||||
2960 | GtkStyle *gtkStatusbarStyle = d->gtk_widget_get_style(gtkStatusbar); | - | ||||||||||||||||||||||||||||||||||||
2961 | QRect gripRect = option->rect.adjusted(0, 0, -gtkStatusbarStyle->xthickness, -gtkStatusbarStyle->ythickness); | - | ||||||||||||||||||||||||||||||||||||
2962 | gtkPainter->paintResizeGrip(gtkStatusbar, "statusbar", gripRect, GTK_STATE_NORMAL, | - | ||||||||||||||||||||||||||||||||||||
2963 | GTK_SHADOW_OUT, option->direction == Qt::RightToLeft ? | - | ||||||||||||||||||||||||||||||||||||
2964 | GDK_WINDOW_EDGE_SOUTH_WEST : GDK_WINDOW_EDGE_SOUTH_EAST, | - | ||||||||||||||||||||||||||||||||||||
2965 | gtkStatusbarStyle); | - | ||||||||||||||||||||||||||||||||||||
2966 | } | - | ||||||||||||||||||||||||||||||||||||
2967 | break; never executed: break; | 0 | ||||||||||||||||||||||||||||||||||||
2968 | - | |||||||||||||||||||||||||||||||||||||
2969 | #endif // QT_NO_SIZEGRIP | - | ||||||||||||||||||||||||||||||||||||
2970 | - | |||||||||||||||||||||||||||||||||||||
2971 | case CE_MenuBarEmptyArea: { never executed: case CE_MenuBarEmptyArea: | 0 | ||||||||||||||||||||||||||||||||||||
2972 | GtkWidget *gtkMenubar = d->gtkWidget("GtkMenuBar"); | - | ||||||||||||||||||||||||||||||||||||
2973 | GdkColor gdkBg = d->gtk_widget_get_style(gtkMenubar)->bg[GTK_STATE_NORMAL]; // Theme can depend on transparency | - | ||||||||||||||||||||||||||||||||||||
2974 | painter->fillRect(option->rect, QColor(gdkBg.red>>8, gdkBg.green>>8, gdkBg.blue>>8)); | - | ||||||||||||||||||||||||||||||||||||
2975 | if (widget) { // See CE_MenuBarItem
| 0 | ||||||||||||||||||||||||||||||||||||
2976 | QRect menuBarRect = widget->rect(); | - | ||||||||||||||||||||||||||||||||||||
2977 | QPixmap pixmap(menuBarRect.size()); | - | ||||||||||||||||||||||||||||||||||||
2978 | pixmap.fill(Qt::transparent); | - | ||||||||||||||||||||||||||||||||||||
2979 | QPainter pmPainter(&pixmap); | - | ||||||||||||||||||||||||||||||||||||
2980 | gtkPainter->reset(&pmPainter); | - | ||||||||||||||||||||||||||||||||||||
2981 | GtkShadowType shadow_type; | - | ||||||||||||||||||||||||||||||||||||
2982 | d->gtk_widget_style_get(gtkMenubar, "shadow-type", &shadow_type, NULL); | - | ||||||||||||||||||||||||||||||||||||
2983 | gtkPainter->paintBox(gtkMenubar, "menubar", menuBarRect, | - | ||||||||||||||||||||||||||||||||||||
2984 | GTK_STATE_NORMAL, shadow_type, d->gtk_widget_get_style(gtkMenubar)); | - | ||||||||||||||||||||||||||||||||||||
2985 | pmPainter.end(); | - | ||||||||||||||||||||||||||||||||||||
2986 | painter->drawPixmap(option->rect, pixmap, option->rect); | - | ||||||||||||||||||||||||||||||||||||
2987 | gtkPainter->reset(painter); | - | ||||||||||||||||||||||||||||||||||||
2988 | } never executed: end of block | 0 | ||||||||||||||||||||||||||||||||||||
2989 | } | - | ||||||||||||||||||||||||||||||||||||
2990 | break; never executed: break; | 0 | ||||||||||||||||||||||||||||||||||||
2991 | - | |||||||||||||||||||||||||||||||||||||
2992 | case CE_MenuBarItem: never executed: case CE_MenuBarItem: | 0 | ||||||||||||||||||||||||||||||||||||
2993 | painter->save(); | - | ||||||||||||||||||||||||||||||||||||
2994 | - | |||||||||||||||||||||||||||||||||||||
2995 | if (const QStyleOptionMenuItem *mbi = qstyleoption_cast<const QStyleOptionMenuItem *>(option)) {
| 0 | ||||||||||||||||||||||||||||||||||||
2996 | GtkWidget *gtkMenubarItem = d->gtkWidget("GtkMenuBar.GtkMenuItem"); | - | ||||||||||||||||||||||||||||||||||||
2997 | GtkWidget *gtkMenubar = d->gtkWidget("GtkMenuBar"); | - | ||||||||||||||||||||||||||||||||||||
2998 | - | |||||||||||||||||||||||||||||||||||||
2999 | style = d->gtk_widget_get_style(gtkMenubarItem); | - | ||||||||||||||||||||||||||||||||||||
3000 | - | |||||||||||||||||||||||||||||||||||||
3001 | if (widget) {
| 0 | ||||||||||||||||||||||||||||||||||||
3002 | // Since Qt does not currently allow filling the entire background | - | ||||||||||||||||||||||||||||||||||||
3003 | // we use a hack for this by making a complete menubar each time and | - | ||||||||||||||||||||||||||||||||||||
3004 | // paint with the correct offset inside it. Pixmap caching should resolve | - | ||||||||||||||||||||||||||||||||||||
3005 | // most of the performance penalty. | - | ||||||||||||||||||||||||||||||||||||
3006 | QRect menuBarRect = widget->rect(); | - | ||||||||||||||||||||||||||||||||||||
3007 | QPixmap pixmap(menuBarRect.size()); | - | ||||||||||||||||||||||||||||||||||||
3008 | pixmap.fill(Qt::transparent); | - | ||||||||||||||||||||||||||||||||||||
3009 | QPainter pmPainter(&pixmap); | - | ||||||||||||||||||||||||||||||||||||
3010 | gtkPainter->reset(&pmPainter); | - | ||||||||||||||||||||||||||||||||||||
3011 | GtkShadowType shadow_type; | - | ||||||||||||||||||||||||||||||||||||
3012 | d->gtk_widget_style_get(gtkMenubar, "shadow-type", &shadow_type, NULL); | - | ||||||||||||||||||||||||||||||||||||
3013 | GdkColor gdkBg = d->gtk_widget_get_style(gtkMenubar)->bg[GTK_STATE_NORMAL]; // Theme can depend on transparency | - | ||||||||||||||||||||||||||||||||||||
3014 | painter->fillRect(option->rect, QColor(gdkBg.red>>8, gdkBg.green>>8, gdkBg.blue>>8)); | - | ||||||||||||||||||||||||||||||||||||
3015 | gtkPainter->paintBox(gtkMenubar, "menubar", menuBarRect, | - | ||||||||||||||||||||||||||||||||||||
3016 | GTK_STATE_NORMAL, shadow_type, d->gtk_widget_get_style(gtkMenubar)); | - | ||||||||||||||||||||||||||||||||||||
3017 | pmPainter.end(); | - | ||||||||||||||||||||||||||||||||||||
3018 | painter->drawPixmap(option->rect, pixmap, option->rect); | - | ||||||||||||||||||||||||||||||||||||
3019 | gtkPainter->reset(painter); | - | ||||||||||||||||||||||||||||||||||||
3020 | } never executed: end of block | 0 | ||||||||||||||||||||||||||||||||||||
3021 | - | |||||||||||||||||||||||||||||||||||||
3022 | QStyleOptionMenuItem item = *mbi; | - | ||||||||||||||||||||||||||||||||||||
3023 | bool act = mbi->state & State_Selected && mbi->state & State_Sunken;
| 0 | ||||||||||||||||||||||||||||||||||||
3024 | bool dis = !(mbi->state & State_Enabled); | - | ||||||||||||||||||||||||||||||||||||
3025 | item.rect = mbi->rect; | - | ||||||||||||||||||||||||||||||||||||
3026 | GdkColor gdkText = style->fg[dis ? GTK_STATE_INSENSITIVE : GTK_STATE_NORMAL]; | - | ||||||||||||||||||||||||||||||||||||
3027 | GdkColor gdkHText = style->fg[GTK_STATE_PRELIGHT]; | - | ||||||||||||||||||||||||||||||||||||
3028 | QColor normalTextColor = QColor(gdkText.red>>8, gdkText.green>>8, gdkText.blue>>8); | - | ||||||||||||||||||||||||||||||||||||
3029 | QColor highlightedTextColor = QColor(gdkHText.red>>8, gdkHText.green>>8, gdkHText.blue>>8); | - | ||||||||||||||||||||||||||||||||||||
3030 | item.palette.setBrush(QPalette::HighlightedText, highlightedTextColor); | - | ||||||||||||||||||||||||||||||||||||
3031 | item.palette.setBrush(QPalette::Text, normalTextColor); | - | ||||||||||||||||||||||||||||||||||||
3032 | item.palette.setBrush(QPalette::ButtonText, normalTextColor); | - | ||||||||||||||||||||||||||||||||||||
3033 | QCommonStyle::drawControl(element, &item, painter, widget); | - | ||||||||||||||||||||||||||||||||||||
3034 | - | |||||||||||||||||||||||||||||||||||||
3035 | if (act) {
| 0 | ||||||||||||||||||||||||||||||||||||
3036 | GtkShadowType shadowType = GTK_SHADOW_NONE; | - | ||||||||||||||||||||||||||||||||||||
3037 | d->gtk_widget_style_get (gtkMenubarItem, "selected-shadow-type", &shadowType, NULL); | - | ||||||||||||||||||||||||||||||||||||
3038 | gtkPainter->paintBox(gtkMenubarItem, "menuitem", option->rect.adjusted(0, 0, 0, 3), | - | ||||||||||||||||||||||||||||||||||||
3039 | GTK_STATE_PRELIGHT, shadowType, style); | - | ||||||||||||||||||||||||||||||||||||
3040 | //draw text | - | ||||||||||||||||||||||||||||||||||||
3041 | QPalette::ColorRole textRole = dis ? QPalette::Text : QPalette::HighlightedText;
| 0 | ||||||||||||||||||||||||||||||||||||
3042 | uint alignment = Qt::AlignCenter | Qt::TextShowMnemonic | Qt::TextDontClip | Qt::TextSingleLine; | - | ||||||||||||||||||||||||||||||||||||
3043 | - | |||||||||||||||||||||||||||||||||||||
3044 | if (!proxy()->styleHint(SH_UnderlineShortcut, mbi, widget))
| 0 | ||||||||||||||||||||||||||||||||||||
3045 | alignment |= Qt::TextHideMnemonic; never executed: alignment |= Qt::TextHideMnemonic; | 0 | ||||||||||||||||||||||||||||||||||||
3046 | - | |||||||||||||||||||||||||||||||||||||
3047 | proxy()->drawItemText(painter, item.rect, alignment, item.palette, mbi->state & State_Enabled, mbi->text, textRole); | - | ||||||||||||||||||||||||||||||||||||
3048 | } never executed: end of block | 0 | ||||||||||||||||||||||||||||||||||||
3049 | } never executed: end of block | 0 | ||||||||||||||||||||||||||||||||||||
3050 | painter->restore(); | - | ||||||||||||||||||||||||||||||||||||
3051 | break; never executed: break; | 0 | ||||||||||||||||||||||||||||||||||||
3052 | - | |||||||||||||||||||||||||||||||||||||
3053 | case CE_Splitter: { never executed: case CE_Splitter: | 0 | ||||||||||||||||||||||||||||||||||||
3054 | GtkWidget *gtkWindow = d->gtkWidget("GtkWindow"); // The Murrine Engine currently assumes a widget is passed | - | ||||||||||||||||||||||||||||||||||||
3055 | gtkPainter->paintHandle(gtkWindow, "splitter", option->rect, qt_gtk_state(option), GTK_SHADOW_NONE, | - | ||||||||||||||||||||||||||||||||||||
3056 | !(option->state & State_Horizontal) ? GTK_ORIENTATION_HORIZONTAL : GTK_ORIENTATION_VERTICAL, | - | ||||||||||||||||||||||||||||||||||||
3057 | style); | - | ||||||||||||||||||||||||||||||||||||
3058 | } | - | ||||||||||||||||||||||||||||||||||||
3059 | break; never executed: break; | 0 | ||||||||||||||||||||||||||||||||||||
3060 | - | |||||||||||||||||||||||||||||||||||||
3061 | #ifndef QT_NO_TOOLBAR | - | ||||||||||||||||||||||||||||||||||||
3062 | - | |||||||||||||||||||||||||||||||||||||
3063 | case CE_ToolBar: never executed: case CE_ToolBar: | 0 | ||||||||||||||||||||||||||||||||||||
3064 | if (const QStyleOptionToolBar *toolbar = qstyleoption_cast<const QStyleOptionToolBar *>(option)) {
| 0 | ||||||||||||||||||||||||||||||||||||
3065 | // Reserve the beveled appearance only for mainwindow toolbars | - | ||||||||||||||||||||||||||||||||||||
3066 | if (!(widget && qobject_cast<const QMainWindow*> (widget->parentWidget())))
| 0 | ||||||||||||||||||||||||||||||||||||
3067 | break; never executed: break; | 0 | ||||||||||||||||||||||||||||||||||||
3068 | - | |||||||||||||||||||||||||||||||||||||
3069 | QRect rect = option->rect; | - | ||||||||||||||||||||||||||||||||||||
3070 | // There is a 1 pixel gap between toolbar lines in some styles (i.e Human) | - | ||||||||||||||||||||||||||||||||||||
3071 | if (toolbar->positionWithinLine != QStyleOptionToolBar::End)
| 0 | ||||||||||||||||||||||||||||||||||||
3072 | rect.adjust(0, 0, 1, 0); never executed: rect.adjust(0, 0, 1, 0); | 0 | ||||||||||||||||||||||||||||||||||||
3073 | - | |||||||||||||||||||||||||||||||||||||
3074 | GtkWidget *gtkToolbar = d->gtkWidget("GtkToolbar"); | - | ||||||||||||||||||||||||||||||||||||
3075 | GtkShadowType shadow_type = GTK_SHADOW_NONE; | - | ||||||||||||||||||||||||||||||||||||
3076 | d->gtk_widget_style_get(gtkToolbar, "shadow-type", &shadow_type, NULL); | - | ||||||||||||||||||||||||||||||||||||
3077 | gtkPainter->paintBox(gtkToolbar, "toolbar", rect, | - | ||||||||||||||||||||||||||||||||||||
3078 | GTK_STATE_NORMAL, shadow_type, d->gtk_widget_get_style(gtkToolbar)); | - | ||||||||||||||||||||||||||||||||||||
3079 | } never executed: end of block | 0 | ||||||||||||||||||||||||||||||||||||
3080 | break; never executed: break; | 0 | ||||||||||||||||||||||||||||||||||||
3081 | - | |||||||||||||||||||||||||||||||||||||
3082 | #endif // QT_NO_TOOLBAR | - | ||||||||||||||||||||||||||||||||||||
3083 | - | |||||||||||||||||||||||||||||||||||||
3084 | case CE_MenuItem: never executed: case CE_MenuItem: | 0 | ||||||||||||||||||||||||||||||||||||
3085 | painter->save(); | - | ||||||||||||||||||||||||||||||||||||
3086 | - | |||||||||||||||||||||||||||||||||||||
3087 | // Draws one item in a popup menu. | - | ||||||||||||||||||||||||||||||||||||
3088 | if (const QStyleOptionMenuItem *menuItem = qstyleoption_cast<const QStyleOptionMenuItem *>(option)) {
| 0 | ||||||||||||||||||||||||||||||||||||
3089 | const int windowsItemHMargin = 3; // menu item hor text margin | - | ||||||||||||||||||||||||||||||||||||
3090 | const int windowsItemVMargin = 26; // menu item ver text margin | - | ||||||||||||||||||||||||||||||||||||
3091 | GtkWidget *gtkMenuItem = menuItem->checked ? d->gtkWidget("GtkMenu.GtkCheckMenuItem") :
| 0 | ||||||||||||||||||||||||||||||||||||
3092 | d->gtkWidget("GtkMenu.GtkMenuItem"); | - | ||||||||||||||||||||||||||||||||||||
3093 | - | |||||||||||||||||||||||||||||||||||||
3094 | style = d->gtk_widget_get_style(gtkMenuItem); | - | ||||||||||||||||||||||||||||||||||||
3095 | QColor shadow = option->palette.dark().color(); | - | ||||||||||||||||||||||||||||||||||||
3096 | - | |||||||||||||||||||||||||||||||||||||
3097 | if (menuItem->menuItemType == QStyleOptionMenuItem::Separator) {
| 0 | ||||||||||||||||||||||||||||||||||||
3098 | GtkWidget *gtkMenuSeparator = d->gtkWidget("GtkMenu.GtkSeparatorMenuItem"); | - | ||||||||||||||||||||||||||||||||||||
3099 | painter->setPen(shadow.lighter(106)); | - | ||||||||||||||||||||||||||||||||||||
3100 | gboolean wide_separators = 0; | - | ||||||||||||||||||||||||||||||||||||
3101 | gint separator_height = 0; | - | ||||||||||||||||||||||||||||||||||||
3102 | guint horizontal_padding = 3; | - | ||||||||||||||||||||||||||||||||||||
3103 | QRect separatorRect = option->rect; | - | ||||||||||||||||||||||||||||||||||||
3104 | if (!d->gtk_check_version(2, 10, 0)) {
| 0 | ||||||||||||||||||||||||||||||||||||
3105 | d->gtk_widget_style_get(gtkMenuSeparator, | - | ||||||||||||||||||||||||||||||||||||
3106 | "wide-separators", &wide_separators, | - | ||||||||||||||||||||||||||||||||||||
3107 | "separator-height", &separator_height, | - | ||||||||||||||||||||||||||||||||||||
3108 | "horizontal-padding", &horizontal_padding, | - | ||||||||||||||||||||||||||||||||||||
3109 | NULL); | - | ||||||||||||||||||||||||||||||||||||
3110 | } never executed: end of block | 0 | ||||||||||||||||||||||||||||||||||||
3111 | GtkStyle *gtkMenuSeparatorStyle = d->gtk_widget_get_style(gtkMenuSeparator); | - | ||||||||||||||||||||||||||||||||||||
3112 | separatorRect.setHeight(option->rect.height() - 2 * gtkMenuSeparatorStyle->ythickness); | - | ||||||||||||||||||||||||||||||||||||
3113 | separatorRect.setWidth(option->rect.width() - 2 * (horizontal_padding + gtkMenuSeparatorStyle->xthickness)); | - | ||||||||||||||||||||||||||||||||||||
3114 | separatorRect.moveCenter(option->rect.center()); | - | ||||||||||||||||||||||||||||||||||||
3115 | if (wide_separators)
| 0 | ||||||||||||||||||||||||||||||||||||
3116 | gtkPainter->paintBox(gtkMenuSeparator, "hseparator", never executed: gtkPainter->paintBox(gtkMenuSeparator, "hseparator", separatorRect, GTK_STATE_NORMAL, GTK_SHADOW_NONE, gtkMenuSeparatorStyle); | 0 | ||||||||||||||||||||||||||||||||||||
3117 | separatorRect, GTK_STATE_NORMAL, GTK_SHADOW_NONE, gtkMenuSeparatorStyle); never executed: gtkPainter->paintBox(gtkMenuSeparator, "hseparator", separatorRect, GTK_STATE_NORMAL, GTK_SHADOW_NONE, gtkMenuSeparatorStyle); | 0 | ||||||||||||||||||||||||||||||||||||
3118 | else | - | ||||||||||||||||||||||||||||||||||||
3119 | gtkPainter->paintHline(gtkMenuSeparator, "hseparator", never executed: gtkPainter->paintHline(gtkMenuSeparator, "hseparator", separatorRect, GTK_STATE_NORMAL, gtkMenuSeparatorStyle, 0, option->rect.right() - 1, 1); | 0 | ||||||||||||||||||||||||||||||||||||
3120 | separatorRect, GTK_STATE_NORMAL, gtkMenuSeparatorStyle, never executed: gtkPainter->paintHline(gtkMenuSeparator, "hseparator", separatorRect, GTK_STATE_NORMAL, gtkMenuSeparatorStyle, 0, option->rect.right() - 1, 1); | 0 | ||||||||||||||||||||||||||||||||||||
3121 | 0, option->rect.right() - 1, 1); never executed: gtkPainter->paintHline(gtkMenuSeparator, "hseparator", separatorRect, GTK_STATE_NORMAL, gtkMenuSeparatorStyle, 0, option->rect.right() - 1, 1); | 0 | ||||||||||||||||||||||||||||||||||||
3122 | painter->restore(); | - | ||||||||||||||||||||||||||||||||||||
3123 | break; never executed: break; | 0 | ||||||||||||||||||||||||||||||||||||
3124 | } | - | ||||||||||||||||||||||||||||||||||||
3125 | - | |||||||||||||||||||||||||||||||||||||
3126 | bool selected = menuItem->state & State_Selected && menuItem->state & State_Enabled;
| 0 | ||||||||||||||||||||||||||||||||||||
3127 | - | |||||||||||||||||||||||||||||||||||||
3128 | if (selected) {
| 0 | ||||||||||||||||||||||||||||||||||||
3129 | QRect rect = option->rect; | - | ||||||||||||||||||||||||||||||||||||
3130 | #ifndef QT_NO_COMBOBOX | - | ||||||||||||||||||||||||||||||||||||
3131 | if (qobject_cast<const QComboBox*>(widget))
| 0 | ||||||||||||||||||||||||||||||||||||
3132 | rect = option->rect; never executed: rect = option->rect; | 0 | ||||||||||||||||||||||||||||||||||||
3133 | #endif | - | ||||||||||||||||||||||||||||||||||||
3134 | gtkPainter->paintBox(gtkMenuItem, "menuitem", rect, GTK_STATE_PRELIGHT, GTK_SHADOW_OUT, style); | - | ||||||||||||||||||||||||||||||||||||
3135 | } never executed: end of block | 0 | ||||||||||||||||||||||||||||||||||||
3136 | - | |||||||||||||||||||||||||||||||||||||
3137 | bool checkable = menuItem->checkType != QStyleOptionMenuItem::NotCheckable; | - | ||||||||||||||||||||||||||||||||||||
3138 | bool checked = menuItem->checked; | - | ||||||||||||||||||||||||||||||||||||
3139 | bool enabled = menuItem->state & State_Enabled; | - | ||||||||||||||||||||||||||||||||||||
3140 | bool ignoreCheckMark = false; | - | ||||||||||||||||||||||||||||||||||||
3141 | - | |||||||||||||||||||||||||||||||||||||
3142 | gint checkSize; | - | ||||||||||||||||||||||||||||||||||||
3143 | d->gtk_widget_style_get(d->gtkWidget("GtkMenu.GtkCheckMenuItem"), "indicator-size", &checkSize, NULL); | - | ||||||||||||||||||||||||||||||||||||
3144 | - | |||||||||||||||||||||||||||||||||||||
3145 | int checkcol = qMax(menuItem->maxIconWidth, qMax(20, checkSize)); | - | ||||||||||||||||||||||||||||||||||||
3146 | - | |||||||||||||||||||||||||||||||||||||
3147 | #ifndef QT_NO_COMBOBOX | - | ||||||||||||||||||||||||||||||||||||
3148 | - | |||||||||||||||||||||||||||||||||||||
3149 | if (qobject_cast<const QComboBox*>(widget) ||
| 0 | ||||||||||||||||||||||||||||||||||||
3150 | (option->styleObject && option->styleObject->property("_q_isComboBoxPopupItem").toBool()))
| 0 | ||||||||||||||||||||||||||||||||||||
3151 | ignoreCheckMark = true; // Ignore the checkmarks provided by the QComboMenuDelegate never executed: ignoreCheckMark = true; | 0 | ||||||||||||||||||||||||||||||||||||
3152 | - | |||||||||||||||||||||||||||||||||||||
3153 | #endif | - | ||||||||||||||||||||||||||||||||||||
3154 | if (!ignoreCheckMark) {
| 0 | ||||||||||||||||||||||||||||||||||||
3155 | // Check | - | ||||||||||||||||||||||||||||||||||||
3156 | QRect checkRect(option->rect.left() + 7, option->rect.center().y() - checkSize/2 + 1, checkSize, checkSize); | - | ||||||||||||||||||||||||||||||||||||
3157 | checkRect = visualRect(menuItem->direction, menuItem->rect, checkRect); | - | ||||||||||||||||||||||||||||||||||||
3158 | - | |||||||||||||||||||||||||||||||||||||
3159 | if (checkable && menuItem->icon.isNull()) {
| 0 | ||||||||||||||||||||||||||||||||||||
3160 | // Some themes such as aero-clone draw slightly outside the paint rect | - | ||||||||||||||||||||||||||||||||||||
3161 | int spacing = 1; // ### Consider using gtkCheckBox : "indicator-spacing" instead | - | ||||||||||||||||||||||||||||||||||||
3162 | - | |||||||||||||||||||||||||||||||||||||
3163 | if (menuItem->checkType & QStyleOptionMenuItem::Exclusive) {
| 0 | ||||||||||||||||||||||||||||||||||||
3164 | // Radio button | - | ||||||||||||||||||||||||||||||||||||
3165 | GtkShadowType shadow = GTK_SHADOW_OUT; | - | ||||||||||||||||||||||||||||||||||||
3166 | GtkStateType state = qt_gtk_state(option); | - | ||||||||||||||||||||||||||||||||||||
3167 | - | |||||||||||||||||||||||||||||||||||||
3168 | if (selected)
| 0 | ||||||||||||||||||||||||||||||||||||
3169 | state = GTK_STATE_PRELIGHT; never executed: state = GTK_STATE_PRELIGHT; | 0 | ||||||||||||||||||||||||||||||||||||
3170 | if (checked)
| 0 | ||||||||||||||||||||||||||||||||||||
3171 | shadow = GTK_SHADOW_IN; never executed: shadow = GTK_SHADOW_IN; | 0 | ||||||||||||||||||||||||||||||||||||
3172 | - | |||||||||||||||||||||||||||||||||||||
3173 | gtkPainter->setClipRect(checkRect.adjusted(-spacing, -spacing, spacing, spacing)); | - | ||||||||||||||||||||||||||||||||||||
3174 | gtkPainter->paintOption(gtkMenuItem, checkRect.translated(-spacing, -spacing), state, shadow, | - | ||||||||||||||||||||||||||||||||||||
3175 | style, QLS("option")); | - | ||||||||||||||||||||||||||||||||||||
3176 | gtkPainter->setClipRect(QRect()); | - | ||||||||||||||||||||||||||||||||||||
3177 | - | |||||||||||||||||||||||||||||||||||||
3178 | } else { never executed: end of block | 0 | ||||||||||||||||||||||||||||||||||||
3179 | // Check box | - | ||||||||||||||||||||||||||||||||||||
3180 | if (menuItem->icon.isNull()) {
| 0 | ||||||||||||||||||||||||||||||||||||
3181 | GtkShadowType shadow = GTK_SHADOW_OUT; | - | ||||||||||||||||||||||||||||||||||||
3182 | GtkStateType state = qt_gtk_state(option); | - | ||||||||||||||||||||||||||||||||||||
3183 | - | |||||||||||||||||||||||||||||||||||||
3184 | if (selected)
| 0 | ||||||||||||||||||||||||||||||||||||
3185 | state = GTK_STATE_PRELIGHT; never executed: state = GTK_STATE_PRELIGHT; | 0 | ||||||||||||||||||||||||||||||||||||
3186 | if (checked)
| 0 | ||||||||||||||||||||||||||||||||||||
3187 | shadow = GTK_SHADOW_IN; never executed: shadow = GTK_SHADOW_IN; | 0 | ||||||||||||||||||||||||||||||||||||
3188 | - | |||||||||||||||||||||||||||||||||||||
3189 | gtkPainter->setClipRect(checkRect.adjusted(-spacing, -spacing, -spacing, -spacing)); | - | ||||||||||||||||||||||||||||||||||||
3190 | gtkPainter->paintCheckbox(gtkMenuItem, checkRect.translated(-spacing, -spacing), state, shadow, | - | ||||||||||||||||||||||||||||||||||||
3191 | style, QLS("check")); | - | ||||||||||||||||||||||||||||||||||||
3192 | gtkPainter->setClipRect(QRect()); | - | ||||||||||||||||||||||||||||||||||||
3193 | } never executed: end of block | 0 | ||||||||||||||||||||||||||||||||||||
3194 | } never executed: end of block | 0 | ||||||||||||||||||||||||||||||||||||
3195 | } | - | ||||||||||||||||||||||||||||||||||||
3196 | - | |||||||||||||||||||||||||||||||||||||
3197 | } else { never executed: end of block | 0 | ||||||||||||||||||||||||||||||||||||
3198 | // Ignore checkmark | - | ||||||||||||||||||||||||||||||||||||
3199 | if (menuItem->icon.isNull())
| 0 | ||||||||||||||||||||||||||||||||||||
3200 | checkcol = 0; never executed: checkcol = 0; | 0 | ||||||||||||||||||||||||||||||||||||
3201 | else | - | ||||||||||||||||||||||||||||||||||||
3202 | checkcol = menuItem->maxIconWidth; never executed: checkcol = menuItem->maxIconWidth; | 0 | ||||||||||||||||||||||||||||||||||||
3203 | } | - | ||||||||||||||||||||||||||||||||||||
3204 | - | |||||||||||||||||||||||||||||||||||||
3205 | bool dis = !(menuItem->state & State_Enabled); | - | ||||||||||||||||||||||||||||||||||||
3206 | bool act = menuItem->state & State_Selected; | - | ||||||||||||||||||||||||||||||||||||
3207 | const QStyleOption *opt = option; | - | ||||||||||||||||||||||||||||||||||||
3208 | const QStyleOptionMenuItem *menuitem = menuItem; | - | ||||||||||||||||||||||||||||||||||||
3209 | QPainter *p = painter; | - | ||||||||||||||||||||||||||||||||||||
3210 | QRect vCheckRect = visualRect(opt->direction, menuitem->rect, | - | ||||||||||||||||||||||||||||||||||||
3211 | QRect(menuitem->rect.x() + 3, menuitem->rect.y(), | - | ||||||||||||||||||||||||||||||||||||
3212 | checkcol, menuitem->rect.height())); | - | ||||||||||||||||||||||||||||||||||||
3213 | - | |||||||||||||||||||||||||||||||||||||
3214 | if (!menuItem->icon.isNull()) {
| 0 | ||||||||||||||||||||||||||||||||||||
3215 | QIcon::Mode mode = dis ? QIcon::Disabled : QIcon::Normal;
| 0 | ||||||||||||||||||||||||||||||||||||
3216 | - | |||||||||||||||||||||||||||||||||||||
3217 | if (act && !dis)
| 0 | ||||||||||||||||||||||||||||||||||||
3218 | mode = QIcon::Active; never executed: mode = QIcon::Active; | 0 | ||||||||||||||||||||||||||||||||||||
3219 | - | |||||||||||||||||||||||||||||||||||||
3220 | QPixmap pixmap; | - | ||||||||||||||||||||||||||||||||||||
3221 | int smallIconSize = proxy()->pixelMetric(PM_SmallIconSize, option, widget); | - | ||||||||||||||||||||||||||||||||||||
3222 | QSize iconSize(smallIconSize, smallIconSize); | - | ||||||||||||||||||||||||||||||||||||
3223 | - | |||||||||||||||||||||||||||||||||||||
3224 | #ifndef QT_NO_COMBOBOX | - | ||||||||||||||||||||||||||||||||||||
3225 | if (const QComboBox *combo = qobject_cast<const QComboBox*>(widget))
| 0 | ||||||||||||||||||||||||||||||||||||
3226 | iconSize = combo->iconSize(); never executed: iconSize = combo->iconSize(); | 0 | ||||||||||||||||||||||||||||||||||||
3227 | - | |||||||||||||||||||||||||||||||||||||
3228 | #endif // QT_NO_COMBOBOX | - | ||||||||||||||||||||||||||||||||||||
3229 | if (checked)
| 0 | ||||||||||||||||||||||||||||||||||||
3230 | pixmap = menuItem->icon.pixmap(iconSize, mode, QIcon::On); never executed: pixmap = menuItem->icon.pixmap(iconSize, mode, QIcon::On); | 0 | ||||||||||||||||||||||||||||||||||||
3231 | else | - | ||||||||||||||||||||||||||||||||||||
3232 | pixmap = menuItem->icon.pixmap(iconSize, mode); never executed: pixmap = menuItem->icon.pixmap(iconSize, mode); | 0 | ||||||||||||||||||||||||||||||||||||
3233 | - | |||||||||||||||||||||||||||||||||||||
3234 | const int pixw = pixmap.width() / pixmap.devicePixelRatio(); | - | ||||||||||||||||||||||||||||||||||||
3235 | const int pixh = pixmap.height() / pixmap.devicePixelRatio(); | - | ||||||||||||||||||||||||||||||||||||
3236 | QRect pmr(0, 0, pixw, pixh); | - | ||||||||||||||||||||||||||||||||||||
3237 | pmr.moveCenter(vCheckRect.center() - QPoint(0, 1)); | - | ||||||||||||||||||||||||||||||||||||
3238 | painter->setPen(menuItem->palette.text().color()); | - | ||||||||||||||||||||||||||||||||||||
3239 | if (!ignoreCheckMark && checkable && checked) {
| 0 | ||||||||||||||||||||||||||||||||||||
3240 | QStyleOption opt = *option; | - | ||||||||||||||||||||||||||||||||||||
3241 | - | |||||||||||||||||||||||||||||||||||||
3242 | if (act) {
| 0 | ||||||||||||||||||||||||||||||||||||
3243 | QColor activeColor = mergedColors(option->palette.background().color(), | - | ||||||||||||||||||||||||||||||||||||
3244 | option->palette.highlight().color()); | - | ||||||||||||||||||||||||||||||||||||
3245 | opt.palette.setBrush(QPalette::Button, activeColor); | - | ||||||||||||||||||||||||||||||||||||
3246 | } never executed: end of block | 0 | ||||||||||||||||||||||||||||||||||||
3247 | opt.state |= State_Sunken; | - | ||||||||||||||||||||||||||||||||||||
3248 | opt.rect = vCheckRect; | - | ||||||||||||||||||||||||||||||||||||
3249 | proxy()->drawPrimitive(PE_PanelButtonCommand, &opt, painter, widget); | - | ||||||||||||||||||||||||||||||||||||
3250 | } never executed: end of block | 0 | ||||||||||||||||||||||||||||||||||||
3251 | painter->drawPixmap(pmr.topLeft(), pixmap); | - | ||||||||||||||||||||||||||||||||||||
3252 | } never executed: end of block | 0 | ||||||||||||||||||||||||||||||||||||
3253 | - | |||||||||||||||||||||||||||||||||||||
3254 | GdkColor gdkText = style->fg[GTK_STATE_NORMAL]; | - | ||||||||||||||||||||||||||||||||||||
3255 | GdkColor gdkDText = style->fg[GTK_STATE_INSENSITIVE]; | - | ||||||||||||||||||||||||||||||||||||
3256 | GdkColor gdkHText = style->fg[GTK_STATE_PRELIGHT]; | - | ||||||||||||||||||||||||||||||||||||
3257 | uint resolve_mask = option->palette.resolve(); | - | ||||||||||||||||||||||||||||||||||||
3258 | QColor textColor = QColor(gdkText.red>>8, gdkText.green>>8, gdkText.blue>>8); | - | ||||||||||||||||||||||||||||||||||||
3259 | QColor disabledTextColor = QColor(gdkDText.red>>8, gdkDText.green>>8, gdkDText.blue>>8); | - | ||||||||||||||||||||||||||||||||||||
3260 | if (resolve_mask & (1 << QPalette::ButtonText)) {
| 0 | ||||||||||||||||||||||||||||||||||||
3261 | textColor = option->palette.buttonText().color(); | - | ||||||||||||||||||||||||||||||||||||
3262 | disabledTextColor = option->palette.brush(QPalette::Disabled, QPalette::ButtonText).color(); | - | ||||||||||||||||||||||||||||||||||||
3263 | } never executed: end of block | 0 | ||||||||||||||||||||||||||||||||||||
3264 | - | |||||||||||||||||||||||||||||||||||||
3265 | QColor highlightedTextColor = QColor(gdkHText.red>>8, gdkHText.green>>8, gdkHText.blue>>8); | - | ||||||||||||||||||||||||||||||||||||
3266 | if (resolve_mask & (1 << QPalette::HighlightedText)) {
| 0 | ||||||||||||||||||||||||||||||||||||
3267 | highlightedTextColor = option->palette.highlightedText().color(); | - | ||||||||||||||||||||||||||||||||||||
3268 | } never executed: end of block | 0 | ||||||||||||||||||||||||||||||||||||
3269 | - | |||||||||||||||||||||||||||||||||||||
3270 | if (selected)
| 0 | ||||||||||||||||||||||||||||||||||||
3271 | painter->setPen(highlightedTextColor); never executed: painter->setPen(highlightedTextColor); | 0 | ||||||||||||||||||||||||||||||||||||
3272 | else | - | ||||||||||||||||||||||||||||||||||||
3273 | painter->setPen(textColor); never executed: painter->setPen(textColor); | 0 | ||||||||||||||||||||||||||||||||||||
3274 | - | |||||||||||||||||||||||||||||||||||||
3275 | int x, y, w, h; | - | ||||||||||||||||||||||||||||||||||||
3276 | menuitem->rect.getRect(&x, &y, &w, &h); | - | ||||||||||||||||||||||||||||||||||||
3277 | int tab = menuitem->tabWidth; | - | ||||||||||||||||||||||||||||||||||||
3278 | int xm = QGtkStylePrivate::menuItemFrame + checkcol + windowsItemHMargin; | - | ||||||||||||||||||||||||||||||||||||
3279 | int xpos = menuitem->rect.x() + xm + 1; | - | ||||||||||||||||||||||||||||||||||||
3280 | QRect textRect(xpos, y + windowsItemVMargin, w - xm - QGtkStylePrivate::menuRightBorder - tab + 1, h - 2 * windowsItemVMargin); | - | ||||||||||||||||||||||||||||||||||||
3281 | QRect vTextRect = visualRect(opt->direction, menuitem->rect, textRect); | - | ||||||||||||||||||||||||||||||||||||
3282 | QString s = menuitem->text; | - | ||||||||||||||||||||||||||||||||||||
3283 | - | |||||||||||||||||||||||||||||||||||||
3284 | if (!s.isEmpty()) { // Draw text
| 0 | ||||||||||||||||||||||||||||||||||||
3285 | p->save(); | - | ||||||||||||||||||||||||||||||||||||
3286 | int t = s.indexOf(QLatin1Char('\t')); | - | ||||||||||||||||||||||||||||||||||||
3287 | int text_flags = Qt::AlignVCenter | Qt::TextShowMnemonic | Qt::TextDontClip | Qt::TextSingleLine; | - | ||||||||||||||||||||||||||||||||||||
3288 | - | |||||||||||||||||||||||||||||||||||||
3289 | if (!proxy()->styleHint(SH_UnderlineShortcut, menuitem, widget))
| 0 | ||||||||||||||||||||||||||||||||||||
3290 | text_flags |= Qt::TextHideMnemonic; never executed: text_flags |= Qt::TextHideMnemonic; | 0 | ||||||||||||||||||||||||||||||||||||
3291 | - | |||||||||||||||||||||||||||||||||||||
3292 | // Draw shortcut right aligned | - | ||||||||||||||||||||||||||||||||||||
3293 | text_flags |= Qt::AlignRight; | - | ||||||||||||||||||||||||||||||||||||
3294 | - | |||||||||||||||||||||||||||||||||||||
3295 | if (t >= 0) {
| 0 | ||||||||||||||||||||||||||||||||||||
3296 | int rightMargin = 12; // Hardcode for now | - | ||||||||||||||||||||||||||||||||||||
3297 | QRect vShortcutRect = visualRect(opt->direction, menuitem->rect, | - | ||||||||||||||||||||||||||||||||||||
3298 | QRect(textRect.topRight(), QPoint(menuitem->rect.right() - rightMargin, textRect.bottom()))); | - | ||||||||||||||||||||||||||||||||||||
3299 | - | |||||||||||||||||||||||||||||||||||||
3300 | if (dis)
| 0 | ||||||||||||||||||||||||||||||||||||
3301 | p->setPen(disabledTextColor); never executed: p->setPen(disabledTextColor); | 0 | ||||||||||||||||||||||||||||||||||||
3302 | p->drawText(vShortcutRect, text_flags , s.mid(t + 1)); | - | ||||||||||||||||||||||||||||||||||||
3303 | s = s.left(t); | - | ||||||||||||||||||||||||||||||||||||
3304 | } never executed: end of block | 0 | ||||||||||||||||||||||||||||||||||||
3305 | - | |||||||||||||||||||||||||||||||||||||
3306 | text_flags &= ~Qt::AlignRight; | - | ||||||||||||||||||||||||||||||||||||
3307 | text_flags |= Qt::AlignLeft; | - | ||||||||||||||||||||||||||||||||||||
3308 | QFont font = menuitem->font; | - | ||||||||||||||||||||||||||||||||||||
3309 | if (menuitem->menuItemType == QStyleOptionMenuItem::DefaultItem)
| 0 | ||||||||||||||||||||||||||||||||||||
3310 | font.setBold(true); never executed: font.setBold(true); | 0 | ||||||||||||||||||||||||||||||||||||
3311 | p->setFont(font); | - | ||||||||||||||||||||||||||||||||||||
3312 | - | |||||||||||||||||||||||||||||||||||||
3313 | if (dis)
| 0 | ||||||||||||||||||||||||||||||||||||
3314 | p->setPen(disabledTextColor); never executed: p->setPen(disabledTextColor); | 0 | ||||||||||||||||||||||||||||||||||||
3315 | p->drawText(vTextRect, text_flags, s.left(t)); | - | ||||||||||||||||||||||||||||||||||||
3316 | p->restore(); | - | ||||||||||||||||||||||||||||||||||||
3317 | } never executed: end of block | 0 | ||||||||||||||||||||||||||||||||||||
3318 | - | |||||||||||||||||||||||||||||||||||||
3319 | // Arrow | - | ||||||||||||||||||||||||||||||||||||
3320 | if (menuItem->menuItemType == QStyleOptionMenuItem::SubMenu) {// draw sub menu arrow
| 0 | ||||||||||||||||||||||||||||||||||||
3321 | - | |||||||||||||||||||||||||||||||||||||
3322 | QFontMetrics fm(menuitem->font); | - | ||||||||||||||||||||||||||||||||||||
3323 | int arrow_size = fm.ascent() + fm.descent() - 2 * style->ythickness; | - | ||||||||||||||||||||||||||||||||||||
3324 | gfloat arrow_scaling = 0.8; | - | ||||||||||||||||||||||||||||||||||||
3325 | int extra = 0; | - | ||||||||||||||||||||||||||||||||||||
3326 | if (!d->gtk_check_version(2, 16, 0)) {
| 0 | ||||||||||||||||||||||||||||||||||||
3327 | // "arrow-scaling" is actually hardcoded and fails on hardy (see gtk+-2.12/gtkmenuitem.c) | - | ||||||||||||||||||||||||||||||||||||
3328 | // though the current documentation states otherwise | - | ||||||||||||||||||||||||||||||||||||
3329 | d->gtk_widget_style_get(gtkMenuItem, "arrow-scaling", &arrow_scaling, NULL); | - | ||||||||||||||||||||||||||||||||||||
3330 | // in versions < 2.16 ythickness was previously subtracted from the arrow_size | - | ||||||||||||||||||||||||||||||||||||
3331 | extra = 2 * style->ythickness; | - | ||||||||||||||||||||||||||||||||||||
3332 | } never executed: end of block | 0 | ||||||||||||||||||||||||||||||||||||
3333 | - | |||||||||||||||||||||||||||||||||||||
3334 | int horizontal_padding; | - | ||||||||||||||||||||||||||||||||||||
3335 | d->gtk_widget_style_get(gtkMenuItem, "horizontal-padding", &horizontal_padding, NULL); | - | ||||||||||||||||||||||||||||||||||||
3336 | - | |||||||||||||||||||||||||||||||||||||
3337 | const int dim = static_cast<int>(arrow_size * arrow_scaling) + extra; | - | ||||||||||||||||||||||||||||||||||||
3338 | int xpos = menuItem->rect.left() + menuItem->rect.width() - horizontal_padding - dim; | - | ||||||||||||||||||||||||||||||||||||
3339 | QRect vSubMenuRect = visualRect(option->direction, menuItem->rect, | - | ||||||||||||||||||||||||||||||||||||
3340 | QRect(xpos, menuItem->rect.top() + | - | ||||||||||||||||||||||||||||||||||||
3341 | menuItem->rect.height() / 2 - dim / 2, dim, dim)); | - | ||||||||||||||||||||||||||||||||||||
3342 | GtkStateType state = enabled ? (act ? GTK_STATE_PRELIGHT: GTK_STATE_NORMAL) : GTK_STATE_INSENSITIVE;
| 0 | ||||||||||||||||||||||||||||||||||||
3343 | GtkShadowType shadowType = (state == GTK_STATE_PRELIGHT) ? GTK_SHADOW_OUT : GTK_SHADOW_IN;
| 0 | ||||||||||||||||||||||||||||||||||||
3344 | gtkPainter->paintArrow(gtkMenuItem, "menuitem", vSubMenuRect, option->direction == Qt::RightToLeft ? GTK_ARROW_LEFT : GTK_ARROW_RIGHT, state, | - | ||||||||||||||||||||||||||||||||||||
3345 | shadowType, false, style); | - | ||||||||||||||||||||||||||||||||||||
3346 | } never executed: end of block | 0 | ||||||||||||||||||||||||||||||||||||
3347 | } never executed: end of block | 0 | ||||||||||||||||||||||||||||||||||||
3348 | painter->restore(); | - | ||||||||||||||||||||||||||||||||||||
3349 | break; never executed: break; | 0 | ||||||||||||||||||||||||||||||||||||
3350 | - | |||||||||||||||||||||||||||||||||||||
3351 | case CE_PushButton: never executed: case CE_PushButton: | 0 | ||||||||||||||||||||||||||||||||||||
3352 | if (const QStyleOptionButton *btn = qstyleoption_cast<const QStyleOptionButton *>(option)) {
| 0 | ||||||||||||||||||||||||||||||||||||
3353 | GtkWidget *gtkButton = d->gtkWidget("GtkButton"); | - | ||||||||||||||||||||||||||||||||||||
3354 | proxy()->drawControl(CE_PushButtonBevel, btn, painter, widget); | - | ||||||||||||||||||||||||||||||||||||
3355 | QStyleOptionButton subopt = *btn; | - | ||||||||||||||||||||||||||||||||||||
3356 | subopt.rect = subElementRect(SE_PushButtonContents, btn, widget); | - | ||||||||||||||||||||||||||||||||||||
3357 | gint interiorFocus = true; | - | ||||||||||||||||||||||||||||||||||||
3358 | d->gtk_widget_style_get(gtkButton, "interior-focus", &interiorFocus, NULL); | - | ||||||||||||||||||||||||||||||||||||
3359 | GtkStyle *gtkButtonStyle = d->gtk_widget_get_style(gtkButton); | - | ||||||||||||||||||||||||||||||||||||
3360 | int xt = interiorFocus ? gtkButtonStyle->xthickness : 0;
| 0 | ||||||||||||||||||||||||||||||||||||
3361 | int yt = interiorFocus ? gtkButtonStyle->ythickness : 0;
| 0 | ||||||||||||||||||||||||||||||||||||
3362 | - | |||||||||||||||||||||||||||||||||||||
3363 | if (btn->features & QStyleOptionButton::Flat && btn->state & State_HasFocus)
| 0 | ||||||||||||||||||||||||||||||||||||
3364 | // The normal button focus rect does not work well for flat buttons in Clearlooks | - | ||||||||||||||||||||||||||||||||||||
3365 | proxy()->drawPrimitive(PE_FrameFocusRect, option, painter, widget); never executed: proxy()->drawPrimitive(PE_FrameFocusRect, option, painter, widget); | 0 | ||||||||||||||||||||||||||||||||||||
3366 | else if (btn->state & State_HasFocus)
| 0 | ||||||||||||||||||||||||||||||||||||
3367 | gtkPainter->paintFocus(gtkButton, "button", never executed: gtkPainter->paintFocus(gtkButton, "button", option->rect.adjusted(xt, yt, -xt, -yt), btn->state & State_Sunken ? GTK_STATE_ACTIVE : GTK_STATE_NORMAL, gtkButtonStyle); | 0 | ||||||||||||||||||||||||||||||||||||
3368 | option->rect.adjusted(xt, yt, -xt, -yt), never executed: gtkPainter->paintFocus(gtkButton, "button", option->rect.adjusted(xt, yt, -xt, -yt), btn->state & State_Sunken ? GTK_STATE_ACTIVE : GTK_STATE_NORMAL, gtkButtonStyle); | 0 | ||||||||||||||||||||||||||||||||||||
3369 | btn->state & State_Sunken ? GTK_STATE_ACTIVE : GTK_STATE_NORMAL, never executed: gtkPainter->paintFocus(gtkButton, "button", option->rect.adjusted(xt, yt, -xt, -yt), btn->state & State_Sunken ? GTK_STATE_ACTIVE : GTK_STATE_NORMAL, gtkButtonStyle); | 0 | ||||||||||||||||||||||||||||||||||||
3370 | gtkButtonStyle); never executed: gtkPainter->paintFocus(gtkButton, "button", option->rect.adjusted(xt, yt, -xt, -yt), btn->state & State_Sunken ? GTK_STATE_ACTIVE : GTK_STATE_NORMAL, gtkButtonStyle); | 0 | ||||||||||||||||||||||||||||||||||||
3371 | - | |||||||||||||||||||||||||||||||||||||
3372 | proxy()->drawControl(CE_PushButtonLabel, &subopt, painter, widget); | - | ||||||||||||||||||||||||||||||||||||
3373 | } never executed: end of block | 0 | ||||||||||||||||||||||||||||||||||||
3374 | break; never executed: break; | 0 | ||||||||||||||||||||||||||||||||||||
3375 | - | |||||||||||||||||||||||||||||||||||||
3376 | #ifndef QT_NO_TABBAR | - | ||||||||||||||||||||||||||||||||||||
3377 | - | |||||||||||||||||||||||||||||||||||||
3378 | case CE_TabBarTabShape: never executed: case CE_TabBarTabShape: | 0 | ||||||||||||||||||||||||||||||||||||
3379 | if (const QStyleOptionTab *tab = qstyleoption_cast<const QStyleOptionTab *>(option)) {
| 0 | ||||||||||||||||||||||||||||||||||||
3380 | GtkWidget *gtkNotebook = d->gtkWidget("GtkNotebook"); | - | ||||||||||||||||||||||||||||||||||||
3381 | style = d->gtk_widget_get_style(gtkNotebook); | - | ||||||||||||||||||||||||||||||||||||
3382 | - | |||||||||||||||||||||||||||||||||||||
3383 | QRect rect = option->rect; | - | ||||||||||||||||||||||||||||||||||||
3384 | GtkShadowType shadow = GTK_SHADOW_OUT; | - | ||||||||||||||||||||||||||||||||||||
3385 | GtkStateType state = GTK_STATE_ACTIVE; | - | ||||||||||||||||||||||||||||||||||||
3386 | if (tab->state & State_Selected)
| 0 | ||||||||||||||||||||||||||||||||||||
3387 | state = GTK_STATE_NORMAL; never executed: state = GTK_STATE_NORMAL; | 0 | ||||||||||||||||||||||||||||||||||||
3388 | - | |||||||||||||||||||||||||||||||||||||
3389 | bool selected = (tab->state & State_Selected); | - | ||||||||||||||||||||||||||||||||||||
3390 | bool first = false, last = false; | - | ||||||||||||||||||||||||||||||||||||
3391 | if (widget) {
| 0 | ||||||||||||||||||||||||||||||||||||
3392 | // This is most accurate and avoids resizing tabs while moving | - | ||||||||||||||||||||||||||||||||||||
3393 | first = tab->rect.left() == widget->rect().left(); | - | ||||||||||||||||||||||||||||||||||||
3394 | last = tab->rect.right() == widget->rect().right(); | - | ||||||||||||||||||||||||||||||||||||
3395 | } else if (option->direction == Qt::RightToLeft) { never executed: end of block
| 0 | ||||||||||||||||||||||||||||||||||||
3396 | bool tmp = first; | - | ||||||||||||||||||||||||||||||||||||
3397 | first = last; | - | ||||||||||||||||||||||||||||||||||||
3398 | last = tmp; | - | ||||||||||||||||||||||||||||||||||||
3399 | } never executed: end of block | 0 | ||||||||||||||||||||||||||||||||||||
3400 | int topIndent = 3; | - | ||||||||||||||||||||||||||||||||||||
3401 | int bottomIndent = 1; | - | ||||||||||||||||||||||||||||||||||||
3402 | int tabOverlap = 1; | - | ||||||||||||||||||||||||||||||||||||
3403 | painter->save(); | - | ||||||||||||||||||||||||||||||||||||
3404 | - | |||||||||||||||||||||||||||||||||||||
3405 | switch (tab->shape) { | - | ||||||||||||||||||||||||||||||||||||
3406 | case QTabBar::RoundedNorth: never executed: case QTabBar::RoundedNorth: | 0 | ||||||||||||||||||||||||||||||||||||
3407 | if (!selected)
| 0 | ||||||||||||||||||||||||||||||||||||
3408 | rect.adjust(first ? 0 : -tabOverlap, topIndent, last ? 0 : tabOverlap, -bottomIndent); never executed: rect.adjust(first ? 0 : -tabOverlap, topIndent, last ? 0 : tabOverlap, -bottomIndent); | 0 | ||||||||||||||||||||||||||||||||||||
3409 | gtkPainter->paintExtention(gtkNotebook, "tab", rect, | - | ||||||||||||||||||||||||||||||||||||
3410 | state, shadow, GTK_POS_BOTTOM, style); | - | ||||||||||||||||||||||||||||||||||||
3411 | break; never executed: break; | 0 | ||||||||||||||||||||||||||||||||||||
3412 | - | |||||||||||||||||||||||||||||||||||||
3413 | case QTabBar::RoundedSouth: never executed: case QTabBar::RoundedSouth: | 0 | ||||||||||||||||||||||||||||||||||||
3414 | if (!selected)
| 0 | ||||||||||||||||||||||||||||||||||||
3415 | rect.adjust(first ? 0 : -tabOverlap, 0, last ? 0 : tabOverlap, -topIndent); never executed: rect.adjust(first ? 0 : -tabOverlap, 0, last ? 0 : tabOverlap, -topIndent); | 0 | ||||||||||||||||||||||||||||||||||||
3416 | gtkPainter->paintExtention(gtkNotebook, "tab", rect.adjusted(0, 1, 0, 0), | - | ||||||||||||||||||||||||||||||||||||
3417 | state, shadow, GTK_POS_TOP, style); | - | ||||||||||||||||||||||||||||||||||||
3418 | break; never executed: break; | 0 | ||||||||||||||||||||||||||||||||||||
3419 | - | |||||||||||||||||||||||||||||||||||||
3420 | case QTabBar::RoundedWest: never executed: case QTabBar::RoundedWest: | 0 | ||||||||||||||||||||||||||||||||||||
3421 | if (!selected)
| 0 | ||||||||||||||||||||||||||||||||||||
3422 | rect.adjust(topIndent, 0, -bottomIndent, 0); never executed: rect.adjust(topIndent, 0, -bottomIndent, 0); | 0 | ||||||||||||||||||||||||||||||||||||
3423 | gtkPainter->paintExtention(gtkNotebook, "tab", rect, state, shadow, GTK_POS_RIGHT, style); | - | ||||||||||||||||||||||||||||||||||||
3424 | break; never executed: break; | 0 | ||||||||||||||||||||||||||||||||||||
3425 | - | |||||||||||||||||||||||||||||||||||||
3426 | case QTabBar::RoundedEast: never executed: case QTabBar::RoundedEast: | 0 | ||||||||||||||||||||||||||||||||||||
3427 | if (!selected)
| 0 | ||||||||||||||||||||||||||||||||||||
3428 | rect.adjust(bottomIndent, 0, -topIndent, 0); never executed: rect.adjust(bottomIndent, 0, -topIndent, 0); | 0 | ||||||||||||||||||||||||||||||||||||
3429 | gtkPainter->paintExtention(gtkNotebook, "tab", rect, state, shadow, GTK_POS_LEFT, style); | - | ||||||||||||||||||||||||||||||||||||
3430 | break; never executed: break; | 0 | ||||||||||||||||||||||||||||||||||||
3431 | - | |||||||||||||||||||||||||||||||||||||
3432 | default: never executed: default: | 0 | ||||||||||||||||||||||||||||||||||||
3433 | QCommonStyle::drawControl(element, option, painter, widget); | - | ||||||||||||||||||||||||||||||||||||
3434 | break; never executed: break; | 0 | ||||||||||||||||||||||||||||||||||||
3435 | } | - | ||||||||||||||||||||||||||||||||||||
3436 | - | |||||||||||||||||||||||||||||||||||||
3437 | painter->restore(); | - | ||||||||||||||||||||||||||||||||||||
3438 | } never executed: end of block | 0 | ||||||||||||||||||||||||||||||||||||
3439 | - | |||||||||||||||||||||||||||||||||||||
3440 | break; never executed: break; | 0 | ||||||||||||||||||||||||||||||||||||
3441 | - | |||||||||||||||||||||||||||||||||||||
3442 | #endif //QT_NO_TABBAR | - | ||||||||||||||||||||||||||||||||||||
3443 | - | |||||||||||||||||||||||||||||||||||||
3444 | case CE_ProgressBarGroove: never executed: case CE_ProgressBarGroove: | 0 | ||||||||||||||||||||||||||||||||||||
3445 | if (const QStyleOptionProgressBar *bar = qstyleoption_cast<const QStyleOptionProgressBar *>(option)) {
| 0 | ||||||||||||||||||||||||||||||||||||
3446 | Q_UNUSED(bar); | - | ||||||||||||||||||||||||||||||||||||
3447 | GtkWidget *gtkProgressBar = d->gtkWidget("GtkProgressBar"); | - | ||||||||||||||||||||||||||||||||||||
3448 | GtkStateType state = qt_gtk_state(option); | - | ||||||||||||||||||||||||||||||||||||
3449 | gtkPainter->paintBox(gtkProgressBar, "trough", option->rect, state, GTK_SHADOW_IN, d->gtk_widget_get_style(gtkProgressBar)); | - | ||||||||||||||||||||||||||||||||||||
3450 | } never executed: end of block | 0 | ||||||||||||||||||||||||||||||||||||
3451 | - | |||||||||||||||||||||||||||||||||||||
3452 | break; never executed: break; | 0 | ||||||||||||||||||||||||||||||||||||
3453 | - | |||||||||||||||||||||||||||||||||||||
3454 | case CE_ProgressBarContents: never executed: case CE_ProgressBarContents: | 0 | ||||||||||||||||||||||||||||||||||||
3455 | if (const QStyleOptionProgressBar *bar = qstyleoption_cast<const QStyleOptionProgressBar *>(option)) {
| 0 | ||||||||||||||||||||||||||||||||||||
3456 | GtkStateType state = option->state & State_Enabled ? GTK_STATE_NORMAL : GTK_STATE_INSENSITIVE;
| 0 | ||||||||||||||||||||||||||||||||||||
3457 | GtkWidget *gtkProgressBar = d->gtkWidget("GtkProgressBar"); | - | ||||||||||||||||||||||||||||||||||||
3458 | style = d->gtk_widget_get_style(gtkProgressBar); | - | ||||||||||||||||||||||||||||||||||||
3459 | gtkPainter->paintBox(gtkProgressBar, "trough", option->rect, state, GTK_SHADOW_IN, style); | - | ||||||||||||||||||||||||||||||||||||
3460 | int xt = style->xthickness; | - | ||||||||||||||||||||||||||||||||||||
3461 | int yt = style->ythickness; | - | ||||||||||||||||||||||||||||||||||||
3462 | QRect rect = bar->rect.adjusted(xt, yt, -xt, -yt); | - | ||||||||||||||||||||||||||||||||||||
3463 | bool vertical = false; | - | ||||||||||||||||||||||||||||||||||||
3464 | bool inverted = false; | - | ||||||||||||||||||||||||||||||||||||
3465 | bool indeterminate = (bar->minimum == 0 && bar->maximum == 0);
| 0 | ||||||||||||||||||||||||||||||||||||
3466 | // Get extra style options if version 2 | - | ||||||||||||||||||||||||||||||||||||
3467 | - | |||||||||||||||||||||||||||||||||||||
3468 | if (const QStyleOptionProgressBarV2 *bar2 = qstyleoption_cast<const QStyleOptionProgressBarV2 *>(option)) {
| 0 | ||||||||||||||||||||||||||||||||||||
3469 | vertical = (bar2->orientation == Qt::Vertical); | - | ||||||||||||||||||||||||||||||||||||
3470 | inverted = bar2->invertedAppearance; | - | ||||||||||||||||||||||||||||||||||||
3471 | } never executed: end of block | 0 | ||||||||||||||||||||||||||||||||||||
3472 | - | |||||||||||||||||||||||||||||||||||||
3473 | // If the orientation is vertical, we use a transform to rotate | - | ||||||||||||||||||||||||||||||||||||
3474 | // the progress bar 90 degrees clockwise. This way we can use the | - | ||||||||||||||||||||||||||||||||||||
3475 | // same rendering code for both orientations. | - | ||||||||||||||||||||||||||||||||||||
3476 | if (vertical) {
| 0 | ||||||||||||||||||||||||||||||||||||
3477 | rect.translate(xt, -yt * 2); | - | ||||||||||||||||||||||||||||||||||||
3478 | rect = QRect(rect.left(), rect.top(), rect.height(), rect.width()); // Flip width and height | - | ||||||||||||||||||||||||||||||||||||
3479 | QTransform m = QTransform::fromTranslate(rect.height(), 0); | - | ||||||||||||||||||||||||||||||||||||
3480 | m.rotate(90.0); | - | ||||||||||||||||||||||||||||||||||||
3481 | painter->setTransform(m); | - | ||||||||||||||||||||||||||||||||||||
3482 | } never executed: end of block | 0 | ||||||||||||||||||||||||||||||||||||
3483 | - | |||||||||||||||||||||||||||||||||||||
3484 | int maxWidth = rect.width(); | - | ||||||||||||||||||||||||||||||||||||
3485 | int minWidth = 4; | - | ||||||||||||||||||||||||||||||||||||
3486 | - | |||||||||||||||||||||||||||||||||||||
3487 | qint64 progress = (qint64)qMax(bar->progress, bar->minimum); // Workaround for bug in QProgressBar | - | ||||||||||||||||||||||||||||||||||||
3488 | double vc6_workaround = ((progress - qint64(bar->minimum)) / double(qint64(bar->maximum) - qint64(bar->minimum))) * maxWidth; | - | ||||||||||||||||||||||||||||||||||||
3489 | int progressBarWidth = (int(vc6_workaround) > minWidth ) ? int(vc6_workaround) : minWidth;
| 0 | ||||||||||||||||||||||||||||||||||||
3490 | int width = indeterminate ? maxWidth : progressBarWidth;
| 0 | ||||||||||||||||||||||||||||||||||||
3491 | bool reverse = (!vertical && (bar->direction == Qt::RightToLeft)) || vertical;
| 0 | ||||||||||||||||||||||||||||||||||||
3492 | - | |||||||||||||||||||||||||||||||||||||
3493 | if (inverted)
| 0 | ||||||||||||||||||||||||||||||||||||
3494 | reverse = !reverse; never executed: reverse = !reverse; | 0 | ||||||||||||||||||||||||||||||||||||
3495 | - | |||||||||||||||||||||||||||||||||||||
3496 | int maximum = 2; | - | ||||||||||||||||||||||||||||||||||||
3497 | int fakePos = 0; | - | ||||||||||||||||||||||||||||||||||||
3498 | if (bar->minimum == bar->maximum)
| 0 | ||||||||||||||||||||||||||||||||||||
3499 | maximum = 0; never executed: maximum = 0; | 0 | ||||||||||||||||||||||||||||||||||||
3500 | if (bar->progress == bar->maximum)
| 0 | ||||||||||||||||||||||||||||||||||||
3501 | fakePos = maximum; never executed: fakePos = maximum; | 0 | ||||||||||||||||||||||||||||||||||||
3502 | else if (bar->progress > bar->minimum)
| 0 | ||||||||||||||||||||||||||||||||||||
3503 | fakePos = maximum - 1; never executed: fakePos = maximum - 1; | 0 | ||||||||||||||||||||||||||||||||||||
3504 | - | |||||||||||||||||||||||||||||||||||||
3505 | QRect progressBar; | - | ||||||||||||||||||||||||||||||||||||
3506 | - | |||||||||||||||||||||||||||||||||||||
3507 | if (!indeterminate) {
| 0 | ||||||||||||||||||||||||||||||||||||
3508 | if (!reverse)
| 0 | ||||||||||||||||||||||||||||||||||||
3509 | progressBar.setRect(rect.left(), rect.top(), width, rect.height()); never executed: progressBar.setRect(rect.left(), rect.top(), width, rect.height()); | 0 | ||||||||||||||||||||||||||||||||||||
3510 | else | - | ||||||||||||||||||||||||||||||||||||
3511 | progressBar.setRect(rect.right() - width, rect.top(), width, rect.height()); never executed: progressBar.setRect(rect.right() - width, rect.top(), width, rect.height()); | 0 | ||||||||||||||||||||||||||||||||||||
3512 | #ifndef QT_NO_ANIMATION | - | ||||||||||||||||||||||||||||||||||||
3513 | d->stopAnimation(option->styleObject); | - | ||||||||||||||||||||||||||||||||||||
3514 | #endif | - | ||||||||||||||||||||||||||||||||||||
3515 | } else { never executed: end of block | 0 | ||||||||||||||||||||||||||||||||||||
3516 | Q_D(const QGtkStyle); | - | ||||||||||||||||||||||||||||||||||||
3517 | int slideWidth = ((rect.width() - 4) * 2) / 3; | - | ||||||||||||||||||||||||||||||||||||
3518 | int step = 0; | - | ||||||||||||||||||||||||||||||||||||
3519 | #ifndef QT_NO_ANIMATION | - | ||||||||||||||||||||||||||||||||||||
3520 | if (QProgressStyleAnimation *animation = qobject_cast<QProgressStyleAnimation*>(d->animation(option->styleObject)))
| 0 | ||||||||||||||||||||||||||||||||||||
3521 | step = animation->progressStep(slideWidth); never executed: step = animation->progressStep(slideWidth); | 0 | ||||||||||||||||||||||||||||||||||||
3522 | else | - | ||||||||||||||||||||||||||||||||||||
3523 | d->startAnimation(new QProgressStyleAnimation(d->animationFps, option->styleObject)); never executed: d->startAnimation(new QProgressStyleAnimation(d->animationFps, option->styleObject)); | 0 | ||||||||||||||||||||||||||||||||||||
3524 | #endif | - | ||||||||||||||||||||||||||||||||||||
3525 | progressBar.setRect(rect.left() + step, rect.top(), slideWidth / 2, rect.height()); | - | ||||||||||||||||||||||||||||||||||||
3526 | } never executed: end of block | 0 | ||||||||||||||||||||||||||||||||||||
3527 | - | |||||||||||||||||||||||||||||||||||||
3528 | QString key = QString(QLS("%0")).arg(fakePos); | - | ||||||||||||||||||||||||||||||||||||
3529 | if (inverted) {
| 0 | ||||||||||||||||||||||||||||||||||||
3530 | key += QLatin1String("inv"); | - | ||||||||||||||||||||||||||||||||||||
3531 | gtkPainter->setFlipHorizontal(true); | - | ||||||||||||||||||||||||||||||||||||
3532 | } never executed: end of block | 0 | ||||||||||||||||||||||||||||||||||||
3533 | gtkPainter->paintBox(gtkProgressBar, "bar", progressBar, GTK_STATE_SELECTED, GTK_SHADOW_OUT, style, key); | - | ||||||||||||||||||||||||||||||||||||
3534 | } never executed: end of block | 0 | ||||||||||||||||||||||||||||||||||||
3535 | - | |||||||||||||||||||||||||||||||||||||
3536 | break; never executed: break; | 0 | ||||||||||||||||||||||||||||||||||||
3537 | - | |||||||||||||||||||||||||||||||||||||
3538 | default: never executed: default: | 0 | ||||||||||||||||||||||||||||||||||||
3539 | QCommonStyle::drawControl(element, option, painter, widget); | - | ||||||||||||||||||||||||||||||||||||
3540 | } never executed: end of block | 0 | ||||||||||||||||||||||||||||||||||||
3541 | } | - | ||||||||||||||||||||||||||||||||||||
3542 | - | |||||||||||||||||||||||||||||||||||||
3543 | /*! | - | ||||||||||||||||||||||||||||||||||||
3544 | \reimp | - | ||||||||||||||||||||||||||||||||||||
3545 | */ | - | ||||||||||||||||||||||||||||||||||||
3546 | QRect QGtkStyle::subControlRect(ComplexControl control, const QStyleOptionComplex *option, | - | ||||||||||||||||||||||||||||||||||||
3547 | SubControl subControl, const QWidget *widget) const | - | ||||||||||||||||||||||||||||||||||||
3548 | { | - | ||||||||||||||||||||||||||||||||||||
3549 | Q_D(const QGtkStyle); | - | ||||||||||||||||||||||||||||||||||||
3550 | - | |||||||||||||||||||||||||||||||||||||
3551 | QRect rect = QCommonStyle::subControlRect(control, option, subControl, widget); | - | ||||||||||||||||||||||||||||||||||||
3552 | if (!d->isThemeAvailable())
| 0 | ||||||||||||||||||||||||||||||||||||
3553 | return QCommonStyle::subControlRect(control, option, subControl, widget); never executed: return QCommonStyle::subControlRect(control, option, subControl, widget); | 0 | ||||||||||||||||||||||||||||||||||||
3554 | - | |||||||||||||||||||||||||||||||||||||
3555 | switch (control) { | - | ||||||||||||||||||||||||||||||||||||
3556 | case CC_ScrollBar: never executed: case CC_ScrollBar: | 0 | ||||||||||||||||||||||||||||||||||||
3557 | break; never executed: break; | 0 | ||||||||||||||||||||||||||||||||||||
3558 | case CC_Slider: never executed: case CC_Slider: | 0 | ||||||||||||||||||||||||||||||||||||
3559 | if (const QStyleOptionSlider *slider = qstyleoption_cast<const QStyleOptionSlider *>(option)) {
| 0 | ||||||||||||||||||||||||||||||||||||
3560 | int tickSize = proxy()->pixelMetric(PM_SliderTickmarkOffset, option, widget); | - | ||||||||||||||||||||||||||||||||||||
3561 | switch (subControl) { | - | ||||||||||||||||||||||||||||||||||||
3562 | case SC_SliderHandle: { never executed: case SC_SliderHandle: | 0 | ||||||||||||||||||||||||||||||||||||
3563 | if (slider->orientation == Qt::Horizontal) {
| 0 | ||||||||||||||||||||||||||||||||||||
3564 | rect.setHeight(proxy()->pixelMetric(PM_SliderThickness)); | - | ||||||||||||||||||||||||||||||||||||
3565 | rect.setWidth(proxy()->pixelMetric(PM_SliderLength)); | - | ||||||||||||||||||||||||||||||||||||
3566 | int centerY = slider->rect.center().y() - rect.height() / 2; | - | ||||||||||||||||||||||||||||||||||||
3567 | if (slider->tickPosition & QSlider::TicksAbove)
| 0 | ||||||||||||||||||||||||||||||||||||
3568 | centerY += tickSize; never executed: centerY += tickSize; | 0 | ||||||||||||||||||||||||||||||||||||
3569 | if (slider->tickPosition & QSlider::TicksBelow)
| 0 | ||||||||||||||||||||||||||||||||||||
3570 | centerY -= tickSize; never executed: centerY -= tickSize; | 0 | ||||||||||||||||||||||||||||||||||||
3571 | rect.moveTop(centerY); | - | ||||||||||||||||||||||||||||||||||||
3572 | } else { never executed: end of block | 0 | ||||||||||||||||||||||||||||||||||||
3573 | rect.setWidth(proxy()->pixelMetric(PM_SliderThickness)); | - | ||||||||||||||||||||||||||||||||||||
3574 | rect.setHeight(proxy()->pixelMetric(PM_SliderLength)); | - | ||||||||||||||||||||||||||||||||||||
3575 | int centerX = slider->rect.center().x() - rect.width() / 2; | - | ||||||||||||||||||||||||||||||||||||
3576 | if (slider->tickPosition & QSlider::TicksAbove)
| 0 | ||||||||||||||||||||||||||||||||||||
3577 | centerX += tickSize; never executed: centerX += tickSize; | 0 | ||||||||||||||||||||||||||||||||||||
3578 | if (slider->tickPosition & QSlider::TicksBelow)
| 0 | ||||||||||||||||||||||||||||||||||||
3579 | centerX -= tickSize; never executed: centerX -= tickSize; | 0 | ||||||||||||||||||||||||||||||||||||
3580 | rect.moveLeft(centerX); | - | ||||||||||||||||||||||||||||||||||||
3581 | } never executed: end of block | 0 | ||||||||||||||||||||||||||||||||||||
3582 | } | - | ||||||||||||||||||||||||||||||||||||
3583 | break; never executed: break; | 0 | ||||||||||||||||||||||||||||||||||||
3584 | case SC_SliderGroove: { never executed: case SC_SliderGroove: | 0 | ||||||||||||||||||||||||||||||||||||
3585 | QPoint grooveCenter = slider->rect.center(); | - | ||||||||||||||||||||||||||||||||||||
3586 | if (slider->orientation == Qt::Horizontal) {
| 0 | ||||||||||||||||||||||||||||||||||||
3587 | rect.setHeight(7); | - | ||||||||||||||||||||||||||||||||||||
3588 | if (slider->tickPosition & QSlider::TicksAbove)
| 0 | ||||||||||||||||||||||||||||||||||||
3589 | grooveCenter.ry() += tickSize; never executed: grooveCenter.ry() += tickSize; | 0 | ||||||||||||||||||||||||||||||||||||
3590 | if (slider->tickPosition & QSlider::TicksBelow)
| 0 | ||||||||||||||||||||||||||||||||||||
3591 | grooveCenter.ry() -= tickSize; never executed: grooveCenter.ry() -= tickSize; | 0 | ||||||||||||||||||||||||||||||||||||
3592 | } else { never executed: end of block | 0 | ||||||||||||||||||||||||||||||||||||
3593 | rect.setWidth(7); | - | ||||||||||||||||||||||||||||||||||||
3594 | if (slider->tickPosition & QSlider::TicksAbove)
| 0 | ||||||||||||||||||||||||||||||||||||
3595 | grooveCenter.rx() += tickSize; never executed: grooveCenter.rx() += tickSize; | 0 | ||||||||||||||||||||||||||||||||||||
3596 | if (slider->tickPosition & QSlider::TicksBelow)
| 0 | ||||||||||||||||||||||||||||||||||||
3597 | grooveCenter.rx() -= tickSize; never executed: grooveCenter.rx() -= tickSize; | 0 | ||||||||||||||||||||||||||||||||||||
3598 | } never executed: end of block | 0 | ||||||||||||||||||||||||||||||||||||
3599 | rect.moveCenter(grooveCenter); | - | ||||||||||||||||||||||||||||||||||||
3600 | break; never executed: break; | 0 | ||||||||||||||||||||||||||||||||||||
3601 | } | - | ||||||||||||||||||||||||||||||||||||
3602 | default: never executed: default: | 0 | ||||||||||||||||||||||||||||||||||||
3603 | break; never executed: break; | 0 | ||||||||||||||||||||||||||||||||||||
3604 | } | - | ||||||||||||||||||||||||||||||||||||
3605 | } | - | ||||||||||||||||||||||||||||||||||||
3606 | break; never executed: break; | 0 | ||||||||||||||||||||||||||||||||||||
3607 | - | |||||||||||||||||||||||||||||||||||||
3608 | #ifndef QT_NO_GROUPBOX | - | ||||||||||||||||||||||||||||||||||||
3609 | - | |||||||||||||||||||||||||||||||||||||
3610 | case CC_GroupBox: never executed: case CC_GroupBox: | 0 | ||||||||||||||||||||||||||||||||||||
3611 | if (const QStyleOptionGroupBox * groupBox = qstyleoption_cast<const QStyleOptionGroupBox *>(option)) {
| 0 | ||||||||||||||||||||||||||||||||||||
3612 | rect = option->rect.adjusted(0, groupBoxTopMargin, 0, -groupBoxBottomMargin); | - | ||||||||||||||||||||||||||||||||||||
3613 | int topMargin = 0; | - | ||||||||||||||||||||||||||||||||||||
3614 | int topHeight = 0; | - | ||||||||||||||||||||||||||||||||||||
3615 | topHeight = 10; | - | ||||||||||||||||||||||||||||||||||||
3616 | QRect frameRect = rect; | - | ||||||||||||||||||||||||||||||||||||
3617 | frameRect.setTop(topMargin); | - | ||||||||||||||||||||||||||||||||||||
3618 | - | |||||||||||||||||||||||||||||||||||||
3619 | if (subControl == SC_GroupBoxFrame)
| 0 | ||||||||||||||||||||||||||||||||||||
3620 | return rect; never executed: return rect; | 0 | ||||||||||||||||||||||||||||||||||||
3621 | else if (subControl == SC_GroupBoxContents) {
| 0 | ||||||||||||||||||||||||||||||||||||
3622 | int margin = 0; | - | ||||||||||||||||||||||||||||||||||||
3623 | int leftMarginExtension = 8; | - | ||||||||||||||||||||||||||||||||||||
3624 | return frameRect.adjusted(leftMarginExtension + margin, margin + topHeight + groupBoxTitleMargin, -margin, -margin); never executed: return frameRect.adjusted(leftMarginExtension + margin, margin + topHeight + groupBoxTitleMargin, -margin, -margin); | 0 | ||||||||||||||||||||||||||||||||||||
3625 | } | - | ||||||||||||||||||||||||||||||||||||
3626 | - | |||||||||||||||||||||||||||||||||||||
3627 | QFontMetrics fontMetrics = option->fontMetrics; | - | ||||||||||||||||||||||||||||||||||||
3628 | if (qobject_cast<const QGroupBox *>(widget)) {
| 0 | ||||||||||||||||||||||||||||||||||||
3629 | //Prepare metrics for a bold font | - | ||||||||||||||||||||||||||||||||||||
3630 | QFont font = widget->font(); | - | ||||||||||||||||||||||||||||||||||||
3631 | font.setBold(true); | - | ||||||||||||||||||||||||||||||||||||
3632 | fontMetrics = QFontMetrics(font); | - | ||||||||||||||||||||||||||||||||||||
3633 | #ifndef QT_NO_ACCESSIBILITY | - | ||||||||||||||||||||||||||||||||||||
3634 | } else if (QStyleHelper::isInstanceOf(groupBox->styleObject, QAccessible::Grouping)) { never executed: end of block
| 0 | ||||||||||||||||||||||||||||||||||||
3635 | QVariant var = groupBox->styleObject->property("font"); | - | ||||||||||||||||||||||||||||||||||||
3636 | if (var.isValid() && var.canConvert<QFont>()) {
| 0 | ||||||||||||||||||||||||||||||||||||
3637 | QFont font = var.value<QFont>(); | - | ||||||||||||||||||||||||||||||||||||
3638 | font.setBold(true); | - | ||||||||||||||||||||||||||||||||||||
3639 | fontMetrics = QFontMetrics(font); | - | ||||||||||||||||||||||||||||||||||||
3640 | } never executed: end of block | 0 | ||||||||||||||||||||||||||||||||||||
3641 | #endif // QT_NO_ACCESSIBILITY | - | ||||||||||||||||||||||||||||||||||||
3642 | } never executed: end of block | 0 | ||||||||||||||||||||||||||||||||||||
3643 | - | |||||||||||||||||||||||||||||||||||||
3644 | QSize textRect = fontMetrics.boundingRect(groupBox->text).size() + QSize(4, 4); | - | ||||||||||||||||||||||||||||||||||||
3645 | int indicatorWidth = proxy()->pixelMetric(PM_IndicatorWidth, option, widget); | - | ||||||||||||||||||||||||||||||||||||
3646 | int indicatorHeight = proxy()->pixelMetric(PM_IndicatorHeight, option, widget); | - | ||||||||||||||||||||||||||||||||||||
3647 | - | |||||||||||||||||||||||||||||||||||||
3648 | if (subControl == SC_GroupBoxCheckBox) {
| 0 | ||||||||||||||||||||||||||||||||||||
3649 | rect.setWidth(indicatorWidth); | - | ||||||||||||||||||||||||||||||||||||
3650 | rect.setHeight(indicatorHeight); | - | ||||||||||||||||||||||||||||||||||||
3651 | rect.moveTop((textRect.height() - indicatorHeight) / 2); | - | ||||||||||||||||||||||||||||||||||||
3652 | - | |||||||||||||||||||||||||||||||||||||
3653 | } else if (subControl == SC_GroupBoxLabel) { never executed: end of block
| 0 | ||||||||||||||||||||||||||||||||||||
3654 | if (groupBox->subControls & SC_GroupBoxCheckBox)
| 0 | ||||||||||||||||||||||||||||||||||||
3655 | rect.adjust(indicatorWidth + 4, 0, 0, 0); never executed: rect.adjust(indicatorWidth + 4, 0, 0, 0); | 0 | ||||||||||||||||||||||||||||||||||||
3656 | rect.setSize(textRect); | - | ||||||||||||||||||||||||||||||||||||
3657 | } never executed: end of block | 0 | ||||||||||||||||||||||||||||||||||||
3658 | rect = visualRect(option->direction, option->rect, rect); | - | ||||||||||||||||||||||||||||||||||||
3659 | } never executed: end of block | 0 | ||||||||||||||||||||||||||||||||||||
3660 | - | |||||||||||||||||||||||||||||||||||||
3661 | return rect; never executed: return rect; | 0 | ||||||||||||||||||||||||||||||||||||
3662 | - | |||||||||||||||||||||||||||||||||||||
3663 | #endif | - | ||||||||||||||||||||||||||||||||||||
3664 | #ifndef QT_NO_SPINBOX | - | ||||||||||||||||||||||||||||||||||||
3665 | - | |||||||||||||||||||||||||||||||||||||
3666 | case CC_SpinBox: never executed: case CC_SpinBox: | 0 | ||||||||||||||||||||||||||||||||||||
3667 | if (const QStyleOptionSpinBox *spinbox = qstyleoption_cast<const QStyleOptionSpinBox *>(option)) {
| 0 | ||||||||||||||||||||||||||||||||||||
3668 | GtkWidget *gtkSpinButton = d->gtkWidget("GtkSpinButton"); | - | ||||||||||||||||||||||||||||||||||||
3669 | int center = spinbox->rect.height() / 2; | - | ||||||||||||||||||||||||||||||||||||
3670 | GtkStyle *gtkSpinButtonStyle = d->gtk_widget_get_style(gtkSpinButton); | - | ||||||||||||||||||||||||||||||||||||
3671 | int xt = spinbox->frame ? gtkSpinButtonStyle->xthickness : 0;
| 0 | ||||||||||||||||||||||||||||||||||||
3672 | int yt = spinbox->frame ? gtkSpinButtonStyle->ythickness : 0;
| 0 | ||||||||||||||||||||||||||||||||||||
3673 | int y = yt; | - | ||||||||||||||||||||||||||||||||||||
3674 | - | |||||||||||||||||||||||||||||||||||||
3675 | QSize bs; | - | ||||||||||||||||||||||||||||||||||||
3676 | bs.setHeight(qMax(8, spinbox->rect.height()/2 - y)); | - | ||||||||||||||||||||||||||||||||||||
3677 | bs.setWidth(d->getSpinboxArrowSize()); | - | ||||||||||||||||||||||||||||||||||||
3678 | int x, lx, rx; | - | ||||||||||||||||||||||||||||||||||||
3679 | x = spinbox->rect.width() - y - bs.width() + 2; | - | ||||||||||||||||||||||||||||||||||||
3680 | lx = xt; | - | ||||||||||||||||||||||||||||||||||||
3681 | rx = x - xt; | - | ||||||||||||||||||||||||||||||||||||
3682 | - | |||||||||||||||||||||||||||||||||||||
3683 | switch (subControl) { | - | ||||||||||||||||||||||||||||||||||||
3684 | - | |||||||||||||||||||||||||||||||||||||
3685 | case SC_SpinBoxUp: never executed: case SC_SpinBoxUp: | 0 | ||||||||||||||||||||||||||||||||||||
3686 | if (spinbox->buttonSymbols == QAbstractSpinBox::NoButtons)
| 0 | ||||||||||||||||||||||||||||||||||||
3687 | return QRect(); never executed: return QRect(); | 0 | ||||||||||||||||||||||||||||||||||||
3688 | rect = QRect(x, xt, bs.width(), center - yt); | - | ||||||||||||||||||||||||||||||||||||
3689 | break; never executed: break; | 0 | ||||||||||||||||||||||||||||||||||||
3690 | - | |||||||||||||||||||||||||||||||||||||
3691 | case SC_SpinBoxDown: never executed: case SC_SpinBoxDown: | 0 | ||||||||||||||||||||||||||||||||||||
3692 | if (spinbox->buttonSymbols == QAbstractSpinBox::NoButtons)
| 0 | ||||||||||||||||||||||||||||||||||||
3693 | return QRect(); never executed: return QRect(); | 0 | ||||||||||||||||||||||||||||||||||||
3694 | rect = QRect(x, center, bs.width(), spinbox->rect.bottom() - center - yt + 1); | - | ||||||||||||||||||||||||||||||||||||
3695 | break; never executed: break; | 0 | ||||||||||||||||||||||||||||||||||||
3696 | - | |||||||||||||||||||||||||||||||||||||
3697 | case SC_SpinBoxEditField: never executed: case SC_SpinBoxEditField: | 0 | ||||||||||||||||||||||||||||||||||||
3698 | if (spinbox->buttonSymbols == QAbstractSpinBox::NoButtons)
| 0 | ||||||||||||||||||||||||||||||||||||
3699 | rect = QRect(lx, yt, spinbox->rect.width() - 2*xt, spinbox->rect.height() - 2*yt); never executed: rect = QRect(lx, yt, spinbox->rect.width() - 2*xt, spinbox->rect.height() - 2*yt); | 0 | ||||||||||||||||||||||||||||||||||||
3700 | else | - | ||||||||||||||||||||||||||||||||||||
3701 | rect = QRect(lx, yt, rx - qMax(xt - 1, 0), spinbox->rect.height() - 2*yt); never executed: rect = QRect(lx, yt, rx - qMax(xt - 1, 0), spinbox->rect.height() - 2*yt); | 0 | ||||||||||||||||||||||||||||||||||||
3702 | break; never executed: break; | 0 | ||||||||||||||||||||||||||||||||||||
3703 | - | |||||||||||||||||||||||||||||||||||||
3704 | case SC_SpinBoxFrame: never executed: case SC_SpinBoxFrame: | 0 | ||||||||||||||||||||||||||||||||||||
3705 | rect = spinbox->rect; | - | ||||||||||||||||||||||||||||||||||||
3706 | - | |||||||||||||||||||||||||||||||||||||
3707 | default: code before this statement never executed: default: never executed: default: | 0 | ||||||||||||||||||||||||||||||||||||
3708 | break; never executed: break; | 0 | ||||||||||||||||||||||||||||||||||||
3709 | } | - | ||||||||||||||||||||||||||||||||||||
3710 | - | |||||||||||||||||||||||||||||||||||||
3711 | rect = visualRect(spinbox->direction, spinbox->rect, rect); | - | ||||||||||||||||||||||||||||||||||||
3712 | } never executed: end of block | 0 | ||||||||||||||||||||||||||||||||||||
3713 | - | |||||||||||||||||||||||||||||||||||||
3714 | break; never executed: break; | 0 | ||||||||||||||||||||||||||||||||||||
3715 | - | |||||||||||||||||||||||||||||||||||||
3716 | #endif // Qt_NO_SPINBOX | - | ||||||||||||||||||||||||||||||||||||
3717 | #ifndef QT_NO_COMBOBOX | - | ||||||||||||||||||||||||||||||||||||
3718 | - | |||||||||||||||||||||||||||||||||||||
3719 | case CC_TitleBar: never executed: case CC_TitleBar: | 0 | ||||||||||||||||||||||||||||||||||||
3720 | if (const QStyleOptionTitleBar *tb = qstyleoption_cast<const QStyleOptionTitleBar *>(option)) {
| 0 | ||||||||||||||||||||||||||||||||||||
3721 | SubControl sc = subControl; | - | ||||||||||||||||||||||||||||||||||||
3722 | QRect &ret = rect; | - | ||||||||||||||||||||||||||||||||||||
3723 | const int indent = 3; | - | ||||||||||||||||||||||||||||||||||||
3724 | const int controlTopMargin = 3; | - | ||||||||||||||||||||||||||||||||||||
3725 | const int controlBottomMargin = 3; | - | ||||||||||||||||||||||||||||||||||||
3726 | const int controlWidthMargin = 2; | - | ||||||||||||||||||||||||||||||||||||
3727 | const int controlHeight = tb->rect.height() - controlTopMargin - controlBottomMargin ; | - | ||||||||||||||||||||||||||||||||||||
3728 | const int delta = controlHeight + controlWidthMargin; | - | ||||||||||||||||||||||||||||||||||||
3729 | int offset = 0; | - | ||||||||||||||||||||||||||||||||||||
3730 | - | |||||||||||||||||||||||||||||||||||||
3731 | bool isMinimized = tb->titleBarState & Qt::WindowMinimized; | - | ||||||||||||||||||||||||||||||||||||
3732 | bool isMaximized = tb->titleBarState & Qt::WindowMaximized; | - | ||||||||||||||||||||||||||||||||||||
3733 | - | |||||||||||||||||||||||||||||||||||||
3734 | switch (sc) { | - | ||||||||||||||||||||||||||||||||||||
3735 | case SC_TitleBarLabel: never executed: case SC_TitleBarLabel: | 0 | ||||||||||||||||||||||||||||||||||||
3736 | if (tb->titleBarFlags & (Qt::WindowTitleHint | Qt::WindowSystemMenuHint)) {
| 0 | ||||||||||||||||||||||||||||||||||||
3737 | ret = tb->rect; | - | ||||||||||||||||||||||||||||||||||||
3738 | if (tb->titleBarFlags & Qt::WindowSystemMenuHint)
| 0 | ||||||||||||||||||||||||||||||||||||
3739 | ret.adjust(delta, 0, -delta, 0); never executed: ret.adjust(delta, 0, -delta, 0); | 0 | ||||||||||||||||||||||||||||||||||||
3740 | if (tb->titleBarFlags & Qt::WindowMinimizeButtonHint)
| 0 | ||||||||||||||||||||||||||||||||||||
3741 | ret.adjust(0, 0, -delta, 0); never executed: ret.adjust(0, 0, -delta, 0); | 0 | ||||||||||||||||||||||||||||||||||||
3742 | if (tb->titleBarFlags & Qt::WindowMaximizeButtonHint)
| 0 | ||||||||||||||||||||||||||||||||||||
3743 | ret.adjust(0, 0, -delta, 0); never executed: ret.adjust(0, 0, -delta, 0); | 0 | ||||||||||||||||||||||||||||||||||||
3744 | if (tb->titleBarFlags & Qt::WindowShadeButtonHint)
| 0 | ||||||||||||||||||||||||||||||||||||
3745 | ret.adjust(0, 0, -delta, 0); never executed: ret.adjust(0, 0, -delta, 0); | 0 | ||||||||||||||||||||||||||||||||||||
3746 | if (tb->titleBarFlags & Qt::WindowContextHelpButtonHint)
| 0 | ||||||||||||||||||||||||||||||||||||
3747 | ret.adjust(0, 0, -delta, 0); never executed: ret.adjust(0, 0, -delta, 0); | 0 | ||||||||||||||||||||||||||||||||||||
3748 | } never executed: end of block | 0 | ||||||||||||||||||||||||||||||||||||
3749 | break; never executed: break; | 0 | ||||||||||||||||||||||||||||||||||||
3750 | case SC_TitleBarContextHelpButton: never executed: case SC_TitleBarContextHelpButton: | 0 | ||||||||||||||||||||||||||||||||||||
3751 | if (tb->titleBarFlags & Qt::WindowContextHelpButtonHint)
| 0 | ||||||||||||||||||||||||||||||||||||
3752 | offset += delta; never executed: offset += delta; | 0 | ||||||||||||||||||||||||||||||||||||
3753 | case SC_TitleBarMinButton: code before this statement never executed: case SC_TitleBarMinButton: never executed: case SC_TitleBarMinButton: | 0 | ||||||||||||||||||||||||||||||||||||
3754 | if (!isMinimized && (tb->titleBarFlags & Qt::WindowMinimizeButtonHint))
| 0 | ||||||||||||||||||||||||||||||||||||
3755 | offset += delta; never executed: offset += delta; | 0 | ||||||||||||||||||||||||||||||||||||
3756 | else if (sc == SC_TitleBarMinButton)
| 0 | ||||||||||||||||||||||||||||||||||||
3757 | break; never executed: break; | 0 | ||||||||||||||||||||||||||||||||||||
3758 | case SC_TitleBarNormalButton: code before this statement never executed: case SC_TitleBarNormalButton: never executed: case SC_TitleBarNormalButton: | 0 | ||||||||||||||||||||||||||||||||||||
3759 | if (isMinimized && (tb->titleBarFlags & Qt::WindowMinimizeButtonHint))
| 0 | ||||||||||||||||||||||||||||||||||||
3760 | offset += delta; never executed: offset += delta; | 0 | ||||||||||||||||||||||||||||||||||||
3761 | else if (isMaximized && (tb->titleBarFlags & Qt::WindowMaximizeButtonHint))
| 0 | ||||||||||||||||||||||||||||||||||||
3762 | offset += delta; never executed: offset += delta; | 0 | ||||||||||||||||||||||||||||||||||||
3763 | else if (sc == SC_TitleBarNormalButton)
| 0 | ||||||||||||||||||||||||||||||||||||
3764 | break; never executed: break; | 0 | ||||||||||||||||||||||||||||||||||||
3765 | case SC_TitleBarMaxButton: code before this statement never executed: case SC_TitleBarMaxButton: never executed: case SC_TitleBarMaxButton: | 0 | ||||||||||||||||||||||||||||||||||||
3766 | if (!isMaximized && (tb->titleBarFlags & Qt::WindowMaximizeButtonHint))
| 0 | ||||||||||||||||||||||||||||||||||||
3767 | offset += delta; never executed: offset += delta; | 0 | ||||||||||||||||||||||||||||||||||||
3768 | else if (sc == SC_TitleBarMaxButton)
| 0 | ||||||||||||||||||||||||||||||||||||
3769 | break; never executed: break; | 0 | ||||||||||||||||||||||||||||||||||||
3770 | case SC_TitleBarShadeButton: code before this statement never executed: case SC_TitleBarShadeButton: never executed: case SC_TitleBarShadeButton: | 0 | ||||||||||||||||||||||||||||||||||||
3771 | if (!isMinimized && (tb->titleBarFlags & Qt::WindowShadeButtonHint))
| 0 | ||||||||||||||||||||||||||||||||||||
3772 | offset += delta; never executed: offset += delta; | 0 | ||||||||||||||||||||||||||||||||||||
3773 | else if (sc == SC_TitleBarShadeButton)
| 0 | ||||||||||||||||||||||||||||||||||||
3774 | break; never executed: break; | 0 | ||||||||||||||||||||||||||||||||||||
3775 | case SC_TitleBarUnshadeButton: code before this statement never executed: case SC_TitleBarUnshadeButton: never executed: case SC_TitleBarUnshadeButton: | 0 | ||||||||||||||||||||||||||||||||||||
3776 | if (isMinimized && (tb->titleBarFlags & Qt::WindowShadeButtonHint))
| 0 | ||||||||||||||||||||||||||||||||||||
3777 | offset += delta; never executed: offset += delta; | 0 | ||||||||||||||||||||||||||||||||||||
3778 | else if (sc == SC_TitleBarUnshadeButton)
| 0 | ||||||||||||||||||||||||||||||||||||
3779 | break; never executed: break; | 0 | ||||||||||||||||||||||||||||||||||||
3780 | case SC_TitleBarCloseButton: code before this statement never executed: case SC_TitleBarCloseButton: never executed: case SC_TitleBarCloseButton: | 0 | ||||||||||||||||||||||||||||||||||||
3781 | if (tb->titleBarFlags & Qt::WindowSystemMenuHint)
| 0 | ||||||||||||||||||||||||||||||||||||
3782 | offset += delta; never executed: offset += delta; | 0 | ||||||||||||||||||||||||||||||||||||
3783 | else if (sc == SC_TitleBarCloseButton)
| 0 | ||||||||||||||||||||||||||||||||||||
3784 | break; never executed: break; | 0 | ||||||||||||||||||||||||||||||||||||
3785 | ret.setRect(tb->rect.right() - indent - offset, tb->rect.top() + controlTopMargin, | - | ||||||||||||||||||||||||||||||||||||
3786 | controlHeight, controlHeight); | - | ||||||||||||||||||||||||||||||||||||
3787 | break; never executed: break; | 0 | ||||||||||||||||||||||||||||||||||||
3788 | case SC_TitleBarSysMenu: never executed: case SC_TitleBarSysMenu: | 0 | ||||||||||||||||||||||||||||||||||||
3789 | if (tb->titleBarFlags & Qt::WindowSystemMenuHint) {
| 0 | ||||||||||||||||||||||||||||||||||||
3790 | ret.setRect(tb->rect.left() + controlWidthMargin + indent, tb->rect.top() + controlTopMargin, | - | ||||||||||||||||||||||||||||||||||||
3791 | controlHeight, controlHeight); | - | ||||||||||||||||||||||||||||||||||||
3792 | } never executed: end of block | 0 | ||||||||||||||||||||||||||||||||||||
3793 | break; never executed: break; | 0 | ||||||||||||||||||||||||||||||||||||
3794 | default: never executed: default: | 0 | ||||||||||||||||||||||||||||||||||||
3795 | break; never executed: break; | 0 | ||||||||||||||||||||||||||||||||||||
3796 | } | - | ||||||||||||||||||||||||||||||||||||
3797 | ret = visualRect(tb->direction, tb->rect, ret); | - | ||||||||||||||||||||||||||||||||||||
3798 | } never executed: end of block | 0 | ||||||||||||||||||||||||||||||||||||
3799 | break; never executed: break; | 0 | ||||||||||||||||||||||||||||||||||||
3800 | case CC_ComboBox: never executed: case CC_ComboBox: | 0 | ||||||||||||||||||||||||||||||||||||
3801 | if (const QStyleOptionComboBox *box = qstyleoption_cast<const QStyleOptionComboBox *>(option)) {
| 0 | ||||||||||||||||||||||||||||||||||||
3802 | // We employ the gtk widget to position arrows and separators for us | - | ||||||||||||||||||||||||||||||||||||
3803 | GtkWidget *gtkCombo = box->editable ? d->gtkWidget("GtkComboBoxEntry")
| 0 | ||||||||||||||||||||||||||||||||||||
3804 | : d->gtkWidget("GtkComboBox"); | - | ||||||||||||||||||||||||||||||||||||
3805 | d->gtk_widget_set_direction(gtkCombo, (option->direction == Qt::RightToLeft) ? GTK_TEXT_DIR_RTL : GTK_TEXT_DIR_LTR); | - | ||||||||||||||||||||||||||||||||||||
3806 | GtkAllocation geometry = {0, 0, qMax(0, option->rect.width()), qMax(0, option->rect.height())}; | - | ||||||||||||||||||||||||||||||||||||
3807 | d->gtk_widget_size_allocate(gtkCombo, &geometry); | - | ||||||||||||||||||||||||||||||||||||
3808 | int appears_as_list = !proxy()->styleHint(QStyle::SH_ComboBox_Popup, option, widget); | - | ||||||||||||||||||||||||||||||||||||
3809 | QHashableLatin1Literal arrowPath("GtkComboBoxEntry.GtkToggleButton"); | - | ||||||||||||||||||||||||||||||||||||
3810 | if (!box->editable) {
| 0 | ||||||||||||||||||||||||||||||||||||
3811 | if (appears_as_list)
| 0 | ||||||||||||||||||||||||||||||||||||
3812 | arrowPath = "GtkComboBox.GtkToggleButton"; never executed: arrowPath = "GtkComboBox.GtkToggleButton"; | 0 | ||||||||||||||||||||||||||||||||||||
3813 | else | - | ||||||||||||||||||||||||||||||||||||
3814 | arrowPath = "GtkComboBox.GtkToggleButton.GtkHBox.GtkArrow"; never executed: arrowPath = "GtkComboBox.GtkToggleButton.GtkHBox.GtkArrow"; | 0 | ||||||||||||||||||||||||||||||||||||
3815 | } | - | ||||||||||||||||||||||||||||||||||||
3816 | - | |||||||||||||||||||||||||||||||||||||
3817 | GtkWidget *arrowWidget = d->gtkWidget(arrowPath); | - | ||||||||||||||||||||||||||||||||||||
3818 | if (!arrowWidget)
| 0 | ||||||||||||||||||||||||||||||||||||
3819 | return QCommonStyle::subControlRect(control, option, subControl, widget); never executed: return QCommonStyle::subControlRect(control, option, subControl, widget); | 0 | ||||||||||||||||||||||||||||||||||||
3820 | - | |||||||||||||||||||||||||||||||||||||
3821 | GtkAllocation allocation; | - | ||||||||||||||||||||||||||||||||||||
3822 | d->gtk_widget_get_allocation(arrowWidget, &allocation); | - | ||||||||||||||||||||||||||||||||||||
3823 | QRect buttonRect(option->rect.left() + allocation.x, | - | ||||||||||||||||||||||||||||||||||||
3824 | option->rect.top() + allocation.y, | - | ||||||||||||||||||||||||||||||||||||
3825 | allocation.width, allocation.height); | - | ||||||||||||||||||||||||||||||||||||
3826 | - | |||||||||||||||||||||||||||||||||||||
3827 | switch (subControl) { | - | ||||||||||||||||||||||||||||||||||||
3828 | - | |||||||||||||||||||||||||||||||||||||
3829 | case SC_ComboBoxArrow: // Note: this indicates the arrowbutton for editable combos never executed: case SC_ComboBoxArrow: | 0 | ||||||||||||||||||||||||||||||||||||
3830 | rect = buttonRect; | - | ||||||||||||||||||||||||||||||||||||
3831 | break; never executed: break; | 0 | ||||||||||||||||||||||||||||||||||||
3832 | - | |||||||||||||||||||||||||||||||||||||
3833 | case SC_ComboBoxEditField: { never executed: case SC_ComboBoxEditField: | 0 | ||||||||||||||||||||||||||||||||||||
3834 | rect = visualRect(option->direction, option->rect, rect); | - | ||||||||||||||||||||||||||||||||||||
3835 | int xMargin = box->editable ? 1 : 4, yMargin = 2;
| 0 | ||||||||||||||||||||||||||||||||||||
3836 | GtkStyle *gtkComboStyle = d->gtk_widget_get_style(gtkCombo); | - | ||||||||||||||||||||||||||||||||||||
3837 | rect.setRect(option->rect.left() + gtkComboStyle->xthickness + xMargin, | - | ||||||||||||||||||||||||||||||||||||
3838 | option->rect.top() + gtkComboStyle->ythickness + yMargin, | - | ||||||||||||||||||||||||||||||||||||
3839 | option->rect.width() - buttonRect.width() - 2*(gtkComboStyle->xthickness + xMargin), | - | ||||||||||||||||||||||||||||||||||||
3840 | option->rect.height() - 2*(gtkComboStyle->ythickness + yMargin)); | - | ||||||||||||||||||||||||||||||||||||
3841 | rect = visualRect(option->direction, option->rect, rect); | - | ||||||||||||||||||||||||||||||||||||
3842 | break; never executed: break; | 0 | ||||||||||||||||||||||||||||||||||||
3843 | } | - | ||||||||||||||||||||||||||||||||||||
3844 | - | |||||||||||||||||||||||||||||||||||||
3845 | default: never executed: default: | 0 | ||||||||||||||||||||||||||||||||||||
3846 | break; never executed: break; | 0 | ||||||||||||||||||||||||||||||||||||
3847 | } | - | ||||||||||||||||||||||||||||||||||||
3848 | } | - | ||||||||||||||||||||||||||||||||||||
3849 | - | |||||||||||||||||||||||||||||||||||||
3850 | break; never executed: break; | 0 | ||||||||||||||||||||||||||||||||||||
3851 | #endif // QT_NO_COMBOBOX | - | ||||||||||||||||||||||||||||||||||||
3852 | - | |||||||||||||||||||||||||||||||||||||
3853 | default: never executed: default: | 0 | ||||||||||||||||||||||||||||||||||||
3854 | break; never executed: break; | 0 | ||||||||||||||||||||||||||||||||||||
3855 | } | - | ||||||||||||||||||||||||||||||||||||
3856 | - | |||||||||||||||||||||||||||||||||||||
3857 | return rect; never executed: return rect; | 0 | ||||||||||||||||||||||||||||||||||||
3858 | } | - | ||||||||||||||||||||||||||||||||||||
3859 | - | |||||||||||||||||||||||||||||||||||||
3860 | /*! | - | ||||||||||||||||||||||||||||||||||||
3861 | \reimp | - | ||||||||||||||||||||||||||||||||||||
3862 | */ | - | ||||||||||||||||||||||||||||||||||||
3863 | QSize QGtkStyle::sizeFromContents(ContentsType type, const QStyleOption *option, | - | ||||||||||||||||||||||||||||||||||||
3864 | const QSize &size, const QWidget *widget) const | - | ||||||||||||||||||||||||||||||||||||
3865 | { | - | ||||||||||||||||||||||||||||||||||||
3866 | Q_D(const QGtkStyle); | - | ||||||||||||||||||||||||||||||||||||
3867 | - | |||||||||||||||||||||||||||||||||||||
3868 | QSize newSize = QCommonStyle::sizeFromContents(type, option, size, widget); | - | ||||||||||||||||||||||||||||||||||||
3869 | if (!d->isThemeAvailable())
| 0 | ||||||||||||||||||||||||||||||||||||
3870 | return newSize; never executed: return newSize; | 0 | ||||||||||||||||||||||||||||||||||||
3871 | - | |||||||||||||||||||||||||||||||||||||
3872 | switch (type) { | - | ||||||||||||||||||||||||||||||||||||
3873 | case CT_GroupBox: never executed: case CT_GroupBox: | 0 | ||||||||||||||||||||||||||||||||||||
3874 | // Since we use a bold font we have to recalculate base width | - | ||||||||||||||||||||||||||||||||||||
3875 | if (const QGroupBox *gb = qobject_cast<const QGroupBox*>(widget)) {
| 0 | ||||||||||||||||||||||||||||||||||||
3876 | QFont font = gb->font(); | - | ||||||||||||||||||||||||||||||||||||
3877 | font.setBold(true); | - | ||||||||||||||||||||||||||||||||||||
3878 | QFontMetrics metrics(font); | - | ||||||||||||||||||||||||||||||||||||
3879 | int baseWidth = metrics.width(gb->title()) + metrics.width(QLatin1Char(' ')); | - | ||||||||||||||||||||||||||||||||||||
3880 | if (gb->isCheckable()) {
| 0 | ||||||||||||||||||||||||||||||||||||
3881 | baseWidth += proxy()->pixelMetric(QStyle::PM_IndicatorWidth, option, widget); | - | ||||||||||||||||||||||||||||||||||||
3882 | baseWidth += proxy()->pixelMetric(QStyle::PM_CheckBoxLabelSpacing, option, widget); | - | ||||||||||||||||||||||||||||||||||||
3883 | } never executed: end of block | 0 | ||||||||||||||||||||||||||||||||||||
3884 | newSize.setWidth(qMax(baseWidth, newSize.width())); | - | ||||||||||||||||||||||||||||||||||||
3885 | } never executed: end of block | 0 | ||||||||||||||||||||||||||||||||||||
3886 | newSize += QSize(4, 1 + groupBoxBottomMargin + groupBoxTopMargin + groupBoxTitleMargin); // Add some space below the groupbox | - | ||||||||||||||||||||||||||||||||||||
3887 | break; never executed: break; | 0 | ||||||||||||||||||||||||||||||||||||
3888 | case CT_ToolButton: never executed: case CT_ToolButton: | 0 | ||||||||||||||||||||||||||||||||||||
3889 | if (const QStyleOptionToolButton *toolbutton = qstyleoption_cast<const QStyleOptionToolButton *>(option)) {
| 0 | ||||||||||||||||||||||||||||||||||||
3890 | GtkWidget *gtkButton = d->gtkWidget("GtkToolButton.GtkButton"); | - | ||||||||||||||||||||||||||||||||||||
3891 | GtkStyle *gtkButtonStyle = d->gtk_widget_get_style(gtkButton); | - | ||||||||||||||||||||||||||||||||||||
3892 | newSize = size + QSize(2 * gtkButtonStyle->xthickness, 2 + 2 * gtkButtonStyle->ythickness); | - | ||||||||||||||||||||||||||||||||||||
3893 | if (widget && qobject_cast<QToolBar *>(widget->parentWidget())) {
| 0 | ||||||||||||||||||||||||||||||||||||
3894 | QSize minSize(0, 25); | - | ||||||||||||||||||||||||||||||||||||
3895 | if (toolbutton->toolButtonStyle != Qt::ToolButtonTextOnly)
| 0 | ||||||||||||||||||||||||||||||||||||
3896 | minSize = toolbutton->iconSize + QSize(12, 12); never executed: minSize = toolbutton->iconSize + QSize(12, 12); | 0 | ||||||||||||||||||||||||||||||||||||
3897 | newSize = newSize.expandedTo(minSize); | - | ||||||||||||||||||||||||||||||||||||
3898 | } never executed: end of block | 0 | ||||||||||||||||||||||||||||||||||||
3899 | - | |||||||||||||||||||||||||||||||||||||
3900 | if (toolbutton->features & QStyleOptionToolButton::HasMenu)
| 0 | ||||||||||||||||||||||||||||||||||||
3901 | newSize += QSize(6, 0); never executed: newSize += QSize(6, 0); | 0 | ||||||||||||||||||||||||||||||||||||
3902 | } never executed: end of block | 0 | ||||||||||||||||||||||||||||||||||||
3903 | break; never executed: break; | 0 | ||||||||||||||||||||||||||||||||||||
3904 | case CT_SpinBox: never executed: case CT_SpinBox: | 0 | ||||||||||||||||||||||||||||||||||||
3905 | // QSpinBox does some nasty things that depends on CT_LineEdit | - | ||||||||||||||||||||||||||||||||||||
3906 | newSize = newSize + QSize(0, -d->gtk_widget_get_style(d->gtkWidget("GtkSpinButton"))->ythickness * 2); | - | ||||||||||||||||||||||||||||||||||||
3907 | break; never executed: break; | 0 | ||||||||||||||||||||||||||||||||||||
3908 | case CT_RadioButton: never executed: case CT_RadioButton: | 0 | ||||||||||||||||||||||||||||||||||||
3909 | case CT_CheckBox: never executed: case CT_CheckBox: | 0 | ||||||||||||||||||||||||||||||||||||
3910 | newSize += QSize(0, 1); | - | ||||||||||||||||||||||||||||||||||||
3911 | break; never executed: break; | 0 | ||||||||||||||||||||||||||||||||||||
3912 | case CT_PushButton: never executed: case CT_PushButton: | 0 | ||||||||||||||||||||||||||||||||||||
3913 | if (const QStyleOptionButton *btn = qstyleoption_cast<const QStyleOptionButton *>(option)) {
| 0 | ||||||||||||||||||||||||||||||||||||
3914 | if (!btn->icon.isNull() && btn->iconSize.height() > 16)
| 0 | ||||||||||||||||||||||||||||||||||||
3915 | newSize -= QSize(0, 2); // From cleanlooksstyle never executed: newSize -= QSize(0, 2); | 0 | ||||||||||||||||||||||||||||||||||||
3916 | newSize += QSize(0, 1); | - | ||||||||||||||||||||||||||||||||||||
3917 | GtkWidget *gtkButton = d->gtkWidget("GtkButton"); | - | ||||||||||||||||||||||||||||||||||||
3918 | gint focusPadding, focusWidth; | - | ||||||||||||||||||||||||||||||||||||
3919 | d->gtk_widget_style_get(gtkButton, "focus-padding", &focusPadding, NULL); | - | ||||||||||||||||||||||||||||||||||||
3920 | d->gtk_widget_style_get(gtkButton, "focus-line-width", &focusWidth, NULL); | - | ||||||||||||||||||||||||||||||||||||
3921 | newSize = size; | - | ||||||||||||||||||||||||||||||||||||
3922 | GtkStyle *gtkButtonStyle = d->gtk_widget_get_style(gtkButton); | - | ||||||||||||||||||||||||||||||||||||
3923 | newSize += QSize(2*gtkButtonStyle->xthickness + 4, 2*gtkButtonStyle->ythickness); | - | ||||||||||||||||||||||||||||||||||||
3924 | newSize += QSize(2*(focusWidth + focusPadding + 2), 2*(focusWidth + focusPadding)); | - | ||||||||||||||||||||||||||||||||||||
3925 | - | |||||||||||||||||||||||||||||||||||||
3926 | GtkWidget *gtkButtonBox = d->gtkWidget("GtkHButtonBox"); | - | ||||||||||||||||||||||||||||||||||||
3927 | gint minWidth = 85, minHeight = 0; | - | ||||||||||||||||||||||||||||||||||||
3928 | d->gtk_widget_style_get(gtkButtonBox, "child-min-width", &minWidth, | - | ||||||||||||||||||||||||||||||||||||
3929 | "child-min-height", &minHeight, NULL); | - | ||||||||||||||||||||||||||||||||||||
3930 | if (!btn->text.isEmpty() && newSize.width() < minWidth)
| 0 | ||||||||||||||||||||||||||||||||||||
3931 | newSize.setWidth(minWidth); never executed: newSize.setWidth(minWidth); | 0 | ||||||||||||||||||||||||||||||||||||
3932 | if (newSize.height() < minHeight)
| 0 | ||||||||||||||||||||||||||||||||||||
3933 | newSize.setHeight(minHeight); never executed: newSize.setHeight(minHeight); | 0 | ||||||||||||||||||||||||||||||||||||
3934 | } never executed: end of block | 0 | ||||||||||||||||||||||||||||||||||||
3935 | break; never executed: break; | 0 | ||||||||||||||||||||||||||||||||||||
3936 | case CT_Slider: { never executed: case CT_Slider: | 0 | ||||||||||||||||||||||||||||||||||||
3937 | GtkWidget *gtkSlider = d->gtkWidget("GtkHScale"); | - | ||||||||||||||||||||||||||||||||||||
3938 | GtkStyle *gtkSliderStyle = d->gtk_widget_get_style(gtkSlider); | - | ||||||||||||||||||||||||||||||||||||
3939 | newSize = size + QSize(2*gtkSliderStyle->xthickness, 2*gtkSliderStyle->ythickness); } | - | ||||||||||||||||||||||||||||||||||||
3940 | break; never executed: break; | 0 | ||||||||||||||||||||||||||||||||||||
3941 | case CT_LineEdit: { never executed: case CT_LineEdit: | 0 | ||||||||||||||||||||||||||||||||||||
3942 | GtkWidget *gtkEntry = d->gtkWidget("GtkEntry"); | - | ||||||||||||||||||||||||||||||||||||
3943 | GtkStyle *gtkEntryStyle = d->gtk_widget_get_style(gtkEntry); | - | ||||||||||||||||||||||||||||||||||||
3944 | newSize = size + QSize(2*gtkEntryStyle->xthickness, 2 + 2*gtkEntryStyle->ythickness); } | - | ||||||||||||||||||||||||||||||||||||
3945 | break; never executed: break; | 0 | ||||||||||||||||||||||||||||||||||||
3946 | case CT_ItemViewItem: never executed: case CT_ItemViewItem: | 0 | ||||||||||||||||||||||||||||||||||||
3947 | newSize += QSize(0, 2); | - | ||||||||||||||||||||||||||||||||||||
3948 | break; never executed: break; | 0 | ||||||||||||||||||||||||||||||||||||
3949 | case CT_ComboBox: never executed: case CT_ComboBox: | 0 | ||||||||||||||||||||||||||||||||||||
3950 | if (const QStyleOptionComboBox *combo = qstyleoption_cast<const QStyleOptionComboBox *>(option)) {
| 0 | ||||||||||||||||||||||||||||||||||||
3951 | GtkWidget *gtkCombo = d->gtkWidget("GtkComboBox"); | - | ||||||||||||||||||||||||||||||||||||
3952 | QRect arrowButtonRect = proxy()->subControlRect(CC_ComboBox, combo, SC_ComboBoxArrow, widget); | - | ||||||||||||||||||||||||||||||||||||
3953 | GtkStyle *gtkComboStyle = d->gtk_widget_get_style(gtkCombo); | - | ||||||||||||||||||||||||||||||||||||
3954 | newSize = size + QSize(12 + arrowButtonRect.width() + 2*gtkComboStyle->xthickness, 4 + 2*gtkComboStyle->ythickness); | - | ||||||||||||||||||||||||||||||||||||
3955 | - | |||||||||||||||||||||||||||||||||||||
3956 | if (!(widget && qobject_cast<QToolBar *>(widget->parentWidget())))
| 0 | ||||||||||||||||||||||||||||||||||||
3957 | newSize += QSize(0, 2); never executed: newSize += QSize(0, 2); | 0 | ||||||||||||||||||||||||||||||||||||
3958 | } never executed: end of block | 0 | ||||||||||||||||||||||||||||||||||||
3959 | break; never executed: break; | 0 | ||||||||||||||||||||||||||||||||||||
3960 | case CT_TabBarTab: never executed: case CT_TabBarTab: | 0 | ||||||||||||||||||||||||||||||||||||
3961 | if (const QStyleOptionTab *tab = qstyleoption_cast<const QStyleOptionTab *>(option)) {
| 0 | ||||||||||||||||||||||||||||||||||||
3962 | if (!tab->icon.isNull())
| 0 | ||||||||||||||||||||||||||||||||||||
3963 | newSize += QSize(6, 0); never executed: newSize += QSize(6, 0); | 0 | ||||||||||||||||||||||||||||||||||||
3964 | } never executed: end of block | 0 | ||||||||||||||||||||||||||||||||||||
3965 | newSize += QSize(1, 1); | - | ||||||||||||||||||||||||||||||||||||
3966 | break; never executed: break; | 0 | ||||||||||||||||||||||||||||||||||||
3967 | case CT_MenuBarItem: never executed: case CT_MenuBarItem: | 0 | ||||||||||||||||||||||||||||||||||||
3968 | newSize += QSize(QGtkStylePrivate::menuItemHMargin * 4, QGtkStylePrivate::menuItemVMargin * 2 + 2); | - | ||||||||||||||||||||||||||||||||||||
3969 | break; never executed: break; | 0 | ||||||||||||||||||||||||||||||||||||
3970 | case CT_SizeGrip: never executed: case CT_SizeGrip: | 0 | ||||||||||||||||||||||||||||||||||||
3971 | newSize += QSize(4, 4); | - | ||||||||||||||||||||||||||||||||||||
3972 | break; never executed: break; | 0 | ||||||||||||||||||||||||||||||||||||
3973 | case CT_MdiControls: never executed: case CT_MdiControls: | 0 | ||||||||||||||||||||||||||||||||||||
3974 | if (const QStyleOptionComplex *styleOpt = qstyleoption_cast<const QStyleOptionComplex *>(option)) {
| 0 | ||||||||||||||||||||||||||||||||||||
3975 | int width = 0; | - | ||||||||||||||||||||||||||||||||||||
3976 | if (styleOpt->subControls & SC_MdiMinButton)
| 0 | ||||||||||||||||||||||||||||||||||||
3977 | width += 19 + 1; never executed: width += 19 + 1; | 0 | ||||||||||||||||||||||||||||||||||||
3978 | if (styleOpt->subControls & SC_MdiNormalButton)
| 0 | ||||||||||||||||||||||||||||||||||||
3979 | width += 19 + 1; never executed: width += 19 + 1; | 0 | ||||||||||||||||||||||||||||||||||||
3980 | if (styleOpt->subControls & SC_MdiCloseButton)
| 0 | ||||||||||||||||||||||||||||||||||||
3981 | width += 19 + 1; never executed: width += 19 + 1; | 0 | ||||||||||||||||||||||||||||||||||||
3982 | newSize = QSize(width, 19); | - | ||||||||||||||||||||||||||||||||||||
3983 | } else { never executed: end of block | 0 | ||||||||||||||||||||||||||||||||||||
3984 | newSize = QSize(60, 19); | - | ||||||||||||||||||||||||||||||||||||
3985 | } never executed: end of block | 0 | ||||||||||||||||||||||||||||||||||||
3986 | break; never executed: break; | 0 | ||||||||||||||||||||||||||||||||||||
3987 | case CT_MenuItem: never executed: case CT_MenuItem: | 0 | ||||||||||||||||||||||||||||||||||||
3988 | if (const QStyleOptionMenuItem *menuItem = qstyleoption_cast<const QStyleOptionMenuItem *>(option)) {
| 0 | ||||||||||||||||||||||||||||||||||||
3989 | int w = newSize.width(); | - | ||||||||||||||||||||||||||||||||||||
3990 | int maxpmw = menuItem->maxIconWidth; | - | ||||||||||||||||||||||||||||||||||||
3991 | int tabSpacing = 20; | - | ||||||||||||||||||||||||||||||||||||
3992 | if (menuItem->text.contains(QLatin1Char('\t')))
| 0 | ||||||||||||||||||||||||||||||||||||
3993 | w += tabSpacing; never executed: w += tabSpacing; | 0 | ||||||||||||||||||||||||||||||||||||
3994 | else if (menuItem->menuItemType == QStyleOptionMenuItem::SubMenu)
| 0 | ||||||||||||||||||||||||||||||||||||
3995 | w += 2 * QGtkStylePrivate::menuArrowHMargin; never executed: w += 2 * QGtkStylePrivate::menuArrowHMargin; | 0 | ||||||||||||||||||||||||||||||||||||
3996 | else if (menuItem->menuItemType == QStyleOptionMenuItem::DefaultItem) {
| 0 | ||||||||||||||||||||||||||||||||||||
3997 | // adjust the font and add the difference in size. | - | ||||||||||||||||||||||||||||||||||||
3998 | // it would be better if the font could be adjusted in the initStyleOption qmenu func!! | - | ||||||||||||||||||||||||||||||||||||
3999 | QFontMetrics fm(menuItem->font); | - | ||||||||||||||||||||||||||||||||||||
4000 | QFont fontBold = menuItem->font; | - | ||||||||||||||||||||||||||||||||||||
4001 | fontBold.setBold(true); | - | ||||||||||||||||||||||||||||||||||||
4002 | QFontMetrics fmBold(fontBold); | - | ||||||||||||||||||||||||||||||||||||
4003 | w += fmBold.width(menuItem->text) - fm.width(menuItem->text); | - | ||||||||||||||||||||||||||||||||||||
4004 | } never executed: end of block | 0 | ||||||||||||||||||||||||||||||||||||
4005 | - | |||||||||||||||||||||||||||||||||||||
4006 | int checkcol = qMax<int>(maxpmw, QGtkStylePrivate::menuCheckMarkWidth); // Windows always shows a check column | - | ||||||||||||||||||||||||||||||||||||
4007 | w += checkcol; | - | ||||||||||||||||||||||||||||||||||||
4008 | w += int(QGtkStylePrivate::menuRightBorder) + 10; | - | ||||||||||||||||||||||||||||||||||||
4009 | - | |||||||||||||||||||||||||||||||||||||
4010 | newSize.setWidth(w); | - | ||||||||||||||||||||||||||||||||||||
4011 | - | |||||||||||||||||||||||||||||||||||||
4012 | int textMargin = 8; | - | ||||||||||||||||||||||||||||||||||||
4013 | if (menuItem->menuItemType == QStyleOptionMenuItem::Separator) {
| 0 | ||||||||||||||||||||||||||||||||||||
4014 | GtkWidget *gtkMenuSeparator = d->gtkWidget("GtkMenu.GtkSeparatorMenuItem"); | - | ||||||||||||||||||||||||||||||||||||
4015 | GtkRequisition sizeReq = {0, 0}; | - | ||||||||||||||||||||||||||||||||||||
4016 | d->gtk_widget_size_request(gtkMenuSeparator, &sizeReq); | - | ||||||||||||||||||||||||||||||||||||
4017 | newSize = QSize(newSize.width(), sizeReq.height); | - | ||||||||||||||||||||||||||||||||||||
4018 | break; never executed: break; | 0 | ||||||||||||||||||||||||||||||||||||
4019 | } | - | ||||||||||||||||||||||||||||||||||||
4020 | - | |||||||||||||||||||||||||||||||||||||
4021 | GtkWidget *gtkMenuItem = d->gtkWidget("GtkMenu.GtkCheckMenuItem"); | - | ||||||||||||||||||||||||||||||||||||
4022 | GtkStyle* style = d->gtk_widget_get_style(gtkMenuItem); | - | ||||||||||||||||||||||||||||||||||||
4023 | - | |||||||||||||||||||||||||||||||||||||
4024 | // Note we get the perfect height for the default font since we | - | ||||||||||||||||||||||||||||||||||||
4025 | // set a fake text label on the gtkMenuItem | - | ||||||||||||||||||||||||||||||||||||
4026 | // But if custom fonts are used on the widget we need a minimum size | - | ||||||||||||||||||||||||||||||||||||
4027 | GtkRequisition sizeReq = {0, 0}; | - | ||||||||||||||||||||||||||||||||||||
4028 | d->gtk_widget_size_request(gtkMenuItem, &sizeReq); | - | ||||||||||||||||||||||||||||||||||||
4029 | newSize.setHeight(qMax(newSize.height() - 4, sizeReq.height)); | - | ||||||||||||||||||||||||||||||||||||
4030 | newSize += QSize(textMargin + style->xthickness - 1, 0); | - | ||||||||||||||||||||||||||||||||||||
4031 | - | |||||||||||||||||||||||||||||||||||||
4032 | gint checkSize; | - | ||||||||||||||||||||||||||||||||||||
4033 | d->gtk_widget_style_get(gtkMenuItem, "indicator-size", &checkSize, NULL); | - | ||||||||||||||||||||||||||||||||||||
4034 | newSize.setWidth(newSize.width() + qMax(0, checkSize - 20)); | - | ||||||||||||||||||||||||||||||||||||
4035 | } never executed: end of block | 0 | ||||||||||||||||||||||||||||||||||||
4036 | break; never executed: break; | 0 | ||||||||||||||||||||||||||||||||||||
4037 | default: never executed: default: | 0 | ||||||||||||||||||||||||||||||||||||
4038 | break; never executed: break; | 0 | ||||||||||||||||||||||||||||||||||||
4039 | } | - | ||||||||||||||||||||||||||||||||||||
4040 | - | |||||||||||||||||||||||||||||||||||||
4041 | return newSize; never executed: return newSize; | 0 | ||||||||||||||||||||||||||||||||||||
4042 | } | - | ||||||||||||||||||||||||||||||||||||
4043 | - | |||||||||||||||||||||||||||||||||||||
4044 | - | |||||||||||||||||||||||||||||||||||||
4045 | /*! \reimp */ | - | ||||||||||||||||||||||||||||||||||||
4046 | QPixmap QGtkStyle::standardPixmap(StandardPixmap sp, const QStyleOption *option, | - | ||||||||||||||||||||||||||||||||||||
4047 | const QWidget *widget) const | - | ||||||||||||||||||||||||||||||||||||
4048 | { | - | ||||||||||||||||||||||||||||||||||||
4049 | Q_D(const QGtkStyle); | - | ||||||||||||||||||||||||||||||||||||
4050 | - | |||||||||||||||||||||||||||||||||||||
4051 | if (!d->isThemeAvailable())
| 0 | ||||||||||||||||||||||||||||||||||||
4052 | return QCommonStyle::standardPixmap(sp, option, widget); never executed: return QCommonStyle::standardPixmap(sp, option, widget); | 0 | ||||||||||||||||||||||||||||||||||||
4053 | - | |||||||||||||||||||||||||||||||||||||
4054 | QPixmap pixmap; | - | ||||||||||||||||||||||||||||||||||||
4055 | switch (sp) { | - | ||||||||||||||||||||||||||||||||||||
4056 | - | |||||||||||||||||||||||||||||||||||||
4057 | case SP_TitleBarNormalButton: { never executed: case SP_TitleBarNormalButton: | 0 | ||||||||||||||||||||||||||||||||||||
4058 | QImage restoreButton(dock_widget_restore_xpm); | - | ||||||||||||||||||||||||||||||||||||
4059 | QColor alphaCorner = restoreButton.color(2); | - | ||||||||||||||||||||||||||||||||||||
4060 | alphaCorner.setAlpha(80); | - | ||||||||||||||||||||||||||||||||||||
4061 | restoreButton.setColor(2, alphaCorner.rgba()); | - | ||||||||||||||||||||||||||||||||||||
4062 | alphaCorner.setAlpha(180); | - | ||||||||||||||||||||||||||||||||||||
4063 | restoreButton.setColor(4, alphaCorner.rgba()); | - | ||||||||||||||||||||||||||||||||||||
4064 | return QPixmap::fromImage(restoreButton); never executed: return QPixmap::fromImage(restoreButton); | 0 | ||||||||||||||||||||||||||||||||||||
4065 | } | - | ||||||||||||||||||||||||||||||||||||
4066 | break; dead code: break; | - | ||||||||||||||||||||||||||||||||||||
4067 | - | |||||||||||||||||||||||||||||||||||||
4068 | case SP_TitleBarCloseButton: // Fall through never executed: case SP_TitleBarCloseButton: | 0 | ||||||||||||||||||||||||||||||||||||
4069 | case SP_DockWidgetCloseButton: { never executed: case SP_DockWidgetCloseButton: | 0 | ||||||||||||||||||||||||||||||||||||
4070 | - | |||||||||||||||||||||||||||||||||||||
4071 | QImage closeButton(dock_widget_close_xpm); | - | ||||||||||||||||||||||||||||||||||||
4072 | QColor alphaCorner = closeButton.color(2); | - | ||||||||||||||||||||||||||||||||||||
4073 | alphaCorner.setAlpha(80); | - | ||||||||||||||||||||||||||||||||||||
4074 | closeButton.setColor(2, alphaCorner.rgba()); | - | ||||||||||||||||||||||||||||||||||||
4075 | return QPixmap::fromImage(closeButton); never executed: return QPixmap::fromImage(closeButton); | 0 | ||||||||||||||||||||||||||||||||||||
4076 | } | - | ||||||||||||||||||||||||||||||||||||
4077 | break; dead code: break; | - | ||||||||||||||||||||||||||||||||||||
4078 | - | |||||||||||||||||||||||||||||||||||||
4079 | case SP_DialogDiscardButton: never executed: case SP_DialogDiscardButton: | 0 | ||||||||||||||||||||||||||||||||||||
4080 | return qt_gtk_get_icon(GTK_STOCK_DELETE); never executed: return qt_gtk_get_icon("gtk-delete"); | 0 | ||||||||||||||||||||||||||||||||||||
4081 | case SP_DialogOkButton: never executed: case SP_DialogOkButton: | 0 | ||||||||||||||||||||||||||||||||||||
4082 | return qt_gtk_get_icon(GTK_STOCK_OK); never executed: return qt_gtk_get_icon("gtk-ok"); | 0 | ||||||||||||||||||||||||||||||||||||
4083 | case SP_DialogCancelButton: never executed: case SP_DialogCancelButton: | 0 | ||||||||||||||||||||||||||||||||||||
4084 | return qt_gtk_get_icon(GTK_STOCK_CANCEL); never executed: return qt_gtk_get_icon("gtk-cancel"); | 0 | ||||||||||||||||||||||||||||||||||||
4085 | case SP_DialogYesButton: never executed: case SP_DialogYesButton: | 0 | ||||||||||||||||||||||||||||||||||||
4086 | return qt_gtk_get_icon(GTK_STOCK_YES); never executed: return qt_gtk_get_icon("gtk-yes"); | 0 | ||||||||||||||||||||||||||||||||||||
4087 | case SP_DialogNoButton: never executed: case SP_DialogNoButton: | 0 | ||||||||||||||||||||||||||||||||||||
4088 | return qt_gtk_get_icon(GTK_STOCK_NO); never executed: return qt_gtk_get_icon("gtk-no"); | 0 | ||||||||||||||||||||||||||||||||||||
4089 | case SP_DialogOpenButton: never executed: case SP_DialogOpenButton: | 0 | ||||||||||||||||||||||||||||||||||||
4090 | return qt_gtk_get_icon(GTK_STOCK_OPEN); never executed: return qt_gtk_get_icon("gtk-open"); | 0 | ||||||||||||||||||||||||||||||||||||
4091 | case SP_DialogCloseButton: never executed: case SP_DialogCloseButton: | 0 | ||||||||||||||||||||||||||||||||||||
4092 | return qt_gtk_get_icon(GTK_STOCK_CLOSE); never executed: return qt_gtk_get_icon("gtk-close"); | 0 | ||||||||||||||||||||||||||||||||||||
4093 | case SP_DialogApplyButton: never executed: case SP_DialogApplyButton: | 0 | ||||||||||||||||||||||||||||||||||||
4094 | return qt_gtk_get_icon(GTK_STOCK_APPLY); never executed: return qt_gtk_get_icon("gtk-apply"); | 0 | ||||||||||||||||||||||||||||||||||||
4095 | case SP_DialogSaveButton: never executed: case SP_DialogSaveButton: | 0 | ||||||||||||||||||||||||||||||||||||
4096 | return qt_gtk_get_icon(GTK_STOCK_SAVE); never executed: return qt_gtk_get_icon("gtk-save"); | 0 | ||||||||||||||||||||||||||||||||||||
4097 | case SP_MessageBoxWarning: never executed: case SP_MessageBoxWarning: | 0 | ||||||||||||||||||||||||||||||||||||
4098 | return qt_gtk_get_icon(GTK_STOCK_DIALOG_WARNING, GTK_ICON_SIZE_DIALOG); never executed: return qt_gtk_get_icon("gtk-dialog-warning", GTK_ICON_SIZE_DIALOG); | 0 | ||||||||||||||||||||||||||||||||||||
4099 | case SP_MessageBoxQuestion: never executed: case SP_MessageBoxQuestion: | 0 | ||||||||||||||||||||||||||||||||||||
4100 | return qt_gtk_get_icon(GTK_STOCK_DIALOG_QUESTION, GTK_ICON_SIZE_DIALOG); never executed: return qt_gtk_get_icon("gtk-dialog-question", GTK_ICON_SIZE_DIALOG); | 0 | ||||||||||||||||||||||||||||||||||||
4101 | case SP_MessageBoxInformation: never executed: case SP_MessageBoxInformation: | 0 | ||||||||||||||||||||||||||||||||||||
4102 | return qt_gtk_get_icon(GTK_STOCK_DIALOG_INFO, GTK_ICON_SIZE_DIALOG); never executed: return qt_gtk_get_icon("gtk-dialog-info", GTK_ICON_SIZE_DIALOG); | 0 | ||||||||||||||||||||||||||||||||||||
4103 | case SP_MessageBoxCritical: never executed: case SP_MessageBoxCritical: | 0 | ||||||||||||||||||||||||||||||||||||
4104 | return qt_gtk_get_icon(GTK_STOCK_DIALOG_ERROR, GTK_ICON_SIZE_DIALOG); never executed: return qt_gtk_get_icon("gtk-dialog-error", GTK_ICON_SIZE_DIALOG); | 0 | ||||||||||||||||||||||||||||||||||||
4105 | default: never executed: default: | 0 | ||||||||||||||||||||||||||||||||||||
4106 | return QCommonStyle::standardPixmap(sp, option, widget); never executed: return QCommonStyle::standardPixmap(sp, option, widget); | 0 | ||||||||||||||||||||||||||||||||||||
4107 | } | - | ||||||||||||||||||||||||||||||||||||
4108 | return pixmap; never executed: return pixmap; | 0 | ||||||||||||||||||||||||||||||||||||
4109 | } | - | ||||||||||||||||||||||||||||||||||||
4110 | - | |||||||||||||||||||||||||||||||||||||
4111 | /*! | - | ||||||||||||||||||||||||||||||||||||
4112 | \reimp | - | ||||||||||||||||||||||||||||||||||||
4113 | */ | - | ||||||||||||||||||||||||||||||||||||
4114 | QIcon QGtkStyle::standardIcon(StandardPixmap standardIcon, | - | ||||||||||||||||||||||||||||||||||||
4115 | const QStyleOption *option, | - | ||||||||||||||||||||||||||||||||||||
4116 | const QWidget *widget) const | - | ||||||||||||||||||||||||||||||||||||
4117 | { | - | ||||||||||||||||||||||||||||||||||||
4118 | Q_D(const QGtkStyle); | - | ||||||||||||||||||||||||||||||||||||
4119 | - | |||||||||||||||||||||||||||||||||||||
4120 | if (!d->isThemeAvailable())
| 0 | ||||||||||||||||||||||||||||||||||||
4121 | return QCommonStyle::standardIcon(standardIcon, option, widget); never executed: return QCommonStyle::standardIcon(standardIcon, option, widget); | 0 | ||||||||||||||||||||||||||||||||||||
4122 | switch (standardIcon) { | - | ||||||||||||||||||||||||||||||||||||
4123 | case SP_DialogDiscardButton: never executed: case SP_DialogDiscardButton: | 0 | ||||||||||||||||||||||||||||||||||||
4124 | return qt_gtk_get_icon(GTK_STOCK_DELETE); never executed: return qt_gtk_get_icon("gtk-delete"); | 0 | ||||||||||||||||||||||||||||||||||||
4125 | case SP_DialogOkButton: never executed: case SP_DialogOkButton: | 0 | ||||||||||||||||||||||||||||||||||||
4126 | return qt_gtk_get_icon(GTK_STOCK_OK); never executed: return qt_gtk_get_icon("gtk-ok"); | 0 | ||||||||||||||||||||||||||||||||||||
4127 | case SP_DialogCancelButton: never executed: case SP_DialogCancelButton: | 0 | ||||||||||||||||||||||||||||||||||||
4128 | return qt_gtk_get_icon(GTK_STOCK_CANCEL); never executed: return qt_gtk_get_icon("gtk-cancel"); | 0 | ||||||||||||||||||||||||||||||||||||
4129 | case SP_DialogYesButton: never executed: case SP_DialogYesButton: | 0 | ||||||||||||||||||||||||||||||||||||
4130 | return qt_gtk_get_icon(GTK_STOCK_YES); never executed: return qt_gtk_get_icon("gtk-yes"); | 0 | ||||||||||||||||||||||||||||||||||||
4131 | case SP_DialogNoButton: never executed: case SP_DialogNoButton: | 0 | ||||||||||||||||||||||||||||||||||||
4132 | return qt_gtk_get_icon(GTK_STOCK_NO); never executed: return qt_gtk_get_icon("gtk-no"); | 0 | ||||||||||||||||||||||||||||||||||||
4133 | case SP_DialogOpenButton: never executed: case SP_DialogOpenButton: | 0 | ||||||||||||||||||||||||||||||||||||
4134 | return qt_gtk_get_icon(GTK_STOCK_OPEN); never executed: return qt_gtk_get_icon("gtk-open"); | 0 | ||||||||||||||||||||||||||||||||||||
4135 | case SP_DialogCloseButton: never executed: case SP_DialogCloseButton: | 0 | ||||||||||||||||||||||||||||||||||||
4136 | return qt_gtk_get_icon(GTK_STOCK_CLOSE); never executed: return qt_gtk_get_icon("gtk-close"); | 0 | ||||||||||||||||||||||||||||||||||||
4137 | case SP_DialogApplyButton: never executed: case SP_DialogApplyButton: | 0 | ||||||||||||||||||||||||||||||||||||
4138 | return qt_gtk_get_icon(GTK_STOCK_APPLY); never executed: return qt_gtk_get_icon("gtk-apply"); | 0 | ||||||||||||||||||||||||||||||||||||
4139 | case SP_DialogSaveButton: never executed: case SP_DialogSaveButton: | 0 | ||||||||||||||||||||||||||||||||||||
4140 | return qt_gtk_get_icon(GTK_STOCK_SAVE); never executed: return qt_gtk_get_icon("gtk-save"); | 0 | ||||||||||||||||||||||||||||||||||||
4141 | case SP_MessageBoxWarning: never executed: case SP_MessageBoxWarning: | 0 | ||||||||||||||||||||||||||||||||||||
4142 | return qt_gtk_get_icon(GTK_STOCK_DIALOG_WARNING, GTK_ICON_SIZE_DIALOG); never executed: return qt_gtk_get_icon("gtk-dialog-warning", GTK_ICON_SIZE_DIALOG); | 0 | ||||||||||||||||||||||||||||||||||||
4143 | case SP_MessageBoxQuestion: never executed: case SP_MessageBoxQuestion: | 0 | ||||||||||||||||||||||||||||||||||||
4144 | return qt_gtk_get_icon(GTK_STOCK_DIALOG_QUESTION, GTK_ICON_SIZE_DIALOG); never executed: return qt_gtk_get_icon("gtk-dialog-question", GTK_ICON_SIZE_DIALOG); | 0 | ||||||||||||||||||||||||||||||||||||
4145 | case SP_MessageBoxInformation: never executed: case SP_MessageBoxInformation: | 0 | ||||||||||||||||||||||||||||||||||||
4146 | return qt_gtk_get_icon(GTK_STOCK_DIALOG_INFO, GTK_ICON_SIZE_DIALOG); never executed: return qt_gtk_get_icon("gtk-dialog-info", GTK_ICON_SIZE_DIALOG); | 0 | ||||||||||||||||||||||||||||||||||||
4147 | case SP_MessageBoxCritical: never executed: case SP_MessageBoxCritical: | 0 | ||||||||||||||||||||||||||||||||||||
4148 | return qt_gtk_get_icon(GTK_STOCK_DIALOG_ERROR, GTK_ICON_SIZE_DIALOG); never executed: return qt_gtk_get_icon("gtk-dialog-error", GTK_ICON_SIZE_DIALOG); | 0 | ||||||||||||||||||||||||||||||||||||
4149 | default: never executed: default: | 0 | ||||||||||||||||||||||||||||||||||||
4150 | return QCommonStyle::standardIcon(standardIcon, option, widget); never executed: return QCommonStyle::standardIcon(standardIcon, option, widget); | 0 | ||||||||||||||||||||||||||||||||||||
4151 | } | - | ||||||||||||||||||||||||||||||||||||
4152 | } | - | ||||||||||||||||||||||||||||||||||||
4153 | - | |||||||||||||||||||||||||||||||||||||
4154 | - | |||||||||||||||||||||||||||||||||||||
4155 | /*! \reimp */ | - | ||||||||||||||||||||||||||||||||||||
4156 | QRect QGtkStyle::subElementRect(SubElement element, const QStyleOption *option, const QWidget *widget) const | - | ||||||||||||||||||||||||||||||||||||
4157 | { | - | ||||||||||||||||||||||||||||||||||||
4158 | Q_D(const QGtkStyle); | - | ||||||||||||||||||||||||||||||||||||
4159 | - | |||||||||||||||||||||||||||||||||||||
4160 | QRect r = QCommonStyle::subElementRect(element, option, widget); | - | ||||||||||||||||||||||||||||||||||||
4161 | if (!d->isThemeAvailable())
| 0 | ||||||||||||||||||||||||||||||||||||
4162 | return r; never executed: return r; | 0 | ||||||||||||||||||||||||||||||||||||
4163 | - | |||||||||||||||||||||||||||||||||||||
4164 | switch (element) { | - | ||||||||||||||||||||||||||||||||||||
4165 | case SE_PushButtonFocusRect: never executed: case SE_PushButtonFocusRect: | 0 | ||||||||||||||||||||||||||||||||||||
4166 | r.adjust(0, 1, 0, -1); | - | ||||||||||||||||||||||||||||||||||||
4167 | break; never executed: break; | 0 | ||||||||||||||||||||||||||||||||||||
4168 | case SE_DockWidgetTitleBarText: { never executed: case SE_DockWidgetTitleBarText: | 0 | ||||||||||||||||||||||||||||||||||||
4169 | const QStyleOptionDockWidgetV2 *v2 | - | ||||||||||||||||||||||||||||||||||||
4170 | = qstyleoption_cast<const QStyleOptionDockWidgetV2*>(option); | - | ||||||||||||||||||||||||||||||||||||
4171 | bool verticalTitleBar = v2 == 0 ? false : v2->verticalTitleBar;
| 0 | ||||||||||||||||||||||||||||||||||||
4172 | if (verticalTitleBar) {
| 0 | ||||||||||||||||||||||||||||||||||||
4173 | r.adjust(0, 0, 0, -4); | - | ||||||||||||||||||||||||||||||||||||
4174 | } else { never executed: end of block | 0 | ||||||||||||||||||||||||||||||||||||
4175 | if (option->direction == Qt::LeftToRight)
| 0 | ||||||||||||||||||||||||||||||||||||
4176 | r.adjust(4, 0, 0, 0); never executed: r.adjust(4, 0, 0, 0); | 0 | ||||||||||||||||||||||||||||||||||||
4177 | else | - | ||||||||||||||||||||||||||||||||||||
4178 | r.adjust(0, 0, -4, 0); never executed: r.adjust(0, 0, -4, 0); | 0 | ||||||||||||||||||||||||||||||||||||
4179 | } | - | ||||||||||||||||||||||||||||||||||||
4180 | - | |||||||||||||||||||||||||||||||||||||
4181 | break; never executed: break; | 0 | ||||||||||||||||||||||||||||||||||||
4182 | } | - | ||||||||||||||||||||||||||||||||||||
4183 | case SE_ProgressBarLabel: never executed: case SE_ProgressBarLabel: | 0 | ||||||||||||||||||||||||||||||||||||
4184 | case SE_ProgressBarContents: never executed: case SE_ProgressBarContents: | 0 | ||||||||||||||||||||||||||||||||||||
4185 | case SE_ProgressBarGroove: never executed: case SE_ProgressBarGroove: | 0 | ||||||||||||||||||||||||||||||||||||
4186 | return option->rect; never executed: return option->rect; | 0 | ||||||||||||||||||||||||||||||||||||
4187 | case SE_PushButtonContents: never executed: case SE_PushButtonContents: | 0 | ||||||||||||||||||||||||||||||||||||
4188 | if (!d->gtk_check_version(2, 10, 0)) {
| 0 | ||||||||||||||||||||||||||||||||||||
4189 | GtkWidget *gtkButton = d->gtkWidget("GtkButton"); | - | ||||||||||||||||||||||||||||||||||||
4190 | GtkBorder *border = 0; | - | ||||||||||||||||||||||||||||||||||||
4191 | d->gtk_widget_style_get(gtkButton, "inner-border", &border, NULL); | - | ||||||||||||||||||||||||||||||||||||
4192 | if (border) {
| 0 | ||||||||||||||||||||||||||||||||||||
4193 | r = option->rect.adjusted(border->left, border->top, -border->right, -border->bottom); | - | ||||||||||||||||||||||||||||||||||||
4194 | d->gtk_border_free(border); | - | ||||||||||||||||||||||||||||||||||||
4195 | } else { never executed: end of block | 0 | ||||||||||||||||||||||||||||||||||||
4196 | r = option->rect.adjusted(1, 1, -1, -1); | - | ||||||||||||||||||||||||||||||||||||
4197 | } never executed: end of block | 0 | ||||||||||||||||||||||||||||||||||||
4198 | r = visualRect(option->direction, option->rect, r); | - | ||||||||||||||||||||||||||||||||||||
4199 | } never executed: end of block | 0 | ||||||||||||||||||||||||||||||||||||
4200 | break; never executed: break; | 0 | ||||||||||||||||||||||||||||||||||||
4201 | default: never executed: default: | 0 | ||||||||||||||||||||||||||||||||||||
4202 | break; never executed: break; | 0 | ||||||||||||||||||||||||||||||||||||
4203 | } | - | ||||||||||||||||||||||||||||||||||||
4204 | - | |||||||||||||||||||||||||||||||||||||
4205 | return r; never executed: return r; | 0 | ||||||||||||||||||||||||||||||||||||
4206 | } | - | ||||||||||||||||||||||||||||||||||||
4207 | - | |||||||||||||||||||||||||||||||||||||
4208 | /*! | - | ||||||||||||||||||||||||||||||||||||
4209 | \reimp | - | ||||||||||||||||||||||||||||||||||||
4210 | */ | - | ||||||||||||||||||||||||||||||||||||
4211 | QRect QGtkStyle::itemPixmapRect(const QRect &r, int flags, const QPixmap &pixmap) const | - | ||||||||||||||||||||||||||||||||||||
4212 | { | - | ||||||||||||||||||||||||||||||||||||
4213 | return QCommonStyle::itemPixmapRect(r, flags, pixmap); never executed: return QCommonStyle::itemPixmapRect(r, flags, pixmap); | 0 | ||||||||||||||||||||||||||||||||||||
4214 | } | - | ||||||||||||||||||||||||||||||||||||
4215 | - | |||||||||||||||||||||||||||||||||||||
4216 | /*! | - | ||||||||||||||||||||||||||||||||||||
4217 | \reimp | - | ||||||||||||||||||||||||||||||||||||
4218 | */ | - | ||||||||||||||||||||||||||||||||||||
4219 | void QGtkStyle::drawItemPixmap(QPainter *painter, const QRect &rect, | - | ||||||||||||||||||||||||||||||||||||
4220 | int alignment, const QPixmap &pixmap) const | - | ||||||||||||||||||||||||||||||||||||
4221 | { | - | ||||||||||||||||||||||||||||||||||||
4222 | QCommonStyle::drawItemPixmap(painter, rect, alignment, pixmap); | - | ||||||||||||||||||||||||||||||||||||
4223 | } never executed: end of block | 0 | ||||||||||||||||||||||||||||||||||||
4224 | - | |||||||||||||||||||||||||||||||||||||
4225 | /*! | - | ||||||||||||||||||||||||||||||||||||
4226 | \reimp | - | ||||||||||||||||||||||||||||||||||||
4227 | */ | - | ||||||||||||||||||||||||||||||||||||
4228 | QStyle::SubControl QGtkStyle::hitTestComplexControl(ComplexControl cc, const QStyleOptionComplex *opt, | - | ||||||||||||||||||||||||||||||||||||
4229 | const QPoint &pt, const QWidget *w) const | - | ||||||||||||||||||||||||||||||||||||
4230 | { | - | ||||||||||||||||||||||||||||||||||||
4231 | return QCommonStyle::hitTestComplexControl(cc, opt, pt, w); never executed: return QCommonStyle::hitTestComplexControl(cc, opt, pt, w); | 0 | ||||||||||||||||||||||||||||||||||||
4232 | } | - | ||||||||||||||||||||||||||||||||||||
4233 | - | |||||||||||||||||||||||||||||||||||||
4234 | /*! | - | ||||||||||||||||||||||||||||||||||||
4235 | \reimp | - | ||||||||||||||||||||||||||||||||||||
4236 | */ | - | ||||||||||||||||||||||||||||||||||||
4237 | QPixmap QGtkStyle::generatedIconPixmap(QIcon::Mode iconMode, const QPixmap &pixmap, | - | ||||||||||||||||||||||||||||||||||||
4238 | const QStyleOption *opt) const | - | ||||||||||||||||||||||||||||||||||||
4239 | { | - | ||||||||||||||||||||||||||||||||||||
4240 | return QCommonStyle::generatedIconPixmap(iconMode, pixmap, opt); never executed: return QCommonStyle::generatedIconPixmap(iconMode, pixmap, opt); | 0 | ||||||||||||||||||||||||||||||||||||
4241 | } | - | ||||||||||||||||||||||||||||||||||||
4242 | - | |||||||||||||||||||||||||||||||||||||
4243 | /*! | - | ||||||||||||||||||||||||||||||||||||
4244 | \reimp | - | ||||||||||||||||||||||||||||||||||||
4245 | */ | - | ||||||||||||||||||||||||||||||||||||
4246 | void QGtkStyle::drawItemText(QPainter *painter, const QRect &rect, int alignment, const QPalette &pal, | - | ||||||||||||||||||||||||||||||||||||
4247 | bool enabled, const QString& text, QPalette::ColorRole textRole) const | - | ||||||||||||||||||||||||||||||||||||
4248 | { | - | ||||||||||||||||||||||||||||||||||||
4249 | return QCommonStyle::drawItemText(painter, rect, alignment, pal, enabled, text, textRole); never executed: return QCommonStyle::drawItemText(painter, rect, alignment, pal, enabled, text, textRole); | 0 | ||||||||||||||||||||||||||||||||||||
4250 | } | - | ||||||||||||||||||||||||||||||||||||
4251 | - | |||||||||||||||||||||||||||||||||||||
4252 | QT_END_NAMESPACE | - | ||||||||||||||||||||||||||||||||||||
4253 | - | |||||||||||||||||||||||||||||||||||||
4254 | #endif //!defined(QT_NO_STYLE_QGTK) | - | ||||||||||||||||||||||||||||||||||||
Source code | Switch to Preprocessed file |