qwindowsstyle.cpp

Absolute File Name:/home/qt/qt5_coco/qt5/qtbase/src/widgets/styles/qwindowsstyle.cpp
Source codeSwitch to Preprocessed file
LineSourceCount
1/****************************************************************************-
2**-
3** Copyright (C) 2016 The Qt Company Ltd.-
4** Contact: https://www.qt.io/licensing/-
5**-
6** This file is part of the QtWidgets module of the Qt Toolkit.-
7**-
8** $QT_BEGIN_LICENSE:LGPL$-
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 https://www.qt.io/terms-conditions. For further-
15** information use the contact form at https://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 3 as published by the Free Software-
20** Foundation and appearing in the file LICENSE.LGPL3 included in the-
21** packaging of this file. Please review the following information to-
22** ensure the GNU Lesser General Public License version 3 requirements-
23** will be met: https://www.gnu.org/licenses/lgpl-3.0.html.-
24**-
25** GNU General Public License Usage-
26** Alternatively, this file may be used under the terms of the GNU-
27** General Public License version 2.0 or (at your option) the GNU General-
28** Public license version 3 or any later version approved by the KDE Free-
29** Qt Foundation. The licenses are as published by the Free Software-
30** Foundation and appearing in the file LICENSE.GPL2 and LICENSE.GPL3-
31** included in the packaging of this file. Please review the following-
32** information to ensure the GNU General Public License requirements will-
33** be met: https://www.gnu.org/licenses/gpl-2.0.html and-
34** https://www.gnu.org/licenses/gpl-3.0.html.-
35**-
36** $QT_END_LICENSE$-
37**-
38****************************************************************************/-
39-
40#include "qwindowsstyle_p.h"-
41#include "qwindowsstyle_p_p.h"-
42-
43#if !defined(QT_NO_STYLE_WINDOWS) || defined(QT_PLUGIN)-
44-
45#include <private/qsystemlibrary_p.h>-
46#include "qapplication.h"-
47#include "qbitmap.h"-
48#include "qdrawutil.h" // for now-
49#include "qevent.h"-
50#include "qmenu.h"-
51#include "qmenubar.h"-
52#include <private/qmenubar_p.h>-
53#include "qpaintengine.h"-
54#include "qpainter.h"-
55#include "qrubberband.h"-
56#include "qstyleoption.h"-
57#include "qtabbar.h"-
58#include "qwidget.h"-
59#include "qdebug.h"-
60#include "qmainwindow.h"-
61#include "qfile.h"-
62#include "qtextstream.h"-
63#include "qpixmapcache.h"-
64#include "qwizard.h"-
65#include "qlistview.h"-
66#include <private/qmath_p.h>-
67#include <qmath.h>-
68#include <QtGui/qscreen.h>-
69#include <QtGui/qwindow.h>-
70#include <qpa/qplatformtheme.h>-
71#include <qpa/qplatformscreen.h>-
72#include <private/qguiapplication_p.h>-
73#include <private/qhighdpiscaling_p.h>-
74-
75#include <private/qstylehelper_p.h>-
76#include <private/qstyleanimation_p.h>-
77-
78#include <algorithm>-
79-
80QT_BEGIN_NAMESPACE-
81-
82#if defined(Q_OS_WIN)-
83-
84QT_BEGIN_INCLUDE_NAMESPACE-
85#include "qt_windows.h"-
86QT_END_INCLUDE_NAMESPACE-
87# ifndef COLOR_GRADIENTACTIVECAPTION-
88# define COLOR_GRADIENTACTIVECAPTION 27-
89# endif-
90# ifndef COLOR_GRADIENTINACTIVECAPTION-
91# define COLOR_GRADIENTINACTIVECAPTION 28-
92# endif-
93-
94-
95typedef struct-
96{-
97 DWORD cbSize;-
98 HICON hIcon;-
99 int iSysImageIndex;-
100 int iIcon;-
101 WCHAR szPath[MAX_PATH];-
102} QSHSTOCKICONINFO;-
103-
104#define _SHGFI_SMALLICON 0x000000001-
105#define _SHGFI_LARGEICON 0x000000000-
106#define _SHGFI_ICON 0x000000100-
107#define _SIID_SHIELD 77-
108-
109typedef HRESULT (WINAPI *PtrSHGetStockIconInfo)(int siid, int uFlags, QSHSTOCKICONINFO *psii);-
110static PtrSHGetStockIconInfo pSHGetStockIconInfo = 0;-
111-
112Q_GUI_EXPORT HICON qt_pixmapToWinHICON(const QPixmap &);-
113Q_GUI_EXPORT QPixmap qt_pixmapFromWinHICON(HICON icon);-
114#endif //Q_OS_WIN-
115-
116QT_BEGIN_INCLUDE_NAMESPACE-
117#include <limits.h>-
118QT_END_INCLUDE_NAMESPACE-
119-
120enum QSliderDirection { SlUp, SlDown, SlLeft, SlRight };-
121-
122/*-
123 \internal-
124*/-
125-
126QWindowsStylePrivate::QWindowsStylePrivate()-
127 : alt_down(false), menuBarTimer(0)-
128{-
129#if defined(Q_OS_WIN) && !defined(Q_OS_WINCE)-
130 if ((QSysInfo::WindowsVersion >= QSysInfo::WV_VISTA-
131 && (QSysInfo::WindowsVersion & QSysInfo::WV_NT_based))) {-
132 QSystemLibrary shellLib(QLatin1String("shell32"));-
133 pSHGetStockIconInfo = (PtrSHGetStockIconInfo)shellLib.resolve("SHGetStockIconInfo");-
134 }-
135#endif-
136}
never executed: end of block
0
137-
138qreal QWindowsStylePrivate::appDevicePixelRatio()-
139{-
140 return qApp->devicePixelRatio();
never executed: return (static_cast<QApplication *>(QCoreApplication::instance()))->devicePixelRatio();
0
141}-
142-
143// Returns \c true if the toplevel parent of \a widget has seen the Alt-key-
144bool QWindowsStylePrivate::hasSeenAlt(const QWidget *widget) const-
145{-
146 widget = widget->window();-
147 return seenAlt.contains(widget);
never executed: return seenAlt.contains(widget);
0
148}-
149-
150/*!-
151 \reimp-
152*/-
153bool QWindowsStyle::eventFilter(QObject *o, QEvent *e)-
154{-
155 // Records Alt- and Focus events-
156 if (!o->isWidgetType())
!o->isWidgetType()Description
TRUEnever evaluated
FALSEnever evaluated
0
157 return QObject::eventFilter(o, e);
never executed: return QObject::eventFilter(o, e);
0
158-
159 QWidget *widget = qobject_cast<QWidget*>(o);-
160 Q_D(QWindowsStyle);-
161 switch(e->type()) {-
162 case QEvent::KeyPress:
never executed: case QEvent::KeyPress:
0
163 if (static_cast<QKeyEvent *>(e)->key() == Qt::Key_Alt) {
static_cast<QK...== Qt::Key_AltDescription
TRUEnever evaluated
FALSEnever evaluated
0
164 widget = widget->window();-
165-
166 // Alt has been pressed - find all widgets that care-
167 QList<QWidget *> l = widget->findChildren<QWidget *>();-
168 auto ignorable = [](QWidget *w) {-
169 return w->isWindow() || !w->isVisible()
never executed: return w->isWindow() || !w->isVisible() || w->style()->styleHint(SH_UnderlineShortcut, 0, w);
0
170 || w->style()->styleHint(SH_UnderlineShortcut, 0, w);
never executed: return w->isWindow() || !w->isVisible() || w->style()->styleHint(SH_UnderlineShortcut, 0, w);
0
171 };-
172 l.erase(std::remove_if(l.begin(), l.end(), ignorable), l.end());-
173 // Update states before repainting-
174 d->seenAlt.append(widget);-
175 d->alt_down = true;-
176-
177 // Repaint all relevant widgets-
178 for (int pos = 0; pos < l.size(); ++pos)
pos < l.size()Description
TRUEnever evaluated
FALSEnever evaluated
0
179 l.at(pos)->update();
never executed: l.at(pos)->update();
0
180 }
never executed: end of block
0
181 break;
never executed: break;
0
182 case QEvent::KeyRelease:
never executed: case QEvent::KeyRelease:
0
183 if (static_cast<QKeyEvent*>(e)->key() == Qt::Key_Alt) {
static_cast<QK...== Qt::Key_AltDescription
TRUEnever evaluated
FALSEnever evaluated
0
184 widget = widget->window();-
185-
186 // Update state and repaint the menu bars.-
187 d->alt_down = false;-
188#ifndef QT_NO_MENUBAR-
189 QList<QMenuBar *> l = widget->findChildren<QMenuBar *>();-
190 for (int i = 0; i < l.size(); ++i)
i < l.size()Description
TRUEnever evaluated
FALSEnever evaluated
0
191 l.at(i)->update();
never executed: l.at(i)->update();
0
192#endif-
193 }
never executed: end of block
0
194 break;
never executed: break;
0
195 case QEvent::Close:
never executed: case QEvent::Close:
0
196 // Reset widget when closing-
197 d->seenAlt.removeAll(widget);-
198 d->seenAlt.removeAll(widget->window());-
199 break;
never executed: break;
0
200 default:
never executed: default:
0
201 break;
never executed: break;
0
202 }-
203 return QCommonStyle::eventFilter(o, e);
never executed: return QCommonStyle::eventFilter(o, e);
0
204}-
205-
206/*!-
207 \class QWindowsStyle-
208 \brief The QWindowsStyle class provides a Microsoft Windows-like look and feel.-
209-
210 \ingroup appearance-
211 \inmodule QtWidgets-
212 \internal-
213-
214 This style is Qt's default GUI style on Windows.-
215-
216 \image qwindowsstyle.png-
217 \sa QWindowsVistaStyle, QMacStyle, QFusionStyle-
218*/-
219-
220/*!-
221 Constructs a QWindowsStyle object.-
222*/-
223QWindowsStyle::QWindowsStyle() : QCommonStyle(*new QWindowsStylePrivate)-
224{-
225}
never executed: end of block
0
226-
227/*!-
228 \internal-
229-
230 Constructs a QWindowsStyle object.-
231*/-
232QWindowsStyle::QWindowsStyle(QWindowsStylePrivate &dd) : QCommonStyle(dd)-
233{-
234}
never executed: end of block
0
235-
236-
237/*! Destroys the QWindowsStyle object. */-
238QWindowsStyle::~QWindowsStyle()-
239{-
240}-
241-
242#ifdef Q_OS_WIN-
243static inline QRgb colorref2qrgb(COLORREF col)-
244{-
245 return qRgb(GetRValue(col), GetGValue(col), GetBValue(col));-
246}-
247#endif-
248-
249/*! \reimp */-
250void QWindowsStyle::polish(QApplication *app)-
251{-
252 QCommonStyle::polish(app);-
253 QWindowsStylePrivate *d = const_cast<QWindowsStylePrivate*>(d_func());-
254 // We only need the overhead when shortcuts are sometimes hidden-
255 if (!proxy()->styleHint(SH_UnderlineShortcut, 0) && app)
!proxy()->styl...neShortcut, 0)Description
TRUEnever evaluated
FALSEnever evaluated
appDescription
TRUEnever evaluated
FALSEnever evaluated
0
256 app->installEventFilter(this);
never executed: app->installEventFilter(this);
0
257-
258 d->activeCaptionColor = app->palette().highlight().color();-
259 d->activeGradientCaptionColor = app->palette().highlight() .color();-
260 d->inactiveCaptionColor = app->palette().dark().color();-
261 d->inactiveGradientCaptionColor = app->palette().dark().color();-
262 d->inactiveCaptionText = app->palette().background().color();-
263-
264#if defined(Q_OS_WIN) && !defined(Q_OS_WINRT) //fetch native title bar colors-
265 if(app->desktopSettingsAware()){-
266 DWORD activeCaption = GetSysColor(COLOR_ACTIVECAPTION);-
267 DWORD gradientActiveCaption = GetSysColor(COLOR_GRADIENTACTIVECAPTION);-
268 DWORD inactiveCaption = GetSysColor(COLOR_INACTIVECAPTION);-
269 DWORD gradientInactiveCaption = GetSysColor(COLOR_GRADIENTINACTIVECAPTION);-
270 DWORD inactiveCaptionText = GetSysColor(COLOR_INACTIVECAPTIONTEXT);-
271 d->activeCaptionColor = colorref2qrgb(activeCaption);-
272 d->activeGradientCaptionColor = colorref2qrgb(gradientActiveCaption);-
273 d->inactiveCaptionColor = colorref2qrgb(inactiveCaption);-
274 d->inactiveGradientCaptionColor = colorref2qrgb(gradientInactiveCaption);-
275 d->inactiveCaptionText = colorref2qrgb(inactiveCaptionText);-
276 }-
277#endif-
278}
never executed: end of block
0
279-
280/*! \reimp */-
281void QWindowsStyle::unpolish(QApplication *app)-
282{-
283 QCommonStyle::unpolish(app);-
284 app->removeEventFilter(this);-
285}
never executed: end of block
0
286-
287/*! \reimp */-
288void QWindowsStyle::polish(QWidget *widget)-
289{-
290 QCommonStyle::polish(widget);-
291}
never executed: end of block
0
292-
293/*! \reimp */-
294void QWindowsStyle::unpolish(QWidget *widget)-
295{-
296 QCommonStyle::unpolish(widget);-
297}
never executed: end of block
0
298-
299/*!-
300 \reimp-
301*/-
302void QWindowsStyle::polish(QPalette &pal)-
303{-
304 QCommonStyle::polish(pal);-
305}
never executed: end of block
0
306-
307int QWindowsStylePrivate::pixelMetricFromSystemDp(QStyle::PixelMetric pm, const QStyleOption *, const QWidget *widget)-
308{-
309#if defined(Q_OS_WIN) && !defined(Q_OS_WINRT)-
310 switch (pm) {-
311 case QStyle::PM_DockWidgetFrameWidth:-
312# ifndef Q_OS_WINCE-
313 return GetSystemMetrics(SM_CXFRAME);-
314# else-
315 return GetSystemMetrics(SM_CXDLGFRAME);-
316# endif-
317 break;-
318-
319 case QStyle::PM_TitleBarHeight:-
320 if (widget && (widget->windowType() == Qt::Tool)) {-
321 // MS always use one less than they say-
322# ifndef Q_OS_WINCE-
323 return GetSystemMetrics(SM_CYSMCAPTION) - 1;-
324# else-
325 return GetSystemMetrics(SM_CYCAPTION) - 1;-
326# endif-
327 }-
328 return GetSystemMetrics(SM_CYCAPTION) - 1;-
329-
330# ifndef Q_OS_WINCE-
331 case QStyle::PM_ScrollBarExtent:-
332 {-
333 NONCLIENTMETRICS ncm;-
334 ncm.cbSize = FIELD_OFFSET(NONCLIENTMETRICS, lfMessageFont) + sizeof(LOGFONT);-
335 if (SystemParametersInfo(SPI_GETNONCLIENTMETRICS, sizeof(NONCLIENTMETRICS), &ncm, 0))-
336 return qMax(ncm.iScrollHeight, ncm.iScrollWidth);-
337 }-
338 break;-
339# endif // !Q_OS_WINCE-
340-
341 case QStyle::PM_MdiSubWindowFrameWidth:-
342# ifndef Q_OS_WINCE-
343 return GetSystemMetrics(SM_CYFRAME);-
344# else-
345 return GetSystemMetrics(SM_CYDLGFRAME);-
346# endif-
347-
348 default:-
349 break;-
350 }-
351#else // Q_OS_WIN && !Q_OS_WINRT-
352 Q_UNUSED(pm);-
353 Q_UNUSED(widget);-
354#endif-
355 return QWindowsStylePrivate::InvalidMetric;
never executed: return QWindowsStylePrivate::InvalidMetric;
0
356}-
357-
358int QWindowsStylePrivate::fixedPixelMetric(QStyle::PixelMetric pm)-
359{-
360 switch (pm) {-
361 case QStyle::PM_ToolBarItemSpacing:
never executed: case QStyle::PM_ToolBarItemSpacing:
0
362 return 0;
never executed: return 0;
0
363 case QStyle::PM_ButtonDefaultIndicator:
never executed: case QStyle::PM_ButtonDefaultIndicator:
0
364 case QStyle::PM_ButtonShiftHorizontal:
never executed: case QStyle::PM_ButtonShiftHorizontal:
0
365 case QStyle::PM_ButtonShiftVertical:
never executed: case QStyle::PM_ButtonShiftVertical:
0
366 case QStyle::PM_MenuHMargin:
never executed: case QStyle::PM_MenuHMargin:
0
367 case QStyle::PM_MenuVMargin:
never executed: case QStyle::PM_MenuVMargin:
0
368 case QStyle::PM_ToolBarItemMargin:
never executed: case QStyle::PM_ToolBarItemMargin:
0
369 return 1;
never executed: return 1;
0
370 break;
dead code: break;
-
371 case QStyle::PM_DockWidgetSeparatorExtent:
never executed: case QStyle::PM_DockWidgetSeparatorExtent:
0
372 return 4;
never executed: return 4;
0
373#ifndef QT_NO_TABBAR-
374 case QStyle::PM_TabBarTabShiftHorizontal:
never executed: case QStyle::PM_TabBarTabShiftHorizontal:
0
375 return 0;
never executed: return 0;
0
376 case QStyle::PM_TabBarTabShiftVertical:
never executed: case QStyle::PM_TabBarTabShiftVertical:
0
377 return 2;
never executed: return 2;
0
378#endif-
379-
380#ifndef QT_NO_SLIDER-
381 case QStyle::PM_SliderLength:
never executed: case QStyle::PM_SliderLength:
0
382 return 11;
never executed: return 11;
0
383#endif // QT_NO_SLIDER-
384-
385#ifndef QT_NO_MENU-
386 case QStyle::PM_MenuBarHMargin:
never executed: case QStyle::PM_MenuBarHMargin:
0
387 case QStyle::PM_MenuBarVMargin:
never executed: case QStyle::PM_MenuBarVMargin:
0
388 case QStyle::PM_MenuBarPanelWidth:
never executed: case QStyle::PM_MenuBarPanelWidth:
0
389 return 0;
never executed: return 0;
0
390 case QStyle::PM_SmallIconSize:
never executed: case QStyle::PM_SmallIconSize:
0
391 return 16;
never executed: return 16;
0
392 case QStyle::PM_LargeIconSize:
never executed: case QStyle::PM_LargeIconSize:
0
393 return 32;
never executed: return 32;
0
394 case QStyle::PM_DockWidgetTitleMargin:
never executed: case QStyle::PM_DockWidgetTitleMargin:
0
395 return 2;
never executed: return 2;
0
396 case QStyle::PM_DockWidgetTitleBarButtonMargin:
never executed: case QStyle::PM_DockWidgetTitleBarButtonMargin:
0
397 case QStyle::PM_DockWidgetFrameWidth:
never executed: case QStyle::PM_DockWidgetFrameWidth:
0
398 return 4;
never executed: return 4;
0
399-
400#endif // QT_NO_MENU-
401 case QStyle::PM_ToolBarHandleExtent:
never executed: case QStyle::PM_ToolBarHandleExtent:
0
402 return 10;
never executed: return 10;
0
403 default:
never executed: default:
0
404 break;
never executed: break;
0
405 }-
406 return QWindowsStylePrivate::InvalidMetric;
never executed: return QWindowsStylePrivate::InvalidMetric;
0
407}-
408-
409static QWindow *windowOf(const QWidget *w)-
410{-
411 QWindow *result = Q_NULLPTR;-
412 if (w) {
wDescription
TRUEnever evaluated
FALSEnever evaluated
0
413 result = w->windowHandle();-
414 if (!result) {
!resultDescription
TRUEnever evaluated
FALSEnever evaluated
0
415 if (const QWidget *np = w->nativeParentWidget())
const QWidget ...ParentWidget()Description
TRUEnever evaluated
FALSEnever evaluated
0
416 result = np->windowHandle();
never executed: result = np->windowHandle();
0
417 }
never executed: end of block
0
418 }
never executed: end of block
0
419 return result;
never executed: return result;
0
420}-
421-
422static QScreen *screenOf(const QWidget *w)-
423{-
424 if (const QWindow *window = windowOf(w))
const QWindow ... = windowOf(w)Description
TRUEnever evaluated
FALSEnever evaluated
0
425 return window->screen();
never executed: return window->screen();
0
426 return QGuiApplication::primaryScreen();
never executed: return QGuiApplication::primaryScreen();
0
427}-
428-
429// Calculate the overall scale factor to obtain Qt Device Independent-
430// Pixels from a native Windows size. Divide by devicePixelRatio-
431// and account for secondary screens with differing logical DPI.-
432qreal QWindowsStylePrivate::nativeMetricScaleFactor(const QWidget *widget)-
433{-
434 if (!QHighDpiScaling::isActive())
!QHighDpiScaling::isActive()Description
TRUEnever evaluated
FALSEnever evaluated
0
435 return 1;
never executed: return 1;
0
436 qreal result = qreal(1) / QWindowsStylePrivate::devicePixelRatio(widget);-
437 if (QGuiApplicationPrivate::screen_list.size() > 1) {
QGuiApplicatio...ist.size() > 1Description
TRUEnever evaluated
FALSEnever evaluated
0
438 const QScreen *primaryScreen = QGuiApplication::primaryScreen();-
439 const QScreen *screen = screenOf(widget);-
440 if (screen != primaryScreen) {
screen != primaryScreenDescription
TRUEnever evaluated
FALSEnever evaluated
0
441 const qreal primaryLogicalDpi = primaryScreen->handle()->logicalDpi().first;-
442 const qreal logicalDpi = screen->handle()->logicalDpi().first;-
443 if (!qFuzzyCompare(primaryLogicalDpi, logicalDpi))
!qFuzzyCompare...i, logicalDpi)Description
TRUEnever evaluated
FALSEnever evaluated
0
444 result *= logicalDpi / primaryLogicalDpi;
never executed: result *= logicalDpi / primaryLogicalDpi;
0
445 }
never executed: end of block
0
446 }
never executed: end of block
0
447 return result;
never executed: return result;
0
448}-
449-
450/*!-
451 \reimp-
452*/-
453int QWindowsStyle::pixelMetric(PixelMetric pm, const QStyleOption *opt, const QWidget *widget) const-
454{-
455 int ret = QWindowsStylePrivate::pixelMetricFromSystemDp(pm, opt, widget);-
456 if (ret != QWindowsStylePrivate::InvalidMetric)
ret != QWindow...:InvalidMetricDescription
TRUEnever evaluated
FALSEnever evaluated
0
457 return qRound(qreal(ret) * QWindowsStylePrivate::nativeMetricScaleFactor(widget));
never executed: return qRound(qreal(ret) * QWindowsStylePrivate::nativeMetricScaleFactor(widget));
0
458-
459 ret = QWindowsStylePrivate::fixedPixelMetric(pm);-
460 if (ret != QWindowsStylePrivate::InvalidMetric)
ret != QWindow...:InvalidMetricDescription
TRUEnever evaluated
FALSEnever evaluated
0
461 return int(QStyleHelper::dpiScaled(ret));
never executed: return int(QStyleHelper::dpiScaled(ret));
0
462-
463 ret = 0;-
464-
465 switch (pm) {-
466 case PM_MaximumDragDistance:
never executed: case PM_MaximumDragDistance:
0
467 ret = QCommonStyle::pixelMetric(PM_MaximumDragDistance);-
468 if (ret == -1)
ret == -1Description
TRUEnever evaluated
FALSEnever evaluated
0
469 ret = 60;
never executed: ret = 60;
0
470 break;
never executed: break;
0
471-
472#ifndef QT_NO_SLIDER-
473 // Returns the number of pixels to use for the business part of the-
474 // slider (i.e., the non-tickmark portion). The remaining space is shared-
475 // equally between the tickmark regions.-
476 case PM_SliderControlThickness:
never executed: case PM_SliderControlThickness:
0
477 if (const QStyleOptionSlider *sl = qstyleoption_cast<const QStyleOptionSlider *>(opt)) {
const QStyleOp...Slider *>(opt)Description
TRUEnever evaluated
FALSEnever evaluated
0
478 int space = (sl->orientation == Qt::Horizontal) ? sl->rect.height() : sl->rect.width();
(sl->orientati...t::Horizontal)Description
TRUEnever evaluated
FALSEnever evaluated
0
479 int ticks = sl->tickPosition;-
480 int n = 0;-
481 if (ticks & QSlider::TicksAbove)
ticks & QSlider::TicksAboveDescription
TRUEnever evaluated
FALSEnever evaluated
0
482 ++n;
never executed: ++n;
0
483 if (ticks & QSlider::TicksBelow)
ticks & QSlider::TicksBelowDescription
TRUEnever evaluated
FALSEnever evaluated
0
484 ++n;
never executed: ++n;
0
485 if (!n) {
!nDescription
TRUEnever evaluated
FALSEnever evaluated
0
486 ret = space;-
487 break;
never executed: break;
0
488 }-
489-
490 int thick = 6; // Magic constant to get 5 + 16 + 5-
491 if (ticks != QSlider::TicksBothSides && ticks != QSlider::NoTicks)
ticks != QSlid...TicksBothSidesDescription
TRUEnever evaluated
FALSEnever evaluated
ticks != QSlider::NoTicksDescription
TRUEnever evaluated
FALSEnever evaluated
0
492 thick += proxy()->pixelMetric(PM_SliderLength, sl, widget) / 4;
never executed: thick += proxy()->pixelMetric(PM_SliderLength, sl, widget) / 4;
0
493-
494 space -= thick;-
495 if (space > 0)
space > 0Description
TRUEnever evaluated
FALSEnever evaluated
0
496 thick += (space * 2) / (n + 2);
never executed: thick += (space * 2) / (n + 2);
0
497 ret = thick;-
498 }
never executed: end of block
0
499 break;
never executed: break;
0
500#endif // QT_NO_SLIDER-
501-
502 case PM_IconViewIconSize:
never executed: case PM_IconViewIconSize:
0
503 ret = proxy()->pixelMetric(PM_LargeIconSize, opt, widget);-
504 break;
never executed: break;
0
505-
506 case PM_SplitterWidth:
never executed: case PM_SplitterWidth:
0
507 ret = qMax(int(QStyleHelper::dpiScaled(4)), QApplication::globalStrut().width());-
508 break;
never executed: break;
0
509-
510 default:
never executed: default:
0
511 ret = QCommonStyle::pixelMetric(pm, opt, widget);-
512 break;
never executed: break;
0
513 }-
514-
515 return ret;
never executed: return ret;
0
516}-
517-
518/*!-
519 \reimp-
520 */-
521QPixmap QWindowsStyle::standardPixmap(StandardPixmap standardPixmap, const QStyleOption *opt,-
522 const QWidget *widget) const-
523{-
524#if defined(Q_OS_WIN) && !defined(Q_OS_WINCE) && !defined(Q_OS_WINRT)-
525 QPixmap desktopIcon;-
526 switch(standardPixmap) {-
527 case SP_DriveCDIcon:-
528 case SP_DriveDVDIcon:-
529 case SP_DriveNetIcon:-
530 case SP_DriveHDIcon:-
531 case SP_DriveFDIcon:-
532 case SP_FileIcon:-
533 case SP_FileLinkIcon:-
534 case SP_DirLinkIcon:-
535 case SP_DirClosedIcon:-
536 case SP_DesktopIcon:-
537 case SP_ComputerIcon:-
538 case SP_DirOpenIcon:-
539 case SP_FileDialogNewFolder:-
540 case SP_DirHomeIcon:-
541 case SP_TrashIcon:-
542 case SP_VistaShield:-
543 if (const QPlatformTheme *theme = QGuiApplicationPrivate::platformTheme()) {-
544 QPlatformTheme::StandardPixmap sp = static_cast<QPlatformTheme::StandardPixmap>(standardPixmap);-
545 desktopIcon = theme->standardPixmap(sp, QSizeF(16, 16));-
546 }-
547 break;-
548 case SP_MessageBoxInformation:-
549 case SP_MessageBoxWarning:-
550 case SP_MessageBoxCritical:-
551 case SP_MessageBoxQuestion:-
552 if (const QPlatformTheme *theme = QGuiApplicationPrivate::platformTheme()) {-
553 QPlatformTheme::StandardPixmap sp = static_cast<QPlatformTheme::StandardPixmap>(standardPixmap);-
554 desktopIcon = theme->standardPixmap(sp, QSizeF());-
555 }-
556 break;-
557 default:-
558 break;-
559 }-
560 if (!desktopIcon.isNull()) {-
561 return desktopIcon;-
562 }-
563#endif // Q_OS_WIN && !Q_OS_WINCE && !Q_OS_WINRT-
564 return QCommonStyle::standardPixmap(standardPixmap, opt, widget);
never executed: return QCommonStyle::standardPixmap(standardPixmap, opt, widget);
0
565}-
566-
567/*! \reimp */-
568int QWindowsStyle::styleHint(StyleHint hint, const QStyleOption *opt, const QWidget *widget,-
569 QStyleHintReturn *returnData) const-
570{-
571 int ret = 0;-
572-
573 switch (hint) {-
574 case SH_EtchDisabledText:
never executed: case SH_EtchDisabledText:
0
575 case SH_Slider_SnapToValue:
never executed: case SH_Slider_SnapToValue:
0
576 case SH_PrintDialog_RightAlignButtons:
never executed: case SH_PrintDialog_RightAlignButtons:
0
577 case SH_FontDialog_SelectAssociatedText:
never executed: case SH_FontDialog_SelectAssociatedText:
0
578 case SH_Menu_AllowActiveAndDisabled:
never executed: case SH_Menu_AllowActiveAndDisabled:
0
579 case SH_MenuBar_AltKeyNavigation:
never executed: case SH_MenuBar_AltKeyNavigation:
0
580 case SH_MenuBar_MouseTracking:
never executed: case SH_MenuBar_MouseTracking:
0
581 case SH_Menu_MouseTracking:
never executed: case SH_Menu_MouseTracking:
0
582 case SH_ComboBox_ListMouseTracking:
never executed: case SH_ComboBox_ListMouseTracking:
0
583 case SH_ScrollBar_StopMouseOverSlider:
never executed: case SH_ScrollBar_StopMouseOverSlider:
0
584 case SH_MainWindow_SpaceBelowMenuBar:
never executed: case SH_MainWindow_SpaceBelowMenuBar:
0
585 ret = 1;-
586-
587 break;
never executed: break;
0
588 case SH_ItemView_ShowDecorationSelected:
never executed: case SH_ItemView_ShowDecorationSelected:
0
589#ifndef QT_NO_LISTVIEW-
590 if (qobject_cast<const QListView*>(widget))
qobject_cast<c...View*>(widget)Description
TRUEnever evaluated
FALSEnever evaluated
0
591 ret = 1;
never executed: ret = 1;
0
592#endif-
593 break;
never executed: break;
0
594 case SH_ItemView_ChangeHighlightOnFocus:
never executed: case SH_ItemView_ChangeHighlightOnFocus:
0
595 ret = 1;-
596 break;
never executed: break;
0
597 case SH_ToolBox_SelectedPageTitleBold:
never executed: case SH_ToolBox_SelectedPageTitleBold:
0
598 ret = 0;-
599 break;
never executed: break;
0
600-
601#if defined(Q_OS_WIN) && !defined(Q_OS_WINRT) // Option not used on WinRT -> common style-
602 case SH_UnderlineShortcut:-
603 {-
604 ret = 1;-
605 BOOL cues = false;-
606 SystemParametersInfo(SPI_GETKEYBOARDCUES, 0, &cues, 0);-
607 ret = int(cues);-
608 // Do nothing if we always paint underlines-
609 Q_D(const QWindowsStyle);-
610 if (!ret && widget && d) {-
611#ifndef QT_NO_MENUBAR-
612 const QMenuBar *menuBar = qobject_cast<const QMenuBar *>(widget);-
613 if (!menuBar && qobject_cast<const QMenu *>(widget)) {-
614 QWidget *w = QApplication::activeWindow();-
615 if (w && w != widget)-
616 menuBar = w->findChild<QMenuBar *>();-
617 }-
618 // If we paint a menu bar draw underlines if is in the keyboardState-
619 if (menuBar) {-
620 if (menuBar->d_func()->keyboardState || d->altDown())-
621 ret = 1;-
622 // Otherwise draw underlines if the toplevel widget has seen an alt-press-
623 } else-
624#endif // QT_NO_MENUBAR-
625 if (d->hasSeenAlt(widget)) {-
626 ret = 1;-
627 }-
628 }-
629#ifndef QT_NO_ACCESSIBILITY-
630 if (!ret && opt && opt->type == QStyleOption::SO_MenuItem-
631 && QStyleHelper::isInstanceOf(opt->styleObject, QAccessible::MenuItem)-
632 && opt->styleObject->property("_q_showUnderlined").toBool())-
633 ret = 1;-
634#endif // QT_NO_ACCESSIBILITY-
635 break;-
636 }-
637#endif // Q_OS_WIN && !Q_OS_WINRT-
638 case SH_Menu_SubMenuSloppyCloseTimeout:
never executed: case SH_Menu_SubMenuSloppyCloseTimeout:
0
639 case SH_Menu_SubMenuPopupDelay: {
never executed: case SH_Menu_SubMenuPopupDelay:
0
640#if defined(Q_OS_WIN) && !defined(Q_OS_WINCE) && !defined(Q_OS_WINRT)-
641 DWORD delay;-
642 if (SystemParametersInfo(SPI_GETMENUSHOWDELAY, 0, &delay, 0))-
643 ret = delay;-
644 else-
645#endif // Q_OS_WIN && !Q_OS_WINCE && !Q_OS_WINRT-
646 ret = 400;-
647 break;
never executed: break;
0
648 }-
649#ifndef QT_NO_RUBBERBAND-
650 case SH_RubberBand_Mask:
never executed: case SH_RubberBand_Mask:
0
651 if (const QStyleOptionRubberBand *rbOpt = qstyleoption_cast<const QStyleOptionRubberBand *>(opt)) {
const QStyleOp...erBand *>(opt)Description
TRUEnever evaluated
FALSEnever evaluated
0
652 ret = 0;-
653 if (rbOpt->shape == QRubberBand::Rectangle) {
rbOpt->shape =...and::RectangleDescription
TRUEnever evaluated
FALSEnever evaluated
0
654 ret = true;-
655 if(QStyleHintReturnMask *mask = qstyleoption_cast<QStyleHintReturnMask*>(returnData)) {
QStyleHintRetu...*>(returnData)Description
TRUEnever evaluated
FALSEnever evaluated
0
656 mask->region = opt->rect;-
657 int size = 1;-
658 if (widget && widget->isWindow())
widgetDescription
TRUEnever evaluated
FALSEnever evaluated
widget->isWindow()Description
TRUEnever evaluated
FALSEnever evaluated
0
659 size = 4;
never executed: size = 4;
0
660 mask->region -= opt->rect.adjusted(size, size, -size, -size);-
661 }
never executed: end of block
0
662 }
never executed: end of block
0
663 }
never executed: end of block
0
664 break;
never executed: break;
0
665#endif // QT_NO_RUBBERBAND-
666#ifndef QT_NO_WIZARD-
667 case SH_WizardStyle:
never executed: case SH_WizardStyle:
0
668 ret = QWizard::ModernStyle;-
669 break;
never executed: break;
0
670#endif-
671 case SH_ItemView_ArrowKeysNavigateIntoChildren:
never executed: case SH_ItemView_ArrowKeysNavigateIntoChildren:
0
672 ret = true;-
673 break;
never executed: break;
0
674 case SH_DialogButtonBox_ButtonsHaveIcons:
never executed: case SH_DialogButtonBox_ButtonsHaveIcons:
0
675 ret = 0;-
676 break;
never executed: break;
0
677 default:
never executed: default:
0
678 ret = QCommonStyle::styleHint(hint, opt, widget, returnData);-
679 break;
never executed: break;
0
680 }-
681 return ret;
never executed: return ret;
0
682}-
683-
684/*! \reimp */-
685void QWindowsStyle::drawPrimitive(PrimitiveElement pe, const QStyleOption *opt, QPainter *p,-
686 const QWidget *w) const-
687{-
688 // Used to restore across fallthrough cases. Currently only used in PE_IndicatorCheckBox-
689 bool doRestore = false;-
690-
691 switch (pe) {-
692#ifndef QT_NO_TOOLBAR-
693 case PE_IndicatorToolBarSeparator:
never executed: case PE_IndicatorToolBarSeparator:
0
694 {-
695 QRect rect = opt->rect;-
696 const int margin = 2;-
697 QPen oldPen = p->pen();-
698 if(opt->state & State_Horizontal){
opt->state & State_HorizontalDescription
TRUEnever evaluated
FALSEnever evaluated
0
699 const int offset = rect.width()/2;-
700 p->setPen(QPen(opt->palette.dark().color()));-
701 p->drawLine(rect.bottomLeft().x() + offset,-
702 rect.bottomLeft().y() - margin,-
703 rect.topLeft().x() + offset,-
704 rect.topLeft().y() + margin);-
705 p->setPen(QPen(opt->palette.light().color()));-
706 p->drawLine(rect.bottomLeft().x() + offset + 1,-
707 rect.bottomLeft().y() - margin,-
708 rect.topLeft().x() + offset + 1,-
709 rect.topLeft().y() + margin);-
710 }
never executed: end of block
0
711 else{ //Draw vertical separator-
712 const int offset = rect.height()/2;-
713 p->setPen(QPen(opt->palette.dark().color()));-
714 p->drawLine(rect.topLeft().x() + margin ,-
715 rect.topLeft().y() + offset,-
716 rect.topRight().x() - margin,-
717 rect.topRight().y() + offset);-
718 p->setPen(QPen(opt->palette.light().color()));-
719 p->drawLine(rect.topLeft().x() + margin ,-
720 rect.topLeft().y() + offset + 1,-
721 rect.topRight().x() - margin,-
722 rect.topRight().y() + offset + 1);-
723 }
never executed: end of block
0
724 p->setPen(oldPen);-
725 }-
726 break;
never executed: break;
0
727 case PE_IndicatorToolBarHandle:
never executed: case PE_IndicatorToolBarHandle:
0
728 p->save();-
729 p->translate(opt->rect.x(), opt->rect.y());-
730 if (opt->state & State_Horizontal) {
opt->state & State_HorizontalDescription
TRUEnever evaluated
FALSEnever evaluated
0
731 int x = opt->rect.width() / 2 - 4;-
732 if (opt->direction == Qt::RightToLeft)
opt->direction...t::RightToLeftDescription
TRUEnever evaluated
FALSEnever evaluated
0
733 x -= 2;
never executed: x -= 2;
0
734 if (opt->rect.height() > 4) {
opt->rect.height() > 4Description
TRUEnever evaluated
FALSEnever evaluated
0
735 qDrawShadePanel(p, x, 2, 3, opt->rect.height() - 4,-
736 opt->palette, false, 1, 0);-
737 qDrawShadePanel(p, x + 3, 2, 3, opt->rect.height() - 4,-
738 opt->palette, false, 1, 0);-
739 }
never executed: end of block
0
740 } else {
never executed: end of block
0
741 if (opt->rect.width() > 4) {
opt->rect.width() > 4Description
TRUEnever evaluated
FALSEnever evaluated
0
742 int y = opt->rect.height() / 2 - 4;-
743 qDrawShadePanel(p, 2, y, opt->rect.width() - 4, 3,-
744 opt->palette, false, 1, 0);-
745 qDrawShadePanel(p, 2, y + 3, opt->rect.width() - 4, 3,-
746 opt->palette, false, 1, 0);-
747 }
never executed: end of block
0
748 }
never executed: end of block
0
749 p->restore();-
750 break;
never executed: break;
0
751-
752#endif // QT_NO_TOOLBAR-
753 case PE_FrameButtonTool:
never executed: case PE_FrameButtonTool:
0
754 case PE_PanelButtonTool: {
never executed: case PE_PanelButtonTool:
0
755 QPen oldPen = p->pen();-
756#ifndef QT_NO_DOCKWIDGET-
757 if (w && w->inherits("QDockWidgetTitleButton")) {
wDescription
TRUEnever evaluated
FALSEnever evaluated
w->inherits("Q...tTitleButton")Description
TRUEnever evaluated
FALSEnever evaluated
0
758 if (const QWidget *dw = w->parentWidget())
const QWidget ...parentWidget()Description
TRUEnever evaluated
FALSEnever evaluated
0
759 if (dw->isWindow()){
dw->isWindow()Description
TRUEnever evaluated
FALSEnever evaluated
0
760 qDrawWinButton(p, opt->rect.adjusted(1, 1, 0, 0), opt->palette, opt->state & (State_Sunken | State_On),-
761 &opt->palette.button());-
762-
763 return;
never executed: return;
0
764 }-
765 }
never executed: end of block
0
766#endif // QT_NO_DOCKWIDGET-
767 QBrush fill;-
768 bool stippled;-
769 bool panel = (pe == PE_PanelButtonTool);-
770 if ((!(opt->state & State_Sunken ))
(!(opt->state ...tate_Sunken ))Description
TRUEnever evaluated
FALSEnever evaluated
0
771 && (!(opt->state & State_Enabled)
!(opt->state & State_Enabled)Description
TRUEnever evaluated
FALSEnever evaluated
0
772 || !(opt->state & State_MouseOver && opt->state & State_AutoRaise))
opt->state & State_MouseOverDescription
TRUEnever evaluated
FALSEnever evaluated
opt->state & State_AutoRaiseDescription
TRUEnever evaluated
FALSEnever evaluated
0
773 && (opt->state & State_On)) {
(opt->state & State_On)Description
TRUEnever evaluated
FALSEnever evaluated
0
774 fill = QBrush(opt->palette.light().color(), Qt::Dense4Pattern);-
775 stippled = true;-
776 } else {
never executed: end of block
0
777 fill = opt->palette.brush(QPalette::Button);-
778 stippled = false;-
779 }
never executed: end of block
0
780-
781 if (opt->state & (State_Raised | State_Sunken | State_On)) {
opt->state & (...en | State_On)Description
TRUEnever evaluated
FALSEnever evaluated
0
782 if (opt->state & State_AutoRaise) {
opt->state & State_AutoRaiseDescription
TRUEnever evaluated
FALSEnever evaluated
0
783 if(opt->state & (State_Enabled | State_Sunken | State_On)){
opt->state & (...en | State_On)Description
TRUEnever evaluated
FALSEnever evaluated
0
784 if (panel)
panelDescription
TRUEnever evaluated
FALSEnever evaluated
0
785 qDrawShadePanel(p, opt->rect, opt->palette,
never executed: qDrawShadePanel(p, opt->rect, opt->palette, opt->state & (State_Sunken | State_On), 1, &fill);
0
786 opt->state & (State_Sunken | State_On), 1, &fill);
never executed: qDrawShadePanel(p, opt->rect, opt->palette, opt->state & (State_Sunken | State_On), 1, &fill);
0
787 else-
788 qDrawShadeRect(p, opt->rect, opt->palette,
never executed: qDrawShadeRect(p, opt->rect, opt->palette, opt->state & (State_Sunken | State_On), 1);
0
789 opt->state & (State_Sunken | State_On), 1);
never executed: qDrawShadeRect(p, opt->rect, opt->palette, opt->state & (State_Sunken | State_On), 1);
0
790 }-
791 if (stippled) {
stippledDescription
TRUEnever evaluated
FALSEnever evaluated
0
792 p->setPen(opt->palette.button().color());-
793 p->drawRect(opt->rect.adjusted(1,1,-2,-2));-
794 }
never executed: end of block
0
795 } else {
never executed: end of block
0
796 qDrawWinButton(p, opt->rect, opt->palette,-
797 opt->state & (State_Sunken | State_On), panel ? &fill : 0);-
798 }
never executed: end of block
0
799 } else {-
800 p->fillRect(opt->rect, fill);-
801 }
never executed: end of block
0
802 p->setPen(oldPen);-
803 break; }
never executed: break;
0
804 case PE_PanelButtonCommand:
never executed: case PE_PanelButtonCommand:
0
805 if (const QStyleOptionButton *btn = qstyleoption_cast<const QStyleOptionButton *>(opt)) {
const QStyleOp...Button *>(opt)Description
TRUEnever evaluated
FALSEnever evaluated
0
806 QBrush fill;-
807 State flags = opt->state;-
808 QPalette pal = opt->palette;-
809 QRect r = opt->rect;-
810 if (! (flags & State_Sunken) && (flags & State_On))
! (flags & State_Sunken)Description
TRUEnever evaluated
FALSEnever evaluated
(flags & State_On)Description
TRUEnever evaluated
FALSEnever evaluated
0
811 fill = QBrush(pal.light().color(), Qt::Dense4Pattern);
never executed: fill = QBrush(pal.light().color(), Qt::Dense4Pattern);
0
812 else-
813 fill = pal.brush(QPalette::Button);
never executed: fill = pal.brush(QPalette::Button);
0
814-
815 if (btn->features & QStyleOptionButton::DefaultButton && flags & State_Sunken) {
btn->features ...:DefaultButtonDescription
TRUEnever evaluated
FALSEnever evaluated
flags & State_SunkenDescription
TRUEnever evaluated
FALSEnever evaluated
0
816 p->setPen(pal.dark().color());-
817 p->setBrush(fill);-
818 p->drawRect(r.adjusted(0, 0, -1, -1));-
819 } else if (flags & (State_Raised | State_On | State_Sunken)) {
never executed: end of block
flags & (State... State_Sunken)Description
TRUEnever evaluated
FALSEnever evaluated
0
820 qDrawWinButton(p, r, pal, flags & (State_Sunken | State_On),-
821 &fill);-
822 } else {
never executed: end of block
0
823 p->fillRect(r, fill);-
824 }
never executed: end of block
0
825 }-
826 break;
never executed: break;
0
827 case PE_FrameDefaultButton: {
never executed: case PE_FrameDefaultButton:
0
828 QPen oldPen = p->pen();-
829 p->setPen(opt->palette.shadow().color());-
830 QRect rect = opt->rect;-
831 rect.adjust(0, 0, -1, -1);-
832 p->drawRect(rect);-
833 p->setPen(oldPen);-
834 break;
never executed: break;
0
835 }-
836 case PE_IndicatorCheckBox: {
never executed: case PE_IndicatorCheckBox:
0
837 QBrush fill;-
838 if (opt->state & State_NoChange)
opt->state & State_NoChangeDescription
TRUEnever evaluated
FALSEnever evaluated
0
839 fill = QBrush(opt->palette.base().color(), Qt::Dense4Pattern);
never executed: fill = QBrush(opt->palette.base().color(), Qt::Dense4Pattern);
0
840 else if (opt->state & State_Sunken)
opt->state & State_SunkenDescription
TRUEnever evaluated
FALSEnever evaluated
0
841 fill = opt->palette.button();
never executed: fill = opt->palette.button();
0
842 else if (opt->state & State_Enabled)
opt->state & State_EnabledDescription
TRUEnever evaluated
FALSEnever evaluated
0
843 fill = opt->palette.base();
never executed: fill = opt->palette.base();
0
844 else-
845 fill = opt->palette.background();
never executed: fill = opt->palette.background();
0
846 p->save();-
847 doRestore = true;-
848 qDrawWinPanel(p, opt->rect, opt->palette, true, &fill);-
849 if (opt->state & State_NoChange)
opt->state & State_NoChangeDescription
TRUEnever evaluated
FALSEnever evaluated
0
850 p->setPen(opt->palette.dark().color());
never executed: p->setPen(opt->palette.dark().color());
0
851 else-
852 p->setPen(opt->palette.text().color());
never executed: p->setPen(opt->palette.text().color());
0
853 } // Fall through!-
854 case PE_IndicatorViewItemCheck:
code before this statement never executed: case PE_IndicatorViewItemCheck:
never executed: case PE_IndicatorViewItemCheck:
0
855 if (!doRestore) {
!doRestoreDescription
TRUEnever evaluated
FALSEnever evaluated
0
856 p->save();-
857 doRestore = true;-
858 }
never executed: end of block
0
859 if (pe == PE_IndicatorViewItemCheck) {
pe == PE_Indic...rViewItemCheckDescription
TRUEnever evaluated
FALSEnever evaluated
0
860 const QStyleOptionViewItem *itemViewOpt = qstyleoption_cast<const QStyleOptionViewItem *>(opt);-
861 p->setPen(itemViewOpt-
862 && itemViewOpt->showDecorationSelected-
863 && opt->state & State_Selected-
864 ? opt->palette.highlightedText().color()-
865 : opt->palette.text().color());-
866 if (opt->state & State_NoChange)
opt->state & State_NoChangeDescription
TRUEnever evaluated
FALSEnever evaluated
0
867 p->setBrush(opt->palette.brush(QPalette::Button));
never executed: p->setBrush(opt->palette.brush(QPalette::Button));
0
868 p->drawRect(opt->rect.x() + 1, opt->rect.y() + 1, 11, 11);-
869 }
never executed: end of block
0
870 if (!(opt->state & State_Off)) {
!(opt->state & State_Off)Description
TRUEnever evaluated
FALSEnever evaluated
0
871 QLineF lines[7];-
872 int i, xx, yy;-
873 xx = opt->rect.x() + 3;-
874 yy = opt->rect.y() + 5;-
875 for (i = 0; i < 3; ++i) {
i < 3Description
TRUEnever evaluated
FALSEnever evaluated
0
876 lines[i] = QLineF(xx, yy, xx, yy + 2);-
877 ++xx;-
878 ++yy;-
879 }
never executed: end of block
0
880 yy -= 2;-
881 for (i = 3; i < 7; ++i) {
i < 7Description
TRUEnever evaluated
FALSEnever evaluated
0
882 lines[i] = QLineF(xx, yy, xx, yy + 2);-
883 ++xx;-
884 --yy;-
885 }
never executed: end of block
0
886 p->drawLines(lines, 7);-
887 }
never executed: end of block
0
888 if (doRestore)
doRestoreDescription
TRUEnever evaluated
FALSEnever evaluated
0
889 p->restore();
never executed: p->restore();
0
890 break;
never executed: break;
0
891 case PE_FrameFocusRect:
never executed: case PE_FrameFocusRect:
0
892 if (const QStyleOptionFocusRect *fropt = qstyleoption_cast<const QStyleOptionFocusRect *>(opt)) {
const QStyleOp...usRect *>(opt)Description
TRUEnever evaluated
FALSEnever evaluated
0
893 //### check for d->alt_down-
894 if (!(fropt->state & State_KeyboardFocusChange) && !proxy()->styleHint(SH_UnderlineShortcut, opt))
!(fropt->state...rdFocusChange)Description
TRUEnever evaluated
FALSEnever evaluated
!proxy()->styl...Shortcut, opt)Description
TRUEnever evaluated
FALSEnever evaluated
0
895 return;
never executed: return;
0
896 QRect r = opt->rect;-
897 p->save();-
898 p->setBackgroundMode(Qt::TransparentMode);-
899 QColor bg_col = fropt->backgroundColor;-
900 if (!bg_col.isValid())
!bg_col.isValid()Description
TRUEnever evaluated
FALSEnever evaluated
0
901 bg_col = p->background().color();
never executed: bg_col = p->background().color();
0
902 // Create an "XOR" color.-
903 QColor patternCol((bg_col.red() ^ 0xff) & 0xff,-
904 (bg_col.green() ^ 0xff) & 0xff,-
905 (bg_col.blue() ^ 0xff) & 0xff);-
906 p->setBrush(QBrush(patternCol, Qt::Dense4Pattern));-
907 p->setBrushOrigin(r.topLeft());-
908 p->setPen(Qt::NoPen);-
909 p->drawRect(r.left(), r.top(), r.width(), 1); // Top-
910 p->drawRect(r.left(), r.bottom(), r.width(), 1); // Bottom-
911 p->drawRect(r.left(), r.top(), 1, r.height()); // Left-
912 p->drawRect(r.right(), r.top(), 1, r.height()); // Right-
913 p->restore();-
914 }
never executed: end of block
0
915 break;
never executed: break;
0
916 case PE_IndicatorRadioButton:
never executed: case PE_IndicatorRadioButton:
0
917 {-
918#define PTSARRLEN(x) sizeof(x)/(sizeof(QPoint))-
919 static const QPoint pts1[] = { // dark lines-
920 QPoint(1, 9), QPoint(1, 8), QPoint(0, 7), QPoint(0, 4), QPoint(1, 3), QPoint(1, 2),-
921 QPoint(2, 1), QPoint(3, 1), QPoint(4, 0), QPoint(7, 0), QPoint(8, 1), QPoint(9, 1)-
922 };-
923 static const QPoint pts2[] = { // black lines-
924 QPoint(2, 8), QPoint(1, 7), QPoint(1, 4), QPoint(2, 3), QPoint(2, 2), QPoint(3, 2),-
925 QPoint(4, 1), QPoint(7, 1), QPoint(8, 2), QPoint(9, 2)-
926 };-
927 static const QPoint pts3[] = { // background lines-
928 QPoint(2, 9), QPoint(3, 9), QPoint(4, 10), QPoint(7, 10), QPoint(8, 9), QPoint(9, 9),-
929 QPoint(9, 8), QPoint(10, 7), QPoint(10, 4), QPoint(9, 3)-
930 };-
931 static const QPoint pts4[] = { // white lines-
932 QPoint(2, 10), QPoint(3, 10), QPoint(4, 11), QPoint(7, 11), QPoint(8, 10),-
933 QPoint(9, 10), QPoint(10, 9), QPoint(10, 8), QPoint(11, 7), QPoint(11, 4),-
934 QPoint(10, 3), QPoint(10, 2)-
935 };-
936 static const QPoint pts5[] = { // inner fill-
937 QPoint(4, 2), QPoint(7, 2), QPoint(9, 4), QPoint(9, 7), QPoint(7, 9), QPoint(4, 9),-
938 QPoint(2, 7), QPoint(2, 4)-
939 };-
940-
941 // make sure the indicator is square-
942 QRect ir = opt->rect;-
943-
944 if (opt->rect.width() < opt->rect.height()) {
opt->rect.widt...>rect.height()Description
TRUEnever evaluated
FALSEnever evaluated
0
945 ir.setTop(opt->rect.top() + (opt->rect.height() - opt->rect.width()) / 2);-
946 ir.setHeight(opt->rect.width());-
947 } else if (opt->rect.height() < opt->rect.width()) {
never executed: end of block
opt->rect.heig...->rect.width()Description
TRUEnever evaluated
FALSEnever evaluated
0
948 ir.setLeft(opt->rect.left() + (opt->rect.width() - opt->rect.height()) / 2);-
949 ir.setWidth(opt->rect.height());-
950 }
never executed: end of block
0
951-
952 p->save();-
953 p->setRenderHint(QPainter::Qt4CompatiblePainting);-
954 bool down = opt->state & State_Sunken;-
955 bool enabled = opt->state & State_Enabled;-
956 bool on = opt->state & State_On;-
957 QPolygon a;-
958-
959 //center when rect is larger than indicator size-
960 int xOffset = 0;-
961 int yOffset = 0;-
962 int indicatorWidth = proxy()->pixelMetric(PM_ExclusiveIndicatorWidth);-
963 int indicatorHeight = proxy()->pixelMetric(PM_ExclusiveIndicatorHeight);-
964 if (ir.width() > indicatorWidth)
ir.width() > indicatorWidthDescription
TRUEnever evaluated
FALSEnever evaluated
0
965 xOffset += (ir.width() - indicatorWidth)/2;
never executed: xOffset += (ir.width() - indicatorWidth)/2;
0
966 if (ir.height() > indicatorHeight)
ir.height() > indicatorHeightDescription
TRUEnever evaluated
FALSEnever evaluated
0
967 yOffset += (ir.height() - indicatorHeight)/2;
never executed: yOffset += (ir.height() - indicatorHeight)/2;
0
968 p->translate(xOffset, yOffset);-
969-
970 p->translate(ir.x(), ir.y());-
971-
972 p->setPen(opt->palette.dark().color());-
973 p->drawPolyline(pts1, PTSARRLEN(pts1));-
974-
975 p->setPen(opt->palette.shadow().color());-
976 p->drawPolyline(pts2, PTSARRLEN(pts2));-
977-
978 p->setPen(opt->palette.midlight().color());-
979 p->drawPolyline(pts3, PTSARRLEN(pts3));-
980-
981 p->setPen(opt->palette.light().color());-
982 p->drawPolyline(pts4, PTSARRLEN(pts4));-
983-
984 QColor fillColor = (down || !enabled)
downDescription
TRUEnever evaluated
FALSEnever evaluated
!enabledDescription
TRUEnever evaluated
FALSEnever evaluated
0
985 ? opt->palette.button().color()-
986 : opt->palette.base().color();-
987 p->setPen(fillColor);-
988 p->setBrush(fillColor) ;-
989 p->drawPolygon(pts5, PTSARRLEN(pts5));-
990-
991 p->translate(-ir.x(), -ir.y()); // restore translate-
992-
993 if (on) {
onDescription
TRUEnever evaluated
FALSEnever evaluated
0
994 p->setPen(Qt::NoPen);-
995 p->setBrush(opt->palette.text());-
996 p->drawRect(ir.x() + 5, ir.y() + 4, 2, 4);-
997 p->drawRect(ir.x() + 4, ir.y() + 5, 4, 2);-
998 }
never executed: end of block
0
999 p->restore();-
1000 break;
never executed: break;
0
1001 }-
1002#ifndef QT_NO_FRAME-
1003 case PE_Frame:
never executed: case PE_Frame:
0
1004 case PE_FrameMenu:
never executed: case PE_FrameMenu:
0
1005 if (const QStyleOptionFrame *frame = qstyleoption_cast<const QStyleOptionFrame *>(opt)) {
const QStyleOp...nFrame *>(opt)Description
TRUEnever evaluated
FALSEnever evaluated
0
1006 if (frame->lineWidth == 2 || pe == PE_Frame) {
frame->lineWidth == 2Description
TRUEnever evaluated
FALSEnever evaluated
pe == PE_FrameDescription
TRUEnever evaluated
FALSEnever evaluated
0
1007 QPalette popupPal = frame->palette;-
1008 if (pe == PE_FrameMenu) {
pe == PE_FrameMenuDescription
TRUEnever evaluated
FALSEnever evaluated
0
1009 popupPal.setColor(QPalette::Light, frame->palette.background().color());-
1010 popupPal.setColor(QPalette::Midlight, frame->palette.light().color());-
1011 }
never executed: end of block
0
1012 if (pe == PE_Frame && (frame->state & State_Raised))
pe == PE_FrameDescription
TRUEnever evaluated
FALSEnever evaluated
(frame->state & State_Raised)Description
TRUEnever evaluated
FALSEnever evaluated
0
1013 qDrawWinButton(p, frame->rect, popupPal, frame->state & State_Sunken);
never executed: qDrawWinButton(p, frame->rect, popupPal, frame->state & State_Sunken);
0
1014 else if (pe == PE_Frame && (frame->state & State_Sunken))
pe == PE_FrameDescription
TRUEnever evaluated
FALSEnever evaluated
(frame->state & State_Sunken)Description
TRUEnever evaluated
FALSEnever evaluated
0
1015 {-
1016 popupPal.setColor(QPalette::Midlight, frame->palette.background().color());-
1017 qDrawWinPanel(p, frame->rect, popupPal, frame->state & State_Sunken);-
1018 }
never executed: end of block
0
1019 else-
1020 qDrawWinPanel(p, frame->rect, popupPal, frame->state & State_Sunken);
never executed: qDrawWinPanel(p, frame->rect, popupPal, frame->state & State_Sunken);
0
1021 } else {-
1022 QCommonStyle::drawPrimitive(pe, opt, p, w);-
1023 }
never executed: end of block
0
1024 } else {-
1025 QPalette popupPal = opt->palette;-
1026 popupPal.setColor(QPalette::Light, opt->palette.background().color());-
1027 popupPal.setColor(QPalette::Midlight, opt->palette.light().color());-
1028 qDrawWinPanel(p, opt->rect, popupPal, opt->state & State_Sunken);-
1029 }
never executed: end of block
0
1030 break;
never executed: break;
0
1031#endif // QT_NO_FRAME-
1032 case PE_FrameButtonBevel:
never executed: case PE_FrameButtonBevel:
0
1033 case PE_PanelButtonBevel: {
never executed: case PE_PanelButtonBevel:
0
1034 QBrush fill;-
1035 bool panel = pe != PE_FrameButtonBevel;-
1036 p->setBrushOrigin(opt->rect.topLeft());-
1037 if (!(opt->state & State_Sunken) && (opt->state & State_On))
!(opt->state & State_Sunken)Description
TRUEnever evaluated
FALSEnever evaluated
(opt->state & State_On)Description
TRUEnever evaluated
FALSEnever evaluated
0
1038 fill = QBrush(opt->palette.light().color(), Qt::Dense4Pattern);
never executed: fill = QBrush(opt->palette.light().color(), Qt::Dense4Pattern);
0
1039 else-
1040 fill = opt->palette.brush(QPalette::Button);
never executed: fill = opt->palette.brush(QPalette::Button);
0
1041-
1042 if (opt->state & (State_Raised | State_On | State_Sunken)) {
opt->state & (... State_Sunken)Description
TRUEnever evaluated
FALSEnever evaluated
0
1043 qDrawWinButton(p, opt->rect, opt->palette, opt->state & (State_Sunken | State_On),-
1044 panel ? &fill : 0);-
1045 } else {
never executed: end of block
0
1046 if (panel)
panelDescription
TRUEnever evaluated
FALSEnever evaluated
0
1047 p->fillRect(opt->rect, fill);
never executed: p->fillRect(opt->rect, fill);
0
1048 else-
1049 p->drawRect(opt->rect);
never executed: p->drawRect(opt->rect);
0
1050 }-
1051 break; }
never executed: break;
0
1052 case PE_FrameWindow: {
never executed: case PE_FrameWindow:
0
1053 QPalette popupPal = opt->palette;-
1054 popupPal.setColor(QPalette::Light, opt->palette.background().color());-
1055 popupPal.setColor(QPalette::Midlight, opt->palette.light().color());-
1056 qDrawWinPanel(p, opt->rect, popupPal, opt->state & State_Sunken);-
1057 break; }
never executed: break;
0
1058#ifndef QT_NO_DOCKWIDGET-
1059 case PE_IndicatorDockWidgetResizeHandle:
never executed: case PE_IndicatorDockWidgetResizeHandle:
0
1060 break;
never executed: break;
0
1061 case PE_FrameDockWidget:
never executed: case PE_FrameDockWidget:
0
1062 if (qstyleoption_cast<const QStyleOptionFrame *>(opt)) {
qstyleoption_c...nFrame *>(opt)Description
TRUEnever evaluated
FALSEnever evaluated
0
1063 proxy()->drawPrimitive(QStyle::PE_FrameWindow, opt, p, w);-
1064 }
never executed: end of block
0
1065 break;
never executed: break;
0
1066#endif // QT_NO_DOCKWIDGET-
1067-
1068 case PE_FrameStatusBarItem:
never executed: case PE_FrameStatusBarItem:
0
1069 qDrawShadePanel(p, opt->rect, opt->palette, true, 1, 0);-
1070 break;
never executed: break;
0
1071-
1072 case PE_IndicatorProgressChunk:
never executed: case PE_IndicatorProgressChunk:
0
1073 {-
1074 bool vertical = false, inverted = false;-
1075 if (const QStyleOptionProgressBar *pb = qstyleoption_cast<const QStyleOptionProgressBar *>(opt)) {
const QStyleOp...essBar *>(opt)Description
TRUEnever evaluated
FALSEnever evaluated
0
1076 vertical = pb->orientation == Qt::Vertical;-
1077 inverted = pb->invertedAppearance;-
1078 }
never executed: end of block
0
1079-
1080 int space = 2;-
1081 int chunksize = proxy()->pixelMetric(PM_ProgressBarChunkWidth, opt, w) - space;-
1082 if (!vertical) {
!verticalDescription
TRUEnever evaluated
FALSEnever evaluated
0
1083 if (opt->rect.width() <= chunksize)
opt->rect.width() <= chunksizeDescription
TRUEnever evaluated
FALSEnever evaluated
0
1084 space = 0;
never executed: space = 0;
0
1085-
1086 if (inverted)
invertedDescription
TRUEnever evaluated
FALSEnever evaluated
0
1087 p->fillRect(opt->rect.x() + space, opt->rect.y(), opt->rect.width() - space, opt->rect.height(),
never executed: p->fillRect(opt->rect.x() + space, opt->rect.y(), opt->rect.width() - space, opt->rect.height(), opt->palette.brush(QPalette::Highlight));
0
1088 opt->palette.brush(QPalette::Highlight));
never executed: p->fillRect(opt->rect.x() + space, opt->rect.y(), opt->rect.width() - space, opt->rect.height(), opt->palette.brush(QPalette::Highlight));
0
1089 else-
1090 p->fillRect(opt->rect.x(), opt->rect.y(), opt->rect.width() - space, opt->rect.height(),
never executed: p->fillRect(opt->rect.x(), opt->rect.y(), opt->rect.width() - space, opt->rect.height(), opt->palette.brush(QPalette::Highlight));
0
1091 opt->palette.brush(QPalette::Highlight));
never executed: p->fillRect(opt->rect.x(), opt->rect.y(), opt->rect.width() - space, opt->rect.height(), opt->palette.brush(QPalette::Highlight));
0
1092 } else {-
1093 if (opt->rect.height() <= chunksize)
opt->rect.heig...) <= chunksizeDescription
TRUEnever evaluated
FALSEnever evaluated
0
1094 space = 0;
never executed: space = 0;
0
1095-
1096 if (inverted)
invertedDescription
TRUEnever evaluated
FALSEnever evaluated
0
1097 p->fillRect(opt->rect.x(), opt->rect.y(), opt->rect.width(), opt->rect.height() - space,
never executed: p->fillRect(opt->rect.x(), opt->rect.y(), opt->rect.width(), opt->rect.height() - space, opt->palette.brush(QPalette::Highlight));
0
1098 opt->palette.brush(QPalette::Highlight));
never executed: p->fillRect(opt->rect.x(), opt->rect.y(), opt->rect.width(), opt->rect.height() - space, opt->palette.brush(QPalette::Highlight));
0
1099 else-
1100 p->fillRect(opt->rect.x(), opt->rect.y() + space, opt->rect.width(), opt->rect.height() - space,
never executed: p->fillRect(opt->rect.x(), opt->rect.y() + space, opt->rect.width(), opt->rect.height() - space, opt->palette.brush(QPalette::Highlight));
0
1101 opt->palette.brush(QPalette::Highlight));
never executed: p->fillRect(opt->rect.x(), opt->rect.y() + space, opt->rect.width(), opt->rect.height() - space, opt->palette.brush(QPalette::Highlight));
0
1102 }-
1103 }-
1104 break;
never executed: break;
0
1105-
1106 case PE_FrameTabWidget: {
never executed: case PE_FrameTabWidget:
0
1107 qDrawWinButton(p, opt->rect, opt->palette, false, 0);-
1108 break;
never executed: break;
0
1109 }-
1110 default:
never executed: default:
0
1111 QCommonStyle::drawPrimitive(pe, opt, p, w);-
1112 }
never executed: end of block
0
1113}-
1114-
1115/*! \reimp */-
1116void QWindowsStyle::drawControl(ControlElement ce, const QStyleOption *opt, QPainter *p,-
1117 const QWidget *widget) const-
1118{-
1119 switch (ce) {-
1120#ifndef QT_NO_RUBBERBAND-
1121 case CE_RubberBand:
never executed: case CE_RubberBand:
0
1122 if (qstyleoption_cast<const QStyleOptionRubberBand *>(opt)) {
qstyleoption_c...erBand *>(opt)Description
TRUEnever evaluated
FALSEnever evaluated
0
1123 // ### workaround for slow general painter path-
1124 QPixmap tiledPixmap(16, 16);-
1125 QPainter pixmapPainter(&tiledPixmap);-
1126 pixmapPainter.setPen(Qt::NoPen);-
1127 pixmapPainter.setBrush(Qt::Dense4Pattern);-
1128 pixmapPainter.setBackground(Qt::white);-
1129 pixmapPainter.setBackgroundMode(Qt::OpaqueMode);-
1130 pixmapPainter.drawRect(0, 0, tiledPixmap.width(), tiledPixmap.height());-
1131 pixmapPainter.end();-
1132 tiledPixmap = QPixmap::fromImage(tiledPixmap.toImage());-
1133 p->save();-
1134 QRect r = opt->rect;-
1135 QStyleHintReturnMask mask;-
1136 if (proxy()->styleHint(QStyle::SH_RubberBand_Mask, opt, widget, &mask))
proxy()->style...widget, &mask)Description
TRUEnever evaluated
FALSEnever evaluated
0
1137 p->setClipRegion(mask.region);
never executed: p->setClipRegion(mask.region);
0
1138 p->drawTiledPixmap(r.x(), r.y(), r.width(), r.height(), tiledPixmap);-
1139 p->restore();-
1140 return;
never executed: return;
0
1141 }-
1142 break;
never executed: break;
0
1143#endif // QT_NO_RUBBERBAND-
1144-
1145#if !defined(QT_NO_MENU) && !defined(QT_NO_MAINWINDOW)-
1146 case CE_MenuBarEmptyArea:
never executed: case CE_MenuBarEmptyArea:
0
1147 if (widget && qobject_cast<const QMainWindow *>(widget->parentWidget())) {
widgetDescription
TRUEnever evaluated
FALSEnever evaluated
qobject_cast<c...arentWidget())Description
TRUEnever evaluated
FALSEnever evaluated
0
1148 p->fillRect(opt->rect, opt->palette.button());-
1149 QPen oldPen = p->pen();-
1150 p->setPen(QPen(opt->palette.dark().color()));-
1151 p->drawLine(opt->rect.bottomLeft(), opt->rect.bottomRight());-
1152 p->setPen(oldPen);-
1153 }
never executed: end of block
0
1154 break;
never executed: break;
0
1155#endif-
1156#ifndef QT_NO_MENU-
1157 case CE_MenuItem:
never executed: case CE_MenuItem:
0
1158 if (const QStyleOptionMenuItem *menuitem = qstyleoption_cast<const QStyleOptionMenuItem *>(opt)) {
const QStyleOp...nuItem *>(opt)Description
TRUEnever evaluated
FALSEnever evaluated
0
1159 int x, y, w, h;-
1160 menuitem->rect.getRect(&x, &y, &w, &h);-
1161 int tab = menuitem->tabWidth;-
1162 bool dis = !(menuitem->state & State_Enabled);-
1163 bool checked = menuitem->checkType != QStyleOptionMenuItem::NotCheckable
menuitem->chec...::NotCheckableDescription
TRUEnever evaluated
FALSEnever evaluated
0
1164 ? menuitem->checked : false;-
1165 bool act = menuitem->state & State_Selected;-
1166-
1167 // windows always has a check column, regardless whether we have an icon or not-
1168 int checkcol = qMax<int>(menuitem->maxIconWidth, QWindowsStylePrivate::windowsCheckMarkWidth);-
1169-
1170 QBrush fill = menuitem->palette.brush(act ? QPalette::Highlight : QPalette::Button);-
1171 p->fillRect(menuitem->rect.adjusted(0, 0, -1, 0), fill);-
1172-
1173 if (menuitem->menuItemType == QStyleOptionMenuItem::Separator){
menuitem->menu...tem::SeparatorDescription
TRUEnever evaluated
FALSEnever evaluated
0
1174 int yoff = y-1 + h / 2;-
1175 p->setPen(menuitem->palette.dark().color());-
1176 p->drawLine(x + 2, yoff, x + w - 4, yoff);-
1177 p->setPen(menuitem->palette.light().color());-
1178 p->drawLine(x + 2, yoff + 1, x + w - 4, yoff + 1);-
1179 return;
never executed: return;
0
1180 }-
1181-
1182 QRect vCheckRect = visualRect(opt->direction, menuitem->rect, QRect(menuitem->rect.x(), menuitem->rect.y(), checkcol, menuitem->rect.height()));-
1183 if (!menuitem->icon.isNull() && checked) {
!menuitem->icon.isNull()Description
TRUEnever evaluated
FALSEnever evaluated
checkedDescription
TRUEnever evaluated
FALSEnever evaluated
0
1184 if (act) {
actDescription
TRUEnever evaluated
FALSEnever evaluated
0
1185 qDrawShadePanel(p, vCheckRect,-
1186 menuitem->palette, true, 1,-
1187 &menuitem->palette.brush(QPalette::Button));-
1188 } else {
never executed: end of block
0
1189 QBrush fill(menuitem->palette.light().color(), Qt::Dense4Pattern);-
1190 qDrawShadePanel(p, vCheckRect, menuitem->palette, true, 1, &fill);-
1191 }
never executed: end of block
0
1192 } else if (!act) {
!actDescription
TRUEnever evaluated
FALSEnever evaluated
0
1193 p->fillRect(vCheckRect, menuitem->palette.brush(QPalette::Button));-
1194 }
never executed: end of block
0
1195-
1196 // On Windows Style, if we have a checkable item and an icon we-
1197 // draw the icon recessed to indicate an item is checked. If we-
1198 // have no icon, we draw a checkmark instead.-
1199 if (!menuitem->icon.isNull()) {
!menuitem->icon.isNull()Description
TRUEnever evaluated
FALSEnever evaluated
0
1200 QIcon::Mode mode = dis ? QIcon::Disabled : QIcon::Normal;
disDescription
TRUEnever evaluated
FALSEnever evaluated
0
1201 if (act && !dis)
actDescription
TRUEnever evaluated
FALSEnever evaluated
!disDescription
TRUEnever evaluated
FALSEnever evaluated
0
1202 mode = QIcon::Active;
never executed: mode = QIcon::Active;
0
1203 QPixmap pixmap;-
1204 if (checked)
checkedDescription
TRUEnever evaluated
FALSEnever evaluated
0
1205 pixmap = menuitem->icon.pixmap(proxy()->pixelMetric(PM_SmallIconSize, opt, widget), mode, QIcon::On);
never executed: pixmap = menuitem->icon.pixmap(proxy()->pixelMetric(PM_SmallIconSize, opt, widget), mode, QIcon::On);
0
1206 else-
1207 pixmap = menuitem->icon.pixmap(proxy()->pixelMetric(PM_SmallIconSize, opt, widget), mode);
never executed: pixmap = menuitem->icon.pixmap(proxy()->pixelMetric(PM_SmallIconSize, opt, widget), mode);
0
1208 const int pixw = pixmap.width() / pixmap.devicePixelRatio();-
1209 const int pixh = pixmap.height() / pixmap.devicePixelRatio();-
1210 if (act && !dis && !checked)
actDescription
TRUEnever evaluated
FALSEnever evaluated
!disDescription
TRUEnever evaluated
FALSEnever evaluated
!checkedDescription
TRUEnever evaluated
FALSEnever evaluated
0
1211 qDrawShadePanel(p, vCheckRect, menuitem->palette, false, 1,
never executed: qDrawShadePanel(p, vCheckRect, menuitem->palette, false, 1, &menuitem->palette.brush(QPalette::Button));
0
1212 &menuitem->palette.brush(QPalette::Button));
never executed: qDrawShadePanel(p, vCheckRect, menuitem->palette, false, 1, &menuitem->palette.brush(QPalette::Button));
0
1213 QRect pmr(0, 0, pixw, pixh);-
1214 pmr.moveCenter(vCheckRect.center());-
1215 p->setPen(menuitem->palette.text().color());-
1216 p->drawPixmap(pmr.topLeft(), pixmap);-
1217 } else if (checked) {
never executed: end of block
checkedDescription
TRUEnever evaluated
FALSEnever evaluated
0
1218 QStyleOptionMenuItem newMi = *menuitem;-
1219 newMi.state = State_None;-
1220 if (!dis)
!disDescription
TRUEnever evaluated
FALSEnever evaluated
0
1221 newMi.state |= State_Enabled;
never executed: newMi.state |= State_Enabled;
0
1222 if (act)
actDescription
TRUEnever evaluated
FALSEnever evaluated
0
1223 newMi.state |= State_On;
never executed: newMi.state |= State_On;
0
1224 newMi.rect = visualRect(opt->direction, menuitem->rect, QRect(menuitem->rect.x() + QWindowsStylePrivate::windowsItemFrame,-
1225 menuitem->rect.y() + QWindowsStylePrivate::windowsItemFrame,-
1226 checkcol - 2 * QWindowsStylePrivate::windowsItemFrame,-
1227 menuitem->rect.height() - 2 * QWindowsStylePrivate::windowsItemFrame));-
1228 proxy()->drawPrimitive(PE_IndicatorMenuCheckMark, &newMi, p, widget);-
1229 }
never executed: end of block
0
1230 p->setPen(act ? menuitem->palette.highlightedText().color() : menuitem->palette.buttonText().color());-
1231-
1232 QColor discol;-
1233 if (dis) {
disDescription
TRUEnever evaluated
FALSEnever evaluated
0
1234 discol = menuitem->palette.text().color();-
1235 p->setPen(discol);-
1236 }
never executed: end of block
0
1237-
1238 int xm = int(QWindowsStylePrivate::windowsItemFrame) + checkcol + int(QWindowsStylePrivate::windowsItemHMargin);-
1239 int xpos = menuitem->rect.x() + xm;-
1240 QRect textRect(xpos, y + QWindowsStylePrivate::windowsItemVMargin,-
1241 w - xm - QWindowsStylePrivate::windowsRightBorder - tab + 1, h - 2 * QWindowsStylePrivate::windowsItemVMargin);-
1242 QRect vTextRect = visualRect(opt->direction, menuitem->rect, textRect);-
1243 QStringRef s(&menuitem->text);-
1244 if (!s.isEmpty()) { // draw text
!s.isEmpty()Description
TRUEnever evaluated
FALSEnever evaluated
0
1245 p->save();-
1246 int t = s.indexOf(QLatin1Char('\t'));-
1247 int text_flags = Qt::AlignVCenter | Qt::TextShowMnemonic | Qt::TextDontClip | Qt::TextSingleLine;-
1248 if (!proxy()->styleHint(SH_UnderlineShortcut, menuitem, widget))
!proxy()->styl...uitem, widget)Description
TRUEnever evaluated
FALSEnever evaluated
0
1249 text_flags |= Qt::TextHideMnemonic;
never executed: text_flags |= Qt::TextHideMnemonic;
0
1250 text_flags |= Qt::AlignLeft;-
1251 if (t >= 0) {
t >= 0Description
TRUEnever evaluated
FALSEnever evaluated
0
1252 QRect vShortcutRect = visualRect(opt->direction, menuitem->rect,-
1253 QRect(textRect.topRight(), QPoint(menuitem->rect.right(), textRect.bottom())));-
1254 const QString textToDraw = s.mid(t + 1).toString();-
1255 if (dis && !act && proxy()->styleHint(SH_EtchDisabledText, opt, widget)) {
disDescription
TRUEnever evaluated
FALSEnever evaluated
!actDescription
TRUEnever evaluated
FALSEnever evaluated
proxy()->style..., opt, widget)Description
TRUEnever evaluated
FALSEnever evaluated
0
1256 p->setPen(menuitem->palette.light().color());-
1257 p->drawText(vShortcutRect.adjusted(1, 1, 1, 1), text_flags, textToDraw);-
1258 p->setPen(discol);-
1259 }
never executed: end of block
0
1260 p->drawText(vShortcutRect, text_flags, textToDraw);-
1261 s = s.left(t);-
1262 }
never executed: end of block
0
1263 QFont font = menuitem->font;-
1264 if (menuitem->menuItemType == QStyleOptionMenuItem::DefaultItem)
menuitem->menu...m::DefaultItemDescription
TRUEnever evaluated
FALSEnever evaluated
0
1265 font.setBold(true);
never executed: font.setBold(true);
0
1266 p->setFont(font);-
1267 const QString textToDraw = s.left(t).toString();-
1268 if (dis && !act && proxy()->styleHint(SH_EtchDisabledText, opt, widget)) {
disDescription
TRUEnever evaluated
FALSEnever evaluated
!actDescription
TRUEnever evaluated
FALSEnever evaluated
proxy()->style..., opt, widget)Description
TRUEnever evaluated
FALSEnever evaluated
0
1269 p->setPen(menuitem->palette.light().color());-
1270 p->drawText(vTextRect.adjusted(1, 1, 1, 1), text_flags, textToDraw);-
1271 p->setPen(discol);-
1272 }
never executed: end of block
0
1273 p->drawText(vTextRect, text_flags, textToDraw);-
1274 p->restore();-
1275 }
never executed: end of block
0
1276 if (menuitem->menuItemType == QStyleOptionMenuItem::SubMenu) {// draw sub menu arrow
menuitem->menu...uItem::SubMenuDescription
TRUEnever evaluated
FALSEnever evaluated
0
1277 int dim = (h - 2 * QWindowsStylePrivate::windowsItemFrame) / 2;-
1278 PrimitiveElement arrow;-
1279 arrow = (opt->direction == Qt::RightToLeft) ? PE_IndicatorArrowLeft : PE_IndicatorArrowRight;
(opt->directio...::RightToLeft)Description
TRUEnever evaluated
FALSEnever evaluated
0
1280 xpos = x + w - QWindowsStylePrivate::windowsArrowHMargin - QWindowsStylePrivate::windowsItemFrame - dim;-
1281 QRect vSubMenuRect = visualRect(opt->direction, menuitem->rect, QRect(xpos, y + h / 2 - dim / 2, dim, dim));-
1282 QStyleOptionMenuItem newMI = *menuitem;-
1283 newMI.rect = vSubMenuRect;-
1284 newMI.state = dis ? State_None : State_Enabled;
disDescription
TRUEnever evaluated
FALSEnever evaluated
0
1285 if (act)
actDescription
TRUEnever evaluated
FALSEnever evaluated
0
1286 newMI.palette.setColor(QPalette::ButtonText,
never executed: newMI.palette.setColor(QPalette::ButtonText, newMI.palette.highlightedText().color());
0
1287 newMI.palette.highlightedText().color());
never executed: newMI.palette.setColor(QPalette::ButtonText, newMI.palette.highlightedText().color());
0
1288 proxy()->drawPrimitive(arrow, &newMI, p, widget);-
1289 }
never executed: end of block
0
1290-
1291 }
never executed: end of block
0
1292 break;
never executed: break;
0
1293#endif // QT_NO_MENU-
1294#ifndef QT_NO_MENUBAR-
1295 case CE_MenuBarItem:
never executed: case CE_MenuBarItem:
0
1296 if (const QStyleOptionMenuItem *mbi = qstyleoption_cast<const QStyleOptionMenuItem *>(opt)) {
const QStyleOp...nuItem *>(opt)Description
TRUEnever evaluated
FALSEnever evaluated
0
1297 bool active = mbi->state & State_Selected;-
1298 bool hasFocus = mbi->state & State_HasFocus;-
1299 bool down = mbi->state & State_Sunken;-
1300 QStyleOptionMenuItem newMbi = *mbi;-
1301 p->fillRect(mbi->rect, mbi->palette.brush(QPalette::Button));-
1302 if (active || hasFocus) {
activeDescription
TRUEnever evaluated
FALSEnever evaluated
hasFocusDescription
TRUEnever evaluated
FALSEnever evaluated
0
1303 QBrush b = mbi->palette.brush(QPalette::Button);-
1304 if (active && down)
activeDescription
TRUEnever evaluated
FALSEnever evaluated
downDescription
TRUEnever evaluated
FALSEnever evaluated
0
1305 p->setBrushOrigin(p->brushOrigin() + QPoint(1, 1));
never executed: p->setBrushOrigin(p->brushOrigin() + QPoint(1, 1));
0
1306 if (active && hasFocus)
activeDescription
TRUEnever evaluated
FALSEnever evaluated
hasFocusDescription
TRUEnever evaluated
FALSEnever evaluated
0
1307 qDrawShadeRect(p, mbi->rect.x(), mbi->rect.y(), mbi->rect.width(),
never executed: qDrawShadeRect(p, mbi->rect.x(), mbi->rect.y(), mbi->rect.width(), mbi->rect.height(), mbi->palette, active && down, 1, 0, &b);
0
1308 mbi->rect.height(), mbi->palette, active && down, 1, 0, &b);
never executed: qDrawShadeRect(p, mbi->rect.x(), mbi->rect.y(), mbi->rect.width(), mbi->rect.height(), mbi->palette, active && down, 1, 0, &b);
0
1309 if (active && down) {
activeDescription
TRUEnever evaluated
FALSEnever evaluated
downDescription
TRUEnever evaluated
FALSEnever evaluated
0
1310 newMbi.rect.translate(proxy()->pixelMetric(PM_ButtonShiftHorizontal, mbi, widget),-
1311 proxy()->pixelMetric(PM_ButtonShiftVertical, mbi, widget));-
1312 p->setBrushOrigin(p->brushOrigin() - QPoint(1, 1));-
1313 }
never executed: end of block
0
1314 }
never executed: end of block
0
1315 QCommonStyle::drawControl(ce, &newMbi, p, widget);-
1316 }
never executed: end of block
0
1317 break;
never executed: break;
0
1318#endif // QT_NO_MENUBAR-
1319#ifndef QT_NO_TABBAR-
1320 case CE_TabBarTabShape:
never executed: case CE_TabBarTabShape:
0
1321 if (const QStyleOptionTab *tab = qstyleoption_cast<const QStyleOptionTab *>(opt)) {
const QStyleOp...ionTab *>(opt)Description
TRUEnever evaluated
FALSEnever evaluated
0
1322 bool rtlHorTabs = (tab->direction == Qt::RightToLeft
tab->direction...t::RightToLeftDescription
TRUEnever evaluated
FALSEnever evaluated
0
1323 && (tab->shape == QTabBar::RoundedNorth
tab->shape == ...::RoundedNorthDescription
TRUEnever evaluated
FALSEnever evaluated
0
1324 || tab->shape == QTabBar::RoundedSouth));
tab->shape == ...::RoundedSouthDescription
TRUEnever evaluated
FALSEnever evaluated
0
1325 bool selected = tab->state & State_Selected;-
1326 bool lastTab = ((!rtlHorTabs && tab->position == QStyleOptionTab::End)
!rtlHorTabsDescription
TRUEnever evaluated
FALSEnever evaluated
tab->position ...OptionTab::EndDescription
TRUEnever evaluated
FALSEnever evaluated
0
1327 || (rtlHorTabs
rtlHorTabsDescription
TRUEnever evaluated
FALSEnever evaluated
0
1328 && tab->position == QStyleOptionTab::Beginning));
tab->position ...Tab::BeginningDescription
TRUEnever evaluated
FALSEnever evaluated
0
1329 bool firstTab = ((!rtlHorTabs
!rtlHorTabsDescription
TRUEnever evaluated
FALSEnever evaluated
0
1330 && tab->position == QStyleOptionTab::Beginning)
tab->position ...Tab::BeginningDescription
TRUEnever evaluated
FALSEnever evaluated
0
1331 || (rtlHorTabs
rtlHorTabsDescription
TRUEnever evaluated
FALSEnever evaluated
0
1332 && tab->position == QStyleOptionTab::End));
tab->position ...OptionTab::EndDescription
TRUEnever evaluated
FALSEnever evaluated
0
1333 bool onlyOne = tab->position == QStyleOptionTab::OnlyOneTab;-
1334 bool previousSelected =-
1335 ((!rtlHorTabs
!rtlHorTabsDescription
TRUEnever evaluated
FALSEnever evaluated
0
1336 && tab->selectedPosition == QStyleOptionTab::PreviousIsSelected)
tab->selectedP...iousIsSelectedDescription
TRUEnever evaluated
FALSEnever evaluated
0
1337 || (rtlHorTabs
rtlHorTabsDescription
TRUEnever evaluated
FALSEnever evaluated
0
1338 && tab->selectedPosition == QStyleOptionTab::NextIsSelected));
tab->selectedP...NextIsSelectedDescription
TRUEnever evaluated
FALSEnever evaluated
0
1339 bool nextSelected =-
1340 ((!rtlHorTabs
!rtlHorTabsDescription
TRUEnever evaluated
FALSEnever evaluated
0
1341 && tab->selectedPosition == QStyleOptionTab::NextIsSelected)
tab->selectedP...NextIsSelectedDescription
TRUEnever evaluated
FALSEnever evaluated
0
1342 || (rtlHorTabs
rtlHorTabsDescription
TRUEnever evaluated
FALSEnever evaluated
0
1343 && tab->selectedPosition
tab->selectedP...iousIsSelectedDescription
TRUEnever evaluated
FALSEnever evaluated
0
1344 == QStyleOptionTab::PreviousIsSelected));
tab->selectedP...iousIsSelectedDescription
TRUEnever evaluated
FALSEnever evaluated
0
1345 int tabBarAlignment = proxy()->styleHint(SH_TabBar_Alignment, tab, widget);-
1346 bool leftAligned = (!rtlHorTabs && tabBarAlignment == Qt::AlignLeft)
!rtlHorTabsDescription
TRUEnever evaluated
FALSEnever evaluated
tabBarAlignmen... Qt::AlignLeftDescription
TRUEnever evaluated
FALSEnever evaluated
0
1347 || (rtlHorTabs
rtlHorTabsDescription
TRUEnever evaluated
FALSEnever evaluated
0
1348 && tabBarAlignment == Qt::AlignRight);
tabBarAlignmen...Qt::AlignRightDescription
TRUEnever evaluated
FALSEnever evaluated
0
1349-
1350 bool rightAligned = (!rtlHorTabs && tabBarAlignment == Qt::AlignRight)
!rtlHorTabsDescription
TRUEnever evaluated
FALSEnever evaluated
tabBarAlignmen...Qt::AlignRightDescription
TRUEnever evaluated
FALSEnever evaluated
0
1351 || (rtlHorTabs
rtlHorTabsDescription
TRUEnever evaluated
FALSEnever evaluated
0
1352 && tabBarAlignment == Qt::AlignLeft);
tabBarAlignmen... Qt::AlignLeftDescription
TRUEnever evaluated
FALSEnever evaluated
0
1353-
1354 QColor light = tab->palette.light().color();-
1355 QColor dark = tab->palette.dark().color();-
1356 QColor shadow = tab->palette.shadow().color();-
1357 int borderThinkness = proxy()->pixelMetric(PM_TabBarBaseOverlap, tab, widget);-
1358 if (selected)
selectedDescription
TRUEnever evaluated
FALSEnever evaluated
0
1359 borderThinkness /= 2;
never executed: borderThinkness /= 2;
0
1360 QRect r2(opt->rect);-
1361 int x1 = r2.left();-
1362 int x2 = r2.right();-
1363 int y1 = r2.top();-
1364 int y2 = r2.bottom();-
1365 switch (tab->shape) {-
1366 default:
never executed: default:
0
1367 QCommonStyle::drawControl(ce, tab, p, widget);-
1368 break;
never executed: break;
0
1369 case QTabBar::RoundedNorth: {
never executed: case QTabBar::RoundedNorth:
0
1370 if (!selected) {
!selectedDescription
TRUEnever evaluated
FALSEnever evaluated
0
1371 y1 += 2;-
1372 x1 += onlyOne || firstTab ? borderThinkness : 0;
onlyOneDescription
TRUEnever evaluated
FALSEnever evaluated
firstTabDescription
TRUEnever evaluated
FALSEnever evaluated
0
1373 x2 -= onlyOne || lastTab ? borderThinkness : 0;
onlyOneDescription
TRUEnever evaluated
FALSEnever evaluated
lastTabDescription
TRUEnever evaluated
FALSEnever evaluated
0
1374 }
never executed: end of block
0
1375-
1376 p->fillRect(QRect(x1 + 1, y1 + 1, (x2 - x1) - 1, (y2 - y1) - 2), tab->palette.background());-
1377-
1378 // Delete border-
1379 if (selected) {
selectedDescription
TRUEnever evaluated
FALSEnever evaluated
0
1380 p->fillRect(QRect(x1,y2-1,x2-x1,1), tab->palette.background());-
1381 p->fillRect(QRect(x1,y2,x2-x1,1), tab->palette.background());-
1382 }
never executed: end of block
0
1383 // Left-
1384 if (firstTab || selected || onlyOne || !previousSelected) {
firstTabDescription
TRUEnever evaluated
FALSEnever evaluated
selectedDescription
TRUEnever evaluated
FALSEnever evaluated
onlyOneDescription
TRUEnever evaluated
FALSEnever evaluated
!previousSelectedDescription
TRUEnever evaluated
FALSEnever evaluated
0
1385 p->setPen(light);-
1386 p->drawLine(x1, y1 + 2, x1, y2 - ((onlyOne || firstTab) && selected && leftAligned ? 0 : borderThinkness));-
1387 p->drawPoint(x1 + 1, y1 + 1);-
1388 }
never executed: end of block
0
1389 // Top-
1390 {-
1391 int beg = x1 + (previousSelected ? 0 : 2);
previousSelectedDescription
TRUEnever evaluated
FALSEnever evaluated
0
1392 int end = x2 - (nextSelected ? 0 : 2);
nextSelectedDescription
TRUEnever evaluated
FALSEnever evaluated
0
1393 p->setPen(light);-
1394 p->drawLine(beg, y1, end, y1);-
1395 }-
1396 // Right-
1397 if (lastTab || selected || onlyOne || !nextSelected) {
lastTabDescription
TRUEnever evaluated
FALSEnever evaluated
selectedDescription
TRUEnever evaluated
FALSEnever evaluated
onlyOneDescription
TRUEnever evaluated
FALSEnever evaluated
!nextSelectedDescription
TRUEnever evaluated
FALSEnever evaluated
0
1398 p->setPen(shadow);-
1399 p->drawLine(x2, y1 + 2, x2, y2 - ((onlyOne || lastTab) && selected && rightAligned ? 0 : borderThinkness));-
1400 p->drawPoint(x2 - 1, y1 + 1);-
1401 p->setPen(dark);-
1402 p->drawLine(x2 - 1, y1 + 2, x2 - 1, y2 - ((onlyOne || lastTab) && selected && rightAligned ? 0 : borderThinkness));-
1403 }
never executed: end of block
0
1404 break; }
never executed: break;
0
1405 case QTabBar::RoundedSouth: {
never executed: case QTabBar::RoundedSouth:
0
1406 if (!selected) {
!selectedDescription
TRUEnever evaluated
FALSEnever evaluated
0
1407 y2 -= 2;-
1408 x1 += firstTab ? borderThinkness : 0;
firstTabDescription
TRUEnever evaluated
FALSEnever evaluated
0
1409 x2 -= lastTab ? borderThinkness : 0;
lastTabDescription
TRUEnever evaluated
FALSEnever evaluated
0
1410 }
never executed: end of block
0
1411-
1412 p->fillRect(QRect(x1 + 1, y1 + 2, (x2 - x1) - 1, (y2 - y1) - 1), tab->palette.background());-
1413-
1414 // Delete border-
1415 if (selected) {
selectedDescription
TRUEnever evaluated
FALSEnever evaluated
0
1416 p->fillRect(QRect(x1, y1 + 1, (x2 - 1)-x1, 1), tab->palette.background());-
1417 p->fillRect(QRect(x1, y1, (x2 - 1)-x1, 1), tab->palette.background());-
1418 }
never executed: end of block
0
1419 // Left-
1420 if (firstTab || selected || onlyOne || !previousSelected) {
firstTabDescription
TRUEnever evaluated
FALSEnever evaluated
selectedDescription
TRUEnever evaluated
FALSEnever evaluated
onlyOneDescription
TRUEnever evaluated
FALSEnever evaluated
!previousSelectedDescription
TRUEnever evaluated
FALSEnever evaluated
0
1421 p->setPen(light);-
1422 p->drawLine(x1, y2 - 2, x1, y1 + ((onlyOne || firstTab) && selected && leftAligned ? 0 : borderThinkness));-
1423 p->drawPoint(x1 + 1, y2 - 1);-
1424 }
never executed: end of block
0
1425 // Bottom-
1426 {-
1427 int beg = x1 + (previousSelected ? 0 : 2);
previousSelectedDescription
TRUEnever evaluated
FALSEnever evaluated
0
1428 int end = x2 - (nextSelected ? 0 : 2);
nextSelectedDescription
TRUEnever evaluated
FALSEnever evaluated
0
1429 p->setPen(shadow);-
1430 p->drawLine(beg, y2, end, y2);-
1431 p->setPen(dark);-
1432 p->drawLine(beg, y2 - 1, end, y2 - 1);-
1433 }-
1434 // Right-
1435 if (lastTab || selected || onlyOne || !nextSelected) {
lastTabDescription
TRUEnever evaluated
FALSEnever evaluated
selectedDescription
TRUEnever evaluated
FALSEnever evaluated
onlyOneDescription
TRUEnever evaluated
FALSEnever evaluated
!nextSelectedDescription
TRUEnever evaluated
FALSEnever evaluated
0
1436 p->setPen(shadow);-
1437 p->drawLine(x2, y2 - 2, x2, y1 + ((onlyOne || lastTab) && selected && rightAligned ? 0 : borderThinkness));-
1438 p->drawPoint(x2 - 1, y2 - 1);-
1439 p->setPen(dark);-
1440 p->drawLine(x2 - 1, y2 - 2, x2 - 1, y1 + ((onlyOne || lastTab) && selected && rightAligned ? 0 : borderThinkness));-
1441 }
never executed: end of block
0
1442 break; }
never executed: break;
0
1443 case QTabBar::RoundedWest: {
never executed: case QTabBar::RoundedWest:
0
1444 if (!selected) {
!selectedDescription
TRUEnever evaluated
FALSEnever evaluated
0
1445 x1 += 2;-
1446 y1 += firstTab ? borderThinkness : 0;
firstTabDescription
TRUEnever evaluated
FALSEnever evaluated
0
1447 y2 -= lastTab ? borderThinkness : 0;
lastTabDescription
TRUEnever evaluated
FALSEnever evaluated
0
1448 }
never executed: end of block
0
1449-
1450 p->fillRect(QRect(x1 + 1, y1 + 1, (x2 - x1) - 2, (y2 - y1) - 1), tab->palette.background());-
1451-
1452 // Delete border-
1453 if (selected) {
selectedDescription
TRUEnever evaluated
FALSEnever evaluated
0
1454 p->fillRect(QRect(x2 - 1, y1, 1, y2-y1), tab->palette.background());-
1455 p->fillRect(QRect(x2, y1, 1, y2-y1), tab->palette.background());-
1456 }
never executed: end of block
0
1457 // Top-
1458 if (firstTab || selected || onlyOne || !previousSelected) {
firstTabDescription
TRUEnever evaluated
FALSEnever evaluated
selectedDescription
TRUEnever evaluated
FALSEnever evaluated
onlyOneDescription
TRUEnever evaluated
FALSEnever evaluated
!previousSelectedDescription
TRUEnever evaluated
FALSEnever evaluated
0
1459 p->setPen(light);-
1460 p->drawLine(x1 + 2, y1, x2 - ((onlyOne || firstTab) && selected && leftAligned ? 0 : borderThinkness), y1);-
1461 p->drawPoint(x1 + 1, y1 + 1);-
1462 }
never executed: end of block
0
1463 // Left-
1464 {-
1465 int beg = y1 + (previousSelected ? 0 : 2);
previousSelectedDescription
TRUEnever evaluated
FALSEnever evaluated
0
1466 int end = y2 - (nextSelected ? 0 : 2);
nextSelectedDescription
TRUEnever evaluated
FALSEnever evaluated
0
1467 p->setPen(light);-
1468 p->drawLine(x1, beg, x1, end);-
1469 }-
1470 // Bottom-
1471 if (lastTab || selected || onlyOne || !nextSelected) {
lastTabDescription
TRUEnever evaluated
FALSEnever evaluated
selectedDescription
TRUEnever evaluated
FALSEnever evaluated
onlyOneDescription
TRUEnever evaluated
FALSEnever evaluated
!nextSelectedDescription
TRUEnever evaluated
FALSEnever evaluated
0
1472 p->setPen(shadow);-
1473 p->drawLine(x1 + 3, y2, x2 - ((onlyOne || lastTab) && selected && rightAligned ? 0 : borderThinkness), y2);-
1474 p->drawPoint(x1 + 2, y2 - 1);-
1475 p->setPen(dark);-
1476 p->drawLine(x1 + 3, y2 - 1, x2 - ((onlyOne || lastTab) && selected && rightAligned ? 0 : borderThinkness), y2 - 1);-
1477 p->drawPoint(x1 + 1, y2 - 1);-
1478 p->drawPoint(x1 + 2, y2);-
1479 }
never executed: end of block
0
1480 break; }
never executed: break;
0
1481 case QTabBar::RoundedEast: {
never executed: case QTabBar::RoundedEast:
0
1482 if (!selected) {
!selectedDescription
TRUEnever evaluated
FALSEnever evaluated
0
1483 x2 -= 2;-
1484 y1 += firstTab ? borderThinkness : 0;
firstTabDescription
TRUEnever evaluated
FALSEnever evaluated
0
1485 y2 -= lastTab ? borderThinkness : 0;
lastTabDescription
TRUEnever evaluated
FALSEnever evaluated
0
1486 }
never executed: end of block
0
1487-
1488 p->fillRect(QRect(x1 + 2, y1 + 1, (x2 - x1) - 1, (y2 - y1) - 1), tab->palette.background());-
1489-
1490 // Delete border-
1491 if (selected) {
selectedDescription
TRUEnever evaluated
FALSEnever evaluated
0
1492 p->fillRect(QRect(x1 + 1, y1, 1, (y2 - 1)-y1),tab->palette.background());-
1493 p->fillRect(QRect(x1, y1, 1, (y2-1)-y1), tab->palette.background());-
1494 }
never executed: end of block
0
1495 // Top-
1496 if (firstTab || selected || onlyOne || !previousSelected) {
firstTabDescription
TRUEnever evaluated
FALSEnever evaluated
selectedDescription
TRUEnever evaluated
FALSEnever evaluated
onlyOneDescription
TRUEnever evaluated
FALSEnever evaluated
!previousSelectedDescription
TRUEnever evaluated
FALSEnever evaluated
0
1497 p->setPen(light);-
1498 p->drawLine(x2 - 2, y1, x1 + ((onlyOne || firstTab) && selected && leftAligned ? 0 : borderThinkness), y1);-
1499 p->drawPoint(x2 - 1, y1 + 1);-
1500 }
never executed: end of block
0
1501 // Right-
1502 {-
1503 int beg = y1 + (previousSelected ? 0 : 2);
previousSelectedDescription
TRUEnever evaluated
FALSEnever evaluated
0
1504 int end = y2 - (nextSelected ? 0 : 2);
nextSelectedDescription
TRUEnever evaluated
FALSEnever evaluated
0
1505 p->setPen(shadow);-
1506 p->drawLine(x2, beg, x2, end);-
1507 p->setPen(dark);-
1508 p->drawLine(x2 - 1, beg, x2 - 1, end);-
1509 }-
1510 // Bottom-
1511 if (lastTab || selected || onlyOne || !nextSelected) {
lastTabDescription
TRUEnever evaluated
FALSEnever evaluated
selectedDescription
TRUEnever evaluated
FALSEnever evaluated
onlyOneDescription
TRUEnever evaluated
FALSEnever evaluated
!nextSelectedDescription
TRUEnever evaluated
FALSEnever evaluated
0
1512 p->setPen(shadow);-
1513 p->drawLine(x2 - 2, y2, x1 + ((onlyOne || lastTab) && selected && rightAligned ? 0 : borderThinkness), y2);-
1514 p->drawPoint(x2 - 1, y2 - 1);-
1515 p->setPen(dark);-
1516 p->drawLine(x2 - 2, y2 - 1, x1 + ((onlyOne || lastTab) && selected && rightAligned ? 0 : borderThinkness), y2 - 1);-
1517 }
never executed: end of block
0
1518 break; }
never executed: break;
0
1519 }-
1520 }-
1521 break;
never executed: break;
0
1522#endif // QT_NO_TABBAR-
1523 case CE_ToolBoxTabShape:
never executed: case CE_ToolBoxTabShape:
0
1524 qDrawShadePanel(p, opt->rect, opt->palette,-
1525 opt->state & (State_Sunken | State_On), 1,-
1526 &opt->palette.brush(QPalette::Button));-
1527 break;
never executed: break;
0
1528#ifndef QT_NO_SPLITTER-
1529 case CE_Splitter:
never executed: case CE_Splitter:
0
1530 p->eraseRect(opt->rect);-
1531 break;
never executed: break;
0
1532#endif // QT_NO_SPLITTER-
1533#ifndef QT_NO_SCROLLBAR-
1534 case CE_ScrollBarSubLine:
never executed: case CE_ScrollBarSubLine:
0
1535 case CE_ScrollBarAddLine: {
never executed: case CE_ScrollBarAddLine:
0
1536 if ((opt->state & State_Sunken)) {
(opt->state & State_Sunken)Description
TRUEnever evaluated
FALSEnever evaluated
0
1537 p->setPen(opt->palette.dark().color());-
1538 p->setBrush(opt->palette.brush(QPalette::Button));-
1539 p->drawRect(opt->rect.adjusted(0, 0, -1, -1));-
1540 } else {
never executed: end of block
0
1541 QStyleOption buttonOpt = *opt;-
1542 if (!(buttonOpt.state & State_Sunken))
!(buttonOpt.st... State_Sunken)Description
TRUEnever evaluated
FALSEnever evaluated
0
1543 buttonOpt.state |= State_Raised;
never executed: buttonOpt.state |= State_Raised;
0
1544 QPalette pal(opt->palette);-
1545 pal.setColor(QPalette::Button, opt->palette.light().color());-
1546 pal.setColor(QPalette::Light, opt->palette.button().color());-
1547 qDrawWinButton(p, opt->rect, pal, opt->state & (State_Sunken | State_On),-
1548 &opt->palette.brush(QPalette::Button));-
1549 }
never executed: end of block
0
1550 PrimitiveElement arrow;-
1551 if (opt->state & State_Horizontal) {
opt->state & State_HorizontalDescription
TRUEnever evaluated
FALSEnever evaluated
0
1552 if (ce == CE_ScrollBarAddLine)
ce == CE_ScrollBarAddLineDescription
TRUEnever evaluated
FALSEnever evaluated
0
1553 arrow = opt->direction == Qt::LeftToRight ? PE_IndicatorArrowRight : PE_IndicatorArrowLeft;
never executed: arrow = opt->direction == Qt::LeftToRight ? PE_IndicatorArrowRight : PE_IndicatorArrowLeft;
opt->direction...t::LeftToRightDescription
TRUEnever evaluated
FALSEnever evaluated
0
1554 else-
1555 arrow = opt->direction == Qt::LeftToRight ? PE_IndicatorArrowLeft : PE_IndicatorArrowRight;
never executed: arrow = opt->direction == Qt::LeftToRight ? PE_IndicatorArrowLeft : PE_IndicatorArrowRight;
opt->direction...t::LeftToRightDescription
TRUEnever evaluated
FALSEnever evaluated
0
1556 } else {-
1557 if (ce == CE_ScrollBarAddLine)
ce == CE_ScrollBarAddLineDescription
TRUEnever evaluated
FALSEnever evaluated
0
1558 arrow = PE_IndicatorArrowDown;
never executed: arrow = PE_IndicatorArrowDown;
0
1559 else-
1560 arrow = PE_IndicatorArrowUp;
never executed: arrow = PE_IndicatorArrowUp;
0
1561 }-
1562 QStyleOption arrowOpt = *opt;-
1563 arrowOpt.rect = opt->rect.adjusted(4, 4, -4, -4);-
1564 proxy()->drawPrimitive(arrow, &arrowOpt, p, widget);-
1565 break; }
never executed: break;
0
1566 case CE_ScrollBarAddPage:
never executed: case CE_ScrollBarAddPage:
0
1567 case CE_ScrollBarSubPage: {
never executed: case CE_ScrollBarSubPage:
0
1568 QBrush br;-
1569 QBrush bg = p->background();-
1570 Qt::BGMode bg_mode = p->backgroundMode();-
1571 p->setPen(Qt::NoPen);-
1572 p->setBackgroundMode(Qt::OpaqueMode);-
1573-
1574 if (opt->state & State_Sunken) {
opt->state & State_SunkenDescription
TRUEnever evaluated
FALSEnever evaluated
0
1575 br = QBrush(opt->palette.shadow().color(), Qt::Dense4Pattern);-
1576 p->setBackground(opt->palette.dark().color());-
1577 p->setBrush(br);-
1578 } else {
never executed: end of block
0
1579 const QBrush paletteBrush = opt->palette.brush(QPalette::Light);-
1580 if (paletteBrush.style() == Qt::TexturePattern) {
paletteBrush.s...TexturePatternDescription
TRUEnever evaluated
FALSEnever evaluated
0
1581 if (qHasPixmapTexture(paletteBrush))
qHasPixmapText...(paletteBrush)Description
TRUEnever evaluated
FALSEnever evaluated
0
1582 br = QBrush(paletteBrush.texture());
never executed: br = QBrush(paletteBrush.texture());
0
1583 else-
1584 br = QBrush(paletteBrush.textureImage());
never executed: br = QBrush(paletteBrush.textureImage());
0
1585 } else-
1586 br = QBrush(opt->palette.light().color(), Qt::Dense4Pattern);
never executed: br = QBrush(opt->palette.light().color(), Qt::Dense4Pattern);
0
1587 p->setBackground(opt->palette.background().color());-
1588 p->setBrush(br);-
1589 }
never executed: end of block
0
1590 p->drawRect(opt->rect);-
1591 p->setBackground(bg);-
1592 p->setBackgroundMode(bg_mode);-
1593 break; }
never executed: break;
0
1594 case CE_ScrollBarSlider:
never executed: case CE_ScrollBarSlider:
0
1595 if (!(opt->state & State_Enabled)) {
!(opt->state & State_Enabled)Description
TRUEnever evaluated
FALSEnever evaluated
0
1596 QBrush br;-
1597 const QBrush paletteBrush = opt->palette.brush(QPalette::Light);-
1598 if (paletteBrush.style() == Qt::TexturePattern) {
paletteBrush.s...TexturePatternDescription
TRUEnever evaluated
FALSEnever evaluated
0
1599 if (qHasPixmapTexture(paletteBrush))
qHasPixmapText...(paletteBrush)Description
TRUEnever evaluated
FALSEnever evaluated
0
1600 br = QBrush(paletteBrush.texture());
never executed: br = QBrush(paletteBrush.texture());
0
1601 else-
1602 br = QBrush(paletteBrush.textureImage());
never executed: br = QBrush(paletteBrush.textureImage());
0
1603 } else-
1604 br = QBrush(opt->palette.light().color(), Qt::Dense4Pattern);
never executed: br = QBrush(opt->palette.light().color(), Qt::Dense4Pattern);
0
1605 p->setPen(Qt::NoPen);-
1606 p->setBrush(br);-
1607 p->setBackgroundMode(Qt::OpaqueMode);-
1608 p->drawRect(opt->rect);-
1609 } else {
never executed: end of block
0
1610 QStyleOptionButton buttonOpt;-
1611 buttonOpt.QStyleOption::operator=(*opt);-
1612 buttonOpt.state = State_Enabled | State_Raised;-
1613-
1614 QPalette pal(opt->palette);-
1615 pal.setColor(QPalette::Button, opt->palette.light().color());-
1616 pal.setColor(QPalette::Light, opt->palette.button().color());-
1617 qDrawWinButton(p, opt->rect, pal, false, &opt->palette.brush(QPalette::Button));-
1618 }
never executed: end of block
0
1619 break;
never executed: break;
0
1620#endif // QT_NO_SCROLLBAR-
1621 case CE_HeaderSection: {
never executed: case CE_HeaderSection:
0
1622 QBrush fill;-
1623 if (opt->state & State_On)
opt->state & State_OnDescription
TRUEnever evaluated
FALSEnever evaluated
0
1624 fill = QBrush(opt->palette.light().color(), Qt::Dense4Pattern);
never executed: fill = QBrush(opt->palette.light().color(), Qt::Dense4Pattern);
0
1625 else-
1626 fill = opt->palette.brush(QPalette::Button);
never executed: fill = opt->palette.brush(QPalette::Button);
0
1627-
1628 if (opt->state & (State_Raised | State_Sunken)) {
opt->state & (... State_Sunken)Description
TRUEnever evaluated
FALSEnever evaluated
0
1629 qDrawWinButton(p, opt->rect, opt->palette, opt->state & State_Sunken, &fill);-
1630 } else {
never executed: end of block
0
1631 p->fillRect(opt->rect, fill);-
1632 }
never executed: end of block
0
1633 break; }
never executed: break;
0
1634#ifndef QT_NO_TOOLBAR-
1635 case CE_ToolBar:
never executed: case CE_ToolBar:
0
1636 if (const QStyleOptionToolBar *toolbar = qstyleoption_cast<const QStyleOptionToolBar *>(opt)) {
const QStyleOp...oolBar *>(opt)Description
TRUEnever evaluated
FALSEnever evaluated
0
1637 // Reserve the beveled appearance only for mainwindow toolbars-
1638 if (!(widget && qobject_cast<const QMainWindow*> (widget->parentWidget())))
widgetDescription
TRUEnever evaluated
FALSEnever evaluated
qobject_cast<c...arentWidget())Description
TRUEnever evaluated
FALSEnever evaluated
0
1639 break;
never executed: break;
0
1640-
1641 QRect rect = opt->rect;-
1642 bool paintLeftBorder = true;-
1643 bool paintRightBorder = true;-
1644 bool paintBottomBorder = true;-
1645-
1646 switch (toolbar->toolBarArea){-
1647 case Qt::BottomToolBarArea :
never executed: case Qt::BottomToolBarArea :
0
1648 switch(toolbar->positionOfLine){-
1649 case QStyleOptionToolBar::Beginning:
never executed: case QStyleOptionToolBar::Beginning:
0
1650 case QStyleOptionToolBar::OnlyOne:
never executed: case QStyleOptionToolBar::OnlyOne:
0
1651 paintBottomBorder = false;-
1652 default:
code before this statement never executed: default:
never executed: default:
0
1653 break;
never executed: break;
0
1654 }-
1655 case Qt::TopToolBarArea :
code before this statement never executed: case Qt::TopToolBarArea :
never executed: case Qt::TopToolBarArea :
0
1656 switch(toolbar->positionWithinLine){-
1657 case QStyleOptionToolBar::Beginning:
never executed: case QStyleOptionToolBar::Beginning:
0
1658 paintLeftBorder = false;-
1659 break;
never executed: break;
0
1660 case QStyleOptionToolBar::End:
never executed: case QStyleOptionToolBar::End:
0
1661 paintRightBorder = false;-
1662 break;
never executed: break;
0
1663 case QStyleOptionToolBar::OnlyOne:
never executed: case QStyleOptionToolBar::OnlyOne:
0
1664 paintRightBorder = false;-
1665 paintLeftBorder = false;-
1666 default:
code before this statement never executed: default:
never executed: default:
0
1667 break;
never executed: break;
0
1668 }-
1669 if(opt->direction == Qt::RightToLeft){ //reverse layout changes the order of Beginning/end
opt->direction...t::RightToLeftDescription
TRUEnever evaluated
FALSEnever evaluated
0
1670 bool tmp = paintLeftBorder;-
1671 paintRightBorder=paintLeftBorder;-
1672 paintLeftBorder=tmp;-
1673 }
never executed: end of block
0
1674 break;
never executed: break;
0
1675 case Qt::RightToolBarArea :
never executed: case Qt::RightToolBarArea :
0
1676 switch (toolbar->positionOfLine){-
1677 case QStyleOptionToolBar::Beginning:
never executed: case QStyleOptionToolBar::Beginning:
0
1678 case QStyleOptionToolBar::OnlyOne:
never executed: case QStyleOptionToolBar::OnlyOne:
0
1679 paintRightBorder = false;-
1680 break;
never executed: break;
0
1681 default:
never executed: default:
0
1682 break;
never executed: break;
0
1683 }-
1684 break;
never executed: break;
0
1685 case Qt::LeftToolBarArea :
never executed: case Qt::LeftToolBarArea :
0
1686 switch (toolbar->positionOfLine){-
1687 case QStyleOptionToolBar::Beginning:
never executed: case QStyleOptionToolBar::Beginning:
0
1688 case QStyleOptionToolBar::OnlyOne:
never executed: case QStyleOptionToolBar::OnlyOne:
0
1689 paintLeftBorder = false;-
1690 break;
never executed: break;
0
1691 default:
never executed: default:
0
1692 break;
never executed: break;
0
1693 }-
1694 break;
never executed: break;
0
1695 default:
never executed: default:
0
1696 break;
never executed: break;
0
1697 }-
1698-
1699-
1700 //draw top border-
1701 p->setPen(QPen(opt->palette.light().color()));-
1702 p->drawLine(rect.topLeft().x(),-
1703 rect.topLeft().y(),-
1704 rect.topRight().x(),-
1705 rect.topRight().y());-
1706-
1707 if (paintLeftBorder){
paintLeftBorderDescription
TRUEnever evaluated
FALSEnever evaluated
0
1708 p->setPen(QPen(opt->palette.light().color()));-
1709 p->drawLine(rect.topLeft().x(),-
1710 rect.topLeft().y(),-
1711 rect.bottomLeft().x(),-
1712 rect.bottomLeft().y());-
1713 }
never executed: end of block
0
1714-
1715 if (paintRightBorder){
paintRightBorderDescription
TRUEnever evaluated
FALSEnever evaluated
0
1716 p->setPen(QPen(opt->palette.dark().color()));-
1717 p->drawLine(rect.topRight().x(),-
1718 rect.topRight().y(),-
1719 rect.bottomRight().x(),-
1720 rect.bottomRight().y());-
1721 }
never executed: end of block
0
1722-
1723 if (paintBottomBorder){
paintBottomBorderDescription
TRUEnever evaluated
FALSEnever evaluated
0
1724 p->setPen(QPen(opt->palette.dark().color()));-
1725 p->drawLine(rect.bottomLeft().x(),-
1726 rect.bottomLeft().y(),-
1727 rect.bottomRight().x(),-
1728 rect.bottomRight().y());-
1729 }
never executed: end of block
0
1730 }
never executed: end of block
0
1731 break;
never executed: break;
0
1732-
1733-
1734#endif // QT_NO_TOOLBAR-
1735-
1736 case CE_ProgressBarContents:
never executed: case CE_ProgressBarContents:
0
1737 if (const QStyleOptionProgressBar *pb = qstyleoption_cast<const QStyleOptionProgressBar *>(opt)) {
const QStyleOp...essBar *>(opt)Description
TRUEnever evaluated
FALSEnever evaluated
0
1738 QRect rect = pb->rect;-
1739 if (!rect.isValid())
!rect.isValid()Description
TRUEnever evaluated
FALSEnever evaluated
0
1740 return;
never executed: return;
0
1741-
1742 const bool vertical = pb->orientation == Qt::Vertical;-
1743 const bool inverted = pb->invertedAppearance;-
1744-
1745 QMatrix m;-
1746 if (vertical) {
verticalDescription
TRUEnever evaluated
FALSEnever evaluated
0
1747 rect = QRect(rect.y(), rect.x(), rect.height(), rect.width()); // flip width and height-
1748 m.rotate(90);-
1749 m.translate(0, -(rect.height() + rect.y()*2));-
1750 }
never executed: end of block
0
1751 QPalette pal2 = pb->palette;-
1752 // Correct the highlight color if it is the same as the background-
1753 if (pal2.highlight() == pal2.background())
pal2.highlight...2.background()Description
TRUEnever evaluated
FALSEnever evaluated
0
1754 pal2.setColor(QPalette::Highlight, pb->palette.color(QPalette::Active,
never executed: pal2.setColor(QPalette::Highlight, pb->palette.color(QPalette::Active, QPalette::Highlight));
0
1755 QPalette::Highlight));
never executed: pal2.setColor(QPalette::Highlight, pb->palette.color(QPalette::Active, QPalette::Highlight));
0
1756 bool reverse = ((!vertical && (pb->direction == Qt::RightToLeft)) || vertical);
!verticalDescription
TRUEnever evaluated
FALSEnever evaluated
(pb->direction...::RightToLeft)Description
TRUEnever evaluated
FALSEnever evaluated
verticalDescription
TRUEnever evaluated
FALSEnever evaluated
0
1757 if (inverted)
invertedDescription
TRUEnever evaluated
FALSEnever evaluated
0
1758 reverse = !reverse;
never executed: reverse = !reverse;
0
1759 int w = rect.width();-
1760 Q_D(const QWindowsStyle);-
1761 if (pb->minimum == 0 && pb->maximum == 0) {
pb->minimum == 0Description
TRUEnever evaluated
FALSEnever evaluated
pb->maximum == 0Description
TRUEnever evaluated
FALSEnever evaluated
0
1762 const int unit_width = proxy()->pixelMetric(PM_ProgressBarChunkWidth, pb, widget);-
1763 QStyleOptionProgressBar pbBits = *pb;-
1764 Q_ASSERT(unit_width >0);-
1765-
1766 pbBits.rect = rect;-
1767 pbBits.palette = pal2;-
1768-
1769 int step = 0;-
1770 int chunkCount = w / unit_width + 1;-
1771 if (QProgressStyleAnimation *animation = qobject_cast<QProgressStyleAnimation*>(d->animation(opt->styleObject)))
QProgressStyle...>styleObject))Description
TRUEnever evaluated
FALSEnever evaluated
0
1772 step = (animation->animationStep() / 3) % chunkCount;
never executed: step = (animation->animationStep() / 3) % chunkCount;
0
1773 else-
1774 d->startAnimation(new QProgressStyleAnimation(d->animationFps, opt->styleObject));
never executed: d->startAnimation(new QProgressStyleAnimation(d->animationFps, opt->styleObject));
0
1775 int chunksInRow = 5;-
1776 int myY = pbBits.rect.y();-
1777 int myHeight = pbBits.rect.height();-
1778 int chunksToDraw = chunksInRow;-
1779-
1780 if(step > chunkCount - 5)chunksToDraw = (chunkCount - step);
never executed: chunksToDraw = (chunkCount - step);
step > chunkCount - 5Description
TRUEnever evaluated
FALSEnever evaluated
0
1781 p->save();-
1782 p->setClipRect(m.mapRect(QRectF(rect)).toRect());-
1783-
1784 int x0 = reverse ? rect.left() + rect.width() - unit_width*(step) - unit_width : rect.left() + unit_width * step;
reverseDescription
TRUEnever evaluated
FALSEnever evaluated
0
1785 int x = 0;-
1786-
1787 for (int i = 0; i < chunksToDraw ; ++i) {
i < chunksToDrawDescription
TRUEnever evaluated
FALSEnever evaluated
0
1788 pbBits.rect.setRect(x0 + x, myY, unit_width, myHeight);-
1789 pbBits.rect = m.mapRect(QRectF(pbBits.rect)).toRect();-
1790 proxy()->drawPrimitive(PE_IndicatorProgressChunk, &pbBits, p, widget);-
1791 x += reverse ? -unit_width : unit_width;
reverseDescription
TRUEnever evaluated
FALSEnever evaluated
0
1792 }
never executed: end of block
0
1793 //Draw wrap-around chunks-
1794 if( step > chunkCount-5){
step > chunkCount-5Description
TRUEnever evaluated
FALSEnever evaluated
0
1795 x0 = reverse ? rect.left() + rect.width() - unit_width : rect.left() ;
reverseDescription
TRUEnever evaluated
FALSEnever evaluated
0
1796 x = 0;-
1797 int chunksToDraw = step - (chunkCount - chunksInRow);-
1798 for (int i = 0; i < chunksToDraw ; ++i) {
i < chunksToDrawDescription
TRUEnever evaluated
FALSEnever evaluated
0
1799 pbBits.rect.setRect(x0 + x, myY, unit_width, myHeight);-
1800 pbBits.rect = m.mapRect(QRectF(pbBits.rect)).toRect();-
1801 proxy()->drawPrimitive(PE_IndicatorProgressChunk, &pbBits, p, widget);-
1802 x += reverse ? -unit_width : unit_width;
reverseDescription
TRUEnever evaluated
FALSEnever evaluated
0
1803 }
never executed: end of block
0
1804 }
never executed: end of block
0
1805 p->restore(); //restore state-
1806 }
never executed: end of block
0
1807 else {-
1808 d->stopAnimation(opt->styleObject);-
1809 QCommonStyle::drawControl(ce, opt, p, widget);-
1810 }
never executed: end of block
0
1811 }-
1812 break;
never executed: break;
0
1813-
1814#ifndef QT_NO_DOCKWIDGET-
1815 case CE_DockWidgetTitle:
never executed: case CE_DockWidgetTitle:
0
1816-
1817 if (const QStyleOptionDockWidget *dwOpt = qstyleoption_cast<const QStyleOptionDockWidget *>(opt)) {
const QStyleOp...Widget *>(opt)Description
TRUEnever evaluated
FALSEnever evaluated
0
1818 Q_D(const QWindowsStyle);-
1819-
1820 const bool verticalTitleBar = dwOpt->verticalTitleBar;-
1821-
1822 QRect rect = dwOpt->rect;-
1823 QRect r = rect;-
1824-
1825 if (verticalTitleBar) {
verticalTitleBarDescription
TRUEnever evaluated
FALSEnever evaluated
0
1826 r = r.transposed();-
1827-
1828 p->save();-
1829 p->translate(r.left(), r.top() + r.width());-
1830 p->rotate(-90);-
1831 p->translate(-r.left(), -r.top());-
1832 }
never executed: end of block
0
1833-
1834 bool floating = false;-
1835 bool active = dwOpt->state & State_Active;-
1836 QColor inactiveCaptionTextColor = d->inactiveCaptionText;-
1837 if (dwOpt->movable) {
dwOpt->movableDescription
TRUEnever evaluated
FALSEnever evaluated
0
1838 QColor left, right;-
1839-
1840 //Titlebar gradient-
1841 if (opt->state & QStyle::State_Window) {
opt->state & Q...::State_WindowDescription
TRUEnever evaluated
FALSEnever evaluated
0
1842 floating = true;-
1843 if (active) {
activeDescription
TRUEnever evaluated
FALSEnever evaluated
0
1844 left = d->activeCaptionColor;-
1845 right = d->activeGradientCaptionColor;-
1846 } else {
never executed: end of block
0
1847 left = d->inactiveCaptionColor;-
1848 right = d->inactiveGradientCaptionColor;-
1849 }
never executed: end of block
0
1850 QBrush fillBrush(left);-
1851 if (left != right) {
left != rightDescription
TRUEnever evaluated
FALSEnever evaluated
0
1852 QPoint p1(r.x(), r.top() + r.height()/2);-
1853 QPoint p2(rect.right(), r.top() + r.height()/2);-
1854 QLinearGradient lg(p1, p2);-
1855 lg.setColorAt(0, left);-
1856 lg.setColorAt(1, right);-
1857 fillBrush = lg;-
1858 }
never executed: end of block
0
1859 p->fillRect(r.adjusted(0, 0, 0, -3), fillBrush);-
1860 }
never executed: end of block
0
1861 }
never executed: end of block
0
1862 if (!dwOpt->title.isEmpty()) {
!dwOpt->title.isEmpty()Description
TRUEnever evaluated
FALSEnever evaluated
0
1863 QFont oldFont = p->font();-
1864 if (floating) {
floatingDescription
TRUEnever evaluated
FALSEnever evaluated
0
1865 QFont font = oldFont;-
1866 font.setBold(true);-
1867 p->setFont(font);-
1868 }
never executed: end of block
0
1869 QPalette palette = dwOpt->palette;-
1870 palette.setColor(QPalette::Window, inactiveCaptionTextColor);-
1871 QRect titleRect = subElementRect(SE_DockWidgetTitleBarText, opt, widget);-
1872 if (verticalTitleBar) {
verticalTitleBarDescription
TRUEnever evaluated
FALSEnever evaluated
0
1873 titleRect = QRect(r.left() + rect.bottom()-
1874 - titleRect.bottom(),-
1875 r.top() + titleRect.left() - rect.left(),-
1876 titleRect.height(), titleRect.width());-
1877 }
never executed: end of block
0
1878 proxy()->drawItemText(p, titleRect,-
1879 Qt::AlignLeft | Qt::AlignVCenter | Qt::TextShowMnemonic, palette,-
1880 dwOpt->state & State_Enabled, dwOpt->title,-
1881 floating ? (active ? QPalette::BrightText : QPalette::Window) : QPalette::WindowText);-
1882 p->setFont(oldFont);-
1883 }
never executed: end of block
0
1884 if (verticalTitleBar)
verticalTitleBarDescription
TRUEnever evaluated
FALSEnever evaluated
0
1885 p->restore();
never executed: p->restore();
0
1886 }
never executed: end of block
0
1887 return;
never executed: return;
0
1888#endif // QT_NO_DOCKWIDGET-
1889#ifndef QT_NO_COMBOBOX-
1890 case CE_ComboBoxLabel:
never executed: case CE_ComboBoxLabel:
0
1891 if (const QStyleOptionComboBox *cb = qstyleoption_cast<const QStyleOptionComboBox *>(opt)) {
const QStyleOp...mboBox *>(opt)Description
TRUEnever evaluated
FALSEnever evaluated
0
1892 if (cb->state & State_HasFocus) {
cb->state & State_HasFocusDescription
TRUEnever evaluated
FALSEnever evaluated
0
1893 p->setPen(cb->palette.highlightedText().color());-
1894 p->setBackground(cb->palette.highlight());-
1895 } else {
never executed: end of block
0
1896 p->setPen(cb->palette.text().color());-
1897 p->setBackground(cb->palette.background());-
1898 }
never executed: end of block
0
1899 }-
1900 QCommonStyle::drawControl(ce, opt, p, widget);-
1901 break;
never executed: break;
0
1902#endif // QT_NO_COMBOBOX-
1903 default:
never executed: default:
0
1904 QCommonStyle::drawControl(ce, opt, p, widget);-
1905 }
never executed: end of block
0
1906}-
1907-
1908/*! \reimp */-
1909QRect QWindowsStyle::subElementRect(SubElement sr, const QStyleOption *opt, const QWidget *w) const-
1910{-
1911 QRect r;-
1912 switch (sr) {-
1913 case SE_SliderFocusRect:
never executed: case SE_SliderFocusRect:
0
1914 case SE_ToolBoxTabContents:
never executed: case SE_ToolBoxTabContents:
0
1915 r = visualRect(opt->direction, opt->rect, opt->rect);-
1916 break;
never executed: break;
0
1917 case SE_DockWidgetTitleBarText: {
never executed: case SE_DockWidgetTitleBarText:
0
1918 r = QCommonStyle::subElementRect(sr, opt, w);-
1919 const QStyleOptionDockWidget *dwOpt-
1920 = qstyleoption_cast<const QStyleOptionDockWidget*>(opt);-
1921 const bool verticalTitleBar = dwOpt && dwOpt->verticalTitleBar;
dwOptDescription
TRUEnever evaluated
FALSEnever evaluated
dwOpt->verticalTitleBarDescription
TRUEnever evaluated
FALSEnever evaluated
0
1922 int m = proxy()->pixelMetric(PM_DockWidgetTitleMargin, opt, w);-
1923 if (verticalTitleBar) {
verticalTitleBarDescription
TRUEnever evaluated
FALSEnever evaluated
0
1924 r.adjust(0, 0, 0, -m);-
1925 } else {
never executed: end of block
0
1926 if (opt->direction == Qt::LeftToRight)
opt->direction...t::LeftToRightDescription
TRUEnever evaluated
FALSEnever evaluated
0
1927 r.adjust(m, 0, 0, 0);
never executed: r.adjust(m, 0, 0, 0);
0
1928 else-
1929 r.adjust(0, 0, -m, 0);
never executed: r.adjust(0, 0, -m, 0);
0
1930 }-
1931 break;
never executed: break;
0
1932 }-
1933 case SE_ProgressBarContents:
never executed: case SE_ProgressBarContents:
0
1934 r = QCommonStyle::subElementRect(SE_ProgressBarGroove, opt, w);-
1935 r.adjust(3, 3, -3, -3);-
1936 break;
never executed: break;
0
1937 default:
never executed: default:
0
1938 r = QCommonStyle::subElementRect(sr, opt, w);-
1939 }
never executed: end of block
0
1940 return r;
never executed: return r;
0
1941}-
1942-
1943-
1944/*! \reimp */-
1945void QWindowsStyle::drawComplexControl(ComplexControl cc, const QStyleOptionComplex *opt,-
1946 QPainter *p, const QWidget *widget) const-
1947{-
1948 switch (cc) {-
1949#ifndef QT_NO_SLIDER-
1950 case CC_Slider:
never executed: case CC_Slider:
0
1951 if (const QStyleOptionSlider *slider = qstyleoption_cast<const QStyleOptionSlider *>(opt)) {
const QStyleOp...Slider *>(opt)Description
TRUEnever evaluated
FALSEnever evaluated
0
1952 int thickness = proxy()->pixelMetric(PM_SliderControlThickness, slider, widget);-
1953 int len = proxy()->pixelMetric(PM_SliderLength, slider, widget);-
1954 int ticks = slider->tickPosition;-
1955 QRect groove = proxy()->subControlRect(CC_Slider, slider, SC_SliderGroove, widget);-
1956 QRect handle = proxy()->subControlRect(CC_Slider, slider, SC_SliderHandle, widget);-
1957-
1958 if ((slider->subControls & SC_SliderGroove) && groove.isValid()) {
(slider->subCo..._SliderGroove)Description
TRUEnever evaluated
FALSEnever evaluated
groove.isValid()Description
TRUEnever evaluated
FALSEnever evaluated
0
1959 int mid = thickness / 2;-
1960-
1961 if (ticks & QSlider::TicksAbove)
ticks & QSlider::TicksAboveDescription
TRUEnever evaluated
FALSEnever evaluated
0
1962 mid += len / 8;
never executed: mid += len / 8;
0
1963 if (ticks & QSlider::TicksBelow)
ticks & QSlider::TicksBelowDescription
TRUEnever evaluated
FALSEnever evaluated
0
1964 mid -= len / 8;
never executed: mid -= len / 8;
0
1965-
1966 p->setPen(slider->palette.shadow().color());-
1967 if (slider->orientation == Qt::Horizontal) {
slider->orient...Qt::HorizontalDescription
TRUEnever evaluated
FALSEnever evaluated
0
1968 qDrawWinPanel(p, groove.x(), groove.y() + mid - 2,-
1969 groove.width(), 4, slider->palette, true);-
1970 p->drawLine(groove.x() + 1, groove.y() + mid - 1,-
1971 groove.x() + groove.width() - 3, groove.y() + mid - 1);-
1972 } else {
never executed: end of block
0
1973 qDrawWinPanel(p, groove.x() + mid - 2, groove.y(),-
1974 4, groove.height(), slider->palette, true);-
1975 p->drawLine(groove.x() + mid - 1, groove.y() + 1,-
1976 groove.x() + mid - 1, groove.y() + groove.height() - 3);-
1977 }
never executed: end of block
0
1978 }-
1979-
1980 if (slider->subControls & SC_SliderTickmarks) {
slider->subCon...liderTickmarksDescription
TRUEnever evaluated
FALSEnever evaluated
0
1981 QStyleOptionSlider tmpSlider = *slider;-
1982 tmpSlider.subControls = SC_SliderTickmarks;-
1983 QCommonStyle::drawComplexControl(cc, &tmpSlider, p, widget);-
1984 }
never executed: end of block
0
1985-
1986 if (slider->subControls & SC_SliderHandle) {
slider->subCon...C_SliderHandleDescription
TRUEnever evaluated
FALSEnever evaluated
0
1987 // 4444440-
1988 // 4333310-
1989 // 4322210-
1990 // 4322210-
1991 // 4322210-
1992 // 4322210-
1993 // *43210*-
1994 // **410**-
1995 // ***0***-
1996 const QColor c0 = slider->palette.shadow().color();-
1997 const QColor c1 = slider->palette.dark().color();-
1998 // const QColor c2 = g.button();-
1999 const QColor c3 = slider->palette.midlight().color();-
2000 const QColor c4 = slider->palette.light().color();-
2001 QBrush handleBrush;-
2002-
2003 if (slider->state & State_Enabled) {
slider->state & State_EnabledDescription
TRUEnever evaluated
FALSEnever evaluated
0
2004 handleBrush = slider->palette.color(QPalette::Button);-
2005 } else {
never executed: end of block
0
2006 handleBrush = QBrush(slider->palette.color(QPalette::Button),-
2007 Qt::Dense4Pattern);-
2008 }
never executed: end of block
0
2009-
2010-
2011 int x = handle.x(), y = handle.y(),-
2012 wi = handle.width(), he = handle.height();-
2013-
2014 int x1 = x;-
2015 int x2 = x+wi-1;-
2016 int y1 = y;-
2017 int y2 = y+he-1;-
2018-
2019 Qt::Orientation orient = slider->orientation;-
2020 bool tickAbove = slider->tickPosition == QSlider::TicksAbove;-
2021 bool tickBelow = slider->tickPosition == QSlider::TicksBelow;-
2022-
2023 if (slider->state & State_HasFocus) {
slider->state & State_HasFocusDescription
TRUEnever evaluated
FALSEnever evaluated
0
2024 QStyleOptionFocusRect fropt;-
2025 fropt.QStyleOption::operator=(*slider);-
2026 fropt.rect = subElementRect(SE_SliderFocusRect, slider, widget);-
2027 proxy()->drawPrimitive(PE_FrameFocusRect, &fropt, p, widget);-
2028 }
never executed: end of block
0
2029-
2030 if ((tickAbove && tickBelow) || (!tickAbove && !tickBelow)) {
tickAboveDescription
TRUEnever evaluated
FALSEnever evaluated
tickBelowDescription
TRUEnever evaluated
FALSEnever evaluated
!tickAboveDescription
TRUEnever evaluated
FALSEnever evaluated
!tickBelowDescription
TRUEnever evaluated
FALSEnever evaluated
0
2031 Qt::BGMode oldMode = p->backgroundMode();-
2032 p->setBackgroundMode(Qt::OpaqueMode);-
2033 qDrawWinButton(p, QRect(x, y, wi, he), slider->palette, false,-
2034 &handleBrush);-
2035 p->setBackgroundMode(oldMode);-
2036 return;
never executed: return;
0
2037 }-
2038-
2039 QSliderDirection dir;-
2040-
2041 if (orient == Qt::Horizontal)
orient == Qt::HorizontalDescription
TRUEnever evaluated
FALSEnever evaluated
0
2042 if (tickAbove)
tickAboveDescription
TRUEnever evaluated
FALSEnever evaluated
0
2043 dir = SlUp;
never executed: dir = SlUp;
0
2044 else-
2045 dir = SlDown;
never executed: dir = SlDown;
0
2046 else-
2047 if (tickAbove)
tickAboveDescription
TRUEnever evaluated
FALSEnever evaluated
0
2048 dir = SlLeft;
never executed: dir = SlLeft;
0
2049 else-
2050 dir = SlRight;
never executed: dir = SlRight;
0
2051-
2052 QPolygon a;-
2053-
2054 int d = 0;-
2055 switch (dir) {-
2056 case SlUp:
never executed: case SlUp:
0
2057 y1 = y1 + wi/2;-
2058 d = (wi + 1) / 2 - 1;-
2059 a.setPoints(5, x1,y1, x1,y2, x2,y2, x2,y1, x1+d,y1-d);-
2060 break;
never executed: break;
0
2061 case SlDown:
never executed: case SlDown:
0
2062 y2 = y2 - wi/2;-
2063 d = (wi + 1) / 2 - 1;-
2064 a.setPoints(5, x1,y1, x1,y2, x1+d,y2+d, x2,y2, x2,y1);-
2065 break;
never executed: break;
0
2066 case SlLeft:
never executed: case SlLeft:
0
2067 d = (he + 1) / 2 - 1;-
2068 x1 = x1 + he/2;-
2069 a.setPoints(5, x1,y1, x1-d,y1+d, x1,y2, x2,y2, x2,y1);-
2070 break;
never executed: break;
0
2071 case SlRight:
never executed: case SlRight:
0
2072 d = (he + 1) / 2 - 1;-
2073 x2 = x2 - he/2;-
2074 a.setPoints(5, x1,y1, x1,y2, x2,y2, x2+d,y1+d, x2,y1);-
2075 break;
never executed: break;
0
2076 }-
2077-
2078 QBrush oldBrush = p->brush();-
2079 bool oldQt4CompatiblePainting = p->testRenderHint(QPainter::Qt4CompatiblePainting);-
2080 p->setPen(Qt::NoPen);-
2081 p->setBrush(handleBrush);-
2082 p->setRenderHint(QPainter::Qt4CompatiblePainting);-
2083 Qt::BGMode oldMode = p->backgroundMode();-
2084 p->setBackgroundMode(Qt::OpaqueMode);-
2085 p->drawRect(x1, y1, x2-x1+1, y2-y1+1);-
2086 p->drawPolygon(a);-
2087 p->setBrush(oldBrush);-
2088 p->setBackgroundMode(oldMode);-
2089-
2090 if (dir != SlUp) {
dir != SlUpDescription
TRUEnever evaluated
FALSEnever evaluated
0
2091 p->setPen(c4);-
2092 p->drawLine(x1, y1, x2, y1);-
2093 p->setPen(c3);-
2094 p->drawLine(x1, y1+1, x2, y1+1);-
2095 }
never executed: end of block
0
2096 if (dir != SlLeft) {
dir != SlLeftDescription
TRUEnever evaluated
FALSEnever evaluated
0
2097 p->setPen(c3);-
2098 p->drawLine(x1+1, y1+1, x1+1, y2);-
2099 p->setPen(c4);-
2100 p->drawLine(x1, y1, x1, y2);-
2101 }
never executed: end of block
0
2102 if (dir != SlRight) {
dir != SlRightDescription
TRUEnever evaluated
FALSEnever evaluated
0
2103 p->setPen(c0);-
2104 p->drawLine(x2, y1, x2, y2);-
2105 p->setPen(c1);-
2106 p->drawLine(x2-1, y1+1, x2-1, y2-1);-
2107 }
never executed: end of block
0
2108 if (dir != SlDown) {
dir != SlDownDescription
TRUEnever evaluated
FALSEnever evaluated
0
2109 p->setPen(c0);-
2110 p->drawLine(x1, y2, x2, y2);-
2111 p->setPen(c1);-
2112 p->drawLine(x1+1, y2-1, x2-1, y2-1);-
2113 }
never executed: end of block
0
2114-
2115 switch (dir) {-
2116 case SlUp:
never executed: case SlUp:
0
2117 p->setPen(c4);-
2118 p->drawLine(x1, y1, x1+d, y1-d);-
2119 p->setPen(c0);-
2120 d = wi - d - 1;-
2121 p->drawLine(x2, y1, x2-d, y1-d);-
2122 d--;-
2123 p->setPen(c3);-
2124 p->drawLine(x1+1, y1, x1+1+d, y1-d);-
2125 p->setPen(c1);-
2126 p->drawLine(x2-1, y1, x2-1-d, y1-d);-
2127 break;
never executed: break;
0
2128 case SlDown:
never executed: case SlDown:
0
2129 p->setPen(c4);-
2130 p->drawLine(x1, y2, x1+d, y2+d);-
2131 p->setPen(c0);-
2132 d = wi - d - 1;-
2133 p->drawLine(x2, y2, x2-d, y2+d);-
2134 d--;-
2135 p->setPen(c3);-
2136 p->drawLine(x1+1, y2, x1+1+d, y2+d);-
2137 p->setPen(c1);-
2138 p->drawLine(x2-1, y2, x2-1-d, y2+d);-
2139 break;
never executed: break;
0
2140 case SlLeft:
never executed: case SlLeft:
0
2141 p->setPen(c4);-
2142 p->drawLine(x1, y1, x1-d, y1+d);-
2143 p->setPen(c0);-
2144 d = he - d - 1;-
2145 p->drawLine(x1, y2, x1-d, y2-d);-
2146 d--;-
2147 p->setPen(c3);-
2148 p->drawLine(x1, y1+1, x1-d, y1+1+d);-
2149 p->setPen(c1);-
2150 p->drawLine(x1, y2-1, x1-d, y2-1-d);-
2151 break;
never executed: break;
0
2152 case SlRight:
never executed: case SlRight:
0
2153 p->setPen(c4);-
2154 p->drawLine(x2, y1, x2+d, y1+d);-
2155 p->setPen(c0);-
2156 d = he - d - 1;-
2157 p->drawLine(x2, y2, x2+d, y2-d);-
2158 d--;-
2159 p->setPen(c3);-
2160 p->drawLine(x2, y1+1, x2+d, y1+1+d);-
2161 p->setPen(c1);-
2162 p->drawLine(x2, y2-1, x2+d, y2-1-d);-
2163 break;
never executed: break;
0
2164 }-
2165 p->setRenderHint(QPainter::Qt4CompatiblePainting, oldQt4CompatiblePainting);-
2166 }
never executed: end of block
0
2167 }
never executed: end of block
0
2168 break;
never executed: break;
0
2169#endif // QT_NO_SLIDER-
2170#ifndef QT_NO_SCROLLBAR-
2171 case CC_ScrollBar:
never executed: case CC_ScrollBar:
0
2172 if (const QStyleOptionSlider *scrollbar = qstyleoption_cast<const QStyleOptionSlider *>(opt)) {
const QStyleOp...Slider *>(opt)Description
TRUEnever evaluated
FALSEnever evaluated
0
2173 QStyleOptionSlider newScrollbar = *scrollbar;-
2174 if (scrollbar->minimum == scrollbar->maximum)
scrollbar->min...llbar->maximumDescription
TRUEnever evaluated
FALSEnever evaluated
0
2175 newScrollbar.state &= ~State_Enabled; //do not draw the slider.
never executed: newScrollbar.state &= ~State_Enabled;
0
2176 QCommonStyle::drawComplexControl(cc, &newScrollbar, p, widget);-
2177 }
never executed: end of block
0
2178 break;
never executed: break;
0
2179#endif // QT_NO_SCROLLBAR-
2180#ifndef QT_NO_COMBOBOX-
2181 case CC_ComboBox:
never executed: case CC_ComboBox:
0
2182 if (const QStyleOptionComboBox *cmb = qstyleoption_cast<const QStyleOptionComboBox *>(opt)) {
const QStyleOp...mboBox *>(opt)Description
TRUEnever evaluated
FALSEnever evaluated
0
2183 QBrush editBrush = cmb->palette.brush(QPalette::Base);-
2184 if ((cmb->subControls & SC_ComboBoxFrame)) {
(cmb->subContr...ComboBoxFrame)Description
TRUEnever evaluated
FALSEnever evaluated
0
2185 if (cmb->frame) {
cmb->frameDescription
TRUEnever evaluated
FALSEnever evaluated
0
2186 QPalette shadePal = opt->palette;-
2187 shadePal.setColor(QPalette::Midlight, shadePal.button().color());-
2188 qDrawWinPanel(p, opt->rect, shadePal, true, &editBrush);-
2189 }
never executed: end of block
0
2190 else {-
2191 p->fillRect(opt->rect, editBrush);-
2192 }
never executed: end of block
0
2193 }-
2194 if (cmb->subControls & SC_ComboBoxArrow) {
cmb->subContro..._ComboBoxArrowDescription
TRUEnever evaluated
FALSEnever evaluated
0
2195 State flags = State_None;-
2196-
2197 QRect ar = proxy()->subControlRect(CC_ComboBox, cmb, SC_ComboBoxArrow, widget);-
2198 bool sunkenArrow = cmb->activeSubControls == SC_ComboBoxArrow
cmb->activeSub..._ComboBoxArrowDescription
TRUEnever evaluated
FALSEnever evaluated
0
2199 && cmb->state & State_Sunken;
cmb->state & State_SunkenDescription
TRUEnever evaluated
FALSEnever evaluated
0
2200 if (sunkenArrow) {
sunkenArrowDescription
TRUEnever evaluated
FALSEnever evaluated
0
2201 p->setPen(cmb->palette.dark().color());-
2202 p->setBrush(cmb->palette.brush(QPalette::Button));-
2203 p->drawRect(ar.adjusted(0,0,-1,-1));-
2204 } else {
never executed: end of block
0
2205 // Make qDrawWinButton use the right colors for drawing the shade of the button-
2206 QPalette pal(cmb->palette);-
2207 pal.setColor(QPalette::Button, cmb->palette.light().color());-
2208 pal.setColor(QPalette::Light, cmb->palette.button().color());-
2209 qDrawWinButton(p, ar, pal, false,-
2210 &cmb->palette.brush(QPalette::Button));-
2211 }
never executed: end of block
0
2212-
2213 ar.adjust(2, 2, -2, -2);-
2214 if (opt->state & State_Enabled)
opt->state & State_EnabledDescription
TRUEnever evaluated
FALSEnever evaluated
0
2215 flags |= State_Enabled;
never executed: flags |= State_Enabled;
0
2216 if (opt->state & State_HasFocus)
opt->state & State_HasFocusDescription
TRUEnever evaluated
FALSEnever evaluated
0
2217 flags |= State_HasFocus;
never executed: flags |= State_HasFocus;
0
2218-
2219 if (sunkenArrow)
sunkenArrowDescription
TRUEnever evaluated
FALSEnever evaluated
0
2220 flags |= State_Sunken;
never executed: flags |= State_Sunken;
0
2221 QStyleOption arrowOpt = *cmb;-
2222 arrowOpt.rect = ar.adjusted(1, 1, -1, -1);-
2223 arrowOpt.state = flags;-
2224 proxy()->drawPrimitive(PE_IndicatorArrowDown, &arrowOpt, p, widget);-
2225 }
never executed: end of block
0
2226-
2227 if (cmb->subControls & SC_ComboBoxEditField) {
cmb->subContro...boBoxEditFieldDescription
TRUEnever evaluated
FALSEnever evaluated
0
2228 QRect re = proxy()->subControlRect(CC_ComboBox, cmb, SC_ComboBoxEditField, widget);-
2229 if (cmb->state & State_HasFocus && !cmb->editable)
cmb->state & State_HasFocusDescription
TRUEnever evaluated
FALSEnever evaluated
!cmb->editableDescription
TRUEnever evaluated
FALSEnever evaluated
0
2230 p->fillRect(re.x(), re.y(), re.width(), re.height(),
never executed: p->fillRect(re.x(), re.y(), re.width(), re.height(), cmb->palette.brush(QPalette::Highlight));
0
2231 cmb->palette.brush(QPalette::Highlight));
never executed: p->fillRect(re.x(), re.y(), re.width(), re.height(), cmb->palette.brush(QPalette::Highlight));
0
2232-
2233 if (cmb->state & State_HasFocus) {
cmb->state & State_HasFocusDescription
TRUEnever evaluated
FALSEnever evaluated
0
2234 p->setPen(cmb->palette.highlightedText().color());-
2235 p->setBackground(cmb->palette.highlight());-
2236-
2237 } else {
never executed: end of block
0
2238 p->setPen(cmb->palette.text().color());-
2239 p->setBackground(cmb->palette.background());-
2240 }
never executed: end of block
0
2241-
2242 if (cmb->state & State_HasFocus && !cmb->editable) {
cmb->state & State_HasFocusDescription
TRUEnever evaluated
FALSEnever evaluated
!cmb->editableDescription
TRUEnever evaluated
FALSEnever evaluated
0
2243 QStyleOptionFocusRect focus;-
2244 focus.QStyleOption::operator=(*cmb);-
2245 focus.rect = subElementRect(SE_ComboBoxFocusRect, cmb, widget);-
2246 focus.state |= State_FocusAtBorder;-
2247 focus.backgroundColor = cmb->palette.highlight().color();-
2248 proxy()->drawPrimitive(PE_FrameFocusRect, &focus, p, widget);-
2249 }
never executed: end of block
0
2250 }
never executed: end of block
0
2251 }
never executed: end of block
0
2252 break;
never executed: break;
0
2253#endif // QT_NO_COMBOBOX-
2254#ifndef QT_NO_SPINBOX-
2255 case CC_SpinBox:
never executed: case CC_SpinBox:
0
2256 if (const QStyleOptionSpinBox *sb = qstyleoption_cast<const QStyleOptionSpinBox *>(opt)) {
const QStyleOp...pinBox *>(opt)Description
TRUEnever evaluated
FALSEnever evaluated
0
2257 QStyleOptionSpinBox copy = *sb;-
2258 PrimitiveElement pe;-
2259 bool enabled = opt->state & State_Enabled;-
2260 if (sb->frame && (sb->subControls & SC_SpinBoxFrame)) {
sb->frameDescription
TRUEnever evaluated
FALSEnever evaluated
(sb->subContro..._SpinBoxFrame)Description
TRUEnever evaluated
FALSEnever evaluated
0
2261 QBrush editBrush = sb->palette.brush(QPalette::Base);-
2262 QRect r = proxy()->subControlRect(CC_SpinBox, sb, SC_SpinBoxFrame, widget);-
2263 QPalette shadePal = sb->palette;-
2264 shadePal.setColor(QPalette::Midlight, shadePal.button().color());-
2265 qDrawWinPanel(p, r, shadePal, true, &editBrush);-
2266 }
never executed: end of block
0
2267-
2268 QPalette shadePal(opt->palette);-
2269 shadePal.setColor(QPalette::Button, opt->palette.light().color());-
2270 shadePal.setColor(QPalette::Light, opt->palette.button().color());-
2271-
2272 if (sb->subControls & SC_SpinBoxUp) {
sb->subControls & SC_SpinBoxUpDescription
TRUEnever evaluated
FALSEnever evaluated
0
2273 copy.subControls = SC_SpinBoxUp;-
2274 QPalette pal2 = sb->palette;-
2275 if (!(sb->stepEnabled & QAbstractSpinBox::StepUpEnabled)) {
!(sb->stepEnab...StepUpEnabled)Description
TRUEnever evaluated
FALSEnever evaluated
0
2276 pal2.setCurrentColorGroup(QPalette::Disabled);-
2277 copy.state &= ~State_Enabled;-
2278 }
never executed: end of block
0
2279-
2280 copy.palette = pal2;-
2281-
2282 if (sb->activeSubControls == SC_SpinBoxUp && (sb->state & State_Sunken)) {
sb->activeSubC...= SC_SpinBoxUpDescription
TRUEnever evaluated
FALSEnever evaluated
(sb->state & State_Sunken)Description
TRUEnever evaluated
FALSEnever evaluated
0
2283 copy.state |= State_On;-
2284 copy.state |= State_Sunken;-
2285 } else {
never executed: end of block
0
2286 copy.state |= State_Raised;-
2287 copy.state &= ~State_Sunken;-
2288 }
never executed: end of block
0
2289 pe = (sb->buttonSymbols == QAbstractSpinBox::PlusMinus ? PE_IndicatorSpinPlus
sb->buttonSymb...Box::PlusMinusDescription
TRUEnever evaluated
FALSEnever evaluated
0
2290 : PE_IndicatorSpinUp);-
2291-
2292 copy.rect = proxy()->subControlRect(CC_SpinBox, sb, SC_SpinBoxUp, widget);-
2293 qDrawWinButton(p, copy.rect, shadePal, copy.state & (State_Sunken | State_On),-
2294 &copy.palette.brush(QPalette::Button));-
2295 copy.rect.adjust(4, 1, -5, -1);-
2296 if ((!enabled || !(sb->stepEnabled & QAbstractSpinBox::StepUpEnabled))
!enabledDescription
TRUEnever evaluated
FALSEnever evaluated
!(sb->stepEnab...StepUpEnabled)Description
TRUEnever evaluated
FALSEnever evaluated
0
2297 && proxy()->styleHint(SH_EtchDisabledText, opt, widget) )
proxy()->style..., opt, widget)Description
TRUEnever evaluated
FALSEnever evaluated
0
2298 {-
2299 QStyleOptionSpinBox lightCopy = copy;-
2300 lightCopy.rect.adjust(1, 1, 1, 1);-
2301 lightCopy.palette.setBrush(QPalette::ButtonText, copy.palette.light());-
2302 proxy()->drawPrimitive(pe, &lightCopy, p, widget);-
2303 }
never executed: end of block
0
2304 proxy()->drawPrimitive(pe, &copy, p, widget);-
2305 }
never executed: end of block
0
2306-
2307 if (sb->subControls & SC_SpinBoxDown) {
sb->subControl...SC_SpinBoxDownDescription
TRUEnever evaluated
FALSEnever evaluated
0
2308 copy.subControls = SC_SpinBoxDown;-
2309 copy.state = sb->state;-
2310 QPalette pal2 = sb->palette;-
2311 if (!(sb->stepEnabled & QAbstractSpinBox::StepDownEnabled)) {
!(sb->stepEnab...epDownEnabled)Description
TRUEnever evaluated
FALSEnever evaluated
0
2312 pal2.setCurrentColorGroup(QPalette::Disabled);-
2313 copy.state &= ~State_Enabled;-
2314 }
never executed: end of block
0
2315 copy.palette = pal2;-
2316-
2317 if (sb->activeSubControls == SC_SpinBoxDown && (sb->state & State_Sunken)) {
sb->activeSubC...SC_SpinBoxDownDescription
TRUEnever evaluated
FALSEnever evaluated
(sb->state & State_Sunken)Description
TRUEnever evaluated
FALSEnever evaluated
0
2318 copy.state |= State_On;-
2319 copy.state |= State_Sunken;-
2320 } else {
never executed: end of block
0
2321 copy.state |= State_Raised;-
2322 copy.state &= ~State_Sunken;-
2323 }
never executed: end of block
0
2324 pe = (sb->buttonSymbols == QAbstractSpinBox::PlusMinus ? PE_IndicatorSpinMinus
sb->buttonSymb...Box::PlusMinusDescription
TRUEnever evaluated
FALSEnever evaluated
0
2325 : PE_IndicatorSpinDown);-
2326-
2327 copy.rect = proxy()->subControlRect(CC_SpinBox, sb, SC_SpinBoxDown, widget);-
2328 qDrawWinButton(p, copy.rect, shadePal, copy.state & (State_Sunken | State_On),-
2329 &copy.palette.brush(QPalette::Button));-
2330 copy.rect.adjust(4, 0, -5, -1);-
2331 if ((!enabled || !(sb->stepEnabled & QAbstractSpinBox::StepDownEnabled))
!enabledDescription
TRUEnever evaluated
FALSEnever evaluated
!(sb->stepEnab...epDownEnabled)Description
TRUEnever evaluated
FALSEnever evaluated
0
2332 && proxy()->styleHint(SH_EtchDisabledText, opt, widget) )
proxy()->style..., opt, widget)Description
TRUEnever evaluated
FALSEnever evaluated
0
2333 {-
2334 QStyleOptionSpinBox lightCopy = copy;-
2335 lightCopy.rect.adjust(1, 1, 1, 1);-
2336 lightCopy.palette.setBrush(QPalette::ButtonText, copy.palette.light());-
2337 proxy()->drawPrimitive(pe, &lightCopy, p, widget);-
2338 }
never executed: end of block
0
2339 proxy()->drawPrimitive(pe, &copy, p, widget);-
2340 }
never executed: end of block
0
2341 }
never executed: end of block
0
2342 break;
never executed: break;
0
2343#endif // QT_NO_SPINBOX-
2344-
2345 default:
never executed: default:
0
2346 QCommonStyle::drawComplexControl(cc, opt, p, widget);-
2347 }
never executed: end of block
0
2348}-
2349-
2350/*! \reimp */-
2351QSize QWindowsStyle::sizeFromContents(ContentsType ct, const QStyleOption *opt,-
2352 const QSize &csz, const QWidget *widget) const-
2353{-
2354 QSize sz(csz);-
2355 switch (ct) {-
2356 case CT_PushButton:
never executed: case CT_PushButton:
0
2357 if (const QStyleOptionButton *btn = qstyleoption_cast<const QStyleOptionButton *>(opt)) {
const QStyleOp...Button *>(opt)Description
TRUEnever evaluated
FALSEnever evaluated
0
2358 sz = QCommonStyle::sizeFromContents(ct, opt, csz, widget);-
2359 int w = sz.width(),-
2360 h = sz.height();-
2361 int defwidth = 0;-
2362 if (btn->features & QStyleOptionButton::AutoDefaultButton)
btn->features ...oDefaultButtonDescription
TRUEnever evaluated
FALSEnever evaluated
0
2363 defwidth = 2 * proxy()->pixelMetric(PM_ButtonDefaultIndicator, btn, widget);
never executed: defwidth = 2 * proxy()->pixelMetric(PM_ButtonDefaultIndicator, btn, widget);
0
2364 int minwidth = int(QStyleHelper::dpiScaled(75.));-
2365 int minheight = int(QStyleHelper::dpiScaled(23.));-
2366-
2367#ifndef QT_QWS_SMALL_PUSHBUTTON-
2368 if (w < minwidth + defwidth && !btn->text.isEmpty())
w < minwidth + defwidthDescription
TRUEnever evaluated
FALSEnever evaluated
!btn->text.isEmpty()Description
TRUEnever evaluated
FALSEnever evaluated
0
2369 w = minwidth + defwidth;
never executed: w = minwidth + defwidth;
0
2370 if (h < minheight + defwidth)
h < minheight + defwidthDescription
TRUEnever evaluated
FALSEnever evaluated
0
2371 h = minheight + defwidth;
never executed: h = minheight + defwidth;
0
2372#endif-
2373 sz = QSize(w, h);-
2374 }
never executed: end of block
0
2375 break;
never executed: break;
0
2376#ifndef QT_NO_MENU-
2377 case CT_MenuItem:
never executed: case CT_MenuItem:
0
2378 if (const QStyleOptionMenuItem *mi = qstyleoption_cast<const QStyleOptionMenuItem *>(opt)) {
const QStyleOp...nuItem *>(opt)Description
TRUEnever evaluated
FALSEnever evaluated
0
2379 int w = sz.width();-
2380 sz = QCommonStyle::sizeFromContents(ct, opt, csz, widget);-
2381-
2382 if (mi->menuItemType == QStyleOptionMenuItem::Separator) {
mi->menuItemTy...tem::SeparatorDescription
TRUEnever evaluated
FALSEnever evaluated
0
2383 sz = QSize(10, QWindowsStylePrivate::windowsSepHeight);-
2384 }
never executed: end of block
0
2385 else if (mi->icon.isNull()) {
mi->icon.isNull()Description
TRUEnever evaluated
FALSEnever evaluated
0
2386 sz.setHeight(sz.height() - 2);-
2387 w -= 6;-
2388 }
never executed: end of block
0
2389-
2390 if (mi->menuItemType != QStyleOptionMenuItem::Separator && !mi->icon.isNull()) {
mi->menuItemTy...tem::SeparatorDescription
TRUEnever evaluated
FALSEnever evaluated
!mi->icon.isNull()Description
TRUEnever evaluated
FALSEnever evaluated
0
2391 int iconExtent = proxy()->pixelMetric(PM_SmallIconSize, opt, widget);-
2392 sz.setHeight(qMax(sz.height(),-
2393 mi->icon.actualSize(QSize(iconExtent, iconExtent)).height()-
2394 + 2 * QWindowsStylePrivate::windowsItemFrame));-
2395 }
never executed: end of block
0
2396 int maxpmw = mi->maxIconWidth;-
2397 int tabSpacing = 20;-
2398 if (mi->text.contains(QLatin1Char('\t')))
mi->text.conta...in1Char('\t'))Description
TRUEnever evaluated
FALSEnever evaluated
0
2399 w += tabSpacing;
never executed: w += tabSpacing;
0
2400 else if (mi->menuItemType == QStyleOptionMenuItem::SubMenu)
mi->menuItemTy...uItem::SubMenuDescription
TRUEnever evaluated
FALSEnever evaluated
0
2401 w += 2 * QWindowsStylePrivate::windowsArrowHMargin;
never executed: w += 2 * QWindowsStylePrivate::windowsArrowHMargin;
0
2402 else if (mi->menuItemType == QStyleOptionMenuItem::DefaultItem) {
mi->menuItemTy...m::DefaultItemDescription
TRUEnever evaluated
FALSEnever evaluated
0
2403 // adjust the font and add the difference in size.-
2404 // it would be better if the font could be adjusted in the initStyleOption qmenu func!!-
2405 QFontMetrics fm(mi->font);-
2406 QFont fontBold = mi->font;-
2407 fontBold.setBold(true);-
2408 QFontMetrics fmBold(fontBold);-
2409 w += fmBold.width(mi->text) - fm.width(mi->text);-
2410 }
never executed: end of block
0
2411-
2412 int checkcol = qMax<int>(maxpmw, QWindowsStylePrivate::windowsCheckMarkWidth); // Windows always shows a check column-
2413 w += checkcol;-
2414 w += int(QWindowsStylePrivate::windowsRightBorder) + 10;-
2415 sz.setWidth(w);-
2416 }
never executed: end of block
0
2417 break;
never executed: break;
0
2418#endif // QT_NO_MENU-
2419#ifndef QT_NO_MENUBAR-
2420 case CT_MenuBarItem:
never executed: case CT_MenuBarItem:
0
2421 if (!sz.isEmpty())
!sz.isEmpty()Description
TRUEnever evaluated
FALSEnever evaluated
0
2422 sz += QSize(QWindowsStylePrivate::windowsItemHMargin * 4, QWindowsStylePrivate::windowsItemVMargin * 2);
never executed: sz += QSize(QWindowsStylePrivate::windowsItemHMargin * 4, QWindowsStylePrivate::windowsItemVMargin * 2);
0
2423 break;
never executed: break;
0
2424#endif-
2425 case CT_ToolButton:
never executed: case CT_ToolButton:
0
2426 if (qstyleoption_cast<const QStyleOptionToolButton *>(opt))
qstyleoption_c...Button *>(opt)Description
TRUEnever evaluated
FALSEnever evaluated
0
2427 return sz += QSize(7, 6);
never executed: return sz += QSize(7, 6);
0
2428 // Otherwise, fall through-
2429-
2430 default:
code before this statement never executed: default:
never executed: default:
0
2431 sz = QCommonStyle::sizeFromContents(ct, opt, csz, widget);-
2432 }
never executed: end of block
0
2433 return sz;
never executed: return sz;
0
2434}-
2435-
2436/*!-
2437 \reimp-
2438*/-
2439QIcon QWindowsStyle::standardIcon(StandardPixmap standardIcon, const QStyleOption *option,-
2440 const QWidget *widget) const-
2441{-
2442 return QCommonStyle::standardIcon(standardIcon, option, widget);
never executed: return QCommonStyle::standardIcon(standardIcon, option, widget);
0
2443}-
2444-
2445-
2446-
2447QT_END_NAMESPACE-
2448-
2449#include "moc_qwindowsstyle_p.cpp"-
2450-
2451#endif // QT_NO_STYLE_WINDOWS-
Source codeSwitch to Preprocessed file

Generated by Squish Coco Non-Commercial 4.3.0-BETA-master-30-08-2018-4cb69e9