| Absolute File Name: | /home/qt/qt5_coco/qt5/qtbase/src/widgets/styles/qcommonstyle.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 "qcommonstyle.h" | - | ||||||||||||||||||||||||
| 35 | #include "qcommonstyle_p.h" | - | ||||||||||||||||||||||||
| 36 | - | |||||||||||||||||||||||||
| 37 | #include <qfile.h> | - | ||||||||||||||||||||||||
| 38 | #include <qapplication.h> | - | ||||||||||||||||||||||||
| 39 | #include <private/qguiapplication_p.h> | - | ||||||||||||||||||||||||
| 40 | #include <qpa/qplatformtheme.h> | - | ||||||||||||||||||||||||
| 41 | #include <qbitmap.h> | - | ||||||||||||||||||||||||
| 42 | #include <qcache.h> | - | ||||||||||||||||||||||||
| 43 | #include <qdockwidget.h> | - | ||||||||||||||||||||||||
| 44 | #include <qdrawutil.h> | - | ||||||||||||||||||||||||
| 45 | #include <qdialogbuttonbox.h> | - | ||||||||||||||||||||||||
| 46 | #include <qformlayout.h> | - | ||||||||||||||||||||||||
| 47 | #include <qgroupbox.h> | - | ||||||||||||||||||||||||
| 48 | #include <qmath.h> | - | ||||||||||||||||||||||||
| 49 | #include <qmenu.h> | - | ||||||||||||||||||||||||
| 50 | #include <qpainter.h> | - | ||||||||||||||||||||||||
| 51 | #include <qpaintengine.h> | - | ||||||||||||||||||||||||
| 52 | #include <qpainterpath.h> | - | ||||||||||||||||||||||||
| 53 | #include <qslider.h> | - | ||||||||||||||||||||||||
| 54 | #include <qstyleoption.h> | - | ||||||||||||||||||||||||
| 55 | #include <qtabbar.h> | - | ||||||||||||||||||||||||
| 56 | #include <qtabwidget.h> | - | ||||||||||||||||||||||||
| 57 | #include <qtoolbar.h> | - | ||||||||||||||||||||||||
| 58 | #include <qtoolbutton.h> | - | ||||||||||||||||||||||||
| 59 | #include <qrubberband.h> | - | ||||||||||||||||||||||||
| 60 | #include "qtreeview.h" | - | ||||||||||||||||||||||||
| 61 | #include <private/qcommonstylepixmaps_p.h> | - | ||||||||||||||||||||||||
| 62 | #include <private/qmath_p.h> | - | ||||||||||||||||||||||||
| 63 | #include <qdebug.h> | - | ||||||||||||||||||||||||
| 64 | #include <qtextformat.h> | - | ||||||||||||||||||||||||
| 65 | #include <qwizard.h> | - | ||||||||||||||||||||||||
| 66 | #include <qfileinfo.h> | - | ||||||||||||||||||||||||
| 67 | #include <qdir.h> | - | ||||||||||||||||||||||||
| 68 | #include <qsettings.h> | - | ||||||||||||||||||||||||
| 69 | #include <qvariant.h> | - | ||||||||||||||||||||||||
| 70 | #include <qpixmapcache.h> | - | ||||||||||||||||||||||||
| 71 | #include <private/qstyleanimation_p.h> | - | ||||||||||||||||||||||||
| 72 | - | |||||||||||||||||||||||||
| 73 | #include <limits.h> | - | ||||||||||||||||||||||||
| 74 | - | |||||||||||||||||||||||||
| 75 | #ifndef QT_NO_ITEMVIEWS | - | ||||||||||||||||||||||||
| 76 | # include "private/qtextengine_p.h" | - | ||||||||||||||||||||||||
| 77 | #endif | - | ||||||||||||||||||||||||
| 78 | - | |||||||||||||||||||||||||
| 79 | #include <private/qstylehelper_p.h> | - | ||||||||||||||||||||||||
| 80 | - | |||||||||||||||||||||||||
| 81 | QT_BEGIN_NAMESPACE | - | ||||||||||||||||||||||||
| 82 | - | |||||||||||||||||||||||||
| 83 | static QWindow *qt_getWindow(const QWidget *widget) | - | ||||||||||||||||||||||||
| 84 | { | - | ||||||||||||||||||||||||
| 85 | return widget ? widget->window()->windowHandle() : 0; never executed: return widget ? widget->window()->windowHandle() : 0;
| 0 | ||||||||||||||||||||||||
| 86 | } | - | ||||||||||||||||||||||||
| 87 | - | |||||||||||||||||||||||||
| 88 | /*! | - | ||||||||||||||||||||||||
| 89 | \class QCommonStyle | - | ||||||||||||||||||||||||
| 90 | \brief The QCommonStyle class encapsulates the common Look and Feel of a GUI. | - | ||||||||||||||||||||||||
| 91 | - | |||||||||||||||||||||||||
| 92 | \ingroup appearance | - | ||||||||||||||||||||||||
| 93 | \inmodule QtWidgets | - | ||||||||||||||||||||||||
| 94 | - | |||||||||||||||||||||||||
| 95 | This abstract class implements some of the widget's look and feel | - | ||||||||||||||||||||||||
| 96 | that is common to all GUI styles provided and shipped as part of | - | ||||||||||||||||||||||||
| 97 | Qt. | - | ||||||||||||||||||||||||
| 98 | - | |||||||||||||||||||||||||
| 99 | Since QCommonStyle inherits QStyle, all of its functions are fully documented | - | ||||||||||||||||||||||||
| 100 | in the QStyle documentation. | - | ||||||||||||||||||||||||
| 101 | \omit | - | ||||||||||||||||||||||||
| 102 | , although the | - | ||||||||||||||||||||||||
| 103 | extra functions that QCommonStyle provides, e.g. | - | ||||||||||||||||||||||||
| 104 | drawComplexControl(), drawControl(), drawPrimitive(), | - | ||||||||||||||||||||||||
| 105 | hitTestComplexControl(), subControlRect(), sizeFromContents(), and | - | ||||||||||||||||||||||||
| 106 | subElementRect() are documented here. | - | ||||||||||||||||||||||||
| 107 | \endomit | - | ||||||||||||||||||||||||
| 108 | - | |||||||||||||||||||||||||
| 109 | \sa QStyle, QProxyStyle | - | ||||||||||||||||||||||||
| 110 | */ | - | ||||||||||||||||||||||||
| 111 | - | |||||||||||||||||||||||||
| 112 | /*! | - | ||||||||||||||||||||||||
| 113 | Constructs a QCommonStyle. | - | ||||||||||||||||||||||||
| 114 | */ | - | ||||||||||||||||||||||||
| 115 | QCommonStyle::QCommonStyle() | - | ||||||||||||||||||||||||
| 116 | : QStyle(*new QCommonStylePrivate) | - | ||||||||||||||||||||||||
| 117 | { never executed: }end of blocknever executed: end of block | 0 | ||||||||||||||||||||||||
| 118 | - | |||||||||||||||||||||||||
| 119 | /*! \internal | - | ||||||||||||||||||||||||
| 120 | */ | - | ||||||||||||||||||||||||
| 121 | QCommonStyle::QCommonStyle(QCommonStylePrivate &dd) | - | ||||||||||||||||||||||||
| 122 | : QStyle(dd) | - | ||||||||||||||||||||||||
| 123 | { never executed: }end of blocknever executed: end of block | 0 | ||||||||||||||||||||||||
| 124 | - | |||||||||||||||||||||||||
| 125 | /*! | - | ||||||||||||||||||||||||
| 126 | Destroys the style. | - | ||||||||||||||||||||||||
| 127 | */ | - | ||||||||||||||||||||||||
| 128 | QCommonStyle::~QCommonStyle() | - | ||||||||||||||||||||||||
| 129 | { } | - | ||||||||||||||||||||||||
| 130 | - | |||||||||||||||||||||||||
| 131 | - | |||||||||||||||||||||||||
| 132 | /*! | - | ||||||||||||||||||||||||
| 133 | \reimp | - | ||||||||||||||||||||||||
| 134 | */ | - | ||||||||||||||||||||||||
| 135 | void QCommonStyle::drawPrimitive(PrimitiveElement pe, const QStyleOption *opt, QPainter *p, | - | ||||||||||||||||||||||||
| 136 | const QWidget *widget) const | - | ||||||||||||||||||||||||
| 137 | { | - | ||||||||||||||||||||||||
| 138 | Q_D(const QCommonStyle); | - | ||||||||||||||||||||||||
| 139 | switch (pe) { | - | ||||||||||||||||||||||||
| 140 | case PE_FrameButtonBevel: never executed: case PE_FrameButtonBevel: | 0 | ||||||||||||||||||||||||
| 141 | case PE_FrameButtonTool: never executed: case PE_FrameButtonTool: | 0 | ||||||||||||||||||||||||
| 142 | qDrawShadeRect(p, opt->rect, opt->palette, | - | ||||||||||||||||||||||||
| 143 | opt->state & (State_Sunken | State_On), 1, 0); | - | ||||||||||||||||||||||||
| 144 | break; never executed: break; | 0 | ||||||||||||||||||||||||
| 145 | case PE_PanelButtonCommand: never executed: case PE_PanelButtonCommand: | 0 | ||||||||||||||||||||||||
| 146 | case PE_PanelButtonBevel: never executed: case PE_PanelButtonBevel: | 0 | ||||||||||||||||||||||||
| 147 | case PE_PanelButtonTool: never executed: case PE_PanelButtonTool: | 0 | ||||||||||||||||||||||||
| 148 | case PE_IndicatorButtonDropDown: never executed: case PE_IndicatorButtonDropDown: | 0 | ||||||||||||||||||||||||
| 149 | qDrawShadePanel(p, opt->rect, opt->palette, | - | ||||||||||||||||||||||||
| 150 | opt->state & (State_Sunken | State_On), 1, | - | ||||||||||||||||||||||||
| 151 | &opt->palette.brush(QPalette::Button)); | - | ||||||||||||||||||||||||
| 152 | break; never executed: break; | 0 | ||||||||||||||||||||||||
| 153 | case PE_IndicatorViewItemCheck: never executed: case PE_IndicatorViewItemCheck: | 0 | ||||||||||||||||||||||||
| 154 | proxy()->drawPrimitive(PE_IndicatorCheckBox, opt, p, widget); | - | ||||||||||||||||||||||||
| 155 | break; never executed: break; | 0 | ||||||||||||||||||||||||
| 156 | case PE_IndicatorCheckBox: never executed: case PE_IndicatorCheckBox: | 0 | ||||||||||||||||||||||||
| 157 | if (opt->state & State_NoChange) {
| 0 | ||||||||||||||||||||||||
| 158 | p->setPen(opt->palette.foreground().color()); | - | ||||||||||||||||||||||||
| 159 | p->fillRect(opt->rect, opt->palette.brush(QPalette::Button)); | - | ||||||||||||||||||||||||
| 160 | p->drawRect(opt->rect); | - | ||||||||||||||||||||||||
| 161 | p->drawLine(opt->rect.topLeft(), opt->rect.bottomRight()); | - | ||||||||||||||||||||||||
| 162 | } else { never executed: end of block | 0 | ||||||||||||||||||||||||
| 163 | qDrawShadePanel(p, opt->rect.x(), opt->rect.y(), opt->rect.width(), opt->rect.height(), | - | ||||||||||||||||||||||||
| 164 | opt->palette, opt->state & (State_Sunken | State_On), 1, | - | ||||||||||||||||||||||||
| 165 | &opt->palette.brush(QPalette::Button)); | - | ||||||||||||||||||||||||
| 166 | } never executed: end of block | 0 | ||||||||||||||||||||||||
| 167 | break; never executed: break; | 0 | ||||||||||||||||||||||||
| 168 | case PE_IndicatorRadioButton: { never executed: case PE_IndicatorRadioButton: | 0 | ||||||||||||||||||||||||
| 169 | QRect ir = opt->rect; | - | ||||||||||||||||||||||||
| 170 | p->setPen(opt->palette.dark().color()); | - | ||||||||||||||||||||||||
| 171 | p->drawArc(opt->rect, 0, 5760); | - | ||||||||||||||||||||||||
| 172 | if (opt->state & (State_Sunken | State_On)) {
| 0 | ||||||||||||||||||||||||
| 173 | ir.adjust(2, 2, -2, -2); | - | ||||||||||||||||||||||||
| 174 | p->setBrush(opt->palette.foreground()); | - | ||||||||||||||||||||||||
| 175 | bool oldQt4CompatiblePainting = p->testRenderHint(QPainter::Qt4CompatiblePainting); | - | ||||||||||||||||||||||||
| 176 | p->setRenderHint(QPainter::Qt4CompatiblePainting); | - | ||||||||||||||||||||||||
| 177 | p->drawEllipse(ir); | - | ||||||||||||||||||||||||
| 178 | p->setRenderHint(QPainter::Qt4CompatiblePainting, oldQt4CompatiblePainting); | - | ||||||||||||||||||||||||
| 179 | } never executed: end of block | 0 | ||||||||||||||||||||||||
| 180 | break; } never executed: break; | 0 | ||||||||||||||||||||||||
| 181 | case PE_FrameFocusRect: never executed: case PE_FrameFocusRect: | 0 | ||||||||||||||||||||||||
| 182 | if (const QStyleOptionFocusRect *fropt = qstyleoption_cast<const QStyleOptionFocusRect *>(opt)) {
| 0 | ||||||||||||||||||||||||
| 183 | QColor bg = fropt->backgroundColor; | - | ||||||||||||||||||||||||
| 184 | QPen oldPen = p->pen(); | - | ||||||||||||||||||||||||
| 185 | if (bg.isValid()) {
| 0 | ||||||||||||||||||||||||
| 186 | int h, s, v; | - | ||||||||||||||||||||||||
| 187 | bg.getHsv(&h, &s, &v); | - | ||||||||||||||||||||||||
| 188 | if (v >= 128)
| 0 | ||||||||||||||||||||||||
| 189 | p->setPen(Qt::black); never executed: p->setPen(Qt::black); | 0 | ||||||||||||||||||||||||
| 190 | else | - | ||||||||||||||||||||||||
| 191 | p->setPen(Qt::white); never executed: p->setPen(Qt::white); | 0 | ||||||||||||||||||||||||
| 192 | } else { | - | ||||||||||||||||||||||||
| 193 | p->setPen(opt->palette.foreground().color()); | - | ||||||||||||||||||||||||
| 194 | } never executed: end of block | 0 | ||||||||||||||||||||||||
| 195 | QRect focusRect = opt->rect.adjusted(1, 1, -1, -1); | - | ||||||||||||||||||||||||
| 196 | p->drawRect(focusRect.adjusted(0, 0, -1, -1)); //draw pen inclusive | - | ||||||||||||||||||||||||
| 197 | p->setPen(oldPen); | - | ||||||||||||||||||||||||
| 198 | } never executed: end of block | 0 | ||||||||||||||||||||||||
| 199 | break; never executed: break; | 0 | ||||||||||||||||||||||||
| 200 | case PE_IndicatorMenuCheckMark: { never executed: case PE_IndicatorMenuCheckMark: | 0 | ||||||||||||||||||||||||
| 201 | const int markW = opt->rect.width() > 7 ? 7 : opt->rect.width();
| 0 | ||||||||||||||||||||||||
| 202 | const int markH = markW; | - | ||||||||||||||||||||||||
| 203 | int posX = opt->rect.x() + (opt->rect.width() - markW)/2 + 1; | - | ||||||||||||||||||||||||
| 204 | int posY = opt->rect.y() + (opt->rect.height() - markH)/2; | - | ||||||||||||||||||||||||
| 205 | - | |||||||||||||||||||||||||
| 206 | QVector<QLineF> a; | - | ||||||||||||||||||||||||
| 207 | a.reserve(markH); | - | ||||||||||||||||||||||||
| 208 | - | |||||||||||||||||||||||||
| 209 | int i, xx, yy; | - | ||||||||||||||||||||||||
| 210 | xx = posX; | - | ||||||||||||||||||||||||
| 211 | yy = 3 + posY; | - | ||||||||||||||||||||||||
| 212 | for (i = 0; i < markW/2; ++i) {
| 0 | ||||||||||||||||||||||||
| 213 | a << QLineF(xx, yy, xx, yy + 2); | - | ||||||||||||||||||||||||
| 214 | ++xx; | - | ||||||||||||||||||||||||
| 215 | ++yy; | - | ||||||||||||||||||||||||
| 216 | } never executed: end of block | 0 | ||||||||||||||||||||||||
| 217 | yy -= 2; | - | ||||||||||||||||||||||||
| 218 | for (; i < markH; ++i) {
| 0 | ||||||||||||||||||||||||
| 219 | a << QLineF(xx, yy, xx, yy + 2); | - | ||||||||||||||||||||||||
| 220 | ++xx; | - | ||||||||||||||||||||||||
| 221 | --yy; | - | ||||||||||||||||||||||||
| 222 | } never executed: end of block | 0 | ||||||||||||||||||||||||
| 223 | if (!(opt->state & State_Enabled) && !(opt->state & State_On)) {
| 0 | ||||||||||||||||||||||||
| 224 | p->save(); | - | ||||||||||||||||||||||||
| 225 | p->translate(1, 1); | - | ||||||||||||||||||||||||
| 226 | p->setPen(opt->palette.light().color()); | - | ||||||||||||||||||||||||
| 227 | p->drawLines(a); | - | ||||||||||||||||||||||||
| 228 | p->restore(); | - | ||||||||||||||||||||||||
| 229 | } never executed: end of block | 0 | ||||||||||||||||||||||||
| 230 | p->setPen((opt->state & State_On) ? opt->palette.highlightedText().color() : opt->palette.text().color()); | - | ||||||||||||||||||||||||
| 231 | p->drawLines(a); | - | ||||||||||||||||||||||||
| 232 | break; } never executed: break; | 0 | ||||||||||||||||||||||||
| 233 | case PE_Frame: never executed: case PE_Frame: | 0 | ||||||||||||||||||||||||
| 234 | case PE_FrameMenu: never executed: case PE_FrameMenu: | 0 | ||||||||||||||||||||||||
| 235 | if (const QStyleOptionFrame *frame = qstyleoption_cast<const QStyleOptionFrame *>(opt)) {
| 0 | ||||||||||||||||||||||||
| 236 | if (pe == PE_FrameMenu || (frame->state & State_Sunken) || (frame->state & State_Raised)) {
| 0 | ||||||||||||||||||||||||
| 237 | qDrawShadePanel(p, frame->rect, frame->palette, frame->state & State_Sunken, | - | ||||||||||||||||||||||||
| 238 | frame->lineWidth); | - | ||||||||||||||||||||||||
| 239 | } else { never executed: end of block | 0 | ||||||||||||||||||||||||
| 240 | qDrawPlainRect(p, frame->rect, frame->palette.foreground().color(), frame->lineWidth); | - | ||||||||||||||||||||||||
| 241 | } never executed: end of block | 0 | ||||||||||||||||||||||||
| 242 | } | - | ||||||||||||||||||||||||
| 243 | break; never executed: break; | 0 | ||||||||||||||||||||||||
| 244 | #ifndef QT_NO_TOOLBAR | - | ||||||||||||||||||||||||
| 245 | case PE_PanelMenuBar: never executed: case PE_PanelMenuBar: | 0 | ||||||||||||||||||||||||
| 246 | if (widget && qobject_cast<QToolBar *>(widget->parentWidget()))
| 0 | ||||||||||||||||||||||||
| 247 | break; never executed: break; | 0 | ||||||||||||||||||||||||
| 248 | if (const QStyleOptionFrame *frame = qstyleoption_cast<const QStyleOptionFrame *>(opt)){
| 0 | ||||||||||||||||||||||||
| 249 | qDrawShadePanel(p, frame->rect, frame->palette, false, frame->lineWidth, | - | ||||||||||||||||||||||||
| 250 | &frame->palette.brush(QPalette::Button)); | - | ||||||||||||||||||||||||
| 251 | - | |||||||||||||||||||||||||
| 252 | } never executed: end of block | 0 | ||||||||||||||||||||||||
| 253 | else if (const QStyleOptionToolBar *frame = qstyleoption_cast<const QStyleOptionToolBar *>(opt)){
| 0 | ||||||||||||||||||||||||
| 254 | qDrawShadePanel(p, frame->rect, frame->palette, false, frame->lineWidth, | - | ||||||||||||||||||||||||
| 255 | &frame->palette.brush(QPalette::Button)); | - | ||||||||||||||||||||||||
| 256 | } never executed: end of block | 0 | ||||||||||||||||||||||||
| 257 | - | |||||||||||||||||||||||||
| 258 | break; never executed: break; | 0 | ||||||||||||||||||||||||
| 259 | case PE_PanelMenu: never executed: case PE_PanelMenu: | 0 | ||||||||||||||||||||||||
| 260 | break; never executed: break; | 0 | ||||||||||||||||||||||||
| 261 | case PE_PanelToolBar: never executed: case PE_PanelToolBar: | 0 | ||||||||||||||||||||||||
| 262 | break; never executed: break; | 0 | ||||||||||||||||||||||||
| 263 | #endif // QT_NO_TOOLBAR | - | ||||||||||||||||||||||||
| 264 | #ifndef QT_NO_PROGRESSBAR | - | ||||||||||||||||||||||||
| 265 | case PE_IndicatorProgressChunk: never executed: case PE_IndicatorProgressChunk: | 0 | ||||||||||||||||||||||||
| 266 | { | - | ||||||||||||||||||||||||
| 267 | bool vertical = false; | - | ||||||||||||||||||||||||
| 268 | if (const QStyleOptionProgressBar *pb = qstyleoption_cast<const QStyleOptionProgressBar *>(opt))
| 0 | ||||||||||||||||||||||||
| 269 | vertical = pb->orientation == Qt::Vertical; never executed: vertical = pb->orientation == Qt::Vertical; | 0 | ||||||||||||||||||||||||
| 270 | if (!vertical) {
| 0 | ||||||||||||||||||||||||
| 271 | p->fillRect(opt->rect.x(), opt->rect.y() + 3, opt->rect.width() -2, opt->rect.height() - 6, | - | ||||||||||||||||||||||||
| 272 | opt->palette.brush(QPalette::Highlight)); | - | ||||||||||||||||||||||||
| 273 | } else { never executed: end of block | 0 | ||||||||||||||||||||||||
| 274 | p->fillRect(opt->rect.x() + 2, opt->rect.y(), opt->rect.width() -6, opt->rect.height() - 2, | - | ||||||||||||||||||||||||
| 275 | opt->palette.brush(QPalette::Highlight)); | - | ||||||||||||||||||||||||
| 276 | } never executed: end of block | 0 | ||||||||||||||||||||||||
| 277 | } | - | ||||||||||||||||||||||||
| 278 | break; never executed: break; | 0 | ||||||||||||||||||||||||
| 279 | #endif // QT_NO_PROGRESSBAR | - | ||||||||||||||||||||||||
| 280 | case PE_IndicatorBranch: { never executed: case PE_IndicatorBranch: | 0 | ||||||||||||||||||||||||
| 281 | static const int decoration_size = 9; | - | ||||||||||||||||||||||||
| 282 | int mid_h = opt->rect.x() + opt->rect.width() / 2; | - | ||||||||||||||||||||||||
| 283 | int mid_v = opt->rect.y() + opt->rect.height() / 2; | - | ||||||||||||||||||||||||
| 284 | int bef_h = mid_h; | - | ||||||||||||||||||||||||
| 285 | int bef_v = mid_v; | - | ||||||||||||||||||||||||
| 286 | int aft_h = mid_h; | - | ||||||||||||||||||||||||
| 287 | int aft_v = mid_v; | - | ||||||||||||||||||||||||
| 288 | if (opt->state & State_Children) {
| 0 | ||||||||||||||||||||||||
| 289 | int delta = decoration_size / 2; | - | ||||||||||||||||||||||||
| 290 | bef_h -= delta; | - | ||||||||||||||||||||||||
| 291 | bef_v -= delta; | - | ||||||||||||||||||||||||
| 292 | aft_h += delta; | - | ||||||||||||||||||||||||
| 293 | aft_v += delta; | - | ||||||||||||||||||||||||
| 294 | p->drawLine(bef_h + 2, bef_v + 4, bef_h + 6, bef_v + 4); | - | ||||||||||||||||||||||||
| 295 | if (!(opt->state & State_Open))
| 0 | ||||||||||||||||||||||||
| 296 | p->drawLine(bef_h + 4, bef_v + 2, bef_h + 4, bef_v + 6); never executed: p->drawLine(bef_h + 4, bef_v + 2, bef_h + 4, bef_v + 6); | 0 | ||||||||||||||||||||||||
| 297 | QPen oldPen = p->pen(); | - | ||||||||||||||||||||||||
| 298 | p->setPen(opt->palette.dark().color()); | - | ||||||||||||||||||||||||
| 299 | p->drawRect(bef_h, bef_v, decoration_size - 1, decoration_size - 1); | - | ||||||||||||||||||||||||
| 300 | p->setPen(oldPen); | - | ||||||||||||||||||||||||
| 301 | } never executed: end of block | 0 | ||||||||||||||||||||||||
| 302 | QBrush brush(opt->palette.dark().color(), Qt::Dense4Pattern); | - | ||||||||||||||||||||||||
| 303 | if (opt->state & State_Item) {
| 0 | ||||||||||||||||||||||||
| 304 | if (opt->direction == Qt::RightToLeft)
| 0 | ||||||||||||||||||||||||
| 305 | p->fillRect(opt->rect.left(), mid_v, bef_h - opt->rect.left(), 1, brush); never executed: p->fillRect(opt->rect.left(), mid_v, bef_h - opt->rect.left(), 1, brush); | 0 | ||||||||||||||||||||||||
| 306 | else | - | ||||||||||||||||||||||||
| 307 | p->fillRect(aft_h, mid_v, opt->rect.right() - aft_h + 1, 1, brush); never executed: p->fillRect(aft_h, mid_v, opt->rect.right() - aft_h + 1, 1, brush); | 0 | ||||||||||||||||||||||||
| 308 | } | - | ||||||||||||||||||||||||
| 309 | if (opt->state & State_Sibling)
| 0 | ||||||||||||||||||||||||
| 310 | p->fillRect(mid_h, aft_v, 1, opt->rect.bottom() - aft_v + 1, brush); never executed: p->fillRect(mid_h, aft_v, 1, opt->rect.bottom() - aft_v + 1, brush); | 0 | ||||||||||||||||||||||||
| 311 | if (opt->state & (State_Open | State_Children | State_Item | State_Sibling))
| 0 | ||||||||||||||||||||||||
| 312 | p->fillRect(mid_h, opt->rect.y(), 1, bef_v - opt->rect.y(), brush); never executed: p->fillRect(mid_h, opt->rect.y(), 1, bef_v - opt->rect.y(), brush); | 0 | ||||||||||||||||||||||||
| 313 | break; } never executed: break; | 0 | ||||||||||||||||||||||||
| 314 | case PE_FrameStatusBarItem: never executed: case PE_FrameStatusBarItem: | 0 | ||||||||||||||||||||||||
| 315 | qDrawShadeRect(p, opt->rect, opt->palette, true, 1, 0, 0); | - | ||||||||||||||||||||||||
| 316 | break; never executed: break; | 0 | ||||||||||||||||||||||||
| 317 | case PE_IndicatorHeaderArrow: never executed: case PE_IndicatorHeaderArrow: | 0 | ||||||||||||||||||||||||
| 318 | if (const QStyleOptionHeader *header = qstyleoption_cast<const QStyleOptionHeader *>(opt)) {
| 0 | ||||||||||||||||||||||||
| 319 | QPen oldPen = p->pen(); | - | ||||||||||||||||||||||||
| 320 | if (header->sortIndicator & QStyleOptionHeader::SortUp) {
| 0 | ||||||||||||||||||||||||
| 321 | p->setPen(QPen(opt->palette.light(), 0)); | - | ||||||||||||||||||||||||
| 322 | p->drawLine(opt->rect.x() + opt->rect.width(), opt->rect.y(), | - | ||||||||||||||||||||||||
| 323 | opt->rect.x() + opt->rect.width() / 2, opt->rect.y() + opt->rect.height()); | - | ||||||||||||||||||||||||
| 324 | p->setPen(QPen(opt->palette.dark(), 0)); | - | ||||||||||||||||||||||||
| 325 | const QPoint points[] = { | - | ||||||||||||||||||||||||
| 326 | QPoint(opt->rect.x() + opt->rect.width() / 2, opt->rect.y() + opt->rect.height()), | - | ||||||||||||||||||||||||
| 327 | QPoint(opt->rect.x(), opt->rect.y()), | - | ||||||||||||||||||||||||
| 328 | QPoint(opt->rect.x() + opt->rect.width(), opt->rect.y()), | - | ||||||||||||||||||||||||
| 329 | }; | - | ||||||||||||||||||||||||
| 330 | p->drawPolyline(points, sizeof points / sizeof *points); | - | ||||||||||||||||||||||||
| 331 | } else if (header->sortIndicator & QStyleOptionHeader::SortDown) { never executed: end of block
| 0 | ||||||||||||||||||||||||
| 332 | p->setPen(QPen(opt->palette.light(), 0)); | - | ||||||||||||||||||||||||
| 333 | const QPoint points[] = { | - | ||||||||||||||||||||||||
| 334 | QPoint(opt->rect.x(), opt->rect.y() + opt->rect.height()), | - | ||||||||||||||||||||||||
| 335 | QPoint(opt->rect.x() + opt->rect.width(), opt->rect.y() + opt->rect.height()), | - | ||||||||||||||||||||||||
| 336 | QPoint(opt->rect.x() + opt->rect.width() / 2, opt->rect.y()), | - | ||||||||||||||||||||||||
| 337 | }; | - | ||||||||||||||||||||||||
| 338 | p->drawPolyline(points, sizeof points / sizeof *points); | - | ||||||||||||||||||||||||
| 339 | p->setPen(QPen(opt->palette.dark(), 0)); | - | ||||||||||||||||||||||||
| 340 | p->drawLine(opt->rect.x(), opt->rect.y() + opt->rect.height(), | - | ||||||||||||||||||||||||
| 341 | opt->rect.x() + opt->rect.width() / 2, opt->rect.y()); | - | ||||||||||||||||||||||||
| 342 | } never executed: end of block | 0 | ||||||||||||||||||||||||
| 343 | p->setPen(oldPen); | - | ||||||||||||||||||||||||
| 344 | } never executed: end of block | 0 | ||||||||||||||||||||||||
| 345 | break; never executed: break; | 0 | ||||||||||||||||||||||||
| 346 | #ifndef QT_NO_TABBAR | - | ||||||||||||||||||||||||
| 347 | case PE_FrameTabBarBase: never executed: case PE_FrameTabBarBase: | 0 | ||||||||||||||||||||||||
| 348 | if (const QStyleOptionTabBarBase *tbb
| 0 | ||||||||||||||||||||||||
| 349 | = qstyleoption_cast<const QStyleOptionTabBarBase *>(opt)) {
| 0 | ||||||||||||||||||||||||
| 350 | p->save(); | - | ||||||||||||||||||||||||
| 351 | switch (tbb->shape) { | - | ||||||||||||||||||||||||
| 352 | case QTabBar::RoundedNorth: never executed: case QTabBar::RoundedNorth: | 0 | ||||||||||||||||||||||||
| 353 | case QTabBar::TriangularNorth: never executed: case QTabBar::TriangularNorth: | 0 | ||||||||||||||||||||||||
| 354 | p->setPen(QPen(tbb->palette.light(), 0)); | - | ||||||||||||||||||||||||
| 355 | p->drawLine(tbb->rect.topLeft(), tbb->rect.topRight()); | - | ||||||||||||||||||||||||
| 356 | break; never executed: break; | 0 | ||||||||||||||||||||||||
| 357 | case QTabBar::RoundedWest: never executed: case QTabBar::RoundedWest: | 0 | ||||||||||||||||||||||||
| 358 | case QTabBar::TriangularWest: never executed: case QTabBar::TriangularWest: | 0 | ||||||||||||||||||||||||
| 359 | p->setPen(QPen(tbb->palette.light(), 0)); | - | ||||||||||||||||||||||||
| 360 | p->drawLine(tbb->rect.topLeft(), tbb->rect.bottomLeft()); | - | ||||||||||||||||||||||||
| 361 | break; never executed: break; | 0 | ||||||||||||||||||||||||
| 362 | case QTabBar::RoundedSouth: never executed: case QTabBar::RoundedSouth: | 0 | ||||||||||||||||||||||||
| 363 | case QTabBar::TriangularSouth: never executed: case QTabBar::TriangularSouth: | 0 | ||||||||||||||||||||||||
| 364 | p->setPen(QPen(tbb->palette.shadow(), 0)); | - | ||||||||||||||||||||||||
| 365 | p->drawLine(tbb->rect.left(), tbb->rect.bottom(), | - | ||||||||||||||||||||||||
| 366 | tbb->rect.right(), tbb->rect.bottom()); | - | ||||||||||||||||||||||||
| 367 | p->setPen(QPen(tbb->palette.dark(), 0)); | - | ||||||||||||||||||||||||
| 368 | p->drawLine(tbb->rect.left(), tbb->rect.bottom() - 1, | - | ||||||||||||||||||||||||
| 369 | tbb->rect.right() - 1, tbb->rect.bottom() - 1); | - | ||||||||||||||||||||||||
| 370 | break; never executed: break; | 0 | ||||||||||||||||||||||||
| 371 | case QTabBar::RoundedEast: never executed: case QTabBar::RoundedEast: | 0 | ||||||||||||||||||||||||
| 372 | case QTabBar::TriangularEast: never executed: case QTabBar::TriangularEast: | 0 | ||||||||||||||||||||||||
| 373 | p->setPen(QPen(tbb->palette.dark(), 0)); | - | ||||||||||||||||||||||||
| 374 | p->drawLine(tbb->rect.topRight(), tbb->rect.bottomRight()); | - | ||||||||||||||||||||||||
| 375 | break; never executed: break; | 0 | ||||||||||||||||||||||||
| 376 | } | - | ||||||||||||||||||||||||
| 377 | p->restore(); | - | ||||||||||||||||||||||||
| 378 | } never executed: end of block | 0 | ||||||||||||||||||||||||
| 379 | break; never executed: break; | 0 | ||||||||||||||||||||||||
| 380 | case PE_IndicatorTabClose: { never executed: case PE_IndicatorTabClose: | 0 | ||||||||||||||||||||||||
| 381 | if (d->tabBarcloseButtonIcon.isNull()) {
| 0 | ||||||||||||||||||||||||
| 382 | d->tabBarcloseButtonIcon.addPixmap(QPixmap( | - | ||||||||||||||||||||||||
| 383 | QLatin1String(":/qt-project.org/styles/commonstyle/images/standardbutton-closetab-16.png")), | - | ||||||||||||||||||||||||
| 384 | QIcon::Normal, QIcon::Off); | - | ||||||||||||||||||||||||
| 385 | d->tabBarcloseButtonIcon.addPixmap(QPixmap( | - | ||||||||||||||||||||||||
| 386 | QLatin1String(":/qt-project.org/styles/commonstyle/images/standardbutton-closetab-down-16.png")), | - | ||||||||||||||||||||||||
| 387 | QIcon::Normal, QIcon::On); | - | ||||||||||||||||||||||||
| 388 | d->tabBarcloseButtonIcon.addPixmap(QPixmap( | - | ||||||||||||||||||||||||
| 389 | QLatin1String(":/qt-project.org/styles/commonstyle/images/standardbutton-closetab-hover-16.png")), | - | ||||||||||||||||||||||||
| 390 | QIcon::Active, QIcon::Off); | - | ||||||||||||||||||||||||
| 391 | } never executed: end of block | 0 | ||||||||||||||||||||||||
| 392 | - | |||||||||||||||||||||||||
| 393 | int size = proxy()->pixelMetric(QStyle::PM_SmallIconSize); | - | ||||||||||||||||||||||||
| 394 | QIcon::Mode mode = opt->state & State_Enabled ?
| 0 | ||||||||||||||||||||||||
| 395 | (opt->state & State_Raised ? QIcon::Active : QIcon::Normal)
| 0 | ||||||||||||||||||||||||
| 396 | : QIcon::Disabled; | - | ||||||||||||||||||||||||
| 397 | if (!(opt->state & State_Raised)
| 0 | ||||||||||||||||||||||||
| 398 | && !(opt->state & State_Sunken)
| 0 | ||||||||||||||||||||||||
| 399 | && !(opt->state & QStyle::State_Selected))
| 0 | ||||||||||||||||||||||||
| 400 | mode = QIcon::Disabled; never executed: mode = QIcon::Disabled; | 0 | ||||||||||||||||||||||||
| 401 | - | |||||||||||||||||||||||||
| 402 | QIcon::State state = opt->state & State_Sunken ? QIcon::On : QIcon::Off;
| 0 | ||||||||||||||||||||||||
| 403 | QPixmap pixmap = d->tabBarcloseButtonIcon.pixmap(qt_getWindow(widget), QSize(size, size), mode, state); | - | ||||||||||||||||||||||||
| 404 | proxy()->drawItemPixmap(p, opt->rect, Qt::AlignCenter, pixmap); | - | ||||||||||||||||||||||||
| 405 | break; never executed: break; | 0 | ||||||||||||||||||||||||
| 406 | } | - | ||||||||||||||||||||||||
| 407 | #endif // QT_NO_TABBAR | - | ||||||||||||||||||||||||
| 408 | case PE_FrameTabWidget: never executed: case PE_FrameTabWidget: | 0 | ||||||||||||||||||||||||
| 409 | case PE_FrameWindow: never executed: case PE_FrameWindow: | 0 | ||||||||||||||||||||||||
| 410 | qDrawWinPanel(p, opt->rect, opt->palette, false, 0); | - | ||||||||||||||||||||||||
| 411 | break; never executed: break; | 0 | ||||||||||||||||||||||||
| 412 | case PE_FrameLineEdit: never executed: case PE_FrameLineEdit: | 0 | ||||||||||||||||||||||||
| 413 | proxy()->drawPrimitive(PE_Frame, opt, p, widget); | - | ||||||||||||||||||||||||
| 414 | break; never executed: break; | 0 | ||||||||||||||||||||||||
| 415 | #ifndef QT_NO_GROUPBOX | - | ||||||||||||||||||||||||
| 416 | case PE_FrameGroupBox: never executed: case PE_FrameGroupBox: | 0 | ||||||||||||||||||||||||
| 417 | if (const QStyleOptionFrame *frame = qstyleoption_cast<const QStyleOptionFrame *>(opt)) {
| 0 | ||||||||||||||||||||||||
| 418 | if (frame->features & QStyleOptionFrame::Flat) {
| 0 | ||||||||||||||||||||||||
| 419 | QRect fr = frame->rect; | - | ||||||||||||||||||||||||
| 420 | QPoint p1(fr.x(), fr.y() + 1); | - | ||||||||||||||||||||||||
| 421 | QPoint p2(fr.x() + fr.width(), p1.y()); | - | ||||||||||||||||||||||||
| 422 | qDrawShadeLine(p, p1, p2, frame->palette, true, | - | ||||||||||||||||||||||||
| 423 | frame->lineWidth, frame->midLineWidth); | - | ||||||||||||||||||||||||
| 424 | } else { never executed: end of block | 0 | ||||||||||||||||||||||||
| 425 | qDrawShadeRect(p, frame->rect.x(), frame->rect.y(), frame->rect.width(), | - | ||||||||||||||||||||||||
| 426 | frame->rect.height(), frame->palette, true, | - | ||||||||||||||||||||||||
| 427 | frame->lineWidth, frame->midLineWidth); | - | ||||||||||||||||||||||||
| 428 | } never executed: end of block | 0 | ||||||||||||||||||||||||
| 429 | } | - | ||||||||||||||||||||||||
| 430 | break; never executed: break; | 0 | ||||||||||||||||||||||||
| 431 | #endif // QT_NO_GROUPBOX | - | ||||||||||||||||||||||||
| 432 | #ifndef QT_NO_DOCKWIDGET | - | ||||||||||||||||||||||||
| 433 | case PE_FrameDockWidget: never executed: case PE_FrameDockWidget: | 0 | ||||||||||||||||||||||||
| 434 | if (const QStyleOptionFrame *frame = qstyleoption_cast<const QStyleOptionFrame *>(opt)) {
| 0 | ||||||||||||||||||||||||
| 435 | int lw = frame->lineWidth; | - | ||||||||||||||||||||||||
| 436 | if (lw <= 0)
| 0 | ||||||||||||||||||||||||
| 437 | lw = proxy()->pixelMetric(PM_DockWidgetFrameWidth); never executed: lw = proxy()->pixelMetric(PM_DockWidgetFrameWidth); | 0 | ||||||||||||||||||||||||
| 438 | - | |||||||||||||||||||||||||
| 439 | qDrawShadePanel(p, frame->rect, frame->palette, false, lw); | - | ||||||||||||||||||||||||
| 440 | } never executed: end of block | 0 | ||||||||||||||||||||||||
| 441 | break; never executed: break; | 0 | ||||||||||||||||||||||||
| 442 | #endif // QT_NO_DOCKWIDGET | - | ||||||||||||||||||||||||
| 443 | #ifndef QT_NO_TOOLBAR | - | ||||||||||||||||||||||||
| 444 | case PE_IndicatorToolBarHandle: never executed: case PE_IndicatorToolBarHandle: | 0 | ||||||||||||||||||||||||
| 445 | p->save(); | - | ||||||||||||||||||||||||
| 446 | p->translate(opt->rect.x(), opt->rect.y()); | - | ||||||||||||||||||||||||
| 447 | if (opt->state & State_Horizontal) {
| 0 | ||||||||||||||||||||||||
| 448 | int x = opt->rect.width() / 3; | - | ||||||||||||||||||||||||
| 449 | if (opt->direction == Qt::RightToLeft)
| 0 | ||||||||||||||||||||||||
| 450 | x -= 2; never executed: x -= 2; | 0 | ||||||||||||||||||||||||
| 451 | if (opt->rect.height() > 4) {
| 0 | ||||||||||||||||||||||||
| 452 | qDrawShadePanel(p, x, 2, 3, opt->rect.height() - 4, | - | ||||||||||||||||||||||||
| 453 | opt->palette, false, 1, 0); | - | ||||||||||||||||||||||||
| 454 | qDrawShadePanel(p, x+3, 2, 3, opt->rect.height() - 4, | - | ||||||||||||||||||||||||
| 455 | opt->palette, false, 1, 0); | - | ||||||||||||||||||||||||
| 456 | } never executed: end of block | 0 | ||||||||||||||||||||||||
| 457 | } else { never executed: end of block | 0 | ||||||||||||||||||||||||
| 458 | if (opt->rect.width() > 4) {
| 0 | ||||||||||||||||||||||||
| 459 | int y = opt->rect.height() / 3; | - | ||||||||||||||||||||||||
| 460 | qDrawShadePanel(p, 2, y, opt->rect.width() - 4, 3, | - | ||||||||||||||||||||||||
| 461 | opt->palette, false, 1, 0); | - | ||||||||||||||||||||||||
| 462 | qDrawShadePanel(p, 2, y+3, opt->rect.width() - 4, 3, | - | ||||||||||||||||||||||||
| 463 | opt->palette, false, 1, 0); | - | ||||||||||||||||||||||||
| 464 | } never executed: end of block | 0 | ||||||||||||||||||||||||
| 465 | } never executed: end of block | 0 | ||||||||||||||||||||||||
| 466 | p->restore(); | - | ||||||||||||||||||||||||
| 467 | break; never executed: break; | 0 | ||||||||||||||||||||||||
| 468 | case PE_IndicatorToolBarSeparator: never executed: case PE_IndicatorToolBarSeparator: | 0 | ||||||||||||||||||||||||
| 469 | { | - | ||||||||||||||||||||||||
| 470 | QPoint p1, p2; | - | ||||||||||||||||||||||||
| 471 | if (opt->state & State_Horizontal) {
| 0 | ||||||||||||||||||||||||
| 472 | p1 = QPoint(opt->rect.width()/2, 0); | - | ||||||||||||||||||||||||
| 473 | p2 = QPoint(p1.x(), opt->rect.height()); | - | ||||||||||||||||||||||||
| 474 | } else { never executed: end of block | 0 | ||||||||||||||||||||||||
| 475 | p1 = QPoint(0, opt->rect.height()/2); | - | ||||||||||||||||||||||||
| 476 | p2 = QPoint(opt->rect.width(), p1.y()); | - | ||||||||||||||||||||||||
| 477 | } never executed: end of block | 0 | ||||||||||||||||||||||||
| 478 | qDrawShadeLine(p, p1, p2, opt->palette, 1, 1, 0); | - | ||||||||||||||||||||||||
| 479 | break; never executed: break; | 0 | ||||||||||||||||||||||||
| 480 | } | - | ||||||||||||||||||||||||
| 481 | #endif // QT_NO_TOOLBAR | - | ||||||||||||||||||||||||
| 482 | #ifndef QT_NO_SPINBOX | - | ||||||||||||||||||||||||
| 483 | case PE_IndicatorSpinPlus: never executed: case PE_IndicatorSpinPlus: | 0 | ||||||||||||||||||||||||
| 484 | case PE_IndicatorSpinMinus: { never executed: case PE_IndicatorSpinMinus: | 0 | ||||||||||||||||||||||||
| 485 | QRect r = opt->rect; | - | ||||||||||||||||||||||||
| 486 | int fw = proxy()->pixelMetric(PM_DefaultFrameWidth, opt, widget); | - | ||||||||||||||||||||||||
| 487 | QRect br = r.adjusted(fw, fw, -fw, -fw); | - | ||||||||||||||||||||||||
| 488 | - | |||||||||||||||||||||||||
| 489 | int offset = (opt->state & State_Sunken) ? 1 : 0;
| 0 | ||||||||||||||||||||||||
| 490 | int step = (br.width() + 4) / 5; | - | ||||||||||||||||||||||||
| 491 | p->fillRect(br.x() + offset, br.y() + offset +br.height() / 2 - step / 2, | - | ||||||||||||||||||||||||
| 492 | br.width(), step, | - | ||||||||||||||||||||||||
| 493 | opt->palette.buttonText()); | - | ||||||||||||||||||||||||
| 494 | if (pe == PE_IndicatorSpinPlus)
| 0 | ||||||||||||||||||||||||
| 495 | p->fillRect(br.x() + br.width() / 2 - step / 2 + offset, br.y() + offset, never executed: p->fillRect(br.x() + br.width() / 2 - step / 2 + offset, br.y() + offset, step, br.height(), opt->palette.buttonText()); | 0 | ||||||||||||||||||||||||
| 496 | step, br.height(), never executed: p->fillRect(br.x() + br.width() / 2 - step / 2 + offset, br.y() + offset, step, br.height(), opt->palette.buttonText()); | 0 | ||||||||||||||||||||||||
| 497 | opt->palette.buttonText()); never executed: p->fillRect(br.x() + br.width() / 2 - step / 2 + offset, br.y() + offset, step, br.height(), opt->palette.buttonText()); | 0 | ||||||||||||||||||||||||
| 498 | - | |||||||||||||||||||||||||
| 499 | break; } never executed: break; | 0 | ||||||||||||||||||||||||
| 500 | case PE_IndicatorSpinUp: never executed: case PE_IndicatorSpinUp: | 0 | ||||||||||||||||||||||||
| 501 | case PE_IndicatorSpinDown: { never executed: case PE_IndicatorSpinDown: | 0 | ||||||||||||||||||||||||
| 502 | QRect r = opt->rect; | - | ||||||||||||||||||||||||
| 503 | int fw = proxy()->pixelMetric(PM_DefaultFrameWidth, opt, widget); | - | ||||||||||||||||||||||||
| 504 | // QRect br = r.adjusted(fw, fw, -fw, -fw); | - | ||||||||||||||||||||||||
| 505 | int x = r.x(), y = r.y(), w = r.width(), h = r.height(); | - | ||||||||||||||||||||||||
| 506 | int sw = w-4; | - | ||||||||||||||||||||||||
| 507 | if (sw < 3)
| 0 | ||||||||||||||||||||||||
| 508 | break; never executed: break; | 0 | ||||||||||||||||||||||||
| 509 | else if (!(sw & 1))
| 0 | ||||||||||||||||||||||||
| 510 | sw--; never executed: sw--; | 0 | ||||||||||||||||||||||||
| 511 | sw -= (sw / 7) * 2; // Empty border | - | ||||||||||||||||||||||||
| 512 | int sh = sw/2 + 2; // Must have empty row at foot of arrow | - | ||||||||||||||||||||||||
| 513 | - | |||||||||||||||||||||||||
| 514 | int sx = x + w / 2 - sw / 2; | - | ||||||||||||||||||||||||
| 515 | int sy = y + h / 2 - sh / 2; | - | ||||||||||||||||||||||||
| 516 | - | |||||||||||||||||||||||||
| 517 | if (pe == PE_IndicatorSpinUp && fw)
| 0 | ||||||||||||||||||||||||
| 518 | --sy; never executed: --sy; | 0 | ||||||||||||||||||||||||
| 519 | - | |||||||||||||||||||||||||
| 520 | int bsx = 0; | - | ||||||||||||||||||||||||
| 521 | int bsy = 0; | - | ||||||||||||||||||||||||
| 522 | if (opt->state & State_Sunken) {
| 0 | ||||||||||||||||||||||||
| 523 | bsx = proxy()->pixelMetric(PM_ButtonShiftHorizontal); | - | ||||||||||||||||||||||||
| 524 | bsy = proxy()->pixelMetric(PM_ButtonShiftVertical); | - | ||||||||||||||||||||||||
| 525 | } never executed: end of block | 0 | ||||||||||||||||||||||||
| 526 | p->save(); | - | ||||||||||||||||||||||||
| 527 | p->translate(sx + bsx, sy + bsy); | - | ||||||||||||||||||||||||
| 528 | p->setPen(opt->palette.buttonText().color()); | - | ||||||||||||||||||||||||
| 529 | p->setBrush(opt->palette.buttonText()); | - | ||||||||||||||||||||||||
| 530 | p->setRenderHint(QPainter::Qt4CompatiblePainting); | - | ||||||||||||||||||||||||
| 531 | if (pe == PE_IndicatorSpinDown) {
| 0 | ||||||||||||||||||||||||
| 532 | const QPoint points[] = { QPoint(0, 1), QPoint(sw-1, 1), QPoint(sh-2, sh-1) }; | - | ||||||||||||||||||||||||
| 533 | p->drawPolygon(points, sizeof points / sizeof *points); | - | ||||||||||||||||||||||||
| 534 | } else { never executed: end of block | 0 | ||||||||||||||||||||||||
| 535 | const QPoint points[] = { QPoint(0, sh-1), QPoint(sw-1, sh-1), QPoint(sh-2, 1) }; | - | ||||||||||||||||||||||||
| 536 | p->drawPolygon(points, sizeof points / sizeof *points); | - | ||||||||||||||||||||||||
| 537 | } never executed: end of block | 0 | ||||||||||||||||||||||||
| 538 | p->restore(); | - | ||||||||||||||||||||||||
| 539 | break; } never executed: break; | 0 | ||||||||||||||||||||||||
| 540 | #endif // QT_NO_SPINBOX | - | ||||||||||||||||||||||||
| 541 | case PE_PanelTipLabel: { never executed: case PE_PanelTipLabel: | 0 | ||||||||||||||||||||||||
| 542 | QBrush oldBrush = p->brush(); | - | ||||||||||||||||||||||||
| 543 | QPen oldPen = p->pen(); | - | ||||||||||||||||||||||||
| 544 | p->setPen(QPen(opt->palette.toolTipText(), 0)); | - | ||||||||||||||||||||||||
| 545 | p->setBrush(opt->palette.toolTipBase()); | - | ||||||||||||||||||||||||
| 546 | p->drawRect(opt->rect.adjusted(0, 0, -1, -1)); | - | ||||||||||||||||||||||||
| 547 | p->setPen(oldPen); | - | ||||||||||||||||||||||||
| 548 | p->setBrush(oldBrush); | - | ||||||||||||||||||||||||
| 549 | break; never executed: break; | 0 | ||||||||||||||||||||||||
| 550 | } | - | ||||||||||||||||||||||||
| 551 | #ifndef QT_NO_TABBAR | - | ||||||||||||||||||||||||
| 552 | case PE_IndicatorTabTear: never executed: case PE_IndicatorTabTear: | 0 | ||||||||||||||||||||||||
| 553 | if (const QStyleOptionTab *tab = qstyleoption_cast<const QStyleOptionTab *>(opt)) {
| 0 | ||||||||||||||||||||||||
| 554 | bool rtl = tab->direction == Qt::RightToLeft; | - | ||||||||||||||||||||||||
| 555 | QRect rect = tab->rect; | - | ||||||||||||||||||||||||
| 556 | QPainterPath path; | - | ||||||||||||||||||||||||
| 557 | - | |||||||||||||||||||||||||
| 558 | rect.setTop(rect.top() + ((tab->state & State_Selected) ? 1 : 3)); | - | ||||||||||||||||||||||||
| 559 | rect.setBottom(rect.bottom() - ((tab->state & State_Selected) ? 0 : 2)); | - | ||||||||||||||||||||||||
| 560 | - | |||||||||||||||||||||||||
| 561 | path.moveTo(QPoint(rtl ? rect.right() : rect.left(), rect.top())); | - | ||||||||||||||||||||||||
| 562 | int count = 4; | - | ||||||||||||||||||||||||
| 563 | for(int jags = 1; jags <= count; ++jags, rtl = !rtl)
| 0 | ||||||||||||||||||||||||
| 564 | path.lineTo(QPoint(rtl ? rect.left() : rect.right(), rect.top() + jags * rect.height()/count)); never executed: path.lineTo(QPoint(rtl ? rect.left() : rect.right(), rect.top() + jags * rect.height()/count)); | 0 | ||||||||||||||||||||||||
| 565 | - | |||||||||||||||||||||||||
| 566 | p->setPen(QPen(tab->palette.light(), qreal(.8))); | - | ||||||||||||||||||||||||
| 567 | p->setBrush(tab->palette.background()); | - | ||||||||||||||||||||||||
| 568 | p->setRenderHint(QPainter::Antialiasing); | - | ||||||||||||||||||||||||
| 569 | p->drawPath(path); | - | ||||||||||||||||||||||||
| 570 | } never executed: end of block | 0 | ||||||||||||||||||||||||
| 571 | break; never executed: break; | 0 | ||||||||||||||||||||||||
| 572 | #endif // QT_NO_TABBAR | - | ||||||||||||||||||||||||
| 573 | #ifndef QT_NO_LINEEDIT | - | ||||||||||||||||||||||||
| 574 | case PE_PanelLineEdit: never executed: case PE_PanelLineEdit: | 0 | ||||||||||||||||||||||||
| 575 | if (const QStyleOptionFrame *panel = qstyleoption_cast<const QStyleOptionFrame *>(opt)) {
| 0 | ||||||||||||||||||||||||
| 576 | p->fillRect(panel->rect.adjusted(panel->lineWidth, panel->lineWidth, -panel->lineWidth, -panel->lineWidth), | - | ||||||||||||||||||||||||
| 577 | panel->palette.brush(QPalette::Base)); | - | ||||||||||||||||||||||||
| 578 | - | |||||||||||||||||||||||||
| 579 | if (panel->lineWidth > 0)
| 0 | ||||||||||||||||||||||||
| 580 | proxy()->drawPrimitive(PE_FrameLineEdit, panel, p, widget); never executed: proxy()->drawPrimitive(PE_FrameLineEdit, panel, p, widget); | 0 | ||||||||||||||||||||||||
| 581 | } never executed: end of block | 0 | ||||||||||||||||||||||||
| 582 | break; never executed: break; | 0 | ||||||||||||||||||||||||
| 583 | #endif // QT_NO_LINEEDIT | - | ||||||||||||||||||||||||
| 584 | #ifndef QT_NO_COLUMNVIEW | - | ||||||||||||||||||||||||
| 585 | case PE_IndicatorColumnViewArrow: { never executed: case PE_IndicatorColumnViewArrow: | 0 | ||||||||||||||||||||||||
| 586 | if (const QStyleOptionViewItem *viewOpt = qstyleoption_cast<const QStyleOptionViewItem *>(opt)) {
| 0 | ||||||||||||||||||||||||
| 587 | bool reverse = (viewOpt->direction == Qt::RightToLeft); | - | ||||||||||||||||||||||||
| 588 | p->save(); | - | ||||||||||||||||||||||||
| 589 | QPainterPath path; | - | ||||||||||||||||||||||||
| 590 | int x = viewOpt->rect.x() + 1; | - | ||||||||||||||||||||||||
| 591 | int offset = (viewOpt->rect.height() / 3); | - | ||||||||||||||||||||||||
| 592 | int height = (viewOpt->rect.height()) - offset * 2; | - | ||||||||||||||||||||||||
| 593 | if (height % 2 == 1)
| 0 | ||||||||||||||||||||||||
| 594 | --height; never executed: --height; | 0 | ||||||||||||||||||||||||
| 595 | int x2 = x + height - 1; | - | ||||||||||||||||||||||||
| 596 | if (reverse) {
| 0 | ||||||||||||||||||||||||
| 597 | x = viewOpt->rect.x() + viewOpt->rect.width() - 1; | - | ||||||||||||||||||||||||
| 598 | x2 = x - height + 1; | - | ||||||||||||||||||||||||
| 599 | } never executed: end of block | 0 | ||||||||||||||||||||||||
| 600 | path.moveTo(x, viewOpt->rect.y() + offset); | - | ||||||||||||||||||||||||
| 601 | path.lineTo(x, viewOpt->rect.y() + offset + height); | - | ||||||||||||||||||||||||
| 602 | path.lineTo(x2, viewOpt->rect.y() + offset+height/2); | - | ||||||||||||||||||||||||
| 603 | path.closeSubpath(); | - | ||||||||||||||||||||||||
| 604 | if (viewOpt->state & QStyle::State_Selected ) {
| 0 | ||||||||||||||||||||||||
| 605 | if (viewOpt->showDecorationSelected) {
| 0 | ||||||||||||||||||||||||
| 606 | QColor color = viewOpt->palette.color(QPalette::Active, QPalette::HighlightedText); | - | ||||||||||||||||||||||||
| 607 | p->setPen(color); | - | ||||||||||||||||||||||||
| 608 | p->setBrush(color); | - | ||||||||||||||||||||||||
| 609 | } else { never executed: end of block | 0 | ||||||||||||||||||||||||
| 610 | QColor color = viewOpt->palette.color(QPalette::Active, QPalette::WindowText); | - | ||||||||||||||||||||||||
| 611 | p->setPen(color); | - | ||||||||||||||||||||||||
| 612 | p->setBrush(color); | - | ||||||||||||||||||||||||
| 613 | } never executed: end of block | 0 | ||||||||||||||||||||||||
| 614 | - | |||||||||||||||||||||||||
| 615 | } else { | - | ||||||||||||||||||||||||
| 616 | QColor color = viewOpt->palette.color(QPalette::Active, QPalette::Mid); | - | ||||||||||||||||||||||||
| 617 | p->setPen(color); | - | ||||||||||||||||||||||||
| 618 | p->setBrush(color); | - | ||||||||||||||||||||||||
| 619 | } never executed: end of block | 0 | ||||||||||||||||||||||||
| 620 | p->drawPath(path); | - | ||||||||||||||||||||||||
| 621 | - | |||||||||||||||||||||||||
| 622 | // draw the vertical and top triangle line | - | ||||||||||||||||||||||||
| 623 | if (!(viewOpt->state & QStyle::State_Selected)) {
| 0 | ||||||||||||||||||||||||
| 624 | QPainterPath lines; | - | ||||||||||||||||||||||||
| 625 | lines.moveTo(x, viewOpt->rect.y() + offset); | - | ||||||||||||||||||||||||
| 626 | lines.lineTo(x, viewOpt->rect.y() + offset + height); | - | ||||||||||||||||||||||||
| 627 | lines.moveTo(x, viewOpt->rect.y() + offset); | - | ||||||||||||||||||||||||
| 628 | lines.lineTo(x2, viewOpt->rect.y() + offset+height/2); | - | ||||||||||||||||||||||||
| 629 | QColor color = viewOpt->palette.color(QPalette::Active, QPalette::Dark); | - | ||||||||||||||||||||||||
| 630 | p->setPen(color); | - | ||||||||||||||||||||||||
| 631 | p->drawPath(lines); | - | ||||||||||||||||||||||||
| 632 | } never executed: end of block | 0 | ||||||||||||||||||||||||
| 633 | p->restore(); | - | ||||||||||||||||||||||||
| 634 | } never executed: end of block | 0 | ||||||||||||||||||||||||
| 635 | break; } never executed: break; | 0 | ||||||||||||||||||||||||
| 636 | #endif //QT_NO_COLUMNVIEW | - | ||||||||||||||||||||||||
| 637 | case PE_IndicatorItemViewItemDrop: { never executed: case PE_IndicatorItemViewItemDrop: | 0 | ||||||||||||||||||||||||
| 638 | QRect rect = opt->rect; | - | ||||||||||||||||||||||||
| 639 | if (opt->rect.height() == 0)
| 0 | ||||||||||||||||||||||||
| 640 | p->drawLine(rect.topLeft(), rect.topRight()); never executed: p->drawLine(rect.topLeft(), rect.topRight()); | 0 | ||||||||||||||||||||||||
| 641 | else | - | ||||||||||||||||||||||||
| 642 | p->drawRect(rect); never executed: p->drawRect(rect); | 0 | ||||||||||||||||||||||||
| 643 | break; } never executed: break; | 0 | ||||||||||||||||||||||||
| 644 | #ifndef QT_NO_ITEMVIEWS | - | ||||||||||||||||||||||||
| 645 | case PE_PanelItemViewRow: never executed: case PE_PanelItemViewRow: | 0 | ||||||||||||||||||||||||
| 646 | if (const QStyleOptionViewItem *vopt = qstyleoption_cast<const QStyleOptionViewItem *>(opt)) {
| 0 | ||||||||||||||||||||||||
| 647 | QPalette::ColorGroup cg = (widget ? widget->isEnabled() : (vopt->state & QStyle::State_Enabled))
| 0 | ||||||||||||||||||||||||
| 648 | ? QPalette::Normal : QPalette::Disabled; | - | ||||||||||||||||||||||||
| 649 | if (cg == QPalette::Normal && !(vopt->state & QStyle::State_Active))
| 0 | ||||||||||||||||||||||||
| 650 | cg = QPalette::Inactive; never executed: cg = QPalette::Inactive; | 0 | ||||||||||||||||||||||||
| 651 | - | |||||||||||||||||||||||||
| 652 | if ((vopt->state & QStyle::State_Selected) && proxy()->styleHint(QStyle::SH_ItemView_ShowDecorationSelected, opt, widget))
| 0 | ||||||||||||||||||||||||
| 653 | p->fillRect(vopt->rect, vopt->palette.brush(cg, QPalette::Highlight)); never executed: p->fillRect(vopt->rect, vopt->palette.brush(cg, QPalette::Highlight)); | 0 | ||||||||||||||||||||||||
| 654 | else if (vopt->features & QStyleOptionViewItem::Alternate)
| 0 | ||||||||||||||||||||||||
| 655 | p->fillRect(vopt->rect, vopt->palette.brush(cg, QPalette::AlternateBase)); never executed: p->fillRect(vopt->rect, vopt->palette.brush(cg, QPalette::AlternateBase)); | 0 | ||||||||||||||||||||||||
| 656 | } never executed: end of block | 0 | ||||||||||||||||||||||||
| 657 | break; never executed: break; | 0 | ||||||||||||||||||||||||
| 658 | case PE_PanelItemViewItem: never executed: case PE_PanelItemViewItem: | 0 | ||||||||||||||||||||||||
| 659 | if (const QStyleOptionViewItem *vopt = qstyleoption_cast<const QStyleOptionViewItem *>(opt)) {
| 0 | ||||||||||||||||||||||||
| 660 | QPalette::ColorGroup cg = (widget ? widget->isEnabled() : (vopt->state & QStyle::State_Enabled))
| 0 | ||||||||||||||||||||||||
| 661 | ? QPalette::Normal : QPalette::Disabled; | - | ||||||||||||||||||||||||
| 662 | if (cg == QPalette::Normal && !(vopt->state & QStyle::State_Active))
| 0 | ||||||||||||||||||||||||
| 663 | cg = QPalette::Inactive; never executed: cg = QPalette::Inactive; | 0 | ||||||||||||||||||||||||
| 664 | - | |||||||||||||||||||||||||
| 665 | if (vopt->showDecorationSelected && (vopt->state & QStyle::State_Selected)) {
| 0 | ||||||||||||||||||||||||
| 666 | p->fillRect(vopt->rect, vopt->palette.brush(cg, QPalette::Highlight)); | - | ||||||||||||||||||||||||
| 667 | } else { never executed: end of block | 0 | ||||||||||||||||||||||||
| 668 | if (vopt->backgroundBrush.style() != Qt::NoBrush) {
| 0 | ||||||||||||||||||||||||
| 669 | QPointF oldBO = p->brushOrigin(); | - | ||||||||||||||||||||||||
| 670 | p->setBrushOrigin(vopt->rect.topLeft()); | - | ||||||||||||||||||||||||
| 671 | p->fillRect(vopt->rect, vopt->backgroundBrush); | - | ||||||||||||||||||||||||
| 672 | p->setBrushOrigin(oldBO); | - | ||||||||||||||||||||||||
| 673 | } never executed: end of block | 0 | ||||||||||||||||||||||||
| 674 | - | |||||||||||||||||||||||||
| 675 | if (vopt->state & QStyle::State_Selected) {
| 0 | ||||||||||||||||||||||||
| 676 | QRect textRect = subElementRect(QStyle::SE_ItemViewItemText, opt, widget); | - | ||||||||||||||||||||||||
| 677 | p->fillRect(textRect, vopt->palette.brush(cg, QPalette::Highlight)); | - | ||||||||||||||||||||||||
| 678 | } never executed: end of block | 0 | ||||||||||||||||||||||||
| 679 | } never executed: end of block | 0 | ||||||||||||||||||||||||
| 680 | } | - | ||||||||||||||||||||||||
| 681 | break; never executed: break; | 0 | ||||||||||||||||||||||||
| 682 | #endif //QT_NO_ITEMVIEWS | - | ||||||||||||||||||||||||
| 683 | case PE_PanelScrollAreaCorner: { never executed: case PE_PanelScrollAreaCorner: | 0 | ||||||||||||||||||||||||
| 684 | const QBrush brush(opt->palette.brush(QPalette::Window)); | - | ||||||||||||||||||||||||
| 685 | p->fillRect(opt->rect, brush); | - | ||||||||||||||||||||||||
| 686 | } break; never executed: break; | 0 | ||||||||||||||||||||||||
| 687 | case PE_IndicatorArrowUp: never executed: case PE_IndicatorArrowUp: | 0 | ||||||||||||||||||||||||
| 688 | case PE_IndicatorArrowDown: never executed: case PE_IndicatorArrowDown: | 0 | ||||||||||||||||||||||||
| 689 | case PE_IndicatorArrowRight: never executed: case PE_IndicatorArrowRight: | 0 | ||||||||||||||||||||||||
| 690 | case PE_IndicatorArrowLeft: never executed: case PE_IndicatorArrowLeft: | 0 | ||||||||||||||||||||||||
| 691 | { | - | ||||||||||||||||||||||||
| 692 | if (opt->rect.width() <= 1 || opt->rect.height() <= 1)
| 0 | ||||||||||||||||||||||||
| 693 | break; never executed: break; | 0 | ||||||||||||||||||||||||
| 694 | QRect r = opt->rect; | - | ||||||||||||||||||||||||
| 695 | int size = qMin(r.height(), r.width()); | - | ||||||||||||||||||||||||
| 696 | QPixmap pixmap; | - | ||||||||||||||||||||||||
| 697 | QString pixmapName = QStyleHelper::uniqueName(QLatin1String("$qt_ia-") | - | ||||||||||||||||||||||||
| 698 | % QLatin1String(metaObject()->className()), opt, QSize(size, size)) | - | ||||||||||||||||||||||||
| 699 | % HexString<uint>(pe); | - | ||||||||||||||||||||||||
| 700 | if (!QPixmapCache::find(pixmapName, pixmap)) {
| 0 | ||||||||||||||||||||||||
| 701 | int border = size/5; | - | ||||||||||||||||||||||||
| 702 | int sqsize = 2*(size/2); | - | ||||||||||||||||||||||||
| 703 | QImage image(sqsize, sqsize, QImage::Format_ARGB32_Premultiplied); | - | ||||||||||||||||||||||||
| 704 | image.fill(0); | - | ||||||||||||||||||||||||
| 705 | QPainter imagePainter(&image); | - | ||||||||||||||||||||||||
| 706 | - | |||||||||||||||||||||||||
| 707 | QPolygon a; | - | ||||||||||||||||||||||||
| 708 | switch (pe) { | - | ||||||||||||||||||||||||
| 709 | case PE_IndicatorArrowUp: never executed: case PE_IndicatorArrowUp: | 0 | ||||||||||||||||||||||||
| 710 | a.setPoints(3, border, sqsize/2, sqsize/2, border, sqsize - border, sqsize/2); | - | ||||||||||||||||||||||||
| 711 | break; never executed: break; | 0 | ||||||||||||||||||||||||
| 712 | case PE_IndicatorArrowDown: never executed: case PE_IndicatorArrowDown: | 0 | ||||||||||||||||||||||||
| 713 | a.setPoints(3, border, sqsize/2, sqsize/2, sqsize - border, sqsize - border, sqsize/2); | - | ||||||||||||||||||||||||
| 714 | break; never executed: break; | 0 | ||||||||||||||||||||||||
| 715 | case PE_IndicatorArrowRight: never executed: case PE_IndicatorArrowRight: | 0 | ||||||||||||||||||||||||
| 716 | a.setPoints(3, sqsize - border, sqsize/2, sqsize/2, border, sqsize/2, sqsize - border); | - | ||||||||||||||||||||||||
| 717 | break; never executed: break; | 0 | ||||||||||||||||||||||||
| 718 | case PE_IndicatorArrowLeft: never executed: case PE_IndicatorArrowLeft: | 0 | ||||||||||||||||||||||||
| 719 | a.setPoints(3, border, sqsize/2, sqsize/2, border, sqsize/2, sqsize - border); | - | ||||||||||||||||||||||||
| 720 | break; never executed: break; | 0 | ||||||||||||||||||||||||
| 721 | default: never executed: default: | 0 | ||||||||||||||||||||||||
| 722 | break; never executed: break; | 0 | ||||||||||||||||||||||||
| 723 | } | - | ||||||||||||||||||||||||
| 724 | - | |||||||||||||||||||||||||
| 725 | int bsx = 0; | - | ||||||||||||||||||||||||
| 726 | int bsy = 0; | - | ||||||||||||||||||||||||
| 727 | - | |||||||||||||||||||||||||
| 728 | if (opt->state & State_Sunken) {
| 0 | ||||||||||||||||||||||||
| 729 | bsx = proxy()->pixelMetric(PM_ButtonShiftHorizontal, opt, widget); | - | ||||||||||||||||||||||||
| 730 | bsy = proxy()->pixelMetric(PM_ButtonShiftVertical, opt, widget); | - | ||||||||||||||||||||||||
| 731 | } never executed: end of block | 0 | ||||||||||||||||||||||||
| 732 | - | |||||||||||||||||||||||||
| 733 | QRect bounds = a.boundingRect(); | - | ||||||||||||||||||||||||
| 734 | int sx = sqsize / 2 - bounds.center().x() - 1; | - | ||||||||||||||||||||||||
| 735 | int sy = sqsize / 2 - bounds.center().y() - 1; | - | ||||||||||||||||||||||||
| 736 | imagePainter.translate(sx + bsx, sy + bsy); | - | ||||||||||||||||||||||||
| 737 | imagePainter.setPen(opt->palette.buttonText().color()); | - | ||||||||||||||||||||||||
| 738 | imagePainter.setBrush(opt->palette.buttonText()); | - | ||||||||||||||||||||||||
| 739 | imagePainter.setRenderHint(QPainter::Qt4CompatiblePainting); | - | ||||||||||||||||||||||||
| 740 | - | |||||||||||||||||||||||||
| 741 | if (!(opt->state & State_Enabled)) {
| 0 | ||||||||||||||||||||||||
| 742 | imagePainter.translate(1, 1); | - | ||||||||||||||||||||||||
| 743 | imagePainter.setBrush(opt->palette.light().color()); | - | ||||||||||||||||||||||||
| 744 | imagePainter.setPen(opt->palette.light().color()); | - | ||||||||||||||||||||||||
| 745 | imagePainter.drawPolygon(a); | - | ||||||||||||||||||||||||
| 746 | imagePainter.translate(-1, -1); | - | ||||||||||||||||||||||||
| 747 | imagePainter.setBrush(opt->palette.mid().color()); | - | ||||||||||||||||||||||||
| 748 | imagePainter.setPen(opt->palette.mid().color()); | - | ||||||||||||||||||||||||
| 749 | } never executed: end of block | 0 | ||||||||||||||||||||||||
| 750 | - | |||||||||||||||||||||||||
| 751 | imagePainter.drawPolygon(a); | - | ||||||||||||||||||||||||
| 752 | imagePainter.end(); | - | ||||||||||||||||||||||||
| 753 | pixmap = QPixmap::fromImage(image); | - | ||||||||||||||||||||||||
| 754 | QPixmapCache::insert(pixmapName, pixmap); | - | ||||||||||||||||||||||||
| 755 | } never executed: end of block | 0 | ||||||||||||||||||||||||
| 756 | int xOffset = r.x() + (r.width() - size)/2; | - | ||||||||||||||||||||||||
| 757 | int yOffset = r.y() + (r.height() - size)/2; | - | ||||||||||||||||||||||||
| 758 | p->drawPixmap(xOffset, yOffset, pixmap); | - | ||||||||||||||||||||||||
| 759 | } | - | ||||||||||||||||||||||||
| 760 | break; never executed: break; | 0 | ||||||||||||||||||||||||
| 761 | default: never executed: default: | 0 | ||||||||||||||||||||||||
| 762 | break; never executed: break; | 0 | ||||||||||||||||||||||||
| 763 | } | - | ||||||||||||||||||||||||
| 764 | } | - | ||||||||||||||||||||||||
| 765 | - | |||||||||||||||||||||||||
| 766 | #ifndef QT_NO_TOOLBUTTON | - | ||||||||||||||||||||||||
| 767 | static void drawArrow(const QStyle *style, const QStyleOptionToolButton *toolbutton, | - | ||||||||||||||||||||||||
| 768 | const QRect &rect, QPainter *painter, const QWidget *widget = 0) | - | ||||||||||||||||||||||||
| 769 | { | - | ||||||||||||||||||||||||
| 770 | QStyle::PrimitiveElement pe; | - | ||||||||||||||||||||||||
| 771 | switch (toolbutton->arrowType) { | - | ||||||||||||||||||||||||
| 772 | case Qt::LeftArrow: never executed: case Qt::LeftArrow: | 0 | ||||||||||||||||||||||||
| 773 | pe = QStyle::PE_IndicatorArrowLeft; | - | ||||||||||||||||||||||||
| 774 | break; never executed: break; | 0 | ||||||||||||||||||||||||
| 775 | case Qt::RightArrow: never executed: case Qt::RightArrow: | 0 | ||||||||||||||||||||||||
| 776 | pe = QStyle::PE_IndicatorArrowRight; | - | ||||||||||||||||||||||||
| 777 | break; never executed: break; | 0 | ||||||||||||||||||||||||
| 778 | case Qt::UpArrow: never executed: case Qt::UpArrow: | 0 | ||||||||||||||||||||||||
| 779 | pe = QStyle::PE_IndicatorArrowUp; | - | ||||||||||||||||||||||||
| 780 | break; never executed: break; | 0 | ||||||||||||||||||||||||
| 781 | case Qt::DownArrow: never executed: case Qt::DownArrow: | 0 | ||||||||||||||||||||||||
| 782 | pe = QStyle::PE_IndicatorArrowDown; | - | ||||||||||||||||||||||||
| 783 | break; never executed: break; | 0 | ||||||||||||||||||||||||
| 784 | default: never executed: default: | 0 | ||||||||||||||||||||||||
| 785 | return; never executed: return; | 0 | ||||||||||||||||||||||||
| 786 | } | - | ||||||||||||||||||||||||
| 787 | QStyleOption arrowOpt = *toolbutton; | - | ||||||||||||||||||||||||
| 788 | arrowOpt.rect = rect; | - | ||||||||||||||||||||||||
| 789 | style->drawPrimitive(pe, &arrowOpt, painter, widget); | - | ||||||||||||||||||||||||
| 790 | } never executed: end of block | 0 | ||||||||||||||||||||||||
| 791 | #endif // QT_NO_TOOLBUTTON | - | ||||||||||||||||||||||||
| 792 | - | |||||||||||||||||||||||||
| 793 | #ifndef QT_NO_ITEMVIEWS | - | ||||||||||||||||||||||||
| 794 | - | |||||||||||||||||||||||||
| 795 | static QSizeF viewItemTextLayout(QTextLayout &textLayout, int lineWidth) | - | ||||||||||||||||||||||||
| 796 | { | - | ||||||||||||||||||||||||
| 797 | qreal height = 0; | - | ||||||||||||||||||||||||
| 798 | qreal widthUsed = 0; | - | ||||||||||||||||||||||||
| 799 | textLayout.beginLayout(); | - | ||||||||||||||||||||||||
| 800 | while (true) { | - | ||||||||||||||||||||||||
| 801 | QTextLine line = textLayout.createLine(); | - | ||||||||||||||||||||||||
| 802 | if (!line.isValid())
| 0 | ||||||||||||||||||||||||
| 803 | break; never executed: break; | 0 | ||||||||||||||||||||||||
| 804 | line.setLineWidth(lineWidth); | - | ||||||||||||||||||||||||
| 805 | line.setPosition(QPointF(0, height)); | - | ||||||||||||||||||||||||
| 806 | height += line.height(); | - | ||||||||||||||||||||||||
| 807 | widthUsed = qMax(widthUsed, line.naturalTextWidth()); | - | ||||||||||||||||||||||||
| 808 | } never executed: end of block | 0 | ||||||||||||||||||||||||
| 809 | textLayout.endLayout(); | - | ||||||||||||||||||||||||
| 810 | return QSizeF(widthUsed, height); never executed: return QSizeF(widthUsed, height); | 0 | ||||||||||||||||||||||||
| 811 | } | - | ||||||||||||||||||||||||
| 812 | - | |||||||||||||||||||||||||
| 813 | QSize QCommonStylePrivate::viewItemSize(const QStyleOptionViewItem *option, int role) const | - | ||||||||||||||||||||||||
| 814 | { | - | ||||||||||||||||||||||||
| 815 | const QWidget *widget = option->widget; | - | ||||||||||||||||||||||||
| 816 | switch (role) { | - | ||||||||||||||||||||||||
| 817 | case Qt::CheckStateRole: never executed: case Qt::CheckStateRole: | 0 | ||||||||||||||||||||||||
| 818 | if (option->features & QStyleOptionViewItem::HasCheckIndicator)
| 0 | ||||||||||||||||||||||||
| 819 | return QSize(proxyStyle->pixelMetric(QStyle::PM_IndicatorWidth, option, widget), never executed: return QSize(proxyStyle->pixelMetric(QStyle::PM_IndicatorWidth, option, widget), proxyStyle->pixelMetric(QStyle::PM_IndicatorHeight, option, widget)); | 0 | ||||||||||||||||||||||||
| 820 | proxyStyle->pixelMetric(QStyle::PM_IndicatorHeight, option, widget)); never executed: return QSize(proxyStyle->pixelMetric(QStyle::PM_IndicatorWidth, option, widget), proxyStyle->pixelMetric(QStyle::PM_IndicatorHeight, option, widget)); | 0 | ||||||||||||||||||||||||
| 821 | break; never executed: break; | 0 | ||||||||||||||||||||||||
| 822 | case Qt::DisplayRole: never executed: case Qt::DisplayRole: | 0 | ||||||||||||||||||||||||
| 823 | if (option->features & QStyleOptionViewItem::HasDisplay) {
| 0 | ||||||||||||||||||||||||
| 824 | QTextOption textOption; | - | ||||||||||||||||||||||||
| 825 | textOption.setWrapMode(QTextOption::WordWrap); | - | ||||||||||||||||||||||||
| 826 | QTextLayout textLayout(option->text, option->font); | - | ||||||||||||||||||||||||
| 827 | textLayout.setTextOption(textOption); | - | ||||||||||||||||||||||||
| 828 | const bool wrapText = option->features & QStyleOptionViewItem::WrapText; | - | ||||||||||||||||||||||||
| 829 | const int textMargin = proxyStyle->pixelMetric(QStyle::PM_FocusFrameHMargin, option, widget) + 1; | - | ||||||||||||||||||||||||
| 830 | QRect bounds = option->rect; | - | ||||||||||||||||||||||||
| 831 | switch (option->decorationPosition) { | - | ||||||||||||||||||||||||
| 832 | case QStyleOptionViewItem::Left: never executed: case QStyleOptionViewItem::Left: | 0 | ||||||||||||||||||||||||
| 833 | case QStyleOptionViewItem::Right: never executed: case QStyleOptionViewItem::Right: | 0 | ||||||||||||||||||||||||
| 834 | bounds.setWidth(wrapText && bounds.isValid() ? bounds.width() - 2 * textMargin : QFIXED_MAX); | - | ||||||||||||||||||||||||
| 835 | break; never executed: break; | 0 | ||||||||||||||||||||||||
| 836 | case QStyleOptionViewItem::Top: never executed: case QStyleOptionViewItem::Top: | 0 | ||||||||||||||||||||||||
| 837 | case QStyleOptionViewItem::Bottom: never executed: case QStyleOptionViewItem::Bottom: | 0 | ||||||||||||||||||||||||
| 838 | if (wrapText)
| 0 | ||||||||||||||||||||||||
| 839 | bounds.setWidth(bounds.isValid() ? bounds.width() - 2 * textMargin : option->decorationSize.width()); never executed: bounds.setWidth(bounds.isValid() ? bounds.width() - 2 * textMargin : option->decorationSize.width()); | 0 | ||||||||||||||||||||||||
| 840 | else | - | ||||||||||||||||||||||||
| 841 | bounds.setWidth(QFIXED_MAX); never executed: bounds.setWidth((2147483647/256)); | 0 | ||||||||||||||||||||||||
| 842 | break; never executed: break; | 0 | ||||||||||||||||||||||||
| 843 | default: never executed: default: | 0 | ||||||||||||||||||||||||
| 844 | break; never executed: break; | 0 | ||||||||||||||||||||||||
| 845 | } | - | ||||||||||||||||||||||||
| 846 | - | |||||||||||||||||||||||||
| 847 | const int lineWidth = bounds.width(); | - | ||||||||||||||||||||||||
| 848 | const QSizeF size = viewItemTextLayout(textLayout, lineWidth); | - | ||||||||||||||||||||||||
| 849 | return QSize(qCeil(size.width()) + 2 * textMargin, qCeil(size.height())); never executed: return QSize(qCeil(size.width()) + 2 * textMargin, qCeil(size.height())); | 0 | ||||||||||||||||||||||||
| 850 | } | - | ||||||||||||||||||||||||
| 851 | break; never executed: break; | 0 | ||||||||||||||||||||||||
| 852 | case Qt::DecorationRole: never executed: case Qt::DecorationRole: | 0 | ||||||||||||||||||||||||
| 853 | if (option->features & QStyleOptionViewItem::HasDecoration) {
| 0 | ||||||||||||||||||||||||
| 854 | return option->decorationSize; never executed: return option->decorationSize; | 0 | ||||||||||||||||||||||||
| 855 | } | - | ||||||||||||||||||||||||
| 856 | break; never executed: break; | 0 | ||||||||||||||||||||||||
| 857 | default: never executed: default: | 0 | ||||||||||||||||||||||||
| 858 | break; never executed: break; | 0 | ||||||||||||||||||||||||
| 859 | } | - | ||||||||||||||||||||||||
| 860 | - | |||||||||||||||||||||||||
| 861 | return QSize(0, 0); never executed: return QSize(0, 0); | 0 | ||||||||||||||||||||||||
| 862 | } | - | ||||||||||||||||||||||||
| 863 | - | |||||||||||||||||||||||||
| 864 | void QCommonStylePrivate::viewItemDrawText(QPainter *p, const QStyleOptionViewItem *option, const QRect &rect) const | - | ||||||||||||||||||||||||
| 865 | { | - | ||||||||||||||||||||||||
| 866 | const QWidget *widget = option->widget; | - | ||||||||||||||||||||||||
| 867 | const int textMargin = proxyStyle->pixelMetric(QStyle::PM_FocusFrameHMargin, 0, widget) + 1; | - | ||||||||||||||||||||||||
| 868 | - | |||||||||||||||||||||||||
| 869 | QRect textRect = rect.adjusted(textMargin, 0, -textMargin, 0); // remove width padding | - | ||||||||||||||||||||||||
| 870 | const bool wrapText = option->features & QStyleOptionViewItem::WrapText; | - | ||||||||||||||||||||||||
| 871 | QTextOption textOption; | - | ||||||||||||||||||||||||
| 872 | textOption.setWrapMode(wrapText ? QTextOption::WordWrap : QTextOption::ManualWrap); | - | ||||||||||||||||||||||||
| 873 | textOption.setTextDirection(option->direction); | - | ||||||||||||||||||||||||
| 874 | textOption.setAlignment(QStyle::visualAlignment(option->direction, option->displayAlignment)); | - | ||||||||||||||||||||||||
| 875 | QTextLayout textLayout(option->text, option->font); | - | ||||||||||||||||||||||||
| 876 | textLayout.setTextOption(textOption); | - | ||||||||||||||||||||||||
| 877 | - | |||||||||||||||||||||||||
| 878 | viewItemTextLayout(textLayout, textRect.width()); | - | ||||||||||||||||||||||||
| 879 | - | |||||||||||||||||||||||||
| 880 | QString elidedText; | - | ||||||||||||||||||||||||
| 881 | qreal height = 0; | - | ||||||||||||||||||||||||
| 882 | qreal width = 0; | - | ||||||||||||||||||||||||
| 883 | int elidedIndex = -1; | - | ||||||||||||||||||||||||
| 884 | const int lineCount = textLayout.lineCount(); | - | ||||||||||||||||||||||||
| 885 | for (int j = 0; j < lineCount; ++j) {
| 0 | ||||||||||||||||||||||||
| 886 | const QTextLine line = textLayout.lineAt(j); | - | ||||||||||||||||||||||||
| 887 | if (j + 1 <= lineCount - 1) {
| 0 | ||||||||||||||||||||||||
| 888 | const QTextLine nextLine = textLayout.lineAt(j + 1); | - | ||||||||||||||||||||||||
| 889 | if ((nextLine.y() + nextLine.height()) > textRect.height()) {
| 0 | ||||||||||||||||||||||||
| 890 | int start = line.textStart(); | - | ||||||||||||||||||||||||
| 891 | int length = line.textLength() + nextLine.textLength(); | - | ||||||||||||||||||||||||
| 892 | const QStackTextEngine engine(textLayout.text().mid(start, length), option->font); | - | ||||||||||||||||||||||||
| 893 | elidedText = engine.elidedText(option->textElideMode, textRect.width()); | - | ||||||||||||||||||||||||
| 894 | height += line.height(); | - | ||||||||||||||||||||||||
| 895 | width = textRect.width(); | - | ||||||||||||||||||||||||
| 896 | elidedIndex = j; | - | ||||||||||||||||||||||||
| 897 | break; never executed: break; | 0 | ||||||||||||||||||||||||
| 898 | } | - | ||||||||||||||||||||||||
| 899 | } never executed: end of block | 0 | ||||||||||||||||||||||||
| 900 | if (line.naturalTextWidth() > textRect.width()) {
| 0 | ||||||||||||||||||||||||
| 901 | int start = line.textStart(); | - | ||||||||||||||||||||||||
| 902 | int length = line.textLength(); | - | ||||||||||||||||||||||||
| 903 | const QStackTextEngine engine(textLayout.text().mid(start, length), option->font); | - | ||||||||||||||||||||||||
| 904 | elidedText = engine.elidedText(option->textElideMode, textRect.width()); | - | ||||||||||||||||||||||||
| 905 | height += line.height(); | - | ||||||||||||||||||||||||
| 906 | width = textRect.width(); | - | ||||||||||||||||||||||||
| 907 | elidedIndex = j; | - | ||||||||||||||||||||||||
| 908 | break; never executed: break; | 0 | ||||||||||||||||||||||||
| 909 | } | - | ||||||||||||||||||||||||
| 910 | width = qMax<qreal>(width, line.width()); | - | ||||||||||||||||||||||||
| 911 | height += line.height(); | - | ||||||||||||||||||||||||
| 912 | } never executed: end of block | 0 | ||||||||||||||||||||||||
| 913 | - | |||||||||||||||||||||||||
| 914 | const QRect layoutRect = QStyle::alignedRect(option->direction, option->displayAlignment, | - | ||||||||||||||||||||||||
| 915 | QSize(int(width), int(height)), textRect); | - | ||||||||||||||||||||||||
| 916 | const QPointF position = layoutRect.topLeft(); | - | ||||||||||||||||||||||||
| 917 | for (int i = 0; i < lineCount; ++i) {
| 0 | ||||||||||||||||||||||||
| 918 | const QTextLine line = textLayout.lineAt(i); | - | ||||||||||||||||||||||||
| 919 | if (i == elidedIndex) {
| 0 | ||||||||||||||||||||||||
| 920 | qreal x = position.x() + line.x(); | - | ||||||||||||||||||||||||
| 921 | qreal y = position.y() + line.y() + line.ascent(); | - | ||||||||||||||||||||||||
| 922 | p->save(); | - | ||||||||||||||||||||||||
| 923 | p->setFont(option->font); | - | ||||||||||||||||||||||||
| 924 | p->drawText(QPointF(x, y), elidedText); | - | ||||||||||||||||||||||||
| 925 | p->restore(); | - | ||||||||||||||||||||||||
| 926 | break; never executed: break; | 0 | ||||||||||||||||||||||||
| 927 | } | - | ||||||||||||||||||||||||
| 928 | line.draw(p, position); | - | ||||||||||||||||||||||||
| 929 | } never executed: end of block | 0 | ||||||||||||||||||||||||
| 930 | } never executed: end of block | 0 | ||||||||||||||||||||||||
| 931 | - | |||||||||||||||||||||||||
| 932 | /*! \internal | - | ||||||||||||||||||||||||
| 933 | compute the position for the different component of an item (pixmap, text, checkbox) | - | ||||||||||||||||||||||||
| 934 | - | |||||||||||||||||||||||||
| 935 | Set sizehint to false to layout the elements inside opt->rect. Set sizehint to true to ignore | - | ||||||||||||||||||||||||
| 936 | opt->rect and return rectangles in infinite space | - | ||||||||||||||||||||||||
| 937 | - | |||||||||||||||||||||||||
| 938 | Code duplicated in QItemDelegate::doLayout | - | ||||||||||||||||||||||||
| 939 | */ | - | ||||||||||||||||||||||||
| 940 | void QCommonStylePrivate::viewItemLayout(const QStyleOptionViewItem *opt, QRect *checkRect, | - | ||||||||||||||||||||||||
| 941 | QRect *pixmapRect, QRect *textRect, bool sizehint) const | - | ||||||||||||||||||||||||
| 942 | { | - | ||||||||||||||||||||||||
| 943 | Q_ASSERT(checkRect && pixmapRect && textRect); | - | ||||||||||||||||||||||||
| 944 | *pixmapRect = QRect(QPoint(0, 0), viewItemSize(opt, Qt::DecorationRole)); | - | ||||||||||||||||||||||||
| 945 | *textRect = QRect(QPoint(0, 0), viewItemSize(opt, Qt::DisplayRole)); | - | ||||||||||||||||||||||||
| 946 | *checkRect = QRect(QPoint(0, 0), viewItemSize(opt, Qt::CheckStateRole)); | - | ||||||||||||||||||||||||
| 947 | - | |||||||||||||||||||||||||
| 948 | const QWidget *widget = opt->widget; | - | ||||||||||||||||||||||||
| 949 | const bool hasCheck = checkRect->isValid(); | - | ||||||||||||||||||||||||
| 950 | const bool hasPixmap = pixmapRect->isValid(); | - | ||||||||||||||||||||||||
| 951 | const bool hasText = textRect->isValid(); | - | ||||||||||||||||||||||||
| 952 | const int textMargin = hasText ? proxyStyle->pixelMetric(QStyle::PM_FocusFrameHMargin, opt, widget) + 1 : 0;
| 0 | ||||||||||||||||||||||||
| 953 | const int pixmapMargin = hasPixmap ? proxyStyle->pixelMetric(QStyle::PM_FocusFrameHMargin, opt, widget) + 1 : 0;
| 0 | ||||||||||||||||||||||||
| 954 | const int checkMargin = hasCheck ? proxyStyle->pixelMetric(QStyle::PM_FocusFrameHMargin, opt, widget) + 1 : 0;
| 0 | ||||||||||||||||||||||||
| 955 | int x = opt->rect.left(); | - | ||||||||||||||||||||||||
| 956 | int y = opt->rect.top(); | - | ||||||||||||||||||||||||
| 957 | int w, h; | - | ||||||||||||||||||||||||
| 958 | - | |||||||||||||||||||||||||
| 959 | if (textRect->height() == 0 && (!hasPixmap || !sizehint)) {
| 0 | ||||||||||||||||||||||||
| 960 | //if there is no text, we still want to have a decent height for the item sizeHint and the editor size | - | ||||||||||||||||||||||||
| 961 | textRect->setHeight(opt->fontMetrics.height()); | - | ||||||||||||||||||||||||
| 962 | } never executed: end of block | 0 | ||||||||||||||||||||||||
| 963 | - | |||||||||||||||||||||||||
| 964 | QSize pm(0, 0); | - | ||||||||||||||||||||||||
| 965 | if (hasPixmap) {
| 0 | ||||||||||||||||||||||||
| 966 | pm = pixmapRect->size(); | - | ||||||||||||||||||||||||
| 967 | pm.rwidth() += 2 * pixmapMargin; | - | ||||||||||||||||||||||||
| 968 | } never executed: end of block | 0 | ||||||||||||||||||||||||
| 969 | if (sizehint) {
| 0 | ||||||||||||||||||||||||
| 970 | h = qMax(checkRect->height(), qMax(textRect->height(), pm.height())); | - | ||||||||||||||||||||||||
| 971 | if (opt->decorationPosition == QStyleOptionViewItem::Left
| 0 | ||||||||||||||||||||||||
| 972 | || opt->decorationPosition == QStyleOptionViewItem::Right) {
| 0 | ||||||||||||||||||||||||
| 973 | w = textRect->width() + pm.width(); | - | ||||||||||||||||||||||||
| 974 | } else { never executed: end of block | 0 | ||||||||||||||||||||||||
| 975 | w = qMax(textRect->width(), pm.width()); | - | ||||||||||||||||||||||||
| 976 | } never executed: end of block | 0 | ||||||||||||||||||||||||
| 977 | } else { | - | ||||||||||||||||||||||||
| 978 | w = opt->rect.width(); | - | ||||||||||||||||||||||||
| 979 | h = opt->rect.height(); | - | ||||||||||||||||||||||||
| 980 | } never executed: end of block | 0 | ||||||||||||||||||||||||
| 981 | - | |||||||||||||||||||||||||
| 982 | int cw = 0; | - | ||||||||||||||||||||||||
| 983 | QRect check; | - | ||||||||||||||||||||||||
| 984 | if (hasCheck) {
| 0 | ||||||||||||||||||||||||
| 985 | cw = checkRect->width() + 2 * checkMargin; | - | ||||||||||||||||||||||||
| 986 | if (sizehint) w += cw; never executed: w += cw;
| 0 | ||||||||||||||||||||||||
| 987 | if (opt->direction == Qt::RightToLeft) {
| 0 | ||||||||||||||||||||||||
| 988 | check.setRect(x + w - cw, y, cw, h); | - | ||||||||||||||||||||||||
| 989 | } else { never executed: end of block | 0 | ||||||||||||||||||||||||
| 990 | check.setRect(x, y, cw, h); | - | ||||||||||||||||||||||||
| 991 | } never executed: end of block | 0 | ||||||||||||||||||||||||
| 992 | } | - | ||||||||||||||||||||||||
| 993 | - | |||||||||||||||||||||||||
| 994 | QRect display; | - | ||||||||||||||||||||||||
| 995 | QRect decoration; | - | ||||||||||||||||||||||||
| 996 | switch (opt->decorationPosition) { | - | ||||||||||||||||||||||||
| 997 | case QStyleOptionViewItem::Top: { never executed: case QStyleOptionViewItem::Top: | 0 | ||||||||||||||||||||||||
| 998 | if (hasPixmap)
| 0 | ||||||||||||||||||||||||
| 999 | pm.setHeight(pm.height() + pixmapMargin); // add space never executed: pm.setHeight(pm.height() + pixmapMargin); | 0 | ||||||||||||||||||||||||
| 1000 | h = sizehint ? textRect->height() : h - pm.height();
| 0 | ||||||||||||||||||||||||
| 1001 | - | |||||||||||||||||||||||||
| 1002 | if (opt->direction == Qt::RightToLeft) {
| 0 | ||||||||||||||||||||||||
| 1003 | decoration.setRect(x, y, w - cw, pm.height()); | - | ||||||||||||||||||||||||
| 1004 | display.setRect(x, y + pm.height(), w - cw, h); | - | ||||||||||||||||||||||||
| 1005 | } else { never executed: end of block | 0 | ||||||||||||||||||||||||
| 1006 | decoration.setRect(x + cw, y, w - cw, pm.height()); | - | ||||||||||||||||||||||||
| 1007 | display.setRect(x + cw, y + pm.height(), w - cw, h); | - | ||||||||||||||||||||||||
| 1008 | } never executed: end of block | 0 | ||||||||||||||||||||||||
| 1009 | break; } never executed: break; | 0 | ||||||||||||||||||||||||
| 1010 | case QStyleOptionViewItem::Bottom: { never executed: case QStyleOptionViewItem::Bottom: | 0 | ||||||||||||||||||||||||
| 1011 | if (hasText)
| 0 | ||||||||||||||||||||||||
| 1012 | textRect->setHeight(textRect->height() + textMargin); // add space never executed: textRect->setHeight(textRect->height() + textMargin); | 0 | ||||||||||||||||||||||||
| 1013 | h = sizehint ? textRect->height() + pm.height() : h;
| 0 | ||||||||||||||||||||||||
| 1014 | - | |||||||||||||||||||||||||
| 1015 | if (opt->direction == Qt::RightToLeft) {
| 0 | ||||||||||||||||||||||||
| 1016 | display.setRect(x, y, w - cw, textRect->height()); | - | ||||||||||||||||||||||||
| 1017 | decoration.setRect(x, y + textRect->height(), w - cw, h - textRect->height()); | - | ||||||||||||||||||||||||
| 1018 | } else { never executed: end of block | 0 | ||||||||||||||||||||||||
| 1019 | display.setRect(x + cw, y, w - cw, textRect->height()); | - | ||||||||||||||||||||||||
| 1020 | decoration.setRect(x + cw, y + textRect->height(), w - cw, h - textRect->height()); | - | ||||||||||||||||||||||||
| 1021 | } never executed: end of block | 0 | ||||||||||||||||||||||||
| 1022 | break; } never executed: break; | 0 | ||||||||||||||||||||||||
| 1023 | case QStyleOptionViewItem::Left: { never executed: case QStyleOptionViewItem::Left: | 0 | ||||||||||||||||||||||||
| 1024 | if (opt->direction == Qt::LeftToRight) {
| 0 | ||||||||||||||||||||||||
| 1025 | decoration.setRect(x + cw, y, pm.width(), h); | - | ||||||||||||||||||||||||
| 1026 | display.setRect(decoration.right() + 1, y, w - pm.width() - cw, h); | - | ||||||||||||||||||||||||
| 1027 | } else { never executed: end of block | 0 | ||||||||||||||||||||||||
| 1028 | display.setRect(x, y, w - pm.width() - cw, h); | - | ||||||||||||||||||||||||
| 1029 | decoration.setRect(display.right() + 1, y, pm.width(), h); | - | ||||||||||||||||||||||||
| 1030 | } never executed: end of block | 0 | ||||||||||||||||||||||||
| 1031 | break; } never executed: break; | 0 | ||||||||||||||||||||||||
| 1032 | case QStyleOptionViewItem::Right: { never executed: case QStyleOptionViewItem::Right: | 0 | ||||||||||||||||||||||||
| 1033 | if (opt->direction == Qt::LeftToRight) {
| 0 | ||||||||||||||||||||||||
| 1034 | display.setRect(x + cw, y, w - pm.width() - cw, h); | - | ||||||||||||||||||||||||
| 1035 | decoration.setRect(display.right() + 1, y, pm.width(), h); | - | ||||||||||||||||||||||||
| 1036 | } else { never executed: end of block | 0 | ||||||||||||||||||||||||
| 1037 | decoration.setRect(x, y, pm.width(), h); | - | ||||||||||||||||||||||||
| 1038 | display.setRect(decoration.right() + 1, y, w - pm.width() - cw, h); | - | ||||||||||||||||||||||||
| 1039 | } never executed: end of block | 0 | ||||||||||||||||||||||||
| 1040 | break; } never executed: break; | 0 | ||||||||||||||||||||||||
| 1041 | default: never executed: default: | 0 | ||||||||||||||||||||||||
| 1042 | qWarning("doLayout: decoration position is invalid"); | - | ||||||||||||||||||||||||
| 1043 | decoration = *pixmapRect; | - | ||||||||||||||||||||||||
| 1044 | break; never executed: break; | 0 | ||||||||||||||||||||||||
| 1045 | } | - | ||||||||||||||||||||||||
| 1046 | - | |||||||||||||||||||||||||
| 1047 | if (!sizehint) { // we only need to do the internal layout if we are going to paint
| 0 | ||||||||||||||||||||||||
| 1048 | *checkRect = QStyle::alignedRect(opt->direction, Qt::AlignCenter, | - | ||||||||||||||||||||||||
| 1049 | checkRect->size(), check); | - | ||||||||||||||||||||||||
| 1050 | *pixmapRect = QStyle::alignedRect(opt->direction, opt->decorationAlignment, | - | ||||||||||||||||||||||||
| 1051 | pixmapRect->size(), decoration); | - | ||||||||||||||||||||||||
| 1052 | // the text takes up all available space, unless the decoration is not shown as selected | - | ||||||||||||||||||||||||
| 1053 | if (opt->showDecorationSelected)
| 0 | ||||||||||||||||||||||||
| 1054 | *textRect = display; never executed: *textRect = display; | 0 | ||||||||||||||||||||||||
| 1055 | else | - | ||||||||||||||||||||||||
| 1056 | *textRect = QStyle::alignedRect(opt->direction, opt->displayAlignment, never executed: *textRect = QStyle::alignedRect(opt->direction, opt->displayAlignment, textRect->size().boundedTo(display.size()), display); | 0 | ||||||||||||||||||||||||
| 1057 | textRect->size().boundedTo(display.size()), display); never executed: *textRect = QStyle::alignedRect(opt->direction, opt->displayAlignment, textRect->size().boundedTo(display.size()), display); | 0 | ||||||||||||||||||||||||
| 1058 | } else { | - | ||||||||||||||||||||||||
| 1059 | *checkRect = check; | - | ||||||||||||||||||||||||
| 1060 | *pixmapRect = decoration; | - | ||||||||||||||||||||||||
| 1061 | *textRect = display; | - | ||||||||||||||||||||||||
| 1062 | } never executed: end of block | 0 | ||||||||||||||||||||||||
| 1063 | } | - | ||||||||||||||||||||||||
| 1064 | #endif // QT_NO_ITEMVIEWS | - | ||||||||||||||||||||||||
| 1065 | - | |||||||||||||||||||||||||
| 1066 | - | |||||||||||||||||||||||||
| 1067 | #ifndef QT_NO_TABBAR | - | ||||||||||||||||||||||||
| 1068 | /*! \internal | - | ||||||||||||||||||||||||
| 1069 | Compute the textRect and the pixmapRect from the opt rect | - | ||||||||||||||||||||||||
| 1070 | - | |||||||||||||||||||||||||
| 1071 | Uses the same computation than in QTabBar::tabSizeHint | - | ||||||||||||||||||||||||
| 1072 | */ | - | ||||||||||||||||||||||||
| 1073 | void QCommonStylePrivate::tabLayout(const QStyleOptionTab *opt, const QWidget *widget, QRect *textRect, QRect *iconRect) const | - | ||||||||||||||||||||||||
| 1074 | { | - | ||||||||||||||||||||||||
| 1075 | Q_ASSERT(textRect); | - | ||||||||||||||||||||||||
| 1076 | Q_ASSERT(iconRect); | - | ||||||||||||||||||||||||
| 1077 | QRect tr = opt->rect; | - | ||||||||||||||||||||||||
| 1078 | bool verticalTabs = opt->shape == QTabBar::RoundedEast
| 0 | ||||||||||||||||||||||||
| 1079 | || opt->shape == QTabBar::RoundedWest
| 0 | ||||||||||||||||||||||||
| 1080 | || opt->shape == QTabBar::TriangularEast
| 0 | ||||||||||||||||||||||||
| 1081 | || opt->shape == QTabBar::TriangularWest;
| 0 | ||||||||||||||||||||||||
| 1082 | if (verticalTabs)
| 0 | ||||||||||||||||||||||||
| 1083 | tr.setRect(0, 0, tr.height(), tr.width()); //0, 0 as we will have a translate transform never executed: tr.setRect(0, 0, tr.height(), tr.width()); | 0 | ||||||||||||||||||||||||
| 1084 | - | |||||||||||||||||||||||||
| 1085 | int verticalShift = proxyStyle->pixelMetric(QStyle::PM_TabBarTabShiftVertical, opt, widget); | - | ||||||||||||||||||||||||
| 1086 | int horizontalShift = proxyStyle->pixelMetric(QStyle::PM_TabBarTabShiftHorizontal, opt, widget); | - | ||||||||||||||||||||||||
| 1087 | int hpadding = proxyStyle->pixelMetric(QStyle::PM_TabBarTabHSpace, opt, widget) / 2; | - | ||||||||||||||||||||||||
| 1088 | int vpadding = proxyStyle->pixelMetric(QStyle::PM_TabBarTabVSpace, opt, widget) / 2; | - | ||||||||||||||||||||||||
| 1089 | if (opt->shape == QTabBar::RoundedSouth || opt->shape == QTabBar::TriangularSouth)
| 0 | ||||||||||||||||||||||||
| 1090 | verticalShift = -verticalShift; never executed: verticalShift = -verticalShift; | 0 | ||||||||||||||||||||||||
| 1091 | tr.adjust(hpadding, verticalShift - vpadding, horizontalShift - hpadding, vpadding); | - | ||||||||||||||||||||||||
| 1092 | bool selected = opt->state & QStyle::State_Selected; | - | ||||||||||||||||||||||||
| 1093 | if (selected) {
| 0 | ||||||||||||||||||||||||
| 1094 | tr.setTop(tr.top() - verticalShift); | - | ||||||||||||||||||||||||
| 1095 | tr.setRight(tr.right() - horizontalShift); | - | ||||||||||||||||||||||||
| 1096 | } never executed: end of block | 0 | ||||||||||||||||||||||||
| 1097 | - | |||||||||||||||||||||||||
| 1098 | // left widget | - | ||||||||||||||||||||||||
| 1099 | if (!opt->leftButtonSize.isEmpty()) {
| 0 | ||||||||||||||||||||||||
| 1100 | tr.setLeft(tr.left() + 4 + | - | ||||||||||||||||||||||||
| 1101 | (verticalTabs ? opt->leftButtonSize.height() : opt->leftButtonSize.width())); | - | ||||||||||||||||||||||||
| 1102 | } never executed: end of block | 0 | ||||||||||||||||||||||||
| 1103 | // right widget | - | ||||||||||||||||||||||||
| 1104 | if (!opt->rightButtonSize.isEmpty()) {
| 0 | ||||||||||||||||||||||||
| 1105 | tr.setRight(tr.right() - 4 - | - | ||||||||||||||||||||||||
| 1106 | (verticalTabs ? opt->rightButtonSize.height() : opt->rightButtonSize.width())); | - | ||||||||||||||||||||||||
| 1107 | } never executed: end of block | 0 | ||||||||||||||||||||||||
| 1108 | - | |||||||||||||||||||||||||
| 1109 | // icon | - | ||||||||||||||||||||||||
| 1110 | if (!opt->icon.isNull()) {
| 0 | ||||||||||||||||||||||||
| 1111 | QSize iconSize = opt->iconSize; | - | ||||||||||||||||||||||||
| 1112 | if (!iconSize.isValid()) {
| 0 | ||||||||||||||||||||||||
| 1113 | int iconExtent = proxyStyle->pixelMetric(QStyle::PM_SmallIconSize); | - | ||||||||||||||||||||||||
| 1114 | iconSize = QSize(iconExtent, iconExtent); | - | ||||||||||||||||||||||||
| 1115 | } never executed: end of block | 0 | ||||||||||||||||||||||||
| 1116 | QSize tabIconSize = opt->icon.actualSize(iconSize, | - | ||||||||||||||||||||||||
| 1117 | (opt->state & QStyle::State_Enabled) ? QIcon::Normal : QIcon::Disabled, | - | ||||||||||||||||||||||||
| 1118 | (opt->state & QStyle::State_Selected) ? QIcon::On : QIcon::Off ); | - | ||||||||||||||||||||||||
| 1119 | // High-dpi icons do not need adjustmet; make sure tabIconSize is not larger than iconSize | - | ||||||||||||||||||||||||
| 1120 | tabIconSize = QSize(qMin(tabIconSize.width(), iconSize.width()), qMin(tabIconSize.height(), iconSize.height())); | - | ||||||||||||||||||||||||
| 1121 | - | |||||||||||||||||||||||||
| 1122 | *iconRect = QRect(tr.left(), tr.center().y() - tabIconSize.height() / 2, | - | ||||||||||||||||||||||||
| 1123 | tabIconSize.width(), tabIconSize .height()); | - | ||||||||||||||||||||||||
| 1124 | if (!verticalTabs)
| 0 | ||||||||||||||||||||||||
| 1125 | *iconRect = proxyStyle->visualRect(opt->direction, opt->rect, *iconRect); never executed: *iconRect = proxyStyle->visualRect(opt->direction, opt->rect, *iconRect); | 0 | ||||||||||||||||||||||||
| 1126 | tr.setLeft(tr.left() + tabIconSize.width() + 4); | - | ||||||||||||||||||||||||
| 1127 | } never executed: end of block | 0 | ||||||||||||||||||||||||
| 1128 | - | |||||||||||||||||||||||||
| 1129 | if (!verticalTabs)
| 0 | ||||||||||||||||||||||||
| 1130 | tr = proxyStyle->visualRect(opt->direction, opt->rect, tr); never executed: tr = proxyStyle->visualRect(opt->direction, opt->rect, tr); | 0 | ||||||||||||||||||||||||
| 1131 | - | |||||||||||||||||||||||||
| 1132 | *textRect = tr; | - | ||||||||||||||||||||||||
| 1133 | } never executed: end of block | 0 | ||||||||||||||||||||||||
| 1134 | #endif //QT_NO_TABBAR | - | ||||||||||||||||||||||||
| 1135 | - | |||||||||||||||||||||||||
| 1136 | #ifndef QT_NO_ANIMATION | - | ||||||||||||||||||||||||
| 1137 | /*! \internal */ | - | ||||||||||||||||||||||||
| 1138 | QList<const QObject*> QCommonStylePrivate::animationTargets() const | - | ||||||||||||||||||||||||
| 1139 | { | - | ||||||||||||||||||||||||
| 1140 | return animations.keys(); never executed: return animations.keys(); | 0 | ||||||||||||||||||||||||
| 1141 | } | - | ||||||||||||||||||||||||
| 1142 | - | |||||||||||||||||||||||||
| 1143 | /*! \internal */ | - | ||||||||||||||||||||||||
| 1144 | QStyleAnimation * QCommonStylePrivate::animation(const QObject *target) const | - | ||||||||||||||||||||||||
| 1145 | { | - | ||||||||||||||||||||||||
| 1146 | return animations.value(target); never executed: return animations.value(target); | 0 | ||||||||||||||||||||||||
| 1147 | } | - | ||||||||||||||||||||||||
| 1148 | - | |||||||||||||||||||||||||
| 1149 | /*! \internal */ | - | ||||||||||||||||||||||||
| 1150 | void QCommonStylePrivate::startAnimation(QStyleAnimation *animation) const | - | ||||||||||||||||||||||||
| 1151 | { | - | ||||||||||||||||||||||||
| 1152 | Q_Q(const QCommonStyle); | - | ||||||||||||||||||||||||
| 1153 | stopAnimation(animation->target()); | - | ||||||||||||||||||||||||
| 1154 | q->connect(animation, SIGNAL(destroyed()), SLOT(_q_removeAnimation()), Qt::UniqueConnection); | - | ||||||||||||||||||||||||
| 1155 | animations.insert(animation->target(), animation); | - | ||||||||||||||||||||||||
| 1156 | animation->start(); | - | ||||||||||||||||||||||||
| 1157 | } never executed: end of block | 0 | ||||||||||||||||||||||||
| 1158 | - | |||||||||||||||||||||||||
| 1159 | /*! \internal */ | - | ||||||||||||||||||||||||
| 1160 | void QCommonStylePrivate::stopAnimation(const QObject *target) const | - | ||||||||||||||||||||||||
| 1161 | { | - | ||||||||||||||||||||||||
| 1162 | QStyleAnimation *animation = animations.take(target); | - | ||||||||||||||||||||||||
| 1163 | if (animation) {
| 0 | ||||||||||||||||||||||||
| 1164 | animation->stop(); | - | ||||||||||||||||||||||||
| 1165 | delete animation; | - | ||||||||||||||||||||||||
| 1166 | } never executed: end of block | 0 | ||||||||||||||||||||||||
| 1167 | } never executed: end of block | 0 | ||||||||||||||||||||||||
| 1168 | - | |||||||||||||||||||||||||
| 1169 | /*! \internal */ | - | ||||||||||||||||||||||||
| 1170 | void QCommonStylePrivate::_q_removeAnimation() | - | ||||||||||||||||||||||||
| 1171 | { | - | ||||||||||||||||||||||||
| 1172 | Q_Q(QCommonStyle); | - | ||||||||||||||||||||||||
| 1173 | QObject *animation = q->sender(); | - | ||||||||||||||||||||||||
| 1174 | if (animation)
| 0 | ||||||||||||||||||||||||
| 1175 | animations.remove(animation->parent()); never executed: animations.remove(animation->parent()); | 0 | ||||||||||||||||||||||||
| 1176 | } never executed: end of block | 0 | ||||||||||||||||||||||||
| 1177 | #endif | - | ||||||||||||||||||||||||
| 1178 | - | |||||||||||||||||||||||||
| 1179 | /*! | - | ||||||||||||||||||||||||
| 1180 | \reimp | - | ||||||||||||||||||||||||
| 1181 | */ | - | ||||||||||||||||||||||||
| 1182 | void QCommonStyle::drawControl(ControlElement element, const QStyleOption *opt, | - | ||||||||||||||||||||||||
| 1183 | QPainter *p, const QWidget *widget) const | - | ||||||||||||||||||||||||
| 1184 | { | - | ||||||||||||||||||||||||
| 1185 | Q_D(const QCommonStyle); | - | ||||||||||||||||||||||||
| 1186 | switch (element) { | - | ||||||||||||||||||||||||
| 1187 | - | |||||||||||||||||||||||||
| 1188 | case CE_PushButton: never executed: case CE_PushButton: | 0 | ||||||||||||||||||||||||
| 1189 | if (const QStyleOptionButton *btn = qstyleoption_cast<const QStyleOptionButton *>(opt)) {
| 0 | ||||||||||||||||||||||||
| 1190 | proxy()->drawControl(CE_PushButtonBevel, btn, p, widget); | - | ||||||||||||||||||||||||
| 1191 | QStyleOptionButton subopt = *btn; | - | ||||||||||||||||||||||||
| 1192 | subopt.rect = subElementRect(SE_PushButtonContents, btn, widget); | - | ||||||||||||||||||||||||
| 1193 | proxy()->drawControl(CE_PushButtonLabel, &subopt, p, widget); | - | ||||||||||||||||||||||||
| 1194 | if (btn->state & State_HasFocus) {
| 0 | ||||||||||||||||||||||||
| 1195 | QStyleOptionFocusRect fropt; | - | ||||||||||||||||||||||||
| 1196 | fropt.QStyleOption::operator=(*btn); | - | ||||||||||||||||||||||||
| 1197 | fropt.rect = subElementRect(SE_PushButtonFocusRect, btn, widget); | - | ||||||||||||||||||||||||
| 1198 | proxy()->drawPrimitive(PE_FrameFocusRect, &fropt, p, widget); | - | ||||||||||||||||||||||||
| 1199 | } never executed: end of block | 0 | ||||||||||||||||||||||||
| 1200 | } never executed: end of block | 0 | ||||||||||||||||||||||||
| 1201 | break; never executed: break; | 0 | ||||||||||||||||||||||||
| 1202 | case CE_PushButtonBevel: never executed: case CE_PushButtonBevel: | 0 | ||||||||||||||||||||||||
| 1203 | if (const QStyleOptionButton *btn = qstyleoption_cast<const QStyleOptionButton *>(opt)) {
| 0 | ||||||||||||||||||||||||
| 1204 | QRect br = btn->rect; | - | ||||||||||||||||||||||||
| 1205 | int dbi = proxy()->pixelMetric(PM_ButtonDefaultIndicator, btn, widget); | - | ||||||||||||||||||||||||
| 1206 | if (btn->features & QStyleOptionButton::DefaultButton)
| 0 | ||||||||||||||||||||||||
| 1207 | proxy()->drawPrimitive(PE_FrameDefaultButton, opt, p, widget); never executed: proxy()->drawPrimitive(PE_FrameDefaultButton, opt, p, widget); | 0 | ||||||||||||||||||||||||
| 1208 | if (btn->features & QStyleOptionButton::AutoDefaultButton)
| 0 | ||||||||||||||||||||||||
| 1209 | br.setCoords(br.left() + dbi, br.top() + dbi, br.right() - dbi, br.bottom() - dbi); never executed: br.setCoords(br.left() + dbi, br.top() + dbi, br.right() - dbi, br.bottom() - dbi); | 0 | ||||||||||||||||||||||||
| 1210 | if (!(btn->features & (QStyleOptionButton::Flat | QStyleOptionButton::CommandLinkButton))
| 0 | ||||||||||||||||||||||||
| 1211 | || btn->state & (State_Sunken | State_On)
| 0 | ||||||||||||||||||||||||
| 1212 | || (btn->features & QStyleOptionButton::CommandLinkButton && btn->state & State_MouseOver)) {
| 0 | ||||||||||||||||||||||||
| 1213 | QStyleOptionButton tmpBtn = *btn; | - | ||||||||||||||||||||||||
| 1214 | tmpBtn.rect = br; | - | ||||||||||||||||||||||||
| 1215 | proxy()->drawPrimitive(PE_PanelButtonCommand, &tmpBtn, p, widget); | - | ||||||||||||||||||||||||
| 1216 | } never executed: end of block | 0 | ||||||||||||||||||||||||
| 1217 | if (btn->features & QStyleOptionButton::HasMenu) {
| 0 | ||||||||||||||||||||||||
| 1218 | int mbi = proxy()->pixelMetric(PM_MenuButtonIndicator, btn, widget); | - | ||||||||||||||||||||||||
| 1219 | QRect ir = btn->rect; | - | ||||||||||||||||||||||||
| 1220 | QStyleOptionButton newBtn = *btn; | - | ||||||||||||||||||||||||
| 1221 | newBtn.rect = QRect(ir.right() - mbi + 2, ir.height()/2 - mbi/2 + 3, mbi - 6, mbi - 6); | - | ||||||||||||||||||||||||
| 1222 | proxy()->drawPrimitive(PE_IndicatorArrowDown, &newBtn, p, widget); | - | ||||||||||||||||||||||||
| 1223 | } never executed: end of block | 0 | ||||||||||||||||||||||||
| 1224 | } never executed: end of block | 0 | ||||||||||||||||||||||||
| 1225 | break; never executed: break; | 0 | ||||||||||||||||||||||||
| 1226 | case CE_PushButtonLabel: never executed: case CE_PushButtonLabel: | 0 | ||||||||||||||||||||||||
| 1227 | if (const QStyleOptionButton *button = qstyleoption_cast<const QStyleOptionButton *>(opt)) {
| 0 | ||||||||||||||||||||||||
| 1228 | QRect textRect = button->rect; | - | ||||||||||||||||||||||||
| 1229 | uint tf = Qt::AlignVCenter | Qt::TextShowMnemonic; | - | ||||||||||||||||||||||||
| 1230 | if (!proxy()->styleHint(SH_UnderlineShortcut, button, widget))
| 0 | ||||||||||||||||||||||||
| 1231 | tf |= Qt::TextHideMnemonic; never executed: tf |= Qt::TextHideMnemonic; | 0 | ||||||||||||||||||||||||
| 1232 | - | |||||||||||||||||||||||||
| 1233 | if (!button->icon.isNull()) {
| 0 | ||||||||||||||||||||||||
| 1234 | //Center both icon and text | - | ||||||||||||||||||||||||
| 1235 | QRect iconRect; | - | ||||||||||||||||||||||||
| 1236 | QIcon::Mode mode = button->state & State_Enabled ? QIcon::Normal : QIcon::Disabled;
| 0 | ||||||||||||||||||||||||
| 1237 | if (mode == QIcon::Normal && button->state & State_HasFocus)
| 0 | ||||||||||||||||||||||||
| 1238 | mode = QIcon::Active; never executed: mode = QIcon::Active; | 0 | ||||||||||||||||||||||||
| 1239 | QIcon::State state = QIcon::Off; | - | ||||||||||||||||||||||||
| 1240 | if (button->state & State_On)
| 0 | ||||||||||||||||||||||||
| 1241 | state = QIcon::On; never executed: state = QIcon::On; | 0 | ||||||||||||||||||||||||
| 1242 | - | |||||||||||||||||||||||||
| 1243 | QPixmap pixmap = button->icon.pixmap(qt_getWindow(widget), button->iconSize, mode, state); | - | ||||||||||||||||||||||||
| 1244 | - | |||||||||||||||||||||||||
| 1245 | int pixmapWidth = pixmap.width() / pixmap.devicePixelRatio(); | - | ||||||||||||||||||||||||
| 1246 | int pixmapHeight = pixmap.height() / pixmap.devicePixelRatio(); | - | ||||||||||||||||||||||||
| 1247 | int labelWidth = pixmapWidth; | - | ||||||||||||||||||||||||
| 1248 | int labelHeight = pixmapHeight; | - | ||||||||||||||||||||||||
| 1249 | int iconSpacing = 4;//### 4 is currently hardcoded in QPushButton::sizeHint() | - | ||||||||||||||||||||||||
| 1250 | int textWidth = button->fontMetrics.boundingRect(opt->rect, tf, button->text).width(); | - | ||||||||||||||||||||||||
| 1251 | if (!button->text.isEmpty())
| 0 | ||||||||||||||||||||||||
| 1252 | labelWidth += (textWidth + iconSpacing); never executed: labelWidth += (textWidth + iconSpacing); | 0 | ||||||||||||||||||||||||
| 1253 | - | |||||||||||||||||||||||||
| 1254 | iconRect = QRect(textRect.x() + (textRect.width() - labelWidth) / 2, | - | ||||||||||||||||||||||||
| 1255 | textRect.y() + (textRect.height() - labelHeight) / 2, | - | ||||||||||||||||||||||||
| 1256 | pixmapWidth, pixmapHeight); | - | ||||||||||||||||||||||||
| 1257 | - | |||||||||||||||||||||||||
| 1258 | iconRect = visualRect(button->direction, textRect, iconRect); | - | ||||||||||||||||||||||||
| 1259 | - | |||||||||||||||||||||||||
| 1260 | tf |= Qt::AlignLeft; //left align, we adjust the text-rect instead | - | ||||||||||||||||||||||||
| 1261 | - | |||||||||||||||||||||||||
| 1262 | if (button->direction == Qt::RightToLeft)
| 0 | ||||||||||||||||||||||||
| 1263 | textRect.setRight(iconRect.left() - iconSpacing); never executed: textRect.setRight(iconRect.left() - iconSpacing); | 0 | ||||||||||||||||||||||||
| 1264 | else | - | ||||||||||||||||||||||||
| 1265 | textRect.setLeft(iconRect.left() + iconRect.width() + iconSpacing); never executed: textRect.setLeft(iconRect.left() + iconRect.width() + iconSpacing); | 0 | ||||||||||||||||||||||||
| 1266 | - | |||||||||||||||||||||||||
| 1267 | if (button->state & (State_On | State_Sunken))
| 0 | ||||||||||||||||||||||||
| 1268 | iconRect.translate(proxy()->pixelMetric(PM_ButtonShiftHorizontal, opt, widget), never executed: iconRect.translate(proxy()->pixelMetric(PM_ButtonShiftHorizontal, opt, widget), proxy()->pixelMetric(PM_ButtonShiftVertical, opt, widget)); | 0 | ||||||||||||||||||||||||
| 1269 | proxy()->pixelMetric(PM_ButtonShiftVertical, opt, widget)); never executed: iconRect.translate(proxy()->pixelMetric(PM_ButtonShiftHorizontal, opt, widget), proxy()->pixelMetric(PM_ButtonShiftVertical, opt, widget)); | 0 | ||||||||||||||||||||||||
| 1270 | p->drawPixmap(iconRect, pixmap); | - | ||||||||||||||||||||||||
| 1271 | } else { never executed: end of block | 0 | ||||||||||||||||||||||||
| 1272 | tf |= Qt::AlignHCenter; | - | ||||||||||||||||||||||||
| 1273 | } never executed: end of block | 0 | ||||||||||||||||||||||||
| 1274 | if (button->state & (State_On | State_Sunken))
| 0 | ||||||||||||||||||||||||
| 1275 | textRect.translate(proxy()->pixelMetric(PM_ButtonShiftHorizontal, opt, widget), never executed: textRect.translate(proxy()->pixelMetric(PM_ButtonShiftHorizontal, opt, widget), proxy()->pixelMetric(PM_ButtonShiftVertical, opt, widget)); | 0 | ||||||||||||||||||||||||
| 1276 | proxy()->pixelMetric(PM_ButtonShiftVertical, opt, widget)); never executed: textRect.translate(proxy()->pixelMetric(PM_ButtonShiftHorizontal, opt, widget), proxy()->pixelMetric(PM_ButtonShiftVertical, opt, widget)); | 0 | ||||||||||||||||||||||||
| 1277 | - | |||||||||||||||||||||||||
| 1278 | if (button->features & QStyleOptionButton::HasMenu) {
| 0 | ||||||||||||||||||||||||
| 1279 | int indicatorSize = proxy()->pixelMetric(PM_MenuButtonIndicator, button, widget); | - | ||||||||||||||||||||||||
| 1280 | if (button->direction == Qt::LeftToRight)
| 0 | ||||||||||||||||||||||||
| 1281 | textRect = textRect.adjusted(0, 0, -indicatorSize, 0); never executed: textRect = textRect.adjusted(0, 0, -indicatorSize, 0); | 0 | ||||||||||||||||||||||||
| 1282 | else | - | ||||||||||||||||||||||||
| 1283 | textRect = textRect.adjusted(indicatorSize, 0, 0, 0); never executed: textRect = textRect.adjusted(indicatorSize, 0, 0, 0); | 0 | ||||||||||||||||||||||||
| 1284 | } | - | ||||||||||||||||||||||||
| 1285 | proxy()->drawItemText(p, textRect, tf, button->palette, (button->state & State_Enabled), | - | ||||||||||||||||||||||||
| 1286 | button->text, QPalette::ButtonText); | - | ||||||||||||||||||||||||
| 1287 | } never executed: end of block | 0 | ||||||||||||||||||||||||
| 1288 | break; never executed: break; | 0 | ||||||||||||||||||||||||
| 1289 | case CE_RadioButton: never executed: case CE_RadioButton: | 0 | ||||||||||||||||||||||||
| 1290 | case CE_CheckBox: never executed: case CE_CheckBox: | 0 | ||||||||||||||||||||||||
| 1291 | if (const QStyleOptionButton *btn = qstyleoption_cast<const QStyleOptionButton *>(opt)) {
| 0 | ||||||||||||||||||||||||
| 1292 | bool isRadio = (element == CE_RadioButton); | - | ||||||||||||||||||||||||
| 1293 | QStyleOptionButton subopt = *btn; | - | ||||||||||||||||||||||||
| 1294 | subopt.rect = subElementRect(isRadio ? SE_RadioButtonIndicator | - | ||||||||||||||||||||||||
| 1295 | : SE_CheckBoxIndicator, btn, widget); | - | ||||||||||||||||||||||||
| 1296 | proxy()->drawPrimitive(isRadio ? PE_IndicatorRadioButton : PE_IndicatorCheckBox, | - | ||||||||||||||||||||||||
| 1297 | &subopt, p, widget); | - | ||||||||||||||||||||||||
| 1298 | subopt.rect = subElementRect(isRadio ? SE_RadioButtonContents | - | ||||||||||||||||||||||||
| 1299 | : SE_CheckBoxContents, btn, widget); | - | ||||||||||||||||||||||||
| 1300 | proxy()->drawControl(isRadio ? CE_RadioButtonLabel : CE_CheckBoxLabel, &subopt, p, widget); | - | ||||||||||||||||||||||||
| 1301 | if (btn->state & State_HasFocus) {
| 0 | ||||||||||||||||||||||||
| 1302 | QStyleOptionFocusRect fropt; | - | ||||||||||||||||||||||||
| 1303 | fropt.QStyleOption::operator=(*btn); | - | ||||||||||||||||||||||||
| 1304 | fropt.rect = subElementRect(isRadio ? SE_RadioButtonFocusRect | - | ||||||||||||||||||||||||
| 1305 | : SE_CheckBoxFocusRect, btn, widget); | - | ||||||||||||||||||||||||
| 1306 | proxy()->drawPrimitive(PE_FrameFocusRect, &fropt, p, widget); | - | ||||||||||||||||||||||||
| 1307 | } never executed: end of block | 0 | ||||||||||||||||||||||||
| 1308 | } never executed: end of block | 0 | ||||||||||||||||||||||||
| 1309 | break; never executed: break; | 0 | ||||||||||||||||||||||||
| 1310 | case CE_RadioButtonLabel: never executed: case CE_RadioButtonLabel: | 0 | ||||||||||||||||||||||||
| 1311 | case CE_CheckBoxLabel: never executed: case CE_CheckBoxLabel: | 0 | ||||||||||||||||||||||||
| 1312 | if (const QStyleOptionButton *btn = qstyleoption_cast<const QStyleOptionButton *>(opt)) {
| 0 | ||||||||||||||||||||||||
| 1313 | uint alignment = visualAlignment(btn->direction, Qt::AlignLeft | Qt::AlignVCenter); | - | ||||||||||||||||||||||||
| 1314 | - | |||||||||||||||||||||||||
| 1315 | if (!proxy()->styleHint(SH_UnderlineShortcut, btn, widget))
| 0 | ||||||||||||||||||||||||
| 1316 | alignment |= Qt::TextHideMnemonic; never executed: alignment |= Qt::TextHideMnemonic; | 0 | ||||||||||||||||||||||||
| 1317 | QPixmap pix; | - | ||||||||||||||||||||||||
| 1318 | QRect textRect = btn->rect; | - | ||||||||||||||||||||||||
| 1319 | if (!btn->icon.isNull()) {
| 0 | ||||||||||||||||||||||||
| 1320 | pix = btn->icon.pixmap(qt_getWindow(widget), btn->iconSize, btn->state & State_Enabled ? QIcon::Normal : QIcon::Disabled); | - | ||||||||||||||||||||||||
| 1321 | proxy()->drawItemPixmap(p, btn->rect, alignment, pix); | - | ||||||||||||||||||||||||
| 1322 | if (btn->direction == Qt::RightToLeft)
| 0 | ||||||||||||||||||||||||
| 1323 | textRect.setRight(textRect.right() - btn->iconSize.width() - 4); never executed: textRect.setRight(textRect.right() - btn->iconSize.width() - 4); | 0 | ||||||||||||||||||||||||
| 1324 | else | - | ||||||||||||||||||||||||
| 1325 | textRect.setLeft(textRect.left() + btn->iconSize.width() + 4); never executed: textRect.setLeft(textRect.left() + btn->iconSize.width() + 4); | 0 | ||||||||||||||||||||||||
| 1326 | } | - | ||||||||||||||||||||||||
| 1327 | if (!btn->text.isEmpty()){
| 0 | ||||||||||||||||||||||||
| 1328 | proxy()->drawItemText(p, textRect, alignment | Qt::TextShowMnemonic, | - | ||||||||||||||||||||||||
| 1329 | btn->palette, btn->state & State_Enabled, btn->text, QPalette::WindowText); | - | ||||||||||||||||||||||||
| 1330 | } never executed: end of block | 0 | ||||||||||||||||||||||||
| 1331 | } never executed: end of block | 0 | ||||||||||||||||||||||||
| 1332 | break; never executed: break; | 0 | ||||||||||||||||||||||||
| 1333 | #ifndef QT_NO_MENU | - | ||||||||||||||||||||||||
| 1334 | case CE_MenuScroller: { never executed: case CE_MenuScroller: | 0 | ||||||||||||||||||||||||
| 1335 | QStyleOption arrowOpt = *opt; | - | ||||||||||||||||||||||||
| 1336 | arrowOpt.state |= State_Enabled; | - | ||||||||||||||||||||||||
| 1337 | proxy()->drawPrimitive(((opt->state & State_DownArrow) ? PE_IndicatorArrowDown : PE_IndicatorArrowUp), | - | ||||||||||||||||||||||||
| 1338 | &arrowOpt, p, widget); | - | ||||||||||||||||||||||||
| 1339 | break; } never executed: break; | 0 | ||||||||||||||||||||||||
| 1340 | case CE_MenuTearoff: never executed: case CE_MenuTearoff: | 0 | ||||||||||||||||||||||||
| 1341 | if (opt->state & State_Selected)
| 0 | ||||||||||||||||||||||||
| 1342 | p->fillRect(opt->rect, opt->palette.brush(QPalette::Highlight)); never executed: p->fillRect(opt->rect, opt->palette.brush(QPalette::Highlight)); | 0 | ||||||||||||||||||||||||
| 1343 | else | - | ||||||||||||||||||||||||
| 1344 | p->fillRect(opt->rect, opt->palette.brush(QPalette::Button)); never executed: p->fillRect(opt->rect, opt->palette.brush(QPalette::Button)); | 0 | ||||||||||||||||||||||||
| 1345 | p->setPen(QPen(opt->palette.dark().color(), 1, Qt::DashLine)); | - | ||||||||||||||||||||||||
| 1346 | p->drawLine(opt->rect.x() + 2, opt->rect.y() + opt->rect.height() / 2 - 1, | - | ||||||||||||||||||||||||
| 1347 | opt->rect.x() + opt->rect.width() - 4, | - | ||||||||||||||||||||||||
| 1348 | opt->rect.y() + opt->rect.height() / 2 - 1); | - | ||||||||||||||||||||||||
| 1349 | p->setPen(QPen(opt->palette.light().color(), 1, Qt::DashLine)); | - | ||||||||||||||||||||||||
| 1350 | p->drawLine(opt->rect.x() + 2, opt->rect.y() + opt->rect.height() / 2, | - | ||||||||||||||||||||||||
| 1351 | opt->rect.x() + opt->rect.width() - 4, opt->rect.y() + opt->rect.height() / 2); | - | ||||||||||||||||||||||||
| 1352 | break; never executed: break; | 0 | ||||||||||||||||||||||||
| 1353 | #endif // QT_NO_MENU | - | ||||||||||||||||||||||||
| 1354 | #ifndef QT_NO_MENUBAR | - | ||||||||||||||||||||||||
| 1355 | case CE_MenuBarItem: never executed: case CE_MenuBarItem: | 0 | ||||||||||||||||||||||||
| 1356 | if (const QStyleOptionMenuItem *mbi = qstyleoption_cast<const QStyleOptionMenuItem *>(opt)) {
| 0 | ||||||||||||||||||||||||
| 1357 | uint alignment = Qt::AlignCenter | Qt::TextShowMnemonic | Qt::TextDontClip | - | ||||||||||||||||||||||||
| 1358 | | Qt::TextSingleLine; | - | ||||||||||||||||||||||||
| 1359 | if (!proxy()->styleHint(SH_UnderlineShortcut, mbi, widget))
| 0 | ||||||||||||||||||||||||
| 1360 | alignment |= Qt::TextHideMnemonic; never executed: alignment |= Qt::TextHideMnemonic; | 0 | ||||||||||||||||||||||||
| 1361 | int iconExtent = proxy()->pixelMetric(PM_SmallIconSize); | - | ||||||||||||||||||||||||
| 1362 | QPixmap pix = mbi->icon.pixmap(qt_getWindow(widget), QSize(iconExtent, iconExtent), (mbi->state & State_Enabled) ? QIcon::Normal : QIcon::Disabled); | - | ||||||||||||||||||||||||
| 1363 | if (!pix.isNull())
| 0 | ||||||||||||||||||||||||
| 1364 | proxy()->drawItemPixmap(p,mbi->rect, alignment, pix); never executed: proxy()->drawItemPixmap(p,mbi->rect, alignment, pix); | 0 | ||||||||||||||||||||||||
| 1365 | else | - | ||||||||||||||||||||||||
| 1366 | proxy()->drawItemText(p, mbi->rect, alignment, mbi->palette, mbi->state & State_Enabled, never executed: proxy()->drawItemText(p, mbi->rect, alignment, mbi->palette, mbi->state & State_Enabled, mbi->text, QPalette::ButtonText); | 0 | ||||||||||||||||||||||||
| 1367 | mbi->text, QPalette::ButtonText); never executed: proxy()->drawItemText(p, mbi->rect, alignment, mbi->palette, mbi->state & State_Enabled, mbi->text, QPalette::ButtonText); | 0 | ||||||||||||||||||||||||
| 1368 | } | - | ||||||||||||||||||||||||
| 1369 | break; never executed: break; | 0 | ||||||||||||||||||||||||
| 1370 | case CE_MenuBarEmptyArea: never executed: case CE_MenuBarEmptyArea: | 0 | ||||||||||||||||||||||||
| 1371 | if (widget && !widget->testAttribute(Qt::WA_NoSystemBackground))
| 0 | ||||||||||||||||||||||||
| 1372 | p->eraseRect(opt->rect); never executed: p->eraseRect(opt->rect); | 0 | ||||||||||||||||||||||||
| 1373 | break; never executed: break; | 0 | ||||||||||||||||||||||||
| 1374 | #endif // QT_NO_MENUBAR | - | ||||||||||||||||||||||||
| 1375 | #ifndef QT_NO_PROGRESSBAR | - | ||||||||||||||||||||||||
| 1376 | case CE_ProgressBar: never executed: case CE_ProgressBar: | 0 | ||||||||||||||||||||||||
| 1377 | if (const QStyleOptionProgressBar *pb
| 0 | ||||||||||||||||||||||||
| 1378 | = qstyleoption_cast<const QStyleOptionProgressBar *>(opt)) {
| 0 | ||||||||||||||||||||||||
| 1379 | QStyleOptionProgressBar subopt = *pb; | - | ||||||||||||||||||||||||
| 1380 | subopt.rect = subElementRect(SE_ProgressBarGroove, pb, widget); | - | ||||||||||||||||||||||||
| 1381 | proxy()->drawControl(CE_ProgressBarGroove, &subopt, p, widget); | - | ||||||||||||||||||||||||
| 1382 | subopt.rect = subElementRect(SE_ProgressBarContents, pb, widget); | - | ||||||||||||||||||||||||
| 1383 | proxy()->drawControl(CE_ProgressBarContents, &subopt, p, widget); | - | ||||||||||||||||||||||||
| 1384 | if (pb->textVisible) {
| 0 | ||||||||||||||||||||||||
| 1385 | subopt.rect = subElementRect(SE_ProgressBarLabel, pb, widget); | - | ||||||||||||||||||||||||
| 1386 | proxy()->drawControl(CE_ProgressBarLabel, &subopt, p, widget); | - | ||||||||||||||||||||||||
| 1387 | } never executed: end of block | 0 | ||||||||||||||||||||||||
| 1388 | } never executed: end of block | 0 | ||||||||||||||||||||||||
| 1389 | break; never executed: break; | 0 | ||||||||||||||||||||||||
| 1390 | case CE_ProgressBarGroove: never executed: case CE_ProgressBarGroove: | 0 | ||||||||||||||||||||||||
| 1391 | if (opt->rect.isValid())
| 0 | ||||||||||||||||||||||||
| 1392 | qDrawShadePanel(p, opt->rect, opt->palette, true, 1, never executed: qDrawShadePanel(p, opt->rect, opt->palette, true, 1, &opt->palette.brush(QPalette::Window)); | 0 | ||||||||||||||||||||||||
| 1393 | &opt->palette.brush(QPalette::Window)); never executed: qDrawShadePanel(p, opt->rect, opt->palette, true, 1, &opt->palette.brush(QPalette::Window)); | 0 | ||||||||||||||||||||||||
| 1394 | break; never executed: break; | 0 | ||||||||||||||||||||||||
| 1395 | case CE_ProgressBarLabel: never executed: case CE_ProgressBarLabel: | 0 | ||||||||||||||||||||||||
| 1396 | if (const QStyleOptionProgressBar *pb = qstyleoption_cast<const QStyleOptionProgressBar *>(opt)) {
| 0 | ||||||||||||||||||||||||
| 1397 | const bool vertical = pb->orientation == Qt::Vertical; | - | ||||||||||||||||||||||||
| 1398 | if (!vertical) {
| 0 | ||||||||||||||||||||||||
| 1399 | QPalette::ColorRole textRole = QPalette::NoRole; | - | ||||||||||||||||||||||||
| 1400 | if ((pb->textAlignment & Qt::AlignCenter) && pb->textVisible
| 0 | ||||||||||||||||||||||||
| 1401 | && ((qint64(pb->progress) - qint64(pb->minimum)) * 2 >= (qint64(pb->maximum) - qint64(pb->minimum)))) {
| 0 | ||||||||||||||||||||||||
| 1402 | textRole = QPalette::HighlightedText; | - | ||||||||||||||||||||||||
| 1403 | //Draw text shadow, This will increase readability when the background of same color | - | ||||||||||||||||||||||||
| 1404 | QRect shadowRect(pb->rect); | - | ||||||||||||||||||||||||
| 1405 | shadowRect.translate(1,1); | - | ||||||||||||||||||||||||
| 1406 | QColor shadowColor = (pb->palette.color(textRole).value() <= 128)
| 0 | ||||||||||||||||||||||||
| 1407 | ? QColor(255,255,255,160) : QColor(0,0,0,160); | - | ||||||||||||||||||||||||
| 1408 | QPalette shadowPalette = pb->palette; | - | ||||||||||||||||||||||||
| 1409 | shadowPalette.setColor(textRole, shadowColor); | - | ||||||||||||||||||||||||
| 1410 | proxy()->drawItemText(p, shadowRect, Qt::AlignCenter | Qt::TextSingleLine, shadowPalette, | - | ||||||||||||||||||||||||
| 1411 | pb->state & State_Enabled, pb->text, textRole); | - | ||||||||||||||||||||||||
| 1412 | } never executed: end of block | 0 | ||||||||||||||||||||||||
| 1413 | proxy()->drawItemText(p, pb->rect, Qt::AlignCenter | Qt::TextSingleLine, pb->palette, | - | ||||||||||||||||||||||||
| 1414 | pb->state & State_Enabled, pb->text, textRole); | - | ||||||||||||||||||||||||
| 1415 | } never executed: end of block | 0 | ||||||||||||||||||||||||
| 1416 | } never executed: end of block | 0 | ||||||||||||||||||||||||
| 1417 | break; never executed: break; | 0 | ||||||||||||||||||||||||
| 1418 | case CE_ProgressBarContents: never executed: case CE_ProgressBarContents: | 0 | ||||||||||||||||||||||||
| 1419 | if (const QStyleOptionProgressBar *pb = qstyleoption_cast<const QStyleOptionProgressBar *>(opt)) {
| 0 | ||||||||||||||||||||||||
| 1420 | - | |||||||||||||||||||||||||
| 1421 | QRect rect = pb->rect; | - | ||||||||||||||||||||||||
| 1422 | const bool vertical = pb->orientation == Qt::Vertical; | - | ||||||||||||||||||||||||
| 1423 | const bool inverted = pb->invertedAppearance; | - | ||||||||||||||||||||||||
| 1424 | qint64 minimum = qint64(pb->minimum); | - | ||||||||||||||||||||||||
| 1425 | qint64 maximum = qint64(pb->maximum); | - | ||||||||||||||||||||||||
| 1426 | qint64 progress = qint64(pb->progress); | - | ||||||||||||||||||||||||
| 1427 | - | |||||||||||||||||||||||||
| 1428 | QMatrix m; | - | ||||||||||||||||||||||||
| 1429 | - | |||||||||||||||||||||||||
| 1430 | if (vertical) {
| 0 | ||||||||||||||||||||||||
| 1431 | rect = QRect(rect.y(), rect.x(), rect.height(), rect.width()); // flip width and height | - | ||||||||||||||||||||||||
| 1432 | m.rotate(90); | - | ||||||||||||||||||||||||
| 1433 | m.translate(0, -(rect.height() + rect.y()*2)); | - | ||||||||||||||||||||||||
| 1434 | } never executed: end of block | 0 | ||||||||||||||||||||||||
| 1435 | - | |||||||||||||||||||||||||
| 1436 | QPalette pal2 = pb->palette; | - | ||||||||||||||||||||||||
| 1437 | // Correct the highlight color if it is the same as the background | - | ||||||||||||||||||||||||
| 1438 | if (pal2.highlight() == pal2.background())
| 0 | ||||||||||||||||||||||||
| 1439 | pal2.setColor(QPalette::Highlight, pb->palette.color(QPalette::Active, never executed: pal2.setColor(QPalette::Highlight, pb->palette.color(QPalette::Active, QPalette::Highlight)); | 0 | ||||||||||||||||||||||||
| 1440 | QPalette::Highlight)); never executed: pal2.setColor(QPalette::Highlight, pb->palette.color(QPalette::Active, QPalette::Highlight)); | 0 | ||||||||||||||||||||||||
| 1441 | bool reverse = ((!vertical && (pb->direction == Qt::RightToLeft)) || vertical);
| 0 | ||||||||||||||||||||||||
| 1442 | if (inverted)
| 0 | ||||||||||||||||||||||||
| 1443 | reverse = !reverse; never executed: reverse = !reverse; | 0 | ||||||||||||||||||||||||
| 1444 | int w = rect.width(); | - | ||||||||||||||||||||||||
| 1445 | if (pb->minimum == 0 && pb->maximum == 0) {
| 0 | ||||||||||||||||||||||||
| 1446 | // draw busy indicator | - | ||||||||||||||||||||||||
| 1447 | int x = (progress - minimum) % (w * 2); | - | ||||||||||||||||||||||||
| 1448 | if (x > w)
| 0 | ||||||||||||||||||||||||
| 1449 | x = 2 * w - x; never executed: x = 2 * w - x; | 0 | ||||||||||||||||||||||||
| 1450 | x = reverse ? rect.right() - x : x + rect.x();
| 0 | ||||||||||||||||||||||||
| 1451 | p->setPen(QPen(pal2.highlight().color(), 4)); | - | ||||||||||||||||||||||||
| 1452 | p->drawLine(x, rect.y(), x, rect.height()); | - | ||||||||||||||||||||||||
| 1453 | } else { never executed: end of block | 0 | ||||||||||||||||||||||||
| 1454 | const int unit_width = proxy()->pixelMetric(PM_ProgressBarChunkWidth, pb, widget); | - | ||||||||||||||||||||||||
| 1455 | if (!unit_width)
| 0 | ||||||||||||||||||||||||
| 1456 | return; never executed: return; | 0 | ||||||||||||||||||||||||
| 1457 | - | |||||||||||||||||||||||||
| 1458 | int u; | - | ||||||||||||||||||||||||
| 1459 | if (unit_width > 1)
| 0 | ||||||||||||||||||||||||
| 1460 | u = ((rect.width() + unit_width) / unit_width); never executed: u = ((rect.width() + unit_width) / unit_width); | 0 | ||||||||||||||||||||||||
| 1461 | else | - | ||||||||||||||||||||||||
| 1462 | u = w / unit_width; never executed: u = w / unit_width; | 0 | ||||||||||||||||||||||||
| 1463 | qint64 p_v = progress - minimum; | - | ||||||||||||||||||||||||
| 1464 | qint64 t_s = (maximum - minimum) ? (maximum - minimum) : qint64(1);
| 0 | ||||||||||||||||||||||||
| 1465 | - | |||||||||||||||||||||||||
| 1466 | if (u > 0 && p_v >= INT_MAX / u && t_s >= u) {
| 0 | ||||||||||||||||||||||||
| 1467 | // scale down to something usable. | - | ||||||||||||||||||||||||
| 1468 | p_v /= u; | - | ||||||||||||||||||||||||
| 1469 | t_s /= u; | - | ||||||||||||||||||||||||
| 1470 | } never executed: end of block | 0 | ||||||||||||||||||||||||
| 1471 | - | |||||||||||||||||||||||||
| 1472 | // nu < tnu, if last chunk is only a partial chunk | - | ||||||||||||||||||||||||
| 1473 | int tnu, nu; | - | ||||||||||||||||||||||||
| 1474 | tnu = nu = p_v * u / t_s; | - | ||||||||||||||||||||||||
| 1475 | - | |||||||||||||||||||||||||
| 1476 | if (nu * unit_width > w)
| 0 | ||||||||||||||||||||||||
| 1477 | --nu; never executed: --nu; | 0 | ||||||||||||||||||||||||
| 1478 | - | |||||||||||||||||||||||||
| 1479 | // Draw nu units out of a possible u of unit_width | - | ||||||||||||||||||||||||
| 1480 | // width, each a rectangle bordered by background | - | ||||||||||||||||||||||||
| 1481 | // color, all in a sunken panel with a percentage text | - | ||||||||||||||||||||||||
| 1482 | // display at the end. | - | ||||||||||||||||||||||||
| 1483 | int x = 0; | - | ||||||||||||||||||||||||
| 1484 | int x0 = reverse ? rect.right() - ((unit_width > 1) ? unit_width : 0)
| 0 | ||||||||||||||||||||||||
| 1485 | : rect.x(); | - | ||||||||||||||||||||||||
| 1486 | - | |||||||||||||||||||||||||
| 1487 | QStyleOptionProgressBar pbBits = *pb; | - | ||||||||||||||||||||||||
| 1488 | pbBits.rect = rect; | - | ||||||||||||||||||||||||
| 1489 | pbBits.palette = pal2; | - | ||||||||||||||||||||||||
| 1490 | int myY = pbBits.rect.y(); | - | ||||||||||||||||||||||||
| 1491 | int myHeight = pbBits.rect.height(); | - | ||||||||||||||||||||||||
| 1492 | pbBits.state = State_None; | - | ||||||||||||||||||||||||
| 1493 | for (int i = 0; i < nu; ++i) {
| 0 | ||||||||||||||||||||||||
| 1494 | pbBits.rect.setRect(x0 + x, myY, unit_width, myHeight); | - | ||||||||||||||||||||||||
| 1495 | pbBits.rect = m.mapRect(QRectF(pbBits.rect)).toRect(); | - | ||||||||||||||||||||||||
| 1496 | proxy()->drawPrimitive(PE_IndicatorProgressChunk, &pbBits, p, widget); | - | ||||||||||||||||||||||||
| 1497 | x += reverse ? -unit_width : unit_width;
| 0 | ||||||||||||||||||||||||
| 1498 | } never executed: end of block | 0 | ||||||||||||||||||||||||
| 1499 | - | |||||||||||||||||||||||||
| 1500 | // Draw the last partial chunk to fill up the | - | ||||||||||||||||||||||||
| 1501 | // progress bar entirely | - | ||||||||||||||||||||||||
| 1502 | if (nu < tnu) {
| 0 | ||||||||||||||||||||||||
| 1503 | int pixels_left = w - (nu * unit_width); | - | ||||||||||||||||||||||||
| 1504 | int offset = reverse ? x0 + x + unit_width-pixels_left : x0 + x;
| 0 | ||||||||||||||||||||||||
| 1505 | pbBits.rect.setRect(offset, myY, pixels_left, myHeight); | - | ||||||||||||||||||||||||
| 1506 | pbBits.rect = m.mapRect(QRectF(pbBits.rect)).toRect(); | - | ||||||||||||||||||||||||
| 1507 | proxy()->drawPrimitive(PE_IndicatorProgressChunk, &pbBits, p, widget); | - | ||||||||||||||||||||||||
| 1508 | } never executed: end of block | 0 | ||||||||||||||||||||||||
| 1509 | } never executed: end of block | 0 | ||||||||||||||||||||||||
| 1510 | } | - | ||||||||||||||||||||||||
| 1511 | break; never executed: break; | 0 | ||||||||||||||||||||||||
| 1512 | #endif // QT_NO_PROGRESSBAR | - | ||||||||||||||||||||||||
| 1513 | case CE_HeaderLabel: never executed: case CE_HeaderLabel: | 0 | ||||||||||||||||||||||||
| 1514 | if (const QStyleOptionHeader *header = qstyleoption_cast<const QStyleOptionHeader *>(opt)) {
| 0 | ||||||||||||||||||||||||
| 1515 | QRect rect = header->rect; | - | ||||||||||||||||||||||||
| 1516 | if (!header->icon.isNull()) {
| 0 | ||||||||||||||||||||||||
| 1517 | int iconExtent = proxy()->pixelMetric(PM_SmallIconSize); | - | ||||||||||||||||||||||||
| 1518 | QPixmap pixmap | - | ||||||||||||||||||||||||
| 1519 | = header->icon.pixmap(qt_getWindow(widget), QSize(iconExtent, iconExtent), (header->state & State_Enabled) ? QIcon::Normal : QIcon::Disabled); | - | ||||||||||||||||||||||||
| 1520 | int pixw = pixmap.width() / pixmap.devicePixelRatio(); | - | ||||||||||||||||||||||||
| 1521 | - | |||||||||||||||||||||||||
| 1522 | QRect aligned = alignedRect(header->direction, QFlag(header->iconAlignment), pixmap.size() / pixmap.devicePixelRatio(), rect); | - | ||||||||||||||||||||||||
| 1523 | QRect inter = aligned.intersected(rect); | - | ||||||||||||||||||||||||
| 1524 | p->drawPixmap(inter.x(), inter.y(), pixmap, | - | ||||||||||||||||||||||||
| 1525 | inter.x() - aligned.x(), inter.y() - aligned.y(), | - | ||||||||||||||||||||||||
| 1526 | aligned.width() * pixmap.devicePixelRatio(), | - | ||||||||||||||||||||||||
| 1527 | pixmap.height() * pixmap.devicePixelRatio()); | - | ||||||||||||||||||||||||
| 1528 | - | |||||||||||||||||||||||||
| 1529 | if (header->direction == Qt::LeftToRight)
| 0 | ||||||||||||||||||||||||
| 1530 | rect.setLeft(rect.left() + pixw + 2); never executed: rect.setLeft(rect.left() + pixw + 2); | 0 | ||||||||||||||||||||||||
| 1531 | else | - | ||||||||||||||||||||||||
| 1532 | rect.setRight(rect.right() - pixw - 2); never executed: rect.setRight(rect.right() - pixw - 2); | 0 | ||||||||||||||||||||||||
| 1533 | } | - | ||||||||||||||||||||||||
| 1534 | if (header->state & QStyle::State_On) {
| 0 | ||||||||||||||||||||||||
| 1535 | QFont fnt = p->font(); | - | ||||||||||||||||||||||||
| 1536 | fnt.setBold(true); | - | ||||||||||||||||||||||||
| 1537 | p->setFont(fnt); | - | ||||||||||||||||||||||||
| 1538 | } never executed: end of block | 0 | ||||||||||||||||||||||||
| 1539 | proxy()->drawItemText(p, rect, header->textAlignment, header->palette, | - | ||||||||||||||||||||||||
| 1540 | (header->state & State_Enabled), header->text, QPalette::ButtonText); | - | ||||||||||||||||||||||||
| 1541 | } never executed: end of block | 0 | ||||||||||||||||||||||||
| 1542 | break; never executed: break; | 0 | ||||||||||||||||||||||||
| 1543 | #ifndef QT_NO_TOOLBUTTON | - | ||||||||||||||||||||||||
| 1544 | case CE_ToolButtonLabel: never executed: case CE_ToolButtonLabel: | 0 | ||||||||||||||||||||||||
| 1545 | if (const QStyleOptionToolButton *toolbutton
| 0 | ||||||||||||||||||||||||
| 1546 | = qstyleoption_cast<const QStyleOptionToolButton *>(opt)) {
| 0 | ||||||||||||||||||||||||
| 1547 | QRect rect = toolbutton->rect; | - | ||||||||||||||||||||||||
| 1548 | int shiftX = 0; | - | ||||||||||||||||||||||||
| 1549 | int shiftY = 0; | - | ||||||||||||||||||||||||
| 1550 | if (toolbutton->state & (State_Sunken | State_On)) {
| 0 | ||||||||||||||||||||||||
| 1551 | shiftX = proxy()->pixelMetric(PM_ButtonShiftHorizontal, toolbutton, widget); | - | ||||||||||||||||||||||||
| 1552 | shiftY = proxy()->pixelMetric(PM_ButtonShiftVertical, toolbutton, widget); | - | ||||||||||||||||||||||||
| 1553 | } never executed: end of block | 0 | ||||||||||||||||||||||||
| 1554 | // Arrow type always overrules and is always shown | - | ||||||||||||||||||||||||
| 1555 | bool hasArrow = toolbutton->features & QStyleOptionToolButton::Arrow; | - | ||||||||||||||||||||||||
| 1556 | if (((!hasArrow && toolbutton->icon.isNull()) && !toolbutton->text.isEmpty())
| 0 | ||||||||||||||||||||||||
| 1557 | || toolbutton->toolButtonStyle == Qt::ToolButtonTextOnly) {
| 0 | ||||||||||||||||||||||||
| 1558 | int alignment = Qt::AlignCenter | Qt::TextShowMnemonic; | - | ||||||||||||||||||||||||
| 1559 | if (!proxy()->styleHint(SH_UnderlineShortcut, opt, widget))
| 0 | ||||||||||||||||||||||||
| 1560 | alignment |= Qt::TextHideMnemonic; never executed: alignment |= Qt::TextHideMnemonic; | 0 | ||||||||||||||||||||||||
| 1561 | rect.translate(shiftX, shiftY); | - | ||||||||||||||||||||||||
| 1562 | p->setFont(toolbutton->font); | - | ||||||||||||||||||||||||
| 1563 | proxy()->drawItemText(p, rect, alignment, toolbutton->palette, | - | ||||||||||||||||||||||||
| 1564 | opt->state & State_Enabled, toolbutton->text, | - | ||||||||||||||||||||||||
| 1565 | QPalette::ButtonText); | - | ||||||||||||||||||||||||
| 1566 | } else { never executed: end of block | 0 | ||||||||||||||||||||||||
| 1567 | QPixmap pm; | - | ||||||||||||||||||||||||
| 1568 | QSize pmSize = toolbutton->iconSize; | - | ||||||||||||||||||||||||
| 1569 | if (!toolbutton->icon.isNull()) {
| 0 | ||||||||||||||||||||||||
| 1570 | QIcon::State state = toolbutton->state & State_On ? QIcon::On : QIcon::Off;
| 0 | ||||||||||||||||||||||||
| 1571 | QIcon::Mode mode; | - | ||||||||||||||||||||||||
| 1572 | if (!(toolbutton->state & State_Enabled))
| 0 | ||||||||||||||||||||||||
| 1573 | mode = QIcon::Disabled; never executed: mode = QIcon::Disabled; | 0 | ||||||||||||||||||||||||
| 1574 | else if ((opt->state & State_MouseOver) && (opt->state & State_AutoRaise))
| 0 | ||||||||||||||||||||||||
| 1575 | mode = QIcon::Active; never executed: mode = QIcon::Active; | 0 | ||||||||||||||||||||||||
| 1576 | else | - | ||||||||||||||||||||||||
| 1577 | mode = QIcon::Normal; never executed: mode = QIcon::Normal; | 0 | ||||||||||||||||||||||||
| 1578 | pm = toolbutton->icon.pixmap(qt_getWindow(widget), toolbutton->rect.size().boundedTo(toolbutton->iconSize), | - | ||||||||||||||||||||||||
| 1579 | mode, state); | - | ||||||||||||||||||||||||
| 1580 | pmSize = pm.size() / pm.devicePixelRatio(); | - | ||||||||||||||||||||||||
| 1581 | } never executed: end of block | 0 | ||||||||||||||||||||||||
| 1582 | - | |||||||||||||||||||||||||
| 1583 | if (toolbutton->toolButtonStyle != Qt::ToolButtonIconOnly) {
| 0 | ||||||||||||||||||||||||
| 1584 | p->setFont(toolbutton->font); | - | ||||||||||||||||||||||||
| 1585 | QRect pr = rect, | - | ||||||||||||||||||||||||
| 1586 | tr = rect; | - | ||||||||||||||||||||||||
| 1587 | int alignment = Qt::TextShowMnemonic; | - | ||||||||||||||||||||||||
| 1588 | if (!proxy()->styleHint(SH_UnderlineShortcut, opt, widget))
| 0 | ||||||||||||||||||||||||
| 1589 | alignment |= Qt::TextHideMnemonic; never executed: alignment |= Qt::TextHideMnemonic; | 0 | ||||||||||||||||||||||||
| 1590 | - | |||||||||||||||||||||||||
| 1591 | if (toolbutton->toolButtonStyle == Qt::ToolButtonTextUnderIcon) {
| 0 | ||||||||||||||||||||||||
| 1592 | pr.setHeight(pmSize.height() + 6); | - | ||||||||||||||||||||||||
| 1593 | tr.adjust(0, pr.height() - 1, 0, -1); | - | ||||||||||||||||||||||||
| 1594 | pr.translate(shiftX, shiftY); | - | ||||||||||||||||||||||||
| 1595 | if (!hasArrow) {
| 0 | ||||||||||||||||||||||||
| 1596 | proxy()->drawItemPixmap(p, pr, Qt::AlignCenter, pm); | - | ||||||||||||||||||||||||
| 1597 | } else { never executed: end of block | 0 | ||||||||||||||||||||||||
| 1598 | drawArrow(proxy(), toolbutton, pr, p, widget); | - | ||||||||||||||||||||||||
| 1599 | } never executed: end of block | 0 | ||||||||||||||||||||||||
| 1600 | alignment |= Qt::AlignCenter; | - | ||||||||||||||||||||||||
| 1601 | } else { never executed: end of block | 0 | ||||||||||||||||||||||||
| 1602 | pr.setWidth(pmSize.width() + 8); | - | ||||||||||||||||||||||||
| 1603 | tr.adjust(pr.width(), 0, 0, 0); | - | ||||||||||||||||||||||||
| 1604 | pr.translate(shiftX, shiftY); | - | ||||||||||||||||||||||||
| 1605 | if (!hasArrow) {
| 0 | ||||||||||||||||||||||||
| 1606 | proxy()->drawItemPixmap(p, QStyle::visualRect(opt->direction, rect, pr), Qt::AlignCenter, pm); | - | ||||||||||||||||||||||||
| 1607 | } else { never executed: end of block | 0 | ||||||||||||||||||||||||
| 1608 | drawArrow(proxy(), toolbutton, pr, p, widget); | - | ||||||||||||||||||||||||
| 1609 | } never executed: end of block | 0 | ||||||||||||||||||||||||
| 1610 | alignment |= Qt::AlignLeft | Qt::AlignVCenter; | - | ||||||||||||||||||||||||
| 1611 | } never executed: end of block | 0 | ||||||||||||||||||||||||
| 1612 | tr.translate(shiftX, shiftY); | - | ||||||||||||||||||||||||
| 1613 | proxy()->drawItemText(p, QStyle::visualRect(opt->direction, rect, tr), alignment, toolbutton->palette, | - | ||||||||||||||||||||||||
| 1614 | toolbutton->state & State_Enabled, toolbutton->text, | - | ||||||||||||||||||||||||
| 1615 | QPalette::ButtonText); | - | ||||||||||||||||||||||||
| 1616 | } else { never executed: end of block | 0 | ||||||||||||||||||||||||
| 1617 | rect.translate(shiftX, shiftY); | - | ||||||||||||||||||||||||
| 1618 | if (hasArrow) {
| 0 | ||||||||||||||||||||||||
| 1619 | drawArrow(proxy(), toolbutton, rect, p, widget); | - | ||||||||||||||||||||||||
| 1620 | } else { never executed: end of block | 0 | ||||||||||||||||||||||||
| 1621 | proxy()->drawItemPixmap(p, rect, Qt::AlignCenter, pm); | - | ||||||||||||||||||||||||
| 1622 | } never executed: end of block | 0 | ||||||||||||||||||||||||
| 1623 | } | - | ||||||||||||||||||||||||
| 1624 | } | - | ||||||||||||||||||||||||
| 1625 | } | - | ||||||||||||||||||||||||
| 1626 | break; never executed: break; | 0 | ||||||||||||||||||||||||
| 1627 | #endif // QT_NO_TOOLBUTTON | - | ||||||||||||||||||||||||
| 1628 | #ifndef QT_NO_TOOLBOX | - | ||||||||||||||||||||||||
| 1629 | case CE_ToolBoxTab: never executed: case CE_ToolBoxTab: | 0 | ||||||||||||||||||||||||
| 1630 | if (const QStyleOptionToolBox *tb = qstyleoption_cast<const QStyleOptionToolBox *>(opt)) {
| 0 | ||||||||||||||||||||||||
| 1631 | proxy()->drawControl(CE_ToolBoxTabShape, tb, p, widget); | - | ||||||||||||||||||||||||
| 1632 | proxy()->drawControl(CE_ToolBoxTabLabel, tb, p, widget); | - | ||||||||||||||||||||||||
| 1633 | } never executed: end of block | 0 | ||||||||||||||||||||||||
| 1634 | break; never executed: break; | 0 | ||||||||||||||||||||||||
| 1635 | case CE_ToolBoxTabShape: never executed: case CE_ToolBoxTabShape: | 0 | ||||||||||||||||||||||||
| 1636 | if (const QStyleOptionToolBox *tb = qstyleoption_cast<const QStyleOptionToolBox *>(opt)) {
| 0 | ||||||||||||||||||||||||
| 1637 | p->setPen(tb->palette.mid().color().darker(150)); | - | ||||||||||||||||||||||||
| 1638 | bool oldQt4CompatiblePainting = p->testRenderHint(QPainter::Qt4CompatiblePainting); | - | ||||||||||||||||||||||||
| 1639 | p->setRenderHint(QPainter::Qt4CompatiblePainting); | - | ||||||||||||||||||||||||
| 1640 | int d = 20 + tb->rect.height() - 3; | - | ||||||||||||||||||||||||
| 1641 | if (tb->direction != Qt::RightToLeft) {
| 0 | ||||||||||||||||||||||||
| 1642 | const QPoint points[] = { | - | ||||||||||||||||||||||||
| 1643 | QPoint(-1, tb->rect.height() + 1), | - | ||||||||||||||||||||||||
| 1644 | QPoint(-1, 1), | - | ||||||||||||||||||||||||
| 1645 | QPoint(tb->rect.width() - d, 1), | - | ||||||||||||||||||||||||
| 1646 | QPoint(tb->rect.width() - 20, tb->rect.height() - 2), | - | ||||||||||||||||||||||||
| 1647 | QPoint(tb->rect.width() - 1, tb->rect.height() - 2), | - | ||||||||||||||||||||||||
| 1648 | QPoint(tb->rect.width() - 1, tb->rect.height() + 1), | - | ||||||||||||||||||||||||
| 1649 | QPoint(-1, tb->rect.height() + 1), | - | ||||||||||||||||||||||||
| 1650 | }; | - | ||||||||||||||||||||||||
| 1651 | p->drawPolygon(points, sizeof points / sizeof *points); | - | ||||||||||||||||||||||||
| 1652 | } else { never executed: end of block | 0 | ||||||||||||||||||||||||
| 1653 | const QPoint points[] = { | - | ||||||||||||||||||||||||
| 1654 | QPoint(tb->rect.width(), tb->rect.height() + 1), | - | ||||||||||||||||||||||||
| 1655 | QPoint(tb->rect.width(), 1), | - | ||||||||||||||||||||||||
| 1656 | QPoint(d - 1, 1), | - | ||||||||||||||||||||||||
| 1657 | QPoint(20 - 1, tb->rect.height() - 2), | - | ||||||||||||||||||||||||
| 1658 | QPoint(0, tb->rect.height() - 2), | - | ||||||||||||||||||||||||
| 1659 | QPoint(0, tb->rect.height() + 1), | - | ||||||||||||||||||||||||
| 1660 | QPoint(tb->rect.width(), tb->rect.height() + 1), | - | ||||||||||||||||||||||||
| 1661 | }; | - | ||||||||||||||||||||||||
| 1662 | p->drawPolygon(points, sizeof points / sizeof *points); | - | ||||||||||||||||||||||||
| 1663 | } never executed: end of block | 0 | ||||||||||||||||||||||||
| 1664 | p->setRenderHint(QPainter::Qt4CompatiblePainting, oldQt4CompatiblePainting); | - | ||||||||||||||||||||||||
| 1665 | p->setPen(tb->palette.light().color()); | - | ||||||||||||||||||||||||
| 1666 | if (tb->direction != Qt::RightToLeft) {
| 0 | ||||||||||||||||||||||||
| 1667 | p->drawLine(0, 2, tb->rect.width() - d, 2); | - | ||||||||||||||||||||||||
| 1668 | p->drawLine(tb->rect.width() - d - 1, 2, tb->rect.width() - 21, tb->rect.height() - 1); | - | ||||||||||||||||||||||||
| 1669 | p->drawLine(tb->rect.width() - 20, tb->rect.height() - 1, | - | ||||||||||||||||||||||||
| 1670 | tb->rect.width(), tb->rect.height() - 1); | - | ||||||||||||||||||||||||
| 1671 | } else { never executed: end of block | 0 | ||||||||||||||||||||||||
| 1672 | p->drawLine(tb->rect.width() - 1, 2, d - 1, 2); | - | ||||||||||||||||||||||||
| 1673 | p->drawLine(d, 2, 20, tb->rect.height() - 1); | - | ||||||||||||||||||||||||
| 1674 | p->drawLine(19, tb->rect.height() - 1, | - | ||||||||||||||||||||||||
| 1675 | -1, tb->rect.height() - 1); | - | ||||||||||||||||||||||||
| 1676 | } never executed: end of block | 0 | ||||||||||||||||||||||||
| 1677 | p->setBrush(Qt::NoBrush); | - | ||||||||||||||||||||||||
| 1678 | } never executed: end of block | 0 | ||||||||||||||||||||||||
| 1679 | break; never executed: break; | 0 | ||||||||||||||||||||||||
| 1680 | #endif // QT_NO_TOOLBOX | - | ||||||||||||||||||||||||
| 1681 | #ifndef QT_NO_TABBAR | - | ||||||||||||||||||||||||
| 1682 | case CE_TabBarTab: never executed: case CE_TabBarTab: | 0 | ||||||||||||||||||||||||
| 1683 | if (const QStyleOptionTab *tab = qstyleoption_cast<const QStyleOptionTab *>(opt)) {
| 0 | ||||||||||||||||||||||||
| 1684 | proxy()->drawControl(CE_TabBarTabShape, tab, p, widget); | - | ||||||||||||||||||||||||
| 1685 | proxy()->drawControl(CE_TabBarTabLabel, tab, p, widget); | - | ||||||||||||||||||||||||
| 1686 | } never executed: end of block | 0 | ||||||||||||||||||||||||
| 1687 | break; never executed: break; | 0 | ||||||||||||||||||||||||
| 1688 | case CE_TabBarTabShape: never executed: case CE_TabBarTabShape: | 0 | ||||||||||||||||||||||||
| 1689 | if (const QStyleOptionTab *tab = qstyleoption_cast<const QStyleOptionTab *>(opt)) {
| 0 | ||||||||||||||||||||||||
| 1690 | p->save(); | - | ||||||||||||||||||||||||
| 1691 | - | |||||||||||||||||||||||||
| 1692 | QRect rect(tab->rect); | - | ||||||||||||||||||||||||
| 1693 | bool selected = tab->state & State_Selected; | - | ||||||||||||||||||||||||
| 1694 | bool onlyOne = tab->position == QStyleOptionTab::OnlyOneTab; | - | ||||||||||||||||||||||||
| 1695 | int tabOverlap = onlyOne ? 0 : proxy()->pixelMetric(PM_TabBarTabOverlap, opt, widget);
| 0 | ||||||||||||||||||||||||
| 1696 | - | |||||||||||||||||||||||||
| 1697 | if (!selected) {
| 0 | ||||||||||||||||||||||||
| 1698 | switch (tab->shape) { | - | ||||||||||||||||||||||||
| 1699 | case QTabBar::TriangularNorth: never executed: case QTabBar::TriangularNorth: | 0 | ||||||||||||||||||||||||
| 1700 | rect.adjust(0, 0, 0, -tabOverlap); | - | ||||||||||||||||||||||||
| 1701 | if(!selected)
| 0 | ||||||||||||||||||||||||
| 1702 | rect.adjust(1, 1, -1, 0); never executed: rect.adjust(1, 1, -1, 0); | 0 | ||||||||||||||||||||||||
| 1703 | break; never executed: break; | 0 | ||||||||||||||||||||||||
| 1704 | case QTabBar::TriangularSouth: never executed: case QTabBar::TriangularSouth: | 0 | ||||||||||||||||||||||||
| 1705 | rect.adjust(0, tabOverlap, 0, 0); | - | ||||||||||||||||||||||||
| 1706 | if(!selected)
| 0 | ||||||||||||||||||||||||
| 1707 | rect.adjust(1, 0, -1, -1); never executed: rect.adjust(1, 0, -1, -1); | 0 | ||||||||||||||||||||||||
| 1708 | break; never executed: break; | 0 | ||||||||||||||||||||||||
| 1709 | case QTabBar::TriangularEast: never executed: case QTabBar::TriangularEast: | 0 | ||||||||||||||||||||||||
| 1710 | rect.adjust(tabOverlap, 0, 0, 0); | - | ||||||||||||||||||||||||
| 1711 | if(!selected)
| 0 | ||||||||||||||||||||||||
| 1712 | rect.adjust(0, 1, -1, -1); never executed: rect.adjust(0, 1, -1, -1); | 0 | ||||||||||||||||||||||||
| 1713 | break; never executed: break; | 0 | ||||||||||||||||||||||||
| 1714 | case QTabBar::TriangularWest: never executed: case QTabBar::TriangularWest: | 0 | ||||||||||||||||||||||||
| 1715 | rect.adjust(0, 0, -tabOverlap, 0); | - | ||||||||||||||||||||||||
| 1716 | if(!selected)
| 0 | ||||||||||||||||||||||||
| 1717 | rect.adjust(1, 1, 0, -1); never executed: rect.adjust(1, 1, 0, -1); | 0 | ||||||||||||||||||||||||
| 1718 | break; never executed: break; | 0 | ||||||||||||||||||||||||
| 1719 | default: never executed: default: | 0 | ||||||||||||||||||||||||
| 1720 | break; never executed: break; | 0 | ||||||||||||||||||||||||
| 1721 | } | - | ||||||||||||||||||||||||
| 1722 | } | - | ||||||||||||||||||||||||
| 1723 | - | |||||||||||||||||||||||||
| 1724 | p->setPen(QPen(tab->palette.foreground(), 0)); | - | ||||||||||||||||||||||||
| 1725 | if (selected) {
| 0 | ||||||||||||||||||||||||
| 1726 | p->setBrush(tab->palette.base()); | - | ||||||||||||||||||||||||
| 1727 | } else { never executed: end of block | 0 | ||||||||||||||||||||||||
| 1728 | if (widget && widget->parentWidget())
| 0 | ||||||||||||||||||||||||
| 1729 | p->setBrush(widget->parentWidget()->palette().background()); never executed: p->setBrush(widget->parentWidget()->palette().background()); | 0 | ||||||||||||||||||||||||
| 1730 | else | - | ||||||||||||||||||||||||
| 1731 | p->setBrush(tab->palette.background()); never executed: p->setBrush(tab->palette.background()); | 0 | ||||||||||||||||||||||||
| 1732 | } | - | ||||||||||||||||||||||||
| 1733 | - | |||||||||||||||||||||||||
| 1734 | int y; | - | ||||||||||||||||||||||||
| 1735 | int x; | - | ||||||||||||||||||||||||
| 1736 | QPolygon a(10); | - | ||||||||||||||||||||||||
| 1737 | switch (tab->shape) { | - | ||||||||||||||||||||||||
| 1738 | case QTabBar::TriangularNorth: never executed: case QTabBar::TriangularNorth: | 0 | ||||||||||||||||||||||||
| 1739 | case QTabBar::TriangularSouth: { never executed: case QTabBar::TriangularSouth: | 0 | ||||||||||||||||||||||||
| 1740 | a.setPoint(0, 0, -1); | - | ||||||||||||||||||||||||
| 1741 | a.setPoint(1, 0, 0); | - | ||||||||||||||||||||||||
| 1742 | y = rect.height() - 2; | - | ||||||||||||||||||||||||
| 1743 | x = y / 3; | - | ||||||||||||||||||||||||
| 1744 | a.setPoint(2, x++, y - 1); | - | ||||||||||||||||||||||||
| 1745 | ++x; | - | ||||||||||||||||||||||||
| 1746 | a.setPoint(3, x++, y++); | - | ||||||||||||||||||||||||
| 1747 | a.setPoint(4, x, y); | - | ||||||||||||||||||||||||
| 1748 | - | |||||||||||||||||||||||||
| 1749 | int i; | - | ||||||||||||||||||||||||
| 1750 | int right = rect.width() - 1; | - | ||||||||||||||||||||||||
| 1751 | for (i = 0; i < 5; ++i)
| 0 | ||||||||||||||||||||||||
| 1752 | a.setPoint(9 - i, right - a.point(i).x(), a.point(i).y()); never executed: a.setPoint(9 - i, right - a.point(i).x(), a.point(i).y()); | 0 | ||||||||||||||||||||||||
| 1753 | if (tab->shape == QTabBar::TriangularNorth)
| 0 | ||||||||||||||||||||||||
| 1754 | for (i = 0; i < 10; ++i)
| 0 | ||||||||||||||||||||||||
| 1755 | a.setPoint(i, a.point(i).x(), rect.height() - 1 - a.point(i).y()); never executed: a.setPoint(i, a.point(i).x(), rect.height() - 1 - a.point(i).y()); | 0 | ||||||||||||||||||||||||
| 1756 | - | |||||||||||||||||||||||||
| 1757 | a.translate(rect.left(), rect.top()); | - | ||||||||||||||||||||||||
| 1758 | p->setRenderHint(QPainter::Antialiasing); | - | ||||||||||||||||||||||||
| 1759 | p->translate(0, 0.5); | - | ||||||||||||||||||||||||
| 1760 | - | |||||||||||||||||||||||||
| 1761 | QPainterPath path; | - | ||||||||||||||||||||||||
| 1762 | path.addPolygon(a); | - | ||||||||||||||||||||||||
| 1763 | p->drawPath(path); | - | ||||||||||||||||||||||||
| 1764 | break; } never executed: break; | 0 | ||||||||||||||||||||||||
| 1765 | case QTabBar::TriangularEast: never executed: case QTabBar::TriangularEast: | 0 | ||||||||||||||||||||||||
| 1766 | case QTabBar::TriangularWest: { never executed: case QTabBar::TriangularWest: | 0 | ||||||||||||||||||||||||
| 1767 | a.setPoint(0, -1, 0); | - | ||||||||||||||||||||||||
| 1768 | a.setPoint(1, 0, 0); | - | ||||||||||||||||||||||||
| 1769 | x = rect.width() - 2; | - | ||||||||||||||||||||||||
| 1770 | y = x / 3; | - | ||||||||||||||||||||||||
| 1771 | a.setPoint(2, x - 1, y++); | - | ||||||||||||||||||||||||
| 1772 | ++y; | - | ||||||||||||||||||||||||
| 1773 | a.setPoint(3, x++, y++); | - | ||||||||||||||||||||||||
| 1774 | a.setPoint(4, x, y); | - | ||||||||||||||||||||||||
| 1775 | int i; | - | ||||||||||||||||||||||||
| 1776 | int bottom = rect.height() - 1; | - | ||||||||||||||||||||||||
| 1777 | for (i = 0; i < 5; ++i)
| 0 | ||||||||||||||||||||||||
| 1778 | a.setPoint(9 - i, a.point(i).x(), bottom - a.point(i).y()); never executed: a.setPoint(9 - i, a.point(i).x(), bottom - a.point(i).y()); | 0 | ||||||||||||||||||||||||
| 1779 | if (tab->shape == QTabBar::TriangularWest)
| 0 | ||||||||||||||||||||||||
| 1780 | for (i = 0; i < 10; ++i)
| 0 | ||||||||||||||||||||||||
| 1781 | a.setPoint(i, rect.width() - 1 - a.point(i).x(), a.point(i).y()); never executed: a.setPoint(i, rect.width() - 1 - a.point(i).x(), a.point(i).y()); | 0 | ||||||||||||||||||||||||
| 1782 | a.translate(rect.left(), rect.top()); | - | ||||||||||||||||||||||||
| 1783 | p->setRenderHint(QPainter::Antialiasing); | - | ||||||||||||||||||||||||
| 1784 | p->translate(0.5, 0); | - | ||||||||||||||||||||||||
| 1785 | QPainterPath path; | - | ||||||||||||||||||||||||
| 1786 | path.addPolygon(a); | - | ||||||||||||||||||||||||
| 1787 | p->drawPath(path); | - | ||||||||||||||||||||||||
| 1788 | break; } never executed: break; | 0 | ||||||||||||||||||||||||
| 1789 | default: never executed: default: | 0 | ||||||||||||||||||||||||
| 1790 | break; never executed: break; | 0 | ||||||||||||||||||||||||
| 1791 | } | - | ||||||||||||||||||||||||
| 1792 | p->restore(); | - | ||||||||||||||||||||||||
| 1793 | } never executed: end of block | 0 | ||||||||||||||||||||||||
| 1794 | break; never executed: break; | 0 | ||||||||||||||||||||||||
| 1795 | case CE_ToolBoxTabLabel: never executed: case CE_ToolBoxTabLabel: | 0 | ||||||||||||||||||||||||
| 1796 | if (const QStyleOptionToolBox *tb = qstyleoption_cast<const QStyleOptionToolBox *>(opt)) {
| 0 | ||||||||||||||||||||||||
| 1797 | bool enabled = tb->state & State_Enabled; | - | ||||||||||||||||||||||||
| 1798 | bool selected = tb->state & State_Selected; | - | ||||||||||||||||||||||||
| 1799 | int iconExtent = proxy()->pixelMetric(QStyle::PM_SmallIconSize, tb, widget); | - | ||||||||||||||||||||||||
| 1800 | QPixmap pm = tb->icon.pixmap(qt_getWindow(widget), QSize(iconExtent, iconExtent), | - | ||||||||||||||||||||||||
| 1801 | enabled ? QIcon::Normal : QIcon::Disabled); | - | ||||||||||||||||||||||||
| 1802 | - | |||||||||||||||||||||||||
| 1803 | QRect cr = subElementRect(QStyle::SE_ToolBoxTabContents, tb, widget); | - | ||||||||||||||||||||||||
| 1804 | QRect tr, ir; | - | ||||||||||||||||||||||||
| 1805 | int ih = 0; | - | ||||||||||||||||||||||||
| 1806 | if (pm.isNull()) {
| 0 | ||||||||||||||||||||||||
| 1807 | tr = cr; | - | ||||||||||||||||||||||||
| 1808 | tr.adjust(4, 0, -8, 0); | - | ||||||||||||||||||||||||
| 1809 | } else { never executed: end of block | 0 | ||||||||||||||||||||||||
| 1810 | int iw = pm.width() / pm.devicePixelRatio() + 4; | - | ||||||||||||||||||||||||
| 1811 | ih = pm.height()/ pm.devicePixelRatio(); | - | ||||||||||||||||||||||||
| 1812 | ir = QRect(cr.left() + 4, cr.top(), iw + 2, ih); | - | ||||||||||||||||||||||||
| 1813 | tr = QRect(ir.right(), cr.top(), cr.width() - ir.right() - 4, cr.height()); | - | ||||||||||||||||||||||||
| 1814 | } never executed: end of block | 0 | ||||||||||||||||||||||||
| 1815 | - | |||||||||||||||||||||||||
| 1816 | if (selected && proxy()->styleHint(QStyle::SH_ToolBox_SelectedPageTitleBold, tb, widget)) {
| 0 | ||||||||||||||||||||||||
| 1817 | QFont f(p->font()); | - | ||||||||||||||||||||||||
| 1818 | f.setBold(true); | - | ||||||||||||||||||||||||
| 1819 | p->setFont(f); | - | ||||||||||||||||||||||||
| 1820 | } never executed: end of block | 0 | ||||||||||||||||||||||||
| 1821 | - | |||||||||||||||||||||||||
| 1822 | QString txt = tb->fontMetrics.elidedText(tb->text, Qt::ElideRight, tr.width()); | - | ||||||||||||||||||||||||
| 1823 | - | |||||||||||||||||||||||||
| 1824 | if (ih)
| 0 | ||||||||||||||||||||||||
| 1825 | p->drawPixmap(ir.left(), (tb->rect.height() - ih) / 2, pm); never executed: p->drawPixmap(ir.left(), (tb->rect.height() - ih) / 2, pm); | 0 | ||||||||||||||||||||||||
| 1826 | - | |||||||||||||||||||||||||
| 1827 | int alignment = Qt::AlignLeft | Qt::AlignVCenter | Qt::TextShowMnemonic; | - | ||||||||||||||||||||||||
| 1828 | if (!proxy()->styleHint(QStyle::SH_UnderlineShortcut, tb, widget))
| 0 | ||||||||||||||||||||||||
| 1829 | alignment |= Qt::TextHideMnemonic; never executed: alignment |= Qt::TextHideMnemonic; | 0 | ||||||||||||||||||||||||
| 1830 | proxy()->drawItemText(p, tr, alignment, tb->palette, enabled, txt, QPalette::ButtonText); | - | ||||||||||||||||||||||||
| 1831 | - | |||||||||||||||||||||||||
| 1832 | if (!txt.isEmpty() && opt->state & State_HasFocus) {
| 0 | ||||||||||||||||||||||||
| 1833 | QStyleOptionFocusRect opt; | - | ||||||||||||||||||||||||
| 1834 | opt.rect = tr; | - | ||||||||||||||||||||||||
| 1835 | opt.palette = tb->palette; | - | ||||||||||||||||||||||||
| 1836 | opt.state = QStyle::State_None; | - | ||||||||||||||||||||||||
| 1837 | proxy()->drawPrimitive(QStyle::PE_FrameFocusRect, &opt, p, widget); | - | ||||||||||||||||||||||||
| 1838 | } never executed: end of block | 0 | ||||||||||||||||||||||||
| 1839 | } never executed: end of block | 0 | ||||||||||||||||||||||||
| 1840 | break; never executed: break; | 0 | ||||||||||||||||||||||||
| 1841 | case CE_TabBarTabLabel: never executed: case CE_TabBarTabLabel: | 0 | ||||||||||||||||||||||||
| 1842 | if (const QStyleOptionTab *tab = qstyleoption_cast<const QStyleOptionTab *>(opt)) {
| 0 | ||||||||||||||||||||||||
| 1843 | QRect tr = tab->rect; | - | ||||||||||||||||||||||||
| 1844 | bool verticalTabs = tab->shape == QTabBar::RoundedEast
| 0 | ||||||||||||||||||||||||
| 1845 | || tab->shape == QTabBar::RoundedWest
| 0 | ||||||||||||||||||||||||
| 1846 | || tab->shape == QTabBar::TriangularEast
| 0 | ||||||||||||||||||||||||
| 1847 | || tab->shape == QTabBar::TriangularWest;
| 0 | ||||||||||||||||||||||||
| 1848 | - | |||||||||||||||||||||||||
| 1849 | int alignment = Qt::AlignCenter | Qt::TextShowMnemonic; | - | ||||||||||||||||||||||||
| 1850 | if (!proxy()->styleHint(SH_UnderlineShortcut, opt, widget))
| 0 | ||||||||||||||||||||||||
| 1851 | alignment |= Qt::TextHideMnemonic; never executed: alignment |= Qt::TextHideMnemonic; | 0 | ||||||||||||||||||||||||
| 1852 | - | |||||||||||||||||||||||||
| 1853 | if (verticalTabs) {
| 0 | ||||||||||||||||||||||||
| 1854 | p->save(); | - | ||||||||||||||||||||||||
| 1855 | int newX, newY, newRot; | - | ||||||||||||||||||||||||
| 1856 | if (tab->shape == QTabBar::RoundedEast || tab->shape == QTabBar::TriangularEast) {
| 0 | ||||||||||||||||||||||||
| 1857 | newX = tr.width() + tr.x(); | - | ||||||||||||||||||||||||
| 1858 | newY = tr.y(); | - | ||||||||||||||||||||||||
| 1859 | newRot = 90; | - | ||||||||||||||||||||||||
| 1860 | } else { never executed: end of block | 0 | ||||||||||||||||||||||||
| 1861 | newX = tr.x(); | - | ||||||||||||||||||||||||
| 1862 | newY = tr.y() + tr.height(); | - | ||||||||||||||||||||||||
| 1863 | newRot = -90; | - | ||||||||||||||||||||||||
| 1864 | } never executed: end of block | 0 | ||||||||||||||||||||||||
| 1865 | QTransform m = QTransform::fromTranslate(newX, newY); | - | ||||||||||||||||||||||||
| 1866 | m.rotate(newRot); | - | ||||||||||||||||||||||||
| 1867 | p->setTransform(m, true); | - | ||||||||||||||||||||||||
| 1868 | } never executed: end of block | 0 | ||||||||||||||||||||||||
| 1869 | QRect iconRect; | - | ||||||||||||||||||||||||
| 1870 | d->tabLayout(tab, widget, &tr, &iconRect); | - | ||||||||||||||||||||||||
| 1871 | tr = proxy()->subElementRect(SE_TabBarTabText, opt, widget); //we compute tr twice because the style may override subElementRect | - | ||||||||||||||||||||||||
| 1872 | - | |||||||||||||||||||||||||
| 1873 | if (!tab->icon.isNull()) {
| 0 | ||||||||||||||||||||||||
| 1874 | QPixmap tabIcon = tab->icon.pixmap(qt_getWindow(widget), tab->iconSize, | - | ||||||||||||||||||||||||
| 1875 | (tab->state & State_Enabled) ? QIcon::Normal | - | ||||||||||||||||||||||||
| 1876 | : QIcon::Disabled, | - | ||||||||||||||||||||||||
| 1877 | (tab->state & State_Selected) ? QIcon::On | - | ||||||||||||||||||||||||
| 1878 | : QIcon::Off); | - | ||||||||||||||||||||||||
| 1879 | p->drawPixmap(iconRect.x(), iconRect.y(), tabIcon); | - | ||||||||||||||||||||||||
| 1880 | } never executed: end of block | 0 | ||||||||||||||||||||||||
| 1881 | - | |||||||||||||||||||||||||
| 1882 | proxy()->drawItemText(p, tr, alignment, tab->palette, tab->state & State_Enabled, tab->text, QPalette::WindowText); | - | ||||||||||||||||||||||||
| 1883 | if (verticalTabs)
| 0 | ||||||||||||||||||||||||
| 1884 | p->restore(); never executed: p->restore(); | 0 | ||||||||||||||||||||||||
| 1885 | - | |||||||||||||||||||||||||
| 1886 | if (tab->state & State_HasFocus) {
| 0 | ||||||||||||||||||||||||
| 1887 | const int OFFSET = 1 + pixelMetric(PM_DefaultFrameWidth); | - | ||||||||||||||||||||||||
| 1888 | - | |||||||||||||||||||||||||
| 1889 | int x1, x2; | - | ||||||||||||||||||||||||
| 1890 | x1 = tab->rect.left(); | - | ||||||||||||||||||||||||
| 1891 | x2 = tab->rect.right() - 1; | - | ||||||||||||||||||||||||
| 1892 | - | |||||||||||||||||||||||||
| 1893 | QStyleOptionFocusRect fropt; | - | ||||||||||||||||||||||||
| 1894 | fropt.QStyleOption::operator=(*tab); | - | ||||||||||||||||||||||||
| 1895 | fropt.rect.setRect(x1 + 1 + OFFSET, tab->rect.y() + OFFSET, | - | ||||||||||||||||||||||||
| 1896 | x2 - x1 - 2*OFFSET, tab->rect.height() - 2*OFFSET); | - | ||||||||||||||||||||||||
| 1897 | drawPrimitive(PE_FrameFocusRect, &fropt, p, widget); | - | ||||||||||||||||||||||||
| 1898 | } never executed: end of block | 0 | ||||||||||||||||||||||||
| 1899 | } never executed: end of block | 0 | ||||||||||||||||||||||||
| 1900 | break; never executed: break; | 0 | ||||||||||||||||||||||||
| 1901 | #endif // QT_NO_TABBAR | - | ||||||||||||||||||||||||
| 1902 | #ifndef QT_NO_SIZEGRIP | - | ||||||||||||||||||||||||
| 1903 | case CE_SizeGrip: { never executed: case CE_SizeGrip: | 0 | ||||||||||||||||||||||||
| 1904 | p->save(); | - | ||||||||||||||||||||||||
| 1905 | int x, y, w, h; | - | ||||||||||||||||||||||||
| 1906 | opt->rect.getRect(&x, &y, &w, &h); | - | ||||||||||||||||||||||||
| 1907 | - | |||||||||||||||||||||||||
| 1908 | int sw = qMin(h, w); | - | ||||||||||||||||||||||||
| 1909 | if (h > w)
| 0 | ||||||||||||||||||||||||
| 1910 | p->translate(0, h - w); never executed: p->translate(0, h - w); | 0 | ||||||||||||||||||||||||
| 1911 | else | - | ||||||||||||||||||||||||
| 1912 | p->translate(w - h, 0); never executed: p->translate(w - h, 0); | 0 | ||||||||||||||||||||||||
| 1913 | - | |||||||||||||||||||||||||
| 1914 | int sx = x; | - | ||||||||||||||||||||||||
| 1915 | int sy = y; | - | ||||||||||||||||||||||||
| 1916 | int s = sw / 3; | - | ||||||||||||||||||||||||
| 1917 | - | |||||||||||||||||||||||||
| 1918 | Qt::Corner corner; | - | ||||||||||||||||||||||||
| 1919 | if (const QStyleOptionSizeGrip *sgOpt = qstyleoption_cast<const QStyleOptionSizeGrip *>(opt))
| 0 | ||||||||||||||||||||||||
| 1920 | corner = sgOpt->corner; never executed: corner = sgOpt->corner; | 0 | ||||||||||||||||||||||||
| 1921 | else if (opt->direction == Qt::RightToLeft)
| 0 | ||||||||||||||||||||||||
| 1922 | corner = Qt::BottomLeftCorner; never executed: corner = Qt::BottomLeftCorner; | 0 | ||||||||||||||||||||||||
| 1923 | else | - | ||||||||||||||||||||||||
| 1924 | corner = Qt::BottomRightCorner; never executed: corner = Qt::BottomRightCorner; | 0 | ||||||||||||||||||||||||
| 1925 | - | |||||||||||||||||||||||||
| 1926 | if (corner == Qt::BottomLeftCorner) {
| 0 | ||||||||||||||||||||||||
| 1927 | sx = x + sw; | - | ||||||||||||||||||||||||
| 1928 | for (int i = 0; i < 4; ++i) {
| 0 | ||||||||||||||||||||||||
| 1929 | p->setPen(QPen(opt->palette.light().color(), 1)); | - | ||||||||||||||||||||||||
| 1930 | p->drawLine(x, sy - 1 , sx + 1, sw); | - | ||||||||||||||||||||||||
| 1931 | p->setPen(QPen(opt->palette.dark().color(), 1)); | - | ||||||||||||||||||||||||
| 1932 | p->drawLine(x, sy, sx, sw); | - | ||||||||||||||||||||||||
| 1933 | p->setPen(QPen(opt->palette.dark().color(), 1)); | - | ||||||||||||||||||||||||
| 1934 | p->drawLine(x, sy + 1, sx - 1, sw); | - | ||||||||||||||||||||||||
| 1935 | sx -= s; | - | ||||||||||||||||||||||||
| 1936 | sy += s; | - | ||||||||||||||||||||||||
| 1937 | } never executed: end of block | 0 | ||||||||||||||||||||||||
| 1938 | } else if (corner == Qt::BottomRightCorner) { never executed: end of block
| 0 | ||||||||||||||||||||||||
| 1939 | for (int i = 0; i < 4; ++i) {
| 0 | ||||||||||||||||||||||||
| 1940 | p->setPen(QPen(opt->palette.light().color(), 1)); | - | ||||||||||||||||||||||||
| 1941 | p->drawLine(sx - 1, sw, sw, sy - 1); | - | ||||||||||||||||||||||||
| 1942 | p->setPen(QPen(opt->palette.dark().color(), 1)); | - | ||||||||||||||||||||||||
| 1943 | p->drawLine(sx, sw, sw, sy); | - | ||||||||||||||||||||||||
| 1944 | p->setPen(QPen(opt->palette.dark().color(), 1)); | - | ||||||||||||||||||||||||
| 1945 | p->drawLine(sx + 1, sw, sw, sy + 1); | - | ||||||||||||||||||||||||
| 1946 | sx += s; | - | ||||||||||||||||||||||||
| 1947 | sy += s; | - | ||||||||||||||||||||||||
| 1948 | } never executed: end of block | 0 | ||||||||||||||||||||||||
| 1949 | } else if (corner == Qt::TopRightCorner) { never executed: end of block
| 0 | ||||||||||||||||||||||||
| 1950 | sy = y + sw; | - | ||||||||||||||||||||||||
| 1951 | for (int i = 0; i < 4; ++i) {
| 0 | ||||||||||||||||||||||||
| 1952 | p->setPen(QPen(opt->palette.light().color(), 1)); | - | ||||||||||||||||||||||||
| 1953 | p->drawLine(sx - 1, y, sw, sy + 1); | - | ||||||||||||||||||||||||
| 1954 | p->setPen(QPen(opt->palette.dark().color(), 1)); | - | ||||||||||||||||||||||||
| 1955 | p->drawLine(sx, y, sw, sy); | - | ||||||||||||||||||||||||
| 1956 | p->setPen(QPen(opt->palette.dark().color(), 1)); | - | ||||||||||||||||||||||||
| 1957 | p->drawLine(sx + 1, y, sw, sy - 1); | - | ||||||||||||||||||||||||
| 1958 | sx += s; | - | ||||||||||||||||||||||||
| 1959 | sy -= s; | - | ||||||||||||||||||||||||
| 1960 | } never executed: end of block | 0 | ||||||||||||||||||||||||
| 1961 | } else if (corner == Qt::TopLeftCorner) { never executed: end of block
| 0 | ||||||||||||||||||||||||
| 1962 | for (int i = 0; i < 4; ++i) {
| 0 | ||||||||||||||||||||||||
| 1963 | p->setPen(QPen(opt->palette.light().color(), 1)); | - | ||||||||||||||||||||||||
| 1964 | p->drawLine(x, sy - 1, sx - 1, y); | - | ||||||||||||||||||||||||
| 1965 | p->setPen(QPen(opt->palette.dark().color(), 1)); | - | ||||||||||||||||||||||||
| 1966 | p->drawLine(x, sy, sx, y); | - | ||||||||||||||||||||||||
| 1967 | p->setPen(QPen(opt->palette.dark().color(), 1)); | - | ||||||||||||||||||||||||
| 1968 | p->drawLine(x, sy + 1, sx + 1, y); | - | ||||||||||||||||||||||||
| 1969 | sx += s; | - | ||||||||||||||||||||||||
| 1970 | sy += s; | - | ||||||||||||||||||||||||
| 1971 | } never executed: end of block | 0 | ||||||||||||||||||||||||
| 1972 | } never executed: end of block | 0 | ||||||||||||||||||||||||
| 1973 | p->restore(); | - | ||||||||||||||||||||||||
| 1974 | break; } never executed: break; | 0 | ||||||||||||||||||||||||
| 1975 | #endif // QT_NO_SIZEGRIP | - | ||||||||||||||||||||||||
| 1976 | #ifndef QT_NO_RUBBERBAND | - | ||||||||||||||||||||||||
| 1977 | case CE_RubberBand: { never executed: case CE_RubberBand: | 0 | ||||||||||||||||||||||||
| 1978 | if (const QStyleOptionRubberBand *rbOpt = qstyleoption_cast<const QStyleOptionRubberBand *>(opt)) {
| 0 | ||||||||||||||||||||||||
| 1979 | QPixmap tiledPixmap(16, 16); | - | ||||||||||||||||||||||||
| 1980 | QPainter pixmapPainter(&tiledPixmap); | - | ||||||||||||||||||||||||
| 1981 | pixmapPainter.setPen(Qt::NoPen); | - | ||||||||||||||||||||||||
| 1982 | pixmapPainter.setBrush(Qt::Dense4Pattern); | - | ||||||||||||||||||||||||
| 1983 | pixmapPainter.setBackground(QBrush(opt->palette.base())); | - | ||||||||||||||||||||||||
| 1984 | pixmapPainter.setBackgroundMode(Qt::OpaqueMode); | - | ||||||||||||||||||||||||
| 1985 | pixmapPainter.drawRect(0, 0, tiledPixmap.width(), tiledPixmap.height()); | - | ||||||||||||||||||||||||
| 1986 | pixmapPainter.end(); | - | ||||||||||||||||||||||||
| 1987 | // ### workaround for borked XRENDER | - | ||||||||||||||||||||||||
| 1988 | tiledPixmap = QPixmap::fromImage(tiledPixmap.toImage()); | - | ||||||||||||||||||||||||
| 1989 | - | |||||||||||||||||||||||||
| 1990 | p->save(); | - | ||||||||||||||||||||||||
| 1991 | QRect r = opt->rect; | - | ||||||||||||||||||||||||
| 1992 | QStyleHintReturnMask mask; | - | ||||||||||||||||||||||||
| 1993 | if (proxy()->styleHint(QStyle::SH_RubberBand_Mask, opt, widget, &mask))
| 0 | ||||||||||||||||||||||||
| 1994 | p->setClipRegion(mask.region); never executed: p->setClipRegion(mask.region); | 0 | ||||||||||||||||||||||||
| 1995 | p->drawTiledPixmap(r.x(), r.y(), r.width(), r.height(), tiledPixmap); | - | ||||||||||||||||||||||||
| 1996 | p->setPen(opt->palette.color(QPalette::Active, QPalette::WindowText)); | - | ||||||||||||||||||||||||
| 1997 | p->setBrush(Qt::NoBrush); | - | ||||||||||||||||||||||||
| 1998 | p->drawRect(r.adjusted(0, 0, -1, -1)); | - | ||||||||||||||||||||||||
| 1999 | if (rbOpt->shape == QRubberBand::Rectangle)
| 0 | ||||||||||||||||||||||||
| 2000 | p->drawRect(r.adjusted(3, 3, -4, -4)); never executed: p->drawRect(r.adjusted(3, 3, -4, -4)); | 0 | ||||||||||||||||||||||||
| 2001 | p->restore(); | - | ||||||||||||||||||||||||
| 2002 | } never executed: end of block | 0 | ||||||||||||||||||||||||
| 2003 | break; } never executed: break; | 0 | ||||||||||||||||||||||||
| 2004 | #endif // QT_NO_RUBBERBAND | - | ||||||||||||||||||||||||
| 2005 | #ifndef QT_NO_DOCKWIDGET | - | ||||||||||||||||||||||||
| 2006 | case CE_DockWidgetTitle: never executed: case CE_DockWidgetTitle: | 0 | ||||||||||||||||||||||||
| 2007 | if (const QStyleOptionDockWidget *dwOpt = qstyleoption_cast<const QStyleOptionDockWidget *>(opt)) {
| 0 | ||||||||||||||||||||||||
| 2008 | QRect r = dwOpt->rect.adjusted(0, 0, -1, -1); | - | ||||||||||||||||||||||||
| 2009 | if (dwOpt->movable) {
| 0 | ||||||||||||||||||||||||
| 2010 | p->setPen(dwOpt->palette.color(QPalette::Dark)); | - | ||||||||||||||||||||||||
| 2011 | p->drawRect(r); | - | ||||||||||||||||||||||||
| 2012 | } never executed: end of block | 0 | ||||||||||||||||||||||||
| 2013 | - | |||||||||||||||||||||||||
| 2014 | if (!dwOpt->title.isEmpty()) {
| 0 | ||||||||||||||||||||||||
| 2015 | const bool verticalTitleBar = dwOpt->verticalTitleBar; | - | ||||||||||||||||||||||||
| 2016 | - | |||||||||||||||||||||||||
| 2017 | if (verticalTitleBar) {
| 0 | ||||||||||||||||||||||||
| 2018 | r.setSize(r.size().transposed()); | - | ||||||||||||||||||||||||
| 2019 | - | |||||||||||||||||||||||||
| 2020 | p->save(); | - | ||||||||||||||||||||||||
| 2021 | p->translate(r.left(), r.top() + r.width()); | - | ||||||||||||||||||||||||
| 2022 | p->rotate(-90); | - | ||||||||||||||||||||||||
| 2023 | p->translate(-r.left(), -r.top()); | - | ||||||||||||||||||||||||
| 2024 | } never executed: end of block | 0 | ||||||||||||||||||||||||
| 2025 | - | |||||||||||||||||||||||||
| 2026 | const int indent = p->fontMetrics().descent(); | - | ||||||||||||||||||||||||
| 2027 | proxy()->drawItemText(p, r.adjusted(indent + 1, 1, -indent - 1, -1), | - | ||||||||||||||||||||||||
| 2028 | Qt::AlignLeft | Qt::AlignVCenter | Qt::TextShowMnemonic, dwOpt->palette, | - | ||||||||||||||||||||||||
| 2029 | dwOpt->state & State_Enabled, dwOpt->title, | - | ||||||||||||||||||||||||
| 2030 | QPalette::WindowText); | - | ||||||||||||||||||||||||
| 2031 | - | |||||||||||||||||||||||||
| 2032 | if (verticalTitleBar)
| 0 | ||||||||||||||||||||||||
| 2033 | p->restore(); never executed: p->restore(); | 0 | ||||||||||||||||||||||||
| 2034 | } never executed: end of block | 0 | ||||||||||||||||||||||||
| 2035 | } never executed: end of block | 0 | ||||||||||||||||||||||||
| 2036 | break; never executed: break; | 0 | ||||||||||||||||||||||||
| 2037 | #endif // QT_NO_DOCKWIDGET | - | ||||||||||||||||||||||||
| 2038 | case CE_Header: never executed: case CE_Header: | 0 | ||||||||||||||||||||||||
| 2039 | if (const QStyleOptionHeader *header = qstyleoption_cast<const QStyleOptionHeader *>(opt)) {
| 0 | ||||||||||||||||||||||||
| 2040 | QRegion clipRegion = p->clipRegion(); | - | ||||||||||||||||||||||||
| 2041 | p->setClipRect(opt->rect); | - | ||||||||||||||||||||||||
| 2042 | proxy()->drawControl(CE_HeaderSection, header, p, widget); | - | ||||||||||||||||||||||||
| 2043 | QStyleOptionHeader subopt = *header; | - | ||||||||||||||||||||||||
| 2044 | subopt.rect = subElementRect(SE_HeaderLabel, header, widget); | - | ||||||||||||||||||||||||
| 2045 | if (subopt.rect.isValid())
| 0 | ||||||||||||||||||||||||
| 2046 | proxy()->drawControl(CE_HeaderLabel, &subopt, p, widget); never executed: proxy()->drawControl(CE_HeaderLabel, &subopt, p, widget); | 0 | ||||||||||||||||||||||||
| 2047 | if (header->sortIndicator != QStyleOptionHeader::None) {
| 0 | ||||||||||||||||||||||||
| 2048 | subopt.rect = subElementRect(SE_HeaderArrow, opt, widget); | - | ||||||||||||||||||||||||
| 2049 | proxy()->drawPrimitive(PE_IndicatorHeaderArrow, &subopt, p, widget); | - | ||||||||||||||||||||||||
| 2050 | } never executed: end of block | 0 | ||||||||||||||||||||||||
| 2051 | p->setClipRegion(clipRegion); | - | ||||||||||||||||||||||||
| 2052 | } never executed: end of block | 0 | ||||||||||||||||||||||||
| 2053 | break; never executed: break; | 0 | ||||||||||||||||||||||||
| 2054 | case CE_FocusFrame: never executed: case CE_FocusFrame: | 0 | ||||||||||||||||||||||||
| 2055 | p->fillRect(opt->rect, opt->palette.foreground()); | - | ||||||||||||||||||||||||
| 2056 | break; never executed: break; | 0 | ||||||||||||||||||||||||
| 2057 | case CE_HeaderSection: never executed: case CE_HeaderSection: | 0 | ||||||||||||||||||||||||
| 2058 | qDrawShadePanel(p, opt->rect, opt->palette, | - | ||||||||||||||||||||||||
| 2059 | opt->state & State_Sunken, 1, | - | ||||||||||||||||||||||||
| 2060 | &opt->palette.brush(QPalette::Button)); | - | ||||||||||||||||||||||||
| 2061 | break; never executed: break; | 0 | ||||||||||||||||||||||||
| 2062 | case CE_HeaderEmptyArea: never executed: case CE_HeaderEmptyArea: | 0 | ||||||||||||||||||||||||
| 2063 | p->fillRect(opt->rect, opt->palette.background()); | - | ||||||||||||||||||||||||
| 2064 | break; never executed: break; | 0 | ||||||||||||||||||||||||
| 2065 | #ifndef QT_NO_COMBOBOX | - | ||||||||||||||||||||||||
| 2066 | case CE_ComboBoxLabel: never executed: case CE_ComboBoxLabel: | 0 | ||||||||||||||||||||||||
| 2067 | if (const QStyleOptionComboBox *cb = qstyleoption_cast<const QStyleOptionComboBox *>(opt)) {
| 0 | ||||||||||||||||||||||||
| 2068 | QRect editRect = proxy()->subControlRect(CC_ComboBox, cb, SC_ComboBoxEditField, widget); | - | ||||||||||||||||||||||||
| 2069 | p->save(); | - | ||||||||||||||||||||||||
| 2070 | p->setClipRect(editRect); | - | ||||||||||||||||||||||||
| 2071 | if (!cb->currentIcon.isNull()) {
| 0 | ||||||||||||||||||||||||
| 2072 | QIcon::Mode mode = cb->state & State_Enabled ? QIcon::Normal
| 0 | ||||||||||||||||||||||||
| 2073 | : QIcon::Disabled; | - | ||||||||||||||||||||||||
| 2074 | QPixmap pixmap = cb->currentIcon.pixmap(qt_getWindow(widget), cb->iconSize, mode); | - | ||||||||||||||||||||||||
| 2075 | QRect iconRect(editRect); | - | ||||||||||||||||||||||||
| 2076 | iconRect.setWidth(cb->iconSize.width() + 4); | - | ||||||||||||||||||||||||
| 2077 | iconRect = alignedRect(cb->direction, | - | ||||||||||||||||||||||||
| 2078 | Qt::AlignLeft | Qt::AlignVCenter, | - | ||||||||||||||||||||||||
| 2079 | iconRect.size(), editRect); | - | ||||||||||||||||||||||||
| 2080 | if (cb->editable)
| 0 | ||||||||||||||||||||||||
| 2081 | p->fillRect(iconRect, opt->palette.brush(QPalette::Base)); never executed: p->fillRect(iconRect, opt->palette.brush(QPalette::Base)); | 0 | ||||||||||||||||||||||||
| 2082 | proxy()->drawItemPixmap(p, iconRect, Qt::AlignCenter, pixmap); | - | ||||||||||||||||||||||||
| 2083 | - | |||||||||||||||||||||||||
| 2084 | if (cb->direction == Qt::RightToLeft)
| 0 | ||||||||||||||||||||||||
| 2085 | editRect.translate(-4 - cb->iconSize.width(), 0); never executed: editRect.translate(-4 - cb->iconSize.width(), 0); | 0 | ||||||||||||||||||||||||
| 2086 | else | - | ||||||||||||||||||||||||
| 2087 | editRect.translate(cb->iconSize.width() + 4, 0); never executed: editRect.translate(cb->iconSize.width() + 4, 0); | 0 | ||||||||||||||||||||||||
| 2088 | } | - | ||||||||||||||||||||||||
| 2089 | if (!cb->currentText.isEmpty() && !cb->editable) {
| 0 | ||||||||||||||||||||||||
| 2090 | proxy()->drawItemText(p, editRect.adjusted(1, 0, -1, 0), | - | ||||||||||||||||||||||||
| 2091 | visualAlignment(cb->direction, Qt::AlignLeft | Qt::AlignVCenter), | - | ||||||||||||||||||||||||
| 2092 | cb->palette, cb->state & State_Enabled, cb->currentText); | - | ||||||||||||||||||||||||
| 2093 | } never executed: end of block | 0 | ||||||||||||||||||||||||
| 2094 | p->restore(); | - | ||||||||||||||||||||||||
| 2095 | } never executed: end of block | 0 | ||||||||||||||||||||||||
| 2096 | break; never executed: break; | 0 | ||||||||||||||||||||||||
| 2097 | #endif // QT_NO_COMBOBOX | - | ||||||||||||||||||||||||
| 2098 | #ifndef QT_NO_TOOLBAR | - | ||||||||||||||||||||||||
| 2099 | case CE_ToolBar: never executed: case CE_ToolBar: | 0 | ||||||||||||||||||||||||
| 2100 | if (const QStyleOptionToolBar *toolBar = qstyleoption_cast<const QStyleOptionToolBar *>(opt)) {
| 0 | ||||||||||||||||||||||||
| 2101 | // Compatibility with styles that use PE_PanelToolBar | - | ||||||||||||||||||||||||
| 2102 | QStyleOptionFrame frame; | - | ||||||||||||||||||||||||
| 2103 | frame.QStyleOption::operator=(*toolBar); | - | ||||||||||||||||||||||||
| 2104 | frame.lineWidth = toolBar->lineWidth; | - | ||||||||||||||||||||||||
| 2105 | frame.midLineWidth = toolBar->midLineWidth; | - | ||||||||||||||||||||||||
| 2106 | proxy()->drawPrimitive(PE_PanelToolBar, opt, p, widget); | - | ||||||||||||||||||||||||
| 2107 | - | |||||||||||||||||||||||||
| 2108 | if (widget && qobject_cast<QToolBar *>(widget->parentWidget()))
| 0 | ||||||||||||||||||||||||
| 2109 | break; never executed: break; | 0 | ||||||||||||||||||||||||
| 2110 | qDrawShadePanel(p, toolBar->rect, toolBar->palette, false, toolBar->lineWidth, | - | ||||||||||||||||||||||||
| 2111 | &toolBar->palette.brush(QPalette::Button)); | - | ||||||||||||||||||||||||
| 2112 | } never executed: end of block | 0 | ||||||||||||||||||||||||
| 2113 | break; never executed: break; | 0 | ||||||||||||||||||||||||
| 2114 | #endif // QT_NO_TOOLBAR | - | ||||||||||||||||||||||||
| 2115 | case CE_ColumnViewGrip: { never executed: case CE_ColumnViewGrip: | 0 | ||||||||||||||||||||||||
| 2116 | // draw background gradients | - | ||||||||||||||||||||||||
| 2117 | QLinearGradient g(0, 0, opt->rect.width(), 0); | - | ||||||||||||||||||||||||
| 2118 | g.setColorAt(0, opt->palette.color(QPalette::Active, QPalette::Mid)); | - | ||||||||||||||||||||||||
| 2119 | g.setColorAt(0.5, Qt::white); | - | ||||||||||||||||||||||||
| 2120 | p->fillRect(QRect(0, 0, opt->rect.width(), opt->rect.height()), g); | - | ||||||||||||||||||||||||
| 2121 | - | |||||||||||||||||||||||||
| 2122 | // draw the two lines | - | ||||||||||||||||||||||||
| 2123 | QPen pen(p->pen()); | - | ||||||||||||||||||||||||
| 2124 | pen.setWidth(opt->rect.width()/20); | - | ||||||||||||||||||||||||
| 2125 | pen.setColor(opt->palette.color(QPalette::Active, QPalette::Dark)); | - | ||||||||||||||||||||||||
| 2126 | p->setPen(pen); | - | ||||||||||||||||||||||||
| 2127 | - | |||||||||||||||||||||||||
| 2128 | int line1starting = opt->rect.width()*8 / 20; | - | ||||||||||||||||||||||||
| 2129 | int line2starting = opt->rect.width()*13 / 20; | - | ||||||||||||||||||||||||
| 2130 | int top = opt->rect.height()*20/75; | - | ||||||||||||||||||||||||
| 2131 | int bottom = opt->rect.height() - 1 - top; | - | ||||||||||||||||||||||||
| 2132 | p->drawLine(line1starting, top, line1starting, bottom); | - | ||||||||||||||||||||||||
| 2133 | p->drawLine(line2starting, top, line2starting, bottom); | - | ||||||||||||||||||||||||
| 2134 | } | - | ||||||||||||||||||||||||
| 2135 | break; never executed: break; | 0 | ||||||||||||||||||||||||
| 2136 | - | |||||||||||||||||||||||||
| 2137 | #ifndef QT_NO_ITEMVIEWS | - | ||||||||||||||||||||||||
| 2138 | case CE_ItemViewItem: never executed: case CE_ItemViewItem: | 0 | ||||||||||||||||||||||||
| 2139 | if (const QStyleOptionViewItem *vopt = qstyleoption_cast<const QStyleOptionViewItem *>(opt)) {
| 0 | ||||||||||||||||||||||||
| 2140 | p->save(); | - | ||||||||||||||||||||||||
| 2141 | p->setClipRect(opt->rect); | - | ||||||||||||||||||||||||
| 2142 | - | |||||||||||||||||||||||||
| 2143 | QRect checkRect = proxy()->subElementRect(SE_ItemViewItemCheckIndicator, vopt, widget); | - | ||||||||||||||||||||||||
| 2144 | QRect iconRect = proxy()->subElementRect(SE_ItemViewItemDecoration, vopt, widget); | - | ||||||||||||||||||||||||
| 2145 | QRect textRect = proxy()->subElementRect(SE_ItemViewItemText, vopt, widget); | - | ||||||||||||||||||||||||
| 2146 | - | |||||||||||||||||||||||||
| 2147 | // draw the background | - | ||||||||||||||||||||||||
| 2148 | proxy()->drawPrimitive(PE_PanelItemViewItem, opt, p, widget); | - | ||||||||||||||||||||||||
| 2149 | - | |||||||||||||||||||||||||
| 2150 | // draw the check mark | - | ||||||||||||||||||||||||
| 2151 | if (vopt->features & QStyleOptionViewItem::HasCheckIndicator) {
| 0 | ||||||||||||||||||||||||
| 2152 | QStyleOptionViewItem option(*vopt); | - | ||||||||||||||||||||||||
| 2153 | option.rect = checkRect; | - | ||||||||||||||||||||||||
| 2154 | option.state = option.state & ~QStyle::State_HasFocus; | - | ||||||||||||||||||||||||
| 2155 | - | |||||||||||||||||||||||||
| 2156 | switch (vopt->checkState) { | - | ||||||||||||||||||||||||
| 2157 | case Qt::Unchecked: never executed: case Qt::Unchecked: | 0 | ||||||||||||||||||||||||
| 2158 | option.state |= QStyle::State_Off; | - | ||||||||||||||||||||||||
| 2159 | break; never executed: break; | 0 | ||||||||||||||||||||||||
| 2160 | case Qt::PartiallyChecked: never executed: case Qt::PartiallyChecked: | 0 | ||||||||||||||||||||||||
| 2161 | option.state |= QStyle::State_NoChange; | - | ||||||||||||||||||||||||
| 2162 | break; never executed: break; | 0 | ||||||||||||||||||||||||
| 2163 | case Qt::Checked: never executed: case Qt::Checked: | 0 | ||||||||||||||||||||||||
| 2164 | option.state |= QStyle::State_On; | - | ||||||||||||||||||||||||
| 2165 | break; never executed: break; | 0 | ||||||||||||||||||||||||
| 2166 | } | - | ||||||||||||||||||||||||
| 2167 | proxy()->drawPrimitive(QStyle::PE_IndicatorViewItemCheck, &option, p, widget); | - | ||||||||||||||||||||||||
| 2168 | } never executed: end of block | 0 | ||||||||||||||||||||||||
| 2169 | - | |||||||||||||||||||||||||
| 2170 | // draw the icon | - | ||||||||||||||||||||||||
| 2171 | QIcon::Mode mode = QIcon::Normal; | - | ||||||||||||||||||||||||
| 2172 | if (!(vopt->state & QStyle::State_Enabled))
| 0 | ||||||||||||||||||||||||
| 2173 | mode = QIcon::Disabled; never executed: mode = QIcon::Disabled; | 0 | ||||||||||||||||||||||||
| 2174 | else if (vopt->state & QStyle::State_Selected)
| 0 | ||||||||||||||||||||||||
| 2175 | mode = QIcon::Selected; never executed: mode = QIcon::Selected; | 0 | ||||||||||||||||||||||||
| 2176 | QIcon::State state = vopt->state & QStyle::State_Open ? QIcon::On : QIcon::Off;
| 0 | ||||||||||||||||||||||||
| 2177 | vopt->icon.paint(p, iconRect, vopt->decorationAlignment, mode, state); | - | ||||||||||||||||||||||||
| 2178 | - | |||||||||||||||||||||||||
| 2179 | // draw the text | - | ||||||||||||||||||||||||
| 2180 | if (!vopt->text.isEmpty()) {
| 0 | ||||||||||||||||||||||||
| 2181 | QPalette::ColorGroup cg = vopt->state & QStyle::State_Enabled
| 0 | ||||||||||||||||||||||||
| 2182 | ? QPalette::Normal : QPalette::Disabled; | - | ||||||||||||||||||||||||
| 2183 | if (cg == QPalette::Normal && !(vopt->state & QStyle::State_Active))
| 0 | ||||||||||||||||||||||||
| 2184 | cg = QPalette::Inactive; never executed: cg = QPalette::Inactive; | 0 | ||||||||||||||||||||||||
| 2185 | - | |||||||||||||||||||||||||
| 2186 | if (vopt->state & QStyle::State_Selected) {
| 0 | ||||||||||||||||||||||||
| 2187 | p->setPen(vopt->palette.color(cg, QPalette::HighlightedText)); | - | ||||||||||||||||||||||||
| 2188 | } else { never executed: end of block | 0 | ||||||||||||||||||||||||
| 2189 | p->setPen(vopt->palette.color(cg, QPalette::Text)); | - | ||||||||||||||||||||||||
| 2190 | } never executed: end of block | 0 | ||||||||||||||||||||||||
| 2191 | if (vopt->state & QStyle::State_Editing) {
| 0 | ||||||||||||||||||||||||
| 2192 | p->setPen(vopt->palette.color(cg, QPalette::Text)); | - | ||||||||||||||||||||||||
| 2193 | p->drawRect(textRect.adjusted(0, 0, -1, -1)); | - | ||||||||||||||||||||||||
| 2194 | } never executed: end of block | 0 | ||||||||||||||||||||||||
| 2195 | - | |||||||||||||||||||||||||
| 2196 | d->viewItemDrawText(p, vopt, textRect); | - | ||||||||||||||||||||||||
| 2197 | } never executed: end of block | 0 | ||||||||||||||||||||||||
| 2198 | - | |||||||||||||||||||||||||
| 2199 | // draw the focus rect | - | ||||||||||||||||||||||||
| 2200 | if (vopt->state & QStyle::State_HasFocus) {
| 0 | ||||||||||||||||||||||||
| 2201 | QStyleOptionFocusRect o; | - | ||||||||||||||||||||||||
| 2202 | o.QStyleOption::operator=(*vopt); | - | ||||||||||||||||||||||||
| 2203 | o.rect = proxy()->subElementRect(SE_ItemViewItemFocusRect, vopt, widget); | - | ||||||||||||||||||||||||
| 2204 | o.state |= QStyle::State_KeyboardFocusChange; | - | ||||||||||||||||||||||||
| 2205 | o.state |= QStyle::State_Item; | - | ||||||||||||||||||||||||
| 2206 | QPalette::ColorGroup cg = (vopt->state & QStyle::State_Enabled)
| 0 | ||||||||||||||||||||||||
| 2207 | ? QPalette::Normal : QPalette::Disabled; | - | ||||||||||||||||||||||||
| 2208 | o.backgroundColor = vopt->palette.color(cg, (vopt->state & QStyle::State_Selected) | - | ||||||||||||||||||||||||
| 2209 | ? QPalette::Highlight : QPalette::Window); | - | ||||||||||||||||||||||||
| 2210 | proxy()->drawPrimitive(QStyle::PE_FrameFocusRect, &o, p, widget); | - | ||||||||||||||||||||||||
| 2211 | } never executed: end of block | 0 | ||||||||||||||||||||||||
| 2212 | - | |||||||||||||||||||||||||
| 2213 | p->restore(); | - | ||||||||||||||||||||||||
| 2214 | } never executed: end of block | 0 | ||||||||||||||||||||||||
| 2215 | break; never executed: break; | 0 | ||||||||||||||||||||||||
| 2216 | - | |||||||||||||||||||||||||
| 2217 | #endif // QT_NO_ITEMVIEWS | - | ||||||||||||||||||||||||
| 2218 | #ifndef QT_NO_FRAME | - | ||||||||||||||||||||||||
| 2219 | case CE_ShapedFrame: never executed: case CE_ShapedFrame: | 0 | ||||||||||||||||||||||||
| 2220 | if (const QStyleOptionFrame *f = qstyleoption_cast<const QStyleOptionFrame *>(opt)) {
| 0 | ||||||||||||||||||||||||
| 2221 | int frameShape = f->frameShape; | - | ||||||||||||||||||||||||
| 2222 | int frameShadow = QFrame::Plain; | - | ||||||||||||||||||||||||
| 2223 | if (f->state & QStyle::State_Sunken) {
| 0 | ||||||||||||||||||||||||
| 2224 | frameShadow = QFrame::Sunken; | - | ||||||||||||||||||||||||
| 2225 | } else if (f->state & QStyle::State_Raised) { never executed: end of block
| 0 | ||||||||||||||||||||||||
| 2226 | frameShadow = QFrame::Raised; | - | ||||||||||||||||||||||||
| 2227 | } never executed: end of block | 0 | ||||||||||||||||||||||||
| 2228 | - | |||||||||||||||||||||||||
| 2229 | int lw = f->lineWidth; | - | ||||||||||||||||||||||||
| 2230 | int mlw = f->midLineWidth; | - | ||||||||||||||||||||||||
| 2231 | QPalette::ColorRole foregroundRole = QPalette::WindowText; | - | ||||||||||||||||||||||||
| 2232 | if (widget)
| 0 | ||||||||||||||||||||||||
| 2233 | foregroundRole = widget->foregroundRole(); never executed: foregroundRole = widget->foregroundRole(); | 0 | ||||||||||||||||||||||||
| 2234 | - | |||||||||||||||||||||||||
| 2235 | switch (frameShape) { | - | ||||||||||||||||||||||||
| 2236 | case QFrame::Box: never executed: case QFrame::Box: | 0 | ||||||||||||||||||||||||
| 2237 | if (frameShadow == QFrame::Plain) {
| 0 | ||||||||||||||||||||||||
| 2238 | qDrawPlainRect(p, f->rect, f->palette.color(foregroundRole), lw); | - | ||||||||||||||||||||||||
| 2239 | } else { never executed: end of block | 0 | ||||||||||||||||||||||||
| 2240 | qDrawShadeRect(p, f->rect, f->palette, frameShadow == QFrame::Sunken, lw, mlw); | - | ||||||||||||||||||||||||
| 2241 | } never executed: end of block | 0 | ||||||||||||||||||||||||
| 2242 | break; never executed: break; | 0 | ||||||||||||||||||||||||
| 2243 | case QFrame::StyledPanel: never executed: case QFrame::StyledPanel: | 0 | ||||||||||||||||||||||||
| 2244 | //keep the compatibility with Qt 4.4 if there is a proxy style. | - | ||||||||||||||||||||||||
| 2245 | //be sure to call drawPrimitive(QStyle::PE_Frame) on the proxy style | - | ||||||||||||||||||||||||
| 2246 | if (widget) {
| 0 | ||||||||||||||||||||||||
| 2247 | widget->style()->drawPrimitive(QStyle::PE_Frame, opt, p, widget); | - | ||||||||||||||||||||||||
| 2248 | } else { never executed: end of block | 0 | ||||||||||||||||||||||||
| 2249 | proxy()->drawPrimitive(QStyle::PE_Frame, opt, p, widget); | - | ||||||||||||||||||||||||
| 2250 | } never executed: end of block | 0 | ||||||||||||||||||||||||
| 2251 | break; never executed: break; | 0 | ||||||||||||||||||||||||
| 2252 | case QFrame::Panel: never executed: case QFrame::Panel: | 0 | ||||||||||||||||||||||||
| 2253 | if (frameShadow == QFrame::Plain) {
| 0 | ||||||||||||||||||||||||
| 2254 | qDrawPlainRect(p, f->rect, f->palette.color(foregroundRole), lw); | - | ||||||||||||||||||||||||
| 2255 | } else { never executed: end of block | 0 | ||||||||||||||||||||||||
| 2256 | qDrawShadePanel(p, f->rect, f->palette, frameShadow == QFrame::Sunken, lw); | - | ||||||||||||||||||||||||
| 2257 | } never executed: end of block | 0 | ||||||||||||||||||||||||
| 2258 | break; never executed: break; | 0 | ||||||||||||||||||||||||
| 2259 | case QFrame::WinPanel: never executed: case QFrame::WinPanel: | 0 | ||||||||||||||||||||||||
| 2260 | if (frameShadow == QFrame::Plain) {
| 0 | ||||||||||||||||||||||||
| 2261 | qDrawPlainRect(p, f->rect, f->palette.color(foregroundRole), lw); | - | ||||||||||||||||||||||||
| 2262 | } else { never executed: end of block | 0 | ||||||||||||||||||||||||
| 2263 | qDrawWinPanel(p, f->rect, f->palette, frameShadow == QFrame::Sunken); | - | ||||||||||||||||||||||||
| 2264 | } never executed: end of block | 0 | ||||||||||||||||||||||||
| 2265 | break; never executed: break; | 0 | ||||||||||||||||||||||||
| 2266 | case QFrame::HLine: never executed: case QFrame::HLine: | 0 | ||||||||||||||||||||||||
| 2267 | case QFrame::VLine: { never executed: case QFrame::VLine: | 0 | ||||||||||||||||||||||||
| 2268 | QPoint p1, p2; | - | ||||||||||||||||||||||||
| 2269 | if (frameShape == QFrame::HLine) {
| 0 | ||||||||||||||||||||||||
| 2270 | p1 = QPoint(opt->rect.x(), opt->rect.y() + opt->rect.height() / 2); | - | ||||||||||||||||||||||||
| 2271 | p2 = QPoint(opt->rect.x() + opt->rect.width(), p1.y()); | - | ||||||||||||||||||||||||
| 2272 | } else { never executed: end of block | 0 | ||||||||||||||||||||||||
| 2273 | p1 = QPoint(opt->rect.x() + opt->rect.width() / 2, opt->rect.y()); | - | ||||||||||||||||||||||||
| 2274 | p2 = QPoint(p1.x(), p1.y() + opt->rect.height()); | - | ||||||||||||||||||||||||
| 2275 | } never executed: end of block | 0 | ||||||||||||||||||||||||
| 2276 | if (frameShadow == QFrame::Plain) {
| 0 | ||||||||||||||||||||||||
| 2277 | QPen oldPen = p->pen(); | - | ||||||||||||||||||||||||
| 2278 | p->setPen(QPen(opt->palette.brush(foregroundRole), lw)); | - | ||||||||||||||||||||||||
| 2279 | p->drawLine(p1, p2); | - | ||||||||||||||||||||||||
| 2280 | p->setPen(oldPen); | - | ||||||||||||||||||||||||
| 2281 | } else { never executed: end of block | 0 | ||||||||||||||||||||||||
| 2282 | qDrawShadeLine(p, p1, p2, f->palette, frameShadow == QFrame::Sunken, lw, mlw); | - | ||||||||||||||||||||||||
| 2283 | } never executed: end of block | 0 | ||||||||||||||||||||||||
| 2284 | break; never executed: break; | 0 | ||||||||||||||||||||||||
| 2285 | } | - | ||||||||||||||||||||||||
| 2286 | } | - | ||||||||||||||||||||||||
| 2287 | } never executed: end of block | 0 | ||||||||||||||||||||||||
| 2288 | break; never executed: break; | 0 | ||||||||||||||||||||||||
| 2289 | #endif | - | ||||||||||||||||||||||||
| 2290 | default: never executed: default: | 0 | ||||||||||||||||||||||||
| 2291 | break; never executed: break; | 0 | ||||||||||||||||||||||||
| 2292 | } | - | ||||||||||||||||||||||||
| 2293 | } | - | ||||||||||||||||||||||||
| 2294 | - | |||||||||||||||||||||||||
| 2295 | /*! | - | ||||||||||||||||||||||||
| 2296 | \reimp | - | ||||||||||||||||||||||||
| 2297 | */ | - | ||||||||||||||||||||||||
| 2298 | QRect QCommonStyle::subElementRect(SubElement sr, const QStyleOption *opt, | - | ||||||||||||||||||||||||
| 2299 | const QWidget *widget) const | - | ||||||||||||||||||||||||
| 2300 | { | - | ||||||||||||||||||||||||
| 2301 | Q_D(const QCommonStyle); | - | ||||||||||||||||||||||||
| 2302 | QRect r; | - | ||||||||||||||||||||||||
| 2303 | switch (sr) { | - | ||||||||||||||||||||||||
| 2304 | case SE_PushButtonContents: never executed: case SE_PushButtonContents: | 0 | ||||||||||||||||||||||||
| 2305 | if (const QStyleOptionButton *btn = qstyleoption_cast<const QStyleOptionButton *>(opt)) {
| 0 | ||||||||||||||||||||||||
| 2306 | int dx1, dx2; | - | ||||||||||||||||||||||||
| 2307 | dx1 = proxy()->pixelMetric(PM_DefaultFrameWidth, btn, widget); | - | ||||||||||||||||||||||||
| 2308 | if (btn->features & QStyleOptionButton::AutoDefaultButton)
| 0 | ||||||||||||||||||||||||
| 2309 | dx1 += proxy()->pixelMetric(PM_ButtonDefaultIndicator, btn, widget); never executed: dx1 += proxy()->pixelMetric(PM_ButtonDefaultIndicator, btn, widget); | 0 | ||||||||||||||||||||||||
| 2310 | dx2 = dx1 * 2; | - | ||||||||||||||||||||||||
| 2311 | r.setRect(opt->rect.x() + dx1, opt->rect.y() + dx1, opt->rect.width() - dx2, | - | ||||||||||||||||||||||||
| 2312 | opt->rect.height() - dx2); | - | ||||||||||||||||||||||||
| 2313 | r = visualRect(opt->direction, opt->rect, r); | - | ||||||||||||||||||||||||
| 2314 | } never executed: end of block | 0 | ||||||||||||||||||||||||
| 2315 | break; never executed: break; | 0 | ||||||||||||||||||||||||
| 2316 | case SE_PushButtonFocusRect: never executed: case SE_PushButtonFocusRect: | 0 | ||||||||||||||||||||||||
| 2317 | if (const QStyleOptionButton *btn = qstyleoption_cast<const QStyleOptionButton *>(opt)) {
| 0 | ||||||||||||||||||||||||
| 2318 | int dbw1 = 0, dbw2 = 0; | - | ||||||||||||||||||||||||
| 2319 | if (btn->features & QStyleOptionButton::AutoDefaultButton){
| 0 | ||||||||||||||||||||||||
| 2320 | dbw1 = proxy()->pixelMetric(PM_ButtonDefaultIndicator, btn, widget); | - | ||||||||||||||||||||||||
| 2321 | dbw2 = dbw1 * 2; | - | ||||||||||||||||||||||||
| 2322 | } never executed: end of block | 0 | ||||||||||||||||||||||||
| 2323 | - | |||||||||||||||||||||||||
| 2324 | int dfw1 = proxy()->pixelMetric(PM_DefaultFrameWidth, btn, widget) + 1, | - | ||||||||||||||||||||||||
| 2325 | dfw2 = dfw1 * 2; | - | ||||||||||||||||||||||||
| 2326 | - | |||||||||||||||||||||||||
| 2327 | r.setRect(btn->rect.x() + dfw1 + dbw1, btn->rect.y() + dfw1 + dbw1, | - | ||||||||||||||||||||||||
| 2328 | btn->rect.width() - dfw2 - dbw2, btn->rect.height()- dfw2 - dbw2); | - | ||||||||||||||||||||||||
| 2329 | r = visualRect(opt->direction, opt->rect, r); | - | ||||||||||||||||||||||||
| 2330 | } never executed: end of block | 0 | ||||||||||||||||||||||||
| 2331 | break; never executed: break; | 0 | ||||||||||||||||||||||||
| 2332 | case SE_CheckBoxIndicator: never executed: case SE_CheckBoxIndicator: | 0 | ||||||||||||||||||||||||
| 2333 | { | - | ||||||||||||||||||||||||
| 2334 | int h = proxy()->pixelMetric(PM_IndicatorHeight, opt, widget); | - | ||||||||||||||||||||||||
| 2335 | r.setRect(opt->rect.x(), opt->rect.y() + ((opt->rect.height() - h) / 2), | - | ||||||||||||||||||||||||
| 2336 | proxy()->pixelMetric(PM_IndicatorWidth, opt, widget), h); | - | ||||||||||||||||||||||||
| 2337 | r = visualRect(opt->direction, opt->rect, r); | - | ||||||||||||||||||||||||
| 2338 | } | - | ||||||||||||||||||||||||
| 2339 | break; never executed: break; | 0 | ||||||||||||||||||||||||
| 2340 | - | |||||||||||||||||||||||||
| 2341 | case SE_CheckBoxContents: never executed: case SE_CheckBoxContents: | 0 | ||||||||||||||||||||||||
| 2342 | { | - | ||||||||||||||||||||||||
| 2343 | // Deal with the logical first, then convert it back to screen coords. | - | ||||||||||||||||||||||||
| 2344 | QRect ir = visualRect(opt->direction, opt->rect, | - | ||||||||||||||||||||||||
| 2345 | subElementRect(SE_CheckBoxIndicator, opt, widget)); | - | ||||||||||||||||||||||||
| 2346 | int spacing = proxy()->pixelMetric(PM_CheckBoxLabelSpacing, opt, widget); | - | ||||||||||||||||||||||||
| 2347 | r.setRect(ir.right() + spacing, opt->rect.y(), opt->rect.width() - ir.width() - spacing, | - | ||||||||||||||||||||||||
| 2348 | opt->rect.height()); | - | ||||||||||||||||||||||||
| 2349 | r = visualRect(opt->direction, opt->rect, r); | - | ||||||||||||||||||||||||
| 2350 | } | - | ||||||||||||||||||||||||
| 2351 | break; never executed: break; | 0 | ||||||||||||||||||||||||
| 2352 | - | |||||||||||||||||||||||||
| 2353 | case SE_CheckBoxFocusRect: never executed: case SE_CheckBoxFocusRect: | 0 | ||||||||||||||||||||||||
| 2354 | if (const QStyleOptionButton *btn = qstyleoption_cast<const QStyleOptionButton *>(opt)) {
| 0 | ||||||||||||||||||||||||
| 2355 | if (btn->icon.isNull() && btn->text.isEmpty()) {
| 0 | ||||||||||||||||||||||||
| 2356 | r = subElementRect(SE_CheckBoxIndicator, opt, widget); | - | ||||||||||||||||||||||||
| 2357 | r.adjust(1, 1, -1, -1); | - | ||||||||||||||||||||||||
| 2358 | break; never executed: break; | 0 | ||||||||||||||||||||||||
| 2359 | } | - | ||||||||||||||||||||||||
| 2360 | // As above, deal with the logical first, then convert it back to screen coords. | - | ||||||||||||||||||||||||
| 2361 | QRect cr = visualRect(btn->direction, btn->rect, | - | ||||||||||||||||||||||||
| 2362 | subElementRect(SE_CheckBoxContents, btn, widget)); | - | ||||||||||||||||||||||||
| 2363 | - | |||||||||||||||||||||||||
| 2364 | QRect iconRect, textRect; | - | ||||||||||||||||||||||||
| 2365 | if (!btn->text.isEmpty()) {
| 0 | ||||||||||||||||||||||||
| 2366 | textRect = itemTextRect(opt->fontMetrics, cr, Qt::AlignAbsolute | Qt::AlignLeft | - | ||||||||||||||||||||||||
| 2367 | | Qt::AlignVCenter | Qt::TextShowMnemonic, | - | ||||||||||||||||||||||||
| 2368 | btn->state & State_Enabled, btn->text); | - | ||||||||||||||||||||||||
| 2369 | } never executed: end of block | 0 | ||||||||||||||||||||||||
| 2370 | if (!btn->icon.isNull()) {
| 0 | ||||||||||||||||||||||||
| 2371 | iconRect = itemPixmapRect(cr, Qt::AlignAbsolute | Qt::AlignLeft | Qt::AlignVCenter | - | ||||||||||||||||||||||||
| 2372 | | Qt::TextShowMnemonic, | - | ||||||||||||||||||||||||
| 2373 | btn->icon.pixmap(qt_getWindow(widget), btn->iconSize, QIcon::Normal)); | - | ||||||||||||||||||||||||
| 2374 | if (!textRect.isEmpty())
| 0 | ||||||||||||||||||||||||
| 2375 | textRect.translate(iconRect.right() + 4, 0); never executed: textRect.translate(iconRect.right() + 4, 0); | 0 | ||||||||||||||||||||||||
| 2376 | } never executed: end of block | 0 | ||||||||||||||||||||||||
| 2377 | r = iconRect | textRect; | - | ||||||||||||||||||||||||
| 2378 | r.adjust(-3, -2, 3, 2); | - | ||||||||||||||||||||||||
| 2379 | r = r.intersected(btn->rect); | - | ||||||||||||||||||||||||
| 2380 | r = visualRect(btn->direction, btn->rect, r); | - | ||||||||||||||||||||||||
| 2381 | } never executed: end of block | 0 | ||||||||||||||||||||||||
| 2382 | break; never executed: break; | 0 | ||||||||||||||||||||||||
| 2383 | - | |||||||||||||||||||||||||
| 2384 | case SE_RadioButtonIndicator: never executed: case SE_RadioButtonIndicator: | 0 | ||||||||||||||||||||||||
| 2385 | { | - | ||||||||||||||||||||||||
| 2386 | int h = proxy()->pixelMetric(PM_ExclusiveIndicatorHeight, opt, widget); | - | ||||||||||||||||||||||||
| 2387 | r.setRect(opt->rect.x(), opt->rect.y() + ((opt->rect.height() - h) / 2), | - | ||||||||||||||||||||||||
| 2388 | proxy()->pixelMetric(PM_ExclusiveIndicatorWidth, opt, widget), h); | - | ||||||||||||||||||||||||
| 2389 | r = visualRect(opt->direction, opt->rect, r); | - | ||||||||||||||||||||||||
| 2390 | } | - | ||||||||||||||||||||||||
| 2391 | break; never executed: break; | 0 | ||||||||||||||||||||||||
| 2392 | - | |||||||||||||||||||||||||
| 2393 | case SE_RadioButtonContents: never executed: case SE_RadioButtonContents: | 0 | ||||||||||||||||||||||||
| 2394 | { | - | ||||||||||||||||||||||||
| 2395 | QRect ir = visualRect(opt->direction, opt->rect, | - | ||||||||||||||||||||||||
| 2396 | subElementRect(SE_RadioButtonIndicator, opt, widget)); | - | ||||||||||||||||||||||||
| 2397 | int spacing = proxy()->pixelMetric(PM_RadioButtonLabelSpacing, opt, widget); | - | ||||||||||||||||||||||||
| 2398 | r.setRect(ir.left() + ir.width() + spacing, opt->rect.y(), opt->rect.width() - ir.width() - spacing, | - | ||||||||||||||||||||||||
| 2399 | opt->rect.height()); | - | ||||||||||||||||||||||||
| 2400 | r = visualRect(opt->direction, opt->rect, r); | - | ||||||||||||||||||||||||
| 2401 | break; never executed: break; | 0 | ||||||||||||||||||||||||
| 2402 | } | - | ||||||||||||||||||||||||
| 2403 | - | |||||||||||||||||||||||||
| 2404 | case SE_RadioButtonFocusRect: never executed: case SE_RadioButtonFocusRect: | 0 | ||||||||||||||||||||||||
| 2405 | if (const QStyleOptionButton *btn = qstyleoption_cast<const QStyleOptionButton *>(opt)) {
| 0 | ||||||||||||||||||||||||
| 2406 | if (btn->icon.isNull() && btn->text.isEmpty()) {
| 0 | ||||||||||||||||||||||||
| 2407 | r = subElementRect(SE_RadioButtonIndicator, opt, widget); | - | ||||||||||||||||||||||||
| 2408 | r.adjust(1, 1, -1, -1); | - | ||||||||||||||||||||||||
| 2409 | break; never executed: break; | 0 | ||||||||||||||||||||||||
| 2410 | } | - | ||||||||||||||||||||||||
| 2411 | QRect cr = visualRect(btn->direction, btn->rect, | - | ||||||||||||||||||||||||
| 2412 | subElementRect(SE_RadioButtonContents, opt, widget)); | - | ||||||||||||||||||||||||
| 2413 | - | |||||||||||||||||||||||||
| 2414 | QRect iconRect, textRect; | - | ||||||||||||||||||||||||
| 2415 | if (!btn->text.isEmpty()){
| 0 | ||||||||||||||||||||||||
| 2416 | textRect = itemTextRect(opt->fontMetrics, cr, Qt::AlignAbsolute | Qt::AlignLeft | Qt::AlignVCenter | - | ||||||||||||||||||||||||
| 2417 | | Qt::TextShowMnemonic, btn->state & State_Enabled, btn->text); | - | ||||||||||||||||||||||||
| 2418 | } never executed: end of block | 0 | ||||||||||||||||||||||||
| 2419 | if (!btn->icon.isNull()) {
| 0 | ||||||||||||||||||||||||
| 2420 | iconRect = itemPixmapRect(cr, Qt::AlignAbsolute | Qt::AlignLeft | Qt::AlignVCenter | Qt::TextShowMnemonic, | - | ||||||||||||||||||||||||
| 2421 | btn->icon.pixmap(qt_getWindow(widget), btn->iconSize, QIcon::Normal)); | - | ||||||||||||||||||||||||
| 2422 | if (!textRect.isEmpty())
| 0 | ||||||||||||||||||||||||
| 2423 | textRect.translate(iconRect.right() + 4, 0); never executed: textRect.translate(iconRect.right() + 4, 0); | 0 | ||||||||||||||||||||||||
| 2424 | } never executed: end of block | 0 | ||||||||||||||||||||||||
| 2425 | r = iconRect | textRect; | - | ||||||||||||||||||||||||
| 2426 | r.adjust(-3, -2, 3, 2); | - | ||||||||||||||||||||||||
| 2427 | r = r.intersected(btn->rect); | - | ||||||||||||||||||||||||
| 2428 | r = visualRect(btn->direction, btn->rect, r); | - | ||||||||||||||||||||||||
| 2429 | } never executed: end of block | 0 | ||||||||||||||||||||||||
| 2430 | break; never executed: break; | 0 | ||||||||||||||||||||||||
| 2431 | #ifndef QT_NO_SLIDER | - | ||||||||||||||||||||||||
| 2432 | case SE_SliderFocusRect: never executed: case SE_SliderFocusRect: | 0 | ||||||||||||||||||||||||
| 2433 | if (const QStyleOptionSlider *slider = qstyleoption_cast<const QStyleOptionSlider *>(opt)) {
| 0 | ||||||||||||||||||||||||
| 2434 | int tickOffset = proxy()->pixelMetric(PM_SliderTickmarkOffset, slider, widget); | - | ||||||||||||||||||||||||
| 2435 | int thickness = proxy()->pixelMetric(PM_SliderControlThickness, slider, widget); | - | ||||||||||||||||||||||||
| 2436 | if (slider->orientation == Qt::Horizontal)
| 0 | ||||||||||||||||||||||||
| 2437 | r.setRect(0, tickOffset - 1, slider->rect.width(), thickness + 2); never executed: r.setRect(0, tickOffset - 1, slider->rect.width(), thickness + 2); | 0 | ||||||||||||||||||||||||
| 2438 | else | - | ||||||||||||||||||||||||
| 2439 | r.setRect(tickOffset - 1, 0, thickness + 2, slider->rect.height()); never executed: r.setRect(tickOffset - 1, 0, thickness + 2, slider->rect.height()); | 0 | ||||||||||||||||||||||||
| 2440 | r = r.intersected(slider->rect); | - | ||||||||||||||||||||||||
| 2441 | r = visualRect(opt->direction, opt->rect, r); | - | ||||||||||||||||||||||||
| 2442 | } never executed: end of block | 0 | ||||||||||||||||||||||||
| 2443 | break; never executed: break; | 0 | ||||||||||||||||||||||||
| 2444 | #endif // QT_NO_SLIDER | - | ||||||||||||||||||||||||
| 2445 | #ifndef QT_NO_PROGRESSBAR | - | ||||||||||||||||||||||||
| 2446 | case SE_ProgressBarGroove: never executed: case SE_ProgressBarGroove: | 0 | ||||||||||||||||||||||||
| 2447 | case SE_ProgressBarContents: never executed: case SE_ProgressBarContents: | 0 | ||||||||||||||||||||||||
| 2448 | case SE_ProgressBarLabel: never executed: case SE_ProgressBarLabel: | 0 | ||||||||||||||||||||||||
| 2449 | if (const QStyleOptionProgressBar *pb = qstyleoption_cast<const QStyleOptionProgressBar *>(opt)) {
| 0 | ||||||||||||||||||||||||
| 2450 | int textw = 0; | - | ||||||||||||||||||||||||
| 2451 | const bool vertical = pb->orientation == Qt::Vertical; | - | ||||||||||||||||||||||||
| 2452 | if (!vertical) {
| 0 | ||||||||||||||||||||||||
| 2453 | if (pb->textVisible)
| 0 | ||||||||||||||||||||||||
| 2454 | textw = qMax(pb->fontMetrics.width(pb->text), pb->fontMetrics.width(QLatin1String("100%"))) + 6; never executed: textw = qMax(pb->fontMetrics.width(pb->text), pb->fontMetrics.width(QLatin1String("100%"))) + 6; | 0 | ||||||||||||||||||||||||
| 2455 | } never executed: end of block | 0 | ||||||||||||||||||||||||
| 2456 | - | |||||||||||||||||||||||||
| 2457 | if ((pb->textAlignment & Qt::AlignCenter) == 0) {
| 0 | ||||||||||||||||||||||||
| 2458 | if (sr != SE_ProgressBarLabel)
| 0 | ||||||||||||||||||||||||
| 2459 | r.setCoords(pb->rect.left(), pb->rect.top(), never executed: r.setCoords(pb->rect.left(), pb->rect.top(), pb->rect.right() - textw, pb->rect.bottom()); | 0 | ||||||||||||||||||||||||
| 2460 | pb->rect.right() - textw, pb->rect.bottom()); never executed: r.setCoords(pb->rect.left(), pb->rect.top(), pb->rect.right() - textw, pb->rect.bottom()); | 0 | ||||||||||||||||||||||||
| 2461 | else | - | ||||||||||||||||||||||||
| 2462 | r.setCoords(pb->rect.right() - textw, pb->rect.top(), never executed: r.setCoords(pb->rect.right() - textw, pb->rect.top(), pb->rect.right(), pb->rect.bottom()); | 0 | ||||||||||||||||||||||||
| 2463 | pb->rect.right(), pb->rect.bottom()); never executed: r.setCoords(pb->rect.right() - textw, pb->rect.top(), pb->rect.right(), pb->rect.bottom()); | 0 | ||||||||||||||||||||||||
| 2464 | } else { | - | ||||||||||||||||||||||||
| 2465 | r = pb->rect; | - | ||||||||||||||||||||||||
| 2466 | } never executed: end of block | 0 | ||||||||||||||||||||||||
| 2467 | r = visualRect(pb->direction, pb->rect, r); | - | ||||||||||||||||||||||||
| 2468 | } never executed: end of block | 0 | ||||||||||||||||||||||||
| 2469 | break; never executed: break; | 0 | ||||||||||||||||||||||||
| 2470 | #endif // QT_NO_PROGRESSBAR | - | ||||||||||||||||||||||||
| 2471 | #ifndef QT_NO_COMBOBOX | - | ||||||||||||||||||||||||
| 2472 | case SE_ComboBoxFocusRect: never executed: case SE_ComboBoxFocusRect: | 0 | ||||||||||||||||||||||||
| 2473 | if (const QStyleOptionComboBox *cb = qstyleoption_cast<const QStyleOptionComboBox *>(opt)) {
| 0 | ||||||||||||||||||||||||
| 2474 | int margin = cb->frame ? 3 : 0;
| 0 | ||||||||||||||||||||||||
| 2475 | r.setRect(opt->rect.left() + margin, opt->rect.top() + margin, | - | ||||||||||||||||||||||||
| 2476 | opt->rect.width() - 2*margin - 16, opt->rect.height() - 2*margin); | - | ||||||||||||||||||||||||
| 2477 | r = visualRect(opt->direction, opt->rect, r); | - | ||||||||||||||||||||||||
| 2478 | } never executed: end of block | 0 | ||||||||||||||||||||||||
| 2479 | break; never executed: break; | 0 | ||||||||||||||||||||||||
| 2480 | #endif // QT_NO_COMBOBOX | - | ||||||||||||||||||||||||
| 2481 | #ifndef QT_NO_TOOLBOX | - | ||||||||||||||||||||||||
| 2482 | case SE_ToolBoxTabContents: never executed: case SE_ToolBoxTabContents: | 0 | ||||||||||||||||||||||||
| 2483 | r = opt->rect; | - | ||||||||||||||||||||||||
| 2484 | r.adjust(0, 0, -30, 0); | - | ||||||||||||||||||||||||
| 2485 | break; never executed: break; | 0 | ||||||||||||||||||||||||
| 2486 | #endif // QT_NO_TOOLBOX | - | ||||||||||||||||||||||||
| 2487 | case SE_HeaderLabel: { never executed: case SE_HeaderLabel: | 0 | ||||||||||||||||||||||||
| 2488 | int margin = proxy()->pixelMetric(QStyle::PM_HeaderMargin, opt, widget); | - | ||||||||||||||||||||||||
| 2489 | r.setRect(opt->rect.x() + margin, opt->rect.y() + margin, | - | ||||||||||||||||||||||||
| 2490 | opt->rect.width() - margin * 2, opt->rect.height() - margin * 2); | - | ||||||||||||||||||||||||
| 2491 | - | |||||||||||||||||||||||||
| 2492 | if (const QStyleOptionHeader *header = qstyleoption_cast<const QStyleOptionHeader *>(opt)) {
| 0 | ||||||||||||||||||||||||
| 2493 | // Subtract width needed for arrow, if there is one | - | ||||||||||||||||||||||||
| 2494 | if (header->sortIndicator != QStyleOptionHeader::None) {
| 0 | ||||||||||||||||||||||||
| 2495 | if (opt->state & State_Horizontal)
| 0 | ||||||||||||||||||||||||
| 2496 | r.setWidth(r.width() - (opt->rect.height() / 2) - (margin * 2)); never executed: r.setWidth(r.width() - (opt->rect.height() / 2) - (margin * 2)); | 0 | ||||||||||||||||||||||||
| 2497 | else | - | ||||||||||||||||||||||||
| 2498 | r.setHeight(r.height() - (opt->rect.width() / 2) - (margin * 2)); never executed: r.setHeight(r.height() - (opt->rect.width() / 2) - (margin * 2)); | 0 | ||||||||||||||||||||||||
| 2499 | } | - | ||||||||||||||||||||||||
| 2500 | } never executed: end of block | 0 | ||||||||||||||||||||||||
| 2501 | r = visualRect(opt->direction, opt->rect, r); | - | ||||||||||||||||||||||||
| 2502 | break; } never executed: break; | 0 | ||||||||||||||||||||||||
| 2503 | case SE_HeaderArrow: { never executed: case SE_HeaderArrow: | 0 | ||||||||||||||||||||||||
| 2504 | int h = opt->rect.height(); | - | ||||||||||||||||||||||||
| 2505 | int w = opt->rect.width(); | - | ||||||||||||||||||||||||
| 2506 | int x = opt->rect.x(); | - | ||||||||||||||||||||||||
| 2507 | int y = opt->rect.y(); | - | ||||||||||||||||||||||||
| 2508 | int margin = proxy()->pixelMetric(QStyle::PM_HeaderMargin, opt, widget); | - | ||||||||||||||||||||||||
| 2509 | - | |||||||||||||||||||||||||
| 2510 | if (opt->state & State_Horizontal) {
| 0 | ||||||||||||||||||||||||
| 2511 | int horiz_size = h / 2; | - | ||||||||||||||||||||||||
| 2512 | r.setRect(x + w - margin * 2 - horiz_size, y + 5, | - | ||||||||||||||||||||||||
| 2513 | horiz_size, h - margin * 2 - 5); | - | ||||||||||||||||||||||||
| 2514 | } else { never executed: end of block | 0 | ||||||||||||||||||||||||
| 2515 | int vert_size = w / 2; | - | ||||||||||||||||||||||||
| 2516 | r.setRect(x + 5, y + h - margin * 2 - vert_size, | - | ||||||||||||||||||||||||
| 2517 | w - margin * 2 - 5, vert_size); | - | ||||||||||||||||||||||||
| 2518 | } never executed: end of block | 0 | ||||||||||||||||||||||||
| 2519 | r = visualRect(opt->direction, opt->rect, r); | - | ||||||||||||||||||||||||
| 2520 | break; } never executed: break; | 0 | ||||||||||||||||||||||||
| 2521 | - | |||||||||||||||||||||||||
| 2522 | case SE_RadioButtonClickRect: never executed: case SE_RadioButtonClickRect: | 0 | ||||||||||||||||||||||||
| 2523 | r = subElementRect(SE_RadioButtonFocusRect, opt, widget); | - | ||||||||||||||||||||||||
| 2524 | r |= subElementRect(SE_RadioButtonIndicator, opt, widget); | - | ||||||||||||||||||||||||
| 2525 | break; never executed: break; | 0 | ||||||||||||||||||||||||
| 2526 | case SE_CheckBoxClickRect: never executed: case SE_CheckBoxClickRect: | 0 | ||||||||||||||||||||||||
| 2527 | r = subElementRect(SE_CheckBoxFocusRect, opt, widget); | - | ||||||||||||||||||||||||
| 2528 | r |= subElementRect(SE_CheckBoxIndicator, opt, widget); | - | ||||||||||||||||||||||||
| 2529 | break; never executed: break; | 0 | ||||||||||||||||||||||||
| 2530 | #ifndef QT_NO_TABWIDGET | - | ||||||||||||||||||||||||
| 2531 | case SE_TabWidgetTabBar: never executed: case SE_TabWidgetTabBar: | 0 | ||||||||||||||||||||||||
| 2532 | if (const QStyleOptionTabWidgetFrame *twf
| 0 | ||||||||||||||||||||||||
| 2533 | = qstyleoption_cast<const QStyleOptionTabWidgetFrame *>(opt)) {
| 0 | ||||||||||||||||||||||||
| 2534 | r.setSize(twf->tabBarSize); | - | ||||||||||||||||||||||||
| 2535 | const uint alingMask = Qt::AlignLeft | Qt::AlignRight | Qt::AlignHCenter; | - | ||||||||||||||||||||||||
| 2536 | switch (twf->shape) { | - | ||||||||||||||||||||||||
| 2537 | case QTabBar::RoundedNorth: never executed: case QTabBar::RoundedNorth: | 0 | ||||||||||||||||||||||||
| 2538 | case QTabBar::TriangularNorth: never executed: case QTabBar::TriangularNorth: | 0 | ||||||||||||||||||||||||
| 2539 | // Constrain the size now, otherwise, center could get off the page | - | ||||||||||||||||||||||||
| 2540 | // This of course repeated for all the other directions | - | ||||||||||||||||||||||||
| 2541 | r.setWidth(qMin(r.width(), twf->rect.width() | - | ||||||||||||||||||||||||
| 2542 | - twf->leftCornerWidgetSize.width() | - | ||||||||||||||||||||||||
| 2543 | - twf->rightCornerWidgetSize.width())); | - | ||||||||||||||||||||||||
| 2544 | switch (proxy()->styleHint(SH_TabBar_Alignment, twf, widget) & alingMask) { | - | ||||||||||||||||||||||||
| 2545 | default: never executed: default: | 0 | ||||||||||||||||||||||||
| 2546 | case Qt::AlignLeft: never executed: case Qt::AlignLeft: | 0 | ||||||||||||||||||||||||
| 2547 | r.moveTopLeft(QPoint(twf->leftCornerWidgetSize.width(), 0)); | - | ||||||||||||||||||||||||
| 2548 | break; never executed: break; | 0 | ||||||||||||||||||||||||
| 2549 | case Qt::AlignHCenter: never executed: case Qt::AlignHCenter: | 0 | ||||||||||||||||||||||||
| 2550 | r.moveTopLeft(QPoint(twf->rect.center().x() - qRound(r.width() / 2.0f) | - | ||||||||||||||||||||||||
| 2551 | + (twf->leftCornerWidgetSize.width() / 2) | - | ||||||||||||||||||||||||
| 2552 | - (twf->rightCornerWidgetSize.width() / 2), 0)); | - | ||||||||||||||||||||||||
| 2553 | break; never executed: break; | 0 | ||||||||||||||||||||||||
| 2554 | case Qt::AlignRight: never executed: case Qt::AlignRight: | 0 | ||||||||||||||||||||||||
| 2555 | r.moveTopLeft(QPoint(twf->rect.width() - twf->tabBarSize.width() | - | ||||||||||||||||||||||||
| 2556 | - twf->rightCornerWidgetSize.width(), 0)); | - | ||||||||||||||||||||||||
| 2557 | break; never executed: break; | 0 | ||||||||||||||||||||||||
| 2558 | } | - | ||||||||||||||||||||||||
| 2559 | r = visualRect(twf->direction, twf->rect, r); | - | ||||||||||||||||||||||||
| 2560 | break; never executed: break; | 0 | ||||||||||||||||||||||||
| 2561 | case QTabBar::RoundedSouth: never executed: case QTabBar::RoundedSouth: | 0 | ||||||||||||||||||||||||
| 2562 | case QTabBar::TriangularSouth: never executed: case QTabBar::TriangularSouth: | 0 | ||||||||||||||||||||||||
| 2563 | r.setWidth(qMin(r.width(), twf->rect.width() | - | ||||||||||||||||||||||||
| 2564 | - twf->leftCornerWidgetSize.width() | - | ||||||||||||||||||||||||
| 2565 | - twf->rightCornerWidgetSize.width())); | - | ||||||||||||||||||||||||
| 2566 | switch (proxy()->styleHint(SH_TabBar_Alignment, twf, widget) & alingMask) { | - | ||||||||||||||||||||||||
| 2567 | default: never executed: default: | 0 | ||||||||||||||||||||||||
| 2568 | case Qt::AlignLeft: never executed: case Qt::AlignLeft: | 0 | ||||||||||||||||||||||||
| 2569 | r.moveTopLeft(QPoint(twf->leftCornerWidgetSize.width(), | - | ||||||||||||||||||||||||
| 2570 | twf->rect.height() - twf->tabBarSize.height())); | - | ||||||||||||||||||||||||
| 2571 | break; never executed: break; | 0 | ||||||||||||||||||||||||
| 2572 | case Qt::AlignHCenter: never executed: case Qt::AlignHCenter: | 0 | ||||||||||||||||||||||||
| 2573 | r.moveTopLeft(QPoint(twf->rect.center().x() - qRound(r.width() / 2.0f) | - | ||||||||||||||||||||||||
| 2574 | + (twf->leftCornerWidgetSize.width() / 2) | - | ||||||||||||||||||||||||
| 2575 | - (twf->rightCornerWidgetSize.width() / 2), | - | ||||||||||||||||||||||||
| 2576 | twf->rect.height() - twf->tabBarSize.height())); | - | ||||||||||||||||||||||||
| 2577 | break; never executed: break; | 0 | ||||||||||||||||||||||||
| 2578 | case Qt::AlignRight: never executed: case Qt::AlignRight: | 0 | ||||||||||||||||||||||||
| 2579 | r.moveTopLeft(QPoint(twf->rect.width() - twf->tabBarSize.width() | - | ||||||||||||||||||||||||
| 2580 | - twf->rightCornerWidgetSize.width(), | - | ||||||||||||||||||||||||
| 2581 | twf->rect.height() - twf->tabBarSize.height())); | - | ||||||||||||||||||||||||
| 2582 | break; never executed: break; | 0 | ||||||||||||||||||||||||
| 2583 | } | - | ||||||||||||||||||||||||
| 2584 | r = visualRect(twf->direction, twf->rect, r); | - | ||||||||||||||||||||||||
| 2585 | break; never executed: break; | 0 | ||||||||||||||||||||||||
| 2586 | case QTabBar::RoundedEast: never executed: case QTabBar::RoundedEast: | 0 | ||||||||||||||||||||||||
| 2587 | case QTabBar::TriangularEast: never executed: case QTabBar::TriangularEast: | 0 | ||||||||||||||||||||||||
| 2588 | r.setHeight(qMin(r.height(), twf->rect.height() | - | ||||||||||||||||||||||||
| 2589 | - twf->leftCornerWidgetSize.height() | - | ||||||||||||||||||||||||
| 2590 | - twf->rightCornerWidgetSize.height())); | - | ||||||||||||||||||||||||
| 2591 | switch (proxy()->styleHint(SH_TabBar_Alignment, twf, widget) & alingMask) { | - | ||||||||||||||||||||||||
| 2592 | default: never executed: default: | 0 | ||||||||||||||||||||||||
| 2593 | case Qt::AlignLeft: never executed: case Qt::AlignLeft: | 0 | ||||||||||||||||||||||||
| 2594 | r.moveTopLeft(QPoint(twf->rect.width() - twf->tabBarSize.width(), | - | ||||||||||||||||||||||||
| 2595 | twf->leftCornerWidgetSize.height())); | - | ||||||||||||||||||||||||
| 2596 | break; never executed: break; | 0 | ||||||||||||||||||||||||
| 2597 | case Qt::AlignHCenter: never executed: case Qt::AlignHCenter: | 0 | ||||||||||||||||||||||||
| 2598 | r.moveTopLeft(QPoint(twf->rect.width() - twf->tabBarSize.width(), | - | ||||||||||||||||||||||||
| 2599 | twf->rect.center().y() - r.height() / 2)); | - | ||||||||||||||||||||||||
| 2600 | break; never executed: break; | 0 | ||||||||||||||||||||||||
| 2601 | case Qt::AlignRight: never executed: case Qt::AlignRight: | 0 | ||||||||||||||||||||||||
| 2602 | r.moveTopLeft(QPoint(twf->rect.width() - twf->tabBarSize.width(), | - | ||||||||||||||||||||||||
| 2603 | twf->rect.height() - twf->tabBarSize.height() | - | ||||||||||||||||||||||||
| 2604 | - twf->rightCornerWidgetSize.height())); | - | ||||||||||||||||||||||||
| 2605 | break; never executed: break; | 0 | ||||||||||||||||||||||||
| 2606 | } | - | ||||||||||||||||||||||||
| 2607 | break; never executed: break; | 0 | ||||||||||||||||||||||||
| 2608 | case QTabBar::RoundedWest: never executed: case QTabBar::RoundedWest: | 0 | ||||||||||||||||||||||||
| 2609 | case QTabBar::TriangularWest: never executed: case QTabBar::TriangularWest: | 0 | ||||||||||||||||||||||||
| 2610 | r.setHeight(qMin(r.height(), twf->rect.height() | - | ||||||||||||||||||||||||
| 2611 | - twf->leftCornerWidgetSize.height() | - | ||||||||||||||||||||||||
| 2612 | - twf->rightCornerWidgetSize.height())); | - | ||||||||||||||||||||||||
| 2613 | switch (proxy()->styleHint(SH_TabBar_Alignment, twf, widget) & alingMask) { | - | ||||||||||||||||||||||||
| 2614 | default: never executed: default: | 0 | ||||||||||||||||||||||||
| 2615 | case Qt::AlignLeft: never executed: case Qt::AlignLeft: | 0 | ||||||||||||||||||||||||
| 2616 | r.moveTopLeft(QPoint(0, twf->leftCornerWidgetSize.height())); | - | ||||||||||||||||||||||||
| 2617 | break; never executed: break; | 0 | ||||||||||||||||||||||||
| 2618 | case Qt::AlignHCenter: never executed: case Qt::AlignHCenter: | 0 | ||||||||||||||||||||||||
| 2619 | r.moveTopLeft(QPoint(0, twf->rect.center().y() - r.height() / 2)); | - | ||||||||||||||||||||||||
| 2620 | break; never executed: break; | 0 | ||||||||||||||||||||||||
| 2621 | case Qt::AlignRight: never executed: case Qt::AlignRight: | 0 | ||||||||||||||||||||||||
| 2622 | r.moveTopLeft(QPoint(0, twf->rect.height() - twf->tabBarSize.height() | - | ||||||||||||||||||||||||
| 2623 | - twf->rightCornerWidgetSize.height())); | - | ||||||||||||||||||||||||
| 2624 | break; never executed: break; | 0 | ||||||||||||||||||||||||
| 2625 | } | - | ||||||||||||||||||||||||
| 2626 | break; never executed: break; | 0 | ||||||||||||||||||||||||
| 2627 | } | - | ||||||||||||||||||||||||
| 2628 | } never executed: end of block | 0 | ||||||||||||||||||||||||
| 2629 | break; never executed: break; | 0 | ||||||||||||||||||||||||
| 2630 | case SE_TabWidgetTabPane: never executed: case SE_TabWidgetTabPane: | 0 | ||||||||||||||||||||||||
| 2631 | case SE_TabWidgetTabContents: never executed: case SE_TabWidgetTabContents: | 0 | ||||||||||||||||||||||||
| 2632 | if (const QStyleOptionTabWidgetFrame *twf = qstyleoption_cast<const QStyleOptionTabWidgetFrame *>(opt)) {
| 0 | ||||||||||||||||||||||||
| 2633 | QStyleOptionTab tabopt; | - | ||||||||||||||||||||||||
| 2634 | tabopt.shape = twf->shape; | - | ||||||||||||||||||||||||
| 2635 | int overlap = proxy()->pixelMetric(PM_TabBarBaseOverlap, &tabopt, widget); | - | ||||||||||||||||||||||||
| 2636 | if (twf->lineWidth == 0)
| 0 | ||||||||||||||||||||||||
| 2637 | overlap = 0; never executed: overlap = 0; | 0 | ||||||||||||||||||||||||
| 2638 | switch (twf->shape) { | - | ||||||||||||||||||||||||
| 2639 | case QTabBar::RoundedNorth: never executed: case QTabBar::RoundedNorth: | 0 | ||||||||||||||||||||||||
| 2640 | case QTabBar::TriangularNorth: never executed: case QTabBar::TriangularNorth: | 0 | ||||||||||||||||||||||||
| 2641 | r = QRect(QPoint(0,qMax(twf->tabBarSize.height() - overlap, 0)), | - | ||||||||||||||||||||||||
| 2642 | QSize(twf->rect.width(), qMin(twf->rect.height() - twf->tabBarSize.height() + overlap, twf->rect.height()))); | - | ||||||||||||||||||||||||
| 2643 | break; never executed: break; | 0 | ||||||||||||||||||||||||
| 2644 | case QTabBar::RoundedSouth: never executed: case QTabBar::RoundedSouth: | 0 | ||||||||||||||||||||||||
| 2645 | case QTabBar::TriangularSouth: never executed: case QTabBar::TriangularSouth: | 0 | ||||||||||||||||||||||||
| 2646 | r = QRect(QPoint(0,0), QSize(twf->rect.width(), qMin(twf->rect.height() - twf->tabBarSize.height() + overlap, twf->rect.height()))); | - | ||||||||||||||||||||||||
| 2647 | break; never executed: break; | 0 | ||||||||||||||||||||||||
| 2648 | case QTabBar::RoundedEast: never executed: case QTabBar::RoundedEast: | 0 | ||||||||||||||||||||||||
| 2649 | case QTabBar::TriangularEast: never executed: case QTabBar::TriangularEast: | 0 | ||||||||||||||||||||||||
| 2650 | r = QRect(QPoint(0, 0), QSize(qMin(twf->rect.width() - twf->tabBarSize.width() + overlap, twf->rect.width()), twf->rect.height())); | - | ||||||||||||||||||||||||
| 2651 | break; never executed: break; | 0 | ||||||||||||||||||||||||
| 2652 | case QTabBar::RoundedWest: never executed: case QTabBar::RoundedWest: | 0 | ||||||||||||||||||||||||
| 2653 | case QTabBar::TriangularWest: never executed: case QTabBar::TriangularWest: | 0 | ||||||||||||||||||||||||
| 2654 | r = QRect(QPoint(qMax(twf->tabBarSize.width() - overlap, 0), 0), | - | ||||||||||||||||||||||||
| 2655 | QSize(qMin(twf->rect.width() - twf->tabBarSize.width() + overlap, twf->rect.width()), twf->rect.height())); | - | ||||||||||||||||||||||||
| 2656 | break; never executed: break; | 0 | ||||||||||||||||||||||||
| 2657 | } | - | ||||||||||||||||||||||||
| 2658 | if (sr == SE_TabWidgetTabContents && twf->lineWidth > 0)
| 0 | ||||||||||||||||||||||||
| 2659 | r.adjust(2, 2, -2, -2); never executed: r.adjust(2, 2, -2, -2); | 0 | ||||||||||||||||||||||||
| 2660 | } never executed: end of block | 0 | ||||||||||||||||||||||||
| 2661 | break; never executed: break; | 0 | ||||||||||||||||||||||||
| 2662 | case SE_TabWidgetLeftCorner: never executed: case SE_TabWidgetLeftCorner: | 0 | ||||||||||||||||||||||||
| 2663 | if (const QStyleOptionTabWidgetFrame *twf = qstyleoption_cast<const QStyleOptionTabWidgetFrame *>(opt)) {
| 0 | ||||||||||||||||||||||||
| 2664 | QRect paneRect = subElementRect(SE_TabWidgetTabPane, twf, widget); | - | ||||||||||||||||||||||||
| 2665 | switch (twf->shape) { | - | ||||||||||||||||||||||||
| 2666 | case QTabBar::RoundedNorth: never executed: case QTabBar::RoundedNorth: | 0 | ||||||||||||||||||||||||
| 2667 | case QTabBar::TriangularNorth: never executed: case QTabBar::TriangularNorth: | 0 | ||||||||||||||||||||||||
| 2668 | r = QRect(QPoint(paneRect.x(), paneRect.y() - twf->leftCornerWidgetSize.height()), | - | ||||||||||||||||||||||||
| 2669 | twf->leftCornerWidgetSize); | - | ||||||||||||||||||||||||
| 2670 | break; never executed: break; | 0 | ||||||||||||||||||||||||
| 2671 | case QTabBar::RoundedSouth: never executed: case QTabBar::RoundedSouth: | 0 | ||||||||||||||||||||||||
| 2672 | case QTabBar::TriangularSouth: never executed: case QTabBar::TriangularSouth: | 0 | ||||||||||||||||||||||||
| 2673 | r = QRect(QPoint(paneRect.x(), paneRect.height()), twf->leftCornerWidgetSize); | - | ||||||||||||||||||||||||
| 2674 | break; never executed: break; | 0 | ||||||||||||||||||||||||
| 2675 | default: never executed: default: | 0 | ||||||||||||||||||||||||
| 2676 | break; never executed: break; | 0 | ||||||||||||||||||||||||
| 2677 | } | - | ||||||||||||||||||||||||
| 2678 | r = visualRect(twf->direction, twf->rect, r); | - | ||||||||||||||||||||||||
| 2679 | } never executed: end of block | 0 | ||||||||||||||||||||||||
| 2680 | break; never executed: break; | 0 | ||||||||||||||||||||||||
| 2681 | case SE_TabWidgetRightCorner: never executed: case SE_TabWidgetRightCorner: | 0 | ||||||||||||||||||||||||
| 2682 | if (const QStyleOptionTabWidgetFrame *twf = qstyleoption_cast<const QStyleOptionTabWidgetFrame *>(opt)) {
| 0 | ||||||||||||||||||||||||
| 2683 | QRect paneRect = subElementRect(SE_TabWidgetTabPane, twf, widget); | - | ||||||||||||||||||||||||
| 2684 | switch (twf->shape) { | - | ||||||||||||||||||||||||
| 2685 | case QTabBar::RoundedNorth: never executed: case QTabBar::RoundedNorth: | 0 | ||||||||||||||||||||||||
| 2686 | case QTabBar::TriangularNorth: never executed: case QTabBar::TriangularNorth: | 0 | ||||||||||||||||||||||||
| 2687 | r = QRect(QPoint(paneRect.width() - twf->rightCornerWidgetSize.width(), | - | ||||||||||||||||||||||||
| 2688 | paneRect.y() - twf->rightCornerWidgetSize.height()), | - | ||||||||||||||||||||||||
| 2689 | twf->rightCornerWidgetSize); | - | ||||||||||||||||||||||||
| 2690 | break; never executed: break; | 0 | ||||||||||||||||||||||||
| 2691 | case QTabBar::RoundedSouth: never executed: case QTabBar::RoundedSouth: | 0 | ||||||||||||||||||||||||
| 2692 | case QTabBar::TriangularSouth: never executed: case QTabBar::TriangularSouth: | 0 | ||||||||||||||||||||||||
| 2693 | r = QRect(QPoint(paneRect.width() - twf->rightCornerWidgetSize.width(), | - | ||||||||||||||||||||||||
| 2694 | paneRect.height()), twf->rightCornerWidgetSize); | - | ||||||||||||||||||||||||
| 2695 | break; never executed: break; | 0 | ||||||||||||||||||||||||
| 2696 | default: never executed: default: | 0 | ||||||||||||||||||||||||
| 2697 | break; never executed: break; | 0 | ||||||||||||||||||||||||
| 2698 | } | - | ||||||||||||||||||||||||
| 2699 | r = visualRect(twf->direction, twf->rect, r); | - | ||||||||||||||||||||||||
| 2700 | } never executed: end of block | 0 | ||||||||||||||||||||||||
| 2701 | break; never executed: break; | 0 | ||||||||||||||||||||||||
| 2702 | case SE_TabBarTabText: never executed: case SE_TabBarTabText: | 0 | ||||||||||||||||||||||||
| 2703 | if (const QStyleOptionTab *tab = qstyleoption_cast<const QStyleOptionTab *>(opt)) {
| 0 | ||||||||||||||||||||||||
| 2704 | QRect dummyIconRect; | - | ||||||||||||||||||||||||
| 2705 | d->tabLayout(tab, widget, &r, &dummyIconRect); | - | ||||||||||||||||||||||||
| 2706 | } never executed: end of block | 0 | ||||||||||||||||||||||||
| 2707 | break; never executed: break; | 0 | ||||||||||||||||||||||||
| 2708 | case SE_TabBarTabLeftButton: never executed: case SE_TabBarTabLeftButton: | 0 | ||||||||||||||||||||||||
| 2709 | case SE_TabBarTabRightButton: never executed: case SE_TabBarTabRightButton: | 0 | ||||||||||||||||||||||||
| 2710 | if (const QStyleOptionTab *tab = qstyleoption_cast<const QStyleOptionTab *>(opt)) {
| 0 | ||||||||||||||||||||||||
| 2711 | bool selected = tab->state & State_Selected; | - | ||||||||||||||||||||||||
| 2712 | int verticalShift = proxy()->pixelMetric(QStyle::PM_TabBarTabShiftVertical, tab, widget); | - | ||||||||||||||||||||||||
| 2713 | int horizontalShift = proxy()->pixelMetric(QStyle::PM_TabBarTabShiftHorizontal, tab, widget); | - | ||||||||||||||||||||||||
| 2714 | int hpadding = proxy()->pixelMetric(QStyle::PM_TabBarTabHSpace, opt, widget) / 2; | - | ||||||||||||||||||||||||
| 2715 | hpadding = qMax(hpadding, 4); //workaround KStyle returning 0 because they workaround an old bug in Qt | - | ||||||||||||||||||||||||
| 2716 | - | |||||||||||||||||||||||||
| 2717 | bool verticalTabs = tab->shape == QTabBar::RoundedEast
| 0 | ||||||||||||||||||||||||
| 2718 | || tab->shape == QTabBar::RoundedWest
| 0 | ||||||||||||||||||||||||
| 2719 | || tab->shape == QTabBar::TriangularEast
| 0 | ||||||||||||||||||||||||
| 2720 | || tab->shape == QTabBar::TriangularWest;
| 0 | ||||||||||||||||||||||||
| 2721 | - | |||||||||||||||||||||||||
| 2722 | QRect tr = tab->rect; | - | ||||||||||||||||||||||||
| 2723 | if (tab->shape == QTabBar::RoundedSouth || tab->shape == QTabBar::TriangularSouth)
| 0 | ||||||||||||||||||||||||
| 2724 | verticalShift = -verticalShift; never executed: verticalShift = -verticalShift; | 0 | ||||||||||||||||||||||||
| 2725 | if (verticalTabs) {
| 0 | ||||||||||||||||||||||||
| 2726 | qSwap(horizontalShift, verticalShift); | - | ||||||||||||||||||||||||
| 2727 | horizontalShift *= -1; | - | ||||||||||||||||||||||||
| 2728 | verticalShift *= -1; | - | ||||||||||||||||||||||||
| 2729 | } never executed: end of block | 0 | ||||||||||||||||||||||||
| 2730 | if (tab->shape == QTabBar::RoundedWest || tab->shape == QTabBar::TriangularWest)
| 0 | ||||||||||||||||||||||||
| 2731 | horizontalShift = -horizontalShift; never executed: horizontalShift = -horizontalShift; | 0 | ||||||||||||||||||||||||
| 2732 | - | |||||||||||||||||||||||||
| 2733 | tr.adjust(0, 0, horizontalShift, verticalShift); | - | ||||||||||||||||||||||||
| 2734 | if (selected)
| 0 | ||||||||||||||||||||||||
| 2735 | { | - | ||||||||||||||||||||||||
| 2736 | tr.setBottom(tr.bottom() - verticalShift); | - | ||||||||||||||||||||||||
| 2737 | tr.setRight(tr.right() - horizontalShift); | - | ||||||||||||||||||||||||
| 2738 | } never executed: end of block | 0 | ||||||||||||||||||||||||
| 2739 | - | |||||||||||||||||||||||||
| 2740 | QSize size = (sr == SE_TabBarTabLeftButton) ? tab->leftButtonSize : tab->rightButtonSize;
| 0 | ||||||||||||||||||||||||
| 2741 | int w = size.width(); | - | ||||||||||||||||||||||||
| 2742 | int h = size.height(); | - | ||||||||||||||||||||||||
| 2743 | int midHeight = static_cast<int>(qCeil(float(tr.height() - h) / 2)); | - | ||||||||||||||||||||||||
| 2744 | int midWidth = ((tr.width() - w) / 2); | - | ||||||||||||||||||||||||
| 2745 | - | |||||||||||||||||||||||||
| 2746 | bool atTheTop = true; | - | ||||||||||||||||||||||||
| 2747 | switch (tab->shape) { | - | ||||||||||||||||||||||||
| 2748 | case QTabBar::RoundedWest: never executed: case QTabBar::RoundedWest: | 0 | ||||||||||||||||||||||||
| 2749 | case QTabBar::TriangularWest: never executed: case QTabBar::TriangularWest: | 0 | ||||||||||||||||||||||||
| 2750 | atTheTop = (sr == SE_TabBarTabLeftButton); | - | ||||||||||||||||||||||||
| 2751 | break; never executed: break; | 0 | ||||||||||||||||||||||||
| 2752 | case QTabBar::RoundedEast: never executed: case QTabBar::RoundedEast: | 0 | ||||||||||||||||||||||||
| 2753 | case QTabBar::TriangularEast: never executed: case QTabBar::TriangularEast: | 0 | ||||||||||||||||||||||||
| 2754 | atTheTop = (sr == SE_TabBarTabRightButton); | - | ||||||||||||||||||||||||
| 2755 | break; never executed: break; | 0 | ||||||||||||||||||||||||
| 2756 | default: never executed: default: | 0 | ||||||||||||||||||||||||
| 2757 | if (sr == SE_TabBarTabLeftButton)
| 0 | ||||||||||||||||||||||||
| 2758 | r = QRect(tab->rect.x() + hpadding, midHeight, w, h); never executed: r = QRect(tab->rect.x() + hpadding, midHeight, w, h); | 0 | ||||||||||||||||||||||||
| 2759 | else | - | ||||||||||||||||||||||||
| 2760 | r = QRect(tab->rect.right() - w - hpadding, midHeight, w, h); never executed: r = QRect(tab->rect.right() - w - hpadding, midHeight, w, h); | 0 | ||||||||||||||||||||||||
| 2761 | r = visualRect(tab->direction, tab->rect, r); | - | ||||||||||||||||||||||||
| 2762 | } never executed: end of block | 0 | ||||||||||||||||||||||||
| 2763 | if (verticalTabs) {
| 0 | ||||||||||||||||||||||||
| 2764 | if (atTheTop)
| 0 | ||||||||||||||||||||||||
| 2765 | r = QRect(midWidth, tr.y() + tab->rect.height() - hpadding - h, w, h); never executed: r = QRect(midWidth, tr.y() + tab->rect.height() - hpadding - h, w, h); | 0 | ||||||||||||||||||||||||
| 2766 | else | - | ||||||||||||||||||||||||
| 2767 | r = QRect(midWidth, tr.y() + hpadding, w, h); never executed: r = QRect(midWidth, tr.y() + hpadding, w, h); | 0 | ||||||||||||||||||||||||
| 2768 | } | - | ||||||||||||||||||||||||
| 2769 | } never executed: end of block | 0 | ||||||||||||||||||||||||
| 2770 | - | |||||||||||||||||||||||||
| 2771 | break; never executed: break; | 0 | ||||||||||||||||||||||||
| 2772 | #endif // QT_NO_TABWIDGET | - | ||||||||||||||||||||||||
| 2773 | #ifndef QT_NO_TABBAR | - | ||||||||||||||||||||||||
| 2774 | case SE_TabBarTearIndicator: never executed: case SE_TabBarTearIndicator: | 0 | ||||||||||||||||||||||||
| 2775 | if (const QStyleOptionTab *tab = qstyleoption_cast<const QStyleOptionTab *>(opt)) {
| 0 | ||||||||||||||||||||||||
| 2776 | switch (tab->shape) { | - | ||||||||||||||||||||||||
| 2777 | case QTabBar::RoundedNorth: never executed: case QTabBar::RoundedNorth: | 0 | ||||||||||||||||||||||||
| 2778 | case QTabBar::TriangularNorth: never executed: case QTabBar::TriangularNorth: | 0 | ||||||||||||||||||||||||
| 2779 | case QTabBar::RoundedSouth: never executed: case QTabBar::RoundedSouth: | 0 | ||||||||||||||||||||||||
| 2780 | case QTabBar::TriangularSouth: never executed: case QTabBar::TriangularSouth: | 0 | ||||||||||||||||||||||||
| 2781 | r.setRect(tab->rect.left(), tab->rect.top(), 4, opt->rect.height()); | - | ||||||||||||||||||||||||
| 2782 | break; never executed: break; | 0 | ||||||||||||||||||||||||
| 2783 | case QTabBar::RoundedWest: never executed: case QTabBar::RoundedWest: | 0 | ||||||||||||||||||||||||
| 2784 | case QTabBar::TriangularWest: never executed: case QTabBar::TriangularWest: | 0 | ||||||||||||||||||||||||
| 2785 | case QTabBar::RoundedEast: never executed: case QTabBar::RoundedEast: | 0 | ||||||||||||||||||||||||
| 2786 | case QTabBar::TriangularEast: never executed: case QTabBar::TriangularEast: | 0 | ||||||||||||||||||||||||
| 2787 | r.setRect(tab->rect.left(), tab->rect.top(), opt->rect.width(), 4); | - | ||||||||||||||||||||||||
| 2788 | break; never executed: break; | 0 | ||||||||||||||||||||||||
| 2789 | default: never executed: default: | 0 | ||||||||||||||||||||||||
| 2790 | break; never executed: break; | 0 | ||||||||||||||||||||||||
| 2791 | } | - | ||||||||||||||||||||||||
| 2792 | r = visualRect(opt->direction, opt->rect, r); | - | ||||||||||||||||||||||||
| 2793 | } never executed: end of block | 0 | ||||||||||||||||||||||||
| 2794 | break; never executed: break; | 0 | ||||||||||||||||||||||||
| 2795 | #endif | - | ||||||||||||||||||||||||
| 2796 | case SE_TreeViewDisclosureItem: never executed: case SE_TreeViewDisclosureItem: | 0 | ||||||||||||||||||||||||
| 2797 | r = opt->rect; | - | ||||||||||||||||||||||||
| 2798 | break; never executed: break; | 0 | ||||||||||||||||||||||||
| 2799 | case SE_LineEditContents: never executed: case SE_LineEditContents: | 0 | ||||||||||||||||||||||||
| 2800 | if (const QStyleOptionFrame *f = qstyleoption_cast<const QStyleOptionFrame *>(opt)) {
| 0 | ||||||||||||||||||||||||
| 2801 | r = f->rect.adjusted(f->lineWidth, f->lineWidth, -f->lineWidth, -f->lineWidth); | - | ||||||||||||||||||||||||
| 2802 | r = visualRect(opt->direction, opt->rect, r); | - | ||||||||||||||||||||||||
| 2803 | } never executed: end of block | 0 | ||||||||||||||||||||||||
| 2804 | break; never executed: break; | 0 | ||||||||||||||||||||||||
| 2805 | case SE_FrameContents: never executed: case SE_FrameContents: | 0 | ||||||||||||||||||||||||
| 2806 | if (const QStyleOptionFrame *f = qstyleoption_cast<const QStyleOptionFrame *>(opt)) {
| 0 | ||||||||||||||||||||||||
| 2807 | int fw = proxy()->pixelMetric(PM_DefaultFrameWidth, f, widget); | - | ||||||||||||||||||||||||
| 2808 | r = opt->rect.adjusted(fw, fw, -fw, -fw); | - | ||||||||||||||||||||||||
| 2809 | r = visualRect(opt->direction, opt->rect, r); | - | ||||||||||||||||||||||||
| 2810 | } never executed: end of block | 0 | ||||||||||||||||||||||||
| 2811 | break; never executed: break; | 0 | ||||||||||||||||||||||||
| 2812 | case SE_ShapedFrameContents: never executed: case SE_ShapedFrameContents: | 0 | ||||||||||||||||||||||||
| 2813 | if (const QStyleOptionFrame *f = qstyleoption_cast<const QStyleOptionFrame *>(opt)) {
| 0 | ||||||||||||||||||||||||
| 2814 | int frameShape = f->frameShape; | - | ||||||||||||||||||||||||
| 2815 | int frameShadow = QFrame::Plain; | - | ||||||||||||||||||||||||
| 2816 | if (f->state & QStyle::State_Sunken) {
| 0 | ||||||||||||||||||||||||
| 2817 | frameShadow = QFrame::Sunken; | - | ||||||||||||||||||||||||
| 2818 | } else if (f->state & QStyle::State_Raised) { never executed: end of block
| 0 | ||||||||||||||||||||||||
| 2819 | frameShadow = QFrame::Raised; | - | ||||||||||||||||||||||||
| 2820 | } never executed: end of block | 0 | ||||||||||||||||||||||||
| 2821 | - | |||||||||||||||||||||||||
| 2822 | int frameWidth = 0; | - | ||||||||||||||||||||||||
| 2823 | - | |||||||||||||||||||||||||
| 2824 | switch (frameShape) { | - | ||||||||||||||||||||||||
| 2825 | case QFrame::NoFrame: never executed: case QFrame::NoFrame: | 0 | ||||||||||||||||||||||||
| 2826 | frameWidth = 0; | - | ||||||||||||||||||||||||
| 2827 | break; never executed: break; | 0 | ||||||||||||||||||||||||
| 2828 | - | |||||||||||||||||||||||||
| 2829 | case QFrame::Box: never executed: case QFrame::Box: | 0 | ||||||||||||||||||||||||
| 2830 | case QFrame::HLine: never executed: case QFrame::HLine: | 0 | ||||||||||||||||||||||||
| 2831 | case QFrame::VLine: never executed: case QFrame::VLine: | 0 | ||||||||||||||||||||||||
| 2832 | switch (frameShadow) { | - | ||||||||||||||||||||||||
| 2833 | case QFrame::Plain: never executed: case QFrame::Plain: | 0 | ||||||||||||||||||||||||
| 2834 | frameWidth = f->lineWidth; | - | ||||||||||||||||||||||||
| 2835 | break; never executed: break; | 0 | ||||||||||||||||||||||||
| 2836 | case QFrame::Raised: never executed: case QFrame::Raised: | 0 | ||||||||||||||||||||||||
| 2837 | case QFrame::Sunken: never executed: case QFrame::Sunken: | 0 | ||||||||||||||||||||||||
| 2838 | frameWidth = (short)(f->lineWidth*2 + f->midLineWidth); | - | ||||||||||||||||||||||||
| 2839 | break; never executed: break; | 0 | ||||||||||||||||||||||||
| 2840 | } | - | ||||||||||||||||||||||||
| 2841 | break; never executed: break; | 0 | ||||||||||||||||||||||||
| 2842 | - | |||||||||||||||||||||||||
| 2843 | case QFrame::StyledPanel: never executed: case QFrame::StyledPanel: | 0 | ||||||||||||||||||||||||
| 2844 | //keep the compatibility with Qt 4.4 if there is a proxy style. | - | ||||||||||||||||||||||||
| 2845 | //be sure to call drawPrimitive(QStyle::SE_FrameContents) on the proxy style | - | ||||||||||||||||||||||||
| 2846 | if (widget)
| 0 | ||||||||||||||||||||||||
| 2847 | return widget->style()->subElementRect(QStyle::SE_FrameContents, opt, widget); never executed: return widget->style()->subElementRect(QStyle::SE_FrameContents, opt, widget); | 0 | ||||||||||||||||||||||||
| 2848 | else | - | ||||||||||||||||||||||||
| 2849 | return subElementRect(QStyle::SE_FrameContents, opt, widget); never executed: return subElementRect(QStyle::SE_FrameContents, opt, widget); | 0 | ||||||||||||||||||||||||
| 2850 | - | |||||||||||||||||||||||||
| 2851 | case QFrame::WinPanel: never executed: case QFrame::WinPanel: | 0 | ||||||||||||||||||||||||
| 2852 | frameWidth = 2; | - | ||||||||||||||||||||||||
| 2853 | break; never executed: break; | 0 | ||||||||||||||||||||||||
| 2854 | - | |||||||||||||||||||||||||
| 2855 | case QFrame::Panel: never executed: case QFrame::Panel: | 0 | ||||||||||||||||||||||||
| 2856 | switch (frameShadow) { | - | ||||||||||||||||||||||||
| 2857 | case QFrame::Plain: never executed: case QFrame::Plain: | 0 | ||||||||||||||||||||||||
| 2858 | case QFrame::Raised: never executed: case QFrame::Raised: | 0 | ||||||||||||||||||||||||
| 2859 | case QFrame::Sunken: never executed: case QFrame::Sunken: | 0 | ||||||||||||||||||||||||
| 2860 | frameWidth = f->lineWidth; | - | ||||||||||||||||||||||||
| 2861 | break; never executed: break; | 0 | ||||||||||||||||||||||||
| 2862 | } | - | ||||||||||||||||||||||||
| 2863 | break; never executed: break; | 0 | ||||||||||||||||||||||||
| 2864 | } | - | ||||||||||||||||||||||||
| 2865 | r = f->rect.adjusted(frameWidth, frameWidth, -frameWidth, -frameWidth); | - | ||||||||||||||||||||||||
| 2866 | } never executed: end of block | 0 | ||||||||||||||||||||||||
| 2867 | break; never executed: break; | 0 | ||||||||||||||||||||||||
| 2868 | #ifndef QT_NO_DOCKWIDGET | - | ||||||||||||||||||||||||
| 2869 | case SE_DockWidgetCloseButton: never executed: case SE_DockWidgetCloseButton: | 0 | ||||||||||||||||||||||||
| 2870 | case SE_DockWidgetFloatButton: never executed: case SE_DockWidgetFloatButton: | 0 | ||||||||||||||||||||||||
| 2871 | case SE_DockWidgetTitleBarText: never executed: case SE_DockWidgetTitleBarText: | 0 | ||||||||||||||||||||||||
| 2872 | case SE_DockWidgetIcon: { never executed: case SE_DockWidgetIcon: | 0 | ||||||||||||||||||||||||
| 2873 | int iconSize = proxy()->pixelMetric(PM_SmallIconSize, opt, widget); | - | ||||||||||||||||||||||||
| 2874 | int buttonMargin = proxy()->pixelMetric(PM_DockWidgetTitleBarButtonMargin, opt, widget); | - | ||||||||||||||||||||||||
| 2875 | int margin = proxy()->pixelMetric(QStyle::PM_DockWidgetTitleMargin, opt, widget); | - | ||||||||||||||||||||||||
| 2876 | QRect rect = opt->rect; | - | ||||||||||||||||||||||||
| 2877 | - | |||||||||||||||||||||||||
| 2878 | const QStyleOptionDockWidget *dwOpt | - | ||||||||||||||||||||||||
| 2879 | = qstyleoption_cast<const QStyleOptionDockWidget*>(opt); | - | ||||||||||||||||||||||||
| 2880 | bool canClose = dwOpt == 0 ? true : dwOpt->closable;
| 0 | ||||||||||||||||||||||||
| 2881 | bool canFloat = dwOpt == 0 ? false : dwOpt->floatable;
| 0 | ||||||||||||||||||||||||
| 2882 | - | |||||||||||||||||||||||||
| 2883 | const bool verticalTitleBar = dwOpt && dwOpt->verticalTitleBar;
| 0 | ||||||||||||||||||||||||
| 2884 | - | |||||||||||||||||||||||||
| 2885 | // If this is a vertical titlebar, we transpose and work as if it was | - | ||||||||||||||||||||||||
| 2886 | // horizontal, then transpose again. | - | ||||||||||||||||||||||||
| 2887 | - | |||||||||||||||||||||||||
| 2888 | if (verticalTitleBar)
| 0 | ||||||||||||||||||||||||
| 2889 | rect.setSize(rect.size().transposed()); never executed: rect.setSize(rect.size().transposed()); | 0 | ||||||||||||||||||||||||
| 2890 | - | |||||||||||||||||||||||||
| 2891 | do { | - | ||||||||||||||||||||||||
| 2892 | - | |||||||||||||||||||||||||
| 2893 | int right = rect.right(); | - | ||||||||||||||||||||||||
| 2894 | int left = rect.left(); | - | ||||||||||||||||||||||||
| 2895 | - | |||||||||||||||||||||||||
| 2896 | QRect closeRect; | - | ||||||||||||||||||||||||
| 2897 | if (canClose) {
| 0 | ||||||||||||||||||||||||
| 2898 | QSize sz = proxy()->standardIcon(QStyle::SP_TitleBarCloseButton, | - | ||||||||||||||||||||||||
| 2899 | opt, widget).actualSize(QSize(iconSize, iconSize)); | - | ||||||||||||||||||||||||
| 2900 | sz += QSize(buttonMargin, buttonMargin); | - | ||||||||||||||||||||||||
| 2901 | if (verticalTitleBar)
| 0 | ||||||||||||||||||||||||
| 2902 | sz = sz.transposed(); never executed: sz = sz.transposed(); | 0 | ||||||||||||||||||||||||
| 2903 | closeRect = QRect(right - sz.width(), | - | ||||||||||||||||||||||||
| 2904 | rect.center().y() - sz.height()/2, | - | ||||||||||||||||||||||||
| 2905 | sz.width(), sz.height()); | - | ||||||||||||||||||||||||
| 2906 | right = closeRect.left() - 1; | - | ||||||||||||||||||||||||
| 2907 | } never executed: end of block | 0 | ||||||||||||||||||||||||
| 2908 | if (sr == SE_DockWidgetCloseButton) {
| 0 | ||||||||||||||||||||||||
| 2909 | r = closeRect; | - | ||||||||||||||||||||||||
| 2910 | break; never executed: break; | 0 | ||||||||||||||||||||||||
| 2911 | } | - | ||||||||||||||||||||||||
| 2912 | - | |||||||||||||||||||||||||
| 2913 | QRect floatRect; | - | ||||||||||||||||||||||||
| 2914 | if (canFloat) {
| 0 | ||||||||||||||||||||||||
| 2915 | QSize sz = proxy()->standardIcon(QStyle::SP_TitleBarNormalButton, | - | ||||||||||||||||||||||||
| 2916 | opt, widget).actualSize(QSize(iconSize, iconSize)); | - | ||||||||||||||||||||||||
| 2917 | sz += QSize(buttonMargin, buttonMargin); | - | ||||||||||||||||||||||||
| 2918 | if (verticalTitleBar)
| 0 | ||||||||||||||||||||||||
| 2919 | sz = sz.transposed(); never executed: sz = sz.transposed(); | 0 | ||||||||||||||||||||||||
| 2920 | floatRect = QRect(right - sz.width(), | - | ||||||||||||||||||||||||
| 2921 | rect.center().y() - sz.height()/2, | - | ||||||||||||||||||||||||
| 2922 | sz.width(), sz.height()); | - | ||||||||||||||||||||||||
| 2923 | right = floatRect.left() - 1; | - | ||||||||||||||||||||||||
| 2924 | } never executed: end of block | 0 | ||||||||||||||||||||||||
| 2925 | if (sr == SE_DockWidgetFloatButton) {
| 0 | ||||||||||||||||||||||||
| 2926 | r = floatRect; | - | ||||||||||||||||||||||||
| 2927 | break; never executed: break; | 0 | ||||||||||||||||||||||||
| 2928 | } | - | ||||||||||||||||||||||||
| 2929 | - | |||||||||||||||||||||||||
| 2930 | QRect iconRect; | - | ||||||||||||||||||||||||
| 2931 | if (const QDockWidget *dw = qobject_cast<const QDockWidget*>(widget)) {
| 0 | ||||||||||||||||||||||||
| 2932 | QIcon icon; | - | ||||||||||||||||||||||||
| 2933 | if (dw->isFloating())
| 0 | ||||||||||||||||||||||||
| 2934 | icon = dw->windowIcon(); never executed: icon = dw->windowIcon(); | 0 | ||||||||||||||||||||||||
| 2935 | if (!icon.isNull()
| 0 | ||||||||||||||||||||||||
| 2936 | && icon.cacheKey() != QApplication::windowIcon().cacheKey()) {
| 0 | ||||||||||||||||||||||||
| 2937 | QSize sz = icon.actualSize(QSize(r.height(), r.height())); | - | ||||||||||||||||||||||||
| 2938 | if (verticalTitleBar)
| 0 | ||||||||||||||||||||||||
| 2939 | sz = sz.transposed(); never executed: sz = sz.transposed(); | 0 | ||||||||||||||||||||||||
| 2940 | iconRect = QRect(left, rect.center().y() - sz.height()/2, | - | ||||||||||||||||||||||||
| 2941 | sz.width(), sz.height()); | - | ||||||||||||||||||||||||
| 2942 | left = iconRect.right() + margin; | - | ||||||||||||||||||||||||
| 2943 | } never executed: end of block | 0 | ||||||||||||||||||||||||
| 2944 | } never executed: end of block | 0 | ||||||||||||||||||||||||
| 2945 | if (sr == SE_DockWidgetIcon) {
| 0 | ||||||||||||||||||||||||
| 2946 | r = iconRect; | - | ||||||||||||||||||||||||
| 2947 | break; never executed: break; | 0 | ||||||||||||||||||||||||
| 2948 | } | - | ||||||||||||||||||||||||
| 2949 | - | |||||||||||||||||||||||||
| 2950 | QRect textRect = QRect(left, rect.top(), | - | ||||||||||||||||||||||||
| 2951 | right - left, rect.height()); | - | ||||||||||||||||||||||||
| 2952 | if (sr == SE_DockWidgetTitleBarText) {
| 0 | ||||||||||||||||||||||||
| 2953 | r = textRect; | - | ||||||||||||||||||||||||
| 2954 | break; never executed: break; | 0 | ||||||||||||||||||||||||
| 2955 | } | - | ||||||||||||||||||||||||
| 2956 | - | |||||||||||||||||||||||||
| 2957 | } while (false); | - | ||||||||||||||||||||||||
| 2958 | - | |||||||||||||||||||||||||
| 2959 | if (verticalTitleBar) {
| 0 | ||||||||||||||||||||||||
| 2960 | r = QRect(rect.left() + r.top() - rect.top(), | - | ||||||||||||||||||||||||
| 2961 | rect.top() + rect.right() - r.right(), | - | ||||||||||||||||||||||||
| 2962 | r.height(), r.width()); | - | ||||||||||||||||||||||||
| 2963 | } else { never executed: end of block | 0 | ||||||||||||||||||||||||
| 2964 | r = visualRect(opt->direction, rect, r); | - | ||||||||||||||||||||||||
| 2965 | } never executed: end of block | 0 | ||||||||||||||||||||||||
| 2966 | break; never executed: break; | 0 | ||||||||||||||||||||||||
| 2967 | } | - | ||||||||||||||||||||||||
| 2968 | #endif | - | ||||||||||||||||||||||||
| 2969 | #ifndef QT_NO_ITEMVIEWS | - | ||||||||||||||||||||||||
| 2970 | case SE_ItemViewItemCheckIndicator: never executed: case SE_ItemViewItemCheckIndicator: | 0 | ||||||||||||||||||||||||
| 2971 | if (!qstyleoption_cast<const QStyleOptionViewItem *>(opt)) {
| 0 | ||||||||||||||||||||||||
| 2972 | r = subElementRect(SE_CheckBoxIndicator, opt, widget); | - | ||||||||||||||||||||||||
| 2973 | break; never executed: break; | 0 | ||||||||||||||||||||||||
| 2974 | } | - | ||||||||||||||||||||||||
| 2975 | case SE_ItemViewItemDecoration: code before this statement never executed: case SE_ItemViewItemDecoration:never executed: case SE_ItemViewItemDecoration: | 0 | ||||||||||||||||||||||||
| 2976 | case SE_ItemViewItemText: never executed: case SE_ItemViewItemText: | 0 | ||||||||||||||||||||||||
| 2977 | case SE_ItemViewItemFocusRect: never executed: case SE_ItemViewItemFocusRect: | 0 | ||||||||||||||||||||||||
| 2978 | if (const QStyleOptionViewItem *vopt = qstyleoption_cast<const QStyleOptionViewItem *>(opt)) {
| 0 | ||||||||||||||||||||||||
| 2979 | if (!d->isViewItemCached(*vopt)) {
| 0 | ||||||||||||||||||||||||
| 2980 | d->viewItemLayout(vopt, &d->checkRect, &d->decorationRect, &d->displayRect, false); | - | ||||||||||||||||||||||||
| 2981 | if (d->cachedOption) {
| 0 | ||||||||||||||||||||||||
| 2982 | delete d->cachedOption; | - | ||||||||||||||||||||||||
| 2983 | d->cachedOption = 0; | - | ||||||||||||||||||||||||
| 2984 | } never executed: end of block | 0 | ||||||||||||||||||||||||
| 2985 | d->cachedOption = new QStyleOptionViewItem(*vopt); | - | ||||||||||||||||||||||||
| 2986 | } never executed: end of block | 0 | ||||||||||||||||||||||||
| 2987 | if (sr == SE_ViewItemCheckIndicator)
| 0 | ||||||||||||||||||||||||
| 2988 | r = d->checkRect; never executed: r = d->checkRect; | 0 | ||||||||||||||||||||||||
| 2989 | else if (sr == SE_ItemViewItemDecoration)
| 0 | ||||||||||||||||||||||||
| 2990 | r = d->decorationRect; never executed: r = d->decorationRect; | 0 | ||||||||||||||||||||||||
| 2991 | else if (sr == SE_ItemViewItemText || sr == SE_ItemViewItemFocusRect)
| 0 | ||||||||||||||||||||||||
| 2992 | r = d->displayRect; never executed: r = d->displayRect; | 0 | ||||||||||||||||||||||||
| 2993 | } never executed: end of block | 0 | ||||||||||||||||||||||||
| 2994 | break; never executed: break; | 0 | ||||||||||||||||||||||||
| 2995 | #endif //QT_NO_ITEMVIEWS | - | ||||||||||||||||||||||||
| 2996 | #ifndef QT_NO_TOOLBAR | - | ||||||||||||||||||||||||
| 2997 | case SE_ToolBarHandle: never executed: case SE_ToolBarHandle: | 0 | ||||||||||||||||||||||||
| 2998 | if (const QStyleOptionToolBar *tbopt = qstyleoption_cast<const QStyleOptionToolBar *>(opt)) {
| 0 | ||||||||||||||||||||||||
| 2999 | if (tbopt->features & QStyleOptionToolBar::Movable) {
| 0 | ||||||||||||||||||||||||
| 3000 | ///we need to access the widget here because the style option doesn't | - | ||||||||||||||||||||||||
| 3001 | //have all the information we need (ie. the layout's margin) | - | ||||||||||||||||||||||||
| 3002 | const QToolBar *tb = qobject_cast<const QToolBar*>(widget); | - | ||||||||||||||||||||||||
| 3003 | const int margin = tb && tb->layout() ? tb->layout()->margin() : 2;
| 0 | ||||||||||||||||||||||||
| 3004 | const int handleExtent = pixelMetric(QStyle::PM_ToolBarHandleExtent, opt, tb); | - | ||||||||||||||||||||||||
| 3005 | if (tbopt->state & QStyle::State_Horizontal) {
| 0 | ||||||||||||||||||||||||
| 3006 | r = QRect(margin, margin, handleExtent, tbopt->rect.height() - 2*margin); | - | ||||||||||||||||||||||||
| 3007 | r = QStyle::visualRect(tbopt->direction, tbopt->rect, r); | - | ||||||||||||||||||||||||
| 3008 | } else { never executed: end of block | 0 | ||||||||||||||||||||||||
| 3009 | r = QRect(margin, margin, tbopt->rect.width() - 2*margin, handleExtent); | - | ||||||||||||||||||||||||
| 3010 | } never executed: end of block | 0 | ||||||||||||||||||||||||
| 3011 | } | - | ||||||||||||||||||||||||
| 3012 | } never executed: end of block | 0 | ||||||||||||||||||||||||
| 3013 | break; never executed: break; | 0 | ||||||||||||||||||||||||
| 3014 | #endif //QT_NO_TOOLBAR | - | ||||||||||||||||||||||||
| 3015 | default: never executed: default: | 0 | ||||||||||||||||||||||||
| 3016 | break; never executed: break; | 0 | ||||||||||||||||||||||||
| 3017 | } | - | ||||||||||||||||||||||||
| 3018 | return r; never executed: return r; | 0 | ||||||||||||||||||||||||
| 3019 | } | - | ||||||||||||||||||||||||
| 3020 | - | |||||||||||||||||||||||||
| 3021 | #ifndef QT_NO_DIAL | - | ||||||||||||||||||||||||
| 3022 | - | |||||||||||||||||||||||||
| 3023 | // in lieu of std::array, minimal API | - | ||||||||||||||||||||||||
| 3024 | template <int N> | - | ||||||||||||||||||||||||
| 3025 | struct StaticPolygonF | - | ||||||||||||||||||||||||
| 3026 | { | - | ||||||||||||||||||||||||
| 3027 | QPointF data[N]; | - | ||||||||||||||||||||||||
| 3028 | - | |||||||||||||||||||||||||
| 3029 | Q_DECL_CONSTEXPR int size() const { return N; } | - | ||||||||||||||||||||||||
| 3030 | Q_DECL_CONSTEXPR const QPointF *cbegin() const { return data; } | - | ||||||||||||||||||||||||
| 3031 | Q_DECL_CONSTEXPR const QPointF &operator[](int idx) const { return data[idx]; } | - | ||||||||||||||||||||||||
| 3032 | }; | - | ||||||||||||||||||||||||
| 3033 | - | |||||||||||||||||||||||||
| 3034 | static StaticPolygonF<3> calcArrow(const QStyleOptionSlider *dial, qreal &a) | - | ||||||||||||||||||||||||
| 3035 | { | - | ||||||||||||||||||||||||
| 3036 | int width = dial->rect.width(); | - | ||||||||||||||||||||||||
| 3037 | int height = dial->rect.height(); | - | ||||||||||||||||||||||||
| 3038 | int r = qMin(width, height) / 2; | - | ||||||||||||||||||||||||
| 3039 | int currentSliderPosition = dial->upsideDown ? dial->sliderPosition : (dial->maximum - dial->sliderPosition);
| 0 | ||||||||||||||||||||||||
| 3040 | - | |||||||||||||||||||||||||
| 3041 | if (dial->maximum == dial->minimum)
| 0 | ||||||||||||||||||||||||
| 3042 | a = Q_PI / 2; never executed: a = Q_PI / 2; | 0 | ||||||||||||||||||||||||
| 3043 | else if (dial->dialWrapping)
| 0 | ||||||||||||||||||||||||
| 3044 | a = Q_PI * 3 / 2 - (currentSliderPosition - dial->minimum) * 2 * Q_PI never executed: a = Q_PI * 3 / 2 - (currentSliderPosition - dial->minimum) * 2 * Q_PI / (dial->maximum - dial->minimum); | 0 | ||||||||||||||||||||||||
| 3045 | / (dial->maximum - dial->minimum); never executed: a = Q_PI * 3 / 2 - (currentSliderPosition - dial->minimum) * 2 * Q_PI / (dial->maximum - dial->minimum); | 0 | ||||||||||||||||||||||||
| 3046 | else | - | ||||||||||||||||||||||||
| 3047 | a = (Q_PI * 8 - (currentSliderPosition - dial->minimum) * 10 * Q_PI never executed: a = (Q_PI * 8 - (currentSliderPosition - dial->minimum) * 10 * Q_PI / (dial->maximum - dial->minimum)) / 6; | 0 | ||||||||||||||||||||||||
| 3048 | / (dial->maximum - dial->minimum)) / 6; never executed: a = (Q_PI * 8 - (currentSliderPosition - dial->minimum) * 10 * Q_PI / (dial->maximum - dial->minimum)) / 6; | 0 | ||||||||||||||||||||||||
| 3049 | - | |||||||||||||||||||||||||
| 3050 | int xc = width / 2; | - | ||||||||||||||||||||||||
| 3051 | int yc = height / 2; | - | ||||||||||||||||||||||||
| 3052 | - | |||||||||||||||||||||||||
| 3053 | int len = r - QStyleHelper::calcBigLineSize(r) - 5; | - | ||||||||||||||||||||||||
| 3054 | if (len < 5)
| 0 | ||||||||||||||||||||||||
| 3055 | len = 5; never executed: len = 5; | 0 | ||||||||||||||||||||||||
| 3056 | int back = len / 2; | - | ||||||||||||||||||||||||
| 3057 | - | |||||||||||||||||||||||||
| 3058 | StaticPolygonF<3> arrow = {{ | - | ||||||||||||||||||||||||
| 3059 | QPointF(0.5 + xc + len * qCos(a), | - | ||||||||||||||||||||||||
| 3060 | 0.5 + yc - len * qSin(a)), | - | ||||||||||||||||||||||||
| 3061 | QPointF(0.5 + xc + back * qCos(a + Q_PI * 5 / 6), | - | ||||||||||||||||||||||||
| 3062 | 0.5 + yc - back * qSin(a + Q_PI * 5 / 6)), | - | ||||||||||||||||||||||||
| 3063 | QPointF(0.5 + xc + back * qCos(a - Q_PI * 5 / 6), | - | ||||||||||||||||||||||||
| 3064 | 0.5 + yc - back * qSin(a - Q_PI * 5 / 6)), | - | ||||||||||||||||||||||||
| 3065 | }}; | - | ||||||||||||||||||||||||
| 3066 | return arrow; never executed: return arrow; | 0 | ||||||||||||||||||||||||
| 3067 | } | - | ||||||||||||||||||||||||
| 3068 | - | |||||||||||||||||||||||||
| 3069 | #endif // QT_NO_DIAL | - | ||||||||||||||||||||||||
| 3070 | - | |||||||||||||||||||||||||
| 3071 | /*! | - | ||||||||||||||||||||||||
| 3072 | \reimp | - | ||||||||||||||||||||||||
| 3073 | */ | - | ||||||||||||||||||||||||
| 3074 | void QCommonStyle::drawComplexControl(ComplexControl cc, const QStyleOptionComplex *opt, | - | ||||||||||||||||||||||||
| 3075 | QPainter *p, const QWidget *widget) const | - | ||||||||||||||||||||||||
| 3076 | { | - | ||||||||||||||||||||||||
| 3077 | switch (cc) { | - | ||||||||||||||||||||||||
| 3078 | #ifndef QT_NO_SLIDER | - | ||||||||||||||||||||||||
| 3079 | case CC_Slider: never executed: case CC_Slider: | 0 | ||||||||||||||||||||||||
| 3080 | if (const QStyleOptionSlider *slider = qstyleoption_cast<const QStyleOptionSlider *>(opt)) {
| 0 | ||||||||||||||||||||||||
| 3081 | if (slider->subControls == SC_SliderTickmarks) {
| 0 | ||||||||||||||||||||||||
| 3082 | int tickOffset = proxy()->pixelMetric(PM_SliderTickmarkOffset, slider, widget); | - | ||||||||||||||||||||||||
| 3083 | int ticks = slider->tickPosition; | - | ||||||||||||||||||||||||
| 3084 | int thickness = proxy()->pixelMetric(PM_SliderControlThickness, slider, widget); | - | ||||||||||||||||||||||||
| 3085 | int len = proxy()->pixelMetric(PM_SliderLength, slider, widget); | - | ||||||||||||||||||||||||
| 3086 | int available = proxy()->pixelMetric(PM_SliderSpaceAvailable, slider, widget); | - | ||||||||||||||||||||||||
| 3087 | int interval = slider->tickInterval; | - | ||||||||||||||||||||||||
| 3088 | if (interval <= 0) {
| 0 | ||||||||||||||||||||||||
| 3089 | interval = slider->singleStep; | - | ||||||||||||||||||||||||
| 3090 | if (QStyle::sliderPositionFromValue(slider->minimum, slider->maximum, interval,
| 0 | ||||||||||||||||||||||||
| 3091 | available)
| 0 | ||||||||||||||||||||||||
| 3092 | - QStyle::sliderPositionFromValue(slider->minimum, slider->maximum,
| 0 | ||||||||||||||||||||||||
| 3093 | 0, available) < 3)
| 0 | ||||||||||||||||||||||||
| 3094 | interval = slider->pageStep; never executed: interval = slider->pageStep; | 0 | ||||||||||||||||||||||||
| 3095 | } never executed: end of block | 0 | ||||||||||||||||||||||||
| 3096 | if (!interval)
| 0 | ||||||||||||||||||||||||
| 3097 | interval = 1; never executed: interval = 1; | 0 | ||||||||||||||||||||||||
| 3098 | int fudge = len / 2; | - | ||||||||||||||||||||||||
| 3099 | int pos; | - | ||||||||||||||||||||||||
| 3100 | // Since there is no subrect for tickmarks do a translation here. | - | ||||||||||||||||||||||||
| 3101 | p->save(); | - | ||||||||||||||||||||||||
| 3102 | p->translate(slider->rect.x(), slider->rect.y()); | - | ||||||||||||||||||||||||
| 3103 | p->setPen(slider->palette.foreground().color()); | - | ||||||||||||||||||||||||
| 3104 | int v = slider->minimum; | - | ||||||||||||||||||||||||
| 3105 | while (v <= slider->maximum + 1) {
| 0 | ||||||||||||||||||||||||
| 3106 | if (v == slider->maximum + 1 && interval == 1)
| 0 | ||||||||||||||||||||||||
| 3107 | break; never executed: break; | 0 | ||||||||||||||||||||||||
| 3108 | const int v_ = qMin(v, slider->maximum); | - | ||||||||||||||||||||||||
| 3109 | pos = QStyle::sliderPositionFromValue(slider->minimum, slider->maximum, | - | ||||||||||||||||||||||||
| 3110 | v_, available) + fudge; | - | ||||||||||||||||||||||||
| 3111 | if (slider->orientation == Qt::Horizontal) {
| 0 | ||||||||||||||||||||||||
| 3112 | if (ticks & QSlider::TicksAbove)
| 0 | ||||||||||||||||||||||||
| 3113 | p->drawLine(pos, 0, pos, tickOffset - 2); never executed: p->drawLine(pos, 0, pos, tickOffset - 2); | 0 | ||||||||||||||||||||||||
| 3114 | if (ticks & QSlider::TicksBelow)
| 0 | ||||||||||||||||||||||||
| 3115 | p->drawLine(pos, tickOffset + thickness + 1, pos, never executed: p->drawLine(pos, tickOffset + thickness + 1, pos, slider->rect.height()-1); | 0 | ||||||||||||||||||||||||
| 3116 | slider->rect.height()-1); never executed: p->drawLine(pos, tickOffset + thickness + 1, pos, slider->rect.height()-1); | 0 | ||||||||||||||||||||||||
| 3117 | } else { never executed: end of block | 0 | ||||||||||||||||||||||||
| 3118 | if (ticks & QSlider::TicksAbove)
| 0 | ||||||||||||||||||||||||
| 3119 | p->drawLine(0, pos, tickOffset - 2, pos); never executed: p->drawLine(0, pos, tickOffset - 2, pos); | 0 | ||||||||||||||||||||||||
| 3120 | if (ticks & QSlider::TicksBelow)
| 0 | ||||||||||||||||||||||||
| 3121 | p->drawLine(tickOffset + thickness + 1, pos, never executed: p->drawLine(tickOffset + thickness + 1, pos, slider->rect.width()-1, pos); | 0 | ||||||||||||||||||||||||
| 3122 | slider->rect.width()-1, pos); never executed: p->drawLine(tickOffset + thickness + 1, pos, slider->rect.width()-1, pos); | 0 | ||||||||||||||||||||||||
| 3123 | } never executed: end of block | 0 | ||||||||||||||||||||||||
| 3124 | // in the case where maximum is max int | - | ||||||||||||||||||||||||
| 3125 | int nextInterval = v + interval; | - | ||||||||||||||||||||||||
| 3126 | if (nextInterval < v)
| 0 | ||||||||||||||||||||||||
| 3127 | break; never executed: break; | 0 | ||||||||||||||||||||||||
| 3128 | v = nextInterval; | - | ||||||||||||||||||||||||
| 3129 | } never executed: end of block | 0 | ||||||||||||||||||||||||
| 3130 | p->restore(); | - | ||||||||||||||||||||||||
| 3131 | } never executed: end of block | 0 | ||||||||||||||||||||||||
| 3132 | } never executed: end of block | 0 | ||||||||||||||||||||||||
| 3133 | break; never executed: break; | 0 | ||||||||||||||||||||||||
| 3134 | #endif // QT_NO_SLIDER | - | ||||||||||||||||||||||||
| 3135 | #ifndef QT_NO_SCROLLBAR | - | ||||||||||||||||||||||||
| 3136 | case CC_ScrollBar: never executed: case CC_ScrollBar: | 0 | ||||||||||||||||||||||||
| 3137 | if (const QStyleOptionSlider *scrollbar = qstyleoption_cast<const QStyleOptionSlider *>(opt)) {
| 0 | ||||||||||||||||||||||||
| 3138 | // Make a copy here and reset it for each primitive. | - | ||||||||||||||||||||||||
| 3139 | QStyleOptionSlider newScrollbar = *scrollbar; | - | ||||||||||||||||||||||||
| 3140 | State saveFlags = scrollbar->state; | - | ||||||||||||||||||||||||
| 3141 | - | |||||||||||||||||||||||||
| 3142 | if (scrollbar->subControls & SC_ScrollBarSubLine) {
| 0 | ||||||||||||||||||||||||
| 3143 | newScrollbar.state = saveFlags; | - | ||||||||||||||||||||||||
| 3144 | newScrollbar.rect = proxy()->subControlRect(cc, &newScrollbar, SC_ScrollBarSubLine, widget); | - | ||||||||||||||||||||||||
| 3145 | if (newScrollbar.rect.isValid()) {
| 0 | ||||||||||||||||||||||||
| 3146 | if (!(scrollbar->activeSubControls & SC_ScrollBarSubLine))
| 0 | ||||||||||||||||||||||||
| 3147 | newScrollbar.state &= ~(State_Sunken | State_MouseOver); never executed: newScrollbar.state &= ~(State_Sunken | State_MouseOver); | 0 | ||||||||||||||||||||||||
| 3148 | proxy()->drawControl(CE_ScrollBarSubLine, &newScrollbar, p, widget); | - | ||||||||||||||||||||||||
| 3149 | } never executed: end of block | 0 | ||||||||||||||||||||||||
| 3150 | } never executed: end of block | 0 | ||||||||||||||||||||||||
| 3151 | if (scrollbar->subControls & SC_ScrollBarAddLine) {
| 0 | ||||||||||||||||||||||||
| 3152 | newScrollbar.rect = scrollbar->rect; | - | ||||||||||||||||||||||||
| 3153 | newScrollbar.state = saveFlags; | - | ||||||||||||||||||||||||
| 3154 | newScrollbar.rect = proxy()->subControlRect(cc, &newScrollbar, SC_ScrollBarAddLine, widget); | - | ||||||||||||||||||||||||
| 3155 | if (newScrollbar.rect.isValid()) {
| 0 | ||||||||||||||||||||||||
| 3156 | if (!(scrollbar->activeSubControls & SC_ScrollBarAddLine))
| 0 | ||||||||||||||||||||||||
| 3157 | newScrollbar.state &= ~(State_Sunken | State_MouseOver); never executed: newScrollbar.state &= ~(State_Sunken | State_MouseOver); | 0 | ||||||||||||||||||||||||
| 3158 | proxy()->drawControl(CE_ScrollBarAddLine, &newScrollbar, p, widget); | - | ||||||||||||||||||||||||
| 3159 | } never executed: end of block | 0 | ||||||||||||||||||||||||
| 3160 | } never executed: end of block | 0 | ||||||||||||||||||||||||
| 3161 | if (scrollbar->subControls & SC_ScrollBarSubPage) {
| 0 | ||||||||||||||||||||||||
| 3162 | newScrollbar.rect = scrollbar->rect; | - | ||||||||||||||||||||||||
| 3163 | newScrollbar.state = saveFlags; | - | ||||||||||||||||||||||||
| 3164 | newScrollbar.rect = proxy()->subControlRect(cc, &newScrollbar, SC_ScrollBarSubPage, widget); | - | ||||||||||||||||||||||||
| 3165 | if (newScrollbar.rect.isValid()) {
| 0 | ||||||||||||||||||||||||
| 3166 | if (!(scrollbar->activeSubControls & SC_ScrollBarSubPage))
| 0 | ||||||||||||||||||||||||
| 3167 | newScrollbar.state &= ~(State_Sunken | State_MouseOver); never executed: newScrollbar.state &= ~(State_Sunken | State_MouseOver); | 0 | ||||||||||||||||||||||||
| 3168 | proxy()->drawControl(CE_ScrollBarSubPage, &newScrollbar, p, widget); | - | ||||||||||||||||||||||||
| 3169 | } never executed: end of block | 0 | ||||||||||||||||||||||||
| 3170 | } never executed: end of block | 0 | ||||||||||||||||||||||||
| 3171 | if (scrollbar->subControls & SC_ScrollBarAddPage) {
| 0 | ||||||||||||||||||||||||
| 3172 | newScrollbar.rect = scrollbar->rect; | - | ||||||||||||||||||||||||
| 3173 | newScrollbar.state = saveFlags; | - | ||||||||||||||||||||||||
| 3174 | newScrollbar.rect = proxy()->subControlRect(cc, &newScrollbar, SC_ScrollBarAddPage, widget); | - | ||||||||||||||||||||||||
| 3175 | if (newScrollbar.rect.isValid()) {
| 0 | ||||||||||||||||||||||||
| 3176 | if (!(scrollbar->activeSubControls & SC_ScrollBarAddPage))
| 0 | ||||||||||||||||||||||||
| 3177 | newScrollbar.state &= ~(State_Sunken | State_MouseOver); never executed: newScrollbar.state &= ~(State_Sunken | State_MouseOver); | 0 | ||||||||||||||||||||||||
| 3178 | proxy()->drawControl(CE_ScrollBarAddPage, &newScrollbar, p, widget); | - | ||||||||||||||||||||||||
| 3179 | } never executed: end of block | 0 | ||||||||||||||||||||||||
| 3180 | } never executed: end of block | 0 | ||||||||||||||||||||||||
| 3181 | if (scrollbar->subControls & SC_ScrollBarFirst) {
| 0 | ||||||||||||||||||||||||
| 3182 | newScrollbar.rect = scrollbar->rect; | - | ||||||||||||||||||||||||
| 3183 | newScrollbar.state = saveFlags; | - | ||||||||||||||||||||||||
| 3184 | newScrollbar.rect = proxy()->subControlRect(cc, &newScrollbar, SC_ScrollBarFirst, widget); | - | ||||||||||||||||||||||||
| 3185 | if (newScrollbar.rect.isValid()) {
| 0 | ||||||||||||||||||||||||
| 3186 | if (!(scrollbar->activeSubControls & SC_ScrollBarFirst))
| 0 | ||||||||||||||||||||||||
| 3187 | newScrollbar.state &= ~(State_Sunken | State_MouseOver); never executed: newScrollbar.state &= ~(State_Sunken | State_MouseOver); | 0 | ||||||||||||||||||||||||
| 3188 | proxy()->drawControl(CE_ScrollBarFirst, &newScrollbar, p, widget); | - | ||||||||||||||||||||||||
| 3189 | } never executed: end of block | 0 | ||||||||||||||||||||||||
| 3190 | } never executed: end of block | 0 | ||||||||||||||||||||||||
| 3191 | if (scrollbar->subControls & SC_ScrollBarLast) {
| 0 | ||||||||||||||||||||||||
| 3192 | newScrollbar.rect = scrollbar->rect; | - | ||||||||||||||||||||||||
| 3193 | newScrollbar.state = saveFlags; | - | ||||||||||||||||||||||||
| 3194 | newScrollbar.rect = proxy()->subControlRect(cc, &newScrollbar, SC_ScrollBarLast, widget); | - | ||||||||||||||||||||||||
| 3195 | if (newScrollbar.rect.isValid()) {
| 0 | ||||||||||||||||||||||||
| 3196 | if (!(scrollbar->activeSubControls & SC_ScrollBarLast))
| 0 | ||||||||||||||||||||||||
| 3197 | newScrollbar.state &= ~(State_Sunken | State_MouseOver); never executed: newScrollbar.state &= ~(State_Sunken | State_MouseOver); | 0 | ||||||||||||||||||||||||
| 3198 | proxy()->drawControl(CE_ScrollBarLast, &newScrollbar, p, widget); | - | ||||||||||||||||||||||||
| 3199 | } never executed: end of block | 0 | ||||||||||||||||||||||||
| 3200 | } never executed: end of block | 0 | ||||||||||||||||||||||||
| 3201 | if (scrollbar->subControls & SC_ScrollBarSlider) {
| 0 | ||||||||||||||||||||||||
| 3202 | newScrollbar.rect = scrollbar->rect; | - | ||||||||||||||||||||||||
| 3203 | newScrollbar.state = saveFlags; | - | ||||||||||||||||||||||||
| 3204 | newScrollbar.rect = proxy()->subControlRect(cc, &newScrollbar, SC_ScrollBarSlider, widget); | - | ||||||||||||||||||||||||
| 3205 | if (newScrollbar.rect.isValid()) {
| 0 | ||||||||||||||||||||||||
| 3206 | if (!(scrollbar->activeSubControls & SC_ScrollBarSlider))
| 0 | ||||||||||||||||||||||||
| 3207 | newScrollbar.state &= ~(State_Sunken | State_MouseOver); never executed: newScrollbar.state &= ~(State_Sunken | State_MouseOver); | 0 | ||||||||||||||||||||||||
| 3208 | proxy()->drawControl(CE_ScrollBarSlider, &newScrollbar, p, widget); | - | ||||||||||||||||||||||||
| 3209 | - | |||||||||||||||||||||||||
| 3210 | if (scrollbar->state & State_HasFocus) {
| 0 | ||||||||||||||||||||||||
| 3211 | QStyleOptionFocusRect fropt; | - | ||||||||||||||||||||||||
| 3212 | fropt.QStyleOption::operator=(newScrollbar); | - | ||||||||||||||||||||||||
| 3213 | fropt.rect.setRect(newScrollbar.rect.x() + 2, newScrollbar.rect.y() + 2, | - | ||||||||||||||||||||||||
| 3214 | newScrollbar.rect.width() - 5, | - | ||||||||||||||||||||||||
| 3215 | newScrollbar.rect.height() - 5); | - | ||||||||||||||||||||||||
| 3216 | proxy()->drawPrimitive(PE_FrameFocusRect, &fropt, p, widget); | - | ||||||||||||||||||||||||
| 3217 | } never executed: end of block | 0 | ||||||||||||||||||||||||
| 3218 | } never executed: end of block | 0 | ||||||||||||||||||||||||
| 3219 | } never executed: end of block | 0 | ||||||||||||||||||||||||
| 3220 | } never executed: end of block | 0 | ||||||||||||||||||||||||
| 3221 | break; never executed: break; | 0 | ||||||||||||||||||||||||
| 3222 | #endif // QT_NO_SCROLLBAR | - | ||||||||||||||||||||||||
| 3223 | #ifndef QT_NO_SPINBOX | - | ||||||||||||||||||||||||
| 3224 | case CC_SpinBox: never executed: case CC_SpinBox: | 0 | ||||||||||||||||||||||||
| 3225 | if (const QStyleOptionSpinBox *sb = qstyleoption_cast<const QStyleOptionSpinBox *>(opt)) {
| 0 | ||||||||||||||||||||||||
| 3226 | QStyleOptionSpinBox copy = *sb; | - | ||||||||||||||||||||||||
| 3227 | PrimitiveElement pe; | - | ||||||||||||||||||||||||
| 3228 | - | |||||||||||||||||||||||||
| 3229 | if (sb->frame && (sb->subControls & SC_SpinBoxFrame)) {
| 0 | ||||||||||||||||||||||||
| 3230 | QRect r = proxy()->subControlRect(CC_SpinBox, sb, SC_SpinBoxFrame, widget); | - | ||||||||||||||||||||||||
| 3231 | qDrawWinPanel(p, r, sb->palette, true); | - | ||||||||||||||||||||||||
| 3232 | } never executed: end of block | 0 | ||||||||||||||||||||||||
| 3233 | - | |||||||||||||||||||||||||
| 3234 | if (sb->subControls & SC_SpinBoxUp) {
| 0 | ||||||||||||||||||||||||
| 3235 | copy.subControls = SC_SpinBoxUp; | - | ||||||||||||||||||||||||
| 3236 | QPalette pal2 = sb->palette; | - | ||||||||||||||||||||||||
| 3237 | if (!(sb->stepEnabled & QAbstractSpinBox::StepUpEnabled)) {
| 0 | ||||||||||||||||||||||||
| 3238 | pal2.setCurrentColorGroup(QPalette::Disabled); | - | ||||||||||||||||||||||||
| 3239 | copy.state &= ~State_Enabled; | - | ||||||||||||||||||||||||
| 3240 | } never executed: end of block | 0 | ||||||||||||||||||||||||
| 3241 | - | |||||||||||||||||||||||||
| 3242 | copy.palette = pal2; | - | ||||||||||||||||||||||||
| 3243 | - | |||||||||||||||||||||||||
| 3244 | if (sb->activeSubControls == SC_SpinBoxUp && (sb->state & State_Sunken)) {
| 0 | ||||||||||||||||||||||||
| 3245 | copy.state |= State_On; | - | ||||||||||||||||||||||||
| 3246 | copy.state |= State_Sunken; | - | ||||||||||||||||||||||||
| 3247 | } else { never executed: end of block | 0 | ||||||||||||||||||||||||
| 3248 | copy.state |= State_Raised; | - | ||||||||||||||||||||||||
| 3249 | copy.state &= ~State_Sunken; | - | ||||||||||||||||||||||||
| 3250 | } never executed: end of block | 0 | ||||||||||||||||||||||||
| 3251 | pe = (sb->buttonSymbols == QAbstractSpinBox::PlusMinus ? PE_IndicatorSpinPlus
| 0 | ||||||||||||||||||||||||
| 3252 | : PE_IndicatorSpinUp); | - | ||||||||||||||||||||||||
| 3253 | - | |||||||||||||||||||||||||
| 3254 | copy.rect = proxy()->subControlRect(CC_SpinBox, sb, SC_SpinBoxUp, widget); | - | ||||||||||||||||||||||||
| 3255 | proxy()->drawPrimitive(PE_PanelButtonBevel, ©, p, widget); | - | ||||||||||||||||||||||||
| 3256 | copy.rect.adjust(3, 0, -4, 0); | - | ||||||||||||||||||||||||
| 3257 | proxy()->drawPrimitive(pe, ©, p, widget); | - | ||||||||||||||||||||||||
| 3258 | } never executed: end of block | 0 | ||||||||||||||||||||||||
| 3259 | - | |||||||||||||||||||||||||
| 3260 | if (sb->subControls & SC_SpinBoxDown) {
| 0 | ||||||||||||||||||||||||
| 3261 | copy.subControls = SC_SpinBoxDown; | - | ||||||||||||||||||||||||
| 3262 | copy.state = sb->state; | - | ||||||||||||||||||||||||
| 3263 | QPalette pal2 = sb->palette; | - | ||||||||||||||||||||||||
| 3264 | if (!(sb->stepEnabled & QAbstractSpinBox::StepDownEnabled)) {
| 0 | ||||||||||||||||||||||||
| 3265 | pal2.setCurrentColorGroup(QPalette::Disabled); | - | ||||||||||||||||||||||||
| 3266 | copy.state &= ~State_Enabled; | - | ||||||||||||||||||||||||
| 3267 | } never executed: end of block | 0 | ||||||||||||||||||||||||
| 3268 | copy.palette = pal2; | - | ||||||||||||||||||||||||
| 3269 | - | |||||||||||||||||||||||||
| 3270 | if (sb->activeSubControls == SC_SpinBoxDown && (sb->state & State_Sunken)) {
| 0 | ||||||||||||||||||||||||
| 3271 | copy.state |= State_On; | - | ||||||||||||||||||||||||
| 3272 | copy.state |= State_Sunken; | - | ||||||||||||||||||||||||
| 3273 | } else { never executed: end of block | 0 | ||||||||||||||||||||||||
| 3274 | copy.state |= State_Raised; | - | ||||||||||||||||||||||||
| 3275 | copy.state &= ~State_Sunken; | - | ||||||||||||||||||||||||
| 3276 | } never executed: end of block | 0 | ||||||||||||||||||||||||
| 3277 | pe = (sb->buttonSymbols == QAbstractSpinBox::PlusMinus ? PE_IndicatorSpinMinus
| 0 | ||||||||||||||||||||||||
| 3278 | : PE_IndicatorSpinDown); | - | ||||||||||||||||||||||||
| 3279 | - | |||||||||||||||||||||||||
| 3280 | copy.rect = proxy()->subControlRect(CC_SpinBox, sb, SC_SpinBoxDown, widget); | - | ||||||||||||||||||||||||
| 3281 | proxy()->drawPrimitive(PE_PanelButtonBevel, ©, p, widget); | - | ||||||||||||||||||||||||
| 3282 | copy.rect.adjust(3, 0, -4, 0); | - | ||||||||||||||||||||||||
| 3283 | proxy()->drawPrimitive(pe, ©, p, widget); | - | ||||||||||||||||||||||||
| 3284 | } never executed: end of block | 0 | ||||||||||||||||||||||||
| 3285 | } never executed: end of block | 0 | ||||||||||||||||||||||||
| 3286 | break; never executed: break; | 0 | ||||||||||||||||||||||||
| 3287 | #endif // QT_NO_SPINBOX | - | ||||||||||||||||||||||||
| 3288 | #ifndef QT_NO_TOOLBUTTON | - | ||||||||||||||||||||||||
| 3289 | case CC_ToolButton: never executed: case CC_ToolButton: | 0 | ||||||||||||||||||||||||
| 3290 | if (const QStyleOptionToolButton *toolbutton
| 0 | ||||||||||||||||||||||||
| 3291 | = qstyleoption_cast<const QStyleOptionToolButton *>(opt)) {
| 0 | ||||||||||||||||||||||||
| 3292 | QRect button, menuarea; | - | ||||||||||||||||||||||||
| 3293 | button = proxy()->subControlRect(cc, toolbutton, SC_ToolButton, widget); | - | ||||||||||||||||||||||||
| 3294 | menuarea = proxy()->subControlRect(cc, toolbutton, SC_ToolButtonMenu, widget); | - | ||||||||||||||||||||||||
| 3295 | - | |||||||||||||||||||||||||
| 3296 | State bflags = toolbutton->state & ~State_Sunken; | - | ||||||||||||||||||||||||
| 3297 | - | |||||||||||||||||||||||||
| 3298 | if (bflags & State_AutoRaise) {
| 0 | ||||||||||||||||||||||||
| 3299 | if (!(bflags & State_MouseOver) || !(bflags & State_Enabled)) {
| 0 | ||||||||||||||||||||||||
| 3300 | bflags &= ~State_Raised; | - | ||||||||||||||||||||||||
| 3301 | } never executed: end of block | 0 | ||||||||||||||||||||||||
| 3302 | } never executed: end of block | 0 | ||||||||||||||||||||||||
| 3303 | State mflags = bflags; | - | ||||||||||||||||||||||||
| 3304 | if (toolbutton->state & State_Sunken) {
| 0 | ||||||||||||||||||||||||
| 3305 | if (toolbutton->activeSubControls & SC_ToolButton)
| 0 | ||||||||||||||||||||||||
| 3306 | bflags |= State_Sunken; never executed: bflags |= State_Sunken; | 0 | ||||||||||||||||||||||||
| 3307 | mflags |= State_Sunken; | - | ||||||||||||||||||||||||
| 3308 | } never executed: end of block | 0 | ||||||||||||||||||||||||
| 3309 | - | |||||||||||||||||||||||||
| 3310 | QStyleOption tool = *toolbutton; | - | ||||||||||||||||||||||||
| 3311 | if (toolbutton->subControls & SC_ToolButton) {
| 0 | ||||||||||||||||||||||||
| 3312 | if (bflags & (State_Sunken | State_On | State_Raised)) {
| 0 | ||||||||||||||||||||||||
| 3313 | tool.rect = button; | - | ||||||||||||||||||||||||
| 3314 | tool.state = bflags; | - | ||||||||||||||||||||||||
| 3315 | proxy()->drawPrimitive(PE_PanelButtonTool, &tool, p, widget); | - | ||||||||||||||||||||||||
| 3316 | } never executed: end of block | 0 | ||||||||||||||||||||||||
| 3317 | } never executed: end of block | 0 | ||||||||||||||||||||||||
| 3318 | - | |||||||||||||||||||||||||
| 3319 | if (toolbutton->state & State_HasFocus) {
| 0 | ||||||||||||||||||||||||
| 3320 | QStyleOptionFocusRect fr; | - | ||||||||||||||||||||||||
| 3321 | fr.QStyleOption::operator=(*toolbutton); | - | ||||||||||||||||||||||||
| 3322 | fr.rect.adjust(3, 3, -3, -3); | - | ||||||||||||||||||||||||
| 3323 | if (toolbutton->features & QStyleOptionToolButton::MenuButtonPopup)
| 0 | ||||||||||||||||||||||||
| 3324 | fr.rect.adjust(0, 0, -proxy()->pixelMetric(QStyle::PM_MenuButtonIndicator, never executed: fr.rect.adjust(0, 0, -proxy()->pixelMetric(QStyle::PM_MenuButtonIndicator, toolbutton, widget), 0); | 0 | ||||||||||||||||||||||||
| 3325 | toolbutton, widget), 0); never executed: fr.rect.adjust(0, 0, -proxy()->pixelMetric(QStyle::PM_MenuButtonIndicator, toolbutton, widget), 0); | 0 | ||||||||||||||||||||||||
| 3326 | proxy()->drawPrimitive(PE_FrameFocusRect, &fr, p, widget); | - | ||||||||||||||||||||||||
| 3327 | } never executed: end of block | 0 | ||||||||||||||||||||||||
| 3328 | QStyleOptionToolButton label = *toolbutton; | - | ||||||||||||||||||||||||
| 3329 | label.state = bflags; | - | ||||||||||||||||||||||||
| 3330 | int fw = proxy()->pixelMetric(PM_DefaultFrameWidth, opt, widget); | - | ||||||||||||||||||||||||
| 3331 | label.rect = button.adjusted(fw, fw, -fw, -fw); | - | ||||||||||||||||||||||||
| 3332 | proxy()->drawControl(CE_ToolButtonLabel, &label, p, widget); | - | ||||||||||||||||||||||||
| 3333 | - | |||||||||||||||||||||||||
| 3334 | if (toolbutton->subControls & SC_ToolButtonMenu) {
| 0 | ||||||||||||||||||||||||
| 3335 | tool.rect = menuarea; | - | ||||||||||||||||||||||||
| 3336 | tool.state = mflags; | - | ||||||||||||||||||||||||
| 3337 | if (mflags & (State_Sunken | State_On | State_Raised))
| 0 | ||||||||||||||||||||||||
| 3338 | proxy()->drawPrimitive(PE_IndicatorButtonDropDown, &tool, p, widget); never executed: proxy()->drawPrimitive(PE_IndicatorButtonDropDown, &tool, p, widget); | 0 | ||||||||||||||||||||||||
| 3339 | proxy()->drawPrimitive(PE_IndicatorArrowDown, &tool, p, widget); | - | ||||||||||||||||||||||||
| 3340 | } else if (toolbutton->features & QStyleOptionToolButton::HasMenu) { never executed: end of block
| 0 | ||||||||||||||||||||||||
| 3341 | int mbi = proxy()->pixelMetric(PM_MenuButtonIndicator, toolbutton, widget); | - | ||||||||||||||||||||||||
| 3342 | QRect ir = toolbutton->rect; | - | ||||||||||||||||||||||||
| 3343 | QStyleOptionToolButton newBtn = *toolbutton; | - | ||||||||||||||||||||||||
| 3344 | newBtn.rect = QRect(ir.right() + 5 - mbi, ir.y() + ir.height() - mbi + 4, mbi - 6, mbi - 6); | - | ||||||||||||||||||||||||
| 3345 | proxy()->drawPrimitive(PE_IndicatorArrowDown, &newBtn, p, widget); | - | ||||||||||||||||||||||||
| 3346 | } never executed: end of block | 0 | ||||||||||||||||||||||||
| 3347 | } never executed: end of block | 0 | ||||||||||||||||||||||||
| 3348 | break; never executed: break; | 0 | ||||||||||||||||||||||||
| 3349 | #endif // QT_NO_TOOLBUTTON | - | ||||||||||||||||||||||||
| 3350 | case CC_TitleBar: never executed: case CC_TitleBar: | 0 | ||||||||||||||||||||||||
| 3351 | if (const QStyleOptionTitleBar *tb = qstyleoption_cast<const QStyleOptionTitleBar *>(opt)) {
| 0 | ||||||||||||||||||||||||
| 3352 | QRect ir; | - | ||||||||||||||||||||||||
| 3353 | if (opt->subControls & SC_TitleBarLabel) {
| 0 | ||||||||||||||||||||||||
| 3354 | QColor left = tb->palette.highlight().color(); | - | ||||||||||||||||||||||||
| 3355 | QColor right = tb->palette.base().color(); | - | ||||||||||||||||||||||||
| 3356 | - | |||||||||||||||||||||||||
| 3357 | QBrush fillBrush(left); | - | ||||||||||||||||||||||||
| 3358 | if (left != right) {
| 0 | ||||||||||||||||||||||||
| 3359 | QPoint p1(tb->rect.x(), tb->rect.top() + tb->rect.height()/2); | - | ||||||||||||||||||||||||
| 3360 | QPoint p2(tb->rect.right(), tb->rect.top() + tb->rect.height()/2); | - | ||||||||||||||||||||||||
| 3361 | QLinearGradient lg(p1, p2); | - | ||||||||||||||||||||||||
| 3362 | lg.setColorAt(0, left); | - | ||||||||||||||||||||||||
| 3363 | lg.setColorAt(1, right); | - | ||||||||||||||||||||||||
| 3364 | fillBrush = lg; | - | ||||||||||||||||||||||||
| 3365 | } never executed: end of block | 0 | ||||||||||||||||||||||||
| 3366 | - | |||||||||||||||||||||||||
| 3367 | p->fillRect(opt->rect, fillBrush); | - | ||||||||||||||||||||||||
| 3368 | - | |||||||||||||||||||||||||
| 3369 | ir = proxy()->subControlRect(CC_TitleBar, tb, SC_TitleBarLabel, widget); | - | ||||||||||||||||||||||||
| 3370 | - | |||||||||||||||||||||||||
| 3371 | p->setPen(tb->palette.highlightedText().color()); | - | ||||||||||||||||||||||||
| 3372 | p->drawText(ir.x() + 2, ir.y(), ir.width() - 2, ir.height(), | - | ||||||||||||||||||||||||
| 3373 | Qt::AlignLeft | Qt::AlignVCenter | Qt::TextSingleLine, tb->text); | - | ||||||||||||||||||||||||
| 3374 | } never executed: end of block | 0 | ||||||||||||||||||||||||
| 3375 | - | |||||||||||||||||||||||||
| 3376 | bool down = false; | - | ||||||||||||||||||||||||
| 3377 | QPixmap pm; | - | ||||||||||||||||||||||||
| 3378 | - | |||||||||||||||||||||||||
| 3379 | QStyleOption tool = *tb; | - | ||||||||||||||||||||||||
| 3380 | if (tb->subControls & SC_TitleBarCloseButton && tb->titleBarFlags & Qt::WindowSystemMenuHint) {
| 0 | ||||||||||||||||||||||||
| 3381 | ir = proxy()->subControlRect(CC_TitleBar, tb, SC_TitleBarCloseButton, widget); | - | ||||||||||||||||||||||||
| 3382 | down = tb->activeSubControls & SC_TitleBarCloseButton && (opt->state & State_Sunken);
| 0 | ||||||||||||||||||||||||
| 3383 | if ((tb->titleBarFlags & Qt::WindowType_Mask) == Qt::Tool
| 0 | ||||||||||||||||||||||||
| 3384 | #ifndef QT_NO_DOCKWIDGET | - | ||||||||||||||||||||||||
| 3385 | || qobject_cast<const QDockWidget *>(widget)
| 0 | ||||||||||||||||||||||||
| 3386 | #endif | - | ||||||||||||||||||||||||
| 3387 | ) | - | ||||||||||||||||||||||||
| 3388 | pm = proxy()->standardIcon(SP_DockWidgetCloseButton, &tool, widget).pixmap(qt_getWindow(widget), QSize(10, 10)); never executed: pm = proxy()->standardIcon(SP_DockWidgetCloseButton, &tool, widget).pixmap(qt_getWindow(widget), QSize(10, 10)); | 0 | ||||||||||||||||||||||||
| 3389 | else | - | ||||||||||||||||||||||||
| 3390 | pm = proxy()->standardIcon(SP_TitleBarCloseButton, &tool, widget).pixmap(qt_getWindow(widget), QSize(10, 10)); never executed: pm = proxy()->standardIcon(SP_TitleBarCloseButton, &tool, widget).pixmap(qt_getWindow(widget), QSize(10, 10)); | 0 | ||||||||||||||||||||||||
| 3391 | tool.rect = ir; | - | ||||||||||||||||||||||||
| 3392 | tool.state = down ? State_Sunken : State_Raised;
| 0 | ||||||||||||||||||||||||
| 3393 | proxy()->drawPrimitive(PE_PanelButtonTool, &tool, p, widget); | - | ||||||||||||||||||||||||
| 3394 | - | |||||||||||||||||||||||||
| 3395 | p->save(); | - | ||||||||||||||||||||||||
| 3396 | if (down)
| 0 | ||||||||||||||||||||||||
| 3397 | p->translate(proxy()->pixelMetric(PM_ButtonShiftHorizontal, tb, widget), never executed: p->translate(proxy()->pixelMetric(PM_ButtonShiftHorizontal, tb, widget), proxy()->pixelMetric(PM_ButtonShiftVertical, tb, widget)); | 0 | ||||||||||||||||||||||||
| 3398 | proxy()->pixelMetric(PM_ButtonShiftVertical, tb, widget)); never executed: p->translate(proxy()->pixelMetric(PM_ButtonShiftHorizontal, tb, widget), proxy()->pixelMetric(PM_ButtonShiftVertical, tb, widget)); | 0 | ||||||||||||||||||||||||
| 3399 | proxy()->drawItemPixmap(p, ir, Qt::AlignCenter, pm); | - | ||||||||||||||||||||||||
| 3400 | p->restore(); | - | ||||||||||||||||||||||||
| 3401 | } never executed: end of block | 0 | ||||||||||||||||||||||||
| 3402 | - | |||||||||||||||||||||||||
| 3403 | if (tb->subControls & SC_TitleBarMaxButton
| 0 | ||||||||||||||||||||||||
| 3404 | && tb->titleBarFlags & Qt::WindowMaximizeButtonHint
| 0 | ||||||||||||||||||||||||
| 3405 | && !(tb->titleBarState & Qt::WindowMaximized)) {
| 0 | ||||||||||||||||||||||||
| 3406 | ir = proxy()->subControlRect(CC_TitleBar, tb, SC_TitleBarMaxButton, widget); | - | ||||||||||||||||||||||||
| 3407 | - | |||||||||||||||||||||||||
| 3408 | down = tb->activeSubControls & SC_TitleBarMaxButton && (opt->state & State_Sunken);
| 0 | ||||||||||||||||||||||||
| 3409 | pm = proxy()->standardIcon(SP_TitleBarMaxButton, &tool, widget).pixmap(qt_getWindow(widget), QSize(10, 10)); | - | ||||||||||||||||||||||||
| 3410 | tool.rect = ir; | - | ||||||||||||||||||||||||
| 3411 | tool.state = down ? State_Sunken : State_Raised;
| 0 | ||||||||||||||||||||||||
| 3412 | proxy()->drawPrimitive(PE_PanelButtonTool, &tool, p, widget); | - | ||||||||||||||||||||||||
| 3413 | - | |||||||||||||||||||||||||
| 3414 | p->save(); | - | ||||||||||||||||||||||||
| 3415 | if (down)
| 0 | ||||||||||||||||||||||||
| 3416 | p->translate(proxy()->pixelMetric(PM_ButtonShiftHorizontal, tb, widget), never executed: p->translate(proxy()->pixelMetric(PM_ButtonShiftHorizontal, tb, widget), proxy()->pixelMetric(PM_ButtonShiftVertical, tb, widget)); | 0 | ||||||||||||||||||||||||
| 3417 | proxy()->pixelMetric(PM_ButtonShiftVertical, tb, widget)); never executed: p->translate(proxy()->pixelMetric(PM_ButtonShiftHorizontal, tb, widget), proxy()->pixelMetric(PM_ButtonShiftVertical, tb, widget)); | 0 | ||||||||||||||||||||||||
| 3418 | proxy()->drawItemPixmap(p, ir, Qt::AlignCenter, pm); | - | ||||||||||||||||||||||||
| 3419 | p->restore(); | - | ||||||||||||||||||||||||
| 3420 | } never executed: end of block | 0 | ||||||||||||||||||||||||
| 3421 | - | |||||||||||||||||||||||||
| 3422 | if (tb->subControls & SC_TitleBarMinButton
| 0 | ||||||||||||||||||||||||
| 3423 | && tb->titleBarFlags & Qt::WindowMinimizeButtonHint
| 0 | ||||||||||||||||||||||||
| 3424 | && !(tb->titleBarState & Qt::WindowMinimized)) {
| 0 | ||||||||||||||||||||||||
| 3425 | ir = proxy()->subControlRect(CC_TitleBar, tb, SC_TitleBarMinButton, widget); | - | ||||||||||||||||||||||||
| 3426 | down = tb->activeSubControls & SC_TitleBarMinButton && (opt->state & State_Sunken);
| 0 | ||||||||||||||||||||||||
| 3427 | pm = proxy()->standardIcon(SP_TitleBarMinButton, &tool, widget).pixmap(qt_getWindow(widget), QSize(10, 10)); | - | ||||||||||||||||||||||||
| 3428 | tool.rect = ir; | - | ||||||||||||||||||||||||
| 3429 | tool.state = down ? State_Sunken : State_Raised;
| 0 | ||||||||||||||||||||||||
| 3430 | proxy()->drawPrimitive(PE_PanelButtonTool, &tool, p, widget); | - | ||||||||||||||||||||||||
| 3431 | - | |||||||||||||||||||||||||
| 3432 | p->save(); | - | ||||||||||||||||||||||||
| 3433 | if (down)
| 0 | ||||||||||||||||||||||||
| 3434 | p->translate(proxy()->pixelMetric(PM_ButtonShiftHorizontal, tb, widget), never executed: p->translate(proxy()->pixelMetric(PM_ButtonShiftHorizontal, tb, widget), proxy()->pixelMetric(PM_ButtonShiftVertical, tb, widget)); | 0 | ||||||||||||||||||||||||
| 3435 | proxy()->pixelMetric(PM_ButtonShiftVertical, tb, widget)); never executed: p->translate(proxy()->pixelMetric(PM_ButtonShiftHorizontal, tb, widget), proxy()->pixelMetric(PM_ButtonShiftVertical, tb, widget)); | 0 | ||||||||||||||||||||||||
| 3436 | proxy()->drawItemPixmap(p, ir, Qt::AlignCenter, pm); | - | ||||||||||||||||||||||||
| 3437 | p->restore(); | - | ||||||||||||||||||||||||
| 3438 | } never executed: end of block | 0 | ||||||||||||||||||||||||
| 3439 | - | |||||||||||||||||||||||||
| 3440 | bool drawNormalButton = (tb->subControls & SC_TitleBarNormalButton)
| 0 | ||||||||||||||||||||||||
| 3441 | && (((tb->titleBarFlags & Qt::WindowMinimizeButtonHint)
| 0 | ||||||||||||||||||||||||
| 3442 | && (tb->titleBarState & Qt::WindowMinimized))
| 0 | ||||||||||||||||||||||||
| 3443 | || ((tb->titleBarFlags & Qt::WindowMaximizeButtonHint)
| 0 | ||||||||||||||||||||||||
| 3444 | && (tb->titleBarState & Qt::WindowMaximized)));
| 0 | ||||||||||||||||||||||||
| 3445 | - | |||||||||||||||||||||||||
| 3446 | if (drawNormalButton) {
| 0 | ||||||||||||||||||||||||
| 3447 | ir = proxy()->subControlRect(CC_TitleBar, tb, SC_TitleBarNormalButton, widget); | - | ||||||||||||||||||||||||
| 3448 | down = tb->activeSubControls & SC_TitleBarNormalButton && (opt->state & State_Sunken);
| 0 | ||||||||||||||||||||||||
| 3449 | pm = proxy()->standardIcon(SP_TitleBarNormalButton, &tool, widget).pixmap(qt_getWindow(widget), QSize(10, 10)); | - | ||||||||||||||||||||||||
| 3450 | tool.rect = ir; | - | ||||||||||||||||||||||||
| 3451 | tool.state = down ? State_Sunken : State_Raised;
| 0 | ||||||||||||||||||||||||
| 3452 | proxy()->drawPrimitive(PE_PanelButtonTool, &tool, p, widget); | - | ||||||||||||||||||||||||
| 3453 | - | |||||||||||||||||||||||||
| 3454 | p->save(); | - | ||||||||||||||||||||||||
| 3455 | if (down)
| 0 | ||||||||||||||||||||||||
| 3456 | p->translate(proxy()->pixelMetric(PM_ButtonShiftHorizontal, tb, widget), never executed: p->translate(proxy()->pixelMetric(PM_ButtonShiftHorizontal, tb, widget), proxy()->pixelMetric(PM_ButtonShiftVertical, tb, widget)); | 0 | ||||||||||||||||||||||||
| 3457 | proxy()->pixelMetric(PM_ButtonShiftVertical, tb, widget)); never executed: p->translate(proxy()->pixelMetric(PM_ButtonShiftHorizontal, tb, widget), proxy()->pixelMetric(PM_ButtonShiftVertical, tb, widget)); | 0 | ||||||||||||||||||||||||
| 3458 | proxy()->drawItemPixmap(p, ir, Qt::AlignCenter, pm); | - | ||||||||||||||||||||||||
| 3459 | p->restore(); | - | ||||||||||||||||||||||||
| 3460 | } never executed: end of block | 0 | ||||||||||||||||||||||||
| 3461 | - | |||||||||||||||||||||||||
| 3462 | if (tb->subControls & SC_TitleBarShadeButton
| 0 | ||||||||||||||||||||||||
| 3463 | && tb->titleBarFlags & Qt::WindowShadeButtonHint
| 0 | ||||||||||||||||||||||||
| 3464 | && !(tb->titleBarState & Qt::WindowMinimized)) {
| 0 | ||||||||||||||||||||||||
| 3465 | ir = proxy()->subControlRect(CC_TitleBar, tb, SC_TitleBarShadeButton, widget); | - | ||||||||||||||||||||||||
| 3466 | down = (tb->activeSubControls & SC_TitleBarShadeButton && (opt->state & State_Sunken));
| 0 | ||||||||||||||||||||||||
| 3467 | pm = proxy()->standardIcon(SP_TitleBarShadeButton, &tool, widget).pixmap(qt_getWindow(widget), QSize(10, 10)); | - | ||||||||||||||||||||||||
| 3468 | tool.rect = ir; | - | ||||||||||||||||||||||||
| 3469 | tool.state = down ? State_Sunken : State_Raised;
| 0 | ||||||||||||||||||||||||
| 3470 | proxy()->drawPrimitive(PE_PanelButtonTool, &tool, p, widget); | - | ||||||||||||||||||||||||
| 3471 | p->save(); | - | ||||||||||||||||||||||||
| 3472 | if (down)
| 0 | ||||||||||||||||||||||||
| 3473 | p->translate(proxy()->pixelMetric(PM_ButtonShiftHorizontal, tb, widget), never executed: p->translate(proxy()->pixelMetric(PM_ButtonShiftHorizontal, tb, widget), proxy()->pixelMetric(PM_ButtonShiftVertical, tb, widget)); | 0 | ||||||||||||||||||||||||
| 3474 | proxy()->pixelMetric(PM_ButtonShiftVertical, tb, widget)); never executed: p->translate(proxy()->pixelMetric(PM_ButtonShiftHorizontal, tb, widget), proxy()->pixelMetric(PM_ButtonShiftVertical, tb, widget)); | 0 | ||||||||||||||||||||||||
| 3475 | proxy()->drawItemPixmap(p, ir, Qt::AlignCenter, pm); | - | ||||||||||||||||||||||||
| 3476 | p->restore(); | - | ||||||||||||||||||||||||
| 3477 | } never executed: end of block | 0 | ||||||||||||||||||||||||
| 3478 | - | |||||||||||||||||||||||||
| 3479 | if (tb->subControls & SC_TitleBarUnshadeButton
| 0 | ||||||||||||||||||||||||
| 3480 | && tb->titleBarFlags & Qt::WindowShadeButtonHint
| 0 | ||||||||||||||||||||||||
| 3481 | && tb->titleBarState & Qt::WindowMinimized) {
| 0 | ||||||||||||||||||||||||
| 3482 | ir = proxy()->subControlRect(CC_TitleBar, tb, SC_TitleBarUnshadeButton, widget); | - | ||||||||||||||||||||||||
| 3483 | - | |||||||||||||||||||||||||
| 3484 | down = tb->activeSubControls & SC_TitleBarUnshadeButton && (opt->state & State_Sunken);
| 0 | ||||||||||||||||||||||||
| 3485 | pm = proxy()->standardIcon(SP_TitleBarUnshadeButton, &tool, widget).pixmap(qt_getWindow(widget), QSize(10, 10)); | - | ||||||||||||||||||||||||
| 3486 | tool.rect = ir; | - | ||||||||||||||||||||||||
| 3487 | tool.state = down ? State_Sunken : State_Raised;
| 0 | ||||||||||||||||||||||||
| 3488 | proxy()->drawPrimitive(PE_PanelButtonTool, &tool, p, widget); | - | ||||||||||||||||||||||||
| 3489 | p->save(); | - | ||||||||||||||||||||||||
| 3490 | if (down)
| 0 | ||||||||||||||||||||||||
| 3491 | p->translate(proxy()->pixelMetric(PM_ButtonShiftHorizontal, tb, widget), never executed: p->translate(proxy()->pixelMetric(PM_ButtonShiftHorizontal, tb, widget), proxy()->pixelMetric(PM_ButtonShiftVertical, tb, widget)); | 0 | ||||||||||||||||||||||||
| 3492 | proxy()->pixelMetric(PM_ButtonShiftVertical, tb, widget)); never executed: p->translate(proxy()->pixelMetric(PM_ButtonShiftHorizontal, tb, widget), proxy()->pixelMetric(PM_ButtonShiftVertical, tb, widget)); | 0 | ||||||||||||||||||||||||
| 3493 | proxy()->drawItemPixmap(p, ir, Qt::AlignCenter, pm); | - | ||||||||||||||||||||||||
| 3494 | p->restore(); | - | ||||||||||||||||||||||||
| 3495 | } never executed: end of block | 0 | ||||||||||||||||||||||||
| 3496 | if (tb->subControls & SC_TitleBarContextHelpButton
| 0 | ||||||||||||||||||||||||
| 3497 | && tb->titleBarFlags & Qt::WindowContextHelpButtonHint) {
| 0 | ||||||||||||||||||||||||
| 3498 | ir = proxy()->subControlRect(CC_TitleBar, tb, SC_TitleBarContextHelpButton, widget); | - | ||||||||||||||||||||||||
| 3499 | - | |||||||||||||||||||||||||
| 3500 | down = tb->activeSubControls & SC_TitleBarContextHelpButton && (opt->state & State_Sunken);
| 0 | ||||||||||||||||||||||||
| 3501 | pm = proxy()->standardIcon(SP_TitleBarContextHelpButton, &tool, widget).pixmap(qt_getWindow(widget), QSize(10, 10)); | - | ||||||||||||||||||||||||
| 3502 | tool.rect = ir; | - | ||||||||||||||||||||||||
| 3503 | tool.state = down ? State_Sunken : State_Raised;
| 0 | ||||||||||||||||||||||||
| 3504 | proxy()->drawPrimitive(PE_PanelButtonTool, &tool, p, widget); | - | ||||||||||||||||||||||||
| 3505 | p->save(); | - | ||||||||||||||||||||||||
| 3506 | if (down)
| 0 | ||||||||||||||||||||||||
| 3507 | p->translate(proxy()->pixelMetric(PM_ButtonShiftHorizontal, tb, widget), never executed: p->translate(proxy()->pixelMetric(PM_ButtonShiftHorizontal, tb, widget), proxy()->pixelMetric(PM_ButtonShiftVertical, tb, widget)); | 0 | ||||||||||||||||||||||||
| 3508 | proxy()->pixelMetric(PM_ButtonShiftVertical, tb, widget)); never executed: p->translate(proxy()->pixelMetric(PM_ButtonShiftHorizontal, tb, widget), proxy()->pixelMetric(PM_ButtonShiftVertical, tb, widget)); | 0 | ||||||||||||||||||||||||
| 3509 | proxy()->drawItemPixmap(p, ir, Qt::AlignCenter, pm); | - | ||||||||||||||||||||||||
| 3510 | p->restore(); | - | ||||||||||||||||||||||||
| 3511 | } never executed: end of block | 0 | ||||||||||||||||||||||||
| 3512 | if (tb->subControls & SC_TitleBarSysMenu && tb->titleBarFlags & Qt::WindowSystemMenuHint) {
| 0 | ||||||||||||||||||||||||
| 3513 | ir = proxy()->subControlRect(CC_TitleBar, tb, SC_TitleBarSysMenu, widget); | - | ||||||||||||||||||||||||
| 3514 | if (!tb->icon.isNull()) {
| 0 | ||||||||||||||||||||||||
| 3515 | tb->icon.paint(p, ir); | - | ||||||||||||||||||||||||
| 3516 | } else { never executed: end of block | 0 | ||||||||||||||||||||||||
| 3517 | int iconSize = proxy()->pixelMetric(PM_SmallIconSize, tb, widget); | - | ||||||||||||||||||||||||
| 3518 | pm = proxy()->standardIcon(SP_TitleBarMenuButton, &tool, widget).pixmap(qt_getWindow(widget), QSize(iconSize, iconSize)); | - | ||||||||||||||||||||||||
| 3519 | tool.rect = ir; | - | ||||||||||||||||||||||||
| 3520 | p->save(); | - | ||||||||||||||||||||||||
| 3521 | proxy()->drawItemPixmap(p, ir, Qt::AlignCenter, pm); | - | ||||||||||||||||||||||||
| 3522 | p->restore(); | - | ||||||||||||||||||||||||
| 3523 | } never executed: end of block | 0 | ||||||||||||||||||||||||
| 3524 | } | - | ||||||||||||||||||||||||
| 3525 | } never executed: end of block | 0 | ||||||||||||||||||||||||
| 3526 | break; never executed: break; | 0 | ||||||||||||||||||||||||
| 3527 | #ifndef QT_NO_DIAL | - | ||||||||||||||||||||||||
| 3528 | case CC_Dial: never executed: case CC_Dial: | 0 | ||||||||||||||||||||||||
| 3529 | if (const QStyleOptionSlider *dial = qstyleoption_cast<const QStyleOptionSlider *>(opt)) {
| 0 | ||||||||||||||||||||||||
| 3530 | // OK, this is more a port of things over | - | ||||||||||||||||||||||||
| 3531 | p->save(); | - | ||||||||||||||||||||||||
| 3532 | - | |||||||||||||||||||||||||
| 3533 | // avoid dithering | - | ||||||||||||||||||||||||
| 3534 | if (p->paintEngine()->hasFeature(QPaintEngine::Antialiasing))
| 0 | ||||||||||||||||||||||||
| 3535 | p->setRenderHint(QPainter::Antialiasing); never executed: p->setRenderHint(QPainter::Antialiasing); | 0 | ||||||||||||||||||||||||
| 3536 | - | |||||||||||||||||||||||||
| 3537 | int width = dial->rect.width(); | - | ||||||||||||||||||||||||
| 3538 | int height = dial->rect.height(); | - | ||||||||||||||||||||||||
| 3539 | qreal r = qMin(width, height) / 2; | - | ||||||||||||||||||||||||
| 3540 | qreal d_ = r / 6; | - | ||||||||||||||||||||||||
| 3541 | qreal dx = dial->rect.x() + d_ + (width - 2 * r) / 2 + 1; | - | ||||||||||||||||||||||||
| 3542 | qreal dy = dial->rect.y() + d_ + (height - 2 * r) / 2 + 1; | - | ||||||||||||||||||||||||
| 3543 | QRect br = QRect(int(dx), int(dy), int(r * 2 - 2 * d_ - 2), int(r * 2 - 2 * d_ - 2)); | - | ||||||||||||||||||||||||
| 3544 | - | |||||||||||||||||||||||||
| 3545 | QPalette pal = opt->palette; | - | ||||||||||||||||||||||||
| 3546 | // draw notches | - | ||||||||||||||||||||||||
| 3547 | if (dial->subControls & QStyle::SC_DialTickmarks) {
| 0 | ||||||||||||||||||||||||
| 3548 | p->setPen(pal.foreground().color()); | - | ||||||||||||||||||||||||
| 3549 | p->drawLines(QStyleHelper::calcLines(dial)); | - | ||||||||||||||||||||||||
| 3550 | } never executed: end of block | 0 | ||||||||||||||||||||||||
| 3551 | - | |||||||||||||||||||||||||
| 3552 | if (dial->state & State_Enabled) {
| 0 | ||||||||||||||||||||||||
| 3553 | p->setBrush(pal.brush(QPalette::ColorRole(proxy()->styleHint(SH_Dial_BackgroundRole, | - | ||||||||||||||||||||||||
| 3554 | dial, widget)))); | - | ||||||||||||||||||||||||
| 3555 | p->setPen(Qt::NoPen); | - | ||||||||||||||||||||||||
| 3556 | p->drawEllipse(br); | - | ||||||||||||||||||||||||
| 3557 | p->setBrush(Qt::NoBrush); | - | ||||||||||||||||||||||||
| 3558 | } never executed: end of block | 0 | ||||||||||||||||||||||||
| 3559 | p->setPen(QPen(pal.dark().color())); | - | ||||||||||||||||||||||||
| 3560 | p->drawArc(br, 60 * 16, 180 * 16); | - | ||||||||||||||||||||||||
| 3561 | p->setPen(QPen(pal.light().color())); | - | ||||||||||||||||||||||||
| 3562 | p->drawArc(br, 240 * 16, 180 * 16); | - | ||||||||||||||||||||||||
| 3563 | - | |||||||||||||||||||||||||
| 3564 | qreal a; | - | ||||||||||||||||||||||||
| 3565 | const StaticPolygonF<3> arrow = calcArrow(dial, a); | - | ||||||||||||||||||||||||
| 3566 | - | |||||||||||||||||||||||||
| 3567 | p->setPen(Qt::NoPen); | - | ||||||||||||||||||||||||
| 3568 | p->setBrush(pal.button()); | - | ||||||||||||||||||||||||
| 3569 | p->setRenderHint(QPainter::Qt4CompatiblePainting); | - | ||||||||||||||||||||||||
| 3570 | p->drawPolygon(arrow.cbegin(), arrow.size()); | - | ||||||||||||||||||||||||
| 3571 | - | |||||||||||||||||||||||||
| 3572 | a = QStyleHelper::angle(QPointF(width / 2, height / 2), arrow[0]); | - | ||||||||||||||||||||||||
| 3573 | p->setBrush(Qt::NoBrush); | - | ||||||||||||||||||||||||
| 3574 | - | |||||||||||||||||||||||||
| 3575 | if (a <= 0 || a > 200) {
| 0 | ||||||||||||||||||||||||
| 3576 | p->setPen(pal.light().color()); | - | ||||||||||||||||||||||||
| 3577 | p->drawLine(arrow[2], arrow[0]); | - | ||||||||||||||||||||||||
| 3578 | p->drawLine(arrow[1], arrow[2]); | - | ||||||||||||||||||||||||
| 3579 | p->setPen(pal.dark().color()); | - | ||||||||||||||||||||||||
| 3580 | p->drawLine(arrow[0], arrow[1]); | - | ||||||||||||||||||||||||
| 3581 | } else if (a > 0 && a < 45) { never executed: end of block
| 0 | ||||||||||||||||||||||||
| 3582 | p->setPen(pal.light().color()); | - | ||||||||||||||||||||||||
| 3583 | p->drawLine(arrow[2], arrow[0]); | - | ||||||||||||||||||||||||
| 3584 | p->setPen(pal.dark().color()); | - | ||||||||||||||||||||||||
| 3585 | p->drawLine(arrow[1], arrow[2]); | - | ||||||||||||||||||||||||
| 3586 | p->drawLine(arrow[0], arrow[1]); | - | ||||||||||||||||||||||||
| 3587 | } else if (a >= 45 && a < 135) { never executed: end of block
| 0 | ||||||||||||||||||||||||
| 3588 | p->setPen(pal.dark().color()); | - | ||||||||||||||||||||||||
| 3589 | p->drawLine(arrow[2], arrow[0]); | - | ||||||||||||||||||||||||
| 3590 | p->drawLine(arrow[1], arrow[2]); | - | ||||||||||||||||||||||||
| 3591 | p->setPen(pal.light().color()); | - | ||||||||||||||||||||||||
| 3592 | p->drawLine(arrow[0], arrow[1]); | - | ||||||||||||||||||||||||
| 3593 | } else if (a >= 135 && a < 200) { never executed: end of block
| 0 | ||||||||||||||||||||||||
| 3594 | p->setPen(pal.dark().color()); | - | ||||||||||||||||||||||||
| 3595 | p->drawLine(arrow[2], arrow[0]); | - | ||||||||||||||||||||||||
| 3596 | p->setPen(pal.light().color()); | - | ||||||||||||||||||||||||
| 3597 | p->drawLine(arrow[0], arrow[1]); | - | ||||||||||||||||||||||||
| 3598 | p->drawLine(arrow[1], arrow[2]); | - | ||||||||||||||||||||||||
| 3599 | } never executed: end of block | 0 | ||||||||||||||||||||||||
| 3600 | - | |||||||||||||||||||||||||
| 3601 | // draw focus rect around the dial | - | ||||||||||||||||||||||||
| 3602 | QStyleOptionFocusRect fropt; | - | ||||||||||||||||||||||||
| 3603 | fropt.rect = dial->rect; | - | ||||||||||||||||||||||||
| 3604 | fropt.state = dial->state; | - | ||||||||||||||||||||||||
| 3605 | fropt.palette = dial->palette; | - | ||||||||||||||||||||||||
| 3606 | if (fropt.state & QStyle::State_HasFocus) {
| 0 | ||||||||||||||||||||||||
| 3607 | br.adjust(0, 0, 2, 2); | - | ||||||||||||||||||||||||
| 3608 | if (dial->subControls & SC_DialTickmarks) {
| 0 | ||||||||||||||||||||||||
| 3609 | int r = qMin(width, height) / 2; | - | ||||||||||||||||||||||||
| 3610 | br.translate(-r / 6, - r / 6); | - | ||||||||||||||||||||||||
| 3611 | br.setWidth(br.width() + r / 3); | - | ||||||||||||||||||||||||
| 3612 | br.setHeight(br.height() + r / 3); | - | ||||||||||||||||||||||||
| 3613 | } never executed: end of block | 0 | ||||||||||||||||||||||||
| 3614 | fropt.rect = br.adjusted(-2, -2, 2, 2); | - | ||||||||||||||||||||||||
| 3615 | proxy()->drawPrimitive(QStyle::PE_FrameFocusRect, &fropt, p, widget); | - | ||||||||||||||||||||||||
| 3616 | } never executed: end of block | 0 | ||||||||||||||||||||||||
| 3617 | p->restore(); | - | ||||||||||||||||||||||||
| 3618 | } never executed: end of block | 0 | ||||||||||||||||||||||||
| 3619 | break; never executed: break; | 0 | ||||||||||||||||||||||||
| 3620 | #endif // QT_NO_DIAL | - | ||||||||||||||||||||||||
| 3621 | #ifndef QT_NO_GROUPBOX | - | ||||||||||||||||||||||||
| 3622 | case CC_GroupBox: never executed: case CC_GroupBox: | 0 | ||||||||||||||||||||||||
| 3623 | if (const QStyleOptionGroupBox *groupBox = qstyleoption_cast<const QStyleOptionGroupBox *>(opt)) {
| 0 | ||||||||||||||||||||||||
| 3624 | // Draw frame | - | ||||||||||||||||||||||||
| 3625 | QRect textRect = proxy()->subControlRect(CC_GroupBox, opt, SC_GroupBoxLabel, widget); | - | ||||||||||||||||||||||||
| 3626 | QRect checkBoxRect = proxy()->subControlRect(CC_GroupBox, opt, SC_GroupBoxCheckBox, widget); | - | ||||||||||||||||||||||||
| 3627 | if (groupBox->subControls & QStyle::SC_GroupBoxFrame) {
| 0 | ||||||||||||||||||||||||
| 3628 | QStyleOptionFrame frame; | - | ||||||||||||||||||||||||
| 3629 | frame.QStyleOption::operator=(*groupBox); | - | ||||||||||||||||||||||||
| 3630 | frame.features = groupBox->features; | - | ||||||||||||||||||||||||
| 3631 | frame.lineWidth = groupBox->lineWidth; | - | ||||||||||||||||||||||||
| 3632 | frame.midLineWidth = groupBox->midLineWidth; | - | ||||||||||||||||||||||||
| 3633 | frame.rect = proxy()->subControlRect(CC_GroupBox, opt, SC_GroupBoxFrame, widget); | - | ||||||||||||||||||||||||
| 3634 | p->save(); | - | ||||||||||||||||||||||||
| 3635 | QRegion region(groupBox->rect); | - | ||||||||||||||||||||||||
| 3636 | if (!groupBox->text.isEmpty()) {
| 0 | ||||||||||||||||||||||||
| 3637 | bool ltr = groupBox->direction == Qt::LeftToRight; | - | ||||||||||||||||||||||||
| 3638 | QRect finalRect; | - | ||||||||||||||||||||||||
| 3639 | if (groupBox->subControls & QStyle::SC_GroupBoxCheckBox) {
| 0 | ||||||||||||||||||||||||
| 3640 | finalRect = checkBoxRect.united(textRect); | - | ||||||||||||||||||||||||
| 3641 | finalRect.adjust(ltr ? -4 : 0, 0, ltr ? 0 : 4, 0); | - | ||||||||||||||||||||||||
| 3642 | } else { never executed: end of block | 0 | ||||||||||||||||||||||||
| 3643 | finalRect = textRect; | - | ||||||||||||||||||||||||
| 3644 | } never executed: end of block | 0 | ||||||||||||||||||||||||
| 3645 | region -= finalRect; | - | ||||||||||||||||||||||||
| 3646 | } never executed: end of block | 0 | ||||||||||||||||||||||||
| 3647 | p->setClipRegion(region); | - | ||||||||||||||||||||||||
| 3648 | proxy()->drawPrimitive(PE_FrameGroupBox, &frame, p, widget); | - | ||||||||||||||||||||||||
| 3649 | p->restore(); | - | ||||||||||||||||||||||||
| 3650 | } never executed: end of block | 0 | ||||||||||||||||||||||||
| 3651 | - | |||||||||||||||||||||||||
| 3652 | // Draw title | - | ||||||||||||||||||||||||
| 3653 | if ((groupBox->subControls & QStyle::SC_GroupBoxLabel) && !groupBox->text.isEmpty()) {
| 0 | ||||||||||||||||||||||||
| 3654 | QColor textColor = groupBox->textColor; | - | ||||||||||||||||||||||||
| 3655 | if (textColor.isValid())
| 0 | ||||||||||||||||||||||||
| 3656 | p->setPen(textColor); never executed: p->setPen(textColor); | 0 | ||||||||||||||||||||||||
| 3657 | int alignment = int(groupBox->textAlignment); | - | ||||||||||||||||||||||||
| 3658 | if (!proxy()->styleHint(QStyle::SH_UnderlineShortcut, opt, widget))
| 0 | ||||||||||||||||||||||||
| 3659 | alignment |= Qt::TextHideMnemonic; never executed: alignment |= Qt::TextHideMnemonic; | 0 | ||||||||||||||||||||||||
| 3660 | - | |||||||||||||||||||||||||
| 3661 | proxy()->drawItemText(p, textRect, Qt::TextShowMnemonic | Qt::AlignHCenter | alignment, | - | ||||||||||||||||||||||||
| 3662 | groupBox->palette, groupBox->state & State_Enabled, groupBox->text, | - | ||||||||||||||||||||||||
| 3663 | textColor.isValid() ? QPalette::NoRole : QPalette::WindowText); | - | ||||||||||||||||||||||||
| 3664 | - | |||||||||||||||||||||||||
| 3665 | if (groupBox->state & State_HasFocus) {
| 0 | ||||||||||||||||||||||||
| 3666 | QStyleOptionFocusRect fropt; | - | ||||||||||||||||||||||||
| 3667 | fropt.QStyleOption::operator=(*groupBox); | - | ||||||||||||||||||||||||
| 3668 | fropt.rect = textRect; | - | ||||||||||||||||||||||||
| 3669 | proxy()->drawPrimitive(PE_FrameFocusRect, &fropt, p, widget); | - | ||||||||||||||||||||||||
| 3670 | } never executed: end of block | 0 | ||||||||||||||||||||||||
| 3671 | } never executed: end of block | 0 | ||||||||||||||||||||||||
| 3672 | - | |||||||||||||||||||||||||
| 3673 | // Draw checkbox | - | ||||||||||||||||||||||||
| 3674 | if (groupBox->subControls & SC_GroupBoxCheckBox) {
| 0 | ||||||||||||||||||||||||
| 3675 | QStyleOptionButton box; | - | ||||||||||||||||||||||||
| 3676 | box.QStyleOption::operator=(*groupBox); | - | ||||||||||||||||||||||||
| 3677 | box.rect = checkBoxRect; | - | ||||||||||||||||||||||||
| 3678 | proxy()->drawPrimitive(PE_IndicatorCheckBox, &box, p, widget); | - | ||||||||||||||||||||||||
| 3679 | } never executed: end of block | 0 | ||||||||||||||||||||||||
| 3680 | } never executed: end of block | 0 | ||||||||||||||||||||||||
| 3681 | break; never executed: break; | 0 | ||||||||||||||||||||||||
| 3682 | #endif // QT_NO_GROUPBOX | - | ||||||||||||||||||||||||
| 3683 | #ifndef QT_NO_MDIAREA | - | ||||||||||||||||||||||||
| 3684 | case CC_MdiControls: never executed: case CC_MdiControls: | 0 | ||||||||||||||||||||||||
| 3685 | { | - | ||||||||||||||||||||||||
| 3686 | QStyleOptionButton btnOpt; | - | ||||||||||||||||||||||||
| 3687 | btnOpt.QStyleOption::operator=(*opt); | - | ||||||||||||||||||||||||
| 3688 | btnOpt.state &= ~State_MouseOver; | - | ||||||||||||||||||||||||
| 3689 | int bsx = 0; | - | ||||||||||||||||||||||||
| 3690 | int bsy = 0; | - | ||||||||||||||||||||||||
| 3691 | if (opt->subControls & QStyle::SC_MdiCloseButton) {
| 0 | ||||||||||||||||||||||||
| 3692 | if (opt->activeSubControls & QStyle::SC_MdiCloseButton && (opt->state & State_Sunken)) {
| 0 | ||||||||||||||||||||||||
| 3693 | btnOpt.state |= State_Sunken; | - | ||||||||||||||||||||||||
| 3694 | btnOpt.state &= ~State_Raised; | - | ||||||||||||||||||||||||
| 3695 | bsx = proxy()->pixelMetric(PM_ButtonShiftHorizontal); | - | ||||||||||||||||||||||||
| 3696 | bsy = proxy()->pixelMetric(PM_ButtonShiftVertical); | - | ||||||||||||||||||||||||
| 3697 | } else { never executed: end of block | 0 | ||||||||||||||||||||||||
| 3698 | btnOpt.state |= State_Raised; | - | ||||||||||||||||||||||||
| 3699 | btnOpt.state &= ~State_Sunken; | - | ||||||||||||||||||||||||
| 3700 | bsx = 0; | - | ||||||||||||||||||||||||
| 3701 | bsy = 0; | - | ||||||||||||||||||||||||
| 3702 | } never executed: end of block | 0 | ||||||||||||||||||||||||
| 3703 | btnOpt.rect = proxy()->subControlRect(CC_MdiControls, opt, SC_MdiCloseButton, widget); | - | ||||||||||||||||||||||||
| 3704 | proxy()->drawPrimitive(PE_PanelButtonCommand, &btnOpt, p, widget); | - | ||||||||||||||||||||||||
| 3705 | QPixmap pm = proxy()->standardIcon(SP_TitleBarCloseButton).pixmap(qt_getWindow(widget), QSize(16, 16)); | - | ||||||||||||||||||||||||
| 3706 | proxy()->drawItemPixmap(p, btnOpt.rect.translated(bsx, bsy), Qt::AlignCenter, pm); | - | ||||||||||||||||||||||||
| 3707 | } never executed: end of block | 0 | ||||||||||||||||||||||||
| 3708 | if (opt->subControls & QStyle::SC_MdiNormalButton) {
| 0 | ||||||||||||||||||||||||
| 3709 | if (opt->activeSubControls & QStyle::SC_MdiNormalButton && (opt->state & State_Sunken)) {
| 0 | ||||||||||||||||||||||||
| 3710 | btnOpt.state |= State_Sunken; | - | ||||||||||||||||||||||||
| 3711 | btnOpt.state &= ~State_Raised; | - | ||||||||||||||||||||||||
| 3712 | bsx = proxy()->pixelMetric(PM_ButtonShiftHorizontal); | - | ||||||||||||||||||||||||
| 3713 | bsy = proxy()->pixelMetric(PM_ButtonShiftVertical); | - | ||||||||||||||||||||||||
| 3714 | } else { never executed: end of block | 0 | ||||||||||||||||||||||||
| 3715 | btnOpt.state |= State_Raised; | - | ||||||||||||||||||||||||
| 3716 | btnOpt.state &= ~State_Sunken; | - | ||||||||||||||||||||||||
| 3717 | bsx = 0; | - | ||||||||||||||||||||||||
| 3718 | bsy = 0; | - | ||||||||||||||||||||||||
| 3719 | } never executed: end of block | 0 | ||||||||||||||||||||||||
| 3720 | btnOpt.rect = proxy()->subControlRect(CC_MdiControls, opt, SC_MdiNormalButton, widget); | - | ||||||||||||||||||||||||
| 3721 | proxy()->drawPrimitive(PE_PanelButtonCommand, &btnOpt, p, widget); | - | ||||||||||||||||||||||||
| 3722 | QPixmap pm = proxy()->standardIcon(SP_TitleBarNormalButton).pixmap(qt_getWindow(widget), QSize(16, 16)); | - | ||||||||||||||||||||||||
| 3723 | proxy()->drawItemPixmap(p, btnOpt.rect.translated(bsx, bsy), Qt::AlignCenter, pm); | - | ||||||||||||||||||||||||
| 3724 | } never executed: end of block | 0 | ||||||||||||||||||||||||
| 3725 | if (opt->subControls & QStyle::SC_MdiMinButton) {
| 0 | ||||||||||||||||||||||||
| 3726 | if (opt->activeSubControls & QStyle::SC_MdiMinButton && (opt->state & State_Sunken)) {
| 0 | ||||||||||||||||||||||||
| 3727 | btnOpt.state |= State_Sunken; | - | ||||||||||||||||||||||||
| 3728 | btnOpt.state &= ~State_Raised; | - | ||||||||||||||||||||||||
| 3729 | bsx = proxy()->pixelMetric(PM_ButtonShiftHorizontal); | - | ||||||||||||||||||||||||
| 3730 | bsy = proxy()->pixelMetric(PM_ButtonShiftVertical); | - | ||||||||||||||||||||||||
| 3731 | } else { never executed: end of block | 0 | ||||||||||||||||||||||||
| 3732 | btnOpt.state |= State_Raised; | - | ||||||||||||||||||||||||
| 3733 | btnOpt.state &= ~State_Sunken; | - | ||||||||||||||||||||||||
| 3734 | bsx = 0; | - | ||||||||||||||||||||||||
| 3735 | bsy = 0; | - | ||||||||||||||||||||||||
| 3736 | } never executed: end of block | 0 | ||||||||||||||||||||||||
| 3737 | btnOpt.rect = proxy()->subControlRect(CC_MdiControls, opt, SC_MdiMinButton, widget); | - | ||||||||||||||||||||||||
| 3738 | proxy()->drawPrimitive(PE_PanelButtonCommand, &btnOpt, p, widget); | - | ||||||||||||||||||||||||
| 3739 | QPixmap pm = proxy()->standardIcon(SP_TitleBarMinButton).pixmap(qt_getWindow(widget), QSize(16, 16)); | - | ||||||||||||||||||||||||
| 3740 | proxy()->drawItemPixmap(p, btnOpt.rect.translated(bsx, bsy), Qt::AlignCenter, pm); | - | ||||||||||||||||||||||||
| 3741 | } never executed: end of block | 0 | ||||||||||||||||||||||||
| 3742 | } | - | ||||||||||||||||||||||||
| 3743 | break; never executed: break; | 0 | ||||||||||||||||||||||||
| 3744 | #endif // QT_NO_MDIAREA | - | ||||||||||||||||||||||||
| 3745 | default: never executed: default: | 0 | ||||||||||||||||||||||||
| 3746 | qWarning("QCommonStyle::drawComplexControl: Control %d not handled", cc); | - | ||||||||||||||||||||||||
| 3747 | } never executed: end of block | 0 | ||||||||||||||||||||||||
| 3748 | } | - | ||||||||||||||||||||||||
| 3749 | - | |||||||||||||||||||||||||
| 3750 | /*! | - | ||||||||||||||||||||||||
| 3751 | \reimp | - | ||||||||||||||||||||||||
| 3752 | */ | - | ||||||||||||||||||||||||
| 3753 | QStyle::SubControl QCommonStyle::hitTestComplexControl(ComplexControl cc, const QStyleOptionComplex *opt, | - | ||||||||||||||||||||||||
| 3754 | const QPoint &pt, const QWidget *widget) const | - | ||||||||||||||||||||||||
| 3755 | { | - | ||||||||||||||||||||||||
| 3756 | SubControl sc = SC_None; | - | ||||||||||||||||||||||||
| 3757 | switch (cc) { | - | ||||||||||||||||||||||||
| 3758 | #ifndef QT_NO_SLIDER | - | ||||||||||||||||||||||||
| 3759 | case CC_Slider: never executed: case CC_Slider: | 0 | ||||||||||||||||||||||||
| 3760 | if (const QStyleOptionSlider *slider = qstyleoption_cast<const QStyleOptionSlider *>(opt)) {
| 0 | ||||||||||||||||||||||||
| 3761 | QRect r = proxy()->subControlRect(cc, slider, SC_SliderHandle, widget); | - | ||||||||||||||||||||||||
| 3762 | if (r.isValid() && r.contains(pt)) {
| 0 | ||||||||||||||||||||||||
| 3763 | sc = SC_SliderHandle; | - | ||||||||||||||||||||||||
| 3764 | } else { never executed: end of block | 0 | ||||||||||||||||||||||||
| 3765 | r = proxy()->subControlRect(cc, slider, SC_SliderGroove ,widget); | - | ||||||||||||||||||||||||
| 3766 | if (r.isValid() && r.contains(pt))
| 0 | ||||||||||||||||||||||||
| 3767 | sc = SC_SliderGroove; never executed: sc = SC_SliderGroove; | 0 | ||||||||||||||||||||||||
| 3768 | } never executed: end of block | 0 | ||||||||||||||||||||||||
| 3769 | } | - | ||||||||||||||||||||||||
| 3770 | break; never executed: break; | 0 | ||||||||||||||||||||||||
| 3771 | #endif // QT_NO_SLIDER | - | ||||||||||||||||||||||||
| 3772 | #ifndef QT_NO_SCROLLBAR | - | ||||||||||||||||||||||||
| 3773 | case CC_ScrollBar: never executed: case CC_ScrollBar: | 0 | ||||||||||||||||||||||||
| 3774 | if (const QStyleOptionSlider *scrollbar = qstyleoption_cast<const QStyleOptionSlider *>(opt)) {
| 0 | ||||||||||||||||||||||||
| 3775 | QRect r; | - | ||||||||||||||||||||||||
| 3776 | uint ctrl = SC_ScrollBarAddLine; | - | ||||||||||||||||||||||||
| 3777 | while (ctrl <= SC_ScrollBarGroove) {
| 0 | ||||||||||||||||||||||||
| 3778 | r = proxy()->subControlRect(cc, scrollbar, QStyle::SubControl(ctrl), widget); | - | ||||||||||||||||||||||||
| 3779 | if (r.isValid() && r.contains(pt)) {
| 0 | ||||||||||||||||||||||||
| 3780 | sc = QStyle::SubControl(ctrl); | - | ||||||||||||||||||||||||
| 3781 | break; never executed: break; | 0 | ||||||||||||||||||||||||
| 3782 | } | - | ||||||||||||||||||||||||
| 3783 | ctrl <<= 1; | - | ||||||||||||||||||||||||
| 3784 | } never executed: end of block | 0 | ||||||||||||||||||||||||
| 3785 | } never executed: end of block | 0 | ||||||||||||||||||||||||
| 3786 | break; never executed: break; | 0 | ||||||||||||||||||||||||
| 3787 | #endif // QT_NO_SCROLLBAR | - | ||||||||||||||||||||||||
| 3788 | #ifndef QT_NO_TOOLBUTTON | - | ||||||||||||||||||||||||
| 3789 | case CC_ToolButton: never executed: case CC_ToolButton: | 0 | ||||||||||||||||||||||||
| 3790 | if (const QStyleOptionToolButton *toolbutton = qstyleoption_cast<const QStyleOptionToolButton *>(opt)) {
| 0 | ||||||||||||||||||||||||
| 3791 | QRect r; | - | ||||||||||||||||||||||||
| 3792 | uint ctrl = SC_ToolButton; | - | ||||||||||||||||||||||||
| 3793 | while (ctrl <= SC_ToolButtonMenu) {
| 0 | ||||||||||||||||||||||||
| 3794 | r = proxy()->subControlRect(cc, toolbutton, QStyle::SubControl(ctrl), widget); | - | ||||||||||||||||||||||||
| 3795 | if (r.isValid() && r.contains(pt)) {
| 0 | ||||||||||||||||||||||||
| 3796 | sc = QStyle::SubControl(ctrl); | - | ||||||||||||||||||||||||
| 3797 | break; never executed: break; | 0 | ||||||||||||||||||||||||
| 3798 | } | - | ||||||||||||||||||||||||
| 3799 | ctrl <<= 1; | - | ||||||||||||||||||||||||
| 3800 | } never executed: end of block | 0 | ||||||||||||||||||||||||
| 3801 | } never executed: end of block | 0 | ||||||||||||||||||||||||
| 3802 | break; never executed: break; | 0 | ||||||||||||||||||||||||
| 3803 | #endif // QT_NO_TOOLBUTTON | - | ||||||||||||||||||||||||
| 3804 | #ifndef QT_NO_SPINBOX | - | ||||||||||||||||||||||||
| 3805 | case CC_SpinBox: never executed: case CC_SpinBox: | 0 | ||||||||||||||||||||||||
| 3806 | if (const QStyleOptionSpinBox *spinbox = qstyleoption_cast<const QStyleOptionSpinBox *>(opt)) {
| 0 | ||||||||||||||||||||||||
| 3807 | QRect r; | - | ||||||||||||||||||||||||
| 3808 | uint ctrl = SC_SpinBoxUp; | - | ||||||||||||||||||||||||
| 3809 | while (ctrl <= SC_SpinBoxEditField) {
| 0 | ||||||||||||||||||||||||
| 3810 | r = proxy()->subControlRect(cc, spinbox, QStyle::SubControl(ctrl), widget); | - | ||||||||||||||||||||||||
| 3811 | if (r.isValid() && r.contains(pt)) {
| 0 | ||||||||||||||||||||||||
| 3812 | sc = QStyle::SubControl(ctrl); | - | ||||||||||||||||||||||||
| 3813 | break; never executed: break; | 0 | ||||||||||||||||||||||||
| 3814 | } | - | ||||||||||||||||||||||||
| 3815 | ctrl <<= 1; | - | ||||||||||||||||||||||||
| 3816 | } never executed: end of block | 0 | ||||||||||||||||||||||||
| 3817 | } never executed: end of block | 0 | ||||||||||||||||||||||||
| 3818 | break; never executed: break; | 0 | ||||||||||||||||||||||||
| 3819 | #endif // QT_NO_SPINBOX | - | ||||||||||||||||||||||||
| 3820 | case CC_TitleBar: never executed: case CC_TitleBar: | 0 | ||||||||||||||||||||||||
| 3821 | if (const QStyleOptionTitleBar *tb = qstyleoption_cast<const QStyleOptionTitleBar *>(opt)) {
| 0 | ||||||||||||||||||||||||
| 3822 | QRect r; | - | ||||||||||||||||||||||||
| 3823 | uint ctrl = SC_TitleBarSysMenu; | - | ||||||||||||||||||||||||
| 3824 | - | |||||||||||||||||||||||||
| 3825 | while (ctrl <= SC_TitleBarLabel) {
| 0 | ||||||||||||||||||||||||
| 3826 | r = proxy()->subControlRect(cc, tb, QStyle::SubControl(ctrl), widget); | - | ||||||||||||||||||||||||
| 3827 | if (r.isValid() && r.contains(pt)) {
| 0 | ||||||||||||||||||||||||
| 3828 | sc = QStyle::SubControl(ctrl); | - | ||||||||||||||||||||||||
| 3829 | break; never executed: break; | 0 | ||||||||||||||||||||||||
| 3830 | } | - | ||||||||||||||||||||||||
| 3831 | ctrl <<= 1; | - | ||||||||||||||||||||||||
| 3832 | } never executed: end of block | 0 | ||||||||||||||||||||||||
| 3833 | } never executed: end of block | 0 | ||||||||||||||||||||||||
| 3834 | break; never executed: break; | 0 | ||||||||||||||||||||||||
| 3835 | #ifndef QT_NO_COMBOBOX | - | ||||||||||||||||||||||||
| 3836 | case CC_ComboBox: never executed: case CC_ComboBox: | 0 | ||||||||||||||||||||||||
| 3837 | if (const QStyleOptionComboBox *cb = qstyleoption_cast<const QStyleOptionComboBox *>(opt)) {
| 0 | ||||||||||||||||||||||||
| 3838 | QRect r; | - | ||||||||||||||||||||||||
| 3839 | uint ctrl = SC_ComboBoxArrow; // Start here and go down. | - | ||||||||||||||||||||||||
| 3840 | while (ctrl > 0) {
| 0 | ||||||||||||||||||||||||
| 3841 | r = proxy()->subControlRect(cc, cb, QStyle::SubControl(ctrl), widget); | - | ||||||||||||||||||||||||
| 3842 | if (r.isValid() && r.contains(pt)) {
| 0 | ||||||||||||||||||||||||
| 3843 | sc = QStyle::SubControl(ctrl); | - | ||||||||||||||||||||||||
| 3844 | break; never executed: break; | 0 | ||||||||||||||||||||||||
| 3845 | } | - | ||||||||||||||||||||||||
| 3846 | ctrl >>= 1; | - | ||||||||||||||||||||||||
| 3847 | } never executed: end of block | 0 | ||||||||||||||||||||||||
| 3848 | } never executed: end of block | 0 | ||||||||||||||||||||||||
| 3849 | break; never executed: break; | 0 | ||||||||||||||||||||||||
| 3850 | #endif // QT_NO_COMBOBOX | - | ||||||||||||||||||||||||
| 3851 | #ifndef QT_NO_GROUPBOX | - | ||||||||||||||||||||||||
| 3852 | case CC_GroupBox: never executed: case CC_GroupBox: | 0 | ||||||||||||||||||||||||
| 3853 | if (const QStyleOptionGroupBox *groupBox = qstyleoption_cast<const QStyleOptionGroupBox *>(opt)) {
| 0 | ||||||||||||||||||||||||
| 3854 | QRect r; | - | ||||||||||||||||||||||||
| 3855 | uint ctrl = SC_GroupBoxCheckBox; | - | ||||||||||||||||||||||||
| 3856 | while (ctrl <= SC_GroupBoxFrame) {
| 0 | ||||||||||||||||||||||||
| 3857 | r = proxy()->subControlRect(cc, groupBox, QStyle::SubControl(ctrl), widget); | - | ||||||||||||||||||||||||
| 3858 | if (r.isValid() && r.contains(pt)) {
| 0 | ||||||||||||||||||||||||
| 3859 | sc = QStyle::SubControl(ctrl); | - | ||||||||||||||||||||||||
| 3860 | break; never executed: break; | 0 | ||||||||||||||||||||||||
| 3861 | } | - | ||||||||||||||||||||||||
| 3862 | ctrl <<= 1; | - | ||||||||||||||||||||||||
| 3863 | } never executed: end of block | 0 | ||||||||||||||||||||||||
| 3864 | } never executed: end of block | 0 | ||||||||||||||||||||||||
| 3865 | break; never executed: break; | 0 | ||||||||||||||||||||||||
| 3866 | #endif // QT_NO_GROUPBOX | - | ||||||||||||||||||||||||
| 3867 | case CC_MdiControls: never executed: case CC_MdiControls: | 0 | ||||||||||||||||||||||||
| 3868 | { | - | ||||||||||||||||||||||||
| 3869 | QRect r; | - | ||||||||||||||||||||||||
| 3870 | uint ctrl = SC_MdiMinButton; | - | ||||||||||||||||||||||||
| 3871 | while (ctrl <= SC_MdiCloseButton) {
| 0 | ||||||||||||||||||||||||
| 3872 | r = proxy()->subControlRect(CC_MdiControls, opt, QStyle::SubControl(ctrl), widget); | - | ||||||||||||||||||||||||
| 3873 | if (r.isValid() && r.contains(pt) && (opt->subControls & ctrl)) {
| 0 | ||||||||||||||||||||||||
| 3874 | sc = QStyle::SubControl(ctrl); | - | ||||||||||||||||||||||||
| 3875 | return sc; never executed: return sc; | 0 | ||||||||||||||||||||||||
| 3876 | } | - | ||||||||||||||||||||||||
| 3877 | ctrl <<= 1; | - | ||||||||||||||||||||||||
| 3878 | } never executed: end of block | 0 | ||||||||||||||||||||||||
| 3879 | } | - | ||||||||||||||||||||||||
| 3880 | break; never executed: break; | 0 | ||||||||||||||||||||||||
| 3881 | default: never executed: default: | 0 | ||||||||||||||||||||||||
| 3882 | qWarning("QCommonStyle::hitTestComplexControl: Case %d not handled", cc); | - | ||||||||||||||||||||||||
| 3883 | } never executed: end of block | 0 | ||||||||||||||||||||||||
| 3884 | return sc; never executed: return sc; | 0 | ||||||||||||||||||||||||
| 3885 | } | - | ||||||||||||||||||||||||
| 3886 | - | |||||||||||||||||||||||||
| 3887 | /*! | - | ||||||||||||||||||||||||
| 3888 | \reimp | - | ||||||||||||||||||||||||
| 3889 | */ | - | ||||||||||||||||||||||||
| 3890 | QRect QCommonStyle::subControlRect(ComplexControl cc, const QStyleOptionComplex *opt, | - | ||||||||||||||||||||||||
| 3891 | SubControl sc, const QWidget *widget) const | - | ||||||||||||||||||||||||
| 3892 | { | - | ||||||||||||||||||||||||
| 3893 | QRect ret; | - | ||||||||||||||||||||||||
| 3894 | switch (cc) { | - | ||||||||||||||||||||||||
| 3895 | #ifndef QT_NO_SLIDER | - | ||||||||||||||||||||||||
| 3896 | case CC_Slider: never executed: case CC_Slider: | 0 | ||||||||||||||||||||||||
| 3897 | if (const QStyleOptionSlider *slider = qstyleoption_cast<const QStyleOptionSlider *>(opt)) {
| 0 | ||||||||||||||||||||||||
| 3898 | int tickOffset = proxy()->pixelMetric(PM_SliderTickmarkOffset, slider, widget); | - | ||||||||||||||||||||||||
| 3899 | int thickness = proxy()->pixelMetric(PM_SliderControlThickness, slider, widget); | - | ||||||||||||||||||||||||
| 3900 | - | |||||||||||||||||||||||||
| 3901 | switch (sc) { | - | ||||||||||||||||||||||||
| 3902 | case SC_SliderHandle: { never executed: case SC_SliderHandle: | 0 | ||||||||||||||||||||||||
| 3903 | int sliderPos = 0; | - | ||||||||||||||||||||||||
| 3904 | int len = proxy()->pixelMetric(PM_SliderLength, slider, widget); | - | ||||||||||||||||||||||||
| 3905 | bool horizontal = slider->orientation == Qt::Horizontal; | - | ||||||||||||||||||||||||
| 3906 | sliderPos = sliderPositionFromValue(slider->minimum, slider->maximum, | - | ||||||||||||||||||||||||
| 3907 | slider->sliderPosition, | - | ||||||||||||||||||||||||
| 3908 | (horizontal ? slider->rect.width() | - | ||||||||||||||||||||||||
| 3909 | : slider->rect.height()) - len, | - | ||||||||||||||||||||||||
| 3910 | slider->upsideDown); | - | ||||||||||||||||||||||||
| 3911 | if (horizontal)
| 0 | ||||||||||||||||||||||||
| 3912 | ret.setRect(slider->rect.x() + sliderPos, slider->rect.y() + tickOffset, len, thickness); never executed: ret.setRect(slider->rect.x() + sliderPos, slider->rect.y() + tickOffset, len, thickness); | 0 | ||||||||||||||||||||||||
| 3913 | else | - | ||||||||||||||||||||||||
| 3914 | ret.setRect(slider->rect.x() + tickOffset, slider->rect.y() + sliderPos, thickness, len); never executed: ret.setRect(slider->rect.x() + tickOffset, slider->rect.y() + sliderPos, thickness, len); | 0 | ||||||||||||||||||||||||
| 3915 | break; } never executed: break; | 0 | ||||||||||||||||||||||||
| 3916 | case SC_SliderGroove: never executed: case SC_SliderGroove: | 0 | ||||||||||||||||||||||||
| 3917 | if (slider->orientation == Qt::Horizontal)
| 0 | ||||||||||||||||||||||||
| 3918 | ret.setRect(slider->rect.x(), slider->rect.y() + tickOffset, never executed: ret.setRect(slider->rect.x(), slider->rect.y() + tickOffset, slider->rect.width(), thickness); | 0 | ||||||||||||||||||||||||
| 3919 | slider->rect.width(), thickness); never executed: ret.setRect(slider->rect.x(), slider->rect.y() + tickOffset, slider->rect.width(), thickness); | 0 | ||||||||||||||||||||||||
| 3920 | else | - | ||||||||||||||||||||||||
| 3921 | ret.setRect(slider->rect.x() + tickOffset, slider->rect.y(), never executed: ret.setRect(slider->rect.x() + tickOffset, slider->rect.y(), thickness, slider->rect.height()); | 0 | ||||||||||||||||||||||||
| 3922 | thickness, slider->rect.height()); never executed: ret.setRect(slider->rect.x() + tickOffset, slider->rect.y(), thickness, slider->rect.height()); | 0 | ||||||||||||||||||||||||
| 3923 | break; never executed: break; | 0 | ||||||||||||||||||||||||
| 3924 | default: never executed: default: | 0 | ||||||||||||||||||||||||
| 3925 | break; never executed: break; | 0 | ||||||||||||||||||||||||
| 3926 | } | - | ||||||||||||||||||||||||
| 3927 | ret = visualRect(slider->direction, slider->rect, ret); | - | ||||||||||||||||||||||||
| 3928 | } never executed: end of block | 0 | ||||||||||||||||||||||||
| 3929 | break; never executed: break; | 0 | ||||||||||||||||||||||||
| 3930 | #endif // QT_NO_SLIDER | - | ||||||||||||||||||||||||
| 3931 | #ifndef QT_NO_SCROLLBAR | - | ||||||||||||||||||||||||
| 3932 | case CC_ScrollBar: never executed: case CC_ScrollBar: | 0 | ||||||||||||||||||||||||
| 3933 | if (const QStyleOptionSlider *scrollbar = qstyleoption_cast<const QStyleOptionSlider *>(opt)) {
| 0 | ||||||||||||||||||||||||
| 3934 | const QRect scrollBarRect = scrollbar->rect; | - | ||||||||||||||||||||||||
| 3935 | int sbextent = 0; | - | ||||||||||||||||||||||||
| 3936 | if (!proxy()->styleHint(SH_ScrollBar_Transient, scrollbar, widget))
| 0 | ||||||||||||||||||||||||
| 3937 | sbextent = proxy()->pixelMetric(PM_ScrollBarExtent, scrollbar, widget); never executed: sbextent = proxy()->pixelMetric(PM_ScrollBarExtent, scrollbar, widget); | 0 | ||||||||||||||||||||||||
| 3938 | int maxlen = ((scrollbar->orientation == Qt::Horizontal) ?
| 0 | ||||||||||||||||||||||||
| 3939 | scrollBarRect.width() : scrollBarRect.height()) - (sbextent * 2); | - | ||||||||||||||||||||||||
| 3940 | int sliderlen; | - | ||||||||||||||||||||||||
| 3941 | - | |||||||||||||||||||||||||
| 3942 | // calculate slider length | - | ||||||||||||||||||||||||
| 3943 | if (scrollbar->maximum != scrollbar->minimum) {
| 0 | ||||||||||||||||||||||||
| 3944 | uint range = scrollbar->maximum - scrollbar->minimum; | - | ||||||||||||||||||||||||
| 3945 | sliderlen = (qint64(scrollbar->pageStep) * maxlen) / (range + scrollbar->pageStep); | - | ||||||||||||||||||||||||
| 3946 | - | |||||||||||||||||||||||||
| 3947 | int slidermin = proxy()->pixelMetric(PM_ScrollBarSliderMin, scrollbar, widget); | - | ||||||||||||||||||||||||
| 3948 | if (sliderlen < slidermin || range > INT_MAX / 2)
| 0 | ||||||||||||||||||||||||
| 3949 | sliderlen = slidermin; never executed: sliderlen = slidermin; | 0 | ||||||||||||||||||||||||
| 3950 | if (sliderlen > maxlen)
| 0 | ||||||||||||||||||||||||
| 3951 | sliderlen = maxlen; never executed: sliderlen = maxlen; | 0 | ||||||||||||||||||||||||
| 3952 | } else { never executed: end of block | 0 | ||||||||||||||||||||||||
| 3953 | sliderlen = maxlen; | - | ||||||||||||||||||||||||
| 3954 | } never executed: end of block | 0 | ||||||||||||||||||||||||
| 3955 | - | |||||||||||||||||||||||||
| 3956 | int sliderstart = sbextent + sliderPositionFromValue(scrollbar->minimum, | - | ||||||||||||||||||||||||
| 3957 | scrollbar->maximum, | - | ||||||||||||||||||||||||
| 3958 | scrollbar->sliderPosition, | - | ||||||||||||||||||||||||
| 3959 | maxlen - sliderlen, | - | ||||||||||||||||||||||||
| 3960 | scrollbar->upsideDown); | - | ||||||||||||||||||||||||
| 3961 | - | |||||||||||||||||||||||||
| 3962 | switch (sc) { | - | ||||||||||||||||||||||||
| 3963 | case SC_ScrollBarSubLine: // top/left button never executed: case SC_ScrollBarSubLine: | 0 | ||||||||||||||||||||||||
| 3964 | if (scrollbar->orientation == Qt::Horizontal) {
| 0 | ||||||||||||||||||||||||
| 3965 | int buttonWidth = qMin(scrollBarRect.width() / 2, sbextent); | - | ||||||||||||||||||||||||
| 3966 | ret.setRect(0, 0, buttonWidth, scrollBarRect.height()); | - | ||||||||||||||||||||||||
| 3967 | } else { never executed: end of block | 0 | ||||||||||||||||||||||||
| 3968 | int buttonHeight = qMin(scrollBarRect.height() / 2, sbextent); | - | ||||||||||||||||||||||||
| 3969 | ret.setRect(0, 0, scrollBarRect.width(), buttonHeight); | - | ||||||||||||||||||||||||
| 3970 | } never executed: end of block | 0 | ||||||||||||||||||||||||
| 3971 | break; never executed: break; | 0 | ||||||||||||||||||||||||
| 3972 | case SC_ScrollBarAddLine: // bottom/right button never executed: case SC_ScrollBarAddLine: | 0 | ||||||||||||||||||||||||
| 3973 | if (scrollbar->orientation == Qt::Horizontal) {
| 0 | ||||||||||||||||||||||||
| 3974 | int buttonWidth = qMin(scrollBarRect.width()/2, sbextent); | - | ||||||||||||||||||||||||
| 3975 | ret.setRect(scrollBarRect.width() - buttonWidth, 0, buttonWidth, scrollBarRect.height()); | - | ||||||||||||||||||||||||
| 3976 | } else { never executed: end of block | 0 | ||||||||||||||||||||||||
| 3977 | int buttonHeight = qMin(scrollBarRect.height()/2, sbextent); | - | ||||||||||||||||||||||||
| 3978 | ret.setRect(0, scrollBarRect.height() - buttonHeight, scrollBarRect.width(), buttonHeight); | - | ||||||||||||||||||||||||
| 3979 | } never executed: end of block | 0 | ||||||||||||||||||||||||
| 3980 | break; never executed: break; | 0 | ||||||||||||||||||||||||
| 3981 | case SC_ScrollBarSubPage: // between top/left button and slider never executed: case SC_ScrollBarSubPage: | 0 | ||||||||||||||||||||||||
| 3982 | if (scrollbar->orientation == Qt::Horizontal)
| 0 | ||||||||||||||||||||||||
| 3983 | ret.setRect(sbextent, 0, sliderstart - sbextent, scrollBarRect.height()); never executed: ret.setRect(sbextent, 0, sliderstart - sbextent, scrollBarRect.height()); | 0 | ||||||||||||||||||||||||
| 3984 | else | - | ||||||||||||||||||||||||
| 3985 | ret.setRect(0, sbextent, scrollBarRect.width(), sliderstart - sbextent); never executed: ret.setRect(0, sbextent, scrollBarRect.width(), sliderstart - sbextent); | 0 | ||||||||||||||||||||||||
| 3986 | break; never executed: break; | 0 | ||||||||||||||||||||||||
| 3987 | case SC_ScrollBarAddPage: // between bottom/right button and slider never executed: case SC_ScrollBarAddPage: | 0 | ||||||||||||||||||||||||
| 3988 | if (scrollbar->orientation == Qt::Horizontal)
| 0 | ||||||||||||||||||||||||
| 3989 | ret.setRect(sliderstart + sliderlen, 0, never executed: ret.setRect(sliderstart + sliderlen, 0, maxlen - sliderstart - sliderlen + sbextent, scrollBarRect.height()); | 0 | ||||||||||||||||||||||||
| 3990 | maxlen - sliderstart - sliderlen + sbextent, scrollBarRect.height()); never executed: ret.setRect(sliderstart + sliderlen, 0, maxlen - sliderstart - sliderlen + sbextent, scrollBarRect.height()); | 0 | ||||||||||||||||||||||||
| 3991 | else | - | ||||||||||||||||||||||||
| 3992 | ret.setRect(0, sliderstart + sliderlen, scrollBarRect.width(), never executed: ret.setRect(0, sliderstart + sliderlen, scrollBarRect.width(), maxlen - sliderstart - sliderlen + sbextent); | 0 | ||||||||||||||||||||||||
| 3993 | maxlen - sliderstart - sliderlen + sbextent); never executed: ret.setRect(0, sliderstart + sliderlen, scrollBarRect.width(), maxlen - sliderstart - sliderlen + sbextent); | 0 | ||||||||||||||||||||||||
| 3994 | break; never executed: break; | 0 | ||||||||||||||||||||||||
| 3995 | case SC_ScrollBarGroove: never executed: case SC_ScrollBarGroove: | 0 | ||||||||||||||||||||||||
| 3996 | if (scrollbar->orientation == Qt::Horizontal)
| 0 | ||||||||||||||||||||||||
| 3997 | ret.setRect(sbextent, 0, scrollBarRect.width() - sbextent * 2, never executed: ret.setRect(sbextent, 0, scrollBarRect.width() - sbextent * 2, scrollBarRect.height()); | 0 | ||||||||||||||||||||||||
| 3998 | scrollBarRect.height()); never executed: ret.setRect(sbextent, 0, scrollBarRect.width() - sbextent * 2, scrollBarRect.height()); | 0 | ||||||||||||||||||||||||
| 3999 | else | - | ||||||||||||||||||||||||
| 4000 | ret.setRect(0, sbextent, scrollBarRect.width(), never executed: ret.setRect(0, sbextent, scrollBarRect.width(), scrollBarRect.height() - sbextent * 2); | 0 | ||||||||||||||||||||||||
| 4001 | scrollBarRect.height() - sbextent * 2); never executed: ret.setRect(0, sbextent, scrollBarRect.width(), scrollBarRect.height() - sbextent * 2); | 0 | ||||||||||||||||||||||||
| 4002 | break; never executed: break; | 0 | ||||||||||||||||||||||||
| 4003 | case SC_ScrollBarSlider: never executed: case SC_ScrollBarSlider: | 0 | ||||||||||||||||||||||||
| 4004 | if (scrollbar->orientation == Qt::Horizontal)
| 0 | ||||||||||||||||||||||||
| 4005 | ret.setRect(sliderstart, 0, sliderlen, scrollBarRect.height()); never executed: ret.setRect(sliderstart, 0, sliderlen, scrollBarRect.height()); | 0 | ||||||||||||||||||||||||
| 4006 | else | - | ||||||||||||||||||||||||
| 4007 | ret.setRect(0, sliderstart, scrollBarRect.width(), sliderlen); never executed: ret.setRect(0, sliderstart, scrollBarRect.width(), sliderlen); | 0 | ||||||||||||||||||||||||
| 4008 | break; never executed: break; | 0 | ||||||||||||||||||||||||
| 4009 | default: never executed: default: | 0 | ||||||||||||||||||||||||
| 4010 | break; never executed: break; | 0 | ||||||||||||||||||||||||
| 4011 | } | - | ||||||||||||||||||||||||
| 4012 | ret = visualRect(scrollbar->direction, scrollBarRect, ret); | - | ||||||||||||||||||||||||
| 4013 | } never executed: end of block | 0 | ||||||||||||||||||||||||
| 4014 | break; never executed: break; | 0 | ||||||||||||||||||||||||
| 4015 | #endif // QT_NO_SCROLLBAR | - | ||||||||||||||||||||||||
| 4016 | #ifndef QT_NO_SPINBOX | - | ||||||||||||||||||||||||
| 4017 | case CC_SpinBox: never executed: case CC_SpinBox: | 0 | ||||||||||||||||||||||||
| 4018 | if (const QStyleOptionSpinBox *spinbox = qstyleoption_cast<const QStyleOptionSpinBox *>(opt)) {
| 0 | ||||||||||||||||||||||||
| 4019 | QSize bs; | - | ||||||||||||||||||||||||
| 4020 | int fw = spinbox->frame ? proxy()->pixelMetric(PM_SpinBoxFrameWidth, spinbox, widget) : 0;
| 0 | ||||||||||||||||||||||||
| 4021 | bs.setHeight(qMax(8, spinbox->rect.height()/2 - fw)); | - | ||||||||||||||||||||||||
| 4022 | // 1.6 -approximate golden mean | - | ||||||||||||||||||||||||
| 4023 | bs.setWidth(qMax(16, qMin(bs.height() * 8 / 5, spinbox->rect.width() / 4))); | - | ||||||||||||||||||||||||
| 4024 | bs = bs.expandedTo(QApplication::globalStrut()); | - | ||||||||||||||||||||||||
| 4025 | int y = fw + spinbox->rect.y(); | - | ||||||||||||||||||||||||
| 4026 | int x, lx, rx; | - | ||||||||||||||||||||||||
| 4027 | x = spinbox->rect.x() + spinbox->rect.width() - fw - bs.width(); | - | ||||||||||||||||||||||||
| 4028 | lx = fw; | - | ||||||||||||||||||||||||
| 4029 | rx = x - fw; | - | ||||||||||||||||||||||||
| 4030 | switch (sc) { | - | ||||||||||||||||||||||||
| 4031 | case SC_SpinBoxUp: never executed: case SC_SpinBoxUp: | 0 | ||||||||||||||||||||||||
| 4032 | if (spinbox->buttonSymbols == QAbstractSpinBox::NoButtons)
| 0 | ||||||||||||||||||||||||
| 4033 | return QRect(); never executed: return QRect(); | 0 | ||||||||||||||||||||||||
| 4034 | ret = QRect(x, y, bs.width(), bs.height()); | - | ||||||||||||||||||||||||
| 4035 | break; never executed: break; | 0 | ||||||||||||||||||||||||
| 4036 | case SC_SpinBoxDown: never executed: case SC_SpinBoxDown: | 0 | ||||||||||||||||||||||||
| 4037 | if (spinbox->buttonSymbols == QAbstractSpinBox::NoButtons)
| 0 | ||||||||||||||||||||||||
| 4038 | return QRect(); never executed: return QRect(); | 0 | ||||||||||||||||||||||||
| 4039 | - | |||||||||||||||||||||||||
| 4040 | ret = QRect(x, y + bs.height(), bs.width(), bs.height()); | - | ||||||||||||||||||||||||
| 4041 | break; never executed: break; | 0 | ||||||||||||||||||||||||
| 4042 | case SC_SpinBoxEditField: never executed: case SC_SpinBoxEditField: | 0 | ||||||||||||||||||||||||
| 4043 | if (spinbox->buttonSymbols == QAbstractSpinBox::NoButtons) {
| 0 | ||||||||||||||||||||||||
| 4044 | ret = QRect(lx, fw, spinbox->rect.width() - 2*fw, spinbox->rect.height() - 2*fw); | - | ||||||||||||||||||||||||
| 4045 | } else { never executed: end of block | 0 | ||||||||||||||||||||||||
| 4046 | ret = QRect(lx, fw, rx, spinbox->rect.height() - 2*fw); | - | ||||||||||||||||||||||||
| 4047 | } never executed: end of block | 0 | ||||||||||||||||||||||||
| 4048 | break; never executed: break; | 0 | ||||||||||||||||||||||||
| 4049 | case SC_SpinBoxFrame: never executed: case SC_SpinBoxFrame: | 0 | ||||||||||||||||||||||||
| 4050 | ret = spinbox->rect; | - | ||||||||||||||||||||||||
| 4051 | default: code before this statement never executed: default:never executed: default: | 0 | ||||||||||||||||||||||||
| 4052 | break; never executed: break; | 0 | ||||||||||||||||||||||||
| 4053 | } | - | ||||||||||||||||||||||||
| 4054 | ret = visualRect(spinbox->direction, spinbox->rect, ret); | - | ||||||||||||||||||||||||
| 4055 | } never executed: end of block | 0 | ||||||||||||||||||||||||
| 4056 | break; never executed: break; | 0 | ||||||||||||||||||||||||
| 4057 | #endif // Qt_NO_SPINBOX | - | ||||||||||||||||||||||||
| 4058 | #ifndef QT_NO_TOOLBUTTON | - | ||||||||||||||||||||||||
| 4059 | case CC_ToolButton: never executed: case CC_ToolButton: | 0 | ||||||||||||||||||||||||
| 4060 | if (const QStyleOptionToolButton *tb = qstyleoption_cast<const QStyleOptionToolButton *>(opt)) {
| 0 | ||||||||||||||||||||||||
| 4061 | int mbi = proxy()->pixelMetric(PM_MenuButtonIndicator, tb, widget); | - | ||||||||||||||||||||||||
| 4062 | ret = tb->rect; | - | ||||||||||||||||||||||||
| 4063 | switch (sc) { | - | ||||||||||||||||||||||||
| 4064 | case SC_ToolButton: never executed: case SC_ToolButton: | 0 | ||||||||||||||||||||||||
| 4065 | if ((tb->features
| 0 | ||||||||||||||||||||||||
| 4066 | & (QStyleOptionToolButton::MenuButtonPopup | QStyleOptionToolButton::PopupDelay))
| 0 | ||||||||||||||||||||||||
| 4067 | == QStyleOptionToolButton::MenuButtonPopup)
| 0 | ||||||||||||||||||||||||
| 4068 | ret.adjust(0, 0, -mbi, 0); never executed: ret.adjust(0, 0, -mbi, 0); | 0 | ||||||||||||||||||||||||
| 4069 | break; never executed: break; | 0 | ||||||||||||||||||||||||
| 4070 | case SC_ToolButtonMenu: never executed: case SC_ToolButtonMenu: | 0 | ||||||||||||||||||||||||
| 4071 | if ((tb->features
| 0 | ||||||||||||||||||||||||
| 4072 | & (QStyleOptionToolButton::MenuButtonPopup | QStyleOptionToolButton::PopupDelay))
| 0 | ||||||||||||||||||||||||
| 4073 | == QStyleOptionToolButton::MenuButtonPopup)
| 0 | ||||||||||||||||||||||||
| 4074 | ret.adjust(ret.width() - mbi, 0, 0, 0); never executed: ret.adjust(ret.width() - mbi, 0, 0, 0); | 0 | ||||||||||||||||||||||||
| 4075 | break; never executed: break; | 0 | ||||||||||||||||||||||||
| 4076 | default: never executed: default: | 0 | ||||||||||||||||||||||||
| 4077 | break; never executed: break; | 0 | ||||||||||||||||||||||||
| 4078 | } | - | ||||||||||||||||||||||||
| 4079 | ret = visualRect(tb->direction, tb->rect, ret); | - | ||||||||||||||||||||||||
| 4080 | } never executed: end of block | 0 | ||||||||||||||||||||||||
| 4081 | break; never executed: break; | 0 | ||||||||||||||||||||||||
| 4082 | #endif // QT_NO_TOOLBUTTON | - | ||||||||||||||||||||||||
| 4083 | #ifndef QT_NO_COMBOBOX | - | ||||||||||||||||||||||||
| 4084 | case CC_ComboBox: never executed: case CC_ComboBox: | 0 | ||||||||||||||||||||||||
| 4085 | if (const QStyleOptionComboBox *cb = qstyleoption_cast<const QStyleOptionComboBox *>(opt)) {
| 0 | ||||||||||||||||||||||||
| 4086 | int x = cb->rect.x(), | - | ||||||||||||||||||||||||
| 4087 | y = cb->rect.y(), | - | ||||||||||||||||||||||||
| 4088 | wi = cb->rect.width(), | - | ||||||||||||||||||||||||
| 4089 | he = cb->rect.height(); | - | ||||||||||||||||||||||||
| 4090 | int xpos = x; | - | ||||||||||||||||||||||||
| 4091 | int margin = cb->frame ? 3 : 0;
| 0 | ||||||||||||||||||||||||
| 4092 | int bmarg = cb->frame ? 2 : 0;
| 0 | ||||||||||||||||||||||||
| 4093 | xpos += wi - bmarg - 16; | - | ||||||||||||||||||||||||
| 4094 | - | |||||||||||||||||||||||||
| 4095 | - | |||||||||||||||||||||||||
| 4096 | switch (sc) { | - | ||||||||||||||||||||||||
| 4097 | case SC_ComboBoxFrame: never executed: case SC_ComboBoxFrame: | 0 | ||||||||||||||||||||||||
| 4098 | ret = cb->rect; | - | ||||||||||||||||||||||||
| 4099 | break; never executed: break; | 0 | ||||||||||||||||||||||||
| 4100 | case SC_ComboBoxArrow: never executed: case SC_ComboBoxArrow: | 0 | ||||||||||||||||||||||||
| 4101 | ret.setRect(xpos, y + bmarg, 16, he - 2*bmarg); | - | ||||||||||||||||||||||||
| 4102 | break; never executed: break; | 0 | ||||||||||||||||||||||||
| 4103 | case SC_ComboBoxEditField: never executed: case SC_ComboBoxEditField: | 0 | ||||||||||||||||||||||||
| 4104 | ret.setRect(x + margin, y + margin, wi - 2 * margin - 16, he - 2 * margin); | - | ||||||||||||||||||||||||
| 4105 | break; never executed: break; | 0 | ||||||||||||||||||||||||
| 4106 | case SC_ComboBoxListBoxPopup: never executed: case SC_ComboBoxListBoxPopup: | 0 | ||||||||||||||||||||||||
| 4107 | ret = cb->rect; | - | ||||||||||||||||||||||||
| 4108 | break; never executed: break; | 0 | ||||||||||||||||||||||||
| 4109 | default: never executed: default: | 0 | ||||||||||||||||||||||||
| 4110 | break; never executed: break; | 0 | ||||||||||||||||||||||||
| 4111 | } | - | ||||||||||||||||||||||||
| 4112 | ret = visualRect(cb->direction, cb->rect, ret); | - | ||||||||||||||||||||||||
| 4113 | } never executed: end of block | 0 | ||||||||||||||||||||||||
| 4114 | break; never executed: break; | 0 | ||||||||||||||||||||||||
| 4115 | #endif // QT_NO_COMBOBOX | - | ||||||||||||||||||||||||
| 4116 | case CC_TitleBar: never executed: case CC_TitleBar: | 0 | ||||||||||||||||||||||||
| 4117 | if (const QStyleOptionTitleBar *tb = qstyleoption_cast<const QStyleOptionTitleBar *>(opt)) {
| 0 | ||||||||||||||||||||||||
| 4118 | const int controlMargin = 2; | - | ||||||||||||||||||||||||
| 4119 | const int controlHeight = tb->rect.height() - controlMargin *2; | - | ||||||||||||||||||||||||
| 4120 | const int delta = controlHeight + controlMargin; | - | ||||||||||||||||||||||||
| 4121 | int offset = 0; | - | ||||||||||||||||||||||||
| 4122 | - | |||||||||||||||||||||||||
| 4123 | bool isMinimized = tb->titleBarState & Qt::WindowMinimized; | - | ||||||||||||||||||||||||
| 4124 | bool isMaximized = tb->titleBarState & Qt::WindowMaximized; | - | ||||||||||||||||||||||||
| 4125 | - | |||||||||||||||||||||||||
| 4126 | switch (sc) { | - | ||||||||||||||||||||||||
| 4127 | case SC_TitleBarLabel: never executed: case SC_TitleBarLabel: | 0 | ||||||||||||||||||||||||
| 4128 | if (tb->titleBarFlags & (Qt::WindowTitleHint | Qt::WindowSystemMenuHint)) {
| 0 | ||||||||||||||||||||||||
| 4129 | ret = tb->rect; | - | ||||||||||||||||||||||||
| 4130 | if (tb->titleBarFlags & Qt::WindowSystemMenuHint)
| 0 | ||||||||||||||||||||||||
| 4131 | ret.adjust(delta, 0, -delta, 0); never executed: ret.adjust(delta, 0, -delta, 0); | 0 | ||||||||||||||||||||||||
| 4132 | if (tb->titleBarFlags & Qt::WindowMinimizeButtonHint)
| 0 | ||||||||||||||||||||||||
| 4133 | ret.adjust(0, 0, -delta, 0); never executed: ret.adjust(0, 0, -delta, 0); | 0 | ||||||||||||||||||||||||
| 4134 | if (tb->titleBarFlags & Qt::WindowMaximizeButtonHint)
| 0 | ||||||||||||||||||||||||
| 4135 | ret.adjust(0, 0, -delta, 0); never executed: ret.adjust(0, 0, -delta, 0); | 0 | ||||||||||||||||||||||||
| 4136 | if (tb->titleBarFlags & Qt::WindowShadeButtonHint)
| 0 | ||||||||||||||||||||||||
| 4137 | ret.adjust(0, 0, -delta, 0); never executed: ret.adjust(0, 0, -delta, 0); | 0 | ||||||||||||||||||||||||
| 4138 | if (tb->titleBarFlags & Qt::WindowContextHelpButtonHint)
| 0 | ||||||||||||||||||||||||
| 4139 | ret.adjust(0, 0, -delta, 0); never executed: ret.adjust(0, 0, -delta, 0); | 0 | ||||||||||||||||||||||||
| 4140 | } never executed: end of block | 0 | ||||||||||||||||||||||||
| 4141 | break; never executed: break; | 0 | ||||||||||||||||||||||||
| 4142 | case SC_TitleBarContextHelpButton: never executed: case SC_TitleBarContextHelpButton: | 0 | ||||||||||||||||||||||||
| 4143 | if (tb->titleBarFlags & Qt::WindowContextHelpButtonHint)
| 0 | ||||||||||||||||||||||||
| 4144 | offset += delta; never executed: offset += delta; | 0 | ||||||||||||||||||||||||
| 4145 | case SC_TitleBarMinButton: code before this statement never executed: case SC_TitleBarMinButton:never executed: case SC_TitleBarMinButton: | 0 | ||||||||||||||||||||||||
| 4146 | if (!isMinimized && (tb->titleBarFlags & Qt::WindowMinimizeButtonHint))
| 0 | ||||||||||||||||||||||||
| 4147 | offset += delta; never executed: offset += delta; | 0 | ||||||||||||||||||||||||
| 4148 | else if (sc == SC_TitleBarMinButton)
| 0 | ||||||||||||||||||||||||
| 4149 | break; never executed: break; | 0 | ||||||||||||||||||||||||
| 4150 | case SC_TitleBarNormalButton: code before this statement never executed: case SC_TitleBarNormalButton:never executed: case SC_TitleBarNormalButton: | 0 | ||||||||||||||||||||||||
| 4151 | if (isMinimized && (tb->titleBarFlags & Qt::WindowMinimizeButtonHint))
| 0 | ||||||||||||||||||||||||
| 4152 | offset += delta; never executed: offset += delta; | 0 | ||||||||||||||||||||||||
| 4153 | else if (isMaximized && (tb->titleBarFlags & Qt::WindowMaximizeButtonHint))
| 0 | ||||||||||||||||||||||||
| 4154 | offset += delta; never executed: offset += delta; | 0 | ||||||||||||||||||||||||
| 4155 | else if (sc == SC_TitleBarNormalButton)
| 0 | ||||||||||||||||||||||||
| 4156 | break; never executed: break; | 0 | ||||||||||||||||||||||||
| 4157 | case SC_TitleBarMaxButton: code before this statement never executed: case SC_TitleBarMaxButton:never executed: case SC_TitleBarMaxButton: | 0 | ||||||||||||||||||||||||
| 4158 | if (!isMaximized && (tb->titleBarFlags & Qt::WindowMaximizeButtonHint))
| 0 | ||||||||||||||||||||||||
| 4159 | offset += delta; never executed: offset += delta; | 0 | ||||||||||||||||||||||||
| 4160 | else if (sc == SC_TitleBarMaxButton)
| 0 | ||||||||||||||||||||||||
| 4161 | break; never executed: break; | 0 | ||||||||||||||||||||||||
| 4162 | case SC_TitleBarShadeButton: code before this statement never executed: case SC_TitleBarShadeButton:never executed: case SC_TitleBarShadeButton: | 0 | ||||||||||||||||||||||||
| 4163 | if (!isMinimized && (tb->titleBarFlags & Qt::WindowShadeButtonHint))
| 0 | ||||||||||||||||||||||||
| 4164 | offset += delta; never executed: offset += delta; | 0 | ||||||||||||||||||||||||
| 4165 | else if (sc == SC_TitleBarShadeButton)
| 0 | ||||||||||||||||||||||||
| 4166 | break; never executed: break; | 0 | ||||||||||||||||||||||||
| 4167 | case SC_TitleBarUnshadeButton: code before this statement never executed: case SC_TitleBarUnshadeButton:never executed: case SC_TitleBarUnshadeButton: | 0 | ||||||||||||||||||||||||
| 4168 | if (isMinimized && (tb->titleBarFlags & Qt::WindowShadeButtonHint))
| 0 | ||||||||||||||||||||||||
| 4169 | offset += delta; never executed: offset += delta; | 0 | ||||||||||||||||||||||||
| 4170 | else if (sc == SC_TitleBarUnshadeButton)
| 0 | ||||||||||||||||||||||||
| 4171 | break; never executed: break; | 0 | ||||||||||||||||||||||||
| 4172 | case SC_TitleBarCloseButton: code before this statement never executed: case SC_TitleBarCloseButton:never executed: case SC_TitleBarCloseButton: | 0 | ||||||||||||||||||||||||
| 4173 | if (tb->titleBarFlags & Qt::WindowSystemMenuHint)
| 0 | ||||||||||||||||||||||||
| 4174 | offset += delta; never executed: offset += delta; | 0 | ||||||||||||||||||||||||
| 4175 | else if (sc == SC_TitleBarCloseButton)
| 0 | ||||||||||||||||||||||||
| 4176 | break; never executed: break; | 0 | ||||||||||||||||||||||||
| 4177 | ret.setRect(tb->rect.right() - offset, tb->rect.top() + controlMargin, | - | ||||||||||||||||||||||||
| 4178 | controlHeight, controlHeight); | - | ||||||||||||||||||||||||
| 4179 | break; never executed: break; | 0 | ||||||||||||||||||||||||
| 4180 | case SC_TitleBarSysMenu: never executed: case SC_TitleBarSysMenu: | 0 | ||||||||||||||||||||||||
| 4181 | if (tb->titleBarFlags & Qt::WindowSystemMenuHint) {
| 0 | ||||||||||||||||||||||||
| 4182 | ret.setRect(tb->rect.left() + controlMargin, tb->rect.top() + controlMargin, | - | ||||||||||||||||||||||||
| 4183 | controlHeight, controlHeight); | - | ||||||||||||||||||||||||
| 4184 | } never executed: end of block | 0 | ||||||||||||||||||||||||
| 4185 | break; never executed: break; | 0 | ||||||||||||||||||||||||
| 4186 | default: never executed: default: | 0 | ||||||||||||||||||||||||
| 4187 | break; never executed: break; | 0 | ||||||||||||||||||||||||
| 4188 | } | - | ||||||||||||||||||||||||
| 4189 | ret = visualRect(tb->direction, tb->rect, ret); | - | ||||||||||||||||||||||||
| 4190 | } never executed: end of block | 0 | ||||||||||||||||||||||||
| 4191 | break; never executed: break; | 0 | ||||||||||||||||||||||||
| 4192 | #ifndef QT_NO_GROUPBOX | - | ||||||||||||||||||||||||
| 4193 | case CC_GroupBox: { never executed: case CC_GroupBox: | 0 | ||||||||||||||||||||||||
| 4194 | if (const QStyleOptionGroupBox *groupBox = qstyleoption_cast<const QStyleOptionGroupBox *>(opt)) {
| 0 | ||||||||||||||||||||||||
| 4195 | switch (sc) { | - | ||||||||||||||||||||||||
| 4196 | case SC_GroupBoxFrame: never executed: case SC_GroupBoxFrame: | 0 | ||||||||||||||||||||||||
| 4197 | // FALL THROUGH | - | ||||||||||||||||||||||||
| 4198 | case SC_GroupBoxContents: { never executed: case SC_GroupBoxContents: | 0 | ||||||||||||||||||||||||
| 4199 | int topMargin = 0; | - | ||||||||||||||||||||||||
| 4200 | int topHeight = 0; | - | ||||||||||||||||||||||||
| 4201 | int verticalAlignment = proxy()->styleHint(SH_GroupBox_TextLabelVerticalAlignment, groupBox, widget); | - | ||||||||||||||||||||||||
| 4202 | if (groupBox->text.size() || (groupBox->subControls & QStyle::SC_GroupBoxCheckBox)) {
| 0 | ||||||||||||||||||||||||
| 4203 | topHeight = groupBox->fontMetrics.height(); | - | ||||||||||||||||||||||||
| 4204 | if (verticalAlignment & Qt::AlignVCenter)
| 0 | ||||||||||||||||||||||||
| 4205 | topMargin = topHeight / 2; never executed: topMargin = topHeight / 2; | 0 | ||||||||||||||||||||||||
| 4206 | else if (verticalAlignment & Qt::AlignTop)
| 0 | ||||||||||||||||||||||||
| 4207 | topMargin = topHeight; never executed: topMargin = topHeight; | 0 | ||||||||||||||||||||||||
| 4208 | } never executed: end of block | 0 | ||||||||||||||||||||||||
| 4209 | - | |||||||||||||||||||||||||
| 4210 | QRect frameRect = groupBox->rect; | - | ||||||||||||||||||||||||
| 4211 | frameRect.setTop(topMargin); | - | ||||||||||||||||||||||||
| 4212 | - | |||||||||||||||||||||||||
| 4213 | if (sc == SC_GroupBoxFrame) {
| 0 | ||||||||||||||||||||||||
| 4214 | ret = frameRect; | - | ||||||||||||||||||||||||
| 4215 | break; never executed: break; | 0 | ||||||||||||||||||||||||
| 4216 | } | - | ||||||||||||||||||||||||
| 4217 | - | |||||||||||||||||||||||||
| 4218 | int frameWidth = 0; | - | ||||||||||||||||||||||||
| 4219 | if ((groupBox->features & QStyleOptionFrame::Flat) == 0)
| 0 | ||||||||||||||||||||||||
| 4220 | frameWidth = proxy()->pixelMetric(PM_DefaultFrameWidth, groupBox, widget); never executed: frameWidth = proxy()->pixelMetric(PM_DefaultFrameWidth, groupBox, widget); | 0 | ||||||||||||||||||||||||
| 4221 | ret = frameRect.adjusted(frameWidth, frameWidth + topHeight - topMargin, | - | ||||||||||||||||||||||||
| 4222 | -frameWidth, -frameWidth); | - | ||||||||||||||||||||||||
| 4223 | break; never executed: break; | 0 | ||||||||||||||||||||||||
| 4224 | } | - | ||||||||||||||||||||||||
| 4225 | case SC_GroupBoxCheckBox: never executed: case SC_GroupBoxCheckBox: | 0 | ||||||||||||||||||||||||
| 4226 | // FALL THROUGH | - | ||||||||||||||||||||||||
| 4227 | case SC_GroupBoxLabel: { never executed: case SC_GroupBoxLabel: | 0 | ||||||||||||||||||||||||
| 4228 | QFontMetrics fontMetrics = groupBox->fontMetrics; | - | ||||||||||||||||||||||||
| 4229 | int h = fontMetrics.height(); | - | ||||||||||||||||||||||||
| 4230 | int tw = fontMetrics.size(Qt::TextShowMnemonic, groupBox->text + QLatin1Char(' ')).width(); | - | ||||||||||||||||||||||||
| 4231 | int marg = (groupBox->features & QStyleOptionFrame::Flat) ? 0 : 8;
| 0 | ||||||||||||||||||||||||
| 4232 | ret = groupBox->rect.adjusted(marg, 0, -marg, 0); | - | ||||||||||||||||||||||||
| 4233 | ret.setHeight(h); | - | ||||||||||||||||||||||||
| 4234 | - | |||||||||||||||||||||||||
| 4235 | int indicatorWidth = proxy()->pixelMetric(PM_IndicatorWidth, opt, widget); | - | ||||||||||||||||||||||||
| 4236 | int indicatorSpace = proxy()->pixelMetric(PM_CheckBoxLabelSpacing, opt, widget) - 1; | - | ||||||||||||||||||||||||
| 4237 | bool hasCheckBox = groupBox->subControls & QStyle::SC_GroupBoxCheckBox; | - | ||||||||||||||||||||||||
| 4238 | int checkBoxSize = hasCheckBox ? (indicatorWidth + indicatorSpace) : 0;
| 0 | ||||||||||||||||||||||||
| 4239 | - | |||||||||||||||||||||||||
| 4240 | // Adjusted rect for label + indicatorWidth + indicatorSpace | - | ||||||||||||||||||||||||
| 4241 | QRect totalRect = alignedRect(groupBox->direction, groupBox->textAlignment, | - | ||||||||||||||||||||||||
| 4242 | QSize(tw + checkBoxSize, h), ret); | - | ||||||||||||||||||||||||
| 4243 | - | |||||||||||||||||||||||||
| 4244 | // Adjust totalRect if checkbox is set | - | ||||||||||||||||||||||||
| 4245 | if (hasCheckBox) {
| 0 | ||||||||||||||||||||||||
| 4246 | bool ltr = groupBox->direction == Qt::LeftToRight; | - | ||||||||||||||||||||||||
| 4247 | int left = 0; | - | ||||||||||||||||||||||||
| 4248 | // Adjust for check box | - | ||||||||||||||||||||||||
| 4249 | if (sc == SC_GroupBoxCheckBox) {
| 0 | ||||||||||||||||||||||||
| 4250 | int indicatorHeight = proxy()->pixelMetric(PM_IndicatorHeight, opt, widget); | - | ||||||||||||||||||||||||
| 4251 | left = ltr ? totalRect.left() : (totalRect.right() - indicatorWidth);
| 0 | ||||||||||||||||||||||||
| 4252 | int top = totalRect.top() + qMax(0, fontMetrics.height() - indicatorHeight) / 2; | - | ||||||||||||||||||||||||
| 4253 | totalRect.setRect(left, top, indicatorWidth, indicatorHeight); | - | ||||||||||||||||||||||||
| 4254 | // Adjust for label | - | ||||||||||||||||||||||||
| 4255 | } else { never executed: end of block | 0 | ||||||||||||||||||||||||
| 4256 | left = ltr ? (totalRect.left() + checkBoxSize - 2) : totalRect.left();
| 0 | ||||||||||||||||||||||||
| 4257 | totalRect.setRect(left, totalRect.top(), | - | ||||||||||||||||||||||||
| 4258 | totalRect.width() - checkBoxSize, totalRect.height()); | - | ||||||||||||||||||||||||
| 4259 | } never executed: end of block | 0 | ||||||||||||||||||||||||
| 4260 | } | - | ||||||||||||||||||||||||
| 4261 | ret = totalRect; | - | ||||||||||||||||||||||||
| 4262 | break; never executed: break; | 0 | ||||||||||||||||||||||||
| 4263 | } | - | ||||||||||||||||||||||||
| 4264 | default: never executed: default: | 0 | ||||||||||||||||||||||||
| 4265 | break; never executed: break; | 0 | ||||||||||||||||||||||||
| 4266 | } | - | ||||||||||||||||||||||||
| 4267 | } | - | ||||||||||||||||||||||||
| 4268 | break; never executed: break; | 0 | ||||||||||||||||||||||||
| 4269 | } | - | ||||||||||||||||||||||||
| 4270 | #endif // QT_NO_GROUPBOX | - | ||||||||||||||||||||||||
| 4271 | #ifndef QT_NO_MDIAREA | - | ||||||||||||||||||||||||
| 4272 | case CC_MdiControls: never executed: case CC_MdiControls: | 0 | ||||||||||||||||||||||||
| 4273 | { | - | ||||||||||||||||||||||||
| 4274 | int numSubControls = 0; | - | ||||||||||||||||||||||||
| 4275 | if (opt->subControls & SC_MdiCloseButton)
| 0 | ||||||||||||||||||||||||
| 4276 | ++numSubControls; never executed: ++numSubControls; | 0 | ||||||||||||||||||||||||
| 4277 | if (opt->subControls & SC_MdiMinButton)
| 0 | ||||||||||||||||||||||||
| 4278 | ++numSubControls; never executed: ++numSubControls; | 0 | ||||||||||||||||||||||||
| 4279 | if (opt->subControls & SC_MdiNormalButton)
| 0 | ||||||||||||||||||||||||
| 4280 | ++numSubControls; never executed: ++numSubControls; | 0 | ||||||||||||||||||||||||
| 4281 | if (numSubControls == 0)
| 0 | ||||||||||||||||||||||||
| 4282 | break; never executed: break; | 0 | ||||||||||||||||||||||||
| 4283 | - | |||||||||||||||||||||||||
| 4284 | int buttonWidth = opt->rect.width() / numSubControls - 1; | - | ||||||||||||||||||||||||
| 4285 | int offset = 0; | - | ||||||||||||||||||||||||
| 4286 | switch (sc) { | - | ||||||||||||||||||||||||
| 4287 | case SC_MdiCloseButton: never executed: case SC_MdiCloseButton: | 0 | ||||||||||||||||||||||||
| 4288 | // Only one sub control, no offset needed. | - | ||||||||||||||||||||||||
| 4289 | if (numSubControls == 1)
| 0 | ||||||||||||||||||||||||
| 4290 | break; never executed: break; | 0 | ||||||||||||||||||||||||
| 4291 | offset += buttonWidth + 2; | - | ||||||||||||||||||||||||
| 4292 | //FALL THROUGH | - | ||||||||||||||||||||||||
| 4293 | case SC_MdiNormalButton: code before this statement never executed: case SC_MdiNormalButton:never executed: case SC_MdiNormalButton: | 0 | ||||||||||||||||||||||||
| 4294 | // No offset needed if | - | ||||||||||||||||||||||||
| 4295 | // 1) There's only one sub control | - | ||||||||||||||||||||||||
| 4296 | // 2) We have a close button and a normal button (offset already added in SC_MdiClose) | - | ||||||||||||||||||||||||
| 4297 | if (numSubControls == 1 || (numSubControls == 2 && !(opt->subControls & SC_MdiMinButton)))
| 0 | ||||||||||||||||||||||||
| 4298 | break; never executed: break; | 0 | ||||||||||||||||||||||||
| 4299 | if (opt->subControls & SC_MdiNormalButton)
| 0 | ||||||||||||||||||||||||
| 4300 | offset += buttonWidth; never executed: offset += buttonWidth; | 0 | ||||||||||||||||||||||||
| 4301 | break; never executed: break; | 0 | ||||||||||||||||||||||||
| 4302 | default: never executed: default: | 0 | ||||||||||||||||||||||||
| 4303 | break; never executed: break; | 0 | ||||||||||||||||||||||||
| 4304 | } | - | ||||||||||||||||||||||||
| 4305 | - | |||||||||||||||||||||||||
| 4306 | // Subtract one pixel if we only have one sub control. At this point | - | ||||||||||||||||||||||||
| 4307 | // buttonWidth is the actual width + 1 pixel margin, but we don't want the | - | ||||||||||||||||||||||||
| 4308 | // margin when there are no other controllers. | - | ||||||||||||||||||||||||
| 4309 | if (numSubControls == 1)
| 0 | ||||||||||||||||||||||||
| 4310 | --buttonWidth; never executed: --buttonWidth; | 0 | ||||||||||||||||||||||||
| 4311 | ret = QRect(offset, 0, buttonWidth, opt->rect.height()); | - | ||||||||||||||||||||||||
| 4312 | break; never executed: break; | 0 | ||||||||||||||||||||||||
| 4313 | } | - | ||||||||||||||||||||||||
| 4314 | #endif // QT_NO_MDIAREA | - | ||||||||||||||||||||||||
| 4315 | default: never executed: default: | 0 | ||||||||||||||||||||||||
| 4316 | qWarning("QCommonStyle::subControlRect: Case %d not handled", cc); | - | ||||||||||||||||||||||||
| 4317 | } never executed: end of block | 0 | ||||||||||||||||||||||||
| 4318 | return ret; never executed: return ret; | 0 | ||||||||||||||||||||||||
| 4319 | } | - | ||||||||||||||||||||||||
| 4320 | - | |||||||||||||||||||||||||
| 4321 | /*! \reimp */ | - | ||||||||||||||||||||||||
| 4322 | int QCommonStyle::pixelMetric(PixelMetric m, const QStyleOption *opt, const QWidget *widget) const | - | ||||||||||||||||||||||||
| 4323 | { | - | ||||||||||||||||||||||||
| 4324 | int ret; | - | ||||||||||||||||||||||||
| 4325 | - | |||||||||||||||||||||||||
| 4326 | switch (m) { | - | ||||||||||||||||||||||||
| 4327 | case PM_FocusFrameVMargin: never executed: case PM_FocusFrameVMargin: | 0 | ||||||||||||||||||||||||
| 4328 | case PM_FocusFrameHMargin: never executed: case PM_FocusFrameHMargin: | 0 | ||||||||||||||||||||||||
| 4329 | ret = 2; | - | ||||||||||||||||||||||||
| 4330 | break; never executed: break; | 0 | ||||||||||||||||||||||||
| 4331 | case PM_MenuBarVMargin: never executed: case PM_MenuBarVMargin: | 0 | ||||||||||||||||||||||||
| 4332 | case PM_MenuBarHMargin: never executed: case PM_MenuBarHMargin: | 0 | ||||||||||||||||||||||||
| 4333 | ret = 0; | - | ||||||||||||||||||||||||
| 4334 | break; never executed: break; | 0 | ||||||||||||||||||||||||
| 4335 | case PM_DialogButtonsSeparator: never executed: case PM_DialogButtonsSeparator: | 0 | ||||||||||||||||||||||||
| 4336 | ret = int(QStyleHelper::dpiScaled(5.)); | - | ||||||||||||||||||||||||
| 4337 | break; never executed: break; | 0 | ||||||||||||||||||||||||
| 4338 | case PM_DialogButtonsButtonWidth: never executed: case PM_DialogButtonsButtonWidth: | 0 | ||||||||||||||||||||||||
| 4339 | ret = int(QStyleHelper::dpiScaled(70.)); | - | ||||||||||||||||||||||||
| 4340 | break; never executed: break; | 0 | ||||||||||||||||||||||||
| 4341 | case PM_DialogButtonsButtonHeight: never executed: case PM_DialogButtonsButtonHeight: | 0 | ||||||||||||||||||||||||
| 4342 | ret = int(QStyleHelper::dpiScaled(30.)); | - | ||||||||||||||||||||||||
| 4343 | break; never executed: break; | 0 | ||||||||||||||||||||||||
| 4344 | case PM_TitleBarHeight: { never executed: case PM_TitleBarHeight: | 0 | ||||||||||||||||||||||||
| 4345 | if (const QStyleOptionTitleBar *tb = qstyleoption_cast<const QStyleOptionTitleBar *>(opt)) {
| 0 | ||||||||||||||||||||||||
| 4346 | if ((tb->titleBarFlags & Qt::WindowType_Mask) == Qt::Tool) {
| 0 | ||||||||||||||||||||||||
| 4347 | ret = qMax(widget ? widget->fontMetrics().height() : opt->fontMetrics.height(), 16); | - | ||||||||||||||||||||||||
| 4348 | #ifndef QT_NO_DOCKWIDGET | - | ||||||||||||||||||||||||
| 4349 | } else if (qobject_cast<const QDockWidget*>(widget)) { never executed: end of block
| 0 | ||||||||||||||||||||||||
| 4350 | ret = qMax(widget->fontMetrics().height(), int(QStyleHelper::dpiScaled(13))); | - | ||||||||||||||||||||||||
| 4351 | #endif | - | ||||||||||||||||||||||||
| 4352 | } else { never executed: end of block | 0 | ||||||||||||||||||||||||
| 4353 | ret = qMax(widget ? widget->fontMetrics().height() : opt->fontMetrics.height(), 18); | - | ||||||||||||||||||||||||
| 4354 | } never executed: end of block | 0 | ||||||||||||||||||||||||
| 4355 | } else { | - | ||||||||||||||||||||||||
| 4356 | ret = int(QStyleHelper::dpiScaled(18.)); | - | ||||||||||||||||||||||||
| 4357 | } never executed: end of block | 0 | ||||||||||||||||||||||||
| 4358 | - | |||||||||||||||||||||||||
| 4359 | break; } never executed: break; | 0 | ||||||||||||||||||||||||
| 4360 | case PM_ScrollBarSliderMin: never executed: case PM_ScrollBarSliderMin: | 0 | ||||||||||||||||||||||||
| 4361 | ret = int(QStyleHelper::dpiScaled(9.)); | - | ||||||||||||||||||||||||
| 4362 | break; never executed: break; | 0 | ||||||||||||||||||||||||
| 4363 | - | |||||||||||||||||||||||||
| 4364 | case PM_ButtonMargin: never executed: case PM_ButtonMargin: | 0 | ||||||||||||||||||||||||
| 4365 | ret = int(QStyleHelper::dpiScaled(6.)); | - | ||||||||||||||||||||||||
| 4366 | break; never executed: break; | 0 | ||||||||||||||||||||||||
| 4367 | - | |||||||||||||||||||||||||
| 4368 | case PM_DockWidgetTitleBarButtonMargin: never executed: case PM_DockWidgetTitleBarButtonMargin: | 0 | ||||||||||||||||||||||||
| 4369 | ret = int(QStyleHelper::dpiScaled(2.)); | - | ||||||||||||||||||||||||
| 4370 | break; never executed: break; | 0 | ||||||||||||||||||||||||
| 4371 | - | |||||||||||||||||||||||||
| 4372 | case PM_ButtonDefaultIndicator: never executed: case PM_ButtonDefaultIndicator: | 0 | ||||||||||||||||||||||||
| 4373 | ret = 0; | - | ||||||||||||||||||||||||
| 4374 | break; never executed: break; | 0 | ||||||||||||||||||||||||
| 4375 | - | |||||||||||||||||||||||||
| 4376 | case PM_MenuButtonIndicator: never executed: case PM_MenuButtonIndicator: | 0 | ||||||||||||||||||||||||
| 4377 | ret = int(QStyleHelper::dpiScaled(12.)); | - | ||||||||||||||||||||||||
| 4378 | break; never executed: break; | 0 | ||||||||||||||||||||||||
| 4379 | - | |||||||||||||||||||||||||
| 4380 | case PM_ButtonShiftHorizontal: never executed: case PM_ButtonShiftHorizontal: | 0 | ||||||||||||||||||||||||
| 4381 | case PM_ButtonShiftVertical: never executed: case PM_ButtonShiftVertical: | 0 | ||||||||||||||||||||||||
| 4382 | - | |||||||||||||||||||||||||
| 4383 | case PM_DefaultFrameWidth: never executed: case PM_DefaultFrameWidth: | 0 | ||||||||||||||||||||||||
| 4384 | ret = 2; | - | ||||||||||||||||||||||||
| 4385 | break; never executed: break; | 0 | ||||||||||||||||||||||||
| 4386 | - | |||||||||||||||||||||||||
| 4387 | case PM_ComboBoxFrameWidth: never executed: case PM_ComboBoxFrameWidth: | 0 | ||||||||||||||||||||||||
| 4388 | case PM_SpinBoxFrameWidth: never executed: case PM_SpinBoxFrameWidth: | 0 | ||||||||||||||||||||||||
| 4389 | case PM_MenuPanelWidth: never executed: case PM_MenuPanelWidth: | 0 | ||||||||||||||||||||||||
| 4390 | case PM_TabBarBaseOverlap: never executed: case PM_TabBarBaseOverlap: | 0 | ||||||||||||||||||||||||
| 4391 | case PM_TabBarBaseHeight: never executed: case PM_TabBarBaseHeight: | 0 | ||||||||||||||||||||||||
| 4392 | ret = proxy()->pixelMetric(PM_DefaultFrameWidth, opt, widget); | - | ||||||||||||||||||||||||
| 4393 | break; never executed: break; | 0 | ||||||||||||||||||||||||
| 4394 | - | |||||||||||||||||||||||||
| 4395 | case PM_MdiSubWindowFrameWidth: never executed: case PM_MdiSubWindowFrameWidth: | 0 | ||||||||||||||||||||||||
| 4396 | ret = int(QStyleHelper::dpiScaled(4.)); | - | ||||||||||||||||||||||||
| 4397 | break; never executed: break; | 0 | ||||||||||||||||||||||||
| 4398 | - | |||||||||||||||||||||||||
| 4399 | case PM_MdiSubWindowMinimizedWidth: never executed: case PM_MdiSubWindowMinimizedWidth: | 0 | ||||||||||||||||||||||||
| 4400 | ret = int(QStyleHelper::dpiScaled(196.)); | - | ||||||||||||||||||||||||
| 4401 | break; never executed: break; | 0 | ||||||||||||||||||||||||
| 4402 | - | |||||||||||||||||||||||||
| 4403 | #ifndef QT_NO_SCROLLBAR | - | ||||||||||||||||||||||||
| 4404 | case PM_ScrollBarExtent: never executed: case PM_ScrollBarExtent: | 0 | ||||||||||||||||||||||||
| 4405 | if (const QStyleOptionSlider *sb = qstyleoption_cast<const QStyleOptionSlider *>(opt)) {
| 0 | ||||||||||||||||||||||||
| 4406 | int s = sb->orientation == Qt::Horizontal ?
| 0 | ||||||||||||||||||||||||
| 4407 | QApplication::globalStrut().height() | - | ||||||||||||||||||||||||
| 4408 | : QApplication::globalStrut().width(); | - | ||||||||||||||||||||||||
| 4409 | ret = qMax(16, s); | - | ||||||||||||||||||||||||
| 4410 | } else { never executed: end of block | 0 | ||||||||||||||||||||||||
| 4411 | ret = int(QStyleHelper::dpiScaled(16.)); | - | ||||||||||||||||||||||||
| 4412 | } never executed: end of block | 0 | ||||||||||||||||||||||||
| 4413 | break; never executed: break; | 0 | ||||||||||||||||||||||||
| 4414 | #endif | - | ||||||||||||||||||||||||
| 4415 | case PM_MaximumDragDistance: never executed: case PM_MaximumDragDistance: | 0 | ||||||||||||||||||||||||
| 4416 | ret = QGuiApplicationPrivate::platformTheme()->themeHint(QPlatformTheme::MaximumScrollBarDragDistance).toInt(); | - | ||||||||||||||||||||||||
| 4417 | break; never executed: break; | 0 | ||||||||||||||||||||||||
| 4418 | - | |||||||||||||||||||||||||
| 4419 | #ifndef QT_NO_SLIDER | - | ||||||||||||||||||||||||
| 4420 | case PM_SliderThickness: never executed: case PM_SliderThickness: | 0 | ||||||||||||||||||||||||
| 4421 | ret = int(QStyleHelper::dpiScaled(16.)); | - | ||||||||||||||||||||||||
| 4422 | break; never executed: break; | 0 | ||||||||||||||||||||||||
| 4423 | - | |||||||||||||||||||||||||
| 4424 | case PM_SliderTickmarkOffset: never executed: case PM_SliderTickmarkOffset: | 0 | ||||||||||||||||||||||||
| 4425 | if (const QStyleOptionSlider *sl = qstyleoption_cast<const QStyleOptionSlider *>(opt)) {
| 0 | ||||||||||||||||||||||||
| 4426 | int space = (sl->orientation == Qt::Horizontal) ? sl->rect.height()
| 0 | ||||||||||||||||||||||||
| 4427 | : sl->rect.width(); | - | ||||||||||||||||||||||||
| 4428 | int thickness = proxy()->pixelMetric(PM_SliderControlThickness, sl, widget); | - | ||||||||||||||||||||||||
| 4429 | int ticks = sl->tickPosition; | - | ||||||||||||||||||||||||
| 4430 | - | |||||||||||||||||||||||||
| 4431 | if (ticks == QSlider::TicksBothSides)
| 0 | ||||||||||||||||||||||||
| 4432 | ret = (space - thickness) / 2; never executed: ret = (space - thickness) / 2; | 0 | ||||||||||||||||||||||||
| 4433 | else if (ticks == QSlider::TicksAbove)
| 0 | ||||||||||||||||||||||||
| 4434 | ret = space - thickness; never executed: ret = space - thickness; | 0 | ||||||||||||||||||||||||
| 4435 | else | - | ||||||||||||||||||||||||
| 4436 | ret = 0; never executed: ret = 0; | 0 | ||||||||||||||||||||||||
| 4437 | } else { | - | ||||||||||||||||||||||||
| 4438 | ret = 0; | - | ||||||||||||||||||||||||
| 4439 | } never executed: end of block | 0 | ||||||||||||||||||||||||
| 4440 | break; never executed: break; | 0 | ||||||||||||||||||||||||
| 4441 | - | |||||||||||||||||||||||||
| 4442 | case PM_SliderSpaceAvailable: never executed: case PM_SliderSpaceAvailable: | 0 | ||||||||||||||||||||||||
| 4443 | if (const QStyleOptionSlider *sl = qstyleoption_cast<const QStyleOptionSlider *>(opt)) {
| 0 | ||||||||||||||||||||||||
| 4444 | if (sl->orientation == Qt::Horizontal)
| 0 | ||||||||||||||||||||||||
| 4445 | ret = sl->rect.width() - proxy()->pixelMetric(PM_SliderLength, sl, widget); never executed: ret = sl->rect.width() - proxy()->pixelMetric(PM_SliderLength, sl, widget); | 0 | ||||||||||||||||||||||||
| 4446 | else | - | ||||||||||||||||||||||||
| 4447 | ret = sl->rect.height() - proxy()->pixelMetric(PM_SliderLength, sl, widget); never executed: ret = sl->rect.height() - proxy()->pixelMetric(PM_SliderLength, sl, widget); | 0 | ||||||||||||||||||||||||
| 4448 | } else { | - | ||||||||||||||||||||||||
| 4449 | ret = 0; | - | ||||||||||||||||||||||||
| 4450 | } never executed: end of block | 0 | ||||||||||||||||||||||||
| 4451 | break; never executed: break; | 0 | ||||||||||||||||||||||||
| 4452 | #endif // QT_NO_SLIDER | - | ||||||||||||||||||||||||
| 4453 | #ifndef QT_NO_DOCKWIDGET | - | ||||||||||||||||||||||||
| 4454 | case PM_DockWidgetSeparatorExtent: never executed: case PM_DockWidgetSeparatorExtent: | 0 | ||||||||||||||||||||||||
| 4455 | ret = int(QStyleHelper::dpiScaled(6.)); | - | ||||||||||||||||||||||||
| 4456 | break; never executed: break; | 0 | ||||||||||||||||||||||||
| 4457 | - | |||||||||||||||||||||||||
| 4458 | case PM_DockWidgetHandleExtent: never executed: case PM_DockWidgetHandleExtent: | 0 | ||||||||||||||||||||||||
| 4459 | ret = int(QStyleHelper::dpiScaled(8.)); | - | ||||||||||||||||||||||||
| 4460 | break; never executed: break; | 0 | ||||||||||||||||||||||||
| 4461 | case PM_DockWidgetTitleMargin: never executed: case PM_DockWidgetTitleMargin: | 0 | ||||||||||||||||||||||||
| 4462 | ret = 0; | - | ||||||||||||||||||||||||
| 4463 | break; never executed: break; | 0 | ||||||||||||||||||||||||
| 4464 | case PM_DockWidgetFrameWidth: never executed: case PM_DockWidgetFrameWidth: | 0 | ||||||||||||||||||||||||
| 4465 | ret = 1; | - | ||||||||||||||||||||||||
| 4466 | break; never executed: break; | 0 | ||||||||||||||||||||||||
| 4467 | #endif // QT_NO_DOCKWIDGET | - | ||||||||||||||||||||||||
| 4468 | - | |||||||||||||||||||||||||
| 4469 | case PM_SpinBoxSliderHeight: never executed: case PM_SpinBoxSliderHeight: | 0 | ||||||||||||||||||||||||
| 4470 | case PM_MenuBarPanelWidth: never executed: case PM_MenuBarPanelWidth: | 0 | ||||||||||||||||||||||||
| 4471 | ret = 2; | - | ||||||||||||||||||||||||
| 4472 | break; never executed: break; | 0 | ||||||||||||||||||||||||
| 4473 | - | |||||||||||||||||||||||||
| 4474 | case PM_MenuBarItemSpacing: never executed: case PM_MenuBarItemSpacing: | 0 | ||||||||||||||||||||||||
| 4475 | ret = 0; | - | ||||||||||||||||||||||||
| 4476 | break; never executed: break; | 0 | ||||||||||||||||||||||||
| 4477 | - | |||||||||||||||||||||||||
| 4478 | #ifndef QT_NO_TOOLBAR | - | ||||||||||||||||||||||||
| 4479 | case PM_ToolBarFrameWidth: never executed: case PM_ToolBarFrameWidth: | 0 | ||||||||||||||||||||||||
| 4480 | ret = 1; | - | ||||||||||||||||||||||||
| 4481 | break; never executed: break; | 0 | ||||||||||||||||||||||||
| 4482 | - | |||||||||||||||||||||||||
| 4483 | case PM_ToolBarItemMargin: never executed: case PM_ToolBarItemMargin: | 0 | ||||||||||||||||||||||||
| 4484 | ret = 0; | - | ||||||||||||||||||||||||
| 4485 | break; never executed: break; | 0 | ||||||||||||||||||||||||
| 4486 | - | |||||||||||||||||||||||||
| 4487 | case PM_ToolBarItemSpacing: never executed: case PM_ToolBarItemSpacing: | 0 | ||||||||||||||||||||||||
| 4488 | ret = int(QStyleHelper::dpiScaled(4.)); | - | ||||||||||||||||||||||||
| 4489 | break; never executed: break; | 0 | ||||||||||||||||||||||||
| 4490 | - | |||||||||||||||||||||||||
| 4491 | case PM_ToolBarHandleExtent: never executed: case PM_ToolBarHandleExtent: | 0 | ||||||||||||||||||||||||
| 4492 | ret = int(QStyleHelper::dpiScaled(8.)); | - | ||||||||||||||||||||||||
| 4493 | break; never executed: break; | 0 | ||||||||||||||||||||||||
| 4494 | - | |||||||||||||||||||||||||
| 4495 | case PM_ToolBarSeparatorExtent: never executed: case PM_ToolBarSeparatorExtent: | 0 | ||||||||||||||||||||||||
| 4496 | ret = int(QStyleHelper::dpiScaled(6.)); | - | ||||||||||||||||||||||||
| 4497 | break; never executed: break; | 0 | ||||||||||||||||||||||||
| 4498 | - | |||||||||||||||||||||||||
| 4499 | case PM_ToolBarExtensionExtent: never executed: case PM_ToolBarExtensionExtent: | 0 | ||||||||||||||||||||||||
| 4500 | ret = int(QStyleHelper::dpiScaled(12.)); | - | ||||||||||||||||||||||||
| 4501 | break; never executed: break; | 0 | ||||||||||||||||||||||||
| 4502 | #endif // QT_NO_TOOLBAR | - | ||||||||||||||||||||||||
| 4503 | - | |||||||||||||||||||||||||
| 4504 | #ifndef QT_NO_TABBAR | - | ||||||||||||||||||||||||
| 4505 | case PM_TabBarTabOverlap: never executed: case PM_TabBarTabOverlap: | 0 | ||||||||||||||||||||||||
| 4506 | ret = 3; | - | ||||||||||||||||||||||||
| 4507 | break; never executed: break; | 0 | ||||||||||||||||||||||||
| 4508 | - | |||||||||||||||||||||||||
| 4509 | case PM_TabBarTabHSpace: never executed: case PM_TabBarTabHSpace: | 0 | ||||||||||||||||||||||||
| 4510 | ret = int(QStyleHelper::dpiScaled(24.)); | - | ||||||||||||||||||||||||
| 4511 | break; never executed: break; | 0 | ||||||||||||||||||||||||
| 4512 | - | |||||||||||||||||||||||||
| 4513 | case PM_TabBarTabShiftHorizontal: never executed: case PM_TabBarTabShiftHorizontal: | 0 | ||||||||||||||||||||||||
| 4514 | ret = 0; | - | ||||||||||||||||||||||||
| 4515 | break; never executed: break; | 0 | ||||||||||||||||||||||||
| 4516 | - | |||||||||||||||||||||||||
| 4517 | case PM_TabBarTabShiftVertical: never executed: case PM_TabBarTabShiftVertical: | 0 | ||||||||||||||||||||||||
| 4518 | ret = 2; | - | ||||||||||||||||||||||||
| 4519 | break; never executed: break; | 0 | ||||||||||||||||||||||||
| 4520 | - | |||||||||||||||||||||||||
| 4521 | case PM_TabBarTabVSpace: { never executed: case PM_TabBarTabVSpace: | 0 | ||||||||||||||||||||||||
| 4522 | const QStyleOptionTab *tb = qstyleoption_cast<const QStyleOptionTab *>(opt); | - | ||||||||||||||||||||||||
| 4523 | if (tb && (tb->shape == QTabBar::RoundedNorth || tb->shape == QTabBar::RoundedSouth
| 0 | ||||||||||||||||||||||||
| 4524 | || tb->shape == QTabBar::RoundedWest || tb->shape == QTabBar::RoundedEast))
| 0 | ||||||||||||||||||||||||
| 4525 | ret = 8; never executed: ret = 8; | 0 | ||||||||||||||||||||||||
| 4526 | else | - | ||||||||||||||||||||||||
| 4527 | if(tb && (tb->shape == QTabBar::TriangularWest || tb->shape == QTabBar::TriangularEast))
| 0 | ||||||||||||||||||||||||
| 4528 | ret = 3; never executed: ret = 3; | 0 | ||||||||||||||||||||||||
| 4529 | else | - | ||||||||||||||||||||||||
| 4530 | ret = 2; never executed: ret = 2; | 0 | ||||||||||||||||||||||||
| 4531 | break; } never executed: break; | 0 | ||||||||||||||||||||||||
| 4532 | #endif | - | ||||||||||||||||||||||||
| 4533 | - | |||||||||||||||||||||||||
| 4534 | case PM_ProgressBarChunkWidth: never executed: case PM_ProgressBarChunkWidth: | 0 | ||||||||||||||||||||||||
| 4535 | ret = 9; | - | ||||||||||||||||||||||||
| 4536 | break; never executed: break; | 0 | ||||||||||||||||||||||||
| 4537 | - | |||||||||||||||||||||||||
| 4538 | case PM_IndicatorWidth: never executed: case PM_IndicatorWidth: | 0 | ||||||||||||||||||||||||
| 4539 | ret = int(QStyleHelper::dpiScaled(13.)); | - | ||||||||||||||||||||||||
| 4540 | break; never executed: break; | 0 | ||||||||||||||||||||||||
| 4541 | - | |||||||||||||||||||||||||
| 4542 | case PM_IndicatorHeight: never executed: case PM_IndicatorHeight: | 0 | ||||||||||||||||||||||||
| 4543 | ret = int(QStyleHelper::dpiScaled(13.)); | - | ||||||||||||||||||||||||
| 4544 | break; never executed: break; | 0 | ||||||||||||||||||||||||
| 4545 | - | |||||||||||||||||||||||||
| 4546 | case PM_ExclusiveIndicatorWidth: never executed: case PM_ExclusiveIndicatorWidth: | 0 | ||||||||||||||||||||||||
| 4547 | ret = int(QStyleHelper::dpiScaled(12.)); | - | ||||||||||||||||||||||||
| 4548 | break; never executed: break; | 0 | ||||||||||||||||||||||||
| 4549 | - | |||||||||||||||||||||||||
| 4550 | case PM_ExclusiveIndicatorHeight: never executed: case PM_ExclusiveIndicatorHeight: | 0 | ||||||||||||||||||||||||
| 4551 | ret = int(QStyleHelper::dpiScaled(12.)); | - | ||||||||||||||||||||||||
| 4552 | break; never executed: break; | 0 | ||||||||||||||||||||||||
| 4553 | - | |||||||||||||||||||||||||
| 4554 | case PM_MenuTearoffHeight: never executed: case PM_MenuTearoffHeight: | 0 | ||||||||||||||||||||||||
| 4555 | ret = int(QStyleHelper::dpiScaled(10.)); | - | ||||||||||||||||||||||||
| 4556 | break; never executed: break; | 0 | ||||||||||||||||||||||||
| 4557 | - | |||||||||||||||||||||||||
| 4558 | case PM_MenuScrollerHeight: never executed: case PM_MenuScrollerHeight: | 0 | ||||||||||||||||||||||||
| 4559 | ret = int(QStyleHelper::dpiScaled(10.)); | - | ||||||||||||||||||||||||
| 4560 | break; never executed: break; | 0 | ||||||||||||||||||||||||
| 4561 | - | |||||||||||||||||||||||||
| 4562 | case PM_MenuDesktopFrameWidth: never executed: case PM_MenuDesktopFrameWidth: | 0 | ||||||||||||||||||||||||
| 4563 | case PM_MenuHMargin: never executed: case PM_MenuHMargin: | 0 | ||||||||||||||||||||||||
| 4564 | case PM_MenuVMargin: never executed: case PM_MenuVMargin: | 0 | ||||||||||||||||||||||||
| 4565 | ret = 0; | - | ||||||||||||||||||||||||
| 4566 | break; never executed: break; | 0 | ||||||||||||||||||||||||
| 4567 | - | |||||||||||||||||||||||||
| 4568 | case PM_HeaderMargin: never executed: case PM_HeaderMargin: | 0 | ||||||||||||||||||||||||
| 4569 | ret = int(QStyleHelper::dpiScaled(4.)); | - | ||||||||||||||||||||||||
| 4570 | break; never executed: break; | 0 | ||||||||||||||||||||||||
| 4571 | case PM_HeaderMarkSize: never executed: case PM_HeaderMarkSize: | 0 | ||||||||||||||||||||||||
| 4572 | ret = int(QStyleHelper::dpiScaled(16.)); | - | ||||||||||||||||||||||||
| 4573 | break; never executed: break; | 0 | ||||||||||||||||||||||||
| 4574 | case PM_HeaderGripMargin: never executed: case PM_HeaderGripMargin: | 0 | ||||||||||||||||||||||||
| 4575 | ret = int(QStyleHelper::dpiScaled(4.)); | - | ||||||||||||||||||||||||
| 4576 | break; never executed: break; | 0 | ||||||||||||||||||||||||
| 4577 | case PM_HeaderDefaultSectionSizeHorizontal: never executed: case PM_HeaderDefaultSectionSizeHorizontal: | 0 | ||||||||||||||||||||||||
| 4578 | ret = int(QStyleHelper::dpiScaled(100.)); | - | ||||||||||||||||||||||||
| 4579 | break; never executed: break; | 0 | ||||||||||||||||||||||||
| 4580 | case PM_HeaderDefaultSectionSizeVertical: never executed: case PM_HeaderDefaultSectionSizeVertical: | 0 | ||||||||||||||||||||||||
| 4581 | ret = int(QStyleHelper::dpiScaled(30.)); | - | ||||||||||||||||||||||||
| 4582 | break; never executed: break; | 0 | ||||||||||||||||||||||||
| 4583 | case PM_TabBarScrollButtonWidth: never executed: case PM_TabBarScrollButtonWidth: | 0 | ||||||||||||||||||||||||
| 4584 | ret = int(QStyleHelper::dpiScaled(16.)); | - | ||||||||||||||||||||||||
| 4585 | break; never executed: break; | 0 | ||||||||||||||||||||||||
| 4586 | case PM_LayoutLeftMargin: never executed: case PM_LayoutLeftMargin: | 0 | ||||||||||||||||||||||||
| 4587 | case PM_LayoutTopMargin: never executed: case PM_LayoutTopMargin: | 0 | ||||||||||||||||||||||||
| 4588 | case PM_LayoutRightMargin: never executed: case PM_LayoutRightMargin: | 0 | ||||||||||||||||||||||||
| 4589 | case PM_LayoutBottomMargin: never executed: case PM_LayoutBottomMargin: | 0 | ||||||||||||||||||||||||
| 4590 | { | - | ||||||||||||||||||||||||
| 4591 | bool isWindow = false; | - | ||||||||||||||||||||||||
| 4592 | if (opt) {
| 0 | ||||||||||||||||||||||||
| 4593 | isWindow = (opt->state & State_Window); | - | ||||||||||||||||||||||||
| 4594 | } else if (widget) { never executed: end of block
| 0 | ||||||||||||||||||||||||
| 4595 | isWindow = widget->isWindow(); | - | ||||||||||||||||||||||||
| 4596 | } never executed: end of block | 0 | ||||||||||||||||||||||||
| 4597 | ret = proxy()->pixelMetric(isWindow ? PM_DefaultTopLevelMargin : PM_DefaultChildMargin); | - | ||||||||||||||||||||||||
| 4598 | } | - | ||||||||||||||||||||||||
| 4599 | break; never executed: break; | 0 | ||||||||||||||||||||||||
| 4600 | case PM_LayoutHorizontalSpacing: never executed: case PM_LayoutHorizontalSpacing: | 0 | ||||||||||||||||||||||||
| 4601 | case PM_LayoutVerticalSpacing: never executed: case PM_LayoutVerticalSpacing: | 0 | ||||||||||||||||||||||||
| 4602 | ret = proxy()->pixelMetric(PM_DefaultLayoutSpacing); | - | ||||||||||||||||||||||||
| 4603 | break; never executed: break; | 0 | ||||||||||||||||||||||||
| 4604 | - | |||||||||||||||||||||||||
| 4605 | case PM_DefaultTopLevelMargin: never executed: case PM_DefaultTopLevelMargin: | 0 | ||||||||||||||||||||||||
| 4606 | ret = int(QStyleHelper::dpiScaled(11.)); | - | ||||||||||||||||||||||||
| 4607 | break; never executed: break; | 0 | ||||||||||||||||||||||||
| 4608 | case PM_DefaultChildMargin: never executed: case PM_DefaultChildMargin: | 0 | ||||||||||||||||||||||||
| 4609 | ret = int(QStyleHelper::dpiScaled(9.)); | - | ||||||||||||||||||||||||
| 4610 | break; never executed: break; | 0 | ||||||||||||||||||||||||
| 4611 | case PM_DefaultLayoutSpacing: never executed: case PM_DefaultLayoutSpacing: | 0 | ||||||||||||||||||||||||
| 4612 | ret = int(QStyleHelper::dpiScaled(6.)); | - | ||||||||||||||||||||||||
| 4613 | break; never executed: break; | 0 | ||||||||||||||||||||||||
| 4614 | - | |||||||||||||||||||||||||
| 4615 | case PM_ToolBarIconSize: never executed: case PM_ToolBarIconSize: | 0 | ||||||||||||||||||||||||
| 4616 | ret = 0; | - | ||||||||||||||||||||||||
| 4617 | if (const QPlatformTheme *theme = QGuiApplicationPrivate::platformTheme())
| 0 | ||||||||||||||||||||||||
| 4618 | ret = theme->themeHint(QPlatformTheme::ToolBarIconSize).toInt(); never executed: ret = theme->themeHint(QPlatformTheme::ToolBarIconSize).toInt(); | 0 | ||||||||||||||||||||||||
| 4619 | if (ret <= 0)
| 0 | ||||||||||||||||||||||||
| 4620 | ret = int(QStyleHelper::dpiScaled(24.)); never executed: ret = int(QStyleHelper::dpiScaled(24.)); | 0 | ||||||||||||||||||||||||
| 4621 | break; never executed: break; | 0 | ||||||||||||||||||||||||
| 4622 | - | |||||||||||||||||||||||||
| 4623 | case PM_TabBarIconSize: never executed: case PM_TabBarIconSize: | 0 | ||||||||||||||||||||||||
| 4624 | case PM_ListViewIconSize: never executed: case PM_ListViewIconSize: | 0 | ||||||||||||||||||||||||
| 4625 | ret = proxy()->pixelMetric(PM_SmallIconSize, opt, widget); | - | ||||||||||||||||||||||||
| 4626 | break; never executed: break; | 0 | ||||||||||||||||||||||||
| 4627 | - | |||||||||||||||||||||||||
| 4628 | case PM_ButtonIconSize: never executed: case PM_ButtonIconSize: | 0 | ||||||||||||||||||||||||
| 4629 | case PM_SmallIconSize: never executed: case PM_SmallIconSize: | 0 | ||||||||||||||||||||||||
| 4630 | ret = int(QStyleHelper::dpiScaled(16.)); | - | ||||||||||||||||||||||||
| 4631 | break; never executed: break; | 0 | ||||||||||||||||||||||||
| 4632 | case PM_IconViewIconSize: never executed: case PM_IconViewIconSize: | 0 | ||||||||||||||||||||||||
| 4633 | ret = proxy()->pixelMetric(PM_LargeIconSize, opt, widget); | - | ||||||||||||||||||||||||
| 4634 | break; never executed: break; | 0 | ||||||||||||||||||||||||
| 4635 | - | |||||||||||||||||||||||||
| 4636 | case PM_LargeIconSize: never executed: case PM_LargeIconSize: | 0 | ||||||||||||||||||||||||
| 4637 | ret = int(QStyleHelper::dpiScaled(32.)); | - | ||||||||||||||||||||||||
| 4638 | break; never executed: break; | 0 | ||||||||||||||||||||||||
| 4639 | - | |||||||||||||||||||||||||
| 4640 | case PM_ToolTipLabelFrameWidth: never executed: case PM_ToolTipLabelFrameWidth: | 0 | ||||||||||||||||||||||||
| 4641 | ret = 1; | - | ||||||||||||||||||||||||
| 4642 | break; never executed: break; | 0 | ||||||||||||||||||||||||
| 4643 | case PM_CheckBoxLabelSpacing: never executed: case PM_CheckBoxLabelSpacing: | 0 | ||||||||||||||||||||||||
| 4644 | case PM_RadioButtonLabelSpacing: never executed: case PM_RadioButtonLabelSpacing: | 0 | ||||||||||||||||||||||||
| 4645 | ret = int(QStyleHelper::dpiScaled(6.)); | - | ||||||||||||||||||||||||
| 4646 | break; never executed: break; | 0 | ||||||||||||||||||||||||
| 4647 | case PM_SizeGripSize: never executed: case PM_SizeGripSize: | 0 | ||||||||||||||||||||||||
| 4648 | ret = int(QStyleHelper::dpiScaled(13.)); | - | ||||||||||||||||||||||||
| 4649 | break; never executed: break; | 0 | ||||||||||||||||||||||||
| 4650 | case PM_MessageBoxIconSize: never executed: case PM_MessageBoxIconSize: | 0 | ||||||||||||||||||||||||
| 4651 | #ifdef Q_OS_MAC | - | ||||||||||||||||||||||||
| 4652 | if (QApplication::desktopSettingsAware()) { | - | ||||||||||||||||||||||||
| 4653 | ret = 64; // No DPI scaling, it's handled elsewhere. | - | ||||||||||||||||||||||||
| 4654 | } else | - | ||||||||||||||||||||||||
| 4655 | #endif | - | ||||||||||||||||||||||||
| 4656 | { | - | ||||||||||||||||||||||||
| 4657 | ret = int(QStyleHelper::dpiScaled(32.)); | - | ||||||||||||||||||||||||
| 4658 | } | - | ||||||||||||||||||||||||
| 4659 | break; never executed: break; | 0 | ||||||||||||||||||||||||
| 4660 | case PM_TextCursorWidth: never executed: case PM_TextCursorWidth: | 0 | ||||||||||||||||||||||||
| 4661 | ret = QGuiApplicationPrivate::platformTheme()->themeHint(QPlatformTheme::TextCursorWidth).toInt(); | - | ||||||||||||||||||||||||
| 4662 | break; never executed: break; | 0 | ||||||||||||||||||||||||
| 4663 | case PM_TabBar_ScrollButtonOverlap: never executed: case PM_TabBar_ScrollButtonOverlap: | 0 | ||||||||||||||||||||||||
| 4664 | ret = 1; | - | ||||||||||||||||||||||||
| 4665 | break; never executed: break; | 0 | ||||||||||||||||||||||||
| 4666 | case PM_TabCloseIndicatorWidth: never executed: case PM_TabCloseIndicatorWidth: | 0 | ||||||||||||||||||||||||
| 4667 | case PM_TabCloseIndicatorHeight: never executed: case PM_TabCloseIndicatorHeight: | 0 | ||||||||||||||||||||||||
| 4668 | ret = int(QStyleHelper::dpiScaled(16.)); | - | ||||||||||||||||||||||||
| 4669 | break; never executed: break; | 0 | ||||||||||||||||||||||||
| 4670 | case PM_ScrollView_ScrollBarSpacing: never executed: case PM_ScrollView_ScrollBarSpacing: | 0 | ||||||||||||||||||||||||
| 4671 | ret = 2 * proxy()->pixelMetric(PM_DefaultFrameWidth, opt, widget); | - | ||||||||||||||||||||||||
| 4672 | break; never executed: break; | 0 | ||||||||||||||||||||||||
| 4673 | case PM_ScrollView_ScrollBarOverlap: never executed: case PM_ScrollView_ScrollBarOverlap: | 0 | ||||||||||||||||||||||||
| 4674 | ret = 0; | - | ||||||||||||||||||||||||
| 4675 | break; never executed: break; | 0 | ||||||||||||||||||||||||
| 4676 | case PM_SubMenuOverlap: never executed: case PM_SubMenuOverlap: | 0 | ||||||||||||||||||||||||
| 4677 | ret = -proxy()->pixelMetric(QStyle::PM_MenuPanelWidth, opt, widget); | - | ||||||||||||||||||||||||
| 4678 | break; never executed: break; | 0 | ||||||||||||||||||||||||
| 4679 | case PM_TreeViewIndentation: never executed: case PM_TreeViewIndentation: | 0 | ||||||||||||||||||||||||
| 4680 | ret = int(QStyleHelper::dpiScaled(20.)); | - | ||||||||||||||||||||||||
| 4681 | break; never executed: break; | 0 | ||||||||||||||||||||||||
| 4682 | default: never executed: default: | 0 | ||||||||||||||||||||||||
| 4683 | ret = 0; | - | ||||||||||||||||||||||||
| 4684 | break; never executed: break; | 0 | ||||||||||||||||||||||||
| 4685 | } | - | ||||||||||||||||||||||||
| 4686 | - | |||||||||||||||||||||||||
| 4687 | return ret; never executed: return ret; | 0 | ||||||||||||||||||||||||
| 4688 | } | - | ||||||||||||||||||||||||
| 4689 | - | |||||||||||||||||||||||||
| 4690 | /*! | - | ||||||||||||||||||||||||
| 4691 | \reimp | - | ||||||||||||||||||||||||
| 4692 | */ | - | ||||||||||||||||||||||||
| 4693 | QSize QCommonStyle::sizeFromContents(ContentsType ct, const QStyleOption *opt, | - | ||||||||||||||||||||||||
| 4694 | const QSize &csz, const QWidget *widget) const | - | ||||||||||||||||||||||||
| 4695 | { | - | ||||||||||||||||||||||||
| 4696 | Q_D(const QCommonStyle); | - | ||||||||||||||||||||||||
| 4697 | QSize sz(csz); | - | ||||||||||||||||||||||||
| 4698 | switch (ct) { | - | ||||||||||||||||||||||||
| 4699 | case CT_PushButton: never executed: case CT_PushButton: | 0 | ||||||||||||||||||||||||
| 4700 | if (const QStyleOptionButton *btn = qstyleoption_cast<const QStyleOptionButton *>(opt)) {
| 0 | ||||||||||||||||||||||||
| 4701 | int w = csz.width(), | - | ||||||||||||||||||||||||
| 4702 | h = csz.height(), | - | ||||||||||||||||||||||||
| 4703 | bm = proxy()->pixelMetric(PM_ButtonMargin, btn, widget), | - | ||||||||||||||||||||||||
| 4704 | fw = proxy()->pixelMetric(PM_DefaultFrameWidth, btn, widget) * 2; | - | ||||||||||||||||||||||||
| 4705 | w += bm + fw; | - | ||||||||||||||||||||||||
| 4706 | h += bm + fw; | - | ||||||||||||||||||||||||
| 4707 | if (btn->features & QStyleOptionButton::AutoDefaultButton){
| 0 | ||||||||||||||||||||||||
| 4708 | int dbw = proxy()->pixelMetric(PM_ButtonDefaultIndicator, btn, widget) * 2; | - | ||||||||||||||||||||||||
| 4709 | w += dbw; | - | ||||||||||||||||||||||||
| 4710 | h += dbw; | - | ||||||||||||||||||||||||
| 4711 | } never executed: end of block | 0 | ||||||||||||||||||||||||
| 4712 | sz = QSize(w, h); | - | ||||||||||||||||||||||||
| 4713 | } never executed: end of block | 0 | ||||||||||||||||||||||||
| 4714 | break; never executed: break; | 0 | ||||||||||||||||||||||||
| 4715 | case CT_RadioButton: never executed: case CT_RadioButton: | 0 | ||||||||||||||||||||||||
| 4716 | case CT_CheckBox: never executed: case CT_CheckBox: | 0 | ||||||||||||||||||||||||
| 4717 | if (const QStyleOptionButton *btn = qstyleoption_cast<const QStyleOptionButton *>(opt)) {
| 0 | ||||||||||||||||||||||||
| 4718 | bool isRadio = (ct == CT_RadioButton); | - | ||||||||||||||||||||||||
| 4719 | - | |||||||||||||||||||||||||
| 4720 | int w = proxy()->pixelMetric(isRadio ? PM_ExclusiveIndicatorWidth | - | ||||||||||||||||||||||||
| 4721 | : PM_IndicatorWidth, btn, widget); | - | ||||||||||||||||||||||||
| 4722 | int h = proxy()->pixelMetric(isRadio ? PM_ExclusiveIndicatorHeight | - | ||||||||||||||||||||||||
| 4723 | : PM_IndicatorHeight, btn, widget); | - | ||||||||||||||||||||||||
| 4724 | - | |||||||||||||||||||||||||
| 4725 | int margins = 0; | - | ||||||||||||||||||||||||
| 4726 | // we add 4 pixels for label margins | - | ||||||||||||||||||||||||
| 4727 | if (!btn->icon.isNull() || !btn->text.isEmpty())
| 0 | ||||||||||||||||||||||||
| 4728 | margins = 4 + proxy()->pixelMetric(isRadio ? PM_RadioButtonLabelSpacing never executed: margins = 4 + proxy()->pixelMetric(isRadio ? PM_RadioButtonLabelSpacing : PM_CheckBoxLabelSpacing, opt, widget); | 0 | ||||||||||||||||||||||||
| 4729 | : PM_CheckBoxLabelSpacing, opt, widget); never executed: margins = 4 + proxy()->pixelMetric(isRadio ? PM_RadioButtonLabelSpacing : PM_CheckBoxLabelSpacing, opt, widget); | 0 | ||||||||||||||||||||||||
| 4730 | sz += QSize(w + margins, 4); | - | ||||||||||||||||||||||||
| 4731 | sz.setHeight(qMax(sz.height(), h)); | - | ||||||||||||||||||||||||
| 4732 | } never executed: end of block | 0 | ||||||||||||||||||||||||
| 4733 | break; never executed: break; | 0 | ||||||||||||||||||||||||
| 4734 | #ifndef QT_NO_MENU | - | ||||||||||||||||||||||||
| 4735 | case CT_MenuItem: never executed: case CT_MenuItem: | 0 | ||||||||||||||||||||||||
| 4736 | if (const QStyleOptionMenuItem *mi = qstyleoption_cast<const QStyleOptionMenuItem *>(opt)) {
| 0 | ||||||||||||||||||||||||
| 4737 | bool checkable = mi->menuHasCheckableItems; | - | ||||||||||||||||||||||||
| 4738 | int maxpmw = mi->maxIconWidth; | - | ||||||||||||||||||||||||
| 4739 | int w = sz.width(), h = sz.height(); | - | ||||||||||||||||||||||||
| 4740 | if (mi->menuItemType == QStyleOptionMenuItem::Separator) {
| 0 | ||||||||||||||||||||||||
| 4741 | w = 10; | - | ||||||||||||||||||||||||
| 4742 | h = 2; | - | ||||||||||||||||||||||||
| 4743 | } else { never executed: end of block | 0 | ||||||||||||||||||||||||
| 4744 | h = mi->fontMetrics.height() + 8; | - | ||||||||||||||||||||||||
| 4745 | if (!mi->icon.isNull()) {
| 0 | ||||||||||||||||||||||||
| 4746 | int iconExtent = proxy()->pixelMetric(PM_SmallIconSize); | - | ||||||||||||||||||||||||
| 4747 | h = qMax(h, mi->icon.actualSize(QSize(iconExtent, iconExtent)).height() + 4); | - | ||||||||||||||||||||||||
| 4748 | } never executed: end of block | 0 | ||||||||||||||||||||||||
| 4749 | } never executed: end of block | 0 | ||||||||||||||||||||||||
| 4750 | if (mi->text.contains(QLatin1Char('\t')))
| 0 | ||||||||||||||||||||||||
| 4751 | w += 12; never executed: w += 12; | 0 | ||||||||||||||||||||||||
| 4752 | if (maxpmw > 0)
| 0 | ||||||||||||||||||||||||
| 4753 | w += maxpmw + 6; never executed: w += maxpmw + 6; | 0 | ||||||||||||||||||||||||
| 4754 | if (checkable && maxpmw < 20)
| 0 | ||||||||||||||||||||||||
| 4755 | w += 20 - maxpmw; never executed: w += 20 - maxpmw; | 0 | ||||||||||||||||||||||||
| 4756 | if (checkable || maxpmw > 0)
| 0 | ||||||||||||||||||||||||
| 4757 | w += 2; never executed: w += 2; | 0 | ||||||||||||||||||||||||
| 4758 | w += 12; | - | ||||||||||||||||||||||||
| 4759 | sz = QSize(w, h); | - | ||||||||||||||||||||||||
| 4760 | } never executed: end of block | 0 | ||||||||||||||||||||||||
| 4761 | break; never executed: break; | 0 | ||||||||||||||||||||||||
| 4762 | #endif // QT_NO_MENU | - | ||||||||||||||||||||||||
| 4763 | #ifndef QT_NO_TOOLBUTTON | - | ||||||||||||||||||||||||
| 4764 | case CT_ToolButton: never executed: case CT_ToolButton: | 0 | ||||||||||||||||||||||||
| 4765 | sz = QSize(sz.width() + 6, sz.height() + 5); | - | ||||||||||||||||||||||||
| 4766 | break; never executed: break; | 0 | ||||||||||||||||||||||||
| 4767 | #endif // QT_NO_TOOLBUTTON | - | ||||||||||||||||||||||||
| 4768 | #ifndef QT_NO_COMBOBOX | - | ||||||||||||||||||||||||
| 4769 | case CT_ComboBox: never executed: case CT_ComboBox: | 0 | ||||||||||||||||||||||||
| 4770 | if (const QStyleOptionComboBox *cmb = qstyleoption_cast<const QStyleOptionComboBox *>(opt)) {
| 0 | ||||||||||||||||||||||||
| 4771 | int fw = cmb->frame ? proxy()->pixelMetric(PM_ComboBoxFrameWidth, opt, widget) * 2 : 0;
| 0 | ||||||||||||||||||||||||
| 4772 | const int textMargins = 2*(proxy()->pixelMetric(PM_FocusFrameHMargin) + 1); | - | ||||||||||||||||||||||||
| 4773 | // QItemDelegate::sizeHint expands the textMargins two times, thus the 2*textMargins... | - | ||||||||||||||||||||||||
| 4774 | int other = qMax(23, 2*textMargins + proxy()->pixelMetric(QStyle::PM_ScrollBarExtent, opt, widget)); | - | ||||||||||||||||||||||||
| 4775 | sz = QSize(sz.width() + fw + other, sz.height() + fw); | - | ||||||||||||||||||||||||
| 4776 | } never executed: end of block | 0 | ||||||||||||||||||||||||
| 4777 | break; never executed: break; | 0 | ||||||||||||||||||||||||
| 4778 | #endif // QT_NO_COMBOBOX | - | ||||||||||||||||||||||||
| 4779 | case CT_HeaderSection: never executed: case CT_HeaderSection: | 0 | ||||||||||||||||||||||||
| 4780 | if (const QStyleOptionHeader *hdr = qstyleoption_cast<const QStyleOptionHeader *>(opt)) {
| 0 | ||||||||||||||||||||||||
| 4781 | bool nullIcon = hdr->icon.isNull(); | - | ||||||||||||||||||||||||
| 4782 | int margin = proxy()->pixelMetric(QStyle::PM_HeaderMargin, hdr, widget); | - | ||||||||||||||||||||||||
| 4783 | int iconSize = nullIcon ? 0 : proxy()->pixelMetric(QStyle::PM_SmallIconSize, hdr, widget);
| 0 | ||||||||||||||||||||||||
| 4784 | QSize txt = hdr->fontMetrics.size(0, hdr->text); | - | ||||||||||||||||||||||||
| 4785 | sz.setHeight(margin + qMax(iconSize, txt.height()) + margin); | - | ||||||||||||||||||||||||
| 4786 | sz.setWidth((nullIcon ? 0 : margin) + iconSize | - | ||||||||||||||||||||||||
| 4787 | + (hdr->text.isNull() ? 0 : margin) + txt.width() + margin); | - | ||||||||||||||||||||||||
| 4788 | if (hdr->sortIndicator != QStyleOptionHeader::None) {
| 0 | ||||||||||||||||||||||||
| 4789 | int margin = proxy()->pixelMetric(QStyle::PM_HeaderMargin, hdr, widget); | - | ||||||||||||||||||||||||
| 4790 | if (hdr->orientation == Qt::Horizontal)
| 0 | ||||||||||||||||||||||||
| 4791 | sz.rwidth() += sz.height() + margin; never executed: sz.rwidth() += sz.height() + margin; | 0 | ||||||||||||||||||||||||
| 4792 | else | - | ||||||||||||||||||||||||
| 4793 | sz.rheight() += sz.width() + margin; never executed: sz.rheight() += sz.width() + margin; | 0 | ||||||||||||||||||||||||
| 4794 | } | - | ||||||||||||||||||||||||
| 4795 | } never executed: end of block | 0 | ||||||||||||||||||||||||
| 4796 | break; never executed: break; | 0 | ||||||||||||||||||||||||
| 4797 | case CT_TabWidget: never executed: case CT_TabWidget: | 0 | ||||||||||||||||||||||||
| 4798 | sz += QSize(4, 4); | - | ||||||||||||||||||||||||
| 4799 | break; never executed: break; | 0 | ||||||||||||||||||||||||
| 4800 | case CT_LineEdit: never executed: case CT_LineEdit: | 0 | ||||||||||||||||||||||||
| 4801 | if (const QStyleOptionFrame *f = qstyleoption_cast<const QStyleOptionFrame *>(opt))
| 0 | ||||||||||||||||||||||||
| 4802 | sz += QSize(2*f->lineWidth, 2*f->lineWidth); never executed: sz += QSize(2*f->lineWidth, 2*f->lineWidth); | 0 | ||||||||||||||||||||||||
| 4803 | break; never executed: break; | 0 | ||||||||||||||||||||||||
| 4804 | #ifndef QT_NO_GROUPBOX | - | ||||||||||||||||||||||||
| 4805 | case CT_GroupBox: never executed: case CT_GroupBox: | 0 | ||||||||||||||||||||||||
| 4806 | if (const QGroupBox *grb = static_cast<const QGroupBox *>(widget))
| 0 | ||||||||||||||||||||||||
| 4807 | sz += QSize(!grb->isFlat() ? 16 : 0, 0); never executed: sz += QSize(!grb->isFlat() ? 16 : 0, 0); | 0 | ||||||||||||||||||||||||
| 4808 | break; never executed: break; | 0 | ||||||||||||||||||||||||
| 4809 | #endif // QT_NO_GROUPBOX | - | ||||||||||||||||||||||||
| 4810 | case CT_MdiControls: never executed: case CT_MdiControls: | 0 | ||||||||||||||||||||||||
| 4811 | if (const QStyleOptionComplex *styleOpt = qstyleoption_cast<const QStyleOptionComplex *>(opt)) {
| 0 | ||||||||||||||||||||||||
| 4812 | int width = 1; | - | ||||||||||||||||||||||||
| 4813 | if (styleOpt->subControls & SC_MdiMinButton)
| 0 | ||||||||||||||||||||||||
| 4814 | width += 16 + 1; never executed: width += 16 + 1; | 0 | ||||||||||||||||||||||||
| 4815 | if (styleOpt->subControls & SC_MdiNormalButton)
| 0 | ||||||||||||||||||||||||
| 4816 | width += 16 + 1; never executed: width += 16 + 1; | 0 | ||||||||||||||||||||||||
| 4817 | if (styleOpt->subControls & SC_MdiCloseButton)
| 0 | ||||||||||||||||||||||||
| 4818 | width += 16 + 1; never executed: width += 16 + 1; | 0 | ||||||||||||||||||||||||
| 4819 | sz = QSize(width, 16); | - | ||||||||||||||||||||||||
| 4820 | } else { never executed: end of block | 0 | ||||||||||||||||||||||||
| 4821 | sz = QSize(52, 16); | - | ||||||||||||||||||||||||
| 4822 | } never executed: end of block | 0 | ||||||||||||||||||||||||
| 4823 | break; never executed: break; | 0 | ||||||||||||||||||||||||
| 4824 | #ifndef QT_NO_ITEMVIEWS | - | ||||||||||||||||||||||||
| 4825 | case CT_ItemViewItem: never executed: case CT_ItemViewItem: | 0 | ||||||||||||||||||||||||
| 4826 | if (const QStyleOptionViewItem *vopt = qstyleoption_cast<const QStyleOptionViewItem *>(opt)) {
| 0 | ||||||||||||||||||||||||
| 4827 | QRect decorationRect, displayRect, checkRect; | - | ||||||||||||||||||||||||
| 4828 | d->viewItemLayout(vopt, &checkRect, &decorationRect, &displayRect, true); | - | ||||||||||||||||||||||||
| 4829 | sz = (decorationRect|displayRect|checkRect).size(); | - | ||||||||||||||||||||||||
| 4830 | } never executed: end of block | 0 | ||||||||||||||||||||||||
| 4831 | break; never executed: break; | 0 | ||||||||||||||||||||||||
| 4832 | #endif // QT_NO_ITEMVIEWS | - | ||||||||||||||||||||||||
| 4833 | #ifndef QT_NO_SPINBOX | - | ||||||||||||||||||||||||
| 4834 | case CT_SpinBox: never executed: case CT_SpinBox: | 0 | ||||||||||||||||||||||||
| 4835 | if (const QStyleOptionSpinBox *vopt = qstyleoption_cast<const QStyleOptionSpinBox *>(opt)) {
| 0 | ||||||||||||||||||||||||
| 4836 | // Add button + frame widths | - | ||||||||||||||||||||||||
| 4837 | int buttonWidth = 20; | - | ||||||||||||||||||||||||
| 4838 | int fw = vopt->frame ? proxy()->pixelMetric(PM_SpinBoxFrameWidth, vopt, widget) : 0;
| 0 | ||||||||||||||||||||||||
| 4839 | sz += QSize(buttonWidth + 2*fw, 2*fw); | - | ||||||||||||||||||||||||
| 4840 | } never executed: end of block | 0 | ||||||||||||||||||||||||
| 4841 | break; never executed: break; | 0 | ||||||||||||||||||||||||
| 4842 | #endif | - | ||||||||||||||||||||||||
| 4843 | case CT_ScrollBar: never executed: case CT_ScrollBar: | 0 | ||||||||||||||||||||||||
| 4844 | case CT_MenuBar: never executed: case CT_MenuBar: | 0 | ||||||||||||||||||||||||
| 4845 | case CT_Menu: never executed: case CT_Menu: | 0 | ||||||||||||||||||||||||
| 4846 | case CT_MenuBarItem: never executed: case CT_MenuBarItem: | 0 | ||||||||||||||||||||||||
| 4847 | case CT_Slider: never executed: case CT_Slider: | 0 | ||||||||||||||||||||||||
| 4848 | case CT_ProgressBar: never executed: case CT_ProgressBar: | 0 | ||||||||||||||||||||||||
| 4849 | case CT_TabBarTab: never executed: case CT_TabBarTab: | 0 | ||||||||||||||||||||||||
| 4850 | // just return the contentsSize for now | - | ||||||||||||||||||||||||
| 4851 | // fall through intended | - | ||||||||||||||||||||||||
| 4852 | default: never executed: default: | 0 | ||||||||||||||||||||||||
| 4853 | break; never executed: break; | 0 | ||||||||||||||||||||||||
| 4854 | } | - | ||||||||||||||||||||||||
| 4855 | return sz; never executed: return sz; | 0 | ||||||||||||||||||||||||
| 4856 | } | - | ||||||||||||||||||||||||
| 4857 | - | |||||||||||||||||||||||||
| 4858 | - | |||||||||||||||||||||||||
| 4859 | /*! \reimp */ | - | ||||||||||||||||||||||||
| 4860 | int QCommonStyle::styleHint(StyleHint sh, const QStyleOption *opt, const QWidget *widget, | - | ||||||||||||||||||||||||
| 4861 | QStyleHintReturn *hret) const | - | ||||||||||||||||||||||||
| 4862 | { | - | ||||||||||||||||||||||||
| 4863 | int ret = 0; | - | ||||||||||||||||||||||||
| 4864 | - | |||||||||||||||||||||||||
| 4865 | switch (sh) { | - | ||||||||||||||||||||||||
| 4866 | case SH_Menu_KeyboardSearch: never executed: case SH_Menu_KeyboardSearch: | 0 | ||||||||||||||||||||||||
| 4867 | ret = false; | - | ||||||||||||||||||||||||
| 4868 | break; never executed: break; | 0 | ||||||||||||||||||||||||
| 4869 | case SH_Slider_AbsoluteSetButtons: never executed: case SH_Slider_AbsoluteSetButtons: | 0 | ||||||||||||||||||||||||
| 4870 | ret = Qt::MidButton; | - | ||||||||||||||||||||||||
| 4871 | break; never executed: break; | 0 | ||||||||||||||||||||||||
| 4872 | case SH_Slider_PageSetButtons: never executed: case SH_Slider_PageSetButtons: | 0 | ||||||||||||||||||||||||
| 4873 | ret = Qt::LeftButton; | - | ||||||||||||||||||||||||
| 4874 | break; never executed: break; | 0 | ||||||||||||||||||||||||
| 4875 | case SH_ScrollBar_ContextMenu: never executed: case SH_ScrollBar_ContextMenu: | 0 | ||||||||||||||||||||||||
| 4876 | ret = true; | - | ||||||||||||||||||||||||
| 4877 | break; never executed: break; | 0 | ||||||||||||||||||||||||
| 4878 | case SH_DialogButtons_DefaultButton: // This value not used anywhere. never executed: case SH_DialogButtons_DefaultButton: | 0 | ||||||||||||||||||||||||
| 4879 | ret = QDialogButtonBox::AcceptRole; | - | ||||||||||||||||||||||||
| 4880 | break; never executed: break; | 0 | ||||||||||||||||||||||||
| 4881 | #ifndef QT_NO_GROUPBOX | - | ||||||||||||||||||||||||
| 4882 | case SH_GroupBox_TextLabelVerticalAlignment: never executed: case SH_GroupBox_TextLabelVerticalAlignment: | 0 | ||||||||||||||||||||||||
| 4883 | ret = Qt::AlignVCenter; | - | ||||||||||||||||||||||||
| 4884 | break; never executed: break; | 0 | ||||||||||||||||||||||||
| 4885 | - | |||||||||||||||||||||||||
| 4886 | case SH_GroupBox_TextLabelColor: never executed: case SH_GroupBox_TextLabelColor: | 0 | ||||||||||||||||||||||||
| 4887 | ret = opt ? int(opt->palette.color(QPalette::Text).rgba()) : 0;
| 0 | ||||||||||||||||||||||||
| 4888 | break; never executed: break; | 0 | ||||||||||||||||||||||||
| 4889 | #endif // QT_NO_GROUPBOX | - | ||||||||||||||||||||||||
| 4890 | - | |||||||||||||||||||||||||
| 4891 | case SH_ListViewExpand_SelectMouseType: never executed: case SH_ListViewExpand_SelectMouseType: | 0 | ||||||||||||||||||||||||
| 4892 | case SH_TabBar_SelectMouseType: never executed: case SH_TabBar_SelectMouseType: | 0 | ||||||||||||||||||||||||
| 4893 | ret = QEvent::MouseButtonPress; | - | ||||||||||||||||||||||||
| 4894 | break; never executed: break; | 0 | ||||||||||||||||||||||||
| 4895 | - | |||||||||||||||||||||||||
| 4896 | - | |||||||||||||||||||||||||
| 4897 | case SH_TabBar_Alignment: never executed: case SH_TabBar_Alignment: | 0 | ||||||||||||||||||||||||
| 4898 | ret = Qt::AlignLeft; | - | ||||||||||||||||||||||||
| 4899 | break; never executed: break; | 0 | ||||||||||||||||||||||||
| 4900 | - | |||||||||||||||||||||||||
| 4901 | case SH_Header_ArrowAlignment: never executed: case SH_Header_ArrowAlignment: | 0 | ||||||||||||||||||||||||
| 4902 | ret = Qt::AlignRight | Qt::AlignVCenter; | - | ||||||||||||||||||||||||
| 4903 | break; never executed: break; | 0 | ||||||||||||||||||||||||
| 4904 | - | |||||||||||||||||||||||||
| 4905 | case SH_TitleBar_AutoRaise: never executed: case SH_TitleBar_AutoRaise: | 0 | ||||||||||||||||||||||||
| 4906 | ret = false; | - | ||||||||||||||||||||||||
| 4907 | break; never executed: break; | 0 | ||||||||||||||||||||||||
| 4908 | - | |||||||||||||||||||||||||
| 4909 | case SH_Menu_SubMenuPopupDelay: never executed: case SH_Menu_SubMenuPopupDelay: | 0 | ||||||||||||||||||||||||
| 4910 | ret = 256; | - | ||||||||||||||||||||||||
| 4911 | break; never executed: break; | 0 | ||||||||||||||||||||||||
| 4912 | - | |||||||||||||||||||||||||
| 4913 | case SH_Menu_SloppySubMenus: never executed: case SH_Menu_SloppySubMenus: | 0 | ||||||||||||||||||||||||
| 4914 | ret = true; | - | ||||||||||||||||||||||||
| 4915 | break; never executed: break; | 0 | ||||||||||||||||||||||||
| 4916 | - | |||||||||||||||||||||||||
| 4917 | case SH_Menu_SubMenuUniDirection: never executed: case SH_Menu_SubMenuUniDirection: | 0 | ||||||||||||||||||||||||
| 4918 | ret = false; | - | ||||||||||||||||||||||||
| 4919 | break; never executed: break; | 0 | ||||||||||||||||||||||||
| 4920 | case SH_Menu_SubMenuUniDirectionFailCount: never executed: case SH_Menu_SubMenuUniDirectionFailCount: | 0 | ||||||||||||||||||||||||
| 4921 | ret = 1; | - | ||||||||||||||||||||||||
| 4922 | break; never executed: break; | 0 | ||||||||||||||||||||||||
| 4923 | case SH_Menu_SubMenuSloppySelectOtherActions: never executed: case SH_Menu_SubMenuSloppySelectOtherActions: | 0 | ||||||||||||||||||||||||
| 4924 | ret = true; | - | ||||||||||||||||||||||||
| 4925 | break; never executed: break; | 0 | ||||||||||||||||||||||||
| 4926 | case SH_Menu_SubMenuSloppyCloseTimeout: never executed: case SH_Menu_SubMenuSloppyCloseTimeout: | 0 | ||||||||||||||||||||||||
| 4927 | ret = 1000; | - | ||||||||||||||||||||||||
| 4928 | break; never executed: break; | 0 | ||||||||||||||||||||||||
| 4929 | case SH_Menu_SubMenuResetWhenReenteringParent: never executed: case SH_Menu_SubMenuResetWhenReenteringParent: | 0 | ||||||||||||||||||||||||
| 4930 | ret = false; | - | ||||||||||||||||||||||||
| 4931 | break; never executed: break; | 0 | ||||||||||||||||||||||||
| 4932 | case SH_Menu_SubMenuDontStartSloppyOnLeave: never executed: case SH_Menu_SubMenuDontStartSloppyOnLeave: | 0 | ||||||||||||||||||||||||
| 4933 | ret = false; | - | ||||||||||||||||||||||||
| 4934 | break; never executed: break; | 0 | ||||||||||||||||||||||||
| 4935 | - | |||||||||||||||||||||||||
| 4936 | case SH_ProgressDialog_TextLabelAlignment: never executed: case SH_ProgressDialog_TextLabelAlignment: | 0 | ||||||||||||||||||||||||
| 4937 | ret = Qt::AlignCenter; | - | ||||||||||||||||||||||||
| 4938 | break; never executed: break; | 0 | ||||||||||||||||||||||||
| 4939 | - | |||||||||||||||||||||||||
| 4940 | case SH_BlinkCursorWhenTextSelected: never executed: case SH_BlinkCursorWhenTextSelected: | 0 | ||||||||||||||||||||||||
| 4941 | ret = 1; | - | ||||||||||||||||||||||||
| 4942 | break; never executed: break; | 0 | ||||||||||||||||||||||||
| 4943 | - | |||||||||||||||||||||||||
| 4944 | case SH_Table_GridLineColor: never executed: case SH_Table_GridLineColor: | 0 | ||||||||||||||||||||||||
| 4945 | if (opt)
| 0 | ||||||||||||||||||||||||
| 4946 | ret = opt->palette.color(QPalette::Mid).rgb(); never executed: ret = opt->palette.color(QPalette::Mid).rgb(); | 0 | ||||||||||||||||||||||||
| 4947 | else | - | ||||||||||||||||||||||||
| 4948 | ret = -1; never executed: ret = -1; | 0 | ||||||||||||||||||||||||
| 4949 | break; never executed: break; | 0 | ||||||||||||||||||||||||
| 4950 | case SH_LineEdit_PasswordCharacter: { never executed: case SH_LineEdit_PasswordCharacter: | 0 | ||||||||||||||||||||||||
| 4951 | const QPlatformTheme *theme = QGuiApplicationPrivate::platformTheme(); | - | ||||||||||||||||||||||||
| 4952 | const QPlatformTheme::ThemeHint hintType = QPlatformTheme::PasswordMaskCharacter; | - | ||||||||||||||||||||||||
| 4953 | const QVariant hint = theme ? theme->themeHint(hintType) : QPlatformTheme::defaultThemeHint(hintType);
| 0 | ||||||||||||||||||||||||
| 4954 | ret = hint.toChar().unicode(); | - | ||||||||||||||||||||||||
| 4955 | break; never executed: break; | 0 | ||||||||||||||||||||||||
| 4956 | } | - | ||||||||||||||||||||||||
| 4957 | case SH_LineEdit_PasswordMaskDelay: never executed: case SH_LineEdit_PasswordMaskDelay: | 0 | ||||||||||||||||||||||||
| 4958 | ret = QGuiApplicationPrivate::platformTheme()->themeHint(QPlatformTheme::PasswordMaskDelay).toInt(); | - | ||||||||||||||||||||||||
| 4959 | break; never executed: break; | 0 | ||||||||||||||||||||||||
| 4960 | case SH_ToolBox_SelectedPageTitleBold: never executed: case SH_ToolBox_SelectedPageTitleBold: | 0 | ||||||||||||||||||||||||
| 4961 | ret = 1; | - | ||||||||||||||||||||||||
| 4962 | break; never executed: break; | 0 | ||||||||||||||||||||||||
| 4963 | - | |||||||||||||||||||||||||
| 4964 | case SH_UnderlineShortcut: never executed: case SH_UnderlineShortcut: | 0 | ||||||||||||||||||||||||
| 4965 | ret = 1; | - | ||||||||||||||||||||||||
| 4966 | break; never executed: break; | 0 | ||||||||||||||||||||||||
| 4967 | - | |||||||||||||||||||||||||
| 4968 | case SH_SpinBox_ClickAutoRepeatRate: never executed: case SH_SpinBox_ClickAutoRepeatRate: | 0 | ||||||||||||||||||||||||
| 4969 | ret = 150; | - | ||||||||||||||||||||||||
| 4970 | break; never executed: break; | 0 | ||||||||||||||||||||||||
| 4971 | - | |||||||||||||||||||||||||
| 4972 | case SH_SpinBox_ClickAutoRepeatThreshold: never executed: case SH_SpinBox_ClickAutoRepeatThreshold: | 0 | ||||||||||||||||||||||||
| 4973 | ret = 500; | - | ||||||||||||||||||||||||
| 4974 | break; never executed: break; | 0 | ||||||||||||||||||||||||
| 4975 | - | |||||||||||||||||||||||||
| 4976 | case SH_SpinBox_KeyPressAutoRepeatRate: never executed: case SH_SpinBox_KeyPressAutoRepeatRate: | 0 | ||||||||||||||||||||||||
| 4977 | ret = 75; | - | ||||||||||||||||||||||||
| 4978 | break; never executed: break; | 0 | ||||||||||||||||||||||||
| 4979 | - | |||||||||||||||||||||||||
| 4980 | case SH_Menu_SelectionWrap: never executed: case SH_Menu_SelectionWrap: | 0 | ||||||||||||||||||||||||
| 4981 | ret = true; | - | ||||||||||||||||||||||||
| 4982 | break; never executed: break; | 0 | ||||||||||||||||||||||||
| 4983 | - | |||||||||||||||||||||||||
| 4984 | case SH_Menu_FillScreenWithScroll: never executed: case SH_Menu_FillScreenWithScroll: | 0 | ||||||||||||||||||||||||
| 4985 | ret = true; | - | ||||||||||||||||||||||||
| 4986 | break; never executed: break; | 0 | ||||||||||||||||||||||||
| 4987 | - | |||||||||||||||||||||||||
| 4988 | case SH_ToolTipLabel_Opacity: never executed: case SH_ToolTipLabel_Opacity: | 0 | ||||||||||||||||||||||||
| 4989 | ret = 255; | - | ||||||||||||||||||||||||
| 4990 | break; never executed: break; | 0 | ||||||||||||||||||||||||
| 4991 | - | |||||||||||||||||||||||||
| 4992 | case SH_Button_FocusPolicy: never executed: case SH_Button_FocusPolicy: | 0 | ||||||||||||||||||||||||
| 4993 | ret = Qt::StrongFocus; | - | ||||||||||||||||||||||||
| 4994 | break; never executed: break; | 0 | ||||||||||||||||||||||||
| 4995 | - | |||||||||||||||||||||||||
| 4996 | case SH_MessageBox_UseBorderForButtonSpacing: never executed: case SH_MessageBox_UseBorderForButtonSpacing: | 0 | ||||||||||||||||||||||||
| 4997 | ret = 0; | - | ||||||||||||||||||||||||
| 4998 | break; never executed: break; | 0 | ||||||||||||||||||||||||
| 4999 | - | |||||||||||||||||||||||||
| 5000 | case SH_ToolButton_PopupDelay: never executed: case SH_ToolButton_PopupDelay: | 0 | ||||||||||||||||||||||||
| 5001 | ret = 600; | - | ||||||||||||||||||||||||
| 5002 | break; never executed: break; | 0 | ||||||||||||||||||||||||
| 5003 | - | |||||||||||||||||||||||||
| 5004 | case SH_FocusFrame_Mask: never executed: case SH_FocusFrame_Mask: | 0 | ||||||||||||||||||||||||
| 5005 | ret = 1; | - | ||||||||||||||||||||||||
| 5006 | if (widget) {
| 0 | ||||||||||||||||||||||||
| 5007 | if(QStyleHintReturnMask *mask = qstyleoption_cast<QStyleHintReturnMask*>(hret)) {
| 0 | ||||||||||||||||||||||||
| 5008 | mask->region = widget->rect(); | - | ||||||||||||||||||||||||
| 5009 | int vmargin = proxy()->pixelMetric(QStyle::PM_FocusFrameVMargin), | - | ||||||||||||||||||||||||
| 5010 | hmargin = proxy()->pixelMetric(QStyle::PM_FocusFrameHMargin); | - | ||||||||||||||||||||||||
| 5011 | mask->region -= QRect(widget->rect().adjusted(hmargin, vmargin, -hmargin, -vmargin)); | - | ||||||||||||||||||||||||
| 5012 | } never executed: end of block | 0 | ||||||||||||||||||||||||
| 5013 | } never executed: end of block | 0 | ||||||||||||||||||||||||
| 5014 | break; never executed: break; | 0 | ||||||||||||||||||||||||
| 5015 | #ifndef QT_NO_RUBBERBAND | - | ||||||||||||||||||||||||
| 5016 | case SH_RubberBand_Mask: never executed: case SH_RubberBand_Mask: | 0 | ||||||||||||||||||||||||
| 5017 | if (const QStyleOptionRubberBand *rbOpt = qstyleoption_cast<const QStyleOptionRubberBand *>(opt)) {
| 0 | ||||||||||||||||||||||||
| 5018 | ret = 0; | - | ||||||||||||||||||||||||
| 5019 | if (rbOpt->shape == QRubberBand::Rectangle) {
| 0 | ||||||||||||||||||||||||
| 5020 | ret = true; | - | ||||||||||||||||||||||||
| 5021 | if(QStyleHintReturnMask *mask = qstyleoption_cast<QStyleHintReturnMask*>(hret)) {
| 0 | ||||||||||||||||||||||||
| 5022 | mask->region = opt->rect; | - | ||||||||||||||||||||||||
| 5023 | int margin = proxy()->pixelMetric(PM_DefaultFrameWidth) * 2; | - | ||||||||||||||||||||||||
| 5024 | mask->region -= opt->rect.adjusted(margin, margin, -margin, -margin); | - | ||||||||||||||||||||||||
| 5025 | } never executed: end of block | 0 | ||||||||||||||||||||||||
| 5026 | } never executed: end of block | 0 | ||||||||||||||||||||||||
| 5027 | } never executed: end of block | 0 | ||||||||||||||||||||||||
| 5028 | break; never executed: break; | 0 | ||||||||||||||||||||||||
| 5029 | #endif // QT_NO_RUBBERBAND | - | ||||||||||||||||||||||||
| 5030 | case SH_SpinControls_DisableOnBounds: never executed: case SH_SpinControls_DisableOnBounds: | 0 | ||||||||||||||||||||||||
| 5031 | ret = 1; | - | ||||||||||||||||||||||||
| 5032 | break; never executed: break; | 0 | ||||||||||||||||||||||||
| 5033 | - | |||||||||||||||||||||||||
| 5034 | case SH_Dial_BackgroundRole: never executed: case SH_Dial_BackgroundRole: | 0 | ||||||||||||||||||||||||
| 5035 | ret = QPalette::Window; | - | ||||||||||||||||||||||||
| 5036 | break; never executed: break; | 0 | ||||||||||||||||||||||||
| 5037 | - | |||||||||||||||||||||||||
| 5038 | case SH_ComboBox_LayoutDirection: never executed: case SH_ComboBox_LayoutDirection: | 0 | ||||||||||||||||||||||||
| 5039 | ret = opt ? opt->direction : Qt::LeftToRight;
| 0 | ||||||||||||||||||||||||
| 5040 | break; never executed: break; | 0 | ||||||||||||||||||||||||
| 5041 | - | |||||||||||||||||||||||||
| 5042 | case SH_ItemView_EllipsisLocation: never executed: case SH_ItemView_EllipsisLocation: | 0 | ||||||||||||||||||||||||
| 5043 | ret = Qt::AlignTrailing; | - | ||||||||||||||||||||||||
| 5044 | break; never executed: break; | 0 | ||||||||||||||||||||||||
| 5045 | - | |||||||||||||||||||||||||
| 5046 | case SH_ItemView_ShowDecorationSelected: never executed: case SH_ItemView_ShowDecorationSelected: | 0 | ||||||||||||||||||||||||
| 5047 | ret = false; | - | ||||||||||||||||||||||||
| 5048 | break; never executed: break; | 0 | ||||||||||||||||||||||||
| 5049 | - | |||||||||||||||||||||||||
| 5050 | case SH_ItemView_ActivateItemOnSingleClick: never executed: case SH_ItemView_ActivateItemOnSingleClick: | 0 | ||||||||||||||||||||||||
| 5051 | ret = 0; | - | ||||||||||||||||||||||||
| 5052 | if (const QPlatformTheme *theme = QGuiApplicationPrivate::platformTheme())
| 0 | ||||||||||||||||||||||||
| 5053 | ret = theme->themeHint(QPlatformTheme::ItemViewActivateItemOnSingleClick).toBool() ? 1 : 0; never executed: ret = theme->themeHint(QPlatformTheme::ItemViewActivateItemOnSingleClick).toBool() ? 1 : 0;
| 0 | ||||||||||||||||||||||||
| 5054 | break; never executed: break; | 0 | ||||||||||||||||||||||||
| 5055 | case SH_TitleBar_ModifyNotification: never executed: case SH_TitleBar_ModifyNotification: | 0 | ||||||||||||||||||||||||
| 5056 | ret = true; | - | ||||||||||||||||||||||||
| 5057 | break; never executed: break; | 0 | ||||||||||||||||||||||||
| 5058 | case SH_ScrollBar_RollBetweenButtons: never executed: case SH_ScrollBar_RollBetweenButtons: | 0 | ||||||||||||||||||||||||
| 5059 | ret = false; | - | ||||||||||||||||||||||||
| 5060 | break; never executed: break; | 0 | ||||||||||||||||||||||||
| 5061 | case SH_TabBar_ElideMode: never executed: case SH_TabBar_ElideMode: | 0 | ||||||||||||||||||||||||
| 5062 | ret = Qt::ElideNone; | - | ||||||||||||||||||||||||
| 5063 | break; never executed: break; | 0 | ||||||||||||||||||||||||
| 5064 | case SH_DialogButtonLayout: never executed: case SH_DialogButtonLayout: | 0 | ||||||||||||||||||||||||
| 5065 | ret = QDialogButtonBox::WinLayout; | - | ||||||||||||||||||||||||
| 5066 | if (const QPlatformTheme *theme = QGuiApplicationPrivate::platformTheme())
| 0 | ||||||||||||||||||||||||
| 5067 | ret = theme->themeHint(QPlatformTheme::DialogButtonBoxLayout).toInt(); never executed: ret = theme->themeHint(QPlatformTheme::DialogButtonBoxLayout).toInt(); | 0 | ||||||||||||||||||||||||
| 5068 | break; never executed: break; | 0 | ||||||||||||||||||||||||
| 5069 | case SH_ComboBox_PopupFrameStyle: never executed: case SH_ComboBox_PopupFrameStyle: | 0 | ||||||||||||||||||||||||
| 5070 | ret = QFrame::StyledPanel | QFrame::Plain; | - | ||||||||||||||||||||||||
| 5071 | break; never executed: break; | 0 | ||||||||||||||||||||||||
| 5072 | case SH_MessageBox_TextInteractionFlags: never executed: case SH_MessageBox_TextInteractionFlags: | 0 | ||||||||||||||||||||||||
| 5073 | ret = Qt::LinksAccessibleByMouse; | - | ||||||||||||||||||||||||
| 5074 | break; never executed: break; | 0 | ||||||||||||||||||||||||
| 5075 | case SH_DialogButtonBox_ButtonsHaveIcons: never executed: case SH_DialogButtonBox_ButtonsHaveIcons: | 0 | ||||||||||||||||||||||||
| 5076 | ret = 0; | - | ||||||||||||||||||||||||
| 5077 | if (const QPlatformTheme *theme = QGuiApplicationPrivate::platformTheme())
| 0 | ||||||||||||||||||||||||
| 5078 | ret = theme->themeHint(QPlatformTheme::DialogButtonBoxButtonsHaveIcons).toBool() ? 1 : 0; never executed: ret = theme->themeHint(QPlatformTheme::DialogButtonBoxButtonsHaveIcons).toBool() ? 1 : 0;
| 0 | ||||||||||||||||||||||||
| 5079 | break; never executed: break; | 0 | ||||||||||||||||||||||||
| 5080 | case SH_SpellCheckUnderlineStyle: never executed: case SH_SpellCheckUnderlineStyle: | 0 | ||||||||||||||||||||||||
| 5081 | ret = QTextCharFormat::WaveUnderline; | - | ||||||||||||||||||||||||
| 5082 | break; never executed: break; | 0 | ||||||||||||||||||||||||
| 5083 | case SH_MessageBox_CenterButtons: never executed: case SH_MessageBox_CenterButtons: | 0 | ||||||||||||||||||||||||
| 5084 | ret = true; | - | ||||||||||||||||||||||||
| 5085 | break; never executed: break; | 0 | ||||||||||||||||||||||||
| 5086 | case SH_ItemView_MovementWithoutUpdatingSelection: never executed: case SH_ItemView_MovementWithoutUpdatingSelection: | 0 | ||||||||||||||||||||||||
| 5087 | ret = true; | - | ||||||||||||||||||||||||
| 5088 | break; never executed: break; | 0 | ||||||||||||||||||||||||
| 5089 | case SH_FocusFrame_AboveWidget: never executed: case SH_FocusFrame_AboveWidget: | 0 | ||||||||||||||||||||||||
| 5090 | ret = false; | - | ||||||||||||||||||||||||
| 5091 | break; never executed: break; | 0 | ||||||||||||||||||||||||
| 5092 | #ifndef QT_NO_TABWIDGET | - | ||||||||||||||||||||||||
| 5093 | case SH_TabWidget_DefaultTabPosition: never executed: case SH_TabWidget_DefaultTabPosition: | 0 | ||||||||||||||||||||||||
| 5094 | ret = QTabWidget::North; | - | ||||||||||||||||||||||||
| 5095 | break; never executed: break; | 0 | ||||||||||||||||||||||||
| 5096 | #endif | - | ||||||||||||||||||||||||
| 5097 | case SH_ToolBar_Movable: never executed: case SH_ToolBar_Movable: | 0 | ||||||||||||||||||||||||
| 5098 | ret = true; | - | ||||||||||||||||||||||||
| 5099 | break; never executed: break; | 0 | ||||||||||||||||||||||||
| 5100 | case SH_TextControl_FocusIndicatorTextCharFormat: never executed: case SH_TextControl_FocusIndicatorTextCharFormat: | 0 | ||||||||||||||||||||||||
| 5101 | ret = true; | - | ||||||||||||||||||||||||
| 5102 | if (QStyleHintReturnVariant *vret = qstyleoption_cast<QStyleHintReturnVariant*>(hret)) {
| 0 | ||||||||||||||||||||||||
| 5103 | QPen outline(opt->palette.color(QPalette::Text), 1, Qt::DotLine); | - | ||||||||||||||||||||||||
| 5104 | QTextCharFormat fmt; | - | ||||||||||||||||||||||||
| 5105 | fmt.setProperty(QTextFormat::OutlinePen, outline); | - | ||||||||||||||||||||||||
| 5106 | vret->variant = fmt; | - | ||||||||||||||||||||||||
| 5107 | } never executed: end of block | 0 | ||||||||||||||||||||||||
| 5108 | break; never executed: break; | 0 | ||||||||||||||||||||||||
| 5109 | #ifndef QT_NO_WIZARD | - | ||||||||||||||||||||||||
| 5110 | case SH_WizardStyle: never executed: case SH_WizardStyle: | 0 | ||||||||||||||||||||||||
| 5111 | ret = QWizard::ClassicStyle; | - | ||||||||||||||||||||||||
| 5112 | break; never executed: break; | 0 | ||||||||||||||||||||||||
| 5113 | #endif | - | ||||||||||||||||||||||||
| 5114 | case SH_FormLayoutWrapPolicy: never executed: case SH_FormLayoutWrapPolicy: | 0 | ||||||||||||||||||||||||
| 5115 | ret = QFormLayout::DontWrapRows; | - | ||||||||||||||||||||||||
| 5116 | break; never executed: break; | 0 | ||||||||||||||||||||||||
| 5117 | case SH_FormLayoutFieldGrowthPolicy: never executed: case SH_FormLayoutFieldGrowthPolicy: | 0 | ||||||||||||||||||||||||
| 5118 | ret = QFormLayout::AllNonFixedFieldsGrow; | - | ||||||||||||||||||||||||
| 5119 | break; never executed: break; | 0 | ||||||||||||||||||||||||
| 5120 | case SH_FormLayoutFormAlignment: never executed: case SH_FormLayoutFormAlignment: | 0 | ||||||||||||||||||||||||
| 5121 | ret = Qt::AlignLeft | Qt::AlignTop; | - | ||||||||||||||||||||||||
| 5122 | break; never executed: break; | 0 | ||||||||||||||||||||||||
| 5123 | case SH_FormLayoutLabelAlignment: never executed: case SH_FormLayoutLabelAlignment: | 0 | ||||||||||||||||||||||||
| 5124 | ret = Qt::AlignLeft; | - | ||||||||||||||||||||||||
| 5125 | break; never executed: break; | 0 | ||||||||||||||||||||||||
| 5126 | case SH_ItemView_ArrowKeysNavigateIntoChildren: never executed: case SH_ItemView_ArrowKeysNavigateIntoChildren: | 0 | ||||||||||||||||||||||||
| 5127 | ret = false; | - | ||||||||||||||||||||||||
| 5128 | break; never executed: break; | 0 | ||||||||||||||||||||||||
| 5129 | case SH_ItemView_DrawDelegateFrame: never executed: case SH_ItemView_DrawDelegateFrame: | 0 | ||||||||||||||||||||||||
| 5130 | ret = 0; | - | ||||||||||||||||||||||||
| 5131 | break; never executed: break; | 0 | ||||||||||||||||||||||||
| 5132 | #ifndef QT_NO_TABBAR | - | ||||||||||||||||||||||||
| 5133 | case SH_TabBar_CloseButtonPosition: never executed: case SH_TabBar_CloseButtonPosition: | 0 | ||||||||||||||||||||||||
| 5134 | ret = QTabBar::RightSide; | - | ||||||||||||||||||||||||
| 5135 | break; never executed: break; | 0 | ||||||||||||||||||||||||
| 5136 | case SH_TabBar_ChangeCurrentDelay: never executed: case SH_TabBar_ChangeCurrentDelay: | 0 | ||||||||||||||||||||||||
| 5137 | ret = 500; | - | ||||||||||||||||||||||||
| 5138 | break; never executed: break; | 0 | ||||||||||||||||||||||||
| 5139 | #endif | - | ||||||||||||||||||||||||
| 5140 | case SH_DockWidget_ButtonsHaveFrame: never executed: case SH_DockWidget_ButtonsHaveFrame: | 0 | ||||||||||||||||||||||||
| 5141 | ret = true; | - | ||||||||||||||||||||||||
| 5142 | break; never executed: break; | 0 | ||||||||||||||||||||||||
| 5143 | case SH_ToolButtonStyle: never executed: case SH_ToolButtonStyle: | 0 | ||||||||||||||||||||||||
| 5144 | ret = 0; | - | ||||||||||||||||||||||||
| 5145 | if (const QPlatformTheme *theme = QGuiApplicationPrivate::platformTheme())
| 0 | ||||||||||||||||||||||||
| 5146 | ret = theme->themeHint(QPlatformTheme::ToolButtonStyle).toInt(); never executed: ret = theme->themeHint(QPlatformTheme::ToolButtonStyle).toInt(); | 0 | ||||||||||||||||||||||||
| 5147 | break; never executed: break; | 0 | ||||||||||||||||||||||||
| 5148 | case SH_RequestSoftwareInputPanel: never executed: case SH_RequestSoftwareInputPanel: | 0 | ||||||||||||||||||||||||
| 5149 | ret = RSIP_OnMouseClick; | - | ||||||||||||||||||||||||
| 5150 | break; never executed: break; | 0 | ||||||||||||||||||||||||
| 5151 | case SH_ScrollBar_Transient: never executed: case SH_ScrollBar_Transient: | 0 | ||||||||||||||||||||||||
| 5152 | ret = false; | - | ||||||||||||||||||||||||
| 5153 | break; never executed: break; | 0 | ||||||||||||||||||||||||
| 5154 | case SH_Menu_SupportsSections: never executed: case SH_Menu_SupportsSections: | 0 | ||||||||||||||||||||||||
| 5155 | ret = false; | - | ||||||||||||||||||||||||
| 5156 | break; never executed: break; | 0 | ||||||||||||||||||||||||
| 5157 | #ifndef QT_NO_TOOLTIP | - | ||||||||||||||||||||||||
| 5158 | case SH_ToolTip_WakeUpDelay: never executed: case SH_ToolTip_WakeUpDelay: | 0 | ||||||||||||||||||||||||
| 5159 | ret = 700; | - | ||||||||||||||||||||||||
| 5160 | break; never executed: break; | 0 | ||||||||||||||||||||||||
| 5161 | case SH_ToolTip_FallAsleepDelay: never executed: case SH_ToolTip_FallAsleepDelay: | 0 | ||||||||||||||||||||||||
| 5162 | ret = 2000; | - | ||||||||||||||||||||||||
| 5163 | break; never executed: break; | 0 | ||||||||||||||||||||||||
| 5164 | #endif | - | ||||||||||||||||||||||||
| 5165 | case SH_Widget_Animate: never executed: case SH_Widget_Animate: | 0 | ||||||||||||||||||||||||
| 5166 | #ifndef QT_NO_TREEVIEW | - | ||||||||||||||||||||||||
| 5167 | if (qobject_cast<const QTreeView*>(widget)) {
| 0 | ||||||||||||||||||||||||
| 5168 | ret = false; | - | ||||||||||||||||||||||||
| 5169 | } else never executed: end of block | 0 | ||||||||||||||||||||||||
| 5170 | #endif | - | ||||||||||||||||||||||||
| 5171 | { | - | ||||||||||||||||||||||||
| 5172 | ret = true; | - | ||||||||||||||||||||||||
| 5173 | } never executed: end of block | 0 | ||||||||||||||||||||||||
| 5174 | break; never executed: break; | 0 | ||||||||||||||||||||||||
| 5175 | case SH_Splitter_OpaqueResize: never executed: case SH_Splitter_OpaqueResize: | 0 | ||||||||||||||||||||||||
| 5176 | ret = true; | - | ||||||||||||||||||||||||
| 5177 | break; never executed: break; | 0 | ||||||||||||||||||||||||
| 5178 | default: never executed: default: | 0 | ||||||||||||||||||||||||
| 5179 | ret = 0; | - | ||||||||||||||||||||||||
| 5180 | break; never executed: break; | 0 | ||||||||||||||||||||||||
| 5181 | } | - | ||||||||||||||||||||||||
| 5182 | - | |||||||||||||||||||||||||
| 5183 | return ret; never executed: return ret; | 0 | ||||||||||||||||||||||||
| 5184 | } | - | ||||||||||||||||||||||||
| 5185 | - | |||||||||||||||||||||||||
| 5186 | static QPixmap cachedPixmapFromXPM(const char * const *xpm) | - | ||||||||||||||||||||||||
| 5187 | { | - | ||||||||||||||||||||||||
| 5188 | QPixmap result; | - | ||||||||||||||||||||||||
| 5189 | const QString tag = QString::asprintf("xpm:0x%p", static_cast<const void*>(xpm)); | - | ||||||||||||||||||||||||
| 5190 | if (!QPixmapCache::find(tag, &result)) {
| 0 | ||||||||||||||||||||||||
| 5191 | result = QPixmap(xpm); | - | ||||||||||||||||||||||||
| 5192 | QPixmapCache::insert(tag, result); | - | ||||||||||||||||||||||||
| 5193 | } never executed: end of block | 0 | ||||||||||||||||||||||||
| 5194 | return result; never executed: return result; | 0 | ||||||||||||||||||||||||
| 5195 | } | - | ||||||||||||||||||||||||
| 5196 | - | |||||||||||||||||||||||||
| 5197 | static never executed: inline QPixmap titleBarMenuCachedPixmapFromXPM() { return cachedPixmapFromXPM(qt_menu_xpm); }return cachedPixmapFromXPM(qt_menu_xpm);never executed: return cachedPixmapFromXPM(qt_menu_xpm); | 0 | ||||||||||||||||||||||||
| 5198 | - | |||||||||||||||||||||||||
| 5199 | #ifndef QT_NO_IMAGEFORMAT_PNG | - | ||||||||||||||||||||||||
| 5200 | static inline QString clearText16IconPath() | - | ||||||||||||||||||||||||
| 5201 | { | - | ||||||||||||||||||||||||
| 5202 | return QStringLiteral(":/qt-project.org/styles/commonstyle/images/cleartext-16.png"); never executed: return ([]() -> QString { enum { Size = sizeof(u"" ":/qt-project.org/styles/commonstyle/images/cleartext-16.png")/2 - 1 }; static const QStaticStringData<Size> qstring_literal = { { { { -1 } }, Size, 0, 0, sizeof(QStringData) }, u"" ":/qt-project.org/styles/commonstyle/images/cleartext-16.png" }; QStringDataPtr holder = { qstring_literal.data_ptr() }; const QString qstring_literal_temp(holder); return qstring_literal_temp; }());never executed: return qstring_literal_temp; | 0 | ||||||||||||||||||||||||
| 5203 | } | - | ||||||||||||||||||||||||
| 5204 | #endif // !QT_NO_IMAGEFORMAT_PNG | - | ||||||||||||||||||||||||
| 5205 | - | |||||||||||||||||||||||||
| 5206 | static QIcon clearTextIcon(bool rtl) | - | ||||||||||||||||||||||||
| 5207 | { | - | ||||||||||||||||||||||||
| 5208 | const QString directionalThemeName = rtl
| 0 | ||||||||||||||||||||||||
| 5209 | ? QStringLiteral("edit-clear-locationbar-ltr") : QStringLiteral("edit-clear-locationbar-rtl"); never executed: return qstring_literal_temp;never executed: return qstring_literal_temp; | 0 | ||||||||||||||||||||||||
| 5210 | if (QIcon::hasThemeIcon(directionalThemeName))
| 0 | ||||||||||||||||||||||||
| 5211 | return QIcon::fromTheme(directionalThemeName); never executed: return QIcon::fromTheme(directionalThemeName); | 0 | ||||||||||||||||||||||||
| 5212 | const QString themeName = QStringLiteral("edit-clear"); never executed: return qstring_literal_temp; | 0 | ||||||||||||||||||||||||
| 5213 | if (QIcon::hasThemeIcon(themeName))
| 0 | ||||||||||||||||||||||||
| 5214 | return QIcon::fromTheme(themeName); never executed: return QIcon::fromTheme(themeName); | 0 | ||||||||||||||||||||||||
| 5215 | - | |||||||||||||||||||||||||
| 5216 | QIcon icon; | - | ||||||||||||||||||||||||
| 5217 | #ifndef QT_NO_IMAGEFORMAT_PNG | - | ||||||||||||||||||||||||
| 5218 | QPixmap clearText16(clearText16IconPath()); | - | ||||||||||||||||||||||||
| 5219 | Q_ASSERT(!clearText16.size().isEmpty()); | - | ||||||||||||||||||||||||
| 5220 | icon.addPixmap(clearText16); | - | ||||||||||||||||||||||||
| 5221 | QPixmap clearText32(QStringLiteral(":/qt-project.org/styles/commonstyle/images/cleartext-32.png")); never executed: return qstring_literal_temp; | 0 | ||||||||||||||||||||||||
| 5222 | Q_ASSERT(!clearText32.size().isEmpty()); | - | ||||||||||||||||||||||||
| 5223 | icon.addPixmap(clearText32); | - | ||||||||||||||||||||||||
| 5224 | clearText32.setDevicePixelRatio(2); // The 32x32 pixmap can also be used for 16x16/devicePixelRatio=2 | - | ||||||||||||||||||||||||
| 5225 | icon.addPixmap(clearText32); | - | ||||||||||||||||||||||||
| 5226 | #endif // !QT_NO_IMAGEFORMAT_PNG | - | ||||||||||||||||||||||||
| 5227 | return icon; never executed: return icon; | 0 | ||||||||||||||||||||||||
| 5228 | } | - | ||||||||||||||||||||||||
| 5229 | - | |||||||||||||||||||||||||
| 5230 | /*! \reimp */ | - | ||||||||||||||||||||||||
| 5231 | QPixmap QCommonStyle::standardPixmap(StandardPixmap sp, const QStyleOption *option, | - | ||||||||||||||||||||||||
| 5232 | const QWidget *widget) const | - | ||||||||||||||||||||||||
| 5233 | { | - | ||||||||||||||||||||||||
| 5234 | const bool rtl = (option && option->direction == Qt::RightToLeft) || (!option && QApplication::isRightToLeft());
| 0 | ||||||||||||||||||||||||
| 5235 | #ifdef QT_NO_IMAGEFORMAT_PNG | - | ||||||||||||||||||||||||
| 5236 | Q_UNUSED(widget); | - | ||||||||||||||||||||||||
| 5237 | Q_UNUSED(sp); | - | ||||||||||||||||||||||||
| 5238 | #else | - | ||||||||||||||||||||||||
| 5239 | QPixmap pixmap; | - | ||||||||||||||||||||||||
| 5240 | - | |||||||||||||||||||||||||
| 5241 | if (QApplication::desktopSettingsAware() && !QIcon::themeName().isEmpty()) {
| 0 | ||||||||||||||||||||||||
| 5242 | switch (sp) { | - | ||||||||||||||||||||||||
| 5243 | case SP_DialogYesButton: never executed: case SP_DialogYesButton: | 0 | ||||||||||||||||||||||||
| 5244 | case SP_DialogOkButton: never executed: case SP_DialogOkButton: | 0 | ||||||||||||||||||||||||
| 5245 | pixmap = QIcon::fromTheme(QLatin1String("dialog-ok")).pixmap(16); | - | ||||||||||||||||||||||||
| 5246 | break; never executed: break; | 0 | ||||||||||||||||||||||||
| 5247 | case SP_DialogApplyButton: never executed: case SP_DialogApplyButton: | 0 | ||||||||||||||||||||||||
| 5248 | pixmap = QIcon::fromTheme(QLatin1String("dialog-ok-apply")).pixmap(16); | - | ||||||||||||||||||||||||
| 5249 | break; never executed: break; | 0 | ||||||||||||||||||||||||
| 5250 | case SP_DialogDiscardButton: never executed: case SP_DialogDiscardButton: | 0 | ||||||||||||||||||||||||
| 5251 | pixmap = QIcon::fromTheme(QLatin1String("edit-delete")).pixmap(16); | - | ||||||||||||||||||||||||
| 5252 | break; never executed: break; | 0 | ||||||||||||||||||||||||
| 5253 | case SP_DialogCloseButton: never executed: case SP_DialogCloseButton: | 0 | ||||||||||||||||||||||||
| 5254 | pixmap = QIcon::fromTheme(QLatin1String("dialog-close")).pixmap(16); | - | ||||||||||||||||||||||||
| 5255 | break; never executed: break; | 0 | ||||||||||||||||||||||||
| 5256 | case SP_DirHomeIcon: never executed: case SP_DirHomeIcon: | 0 | ||||||||||||||||||||||||
| 5257 | pixmap = QIcon::fromTheme(QLatin1String("user-home")).pixmap(16); | - | ||||||||||||||||||||||||
| 5258 | break; never executed: break; | 0 | ||||||||||||||||||||||||
| 5259 | case SP_MessageBoxInformation: never executed: case SP_MessageBoxInformation: | 0 | ||||||||||||||||||||||||
| 5260 | pixmap = QIcon::fromTheme(QLatin1String("messagebox_info")).pixmap(16); | - | ||||||||||||||||||||||||
| 5261 | break; never executed: break; | 0 | ||||||||||||||||||||||||
| 5262 | case SP_MessageBoxWarning: never executed: case SP_MessageBoxWarning: | 0 | ||||||||||||||||||||||||
| 5263 | pixmap = QIcon::fromTheme(QLatin1String("messagebox_warning")).pixmap(16); | - | ||||||||||||||||||||||||
| 5264 | break; never executed: break; | 0 | ||||||||||||||||||||||||
| 5265 | case SP_MessageBoxCritical: never executed: case SP_MessageBoxCritical: | 0 | ||||||||||||||||||||||||
| 5266 | pixmap = QIcon::fromTheme(QLatin1String("messagebox_critical")).pixmap(16); | - | ||||||||||||||||||||||||
| 5267 | break; never executed: break; | 0 | ||||||||||||||||||||||||
| 5268 | case SP_MessageBoxQuestion: never executed: case SP_MessageBoxQuestion: | 0 | ||||||||||||||||||||||||
| 5269 | pixmap = QIcon::fromTheme(QLatin1String("help")).pixmap(16); | - | ||||||||||||||||||||||||
| 5270 | break; never executed: break; | 0 | ||||||||||||||||||||||||
| 5271 | case SP_DialogOpenButton: never executed: case SP_DialogOpenButton: | 0 | ||||||||||||||||||||||||
| 5272 | case SP_DirOpenIcon: never executed: case SP_DirOpenIcon: | 0 | ||||||||||||||||||||||||
| 5273 | pixmap = QIcon::fromTheme(QLatin1String("folder-open")).pixmap(16); | - | ||||||||||||||||||||||||
| 5274 | break; never executed: break; | 0 | ||||||||||||||||||||||||
| 5275 | case SP_FileIcon: never executed: case SP_FileIcon: | 0 | ||||||||||||||||||||||||
| 5276 | pixmap = QIcon::fromTheme(QLatin1String("text-x-generic"), | - | ||||||||||||||||||||||||
| 5277 | QIcon::fromTheme(QLatin1String("empty"))).pixmap(16); | - | ||||||||||||||||||||||||
| 5278 | break; never executed: break; | 0 | ||||||||||||||||||||||||
| 5279 | case SP_DirClosedIcon: never executed: case SP_DirClosedIcon: | 0 | ||||||||||||||||||||||||
| 5280 | case SP_DirIcon: never executed: case SP_DirIcon: | 0 | ||||||||||||||||||||||||
| 5281 | pixmap = QIcon::fromTheme(QLatin1String("folder")).pixmap(16); | - | ||||||||||||||||||||||||
| 5282 | break; never executed: break; | 0 | ||||||||||||||||||||||||
| 5283 | case SP_DriveFDIcon: never executed: case SP_DriveFDIcon: | 0 | ||||||||||||||||||||||||
| 5284 | pixmap = QIcon::fromTheme(QLatin1String("media-floppy"), | - | ||||||||||||||||||||||||
| 5285 | QIcon::fromTheme(QLatin1String("3floppy_unmount"))).pixmap(16); | - | ||||||||||||||||||||||||
| 5286 | break; never executed: break; | 0 | ||||||||||||||||||||||||
| 5287 | case SP_ComputerIcon: never executed: case SP_ComputerIcon: | 0 | ||||||||||||||||||||||||
| 5288 | pixmap = QIcon::fromTheme(QLatin1String("computer"), | - | ||||||||||||||||||||||||
| 5289 | QIcon::fromTheme(QLatin1String("system"))).pixmap(16); | - | ||||||||||||||||||||||||
| 5290 | break; never executed: break; | 0 | ||||||||||||||||||||||||
| 5291 | case SP_DesktopIcon: never executed: case SP_DesktopIcon: | 0 | ||||||||||||||||||||||||
| 5292 | pixmap = QIcon::fromTheme(QLatin1String("user-desktop"), | - | ||||||||||||||||||||||||
| 5293 | QIcon::fromTheme(QLatin1String("desktop"))).pixmap(16); | - | ||||||||||||||||||||||||
| 5294 | break; never executed: break; | 0 | ||||||||||||||||||||||||
| 5295 | case SP_TrashIcon: never executed: case SP_TrashIcon: | 0 | ||||||||||||||||||||||||
| 5296 | pixmap = QIcon::fromTheme(QLatin1String("user-trash"), | - | ||||||||||||||||||||||||
| 5297 | QIcon::fromTheme(QLatin1String("trashcan_empty"))).pixmap(16); | - | ||||||||||||||||||||||||
| 5298 | break; never executed: break; | 0 | ||||||||||||||||||||||||
| 5299 | case SP_DriveCDIcon: never executed: case SP_DriveCDIcon: | 0 | ||||||||||||||||||||||||
| 5300 | case SP_DriveDVDIcon: never executed: case SP_DriveDVDIcon: | 0 | ||||||||||||||||||||||||
| 5301 | pixmap = QIcon::fromTheme(QLatin1String("media-optical"), | - | ||||||||||||||||||||||||
| 5302 | QIcon::fromTheme(QLatin1String("cdrom_unmount"))).pixmap(16); | - | ||||||||||||||||||||||||
| 5303 | break; never executed: break; | 0 | ||||||||||||||||||||||||
| 5304 | case SP_DriveHDIcon: never executed: case SP_DriveHDIcon: | 0 | ||||||||||||||||||||||||
| 5305 | pixmap = QIcon::fromTheme(QLatin1String("drive-harddisk"), | - | ||||||||||||||||||||||||
| 5306 | QIcon::fromTheme(QLatin1String("hdd_unmount"))).pixmap(16); | - | ||||||||||||||||||||||||
| 5307 | break; never executed: break; | 0 | ||||||||||||||||||||||||
| 5308 | case SP_FileDialogToParent: never executed: case SP_FileDialogToParent: | 0 | ||||||||||||||||||||||||
| 5309 | pixmap = QIcon::fromTheme(QLatin1String("go-up"), | - | ||||||||||||||||||||||||
| 5310 | QIcon::fromTheme(QLatin1String("up"))).pixmap(16); | - | ||||||||||||||||||||||||
| 5311 | break; never executed: break; | 0 | ||||||||||||||||||||||||
| 5312 | case SP_FileDialogNewFolder: never executed: case SP_FileDialogNewFolder: | 0 | ||||||||||||||||||||||||
| 5313 | pixmap = QIcon::fromTheme(QLatin1String("folder_new")).pixmap(16); | - | ||||||||||||||||||||||||
| 5314 | break; never executed: break; | 0 | ||||||||||||||||||||||||
| 5315 | case SP_ArrowUp: never executed: case SP_ArrowUp: | 0 | ||||||||||||||||||||||||
| 5316 | pixmap = QIcon::fromTheme(QLatin1String("go-up"), | - | ||||||||||||||||||||||||
| 5317 | QIcon::fromTheme(QLatin1String("up"))).pixmap(16); | - | ||||||||||||||||||||||||
| 5318 | break; never executed: break; | 0 | ||||||||||||||||||||||||
| 5319 | case SP_ArrowDown: never executed: case SP_ArrowDown: | 0 | ||||||||||||||||||||||||
| 5320 | pixmap = QIcon::fromTheme(QLatin1String("go-down"), | - | ||||||||||||||||||||||||
| 5321 | QIcon::fromTheme(QLatin1String("down"))).pixmap(16); | - | ||||||||||||||||||||||||
| 5322 | break; never executed: break; | 0 | ||||||||||||||||||||||||
| 5323 | case SP_ArrowRight: never executed: case SP_ArrowRight: | 0 | ||||||||||||||||||||||||
| 5324 | pixmap = QIcon::fromTheme(QLatin1String("go-next"), | - | ||||||||||||||||||||||||
| 5325 | QIcon::fromTheme(QLatin1String("forward"))).pixmap(16); | - | ||||||||||||||||||||||||
| 5326 | break; never executed: break; | 0 | ||||||||||||||||||||||||
| 5327 | case SP_ArrowLeft: never executed: case SP_ArrowLeft: | 0 | ||||||||||||||||||||||||
| 5328 | pixmap = QIcon::fromTheme(QLatin1String("go-previous"), | - | ||||||||||||||||||||||||
| 5329 | QIcon::fromTheme(QLatin1String("back"))).pixmap(16); | - | ||||||||||||||||||||||||
| 5330 | break; never executed: break; | 0 | ||||||||||||||||||||||||
| 5331 | case SP_FileDialogDetailedView: never executed: case SP_FileDialogDetailedView: | 0 | ||||||||||||||||||||||||
| 5332 | pixmap = QIcon::fromTheme(QLatin1String("view_detailed")).pixmap(16); | - | ||||||||||||||||||||||||
| 5333 | break; never executed: break; | 0 | ||||||||||||||||||||||||
| 5334 | case SP_FileDialogListView: never executed: case SP_FileDialogListView: | 0 | ||||||||||||||||||||||||
| 5335 | pixmap = QIcon::fromTheme(QLatin1String("view_icon")).pixmap(16); | - | ||||||||||||||||||||||||
| 5336 | break; never executed: break; | 0 | ||||||||||||||||||||||||
| 5337 | case SP_BrowserReload: never executed: case SP_BrowserReload: | 0 | ||||||||||||||||||||||||
| 5338 | pixmap = QIcon::fromTheme(QLatin1String("reload")).pixmap(16); | - | ||||||||||||||||||||||||
| 5339 | break; never executed: break; | 0 | ||||||||||||||||||||||||
| 5340 | case SP_BrowserStop: never executed: case SP_BrowserStop: | 0 | ||||||||||||||||||||||||
| 5341 | pixmap = QIcon::fromTheme(QLatin1String("process-stop")).pixmap(16); | - | ||||||||||||||||||||||||
| 5342 | break; never executed: break; | 0 | ||||||||||||||||||||||||
| 5343 | case SP_MediaPlay: never executed: case SP_MediaPlay: | 0 | ||||||||||||||||||||||||
| 5344 | pixmap = QIcon::fromTheme(QLatin1String("media-playback-start")).pixmap(16); | - | ||||||||||||||||||||||||
| 5345 | break; never executed: break; | 0 | ||||||||||||||||||||||||
| 5346 | case SP_MediaPause: never executed: case SP_MediaPause: | 0 | ||||||||||||||||||||||||
| 5347 | pixmap = QIcon::fromTheme(QLatin1String("media-playback-pause")).pixmap(16); | - | ||||||||||||||||||||||||
| 5348 | break; never executed: break; | 0 | ||||||||||||||||||||||||
| 5349 | case SP_MediaStop: never executed: case SP_MediaStop: | 0 | ||||||||||||||||||||||||
| 5350 | pixmap = QIcon::fromTheme(QLatin1String("media-playback-stop")).pixmap(16); | - | ||||||||||||||||||||||||
| 5351 | break; never executed: break; | 0 | ||||||||||||||||||||||||
| 5352 | case SP_MediaSeekForward: never executed: case SP_MediaSeekForward: | 0 | ||||||||||||||||||||||||
| 5353 | pixmap = QIcon::fromTheme(QLatin1String("media-seek-forward")).pixmap(16); | - | ||||||||||||||||||||||||
| 5354 | break; never executed: break; | 0 | ||||||||||||||||||||||||
| 5355 | case SP_MediaSeekBackward: never executed: case SP_MediaSeekBackward: | 0 | ||||||||||||||||||||||||
| 5356 | pixmap = QIcon::fromTheme(QLatin1String("media-seek-backward")).pixmap(16); | - | ||||||||||||||||||||||||
| 5357 | break; never executed: break; | 0 | ||||||||||||||||||||||||
| 5358 | case SP_MediaSkipForward: never executed: case SP_MediaSkipForward: | 0 | ||||||||||||||||||||||||
| 5359 | pixmap = QIcon::fromTheme(QLatin1String("media-skip-forward")).pixmap(16); | - | ||||||||||||||||||||||||
| 5360 | break; never executed: break; | 0 | ||||||||||||||||||||||||
| 5361 | case SP_MediaSkipBackward: never executed: case SP_MediaSkipBackward: | 0 | ||||||||||||||||||||||||
| 5362 | pixmap = QIcon::fromTheme(QLatin1String("media-skip-backward")).pixmap(16); | - | ||||||||||||||||||||||||
| 5363 | break; never executed: break; | 0 | ||||||||||||||||||||||||
| 5364 | case SP_DialogResetButton: never executed: case SP_DialogResetButton: | 0 | ||||||||||||||||||||||||
| 5365 | pixmap = QIcon::fromTheme(QLatin1String("edit-clear")).pixmap(24); | - | ||||||||||||||||||||||||
| 5366 | break; never executed: break; | 0 | ||||||||||||||||||||||||
| 5367 | case SP_DialogHelpButton: never executed: case SP_DialogHelpButton: | 0 | ||||||||||||||||||||||||
| 5368 | pixmap = QIcon::fromTheme(QLatin1String("help-contents")).pixmap(24); | - | ||||||||||||||||||||||||
| 5369 | break; never executed: break; | 0 | ||||||||||||||||||||||||
| 5370 | case SP_DialogNoButton: never executed: case SP_DialogNoButton: | 0 | ||||||||||||||||||||||||
| 5371 | case SP_DialogCancelButton: never executed: case SP_DialogCancelButton: | 0 | ||||||||||||||||||||||||
| 5372 | pixmap = QIcon::fromTheme(QLatin1String("dialog-cancel"), | - | ||||||||||||||||||||||||
| 5373 | QIcon::fromTheme(QLatin1String("process-stop"))).pixmap(24); | - | ||||||||||||||||||||||||
| 5374 | break; never executed: break; | 0 | ||||||||||||||||||||||||
| 5375 | case SP_DialogSaveButton: never executed: case SP_DialogSaveButton: | 0 | ||||||||||||||||||||||||
| 5376 | pixmap = QIcon::fromTheme(QLatin1String("document-save")).pixmap(24); | - | ||||||||||||||||||||||||
| 5377 | break; never executed: break; | 0 | ||||||||||||||||||||||||
| 5378 | case SP_FileLinkIcon: never executed: case SP_FileLinkIcon: | 0 | ||||||||||||||||||||||||
| 5379 | pixmap = QIcon::fromTheme(QLatin1String("emblem-symbolic-link")).pixmap(16); | - | ||||||||||||||||||||||||
| 5380 | if (!pixmap.isNull()) {
| 0 | ||||||||||||||||||||||||
| 5381 | QPixmap fileIcon = QIcon::fromTheme(QLatin1String("text-x-generic")).pixmap(16); | - | ||||||||||||||||||||||||
| 5382 | if (fileIcon.isNull())
| 0 | ||||||||||||||||||||||||
| 5383 | fileIcon = QIcon::fromTheme(QLatin1String("empty")).pixmap(16); never executed: fileIcon = QIcon::fromTheme(QLatin1String("empty")).pixmap(16); | 0 | ||||||||||||||||||||||||
| 5384 | if (!fileIcon.isNull()) {
| 0 | ||||||||||||||||||||||||
| 5385 | QPainter painter(&fileIcon); | - | ||||||||||||||||||||||||
| 5386 | painter.drawPixmap(0, 0, 16, 16, pixmap); | - | ||||||||||||||||||||||||
| 5387 | return fileIcon; never executed: return fileIcon; | 0 | ||||||||||||||||||||||||
| 5388 | } | - | ||||||||||||||||||||||||
| 5389 | } never executed: end of block | 0 | ||||||||||||||||||||||||
| 5390 | break; never executed: break; | 0 | ||||||||||||||||||||||||
| 5391 | case SP_DirLinkIcon: never executed: case SP_DirLinkIcon: | 0 | ||||||||||||||||||||||||
| 5392 | pixmap = QIcon::fromTheme(QLatin1String("emblem-symbolic-link")).pixmap(16); | - | ||||||||||||||||||||||||
| 5393 | if (!pixmap.isNull()) {
| 0 | ||||||||||||||||||||||||
| 5394 | QPixmap dirIcon = QIcon::fromTheme(QLatin1String("folder")).pixmap(16); | - | ||||||||||||||||||||||||
| 5395 | if (!dirIcon.isNull()) {
| 0 | ||||||||||||||||||||||||
| 5396 | QPainter painter(&dirIcon); | - | ||||||||||||||||||||||||
| 5397 | painter.drawPixmap(0, 0, 16, 16, pixmap); | - | ||||||||||||||||||||||||
| 5398 | return dirIcon; never executed: return dirIcon; | 0 | ||||||||||||||||||||||||
| 5399 | } | - | ||||||||||||||||||||||||
| 5400 | } never executed: end of block | 0 | ||||||||||||||||||||||||
| 5401 | break; never executed: break; | 0 | ||||||||||||||||||||||||
| 5402 | case SP_LineEditClearButton: never executed: case SP_LineEditClearButton: | 0 | ||||||||||||||||||||||||
| 5403 | pixmap = clearTextIcon(rtl).pixmap(16); | - | ||||||||||||||||||||||||
| 5404 | break; never executed: break; | 0 | ||||||||||||||||||||||||
| 5405 | default: never executed: default: | 0 | ||||||||||||||||||||||||
| 5406 | break; never executed: break; | 0 | ||||||||||||||||||||||||
| 5407 | } | - | ||||||||||||||||||||||||
| 5408 | } | - | ||||||||||||||||||||||||
| 5409 | - | |||||||||||||||||||||||||
| 5410 | if (!pixmap.isNull())
| 0 | ||||||||||||||||||||||||
| 5411 | return pixmap; never executed: return pixmap; | 0 | ||||||||||||||||||||||||
| 5412 | #endif //QT_NO_IMAGEFORMAT_PNG | - | ||||||||||||||||||||||||
| 5413 | switch (sp) { | - | ||||||||||||||||||||||||
| 5414 | #ifndef QT_NO_IMAGEFORMAT_XPM | - | ||||||||||||||||||||||||
| 5415 | case SP_ToolBarHorizontalExtensionButton: never executed: case SP_ToolBarHorizontalExtensionButton: | 0 | ||||||||||||||||||||||||
| 5416 | if (rtl) {
| 0 | ||||||||||||||||||||||||
| 5417 | QImage im(tb_extension_arrow_h_xpm); | - | ||||||||||||||||||||||||
| 5418 | im = im.convertToFormat(QImage::Format_ARGB32).mirrored(true, false); | - | ||||||||||||||||||||||||
| 5419 | return QPixmap::fromImage(im); never executed: return QPixmap::fromImage(im); | 0 | ||||||||||||||||||||||||
| 5420 | } | - | ||||||||||||||||||||||||
| 5421 | return cachedPixmapFromXPM(tb_extension_arrow_h_xpm); never executed: return cachedPixmapFromXPM(tb_extension_arrow_h_xpm); | 0 | ||||||||||||||||||||||||
| 5422 | case SP_ToolBarVerticalExtensionButton: never executed: case SP_ToolBarVerticalExtensionButton: | 0 | ||||||||||||||||||||||||
| 5423 | return cachedPixmapFromXPM(tb_extension_arrow_v_xpm); never executed: return cachedPixmapFromXPM(tb_extension_arrow_v_xpm); | 0 | ||||||||||||||||||||||||
| 5424 | case SP_FileDialogStart: never executed: case SP_FileDialogStart: | 0 | ||||||||||||||||||||||||
| 5425 | return cachedPixmapFromXPM(filedialog_start_xpm); never executed: return cachedPixmapFromXPM(filedialog_start_xpm); | 0 | ||||||||||||||||||||||||
| 5426 | case SP_FileDialogEnd: never executed: case SP_FileDialogEnd: | 0 | ||||||||||||||||||||||||
| 5427 | return cachedPixmapFromXPM(filedialog_end_xpm); never executed: return cachedPixmapFromXPM(filedialog_end_xpm); | 0 | ||||||||||||||||||||||||
| 5428 | #endif | - | ||||||||||||||||||||||||
| 5429 | #ifndef QT_NO_IMAGEFORMAT_PNG | - | ||||||||||||||||||||||||
| 5430 | case SP_CommandLink: never executed: case SP_CommandLink: | 0 | ||||||||||||||||||||||||
| 5431 | case SP_ArrowForward: never executed: case SP_ArrowForward: | 0 | ||||||||||||||||||||||||
| 5432 | if (rtl)
| 0 | ||||||||||||||||||||||||
| 5433 | return proxy()->standardPixmap(SP_ArrowLeft, option, widget); never executed: return proxy()->standardPixmap(SP_ArrowLeft, option, widget); | 0 | ||||||||||||||||||||||||
| 5434 | return proxy()->standardPixmap(SP_ArrowRight, option, widget); never executed: return proxy()->standardPixmap(SP_ArrowRight, option, widget); | 0 | ||||||||||||||||||||||||
| 5435 | case SP_ArrowBack: never executed: case SP_ArrowBack: | 0 | ||||||||||||||||||||||||
| 5436 | if (rtl)
| 0 | ||||||||||||||||||||||||
| 5437 | return proxy()->standardPixmap(SP_ArrowRight, option, widget); never executed: return proxy()->standardPixmap(SP_ArrowRight, option, widget); | 0 | ||||||||||||||||||||||||
| 5438 | return proxy()->standardPixmap(SP_ArrowLeft, option, widget); never executed: return proxy()->standardPixmap(SP_ArrowLeft, option, widget); | 0 | ||||||||||||||||||||||||
| 5439 | case SP_ArrowLeft: never executed: case SP_ArrowLeft: | 0 | ||||||||||||||||||||||||
| 5440 | return QPixmap(QLatin1String(":/qt-project.org/styles/commonstyle/images/left-16.png")); never executed: return QPixmap(QLatin1String(":/qt-project.org/styles/commonstyle/images/left-16.png")); | 0 | ||||||||||||||||||||||||
| 5441 | case SP_ArrowRight: never executed: case SP_ArrowRight: | 0 | ||||||||||||||||||||||||
| 5442 | return QPixmap(QLatin1String(":/qt-project.org/styles/commonstyle/images/right-16.png")); never executed: return QPixmap(QLatin1String(":/qt-project.org/styles/commonstyle/images/right-16.png")); | 0 | ||||||||||||||||||||||||
| 5443 | case SP_ArrowUp: never executed: case SP_ArrowUp: | 0 | ||||||||||||||||||||||||
| 5444 | return QPixmap(QLatin1String(":/qt-project.org/styles/commonstyle/images/up-16.png")); never executed: return QPixmap(QLatin1String(":/qt-project.org/styles/commonstyle/images/up-16.png")); | 0 | ||||||||||||||||||||||||
| 5445 | case SP_ArrowDown: never executed: case SP_ArrowDown: | 0 | ||||||||||||||||||||||||
| 5446 | return QPixmap(QLatin1String(":/qt-project.org/styles/commonstyle/images/down-16.png")); never executed: return QPixmap(QLatin1String(":/qt-project.org/styles/commonstyle/images/down-16.png")); | 0 | ||||||||||||||||||||||||
| 5447 | case SP_FileDialogToParent: never executed: case SP_FileDialogToParent: | 0 | ||||||||||||||||||||||||
| 5448 | return proxy()->standardPixmap(SP_ArrowUp, option, widget); never executed: return proxy()->standardPixmap(SP_ArrowUp, option, widget); | 0 | ||||||||||||||||||||||||
| 5449 | case SP_FileDialogNewFolder: never executed: case SP_FileDialogNewFolder: | 0 | ||||||||||||||||||||||||
| 5450 | return QPixmap(QLatin1String(":/qt-project.org/styles/commonstyle/images/newdirectory-16.png")); never executed: return QPixmap(QLatin1String(":/qt-project.org/styles/commonstyle/images/newdirectory-16.png")); | 0 | ||||||||||||||||||||||||
| 5451 | case SP_FileDialogDetailedView: never executed: case SP_FileDialogDetailedView: | 0 | ||||||||||||||||||||||||
| 5452 | return QPixmap(QLatin1String(":/qt-project.org/styles/commonstyle/images/viewdetailed-16.png")); never executed: return QPixmap(QLatin1String(":/qt-project.org/styles/commonstyle/images/viewdetailed-16.png")); | 0 | ||||||||||||||||||||||||
| 5453 | case SP_FileDialogInfoView: never executed: case SP_FileDialogInfoView: | 0 | ||||||||||||||||||||||||
| 5454 | return QPixmap(QLatin1String(":/qt-project.org/styles/commonstyle/images/fileinfo-16.png")); never executed: return QPixmap(QLatin1String(":/qt-project.org/styles/commonstyle/images/fileinfo-16.png")); | 0 | ||||||||||||||||||||||||
| 5455 | case SP_FileDialogContentsView: never executed: case SP_FileDialogContentsView: | 0 | ||||||||||||||||||||||||
| 5456 | return QPixmap(QLatin1String(":/qt-project.org/styles/commonstyle/images/filecontents-16.png")); never executed: return QPixmap(QLatin1String(":/qt-project.org/styles/commonstyle/images/filecontents-16.png")); | 0 | ||||||||||||||||||||||||
| 5457 | case SP_FileDialogListView: never executed: case SP_FileDialogListView: | 0 | ||||||||||||||||||||||||
| 5458 | return QPixmap(QLatin1String(":/qt-project.org/styles/commonstyle/images/viewlist-16.png")); never executed: return QPixmap(QLatin1String(":/qt-project.org/styles/commonstyle/images/viewlist-16.png")); | 0 | ||||||||||||||||||||||||
| 5459 | case SP_FileDialogBack: never executed: case SP_FileDialogBack: | 0 | ||||||||||||||||||||||||
| 5460 | return proxy()->standardPixmap(SP_ArrowBack, option, widget); never executed: return proxy()->standardPixmap(SP_ArrowBack, option, widget); | 0 | ||||||||||||||||||||||||
| 5461 | case SP_DriveHDIcon: never executed: case SP_DriveHDIcon: | 0 | ||||||||||||||||||||||||
| 5462 | return QPixmap(QLatin1String(":/qt-project.org/styles/commonstyle/images/harddrive-16.png")); never executed: return QPixmap(QLatin1String(":/qt-project.org/styles/commonstyle/images/harddrive-16.png")); | 0 | ||||||||||||||||||||||||
| 5463 | case SP_TrashIcon: never executed: case SP_TrashIcon: | 0 | ||||||||||||||||||||||||
| 5464 | return QPixmap(QLatin1String(":/qt-project.org/styles/commonstyle/images/trash-16.png")); never executed: return QPixmap(QLatin1String(":/qt-project.org/styles/commonstyle/images/trash-16.png")); | 0 | ||||||||||||||||||||||||
| 5465 | case SP_DriveFDIcon: never executed: case SP_DriveFDIcon: | 0 | ||||||||||||||||||||||||
| 5466 | return QPixmap(QLatin1String(":/qt-project.org/styles/commonstyle/images/floppy-16.png")); never executed: return QPixmap(QLatin1String(":/qt-project.org/styles/commonstyle/images/floppy-16.png")); | 0 | ||||||||||||||||||||||||
| 5467 | case SP_DriveNetIcon: never executed: case SP_DriveNetIcon: | 0 | ||||||||||||||||||||||||
| 5468 | return QPixmap(QLatin1String(":/qt-project.org/styles/commonstyle/images/networkdrive-16.png")); never executed: return QPixmap(QLatin1String(":/qt-project.org/styles/commonstyle/images/networkdrive-16.png")); | 0 | ||||||||||||||||||||||||
| 5469 | case SP_DesktopIcon: never executed: case SP_DesktopIcon: | 0 | ||||||||||||||||||||||||
| 5470 | return QPixmap(QLatin1String(":/qt-project.org/styles/commonstyle/images/desktop-16.png")); never executed: return QPixmap(QLatin1String(":/qt-project.org/styles/commonstyle/images/desktop-16.png")); | 0 | ||||||||||||||||||||||||
| 5471 | case SP_ComputerIcon: never executed: case SP_ComputerIcon: | 0 | ||||||||||||||||||||||||
| 5472 | return QPixmap(QLatin1String(":/qt-project.org/styles/commonstyle/images/computer-16.png")); never executed: return QPixmap(QLatin1String(":/qt-project.org/styles/commonstyle/images/computer-16.png")); | 0 | ||||||||||||||||||||||||
| 5473 | case SP_DriveCDIcon: never executed: case SP_DriveCDIcon: | 0 | ||||||||||||||||||||||||
| 5474 | return QPixmap(QLatin1String(":/qt-project.org/styles/commonstyle/images/cdr-16.png")); never executed: return QPixmap(QLatin1String(":/qt-project.org/styles/commonstyle/images/cdr-16.png")); | 0 | ||||||||||||||||||||||||
| 5475 | case SP_DriveDVDIcon: never executed: case SP_DriveDVDIcon: | 0 | ||||||||||||||||||||||||
| 5476 | return QPixmap(QLatin1String(":/qt-project.org/styles/commonstyle/images/dvd-16.png")); never executed: return QPixmap(QLatin1String(":/qt-project.org/styles/commonstyle/images/dvd-16.png")); | 0 | ||||||||||||||||||||||||
| 5477 | case SP_DirHomeIcon: never executed: case SP_DirHomeIcon: | 0 | ||||||||||||||||||||||||
| 5478 | case SP_DirOpenIcon: never executed: case SP_DirOpenIcon: | 0 | ||||||||||||||||||||||||
| 5479 | return QPixmap(QLatin1String(":/qt-project.org/styles/commonstyle/images/diropen-16.png")); never executed: return QPixmap(QLatin1String(":/qt-project.org/styles/commonstyle/images/diropen-16.png")); | 0 | ||||||||||||||||||||||||
| 5480 | case SP_DirIcon: never executed: case SP_DirIcon: | 0 | ||||||||||||||||||||||||
| 5481 | case SP_DirClosedIcon: never executed: case SP_DirClosedIcon: | 0 | ||||||||||||||||||||||||
| 5482 | return QPixmap(QLatin1String(":/qt-project.org/styles/commonstyle/images/dirclosed-16.png")); never executed: return QPixmap(QLatin1String(":/qt-project.org/styles/commonstyle/images/dirclosed-16.png")); | 0 | ||||||||||||||||||||||||
| 5483 | case SP_DirLinkIcon: never executed: case SP_DirLinkIcon: | 0 | ||||||||||||||||||||||||
| 5484 | return QPixmap(QLatin1String(":/qt-project.org/styles/commonstyle/images/dirlink-16.png")); never executed: return QPixmap(QLatin1String(":/qt-project.org/styles/commonstyle/images/dirlink-16.png")); | 0 | ||||||||||||||||||||||||
| 5485 | case SP_FileIcon: never executed: case SP_FileIcon: | 0 | ||||||||||||||||||||||||
| 5486 | return QPixmap(QLatin1String(":/qt-project.org/styles/commonstyle/images/file-16.png")); never executed: return QPixmap(QLatin1String(":/qt-project.org/styles/commonstyle/images/file-16.png")); | 0 | ||||||||||||||||||||||||
| 5487 | case SP_FileLinkIcon: never executed: case SP_FileLinkIcon: | 0 | ||||||||||||||||||||||||
| 5488 | return QPixmap(QLatin1String(":/qt-project.org/styles/commonstyle/images/filelink-16.png")); never executed: return QPixmap(QLatin1String(":/qt-project.org/styles/commonstyle/images/filelink-16.png")); | 0 | ||||||||||||||||||||||||
| 5489 | case SP_DialogOkButton: never executed: case SP_DialogOkButton: | 0 | ||||||||||||||||||||||||
| 5490 | return QPixmap(QLatin1String(":/qt-project.org/styles/commonstyle/images/standardbutton-ok-16.png")); never executed: return QPixmap(QLatin1String(":/qt-project.org/styles/commonstyle/images/standardbutton-ok-16.png")); | 0 | ||||||||||||||||||||||||
| 5491 | case SP_DialogCancelButton: never executed: case SP_DialogCancelButton: | 0 | ||||||||||||||||||||||||
| 5492 | return QPixmap(QLatin1String(":/qt-project.org/styles/commonstyle/images/standardbutton-cancel-16.png")); never executed: return QPixmap(QLatin1String(":/qt-project.org/styles/commonstyle/images/standardbutton-cancel-16.png")); | 0 | ||||||||||||||||||||||||
| 5493 | case SP_DialogHelpButton: never executed: case SP_DialogHelpButton: | 0 | ||||||||||||||||||||||||
| 5494 | return QPixmap(QLatin1String(":/qt-project.org/styles/commonstyle/images/standardbutton-help-16.png")); never executed: return QPixmap(QLatin1String(":/qt-project.org/styles/commonstyle/images/standardbutton-help-16.png")); | 0 | ||||||||||||||||||||||||
| 5495 | case SP_DialogOpenButton: never executed: case SP_DialogOpenButton: | 0 | ||||||||||||||||||||||||
| 5496 | return QPixmap(QLatin1String(":/qt-project.org/styles/commonstyle/images/standardbutton-open-16.png")); never executed: return QPixmap(QLatin1String(":/qt-project.org/styles/commonstyle/images/standardbutton-open-16.png")); | 0 | ||||||||||||||||||||||||
| 5497 | case SP_DialogSaveButton: never executed: case SP_DialogSaveButton: | 0 | ||||||||||||||||||||||||
| 5498 | return QPixmap(QLatin1String(":/qt-project.org/styles/commonstyle/images/standardbutton-save-16.png")); never executed: return QPixmap(QLatin1String(":/qt-project.org/styles/commonstyle/images/standardbutton-save-16.png")); | 0 | ||||||||||||||||||||||||
| 5499 | case SP_DialogCloseButton: never executed: case SP_DialogCloseButton: | 0 | ||||||||||||||||||||||||
| 5500 | return QPixmap(QLatin1String(":/qt-project.org/styles/commonstyle/images/standardbutton-close-16.png")); never executed: return QPixmap(QLatin1String(":/qt-project.org/styles/commonstyle/images/standardbutton-close-16.png")); | 0 | ||||||||||||||||||||||||
| 5501 | case SP_DialogApplyButton: never executed: case SP_DialogApplyButton: | 0 | ||||||||||||||||||||||||
| 5502 | return QPixmap(QLatin1String(":/qt-project.org/styles/commonstyle/images/standardbutton-apply-16.png")); never executed: return QPixmap(QLatin1String(":/qt-project.org/styles/commonstyle/images/standardbutton-apply-16.png")); | 0 | ||||||||||||||||||||||||
| 5503 | case SP_DialogResetButton: never executed: case SP_DialogResetButton: | 0 | ||||||||||||||||||||||||
| 5504 | return QPixmap(QLatin1String(":/qt-project.org/styles/commonstyle/images/standardbutton-clear-16.png")); never executed: return QPixmap(QLatin1String(":/qt-project.org/styles/commonstyle/images/standardbutton-clear-16.png")); | 0 | ||||||||||||||||||||||||
| 5505 | case SP_DialogDiscardButton: never executed: case SP_DialogDiscardButton: | 0 | ||||||||||||||||||||||||
| 5506 | return QPixmap(QLatin1String(":/qt-project.org/styles/commonstyle/images/standardbutton-delete-16.png")); never executed: return QPixmap(QLatin1String(":/qt-project.org/styles/commonstyle/images/standardbutton-delete-16.png")); | 0 | ||||||||||||||||||||||||
| 5507 | case SP_DialogYesButton: never executed: case SP_DialogYesButton: | 0 | ||||||||||||||||||||||||
| 5508 | return QPixmap(QLatin1String(":/qt-project.org/styles/commonstyle/images/standardbutton-yes-16.png")); never executed: return QPixmap(QLatin1String(":/qt-project.org/styles/commonstyle/images/standardbutton-yes-16.png")); | 0 | ||||||||||||||||||||||||
| 5509 | case SP_DialogNoButton: never executed: case SP_DialogNoButton: | 0 | ||||||||||||||||||||||||
| 5510 | return QPixmap(QLatin1String(":/qt-project.org/styles/commonstyle/images/standardbutton-no-16.png")); never executed: return QPixmap(QLatin1String(":/qt-project.org/styles/commonstyle/images/standardbutton-no-16.png")); | 0 | ||||||||||||||||||||||||
| 5511 | case SP_BrowserReload: never executed: case SP_BrowserReload: | 0 | ||||||||||||||||||||||||
| 5512 | return QPixmap(QLatin1String(":/qt-project.org/styles/commonstyle/images/refresh-24.png")); never executed: return QPixmap(QLatin1String(":/qt-project.org/styles/commonstyle/images/refresh-24.png")); | 0 | ||||||||||||||||||||||||
| 5513 | case SP_BrowserStop: never executed: case SP_BrowserStop: | 0 | ||||||||||||||||||||||||
| 5514 | return QPixmap(QLatin1String(":/qt-project.org/styles/commonstyle/images/stop-24.png")); never executed: return QPixmap(QLatin1String(":/qt-project.org/styles/commonstyle/images/stop-24.png")); | 0 | ||||||||||||||||||||||||
| 5515 | case SP_MediaPlay: never executed: case SP_MediaPlay: | 0 | ||||||||||||||||||||||||
| 5516 | return QPixmap(QLatin1String(":/qt-project.org/styles/commonstyle/images/media-play-32.png")); never executed: return QPixmap(QLatin1String(":/qt-project.org/styles/commonstyle/images/media-play-32.png")); | 0 | ||||||||||||||||||||||||
| 5517 | case SP_MediaPause: never executed: case SP_MediaPause: | 0 | ||||||||||||||||||||||||
| 5518 | return QPixmap(QLatin1String(":/qt-project.org/styles/commonstyle/images/media-pause-32.png")); never executed: return QPixmap(QLatin1String(":/qt-project.org/styles/commonstyle/images/media-pause-32.png")); | 0 | ||||||||||||||||||||||||
| 5519 | case SP_MediaStop: never executed: case SP_MediaStop: | 0 | ||||||||||||||||||||||||
| 5520 | return QPixmap(QLatin1String(":/qt-project.org/styles/commonstyle/images/media-stop-32.png")); never executed: return QPixmap(QLatin1String(":/qt-project.org/styles/commonstyle/images/media-stop-32.png")); | 0 | ||||||||||||||||||||||||
| 5521 | case SP_MediaSeekForward: never executed: case SP_MediaSeekForward: | 0 | ||||||||||||||||||||||||
| 5522 | return QPixmap(QLatin1String(":/qt-project.org/styles/commonstyle/images/media-seek-forward-32.png")); never executed: return QPixmap(QLatin1String(":/qt-project.org/styles/commonstyle/images/media-seek-forward-32.png")); | 0 | ||||||||||||||||||||||||
| 5523 | case SP_MediaSeekBackward: never executed: case SP_MediaSeekBackward: | 0 | ||||||||||||||||||||||||
| 5524 | return QPixmap(QLatin1String(":/qt-project.org/styles/commonstyle/images/media-seek-backward-32.png")); never executed: return QPixmap(QLatin1String(":/qt-project.org/styles/commonstyle/images/media-seek-backward-32.png")); | 0 | ||||||||||||||||||||||||
| 5525 | case SP_MediaSkipForward: never executed: case SP_MediaSkipForward: | 0 | ||||||||||||||||||||||||
| 5526 | return QPixmap(QLatin1String(":/qt-project.org/styles/commonstyle/images/media-skip-forward-32.png")); never executed: return QPixmap(QLatin1String(":/qt-project.org/styles/commonstyle/images/media-skip-forward-32.png")); | 0 | ||||||||||||||||||||||||
| 5527 | case SP_MediaSkipBackward: never executed: case SP_MediaSkipBackward: | 0 | ||||||||||||||||||||||||
| 5528 | return QPixmap(QLatin1String(":/qt-project.org/styles/commonstyle/images/media-skip-backward-32.png")); never executed: return QPixmap(QLatin1String(":/qt-project.org/styles/commonstyle/images/media-skip-backward-32.png")); | 0 | ||||||||||||||||||||||||
| 5529 | case SP_MediaVolume: never executed: case SP_MediaVolume: | 0 | ||||||||||||||||||||||||
| 5530 | return QPixmap(QLatin1String(":/qt-project.org/styles/commonstyle/images/media-volume-16.png")); never executed: return QPixmap(QLatin1String(":/qt-project.org/styles/commonstyle/images/media-volume-16.png")); | 0 | ||||||||||||||||||||||||
| 5531 | case SP_MediaVolumeMuted: never executed: case SP_MediaVolumeMuted: | 0 | ||||||||||||||||||||||||
| 5532 | return QPixmap(QLatin1String(":/qt-project.org/styles/commonstyle/images/media-volume-muted-16.png")); never executed: return QPixmap(QLatin1String(":/qt-project.org/styles/commonstyle/images/media-volume-muted-16.png")); | 0 | ||||||||||||||||||||||||
| 5533 | case SP_LineEditClearButton: never executed: case SP_LineEditClearButton: | 0 | ||||||||||||||||||||||||
| 5534 | return QPixmap(clearText16IconPath()); never executed: return QPixmap(clearText16IconPath()); | 0 | ||||||||||||||||||||||||
| 5535 | #endif // QT_NO_IMAGEFORMAT_PNG | - | ||||||||||||||||||||||||
| 5536 | default: never executed: default: | 0 | ||||||||||||||||||||||||
| 5537 | break; never executed: break; | 0 | ||||||||||||||||||||||||
| 5538 | } | - | ||||||||||||||||||||||||
| 5539 | - | |||||||||||||||||||||||||
| 5540 | #ifndef QT_NO_IMAGEFORMAT_XPM | - | ||||||||||||||||||||||||
| 5541 | switch (sp) { | - | ||||||||||||||||||||||||
| 5542 | case SP_TitleBarMenuButton: never executed: case SP_TitleBarMenuButton: | 0 | ||||||||||||||||||||||||
| 5543 | return titleBarMenuCachedPixmapFromXPM(); never executed: return titleBarMenuCachedPixmapFromXPM(); | 0 | ||||||||||||||||||||||||
| 5544 | case SP_TitleBarShadeButton: never executed: case SP_TitleBarShadeButton: | 0 | ||||||||||||||||||||||||
| 5545 | return cachedPixmapFromXPM(qt_shade_xpm); never executed: return cachedPixmapFromXPM(qt_shade_xpm); | 0 | ||||||||||||||||||||||||
| 5546 | case SP_TitleBarUnshadeButton: never executed: case SP_TitleBarUnshadeButton: | 0 | ||||||||||||||||||||||||
| 5547 | return cachedPixmapFromXPM(qt_unshade_xpm); never executed: return cachedPixmapFromXPM(qt_unshade_xpm); | 0 | ||||||||||||||||||||||||
| 5548 | case SP_TitleBarNormalButton: never executed: case SP_TitleBarNormalButton: | 0 | ||||||||||||||||||||||||
| 5549 | return cachedPixmapFromXPM(qt_normalizeup_xpm); never executed: return cachedPixmapFromXPM(qt_normalizeup_xpm); | 0 | ||||||||||||||||||||||||
| 5550 | case SP_TitleBarMinButton: never executed: case SP_TitleBarMinButton: | 0 | ||||||||||||||||||||||||
| 5551 | return cachedPixmapFromXPM(qt_minimize_xpm); never executed: return cachedPixmapFromXPM(qt_minimize_xpm); | 0 | ||||||||||||||||||||||||
| 5552 | case SP_TitleBarMaxButton: never executed: case SP_TitleBarMaxButton: | 0 | ||||||||||||||||||||||||
| 5553 | return cachedPixmapFromXPM(qt_maximize_xpm); never executed: return cachedPixmapFromXPM(qt_maximize_xpm); | 0 | ||||||||||||||||||||||||
| 5554 | case SP_TitleBarCloseButton: never executed: case SP_TitleBarCloseButton: | 0 | ||||||||||||||||||||||||
| 5555 | return cachedPixmapFromXPM(qt_close_xpm); never executed: return cachedPixmapFromXPM(qt_close_xpm); | 0 | ||||||||||||||||||||||||
| 5556 | case SP_TitleBarContextHelpButton: never executed: case SP_TitleBarContextHelpButton: | 0 | ||||||||||||||||||||||||
| 5557 | return cachedPixmapFromXPM(qt_help_xpm); never executed: return cachedPixmapFromXPM(qt_help_xpm); | 0 | ||||||||||||||||||||||||
| 5558 | case SP_DockWidgetCloseButton: never executed: case SP_DockWidgetCloseButton: | 0 | ||||||||||||||||||||||||
| 5559 | return cachedPixmapFromXPM(dock_widget_close_xpm); never executed: return cachedPixmapFromXPM(dock_widget_close_xpm); | 0 | ||||||||||||||||||||||||
| 5560 | case SP_MessageBoxInformation: never executed: case SP_MessageBoxInformation: | 0 | ||||||||||||||||||||||||
| 5561 | return cachedPixmapFromXPM(information_xpm); never executed: return cachedPixmapFromXPM(information_xpm); | 0 | ||||||||||||||||||||||||
| 5562 | case SP_MessageBoxWarning: never executed: case SP_MessageBoxWarning: | 0 | ||||||||||||||||||||||||
| 5563 | return cachedPixmapFromXPM(warning_xpm); never executed: return cachedPixmapFromXPM(warning_xpm); | 0 | ||||||||||||||||||||||||
| 5564 | case SP_MessageBoxCritical: never executed: case SP_MessageBoxCritical: | 0 | ||||||||||||||||||||||||
| 5565 | return cachedPixmapFromXPM(critical_xpm); never executed: return cachedPixmapFromXPM(critical_xpm); | 0 | ||||||||||||||||||||||||
| 5566 | case SP_MessageBoxQuestion: never executed: case SP_MessageBoxQuestion: | 0 | ||||||||||||||||||||||||
| 5567 | return cachedPixmapFromXPM(question_xpm); never executed: return cachedPixmapFromXPM(question_xpm); | 0 | ||||||||||||||||||||||||
| 5568 | default: never executed: default: | 0 | ||||||||||||||||||||||||
| 5569 | break; never executed: break; | 0 | ||||||||||||||||||||||||
| 5570 | } | - | ||||||||||||||||||||||||
| 5571 | #endif //QT_NO_IMAGEFORMAT_XPM | - | ||||||||||||||||||||||||
| 5572 | - | |||||||||||||||||||||||||
| 5573 | - | |||||||||||||||||||||||||
| 5574 | return QPixmap(); never executed: return QPixmap(); | 0 | ||||||||||||||||||||||||
| 5575 | } | - | ||||||||||||||||||||||||
| 5576 | - | |||||||||||||||||||||||||
| 5577 | /*! | - | ||||||||||||||||||||||||
| 5578 | \internal | - | ||||||||||||||||||||||||
| 5579 | */ | - | ||||||||||||||||||||||||
| 5580 | QIcon QCommonStyle::standardIcon(StandardPixmap standardIcon, const QStyleOption *option, | - | ||||||||||||||||||||||||
| 5581 | const QWidget *widget) const | - | ||||||||||||||||||||||||
| 5582 | { | - | ||||||||||||||||||||||||
| 5583 | QIcon icon; | - | ||||||||||||||||||||||||
| 5584 | const bool rtl = (option && option->direction == Qt::RightToLeft) || (!option && QApplication::isRightToLeft());
| 0 | ||||||||||||||||||||||||
| 5585 | - | |||||||||||||||||||||||||
| 5586 | #ifdef Q_OS_WIN | - | ||||||||||||||||||||||||
| 5587 | switch (standardIcon) { | - | ||||||||||||||||||||||||
| 5588 | case SP_DriveCDIcon: | - | ||||||||||||||||||||||||
| 5589 | case SP_DriveDVDIcon: | - | ||||||||||||||||||||||||
| 5590 | case SP_DriveNetIcon: | - | ||||||||||||||||||||||||
| 5591 | case SP_DriveHDIcon: | - | ||||||||||||||||||||||||
| 5592 | case SP_DriveFDIcon: | - | ||||||||||||||||||||||||
| 5593 | case SP_FileIcon: | - | ||||||||||||||||||||||||
| 5594 | case SP_FileLinkIcon: | - | ||||||||||||||||||||||||
| 5595 | case SP_DesktopIcon: | - | ||||||||||||||||||||||||
| 5596 | case SP_ComputerIcon: | - | ||||||||||||||||||||||||
| 5597 | if (const QPlatformTheme *theme = QGuiApplicationPrivate::platformTheme()) { | - | ||||||||||||||||||||||||
| 5598 | QPlatformTheme::StandardPixmap sp = static_cast<QPlatformTheme::StandardPixmap>(standardIcon); | - | ||||||||||||||||||||||||
| 5599 | for (int size = 16 ; size <= 32 ; size += 16) { | - | ||||||||||||||||||||||||
| 5600 | QPixmap pixmap = theme->standardPixmap(sp, QSizeF(size, size)); | - | ||||||||||||||||||||||||
| 5601 | icon.addPixmap(pixmap, QIcon::Normal); | - | ||||||||||||||||||||||||
| 5602 | } | - | ||||||||||||||||||||||||
| 5603 | } | - | ||||||||||||||||||||||||
| 5604 | break; | - | ||||||||||||||||||||||||
| 5605 | case SP_DirIcon: | - | ||||||||||||||||||||||||
| 5606 | case SP_DirLinkIcon: | - | ||||||||||||||||||||||||
| 5607 | if (const QPlatformTheme *theme = QGuiApplicationPrivate::platformTheme()) { | - | ||||||||||||||||||||||||
| 5608 | QPlatformTheme::StandardPixmap spOff = static_cast<QPlatformTheme::StandardPixmap>(standardIcon); | - | ||||||||||||||||||||||||
| 5609 | QPlatformTheme::StandardPixmap spOn = standardIcon == SP_DirIcon ? QPlatformTheme::DirOpenIcon : | - | ||||||||||||||||||||||||
| 5610 | QPlatformTheme::DirLinkOpenIcon; | - | ||||||||||||||||||||||||
| 5611 | for (int size = 16 ; size <= 32 ; size += 16) { | - | ||||||||||||||||||||||||
| 5612 | QSizeF pixSize(size, size); | - | ||||||||||||||||||||||||
| 5613 | QPixmap pixmap = theme->standardPixmap(spOff, pixSize); | - | ||||||||||||||||||||||||
| 5614 | icon.addPixmap(pixmap, QIcon::Normal, QIcon::Off); | - | ||||||||||||||||||||||||
| 5615 | pixmap = theme->standardPixmap(spOn, pixSize); | - | ||||||||||||||||||||||||
| 5616 | icon.addPixmap(pixmap, QIcon::Normal, QIcon::On); | - | ||||||||||||||||||||||||
| 5617 | } | - | ||||||||||||||||||||||||
| 5618 | } | - | ||||||||||||||||||||||||
| 5619 | break; | - | ||||||||||||||||||||||||
| 5620 | case SP_VistaShield: | - | ||||||||||||||||||||||||
| 5621 | if (const QPlatformTheme *theme = QGuiApplicationPrivate::platformTheme()) { | - | ||||||||||||||||||||||||
| 5622 | QPlatformTheme::StandardPixmap sp = static_cast<QPlatformTheme::StandardPixmap>(standardIcon); | - | ||||||||||||||||||||||||
| 5623 | QPixmap pixmap = theme->standardPixmap(sp, QSizeF(32, 32)); | - | ||||||||||||||||||||||||
| 5624 | icon.addPixmap(pixmap); | - | ||||||||||||||||||||||||
| 5625 | } | - | ||||||||||||||||||||||||
| 5626 | break; | - | ||||||||||||||||||||||||
| 5627 | case SP_LineEditClearButton: | - | ||||||||||||||||||||||||
| 5628 | icon = clearTextIcon(rtl); | - | ||||||||||||||||||||||||
| 5629 | break; | - | ||||||||||||||||||||||||
| 5630 | default: | - | ||||||||||||||||||||||||
| 5631 | break; | - | ||||||||||||||||||||||||
| 5632 | } | - | ||||||||||||||||||||||||
| 5633 | if (!icon.isNull()) | - | ||||||||||||||||||||||||
| 5634 | return icon; | - | ||||||||||||||||||||||||
| 5635 | - | |||||||||||||||||||||||||
| 5636 | #endif | - | ||||||||||||||||||||||||
| 5637 | - | |||||||||||||||||||||||||
| 5638 | if (QApplication::desktopSettingsAware() && !QIcon::themeName().isEmpty()) {
| 0 | ||||||||||||||||||||||||
| 5639 | switch (standardIcon) { | - | ||||||||||||||||||||||||
| 5640 | case SP_DirHomeIcon: never executed: case SP_DirHomeIcon: | 0 | ||||||||||||||||||||||||
| 5641 | icon = QIcon::fromTheme(QLatin1String("user-home")); | - | ||||||||||||||||||||||||
| 5642 | break; never executed: break; | 0 | ||||||||||||||||||||||||
| 5643 | case SP_MessageBoxInformation: never executed: case SP_MessageBoxInformation: | 0 | ||||||||||||||||||||||||
| 5644 | icon = QIcon::fromTheme(QLatin1String("dialog-information")); | - | ||||||||||||||||||||||||
| 5645 | break; never executed: break; | 0 | ||||||||||||||||||||||||
| 5646 | case SP_MessageBoxWarning: never executed: case SP_MessageBoxWarning: | 0 | ||||||||||||||||||||||||
| 5647 | icon = QIcon::fromTheme(QLatin1String("dialog-warning")); | - | ||||||||||||||||||||||||
| 5648 | break; never executed: break; | 0 | ||||||||||||||||||||||||
| 5649 | case SP_MessageBoxCritical: never executed: case SP_MessageBoxCritical: | 0 | ||||||||||||||||||||||||
| 5650 | icon = QIcon::fromTheme(QLatin1String("dialog-error")); | - | ||||||||||||||||||||||||
| 5651 | break; never executed: break; | 0 | ||||||||||||||||||||||||
| 5652 | case SP_MessageBoxQuestion: never executed: case SP_MessageBoxQuestion: | 0 | ||||||||||||||||||||||||
| 5653 | icon = QIcon::fromTheme(QLatin1String("dialog-question")); | - | ||||||||||||||||||||||||
| 5654 | break; never executed: break; | 0 | ||||||||||||||||||||||||
| 5655 | case SP_DialogOpenButton: never executed: case SP_DialogOpenButton: | 0 | ||||||||||||||||||||||||
| 5656 | case SP_DirOpenIcon: never executed: case SP_DirOpenIcon: | 0 | ||||||||||||||||||||||||
| 5657 | icon = QIcon::fromTheme(QLatin1String("folder-open")); | - | ||||||||||||||||||||||||
| 5658 | break; never executed: break; | 0 | ||||||||||||||||||||||||
| 5659 | case SP_DialogSaveButton: never executed: case SP_DialogSaveButton: | 0 | ||||||||||||||||||||||||
| 5660 | icon = QIcon::fromTheme(QLatin1String("document-save")); | - | ||||||||||||||||||||||||
| 5661 | break; never executed: break; | 0 | ||||||||||||||||||||||||
| 5662 | case SP_DialogApplyButton: never executed: case SP_DialogApplyButton: | 0 | ||||||||||||||||||||||||
| 5663 | icon = QIcon::fromTheme(QLatin1String("dialog-ok-apply")); | - | ||||||||||||||||||||||||
| 5664 | break; never executed: break; | 0 | ||||||||||||||||||||||||
| 5665 | case SP_DialogYesButton: never executed: case SP_DialogYesButton: | 0 | ||||||||||||||||||||||||
| 5666 | case SP_DialogOkButton: never executed: case SP_DialogOkButton: | 0 | ||||||||||||||||||||||||
| 5667 | icon = QIcon::fromTheme(QLatin1String("dialog-ok")); | - | ||||||||||||||||||||||||
| 5668 | break; never executed: break; | 0 | ||||||||||||||||||||||||
| 5669 | case SP_DialogDiscardButton: never executed: case SP_DialogDiscardButton: | 0 | ||||||||||||||||||||||||
| 5670 | icon = QIcon::fromTheme(QLatin1String("edit-delete")); | - | ||||||||||||||||||||||||
| 5671 | break; never executed: break; | 0 | ||||||||||||||||||||||||
| 5672 | case SP_DialogResetButton: never executed: case SP_DialogResetButton: | 0 | ||||||||||||||||||||||||
| 5673 | icon = QIcon::fromTheme(QLatin1String("edit-clear")); | - | ||||||||||||||||||||||||
| 5674 | break; never executed: break; | 0 | ||||||||||||||||||||||||
| 5675 | case SP_DialogHelpButton: never executed: case SP_DialogHelpButton: | 0 | ||||||||||||||||||||||||
| 5676 | icon = QIcon::fromTheme(QLatin1String("help-contents")); | - | ||||||||||||||||||||||||
| 5677 | break; never executed: break; | 0 | ||||||||||||||||||||||||
| 5678 | case SP_FileIcon: never executed: case SP_FileIcon: | 0 | ||||||||||||||||||||||||
| 5679 | icon = QIcon::fromTheme(QLatin1String("text-x-generic")); | - | ||||||||||||||||||||||||
| 5680 | break; never executed: break; | 0 | ||||||||||||||||||||||||
| 5681 | case SP_DirClosedIcon: never executed: case SP_DirClosedIcon: | 0 | ||||||||||||||||||||||||
| 5682 | case SP_DirIcon: never executed: case SP_DirIcon: | 0 | ||||||||||||||||||||||||
| 5683 | icon = QIcon::fromTheme(QLatin1String("folder")); | - | ||||||||||||||||||||||||
| 5684 | break; never executed: break; | 0 | ||||||||||||||||||||||||
| 5685 | case SP_DriveFDIcon: never executed: case SP_DriveFDIcon: | 0 | ||||||||||||||||||||||||
| 5686 | icon = QIcon::fromTheme(QLatin1String("floppy_unmount")); | - | ||||||||||||||||||||||||
| 5687 | break; never executed: break; | 0 | ||||||||||||||||||||||||
| 5688 | case SP_ComputerIcon: never executed: case SP_ComputerIcon: | 0 | ||||||||||||||||||||||||
| 5689 | icon = QIcon::fromTheme(QLatin1String("computer"), | - | ||||||||||||||||||||||||
| 5690 | QIcon::fromTheme(QLatin1String("system"))); | - | ||||||||||||||||||||||||
| 5691 | break; never executed: break; | 0 | ||||||||||||||||||||||||
| 5692 | case SP_DesktopIcon: never executed: case SP_DesktopIcon: | 0 | ||||||||||||||||||||||||
| 5693 | icon = QIcon::fromTheme(QLatin1String("user-desktop")); | - | ||||||||||||||||||||||||
| 5694 | break; never executed: break; | 0 | ||||||||||||||||||||||||
| 5695 | case SP_TrashIcon: never executed: case SP_TrashIcon: | 0 | ||||||||||||||||||||||||
| 5696 | icon = QIcon::fromTheme(QLatin1String("user-trash")); | - | ||||||||||||||||||||||||
| 5697 | break; never executed: break; | 0 | ||||||||||||||||||||||||
| 5698 | case SP_DriveCDIcon: never executed: case SP_DriveCDIcon: | 0 | ||||||||||||||||||||||||
| 5699 | case SP_DriveDVDIcon: never executed: case SP_DriveDVDIcon: | 0 | ||||||||||||||||||||||||
| 5700 | icon = QIcon::fromTheme(QLatin1String("media-optical")); | - | ||||||||||||||||||||||||
| 5701 | break; never executed: break; | 0 | ||||||||||||||||||||||||
| 5702 | case SP_DriveHDIcon: never executed: case SP_DriveHDIcon: | 0 | ||||||||||||||||||||||||
| 5703 | icon = QIcon::fromTheme(QLatin1String("drive-harddisk")); | - | ||||||||||||||||||||||||
| 5704 | break; never executed: break; | 0 | ||||||||||||||||||||||||
| 5705 | case SP_FileDialogToParent: never executed: case SP_FileDialogToParent: | 0 | ||||||||||||||||||||||||
| 5706 | icon = QIcon::fromTheme(QLatin1String("go-up")); | - | ||||||||||||||||||||||||
| 5707 | break; never executed: break; | 0 | ||||||||||||||||||||||||
| 5708 | case SP_FileDialogNewFolder: never executed: case SP_FileDialogNewFolder: | 0 | ||||||||||||||||||||||||
| 5709 | icon = QIcon::fromTheme(QLatin1String("folder-new")); | - | ||||||||||||||||||||||||
| 5710 | break; never executed: break; | 0 | ||||||||||||||||||||||||
| 5711 | case SP_ArrowUp: never executed: case SP_ArrowUp: | 0 | ||||||||||||||||||||||||
| 5712 | icon = QIcon::fromTheme(QLatin1String("go-up")); | - | ||||||||||||||||||||||||
| 5713 | break; never executed: break; | 0 | ||||||||||||||||||||||||
| 5714 | case SP_ArrowDown: never executed: case SP_ArrowDown: | 0 | ||||||||||||||||||||||||
| 5715 | icon = QIcon::fromTheme(QLatin1String("go-down")); | - | ||||||||||||||||||||||||
| 5716 | break; never executed: break; | 0 | ||||||||||||||||||||||||
| 5717 | case SP_ArrowRight: never executed: case SP_ArrowRight: | 0 | ||||||||||||||||||||||||
| 5718 | icon = QIcon::fromTheme(QLatin1String("go-next")); | - | ||||||||||||||||||||||||
| 5719 | break; never executed: break; | 0 | ||||||||||||||||||||||||
| 5720 | case SP_ArrowLeft: never executed: case SP_ArrowLeft: | 0 | ||||||||||||||||||||||||
| 5721 | icon = QIcon::fromTheme(QLatin1String("go-previous")); | - | ||||||||||||||||||||||||
| 5722 | break; never executed: break; | 0 | ||||||||||||||||||||||||
| 5723 | case SP_DialogCancelButton: never executed: case SP_DialogCancelButton: | 0 | ||||||||||||||||||||||||
| 5724 | icon = QIcon::fromTheme(QLatin1String("dialog-cancel"), | - | ||||||||||||||||||||||||
| 5725 | QIcon::fromTheme(QLatin1String("process-stop"))); | - | ||||||||||||||||||||||||
| 5726 | break; never executed: break; | 0 | ||||||||||||||||||||||||
| 5727 | case SP_DialogCloseButton: never executed: case SP_DialogCloseButton: | 0 | ||||||||||||||||||||||||
| 5728 | icon = QIcon::fromTheme(QLatin1String("window-close")); | - | ||||||||||||||||||||||||
| 5729 | break; never executed: break; | 0 | ||||||||||||||||||||||||
| 5730 | case SP_FileDialogDetailedView: never executed: case SP_FileDialogDetailedView: | 0 | ||||||||||||||||||||||||
| 5731 | icon = QIcon::fromTheme(QLatin1String("view-list-details")); | - | ||||||||||||||||||||||||
| 5732 | break; never executed: break; | 0 | ||||||||||||||||||||||||
| 5733 | case SP_FileDialogListView: never executed: case SP_FileDialogListView: | 0 | ||||||||||||||||||||||||
| 5734 | icon = QIcon::fromTheme(QLatin1String("view-list-icons")); | - | ||||||||||||||||||||||||
| 5735 | break; never executed: break; | 0 | ||||||||||||||||||||||||
| 5736 | case SP_BrowserReload: never executed: case SP_BrowserReload: | 0 | ||||||||||||||||||||||||
| 5737 | icon = QIcon::fromTheme(QLatin1String("view-refresh")); | - | ||||||||||||||||||||||||
| 5738 | break; never executed: break; | 0 | ||||||||||||||||||||||||
| 5739 | case SP_BrowserStop: never executed: case SP_BrowserStop: | 0 | ||||||||||||||||||||||||
| 5740 | icon = QIcon::fromTheme(QLatin1String("process-stop")); | - | ||||||||||||||||||||||||
| 5741 | break; never executed: break; | 0 | ||||||||||||||||||||||||
| 5742 | case SP_MediaPlay: never executed: case SP_MediaPlay: | 0 | ||||||||||||||||||||||||
| 5743 | icon = QIcon::fromTheme(QLatin1String("media-playback-start")); | - | ||||||||||||||||||||||||
| 5744 | break; never executed: break; | 0 | ||||||||||||||||||||||||
| 5745 | case SP_MediaPause: never executed: case SP_MediaPause: | 0 | ||||||||||||||||||||||||
| 5746 | icon = QIcon::fromTheme(QLatin1String("media-playback-pause")); | - | ||||||||||||||||||||||||
| 5747 | break; never executed: break; | 0 | ||||||||||||||||||||||||
| 5748 | case SP_MediaStop: never executed: case SP_MediaStop: | 0 | ||||||||||||||||||||||||
| 5749 | icon = QIcon::fromTheme(QLatin1String("media-playback-stop")); | - | ||||||||||||||||||||||||
| 5750 | break; never executed: break; | 0 | ||||||||||||||||||||||||
| 5751 | case SP_MediaSeekForward: never executed: case SP_MediaSeekForward: | 0 | ||||||||||||||||||||||||
| 5752 | icon = QIcon::fromTheme(QLatin1String("media-seek-forward")); | - | ||||||||||||||||||||||||
| 5753 | break; never executed: break; | 0 | ||||||||||||||||||||||||
| 5754 | case SP_MediaSeekBackward: never executed: case SP_MediaSeekBackward: | 0 | ||||||||||||||||||||||||
| 5755 | icon = QIcon::fromTheme(QLatin1String("media-seek-backward")); | - | ||||||||||||||||||||||||
| 5756 | break; never executed: break; | 0 | ||||||||||||||||||||||||
| 5757 | case SP_MediaSkipForward: never executed: case SP_MediaSkipForward: | 0 | ||||||||||||||||||||||||
| 5758 | icon = QIcon::fromTheme(QLatin1String("media-skip-forward")); | - | ||||||||||||||||||||||||
| 5759 | break; never executed: break; | 0 | ||||||||||||||||||||||||
| 5760 | case SP_MediaSkipBackward: never executed: case SP_MediaSkipBackward: | 0 | ||||||||||||||||||||||||
| 5761 | icon = QIcon::fromTheme(QLatin1String("media-skip-backward")); | - | ||||||||||||||||||||||||
| 5762 | break; never executed: break; | 0 | ||||||||||||||||||||||||
| 5763 | case SP_MediaVolume: never executed: case SP_MediaVolume: | 0 | ||||||||||||||||||||||||
| 5764 | icon = QIcon::fromTheme(QLatin1String("audio-volume-medium")); | - | ||||||||||||||||||||||||
| 5765 | break; never executed: break; | 0 | ||||||||||||||||||||||||
| 5766 | case SP_MediaVolumeMuted: never executed: case SP_MediaVolumeMuted: | 0 | ||||||||||||||||||||||||
| 5767 | icon = QIcon::fromTheme(QLatin1String("audio-volume-muted")); | - | ||||||||||||||||||||||||
| 5768 | break; never executed: break; | 0 | ||||||||||||||||||||||||
| 5769 | case SP_ArrowForward: never executed: case SP_ArrowForward: | 0 | ||||||||||||||||||||||||
| 5770 | if (rtl)
| 0 | ||||||||||||||||||||||||
| 5771 | return QCommonStyle::standardIcon(SP_ArrowLeft, option, widget); never executed: return QCommonStyle::standardIcon(SP_ArrowLeft, option, widget); | 0 | ||||||||||||||||||||||||
| 5772 | return QCommonStyle::standardIcon(SP_ArrowRight, option, widget); never executed: return QCommonStyle::standardIcon(SP_ArrowRight, option, widget); | 0 | ||||||||||||||||||||||||
| 5773 | case SP_ArrowBack: never executed: case SP_ArrowBack: | 0 | ||||||||||||||||||||||||
| 5774 | if (rtl)
| 0 | ||||||||||||||||||||||||
| 5775 | return QCommonStyle::standardIcon(SP_ArrowRight, option, widget); never executed: return QCommonStyle::standardIcon(SP_ArrowRight, option, widget); | 0 | ||||||||||||||||||||||||
| 5776 | return QCommonStyle::standardIcon(SP_ArrowLeft, option, widget); never executed: return QCommonStyle::standardIcon(SP_ArrowLeft, option, widget); | 0 | ||||||||||||||||||||||||
| 5777 | case SP_FileLinkIcon: never executed: case SP_FileLinkIcon: | 0 | ||||||||||||||||||||||||
| 5778 | { | - | ||||||||||||||||||||||||
| 5779 | QIcon linkIcon = QIcon::fromTheme(QLatin1String("emblem-symbolic-link")); | - | ||||||||||||||||||||||||
| 5780 | if (!linkIcon.isNull()) {
| 0 | ||||||||||||||||||||||||
| 5781 | QIcon baseIcon = QCommonStyle::standardIcon(SP_FileIcon, option, widget); | - | ||||||||||||||||||||||||
| 5782 | const QList<QSize> sizes = baseIcon.availableSizes(QIcon::Normal, QIcon::Off); | - | ||||||||||||||||||||||||
| 5783 | for (int i = 0 ; i < sizes.size() ; ++i) {
| 0 | ||||||||||||||||||||||||
| 5784 | int size = sizes[i].width(); | - | ||||||||||||||||||||||||
| 5785 | QPixmap basePixmap = baseIcon.pixmap(qt_getWindow(widget), QSize(size, size)); | - | ||||||||||||||||||||||||
| 5786 | QPixmap linkPixmap = linkIcon.pixmap(qt_getWindow(widget), QSize(size / 2, size / 2)); | - | ||||||||||||||||||||||||
| 5787 | QPainter painter(&basePixmap); | - | ||||||||||||||||||||||||
| 5788 | painter.drawPixmap(size/2, size/2, linkPixmap); | - | ||||||||||||||||||||||||
| 5789 | icon.addPixmap(basePixmap); | - | ||||||||||||||||||||||||
| 5790 | } never executed: end of block | 0 | ||||||||||||||||||||||||
| 5791 | } never executed: end of block | 0 | ||||||||||||||||||||||||
| 5792 | } | - | ||||||||||||||||||||||||
| 5793 | break; never executed: break; | 0 | ||||||||||||||||||||||||
| 5794 | case SP_DirLinkIcon: never executed: case SP_DirLinkIcon: | 0 | ||||||||||||||||||||||||
| 5795 | { | - | ||||||||||||||||||||||||
| 5796 | QIcon linkIcon = QIcon::fromTheme(QLatin1String("emblem-symbolic-link")); | - | ||||||||||||||||||||||||
| 5797 | if (!linkIcon.isNull()) {
| 0 | ||||||||||||||||||||||||
| 5798 | QIcon baseIcon = QCommonStyle::standardIcon(SP_DirIcon, option, widget); | - | ||||||||||||||||||||||||
| 5799 | const QList<QSize> sizes = baseIcon.availableSizes(QIcon::Normal, QIcon::Off); | - | ||||||||||||||||||||||||
| 5800 | for (int i = 0 ; i < sizes.size() ; ++i) {
| 0 | ||||||||||||||||||||||||
| 5801 | int size = sizes[i].width(); | - | ||||||||||||||||||||||||
| 5802 | QPixmap basePixmap = baseIcon.pixmap(qt_getWindow(widget), QSize(size, size)); | - | ||||||||||||||||||||||||
| 5803 | QPixmap linkPixmap = linkIcon.pixmap(qt_getWindow(widget), QSize(size / 2, size / 2)); | - | ||||||||||||||||||||||||
| 5804 | QPainter painter(&basePixmap); | - | ||||||||||||||||||||||||
| 5805 | painter.drawPixmap(size/2, size/2, linkPixmap); | - | ||||||||||||||||||||||||
| 5806 | icon.addPixmap(basePixmap); | - | ||||||||||||||||||||||||
| 5807 | } never executed: end of block | 0 | ||||||||||||||||||||||||
| 5808 | } never executed: end of block | 0 | ||||||||||||||||||||||||
| 5809 | } | - | ||||||||||||||||||||||||
| 5810 | break; never executed: break; | 0 | ||||||||||||||||||||||||
| 5811 | default: never executed: default: | 0 | ||||||||||||||||||||||||
| 5812 | break; never executed: break; | 0 | ||||||||||||||||||||||||
| 5813 | } | - | ||||||||||||||||||||||||
| 5814 | } // if (QApplication::desktopSettingsAware() && !QIcon::themeName().isEmpty()) | - | ||||||||||||||||||||||||
| 5815 | - | |||||||||||||||||||||||||
| 5816 | if (!icon.isNull())
| 0 | ||||||||||||||||||||||||
| 5817 | return icon; never executed: return icon; | 0 | ||||||||||||||||||||||||
| 5818 | - | |||||||||||||||||||||||||
| 5819 | #if defined(Q_OS_MAC) | - | ||||||||||||||||||||||||
| 5820 | if (QApplication::desktopSettingsAware()) { | - | ||||||||||||||||||||||||
| 5821 | switch (standardIcon) { | - | ||||||||||||||||||||||||
| 5822 | case SP_DirIcon: { | - | ||||||||||||||||||||||||
| 5823 | // A rather special case | - | ||||||||||||||||||||||||
| 5824 | QIcon closeIcon = QCommonStyle::standardIcon(SP_DirClosedIcon, option, widget); | - | ||||||||||||||||||||||||
| 5825 | QIcon openIcon = QCommonStyle::standardIcon(SP_DirOpenIcon, option, widget); | - | ||||||||||||||||||||||||
| 5826 | closeIcon.addPixmap(openIcon.pixmap(16, 16), QIcon::Normal, QIcon::On); | - | ||||||||||||||||||||||||
| 5827 | closeIcon.addPixmap(openIcon.pixmap(32, 32), QIcon::Normal, QIcon::On); | - | ||||||||||||||||||||||||
| 5828 | closeIcon.addPixmap(openIcon.pixmap(64, 64), QIcon::Normal, QIcon::On); | - | ||||||||||||||||||||||||
| 5829 | closeIcon.addPixmap(openIcon.pixmap(128, 128), QIcon::Normal, QIcon::On); | - | ||||||||||||||||||||||||
| 5830 | return closeIcon; | - | ||||||||||||||||||||||||
| 5831 | } | - | ||||||||||||||||||||||||
| 5832 | - | |||||||||||||||||||||||||
| 5833 | case SP_TitleBarNormalButton: | - | ||||||||||||||||||||||||
| 5834 | case SP_TitleBarCloseButton: { | - | ||||||||||||||||||||||||
| 5835 | QIcon titleBarIcon; | - | ||||||||||||||||||||||||
| 5836 | if (standardIcon == SP_TitleBarCloseButton) { | - | ||||||||||||||||||||||||
| 5837 | titleBarIcon.addFile(QLatin1String(":/qt-project.org/styles/macstyle/images/closedock-16.png")); | - | ||||||||||||||||||||||||
| 5838 | titleBarIcon.addFile(QLatin1String(":/qt-project.org/styles/macstyle/images/closedock-down-16.png"), QSize(16, 16), QIcon::Normal, QIcon::On); | - | ||||||||||||||||||||||||
| 5839 | } else { | - | ||||||||||||||||||||||||
| 5840 | titleBarIcon.addFile(QLatin1String(":/qt-project.org/styles/macstyle/images/dockdock-16.png")); | - | ||||||||||||||||||||||||
| 5841 | titleBarIcon.addFile(QLatin1String(":/qt-project.org/styles/macstyle/images/dockdock-down-16.png"), QSize(16, 16), QIcon::Normal, QIcon::On); | - | ||||||||||||||||||||||||
| 5842 | } | - | ||||||||||||||||||||||||
| 5843 | return titleBarIcon; | - | ||||||||||||||||||||||||
| 5844 | } | - | ||||||||||||||||||||||||
| 5845 | - | |||||||||||||||||||||||||
| 5846 | case SP_MessageBoxQuestion: | - | ||||||||||||||||||||||||
| 5847 | case SP_MessageBoxInformation: | - | ||||||||||||||||||||||||
| 5848 | case SP_MessageBoxWarning: | - | ||||||||||||||||||||||||
| 5849 | case SP_MessageBoxCritical: | - | ||||||||||||||||||||||||
| 5850 | case SP_DesktopIcon: | - | ||||||||||||||||||||||||
| 5851 | case SP_TrashIcon: | - | ||||||||||||||||||||||||
| 5852 | case SP_ComputerIcon: | - | ||||||||||||||||||||||||
| 5853 | case SP_DriveFDIcon: | - | ||||||||||||||||||||||||
| 5854 | case SP_DriveHDIcon: | - | ||||||||||||||||||||||||
| 5855 | case SP_DriveCDIcon: | - | ||||||||||||||||||||||||
| 5856 | case SP_DriveDVDIcon: | - | ||||||||||||||||||||||||
| 5857 | case SP_DriveNetIcon: | - | ||||||||||||||||||||||||
| 5858 | case SP_DirOpenIcon: | - | ||||||||||||||||||||||||
| 5859 | case SP_DirClosedIcon: | - | ||||||||||||||||||||||||
| 5860 | case SP_DirLinkIcon: | - | ||||||||||||||||||||||||
| 5861 | case SP_FileLinkIcon: | - | ||||||||||||||||||||||||
| 5862 | case SP_FileIcon: | - | ||||||||||||||||||||||||
| 5863 | if (const QPlatformTheme *theme = QGuiApplicationPrivate::platformTheme()) { | - | ||||||||||||||||||||||||
| 5864 | QPlatformTheme::StandardPixmap sp = static_cast<QPlatformTheme::StandardPixmap>(standardIcon); | - | ||||||||||||||||||||||||
| 5865 | QIcon retIcon; | - | ||||||||||||||||||||||||
| 5866 | QList<int> sizes = theme->themeHint(QPlatformTheme::IconPixmapSizes).value<QList<int> >(); | - | ||||||||||||||||||||||||
| 5867 | Q_FOREACH (int size, sizes) { | - | ||||||||||||||||||||||||
| 5868 | QPixmap mainIcon; | - | ||||||||||||||||||||||||
| 5869 | const QString cacheKey = QLatin1String("qt_mac_constructQIconFromIconRef") + QString::number(standardIcon) + QString::number(size); | - | ||||||||||||||||||||||||
| 5870 | if (standardIcon >= QStyle::SP_CustomBase) { | - | ||||||||||||||||||||||||
| 5871 | mainIcon = theme->standardPixmap(sp, QSizeF(size, size)); | - | ||||||||||||||||||||||||
| 5872 | } else if (QPixmapCache::find(cacheKey, mainIcon) == false) { | - | ||||||||||||||||||||||||
| 5873 | mainIcon = theme->standardPixmap(sp, QSizeF(size, size)); | - | ||||||||||||||||||||||||
| 5874 | QPixmapCache::insert(cacheKey, mainIcon); | - | ||||||||||||||||||||||||
| 5875 | } | - | ||||||||||||||||||||||||
| 5876 | - | |||||||||||||||||||||||||
| 5877 | retIcon.addPixmap(mainIcon); | - | ||||||||||||||||||||||||
| 5878 | } | - | ||||||||||||||||||||||||
| 5879 | if (!retIcon.isNull()) | - | ||||||||||||||||||||||||
| 5880 | return retIcon; | - | ||||||||||||||||||||||||
| 5881 | } | - | ||||||||||||||||||||||||
| 5882 | - | |||||||||||||||||||||||||
| 5883 | default: | - | ||||||||||||||||||||||||
| 5884 | break; | - | ||||||||||||||||||||||||
| 5885 | } | - | ||||||||||||||||||||||||
| 5886 | } // if (QApplication::desktopSettingsAware()) | - | ||||||||||||||||||||||||
| 5887 | #endif // Q_OS_MAC | - | ||||||||||||||||||||||||
| 5888 | - | |||||||||||||||||||||||||
| 5889 | switch (standardIcon) { | - | ||||||||||||||||||||||||
| 5890 | #ifndef QT_NO_IMAGEFORMAT_PNG | - | ||||||||||||||||||||||||
| 5891 | case SP_FileDialogNewFolder: never executed: case SP_FileDialogNewFolder: | 0 | ||||||||||||||||||||||||
| 5892 | icon.addFile(QLatin1String(":/qt-project.org/styles/commonstyle/images/newdirectory-16.png"), QSize(16, 16)); | - | ||||||||||||||||||||||||
| 5893 | icon.addFile(QLatin1String(":/qt-project.org/styles/commonstyle/images/newdirectory-32.png"), QSize(32, 32)); | - | ||||||||||||||||||||||||
| 5894 | icon.addFile(QLatin1String(":/qt-project.org/styles/commonstyle/images/newdirectory-128.png"), QSize(128, 128)); | - | ||||||||||||||||||||||||
| 5895 | break; never executed: break; | 0 | ||||||||||||||||||||||||
| 5896 | case SP_FileDialogBack: never executed: case SP_FileDialogBack: | 0 | ||||||||||||||||||||||||
| 5897 | return QCommonStyle::standardIcon(SP_ArrowBack, option, widget); never executed: return QCommonStyle::standardIcon(SP_ArrowBack, option, widget); | 0 | ||||||||||||||||||||||||
| 5898 | case SP_FileDialogToParent: never executed: case SP_FileDialogToParent: | 0 | ||||||||||||||||||||||||
| 5899 | return QCommonStyle::standardIcon(SP_ArrowUp, option, widget); never executed: return QCommonStyle::standardIcon(SP_ArrowUp, option, widget); | 0 | ||||||||||||||||||||||||
| 5900 | case SP_FileDialogDetailedView: never executed: case SP_FileDialogDetailedView: | 0 | ||||||||||||||||||||||||
| 5901 | icon.addFile(QLatin1String(":/qt-project.org/styles/commonstyle/images/viewdetailed-16.png"), QSize(16, 16)); | - | ||||||||||||||||||||||||
| 5902 | icon.addFile(QLatin1String(":/qt-project.org/styles/commonstyle/images/viewdetailed-32.png"), QSize(32, 32)); | - | ||||||||||||||||||||||||
| 5903 | icon.addFile(QLatin1String(":/qt-project.org/styles/commonstyle/images/viewdetailed-128.png"), QSize(128, 128)); | - | ||||||||||||||||||||||||
| 5904 | break; never executed: break; | 0 | ||||||||||||||||||||||||
| 5905 | case SP_FileDialogInfoView: never executed: case SP_FileDialogInfoView: | 0 | ||||||||||||||||||||||||
| 5906 | icon.addFile(QLatin1String(":/qt-project.org/styles/commonstyle/images/fileinfo-16.png"), QSize(16, 16)); | - | ||||||||||||||||||||||||
| 5907 | icon.addFile(QLatin1String(":/qt-project.org/styles/commonstyle/images/fileinfo-32.png"), QSize(32, 32)); | - | ||||||||||||||||||||||||
| 5908 | icon.addFile(QLatin1String(":/qt-project.org/styles/commonstyle/images/fileinfo-128.png"), QSize(128, 128)); | - | ||||||||||||||||||||||||
| 5909 | break; never executed: break; | 0 | ||||||||||||||||||||||||
| 5910 | case SP_FileDialogContentsView: never executed: case SP_FileDialogContentsView: | 0 | ||||||||||||||||||||||||
| 5911 | icon.addFile(QLatin1String(":/qt-project.org/styles/commonstyle/images/filecontents-16.png"), QSize(16, 16)); | - | ||||||||||||||||||||||||
| 5912 | icon.addFile(QLatin1String(":/qt-project.org/styles/commonstyle/images/filecontents-32.png"), QSize(32, 32)); | - | ||||||||||||||||||||||||
| 5913 | icon.addFile(QLatin1String(":/qt-project.org/styles/commonstyle/images/filecontents-128.png"), QSize(128, 128)); | - | ||||||||||||||||||||||||
| 5914 | break; never executed: break; | 0 | ||||||||||||||||||||||||
| 5915 | case SP_FileDialogListView: never executed: case SP_FileDialogListView: | 0 | ||||||||||||||||||||||||
| 5916 | icon.addFile(QLatin1String(":/qt-project.org/styles/commonstyle/images/viewlist-16.png"), QSize(16, 16)); | - | ||||||||||||||||||||||||
| 5917 | icon.addFile(QLatin1String(":/qt-project.org/styles/commonstyle/images/viewlist-32.png"), QSize(32, 32)); | - | ||||||||||||||||||||||||
| 5918 | icon.addFile(QLatin1String(":/qt-project.org/styles/commonstyle/images/viewlist-128.png"), QSize(128, 128)); | - | ||||||||||||||||||||||||
| 5919 | break; never executed: break; | 0 | ||||||||||||||||||||||||
| 5920 | case SP_DialogOkButton: never executed: case SP_DialogOkButton: | 0 | ||||||||||||||||||||||||
| 5921 | icon.addFile(QLatin1String(":/qt-project.org/styles/commonstyle/images/standardbutton-ok-16.png"), QSize(16, 16)); | - | ||||||||||||||||||||||||
| 5922 | icon.addFile(QLatin1String(":/qt-project.org/styles/commonstyle/images/standardbutton-ok-32.png"), QSize(32, 32)); | - | ||||||||||||||||||||||||
| 5923 | icon.addFile(QLatin1String(":/qt-project.org/styles/commonstyle/images/standardbutton-ok-128.png"), QSize(128, 128)); | - | ||||||||||||||||||||||||
| 5924 | break; never executed: break; | 0 | ||||||||||||||||||||||||
| 5925 | case SP_DialogCancelButton: never executed: case SP_DialogCancelButton: | 0 | ||||||||||||||||||||||||
| 5926 | icon.addFile(QLatin1String(":/qt-project.org/styles/commonstyle/images/standardbutton-cancel-16.png"), QSize(16, 16)); | - | ||||||||||||||||||||||||
| 5927 | icon.addFile(QLatin1String(":/qt-project.org/styles/commonstyle/images/standardbutton-cancel-32.png"), QSize(32, 32)); | - | ||||||||||||||||||||||||
| 5928 | icon.addFile(QLatin1String(":/qt-project.org/styles/commonstyle/images/standardbutton-cancel-128.png"), QSize(128, 128)); | - | ||||||||||||||||||||||||
| 5929 | break; never executed: break; | 0 | ||||||||||||||||||||||||
| 5930 | case SP_DialogHelpButton: never executed: case SP_DialogHelpButton: | 0 | ||||||||||||||||||||||||
| 5931 | icon.addFile(QLatin1String(":/qt-project.org/styles/commonstyle/images/standardbutton-help-16.png"), QSize(16, 16)); | - | ||||||||||||||||||||||||
| 5932 | icon.addFile(QLatin1String(":/qt-project.org/styles/commonstyle/images/standardbutton-help-32.png"), QSize(32, 32)); | - | ||||||||||||||||||||||||
| 5933 | icon.addFile(QLatin1String(":/qt-project.org/styles/commonstyle/images/standardbutton-help-128.png"), QSize(128, 128)); | - | ||||||||||||||||||||||||
| 5934 | break; never executed: break; | 0 | ||||||||||||||||||||||||
| 5935 | case SP_DialogOpenButton: never executed: case SP_DialogOpenButton: | 0 | ||||||||||||||||||||||||
| 5936 | icon.addFile(QLatin1String(":/qt-project.org/styles/commonstyle/images/standardbutton-open-16.png"), QSize(16, 16)); | - | ||||||||||||||||||||||||
| 5937 | icon.addFile(QLatin1String(":/qt-project.org/styles/commonstyle/images/standardbutton-open-32.png"), QSize(32, 32)); | - | ||||||||||||||||||||||||
| 5938 | icon.addFile(QLatin1String(":/qt-project.org/styles/commonstyle/images/standardbutton-open-128.png"), QSize(128, 128)); | - | ||||||||||||||||||||||||
| 5939 | break; never executed: break; | 0 | ||||||||||||||||||||||||
| 5940 | case SP_DialogSaveButton: never executed: case SP_DialogSaveButton: | 0 | ||||||||||||||||||||||||
| 5941 | icon.addFile(QLatin1String(":/qt-project.org/styles/commonstyle/images/standardbutton-save-16.png"), QSize(16, 16)); | - | ||||||||||||||||||||||||
| 5942 | icon.addFile(QLatin1String(":/qt-project.org/styles/commonstyle/images/standardbutton-save-32.png"), QSize(32, 32)); | - | ||||||||||||||||||||||||
| 5943 | icon.addFile(QLatin1String(":/qt-project.org/styles/commonstyle/images/standardbutton-save-128.png"), QSize(128, 128)); | - | ||||||||||||||||||||||||
| 5944 | break; never executed: break; | 0 | ||||||||||||||||||||||||
| 5945 | case SP_DialogCloseButton: never executed: case SP_DialogCloseButton: | 0 | ||||||||||||||||||||||||
| 5946 | icon.addFile(QLatin1String(":/qt-project.org/styles/commonstyle/images/standardbutton-close-16.png"), QSize(16, 16)); | - | ||||||||||||||||||||||||
| 5947 | icon.addFile(QLatin1String(":/qt-project.org/styles/commonstyle/images/standardbutton-close-32.png"), QSize(32, 32)); | - | ||||||||||||||||||||||||
| 5948 | icon.addFile(QLatin1String(":/qt-project.org/styles/commonstyle/images/standardbutton-close-128.png"), QSize(128, 128)); | - | ||||||||||||||||||||||||
| 5949 | break; never executed: break; | 0 | ||||||||||||||||||||||||
| 5950 | case SP_DialogApplyButton: never executed: case SP_DialogApplyButton: | 0 | ||||||||||||||||||||||||
| 5951 | icon.addFile(QLatin1String(":/qt-project.org/styles/commonstyle/images/standardbutton-apply-16.png"), QSize(16, 16)); | - | ||||||||||||||||||||||||
| 5952 | icon.addFile(QLatin1String(":/qt-project.org/styles/commonstyle/images/standardbutton-apply-32.png"), QSize(32, 32)); | - | ||||||||||||||||||||||||
| 5953 | icon.addFile(QLatin1String(":/qt-project.org/styles/commonstyle/images/standardbutton-apply-128.png"), QSize(128, 128)); | - | ||||||||||||||||||||||||
| 5954 | break; never executed: break; | 0 | ||||||||||||||||||||||||
| 5955 | case SP_DialogResetButton: never executed: case SP_DialogResetButton: | 0 | ||||||||||||||||||||||||
| 5956 | icon.addFile(QLatin1String(":/qt-project.org/styles/commonstyle/images/standardbutton-clear-16.png"), QSize(16, 16)); | - | ||||||||||||||||||||||||
| 5957 | icon.addFile(QLatin1String(":/qt-project.org/styles/commonstyle/images/standardbutton-clear-32.png"), QSize(32, 32)); | - | ||||||||||||||||||||||||
| 5958 | icon.addFile(QLatin1String(":/qt-project.org/styles/commonstyle/images/standardbutton-clear-128.png"), QSize(128, 128)); | - | ||||||||||||||||||||||||
| 5959 | break; never executed: break; | 0 | ||||||||||||||||||||||||
| 5960 | case SP_DialogDiscardButton: never executed: case SP_DialogDiscardButton: | 0 | ||||||||||||||||||||||||
| 5961 | icon.addFile(QLatin1String(":/qt-project.org/styles/commonstyle/images/standardbutton-delete-16.png"), QSize(16, 16)); | - | ||||||||||||||||||||||||
| 5962 | icon.addFile(QLatin1String(":/qt-project.org/styles/commonstyle/images/standardbutton-delete-32.png"), QSize(32, 32)); | - | ||||||||||||||||||||||||
| 5963 | icon.addFile(QLatin1String(":/qt-project.org/styles/commonstyle/images/standardbutton-delete-128.png"), QSize(128, 128)); | - | ||||||||||||||||||||||||
| 5964 | break; never executed: break; | 0 | ||||||||||||||||||||||||
| 5965 | case SP_DialogYesButton: never executed: case SP_DialogYesButton: | 0 | ||||||||||||||||||||||||
| 5966 | icon.addFile(QLatin1String(":/qt-project.org/styles/commonstyle/images/standardbutton-yes-16.png"), QSize(16, 16)); | - | ||||||||||||||||||||||||
| 5967 | icon.addFile(QLatin1String(":/qt-project.org/styles/commonstyle/images/standardbutton-yes-32.png"), QSize(32, 32)); | - | ||||||||||||||||||||||||
| 5968 | icon.addFile(QLatin1String(":/qt-project.org/styles/commonstyle/images/standardbutton-yes-128.png"), QSize(128, 128)); | - | ||||||||||||||||||||||||
| 5969 | break; never executed: break; | 0 | ||||||||||||||||||||||||
| 5970 | case SP_DialogNoButton: never executed: case SP_DialogNoButton: | 0 | ||||||||||||||||||||||||
| 5971 | icon.addFile(QLatin1String(":/qt-project.org/styles/commonstyle/images/standardbutton-no-16.png"), QSize(16, 16)); | - | ||||||||||||||||||||||||
| 5972 | icon.addFile(QLatin1String(":/qt-project.org/styles/commonstyle/images/standardbutton-no-32.png"), QSize(32, 32)); | - | ||||||||||||||||||||||||
| 5973 | icon.addFile(QLatin1String(":/qt-project.org/styles/commonstyle/images/standardbutton-no-128.png"), QSize(128, 128)); | - | ||||||||||||||||||||||||
| 5974 | break; never executed: break; | 0 | ||||||||||||||||||||||||
| 5975 | case SP_ArrowForward: never executed: case SP_ArrowForward: | 0 | ||||||||||||||||||||||||
| 5976 | if (rtl)
| 0 | ||||||||||||||||||||||||
| 5977 | return QCommonStyle::standardIcon(SP_ArrowLeft, option, widget); never executed: return QCommonStyle::standardIcon(SP_ArrowLeft, option, widget); | 0 | ||||||||||||||||||||||||
| 5978 | return QCommonStyle::standardIcon(SP_ArrowRight, option, widget); never executed: return QCommonStyle::standardIcon(SP_ArrowRight, option, widget); | 0 | ||||||||||||||||||||||||
| 5979 | case SP_ArrowBack: never executed: case SP_ArrowBack: | 0 | ||||||||||||||||||||||||
| 5980 | if (rtl)
| 0 | ||||||||||||||||||||||||
| 5981 | return QCommonStyle::standardIcon(SP_ArrowRight, option, widget); never executed: return QCommonStyle::standardIcon(SP_ArrowRight, option, widget); | 0 | ||||||||||||||||||||||||
| 5982 | return QCommonStyle::standardIcon(SP_ArrowLeft, option, widget); never executed: return QCommonStyle::standardIcon(SP_ArrowLeft, option, widget); | 0 | ||||||||||||||||||||||||
| 5983 | case SP_ArrowLeft: never executed: case SP_ArrowLeft: | 0 | ||||||||||||||||||||||||
| 5984 | icon.addFile(QLatin1String(":/qt-project.org/styles/commonstyle/images/left-16.png"), QSize(16, 16)); | - | ||||||||||||||||||||||||
| 5985 | icon.addFile(QLatin1String(":/qt-project.org/styles/commonstyle/images/left-32.png"), QSize(32, 32)); | - | ||||||||||||||||||||||||
| 5986 | icon.addFile(QLatin1String(":/qt-project.org/styles/commonstyle/images/left-128.png"), QSize(128, 128)); | - | ||||||||||||||||||||||||
| 5987 | break; never executed: break; | 0 | ||||||||||||||||||||||||
| 5988 | case SP_ArrowRight: never executed: case SP_ArrowRight: | 0 | ||||||||||||||||||||||||
| 5989 | icon.addFile(QLatin1String(":/qt-project.org/styles/commonstyle/images/right-16.png"), QSize(16, 16)); | - | ||||||||||||||||||||||||
| 5990 | icon.addFile(QLatin1String(":/qt-project.org/styles/commonstyle/images/right-32.png"), QSize(32, 32)); | - | ||||||||||||||||||||||||
| 5991 | icon.addFile(QLatin1String(":/qt-project.org/styles/commonstyle/images/right-128.png"), QSize(128, 128)); | - | ||||||||||||||||||||||||
| 5992 | break; never executed: break; | 0 | ||||||||||||||||||||||||
| 5993 | case SP_ArrowUp: never executed: case SP_ArrowUp: | 0 | ||||||||||||||||||||||||
| 5994 | icon.addFile(QLatin1String(":/qt-project.org/styles/commonstyle/images/up-16.png"), QSize(16, 16)); | - | ||||||||||||||||||||||||
| 5995 | icon.addFile(QLatin1String(":/qt-project.org/styles/commonstyle/images/up-32.png"), QSize(32, 32)); | - | ||||||||||||||||||||||||
| 5996 | icon.addFile(QLatin1String(":/qt-project.org/styles/commonstyle/images/up-128.png"), QSize(128, 128)); | - | ||||||||||||||||||||||||
| 5997 | break; never executed: break; | 0 | ||||||||||||||||||||||||
| 5998 | case SP_ArrowDown: never executed: case SP_ArrowDown: | 0 | ||||||||||||||||||||||||
| 5999 | icon.addFile(QLatin1String(":/qt-project.org/styles/commonstyle/images/down-16.png"), QSize(16, 16)); | - | ||||||||||||||||||||||||
| 6000 | icon.addFile(QLatin1String(":/qt-project.org/styles/commonstyle/images/down-32.png"), QSize(32, 32)); | - | ||||||||||||||||||||||||
| 6001 | icon.addFile(QLatin1String(":/qt-project.org/styles/commonstyle/images/down-128.png"), QSize(128, 128)); | - | ||||||||||||||||||||||||
| 6002 | break; never executed: break; | 0 | ||||||||||||||||||||||||
| 6003 | case SP_DirHomeIcon: never executed: case SP_DirHomeIcon: | 0 | ||||||||||||||||||||||||
| 6004 | case SP_DirIcon: never executed: case SP_DirIcon: | 0 | ||||||||||||||||||||||||
| 6005 | icon.addFile(QLatin1String(":/qt-project.org/styles/commonstyle/images/dirclosed-16.png"), | - | ||||||||||||||||||||||||
| 6006 | QSize(), QIcon::Normal, QIcon::Off); | - | ||||||||||||||||||||||||
| 6007 | icon.addFile(QLatin1String(":/qt-project.org/styles/commonstyle/images/diropen-16.png"), | - | ||||||||||||||||||||||||
| 6008 | QSize(), QIcon::Normal, QIcon::On); | - | ||||||||||||||||||||||||
| 6009 | icon.addFile(QLatin1String(":/qt-project.org/styles/commonstyle/images/dirclosed-32.png"), | - | ||||||||||||||||||||||||
| 6010 | QSize(32, 32), QIcon::Normal, QIcon::Off); | - | ||||||||||||||||||||||||
| 6011 | icon.addFile(QLatin1String(":/qt-project.org/styles/commonstyle/images/diropen-32.png"), | - | ||||||||||||||||||||||||
| 6012 | QSize(32, 32), QIcon::Normal, QIcon::On); | - | ||||||||||||||||||||||||
| 6013 | icon.addFile(QLatin1String(":/qt-project.org/styles/commonstyle/images/dirclosed-128.png"), | - | ||||||||||||||||||||||||
| 6014 | QSize(128, 128), QIcon::Normal, QIcon::Off); | - | ||||||||||||||||||||||||
| 6015 | icon.addFile(QLatin1String(":/qt-project.org/styles/commonstyle/images/diropen-128.png"), | - | ||||||||||||||||||||||||
| 6016 | QSize(128, 128), QIcon::Normal, QIcon::On); | - | ||||||||||||||||||||||||
| 6017 | break; never executed: break; | 0 | ||||||||||||||||||||||||
| 6018 | case SP_DriveCDIcon: never executed: case SP_DriveCDIcon: | 0 | ||||||||||||||||||||||||
| 6019 | icon.addFile(QLatin1String(":/qt-project.org/styles/commonstyle/images/cdr-16.png"), QSize(16, 16)); | - | ||||||||||||||||||||||||
| 6020 | icon.addFile(QLatin1String(":/qt-project.org/styles/commonstyle/images/cdr-32.png"), QSize(32, 32)); | - | ||||||||||||||||||||||||
| 6021 | icon.addFile(QLatin1String(":/qt-project.org/styles/commonstyle/images/cdr-128.png"), QSize(128, 128)); | - | ||||||||||||||||||||||||
| 6022 | break; never executed: break; | 0 | ||||||||||||||||||||||||
| 6023 | case SP_DriveDVDIcon: never executed: case SP_DriveDVDIcon: | 0 | ||||||||||||||||||||||||
| 6024 | icon.addFile(QLatin1String(":/qt-project.org/styles/commonstyle/images/dvd-16.png"), QSize(16, 16)); | - | ||||||||||||||||||||||||
| 6025 | icon.addFile(QLatin1String(":/qt-project.org/styles/commonstyle/images/dvd-32.png"), QSize(32, 32)); | - | ||||||||||||||||||||||||
| 6026 | icon.addFile(QLatin1String(":/qt-project.org/styles/commonstyle/images/dvd-128.png"), QSize(128, 128)); | - | ||||||||||||||||||||||||
| 6027 | break; never executed: break; | 0 | ||||||||||||||||||||||||
| 6028 | case SP_FileIcon: never executed: case SP_FileIcon: | 0 | ||||||||||||||||||||||||
| 6029 | icon.addFile(QLatin1String(":/qt-project.org/styles/commonstyle/images/file-16.png"), QSize(16, 16)); | - | ||||||||||||||||||||||||
| 6030 | icon.addFile(QLatin1String(":/qt-project.org/styles/commonstyle/images/file-32.png"), QSize(32, 32)); | - | ||||||||||||||||||||||||
| 6031 | icon.addFile(QLatin1String(":/qt-project.org/styles/commonstyle/images/file-128.png"), QSize(128, 128)); | - | ||||||||||||||||||||||||
| 6032 | break; never executed: break; | 0 | ||||||||||||||||||||||||
| 6033 | case SP_FileLinkIcon: never executed: case SP_FileLinkIcon: | 0 | ||||||||||||||||||||||||
| 6034 | icon.addFile(QLatin1String(":/qt-project.org/styles/commonstyle/images/filelink-16.png"), QSize(16, 16)); | - | ||||||||||||||||||||||||
| 6035 | icon.addFile(QLatin1String(":/qt-project.org/styles/commonstyle/images/filelink-32.png"), QSize(32, 32)); | - | ||||||||||||||||||||||||
| 6036 | icon.addFile(QLatin1String(":/qt-project.org/styles/commonstyle/images/filelink-128.png"), QSize(128, 128)); | - | ||||||||||||||||||||||||
| 6037 | break; never executed: break; | 0 | ||||||||||||||||||||||||
| 6038 | case SP_TrashIcon: never executed: case SP_TrashIcon: | 0 | ||||||||||||||||||||||||
| 6039 | icon.addFile(QLatin1String(":/qt-project.org/styles/commonstyle/images/trash-16.png"), QSize(16, 16)); | - | ||||||||||||||||||||||||
| 6040 | icon.addFile(QLatin1String(":/qt-project.org/styles/commonstyle/images/trash-32.png"), QSize(32, 32)); | - | ||||||||||||||||||||||||
| 6041 | icon.addFile(QLatin1String(":/qt-project.org/styles/commonstyle/images/trash-128.png"), QSize(128, 128)); | - | ||||||||||||||||||||||||
| 6042 | break; never executed: break; | 0 | ||||||||||||||||||||||||
| 6043 | case SP_BrowserReload: never executed: case SP_BrowserReload: | 0 | ||||||||||||||||||||||||
| 6044 | icon.addFile(QLatin1String(":/qt-project.org/styles/commonstyle/images/refresh-24.png"), QSize(24, 24)); | - | ||||||||||||||||||||||||
| 6045 | icon.addFile(QLatin1String(":/qt-project.org/styles/commonstyle/images/refresh-32.png"), QSize(32, 32)); | - | ||||||||||||||||||||||||
| 6046 | break; never executed: break; | 0 | ||||||||||||||||||||||||
| 6047 | case SP_BrowserStop: never executed: case SP_BrowserStop: | 0 | ||||||||||||||||||||||||
| 6048 | icon.addFile(QLatin1String(":/qt-project.org/styles/commonstyle/images/stop-24.png"), QSize(24, 24)); | - | ||||||||||||||||||||||||
| 6049 | icon.addFile(QLatin1String(":/qt-project.org/styles/commonstyle/images/stop-32.png"), QSize(32, 32)); | - | ||||||||||||||||||||||||
| 6050 | break; never executed: break; | 0 | ||||||||||||||||||||||||
| 6051 | case SP_MediaPlay: never executed: case SP_MediaPlay: | 0 | ||||||||||||||||||||||||
| 6052 | icon.addFile(QLatin1String(":/qt-project.org/styles/commonstyle/images/media-play-16.png"), QSize(16, 16)); | - | ||||||||||||||||||||||||
| 6053 | icon.addFile(QLatin1String(":/qt-project.org/styles/commonstyle/images/media-play-32.png"), QSize(32, 32)); | - | ||||||||||||||||||||||||
| 6054 | break; never executed: break; | 0 | ||||||||||||||||||||||||
| 6055 | case SP_MediaPause: never executed: case SP_MediaPause: | 0 | ||||||||||||||||||||||||
| 6056 | icon.addFile(QLatin1String(":/qt-project.org/styles/commonstyle/images/media-pause-16.png"), QSize(16, 16)); | - | ||||||||||||||||||||||||
| 6057 | icon.addFile(QLatin1String(":/qt-project.org/styles/commonstyle/images/media-pause-32.png"), QSize(32, 32)); | - | ||||||||||||||||||||||||
| 6058 | break; never executed: break; | 0 | ||||||||||||||||||||||||
| 6059 | case SP_MediaStop: never executed: case SP_MediaStop: | 0 | ||||||||||||||||||||||||
| 6060 | icon.addFile(QLatin1String(":/qt-project.org/styles/commonstyle/images/media-stop-16.png"), QSize(16, 16)); | - | ||||||||||||||||||||||||
| 6061 | icon.addFile(QLatin1String(":/qt-project.org/styles/commonstyle/images/media-stop-32.png"), QSize(32, 32)); | - | ||||||||||||||||||||||||
| 6062 | break; never executed: break; | 0 | ||||||||||||||||||||||||
| 6063 | case SP_MediaSeekForward: never executed: case SP_MediaSeekForward: | 0 | ||||||||||||||||||||||||
| 6064 | icon.addFile(QLatin1String(":/qt-project.org/styles/commonstyle/images/media-seek-forward-16.png"), QSize(16, 16)); | - | ||||||||||||||||||||||||
| 6065 | icon.addFile(QLatin1String(":/qt-project.org/styles/commonstyle/images/media-seek-forward-32.png"), QSize(32, 32)); | - | ||||||||||||||||||||||||
| 6066 | break; never executed: break; | 0 | ||||||||||||||||||||||||
| 6067 | case SP_MediaSeekBackward: never executed: case SP_MediaSeekBackward: | 0 | ||||||||||||||||||||||||
| 6068 | icon.addFile(QLatin1String(":/qt-project.org/styles/commonstyle/images/media-seek-backward-16.png"), QSize(16, 16)); | - | ||||||||||||||||||||||||
| 6069 | icon.addFile(QLatin1String(":/qt-project.org/styles/commonstyle/images/media-seek-backward-32.png"), QSize(32, 32)); | - | ||||||||||||||||||||||||
| 6070 | break; never executed: break; | 0 | ||||||||||||||||||||||||
| 6071 | case SP_MediaSkipForward: never executed: case SP_MediaSkipForward: | 0 | ||||||||||||||||||||||||
| 6072 | icon.addFile(QLatin1String(":/qt-project.org/styles/commonstyle/images/media-skip-forward-16.png"), QSize(16, 16)); | - | ||||||||||||||||||||||||
| 6073 | icon.addFile(QLatin1String(":/qt-project.org/styles/commonstyle/images/media-skip-forward-32.png"), QSize(32, 32)); | - | ||||||||||||||||||||||||
| 6074 | break; never executed: break; | 0 | ||||||||||||||||||||||||
| 6075 | case SP_MediaSkipBackward: never executed: case SP_MediaSkipBackward: | 0 | ||||||||||||||||||||||||
| 6076 | icon.addFile(QLatin1String(":/qt-project.org/styles/commonstyle/images/media-skip-backward-16.png"), QSize(16, 16)); | - | ||||||||||||||||||||||||
| 6077 | icon.addFile(QLatin1String(":/qt-project.org/styles/commonstyle/images/media-skip-backward-32.png"), QSize(32, 32)); | - | ||||||||||||||||||||||||
| 6078 | break; never executed: break; | 0 | ||||||||||||||||||||||||
| 6079 | case SP_MediaVolume: never executed: case SP_MediaVolume: | 0 | ||||||||||||||||||||||||
| 6080 | icon.addFile(QLatin1String(":/qt-project.org/styles/commonstyle/images/media-volume-16.png"), QSize(16, 16)); | - | ||||||||||||||||||||||||
| 6081 | break; never executed: break; | 0 | ||||||||||||||||||||||||
| 6082 | case SP_MediaVolumeMuted: never executed: case SP_MediaVolumeMuted: | 0 | ||||||||||||||||||||||||
| 6083 | icon.addFile(QLatin1String(":/qt-project.org/styles/commonstyle/images/media-volume-muted-16.png"), QSize(16, 16)); | - | ||||||||||||||||||||||||
| 6084 | break; never executed: break; | 0 | ||||||||||||||||||||||||
| 6085 | case SP_TitleBarMenuButton: never executed: case SP_TitleBarMenuButton: | 0 | ||||||||||||||||||||||||
| 6086 | # ifndef QT_NO_IMAGEFORMAT_XPM | - | ||||||||||||||||||||||||
| 6087 | icon.addPixmap(titleBarMenuCachedPixmapFromXPM()); | - | ||||||||||||||||||||||||
| 6088 | # endif | - | ||||||||||||||||||||||||
| 6089 | icon.addFile(QLatin1String(":/qt-project.org/qmessagebox/images/qtlogo-64.png")); | - | ||||||||||||||||||||||||
| 6090 | break; never executed: break; | 0 | ||||||||||||||||||||||||
| 6091 | #endif // QT_NO_IMAGEFORMAT_PNG | - | ||||||||||||||||||||||||
| 6092 | default: never executed: default: | 0 | ||||||||||||||||||||||||
| 6093 | icon.addPixmap(proxy()->standardPixmap(standardIcon, option, widget)); | - | ||||||||||||||||||||||||
| 6094 | break; never executed: break; | 0 | ||||||||||||||||||||||||
| 6095 | } | - | ||||||||||||||||||||||||
| 6096 | return icon; never executed: return icon; | 0 | ||||||||||||||||||||||||
| 6097 | } | - | ||||||||||||||||||||||||
| 6098 | - | |||||||||||||||||||||||||
| 6099 | static inline uint qt_intensity(uint r, uint g, uint b) | - | ||||||||||||||||||||||||
| 6100 | { | - | ||||||||||||||||||||||||
| 6101 | // 30% red, 59% green, 11% blue | - | ||||||||||||||||||||||||
| 6102 | return (77 * r + 150 * g + 28 * b) / 255; never executed: return (77 * r + 150 * g + 28 * b) / 255; | 0 | ||||||||||||||||||||||||
| 6103 | } | - | ||||||||||||||||||||||||
| 6104 | - | |||||||||||||||||||||||||
| 6105 | /*! \reimp */ | - | ||||||||||||||||||||||||
| 6106 | QPixmap QCommonStyle::generatedIconPixmap(QIcon::Mode iconMode, const QPixmap &pixmap, | - | ||||||||||||||||||||||||
| 6107 | const QStyleOption *opt) const | - | ||||||||||||||||||||||||
| 6108 | { | - | ||||||||||||||||||||||||
| 6109 | switch (iconMode) { | - | ||||||||||||||||||||||||
| 6110 | case QIcon::Disabled: { never executed: case QIcon::Disabled: | 0 | ||||||||||||||||||||||||
| 6111 | QImage im = pixmap.toImage().convertToFormat(QImage::Format_ARGB32); | - | ||||||||||||||||||||||||
| 6112 | - | |||||||||||||||||||||||||
| 6113 | // Create a colortable based on the background (black -> bg -> white) | - | ||||||||||||||||||||||||
| 6114 | QColor bg = opt->palette.color(QPalette::Disabled, QPalette::Window); | - | ||||||||||||||||||||||||
| 6115 | int red = bg.red(); | - | ||||||||||||||||||||||||
| 6116 | int green = bg.green(); | - | ||||||||||||||||||||||||
| 6117 | int blue = bg.blue(); | - | ||||||||||||||||||||||||
| 6118 | uchar reds[256], greens[256], blues[256]; | - | ||||||||||||||||||||||||
| 6119 | for (int i=0; i<128; ++i) {
| 0 | ||||||||||||||||||||||||
| 6120 | reds[i] = uchar((red * (i<<1)) >> 8); | - | ||||||||||||||||||||||||
| 6121 | greens[i] = uchar((green * (i<<1)) >> 8); | - | ||||||||||||||||||||||||
| 6122 | blues[i] = uchar((blue * (i<<1)) >> 8); | - | ||||||||||||||||||||||||
| 6123 | } never executed: end of block | 0 | ||||||||||||||||||||||||
| 6124 | for (int i=0; i<128; ++i) {
| 0 | ||||||||||||||||||||||||
| 6125 | reds[i+128] = uchar(qMin(red + (i << 1), 255)); | - | ||||||||||||||||||||||||
| 6126 | greens[i+128] = uchar(qMin(green + (i << 1), 255)); | - | ||||||||||||||||||||||||
| 6127 | blues[i+128] = uchar(qMin(blue + (i << 1), 255)); | - | ||||||||||||||||||||||||
| 6128 | } never executed: end of block | 0 | ||||||||||||||||||||||||
| 6129 | - | |||||||||||||||||||||||||
| 6130 | int intensity = qt_intensity(red, green, blue); | - | ||||||||||||||||||||||||
| 6131 | const int factor = 191; | - | ||||||||||||||||||||||||
| 6132 | - | |||||||||||||||||||||||||
| 6133 | // High intensity colors needs dark shifting in the color table, while | - | ||||||||||||||||||||||||
| 6134 | // low intensity colors needs light shifting. This is to increase the | - | ||||||||||||||||||||||||
| 6135 | // percieved contrast. | - | ||||||||||||||||||||||||
| 6136 | if ((red - factor > green && red - factor > blue)
| 0 | ||||||||||||||||||||||||
| 6137 | || (green - factor > red && green - factor > blue)
| 0 | ||||||||||||||||||||||||
| 6138 | || (blue - factor > red && blue - factor > green))
| 0 | ||||||||||||||||||||||||
| 6139 | intensity = qMin(255, intensity + 91); never executed: intensity = qMin(255, intensity + 91); | 0 | ||||||||||||||||||||||||
| 6140 | else if (intensity <= 128)
| 0 | ||||||||||||||||||||||||
| 6141 | intensity -= 51; never executed: intensity -= 51; | 0 | ||||||||||||||||||||||||
| 6142 | - | |||||||||||||||||||||||||
| 6143 | for (int y=0; y<im.height(); ++y) {
| 0 | ||||||||||||||||||||||||
| 6144 | QRgb *scanLine = (QRgb*)im.scanLine(y); | - | ||||||||||||||||||||||||
| 6145 | for (int x=0; x<im.width(); ++x) {
| 0 | ||||||||||||||||||||||||
| 6146 | QRgb pixel = *scanLine; | - | ||||||||||||||||||||||||
| 6147 | // Calculate color table index, taking intensity adjustment | - | ||||||||||||||||||||||||
| 6148 | // and a magic offset into account. | - | ||||||||||||||||||||||||
| 6149 | uint ci = uint(qGray(pixel)/3 + (130 - intensity / 3)); | - | ||||||||||||||||||||||||
| 6150 | *scanLine = qRgba(reds[ci], greens[ci], blues[ci], qAlpha(pixel)); | - | ||||||||||||||||||||||||
| 6151 | ++scanLine; | - | ||||||||||||||||||||||||
| 6152 | } never executed: end of block | 0 | ||||||||||||||||||||||||
| 6153 | } never executed: end of block | 0 | ||||||||||||||||||||||||
| 6154 | - | |||||||||||||||||||||||||
| 6155 | return QPixmap::fromImage(im); never executed: return QPixmap::fromImage(im); | 0 | ||||||||||||||||||||||||
| 6156 | } | - | ||||||||||||||||||||||||
| 6157 | case QIcon::Selected: { never executed: case QIcon::Selected: | 0 | ||||||||||||||||||||||||
| 6158 | QImage img = pixmap.toImage().convertToFormat(QImage::Format_ARGB32_Premultiplied); | - | ||||||||||||||||||||||||
| 6159 | QColor color = opt->palette.color(QPalette::Normal, QPalette::Highlight); | - | ||||||||||||||||||||||||
| 6160 | color.setAlphaF(qreal(0.3)); | - | ||||||||||||||||||||||||
| 6161 | QPainter painter(&img); | - | ||||||||||||||||||||||||
| 6162 | painter.setCompositionMode(QPainter::CompositionMode_SourceAtop); | - | ||||||||||||||||||||||||
| 6163 | painter.fillRect(0, 0, img.width(), img.height(), color); | - | ||||||||||||||||||||||||
| 6164 | painter.end(); | - | ||||||||||||||||||||||||
| 6165 | return QPixmap::fromImage(img); } never executed: return QPixmap::fromImage(img); | 0 | ||||||||||||||||||||||||
| 6166 | case QIcon::Active: never executed: case QIcon::Active: | 0 | ||||||||||||||||||||||||
| 6167 | return pixmap; never executed: return pixmap; | 0 | ||||||||||||||||||||||||
| 6168 | default: never executed: default: | 0 | ||||||||||||||||||||||||
| 6169 | break; never executed: break; | 0 | ||||||||||||||||||||||||
| 6170 | } | - | ||||||||||||||||||||||||
| 6171 | return pixmap; never executed: return pixmap; | 0 | ||||||||||||||||||||||||
| 6172 | } | - | ||||||||||||||||||||||||
| 6173 | - | |||||||||||||||||||||||||
| 6174 | /*! | - | ||||||||||||||||||||||||
| 6175 | \reimp | - | ||||||||||||||||||||||||
| 6176 | */ | - | ||||||||||||||||||||||||
| 6177 | int QCommonStyle::layoutSpacing(QSizePolicy::ControlType /* control1 */, QSizePolicy::ControlType /* control2 */, | - | ||||||||||||||||||||||||
| 6178 | Qt::Orientation /* orientation */, const QStyleOption * /* option */, | - | ||||||||||||||||||||||||
| 6179 | const QWidget * /* widget */) const | - | ||||||||||||||||||||||||
| 6180 | { | - | ||||||||||||||||||||||||
| 6181 | return -1; never executed: return -1; | 0 | ||||||||||||||||||||||||
| 6182 | } | - | ||||||||||||||||||||||||
| 6183 | - | |||||||||||||||||||||||||
| 6184 | /*! | - | ||||||||||||||||||||||||
| 6185 | \reimp | - | ||||||||||||||||||||||||
| 6186 | */ | - | ||||||||||||||||||||||||
| 6187 | void QCommonStyle::polish(QPalette &pal) | - | ||||||||||||||||||||||||
| 6188 | { | - | ||||||||||||||||||||||||
| 6189 | QStyle::polish(pal); | - | ||||||||||||||||||||||||
| 6190 | } never executed: end of block | 0 | ||||||||||||||||||||||||
| 6191 | - | |||||||||||||||||||||||||
| 6192 | /*! | - | ||||||||||||||||||||||||
| 6193 | \reimp | - | ||||||||||||||||||||||||
| 6194 | */ | - | ||||||||||||||||||||||||
| 6195 | void QCommonStyle::polish(QWidget *widget) | - | ||||||||||||||||||||||||
| 6196 | { | - | ||||||||||||||||||||||||
| 6197 | QStyle::polish(widget); | - | ||||||||||||||||||||||||
| 6198 | } never executed: end of block | 0 | ||||||||||||||||||||||||
| 6199 | - | |||||||||||||||||||||||||
| 6200 | /*! | - | ||||||||||||||||||||||||
| 6201 | \reimp | - | ||||||||||||||||||||||||
| 6202 | */ | - | ||||||||||||||||||||||||
| 6203 | void QCommonStyle::unpolish(QWidget *widget) | - | ||||||||||||||||||||||||
| 6204 | { | - | ||||||||||||||||||||||||
| 6205 | QStyle::unpolish(widget); | - | ||||||||||||||||||||||||
| 6206 | } never executed: end of block | 0 | ||||||||||||||||||||||||
| 6207 | - | |||||||||||||||||||||||||
| 6208 | /*! | - | ||||||||||||||||||||||||
| 6209 | \reimp | - | ||||||||||||||||||||||||
| 6210 | */ | - | ||||||||||||||||||||||||
| 6211 | void QCommonStyle::polish(QApplication *app) | - | ||||||||||||||||||||||||
| 6212 | { | - | ||||||||||||||||||||||||
| 6213 | QStyle::polish(app); | - | ||||||||||||||||||||||||
| 6214 | } never executed: end of block | 0 | ||||||||||||||||||||||||
| 6215 | - | |||||||||||||||||||||||||
| 6216 | /*! | - | ||||||||||||||||||||||||
| 6217 | \reimp | - | ||||||||||||||||||||||||
| 6218 | */ | - | ||||||||||||||||||||||||
| 6219 | void QCommonStyle::unpolish(QApplication *application) | - | ||||||||||||||||||||||||
| 6220 | { | - | ||||||||||||||||||||||||
| 6221 | Q_D(const QCommonStyle); | - | ||||||||||||||||||||||||
| 6222 | d->tabBarcloseButtonIcon = QIcon(); | - | ||||||||||||||||||||||||
| 6223 | QStyle::unpolish(application); | - | ||||||||||||||||||||||||
| 6224 | } never executed: end of block | 0 | ||||||||||||||||||||||||
| 6225 | - | |||||||||||||||||||||||||
| 6226 | - | |||||||||||||||||||||||||
| 6227 | QT_END_NAMESPACE | - | ||||||||||||||||||||||||
| 6228 | - | |||||||||||||||||||||||||
| 6229 | #include "moc_qcommonstyle.cpp" | - | ||||||||||||||||||||||||
| Source code | Switch to Preprocessed file |