| Absolute File Name: | /home/qt/qt5_coco/qt5/qtbase/src/widgets/styles/qstylesheetstyle.cpp |
| Source code | Switch to Preprocessed file |
| Line | Source | Count | ||||||||||||||||||||||||||||||
|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
| 1 | /**************************************************************************** | - | ||||||||||||||||||||||||||||||
| 2 | ** | - | ||||||||||||||||||||||||||||||
| 3 | ** Copyright (C) 2015 The Qt Company Ltd. | - | ||||||||||||||||||||||||||||||
| 4 | ** Contact: http://www.qt.io/licensing/ | - | ||||||||||||||||||||||||||||||
| 5 | ** | - | ||||||||||||||||||||||||||||||
| 6 | ** This file is part of the QtWidgets module of the Qt Toolkit. | - | ||||||||||||||||||||||||||||||
| 7 | ** | - | ||||||||||||||||||||||||||||||
| 8 | ** $QT_BEGIN_LICENSE:LGPL21$ | - | ||||||||||||||||||||||||||||||
| 9 | ** Commercial License Usage | - | ||||||||||||||||||||||||||||||
| 10 | ** Licensees holding valid commercial Qt licenses may use this file in | - | ||||||||||||||||||||||||||||||
| 11 | ** accordance with the commercial license agreement provided with the | - | ||||||||||||||||||||||||||||||
| 12 | ** Software or, alternatively, in accordance with the terms contained in | - | ||||||||||||||||||||||||||||||
| 13 | ** a written agreement between you and The Qt Company. For licensing terms | - | ||||||||||||||||||||||||||||||
| 14 | ** and conditions see http://www.qt.io/terms-conditions. For further | - | ||||||||||||||||||||||||||||||
| 15 | ** information use the contact form at http://www.qt.io/contact-us. | - | ||||||||||||||||||||||||||||||
| 16 | ** | - | ||||||||||||||||||||||||||||||
| 17 | ** GNU Lesser General Public License Usage | - | ||||||||||||||||||||||||||||||
| 18 | ** Alternatively, this file may be used under the terms of the GNU Lesser | - | ||||||||||||||||||||||||||||||
| 19 | ** General Public License version 2.1 or version 3 as published by the Free | - | ||||||||||||||||||||||||||||||
| 20 | ** Software Foundation and appearing in the file LICENSE.LGPLv21 and | - | ||||||||||||||||||||||||||||||
| 21 | ** LICENSE.LGPLv3 included in the packaging of this file. Please review the | - | ||||||||||||||||||||||||||||||
| 22 | ** following information to ensure the GNU Lesser General Public License | - | ||||||||||||||||||||||||||||||
| 23 | ** requirements will be met: https://www.gnu.org/licenses/lgpl.html and | - | ||||||||||||||||||||||||||||||
| 24 | ** http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. | - | ||||||||||||||||||||||||||||||
| 25 | ** | - | ||||||||||||||||||||||||||||||
| 26 | ** As a special exception, The Qt Company gives you certain additional | - | ||||||||||||||||||||||||||||||
| 27 | ** rights. These rights are described in The Qt Company LGPL Exception | - | ||||||||||||||||||||||||||||||
| 28 | ** version 1.1, included in the file LGPL_EXCEPTION.txt in this package. | - | ||||||||||||||||||||||||||||||
| 29 | ** | - | ||||||||||||||||||||||||||||||
| 30 | ** $QT_END_LICENSE$ | - | ||||||||||||||||||||||||||||||
| 31 | ** | - | ||||||||||||||||||||||||||||||
| 32 | ****************************************************************************/ | - | ||||||||||||||||||||||||||||||
| 33 | - | |||||||||||||||||||||||||||||||
| 34 | #include <qglobal.h> | - | ||||||||||||||||||||||||||||||
| 35 | - | |||||||||||||||||||||||||||||||
| 36 | #ifndef QT_NO_STYLE_STYLESHEET | - | ||||||||||||||||||||||||||||||
| 37 | - | |||||||||||||||||||||||||||||||
| 38 | #include "qstylesheetstyle_p.h" | - | ||||||||||||||||||||||||||||||
| 39 | #include "private/qcssutil_p.h" | - | ||||||||||||||||||||||||||||||
| 40 | #include <qdebug.h> | - | ||||||||||||||||||||||||||||||
| 41 | #include <qapplication.h> | - | ||||||||||||||||||||||||||||||
| 42 | #include <qmenu.h> | - | ||||||||||||||||||||||||||||||
| 43 | #include <qmenubar.h> | - | ||||||||||||||||||||||||||||||
| 44 | #include <qpainter.h> | - | ||||||||||||||||||||||||||||||
| 45 | #include <qstyleoption.h> | - | ||||||||||||||||||||||||||||||
| 46 | #include <qlineedit.h> | - | ||||||||||||||||||||||||||||||
| 47 | #include <private/qwindowsstyle_p.h> | - | ||||||||||||||||||||||||||||||
| 48 | #include <qcombobox.h> | - | ||||||||||||||||||||||||||||||
| 49 | #include "private/qcssparser_p.h" | - | ||||||||||||||||||||||||||||||
| 50 | #include "private/qmath_p.h" | - | ||||||||||||||||||||||||||||||
| 51 | #include <qabstractscrollarea.h> | - | ||||||||||||||||||||||||||||||
| 52 | #include "private/qabstractscrollarea_p.h" | - | ||||||||||||||||||||||||||||||
| 53 | #include <qtooltip.h> | - | ||||||||||||||||||||||||||||||
| 54 | #include <qshareddata.h> | - | ||||||||||||||||||||||||||||||
| 55 | #include <qradiobutton.h> | - | ||||||||||||||||||||||||||||||
| 56 | #include <qtoolbutton.h> | - | ||||||||||||||||||||||||||||||
| 57 | #include <qscrollbar.h> | - | ||||||||||||||||||||||||||||||
| 58 | #include <qstring.h> | - | ||||||||||||||||||||||||||||||
| 59 | #include <qfile.h> | - | ||||||||||||||||||||||||||||||
| 60 | #include <qcheckbox.h> | - | ||||||||||||||||||||||||||||||
| 61 | #include <qstatusbar.h> | - | ||||||||||||||||||||||||||||||
| 62 | #include <qheaderview.h> | - | ||||||||||||||||||||||||||||||
| 63 | #include <private/qwindowsstyle_p_p.h> | - | ||||||||||||||||||||||||||||||
| 64 | #include <private/qstyleanimation_p.h> | - | ||||||||||||||||||||||||||||||
| 65 | #include <qtabbar.h> | - | ||||||||||||||||||||||||||||||
| 66 | #include <QMetaProperty> | - | ||||||||||||||||||||||||||||||
| 67 | #include <qmainwindow.h> | - | ||||||||||||||||||||||||||||||
| 68 | #include <qdockwidget.h> | - | ||||||||||||||||||||||||||||||
| 69 | #include <qmdisubwindow.h> | - | ||||||||||||||||||||||||||||||
| 70 | #include <qdialog.h> | - | ||||||||||||||||||||||||||||||
| 71 | #include <private/qwidget_p.h> | - | ||||||||||||||||||||||||||||||
| 72 | #include <QAbstractSpinBox> | - | ||||||||||||||||||||||||||||||
| 73 | #include <QLabel> | - | ||||||||||||||||||||||||||||||
| 74 | #include "qdrawutil.h" | - | ||||||||||||||||||||||||||||||
| 75 | - | |||||||||||||||||||||||||||||||
| 76 | #include <limits.h> | - | ||||||||||||||||||||||||||||||
| 77 | #include <QtWidgets/qtoolbar.h> | - | ||||||||||||||||||||||||||||||
| 78 | - | |||||||||||||||||||||||||||||||
| 79 | QT_BEGIN_NAMESPACE | - | ||||||||||||||||||||||||||||||
| 80 | - | |||||||||||||||||||||||||||||||
| 81 | using namespace QCss; | - | ||||||||||||||||||||||||||||||
| 82 | - | |||||||||||||||||||||||||||||||
| 83 | - | |||||||||||||||||||||||||||||||
| 84 | class QStyleSheetStylePrivate : public QWindowsStylePrivate | - | ||||||||||||||||||||||||||||||
| 85 | { | - | ||||||||||||||||||||||||||||||
| 86 | Q_DECLARE_PUBLIC(QStyleSheetStyle) | - | ||||||||||||||||||||||||||||||
| 87 | public: | - | ||||||||||||||||||||||||||||||
| 88 | QStyleSheetStylePrivate() { } | - | ||||||||||||||||||||||||||||||
| 89 | }; | - | ||||||||||||||||||||||||||||||
| 90 | - | |||||||||||||||||||||||||||||||
| 91 | - | |||||||||||||||||||||||||||||||
| 92 | static QStyleSheetStyleCaches *styleSheetCaches = 0; | - | ||||||||||||||||||||||||||||||
| 93 | - | |||||||||||||||||||||||||||||||
| 94 | /* RECURSION_GUARD: | - | ||||||||||||||||||||||||||||||
| 95 | * the QStyleSheetStyle is a proxy. If used with others proxy style, we may end up with something like: | - | ||||||||||||||||||||||||||||||
| 96 | * QStyleSheetStyle -> ProxyStyle -> QStyleSheetStyle -> OriginalStyle | - | ||||||||||||||||||||||||||||||
| 97 | * Recursion may happen if the style call the widget()->style() again. | - | ||||||||||||||||||||||||||||||
| 98 | * Not to mention the performence penalty of having two lookup of rules. | - | ||||||||||||||||||||||||||||||
| 99 | * | - | ||||||||||||||||||||||||||||||
| 100 | * The first instance of QStyleSheetStyle will set globalStyleSheetStyle to itself. The second one | - | ||||||||||||||||||||||||||||||
| 101 | * will notice the globalStyleSheetStyle is not istelf and call its base style directly. | - | ||||||||||||||||||||||||||||||
| 102 | */ | - | ||||||||||||||||||||||||||||||
| 103 | static const QStyleSheetStyle *globalStyleSheetStyle = 0; | - | ||||||||||||||||||||||||||||||
| 104 | class QStyleSheetStyleRecursionGuard | - | ||||||||||||||||||||||||||||||
| 105 | { | - | ||||||||||||||||||||||||||||||
| 106 | public: | - | ||||||||||||||||||||||||||||||
| 107 | QStyleSheetStyleRecursionGuard(const QStyleSheetStyle *that) | - | ||||||||||||||||||||||||||||||
| 108 | : guarded(globalStyleSheetStyle == 0) | - | ||||||||||||||||||||||||||||||
| 109 | { | - | ||||||||||||||||||||||||||||||
| 110 | if (guarded) globalStyleSheetStyle = that; never executed: globalStyleSheetStyle = that;
| 0 | ||||||||||||||||||||||||||||||
| 111 | } never executed: end of block | 0 | ||||||||||||||||||||||||||||||
| 112 | ~QStyleSheetStyleRecursionGuard() { if (guarded) globalStyleSheetStyle = 0; } never executed: end of blocknever executed: globalStyleSheetStyle = 0;
| 0 | ||||||||||||||||||||||||||||||
| 113 | bool guarded; | - | ||||||||||||||||||||||||||||||
| 114 | }; | - | ||||||||||||||||||||||||||||||
| 115 | #define RECURSION_GUARD(RETURN) \ | - | ||||||||||||||||||||||||||||||
| 116 | if (globalStyleSheetStyle != 0 && globalStyleSheetStyle != this) { RETURN; } \ | - | ||||||||||||||||||||||||||||||
| 117 | QStyleSheetStyleRecursionGuard recursion_guard(this); | - | ||||||||||||||||||||||||||||||
| 118 | - | |||||||||||||||||||||||||||||||
| 119 | #define ceil(x) ((int)(x) + ((x) > 0 && (x) != (int)(x))) | - | ||||||||||||||||||||||||||||||
| 120 | - | |||||||||||||||||||||||||||||||
| 121 | enum PseudoElement { | - | ||||||||||||||||||||||||||||||
| 122 | PseudoElement_None, | - | ||||||||||||||||||||||||||||||
| 123 | PseudoElement_DownArrow, | - | ||||||||||||||||||||||||||||||
| 124 | PseudoElement_UpArrow, | - | ||||||||||||||||||||||||||||||
| 125 | PseudoElement_LeftArrow, | - | ||||||||||||||||||||||||||||||
| 126 | PseudoElement_RightArrow, | - | ||||||||||||||||||||||||||||||
| 127 | PseudoElement_Indicator, | - | ||||||||||||||||||||||||||||||
| 128 | PseudoElement_ExclusiveIndicator, | - | ||||||||||||||||||||||||||||||
| 129 | PseudoElement_PushButtonMenuIndicator, | - | ||||||||||||||||||||||||||||||
| 130 | PseudoElement_ComboBoxDropDown, | - | ||||||||||||||||||||||||||||||
| 131 | PseudoElement_ComboBoxArrow, | - | ||||||||||||||||||||||||||||||
| 132 | PseudoElement_Item, | - | ||||||||||||||||||||||||||||||
| 133 | PseudoElement_SpinBoxUpButton, | - | ||||||||||||||||||||||||||||||
| 134 | PseudoElement_SpinBoxUpArrow, | - | ||||||||||||||||||||||||||||||
| 135 | PseudoElement_SpinBoxDownButton, | - | ||||||||||||||||||||||||||||||
| 136 | PseudoElement_SpinBoxDownArrow, | - | ||||||||||||||||||||||||||||||
| 137 | PseudoElement_GroupBoxTitle, | - | ||||||||||||||||||||||||||||||
| 138 | PseudoElement_GroupBoxIndicator, | - | ||||||||||||||||||||||||||||||
| 139 | PseudoElement_ToolButtonMenu, | - | ||||||||||||||||||||||||||||||
| 140 | PseudoElement_ToolButtonMenuArrow, | - | ||||||||||||||||||||||||||||||
| 141 | PseudoElement_ToolButtonDownArrow, | - | ||||||||||||||||||||||||||||||
| 142 | PseudoElement_ToolBoxTab, | - | ||||||||||||||||||||||||||||||
| 143 | PseudoElement_ScrollBarSlider, | - | ||||||||||||||||||||||||||||||
| 144 | PseudoElement_ScrollBarAddPage, | - | ||||||||||||||||||||||||||||||
| 145 | PseudoElement_ScrollBarSubPage, | - | ||||||||||||||||||||||||||||||
| 146 | PseudoElement_ScrollBarAddLine, | - | ||||||||||||||||||||||||||||||
| 147 | PseudoElement_ScrollBarSubLine, | - | ||||||||||||||||||||||||||||||
| 148 | PseudoElement_ScrollBarFirst, | - | ||||||||||||||||||||||||||||||
| 149 | PseudoElement_ScrollBarLast, | - | ||||||||||||||||||||||||||||||
| 150 | PseudoElement_ScrollBarUpArrow, | - | ||||||||||||||||||||||||||||||
| 151 | PseudoElement_ScrollBarDownArrow, | - | ||||||||||||||||||||||||||||||
| 152 | PseudoElement_ScrollBarLeftArrow, | - | ||||||||||||||||||||||||||||||
| 153 | PseudoElement_ScrollBarRightArrow, | - | ||||||||||||||||||||||||||||||
| 154 | PseudoElement_SplitterHandle, | - | ||||||||||||||||||||||||||||||
| 155 | PseudoElement_ToolBarHandle, | - | ||||||||||||||||||||||||||||||
| 156 | PseudoElement_ToolBarSeparator, | - | ||||||||||||||||||||||||||||||
| 157 | PseudoElement_MenuScroller, | - | ||||||||||||||||||||||||||||||
| 158 | PseudoElement_MenuTearoff, | - | ||||||||||||||||||||||||||||||
| 159 | PseudoElement_MenuCheckMark, | - | ||||||||||||||||||||||||||||||
| 160 | PseudoElement_MenuSeparator, | - | ||||||||||||||||||||||||||||||
| 161 | PseudoElement_MenuIcon, | - | ||||||||||||||||||||||||||||||
| 162 | PseudoElement_MenuRightArrow, | - | ||||||||||||||||||||||||||||||
| 163 | PseudoElement_TreeViewBranch, | - | ||||||||||||||||||||||||||||||
| 164 | PseudoElement_HeaderViewSection, | - | ||||||||||||||||||||||||||||||
| 165 | PseudoElement_HeaderViewUpArrow, | - | ||||||||||||||||||||||||||||||
| 166 | PseudoElement_HeaderViewDownArrow, | - | ||||||||||||||||||||||||||||||
| 167 | PseudoElement_ProgressBarChunk, | - | ||||||||||||||||||||||||||||||
| 168 | PseudoElement_TabBarTab, | - | ||||||||||||||||||||||||||||||
| 169 | PseudoElement_TabBarScroller, | - | ||||||||||||||||||||||||||||||
| 170 | PseudoElement_TabBarTear, | - | ||||||||||||||||||||||||||||||
| 171 | PseudoElement_SliderGroove, | - | ||||||||||||||||||||||||||||||
| 172 | PseudoElement_SliderHandle, | - | ||||||||||||||||||||||||||||||
| 173 | PseudoElement_SliderAddPage, | - | ||||||||||||||||||||||||||||||
| 174 | PseudoElement_SliderSubPage, | - | ||||||||||||||||||||||||||||||
| 175 | PseudoElement_SliderTickmark, | - | ||||||||||||||||||||||||||||||
| 176 | PseudoElement_TabWidgetPane, | - | ||||||||||||||||||||||||||||||
| 177 | PseudoElement_TabWidgetTabBar, | - | ||||||||||||||||||||||||||||||
| 178 | PseudoElement_TabWidgetLeftCorner, | - | ||||||||||||||||||||||||||||||
| 179 | PseudoElement_TabWidgetRightCorner, | - | ||||||||||||||||||||||||||||||
| 180 | PseudoElement_DockWidgetTitle, | - | ||||||||||||||||||||||||||||||
| 181 | PseudoElement_DockWidgetCloseButton, | - | ||||||||||||||||||||||||||||||
| 182 | PseudoElement_DockWidgetFloatButton, | - | ||||||||||||||||||||||||||||||
| 183 | PseudoElement_DockWidgetSeparator, | - | ||||||||||||||||||||||||||||||
| 184 | PseudoElement_MdiCloseButton, | - | ||||||||||||||||||||||||||||||
| 185 | PseudoElement_MdiMinButton, | - | ||||||||||||||||||||||||||||||
| 186 | PseudoElement_MdiNormalButton, | - | ||||||||||||||||||||||||||||||
| 187 | PseudoElement_TitleBar, | - | ||||||||||||||||||||||||||||||
| 188 | PseudoElement_TitleBarCloseButton, | - | ||||||||||||||||||||||||||||||
| 189 | PseudoElement_TitleBarMinButton, | - | ||||||||||||||||||||||||||||||
| 190 | PseudoElement_TitleBarMaxButton, | - | ||||||||||||||||||||||||||||||
| 191 | PseudoElement_TitleBarShadeButton, | - | ||||||||||||||||||||||||||||||
| 192 | PseudoElement_TitleBarUnshadeButton, | - | ||||||||||||||||||||||||||||||
| 193 | PseudoElement_TitleBarNormalButton, | - | ||||||||||||||||||||||||||||||
| 194 | PseudoElement_TitleBarContextHelpButton, | - | ||||||||||||||||||||||||||||||
| 195 | PseudoElement_TitleBarSysMenu, | - | ||||||||||||||||||||||||||||||
| 196 | PseudoElement_ViewItem, | - | ||||||||||||||||||||||||||||||
| 197 | PseudoElement_ViewItemIcon, | - | ||||||||||||||||||||||||||||||
| 198 | PseudoElement_ViewItemText, | - | ||||||||||||||||||||||||||||||
| 199 | PseudoElement_ViewItemIndicator, | - | ||||||||||||||||||||||||||||||
| 200 | PseudoElement_ScrollAreaCorner, | - | ||||||||||||||||||||||||||||||
| 201 | PseudoElement_TabBarTabCloseButton, | - | ||||||||||||||||||||||||||||||
| 202 | NumPseudoElements | - | ||||||||||||||||||||||||||||||
| 203 | }; | - | ||||||||||||||||||||||||||||||
| 204 | - | |||||||||||||||||||||||||||||||
| 205 | struct PseudoElementInfo { | - | ||||||||||||||||||||||||||||||
| 206 | QStyle::SubControl subControl; | - | ||||||||||||||||||||||||||||||
| 207 | const char name[19]; | - | ||||||||||||||||||||||||||||||
| 208 | }; | - | ||||||||||||||||||||||||||||||
| 209 | - | |||||||||||||||||||||||||||||||
| 210 | static const PseudoElementInfo knownPseudoElements[NumPseudoElements] = { | - | ||||||||||||||||||||||||||||||
| 211 | { QStyle::SC_None, "" }, | - | ||||||||||||||||||||||||||||||
| 212 | { QStyle::SC_None, "down-arrow" }, | - | ||||||||||||||||||||||||||||||
| 213 | { QStyle::SC_None, "up-arrow" }, | - | ||||||||||||||||||||||||||||||
| 214 | { QStyle::SC_None, "left-arrow" }, | - | ||||||||||||||||||||||||||||||
| 215 | { QStyle::SC_None, "right-arrow" }, | - | ||||||||||||||||||||||||||||||
| 216 | { QStyle::SC_None, "indicator" }, | - | ||||||||||||||||||||||||||||||
| 217 | { QStyle::SC_None, "indicator" }, | - | ||||||||||||||||||||||||||||||
| 218 | { QStyle::SC_None, "menu-indicator" }, | - | ||||||||||||||||||||||||||||||
| 219 | { QStyle::SC_ComboBoxArrow, "drop-down" }, | - | ||||||||||||||||||||||||||||||
| 220 | { QStyle::SC_ComboBoxArrow, "down-arrow" }, | - | ||||||||||||||||||||||||||||||
| 221 | { QStyle::SC_None, "item" }, | - | ||||||||||||||||||||||||||||||
| 222 | { QStyle::SC_SpinBoxUp, "up-button" }, | - | ||||||||||||||||||||||||||||||
| 223 | { QStyle::SC_SpinBoxUp, "up-arrow" }, | - | ||||||||||||||||||||||||||||||
| 224 | { QStyle::SC_SpinBoxDown, "down-button" }, | - | ||||||||||||||||||||||||||||||
| 225 | { QStyle::SC_SpinBoxDown, "down-arrow" }, | - | ||||||||||||||||||||||||||||||
| 226 | { QStyle::SC_GroupBoxLabel, "title" }, | - | ||||||||||||||||||||||||||||||
| 227 | { QStyle::SC_GroupBoxCheckBox, "indicator" }, | - | ||||||||||||||||||||||||||||||
| 228 | { QStyle::SC_ToolButtonMenu, "menu-button" }, | - | ||||||||||||||||||||||||||||||
| 229 | { QStyle::SC_ToolButtonMenu, "menu-arrow" }, | - | ||||||||||||||||||||||||||||||
| 230 | { QStyle::SC_None, "menu-indicator" }, | - | ||||||||||||||||||||||||||||||
| 231 | { QStyle::SC_None, "tab" }, | - | ||||||||||||||||||||||||||||||
| 232 | { QStyle::SC_ScrollBarSlider, "handle" }, | - | ||||||||||||||||||||||||||||||
| 233 | { QStyle::SC_ScrollBarAddPage, "add-page" }, | - | ||||||||||||||||||||||||||||||
| 234 | { QStyle::SC_ScrollBarSubPage, "sub-page" }, | - | ||||||||||||||||||||||||||||||
| 235 | { QStyle::SC_ScrollBarAddLine, "add-line" }, | - | ||||||||||||||||||||||||||||||
| 236 | { QStyle::SC_ScrollBarSubLine, "sub-line" }, | - | ||||||||||||||||||||||||||||||
| 237 | { QStyle::SC_ScrollBarFirst, "first" }, | - | ||||||||||||||||||||||||||||||
| 238 | { QStyle::SC_ScrollBarLast, "last" }, | - | ||||||||||||||||||||||||||||||
| 239 | { QStyle::SC_ScrollBarSubLine, "up-arrow" }, | - | ||||||||||||||||||||||||||||||
| 240 | { QStyle::SC_ScrollBarAddLine, "down-arrow" }, | - | ||||||||||||||||||||||||||||||
| 241 | { QStyle::SC_ScrollBarSubLine, "left-arrow" }, | - | ||||||||||||||||||||||||||||||
| 242 | { QStyle::SC_ScrollBarAddLine, "right-arrow" }, | - | ||||||||||||||||||||||||||||||
| 243 | { QStyle::SC_None, "handle" }, | - | ||||||||||||||||||||||||||||||
| 244 | { QStyle::SC_None, "handle" }, | - | ||||||||||||||||||||||||||||||
| 245 | { QStyle::SC_None, "separator" }, | - | ||||||||||||||||||||||||||||||
| 246 | { QStyle::SC_None, "scroller" }, | - | ||||||||||||||||||||||||||||||
| 247 | { QStyle::SC_None, "tearoff" }, | - | ||||||||||||||||||||||||||||||
| 248 | { QStyle::SC_None, "indicator" }, | - | ||||||||||||||||||||||||||||||
| 249 | { QStyle::SC_None, "separator" }, | - | ||||||||||||||||||||||||||||||
| 250 | { QStyle::SC_None, "icon" }, | - | ||||||||||||||||||||||||||||||
| 251 | { QStyle::SC_None, "right-arrow" }, | - | ||||||||||||||||||||||||||||||
| 252 | { QStyle::SC_None, "branch" }, | - | ||||||||||||||||||||||||||||||
| 253 | { QStyle::SC_None, "section" }, | - | ||||||||||||||||||||||||||||||
| 254 | { QStyle::SC_None, "down-arrow" }, | - | ||||||||||||||||||||||||||||||
| 255 | { QStyle::SC_None, "up-arrow" }, | - | ||||||||||||||||||||||||||||||
| 256 | { QStyle::SC_None, "chunk" }, | - | ||||||||||||||||||||||||||||||
| 257 | { QStyle::SC_None, "tab" }, | - | ||||||||||||||||||||||||||||||
| 258 | { QStyle::SC_None, "scroller" }, | - | ||||||||||||||||||||||||||||||
| 259 | { QStyle::SC_None, "tear" }, | - | ||||||||||||||||||||||||||||||
| 260 | { QStyle::SC_SliderGroove, "groove" }, | - | ||||||||||||||||||||||||||||||
| 261 | { QStyle::SC_SliderHandle, "handle" }, | - | ||||||||||||||||||||||||||||||
| 262 | { QStyle::SC_None, "add-page" }, | - | ||||||||||||||||||||||||||||||
| 263 | { QStyle::SC_None, "sub-page"}, | - | ||||||||||||||||||||||||||||||
| 264 | { QStyle::SC_SliderTickmarks, "tick-mark" }, | - | ||||||||||||||||||||||||||||||
| 265 | { QStyle::SC_None, "pane" }, | - | ||||||||||||||||||||||||||||||
| 266 | { QStyle::SC_None, "tab-bar" }, | - | ||||||||||||||||||||||||||||||
| 267 | { QStyle::SC_None, "left-corner" }, | - | ||||||||||||||||||||||||||||||
| 268 | { QStyle::SC_None, "right-corner" }, | - | ||||||||||||||||||||||||||||||
| 269 | { QStyle::SC_None, "title" }, | - | ||||||||||||||||||||||||||||||
| 270 | { QStyle::SC_None, "close-button" }, | - | ||||||||||||||||||||||||||||||
| 271 | { QStyle::SC_None, "float-button" }, | - | ||||||||||||||||||||||||||||||
| 272 | { QStyle::SC_None, "separator" }, | - | ||||||||||||||||||||||||||||||
| 273 | { QStyle::SC_MdiCloseButton, "close-button" }, | - | ||||||||||||||||||||||||||||||
| 274 | { QStyle::SC_MdiMinButton, "minimize-button" }, | - | ||||||||||||||||||||||||||||||
| 275 | { QStyle::SC_MdiNormalButton, "normal-button" }, | - | ||||||||||||||||||||||||||||||
| 276 | { QStyle::SC_TitleBarLabel, "title" }, | - | ||||||||||||||||||||||||||||||
| 277 | { QStyle::SC_TitleBarCloseButton, "close-button" }, | - | ||||||||||||||||||||||||||||||
| 278 | { QStyle::SC_TitleBarMinButton, "minimize-button" }, | - | ||||||||||||||||||||||||||||||
| 279 | { QStyle::SC_TitleBarMaxButton, "maximize-button" }, | - | ||||||||||||||||||||||||||||||
| 280 | { QStyle::SC_TitleBarShadeButton, "shade-button" }, | - | ||||||||||||||||||||||||||||||
| 281 | { QStyle::SC_TitleBarUnshadeButton, "unshade-button" }, | - | ||||||||||||||||||||||||||||||
| 282 | { QStyle::SC_TitleBarNormalButton, "normal-button" }, | - | ||||||||||||||||||||||||||||||
| 283 | { QStyle::SC_TitleBarContextHelpButton, "contexthelp-button" }, | - | ||||||||||||||||||||||||||||||
| 284 | { QStyle::SC_TitleBarSysMenu, "sys-menu" }, | - | ||||||||||||||||||||||||||||||
| 285 | { QStyle::SC_None, "item" }, | - | ||||||||||||||||||||||||||||||
| 286 | { QStyle::SC_None, "icon" }, | - | ||||||||||||||||||||||||||||||
| 287 | { QStyle::SC_None, "text" }, | - | ||||||||||||||||||||||||||||||
| 288 | { QStyle::SC_None, "indicator" }, | - | ||||||||||||||||||||||||||||||
| 289 | { QStyle::SC_None, "corner" }, | - | ||||||||||||||||||||||||||||||
| 290 | { QStyle::SC_None, "close-button" }, | - | ||||||||||||||||||||||||||||||
| 291 | }; | - | ||||||||||||||||||||||||||||||
| 292 | - | |||||||||||||||||||||||||||||||
| 293 | - | |||||||||||||||||||||||||||||||
| 294 | struct QStyleSheetBorderImageData : public QSharedData | - | ||||||||||||||||||||||||||||||
| 295 | { | - | ||||||||||||||||||||||||||||||
| 296 | QStyleSheetBorderImageData() | - | ||||||||||||||||||||||||||||||
| 297 | : horizStretch(QCss::TileMode_Unknown), vertStretch(QCss::TileMode_Unknown) | - | ||||||||||||||||||||||||||||||
| 298 | { | - | ||||||||||||||||||||||||||||||
| 299 | for (int i = 0; i < 4; i++)
| 0 | ||||||||||||||||||||||||||||||
| 300 | cuts[i] = -1; never executed: cuts[i] = -1; | 0 | ||||||||||||||||||||||||||||||
| 301 | } never executed: end of block | 0 | ||||||||||||||||||||||||||||||
| 302 | int cuts[4]; | - | ||||||||||||||||||||||||||||||
| 303 | QPixmap pixmap; | - | ||||||||||||||||||||||||||||||
| 304 | QImage image; | - | ||||||||||||||||||||||||||||||
| 305 | QCss::TileMode horizStretch, vertStretch; | - | ||||||||||||||||||||||||||||||
| 306 | }; | - | ||||||||||||||||||||||||||||||
| 307 | - | |||||||||||||||||||||||||||||||
| 308 | struct QStyleSheetBackgroundData : public QSharedData | - | ||||||||||||||||||||||||||||||
| 309 | { | - | ||||||||||||||||||||||||||||||
| 310 | QStyleSheetBackgroundData(const QBrush& b, const QPixmap& p, QCss::Repeat r, | - | ||||||||||||||||||||||||||||||
| 311 | Qt::Alignment a, QCss::Origin o, Attachment t, QCss::Origin c) | - | ||||||||||||||||||||||||||||||
| 312 | : brush(b), pixmap(p), repeat(r), position(a), origin(o), attachment(t), clip(c) { } never executed: end of block | 0 | ||||||||||||||||||||||||||||||
| 313 | - | |||||||||||||||||||||||||||||||
| 314 | bool isTransparent() const { | - | ||||||||||||||||||||||||||||||
| 315 | if (brush.style() != Qt::NoBrush)
| 0 | ||||||||||||||||||||||||||||||
| 316 | return !brush.isOpaque(); never executed: return !brush.isOpaque(); | 0 | ||||||||||||||||||||||||||||||
| 317 | return pixmap.isNull() ? false : pixmap.hasAlpha(); never executed: return pixmap.isNull() ? false : pixmap.hasAlpha();
| 0 | ||||||||||||||||||||||||||||||
| 318 | } | - | ||||||||||||||||||||||||||||||
| 319 | QBrush brush; | - | ||||||||||||||||||||||||||||||
| 320 | QPixmap pixmap; | - | ||||||||||||||||||||||||||||||
| 321 | QCss::Repeat repeat; | - | ||||||||||||||||||||||||||||||
| 322 | Qt::Alignment position; | - | ||||||||||||||||||||||||||||||
| 323 | QCss::Origin origin; | - | ||||||||||||||||||||||||||||||
| 324 | QCss::Attachment attachment; | - | ||||||||||||||||||||||||||||||
| 325 | QCss::Origin clip; | - | ||||||||||||||||||||||||||||||
| 326 | }; | - | ||||||||||||||||||||||||||||||
| 327 | - | |||||||||||||||||||||||||||||||
| 328 | struct QStyleSheetBorderData : public QSharedData | - | ||||||||||||||||||||||||||||||
| 329 | { | - | ||||||||||||||||||||||||||||||
| 330 | QStyleSheetBorderData() : bi(0) | - | ||||||||||||||||||||||||||||||
| 331 | { | - | ||||||||||||||||||||||||||||||
| 332 | for (int i = 0; i < 4; i++) {
| 0 | ||||||||||||||||||||||||||||||
| 333 | borders[i] = 0; | - | ||||||||||||||||||||||||||||||
| 334 | styles[i] = QCss::BorderStyle_None; | - | ||||||||||||||||||||||||||||||
| 335 | } never executed: end of block | 0 | ||||||||||||||||||||||||||||||
| 336 | } never executed: end of block | 0 | ||||||||||||||||||||||||||||||
| 337 | - | |||||||||||||||||||||||||||||||
| 338 | QStyleSheetBorderData(int *b, QBrush *c, QCss::BorderStyle *s, QSize *r) : bi(0) | - | ||||||||||||||||||||||||||||||
| 339 | { | - | ||||||||||||||||||||||||||||||
| 340 | for (int i = 0; i < 4; i++) {
| 0 | ||||||||||||||||||||||||||||||
| 341 | borders[i] = b[i]; | - | ||||||||||||||||||||||||||||||
| 342 | styles[i] = s[i]; | - | ||||||||||||||||||||||||||||||
| 343 | colors[i] = c[i]; | - | ||||||||||||||||||||||||||||||
| 344 | radii[i] = r[i]; | - | ||||||||||||||||||||||||||||||
| 345 | } never executed: end of block | 0 | ||||||||||||||||||||||||||||||
| 346 | } never executed: end of block | 0 | ||||||||||||||||||||||||||||||
| 347 | - | |||||||||||||||||||||||||||||||
| 348 | int borders[4]; | - | ||||||||||||||||||||||||||||||
| 349 | QBrush colors[4]; | - | ||||||||||||||||||||||||||||||
| 350 | QCss::BorderStyle styles[4]; | - | ||||||||||||||||||||||||||||||
| 351 | QSize radii[4]; // topleft, topright, bottomleft, bottomright | - | ||||||||||||||||||||||||||||||
| 352 | - | |||||||||||||||||||||||||||||||
| 353 | const QStyleSheetBorderImageData *borderImage() const | - | ||||||||||||||||||||||||||||||
| 354 | { return bi; } never executed: return bi; | 0 | ||||||||||||||||||||||||||||||
| 355 | bool hasBorderImage() const { return bi!=0; } never executed: return bi!=0; | 0 | ||||||||||||||||||||||||||||||
| 356 | - | |||||||||||||||||||||||||||||||
| 357 | QSharedDataPointer<QStyleSheetBorderImageData> bi; | - | ||||||||||||||||||||||||||||||
| 358 | - | |||||||||||||||||||||||||||||||
| 359 | bool isOpaque() const | - | ||||||||||||||||||||||||||||||
| 360 | { | - | ||||||||||||||||||||||||||||||
| 361 | for (int i = 0; i < 4; i++) {
| 0 | ||||||||||||||||||||||||||||||
| 362 | if (styles[i] == QCss::BorderStyle_Native || styles[i] == QCss::BorderStyle_None)
| 0 | ||||||||||||||||||||||||||||||
| 363 | continue; never executed: continue; | 0 | ||||||||||||||||||||||||||||||
| 364 | if (styles[i] >= QCss::BorderStyle_Dotted && styles[i] <= QCss::BorderStyle_DotDotDash
| 0 | ||||||||||||||||||||||||||||||
| 365 | && styles[i] != BorderStyle_Solid)
| 0 | ||||||||||||||||||||||||||||||
| 366 | return false; never executed: return false; | 0 | ||||||||||||||||||||||||||||||
| 367 | if (!colors[i].isOpaque())
| 0 | ||||||||||||||||||||||||||||||
| 368 | return false; never executed: return false; | 0 | ||||||||||||||||||||||||||||||
| 369 | if (!radii[i].isEmpty())
| 0 | ||||||||||||||||||||||||||||||
| 370 | return false; never executed: return false; | 0 | ||||||||||||||||||||||||||||||
| 371 | } never executed: end of block | 0 | ||||||||||||||||||||||||||||||
| 372 | if (bi != 0 && bi->pixmap.hasAlpha())
| 0 | ||||||||||||||||||||||||||||||
| 373 | return false; never executed: return false; | 0 | ||||||||||||||||||||||||||||||
| 374 | return true; never executed: return true; | 0 | ||||||||||||||||||||||||||||||
| 375 | } | - | ||||||||||||||||||||||||||||||
| 376 | }; | - | ||||||||||||||||||||||||||||||
| 377 | - | |||||||||||||||||||||||||||||||
| 378 | - | |||||||||||||||||||||||||||||||
| 379 | struct QStyleSheetOutlineData : public QStyleSheetBorderData | - | ||||||||||||||||||||||||||||||
| 380 | { | - | ||||||||||||||||||||||||||||||
| 381 | QStyleSheetOutlineData() | - | ||||||||||||||||||||||||||||||
| 382 | { | - | ||||||||||||||||||||||||||||||
| 383 | for (int i = 0; i < 4; i++) {
| 0 | ||||||||||||||||||||||||||||||
| 384 | offsets[i] = 0; | - | ||||||||||||||||||||||||||||||
| 385 | } never executed: end of block | 0 | ||||||||||||||||||||||||||||||
| 386 | } never executed: end of block | 0 | ||||||||||||||||||||||||||||||
| 387 | - | |||||||||||||||||||||||||||||||
| 388 | QStyleSheetOutlineData(int *b, QBrush *c, QCss::BorderStyle *s, QSize *r, int *o) | - | ||||||||||||||||||||||||||||||
| 389 | : QStyleSheetBorderData(b, c, s, r) | - | ||||||||||||||||||||||||||||||
| 390 | { | - | ||||||||||||||||||||||||||||||
| 391 | for (int i = 0; i < 4; i++) {
| 0 | ||||||||||||||||||||||||||||||
| 392 | offsets[i] = o[i]; | - | ||||||||||||||||||||||||||||||
| 393 | } never executed: end of block | 0 | ||||||||||||||||||||||||||||||
| 394 | } never executed: end of block | 0 | ||||||||||||||||||||||||||||||
| 395 | - | |||||||||||||||||||||||||||||||
| 396 | int offsets[4]; | - | ||||||||||||||||||||||||||||||
| 397 | }; | - | ||||||||||||||||||||||||||||||
| 398 | - | |||||||||||||||||||||||||||||||
| 399 | struct QStyleSheetBoxData : public QSharedData | - | ||||||||||||||||||||||||||||||
| 400 | { | - | ||||||||||||||||||||||||||||||
| 401 | QStyleSheetBoxData(int *m, int *p, int s) : spacing(s) | - | ||||||||||||||||||||||||||||||
| 402 | { | - | ||||||||||||||||||||||||||||||
| 403 | for (int i = 0; i < 4; i++) {
| 0 | ||||||||||||||||||||||||||||||
| 404 | margins[i] = m[i]; | - | ||||||||||||||||||||||||||||||
| 405 | paddings[i] = p[i]; | - | ||||||||||||||||||||||||||||||
| 406 | } never executed: end of block | 0 | ||||||||||||||||||||||||||||||
| 407 | } never executed: end of block | 0 | ||||||||||||||||||||||||||||||
| 408 | - | |||||||||||||||||||||||||||||||
| 409 | int margins[4]; | - | ||||||||||||||||||||||||||||||
| 410 | int paddings[4]; | - | ||||||||||||||||||||||||||||||
| 411 | - | |||||||||||||||||||||||||||||||
| 412 | int spacing; | - | ||||||||||||||||||||||||||||||
| 413 | }; | - | ||||||||||||||||||||||||||||||
| 414 | - | |||||||||||||||||||||||||||||||
| 415 | struct QStyleSheetPaletteData : public QSharedData | - | ||||||||||||||||||||||||||||||
| 416 | { | - | ||||||||||||||||||||||||||||||
| 417 | QStyleSheetPaletteData(const QBrush &fg, const QBrush &sfg, const QBrush &sbg, | - | ||||||||||||||||||||||||||||||
| 418 | const QBrush &abg) | - | ||||||||||||||||||||||||||||||
| 419 | : foreground(fg), selectionForeground(sfg), selectionBackground(sbg), | - | ||||||||||||||||||||||||||||||
| 420 | alternateBackground(abg) { } never executed: end of block | 0 | ||||||||||||||||||||||||||||||
| 421 | - | |||||||||||||||||||||||||||||||
| 422 | QBrush foreground; | - | ||||||||||||||||||||||||||||||
| 423 | QBrush selectionForeground; | - | ||||||||||||||||||||||||||||||
| 424 | QBrush selectionBackground; | - | ||||||||||||||||||||||||||||||
| 425 | QBrush alternateBackground; | - | ||||||||||||||||||||||||||||||
| 426 | }; | - | ||||||||||||||||||||||||||||||
| 427 | - | |||||||||||||||||||||||||||||||
| 428 | struct QStyleSheetGeometryData : public QSharedData | - | ||||||||||||||||||||||||||||||
| 429 | { | - | ||||||||||||||||||||||||||||||
| 430 | QStyleSheetGeometryData(int w, int h, int minw, int minh, int maxw, int maxh) | - | ||||||||||||||||||||||||||||||
| 431 | : minWidth(minw), minHeight(minh), width(w), height(h), maxWidth(maxw), maxHeight(maxh) { } never executed: end of block | 0 | ||||||||||||||||||||||||||||||
| 432 | - | |||||||||||||||||||||||||||||||
| 433 | int minWidth, minHeight, width, height, maxWidth, maxHeight; | - | ||||||||||||||||||||||||||||||
| 434 | }; | - | ||||||||||||||||||||||||||||||
| 435 | - | |||||||||||||||||||||||||||||||
| 436 | struct QStyleSheetPositionData : public QSharedData | - | ||||||||||||||||||||||||||||||
| 437 | { | - | ||||||||||||||||||||||||||||||
| 438 | QStyleSheetPositionData(int l, int t, int r, int b, Origin o, Qt::Alignment p, QCss::PositionMode m, Qt::Alignment a = 0) | - | ||||||||||||||||||||||||||||||
| 439 | : left(l), top(t), bottom(b), right(r), origin(o), position(p), mode(m), textAlignment(a) { } never executed: end of block | 0 | ||||||||||||||||||||||||||||||
| 440 | - | |||||||||||||||||||||||||||||||
| 441 | int left, top, bottom, right; | - | ||||||||||||||||||||||||||||||
| 442 | Origin origin; | - | ||||||||||||||||||||||||||||||
| 443 | Qt::Alignment position; | - | ||||||||||||||||||||||||||||||
| 444 | QCss::PositionMode mode; | - | ||||||||||||||||||||||||||||||
| 445 | Qt::Alignment textAlignment; | - | ||||||||||||||||||||||||||||||
| 446 | }; | - | ||||||||||||||||||||||||||||||
| 447 | - | |||||||||||||||||||||||||||||||
| 448 | struct QStyleSheetImageData : public QSharedData | - | ||||||||||||||||||||||||||||||
| 449 | { | - | ||||||||||||||||||||||||||||||
| 450 | QStyleSheetImageData(const QIcon &i, Qt::Alignment a, const QSize &sz) | - | ||||||||||||||||||||||||||||||
| 451 | : icon(i), alignment(a), size(sz) { } never executed: end of block | 0 | ||||||||||||||||||||||||||||||
| 452 | - | |||||||||||||||||||||||||||||||
| 453 | QIcon icon; | - | ||||||||||||||||||||||||||||||
| 454 | Qt::Alignment alignment; | - | ||||||||||||||||||||||||||||||
| 455 | QSize size; | - | ||||||||||||||||||||||||||||||
| 456 | }; | - | ||||||||||||||||||||||||||||||
| 457 | - | |||||||||||||||||||||||||||||||
| 458 | class QRenderRule | - | ||||||||||||||||||||||||||||||
| 459 | { | - | ||||||||||||||||||||||||||||||
| 460 | public: | - | ||||||||||||||||||||||||||||||
| 461 | QRenderRule() : features(0), hasFont(false), pal(0), b(0), bg(0), bd(0), ou(0), geo(0), p(0), img(0), clipset(0) { } never executed: end of block | 0 | ||||||||||||||||||||||||||||||
| 462 | QRenderRule(const QVector<QCss::Declaration> &, const QObject *); | - | ||||||||||||||||||||||||||||||
| 463 | - | |||||||||||||||||||||||||||||||
| 464 | QRect borderRect(const QRect &r) const; | - | ||||||||||||||||||||||||||||||
| 465 | QRect outlineRect(const QRect &r) const; | - | ||||||||||||||||||||||||||||||
| 466 | QRect paddingRect(const QRect &r) const; | - | ||||||||||||||||||||||||||||||
| 467 | QRect contentsRect(const QRect &r) const; | - | ||||||||||||||||||||||||||||||
| 468 | - | |||||||||||||||||||||||||||||||
| 469 | enum { Margin = 1, Border = 2, Padding = 4, All=Margin|Border|Padding }; | - | ||||||||||||||||||||||||||||||
| 470 | QRect boxRect(const QRect &r, int flags = All) const; | - | ||||||||||||||||||||||||||||||
| 471 | QSize boxSize(const QSize &s, int flags = All) const; | - | ||||||||||||||||||||||||||||||
| 472 | QRect originRect(const QRect &rect, Origin origin) const; | - | ||||||||||||||||||||||||||||||
| 473 | - | |||||||||||||||||||||||||||||||
| 474 | QPainterPath borderClip(QRect rect); | - | ||||||||||||||||||||||||||||||
| 475 | void drawBorder(QPainter *, const QRect&); | - | ||||||||||||||||||||||||||||||
| 476 | void drawOutline(QPainter *, const QRect&); | - | ||||||||||||||||||||||||||||||
| 477 | void drawBorderImage(QPainter *, const QRect&); | - | ||||||||||||||||||||||||||||||
| 478 | void drawBackground(QPainter *, const QRect&, const QPoint& = QPoint(0, 0)); | - | ||||||||||||||||||||||||||||||
| 479 | void drawBackgroundImage(QPainter *, const QRect&, QPoint = QPoint(0, 0)); | - | ||||||||||||||||||||||||||||||
| 480 | void drawFrame(QPainter *, const QRect&); | - | ||||||||||||||||||||||||||||||
| 481 | void drawImage(QPainter *p, const QRect &rect); | - | ||||||||||||||||||||||||||||||
| 482 | void drawRule(QPainter *, const QRect&); | - | ||||||||||||||||||||||||||||||
| 483 | void configurePalette(QPalette *, QPalette::ColorGroup, const QWidget *, bool); | - | ||||||||||||||||||||||||||||||
| 484 | void configurePalette(QPalette *p, QPalette::ColorRole fr, QPalette::ColorRole br); | - | ||||||||||||||||||||||||||||||
| 485 | - | |||||||||||||||||||||||||||||||
| 486 | const QStyleSheetPaletteData *palette() const { return pal; } never executed: return pal; | 0 | ||||||||||||||||||||||||||||||
| 487 | const QStyleSheetBoxData *box() const { return b; } never executed: return b; | 0 | ||||||||||||||||||||||||||||||
| 488 | const QStyleSheetBackgroundData *background() const { return bg; } never executed: return bg; | 0 | ||||||||||||||||||||||||||||||
| 489 | const QStyleSheetBorderData *border() const { return bd; } never executed: return bd; | 0 | ||||||||||||||||||||||||||||||
| 490 | const QStyleSheetOutlineData *outline() const { return ou; } never executed: return ou; | 0 | ||||||||||||||||||||||||||||||
| 491 | const QStyleSheetGeometryData *geometry() const { return geo; } never executed: return geo; | 0 | ||||||||||||||||||||||||||||||
| 492 | const QStyleSheetPositionData *position() const { return p; } never executed: return p; | 0 | ||||||||||||||||||||||||||||||
| 493 | - | |||||||||||||||||||||||||||||||
| 494 | bool hasPalette() const { return pal != 0; } never executed: return pal != 0; | 0 | ||||||||||||||||||||||||||||||
| 495 | bool hasBackground() const { return bg != 0 && (!bg->pixmap.isNull() || bg->brush.style() != Qt::NoBrush); } never executed: return bg != 0 && (!bg->pixmap.isNull() || bg->brush.style() != Qt::NoBrush);
| 0 | ||||||||||||||||||||||||||||||
| 496 | bool hasGradientBackground() const { return bg && bg->brush.style() >= Qt::LinearGradientPattern never executed: return bg && bg->brush.style() >= Qt::LinearGradientPattern && bg->brush.style() <= Qt::ConicalGradientPattern;
| 0 | ||||||||||||||||||||||||||||||
| 497 | && bg->brush.style() <= Qt::ConicalGradientPattern; } never executed: return bg && bg->brush.style() >= Qt::LinearGradientPattern && bg->brush.style() <= Qt::ConicalGradientPattern;
| 0 | ||||||||||||||||||||||||||||||
| 498 | - | |||||||||||||||||||||||||||||||
| 499 | bool hasNativeBorder() const { | - | ||||||||||||||||||||||||||||||
| 500 | return bd == 0 never executed: return bd == 0 || (!bd->hasBorderImage() && bd->styles[0] == BorderStyle_Native);
| 0 | ||||||||||||||||||||||||||||||
| 501 | || (!bd->hasBorderImage() && bd->styles[0] == BorderStyle_Native); never executed: return bd == 0 || (!bd->hasBorderImage() && bd->styles[0] == BorderStyle_Native);
| 0 | ||||||||||||||||||||||||||||||
| 502 | } | - | ||||||||||||||||||||||||||||||
| 503 | - | |||||||||||||||||||||||||||||||
| 504 | bool hasNativeOutline() const { | - | ||||||||||||||||||||||||||||||
| 505 | return (ou == 0 never executed: return (ou == 0 || (!ou->hasBorderImage() && ou->styles[0] == BorderStyle_Native));
| 0 | ||||||||||||||||||||||||||||||
| 506 | || (!ou->hasBorderImage() && ou->styles[0] == BorderStyle_Native)); never executed: return (ou == 0 || (!ou->hasBorderImage() && ou->styles[0] == BorderStyle_Native));
| 0 | ||||||||||||||||||||||||||||||
| 507 | } | - | ||||||||||||||||||||||||||||||
| 508 | - | |||||||||||||||||||||||||||||||
| 509 | bool baseStyleCanDraw() const { | - | ||||||||||||||||||||||||||||||
| 510 | if (!hasBackground() || (background()->brush.style() == Qt::NoBrush && bg->pixmap.isNull()))
| 0 | ||||||||||||||||||||||||||||||
| 511 | return true; never executed: return true; | 0 | ||||||||||||||||||||||||||||||
| 512 | if (bg && !bg->pixmap.isNull())
| 0 | ||||||||||||||||||||||||||||||
| 513 | return false; never executed: return false; | 0 | ||||||||||||||||||||||||||||||
| 514 | if (hasGradientBackground())
| 0 | ||||||||||||||||||||||||||||||
| 515 | return features & StyleFeature_BackgroundGradient; never executed: return features & StyleFeature_BackgroundGradient; | 0 | ||||||||||||||||||||||||||||||
| 516 | return features & StyleFeature_BackgroundColor; never executed: return features & StyleFeature_BackgroundColor; | 0 | ||||||||||||||||||||||||||||||
| 517 | } | - | ||||||||||||||||||||||||||||||
| 518 | - | |||||||||||||||||||||||||||||||
| 519 | bool hasBox() const { return b != 0; } never executed: return b != 0; | 0 | ||||||||||||||||||||||||||||||
| 520 | bool hasBorder() const { return bd != 0; } never executed: return bd != 0; | 0 | ||||||||||||||||||||||||||||||
| 521 | bool hasOutline() const { return ou != 0; } never executed: return ou != 0; | 0 | ||||||||||||||||||||||||||||||
| 522 | bool hasPosition() const { return p != 0; } never executed: return p != 0; | 0 | ||||||||||||||||||||||||||||||
| 523 | bool hasGeometry() const { return geo != 0; } never executed: return geo != 0; | 0 | ||||||||||||||||||||||||||||||
| 524 | bool hasDrawable() const { return !hasNativeBorder() || hasBackground() || hasImage(); } never executed: return !hasNativeBorder() || hasBackground() || hasImage();
| 0 | ||||||||||||||||||||||||||||||
| 525 | bool hasImage() const { return img != 0; } never executed: return img != 0; | 0 | ||||||||||||||||||||||||||||||
| 526 | - | |||||||||||||||||||||||||||||||
| 527 | QSize minimumContentsSize() const | - | ||||||||||||||||||||||||||||||
| 528 | { return geo ? QSize(geo->minWidth, geo->minHeight) : QSize(0, 0); } never executed: return geo ? QSize(geo->minWidth, geo->minHeight) : QSize(0, 0);
| 0 | ||||||||||||||||||||||||||||||
| 529 | QSize minimumSize() const | - | ||||||||||||||||||||||||||||||
| 530 | { return boxSize(minimumContentsSize()); } never executed: return boxSize(minimumContentsSize()); | 0 | ||||||||||||||||||||||||||||||
| 531 | - | |||||||||||||||||||||||||||||||
| 532 | QSize contentsSize() const | - | ||||||||||||||||||||||||||||||
| 533 | { return geo ? QSize(geo->width, geo->height) never executed: return geo ? QSize(geo->width, geo->height) : ((img && img->size.isValid()) ? img->size : QSize());
| 0 | ||||||||||||||||||||||||||||||
| 534 | : ((img && img->size.isValid()) ? img->size : QSize()); } never executed: return geo ? QSize(geo->width, geo->height) : ((img && img->size.isValid()) ? img->size : QSize());
| 0 | ||||||||||||||||||||||||||||||
| 535 | QSize contentsSize(const QSize &sz) const | - | ||||||||||||||||||||||||||||||
| 536 | { | - | ||||||||||||||||||||||||||||||
| 537 | QSize csz = contentsSize(); | - | ||||||||||||||||||||||||||||||
| 538 | if (csz.width() == -1) csz.setWidth(sz.width()); never executed: csz.setWidth(sz.width());
| 0 | ||||||||||||||||||||||||||||||
| 539 | if (csz.height() == -1) csz.setHeight(sz.height()); never executed: csz.setHeight(sz.height());
| 0 | ||||||||||||||||||||||||||||||
| 540 | return csz; never executed: return csz; | 0 | ||||||||||||||||||||||||||||||
| 541 | } | - | ||||||||||||||||||||||||||||||
| 542 | bool hasContentsSize() const | - | ||||||||||||||||||||||||||||||
| 543 | { return (geo && (geo->width != -1 || geo->height != -1)) || (img && img->size.isValid()); } never executed: return (geo && (geo->width != -1 || geo->height != -1)) || (img && img->size.isValid());
| 0 | ||||||||||||||||||||||||||||||
| 544 | - | |||||||||||||||||||||||||||||||
| 545 | QSize size() const { return boxSize(contentsSize()); } never executed: return boxSize(contentsSize()); | 0 | ||||||||||||||||||||||||||||||
| 546 | QSize size(const QSize &sz) const { return boxSize(contentsSize(sz)); } never executed: return boxSize(contentsSize(sz)); | 0 | ||||||||||||||||||||||||||||||
| 547 | QSize adjustSize(const QSize &sz) | - | ||||||||||||||||||||||||||||||
| 548 | { | - | ||||||||||||||||||||||||||||||
| 549 | if (!geo)
| 0 | ||||||||||||||||||||||||||||||
| 550 | return sz; never executed: return sz; | 0 | ||||||||||||||||||||||||||||||
| 551 | QSize csz = contentsSize(); | - | ||||||||||||||||||||||||||||||
| 552 | if (csz.width() == -1) csz.setWidth(sz.width()); never executed: csz.setWidth(sz.width());
| 0 | ||||||||||||||||||||||||||||||
| 553 | if (csz.height() == -1) csz.setHeight(sz.height()); never executed: csz.setHeight(sz.height());
| 0 | ||||||||||||||||||||||||||||||
| 554 | if (geo->maxWidth != -1 && csz.width() > geo->maxWidth) csz.setWidth(geo->maxWidth); never executed: csz.setWidth(geo->maxWidth);
| 0 | ||||||||||||||||||||||||||||||
| 555 | if (geo->maxHeight != -1 && csz.height() > geo->maxHeight) csz.setHeight(geo->maxHeight); never executed: csz.setHeight(geo->maxHeight);
| 0 | ||||||||||||||||||||||||||||||
| 556 | csz=csz.expandedTo(QSize(geo->minWidth, geo->minHeight)); | - | ||||||||||||||||||||||||||||||
| 557 | return csz; never executed: return csz; | 0 | ||||||||||||||||||||||||||||||
| 558 | } | - | ||||||||||||||||||||||||||||||
| 559 | - | |||||||||||||||||||||||||||||||
| 560 | bool hasStyleHint(const QString &sh) const { return styleHints.contains(sh); } never executed: return styleHints.contains(sh); | 0 | ||||||||||||||||||||||||||||||
| 561 | QVariant styleHint(const QString &sh) const { return styleHints.value(sh); } never executed: return styleHints.value(sh); | 0 | ||||||||||||||||||||||||||||||
| 562 | - | |||||||||||||||||||||||||||||||
| 563 | void fixupBorder(int); | - | ||||||||||||||||||||||||||||||
| 564 | - | |||||||||||||||||||||||||||||||
| 565 | // Shouldn't be here | - | ||||||||||||||||||||||||||||||
| 566 | void setClip(QPainter *p, const QRect &rect); | - | ||||||||||||||||||||||||||||||
| 567 | void unsetClip(QPainter *); | - | ||||||||||||||||||||||||||||||
| 568 | - | |||||||||||||||||||||||||||||||
| 569 | public: | - | ||||||||||||||||||||||||||||||
| 570 | int features; | - | ||||||||||||||||||||||||||||||
| 571 | QBrush defaultBackground; | - | ||||||||||||||||||||||||||||||
| 572 | QFont font; | - | ||||||||||||||||||||||||||||||
| 573 | bool hasFont; | - | ||||||||||||||||||||||||||||||
| 574 | - | |||||||||||||||||||||||||||||||
| 575 | QHash<QString, QVariant> styleHints; | - | ||||||||||||||||||||||||||||||
| 576 | - | |||||||||||||||||||||||||||||||
| 577 | QSharedDataPointer<QStyleSheetPaletteData> pal; | - | ||||||||||||||||||||||||||||||
| 578 | QSharedDataPointer<QStyleSheetBoxData> b; | - | ||||||||||||||||||||||||||||||
| 579 | QSharedDataPointer<QStyleSheetBackgroundData> bg; | - | ||||||||||||||||||||||||||||||
| 580 | QSharedDataPointer<QStyleSheetBorderData> bd; | - | ||||||||||||||||||||||||||||||
| 581 | QSharedDataPointer<QStyleSheetOutlineData> ou; | - | ||||||||||||||||||||||||||||||
| 582 | QSharedDataPointer<QStyleSheetGeometryData> geo; | - | ||||||||||||||||||||||||||||||
| 583 | QSharedDataPointer<QStyleSheetPositionData> p; | - | ||||||||||||||||||||||||||||||
| 584 | QSharedDataPointer<QStyleSheetImageData> img; | - | ||||||||||||||||||||||||||||||
| 585 | - | |||||||||||||||||||||||||||||||
| 586 | int clipset; | - | ||||||||||||||||||||||||||||||
| 587 | QPainterPath clipPath; | - | ||||||||||||||||||||||||||||||
| 588 | }; | - | ||||||||||||||||||||||||||||||
| 589 | Q_DECLARE_TYPEINFO(QRenderRule, Q_MOVABLE_TYPE); | - | ||||||||||||||||||||||||||||||
| 590 | - | |||||||||||||||||||||||||||||||
| 591 | /////////////////////////////////////////////////////////////////////////////////////////// | - | ||||||||||||||||||||||||||||||
| 592 | static const char knownStyleHints[][45] = { | - | ||||||||||||||||||||||||||||||
| 593 | "activate-on-singleclick", | - | ||||||||||||||||||||||||||||||
| 594 | "alignment", | - | ||||||||||||||||||||||||||||||
| 595 | "arrow-keys-navigate-into-children", | - | ||||||||||||||||||||||||||||||
| 596 | "backward-icon", | - | ||||||||||||||||||||||||||||||
| 597 | "button-layout", | - | ||||||||||||||||||||||||||||||
| 598 | "cd-icon", | - | ||||||||||||||||||||||||||||||
| 599 | "combobox-list-mousetracking", | - | ||||||||||||||||||||||||||||||
| 600 | "combobox-popup", | - | ||||||||||||||||||||||||||||||
| 601 | "computer-icon", | - | ||||||||||||||||||||||||||||||
| 602 | "desktop-icon", | - | ||||||||||||||||||||||||||||||
| 603 | "dialog-apply-icon", | - | ||||||||||||||||||||||||||||||
| 604 | "dialog-cancel-icon", | - | ||||||||||||||||||||||||||||||
| 605 | "dialog-close-icon", | - | ||||||||||||||||||||||||||||||
| 606 | "dialog-discard-icon", | - | ||||||||||||||||||||||||||||||
| 607 | "dialog-help-icon", | - | ||||||||||||||||||||||||||||||
| 608 | "dialog-no-icon", | - | ||||||||||||||||||||||||||||||
| 609 | "dialog-ok-icon", | - | ||||||||||||||||||||||||||||||
| 610 | "dialog-open-icon", | - | ||||||||||||||||||||||||||||||
| 611 | "dialog-reset-icon", | - | ||||||||||||||||||||||||||||||
| 612 | "dialog-save-icon", | - | ||||||||||||||||||||||||||||||
| 613 | "dialog-yes-icon", | - | ||||||||||||||||||||||||||||||
| 614 | "dialogbuttonbox-buttons-have-icons", | - | ||||||||||||||||||||||||||||||
| 615 | "directory-closed-icon", | - | ||||||||||||||||||||||||||||||
| 616 | "directory-icon", | - | ||||||||||||||||||||||||||||||
| 617 | "directory-link-icon", | - | ||||||||||||||||||||||||||||||
| 618 | "directory-open-icon", | - | ||||||||||||||||||||||||||||||
| 619 | "dither-disable-text", | - | ||||||||||||||||||||||||||||||
| 620 | "dockwidget-close-icon", | - | ||||||||||||||||||||||||||||||
| 621 | "downarrow-icon", | - | ||||||||||||||||||||||||||||||
| 622 | "dvd-icon", | - | ||||||||||||||||||||||||||||||
| 623 | "etch-disabled-text", | - | ||||||||||||||||||||||||||||||
| 624 | "file-icon", | - | ||||||||||||||||||||||||||||||
| 625 | "file-link-icon", | - | ||||||||||||||||||||||||||||||
| 626 | "filedialog-backward-icon", // unused | - | ||||||||||||||||||||||||||||||
| 627 | "filedialog-contentsview-icon", | - | ||||||||||||||||||||||||||||||
| 628 | "filedialog-detailedview-icon", | - | ||||||||||||||||||||||||||||||
| 629 | "filedialog-end-icon", | - | ||||||||||||||||||||||||||||||
| 630 | "filedialog-infoview-icon", | - | ||||||||||||||||||||||||||||||
| 631 | "filedialog-listview-icon", | - | ||||||||||||||||||||||||||||||
| 632 | "filedialog-new-directory-icon", | - | ||||||||||||||||||||||||||||||
| 633 | "filedialog-parent-directory-icon", | - | ||||||||||||||||||||||||||||||
| 634 | "filedialog-start-icon", | - | ||||||||||||||||||||||||||||||
| 635 | "floppy-icon", | - | ||||||||||||||||||||||||||||||
| 636 | "forward-icon", | - | ||||||||||||||||||||||||||||||
| 637 | "gridline-color", | - | ||||||||||||||||||||||||||||||
| 638 | "harddisk-icon", | - | ||||||||||||||||||||||||||||||
| 639 | "home-icon", | - | ||||||||||||||||||||||||||||||
| 640 | "icon-size", | - | ||||||||||||||||||||||||||||||
| 641 | "leftarrow-icon", | - | ||||||||||||||||||||||||||||||
| 642 | "lineedit-password-character", | - | ||||||||||||||||||||||||||||||
| 643 | "lineedit-password-mask-delay", | - | ||||||||||||||||||||||||||||||
| 644 | "mdi-fill-space-on-maximize", | - | ||||||||||||||||||||||||||||||
| 645 | "menu-scrollable", | - | ||||||||||||||||||||||||||||||
| 646 | "menubar-altkey-navigation", | - | ||||||||||||||||||||||||||||||
| 647 | "menubar-separator", | - | ||||||||||||||||||||||||||||||
| 648 | "messagebox-critical-icon", | - | ||||||||||||||||||||||||||||||
| 649 | "messagebox-information-icon", | - | ||||||||||||||||||||||||||||||
| 650 | "messagebox-question-icon", | - | ||||||||||||||||||||||||||||||
| 651 | "messagebox-text-interaction-flags", | - | ||||||||||||||||||||||||||||||
| 652 | "messagebox-warning-icon", | - | ||||||||||||||||||||||||||||||
| 653 | "mouse-tracking", | - | ||||||||||||||||||||||||||||||
| 654 | "network-icon", | - | ||||||||||||||||||||||||||||||
| 655 | "opacity", | - | ||||||||||||||||||||||||||||||
| 656 | "paint-alternating-row-colors-for-empty-area", | - | ||||||||||||||||||||||||||||||
| 657 | "rightarrow-icon", | - | ||||||||||||||||||||||||||||||
| 658 | "scrollbar-contextmenu", | - | ||||||||||||||||||||||||||||||
| 659 | "scrollbar-leftclick-absolute-position", | - | ||||||||||||||||||||||||||||||
| 660 | "scrollbar-middleclick-absolute-position", | - | ||||||||||||||||||||||||||||||
| 661 | "scrollbar-roll-between-buttons", | - | ||||||||||||||||||||||||||||||
| 662 | "scrollbar-scroll-when-pointer-leaves-control", | - | ||||||||||||||||||||||||||||||
| 663 | "scrollview-frame-around-contents", | - | ||||||||||||||||||||||||||||||
| 664 | "show-decoration-selected", | - | ||||||||||||||||||||||||||||||
| 665 | "spinbox-click-autorepeat-rate", | - | ||||||||||||||||||||||||||||||
| 666 | "spincontrol-disable-on-bounds", | - | ||||||||||||||||||||||||||||||
| 667 | "tabbar-elide-mode", | - | ||||||||||||||||||||||||||||||
| 668 | "tabbar-prefer-no-arrows", | - | ||||||||||||||||||||||||||||||
| 669 | "titlebar-close-icon", | - | ||||||||||||||||||||||||||||||
| 670 | "titlebar-contexthelp-icon", | - | ||||||||||||||||||||||||||||||
| 671 | "titlebar-maximize-icon", | - | ||||||||||||||||||||||||||||||
| 672 | "titlebar-menu-icon", | - | ||||||||||||||||||||||||||||||
| 673 | "titlebar-minimize-icon", | - | ||||||||||||||||||||||||||||||
| 674 | "titlebar-normal-icon", | - | ||||||||||||||||||||||||||||||
| 675 | "titlebar-shade-icon", | - | ||||||||||||||||||||||||||||||
| 676 | "titlebar-unshade-icon", | - | ||||||||||||||||||||||||||||||
| 677 | "toolbutton-popup-delay", | - | ||||||||||||||||||||||||||||||
| 678 | "trash-icon", | - | ||||||||||||||||||||||||||||||
| 679 | "uparrow-icon" | - | ||||||||||||||||||||||||||||||
| 680 | }; | - | ||||||||||||||||||||||||||||||
| 681 | - | |||||||||||||||||||||||||||||||
| 682 | static const int numKnownStyleHints = sizeof(knownStyleHints)/sizeof(knownStyleHints[0]); | - | ||||||||||||||||||||||||||||||
| 683 | - | |||||||||||||||||||||||||||||||
| 684 | static QList<QVariant> subControlLayout(const QString& layout) | - | ||||||||||||||||||||||||||||||
| 685 | { | - | ||||||||||||||||||||||||||||||
| 686 | QList<QVariant> buttons; | - | ||||||||||||||||||||||||||||||
| 687 | for (int i = 0; i < layout.count(); i++) {
| 0 | ||||||||||||||||||||||||||||||
| 688 | int button = layout[i].toLatin1(); | - | ||||||||||||||||||||||||||||||
| 689 | switch (button) { | - | ||||||||||||||||||||||||||||||
| 690 | case 'm': never executed: case 'm': | 0 | ||||||||||||||||||||||||||||||
| 691 | buttons.append(PseudoElement_MdiMinButton); | - | ||||||||||||||||||||||||||||||
| 692 | buttons.append(PseudoElement_TitleBarMinButton); | - | ||||||||||||||||||||||||||||||
| 693 | break; never executed: break; | 0 | ||||||||||||||||||||||||||||||
| 694 | case 'M': never executed: case 'M': | 0 | ||||||||||||||||||||||||||||||
| 695 | buttons.append(PseudoElement_TitleBarMaxButton); | - | ||||||||||||||||||||||||||||||
| 696 | break; never executed: break; | 0 | ||||||||||||||||||||||||||||||
| 697 | case 'X': never executed: case 'X': | 0 | ||||||||||||||||||||||||||||||
| 698 | buttons.append(PseudoElement_MdiCloseButton); | - | ||||||||||||||||||||||||||||||
| 699 | buttons.append(PseudoElement_TitleBarCloseButton); | - | ||||||||||||||||||||||||||||||
| 700 | break; never executed: break; | 0 | ||||||||||||||||||||||||||||||
| 701 | case 'N': never executed: case 'N': | 0 | ||||||||||||||||||||||||||||||
| 702 | buttons.append(PseudoElement_MdiNormalButton); | - | ||||||||||||||||||||||||||||||
| 703 | buttons.append(PseudoElement_TitleBarNormalButton); | - | ||||||||||||||||||||||||||||||
| 704 | break; never executed: break; | 0 | ||||||||||||||||||||||||||||||
| 705 | case 'I': never executed: case 'I': | 0 | ||||||||||||||||||||||||||||||
| 706 | buttons.append(PseudoElement_TitleBarSysMenu); | - | ||||||||||||||||||||||||||||||
| 707 | break; never executed: break; | 0 | ||||||||||||||||||||||||||||||
| 708 | case 'T': never executed: case 'T': | 0 | ||||||||||||||||||||||||||||||
| 709 | buttons.append(PseudoElement_TitleBar); | - | ||||||||||||||||||||||||||||||
| 710 | break; never executed: break; | 0 | ||||||||||||||||||||||||||||||
| 711 | case 'H': never executed: case 'H': | 0 | ||||||||||||||||||||||||||||||
| 712 | buttons.append(PseudoElement_TitleBarContextHelpButton); | - | ||||||||||||||||||||||||||||||
| 713 | break; never executed: break; | 0 | ||||||||||||||||||||||||||||||
| 714 | case 'S': never executed: case 'S': | 0 | ||||||||||||||||||||||||||||||
| 715 | buttons.append(PseudoElement_TitleBarShadeButton); | - | ||||||||||||||||||||||||||||||
| 716 | break; never executed: break; | 0 | ||||||||||||||||||||||||||||||
| 717 | default: never executed: default: | 0 | ||||||||||||||||||||||||||||||
| 718 | buttons.append(button); | - | ||||||||||||||||||||||||||||||
| 719 | break; never executed: break; | 0 | ||||||||||||||||||||||||||||||
| 720 | } | - | ||||||||||||||||||||||||||||||
| 721 | } | - | ||||||||||||||||||||||||||||||
| 722 | return buttons; never executed: return buttons; | 0 | ||||||||||||||||||||||||||||||
| 723 | } | - | ||||||||||||||||||||||||||||||
| 724 | - | |||||||||||||||||||||||||||||||
| 725 | namespace { | - | ||||||||||||||||||||||||||||||
| 726 | struct ButtonInfo { | - | ||||||||||||||||||||||||||||||
| 727 | QRenderRule rule; | - | ||||||||||||||||||||||||||||||
| 728 | int element; | - | ||||||||||||||||||||||||||||||
| 729 | int offset; | - | ||||||||||||||||||||||||||||||
| 730 | int where; | - | ||||||||||||||||||||||||||||||
| 731 | int width; | - | ||||||||||||||||||||||||||||||
| 732 | }; | - | ||||||||||||||||||||||||||||||
| 733 | } | - | ||||||||||||||||||||||||||||||
| 734 | template <> class QTypeInfo<ButtonInfo> : public QTypeInfoMerger<ButtonInfo, QRenderRule, int> {}; | - | ||||||||||||||||||||||||||||||
| 735 | - | |||||||||||||||||||||||||||||||
| 736 | QHash<QStyle::SubControl, QRect> QStyleSheetStyle::titleBarLayout(const QWidget *w, const QStyleOptionTitleBar *tb) const | - | ||||||||||||||||||||||||||||||
| 737 | { | - | ||||||||||||||||||||||||||||||
| 738 | QHash<QStyle::SubControl, QRect> layoutRects; | - | ||||||||||||||||||||||||||||||
| 739 | const bool isMinimized = tb->titleBarState & Qt::WindowMinimized; | - | ||||||||||||||||||||||||||||||
| 740 | const bool isMaximized = tb->titleBarState & Qt::WindowMaximized; | - | ||||||||||||||||||||||||||||||
| 741 | QRenderRule subRule = renderRule(w, tb); | - | ||||||||||||||||||||||||||||||
| 742 | QRect cr = subRule.contentsRect(tb->rect); | - | ||||||||||||||||||||||||||||||
| 743 | QList<QVariant> layout = subRule.styleHint(QLatin1String("button-layout")).toList(); | - | ||||||||||||||||||||||||||||||
| 744 | if (layout.isEmpty())
| 0 | ||||||||||||||||||||||||||||||
| 745 | layout = subControlLayout(QLatin1String("I(T)HSmMX")); never executed: layout = subControlLayout(QLatin1String("I(T)HSmMX")); | 0 | ||||||||||||||||||||||||||||||
| 746 | - | |||||||||||||||||||||||||||||||
| 747 | int offsets[3] = { 0, 0, 0 }; | - | ||||||||||||||||||||||||||||||
| 748 | enum Where { Left, Right, Center, NoWhere } where = Left; | - | ||||||||||||||||||||||||||||||
| 749 | QVector<ButtonInfo> infos; | - | ||||||||||||||||||||||||||||||
| 750 | const int numLayouts = layout.size(); | - | ||||||||||||||||||||||||||||||
| 751 | infos.reserve(numLayouts); | - | ||||||||||||||||||||||||||||||
| 752 | for (int i = 0; i < numLayouts; i++) {
| 0 | ||||||||||||||||||||||||||||||
| 753 | const int element = layout[i].toInt(); | - | ||||||||||||||||||||||||||||||
| 754 | if (element == '(') {
| 0 | ||||||||||||||||||||||||||||||
| 755 | where = Center; | - | ||||||||||||||||||||||||||||||
| 756 | } else if (element == ')') { never executed: end of block
| 0 | ||||||||||||||||||||||||||||||
| 757 | where = Right; | - | ||||||||||||||||||||||||||||||
| 758 | } else { never executed: end of block | 0 | ||||||||||||||||||||||||||||||
| 759 | ButtonInfo info; | - | ||||||||||||||||||||||||||||||
| 760 | info.element = element; | - | ||||||||||||||||||||||||||||||
| 761 | switch (element) { | - | ||||||||||||||||||||||||||||||
| 762 | case PseudoElement_TitleBar: never executed: case PseudoElement_TitleBar: | 0 | ||||||||||||||||||||||||||||||
| 763 | if (!(tb->titleBarFlags & (Qt::WindowTitleHint | Qt::WindowSystemMenuHint)))
| 0 | ||||||||||||||||||||||||||||||
| 764 | continue; never executed: continue; | 0 | ||||||||||||||||||||||||||||||
| 765 | break; never executed: break; | 0 | ||||||||||||||||||||||||||||||
| 766 | case PseudoElement_TitleBarContextHelpButton: never executed: case PseudoElement_TitleBarContextHelpButton: | 0 | ||||||||||||||||||||||||||||||
| 767 | if (!(tb->titleBarFlags & Qt::WindowContextHelpButtonHint))
| 0 | ||||||||||||||||||||||||||||||
| 768 | continue; never executed: continue; | 0 | ||||||||||||||||||||||||||||||
| 769 | break; never executed: break; | 0 | ||||||||||||||||||||||||||||||
| 770 | case PseudoElement_TitleBarMinButton: never executed: case PseudoElement_TitleBarMinButton: | 0 | ||||||||||||||||||||||||||||||
| 771 | if (!(tb->titleBarFlags & Qt::WindowMinimizeButtonHint))
| 0 | ||||||||||||||||||||||||||||||
| 772 | continue; never executed: continue; | 0 | ||||||||||||||||||||||||||||||
| 773 | if (isMinimized)
| 0 | ||||||||||||||||||||||||||||||
| 774 | info.element = PseudoElement_TitleBarNormalButton; never executed: info.element = PseudoElement_TitleBarNormalButton; | 0 | ||||||||||||||||||||||||||||||
| 775 | break; never executed: break; | 0 | ||||||||||||||||||||||||||||||
| 776 | case PseudoElement_TitleBarMaxButton: never executed: case PseudoElement_TitleBarMaxButton: | 0 | ||||||||||||||||||||||||||||||
| 777 | if (!(tb->titleBarFlags & Qt::WindowMaximizeButtonHint))
| 0 | ||||||||||||||||||||||||||||||
| 778 | continue; never executed: continue; | 0 | ||||||||||||||||||||||||||||||
| 779 | if (isMaximized)
| 0 | ||||||||||||||||||||||||||||||
| 780 | info.element = PseudoElement_TitleBarNormalButton; never executed: info.element = PseudoElement_TitleBarNormalButton; | 0 | ||||||||||||||||||||||||||||||
| 781 | break; never executed: break; | 0 | ||||||||||||||||||||||||||||||
| 782 | case PseudoElement_TitleBarShadeButton: never executed: case PseudoElement_TitleBarShadeButton: | 0 | ||||||||||||||||||||||||||||||
| 783 | if (!(tb->titleBarFlags & Qt::WindowShadeButtonHint))
| 0 | ||||||||||||||||||||||||||||||
| 784 | continue; never executed: continue; | 0 | ||||||||||||||||||||||||||||||
| 785 | if (isMinimized)
| 0 | ||||||||||||||||||||||||||||||
| 786 | info.element = PseudoElement_TitleBarUnshadeButton; never executed: info.element = PseudoElement_TitleBarUnshadeButton; | 0 | ||||||||||||||||||||||||||||||
| 787 | break; never executed: break; | 0 | ||||||||||||||||||||||||||||||
| 788 | case PseudoElement_TitleBarCloseButton: never executed: case PseudoElement_TitleBarCloseButton: | 0 | ||||||||||||||||||||||||||||||
| 789 | case PseudoElement_TitleBarSysMenu: never executed: case PseudoElement_TitleBarSysMenu: | 0 | ||||||||||||||||||||||||||||||
| 790 | if (!(tb->titleBarFlags & Qt::WindowSystemMenuHint))
| 0 | ||||||||||||||||||||||||||||||
| 791 | continue; never executed: continue; | 0 | ||||||||||||||||||||||||||||||
| 792 | break; never executed: break; | 0 | ||||||||||||||||||||||||||||||
| 793 | default: never executed: default: | 0 | ||||||||||||||||||||||||||||||
| 794 | continue; never executed: continue; | 0 | ||||||||||||||||||||||||||||||
| 795 | } | - | ||||||||||||||||||||||||||||||
| 796 | if (info.element == PseudoElement_TitleBar) {
| 0 | ||||||||||||||||||||||||||||||
| 797 | info.width = tb->fontMetrics.width(tb->text) + 6; | - | ||||||||||||||||||||||||||||||
| 798 | subRule.geo = new QStyleSheetGeometryData(info.width, tb->fontMetrics.height(), -1, -1, -1, -1); | - | ||||||||||||||||||||||||||||||
| 799 | } else { never executed: end of block | 0 | ||||||||||||||||||||||||||||||
| 800 | subRule = renderRule(w, tb, info.element); | - | ||||||||||||||||||||||||||||||
| 801 | info.width = subRule.size().width(); | - | ||||||||||||||||||||||||||||||
| 802 | } never executed: end of block | 0 | ||||||||||||||||||||||||||||||
| 803 | info.rule = subRule; | - | ||||||||||||||||||||||||||||||
| 804 | info.offset = offsets[where]; | - | ||||||||||||||||||||||||||||||
| 805 | info.where = where; | - | ||||||||||||||||||||||||||||||
| 806 | infos.append(qMove(info)); | - | ||||||||||||||||||||||||||||||
| 807 | - | |||||||||||||||||||||||||||||||
| 808 | offsets[where] += info.width; | - | ||||||||||||||||||||||||||||||
| 809 | } never executed: end of block | 0 | ||||||||||||||||||||||||||||||
| 810 | } | - | ||||||||||||||||||||||||||||||
| 811 | - | |||||||||||||||||||||||||||||||
| 812 | for (int i = 0; i < infos.size(); i++) {
| 0 | ||||||||||||||||||||||||||||||
| 813 | const ButtonInfo &info = infos[i]; | - | ||||||||||||||||||||||||||||||
| 814 | QRect lr = cr; | - | ||||||||||||||||||||||||||||||
| 815 | switch (info.where) { | - | ||||||||||||||||||||||||||||||
| 816 | case Center: { never executed: case Center: | 0 | ||||||||||||||||||||||||||||||
| 817 | lr.setLeft(cr.left() + offsets[Left]); | - | ||||||||||||||||||||||||||||||
| 818 | lr.setRight(cr.right() - offsets[Right]); | - | ||||||||||||||||||||||||||||||
| 819 | QRect r(0, 0, offsets[Center], lr.height()); | - | ||||||||||||||||||||||||||||||
| 820 | r.moveCenter(lr.center()); | - | ||||||||||||||||||||||||||||||
| 821 | r.setLeft(r.left()+info.offset); | - | ||||||||||||||||||||||||||||||
| 822 | r.setWidth(info.width); | - | ||||||||||||||||||||||||||||||
| 823 | lr = r; | - | ||||||||||||||||||||||||||||||
| 824 | break; } never executed: break; | 0 | ||||||||||||||||||||||||||||||
| 825 | case Left: never executed: case Left: | 0 | ||||||||||||||||||||||||||||||
| 826 | lr.translate(info.offset, 0); | - | ||||||||||||||||||||||||||||||
| 827 | lr.setWidth(info.width); | - | ||||||||||||||||||||||||||||||
| 828 | break; never executed: break; | 0 | ||||||||||||||||||||||||||||||
| 829 | case Right: never executed: case Right: | 0 | ||||||||||||||||||||||||||||||
| 830 | lr.moveLeft(cr.right() + 1 - offsets[Right] + info.offset); | - | ||||||||||||||||||||||||||||||
| 831 | lr.setWidth(info.width); | - | ||||||||||||||||||||||||||||||
| 832 | break; never executed: break; | 0 | ||||||||||||||||||||||||||||||
| 833 | default: never executed: default: | 0 | ||||||||||||||||||||||||||||||
| 834 | break; never executed: break; | 0 | ||||||||||||||||||||||||||||||
| 835 | } | - | ||||||||||||||||||||||||||||||
| 836 | QStyle::SubControl control = knownPseudoElements[info.element].subControl; | - | ||||||||||||||||||||||||||||||
| 837 | layoutRects[control] = positionRect(w, info.rule, info.element, lr, tb->direction); | - | ||||||||||||||||||||||||||||||
| 838 | } never executed: end of block | 0 | ||||||||||||||||||||||||||||||
| 839 | - | |||||||||||||||||||||||||||||||
| 840 | return layoutRects; never executed: return layoutRects; | 0 | ||||||||||||||||||||||||||||||
| 841 | } | - | ||||||||||||||||||||||||||||||
| 842 | - | |||||||||||||||||||||||||||||||
| 843 | static QStyle::StandardPixmap subControlIcon(int pe) | - | ||||||||||||||||||||||||||||||
| 844 | { | - | ||||||||||||||||||||||||||||||
| 845 | switch (pe) { | - | ||||||||||||||||||||||||||||||
| 846 | case PseudoElement_MdiCloseButton: return QStyle::SP_TitleBarCloseButton; never executed: return QStyle::SP_TitleBarCloseButton;never executed: case PseudoElement_MdiCloseButton: | 0 | ||||||||||||||||||||||||||||||
| 847 | case PseudoElement_MdiMinButton: return QStyle::SP_TitleBarMinButton; never executed: return QStyle::SP_TitleBarMinButton;never executed: case PseudoElement_MdiMinButton: | 0 | ||||||||||||||||||||||||||||||
| 848 | case PseudoElement_MdiNormalButton: return QStyle::SP_TitleBarNormalButton; never executed: return QStyle::SP_TitleBarNormalButton;never executed: case PseudoElement_MdiNormalButton: | 0 | ||||||||||||||||||||||||||||||
| 849 | case PseudoElement_TitleBarCloseButton: return QStyle::SP_TitleBarCloseButton; never executed: return QStyle::SP_TitleBarCloseButton;never executed: case PseudoElement_TitleBarCloseButton: | 0 | ||||||||||||||||||||||||||||||
| 850 | case PseudoElement_TitleBarMinButton: return QStyle::SP_TitleBarMinButton; never executed: return QStyle::SP_TitleBarMinButton;never executed: case PseudoElement_TitleBarMinButton: | 0 | ||||||||||||||||||||||||||||||
| 851 | case PseudoElement_TitleBarMaxButton: return QStyle::SP_TitleBarMaxButton; never executed: return QStyle::SP_TitleBarMaxButton;never executed: case PseudoElement_TitleBarMaxButton: | 0 | ||||||||||||||||||||||||||||||
| 852 | case PseudoElement_TitleBarShadeButton: return QStyle::SP_TitleBarShadeButton; never executed: return QStyle::SP_TitleBarShadeButton;never executed: case PseudoElement_TitleBarShadeButton: | 0 | ||||||||||||||||||||||||||||||
| 853 | case PseudoElement_TitleBarUnshadeButton: return QStyle::SP_TitleBarUnshadeButton; never executed: return QStyle::SP_TitleBarUnshadeButton;never executed: case PseudoElement_TitleBarUnshadeButton: | 0 | ||||||||||||||||||||||||||||||
| 854 | case PseudoElement_TitleBarNormalButton: return QStyle::SP_TitleBarNormalButton; never executed: return QStyle::SP_TitleBarNormalButton;never executed: case PseudoElement_TitleBarNormalButton: | 0 | ||||||||||||||||||||||||||||||
| 855 | case PseudoElement_TitleBarContextHelpButton: return QStyle::SP_TitleBarContextHelpButton; never executed: return QStyle::SP_TitleBarContextHelpButton;never executed: case PseudoElement_TitleBarContextHelpButton: | 0 | ||||||||||||||||||||||||||||||
| 856 | default: break; never executed: break;never executed: default: | 0 | ||||||||||||||||||||||||||||||
| 857 | } | - | ||||||||||||||||||||||||||||||
| 858 | return QStyle::SP_CustomBase; never executed: return QStyle::SP_CustomBase; | 0 | ||||||||||||||||||||||||||||||
| 859 | } | - | ||||||||||||||||||||||||||||||
| 860 | - | |||||||||||||||||||||||||||||||
| 861 | QRenderRule::QRenderRule(const QVector<Declaration> &declarations, const QObject *object) | - | ||||||||||||||||||||||||||||||
| 862 | : features(0), hasFont(false), pal(0), b(0), bg(0), bd(0), ou(0), geo(0), p(0), img(0), clipset(0) | - | ||||||||||||||||||||||||||||||
| 863 | { | - | ||||||||||||||||||||||||||||||
| 864 | QPalette palette = QApplication::palette(); // ###: ideally widget's palette | - | ||||||||||||||||||||||||||||||
| 865 | ValueExtractor v(declarations, palette); | - | ||||||||||||||||||||||||||||||
| 866 | features = v.extractStyleFeatures(); | - | ||||||||||||||||||||||||||||||
| 867 | - | |||||||||||||||||||||||||||||||
| 868 | int w = -1, h = -1, minw = -1, minh = -1, maxw = -1, maxh = -1; | - | ||||||||||||||||||||||||||||||
| 869 | if (v.extractGeometry(&w, &h, &minw, &minh, &maxw, &maxh))
| 0 | ||||||||||||||||||||||||||||||
| 870 | geo = new QStyleSheetGeometryData(w, h, minw, minh, maxw, maxh); never executed: geo = new QStyleSheetGeometryData(w, h, minw, minh, maxw, maxh); | 0 | ||||||||||||||||||||||||||||||
| 871 | - | |||||||||||||||||||||||||||||||
| 872 | int left = 0, top = 0, right = 0, bottom = 0; | - | ||||||||||||||||||||||||||||||
| 873 | Origin origin = Origin_Unknown; | - | ||||||||||||||||||||||||||||||
| 874 | Qt::Alignment position = 0; | - | ||||||||||||||||||||||||||||||
| 875 | QCss::PositionMode mode = PositionMode_Unknown; | - | ||||||||||||||||||||||||||||||
| 876 | Qt::Alignment textAlignment = 0; | - | ||||||||||||||||||||||||||||||
| 877 | if (v.extractPosition(&left, &top, &right, &bottom, &origin, &position, &mode, &textAlignment))
| 0 | ||||||||||||||||||||||||||||||
| 878 | p = new QStyleSheetPositionData(left, top, right, bottom, origin, position, mode, textAlignment); never executed: p = new QStyleSheetPositionData(left, top, right, bottom, origin, position, mode, textAlignment); | 0 | ||||||||||||||||||||||||||||||
| 879 | - | |||||||||||||||||||||||||||||||
| 880 | int margins[4], paddings[4], spacing = -1; | - | ||||||||||||||||||||||||||||||
| 881 | for (int i = 0; i < 4; i++)
| 0 | ||||||||||||||||||||||||||||||
| 882 | margins[i] = paddings[i] = 0; never executed: margins[i] = paddings[i] = 0; | 0 | ||||||||||||||||||||||||||||||
| 883 | if (v.extractBox(margins, paddings, &spacing))
| 0 | ||||||||||||||||||||||||||||||
| 884 | b = new QStyleSheetBoxData(margins, paddings, spacing); never executed: b = new QStyleSheetBoxData(margins, paddings, spacing); | 0 | ||||||||||||||||||||||||||||||
| 885 | - | |||||||||||||||||||||||||||||||
| 886 | int borders[4]; | - | ||||||||||||||||||||||||||||||
| 887 | QBrush colors[4]; | - | ||||||||||||||||||||||||||||||
| 888 | QCss::BorderStyle styles[4]; | - | ||||||||||||||||||||||||||||||
| 889 | QSize radii[4]; | - | ||||||||||||||||||||||||||||||
| 890 | for (int i = 0; i < 4; i++) {
| 0 | ||||||||||||||||||||||||||||||
| 891 | borders[i] = 0; | - | ||||||||||||||||||||||||||||||
| 892 | styles[i] = BorderStyle_None; | - | ||||||||||||||||||||||||||||||
| 893 | } never executed: end of block | 0 | ||||||||||||||||||||||||||||||
| 894 | if (v.extractBorder(borders, colors, styles, radii))
| 0 | ||||||||||||||||||||||||||||||
| 895 | bd = new QStyleSheetBorderData(borders, colors, styles, radii); never executed: bd = new QStyleSheetBorderData(borders, colors, styles, radii); | 0 | ||||||||||||||||||||||||||||||
| 896 | - | |||||||||||||||||||||||||||||||
| 897 | int offsets[4]; | - | ||||||||||||||||||||||||||||||
| 898 | for (int i = 0; i < 4; i++) {
| 0 | ||||||||||||||||||||||||||||||
| 899 | borders[i] = offsets[i] = 0; | - | ||||||||||||||||||||||||||||||
| 900 | styles[i] = BorderStyle_None; | - | ||||||||||||||||||||||||||||||
| 901 | } never executed: end of block | 0 | ||||||||||||||||||||||||||||||
| 902 | if (v.extractOutline(borders, colors, styles, radii, offsets))
| 0 | ||||||||||||||||||||||||||||||
| 903 | ou = new QStyleSheetOutlineData(borders, colors, styles, radii, offsets); never executed: ou = new QStyleSheetOutlineData(borders, colors, styles, radii, offsets); | 0 | ||||||||||||||||||||||||||||||
| 904 | - | |||||||||||||||||||||||||||||||
| 905 | QBrush brush; | - | ||||||||||||||||||||||||||||||
| 906 | QString uri; | - | ||||||||||||||||||||||||||||||
| 907 | Repeat repeat = Repeat_XY; | - | ||||||||||||||||||||||||||||||
| 908 | Qt::Alignment alignment = Qt::AlignTop | Qt::AlignLeft; | - | ||||||||||||||||||||||||||||||
| 909 | Attachment attachment = Attachment_Scroll; | - | ||||||||||||||||||||||||||||||
| 910 | origin = Origin_Padding; | - | ||||||||||||||||||||||||||||||
| 911 | Origin clip = Origin_Border; | - | ||||||||||||||||||||||||||||||
| 912 | if (v.extractBackground(&brush, &uri, &repeat, &alignment, &origin, &attachment, &clip))
| 0 | ||||||||||||||||||||||||||||||
| 913 | bg = new QStyleSheetBackgroundData(brush, QPixmap(uri), repeat, alignment, origin, attachment, clip); never executed: bg = new QStyleSheetBackgroundData(brush, QPixmap(uri), repeat, alignment, origin, attachment, clip); | 0 | ||||||||||||||||||||||||||||||
| 914 | - | |||||||||||||||||||||||||||||||
| 915 | QBrush sfg, fg; | - | ||||||||||||||||||||||||||||||
| 916 | QBrush sbg, abg; | - | ||||||||||||||||||||||||||||||
| 917 | if (v.extractPalette(&fg, &sfg, &sbg, &abg))
| 0 | ||||||||||||||||||||||||||||||
| 918 | pal = new QStyleSheetPaletteData(fg, sfg, sbg, abg); never executed: pal = new QStyleSheetPaletteData(fg, sfg, sbg, abg); | 0 | ||||||||||||||||||||||||||||||
| 919 | - | |||||||||||||||||||||||||||||||
| 920 | QIcon icon; | - | ||||||||||||||||||||||||||||||
| 921 | alignment = Qt::AlignCenter; | - | ||||||||||||||||||||||||||||||
| 922 | QSize size; | - | ||||||||||||||||||||||||||||||
| 923 | if (v.extractImage(&icon, &alignment, &size))
| 0 | ||||||||||||||||||||||||||||||
| 924 | img = new QStyleSheetImageData(icon, alignment, size); never executed: img = new QStyleSheetImageData(icon, alignment, size); | 0 | ||||||||||||||||||||||||||||||
| 925 | - | |||||||||||||||||||||||||||||||
| 926 | int adj = -255; | - | ||||||||||||||||||||||||||||||
| 927 | hasFont = v.extractFont(&font, &adj); | - | ||||||||||||||||||||||||||||||
| 928 | - | |||||||||||||||||||||||||||||||
| 929 | #ifndef QT_NO_TOOLTIP | - | ||||||||||||||||||||||||||||||
| 930 | if (object && qstrcmp(object->metaObject()->className(), "QTipLabel") == 0)
| 0 | ||||||||||||||||||||||||||||||
| 931 | palette = QToolTip::palette(); never executed: palette = QToolTip::palette(); | 0 | ||||||||||||||||||||||||||||||
| 932 | #endif | - | ||||||||||||||||||||||||||||||
| 933 | - | |||||||||||||||||||||||||||||||
| 934 | for (int i = 0; i < declarations.count(); i++) {
| 0 | ||||||||||||||||||||||||||||||
| 935 | const Declaration& decl = declarations.at(i); | - | ||||||||||||||||||||||||||||||
| 936 | if (decl.d->propertyId == BorderImage) {
| 0 | ||||||||||||||||||||||||||||||
| 937 | QString uri; | - | ||||||||||||||||||||||||||||||
| 938 | QCss::TileMode horizStretch, vertStretch; | - | ||||||||||||||||||||||||||||||
| 939 | int cuts[4]; | - | ||||||||||||||||||||||||||||||
| 940 | - | |||||||||||||||||||||||||||||||
| 941 | decl.borderImageValue(&uri, cuts, &horizStretch, &vertStretch); | - | ||||||||||||||||||||||||||||||
| 942 | if (uri.isEmpty() || uri == QLatin1String("none")) {
| 0 | ||||||||||||||||||||||||||||||
| 943 | if (bd && bd->bi)
| 0 | ||||||||||||||||||||||||||||||
| 944 | bd->bi->pixmap = QPixmap(); never executed: bd->bi->pixmap = QPixmap(); | 0 | ||||||||||||||||||||||||||||||
| 945 | } else { never executed: end of block | 0 | ||||||||||||||||||||||||||||||
| 946 | if (!bd)
| 0 | ||||||||||||||||||||||||||||||
| 947 | bd = new QStyleSheetBorderData; never executed: bd = new QStyleSheetBorderData; | 0 | ||||||||||||||||||||||||||||||
| 948 | if (!bd->bi)
| 0 | ||||||||||||||||||||||||||||||
| 949 | bd->bi = new QStyleSheetBorderImageData; never executed: bd->bi = new QStyleSheetBorderImageData; | 0 | ||||||||||||||||||||||||||||||
| 950 | - | |||||||||||||||||||||||||||||||
| 951 | QStyleSheetBorderImageData *bi = bd->bi; | - | ||||||||||||||||||||||||||||||
| 952 | bi->pixmap = QPixmap(uri); | - | ||||||||||||||||||||||||||||||
| 953 | for (int i = 0; i < 4; i++)
| 0 | ||||||||||||||||||||||||||||||
| 954 | bi->cuts[i] = cuts[i]; never executed: bi->cuts[i] = cuts[i]; | 0 | ||||||||||||||||||||||||||||||
| 955 | bi->horizStretch = horizStretch; | - | ||||||||||||||||||||||||||||||
| 956 | bi->vertStretch = vertStretch; | - | ||||||||||||||||||||||||||||||
| 957 | } never executed: end of block | 0 | ||||||||||||||||||||||||||||||
| 958 | } else if (decl.d->propertyId == QtBackgroundRole) {
| 0 | ||||||||||||||||||||||||||||||
| 959 | if (bg && bg->brush.style() != Qt::NoBrush)
| 0 | ||||||||||||||||||||||||||||||
| 960 | continue; never executed: continue; | 0 | ||||||||||||||||||||||||||||||
| 961 | int role = decl.d->values.at(0).variant.toInt(); | - | ||||||||||||||||||||||||||||||
| 962 | if (role >= Value_FirstColorRole && role <= Value_LastColorRole)
| 0 | ||||||||||||||||||||||||||||||
| 963 | defaultBackground = palette.color((QPalette::ColorRole)(role-Value_FirstColorRole)); never executed: defaultBackground = palette.color((QPalette::ColorRole)(role-Value_FirstColorRole)); | 0 | ||||||||||||||||||||||||||||||
| 964 | } else if (decl.d->property.startsWith(QLatin1String("qproperty-"), Qt::CaseInsensitive)) { never executed: end of block
| 0 | ||||||||||||||||||||||||||||||
| 965 | // intentionally left blank... | - | ||||||||||||||||||||||||||||||
| 966 | } else if (decl.d->propertyId == UnknownProperty) { never executed: end of block
| 0 | ||||||||||||||||||||||||||||||
| 967 | bool knownStyleHint = false; | - | ||||||||||||||||||||||||||||||
| 968 | for (int i = 0; i < numKnownStyleHints; i++) {
| 0 | ||||||||||||||||||||||||||||||
| 969 | QLatin1String styleHint(knownStyleHints[i]); | - | ||||||||||||||||||||||||||||||
| 970 | if (decl.d->property.compare(styleHint) == 0) {
| 0 | ||||||||||||||||||||||||||||||
| 971 | QString hintName = QString(styleHint); | - | ||||||||||||||||||||||||||||||
| 972 | QVariant hintValue; | - | ||||||||||||||||||||||||||||||
| 973 | if (hintName.endsWith(QLatin1String("alignment"))) {
| 0 | ||||||||||||||||||||||||||||||
| 974 | hintValue = (int) decl.alignmentValue(); | - | ||||||||||||||||||||||||||||||
| 975 | } else if (hintName.endsWith(QLatin1String("color"))) { never executed: end of block
| 0 | ||||||||||||||||||||||||||||||
| 976 | hintValue = (int) decl.colorValue().rgba(); | - | ||||||||||||||||||||||||||||||
| 977 | } else if (hintName.endsWith(QLatin1String("size"))) { never executed: end of block
| 0 | ||||||||||||||||||||||||||||||
| 978 | hintValue = decl.sizeValue(); | - | ||||||||||||||||||||||||||||||
| 979 | } else if (hintName.endsWith(QLatin1String("icon"))) { never executed: end of block
| 0 | ||||||||||||||||||||||||||||||
| 980 | hintValue = decl.iconValue(); | - | ||||||||||||||||||||||||||||||
| 981 | } else if (hintName == QLatin1String("button-layout") never executed: end of block
| 0 | ||||||||||||||||||||||||||||||
| 982 | && decl.d->values.count() != 0 && decl.d->values.at(0).type == Value::String) {
| 0 | ||||||||||||||||||||||||||||||
| 983 | hintValue = subControlLayout(decl.d->values.at(0).variant.toString()); | - | ||||||||||||||||||||||||||||||
| 984 | } else { never executed: end of block | 0 | ||||||||||||||||||||||||||||||
| 985 | int integer; | - | ||||||||||||||||||||||||||||||
| 986 | decl.intValue(&integer); | - | ||||||||||||||||||||||||||||||
| 987 | hintValue = integer; | - | ||||||||||||||||||||||||||||||
| 988 | } never executed: end of block | 0 | ||||||||||||||||||||||||||||||
| 989 | styleHints[decl.d->property] = hintValue; | - | ||||||||||||||||||||||||||||||
| 990 | knownStyleHint = true; | - | ||||||||||||||||||||||||||||||
| 991 | break; never executed: break; | 0 | ||||||||||||||||||||||||||||||
| 992 | } | - | ||||||||||||||||||||||||||||||
| 993 | } never executed: end of block | 0 | ||||||||||||||||||||||||||||||
| 994 | if (!knownStyleHint)
| 0 | ||||||||||||||||||||||||||||||
| 995 | qDebug("Unknown property %s", qPrintable(decl.d->property)); never executed: QMessageLogger(__FILE__, 995, __PRETTY_FUNCTION__).debug("Unknown property %s", QString(decl.d->property).toLocal8Bit().constData()); | 0 | ||||||||||||||||||||||||||||||
| 996 | } never executed: end of block | 0 | ||||||||||||||||||||||||||||||
| 997 | } never executed: end of block | 0 | ||||||||||||||||||||||||||||||
| 998 | - | |||||||||||||||||||||||||||||||
| 999 | if (hasBorder()) {
| 0 | ||||||||||||||||||||||||||||||
| 1000 | if (const QWidget *widget = qobject_cast<const QWidget *>(object)) {
| 0 | ||||||||||||||||||||||||||||||
| 1001 | QStyleSheetStyle *style = const_cast<QStyleSheetStyle *>(globalStyleSheetStyle); | - | ||||||||||||||||||||||||||||||
| 1002 | if (!style)
| 0 | ||||||||||||||||||||||||||||||
| 1003 | style = qobject_cast<QStyleSheetStyle *>(widget->style()); never executed: style = qobject_cast<QStyleSheetStyle *>(widget->style()); | 0 | ||||||||||||||||||||||||||||||
| 1004 | if (style)
| 0 | ||||||||||||||||||||||||||||||
| 1005 | fixupBorder(style->nativeFrameWidth(widget)); never executed: fixupBorder(style->nativeFrameWidth(widget)); | 0 | ||||||||||||||||||||||||||||||
| 1006 | } never executed: end of block | 0 | ||||||||||||||||||||||||||||||
| 1007 | if (border()->hasBorderImage())
| 0 | ||||||||||||||||||||||||||||||
| 1008 | defaultBackground = QBrush(); never executed: defaultBackground = QBrush(); | 0 | ||||||||||||||||||||||||||||||
| 1009 | } never executed: end of block | 0 | ||||||||||||||||||||||||||||||
| 1010 | } never executed: end of block | 0 | ||||||||||||||||||||||||||||||
| 1011 | - | |||||||||||||||||||||||||||||||
| 1012 | QRect QRenderRule::borderRect(const QRect& r) const | - | ||||||||||||||||||||||||||||||
| 1013 | { | - | ||||||||||||||||||||||||||||||
| 1014 | if (!hasBox())
| 0 | ||||||||||||||||||||||||||||||
| 1015 | return r; never executed: return r; | 0 | ||||||||||||||||||||||||||||||
| 1016 | const int* m = box()->margins; | - | ||||||||||||||||||||||||||||||
| 1017 | return r.adjusted(m[LeftEdge], m[TopEdge], -m[RightEdge], -m[BottomEdge]); never executed: return r.adjusted(m[LeftEdge], m[TopEdge], -m[RightEdge], -m[BottomEdge]); | 0 | ||||||||||||||||||||||||||||||
| 1018 | } | - | ||||||||||||||||||||||||||||||
| 1019 | - | |||||||||||||||||||||||||||||||
| 1020 | QRect QRenderRule::outlineRect(const QRect& r) const | - | ||||||||||||||||||||||||||||||
| 1021 | { | - | ||||||||||||||||||||||||||||||
| 1022 | QRect br = borderRect(r); | - | ||||||||||||||||||||||||||||||
| 1023 | if (!hasOutline())
| 0 | ||||||||||||||||||||||||||||||
| 1024 | return br; never executed: return br; | 0 | ||||||||||||||||||||||||||||||
| 1025 | const int *b = outline()->borders; | - | ||||||||||||||||||||||||||||||
| 1026 | return r.adjusted(b[LeftEdge], b[TopEdge], -b[RightEdge], -b[BottomEdge]); never executed: return r.adjusted(b[LeftEdge], b[TopEdge], -b[RightEdge], -b[BottomEdge]); | 0 | ||||||||||||||||||||||||||||||
| 1027 | } | - | ||||||||||||||||||||||||||||||
| 1028 | - | |||||||||||||||||||||||||||||||
| 1029 | QRect QRenderRule::paddingRect(const QRect& r) const | - | ||||||||||||||||||||||||||||||
| 1030 | { | - | ||||||||||||||||||||||||||||||
| 1031 | QRect br = borderRect(r); | - | ||||||||||||||||||||||||||||||
| 1032 | if (!hasBorder())
| 0 | ||||||||||||||||||||||||||||||
| 1033 | return br; never executed: return br; | 0 | ||||||||||||||||||||||||||||||
| 1034 | const int *b = border()->borders; | - | ||||||||||||||||||||||||||||||
| 1035 | return br.adjusted(b[LeftEdge], b[TopEdge], -b[RightEdge], -b[BottomEdge]); never executed: return br.adjusted(b[LeftEdge], b[TopEdge], -b[RightEdge], -b[BottomEdge]); | 0 | ||||||||||||||||||||||||||||||
| 1036 | } | - | ||||||||||||||||||||||||||||||
| 1037 | - | |||||||||||||||||||||||||||||||
| 1038 | QRect QRenderRule::contentsRect(const QRect& r) const | - | ||||||||||||||||||||||||||||||
| 1039 | { | - | ||||||||||||||||||||||||||||||
| 1040 | QRect pr = paddingRect(r); | - | ||||||||||||||||||||||||||||||
| 1041 | if (!hasBox())
| 0 | ||||||||||||||||||||||||||||||
| 1042 | return pr; never executed: return pr; | 0 | ||||||||||||||||||||||||||||||
| 1043 | const int *p = box()->paddings; | - | ||||||||||||||||||||||||||||||
| 1044 | return pr.adjusted(p[LeftEdge], p[TopEdge], -p[RightEdge], -p[BottomEdge]); never executed: return pr.adjusted(p[LeftEdge], p[TopEdge], -p[RightEdge], -p[BottomEdge]); | 0 | ||||||||||||||||||||||||||||||
| 1045 | } | - | ||||||||||||||||||||||||||||||
| 1046 | - | |||||||||||||||||||||||||||||||
| 1047 | QRect QRenderRule::boxRect(const QRect& cr, int flags) const | - | ||||||||||||||||||||||||||||||
| 1048 | { | - | ||||||||||||||||||||||||||||||
| 1049 | QRect r = cr; | - | ||||||||||||||||||||||||||||||
| 1050 | if (hasBox()) {
| 0 | ||||||||||||||||||||||||||||||
| 1051 | if (flags & Margin) {
| 0 | ||||||||||||||||||||||||||||||
| 1052 | const int *m = box()->margins; | - | ||||||||||||||||||||||||||||||
| 1053 | r.adjust(-m[LeftEdge], -m[TopEdge], m[RightEdge], m[BottomEdge]); | - | ||||||||||||||||||||||||||||||
| 1054 | } never executed: end of block | 0 | ||||||||||||||||||||||||||||||
| 1055 | if (flags & Padding) {
| 0 | ||||||||||||||||||||||||||||||
| 1056 | const int *p = box()->paddings; | - | ||||||||||||||||||||||||||||||
| 1057 | r.adjust(-p[LeftEdge], -p[TopEdge], p[RightEdge], p[BottomEdge]); | - | ||||||||||||||||||||||||||||||
| 1058 | } never executed: end of block | 0 | ||||||||||||||||||||||||||||||
| 1059 | } never executed: end of block | 0 | ||||||||||||||||||||||||||||||
| 1060 | if (hasBorder() && (flags & Border)) {
| 0 | ||||||||||||||||||||||||||||||
| 1061 | const int *b = border()->borders; | - | ||||||||||||||||||||||||||||||
| 1062 | r.adjust(-b[LeftEdge], -b[TopEdge], b[RightEdge], b[BottomEdge]); | - | ||||||||||||||||||||||||||||||
| 1063 | } never executed: end of block | 0 | ||||||||||||||||||||||||||||||
| 1064 | return r; never executed: return r; | 0 | ||||||||||||||||||||||||||||||
| 1065 | } | - | ||||||||||||||||||||||||||||||
| 1066 | - | |||||||||||||||||||||||||||||||
| 1067 | QSize QRenderRule::boxSize(const QSize &cs, int flags) const | - | ||||||||||||||||||||||||||||||
| 1068 | { | - | ||||||||||||||||||||||||||||||
| 1069 | QSize bs = boxRect(QRect(QPoint(0, 0), cs), flags).size(); | - | ||||||||||||||||||||||||||||||
| 1070 | if (cs.width() < 0) bs.setWidth(-1); never executed: bs.setWidth(-1);
| 0 | ||||||||||||||||||||||||||||||
| 1071 | if (cs.height() < 0) bs.setHeight(-1); never executed: bs.setHeight(-1);
| 0 | ||||||||||||||||||||||||||||||
| 1072 | return bs; never executed: return bs; | 0 | ||||||||||||||||||||||||||||||
| 1073 | } | - | ||||||||||||||||||||||||||||||
| 1074 | - | |||||||||||||||||||||||||||||||
| 1075 | void QRenderRule::fixupBorder(int nativeWidth) | - | ||||||||||||||||||||||||||||||
| 1076 | { | - | ||||||||||||||||||||||||||||||
| 1077 | if (bd == 0)
| 0 | ||||||||||||||||||||||||||||||
| 1078 | return; never executed: return; | 0 | ||||||||||||||||||||||||||||||
| 1079 | - | |||||||||||||||||||||||||||||||
| 1080 | if (!bd->hasBorderImage() || bd->bi->pixmap.isNull()) {
| 0 | ||||||||||||||||||||||||||||||
| 1081 | bd->bi = 0; | - | ||||||||||||||||||||||||||||||
| 1082 | // ignore the color, border of edges that have none border-style | - | ||||||||||||||||||||||||||||||
| 1083 | QBrush color = pal ? pal->foreground : QBrush();
| 0 | ||||||||||||||||||||||||||||||
| 1084 | const bool hasRadius = bd->radii[0].isValid() || bd->radii[1].isValid()
| 0 | ||||||||||||||||||||||||||||||
| 1085 | || bd->radii[2].isValid() || bd->radii[3].isValid();
| 0 | ||||||||||||||||||||||||||||||
| 1086 | for (int i = 0; i < 4; i++) {
| 0 | ||||||||||||||||||||||||||||||
| 1087 | if ((bd->styles[i] == BorderStyle_Native) && hasRadius)
| 0 | ||||||||||||||||||||||||||||||
| 1088 | bd->styles[i] = BorderStyle_None; never executed: bd->styles[i] = BorderStyle_None; | 0 | ||||||||||||||||||||||||||||||
| 1089 | - | |||||||||||||||||||||||||||||||
| 1090 | switch (bd->styles[i]) { | - | ||||||||||||||||||||||||||||||
| 1091 | case BorderStyle_None: never executed: case BorderStyle_None: | 0 | ||||||||||||||||||||||||||||||
| 1092 | // border-style: none forces width to be 0 | - | ||||||||||||||||||||||||||||||
| 1093 | bd->colors[i] = QBrush(); | - | ||||||||||||||||||||||||||||||
| 1094 | bd->borders[i] = 0; | - | ||||||||||||||||||||||||||||||
| 1095 | break; never executed: break; | 0 | ||||||||||||||||||||||||||||||
| 1096 | case BorderStyle_Native: never executed: case BorderStyle_Native: | 0 | ||||||||||||||||||||||||||||||
| 1097 | if (bd->borders[i] == 0)
| 0 | ||||||||||||||||||||||||||||||
| 1098 | bd->borders[i] = nativeWidth; never executed: bd->borders[i] = nativeWidth; | 0 | ||||||||||||||||||||||||||||||
| 1099 | // intentional fall through | - | ||||||||||||||||||||||||||||||
| 1100 | default: code before this statement never executed: default:never executed: default: | 0 | ||||||||||||||||||||||||||||||
| 1101 | if (bd->colors[i].style() == Qt::NoBrush) // auto-acquire 'color'
| 0 | ||||||||||||||||||||||||||||||
| 1102 | bd->colors[i] = color; never executed: bd->colors[i] = color; | 0 | ||||||||||||||||||||||||||||||
| 1103 | break; never executed: break; | 0 | ||||||||||||||||||||||||||||||
| 1104 | } | - | ||||||||||||||||||||||||||||||
| 1105 | } | - | ||||||||||||||||||||||||||||||
| 1106 | - | |||||||||||||||||||||||||||||||
| 1107 | return; never executed: return; | 0 | ||||||||||||||||||||||||||||||
| 1108 | } | - | ||||||||||||||||||||||||||||||
| 1109 | - | |||||||||||||||||||||||||||||||
| 1110 | // inspect the border image | - | ||||||||||||||||||||||||||||||
| 1111 | QStyleSheetBorderImageData *bi = bd->bi; | - | ||||||||||||||||||||||||||||||
| 1112 | if (bi->cuts[0] == -1) {
| 0 | ||||||||||||||||||||||||||||||
| 1113 | for (int i = 0; i < 4; i++) // assume, cut = border
| 0 | ||||||||||||||||||||||||||||||
| 1114 | bi->cuts[i] = int(border()->borders[i]); never executed: bi->cuts[i] = int(border()->borders[i]); | 0 | ||||||||||||||||||||||||||||||
| 1115 | } never executed: end of block | 0 | ||||||||||||||||||||||||||||||
| 1116 | } never executed: end of block | 0 | ||||||||||||||||||||||||||||||
| 1117 | - | |||||||||||||||||||||||||||||||
| 1118 | void QRenderRule::drawBorderImage(QPainter *p, const QRect& rect) | - | ||||||||||||||||||||||||||||||
| 1119 | { | - | ||||||||||||||||||||||||||||||
| 1120 | setClip(p, rect); | - | ||||||||||||||||||||||||||||||
| 1121 | static const Qt::TileRule tileMode2TileRule[] = { | - | ||||||||||||||||||||||||||||||
| 1122 | Qt::StretchTile, Qt::RoundTile, Qt::StretchTile, Qt::RepeatTile, Qt::StretchTile }; | - | ||||||||||||||||||||||||||||||
| 1123 | - | |||||||||||||||||||||||||||||||
| 1124 | const QStyleSheetBorderImageData *borderImageData = border()->borderImage(); | - | ||||||||||||||||||||||||||||||
| 1125 | const int *targetBorders = border()->borders; | - | ||||||||||||||||||||||||||||||
| 1126 | const int *sourceBorders = borderImageData->cuts; | - | ||||||||||||||||||||||||||||||
| 1127 | QMargins sourceMargins(sourceBorders[LeftEdge], sourceBorders[TopEdge], | - | ||||||||||||||||||||||||||||||
| 1128 | sourceBorders[RightEdge], sourceBorders[BottomEdge]); | - | ||||||||||||||||||||||||||||||
| 1129 | QMargins targetMargins(targetBorders[LeftEdge], targetBorders[TopEdge], | - | ||||||||||||||||||||||||||||||
| 1130 | targetBorders[RightEdge], targetBorders[BottomEdge]); | - | ||||||||||||||||||||||||||||||
| 1131 | - | |||||||||||||||||||||||||||||||
| 1132 | bool wasSmoothPixmapTransform = p->renderHints() & QPainter::SmoothPixmapTransform; | - | ||||||||||||||||||||||||||||||
| 1133 | p->setRenderHint(QPainter::SmoothPixmapTransform); | - | ||||||||||||||||||||||||||||||
| 1134 | qDrawBorderPixmap(p, rect, targetMargins, borderImageData->pixmap, | - | ||||||||||||||||||||||||||||||
| 1135 | QRect(QPoint(), borderImageData->pixmap.size()), sourceMargins, | - | ||||||||||||||||||||||||||||||
| 1136 | QTileRules(tileMode2TileRule[borderImageData->horizStretch], tileMode2TileRule[borderImageData->vertStretch])); | - | ||||||||||||||||||||||||||||||
| 1137 | p->setRenderHint(QPainter::SmoothPixmapTransform, wasSmoothPixmapTransform); | - | ||||||||||||||||||||||||||||||
| 1138 | unsetClip(p); | - | ||||||||||||||||||||||||||||||
| 1139 | } never executed: end of block | 0 | ||||||||||||||||||||||||||||||
| 1140 | - | |||||||||||||||||||||||||||||||
| 1141 | QRect QRenderRule::originRect(const QRect &rect, Origin origin) const | - | ||||||||||||||||||||||||||||||
| 1142 | { | - | ||||||||||||||||||||||||||||||
| 1143 | switch (origin) { | - | ||||||||||||||||||||||||||||||
| 1144 | case Origin_Padding: never executed: case Origin_Padding: | 0 | ||||||||||||||||||||||||||||||
| 1145 | return paddingRect(rect); never executed: return paddingRect(rect); | 0 | ||||||||||||||||||||||||||||||
| 1146 | case Origin_Border: never executed: case Origin_Border: | 0 | ||||||||||||||||||||||||||||||
| 1147 | return borderRect(rect); never executed: return borderRect(rect); | 0 | ||||||||||||||||||||||||||||||
| 1148 | case Origin_Content: never executed: case Origin_Content: | 0 | ||||||||||||||||||||||||||||||
| 1149 | return contentsRect(rect); never executed: return contentsRect(rect); | 0 | ||||||||||||||||||||||||||||||
| 1150 | case Origin_Margin: never executed: case Origin_Margin: | 0 | ||||||||||||||||||||||||||||||
| 1151 | default: never executed: default: | 0 | ||||||||||||||||||||||||||||||
| 1152 | return rect; never executed: return rect; | 0 | ||||||||||||||||||||||||||||||
| 1153 | } | - | ||||||||||||||||||||||||||||||
| 1154 | } | - | ||||||||||||||||||||||||||||||
| 1155 | - | |||||||||||||||||||||||||||||||
| 1156 | void QRenderRule::drawBackgroundImage(QPainter *p, const QRect &rect, QPoint off) | - | ||||||||||||||||||||||||||||||
| 1157 | { | - | ||||||||||||||||||||||||||||||
| 1158 | if (!hasBackground())
| 0 | ||||||||||||||||||||||||||||||
| 1159 | return; never executed: return; | 0 | ||||||||||||||||||||||||||||||
| 1160 | - | |||||||||||||||||||||||||||||||
| 1161 | const QPixmap& bgp = background()->pixmap; | - | ||||||||||||||||||||||||||||||
| 1162 | if (bgp.isNull())
| 0 | ||||||||||||||||||||||||||||||
| 1163 | return; never executed: return; | 0 | ||||||||||||||||||||||||||||||
| 1164 | - | |||||||||||||||||||||||||||||||
| 1165 | setClip(p, borderRect(rect)); | - | ||||||||||||||||||||||||||||||
| 1166 | - | |||||||||||||||||||||||||||||||
| 1167 | if (background()->origin != background()->clip) {
| 0 | ||||||||||||||||||||||||||||||
| 1168 | p->save(); | - | ||||||||||||||||||||||||||||||
| 1169 | p->setClipRect(originRect(rect, background()->clip), Qt::IntersectClip); | - | ||||||||||||||||||||||||||||||
| 1170 | } never executed: end of block | 0 | ||||||||||||||||||||||||||||||
| 1171 | - | |||||||||||||||||||||||||||||||
| 1172 | if (background()->attachment == Attachment_Fixed)
| 0 | ||||||||||||||||||||||||||||||
| 1173 | off = QPoint(0, 0); never executed: off = QPoint(0, 0); | 0 | ||||||||||||||||||||||||||||||
| 1174 | - | |||||||||||||||||||||||||||||||
| 1175 | QRect r = originRect(rect, background()->origin); | - | ||||||||||||||||||||||||||||||
| 1176 | QRect aligned = QStyle::alignedRect(Qt::LeftToRight, background()->position, bgp.size(), r); | - | ||||||||||||||||||||||||||||||
| 1177 | QRect inter = aligned.translated(-off).intersected(r); | - | ||||||||||||||||||||||||||||||
| 1178 | - | |||||||||||||||||||||||||||||||
| 1179 | switch (background()->repeat) { | - | ||||||||||||||||||||||||||||||
| 1180 | case Repeat_Y: never executed: case Repeat_Y: | 0 | ||||||||||||||||||||||||||||||
| 1181 | p->drawTiledPixmap(inter.x(), r.y(), inter.width(), r.height(), bgp, | - | ||||||||||||||||||||||||||||||
| 1182 | inter.x() - aligned.x() + off.x(), | - | ||||||||||||||||||||||||||||||
| 1183 | bgp.height() - int(aligned.y() - r.y()) % bgp.height() + off.y()); | - | ||||||||||||||||||||||||||||||
| 1184 | break; never executed: break; | 0 | ||||||||||||||||||||||||||||||
| 1185 | case Repeat_X: never executed: case Repeat_X: | 0 | ||||||||||||||||||||||||||||||
| 1186 | p->drawTiledPixmap(r.x(), inter.y(), r.width(), inter.height(), bgp, | - | ||||||||||||||||||||||||||||||
| 1187 | bgp.width() - int(aligned.x() - r.x())%bgp.width() + off.x(), | - | ||||||||||||||||||||||||||||||
| 1188 | inter.y() - aligned.y() + off.y()); | - | ||||||||||||||||||||||||||||||
| 1189 | break; never executed: break; | 0 | ||||||||||||||||||||||||||||||
| 1190 | case Repeat_XY: never executed: case Repeat_XY: | 0 | ||||||||||||||||||||||||||||||
| 1191 | p->drawTiledPixmap(r, bgp, | - | ||||||||||||||||||||||||||||||
| 1192 | QPoint(bgp.width() - int(aligned.x() - r.x())% bgp.width() + off.x(), | - | ||||||||||||||||||||||||||||||
| 1193 | bgp.height() - int(aligned.y() - r.y())%bgp.height() + off.y())); | - | ||||||||||||||||||||||||||||||
| 1194 | break; never executed: break; | 0 | ||||||||||||||||||||||||||||||
| 1195 | case Repeat_None: never executed: case Repeat_None: | 0 | ||||||||||||||||||||||||||||||
| 1196 | default: never executed: default: | 0 | ||||||||||||||||||||||||||||||
| 1197 | p->drawPixmap(inter.x(), inter.y(), bgp, inter.x() - aligned.x() + off.x(), | - | ||||||||||||||||||||||||||||||
| 1198 | inter.y() - aligned.y() + off.y(), inter.width(), inter.height()); | - | ||||||||||||||||||||||||||||||
| 1199 | break; never executed: break; | 0 | ||||||||||||||||||||||||||||||
| 1200 | } | - | ||||||||||||||||||||||||||||||
| 1201 | - | |||||||||||||||||||||||||||||||
| 1202 | - | |||||||||||||||||||||||||||||||
| 1203 | if (background()->origin != background()->clip)
| 0 | ||||||||||||||||||||||||||||||
| 1204 | p->restore(); never executed: p->restore(); | 0 | ||||||||||||||||||||||||||||||
| 1205 | - | |||||||||||||||||||||||||||||||
| 1206 | unsetClip(p); | - | ||||||||||||||||||||||||||||||
| 1207 | } never executed: end of block | 0 | ||||||||||||||||||||||||||||||
| 1208 | - | |||||||||||||||||||||||||||||||
| 1209 | void QRenderRule::drawOutline(QPainter *p, const QRect &rect) | - | ||||||||||||||||||||||||||||||
| 1210 | { | - | ||||||||||||||||||||||||||||||
| 1211 | if (!hasOutline())
| 0 | ||||||||||||||||||||||||||||||
| 1212 | return; never executed: return; | 0 | ||||||||||||||||||||||||||||||
| 1213 | - | |||||||||||||||||||||||||||||||
| 1214 | bool wasAntialiased = p->renderHints() & QPainter::Antialiasing; | - | ||||||||||||||||||||||||||||||
| 1215 | p->setRenderHint(QPainter::Antialiasing); | - | ||||||||||||||||||||||||||||||
| 1216 | qDrawBorder(p, rect, ou->styles, ou->borders, ou->colors, ou->radii); | - | ||||||||||||||||||||||||||||||
| 1217 | p->setRenderHint(QPainter::Antialiasing, wasAntialiased); | - | ||||||||||||||||||||||||||||||
| 1218 | } never executed: end of block | 0 | ||||||||||||||||||||||||||||||
| 1219 | - | |||||||||||||||||||||||||||||||
| 1220 | void QRenderRule::drawBorder(QPainter *p, const QRect& rect) | - | ||||||||||||||||||||||||||||||
| 1221 | { | - | ||||||||||||||||||||||||||||||
| 1222 | if (!hasBorder())
| 0 | ||||||||||||||||||||||||||||||
| 1223 | return; never executed: return; | 0 | ||||||||||||||||||||||||||||||
| 1224 | - | |||||||||||||||||||||||||||||||
| 1225 | if (border()->hasBorderImage()) {
| 0 | ||||||||||||||||||||||||||||||
| 1226 | drawBorderImage(p, rect); | - | ||||||||||||||||||||||||||||||
| 1227 | return; never executed: return; | 0 | ||||||||||||||||||||||||||||||
| 1228 | } | - | ||||||||||||||||||||||||||||||
| 1229 | - | |||||||||||||||||||||||||||||||
| 1230 | bool wasAntialiased = p->renderHints() & QPainter::Antialiasing; | - | ||||||||||||||||||||||||||||||
| 1231 | p->setRenderHint(QPainter::Antialiasing); | - | ||||||||||||||||||||||||||||||
| 1232 | qDrawBorder(p, rect, bd->styles, bd->borders, bd->colors, bd->radii); | - | ||||||||||||||||||||||||||||||
| 1233 | p->setRenderHint(QPainter::Antialiasing, wasAntialiased); | - | ||||||||||||||||||||||||||||||
| 1234 | } never executed: end of block | 0 | ||||||||||||||||||||||||||||||
| 1235 | - | |||||||||||||||||||||||||||||||
| 1236 | QPainterPath QRenderRule::borderClip(QRect r) | - | ||||||||||||||||||||||||||||||
| 1237 | { | - | ||||||||||||||||||||||||||||||
| 1238 | if (!hasBorder())
| 0 | ||||||||||||||||||||||||||||||
| 1239 | return QPainterPath(); never executed: return QPainterPath(); | 0 | ||||||||||||||||||||||||||||||
| 1240 | - | |||||||||||||||||||||||||||||||
| 1241 | QSize tlr, trr, blr, brr; | - | ||||||||||||||||||||||||||||||
| 1242 | qNormalizeRadii(r, bd->radii, &tlr, &trr, &blr, &brr); | - | ||||||||||||||||||||||||||||||
| 1243 | if (tlr.isNull() && trr.isNull() && blr.isNull() && brr.isNull())
| 0 | ||||||||||||||||||||||||||||||
| 1244 | return QPainterPath(); never executed: return QPainterPath(); | 0 | ||||||||||||||||||||||||||||||
| 1245 | - | |||||||||||||||||||||||||||||||
| 1246 | const QRectF rect(r); | - | ||||||||||||||||||||||||||||||
| 1247 | const int *borders = border()->borders; | - | ||||||||||||||||||||||||||||||
| 1248 | QPainterPath path; | - | ||||||||||||||||||||||||||||||
| 1249 | qreal curY = rect.y() + borders[TopEdge]/2.0; | - | ||||||||||||||||||||||||||||||
| 1250 | path.moveTo(rect.x() + tlr.width(), curY); | - | ||||||||||||||||||||||||||||||
| 1251 | path.lineTo(rect.right() - trr.width(), curY); | - | ||||||||||||||||||||||||||||||
| 1252 | qreal curX = rect.right() - borders[RightEdge]/2.0; | - | ||||||||||||||||||||||||||||||
| 1253 | path.arcTo(curX - 2*trr.width() + borders[RightEdge], curY, | - | ||||||||||||||||||||||||||||||
| 1254 | trr.width()*2 - borders[RightEdge], trr.height()*2 - borders[TopEdge], 90, -90); | - | ||||||||||||||||||||||||||||||
| 1255 | - | |||||||||||||||||||||||||||||||
| 1256 | path.lineTo(curX, rect.bottom() - brr.height()); | - | ||||||||||||||||||||||||||||||
| 1257 | curY = rect.bottom() - borders[BottomEdge]/2.0; | - | ||||||||||||||||||||||||||||||
| 1258 | path.arcTo(curX - 2*brr.width() + borders[RightEdge], curY - 2*brr.height() + borders[BottomEdge], | - | ||||||||||||||||||||||||||||||
| 1259 | brr.width()*2 - borders[RightEdge], brr.height()*2 - borders[BottomEdge], 0, -90); | - | ||||||||||||||||||||||||||||||
| 1260 | - | |||||||||||||||||||||||||||||||
| 1261 | path.lineTo(rect.x() + blr.width(), curY); | - | ||||||||||||||||||||||||||||||
| 1262 | curX = rect.left() + borders[LeftEdge]/2.0; | - | ||||||||||||||||||||||||||||||
| 1263 | path.arcTo(curX, rect.bottom() - 2*blr.height() + borders[BottomEdge]/2, | - | ||||||||||||||||||||||||||||||
| 1264 | blr.width()*2 - borders[LeftEdge], blr.height()*2 - borders[BottomEdge], 270, -90); | - | ||||||||||||||||||||||||||||||
| 1265 | - | |||||||||||||||||||||||||||||||
| 1266 | path.lineTo(curX, rect.top() + tlr.height()); | - | ||||||||||||||||||||||||||||||
| 1267 | path.arcTo(curX, rect.top() + borders[TopEdge]/2, | - | ||||||||||||||||||||||||||||||
| 1268 | tlr.width()*2 - borders[LeftEdge], tlr.height()*2 - borders[TopEdge], 180, -90); | - | ||||||||||||||||||||||||||||||
| 1269 | - | |||||||||||||||||||||||||||||||
| 1270 | path.closeSubpath(); | - | ||||||||||||||||||||||||||||||
| 1271 | return path; never executed: return path; | 0 | ||||||||||||||||||||||||||||||
| 1272 | } | - | ||||||||||||||||||||||||||||||
| 1273 | - | |||||||||||||||||||||||||||||||
| 1274 | /*! \internal | - | ||||||||||||||||||||||||||||||
| 1275 | Clip the painter to the border (in case we are using radius border) | - | ||||||||||||||||||||||||||||||
| 1276 | */ | - | ||||||||||||||||||||||||||||||
| 1277 | void QRenderRule::setClip(QPainter *p, const QRect &rect) | - | ||||||||||||||||||||||||||||||
| 1278 | { | - | ||||||||||||||||||||||||||||||
| 1279 | if (clipset++)
| 0 | ||||||||||||||||||||||||||||||
| 1280 | return; never executed: return; | 0 | ||||||||||||||||||||||||||||||
| 1281 | clipPath = borderClip(rect); | - | ||||||||||||||||||||||||||||||
| 1282 | if (!clipPath.isEmpty()) {
| 0 | ||||||||||||||||||||||||||||||
| 1283 | p->save(); | - | ||||||||||||||||||||||||||||||
| 1284 | p->setClipPath(clipPath, Qt::IntersectClip); | - | ||||||||||||||||||||||||||||||
| 1285 | } never executed: end of block | 0 | ||||||||||||||||||||||||||||||
| 1286 | } never executed: end of block | 0 | ||||||||||||||||||||||||||||||
| 1287 | - | |||||||||||||||||||||||||||||||
| 1288 | void QRenderRule::unsetClip(QPainter *p) | - | ||||||||||||||||||||||||||||||
| 1289 | { | - | ||||||||||||||||||||||||||||||
| 1290 | if (--clipset)
| 0 | ||||||||||||||||||||||||||||||
| 1291 | return; never executed: return; | 0 | ||||||||||||||||||||||||||||||
| 1292 | if (!clipPath.isEmpty())
| 0 | ||||||||||||||||||||||||||||||
| 1293 | p->restore(); never executed: p->restore(); | 0 | ||||||||||||||||||||||||||||||
| 1294 | } never executed: end of block | 0 | ||||||||||||||||||||||||||||||
| 1295 | - | |||||||||||||||||||||||||||||||
| 1296 | void QRenderRule::drawBackground(QPainter *p, const QRect& rect, const QPoint& off) | - | ||||||||||||||||||||||||||||||
| 1297 | { | - | ||||||||||||||||||||||||||||||
| 1298 | QBrush brush = hasBackground() ? background()->brush : QBrush();
| 0 | ||||||||||||||||||||||||||||||
| 1299 | if (brush.style() == Qt::NoBrush)
| 0 | ||||||||||||||||||||||||||||||
| 1300 | brush = defaultBackground; never executed: brush = defaultBackground; | 0 | ||||||||||||||||||||||||||||||
| 1301 | - | |||||||||||||||||||||||||||||||
| 1302 | if (brush.style() != Qt::NoBrush) {
| 0 | ||||||||||||||||||||||||||||||
| 1303 | Origin origin = hasBackground() ? background()->clip : Origin_Border;
| 0 | ||||||||||||||||||||||||||||||
| 1304 | // ### fix for gradients | - | ||||||||||||||||||||||||||||||
| 1305 | const QPainterPath &borderPath = borderClip(originRect(rect, origin)); | - | ||||||||||||||||||||||||||||||
| 1306 | if (!borderPath.isEmpty()) {
| 0 | ||||||||||||||||||||||||||||||
| 1307 | // Drawn intead of being used as clipping path for better visual quality | - | ||||||||||||||||||||||||||||||
| 1308 | bool wasAntialiased = p->renderHints() & QPainter::Antialiasing; | - | ||||||||||||||||||||||||||||||
| 1309 | p->setRenderHint(QPainter::Antialiasing); | - | ||||||||||||||||||||||||||||||
| 1310 | p->fillPath(borderPath, brush); | - | ||||||||||||||||||||||||||||||
| 1311 | p->setRenderHint(QPainter::Antialiasing, wasAntialiased); | - | ||||||||||||||||||||||||||||||
| 1312 | } else { never executed: end of block | 0 | ||||||||||||||||||||||||||||||
| 1313 | p->fillRect(originRect(rect, origin), brush); | - | ||||||||||||||||||||||||||||||
| 1314 | } never executed: end of block | 0 | ||||||||||||||||||||||||||||||
| 1315 | } | - | ||||||||||||||||||||||||||||||
| 1316 | - | |||||||||||||||||||||||||||||||
| 1317 | drawBackgroundImage(p, rect, off); | - | ||||||||||||||||||||||||||||||
| 1318 | } never executed: end of block | 0 | ||||||||||||||||||||||||||||||
| 1319 | - | |||||||||||||||||||||||||||||||
| 1320 | void QRenderRule::drawFrame(QPainter *p, const QRect& rect) | - | ||||||||||||||||||||||||||||||
| 1321 | { | - | ||||||||||||||||||||||||||||||
| 1322 | drawBackground(p, rect); | - | ||||||||||||||||||||||||||||||
| 1323 | if (hasBorder())
| 0 | ||||||||||||||||||||||||||||||
| 1324 | drawBorder(p, borderRect(rect)); never executed: drawBorder(p, borderRect(rect)); | 0 | ||||||||||||||||||||||||||||||
| 1325 | } never executed: end of block | 0 | ||||||||||||||||||||||||||||||
| 1326 | - | |||||||||||||||||||||||||||||||
| 1327 | void QRenderRule::drawImage(QPainter *p, const QRect &rect) | - | ||||||||||||||||||||||||||||||
| 1328 | { | - | ||||||||||||||||||||||||||||||
| 1329 | if (!hasImage())
| 0 | ||||||||||||||||||||||||||||||
| 1330 | return; never executed: return; | 0 | ||||||||||||||||||||||||||||||
| 1331 | img->icon.paint(p, rect, img->alignment); | - | ||||||||||||||||||||||||||||||
| 1332 | } never executed: end of block | 0 | ||||||||||||||||||||||||||||||
| 1333 | - | |||||||||||||||||||||||||||||||
| 1334 | void QRenderRule::drawRule(QPainter *p, const QRect& rect) | - | ||||||||||||||||||||||||||||||
| 1335 | { | - | ||||||||||||||||||||||||||||||
| 1336 | drawFrame(p, rect); | - | ||||||||||||||||||||||||||||||
| 1337 | drawImage(p, contentsRect(rect)); | - | ||||||||||||||||||||||||||||||
| 1338 | } never executed: end of block | 0 | ||||||||||||||||||||||||||||||
| 1339 | - | |||||||||||||||||||||||||||||||
| 1340 | // *shudder* , *horror*, *whoa* <-- what you might feel when you see the functions below | - | ||||||||||||||||||||||||||||||
| 1341 | void QRenderRule::configurePalette(QPalette *p, QPalette::ColorRole fr, QPalette::ColorRole br) | - | ||||||||||||||||||||||||||||||
| 1342 | { | - | ||||||||||||||||||||||||||||||
| 1343 | if (bg && bg->brush.style() != Qt::NoBrush) {
| 0 | ||||||||||||||||||||||||||||||
| 1344 | if (br != QPalette::NoRole)
| 0 | ||||||||||||||||||||||||||||||
| 1345 | p->setBrush(br, bg->brush); never executed: p->setBrush(br, bg->brush); | 0 | ||||||||||||||||||||||||||||||
| 1346 | p->setBrush(QPalette::Window, bg->brush); | - | ||||||||||||||||||||||||||||||
| 1347 | if (bg->brush.style() == Qt::SolidPattern) {
| 0 | ||||||||||||||||||||||||||||||
| 1348 | p->setBrush(QPalette::Light, bg->brush.color().lighter(115)); | - | ||||||||||||||||||||||||||||||
| 1349 | p->setBrush(QPalette::Midlight, bg->brush.color().lighter(107)); | - | ||||||||||||||||||||||||||||||
| 1350 | p->setBrush(QPalette::Dark, bg->brush.color().darker(150)); | - | ||||||||||||||||||||||||||||||
| 1351 | p->setBrush(QPalette::Shadow, bg->brush.color().darker(300)); | - | ||||||||||||||||||||||||||||||
| 1352 | } never executed: end of block | 0 | ||||||||||||||||||||||||||||||
| 1353 | } never executed: end of block | 0 | ||||||||||||||||||||||||||||||
| 1354 | - | |||||||||||||||||||||||||||||||
| 1355 | if (!hasPalette())
| 0 | ||||||||||||||||||||||||||||||
| 1356 | return; never executed: return; | 0 | ||||||||||||||||||||||||||||||
| 1357 | - | |||||||||||||||||||||||||||||||
| 1358 | if (pal->foreground.style() != Qt::NoBrush) {
| 0 | ||||||||||||||||||||||||||||||
| 1359 | if (fr != QPalette::NoRole)
| 0 | ||||||||||||||||||||||||||||||
| 1360 | p->setBrush(fr, pal->foreground); never executed: p->setBrush(fr, pal->foreground); | 0 | ||||||||||||||||||||||||||||||
| 1361 | p->setBrush(QPalette::WindowText, pal->foreground); | - | ||||||||||||||||||||||||||||||
| 1362 | p->setBrush(QPalette::Text, pal->foreground); | - | ||||||||||||||||||||||||||||||
| 1363 | } never executed: end of block | 0 | ||||||||||||||||||||||||||||||
| 1364 | if (pal->selectionBackground.style() != Qt::NoBrush)
| 0 | ||||||||||||||||||||||||||||||
| 1365 | p->setBrush(QPalette::Highlight, pal->selectionBackground); never executed: p->setBrush(QPalette::Highlight, pal->selectionBackground); | 0 | ||||||||||||||||||||||||||||||
| 1366 | if (pal->selectionForeground.style() != Qt::NoBrush)
| 0 | ||||||||||||||||||||||||||||||
| 1367 | p->setBrush(QPalette::HighlightedText, pal->selectionForeground); never executed: p->setBrush(QPalette::HighlightedText, pal->selectionForeground); | 0 | ||||||||||||||||||||||||||||||
| 1368 | if (pal->alternateBackground.style() != Qt::NoBrush)
| 0 | ||||||||||||||||||||||||||||||
| 1369 | p->setBrush(QPalette::AlternateBase, pal->alternateBackground); never executed: p->setBrush(QPalette::AlternateBase, pal->alternateBackground); | 0 | ||||||||||||||||||||||||||||||
| 1370 | } never executed: end of block | 0 | ||||||||||||||||||||||||||||||
| 1371 | - | |||||||||||||||||||||||||||||||
| 1372 | void QRenderRule::configurePalette(QPalette *p, QPalette::ColorGroup cg, const QWidget *w, bool embedded) | - | ||||||||||||||||||||||||||||||
| 1373 | { | - | ||||||||||||||||||||||||||||||
| 1374 | if (bg && bg->brush.style() != Qt::NoBrush) {
| 0 | ||||||||||||||||||||||||||||||
| 1375 | p->setBrush(cg, QPalette::Base, bg->brush); // for windows, windowxp | - | ||||||||||||||||||||||||||||||
| 1376 | p->setBrush(cg, QPalette::Button, bg->brush); // for plastique | - | ||||||||||||||||||||||||||||||
| 1377 | p->setBrush(cg, w->backgroundRole(), bg->brush); | - | ||||||||||||||||||||||||||||||
| 1378 | p->setBrush(cg, QPalette::Window, bg->brush); | - | ||||||||||||||||||||||||||||||
| 1379 | } never executed: end of block | 0 | ||||||||||||||||||||||||||||||
| 1380 | - | |||||||||||||||||||||||||||||||
| 1381 | if (embedded) {
| 0 | ||||||||||||||||||||||||||||||
| 1382 | /* For embedded widgets (ComboBox, SpinBox and ScrollArea) we want the embedded widget | - | ||||||||||||||||||||||||||||||
| 1383 | * to be transparent when we have a transparent background or border image */ | - | ||||||||||||||||||||||||||||||
| 1384 | if ((hasBackground() && background()->isTransparent())
| 0 | ||||||||||||||||||||||||||||||
| 1385 | || (hasBorder() && border()->hasBorderImage() && !border()->borderImage()->pixmap.isNull()))
| 0 | ||||||||||||||||||||||||||||||
| 1386 | p->setBrush(cg, w->backgroundRole(), Qt::NoBrush); never executed: p->setBrush(cg, w->backgroundRole(), Qt::NoBrush); | 0 | ||||||||||||||||||||||||||||||
| 1387 | } never executed: end of block | 0 | ||||||||||||||||||||||||||||||
| 1388 | - | |||||||||||||||||||||||||||||||
| 1389 | if (!hasPalette())
| 0 | ||||||||||||||||||||||||||||||
| 1390 | return; never executed: return; | 0 | ||||||||||||||||||||||||||||||
| 1391 | - | |||||||||||||||||||||||||||||||
| 1392 | if (pal->foreground.style() != Qt::NoBrush) {
| 0 | ||||||||||||||||||||||||||||||
| 1393 | p->setBrush(cg, QPalette::ButtonText, pal->foreground); | - | ||||||||||||||||||||||||||||||
| 1394 | p->setBrush(cg, w->foregroundRole(), pal->foreground); | - | ||||||||||||||||||||||||||||||
| 1395 | p->setBrush(cg, QPalette::WindowText, pal->foreground); | - | ||||||||||||||||||||||||||||||
| 1396 | p->setBrush(cg, QPalette::Text, pal->foreground); | - | ||||||||||||||||||||||||||||||
| 1397 | } never executed: end of block | 0 | ||||||||||||||||||||||||||||||
| 1398 | if (pal->selectionBackground.style() != Qt::NoBrush)
| 0 | ||||||||||||||||||||||||||||||
| 1399 | p->setBrush(cg, QPalette::Highlight, pal->selectionBackground); never executed: p->setBrush(cg, QPalette::Highlight, pal->selectionBackground); | 0 | ||||||||||||||||||||||||||||||
| 1400 | if (pal->selectionForeground.style() != Qt::NoBrush)
| 0 | ||||||||||||||||||||||||||||||
| 1401 | p->setBrush(cg, QPalette::HighlightedText, pal->selectionForeground); never executed: p->setBrush(cg, QPalette::HighlightedText, pal->selectionForeground); | 0 | ||||||||||||||||||||||||||||||
| 1402 | if (pal->alternateBackground.style() != Qt::NoBrush)
| 0 | ||||||||||||||||||||||||||||||
| 1403 | p->setBrush(cg, QPalette::AlternateBase, pal->alternateBackground); never executed: p->setBrush(cg, QPalette::AlternateBase, pal->alternateBackground); | 0 | ||||||||||||||||||||||||||||||
| 1404 | } never executed: end of block | 0 | ||||||||||||||||||||||||||||||
| 1405 | - | |||||||||||||||||||||||||||||||
| 1406 | /////////////////////////////////////////////////////////////////////////////// | - | ||||||||||||||||||||||||||||||
| 1407 | // Style rules | - | ||||||||||||||||||||||||||||||
| 1408 | #define OBJECT_PTR(x) (static_cast<QObject *>(x.ptr)) | - | ||||||||||||||||||||||||||||||
| 1409 | - | |||||||||||||||||||||||||||||||
| 1410 | static inline QObject *parentObject(const QObject *obj) | - | ||||||||||||||||||||||||||||||
| 1411 | { | - | ||||||||||||||||||||||||||||||
| 1412 | if (qobject_cast<const QLabel *>(obj) && qstrcmp(obj->metaObject()->className(), "QTipLabel") == 0) {
| 0 | ||||||||||||||||||||||||||||||
| 1413 | QObject *p = qvariant_cast<QObject *>(obj->property("_q_stylesheet_parent")); | - | ||||||||||||||||||||||||||||||
| 1414 | if (p)
| 0 | ||||||||||||||||||||||||||||||
| 1415 | return p; never executed: return p; | 0 | ||||||||||||||||||||||||||||||
| 1416 | } never executed: end of block | 0 | ||||||||||||||||||||||||||||||
| 1417 | return obj->parent(); never executed: return obj->parent(); | 0 | ||||||||||||||||||||||||||||||
| 1418 | } | - | ||||||||||||||||||||||||||||||
| 1419 | - | |||||||||||||||||||||||||||||||
| 1420 | class QStyleSheetStyleSelector : public StyleSelector | - | ||||||||||||||||||||||||||||||
| 1421 | { | - | ||||||||||||||||||||||||||||||
| 1422 | public: | - | ||||||||||||||||||||||||||||||
| 1423 | QStyleSheetStyleSelector() { } | - | ||||||||||||||||||||||||||||||
| 1424 | - | |||||||||||||||||||||||||||||||
| 1425 | QStringList nodeNames(NodePtr node) const Q_DECL_OVERRIDE | - | ||||||||||||||||||||||||||||||
| 1426 | { | - | ||||||||||||||||||||||||||||||
| 1427 | if (isNullNode(node))
| 0 | ||||||||||||||||||||||||||||||
| 1428 | return QStringList(); never executed: return QStringList(); | 0 | ||||||||||||||||||||||||||||||
| 1429 | const QMetaObject *metaObject = OBJECT_PTR(node)->metaObject(); | - | ||||||||||||||||||||||||||||||
| 1430 | #ifndef QT_NO_TOOLTIP | - | ||||||||||||||||||||||||||||||
| 1431 | if (qstrcmp(metaObject->className(), "QTipLabel") == 0)
| 0 | ||||||||||||||||||||||||||||||
| 1432 | return QStringList(QLatin1String("QToolTip")); never executed: return QStringList(QLatin1String("QToolTip")); | 0 | ||||||||||||||||||||||||||||||
| 1433 | #endif | - | ||||||||||||||||||||||||||||||
| 1434 | QStringList result; | - | ||||||||||||||||||||||||||||||
| 1435 | do { | - | ||||||||||||||||||||||||||||||
| 1436 | result += QString::fromLatin1(metaObject->className()).replace(QLatin1Char(':'), QLatin1Char('-')); | - | ||||||||||||||||||||||||||||||
| 1437 | metaObject = metaObject->superClass(); | - | ||||||||||||||||||||||||||||||
| 1438 | } while (metaObject != 0); never executed: end of block
| 0 | ||||||||||||||||||||||||||||||
| 1439 | return result; never executed: return result; | 0 | ||||||||||||||||||||||||||||||
| 1440 | } | - | ||||||||||||||||||||||||||||||
| 1441 | QString attribute(NodePtr node, const QString& name) const Q_DECL_OVERRIDE | - | ||||||||||||||||||||||||||||||
| 1442 | { | - | ||||||||||||||||||||||||||||||
| 1443 | if (isNullNode(node))
| 0 | ||||||||||||||||||||||||||||||
| 1444 | return QString(); never executed: return QString(); | 0 | ||||||||||||||||||||||||||||||
| 1445 | - | |||||||||||||||||||||||||||||||
| 1446 | QHash<QString, QString> &cache = m_attributeCache[OBJECT_PTR(node)]; | - | ||||||||||||||||||||||||||||||
| 1447 | QHash<QString, QString>::const_iterator cacheIt = cache.constFind(name); | - | ||||||||||||||||||||||||||||||
| 1448 | if (cacheIt != cache.constEnd())
| 0 | ||||||||||||||||||||||||||||||
| 1449 | return cacheIt.value(); never executed: return cacheIt.value(); | 0 | ||||||||||||||||||||||||||||||
| 1450 | - | |||||||||||||||||||||||||||||||
| 1451 | QObject *obj = OBJECT_PTR(node); | - | ||||||||||||||||||||||||||||||
| 1452 | QVariant value = obj->property(name.toLatin1()); | - | ||||||||||||||||||||||||||||||
| 1453 | if (!value.isValid()) {
| 0 | ||||||||||||||||||||||||||||||
| 1454 | if (name == QLatin1String("class")) {
| 0 | ||||||||||||||||||||||||||||||
| 1455 | QString className = QString::fromLatin1(obj->metaObject()->className()); | - | ||||||||||||||||||||||||||||||
| 1456 | if (className.contains(QLatin1Char(':')))
| 0 | ||||||||||||||||||||||||||||||
| 1457 | className.replace(QLatin1Char(':'), QLatin1Char('-')); never executed: className.replace(QLatin1Char(':'), QLatin1Char('-')); | 0 | ||||||||||||||||||||||||||||||
| 1458 | cache[name] = className; | - | ||||||||||||||||||||||||||||||
| 1459 | return className; never executed: return className; | 0 | ||||||||||||||||||||||||||||||
| 1460 | } else if (name == QLatin1String("style")) {
| 0 | ||||||||||||||||||||||||||||||
| 1461 | QWidget *w = qobject_cast<QWidget *>(obj); | - | ||||||||||||||||||||||||||||||
| 1462 | QStyleSheetStyle *proxy = w ? qobject_cast<QStyleSheetStyle *>(w->style()) : 0;
| 0 | ||||||||||||||||||||||||||||||
| 1463 | if (proxy) {
| 0 | ||||||||||||||||||||||||||||||
| 1464 | QString styleName = QString::fromLatin1(proxy->baseStyle()->metaObject()->className()); | - | ||||||||||||||||||||||||||||||
| 1465 | cache[name] = styleName; | - | ||||||||||||||||||||||||||||||
| 1466 | return styleName; never executed: return styleName; | 0 | ||||||||||||||||||||||||||||||
| 1467 | } | - | ||||||||||||||||||||||||||||||
| 1468 | } never executed: end of block | 0 | ||||||||||||||||||||||||||||||
| 1469 | } never executed: end of block | 0 | ||||||||||||||||||||||||||||||
| 1470 | QString valueStr; | - | ||||||||||||||||||||||||||||||
| 1471 | if(value.type() == QVariant::StringList || value.type() == QVariant::List)
| 0 | ||||||||||||||||||||||||||||||
| 1472 | valueStr = value.toStringList().join(QLatin1Char(' ')); never executed: valueStr = value.toStringList().join(QLatin1Char(' ')); | 0 | ||||||||||||||||||||||||||||||
| 1473 | else | - | ||||||||||||||||||||||||||||||
| 1474 | valueStr = value.toString(); never executed: valueStr = value.toString(); | 0 | ||||||||||||||||||||||||||||||
| 1475 | cache[name] = valueStr; | - | ||||||||||||||||||||||||||||||
| 1476 | return valueStr; never executed: return valueStr; | 0 | ||||||||||||||||||||||||||||||
| 1477 | } | - | ||||||||||||||||||||||||||||||
| 1478 | bool nodeNameEquals(NodePtr node, const QString& nodeName) const Q_DECL_OVERRIDE | - | ||||||||||||||||||||||||||||||
| 1479 | { | - | ||||||||||||||||||||||||||||||
| 1480 | if (isNullNode(node))
| 0 | ||||||||||||||||||||||||||||||
| 1481 | return false; never executed: return false; | 0 | ||||||||||||||||||||||||||||||
| 1482 | const QMetaObject *metaObject = OBJECT_PTR(node)->metaObject(); | - | ||||||||||||||||||||||||||||||
| 1483 | #ifndef QT_NO_TOOLTIP | - | ||||||||||||||||||||||||||||||
| 1484 | if (qstrcmp(metaObject->className(), "QTipLabel") == 0)
| 0 | ||||||||||||||||||||||||||||||
| 1485 | return nodeName == QLatin1String("QToolTip"); never executed: return nodeName == QLatin1String("QToolTip"); | 0 | ||||||||||||||||||||||||||||||
| 1486 | #endif | - | ||||||||||||||||||||||||||||||
| 1487 | do { | - | ||||||||||||||||||||||||||||||
| 1488 | const ushort *uc = (const ushort *)nodeName.constData(); | - | ||||||||||||||||||||||||||||||
| 1489 | const ushort *e = uc + nodeName.length(); | - | ||||||||||||||||||||||||||||||
| 1490 | const uchar *c = (const uchar *)metaObject->className(); | - | ||||||||||||||||||||||||||||||
| 1491 | while (*c && uc != e && (*uc == *c || (*c == ':' && *uc == '-'))) {
| 0 | ||||||||||||||||||||||||||||||
| 1492 | ++uc; | - | ||||||||||||||||||||||||||||||
| 1493 | ++c; | - | ||||||||||||||||||||||||||||||
| 1494 | } never executed: end of block | 0 | ||||||||||||||||||||||||||||||
| 1495 | if (uc == e && !*c)
| 0 | ||||||||||||||||||||||||||||||
| 1496 | return true; never executed: return true; | 0 | ||||||||||||||||||||||||||||||
| 1497 | metaObject = metaObject->superClass(); | - | ||||||||||||||||||||||||||||||
| 1498 | } while (metaObject != 0); never executed: end of block
| 0 | ||||||||||||||||||||||||||||||
| 1499 | return false; never executed: return false; | 0 | ||||||||||||||||||||||||||||||
| 1500 | } | - | ||||||||||||||||||||||||||||||
| 1501 | bool hasAttributes(NodePtr) const Q_DECL_OVERRIDE | - | ||||||||||||||||||||||||||||||
| 1502 | { return true; } never executed: return true; | 0 | ||||||||||||||||||||||||||||||
| 1503 | QStringList nodeIds(NodePtr node) const Q_DECL_OVERRIDE | - | ||||||||||||||||||||||||||||||
| 1504 | { return isNullNode(node) ? QStringList() : QStringList(OBJECT_PTR(node)->objectName()); } never executed: return isNullNode(node) ? QStringList() : QStringList((static_cast<QObject *>(node.ptr))->objectName());
| 0 | ||||||||||||||||||||||||||||||
| 1505 | bool isNullNode(NodePtr node) const Q_DECL_OVERRIDE | - | ||||||||||||||||||||||||||||||
| 1506 | { return node.ptr == 0; } never executed: return node.ptr == 0; | 0 | ||||||||||||||||||||||||||||||
| 1507 | NodePtr parentNode(NodePtr node) const Q_DECL_OVERRIDE | - | ||||||||||||||||||||||||||||||
| 1508 | { NodePtr n; n.ptr = isNullNode(node) ? 0 : parentObject(OBJECT_PTR(node)); return n; } never executed: return n;
| 0 | ||||||||||||||||||||||||||||||
| 1509 | NodePtr previousSiblingNode(NodePtr) const Q_DECL_OVERRIDE | - | ||||||||||||||||||||||||||||||
| 1510 | { NodePtr n; n.ptr = 0; return n; } never executed: return n; | 0 | ||||||||||||||||||||||||||||||
| 1511 | NodePtr duplicateNode(NodePtr node) const Q_DECL_OVERRIDE | - | ||||||||||||||||||||||||||||||
| 1512 | { return node; } never executed: return node; | 0 | ||||||||||||||||||||||||||||||
| 1513 | void freeNode(NodePtr) const Q_DECL_OVERRIDE | - | ||||||||||||||||||||||||||||||
| 1514 | { } | - | ||||||||||||||||||||||||||||||
| 1515 | - | |||||||||||||||||||||||||||||||
| 1516 | private: | - | ||||||||||||||||||||||||||||||
| 1517 | mutable QHash<const QObject *, QHash<QString, QString> > m_attributeCache; | - | ||||||||||||||||||||||||||||||
| 1518 | }; | - | ||||||||||||||||||||||||||||||
| 1519 | - | |||||||||||||||||||||||||||||||
| 1520 | QVector<QCss::StyleRule> QStyleSheetStyle::styleRules(const QObject *obj) const | - | ||||||||||||||||||||||||||||||
| 1521 | { | - | ||||||||||||||||||||||||||||||
| 1522 | QHash<const QObject *, QVector<StyleRule> >::const_iterator cacheIt = styleSheetCaches->styleRulesCache.constFind(obj); | - | ||||||||||||||||||||||||||||||
| 1523 | if (cacheIt != styleSheetCaches->styleRulesCache.constEnd())
| 0 | ||||||||||||||||||||||||||||||
| 1524 | return cacheIt.value(); never executed: return cacheIt.value(); | 0 | ||||||||||||||||||||||||||||||
| 1525 | - | |||||||||||||||||||||||||||||||
| 1526 | if (!initObject(obj)) {
| 0 | ||||||||||||||||||||||||||||||
| 1527 | return QVector<StyleRule>(); never executed: return QVector<StyleRule>(); | 0 | ||||||||||||||||||||||||||||||
| 1528 | } | - | ||||||||||||||||||||||||||||||
| 1529 | - | |||||||||||||||||||||||||||||||
| 1530 | QStyleSheetStyleSelector styleSelector; | - | ||||||||||||||||||||||||||||||
| 1531 | - | |||||||||||||||||||||||||||||||
| 1532 | StyleSheet defaultSs; | - | ||||||||||||||||||||||||||||||
| 1533 | QHash<const void *, StyleSheet>::const_iterator defaultCacheIt = styleSheetCaches->styleSheetCache.constFind(baseStyle()); | - | ||||||||||||||||||||||||||||||
| 1534 | if (defaultCacheIt == styleSheetCaches->styleSheetCache.constEnd()) {
| 0 | ||||||||||||||||||||||||||||||
| 1535 | defaultSs = getDefaultStyleSheet(); | - | ||||||||||||||||||||||||||||||
| 1536 | QStyle *bs = baseStyle(); | - | ||||||||||||||||||||||||||||||
| 1537 | styleSheetCaches->styleSheetCache.insert(bs, defaultSs); | - | ||||||||||||||||||||||||||||||
| 1538 | QObject::connect(bs, SIGNAL(destroyed(QObject*)), styleSheetCaches, SLOT(styleDestroyed(QObject*)), Qt::UniqueConnection); | - | ||||||||||||||||||||||||||||||
| 1539 | } else { never executed: end of block | 0 | ||||||||||||||||||||||||||||||
| 1540 | defaultSs = defaultCacheIt.value(); | - | ||||||||||||||||||||||||||||||
| 1541 | } never executed: end of block | 0 | ||||||||||||||||||||||||||||||
| 1542 | styleSelector.styleSheets += defaultSs; | - | ||||||||||||||||||||||||||||||
| 1543 | - | |||||||||||||||||||||||||||||||
| 1544 | if (!qApp->styleSheet().isEmpty()) {
| 0 | ||||||||||||||||||||||||||||||
| 1545 | StyleSheet appSs; | - | ||||||||||||||||||||||||||||||
| 1546 | QHash<const void *, StyleSheet>::const_iterator appCacheIt = styleSheetCaches->styleSheetCache.constFind(qApp); | - | ||||||||||||||||||||||||||||||
| 1547 | if (appCacheIt == styleSheetCaches->styleSheetCache.constEnd()) {
| 0 | ||||||||||||||||||||||||||||||
| 1548 | QString ss = qApp->styleSheet(); | - | ||||||||||||||||||||||||||||||
| 1549 | if (ss.startsWith(QLatin1String("file:///")))
| 0 | ||||||||||||||||||||||||||||||
| 1550 | ss.remove(0, 8); never executed: ss.remove(0, 8); | 0 | ||||||||||||||||||||||||||||||
| 1551 | parser.init(ss, qApp->styleSheet() != ss); | - | ||||||||||||||||||||||||||||||
| 1552 | if (!parser.parse(&appSs))
| 0 | ||||||||||||||||||||||||||||||
| 1553 | qWarning("Could not parse application stylesheet"); never executed: QMessageLogger(__FILE__, 1553, __PRETTY_FUNCTION__).warning("Could not parse application stylesheet"); | 0 | ||||||||||||||||||||||||||||||
| 1554 | appSs.origin = StyleSheetOrigin_Inline; | - | ||||||||||||||||||||||||||||||
| 1555 | appSs.depth = 1; | - | ||||||||||||||||||||||||||||||
| 1556 | styleSheetCaches->styleSheetCache.insert(qApp, appSs); | - | ||||||||||||||||||||||||||||||
| 1557 | } else { never executed: end of block | 0 | ||||||||||||||||||||||||||||||
| 1558 | appSs = appCacheIt.value(); | - | ||||||||||||||||||||||||||||||
| 1559 | } never executed: end of block | 0 | ||||||||||||||||||||||||||||||
| 1560 | styleSelector.styleSheets += appSs; | - | ||||||||||||||||||||||||||||||
| 1561 | } never executed: end of block | 0 | ||||||||||||||||||||||||||||||
| 1562 | - | |||||||||||||||||||||||||||||||
| 1563 | QVector<QCss::StyleSheet> objectSs; | - | ||||||||||||||||||||||||||||||
| 1564 | for (const QObject *o = obj; o; o = parentObject(o)) {
| 0 | ||||||||||||||||||||||||||||||
| 1565 | QString styleSheet = o->property("styleSheet").toString(); | - | ||||||||||||||||||||||||||||||
| 1566 | if (styleSheet.isEmpty())
| 0 | ||||||||||||||||||||||||||||||
| 1567 | continue; never executed: continue; | 0 | ||||||||||||||||||||||||||||||
| 1568 | StyleSheet ss; | - | ||||||||||||||||||||||||||||||
| 1569 | QHash<const void *, StyleSheet>::const_iterator objCacheIt = styleSheetCaches->styleSheetCache.constFind(o); | - | ||||||||||||||||||||||||||||||
| 1570 | if (objCacheIt == styleSheetCaches->styleSheetCache.constEnd()) {
| 0 | ||||||||||||||||||||||||||||||
| 1571 | parser.init(styleSheet); | - | ||||||||||||||||||||||||||||||
| 1572 | if (!parser.parse(&ss)) {
| 0 | ||||||||||||||||||||||||||||||
| 1573 | parser.init(QLatin1String("* {") + styleSheet + QLatin1Char('}')); | - | ||||||||||||||||||||||||||||||
| 1574 | if (!parser.parse(&ss))
| 0 | ||||||||||||||||||||||||||||||
| 1575 | qWarning("Could not parse stylesheet of object %p", o); never executed: QMessageLogger(__FILE__, 1575, __PRETTY_FUNCTION__).warning("Could not parse stylesheet of object %p", o); | 0 | ||||||||||||||||||||||||||||||
| 1576 | } never executed: end of block | 0 | ||||||||||||||||||||||||||||||
| 1577 | ss.origin = StyleSheetOrigin_Inline; | - | ||||||||||||||||||||||||||||||
| 1578 | styleSheetCaches->styleSheetCache.insert(o, ss); | - | ||||||||||||||||||||||||||||||
| 1579 | } else { never executed: end of block | 0 | ||||||||||||||||||||||||||||||
| 1580 | ss = objCacheIt.value(); | - | ||||||||||||||||||||||||||||||
| 1581 | } never executed: end of block | 0 | ||||||||||||||||||||||||||||||
| 1582 | objectSs.append(ss); | - | ||||||||||||||||||||||||||||||
| 1583 | } never executed: end of block | 0 | ||||||||||||||||||||||||||||||
| 1584 | - | |||||||||||||||||||||||||||||||
| 1585 | for (int i = 0; i < objectSs.count(); i++)
| 0 | ||||||||||||||||||||||||||||||
| 1586 | objectSs[i].depth = objectSs.count() - i + 2; never executed: objectSs[i].depth = objectSs.count() - i + 2; | 0 | ||||||||||||||||||||||||||||||
| 1587 | - | |||||||||||||||||||||||||||||||
| 1588 | styleSelector.styleSheets += objectSs; | - | ||||||||||||||||||||||||||||||
| 1589 | - | |||||||||||||||||||||||||||||||
| 1590 | StyleSelector::NodePtr n; | - | ||||||||||||||||||||||||||||||
| 1591 | n.ptr = const_cast<QObject *>(obj); | - | ||||||||||||||||||||||||||||||
| 1592 | QVector<QCss::StyleRule> rules = styleSelector.styleRulesForNode(n); | - | ||||||||||||||||||||||||||||||
| 1593 | styleSheetCaches->styleRulesCache.insert(obj, rules); | - | ||||||||||||||||||||||||||||||
| 1594 | return rules; never executed: return rules; | 0 | ||||||||||||||||||||||||||||||
| 1595 | } | - | ||||||||||||||||||||||||||||||
| 1596 | - | |||||||||||||||||||||||||||||||
| 1597 | ///////////////////////////////////////////////////////////////////////////////////////// | - | ||||||||||||||||||||||||||||||
| 1598 | // Rendering rules | - | ||||||||||||||||||||||||||||||
| 1599 | static QVector<Declaration> declarations(const QVector<StyleRule> &styleRules, const QString &part, quint64 pseudoClass = PseudoClass_Unspecified) | - | ||||||||||||||||||||||||||||||
| 1600 | { | - | ||||||||||||||||||||||||||||||
| 1601 | QVector<Declaration> decls; | - | ||||||||||||||||||||||||||||||
| 1602 | for (int i = 0; i < styleRules.count(); i++) {
| 0 | ||||||||||||||||||||||||||||||
| 1603 | const Selector& selector = styleRules.at(i).selectors.at(0); | - | ||||||||||||||||||||||||||||||
| 1604 | // Rules with pseudo elements don't cascade. This is an intentional | - | ||||||||||||||||||||||||||||||
| 1605 | // diversion for CSS | - | ||||||||||||||||||||||||||||||
| 1606 | if (part.compare(selector.pseudoElement(), Qt::CaseInsensitive) != 0)
| 0 | ||||||||||||||||||||||||||||||
| 1607 | continue; never executed: continue; | 0 | ||||||||||||||||||||||||||||||
| 1608 | quint64 negated = 0; | - | ||||||||||||||||||||||||||||||
| 1609 | quint64 cssClass = selector.pseudoClass(&negated); | - | ||||||||||||||||||||||||||||||
| 1610 | if ((pseudoClass == PseudoClass_Any) || (cssClass == PseudoClass_Unspecified)
| 0 | ||||||||||||||||||||||||||||||
| 1611 | || ((((cssClass & pseudoClass) == cssClass)) && ((negated & pseudoClass) == 0)))
| 0 | ||||||||||||||||||||||||||||||
| 1612 | decls += styleRules.at(i).declarations; never executed: decls += styleRules.at(i).declarations; | 0 | ||||||||||||||||||||||||||||||
| 1613 | } never executed: end of block | 0 | ||||||||||||||||||||||||||||||
| 1614 | return decls; never executed: return decls; | 0 | ||||||||||||||||||||||||||||||
| 1615 | } | - | ||||||||||||||||||||||||||||||
| 1616 | - | |||||||||||||||||||||||||||||||
| 1617 | int QStyleSheetStyle::nativeFrameWidth(const QWidget *w) | - | ||||||||||||||||||||||||||||||
| 1618 | { | - | ||||||||||||||||||||||||||||||
| 1619 | QStyle *base = baseStyle(); | - | ||||||||||||||||||||||||||||||
| 1620 | - | |||||||||||||||||||||||||||||||
| 1621 | #ifndef QT_NO_SPINBOX | - | ||||||||||||||||||||||||||||||
| 1622 | if (qobject_cast<const QAbstractSpinBox *>(w))
| 0 | ||||||||||||||||||||||||||||||
| 1623 | return base->pixelMetric(QStyle::PM_SpinBoxFrameWidth, 0, w); never executed: return base->pixelMetric(QStyle::PM_SpinBoxFrameWidth, 0, w); | 0 | ||||||||||||||||||||||||||||||
| 1624 | #endif | - | ||||||||||||||||||||||||||||||
| 1625 | - | |||||||||||||||||||||||||||||||
| 1626 | #ifndef QT_NO_COMBOBOX | - | ||||||||||||||||||||||||||||||
| 1627 | if (qobject_cast<const QComboBox *>(w))
| 0 | ||||||||||||||||||||||||||||||
| 1628 | return base->pixelMetric(QStyle::PM_ComboBoxFrameWidth, 0, w); never executed: return base->pixelMetric(QStyle::PM_ComboBoxFrameWidth, 0, w); | 0 | ||||||||||||||||||||||||||||||
| 1629 | #endif | - | ||||||||||||||||||||||||||||||
| 1630 | - | |||||||||||||||||||||||||||||||
| 1631 | #ifndef QT_NO_MENU | - | ||||||||||||||||||||||||||||||
| 1632 | if (qobject_cast<const QMenu *>(w))
| 0 | ||||||||||||||||||||||||||||||
| 1633 | return base->pixelMetric(QStyle::PM_MenuPanelWidth, 0, w); never executed: return base->pixelMetric(QStyle::PM_MenuPanelWidth, 0, w); | 0 | ||||||||||||||||||||||||||||||
| 1634 | #endif | - | ||||||||||||||||||||||||||||||
| 1635 | - | |||||||||||||||||||||||||||||||
| 1636 | #ifndef QT_NO_MENUBAR | - | ||||||||||||||||||||||||||||||
| 1637 | if (qobject_cast<const QMenuBar *>(w))
| 0 | ||||||||||||||||||||||||||||||
| 1638 | return base->pixelMetric(QStyle::PM_MenuBarPanelWidth, 0, w); never executed: return base->pixelMetric(QStyle::PM_MenuBarPanelWidth, 0, w); | 0 | ||||||||||||||||||||||||||||||
| 1639 | #endif | - | ||||||||||||||||||||||||||||||
| 1640 | #ifndef QT_NO_FRAME | - | ||||||||||||||||||||||||||||||
| 1641 | if (const QFrame *frame = qobject_cast<const QFrame *>(w)) {
| 0 | ||||||||||||||||||||||||||||||
| 1642 | if (frame->frameShape() == QFrame::NoFrame)
| 0 | ||||||||||||||||||||||||||||||
| 1643 | return 0; never executed: return 0; | 0 | ||||||||||||||||||||||||||||||
| 1644 | } never executed: end of block | 0 | ||||||||||||||||||||||||||||||
| 1645 | #endif | - | ||||||||||||||||||||||||||||||
| 1646 | - | |||||||||||||||||||||||||||||||
| 1647 | if (qstrcmp(w->metaObject()->className(), "QTipLabel") == 0)
| 0 | ||||||||||||||||||||||||||||||
| 1648 | return base->pixelMetric(QStyle::PM_ToolTipLabelFrameWidth, 0, w); never executed: return base->pixelMetric(QStyle::PM_ToolTipLabelFrameWidth, 0, w); | 0 | ||||||||||||||||||||||||||||||
| 1649 | - | |||||||||||||||||||||||||||||||
| 1650 | return base->pixelMetric(QStyle::PM_DefaultFrameWidth, 0, w); never executed: return base->pixelMetric(QStyle::PM_DefaultFrameWidth, 0, w); | 0 | ||||||||||||||||||||||||||||||
| 1651 | } | - | ||||||||||||||||||||||||||||||
| 1652 | - | |||||||||||||||||||||||||||||||
| 1653 | static quint64 pseudoClass(QStyle::State state) | - | ||||||||||||||||||||||||||||||
| 1654 | { | - | ||||||||||||||||||||||||||||||
| 1655 | quint64 pc = 0; | - | ||||||||||||||||||||||||||||||
| 1656 | if (state & QStyle::State_Enabled) {
| 0 | ||||||||||||||||||||||||||||||
| 1657 | pc |= PseudoClass_Enabled; | - | ||||||||||||||||||||||||||||||
| 1658 | if (state & QStyle::State_MouseOver)
| 0 | ||||||||||||||||||||||||||||||
| 1659 | pc |= PseudoClass_Hover; never executed: pc |= PseudoClass_Hover; | 0 | ||||||||||||||||||||||||||||||
| 1660 | } else { never executed: end of block | 0 | ||||||||||||||||||||||||||||||
| 1661 | pc |= PseudoClass_Disabled; | - | ||||||||||||||||||||||||||||||
| 1662 | } never executed: end of block | 0 | ||||||||||||||||||||||||||||||
| 1663 | if (state & QStyle::State_Active)
| 0 | ||||||||||||||||||||||||||||||
| 1664 | pc |= PseudoClass_Active; never executed: pc |= PseudoClass_Active; | 0 | ||||||||||||||||||||||||||||||
| 1665 | if (state & QStyle::State_Window)
| 0 | ||||||||||||||||||||||||||||||
| 1666 | pc |= PseudoClass_Window; never executed: pc |= PseudoClass_Window; | 0 | ||||||||||||||||||||||||||||||
| 1667 | if (state & QStyle::State_Sunken)
| 0 | ||||||||||||||||||||||||||||||
| 1668 | pc |= PseudoClass_Pressed; never executed: pc |= PseudoClass_Pressed; | 0 | ||||||||||||||||||||||||||||||
| 1669 | if (state & QStyle::State_HasFocus)
| 0 | ||||||||||||||||||||||||||||||
| 1670 | pc |= PseudoClass_Focus; never executed: pc |= PseudoClass_Focus; | 0 | ||||||||||||||||||||||||||||||
| 1671 | if (state & QStyle::State_On)
| 0 | ||||||||||||||||||||||||||||||
| 1672 | pc |= (PseudoClass_On | PseudoClass_Checked); never executed: pc |= (PseudoClass_On | PseudoClass_Checked); | 0 | ||||||||||||||||||||||||||||||
| 1673 | if (state & QStyle::State_Off)
| 0 | ||||||||||||||||||||||||||||||
| 1674 | pc |= (PseudoClass_Off | PseudoClass_Unchecked); never executed: pc |= (PseudoClass_Off | PseudoClass_Unchecked); | 0 | ||||||||||||||||||||||||||||||
| 1675 | if (state & QStyle::State_NoChange)
| 0 | ||||||||||||||||||||||||||||||
| 1676 | pc |= PseudoClass_Indeterminate; never executed: pc |= PseudoClass_Indeterminate; | 0 | ||||||||||||||||||||||||||||||
| 1677 | if (state & QStyle::State_Selected)
| 0 | ||||||||||||||||||||||||||||||
| 1678 | pc |= PseudoClass_Selected; never executed: pc |= PseudoClass_Selected; | 0 | ||||||||||||||||||||||||||||||
| 1679 | if (state & QStyle::State_Horizontal)
| 0 | ||||||||||||||||||||||||||||||
| 1680 | pc |= PseudoClass_Horizontal; never executed: pc |= PseudoClass_Horizontal; | 0 | ||||||||||||||||||||||||||||||
| 1681 | else | - | ||||||||||||||||||||||||||||||
| 1682 | pc |= PseudoClass_Vertical; never executed: pc |= PseudoClass_Vertical; | 0 | ||||||||||||||||||||||||||||||
| 1683 | if (state & (QStyle::State_Open | QStyle::State_On | QStyle::State_Sunken))
| 0 | ||||||||||||||||||||||||||||||
| 1684 | pc |= PseudoClass_Open; never executed: pc |= PseudoClass_Open; | 0 | ||||||||||||||||||||||||||||||
| 1685 | else | - | ||||||||||||||||||||||||||||||
| 1686 | pc |= PseudoClass_Closed; never executed: pc |= PseudoClass_Closed; | 0 | ||||||||||||||||||||||||||||||
| 1687 | if (state & QStyle::State_Children)
| 0 | ||||||||||||||||||||||||||||||
| 1688 | pc |= PseudoClass_Children; never executed: pc |= PseudoClass_Children; | 0 | ||||||||||||||||||||||||||||||
| 1689 | if (state & QStyle::State_Sibling)
| 0 | ||||||||||||||||||||||||||||||
| 1690 | pc |= PseudoClass_Sibling; never executed: pc |= PseudoClass_Sibling; | 0 | ||||||||||||||||||||||||||||||
| 1691 | if (state & QStyle::State_ReadOnly)
| 0 | ||||||||||||||||||||||||||||||
| 1692 | pc |= PseudoClass_ReadOnly; never executed: pc |= PseudoClass_ReadOnly; | 0 | ||||||||||||||||||||||||||||||
| 1693 | if (state & QStyle::State_Item)
| 0 | ||||||||||||||||||||||||||||||
| 1694 | pc |= PseudoClass_Item; never executed: pc |= PseudoClass_Item; | 0 | ||||||||||||||||||||||||||||||
| 1695 | #ifdef QT_KEYPAD_NAVIGATION | - | ||||||||||||||||||||||||||||||
| 1696 | if (state & QStyle::State_HasEditFocus) | - | ||||||||||||||||||||||||||||||
| 1697 | pc |= PseudoClass_EditFocus; | - | ||||||||||||||||||||||||||||||
| 1698 | #endif | - | ||||||||||||||||||||||||||||||
| 1699 | return pc; never executed: return pc; | 0 | ||||||||||||||||||||||||||||||
| 1700 | } | - | ||||||||||||||||||||||||||||||
| 1701 | - | |||||||||||||||||||||||||||||||
| 1702 | static void qt_check_if_internal_object(const QObject **obj, int *element) | - | ||||||||||||||||||||||||||||||
| 1703 | { | - | ||||||||||||||||||||||||||||||
| 1704 | #ifdef QT_NO_DOCKWIDGET | - | ||||||||||||||||||||||||||||||
| 1705 | Q_UNUSED(obj); | - | ||||||||||||||||||||||||||||||
| 1706 | Q_UNUSED(element); | - | ||||||||||||||||||||||||||||||
| 1707 | #else | - | ||||||||||||||||||||||||||||||
| 1708 | if (*obj && qstrcmp((*obj)->metaObject()->className(), "QDockWidgetTitleButton") == 0) {
| 0 | ||||||||||||||||||||||||||||||
| 1709 | if ((*obj)->objectName() == QLatin1String("qt_dockwidget_closebutton")) {
| 0 | ||||||||||||||||||||||||||||||
| 1710 | *element = PseudoElement_DockWidgetCloseButton; | - | ||||||||||||||||||||||||||||||
| 1711 | } else if ((*obj)->objectName() == QLatin1String("qt_dockwidget_floatbutton")) { never executed: end of block
| 0 | ||||||||||||||||||||||||||||||
| 1712 | *element = PseudoElement_DockWidgetFloatButton; | - | ||||||||||||||||||||||||||||||
| 1713 | } never executed: end of block | 0 | ||||||||||||||||||||||||||||||
| 1714 | *obj = (*obj)->parent(); | - | ||||||||||||||||||||||||||||||
| 1715 | } never executed: end of block | 0 | ||||||||||||||||||||||||||||||
| 1716 | #endif | - | ||||||||||||||||||||||||||||||
| 1717 | } never executed: end of block | 0 | ||||||||||||||||||||||||||||||
| 1718 | - | |||||||||||||||||||||||||||||||
| 1719 | QRenderRule QStyleSheetStyle::renderRule(const QObject *obj, int element, quint64 state) const | - | ||||||||||||||||||||||||||||||
| 1720 | { | - | ||||||||||||||||||||||||||||||
| 1721 | qt_check_if_internal_object(&obj, &element); | - | ||||||||||||||||||||||||||||||
| 1722 | QHash<quint64, QRenderRule> &cache = styleSheetCaches->renderRulesCache[obj][element]; | - | ||||||||||||||||||||||||||||||
| 1723 | QHash<quint64, QRenderRule>::const_iterator cacheIt = cache.constFind(state); | - | ||||||||||||||||||||||||||||||
| 1724 | if (cacheIt != cache.constEnd())
| 0 | ||||||||||||||||||||||||||||||
| 1725 | return cacheIt.value(); never executed: return cacheIt.value(); | 0 | ||||||||||||||||||||||||||||||
| 1726 | - | |||||||||||||||||||||||||||||||
| 1727 | if (!initObject(obj))
| 0 | ||||||||||||||||||||||||||||||
| 1728 | return QRenderRule(); never executed: return QRenderRule(); | 0 | ||||||||||||||||||||||||||||||
| 1729 | - | |||||||||||||||||||||||||||||||
| 1730 | quint64 stateMask = 0; | - | ||||||||||||||||||||||||||||||
| 1731 | const QVector<StyleRule> rules = styleRules(obj); | - | ||||||||||||||||||||||||||||||
| 1732 | for (int i = 0; i < rules.count(); i++) {
| 0 | ||||||||||||||||||||||||||||||
| 1733 | const Selector& selector = rules.at(i).selectors.at(0); | - | ||||||||||||||||||||||||||||||
| 1734 | quint64 negated = 0; | - | ||||||||||||||||||||||||||||||
| 1735 | stateMask |= selector.pseudoClass(&negated); | - | ||||||||||||||||||||||||||||||
| 1736 | stateMask |= negated; | - | ||||||||||||||||||||||||||||||
| 1737 | } never executed: end of block | 0 | ||||||||||||||||||||||||||||||
| 1738 | - | |||||||||||||||||||||||||||||||
| 1739 | cacheIt = cache.constFind(state & stateMask); | - | ||||||||||||||||||||||||||||||
| 1740 | if (cacheIt != cache.constEnd()) {
| 0 | ||||||||||||||||||||||||||||||
| 1741 | const QRenderRule &newRule = cacheIt.value(); | - | ||||||||||||||||||||||||||||||
| 1742 | cache[state] = newRule; | - | ||||||||||||||||||||||||||||||
| 1743 | return newRule; never executed: return newRule; | 0 | ||||||||||||||||||||||||||||||
| 1744 | } | - | ||||||||||||||||||||||||||||||
| 1745 | - | |||||||||||||||||||||||||||||||
| 1746 | - | |||||||||||||||||||||||||||||||
| 1747 | const QString part = QLatin1String(knownPseudoElements[element].name); | - | ||||||||||||||||||||||||||||||
| 1748 | QVector<Declaration> decls = declarations(rules, part, state); | - | ||||||||||||||||||||||||||||||
| 1749 | QRenderRule newRule(decls, obj); | - | ||||||||||||||||||||||||||||||
| 1750 | cache[state] = newRule; | - | ||||||||||||||||||||||||||||||
| 1751 | if ((state & stateMask) != state)
| 0 | ||||||||||||||||||||||||||||||
| 1752 | cache[state&stateMask] = newRule; never executed: cache[state&stateMask] = newRule; | 0 | ||||||||||||||||||||||||||||||
| 1753 | return newRule; never executed: return newRule; | 0 | ||||||||||||||||||||||||||||||
| 1754 | } | - | ||||||||||||||||||||||||||||||
| 1755 | - | |||||||||||||||||||||||||||||||
| 1756 | QRenderRule QStyleSheetStyle::renderRule(const QObject *obj, const QStyleOption *opt, int pseudoElement) const | - | ||||||||||||||||||||||||||||||
| 1757 | { | - | ||||||||||||||||||||||||||||||
| 1758 | quint64 extraClass = 0; | - | ||||||||||||||||||||||||||||||
| 1759 | QStyle::State state = opt ? opt->state : QStyle::State(QStyle::State_None);
| 0 | ||||||||||||||||||||||||||||||
| 1760 | - | |||||||||||||||||||||||||||||||
| 1761 | if (const QStyleOptionComplex *complex = qstyleoption_cast<const QStyleOptionComplex *>(opt)) {
| 0 | ||||||||||||||||||||||||||||||
| 1762 | if (pseudoElement != PseudoElement_None) {
| 0 | ||||||||||||||||||||||||||||||
| 1763 | // if not an active subcontrol, just pass enabled/disabled | - | ||||||||||||||||||||||||||||||
| 1764 | QStyle::SubControl subControl = knownPseudoElements[pseudoElement].subControl; | - | ||||||||||||||||||||||||||||||
| 1765 | - | |||||||||||||||||||||||||||||||
| 1766 | if (!(complex->activeSubControls & subControl))
| 0 | ||||||||||||||||||||||||||||||
| 1767 | state &= (QStyle::State_Enabled | QStyle::State_Horizontal | QStyle::State_HasFocus); never executed: state &= (QStyle::State_Enabled | QStyle::State_Horizontal | QStyle::State_HasFocus); | 0 | ||||||||||||||||||||||||||||||
| 1768 | } never executed: end of block | 0 | ||||||||||||||||||||||||||||||
| 1769 | - | |||||||||||||||||||||||||||||||
| 1770 | switch (pseudoElement) { | - | ||||||||||||||||||||||||||||||
| 1771 | case PseudoElement_ComboBoxDropDown: never executed: case PseudoElement_ComboBoxDropDown: | 0 | ||||||||||||||||||||||||||||||
| 1772 | case PseudoElement_ComboBoxArrow: never executed: case PseudoElement_ComboBoxArrow: | 0 | ||||||||||||||||||||||||||||||
| 1773 | state |= (complex->state & (QStyle::State_On|QStyle::State_ReadOnly)); | - | ||||||||||||||||||||||||||||||
| 1774 | break; never executed: break; | 0 | ||||||||||||||||||||||||||||||
| 1775 | case PseudoElement_SpinBoxUpButton: never executed: case PseudoElement_SpinBoxUpButton: | 0 | ||||||||||||||||||||||||||||||
| 1776 | case PseudoElement_SpinBoxDownButton: never executed: case PseudoElement_SpinBoxDownButton: | 0 | ||||||||||||||||||||||||||||||
| 1777 | case PseudoElement_SpinBoxUpArrow: never executed: case PseudoElement_SpinBoxUpArrow: | 0 | ||||||||||||||||||||||||||||||
| 1778 | case PseudoElement_SpinBoxDownArrow: never executed: case PseudoElement_SpinBoxDownArrow: | 0 | ||||||||||||||||||||||||||||||
| 1779 | #ifndef QT_NO_SPINBOX | - | ||||||||||||||||||||||||||||||
| 1780 | if (const QStyleOptionSpinBox *sb = qstyleoption_cast<const QStyleOptionSpinBox *>(opt)) {
| 0 | ||||||||||||||||||||||||||||||
| 1781 | bool on = false; | - | ||||||||||||||||||||||||||||||
| 1782 | bool up = pseudoElement == PseudoElement_SpinBoxUpButton
| 0 | ||||||||||||||||||||||||||||||
| 1783 | || pseudoElement == PseudoElement_SpinBoxUpArrow;
| 0 | ||||||||||||||||||||||||||||||
| 1784 | if ((sb->stepEnabled & QAbstractSpinBox::StepUpEnabled) && up)
| 0 | ||||||||||||||||||||||||||||||
| 1785 | on = true; never executed: on = true; | 0 | ||||||||||||||||||||||||||||||
| 1786 | else if ((sb->stepEnabled & QAbstractSpinBox::StepDownEnabled) && !up)
| 0 | ||||||||||||||||||||||||||||||
| 1787 | on = true; never executed: on = true; | 0 | ||||||||||||||||||||||||||||||
| 1788 | state |= (on ? QStyle::State_On : QStyle::State_Off);
| 0 | ||||||||||||||||||||||||||||||
| 1789 | } never executed: end of block | 0 | ||||||||||||||||||||||||||||||
| 1790 | #endif // QT_NO_SPINBOX | - | ||||||||||||||||||||||||||||||
| 1791 | break; never executed: break; | 0 | ||||||||||||||||||||||||||||||
| 1792 | case PseudoElement_GroupBoxTitle: never executed: case PseudoElement_GroupBoxTitle: | 0 | ||||||||||||||||||||||||||||||
| 1793 | state |= (complex->state & (QStyle::State_MouseOver | QStyle::State_Sunken)); | - | ||||||||||||||||||||||||||||||
| 1794 | break; never executed: break; | 0 | ||||||||||||||||||||||||||||||
| 1795 | case PseudoElement_ToolButtonMenu: never executed: case PseudoElement_ToolButtonMenu: | 0 | ||||||||||||||||||||||||||||||
| 1796 | case PseudoElement_ToolButtonMenuArrow: never executed: case PseudoElement_ToolButtonMenuArrow: | 0 | ||||||||||||||||||||||||||||||
| 1797 | case PseudoElement_ToolButtonDownArrow: never executed: case PseudoElement_ToolButtonDownArrow: | 0 | ||||||||||||||||||||||||||||||
| 1798 | state |= complex->state & QStyle::State_MouseOver; | - | ||||||||||||||||||||||||||||||
| 1799 | if (complex->state & QStyle::State_Sunken ||
| 0 | ||||||||||||||||||||||||||||||
| 1800 | complex->activeSubControls & QStyle::SC_ToolButtonMenu)
| 0 | ||||||||||||||||||||||||||||||
| 1801 | state |= QStyle::State_Sunken; never executed: state |= QStyle::State_Sunken; | 0 | ||||||||||||||||||||||||||||||
| 1802 | break; never executed: break; | 0 | ||||||||||||||||||||||||||||||
| 1803 | case PseudoElement_SliderGroove: never executed: case PseudoElement_SliderGroove: | 0 | ||||||||||||||||||||||||||||||
| 1804 | state |= complex->state & QStyle::State_MouseOver; | - | ||||||||||||||||||||||||||||||
| 1805 | break; never executed: break; | 0 | ||||||||||||||||||||||||||||||
| 1806 | default: never executed: default: | 0 | ||||||||||||||||||||||||||||||
| 1807 | break; never executed: break; | 0 | ||||||||||||||||||||||||||||||
| 1808 | } | - | ||||||||||||||||||||||||||||||
| 1809 | - | |||||||||||||||||||||||||||||||
| 1810 | if (const QStyleOptionComboBox *combo = qstyleoption_cast<const QStyleOptionComboBox *>(opt)) {
| 0 | ||||||||||||||||||||||||||||||
| 1811 | // QStyle::State_On is set when the popup is being shown | - | ||||||||||||||||||||||||||||||
| 1812 | // Propagate EditField Pressed state | - | ||||||||||||||||||||||||||||||
| 1813 | if (pseudoElement == PseudoElement_None
| 0 | ||||||||||||||||||||||||||||||
| 1814 | && (complex->activeSubControls & QStyle::SC_ComboBoxEditField)
| 0 | ||||||||||||||||||||||||||||||
| 1815 | && (!(state & QStyle::State_MouseOver))) {
| 0 | ||||||||||||||||||||||||||||||
| 1816 | state |= QStyle::State_Sunken; | - | ||||||||||||||||||||||||||||||
| 1817 | } never executed: end of block | 0 | ||||||||||||||||||||||||||||||
| 1818 | - | |||||||||||||||||||||||||||||||
| 1819 | if (!combo->frame)
| 0 | ||||||||||||||||||||||||||||||
| 1820 | extraClass |= PseudoClass_Frameless; never executed: extraClass |= PseudoClass_Frameless; | 0 | ||||||||||||||||||||||||||||||
| 1821 | if (!combo->editable)
| 0 | ||||||||||||||||||||||||||||||
| 1822 | extraClass |= PseudoClass_ReadOnly; never executed: extraClass |= PseudoClass_ReadOnly; | 0 | ||||||||||||||||||||||||||||||
| 1823 | else | - | ||||||||||||||||||||||||||||||
| 1824 | extraClass |= PseudoClass_Editable; never executed: extraClass |= PseudoClass_Editable; | 0 | ||||||||||||||||||||||||||||||
| 1825 | #ifndef QT_NO_SPINBOX | - | ||||||||||||||||||||||||||||||
| 1826 | } else if (const QStyleOptionSpinBox *spin = qstyleoption_cast<const QStyleOptionSpinBox *>(opt)) {
| 0 | ||||||||||||||||||||||||||||||
| 1827 | if (!spin->frame)
| 0 | ||||||||||||||||||||||||||||||
| 1828 | extraClass |= PseudoClass_Frameless; never executed: extraClass |= PseudoClass_Frameless; | 0 | ||||||||||||||||||||||||||||||
| 1829 | #endif // QT_NO_SPINBOX | - | ||||||||||||||||||||||||||||||
| 1830 | } else if (const QStyleOptionGroupBox *gb = qstyleoption_cast<const QStyleOptionGroupBox *>(opt)) { never executed: end of block
| 0 | ||||||||||||||||||||||||||||||
| 1831 | if (gb->features & QStyleOptionFrame::Flat)
| 0 | ||||||||||||||||||||||||||||||
| 1832 | extraClass |= PseudoClass_Flat; never executed: extraClass |= PseudoClass_Flat; | 0 | ||||||||||||||||||||||||||||||
| 1833 | if (gb->lineWidth == 0)
| 0 | ||||||||||||||||||||||||||||||
| 1834 | extraClass |= PseudoClass_Frameless; never executed: extraClass |= PseudoClass_Frameless; | 0 | ||||||||||||||||||||||||||||||
| 1835 | } else if (const QStyleOptionTitleBar *tb = qstyleoption_cast<const QStyleOptionTitleBar *>(opt)) { never executed: end of block
| 0 | ||||||||||||||||||||||||||||||
| 1836 | if (tb->titleBarState & Qt::WindowMinimized) {
| 0 | ||||||||||||||||||||||||||||||
| 1837 | extraClass |= PseudoClass_Minimized; | - | ||||||||||||||||||||||||||||||
| 1838 | } never executed: end of block | 0 | ||||||||||||||||||||||||||||||
| 1839 | else if (tb->titleBarState & Qt::WindowMaximized)
| 0 | ||||||||||||||||||||||||||||||
| 1840 | extraClass |= PseudoClass_Maximized; never executed: extraClass |= PseudoClass_Maximized; | 0 | ||||||||||||||||||||||||||||||
| 1841 | } never executed: end of block | 0 | ||||||||||||||||||||||||||||||
| 1842 | } else { never executed: end of block | 0 | ||||||||||||||||||||||||||||||
| 1843 | // handle simple style options | - | ||||||||||||||||||||||||||||||
| 1844 | if (const QStyleOptionMenuItem *mi = qstyleoption_cast<const QStyleOptionMenuItem *>(opt)) {
| 0 | ||||||||||||||||||||||||||||||
| 1845 | if (mi->menuItemType == QStyleOptionMenuItem::DefaultItem)
| 0 | ||||||||||||||||||||||||||||||
| 1846 | extraClass |= PseudoClass_Default; never executed: extraClass |= PseudoClass_Default; | 0 | ||||||||||||||||||||||||||||||
| 1847 | if (mi->checkType == QStyleOptionMenuItem::Exclusive)
| 0 | ||||||||||||||||||||||||||||||
| 1848 | extraClass |= PseudoClass_Exclusive; never executed: extraClass |= PseudoClass_Exclusive; | 0 | ||||||||||||||||||||||||||||||
| 1849 | else if (mi->checkType == QStyleOptionMenuItem::NonExclusive)
| 0 | ||||||||||||||||||||||||||||||
| 1850 | extraClass |= PseudoClass_NonExclusive; never executed: extraClass |= PseudoClass_NonExclusive; | 0 | ||||||||||||||||||||||||||||||
| 1851 | if (mi->checkType != QStyleOptionMenuItem::NotCheckable)
| 0 | ||||||||||||||||||||||||||||||
| 1852 | extraClass |= (mi->checked) ? (PseudoClass_On|PseudoClass_Checked) never executed: extraClass |= (mi->checked) ? (PseudoClass_On|PseudoClass_Checked) : (PseudoClass_Off|PseudoClass_Unchecked);
| 0 | ||||||||||||||||||||||||||||||
| 1853 | : (PseudoClass_Off|PseudoClass_Unchecked); never executed: extraClass |= (mi->checked) ? (PseudoClass_On|PseudoClass_Checked) : (PseudoClass_Off|PseudoClass_Unchecked); | 0 | ||||||||||||||||||||||||||||||
| 1854 | } else if (const QStyleOptionHeader *hdr = qstyleoption_cast<const QStyleOptionHeader *>(opt)) { never executed: end of block
| 0 | ||||||||||||||||||||||||||||||
| 1855 | if (hdr->position == QStyleOptionHeader::OnlyOneSection)
| 0 | ||||||||||||||||||||||||||||||
| 1856 | extraClass |= PseudoClass_OnlyOne; never executed: extraClass |= PseudoClass_OnlyOne; | 0 | ||||||||||||||||||||||||||||||
| 1857 | else if (hdr->position == QStyleOptionHeader::Beginning)
| 0 | ||||||||||||||||||||||||||||||
| 1858 | extraClass |= PseudoClass_First; never executed: extraClass |= PseudoClass_First; | 0 | ||||||||||||||||||||||||||||||
| 1859 | else if (hdr->position == QStyleOptionHeader::End)
| 0 | ||||||||||||||||||||||||||||||
| 1860 | extraClass |= PseudoClass_Last; never executed: extraClass |= PseudoClass_Last; | 0 | ||||||||||||||||||||||||||||||
| 1861 | else if (hdr->position == QStyleOptionHeader::Middle)
| 0 | ||||||||||||||||||||||||||||||
| 1862 | extraClass |= PseudoClass_Middle; never executed: extraClass |= PseudoClass_Middle; | 0 | ||||||||||||||||||||||||||||||
| 1863 | - | |||||||||||||||||||||||||||||||
| 1864 | if (hdr->selectedPosition == QStyleOptionHeader::NextAndPreviousAreSelected)
| 0 | ||||||||||||||||||||||||||||||
| 1865 | extraClass |= (PseudoClass_NextSelected | PseudoClass_PreviousSelected); never executed: extraClass |= (PseudoClass_NextSelected | PseudoClass_PreviousSelected); | 0 | ||||||||||||||||||||||||||||||
| 1866 | else if (hdr->selectedPosition == QStyleOptionHeader::NextIsSelected)
| 0 | ||||||||||||||||||||||||||||||
| 1867 | extraClass |= PseudoClass_NextSelected; never executed: extraClass |= PseudoClass_NextSelected; | 0 | ||||||||||||||||||||||||||||||
| 1868 | else if (hdr->selectedPosition == QStyleOptionHeader::PreviousIsSelected)
| 0 | ||||||||||||||||||||||||||||||
| 1869 | extraClass |= PseudoClass_PreviousSelected; never executed: extraClass |= PseudoClass_PreviousSelected; | 0 | ||||||||||||||||||||||||||||||
| 1870 | #ifndef QT_NO_TABWIDGET | - | ||||||||||||||||||||||||||||||
| 1871 | } else if (const QStyleOptionTabWidgetFrame *tab = qstyleoption_cast<const QStyleOptionTabWidgetFrame *>(opt)) { never executed: end of block
| 0 | ||||||||||||||||||||||||||||||
| 1872 | switch (tab->shape) { | - | ||||||||||||||||||||||||||||||
| 1873 | case QTabBar::RoundedNorth: never executed: case QTabBar::RoundedNorth: | 0 | ||||||||||||||||||||||||||||||
| 1874 | case QTabBar::TriangularNorth: never executed: case QTabBar::TriangularNorth: | 0 | ||||||||||||||||||||||||||||||
| 1875 | extraClass |= PseudoClass_Top; | - | ||||||||||||||||||||||||||||||
| 1876 | break; never executed: break; | 0 | ||||||||||||||||||||||||||||||
| 1877 | case QTabBar::RoundedSouth: never executed: case QTabBar::RoundedSouth: | 0 | ||||||||||||||||||||||||||||||
| 1878 | case QTabBar::TriangularSouth: never executed: case QTabBar::TriangularSouth: | 0 | ||||||||||||||||||||||||||||||
| 1879 | extraClass |= PseudoClass_Bottom; | - | ||||||||||||||||||||||||||||||
| 1880 | break; never executed: break; | 0 | ||||||||||||||||||||||||||||||
| 1881 | case QTabBar::RoundedEast: never executed: case QTabBar::RoundedEast: | 0 | ||||||||||||||||||||||||||||||
| 1882 | case QTabBar::TriangularEast: never executed: case QTabBar::TriangularEast: | 0 | ||||||||||||||||||||||||||||||
| 1883 | extraClass |= PseudoClass_Left; | - | ||||||||||||||||||||||||||||||
| 1884 | break; never executed: break; | 0 | ||||||||||||||||||||||||||||||
| 1885 | case QTabBar::RoundedWest: never executed: case QTabBar::RoundedWest: | 0 | ||||||||||||||||||||||||||||||
| 1886 | case QTabBar::TriangularWest: never executed: case QTabBar::TriangularWest: | 0 | ||||||||||||||||||||||||||||||
| 1887 | extraClass |= PseudoClass_Right; | - | ||||||||||||||||||||||||||||||
| 1888 | break; never executed: break; | 0 | ||||||||||||||||||||||||||||||
| 1889 | default: never executed: default: | 0 | ||||||||||||||||||||||||||||||
| 1890 | break; never executed: break; | 0 | ||||||||||||||||||||||||||||||
| 1891 | } | - | ||||||||||||||||||||||||||||||
| 1892 | #endif | - | ||||||||||||||||||||||||||||||
| 1893 | #ifndef QT_NO_TABBAR | - | ||||||||||||||||||||||||||||||
| 1894 | } else if (const QStyleOptionTab *tab = qstyleoption_cast<const QStyleOptionTab *>(opt)) {
| 0 | ||||||||||||||||||||||||||||||
| 1895 | if (tab->position == QStyleOptionTab::OnlyOneTab)
| 0 | ||||||||||||||||||||||||||||||
| 1896 | extraClass |= PseudoClass_OnlyOne; never executed: extraClass |= PseudoClass_OnlyOne; | 0 | ||||||||||||||||||||||||||||||
| 1897 | else if (tab->position == QStyleOptionTab::Beginning)
| 0 | ||||||||||||||||||||||||||||||
| 1898 | extraClass |= PseudoClass_First; never executed: extraClass |= PseudoClass_First; | 0 | ||||||||||||||||||||||||||||||
| 1899 | else if (tab->position == QStyleOptionTab::End)
| 0 | ||||||||||||||||||||||||||||||
| 1900 | extraClass |= PseudoClass_Last; never executed: extraClass |= PseudoClass_Last; | 0 | ||||||||||||||||||||||||||||||
| 1901 | else if (tab->position == QStyleOptionTab::Middle)
| 0 | ||||||||||||||||||||||||||||||
| 1902 | extraClass |= PseudoClass_Middle; never executed: extraClass |= PseudoClass_Middle; | 0 | ||||||||||||||||||||||||||||||
| 1903 | - | |||||||||||||||||||||||||||||||
| 1904 | if (tab->selectedPosition == QStyleOptionTab::NextIsSelected)
| 0 | ||||||||||||||||||||||||||||||
| 1905 | extraClass |= PseudoClass_NextSelected; never executed: extraClass |= PseudoClass_NextSelected; | 0 | ||||||||||||||||||||||||||||||
| 1906 | else if (tab->selectedPosition == QStyleOptionTab::PreviousIsSelected)
| 0 | ||||||||||||||||||||||||||||||
| 1907 | extraClass |= PseudoClass_PreviousSelected; never executed: extraClass |= PseudoClass_PreviousSelected; | 0 | ||||||||||||||||||||||||||||||
| 1908 | - | |||||||||||||||||||||||||||||||
| 1909 | switch (tab->shape) { | - | ||||||||||||||||||||||||||||||
| 1910 | case QTabBar::RoundedNorth: never executed: case QTabBar::RoundedNorth: | 0 | ||||||||||||||||||||||||||||||
| 1911 | case QTabBar::TriangularNorth: never executed: case QTabBar::TriangularNorth: | 0 | ||||||||||||||||||||||||||||||
| 1912 | extraClass |= PseudoClass_Top; | - | ||||||||||||||||||||||||||||||
| 1913 | break; never executed: break; | 0 | ||||||||||||||||||||||||||||||
| 1914 | case QTabBar::RoundedSouth: never executed: case QTabBar::RoundedSouth: | 0 | ||||||||||||||||||||||||||||||
| 1915 | case QTabBar::TriangularSouth: never executed: case QTabBar::TriangularSouth: | 0 | ||||||||||||||||||||||||||||||
| 1916 | extraClass |= PseudoClass_Bottom; | - | ||||||||||||||||||||||||||||||
| 1917 | break; never executed: break; | 0 | ||||||||||||||||||||||||||||||
| 1918 | case QTabBar::RoundedEast: never executed: case QTabBar::RoundedEast: | 0 | ||||||||||||||||||||||||||||||
| 1919 | case QTabBar::TriangularEast: never executed: case QTabBar::TriangularEast: | 0 | ||||||||||||||||||||||||||||||
| 1920 | extraClass |= PseudoClass_Left; | - | ||||||||||||||||||||||||||||||
| 1921 | break; never executed: break; | 0 | ||||||||||||||||||||||||||||||
| 1922 | case QTabBar::RoundedWest: never executed: case QTabBar::RoundedWest: | 0 | ||||||||||||||||||||||||||||||
| 1923 | case QTabBar::TriangularWest: never executed: case QTabBar::TriangularWest: | 0 | ||||||||||||||||||||||||||||||
| 1924 | extraClass |= PseudoClass_Right; | - | ||||||||||||||||||||||||||||||
| 1925 | break; never executed: break; | 0 | ||||||||||||||||||||||||||||||
| 1926 | default: never executed: default: | 0 | ||||||||||||||||||||||||||||||
| 1927 | break; never executed: break; | 0 | ||||||||||||||||||||||||||||||
| 1928 | } | - | ||||||||||||||||||||||||||||||
| 1929 | #endif // QT_NO_TABBAR | - | ||||||||||||||||||||||||||||||
| 1930 | } else if (const QStyleOptionButton *btn = qstyleoption_cast<const QStyleOptionButton *>(opt)) {
| 0 | ||||||||||||||||||||||||||||||
| 1931 | if (btn->features & QStyleOptionButton::Flat)
| 0 | ||||||||||||||||||||||||||||||
| 1932 | extraClass |= PseudoClass_Flat; never executed: extraClass |= PseudoClass_Flat; | 0 | ||||||||||||||||||||||||||||||
| 1933 | if (btn->features & QStyleOptionButton::DefaultButton)
| 0 | ||||||||||||||||||||||||||||||
| 1934 | extraClass |= PseudoClass_Default; never executed: extraClass |= PseudoClass_Default; | 0 | ||||||||||||||||||||||||||||||
| 1935 | } else if (const QStyleOptionFrame *frm = qstyleoption_cast<const QStyleOptionFrame *>(opt)) { never executed: end of block
| 0 | ||||||||||||||||||||||||||||||
| 1936 | if (frm->lineWidth == 0)
| 0 | ||||||||||||||||||||||||||||||
| 1937 | extraClass |= PseudoClass_Frameless; never executed: extraClass |= PseudoClass_Frameless; | 0 | ||||||||||||||||||||||||||||||
| 1938 | if (frm->features & QStyleOptionFrame::Flat)
| 0 | ||||||||||||||||||||||||||||||
| 1939 | extraClass |= PseudoClass_Flat; never executed: extraClass |= PseudoClass_Flat; | 0 | ||||||||||||||||||||||||||||||
| 1940 | } never executed: end of block | 0 | ||||||||||||||||||||||||||||||
| 1941 | #ifndef QT_NO_TOOLBAR | - | ||||||||||||||||||||||||||||||
| 1942 | else if (const QStyleOptionToolBar *tb = qstyleoption_cast<const QStyleOptionToolBar *>(opt)) {
| 0 | ||||||||||||||||||||||||||||||
| 1943 | if (tb->toolBarArea == Qt::LeftToolBarArea)
| 0 | ||||||||||||||||||||||||||||||
| 1944 | extraClass |= PseudoClass_Left; never executed: extraClass |= PseudoClass_Left; | 0 | ||||||||||||||||||||||||||||||
| 1945 | else if (tb->toolBarArea == Qt::RightToolBarArea)
| 0 | ||||||||||||||||||||||||||||||
| 1946 | extraClass |= PseudoClass_Right; never executed: extraClass |= PseudoClass_Right; | 0 | ||||||||||||||||||||||||||||||
| 1947 | else if (tb->toolBarArea == Qt::TopToolBarArea)
| 0 | ||||||||||||||||||||||||||||||
| 1948 | extraClass |= PseudoClass_Top; never executed: extraClass |= PseudoClass_Top; | 0 | ||||||||||||||||||||||||||||||
| 1949 | else if (tb->toolBarArea == Qt::BottomToolBarArea)
| 0 | ||||||||||||||||||||||||||||||
| 1950 | extraClass |= PseudoClass_Bottom; never executed: extraClass |= PseudoClass_Bottom; | 0 | ||||||||||||||||||||||||||||||
| 1951 | - | |||||||||||||||||||||||||||||||
| 1952 | if (tb->positionWithinLine == QStyleOptionToolBar::Beginning)
| 0 | ||||||||||||||||||||||||||||||
| 1953 | extraClass |= PseudoClass_First; never executed: extraClass |= PseudoClass_First; | 0 | ||||||||||||||||||||||||||||||
| 1954 | else if (tb->positionWithinLine == QStyleOptionToolBar::Middle)
| 0 | ||||||||||||||||||||||||||||||
| 1955 | extraClass |= PseudoClass_Middle; never executed: extraClass |= PseudoClass_Middle; | 0 | ||||||||||||||||||||||||||||||
| 1956 | else if (tb->positionWithinLine == QStyleOptionToolBar::End)
| 0 | ||||||||||||||||||||||||||||||
| 1957 | extraClass |= PseudoClass_Last; never executed: extraClass |= PseudoClass_Last; | 0 | ||||||||||||||||||||||||||||||
| 1958 | else if (tb->positionWithinLine == QStyleOptionToolBar::OnlyOne)
| 0 | ||||||||||||||||||||||||||||||
| 1959 | extraClass |= PseudoClass_OnlyOne; never executed: extraClass |= PseudoClass_OnlyOne; | 0 | ||||||||||||||||||||||||||||||
| 1960 | } never executed: end of block | 0 | ||||||||||||||||||||||||||||||
| 1961 | #endif // QT_NO_TOOLBAR | - | ||||||||||||||||||||||||||||||
| 1962 | #ifndef QT_NO_TOOLBOX | - | ||||||||||||||||||||||||||||||
| 1963 | else if (const QStyleOptionToolBox *tb = qstyleoption_cast<const QStyleOptionToolBox *>(opt)) {
| 0 | ||||||||||||||||||||||||||||||
| 1964 | if (tb->position == QStyleOptionToolBox::OnlyOneTab)
| 0 | ||||||||||||||||||||||||||||||
| 1965 | extraClass |= PseudoClass_OnlyOne; never executed: extraClass |= PseudoClass_OnlyOne; | 0 | ||||||||||||||||||||||||||||||
| 1966 | else if (tb->position == QStyleOptionToolBox::Beginning)
| 0 | ||||||||||||||||||||||||||||||
| 1967 | extraClass |= PseudoClass_First; never executed: extraClass |= PseudoClass_First; | 0 | ||||||||||||||||||||||||||||||
| 1968 | else if (tb->position == QStyleOptionToolBox::End)
| 0 | ||||||||||||||||||||||||||||||
| 1969 | extraClass |= PseudoClass_Last; never executed: extraClass |= PseudoClass_Last; | 0 | ||||||||||||||||||||||||||||||
| 1970 | else if (tb->position == QStyleOptionToolBox::Middle)
| 0 | ||||||||||||||||||||||||||||||
| 1971 | extraClass |= PseudoClass_Middle; never executed: extraClass |= PseudoClass_Middle; | 0 | ||||||||||||||||||||||||||||||
| 1972 | - | |||||||||||||||||||||||||||||||
| 1973 | if (tb->selectedPosition == QStyleOptionToolBox::NextIsSelected)
| 0 | ||||||||||||||||||||||||||||||
| 1974 | extraClass |= PseudoClass_NextSelected; never executed: extraClass |= PseudoClass_NextSelected; | 0 | ||||||||||||||||||||||||||||||
| 1975 | else if (tb->selectedPosition == QStyleOptionToolBox::PreviousIsSelected)
| 0 | ||||||||||||||||||||||||||||||
| 1976 | extraClass |= PseudoClass_PreviousSelected; never executed: extraClass |= PseudoClass_PreviousSelected; | 0 | ||||||||||||||||||||||||||||||
| 1977 | } never executed: end of block | 0 | ||||||||||||||||||||||||||||||
| 1978 | #endif // QT_NO_TOOLBOX | - | ||||||||||||||||||||||||||||||
| 1979 | #ifndef QT_NO_DOCKWIDGET | - | ||||||||||||||||||||||||||||||
| 1980 | else if (const QStyleOptionDockWidget *dw = qstyleoption_cast<const QStyleOptionDockWidget *>(opt)) {
| 0 | ||||||||||||||||||||||||||||||
| 1981 | if (dw->verticalTitleBar)
| 0 | ||||||||||||||||||||||||||||||
| 1982 | extraClass |= PseudoClass_Vertical; never executed: extraClass |= PseudoClass_Vertical; | 0 | ||||||||||||||||||||||||||||||
| 1983 | else | - | ||||||||||||||||||||||||||||||
| 1984 | extraClass |= PseudoClass_Horizontal; never executed: extraClass |= PseudoClass_Horizontal; | 0 | ||||||||||||||||||||||||||||||
| 1985 | if (dw->closable)
| 0 | ||||||||||||||||||||||||||||||
| 1986 | extraClass |= PseudoClass_Closable; never executed: extraClass |= PseudoClass_Closable; | 0 | ||||||||||||||||||||||||||||||
| 1987 | if (dw->floatable)
| 0 | ||||||||||||||||||||||||||||||
| 1988 | extraClass |= PseudoClass_Floatable; never executed: extraClass |= PseudoClass_Floatable; | 0 | ||||||||||||||||||||||||||||||
| 1989 | if (dw->movable)
| 0 | ||||||||||||||||||||||||||||||
| 1990 | extraClass |= PseudoClass_Movable; never executed: extraClass |= PseudoClass_Movable; | 0 | ||||||||||||||||||||||||||||||
| 1991 | } never executed: end of block | 0 | ||||||||||||||||||||||||||||||
| 1992 | #endif // QT_NO_DOCKWIDGET | - | ||||||||||||||||||||||||||||||
| 1993 | #ifndef QT_NO_ITEMVIEWS | - | ||||||||||||||||||||||||||||||
| 1994 | else if (const QStyleOptionViewItem *vopt = qstyleoption_cast<const QStyleOptionViewItem *>(opt)) {
| 0 | ||||||||||||||||||||||||||||||
| 1995 | if (vopt->features & QStyleOptionViewItem::Alternate)
| 0 | ||||||||||||||||||||||||||||||
| 1996 | extraClass |= PseudoClass_Alternate; never executed: extraClass |= PseudoClass_Alternate; | 0 | ||||||||||||||||||||||||||||||
| 1997 | if (vopt->viewItemPosition == QStyleOptionViewItem::OnlyOne)
| 0 | ||||||||||||||||||||||||||||||
| 1998 | extraClass |= PseudoClass_OnlyOne; never executed: extraClass |= PseudoClass_OnlyOne; | 0 | ||||||||||||||||||||||||||||||
| 1999 | else if (vopt->viewItemPosition == QStyleOptionViewItem::Beginning)
| 0 | ||||||||||||||||||||||||||||||
| 2000 | extraClass |= PseudoClass_First; never executed: extraClass |= PseudoClass_First; | 0 | ||||||||||||||||||||||||||||||
| 2001 | else if (vopt->viewItemPosition == QStyleOptionViewItem::End)
| 0 | ||||||||||||||||||||||||||||||
| 2002 | extraClass |= PseudoClass_Last; never executed: extraClass |= PseudoClass_Last; | 0 | ||||||||||||||||||||||||||||||
| 2003 | else if (vopt->viewItemPosition == QStyleOptionViewItem::Middle)
| 0 | ||||||||||||||||||||||||||||||
| 2004 | extraClass |= PseudoClass_Middle; never executed: extraClass |= PseudoClass_Middle; | 0 | ||||||||||||||||||||||||||||||
| 2005 | - | |||||||||||||||||||||||||||||||
| 2006 | } never executed: end of block | 0 | ||||||||||||||||||||||||||||||
| 2007 | #endif | - | ||||||||||||||||||||||||||||||
| 2008 | #ifndef QT_NO_LINEEDIT | - | ||||||||||||||||||||||||||||||
| 2009 | // LineEdit sets Sunken flag to indicate Sunken frame (argh) | - | ||||||||||||||||||||||||||||||
| 2010 | if (const QLineEdit *lineEdit = qobject_cast<const QLineEdit *>(obj)) {
| 0 | ||||||||||||||||||||||||||||||
| 2011 | state &= ~QStyle::State_Sunken; | - | ||||||||||||||||||||||||||||||
| 2012 | if (lineEdit->hasFrame()) {
| 0 | ||||||||||||||||||||||||||||||
| 2013 | extraClass &= ~PseudoClass_Frameless; | - | ||||||||||||||||||||||||||||||
| 2014 | } else { never executed: end of block | 0 | ||||||||||||||||||||||||||||||
| 2015 | extraClass |= PseudoClass_Frameless; | - | ||||||||||||||||||||||||||||||
| 2016 | } never executed: end of block | 0 | ||||||||||||||||||||||||||||||
| 2017 | } else | - | ||||||||||||||||||||||||||||||
| 2018 | #endif | - | ||||||||||||||||||||||||||||||
| 2019 | if (const QFrame *frm = qobject_cast<const QFrame *>(obj)) {
| 0 | ||||||||||||||||||||||||||||||
| 2020 | if (frm->lineWidth() == 0)
| 0 | ||||||||||||||||||||||||||||||
| 2021 | extraClass |= PseudoClass_Frameless; never executed: extraClass |= PseudoClass_Frameless; | 0 | ||||||||||||||||||||||||||||||
| 2022 | } never executed: end of block | 0 | ||||||||||||||||||||||||||||||
| 2023 | } never executed: end of block | 0 | ||||||||||||||||||||||||||||||
| 2024 | - | |||||||||||||||||||||||||||||||
| 2025 | return renderRule(obj, pseudoElement, pseudoClass(state) | extraClass); never executed: return renderRule(obj, pseudoElement, pseudoClass(state) | extraClass); | 0 | ||||||||||||||||||||||||||||||
| 2026 | } | - | ||||||||||||||||||||||||||||||
| 2027 | - | |||||||||||||||||||||||||||||||
| 2028 | bool QStyleSheetStyle::hasStyleRule(const QObject *obj, int part) const | - | ||||||||||||||||||||||||||||||
| 2029 | { | - | ||||||||||||||||||||||||||||||
| 2030 | QHash<int, bool> &cache = styleSheetCaches->hasStyleRuleCache[obj]; | - | ||||||||||||||||||||||||||||||
| 2031 | QHash<int, bool>::const_iterator cacheIt = cache.constFind(part); | - | ||||||||||||||||||||||||||||||
| 2032 | if (cacheIt != cache.constEnd())
| 0 | ||||||||||||||||||||||||||||||
| 2033 | return cacheIt.value(); never executed: return cacheIt.value(); | 0 | ||||||||||||||||||||||||||||||
| 2034 | - | |||||||||||||||||||||||||||||||
| 2035 | if (!initObject(obj))
| 0 | ||||||||||||||||||||||||||||||
| 2036 | return false; never executed: return false; | 0 | ||||||||||||||||||||||||||||||
| 2037 | - | |||||||||||||||||||||||||||||||
| 2038 | - | |||||||||||||||||||||||||||||||
| 2039 | const QVector<StyleRule> &rules = styleRules(obj); | - | ||||||||||||||||||||||||||||||
| 2040 | if (part == PseudoElement_None) {
| 0 | ||||||||||||||||||||||||||||||
| 2041 | bool result = obj && !rules.isEmpty();
| 0 | ||||||||||||||||||||||||||||||
| 2042 | cache[part] = result; | - | ||||||||||||||||||||||||||||||
| 2043 | return result; never executed: return result; | 0 | ||||||||||||||||||||||||||||||
| 2044 | } | - | ||||||||||||||||||||||||||||||
| 2045 | - | |||||||||||||||||||||||||||||||
| 2046 | QString pseudoElement = QLatin1String(knownPseudoElements[part].name); | - | ||||||||||||||||||||||||||||||
| 2047 | for (int i = 0; i < rules.count(); i++) {
| 0 | ||||||||||||||||||||||||||||||
| 2048 | const Selector& selector = rules.at(i).selectors.at(0); | - | ||||||||||||||||||||||||||||||
| 2049 | if (pseudoElement.compare(selector.pseudoElement(), Qt::CaseInsensitive) == 0) {
| 0 | ||||||||||||||||||||||||||||||
| 2050 | cache[part] = true; | - | ||||||||||||||||||||||||||||||
| 2051 | return true; never executed: return true; | 0 | ||||||||||||||||||||||||||||||
| 2052 | } | - | ||||||||||||||||||||||||||||||
| 2053 | } never executed: end of block | 0 | ||||||||||||||||||||||||||||||
| 2054 | - | |||||||||||||||||||||||||||||||
| 2055 | cache[part] = false; | - | ||||||||||||||||||||||||||||||
| 2056 | return false; never executed: return false; | 0 | ||||||||||||||||||||||||||||||
| 2057 | } | - | ||||||||||||||||||||||||||||||
| 2058 | - | |||||||||||||||||||||||||||||||
| 2059 | static Origin defaultOrigin(int pe) | - | ||||||||||||||||||||||||||||||
| 2060 | { | - | ||||||||||||||||||||||||||||||
| 2061 | switch (pe) { | - | ||||||||||||||||||||||||||||||
| 2062 | case PseudoElement_ScrollBarAddPage: never executed: case PseudoElement_ScrollBarAddPage: | 0 | ||||||||||||||||||||||||||||||
| 2063 | case PseudoElement_ScrollBarSubPage: never executed: case PseudoElement_ScrollBarSubPage: | 0 | ||||||||||||||||||||||||||||||
| 2064 | case PseudoElement_ScrollBarAddLine: never executed: case PseudoElement_ScrollBarAddLine: | 0 | ||||||||||||||||||||||||||||||
| 2065 | case PseudoElement_ScrollBarSubLine: never executed: case PseudoElement_ScrollBarSubLine: | 0 | ||||||||||||||||||||||||||||||
| 2066 | case PseudoElement_ScrollBarFirst: never executed: case PseudoElement_ScrollBarFirst: | 0 | ||||||||||||||||||||||||||||||
| 2067 | case PseudoElement_ScrollBarLast: never executed: case PseudoElement_ScrollBarLast: | 0 | ||||||||||||||||||||||||||||||
| 2068 | case PseudoElement_GroupBoxTitle: never executed: case PseudoElement_GroupBoxTitle: | 0 | ||||||||||||||||||||||||||||||
| 2069 | case PseudoElement_GroupBoxIndicator: // never used never executed: case PseudoElement_GroupBoxIndicator: | 0 | ||||||||||||||||||||||||||||||
| 2070 | case PseudoElement_ToolButtonMenu: never executed: case PseudoElement_ToolButtonMenu: | 0 | ||||||||||||||||||||||||||||||
| 2071 | case PseudoElement_SliderAddPage: never executed: case PseudoElement_SliderAddPage: | 0 | ||||||||||||||||||||||||||||||
| 2072 | case PseudoElement_SliderSubPage: never executed: case PseudoElement_SliderSubPage: | 0 | ||||||||||||||||||||||||||||||
| 2073 | return Origin_Border; never executed: return Origin_Border; | 0 | ||||||||||||||||||||||||||||||
| 2074 | - | |||||||||||||||||||||||||||||||
| 2075 | case PseudoElement_SpinBoxUpButton: never executed: case PseudoElement_SpinBoxUpButton: | 0 | ||||||||||||||||||||||||||||||
| 2076 | case PseudoElement_SpinBoxDownButton: never executed: case PseudoElement_SpinBoxDownButton: | 0 | ||||||||||||||||||||||||||||||
| 2077 | case PseudoElement_PushButtonMenuIndicator: never executed: case PseudoElement_PushButtonMenuIndicator: | 0 | ||||||||||||||||||||||||||||||
| 2078 | case PseudoElement_ComboBoxDropDown: never executed: case PseudoElement_ComboBoxDropDown: | 0 | ||||||||||||||||||||||||||||||
| 2079 | case PseudoElement_ToolButtonDownArrow: never executed: case PseudoElement_ToolButtonDownArrow: | 0 | ||||||||||||||||||||||||||||||
| 2080 | case PseudoElement_MenuCheckMark: never executed: case PseudoElement_MenuCheckMark: | 0 | ||||||||||||||||||||||||||||||
| 2081 | case PseudoElement_MenuIcon: never executed: case PseudoElement_MenuIcon: | 0 | ||||||||||||||||||||||||||||||
| 2082 | case PseudoElement_MenuRightArrow: never executed: case PseudoElement_MenuRightArrow: | 0 | ||||||||||||||||||||||||||||||
| 2083 | return Origin_Padding; never executed: return Origin_Padding; | 0 | ||||||||||||||||||||||||||||||
| 2084 | - | |||||||||||||||||||||||||||||||
| 2085 | case PseudoElement_Indicator: never executed: case PseudoElement_Indicator: | 0 | ||||||||||||||||||||||||||||||
| 2086 | case PseudoElement_ExclusiveIndicator: never executed: case PseudoElement_ExclusiveIndicator: | 0 | ||||||||||||||||||||||||||||||
| 2087 | case PseudoElement_ComboBoxArrow: never executed: case PseudoElement_ComboBoxArrow: | 0 | ||||||||||||||||||||||||||||||
| 2088 | case PseudoElement_ScrollBarSlider: never executed: case PseudoElement_ScrollBarSlider: | 0 | ||||||||||||||||||||||||||||||
| 2089 | case PseudoElement_ScrollBarUpArrow: never executed: case PseudoElement_ScrollBarUpArrow: | 0 | ||||||||||||||||||||||||||||||
| 2090 | case PseudoElement_ScrollBarDownArrow: never executed: case PseudoElement_ScrollBarDownArrow: | 0 | ||||||||||||||||||||||||||||||
| 2091 | case PseudoElement_ScrollBarLeftArrow: never executed: case PseudoElement_ScrollBarLeftArrow: | 0 | ||||||||||||||||||||||||||||||
| 2092 | case PseudoElement_ScrollBarRightArrow: never executed: case PseudoElement_ScrollBarRightArrow: | 0 | ||||||||||||||||||||||||||||||
| 2093 | case PseudoElement_SpinBoxUpArrow: never executed: case PseudoElement_SpinBoxUpArrow: | 0 | ||||||||||||||||||||||||||||||
| 2094 | case PseudoElement_SpinBoxDownArrow: never executed: case PseudoElement_SpinBoxDownArrow: | 0 | ||||||||||||||||||||||||||||||
| 2095 | case PseudoElement_ToolButtonMenuArrow: never executed: case PseudoElement_ToolButtonMenuArrow: | 0 | ||||||||||||||||||||||||||||||
| 2096 | case PseudoElement_HeaderViewUpArrow: never executed: case PseudoElement_HeaderViewUpArrow: | 0 | ||||||||||||||||||||||||||||||
| 2097 | case PseudoElement_HeaderViewDownArrow: never executed: case PseudoElement_HeaderViewDownArrow: | 0 | ||||||||||||||||||||||||||||||
| 2098 | case PseudoElement_SliderGroove: never executed: case PseudoElement_SliderGroove: | 0 | ||||||||||||||||||||||||||||||
| 2099 | case PseudoElement_SliderHandle: never executed: case PseudoElement_SliderHandle: | 0 | ||||||||||||||||||||||||||||||
| 2100 | return Origin_Content; never executed: return Origin_Content; | 0 | ||||||||||||||||||||||||||||||
| 2101 | - | |||||||||||||||||||||||||||||||
| 2102 | default: never executed: default: | 0 | ||||||||||||||||||||||||||||||
| 2103 | return Origin_Margin; never executed: return Origin_Margin; | 0 | ||||||||||||||||||||||||||||||
| 2104 | } | - | ||||||||||||||||||||||||||||||
| 2105 | } | - | ||||||||||||||||||||||||||||||
| 2106 | - | |||||||||||||||||||||||||||||||
| 2107 | static Qt::Alignment defaultPosition(int pe) | - | ||||||||||||||||||||||||||||||
| 2108 | { | - | ||||||||||||||||||||||||||||||
| 2109 | switch (pe) { | - | ||||||||||||||||||||||||||||||
| 2110 | case PseudoElement_Indicator: never executed: case PseudoElement_Indicator: | 0 | ||||||||||||||||||||||||||||||
| 2111 | case PseudoElement_ExclusiveIndicator: never executed: case PseudoElement_ExclusiveIndicator: | 0 | ||||||||||||||||||||||||||||||
| 2112 | case PseudoElement_MenuCheckMark: never executed: case PseudoElement_MenuCheckMark: | 0 | ||||||||||||||||||||||||||||||
| 2113 | case PseudoElement_MenuIcon: never executed: case PseudoElement_MenuIcon: | 0 | ||||||||||||||||||||||||||||||
| 2114 | return Qt::AlignLeft | Qt::AlignVCenter; never executed: return Qt::AlignLeft | Qt::AlignVCenter; | 0 | ||||||||||||||||||||||||||||||
| 2115 | - | |||||||||||||||||||||||||||||||
| 2116 | case PseudoElement_ScrollBarAddLine: never executed: case PseudoElement_ScrollBarAddLine: | 0 | ||||||||||||||||||||||||||||||
| 2117 | case PseudoElement_ScrollBarLast: never executed: case PseudoElement_ScrollBarLast: | 0 | ||||||||||||||||||||||||||||||
| 2118 | case PseudoElement_SpinBoxDownButton: never executed: case PseudoElement_SpinBoxDownButton: | 0 | ||||||||||||||||||||||||||||||
| 2119 | case PseudoElement_PushButtonMenuIndicator: never executed: case PseudoElement_PushButtonMenuIndicator: | 0 | ||||||||||||||||||||||||||||||
| 2120 | case PseudoElement_ToolButtonDownArrow: never executed: case PseudoElement_ToolButtonDownArrow: | 0 | ||||||||||||||||||||||||||||||
| 2121 | return Qt::AlignRight | Qt::AlignBottom; never executed: return Qt::AlignRight | Qt::AlignBottom; | 0 | ||||||||||||||||||||||||||||||
| 2122 | - | |||||||||||||||||||||||||||||||
| 2123 | case PseudoElement_ScrollBarSubLine: never executed: case PseudoElement_ScrollBarSubLine: | 0 | ||||||||||||||||||||||||||||||
| 2124 | case PseudoElement_ScrollBarFirst: never executed: case PseudoElement_ScrollBarFirst: | 0 | ||||||||||||||||||||||||||||||
| 2125 | case PseudoElement_SpinBoxUpButton: never executed: case PseudoElement_SpinBoxUpButton: | 0 | ||||||||||||||||||||||||||||||
| 2126 | case PseudoElement_ComboBoxDropDown: never executed: case PseudoElement_ComboBoxDropDown: | 0 | ||||||||||||||||||||||||||||||
| 2127 | case PseudoElement_ToolButtonMenu: never executed: case PseudoElement_ToolButtonMenu: | 0 | ||||||||||||||||||||||||||||||
| 2128 | case PseudoElement_DockWidgetCloseButton: never executed: case PseudoElement_DockWidgetCloseButton: | 0 | ||||||||||||||||||||||||||||||
| 2129 | case PseudoElement_DockWidgetFloatButton: never executed: case PseudoElement_DockWidgetFloatButton: | 0 | ||||||||||||||||||||||||||||||
| 2130 | return Qt::AlignRight | Qt::AlignTop; never executed: return Qt::AlignRight | Qt::AlignTop; | 0 | ||||||||||||||||||||||||||||||
| 2131 | - | |||||||||||||||||||||||||||||||
| 2132 | case PseudoElement_ScrollBarUpArrow: never executed: case PseudoElement_ScrollBarUpArrow: | 0 | ||||||||||||||||||||||||||||||
| 2133 | case PseudoElement_ScrollBarDownArrow: never executed: case PseudoElement_ScrollBarDownArrow: | 0 | ||||||||||||||||||||||||||||||
| 2134 | case PseudoElement_ScrollBarLeftArrow: never executed: case PseudoElement_ScrollBarLeftArrow: | 0 | ||||||||||||||||||||||||||||||
| 2135 | case PseudoElement_ScrollBarRightArrow: never executed: case PseudoElement_ScrollBarRightArrow: | 0 | ||||||||||||||||||||||||||||||
| 2136 | case PseudoElement_SpinBoxUpArrow: never executed: case PseudoElement_SpinBoxUpArrow: | 0 | ||||||||||||||||||||||||||||||
| 2137 | case PseudoElement_SpinBoxDownArrow: never executed: case PseudoElement_SpinBoxDownArrow: | 0 | ||||||||||||||||||||||||||||||
| 2138 | case PseudoElement_ComboBoxArrow: never executed: case PseudoElement_ComboBoxArrow: | 0 | ||||||||||||||||||||||||||||||
| 2139 | case PseudoElement_DownArrow: never executed: case PseudoElement_DownArrow: | 0 | ||||||||||||||||||||||||||||||
| 2140 | case PseudoElement_ToolButtonMenuArrow: never executed: case PseudoElement_ToolButtonMenuArrow: | 0 | ||||||||||||||||||||||||||||||
| 2141 | case PseudoElement_SliderGroove: never executed: case PseudoElement_SliderGroove: | 0 | ||||||||||||||||||||||||||||||
| 2142 | return Qt::AlignCenter; never executed: return Qt::AlignCenter; | 0 | ||||||||||||||||||||||||||||||
| 2143 | - | |||||||||||||||||||||||||||||||
| 2144 | case PseudoElement_GroupBoxTitle: never executed: case PseudoElement_GroupBoxTitle: | 0 | ||||||||||||||||||||||||||||||
| 2145 | case PseudoElement_GroupBoxIndicator: // never used never executed: case PseudoElement_GroupBoxIndicator: | 0 | ||||||||||||||||||||||||||||||
| 2146 | return Qt::AlignLeft | Qt::AlignTop; never executed: return Qt::AlignLeft | Qt::AlignTop; | 0 | ||||||||||||||||||||||||||||||
| 2147 | - | |||||||||||||||||||||||||||||||
| 2148 | case PseudoElement_HeaderViewUpArrow: never executed: case PseudoElement_HeaderViewUpArrow: | 0 | ||||||||||||||||||||||||||||||
| 2149 | case PseudoElement_HeaderViewDownArrow: never executed: case PseudoElement_HeaderViewDownArrow: | 0 | ||||||||||||||||||||||||||||||
| 2150 | case PseudoElement_MenuRightArrow: never executed: case PseudoElement_MenuRightArrow: | 0 | ||||||||||||||||||||||||||||||
| 2151 | return Qt::AlignRight | Qt::AlignVCenter; never executed: return Qt::AlignRight | Qt::AlignVCenter; | 0 | ||||||||||||||||||||||||||||||
| 2152 | - | |||||||||||||||||||||||||||||||
| 2153 | default: never executed: default: | 0 | ||||||||||||||||||||||||||||||
| 2154 | return 0; never executed: return 0; | 0 | ||||||||||||||||||||||||||||||
| 2155 | } | - | ||||||||||||||||||||||||||||||
| 2156 | } | - | ||||||||||||||||||||||||||||||
| 2157 | - | |||||||||||||||||||||||||||||||
| 2158 | QSize QStyleSheetStyle::defaultSize(const QWidget *w, QSize sz, const QRect& rect, int pe) const | - | ||||||||||||||||||||||||||||||
| 2159 | { | - | ||||||||||||||||||||||||||||||
| 2160 | QStyle *base = baseStyle(); | - | ||||||||||||||||||||||||||||||
| 2161 | - | |||||||||||||||||||||||||||||||
| 2162 | switch (pe) { | - | ||||||||||||||||||||||||||||||
| 2163 | case PseudoElement_Indicator: never executed: case PseudoElement_Indicator: | 0 | ||||||||||||||||||||||||||||||
| 2164 | case PseudoElement_MenuCheckMark: never executed: case PseudoElement_MenuCheckMark: | 0 | ||||||||||||||||||||||||||||||
| 2165 | if (sz.width() == -1)
| 0 | ||||||||||||||||||||||||||||||
| 2166 | sz.setWidth(base->pixelMetric(PM_IndicatorWidth, 0, w)); never executed: sz.setWidth(base->pixelMetric(PM_IndicatorWidth, 0, w)); | 0 | ||||||||||||||||||||||||||||||
| 2167 | if (sz.height() == -1)
| 0 | ||||||||||||||||||||||||||||||
| 2168 | sz.setHeight(base->pixelMetric(PM_IndicatorHeight, 0, w)); never executed: sz.setHeight(base->pixelMetric(PM_IndicatorHeight, 0, w)); | 0 | ||||||||||||||||||||||||||||||
| 2169 | break; never executed: break; | 0 | ||||||||||||||||||||||||||||||
| 2170 | - | |||||||||||||||||||||||||||||||
| 2171 | case PseudoElement_ExclusiveIndicator: never executed: case PseudoElement_ExclusiveIndicator: | 0 | ||||||||||||||||||||||||||||||
| 2172 | case PseudoElement_GroupBoxIndicator: never executed: case PseudoElement_GroupBoxIndicator: | 0 | ||||||||||||||||||||||||||||||
| 2173 | if (sz.width() == -1)
| 0 | ||||||||||||||||||||||||||||||
| 2174 | sz.setWidth(base->pixelMetric(PM_ExclusiveIndicatorWidth, 0, w)); never executed: sz.setWidth(base->pixelMetric(PM_ExclusiveIndicatorWidth, 0, w)); | 0 | ||||||||||||||||||||||||||||||
| 2175 | if (sz.height() == -1)
| 0 | ||||||||||||||||||||||||||||||
| 2176 | sz.setHeight(base->pixelMetric(PM_ExclusiveIndicatorHeight, 0, w)); never executed: sz.setHeight(base->pixelMetric(PM_ExclusiveIndicatorHeight, 0, w)); | 0 | ||||||||||||||||||||||||||||||
| 2177 | break; never executed: break; | 0 | ||||||||||||||||||||||||||||||
| 2178 | - | |||||||||||||||||||||||||||||||
| 2179 | case PseudoElement_PushButtonMenuIndicator: { never executed: case PseudoElement_PushButtonMenuIndicator: | 0 | ||||||||||||||||||||||||||||||
| 2180 | int pm = base->pixelMetric(PM_MenuButtonIndicator, 0, w); | - | ||||||||||||||||||||||||||||||
| 2181 | if (sz.width() == -1)
| 0 | ||||||||||||||||||||||||||||||
| 2182 | sz.setWidth(pm); never executed: sz.setWidth(pm); | 0 | ||||||||||||||||||||||||||||||
| 2183 | if (sz.height() == -1)
| 0 | ||||||||||||||||||||||||||||||
| 2184 | sz.setHeight(pm); never executed: sz.setHeight(pm); | 0 | ||||||||||||||||||||||||||||||
| 2185 | } | - | ||||||||||||||||||||||||||||||
| 2186 | break; never executed: break; | 0 | ||||||||||||||||||||||||||||||
| 2187 | - | |||||||||||||||||||||||||||||||
| 2188 | case PseudoElement_ComboBoxDropDown: never executed: case PseudoElement_ComboBoxDropDown: | 0 | ||||||||||||||||||||||||||||||
| 2189 | if (sz.width() == -1)
| 0 | ||||||||||||||||||||||||||||||
| 2190 | sz.setWidth(16); never executed: sz.setWidth(16); | 0 | ||||||||||||||||||||||||||||||
| 2191 | break; never executed: break; | 0 | ||||||||||||||||||||||||||||||
| 2192 | - | |||||||||||||||||||||||||||||||
| 2193 | case PseudoElement_ComboBoxArrow: never executed: case PseudoElement_ComboBoxArrow: | 0 | ||||||||||||||||||||||||||||||
| 2194 | case PseudoElement_DownArrow: never executed: case PseudoElement_DownArrow: | 0 | ||||||||||||||||||||||||||||||
| 2195 | case PseudoElement_ToolButtonMenuArrow: never executed: case PseudoElement_ToolButtonMenuArrow: | 0 | ||||||||||||||||||||||||||||||
| 2196 | case PseudoElement_ToolButtonDownArrow: never executed: case PseudoElement_ToolButtonDownArrow: | 0 | ||||||||||||||||||||||||||||||
| 2197 | case PseudoElement_MenuRightArrow: never executed: case PseudoElement_MenuRightArrow: | 0 | ||||||||||||||||||||||||||||||
| 2198 | if (sz.width() == -1)
| 0 | ||||||||||||||||||||||||||||||
| 2199 | sz.setWidth(13); never executed: sz.setWidth(13); | 0 | ||||||||||||||||||||||||||||||
| 2200 | if (sz.height() == -1)
| 0 | ||||||||||||||||||||||||||||||
| 2201 | sz.setHeight(13); never executed: sz.setHeight(13); | 0 | ||||||||||||||||||||||||||||||
| 2202 | break; never executed: break; | 0 | ||||||||||||||||||||||||||||||
| 2203 | - | |||||||||||||||||||||||||||||||
| 2204 | case PseudoElement_SpinBoxUpButton: never executed: case PseudoElement_SpinBoxUpButton: | 0 | ||||||||||||||||||||||||||||||
| 2205 | case PseudoElement_SpinBoxDownButton: never executed: case PseudoElement_SpinBoxDownButton: | 0 | ||||||||||||||||||||||||||||||
| 2206 | if (sz.width() == -1)
| 0 | ||||||||||||||||||||||||||||||
| 2207 | sz.setWidth(16); never executed: sz.setWidth(16); | 0 | ||||||||||||||||||||||||||||||
| 2208 | if (sz.height() == -1)
| 0 | ||||||||||||||||||||||||||||||
| 2209 | sz.setHeight(rect.height()/2); never executed: sz.setHeight(rect.height()/2); | 0 | ||||||||||||||||||||||||||||||
| 2210 | break; never executed: break; | 0 | ||||||||||||||||||||||||||||||
| 2211 | - | |||||||||||||||||||||||||||||||
| 2212 | case PseudoElement_ToolButtonMenu: never executed: case PseudoElement_ToolButtonMenu: | 0 | ||||||||||||||||||||||||||||||
| 2213 | if (sz.width() == -1)
| 0 | ||||||||||||||||||||||||||||||
| 2214 | sz.setWidth(base->pixelMetric(PM_MenuButtonIndicator, 0, w)); never executed: sz.setWidth(base->pixelMetric(PM_MenuButtonIndicator, 0, w)); | 0 | ||||||||||||||||||||||||||||||
| 2215 | break; never executed: break; | 0 | ||||||||||||||||||||||||||||||
| 2216 | - | |||||||||||||||||||||||||||||||
| 2217 | case PseudoElement_HeaderViewUpArrow: never executed: case PseudoElement_HeaderViewUpArrow: | 0 | ||||||||||||||||||||||||||||||
| 2218 | case PseudoElement_HeaderViewDownArrow: { never executed: case PseudoElement_HeaderViewDownArrow: | 0 | ||||||||||||||||||||||||||||||
| 2219 | int pm = base->pixelMetric(PM_HeaderMargin, 0, w); | - | ||||||||||||||||||||||||||||||
| 2220 | if (sz.width() == -1)
| 0 | ||||||||||||||||||||||||||||||
| 2221 | sz.setWidth(pm); never executed: sz.setWidth(pm); | 0 | ||||||||||||||||||||||||||||||
| 2222 | if (sz.height() == 1)
| 0 | ||||||||||||||||||||||||||||||
| 2223 | sz.setHeight(pm); never executed: sz.setHeight(pm); | 0 | ||||||||||||||||||||||||||||||
| 2224 | break; never executed: break; | 0 | ||||||||||||||||||||||||||||||
| 2225 | } | - | ||||||||||||||||||||||||||||||
| 2226 | - | |||||||||||||||||||||||||||||||
| 2227 | case PseudoElement_ScrollBarFirst: never executed: case PseudoElement_ScrollBarFirst: | 0 | ||||||||||||||||||||||||||||||
| 2228 | case PseudoElement_ScrollBarLast: never executed: case PseudoElement_ScrollBarLast: | 0 | ||||||||||||||||||||||||||||||
| 2229 | case PseudoElement_ScrollBarAddLine: never executed: case PseudoElement_ScrollBarAddLine: | 0 | ||||||||||||||||||||||||||||||
| 2230 | case PseudoElement_ScrollBarSubLine: never executed: case PseudoElement_ScrollBarSubLine: | 0 | ||||||||||||||||||||||||||||||
| 2231 | case PseudoElement_ScrollBarSlider: { never executed: case PseudoElement_ScrollBarSlider: | 0 | ||||||||||||||||||||||||||||||
| 2232 | int pm = pixelMetric(QStyle::PM_ScrollBarExtent, 0, w); | - | ||||||||||||||||||||||||||||||
| 2233 | if (sz.width() == -1)
| 0 | ||||||||||||||||||||||||||||||
| 2234 | sz.setWidth(pm); never executed: sz.setWidth(pm); | 0 | ||||||||||||||||||||||||||||||
| 2235 | if (sz.height() == -1)
| 0 | ||||||||||||||||||||||||||||||
| 2236 | sz.setHeight(pm); never executed: sz.setHeight(pm); | 0 | ||||||||||||||||||||||||||||||
| 2237 | break; never executed: break; | 0 | ||||||||||||||||||||||||||||||
| 2238 | } | - | ||||||||||||||||||||||||||||||
| 2239 | - | |||||||||||||||||||||||||||||||
| 2240 | case PseudoElement_DockWidgetCloseButton: never executed: case PseudoElement_DockWidgetCloseButton: | 0 | ||||||||||||||||||||||||||||||
| 2241 | case PseudoElement_DockWidgetFloatButton: { never executed: case PseudoElement_DockWidgetFloatButton: | 0 | ||||||||||||||||||||||||||||||
| 2242 | int iconSize = pixelMetric(PM_SmallIconSize, 0, w); | - | ||||||||||||||||||||||||||||||
| 2243 | return QSize(iconSize, iconSize); never executed: return QSize(iconSize, iconSize); | 0 | ||||||||||||||||||||||||||||||
| 2244 | } | - | ||||||||||||||||||||||||||||||
| 2245 | - | |||||||||||||||||||||||||||||||
| 2246 | default: never executed: default: | 0 | ||||||||||||||||||||||||||||||
| 2247 | break; never executed: break; | 0 | ||||||||||||||||||||||||||||||
| 2248 | } | - | ||||||||||||||||||||||||||||||
| 2249 | - | |||||||||||||||||||||||||||||||
| 2250 | // expand to rectangle | - | ||||||||||||||||||||||||||||||
| 2251 | if (sz.height() == -1)
| 0 | ||||||||||||||||||||||||||||||
| 2252 | sz.setHeight(rect.height()); never executed: sz.setHeight(rect.height()); | 0 | ||||||||||||||||||||||||||||||
| 2253 | if (sz.width() == -1)
| 0 | ||||||||||||||||||||||||||||||
| 2254 | sz.setWidth(rect.width()); never executed: sz.setWidth(rect.width()); | 0 | ||||||||||||||||||||||||||||||
| 2255 | - | |||||||||||||||||||||||||||||||
| 2256 | return sz; never executed: return sz; | 0 | ||||||||||||||||||||||||||||||
| 2257 | } | - | ||||||||||||||||||||||||||||||
| 2258 | - | |||||||||||||||||||||||||||||||
| 2259 | static PositionMode defaultPositionMode(int pe) | - | ||||||||||||||||||||||||||||||
| 2260 | { | - | ||||||||||||||||||||||||||||||
| 2261 | switch (pe) { | - | ||||||||||||||||||||||||||||||
| 2262 | case PseudoElement_ScrollBarFirst: never executed: case PseudoElement_ScrollBarFirst: | 0 | ||||||||||||||||||||||||||||||
| 2263 | case PseudoElement_ScrollBarLast: never executed: case PseudoElement_ScrollBarLast: | 0 | ||||||||||||||||||||||||||||||
| 2264 | case PseudoElement_ScrollBarAddLine: never executed: case PseudoElement_ScrollBarAddLine: | 0 | ||||||||||||||||||||||||||||||
| 2265 | case PseudoElement_ScrollBarSubLine: never executed: case PseudoElement_ScrollBarSubLine: | 0 | ||||||||||||||||||||||||||||||
| 2266 | case PseudoElement_ScrollBarAddPage: never executed: case PseudoElement_ScrollBarAddPage: | 0 | ||||||||||||||||||||||||||||||
| 2267 | case PseudoElement_ScrollBarSubPage: never executed: case PseudoElement_ScrollBarSubPage: | 0 | ||||||||||||||||||||||||||||||
| 2268 | case PseudoElement_ScrollBarSlider: never executed: case PseudoElement_ScrollBarSlider: | 0 | ||||||||||||||||||||||||||||||
| 2269 | case PseudoElement_SliderGroove: never executed: case PseudoElement_SliderGroove: | 0 | ||||||||||||||||||||||||||||||
| 2270 | case PseudoElement_SliderHandle: never executed: case PseudoElement_SliderHandle: | 0 | ||||||||||||||||||||||||||||||
| 2271 | case PseudoElement_TabWidgetPane: never executed: case PseudoElement_TabWidgetPane: | 0 | ||||||||||||||||||||||||||||||
| 2272 | return PositionMode_Absolute; never executed: return PositionMode_Absolute; | 0 | ||||||||||||||||||||||||||||||
| 2273 | default: never executed: default: | 0 | ||||||||||||||||||||||||||||||
| 2274 | return PositionMode_Static; never executed: return PositionMode_Static; | 0 | ||||||||||||||||||||||||||||||
| 2275 | } | - | ||||||||||||||||||||||||||||||
| 2276 | } | - | ||||||||||||||||||||||||||||||
| 2277 | - | |||||||||||||||||||||||||||||||
| 2278 | QRect QStyleSheetStyle::positionRect(const QWidget *w, const QRenderRule &rule2, int pe, | - | ||||||||||||||||||||||||||||||
| 2279 | const QRect &originRect, Qt::LayoutDirection dir) const | - | ||||||||||||||||||||||||||||||
| 2280 | { | - | ||||||||||||||||||||||||||||||
| 2281 | const QStyleSheetPositionData *p = rule2.position(); | - | ||||||||||||||||||||||||||||||
| 2282 | PositionMode mode = (p && p->mode != PositionMode_Unknown) ? p->mode : defaultPositionMode(pe);
| 0 | ||||||||||||||||||||||||||||||
| 2283 | Qt::Alignment position = (p && p->position != 0) ? p->position : defaultPosition(pe);
| 0 | ||||||||||||||||||||||||||||||
| 2284 | QRect r; | - | ||||||||||||||||||||||||||||||
| 2285 | - | |||||||||||||||||||||||||||||||
| 2286 | if (mode != PositionMode_Absolute) {
| 0 | ||||||||||||||||||||||||||||||
| 2287 | QSize sz = defaultSize(w, rule2.size(), originRect, pe); | - | ||||||||||||||||||||||||||||||
| 2288 | sz = sz.expandedTo(rule2.minimumContentsSize()); | - | ||||||||||||||||||||||||||||||
| 2289 | r = QStyle::alignedRect(dir, position, sz, originRect); | - | ||||||||||||||||||||||||||||||
| 2290 | if (p) {
| 0 | ||||||||||||||||||||||||||||||
| 2291 | int left = p->left ? p->left : -p->right;
| 0 | ||||||||||||||||||||||||||||||
| 2292 | int top = p->top ? p->top : -p->bottom;
| 0 | ||||||||||||||||||||||||||||||
| 2293 | r.translate(dir == Qt::LeftToRight ? left : -left, top); | - | ||||||||||||||||||||||||||||||
| 2294 | } never executed: end of block | 0 | ||||||||||||||||||||||||||||||
| 2295 | } else { never executed: end of block | 0 | ||||||||||||||||||||||||||||||
| 2296 | r = p ? originRect.adjusted(dir == Qt::LeftToRight ? p->left : p->right, p->top,
| 0 | ||||||||||||||||||||||||||||||
| 2297 | dir == Qt::LeftToRight ? -p->right : -p->left, -p->bottom) | - | ||||||||||||||||||||||||||||||
| 2298 | : originRect; | - | ||||||||||||||||||||||||||||||
| 2299 | if (rule2.hasContentsSize()) {
| 0 | ||||||||||||||||||||||||||||||
| 2300 | QSize sz = rule2.size().expandedTo(rule2.minimumContentsSize()); | - | ||||||||||||||||||||||||||||||
| 2301 | if (sz.width() == -1) sz.setWidth(r.width()); never executed: sz.setWidth(r.width());
| 0 | ||||||||||||||||||||||||||||||
| 2302 | if (sz.height() == -1) sz.setHeight(r.height()); never executed: sz.setHeight(r.height());
| 0 | ||||||||||||||||||||||||||||||
| 2303 | r = QStyle::alignedRect(dir, position, sz, r); | - | ||||||||||||||||||||||||||||||
| 2304 | } never executed: end of block | 0 | ||||||||||||||||||||||||||||||
| 2305 | } never executed: end of block | 0 | ||||||||||||||||||||||||||||||
| 2306 | return r; never executed: return r; | 0 | ||||||||||||||||||||||||||||||
| 2307 | } | - | ||||||||||||||||||||||||||||||
| 2308 | - | |||||||||||||||||||||||||||||||
| 2309 | QRect QStyleSheetStyle::positionRect(const QWidget *w, const QRenderRule& rule1, const QRenderRule& rule2, int pe, | - | ||||||||||||||||||||||||||||||
| 2310 | const QRect& rect, Qt::LayoutDirection dir) const | - | ||||||||||||||||||||||||||||||
| 2311 | { | - | ||||||||||||||||||||||||||||||
| 2312 | const QStyleSheetPositionData *p = rule2.position(); | - | ||||||||||||||||||||||||||||||
| 2313 | Origin origin = (p && p->origin != Origin_Unknown) ? p->origin : defaultOrigin(pe);
| 0 | ||||||||||||||||||||||||||||||
| 2314 | QRect originRect = rule1.originRect(rect, origin); | - | ||||||||||||||||||||||||||||||
| 2315 | return positionRect(w, rule2, pe, originRect, dir); never executed: return positionRect(w, rule2, pe, originRect, dir); | 0 | ||||||||||||||||||||||||||||||
| 2316 | } | - | ||||||||||||||||||||||||||||||
| 2317 | - | |||||||||||||||||||||||||||||||
| 2318 | - | |||||||||||||||||||||||||||||||
| 2319 | /** \internal | - | ||||||||||||||||||||||||||||||
| 2320 | For widget that have an embedded widget (such as combobox) return that embedded widget. | - | ||||||||||||||||||||||||||||||
| 2321 | otherwise return the widget itself | - | ||||||||||||||||||||||||||||||
| 2322 | */ | - | ||||||||||||||||||||||||||||||
| 2323 | static QWidget *embeddedWidget(QWidget *w) | - | ||||||||||||||||||||||||||||||
| 2324 | { | - | ||||||||||||||||||||||||||||||
| 2325 | #ifndef QT_NO_COMBOBOX | - | ||||||||||||||||||||||||||||||
| 2326 | if (QComboBox *cmb = qobject_cast<QComboBox *>(w)) {
| 0 | ||||||||||||||||||||||||||||||
| 2327 | if (cmb->isEditable())
| 0 | ||||||||||||||||||||||||||||||
| 2328 | return cmb->lineEdit(); never executed: return cmb->lineEdit(); | 0 | ||||||||||||||||||||||||||||||
| 2329 | else | - | ||||||||||||||||||||||||||||||
| 2330 | return cmb; never executed: return cmb; | 0 | ||||||||||||||||||||||||||||||
| 2331 | } | - | ||||||||||||||||||||||||||||||
| 2332 | #endif | - | ||||||||||||||||||||||||||||||
| 2333 | - | |||||||||||||||||||||||||||||||
| 2334 | #ifndef QT_NO_SPINBOX | - | ||||||||||||||||||||||||||||||
| 2335 | if (QAbstractSpinBox *sb = qobject_cast<QAbstractSpinBox *>(w))
| 0 | ||||||||||||||||||||||||||||||
| 2336 | return sb->findChild<QLineEdit *>(); never executed: return sb->findChild<QLineEdit *>(); | 0 | ||||||||||||||||||||||||||||||
| 2337 | #endif | - | ||||||||||||||||||||||||||||||
| 2338 | - | |||||||||||||||||||||||||||||||
| 2339 | #ifndef QT_NO_SCROLLAREA | - | ||||||||||||||||||||||||||||||
| 2340 | if (QAbstractScrollArea *sa = qobject_cast<QAbstractScrollArea *>(w))
| 0 | ||||||||||||||||||||||||||||||
| 2341 | return sa->viewport(); never executed: return sa->viewport(); | 0 | ||||||||||||||||||||||||||||||
| 2342 | #endif | - | ||||||||||||||||||||||||||||||
| 2343 | - | |||||||||||||||||||||||||||||||
| 2344 | return w; never executed: return w; | 0 | ||||||||||||||||||||||||||||||
| 2345 | } | - | ||||||||||||||||||||||||||||||
| 2346 | - | |||||||||||||||||||||||||||||||
| 2347 | /** \internal | - | ||||||||||||||||||||||||||||||
| 2348 | in case w is an embedded widget, return the container widget | - | ||||||||||||||||||||||||||||||
| 2349 | (i.e, the widget for which the rules actualy apply) | - | ||||||||||||||||||||||||||||||
| 2350 | (exemple, if w is a lineedit embedded in a combobox, return the combobox) | - | ||||||||||||||||||||||||||||||
| 2351 | - | |||||||||||||||||||||||||||||||
| 2352 | if w is not embedded, return w itself | - | ||||||||||||||||||||||||||||||
| 2353 | */ | - | ||||||||||||||||||||||||||||||
| 2354 | static QWidget *containerWidget(const QWidget *w) | - | ||||||||||||||||||||||||||||||
| 2355 | { | - | ||||||||||||||||||||||||||||||
| 2356 | #ifndef QT_NO_LINEEDIT | - | ||||||||||||||||||||||||||||||
| 2357 | if (qobject_cast<const QLineEdit *>(w)) {
| 0 | ||||||||||||||||||||||||||||||
| 2358 | //if the QLineEdit is an embeddedWidget, we need the rule of the real widget | - | ||||||||||||||||||||||||||||||
| 2359 | #ifndef QT_NO_COMBOBOX | - | ||||||||||||||||||||||||||||||
| 2360 | if (qobject_cast<const QComboBox *>(w->parentWidget()))
| 0 | ||||||||||||||||||||||||||||||
| 2361 | return w->parentWidget(); never executed: return w->parentWidget(); | 0 | ||||||||||||||||||||||||||||||
| 2362 | #endif | - | ||||||||||||||||||||||||||||||
| 2363 | #ifndef QT_NO_SPINBOX | - | ||||||||||||||||||||||||||||||
| 2364 | if (qobject_cast<const QAbstractSpinBox *>(w->parentWidget()))
| 0 | ||||||||||||||||||||||||||||||
| 2365 | return w->parentWidget(); never executed: return w->parentWidget(); | 0 | ||||||||||||||||||||||||||||||
| 2366 | #endif | - | ||||||||||||||||||||||||||||||
| 2367 | } never executed: end of block | 0 | ||||||||||||||||||||||||||||||
| 2368 | #endif // QT_NO_LINEEDIT | - | ||||||||||||||||||||||||||||||
| 2369 | - | |||||||||||||||||||||||||||||||
| 2370 | #ifndef QT_NO_SCROLLAREA | - | ||||||||||||||||||||||||||||||
| 2371 | if (const QAbstractScrollArea *sa = qobject_cast<const QAbstractScrollArea *>(w->parentWidget())) {
| 0 | ||||||||||||||||||||||||||||||
| 2372 | if (sa->viewport() == w)
| 0 | ||||||||||||||||||||||||||||||
| 2373 | return w->parentWidget(); never executed: return w->parentWidget(); | 0 | ||||||||||||||||||||||||||||||
| 2374 | } never executed: end of block | 0 | ||||||||||||||||||||||||||||||
| 2375 | #endif | - | ||||||||||||||||||||||||||||||
| 2376 | - | |||||||||||||||||||||||||||||||
| 2377 | return const_cast<QWidget *>(w); never executed: return const_cast<QWidget *>(w); | 0 | ||||||||||||||||||||||||||||||
| 2378 | } | - | ||||||||||||||||||||||||||||||
| 2379 | - | |||||||||||||||||||||||||||||||
| 2380 | /** \internal | - | ||||||||||||||||||||||||||||||
| 2381 | returns \c true if the widget can NOT be styled directly | - | ||||||||||||||||||||||||||||||
| 2382 | */ | - | ||||||||||||||||||||||||||||||
| 2383 | static bool unstylable(const QWidget *w) | - | ||||||||||||||||||||||||||||||
| 2384 | { | - | ||||||||||||||||||||||||||||||
| 2385 | if (w->windowType() == Qt::Desktop)
| 0 | ||||||||||||||||||||||||||||||
| 2386 | return true; never executed: return true; | 0 | ||||||||||||||||||||||||||||||
| 2387 | - | |||||||||||||||||||||||||||||||
| 2388 | if (!w->styleSheet().isEmpty())
| 0 | ||||||||||||||||||||||||||||||
| 2389 | return false; never executed: return false; | 0 | ||||||||||||||||||||||||||||||
| 2390 | - | |||||||||||||||||||||||||||||||
| 2391 | if (containerWidget(w) != w)
| 0 | ||||||||||||||||||||||||||||||
| 2392 | return true; never executed: return true; | 0 | ||||||||||||||||||||||||||||||
| 2393 | - | |||||||||||||||||||||||||||||||
| 2394 | #ifndef QT_NO_FRAME | - | ||||||||||||||||||||||||||||||
| 2395 | // detect QComboBoxPrivateContainer | - | ||||||||||||||||||||||||||||||
| 2396 | else if (qobject_cast<const QFrame *>(w)) {
| 0 | ||||||||||||||||||||||||||||||
| 2397 | if (0 | - | ||||||||||||||||||||||||||||||
| 2398 | #ifndef QT_NO_COMBOBOX | - | ||||||||||||||||||||||||||||||
| 2399 | || qobject_cast<const QComboBox *>(w->parentWidget())
| 0 | ||||||||||||||||||||||||||||||
| 2400 | #endif | - | ||||||||||||||||||||||||||||||
| 2401 | ) | - | ||||||||||||||||||||||||||||||
| 2402 | return true; never executed: return true; | 0 | ||||||||||||||||||||||||||||||
| 2403 | } never executed: end of block | 0 | ||||||||||||||||||||||||||||||
| 2404 | #endif | - | ||||||||||||||||||||||||||||||
| 2405 | - | |||||||||||||||||||||||||||||||
| 2406 | #ifndef QT_NO_TABBAR | - | ||||||||||||||||||||||||||||||
| 2407 | if (w->metaObject() == &QWidget::staticMetaObject
| 0 | ||||||||||||||||||||||||||||||
| 2408 | && qobject_cast<const QTabBar*>(w->parentWidget()))
| 0 | ||||||||||||||||||||||||||||||
| 2409 | return true; // The moving tab of a QTabBar never executed: return true; | 0 | ||||||||||||||||||||||||||||||
| 2410 | #endif | - | ||||||||||||||||||||||||||||||
| 2411 | - | |||||||||||||||||||||||||||||||
| 2412 | return false; never executed: return false; | 0 | ||||||||||||||||||||||||||||||
| 2413 | } | - | ||||||||||||||||||||||||||||||
| 2414 | - | |||||||||||||||||||||||||||||||
| 2415 | static quint64 extendedPseudoClass(const QWidget *w) | - | ||||||||||||||||||||||||||||||
| 2416 | { | - | ||||||||||||||||||||||||||||||
| 2417 | quint64 pc = w->isWindow() ? quint64(PseudoClass_Window) : 0;
| 0 | ||||||||||||||||||||||||||||||
| 2418 | if (const QAbstractSlider *slider = qobject_cast<const QAbstractSlider *>(w)) {
| 0 | ||||||||||||||||||||||||||||||
| 2419 | pc |= ((slider->orientation() == Qt::Vertical) ? PseudoClass_Vertical : PseudoClass_Horizontal);
| 0 | ||||||||||||||||||||||||||||||
| 2420 | } else never executed: end of block | 0 | ||||||||||||||||||||||||||||||
| 2421 | #ifndef QT_NO_COMBOBOX | - | ||||||||||||||||||||||||||||||
| 2422 | if (const QComboBox *combo = qobject_cast<const QComboBox *>(w)) {
| 0 | ||||||||||||||||||||||||||||||
| 2423 | if (combo->isEditable())
| 0 | ||||||||||||||||||||||||||||||
| 2424 | pc |= (combo->isEditable() ? PseudoClass_Editable : PseudoClass_ReadOnly); never executed: pc |= (combo->isEditable() ? PseudoClass_Editable : PseudoClass_ReadOnly);
| 0 | ||||||||||||||||||||||||||||||
| 2425 | } else never executed: end of block | 0 | ||||||||||||||||||||||||||||||
| 2426 | #endif | - | ||||||||||||||||||||||||||||||
| 2427 | #ifndef QT_NO_LINEEDIT | - | ||||||||||||||||||||||||||||||
| 2428 | if (const QLineEdit *edit = qobject_cast<const QLineEdit *>(w)) {
| 0 | ||||||||||||||||||||||||||||||
| 2429 | pc |= (edit->isReadOnly() ? PseudoClass_ReadOnly : PseudoClass_Editable);
| 0 | ||||||||||||||||||||||||||||||
| 2430 | } else never executed: end of block | 0 | ||||||||||||||||||||||||||||||
| 2431 | #endif | - | ||||||||||||||||||||||||||||||
| 2432 | { } // required for the above ifdef'ery to work never executed: end of block | 0 | ||||||||||||||||||||||||||||||
| 2433 | return pc; never executed: return pc; | 0 | ||||||||||||||||||||||||||||||
| 2434 | } | - | ||||||||||||||||||||||||||||||
| 2435 | - | |||||||||||||||||||||||||||||||
| 2436 | // sets up the geometry of the widget. We set a dynamic property when | - | ||||||||||||||||||||||||||||||
| 2437 | // we modify the min/max size of the widget. The min/max size is restored | - | ||||||||||||||||||||||||||||||
| 2438 | // to their original value when a new stylesheet that does not contain | - | ||||||||||||||||||||||||||||||
| 2439 | // the CSS properties is set and when the widget has this dynamic property set. | - | ||||||||||||||||||||||||||||||
| 2440 | // This way we don't trample on users who had setup a min/max size in code and | - | ||||||||||||||||||||||||||||||
| 2441 | // don't use stylesheets at all. | - | ||||||||||||||||||||||||||||||
| 2442 | void QStyleSheetStyle::setGeometry(QWidget *w) | - | ||||||||||||||||||||||||||||||
| 2443 | { | - | ||||||||||||||||||||||||||||||
| 2444 | QRenderRule rule = renderRule(w, PseudoElement_None, PseudoClass_Enabled | extendedPseudoClass(w)); | - | ||||||||||||||||||||||||||||||
| 2445 | const QStyleSheetGeometryData *geo = rule.geometry(); | - | ||||||||||||||||||||||||||||||
| 2446 | if (w->property("_q_stylesheet_minw").toBool()
| 0 | ||||||||||||||||||||||||||||||
| 2447 | && ((!rule.hasGeometry() || geo->minWidth == -1))) {
| 0 | ||||||||||||||||||||||||||||||
| 2448 | w->setMinimumWidth(0); | - | ||||||||||||||||||||||||||||||
| 2449 | w->setProperty("_q_stylesheet_minw", QVariant()); | - | ||||||||||||||||||||||||||||||
| 2450 | } never executed: end of block | 0 | ||||||||||||||||||||||||||||||
| 2451 | if (w->property("_q_stylesheet_minh").toBool()
| 0 | ||||||||||||||||||||||||||||||
| 2452 | && ((!rule.hasGeometry() || geo->minHeight == -1))) {
| 0 | ||||||||||||||||||||||||||||||
| 2453 | w->setMinimumHeight(0); | - | ||||||||||||||||||||||||||||||
| 2454 | w->setProperty("_q_stylesheet_minh", QVariant()); | - | ||||||||||||||||||||||||||||||
| 2455 | } never executed: end of block | 0 | ||||||||||||||||||||||||||||||
| 2456 | if (w->property("_q_stylesheet_maxw").toBool()
| 0 | ||||||||||||||||||||||||||||||
| 2457 | && ((!rule.hasGeometry() || geo->maxWidth == -1))) {
| 0 | ||||||||||||||||||||||||||||||
| 2458 | w->setMaximumWidth(QWIDGETSIZE_MAX); | - | ||||||||||||||||||||||||||||||
| 2459 | w->setProperty("_q_stylesheet_maxw", QVariant()); | - | ||||||||||||||||||||||||||||||
| 2460 | } never executed: end of block | 0 | ||||||||||||||||||||||||||||||
| 2461 | if (w->property("_q_stylesheet_maxh").toBool()
| 0 | ||||||||||||||||||||||||||||||
| 2462 | && ((!rule.hasGeometry() || geo->maxHeight == -1))) {
| 0 | ||||||||||||||||||||||||||||||
| 2463 | w->setMaximumHeight(QWIDGETSIZE_MAX); | - | ||||||||||||||||||||||||||||||
| 2464 | w->setProperty("_q_stylesheet_maxh", QVariant()); | - | ||||||||||||||||||||||||||||||
| 2465 | } never executed: end of block | 0 | ||||||||||||||||||||||||||||||
| 2466 | - | |||||||||||||||||||||||||||||||
| 2467 | - | |||||||||||||||||||||||||||||||
| 2468 | if (rule.hasGeometry()) {
| 0 | ||||||||||||||||||||||||||||||
| 2469 | if (geo->minWidth != -1) {
| 0 | ||||||||||||||||||||||||||||||
| 2470 | w->setProperty("_q_stylesheet_minw", true); | - | ||||||||||||||||||||||||||||||
| 2471 | w->setMinimumWidth(rule.boxSize(QSize(qMax(geo->width, geo->minWidth), 0)).width()); | - | ||||||||||||||||||||||||||||||
| 2472 | } never executed: end of block | 0 | ||||||||||||||||||||||||||||||
| 2473 | if (geo->minHeight != -1) {
| 0 | ||||||||||||||||||||||||||||||
| 2474 | w->setProperty("_q_stylesheet_minh", true); | - | ||||||||||||||||||||||||||||||
| 2475 | w->setMinimumHeight(rule.boxSize(QSize(0, qMax(geo->height, geo->minHeight))).height()); | - | ||||||||||||||||||||||||||||||
| 2476 | } never executed: end of block | 0 | ||||||||||||||||||||||||||||||
| 2477 | if (geo->maxWidth != -1) {
| 0 | ||||||||||||||||||||||||||||||
| 2478 | w->setProperty("_q_stylesheet_maxw", true); | - | ||||||||||||||||||||||||||||||
| 2479 | w->setMaximumWidth(rule.boxSize(QSize(qMin(geo->width == -1 ? QWIDGETSIZE_MAX : geo->width, | - | ||||||||||||||||||||||||||||||
| 2480 | geo->maxWidth == -1 ? QWIDGETSIZE_MAX : geo->maxWidth), 0)).width()); | - | ||||||||||||||||||||||||||||||
| 2481 | } never executed: end of block | 0 | ||||||||||||||||||||||||||||||
| 2482 | if (geo->maxHeight != -1) {
| 0 | ||||||||||||||||||||||||||||||
| 2483 | w->setProperty("_q_stylesheet_maxh", true); | - | ||||||||||||||||||||||||||||||
| 2484 | w->setMaximumHeight(rule.boxSize(QSize(0, qMin(geo->height == -1 ? QWIDGETSIZE_MAX : geo->height, | - | ||||||||||||||||||||||||||||||
| 2485 | geo->maxHeight == -1 ? QWIDGETSIZE_MAX : geo->maxHeight))).height()); | - | ||||||||||||||||||||||||||||||
| 2486 | } never executed: end of block | 0 | ||||||||||||||||||||||||||||||
| 2487 | } never executed: end of block | 0 | ||||||||||||||||||||||||||||||
| 2488 | } never executed: end of block | 0 | ||||||||||||||||||||||||||||||
| 2489 | - | |||||||||||||||||||||||||||||||
| 2490 | void QStyleSheetStyle::setProperties(QWidget *w) | - | ||||||||||||||||||||||||||||||
| 2491 | { | - | ||||||||||||||||||||||||||||||
| 2492 | // The final occurrence of each property is authoritative. | - | ||||||||||||||||||||||||||||||
| 2493 | // Set value for each property in the order of property final occurrence | - | ||||||||||||||||||||||||||||||
| 2494 | // since properties interact. | - | ||||||||||||||||||||||||||||||
| 2495 | - | |||||||||||||||||||||||||||||||
| 2496 | const QVector<Declaration> decls = declarations(styleRules(w), QString()); | - | ||||||||||||||||||||||||||||||
| 2497 | QVector<int> finals; // indices in reverse order of each property's final occurrence | - | ||||||||||||||||||||||||||||||
| 2498 | - | |||||||||||||||||||||||||||||||
| 2499 | { | - | ||||||||||||||||||||||||||||||
| 2500 | // scan decls for final occurrence of each "qproperty" | - | ||||||||||||||||||||||||||||||
| 2501 | QSet<const QString> propertySet; | - | ||||||||||||||||||||||||||||||
| 2502 | for (int i = decls.count() - 1; i >= 0; --i) {
| 0 | ||||||||||||||||||||||||||||||
| 2503 | const QString property = decls.at(i).d->property; | - | ||||||||||||||||||||||||||||||
| 2504 | if (!property.startsWith(QLatin1String("qproperty-"), Qt::CaseInsensitive))
| 0 | ||||||||||||||||||||||||||||||
| 2505 | continue; never executed: continue; | 0 | ||||||||||||||||||||||||||||||
| 2506 | if (!propertySet.contains(property)) {
| 0 | ||||||||||||||||||||||||||||||
| 2507 | propertySet.insert(property); | - | ||||||||||||||||||||||||||||||
| 2508 | finals.append(i); | - | ||||||||||||||||||||||||||||||
| 2509 | } never executed: end of block | 0 | ||||||||||||||||||||||||||||||
| 2510 | } never executed: end of block | 0 | ||||||||||||||||||||||||||||||
| 2511 | } | - | ||||||||||||||||||||||||||||||
| 2512 | - | |||||||||||||||||||||||||||||||
| 2513 | for (int i = finals.count() - 1; i >= 0; --i) {
| 0 | ||||||||||||||||||||||||||||||
| 2514 | const Declaration &decl = decls.at(finals[i]); | - | ||||||||||||||||||||||||||||||
| 2515 | QString property = decl.d->property; | - | ||||||||||||||||||||||||||||||
| 2516 | property.remove(0, 10); // strip "qproperty-" | - | ||||||||||||||||||||||||||||||
| 2517 | - | |||||||||||||||||||||||||||||||
| 2518 | const QMetaObject *metaObject = w->metaObject(); | - | ||||||||||||||||||||||||||||||
| 2519 | int index = metaObject->indexOfProperty(property.toLatin1()); | - | ||||||||||||||||||||||||||||||
| 2520 | if (index == -1) {
| 0 | ||||||||||||||||||||||||||||||
| 2521 | qWarning() << w << " does not have a property named " << property; | - | ||||||||||||||||||||||||||||||
| 2522 | continue; never executed: continue; | 0 | ||||||||||||||||||||||||||||||
| 2523 | } | - | ||||||||||||||||||||||||||||||
| 2524 | const QMetaProperty metaProperty = metaObject->property(index); | - | ||||||||||||||||||||||||||||||
| 2525 | if (!metaProperty.isWritable() || !metaProperty.isDesignable()) {
| 0 | ||||||||||||||||||||||||||||||
| 2526 | qWarning() << w << " cannot design property named " << property; | - | ||||||||||||||||||||||||||||||
| 2527 | continue; never executed: continue; | 0 | ||||||||||||||||||||||||||||||
| 2528 | } | - | ||||||||||||||||||||||||||||||
| 2529 | - | |||||||||||||||||||||||||||||||
| 2530 | QVariant v; | - | ||||||||||||||||||||||||||||||
| 2531 | const QVariant value = w->property(property.toLatin1()); | - | ||||||||||||||||||||||||||||||
| 2532 | switch (value.type()) { | - | ||||||||||||||||||||||||||||||
| 2533 | case QVariant::Icon: v = decl.iconValue(); break; never executed: break;never executed: case QVariant::Icon: | 0 | ||||||||||||||||||||||||||||||
| 2534 | case QVariant::Image: v = QImage(decl.uriValue()); break; never executed: break;never executed: case QVariant::Image: | 0 | ||||||||||||||||||||||||||||||
| 2535 | case QVariant::Pixmap: v = QPixmap(decl.uriValue()); break; never executed: break;never executed: case QVariant::Pixmap: | 0 | ||||||||||||||||||||||||||||||
| 2536 | case QVariant::Rect: v = decl.rectValue(); break; never executed: break;never executed: case QVariant::Rect: | 0 | ||||||||||||||||||||||||||||||
| 2537 | case QVariant::Size: v = decl.sizeValue(); break; never executed: break;never executed: case QVariant::Size: | 0 | ||||||||||||||||||||||||||||||
| 2538 | case QVariant::Color: v = decl.colorValue(); break; never executed: break;never executed: case QVariant::Color: | 0 | ||||||||||||||||||||||||||||||
| 2539 | case QVariant::Brush: v = decl.brushValue(); break; never executed: break;never executed: case QVariant::Brush: | 0 | ||||||||||||||||||||||||||||||
| 2540 | #ifndef QT_NO_SHORTCUT | - | ||||||||||||||||||||||||||||||
| 2541 | case QVariant::KeySequence: v = QKeySequence(decl.d->values.at(0).variant.toString()); break; never executed: break;never executed: case QVariant::KeySequence: | 0 | ||||||||||||||||||||||||||||||
| 2542 | #endif | - | ||||||||||||||||||||||||||||||
| 2543 | default: v = decl.d->values.at(0).variant; break; never executed: break;never executed: default: | 0 | ||||||||||||||||||||||||||||||
| 2544 | } | - | ||||||||||||||||||||||||||||||
| 2545 | - | |||||||||||||||||||||||||||||||
| 2546 | w->setProperty(property.toLatin1(), v); | - | ||||||||||||||||||||||||||||||
| 2547 | } never executed: end of block | 0 | ||||||||||||||||||||||||||||||
| 2548 | } never executed: end of block | 0 | ||||||||||||||||||||||||||||||
| 2549 | - | |||||||||||||||||||||||||||||||
| 2550 | void QStyleSheetStyle::setPalette(QWidget *w) | - | ||||||||||||||||||||||||||||||
| 2551 | { | - | ||||||||||||||||||||||||||||||
| 2552 | struct RuleRoleMap { | - | ||||||||||||||||||||||||||||||
| 2553 | int state; | - | ||||||||||||||||||||||||||||||
| 2554 | QPalette::ColorGroup group; | - | ||||||||||||||||||||||||||||||
| 2555 | } map[3] = { | - | ||||||||||||||||||||||||||||||
| 2556 | { int(PseudoClass_Active | PseudoClass_Enabled), QPalette::Active }, | - | ||||||||||||||||||||||||||||||
| 2557 | { PseudoClass_Disabled, QPalette::Disabled }, | - | ||||||||||||||||||||||||||||||
| 2558 | { PseudoClass_Enabled, QPalette::Inactive } | - | ||||||||||||||||||||||||||||||
| 2559 | }; | - | ||||||||||||||||||||||||||||||
| 2560 | - | |||||||||||||||||||||||||||||||
| 2561 | QPalette p = w->palette(); | - | ||||||||||||||||||||||||||||||
| 2562 | QWidget *ew = embeddedWidget(w); | - | ||||||||||||||||||||||||||||||
| 2563 | - | |||||||||||||||||||||||||||||||
| 2564 | for (int i = 0; i < 3; i++) {
| 0 | ||||||||||||||||||||||||||||||
| 2565 | QRenderRule rule = renderRule(w, PseudoElement_None, map[i].state | extendedPseudoClass(w)); | - | ||||||||||||||||||||||||||||||
| 2566 | if (i == 0) {
| 0 | ||||||||||||||||||||||||||||||
| 2567 | if (!w->property("_q_styleSheetWidgetFont").isValid()) {
| 0 | ||||||||||||||||||||||||||||||
| 2568 | saveWidgetFont(w, w->font()); | - | ||||||||||||||||||||||||||||||
| 2569 | } never executed: end of block | 0 | ||||||||||||||||||||||||||||||
| 2570 | updateStyleSheetFont(w); | - | ||||||||||||||||||||||||||||||
| 2571 | if (ew != w)
| 0 | ||||||||||||||||||||||||||||||
| 2572 | updateStyleSheetFont(ew); never executed: updateStyleSheetFont(ew); | 0 | ||||||||||||||||||||||||||||||
| 2573 | } never executed: end of block | 0 | ||||||||||||||||||||||||||||||
| 2574 | - | |||||||||||||||||||||||||||||||
| 2575 | rule.configurePalette(&p, map[i].group, ew, ew != w); | - | ||||||||||||||||||||||||||||||
| 2576 | } never executed: end of block | 0 | ||||||||||||||||||||||||||||||
| 2577 | - | |||||||||||||||||||||||||||||||
| 2578 | styleSheetCaches->customPaletteWidgets.insert(w, w->palette()); | - | ||||||||||||||||||||||||||||||
| 2579 | w->setPalette(p); | - | ||||||||||||||||||||||||||||||
| 2580 | if (ew != w)
| 0 | ||||||||||||||||||||||||||||||
| 2581 | ew->setPalette(p); never executed: ew->setPalette(p); | 0 | ||||||||||||||||||||||||||||||
| 2582 | } never executed: end of block | 0 | ||||||||||||||||||||||||||||||
| 2583 | - | |||||||||||||||||||||||||||||||
| 2584 | void QStyleSheetStyle::unsetPalette(QWidget *w) | - | ||||||||||||||||||||||||||||||
| 2585 | { | - | ||||||||||||||||||||||||||||||
| 2586 | if (styleSheetCaches->customPaletteWidgets.contains(w)) {
| 0 | ||||||||||||||||||||||||||||||
| 2587 | QPalette p = styleSheetCaches->customPaletteWidgets.value(w); | - | ||||||||||||||||||||||||||||||
| 2588 | w->setPalette(p); | - | ||||||||||||||||||||||||||||||
| 2589 | QWidget *ew = embeddedWidget(w); | - | ||||||||||||||||||||||||||||||
| 2590 | if (ew != w)
| 0 | ||||||||||||||||||||||||||||||
| 2591 | ew->setPalette(p); never executed: ew->setPalette(p); | 0 | ||||||||||||||||||||||||||||||
| 2592 | styleSheetCaches->customPaletteWidgets.remove(w); | - | ||||||||||||||||||||||||||||||
| 2593 | } never executed: end of block | 0 | ||||||||||||||||||||||||||||||
| 2594 | QVariant oldFont = w->property("_q_styleSheetWidgetFont"); | - | ||||||||||||||||||||||||||||||
| 2595 | if (oldFont.isValid()) {
| 0 | ||||||||||||||||||||||||||||||
| 2596 | w->setFont(qvariant_cast<QFont>(oldFont)); | - | ||||||||||||||||||||||||||||||
| 2597 | } never executed: end of block | 0 | ||||||||||||||||||||||||||||||
| 2598 | if (styleSheetCaches->autoFillDisabledWidgets.contains(w)) {
| 0 | ||||||||||||||||||||||||||||||
| 2599 | embeddedWidget(w)->setAutoFillBackground(true); | - | ||||||||||||||||||||||||||||||
| 2600 | styleSheetCaches->autoFillDisabledWidgets.remove(w); | - | ||||||||||||||||||||||||||||||
| 2601 | } never executed: end of block | 0 | ||||||||||||||||||||||||||||||
| 2602 | } never executed: end of block | 0 | ||||||||||||||||||||||||||||||
| 2603 | - | |||||||||||||||||||||||||||||||
| 2604 | static void updateObjects(const QList<const QObject *>& objects) | - | ||||||||||||||||||||||||||||||
| 2605 | { | - | ||||||||||||||||||||||||||||||
| 2606 | if (!styleSheetCaches->styleRulesCache.isEmpty() || !styleSheetCaches->hasStyleRuleCache.isEmpty() || !styleSheetCaches->renderRulesCache.isEmpty()) {
| 0 | ||||||||||||||||||||||||||||||
| 2607 | for (int i = 0; i < objects.size(); ++i) {
| 0 | ||||||||||||||||||||||||||||||
| 2608 | const QObject *object = objects.at(i); | - | ||||||||||||||||||||||||||||||
| 2609 | styleSheetCaches->styleRulesCache.remove(object); | - | ||||||||||||||||||||||||||||||
| 2610 | styleSheetCaches->hasStyleRuleCache.remove(object); | - | ||||||||||||||||||||||||||||||
| 2611 | styleSheetCaches->renderRulesCache.remove(object); | - | ||||||||||||||||||||||||||||||
| 2612 | } never executed: end of block | 0 | ||||||||||||||||||||||||||||||
| 2613 | } never executed: end of block | 0 | ||||||||||||||||||||||||||||||
| 2614 | - | |||||||||||||||||||||||||||||||
| 2615 | QWidgetList widgets; | - | ||||||||||||||||||||||||||||||
| 2616 | foreach (const QObject *object, objects) { | - | ||||||||||||||||||||||||||||||
| 2617 | if (QWidget *w = qobject_cast<QWidget*>(const_cast<QObject*>(object)))
| 0 | ||||||||||||||||||||||||||||||
| 2618 | widgets << w; never executed: widgets << w; | 0 | ||||||||||||||||||||||||||||||
| 2619 | } never executed: end of block | 0 | ||||||||||||||||||||||||||||||
| 2620 | - | |||||||||||||||||||||||||||||||
| 2621 | QEvent event(QEvent::StyleChange); | - | ||||||||||||||||||||||||||||||
| 2622 | foreach (QWidget *widget, widgets) { | - | ||||||||||||||||||||||||||||||
| 2623 | widget->style()->polish(widget); | - | ||||||||||||||||||||||||||||||
| 2624 | QApplication::sendEvent(widget, &event); | - | ||||||||||||||||||||||||||||||
| 2625 | } never executed: end of block | 0 | ||||||||||||||||||||||||||||||
| 2626 | } never executed: end of block | 0 | ||||||||||||||||||||||||||||||
| 2627 | - | |||||||||||||||||||||||||||||||
| 2628 | ///////////////////////////////////////////////////////////////////////////////////////// | - | ||||||||||||||||||||||||||||||
| 2629 | // The stylesheet style | - | ||||||||||||||||||||||||||||||
| 2630 | int QStyleSheetStyle::numinstances = 0; | - | ||||||||||||||||||||||||||||||
| 2631 | - | |||||||||||||||||||||||||||||||
| 2632 | QStyleSheetStyle::QStyleSheetStyle(QStyle *base) | - | ||||||||||||||||||||||||||||||
| 2633 | : QWindowsStyle(*new QStyleSheetStylePrivate), base(base), refcount(1) | - | ||||||||||||||||||||||||||||||
| 2634 | { | - | ||||||||||||||||||||||||||||||
| 2635 | ++numinstances; | - | ||||||||||||||||||||||||||||||
| 2636 | if (numinstances == 1) {
| 0 | ||||||||||||||||||||||||||||||
| 2637 | styleSheetCaches = new QStyleSheetStyleCaches; | - | ||||||||||||||||||||||||||||||
| 2638 | } never executed: end of block | 0 | ||||||||||||||||||||||||||||||
| 2639 | } never executed: end of block | 0 | ||||||||||||||||||||||||||||||
| 2640 | - | |||||||||||||||||||||||||||||||
| 2641 | QStyleSheetStyle::~QStyleSheetStyle() | - | ||||||||||||||||||||||||||||||
| 2642 | { | - | ||||||||||||||||||||||||||||||
| 2643 | --numinstances; | - | ||||||||||||||||||||||||||||||
| 2644 | if (numinstances == 0) {
| 0 | ||||||||||||||||||||||||||||||
| 2645 | delete styleSheetCaches; | - | ||||||||||||||||||||||||||||||
| 2646 | } never executed: end of block | 0 | ||||||||||||||||||||||||||||||
| 2647 | } never executed: end of block | 0 | ||||||||||||||||||||||||||||||
| 2648 | QStyle *QStyleSheetStyle::baseStyle() const | - | ||||||||||||||||||||||||||||||
| 2649 | { | - | ||||||||||||||||||||||||||||||
| 2650 | if (base)
| 0 | ||||||||||||||||||||||||||||||
| 2651 | return base; never executed: return base; | 0 | ||||||||||||||||||||||||||||||
| 2652 | if (QStyleSheetStyle *me = qobject_cast<QStyleSheetStyle *>(QApplication::style()))
| 0 | ||||||||||||||||||||||||||||||
| 2653 | return me->base; never executed: return me->base; | 0 | ||||||||||||||||||||||||||||||
| 2654 | return QApplication::style(); never executed: return QApplication::style(); | 0 | ||||||||||||||||||||||||||||||
| 2655 | } | - | ||||||||||||||||||||||||||||||
| 2656 | - | |||||||||||||||||||||||||||||||
| 2657 | void QStyleSheetStyleCaches::objectDestroyed(QObject *o) | - | ||||||||||||||||||||||||||||||
| 2658 | { | - | ||||||||||||||||||||||||||||||
| 2659 | styleRulesCache.remove(o); | - | ||||||||||||||||||||||||||||||
| 2660 | hasStyleRuleCache.remove(o); | - | ||||||||||||||||||||||||||||||
| 2661 | renderRulesCache.remove(o); | - | ||||||||||||||||||||||||||||||
| 2662 | customPaletteWidgets.remove((const QWidget *)o); | - | ||||||||||||||||||||||||||||||
| 2663 | styleSheetCache.remove(o); | - | ||||||||||||||||||||||||||||||
| 2664 | autoFillDisabledWidgets.remove((const QWidget *)o); | - | ||||||||||||||||||||||||||||||
| 2665 | } never executed: end of block | 0 | ||||||||||||||||||||||||||||||
| 2666 | - | |||||||||||||||||||||||||||||||
| 2667 | void QStyleSheetStyleCaches::styleDestroyed(QObject *o) | - | ||||||||||||||||||||||||||||||
| 2668 | { | - | ||||||||||||||||||||||||||||||
| 2669 | styleSheetCache.remove(o); | - | ||||||||||||||||||||||||||||||
| 2670 | } never executed: end of block | 0 | ||||||||||||||||||||||||||||||
| 2671 | - | |||||||||||||||||||||||||||||||
| 2672 | /*! | - | ||||||||||||||||||||||||||||||
| 2673 | * Make sure that the cache will be clean by connecting destroyed if needed. | - | ||||||||||||||||||||||||||||||
| 2674 | * return false if the widget is not stylable; | - | ||||||||||||||||||||||||||||||
| 2675 | */ | - | ||||||||||||||||||||||||||||||
| 2676 | bool QStyleSheetStyle::initObject(const QObject *obj) const | - | ||||||||||||||||||||||||||||||
| 2677 | { | - | ||||||||||||||||||||||||||||||
| 2678 | if (!obj)
| 0 | ||||||||||||||||||||||||||||||
| 2679 | return false; never executed: return false; | 0 | ||||||||||||||||||||||||||||||
| 2680 | if (const QWidget *w = qobject_cast<const QWidget*>(obj)) {
| 0 | ||||||||||||||||||||||||||||||
| 2681 | if (w->testAttribute(Qt::WA_StyleSheet))
| 0 | ||||||||||||||||||||||||||||||
| 2682 | return true; never executed: return true; | 0 | ||||||||||||||||||||||||||||||
| 2683 | if (unstylable(w))
| 0 | ||||||||||||||||||||||||||||||
| 2684 | return false; never executed: return false; | 0 | ||||||||||||||||||||||||||||||
| 2685 | const_cast<QWidget *>(w)->setAttribute(Qt::WA_StyleSheet, true); | - | ||||||||||||||||||||||||||||||
| 2686 | } never executed: end of block | 0 | ||||||||||||||||||||||||||||||
| 2687 | - | |||||||||||||||||||||||||||||||
| 2688 | QObject::connect(obj, SIGNAL(destroyed(QObject*)), styleSheetCaches, SLOT(objectDestroyed(QObject*)), Qt::UniqueConnection); | - | ||||||||||||||||||||||||||||||
| 2689 | return true; never executed: return true; | 0 | ||||||||||||||||||||||||||||||
| 2690 | } | - | ||||||||||||||||||||||||||||||
| 2691 | - | |||||||||||||||||||||||||||||||
| 2692 | void QStyleSheetStyle::polish(QWidget *w) | - | ||||||||||||||||||||||||||||||
| 2693 | { | - | ||||||||||||||||||||||||||||||
| 2694 | baseStyle()->polish(w); | - | ||||||||||||||||||||||||||||||
| 2695 | RECURSION_GUARD(return) never executed: return;
| 0 | ||||||||||||||||||||||||||||||
| 2696 | - | |||||||||||||||||||||||||||||||
| 2697 | if (!initObject(w))
| 0 | ||||||||||||||||||||||||||||||
| 2698 | return; never executed: return; | 0 | ||||||||||||||||||||||||||||||
| 2699 | - | |||||||||||||||||||||||||||||||
| 2700 | if (styleSheetCaches->styleRulesCache.contains(w)) {
| 0 | ||||||||||||||||||||||||||||||
| 2701 | // the widget accessed its style pointer before polish (or repolish) | - | ||||||||||||||||||||||||||||||
| 2702 | // (exemple: the QAbstractSpinBox constructor ask for the stylehint) | - | ||||||||||||||||||||||||||||||
| 2703 | styleSheetCaches->styleRulesCache.remove(w); | - | ||||||||||||||||||||||||||||||
| 2704 | styleSheetCaches->hasStyleRuleCache.remove(w); | - | ||||||||||||||||||||||||||||||
| 2705 | styleSheetCaches->renderRulesCache.remove(w); | - | ||||||||||||||||||||||||||||||
| 2706 | styleSheetCaches->styleSheetCache.remove(w); | - | ||||||||||||||||||||||||||||||
| 2707 | } never executed: end of block | 0 | ||||||||||||||||||||||||||||||
| 2708 | setGeometry(w); | - | ||||||||||||||||||||||||||||||
| 2709 | setProperties(w); | - | ||||||||||||||||||||||||||||||
| 2710 | unsetPalette(w); | - | ||||||||||||||||||||||||||||||
| 2711 | setPalette(w); | - | ||||||||||||||||||||||||||||||
| 2712 | - | |||||||||||||||||||||||||||||||
| 2713 | //set the WA_Hover attribute if one of the selector depends of the hover state | - | ||||||||||||||||||||||||||||||
| 2714 | QVector<StyleRule> rules = styleRules(w); | - | ||||||||||||||||||||||||||||||
| 2715 | for (int i = 0; i < rules.count(); i++) {
| 0 | ||||||||||||||||||||||||||||||
| 2716 | const Selector& selector = rules.at(i).selectors.at(0); | - | ||||||||||||||||||||||||||||||
| 2717 | quint64 negated = 0; | - | ||||||||||||||||||||||||||||||
| 2718 | quint64 cssClass = selector.pseudoClass(&negated); | - | ||||||||||||||||||||||||||||||
| 2719 | if ( cssClass & PseudoClass_Hover || negated & PseudoClass_Hover) {
| 0 | ||||||||||||||||||||||||||||||
| 2720 | w->setAttribute(Qt::WA_Hover); | - | ||||||||||||||||||||||||||||||
| 2721 | embeddedWidget(w)->setAttribute(Qt::WA_Hover); | - | ||||||||||||||||||||||||||||||
| 2722 | } never executed: end of block | 0 | ||||||||||||||||||||||||||||||
| 2723 | } never executed: end of block | 0 | ||||||||||||||||||||||||||||||
| 2724 | - | |||||||||||||||||||||||||||||||
| 2725 | - | |||||||||||||||||||||||||||||||
| 2726 | #ifndef QT_NO_SCROLLAREA | - | ||||||||||||||||||||||||||||||
| 2727 | if (QAbstractScrollArea *sa = qobject_cast<QAbstractScrollArea *>(w)) {
| 0 | ||||||||||||||||||||||||||||||
| 2728 | QRenderRule rule = renderRule(sa, PseudoElement_None, PseudoClass_Enabled); | - | ||||||||||||||||||||||||||||||
| 2729 | if ((rule.hasBorder() && rule.border()->hasBorderImage())
| 0 | ||||||||||||||||||||||||||||||
| 2730 | || (rule.hasBackground() && !rule.background()->pixmap.isNull())) {
| 0 | ||||||||||||||||||||||||||||||
| 2731 | QObject::connect(sa->horizontalScrollBar(), SIGNAL(valueChanged(int)), | - | ||||||||||||||||||||||||||||||
| 2732 | sa, SLOT(update()), Qt::UniqueConnection); | - | ||||||||||||||||||||||||||||||
| 2733 | QObject::connect(sa->verticalScrollBar(), SIGNAL(valueChanged(int)), | - | ||||||||||||||||||||||||||||||
| 2734 | sa, SLOT(update()), Qt::UniqueConnection); | - | ||||||||||||||||||||||||||||||
| 2735 | } never executed: end of block | 0 | ||||||||||||||||||||||||||||||
| 2736 | } never executed: end of block | 0 | ||||||||||||||||||||||||||||||
| 2737 | #endif | - | ||||||||||||||||||||||||||||||
| 2738 | - | |||||||||||||||||||||||||||||||
| 2739 | QRenderRule rule = renderRule(w, PseudoElement_None, PseudoClass_Any); | - | ||||||||||||||||||||||||||||||
| 2740 | if (rule.hasDrawable() || rule.hasBox()) {
| 0 | ||||||||||||||||||||||||||||||
| 2741 | if (w->metaObject() == &QWidget::staticMetaObject
| 0 | ||||||||||||||||||||||||||||||
| 2742 | #ifndef QT_NO_ITEMVIEWS | - | ||||||||||||||||||||||||||||||
| 2743 | || qobject_cast<QHeaderView *>(w)
| 0 | ||||||||||||||||||||||||||||||
| 2744 | #endif | - | ||||||||||||||||||||||||||||||
| 2745 | #ifndef QT_NO_TABBAR | - | ||||||||||||||||||||||||||||||
| 2746 | || qobject_cast<QTabBar *>(w)
| 0 | ||||||||||||||||||||||||||||||
| 2747 | #endif | - | ||||||||||||||||||||||||||||||
| 2748 | #ifndef QT_NO_FRAME | - | ||||||||||||||||||||||||||||||
| 2749 | || qobject_cast<QFrame *>(w)
| 0 | ||||||||||||||||||||||||||||||
| 2750 | #endif | - | ||||||||||||||||||||||||||||||
| 2751 | #ifndef QT_NO_MAINWINDOW | - | ||||||||||||||||||||||||||||||
| 2752 | || qobject_cast<QMainWindow *>(w)
| 0 | ||||||||||||||||||||||||||||||
| 2753 | #endif | - | ||||||||||||||||||||||||||||||
| 2754 | #ifndef QT_NO_MDIAREA | - | ||||||||||||||||||||||||||||||
| 2755 | || qobject_cast<QMdiSubWindow *>(w)
| 0 | ||||||||||||||||||||||||||||||
| 2756 | #endif | - | ||||||||||||||||||||||||||||||
| 2757 | #ifndef QT_NO_MENUBAR | - | ||||||||||||||||||||||||||||||
| 2758 | || qobject_cast<QMenuBar *>(w)
| 0 | ||||||||||||||||||||||||||||||
| 2759 | #endif | - | ||||||||||||||||||||||||||||||
| 2760 | || qobject_cast<QDialog *>(w)) {
| 0 | ||||||||||||||||||||||||||||||
| 2761 | w->setAttribute(Qt::WA_StyledBackground, true); | - | ||||||||||||||||||||||||||||||
| 2762 | } never executed: end of block | 0 | ||||||||||||||||||||||||||||||
| 2763 | QWidget *ew = embeddedWidget(w); | - | ||||||||||||||||||||||||||||||
| 2764 | if (ew->autoFillBackground()) {
| 0 | ||||||||||||||||||||||||||||||
| 2765 | ew->setAutoFillBackground(false); | - | ||||||||||||||||||||||||||||||
| 2766 | styleSheetCaches->autoFillDisabledWidgets.insert(w); | - | ||||||||||||||||||||||||||||||
| 2767 | if (ew != w) { //eg. viewport of a scrollarea
| 0 | ||||||||||||||||||||||||||||||
| 2768 | //(in order to draw the background anyway in case we don't.) | - | ||||||||||||||||||||||||||||||
| 2769 | ew->setAttribute(Qt::WA_StyledBackground, true); | - | ||||||||||||||||||||||||||||||
| 2770 | } never executed: end of block | 0 | ||||||||||||||||||||||||||||||
| 2771 | } never executed: end of block | 0 | ||||||||||||||||||||||||||||||
| 2772 | if (!rule.hasBackground() || rule.background()->isTransparent() || rule.hasBox()
| 0 | ||||||||||||||||||||||||||||||
| 2773 | || (!rule.hasNativeBorder() && !rule.border()->isOpaque()))
| 0 | ||||||||||||||||||||||||||||||
| 2774 | w->setAttribute(Qt::WA_OpaquePaintEvent, false); never executed: w->setAttribute(Qt::WA_OpaquePaintEvent, false); | 0 | ||||||||||||||||||||||||||||||
| 2775 | } never executed: end of block | 0 | ||||||||||||||||||||||||||||||
| 2776 | } never executed: end of block | 0 | ||||||||||||||||||||||||||||||
| 2777 | - | |||||||||||||||||||||||||||||||
| 2778 | void QStyleSheetStyle::polish(QApplication *app) | - | ||||||||||||||||||||||||||||||
| 2779 | { | - | ||||||||||||||||||||||||||||||
| 2780 | baseStyle()->polish(app); | - | ||||||||||||||||||||||||||||||
| 2781 | } never executed: end of block | 0 | ||||||||||||||||||||||||||||||
| 2782 | - | |||||||||||||||||||||||||||||||
| 2783 | void QStyleSheetStyle::polish(QPalette &pal) | - | ||||||||||||||||||||||||||||||
| 2784 | { | - | ||||||||||||||||||||||||||||||
| 2785 | baseStyle()->polish(pal); | - | ||||||||||||||||||||||||||||||
| 2786 | } never executed: end of block | 0 | ||||||||||||||||||||||||||||||
| 2787 | - | |||||||||||||||||||||||||||||||
| 2788 | void QStyleSheetStyle::repolish(QWidget *w) | - | ||||||||||||||||||||||||||||||
| 2789 | { | - | ||||||||||||||||||||||||||||||
| 2790 | QList<const QObject *> children = w->findChildren<const QObject *>(QString()); | - | ||||||||||||||||||||||||||||||
| 2791 | children.append(w); | - | ||||||||||||||||||||||||||||||
| 2792 | styleSheetCaches->styleSheetCache.remove(w); | - | ||||||||||||||||||||||||||||||
| 2793 | updateObjects(children); | - | ||||||||||||||||||||||||||||||
| 2794 | } never executed: end of block | 0 | ||||||||||||||||||||||||||||||
| 2795 | - | |||||||||||||||||||||||||||||||
| 2796 | void QStyleSheetStyle::repolish(QApplication *app) | - | ||||||||||||||||||||||||||||||
| 2797 | { | - | ||||||||||||||||||||||||||||||
| 2798 | Q_UNUSED(app); | - | ||||||||||||||||||||||||||||||
| 2799 | const QList<const QObject*> allObjects = styleSheetCaches->styleRulesCache.keys(); | - | ||||||||||||||||||||||||||||||
| 2800 | styleSheetCaches->styleSheetCache.remove(qApp); | - | ||||||||||||||||||||||||||||||
| 2801 | styleSheetCaches->styleRulesCache.clear(); | - | ||||||||||||||||||||||||||||||
| 2802 | styleSheetCaches->hasStyleRuleCache.clear(); | - | ||||||||||||||||||||||||||||||
| 2803 | styleSheetCaches->renderRulesCache.clear(); | - | ||||||||||||||||||||||||||||||
| 2804 | updateObjects(allObjects); | - | ||||||||||||||||||||||||||||||
| 2805 | } never executed: end of block | 0 | ||||||||||||||||||||||||||||||
| 2806 | - | |||||||||||||||||||||||||||||||
| 2807 | void QStyleSheetStyle::unpolish(QWidget *w) | - | ||||||||||||||||||||||||||||||
| 2808 | { | - | ||||||||||||||||||||||||||||||
| 2809 | if (!w || !w->testAttribute(Qt::WA_StyleSheet)) {
| 0 | ||||||||||||||||||||||||||||||
| 2810 | baseStyle()->unpolish(w); | - | ||||||||||||||||||||||||||||||
| 2811 | return; never executed: return; | 0 | ||||||||||||||||||||||||||||||
| 2812 | } | - | ||||||||||||||||||||||||||||||
| 2813 | - | |||||||||||||||||||||||||||||||
| 2814 | styleSheetCaches->styleRulesCache.remove(w); | - | ||||||||||||||||||||||||||||||
| 2815 | styleSheetCaches->hasStyleRuleCache.remove(w); | - | ||||||||||||||||||||||||||||||
| 2816 | styleSheetCaches->renderRulesCache.remove(w); | - | ||||||||||||||||||||||||||||||
| 2817 | styleSheetCaches->styleSheetCache.remove(w); | - | ||||||||||||||||||||||||||||||
| 2818 | unsetPalette(w); | - | ||||||||||||||||||||||||||||||
| 2819 | w->setProperty("_q_stylesheet_minw", QVariant()); | - | ||||||||||||||||||||||||||||||
| 2820 | w->setProperty("_q_stylesheet_minh", QVariant()); | - | ||||||||||||||||||||||||||||||
| 2821 | w->setProperty("_q_stylesheet_maxw", QVariant()); | - | ||||||||||||||||||||||||||||||
| 2822 | w->setProperty("_q_stylesheet_maxh", QVariant()); | - | ||||||||||||||||||||||||||||||
| 2823 | w->setAttribute(Qt::WA_StyleSheet, false); | - | ||||||||||||||||||||||||||||||
| 2824 | QObject::disconnect(w, 0, this, 0); | - | ||||||||||||||||||||||||||||||
| 2825 | #ifndef QT_NO_SCROLLAREA | - | ||||||||||||||||||||||||||||||
| 2826 | if (QAbstractScrollArea *sa = qobject_cast<QAbstractScrollArea *>(w)) {
| 0 | ||||||||||||||||||||||||||||||
| 2827 | QObject::disconnect(sa->horizontalScrollBar(), SIGNAL(valueChanged(int)), | - | ||||||||||||||||||||||||||||||
| 2828 | sa, SLOT(update())); | - | ||||||||||||||||||||||||||||||
| 2829 | QObject::disconnect(sa->verticalScrollBar(), SIGNAL(valueChanged(int)), | - | ||||||||||||||||||||||||||||||
| 2830 | sa, SLOT(update())); | - | ||||||||||||||||||||||||||||||
| 2831 | } never executed: end of block | 0 | ||||||||||||||||||||||||||||||
| 2832 | #endif | - | ||||||||||||||||||||||||||||||
| 2833 | baseStyle()->unpolish(w); | - | ||||||||||||||||||||||||||||||
| 2834 | } never executed: end of block | 0 | ||||||||||||||||||||||||||||||
| 2835 | - | |||||||||||||||||||||||||||||||
| 2836 | void QStyleSheetStyle::unpolish(QApplication *app) | - | ||||||||||||||||||||||||||||||
| 2837 | { | - | ||||||||||||||||||||||||||||||
| 2838 | baseStyle()->unpolish(app); | - | ||||||||||||||||||||||||||||||
| 2839 | RECURSION_GUARD(return) never executed: return;
| 0 | ||||||||||||||||||||||||||||||
| 2840 | styleSheetCaches->styleRulesCache.clear(); | - | ||||||||||||||||||||||||||||||
| 2841 | styleSheetCaches->hasStyleRuleCache.clear(); | - | ||||||||||||||||||||||||||||||
| 2842 | styleSheetCaches->renderRulesCache.clear(); | - | ||||||||||||||||||||||||||||||
| 2843 | styleSheetCaches->styleSheetCache.remove(qApp); | - | ||||||||||||||||||||||||||||||
| 2844 | } never executed: end of block | 0 | ||||||||||||||||||||||||||||||
| 2845 | - | |||||||||||||||||||||||||||||||
| 2846 | #ifndef QT_NO_TABBAR | - | ||||||||||||||||||||||||||||||
| 2847 | inline static bool verticalTabs(QTabBar::Shape shape) | - | ||||||||||||||||||||||||||||||
| 2848 | { | - | ||||||||||||||||||||||||||||||
| 2849 | return shape == QTabBar::RoundedWest never executed: return shape == QTabBar::RoundedWest || shape == QTabBar::RoundedEast || shape == QTabBar::TriangularWest || shape == QTabBar::TriangularEast;
| 0 | ||||||||||||||||||||||||||||||
| 2850 | || shape == QTabBar::RoundedEast never executed: return shape == QTabBar::RoundedWest || shape == QTabBar::RoundedEast || shape == QTabBar::TriangularWest || shape == QTabBar::TriangularEast;
| 0 | ||||||||||||||||||||||||||||||
| 2851 | || shape == QTabBar::TriangularWest never executed: return shape == QTabBar::RoundedWest || shape == QTabBar::RoundedEast || shape == QTabBar::TriangularWest || shape == QTabBar::TriangularEast;
| 0 | ||||||||||||||||||||||||||||||
| 2852 | || shape == QTabBar::TriangularEast; never executed: return shape == QTabBar::RoundedWest || shape == QTabBar::RoundedEast || shape == QTabBar::TriangularWest || shape == QTabBar::TriangularEast;
| 0 | ||||||||||||||||||||||||||||||
| 2853 | } | - | ||||||||||||||||||||||||||||||
| 2854 | #endif // QT_NO_TABBAR | - | ||||||||||||||||||||||||||||||
| 2855 | - | |||||||||||||||||||||||||||||||
| 2856 | void QStyleSheetStyle::drawComplexControl(ComplexControl cc, const QStyleOptionComplex *opt, QPainter *p, | - | ||||||||||||||||||||||||||||||
| 2857 | const QWidget *w) const | - | ||||||||||||||||||||||||||||||
| 2858 | { | - | ||||||||||||||||||||||||||||||
| 2859 | RECURSION_GUARD(baseStyle()->drawComplexControl(cc, opt, p, w); return) never executed: return;
| 0 | ||||||||||||||||||||||||||||||
| 2860 | - | |||||||||||||||||||||||||||||||
| 2861 | QRenderRule rule = renderRule(w, opt); | - | ||||||||||||||||||||||||||||||
| 2862 | - | |||||||||||||||||||||||||||||||
| 2863 | switch (cc) { | - | ||||||||||||||||||||||||||||||
| 2864 | case CC_ComboBox: never executed: case CC_ComboBox: | 0 | ||||||||||||||||||||||||||||||
| 2865 | if (const QStyleOptionComboBox *cmb = qstyleoption_cast<const QStyleOptionComboBox *>(opt)) {
| 0 | ||||||||||||||||||||||||||||||
| 2866 | QStyleOptionComboBox cmbOpt(*cmb); | - | ||||||||||||||||||||||||||||||
| 2867 | cmbOpt.rect = rule.borderRect(opt->rect); | - | ||||||||||||||||||||||||||||||
| 2868 | if (rule.hasNativeBorder()) {
| 0 | ||||||||||||||||||||||||||||||
| 2869 | rule.drawBackgroundImage(p, cmbOpt.rect); | - | ||||||||||||||||||||||||||||||
| 2870 | rule.configurePalette(&cmbOpt.palette, QPalette::ButtonText, QPalette::Button); | - | ||||||||||||||||||||||||||||||
| 2871 | bool customDropDown = (opt->subControls & QStyle::SC_ComboBoxArrow)
| 0 | ||||||||||||||||||||||||||||||
| 2872 | && (hasStyleRule(w, PseudoElement_ComboBoxDropDown) || hasStyleRule(w, PseudoElement_ComboBoxArrow));
| 0 | ||||||||||||||||||||||||||||||
| 2873 | if (customDropDown)
| 0 | ||||||||||||||||||||||||||||||
| 2874 | cmbOpt.subControls &= ~QStyle::SC_ComboBoxArrow; never executed: cmbOpt.subControls &= ~QStyle::SC_ComboBoxArrow; | 0 | ||||||||||||||||||||||||||||||
| 2875 | if (rule.baseStyleCanDraw()) {
| 0 | ||||||||||||||||||||||||||||||
| 2876 | baseStyle()->drawComplexControl(cc, &cmbOpt, p, w); | - | ||||||||||||||||||||||||||||||
| 2877 | } else { never executed: end of block | 0 | ||||||||||||||||||||||||||||||
| 2878 | QWindowsStyle::drawComplexControl(cc, &cmbOpt, p, w); | - | ||||||||||||||||||||||||||||||
| 2879 | } never executed: end of block | 0 | ||||||||||||||||||||||||||||||
| 2880 | if (!customDropDown)
| 0 | ||||||||||||||||||||||||||||||
| 2881 | return; never executed: return; | 0 | ||||||||||||||||||||||||||||||
| 2882 | } else { never executed: end of block | 0 | ||||||||||||||||||||||||||||||
| 2883 | rule.drawRule(p, opt->rect); | - | ||||||||||||||||||||||||||||||
| 2884 | } never executed: end of block | 0 | ||||||||||||||||||||||||||||||
| 2885 | - | |||||||||||||||||||||||||||||||
| 2886 | if (opt->subControls & QStyle::SC_ComboBoxArrow) {
| 0 | ||||||||||||||||||||||||||||||
| 2887 | QRenderRule subRule = renderRule(w, opt, PseudoElement_ComboBoxDropDown); | - | ||||||||||||||||||||||||||||||
| 2888 | if (subRule.hasDrawable()) {
| 0 | ||||||||||||||||||||||||||||||
| 2889 | QRect r = subControlRect(CC_ComboBox, opt, SC_ComboBoxArrow, w); | - | ||||||||||||||||||||||||||||||
| 2890 | subRule.drawRule(p, r); | - | ||||||||||||||||||||||||||||||
| 2891 | QRenderRule subRule2 = renderRule(w, opt, PseudoElement_ComboBoxArrow); | - | ||||||||||||||||||||||||||||||
| 2892 | r = positionRect(w, subRule, subRule2, PseudoElement_ComboBoxArrow, r, opt->direction); | - | ||||||||||||||||||||||||||||||
| 2893 | subRule2.drawRule(p, r); | - | ||||||||||||||||||||||||||||||
| 2894 | } else { never executed: end of block | 0 | ||||||||||||||||||||||||||||||
| 2895 | cmbOpt.subControls = QStyle::SC_ComboBoxArrow; | - | ||||||||||||||||||||||||||||||
| 2896 | QWindowsStyle::drawComplexControl(cc, &cmbOpt, p, w); | - | ||||||||||||||||||||||||||||||
| 2897 | } never executed: end of block | 0 | ||||||||||||||||||||||||||||||
| 2898 | } | - | ||||||||||||||||||||||||||||||
| 2899 | - | |||||||||||||||||||||||||||||||
| 2900 | return; never executed: return; | 0 | ||||||||||||||||||||||||||||||
| 2901 | } | - | ||||||||||||||||||||||||||||||
| 2902 | break; never executed: break; | 0 | ||||||||||||||||||||||||||||||
| 2903 | - | |||||||||||||||||||||||||||||||
| 2904 | #ifndef QT_NO_SPINBOX | - | ||||||||||||||||||||||||||||||
| 2905 | case CC_SpinBox: never executed: case CC_SpinBox: | 0 | ||||||||||||||||||||||||||||||
| 2906 | if (const QStyleOptionSpinBox *spin = qstyleoption_cast<const QStyleOptionSpinBox *>(opt)) {
| 0 | ||||||||||||||||||||||||||||||
| 2907 | QStyleOptionSpinBox spinOpt(*spin); | - | ||||||||||||||||||||||||||||||
| 2908 | rule.configurePalette(&spinOpt.palette, QPalette::ButtonText, QPalette::Button); | - | ||||||||||||||||||||||||||||||
| 2909 | rule.configurePalette(&spinOpt.palette, QPalette::Text, QPalette::Base); | - | ||||||||||||||||||||||||||||||
| 2910 | spinOpt.rect = rule.borderRect(opt->rect); | - | ||||||||||||||||||||||||||||||
| 2911 | bool customUp = true, customDown = true; | - | ||||||||||||||||||||||||||||||
| 2912 | QRenderRule upRule = renderRule(w, opt, PseudoElement_SpinBoxUpButton); | - | ||||||||||||||||||||||||||||||
| 2913 | QRenderRule downRule = renderRule(w, opt, PseudoElement_SpinBoxDownButton); | - | ||||||||||||||||||||||||||||||
| 2914 | bool upRuleMatch = upRule.hasGeometry() || upRule.hasPosition();
| 0 | ||||||||||||||||||||||||||||||
| 2915 | bool downRuleMatch = downRule.hasGeometry() || downRule.hasPosition();
| 0 | ||||||||||||||||||||||||||||||
| 2916 | if (rule.hasNativeBorder() && !upRuleMatch && !downRuleMatch) {
| 0 | ||||||||||||||||||||||||||||||
| 2917 | rule.drawBackgroundImage(p, spinOpt.rect); | - | ||||||||||||||||||||||||||||||
| 2918 | customUp = (opt->subControls & QStyle::SC_SpinBoxUp)
| 0 | ||||||||||||||||||||||||||||||
| 2919 | && (hasStyleRule(w, PseudoElement_SpinBoxUpButton) || hasStyleRule(w, PseudoElement_UpArrow));
| 0 | ||||||||||||||||||||||||||||||
| 2920 | if (customUp)
| 0 | ||||||||||||||||||||||||||||||
| 2921 | spinOpt.subControls &= ~QStyle::SC_SpinBoxUp; never executed: spinOpt.subControls &= ~QStyle::SC_SpinBoxUp; | 0 | ||||||||||||||||||||||||||||||
| 2922 | customDown = (opt->subControls & QStyle::SC_SpinBoxDown)
| 0 | ||||||||||||||||||||||||||||||
| 2923 | && (hasStyleRule(w, PseudoElement_SpinBoxDownButton) || hasStyleRule(w, PseudoElement_DownArrow));
| 0 | ||||||||||||||||||||||||||||||
| 2924 | if (customDown)
| 0 | ||||||||||||||||||||||||||||||
| 2925 | spinOpt.subControls &= ~QStyle::SC_SpinBoxDown; never executed: spinOpt.subControls &= ~QStyle::SC_SpinBoxDown; | 0 | ||||||||||||||||||||||||||||||
| 2926 | if (rule.baseStyleCanDraw()) {
| 0 | ||||||||||||||||||||||||||||||
| 2927 | baseStyle()->drawComplexControl(cc, &spinOpt, p, w); | - | ||||||||||||||||||||||||||||||
| 2928 | } else { never executed: end of block | 0 | ||||||||||||||||||||||||||||||
| 2929 | QWindowsStyle::drawComplexControl(cc, &spinOpt, p, w); | - | ||||||||||||||||||||||||||||||
| 2930 | } never executed: end of block | 0 | ||||||||||||||||||||||||||||||
| 2931 | if (!customUp && !customDown)
| 0 | ||||||||||||||||||||||||||||||
| 2932 | return; never executed: return; | 0 | ||||||||||||||||||||||||||||||
| 2933 | } else { never executed: end of block | 0 | ||||||||||||||||||||||||||||||
| 2934 | rule.drawRule(p, opt->rect); | - | ||||||||||||||||||||||||||||||
| 2935 | } never executed: end of block | 0 | ||||||||||||||||||||||||||||||
| 2936 | - | |||||||||||||||||||||||||||||||
| 2937 | if ((opt->subControls & QStyle::SC_SpinBoxUp) && customUp) {
| 0 | ||||||||||||||||||||||||||||||
| 2938 | QRenderRule subRule = renderRule(w, opt, PseudoElement_SpinBoxUpButton); | - | ||||||||||||||||||||||||||||||
| 2939 | if (subRule.hasDrawable()) {
| 0 | ||||||||||||||||||||||||||||||
| 2940 | QRect r = subControlRect(CC_SpinBox, opt, SC_SpinBoxUp, w); | - | ||||||||||||||||||||||||||||||
| 2941 | subRule.drawRule(p, r); | - | ||||||||||||||||||||||||||||||
| 2942 | QRenderRule subRule2 = renderRule(w, opt, PseudoElement_SpinBoxUpArrow); | - | ||||||||||||||||||||||||||||||
| 2943 | r = positionRect(w, subRule, subRule2, PseudoElement_SpinBoxUpArrow, r, opt->direction); | - | ||||||||||||||||||||||||||||||
| 2944 | subRule2.drawRule(p, r); | - | ||||||||||||||||||||||||||||||
| 2945 | } else { never executed: end of block | 0 | ||||||||||||||||||||||||||||||
| 2946 | spinOpt.subControls = QStyle::SC_SpinBoxUp; | - | ||||||||||||||||||||||||||||||
| 2947 | QWindowsStyle::drawComplexControl(cc, &spinOpt, p, w); | - | ||||||||||||||||||||||||||||||
| 2948 | } never executed: end of block | 0 | ||||||||||||||||||||||||||||||
| 2949 | } | - | ||||||||||||||||||||||||||||||
| 2950 | - | |||||||||||||||||||||||||||||||
| 2951 | if ((opt->subControls & QStyle::SC_SpinBoxDown) && customDown) {
| 0 | ||||||||||||||||||||||||||||||
| 2952 | QRenderRule subRule = renderRule(w, opt, PseudoElement_SpinBoxDownButton); | - | ||||||||||||||||||||||||||||||
| 2953 | if (subRule.hasDrawable()) {
| 0 | ||||||||||||||||||||||||||||||
| 2954 | QRect r = subControlRect(CC_SpinBox, opt, SC_SpinBoxDown, w); | - | ||||||||||||||||||||||||||||||
| 2955 | subRule.drawRule(p, r); | - | ||||||||||||||||||||||||||||||
| 2956 | QRenderRule subRule2 = renderRule(w, opt, PseudoElement_SpinBoxDownArrow); | - | ||||||||||||||||||||||||||||||
| 2957 | r = positionRect(w, subRule, subRule2, PseudoElement_SpinBoxDownArrow, r, opt->direction); | - | ||||||||||||||||||||||||||||||
| 2958 | subRule2.drawRule(p, r); | - | ||||||||||||||||||||||||||||||
| 2959 | } else { never executed: end of block | 0 | ||||||||||||||||||||||||||||||
| 2960 | spinOpt.subControls = QStyle::SC_SpinBoxDown; | - | ||||||||||||||||||||||||||||||
| 2961 | QWindowsStyle::drawComplexControl(cc, &spinOpt, p, w); | - | ||||||||||||||||||||||||||||||
| 2962 | } never executed: end of block | 0 | ||||||||||||||||||||||||||||||
| 2963 | } | - | ||||||||||||||||||||||||||||||
| 2964 | return; never executed: return; | 0 | ||||||||||||||||||||||||||||||
| 2965 | } | - | ||||||||||||||||||||||||||||||
| 2966 | break; never executed: break; | 0 | ||||||||||||||||||||||||||||||
| 2967 | #endif // QT_NO_SPINBOX | - | ||||||||||||||||||||||||||||||
| 2968 | - | |||||||||||||||||||||||||||||||
| 2969 | case CC_GroupBox: never executed: case CC_GroupBox: | 0 | ||||||||||||||||||||||||||||||
| 2970 | if (const QStyleOptionGroupBox *gb = qstyleoption_cast<const QStyleOptionGroupBox *>(opt)) {
| 0 | ||||||||||||||||||||||||||||||
| 2971 | - | |||||||||||||||||||||||||||||||
| 2972 | QRect labelRect, checkBoxRect, titleRect, frameRect; | - | ||||||||||||||||||||||||||||||
| 2973 | bool hasTitle = (gb->subControls & QStyle::SC_GroupBoxCheckBox) || !gb->text.isEmpty();
| 0 | ||||||||||||||||||||||||||||||
| 2974 | - | |||||||||||||||||||||||||||||||
| 2975 | if (!rule.hasDrawable() && (!hasTitle || !hasStyleRule(w, PseudoElement_GroupBoxTitle))
| 0 | ||||||||||||||||||||||||||||||
| 2976 | && !hasStyleRule(w, PseudoElement_Indicator) && !rule.hasBox() && !rule.hasFont && !rule.hasPalette()) {
| 0 | ||||||||||||||||||||||||||||||
| 2977 | // let the native style draw the combobox if there is no style for it. | - | ||||||||||||||||||||||||||||||
| 2978 | break; never executed: break; | 0 | ||||||||||||||||||||||||||||||
| 2979 | } | - | ||||||||||||||||||||||||||||||
| 2980 | rule.drawBackground(p, opt->rect); | - | ||||||||||||||||||||||||||||||
| 2981 | - | |||||||||||||||||||||||||||||||
| 2982 | QRenderRule titleRule = renderRule(w, opt, PseudoElement_GroupBoxTitle); | - | ||||||||||||||||||||||||||||||
| 2983 | bool clipSet = false; | - | ||||||||||||||||||||||||||||||
| 2984 | - | |||||||||||||||||||||||||||||||
| 2985 | if (hasTitle) {
| 0 | ||||||||||||||||||||||||||||||
| 2986 | labelRect = subControlRect(CC_GroupBox, opt, SC_GroupBoxLabel, w); | - | ||||||||||||||||||||||||||||||
| 2987 | //Some native style (such as mac) may return a too small rectangle (because they use smaller fonts), so we may need to expand it a little bit. | - | ||||||||||||||||||||||||||||||
| 2988 | labelRect.setSize(labelRect.size().expandedTo(ParentStyle::subControlRect(CC_GroupBox, opt, SC_GroupBoxLabel, w).size())); | - | ||||||||||||||||||||||||||||||
| 2989 | if (gb->subControls & QStyle::SC_GroupBoxCheckBox) {
| 0 | ||||||||||||||||||||||||||||||
| 2990 | checkBoxRect = subControlRect(CC_GroupBox, opt, SC_GroupBoxCheckBox, w); | - | ||||||||||||||||||||||||||||||
| 2991 | titleRect = titleRule.boxRect(checkBoxRect.united(labelRect)); | - | ||||||||||||||||||||||||||||||
| 2992 | } else { never executed: end of block | 0 | ||||||||||||||||||||||||||||||
| 2993 | titleRect = titleRule.boxRect(labelRect); | - | ||||||||||||||||||||||||||||||
| 2994 | } never executed: end of block | 0 | ||||||||||||||||||||||||||||||
| 2995 | if (!titleRule.hasBackground() || !titleRule.background()->isTransparent()) {
| 0 | ||||||||||||||||||||||||||||||
| 2996 | clipSet = true; | - | ||||||||||||||||||||||||||||||
| 2997 | p->save(); | - | ||||||||||||||||||||||||||||||
| 2998 | p->setClipRegion(QRegion(opt->rect) - titleRect); | - | ||||||||||||||||||||||||||||||
| 2999 | } never executed: end of block | 0 | ||||||||||||||||||||||||||||||
| 3000 | } never executed: end of block | 0 | ||||||||||||||||||||||||||||||
| 3001 | - | |||||||||||||||||||||||||||||||
| 3002 | frameRect = subControlRect(CC_GroupBox, opt, SC_GroupBoxFrame, w); | - | ||||||||||||||||||||||||||||||
| 3003 | QStyleOptionFrame frame; | - | ||||||||||||||||||||||||||||||
| 3004 | frame.QStyleOption::operator=(*gb); | - | ||||||||||||||||||||||||||||||
| 3005 | frame.features = gb->features; | - | ||||||||||||||||||||||||||||||
| 3006 | frame.lineWidth = gb->lineWidth; | - | ||||||||||||||||||||||||||||||
| 3007 | frame.midLineWidth = gb->midLineWidth; | - | ||||||||||||||||||||||||||||||
| 3008 | frame.rect = frameRect; | - | ||||||||||||||||||||||||||||||
| 3009 | drawPrimitive(PE_FrameGroupBox, &frame, p, w); | - | ||||||||||||||||||||||||||||||
| 3010 | - | |||||||||||||||||||||||||||||||
| 3011 | if (clipSet)
| 0 | ||||||||||||||||||||||||||||||
| 3012 | p->restore(); never executed: p->restore(); | 0 | ||||||||||||||||||||||||||||||
| 3013 | - | |||||||||||||||||||||||||||||||
| 3014 | // draw background and frame of the title | - | ||||||||||||||||||||||||||||||
| 3015 | if (hasTitle)
| 0 | ||||||||||||||||||||||||||||||
| 3016 | titleRule.drawRule(p, titleRect); never executed: titleRule.drawRule(p, titleRect); | 0 | ||||||||||||||||||||||||||||||
| 3017 | - | |||||||||||||||||||||||||||||||
| 3018 | // draw the indicator | - | ||||||||||||||||||||||||||||||
| 3019 | if (gb->subControls & QStyle::SC_GroupBoxCheckBox) {
| 0 | ||||||||||||||||||||||||||||||
| 3020 | QStyleOptionButton box; | - | ||||||||||||||||||||||||||||||
| 3021 | box.QStyleOption::operator=(*gb); | - | ||||||||||||||||||||||||||||||
| 3022 | box.rect = checkBoxRect; | - | ||||||||||||||||||||||||||||||
| 3023 | drawPrimitive(PE_IndicatorCheckBox, &box, p, w); | - | ||||||||||||||||||||||||||||||
| 3024 | } never executed: end of block | 0 | ||||||||||||||||||||||||||||||
| 3025 | - | |||||||||||||||||||||||||||||||
| 3026 | // draw the text | - | ||||||||||||||||||||||||||||||
| 3027 | if (!gb->text.isEmpty()) {
| 0 | ||||||||||||||||||||||||||||||
| 3028 | int alignment = int(Qt::AlignCenter | Qt::TextShowMnemonic); | - | ||||||||||||||||||||||||||||||
| 3029 | if (!styleHint(QStyle::SH_UnderlineShortcut, opt, w)) {
| 0 | ||||||||||||||||||||||||||||||
| 3030 | alignment |= Qt::TextHideMnemonic; | - | ||||||||||||||||||||||||||||||
| 3031 | } never executed: end of block | 0 | ||||||||||||||||||||||||||||||
| 3032 | - | |||||||||||||||||||||||||||||||
| 3033 | QPalette pal = gb->palette; | - | ||||||||||||||||||||||||||||||
| 3034 | if (gb->textColor.isValid())
| 0 | ||||||||||||||||||||||||||||||
| 3035 | pal.setColor(QPalette::WindowText, gb->textColor); never executed: pal.setColor(QPalette::WindowText, gb->textColor); | 0 | ||||||||||||||||||||||||||||||
| 3036 | titleRule.configurePalette(&pal, QPalette::WindowText, QPalette::Window); | - | ||||||||||||||||||||||||||||||
| 3037 | drawItemText(p, labelRect, alignment, pal, gb->state & State_Enabled, | - | ||||||||||||||||||||||||||||||
| 3038 | gb->text, QPalette::WindowText); | - | ||||||||||||||||||||||||||||||
| 3039 | - | |||||||||||||||||||||||||||||||
| 3040 | if (gb->state & State_HasFocus) {
| 0 | ||||||||||||||||||||||||||||||
| 3041 | QStyleOptionFocusRect fropt; | - | ||||||||||||||||||||||||||||||
| 3042 | fropt.QStyleOption::operator=(*gb); | - | ||||||||||||||||||||||||||||||
| 3043 | fropt.rect = labelRect; | - | ||||||||||||||||||||||||||||||
| 3044 | drawPrimitive(PE_FrameFocusRect, &fropt, p, w); | - | ||||||||||||||||||||||||||||||
| 3045 | } never executed: end of block | 0 | ||||||||||||||||||||||||||||||
| 3046 | } never executed: end of block | 0 | ||||||||||||||||||||||||||||||
| 3047 | - | |||||||||||||||||||||||||||||||
| 3048 | return; never executed: return; | 0 | ||||||||||||||||||||||||||||||
| 3049 | } | - | ||||||||||||||||||||||||||||||
| 3050 | break; never executed: break; | 0 | ||||||||||||||||||||||||||||||
| 3051 | - | |||||||||||||||||||||||||||||||
| 3052 | case CC_ToolButton: never executed: case CC_ToolButton: | 0 | ||||||||||||||||||||||||||||||
| 3053 | if (const QStyleOptionToolButton *tool = qstyleoption_cast<const QStyleOptionToolButton *>(opt)) {
| 0 | ||||||||||||||||||||||||||||||
| 3054 | QStyleOptionToolButton toolOpt(*tool); | - | ||||||||||||||||||||||||||||||
| 3055 | rule.configurePalette(&toolOpt.palette, QPalette::ButtonText, QPalette::Button); | - | ||||||||||||||||||||||||||||||
| 3056 | toolOpt.font = rule.font.resolve(toolOpt.font); | - | ||||||||||||||||||||||||||||||
| 3057 | toolOpt.rect = rule.borderRect(opt->rect); | - | ||||||||||||||||||||||||||||||
| 3058 | bool customArrow = (tool->features & (QStyleOptionToolButton::HasMenu | QStyleOptionToolButton::MenuButtonPopup)); | - | ||||||||||||||||||||||||||||||
| 3059 | bool customDropDown = tool->features & QStyleOptionToolButton::MenuButtonPopup; | - | ||||||||||||||||||||||||||||||
| 3060 | if (rule.hasNativeBorder()) {
| 0 | ||||||||||||||||||||||||||||||
| 3061 | if (tool->subControls & SC_ToolButton) {
| 0 | ||||||||||||||||||||||||||||||
| 3062 | //in some case (eg. the button is "auto raised") the style doesn't draw the background | - | ||||||||||||||||||||||||||||||
| 3063 | //so we need to draw the background. | - | ||||||||||||||||||||||||||||||
| 3064 | // use the same condition as in QCommonStyle | - | ||||||||||||||||||||||||||||||
| 3065 | State bflags = tool->state & ~State_Sunken; | - | ||||||||||||||||||||||||||||||
| 3066 | if (bflags & State_AutoRaise && (!(bflags & State_MouseOver) || !(bflags & State_Enabled)))
| 0 | ||||||||||||||||||||||||||||||
| 3067 | bflags &= ~State_Raised; never executed: bflags &= ~State_Raised; | 0 | ||||||||||||||||||||||||||||||
| 3068 | if (tool->state & State_Sunken && tool->activeSubControls & SC_ToolButton)
| 0 | ||||||||||||||||||||||||||||||
| 3069 | bflags |= State_Sunken; never executed: bflags |= State_Sunken; | 0 | ||||||||||||||||||||||||||||||
| 3070 | if (!(bflags & (State_Sunken | State_On | State_Raised)))
| 0 | ||||||||||||||||||||||||||||||
| 3071 | rule.drawBackground(p, toolOpt.rect); never executed: rule.drawBackground(p, toolOpt.rect); | 0 | ||||||||||||||||||||||||||||||
| 3072 | } never executed: end of block | 0 | ||||||||||||||||||||||||||||||
| 3073 | customArrow = customArrow && hasStyleRule(w, PseudoElement_ToolButtonDownArrow);
| 0 | ||||||||||||||||||||||||||||||
| 3074 | if (customArrow)
| 0 | ||||||||||||||||||||||||||||||
| 3075 | toolOpt.features &= ~QStyleOptionToolButton::HasMenu; never executed: toolOpt.features &= ~QStyleOptionToolButton::HasMenu; | 0 | ||||||||||||||||||||||||||||||
| 3076 | customDropDown = customDropDown && hasStyleRule(w, PseudoElement_ToolButtonMenu);
| 0 | ||||||||||||||||||||||||||||||
| 3077 | if (customDropDown)
| 0 | ||||||||||||||||||||||||||||||
| 3078 | toolOpt.subControls &= ~QStyle::SC_ToolButtonMenu; never executed: toolOpt.subControls &= ~QStyle::SC_ToolButtonMenu; | 0 | ||||||||||||||||||||||||||||||
| 3079 | - | |||||||||||||||||||||||||||||||
| 3080 | if (rule.baseStyleCanDraw() && !(tool->features & QStyleOptionToolButton::Arrow)) {
| 0 | ||||||||||||||||||||||||||||||
| 3081 | baseStyle()->drawComplexControl(cc, &toolOpt, p, w); | - | ||||||||||||||||||||||||||||||
| 3082 | } else { never executed: end of block | 0 | ||||||||||||||||||||||||||||||
| 3083 | QWindowsStyle::drawComplexControl(cc, &toolOpt, p, w); | - | ||||||||||||||||||||||||||||||
| 3084 | } never executed: end of block | 0 | ||||||||||||||||||||||||||||||
| 3085 | - | |||||||||||||||||||||||||||||||
| 3086 | if (!customArrow && !customDropDown)
| 0 | ||||||||||||||||||||||||||||||
| 3087 | return; never executed: return; | 0 | ||||||||||||||||||||||||||||||
| 3088 | } else { never executed: end of block | 0 | ||||||||||||||||||||||||||||||
| 3089 | rule.drawRule(p, opt->rect); | - | ||||||||||||||||||||||||||||||
| 3090 | toolOpt.rect = rule.contentsRect(opt->rect); | - | ||||||||||||||||||||||||||||||
| 3091 | if (rule.hasFont)
| 0 | ||||||||||||||||||||||||||||||
| 3092 | toolOpt.font = rule.font; never executed: toolOpt.font = rule.font; | 0 | ||||||||||||||||||||||||||||||
| 3093 | drawControl(CE_ToolButtonLabel, &toolOpt, p, w); | - | ||||||||||||||||||||||||||||||
| 3094 | } never executed: end of block | 0 | ||||||||||||||||||||||||||||||
| 3095 | - | |||||||||||||||||||||||||||||||
| 3096 | QRenderRule subRule = renderRule(w, opt, PseudoElement_ToolButtonMenu); | - | ||||||||||||||||||||||||||||||
| 3097 | QRect r = subControlRect(CC_ToolButton, opt, QStyle::SC_ToolButtonMenu, w); | - | ||||||||||||||||||||||||||||||
| 3098 | if (customDropDown) {
| 0 | ||||||||||||||||||||||||||||||
| 3099 | if (opt->subControls & QStyle::SC_ToolButtonMenu) {
| 0 | ||||||||||||||||||||||||||||||
| 3100 | if (subRule.hasDrawable()) {
| 0 | ||||||||||||||||||||||||||||||
| 3101 | subRule.drawRule(p, r); | - | ||||||||||||||||||||||||||||||
| 3102 | } else { never executed: end of block | 0 | ||||||||||||||||||||||||||||||
| 3103 | toolOpt.rect = r; | - | ||||||||||||||||||||||||||||||
| 3104 | baseStyle()->drawPrimitive(PE_IndicatorButtonDropDown, &toolOpt, p, w); | - | ||||||||||||||||||||||||||||||
| 3105 | } never executed: end of block | 0 | ||||||||||||||||||||||||||||||
| 3106 | } | - | ||||||||||||||||||||||||||||||
| 3107 | } never executed: end of block | 0 | ||||||||||||||||||||||||||||||
| 3108 | - | |||||||||||||||||||||||||||||||
| 3109 | if (customArrow) {
| 0 | ||||||||||||||||||||||||||||||
| 3110 | QRenderRule subRule2 = customDropDown ? renderRule(w, opt, PseudoElement_ToolButtonMenuArrow)
| 0 | ||||||||||||||||||||||||||||||
| 3111 | : renderRule(w, opt, PseudoElement_ToolButtonDownArrow); | - | ||||||||||||||||||||||||||||||
| 3112 | QRect r2 = customDropDown
| 0 | ||||||||||||||||||||||||||||||
| 3113 | ? positionRect(w, subRule, subRule2, PseudoElement_ToolButtonMenuArrow, r, opt->direction) | - | ||||||||||||||||||||||||||||||
| 3114 | : positionRect(w, rule, subRule2, PseudoElement_ToolButtonDownArrow, opt->rect, opt->direction); | - | ||||||||||||||||||||||||||||||
| 3115 | if (subRule2.hasDrawable()) {
| 0 | ||||||||||||||||||||||||||||||
| 3116 | subRule2.drawRule(p, r2); | - | ||||||||||||||||||||||||||||||
| 3117 | } else { never executed: end of block | 0 | ||||||||||||||||||||||||||||||
| 3118 | toolOpt.rect = r2; | - | ||||||||||||||||||||||||||||||
| 3119 | baseStyle()->drawPrimitive(QStyle::PE_IndicatorArrowDown, &toolOpt, p, w); | - | ||||||||||||||||||||||||||||||
| 3120 | } never executed: end of block | 0 | ||||||||||||||||||||||||||||||
| 3121 | } | - | ||||||||||||||||||||||||||||||
| 3122 | - | |||||||||||||||||||||||||||||||
| 3123 | return; never executed: return; | 0 | ||||||||||||||||||||||||||||||
| 3124 | } | - | ||||||||||||||||||||||||||||||
| 3125 | break; never executed: break; | 0 | ||||||||||||||||||||||||||||||
| 3126 | - | |||||||||||||||||||||||||||||||
| 3127 | #ifndef QT_NO_SCROLLBAR | - | ||||||||||||||||||||||||||||||
| 3128 | case CC_ScrollBar: never executed: case CC_ScrollBar: | 0 | ||||||||||||||||||||||||||||||
| 3129 | if (const QStyleOptionSlider *sb = qstyleoption_cast<const QStyleOptionSlider *>(opt)) {
| 0 | ||||||||||||||||||||||||||||||
| 3130 | QStyleOptionSlider sbOpt(*sb); | - | ||||||||||||||||||||||||||||||
| 3131 | if (!rule.hasDrawable()) {
| 0 | ||||||||||||||||||||||||||||||
| 3132 | sbOpt.rect = rule.borderRect(opt->rect); | - | ||||||||||||||||||||||||||||||
| 3133 | rule.drawBackgroundImage(p, opt->rect); | - | ||||||||||||||||||||||||||||||
| 3134 | baseStyle()->drawComplexControl(cc, &sbOpt, p, w); | - | ||||||||||||||||||||||||||||||
| 3135 | } else { never executed: end of block | 0 | ||||||||||||||||||||||||||||||
| 3136 | rule.drawRule(p, opt->rect); | - | ||||||||||||||||||||||||||||||
| 3137 | QWindowsStyle::drawComplexControl(cc, opt, p, w); | - | ||||||||||||||||||||||||||||||
| 3138 | } never executed: end of block | 0 | ||||||||||||||||||||||||||||||
| 3139 | return; never executed: return; | 0 | ||||||||||||||||||||||||||||||
| 3140 | } | - | ||||||||||||||||||||||||||||||
| 3141 | break; never executed: break; | 0 | ||||||||||||||||||||||||||||||
| 3142 | #endif // QT_NO_SCROLLBAR | - | ||||||||||||||||||||||||||||||
| 3143 | - | |||||||||||||||||||||||||||||||
| 3144 | #ifndef QT_NO_SLIDER | - | ||||||||||||||||||||||||||||||
| 3145 | case CC_Slider: never executed: case CC_Slider: | 0 | ||||||||||||||||||||||||||||||
| 3146 | if (const QStyleOptionSlider *slider = qstyleoption_cast<const QStyleOptionSlider *>(opt)) {
| 0 | ||||||||||||||||||||||||||||||
| 3147 | rule.drawRule(p, opt->rect); | - | ||||||||||||||||||||||||||||||
| 3148 | - | |||||||||||||||||||||||||||||||
| 3149 | QRenderRule grooveSubRule = renderRule(w, opt, PseudoElement_SliderGroove); | - | ||||||||||||||||||||||||||||||
| 3150 | QRenderRule handleSubRule = renderRule(w, opt, PseudoElement_SliderHandle); | - | ||||||||||||||||||||||||||||||
| 3151 | if (!grooveSubRule.hasDrawable()) {
| 0 | ||||||||||||||||||||||||||||||
| 3152 | QStyleOptionSlider slOpt(*slider); | - | ||||||||||||||||||||||||||||||
| 3153 | bool handleHasRule = handleSubRule.hasDrawable(); | - | ||||||||||||||||||||||||||||||
| 3154 | // If the style specifies a different handler rule, draw the groove without the handler. | - | ||||||||||||||||||||||||||||||
| 3155 | if (handleHasRule)
| 0 | ||||||||||||||||||||||||||||||
| 3156 | slOpt.subControls &= ~SC_SliderHandle; never executed: slOpt.subControls &= ~SC_SliderHandle; | 0 | ||||||||||||||||||||||||||||||
| 3157 | baseStyle()->drawComplexControl(cc, &slOpt, p, w); | - | ||||||||||||||||||||||||||||||
| 3158 | if (!handleHasRule)
| 0 | ||||||||||||||||||||||||||||||
| 3159 | return; never executed: return; | 0 | ||||||||||||||||||||||||||||||
| 3160 | } never executed: end of block | 0 | ||||||||||||||||||||||||||||||
| 3161 | - | |||||||||||||||||||||||||||||||
| 3162 | QRect gr = subControlRect(cc, opt, SC_SliderGroove, w); | - | ||||||||||||||||||||||||||||||
| 3163 | if (slider->subControls & SC_SliderGroove) {
| 0 | ||||||||||||||||||||||||||||||
| 3164 | grooveSubRule.drawRule(p, gr); | - | ||||||||||||||||||||||||||||||
| 3165 | } never executed: end of block | 0 | ||||||||||||||||||||||||||||||
| 3166 | - | |||||||||||||||||||||||||||||||
| 3167 | if (slider->subControls & SC_SliderHandle) {
| 0 | ||||||||||||||||||||||||||||||
| 3168 | QRect hr = subControlRect(cc, opt, SC_SliderHandle, w); | - | ||||||||||||||||||||||||||||||
| 3169 | - | |||||||||||||||||||||||||||||||
| 3170 | QRenderRule subRule1 = renderRule(w, opt, PseudoElement_SliderSubPage); | - | ||||||||||||||||||||||||||||||
| 3171 | if (subRule1.hasDrawable()) {
| 0 | ||||||||||||||||||||||||||||||
| 3172 | QRect r(gr.topLeft(), | - | ||||||||||||||||||||||||||||||
| 3173 | slider->orientation == Qt::Horizontal | - | ||||||||||||||||||||||||||||||
| 3174 | ? QPoint(hr.x()+hr.width()/2, gr.y()+gr.height() - 1) | - | ||||||||||||||||||||||||||||||
| 3175 | : QPoint(gr.x()+gr.width() - 1, hr.y()+hr.height()/2)); | - | ||||||||||||||||||||||||||||||
| 3176 | subRule1.drawRule(p, r); | - | ||||||||||||||||||||||||||||||
| 3177 | } never executed: end of block | 0 | ||||||||||||||||||||||||||||||
| 3178 | - | |||||||||||||||||||||||||||||||
| 3179 | QRenderRule subRule2 = renderRule(w, opt, PseudoElement_SliderAddPage); | - | ||||||||||||||||||||||||||||||
| 3180 | if (subRule2.hasDrawable()) {
| 0 | ||||||||||||||||||||||||||||||
| 3181 | QRect r(slider->orientation == Qt::Horizontal | - | ||||||||||||||||||||||||||||||
| 3182 | ? QPoint(hr.x()+hr.width()/2+1, gr.y()) | - | ||||||||||||||||||||||||||||||
| 3183 | : QPoint(gr.x(), hr.y()+hr.height()/2+1), | - | ||||||||||||||||||||||||||||||
| 3184 | gr.bottomRight()); | - | ||||||||||||||||||||||||||||||
| 3185 | subRule2.drawRule(p, r); | - | ||||||||||||||||||||||||||||||
| 3186 | } never executed: end of block | 0 | ||||||||||||||||||||||||||||||
| 3187 | - | |||||||||||||||||||||||||||||||
| 3188 | handleSubRule.drawRule(p, handleSubRule.boxRect(hr, Margin)); | - | ||||||||||||||||||||||||||||||
| 3189 | } never executed: end of block | 0 | ||||||||||||||||||||||||||||||
| 3190 | - | |||||||||||||||||||||||||||||||
| 3191 | if (slider->subControls & SC_SliderTickmarks) {
| 0 | ||||||||||||||||||||||||||||||
| 3192 | // TODO... | - | ||||||||||||||||||||||||||||||
| 3193 | } never executed: end of block | 0 | ||||||||||||||||||||||||||||||
| 3194 | - | |||||||||||||||||||||||||||||||
| 3195 | return; never executed: return; | 0 | ||||||||||||||||||||||||||||||
| 3196 | } | - | ||||||||||||||||||||||||||||||
| 3197 | break; never executed: break; | 0 | ||||||||||||||||||||||||||||||
| 3198 | #endif // QT_NO_SLIDER | - | ||||||||||||||||||||||||||||||
| 3199 | - | |||||||||||||||||||||||||||||||
| 3200 | case CC_MdiControls: never executed: case CC_MdiControls: | 0 | ||||||||||||||||||||||||||||||
| 3201 | if (hasStyleRule(w, PseudoElement_MdiCloseButton)
| 0 | ||||||||||||||||||||||||||||||
| 3202 | || hasStyleRule(w, PseudoElement_MdiNormalButton)
| 0 | ||||||||||||||||||||||||||||||
| 3203 | || hasStyleRule(w, PseudoElement_MdiMinButton)) {
| 0 | ||||||||||||||||||||||||||||||
| 3204 | QList<QVariant> layout = rule.styleHint(QLatin1String("button-layout")).toList(); | - | ||||||||||||||||||||||||||||||
| 3205 | if (layout.isEmpty())
| 0 | ||||||||||||||||||||||||||||||
| 3206 | layout = subControlLayout(QLatin1String("mNX")); never executed: layout = subControlLayout(QLatin1String("mNX")); | 0 | ||||||||||||||||||||||||||||||
| 3207 | - | |||||||||||||||||||||||||||||||
| 3208 | QStyleOptionComplex optCopy(*opt); | - | ||||||||||||||||||||||||||||||
| 3209 | optCopy.subControls = 0; | - | ||||||||||||||||||||||||||||||
| 3210 | for (int i = 0; i < layout.count(); i++) {
| 0 | ||||||||||||||||||||||||||||||
| 3211 | int layoutButton = layout[i].toInt(); | - | ||||||||||||||||||||||||||||||
| 3212 | if (layoutButton < PseudoElement_MdiCloseButton
| 0 | ||||||||||||||||||||||||||||||
| 3213 | || layoutButton > PseudoElement_MdiNormalButton)
| 0 | ||||||||||||||||||||||||||||||
| 3214 | continue; never executed: continue; | 0 | ||||||||||||||||||||||||||||||
| 3215 | QStyle::SubControl control = knownPseudoElements[layoutButton].subControl; | - | ||||||||||||||||||||||||||||||
| 3216 | if (!(opt->subControls & control))
| 0 | ||||||||||||||||||||||||||||||
| 3217 | continue; never executed: continue; | 0 | ||||||||||||||||||||||||||||||
| 3218 | QRenderRule subRule = renderRule(w, opt, layoutButton); | - | ||||||||||||||||||||||||||||||
| 3219 | if (subRule.hasDrawable()) {
| 0 | ||||||||||||||||||||||||||||||
| 3220 | QRect rect = subRule.boxRect(subControlRect(CC_MdiControls, opt, control, w), Margin); | - | ||||||||||||||||||||||||||||||
| 3221 | subRule.drawRule(p, rect); | - | ||||||||||||||||||||||||||||||
| 3222 | QIcon icon = standardIcon(subControlIcon(layoutButton), opt); | - | ||||||||||||||||||||||||||||||
| 3223 | icon.paint(p, subRule.contentsRect(rect), Qt::AlignCenter); | - | ||||||||||||||||||||||||||||||
| 3224 | } else { never executed: end of block | 0 | ||||||||||||||||||||||||||||||
| 3225 | optCopy.subControls |= control; | - | ||||||||||||||||||||||||||||||
| 3226 | } never executed: end of block | 0 | ||||||||||||||||||||||||||||||
| 3227 | } | - | ||||||||||||||||||||||||||||||
| 3228 | - | |||||||||||||||||||||||||||||||
| 3229 | if (optCopy.subControls)
| 0 | ||||||||||||||||||||||||||||||
| 3230 | baseStyle()->drawComplexControl(CC_MdiControls, &optCopy, p, w); never executed: baseStyle()->drawComplexControl(CC_MdiControls, &optCopy, p, w); | 0 | ||||||||||||||||||||||||||||||
| 3231 | return; never executed: return; | 0 | ||||||||||||||||||||||||||||||
| 3232 | } | - | ||||||||||||||||||||||||||||||
| 3233 | break; never executed: break; | 0 | ||||||||||||||||||||||||||||||
| 3234 | - | |||||||||||||||||||||||||||||||
| 3235 | case CC_TitleBar: never executed: case CC_TitleBar: | 0 | ||||||||||||||||||||||||||||||
| 3236 | if (const QStyleOptionTitleBar *tb = qstyleoption_cast<const QStyleOptionTitleBar *>(opt)) {
| 0 | ||||||||||||||||||||||||||||||
| 3237 | QRenderRule subRule = renderRule(w, opt, PseudoElement_TitleBar); | - | ||||||||||||||||||||||||||||||
| 3238 | if (!subRule.hasDrawable() && !subRule.hasBox() && !subRule.hasBorder())
| 0 | ||||||||||||||||||||||||||||||
| 3239 | break; never executed: break; | 0 | ||||||||||||||||||||||||||||||
| 3240 | subRule.drawRule(p, opt->rect); | - | ||||||||||||||||||||||||||||||
| 3241 | QHash<QStyle::SubControl, QRect> layout = titleBarLayout(w, tb); | - | ||||||||||||||||||||||||||||||
| 3242 | - | |||||||||||||||||||||||||||||||
| 3243 | QRect ir; | - | ||||||||||||||||||||||||||||||
| 3244 | ir = layout[SC_TitleBarLabel]; | - | ||||||||||||||||||||||||||||||
| 3245 | if (ir.isValid()) {
| 0 | ||||||||||||||||||||||||||||||
| 3246 | if (subRule.hasPalette())
| 0 | ||||||||||||||||||||||||||||||
| 3247 | p->setPen(subRule.palette()->foreground.color()); never executed: p->setPen(subRule.palette()->foreground.color()); | 0 | ||||||||||||||||||||||||||||||
| 3248 | p->fillRect(ir, Qt::white); | - | ||||||||||||||||||||||||||||||
| 3249 | p->drawText(ir.x(), ir.y(), ir.width(), ir.height(), Qt::AlignLeft | Qt::AlignVCenter | Qt::TextSingleLine, tb->text); | - | ||||||||||||||||||||||||||||||
| 3250 | } never executed: end of block | 0 | ||||||||||||||||||||||||||||||
| 3251 | - | |||||||||||||||||||||||||||||||
| 3252 | QPixmap pm; | - | ||||||||||||||||||||||||||||||
| 3253 | - | |||||||||||||||||||||||||||||||
| 3254 | ir = layout[SC_TitleBarSysMenu]; | - | ||||||||||||||||||||||||||||||
| 3255 | if (ir.isValid()) {
| 0 | ||||||||||||||||||||||||||||||
| 3256 | QRenderRule subSubRule = renderRule(w, opt, PseudoElement_TitleBarSysMenu); | - | ||||||||||||||||||||||||||||||
| 3257 | subSubRule.drawRule(p, ir); | - | ||||||||||||||||||||||||||||||
| 3258 | ir = subSubRule.contentsRect(ir); | - | ||||||||||||||||||||||||||||||
| 3259 | if (!tb->icon.isNull()) {
| 0 | ||||||||||||||||||||||||||||||
| 3260 | tb->icon.paint(p, ir); | - | ||||||||||||||||||||||||||||||
| 3261 | } else { never executed: end of block | 0 | ||||||||||||||||||||||||||||||
| 3262 | int iconSize = pixelMetric(PM_SmallIconSize, tb, w); | - | ||||||||||||||||||||||||||||||
| 3263 | pm = standardIcon(SP_TitleBarMenuButton, 0, w).pixmap(iconSize, iconSize); | - | ||||||||||||||||||||||||||||||
| 3264 | drawItemPixmap(p, ir, Qt::AlignCenter, pm); | - | ||||||||||||||||||||||||||||||
| 3265 | } never executed: end of block | 0 | ||||||||||||||||||||||||||||||
| 3266 | } | - | ||||||||||||||||||||||||||||||
| 3267 | - | |||||||||||||||||||||||||||||||
| 3268 | ir = layout[SC_TitleBarCloseButton]; | - | ||||||||||||||||||||||||||||||
| 3269 | if (ir.isValid()) {
| 0 | ||||||||||||||||||||||||||||||
| 3270 | QRenderRule subSubRule = renderRule(w, opt, PseudoElement_TitleBarCloseButton); | - | ||||||||||||||||||||||||||||||
| 3271 | subSubRule.drawRule(p, ir); | - | ||||||||||||||||||||||||||||||
| 3272 | - | |||||||||||||||||||||||||||||||
| 3273 | QSize sz = subSubRule.contentsRect(ir).size(); | - | ||||||||||||||||||||||||||||||
| 3274 | if ((tb->titleBarFlags & Qt::WindowType_Mask) == Qt::Tool)
| 0 | ||||||||||||||||||||||||||||||
| 3275 | pm = standardIcon(SP_DockWidgetCloseButton, 0, w).pixmap(sz); never executed: pm = standardIcon(SP_DockWidgetCloseButton, 0, w).pixmap(sz); | 0 | ||||||||||||||||||||||||||||||
| 3276 | else | - | ||||||||||||||||||||||||||||||
| 3277 | pm = standardIcon(SP_TitleBarCloseButton, 0, w).pixmap(sz); never executed: pm = standardIcon(SP_TitleBarCloseButton, 0, w).pixmap(sz); | 0 | ||||||||||||||||||||||||||||||
| 3278 | drawItemPixmap(p, ir, Qt::AlignCenter, pm); | - | ||||||||||||||||||||||||||||||
| 3279 | } never executed: end of block | 0 | ||||||||||||||||||||||||||||||
| 3280 | - | |||||||||||||||||||||||||||||||
| 3281 | int pes[] = { | - | ||||||||||||||||||||||||||||||
| 3282 | PseudoElement_TitleBarMaxButton, | - | ||||||||||||||||||||||||||||||
| 3283 | PseudoElement_TitleBarMinButton, | - | ||||||||||||||||||||||||||||||
| 3284 | PseudoElement_TitleBarNormalButton, | - | ||||||||||||||||||||||||||||||
| 3285 | PseudoElement_TitleBarShadeButton, | - | ||||||||||||||||||||||||||||||
| 3286 | PseudoElement_TitleBarUnshadeButton, | - | ||||||||||||||||||||||||||||||
| 3287 | PseudoElement_TitleBarContextHelpButton | - | ||||||||||||||||||||||||||||||
| 3288 | }; | - | ||||||||||||||||||||||||||||||
| 3289 | - | |||||||||||||||||||||||||||||||
| 3290 | for (unsigned int i = 0; i < sizeof(pes)/sizeof(int); i++) {
| 0 | ||||||||||||||||||||||||||||||
| 3291 | int pe = pes[i]; | - | ||||||||||||||||||||||||||||||
| 3292 | QStyle::SubControl sc = knownPseudoElements[pe].subControl; | - | ||||||||||||||||||||||||||||||
| 3293 | ir = layout[sc]; | - | ||||||||||||||||||||||||||||||
| 3294 | if (!ir.isValid())
| 0 | ||||||||||||||||||||||||||||||
| 3295 | continue; never executed: continue; | 0 | ||||||||||||||||||||||||||||||
| 3296 | QRenderRule subSubRule = renderRule(w, opt, pe); | - | ||||||||||||||||||||||||||||||
| 3297 | subSubRule.drawRule(p, ir); | - | ||||||||||||||||||||||||||||||
| 3298 | pm = standardIcon(subControlIcon(pe), 0, w).pixmap(subSubRule.contentsRect(ir).size()); | - | ||||||||||||||||||||||||||||||
| 3299 | drawItemPixmap(p, ir, Qt::AlignCenter, pm); | - | ||||||||||||||||||||||||||||||
| 3300 | } never executed: end of block | 0 | ||||||||||||||||||||||||||||||
| 3301 | - | |||||||||||||||||||||||||||||||
| 3302 | return; never executed: return; | 0 | ||||||||||||||||||||||||||||||
| 3303 | } | - | ||||||||||||||||||||||||||||||
| 3304 | break; never executed: break; | 0 | ||||||||||||||||||||||||||||||
| 3305 | - | |||||||||||||||||||||||||||||||
| 3306 | - | |||||||||||||||||||||||||||||||
| 3307 | default: never executed: default: | 0 | ||||||||||||||||||||||||||||||
| 3308 | break; never executed: break; | 0 | ||||||||||||||||||||||||||||||
| 3309 | } | - | ||||||||||||||||||||||||||||||
| 3310 | - | |||||||||||||||||||||||||||||||
| 3311 | baseStyle()->drawComplexControl(cc, opt, p, w); | - | ||||||||||||||||||||||||||||||
| 3312 | } never executed: end of block | 0 | ||||||||||||||||||||||||||||||
| 3313 | - | |||||||||||||||||||||||||||||||
| 3314 | void QStyleSheetStyle::drawControl(ControlElement ce, const QStyleOption *opt, QPainter *p, | - | ||||||||||||||||||||||||||||||
| 3315 | const QWidget *w) const | - | ||||||||||||||||||||||||||||||
| 3316 | { | - | ||||||||||||||||||||||||||||||
| 3317 | RECURSION_GUARD(baseStyle()->drawControl(ce, opt, p, w); return) never executed: return;
| 0 | ||||||||||||||||||||||||||||||
| 3318 | - | |||||||||||||||||||||||||||||||
| 3319 | QRenderRule rule = renderRule(w, opt); | - | ||||||||||||||||||||||||||||||
| 3320 | int pe1 = PseudoElement_None, pe2 = PseudoElement_None; | - | ||||||||||||||||||||||||||||||
| 3321 | bool fallback = false; | - | ||||||||||||||||||||||||||||||
| 3322 | - | |||||||||||||||||||||||||||||||
| 3323 | switch (ce) { | - | ||||||||||||||||||||||||||||||
| 3324 | case CE_ToolButtonLabel: never executed: case CE_ToolButtonLabel: | 0 | ||||||||||||||||||||||||||||||
| 3325 | if (const QStyleOptionToolButton *btn = qstyleoption_cast<const QStyleOptionToolButton *>(opt)) {
| 0 | ||||||||||||||||||||||||||||||
| 3326 | if (rule.hasBox() || btn->features & QStyleOptionToolButton::Arrow) {
| 0 | ||||||||||||||||||||||||||||||
| 3327 | QCommonStyle::drawControl(ce, opt, p, w); | - | ||||||||||||||||||||||||||||||
| 3328 | } else { never executed: end of block | 0 | ||||||||||||||||||||||||||||||
| 3329 | QStyleOptionToolButton butOpt(*btn); | - | ||||||||||||||||||||||||||||||
| 3330 | rule.configurePalette(&butOpt.palette, QPalette::ButtonText, QPalette::Button); | - | ||||||||||||||||||||||||||||||
| 3331 | baseStyle()->drawControl(ce, &butOpt, p, w); | - | ||||||||||||||||||||||||||||||
| 3332 | } never executed: end of block | 0 | ||||||||||||||||||||||||||||||
| 3333 | return; never executed: return; | 0 | ||||||||||||||||||||||||||||||
| 3334 | } | - | ||||||||||||||||||||||||||||||
| 3335 | break; never executed: break; | 0 | ||||||||||||||||||||||||||||||
| 3336 | - | |||||||||||||||||||||||||||||||
| 3337 | case CE_FocusFrame: never executed: case CE_FocusFrame: | 0 | ||||||||||||||||||||||||||||||
| 3338 | if (!rule.hasNativeBorder()) {
| 0 | ||||||||||||||||||||||||||||||
| 3339 | rule.drawBorder(p, opt->rect); | - | ||||||||||||||||||||||||||||||
| 3340 | return; never executed: return; | 0 | ||||||||||||||||||||||||||||||
| 3341 | } | - | ||||||||||||||||||||||||||||||
| 3342 | break; never executed: break; | 0 | ||||||||||||||||||||||||||||||
| 3343 | - | |||||||||||||||||||||||||||||||
| 3344 | case CE_PushButton: never executed: case CE_PushButton: | 0 | ||||||||||||||||||||||||||||||
| 3345 | if (const QStyleOptionButton *btn = qstyleoption_cast<const QStyleOptionButton *>(opt)) {
| 0 | ||||||||||||||||||||||||||||||
| 3346 | if (rule.hasDrawable() || rule.hasBox() || rule.hasPosition() || rule.hasPalette() ||
| 0 | ||||||||||||||||||||||||||||||
| 3347 | ((btn->features & QStyleOptionButton::HasMenu) && hasStyleRule(w, PseudoElement_PushButtonMenuIndicator))) {
| 0 | ||||||||||||||||||||||||||||||
| 3348 | ParentStyle::drawControl(ce, opt, p, w); | - | ||||||||||||||||||||||||||||||
| 3349 | return; never executed: return; | 0 | ||||||||||||||||||||||||||||||
| 3350 | } | - | ||||||||||||||||||||||||||||||
| 3351 | } never executed: end of block | 0 | ||||||||||||||||||||||||||||||
| 3352 | break; never executed: break; | 0 | ||||||||||||||||||||||||||||||
| 3353 | case CE_PushButtonBevel: never executed: case CE_PushButtonBevel: | 0 | ||||||||||||||||||||||||||||||
| 3354 | if (const QStyleOptionButton *btn = qstyleoption_cast<const QStyleOptionButton *>(opt)) {
| 0 | ||||||||||||||||||||||||||||||
| 3355 | QStyleOptionButton btnOpt(*btn); | - | ||||||||||||||||||||||||||||||
| 3356 | btnOpt.rect = rule.borderRect(opt->rect); | - | ||||||||||||||||||||||||||||||
| 3357 | if (rule.hasNativeBorder()) {
| 0 | ||||||||||||||||||||||||||||||
| 3358 | rule.drawBackgroundImage(p, btnOpt.rect); | - | ||||||||||||||||||||||||||||||
| 3359 | rule.configurePalette(&btnOpt.palette, QPalette::ButtonText, QPalette::Button); | - | ||||||||||||||||||||||||||||||
| 3360 | bool customMenu = (btn->features & QStyleOptionButton::HasMenu
| 0 | ||||||||||||||||||||||||||||||
| 3361 | && hasStyleRule(w, PseudoElement_PushButtonMenuIndicator));
| 0 | ||||||||||||||||||||||||||||||
| 3362 | if (customMenu)
| 0 | ||||||||||||||||||||||||||||||
| 3363 | btnOpt.features &= ~QStyleOptionButton::HasMenu; never executed: btnOpt.features &= ~QStyleOptionButton::HasMenu; | 0 | ||||||||||||||||||||||||||||||
| 3364 | if (rule.baseStyleCanDraw()) {
| 0 | ||||||||||||||||||||||||||||||
| 3365 | baseStyle()->drawControl(ce, &btnOpt, p, w); | - | ||||||||||||||||||||||||||||||
| 3366 | } else { never executed: end of block | 0 | ||||||||||||||||||||||||||||||
| 3367 | QWindowsStyle::drawControl(ce, &btnOpt, p, w); | - | ||||||||||||||||||||||||||||||
| 3368 | } never executed: end of block | 0 | ||||||||||||||||||||||||||||||
| 3369 | if (!customMenu)
| 0 | ||||||||||||||||||||||||||||||
| 3370 | return; never executed: return; | 0 | ||||||||||||||||||||||||||||||
| 3371 | } else { never executed: end of block | 0 | ||||||||||||||||||||||||||||||
| 3372 | rule.drawRule(p, opt->rect); | - | ||||||||||||||||||||||||||||||
| 3373 | } never executed: end of block | 0 | ||||||||||||||||||||||||||||||
| 3374 | - | |||||||||||||||||||||||||||||||
| 3375 | if (btn->features & QStyleOptionButton::HasMenu) {
| 0 | ||||||||||||||||||||||||||||||
| 3376 | QRenderRule subRule = renderRule(w, opt, PseudoElement_PushButtonMenuIndicator); | - | ||||||||||||||||||||||||||||||
| 3377 | QRect ir = positionRect(w, rule, subRule, PseudoElement_PushButtonMenuIndicator, opt->rect, opt->direction); | - | ||||||||||||||||||||||||||||||
| 3378 | if (subRule.hasDrawable()) {
| 0 | ||||||||||||||||||||||||||||||
| 3379 | subRule.drawRule(p, ir); | - | ||||||||||||||||||||||||||||||
| 3380 | } else { never executed: end of block | 0 | ||||||||||||||||||||||||||||||
| 3381 | btnOpt.rect = ir; | - | ||||||||||||||||||||||||||||||
| 3382 | baseStyle()->drawPrimitive(PE_IndicatorArrowDown, &btnOpt, p, w); | - | ||||||||||||||||||||||||||||||
| 3383 | } never executed: end of block | 0 | ||||||||||||||||||||||||||||||
| 3384 | } | - | ||||||||||||||||||||||||||||||
| 3385 | } never executed: end of block | 0 | ||||||||||||||||||||||||||||||
| 3386 | return; never executed: return; | 0 | ||||||||||||||||||||||||||||||
| 3387 | - | |||||||||||||||||||||||||||||||
| 3388 | case CE_PushButtonLabel: never executed: case CE_PushButtonLabel: | 0 | ||||||||||||||||||||||||||||||
| 3389 | if (const QStyleOptionButton *button = qstyleoption_cast<const QStyleOptionButton *>(opt)) {
| 0 | ||||||||||||||||||||||||||||||
| 3390 | QStyleOptionButton butOpt(*button); | - | ||||||||||||||||||||||||||||||
| 3391 | rule.configurePalette(&butOpt.palette, QPalette::ButtonText, QPalette::Button); | - | ||||||||||||||||||||||||||||||
| 3392 | - | |||||||||||||||||||||||||||||||
| 3393 | const QFont oldFont = p->font(); | - | ||||||||||||||||||||||||||||||
| 3394 | if (rule.hasFont)
| 0 | ||||||||||||||||||||||||||||||
| 3395 | p->setFont(rule.font); never executed: p->setFont(rule.font); | 0 | ||||||||||||||||||||||||||||||
| 3396 | - | |||||||||||||||||||||||||||||||
| 3397 | if (rule.hasPosition() && rule.position()->textAlignment != 0) {
| 0 | ||||||||||||||||||||||||||||||
| 3398 | Qt::Alignment textAlignment = rule.position()->textAlignment; | - | ||||||||||||||||||||||||||||||
| 3399 | QRect textRect = button->rect; | - | ||||||||||||||||||||||||||||||
| 3400 | uint tf = Qt::TextShowMnemonic; | - | ||||||||||||||||||||||||||||||
| 3401 | const uint verticalAlignMask = Qt::AlignVCenter | Qt::AlignTop | Qt::AlignLeft; | - | ||||||||||||||||||||||||||||||
| 3402 | tf |= (textAlignment & verticalAlignMask) ? (textAlignment & verticalAlignMask) : Qt::AlignVCenter;
| 0 | ||||||||||||||||||||||||||||||
| 3403 | if (!styleHint(SH_UnderlineShortcut, button, w))
| 0 | ||||||||||||||||||||||||||||||
| 3404 | tf |= Qt::TextHideMnemonic; never executed: tf |= Qt::TextHideMnemonic; | 0 | ||||||||||||||||||||||||||||||
| 3405 | if (!button->icon.isNull()) {
| 0 | ||||||||||||||||||||||||||||||
| 3406 | //Group both icon and text | - | ||||||||||||||||||||||||||||||
| 3407 | QRect iconRect; | - | ||||||||||||||||||||||||||||||
| 3408 | QIcon::Mode mode = button->state & State_Enabled ? QIcon::Normal : QIcon::Disabled;
| 0 | ||||||||||||||||||||||||||||||
| 3409 | if (mode == QIcon::Normal && button->state & State_HasFocus)
| 0 | ||||||||||||||||||||||||||||||
| 3410 | mode = QIcon::Active; never executed: mode = QIcon::Active; | 0 | ||||||||||||||||||||||||||||||
| 3411 | QIcon::State state = QIcon::Off; | - | ||||||||||||||||||||||||||||||
| 3412 | if (button->state & State_On)
| 0 | ||||||||||||||||||||||||||||||
| 3413 | state = QIcon::On; never executed: state = QIcon::On; | 0 | ||||||||||||||||||||||||||||||
| 3414 | - | |||||||||||||||||||||||||||||||
| 3415 | QPixmap pixmap = button->icon.pixmap(button->iconSize, mode, state); | - | ||||||||||||||||||||||||||||||
| 3416 | int pixmapWidth = pixmap.width() / pixmap.devicePixelRatio(); | - | ||||||||||||||||||||||||||||||
| 3417 | int pixmapHeight = pixmap.height() / pixmap.devicePixelRatio(); | - | ||||||||||||||||||||||||||||||
| 3418 | int labelWidth = pixmapWidth; | - | ||||||||||||||||||||||||||||||
| 3419 | int labelHeight = pixmapHeight; | - | ||||||||||||||||||||||||||||||
| 3420 | int iconSpacing = 4;//### 4 is currently hardcoded in QPushButton::sizeHint() | - | ||||||||||||||||||||||||||||||
| 3421 | int textWidth = button->fontMetrics.boundingRect(opt->rect, tf, button->text).width(); | - | ||||||||||||||||||||||||||||||
| 3422 | if (!button->text.isEmpty())
| 0 | ||||||||||||||||||||||||||||||
| 3423 | labelWidth += (textWidth + iconSpacing); never executed: labelWidth += (textWidth + iconSpacing); | 0 | ||||||||||||||||||||||||||||||
| 3424 | - | |||||||||||||||||||||||||||||||
| 3425 | //Determine label alignment: | - | ||||||||||||||||||||||||||||||
| 3426 | if (textAlignment & Qt::AlignLeft) { /*left*/
| 0 | ||||||||||||||||||||||||||||||
| 3427 | iconRect = QRect(textRect.x(), textRect.y() + (textRect.height() - labelHeight) / 2, | - | ||||||||||||||||||||||||||||||
| 3428 | pixmapWidth, pixmapHeight); | - | ||||||||||||||||||||||||||||||
| 3429 | } else if (textAlignment & Qt::AlignHCenter) { /* center */ never executed: end of block
| 0 | ||||||||||||||||||||||||||||||
| 3430 | iconRect = QRect(textRect.x() + (textRect.width() - labelWidth) / 2, | - | ||||||||||||||||||||||||||||||
| 3431 | textRect.y() + (textRect.height() - labelHeight) / 2, | - | ||||||||||||||||||||||||||||||
| 3432 | pixmapWidth, pixmapHeight); | - | ||||||||||||||||||||||||||||||
| 3433 | } else { /*right*/ never executed: end of block | 0 | ||||||||||||||||||||||||||||||
| 3434 | iconRect = QRect(textRect.x() + textRect.width() - labelWidth, | - | ||||||||||||||||||||||||||||||
| 3435 | textRect.y() + (textRect.height() - labelHeight) / 2, | - | ||||||||||||||||||||||||||||||
| 3436 | pixmapWidth, pixmapHeight); | - | ||||||||||||||||||||||||||||||
| 3437 | } never executed: end of block | 0 | ||||||||||||||||||||||||||||||
| 3438 | - | |||||||||||||||||||||||||||||||
| 3439 | iconRect = visualRect(button->direction, textRect, iconRect); | - | ||||||||||||||||||||||||||||||
| 3440 | - | |||||||||||||||||||||||||||||||
| 3441 | tf |= Qt::AlignLeft; //left align, we adjust the text-rect instead | - | ||||||||||||||||||||||||||||||
| 3442 | - | |||||||||||||||||||||||||||||||
| 3443 | if (button->direction == Qt::RightToLeft)
| 0 | ||||||||||||||||||||||||||||||
| 3444 | textRect.setRight(iconRect.left() - iconSpacing); never executed: textRect.setRight(iconRect.left() - iconSpacing); | 0 | ||||||||||||||||||||||||||||||
| 3445 | else | - | ||||||||||||||||||||||||||||||
| 3446 | textRect.setLeft(iconRect.left() + iconRect.width() + iconSpacing); never executed: textRect.setLeft(iconRect.left() + iconRect.width() + iconSpacing); | 0 | ||||||||||||||||||||||||||||||
| 3447 | - | |||||||||||||||||||||||||||||||
| 3448 | if (button->state & (State_On | State_Sunken))
| 0 | ||||||||||||||||||||||||||||||
| 3449 | iconRect.translate(pixelMetric(PM_ButtonShiftHorizontal, opt, w), never executed: iconRect.translate(pixelMetric(PM_ButtonShiftHorizontal, opt, w), pixelMetric(PM_ButtonShiftVertical, opt, w)); | 0 | ||||||||||||||||||||||||||||||
| 3450 | pixelMetric(PM_ButtonShiftVertical, opt, w)); never executed: iconRect.translate(pixelMetric(PM_ButtonShiftHorizontal, opt, w), pixelMetric(PM_ButtonShiftVertical, opt, w)); | 0 | ||||||||||||||||||||||||||||||
| 3451 | p->drawPixmap(iconRect, pixmap); | - | ||||||||||||||||||||||||||||||
| 3452 | } else { never executed: end of block | 0 | ||||||||||||||||||||||||||||||
| 3453 | tf |= textAlignment; | - | ||||||||||||||||||||||||||||||
| 3454 | } never executed: end of block | 0 | ||||||||||||||||||||||||||||||
| 3455 | if (button->state & (State_On | State_Sunken))
| 0 | ||||||||||||||||||||||||||||||
| 3456 | textRect.translate(pixelMetric(PM_ButtonShiftHorizontal, opt, w), never executed: textRect.translate(pixelMetric(PM_ButtonShiftHorizontal, opt, w), pixelMetric(PM_ButtonShiftVertical, opt, w)); | 0 | ||||||||||||||||||||||||||||||
| 3457 | pixelMetric(PM_ButtonShiftVertical, opt, w)); never executed: textRect.translate(pixelMetric(PM_ButtonShiftHorizontal, opt, w), pixelMetric(PM_ButtonShiftVertical, opt, w)); | 0 | ||||||||||||||||||||||||||||||
| 3458 | - | |||||||||||||||||||||||||||||||
| 3459 | if (button->features & QStyleOptionButton::HasMenu) {
| 0 | ||||||||||||||||||||||||||||||
| 3460 | int indicatorSize = pixelMetric(PM_MenuButtonIndicator, button, w); | - | ||||||||||||||||||||||||||||||
| 3461 | if (button->direction == Qt::LeftToRight)
| 0 | ||||||||||||||||||||||||||||||
| 3462 | textRect = textRect.adjusted(0, 0, -indicatorSize, 0); never executed: textRect = textRect.adjusted(0, 0, -indicatorSize, 0); | 0 | ||||||||||||||||||||||||||||||
| 3463 | else | - | ||||||||||||||||||||||||||||||
| 3464 | textRect = textRect.adjusted(indicatorSize, 0, 0, 0); never executed: textRect = textRect.adjusted(indicatorSize, 0, 0, 0); | 0 | ||||||||||||||||||||||||||||||
| 3465 | } | - | ||||||||||||||||||||||||||||||
| 3466 | drawItemText(p, textRect, tf, butOpt.palette, (button->state & State_Enabled), | - | ||||||||||||||||||||||||||||||
| 3467 | button->text, QPalette::ButtonText); | - | ||||||||||||||||||||||||||||||
| 3468 | } else { never executed: end of block | 0 | ||||||||||||||||||||||||||||||
| 3469 | ParentStyle::drawControl(ce, &butOpt, p, w); | - | ||||||||||||||||||||||||||||||
| 3470 | } never executed: end of block | 0 | ||||||||||||||||||||||||||||||
| 3471 | - | |||||||||||||||||||||||||||||||
| 3472 | if (rule.hasFont)
| 0 | ||||||||||||||||||||||||||||||
| 3473 | p->setFont(oldFont); never executed: p->setFont(oldFont); | 0 | ||||||||||||||||||||||||||||||
| 3474 | } never executed: end of block | 0 | ||||||||||||||||||||||||||||||
| 3475 | return; never executed: return; | 0 | ||||||||||||||||||||||||||||||
| 3476 | - | |||||||||||||||||||||||||||||||
| 3477 | case CE_RadioButton: never executed: case CE_RadioButton: | 0 | ||||||||||||||||||||||||||||||
| 3478 | case CE_CheckBox: never executed: case CE_CheckBox: | 0 | ||||||||||||||||||||||||||||||
| 3479 | if (rule.hasBox() || !rule.hasNativeBorder() || rule.hasDrawable() || hasStyleRule(w, PseudoElement_Indicator)) {
| 0 | ||||||||||||||||||||||||||||||
| 3480 | rule.drawRule(p, opt->rect); | - | ||||||||||||||||||||||||||||||
| 3481 | ParentStyle::drawControl(ce, opt, p, w); | - | ||||||||||||||||||||||||||||||
| 3482 | return; never executed: return; | 0 | ||||||||||||||||||||||||||||||
| 3483 | } else if (const QStyleOptionButton *btn = qstyleoption_cast<const QStyleOptionButton *>(opt)) {
| 0 | ||||||||||||||||||||||||||||||
| 3484 | QStyleOptionButton butOpt(*btn); | - | ||||||||||||||||||||||||||||||
| 3485 | rule.configurePalette(&butOpt.palette, QPalette::ButtonText, QPalette::Button); | - | ||||||||||||||||||||||||||||||
| 3486 | baseStyle()->drawControl(ce, &butOpt, p, w); | - | ||||||||||||||||||||||||||||||
| 3487 | return; never executed: return; | 0 | ||||||||||||||||||||||||||||||
| 3488 | } | - | ||||||||||||||||||||||||||||||
| 3489 | break; never executed: break; | 0 | ||||||||||||||||||||||||||||||
| 3490 | case CE_RadioButtonLabel: never executed: case CE_RadioButtonLabel: | 0 | ||||||||||||||||||||||||||||||
| 3491 | case CE_CheckBoxLabel: never executed: case CE_CheckBoxLabel: | 0 | ||||||||||||||||||||||||||||||
| 3492 | if (const QStyleOptionButton *btn = qstyleoption_cast<const QStyleOptionButton *>(opt)) {
| 0 | ||||||||||||||||||||||||||||||
| 3493 | QStyleOptionButton butOpt(*btn); | - | ||||||||||||||||||||||||||||||
| 3494 | rule.configurePalette(&butOpt.palette, QPalette::ButtonText, QPalette::Button); | - | ||||||||||||||||||||||||||||||
| 3495 | ParentStyle::drawControl(ce, &butOpt, p, w); | - | ||||||||||||||||||||||||||||||
| 3496 | } never executed: end of block | 0 | ||||||||||||||||||||||||||||||
| 3497 | return; never executed: return; | 0 | ||||||||||||||||||||||||||||||
| 3498 | - | |||||||||||||||||||||||||||||||
| 3499 | case CE_Splitter: never executed: case CE_Splitter: | 0 | ||||||||||||||||||||||||||||||
| 3500 | pe1 = PseudoElement_SplitterHandle; | - | ||||||||||||||||||||||||||||||
| 3501 | break; never executed: break; | 0 | ||||||||||||||||||||||||||||||
| 3502 | - | |||||||||||||||||||||||||||||||
| 3503 | case CE_ToolBar: never executed: case CE_ToolBar: | 0 | ||||||||||||||||||||||||||||||
| 3504 | if (rule.hasBackground()) {
| 0 | ||||||||||||||||||||||||||||||
| 3505 | rule.drawBackground(p, opt->rect); | - | ||||||||||||||||||||||||||||||
| 3506 | } never executed: end of block | 0 | ||||||||||||||||||||||||||||||
| 3507 | if (rule.hasBorder()) {
| 0 | ||||||||||||||||||||||||||||||
| 3508 | rule.drawBorder(p, rule.borderRect(opt->rect)); | - | ||||||||||||||||||||||||||||||
| 3509 | } else { never executed: end of block | 0 | ||||||||||||||||||||||||||||||
| 3510 | #ifndef QT_NO_TOOLBAR | - | ||||||||||||||||||||||||||||||
| 3511 | if (const QStyleOptionToolBar *tb = qstyleoption_cast<const QStyleOptionToolBar *>(opt)) {
| 0 | ||||||||||||||||||||||||||||||
| 3512 | QStyleOptionToolBar newTb(*tb); | - | ||||||||||||||||||||||||||||||
| 3513 | newTb.rect = rule.borderRect(opt->rect); | - | ||||||||||||||||||||||||||||||
| 3514 | baseStyle()->drawControl(ce, &newTb, p, w); | - | ||||||||||||||||||||||||||||||
| 3515 | } never executed: end of block | 0 | ||||||||||||||||||||||||||||||
| 3516 | #endif // QT_NO_TOOLBAR | - | ||||||||||||||||||||||||||||||
| 3517 | } never executed: end of block | 0 | ||||||||||||||||||||||||||||||
| 3518 | return; never executed: return; | 0 | ||||||||||||||||||||||||||||||
| 3519 | - | |||||||||||||||||||||||||||||||
| 3520 | case CE_MenuEmptyArea: never executed: case CE_MenuEmptyArea: | 0 | ||||||||||||||||||||||||||||||
| 3521 | case CE_MenuBarEmptyArea: never executed: case CE_MenuBarEmptyArea: | 0 | ||||||||||||||||||||||||||||||
| 3522 | if (rule.hasDrawable()) {
| 0 | ||||||||||||||||||||||||||||||
| 3523 | // Drawn by PE_Widget | - | ||||||||||||||||||||||||||||||
| 3524 | return; never executed: return; | 0 | ||||||||||||||||||||||||||||||
| 3525 | } | - | ||||||||||||||||||||||||||||||
| 3526 | break; never executed: break; | 0 | ||||||||||||||||||||||||||||||
| 3527 | - | |||||||||||||||||||||||||||||||
| 3528 | case CE_MenuTearoff: never executed: case CE_MenuTearoff: | 0 | ||||||||||||||||||||||||||||||
| 3529 | case CE_MenuScroller: never executed: case CE_MenuScroller: | 0 | ||||||||||||||||||||||||||||||
| 3530 | if (const QStyleOptionMenuItem *m = qstyleoption_cast<const QStyleOptionMenuItem *>(opt)) {
| 0 | ||||||||||||||||||||||||||||||
| 3531 | QStyleOptionMenuItem mi(*m); | - | ||||||||||||||||||||||||||||||
| 3532 | int pe = ce == CE_MenuTearoff ? PseudoElement_MenuTearoff : PseudoElement_MenuScroller;
| 0 | ||||||||||||||||||||||||||||||
| 3533 | QRenderRule subRule = renderRule(w, opt, pe); | - | ||||||||||||||||||||||||||||||
| 3534 | mi.rect = subRule.contentsRect(opt->rect); | - | ||||||||||||||||||||||||||||||
| 3535 | rule.configurePalette(&mi.palette, QPalette::ButtonText, QPalette::Button); | - | ||||||||||||||||||||||||||||||
| 3536 | subRule.configurePalette(&mi.palette, QPalette::ButtonText, QPalette::Button); | - | ||||||||||||||||||||||||||||||
| 3537 | - | |||||||||||||||||||||||||||||||
| 3538 | if (subRule.hasDrawable()) {
| 0 | ||||||||||||||||||||||||||||||
| 3539 | subRule.drawRule(p, opt->rect); | - | ||||||||||||||||||||||||||||||
| 3540 | } else { never executed: end of block | 0 | ||||||||||||||||||||||||||||||
| 3541 | baseStyle()->drawControl(ce, &mi, p, w); | - | ||||||||||||||||||||||||||||||
| 3542 | } never executed: end of block | 0 | ||||||||||||||||||||||||||||||
| 3543 | } | - | ||||||||||||||||||||||||||||||
| 3544 | return; never executed: return; | 0 | ||||||||||||||||||||||||||||||
| 3545 | - | |||||||||||||||||||||||||||||||
| 3546 | case CE_MenuItem: never executed: case CE_MenuItem: | 0 | ||||||||||||||||||||||||||||||
| 3547 | if (const QStyleOptionMenuItem *m = qstyleoption_cast<const QStyleOptionMenuItem *>(opt)) {
| 0 | ||||||||||||||||||||||||||||||
| 3548 | QStyleOptionMenuItem mi(*m); | - | ||||||||||||||||||||||||||||||
| 3549 | - | |||||||||||||||||||||||||||||||
| 3550 | int pseudo = (mi.menuItemType == QStyleOptionMenuItem::Separator) ? PseudoElement_MenuSeparator : PseudoElement_Item;
| 0 | ||||||||||||||||||||||||||||||
| 3551 | QRenderRule subRule = renderRule(w, opt, pseudo); | - | ||||||||||||||||||||||||||||||
| 3552 | mi.rect = subRule.contentsRect(opt->rect); | - | ||||||||||||||||||||||||||||||
| 3553 | rule.configurePalette(&mi.palette, QPalette::ButtonText, QPalette::Button); | - | ||||||||||||||||||||||||||||||
| 3554 | rule.configurePalette(&mi.palette, QPalette::HighlightedText, QPalette::Highlight); | - | ||||||||||||||||||||||||||||||
| 3555 | subRule.configurePalette(&mi.palette, QPalette::ButtonText, QPalette::Button); | - | ||||||||||||||||||||||||||||||
| 3556 | subRule.configurePalette(&mi.palette, QPalette::HighlightedText, QPalette::Highlight); | - | ||||||||||||||||||||||||||||||
| 3557 | QFont oldFont = p->font(); | - | ||||||||||||||||||||||||||||||
| 3558 | if (subRule.hasFont)
| 0 | ||||||||||||||||||||||||||||||
| 3559 | p->setFont(subRule.font.resolve(p->font())); never executed: p->setFont(subRule.font.resolve(p->font())); | 0 | ||||||||||||||||||||||||||||||
| 3560 | - | |||||||||||||||||||||||||||||||
| 3561 | // We fall back to drawing with the style sheet code whenever at least one of the | - | ||||||||||||||||||||||||||||||
| 3562 | // items are styled in an incompatible way, such as having a background image. | - | ||||||||||||||||||||||||||||||
| 3563 | QRenderRule allRules = renderRule(w, PseudoElement_Item, PseudoClass_Any); | - | ||||||||||||||||||||||||||||||
| 3564 | - | |||||||||||||||||||||||||||||||
| 3565 | if ((pseudo == PseudoElement_MenuSeparator) && subRule.hasDrawable()) {
| 0 | ||||||||||||||||||||||||||||||
| 3566 | subRule.drawRule(p, opt->rect); | - | ||||||||||||||||||||||||||||||
| 3567 | } else if ((pseudo == PseudoElement_Item) never executed: end of block
| 0 | ||||||||||||||||||||||||||||||
| 3568 | && (allRules.hasBox() || allRules.hasBorder()
| 0 | ||||||||||||||||||||||||||||||
| 3569 | || (allRules.background() && !allRules.background()->pixmap.isNull()))) {
| 0 | ||||||||||||||||||||||||||||||
| 3570 | subRule.drawRule(p, opt->rect); | - | ||||||||||||||||||||||||||||||
| 3571 | if (subRule.hasBackground()) {
| 0 | ||||||||||||||||||||||||||||||
| 3572 | mi.palette.setBrush(QPalette::Highlight, Qt::NoBrush); | - | ||||||||||||||||||||||||||||||
| 3573 | mi.palette.setBrush(QPalette::Button, Qt::NoBrush); | - | ||||||||||||||||||||||||||||||
| 3574 | } else { never executed: end of block | 0 | ||||||||||||||||||||||||||||||
| 3575 | mi.palette.setBrush(QPalette::Highlight, mi.palette.brush(QPalette::Button)); | - | ||||||||||||||||||||||||||||||
| 3576 | } never executed: end of block | 0 | ||||||||||||||||||||||||||||||
| 3577 | mi.palette.setBrush(QPalette::HighlightedText, mi.palette.brush(QPalette::ButtonText)); | - | ||||||||||||||||||||||||||||||
| 3578 | - | |||||||||||||||||||||||||||||||
| 3579 | bool checkable = mi.checkType != QStyleOptionMenuItem::NotCheckable; | - | ||||||||||||||||||||||||||||||
| 3580 | bool checked = checkable ? mi.checked : false;
| 0 | ||||||||||||||||||||||||||||||
| 3581 | - | |||||||||||||||||||||||||||||||
| 3582 | bool dis = !(opt->state & QStyle::State_Enabled), | - | ||||||||||||||||||||||||||||||
| 3583 | act = opt->state & QStyle::State_Selected; | - | ||||||||||||||||||||||||||||||
| 3584 | - | |||||||||||||||||||||||||||||||
| 3585 | if (!mi.icon.isNull()) {
| 0 | ||||||||||||||||||||||||||||||
| 3586 | QIcon::Mode mode = dis ? QIcon::Disabled : QIcon::Normal;
| 0 | ||||||||||||||||||||||||||||||
| 3587 | if (act && !dis)
| 0 | ||||||||||||||||||||||||||||||
| 3588 | mode = QIcon::Active; never executed: mode = QIcon::Active; | 0 | ||||||||||||||||||||||||||||||
| 3589 | QPixmap pixmap; | - | ||||||||||||||||||||||||||||||
| 3590 | if (checked)
| 0 | ||||||||||||||||||||||||||||||
| 3591 | pixmap = mi.icon.pixmap(pixelMetric(PM_SmallIconSize), mode, QIcon::On); never executed: pixmap = mi.icon.pixmap(pixelMetric(PM_SmallIconSize), mode, QIcon::On); | 0 | ||||||||||||||||||||||||||||||
| 3592 | else | - | ||||||||||||||||||||||||||||||
| 3593 | pixmap = mi.icon.pixmap(pixelMetric(PM_SmallIconSize), mode); never executed: pixmap = mi.icon.pixmap(pixelMetric(PM_SmallIconSize), mode); | 0 | ||||||||||||||||||||||||||||||
| 3594 | const int pixw = pixmap.width() / pixmap.devicePixelRatio(); | - | ||||||||||||||||||||||||||||||
| 3595 | const int pixh = pixmap.height() / pixmap.devicePixelRatio(); | - | ||||||||||||||||||||||||||||||
| 3596 | QRenderRule iconRule = renderRule(w, opt, PseudoElement_MenuIcon); | - | ||||||||||||||||||||||||||||||
| 3597 | if (!iconRule.hasGeometry()) {
| 0 | ||||||||||||||||||||||||||||||
| 3598 | iconRule.geo = new QStyleSheetGeometryData(pixw, pixh, pixw, pixh, -1, -1); | - | ||||||||||||||||||||||||||||||
| 3599 | } else { never executed: end of block | 0 | ||||||||||||||||||||||||||||||
| 3600 | iconRule.geo->width = pixw; | - | ||||||||||||||||||||||||||||||
| 3601 | iconRule.geo->height = pixh; | - | ||||||||||||||||||||||||||||||
| 3602 | } never executed: end of block | 0 | ||||||||||||||||||||||||||||||
| 3603 | QRect iconRect = positionRect(w, subRule, iconRule, PseudoElement_MenuIcon, opt->rect, opt->direction); | - | ||||||||||||||||||||||||||||||
| 3604 | iconRule.drawRule(p, iconRect); | - | ||||||||||||||||||||||||||||||
| 3605 | QRect pmr(0, 0, pixw, pixh); | - | ||||||||||||||||||||||||||||||
| 3606 | pmr.moveCenter(iconRect.center()); | - | ||||||||||||||||||||||||||||||
| 3607 | p->drawPixmap(pmr.topLeft(), pixmap); | - | ||||||||||||||||||||||||||||||
| 3608 | } else if (checkable) { never executed: end of block
| 0 | ||||||||||||||||||||||||||||||
| 3609 | QRenderRule subSubRule = renderRule(w, opt, PseudoElement_MenuCheckMark); | - | ||||||||||||||||||||||||||||||
| 3610 | if (subSubRule.hasDrawable() || checked) {
| 0 | ||||||||||||||||||||||||||||||
| 3611 | QStyleOptionMenuItem newMi = mi; | - | ||||||||||||||||||||||||||||||
| 3612 | newMi.rect = positionRect(w, subRule, subSubRule, PseudoElement_MenuCheckMark, opt->rect, opt->direction); | - | ||||||||||||||||||||||||||||||
| 3613 | drawPrimitive(PE_IndicatorMenuCheckMark, &newMi, p, w); | - | ||||||||||||||||||||||||||||||
| 3614 | } never executed: end of block | 0 | ||||||||||||||||||||||||||||||
| 3615 | } never executed: end of block | 0 | ||||||||||||||||||||||||||||||
| 3616 | - | |||||||||||||||||||||||||||||||
| 3617 | QRect textRect = subRule.contentsRect(opt->rect); | - | ||||||||||||||||||||||||||||||
| 3618 | textRect.setWidth(textRect.width() - mi.tabWidth); | - | ||||||||||||||||||||||||||||||
| 3619 | QString s = mi.text; | - | ||||||||||||||||||||||||||||||
| 3620 | p->setPen(mi.palette.buttonText().color()); | - | ||||||||||||||||||||||||||||||
| 3621 | if (!s.isEmpty()) {
| 0 | ||||||||||||||||||||||||||||||
| 3622 | int text_flags = Qt::AlignLeft | Qt::AlignVCenter | Qt::TextShowMnemonic | Qt::TextDontClip | Qt::TextSingleLine; | - | ||||||||||||||||||||||||||||||
| 3623 | if (!styleHint(SH_UnderlineShortcut, &mi, w))
| 0 | ||||||||||||||||||||||||||||||
| 3624 | text_flags |= Qt::TextHideMnemonic; never executed: text_flags |= Qt::TextHideMnemonic; | 0 | ||||||||||||||||||||||||||||||
| 3625 | int t = s.indexOf(QLatin1Char('\t')); | - | ||||||||||||||||||||||||||||||
| 3626 | if (t >= 0) {
| 0 | ||||||||||||||||||||||||||||||
| 3627 | QRect vShortcutRect = visualRect(opt->direction, mi.rect, | - | ||||||||||||||||||||||||||||||
| 3628 | QRect(textRect.topRight(), QPoint(mi.rect.right(), textRect.bottom()))); | - | ||||||||||||||||||||||||||||||
| 3629 | p->drawText(vShortcutRect, text_flags, s.mid(t + 1)); | - | ||||||||||||||||||||||||||||||
| 3630 | s = s.left(t); | - | ||||||||||||||||||||||||||||||
| 3631 | } never executed: end of block | 0 | ||||||||||||||||||||||||||||||
| 3632 | p->drawText(textRect, text_flags, s.left(t)); | - | ||||||||||||||||||||||||||||||
| 3633 | } never executed: end of block | 0 | ||||||||||||||||||||||||||||||
| 3634 | - | |||||||||||||||||||||||||||||||
| 3635 | if (mi.menuItemType == QStyleOptionMenuItem::SubMenu) {// draw sub menu arrow
| 0 | ||||||||||||||||||||||||||||||
| 3636 | PrimitiveElement arrow = (opt->direction == Qt::RightToLeft) ? PE_IndicatorArrowLeft : PE_IndicatorArrowRight;
| 0 | ||||||||||||||||||||||||||||||
| 3637 | QRenderRule subRule2 = renderRule(w, opt, PseudoElement_MenuRightArrow); | - | ||||||||||||||||||||||||||||||
| 3638 | mi.rect = positionRect(w, subRule, subRule2, PseudoElement_MenuRightArrow, opt->rect, mi.direction); | - | ||||||||||||||||||||||||||||||
| 3639 | drawPrimitive(arrow, &mi, p, w); | - | ||||||||||||||||||||||||||||||
| 3640 | } never executed: end of block | 0 | ||||||||||||||||||||||||||||||
| 3641 | } else if (hasStyleRule(w, PseudoElement_MenuCheckMark) || hasStyleRule(w, PseudoElement_MenuRightArrow)) { never executed: end of block
| 0 | ||||||||||||||||||||||||||||||
| 3642 | QWindowsStyle::drawControl(ce, &mi, p, w); | - | ||||||||||||||||||||||||||||||
| 3643 | if (mi.checkType != QStyleOptionMenuItem::NotCheckable && !mi.checked) {
| 0 | ||||||||||||||||||||||||||||||
| 3644 | // We have a style defined, but QWindowsStyle won't draw anything if not checked. | - | ||||||||||||||||||||||||||||||
| 3645 | // So we mimick what QWindowsStyle would do. | - | ||||||||||||||||||||||||||||||
| 3646 | int checkcol = qMax<int>(mi.maxIconWidth, QWindowsStylePrivate::windowsCheckMarkWidth); | - | ||||||||||||||||||||||||||||||
| 3647 | QRect vCheckRect = visualRect(opt->direction, mi.rect, QRect(mi.rect.x(), mi.rect.y(), checkcol, mi.rect.height())); | - | ||||||||||||||||||||||||||||||
| 3648 | if (mi.state.testFlag(State_Enabled) && mi.state.testFlag(State_Selected)) {
| 0 | ||||||||||||||||||||||||||||||
| 3649 | qDrawShadePanel(p, vCheckRect, mi.palette, true, 1, &mi.palette.brush(QPalette::Button)); | - | ||||||||||||||||||||||||||||||
| 3650 | } else { never executed: end of block | 0 | ||||||||||||||||||||||||||||||
| 3651 | QBrush fill(mi.palette.light().color(), Qt::Dense4Pattern); | - | ||||||||||||||||||||||||||||||
| 3652 | qDrawShadePanel(p, vCheckRect, mi.palette, true, 1, &fill); | - | ||||||||||||||||||||||||||||||
| 3653 | } never executed: end of block | 0 | ||||||||||||||||||||||||||||||
| 3654 | QRenderRule subSubRule = renderRule(w, opt, PseudoElement_MenuCheckMark); | - | ||||||||||||||||||||||||||||||
| 3655 | if (subSubRule.hasDrawable()) {
| 0 | ||||||||||||||||||||||||||||||
| 3656 | QStyleOptionMenuItem newMi(mi); | - | ||||||||||||||||||||||||||||||
| 3657 | newMi.rect = visualRect(opt->direction, mi.rect, QRect(mi.rect.x() + QWindowsStylePrivate::windowsItemFrame, | - | ||||||||||||||||||||||||||||||
| 3658 | mi.rect.y() + QWindowsStylePrivate::windowsItemFrame, | - | ||||||||||||||||||||||||||||||
| 3659 | checkcol - 2 * QWindowsStylePrivate::windowsItemFrame, | - | ||||||||||||||||||||||||||||||
| 3660 | mi.rect.height() - 2 * QWindowsStylePrivate::windowsItemFrame)); | - | ||||||||||||||||||||||||||||||
| 3661 | drawPrimitive(PE_IndicatorMenuCheckMark, &newMi, p, w); | - | ||||||||||||||||||||||||||||||
| 3662 | } never executed: end of block | 0 | ||||||||||||||||||||||||||||||
| 3663 | } never executed: end of block | 0 | ||||||||||||||||||||||||||||||
| 3664 | } else { never executed: end of block | 0 | ||||||||||||||||||||||||||||||
| 3665 | if (rule.hasDrawable() && !subRule.hasDrawable() && !(opt->state & QStyle::State_Selected)) {
| 0 | ||||||||||||||||||||||||||||||
| 3666 | mi.palette.setColor(QPalette::Window, Qt::transparent); | - | ||||||||||||||||||||||||||||||
| 3667 | mi.palette.setColor(QPalette::Button, Qt::transparent); | - | ||||||||||||||||||||||||||||||
| 3668 | } never executed: end of block | 0 | ||||||||||||||||||||||||||||||
| 3669 | if (rule.baseStyleCanDraw() && subRule.baseStyleCanDraw()) {
| 0 | ||||||||||||||||||||||||||||||
| 3670 | baseStyle()->drawControl(ce, &mi, p, w); | - | ||||||||||||||||||||||||||||||
| 3671 | } else { never executed: end of block | 0 | ||||||||||||||||||||||||||||||
| 3672 | ParentStyle::drawControl(ce, &mi, p, w); | - | ||||||||||||||||||||||||||||||
| 3673 | } never executed: end of block | 0 | ||||||||||||||||||||||||||||||
| 3674 | } | - | ||||||||||||||||||||||||||||||
| 3675 | - | |||||||||||||||||||||||||||||||
| 3676 | if (subRule.hasFont)
| 0 | ||||||||||||||||||||||||||||||
| 3677 | p->setFont(oldFont); never executed: p->setFont(oldFont); | 0 | ||||||||||||||||||||||||||||||
| 3678 | - | |||||||||||||||||||||||||||||||
| 3679 | return; never executed: return; | 0 | ||||||||||||||||||||||||||||||
| 3680 | } | - | ||||||||||||||||||||||||||||||
| 3681 | return; never executed: return; | 0 | ||||||||||||||||||||||||||||||
| 3682 | - | |||||||||||||||||||||||||||||||
| 3683 | case CE_MenuBarItem: never executed: case CE_MenuBarItem: | 0 | ||||||||||||||||||||||||||||||
| 3684 | if (const QStyleOptionMenuItem *m = qstyleoption_cast<const QStyleOptionMenuItem *>(opt)) {
| 0 | ||||||||||||||||||||||||||||||
| 3685 | QStyleOptionMenuItem mi(*m); | - | ||||||||||||||||||||||||||||||
| 3686 | QRenderRule subRule = renderRule(w, opt, PseudoElement_Item); | - | ||||||||||||||||||||||||||||||
| 3687 | mi.rect = subRule.contentsRect(opt->rect); | - | ||||||||||||||||||||||||||||||
| 3688 | rule.configurePalette(&mi.palette, QPalette::ButtonText, QPalette::Button); | - | ||||||||||||||||||||||||||||||
| 3689 | subRule.configurePalette(&mi.palette, QPalette::ButtonText, QPalette::Button); | - | ||||||||||||||||||||||||||||||
| 3690 | - | |||||||||||||||||||||||||||||||
| 3691 | if (subRule.hasDrawable()) {
| 0 | ||||||||||||||||||||||||||||||
| 3692 | subRule.drawRule(p, opt->rect); | - | ||||||||||||||||||||||||||||||
| 3693 | QCommonStyle::drawControl(ce, &mi, p, w); | - | ||||||||||||||||||||||||||||||
| 3694 | } else { never executed: end of block | 0 | ||||||||||||||||||||||||||||||
| 3695 | if (rule.hasDrawable() && !(opt->state & QStyle::State_Selected)) {
| 0 | ||||||||||||||||||||||||||||||
| 3696 | // So that the menu bar background is not hidden by the items | - | ||||||||||||||||||||||||||||||
| 3697 | mi.palette.setColor(QPalette::Window, Qt::transparent); | - | ||||||||||||||||||||||||||||||
| 3698 | mi.palette.setColor(QPalette::Button, Qt::transparent); | - | ||||||||||||||||||||||||||||||
| 3699 | } never executed: end of block | 0 | ||||||||||||||||||||||||||||||
| 3700 | baseStyle()->drawControl(ce, &mi, p, w); | - | ||||||||||||||||||||||||||||||
| 3701 | } never executed: end of block | 0 | ||||||||||||||||||||||||||||||
| 3702 | } | - | ||||||||||||||||||||||||||||||
| 3703 | return; never executed: return; | 0 | ||||||||||||||||||||||||||||||
| 3704 | - | |||||||||||||||||||||||||||||||
| 3705 | #ifndef QT_NO_COMBOBOX | - | ||||||||||||||||||||||||||||||
| 3706 | case CE_ComboBoxLabel: never executed: case CE_ComboBoxLabel: | 0 | ||||||||||||||||||||||||||||||
| 3707 | if (!rule.hasBox())
| 0 | ||||||||||||||||||||||||||||||
| 3708 | break; never executed: break; | 0 | ||||||||||||||||||||||||||||||
| 3709 | if (const QStyleOptionComboBox *cb = qstyleoption_cast<const QStyleOptionComboBox *>(opt)) {
| 0 | ||||||||||||||||||||||||||||||
| 3710 | QRect editRect = subControlRect(CC_ComboBox, cb, SC_ComboBoxEditField, w); | - | ||||||||||||||||||||||||||||||
| 3711 | p->save(); | - | ||||||||||||||||||||||||||||||
| 3712 | p->setClipRect(editRect); | - | ||||||||||||||||||||||||||||||
| 3713 | if (!cb->currentIcon.isNull()) {
| 0 | ||||||||||||||||||||||||||||||
| 3714 | int spacing = rule.hasBox() ? rule.box()->spacing : -1;
| 0 | ||||||||||||||||||||||||||||||
| 3715 | if (spacing == -1)
| 0 | ||||||||||||||||||||||||||||||
| 3716 | spacing = 6; never executed: spacing = 6; | 0 | ||||||||||||||||||||||||||||||
| 3717 | QIcon::Mode mode = cb->state & State_Enabled ? QIcon::Normal : QIcon::Disabled;
| 0 | ||||||||||||||||||||||||||||||
| 3718 | QPixmap pixmap = cb->currentIcon.pixmap(cb->iconSize, mode); | - | ||||||||||||||||||||||||||||||
| 3719 | QRect iconRect(editRect); | - | ||||||||||||||||||||||||||||||
| 3720 | iconRect.setWidth(cb->iconSize.width()); | - | ||||||||||||||||||||||||||||||
| 3721 | iconRect = alignedRect(cb->direction, | - | ||||||||||||||||||||||||||||||
| 3722 | Qt::AlignLeft | Qt::AlignVCenter, | - | ||||||||||||||||||||||||||||||
| 3723 | iconRect.size(), editRect); | - | ||||||||||||||||||||||||||||||
| 3724 | drawItemPixmap(p, iconRect, Qt::AlignCenter, pixmap); | - | ||||||||||||||||||||||||||||||
| 3725 | - | |||||||||||||||||||||||||||||||
| 3726 | if (cb->direction == Qt::RightToLeft)
| 0 | ||||||||||||||||||||||||||||||
| 3727 | editRect.translate(-spacing - cb->iconSize.width(), 0); never executed: editRect.translate(-spacing - cb->iconSize.width(), 0); | 0 | ||||||||||||||||||||||||||||||
| 3728 | else | - | ||||||||||||||||||||||||||||||
| 3729 | editRect.translate(cb->iconSize.width() + spacing, 0); never executed: editRect.translate(cb->iconSize.width() + spacing, 0); | 0 | ||||||||||||||||||||||||||||||
| 3730 | } | - | ||||||||||||||||||||||||||||||
| 3731 | if (!cb->currentText.isEmpty() && !cb->editable) {
| 0 | ||||||||||||||||||||||||||||||
| 3732 | QPalette styledPalette(cb->palette); | - | ||||||||||||||||||||||||||||||
| 3733 | rule.configurePalette(&styledPalette, QPalette::Text, QPalette::Base); | - | ||||||||||||||||||||||||||||||
| 3734 | drawItemText(p, editRect.adjusted(0, 0, 0, 0), Qt::AlignLeft | Qt::AlignVCenter, styledPalette, | - | ||||||||||||||||||||||||||||||
| 3735 | cb->state & State_Enabled, cb->currentText, QPalette::Text); | - | ||||||||||||||||||||||||||||||
| 3736 | } never executed: end of block | 0 | ||||||||||||||||||||||||||||||
| 3737 | p->restore(); | - | ||||||||||||||||||||||||||||||
| 3738 | return; never executed: return; | 0 | ||||||||||||||||||||||||||||||
| 3739 | } | - | ||||||||||||||||||||||||||||||
| 3740 | break; never executed: break; | 0 | ||||||||||||||||||||||||||||||
| 3741 | #endif // QT_NO_COMBOBOX | - | ||||||||||||||||||||||||||||||
| 3742 | - | |||||||||||||||||||||||||||||||
| 3743 | case CE_Header: never executed: case CE_Header: | 0 | ||||||||||||||||||||||||||||||
| 3744 | if (hasStyleRule(w, PseudoElement_HeaderViewUpArrow)
| 0 | ||||||||||||||||||||||||||||||
| 3745 | || hasStyleRule(w, PseudoElement_HeaderViewDownArrow)) {
| 0 | ||||||||||||||||||||||||||||||
| 3746 | ParentStyle::drawControl(ce, opt, p, w); | - | ||||||||||||||||||||||||||||||
| 3747 | return; never executed: return; | 0 | ||||||||||||||||||||||||||||||
| 3748 | } | - | ||||||||||||||||||||||||||||||
| 3749 | if(hasStyleRule(w, PseudoElement_HeaderViewSection)) {
| 0 | ||||||||||||||||||||||||||||||
| 3750 | QRenderRule subRule = renderRule(w, opt, PseudoElement_HeaderViewSection); | - | ||||||||||||||||||||||||||||||
| 3751 | if (!subRule.hasNativeBorder() || !subRule.baseStyleCanDraw()
| 0 | ||||||||||||||||||||||||||||||
| 3752 | || subRule.hasBackground() || subRule.hasPalette()) {
| 0 | ||||||||||||||||||||||||||||||
| 3753 | ParentStyle::drawControl(ce, opt, p, w); | - | ||||||||||||||||||||||||||||||
| 3754 | return; never executed: return; | 0 | ||||||||||||||||||||||||||||||
| 3755 | } | - | ||||||||||||||||||||||||||||||
| 3756 | if (subRule.hasFont) {
| 0 | ||||||||||||||||||||||||||||||
| 3757 | const QFont oldFont = p->font(); | - | ||||||||||||||||||||||||||||||
| 3758 | p->setFont(subRule.font.resolve(p->font())); | - | ||||||||||||||||||||||||||||||
| 3759 | baseStyle()->drawControl(ce, opt, p, w); | - | ||||||||||||||||||||||||||||||
| 3760 | p->setFont(oldFont); | - | ||||||||||||||||||||||||||||||
| 3761 | return; never executed: return; | 0 | ||||||||||||||||||||||||||||||
| 3762 | } | - | ||||||||||||||||||||||||||||||
| 3763 | } never executed: end of block | 0 | ||||||||||||||||||||||||||||||
| 3764 | break; never executed: break; | 0 | ||||||||||||||||||||||||||||||
| 3765 | case CE_HeaderSection: never executed: case CE_HeaderSection: | 0 | ||||||||||||||||||||||||||||||
| 3766 | if (const QStyleOptionHeader *header = qstyleoption_cast<const QStyleOptionHeader *>(opt)) {
| 0 | ||||||||||||||||||||||||||||||
| 3767 | QRenderRule subRule = renderRule(w, opt, PseudoElement_HeaderViewSection); | - | ||||||||||||||||||||||||||||||
| 3768 | if (subRule.hasNativeBorder()) {
| 0 | ||||||||||||||||||||||||||||||
| 3769 | QStyleOptionHeader hdr(*header); | - | ||||||||||||||||||||||||||||||
| 3770 | subRule.configurePalette(&hdr.palette, QPalette::ButtonText, QPalette::Button); | - | ||||||||||||||||||||||||||||||
| 3771 | - | |||||||||||||||||||||||||||||||
| 3772 | if (subRule.baseStyleCanDraw()) {
| 0 | ||||||||||||||||||||||||||||||
| 3773 | baseStyle()->drawControl(CE_HeaderSection, &hdr, p, w); | - | ||||||||||||||||||||||||||||||
| 3774 | } else { never executed: end of block | 0 | ||||||||||||||||||||||||||||||
| 3775 | QWindowsStyle::drawControl(CE_HeaderSection, &hdr, p, w); | - | ||||||||||||||||||||||||||||||
| 3776 | } never executed: end of block | 0 | ||||||||||||||||||||||||||||||
| 3777 | } else { | - | ||||||||||||||||||||||||||||||
| 3778 | subRule.drawRule(p, opt->rect); | - | ||||||||||||||||||||||||||||||
| 3779 | } never executed: end of block | 0 | ||||||||||||||||||||||||||||||
| 3780 | return; never executed: return; | 0 | ||||||||||||||||||||||||||||||
| 3781 | } | - | ||||||||||||||||||||||||||||||
| 3782 | break; never executed: break; | 0 | ||||||||||||||||||||||||||||||
| 3783 | - | |||||||||||||||||||||||||||||||
| 3784 | case CE_HeaderLabel: never executed: case CE_HeaderLabel: | 0 | ||||||||||||||||||||||||||||||
| 3785 | if (const QStyleOptionHeader *header = qstyleoption_cast<const QStyleOptionHeader *>(opt)) {
| 0 | ||||||||||||||||||||||||||||||
| 3786 | QStyleOptionHeader hdr(*header); | - | ||||||||||||||||||||||||||||||
| 3787 | QRenderRule subRule = renderRule(w, opt, PseudoElement_HeaderViewSection); | - | ||||||||||||||||||||||||||||||
| 3788 | subRule.configurePalette(&hdr.palette, QPalette::ButtonText, QPalette::Button); | - | ||||||||||||||||||||||||||||||
| 3789 | QFont oldFont = p->font(); | - | ||||||||||||||||||||||||||||||
| 3790 | if (subRule.hasFont)
| 0 | ||||||||||||||||||||||||||||||
| 3791 | p->setFont(subRule.font.resolve(p->font())); never executed: p->setFont(subRule.font.resolve(p->font())); | 0 | ||||||||||||||||||||||||||||||
| 3792 | baseStyle()->drawControl(ce, &hdr, p, w); | - | ||||||||||||||||||||||||||||||
| 3793 | if (subRule.hasFont)
| 0 | ||||||||||||||||||||||||||||||
| 3794 | p->setFont(oldFont); never executed: p->setFont(oldFont); | 0 | ||||||||||||||||||||||||||||||
| 3795 | return; never executed: return; | 0 | ||||||||||||||||||||||||||||||
| 3796 | } | - | ||||||||||||||||||||||||||||||
| 3797 | break; never executed: break; | 0 | ||||||||||||||||||||||||||||||
| 3798 | - | |||||||||||||||||||||||||||||||
| 3799 | case CE_HeaderEmptyArea: never executed: case CE_HeaderEmptyArea: | 0 | ||||||||||||||||||||||||||||||
| 3800 | if (rule.hasDrawable()) {
| 0 | ||||||||||||||||||||||||||||||
| 3801 | return; never executed: return; | 0 | ||||||||||||||||||||||||||||||
| 3802 | } | - | ||||||||||||||||||||||||||||||
| 3803 | break; never executed: break; | 0 | ||||||||||||||||||||||||||||||
| 3804 | - | |||||||||||||||||||||||||||||||
| 3805 | case CE_ProgressBar: never executed: case CE_ProgressBar: | 0 | ||||||||||||||||||||||||||||||
| 3806 | QWindowsStyle::drawControl(ce, opt, p, w); | - | ||||||||||||||||||||||||||||||
| 3807 | return; never executed: return; | 0 | ||||||||||||||||||||||||||||||
| 3808 | - | |||||||||||||||||||||||||||||||
| 3809 | case CE_ProgressBarGroove: never executed: case CE_ProgressBarGroove: | 0 | ||||||||||||||||||||||||||||||
| 3810 | if (!rule.hasNativeBorder()) {
| 0 | ||||||||||||||||||||||||||||||
| 3811 | rule.drawRule(p, rule.boxRect(opt->rect, Margin)); | - | ||||||||||||||||||||||||||||||
| 3812 | return; never executed: return; | 0 | ||||||||||||||||||||||||||||||
| 3813 | } | - | ||||||||||||||||||||||||||||||
| 3814 | break; never executed: break; | 0 | ||||||||||||||||||||||||||||||
| 3815 | - | |||||||||||||||||||||||||||||||
| 3816 | case CE_ProgressBarContents: { never executed: case CE_ProgressBarContents: | 0 | ||||||||||||||||||||||||||||||
| 3817 | QRenderRule subRule = renderRule(w, opt, PseudoElement_ProgressBarChunk); | - | ||||||||||||||||||||||||||||||
| 3818 | if (subRule.hasDrawable()) {
| 0 | ||||||||||||||||||||||||||||||
| 3819 | if (const QStyleOptionProgressBar *pb = qstyleoption_cast<const QStyleOptionProgressBar *>(opt)) {
| 0 | ||||||||||||||||||||||||||||||
| 3820 | p->save(); | - | ||||||||||||||||||||||||||||||
| 3821 | p->setClipRect(pb->rect); | - | ||||||||||||||||||||||||||||||
| 3822 | - | |||||||||||||||||||||||||||||||
| 3823 | qint64 minimum = qint64(pb->minimum); | - | ||||||||||||||||||||||||||||||
| 3824 | qint64 maximum = qint64(pb->maximum); | - | ||||||||||||||||||||||||||||||
| 3825 | qint64 progress = qint64(pb->progress); | - | ||||||||||||||||||||||||||||||
| 3826 | bool vertical = (pb->orientation == Qt::Vertical); | - | ||||||||||||||||||||||||||||||
| 3827 | bool inverted = pb->invertedAppearance; | - | ||||||||||||||||||||||||||||||
| 3828 | - | |||||||||||||||||||||||||||||||
| 3829 | QTransform m; | - | ||||||||||||||||||||||||||||||
| 3830 | QRect rect = pb->rect; | - | ||||||||||||||||||||||||||||||
| 3831 | if (vertical) {
| 0 | ||||||||||||||||||||||||||||||
| 3832 | rect = QRect(rect.y(), rect.x(), rect.height(), rect.width()); | - | ||||||||||||||||||||||||||||||
| 3833 | m.rotate(90); | - | ||||||||||||||||||||||||||||||
| 3834 | m.translate(0, -(rect.height() + rect.y()*2)); | - | ||||||||||||||||||||||||||||||
| 3835 | } never executed: end of block | 0 | ||||||||||||||||||||||||||||||
| 3836 | - | |||||||||||||||||||||||||||||||
| 3837 | bool reverse = ((!vertical && (pb->direction == Qt::RightToLeft)) || vertical);
| 0 | ||||||||||||||||||||||||||||||
| 3838 | if (inverted)
| 0 | ||||||||||||||||||||||||||||||
| 3839 | reverse = !reverse; never executed: reverse = !reverse; | 0 | ||||||||||||||||||||||||||||||
| 3840 | const bool indeterminate = pb->minimum == pb->maximum; | - | ||||||||||||||||||||||||||||||
| 3841 | qreal fillRatio = indeterminate ? 0.50 : qreal(progress - minimum)/(maximum - minimum);
| 0 | ||||||||||||||||||||||||||||||
| 3842 | int fillWidth = int(rect.width() * fillRatio); | - | ||||||||||||||||||||||||||||||
| 3843 | int chunkWidth = fillWidth; | - | ||||||||||||||||||||||||||||||
| 3844 | if (subRule.hasContentsSize()) {
| 0 | ||||||||||||||||||||||||||||||
| 3845 | QSize sz = subRule.size(); | - | ||||||||||||||||||||||||||||||
| 3846 | chunkWidth = (opt->state & QStyle::State_Horizontal) ? sz.width() : sz.height();
| 0 | ||||||||||||||||||||||||||||||
| 3847 | } never executed: end of block | 0 | ||||||||||||||||||||||||||||||
| 3848 | - | |||||||||||||||||||||||||||||||
| 3849 | QRect r = rect; | - | ||||||||||||||||||||||||||||||
| 3850 | Q_D(const QWindowsStyle); | - | ||||||||||||||||||||||||||||||
| 3851 | if (pb->minimum == 0 && pb->maximum == 0) {
| 0 | ||||||||||||||||||||||||||||||
| 3852 | int chunkCount = fillWidth/chunkWidth; | - | ||||||||||||||||||||||||||||||
| 3853 | int offset = 0; | - | ||||||||||||||||||||||||||||||
| 3854 | if (QProgressStyleAnimation *animation = qobject_cast<QProgressStyleAnimation*>(d->animation(opt->styleObject)))
| 0 | ||||||||||||||||||||||||||||||
| 3855 | offset = animation->animationStep() * 8 % rect.width(); never executed: offset = animation->animationStep() * 8 % rect.width(); | 0 | ||||||||||||||||||||||||||||||
| 3856 | else | - | ||||||||||||||||||||||||||||||
| 3857 | d->startAnimation(new QProgressStyleAnimation(d->animationFps, opt->styleObject)); never executed: d->startAnimation(new QProgressStyleAnimation(d->animationFps, opt->styleObject)); | 0 | ||||||||||||||||||||||||||||||
| 3858 | int x = reverse ? r.left() + r.width() - offset - chunkWidth : r.x() + offset;
| 0 | ||||||||||||||||||||||||||||||
| 3859 | while (chunkCount > 0) {
| 0 | ||||||||||||||||||||||||||||||
| 3860 | r.setRect(x, rect.y(), chunkWidth, rect.height()); | - | ||||||||||||||||||||||||||||||
| 3861 | r = m.mapRect(QRectF(r)).toRect(); | - | ||||||||||||||||||||||||||||||
| 3862 | subRule.drawRule(p, r); | - | ||||||||||||||||||||||||||||||
| 3863 | x += reverse ? -chunkWidth : chunkWidth;
| 0 | ||||||||||||||||||||||||||||||
| 3864 | if (reverse ? x < rect.left() : x > rect.right())
| 0 | ||||||||||||||||||||||||||||||
| 3865 | break; never executed: break; | 0 | ||||||||||||||||||||||||||||||
| 3866 | --chunkCount; | - | ||||||||||||||||||||||||||||||
| 3867 | } never executed: end of block | 0 | ||||||||||||||||||||||||||||||
| 3868 | - | |||||||||||||||||||||||||||||||
| 3869 | r = rect; | - | ||||||||||||||||||||||||||||||
| 3870 | x = reverse ? r.right() - (r.left() - x - chunkWidth)
| 0 | ||||||||||||||||||||||||||||||
| 3871 | : r.left() + (x - r.right() - chunkWidth); | - | ||||||||||||||||||||||||||||||
| 3872 | while (chunkCount > 0) {
| 0 | ||||||||||||||||||||||||||||||
| 3873 | r.setRect(x, rect.y(), chunkWidth, rect.height()); | - | ||||||||||||||||||||||||||||||
| 3874 | r = m.mapRect(QRectF(r)).toRect(); | - | ||||||||||||||||||||||||||||||
| 3875 | subRule.drawRule(p, r); | - | ||||||||||||||||||||||||||||||
| 3876 | x += reverse ? -chunkWidth : chunkWidth;
| 0 | ||||||||||||||||||||||||||||||
| 3877 | --chunkCount; | - | ||||||||||||||||||||||||||||||
| 3878 | }; never executed: end of block | 0 | ||||||||||||||||||||||||||||||
| 3879 | } else { never executed: end of block | 0 | ||||||||||||||||||||||||||||||
| 3880 | int x = reverse ? r.left() + r.width() - chunkWidth : r.x();
| 0 | ||||||||||||||||||||||||||||||
| 3881 | - | |||||||||||||||||||||||||||||||
| 3882 | for (int i = 0; i < ceil(qreal(fillWidth)/chunkWidth); ++i) {
| 0 | ||||||||||||||||||||||||||||||
| 3883 | r.setRect(x, rect.y(), chunkWidth, rect.height()); | - | ||||||||||||||||||||||||||||||
| 3884 | r = m.mapRect(QRectF(r)).toRect(); | - | ||||||||||||||||||||||||||||||
| 3885 | subRule.drawRule(p, r); | - | ||||||||||||||||||||||||||||||
| 3886 | x += reverse ? -chunkWidth : chunkWidth;
| 0 | ||||||||||||||||||||||||||||||
| 3887 | } never executed: end of block | 0 | ||||||||||||||||||||||||||||||
| 3888 | - | |||||||||||||||||||||||||||||||
| 3889 | d->stopAnimation(opt->styleObject); | - | ||||||||||||||||||||||||||||||
| 3890 | } never executed: end of block | 0 | ||||||||||||||||||||||||||||||
| 3891 | - | |||||||||||||||||||||||||||||||
| 3892 | p->restore(); | - | ||||||||||||||||||||||||||||||
| 3893 | return; never executed: return; | 0 | ||||||||||||||||||||||||||||||
| 3894 | } | - | ||||||||||||||||||||||||||||||
| 3895 | } never executed: end of block | 0 | ||||||||||||||||||||||||||||||
| 3896 | } | - | ||||||||||||||||||||||||||||||
| 3897 | break; never executed: break; | 0 | ||||||||||||||||||||||||||||||
| 3898 | - | |||||||||||||||||||||||||||||||
| 3899 | case CE_ProgressBarLabel: never executed: case CE_ProgressBarLabel: | 0 | ||||||||||||||||||||||||||||||
| 3900 | if (const QStyleOptionProgressBar *pb = qstyleoption_cast<const QStyleOptionProgressBar *>(opt)) {
| 0 | ||||||||||||||||||||||||||||||
| 3901 | if (rule.hasBox() || rule.hasBorder() || hasStyleRule(w, PseudoElement_ProgressBarChunk)) {
| 0 | ||||||||||||||||||||||||||||||
| 3902 | drawItemText(p, pb->rect, pb->textAlignment | Qt::TextSingleLine, pb->palette, | - | ||||||||||||||||||||||||||||||
| 3903 | pb->state & State_Enabled, pb->text, QPalette::Text); | - | ||||||||||||||||||||||||||||||
| 3904 | } else { never executed: end of block | 0 | ||||||||||||||||||||||||||||||
| 3905 | QStyleOptionProgressBar pbCopy(*pb); | - | ||||||||||||||||||||||||||||||
| 3906 | rule.configurePalette(&pbCopy.palette, QPalette::HighlightedText, QPalette::Highlight); | - | ||||||||||||||||||||||||||||||
| 3907 | baseStyle()->drawControl(ce, &pbCopy, p, w); | - | ||||||||||||||||||||||||||||||
| 3908 | } never executed: end of block | 0 | ||||||||||||||||||||||||||||||
| 3909 | return; never executed: return; | 0 | ||||||||||||||||||||||||||||||
| 3910 | } | - | ||||||||||||||||||||||||||||||
| 3911 | break; never executed: break; | 0 | ||||||||||||||||||||||||||||||
| 3912 | - | |||||||||||||||||||||||||||||||
| 3913 | case CE_SizeGrip: never executed: case CE_SizeGrip: | 0 | ||||||||||||||||||||||||||||||
| 3914 | if (const QStyleOptionSizeGrip *sgOpt = qstyleoption_cast<const QStyleOptionSizeGrip *>(opt)) {
| 0 | ||||||||||||||||||||||||||||||
| 3915 | if (rule.hasDrawable()) {
| 0 | ||||||||||||||||||||||||||||||
| 3916 | rule.drawFrame(p, opt->rect); | - | ||||||||||||||||||||||||||||||
| 3917 | p->save(); | - | ||||||||||||||||||||||||||||||
| 3918 | switch (sgOpt->corner) { | - | ||||||||||||||||||||||||||||||
| 3919 | case Qt::BottomRightCorner: break; never executed: break;never executed: case Qt::BottomRightCorner: | 0 | ||||||||||||||||||||||||||||||
| 3920 | case Qt::BottomLeftCorner: p->rotate(90); break; never executed: break;never executed: case Qt::BottomLeftCorner: | 0 | ||||||||||||||||||||||||||||||
| 3921 | case Qt::TopLeftCorner: p->rotate(180); break; never executed: break;never executed: case Qt::TopLeftCorner: | 0 | ||||||||||||||||||||||||||||||
| 3922 | case Qt::TopRightCorner: p->rotate(270); break; never executed: break;never executed: case Qt::TopRightCorner: | 0 | ||||||||||||||||||||||||||||||
| 3923 | default: break; never executed: break;never executed: default: | 0 | ||||||||||||||||||||||||||||||
| 3924 | } | - | ||||||||||||||||||||||||||||||
| 3925 | rule.drawImage(p, opt->rect); | - | ||||||||||||||||||||||||||||||
| 3926 | p->restore(); | - | ||||||||||||||||||||||||||||||
| 3927 | } else { never executed: end of block | 0 | ||||||||||||||||||||||||||||||
| 3928 | QStyleOptionSizeGrip sg(*sgOpt); | - | ||||||||||||||||||||||||||||||
| 3929 | sg.rect = rule.contentsRect(opt->rect); | - | ||||||||||||||||||||||||||||||
| 3930 | baseStyle()->drawControl(CE_SizeGrip, &sg, p, w); | - | ||||||||||||||||||||||||||||||
| 3931 | } never executed: end of block | 0 | ||||||||||||||||||||||||||||||
| 3932 | return; never executed: return; | 0 | ||||||||||||||||||||||||||||||
| 3933 | } | - | ||||||||||||||||||||||||||||||
| 3934 | break; never executed: break; | 0 | ||||||||||||||||||||||||||||||
| 3935 | - | |||||||||||||||||||||||||||||||
| 3936 | case CE_ToolBoxTab: never executed: case CE_ToolBoxTab: | 0 | ||||||||||||||||||||||||||||||
| 3937 | QWindowsStyle::drawControl(ce, opt, p, w); | - | ||||||||||||||||||||||||||||||
| 3938 | return; never executed: return; | 0 | ||||||||||||||||||||||||||||||
| 3939 | - | |||||||||||||||||||||||||||||||
| 3940 | case CE_ToolBoxTabShape: { never executed: case CE_ToolBoxTabShape: | 0 | ||||||||||||||||||||||||||||||
| 3941 | QRenderRule subRule = renderRule(w, opt, PseudoElement_ToolBoxTab); | - | ||||||||||||||||||||||||||||||
| 3942 | if (subRule.hasDrawable()) {
| 0 | ||||||||||||||||||||||||||||||
| 3943 | subRule.drawRule(p, opt->rect); | - | ||||||||||||||||||||||||||||||
| 3944 | return; never executed: return; | 0 | ||||||||||||||||||||||||||||||
| 3945 | } | - | ||||||||||||||||||||||||||||||
| 3946 | } | - | ||||||||||||||||||||||||||||||
| 3947 | break; never executed: break; | 0 | ||||||||||||||||||||||||||||||
| 3948 | - | |||||||||||||||||||||||||||||||
| 3949 | case CE_ToolBoxTabLabel: never executed: case CE_ToolBoxTabLabel: | 0 | ||||||||||||||||||||||||||||||
| 3950 | if (const QStyleOptionToolBox *box = qstyleoption_cast<const QStyleOptionToolBox *>(opt)) {
| 0 | ||||||||||||||||||||||||||||||
| 3951 | QStyleOptionToolBox boxCopy(*box); | - | ||||||||||||||||||||||||||||||
| 3952 | QRenderRule subRule = renderRule(w, opt, PseudoElement_ToolBoxTab); | - | ||||||||||||||||||||||||||||||
| 3953 | subRule.configurePalette(&boxCopy.palette, QPalette::ButtonText, QPalette::Button); | - | ||||||||||||||||||||||||||||||
| 3954 | QFont oldFont = p->font(); | - | ||||||||||||||||||||||||||||||
| 3955 | if (subRule.hasFont)
| 0 | ||||||||||||||||||||||||||||||
| 3956 | p->setFont(subRule.font); never executed: p->setFont(subRule.font); | 0 | ||||||||||||||||||||||||||||||
| 3957 | boxCopy.rect = subRule.contentsRect(opt->rect); | - | ||||||||||||||||||||||||||||||
| 3958 | QWindowsStyle::drawControl(ce, &boxCopy, p , w); | - | ||||||||||||||||||||||||||||||
| 3959 | if (subRule.hasFont)
| 0 | ||||||||||||||||||||||||||||||
| 3960 | p->setFont(oldFont); never executed: p->setFont(oldFont); | 0 | ||||||||||||||||||||||||||||||
| 3961 | return; never executed: return; | 0 | ||||||||||||||||||||||||||||||
| 3962 | } | - | ||||||||||||||||||||||||||||||
| 3963 | break; never executed: break; | 0 | ||||||||||||||||||||||||||||||
| 3964 | - | |||||||||||||||||||||||||||||||
| 3965 | case CE_ScrollBarAddPage: never executed: case CE_ScrollBarAddPage: | 0 | ||||||||||||||||||||||||||||||
| 3966 | pe1 = PseudoElement_ScrollBarAddPage; | - | ||||||||||||||||||||||||||||||
| 3967 | break; never executed: break; | 0 | ||||||||||||||||||||||||||||||
| 3968 | - | |||||||||||||||||||||||||||||||
| 3969 | case CE_ScrollBarSubPage: never executed: case CE_ScrollBarSubPage: | 0 | ||||||||||||||||||||||||||||||
| 3970 | pe1 = PseudoElement_ScrollBarSubPage; | - | ||||||||||||||||||||||||||||||
| 3971 | break; never executed: break; | 0 | ||||||||||||||||||||||||||||||
| 3972 | - | |||||||||||||||||||||||||||||||
| 3973 | case CE_ScrollBarAddLine: never executed: case CE_ScrollBarAddLine: | 0 | ||||||||||||||||||||||||||||||
| 3974 | pe1 = PseudoElement_ScrollBarAddLine; | - | ||||||||||||||||||||||||||||||
| 3975 | pe2 = (opt->state & QStyle::State_Horizontal) ? PseudoElement_ScrollBarRightArrow : PseudoElement_ScrollBarDownArrow;
| 0 | ||||||||||||||||||||||||||||||
| 3976 | fallback = true; | - | ||||||||||||||||||||||||||||||
| 3977 | break; never executed: break; | 0 | ||||||||||||||||||||||||||||||
| 3978 | - | |||||||||||||||||||||||||||||||
| 3979 | case CE_ScrollBarSubLine: never executed: case CE_ScrollBarSubLine: | 0 | ||||||||||||||||||||||||||||||
| 3980 | pe1 = PseudoElement_ScrollBarSubLine; | - | ||||||||||||||||||||||||||||||
| 3981 | pe2 = (opt->state & QStyle::State_Horizontal) ? PseudoElement_ScrollBarLeftArrow : PseudoElement_ScrollBarUpArrow;
| 0 | ||||||||||||||||||||||||||||||
| 3982 | fallback = true; | - | ||||||||||||||||||||||||||||||
| 3983 | break; never executed: break; | 0 | ||||||||||||||||||||||||||||||
| 3984 | - | |||||||||||||||||||||||||||||||
| 3985 | case CE_ScrollBarFirst: never executed: case CE_ScrollBarFirst: | 0 | ||||||||||||||||||||||||||||||
| 3986 | pe1 = PseudoElement_ScrollBarFirst; | - | ||||||||||||||||||||||||||||||
| 3987 | break; never executed: break; | 0 | ||||||||||||||||||||||||||||||
| 3988 | - | |||||||||||||||||||||||||||||||
| 3989 | case CE_ScrollBarLast: never executed: case CE_ScrollBarLast: | 0 | ||||||||||||||||||||||||||||||
| 3990 | pe1 = PseudoElement_ScrollBarLast; | - | ||||||||||||||||||||||||||||||
| 3991 | break; never executed: break; | 0 | ||||||||||||||||||||||||||||||
| 3992 | - | |||||||||||||||||||||||||||||||
| 3993 | case CE_ScrollBarSlider: never executed: case CE_ScrollBarSlider: | 0 | ||||||||||||||||||||||||||||||
| 3994 | pe1 = PseudoElement_ScrollBarSlider; | - | ||||||||||||||||||||||||||||||
| 3995 | fallback = true; | - | ||||||||||||||||||||||||||||||
| 3996 | break; never executed: break; | 0 | ||||||||||||||||||||||||||||||
| 3997 | - | |||||||||||||||||||||||||||||||
| 3998 | #ifndef QT_NO_ITEMVIEWS | - | ||||||||||||||||||||||||||||||
| 3999 | case CE_ItemViewItem: never executed: case CE_ItemViewItem: | 0 | ||||||||||||||||||||||||||||||
| 4000 | if (const QStyleOptionViewItem *vopt = qstyleoption_cast<const QStyleOptionViewItem *>(opt)) {
| 0 | ||||||||||||||||||||||||||||||
| 4001 | QRenderRule subRule = renderRule(w, opt, PseudoElement_ViewItem); | - | ||||||||||||||||||||||||||||||
| 4002 | if (subRule.hasDrawable() || hasStyleRule(w, PseudoElement_Indicator)) {
| 0 | ||||||||||||||||||||||||||||||
| 4003 | QStyleOptionViewItem optCopy(*vopt); | - | ||||||||||||||||||||||||||||||
| 4004 | subRule.configurePalette(&optCopy.palette, vopt->state & QStyle::State_Selected ? QPalette::HighlightedText : QPalette::Text, | - | ||||||||||||||||||||||||||||||
| 4005 | vopt->state & QStyle::State_Selected ? QPalette::Highlight : QPalette::Base); | - | ||||||||||||||||||||||||||||||
| 4006 | QWindowsStyle::drawControl(ce, &optCopy, p, w); | - | ||||||||||||||||||||||||||||||
| 4007 | } else { never executed: end of block | 0 | ||||||||||||||||||||||||||||||
| 4008 | QStyleOptionViewItem voptCopy(*vopt); | - | ||||||||||||||||||||||||||||||
| 4009 | subRule.configurePalette(&voptCopy.palette, QPalette::Text, QPalette::NoRole); | - | ||||||||||||||||||||||||||||||
| 4010 | baseStyle()->drawControl(ce, &voptCopy, p, w); | - | ||||||||||||||||||||||||||||||
| 4011 | } never executed: end of block | 0 | ||||||||||||||||||||||||||||||
| 4012 | return; never executed: return; | 0 | ||||||||||||||||||||||||||||||
| 4013 | } | - | ||||||||||||||||||||||||||||||
| 4014 | break; never executed: break; | 0 | ||||||||||||||||||||||||||||||
| 4015 | #endif // QT_NO_ITEMVIEWS | - | ||||||||||||||||||||||||||||||
| 4016 | - | |||||||||||||||||||||||||||||||
| 4017 | #ifndef QT_NO_TABBAR | - | ||||||||||||||||||||||||||||||
| 4018 | case CE_TabBarTab: never executed: case CE_TabBarTab: | 0 | ||||||||||||||||||||||||||||||
| 4019 | if (hasStyleRule(w, PseudoElement_TabBarTab)) {
| 0 | ||||||||||||||||||||||||||||||
| 4020 | QWindowsStyle::drawControl(ce, opt, p, w); | - | ||||||||||||||||||||||||||||||
| 4021 | return; never executed: return; | 0 | ||||||||||||||||||||||||||||||
| 4022 | } | - | ||||||||||||||||||||||||||||||
| 4023 | break; never executed: break; | 0 | ||||||||||||||||||||||||||||||
| 4024 | - | |||||||||||||||||||||||||||||||
| 4025 | case CE_TabBarTabLabel: never executed: case CE_TabBarTabLabel: | 0 | ||||||||||||||||||||||||||||||
| 4026 | case CE_TabBarTabShape: never executed: case CE_TabBarTabShape: | 0 | ||||||||||||||||||||||||||||||
| 4027 | if (const QStyleOptionTab *tab = qstyleoption_cast<const QStyleOptionTab *>(opt)) {
| 0 | ||||||||||||||||||||||||||||||
| 4028 | QRenderRule subRule = renderRule(w, opt, PseudoElement_TabBarTab); | - | ||||||||||||||||||||||||||||||
| 4029 | QRect r = positionRect(w, subRule, PseudoElement_TabBarTab, opt->rect, opt->direction); | - | ||||||||||||||||||||||||||||||
| 4030 | if (ce == CE_TabBarTabShape && subRule.hasDrawable()) {
| 0 | ||||||||||||||||||||||||||||||
| 4031 | subRule.drawRule(p, r); | - | ||||||||||||||||||||||||||||||
| 4032 | return; never executed: return; | 0 | ||||||||||||||||||||||||||||||
| 4033 | } | - | ||||||||||||||||||||||||||||||
| 4034 | QStyleOptionTab tabCopy(*tab); | - | ||||||||||||||||||||||||||||||
| 4035 | subRule.configurePalette(&tabCopy.palette, QPalette::WindowText, QPalette::Window); | - | ||||||||||||||||||||||||||||||
| 4036 | QFont oldFont = p->font(); | - | ||||||||||||||||||||||||||||||
| 4037 | if (subRule.hasFont)
| 0 | ||||||||||||||||||||||||||||||
| 4038 | p->setFont(subRule.font); never executed: p->setFont(subRule.font); | 0 | ||||||||||||||||||||||||||||||
| 4039 | if (subRule.hasBox() || !subRule.hasNativeBorder()) {
| 0 | ||||||||||||||||||||||||||||||
| 4040 | tabCopy.rect = ce == CE_TabBarTabShape ? subRule.borderRect(r)
| 0 | ||||||||||||||||||||||||||||||
| 4041 | : subRule.contentsRect(r); | - | ||||||||||||||||||||||||||||||
| 4042 | QWindowsStyle::drawControl(ce, &tabCopy, p, w); | - | ||||||||||||||||||||||||||||||
| 4043 | } else { never executed: end of block | 0 | ||||||||||||||||||||||||||||||
| 4044 | baseStyle()->drawControl(ce, &tabCopy, p, w); | - | ||||||||||||||||||||||||||||||
| 4045 | } never executed: end of block | 0 | ||||||||||||||||||||||||||||||
| 4046 | if (subRule.hasFont)
| 0 | ||||||||||||||||||||||||||||||
| 4047 | p->setFont(oldFont); never executed: p->setFont(oldFont); | 0 | ||||||||||||||||||||||||||||||
| 4048 | - | |||||||||||||||||||||||||||||||
| 4049 | return; never executed: return; | 0 | ||||||||||||||||||||||||||||||
| 4050 | } | - | ||||||||||||||||||||||||||||||
| 4051 | break; never executed: break; | 0 | ||||||||||||||||||||||||||||||
| 4052 | #endif // QT_NO_TABBAR | - | ||||||||||||||||||||||||||||||
| 4053 | - | |||||||||||||||||||||||||||||||
| 4054 | case CE_ColumnViewGrip: never executed: case CE_ColumnViewGrip: | 0 | ||||||||||||||||||||||||||||||
| 4055 | if (rule.hasDrawable()) {
| 0 | ||||||||||||||||||||||||||||||
| 4056 | rule.drawRule(p, opt->rect); | - | ||||||||||||||||||||||||||||||
| 4057 | return; never executed: return; | 0 | ||||||||||||||||||||||||||||||
| 4058 | } | - | ||||||||||||||||||||||||||||||
| 4059 | break; never executed: break; | 0 | ||||||||||||||||||||||||||||||
| 4060 | - | |||||||||||||||||||||||||||||||
| 4061 | case CE_DockWidgetTitle: never executed: case CE_DockWidgetTitle: | 0 | ||||||||||||||||||||||||||||||
| 4062 | if (const QStyleOptionDockWidget *dwOpt = qstyleoption_cast<const QStyleOptionDockWidget *>(opt)) {
| 0 | ||||||||||||||||||||||||||||||
| 4063 | QRenderRule subRule = renderRule(w, opt, PseudoElement_DockWidgetTitle); | - | ||||||||||||||||||||||||||||||
| 4064 | if (!subRule.hasDrawable() && !subRule.hasPosition())
| 0 | ||||||||||||||||||||||||||||||
| 4065 | break; never executed: break; | 0 | ||||||||||||||||||||||||||||||
| 4066 | if (subRule.hasDrawable()) {
| 0 | ||||||||||||||||||||||||||||||
| 4067 | subRule.drawRule(p, opt->rect); | - | ||||||||||||||||||||||||||||||
| 4068 | } else { never executed: end of block | 0 | ||||||||||||||||||||||||||||||
| 4069 | QStyleOptionDockWidget dwCopy(*dwOpt); | - | ||||||||||||||||||||||||||||||
| 4070 | dwCopy.title = QString(); | - | ||||||||||||||||||||||||||||||
| 4071 | baseStyle()->drawControl(ce, &dwCopy, p, w); | - | ||||||||||||||||||||||||||||||
| 4072 | } never executed: end of block | 0 | ||||||||||||||||||||||||||||||
| 4073 | - | |||||||||||||||||||||||||||||||
| 4074 | if (!dwOpt->title.isEmpty()) {
| 0 | ||||||||||||||||||||||||||||||
| 4075 | QRect r = subElementRect(SE_DockWidgetTitleBarText, opt, w); | - | ||||||||||||||||||||||||||||||
| 4076 | if (dwOpt->verticalTitleBar) {
| 0 | ||||||||||||||||||||||||||||||
| 4077 | r.setSize(r.size().transposed()); | - | ||||||||||||||||||||||||||||||
| 4078 | p->save(); | - | ||||||||||||||||||||||||||||||
| 4079 | p->translate(r.left(), r.top() + r.width()); | - | ||||||||||||||||||||||||||||||
| 4080 | p->rotate(-90); | - | ||||||||||||||||||||||||||||||
| 4081 | p->translate(-r.left(), -r.top()); | - | ||||||||||||||||||||||||||||||
| 4082 | } never executed: end of block | 0 | ||||||||||||||||||||||||||||||
| 4083 | r = subRule.contentsRect(r); | - | ||||||||||||||||||||||||||||||
| 4084 | - | |||||||||||||||||||||||||||||||
| 4085 | Qt::Alignment alignment = 0; | - | ||||||||||||||||||||||||||||||
| 4086 | if (subRule.hasPosition())
| 0 | ||||||||||||||||||||||||||||||
| 4087 | alignment = subRule.position()->textAlignment; never executed: alignment = subRule.position()->textAlignment; | 0 | ||||||||||||||||||||||||||||||
| 4088 | if (alignment == 0)
| 0 | ||||||||||||||||||||||||||||||
| 4089 | alignment = Qt::AlignLeft; never executed: alignment = Qt::AlignLeft; | 0 | ||||||||||||||||||||||||||||||
| 4090 | - | |||||||||||||||||||||||||||||||
| 4091 | QString titleText = p->fontMetrics().elidedText(dwOpt->title, Qt::ElideRight, r.width()); | - | ||||||||||||||||||||||||||||||
| 4092 | drawItemText(p, r, | - | ||||||||||||||||||||||||||||||
| 4093 | alignment | Qt::TextShowMnemonic, dwOpt->palette, | - | ||||||||||||||||||||||||||||||
| 4094 | dwOpt->state & State_Enabled, titleText, | - | ||||||||||||||||||||||||||||||
| 4095 | QPalette::WindowText); | - | ||||||||||||||||||||||||||||||
| 4096 | - | |||||||||||||||||||||||||||||||
| 4097 | if (dwOpt->verticalTitleBar)
| 0 | ||||||||||||||||||||||||||||||
| 4098 | p->restore(); never executed: p->restore(); | 0 | ||||||||||||||||||||||||||||||
| 4099 | } never executed: end of block | 0 | ||||||||||||||||||||||||||||||
| 4100 | - | |||||||||||||||||||||||||||||||
| 4101 | return; never executed: return; | 0 | ||||||||||||||||||||||||||||||
| 4102 | } | - | ||||||||||||||||||||||||||||||
| 4103 | break; never executed: break; | 0 | ||||||||||||||||||||||||||||||
| 4104 | case CE_ShapedFrame: never executed: case CE_ShapedFrame: | 0 | ||||||||||||||||||||||||||||||
| 4105 | if (const QStyleOptionFrame *frm = qstyleoption_cast<const QStyleOptionFrame *>(opt)) {
| 0 | ||||||||||||||||||||||||||||||
| 4106 | if (rule.hasNativeBorder()) {
| 0 | ||||||||||||||||||||||||||||||
| 4107 | QStyleOptionFrame frmOpt(*frm); | - | ||||||||||||||||||||||||||||||
| 4108 | rule.configurePalette(&frmOpt.palette, QPalette::Text, QPalette::Base); | - | ||||||||||||||||||||||||||||||
| 4109 | frmOpt.rect = rule.borderRect(frmOpt.rect); | - | ||||||||||||||||||||||||||||||
| 4110 | baseStyle()->drawControl(ce, &frmOpt, p, w); | - | ||||||||||||||||||||||||||||||
| 4111 | } never executed: end of block | 0 | ||||||||||||||||||||||||||||||
| 4112 | // else, borders are already drawn in PE_Widget | - | ||||||||||||||||||||||||||||||
| 4113 | } never executed: end of block | 0 | ||||||||||||||||||||||||||||||
| 4114 | return; never executed: return; | 0 | ||||||||||||||||||||||||||||||
| 4115 | - | |||||||||||||||||||||||||||||||
| 4116 | - | |||||||||||||||||||||||||||||||
| 4117 | default: never executed: default: | 0 | ||||||||||||||||||||||||||||||
| 4118 | break; never executed: break; | 0 | ||||||||||||||||||||||||||||||
| 4119 | } | - | ||||||||||||||||||||||||||||||
| 4120 | - | |||||||||||||||||||||||||||||||
| 4121 | if (pe1 != PseudoElement_None) {
| 0 | ||||||||||||||||||||||||||||||
| 4122 | QRenderRule subRule = renderRule(w, opt, pe1); | - | ||||||||||||||||||||||||||||||
| 4123 | if (subRule.bg != 0 || subRule.hasDrawable()) {
| 0 | ||||||||||||||||||||||||||||||
| 4124 | //We test subRule.bg directly because hasBackground() would return false for background:none. | - | ||||||||||||||||||||||||||||||
| 4125 | //But we still don't want the default drawning in that case (example for QScrollBar::add-page) (task 198926) | - | ||||||||||||||||||||||||||||||
| 4126 | subRule.drawRule(p, opt->rect); | - | ||||||||||||||||||||||||||||||
| 4127 | } else if (fallback) { never executed: end of block
| 0 | ||||||||||||||||||||||||||||||
| 4128 | QWindowsStyle::drawControl(ce, opt, p, w); | - | ||||||||||||||||||||||||||||||
| 4129 | pe2 = PseudoElement_None; | - | ||||||||||||||||||||||||||||||
| 4130 | } else { never executed: end of block | 0 | ||||||||||||||||||||||||||||||
| 4131 | baseStyle()->drawControl(ce, opt, p, w); | - | ||||||||||||||||||||||||||||||
| 4132 | } never executed: end of block | 0 | ||||||||||||||||||||||||||||||
| 4133 | if (pe2 != PseudoElement_None) {
| 0 | ||||||||||||||||||||||||||||||
| 4134 | QRenderRule subSubRule = renderRule(w, opt, pe2); | - | ||||||||||||||||||||||||||||||
| 4135 | QRect r = positionRect(w, subRule, subSubRule, pe2, opt->rect, opt->direction); | - | ||||||||||||||||||||||||||||||
| 4136 | subSubRule.drawRule(p, r); | - | ||||||||||||||||||||||||||||||
| 4137 | } never executed: end of block | 0 | ||||||||||||||||||||||||||||||
| 4138 | return; never executed: return; | 0 | ||||||||||||||||||||||||||||||
| 4139 | } | - | ||||||||||||||||||||||||||||||
| 4140 | - | |||||||||||||||||||||||||||||||
| 4141 | baseStyle()->drawControl(ce, opt, p, w); | - | ||||||||||||||||||||||||||||||
| 4142 | } never executed: end of block | 0 | ||||||||||||||||||||||||||||||
| 4143 | - | |||||||||||||||||||||||||||||||
| 4144 | void QStyleSheetStyle::drawItemPixmap(QPainter *p, const QRect &rect, int alignment, const | - | ||||||||||||||||||||||||||||||
| 4145 | QPixmap &pixmap) const | - | ||||||||||||||||||||||||||||||
| 4146 | { | - | ||||||||||||||||||||||||||||||
| 4147 | baseStyle()->drawItemPixmap(p, rect, alignment, pixmap); | - | ||||||||||||||||||||||||||||||
| 4148 | } never executed: end of block | 0 | ||||||||||||||||||||||||||||||
| 4149 | - | |||||||||||||||||||||||||||||||
| 4150 | void QStyleSheetStyle::drawItemText(QPainter *painter, const QRect& rect, int alignment, const QPalette &pal, | - | ||||||||||||||||||||||||||||||
| 4151 | bool enabled, const QString& text, QPalette::ColorRole textRole) const | - | ||||||||||||||||||||||||||||||
| 4152 | { | - | ||||||||||||||||||||||||||||||
| 4153 | baseStyle()->drawItemText(painter, rect, alignment, pal, enabled, text, textRole); | - | ||||||||||||||||||||||||||||||
| 4154 | } never executed: end of block | 0 | ||||||||||||||||||||||||||||||
| 4155 | - | |||||||||||||||||||||||||||||||
| 4156 | void QStyleSheetStyle::drawPrimitive(PrimitiveElement pe, const QStyleOption *opt, QPainter *p, | - | ||||||||||||||||||||||||||||||
| 4157 | const QWidget *w) const | - | ||||||||||||||||||||||||||||||
| 4158 | { | - | ||||||||||||||||||||||||||||||
| 4159 | RECURSION_GUARD(baseStyle()->drawPrimitive(pe, opt, p, w); return) never executed: return;
| 0 | ||||||||||||||||||||||||||||||
| 4160 | - | |||||||||||||||||||||||||||||||
| 4161 | int pseudoElement = PseudoElement_None; | - | ||||||||||||||||||||||||||||||
| 4162 | QRenderRule rule = renderRule(w, opt); | - | ||||||||||||||||||||||||||||||
| 4163 | QRect rect = opt->rect; | - | ||||||||||||||||||||||||||||||
| 4164 | - | |||||||||||||||||||||||||||||||
| 4165 | switch (pe) { | - | ||||||||||||||||||||||||||||||
| 4166 | - | |||||||||||||||||||||||||||||||
| 4167 | case PE_FrameStatusBar: { never executed: case PE_FrameStatusBar: | 0 | ||||||||||||||||||||||||||||||
| 4168 | QRenderRule subRule = renderRule(w ? w->parentWidget() : Q_NULLPTR, opt, PseudoElement_Item); | - | ||||||||||||||||||||||||||||||
| 4169 | if (subRule.hasDrawable()) {
| 0 | ||||||||||||||||||||||||||||||
| 4170 | subRule.drawRule(p, opt->rect); | - | ||||||||||||||||||||||||||||||
| 4171 | return; never executed: return; | 0 | ||||||||||||||||||||||||||||||
| 4172 | } | - | ||||||||||||||||||||||||||||||
| 4173 | break; never executed: break; | 0 | ||||||||||||||||||||||||||||||
| 4174 | } | - | ||||||||||||||||||||||||||||||
| 4175 | - | |||||||||||||||||||||||||||||||
| 4176 | case PE_IndicatorArrowDown: never executed: case PE_IndicatorArrowDown: | 0 | ||||||||||||||||||||||||||||||
| 4177 | pseudoElement = PseudoElement_DownArrow; | - | ||||||||||||||||||||||||||||||
| 4178 | break; never executed: break; | 0 | ||||||||||||||||||||||||||||||
| 4179 | - | |||||||||||||||||||||||||||||||
| 4180 | case PE_IndicatorArrowUp: never executed: case PE_IndicatorArrowUp: | 0 | ||||||||||||||||||||||||||||||
| 4181 | pseudoElement = PseudoElement_UpArrow; | - | ||||||||||||||||||||||||||||||
| 4182 | break; never executed: break; | 0 | ||||||||||||||||||||||||||||||
| 4183 | - | |||||||||||||||||||||||||||||||
| 4184 | case PE_IndicatorRadioButton: never executed: case PE_IndicatorRadioButton: | 0 | ||||||||||||||||||||||||||||||
| 4185 | pseudoElement = PseudoElement_ExclusiveIndicator; | - | ||||||||||||||||||||||||||||||
| 4186 | break; never executed: break; | 0 | ||||||||||||||||||||||||||||||
| 4187 | - | |||||||||||||||||||||||||||||||
| 4188 | case PE_IndicatorViewItemCheck: never executed: case PE_IndicatorViewItemCheck: | 0 | ||||||||||||||||||||||||||||||
| 4189 | pseudoElement = PseudoElement_ViewItemIndicator; | - | ||||||||||||||||||||||||||||||
| 4190 | break; never executed: break; | 0 | ||||||||||||||||||||||||||||||
| 4191 | - | |||||||||||||||||||||||||||||||
| 4192 | case PE_IndicatorCheckBox: never executed: case PE_IndicatorCheckBox: | 0 | ||||||||||||||||||||||||||||||
| 4193 | pseudoElement = PseudoElement_Indicator; | - | ||||||||||||||||||||||||||||||
| 4194 | break; never executed: break; | 0 | ||||||||||||||||||||||||||||||
| 4195 | - | |||||||||||||||||||||||||||||||
| 4196 | case PE_IndicatorHeaderArrow: never executed: case PE_IndicatorHeaderArrow: | 0 | ||||||||||||||||||||||||||||||
| 4197 | if (const QStyleOptionHeader *hdr = qstyleoption_cast<const QStyleOptionHeader *>(opt)) {
| 0 | ||||||||||||||||||||||||||||||
| 4198 | pseudoElement = hdr->sortIndicator == QStyleOptionHeader::SortUp
| 0 | ||||||||||||||||||||||||||||||
| 4199 | ? PseudoElement_HeaderViewUpArrow | - | ||||||||||||||||||||||||||||||
| 4200 | : PseudoElement_HeaderViewDownArrow; | - | ||||||||||||||||||||||||||||||
| 4201 | } never executed: end of block | 0 | ||||||||||||||||||||||||||||||
| 4202 | break; never executed: break; | 0 | ||||||||||||||||||||||||||||||
| 4203 | - | |||||||||||||||||||||||||||||||
| 4204 | case PE_PanelButtonTool: never executed: case PE_PanelButtonTool: | 0 | ||||||||||||||||||||||||||||||
| 4205 | case PE_PanelButtonCommand: never executed: case PE_PanelButtonCommand: | 0 | ||||||||||||||||||||||||||||||
| 4206 | if (qobject_cast<const QAbstractButton *>(w) && rule.hasBackground() && rule.hasNativeBorder()) {
| 0 | ||||||||||||||||||||||||||||||
| 4207 | //the window style will draw the borders | - | ||||||||||||||||||||||||||||||
| 4208 | ParentStyle::drawPrimitive(pe, opt, p, w); | - | ||||||||||||||||||||||||||||||
| 4209 | if (!rule.background()->pixmap.isNull() || rule.hasImage()) {
| 0 | ||||||||||||||||||||||||||||||
| 4210 | rule.drawRule(p, rule.boxRect(opt->rect, QRenderRule::Margin).adjusted(1,1,-1,-1)); | - | ||||||||||||||||||||||||||||||
| 4211 | } never executed: end of block | 0 | ||||||||||||||||||||||||||||||
| 4212 | return; never executed: return; | 0 | ||||||||||||||||||||||||||||||
| 4213 | } | - | ||||||||||||||||||||||||||||||
| 4214 | if (!rule.hasNativeBorder()) {
| 0 | ||||||||||||||||||||||||||||||
| 4215 | rule.drawRule(p, rule.boxRect(opt->rect, QRenderRule::Margin)); | - | ||||||||||||||||||||||||||||||
| 4216 | return; never executed: return; | 0 | ||||||||||||||||||||||||||||||
| 4217 | } | - | ||||||||||||||||||||||||||||||
| 4218 | break; never executed: break; | 0 | ||||||||||||||||||||||||||||||
| 4219 | - | |||||||||||||||||||||||||||||||
| 4220 | case PE_IndicatorButtonDropDown: { never executed: case PE_IndicatorButtonDropDown: | 0 | ||||||||||||||||||||||||||||||
| 4221 | QRenderRule subRule = renderRule(w, opt, PseudoElement_ToolButtonMenu); | - | ||||||||||||||||||||||||||||||
| 4222 | if (!subRule.hasNativeBorder()) {
| 0 | ||||||||||||||||||||||||||||||
| 4223 | rule.drawBorder(p, opt->rect); | - | ||||||||||||||||||||||||||||||
| 4224 | return; never executed: return; | 0 | ||||||||||||||||||||||||||||||
| 4225 | } | - | ||||||||||||||||||||||||||||||
| 4226 | break; never executed: break; | 0 | ||||||||||||||||||||||||||||||
| 4227 | } | - | ||||||||||||||||||||||||||||||
| 4228 | - | |||||||||||||||||||||||||||||||
| 4229 | case PE_FrameDefaultButton: never executed: case PE_FrameDefaultButton: | 0 | ||||||||||||||||||||||||||||||
| 4230 | if (rule.hasNativeBorder()) {
| 0 | ||||||||||||||||||||||||||||||
| 4231 | if (rule.baseStyleCanDraw())
| 0 | ||||||||||||||||||||||||||||||
| 4232 | break; never executed: break; | 0 | ||||||||||||||||||||||||||||||
| 4233 | QWindowsStyle::drawPrimitive(pe, opt, p, w); | - | ||||||||||||||||||||||||||||||
| 4234 | } never executed: end of block | 0 | ||||||||||||||||||||||||||||||
| 4235 | return; never executed: return; | 0 | ||||||||||||||||||||||||||||||
| 4236 | - | |||||||||||||||||||||||||||||||
| 4237 | case PE_FrameWindow: never executed: case PE_FrameWindow: | 0 | ||||||||||||||||||||||||||||||
| 4238 | case PE_FrameDockWidget: never executed: case PE_FrameDockWidget: | 0 | ||||||||||||||||||||||||||||||
| 4239 | case PE_Frame: never executed: case PE_Frame: | 0 | ||||||||||||||||||||||||||||||
| 4240 | if (const QStyleOptionFrame *frm = qstyleoption_cast<const QStyleOptionFrame *>(opt)) {
| 0 | ||||||||||||||||||||||||||||||
| 4241 | if (rule.hasNativeBorder()) {
| 0 | ||||||||||||||||||||||||||||||
| 4242 | QStyleOptionFrame frmOpt(*frm); | - | ||||||||||||||||||||||||||||||
| 4243 | rule.configurePalette(&frmOpt.palette, QPalette::Text, QPalette::Base); | - | ||||||||||||||||||||||||||||||
| 4244 | baseStyle()->drawPrimitive(pe, &frmOpt, p, w); | - | ||||||||||||||||||||||||||||||
| 4245 | } else { never executed: end of block | 0 | ||||||||||||||||||||||||||||||
| 4246 | rule.drawBorder(p, rule.borderRect(opt->rect)); | - | ||||||||||||||||||||||||||||||
| 4247 | } never executed: end of block | 0 | ||||||||||||||||||||||||||||||
| 4248 | } | - | ||||||||||||||||||||||||||||||
| 4249 | return; never executed: return; | 0 | ||||||||||||||||||||||||||||||
| 4250 | - | |||||||||||||||||||||||||||||||
| 4251 | case PE_PanelLineEdit: never executed: case PE_PanelLineEdit: | 0 | ||||||||||||||||||||||||||||||
| 4252 | if (const QStyleOptionFrame *frm = qstyleoption_cast<const QStyleOptionFrame *>(opt)) {
| 0 | ||||||||||||||||||||||||||||||
| 4253 | #ifndef QT_NO_SPINBOX | - | ||||||||||||||||||||||||||||||
| 4254 | if (w && qobject_cast<const QAbstractSpinBox *>(w->parentWidget())) {
| 0 | ||||||||||||||||||||||||||||||
| 4255 | QRenderRule spinboxRule = renderRule(w->parentWidget(), opt); | - | ||||||||||||||||||||||||||||||
| 4256 | if (!spinboxRule.hasNativeBorder() || !spinboxRule.baseStyleCanDraw())
| 0 | ||||||||||||||||||||||||||||||
| 4257 | return; never executed: return; | 0 | ||||||||||||||||||||||||||||||
| 4258 | rule = spinboxRule; | - | ||||||||||||||||||||||||||||||
| 4259 | } never executed: end of block | 0 | ||||||||||||||||||||||||||||||
| 4260 | #endif | - | ||||||||||||||||||||||||||||||
| 4261 | if (rule.hasNativeBorder()) {
| 0 | ||||||||||||||||||||||||||||||
| 4262 | QStyleOptionFrame frmOpt(*frm); | - | ||||||||||||||||||||||||||||||
| 4263 | rule.configurePalette(&frmOpt.palette, QPalette::Text, QPalette::Base); | - | ||||||||||||||||||||||||||||||
| 4264 | frmOpt.rect = rule.borderRect(frmOpt.rect); | - | ||||||||||||||||||||||||||||||
| 4265 | if (rule.baseStyleCanDraw()) {
| 0 | ||||||||||||||||||||||||||||||
| 4266 | rule.drawBackgroundImage(p, opt->rect); | - | ||||||||||||||||||||||||||||||
| 4267 | baseStyle()->drawPrimitive(pe, &frmOpt, p, w); | - | ||||||||||||||||||||||||||||||
| 4268 | } else { never executed: end of block | 0 | ||||||||||||||||||||||||||||||
| 4269 | rule.drawBackground(p, opt->rect); | - | ||||||||||||||||||||||||||||||
| 4270 | if (frmOpt.lineWidth > 0)
| 0 | ||||||||||||||||||||||||||||||
| 4271 | baseStyle()->drawPrimitive(PE_FrameLineEdit, &frmOpt, p, w); never executed: baseStyle()->drawPrimitive(PE_FrameLineEdit, &frmOpt, p, w); | 0 | ||||||||||||||||||||||||||||||
| 4272 | } never executed: end of block | 0 | ||||||||||||||||||||||||||||||
| 4273 | } else { | - | ||||||||||||||||||||||||||||||
| 4274 | rule.drawRule(p, opt->rect); | - | ||||||||||||||||||||||||||||||
| 4275 | } never executed: end of block | 0 | ||||||||||||||||||||||||||||||
| 4276 | } | - | ||||||||||||||||||||||||||||||
| 4277 | return; never executed: return; | 0 | ||||||||||||||||||||||||||||||
| 4278 | - | |||||||||||||||||||||||||||||||
| 4279 | case PE_Widget: never executed: case PE_Widget: | 0 | ||||||||||||||||||||||||||||||
| 4280 | if (w && !rule.hasDrawable()) {
| 0 | ||||||||||||||||||||||||||||||
| 4281 | QWidget *container = containerWidget(w); | - | ||||||||||||||||||||||||||||||
| 4282 | if (styleSheetCaches->autoFillDisabledWidgets.contains(container)
| 0 | ||||||||||||||||||||||||||||||
| 4283 | && (container == w || !renderRule(container, opt).hasBackground())) {
| 0 | ||||||||||||||||||||||||||||||
| 4284 | //we do not have a background, but we disabled the autofillbackground anyway. so fill the background now. | - | ||||||||||||||||||||||||||||||
| 4285 | // (this may happen if we have rules like :focus) | - | ||||||||||||||||||||||||||||||
| 4286 | p->fillRect(opt->rect, opt->palette.brush(w->backgroundRole())); | - | ||||||||||||||||||||||||||||||
| 4287 | } never executed: end of block | 0 | ||||||||||||||||||||||||||||||
| 4288 | break; never executed: break; | 0 | ||||||||||||||||||||||||||||||
| 4289 | } | - | ||||||||||||||||||||||||||||||
| 4290 | #ifndef QT_NO_SCROLLAREA | - | ||||||||||||||||||||||||||||||
| 4291 | if (const QAbstractScrollArea *sa = qobject_cast<const QAbstractScrollArea *>(w)) {
| 0 | ||||||||||||||||||||||||||||||
| 4292 | const QAbstractScrollAreaPrivate *sap = sa->d_func(); | - | ||||||||||||||||||||||||||||||
| 4293 | rule.drawBackground(p, opt->rect, sap->contentsOffset()); | - | ||||||||||||||||||||||||||||||
| 4294 | if (rule.hasBorder()) {
| 0 | ||||||||||||||||||||||||||||||
| 4295 | QRect brect = rule.borderRect(opt->rect); | - | ||||||||||||||||||||||||||||||
| 4296 | if (styleHint(QStyle::SH_ScrollView_FrameOnlyAroundContents, opt, w)) {
| 0 | ||||||||||||||||||||||||||||||
| 4297 | QRect r = brect.adjusted(0, 0, sa->verticalScrollBar()->isVisible() ? -sa->verticalScrollBar()->width() : 0, | - | ||||||||||||||||||||||||||||||
| 4298 | sa->horizontalScrollBar()->isVisible() ? -sa->horizontalScrollBar()->height() : 0); | - | ||||||||||||||||||||||||||||||
| 4299 | brect = QStyle::visualRect(opt->direction, brect, r); | - | ||||||||||||||||||||||||||||||
| 4300 | } never executed: end of block | 0 | ||||||||||||||||||||||||||||||
| 4301 | rule.drawBorder(p, brect); | - | ||||||||||||||||||||||||||||||
| 4302 | } never executed: end of block | 0 | ||||||||||||||||||||||||||||||
| 4303 | break; never executed: break; | 0 | ||||||||||||||||||||||||||||||
| 4304 | } | - | ||||||||||||||||||||||||||||||
| 4305 | #endif | - | ||||||||||||||||||||||||||||||
| 4306 | //fall tghought | - | ||||||||||||||||||||||||||||||
| 4307 | case PE_PanelMenu: code before this statement never executed: case PE_PanelMenu:never executed: case PE_PanelMenu: | 0 | ||||||||||||||||||||||||||||||
| 4308 | case PE_PanelStatusBar: never executed: case PE_PanelStatusBar: | 0 | ||||||||||||||||||||||||||||||
| 4309 | if(rule.hasDrawable()) {
| 0 | ||||||||||||||||||||||||||||||
| 4310 | rule.drawRule(p, opt->rect); | - | ||||||||||||||||||||||||||||||
| 4311 | return; never executed: return; | 0 | ||||||||||||||||||||||||||||||
| 4312 | } | - | ||||||||||||||||||||||||||||||
| 4313 | break; never executed: break; | 0 | ||||||||||||||||||||||||||||||
| 4314 | - | |||||||||||||||||||||||||||||||
| 4315 | case PE_FrameMenu: never executed: case PE_FrameMenu: | 0 | ||||||||||||||||||||||||||||||
| 4316 | if (rule.hasDrawable()) {
| 0 | ||||||||||||||||||||||||||||||
| 4317 | // Drawn by PE_PanelMenu | - | ||||||||||||||||||||||||||||||
| 4318 | return; never executed: return; | 0 | ||||||||||||||||||||||||||||||
| 4319 | } | - | ||||||||||||||||||||||||||||||
| 4320 | break; never executed: break; | 0 | ||||||||||||||||||||||||||||||
| 4321 | - | |||||||||||||||||||||||||||||||
| 4322 | case PE_PanelMenuBar: never executed: case PE_PanelMenuBar: | 0 | ||||||||||||||||||||||||||||||
| 4323 | if (rule.hasDrawable()) {
| 0 | ||||||||||||||||||||||||||||||
| 4324 | // Drawn by PE_Widget | - | ||||||||||||||||||||||||||||||
| 4325 | return; never executed: return; | 0 | ||||||||||||||||||||||||||||||
| 4326 | } | - | ||||||||||||||||||||||||||||||
| 4327 | break; never executed: break; | 0 | ||||||||||||||||||||||||||||||
| 4328 | - | |||||||||||||||||||||||||||||||
| 4329 | case PE_IndicatorToolBarSeparator: never executed: case PE_IndicatorToolBarSeparator: | 0 | ||||||||||||||||||||||||||||||
| 4330 | case PE_IndicatorToolBarHandle: { never executed: case PE_IndicatorToolBarHandle: | 0 | ||||||||||||||||||||||||||||||
| 4331 | PseudoElement ps = pe == PE_IndicatorToolBarHandle ? PseudoElement_ToolBarHandle : PseudoElement_ToolBarSeparator;
| 0 | ||||||||||||||||||||||||||||||
| 4332 | QRenderRule subRule = renderRule(w, opt, ps); | - | ||||||||||||||||||||||||||||||
| 4333 | if (subRule.hasDrawable()) {
| 0 | ||||||||||||||||||||||||||||||
| 4334 | subRule.drawRule(p, opt->rect); | - | ||||||||||||||||||||||||||||||
| 4335 | return; never executed: return; | 0 | ||||||||||||||||||||||||||||||
| 4336 | } | - | ||||||||||||||||||||||||||||||
| 4337 | } | - | ||||||||||||||||||||||||||||||
| 4338 | break; never executed: break; | 0 | ||||||||||||||||||||||||||||||
| 4339 | - | |||||||||||||||||||||||||||||||
| 4340 | case PE_IndicatorMenuCheckMark: never executed: case PE_IndicatorMenuCheckMark: | 0 | ||||||||||||||||||||||||||||||
| 4341 | pseudoElement = PseudoElement_MenuCheckMark; | - | ||||||||||||||||||||||||||||||
| 4342 | break; never executed: break; | 0 | ||||||||||||||||||||||||||||||
| 4343 | - | |||||||||||||||||||||||||||||||
| 4344 | case PE_IndicatorArrowLeft: never executed: case PE_IndicatorArrowLeft: | 0 | ||||||||||||||||||||||||||||||
| 4345 | pseudoElement = PseudoElement_LeftArrow; | - | ||||||||||||||||||||||||||||||
| 4346 | break; never executed: break; | 0 | ||||||||||||||||||||||||||||||
| 4347 | - | |||||||||||||||||||||||||||||||
| 4348 | case PE_IndicatorArrowRight: never executed: case PE_IndicatorArrowRight: | 0 | ||||||||||||||||||||||||||||||
| 4349 | pseudoElement = PseudoElement_RightArrow; | - | ||||||||||||||||||||||||||||||
| 4350 | break; never executed: break; | 0 | ||||||||||||||||||||||||||||||
| 4351 | - | |||||||||||||||||||||||||||||||
| 4352 | case PE_IndicatorColumnViewArrow: never executed: case PE_IndicatorColumnViewArrow: | 0 | ||||||||||||||||||||||||||||||
| 4353 | if (const QStyleOptionViewItem *viewOpt = qstyleoption_cast<const QStyleOptionViewItem *>(opt)) {
| 0 | ||||||||||||||||||||||||||||||
| 4354 | bool reverse = (viewOpt->direction == Qt::RightToLeft); | - | ||||||||||||||||||||||||||||||
| 4355 | pseudoElement = reverse ? PseudoElement_LeftArrow : PseudoElement_RightArrow;
| 0 | ||||||||||||||||||||||||||||||
| 4356 | } else { never executed: end of block | 0 | ||||||||||||||||||||||||||||||
| 4357 | pseudoElement = PseudoElement_RightArrow; | - | ||||||||||||||||||||||||||||||
| 4358 | } never executed: end of block | 0 | ||||||||||||||||||||||||||||||
| 4359 | break; never executed: break; | 0 | ||||||||||||||||||||||||||||||
| 4360 | - | |||||||||||||||||||||||||||||||
| 4361 | case PE_IndicatorBranch: never executed: case PE_IndicatorBranch: | 0 | ||||||||||||||||||||||||||||||
| 4362 | if (const QStyleOptionViewItem *vopt = qstyleoption_cast<const QStyleOptionViewItem *>(opt)) {
| 0 | ||||||||||||||||||||||||||||||
| 4363 | QRenderRule subRule = renderRule(w, opt, PseudoElement_TreeViewBranch); | - | ||||||||||||||||||||||||||||||
| 4364 | if (subRule.hasDrawable()) {
| 0 | ||||||||||||||||||||||||||||||
| 4365 | if ((vopt->state & QStyle::State_Selected) && vopt->showDecorationSelected)
| 0 | ||||||||||||||||||||||||||||||
| 4366 | p->fillRect(vopt->rect, vopt->palette.highlight()); never executed: p->fillRect(vopt->rect, vopt->palette.highlight()); | 0 | ||||||||||||||||||||||||||||||
| 4367 | else if (vopt->features & QStyleOptionViewItem::Alternate)
| 0 | ||||||||||||||||||||||||||||||
| 4368 | p->fillRect(vopt->rect, vopt->palette.alternateBase()); never executed: p->fillRect(vopt->rect, vopt->palette.alternateBase()); | 0 | ||||||||||||||||||||||||||||||
| 4369 | subRule.drawRule(p, opt->rect); | - | ||||||||||||||||||||||||||||||
| 4370 | } else { never executed: end of block | 0 | ||||||||||||||||||||||||||||||
| 4371 | baseStyle()->drawPrimitive(pe, vopt, p, w); | - | ||||||||||||||||||||||||||||||
| 4372 | } never executed: end of block | 0 | ||||||||||||||||||||||||||||||
| 4373 | } | - | ||||||||||||||||||||||||||||||
| 4374 | return; never executed: return; | 0 | ||||||||||||||||||||||||||||||
| 4375 | - | |||||||||||||||||||||||||||||||
| 4376 | case PE_PanelTipLabel: never executed: case PE_PanelTipLabel: | 0 | ||||||||||||||||||||||||||||||
| 4377 | if (!rule.hasDrawable())
| 0 | ||||||||||||||||||||||||||||||
| 4378 | break; never executed: break; | 0 | ||||||||||||||||||||||||||||||
| 4379 | - | |||||||||||||||||||||||||||||||
| 4380 | if (const QStyleOptionFrame *frmOpt = qstyleoption_cast<const QStyleOptionFrame *>(opt)) {
| 0 | ||||||||||||||||||||||||||||||
| 4381 | if (rule.hasNativeBorder()) {
| 0 | ||||||||||||||||||||||||||||||
| 4382 | rule.drawBackground(p, opt->rect); | - | ||||||||||||||||||||||||||||||
| 4383 | QStyleOptionFrame optCopy(*frmOpt); | - | ||||||||||||||||||||||||||||||
| 4384 | optCopy.rect = rule.borderRect(opt->rect); | - | ||||||||||||||||||||||||||||||
| 4385 | optCopy.palette.setBrush(QPalette::Window, Qt::NoBrush); // oh dear | - | ||||||||||||||||||||||||||||||
| 4386 | baseStyle()->drawPrimitive(pe, &optCopy, p, w); | - | ||||||||||||||||||||||||||||||
| 4387 | } else { never executed: end of block | 0 | ||||||||||||||||||||||||||||||
| 4388 | rule.drawRule(p, opt->rect); | - | ||||||||||||||||||||||||||||||
| 4389 | } never executed: end of block | 0 | ||||||||||||||||||||||||||||||
| 4390 | } | - | ||||||||||||||||||||||||||||||
| 4391 | return; never executed: return; | 0 | ||||||||||||||||||||||||||||||
| 4392 | - | |||||||||||||||||||||||||||||||
| 4393 | case PE_FrameGroupBox: never executed: case PE_FrameGroupBox: | 0 | ||||||||||||||||||||||||||||||
| 4394 | if (rule.hasNativeBorder())
| 0 | ||||||||||||||||||||||||||||||
| 4395 | break; never executed: break; | 0 | ||||||||||||||||||||||||||||||
| 4396 | rule.drawBorder(p, opt->rect); | - | ||||||||||||||||||||||||||||||
| 4397 | return; never executed: return; | 0 | ||||||||||||||||||||||||||||||
| 4398 | - | |||||||||||||||||||||||||||||||
| 4399 | #ifndef QT_NO_TABWIDGET | - | ||||||||||||||||||||||||||||||
| 4400 | case PE_FrameTabWidget: never executed: case PE_FrameTabWidget: | 0 | ||||||||||||||||||||||||||||||
| 4401 | if (const QStyleOptionTabWidgetFrame *frm = qstyleoption_cast<const QStyleOptionTabWidgetFrame *>(opt)) {
| 0 | ||||||||||||||||||||||||||||||
| 4402 | QRenderRule subRule = renderRule(w, opt, PseudoElement_TabWidgetPane); | - | ||||||||||||||||||||||||||||||
| 4403 | if (subRule.hasNativeBorder()) {
| 0 | ||||||||||||||||||||||||||||||
| 4404 | subRule.drawBackground(p, opt->rect); | - | ||||||||||||||||||||||||||||||
| 4405 | QStyleOptionTabWidgetFrame frmCopy(*frm); | - | ||||||||||||||||||||||||||||||
| 4406 | subRule.configurePalette(&frmCopy.palette, QPalette::WindowText, QPalette::Window); | - | ||||||||||||||||||||||||||||||
| 4407 | baseStyle()->drawPrimitive(pe, &frmCopy, p, w); | - | ||||||||||||||||||||||||||||||
| 4408 | } else { never executed: end of block | 0 | ||||||||||||||||||||||||||||||
| 4409 | subRule.drawRule(p, opt->rect); | - | ||||||||||||||||||||||||||||||
| 4410 | } never executed: end of block | 0 | ||||||||||||||||||||||||||||||
| 4411 | return; never executed: return; | 0 | ||||||||||||||||||||||||||||||
| 4412 | } | - | ||||||||||||||||||||||||||||||
| 4413 | break; never executed: break; | 0 | ||||||||||||||||||||||||||||||
| 4414 | #endif // QT_NO_TABWIDGET | - | ||||||||||||||||||||||||||||||
| 4415 | - | |||||||||||||||||||||||||||||||
| 4416 | case PE_IndicatorProgressChunk: never executed: case PE_IndicatorProgressChunk: | 0 | ||||||||||||||||||||||||||||||
| 4417 | pseudoElement = PseudoElement_ProgressBarChunk; | - | ||||||||||||||||||||||||||||||
| 4418 | break; never executed: break; | 0 | ||||||||||||||||||||||||||||||
| 4419 | - | |||||||||||||||||||||||||||||||
| 4420 | case PE_IndicatorTabTear: never executed: case PE_IndicatorTabTear: | 0 | ||||||||||||||||||||||||||||||
| 4421 | pseudoElement = PseudoElement_TabBarTear; | - | ||||||||||||||||||||||||||||||
| 4422 | break; never executed: break; | 0 | ||||||||||||||||||||||||||||||
| 4423 | - | |||||||||||||||||||||||||||||||
| 4424 | case PE_FrameFocusRect: never executed: case PE_FrameFocusRect: | 0 | ||||||||||||||||||||||||||||||
| 4425 | if (!rule.hasNativeOutline()) {
| 0 | ||||||||||||||||||||||||||||||
| 4426 | rule.drawOutline(p, opt->rect); | - | ||||||||||||||||||||||||||||||
| 4427 | return; never executed: return; | 0 | ||||||||||||||||||||||||||||||
| 4428 | } | - | ||||||||||||||||||||||||||||||
| 4429 | break; never executed: break; | 0 | ||||||||||||||||||||||||||||||
| 4430 | - | |||||||||||||||||||||||||||||||
| 4431 | case PE_IndicatorDockWidgetResizeHandle: never executed: case PE_IndicatorDockWidgetResizeHandle: | 0 | ||||||||||||||||||||||||||||||
| 4432 | pseudoElement = PseudoElement_DockWidgetSeparator; | - | ||||||||||||||||||||||||||||||
| 4433 | break; never executed: break; | 0 | ||||||||||||||||||||||||||||||
| 4434 | - | |||||||||||||||||||||||||||||||
| 4435 | case PE_PanelItemViewItem: never executed: case PE_PanelItemViewItem: | 0 | ||||||||||||||||||||||||||||||
| 4436 | pseudoElement = PseudoElement_ViewItem; | - | ||||||||||||||||||||||||||||||
| 4437 | break; never executed: break; | 0 | ||||||||||||||||||||||||||||||
| 4438 | - | |||||||||||||||||||||||||||||||
| 4439 | case PE_PanelScrollAreaCorner: never executed: case PE_PanelScrollAreaCorner: | 0 | ||||||||||||||||||||||||||||||
| 4440 | pseudoElement = PseudoElement_ScrollAreaCorner; | - | ||||||||||||||||||||||||||||||
| 4441 | break; never executed: break; | 0 | ||||||||||||||||||||||||||||||
| 4442 | - | |||||||||||||||||||||||||||||||
| 4443 | case PE_IndicatorSpinDown: never executed: case PE_IndicatorSpinDown: | 0 | ||||||||||||||||||||||||||||||
| 4444 | case PE_IndicatorSpinMinus: never executed: case PE_IndicatorSpinMinus: | 0 | ||||||||||||||||||||||||||||||
| 4445 | pseudoElement = PseudoElement_SpinBoxDownArrow; | - | ||||||||||||||||||||||||||||||
| 4446 | break; never executed: break; | 0 | ||||||||||||||||||||||||||||||
| 4447 | - | |||||||||||||||||||||||||||||||
| 4448 | case PE_IndicatorSpinUp: never executed: case PE_IndicatorSpinUp: | 0 | ||||||||||||||||||||||||||||||
| 4449 | case PE_IndicatorSpinPlus: never executed: case PE_IndicatorSpinPlus: | 0 | ||||||||||||||||||||||||||||||
| 4450 | pseudoElement = PseudoElement_SpinBoxUpArrow; | - | ||||||||||||||||||||||||||||||
| 4451 | break; never executed: break; | 0 | ||||||||||||||||||||||||||||||
| 4452 | #ifndef QT_NO_TABBAR | - | ||||||||||||||||||||||||||||||
| 4453 | case PE_IndicatorTabClose: never executed: case PE_IndicatorTabClose: | 0 | ||||||||||||||||||||||||||||||
| 4454 | if (w)
| 0 | ||||||||||||||||||||||||||||||
| 4455 | w = w->parentWidget(); //match on the QTabBar instead of the CloseButton never executed: w = w->parentWidget(); | 0 | ||||||||||||||||||||||||||||||
| 4456 | pseudoElement = PseudoElement_TabBarTabCloseButton; | - | ||||||||||||||||||||||||||||||
| 4457 | #endif | - | ||||||||||||||||||||||||||||||
| 4458 | - | |||||||||||||||||||||||||||||||
| 4459 | default: code before this statement never executed: default:never executed: default: | 0 | ||||||||||||||||||||||||||||||
| 4460 | break; never executed: break; | 0 | ||||||||||||||||||||||||||||||
| 4461 | } | - | ||||||||||||||||||||||||||||||
| 4462 | - | |||||||||||||||||||||||||||||||
| 4463 | if (pseudoElement != PseudoElement_None) {
| 0 | ||||||||||||||||||||||||||||||
| 4464 | QRenderRule subRule = renderRule(w, opt, pseudoElement); | - | ||||||||||||||||||||||||||||||
| 4465 | if (subRule.hasDrawable()) {
| 0 | ||||||||||||||||||||||||||||||
| 4466 | subRule.drawRule(p, rect); | - | ||||||||||||||||||||||||||||||
| 4467 | } else { never executed: end of block | 0 | ||||||||||||||||||||||||||||||
| 4468 | baseStyle()->drawPrimitive(pe, opt, p, w); | - | ||||||||||||||||||||||||||||||
| 4469 | } never executed: end of block | 0 | ||||||||||||||||||||||||||||||
| 4470 | } else { | - | ||||||||||||||||||||||||||||||
| 4471 | baseStyle()->drawPrimitive(pe, opt, p, w); | - | ||||||||||||||||||||||||||||||
| 4472 | } never executed: end of block | 0 | ||||||||||||||||||||||||||||||
| 4473 | } | - | ||||||||||||||||||||||||||||||
| 4474 | - | |||||||||||||||||||||||||||||||
| 4475 | QPixmap QStyleSheetStyle::generatedIconPixmap(QIcon::Mode iconMode, const QPixmap& pixmap, | - | ||||||||||||||||||||||||||||||
| 4476 | const QStyleOption *option) const | - | ||||||||||||||||||||||||||||||
| 4477 | { | - | ||||||||||||||||||||||||||||||
| 4478 | return baseStyle()->generatedIconPixmap(iconMode, pixmap, option); never executed: return baseStyle()->generatedIconPixmap(iconMode, pixmap, option); | 0 | ||||||||||||||||||||||||||||||
| 4479 | } | - | ||||||||||||||||||||||||||||||
| 4480 | - | |||||||||||||||||||||||||||||||
| 4481 | QStyle::SubControl QStyleSheetStyle::hitTestComplexControl(ComplexControl cc, const QStyleOptionComplex *opt, | - | ||||||||||||||||||||||||||||||
| 4482 | const QPoint &pt, const QWidget *w) const | - | ||||||||||||||||||||||||||||||
| 4483 | { | - | ||||||||||||||||||||||||||||||
| 4484 | RECURSION_GUARD(return baseStyle()->hitTestComplexControl(cc, opt, pt, w)) never executed: return baseStyle()->hitTestComplexControl(cc, opt, pt, w);
| 0 | ||||||||||||||||||||||||||||||
| 4485 | switch (cc) { | - | ||||||||||||||||||||||||||||||
| 4486 | case CC_TitleBar: never executed: case CC_TitleBar: | 0 | ||||||||||||||||||||||||||||||
| 4487 | if (const QStyleOptionTitleBar *tb = qstyleoption_cast<const QStyleOptionTitleBar *>(opt)) {
| 0 | ||||||||||||||||||||||||||||||
| 4488 | QRenderRule rule = renderRule(w, opt, PseudoElement_TitleBar); | - | ||||||||||||||||||||||||||||||
| 4489 | if (rule.hasDrawable() || rule.hasBox() || rule.hasBorder()) {
| 0 | ||||||||||||||||||||||||||||||
| 4490 | QHash<QStyle::SubControl, QRect> layout = titleBarLayout(w, tb); | - | ||||||||||||||||||||||||||||||
| 4491 | QRect r; | - | ||||||||||||||||||||||||||||||
| 4492 | QStyle::SubControl sc = QStyle::SC_None; | - | ||||||||||||||||||||||||||||||
| 4493 | uint ctrl = SC_TitleBarSysMenu; | - | ||||||||||||||||||||||||||||||
| 4494 | while (ctrl <= SC_TitleBarLabel) {
| 0 | ||||||||||||||||||||||||||||||
| 4495 | r = layout[QStyle::SubControl(ctrl)]; | - | ||||||||||||||||||||||||||||||
| 4496 | if (r.isValid() && r.contains(pt)) {
| 0 | ||||||||||||||||||||||||||||||
| 4497 | sc = QStyle::SubControl(ctrl); | - | ||||||||||||||||||||||||||||||
| 4498 | break; never executed: break; | 0 | ||||||||||||||||||||||||||||||
| 4499 | } | - | ||||||||||||||||||||||||||||||
| 4500 | ctrl <<= 1; | - | ||||||||||||||||||||||||||||||
| 4501 | } never executed: end of block | 0 | ||||||||||||||||||||||||||||||
| 4502 | return sc; never executed: return sc; | 0 | ||||||||||||||||||||||||||||||
| 4503 | } | - | ||||||||||||||||||||||||||||||
| 4504 | } never executed: end of block | 0 | ||||||||||||||||||||||||||||||
| 4505 | break; never executed: break; | 0 | ||||||||||||||||||||||||||||||
| 4506 | - | |||||||||||||||||||||||||||||||
| 4507 | case CC_MdiControls: never executed: case CC_MdiControls: | 0 | ||||||||||||||||||||||||||||||
| 4508 | if (hasStyleRule(w, PseudoElement_MdiCloseButton)
| 0 | ||||||||||||||||||||||||||||||
| 4509 | || hasStyleRule(w, PseudoElement_MdiNormalButton)
| 0 | ||||||||||||||||||||||||||||||
| 4510 | || hasStyleRule(w, PseudoElement_MdiMinButton))
| 0 | ||||||||||||||||||||||||||||||
| 4511 | return QWindowsStyle::hitTestComplexControl(cc, opt, pt, w); never executed: return QWindowsStyle::hitTestComplexControl(cc, opt, pt, w); | 0 | ||||||||||||||||||||||||||||||
| 4512 | break; never executed: break; | 0 | ||||||||||||||||||||||||||||||
| 4513 | - | |||||||||||||||||||||||||||||||
| 4514 | case CC_ScrollBar: { never executed: case CC_ScrollBar: | 0 | ||||||||||||||||||||||||||||||
| 4515 | QRenderRule rule = renderRule(w, opt); | - | ||||||||||||||||||||||||||||||
| 4516 | if (!rule.hasDrawable() && !rule.hasBox())
| 0 | ||||||||||||||||||||||||||||||
| 4517 | break; never executed: break; | 0 | ||||||||||||||||||||||||||||||
| 4518 | } | - | ||||||||||||||||||||||||||||||
| 4519 | // intentionally falls through | - | ||||||||||||||||||||||||||||||
| 4520 | case CC_SpinBox: code before this statement never executed: case CC_SpinBox:never executed: case CC_SpinBox: | 0 | ||||||||||||||||||||||||||||||
| 4521 | case CC_GroupBox: never executed: case CC_GroupBox: | 0 | ||||||||||||||||||||||||||||||
| 4522 | case CC_ComboBox: never executed: case CC_ComboBox: | 0 | ||||||||||||||||||||||||||||||
| 4523 | case CC_Slider: never executed: case CC_Slider: | 0 | ||||||||||||||||||||||||||||||
| 4524 | case CC_ToolButton: never executed: case CC_ToolButton: | 0 | ||||||||||||||||||||||||||||||
| 4525 | return QWindowsStyle::hitTestComplexControl(cc, opt, pt, w); never executed: return QWindowsStyle::hitTestComplexControl(cc, opt, pt, w); | 0 | ||||||||||||||||||||||||||||||
| 4526 | default: never executed: default: | 0 | ||||||||||||||||||||||||||||||
| 4527 | break; never executed: break; | 0 | ||||||||||||||||||||||||||||||
| 4528 | } | - | ||||||||||||||||||||||||||||||
| 4529 | - | |||||||||||||||||||||||||||||||
| 4530 | return baseStyle()->hitTestComplexControl(cc, opt, pt, w); never executed: return baseStyle()->hitTestComplexControl(cc, opt, pt, w); | 0 | ||||||||||||||||||||||||||||||
| 4531 | } | - | ||||||||||||||||||||||||||||||
| 4532 | - | |||||||||||||||||||||||||||||||
| 4533 | QRect QStyleSheetStyle::itemPixmapRect(const QRect &rect, int alignment, const QPixmap &pixmap) const | - | ||||||||||||||||||||||||||||||
| 4534 | { | - | ||||||||||||||||||||||||||||||
| 4535 | return baseStyle()->itemPixmapRect(rect, alignment, pixmap); never executed: return baseStyle()->itemPixmapRect(rect, alignment, pixmap); | 0 | ||||||||||||||||||||||||||||||
| 4536 | } | - | ||||||||||||||||||||||||||||||
| 4537 | - | |||||||||||||||||||||||||||||||
| 4538 | QRect QStyleSheetStyle::itemTextRect(const QFontMetrics &metrics, const QRect& rect, int alignment, | - | ||||||||||||||||||||||||||||||
| 4539 | bool enabled, const QString& text) const | - | ||||||||||||||||||||||||||||||
| 4540 | { | - | ||||||||||||||||||||||||||||||
| 4541 | return baseStyle()->itemTextRect(metrics, rect, alignment, enabled, text); never executed: return baseStyle()->itemTextRect(metrics, rect, alignment, enabled, text); | 0 | ||||||||||||||||||||||||||||||
| 4542 | } | - | ||||||||||||||||||||||||||||||
| 4543 | - | |||||||||||||||||||||||||||||||
| 4544 | int QStyleSheetStyle::pixelMetric(PixelMetric m, const QStyleOption *opt, const QWidget *w) const | - | ||||||||||||||||||||||||||||||
| 4545 | { | - | ||||||||||||||||||||||||||||||
| 4546 | RECURSION_GUARD(return baseStyle()->pixelMetric(m, opt, w)) never executed: return baseStyle()->pixelMetric(m, opt, w);
| 0 | ||||||||||||||||||||||||||||||
| 4547 | - | |||||||||||||||||||||||||||||||
| 4548 | QRenderRule rule = renderRule(w, opt); | - | ||||||||||||||||||||||||||||||
| 4549 | QRenderRule subRule; | - | ||||||||||||||||||||||||||||||
| 4550 | - | |||||||||||||||||||||||||||||||
| 4551 | switch (m) { | - | ||||||||||||||||||||||||||||||
| 4552 | case PM_MenuButtonIndicator: never executed: case PM_MenuButtonIndicator: | 0 | ||||||||||||||||||||||||||||||
| 4553 | #ifndef QT_NO_TOOLBUTTON | - | ||||||||||||||||||||||||||||||
| 4554 | // QToolButton adds this directly to the width | - | ||||||||||||||||||||||||||||||
| 4555 | if (qobject_cast<const QToolButton *>(w) && (rule.hasBox() || !rule.hasNativeBorder()))
| 0 | ||||||||||||||||||||||||||||||
| 4556 | return 0; never executed: return 0; | 0 | ||||||||||||||||||||||||||||||
| 4557 | #endif | - | ||||||||||||||||||||||||||||||
| 4558 | subRule = renderRule(w, opt, PseudoElement_PushButtonMenuIndicator); | - | ||||||||||||||||||||||||||||||
| 4559 | if (subRule.hasContentsSize())
| 0 | ||||||||||||||||||||||||||||||
| 4560 | return subRule.size().width(); never executed: return subRule.size().width(); | 0 | ||||||||||||||||||||||||||||||
| 4561 | break; never executed: break; | 0 | ||||||||||||||||||||||||||||||
| 4562 | - | |||||||||||||||||||||||||||||||
| 4563 | case PM_ButtonShiftHorizontal: never executed: case PM_ButtonShiftHorizontal: | 0 | ||||||||||||||||||||||||||||||
| 4564 | case PM_ButtonShiftVertical: never executed: case PM_ButtonShiftVertical: | 0 | ||||||||||||||||||||||||||||||
| 4565 | case PM_ButtonMargin: never executed: case PM_ButtonMargin: | 0 | ||||||||||||||||||||||||||||||
| 4566 | case PM_ButtonDefaultIndicator: never executed: case PM_ButtonDefaultIndicator: | 0 | ||||||||||||||||||||||||||||||
| 4567 | if (rule.hasBox())
| 0 | ||||||||||||||||||||||||||||||
| 4568 | return 0; never executed: return 0; | 0 | ||||||||||||||||||||||||||||||
| 4569 | break; never executed: break; | 0 | ||||||||||||||||||||||||||||||
| 4570 | - | |||||||||||||||||||||||||||||||
| 4571 | case PM_DefaultFrameWidth: never executed: case PM_DefaultFrameWidth: | 0 | ||||||||||||||||||||||||||||||
| 4572 | if (!rule.hasNativeBorder())
| 0 | ||||||||||||||||||||||||||||||
| 4573 | return rule.border()->borders[LeftEdge]; never executed: return rule.border()->borders[LeftEdge]; | 0 | ||||||||||||||||||||||||||||||
| 4574 | break; never executed: break; | 0 | ||||||||||||||||||||||||||||||
| 4575 | - | |||||||||||||||||||||||||||||||
| 4576 | case PM_ExclusiveIndicatorWidth: never executed: case PM_ExclusiveIndicatorWidth: | 0 | ||||||||||||||||||||||||||||||
| 4577 | case PM_IndicatorWidth: never executed: case PM_IndicatorWidth: | 0 | ||||||||||||||||||||||||||||||
| 4578 | case PM_ExclusiveIndicatorHeight: never executed: case PM_ExclusiveIndicatorHeight: | 0 | ||||||||||||||||||||||||||||||
| 4579 | case PM_IndicatorHeight: never executed: case PM_IndicatorHeight: | 0 | ||||||||||||||||||||||||||||||
| 4580 | subRule = renderRule(w, opt, PseudoElement_Indicator); | - | ||||||||||||||||||||||||||||||
| 4581 | if (subRule.hasContentsSize()) {
| 0 | ||||||||||||||||||||||||||||||
| 4582 | return (m == PM_ExclusiveIndicatorWidth) || (m == PM_IndicatorWidth) never executed: return (m == PM_ExclusiveIndicatorWidth) || (m == PM_IndicatorWidth) ? subRule.size().width() : subRule.size().height();
| 0 | ||||||||||||||||||||||||||||||
| 4583 | ? subRule.size().width() : subRule.size().height(); never executed: return (m == PM_ExclusiveIndicatorWidth) || (m == PM_IndicatorWidth) ? subRule.size().width() : subRule.size().height(); | 0 | ||||||||||||||||||||||||||||||
| 4584 | } | - | ||||||||||||||||||||||||||||||
| 4585 | break; never executed: break; | 0 | ||||||||||||||||||||||||||||||
| 4586 | - | |||||||||||||||||||||||||||||||
| 4587 | case PM_DockWidgetFrameWidth: never executed: case PM_DockWidgetFrameWidth: | 0 | ||||||||||||||||||||||||||||||
| 4588 | case PM_ToolTipLabelFrameWidth: // border + margin + padding (support only one width) never executed: case PM_ToolTipLabelFrameWidth: | 0 | ||||||||||||||||||||||||||||||
| 4589 | if (!rule.hasDrawable())
| 0 | ||||||||||||||||||||||||||||||
| 4590 | break; never executed: break; | 0 | ||||||||||||||||||||||||||||||
| 4591 | - | |||||||||||||||||||||||||||||||
| 4592 | return (rule.border() ? rule.border()->borders[LeftEdge] : 0) never executed: return (rule.border() ? rule.border()->borders[LeftEdge] : 0) + (rule.hasBox() ? rule.box()->margins[LeftEdge] + rule.box()->paddings[LeftEdge]: 0);
| 0 | ||||||||||||||||||||||||||||||
| 4593 | + (rule.hasBox() ? rule.box()->margins[LeftEdge] + rule.box()->paddings[LeftEdge]: 0); never executed: return (rule.border() ? rule.border()->borders[LeftEdge] : 0) + (rule.hasBox() ? rule.box()->margins[LeftEdge] + rule.box()->paddings[LeftEdge]: 0);
| 0 | ||||||||||||||||||||||||||||||
| 4594 | - | |||||||||||||||||||||||||||||||
| 4595 | case PM_ToolBarFrameWidth: never executed: case PM_ToolBarFrameWidth: | 0 | ||||||||||||||||||||||||||||||
| 4596 | if (rule.hasBorder() || rule.hasBox())
| 0 | ||||||||||||||||||||||||||||||
| 4597 | return (rule.border() ? rule.border()->borders[LeftEdge] : 0) never executed: return (rule.border() ? rule.border()->borders[LeftEdge] : 0) + (rule.hasBox() ? rule.box()->paddings[LeftEdge]: 0);
| 0 | ||||||||||||||||||||||||||||||
| 4598 | + (rule.hasBox() ? rule.box()->paddings[LeftEdge]: 0); never executed: return (rule.border() ? rule.border()->borders[LeftEdge] : 0) + (rule.hasBox() ? rule.box()->paddings[LeftEdge]: 0);
| 0 | ||||||||||||||||||||||||||||||
| 4599 | break; never executed: break; | 0 | ||||||||||||||||||||||||||||||
| 4600 | - | |||||||||||||||||||||||||||||||
| 4601 | case PM_MenuPanelWidth: never executed: case PM_MenuPanelWidth: | 0 | ||||||||||||||||||||||||||||||
| 4602 | case PM_MenuBarPanelWidth: never executed: case PM_MenuBarPanelWidth: | 0 | ||||||||||||||||||||||||||||||
| 4603 | if (rule.hasBorder() || rule.hasBox())
| 0 | ||||||||||||||||||||||||||||||
| 4604 | return (rule.border() ? rule.border()->borders[LeftEdge] : 0) never executed: return (rule.border() ? rule.border()->borders[LeftEdge] : 0) + (rule.hasBox() ? rule.box()->margins[LeftEdge]: 0);
| 0 | ||||||||||||||||||||||||||||||
| 4605 | + (rule.hasBox() ? rule.box()->margins[LeftEdge]: 0); never executed: return (rule.border() ? rule.border()->borders[LeftEdge] : 0) + (rule.hasBox() ? rule.box()->margins[LeftEdge]: 0);
| 0 | ||||||||||||||||||||||||||||||
| 4606 | break; never executed: break; | 0 | ||||||||||||||||||||||||||||||
| 4607 | - | |||||||||||||||||||||||||||||||
| 4608 | - | |||||||||||||||||||||||||||||||
| 4609 | case PM_MenuHMargin: never executed: case PM_MenuHMargin: | 0 | ||||||||||||||||||||||||||||||
| 4610 | case PM_MenuBarHMargin: never executed: case PM_MenuBarHMargin: | 0 | ||||||||||||||||||||||||||||||
| 4611 | if (rule.hasBox())
| 0 | ||||||||||||||||||||||||||||||
| 4612 | return rule.box()->paddings[LeftEdge]; never executed: return rule.box()->paddings[LeftEdge]; | 0 | ||||||||||||||||||||||||||||||
| 4613 | break; never executed: break; | 0 | ||||||||||||||||||||||||||||||
| 4614 | - | |||||||||||||||||||||||||||||||
| 4615 | case PM_MenuVMargin: never executed: case PM_MenuVMargin: | 0 | ||||||||||||||||||||||||||||||
| 4616 | case PM_MenuBarVMargin: never executed: case PM_MenuBarVMargin: | 0 | ||||||||||||||||||||||||||||||
| 4617 | if (rule.hasBox())
| 0 | ||||||||||||||||||||||||||||||
| 4618 | return rule.box()->paddings[TopEdge]; never executed: return rule.box()->paddings[TopEdge]; | 0 | ||||||||||||||||||||||||||||||
| 4619 | break; never executed: break; | 0 | ||||||||||||||||||||||||||||||
| 4620 | - | |||||||||||||||||||||||||||||||
| 4621 | case PM_DockWidgetTitleBarButtonMargin: never executed: case PM_DockWidgetTitleBarButtonMargin: | 0 | ||||||||||||||||||||||||||||||
| 4622 | case PM_ToolBarItemMargin: never executed: case PM_ToolBarItemMargin: | 0 | ||||||||||||||||||||||||||||||
| 4623 | if (rule.hasBox())
| 0 | ||||||||||||||||||||||||||||||
| 4624 | return rule.box()->margins[TopEdge]; never executed: return rule.box()->margins[TopEdge]; | 0 | ||||||||||||||||||||||||||||||
| 4625 | break; never executed: break; | 0 | ||||||||||||||||||||||||||||||
| 4626 | - | |||||||||||||||||||||||||||||||
| 4627 | case PM_ToolBarItemSpacing: never executed: case PM_ToolBarItemSpacing: | 0 | ||||||||||||||||||||||||||||||
| 4628 | case PM_MenuBarItemSpacing: never executed: case PM_MenuBarItemSpacing: | 0 | ||||||||||||||||||||||||||||||
| 4629 | if (rule.hasBox() && rule.box()->spacing != -1)
| 0 | ||||||||||||||||||||||||||||||
| 4630 | return rule.box()->spacing; never executed: return rule.box()->spacing; | 0 | ||||||||||||||||||||||||||||||
| 4631 | break; never executed: break; | 0 | ||||||||||||||||||||||||||||||
| 4632 | - | |||||||||||||||||||||||||||||||
| 4633 | case PM_MenuTearoffHeight: never executed: case PM_MenuTearoffHeight: | 0 | ||||||||||||||||||||||||||||||
| 4634 | case PM_MenuScrollerHeight: { never executed: case PM_MenuScrollerHeight: | 0 | ||||||||||||||||||||||||||||||
| 4635 | PseudoElement ps = m == PM_MenuTearoffHeight ? PseudoElement_MenuTearoff : PseudoElement_MenuScroller;
| 0 | ||||||||||||||||||||||||||||||
| 4636 | subRule = renderRule(w, opt, ps); | - | ||||||||||||||||||||||||||||||
| 4637 | if (subRule.hasContentsSize())
| 0 | ||||||||||||||||||||||||||||||
| 4638 | return subRule.size().height(); never executed: return subRule.size().height(); | 0 | ||||||||||||||||||||||||||||||
| 4639 | break; never executed: break; | 0 | ||||||||||||||||||||||||||||||
| 4640 | } | - | ||||||||||||||||||||||||||||||
| 4641 | - | |||||||||||||||||||||||||||||||
| 4642 | case PM_ToolBarExtensionExtent: never executed: case PM_ToolBarExtensionExtent: | 0 | ||||||||||||||||||||||||||||||
| 4643 | break; never executed: break; | 0 | ||||||||||||||||||||||||||||||
| 4644 | - | |||||||||||||||||||||||||||||||
| 4645 | case PM_SplitterWidth: never executed: case PM_SplitterWidth: | 0 | ||||||||||||||||||||||||||||||
| 4646 | case PM_ToolBarSeparatorExtent: never executed: case PM_ToolBarSeparatorExtent: | 0 | ||||||||||||||||||||||||||||||
| 4647 | case PM_ToolBarHandleExtent: { never executed: case PM_ToolBarHandleExtent: | 0 | ||||||||||||||||||||||||||||||
| 4648 | PseudoElement ps; | - | ||||||||||||||||||||||||||||||
| 4649 | if (m == PM_ToolBarHandleExtent) ps = PseudoElement_ToolBarHandle; never executed: ps = PseudoElement_ToolBarHandle;
| 0 | ||||||||||||||||||||||||||||||
| 4650 | else if (m == PM_SplitterWidth) ps = PseudoElement_SplitterHandle; never executed: ps = PseudoElement_SplitterHandle;
| 0 | ||||||||||||||||||||||||||||||
| 4651 | else ps = PseudoElement_ToolBarSeparator; never executed: ps = PseudoElement_ToolBarSeparator; | 0 | ||||||||||||||||||||||||||||||
| 4652 | subRule = renderRule(w, opt, ps); | - | ||||||||||||||||||||||||||||||
| 4653 | if (subRule.hasContentsSize()) {
| 0 | ||||||||||||||||||||||||||||||
| 4654 | QSize sz = subRule.size(); | - | ||||||||||||||||||||||||||||||
| 4655 | return (opt && opt->state & QStyle::State_Horizontal) ? sz.width() : sz.height(); never executed: return (opt && opt->state & QStyle::State_Horizontal) ? sz.width() : sz.height();
| 0 | ||||||||||||||||||||||||||||||
| 4656 | } | - | ||||||||||||||||||||||||||||||
| 4657 | break; never executed: break; | 0 | ||||||||||||||||||||||||||||||
| 4658 | } | - | ||||||||||||||||||||||||||||||
| 4659 | - | |||||||||||||||||||||||||||||||
| 4660 | case PM_RadioButtonLabelSpacing: never executed: case PM_RadioButtonLabelSpacing: | 0 | ||||||||||||||||||||||||||||||
| 4661 | if (rule.hasBox() && rule.box()->spacing != -1)
| 0 | ||||||||||||||||||||||||||||||
| 4662 | return rule.box()->spacing; never executed: return rule.box()->spacing; | 0 | ||||||||||||||||||||||||||||||
| 4663 | break; never executed: break; | 0 | ||||||||||||||||||||||||||||||
| 4664 | case PM_CheckBoxLabelSpacing: never executed: case PM_CheckBoxLabelSpacing: | 0 | ||||||||||||||||||||||||||||||
| 4665 | if (qobject_cast<const QCheckBox *>(w)) {
| 0 | ||||||||||||||||||||||||||||||
| 4666 | if (rule.hasBox() && rule.box()->spacing != -1)
| 0 | ||||||||||||||||||||||||||||||
| 4667 | return rule.box()->spacing; never executed: return rule.box()->spacing; | 0 | ||||||||||||||||||||||||||||||
| 4668 | } never executed: end of block | 0 | ||||||||||||||||||||||||||||||
| 4669 | // assume group box | - | ||||||||||||||||||||||||||||||
| 4670 | subRule = renderRule(w, opt, PseudoElement_GroupBoxTitle); | - | ||||||||||||||||||||||||||||||
| 4671 | if (subRule.hasBox() && subRule.box()->spacing != -1)
| 0 | ||||||||||||||||||||||||||||||
| 4672 | return subRule.box()->spacing; never executed: return subRule.box()->spacing; | 0 | ||||||||||||||||||||||||||||||
| 4673 | break; never executed: break; | 0 | ||||||||||||||||||||||||||||||
| 4674 | - | |||||||||||||||||||||||||||||||
| 4675 | #ifndef QT_NO_SCROLLBAR | - | ||||||||||||||||||||||||||||||
| 4676 | case PM_ScrollBarExtent: never executed: case PM_ScrollBarExtent: | 0 | ||||||||||||||||||||||||||||||
| 4677 | if (rule.hasContentsSize()) {
| 0 | ||||||||||||||||||||||||||||||
| 4678 | QSize sz = rule.size(); | - | ||||||||||||||||||||||||||||||
| 4679 | if (const QStyleOptionSlider *sb = qstyleoption_cast<const QStyleOptionSlider *>(opt))
| 0 | ||||||||||||||||||||||||||||||
| 4680 | return sb->orientation == Qt::Horizontal ? sz.height() : sz.width(); never executed: return sb->orientation == Qt::Horizontal ? sz.height() : sz.width();
| 0 | ||||||||||||||||||||||||||||||
| 4681 | return sz.width() == -1 ? sz.height() : sz.width(); never executed: return sz.width() == -1 ? sz.height() : sz.width();
| 0 | ||||||||||||||||||||||||||||||
| 4682 | } | - | ||||||||||||||||||||||||||||||
| 4683 | break; never executed: break; | 0 | ||||||||||||||||||||||||||||||
| 4684 | - | |||||||||||||||||||||||||||||||
| 4685 | case PM_ScrollBarSliderMin: never executed: case PM_ScrollBarSliderMin: | 0 | ||||||||||||||||||||||||||||||
| 4686 | if (hasStyleRule(w, PseudoElement_ScrollBarSlider)) {
| 0 | ||||||||||||||||||||||||||||||
| 4687 | subRule = renderRule(w, opt, PseudoElement_ScrollBarSlider); | - | ||||||||||||||||||||||||||||||
| 4688 | QSize msz = subRule.minimumSize(); | - | ||||||||||||||||||||||||||||||
| 4689 | if (const QStyleOptionSlider *sb = qstyleoption_cast<const QStyleOptionSlider *>(opt))
| 0 | ||||||||||||||||||||||||||||||
| 4690 | return sb->orientation == Qt::Horizontal ? msz.width() : msz.height(); never executed: return sb->orientation == Qt::Horizontal ? msz.width() : msz.height();
| 0 | ||||||||||||||||||||||||||||||
| 4691 | return msz.width() == -1 ? msz.height() : msz.width(); never executed: return msz.width() == -1 ? msz.height() : msz.width();
| 0 | ||||||||||||||||||||||||||||||
| 4692 | } | - | ||||||||||||||||||||||||||||||
| 4693 | break; never executed: break; | 0 | ||||||||||||||||||||||||||||||
| 4694 | - | |||||||||||||||||||||||||||||||
| 4695 | case PM_ScrollView_ScrollBarSpacing: never executed: case PM_ScrollView_ScrollBarSpacing: | 0 | ||||||||||||||||||||||||||||||
| 4696 | if(!rule.hasNativeBorder() || rule.hasBox())
| 0 | ||||||||||||||||||||||||||||||
| 4697 | return 0; never executed: return 0; | 0 | ||||||||||||||||||||||||||||||
| 4698 | break; never executed: break; | 0 | ||||||||||||||||||||||||||||||
| 4699 | #endif // QT_NO_SCROLLBAR | - | ||||||||||||||||||||||||||||||
| 4700 | - | |||||||||||||||||||||||||||||||
| 4701 | case PM_ProgressBarChunkWidth: never executed: case PM_ProgressBarChunkWidth: | 0 | ||||||||||||||||||||||||||||||
| 4702 | subRule = renderRule(w, opt, PseudoElement_ProgressBarChunk); | - | ||||||||||||||||||||||||||||||
| 4703 | if (subRule.hasContentsSize()) {
| 0 | ||||||||||||||||||||||||||||||
| 4704 | QSize sz = subRule.size(); | - | ||||||||||||||||||||||||||||||
| 4705 | return (opt->state & QStyle::State_Horizontal) never executed: return (opt->state & QStyle::State_Horizontal) ? sz.width() : sz.height();
| 0 | ||||||||||||||||||||||||||||||
| 4706 | ? sz.width() : sz.height(); never executed: return (opt->state & QStyle::State_Horizontal) ? sz.width() : sz.height(); | 0 | ||||||||||||||||||||||||||||||
| 4707 | } | - | ||||||||||||||||||||||||||||||
| 4708 | break; never executed: break; | 0 | ||||||||||||||||||||||||||||||
| 4709 | - | |||||||||||||||||||||||||||||||
| 4710 | #ifndef QT_NO_TABWIDGET | - | ||||||||||||||||||||||||||||||
| 4711 | case PM_TabBarTabHSpace: never executed: case PM_TabBarTabHSpace: | 0 | ||||||||||||||||||||||||||||||
| 4712 | case PM_TabBarTabVSpace: never executed: case PM_TabBarTabVSpace: | 0 | ||||||||||||||||||||||||||||||
| 4713 | subRule = renderRule(w, opt, PseudoElement_TabBarTab); | - | ||||||||||||||||||||||||||||||
| 4714 | if (subRule.hasBox() || subRule.hasBorder())
| 0 | ||||||||||||||||||||||||||||||
| 4715 | return 0; never executed: return 0; | 0 | ||||||||||||||||||||||||||||||
| 4716 | break; never executed: break; | 0 | ||||||||||||||||||||||||||||||
| 4717 | - | |||||||||||||||||||||||||||||||
| 4718 | case PM_TabBarScrollButtonWidth: { never executed: case PM_TabBarScrollButtonWidth: | 0 | ||||||||||||||||||||||||||||||
| 4719 | subRule = renderRule(w, opt, PseudoElement_TabBarScroller); | - | ||||||||||||||||||||||||||||||
| 4720 | if (subRule.hasContentsSize()) {
| 0 | ||||||||||||||||||||||||||||||
| 4721 | QSize sz = subRule.size(); | - | ||||||||||||||||||||||||||||||
| 4722 | return sz.width() != -1 ? sz.width() : sz.height(); never executed: return sz.width() != -1 ? sz.width() : sz.height();
| 0 | ||||||||||||||||||||||||||||||
| 4723 | } | - | ||||||||||||||||||||||||||||||
| 4724 | } | - | ||||||||||||||||||||||||||||||
| 4725 | break; never executed: break; | 0 | ||||||||||||||||||||||||||||||
| 4726 | - | |||||||||||||||||||||||||||||||
| 4727 | case PM_TabBarTabShiftHorizontal: never executed: case PM_TabBarTabShiftHorizontal: | 0 | ||||||||||||||||||||||||||||||
| 4728 | case PM_TabBarTabShiftVertical: never executed: case PM_TabBarTabShiftVertical: | 0 | ||||||||||||||||||||||||||||||
| 4729 | subRule = renderRule(w, opt, PseudoElement_TabBarTab); | - | ||||||||||||||||||||||||||||||
| 4730 | if (subRule.hasBox())
| 0 | ||||||||||||||||||||||||||||||
| 4731 | return 0; never executed: return 0; | 0 | ||||||||||||||||||||||||||||||
| 4732 | break; never executed: break; | 0 | ||||||||||||||||||||||||||||||
| 4733 | - | |||||||||||||||||||||||||||||||
| 4734 | case PM_TabBarBaseOverlap: { never executed: case PM_TabBarBaseOverlap: | 0 | ||||||||||||||||||||||||||||||
| 4735 | const QWidget *tabWidget = qobject_cast<const QTabWidget *>(w); | - | ||||||||||||||||||||||||||||||
| 4736 | if (!tabWidget && w)
| 0 | ||||||||||||||||||||||||||||||
| 4737 | tabWidget = w->parentWidget(); never executed: tabWidget = w->parentWidget(); | 0 | ||||||||||||||||||||||||||||||
| 4738 | if (hasStyleRule(tabWidget, PseudoElement_TabWidgetPane)) {
| 0 | ||||||||||||||||||||||||||||||
| 4739 | return 0; never executed: return 0; | 0 | ||||||||||||||||||||||||||||||
| 4740 | } | - | ||||||||||||||||||||||||||||||
| 4741 | break; never executed: break; | 0 | ||||||||||||||||||||||||||||||
| 4742 | } | - | ||||||||||||||||||||||||||||||
| 4743 | #endif // QT_NO_TABWIDGET | - | ||||||||||||||||||||||||||||||
| 4744 | - | |||||||||||||||||||||||||||||||
| 4745 | case PM_SliderThickness: // horizontal slider's height (sizeHint) never executed: case PM_SliderThickness: | 0 | ||||||||||||||||||||||||||||||
| 4746 | case PM_SliderLength: // minimum length of slider never executed: case PM_SliderLength: | 0 | ||||||||||||||||||||||||||||||
| 4747 | if (rule.hasContentsSize()) {
| 0 | ||||||||||||||||||||||||||||||
| 4748 | bool horizontal = opt->state & QStyle::State_Horizontal; | - | ||||||||||||||||||||||||||||||
| 4749 | if (m == PM_SliderThickness) {
| 0 | ||||||||||||||||||||||||||||||
| 4750 | QSize sz = rule.size(); | - | ||||||||||||||||||||||||||||||
| 4751 | return horizontal ? sz.height() : sz.width(); never executed: return horizontal ? sz.height() : sz.width();
| 0 | ||||||||||||||||||||||||||||||
| 4752 | } else { | - | ||||||||||||||||||||||||||||||
| 4753 | QSize msz = rule.minimumContentsSize(); | - | ||||||||||||||||||||||||||||||
| 4754 | return horizontal ? msz.width() : msz.height(); never executed: return horizontal ? msz.width() : msz.height();
| 0 | ||||||||||||||||||||||||||||||
| 4755 | } | - | ||||||||||||||||||||||||||||||
| 4756 | } | - | ||||||||||||||||||||||||||||||
| 4757 | break; never executed: break; | 0 | ||||||||||||||||||||||||||||||
| 4758 | - | |||||||||||||||||||||||||||||||
| 4759 | case PM_SliderControlThickness: { never executed: case PM_SliderControlThickness: | 0 | ||||||||||||||||||||||||||||||
| 4760 | QRenderRule subRule = renderRule(w, opt, PseudoElement_SliderHandle); | - | ||||||||||||||||||||||||||||||
| 4761 | if (!subRule.hasContentsSize())
| 0 | ||||||||||||||||||||||||||||||
| 4762 | break; never executed: break; | 0 | ||||||||||||||||||||||||||||||
| 4763 | QSize size = subRule.size(); | - | ||||||||||||||||||||||||||||||
| 4764 | return (opt->state & QStyle::State_Horizontal) ? size.height() : size.width(); never executed: return (opt->state & QStyle::State_Horizontal) ? size.height() : size.width();
| 0 | ||||||||||||||||||||||||||||||
| 4765 | } | - | ||||||||||||||||||||||||||||||
| 4766 | - | |||||||||||||||||||||||||||||||
| 4767 | case PM_ToolBarIconSize: never executed: case PM_ToolBarIconSize: | 0 | ||||||||||||||||||||||||||||||
| 4768 | case PM_ListViewIconSize: never executed: case PM_ListViewIconSize: | 0 | ||||||||||||||||||||||||||||||
| 4769 | case PM_IconViewIconSize: never executed: case PM_IconViewIconSize: | 0 | ||||||||||||||||||||||||||||||
| 4770 | case PM_TabBarIconSize: never executed: case PM_TabBarIconSize: | 0 | ||||||||||||||||||||||||||||||
| 4771 | case PM_MessageBoxIconSize: never executed: case PM_MessageBoxIconSize: | 0 | ||||||||||||||||||||||||||||||
| 4772 | case PM_ButtonIconSize: never executed: case PM_ButtonIconSize: | 0 | ||||||||||||||||||||||||||||||
| 4773 | case PM_SmallIconSize: never executed: case PM_SmallIconSize: | 0 | ||||||||||||||||||||||||||||||
| 4774 | if (rule.hasStyleHint(QLatin1String("icon-size"))) {
| 0 | ||||||||||||||||||||||||||||||
| 4775 | return rule.styleHint(QLatin1String("icon-size")).toSize().width(); never executed: return rule.styleHint(QLatin1String("icon-size")).toSize().width(); | 0 | ||||||||||||||||||||||||||||||
| 4776 | } | - | ||||||||||||||||||||||||||||||
| 4777 | break; never executed: break; | 0 | ||||||||||||||||||||||||||||||
| 4778 | - | |||||||||||||||||||||||||||||||
| 4779 | case PM_DockWidgetTitleMargin: { never executed: case PM_DockWidgetTitleMargin: | 0 | ||||||||||||||||||||||||||||||
| 4780 | QRenderRule subRule = renderRule(w, opt, PseudoElement_DockWidgetTitle); | - | ||||||||||||||||||||||||||||||
| 4781 | if (!subRule.hasBox())
| 0 | ||||||||||||||||||||||||||||||
| 4782 | break; never executed: break; | 0 | ||||||||||||||||||||||||||||||
| 4783 | return (subRule.border() ? subRule.border()->borders[TopEdge] : 0) never executed: return (subRule.border() ? subRule.border()->borders[TopEdge] : 0) + (subRule.hasBox() ? subRule.box()->margins[TopEdge] + subRule.box()->paddings[TopEdge]: 0);
| 0 | ||||||||||||||||||||||||||||||
| 4784 | + (subRule.hasBox() ? subRule.box()->margins[TopEdge] + subRule.box()->paddings[TopEdge]: 0); never executed: return (subRule.border() ? subRule.border()->borders[TopEdge] : 0) + (subRule.hasBox() ? subRule.box()->margins[TopEdge] + subRule.box()->paddings[TopEdge]: 0);
| 0 | ||||||||||||||||||||||||||||||
| 4785 | } | - | ||||||||||||||||||||||||||||||
| 4786 | - | |||||||||||||||||||||||||||||||
| 4787 | case PM_DockWidgetSeparatorExtent: { never executed: case PM_DockWidgetSeparatorExtent: | 0 | ||||||||||||||||||||||||||||||
| 4788 | QRenderRule subRule = renderRule(w, opt, PseudoElement_DockWidgetSeparator); | - | ||||||||||||||||||||||||||||||
| 4789 | if (!subRule.hasContentsSize())
| 0 | ||||||||||||||||||||||||||||||
| 4790 | break; never executed: break; | 0 | ||||||||||||||||||||||||||||||
| 4791 | QSize sz = subRule.size(); | - | ||||||||||||||||||||||||||||||
| 4792 | return qMax(sz.width(), sz.height()); never executed: return qMax(sz.width(), sz.height()); | 0 | ||||||||||||||||||||||||||||||
| 4793 | } | - | ||||||||||||||||||||||||||||||
| 4794 | - | |||||||||||||||||||||||||||||||
| 4795 | case PM_TitleBarHeight: { never executed: case PM_TitleBarHeight: | 0 | ||||||||||||||||||||||||||||||
| 4796 | QRenderRule subRule = renderRule(w, opt, PseudoElement_TitleBar); | - | ||||||||||||||||||||||||||||||
| 4797 | if (subRule.hasContentsSize())
| 0 | ||||||||||||||||||||||||||||||
| 4798 | return subRule.size().height(); never executed: return subRule.size().height(); | 0 | ||||||||||||||||||||||||||||||
| 4799 | else if (subRule.hasBox() || subRule.hasBorder()) {
| 0 | ||||||||||||||||||||||||||||||
| 4800 | QFontMetrics fm = opt ? opt->fontMetrics : w->fontMetrics();
| 0 | ||||||||||||||||||||||||||||||
| 4801 | return subRule.size(QSize(0, fm.height())).height(); never executed: return subRule.size(QSize(0, fm.height())).height(); | 0 | ||||||||||||||||||||||||||||||
| 4802 | } | - | ||||||||||||||||||||||||||||||
| 4803 | break; never executed: break; | 0 | ||||||||||||||||||||||||||||||
| 4804 | } | - | ||||||||||||||||||||||||||||||
| 4805 | - | |||||||||||||||||||||||||||||||
| 4806 | case PM_MdiSubWindowFrameWidth: never executed: case PM_MdiSubWindowFrameWidth: | 0 | ||||||||||||||||||||||||||||||
| 4807 | if (rule.hasBox() || rule.hasBorder()) {
| 0 | ||||||||||||||||||||||||||||||
| 4808 | return (rule.border() ? rule.border()->borders[LeftEdge] : 0) never executed: return (rule.border() ? rule.border()->borders[LeftEdge] : 0) + (rule.hasBox() ? rule.box()->paddings[LeftEdge]+rule.box()->margins[LeftEdge]: 0);
| 0 | ||||||||||||||||||||||||||||||
| 4809 | + (rule.hasBox() ? rule.box()->paddings[LeftEdge]+rule.box()->margins[LeftEdge]: 0); never executed: return (rule.border() ? rule.border()->borders[LeftEdge] : 0) + (rule.hasBox() ? rule.box()->paddings[LeftEdge]+rule.box()->margins[LeftEdge]: 0);
| 0 | ||||||||||||||||||||||||||||||
| 4810 | } | - | ||||||||||||||||||||||||||||||
| 4811 | break; never executed: break; | 0 | ||||||||||||||||||||||||||||||
| 4812 | - | |||||||||||||||||||||||||||||||
| 4813 | case PM_MdiSubWindowMinimizedWidth: { never executed: case PM_MdiSubWindowMinimizedWidth: | 0 | ||||||||||||||||||||||||||||||
| 4814 | QRenderRule subRule = renderRule(w, PseudoElement_None, PseudoClass_Minimized); | - | ||||||||||||||||||||||||||||||
| 4815 | int width = subRule.size().width(); | - | ||||||||||||||||||||||||||||||
| 4816 | if (width != -1)
| 0 | ||||||||||||||||||||||||||||||
| 4817 | return width; never executed: return width; | 0 | ||||||||||||||||||||||||||||||
| 4818 | break; never executed: break; | 0 | ||||||||||||||||||||||||||||||
| 4819 | } | - | ||||||||||||||||||||||||||||||
| 4820 | default: never executed: default: | 0 | ||||||||||||||||||||||||||||||
| 4821 | break; never executed: break; | 0 | ||||||||||||||||||||||||||||||
| 4822 | } | - | ||||||||||||||||||||||||||||||
| 4823 | - | |||||||||||||||||||||||||||||||
| 4824 | return baseStyle()->pixelMetric(m, opt, w); never executed: return baseStyle()->pixelMetric(m, opt, w); | 0 | ||||||||||||||||||||||||||||||
| 4825 | } | - | ||||||||||||||||||||||||||||||
| 4826 | - | |||||||||||||||||||||||||||||||
| 4827 | QSize QStyleSheetStyle::sizeFromContents(ContentsType ct, const QStyleOption *opt, | - | ||||||||||||||||||||||||||||||
| 4828 | const QSize &csz, const QWidget *w) const | - | ||||||||||||||||||||||||||||||
| 4829 | { | - | ||||||||||||||||||||||||||||||
| 4830 | RECURSION_GUARD(return baseStyle()->sizeFromContents(ct, opt, csz, w)) never executed: return baseStyle()->sizeFromContents(ct, opt, csz, w);
| 0 | ||||||||||||||||||||||||||||||
| 4831 | - | |||||||||||||||||||||||||||||||
| 4832 | QRenderRule rule = renderRule(w, opt); | - | ||||||||||||||||||||||||||||||
| 4833 | QSize sz = rule.adjustSize(csz); | - | ||||||||||||||||||||||||||||||
| 4834 | - | |||||||||||||||||||||||||||||||
| 4835 | switch (ct) { | - | ||||||||||||||||||||||||||||||
| 4836 | case CT_SpinBox: // ### hopelessly broken QAbstractSpinBox (part 1) never executed: case CT_SpinBox: | 0 | ||||||||||||||||||||||||||||||
| 4837 | if (const QStyleOptionSpinBox *spinbox = qstyleoption_cast<const QStyleOptionSpinBox *>(opt)) {
| 0 | ||||||||||||||||||||||||||||||
| 4838 | // Add some space for the up/down buttons | - | ||||||||||||||||||||||||||||||
| 4839 | QRenderRule subRule = renderRule(w, opt, PseudoElement_SpinBoxUpButton); | - | ||||||||||||||||||||||||||||||
| 4840 | if (subRule.hasDrawable()) {
| 0 | ||||||||||||||||||||||||||||||
| 4841 | QRect r = positionRect(w, rule, subRule, PseudoElement_SpinBoxUpButton, | - | ||||||||||||||||||||||||||||||
| 4842 | opt->rect, opt->direction); | - | ||||||||||||||||||||||||||||||
| 4843 | sz += QSize(r.width(), 0); | - | ||||||||||||||||||||||||||||||
| 4844 | } else { never executed: end of block | 0 | ||||||||||||||||||||||||||||||
| 4845 | QSize defaultUpSize = defaultSize(w, subRule.size(), spinbox->rect, PseudoElement_SpinBoxUpButton); | - | ||||||||||||||||||||||||||||||
| 4846 | sz += QSize(defaultUpSize.width(), 0); | - | ||||||||||||||||||||||||||||||
| 4847 | } never executed: end of block | 0 | ||||||||||||||||||||||||||||||
| 4848 | if (rule.hasBox() || rule.hasBorder() || !rule.hasNativeBorder())
| 0 | ||||||||||||||||||||||||||||||
| 4849 | sz = rule.boxSize(sz); never executed: sz = rule.boxSize(sz); | 0 | ||||||||||||||||||||||||||||||
| 4850 | return sz; never executed: return sz; | 0 | ||||||||||||||||||||||||||||||
| 4851 | } | - | ||||||||||||||||||||||||||||||
| 4852 | break; never executed: break; | 0 | ||||||||||||||||||||||||||||||
| 4853 | case CT_ToolButton: never executed: case CT_ToolButton: | 0 | ||||||||||||||||||||||||||||||
| 4854 | if (rule.hasBox() || !rule.hasNativeBorder() || !rule.baseStyleCanDraw())
| 0 | ||||||||||||||||||||||||||||||
| 4855 | sz += QSize(3, 3); // ### broken QToolButton never executed: sz += QSize(3, 3); | 0 | ||||||||||||||||||||||||||||||
| 4856 | //fall thought | - | ||||||||||||||||||||||||||||||
| 4857 | case CT_ComboBox: code before this statement never executed: case CT_ComboBox:never executed: case CT_ComboBox: | 0 | ||||||||||||||||||||||||||||||
| 4858 | case CT_PushButton: never executed: case CT_PushButton: | 0 | ||||||||||||||||||||||||||||||
| 4859 | if (rule.hasBox() || !rule.hasNativeBorder()) {
| 0 | ||||||||||||||||||||||||||||||
| 4860 | if(ct == CT_ComboBox) {
| 0 | ||||||||||||||||||||||||||||||
| 4861 | //add some space for the drop down. | - | ||||||||||||||||||||||||||||||
| 4862 | QRenderRule subRule = renderRule(w, opt, PseudoElement_ComboBoxDropDown); | - | ||||||||||||||||||||||||||||||
| 4863 | QRect comboRect = positionRect(w, rule, subRule, PseudoElement_ComboBoxDropDown, opt->rect, opt->direction); | - | ||||||||||||||||||||||||||||||
| 4864 | //+2 because there is hardcoded margins in QCommonStyle::drawControl(CE_ComboBoxLabel) | - | ||||||||||||||||||||||||||||||
| 4865 | sz += QSize(comboRect.width() + 2, 0); | - | ||||||||||||||||||||||||||||||
| 4866 | } never executed: end of block | 0 | ||||||||||||||||||||||||||||||
| 4867 | return rule.boxSize(sz); never executed: return rule.boxSize(sz); | 0 | ||||||||||||||||||||||||||||||
| 4868 | } | - | ||||||||||||||||||||||||||||||
| 4869 | sz = rule.baseStyleCanDraw() ? baseStyle()->sizeFromContents(ct, opt, sz, w)
| 0 | ||||||||||||||||||||||||||||||
| 4870 | : QWindowsStyle::sizeFromContents(ct, opt, sz, w); | - | ||||||||||||||||||||||||||||||
| 4871 | return rule.boxSize(sz, Margin); never executed: return rule.boxSize(sz, Margin); | 0 | ||||||||||||||||||||||||||||||
| 4872 | - | |||||||||||||||||||||||||||||||
| 4873 | case CT_HeaderSection: { never executed: case CT_HeaderSection: | 0 | ||||||||||||||||||||||||||||||
| 4874 | if (const QStyleOptionHeader *hdr = qstyleoption_cast<const QStyleOptionHeader *>(opt)) {
| 0 | ||||||||||||||||||||||||||||||
| 4875 | QRenderRule subRule = renderRule(w, opt, PseudoElement_HeaderViewSection); | - | ||||||||||||||||||||||||||||||
| 4876 | if (subRule.hasGeometry() || subRule.hasBox() || !subRule.hasNativeBorder() || subRule.hasFont) {
| 0 | ||||||||||||||||||||||||||||||
| 4877 | sz = subRule.adjustSize(csz); | - | ||||||||||||||||||||||||||||||
| 4878 | if (!subRule.hasGeometry()) {
| 0 | ||||||||||||||||||||||||||||||
| 4879 | QSize nativeContentsSize; | - | ||||||||||||||||||||||||||||||
| 4880 | bool nullIcon = hdr->icon.isNull(); | - | ||||||||||||||||||||||||||||||
| 4881 | int iconSize = nullIcon ? 0 : pixelMetric(QStyle::PM_SmallIconSize, hdr, w);
| 0 | ||||||||||||||||||||||||||||||
| 4882 | const QSize txt = subRule.hasFont ? QFontMetrics(subRule.font).size(0, hdr->text)
| 0 | ||||||||||||||||||||||||||||||
| 4883 | : hdr->fontMetrics.size(0, hdr->text); | - | ||||||||||||||||||||||||||||||
| 4884 | nativeContentsSize.setHeight(qMax(iconSize, txt.height())); | - | ||||||||||||||||||||||||||||||
| 4885 | nativeContentsSize.setWidth(iconSize + txt.width()); | - | ||||||||||||||||||||||||||||||
| 4886 | sz = sz.expandedTo(nativeContentsSize); | - | ||||||||||||||||||||||||||||||
| 4887 | } never executed: end of block | 0 | ||||||||||||||||||||||||||||||
| 4888 | return subRule.size(sz); never executed: return subRule.size(sz); | 0 | ||||||||||||||||||||||||||||||
| 4889 | } | - | ||||||||||||||||||||||||||||||
| 4890 | return subRule.baseStyleCanDraw() ? baseStyle()->sizeFromContents(ct, opt, sz, w) never executed: return subRule.baseStyleCanDraw() ? baseStyle()->sizeFromContents(ct, opt, sz, w) : QWindowsStyle::sizeFromContents(ct, opt, sz, w);
| 0 | ||||||||||||||||||||||||||||||
| 4891 | : QWindowsStyle::sizeFromContents(ct, opt, sz, w); never executed: return subRule.baseStyleCanDraw() ? baseStyle()->sizeFromContents(ct, opt, sz, w) : QWindowsStyle::sizeFromContents(ct, opt, sz, w); | 0 | ||||||||||||||||||||||||||||||
| 4892 | } | - | ||||||||||||||||||||||||||||||
| 4893 | } | - | ||||||||||||||||||||||||||||||
| 4894 | break; never executed: break; | 0 | ||||||||||||||||||||||||||||||
| 4895 | case CT_GroupBox: never executed: case CT_GroupBox: | 0 | ||||||||||||||||||||||||||||||
| 4896 | case CT_LineEdit: never executed: case CT_LineEdit: | 0 | ||||||||||||||||||||||||||||||
| 4897 | #ifndef QT_NO_SPINBOX | - | ||||||||||||||||||||||||||||||
| 4898 | if (qobject_cast<QAbstractSpinBox *>(w ? w->parentWidget() : 0))
| 0 | ||||||||||||||||||||||||||||||
| 4899 | return csz; // we only care about the size hint of the line edit never executed: return csz; | 0 | ||||||||||||||||||||||||||||||
| 4900 | #endif | - | ||||||||||||||||||||||||||||||
| 4901 | if (rule.hasBox() || !rule.hasNativeBorder()) {
| 0 | ||||||||||||||||||||||||||||||
| 4902 | return rule.boxSize(sz); never executed: return rule.boxSize(sz); | 0 | ||||||||||||||||||||||||||||||
| 4903 | } | - | ||||||||||||||||||||||||||||||
| 4904 | break; never executed: break; | 0 | ||||||||||||||||||||||||||||||
| 4905 | - | |||||||||||||||||||||||||||||||
| 4906 | case CT_CheckBox: never executed: case CT_CheckBox: | 0 | ||||||||||||||||||||||||||||||
| 4907 | case CT_RadioButton: never executed: case CT_RadioButton: | 0 | ||||||||||||||||||||||||||||||
| 4908 | if (const QStyleOptionButton *btn = qstyleoption_cast<const QStyleOptionButton *>(opt)) {
| 0 | ||||||||||||||||||||||||||||||
| 4909 | if (rule.hasBox() || rule.hasBorder() || hasStyleRule(w, PseudoElement_Indicator)) {
| 0 | ||||||||||||||||||||||||||||||
| 4910 | bool isRadio = (ct == CT_RadioButton); | - | ||||||||||||||||||||||||||||||
| 4911 | int iw = pixelMetric(isRadio ? PM_ExclusiveIndicatorWidth | - | ||||||||||||||||||||||||||||||
| 4912 | : PM_IndicatorWidth, btn, w); | - | ||||||||||||||||||||||||||||||
| 4913 | int ih = pixelMetric(isRadio ? PM_ExclusiveIndicatorHeight | - | ||||||||||||||||||||||||||||||
| 4914 | : PM_IndicatorHeight, btn, w); | - | ||||||||||||||||||||||||||||||
| 4915 | - | |||||||||||||||||||||||||||||||
| 4916 | int spacing = pixelMetric(isRadio ? PM_RadioButtonLabelSpacing | - | ||||||||||||||||||||||||||||||
| 4917 | : PM_CheckBoxLabelSpacing, btn, w); | - | ||||||||||||||||||||||||||||||
| 4918 | sz.setWidth(sz.width() + iw + spacing); | - | ||||||||||||||||||||||||||||||
| 4919 | sz.setHeight(qMax(sz.height(), ih)); | - | ||||||||||||||||||||||||||||||
| 4920 | return rule.boxSize(sz); never executed: return rule.boxSize(sz); | 0 | ||||||||||||||||||||||||||||||
| 4921 | } | - | ||||||||||||||||||||||||||||||
| 4922 | } never executed: end of block | 0 | ||||||||||||||||||||||||||||||
| 4923 | break; never executed: break; | 0 | ||||||||||||||||||||||||||||||
| 4924 | - | |||||||||||||||||||||||||||||||
| 4925 | case CT_Menu: never executed: case CT_Menu: | 0 | ||||||||||||||||||||||||||||||
| 4926 | case CT_MenuBar: // already has everything! never executed: case CT_MenuBar: | 0 | ||||||||||||||||||||||||||||||
| 4927 | case CT_ScrollBar: never executed: case CT_ScrollBar: | 0 | ||||||||||||||||||||||||||||||
| 4928 | if (rule.hasBox() || rule.hasBorder())
| 0 | ||||||||||||||||||||||||||||||
| 4929 | return sz; never executed: return sz; | 0 | ||||||||||||||||||||||||||||||
| 4930 | break; never executed: break; | 0 | ||||||||||||||||||||||||||||||
| 4931 | - | |||||||||||||||||||||||||||||||
| 4932 | case CT_MenuItem: never executed: case CT_MenuItem: | 0 | ||||||||||||||||||||||||||||||
| 4933 | if (const QStyleOptionMenuItem *mi = qstyleoption_cast<const QStyleOptionMenuItem *>(opt)) {
| 0 | ||||||||||||||||||||||||||||||
| 4934 | PseudoElement pe = (mi->menuItemType == QStyleOptionMenuItem::Separator)
| 0 | ||||||||||||||||||||||||||||||
| 4935 | ? PseudoElement_MenuSeparator : PseudoElement_Item; | - | ||||||||||||||||||||||||||||||
| 4936 | QRenderRule subRule = renderRule(w, opt, pe); | - | ||||||||||||||||||||||||||||||
| 4937 | if ((pe == PseudoElement_MenuSeparator) && subRule.hasContentsSize()) {
| 0 | ||||||||||||||||||||||||||||||
| 4938 | return QSize(sz.width(), subRule.size().height()); never executed: return QSize(sz.width(), subRule.size().height()); | 0 | ||||||||||||||||||||||||||||||
| 4939 | } else if ((pe == PseudoElement_Item) && (subRule.hasBox() || subRule.hasBorder())) {
| 0 | ||||||||||||||||||||||||||||||
| 4940 | int width = csz.width(); | - | ||||||||||||||||||||||||||||||
| 4941 | if (mi->text.contains(QLatin1Char('\t')))
| 0 | ||||||||||||||||||||||||||||||
| 4942 | width += 12; //as in QCommonStyle never executed: width += 12; | 0 | ||||||||||||||||||||||||||||||
| 4943 | return subRule.boxSize(subRule.adjustSize(QSize(width, csz.height()))); never executed: return subRule.boxSize(subRule.adjustSize(QSize(width, csz.height()))); | 0 | ||||||||||||||||||||||||||||||
| 4944 | } | - | ||||||||||||||||||||||||||||||
| 4945 | } never executed: end of block | 0 | ||||||||||||||||||||||||||||||
| 4946 | break; never executed: break; | 0 | ||||||||||||||||||||||||||||||
| 4947 | - | |||||||||||||||||||||||||||||||
| 4948 | case CT_Splitter: never executed: case CT_Splitter: | 0 | ||||||||||||||||||||||||||||||
| 4949 | case CT_MenuBarItem: { never executed: case CT_MenuBarItem: | 0 | ||||||||||||||||||||||||||||||
| 4950 | PseudoElement pe = (ct == CT_Splitter) ? PseudoElement_SplitterHandle : PseudoElement_Item;
| 0 | ||||||||||||||||||||||||||||||
| 4951 | QRenderRule subRule = renderRule(w, opt, pe); | - | ||||||||||||||||||||||||||||||
| 4952 | if (subRule.hasBox() || subRule.hasBorder())
| 0 | ||||||||||||||||||||||||||||||
| 4953 | return subRule.boxSize(sz); never executed: return subRule.boxSize(sz); | 0 | ||||||||||||||||||||||||||||||
| 4954 | break; never executed: break; | 0 | ||||||||||||||||||||||||||||||
| 4955 | } | - | ||||||||||||||||||||||||||||||
| 4956 | - | |||||||||||||||||||||||||||||||
| 4957 | case CT_ProgressBar: never executed: case CT_ProgressBar: | 0 | ||||||||||||||||||||||||||||||
| 4958 | case CT_SizeGrip: never executed: case CT_SizeGrip: | 0 | ||||||||||||||||||||||||||||||
| 4959 | return (rule.hasContentsSize()) never executed: return (rule.hasContentsSize()) ? rule.size(sz) : rule.boxSize(baseStyle()->sizeFromContents(ct, opt, sz, w));
| 0 | ||||||||||||||||||||||||||||||
| 4960 | ? rule.size(sz) never executed: return (rule.hasContentsSize()) ? rule.size(sz) : rule.boxSize(baseStyle()->sizeFromContents(ct, opt, sz, w)); | 0 | ||||||||||||||||||||||||||||||
| 4961 | : rule.boxSize(baseStyle()->sizeFromContents(ct, opt, sz, w)); never executed: return (rule.hasContentsSize()) ? rule.size(sz) : rule.boxSize(baseStyle()->sizeFromContents(ct, opt, sz, w)); | 0 | ||||||||||||||||||||||||||||||
| 4962 | break; dead code: break; | - | ||||||||||||||||||||||||||||||
| 4963 | - | |||||||||||||||||||||||||||||||
| 4964 | case CT_Slider: never executed: case CT_Slider: | 0 | ||||||||||||||||||||||||||||||
| 4965 | if (rule.hasBorder() || rule.hasBox() || rule.hasGeometry())
| 0 | ||||||||||||||||||||||||||||||
| 4966 | return rule.boxSize(sz); never executed: return rule.boxSize(sz); | 0 | ||||||||||||||||||||||||||||||
| 4967 | break; never executed: break; | 0 | ||||||||||||||||||||||||||||||
| 4968 | - | |||||||||||||||||||||||||||||||
| 4969 | #ifndef QT_NO_TABBAR | - | ||||||||||||||||||||||||||||||
| 4970 | case CT_TabBarTab: { never executed: case CT_TabBarTab: | 0 | ||||||||||||||||||||||||||||||
| 4971 | QRenderRule subRule = renderRule(w, opt, PseudoElement_TabBarTab); | - | ||||||||||||||||||||||||||||||
| 4972 | if (subRule.hasBox() || !subRule.hasNativeBorder()) {
| 0 | ||||||||||||||||||||||||||||||
| 4973 | int spaceForIcon = 0; | - | ||||||||||||||||||||||||||||||
| 4974 | bool vertical = false; | - | ||||||||||||||||||||||||||||||
| 4975 | if (const QStyleOptionTab *tab = qstyleoption_cast<const QStyleOptionTab *>(opt)) {
| 0 | ||||||||||||||||||||||||||||||
| 4976 | if (!tab->icon.isNull())
| 0 | ||||||||||||||||||||||||||||||
| 4977 | spaceForIcon = 6 /* icon offset */ + 4 /* spacing */ + 2 /* magic */; // ###: hardcoded to match with common style never executed: spaceForIcon = 6 + 4 + 2 ; | 0 | ||||||||||||||||||||||||||||||
| 4978 | vertical = verticalTabs(tab->shape); | - | ||||||||||||||||||||||||||||||
| 4979 | } never executed: end of block | 0 | ||||||||||||||||||||||||||||||
| 4980 | sz = csz + QSize(vertical ? 0 : spaceForIcon, vertical ? spaceForIcon : 0); | - | ||||||||||||||||||||||||||||||
| 4981 | return subRule.boxSize(subRule.adjustSize(sz)); never executed: return subRule.boxSize(subRule.adjustSize(sz)); | 0 | ||||||||||||||||||||||||||||||
| 4982 | } | - | ||||||||||||||||||||||||||||||
| 4983 | #ifdef Q_DEAD_CODE_FROM_QT4_MAC | - | ||||||||||||||||||||||||||||||
| 4984 | if (baseStyle()->inherits("QMacStyle")) { | - | ||||||||||||||||||||||||||||||
| 4985 | //adjust the size after the call to the style because the mac style ignore the size arguments anyway. | - | ||||||||||||||||||||||||||||||
| 4986 | //this might cause the (max-){width,height} property to include the native style border while they should not. | - | ||||||||||||||||||||||||||||||
| 4987 | return subRule.adjustSize(baseStyle()->sizeFromContents(ct, opt, csz, w)); | - | ||||||||||||||||||||||||||||||
| 4988 | } | - | ||||||||||||||||||||||||||||||
| 4989 | #endif | - | ||||||||||||||||||||||||||||||
| 4990 | sz = subRule.adjustSize(csz); | - | ||||||||||||||||||||||||||||||
| 4991 | break; never executed: break; | 0 | ||||||||||||||||||||||||||||||
| 4992 | } | - | ||||||||||||||||||||||||||||||
| 4993 | #endif // QT_NO_TABBAR | - | ||||||||||||||||||||||||||||||
| 4994 | - | |||||||||||||||||||||||||||||||
| 4995 | case CT_MdiControls: never executed: case CT_MdiControls: | 0 | ||||||||||||||||||||||||||||||
| 4996 | if (const QStyleOptionComplex *ccOpt = qstyleoption_cast<const QStyleOptionComplex *>(opt)) {
| 0 | ||||||||||||||||||||||||||||||
| 4997 | if (!hasStyleRule(w, PseudoElement_MdiCloseButton)
| 0 | ||||||||||||||||||||||||||||||
| 4998 | && !hasStyleRule(w, PseudoElement_MdiNormalButton)
| 0 | ||||||||||||||||||||||||||||||
| 4999 | && !hasStyleRule(w, PseudoElement_MdiMinButton))
| 0 | ||||||||||||||||||||||||||||||
| 5000 | break; never executed: break; | 0 | ||||||||||||||||||||||||||||||
| 5001 | - | |||||||||||||||||||||||||||||||
| 5002 | QList<QVariant> layout = rule.styleHint(QLatin1String("button-layout")).toList(); | - | ||||||||||||||||||||||||||||||
| 5003 | if (layout.isEmpty())
| 0 | ||||||||||||||||||||||||||||||
| 5004 | layout = subControlLayout(QLatin1String("mNX")); never executed: layout = subControlLayout(QLatin1String("mNX")); | 0 | ||||||||||||||||||||||||||||||
| 5005 | - | |||||||||||||||||||||||||||||||
| 5006 | int width = 0, height = 0; | - | ||||||||||||||||||||||||||||||
| 5007 | for (int i = 0; i < layout.count(); i++) {
| 0 | ||||||||||||||||||||||||||||||
| 5008 | int layoutButton = layout[i].toInt(); | - | ||||||||||||||||||||||||||||||
| 5009 | if (layoutButton < PseudoElement_MdiCloseButton
| 0 | ||||||||||||||||||||||||||||||
| 5010 | || layoutButton > PseudoElement_MdiNormalButton)
| 0 | ||||||||||||||||||||||||||||||
| 5011 | continue; never executed: continue; | 0 | ||||||||||||||||||||||||||||||
| 5012 | QStyle::SubControl sc = knownPseudoElements[layoutButton].subControl; | - | ||||||||||||||||||||||||||||||
| 5013 | if (!(ccOpt->subControls & sc))
| 0 | ||||||||||||||||||||||||||||||
| 5014 | continue; never executed: continue; | 0 | ||||||||||||||||||||||||||||||
| 5015 | QRenderRule subRule = renderRule(w, opt, layoutButton); | - | ||||||||||||||||||||||||||||||
| 5016 | QSize sz = subRule.size(); | - | ||||||||||||||||||||||||||||||
| 5017 | width += sz.width(); | - | ||||||||||||||||||||||||||||||
| 5018 | height = qMax(height, sz.height()); | - | ||||||||||||||||||||||||||||||
| 5019 | } never executed: end of block | 0 | ||||||||||||||||||||||||||||||
| 5020 | - | |||||||||||||||||||||||||||||||
| 5021 | return QSize(width, height); never executed: return QSize(width, height); | 0 | ||||||||||||||||||||||||||||||
| 5022 | } | - | ||||||||||||||||||||||||||||||
| 5023 | break; never executed: break; | 0 | ||||||||||||||||||||||||||||||
| 5024 | - | |||||||||||||||||||||||||||||||
| 5025 | #ifndef QT_NO_ITEMVIEWS | - | ||||||||||||||||||||||||||||||
| 5026 | case CT_ItemViewItem: { never executed: case CT_ItemViewItem: | 0 | ||||||||||||||||||||||||||||||
| 5027 | QRenderRule subRule = renderRule(w, opt, PseudoElement_ViewItem); | - | ||||||||||||||||||||||||||||||
| 5028 | sz = baseStyle()->sizeFromContents(ct, opt, csz, w); | - | ||||||||||||||||||||||||||||||
| 5029 | sz = subRule.adjustSize(sz); | - | ||||||||||||||||||||||||||||||
| 5030 | if (subRule.hasBox() || subRule.hasBorder())
| 0 | ||||||||||||||||||||||||||||||
| 5031 | sz = subRule.boxSize(sz); never executed: sz = subRule.boxSize(sz); | 0 | ||||||||||||||||||||||||||||||
| 5032 | return sz; never executed: return sz; | 0 | ||||||||||||||||||||||||||||||
| 5033 | } | - | ||||||||||||||||||||||||||||||
| 5034 | #endif // QT_NO_ITEMVIEWS | - | ||||||||||||||||||||||||||||||
| 5035 | - | |||||||||||||||||||||||||||||||
| 5036 | default: never executed: default: | 0 | ||||||||||||||||||||||||||||||
| 5037 | break; never executed: break; | 0 | ||||||||||||||||||||||||||||||
| 5038 | } | - | ||||||||||||||||||||||||||||||
| 5039 | - | |||||||||||||||||||||||||||||||
| 5040 | return baseStyle()->sizeFromContents(ct, opt, sz, w); never executed: return baseStyle()->sizeFromContents(ct, opt, sz, w); | 0 | ||||||||||||||||||||||||||||||
| 5041 | } | - | ||||||||||||||||||||||||||||||
| 5042 | - | |||||||||||||||||||||||||||||||
| 5043 | /*! | - | ||||||||||||||||||||||||||||||
| 5044 | \internal | - | ||||||||||||||||||||||||||||||
| 5045 | */ | - | ||||||||||||||||||||||||||||||
| 5046 | static QLatin1String propertyNameForStandardPixmap(QStyle::StandardPixmap sp) | - | ||||||||||||||||||||||||||||||
| 5047 | { | - | ||||||||||||||||||||||||||||||
| 5048 | switch (sp) { | - | ||||||||||||||||||||||||||||||
| 5049 | case QStyle::SP_TitleBarMenuButton: return QLatin1String("titlebar-menu-icon"); never executed: return QLatin1String("titlebar-menu-icon");never executed: case QStyle::SP_TitleBarMenuButton: | 0 | ||||||||||||||||||||||||||||||
| 5050 | case QStyle::SP_TitleBarMinButton: return QLatin1String("titlebar-minimize-icon"); never executed: return QLatin1String("titlebar-minimize-icon");never executed: case QStyle::SP_TitleBarMinButton: | 0 | ||||||||||||||||||||||||||||||
| 5051 | case QStyle::SP_TitleBarMaxButton: return QLatin1String("titlebar-maximize-icon"); never executed: return QLatin1String("titlebar-maximize-icon");never executed: case QStyle::SP_TitleBarMaxButton: | 0 | ||||||||||||||||||||||||||||||
| 5052 | case QStyle::SP_TitleBarCloseButton: return QLatin1String("titlebar-close-icon"); never executed: return QLatin1String("titlebar-close-icon");never executed: case QStyle::SP_TitleBarCloseButton: | 0 | ||||||||||||||||||||||||||||||
| 5053 | case QStyle::SP_TitleBarNormalButton: return QLatin1String("titlebar-normal-icon"); never executed: return QLatin1String("titlebar-normal-icon");never executed: case QStyle::SP_TitleBarNormalButton: | 0 | ||||||||||||||||||||||||||||||
| 5054 | case QStyle::SP_TitleBarShadeButton: return QLatin1String("titlebar-shade-icon"); never executed: return QLatin1String("titlebar-shade-icon");never executed: case QStyle::SP_TitleBarShadeButton: | 0 | ||||||||||||||||||||||||||||||
| 5055 | case QStyle::SP_TitleBarUnshadeButton: return QLatin1String("titlebar-unshade-icon"); never executed: return QLatin1String("titlebar-unshade-icon");never executed: case QStyle::SP_TitleBarUnshadeButton: | 0 | ||||||||||||||||||||||||||||||
| 5056 | case QStyle::SP_TitleBarContextHelpButton: return QLatin1String("titlebar-contexthelp-icon"); never executed: return QLatin1String("titlebar-contexthelp-icon");never executed: case QStyle::SP_TitleBarContextHelpButton: | 0 | ||||||||||||||||||||||||||||||
| 5057 | case QStyle::SP_DockWidgetCloseButton: return QLatin1String("dockwidget-close-icon"); never executed: return QLatin1String("dockwidget-close-icon");never executed: case QStyle::SP_DockWidgetCloseButton: | 0 | ||||||||||||||||||||||||||||||
| 5058 | case QStyle::SP_MessageBoxInformation: return QLatin1String("messagebox-information-icon"); never executed: return QLatin1String("messagebox-information-icon");never executed: case QStyle::SP_MessageBoxInformation: | 0 | ||||||||||||||||||||||||||||||
| 5059 | case QStyle::SP_MessageBoxWarning: return QLatin1String("messagebox-warning-icon"); never executed: return QLatin1String("messagebox-warning-icon");never executed: case QStyle::SP_MessageBoxWarning: | 0 | ||||||||||||||||||||||||||||||
| 5060 | case QStyle::SP_MessageBoxCritical: return QLatin1String("messagebox-critical-icon"); never executed: return QLatin1String("messagebox-critical-icon");never executed: case QStyle::SP_MessageBoxCritical: | 0 | ||||||||||||||||||||||||||||||
| 5061 | case QStyle::SP_MessageBoxQuestion: return QLatin1String("messagebox-question-icon"); never executed: return QLatin1String("messagebox-question-icon");never executed: case QStyle::SP_MessageBoxQuestion: | 0 | ||||||||||||||||||||||||||||||
| 5062 | case QStyle::SP_DesktopIcon: return QLatin1String("desktop-icon"); never executed: return QLatin1String("desktop-icon");never executed: case QStyle::SP_DesktopIcon: | 0 | ||||||||||||||||||||||||||||||
| 5063 | case QStyle::SP_TrashIcon: return QLatin1String("trash-icon"); never executed: return QLatin1String("trash-icon");never executed: case QStyle::SP_TrashIcon: | 0 | ||||||||||||||||||||||||||||||
| 5064 | case QStyle::SP_ComputerIcon: return QLatin1String("computer-icon"); never executed: return QLatin1String("computer-icon");never executed: case QStyle::SP_ComputerIcon: | 0 | ||||||||||||||||||||||||||||||
| 5065 | case QStyle::SP_DriveFDIcon: return QLatin1String("floppy-icon"); never executed: return QLatin1String("floppy-icon");never executed: case QStyle::SP_DriveFDIcon: | 0 | ||||||||||||||||||||||||||||||
| 5066 | case QStyle::SP_DriveHDIcon: return QLatin1String("harddisk-icon"); never executed: return QLatin1String("harddisk-icon");never executed: case QStyle::SP_DriveHDIcon: | 0 | ||||||||||||||||||||||||||||||
| 5067 | case QStyle::SP_DriveCDIcon: return QLatin1String("cd-icon"); never executed: return QLatin1String("cd-icon");never executed: case QStyle::SP_DriveCDIcon: | 0 | ||||||||||||||||||||||||||||||
| 5068 | case QStyle::SP_DriveDVDIcon: return QLatin1String("dvd-icon"); never executed: return QLatin1String("dvd-icon");never executed: case QStyle::SP_DriveDVDIcon: | 0 | ||||||||||||||||||||||||||||||
| 5069 | case QStyle::SP_DriveNetIcon: return QLatin1String("network-icon"); never executed: return QLatin1String("network-icon");never executed: case QStyle::SP_DriveNetIcon: | 0 | ||||||||||||||||||||||||||||||
| 5070 | case QStyle::SP_DirOpenIcon: return QLatin1String("directory-open-icon"); never executed: return QLatin1String("directory-open-icon");never executed: case QStyle::SP_DirOpenIcon: | 0 | ||||||||||||||||||||||||||||||
| 5071 | case QStyle::SP_DirClosedIcon: return QLatin1String("directory-closed-icon"); never executed: return QLatin1String("directory-closed-icon");never executed: case QStyle::SP_DirClosedIcon: | 0 | ||||||||||||||||||||||||||||||
| 5072 | case QStyle::SP_DirLinkIcon: return QLatin1String("directory-link-icon"); never executed: return QLatin1String("directory-link-icon");never executed: case QStyle::SP_DirLinkIcon: | 0 | ||||||||||||||||||||||||||||||
| 5073 | case QStyle::SP_FileIcon: return QLatin1String("file-icon"); never executed: return QLatin1String("file-icon");never executed: case QStyle::SP_FileIcon: | 0 | ||||||||||||||||||||||||||||||
| 5074 | case QStyle::SP_FileLinkIcon: return QLatin1String("file-link-icon"); never executed: return QLatin1String("file-link-icon");never executed: case QStyle::SP_FileLinkIcon: | 0 | ||||||||||||||||||||||||||||||
| 5075 | case QStyle::SP_FileDialogStart: return QLatin1String("filedialog-start-icon"); never executed: return QLatin1String("filedialog-start-icon");never executed: case QStyle::SP_FileDialogStart: | 0 | ||||||||||||||||||||||||||||||
| 5076 | case QStyle::SP_FileDialogEnd: return QLatin1String("filedialog-end-icon"); never executed: return QLatin1String("filedialog-end-icon");never executed: case QStyle::SP_FileDialogEnd: | 0 | ||||||||||||||||||||||||||||||
| 5077 | case QStyle::SP_FileDialogToParent: return QLatin1String("filedialog-parent-directory-icon"); never executed: return QLatin1String("filedialog-parent-directory-icon");never executed: case QStyle::SP_FileDialogToParent: | 0 | ||||||||||||||||||||||||||||||
| 5078 | case QStyle::SP_FileDialogNewFolder: return QLatin1String("filedialog-new-directory-icon"); never executed: return QLatin1String("filedialog-new-directory-icon");never executed: case QStyle::SP_FileDialogNewFolder: | 0 | ||||||||||||||||||||||||||||||
| 5079 | case QStyle::SP_FileDialogDetailedView: return QLatin1String("filedialog-detailedview-icon"); never executed: return QLatin1String("filedialog-detailedview-icon");never executed: case QStyle::SP_FileDialogDetailedView: | 0 | ||||||||||||||||||||||||||||||
| 5080 | case QStyle::SP_FileDialogInfoView: return QLatin1String("filedialog-infoview-icon"); never executed: return QLatin1String("filedialog-infoview-icon");never executed: case QStyle::SP_FileDialogInfoView: | 0 | ||||||||||||||||||||||||||||||
| 5081 | case QStyle::SP_FileDialogContentsView: return QLatin1String("filedialog-contentsview-icon"); never executed: return QLatin1String("filedialog-contentsview-icon");never executed: case QStyle::SP_FileDialogContentsView: | 0 | ||||||||||||||||||||||||||||||
| 5082 | case QStyle::SP_FileDialogListView: return QLatin1String("filedialog-listview-icon"); never executed: return QLatin1String("filedialog-listview-icon");never executed: case QStyle::SP_FileDialogListView: | 0 | ||||||||||||||||||||||||||||||
| 5083 | case QStyle::SP_FileDialogBack: return QLatin1String("filedialog-backward-icon"); never executed: return QLatin1String("filedialog-backward-icon");never executed: case QStyle::SP_FileDialogBack: | 0 | ||||||||||||||||||||||||||||||
| 5084 | case QStyle::SP_DirIcon: return QLatin1String("directory-icon"); never executed: return QLatin1String("directory-icon");never executed: case QStyle::SP_DirIcon: | 0 | ||||||||||||||||||||||||||||||
| 5085 | case QStyle::SP_DialogOkButton: return QLatin1String("dialog-ok-icon"); never executed: return QLatin1String("dialog-ok-icon");never executed: case QStyle::SP_DialogOkButton: | 0 | ||||||||||||||||||||||||||||||
| 5086 | case QStyle::SP_DialogCancelButton: return QLatin1String("dialog-cancel-icon"); never executed: return QLatin1String("dialog-cancel-icon");never executed: case QStyle::SP_DialogCancelButton: | 0 | ||||||||||||||||||||||||||||||
| 5087 | case QStyle::SP_DialogHelpButton: return QLatin1String("dialog-help-icon"); never executed: return QLatin1String("dialog-help-icon");never executed: case QStyle::SP_DialogHelpButton: | 0 | ||||||||||||||||||||||||||||||
| 5088 | case QStyle::SP_DialogOpenButton: return QLatin1String("dialog-open-icon"); never executed: return QLatin1String("dialog-open-icon");never executed: case QStyle::SP_DialogOpenButton: | 0 | ||||||||||||||||||||||||||||||
| 5089 | case QStyle::SP_DialogSaveButton: return QLatin1String("dialog-save-icon"); never executed: return QLatin1String("dialog-save-icon");never executed: case QStyle::SP_DialogSaveButton: | 0 | ||||||||||||||||||||||||||||||
| 5090 | case QStyle::SP_DialogCloseButton: return QLatin1String("dialog-close-icon"); never executed: return QLatin1String("dialog-close-icon");never executed: case QStyle::SP_DialogCloseButton: | 0 | ||||||||||||||||||||||||||||||
| 5091 | case QStyle::SP_DialogApplyButton: return QLatin1String("dialog-apply-icon"); never executed: return QLatin1String("dialog-apply-icon");never executed: case QStyle::SP_DialogApplyButton: | 0 | ||||||||||||||||||||||||||||||
| 5092 | case QStyle::SP_DialogResetButton: return QLatin1String("dialog-reset-icon"); never executed: return QLatin1String("dialog-reset-icon");never executed: case QStyle::SP_DialogResetButton: | 0 | ||||||||||||||||||||||||||||||
| 5093 | case QStyle::SP_DialogDiscardButton: return QLatin1String("discard-icon"); never executed: return QLatin1String("discard-icon");never executed: case QStyle::SP_DialogDiscardButton: | 0 | ||||||||||||||||||||||||||||||
| 5094 | case QStyle::SP_DialogYesButton: return QLatin1String("dialog-yes-icon"); never executed: return QLatin1String("dialog-yes-icon");never executed: case QStyle::SP_DialogYesButton: | 0 | ||||||||||||||||||||||||||||||
| 5095 | case QStyle::SP_DialogNoButton: return QLatin1String("dialog-no-icon"); never executed: return QLatin1String("dialog-no-icon");never executed: case QStyle::SP_DialogNoButton: | 0 | ||||||||||||||||||||||||||||||
| 5096 | case QStyle::SP_ArrowUp: return QLatin1String("uparrow-icon"); never executed: return QLatin1String("uparrow-icon");never executed: case QStyle::SP_ArrowUp: | 0 | ||||||||||||||||||||||||||||||
| 5097 | case QStyle::SP_ArrowDown: return QLatin1String("downarrow-icon"); never executed: return QLatin1String("downarrow-icon");never executed: case QStyle::SP_ArrowDown: | 0 | ||||||||||||||||||||||||||||||
| 5098 | case QStyle::SP_ArrowLeft: return QLatin1String("leftarrow-icon"); never executed: return QLatin1String("leftarrow-icon");never executed: case QStyle::SP_ArrowLeft: | 0 | ||||||||||||||||||||||||||||||
| 5099 | case QStyle::SP_ArrowRight: return QLatin1String("rightarrow-icon"); never executed: return QLatin1String("rightarrow-icon");never executed: case QStyle::SP_ArrowRight: | 0 | ||||||||||||||||||||||||||||||
| 5100 | case QStyle::SP_ArrowBack: return QLatin1String("backward-icon"); never executed: return QLatin1String("backward-icon");never executed: case QStyle::SP_ArrowBack: | 0 | ||||||||||||||||||||||||||||||
| 5101 | case QStyle::SP_ArrowForward: return QLatin1String("forward-icon"); never executed: return QLatin1String("forward-icon");never executed: case QStyle::SP_ArrowForward: | 0 | ||||||||||||||||||||||||||||||
| 5102 | case QStyle::SP_DirHomeIcon: return QLatin1String("home-icon"); never executed: return QLatin1String("home-icon");never executed: case QStyle::SP_DirHomeIcon: | 0 | ||||||||||||||||||||||||||||||
| 5103 | default: return QLatin1String(""); never executed: return QLatin1String("");never executed: default: | 0 | ||||||||||||||||||||||||||||||
| 5104 | } | - | ||||||||||||||||||||||||||||||
| 5105 | } | - | ||||||||||||||||||||||||||||||
| 5106 | - | |||||||||||||||||||||||||||||||
| 5107 | QIcon QStyleSheetStyle::standardIcon(StandardPixmap standardIcon, const QStyleOption *opt, | - | ||||||||||||||||||||||||||||||
| 5108 | const QWidget *w) const | - | ||||||||||||||||||||||||||||||
| 5109 | { | - | ||||||||||||||||||||||||||||||
| 5110 | RECURSION_GUARD(return baseStyle()->standardIcon(standardIcon, opt, w)) never executed: return baseStyle()->standardIcon(standardIcon, opt, w);
| 0 | ||||||||||||||||||||||||||||||
| 5111 | QString s = propertyNameForStandardPixmap(standardIcon); | - | ||||||||||||||||||||||||||||||
| 5112 | if (!s.isEmpty()) {
| 0 | ||||||||||||||||||||||||||||||
| 5113 | QRenderRule rule = renderRule(w, opt); | - | ||||||||||||||||||||||||||||||
| 5114 | if (rule.hasStyleHint(s))
| 0 | ||||||||||||||||||||||||||||||
| 5115 | return qvariant_cast<QIcon>(rule.styleHint(s)); never executed: return qvariant_cast<QIcon>(rule.styleHint(s)); | 0 | ||||||||||||||||||||||||||||||
| 5116 | } never executed: end of block | 0 | ||||||||||||||||||||||||||||||
| 5117 | return baseStyle()->standardIcon(standardIcon, opt, w); never executed: return baseStyle()->standardIcon(standardIcon, opt, w); | 0 | ||||||||||||||||||||||||||||||
| 5118 | } | - | ||||||||||||||||||||||||||||||
| 5119 | - | |||||||||||||||||||||||||||||||
| 5120 | QPalette QStyleSheetStyle::standardPalette() const | - | ||||||||||||||||||||||||||||||
| 5121 | { | - | ||||||||||||||||||||||||||||||
| 5122 | return baseStyle()->standardPalette(); never executed: return baseStyle()->standardPalette(); | 0 | ||||||||||||||||||||||||||||||
| 5123 | } | - | ||||||||||||||||||||||||||||||
| 5124 | - | |||||||||||||||||||||||||||||||
| 5125 | QPixmap QStyleSheetStyle::standardPixmap(StandardPixmap standardPixmap, const QStyleOption *opt, | - | ||||||||||||||||||||||||||||||
| 5126 | const QWidget *w) const | - | ||||||||||||||||||||||||||||||
| 5127 | { | - | ||||||||||||||||||||||||||||||
| 5128 | RECURSION_GUARD(return baseStyle()->standardPixmap(standardPixmap, opt, w)) never executed: return baseStyle()->standardPixmap(standardPixmap, opt, w);
| 0 | ||||||||||||||||||||||||||||||
| 5129 | QString s = propertyNameForStandardPixmap(standardPixmap); | - | ||||||||||||||||||||||||||||||
| 5130 | if (!s.isEmpty()) {
| 0 | ||||||||||||||||||||||||||||||
| 5131 | QRenderRule rule = renderRule(w, opt); | - | ||||||||||||||||||||||||||||||
| 5132 | if (rule.hasStyleHint(s)) {
| 0 | ||||||||||||||||||||||||||||||
| 5133 | QIcon icon = qvariant_cast<QIcon>(rule.styleHint(s)); | - | ||||||||||||||||||||||||||||||
| 5134 | return icon.pixmap(16, 16); // ###: unhard-code this if someone complains never executed: return icon.pixmap(16, 16); | 0 | ||||||||||||||||||||||||||||||
| 5135 | } | - | ||||||||||||||||||||||||||||||
| 5136 | } never executed: end of block | 0 | ||||||||||||||||||||||||||||||
| 5137 | return baseStyle()->standardPixmap(standardPixmap, opt, w); never executed: return baseStyle()->standardPixmap(standardPixmap, opt, w); | 0 | ||||||||||||||||||||||||||||||
| 5138 | } | - | ||||||||||||||||||||||||||||||
| 5139 | - | |||||||||||||||||||||||||||||||
| 5140 | int QStyleSheetStyle::layoutSpacing(QSizePolicy::ControlType control1, QSizePolicy::ControlType control2, | - | ||||||||||||||||||||||||||||||
| 5141 | Qt::Orientation orientation, const QStyleOption *option, | - | ||||||||||||||||||||||||||||||
| 5142 | const QWidget *widget) const | - | ||||||||||||||||||||||||||||||
| 5143 | { | - | ||||||||||||||||||||||||||||||
| 5144 | return baseStyle()->layoutSpacing(control1, control2, orientation, option, widget); never executed: return baseStyle()->layoutSpacing(control1, control2, orientation, option, widget); | 0 | ||||||||||||||||||||||||||||||
| 5145 | } | - | ||||||||||||||||||||||||||||||
| 5146 | - | |||||||||||||||||||||||||||||||
| 5147 | int QStyleSheetStyle::styleHint(StyleHint sh, const QStyleOption *opt, const QWidget *w, | - | ||||||||||||||||||||||||||||||
| 5148 | QStyleHintReturn *shret) const | - | ||||||||||||||||||||||||||||||
| 5149 | { | - | ||||||||||||||||||||||||||||||
| 5150 | RECURSION_GUARD(return baseStyle()->styleHint(sh, opt, w, shret)) never executed: return baseStyle()->styleHint(sh, opt, w, shret);
| 0 | ||||||||||||||||||||||||||||||
| 5151 | // Prevent endless loop if somebody use isActiveWindow property as selector. | - | ||||||||||||||||||||||||||||||
| 5152 | // QWidget::isActiveWindow uses this styleHint to determine if the window is active or not | - | ||||||||||||||||||||||||||||||
| 5153 | if (sh == SH_Widget_ShareActivation)
| 0 | ||||||||||||||||||||||||||||||
| 5154 | return baseStyle()->styleHint(sh, opt, w, shret); never executed: return baseStyle()->styleHint(sh, opt, w, shret); | 0 | ||||||||||||||||||||||||||||||
| 5155 | - | |||||||||||||||||||||||||||||||
| 5156 | QRenderRule rule = renderRule(w, opt); | - | ||||||||||||||||||||||||||||||
| 5157 | QString s; | - | ||||||||||||||||||||||||||||||
| 5158 | switch (sh) { | - | ||||||||||||||||||||||||||||||
| 5159 | case SH_LineEdit_PasswordCharacter: s = QLatin1String("lineedit-password-character"); break; never executed: break;never executed: case SH_LineEdit_PasswordCharacter: | 0 | ||||||||||||||||||||||||||||||
| 5160 | case SH_LineEdit_PasswordMaskDelay: s = QLatin1String("lineedit-password-mask-delay"); break; never executed: break;never executed: case SH_LineEdit_PasswordMaskDelay: | 0 | ||||||||||||||||||||||||||||||
| 5161 | case SH_DitherDisabledText: s = QLatin1String("dither-disabled-text"); break; never executed: break;never executed: case SH_DitherDisabledText: | 0 | ||||||||||||||||||||||||||||||
| 5162 | case SH_EtchDisabledText: s = QLatin1String("etch-disabled-text"); break; never executed: break;never executed: case SH_EtchDisabledText: | 0 | ||||||||||||||||||||||||||||||
| 5163 | case SH_ItemView_ActivateItemOnSingleClick: s = QLatin1String("activate-on-singleclick"); break; never executed: break;never executed: case SH_ItemView_ActivateItemOnSingleClick: | 0 | ||||||||||||||||||||||||||||||
| 5164 | case SH_ItemView_ShowDecorationSelected: s = QLatin1String("show-decoration-selected"); break; never executed: break;never executed: case SH_ItemView_ShowDecorationSelected: | 0 | ||||||||||||||||||||||||||||||
| 5165 | case SH_Table_GridLineColor: s = QLatin1String("gridline-color"); break; never executed: break;never executed: case SH_Table_GridLineColor: | 0 | ||||||||||||||||||||||||||||||
| 5166 | case SH_DialogButtonLayout: s = QLatin1String("button-layout"); break; never executed: break;never executed: case SH_DialogButtonLayout: | 0 | ||||||||||||||||||||||||||||||
| 5167 | case SH_ToolTipLabel_Opacity: s = QLatin1String("opacity"); break; never executed: break;never executed: case SH_ToolTipLabel_Opacity: | 0 | ||||||||||||||||||||||||||||||
| 5168 | case SH_ComboBox_Popup: s = QLatin1String("combobox-popup"); break; never executed: break;never executed: case SH_ComboBox_Popup: | 0 | ||||||||||||||||||||||||||||||
| 5169 | case SH_ComboBox_ListMouseTracking: s = QLatin1String("combobox-list-mousetracking"); break; never executed: break;never executed: case SH_ComboBox_ListMouseTracking: | 0 | ||||||||||||||||||||||||||||||
| 5170 | case SH_MenuBar_AltKeyNavigation: s = QLatin1String("menubar-altkey-navigation"); break; never executed: break;never executed: case SH_MenuBar_AltKeyNavigation: | 0 | ||||||||||||||||||||||||||||||
| 5171 | case SH_Menu_Scrollable: s = QLatin1String("menu-scrollable"); break; never executed: break;never executed: case SH_Menu_Scrollable: | 0 | ||||||||||||||||||||||||||||||
| 5172 | case SH_DrawMenuBarSeparator: s = QLatin1String("menubar-separator"); break; never executed: break;never executed: case SH_DrawMenuBarSeparator: | 0 | ||||||||||||||||||||||||||||||
| 5173 | case SH_MenuBar_MouseTracking: s = QLatin1String("mouse-tracking"); break; never executed: break;never executed: case SH_MenuBar_MouseTracking: | 0 | ||||||||||||||||||||||||||||||
| 5174 | case SH_SpinBox_ClickAutoRepeatRate: s = QLatin1String("spinbox-click-autorepeat-rate"); break; never executed: break;never executed: case SH_SpinBox_ClickAutoRepeatRate: | 0 | ||||||||||||||||||||||||||||||
| 5175 | case SH_SpinControls_DisableOnBounds: s = QLatin1String("spincontrol-disable-on-bounds"); break; never executed: break;never executed: case SH_SpinControls_DisableOnBounds: | 0 | ||||||||||||||||||||||||||||||
| 5176 | case SH_MessageBox_TextInteractionFlags: s = QLatin1String("messagebox-text-interaction-flags"); break; never executed: break;never executed: case SH_MessageBox_TextInteractionFlags: | 0 | ||||||||||||||||||||||||||||||
| 5177 | case SH_ToolButton_PopupDelay: s = QLatin1String("toolbutton-popup-delay"); break; never executed: break;never executed: case SH_ToolButton_PopupDelay: | 0 | ||||||||||||||||||||||||||||||
| 5178 | case SH_ToolBox_SelectedPageTitleBold: never executed: case SH_ToolBox_SelectedPageTitleBold: | 0 | ||||||||||||||||||||||||||||||
| 5179 | if (renderRule(w, opt, PseudoElement_ToolBoxTab).hasFont)
| 0 | ||||||||||||||||||||||||||||||
| 5180 | return 0; never executed: return 0; | 0 | ||||||||||||||||||||||||||||||
| 5181 | break; never executed: break; | 0 | ||||||||||||||||||||||||||||||
| 5182 | case SH_GroupBox_TextLabelColor: never executed: case SH_GroupBox_TextLabelColor: | 0 | ||||||||||||||||||||||||||||||
| 5183 | if (rule.hasPalette() && rule.palette()->foreground.style() != Qt::NoBrush)
| 0 | ||||||||||||||||||||||||||||||
| 5184 | return rule.palette()->foreground.color().rgba(); never executed: return rule.palette()->foreground.color().rgba(); | 0 | ||||||||||||||||||||||||||||||
| 5185 | break; never executed: break; | 0 | ||||||||||||||||||||||||||||||
| 5186 | case SH_ScrollView_FrameOnlyAroundContents: s = QLatin1String("scrollview-frame-around-contents"); break; never executed: break;never executed: case SH_ScrollView_FrameOnlyAroundContents: | 0 | ||||||||||||||||||||||||||||||
| 5187 | case SH_ScrollBar_ContextMenu: s = QLatin1String("scrollbar-contextmenu"); break; never executed: break;never executed: case SH_ScrollBar_ContextMenu: | 0 | ||||||||||||||||||||||||||||||
| 5188 | case SH_ScrollBar_LeftClickAbsolutePosition: s = QLatin1String("scrollbar-leftclick-absolute-position"); break; never executed: break;never executed: case SH_ScrollBar_LeftClickAbsolutePosition: | 0 | ||||||||||||||||||||||||||||||
| 5189 | case SH_ScrollBar_MiddleClickAbsolutePosition: s = QLatin1String("scrollbar-middleclick-absolute-position"); break; never executed: break;never executed: case SH_ScrollBar_MiddleClickAbsolutePosition: | 0 | ||||||||||||||||||||||||||||||
| 5190 | case SH_ScrollBar_RollBetweenButtons: s = QLatin1String("scrollbar-roll-between-buttons"); break; never executed: break;never executed: case SH_ScrollBar_RollBetweenButtons: | 0 | ||||||||||||||||||||||||||||||
| 5191 | case SH_ScrollBar_ScrollWhenPointerLeavesControl: s = QLatin1String("scrollbar-scroll-when-pointer-leaves-control"); break; never executed: break;never executed: case SH_ScrollBar_ScrollWhenPointerLeavesControl: | 0 | ||||||||||||||||||||||||||||||
| 5192 | case SH_TabBar_Alignment: never executed: case SH_TabBar_Alignment: | 0 | ||||||||||||||||||||||||||||||
| 5193 | #ifndef QT_NO_TABWIDGET | - | ||||||||||||||||||||||||||||||
| 5194 | if (qobject_cast<const QTabWidget *>(w)) {
| 0 | ||||||||||||||||||||||||||||||
| 5195 | rule = renderRule(w, opt, PseudoElement_TabWidgetTabBar); | - | ||||||||||||||||||||||||||||||
| 5196 | if (rule.hasPosition())
| 0 | ||||||||||||||||||||||||||||||
| 5197 | return rule.position()->position; never executed: return rule.position()->position; | 0 | ||||||||||||||||||||||||||||||
| 5198 | } never executed: end of block | 0 | ||||||||||||||||||||||||||||||
| 5199 | #endif // QT_NO_TABWIDGET | - | ||||||||||||||||||||||||||||||
| 5200 | s = QLatin1String("alignment"); | - | ||||||||||||||||||||||||||||||
| 5201 | break; never executed: break; | 0 | ||||||||||||||||||||||||||||||
| 5202 | #ifndef QT_NO_TABBAR | - | ||||||||||||||||||||||||||||||
| 5203 | case SH_TabBar_CloseButtonPosition: never executed: case SH_TabBar_CloseButtonPosition: | 0 | ||||||||||||||||||||||||||||||
| 5204 | rule = renderRule(w, opt, PseudoElement_TabBarTabCloseButton); | - | ||||||||||||||||||||||||||||||
| 5205 | if (rule.hasPosition()) {
| 0 | ||||||||||||||||||||||||||||||
| 5206 | Qt::Alignment align = rule.position()->position; | - | ||||||||||||||||||||||||||||||
| 5207 | if (align & Qt::AlignLeft || align & Qt::AlignTop)
| 0 | ||||||||||||||||||||||||||||||
| 5208 | return QTabBar::LeftSide; never executed: return QTabBar::LeftSide; | 0 | ||||||||||||||||||||||||||||||
| 5209 | if (align & Qt::AlignRight || align & Qt::AlignBottom)
| 0 | ||||||||||||||||||||||||||||||
| 5210 | return QTabBar::RightSide; never executed: return QTabBar::RightSide; | 0 | ||||||||||||||||||||||||||||||
| 5211 | } never executed: end of block | 0 | ||||||||||||||||||||||||||||||
| 5212 | break; never executed: break; | 0 | ||||||||||||||||||||||||||||||
| 5213 | #endif | - | ||||||||||||||||||||||||||||||
| 5214 | case SH_TabBar_ElideMode: s = QLatin1String("tabbar-elide-mode"); break; never executed: break;never executed: case SH_TabBar_ElideMode: | 0 | ||||||||||||||||||||||||||||||
| 5215 | case SH_TabBar_PreferNoArrows: s = QLatin1String("tabbar-prefer-no-arrows"); break; never executed: break;never executed: case SH_TabBar_PreferNoArrows: | 0 | ||||||||||||||||||||||||||||||
| 5216 | case SH_ComboBox_PopupFrameStyle: never executed: case SH_ComboBox_PopupFrameStyle: | 0 | ||||||||||||||||||||||||||||||
| 5217 | #ifndef QT_NO_COMBOBOX | - | ||||||||||||||||||||||||||||||
| 5218 | if (qobject_cast<const QComboBox *>(w)) {
| 0 | ||||||||||||||||||||||||||||||
| 5219 | QAbstractItemView *view = w->findChild<QAbstractItemView *>(); | - | ||||||||||||||||||||||||||||||
| 5220 | if (view) {
| 0 | ||||||||||||||||||||||||||||||
| 5221 | view->ensurePolished(); | - | ||||||||||||||||||||||||||||||
| 5222 | QRenderRule subRule = renderRule(view, PseudoElement_None); | - | ||||||||||||||||||||||||||||||
| 5223 | if (subRule.hasBox() || !subRule.hasNativeBorder())
| 0 | ||||||||||||||||||||||||||||||
| 5224 | return QFrame::NoFrame; never executed: return QFrame::NoFrame; | 0 | ||||||||||||||||||||||||||||||
| 5225 | } never executed: end of block | 0 | ||||||||||||||||||||||||||||||
| 5226 | } never executed: end of block | 0 | ||||||||||||||||||||||||||||||
| 5227 | #endif // QT_NO_COMBOBOX | - | ||||||||||||||||||||||||||||||
| 5228 | break; never executed: break; | 0 | ||||||||||||||||||||||||||||||
| 5229 | case SH_DialogButtonBox_ButtonsHaveIcons: s = QLatin1String("dialogbuttonbox-buttons-have-icons"); break; never executed: break;never executed: case SH_DialogButtonBox_ButtonsHaveIcons: | 0 | ||||||||||||||||||||||||||||||
| 5230 | case SH_Workspace_FillSpaceOnMaximize: s = QLatin1String("mdi-fill-space-on-maximize"); break; never executed: break;never executed: case SH_Workspace_FillSpaceOnMaximize: | 0 | ||||||||||||||||||||||||||||||
| 5231 | case SH_TitleBar_NoBorder: never executed: case SH_TitleBar_NoBorder: | 0 | ||||||||||||||||||||||||||||||
| 5232 | if (rule.hasBorder())
| 0 | ||||||||||||||||||||||||||||||
| 5233 | return !rule.border()->borders[LeftEdge]; never executed: return !rule.border()->borders[LeftEdge]; | 0 | ||||||||||||||||||||||||||||||
| 5234 | break; never executed: break; | 0 | ||||||||||||||||||||||||||||||
| 5235 | case SH_TitleBar_AutoRaise: { // plain absurd never executed: case SH_TitleBar_AutoRaise: | 0 | ||||||||||||||||||||||||||||||
| 5236 | QRenderRule subRule = renderRule(w, opt, PseudoElement_TitleBar); | - | ||||||||||||||||||||||||||||||
| 5237 | if (subRule.hasDrawable())
| 0 | ||||||||||||||||||||||||||||||
| 5238 | return 1; never executed: return 1; | 0 | ||||||||||||||||||||||||||||||
| 5239 | break; never executed: break; | 0 | ||||||||||||||||||||||||||||||
| 5240 | } | - | ||||||||||||||||||||||||||||||
| 5241 | case SH_ItemView_ArrowKeysNavigateIntoChildren: s = QLatin1String("arrow-keys-navigate-into-children"); break; never executed: break;never executed: case SH_ItemView_ArrowKeysNavigateIntoChildren: | 0 | ||||||||||||||||||||||||||||||
| 5242 | case SH_ItemView_PaintAlternatingRowColorsForEmptyArea: s = QLatin1String("paint-alternating-row-colors-for-empty-area"); break; never executed: break;never executed: case SH_ItemView_PaintAlternatingRowColorsForEmptyArea: | 0 | ||||||||||||||||||||||||||||||
| 5243 | default: break; never executed: break;never executed: default: | 0 | ||||||||||||||||||||||||||||||
| 5244 | } | - | ||||||||||||||||||||||||||||||
| 5245 | if (!s.isEmpty() && rule.hasStyleHint(s)) {
| 0 | ||||||||||||||||||||||||||||||
| 5246 | return rule.styleHint(s).toInt(); never executed: return rule.styleHint(s).toInt(); | 0 | ||||||||||||||||||||||||||||||
| 5247 | } | - | ||||||||||||||||||||||||||||||
| 5248 | - | |||||||||||||||||||||||||||||||
| 5249 | return baseStyle()->styleHint(sh, opt, w, shret); never executed: return baseStyle()->styleHint(sh, opt, w, shret); | 0 | ||||||||||||||||||||||||||||||
| 5250 | } | - | ||||||||||||||||||||||||||||||
| 5251 | - | |||||||||||||||||||||||||||||||
| 5252 | QRect QStyleSheetStyle::subControlRect(ComplexControl cc, const QStyleOptionComplex *opt, SubControl sc, | - | ||||||||||||||||||||||||||||||
| 5253 | const QWidget *w) const | - | ||||||||||||||||||||||||||||||
| 5254 | { | - | ||||||||||||||||||||||||||||||
| 5255 | RECURSION_GUARD(return baseStyle()->subControlRect(cc, opt, sc, w)) never executed: return baseStyle()->subControlRect(cc, opt, sc, w);
| 0 | ||||||||||||||||||||||||||||||
| 5256 | - | |||||||||||||||||||||||||||||||
| 5257 | QRenderRule rule = renderRule(w, opt); | - | ||||||||||||||||||||||||||||||
| 5258 | switch (cc) { | - | ||||||||||||||||||||||||||||||
| 5259 | case CC_ComboBox: never executed: case CC_ComboBox: | 0 | ||||||||||||||||||||||||||||||
| 5260 | if (const QStyleOptionComboBox *cb = qstyleoption_cast<const QStyleOptionComboBox *>(opt)) {
| 0 | ||||||||||||||||||||||||||||||
| 5261 | if (rule.hasBox() || !rule.hasNativeBorder()) {
| 0 | ||||||||||||||||||||||||||||||
| 5262 | switch (sc) { | - | ||||||||||||||||||||||||||||||
| 5263 | case SC_ComboBoxFrame: return rule.borderRect(opt->rect); never executed: return rule.borderRect(opt->rect);never executed: case SC_ComboBoxFrame: | 0 | ||||||||||||||||||||||||||||||
| 5264 | case SC_ComboBoxEditField: never executed: case SC_ComboBoxEditField: | 0 | ||||||||||||||||||||||||||||||
| 5265 | { | - | ||||||||||||||||||||||||||||||
| 5266 | QRenderRule subRule = renderRule(w, opt, PseudoElement_ComboBoxDropDown); | - | ||||||||||||||||||||||||||||||
| 5267 | QRect r = rule.contentsRect(opt->rect); | - | ||||||||||||||||||||||||||||||
| 5268 | QRect r2 = positionRect(w, rule, subRule, PseudoElement_ComboBoxDropDown, | - | ||||||||||||||||||||||||||||||
| 5269 | opt->rect, opt->direction); | - | ||||||||||||||||||||||||||||||
| 5270 | if (subRule.hasPosition() && subRule.position()->position & Qt::AlignLeft) {
| 0 | ||||||||||||||||||||||||||||||
| 5271 | return visualRect(opt->direction, r, r.adjusted(r2.width(),0,0,0)); never executed: return visualRect(opt->direction, r, r.adjusted(r2.width(),0,0,0)); | 0 | ||||||||||||||||||||||||||||||
| 5272 | } else { | - | ||||||||||||||||||||||||||||||
| 5273 | return visualRect(opt->direction, r, r.adjusted(0,0,-r2.width(),0)); never executed: return visualRect(opt->direction, r, r.adjusted(0,0,-r2.width(),0)); | 0 | ||||||||||||||||||||||||||||||
| 5274 | } | - | ||||||||||||||||||||||||||||||
| 5275 | } | - | ||||||||||||||||||||||||||||||
| 5276 | case SC_ComboBoxArrow: { never executed: case SC_ComboBoxArrow: | 0 | ||||||||||||||||||||||||||||||
| 5277 | QRenderRule subRule = renderRule(w, opt, PseudoElement_ComboBoxDropDown); | - | ||||||||||||||||||||||||||||||
| 5278 | return positionRect(w, rule, subRule, PseudoElement_ComboBoxDropDown, opt->rect, opt->direction); never executed: return positionRect(w, rule, subRule, PseudoElement_ComboBoxDropDown, opt->rect, opt->direction); | 0 | ||||||||||||||||||||||||||||||
| 5279 | } | - | ||||||||||||||||||||||||||||||
| 5280 | case SC_ComboBoxListBoxPopup: never executed: case SC_ComboBoxListBoxPopup: | 0 | ||||||||||||||||||||||||||||||
| 5281 | default: never executed: default: | 0 | ||||||||||||||||||||||||||||||
| 5282 | return baseStyle()->subControlRect(cc, opt, sc, w); never executed: return baseStyle()->subControlRect(cc, opt, sc, w); | 0 | ||||||||||||||||||||||||||||||
| 5283 | } | - | ||||||||||||||||||||||||||||||
| 5284 | } | - | ||||||||||||||||||||||||||||||
| 5285 | - | |||||||||||||||||||||||||||||||
| 5286 | QStyleOptionComboBox comboBox(*cb); | - | ||||||||||||||||||||||||||||||
| 5287 | comboBox.rect = rule.borderRect(opt->rect); | - | ||||||||||||||||||||||||||||||
| 5288 | return rule.baseStyleCanDraw() ? baseStyle()->subControlRect(cc, &comboBox, sc, w) never executed: return rule.baseStyleCanDraw() ? baseStyle()->subControlRect(cc, &comboBox, sc, w) : QWindowsStyle::subControlRect(cc, &comboBox, sc, w);
| 0 | ||||||||||||||||||||||||||||||
| 5289 | : QWindowsStyle::subControlRect(cc, &comboBox, sc, w); never executed: return rule.baseStyleCanDraw() ? baseStyle()->subControlRect(cc, &comboBox, sc, w) : QWindowsStyle::subControlRect(cc, &comboBox, sc, w); | 0 | ||||||||||||||||||||||||||||||
| 5290 | } | - | ||||||||||||||||||||||||||||||
| 5291 | break; never executed: break; | 0 | ||||||||||||||||||||||||||||||
| 5292 | - | |||||||||||||||||||||||||||||||
| 5293 | #ifndef QT_NO_SPINBOX | - | ||||||||||||||||||||||||||||||
| 5294 | case CC_SpinBox: never executed: case CC_SpinBox: | 0 | ||||||||||||||||||||||||||||||
| 5295 | if (const QStyleOptionSpinBox *spin = qstyleoption_cast<const QStyleOptionSpinBox *>(opt)) {
| 0 | ||||||||||||||||||||||||||||||
| 5296 | QRenderRule upRule = renderRule(w, opt, PseudoElement_SpinBoxUpButton); | - | ||||||||||||||||||||||||||||||
| 5297 | QRenderRule downRule = renderRule(w, opt, PseudoElement_SpinBoxDownButton); | - | ||||||||||||||||||||||||||||||
| 5298 | bool ruleMatch = rule.hasBox() || !rule.hasNativeBorder();
| 0 | ||||||||||||||||||||||||||||||
| 5299 | bool upRuleMatch = upRule.hasGeometry() || upRule.hasPosition();
| 0 | ||||||||||||||||||||||||||||||
| 5300 | bool downRuleMatch = downRule.hasGeometry() || downRule.hasPosition();
| 0 | ||||||||||||||||||||||||||||||
| 5301 | if (ruleMatch || upRuleMatch || downRuleMatch) {
| 0 | ||||||||||||||||||||||||||||||
| 5302 | switch (sc) { | - | ||||||||||||||||||||||||||||||
| 5303 | case SC_SpinBoxFrame: never executed: case SC_SpinBoxFrame: | 0 | ||||||||||||||||||||||||||||||
| 5304 | return rule.borderRect(opt->rect); never executed: return rule.borderRect(opt->rect); | 0 | ||||||||||||||||||||||||||||||
| 5305 | case SC_SpinBoxEditField: never executed: case SC_SpinBoxEditField: | 0 | ||||||||||||||||||||||||||||||
| 5306 | { | - | ||||||||||||||||||||||||||||||
| 5307 | QRect r = rule.contentsRect(opt->rect); | - | ||||||||||||||||||||||||||||||
| 5308 | // Use the widest button on each side to determine edit field size. | - | ||||||||||||||||||||||||||||||
| 5309 | Qt::Alignment upAlign, downAlign; | - | ||||||||||||||||||||||||||||||
| 5310 | - | |||||||||||||||||||||||||||||||
| 5311 | upAlign = upRule.hasPosition() ? upRule.position()->position
| 0 | ||||||||||||||||||||||||||||||
| 5312 | : Qt::Alignment(Qt::AlignRight); | - | ||||||||||||||||||||||||||||||
| 5313 | upAlign = resolveAlignment(opt->direction, upAlign); | - | ||||||||||||||||||||||||||||||
| 5314 | - | |||||||||||||||||||||||||||||||
| 5315 | downAlign = downRule.hasPosition() ? downRule.position()->position
| 0 | ||||||||||||||||||||||||||||||
| 5316 | : Qt::Alignment(Qt::AlignRight); | - | ||||||||||||||||||||||||||||||
| 5317 | downAlign = resolveAlignment(opt->direction, downAlign); | - | ||||||||||||||||||||||||||||||
| 5318 | - | |||||||||||||||||||||||||||||||
| 5319 | int upSize = subControlRect(CC_SpinBox, opt, SC_SpinBoxUp, w).width(); | - | ||||||||||||||||||||||||||||||
| 5320 | int downSize = subControlRect(CC_SpinBox, opt, SC_SpinBoxDown, w).width(); | - | ||||||||||||||||||||||||||||||
| 5321 | int widestL = qMax((upAlign & Qt::AlignLeft) ? upSize : 0, | - | ||||||||||||||||||||||||||||||
| 5322 | (downAlign & Qt::AlignLeft) ? downSize : 0); | - | ||||||||||||||||||||||||||||||
| 5323 | int widestR = qMax((upAlign & Qt::AlignRight) ? upSize : 0, | - | ||||||||||||||||||||||||||||||
| 5324 | (downAlign & Qt::AlignRight) ? downSize : 0); | - | ||||||||||||||||||||||||||||||
| 5325 | r.setRight(r.right() - widestR); | - | ||||||||||||||||||||||||||||||
| 5326 | r.setLeft(r.left() + widestL); | - | ||||||||||||||||||||||||||||||
| 5327 | return r; never executed: return r; | 0 | ||||||||||||||||||||||||||||||
| 5328 | } | - | ||||||||||||||||||||||||||||||
| 5329 | case SC_SpinBoxDown: never executed: case SC_SpinBoxDown: | 0 | ||||||||||||||||||||||||||||||
| 5330 | if (downRuleMatch)
| 0 | ||||||||||||||||||||||||||||||
| 5331 | return positionRect(w, rule, downRule, PseudoElement_SpinBoxDownButton, never executed: return positionRect(w, rule, downRule, PseudoElement_SpinBoxDownButton, opt->rect, opt->direction); | 0 | ||||||||||||||||||||||||||||||
| 5332 | opt->rect, opt->direction); never executed: return positionRect(w, rule, downRule, PseudoElement_SpinBoxDownButton, opt->rect, opt->direction); | 0 | ||||||||||||||||||||||||||||||
| 5333 | break; never executed: break; | 0 | ||||||||||||||||||||||||||||||
| 5334 | case SC_SpinBoxUp: never executed: case SC_SpinBoxUp: | 0 | ||||||||||||||||||||||||||||||
| 5335 | if (upRuleMatch)
| 0 | ||||||||||||||||||||||||||||||
| 5336 | return positionRect(w, rule, upRule, PseudoElement_SpinBoxUpButton, never executed: return positionRect(w, rule, upRule, PseudoElement_SpinBoxUpButton, opt->rect, opt->direction); | 0 | ||||||||||||||||||||||||||||||
| 5337 | opt->rect, opt->direction); never executed: return positionRect(w, rule, upRule, PseudoElement_SpinBoxUpButton, opt->rect, opt->direction); | 0 | ||||||||||||||||||||||||||||||
| 5338 | break; never executed: break; | 0 | ||||||||||||||||||||||||||||||
| 5339 | default: never executed: default: | 0 | ||||||||||||||||||||||||||||||
| 5340 | break; never executed: break; | 0 | ||||||||||||||||||||||||||||||
| 5341 | } | - | ||||||||||||||||||||||||||||||
| 5342 | - | |||||||||||||||||||||||||||||||
| 5343 | return baseStyle()->subControlRect(cc, opt, sc, w); never executed: return baseStyle()->subControlRect(cc, opt, sc, w); | 0 | ||||||||||||||||||||||||||||||
| 5344 | } | - | ||||||||||||||||||||||||||||||
| 5345 | - | |||||||||||||||||||||||||||||||
| 5346 | QStyleOptionSpinBox spinBox(*spin); | - | ||||||||||||||||||||||||||||||
| 5347 | spinBox.rect = rule.borderRect(opt->rect); | - | ||||||||||||||||||||||||||||||
| 5348 | return rule.baseStyleCanDraw() ? baseStyle()->subControlRect(cc, &spinBox, sc, w) never executed: return rule.baseStyleCanDraw() ? baseStyle()->subControlRect(cc, &spinBox, sc, w) : QWindowsStyle::subControlRect(cc, &spinBox, sc, w);
| 0 | ||||||||||||||||||||||||||||||
| 5349 | : QWindowsStyle::subControlRect(cc, &spinBox, sc, w); never executed: return rule.baseStyleCanDraw() ? baseStyle()->subControlRect(cc, &spinBox, sc, w) : QWindowsStyle::subControlRect(cc, &spinBox, sc, w); | 0 | ||||||||||||||||||||||||||||||
| 5350 | } | - | ||||||||||||||||||||||||||||||
| 5351 | break; never executed: break; | 0 | ||||||||||||||||||||||||||||||
| 5352 | #endif // QT_NO_SPINBOX | - | ||||||||||||||||||||||||||||||
| 5353 | - | |||||||||||||||||||||||||||||||
| 5354 | case CC_GroupBox: never executed: case CC_GroupBox: | 0 | ||||||||||||||||||||||||||||||
| 5355 | if (const QStyleOptionGroupBox *gb = qstyleoption_cast<const QStyleOptionGroupBox *>(opt)) {
| 0 | ||||||||||||||||||||||||||||||
| 5356 | switch (sc) { | - | ||||||||||||||||||||||||||||||
| 5357 | case SC_GroupBoxFrame: never executed: case SC_GroupBoxFrame: | 0 | ||||||||||||||||||||||||||||||
| 5358 | case SC_GroupBoxContents: { never executed: case SC_GroupBoxContents: | 0 | ||||||||||||||||||||||||||||||
| 5359 | if (rule.hasBox() || !rule.hasNativeBorder()) {
| 0 | ||||||||||||||||||||||||||||||
| 5360 | return sc == SC_GroupBoxFrame ? rule.borderRect(opt->rect) never executed: return sc == SC_GroupBoxFrame ? rule.borderRect(opt->rect) : rule.contentsRect(opt->rect);
| 0 | ||||||||||||||||||||||||||||||
| 5361 | : rule.contentsRect(opt->rect); never executed: return sc == SC_GroupBoxFrame ? rule.borderRect(opt->rect) : rule.contentsRect(opt->rect); | 0 | ||||||||||||||||||||||||||||||
| 5362 | } | - | ||||||||||||||||||||||||||||||
| 5363 | QStyleOptionGroupBox groupBox(*gb); | - | ||||||||||||||||||||||||||||||
| 5364 | groupBox.rect = rule.borderRect(opt->rect); | - | ||||||||||||||||||||||||||||||
| 5365 | return baseStyle()->subControlRect(cc, &groupBox, sc, w); never executed: return baseStyle()->subControlRect(cc, &groupBox, sc, w); | 0 | ||||||||||||||||||||||||||||||
| 5366 | } | - | ||||||||||||||||||||||||||||||
| 5367 | default: never executed: default: | 0 | ||||||||||||||||||||||||||||||
| 5368 | case SC_GroupBoxLabel: never executed: case SC_GroupBoxLabel: | 0 | ||||||||||||||||||||||||||||||
| 5369 | case SC_GroupBoxCheckBox: { never executed: case SC_GroupBoxCheckBox: | 0 | ||||||||||||||||||||||||||||||
| 5370 | QRenderRule indRule = renderRule(w, opt, PseudoElement_GroupBoxIndicator); | - | ||||||||||||||||||||||||||||||
| 5371 | QRenderRule labelRule = renderRule(w, opt, PseudoElement_GroupBoxTitle); | - | ||||||||||||||||||||||||||||||
| 5372 | if (!labelRule.hasPosition() && !labelRule.hasGeometry() && !labelRule.hasBox()
| 0 | ||||||||||||||||||||||||||||||
| 5373 | && !labelRule.hasBorder() && !indRule.hasContentsSize()) {
| 0 | ||||||||||||||||||||||||||||||
| 5374 | QStyleOptionGroupBox groupBox(*gb); | - | ||||||||||||||||||||||||||||||
| 5375 | groupBox.rect = rule.borderRect(opt->rect); | - | ||||||||||||||||||||||||||||||
| 5376 | return baseStyle()->subControlRect(cc, &groupBox, sc, w); never executed: return baseStyle()->subControlRect(cc, &groupBox, sc, w); | 0 | ||||||||||||||||||||||||||||||
| 5377 | } | - | ||||||||||||||||||||||||||||||
| 5378 | int tw = opt->fontMetrics.width(gb->text); | - | ||||||||||||||||||||||||||||||
| 5379 | int th = opt->fontMetrics.height(); | - | ||||||||||||||||||||||||||||||
| 5380 | int spacing = pixelMetric(QStyle::PM_CheckBoxLabelSpacing, opt, w); | - | ||||||||||||||||||||||||||||||
| 5381 | int iw = pixelMetric(QStyle::PM_IndicatorWidth, opt, w); | - | ||||||||||||||||||||||||||||||
| 5382 | int ih = pixelMetric(QStyle::PM_IndicatorHeight, opt, w); | - | ||||||||||||||||||||||||||||||
| 5383 | - | |||||||||||||||||||||||||||||||
| 5384 | if (gb->subControls & QStyle::SC_GroupBoxCheckBox) {
| 0 | ||||||||||||||||||||||||||||||
| 5385 | tw = tw + iw + spacing; | - | ||||||||||||||||||||||||||||||
| 5386 | th = qMax(th, ih); | - | ||||||||||||||||||||||||||||||
| 5387 | } never executed: end of block | 0 | ||||||||||||||||||||||||||||||
| 5388 | if (!labelRule.hasGeometry()) {
| 0 | ||||||||||||||||||||||||||||||
| 5389 | labelRule.geo = new QStyleSheetGeometryData(tw, th, tw, th, -1, -1); | - | ||||||||||||||||||||||||||||||
| 5390 | } else { never executed: end of block | 0 | ||||||||||||||||||||||||||||||
| 5391 | labelRule.geo->width = tw; | - | ||||||||||||||||||||||||||||||
| 5392 | labelRule.geo->height = th; | - | ||||||||||||||||||||||||||||||
| 5393 | } never executed: end of block | 0 | ||||||||||||||||||||||||||||||
| 5394 | if (!labelRule.hasPosition()) {
| 0 | ||||||||||||||||||||||||||||||
| 5395 | labelRule.p = new QStyleSheetPositionData(0, 0, 0, 0, defaultOrigin(PseudoElement_GroupBoxTitle), | - | ||||||||||||||||||||||||||||||
| 5396 | gb->textAlignment, PositionMode_Static); | - | ||||||||||||||||||||||||||||||
| 5397 | } never executed: end of block | 0 | ||||||||||||||||||||||||||||||
| 5398 | QRect r = positionRect(w, rule, labelRule, PseudoElement_GroupBoxTitle, | - | ||||||||||||||||||||||||||||||
| 5399 | opt->rect, opt->direction); | - | ||||||||||||||||||||||||||||||
| 5400 | if (gb->subControls & SC_GroupBoxCheckBox) {
| 0 | ||||||||||||||||||||||||||||||
| 5401 | r = labelRule.contentsRect(r); | - | ||||||||||||||||||||||||||||||
| 5402 | if (sc == SC_GroupBoxLabel) {
| 0 | ||||||||||||||||||||||||||||||
| 5403 | r.setLeft(r.left() + iw + spacing); | - | ||||||||||||||||||||||||||||||
| 5404 | r.setTop(r.center().y() - th/2); | - | ||||||||||||||||||||||||||||||
| 5405 | } else { never executed: end of block | 0 | ||||||||||||||||||||||||||||||
| 5406 | r = QRect(r.left(), r.center().y() - ih/2, iw, ih); | - | ||||||||||||||||||||||||||||||
| 5407 | } never executed: end of block | 0 | ||||||||||||||||||||||||||||||
| 5408 | return r; never executed: return r; | 0 | ||||||||||||||||||||||||||||||
| 5409 | } else { | - | ||||||||||||||||||||||||||||||
| 5410 | return labelRule.contentsRect(r); never executed: return labelRule.contentsRect(r); | 0 | ||||||||||||||||||||||||||||||
| 5411 | } | - | ||||||||||||||||||||||||||||||
| 5412 | } | - | ||||||||||||||||||||||||||||||
| 5413 | } // switch | - | ||||||||||||||||||||||||||||||
| 5414 | } | - | ||||||||||||||||||||||||||||||
| 5415 | break; never executed: break; | 0 | ||||||||||||||||||||||||||||||
| 5416 | - | |||||||||||||||||||||||||||||||
| 5417 | case CC_ToolButton: never executed: case CC_ToolButton: | 0 | ||||||||||||||||||||||||||||||
| 5418 | if (const QStyleOptionToolButton *tb = qstyleoption_cast<const QStyleOptionToolButton *>(opt)) {
| 0 | ||||||||||||||||||||||||||||||
| 5419 | if (rule.hasBox() || !rule.hasNativeBorder()) {
| 0 | ||||||||||||||||||||||||||||||
| 5420 | switch (sc) { | - | ||||||||||||||||||||||||||||||
| 5421 | case SC_ToolButton: return rule.borderRect(opt->rect); never executed: return rule.borderRect(opt->rect);never executed: case SC_ToolButton: | 0 | ||||||||||||||||||||||||||||||
| 5422 | case SC_ToolButtonMenu: { never executed: case SC_ToolButtonMenu: | 0 | ||||||||||||||||||||||||||||||
| 5423 | QRenderRule subRule = renderRule(w, opt, PseudoElement_ToolButtonMenu); | - | ||||||||||||||||||||||||||||||
| 5424 | return positionRect(w, rule, subRule, PseudoElement_ToolButtonMenu, opt->rect, opt->direction); never executed: return positionRect(w, rule, subRule, PseudoElement_ToolButtonMenu, opt->rect, opt->direction); | 0 | ||||||||||||||||||||||||||||||
| 5425 | } | - | ||||||||||||||||||||||||||||||
| 5426 | default: never executed: default: | 0 | ||||||||||||||||||||||||||||||
| 5427 | break; never executed: break; | 0 | ||||||||||||||||||||||||||||||
| 5428 | } | - | ||||||||||||||||||||||||||||||
| 5429 | } | - | ||||||||||||||||||||||||||||||
| 5430 | - | |||||||||||||||||||||||||||||||
| 5431 | QStyleOptionToolButton tool(*tb); | - | ||||||||||||||||||||||||||||||
| 5432 | tool.rect = rule.borderRect(opt->rect); | - | ||||||||||||||||||||||||||||||
| 5433 | return rule.baseStyleCanDraw() ? baseStyle()->subControlRect(cc, &tool, sc, w) never executed: return rule.baseStyleCanDraw() ? baseStyle()->subControlRect(cc, &tool, sc, w) : QWindowsStyle::subControlRect(cc, &tool, sc, w);
| 0 | ||||||||||||||||||||||||||||||
| 5434 | : QWindowsStyle::subControlRect(cc, &tool, sc, w); never executed: return rule.baseStyleCanDraw() ? baseStyle()->subControlRect(cc, &tool, sc, w) : QWindowsStyle::subControlRect(cc, &tool, sc, w); | 0 | ||||||||||||||||||||||||||||||
| 5435 | } | - | ||||||||||||||||||||||||||||||
| 5436 | break; never executed: break; | 0 | ||||||||||||||||||||||||||||||
| 5437 | - | |||||||||||||||||||||||||||||||
| 5438 | #ifndef QT_NO_SCROLLBAR | - | ||||||||||||||||||||||||||||||
| 5439 | case CC_ScrollBar: never executed: case CC_ScrollBar: | 0 | ||||||||||||||||||||||||||||||
| 5440 | if (const QStyleOptionSlider *sb = qstyleoption_cast<const QStyleOptionSlider *>(opt)) {
| 0 | ||||||||||||||||||||||||||||||
| 5441 | QStyleOptionSlider styleOptionSlider(*sb); | - | ||||||||||||||||||||||||||||||
| 5442 | styleOptionSlider.rect = rule.borderRect(opt->rect); | - | ||||||||||||||||||||||||||||||
| 5443 | if (rule.hasDrawable() || rule.hasBox()) {
| 0 | ||||||||||||||||||||||||||||||
| 5444 | QRect grooveRect; | - | ||||||||||||||||||||||||||||||
| 5445 | if (!rule.hasBox()) {
| 0 | ||||||||||||||||||||||||||||||
| 5446 | grooveRect = rule.baseStyleCanDraw() ? baseStyle()->subControlRect(cc, sb, SC_ScrollBarGroove, w)
| 0 | ||||||||||||||||||||||||||||||
| 5447 | : QWindowsStyle::subControlRect(cc, sb, SC_ScrollBarGroove, w); | - | ||||||||||||||||||||||||||||||
| 5448 | } else { never executed: end of block | 0 | ||||||||||||||||||||||||||||||
| 5449 | grooveRect = rule.contentsRect(opt->rect); | - | ||||||||||||||||||||||||||||||
| 5450 | } never executed: end of block | 0 | ||||||||||||||||||||||||||||||
| 5451 | - | |||||||||||||||||||||||||||||||
| 5452 | PseudoElement pe = PseudoElement_None; | - | ||||||||||||||||||||||||||||||
| 5453 | - | |||||||||||||||||||||||||||||||
| 5454 | switch (sc) { | - | ||||||||||||||||||||||||||||||
| 5455 | case SC_ScrollBarGroove: never executed: case SC_ScrollBarGroove: | 0 | ||||||||||||||||||||||||||||||
| 5456 | return grooveRect; never executed: return grooveRect; | 0 | ||||||||||||||||||||||||||||||
| 5457 | case SC_ScrollBarAddPage: never executed: case SC_ScrollBarAddPage: | 0 | ||||||||||||||||||||||||||||||
| 5458 | case SC_ScrollBarSubPage: never executed: case SC_ScrollBarSubPage: | 0 | ||||||||||||||||||||||||||||||
| 5459 | case SC_ScrollBarSlider: { never executed: case SC_ScrollBarSlider: | 0 | ||||||||||||||||||||||||||||||
| 5460 | QRect contentRect = grooveRect; | - | ||||||||||||||||||||||||||||||
| 5461 | if (hasStyleRule(w, PseudoElement_ScrollBarSlider)) {
| 0 | ||||||||||||||||||||||||||||||
| 5462 | QRenderRule sliderRule = renderRule(w, opt, PseudoElement_ScrollBarSlider); | - | ||||||||||||||||||||||||||||||
| 5463 | Origin origin = sliderRule.hasPosition() ? sliderRule.position()->origin : defaultOrigin(PseudoElement_ScrollBarSlider);
| 0 | ||||||||||||||||||||||||||||||
| 5464 | contentRect = rule.originRect(opt->rect, origin); | - | ||||||||||||||||||||||||||||||
| 5465 | } never executed: end of block | 0 | ||||||||||||||||||||||||||||||
| 5466 | int maxlen = (styleOptionSlider.orientation == Qt::Horizontal) ? contentRect.width() : contentRect.height();
| 0 | ||||||||||||||||||||||||||||||
| 5467 | int sliderlen; | - | ||||||||||||||||||||||||||||||
| 5468 | if (sb->maximum != sb->minimum) {
| 0 | ||||||||||||||||||||||||||||||
| 5469 | uint range = sb->maximum - sb->minimum; | - | ||||||||||||||||||||||||||||||
| 5470 | sliderlen = (qint64(sb->pageStep) * maxlen) / (range + sb->pageStep); | - | ||||||||||||||||||||||||||||||
| 5471 | - | |||||||||||||||||||||||||||||||
| 5472 | int slidermin = pixelMetric(PM_ScrollBarSliderMin, sb, w); | - | ||||||||||||||||||||||||||||||
| 5473 | if (sliderlen < slidermin || range > INT_MAX / 2)
| 0 | ||||||||||||||||||||||||||||||
| 5474 | sliderlen = slidermin; never executed: sliderlen = slidermin; | 0 | ||||||||||||||||||||||||||||||
| 5475 | if (sliderlen > maxlen)
| 0 | ||||||||||||||||||||||||||||||
| 5476 | sliderlen = maxlen; never executed: sliderlen = maxlen; | 0 | ||||||||||||||||||||||||||||||
| 5477 | } else { never executed: end of block | 0 | ||||||||||||||||||||||||||||||
| 5478 | sliderlen = maxlen; | - | ||||||||||||||||||||||||||||||
| 5479 | } never executed: end of block | 0 | ||||||||||||||||||||||||||||||
| 5480 | const int sliderPosition = sb->orientation == Qt::Horizontal && sb->direction == Qt::RightToLeft ? sb->maximum - sb->sliderPosition + sb->minimum : sb->sliderPosition;
| 0 | ||||||||||||||||||||||||||||||
| 5481 | int sliderstart = (styleOptionSlider.orientation == Qt::Horizontal ? contentRect.left() : contentRect.top())
| 0 | ||||||||||||||||||||||||||||||
| 5482 | + sliderPositionFromValue(sb->minimum, sb->maximum, sliderPosition, | - | ||||||||||||||||||||||||||||||
| 5483 | maxlen - sliderlen, sb->upsideDown); | - | ||||||||||||||||||||||||||||||
| 5484 | - | |||||||||||||||||||||||||||||||
| 5485 | QRect sr = (sb->orientation == Qt::Horizontal)
| 0 | ||||||||||||||||||||||||||||||
| 5486 | ? QRect(sliderstart, contentRect.top(), sliderlen, contentRect.height()) | - | ||||||||||||||||||||||||||||||
| 5487 | : QRect(contentRect.left(), sliderstart, contentRect.width(), sliderlen); | - | ||||||||||||||||||||||||||||||
| 5488 | if (sc == SC_ScrollBarSlider) {
| 0 | ||||||||||||||||||||||||||||||
| 5489 | return sr; never executed: return sr; | 0 | ||||||||||||||||||||||||||||||
| 5490 | } else if (sc == SC_ScrollBarSubPage) {
| 0 | ||||||||||||||||||||||||||||||
| 5491 | return QRect(contentRect.topLeft(), sb->orientation == Qt::Horizontal ? sr.bottomLeft() : sr.topRight()); never executed: return QRect(contentRect.topLeft(), sb->orientation == Qt::Horizontal ? sr.bottomLeft() : sr.topRight()); | 0 | ||||||||||||||||||||||||||||||
| 5492 | } else { // SC_ScrollBarAddPage | - | ||||||||||||||||||||||||||||||
| 5493 | return QRect(sb->orientation == Qt::Horizontal ? sr.topRight() : sr.bottomLeft(), contentRect.bottomRight()); never executed: return QRect(sb->orientation == Qt::Horizontal ? sr.topRight() : sr.bottomLeft(), contentRect.bottomRight()); | 0 | ||||||||||||||||||||||||||||||
| 5494 | } | - | ||||||||||||||||||||||||||||||
| 5495 | break; dead code: break; | - | ||||||||||||||||||||||||||||||
| 5496 | } | - | ||||||||||||||||||||||||||||||
| 5497 | case SC_ScrollBarAddLine: pe = PseudoElement_ScrollBarAddLine; break; never executed: break;never executed: case SC_ScrollBarAddLine: | 0 | ||||||||||||||||||||||||||||||
| 5498 | case SC_ScrollBarSubLine: pe = PseudoElement_ScrollBarSubLine; break; never executed: break;never executed: case SC_ScrollBarSubLine: | 0 | ||||||||||||||||||||||||||||||
| 5499 | case SC_ScrollBarFirst: pe = PseudoElement_ScrollBarFirst; break; never executed: break;never executed: case SC_ScrollBarFirst: | 0 | ||||||||||||||||||||||||||||||
| 5500 | case SC_ScrollBarLast: pe = PseudoElement_ScrollBarLast; break; never executed: break;never executed: case SC_ScrollBarLast: | 0 | ||||||||||||||||||||||||||||||
| 5501 | default: break; never executed: break;never executed: default: | 0 | ||||||||||||||||||||||||||||||
| 5502 | } | - | ||||||||||||||||||||||||||||||
| 5503 | if (hasStyleRule(w,pe)) {
| 0 | ||||||||||||||||||||||||||||||
| 5504 | QRenderRule subRule = renderRule(w, opt, pe); | - | ||||||||||||||||||||||||||||||
| 5505 | if (subRule.hasPosition() || subRule.hasGeometry() || subRule.hasBox()) {
| 0 | ||||||||||||||||||||||||||||||
| 5506 | const QStyleSheetPositionData *pos = subRule.position(); | - | ||||||||||||||||||||||||||||||
| 5507 | QRect originRect = grooveRect; | - | ||||||||||||||||||||||||||||||
| 5508 | if (rule.hasBox()) {
| 0 | ||||||||||||||||||||||||||||||
| 5509 | Origin origin = (pos && pos->origin != Origin_Unknown) ? pos->origin : defaultOrigin(pe);
| 0 | ||||||||||||||||||||||||||||||
| 5510 | originRect = rule.originRect(opt->rect, origin); | - | ||||||||||||||||||||||||||||||
| 5511 | } never executed: end of block | 0 | ||||||||||||||||||||||||||||||
| 5512 | return positionRect(w, subRule, pe, originRect, styleOptionSlider.direction); never executed: return positionRect(w, subRule, pe, originRect, styleOptionSlider.direction); | 0 | ||||||||||||||||||||||||||||||
| 5513 | } | - | ||||||||||||||||||||||||||||||
| 5514 | } never executed: end of block | 0 | ||||||||||||||||||||||||||||||
| 5515 | } never executed: end of block | 0 | ||||||||||||||||||||||||||||||
| 5516 | return rule.baseStyleCanDraw() ? baseStyle()->subControlRect(cc, &styleOptionSlider, sc, w) never executed: return rule.baseStyleCanDraw() ? baseStyle()->subControlRect(cc, &styleOptionSlider, sc, w) : QWindowsStyle::subControlRect(cc, &styleOptionSlider, sc, w);
| 0 | ||||||||||||||||||||||||||||||
| 5517 | : QWindowsStyle::subControlRect(cc, &styleOptionSlider, sc, w); never executed: return rule.baseStyleCanDraw() ? baseStyle()->subControlRect(cc, &styleOptionSlider, sc, w) : QWindowsStyle::subControlRect(cc, &styleOptionSlider, sc, w); | 0 | ||||||||||||||||||||||||||||||
| 5518 | } | - | ||||||||||||||||||||||||||||||
| 5519 | break; never executed: break; | 0 | ||||||||||||||||||||||||||||||
| 5520 | #endif // QT_NO_SCROLLBAR | - | ||||||||||||||||||||||||||||||
| 5521 | - | |||||||||||||||||||||||||||||||
| 5522 | #ifndef QT_NO_SLIDER | - | ||||||||||||||||||||||||||||||
| 5523 | case CC_Slider: never executed: case CC_Slider: | 0 | ||||||||||||||||||||||||||||||
| 5524 | if (const QStyleOptionSlider *slider = qstyleoption_cast<const QStyleOptionSlider *>(opt)) {
| 0 | ||||||||||||||||||||||||||||||
| 5525 | QRenderRule subRule = renderRule(w, opt, PseudoElement_SliderGroove); | - | ||||||||||||||||||||||||||||||
| 5526 | if (!subRule.hasDrawable())
| 0 | ||||||||||||||||||||||||||||||
| 5527 | break; never executed: break; | 0 | ||||||||||||||||||||||||||||||
| 5528 | subRule.img = 0; | - | ||||||||||||||||||||||||||||||
| 5529 | QRect gr = positionRect(w, rule, subRule, PseudoElement_SliderGroove, opt->rect, opt->direction); | - | ||||||||||||||||||||||||||||||
| 5530 | switch (sc) { | - | ||||||||||||||||||||||||||||||
| 5531 | case SC_SliderGroove: never executed: case SC_SliderGroove: | 0 | ||||||||||||||||||||||||||||||
| 5532 | return gr; never executed: return gr; | 0 | ||||||||||||||||||||||||||||||
| 5533 | case SC_SliderHandle: { never executed: case SC_SliderHandle: | 0 | ||||||||||||||||||||||||||||||
| 5534 | bool horizontal = slider->orientation & Qt::Horizontal; | - | ||||||||||||||||||||||||||||||
| 5535 | QRect cr = subRule.contentsRect(gr); | - | ||||||||||||||||||||||||||||||
| 5536 | QRenderRule subRule2 = renderRule(w, opt, PseudoElement_SliderHandle); | - | ||||||||||||||||||||||||||||||
| 5537 | int len = horizontal ? subRule2.size().width() : subRule2.size().height();
| 0 | ||||||||||||||||||||||||||||||
| 5538 | subRule2.img = 0; | - | ||||||||||||||||||||||||||||||
| 5539 | subRule2.geo = 0; | - | ||||||||||||||||||||||||||||||
| 5540 | cr = positionRect(w, subRule2, PseudoElement_SliderHandle, cr, opt->direction); | - | ||||||||||||||||||||||||||||||
| 5541 | int thickness = horizontal ? cr.height() : cr.width();
| 0 | ||||||||||||||||||||||||||||||
| 5542 | int sliderPos = sliderPositionFromValue(slider->minimum, slider->maximum, slider->sliderPosition, | - | ||||||||||||||||||||||||||||||
| 5543 | (horizontal ? cr.width() : cr.height()) - len, slider->upsideDown); | - | ||||||||||||||||||||||||||||||
| 5544 | cr = horizontal ? QRect(cr.x() + sliderPos, cr.y(), len, thickness)
| 0 | ||||||||||||||||||||||||||||||
| 5545 | : QRect(cr.x(), cr.y() + sliderPos, thickness, len); | - | ||||||||||||||||||||||||||||||
| 5546 | return subRule2.borderRect(cr); never executed: return subRule2.borderRect(cr); | 0 | ||||||||||||||||||||||||||||||
| 5547 | break; } dead code: break; | - | ||||||||||||||||||||||||||||||
| 5548 | case SC_SliderTickmarks: never executed: case SC_SliderTickmarks: | 0 | ||||||||||||||||||||||||||||||
| 5549 | // TODO... | - | ||||||||||||||||||||||||||||||
| 5550 | default: never executed: default: | 0 | ||||||||||||||||||||||||||||||
| 5551 | break; never executed: break; | 0 | ||||||||||||||||||||||||||||||
| 5552 | } | - | ||||||||||||||||||||||||||||||
| 5553 | } | - | ||||||||||||||||||||||||||||||
| 5554 | break; never executed: break; | 0 | ||||||||||||||||||||||||||||||
| 5555 | #endif // QT_NO_SLIDER | - | ||||||||||||||||||||||||||||||
| 5556 | - | |||||||||||||||||||||||||||||||
| 5557 | case CC_MdiControls: never executed: case CC_MdiControls: | 0 | ||||||||||||||||||||||||||||||
| 5558 | if (hasStyleRule(w, PseudoElement_MdiCloseButton)
| 0 | ||||||||||||||||||||||||||||||
| 5559 | || hasStyleRule(w, PseudoElement_MdiNormalButton)
| 0 | ||||||||||||||||||||||||||||||
| 5560 | || hasStyleRule(w, PseudoElement_MdiMinButton)) {
| 0 | ||||||||||||||||||||||||||||||
| 5561 | QList<QVariant> layout = rule.styleHint(QLatin1String("button-layout")).toList(); | - | ||||||||||||||||||||||||||||||
| 5562 | if (layout.isEmpty())
| 0 | ||||||||||||||||||||||||||||||
| 5563 | layout = subControlLayout(QLatin1String("mNX")); never executed: layout = subControlLayout(QLatin1String("mNX")); | 0 | ||||||||||||||||||||||||||||||
| 5564 | - | |||||||||||||||||||||||||||||||
| 5565 | int x = 0, width = 0; | - | ||||||||||||||||||||||||||||||
| 5566 | QRenderRule subRule; | - | ||||||||||||||||||||||||||||||
| 5567 | for (int i = 0; i < layout.count(); i++) {
| 0 | ||||||||||||||||||||||||||||||
| 5568 | int layoutButton = layout[i].toInt(); | - | ||||||||||||||||||||||||||||||
| 5569 | if (layoutButton < PseudoElement_MdiCloseButton
| 0 | ||||||||||||||||||||||||||||||
| 5570 | || layoutButton > PseudoElement_MdiNormalButton)
| 0 | ||||||||||||||||||||||||||||||
| 5571 | continue; never executed: continue; | 0 | ||||||||||||||||||||||||||||||
| 5572 | QStyle::SubControl control = knownPseudoElements[layoutButton].subControl; | - | ||||||||||||||||||||||||||||||
| 5573 | if (!(opt->subControls & control))
| 0 | ||||||||||||||||||||||||||||||
| 5574 | continue; never executed: continue; | 0 | ||||||||||||||||||||||||||||||
| 5575 | subRule = renderRule(w, opt, layoutButton); | - | ||||||||||||||||||||||||||||||
| 5576 | width = subRule.size().width(); | - | ||||||||||||||||||||||||||||||
| 5577 | if (sc == control)
| 0 | ||||||||||||||||||||||||||||||
| 5578 | break; never executed: break; | 0 | ||||||||||||||||||||||||||||||
| 5579 | x += width; | - | ||||||||||||||||||||||||||||||
| 5580 | } never executed: end of block | 0 | ||||||||||||||||||||||||||||||
| 5581 | - | |||||||||||||||||||||||||||||||
| 5582 | return subRule.borderRect(QRect(x, opt->rect.top(), width, opt->rect.height())); never executed: return subRule.borderRect(QRect(x, opt->rect.top(), width, opt->rect.height())); | 0 | ||||||||||||||||||||||||||||||
| 5583 | } | - | ||||||||||||||||||||||||||||||
| 5584 | break; never executed: break; | 0 | ||||||||||||||||||||||||||||||
| 5585 | - | |||||||||||||||||||||||||||||||
| 5586 | case CC_TitleBar: never executed: case CC_TitleBar: | 0 | ||||||||||||||||||||||||||||||
| 5587 | if (const QStyleOptionTitleBar *tb = qstyleoption_cast<const QStyleOptionTitleBar *>(opt)) {
| 0 | ||||||||||||||||||||||||||||||
| 5588 | QRenderRule subRule = renderRule(w, opt, PseudoElement_TitleBar); | - | ||||||||||||||||||||||||||||||
| 5589 | if (!subRule.hasDrawable() && !subRule.hasBox() && !subRule.hasBorder())
| 0 | ||||||||||||||||||||||||||||||
| 5590 | break; never executed: break; | 0 | ||||||||||||||||||||||||||||||
| 5591 | QHash<QStyle::SubControl, QRect> layoutRects = titleBarLayout(w, tb); | - | ||||||||||||||||||||||||||||||
| 5592 | return layoutRects.value(sc); never executed: return layoutRects.value(sc); | 0 | ||||||||||||||||||||||||||||||
| 5593 | } | - | ||||||||||||||||||||||||||||||
| 5594 | break; never executed: break; | 0 | ||||||||||||||||||||||||||||||
| 5595 | - | |||||||||||||||||||||||||||||||
| 5596 | default: never executed: default: | 0 | ||||||||||||||||||||||||||||||
| 5597 | break; never executed: break; | 0 | ||||||||||||||||||||||||||||||
| 5598 | } | - | ||||||||||||||||||||||||||||||
| 5599 | - | |||||||||||||||||||||||||||||||
| 5600 | return baseStyle()->subControlRect(cc, opt, sc, w); never executed: return baseStyle()->subControlRect(cc, opt, sc, w); | 0 | ||||||||||||||||||||||||||||||
| 5601 | } | - | ||||||||||||||||||||||||||||||
| 5602 | - | |||||||||||||||||||||||||||||||
| 5603 | QRect QStyleSheetStyle::subElementRect(SubElement se, const QStyleOption *opt, const QWidget *w) const | - | ||||||||||||||||||||||||||||||
| 5604 | { | - | ||||||||||||||||||||||||||||||
| 5605 | RECURSION_GUARD(return baseStyle()->subElementRect(se, opt, w)) never executed: return baseStyle()->subElementRect(se, opt, w);
| 0 | ||||||||||||||||||||||||||||||
| 5606 | - | |||||||||||||||||||||||||||||||
| 5607 | QRenderRule rule = renderRule(w, opt); | - | ||||||||||||||||||||||||||||||
| 5608 | #ifndef QT_NO_TABBAR | - | ||||||||||||||||||||||||||||||
| 5609 | int pe = PseudoElement_None; | - | ||||||||||||||||||||||||||||||
| 5610 | #endif | - | ||||||||||||||||||||||||||||||
| 5611 | - | |||||||||||||||||||||||||||||||
| 5612 | switch (se) { | - | ||||||||||||||||||||||||||||||
| 5613 | case SE_PushButtonContents: never executed: case SE_PushButtonContents: | 0 | ||||||||||||||||||||||||||||||
| 5614 | case SE_PushButtonFocusRect: never executed: case SE_PushButtonFocusRect: | 0 | ||||||||||||||||||||||||||||||
| 5615 | if (const QStyleOptionButton *btn = qstyleoption_cast<const QStyleOptionButton *>(opt)) {
| 0 | ||||||||||||||||||||||||||||||
| 5616 | QStyleOptionButton btnOpt(*btn); | - | ||||||||||||||||||||||||||||||
| 5617 | if (rule.hasBox() || !rule.hasNativeBorder())
| 0 | ||||||||||||||||||||||||||||||
| 5618 | return visualRect(opt->direction, opt->rect, rule.contentsRect(opt->rect)); never executed: return visualRect(opt->direction, opt->rect, rule.contentsRect(opt->rect)); | 0 | ||||||||||||||||||||||||||||||
| 5619 | return rule.baseStyleCanDraw() ? baseStyle()->subElementRect(se, &btnOpt, w) never executed: return rule.baseStyleCanDraw() ? baseStyle()->subElementRect(se, &btnOpt, w) : QWindowsStyle::subElementRect(se, &btnOpt, w);
| 0 | ||||||||||||||||||||||||||||||
| 5620 | : QWindowsStyle::subElementRect(se, &btnOpt, w); never executed: return rule.baseStyleCanDraw() ? baseStyle()->subElementRect(se, &btnOpt, w) : QWindowsStyle::subElementRect(se, &btnOpt, w); | 0 | ||||||||||||||||||||||||||||||
| 5621 | } | - | ||||||||||||||||||||||||||||||
| 5622 | break; never executed: break; | 0 | ||||||||||||||||||||||||||||||
| 5623 | - | |||||||||||||||||||||||||||||||
| 5624 | case SE_LineEditContents: never executed: case SE_LineEditContents: | 0 | ||||||||||||||||||||||||||||||
| 5625 | case SE_FrameContents: never executed: case SE_FrameContents: | 0 | ||||||||||||||||||||||||||||||
| 5626 | case SE_ShapedFrameContents: never executed: case SE_ShapedFrameContents: | 0 | ||||||||||||||||||||||||||||||
| 5627 | if (rule.hasBox() || !rule.hasNativeBorder()) {
| 0 | ||||||||||||||||||||||||||||||
| 5628 | return visualRect(opt->direction, opt->rect, rule.contentsRect(opt->rect)); never executed: return visualRect(opt->direction, opt->rect, rule.contentsRect(opt->rect)); | 0 | ||||||||||||||||||||||||||||||
| 5629 | } | - | ||||||||||||||||||||||||||||||
| 5630 | break; never executed: break; | 0 | ||||||||||||||||||||||||||||||
| 5631 | - | |||||||||||||||||||||||||||||||
| 5632 | case SE_CheckBoxIndicator: never executed: case SE_CheckBoxIndicator: | 0 | ||||||||||||||||||||||||||||||
| 5633 | case SE_RadioButtonIndicator: never executed: case SE_RadioButtonIndicator: | 0 | ||||||||||||||||||||||||||||||
| 5634 | if (rule.hasBox() || rule.hasBorder() || hasStyleRule(w, PseudoElement_Indicator)) {
| 0 | ||||||||||||||||||||||||||||||
| 5635 | PseudoElement pe = se == SE_CheckBoxIndicator ? PseudoElement_Indicator : PseudoElement_ExclusiveIndicator;
| 0 | ||||||||||||||||||||||||||||||
| 5636 | QRenderRule subRule = renderRule(w, opt, pe); | - | ||||||||||||||||||||||||||||||
| 5637 | return positionRect(w, rule, subRule, pe, opt->rect, opt->direction); never executed: return positionRect(w, rule, subRule, pe, opt->rect, opt->direction); | 0 | ||||||||||||||||||||||||||||||
| 5638 | } | - | ||||||||||||||||||||||||||||||
| 5639 | break; never executed: break; | 0 | ||||||||||||||||||||||||||||||
| 5640 | - | |||||||||||||||||||||||||||||||
| 5641 | case SE_CheckBoxContents: never executed: case SE_CheckBoxContents: | 0 | ||||||||||||||||||||||||||||||
| 5642 | case SE_RadioButtonContents: never executed: case SE_RadioButtonContents: | 0 | ||||||||||||||||||||||||||||||
| 5643 | if (rule.hasBox() || rule.hasBorder() || hasStyleRule(w, PseudoElement_Indicator)) {
| 0 | ||||||||||||||||||||||||||||||
| 5644 | bool isRadio = se == SE_RadioButtonContents; | - | ||||||||||||||||||||||||||||||
| 5645 | QRect ir = subElementRect(isRadio ? SE_RadioButtonIndicator : SE_CheckBoxIndicator, | - | ||||||||||||||||||||||||||||||
| 5646 | opt, w); | - | ||||||||||||||||||||||||||||||
| 5647 | ir = visualRect(opt->direction, opt->rect, ir); | - | ||||||||||||||||||||||||||||||
| 5648 | int spacing = pixelMetric(isRadio ? PM_RadioButtonLabelSpacing : PM_CheckBoxLabelSpacing, 0, w); | - | ||||||||||||||||||||||||||||||
| 5649 | QRect cr = rule.contentsRect(opt->rect); | - | ||||||||||||||||||||||||||||||
| 5650 | ir.setRect(ir.left() + ir.width() + spacing, cr.y(), | - | ||||||||||||||||||||||||||||||
| 5651 | cr.width() - ir.width() - spacing, cr.height()); | - | ||||||||||||||||||||||||||||||
| 5652 | return visualRect(opt->direction, opt->rect, ir); never executed: return visualRect(opt->direction, opt->rect, ir); | 0 | ||||||||||||||||||||||||||||||
| 5653 | } | - | ||||||||||||||||||||||||||||||
| 5654 | break; never executed: break; | 0 | ||||||||||||||||||||||||||||||
| 5655 | - | |||||||||||||||||||||||||||||||
| 5656 | case SE_ToolBoxTabContents: never executed: case SE_ToolBoxTabContents: | 0 | ||||||||||||||||||||||||||||||
| 5657 | if (w && hasStyleRule(w->parentWidget(), PseudoElement_ToolBoxTab)) {
| 0 | ||||||||||||||||||||||||||||||
| 5658 | QRenderRule subRule = renderRule(w->parentWidget(), opt, PseudoElement_ToolBoxTab); | - | ||||||||||||||||||||||||||||||
| 5659 | return visualRect(opt->direction, opt->rect, subRule.contentsRect(opt->rect)); never executed: return visualRect(opt->direction, opt->rect, subRule.contentsRect(opt->rect)); | 0 | ||||||||||||||||||||||||||||||
| 5660 | } | - | ||||||||||||||||||||||||||||||
| 5661 | break; never executed: break; | 0 | ||||||||||||||||||||||||||||||
| 5662 | - | |||||||||||||||||||||||||||||||
| 5663 | case SE_RadioButtonFocusRect: never executed: case SE_RadioButtonFocusRect: | 0 | ||||||||||||||||||||||||||||||
| 5664 | case SE_RadioButtonClickRect: // focusrect | indicator never executed: case SE_RadioButtonClickRect: | 0 | ||||||||||||||||||||||||||||||
| 5665 | if (rule.hasBox() || rule.hasBorder() || hasStyleRule(w, PseudoElement_Indicator)) {
| 0 | ||||||||||||||||||||||||||||||
| 5666 | return opt->rect; never executed: return opt->rect; | 0 | ||||||||||||||||||||||||||||||
| 5667 | } | - | ||||||||||||||||||||||||||||||
| 5668 | break; never executed: break; | 0 | ||||||||||||||||||||||||||||||
| 5669 | - | |||||||||||||||||||||||||||||||
| 5670 | case SE_CheckBoxFocusRect: never executed: case SE_CheckBoxFocusRect: | 0 | ||||||||||||||||||||||||||||||
| 5671 | case SE_CheckBoxClickRect: // relies on indicator and contents never executed: case SE_CheckBoxClickRect: | 0 | ||||||||||||||||||||||||||||||
| 5672 | return ParentStyle::subElementRect(se, opt, w); never executed: return ParentStyle::subElementRect(se, opt, w); | 0 | ||||||||||||||||||||||||||||||
| 5673 | - | |||||||||||||||||||||||||||||||
| 5674 | #ifndef QT_NO_ITEMVIEWS | - | ||||||||||||||||||||||||||||||
| 5675 | case SE_ViewItemCheckIndicator: never executed: case SE_ViewItemCheckIndicator: | 0 | ||||||||||||||||||||||||||||||
| 5676 | if (!qstyleoption_cast<const QStyleOptionViewItem *>(opt)) {
| 0 | ||||||||||||||||||||||||||||||
| 5677 | return subElementRect(SE_CheckBoxIndicator, opt, w); never executed: return subElementRect(SE_CheckBoxIndicator, opt, w); | 0 | ||||||||||||||||||||||||||||||
| 5678 | } | - | ||||||||||||||||||||||||||||||
| 5679 | // intentionally falls through | - | ||||||||||||||||||||||||||||||
| 5680 | case SE_ItemViewItemText: code before this statement never executed: case SE_ItemViewItemText:never executed: case SE_ItemViewItemText: | 0 | ||||||||||||||||||||||||||||||
| 5681 | case SE_ItemViewItemDecoration: never executed: case SE_ItemViewItemDecoration: | 0 | ||||||||||||||||||||||||||||||
| 5682 | case SE_ItemViewItemFocusRect: never executed: case SE_ItemViewItemFocusRect: | 0 | ||||||||||||||||||||||||||||||
| 5683 | if (const QStyleOptionViewItem *vopt = qstyleoption_cast<const QStyleOptionViewItem *>(opt)) {
| 0 | ||||||||||||||||||||||||||||||
| 5684 | QRenderRule subRule = renderRule(w, opt, PseudoElement_ViewItem); | - | ||||||||||||||||||||||||||||||
| 5685 | PseudoElement pe = PseudoElement_None; | - | ||||||||||||||||||||||||||||||
| 5686 | if (se == SE_ItemViewItemText || se == SE_ItemViewItemFocusRect)
| 0 | ||||||||||||||||||||||||||||||
| 5687 | pe = PseudoElement_ViewItemText; never executed: pe = PseudoElement_ViewItemText; | 0 | ||||||||||||||||||||||||||||||
| 5688 | else if (se == SE_ItemViewItemDecoration && vopt->features & QStyleOptionViewItem::HasDecoration)
| 0 | ||||||||||||||||||||||||||||||
| 5689 | pe = PseudoElement_ViewItemIcon; never executed: pe = PseudoElement_ViewItemIcon; | 0 | ||||||||||||||||||||||||||||||
| 5690 | else if (se == SE_ItemViewItemCheckIndicator && vopt->features & QStyleOptionViewItem::HasCheckIndicator)
| 0 | ||||||||||||||||||||||||||||||
| 5691 | pe = PseudoElement_ViewItemIndicator; never executed: pe = PseudoElement_ViewItemIndicator; | 0 | ||||||||||||||||||||||||||||||
| 5692 | else | - | ||||||||||||||||||||||||||||||
| 5693 | break; never executed: break; | 0 | ||||||||||||||||||||||||||||||
| 5694 | if (subRule.hasGeometry() || subRule.hasBox() || !subRule.hasNativeBorder() || hasStyleRule(w, pe)) {
| 0 | ||||||||||||||||||||||||||||||
| 5695 | QRenderRule subRule2 = renderRule(w, opt, pe); | - | ||||||||||||||||||||||||||||||
| 5696 | QStyleOptionViewItem optCopy(*vopt); | - | ||||||||||||||||||||||||||||||
| 5697 | optCopy.rect = subRule.contentsRect(vopt->rect); | - | ||||||||||||||||||||||||||||||
| 5698 | QRect rect = ParentStyle::subElementRect(se, &optCopy, w); | - | ||||||||||||||||||||||||||||||
| 5699 | return positionRect(w, subRule2, pe, rect, opt->direction); never executed: return positionRect(w, subRule2, pe, rect, opt->direction); | 0 | ||||||||||||||||||||||||||||||
| 5700 | } | - | ||||||||||||||||||||||||||||||
| 5701 | } never executed: end of block | 0 | ||||||||||||||||||||||||||||||
| 5702 | break; never executed: break; | 0 | ||||||||||||||||||||||||||||||
| 5703 | #endif // QT_NO_ITEMVIEWS | - | ||||||||||||||||||||||||||||||
| 5704 | - | |||||||||||||||||||||||||||||||
| 5705 | case SE_HeaderArrow: { never executed: case SE_HeaderArrow: | 0 | ||||||||||||||||||||||||||||||
| 5706 | QRenderRule subRule = renderRule(w, opt, PseudoElement_HeaderViewUpArrow); | - | ||||||||||||||||||||||||||||||
| 5707 | if (subRule.hasPosition() || subRule.hasGeometry())
| 0 | ||||||||||||||||||||||||||||||
| 5708 | return positionRect(w, rule, subRule, PseudoElement_HeaderViewUpArrow, opt->rect, opt->direction); never executed: return positionRect(w, rule, subRule, PseudoElement_HeaderViewUpArrow, opt->rect, opt->direction); | 0 | ||||||||||||||||||||||||||||||
| 5709 | } | - | ||||||||||||||||||||||||||||||
| 5710 | break; never executed: break; | 0 | ||||||||||||||||||||||||||||||
| 5711 | - | |||||||||||||||||||||||||||||||
| 5712 | case SE_HeaderLabel: { never executed: case SE_HeaderLabel: | 0 | ||||||||||||||||||||||||||||||
| 5713 | QRenderRule subRule = renderRule(w, opt, PseudoElement_HeaderViewSection); | - | ||||||||||||||||||||||||||||||
| 5714 | if (subRule.hasBox() || !subRule.hasNativeBorder())
| 0 | ||||||||||||||||||||||||||||||
| 5715 | return subRule.contentsRect(opt->rect); never executed: return subRule.contentsRect(opt->rect); | 0 | ||||||||||||||||||||||||||||||
| 5716 | } | - | ||||||||||||||||||||||||||||||
| 5717 | break; never executed: break; | 0 | ||||||||||||||||||||||||||||||
| 5718 | - | |||||||||||||||||||||||||||||||
| 5719 | case SE_ProgressBarGroove: never executed: case SE_ProgressBarGroove: | 0 | ||||||||||||||||||||||||||||||
| 5720 | case SE_ProgressBarContents: never executed: case SE_ProgressBarContents: | 0 | ||||||||||||||||||||||||||||||
| 5721 | case SE_ProgressBarLabel: never executed: case SE_ProgressBarLabel: | 0 | ||||||||||||||||||||||||||||||
| 5722 | if (const QStyleOptionProgressBar *pb = qstyleoption_cast<const QStyleOptionProgressBar *>(opt)) {
| 0 | ||||||||||||||||||||||||||||||
| 5723 | if (rule.hasBox() || !rule.hasNativeBorder() || rule.hasPosition() || hasStyleRule(w, PseudoElement_ProgressBarChunk)) {
| 0 | ||||||||||||||||||||||||||||||
| 5724 | if (se == SE_ProgressBarGroove)
| 0 | ||||||||||||||||||||||||||||||
| 5725 | return rule.borderRect(pb->rect); never executed: return rule.borderRect(pb->rect); | 0 | ||||||||||||||||||||||||||||||
| 5726 | else if (se == SE_ProgressBarContents)
| 0 | ||||||||||||||||||||||||||||||
| 5727 | return rule.contentsRect(pb->rect); never executed: return rule.contentsRect(pb->rect); | 0 | ||||||||||||||||||||||||||||||
| 5728 | - | |||||||||||||||||||||||||||||||
| 5729 | QSize sz = pb->fontMetrics.size(0, pb->text); | - | ||||||||||||||||||||||||||||||
| 5730 | return QStyle::alignedRect(Qt::LeftToRight, rule.hasPosition() ? rule.position()->textAlignment : pb->textAlignment, never executed: return QStyle::alignedRect(Qt::LeftToRight, rule.hasPosition() ? rule.position()->textAlignment : pb->textAlignment, sz, pb->rect); | 0 | ||||||||||||||||||||||||||||||
| 5731 | sz, pb->rect); never executed: return QStyle::alignedRect(Qt::LeftToRight, rule.hasPosition() ? rule.position()->textAlignment : pb->textAlignment, sz, pb->rect); | 0 | ||||||||||||||||||||||||||||||
| 5732 | } | - | ||||||||||||||||||||||||||||||
| 5733 | } never executed: end of block | 0 | ||||||||||||||||||||||||||||||
| 5734 | break; never executed: break; | 0 | ||||||||||||||||||||||||||||||
| 5735 | - | |||||||||||||||||||||||||||||||
| 5736 | #ifndef QT_NO_TABBAR | - | ||||||||||||||||||||||||||||||
| 5737 | case SE_TabWidgetLeftCorner: never executed: case SE_TabWidgetLeftCorner: | 0 | ||||||||||||||||||||||||||||||
| 5738 | pe = PseudoElement_TabWidgetLeftCorner; | - | ||||||||||||||||||||||||||||||
| 5739 | // intentionally falls through | - | ||||||||||||||||||||||||||||||
| 5740 | case SE_TabWidgetRightCorner: code before this statement never executed: case SE_TabWidgetRightCorner:never executed: case SE_TabWidgetRightCorner: | 0 | ||||||||||||||||||||||||||||||
| 5741 | if (pe == PseudoElement_None)
| 0 | ||||||||||||||||||||||||||||||
| 5742 | pe = PseudoElement_TabWidgetRightCorner; never executed: pe = PseudoElement_TabWidgetRightCorner; | 0 | ||||||||||||||||||||||||||||||
| 5743 | // intentionally falls through | - | ||||||||||||||||||||||||||||||
| 5744 | case SE_TabWidgetTabBar: code before this statement never executed: case SE_TabWidgetTabBar:never executed: case SE_TabWidgetTabBar: | 0 | ||||||||||||||||||||||||||||||
| 5745 | if (pe == PseudoElement_None)
| 0 | ||||||||||||||||||||||||||||||
| 5746 | pe = PseudoElement_TabWidgetTabBar; never executed: pe = PseudoElement_TabWidgetTabBar; | 0 | ||||||||||||||||||||||||||||||
| 5747 | // intentionally falls through | - | ||||||||||||||||||||||||||||||
| 5748 | case SE_TabWidgetTabPane: code before this statement never executed: case SE_TabWidgetTabPane:never executed: case SE_TabWidgetTabPane: | 0 | ||||||||||||||||||||||||||||||
| 5749 | case SE_TabWidgetTabContents: never executed: case SE_TabWidgetTabContents: | 0 | ||||||||||||||||||||||||||||||
| 5750 | if (pe == PseudoElement_None)
| 0 | ||||||||||||||||||||||||||||||
| 5751 | pe = PseudoElement_TabWidgetPane; never executed: pe = PseudoElement_TabWidgetPane; | 0 | ||||||||||||||||||||||||||||||
| 5752 | - | |||||||||||||||||||||||||||||||
| 5753 | if (hasStyleRule(w, pe)) {
| 0 | ||||||||||||||||||||||||||||||
| 5754 | QRect r = QWindowsStyle::subElementRect(pe == PseudoElement_TabWidgetPane ? SE_TabWidgetTabPane : se, opt, w); | - | ||||||||||||||||||||||||||||||
| 5755 | QRenderRule subRule = renderRule(w, opt, pe); | - | ||||||||||||||||||||||||||||||
| 5756 | r = positionRect(w, subRule, pe, r, opt->direction); | - | ||||||||||||||||||||||||||||||
| 5757 | if (pe == PseudoElement_TabWidgetTabBar) {
| 0 | ||||||||||||||||||||||||||||||
| 5758 | Q_ASSERT(opt); | - | ||||||||||||||||||||||||||||||
| 5759 | r = opt->rect.intersected(r); | - | ||||||||||||||||||||||||||||||
| 5760 | } never executed: end of block | 0 | ||||||||||||||||||||||||||||||
| 5761 | if (se == SE_TabWidgetTabContents)
| 0 | ||||||||||||||||||||||||||||||
| 5762 | r = subRule.contentsRect(r); never executed: r = subRule.contentsRect(r); | 0 | ||||||||||||||||||||||||||||||
| 5763 | return r; never executed: return r; | 0 | ||||||||||||||||||||||||||||||
| 5764 | } | - | ||||||||||||||||||||||||||||||
| 5765 | break; never executed: break; | 0 | ||||||||||||||||||||||||||||||
| 5766 | - | |||||||||||||||||||||||||||||||
| 5767 | case SE_TabBarTearIndicator: { never executed: case SE_TabBarTearIndicator: | 0 | ||||||||||||||||||||||||||||||
| 5768 | QRenderRule subRule = renderRule(w, opt, PseudoElement_TabBarTear); | - | ||||||||||||||||||||||||||||||
| 5769 | if (subRule.hasContentsSize()) {
| 0 | ||||||||||||||||||||||||||||||
| 5770 | QRect r; | - | ||||||||||||||||||||||||||||||
| 5771 | if (const QStyleOptionTab *tab = qstyleoption_cast<const QStyleOptionTab *>(opt)) {
| 0 | ||||||||||||||||||||||||||||||
| 5772 | switch (tab->shape) { | - | ||||||||||||||||||||||||||||||
| 5773 | case QTabBar::RoundedNorth: never executed: case QTabBar::RoundedNorth: | 0 | ||||||||||||||||||||||||||||||
| 5774 | case QTabBar::TriangularNorth: never executed: case QTabBar::TriangularNorth: | 0 | ||||||||||||||||||||||||||||||
| 5775 | case QTabBar::RoundedSouth: never executed: case QTabBar::RoundedSouth: | 0 | ||||||||||||||||||||||||||||||
| 5776 | case QTabBar::TriangularSouth: never executed: case QTabBar::TriangularSouth: | 0 | ||||||||||||||||||||||||||||||
| 5777 | r.setRect(tab->rect.left(), tab->rect.top(), subRule.size().width(), opt->rect.height()); | - | ||||||||||||||||||||||||||||||
| 5778 | break; never executed: break; | 0 | ||||||||||||||||||||||||||||||
| 5779 | case QTabBar::RoundedWest: never executed: case QTabBar::RoundedWest: | 0 | ||||||||||||||||||||||||||||||
| 5780 | case QTabBar::TriangularWest: never executed: case QTabBar::TriangularWest: | 0 | ||||||||||||||||||||||||||||||
| 5781 | case QTabBar::RoundedEast: never executed: case QTabBar::RoundedEast: | 0 | ||||||||||||||||||||||||||||||
| 5782 | case QTabBar::TriangularEast: never executed: case QTabBar::TriangularEast: | 0 | ||||||||||||||||||||||||||||||
| 5783 | r.setRect(tab->rect.left(), tab->rect.top(), opt->rect.width(), subRule.size().height()); | - | ||||||||||||||||||||||||||||||
| 5784 | break; never executed: break; | 0 | ||||||||||||||||||||||||||||||
| 5785 | default: never executed: default: | 0 | ||||||||||||||||||||||||||||||
| 5786 | break; never executed: break; | 0 | ||||||||||||||||||||||||||||||
| 5787 | } | - | ||||||||||||||||||||||||||||||
| 5788 | r = visualRect(opt->direction, opt->rect, r); | - | ||||||||||||||||||||||||||||||
| 5789 | } never executed: end of block | 0 | ||||||||||||||||||||||||||||||
| 5790 | return r; never executed: return r; | 0 | ||||||||||||||||||||||||||||||
| 5791 | } | - | ||||||||||||||||||||||||||||||
| 5792 | break; never executed: break; | 0 | ||||||||||||||||||||||||||||||
| 5793 | } | - | ||||||||||||||||||||||||||||||
| 5794 | case SE_TabBarTabText: never executed: case SE_TabBarTabText: | 0 | ||||||||||||||||||||||||||||||
| 5795 | case SE_TabBarTabLeftButton: never executed: case SE_TabBarTabLeftButton: | 0 | ||||||||||||||||||||||||||||||
| 5796 | case SE_TabBarTabRightButton: { never executed: case SE_TabBarTabRightButton: | 0 | ||||||||||||||||||||||||||||||
| 5797 | QRenderRule subRule = renderRule(w, opt, PseudoElement_TabBarTab); | - | ||||||||||||||||||||||||||||||
| 5798 | if (subRule.hasBox() || !subRule.hasNativeBorder()) {
| 0 | ||||||||||||||||||||||||||||||
| 5799 | return ParentStyle::subElementRect(se, opt, w); never executed: return ParentStyle::subElementRect(se, opt, w); | 0 | ||||||||||||||||||||||||||||||
| 5800 | } | - | ||||||||||||||||||||||||||||||
| 5801 | break; never executed: break; | 0 | ||||||||||||||||||||||||||||||
| 5802 | } | - | ||||||||||||||||||||||||||||||
| 5803 | #endif // QT_NO_TABBAR | - | ||||||||||||||||||||||||||||||
| 5804 | - | |||||||||||||||||||||||||||||||
| 5805 | case SE_DockWidgetCloseButton: never executed: case SE_DockWidgetCloseButton: | 0 | ||||||||||||||||||||||||||||||
| 5806 | case SE_DockWidgetFloatButton: { never executed: case SE_DockWidgetFloatButton: | 0 | ||||||||||||||||||||||||||||||
| 5807 | PseudoElement pe = (se == SE_DockWidgetCloseButton) ? PseudoElement_DockWidgetCloseButton : PseudoElement_DockWidgetFloatButton;
| 0 | ||||||||||||||||||||||||||||||
| 5808 | QRenderRule subRule2 = renderRule(w, opt, pe); | - | ||||||||||||||||||||||||||||||
| 5809 | if (!subRule2.hasPosition())
| 0 | ||||||||||||||||||||||||||||||
| 5810 | break; never executed: break; | 0 | ||||||||||||||||||||||||||||||
| 5811 | QRenderRule subRule = renderRule(w, opt, PseudoElement_DockWidgetTitle); | - | ||||||||||||||||||||||||||||||
| 5812 | return positionRect(w, subRule, subRule2, pe, opt->rect, opt->direction); never executed: return positionRect(w, subRule, subRule2, pe, opt->rect, opt->direction); | 0 | ||||||||||||||||||||||||||||||
| 5813 | } | - | ||||||||||||||||||||||||||||||
| 5814 | - | |||||||||||||||||||||||||||||||
| 5815 | #ifndef QT_NO_TOOLBAR | - | ||||||||||||||||||||||||||||||
| 5816 | case SE_ToolBarHandle: never executed: case SE_ToolBarHandle: | 0 | ||||||||||||||||||||||||||||||
| 5817 | if (hasStyleRule(w, PseudoElement_ToolBarHandle))
| 0 | ||||||||||||||||||||||||||||||
| 5818 | return ParentStyle::subElementRect(se, opt, w); never executed: return ParentStyle::subElementRect(se, opt, w); | 0 | ||||||||||||||||||||||||||||||
| 5819 | break; never executed: break; | 0 | ||||||||||||||||||||||||||||||
| 5820 | #endif //QT_NO_TOOLBAR | - | ||||||||||||||||||||||||||||||
| 5821 | - | |||||||||||||||||||||||||||||||
| 5822 | // On mac we make pixel adjustments to layouts which are not | - | ||||||||||||||||||||||||||||||
| 5823 | // desireable when you have custom style sheets on them | - | ||||||||||||||||||||||||||||||
| 5824 | case SE_CheckBoxLayoutItem: never executed: case SE_CheckBoxLayoutItem: | 0 | ||||||||||||||||||||||||||||||
| 5825 | case SE_ComboBoxLayoutItem: never executed: case SE_ComboBoxLayoutItem: | 0 | ||||||||||||||||||||||||||||||
| 5826 | case SE_DateTimeEditLayoutItem: never executed: case SE_DateTimeEditLayoutItem: | 0 | ||||||||||||||||||||||||||||||
| 5827 | case SE_LabelLayoutItem: never executed: case SE_LabelLayoutItem: | 0 | ||||||||||||||||||||||||||||||
| 5828 | case SE_ProgressBarLayoutItem: never executed: case SE_ProgressBarLayoutItem: | 0 | ||||||||||||||||||||||||||||||
| 5829 | case SE_PushButtonLayoutItem: never executed: case SE_PushButtonLayoutItem: | 0 | ||||||||||||||||||||||||||||||
| 5830 | case SE_RadioButtonLayoutItem: never executed: case SE_RadioButtonLayoutItem: | 0 | ||||||||||||||||||||||||||||||
| 5831 | case SE_SliderLayoutItem: never executed: case SE_SliderLayoutItem: | 0 | ||||||||||||||||||||||||||||||
| 5832 | case SE_SpinBoxLayoutItem: never executed: case SE_SpinBoxLayoutItem: | 0 | ||||||||||||||||||||||||||||||
| 5833 | case SE_ToolButtonLayoutItem: never executed: case SE_ToolButtonLayoutItem: | 0 | ||||||||||||||||||||||||||||||
| 5834 | case SE_FrameLayoutItem: never executed: case SE_FrameLayoutItem: | 0 | ||||||||||||||||||||||||||||||
| 5835 | case SE_GroupBoxLayoutItem: never executed: case SE_GroupBoxLayoutItem: | 0 | ||||||||||||||||||||||||||||||
| 5836 | case SE_TabWidgetLayoutItem: never executed: case SE_TabWidgetLayoutItem: | 0 | ||||||||||||||||||||||||||||||
| 5837 | if (!rule.hasNativeBorder())
| 0 | ||||||||||||||||||||||||||||||
| 5838 | return opt->rect; never executed: return opt->rect; | 0 | ||||||||||||||||||||||||||||||
| 5839 | break; never executed: break; | 0 | ||||||||||||||||||||||||||||||
| 5840 | - | |||||||||||||||||||||||||||||||
| 5841 | default: never executed: default: | 0 | ||||||||||||||||||||||||||||||
| 5842 | break; never executed: break; | 0 | ||||||||||||||||||||||||||||||
| 5843 | } | - | ||||||||||||||||||||||||||||||
| 5844 | - | |||||||||||||||||||||||||||||||
| 5845 | return baseStyle()->subElementRect(se, opt, w); never executed: return baseStyle()->subElementRect(se, opt, w); | 0 | ||||||||||||||||||||||||||||||
| 5846 | } | - | ||||||||||||||||||||||||||||||
| 5847 | - | |||||||||||||||||||||||||||||||
| 5848 | bool QStyleSheetStyle::event(QEvent *e) | - | ||||||||||||||||||||||||||||||
| 5849 | { | - | ||||||||||||||||||||||||||||||
| 5850 | return (baseStyle()->event(e) && e->isAccepted()) || ParentStyle::event(e); never executed: return (baseStyle()->event(e) && e->isAccepted()) || ParentStyle::event(e);
| 0 | ||||||||||||||||||||||||||||||
| 5851 | } | - | ||||||||||||||||||||||||||||||
| 5852 | - | |||||||||||||||||||||||||||||||
| 5853 | void QStyleSheetStyle::updateStyleSheetFont(QWidget* w) const | - | ||||||||||||||||||||||||||||||
| 5854 | { | - | ||||||||||||||||||||||||||||||
| 5855 | // Qt's fontDialog relies on the font of the sample edit for its selection, | - | ||||||||||||||||||||||||||||||
| 5856 | // we should never override it. | - | ||||||||||||||||||||||||||||||
| 5857 | if (w->objectName() == QLatin1String("qt_fontDialog_sampleEdit"))
| 0 | ||||||||||||||||||||||||||||||
| 5858 | return; never executed: return; | 0 | ||||||||||||||||||||||||||||||
| 5859 | QWidget *container = containerWidget(w); | - | ||||||||||||||||||||||||||||||
| 5860 | QRenderRule rule = renderRule(container, PseudoElement_None, | - | ||||||||||||||||||||||||||||||
| 5861 | PseudoClass_Active | PseudoClass_Enabled | extendedPseudoClass(container)); | - | ||||||||||||||||||||||||||||||
| 5862 | QFont font = rule.font.resolve(w->font()); | - | ||||||||||||||||||||||||||||||
| 5863 | - | |||||||||||||||||||||||||||||||
| 5864 | if ((!w->isWindow() || w->testAttribute(Qt::WA_WindowPropagation))
| 0 | ||||||||||||||||||||||||||||||
| 5865 | && isNaturalChild(w) && qobject_cast<QWidget *>(w->parent())) {
| 0 | ||||||||||||||||||||||||||||||
| 5866 | - | |||||||||||||||||||||||||||||||
| 5867 | font = font.resolve(static_cast<QWidget *>(w->parent())->font()); | - | ||||||||||||||||||||||||||||||
| 5868 | } never executed: end of block | 0 | ||||||||||||||||||||||||||||||
| 5869 | - | |||||||||||||||||||||||||||||||
| 5870 | if (w->data->fnt == font)
| 0 | ||||||||||||||||||||||||||||||
| 5871 | return; never executed: return; | 0 | ||||||||||||||||||||||||||||||
| 5872 | - | |||||||||||||||||||||||||||||||
| 5873 | w->data->fnt = font; | - | ||||||||||||||||||||||||||||||
| 5874 | - | |||||||||||||||||||||||||||||||
| 5875 | QEvent e(QEvent::FontChange); | - | ||||||||||||||||||||||||||||||
| 5876 | QApplication::sendEvent(w, &e); | - | ||||||||||||||||||||||||||||||
| 5877 | } never executed: end of block | 0 | ||||||||||||||||||||||||||||||
| 5878 | - | |||||||||||||||||||||||||||||||
| 5879 | void QStyleSheetStyle::saveWidgetFont(QWidget* w, const QFont& font) const | - | ||||||||||||||||||||||||||||||
| 5880 | { | - | ||||||||||||||||||||||||||||||
| 5881 | w->setProperty("_q_styleSheetWidgetFont", font); | - | ||||||||||||||||||||||||||||||
| 5882 | } never executed: end of block | 0 | ||||||||||||||||||||||||||||||
| 5883 | - | |||||||||||||||||||||||||||||||
| 5884 | void QStyleSheetStyle::clearWidgetFont(QWidget* w) const | - | ||||||||||||||||||||||||||||||
| 5885 | { | - | ||||||||||||||||||||||||||||||
| 5886 | w->setProperty("_q_styleSheetWidgetFont", QVariant(QVariant::Invalid)); | - | ||||||||||||||||||||||||||||||
| 5887 | } never executed: end of block | 0 | ||||||||||||||||||||||||||||||
| 5888 | - | |||||||||||||||||||||||||||||||
| 5889 | // Polish palette that should be used for a particular widget, with particular states | - | ||||||||||||||||||||||||||||||
| 5890 | // (eg. :focus, :hover, ...) | - | ||||||||||||||||||||||||||||||
| 5891 | // this is called by widgets that paint themself in their paint event | - | ||||||||||||||||||||||||||||||
| 5892 | // Returns \c true if there is a new palette in pal. | - | ||||||||||||||||||||||||||||||
| 5893 | bool QStyleSheetStyle::styleSheetPalette(const QWidget* w, const QStyleOption* opt, QPalette* pal) | - | ||||||||||||||||||||||||||||||
| 5894 | { | - | ||||||||||||||||||||||||||||||
| 5895 | if (!w || !opt || !pal)
| 0 | ||||||||||||||||||||||||||||||
| 5896 | return false; never executed: return false; | 0 | ||||||||||||||||||||||||||||||
| 5897 | - | |||||||||||||||||||||||||||||||
| 5898 | RECURSION_GUARD(return false) never executed: return false;
| 0 | ||||||||||||||||||||||||||||||
| 5899 | - | |||||||||||||||||||||||||||||||
| 5900 | w = containerWidget(w); | - | ||||||||||||||||||||||||||||||
| 5901 | - | |||||||||||||||||||||||||||||||
| 5902 | QRenderRule rule = renderRule(w, PseudoElement_None, pseudoClass(opt->state) | extendedPseudoClass(w)); | - | ||||||||||||||||||||||||||||||
| 5903 | if (!rule.hasPalette())
| 0 | ||||||||||||||||||||||||||||||
| 5904 | return false; never executed: return false; | 0 | ||||||||||||||||||||||||||||||
| 5905 | - | |||||||||||||||||||||||||||||||
| 5906 | rule.configurePalette(pal, QPalette::NoRole, QPalette::NoRole); | - | ||||||||||||||||||||||||||||||
| 5907 | return true; never executed: return true; | 0 | ||||||||||||||||||||||||||||||
| 5908 | } | - | ||||||||||||||||||||||||||||||
| 5909 | - | |||||||||||||||||||||||||||||||
| 5910 | Qt::Alignment QStyleSheetStyle::resolveAlignment(Qt::LayoutDirection layDir, Qt::Alignment src) | - | ||||||||||||||||||||||||||||||
| 5911 | { | - | ||||||||||||||||||||||||||||||
| 5912 | if (layDir == Qt::LeftToRight || src & Qt::AlignAbsolute)
| 0 | ||||||||||||||||||||||||||||||
| 5913 | return src; never executed: return src; | 0 | ||||||||||||||||||||||||||||||
| 5914 | - | |||||||||||||||||||||||||||||||
| 5915 | if (src & Qt::AlignLeft) {
| 0 | ||||||||||||||||||||||||||||||
| 5916 | src &= ~Qt::AlignLeft; | - | ||||||||||||||||||||||||||||||
| 5917 | src |= Qt::AlignRight; | - | ||||||||||||||||||||||||||||||
| 5918 | } else if (src & Qt::AlignRight) { never executed: end of block
| 0 | ||||||||||||||||||||||||||||||
| 5919 | src &= ~Qt::AlignRight; | - | ||||||||||||||||||||||||||||||
| 5920 | src |= Qt::AlignLeft; | - | ||||||||||||||||||||||||||||||
| 5921 | } never executed: end of block | 0 | ||||||||||||||||||||||||||||||
| 5922 | src |= Qt::AlignAbsolute; | - | ||||||||||||||||||||||||||||||
| 5923 | return src; never executed: return src; | 0 | ||||||||||||||||||||||||||||||
| 5924 | } | - | ||||||||||||||||||||||||||||||
| 5925 | - | |||||||||||||||||||||||||||||||
| 5926 | // Returns whether the given QWidget has a "natural" parent, meaning that | - | ||||||||||||||||||||||||||||||
| 5927 | // the parent contains this child as part of its normal operation. | - | ||||||||||||||||||||||||||||||
| 5928 | // An example is the QTabBar inside a QTabWidget. | - | ||||||||||||||||||||||||||||||
| 5929 | // This does not mean that any QTabBar which is a child of QTabWidget will | - | ||||||||||||||||||||||||||||||
| 5930 | // match, only the one that was created by the QTabWidget initialization | - | ||||||||||||||||||||||||||||||
| 5931 | // (and hence has the correct object name). | - | ||||||||||||||||||||||||||||||
| 5932 | bool QStyleSheetStyle::isNaturalChild(const QObject *obj) | - | ||||||||||||||||||||||||||||||
| 5933 | { | - | ||||||||||||||||||||||||||||||
| 5934 | if (obj->objectName().startsWith(QLatin1String("qt_")))
| 0 | ||||||||||||||||||||||||||||||
| 5935 | return true; never executed: return true; | 0 | ||||||||||||||||||||||||||||||
| 5936 | - | |||||||||||||||||||||||||||||||
| 5937 | return false; never executed: return false; | 0 | ||||||||||||||||||||||||||||||
| 5938 | } | - | ||||||||||||||||||||||||||||||
| 5939 | - | |||||||||||||||||||||||||||||||
| 5940 | QT_END_NAMESPACE | - | ||||||||||||||||||||||||||||||
| 5941 | - | |||||||||||||||||||||||||||||||
| 5942 | #include "moc_qstylesheetstyle_p.cpp" | - | ||||||||||||||||||||||||||||||
| 5943 | - | |||||||||||||||||||||||||||||||
| 5944 | #endif // QT_NO_STYLE_STYLESHEET | - | ||||||||||||||||||||||||||||||
| Source code | Switch to Preprocessed file |