| 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) 2016 The Qt Company Ltd. | - | ||||||||||||||||||||||||
| 4 | ** Contact: https://www.qt.io/licensing/ | - | ||||||||||||||||||||||||
| 5 | ** | - | ||||||||||||||||||||||||
| 6 | ** This file is part of the QtWidgets module of the Qt Toolkit. | - | ||||||||||||||||||||||||
| 7 | ** | - | ||||||||||||||||||||||||
| 8 | ** $QT_BEGIN_LICENSE:LGPL$ | - | ||||||||||||||||||||||||
| 9 | ** Commercial License Usage | - | ||||||||||||||||||||||||
| 10 | ** Licensees holding valid commercial Qt licenses may use this file in | - | ||||||||||||||||||||||||
| 11 | ** accordance with the commercial license agreement provided with the | - | ||||||||||||||||||||||||
| 12 | ** Software or, alternatively, in accordance with the terms contained in | - | ||||||||||||||||||||||||
| 13 | ** a written agreement between you and The Qt Company. For licensing terms | - | ||||||||||||||||||||||||
| 14 | ** and conditions see https://www.qt.io/terms-conditions. For further | - | ||||||||||||||||||||||||
| 15 | ** information use the contact form at https://www.qt.io/contact-us. | - | ||||||||||||||||||||||||
| 16 | ** | - | ||||||||||||||||||||||||
| 17 | ** GNU Lesser General Public License Usage | - | ||||||||||||||||||||||||
| 18 | ** Alternatively, this file may be used under the terms of the GNU Lesser | - | ||||||||||||||||||||||||
| 19 | ** General Public License version 3 as published by the Free Software | - | ||||||||||||||||||||||||
| 20 | ** Foundation and appearing in the file LICENSE.LGPL3 included in the | - | ||||||||||||||||||||||||
| 21 | ** packaging of this file. Please review the following information to | - | ||||||||||||||||||||||||
| 22 | ** ensure the GNU Lesser General Public License version 3 requirements | - | ||||||||||||||||||||||||
| 23 | ** will be met: https://www.gnu.org/licenses/lgpl-3.0.html. | - | ||||||||||||||||||||||||
| 24 | ** | - | ||||||||||||||||||||||||
| 25 | ** GNU General Public License Usage | - | ||||||||||||||||||||||||
| 26 | ** Alternatively, this file may be used under the terms of the GNU | - | ||||||||||||||||||||||||
| 27 | ** General Public License version 2.0 or (at your option) the GNU General | - | ||||||||||||||||||||||||
| 28 | ** Public license version 3 or any later version approved by the KDE Free | - | ||||||||||||||||||||||||
| 29 | ** Qt Foundation. The licenses are as published by the Free Software | - | ||||||||||||||||||||||||
| 30 | ** Foundation and appearing in the file LICENSE.GPL2 and LICENSE.GPL3 | - | ||||||||||||||||||||||||
| 31 | ** included in the packaging of this file. Please review the following | - | ||||||||||||||||||||||||
| 32 | ** information to ensure the GNU General Public License requirements will | - | ||||||||||||||||||||||||
| 33 | ** be met: https://www.gnu.org/licenses/gpl-2.0.html and | - | ||||||||||||||||||||||||
| 34 | ** https://www.gnu.org/licenses/gpl-3.0.html. | - | ||||||||||||||||||||||||
| 35 | ** | - | ||||||||||||||||||||||||
| 36 | ** $QT_END_LICENSE$ | - | ||||||||||||||||||||||||
| 37 | ** | - | ||||||||||||||||||||||||
| 38 | ****************************************************************************/ | - | ||||||||||||||||||||||||
| 39 | - | |||||||||||||||||||||||||
| 40 | #include "qcommonstyle.h" | - | ||||||||||||||||||||||||
| 41 | #include "qcommonstyle_p.h" | - | ||||||||||||||||||||||||
| 42 | - | |||||||||||||||||||||||||
| 43 | #include <qfile.h> | - | ||||||||||||||||||||||||
| 44 | #include <qapplication.h> | - | ||||||||||||||||||||||||
| 45 | #include <private/qguiapplication_p.h> | - | ||||||||||||||||||||||||
| 46 | #include <qpa/qplatformtheme.h> | - | ||||||||||||||||||||||||
| 47 | #include <qbitmap.h> | - | ||||||||||||||||||||||||
| 48 | #include <qcache.h> | - | ||||||||||||||||||||||||
| 49 | #include <qdockwidget.h> | - | ||||||||||||||||||||||||
| 50 | #include <qdrawutil.h> | - | ||||||||||||||||||||||||
| 51 | #include <qdialogbuttonbox.h> | - | ||||||||||||||||||||||||
| 52 | #include <qformlayout.h> | - | ||||||||||||||||||||||||
| 53 | #include <qgroupbox.h> | - | ||||||||||||||||||||||||
| 54 | #include <qmath.h> | - | ||||||||||||||||||||||||
| 55 | #include <qmenu.h> | - | ||||||||||||||||||||||||
| 56 | #include <qpainter.h> | - | ||||||||||||||||||||||||
| 57 | #include <qpaintengine.h> | - | ||||||||||||||||||||||||
| 58 | #include <qpainterpath.h> | - | ||||||||||||||||||||||||
| 59 | #include <qslider.h> | - | ||||||||||||||||||||||||
| 60 | #include <qstyleoption.h> | - | ||||||||||||||||||||||||
| 61 | #include <qtabbar.h> | - | ||||||||||||||||||||||||
| 62 | #include <qtabwidget.h> | - | ||||||||||||||||||||||||
| 63 | #include <qtoolbar.h> | - | ||||||||||||||||||||||||
| 64 | #include <qtoolbutton.h> | - | ||||||||||||||||||||||||
| 65 | #include <qrubberband.h> | - | ||||||||||||||||||||||||
| 66 | #include "qtreeview.h" | - | ||||||||||||||||||||||||
| 67 | #include <private/qcommonstylepixmaps_p.h> | - | ||||||||||||||||||||||||
| 68 | #include <private/qmath_p.h> | - | ||||||||||||||||||||||||
| 69 | #include <qdebug.h> | - | ||||||||||||||||||||||||
| 70 | #include <qtextformat.h> | - | ||||||||||||||||||||||||
| 71 | #include <qwizard.h> | - | ||||||||||||||||||||||||
| 72 | #include <qfileinfo.h> | - | ||||||||||||||||||||||||
| 73 | #include <qdir.h> | - | ||||||||||||||||||||||||
| 74 | #include <qsettings.h> | - | ||||||||||||||||||||||||
| 75 | #include <qvariant.h> | - | ||||||||||||||||||||||||
| 76 | #include <qpixmapcache.h> | - | ||||||||||||||||||||||||
| 77 | #include <private/qstyleanimation_p.h> | - | ||||||||||||||||||||||||
| 78 | - | |||||||||||||||||||||||||
| 79 | #include <limits.h> | - | ||||||||||||||||||||||||
| 80 | - | |||||||||||||||||||||||||
| 81 | #ifndef QT_NO_ITEMVIEWS | - | ||||||||||||||||||||||||
| 82 | # include "private/qtextengine_p.h" | - | ||||||||||||||||||||||||
| 83 | #endif | - | ||||||||||||||||||||||||
| 84 | - | |||||||||||||||||||||||||
| 85 | #include <private/qstylehelper_p.h> | - | ||||||||||||||||||||||||
| 86 | - | |||||||||||||||||||||||||
| 87 | QT_BEGIN_NAMESPACE | - | ||||||||||||||||||||||||
| 88 | - | |||||||||||||||||||||||||
| 89 | static QWindow *qt_getWindow(const QWidget *widget) | - | ||||||||||||||||||||||||
| 90 | { | - | ||||||||||||||||||||||||
| 91 | return widget ? widget->window()->windowHandle() : 0; | - | ||||||||||||||||||||||||
| 92 | } | - | ||||||||||||||||||||||||
| 93 | - | |||||||||||||||||||||||||
| 94 | /*! | - | ||||||||||||||||||||||||
| 95 | \class QCommonStyle | - | ||||||||||||||||||||||||
| 96 | \brief The QCommonStyle class encapsulates the common Look and Feel of a GUI. | - | ||||||||||||||||||||||||
| 97 | - | |||||||||||||||||||||||||
| 98 | \ingroup appearance | - | ||||||||||||||||||||||||
| 99 | \inmodule QtWidgets | - | ||||||||||||||||||||||||
| 100 | - | |||||||||||||||||||||||||
| 101 | This abstract class implements some of the widget's look and feel | - | ||||||||||||||||||||||||
| 102 | that is common to all GUI styles provided and shipped as part of | - | ||||||||||||||||||||||||
| 103 | Qt. | - | ||||||||||||||||||||||||
| 104 | - | |||||||||||||||||||||||||
| 105 | Since QCommonStyle inherits QStyle, all of its functions are fully documented | - | ||||||||||||||||||||||||
| 106 | in the QStyle documentation. | - | ||||||||||||||||||||||||
| 107 | \omit | - | ||||||||||||||||||||||||
| 108 | , although the | - | ||||||||||||||||||||||||
| 109 | extra functions that QCommonStyle provides, e.g. | - | ||||||||||||||||||||||||
| 110 | drawComplexControl(), drawControl(), drawPrimitive(), | - | ||||||||||||||||||||||||
| 111 | hitTestComplexControl(), subControlRect(), sizeFromContents(), and | - | ||||||||||||||||||||||||
| 112 | subElementRect() are documented here. | - | ||||||||||||||||||||||||
| 113 | \endomit | - | ||||||||||||||||||||||||
| 114 | - | |||||||||||||||||||||||||
| 115 | \sa QStyle, QProxyStyle | - | ||||||||||||||||||||||||
| 116 | */ | - | ||||||||||||||||||||||||
| 117 | - | |||||||||||||||||||||||||
| 118 | /*! | - | ||||||||||||||||||||||||
| 119 | Constructs a QCommonStyle. | - | ||||||||||||||||||||||||
| 120 | */ | - | ||||||||||||||||||||||||
| 121 | QCommonStyle::QCommonStyle() | - | ||||||||||||||||||||||||
| 122 | : QStyle(*new QCommonStylePrivate) | - | ||||||||||||||||||||||||
| 123 | { } | - | ||||||||||||||||||||||||
| 124 | - | |||||||||||||||||||||||||
| 125 | /*! \internal | - | ||||||||||||||||||||||||
| 126 | */ | - | ||||||||||||||||||||||||
| 127 | QCommonStyle::QCommonStyle(QCommonStylePrivate &dd) | - | ||||||||||||||||||||||||
| 128 | : QStyle(dd) | - | ||||||||||||||||||||||||
| 129 | { } | - | ||||||||||||||||||||||||
| 130 | - | |||||||||||||||||||||||||
| 131 | /*! | - | ||||||||||||||||||||||||
| 132 | Destroys the style. | - | ||||||||||||||||||||||||
| 133 | */ | - | ||||||||||||||||||||||||
| 134 | QCommonStyle::~QCommonStyle() | - | ||||||||||||||||||||||||
| 135 | { } | - | ||||||||||||||||||||||||
| 136 | - | |||||||||||||||||||||||||
| 137 | - | |||||||||||||||||||||||||
| 138 | /*! | - | ||||||||||||||||||||||||
| 139 | \reimp | - | ||||||||||||||||||||||||
| 140 | */ | - | ||||||||||||||||||||||||
| 141 | void QCommonStyle::drawPrimitive(PrimitiveElement pe, const QStyleOption *opt, QPainter *p, | - | ||||||||||||||||||||||||
| 142 | const QWidget *widget) const | - | ||||||||||||||||||||||||
| 143 | { | - | ||||||||||||||||||||||||
| 144 | Q_D(const QCommonStyle); | - | ||||||||||||||||||||||||
| 145 | switch (pe) { | - | ||||||||||||||||||||||||
| 146 | case PE_FrameButtonBevel: never executed: case PE_FrameButtonBevel: | 0 | ||||||||||||||||||||||||
| 147 | case PE_FrameButtonTool: never executed: case PE_FrameButtonTool: | 0 | ||||||||||||||||||||||||
| 148 | qDrawShadeRect(p, opt->rect, opt->palette, | - | ||||||||||||||||||||||||
| 149 | opt->state & (State_Sunken | State_On), 1, 0); | - | ||||||||||||||||||||||||
| 150 | break; never executed: break; | 0 | ||||||||||||||||||||||||
| 151 | case PE_PanelButtonCommand: never executed: case PE_PanelButtonCommand: | 0 | ||||||||||||||||||||||||
| 152 | case PE_PanelButtonBevel: never executed: case PE_PanelButtonBevel: | 0 | ||||||||||||||||||||||||
| 153 | case PE_PanelButtonTool: never executed: case PE_PanelButtonTool: | 0 | ||||||||||||||||||||||||
| 154 | case PE_IndicatorButtonDropDown: never executed: case PE_IndicatorButtonDropDown: | 0 | ||||||||||||||||||||||||
| 155 | qDrawShadePanel(p, opt->rect, opt->palette, | - | ||||||||||||||||||||||||
| 156 | opt->state & (State_Sunken | State_On), 1, | - | ||||||||||||||||||||||||
| 157 | &opt->palette.brush(QPalette::Button)); | - | ||||||||||||||||||||||||
| 158 | break; never executed: break; | 0 | ||||||||||||||||||||||||
| 159 | case PE_IndicatorViewItemCheck: never executed: case PE_IndicatorViewItemCheck: | 0 | ||||||||||||||||||||||||
| 160 | proxy()->drawPrimitive(PE_IndicatorCheckBox, opt, p, widget); | - | ||||||||||||||||||||||||
| 161 | break; never executed: break; | 0 | ||||||||||||||||||||||||
| 162 | case PE_IndicatorCheckBox: never executed: case PE_IndicatorCheckBox: | 0 | ||||||||||||||||||||||||
| 163 | if (opt->state & State_NoChange) {
| 0 | ||||||||||||||||||||||||
| 164 | p->setPen(opt->palette.foreground().color()); | - | ||||||||||||||||||||||||
| 165 | p->fillRect(opt->rect, opt->palette.brush(QPalette::Button)); | - | ||||||||||||||||||||||||
| 166 | p->drawRect(opt->rect); | - | ||||||||||||||||||||||||
| 167 | p->drawLine(opt->rect.topLeft(), opt->rect.bottomRight()); | - | ||||||||||||||||||||||||
| 168 | } else { never executed: end of block | 0 | ||||||||||||||||||||||||
| 169 | qDrawShadePanel(p, opt->rect.x(), opt->rect.y(), opt->rect.width(), opt->rect.height(), | - | ||||||||||||||||||||||||
| 170 | opt->palette, opt->state & (State_Sunken | State_On), 1, | - | ||||||||||||||||||||||||
| 171 | &opt->palette.brush(QPalette::Button)); | - | ||||||||||||||||||||||||
| 172 | } never executed: end of block | 0 | ||||||||||||||||||||||||
| 173 | break; never executed: break; | 0 | ||||||||||||||||||||||||
| 174 | case PE_IndicatorRadioButton: { never executed: case PE_IndicatorRadioButton: | 0 | ||||||||||||||||||||||||
| 175 | QRect ir = opt->rect; | - | ||||||||||||||||||||||||
| 176 | p->setPen(opt->palette.dark().color()); | - | ||||||||||||||||||||||||
| 177 | p->drawArc(opt->rect, 0, 5760); | - | ||||||||||||||||||||||||
| 178 | if (opt->state & (State_Sunken | State_On)) {
| 0 | ||||||||||||||||||||||||
| 179 | ir.adjust(2, 2, -2, -2); | - | ||||||||||||||||||||||||
| 180 | p->setBrush(opt->palette.foreground()); | - | ||||||||||||||||||||||||
| 181 | bool oldQt4CompatiblePainting = p->testRenderHint(QPainter::Qt4CompatiblePainting); | - | ||||||||||||||||||||||||
| 182 | p->setRenderHint(QPainter::Qt4CompatiblePainting); | - | ||||||||||||||||||||||||
| 183 | p->drawEllipse(ir); | - | ||||||||||||||||||||||||
| 184 | p->setRenderHint(QPainter::Qt4CompatiblePainting, oldQt4CompatiblePainting); | - | ||||||||||||||||||||||||
| 185 | } never executed: end of block | 0 | ||||||||||||||||||||||||
| 186 | break; } never executed: break; | 0 | ||||||||||||||||||||||||
| 187 | case PE_FrameFocusRect: never executed: case PE_FrameFocusRect: | 0 | ||||||||||||||||||||||||
| 188 | if (const QStyleOptionFocusRect *fropt = qstyleoption_cast<const QStyleOptionFocusRect *>(opt)) {
| 0 | ||||||||||||||||||||||||
| 189 | QColor bg = fropt->backgroundColor; | - | ||||||||||||||||||||||||
| 190 | QPen oldPen = p->pen(); | - | ||||||||||||||||||||||||
| 191 | if (bg.isValid()) {
| 0 | ||||||||||||||||||||||||
| 192 | int h, s, v; | - | ||||||||||||||||||||||||
| 193 | bg.getHsv(&h, &s, &v); | - | ||||||||||||||||||||||||
| 194 | if (v >= 128)
| 0 | ||||||||||||||||||||||||
| 195 | p->setPen(Qt::black); never executed: p->setPen(Qt::black); | 0 | ||||||||||||||||||||||||
| 196 | else | - | ||||||||||||||||||||||||
| 197 | p->setPen(Qt::white); never executed: p->setPen(Qt::white); | 0 | ||||||||||||||||||||||||
| 198 | } else { | - | ||||||||||||||||||||||||
| 199 | p->setPen(opt->palette.foreground().color()); | - | ||||||||||||||||||||||||
| 200 | } never executed: end of block | 0 | ||||||||||||||||||||||||
| 201 | QRect focusRect = opt->rect.adjusted(1, 1, -1, -1); | - | ||||||||||||||||||||||||
| 202 | p->drawRect(focusRect.adjusted(0, 0, -1, -1)); //draw pen inclusive | - | ||||||||||||||||||||||||
| 203 | p->setPen(oldPen); | - | ||||||||||||||||||||||||
| 204 | } never executed: end of block | 0 | ||||||||||||||||||||||||
| 205 | break; never executed: break; | 0 | ||||||||||||||||||||||||
| 206 | case PE_IndicatorMenuCheckMark: { never executed: case PE_IndicatorMenuCheckMark: | 0 | ||||||||||||||||||||||||
| 207 | const int markW = opt->rect.width() > 7 ? 7 : opt->rect.width();
| 0 | ||||||||||||||||||||||||
| 208 | const int markH = markW; | - | ||||||||||||||||||||||||
| 209 | int posX = opt->rect.x() + (opt->rect.width() - markW)/2 + 1; | - | ||||||||||||||||||||||||
| 210 | int posY = opt->rect.y() + (opt->rect.height() - markH)/2; | - | ||||||||||||||||||||||||
| 211 | - | |||||||||||||||||||||||||
| 212 | QVector<QLineF> a; | - | ||||||||||||||||||||||||
| 213 | a.reserve(markH); | - | ||||||||||||||||||||||||
| 214 | - | |||||||||||||||||||||||||
| 215 | int i, xx, yy; | - | ||||||||||||||||||||||||
| 216 | xx = posX; | - | ||||||||||||||||||||||||
| 217 | yy = 3 + posY; | - | ||||||||||||||||||||||||
| 218 | for (i = 0; i < markW/2; ++i) {
| 0 | ||||||||||||||||||||||||
| 219 | a << QLineF(xx, yy, xx, yy + 2); | - | ||||||||||||||||||||||||
| 220 | ++xx; | - | ||||||||||||||||||||||||
| 221 | ++yy; | - | ||||||||||||||||||||||||
| 222 | } never executed: end of block | 0 | ||||||||||||||||||||||||
| 223 | yy -= 2; | - | ||||||||||||||||||||||||
| 224 | for (; i < markH; ++i) {
| 0 | ||||||||||||||||||||||||
| 225 | a << QLineF(xx, yy, xx, yy + 2); | - | ||||||||||||||||||||||||
| 226 | ++xx; | - | ||||||||||||||||||||||||
| 227 | --yy; | - | ||||||||||||||||||||||||
| 228 | } never executed: end of block | 0 | ||||||||||||||||||||||||
| 229 | if (!(opt->state & State_Enabled) && !(opt->state & State_On)) {
| 0 | ||||||||||||||||||||||||
| 230 | p->save(); | - | ||||||||||||||||||||||||
| 231 | p->translate(1, 1); | - | ||||||||||||||||||||||||
| 232 | p->setPen(opt->palette.light().color()); | - | ||||||||||||||||||||||||
| 233 | p->drawLines(a); | - | ||||||||||||||||||||||||
| 234 | p->restore(); | - | ||||||||||||||||||||||||
| 235 | } never executed: end of block | 0 | ||||||||||||||||||||||||
| 236 | p->setPen((opt->state & State_On) ? opt->palette.highlightedText().color() : opt->palette.text().color()); | - | ||||||||||||||||||||||||
| 237 | p->drawLines(a); | - | ||||||||||||||||||||||||
| 238 | break; } never executed: break; | 0 | ||||||||||||||||||||||||
| 239 | case PE_Frame: never executed: case PE_Frame: | 0 | ||||||||||||||||||||||||
| 240 | case PE_FrameMenu: never executed: case PE_FrameMenu: | 0 | ||||||||||||||||||||||||
| 241 | if (const QStyleOptionFrame *frame = qstyleoption_cast<const QStyleOptionFrame *>(opt)) {
| 0 | ||||||||||||||||||||||||
| 242 | if (pe == PE_FrameMenu || (frame->state & State_Sunken) || (frame->state & State_Raised)) {
| 0 | ||||||||||||||||||||||||
| 243 | qDrawShadePanel(p, frame->rect, frame->palette, frame->state & State_Sunken, | - | ||||||||||||||||||||||||
| 244 | frame->lineWidth); | - | ||||||||||||||||||||||||
| 245 | } else { never executed: end of block | 0 | ||||||||||||||||||||||||
| 246 | qDrawPlainRect(p, frame->rect, frame->palette.foreground().color(), frame->lineWidth); | - | ||||||||||||||||||||||||
| 247 | } never executed: end of block | 0 | ||||||||||||||||||||||||
| 248 | } | - | ||||||||||||||||||||||||
| 249 | break; never executed: break; | 0 | ||||||||||||||||||||||||
| 250 | #ifndef QT_NO_TOOLBAR | - | ||||||||||||||||||||||||
| 251 | case PE_PanelMenuBar: never executed: case PE_PanelMenuBar: | 0 | ||||||||||||||||||||||||
| 252 | if (widget && qobject_cast<QToolBar *>(widget->parentWidget()))
| 0 | ||||||||||||||||||||||||
| 253 | break; never executed: break; | 0 | ||||||||||||||||||||||||
| 254 | if (const QStyleOptionFrame *frame = qstyleoption_cast<const QStyleOptionFrame *>(opt)){
| 0 | ||||||||||||||||||||||||
| 255 | qDrawShadePanel(p, frame->rect, frame->palette, false, frame->lineWidth, | - | ||||||||||||||||||||||||
| 256 | &frame->palette.brush(QPalette::Button)); | - | ||||||||||||||||||||||||
| 257 | - | |||||||||||||||||||||||||
| 258 | } never executed: end of block | 0 | ||||||||||||||||||||||||
| 259 | else if (const QStyleOptionToolBar *frame = qstyleoption_cast<const QStyleOptionToolBar *>(opt)){
| 0 | ||||||||||||||||||||||||
| 260 | qDrawShadePanel(p, frame->rect, frame->palette, false, frame->lineWidth, | - | ||||||||||||||||||||||||
| 261 | &frame->palette.brush(QPalette::Button)); | - | ||||||||||||||||||||||||
| 262 | } never executed: end of block | 0 | ||||||||||||||||||||||||
| 263 | - | |||||||||||||||||||||||||
| 264 | break; never executed: break; | 0 | ||||||||||||||||||||||||
| 265 | case PE_PanelMenu: never executed: case PE_PanelMenu: | 0 | ||||||||||||||||||||||||
| 266 | break; never executed: break; | 0 | ||||||||||||||||||||||||
| 267 | case PE_PanelToolBar: never executed: case PE_PanelToolBar: | 0 | ||||||||||||||||||||||||
| 268 | break; never executed: break; | 0 | ||||||||||||||||||||||||
| 269 | #endif // QT_NO_TOOLBAR | - | ||||||||||||||||||||||||
| 270 | #ifndef QT_NO_PROGRESSBAR | - | ||||||||||||||||||||||||
| 271 | case PE_IndicatorProgressChunk: never executed: case PE_IndicatorProgressChunk: | 0 | ||||||||||||||||||||||||
| 272 | { | - | ||||||||||||||||||||||||
| 273 | bool vertical = false; | - | ||||||||||||||||||||||||
| 274 | if (const QStyleOptionProgressBar *pb = qstyleoption_cast<const QStyleOptionProgressBar *>(opt))
| 0 | ||||||||||||||||||||||||
| 275 | vertical = pb->orientation == Qt::Vertical; never executed: vertical = pb->orientation == Qt::Vertical; | 0 | ||||||||||||||||||||||||
| 276 | if (!vertical) {
| 0 | ||||||||||||||||||||||||
| 277 | p->fillRect(opt->rect.x(), opt->rect.y() + 3, opt->rect.width() -2, opt->rect.height() - 6, | - | ||||||||||||||||||||||||
| 278 | opt->palette.brush(QPalette::Highlight)); | - | ||||||||||||||||||||||||
| 279 | } else { never executed: end of block | 0 | ||||||||||||||||||||||||
| 280 | p->fillRect(opt->rect.x() + 2, opt->rect.y(), opt->rect.width() -6, opt->rect.height() - 2, | - | ||||||||||||||||||||||||
| 281 | opt->palette.brush(QPalette::Highlight)); | - | ||||||||||||||||||||||||
| 282 | } never executed: end of block | 0 | ||||||||||||||||||||||||
| 283 | } | - | ||||||||||||||||||||||||
| 284 | break; never executed: break; | 0 | ||||||||||||||||||||||||
| 285 | #endif // QT_NO_PROGRESSBAR | - | ||||||||||||||||||||||||
| 286 | case PE_IndicatorBranch: { never executed: case PE_IndicatorBranch: | 0 | ||||||||||||||||||||||||
| 287 | static const int decoration_size = 9; | - | ||||||||||||||||||||||||
| 288 | int mid_h = opt->rect.x() + opt->rect.width() / 2; | - | ||||||||||||||||||||||||
| 289 | int mid_v = opt->rect.y() + opt->rect.height() / 2; | - | ||||||||||||||||||||||||
| 290 | int bef_h = mid_h; | - | ||||||||||||||||||||||||
| 291 | int bef_v = mid_v; | - | ||||||||||||||||||||||||
| 292 | int aft_h = mid_h; | - | ||||||||||||||||||||||||
| 293 | int aft_v = mid_v; | - | ||||||||||||||||||||||||
| 294 | if (opt->state & State_Children) {
| 0 | ||||||||||||||||||||||||
| 295 | int delta = decoration_size / 2; | - | ||||||||||||||||||||||||
| 296 | bef_h -= delta; | - | ||||||||||||||||||||||||
| 297 | bef_v -= delta; | - | ||||||||||||||||||||||||
| 298 | aft_h += delta; | - | ||||||||||||||||||||||||
| 299 | aft_v += delta; | - | ||||||||||||||||||||||||
| 300 | p->drawLine(bef_h + 2, bef_v + 4, bef_h + 6, bef_v + 4); | - | ||||||||||||||||||||||||
| 301 | if (!(opt->state & State_Open))
| 0 | ||||||||||||||||||||||||
| 302 | 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 | ||||||||||||||||||||||||
| 303 | QPen oldPen = p->pen(); | - | ||||||||||||||||||||||||
| 304 | p->setPen(opt->palette.dark().color()); | - | ||||||||||||||||||||||||
| 305 | p->drawRect(bef_h, bef_v, decoration_size - 1, decoration_size - 1); | - | ||||||||||||||||||||||||
| 306 | p->setPen(oldPen); | - | ||||||||||||||||||||||||
| 307 | } never executed: end of block | 0 | ||||||||||||||||||||||||
| 308 | QBrush brush(opt->palette.dark().color(), Qt::Dense4Pattern); | - | ||||||||||||||||||||||||
| 309 | if (opt->state & State_Item) {
| 0 | ||||||||||||||||||||||||
| 310 | if (opt->direction == Qt::RightToLeft)
| 0 | ||||||||||||||||||||||||
| 311 | 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 | ||||||||||||||||||||||||
| 312 | else | - | ||||||||||||||||||||||||
| 313 | 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 | ||||||||||||||||||||||||
| 314 | } | - | ||||||||||||||||||||||||
| 315 | if (opt->state & State_Sibling)
| 0 | ||||||||||||||||||||||||
| 316 | 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 | ||||||||||||||||||||||||
| 317 | if (opt->state & (State_Open | State_Children | State_Item | State_Sibling))
| 0 | ||||||||||||||||||||||||
| 318 | 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 | ||||||||||||||||||||||||
| 319 | break; } never executed: break; | 0 | ||||||||||||||||||||||||
| 320 | case PE_FrameStatusBarItem: never executed: case PE_FrameStatusBarItem: | 0 | ||||||||||||||||||||||||
| 321 | qDrawShadeRect(p, opt->rect, opt->palette, true, 1, 0, 0); | - | ||||||||||||||||||||||||
| 322 | break; never executed: break; | 0 | ||||||||||||||||||||||||
| 323 | case PE_IndicatorHeaderArrow: never executed: case PE_IndicatorHeaderArrow: | 0 | ||||||||||||||||||||||||
| 324 | if (const QStyleOptionHeader *header = qstyleoption_cast<const QStyleOptionHeader *>(opt)) {
| 0 | ||||||||||||||||||||||||
| 325 | QPen oldPen = p->pen(); | - | ||||||||||||||||||||||||
| 326 | if (header->sortIndicator & QStyleOptionHeader::SortUp) {
| 0 | ||||||||||||||||||||||||
| 327 | p->setPen(QPen(opt->palette.light(), 0)); | - | ||||||||||||||||||||||||
| 328 | p->drawLine(opt->rect.x() + opt->rect.width(), opt->rect.y(), | - | ||||||||||||||||||||||||
| 329 | opt->rect.x() + opt->rect.width() / 2, opt->rect.y() + opt->rect.height()); | - | ||||||||||||||||||||||||
| 330 | p->setPen(QPen(opt->palette.dark(), 0)); | - | ||||||||||||||||||||||||
| 331 | const QPoint points[] = { | - | ||||||||||||||||||||||||
| 332 | QPoint(opt->rect.x() + opt->rect.width() / 2, opt->rect.y() + opt->rect.height()), | - | ||||||||||||||||||||||||
| 333 | QPoint(opt->rect.x(), opt->rect.y()), | - | ||||||||||||||||||||||||
| 334 | QPoint(opt->rect.x() + opt->rect.width(), opt->rect.y()), | - | ||||||||||||||||||||||||
| 335 | }; | - | ||||||||||||||||||||||||
| 336 | p->drawPolyline(points, sizeof points / sizeof *points); | - | ||||||||||||||||||||||||
| 337 | } else if (header->sortIndicator & QStyleOptionHeader::SortDown) { never executed: end of block
| 0 | ||||||||||||||||||||||||
| 338 | p->setPen(QPen(opt->palette.light(), 0)); | - | ||||||||||||||||||||||||
| 339 | const QPoint points[] = { | - | ||||||||||||||||||||||||
| 340 | QPoint(opt->rect.x(), opt->rect.y() + opt->rect.height()), | - | ||||||||||||||||||||||||
| 341 | QPoint(opt->rect.x() + opt->rect.width(), opt->rect.y() + opt->rect.height()), | - | ||||||||||||||||||||||||
| 342 | QPoint(opt->rect.x() + opt->rect.width() / 2, opt->rect.y()), | - | ||||||||||||||||||||||||
| 343 | }; | - | ||||||||||||||||||||||||
| 344 | p->drawPolyline(points, sizeof points / sizeof *points); | - | ||||||||||||||||||||||||
| 345 | p->setPen(QPen(opt->palette.dark(), 0)); | - | ||||||||||||||||||||||||
| 346 | p->drawLine(opt->rect.x(), opt->rect.y() + opt->rect.height(), | - | ||||||||||||||||||||||||
| 347 | opt->rect.x() + opt->rect.width() / 2, opt->rect.y()); | - | ||||||||||||||||||||||||
| 348 | } never executed: end of block | 0 | ||||||||||||||||||||||||
| 349 | p->setPen(oldPen); | - | ||||||||||||||||||||||||
| 350 | } never executed: end of block | 0 | ||||||||||||||||||||||||
| 351 | break; never executed: break; | 0 | ||||||||||||||||||||||||
| 352 | #ifndef QT_NO_TABBAR | - | ||||||||||||||||||||||||
| 353 | case PE_FrameTabBarBase: never executed: case PE_FrameTabBarBase: | 0 | ||||||||||||||||||||||||
| 354 | if (const QStyleOptionTabBarBase *tbb
| 0 | ||||||||||||||||||||||||
| 355 | = qstyleoption_cast<const QStyleOptionTabBarBase *>(opt)) {
| 0 | ||||||||||||||||||||||||
| 356 | p->save(); | - | ||||||||||||||||||||||||
| 357 | switch (tbb->shape) { | - | ||||||||||||||||||||||||
| 358 | case QTabBar::RoundedNorth: never executed: case QTabBar::RoundedNorth: | 0 | ||||||||||||||||||||||||
| 359 | case QTabBar::TriangularNorth: never executed: case QTabBar::TriangularNorth: | 0 | ||||||||||||||||||||||||
| 360 | p->setPen(QPen(tbb->palette.light(), 0)); | - | ||||||||||||||||||||||||
| 361 | p->drawLine(tbb->rect.topLeft(), tbb->rect.topRight()); | - | ||||||||||||||||||||||||
| 362 | break; never executed: break; | 0 | ||||||||||||||||||||||||
| 363 | case QTabBar::RoundedWest: never executed: case QTabBar::RoundedWest: | 0 | ||||||||||||||||||||||||
| 364 | case QTabBar::TriangularWest: never executed: case QTabBar::TriangularWest: | 0 | ||||||||||||||||||||||||
| 365 | p->setPen(QPen(tbb->palette.light(), 0)); | - | ||||||||||||||||||||||||
| 366 | p->drawLine(tbb->rect.topLeft(), tbb->rect.bottomLeft()); | - | ||||||||||||||||||||||||
| 367 | break; never executed: break; | 0 | ||||||||||||||||||||||||
| 368 | case QTabBar::RoundedSouth: never executed: case QTabBar::RoundedSouth: | 0 | ||||||||||||||||||||||||
| 369 | case QTabBar::TriangularSouth: never executed: case QTabBar::TriangularSouth: | 0 | ||||||||||||||||||||||||
| 370 | p->setPen(QPen(tbb->palette.shadow(), 0)); | - | ||||||||||||||||||||||||
| 371 | p->drawLine(tbb->rect.left(), tbb->rect.bottom(), | - | ||||||||||||||||||||||||
| 372 | tbb->rect.right(), tbb->rect.bottom()); | - | ||||||||||||||||||||||||
| 373 | p->setPen(QPen(tbb->palette.dark(), 0)); | - | ||||||||||||||||||||||||
| 374 | p->drawLine(tbb->rect.left(), tbb->rect.bottom() - 1, | - | ||||||||||||||||||||||||
| 375 | tbb->rect.right() - 1, tbb->rect.bottom() - 1); | - | ||||||||||||||||||||||||
| 376 | break; never executed: break; | 0 | ||||||||||||||||||||||||
| 377 | case QTabBar::RoundedEast: never executed: case QTabBar::RoundedEast: | 0 | ||||||||||||||||||||||||
| 378 | case QTabBar::TriangularEast: never executed: case QTabBar::TriangularEast: | 0 | ||||||||||||||||||||||||
| 379 | p->setPen(QPen(tbb->palette.dark(), 0)); | - | ||||||||||||||||||||||||
| 380 | p->drawLine(tbb->rect.topRight(), tbb->rect.bottomRight()); | - | ||||||||||||||||||||||||
| 381 | break; never executed: break; | 0 | ||||||||||||||||||||||||
| 382 | } | - | ||||||||||||||||||||||||
| 383 | p->restore(); | - | ||||||||||||||||||||||||
| 384 | } never executed: end of block | 0 | ||||||||||||||||||||||||
| 385 | break; never executed: break; | 0 | ||||||||||||||||||||||||
| 386 | case PE_IndicatorTabClose: { never executed: case PE_IndicatorTabClose: | 0 | ||||||||||||||||||||||||
| 387 | if (d->tabBarcloseButtonIcon.isNull()) {
| 0 | ||||||||||||||||||||||||
| 388 | d->tabBarcloseButtonIcon.addPixmap(QPixmap( | - | ||||||||||||||||||||||||
| 389 | QLatin1String(":/qt-project.org/styles/commonstyle/images/standardbutton-closetab-16.png")), | - | ||||||||||||||||||||||||
| 390 | QIcon::Normal, QIcon::Off); | - | ||||||||||||||||||||||||
| 391 | d->tabBarcloseButtonIcon.addPixmap(QPixmap( | - | ||||||||||||||||||||||||
| 392 | QLatin1String(":/qt-project.org/styles/commonstyle/images/standardbutton-closetab-down-16.png")), | - | ||||||||||||||||||||||||
| 393 | QIcon::Normal, QIcon::On); | - | ||||||||||||||||||||||||
| 394 | d->tabBarcloseButtonIcon.addPixmap(QPixmap( | - | ||||||||||||||||||||||||
| 395 | QLatin1String(":/qt-project.org/styles/commonstyle/images/standardbutton-closetab-hover-16.png")), | - | ||||||||||||||||||||||||
| 396 | QIcon::Active, QIcon::Off); | - | ||||||||||||||||||||||||
| 397 | } never executed: end of block | 0 | ||||||||||||||||||||||||
| 398 | - | |||||||||||||||||||||||||
| 399 | int size = proxy()->pixelMetric(QStyle::PM_SmallIconSize); | - | ||||||||||||||||||||||||
| 400 | QIcon::Mode mode = opt->state & State_Enabled ?
| 0 | ||||||||||||||||||||||||
| 401 | (opt->state & State_Raised ? QIcon::Active : QIcon::Normal)
| 0 | ||||||||||||||||||||||||
| 402 | : QIcon::Disabled; | - | ||||||||||||||||||||||||
| 403 | if (!(opt->state & State_Raised)
| 0 | ||||||||||||||||||||||||
| 404 | && !(opt->state & State_Sunken)
| 0 | ||||||||||||||||||||||||
| 405 | && !(opt->state & QStyle::State_Selected))
| 0 | ||||||||||||||||||||||||
| 406 | mode = QIcon::Disabled; never executed: mode = QIcon::Disabled; | 0 | ||||||||||||||||||||||||
| 407 | - | |||||||||||||||||||||||||
| 408 | QIcon::State state = opt->state & State_Sunken ? QIcon::On : QIcon::Off;
| 0 | ||||||||||||||||||||||||
| 409 | QPixmap pixmap = d->tabBarcloseButtonIcon.pixmap(qt_getWindow(widget), QSize(size, size), mode, state); | - | ||||||||||||||||||||||||
| 410 | proxy()->drawItemPixmap(p, opt->rect, Qt::AlignCenter, pixmap); | - | ||||||||||||||||||||||||
| 411 | break; never executed: break; | 0 | ||||||||||||||||||||||||
| 412 | } | - | ||||||||||||||||||||||||
| 413 | #endif // QT_NO_TABBAR | - | ||||||||||||||||||||||||
| 414 | case PE_FrameTabWidget: never executed: case PE_FrameTabWidget: | 0 | ||||||||||||||||||||||||
| 415 | case PE_FrameWindow: never executed: case PE_FrameWindow: | 0 | ||||||||||||||||||||||||
| 416 | qDrawWinPanel(p, opt->rect, opt->palette, false, 0); | - | ||||||||||||||||||||||||
| 417 | break; never executed: break; | 0 | ||||||||||||||||||||||||
| 418 | case PE_FrameLineEdit: never executed: case PE_FrameLineEdit: | 0 | ||||||||||||||||||||||||
| 419 | proxy()->drawPrimitive(PE_Frame, opt, p, widget); | - | ||||||||||||||||||||||||
| 420 | break; never executed: break; | 0 | ||||||||||||||||||||||||
| 421 | #ifndef QT_NO_GROUPBOX | - | ||||||||||||||||||||||||
| 422 | case PE_FrameGroupBox: never executed: case PE_FrameGroupBox: | 0 | ||||||||||||||||||||||||
| 423 | if (const QStyleOptionFrame *frame = qstyleoption_cast<const QStyleOptionFrame *>(opt)) {
| 0 | ||||||||||||||||||||||||
| 424 | if (frame->features & QStyleOptionFrame::Flat) {
| 0 | ||||||||||||||||||||||||
| 425 | QRect fr = frame->rect; | - | ||||||||||||||||||||||||
| 426 | QPoint p1(fr.x(), fr.y() + 1); | - | ||||||||||||||||||||||||
| 427 | QPoint p2(fr.x() + fr.width(), p1.y()); | - | ||||||||||||||||||||||||
| 428 | qDrawShadeLine(p, p1, p2, frame->palette, true, | - | ||||||||||||||||||||||||
| 429 | frame->lineWidth, frame->midLineWidth); | - | ||||||||||||||||||||||||
| 430 | } else { never executed: end of block | 0 | ||||||||||||||||||||||||
| 431 | qDrawShadeRect(p, frame->rect.x(), frame->rect.y(), frame->rect.width(), | - | ||||||||||||||||||||||||
| 432 | frame->rect.height(), frame->palette, true, | - | ||||||||||||||||||||||||
| 433 | frame->lineWidth, frame->midLineWidth); | - | ||||||||||||||||||||||||
| 434 | } never executed: end of block | 0 | ||||||||||||||||||||||||
| 435 | } | - | ||||||||||||||||||||||||
| 436 | break; never executed: break; | 0 | ||||||||||||||||||||||||
| 437 | #endif // QT_NO_GROUPBOX | - | ||||||||||||||||||||||||
| 438 | #ifndef QT_NO_DOCKWIDGET | - | ||||||||||||||||||||||||
| 439 | case PE_FrameDockWidget: never executed: case PE_FrameDockWidget: | 0 | ||||||||||||||||||||||||
| 440 | if (const QStyleOptionFrame *frame = qstyleoption_cast<const QStyleOptionFrame *>(opt)) {
| 0 | ||||||||||||||||||||||||
| 441 | int lw = frame->lineWidth; | - | ||||||||||||||||||||||||
| 442 | if (lw <= 0)
| 0 | ||||||||||||||||||||||||
| 443 | lw = proxy()->pixelMetric(PM_DockWidgetFrameWidth); never executed: lw = proxy()->pixelMetric(PM_DockWidgetFrameWidth); | 0 | ||||||||||||||||||||||||
| 444 | - | |||||||||||||||||||||||||
| 445 | qDrawShadePanel(p, frame->rect, frame->palette, false, lw); | - | ||||||||||||||||||||||||
| 446 | } never executed: end of block | 0 | ||||||||||||||||||||||||
| 447 | break; never executed: break; | 0 | ||||||||||||||||||||||||
| 448 | #endif // QT_NO_DOCKWIDGET | - | ||||||||||||||||||||||||
| 449 | #ifndef QT_NO_TOOLBAR | - | ||||||||||||||||||||||||
| 450 | case PE_IndicatorToolBarHandle: never executed: case PE_IndicatorToolBarHandle: | 0 | ||||||||||||||||||||||||
| 451 | p->save(); | - | ||||||||||||||||||||||||
| 452 | p->translate(opt->rect.x(), opt->rect.y()); | - | ||||||||||||||||||||||||
| 453 | if (opt->state & State_Horizontal) {
| 0 | ||||||||||||||||||||||||
| 454 | int x = opt->rect.width() / 3; | - | ||||||||||||||||||||||||
| 455 | if (opt->direction == Qt::RightToLeft)
| 0 | ||||||||||||||||||||||||
| 456 | x -= 2; never executed: x -= 2; | 0 | ||||||||||||||||||||||||
| 457 | if (opt->rect.height() > 4) {
| 0 | ||||||||||||||||||||||||
| 458 | qDrawShadePanel(p, x, 2, 3, opt->rect.height() - 4, | - | ||||||||||||||||||||||||
| 459 | opt->palette, false, 1, 0); | - | ||||||||||||||||||||||||
| 460 | qDrawShadePanel(p, x+3, 2, 3, opt->rect.height() - 4, | - | ||||||||||||||||||||||||
| 461 | opt->palette, false, 1, 0); | - | ||||||||||||||||||||||||
| 462 | } never executed: end of block | 0 | ||||||||||||||||||||||||
| 463 | } else { never executed: end of block | 0 | ||||||||||||||||||||||||
| 464 | if (opt->rect.width() > 4) {
| 0 | ||||||||||||||||||||||||
| 465 | int y = opt->rect.height() / 3; | - | ||||||||||||||||||||||||
| 466 | qDrawShadePanel(p, 2, y, opt->rect.width() - 4, 3, | - | ||||||||||||||||||||||||
| 467 | opt->palette, false, 1, 0); | - | ||||||||||||||||||||||||
| 468 | qDrawShadePanel(p, 2, y+3, opt->rect.width() - 4, 3, | - | ||||||||||||||||||||||||
| 469 | opt->palette, false, 1, 0); | - | ||||||||||||||||||||||||
| 470 | } never executed: end of block | 0 | ||||||||||||||||||||||||
| 471 | } never executed: end of block | 0 | ||||||||||||||||||||||||
| 472 | p->restore(); | - | ||||||||||||||||||||||||
| 473 | break; never executed: break; | 0 | ||||||||||||||||||||||||
| 474 | case PE_IndicatorToolBarSeparator: never executed: case PE_IndicatorToolBarSeparator: | 0 | ||||||||||||||||||||||||
| 475 | { | - | ||||||||||||||||||||||||
| 476 | QPoint p1, p2; | - | ||||||||||||||||||||||||
| 477 | if (opt->state & State_Horizontal) {
| 0 | ||||||||||||||||||||||||
| 478 | p1 = QPoint(opt->rect.width()/2, 0); | - | ||||||||||||||||||||||||
| 479 | p2 = QPoint(p1.x(), opt->rect.height()); | - | ||||||||||||||||||||||||
| 480 | } else { never executed: end of block | 0 | ||||||||||||||||||||||||
| 481 | p1 = QPoint(0, opt->rect.height()/2); | - | ||||||||||||||||||||||||
| 482 | p2 = QPoint(opt->rect.width(), p1.y()); | - | ||||||||||||||||||||||||
| 483 | } never executed: end of block | 0 | ||||||||||||||||||||||||
| 484 | qDrawShadeLine(p, p1, p2, opt->palette, 1, 1, 0); | - | ||||||||||||||||||||||||
| 485 | break; never executed: break; | 0 | ||||||||||||||||||||||||
| 486 | } | - | ||||||||||||||||||||||||
| 487 | #endif // QT_NO_TOOLBAR | - | ||||||||||||||||||||||||
| 488 | #ifndef QT_NO_SPINBOX | - | ||||||||||||||||||||||||
| 489 | case PE_IndicatorSpinPlus: never executed: case PE_IndicatorSpinPlus: | 0 | ||||||||||||||||||||||||
| 490 | case PE_IndicatorSpinMinus: { never executed: case PE_IndicatorSpinMinus: | 0 | ||||||||||||||||||||||||
| 491 | QRect r = opt->rect; | - | ||||||||||||||||||||||||
| 492 | int fw = proxy()->pixelMetric(PM_DefaultFrameWidth, opt, widget); | - | ||||||||||||||||||||||||
| 493 | QRect br = r.adjusted(fw, fw, -fw, -fw); | - | ||||||||||||||||||||||||
| 494 | - | |||||||||||||||||||||||||
| 495 | int offset = (opt->state & State_Sunken) ? 1 : 0;
| 0 | ||||||||||||||||||||||||
| 496 | int step = (br.width() + 4) / 5; | - | ||||||||||||||||||||||||
| 497 | p->fillRect(br.x() + offset, br.y() + offset +br.height() / 2 - step / 2, | - | ||||||||||||||||||||||||
| 498 | br.width(), step, | - | ||||||||||||||||||||||||
| 499 | opt->palette.buttonText()); | - | ||||||||||||||||||||||||
| 500 | if (pe == PE_IndicatorSpinPlus)
| 0 | ||||||||||||||||||||||||
| 501 | 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 | ||||||||||||||||||||||||
| 502 | 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 | ||||||||||||||||||||||||
| 503 | 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 | ||||||||||||||||||||||||
| 504 | - | |||||||||||||||||||||||||
| 505 | break; } never executed: break; | 0 | ||||||||||||||||||||||||
| 506 | case PE_IndicatorSpinUp: never executed: case PE_IndicatorSpinUp: | 0 | ||||||||||||||||||||||||
| 507 | case PE_IndicatorSpinDown: { never executed: case PE_IndicatorSpinDown: | 0 | ||||||||||||||||||||||||
| 508 | QRect r = opt->rect; | - | ||||||||||||||||||||||||
| 509 | int fw = proxy()->pixelMetric(PM_DefaultFrameWidth, opt, widget); | - | ||||||||||||||||||||||||
| 510 | // QRect br = r.adjusted(fw, fw, -fw, -fw); | - | ||||||||||||||||||||||||
| 511 | int x = r.x(), y = r.y(), w = r.width(), h = r.height(); | - | ||||||||||||||||||||||||
| 512 | int sw = w-4; | - | ||||||||||||||||||||||||
| 513 | if (sw < 3)
| 0 | ||||||||||||||||||||||||
| 514 | break; never executed: break; | 0 | ||||||||||||||||||||||||
| 515 | else if (!(sw & 1))
| 0 | ||||||||||||||||||||||||
| 516 | sw--; never executed: sw--; | 0 | ||||||||||||||||||||||||
| 517 | sw -= (sw / 7) * 2; // Empty border | - | ||||||||||||||||||||||||
| 518 | int sh = sw/2 + 2; // Must have empty row at foot of arrow | - | ||||||||||||||||||||||||
| 519 | - | |||||||||||||||||||||||||
| 520 | int sx = x + w / 2 - sw / 2; | - | ||||||||||||||||||||||||
| 521 | int sy = y + h / 2 - sh / 2; | - | ||||||||||||||||||||||||
| 522 | - | |||||||||||||||||||||||||
| 523 | if (pe == PE_IndicatorSpinUp && fw)
| 0 | ||||||||||||||||||||||||
| 524 | --sy; never executed: --sy; | 0 | ||||||||||||||||||||||||
| 525 | - | |||||||||||||||||||||||||
| 526 | int bsx = 0; | - | ||||||||||||||||||||||||
| 527 | int bsy = 0; | - | ||||||||||||||||||||||||
| 528 | if (opt->state & State_Sunken) {
| 0 | ||||||||||||||||||||||||
| 529 | bsx = proxy()->pixelMetric(PM_ButtonShiftHorizontal); | - | ||||||||||||||||||||||||
| 530 | bsy = proxy()->pixelMetric(PM_ButtonShiftVertical); | - | ||||||||||||||||||||||||
| 531 | } never executed: end of block | 0 | ||||||||||||||||||||||||
| 532 | p->save(); | - | ||||||||||||||||||||||||
| 533 | p->translate(sx + bsx, sy + bsy); | - | ||||||||||||||||||||||||
| 534 | p->setPen(opt->palette.buttonText().color()); | - | ||||||||||||||||||||||||
| 535 | p->setBrush(opt->palette.buttonText()); | - | ||||||||||||||||||||||||
| 536 | p->setRenderHint(QPainter::Qt4CompatiblePainting); | - | ||||||||||||||||||||||||
| 537 | if (pe == PE_IndicatorSpinDown) {
| 0 | ||||||||||||||||||||||||
| 538 | const QPoint points[] = { QPoint(0, 1), QPoint(sw-1, 1), QPoint(sh-2, sh-1) }; | - | ||||||||||||||||||||||||
| 539 | p->drawPolygon(points, sizeof points / sizeof *points); | - | ||||||||||||||||||||||||
| 540 | } else { never executed: end of block | 0 | ||||||||||||||||||||||||
| 541 | const QPoint points[] = { QPoint(0, sh-1), QPoint(sw-1, sh-1), QPoint(sh-2, 1) }; | - | ||||||||||||||||||||||||
| 542 | p->drawPolygon(points, sizeof points / sizeof *points); | - | ||||||||||||||||||||||||
| 543 | } never executed: end of block | 0 | ||||||||||||||||||||||||
| 544 | p->restore(); | - | ||||||||||||||||||||||||
| 545 | break; } never executed: break; | 0 | ||||||||||||||||||||||||
| 546 | #endif // QT_NO_SPINBOX | - | ||||||||||||||||||||||||
| 547 | case PE_PanelTipLabel: { never executed: case PE_PanelTipLabel: | 0 | ||||||||||||||||||||||||
| 548 | QBrush oldBrush = p->brush(); | - | ||||||||||||||||||||||||
| 549 | QPen oldPen = p->pen(); | - | ||||||||||||||||||||||||
| 550 | p->setPen(QPen(opt->palette.toolTipText(), 0)); | - | ||||||||||||||||||||||||
| 551 | p->setBrush(opt->palette.toolTipBase()); | - | ||||||||||||||||||||||||
| 552 | p->drawRect(opt->rect.adjusted(0, 0, -1, -1)); | - | ||||||||||||||||||||||||
| 553 | p->setPen(oldPen); | - | ||||||||||||||||||||||||
| 554 | p->setBrush(oldBrush); | - | ||||||||||||||||||||||||
| 555 | break; never executed: break; | 0 | ||||||||||||||||||||||||
| 556 | } | - | ||||||||||||||||||||||||
| 557 | #ifndef QT_NO_TABBAR | - | ||||||||||||||||||||||||
| 558 | case PE_IndicatorTabTear: never executed: case PE_IndicatorTabTear: | 0 | ||||||||||||||||||||||||
| 559 | if (const QStyleOptionTab *tab = qstyleoption_cast<const QStyleOptionTab *>(opt)) {
| 0 | ||||||||||||||||||||||||
| 560 | bool rtl = tab->direction == Qt::RightToLeft; | - | ||||||||||||||||||||||||
| 561 | QRect rectconst bool horizontal = tab->rect.height() > tab->rect.width(); | - | ||||||||||||||||||||||||
| 562 | const int margin = 4; | - | ||||||||||||||||||||||||
| 563 | QPainterPath path; | - | ||||||||||||||||||||||||
| 564 | - | |||||||||||||||||||||||||
| 565 | if (horizontal) {
| 0 | ||||||||||||||||||||||||
| 566 | QRect rect = tab->rect.adjusted(rtl ? margin : 0, 0, rtl ? 1 : -margin, 0); | - | ||||||||||||||||||||||||
| 567 | rect.setTop(rect.top() + ((tab->state & State_Selected) ? 1 : 3)); | - | ||||||||||||||||||||||||
| 568 | rect.setBottom(rect.bottom() - ((tab->state & State_Selected) ? 0 : 2)); | - | ||||||||||||||||||||||||
| 569 | - | |||||||||||||||||||||||||
| 570 | path.moveTo(QPoint(rtl ? rect.right() : rect.left(), rect.top())); | - | ||||||||||||||||||||||||
| 571 | int count = 4; | - | ||||||||||||||||||||||||
| 572 | for (int jags = 1; jags <= count; ++jags, rtl = !rtl)
| 0 | ||||||||||||||||||||||||
| 573 | 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 | ||||||||||||||||||||||||
| 574 | } else { never executed: end of block | 0 | ||||||||||||||||||||||||
| 575 | QRect rect = tab->rect.adjusted(0, 0, 0, -margin); | - | ||||||||||||||||||||||||
| 576 | rect.setLeft(rect.left() + ((tab->state & State_Selected) ? 1 : 3)); | - | ||||||||||||||||||||||||
| 577 | rect.setRight(rect.right() - ((tab->state & State_Selected) ? 0 : 2)); | - | ||||||||||||||||||||||||
| 578 | - | |||||||||||||||||||||||||
| 579 | path.moveTo(QPoint(rect.left(), rect.top())); | - | ||||||||||||||||||||||||
| 580 | int count = 4; | - | ||||||||||||||||||||||||
| 581 | for (int jags = 1; jags <= count; ++jags, rtl = !rtl)
| 0 | ||||||||||||||||||||||||
| 582 | path.lineTo(QPoint(rect.left() + jags * rect.width()/count, rtl ? rect.top() : rect.bottom())); never executed: path.lineTo(QPoint(rect.left() + jags * rect.width()/count, rtl ? rect.top() : rect.bottom())); | 0 | ||||||||||||||||||||||||
| 583 | } never executed: end of block | 0 | ||||||||||||||||||||||||
| 584 | - | |||||||||||||||||||||||||
| 585 | p->setPen(QPen(tab->palette.lightdark(), qreal(.8))); | - | ||||||||||||||||||||||||
| 586 | p->setBrush(tab->palette.background()); | - | ||||||||||||||||||||||||
| 587 | p->setRenderHint(QPainter::Antialiasing); | - | ||||||||||||||||||||||||
| 588 | p->drawPath(path); | - | ||||||||||||||||||||||||
| 589 | } never executed: end of block | 0 | ||||||||||||||||||||||||
| 590 | break; never executed: break; | 0 | ||||||||||||||||||||||||
| 591 | #endif // QT_NO_TABBAR | - | ||||||||||||||||||||||||
| 592 | #ifndef QT_NO_LINEEDIT | - | ||||||||||||||||||||||||
| 593 | case PE_PanelLineEdit: never executed: case PE_PanelLineEdit: | 0 | ||||||||||||||||||||||||
| 594 | if (const QStyleOptionFrame *panel = qstyleoption_cast<const QStyleOptionFrame *>(opt)) {
| 0 | ||||||||||||||||||||||||
| 595 | p->fillRect(panel->rect.adjusted(panel->lineWidth, panel->lineWidth, -panel->lineWidth, -panel->lineWidth), | - | ||||||||||||||||||||||||
| 596 | panel->palette.brush(QPalette::Base)); | - | ||||||||||||||||||||||||
| 597 | - | |||||||||||||||||||||||||
| 598 | if (panel->lineWidth > 0)
| 0 | ||||||||||||||||||||||||
| 599 | proxy()->drawPrimitive(PE_FrameLineEdit, panel, p, widget); never executed: proxy()->drawPrimitive(PE_FrameLineEdit, panel, p, widget); | 0 | ||||||||||||||||||||||||
| 600 | } never executed: end of block | 0 | ||||||||||||||||||||||||
| 601 | break; never executed: break; | 0 | ||||||||||||||||||||||||
| 602 | #endif // QT_NO_LINEEDIT | - | ||||||||||||||||||||||||
| 603 | #ifndef QT_NO_COLUMNVIEW | - | ||||||||||||||||||||||||
| 604 | case PE_IndicatorColumnViewArrow: { never executed: case PE_IndicatorColumnViewArrow: | 0 | ||||||||||||||||||||||||
| 605 | if (const QStyleOptionViewItem *viewOpt = qstyleoption_cast<const QStyleOptionViewItem *>(opt)) {
| 0 | ||||||||||||||||||||||||
| 606 | bool reverse = (viewOpt->direction == Qt::RightToLeft); | - | ||||||||||||||||||||||||
| 607 | p->save(); | - | ||||||||||||||||||||||||
| 608 | QPainterPath path; | - | ||||||||||||||||||||||||
| 609 | int x = viewOpt->rect.x() + 1; | - | ||||||||||||||||||||||||
| 610 | int offset = (viewOpt->rect.height() / 3); | - | ||||||||||||||||||||||||
| 611 | int height = (viewOpt->rect.height()) - offset * 2; | - | ||||||||||||||||||||||||
| 612 | if (height % 2 == 1)
| 0 | ||||||||||||||||||||||||
| 613 | --height; never executed: --height; | 0 | ||||||||||||||||||||||||
| 614 | int x2 = x + height - 1; | - | ||||||||||||||||||||||||
| 615 | if (reverse) {
| 0 | ||||||||||||||||||||||||
| 616 | x = viewOpt->rect.x() + viewOpt->rect.width() - 1; | - | ||||||||||||||||||||||||
| 617 | x2 = x - height + 1; | - | ||||||||||||||||||||||||
| 618 | } never executed: end of block | 0 | ||||||||||||||||||||||||
| 619 | path.moveTo(x, viewOpt->rect.y() + offset); | - | ||||||||||||||||||||||||
| 620 | path.lineTo(x, viewOpt->rect.y() + offset + height); | - | ||||||||||||||||||||||||
| 621 | path.lineTo(x2, viewOpt->rect.y() + offset+height/2); | - | ||||||||||||||||||||||||
| 622 | path.closeSubpath(); | - | ||||||||||||||||||||||||
| 623 | if (viewOpt->state & QStyle::State_Selected ) {
| 0 | ||||||||||||||||||||||||
| 624 | if (viewOpt->showDecorationSelected) {
| 0 | ||||||||||||||||||||||||
| 625 | QColor color = viewOpt->palette.color(QPalette::Active, QPalette::HighlightedText); | - | ||||||||||||||||||||||||
| 626 | p->setPen(color); | - | ||||||||||||||||||||||||
| 627 | p->setBrush(color); | - | ||||||||||||||||||||||||
| 628 | } else { never executed: end of block | 0 | ||||||||||||||||||||||||
| 629 | QColor color = viewOpt->palette.color(QPalette::Active, QPalette::WindowText); | - | ||||||||||||||||||||||||
| 630 | p->setPen(color); | - | ||||||||||||||||||||||||
| 631 | p->setBrush(color); | - | ||||||||||||||||||||||||
| 632 | } never executed: end of block | 0 | ||||||||||||||||||||||||
| 633 | - | |||||||||||||||||||||||||
| 634 | } else { | - | ||||||||||||||||||||||||
| 635 | QColor color = viewOpt->palette.color(QPalette::Active, QPalette::Mid); | - | ||||||||||||||||||||||||
| 636 | p->setPen(color); | - | ||||||||||||||||||||||||
| 637 | p->setBrush(color); | - | ||||||||||||||||||||||||
| 638 | } never executed: end of block | 0 | ||||||||||||||||||||||||
| 639 | p->drawPath(path); | - | ||||||||||||||||||||||||
| 640 | - | |||||||||||||||||||||||||
| 641 | // draw the vertical and top triangle line | - | ||||||||||||||||||||||||
| 642 | if (!(viewOpt->state & QStyle::State_Selected)) {
| 0 | ||||||||||||||||||||||||
| 643 | QPainterPath lines; | - | ||||||||||||||||||||||||
| 644 | lines.moveTo(x, viewOpt->rect.y() + offset); | - | ||||||||||||||||||||||||
| 645 | lines.lineTo(x, viewOpt->rect.y() + offset + height); | - | ||||||||||||||||||||||||
| 646 | lines.moveTo(x, viewOpt->rect.y() + offset); | - | ||||||||||||||||||||||||
| 647 | lines.lineTo(x2, viewOpt->rect.y() + offset+height/2); | - | ||||||||||||||||||||||||
| 648 | QColor color = viewOpt->palette.color(QPalette::Active, QPalette::Dark); | - | ||||||||||||||||||||||||
| 649 | p->setPen(color); | - | ||||||||||||||||||||||||
| 650 | p->drawPath(lines); | - | ||||||||||||||||||||||||
| 651 | } never executed: end of block | 0 | ||||||||||||||||||||||||
| 652 | p->restore(); | - | ||||||||||||||||||||||||
| 653 | } never executed: end of block | 0 | ||||||||||||||||||||||||
| 654 | break; } never executed: break; | 0 | ||||||||||||||||||||||||
| 655 | #endif //QT_NO_COLUMNVIEW | - | ||||||||||||||||||||||||
| 656 | case PE_IndicatorItemViewItemDrop: { never executed: case PE_IndicatorItemViewItemDrop: | 0 | ||||||||||||||||||||||||
| 657 | QRect rect = opt->rect; | - | ||||||||||||||||||||||||
| 658 | if (opt->rect.height() == 0)
| 0 | ||||||||||||||||||||||||
| 659 | p->drawLine(rect.topLeft(), rect.topRight()); never executed: p->drawLine(rect.topLeft(), rect.topRight()); | 0 | ||||||||||||||||||||||||
| 660 | else | - | ||||||||||||||||||||||||
| 661 | p->drawRect(rect); never executed: p->drawRect(rect); | 0 | ||||||||||||||||||||||||
| 662 | break; } never executed: break; | 0 | ||||||||||||||||||||||||
| 663 | #ifndef QT_NO_ITEMVIEWS | - | ||||||||||||||||||||||||
| 664 | case PE_PanelItemViewRow: never executed: case PE_PanelItemViewRow: | 0 | ||||||||||||||||||||||||
| 665 | if (const QStyleOptionViewItem *vopt = qstyleoption_cast<const QStyleOptionViewItem *>(opt)) {
| 0 | ||||||||||||||||||||||||
| 666 | QPalette::ColorGroup cg = (widget ? widget->isEnabled() : (vopt->state & QStyle::State_Enabled))
| 0 | ||||||||||||||||||||||||
| 667 | ? QPalette::Normal : QPalette::Disabled; | - | ||||||||||||||||||||||||
| 668 | if (cg == QPalette::Normal && !(vopt->state & QStyle::State_Active))
| 0 | ||||||||||||||||||||||||
| 669 | cg = QPalette::Inactive; never executed: cg = QPalette::Inactive; | 0 | ||||||||||||||||||||||||
| 670 | - | |||||||||||||||||||||||||
| 671 | if ((vopt->state & QStyle::State_Selected) && proxy()->styleHint(QStyle::SH_ItemView_ShowDecorationSelected, opt, widget))
| 0 | ||||||||||||||||||||||||
| 672 | p->fillRect(vopt->rect, vopt->palette.brush(cg, QPalette::Highlight)); never executed: p->fillRect(vopt->rect, vopt->palette.brush(cg, QPalette::Highlight)); | 0 | ||||||||||||||||||||||||
| 673 | else if (vopt->features & QStyleOptionViewItem::Alternate)
| 0 | ||||||||||||||||||||||||
| 674 | p->fillRect(vopt->rect, vopt->palette.brush(cg, QPalette::AlternateBase)); never executed: p->fillRect(vopt->rect, vopt->palette.brush(cg, QPalette::AlternateBase)); | 0 | ||||||||||||||||||||||||
| 675 | } never executed: end of block | 0 | ||||||||||||||||||||||||
| 676 | break; never executed: break; | 0 | ||||||||||||||||||||||||
| 677 | case PE_PanelItemViewItem: never executed: case PE_PanelItemViewItem: | 0 | ||||||||||||||||||||||||
| 678 | if (const QStyleOptionViewItem *vopt = qstyleoption_cast<const QStyleOptionViewItem *>(opt)) {
| 0 | ||||||||||||||||||||||||
| 679 | QPalette::ColorGroup cg = (widget ? widget->isEnabled() : (vopt->state & QStyle::State_Enabled))
| 0 | ||||||||||||||||||||||||
| 680 | ? QPalette::Normal : QPalette::Disabled; | - | ||||||||||||||||||||||||
| 681 | if (cg == QPalette::Normal && !(vopt->state & QStyle::State_Active))
| 0 | ||||||||||||||||||||||||
| 682 | cg = QPalette::Inactive; never executed: cg = QPalette::Inactive; | 0 | ||||||||||||||||||||||||
| 683 | - | |||||||||||||||||||||||||
| 684 | if (vopt->showDecorationSelected && (vopt->state & QStyle::State_Selected)) {
| 0 | ||||||||||||||||||||||||
| 685 | p->fillRect(vopt->rect, vopt->palette.brush(cg, QPalette::Highlight)); | - | ||||||||||||||||||||||||
| 686 | } else { never executed: end of block | 0 | ||||||||||||||||||||||||
| 687 | if (vopt->backgroundBrush.style() != Qt::NoBrush) {
| 0 | ||||||||||||||||||||||||
| 688 | QPointF oldBO = p->brushOrigin(); | - | ||||||||||||||||||||||||
| 689 | p->setBrushOrigin(vopt->rect.topLeft()); | - | ||||||||||||||||||||||||
| 690 | p->fillRect(vopt->rect, vopt->backgroundBrush); | - | ||||||||||||||||||||||||
| 691 | p->setBrushOrigin(oldBO); | - | ||||||||||||||||||||||||
| 692 | } never executed: end of block | 0 | ||||||||||||||||||||||||
| 693 | - | |||||||||||||||||||||||||
| 694 | if (vopt->state & QStyle::State_Selected) {
| 0 | ||||||||||||||||||||||||
| 695 | QRect textRect = subElementRect(QStyle::SE_ItemViewItemText, opt, widget); | - | ||||||||||||||||||||||||
| 696 | p->fillRect(textRect, vopt->palette.brush(cg, QPalette::Highlight)); | - | ||||||||||||||||||||||||
| 697 | } never executed: end of block | 0 | ||||||||||||||||||||||||
| 698 | } never executed: end of block | 0 | ||||||||||||||||||||||||
| 699 | } | - | ||||||||||||||||||||||||
| 700 | break; never executed: break; | 0 | ||||||||||||||||||||||||
| 701 | #endif //QT_NO_ITEMVIEWS | - | ||||||||||||||||||||||||
| 702 | case PE_PanelScrollAreaCorner: { never executed: case PE_PanelScrollAreaCorner: | 0 | ||||||||||||||||||||||||
| 703 | const QBrush brush(opt->palette.brush(QPalette::Window)); | - | ||||||||||||||||||||||||
| 704 | p->fillRect(opt->rect, brush); | - | ||||||||||||||||||||||||
| 705 | } break; never executed: break; | 0 | ||||||||||||||||||||||||
| 706 | case PE_IndicatorArrowUp: never executed: case PE_IndicatorArrowUp: | 0 | ||||||||||||||||||||||||
| 707 | case PE_IndicatorArrowDown: never executed: case PE_IndicatorArrowDown: | 0 | ||||||||||||||||||||||||
| 708 | case PE_IndicatorArrowRight: never executed: case PE_IndicatorArrowRight: | 0 | ||||||||||||||||||||||||
| 709 | case PE_IndicatorArrowLeft: never executed: case PE_IndicatorArrowLeft: | 0 | ||||||||||||||||||||||||
| 710 | { | - | ||||||||||||||||||||||||
| 711 | if (opt->rect.width() <= 1 || opt->rect.height() <= 1)
| 0 | ||||||||||||||||||||||||
| 712 | break; never executed: break; | 0 | ||||||||||||||||||||||||
| 713 | QRect r = opt->rect; | - | ||||||||||||||||||||||||
| 714 | int size = qMin(r.height(), r.width()); | - | ||||||||||||||||||||||||
| 715 | QPixmap pixmap; | - | ||||||||||||||||||||||||
| 716 | QString pixmapName = QStyleHelper::uniqueName(QLatin1String("$qt_ia-") | - | ||||||||||||||||||||||||
| 717 | % QLatin1String(metaObject()->className()), opt, QSize(size, size)) | - | ||||||||||||||||||||||||
| 718 | % HexString<uint>(pe); | - | ||||||||||||||||||||||||
| 719 | if (!QPixmapCache::find(pixmapName, pixmap)) {
| 0 | ||||||||||||||||||||||||
| 720 | int border = size/5; | - | ||||||||||||||||||||||||
| 721 | int sqsize = 2*(size/2); | - | ||||||||||||||||||||||||
| 722 | QImage image(sqsize, sqsize, QImage::Format_ARGB32_Premultiplied); | - | ||||||||||||||||||||||||
| 723 | image.fill(0); | - | ||||||||||||||||||||||||
| 724 | QPainter imagePainter(&image); | - | ||||||||||||||||||||||||
| 725 | - | |||||||||||||||||||||||||
| 726 | QPolygon a; | - | ||||||||||||||||||||||||
| 727 | switch (pe) { | - | ||||||||||||||||||||||||
| 728 | case PE_IndicatorArrowUp: never executed: case PE_IndicatorArrowUp: | 0 | ||||||||||||||||||||||||
| 729 | a.setPoints(3, border, sqsize/2, sqsize/2, border, sqsize - border, sqsize/2); | - | ||||||||||||||||||||||||
| 730 | break; never executed: break; | 0 | ||||||||||||||||||||||||
| 731 | case PE_IndicatorArrowDown: never executed: case PE_IndicatorArrowDown: | 0 | ||||||||||||||||||||||||
| 732 | a.setPoints(3, border, sqsize/2, sqsize/2, sqsize - border, sqsize - border, sqsize/2); | - | ||||||||||||||||||||||||
| 733 | break; never executed: break; | 0 | ||||||||||||||||||||||||
| 734 | case PE_IndicatorArrowRight: never executed: case PE_IndicatorArrowRight: | 0 | ||||||||||||||||||||||||
| 735 | a.setPoints(3, sqsize - border, sqsize/2, sqsize/2, border, sqsize/2, sqsize - border); | - | ||||||||||||||||||||||||
| 736 | break; never executed: break; | 0 | ||||||||||||||||||||||||
| 737 | case PE_IndicatorArrowLeft: never executed: case PE_IndicatorArrowLeft: | 0 | ||||||||||||||||||||||||
| 738 | a.setPoints(3, border, sqsize/2, sqsize/2, border, sqsize/2, sqsize - border); | - | ||||||||||||||||||||||||
| 739 | break; never executed: break; | 0 | ||||||||||||||||||||||||
| 740 | default: never executed: default: | 0 | ||||||||||||||||||||||||
| 741 | break; never executed: break; | 0 | ||||||||||||||||||||||||
| 742 | } | - | ||||||||||||||||||||||||
| 743 | - | |||||||||||||||||||||||||
| 744 | int bsx = 0; | - | ||||||||||||||||||||||||
| 745 | int bsy = 0; | - | ||||||||||||||||||||||||
| 746 | - | |||||||||||||||||||||||||
| 747 | if (opt->state & State_Sunken) {
| 0 | ||||||||||||||||||||||||
| 748 | bsx = proxy()->pixelMetric(PM_ButtonShiftHorizontal, opt, widget); | - | ||||||||||||||||||||||||
| 749 | bsy = proxy()->pixelMetric(PM_ButtonShiftVertical, opt, widget); | - | ||||||||||||||||||||||||
| 750 | } never executed: end of block | 0 | ||||||||||||||||||||||||
| 751 | - | |||||||||||||||||||||||||
| 752 | QRect bounds = a.boundingRect(); | - | ||||||||||||||||||||||||
| 753 | int sx = sqsize / 2 - bounds.center().x() - 1; | - | ||||||||||||||||||||||||
| 754 | int sy = sqsize / 2 - bounds.center().y() - 1; | - | ||||||||||||||||||||||||
| 755 | imagePainter.translate(sx + bsx, sy + bsy); | - | ||||||||||||||||||||||||
| 756 | imagePainter.setPen(opt->palette.buttonText().color()); | - | ||||||||||||||||||||||||
| 757 | imagePainter.setBrush(opt->palette.buttonText()); | - | ||||||||||||||||||||||||
| 758 | imagePainter.setRenderHint(QPainter::Qt4CompatiblePainting); | - | ||||||||||||||||||||||||
| 759 | - | |||||||||||||||||||||||||
| 760 | if (!(opt->state & State_Enabled)) {
| 0 | ||||||||||||||||||||||||
| 761 | imagePainter.translate(1, 1); | - | ||||||||||||||||||||||||
| 762 | imagePainter.setBrush(opt->palette.light().color()); | - | ||||||||||||||||||||||||
| 763 | imagePainter.setPen(opt->palette.light().color()); | - | ||||||||||||||||||||||||
| 764 | imagePainter.drawPolygon(a); | - | ||||||||||||||||||||||||
| 765 | imagePainter.translate(-1, -1); | - | ||||||||||||||||||||||||
| 766 | imagePainter.setBrush(opt->palette.mid().color()); | - | ||||||||||||||||||||||||
| 767 | imagePainter.setPen(opt->palette.mid().color()); | - | ||||||||||||||||||||||||
| 768 | } never executed: end of block | 0 | ||||||||||||||||||||||||
| 769 | - | |||||||||||||||||||||||||
| 770 | imagePainter.drawPolygon(a); | - | ||||||||||||||||||||||||
| 771 | imagePainter.end(); | - | ||||||||||||||||||||||||
| 772 | pixmap = QPixmap::fromImage(image); | - | ||||||||||||||||||||||||
| 773 | QPixmapCache::insert(pixmapName, pixmap); | - | ||||||||||||||||||||||||
| 774 | } never executed: end of block | 0 | ||||||||||||||||||||||||
| 775 | int xOffset = r.x() + (r.width() - size)/2; | - | ||||||||||||||||||||||||
| 776 | int yOffset = r.y() + (r.height() - size)/2; | - | ||||||||||||||||||||||||
| 777 | p->drawPixmap(xOffset, yOffset, pixmap); | - | ||||||||||||||||||||||||
| 778 | } | - | ||||||||||||||||||||||||
| 779 | break; never executed: break; | 0 | ||||||||||||||||||||||||
| 780 | default: never executed: default: | 0 | ||||||||||||||||||||||||
| 781 | break; never executed: break; | 0 | ||||||||||||||||||||||||
| 782 | } | - | ||||||||||||||||||||||||
| 783 | } | - | ||||||||||||||||||||||||
| 784 | - | |||||||||||||||||||||||||
| 785 | #ifndef QT_NO_TOOLBUTTON | - | ||||||||||||||||||||||||
| 786 | static void drawArrow(const QStyle *style, const QStyleOptionToolButton *toolbutton, | - | ||||||||||||||||||||||||
| 787 | const QRect &rect, QPainter *painter, const QWidget *widget = 0) | - | ||||||||||||||||||||||||
| 788 | { | - | ||||||||||||||||||||||||
| 789 | QStyle::PrimitiveElement pe; | - | ||||||||||||||||||||||||
| 790 | switch (toolbutton->arrowType) { | - | ||||||||||||||||||||||||
| 791 | case Qt::LeftArrow: | - | ||||||||||||||||||||||||
| 792 | pe = QStyle::PE_IndicatorArrowLeft; | - | ||||||||||||||||||||||||
| 793 | break; | - | ||||||||||||||||||||||||
| 794 | case Qt::RightArrow: | - | ||||||||||||||||||||||||
| 795 | pe = QStyle::PE_IndicatorArrowRight; | - | ||||||||||||||||||||||||
| 796 | break; | - | ||||||||||||||||||||||||
| 797 | case Qt::UpArrow: | - | ||||||||||||||||||||||||
| 798 | pe = QStyle::PE_IndicatorArrowUp; | - | ||||||||||||||||||||||||
| 799 | break; | - | ||||||||||||||||||||||||
| 800 | case Qt::DownArrow: | - | ||||||||||||||||||||||||
| 801 | pe = QStyle::PE_IndicatorArrowDown; | - | ||||||||||||||||||||||||
| 802 | break; | - | ||||||||||||||||||||||||
| 803 | default: | - | ||||||||||||||||||||||||
| 804 | return; | - | ||||||||||||||||||||||||
| 805 | } | - | ||||||||||||||||||||||||
| 806 | QStyleOption arrowOpt = *toolbutton; | - | ||||||||||||||||||||||||
| 807 | arrowOpt.rect = rect; | - | ||||||||||||||||||||||||
| 808 | style->drawPrimitive(pe, &arrowOpt, painter, widget); | - | ||||||||||||||||||||||||
| 809 | } | - | ||||||||||||||||||||||||
| 810 | #endif // QT_NO_TOOLBUTTON | - | ||||||||||||||||||||||||
| 811 | - | |||||||||||||||||||||||||
| 812 | #ifndef QT_NO_ITEMVIEWS | - | ||||||||||||||||||||||||
| 813 | - | |||||||||||||||||||||||||
| 814 | static QSizeF viewItemTextLayout(QTextLayout &textLayout, int lineWidth) | - | ||||||||||||||||||||||||
| 815 | { | - | ||||||||||||||||||||||||
| 816 | qreal height = 0; | - | ||||||||||||||||||||||||
| 817 | qreal widthUsed = 0; | - | ||||||||||||||||||||||||
| 818 | textLayout.beginLayout(); | - | ||||||||||||||||||||||||
| 819 | while (true) { | - | ||||||||||||||||||||||||
| 820 | QTextLine line = textLayout.createLine(); | - | ||||||||||||||||||||||||
| 821 | if (!line.isValid()) | - | ||||||||||||||||||||||||
| 822 | break; | - | ||||||||||||||||||||||||
| 823 | line.setLineWidth(lineWidth); | - | ||||||||||||||||||||||||
| 824 | line.setPosition(QPointF(0, height)); | - | ||||||||||||||||||||||||
| 825 | height += line.height(); | - | ||||||||||||||||||||||||
| 826 | widthUsed = qMax(widthUsed, line.naturalTextWidth()); | - | ||||||||||||||||||||||||
| 827 | } | - | ||||||||||||||||||||||||
| 828 | textLayout.endLayout(); | - | ||||||||||||||||||||||||
| 829 | return QSizeF(widthUsed, height); | - | ||||||||||||||||||||||||
| 830 | } | - | ||||||||||||||||||||||||
| 831 | - | |||||||||||||||||||||||||
| 832 | QSize QCommonStylePrivate::viewItemSize(const QStyleOptionViewItem *option, int role) const | - | ||||||||||||||||||||||||
| 833 | { | - | ||||||||||||||||||||||||
| 834 | const QWidget *widget = option->widget; | - | ||||||||||||||||||||||||
| 835 | switch (role) { | - | ||||||||||||||||||||||||
| 836 | case Qt::CheckStateRole: | - | ||||||||||||||||||||||||
| 837 | if (option->features & QStyleOptionViewItem::HasCheckIndicator) | - | ||||||||||||||||||||||||
| 838 | return QSize(proxyStyle->pixelMetric(QStyle::PM_IndicatorWidth, option, widget), | - | ||||||||||||||||||||||||
| 839 | proxyStyle->pixelMetric(QStyle::PM_IndicatorHeight, option, widget)); | - | ||||||||||||||||||||||||
| 840 | break; | - | ||||||||||||||||||||||||
| 841 | case Qt::DisplayRole: | - | ||||||||||||||||||||||||
| 842 | if (option->features & QStyleOptionViewItem::HasDisplay) { | - | ||||||||||||||||||||||||
| 843 | QTextOption textOption; | - | ||||||||||||||||||||||||
| 844 | textOption.setWrapMode(QTextOption::WordWrap); | - | ||||||||||||||||||||||||
| 845 | QTextLayout textLayout(option->text, option->font); | - | ||||||||||||||||||||||||
| 846 | textLayout.setTextOption(textOption); | - | ||||||||||||||||||||||||
| 847 | const bool wrapText = option->features & QStyleOptionViewItem::WrapText; | - | ||||||||||||||||||||||||
| 848 | const int textMargin = proxyStyle->pixelMetric(QStyle::PM_FocusFrameHMargin, option, widget) + 1; | - | ||||||||||||||||||||||||
| 849 | QRect bounds = option->rect; | - | ||||||||||||||||||||||||
| 850 | switch (option->decorationPosition) { | - | ||||||||||||||||||||||||
| 851 | case QStyleOptionViewItem::Left: | - | ||||||||||||||||||||||||
| 852 | case QStyleOptionViewItem::Right: | - | ||||||||||||||||||||||||
| 853 | bounds.setWidth(wrapText && bounds.isValid() ? bounds.width() - 2 * textMargin : QFIXED_MAX); | - | ||||||||||||||||||||||||
| 854 | break; | - | ||||||||||||||||||||||||
| 855 | case QStyleOptionViewItem::Top: | - | ||||||||||||||||||||||||
| 856 | case QStyleOptionViewItem::Bottom: | - | ||||||||||||||||||||||||
| 857 | if (wrapText) | - | ||||||||||||||||||||||||
| 858 | bounds.setWidth(bounds.isValid() ? bounds.width() - 2 * textMargin : option->decorationSize.width()); | - | ||||||||||||||||||||||||
| 859 | else | - | ||||||||||||||||||||||||
| 860 | bounds.setWidth(QFIXED_MAX); | - | ||||||||||||||||||||||||
| 861 | break; | - | ||||||||||||||||||||||||
| 862 | default: | - | ||||||||||||||||||||||||
| 863 | break; | - | ||||||||||||||||||||||||
| 864 | } | - | ||||||||||||||||||||||||
| 865 | - | |||||||||||||||||||||||||
| 866 | const int lineWidth = bounds.width(); | - | ||||||||||||||||||||||||
| 867 | const QSizeF size = viewItemTextLayout(textLayout, lineWidth); | - | ||||||||||||||||||||||||
| 868 | return QSize(qCeil(size.width()) + 2 * textMargin, qCeil(size.height())); | - | ||||||||||||||||||||||||
| 869 | } | - | ||||||||||||||||||||||||
| 870 | break; | - | ||||||||||||||||||||||||
| 871 | case Qt::DecorationRole: | - | ||||||||||||||||||||||||
| 872 | if (option->features & QStyleOptionViewItem::HasDecoration) { | - | ||||||||||||||||||||||||
| 873 | return option->decorationSize; | - | ||||||||||||||||||||||||
| 874 | } | - | ||||||||||||||||||||||||
| 875 | break; | - | ||||||||||||||||||||||||
| 876 | default: | - | ||||||||||||||||||||||||
| 877 | break; | - | ||||||||||||||||||||||||
| 878 | } | - | ||||||||||||||||||||||||
| 879 | - | |||||||||||||||||||||||||
| 880 | return QSize(0, 0); | - | ||||||||||||||||||||||||
| 881 | } | - | ||||||||||||||||||||||||
| 882 | - | |||||||||||||||||||||||||
| 883 | void QCommonStylePrivate::viewItemDrawText(QPainter *p, const QStyleOptionViewItem *option, const QRect &rect) const | - | ||||||||||||||||||||||||
| 884 | { | - | ||||||||||||||||||||||||
| 885 | const QWidget *widget = option->widget; | - | ||||||||||||||||||||||||
| 886 | const int textMargin = proxyStyle->pixelMetric(QStyle::PM_FocusFrameHMargin, 0, widget) + 1; | - | ||||||||||||||||||||||||
| 887 | - | |||||||||||||||||||||||||
| 888 | QRect textRect = rect.adjusted(textMargin, 0, -textMargin, 0); // remove width padding | - | ||||||||||||||||||||||||
| 889 | const bool wrapText = option->features & QStyleOptionViewItem::WrapText; | - | ||||||||||||||||||||||||
| 890 | QTextOption textOption; | - | ||||||||||||||||||||||||
| 891 | textOption.setWrapMode(wrapText ? QTextOption::WordWrap : QTextOption::ManualWrap); | - | ||||||||||||||||||||||||
| 892 | textOption.setTextDirection(option->direction); | - | ||||||||||||||||||||||||
| 893 | textOption.setAlignment(QStyle::visualAlignment(option->direction, option->displayAlignment)); | - | ||||||||||||||||||||||||
| 894 | QTextLayout textLayout(option->text, option->font); | - | ||||||||||||||||||||||||
| 895 | textLayout.setTextOption(textOption); | - | ||||||||||||||||||||||||
| 896 | - | |||||||||||||||||||||||||
| 897 | viewItemTextLayout(textLayout, textRect.width()); | - | ||||||||||||||||||||||||
| 898 | - | |||||||||||||||||||||||||
| 899 | QString elidedText; | - | ||||||||||||||||||||||||
| 900 | qreal height = 0; | - | ||||||||||||||||||||||||
| 901 | qreal width = 0; | - | ||||||||||||||||||||||||
| 902 | int elidedIndex = -1; | - | ||||||||||||||||||||||||
| 903 | const int lineCount = textLayout.lineCount(); | - | ||||||||||||||||||||||||
| 904 | for (int j = 0; j < lineCount; ++j) { | - | ||||||||||||||||||||||||
| 905 | const QTextLine line = textLayout.lineAt(j); | - | ||||||||||||||||||||||||
| 906 | if (j + 1 <= lineCount - 1) { | - | ||||||||||||||||||||||||
| 907 | const QTextLine nextLine = textLayout.lineAt(j + 1); | - | ||||||||||||||||||||||||
| 908 | if ((nextLine.y() + nextLine.height()) > textRect.height()) { | - | ||||||||||||||||||||||||
| 909 | int start = line.textStart(); | - | ||||||||||||||||||||||||
| 910 | int length = line.textLength() + nextLine.textLength(); | - | ||||||||||||||||||||||||
| 911 | const QStackTextEngine engine(textLayout.text().mid(start, length), option->font); | - | ||||||||||||||||||||||||
| 912 | elidedText = engine.elidedText(option->textElideMode, textRect.width()); | - | ||||||||||||||||||||||||
| 913 | height += line.height(); | - | ||||||||||||||||||||||||
| 914 | width = textRect.width(); | - | ||||||||||||||||||||||||
| 915 | elidedIndex = j; | - | ||||||||||||||||||||||||
| 916 | break; | - | ||||||||||||||||||||||||
| 917 | } | - | ||||||||||||||||||||||||
| 918 | } | - | ||||||||||||||||||||||||
| 919 | if (line.naturalTextWidth() > textRect.width()) { | - | ||||||||||||||||||||||||
| 920 | int start = line.textStart(); | - | ||||||||||||||||||||||||
| 921 | int length = line.textLength(); | - | ||||||||||||||||||||||||
| 922 | const QStackTextEngine engine(textLayout.text().mid(start, length), option->font); | - | ||||||||||||||||||||||||
| 923 | elidedText = engine.elidedText(option->textElideMode, textRect.width()); | - | ||||||||||||||||||||||||
| 924 | height += line.height(); | - | ||||||||||||||||||||||||
| 925 | width = textRect.width(); | - | ||||||||||||||||||||||||
| 926 | elidedIndex = j; | - | ||||||||||||||||||||||||
| 927 | break; | - | ||||||||||||||||||||||||
| 928 | } | - | ||||||||||||||||||||||||
| 929 | width = qMax<qreal>(width, line.width()); | - | ||||||||||||||||||||||||
| 930 | height += line.height(); | - | ||||||||||||||||||||||||
| 931 | } | - | ||||||||||||||||||||||||
| 932 | - | |||||||||||||||||||||||||
| 933 | const QRect layoutRect = QStyle::alignedRect(option->direction, option->displayAlignment, | - | ||||||||||||||||||||||||
| 934 | QSize(int(width), int(height)), textRect); | - | ||||||||||||||||||||||||
| 935 | const QPointF position = layoutRect.topLeft(); | - | ||||||||||||||||||||||||
| 936 | for (int i = 0; i < lineCount; ++i) { | - | ||||||||||||||||||||||||
| 937 | const QTextLine line = textLayout.lineAt(i); | - | ||||||||||||||||||||||||
| 938 | if (i == elidedIndex) { | - | ||||||||||||||||||||||||
| 939 | qreal x = position.x() + line.x(); | - | ||||||||||||||||||||||||
| 940 | qreal y = position.y() + line.y() + line.ascent(); | - | ||||||||||||||||||||||||
| 941 | p->save(); | - | ||||||||||||||||||||||||
| 942 | p->setFont(option->font); | - | ||||||||||||||||||||||||
| 943 | p->drawText(QPointF(x, y), elidedText); | - | ||||||||||||||||||||||||
| 944 | p->restore(); | - | ||||||||||||||||||||||||
| 945 | break; | - | ||||||||||||||||||||||||
| 946 | } | - | ||||||||||||||||||||||||
| 947 | line.draw(p, position); | - | ||||||||||||||||||||||||
| 948 | } | - | ||||||||||||||||||||||||
| 949 | } | - | ||||||||||||||||||||||||
| 950 | - | |||||||||||||||||||||||||
| 951 | /*! \internal | - | ||||||||||||||||||||||||
| 952 | compute the position for the different component of an item (pixmap, text, checkbox) | - | ||||||||||||||||||||||||
| 953 | - | |||||||||||||||||||||||||
| 954 | Set sizehint to false to layout the elements inside opt->rect. Set sizehint to true to ignore | - | ||||||||||||||||||||||||
| 955 | opt->rect and return rectangles in infinite space | - | ||||||||||||||||||||||||
| 956 | - | |||||||||||||||||||||||||
| 957 | Code duplicated in QItemDelegate::doLayout | - | ||||||||||||||||||||||||
| 958 | */ | - | ||||||||||||||||||||||||
| 959 | void QCommonStylePrivate::viewItemLayout(const QStyleOptionViewItem *opt, QRect *checkRect, | - | ||||||||||||||||||||||||
| 960 | QRect *pixmapRect, QRect *textRect, bool sizehint) const | - | ||||||||||||||||||||||||
| 961 | { | - | ||||||||||||||||||||||||
| 962 | Q_ASSERT(checkRect && pixmapRect && textRect); | - | ||||||||||||||||||||||||
| 963 | *pixmapRect = QRect(QPoint(0, 0), viewItemSize(opt, Qt::DecorationRole)); | - | ||||||||||||||||||||||||
| 964 | *textRect = QRect(QPoint(0, 0), viewItemSize(opt, Qt::DisplayRole)); | - | ||||||||||||||||||||||||
| 965 | *checkRect = QRect(QPoint(0, 0), viewItemSize(opt, Qt::CheckStateRole)); | - | ||||||||||||||||||||||||
| 966 | - | |||||||||||||||||||||||||
| 967 | const QWidget *widget = opt->widget; | - | ||||||||||||||||||||||||
| 968 | const bool hasCheck = checkRect->isValid(); | - | ||||||||||||||||||||||||
| 969 | const bool hasPixmap = pixmapRect->isValid(); | - | ||||||||||||||||||||||||
| 970 | const bool hasText = textRect->isValid(); | - | ||||||||||||||||||||||||
| 971 | const int textMargin = hasText ? proxyStyle->pixelMetric(QStyle::PM_FocusFrameHMargin, opt, widget) + 1 : 0; | - | ||||||||||||||||||||||||
| 972 | const int pixmapMargin = hasPixmap ? proxyStyle->pixelMetric(QStyle::PM_FocusFrameHMargin, opt, widget) + 1 : 0; | - | ||||||||||||||||||||||||
| 973 | const int checkMargin = hasCheck ? proxyStyle->pixelMetric(QStyle::PM_FocusFrameHMargin, opt, widget) + 1 : 0; | - | ||||||||||||||||||||||||
| 974 | int x = opt->rect.left(); | - | ||||||||||||||||||||||||
| 975 | int y = opt->rect.top(); | - | ||||||||||||||||||||||||
| 976 | int w, h; | - | ||||||||||||||||||||||||
| 977 | - | |||||||||||||||||||||||||
| 978 | if (textRect->height() == 0 && (!hasPixmap || !sizehint)) { | - | ||||||||||||||||||||||||
| 979 | //if there is no text, we still want to have a decent height for the item sizeHint and the editor size | - | ||||||||||||||||||||||||
| 980 | textRect->setHeight(opt->fontMetrics.height()); | - | ||||||||||||||||||||||||
| 981 | } | - | ||||||||||||||||||||||||
| 982 | - | |||||||||||||||||||||||||
| 983 | QSize pm(0, 0); | - | ||||||||||||||||||||||||
| 984 | if (hasPixmap) { | - | ||||||||||||||||||||||||
| 985 | pm = pixmapRect->size(); | - | ||||||||||||||||||||||||
| 986 | pm.rwidth() += 2 * pixmapMargin; | - | ||||||||||||||||||||||||
| 987 | } | - | ||||||||||||||||||||||||
| 988 | if (sizehint) { | - | ||||||||||||||||||||||||
| 989 | h = qMax(checkRect->height(), qMax(textRect->height(), pm.height())); | - | ||||||||||||||||||||||||
| 990 | if (opt->decorationPosition == QStyleOptionViewItem::Left | - | ||||||||||||||||||||||||
| 991 | || opt->decorationPosition == QStyleOptionViewItem::Right) { | - | ||||||||||||||||||||||||
| 992 | w = textRect->width() + pm.width(); | - | ||||||||||||||||||||||||
| 993 | } else { | - | ||||||||||||||||||||||||
| 994 | w = qMax(textRect->width(), pm.width()); | - | ||||||||||||||||||||||||
| 995 | } | - | ||||||||||||||||||||||||
| 996 | } else { | - | ||||||||||||||||||||||||
| 997 | w = opt->rect.width(); | - | ||||||||||||||||||||||||
| 998 | h = opt->rect.height(); | - | ||||||||||||||||||||||||
| 999 | } | - | ||||||||||||||||||||||||
| 1000 | - | |||||||||||||||||||||||||
| 1001 | int cw = 0; | - | ||||||||||||||||||||||||
| 1002 | QRect check; | - | ||||||||||||||||||||||||
| 1003 | if (hasCheck) { | - | ||||||||||||||||||||||||
| 1004 | cw = checkRect->width() + 2 * checkMargin; | - | ||||||||||||||||||||||||
| 1005 | if (sizehint) w += cw; | - | ||||||||||||||||||||||||
| 1006 | if (opt->direction == Qt::RightToLeft) { | - | ||||||||||||||||||||||||
| 1007 | check.setRect(x + w - cw, y, cw, h); | - | ||||||||||||||||||||||||
| 1008 | } else { | - | ||||||||||||||||||||||||
| 1009 | check.setRect(x, y, cw, h); | - | ||||||||||||||||||||||||
| 1010 | } | - | ||||||||||||||||||||||||
| 1011 | } | - | ||||||||||||||||||||||||
| 1012 | - | |||||||||||||||||||||||||
| 1013 | QRect display; | - | ||||||||||||||||||||||||
| 1014 | QRect decoration; | - | ||||||||||||||||||||||||
| 1015 | switch (opt->decorationPosition) { | - | ||||||||||||||||||||||||
| 1016 | case QStyleOptionViewItem::Top: { | - | ||||||||||||||||||||||||
| 1017 | if (hasPixmap) | - | ||||||||||||||||||||||||
| 1018 | pm.setHeight(pm.height() + pixmapMargin); // add space | - | ||||||||||||||||||||||||
| 1019 | h = sizehint ? textRect->height() : h - pm.height(); | - | ||||||||||||||||||||||||
| 1020 | - | |||||||||||||||||||||||||
| 1021 | if (opt->direction == Qt::RightToLeft) { | - | ||||||||||||||||||||||||
| 1022 | decoration.setRect(x, y, w - cw, pm.height()); | - | ||||||||||||||||||||||||
| 1023 | display.setRect(x, y + pm.height(), w - cw, h); | - | ||||||||||||||||||||||||
| 1024 | } else { | - | ||||||||||||||||||||||||
| 1025 | decoration.setRect(x + cw, y, w - cw, pm.height()); | - | ||||||||||||||||||||||||
| 1026 | display.setRect(x + cw, y + pm.height(), w - cw, h); | - | ||||||||||||||||||||||||
| 1027 | } | - | ||||||||||||||||||||||||
| 1028 | break; } | - | ||||||||||||||||||||||||
| 1029 | case QStyleOptionViewItem::Bottom: { | - | ||||||||||||||||||||||||
| 1030 | if (hasText) | - | ||||||||||||||||||||||||
| 1031 | textRect->setHeight(textRect->height() + textMargin); // add space | - | ||||||||||||||||||||||||
| 1032 | h = sizehint ? textRect->height() + pm.height() : h; | - | ||||||||||||||||||||||||
| 1033 | - | |||||||||||||||||||||||||
| 1034 | if (opt->direction == Qt::RightToLeft) { | - | ||||||||||||||||||||||||
| 1035 | display.setRect(x, y, w - cw, textRect->height()); | - | ||||||||||||||||||||||||
| 1036 | decoration.setRect(x, y + textRect->height(), w - cw, h - textRect->height()); | - | ||||||||||||||||||||||||
| 1037 | } else { | - | ||||||||||||||||||||||||
| 1038 | display.setRect(x + cw, y, w - cw, textRect->height()); | - | ||||||||||||||||||||||||
| 1039 | decoration.setRect(x + cw, y + textRect->height(), w - cw, h - textRect->height()); | - | ||||||||||||||||||||||||
| 1040 | } | - | ||||||||||||||||||||||||
| 1041 | break; } | - | ||||||||||||||||||||||||
| 1042 | case QStyleOptionViewItem::Left: { | - | ||||||||||||||||||||||||
| 1043 | if (opt->direction == Qt::LeftToRight) { | - | ||||||||||||||||||||||||
| 1044 | decoration.setRect(x + cw, y, pm.width(), h); | - | ||||||||||||||||||||||||
| 1045 | display.setRect(decoration.right() + 1, y, w - pm.width() - cw, h); | - | ||||||||||||||||||||||||
| 1046 | } else { | - | ||||||||||||||||||||||||
| 1047 | display.setRect(x, y, w - pm.width() - cw, h); | - | ||||||||||||||||||||||||
| 1048 | decoration.setRect(display.right() + 1, y, pm.width(), h); | - | ||||||||||||||||||||||||
| 1049 | } | - | ||||||||||||||||||||||||
| 1050 | break; } | - | ||||||||||||||||||||||||
| 1051 | case QStyleOptionViewItem::Right: { | - | ||||||||||||||||||||||||
| 1052 | if (opt->direction == Qt::LeftToRight) { | - | ||||||||||||||||||||||||
| 1053 | display.setRect(x + cw, y, w - pm.width() - cw, h); | - | ||||||||||||||||||||||||
| 1054 | decoration.setRect(display.right() + 1, y, pm.width(), h); | - | ||||||||||||||||||||||||
| 1055 | } else { | - | ||||||||||||||||||||||||
| 1056 | decoration.setRect(x, y, pm.width(), h); | - | ||||||||||||||||||||||||
| 1057 | display.setRect(decoration.right() + 1, y, w - pm.width() - cw, h); | - | ||||||||||||||||||||||||
| 1058 | } | - | ||||||||||||||||||||||||
| 1059 | break; } | - | ||||||||||||||||||||||||
| 1060 | default: | - | ||||||||||||||||||||||||
| 1061 | qWarning("doLayout: decoration position is invalid"); | - | ||||||||||||||||||||||||
| 1062 | decoration = *pixmapRect; | - | ||||||||||||||||||||||||
| 1063 | break; | - | ||||||||||||||||||||||||
| 1064 | } | - | ||||||||||||||||||||||||
| 1065 | - | |||||||||||||||||||||||||
| 1066 | if (!sizehint) { // we only need to do the internal layout if we are going to paint | - | ||||||||||||||||||||||||
| 1067 | *checkRect = QStyle::alignedRect(opt->direction, Qt::AlignCenter, | - | ||||||||||||||||||||||||
| 1068 | checkRect->size(), check); | - | ||||||||||||||||||||||||
| 1069 | *pixmapRect = QStyle::alignedRect(opt->direction, opt->decorationAlignment, | - | ||||||||||||||||||||||||
| 1070 | pixmapRect->size(), decoration); | - | ||||||||||||||||||||||||
| 1071 | // the text takes up all available space, unless the decoration is not shown as selected | - | ||||||||||||||||||||||||
| 1072 | if (opt->showDecorationSelected) | - | ||||||||||||||||||||||||
| 1073 | *textRect = display; | - | ||||||||||||||||||||||||
| 1074 | else | - | ||||||||||||||||||||||||
| 1075 | *textRect = QStyle::alignedRect(opt->direction, opt->displayAlignment, | - | ||||||||||||||||||||||||
| 1076 | textRect->size().boundedTo(display.size()), display); | - | ||||||||||||||||||||||||
| 1077 | } else { | - | ||||||||||||||||||||||||
| 1078 | *checkRect = check; | - | ||||||||||||||||||||||||
| 1079 | *pixmapRect = decoration; | - | ||||||||||||||||||||||||
| 1080 | *textRect = display; | - | ||||||||||||||||||||||||
| 1081 | } | - | ||||||||||||||||||||||||
| 1082 | } | - | ||||||||||||||||||||||||
| 1083 | #endif // QT_NO_ITEMVIEWS | - | ||||||||||||||||||||||||
| 1084 | - | |||||||||||||||||||||||||
| 1085 | - | |||||||||||||||||||||||||
| 1086 | #ifndef QT_NO_TABBAR | - | ||||||||||||||||||||||||
| 1087 | /*! \internal | - | ||||||||||||||||||||||||
| 1088 | Compute the textRect and the pixmapRect from the opt rect | - | ||||||||||||||||||||||||
| 1089 | - | |||||||||||||||||||||||||
| 1090 | Uses the same computation than in QTabBar::tabSizeHint | - | ||||||||||||||||||||||||
| 1091 | */ | - | ||||||||||||||||||||||||
| 1092 | void QCommonStylePrivate::tabLayout(const QStyleOptionTab *opt, const QWidget *widget, QRect *textRect, QRect *iconRect) const | - | ||||||||||||||||||||||||
| 1093 | { | - | ||||||||||||||||||||||||
| 1094 | Q_ASSERT(textRect); | - | ||||||||||||||||||||||||
| 1095 | Q_ASSERT(iconRect); | - | ||||||||||||||||||||||||
| 1096 | QRect tr = opt->rect; | - | ||||||||||||||||||||||||
| 1097 | bool verticalTabs = opt->shape == QTabBar::RoundedEast | - | ||||||||||||||||||||||||
| 1098 | || opt->shape == QTabBar::RoundedWest | - | ||||||||||||||||||||||||
| 1099 | || opt->shape == QTabBar::TriangularEast | - | ||||||||||||||||||||||||
| 1100 | || opt->shape == QTabBar::TriangularWest; | - | ||||||||||||||||||||||||
| 1101 | if (verticalTabs) | - | ||||||||||||||||||||||||
| 1102 | tr.setRect(0, 0, tr.height(), tr.width()); //0, 0 as we will have a translate transform | - | ||||||||||||||||||||||||
| 1103 | - | |||||||||||||||||||||||||
| 1104 | int verticalShift = proxyStyle->pixelMetric(QStyle::PM_TabBarTabShiftVertical, opt, widget); | - | ||||||||||||||||||||||||
| 1105 | int horizontalShift = proxyStyle->pixelMetric(QStyle::PM_TabBarTabShiftHorizontal, opt, widget); | - | ||||||||||||||||||||||||
| 1106 | int hpadding = proxyStyle->pixelMetric(QStyle::PM_TabBarTabHSpace, opt, widget) / 2; | - | ||||||||||||||||||||||||
| 1107 | int vpadding = proxyStyle->pixelMetric(QStyle::PM_TabBarTabVSpace, opt, widget) / 2; | - | ||||||||||||||||||||||||
| 1108 | if (opt->shape == QTabBar::RoundedSouth || opt->shape == QTabBar::TriangularSouth) | - | ||||||||||||||||||||||||
| 1109 | verticalShift = -verticalShift; | - | ||||||||||||||||||||||||
| 1110 | tr.adjust(hpadding, verticalShift - vpadding, horizontalShift - hpadding, vpadding); | - | ||||||||||||||||||||||||
| 1111 | bool selected = opt->state & QStyle::State_Selected; | - | ||||||||||||||||||||||||
| 1112 | if (selected) { | - | ||||||||||||||||||||||||
| 1113 | tr.setTop(tr.top() - verticalShift); | - | ||||||||||||||||||||||||
| 1114 | tr.setRight(tr.right() - horizontalShift); | - | ||||||||||||||||||||||||
| 1115 | } | - | ||||||||||||||||||||||||
| 1116 | - | |||||||||||||||||||||||||
| 1117 | // left widget | - | ||||||||||||||||||||||||
| 1118 | if (!opt->leftButtonSize.isEmpty()) { | - | ||||||||||||||||||||||||
| 1119 | tr.setLeft(tr.left() + 4 + | - | ||||||||||||||||||||||||
| 1120 | (verticalTabs ? opt->leftButtonSize.height() : opt->leftButtonSize.width())); | - | ||||||||||||||||||||||||
| 1121 | } | - | ||||||||||||||||||||||||
| 1122 | // right widget | - | ||||||||||||||||||||||||
| 1123 | if (!opt->rightButtonSize.isEmpty()) { | - | ||||||||||||||||||||||||
| 1124 | tr.setRight(tr.right() - 4 - | - | ||||||||||||||||||||||||
| 1125 | (verticalTabs ? opt->rightButtonSize.height() : opt->rightButtonSize.width())); | - | ||||||||||||||||||||||||
| 1126 | } | - | ||||||||||||||||||||||||
| 1127 | - | |||||||||||||||||||||||||
| 1128 | // icon | - | ||||||||||||||||||||||||
| 1129 | if (!opt->icon.isNull()) { | - | ||||||||||||||||||||||||
| 1130 | QSize iconSize = opt->iconSize; | - | ||||||||||||||||||||||||
| 1131 | if (!iconSize.isValid()) { | - | ||||||||||||||||||||||||
| 1132 | int iconExtent = proxyStyle->pixelMetric(QStyle::PM_SmallIconSize); | - | ||||||||||||||||||||||||
| 1133 | iconSize = QSize(iconExtent, iconExtent); | - | ||||||||||||||||||||||||
| 1134 | } | - | ||||||||||||||||||||||||
| 1135 | QSize tabIconSize = opt->icon.actualSize(iconSize, | - | ||||||||||||||||||||||||
| 1136 | (opt->state & QStyle::State_Enabled) ? QIcon::Normal : QIcon::Disabled, | - | ||||||||||||||||||||||||
| 1137 | (opt->state & QStyle::State_Selected) ? QIcon::On : QIcon::Off ); | - | ||||||||||||||||||||||||
| 1138 | // High-dpi icons do not need adjustmet; make sure tabIconSize is not larger than iconSize | - | ||||||||||||||||||||||||
| 1139 | tabIconSize = QSize(qMin(tabIconSize.width(), iconSize.width()), qMin(tabIconSize.height(), iconSize.height())); | - | ||||||||||||||||||||||||
| 1140 | - | |||||||||||||||||||||||||
| 1141 | *iconRect = QRect(tr.left(), tr.center().y() - tabIconSize.height() / 2, | - | ||||||||||||||||||||||||
| 1142 | tabIconSize.width(), tabIconSize .height()); | - | ||||||||||||||||||||||||
| 1143 | if (!verticalTabs) | - | ||||||||||||||||||||||||
| 1144 | *iconRect = proxyStyle->visualRect(opt->direction, opt->rect, *iconRect); | - | ||||||||||||||||||||||||
| 1145 | tr.setLeft(tr.left() + tabIconSize.width() + 4); | - | ||||||||||||||||||||||||
| 1146 | } | - | ||||||||||||||||||||||||
| 1147 | - | |||||||||||||||||||||||||
| 1148 | if (!verticalTabs) | - | ||||||||||||||||||||||||
| 1149 | tr = proxyStyle->visualRect(opt->direction, opt->rect, tr); | - | ||||||||||||||||||||||||
| 1150 | - | |||||||||||||||||||||||||
| 1151 | *textRect = tr; | - | ||||||||||||||||||||||||
| 1152 | } | - | ||||||||||||||||||||||||
| 1153 | #endif //QT_NO_TABBAR | - | ||||||||||||||||||||||||
| 1154 | - | |||||||||||||||||||||||||
| 1155 | #ifndef QT_NO_ANIMATION | - | ||||||||||||||||||||||||
| 1156 | /*! \internal */ | - | ||||||||||||||||||||||||
| 1157 | QList<const QObject*> QCommonStylePrivate::animationTargets() const | - | ||||||||||||||||||||||||
| 1158 | { | - | ||||||||||||||||||||||||
| 1159 | return animations.keys(); | - | ||||||||||||||||||||||||
| 1160 | } | - | ||||||||||||||||||||||||
| 1161 | - | |||||||||||||||||||||||||
| 1162 | /*! \internal */ | - | ||||||||||||||||||||||||
| 1163 | QStyleAnimation * QCommonStylePrivate::animation(const QObject *target) const | - | ||||||||||||||||||||||||
| 1164 | { | - | ||||||||||||||||||||||||
| 1165 | return animations.value(target); | - | ||||||||||||||||||||||||
| 1166 | } | - | ||||||||||||||||||||||||
| 1167 | - | |||||||||||||||||||||||||
| 1168 | /*! \internal */ | - | ||||||||||||||||||||||||
| 1169 | void QCommonStylePrivate::startAnimation(QStyleAnimation *animation) const | - | ||||||||||||||||||||||||
| 1170 | { | - | ||||||||||||||||||||||||
| 1171 | Q_Q(const QCommonStyle); | - | ||||||||||||||||||||||||
| 1172 | stopAnimation(animation->target()); | - | ||||||||||||||||||||||||
| 1173 | q->connect(animation, SIGNAL(destroyed()), SLOT(_q_removeAnimation()), Qt::UniqueConnection); | - | ||||||||||||||||||||||||
| 1174 | animations.insert(animation->target(), animation); | - | ||||||||||||||||||||||||
| 1175 | animation->start(); | - | ||||||||||||||||||||||||
| 1176 | } | - | ||||||||||||||||||||||||
| 1177 | - | |||||||||||||||||||||||||
| 1178 | /*! \internal */ | - | ||||||||||||||||||||||||
| 1179 | void QCommonStylePrivate::stopAnimation(const QObject *target) const | - | ||||||||||||||||||||||||
| 1180 | { | - | ||||||||||||||||||||||||
| 1181 | QStyleAnimation *animation = animations.take(target); | - | ||||||||||||||||||||||||
| 1182 | if (animation) { | - | ||||||||||||||||||||||||
| 1183 | animation->stop(); | - | ||||||||||||||||||||||||
| 1184 | delete animation; | - | ||||||||||||||||||||||||
| 1185 | } | - | ||||||||||||||||||||||||
| 1186 | } | - | ||||||||||||||||||||||||
| 1187 | - | |||||||||||||||||||||||||
| 1188 | /*! \internal */ | - | ||||||||||||||||||||||||
| 1189 | void QCommonStylePrivate::_q_removeAnimation() | - | ||||||||||||||||||||||||
| 1190 | { | - | ||||||||||||||||||||||||
| 1191 | Q_Q(QCommonStyle); | - | ||||||||||||||||||||||||
| 1192 | QObject *animation = q->sender(); | - | ||||||||||||||||||||||||
| 1193 | if (animation) | - | ||||||||||||||||||||||||
| 1194 | animations.remove(animation->parent()); | - | ||||||||||||||||||||||||
| 1195 | } | - | ||||||||||||||||||||||||
| 1196 | #endif | - | ||||||||||||||||||||||||
| 1197 | - | |||||||||||||||||||||||||
| 1198 | /*! | - | ||||||||||||||||||||||||
| 1199 | \reimp | - | ||||||||||||||||||||||||
| 1200 | */ | - | ||||||||||||||||||||||||
| 1201 | void QCommonStyle::drawControl(ControlElement element, const QStyleOption *opt, | - | ||||||||||||||||||||||||
| 1202 | QPainter *p, const QWidget *widget) const | - | ||||||||||||||||||||||||
| 1203 | { | - | ||||||||||||||||||||||||
| 1204 | Q_D(const QCommonStyle); | - | ||||||||||||||||||||||||
| 1205 | switch (element) { | - | ||||||||||||||||||||||||
| 1206 | - | |||||||||||||||||||||||||
| 1207 | case CE_PushButton: never executed: case CE_PushButton: | 0 | ||||||||||||||||||||||||
| 1208 | if (const QStyleOptionButton *btn = qstyleoption_cast<const QStyleOptionButton *>(opt)) {
| 0 | ||||||||||||||||||||||||
| 1209 | proxy()->drawControl(CE_PushButtonBevel, btn, p, widget); | - | ||||||||||||||||||||||||
| 1210 | QStyleOptionButton subopt = *btn; | - | ||||||||||||||||||||||||
| 1211 | subopt.rect = subElementRect(SE_PushButtonContents, btn, widget); | - | ||||||||||||||||||||||||
| 1212 | proxy()->drawControl(CE_PushButtonLabel, &subopt, p, widget); | - | ||||||||||||||||||||||||
| 1213 | if (btn->state & State_HasFocus) {
| 0 | ||||||||||||||||||||||||
| 1214 | QStyleOptionFocusRect fropt; | - | ||||||||||||||||||||||||
| 1215 | fropt.QStyleOption::operator=(*btn); | - | ||||||||||||||||||||||||
| 1216 | fropt.rect = subElementRect(SE_PushButtonFocusRect, btn, widget); | - | ||||||||||||||||||||||||
| 1217 | proxy()->drawPrimitive(PE_FrameFocusRect, &fropt, p, widget); | - | ||||||||||||||||||||||||
| 1218 | } never executed: end of block | 0 | ||||||||||||||||||||||||
| 1219 | } never executed: end of block | 0 | ||||||||||||||||||||||||
| 1220 | break; never executed: break; | 0 | ||||||||||||||||||||||||
| 1221 | case CE_PushButtonBevel: never executed: case CE_PushButtonBevel: | 0 | ||||||||||||||||||||||||
| 1222 | if (const QStyleOptionButton *btn = qstyleoption_cast<const QStyleOptionButton *>(opt)) {
| 0 | ||||||||||||||||||||||||
| 1223 | QRect br = btn->rect; | - | ||||||||||||||||||||||||
| 1224 | int dbi = proxy()->pixelMetric(PM_ButtonDefaultIndicator, btn, widget); | - | ||||||||||||||||||||||||
| 1225 | if (btn->features & QStyleOptionButton::DefaultButton)
| 0 | ||||||||||||||||||||||||
| 1226 | proxy()->drawPrimitive(PE_FrameDefaultButton, opt, p, widget); never executed: proxy()->drawPrimitive(PE_FrameDefaultButton, opt, p, widget); | 0 | ||||||||||||||||||||||||
| 1227 | if (btn->features & QStyleOptionButton::AutoDefaultButton)
| 0 | ||||||||||||||||||||||||
| 1228 | 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 | ||||||||||||||||||||||||
| 1229 | if (!(btn->features & (QStyleOptionButton::Flat | QStyleOptionButton::CommandLinkButton))
| 0 | ||||||||||||||||||||||||
| 1230 | || btn->state & (State_Sunken | State_On)
| 0 | ||||||||||||||||||||||||
| 1231 | || (btn->features & QStyleOptionButton::CommandLinkButton && btn->state & State_MouseOver)) {
| 0 | ||||||||||||||||||||||||
| 1232 | QStyleOptionButton tmpBtn = *btn; | - | ||||||||||||||||||||||||
| 1233 | tmpBtn.rect = br; | - | ||||||||||||||||||||||||
| 1234 | proxy()->drawPrimitive(PE_PanelButtonCommand, &tmpBtn, p, widget); | - | ||||||||||||||||||||||||
| 1235 | } never executed: end of block | 0 | ||||||||||||||||||||||||
| 1236 | if (btn->features & QStyleOptionButton::HasMenu) {
| 0 | ||||||||||||||||||||||||
| 1237 | int mbi = proxy()->pixelMetric(PM_MenuButtonIndicator, btn, widget); | - | ||||||||||||||||||||||||
| 1238 | QRect ir = btn->rect; | - | ||||||||||||||||||||||||
| 1239 | QStyleOptionButton newBtn = *btn; | - | ||||||||||||||||||||||||
| 1240 | newBtn.rect = QRect(ir.right() - mbi + 2, ir.height()/2 - mbi/2 + 3, mbi - 6, mbi - 6); | - | ||||||||||||||||||||||||
| 1241 | proxy()->drawPrimitive(PE_IndicatorArrowDown, &newBtn, p, widget); | - | ||||||||||||||||||||||||
| 1242 | } never executed: end of block | 0 | ||||||||||||||||||||||||
| 1243 | } never executed: end of block | 0 | ||||||||||||||||||||||||
| 1244 | break; never executed: break; | 0 | ||||||||||||||||||||||||
| 1245 | case CE_PushButtonLabel: never executed: case CE_PushButtonLabel: | 0 | ||||||||||||||||||||||||
| 1246 | if (const QStyleOptionButton *button = qstyleoption_cast<const QStyleOptionButton *>(opt)) {
| 0 | ||||||||||||||||||||||||
| 1247 | QRect textRect = button->rect; | - | ||||||||||||||||||||||||
| 1248 | uint tf = Qt::AlignVCenter | Qt::TextShowMnemonic; | - | ||||||||||||||||||||||||
| 1249 | if (!proxy()->styleHint(SH_UnderlineShortcut, button, widget))
| 0 | ||||||||||||||||||||||||
| 1250 | tf |= Qt::TextHideMnemonic; never executed: tf |= Qt::TextHideMnemonic; | 0 | ||||||||||||||||||||||||
| 1251 | - | |||||||||||||||||||||||||
| 1252 | if (!button->icon.isNull()) {
| 0 | ||||||||||||||||||||||||
| 1253 | //Center both icon and text | - | ||||||||||||||||||||||||
| 1254 | QRect iconRect; | - | ||||||||||||||||||||||||
| 1255 | QIcon::Mode mode = button->state & State_Enabled ? QIcon::Normal : QIcon::Disabled;
| 0 | ||||||||||||||||||||||||
| 1256 | if (mode == QIcon::Normal && button->state & State_HasFocus)
| 0 | ||||||||||||||||||||||||
| 1257 | mode = QIcon::Active; never executed: mode = QIcon::Active; | 0 | ||||||||||||||||||||||||
| 1258 | QIcon::State state = QIcon::Off; | - | ||||||||||||||||||||||||
| 1259 | if (button->state & State_On)
| 0 | ||||||||||||||||||||||||
| 1260 | state = QIcon::On; never executed: state = QIcon::On; | 0 | ||||||||||||||||||||||||
| 1261 | - | |||||||||||||||||||||||||
| 1262 | QPixmap pixmap = button->icon.pixmap(qt_getWindow(widget), button->iconSize, mode, state); | - | ||||||||||||||||||||||||
| 1263 | - | |||||||||||||||||||||||||
| 1264 | int pixmapWidth = pixmap.width() / pixmap.devicePixelRatio(); | - | ||||||||||||||||||||||||
| 1265 | int pixmapHeight = pixmap.height() / pixmap.devicePixelRatio(); | - | ||||||||||||||||||||||||
| 1266 | int labelWidth = pixmapWidth; | - | ||||||||||||||||||||||||
| 1267 | int labelHeight = pixmapHeight; | - | ||||||||||||||||||||||||
| 1268 | int iconSpacing = 4;//### 4 is currently hardcoded in QPushButton::sizeHint() | - | ||||||||||||||||||||||||
| 1269 | int textWidth = button->fontMetrics.boundingRect(opt->rect, tf, button->text).width(); | - | ||||||||||||||||||||||||
| 1270 | if (!button->text.isEmpty())
| 0 | ||||||||||||||||||||||||
| 1271 | labelWidth += (textWidth + iconSpacing); never executed: labelWidth += (textWidth + iconSpacing); | 0 | ||||||||||||||||||||||||
| 1272 | - | |||||||||||||||||||||||||
| 1273 | iconRect = QRect(textRect.x() + (textRect.width() - labelWidth) / 2, | - | ||||||||||||||||||||||||
| 1274 | textRect.y() + (textRect.height() - labelHeight) / 2, | - | ||||||||||||||||||||||||
| 1275 | pixmapWidth, pixmapHeight); | - | ||||||||||||||||||||||||
| 1276 | - | |||||||||||||||||||||||||
| 1277 | iconRect = visualRect(button->direction, textRect, iconRect); | - | ||||||||||||||||||||||||
| 1278 | - | |||||||||||||||||||||||||
| 1279 | tf |= Qt::AlignLeft; //left align, we adjust the text-rect instead | - | ||||||||||||||||||||||||
| 1280 | - | |||||||||||||||||||||||||
| 1281 | if (button->direction == Qt::RightToLeft)
| 0 | ||||||||||||||||||||||||
| 1282 | textRect.setRight(iconRect.left() - iconSpacing); never executed: textRect.setRight(iconRect.left() - iconSpacing); | 0 | ||||||||||||||||||||||||
| 1283 | else | - | ||||||||||||||||||||||||
| 1284 | textRect.setLeft(iconRect.left() + iconRect.width() + iconSpacing); never executed: textRect.setLeft(iconRect.left() + iconRect.width() + iconSpacing); | 0 | ||||||||||||||||||||||||
| 1285 | - | |||||||||||||||||||||||||
| 1286 | if (button->state & (State_On | State_Sunken))
| 0 | ||||||||||||||||||||||||
| 1287 | 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 | ||||||||||||||||||||||||
| 1288 | proxy()->pixelMetric(PM_ButtonShiftVertical, opt, widget)); never executed: iconRect.translate(proxy()->pixelMetric(PM_ButtonShiftHorizontal, opt, widget), proxy()->pixelMetric(PM_ButtonShiftVertical, opt, widget)); | 0 | ||||||||||||||||||||||||
| 1289 | p->drawPixmap(iconRect, pixmap); | - | ||||||||||||||||||||||||
| 1290 | } else { never executed: end of block | 0 | ||||||||||||||||||||||||
| 1291 | tf |= Qt::AlignHCenter; | - | ||||||||||||||||||||||||
| 1292 | } never executed: end of block | 0 | ||||||||||||||||||||||||
| 1293 | if (button->state & (State_On | State_Sunken))
| 0 | ||||||||||||||||||||||||
| 1294 | 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 | ||||||||||||||||||||||||
| 1295 | proxy()->pixelMetric(PM_ButtonShiftVertical, opt, widget)); never executed: textRect.translate(proxy()->pixelMetric(PM_ButtonShiftHorizontal, opt, widget), proxy()->pixelMetric(PM_ButtonShiftVertical, opt, widget)); | 0 | ||||||||||||||||||||||||
| 1296 | - | |||||||||||||||||||||||||
| 1297 | if (button->features & QStyleOptionButton::HasMenu) {
| 0 | ||||||||||||||||||||||||
| 1298 | int indicatorSize = proxy()->pixelMetric(PM_MenuButtonIndicator, button, widget); | - | ||||||||||||||||||||||||
| 1299 | if (button->direction == Qt::LeftToRight)
| 0 | ||||||||||||||||||||||||
| 1300 | textRect = textRect.adjusted(0, 0, -indicatorSize, 0); never executed: textRect = textRect.adjusted(0, 0, -indicatorSize, 0); | 0 | ||||||||||||||||||||||||
| 1301 | else | - | ||||||||||||||||||||||||
| 1302 | textRect = textRect.adjusted(indicatorSize, 0, 0, 0); never executed: textRect = textRect.adjusted(indicatorSize, 0, 0, 0); | 0 | ||||||||||||||||||||||||
| 1303 | } | - | ||||||||||||||||||||||||
| 1304 | proxy()->drawItemText(p, textRect, tf, button->palette, (button->state & State_Enabled), | - | ||||||||||||||||||||||||
| 1305 | button->text, QPalette::ButtonText); | - | ||||||||||||||||||||||||
| 1306 | } never executed: end of block | 0 | ||||||||||||||||||||||||
| 1307 | break; never executed: break; | 0 | ||||||||||||||||||||||||
| 1308 | case CE_RadioButton: never executed: case CE_RadioButton: | 0 | ||||||||||||||||||||||||
| 1309 | case CE_CheckBox: never executed: case CE_CheckBox: | 0 | ||||||||||||||||||||||||
| 1310 | if (const QStyleOptionButton *btn = qstyleoption_cast<const QStyleOptionButton *>(opt)) {
| 0 | ||||||||||||||||||||||||
| 1311 | bool isRadio = (element == CE_RadioButton); | - | ||||||||||||||||||||||||
| 1312 | QStyleOptionButton subopt = *btn; | - | ||||||||||||||||||||||||
| 1313 | subopt.rect = subElementRect(isRadio ? SE_RadioButtonIndicator | - | ||||||||||||||||||||||||
| 1314 | : SE_CheckBoxIndicator, btn, widget); | - | ||||||||||||||||||||||||
| 1315 | proxy()->drawPrimitive(isRadio ? PE_IndicatorRadioButton : PE_IndicatorCheckBox, | - | ||||||||||||||||||||||||
| 1316 | &subopt, p, widget); | - | ||||||||||||||||||||||||
| 1317 | subopt.rect = subElementRect(isRadio ? SE_RadioButtonContents | - | ||||||||||||||||||||||||
| 1318 | : SE_CheckBoxContents, btn, widget); | - | ||||||||||||||||||||||||
| 1319 | proxy()->drawControl(isRadio ? CE_RadioButtonLabel : CE_CheckBoxLabel, &subopt, p, widget); | - | ||||||||||||||||||||||||
| 1320 | if (btn->state & State_HasFocus) {
| 0 | ||||||||||||||||||||||||
| 1321 | QStyleOptionFocusRect fropt; | - | ||||||||||||||||||||||||
| 1322 | fropt.QStyleOption::operator=(*btn); | - | ||||||||||||||||||||||||
| 1323 | fropt.rect = subElementRect(isRadio ? SE_RadioButtonFocusRect | - | ||||||||||||||||||||||||
| 1324 | : SE_CheckBoxFocusRect, btn, widget); | - | ||||||||||||||||||||||||
| 1325 | proxy()->drawPrimitive(PE_FrameFocusRect, &fropt, p, widget); | - | ||||||||||||||||||||||||
| 1326 | } never executed: end of block | 0 | ||||||||||||||||||||||||
| 1327 | } never executed: end of block | 0 | ||||||||||||||||||||||||
| 1328 | break; never executed: break; | 0 | ||||||||||||||||||||||||
| 1329 | case CE_RadioButtonLabel: never executed: case CE_RadioButtonLabel: | 0 | ||||||||||||||||||||||||
| 1330 | case CE_CheckBoxLabel: never executed: case CE_CheckBoxLabel: | 0 | ||||||||||||||||||||||||
| 1331 | if (const QStyleOptionButton *btn = qstyleoption_cast<const QStyleOptionButton *>(opt)) {
| 0 | ||||||||||||||||||||||||
| 1332 | uint alignment = visualAlignment(btn->direction, Qt::AlignLeft | Qt::AlignVCenter); | - | ||||||||||||||||||||||||
| 1333 | - | |||||||||||||||||||||||||
| 1334 | if (!proxy()->styleHint(SH_UnderlineShortcut, btn, widget))
| 0 | ||||||||||||||||||||||||
| 1335 | alignment |= Qt::TextHideMnemonic; never executed: alignment |= Qt::TextHideMnemonic; | 0 | ||||||||||||||||||||||||
| 1336 | QPixmap pix; | - | ||||||||||||||||||||||||
| 1337 | QRect textRect = btn->rect; | - | ||||||||||||||||||||||||
| 1338 | if (!btn->icon.isNull()) {
| 0 | ||||||||||||||||||||||||
| 1339 | pix = btn->icon.pixmap(qt_getWindow(widget), btn->iconSize, btn->state & State_Enabled ? QIcon::Normal : QIcon::Disabled); | - | ||||||||||||||||||||||||
| 1340 | proxy()->drawItemPixmap(p, btn->rect, alignment, pix); | - | ||||||||||||||||||||||||
| 1341 | if (btn->direction == Qt::RightToLeft)
| 0 | ||||||||||||||||||||||||
| 1342 | textRect.setRight(textRect.right() - btn->iconSize.width() - 4); never executed: textRect.setRight(textRect.right() - btn->iconSize.width() - 4); | 0 | ||||||||||||||||||||||||
| 1343 | else | - | ||||||||||||||||||||||||
| 1344 | textRect.setLeft(textRect.left() + btn->iconSize.width() + 4); never executed: textRect.setLeft(textRect.left() + btn->iconSize.width() + 4); | 0 | ||||||||||||||||||||||||
| 1345 | } | - | ||||||||||||||||||||||||
| 1346 | if (!btn->text.isEmpty()){
| 0 | ||||||||||||||||||||||||
| 1347 | proxy()->drawItemText(p, textRect, alignment | Qt::TextShowMnemonic, | - | ||||||||||||||||||||||||
| 1348 | btn->palette, btn->state & State_Enabled, btn->text, QPalette::WindowText); | - | ||||||||||||||||||||||||
| 1349 | } never executed: end of block | 0 | ||||||||||||||||||||||||
| 1350 | } never executed: end of block | 0 | ||||||||||||||||||||||||
| 1351 | break; never executed: break; | 0 | ||||||||||||||||||||||||
| 1352 | #ifndef QT_NO_MENU | - | ||||||||||||||||||||||||
| 1353 | case CE_MenuScroller: { never executed: case CE_MenuScroller: | 0 | ||||||||||||||||||||||||
| 1354 | QStyleOption arrowOpt = *opt; | - | ||||||||||||||||||||||||
| 1355 | arrowOpt.state |= State_Enabled; | - | ||||||||||||||||||||||||
| 1356 | proxy()->drawPrimitive(((opt->state & State_DownArrow) ? PE_IndicatorArrowDown : PE_IndicatorArrowUp), | - | ||||||||||||||||||||||||
| 1357 | &arrowOpt, p, widget); | - | ||||||||||||||||||||||||
| 1358 | break; } never executed: break; | 0 | ||||||||||||||||||||||||
| 1359 | case CE_MenuTearoff: never executed: case CE_MenuTearoff: | 0 | ||||||||||||||||||||||||
| 1360 | if (opt->state & State_Selected)
| 0 | ||||||||||||||||||||||||
| 1361 | p->fillRect(opt->rect, opt->palette.brush(QPalette::Highlight)); never executed: p->fillRect(opt->rect, opt->palette.brush(QPalette::Highlight)); | 0 | ||||||||||||||||||||||||
| 1362 | else | - | ||||||||||||||||||||||||
| 1363 | p->fillRect(opt->rect, opt->palette.brush(QPalette::Button)); never executed: p->fillRect(opt->rect, opt->palette.brush(QPalette::Button)); | 0 | ||||||||||||||||||||||||
| 1364 | p->setPen(QPen(opt->palette.dark().color(), 1, Qt::DashLine)); | - | ||||||||||||||||||||||||
| 1365 | p->drawLine(opt->rect.x() + 2, opt->rect.y() + opt->rect.height() / 2 - 1, | - | ||||||||||||||||||||||||
| 1366 | opt->rect.x() + opt->rect.width() - 4, | - | ||||||||||||||||||||||||
| 1367 | opt->rect.y() + opt->rect.height() / 2 - 1); | - | ||||||||||||||||||||||||
| 1368 | p->setPen(QPen(opt->palette.light().color(), 1, Qt::DashLine)); | - | ||||||||||||||||||||||||
| 1369 | p->drawLine(opt->rect.x() + 2, opt->rect.y() + opt->rect.height() / 2, | - | ||||||||||||||||||||||||
| 1370 | opt->rect.x() + opt->rect.width() - 4, opt->rect.y() + opt->rect.height() / 2); | - | ||||||||||||||||||||||||
| 1371 | break; never executed: break; | 0 | ||||||||||||||||||||||||
| 1372 | #endif // QT_NO_MENU | - | ||||||||||||||||||||||||
| 1373 | #ifndef QT_NO_MENUBAR | - | ||||||||||||||||||||||||
| 1374 | case CE_MenuBarItem: never executed: case CE_MenuBarItem: | 0 | ||||||||||||||||||||||||
| 1375 | if (const QStyleOptionMenuItem *mbi = qstyleoption_cast<const QStyleOptionMenuItem *>(opt)) {
| 0 | ||||||||||||||||||||||||
| 1376 | uint alignment = Qt::AlignCenter | Qt::TextShowMnemonic | Qt::TextDontClip | - | ||||||||||||||||||||||||
| 1377 | | Qt::TextSingleLine; | - | ||||||||||||||||||||||||
| 1378 | if (!proxy()->styleHint(SH_UnderlineShortcut, mbi, widget))
| 0 | ||||||||||||||||||||||||
| 1379 | alignment |= Qt::TextHideMnemonic; never executed: alignment |= Qt::TextHideMnemonic; | 0 | ||||||||||||||||||||||||
| 1380 | int iconExtent = proxy()->pixelMetric(PM_SmallIconSize); | - | ||||||||||||||||||||||||
| 1381 | QPixmap pix = mbi->icon.pixmap(qt_getWindow(widget), QSize(iconExtent, iconExtent), (mbi->state & State_Enabled) ? QIcon::Normal : QIcon::Disabled); | - | ||||||||||||||||||||||||
| 1382 | if (!pix.isNull())
| 0 | ||||||||||||||||||||||||
| 1383 | proxy()->drawItemPixmap(p,mbi->rect, alignment, pix); never executed: proxy()->drawItemPixmap(p,mbi->rect, alignment, pix); | 0 | ||||||||||||||||||||||||
| 1384 | else | - | ||||||||||||||||||||||||
| 1385 | 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 | ||||||||||||||||||||||||
| 1386 | mbi->text, QPalette::ButtonText); never executed: proxy()->drawItemText(p, mbi->rect, alignment, mbi->palette, mbi->state & State_Enabled, mbi->text, QPalette::ButtonText); | 0 | ||||||||||||||||||||||||
| 1387 | } | - | ||||||||||||||||||||||||
| 1388 | break; never executed: break; | 0 | ||||||||||||||||||||||||
| 1389 | case CE_MenuBarEmptyArea: never executed: case CE_MenuBarEmptyArea: | 0 | ||||||||||||||||||||||||
| 1390 | if (widget && !widget->testAttribute(Qt::WA_NoSystemBackground))
| 0 | ||||||||||||||||||||||||
| 1391 | p->eraseRect(opt->rect); never executed: p->eraseRect(opt->rect); | 0 | ||||||||||||||||||||||||
| 1392 | break; never executed: break; | 0 | ||||||||||||||||||||||||
| 1393 | #endif // QT_NO_MENUBAR | - | ||||||||||||||||||||||||
| 1394 | #ifndef QT_NO_PROGRESSBAR | - | ||||||||||||||||||||||||
| 1395 | case CE_ProgressBar: never executed: case CE_ProgressBar: | 0 | ||||||||||||||||||||||||
| 1396 | if (const QStyleOptionProgressBar *pb
| 0 | ||||||||||||||||||||||||
| 1397 | = qstyleoption_cast<const QStyleOptionProgressBar *>(opt)) {
| 0 | ||||||||||||||||||||||||
| 1398 | QStyleOptionProgressBar subopt = *pb; | - | ||||||||||||||||||||||||
| 1399 | subopt.rect = subElementRect(SE_ProgressBarGroove, pb, widget); | - | ||||||||||||||||||||||||
| 1400 | proxy()->drawControl(CE_ProgressBarGroove, &subopt, p, widget); | - | ||||||||||||||||||||||||
| 1401 | subopt.rect = subElementRect(SE_ProgressBarContents, pb, widget); | - | ||||||||||||||||||||||||
| 1402 | proxy()->drawControl(CE_ProgressBarContents, &subopt, p, widget); | - | ||||||||||||||||||||||||
| 1403 | if (pb->textVisible) {
| 0 | ||||||||||||||||||||||||
| 1404 | subopt.rect = subElementRect(SE_ProgressBarLabel, pb, widget); | - | ||||||||||||||||||||||||
| 1405 | proxy()->drawControl(CE_ProgressBarLabel, &subopt, p, widget); | - | ||||||||||||||||||||||||
| 1406 | } never executed: end of block | 0 | ||||||||||||||||||||||||
| 1407 | } never executed: end of block | 0 | ||||||||||||||||||||||||
| 1408 | break; never executed: break; | 0 | ||||||||||||||||||||||||
| 1409 | case CE_ProgressBarGroove: never executed: case CE_ProgressBarGroove: | 0 | ||||||||||||||||||||||||
| 1410 | if (opt->rect.isValid())
| 0 | ||||||||||||||||||||||||
| 1411 | qDrawShadePanel(p, opt->rect, opt->palette, true, 1, never executed: qDrawShadePanel(p, opt->rect, opt->palette, true, 1, &opt->palette.brush(QPalette::Window)); | 0 | ||||||||||||||||||||||||
| 1412 | &opt->palette.brush(QPalette::Window)); never executed: qDrawShadePanel(p, opt->rect, opt->palette, true, 1, &opt->palette.brush(QPalette::Window)); | 0 | ||||||||||||||||||||||||
| 1413 | break; never executed: break; | 0 | ||||||||||||||||||||||||
| 1414 | case CE_ProgressBarLabel: never executed: case CE_ProgressBarLabel: | 0 | ||||||||||||||||||||||||
| 1415 | if (const QStyleOptionProgressBar *pb = qstyleoption_cast<const QStyleOptionProgressBar *>(opt)) {
| 0 | ||||||||||||||||||||||||
| 1416 | const bool vertical = pb->orientation == Qt::Vertical; | - | ||||||||||||||||||||||||
| 1417 | if (!vertical) {
| 0 | ||||||||||||||||||||||||
| 1418 | QPalette::ColorRole textRole = QPalette::NoRole; | - | ||||||||||||||||||||||||
| 1419 | if ((pb->textAlignment & Qt::AlignCenter) && pb->textVisible
| 0 | ||||||||||||||||||||||||
| 1420 | && ((qint64(pb->progress) - qint64(pb->minimum)) * 2 >= (qint64(pb->maximum) - qint64(pb->minimum)))) {
| 0 | ||||||||||||||||||||||||
| 1421 | textRole = QPalette::HighlightedText; | - | ||||||||||||||||||||||||
| 1422 | //Draw text shadow, This will increase readability when the background of same color | - | ||||||||||||||||||||||||
| 1423 | QRect shadowRect(pb->rect); | - | ||||||||||||||||||||||||
| 1424 | shadowRect.translate(1,1); | - | ||||||||||||||||||||||||
| 1425 | QColor shadowColor = (pb->palette.color(textRole).value() <= 128)
| 0 | ||||||||||||||||||||||||
| 1426 | ? QColor(255,255,255,160) : QColor(0,0,0,160); | - | ||||||||||||||||||||||||
| 1427 | QPalette shadowPalette = pb->palette; | - | ||||||||||||||||||||||||
| 1428 | shadowPalette.setColor(textRole, shadowColor); | - | ||||||||||||||||||||||||
| 1429 | proxy()->drawItemText(p, shadowRect, Qt::AlignCenter | Qt::TextSingleLine, shadowPalette, | - | ||||||||||||||||||||||||
| 1430 | pb->state & State_Enabled, pb->text, textRole); | - | ||||||||||||||||||||||||
| 1431 | } never executed: end of block | 0 | ||||||||||||||||||||||||
| 1432 | proxy()->drawItemText(p, pb->rect, Qt::AlignCenter | Qt::TextSingleLine, pb->palette, | - | ||||||||||||||||||||||||
| 1433 | pb->state & State_Enabled, pb->text, textRole); | - | ||||||||||||||||||||||||
| 1434 | } never executed: end of block | 0 | ||||||||||||||||||||||||
| 1435 | } never executed: end of block | 0 | ||||||||||||||||||||||||
| 1436 | break; never executed: break; | 0 | ||||||||||||||||||||||||
| 1437 | case CE_ProgressBarContents: never executed: case CE_ProgressBarContents: | 0 | ||||||||||||||||||||||||
| 1438 | if (const QStyleOptionProgressBar *pb = qstyleoption_cast<const QStyleOptionProgressBar *>(opt)) {
| 0 | ||||||||||||||||||||||||
| 1439 | - | |||||||||||||||||||||||||
| 1440 | QRect rect = pb->rect; | - | ||||||||||||||||||||||||
| 1441 | const bool vertical = pb->orientation == Qt::Vertical; | - | ||||||||||||||||||||||||
| 1442 | const bool inverted = pb->invertedAppearance; | - | ||||||||||||||||||||||||
| 1443 | qint64 minimum = qint64(pb->minimum); | - | ||||||||||||||||||||||||
| 1444 | qint64 maximum = qint64(pb->maximum); | - | ||||||||||||||||||||||||
| 1445 | qint64 progress = qint64(pb->progress); | - | ||||||||||||||||||||||||
| 1446 | - | |||||||||||||||||||||||||
| 1447 | QMatrix m; | - | ||||||||||||||||||||||||
| 1448 | - | |||||||||||||||||||||||||
| 1449 | if (vertical) {
| 0 | ||||||||||||||||||||||||
| 1450 | rect = QRect(rect.y(), rect.x(), rect.height(), rect.width()); // flip width and height | - | ||||||||||||||||||||||||
| 1451 | m.rotate(90); | - | ||||||||||||||||||||||||
| 1452 | m.translate(0, -(rect.height() + rect.y()*2)); | - | ||||||||||||||||||||||||
| 1453 | } never executed: end of block | 0 | ||||||||||||||||||||||||
| 1454 | - | |||||||||||||||||||||||||
| 1455 | QPalette pal2 = pb->palette; | - | ||||||||||||||||||||||||
| 1456 | // Correct the highlight color if it is the same as the background | - | ||||||||||||||||||||||||
| 1457 | if (pal2.highlight() == pal2.background())
| 0 | ||||||||||||||||||||||||
| 1458 | pal2.setColor(QPalette::Highlight, pb->palette.color(QPalette::Active, never executed: pal2.setColor(QPalette::Highlight, pb->palette.color(QPalette::Active, QPalette::Highlight)); | 0 | ||||||||||||||||||||||||
| 1459 | QPalette::Highlight)); never executed: pal2.setColor(QPalette::Highlight, pb->palette.color(QPalette::Active, QPalette::Highlight)); | 0 | ||||||||||||||||||||||||
| 1460 | bool reverse = ((!vertical && (pb->direction == Qt::RightToLeft)) || vertical);
| 0 | ||||||||||||||||||||||||
| 1461 | if (inverted)
| 0 | ||||||||||||||||||||||||
| 1462 | reverse = !reverse; never executed: reverse = !reverse; | 0 | ||||||||||||||||||||||||
| 1463 | int w = rect.width(); | - | ||||||||||||||||||||||||
| 1464 | if (pb->minimum == 0 && pb->maximum == 0) {
| 0 | ||||||||||||||||||||||||
| 1465 | // draw busy indicator | - | ||||||||||||||||||||||||
| 1466 | int x = (progress - minimum) % (w * 2); | - | ||||||||||||||||||||||||
| 1467 | if (x > w)
| 0 | ||||||||||||||||||||||||
| 1468 | x = 2 * w - x; never executed: x = 2 * w - x; | 0 | ||||||||||||||||||||||||
| 1469 | x = reverse ? rect.right() - x : x + rect.x();
| 0 | ||||||||||||||||||||||||
| 1470 | p->setPen(QPen(pal2.highlight().color(), 4)); | - | ||||||||||||||||||||||||
| 1471 | p->drawLine(x, rect.y(), x, rect.height()); | - | ||||||||||||||||||||||||
| 1472 | } else { never executed: end of block | 0 | ||||||||||||||||||||||||
| 1473 | const int unit_width = proxy()->pixelMetric(PM_ProgressBarChunkWidth, pb, widget); | - | ||||||||||||||||||||||||
| 1474 | if (!unit_width)
| 0 | ||||||||||||||||||||||||
| 1475 | return; never executed: return; | 0 | ||||||||||||||||||||||||
| 1476 | - | |||||||||||||||||||||||||
| 1477 | int u; | - | ||||||||||||||||||||||||
| 1478 | if (unit_width > 1)
| 0 | ||||||||||||||||||||||||
| 1479 | u = ((rect.width() + unit_width) / unit_width); never executed: u = ((rect.width() + unit_width) / unit_width); | 0 | ||||||||||||||||||||||||
| 1480 | else | - | ||||||||||||||||||||||||
| 1481 | u = w / unit_width; never executed: u = w / unit_width; | 0 | ||||||||||||||||||||||||
| 1482 | qint64 p_v = progress - minimum; | - | ||||||||||||||||||||||||
| 1483 | qint64 t_s = (maximum - minimum) ? (maximum - minimum) : qint64(1);
| 0 | ||||||||||||||||||||||||
| 1484 | - | |||||||||||||||||||||||||
| 1485 | if (u > 0 && p_v >= INT_MAX / u && t_s >= u) {
| 0 | ||||||||||||||||||||||||
| 1486 | // scale down to something usable. | - | ||||||||||||||||||||||||
| 1487 | p_v /= u; | - | ||||||||||||||||||||||||
| 1488 | t_s /= u; | - | ||||||||||||||||||||||||
| 1489 | } never executed: end of block | 0 | ||||||||||||||||||||||||
| 1490 | - | |||||||||||||||||||||||||
| 1491 | // nu < tnu, if last chunk is only a partial chunk | - | ||||||||||||||||||||||||
| 1492 | int tnu, nu; | - | ||||||||||||||||||||||||
| 1493 | tnu = nu = p_v * u / t_s; | - | ||||||||||||||||||||||||
| 1494 | - | |||||||||||||||||||||||||
| 1495 | if (nu * unit_width > w)
| 0 | ||||||||||||||||||||||||
| 1496 | --nu; never executed: --nu; | 0 | ||||||||||||||||||||||||
| 1497 | - | |||||||||||||||||||||||||
| 1498 | // Draw nu units out of a possible u of unit_width | - | ||||||||||||||||||||||||
| 1499 | // width, each a rectangle bordered by background | - | ||||||||||||||||||||||||
| 1500 | // color, all in a sunken panel with a percentage text | - | ||||||||||||||||||||||||
| 1501 | // display at the end. | - | ||||||||||||||||||||||||
| 1502 | int x = 0; | - | ||||||||||||||||||||||||
| 1503 | int x0 = reverse ? rect.right() - ((unit_width > 1) ? unit_width : 0)
| 0 | ||||||||||||||||||||||||
| 1504 | : rect.x(); | - | ||||||||||||||||||||||||
| 1505 | - | |||||||||||||||||||||||||
| 1506 | QStyleOptionProgressBar pbBits = *pb; | - | ||||||||||||||||||||||||
| 1507 | pbBits.rect = rect; | - | ||||||||||||||||||||||||
| 1508 | pbBits.palette = pal2; | - | ||||||||||||||||||||||||
| 1509 | int myY = pbBits.rect.y(); | - | ||||||||||||||||||||||||
| 1510 | int myHeight = pbBits.rect.height(); | - | ||||||||||||||||||||||||
| 1511 | pbBits.state = State_None; | - | ||||||||||||||||||||||||
| 1512 | for (int i = 0; i < nu; ++i) {
| 0 | ||||||||||||||||||||||||
| 1513 | pbBits.rect.setRect(x0 + x, myY, unit_width, myHeight); | - | ||||||||||||||||||||||||
| 1514 | pbBits.rect = m.mapRect(QRectF(pbBits.rect)).toRect(); | - | ||||||||||||||||||||||||
| 1515 | proxy()->drawPrimitive(PE_IndicatorProgressChunk, &pbBits, p, widget); | - | ||||||||||||||||||||||||
| 1516 | x += reverse ? -unit_width : unit_width;
| 0 | ||||||||||||||||||||||||
| 1517 | } never executed: end of block | 0 | ||||||||||||||||||||||||
| 1518 | - | |||||||||||||||||||||||||
| 1519 | // Draw the last partial chunk to fill up the | - | ||||||||||||||||||||||||
| 1520 | // progress bar entirely | - | ||||||||||||||||||||||||
| 1521 | if (nu < tnu) {
| 0 | ||||||||||||||||||||||||
| 1522 | int pixels_left = w - (nu * unit_width); | - | ||||||||||||||||||||||||
| 1523 | int offset = reverse ? x0 + x + unit_width-pixels_left : x0 + x;
| 0 | ||||||||||||||||||||||||
| 1524 | pbBits.rect.setRect(offset, myY, pixels_left, myHeight); | - | ||||||||||||||||||||||||
| 1525 | pbBits.rect = m.mapRect(QRectF(pbBits.rect)).toRect(); | - | ||||||||||||||||||||||||
| 1526 | proxy()->drawPrimitive(PE_IndicatorProgressChunk, &pbBits, p, widget); | - | ||||||||||||||||||||||||
| 1527 | } never executed: end of block | 0 | ||||||||||||||||||||||||
| 1528 | } never executed: end of block | 0 | ||||||||||||||||||||||||
| 1529 | } | - | ||||||||||||||||||||||||
| 1530 | break; never executed: break; | 0 | ||||||||||||||||||||||||
| 1531 | #endif // QT_NO_PROGRESSBAR | - | ||||||||||||||||||||||||
| 1532 | case CE_HeaderLabel: never executed: case CE_HeaderLabel: | 0 | ||||||||||||||||||||||||
| 1533 | if (const QStyleOptionHeader *header = qstyleoption_cast<const QStyleOptionHeader *>(opt)) {
| 0 | ||||||||||||||||||||||||
| 1534 | QRect rect = header->rect; | - | ||||||||||||||||||||||||
| 1535 | if (!header->icon.isNull()) {
| 0 | ||||||||||||||||||||||||
| 1536 | int iconExtent = proxy()->pixelMetric(PM_SmallIconSize); | - | ||||||||||||||||||||||||
| 1537 | QPixmap pixmap | - | ||||||||||||||||||||||||
| 1538 | = header->icon.pixmap(qt_getWindow(widget), QSize(iconExtent, iconExtent), (header->state & State_Enabled) ? QIcon::Normal : QIcon::Disabled); | - | ||||||||||||||||||||||||
| 1539 | int pixw = pixmap.width() / pixmap.devicePixelRatio(); | - | ||||||||||||||||||||||||
| 1540 | - | |||||||||||||||||||||||||
| 1541 | QRect aligned = alignedRect(header->direction, QFlag(header->iconAlignment), pixmap.size() / pixmap.devicePixelRatio(), rect); | - | ||||||||||||||||||||||||
| 1542 | QRect inter = aligned.intersected(rect); | - | ||||||||||||||||||||||||
| 1543 | p->drawPixmap(inter.x(), inter.y(), pixmap, | - | ||||||||||||||||||||||||
| 1544 | inter.x() - aligned.x(), inter.y() - aligned.y(), | - | ||||||||||||||||||||||||
| 1545 | aligned.width() * pixmap.devicePixelRatio(), | - | ||||||||||||||||||||||||
| 1546 | pixmap.height() * pixmap.devicePixelRatio()); | - | ||||||||||||||||||||||||
| 1547 | - | |||||||||||||||||||||||||
| 1548 | if (header->direction == Qt::LeftToRight)
| 0 | ||||||||||||||||||||||||
| 1549 | rect.setLeft(rect.left() + pixw + 2); never executed: rect.setLeft(rect.left() + pixw + 2); | 0 | ||||||||||||||||||||||||
| 1550 | else | - | ||||||||||||||||||||||||
| 1551 | rect.setRight(rect.right() - pixw - 2); never executed: rect.setRight(rect.right() - pixw - 2); | 0 | ||||||||||||||||||||||||
| 1552 | } | - | ||||||||||||||||||||||||
| 1553 | if (header->state & QStyle::State_On) {
| 0 | ||||||||||||||||||||||||
| 1554 | QFont fnt = p->font(); | - | ||||||||||||||||||||||||
| 1555 | fnt.setBold(true); | - | ||||||||||||||||||||||||
| 1556 | p->setFont(fnt); | - | ||||||||||||||||||||||||
| 1557 | } never executed: end of block | 0 | ||||||||||||||||||||||||
| 1558 | proxy()->drawItemText(p, rect, header->textAlignment, header->palette, | - | ||||||||||||||||||||||||
| 1559 | (header->state & State_Enabled), header->text, QPalette::ButtonText); | - | ||||||||||||||||||||||||
| 1560 | } never executed: end of block | 0 | ||||||||||||||||||||||||
| 1561 | break; never executed: break; | 0 | ||||||||||||||||||||||||
| 1562 | #ifndef QT_NO_TOOLBUTTON | - | ||||||||||||||||||||||||
| 1563 | case CE_ToolButtonLabel: never executed: case CE_ToolButtonLabel: | 0 | ||||||||||||||||||||||||
| 1564 | if (const QStyleOptionToolButton *toolbutton
| 0 | ||||||||||||||||||||||||
| 1565 | = qstyleoption_cast<const QStyleOptionToolButton *>(opt)) {
| 0 | ||||||||||||||||||||||||
| 1566 | QRect rect = toolbutton->rect; | - | ||||||||||||||||||||||||
| 1567 | int shiftX = 0; | - | ||||||||||||||||||||||||
| 1568 | int shiftY = 0; | - | ||||||||||||||||||||||||
| 1569 | if (toolbutton->state & (State_Sunken | State_On)) {
| 0 | ||||||||||||||||||||||||
| 1570 | shiftX = proxy()->pixelMetric(PM_ButtonShiftHorizontal, toolbutton, widget); | - | ||||||||||||||||||||||||
| 1571 | shiftY = proxy()->pixelMetric(PM_ButtonShiftVertical, toolbutton, widget); | - | ||||||||||||||||||||||||
| 1572 | } never executed: end of block | 0 | ||||||||||||||||||||||||
| 1573 | // Arrow type always overrules and is always shown | - | ||||||||||||||||||||||||
| 1574 | bool hasArrow = toolbutton->features & QStyleOptionToolButton::Arrow; | - | ||||||||||||||||||||||||
| 1575 | if (((!hasArrow && toolbutton->icon.isNull()) && !toolbutton->text.isEmpty())
| 0 | ||||||||||||||||||||||||
| 1576 | || toolbutton->toolButtonStyle == Qt::ToolButtonTextOnly) {
| 0 | ||||||||||||||||||||||||
| 1577 | int alignment = Qt::AlignCenter | Qt::TextShowMnemonic; | - | ||||||||||||||||||||||||
| 1578 | if (!proxy()->styleHint(SH_UnderlineShortcut, opt, widget))
| 0 | ||||||||||||||||||||||||
| 1579 | alignment |= Qt::TextHideMnemonic; never executed: alignment |= Qt::TextHideMnemonic; | 0 | ||||||||||||||||||||||||
| 1580 | rect.translate(shiftX, shiftY); | - | ||||||||||||||||||||||||
| 1581 | p->setFont(toolbutton->font); | - | ||||||||||||||||||||||||
| 1582 | proxy()->drawItemText(p, rect, alignment, toolbutton->palette, | - | ||||||||||||||||||||||||
| 1583 | opt->state & State_Enabled, toolbutton->text, | - | ||||||||||||||||||||||||
| 1584 | QPalette::ButtonText); | - | ||||||||||||||||||||||||
| 1585 | } else { never executed: end of block | 0 | ||||||||||||||||||||||||
| 1586 | QPixmap pm; | - | ||||||||||||||||||||||||
| 1587 | QSize pmSize = toolbutton->iconSize; | - | ||||||||||||||||||||||||
| 1588 | if (!toolbutton->icon.isNull()) {
| 0 | ||||||||||||||||||||||||
| 1589 | QIcon::State state = toolbutton->state & State_On ? QIcon::On : QIcon::Off;
| 0 | ||||||||||||||||||||||||
| 1590 | QIcon::Mode mode; | - | ||||||||||||||||||||||||
| 1591 | if (!(toolbutton->state & State_Enabled))
| 0 | ||||||||||||||||||||||||
| 1592 | mode = QIcon::Disabled; never executed: mode = QIcon::Disabled; | 0 | ||||||||||||||||||||||||
| 1593 | else if ((opt->state & State_MouseOver) && (opt->state & State_AutoRaise))
| 0 | ||||||||||||||||||||||||
| 1594 | mode = QIcon::Active; never executed: mode = QIcon::Active; | 0 | ||||||||||||||||||||||||
| 1595 | else | - | ||||||||||||||||||||||||
| 1596 | mode = QIcon::Normal; never executed: mode = QIcon::Normal; | 0 | ||||||||||||||||||||||||
| 1597 | pm = toolbutton->icon.pixmap(qt_getWindow(widget), toolbutton->rect.size().boundedTo(toolbutton->iconSize), | - | ||||||||||||||||||||||||
| 1598 | mode, state); | - | ||||||||||||||||||||||||
| 1599 | pmSize = pm.size() / pm.devicePixelRatio(); | - | ||||||||||||||||||||||||
| 1600 | } never executed: end of block | 0 | ||||||||||||||||||||||||
| 1601 | - | |||||||||||||||||||||||||
| 1602 | if (toolbutton->toolButtonStyle != Qt::ToolButtonIconOnly) {
| 0 | ||||||||||||||||||||||||
| 1603 | p->setFont(toolbutton->font); | - | ||||||||||||||||||||||||
| 1604 | QRect pr = rect, | - | ||||||||||||||||||||||||
| 1605 | tr = rect; | - | ||||||||||||||||||||||||
| 1606 | int alignment = Qt::TextShowMnemonic; | - | ||||||||||||||||||||||||
| 1607 | if (!proxy()->styleHint(SH_UnderlineShortcut, opt, widget))
| 0 | ||||||||||||||||||||||||
| 1608 | alignment |= Qt::TextHideMnemonic; never executed: alignment |= Qt::TextHideMnemonic; | 0 | ||||||||||||||||||||||||
| 1609 | - | |||||||||||||||||||||||||
| 1610 | if (toolbutton->toolButtonStyle == Qt::ToolButtonTextUnderIcon) {
| 0 | ||||||||||||||||||||||||
| 1611 | pr.setHeight(pmSize.height() + 6); | - | ||||||||||||||||||||||||
| 1612 | tr.adjust(0, pr.height() - 1, 0, -1); | - | ||||||||||||||||||||||||
| 1613 | pr.translate(shiftX, shiftY); | - | ||||||||||||||||||||||||
| 1614 | if (!hasArrow) {
| 0 | ||||||||||||||||||||||||
| 1615 | proxy()->drawItemPixmap(p, pr, Qt::AlignCenter, pm); | - | ||||||||||||||||||||||||
| 1616 | } else { never executed: end of block | 0 | ||||||||||||||||||||||||
| 1617 | drawArrow(proxy(), toolbutton, pr, p, widget); | - | ||||||||||||||||||||||||
| 1618 | } never executed: end of block | 0 | ||||||||||||||||||||||||
| 1619 | alignment |= Qt::AlignCenter; | - | ||||||||||||||||||||||||
| 1620 | } else { never executed: end of block | 0 | ||||||||||||||||||||||||
| 1621 | pr.setWidth(pmSize.width() + 8); | - | ||||||||||||||||||||||||
| 1622 | tr.adjust(pr.width(), 0, 0, 0); | - | ||||||||||||||||||||||||
| 1623 | pr.translate(shiftX, shiftY); | - | ||||||||||||||||||||||||
| 1624 | if (!hasArrow) {
| 0 | ||||||||||||||||||||||||
| 1625 | proxy()->drawItemPixmap(p, QStyle::visualRect(opt->direction, rect, pr), Qt::AlignCenter, pm); | - | ||||||||||||||||||||||||
| 1626 | } else { never executed: end of block | 0 | ||||||||||||||||||||||||
| 1627 | drawArrow(proxy(), toolbutton, pr, p, widget); | - | ||||||||||||||||||||||||
| 1628 | } never executed: end of block | 0 | ||||||||||||||||||||||||
| 1629 | alignment |= Qt::AlignLeft | Qt::AlignVCenter; | - | ||||||||||||||||||||||||
| 1630 | } never executed: end of block | 0 | ||||||||||||||||||||||||
| 1631 | tr.translate(shiftX, shiftY); | - | ||||||||||||||||||||||||
| 1632 | proxy()->drawItemText(p, QStyle::visualRect(opt->direction, rect, tr), alignment, toolbutton->palette, | - | ||||||||||||||||||||||||
| 1633 | toolbutton->state & State_Enabled, toolbutton->text, | - | ||||||||||||||||||||||||
| 1634 | QPalette::ButtonText); | - | ||||||||||||||||||||||||
| 1635 | } else { never executed: end of block | 0 | ||||||||||||||||||||||||
| 1636 | rect.translate(shiftX, shiftY); | - | ||||||||||||||||||||||||
| 1637 | if (hasArrow) {
| 0 | ||||||||||||||||||||||||
| 1638 | drawArrow(proxy(), toolbutton, rect, p, widget); | - | ||||||||||||||||||||||||
| 1639 | } else { never executed: end of block | 0 | ||||||||||||||||||||||||
| 1640 | proxy()->drawItemPixmap(p, rect, Qt::AlignCenter, pm); | - | ||||||||||||||||||||||||
| 1641 | } never executed: end of block | 0 | ||||||||||||||||||||||||
| 1642 | } | - | ||||||||||||||||||||||||
| 1643 | } | - | ||||||||||||||||||||||||
| 1644 | } | - | ||||||||||||||||||||||||
| 1645 | break; never executed: break; | 0 | ||||||||||||||||||||||||
| 1646 | #endif // QT_NO_TOOLBUTTON | - | ||||||||||||||||||||||||
| 1647 | #ifndef QT_NO_TOOLBOX | - | ||||||||||||||||||||||||
| 1648 | case CE_ToolBoxTab: never executed: case CE_ToolBoxTab: | 0 | ||||||||||||||||||||||||
| 1649 | if (const QStyleOptionToolBox *tb = qstyleoption_cast<const QStyleOptionToolBox *>(opt)) {
| 0 | ||||||||||||||||||||||||
| 1650 | proxy()->drawControl(CE_ToolBoxTabShape, tb, p, widget); | - | ||||||||||||||||||||||||
| 1651 | proxy()->drawControl(CE_ToolBoxTabLabel, tb, p, widget); | - | ||||||||||||||||||||||||
| 1652 | } never executed: end of block | 0 | ||||||||||||||||||||||||
| 1653 | break; never executed: break; | 0 | ||||||||||||||||||||||||
| 1654 | case CE_ToolBoxTabShape: never executed: case CE_ToolBoxTabShape: | 0 | ||||||||||||||||||||||||
| 1655 | if (const QStyleOptionToolBox *tb = qstyleoption_cast<const QStyleOptionToolBox *>(opt)) {
| 0 | ||||||||||||||||||||||||
| 1656 | p->setPen(tb->palette.mid().color().darker(150)); | - | ||||||||||||||||||||||||
| 1657 | bool oldQt4CompatiblePainting = p->testRenderHint(QPainter::Qt4CompatiblePainting); | - | ||||||||||||||||||||||||
| 1658 | p->setRenderHint(QPainter::Qt4CompatiblePainting); | - | ||||||||||||||||||||||||
| 1659 | int d = 20 + tb->rect.height() - 3; | - | ||||||||||||||||||||||||
| 1660 | if (tb->direction != Qt::RightToLeft) {
| 0 | ||||||||||||||||||||||||
| 1661 | const QPoint points[] = { | - | ||||||||||||||||||||||||
| 1662 | QPoint(-1, tb->rect.height() + 1), | - | ||||||||||||||||||||||||
| 1663 | QPoint(-1, 1), | - | ||||||||||||||||||||||||
| 1664 | QPoint(tb->rect.width() - d, 1), | - | ||||||||||||||||||||||||
| 1665 | QPoint(tb->rect.width() - 20, tb->rect.height() - 2), | - | ||||||||||||||||||||||||
| 1666 | QPoint(tb->rect.width() - 1, tb->rect.height() - 2), | - | ||||||||||||||||||||||||
| 1667 | QPoint(tb->rect.width() - 1, tb->rect.height() + 1), | - | ||||||||||||||||||||||||
| 1668 | QPoint(-1, tb->rect.height() + 1), | - | ||||||||||||||||||||||||
| 1669 | }; | - | ||||||||||||||||||||||||
| 1670 | p->drawPolygon(points, sizeof points / sizeof *points); | - | ||||||||||||||||||||||||
| 1671 | } else { never executed: end of block | 0 | ||||||||||||||||||||||||
| 1672 | const QPoint points[] = { | - | ||||||||||||||||||||||||
| 1673 | QPoint(tb->rect.width(), tb->rect.height() + 1), | - | ||||||||||||||||||||||||
| 1674 | QPoint(tb->rect.width(), 1), | - | ||||||||||||||||||||||||
| 1675 | QPoint(d - 1, 1), | - | ||||||||||||||||||||||||
| 1676 | QPoint(20 - 1, tb->rect.height() - 2), | - | ||||||||||||||||||||||||
| 1677 | QPoint(0, tb->rect.height() - 2), | - | ||||||||||||||||||||||||
| 1678 | QPoint(0, tb->rect.height() + 1), | - | ||||||||||||||||||||||||
| 1679 | QPoint(tb->rect.width(), tb->rect.height() + 1), | - | ||||||||||||||||||||||||
| 1680 | }; | - | ||||||||||||||||||||||||
| 1681 | p->drawPolygon(points, sizeof points / sizeof *points); | - | ||||||||||||||||||||||||
| 1682 | } never executed: end of block | 0 | ||||||||||||||||||||||||
| 1683 | p->setRenderHint(QPainter::Qt4CompatiblePainting, oldQt4CompatiblePainting); | - | ||||||||||||||||||||||||
| 1684 | p->setPen(tb->palette.light().color()); | - | ||||||||||||||||||||||||
| 1685 | if (tb->direction != Qt::RightToLeft) {
| 0 | ||||||||||||||||||||||||
| 1686 | p->drawLine(0, 2, tb->rect.width() - d, 2); | - | ||||||||||||||||||||||||
| 1687 | p->drawLine(tb->rect.width() - d - 1, 2, tb->rect.width() - 21, tb->rect.height() - 1); | - | ||||||||||||||||||||||||
| 1688 | p->drawLine(tb->rect.width() - 20, tb->rect.height() - 1, | - | ||||||||||||||||||||||||
| 1689 | tb->rect.width(), tb->rect.height() - 1); | - | ||||||||||||||||||||||||
| 1690 | } else { never executed: end of block | 0 | ||||||||||||||||||||||||
| 1691 | p->drawLine(tb->rect.width() - 1, 2, d - 1, 2); | - | ||||||||||||||||||||||||
| 1692 | p->drawLine(d, 2, 20, tb->rect.height() - 1); | - | ||||||||||||||||||||||||
| 1693 | p->drawLine(19, tb->rect.height() - 1, | - | ||||||||||||||||||||||||
| 1694 | -1, tb->rect.height() - 1); | - | ||||||||||||||||||||||||
| 1695 | } never executed: end of block | 0 | ||||||||||||||||||||||||
| 1696 | p->setBrush(Qt::NoBrush); | - | ||||||||||||||||||||||||
| 1697 | } never executed: end of block | 0 | ||||||||||||||||||||||||
| 1698 | break; never executed: break; | 0 | ||||||||||||||||||||||||
| 1699 | #endif // QT_NO_TOOLBOX | - | ||||||||||||||||||||||||
| 1700 | #ifndef QT_NO_TABBAR | - | ||||||||||||||||||||||||
| 1701 | case CE_TabBarTab: never executed: case CE_TabBarTab: | 0 | ||||||||||||||||||||||||
| 1702 | if (const QStyleOptionTab *tab = qstyleoption_cast<const QStyleOptionTab *>(opt)) {
| 0 | ||||||||||||||||||||||||
| 1703 | proxy()->drawControl(CE_TabBarTabShape, tab, p, widget); | - | ||||||||||||||||||||||||
| 1704 | proxy()->drawControl(CE_TabBarTabLabel, tab, p, widget); | - | ||||||||||||||||||||||||
| 1705 | } never executed: end of block | 0 | ||||||||||||||||||||||||
| 1706 | break; never executed: break; | 0 | ||||||||||||||||||||||||
| 1707 | case CE_TabBarTabShape: never executed: case CE_TabBarTabShape: | 0 | ||||||||||||||||||||||||
| 1708 | if (const QStyleOptionTab *tab = qstyleoption_cast<const QStyleOptionTab *>(opt)) {
| 0 | ||||||||||||||||||||||||
| 1709 | p->save(); | - | ||||||||||||||||||||||||
| 1710 | - | |||||||||||||||||||||||||
| 1711 | QRect rect(tab->rect); | - | ||||||||||||||||||||||||
| 1712 | bool selected = tab->state & State_Selected; | - | ||||||||||||||||||||||||
| 1713 | bool onlyOne = tab->position == QStyleOptionTab::OnlyOneTab; | - | ||||||||||||||||||||||||
| 1714 | int tabOverlap = onlyOne ? 0 : proxy()->pixelMetric(PM_TabBarTabOverlap, opt, widget);
| 0 | ||||||||||||||||||||||||
| 1715 | - | |||||||||||||||||||||||||
| 1716 | if (!selected) {
| 0 | ||||||||||||||||||||||||
| 1717 | switch (tab->shape) { | - | ||||||||||||||||||||||||
| 1718 | case QTabBar::TriangularNorth: never executed: case QTabBar::TriangularNorth: | 0 | ||||||||||||||||||||||||
| 1719 | rect.adjust(0, 0, 0, -tabOverlap); | - | ||||||||||||||||||||||||
| 1720 | if(!selected)
| 0 | ||||||||||||||||||||||||
| 1721 | rect.adjust(1, 1, -1, 0); never executed: rect.adjust(1, 1, -1, 0); | 0 | ||||||||||||||||||||||||
| 1722 | break; never executed: break; | 0 | ||||||||||||||||||||||||
| 1723 | case QTabBar::TriangularSouth: never executed: case QTabBar::TriangularSouth: | 0 | ||||||||||||||||||||||||
| 1724 | rect.adjust(0, tabOverlap, 0, 0); | - | ||||||||||||||||||||||||
| 1725 | if(!selected)
| 0 | ||||||||||||||||||||||||
| 1726 | rect.adjust(1, 0, -1, -1); never executed: rect.adjust(1, 0, -1, -1); | 0 | ||||||||||||||||||||||||
| 1727 | break; never executed: break; | 0 | ||||||||||||||||||||||||
| 1728 | case QTabBar::TriangularEast: never executed: case QTabBar::TriangularEast: | 0 | ||||||||||||||||||||||||
| 1729 | rect.adjust(tabOverlap, 0, 0, 0); | - | ||||||||||||||||||||||||
| 1730 | if(!selected)
| 0 | ||||||||||||||||||||||||
| 1731 | rect.adjust(0, 1, -1, -1); never executed: rect.adjust(0, 1, -1, -1); | 0 | ||||||||||||||||||||||||
| 1732 | break; never executed: break; | 0 | ||||||||||||||||||||||||
| 1733 | case QTabBar::TriangularWest: never executed: case QTabBar::TriangularWest: | 0 | ||||||||||||||||||||||||
| 1734 | rect.adjust(0, 0, -tabOverlap, 0); | - | ||||||||||||||||||||||||
| 1735 | if(!selected)
| 0 | ||||||||||||||||||||||||
| 1736 | rect.adjust(1, 1, 0, -1); never executed: rect.adjust(1, 1, 0, -1); | 0 | ||||||||||||||||||||||||
| 1737 | break; never executed: break; | 0 | ||||||||||||||||||||||||
| 1738 | default: never executed: default: | 0 | ||||||||||||||||||||||||
| 1739 | break; never executed: break; | 0 | ||||||||||||||||||||||||
| 1740 | } | - | ||||||||||||||||||||||||
| 1741 | } | - | ||||||||||||||||||||||||
| 1742 | - | |||||||||||||||||||||||||
| 1743 | p->setPen(QPen(tab->palette.foreground(), 0)); | - | ||||||||||||||||||||||||
| 1744 | if (selected) {
| 0 | ||||||||||||||||||||||||
| 1745 | p->setBrush(tab->palette.base()); | - | ||||||||||||||||||||||||
| 1746 | } else { never executed: end of block | 0 | ||||||||||||||||||||||||
| 1747 | if (widget && widget->parentWidget())
| 0 | ||||||||||||||||||||||||
| 1748 | p->setBrush(widget->parentWidget()->palette().background()); never executed: p->setBrush(widget->parentWidget()->palette().background()); | 0 | ||||||||||||||||||||||||
| 1749 | else | - | ||||||||||||||||||||||||
| 1750 | p->setBrush(tab->palette.background()); never executed: p->setBrush(tab->palette.background()); | 0 | ||||||||||||||||||||||||
| 1751 | } | - | ||||||||||||||||||||||||
| 1752 | - | |||||||||||||||||||||||||
| 1753 | int y; | - | ||||||||||||||||||||||||
| 1754 | int x; | - | ||||||||||||||||||||||||
| 1755 | QPolygon a(10); | - | ||||||||||||||||||||||||
| 1756 | switch (tab->shape) { | - | ||||||||||||||||||||||||
| 1757 | case QTabBar::TriangularNorth: never executed: case QTabBar::TriangularNorth: | 0 | ||||||||||||||||||||||||
| 1758 | case QTabBar::TriangularSouth: { never executed: case QTabBar::TriangularSouth: | 0 | ||||||||||||||||||||||||
| 1759 | a.setPoint(0, 0, -1); | - | ||||||||||||||||||||||||
| 1760 | a.setPoint(1, 0, 0); | - | ||||||||||||||||||||||||
| 1761 | y = rect.height() - 2; | - | ||||||||||||||||||||||||
| 1762 | x = y / 3; | - | ||||||||||||||||||||||||
| 1763 | a.setPoint(2, x++, y - 1); | - | ||||||||||||||||||||||||
| 1764 | ++x; | - | ||||||||||||||||||||||||
| 1765 | a.setPoint(3, x++, y++); | - | ||||||||||||||||||||||||
| 1766 | a.setPoint(4, x, y); | - | ||||||||||||||||||||||||
| 1767 | - | |||||||||||||||||||||||||
| 1768 | int i; | - | ||||||||||||||||||||||||
| 1769 | int right = rect.width() - 1; | - | ||||||||||||||||||||||||
| 1770 | for (i = 0; i < 5; ++i)
| 0 | ||||||||||||||||||||||||
| 1771 | 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 | ||||||||||||||||||||||||
| 1772 | if (tab->shape == QTabBar::TriangularNorth)
| 0 | ||||||||||||||||||||||||
| 1773 | for (i = 0; i < 10; ++i)
| 0 | ||||||||||||||||||||||||
| 1774 | 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 | ||||||||||||||||||||||||
| 1775 | - | |||||||||||||||||||||||||
| 1776 | a.translate(rect.left(), rect.top()); | - | ||||||||||||||||||||||||
| 1777 | p->setRenderHint(QPainter::Antialiasing); | - | ||||||||||||||||||||||||
| 1778 | p->translate(0, 0.5); | - | ||||||||||||||||||||||||
| 1779 | - | |||||||||||||||||||||||||
| 1780 | QPainterPath path; | - | ||||||||||||||||||||||||
| 1781 | path.addPolygon(a); | - | ||||||||||||||||||||||||
| 1782 | p->drawPath(path); | - | ||||||||||||||||||||||||
| 1783 | break; } never executed: break; | 0 | ||||||||||||||||||||||||
| 1784 | case QTabBar::TriangularEast: never executed: case QTabBar::TriangularEast: | 0 | ||||||||||||||||||||||||
| 1785 | case QTabBar::TriangularWest: { never executed: case QTabBar::TriangularWest: | 0 | ||||||||||||||||||||||||
| 1786 | a.setPoint(0, -1, 0); | - | ||||||||||||||||||||||||
| 1787 | a.setPoint(1, 0, 0); | - | ||||||||||||||||||||||||
| 1788 | x = rect.width() - 2; | - | ||||||||||||||||||||||||
| 1789 | y = x / 3; | - | ||||||||||||||||||||||||
| 1790 | a.setPoint(2, x - 1, y++); | - | ||||||||||||||||||||||||
| 1791 | ++y; | - | ||||||||||||||||||||||||
| 1792 | a.setPoint(3, x++, y++); | - | ||||||||||||||||||||||||
| 1793 | a.setPoint(4, x, y); | - | ||||||||||||||||||||||||
| 1794 | int i; | - | ||||||||||||||||||||||||
| 1795 | int bottom = rect.height() - 1; | - | ||||||||||||||||||||||||
| 1796 | for (i = 0; i < 5; ++i)
| 0 | ||||||||||||||||||||||||
| 1797 | 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 | ||||||||||||||||||||||||
| 1798 | if (tab->shape == QTabBar::TriangularWest)
| 0 | ||||||||||||||||||||||||
| 1799 | for (i = 0; i < 10; ++i)
| 0 | ||||||||||||||||||||||||
| 1800 | 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 | ||||||||||||||||||||||||
| 1801 | a.translate(rect.left(), rect.top()); | - | ||||||||||||||||||||||||
| 1802 | p->setRenderHint(QPainter::Antialiasing); | - | ||||||||||||||||||||||||
| 1803 | p->translate(0.5, 0); | - | ||||||||||||||||||||||||
| 1804 | QPainterPath path; | - | ||||||||||||||||||||||||
| 1805 | path.addPolygon(a); | - | ||||||||||||||||||||||||
| 1806 | p->drawPath(path); | - | ||||||||||||||||||||||||
| 1807 | break; } never executed: break; | 0 | ||||||||||||||||||||||||
| 1808 | default: never executed: default: | 0 | ||||||||||||||||||||||||
| 1809 | break; never executed: break; | 0 | ||||||||||||||||||||||||
| 1810 | } | - | ||||||||||||||||||||||||
| 1811 | p->restore(); | - | ||||||||||||||||||||||||
| 1812 | } never executed: end of block | 0 | ||||||||||||||||||||||||
| 1813 | break; never executed: break; | 0 | ||||||||||||||||||||||||
| 1814 | case CE_ToolBoxTabLabel: never executed: case CE_ToolBoxTabLabel: | 0 | ||||||||||||||||||||||||
| 1815 | if (const QStyleOptionToolBox *tb = qstyleoption_cast<const QStyleOptionToolBox *>(opt)) {
| 0 | ||||||||||||||||||||||||
| 1816 | bool enabled = tb->state & State_Enabled; | - | ||||||||||||||||||||||||
| 1817 | bool selected = tb->state & State_Selected; | - | ||||||||||||||||||||||||
| 1818 | int iconExtent = proxy()->pixelMetric(QStyle::PM_SmallIconSize, tb, widget); | - | ||||||||||||||||||||||||
| 1819 | QPixmap pm = tb->icon.pixmap(qt_getWindow(widget), QSize(iconExtent, iconExtent), | - | ||||||||||||||||||||||||
| 1820 | enabled ? QIcon::Normal : QIcon::Disabled); | - | ||||||||||||||||||||||||
| 1821 | - | |||||||||||||||||||||||||
| 1822 | QRect cr = subElementRect(QStyle::SE_ToolBoxTabContents, tb, widget); | - | ||||||||||||||||||||||||
| 1823 | QRect tr, ir; | - | ||||||||||||||||||||||||
| 1824 | int ih = 0; | - | ||||||||||||||||||||||||
| 1825 | if (pm.isNull()) {
| 0 | ||||||||||||||||||||||||
| 1826 | tr = cr; | - | ||||||||||||||||||||||||
| 1827 | tr.adjust(4, 0, -8, 0); | - | ||||||||||||||||||||||||
| 1828 | } else { never executed: end of block | 0 | ||||||||||||||||||||||||
| 1829 | int iw = pm.width() / pm.devicePixelRatio() + 4; | - | ||||||||||||||||||||||||
| 1830 | ih = pm.height()/ pm.devicePixelRatio(); | - | ||||||||||||||||||||||||
| 1831 | ir = QRect(cr.left() + 4, cr.top(), iw + 2, ih); | - | ||||||||||||||||||||||||
| 1832 | tr = QRect(ir.right(), cr.top(), cr.width() - ir.right() - 4, cr.height()); | - | ||||||||||||||||||||||||
| 1833 | } never executed: end of block | 0 | ||||||||||||||||||||||||
| 1834 | - | |||||||||||||||||||||||||
| 1835 | if (selected && proxy()->styleHint(QStyle::SH_ToolBox_SelectedPageTitleBold, tb, widget)) {
| 0 | ||||||||||||||||||||||||
| 1836 | QFont f(p->font()); | - | ||||||||||||||||||||||||
| 1837 | f.setBold(true); | - | ||||||||||||||||||||||||
| 1838 | p->setFont(f); | - | ||||||||||||||||||||||||
| 1839 | } never executed: end of block | 0 | ||||||||||||||||||||||||
| 1840 | - | |||||||||||||||||||||||||
| 1841 | QString txt = tb->fontMetrics.elidedText(tb->text, Qt::ElideRight, tr.width()); | - | ||||||||||||||||||||||||
| 1842 | - | |||||||||||||||||||||||||
| 1843 | if (ih)
| 0 | ||||||||||||||||||||||||
| 1844 | p->drawPixmap(ir.left(), (tb->rect.height() - ih) / 2, pm); never executed: p->drawPixmap(ir.left(), (tb->rect.height() - ih) / 2, pm); | 0 | ||||||||||||||||||||||||
| 1845 | - | |||||||||||||||||||||||||
| 1846 | int alignment = Qt::AlignLeft | Qt::AlignVCenter | Qt::TextShowMnemonic; | - | ||||||||||||||||||||||||
| 1847 | if (!proxy()->styleHint(QStyle::SH_UnderlineShortcut, tb, widget))
| 0 | ||||||||||||||||||||||||
| 1848 | alignment |= Qt::TextHideMnemonic; never executed: alignment |= Qt::TextHideMnemonic; | 0 | ||||||||||||||||||||||||
| 1849 | proxy()->drawItemText(p, tr, alignment, tb->palette, enabled, txt, QPalette::ButtonText); | - | ||||||||||||||||||||||||
| 1850 | - | |||||||||||||||||||||||||
| 1851 | if (!txt.isEmpty() && opt->state & State_HasFocus) {
| 0 | ||||||||||||||||||||||||
| 1852 | QStyleOptionFocusRect opt; | - | ||||||||||||||||||||||||
| 1853 | opt.rect = tr; | - | ||||||||||||||||||||||||
| 1854 | opt.palette = tb->palette; | - | ||||||||||||||||||||||||
| 1855 | opt.state = QStyle::State_None; | - | ||||||||||||||||||||||||
| 1856 | proxy()->drawPrimitive(QStyle::PE_FrameFocusRect, &opt, p, widget); | - | ||||||||||||||||||||||||
| 1857 | } never executed: end of block | 0 | ||||||||||||||||||||||||
| 1858 | } never executed: end of block | 0 | ||||||||||||||||||||||||
| 1859 | break; never executed: break; | 0 | ||||||||||||||||||||||||
| 1860 | case CE_TabBarTabLabel: never executed: case CE_TabBarTabLabel: | 0 | ||||||||||||||||||||||||
| 1861 | if (const QStyleOptionTab *tab = qstyleoption_cast<const QStyleOptionTab *>(opt)) {
| 0 | ||||||||||||||||||||||||
| 1862 | QRect tr = tab->rect; | - | ||||||||||||||||||||||||
| 1863 | bool verticalTabs = tab->shape == QTabBar::RoundedEast
| 0 | ||||||||||||||||||||||||
| 1864 | || tab->shape == QTabBar::RoundedWest
| 0 | ||||||||||||||||||||||||
| 1865 | || tab->shape == QTabBar::TriangularEast
| 0 | ||||||||||||||||||||||||
| 1866 | || tab->shape == QTabBar::TriangularWest;
| 0 | ||||||||||||||||||||||||
| 1867 | - | |||||||||||||||||||||||||
| 1868 | int alignment = Qt::AlignCenter | Qt::TextShowMnemonic; | - | ||||||||||||||||||||||||
| 1869 | if (!proxy()->styleHint(SH_UnderlineShortcut, opt, widget))
| 0 | ||||||||||||||||||||||||
| 1870 | alignment |= Qt::TextHideMnemonic; never executed: alignment |= Qt::TextHideMnemonic; | 0 | ||||||||||||||||||||||||
| 1871 | - | |||||||||||||||||||||||||
| 1872 | if (verticalTabs) {
| 0 | ||||||||||||||||||||||||
| 1873 | p->save(); | - | ||||||||||||||||||||||||
| 1874 | int newX, newY, newRot; | - | ||||||||||||||||||||||||
| 1875 | if (tab->shape == QTabBar::RoundedEast || tab->shape == QTabBar::TriangularEast) {
| 0 | ||||||||||||||||||||||||
| 1876 | newX = tr.width() + tr.x(); | - | ||||||||||||||||||||||||
| 1877 | newY = tr.y(); | - | ||||||||||||||||||||||||
| 1878 | newRot = 90; | - | ||||||||||||||||||||||||
| 1879 | } else { never executed: end of block | 0 | ||||||||||||||||||||||||
| 1880 | newX = tr.x(); | - | ||||||||||||||||||||||||
| 1881 | newY = tr.y() + tr.height(); | - | ||||||||||||||||||||||||
| 1882 | newRot = -90; | - | ||||||||||||||||||||||||
| 1883 | } never executed: end of block | 0 | ||||||||||||||||||||||||
| 1884 | QTransform m = QTransform::fromTranslate(newX, newY); | - | ||||||||||||||||||||||||
| 1885 | m.rotate(newRot); | - | ||||||||||||||||||||||||
| 1886 | p->setTransform(m, true); | - | ||||||||||||||||||||||||
| 1887 | } never executed: end of block | 0 | ||||||||||||||||||||||||
| 1888 | QRect iconRect; | - | ||||||||||||||||||||||||
| 1889 | d->tabLayout(tab, widget, &tr, &iconRect); | - | ||||||||||||||||||||||||
| 1890 | tr = proxy()->subElementRect(SE_TabBarTabText, opt, widget); //we compute tr twice because the style may override subElementRect | - | ||||||||||||||||||||||||
| 1891 | - | |||||||||||||||||||||||||
| 1892 | if (!tab->icon.isNull()) {
| 0 | ||||||||||||||||||||||||
| 1893 | QPixmap tabIcon = tab->icon.pixmap(qt_getWindow(widget), tab->iconSize, | - | ||||||||||||||||||||||||
| 1894 | (tab->state & State_Enabled) ? QIcon::Normal | - | ||||||||||||||||||||||||
| 1895 | : QIcon::Disabled, | - | ||||||||||||||||||||||||
| 1896 | (tab->state & State_Selected) ? QIcon::On | - | ||||||||||||||||||||||||
| 1897 | : QIcon::Off); | - | ||||||||||||||||||||||||
| 1898 | p->drawPixmap(iconRect.x(), iconRect.y(), tabIcon); | - | ||||||||||||||||||||||||
| 1899 | } never executed: end of block | 0 | ||||||||||||||||||||||||
| 1900 | - | |||||||||||||||||||||||||
| 1901 | proxy()->drawItemText(p, tr, alignment, tab->palette, tab->state & State_Enabled, tab->text, QPalette::WindowText); | - | ||||||||||||||||||||||||
| 1902 | if (verticalTabs)
| 0 | ||||||||||||||||||||||||
| 1903 | p->restore(); never executed: p->restore(); | 0 | ||||||||||||||||||||||||
| 1904 | - | |||||||||||||||||||||||||
| 1905 | if (tab->state & State_HasFocus) {
| 0 | ||||||||||||||||||||||||
| 1906 | const int OFFSET = 1 + pixelMetric(PM_DefaultFrameWidth); | - | ||||||||||||||||||||||||
| 1907 | - | |||||||||||||||||||||||||
| 1908 | int x1, x2; | - | ||||||||||||||||||||||||
| 1909 | x1 = tab->rect.left(); | - | ||||||||||||||||||||||||
| 1910 | x2 = tab->rect.right() - 1; | - | ||||||||||||||||||||||||
| 1911 | - | |||||||||||||||||||||||||
| 1912 | QStyleOptionFocusRect fropt; | - | ||||||||||||||||||||||||
| 1913 | fropt.QStyleOption::operator=(*tab); | - | ||||||||||||||||||||||||
| 1914 | fropt.rect.setRect(x1 + 1 + OFFSET, tab->rect.y() + OFFSET, | - | ||||||||||||||||||||||||
| 1915 | x2 - x1 - 2*OFFSET, tab->rect.height() - 2*OFFSET); | - | ||||||||||||||||||||||||
| 1916 | drawPrimitive(PE_FrameFocusRect, &fropt, p, widget); | - | ||||||||||||||||||||||||
| 1917 | } never executed: end of block | 0 | ||||||||||||||||||||||||
| 1918 | } never executed: end of block | 0 | ||||||||||||||||||||||||
| 1919 | break; never executed: break; | 0 | ||||||||||||||||||||||||
| 1920 | #endif // QT_NO_TABBAR | - | ||||||||||||||||||||||||
| 1921 | #ifndef QT_NO_SIZEGRIP | - | ||||||||||||||||||||||||
| 1922 | case CE_SizeGrip: { never executed: case CE_SizeGrip: | 0 | ||||||||||||||||||||||||
| 1923 | p->save(); | - | ||||||||||||||||||||||||
| 1924 | int x, y, w, h; | - | ||||||||||||||||||||||||
| 1925 | opt->rect.getRect(&x, &y, &w, &h); | - | ||||||||||||||||||||||||
| 1926 | - | |||||||||||||||||||||||||
| 1927 | int sw = qMin(h, w); | - | ||||||||||||||||||||||||
| 1928 | if (h > w)
| 0 | ||||||||||||||||||||||||
| 1929 | p->translate(0, h - w); never executed: p->translate(0, h - w); | 0 | ||||||||||||||||||||||||
| 1930 | else | - | ||||||||||||||||||||||||
| 1931 | p->translate(w - h, 0); never executed: p->translate(w - h, 0); | 0 | ||||||||||||||||||||||||
| 1932 | - | |||||||||||||||||||||||||
| 1933 | int sx = x; | - | ||||||||||||||||||||||||
| 1934 | int sy = y; | - | ||||||||||||||||||||||||
| 1935 | int s = sw / 3; | - | ||||||||||||||||||||||||
| 1936 | - | |||||||||||||||||||||||||
| 1937 | Qt::Corner corner; | - | ||||||||||||||||||||||||
| 1938 | if (const QStyleOptionSizeGrip *sgOpt = qstyleoption_cast<const QStyleOptionSizeGrip *>(opt))
| 0 | ||||||||||||||||||||||||
| 1939 | corner = sgOpt->corner; never executed: corner = sgOpt->corner; | 0 | ||||||||||||||||||||||||
| 1940 | else if (opt->direction == Qt::RightToLeft)
| 0 | ||||||||||||||||||||||||
| 1941 | corner = Qt::BottomLeftCorner; never executed: corner = Qt::BottomLeftCorner; | 0 | ||||||||||||||||||||||||
| 1942 | else | - | ||||||||||||||||||||||||
| 1943 | corner = Qt::BottomRightCorner; never executed: corner = Qt::BottomRightCorner; | 0 | ||||||||||||||||||||||||
| 1944 | - | |||||||||||||||||||||||||
| 1945 | if (corner == Qt::BottomLeftCorner) {
| 0 | ||||||||||||||||||||||||
| 1946 | sx = x + sw; | - | ||||||||||||||||||||||||
| 1947 | for (int i = 0; i < 4; ++i) {
| 0 | ||||||||||||||||||||||||
| 1948 | p->setPen(QPen(opt->palette.light().color(), 1)); | - | ||||||||||||||||||||||||
| 1949 | p->drawLine(x, sy - 1 , sx + 1, sw); | - | ||||||||||||||||||||||||
| 1950 | p->setPen(QPen(opt->palette.dark().color(), 1)); | - | ||||||||||||||||||||||||
| 1951 | p->drawLine(x, sy, sx, sw); | - | ||||||||||||||||||||||||
| 1952 | p->setPen(QPen(opt->palette.dark().color(), 1)); | - | ||||||||||||||||||||||||
| 1953 | p->drawLine(x, sy + 1, sx - 1, sw); | - | ||||||||||||||||||||||||
| 1954 | sx -= s; | - | ||||||||||||||||||||||||
| 1955 | sy += s; | - | ||||||||||||||||||||||||
| 1956 | } never executed: end of block | 0 | ||||||||||||||||||||||||
| 1957 | } else if (corner == Qt::BottomRightCorner) { never executed: end of block
| 0 | ||||||||||||||||||||||||
| 1958 | for (int i = 0; i < 4; ++i) {
| 0 | ||||||||||||||||||||||||
| 1959 | p->setPen(QPen(opt->palette.light().color(), 1)); | - | ||||||||||||||||||||||||
| 1960 | p->drawLine(sx - 1, sw, sw, sy - 1); | - | ||||||||||||||||||||||||
| 1961 | p->setPen(QPen(opt->palette.dark().color(), 1)); | - | ||||||||||||||||||||||||
| 1962 | p->drawLine(sx, sw, sw, sy); | - | ||||||||||||||||||||||||
| 1963 | p->setPen(QPen(opt->palette.dark().color(), 1)); | - | ||||||||||||||||||||||||
| 1964 | p->drawLine(sx + 1, sw, sw, sy + 1); | - | ||||||||||||||||||||||||
| 1965 | sx += s; | - | ||||||||||||||||||||||||
| 1966 | sy += s; | - | ||||||||||||||||||||||||
| 1967 | } never executed: end of block | 0 | ||||||||||||||||||||||||
| 1968 | } else if (corner == Qt::TopRightCorner) { never executed: end of block
| 0 | ||||||||||||||||||||||||
| 1969 | sy = y + sw; | - | ||||||||||||||||||||||||
| 1970 | for (int i = 0; i < 4; ++i) {
| 0 | ||||||||||||||||||||||||
| 1971 | p->setPen(QPen(opt->palette.light().color(), 1)); | - | ||||||||||||||||||||||||
| 1972 | p->drawLine(sx - 1, y, sw, sy + 1); | - | ||||||||||||||||||||||||
| 1973 | p->setPen(QPen(opt->palette.dark().color(), 1)); | - | ||||||||||||||||||||||||
| 1974 | p->drawLine(sx, y, sw, sy); | - | ||||||||||||||||||||||||
| 1975 | p->setPen(QPen(opt->palette.dark().color(), 1)); | - | ||||||||||||||||||||||||
| 1976 | p->drawLine(sx + 1, y, sw, sy - 1); | - | ||||||||||||||||||||||||
| 1977 | sx += s; | - | ||||||||||||||||||||||||
| 1978 | sy -= s; | - | ||||||||||||||||||||||||
| 1979 | } never executed: end of block | 0 | ||||||||||||||||||||||||
| 1980 | } else if (corner == Qt::TopLeftCorner) { never executed: end of block
| 0 | ||||||||||||||||||||||||
| 1981 | for (int i = 0; i < 4; ++i) {
| 0 | ||||||||||||||||||||||||
| 1982 | p->setPen(QPen(opt->palette.light().color(), 1)); | - | ||||||||||||||||||||||||
| 1983 | p->drawLine(x, sy - 1, sx - 1, y); | - | ||||||||||||||||||||||||
| 1984 | p->setPen(QPen(opt->palette.dark().color(), 1)); | - | ||||||||||||||||||||||||
| 1985 | p->drawLine(x, sy, sx, y); | - | ||||||||||||||||||||||||
| 1986 | p->setPen(QPen(opt->palette.dark().color(), 1)); | - | ||||||||||||||||||||||||
| 1987 | p->drawLine(x, sy + 1, sx + 1, y); | - | ||||||||||||||||||||||||
| 1988 | sx += s; | - | ||||||||||||||||||||||||
| 1989 | sy += s; | - | ||||||||||||||||||||||||
| 1990 | } never executed: end of block | 0 | ||||||||||||||||||||||||
| 1991 | } never executed: end of block | 0 | ||||||||||||||||||||||||
| 1992 | p->restore(); | - | ||||||||||||||||||||||||
| 1993 | break; } never executed: break; | 0 | ||||||||||||||||||||||||
| 1994 | #endif // QT_NO_SIZEGRIP | - | ||||||||||||||||||||||||
| 1995 | #ifndef QT_NO_RUBBERBAND | - | ||||||||||||||||||||||||
| 1996 | case CE_RubberBand: { never executed: case CE_RubberBand: | 0 | ||||||||||||||||||||||||
| 1997 | if (const QStyleOptionRubberBand *rbOpt = qstyleoption_cast<const QStyleOptionRubberBand *>(opt)) {
| 0 | ||||||||||||||||||||||||
| 1998 | QPixmap tiledPixmap(16, 16); | - | ||||||||||||||||||||||||
| 1999 | QPainter pixmapPainter(&tiledPixmap); | - | ||||||||||||||||||||||||
| 2000 | pixmapPainter.setPen(Qt::NoPen); | - | ||||||||||||||||||||||||
| 2001 | pixmapPainter.setBrush(Qt::Dense4Pattern); | - | ||||||||||||||||||||||||
| 2002 | pixmapPainter.setBackground(QBrush(opt->palette.base())); | - | ||||||||||||||||||||||||
| 2003 | pixmapPainter.setBackgroundMode(Qt::OpaqueMode); | - | ||||||||||||||||||||||||
| 2004 | pixmapPainter.drawRect(0, 0, tiledPixmap.width(), tiledPixmap.height()); | - | ||||||||||||||||||||||||
| 2005 | pixmapPainter.end(); | - | ||||||||||||||||||||||||
| 2006 | // ### workaround for borked XRENDER | - | ||||||||||||||||||||||||
| 2007 | tiledPixmap = QPixmap::fromImage(tiledPixmap.toImage()); | - | ||||||||||||||||||||||||
| 2008 | - | |||||||||||||||||||||||||
| 2009 | p->save(); | - | ||||||||||||||||||||||||
| 2010 | QRect r = opt->rect; | - | ||||||||||||||||||||||||
| 2011 | QStyleHintReturnMask mask; | - | ||||||||||||||||||||||||
| 2012 | if (proxy()->styleHint(QStyle::SH_RubberBand_Mask, opt, widget, &mask))
| 0 | ||||||||||||||||||||||||
| 2013 | p->setClipRegion(mask.region); never executed: p->setClipRegion(mask.region); | 0 | ||||||||||||||||||||||||
| 2014 | p->drawTiledPixmap(r.x(), r.y(), r.width(), r.height(), tiledPixmap); | - | ||||||||||||||||||||||||
| 2015 | p->setPen(opt->palette.color(QPalette::Active, QPalette::WindowText)); | - | ||||||||||||||||||||||||
| 2016 | p->setBrush(Qt::NoBrush); | - | ||||||||||||||||||||||||
| 2017 | p->drawRect(r.adjusted(0, 0, -1, -1)); | - | ||||||||||||||||||||||||
| 2018 | if (rbOpt->shape == QRubberBand::Rectangle)
| 0 | ||||||||||||||||||||||||
| 2019 | p->drawRect(r.adjusted(3, 3, -4, -4)); never executed: p->drawRect(r.adjusted(3, 3, -4, -4)); | 0 | ||||||||||||||||||||||||
| 2020 | p->restore(); | - | ||||||||||||||||||||||||
| 2021 | } never executed: end of block | 0 | ||||||||||||||||||||||||
| 2022 | break; } never executed: break; | 0 | ||||||||||||||||||||||||
| 2023 | #endif // QT_NO_RUBBERBAND | - | ||||||||||||||||||||||||
| 2024 | #ifndef QT_NO_DOCKWIDGET | - | ||||||||||||||||||||||||
| 2025 | case CE_DockWidgetTitle: never executed: case CE_DockWidgetTitle: | 0 | ||||||||||||||||||||||||
| 2026 | if (const QStyleOptionDockWidget *dwOpt = qstyleoption_cast<const QStyleOptionDockWidget *>(opt)) {
| 0 | ||||||||||||||||||||||||
| 2027 | QRect r = dwOpt->rect.adjusted(0, 0, -1, -1); | - | ||||||||||||||||||||||||
| 2028 | if (dwOpt->movable) {
| 0 | ||||||||||||||||||||||||
| 2029 | p->setPen(dwOpt->palette.color(QPalette::Dark)); | - | ||||||||||||||||||||||||
| 2030 | p->drawRect(r); | - | ||||||||||||||||||||||||
| 2031 | } never executed: end of block | 0 | ||||||||||||||||||||||||
| 2032 | - | |||||||||||||||||||||||||
| 2033 | if (!dwOpt->title.isEmpty()) {
| 0 | ||||||||||||||||||||||||
| 2034 | const bool verticalTitleBar = dwOpt->verticalTitleBar; | - | ||||||||||||||||||||||||
| 2035 | - | |||||||||||||||||||||||||
| 2036 | if (verticalTitleBar) {
| 0 | ||||||||||||||||||||||||
| 2037 | r .setSize(= r.size().transposed());(); | - | ||||||||||||||||||||||||
| 2038 | - | |||||||||||||||||||||||||
| 2039 | p->save(); | - | ||||||||||||||||||||||||
| 2040 | p->translate(r.left(), r.top() + r.width()); | - | ||||||||||||||||||||||||
| 2041 | p->rotate(-90); | - | ||||||||||||||||||||||||
| 2042 | p->translate(-r.left(), -r.top()); | - | ||||||||||||||||||||||||
| 2043 | } never executed: end of block | 0 | ||||||||||||||||||||||||
| 2044 | - | |||||||||||||||||||||||||
| 2045 | const int indent = p->fontMetrics().descent(); | - | ||||||||||||||||||||||||
| 2046 | proxy()->drawItemText(p, r.adjusted(indent + 1, 1, -indent - 1, -1), | - | ||||||||||||||||||||||||
| 2047 | Qt::AlignLeft | Qt::AlignVCenter | Qt::TextShowMnemonic, dwOpt->palette, | - | ||||||||||||||||||||||||
| 2048 | dwOpt->state & State_Enabled, dwOpt->title, | - | ||||||||||||||||||||||||
| 2049 | QPalette::WindowText); | - | ||||||||||||||||||||||||
| 2050 | - | |||||||||||||||||||||||||
| 2051 | if (verticalTitleBar)
| 0 | ||||||||||||||||||||||||
| 2052 | p->restore(); never executed: p->restore(); | 0 | ||||||||||||||||||||||||
| 2053 | } never executed: end of block | 0 | ||||||||||||||||||||||||
| 2054 | } never executed: end of block | 0 | ||||||||||||||||||||||||
| 2055 | break; never executed: break; | 0 | ||||||||||||||||||||||||
| 2056 | #endif // QT_NO_DOCKWIDGET | - | ||||||||||||||||||||||||
| 2057 | case CE_Header: never executed: case CE_Header: | 0 | ||||||||||||||||||||||||
| 2058 | if (const QStyleOptionHeader *header = qstyleoption_cast<const QStyleOptionHeader *>(opt)) {
| 0 | ||||||||||||||||||||||||
| 2059 | QRegion clipRegion = p->clipRegion(); | - | ||||||||||||||||||||||||
| 2060 | p->setClipRect(opt->rect); | - | ||||||||||||||||||||||||
| 2061 | proxy()->drawControl(CE_HeaderSection, header, p, widget); | - | ||||||||||||||||||||||||
| 2062 | QStyleOptionHeader subopt = *header; | - | ||||||||||||||||||||||||
| 2063 | subopt.rect = subElementRect(SE_HeaderLabel, header, widget); | - | ||||||||||||||||||||||||
| 2064 | if (subopt.rect.isValid())
| 0 | ||||||||||||||||||||||||
| 2065 | proxy()->drawControl(CE_HeaderLabel, &subopt, p, widget); never executed: proxy()->drawControl(CE_HeaderLabel, &subopt, p, widget); | 0 | ||||||||||||||||||||||||
| 2066 | if (header->sortIndicator != QStyleOptionHeader::None) {
| 0 | ||||||||||||||||||||||||
| 2067 | subopt.rect = subElementRect(SE_HeaderArrow, opt, widget); | - | ||||||||||||||||||||||||
| 2068 | proxy()->drawPrimitive(PE_IndicatorHeaderArrow, &subopt, p, widget); | - | ||||||||||||||||||||||||
| 2069 | } never executed: end of block | 0 | ||||||||||||||||||||||||
| 2070 | p->setClipRegion(clipRegion); | - | ||||||||||||||||||||||||
| 2071 | } never executed: end of block | 0 | ||||||||||||||||||||||||
| 2072 | break; never executed: break; | 0 | ||||||||||||||||||||||||
| 2073 | case CE_FocusFrame: never executed: case CE_FocusFrame: | 0 | ||||||||||||||||||||||||
| 2074 | p->fillRect(opt->rect, opt->palette.foreground()); | - | ||||||||||||||||||||||||
| 2075 | break; never executed: break; | 0 | ||||||||||||||||||||||||
| 2076 | case CE_HeaderSection: never executed: case CE_HeaderSection: | 0 | ||||||||||||||||||||||||
| 2077 | qDrawShadePanel(p, opt->rect, opt->palette, | - | ||||||||||||||||||||||||
| 2078 | opt->state & State_Sunken, 1, | - | ||||||||||||||||||||||||
| 2079 | &opt->palette.brush(QPalette::Button)); | - | ||||||||||||||||||||||||
| 2080 | break; never executed: break; | 0 | ||||||||||||||||||||||||
| 2081 | case CE_HeaderEmptyArea: never executed: case CE_HeaderEmptyArea: | 0 | ||||||||||||||||||||||||
| 2082 | p->fillRect(opt->rect, opt->palette.background()); | - | ||||||||||||||||||||||||
| 2083 | break; never executed: break; | 0 | ||||||||||||||||||||||||
| 2084 | #ifndef QT_NO_COMBOBOX | - | ||||||||||||||||||||||||
| 2085 | case CE_ComboBoxLabel: never executed: case CE_ComboBoxLabel: | 0 | ||||||||||||||||||||||||
| 2086 | if (const QStyleOptionComboBox *cb = qstyleoption_cast<const QStyleOptionComboBox *>(opt)) {
| 0 | ||||||||||||||||||||||||
| 2087 | QRect editRect = proxy()->subControlRect(CC_ComboBox, cb, SC_ComboBoxEditField, widget); | - | ||||||||||||||||||||||||
| 2088 | p->save(); | - | ||||||||||||||||||||||||
| 2089 | p->setClipRect(editRect); | - | ||||||||||||||||||||||||
| 2090 | if (!cb->currentIcon.isNull()) {
| 0 | ||||||||||||||||||||||||
| 2091 | QIcon::Mode mode = cb->state & State_Enabled ? QIcon::Normal
| 0 | ||||||||||||||||||||||||
| 2092 | : QIcon::Disabled; | - | ||||||||||||||||||||||||
| 2093 | QPixmap pixmap = cb->currentIcon.pixmap(qt_getWindow(widget), cb->iconSize, mode); | - | ||||||||||||||||||||||||
| 2094 | QRect iconRect(editRect); | - | ||||||||||||||||||||||||
| 2095 | iconRect.setWidth(cb->iconSize.width() + 4); | - | ||||||||||||||||||||||||
| 2096 | iconRect = alignedRect(cb->direction, | - | ||||||||||||||||||||||||
| 2097 | Qt::AlignLeft | Qt::AlignVCenter, | - | ||||||||||||||||||||||||
| 2098 | iconRect.size(), editRect); | - | ||||||||||||||||||||||||
| 2099 | if (cb->editable)
| 0 | ||||||||||||||||||||||||
| 2100 | p->fillRect(iconRect, opt->palette.brush(QPalette::Base)); never executed: p->fillRect(iconRect, opt->palette.brush(QPalette::Base)); | 0 | ||||||||||||||||||||||||
| 2101 | proxy()->drawItemPixmap(p, iconRect, Qt::AlignCenter, pixmap); | - | ||||||||||||||||||||||||
| 2102 | - | |||||||||||||||||||||||||
| 2103 | if (cb->direction == Qt::RightToLeft)
| 0 | ||||||||||||||||||||||||
| 2104 | editRect.translate(-4 - cb->iconSize.width(), 0); never executed: editRect.translate(-4 - cb->iconSize.width(), 0); | 0 | ||||||||||||||||||||||||
| 2105 | else | - | ||||||||||||||||||||||||
| 2106 | editRect.translate(cb->iconSize.width() + 4, 0); never executed: editRect.translate(cb->iconSize.width() + 4, 0); | 0 | ||||||||||||||||||||||||
| 2107 | } | - | ||||||||||||||||||||||||
| 2108 | if (!cb->currentText.isEmpty() && !cb->editable) {
| 0 | ||||||||||||||||||||||||
| 2109 | proxy()->drawItemText(p, editRect.adjusted(1, 0, -1, 0), | - | ||||||||||||||||||||||||
| 2110 | visualAlignment(cb->direction, Qt::AlignLeft | Qt::AlignVCenter), | - | ||||||||||||||||||||||||
| 2111 | cb->palette, cb->state & State_Enabled, cb->currentText); | - | ||||||||||||||||||||||||
| 2112 | } never executed: end of block | 0 | ||||||||||||||||||||||||
| 2113 | p->restore(); | - | ||||||||||||||||||||||||
| 2114 | } never executed: end of block | 0 | ||||||||||||||||||||||||
| 2115 | break; never executed: break; | 0 | ||||||||||||||||||||||||
| 2116 | #endif // QT_NO_COMBOBOX | - | ||||||||||||||||||||||||
| 2117 | #ifndef QT_NO_TOOLBAR | - | ||||||||||||||||||||||||
| 2118 | case CE_ToolBar: never executed: case CE_ToolBar: | 0 | ||||||||||||||||||||||||
| 2119 | if (const QStyleOptionToolBar *toolBar = qstyleoption_cast<const QStyleOptionToolBar *>(opt)) {
| 0 | ||||||||||||||||||||||||
| 2120 | // Compatibility with styles that use PE_PanelToolBar | - | ||||||||||||||||||||||||
| 2121 | QStyleOptionFrame frame; | - | ||||||||||||||||||||||||
| 2122 | frame.QStyleOption::operator=(*toolBar); | - | ||||||||||||||||||||||||
| 2123 | frame.lineWidth = toolBar->lineWidth; | - | ||||||||||||||||||||||||
| 2124 | frame.midLineWidth = toolBar->midLineWidth; | - | ||||||||||||||||||||||||
| 2125 | proxy()->drawPrimitive(PE_PanelToolBar, opt, p, widget); | - | ||||||||||||||||||||||||
| 2126 | - | |||||||||||||||||||||||||
| 2127 | if (widget && qobject_cast<QToolBar *>(widget->parentWidget()))
| 0 | ||||||||||||||||||||||||
| 2128 | break; never executed: break; | 0 | ||||||||||||||||||||||||
| 2129 | qDrawShadePanel(p, toolBar->rect, toolBar->palette, false, toolBar->lineWidth, | - | ||||||||||||||||||||||||
| 2130 | &toolBar->palette.brush(QPalette::Button)); | - | ||||||||||||||||||||||||
| 2131 | } never executed: end of block | 0 | ||||||||||||||||||||||||
| 2132 | break; never executed: break; | 0 | ||||||||||||||||||||||||
| 2133 | #endif // QT_NO_TOOLBAR | - | ||||||||||||||||||||||||
| 2134 | case CE_ColumnViewGrip: { never executed: case CE_ColumnViewGrip: | 0 | ||||||||||||||||||||||||
| 2135 | // draw background gradients | - | ||||||||||||||||||||||||
| 2136 | QLinearGradient g(0, 0, opt->rect.width(), 0); | - | ||||||||||||||||||||||||
| 2137 | g.setColorAt(0, opt->palette.color(QPalette::Active, QPalette::Mid)); | - | ||||||||||||||||||||||||
| 2138 | g.setColorAt(0.5, Qt::white); | - | ||||||||||||||||||||||||
| 2139 | p->fillRect(QRect(0, 0, opt->rect.width(), opt->rect.height()), g); | - | ||||||||||||||||||||||||
| 2140 | - | |||||||||||||||||||||||||
| 2141 | // draw the two lines | - | ||||||||||||||||||||||||
| 2142 | QPen pen(p->pen()); | - | ||||||||||||||||||||||||
| 2143 | pen.setWidth(opt->rect.width()/20); | - | ||||||||||||||||||||||||
| 2144 | pen.setColor(opt->palette.color(QPalette::Active, QPalette::Dark)); | - | ||||||||||||||||||||||||
| 2145 | p->setPen(pen); | - | ||||||||||||||||||||||||
| 2146 | - | |||||||||||||||||||||||||
| 2147 | int line1starting = opt->rect.width()*8 / 20; | - | ||||||||||||||||||||||||
| 2148 | int line2starting = opt->rect.width()*13 / 20; | - | ||||||||||||||||||||||||
| 2149 | int top = opt->rect.height()*20/75; | - | ||||||||||||||||||||||||
| 2150 | int bottom = opt->rect.height() - 1 - top; | - | ||||||||||||||||||||||||
| 2151 | p->drawLine(line1starting, top, line1starting, bottom); | - | ||||||||||||||||||||||||
| 2152 | p->drawLine(line2starting, top, line2starting, bottom); | - | ||||||||||||||||||||||||
| 2153 | } | - | ||||||||||||||||||||||||
| 2154 | break; never executed: break; | 0 | ||||||||||||||||||||||||
| 2155 | - | |||||||||||||||||||||||||
| 2156 | #ifndef QT_NO_ITEMVIEWS | - | ||||||||||||||||||||||||
| 2157 | case CE_ItemViewItem: never executed: case CE_ItemViewItem: | 0 | ||||||||||||||||||||||||
| 2158 | if (const QStyleOptionViewItem *vopt = qstyleoption_cast<const QStyleOptionViewItem *>(opt)) {
| 0 | ||||||||||||||||||||||||
| 2159 | p->save(); | - | ||||||||||||||||||||||||
| 2160 | p->setClipRect(opt->rect); | - | ||||||||||||||||||||||||
| 2161 | - | |||||||||||||||||||||||||
| 2162 | QRect checkRect = proxy()->subElementRect(SE_ItemViewItemCheckIndicator, vopt, widget); | - | ||||||||||||||||||||||||
| 2163 | QRect iconRect = proxy()->subElementRect(SE_ItemViewItemDecoration, vopt, widget); | - | ||||||||||||||||||||||||
| 2164 | QRect textRect = proxy()->subElementRect(SE_ItemViewItemText, vopt, widget); | - | ||||||||||||||||||||||||
| 2165 | - | |||||||||||||||||||||||||
| 2166 | // draw the background | - | ||||||||||||||||||||||||
| 2167 | proxy()->drawPrimitive(PE_PanelItemViewItem, opt, p, widget); | - | ||||||||||||||||||||||||
| 2168 | - | |||||||||||||||||||||||||
| 2169 | // draw the check mark | - | ||||||||||||||||||||||||
| 2170 | if (vopt->features & QStyleOptionViewItem::HasCheckIndicator) {
| 0 | ||||||||||||||||||||||||
| 2171 | QStyleOptionViewItem option(*vopt); | - | ||||||||||||||||||||||||
| 2172 | option.rect = checkRect; | - | ||||||||||||||||||||||||
| 2173 | option.state = option.state & ~QStyle::State_HasFocus; | - | ||||||||||||||||||||||||
| 2174 | - | |||||||||||||||||||||||||
| 2175 | switch (vopt->checkState) { | - | ||||||||||||||||||||||||
| 2176 | case Qt::Unchecked: never executed: case Qt::Unchecked: | 0 | ||||||||||||||||||||||||
| 2177 | option.state |= QStyle::State_Off; | - | ||||||||||||||||||||||||
| 2178 | break; never executed: break; | 0 | ||||||||||||||||||||||||
| 2179 | case Qt::PartiallyChecked: never executed: case Qt::PartiallyChecked: | 0 | ||||||||||||||||||||||||
| 2180 | option.state |= QStyle::State_NoChange; | - | ||||||||||||||||||||||||
| 2181 | break; never executed: break; | 0 | ||||||||||||||||||||||||
| 2182 | case Qt::Checked: never executed: case Qt::Checked: | 0 | ||||||||||||||||||||||||
| 2183 | option.state |= QStyle::State_On; | - | ||||||||||||||||||||||||
| 2184 | break; never executed: break; | 0 | ||||||||||||||||||||||||
| 2185 | } | - | ||||||||||||||||||||||||
| 2186 | proxy()->drawPrimitive(QStyle::PE_IndicatorViewItemCheck, &option, p, widget); | - | ||||||||||||||||||||||||
| 2187 | } never executed: end of block | 0 | ||||||||||||||||||||||||
| 2188 | - | |||||||||||||||||||||||||
| 2189 | // draw the icon | - | ||||||||||||||||||||||||
| 2190 | QIcon::Mode mode = QIcon::Normal; | - | ||||||||||||||||||||||||
| 2191 | if (!(vopt->state & QStyle::State_Enabled))
| 0 | ||||||||||||||||||||||||
| 2192 | mode = QIcon::Disabled; never executed: mode = QIcon::Disabled; | 0 | ||||||||||||||||||||||||
| 2193 | else if (vopt->state & QStyle::State_Selected)
| 0 | ||||||||||||||||||||||||
| 2194 | mode = QIcon::Selected; never executed: mode = QIcon::Selected; | 0 | ||||||||||||||||||||||||
| 2195 | QIcon::State state = vopt->state & QStyle::State_Open ? QIcon::On : QIcon::Off;
| 0 | ||||||||||||||||||||||||
| 2196 | vopt->icon.paint(p, iconRect, vopt->decorationAlignment, mode, state); | - | ||||||||||||||||||||||||
| 2197 | - | |||||||||||||||||||||||||
| 2198 | // draw the text | - | ||||||||||||||||||||||||
| 2199 | if (!vopt->text.isEmpty()) {
| 0 | ||||||||||||||||||||||||
| 2200 | QPalette::ColorGroup cg = vopt->state & QStyle::State_Enabled
| 0 | ||||||||||||||||||||||||
| 2201 | ? QPalette::Normal : QPalette::Disabled; | - | ||||||||||||||||||||||||
| 2202 | if (cg == QPalette::Normal && !(vopt->state & QStyle::State_Active))
| 0 | ||||||||||||||||||||||||
| 2203 | cg = QPalette::Inactive; never executed: cg = QPalette::Inactive; | 0 | ||||||||||||||||||||||||
| 2204 | - | |||||||||||||||||||||||||
| 2205 | if (vopt->state & QStyle::State_Selected) {
| 0 | ||||||||||||||||||||||||
| 2206 | p->setPen(vopt->palette.color(cg, QPalette::HighlightedText)); | - | ||||||||||||||||||||||||
| 2207 | } else { never executed: end of block | 0 | ||||||||||||||||||||||||
| 2208 | p->setPen(vopt->palette.color(cg, QPalette::Text)); | - | ||||||||||||||||||||||||
| 2209 | } never executed: end of block | 0 | ||||||||||||||||||||||||
| 2210 | if (vopt->state & QStyle::State_Editing) {
| 0 | ||||||||||||||||||||||||
| 2211 | p->setPen(vopt->palette.color(cg, QPalette::Text)); | - | ||||||||||||||||||||||||
| 2212 | p->drawRect(textRect.adjusted(0, 0, -1, -1)); | - | ||||||||||||||||||||||||
| 2213 | } never executed: end of block | 0 | ||||||||||||||||||||||||
| 2214 | - | |||||||||||||||||||||||||
| 2215 | d->viewItemDrawText(p, vopt, textRect); | - | ||||||||||||||||||||||||
| 2216 | } never executed: end of block | 0 | ||||||||||||||||||||||||
| 2217 | - | |||||||||||||||||||||||||
| 2218 | // draw the focus rect | - | ||||||||||||||||||||||||
| 2219 | if (vopt->state & QStyle::State_HasFocus) {
| 0 | ||||||||||||||||||||||||
| 2220 | QStyleOptionFocusRect o; | - | ||||||||||||||||||||||||
| 2221 | o.QStyleOption::operator=(*vopt); | - | ||||||||||||||||||||||||
| 2222 | o.rect = proxy()->subElementRect(SE_ItemViewItemFocusRect, vopt, widget); | - | ||||||||||||||||||||||||
| 2223 | o.state |= QStyle::State_KeyboardFocusChange; | - | ||||||||||||||||||||||||
| 2224 | o.state |= QStyle::State_Item; | - | ||||||||||||||||||||||||
| 2225 | QPalette::ColorGroup cg = (vopt->state & QStyle::State_Enabled)
| 0 | ||||||||||||||||||||||||
| 2226 | ? QPalette::Normal : QPalette::Disabled; | - | ||||||||||||||||||||||||
| 2227 | o.backgroundColor = vopt->palette.color(cg, (vopt->state & QStyle::State_Selected) | - | ||||||||||||||||||||||||
| 2228 | ? QPalette::Highlight : QPalette::Window); | - | ||||||||||||||||||||||||
| 2229 | proxy()->drawPrimitive(QStyle::PE_FrameFocusRect, &o, p, widget); | - | ||||||||||||||||||||||||
| 2230 | } never executed: end of block | 0 | ||||||||||||||||||||||||
| 2231 | - | |||||||||||||||||||||||||
| 2232 | p->restore(); | - | ||||||||||||||||||||||||
| 2233 | } never executed: end of block | 0 | ||||||||||||||||||||||||
| 2234 | break; never executed: break; | 0 | ||||||||||||||||||||||||
| 2235 | - | |||||||||||||||||||||||||
| 2236 | #endif // QT_NO_ITEMVIEWS | - | ||||||||||||||||||||||||
| 2237 | #ifndef QT_NO_FRAME | - | ||||||||||||||||||||||||
| 2238 | case CE_ShapedFrame: never executed: case CE_ShapedFrame: | 0 | ||||||||||||||||||||||||
| 2239 | if (const QStyleOptionFrame *f = qstyleoption_cast<const QStyleOptionFrame *>(opt)) {
| 0 | ||||||||||||||||||||||||
| 2240 | int frameShape = f->frameShape; | - | ||||||||||||||||||||||||
| 2241 | int frameShadow = QFrame::Plain; | - | ||||||||||||||||||||||||
| 2242 | if (f->state & QStyle::State_Sunken) {
| 0 | ||||||||||||||||||||||||
| 2243 | frameShadow = QFrame::Sunken; | - | ||||||||||||||||||||||||
| 2244 | } else if (f->state & QStyle::State_Raised) { never executed: end of block
| 0 | ||||||||||||||||||||||||
| 2245 | frameShadow = QFrame::Raised; | - | ||||||||||||||||||||||||
| 2246 | } never executed: end of block | 0 | ||||||||||||||||||||||||
| 2247 | - | |||||||||||||||||||||||||
| 2248 | int lw = f->lineWidth; | - | ||||||||||||||||||||||||
| 2249 | int mlw = f->midLineWidth; | - | ||||||||||||||||||||||||
| 2250 | QPalette::ColorRole foregroundRole = QPalette::WindowText; | - | ||||||||||||||||||||||||
| 2251 | if (widget)
| 0 | ||||||||||||||||||||||||
| 2252 | foregroundRole = widget->foregroundRole(); never executed: foregroundRole = widget->foregroundRole(); | 0 | ||||||||||||||||||||||||
| 2253 | - | |||||||||||||||||||||||||
| 2254 | switch (frameShape) { | - | ||||||||||||||||||||||||
| 2255 | case QFrame::Box: never executed: case QFrame::Box: | 0 | ||||||||||||||||||||||||
| 2256 | if (frameShadow == QFrame::Plain) {
| 0 | ||||||||||||||||||||||||
| 2257 | qDrawPlainRect(p, f->rect, f->palette.color(foregroundRole), lw); | - | ||||||||||||||||||||||||
| 2258 | } else { never executed: end of block | 0 | ||||||||||||||||||||||||
| 2259 | qDrawShadeRect(p, f->rect, f->palette, frameShadow == QFrame::Sunken, lw, mlw); | - | ||||||||||||||||||||||||
| 2260 | } never executed: end of block | 0 | ||||||||||||||||||||||||
| 2261 | break; never executed: break; | 0 | ||||||||||||||||||||||||
| 2262 | case QFrame::StyledPanel: never executed: case QFrame::StyledPanel: | 0 | ||||||||||||||||||||||||
| 2263 | //keep the compatibility with Qt 4.4 if there is a proxy style. | - | ||||||||||||||||||||||||
| 2264 | //be sure to call drawPrimitive(QStyle::PE_Frame) on the proxy style | - | ||||||||||||||||||||||||
| 2265 | if (widget) {
| 0 | ||||||||||||||||||||||||
| 2266 | widget->style()->drawPrimitive(QStyle::PE_Frame, opt, p, widget); | - | ||||||||||||||||||||||||
| 2267 | } else { never executed: end of block | 0 | ||||||||||||||||||||||||
| 2268 | proxy()->drawPrimitive(QStyle::PE_Frame, opt, p, widget); | - | ||||||||||||||||||||||||
| 2269 | } never executed: end of block | 0 | ||||||||||||||||||||||||
| 2270 | break; never executed: break; | 0 | ||||||||||||||||||||||||
| 2271 | case QFrame::Panel: never executed: case QFrame::Panel: | 0 | ||||||||||||||||||||||||
| 2272 | if (frameShadow == QFrame::Plain) {
| 0 | ||||||||||||||||||||||||
| 2273 | qDrawPlainRect(p, f->rect, f->palette.color(foregroundRole), lw); | - | ||||||||||||||||||||||||
| 2274 | } else { never executed: end of block | 0 | ||||||||||||||||||||||||
| 2275 | qDrawShadePanel(p, f->rect, f->palette, frameShadow == QFrame::Sunken, lw); | - | ||||||||||||||||||||||||
| 2276 | } never executed: end of block | 0 | ||||||||||||||||||||||||
| 2277 | break; never executed: break; | 0 | ||||||||||||||||||||||||
| 2278 | case QFrame::WinPanel: never executed: case QFrame::WinPanel: | 0 | ||||||||||||||||||||||||
| 2279 | if (frameShadow == QFrame::Plain) {
| 0 | ||||||||||||||||||||||||
| 2280 | qDrawPlainRect(p, f->rect, f->palette.color(foregroundRole), lw); | - | ||||||||||||||||||||||||
| 2281 | } else { never executed: end of block | 0 | ||||||||||||||||||||||||
| 2282 | qDrawWinPanel(p, f->rect, f->palette, frameShadow == QFrame::Sunken); | - | ||||||||||||||||||||||||
| 2283 | } never executed: end of block | 0 | ||||||||||||||||||||||||
| 2284 | break; never executed: break; | 0 | ||||||||||||||||||||||||
| 2285 | case QFrame::HLine: never executed: case QFrame::HLine: | 0 | ||||||||||||||||||||||||
| 2286 | case QFrame::VLine: { never executed: case QFrame::VLine: | 0 | ||||||||||||||||||||||||
| 2287 | QPoint p1, p2; | - | ||||||||||||||||||||||||
| 2288 | if (frameShape == QFrame::HLine) {
| 0 | ||||||||||||||||||||||||
| 2289 | p1 = QPoint(opt->rect.x(), opt->rect.y() + opt->rect.height() / 2); | - | ||||||||||||||||||||||||
| 2290 | p2 = QPoint(opt->rect.x() + opt->rect.width(), p1.y()); | - | ||||||||||||||||||||||||
| 2291 | } else { never executed: end of block | 0 | ||||||||||||||||||||||||
| 2292 | p1 = QPoint(opt->rect.x() + opt->rect.width() / 2, opt->rect.y()); | - | ||||||||||||||||||||||||
| 2293 | p2 = QPoint(p1.x(), p1.y() + opt->rect.height()); | - | ||||||||||||||||||||||||
| 2294 | } never executed: end of block | 0 | ||||||||||||||||||||||||
| 2295 | if (frameShadow == QFrame::Plain) {
| 0 | ||||||||||||||||||||||||
| 2296 | QPen oldPen = p->pen(); | - | ||||||||||||||||||||||||
| 2297 | p->setPen(QPen(opt->palette.brush(foregroundRole), lw)); | - | ||||||||||||||||||||||||
| 2298 | p->drawLine(p1, p2); | - | ||||||||||||||||||||||||
| 2299 | p->setPen(oldPen); | - | ||||||||||||||||||||||||
| 2300 | } else { never executed: end of block | 0 | ||||||||||||||||||||||||
| 2301 | qDrawShadeLine(p, p1, p2, f->palette, frameShadow == QFrame::Sunken, lw, mlw); | - | ||||||||||||||||||||||||
| 2302 | } never executed: end of block | 0 | ||||||||||||||||||||||||
| 2303 | break; never executed: break; | 0 | ||||||||||||||||||||||||
| 2304 | } | - | ||||||||||||||||||||||||
| 2305 | } | - | ||||||||||||||||||||||||
| 2306 | } never executed: end of block | 0 | ||||||||||||||||||||||||
| 2307 | break; never executed: break; | 0 | ||||||||||||||||||||||||
| 2308 | #endif | - | ||||||||||||||||||||||||
| 2309 | default: never executed: default: | 0 | ||||||||||||||||||||||||
| 2310 | break; never executed: break; | 0 | ||||||||||||||||||||||||
| 2311 | } | - | ||||||||||||||||||||||||
| 2312 | } | - | ||||||||||||||||||||||||
| 2313 | - | |||||||||||||||||||||||||
| 2314 | /*! | - | ||||||||||||||||||||||||
| 2315 | \reimp | - | ||||||||||||||||||||||||
| 2316 | */ | - | ||||||||||||||||||||||||
| 2317 | QRect QCommonStyle::subElementRect(SubElement sr, const QStyleOption *opt, | - | ||||||||||||||||||||||||
| 2318 | const QWidget *widget) const | - | ||||||||||||||||||||||||
| 2319 | { | - | ||||||||||||||||||||||||
| 2320 | Q_D(const QCommonStyle); | - | ||||||||||||||||||||||||
| 2321 | QRect r; | - | ||||||||||||||||||||||||
| 2322 | switch (sr) { | - | ||||||||||||||||||||||||
| 2323 | case SE_PushButtonContents: never executed: case SE_PushButtonContents: | 0 | ||||||||||||||||||||||||
| 2324 | if (const QStyleOptionButton *btn = qstyleoption_cast<const QStyleOptionButton *>(opt)) {
| 0 | ||||||||||||||||||||||||
| 2325 | int dx1, dx2; | - | ||||||||||||||||||||||||
| 2326 | dx1 = proxy()->pixelMetric(PM_DefaultFrameWidth, btn, widget); | - | ||||||||||||||||||||||||
| 2327 | if (btn->features & QStyleOptionButton::AutoDefaultButton)
| 0 | ||||||||||||||||||||||||
| 2328 | dx1 += proxy()->pixelMetric(PM_ButtonDefaultIndicator, btn, widget); never executed: dx1 += proxy()->pixelMetric(PM_ButtonDefaultIndicator, btn, widget); | 0 | ||||||||||||||||||||||||
| 2329 | dx2 = dx1 * 2; | - | ||||||||||||||||||||||||
| 2330 | r.setRect(opt->rect.x() + dx1, opt->rect.y() + dx1, opt->rect.width() - dx2, | - | ||||||||||||||||||||||||
| 2331 | opt->rect.height() - dx2); | - | ||||||||||||||||||||||||
| 2332 | r = visualRect(opt->direction, opt->rect, r); | - | ||||||||||||||||||||||||
| 2333 | } never executed: end of block | 0 | ||||||||||||||||||||||||
| 2334 | break; never executed: break; | 0 | ||||||||||||||||||||||||
| 2335 | case SE_PushButtonFocusRect: never executed: case SE_PushButtonFocusRect: | 0 | ||||||||||||||||||||||||
| 2336 | if (const QStyleOptionButton *btn = qstyleoption_cast<const QStyleOptionButton *>(opt)) {
| 0 | ||||||||||||||||||||||||
| 2337 | int dbw1 = 0, dbw2 = 0; | - | ||||||||||||||||||||||||
| 2338 | if (btn->features & QStyleOptionButton::AutoDefaultButton){
| 0 | ||||||||||||||||||||||||
| 2339 | dbw1 = proxy()->pixelMetric(PM_ButtonDefaultIndicator, btn, widget); | - | ||||||||||||||||||||||||
| 2340 | dbw2 = dbw1 * 2; | - | ||||||||||||||||||||||||
| 2341 | } never executed: end of block | 0 | ||||||||||||||||||||||||
| 2342 | - | |||||||||||||||||||||||||
| 2343 | int dfw1 = proxy()->pixelMetric(PM_DefaultFrameWidth, btn, widget) + 1, | - | ||||||||||||||||||||||||
| 2344 | dfw2 = dfw1 * 2; | - | ||||||||||||||||||||||||
| 2345 | - | |||||||||||||||||||||||||
| 2346 | r.setRect(btn->rect.x() + dfw1 + dbw1, btn->rect.y() + dfw1 + dbw1, | - | ||||||||||||||||||||||||
| 2347 | btn->rect.width() - dfw2 - dbw2, btn->rect.height()- dfw2 - dbw2); | - | ||||||||||||||||||||||||
| 2348 | r = visualRect(opt->direction, opt->rect, r); | - | ||||||||||||||||||||||||
| 2349 | } never executed: end of block | 0 | ||||||||||||||||||||||||
| 2350 | break; never executed: break; | 0 | ||||||||||||||||||||||||
| 2351 | case SE_CheckBoxIndicator: never executed: case SE_CheckBoxIndicator: | 0 | ||||||||||||||||||||||||
| 2352 | { | - | ||||||||||||||||||||||||
| 2353 | int h = proxy()->pixelMetric(PM_IndicatorHeight, opt, widget); | - | ||||||||||||||||||||||||
| 2354 | r.setRect(opt->rect.x(), opt->rect.y() + ((opt->rect.height() - h) / 2), | - | ||||||||||||||||||||||||
| 2355 | proxy()->pixelMetric(PM_IndicatorWidth, opt, widget), h); | - | ||||||||||||||||||||||||
| 2356 | r = visualRect(opt->direction, opt->rect, r); | - | ||||||||||||||||||||||||
| 2357 | } | - | ||||||||||||||||||||||||
| 2358 | break; never executed: break; | 0 | ||||||||||||||||||||||||
| 2359 | - | |||||||||||||||||||||||||
| 2360 | case SE_CheckBoxContents: never executed: case SE_CheckBoxContents: | 0 | ||||||||||||||||||||||||
| 2361 | { | - | ||||||||||||||||||||||||
| 2362 | // Deal with the logical first, then convert it back to screen coords. | - | ||||||||||||||||||||||||
| 2363 | QRect ir = visualRect(opt->direction, opt->rect, | - | ||||||||||||||||||||||||
| 2364 | subElementRect(SE_CheckBoxIndicator, opt, widget)); | - | ||||||||||||||||||||||||
| 2365 | int spacing = proxy()->pixelMetric(PM_CheckBoxLabelSpacing, opt, widget); | - | ||||||||||||||||||||||||
| 2366 | r.setRect(ir.right() + spacing, opt->rect.y(), opt->rect.width() - ir.width() - spacing, | - | ||||||||||||||||||||||||
| 2367 | opt->rect.height()); | - | ||||||||||||||||||||||||
| 2368 | r = visualRect(opt->direction, opt->rect, r); | - | ||||||||||||||||||||||||
| 2369 | } | - | ||||||||||||||||||||||||
| 2370 | break; never executed: break; | 0 | ||||||||||||||||||||||||
| 2371 | - | |||||||||||||||||||||||||
| 2372 | case SE_CheckBoxFocusRect: never executed: case SE_CheckBoxFocusRect: | 0 | ||||||||||||||||||||||||
| 2373 | if (const QStyleOptionButton *btn = qstyleoption_cast<const QStyleOptionButton *>(opt)) {
| 0 | ||||||||||||||||||||||||
| 2374 | if (btn->icon.isNull() && btn->text.isEmpty()) {
| 0 | ||||||||||||||||||||||||
| 2375 | r = subElementRect(SE_CheckBoxIndicator, opt, widget); | - | ||||||||||||||||||||||||
| 2376 | r.adjust(1, 1, -1, -1); | - | ||||||||||||||||||||||||
| 2377 | break; never executed: break; | 0 | ||||||||||||||||||||||||
| 2378 | } | - | ||||||||||||||||||||||||
| 2379 | // As above, deal with the logical first, then convert it back to screen coords. | - | ||||||||||||||||||||||||
| 2380 | QRect cr = visualRect(btn->direction, btn->rect, | - | ||||||||||||||||||||||||
| 2381 | subElementRect(SE_CheckBoxContents, btn, widget)); | - | ||||||||||||||||||||||||
| 2382 | - | |||||||||||||||||||||||||
| 2383 | QRect iconRect, textRect; | - | ||||||||||||||||||||||||
| 2384 | if (!btn->text.isEmpty()) {
| 0 | ||||||||||||||||||||||||
| 2385 | textRect = itemTextRect(opt->fontMetrics, cr, Qt::AlignAbsolute | Qt::AlignLeft | - | ||||||||||||||||||||||||
| 2386 | | Qt::AlignVCenter | Qt::TextShowMnemonic, | - | ||||||||||||||||||||||||
| 2387 | btn->state & State_Enabled, btn->text); | - | ||||||||||||||||||||||||
| 2388 | } never executed: end of block | 0 | ||||||||||||||||||||||||
| 2389 | if (!btn->icon.isNull()) {
| 0 | ||||||||||||||||||||||||
| 2390 | iconRect = itemPixmapRect(cr, Qt::AlignAbsolute | Qt::AlignLeft | Qt::AlignVCenter | - | ||||||||||||||||||||||||
| 2391 | | Qt::TextShowMnemonic, | - | ||||||||||||||||||||||||
| 2392 | btn->icon.pixmap(qt_getWindow(widget), btn->iconSize, QIcon::Normal)); | - | ||||||||||||||||||||||||
| 2393 | if (!textRect.isEmpty())
| 0 | ||||||||||||||||||||||||
| 2394 | textRect.translate(iconRect.right() + 4, 0); never executed: textRect.translate(iconRect.right() + 4, 0); | 0 | ||||||||||||||||||||||||
| 2395 | } never executed: end of block | 0 | ||||||||||||||||||||||||
| 2396 | r = iconRect | textRect; | - | ||||||||||||||||||||||||
| 2397 | r.adjust(-3, -2, 3, 2); | - | ||||||||||||||||||||||||
| 2398 | r = r.intersected(btn->rect); | - | ||||||||||||||||||||||||
| 2399 | r = visualRect(btn->direction, btn->rect, r); | - | ||||||||||||||||||||||||
| 2400 | } never executed: end of block | 0 | ||||||||||||||||||||||||
| 2401 | break; never executed: break; | 0 | ||||||||||||||||||||||||
| 2402 | - | |||||||||||||||||||||||||
| 2403 | case SE_RadioButtonIndicator: never executed: case SE_RadioButtonIndicator: | 0 | ||||||||||||||||||||||||
| 2404 | { | - | ||||||||||||||||||||||||
| 2405 | int h = proxy()->pixelMetric(PM_ExclusiveIndicatorHeight, opt, widget); | - | ||||||||||||||||||||||||
| 2406 | r.setRect(opt->rect.x(), opt->rect.y() + ((opt->rect.height() - h) / 2), | - | ||||||||||||||||||||||||
| 2407 | proxy()->pixelMetric(PM_ExclusiveIndicatorWidth, opt, widget), h); | - | ||||||||||||||||||||||||
| 2408 | r = visualRect(opt->direction, opt->rect, r); | - | ||||||||||||||||||||||||
| 2409 | } | - | ||||||||||||||||||||||||
| 2410 | break; never executed: break; | 0 | ||||||||||||||||||||||||
| 2411 | - | |||||||||||||||||||||||||
| 2412 | case SE_RadioButtonContents: never executed: case SE_RadioButtonContents: | 0 | ||||||||||||||||||||||||
| 2413 | { | - | ||||||||||||||||||||||||
| 2414 | QRect ir = visualRect(opt->direction, opt->rect, | - | ||||||||||||||||||||||||
| 2415 | subElementRect(SE_RadioButtonIndicator, opt, widget)); | - | ||||||||||||||||||||||||
| 2416 | int spacing = proxy()->pixelMetric(PM_RadioButtonLabelSpacing, opt, widget); | - | ||||||||||||||||||||||||
| 2417 | r.setRect(ir.left() + ir.width() + spacing, opt->rect.y(), opt->rect.width() - ir.width() - spacing, | - | ||||||||||||||||||||||||
| 2418 | opt->rect.height()); | - | ||||||||||||||||||||||||
| 2419 | r = visualRect(opt->direction, opt->rect, r); | - | ||||||||||||||||||||||||
| 2420 | break; never executed: break; | 0 | ||||||||||||||||||||||||
| 2421 | } | - | ||||||||||||||||||||||||
| 2422 | - | |||||||||||||||||||||||||
| 2423 | case SE_RadioButtonFocusRect: never executed: case SE_RadioButtonFocusRect: | 0 | ||||||||||||||||||||||||
| 2424 | if (const QStyleOptionButton *btn = qstyleoption_cast<const QStyleOptionButton *>(opt)) {
| 0 | ||||||||||||||||||||||||
| 2425 | if (btn->icon.isNull() && btn->text.isEmpty()) {
| 0 | ||||||||||||||||||||||||
| 2426 | r = subElementRect(SE_RadioButtonIndicator, opt, widget); | - | ||||||||||||||||||||||||
| 2427 | r.adjust(1, 1, -1, -1); | - | ||||||||||||||||||||||||
| 2428 | break; never executed: break; | 0 | ||||||||||||||||||||||||
| 2429 | } | - | ||||||||||||||||||||||||
| 2430 | QRect cr = visualRect(btn->direction, btn->rect, | - | ||||||||||||||||||||||||
| 2431 | subElementRect(SE_RadioButtonContents, opt, widget)); | - | ||||||||||||||||||||||||
| 2432 | - | |||||||||||||||||||||||||
| 2433 | QRect iconRect, textRect; | - | ||||||||||||||||||||||||
| 2434 | if (!btn->text.isEmpty()){
| 0 | ||||||||||||||||||||||||
| 2435 | textRect = itemTextRect(opt->fontMetrics, cr, Qt::AlignAbsolute | Qt::AlignLeft | Qt::AlignVCenter | - | ||||||||||||||||||||||||
| 2436 | | Qt::TextShowMnemonic, btn->state & State_Enabled, btn->text); | - | ||||||||||||||||||||||||
| 2437 | } never executed: end of block | 0 | ||||||||||||||||||||||||
| 2438 | if (!btn->icon.isNull()) {
| 0 | ||||||||||||||||||||||||
| 2439 | iconRect = itemPixmapRect(cr, Qt::AlignAbsolute | Qt::AlignLeft | Qt::AlignVCenter | Qt::TextShowMnemonic, | - | ||||||||||||||||||||||||
| 2440 | btn->icon.pixmap(qt_getWindow(widget), btn->iconSize, QIcon::Normal)); | - | ||||||||||||||||||||||||
| 2441 | if (!textRect.isEmpty())
| 0 | ||||||||||||||||||||||||
| 2442 | textRect.translate(iconRect.right() + 4, 0); never executed: textRect.translate(iconRect.right() + 4, 0); | 0 | ||||||||||||||||||||||||
| 2443 | } never executed: end of block | 0 | ||||||||||||||||||||||||
| 2444 | r = iconRect | textRect; | - | ||||||||||||||||||||||||
| 2445 | r.adjust(-3, -2, 3, 2); | - | ||||||||||||||||||||||||
| 2446 | r = r.intersected(btn->rect); | - | ||||||||||||||||||||||||
| 2447 | r = visualRect(btn->direction, btn->rect, r); | - | ||||||||||||||||||||||||
| 2448 | } never executed: end of block | 0 | ||||||||||||||||||||||||
| 2449 | break; never executed: break; | 0 | ||||||||||||||||||||||||
| 2450 | #ifndef QT_NO_SLIDER | - | ||||||||||||||||||||||||
| 2451 | case SE_SliderFocusRect: never executed: case SE_SliderFocusRect: | 0 | ||||||||||||||||||||||||
| 2452 | if (const QStyleOptionSlider *slider = qstyleoption_cast<const QStyleOptionSlider *>(opt)) {
| 0 | ||||||||||||||||||||||||
| 2453 | int tickOffset = proxy()->pixelMetric(PM_SliderTickmarkOffset, slider, widget); | - | ||||||||||||||||||||||||
| 2454 | int thickness = proxy()->pixelMetric(PM_SliderControlThickness, slider, widget); | - | ||||||||||||||||||||||||
| 2455 | if (slider->orientation == Qt::Horizontal)
| 0 | ||||||||||||||||||||||||
| 2456 | r.setRect(0, tickOffset - 1, slider->rect.width(), thickness + 2); never executed: r.setRect(0, tickOffset - 1, slider->rect.width(), thickness + 2); | 0 | ||||||||||||||||||||||||
| 2457 | else | - | ||||||||||||||||||||||||
| 2458 | r.setRect(tickOffset - 1, 0, thickness + 2, slider->rect.height()); never executed: r.setRect(tickOffset - 1, 0, thickness + 2, slider->rect.height()); | 0 | ||||||||||||||||||||||||
| 2459 | r = r.intersected(slider->rect); | - | ||||||||||||||||||||||||
| 2460 | r = visualRect(opt->direction, opt->rect, r); | - | ||||||||||||||||||||||||
| 2461 | } never executed: end of block | 0 | ||||||||||||||||||||||||
| 2462 | break; never executed: break; | 0 | ||||||||||||||||||||||||
| 2463 | #endif // QT_NO_SLIDER | - | ||||||||||||||||||||||||
| 2464 | #ifndef QT_NO_PROGRESSBAR | - | ||||||||||||||||||||||||
| 2465 | case SE_ProgressBarGroove: never executed: case SE_ProgressBarGroove: | 0 | ||||||||||||||||||||||||
| 2466 | case SE_ProgressBarContents: never executed: case SE_ProgressBarContents: | 0 | ||||||||||||||||||||||||
| 2467 | case SE_ProgressBarLabel: never executed: case SE_ProgressBarLabel: | 0 | ||||||||||||||||||||||||
| 2468 | if (const QStyleOptionProgressBar *pb = qstyleoption_cast<const QStyleOptionProgressBar *>(opt)) {
| 0 | ||||||||||||||||||||||||
| 2469 | int textw = 0; | - | ||||||||||||||||||||||||
| 2470 | const bool vertical = pb->orientation == Qt::Vertical; | - | ||||||||||||||||||||||||
| 2471 | if (!vertical) {
| 0 | ||||||||||||||||||||||||
| 2472 | if (pb->textVisible)
| 0 | ||||||||||||||||||||||||
| 2473 | 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 | ||||||||||||||||||||||||
| 2474 | } never executed: end of block | 0 | ||||||||||||||||||||||||
| 2475 | - | |||||||||||||||||||||||||
| 2476 | if ((pb->textAlignment & Qt::AlignCenter) == 0) {
| 0 | ||||||||||||||||||||||||
| 2477 | if (sr != SE_ProgressBarLabel)
| 0 | ||||||||||||||||||||||||
| 2478 | 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 | ||||||||||||||||||||||||
| 2479 | 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 | ||||||||||||||||||||||||
| 2480 | else | - | ||||||||||||||||||||||||
| 2481 | 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 | ||||||||||||||||||||||||
| 2482 | pb->rect.right(), pb->rect.bottom()); never executed: r.setCoords(pb->rect.right() - textw, pb->rect.top(), pb->rect.right(), pb->rect.bottom()); | 0 | ||||||||||||||||||||||||
| 2483 | } else { | - | ||||||||||||||||||||||||
| 2484 | r = pb->rect; | - | ||||||||||||||||||||||||
| 2485 | } never executed: end of block | 0 | ||||||||||||||||||||||||
| 2486 | r = visualRect(pb->direction, pb->rect, r); | - | ||||||||||||||||||||||||
| 2487 | } never executed: end of block | 0 | ||||||||||||||||||||||||
| 2488 | break; never executed: break; | 0 | ||||||||||||||||||||||||
| 2489 | #endif // QT_NO_PROGRESSBAR | - | ||||||||||||||||||||||||
| 2490 | #ifndef QT_NO_COMBOBOX | - | ||||||||||||||||||||||||
| 2491 | case SE_ComboBoxFocusRect: never executed: case SE_ComboBoxFocusRect: | 0 | ||||||||||||||||||||||||
| 2492 | if (const QStyleOptionComboBox *cb = qstyleoption_cast<const QStyleOptionComboBox *>(opt)) {
| 0 | ||||||||||||||||||||||||
| 2493 | int margin = cb->frame ? 3 : 0;
| 0 | ||||||||||||||||||||||||
| 2494 | r.setRect(opt->rect.left() + margin, opt->rect.top() + margin, | - | ||||||||||||||||||||||||
| 2495 | opt->rect.width() - 2*margin - 16, opt->rect.height() - 2*margin); | - | ||||||||||||||||||||||||
| 2496 | r = visualRect(opt->direction, opt->rect, r); | - | ||||||||||||||||||||||||
| 2497 | } never executed: end of block | 0 | ||||||||||||||||||||||||
| 2498 | break; never executed: break; | 0 | ||||||||||||||||||||||||
| 2499 | #endif // QT_NO_COMBOBOX | - | ||||||||||||||||||||||||
| 2500 | #ifndef QT_NO_TOOLBOX | - | ||||||||||||||||||||||||
| 2501 | case SE_ToolBoxTabContents: never executed: case SE_ToolBoxTabContents: | 0 | ||||||||||||||||||||||||
| 2502 | r = opt->rect; | - | ||||||||||||||||||||||||
| 2503 | r.adjust(0, 0, -30, 0); | - | ||||||||||||||||||||||||
| 2504 | break; never executed: break; | 0 | ||||||||||||||||||||||||
| 2505 | #endif // QT_NO_TOOLBOX | - | ||||||||||||||||||||||||
| 2506 | case SE_HeaderLabel: { never executed: case SE_HeaderLabel: | 0 | ||||||||||||||||||||||||
| 2507 | int margin = proxy()->pixelMetric(QStyle::PM_HeaderMargin, opt, widget); | - | ||||||||||||||||||||||||
| 2508 | r.setRect(opt->rect.x() + margin, opt->rect.y() + margin, | - | ||||||||||||||||||||||||
| 2509 | opt->rect.width() - margin * 2, opt->rect.height() - margin * 2); | - | ||||||||||||||||||||||||
| 2510 | - | |||||||||||||||||||||||||
| 2511 | if (const QStyleOptionHeader *header = qstyleoption_cast<const QStyleOptionHeader *>(opt)) {
| 0 | ||||||||||||||||||||||||
| 2512 | // Subtract width needed for arrow, if there is one | - | ||||||||||||||||||||||||
| 2513 | if (header->sortIndicator != QStyleOptionHeader::None) {
| 0 | ||||||||||||||||||||||||
| 2514 | if (opt->state & State_Horizontal)
| 0 | ||||||||||||||||||||||||
| 2515 | r.setWidth(r.width() - (opt->rect.height() / 2) - (margin * 2)); never executed: r.setWidth(r.width() - (opt->rect.height() / 2) - (margin * 2)); | 0 | ||||||||||||||||||||||||
| 2516 | else | - | ||||||||||||||||||||||||
| 2517 | r.setHeight(r.height() - (opt->rect.width() / 2) - (margin * 2)); never executed: r.setHeight(r.height() - (opt->rect.width() / 2) - (margin * 2)); | 0 | ||||||||||||||||||||||||
| 2518 | } | - | ||||||||||||||||||||||||
| 2519 | } never executed: end of block | 0 | ||||||||||||||||||||||||
| 2520 | r = visualRect(opt->direction, opt->rect, r); | - | ||||||||||||||||||||||||
| 2521 | break; } never executed: break; | 0 | ||||||||||||||||||||||||
| 2522 | case SE_HeaderArrow: { never executed: case SE_HeaderArrow: | 0 | ||||||||||||||||||||||||
| 2523 | int h = opt->rect.height(); | - | ||||||||||||||||||||||||
| 2524 | int w = opt->rect.width(); | - | ||||||||||||||||||||||||
| 2525 | int x = opt->rect.x(); | - | ||||||||||||||||||||||||
| 2526 | int y = opt->rect.y(); | - | ||||||||||||||||||||||||
| 2527 | int margin = proxy()->pixelMetric(QStyle::PM_HeaderMargin, opt, widget); | - | ||||||||||||||||||||||||
| 2528 | - | |||||||||||||||||||||||||
| 2529 | if (opt->state & State_Horizontal) {
| 0 | ||||||||||||||||||||||||
| 2530 | int horiz_size = h / 2; | - | ||||||||||||||||||||||||
| 2531 | r.setRect(x + w - margin * 2 - horiz_size, y + 5, | - | ||||||||||||||||||||||||
| 2532 | horiz_size, h - margin * 2 - 5); | - | ||||||||||||||||||||||||
| 2533 | } else { never executed: end of block | 0 | ||||||||||||||||||||||||
| 2534 | int vert_size = w / 2; | - | ||||||||||||||||||||||||
| 2535 | r.setRect(x + 5, y + h - margin * 2 - vert_size, | - | ||||||||||||||||||||||||
| 2536 | w - margin * 2 - 5, vert_size); | - | ||||||||||||||||||||||||
| 2537 | } never executed: end of block | 0 | ||||||||||||||||||||||||
| 2538 | r = visualRect(opt->direction, opt->rect, r); | - | ||||||||||||||||||||||||
| 2539 | break; } never executed: break; | 0 | ||||||||||||||||||||||||
| 2540 | - | |||||||||||||||||||||||||
| 2541 | case SE_RadioButtonClickRect: never executed: case SE_RadioButtonClickRect: | 0 | ||||||||||||||||||||||||
| 2542 | r = subElementRect(SE_RadioButtonFocusRect, opt, widget); | - | ||||||||||||||||||||||||
| 2543 | r |= subElementRect(SE_RadioButtonIndicator, opt, widget); | - | ||||||||||||||||||||||||
| 2544 | break; never executed: break; | 0 | ||||||||||||||||||||||||
| 2545 | case SE_CheckBoxClickRect: never executed: case SE_CheckBoxClickRect: | 0 | ||||||||||||||||||||||||
| 2546 | r = subElementRect(SE_CheckBoxFocusRect, opt, widget); | - | ||||||||||||||||||||||||
| 2547 | r |= subElementRect(SE_CheckBoxIndicator, opt, widget); | - | ||||||||||||||||||||||||
| 2548 | break; never executed: break; | 0 | ||||||||||||||||||||||||
| 2549 | #ifndef QT_NO_TABWIDGET | - | ||||||||||||||||||||||||
| 2550 | case SE_TabWidgetTabBar: never executed: case SE_TabWidgetTabBar: | 0 | ||||||||||||||||||||||||
| 2551 | if (const QStyleOptionTabWidgetFrame *twf
| 0 | ||||||||||||||||||||||||
| 2552 | = qstyleoption_cast<const QStyleOptionTabWidgetFrame *>(opt)) {
| 0 | ||||||||||||||||||||||||
| 2553 | r.setSize(twf->tabBarSize); | - | ||||||||||||||||||||||||
| 2554 | const uint alingMask = Qt::AlignLeft | Qt::AlignRight | Qt::AlignHCenter; | - | ||||||||||||||||||||||||
| 2555 | switch (twf->shape) { | - | ||||||||||||||||||||||||
| 2556 | case QTabBar::RoundedNorth: never executed: case QTabBar::RoundedNorth: | 0 | ||||||||||||||||||||||||
| 2557 | case QTabBar::TriangularNorth: never executed: case QTabBar::TriangularNorth: | 0 | ||||||||||||||||||||||||
| 2558 | // Constrain the size now, otherwise, center could get off the page | - | ||||||||||||||||||||||||
| 2559 | // This of course repeated for all the other directions | - | ||||||||||||||||||||||||
| 2560 | r.setWidth(qMin(r.width(), twf->rect.width() | - | ||||||||||||||||||||||||
| 2561 | - twf->leftCornerWidgetSize.width() | - | ||||||||||||||||||||||||
| 2562 | - twf->rightCornerWidgetSize.width())); | - | ||||||||||||||||||||||||
| 2563 | switch (proxy()->styleHint(SH_TabBar_Alignment, twf, widget) & alingMask) { | - | ||||||||||||||||||||||||
| 2564 | default: never executed: default: | 0 | ||||||||||||||||||||||||
| 2565 | case Qt::AlignLeft: never executed: case Qt::AlignLeft: | 0 | ||||||||||||||||||||||||
| 2566 | r.moveTopLeft(QPoint(twf->leftCornerWidgetSize.width(), 0)); | - | ||||||||||||||||||||||||
| 2567 | break; never executed: break; | 0 | ||||||||||||||||||||||||
| 2568 | case Qt::AlignHCenter: never executed: case Qt::AlignHCenter: | 0 | ||||||||||||||||||||||||
| 2569 | r.moveTopLeft(QPoint(twf->rect.center().x() - qRound(r.width() / 2.0f) | - | ||||||||||||||||||||||||
| 2570 | + (twf->leftCornerWidgetSize.width() / 2) | - | ||||||||||||||||||||||||
| 2571 | - (twf->rightCornerWidgetSize.width() / 2), 0)); | - | ||||||||||||||||||||||||
| 2572 | break; never executed: break; | 0 | ||||||||||||||||||||||||
| 2573 | case Qt::AlignRight: never executed: case Qt::AlignRight: | 0 | ||||||||||||||||||||||||
| 2574 | r.moveTopLeft(QPoint(twf->rect.width() - twf->tabBarSize.width() | - | ||||||||||||||||||||||||
| 2575 | - twf->rightCornerWidgetSize.width(), 0)); | - | ||||||||||||||||||||||||
| 2576 | break; never executed: break; | 0 | ||||||||||||||||||||||||
| 2577 | } | - | ||||||||||||||||||||||||
| 2578 | r = visualRect(twf->direction, twf->rect, r); | - | ||||||||||||||||||||||||
| 2579 | break; never executed: break; | 0 | ||||||||||||||||||||||||
| 2580 | case QTabBar::RoundedSouth: never executed: case QTabBar::RoundedSouth: | 0 | ||||||||||||||||||||||||
| 2581 | case QTabBar::TriangularSouth: never executed: case QTabBar::TriangularSouth: | 0 | ||||||||||||||||||||||||
| 2582 | r.setWidth(qMin(r.width(), twf->rect.width() | - | ||||||||||||||||||||||||
| 2583 | - twf->leftCornerWidgetSize.width() | - | ||||||||||||||||||||||||
| 2584 | - twf->rightCornerWidgetSize.width())); | - | ||||||||||||||||||||||||
| 2585 | switch (proxy()->styleHint(SH_TabBar_Alignment, twf, widget) & alingMask) { | - | ||||||||||||||||||||||||
| 2586 | default: never executed: default: | 0 | ||||||||||||||||||||||||
| 2587 | case Qt::AlignLeft: never executed: case Qt::AlignLeft: | 0 | ||||||||||||||||||||||||
| 2588 | r.moveTopLeft(QPoint(twf->leftCornerWidgetSize.width(), | - | ||||||||||||||||||||||||
| 2589 | twf->rect.height() - twf->tabBarSize.height())); | - | ||||||||||||||||||||||||
| 2590 | break; never executed: break; | 0 | ||||||||||||||||||||||||
| 2591 | case Qt::AlignHCenter: never executed: case Qt::AlignHCenter: | 0 | ||||||||||||||||||||||||
| 2592 | r.moveTopLeft(QPoint(twf->rect.center().x() - qRound(r.width() / 2.0f) | - | ||||||||||||||||||||||||
| 2593 | + (twf->leftCornerWidgetSize.width() / 2) | - | ||||||||||||||||||||||||
| 2594 | - (twf->rightCornerWidgetSize.width() / 2), | - | ||||||||||||||||||||||||
| 2595 | twf->rect.height() - twf->tabBarSize.height())); | - | ||||||||||||||||||||||||
| 2596 | break; never executed: break; | 0 | ||||||||||||||||||||||||
| 2597 | case Qt::AlignRight: never executed: case Qt::AlignRight: | 0 | ||||||||||||||||||||||||
| 2598 | r.moveTopLeft(QPoint(twf->rect.width() - twf->tabBarSize.width() | - | ||||||||||||||||||||||||
| 2599 | - twf->rightCornerWidgetSize.width(), | - | ||||||||||||||||||||||||
| 2600 | twf->rect.height() - twf->tabBarSize.height())); | - | ||||||||||||||||||||||||
| 2601 | break; never executed: break; | 0 | ||||||||||||||||||||||||
| 2602 | } | - | ||||||||||||||||||||||||
| 2603 | r = visualRect(twf->direction, twf->rect, r); | - | ||||||||||||||||||||||||
| 2604 | break; never executed: break; | 0 | ||||||||||||||||||||||||
| 2605 | case QTabBar::RoundedEast: never executed: case QTabBar::RoundedEast: | 0 | ||||||||||||||||||||||||
| 2606 | case QTabBar::TriangularEast: never executed: case QTabBar::TriangularEast: | 0 | ||||||||||||||||||||||||
| 2607 | r.setHeight(qMin(r.height(), twf->rect.height() | - | ||||||||||||||||||||||||
| 2608 | - twf->leftCornerWidgetSize.height() | - | ||||||||||||||||||||||||
| 2609 | - twf->rightCornerWidgetSize.height())); | - | ||||||||||||||||||||||||
| 2610 | switch (proxy()->styleHint(SH_TabBar_Alignment, twf, widget) & alingMask) { | - | ||||||||||||||||||||||||
| 2611 | default: never executed: default: | 0 | ||||||||||||||||||||||||
| 2612 | case Qt::AlignLeft: never executed: case Qt::AlignLeft: | 0 | ||||||||||||||||||||||||
| 2613 | r.moveTopLeft(QPoint(twf->rect.width() - twf->tabBarSize.width(), | - | ||||||||||||||||||||||||
| 2614 | twf->leftCornerWidgetSize.height())); | - | ||||||||||||||||||||||||
| 2615 | break; never executed: break; | 0 | ||||||||||||||||||||||||
| 2616 | case Qt::AlignHCenter: never executed: case Qt::AlignHCenter: | 0 | ||||||||||||||||||||||||
| 2617 | r.moveTopLeft(QPoint(twf->rect.width() - twf->tabBarSize.width(), | - | ||||||||||||||||||||||||
| 2618 | twf->rect.center().y() - r.height() / 2)); | - | ||||||||||||||||||||||||
| 2619 | break; never executed: break; | 0 | ||||||||||||||||||||||||
| 2620 | case Qt::AlignRight: never executed: case Qt::AlignRight: | 0 | ||||||||||||||||||||||||
| 2621 | r.moveTopLeft(QPoint(twf->rect.width() - twf->tabBarSize.width(), | - | ||||||||||||||||||||||||
| 2622 | twf->rect.height() - twf->tabBarSize.height() | - | ||||||||||||||||||||||||
| 2623 | - twf->rightCornerWidgetSize.height())); | - | ||||||||||||||||||||||||
| 2624 | break; never executed: break; | 0 | ||||||||||||||||||||||||
| 2625 | } | - | ||||||||||||||||||||||||
| 2626 | break; never executed: break; | 0 | ||||||||||||||||||||||||
| 2627 | case QTabBar::RoundedWest: never executed: case QTabBar::RoundedWest: | 0 | ||||||||||||||||||||||||
| 2628 | case QTabBar::TriangularWest: never executed: case QTabBar::TriangularWest: | 0 | ||||||||||||||||||||||||
| 2629 | r.setHeight(qMin(r.height(), twf->rect.height() | - | ||||||||||||||||||||||||
| 2630 | - twf->leftCornerWidgetSize.height() | - | ||||||||||||||||||||||||
| 2631 | - twf->rightCornerWidgetSize.height())); | - | ||||||||||||||||||||||||
| 2632 | switch (proxy()->styleHint(SH_TabBar_Alignment, twf, widget) & alingMask) { | - | ||||||||||||||||||||||||
| 2633 | default: never executed: default: | 0 | ||||||||||||||||||||||||
| 2634 | case Qt::AlignLeft: never executed: case Qt::AlignLeft: | 0 | ||||||||||||||||||||||||
| 2635 | r.moveTopLeft(QPoint(0, twf->leftCornerWidgetSize.height())); | - | ||||||||||||||||||||||||
| 2636 | break; never executed: break; | 0 | ||||||||||||||||||||||||
| 2637 | case Qt::AlignHCenter: never executed: case Qt::AlignHCenter: | 0 | ||||||||||||||||||||||||
| 2638 | r.moveTopLeft(QPoint(0, twf->rect.center().y() - r.height() / 2)); | - | ||||||||||||||||||||||||
| 2639 | break; never executed: break; | 0 | ||||||||||||||||||||||||
| 2640 | case Qt::AlignRight: never executed: case Qt::AlignRight: | 0 | ||||||||||||||||||||||||
| 2641 | r.moveTopLeft(QPoint(0, twf->rect.height() - twf->tabBarSize.height() | - | ||||||||||||||||||||||||
| 2642 | - twf->rightCornerWidgetSize.height())); | - | ||||||||||||||||||||||||
| 2643 | break; never executed: break; | 0 | ||||||||||||||||||||||||
| 2644 | } | - | ||||||||||||||||||||||||
| 2645 | break; never executed: break; | 0 | ||||||||||||||||||||||||
| 2646 | } | - | ||||||||||||||||||||||||
| 2647 | } never executed: end of block | 0 | ||||||||||||||||||||||||
| 2648 | break; never executed: break; | 0 | ||||||||||||||||||||||||
| 2649 | case SE_TabWidgetTabPane: never executed: case SE_TabWidgetTabPane: | 0 | ||||||||||||||||||||||||
| 2650 | case SE_TabWidgetTabContents: never executed: case SE_TabWidgetTabContents: | 0 | ||||||||||||||||||||||||
| 2651 | if (const QStyleOptionTabWidgetFrame *twf = qstyleoption_cast<const QStyleOptionTabWidgetFrame *>(opt)) {
| 0 | ||||||||||||||||||||||||
| 2652 | QStyleOptionTab tabopt; | - | ||||||||||||||||||||||||
| 2653 | tabopt.shape = twf->shape; | - | ||||||||||||||||||||||||
| 2654 | int overlap = proxy()->pixelMetric(PM_TabBarBaseOverlap, &tabopt, widget); | - | ||||||||||||||||||||||||
| 2655 | if (twf->lineWidth == 0)
| 0 | ||||||||||||||||||||||||
| 2656 | overlap = 0; never executed: overlap = 0; | 0 | ||||||||||||||||||||||||
| 2657 | switch (twf->shape) { | - | ||||||||||||||||||||||||
| 2658 | case QTabBar::RoundedNorth: never executed: case QTabBar::RoundedNorth: | 0 | ||||||||||||||||||||||||
| 2659 | case QTabBar::TriangularNorth: never executed: case QTabBar::TriangularNorth: | 0 | ||||||||||||||||||||||||
| 2660 | r = QRect(QPoint(0,qMax(twf->tabBarSize.height() - overlap, 0)), | - | ||||||||||||||||||||||||
| 2661 | QSize(twf->rect.width(), qMin(twf->rect.height() - twf->tabBarSize.height() + overlap, twf->rect.height()))); | - | ||||||||||||||||||||||||
| 2662 | break; never executed: break; | 0 | ||||||||||||||||||||||||
| 2663 | case QTabBar::RoundedSouth: never executed: case QTabBar::RoundedSouth: | 0 | ||||||||||||||||||||||||
| 2664 | case QTabBar::TriangularSouth: never executed: case QTabBar::TriangularSouth: | 0 | ||||||||||||||||||||||||
| 2665 | r = QRect(QPoint(0,0), QSize(twf->rect.width(), qMin(twf->rect.height() - twf->tabBarSize.height() + overlap, twf->rect.height()))); | - | ||||||||||||||||||||||||
| 2666 | break; never executed: break; | 0 | ||||||||||||||||||||||||
| 2667 | case QTabBar::RoundedEast: never executed: case QTabBar::RoundedEast: | 0 | ||||||||||||||||||||||||
| 2668 | case QTabBar::TriangularEast: never executed: case QTabBar::TriangularEast: | 0 | ||||||||||||||||||||||||
| 2669 | r = QRect(QPoint(0, 0), QSize(qMin(twf->rect.width() - twf->tabBarSize.width() + overlap, twf->rect.width()), twf->rect.height())); | - | ||||||||||||||||||||||||
| 2670 | break; never executed: break; | 0 | ||||||||||||||||||||||||
| 2671 | case QTabBar::RoundedWest: never executed: case QTabBar::RoundedWest: | 0 | ||||||||||||||||||||||||
| 2672 | case QTabBar::TriangularWest: never executed: case QTabBar::TriangularWest: | 0 | ||||||||||||||||||||||||
| 2673 | r = QRect(QPoint(qMax(twf->tabBarSize.width() - overlap, 0), 0), | - | ||||||||||||||||||||||||
| 2674 | QSize(qMin(twf->rect.width() - twf->tabBarSize.width() + overlap, twf->rect.width()), twf->rect.height())); | - | ||||||||||||||||||||||||
| 2675 | break; never executed: break; | 0 | ||||||||||||||||||||||||
| 2676 | } | - | ||||||||||||||||||||||||
| 2677 | if (sr == SE_TabWidgetTabContents && twf->lineWidth > 0)
| 0 | ||||||||||||||||||||||||
| 2678 | r.adjust(2, 2, -2, -2); never executed: r.adjust(2, 2, -2, -2); | 0 | ||||||||||||||||||||||||
| 2679 | } never executed: end of block | 0 | ||||||||||||||||||||||||
| 2680 | break; never executed: break; | 0 | ||||||||||||||||||||||||
| 2681 | case SE_TabWidgetLeftCorner: never executed: case SE_TabWidgetLeftCorner: | 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.x(), paneRect.y() - twf->leftCornerWidgetSize.height()), | - | ||||||||||||||||||||||||
| 2688 | twf->leftCornerWidgetSize); | - | ||||||||||||||||||||||||
| 2689 | break; never executed: break; | 0 | ||||||||||||||||||||||||
| 2690 | case QTabBar::RoundedSouth: never executed: case QTabBar::RoundedSouth: | 0 | ||||||||||||||||||||||||
| 2691 | case QTabBar::TriangularSouth: never executed: case QTabBar::TriangularSouth: | 0 | ||||||||||||||||||||||||
| 2692 | r = QRect(QPoint(paneRect.x(), paneRect.height()), twf->leftCornerWidgetSize); | - | ||||||||||||||||||||||||
| 2693 | break; never executed: break; | 0 | ||||||||||||||||||||||||
| 2694 | default: never executed: default: | 0 | ||||||||||||||||||||||||
| 2695 | break; never executed: break; | 0 | ||||||||||||||||||||||||
| 2696 | } | - | ||||||||||||||||||||||||
| 2697 | r = visualRect(twf->direction, twf->rect, r); | - | ||||||||||||||||||||||||
| 2698 | } never executed: end of block | 0 | ||||||||||||||||||||||||
| 2699 | break; never executed: break; | 0 | ||||||||||||||||||||||||
| 2700 | case SE_TabWidgetRightCorner: never executed: case SE_TabWidgetRightCorner: | 0 | ||||||||||||||||||||||||
| 2701 | if (const QStyleOptionTabWidgetFrame *twf = qstyleoption_cast<const QStyleOptionTabWidgetFrame *>(opt)) {
| 0 | ||||||||||||||||||||||||
| 2702 | QRect paneRect = subElementRect(SE_TabWidgetTabPane, twf, widget); | - | ||||||||||||||||||||||||
| 2703 | switch (twf->shape) { | - | ||||||||||||||||||||||||
| 2704 | case QTabBar::RoundedNorth: never executed: case QTabBar::RoundedNorth: | 0 | ||||||||||||||||||||||||
| 2705 | case QTabBar::TriangularNorth: never executed: case QTabBar::TriangularNorth: | 0 | ||||||||||||||||||||||||
| 2706 | r = QRect(QPoint(paneRect.width() - twf->rightCornerWidgetSize.width(), | - | ||||||||||||||||||||||||
| 2707 | paneRect.y() - twf->rightCornerWidgetSize.height()), | - | ||||||||||||||||||||||||
| 2708 | twf->rightCornerWidgetSize); | - | ||||||||||||||||||||||||
| 2709 | break; never executed: break; | 0 | ||||||||||||||||||||||||
| 2710 | case QTabBar::RoundedSouth: never executed: case QTabBar::RoundedSouth: | 0 | ||||||||||||||||||||||||
| 2711 | case QTabBar::TriangularSouth: never executed: case QTabBar::TriangularSouth: | 0 | ||||||||||||||||||||||||
| 2712 | r = QRect(QPoint(paneRect.width() - twf->rightCornerWidgetSize.width(), | - | ||||||||||||||||||||||||
| 2713 | paneRect.height()), twf->rightCornerWidgetSize); | - | ||||||||||||||||||||||||
| 2714 | break; never executed: break; | 0 | ||||||||||||||||||||||||
| 2715 | default: never executed: default: | 0 | ||||||||||||||||||||||||
| 2716 | break; never executed: break; | 0 | ||||||||||||||||||||||||
| 2717 | } | - | ||||||||||||||||||||||||
| 2718 | r = visualRect(twf->direction, twf->rect, r); | - | ||||||||||||||||||||||||
| 2719 | } never executed: end of block | 0 | ||||||||||||||||||||||||
| 2720 | break; never executed: break; | 0 | ||||||||||||||||||||||||
| 2721 | case SE_TabBarTabText: never executed: case SE_TabBarTabText: | 0 | ||||||||||||||||||||||||
| 2722 | if (const QStyleOptionTab *tab = qstyleoption_cast<const QStyleOptionTab *>(opt)) {
| 0 | ||||||||||||||||||||||||
| 2723 | QRect dummyIconRect; | - | ||||||||||||||||||||||||
| 2724 | d->tabLayout(tab, widget, &r, &dummyIconRect); | - | ||||||||||||||||||||||||
| 2725 | } never executed: end of block | 0 | ||||||||||||||||||||||||
| 2726 | break; never executed: break; | 0 | ||||||||||||||||||||||||
| 2727 | case SE_TabBarTabLeftButton: never executed: case SE_TabBarTabLeftButton: | 0 | ||||||||||||||||||||||||
| 2728 | case SE_TabBarTabRightButton: never executed: case SE_TabBarTabRightButton: | 0 | ||||||||||||||||||||||||
| 2729 | if (const QStyleOptionTab *tab = qstyleoption_cast<const QStyleOptionTab *>(opt)) {
| 0 | ||||||||||||||||||||||||
| 2730 | bool selected = tab->state & State_Selected; | - | ||||||||||||||||||||||||
| 2731 | int verticalShift = proxy()->pixelMetric(QStyle::PM_TabBarTabShiftVertical, tab, widget); | - | ||||||||||||||||||||||||
| 2732 | int horizontalShift = proxy()->pixelMetric(QStyle::PM_TabBarTabShiftHorizontal, tab, widget); | - | ||||||||||||||||||||||||
| 2733 | int hpadding = proxy()->pixelMetric(QStyle::PM_TabBarTabHSpace, opt, widget) / 2; | - | ||||||||||||||||||||||||
| 2734 | hpadding = qMax(hpadding, 4); //workaround KStyle returning 0 because they workaround an old bug in Qt | - | ||||||||||||||||||||||||
| 2735 | - | |||||||||||||||||||||||||
| 2736 | bool verticalTabs = tab->shape == QTabBar::RoundedEast
| 0 | ||||||||||||||||||||||||
| 2737 | || tab->shape == QTabBar::RoundedWest
| 0 | ||||||||||||||||||||||||
| 2738 | || tab->shape == QTabBar::TriangularEast
| 0 | ||||||||||||||||||||||||
| 2739 | || tab->shape == QTabBar::TriangularWest;
| 0 | ||||||||||||||||||||||||
| 2740 | - | |||||||||||||||||||||||||
| 2741 | QRect tr = tab->rect; | - | ||||||||||||||||||||||||
| 2742 | if (tab->shape == QTabBar::RoundedSouth || tab->shape == QTabBar::TriangularSouth)
| 0 | ||||||||||||||||||||||||
| 2743 | verticalShift = -verticalShift; never executed: verticalShift = -verticalShift; | 0 | ||||||||||||||||||||||||
| 2744 | if (verticalTabs) {
| 0 | ||||||||||||||||||||||||
| 2745 | qSwap(horizontalShift, verticalShift); | - | ||||||||||||||||||||||||
| 2746 | horizontalShift *= -1; | - | ||||||||||||||||||||||||
| 2747 | verticalShift *= -1; | - | ||||||||||||||||||||||||
| 2748 | } never executed: end of block | 0 | ||||||||||||||||||||||||
| 2749 | if (tab->shape == QTabBar::RoundedWest || tab->shape == QTabBar::TriangularWest)
| 0 | ||||||||||||||||||||||||
| 2750 | horizontalShift = -horizontalShift; never executed: horizontalShift = -horizontalShift; | 0 | ||||||||||||||||||||||||
| 2751 | - | |||||||||||||||||||||||||
| 2752 | tr.adjust(0, 0, horizontalShift, verticalShift); | - | ||||||||||||||||||||||||
| 2753 | if (selected)
| 0 | ||||||||||||||||||||||||
| 2754 | { | - | ||||||||||||||||||||||||
| 2755 | tr.setBottom(tr.bottom() - verticalShift); | - | ||||||||||||||||||||||||
| 2756 | tr.setRight(tr.right() - horizontalShift); | - | ||||||||||||||||||||||||
| 2757 | } never executed: end of block | 0 | ||||||||||||||||||||||||
| 2758 | - | |||||||||||||||||||||||||
| 2759 | QSize size = (sr == SE_TabBarTabLeftButton) ? tab->leftButtonSize : tab->rightButtonSize;
| 0 | ||||||||||||||||||||||||
| 2760 | int w = size.width(); | - | ||||||||||||||||||||||||
| 2761 | int h = size.height(); | - | ||||||||||||||||||||||||
| 2762 | int midHeight = static_cast<int>(qCeil(float(tr.height() - h) / 2)); | - | ||||||||||||||||||||||||
| 2763 | int midWidth = ((tr.width() - w) / 2); | - | ||||||||||||||||||||||||
| 2764 | - | |||||||||||||||||||||||||
| 2765 | bool atTheTop = true; | - | ||||||||||||||||||||||||
| 2766 | switch (tab->shape) { | - | ||||||||||||||||||||||||
| 2767 | case QTabBar::RoundedWest: never executed: case QTabBar::RoundedWest: | 0 | ||||||||||||||||||||||||
| 2768 | case QTabBar::TriangularWest: never executed: case QTabBar::TriangularWest: | 0 | ||||||||||||||||||||||||
| 2769 | atTheTop = (sr == SE_TabBarTabLeftButton); | - | ||||||||||||||||||||||||
| 2770 | break; never executed: break; | 0 | ||||||||||||||||||||||||
| 2771 | case QTabBar::RoundedEast: never executed: case QTabBar::RoundedEast: | 0 | ||||||||||||||||||||||||
| 2772 | case QTabBar::TriangularEast: never executed: case QTabBar::TriangularEast: | 0 | ||||||||||||||||||||||||
| 2773 | atTheTop = (sr == SE_TabBarTabRightButton); | - | ||||||||||||||||||||||||
| 2774 | break; never executed: break; | 0 | ||||||||||||||||||||||||
| 2775 | default: never executed: default: | 0 | ||||||||||||||||||||||||
| 2776 | if (sr == SE_TabBarTabLeftButton)
| 0 | ||||||||||||||||||||||||
| 2777 | r = QRect(tab->rect.x() + hpadding, midHeight, w, h); never executed: r = QRect(tab->rect.x() + hpadding, midHeight, w, h); | 0 | ||||||||||||||||||||||||
| 2778 | else | - | ||||||||||||||||||||||||
| 2779 | r = QRect(tab->rect.right() - w - hpadding, midHeight, w, h); never executed: r = QRect(tab->rect.right() - w - hpadding, midHeight, w, h); | 0 | ||||||||||||||||||||||||
| 2780 | r = visualRect(tab->direction, tab->rect, r); | - | ||||||||||||||||||||||||
| 2781 | } never executed: end of block | 0 | ||||||||||||||||||||||||
| 2782 | if (verticalTabs) {
| 0 | ||||||||||||||||||||||||
| 2783 | if (atTheTop)
| 0 | ||||||||||||||||||||||||
| 2784 | 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 | ||||||||||||||||||||||||
| 2785 | else | - | ||||||||||||||||||||||||
| 2786 | r = QRect(midWidth, tr.y() + hpadding, w, h); never executed: r = QRect(midWidth, tr.y() + hpadding, w, h); | 0 | ||||||||||||||||||||||||
| 2787 | } | - | ||||||||||||||||||||||||
| 2788 | } never executed: end of block | 0 | ||||||||||||||||||||||||
| 2789 | - | |||||||||||||||||||||||||
| 2790 | break; never executed: break; | 0 | ||||||||||||||||||||||||
| 2791 | #endif // QT_NO_TABWIDGET | - | ||||||||||||||||||||||||
| 2792 | #ifndef QT_NO_TABBAR | - | ||||||||||||||||||||||||
| 2793 | case SE_TabBarTearIndicator: never executed: case SE_TabBarTearIndicator: | 0 | ||||||||||||||||||||||||
| 2794 | if (const QStyleOptionTab *tab = qstyleoption_cast<const QStyleOptionTab *>(opt)) {
| 0 | ||||||||||||||||||||||||
| 2795 | switch (tab->shape) { | - | ||||||||||||||||||||||||
| 2796 | case QTabBar::RoundedNorth: never executed: case QTabBar::RoundedNorth: | 0 | ||||||||||||||||||||||||
| 2797 | case QTabBar::TriangularNorth: never executed: case QTabBar::TriangularNorth: | 0 | ||||||||||||||||||||||||
| 2798 | case QTabBar::RoundedSouth: never executed: case QTabBar::RoundedSouth: | 0 | ||||||||||||||||||||||||
| 2799 | case QTabBar::TriangularSouth: never executed: case QTabBar::TriangularSouth: | 0 | ||||||||||||||||||||||||
| 2800 | r.setRect(tab->rect.left(), tab->rect.top(), 48, opt->rect.height()); | - | ||||||||||||||||||||||||
| 2801 | break; never executed: break; | 0 | ||||||||||||||||||||||||
| 2802 | case QTabBar::RoundedWest: never executed: case QTabBar::RoundedWest: | 0 | ||||||||||||||||||||||||
| 2803 | case QTabBar::TriangularWest: never executed: case QTabBar::TriangularWest: | 0 | ||||||||||||||||||||||||
| 2804 | case QTabBar::RoundedEast: never executed: case QTabBar::RoundedEast: | 0 | ||||||||||||||||||||||||
| 2805 | case QTabBar::TriangularEast: never executed: case QTabBar::TriangularEast: | 0 | ||||||||||||||||||||||||
| 2806 | r.setRect(tab->rect.left(), tab->rect.top(), opt->rect.width(), 48); | - | ||||||||||||||||||||||||
| 2807 | break; never executed: break; | 0 | ||||||||||||||||||||||||
| 2808 | default: never executed: default: | 0 | ||||||||||||||||||||||||
| 2809 | break; never executed: break; | 0 | ||||||||||||||||||||||||
| 2810 | } | - | ||||||||||||||||||||||||
| 2811 | r = visualRect(opt->direction, opt->rect, r); | - | ||||||||||||||||||||||||
| 2812 | } never executed: end of block | 0 | ||||||||||||||||||||||||
| 2813 | break; never executed: break; | 0 | ||||||||||||||||||||||||
| 2814 | case SE_TabBarScrollLeftButton: { never executed: case SE_TabBarScrollLeftButton: | 0 | ||||||||||||||||||||||||
| 2815 | const bool vertical = opt->rect.width() < opt->rect.height(); | - | ||||||||||||||||||||||||
| 2816 | const Qt::LayoutDirection ld = widget->layoutDirection(); | - | ||||||||||||||||||||||||
| 2817 | const int buttonWidth = qMax(pixelMetric(QStyle::PM_TabBarScrollButtonWidth, 0, widget), QApplication::globalStrut().width()); | - | ||||||||||||||||||||||||
| 2818 | const int buttonOverlap = pixelMetric(QStyle::PM_TabBar_ScrollButtonOverlap, 0, widget); | - | ||||||||||||||||||||||||
| 2819 | - | |||||||||||||||||||||||||
| 2820 | r = vertical ? QRect(0, opt->rect.height() - (buttonWidth * 2) + buttonOverlap, opt->rect.width(), buttonWidth)
| 0 | ||||||||||||||||||||||||
| 2821 | : QStyle::visualRect(ld, opt->rect, QRect(opt->rect.width() - (buttonWidth * 2) + buttonOverlap, 0, buttonWidth, opt->rect.height())); | - | ||||||||||||||||||||||||
| 2822 | break; never executed: }break;never executed: break; | 0 | ||||||||||||||||||||||||
| 2823 | case SE_TabBarScrollRightButton: { never executed: case SE_TabBarScrollRightButton: | 0 | ||||||||||||||||||||||||
| 2824 | const bool vertical = opt->rect.width() < opt->rect.height(); | - | ||||||||||||||||||||||||
| 2825 | const Qt::LayoutDirection ld = widget->layoutDirection(); | - | ||||||||||||||||||||||||
| 2826 | const int buttonWidth = qMax(pixelMetric(QStyle::PM_TabBarScrollButtonWidth, 0, widget), QApplication::globalStrut().width()); | - | ||||||||||||||||||||||||
| 2827 | - | |||||||||||||||||||||||||
| 2828 | r = vertical ? QRect(0, opt->rect.height() - buttonWidth, opt->rect.width(), buttonWidth)
| 0 | ||||||||||||||||||||||||
| 2829 | : QStyle::visualRect(ld, opt->rect, QRect(opt->rect.width() - buttonWidth, 0, buttonWidth, opt->rect.height())); | - | ||||||||||||||||||||||||
| 2830 | break; } never executed: break; | 0 | ||||||||||||||||||||||||
| 2831 | #endif | - | ||||||||||||||||||||||||
| 2832 | case SE_TreeViewDisclosureItem: never executed: case SE_TreeViewDisclosureItem: | 0 | ||||||||||||||||||||||||
| 2833 | r = opt->rect; | - | ||||||||||||||||||||||||
| 2834 | break; never executed: break; | 0 | ||||||||||||||||||||||||
| 2835 | case SE_LineEditContents: never executed: case SE_LineEditContents: | 0 | ||||||||||||||||||||||||
| 2836 | if (const QStyleOptionFrame *f = qstyleoption_cast<const QStyleOptionFrame *>(opt)) {
| 0 | ||||||||||||||||||||||||
| 2837 | r = f->rect.adjusted(f->lineWidth, f->lineWidth, -f->lineWidth, -f->lineWidth); | - | ||||||||||||||||||||||||
| 2838 | r = visualRect(opt->direction, opt->rect, r); | - | ||||||||||||||||||||||||
| 2839 | } never executed: end of block | 0 | ||||||||||||||||||||||||
| 2840 | break; never executed: break; | 0 | ||||||||||||||||||||||||
| 2841 | case SE_FrameContents: never executed: case SE_FrameContents: | 0 | ||||||||||||||||||||||||
| 2842 | if (const QStyleOptionFrame *f = qstyleoption_cast<const QStyleOptionFrame *>(opt)) {
| 0 | ||||||||||||||||||||||||
| 2843 | int fw = proxy()->pixelMetric(PM_DefaultFrameWidth, f, widget); | - | ||||||||||||||||||||||||
| 2844 | r = opt->rect.adjusted(fw, fw, -fw, -fw); | - | ||||||||||||||||||||||||
| 2845 | r = visualRect(opt->direction, opt->rect, r); | - | ||||||||||||||||||||||||
| 2846 | } never executed: end of block | 0 | ||||||||||||||||||||||||
| 2847 | break; never executed: break; | 0 | ||||||||||||||||||||||||
| 2848 | case SE_ShapedFrameContents: never executed: case SE_ShapedFrameContents: | 0 | ||||||||||||||||||||||||
| 2849 | if (const QStyleOptionFrame *f = qstyleoption_cast<const QStyleOptionFrame *>(opt)) {
| 0 | ||||||||||||||||||||||||
| 2850 | int frameShape = f->frameShape; | - | ||||||||||||||||||||||||
| 2851 | int frameShadow = QFrame::Plain; | - | ||||||||||||||||||||||||
| 2852 | if (f->state & QStyle::State_Sunken) {
| 0 | ||||||||||||||||||||||||
| 2853 | frameShadow = QFrame::Sunken; | - | ||||||||||||||||||||||||
| 2854 | } else if (f->state & QStyle::State_Raised) { never executed: end of block
| 0 | ||||||||||||||||||||||||
| 2855 | frameShadow = QFrame::Raised; | - | ||||||||||||||||||||||||
| 2856 | } never executed: end of block | 0 | ||||||||||||||||||||||||
| 2857 | - | |||||||||||||||||||||||||
| 2858 | int frameWidth = 0; | - | ||||||||||||||||||||||||
| 2859 | - | |||||||||||||||||||||||||
| 2860 | switch (frameShape) { | - | ||||||||||||||||||||||||
| 2861 | case QFrame::NoFrame: never executed: case QFrame::NoFrame: | 0 | ||||||||||||||||||||||||
| 2862 | frameWidth = 0; | - | ||||||||||||||||||||||||
| 2863 | break; never executed: break; | 0 | ||||||||||||||||||||||||
| 2864 | - | |||||||||||||||||||||||||
| 2865 | case QFrame::Box: never executed: case QFrame::Box: | 0 | ||||||||||||||||||||||||
| 2866 | case QFrame::HLine: never executed: case QFrame::HLine: | 0 | ||||||||||||||||||||||||
| 2867 | case QFrame::VLine: never executed: case QFrame::VLine: | 0 | ||||||||||||||||||||||||
| 2868 | switch (frameShadow) { | - | ||||||||||||||||||||||||
| 2869 | case QFrame::Plain: never executed: case QFrame::Plain: | 0 | ||||||||||||||||||||||||
| 2870 | frameWidth = f->lineWidth; | - | ||||||||||||||||||||||||
| 2871 | break; never executed: break; | 0 | ||||||||||||||||||||||||
| 2872 | case QFrame::Raised: never executed: case QFrame::Raised: | 0 | ||||||||||||||||||||||||
| 2873 | case QFrame::Sunken: never executed: case QFrame::Sunken: | 0 | ||||||||||||||||||||||||
| 2874 | frameWidth = (short)(f->lineWidth*2 + f->midLineWidth); | - | ||||||||||||||||||||||||
| 2875 | break; never executed: break; | 0 | ||||||||||||||||||||||||
| 2876 | } | - | ||||||||||||||||||||||||
| 2877 | break; never executed: break; | 0 | ||||||||||||||||||||||||
| 2878 | - | |||||||||||||||||||||||||
| 2879 | case QFrame::StyledPanel: never executed: case QFrame::StyledPanel: | 0 | ||||||||||||||||||||||||
| 2880 | //keep the compatibility with Qt 4.4 if there is a proxy style. | - | ||||||||||||||||||||||||
| 2881 | //be sure to call drawPrimitive(QStyle::SE_FrameContents) on the proxy style | - | ||||||||||||||||||||||||
| 2882 | if (widget)
| 0 | ||||||||||||||||||||||||
| 2883 | return widget->style()->subElementRect(QStyle::SE_FrameContents, opt, widget); never executed: return widget->style()->subElementRect(QStyle::SE_FrameContents, opt, widget); | 0 | ||||||||||||||||||||||||
| 2884 | else | - | ||||||||||||||||||||||||
| 2885 | return subElementRect(QStyle::SE_FrameContents, opt, widget); never executed: return subElementRect(QStyle::SE_FrameContents, opt, widget); | 0 | ||||||||||||||||||||||||
| 2886 | - | |||||||||||||||||||||||||
| 2887 | case QFrame::WinPanel: never executed: case QFrame::WinPanel: | 0 | ||||||||||||||||||||||||
| 2888 | frameWidth = 2; | - | ||||||||||||||||||||||||
| 2889 | break; never executed: break; | 0 | ||||||||||||||||||||||||
| 2890 | - | |||||||||||||||||||||||||
| 2891 | case QFrame::Panel: never executed: case QFrame::Panel: | 0 | ||||||||||||||||||||||||
| 2892 | switch (frameShadow) { | - | ||||||||||||||||||||||||
| 2893 | case QFrame::Plain: never executed: case QFrame::Plain: | 0 | ||||||||||||||||||||||||
| 2894 | case QFrame::Raised: never executed: case QFrame::Raised: | 0 | ||||||||||||||||||||||||
| 2895 | case QFrame::Sunken: never executed: case QFrame::Sunken: | 0 | ||||||||||||||||||||||||
| 2896 | frameWidth = f->lineWidth; | - | ||||||||||||||||||||||||
| 2897 | break; never executed: break; | 0 | ||||||||||||||||||||||||
| 2898 | } | - | ||||||||||||||||||||||||
| 2899 | break; never executed: break; | 0 | ||||||||||||||||||||||||
| 2900 | } | - | ||||||||||||||||||||||||
| 2901 | r = f->rect.adjusted(frameWidth, frameWidth, -frameWidth, -frameWidth); | - | ||||||||||||||||||||||||
| 2902 | } never executed: end of block | 0 | ||||||||||||||||||||||||
| 2903 | break; never executed: break; | 0 | ||||||||||||||||||||||||
| 2904 | #ifndef QT_NO_DOCKWIDGET | - | ||||||||||||||||||||||||
| 2905 | case SE_DockWidgetCloseButton: never executed: case SE_DockWidgetCloseButton: | 0 | ||||||||||||||||||||||||
| 2906 | case SE_DockWidgetFloatButton: never executed: case SE_DockWidgetFloatButton: | 0 | ||||||||||||||||||||||||
| 2907 | case SE_DockWidgetTitleBarText: never executed: case SE_DockWidgetTitleBarText: | 0 | ||||||||||||||||||||||||
| 2908 | case SE_DockWidgetIcon: { never executed: case SE_DockWidgetIcon: | 0 | ||||||||||||||||||||||||
| 2909 | int iconSize = proxy()->pixelMetric(PM_SmallIconSize, opt, widget); | - | ||||||||||||||||||||||||
| 2910 | int buttonMargin = proxy()->pixelMetric(PM_DockWidgetTitleBarButtonMargin, opt, widget); | - | ||||||||||||||||||||||||
| 2911 | int margin = proxy()->pixelMetric(QStyle::PM_DockWidgetTitleMargin, opt, widget); | - | ||||||||||||||||||||||||
| 2912 | QRect rect = opt->rect; | - | ||||||||||||||||||||||||
| 2913 | - | |||||||||||||||||||||||||
| 2914 | const QStyleOptionDockWidget *dwOpt | - | ||||||||||||||||||||||||
| 2915 | = qstyleoption_cast<const QStyleOptionDockWidget*>(opt); | - | ||||||||||||||||||||||||
| 2916 | bool canClose = dwOpt == 0 ? true : dwOpt->closable;
| 0 | ||||||||||||||||||||||||
| 2917 | bool canFloat = dwOpt == 0 ? false : dwOpt->floatable;
| 0 | ||||||||||||||||||||||||
| 2918 | - | |||||||||||||||||||||||||
| 2919 | const bool verticalTitleBar = dwOpt && dwOpt->verticalTitleBar;
| 0 | ||||||||||||||||||||||||
| 2920 | - | |||||||||||||||||||||||||
| 2921 | // If this is a vertical titlebar, we transpose and work as if it was | - | ||||||||||||||||||||||||
| 2922 | // horizontal, then transpose again. | - | ||||||||||||||||||||||||
| 2923 | - | |||||||||||||||||||||||||
| 2924 | if (verticalTitleBar)
| 0 | ||||||||||||||||||||||||
| 2925 | rect .setSize(= rect.size().transposed());(); never executed: rect = rect.transposed(); | 0 | ||||||||||||||||||||||||
| 2926 | - | |||||||||||||||||||||||||
| 2927 | do { | - | ||||||||||||||||||||||||
| 2928 | - | |||||||||||||||||||||||||
| 2929 | int right = rect.right(); | - | ||||||||||||||||||||||||
| 2930 | int left = rect.left(); | - | ||||||||||||||||||||||||
| 2931 | - | |||||||||||||||||||||||||
| 2932 | QRect closeRect; | - | ||||||||||||||||||||||||
| 2933 | if (canClose) {
| 0 | ||||||||||||||||||||||||
| 2934 | QSize sz = proxy()->standardIcon(QStyle::SP_TitleBarCloseButton, | - | ||||||||||||||||||||||||
| 2935 | opt, widget).actualSize(QSize(iconSize, iconSize)); | - | ||||||||||||||||||||||||
| 2936 | sz += QSize(buttonMargin, buttonMargin); | - | ||||||||||||||||||||||||
| 2937 | if (verticalTitleBar)
| 0 | ||||||||||||||||||||||||
| 2938 | sz = sz.transposed(); never executed: sz = sz.transposed(); | 0 | ||||||||||||||||||||||||
| 2939 | closeRect = QRect(right - sz.width(), | - | ||||||||||||||||||||||||
| 2940 | rect.center().y() - sz.height()/2, | - | ||||||||||||||||||||||||
| 2941 | sz.width(), sz.height()); | - | ||||||||||||||||||||||||
| 2942 | right = closeRect.left() - 1; | - | ||||||||||||||||||||||||
| 2943 | } never executed: end of block | 0 | ||||||||||||||||||||||||
| 2944 | if (sr == SE_DockWidgetCloseButton) {
| 0 | ||||||||||||||||||||||||
| 2945 | r = closeRect; | - | ||||||||||||||||||||||||
| 2946 | break; never executed: break; | 0 | ||||||||||||||||||||||||
| 2947 | } | - | ||||||||||||||||||||||||
| 2948 | - | |||||||||||||||||||||||||
| 2949 | QRect floatRect; | - | ||||||||||||||||||||||||
| 2950 | if (canFloat) {
| 0 | ||||||||||||||||||||||||
| 2951 | QSize sz = proxy()->standardIcon(QStyle::SP_TitleBarNormalButton, | - | ||||||||||||||||||||||||
| 2952 | opt, widget).actualSize(QSize(iconSize, iconSize)); | - | ||||||||||||||||||||||||
| 2953 | sz += QSize(buttonMargin, buttonMargin); | - | ||||||||||||||||||||||||
| 2954 | if (verticalTitleBar)
| 0 | ||||||||||||||||||||||||
| 2955 | sz = sz.transposed(); never executed: sz = sz.transposed(); | 0 | ||||||||||||||||||||||||
| 2956 | floatRect = QRect(right - sz.width(), | - | ||||||||||||||||||||||||
| 2957 | rect.center().y() - sz.height()/2, | - | ||||||||||||||||||||||||
| 2958 | sz.width(), sz.height()); | - | ||||||||||||||||||||||||
| 2959 | right = floatRect.left() - 1; | - | ||||||||||||||||||||||||
| 2960 | } never executed: end of block | 0 | ||||||||||||||||||||||||
| 2961 | if (sr == SE_DockWidgetFloatButton) {
| 0 | ||||||||||||||||||||||||
| 2962 | r = floatRect; | - | ||||||||||||||||||||||||
| 2963 | break; never executed: break; | 0 | ||||||||||||||||||||||||
| 2964 | } | - | ||||||||||||||||||||||||
| 2965 | - | |||||||||||||||||||||||||
| 2966 | QRect iconRect; | - | ||||||||||||||||||||||||
| 2967 | if (const QDockWidget *dw = qobject_cast<const QDockWidget*>(widget)) {
| 0 | ||||||||||||||||||||||||
| 2968 | QIcon icon; | - | ||||||||||||||||||||||||
| 2969 | if (dw->isFloating())
| 0 | ||||||||||||||||||||||||
| 2970 | icon = dw->windowIcon(); never executed: icon = dw->windowIcon(); | 0 | ||||||||||||||||||||||||
| 2971 | if (!icon.isNull()
| 0 | ||||||||||||||||||||||||
| 2972 | && icon.cacheKey() != QApplication::windowIcon().cacheKey()) {
| 0 | ||||||||||||||||||||||||
| 2973 | QSize sz = icon.actualSize(QSize(r.height(), r.height())); | - | ||||||||||||||||||||||||
| 2974 | if (verticalTitleBar)
| 0 | ||||||||||||||||||||||||
| 2975 | sz = sz.transposed(); never executed: sz = sz.transposed(); | 0 | ||||||||||||||||||||||||
| 2976 | iconRect = QRect(left, rect.center().y() - sz.height()/2, | - | ||||||||||||||||||||||||
| 2977 | sz.width(), sz.height()); | - | ||||||||||||||||||||||||
| 2978 | left = iconRect.right() + margin; | - | ||||||||||||||||||||||||
| 2979 | } never executed: end of block | 0 | ||||||||||||||||||||||||
| 2980 | } never executed: end of block | 0 | ||||||||||||||||||||||||
| 2981 | if (sr == SE_DockWidgetIcon) {
| 0 | ||||||||||||||||||||||||
| 2982 | r = iconRect; | - | ||||||||||||||||||||||||
| 2983 | break; never executed: break; | 0 | ||||||||||||||||||||||||
| 2984 | } | - | ||||||||||||||||||||||||
| 2985 | - | |||||||||||||||||||||||||
| 2986 | QRect textRect = QRect(left, rect.top(), | - | ||||||||||||||||||||||||
| 2987 | right - left, rect.height()); | - | ||||||||||||||||||||||||
| 2988 | if (sr == SE_DockWidgetTitleBarText) {
| 0 | ||||||||||||||||||||||||
| 2989 | r = textRect; | - | ||||||||||||||||||||||||
| 2990 | break; never executed: break; | 0 | ||||||||||||||||||||||||
| 2991 | } | - | ||||||||||||||||||||||||
| 2992 | - | |||||||||||||||||||||||||
| 2993 | } while (false); | - | ||||||||||||||||||||||||
| 2994 | - | |||||||||||||||||||||||||
| 2995 | if (verticalTitleBar) {
| 0 | ||||||||||||||||||||||||
| 2996 | r = QRect(rect.left() + r.top() - rect.top(), | - | ||||||||||||||||||||||||
| 2997 | rect.top() + rect.right() - r.right(), | - | ||||||||||||||||||||||||
| 2998 | r.height(), r.width()); | - | ||||||||||||||||||||||||
| 2999 | } else { never executed: end of block | 0 | ||||||||||||||||||||||||
| 3000 | r = visualRect(opt->direction, rect, r); | - | ||||||||||||||||||||||||
| 3001 | } never executed: end of block | 0 | ||||||||||||||||||||||||
| 3002 | break; never executed: break; | 0 | ||||||||||||||||||||||||
| 3003 | } | - | ||||||||||||||||||||||||
| 3004 | #endif | - | ||||||||||||||||||||||||
| 3005 | #ifndef QT_NO_ITEMVIEWS | - | ||||||||||||||||||||||||
| 3006 | case SE_ItemViewItemCheckIndicator: never executed: case SE_ItemViewItemCheckIndicator: | 0 | ||||||||||||||||||||||||
| 3007 | if (!qstyleoption_cast<const QStyleOptionViewItem *>(opt)) {
| 0 | ||||||||||||||||||||||||
| 3008 | r = subElementRect(SE_CheckBoxIndicator, opt, widget); | - | ||||||||||||||||||||||||
| 3009 | break; never executed: break; | 0 | ||||||||||||||||||||||||
| 3010 | } | - | ||||||||||||||||||||||||
| 3011 | case SE_ItemViewItemDecoration: code before this statement never executed: case SE_ItemViewItemDecoration:never executed: case SE_ItemViewItemDecoration: | 0 | ||||||||||||||||||||||||
| 3012 | case SE_ItemViewItemText: never executed: case SE_ItemViewItemText: | 0 | ||||||||||||||||||||||||
| 3013 | case SE_ItemViewItemFocusRect: never executed: case SE_ItemViewItemFocusRect: | 0 | ||||||||||||||||||||||||
| 3014 | if (const QStyleOptionViewItem *vopt = qstyleoption_cast<const QStyleOptionViewItem *>(opt)) {
| 0 | ||||||||||||||||||||||||
| 3015 | if (!d->isViewItemCached(*vopt)) {
| 0 | ||||||||||||||||||||||||
| 3016 | d->viewItemLayout(vopt, &d->checkRect, &d->decorationRect, &d->displayRect, false); | - | ||||||||||||||||||||||||
| 3017 | if (d->cachedOption) {
| 0 | ||||||||||||||||||||||||
| 3018 | delete d->cachedOption; | - | ||||||||||||||||||||||||
| 3019 | d->cachedOption = 0; | - | ||||||||||||||||||||||||
| 3020 | } never executed: end of block | 0 | ||||||||||||||||||||||||
| 3021 | d->cachedOption = new QStyleOptionViewItem(*vopt); | - | ||||||||||||||||||||||||
| 3022 | } never executed: end of block | 0 | ||||||||||||||||||||||||
| 3023 | if (sr == SE_ViewItemCheckIndicator)
| 0 | ||||||||||||||||||||||||
| 3024 | r = d->checkRect; never executed: r = d->checkRect; | 0 | ||||||||||||||||||||||||
| 3025 | else if (sr == SE_ItemViewItemDecoration)
| 0 | ||||||||||||||||||||||||
| 3026 | r = d->decorationRect; never executed: r = d->decorationRect; | 0 | ||||||||||||||||||||||||
| 3027 | else if (sr == SE_ItemViewItemText || sr == SE_ItemViewItemFocusRect)
| 0 | ||||||||||||||||||||||||
| 3028 | r = d->displayRect; never executed: r = d->displayRect; | 0 | ||||||||||||||||||||||||
| 3029 | } never executed: end of block | 0 | ||||||||||||||||||||||||
| 3030 | break; never executed: break; | 0 | ||||||||||||||||||||||||
| 3031 | #endif //QT_NO_ITEMVIEWS | - | ||||||||||||||||||||||||
| 3032 | #ifndef QT_NO_TOOLBAR | - | ||||||||||||||||||||||||
| 3033 | case SE_ToolBarHandle: never executed: case SE_ToolBarHandle: | 0 | ||||||||||||||||||||||||
| 3034 | if (const QStyleOptionToolBar *tbopt = qstyleoption_cast<const QStyleOptionToolBar *>(opt)) {
| 0 | ||||||||||||||||||||||||
| 3035 | if (tbopt->features & QStyleOptionToolBar::Movable) {
| 0 | ||||||||||||||||||||||||
| 3036 | ///we need to access the widget here because the style option doesn't | - | ||||||||||||||||||||||||
| 3037 | //have all the information we need (ie. the layout's margin) | - | ||||||||||||||||||||||||
| 3038 | const QToolBar *tb = qobject_cast<const QToolBar*>(widget); | - | ||||||||||||||||||||||||
| 3039 | const int margin = tb && tb->layout() ? tb->layout()->margin() : 2;
| 0 | ||||||||||||||||||||||||
| 3040 | const int handleExtent = pixelMetric(QStyle::PM_ToolBarHandleExtent, opt, tb); | - | ||||||||||||||||||||||||
| 3041 | if (tbopt->state & QStyle::State_Horizontal) {
| 0 | ||||||||||||||||||||||||
| 3042 | r = QRect(margin, margin, handleExtent, tbopt->rect.height() - 2*margin); | - | ||||||||||||||||||||||||
| 3043 | r = QStyle::visualRect(tbopt->direction, tbopt->rect, r); | - | ||||||||||||||||||||||||
| 3044 | } else { never executed: end of block | 0 | ||||||||||||||||||||||||
| 3045 | r = QRect(margin, margin, tbopt->rect.width() - 2*margin, handleExtent); | - | ||||||||||||||||||||||||
| 3046 | } never executed: end of block | 0 | ||||||||||||||||||||||||
| 3047 | } | - | ||||||||||||||||||||||||
| 3048 | } never executed: end of block | 0 | ||||||||||||||||||||||||
| 3049 | break; never executed: break; | 0 | ||||||||||||||||||||||||
| 3050 | #endif //QT_NO_TOOLBAR | - | ||||||||||||||||||||||||
| 3051 | default: never executed: default: | 0 | ||||||||||||||||||||||||
| 3052 | break; never executed: break; | 0 | ||||||||||||||||||||||||
| 3053 | } | - | ||||||||||||||||||||||||
| 3054 | return r; never executed: return r; | 0 | ||||||||||||||||||||||||
| 3055 | } | - | ||||||||||||||||||||||||
| 3056 | - | |||||||||||||||||||||||||
| 3057 | #ifndef QT_NO_DIAL | - | ||||||||||||||||||||||||
| 3058 | - | |||||||||||||||||||||||||
| 3059 | // in lieu of std::array, minimal API | - | ||||||||||||||||||||||||
| 3060 | template <int N> | - | ||||||||||||||||||||||||
| 3061 | struct StaticPolygonF | - | ||||||||||||||||||||||||
| 3062 | { | - | ||||||||||||||||||||||||
| 3063 | QPointF data[N]; | - | ||||||||||||||||||||||||
| 3064 | - | |||||||||||||||||||||||||
| 3065 | Q_DECL_CONSTEXPR int size() const { return N; } | - | ||||||||||||||||||||||||
| 3066 | Q_DECL_CONSTEXPR const QPointF *cbegin() const { return data; } | - | ||||||||||||||||||||||||
| 3067 | Q_DECL_CONSTEXPR const QPointF &operator[](int idx) const { return data[idx]; } | - | ||||||||||||||||||||||||
| 3068 | }; | - | ||||||||||||||||||||||||
| 3069 | - | |||||||||||||||||||||||||
| 3070 | static StaticPolygonF<3> calcArrow(const QStyleOptionSlider *dial, qreal &a) | - | ||||||||||||||||||||||||
| 3071 | { | - | ||||||||||||||||||||||||
| 3072 | int width = dial->rect.width(); | - | ||||||||||||||||||||||||
| 3073 | int height = dial->rect.height(); | - | ||||||||||||||||||||||||
| 3074 | int r = qMin(width, height) / 2; | - | ||||||||||||||||||||||||
| 3075 | int currentSliderPosition = dial->upsideDown ? dial->sliderPosition : (dial->maximum - dial->sliderPosition); | - | ||||||||||||||||||||||||
| 3076 | - | |||||||||||||||||||||||||
| 3077 | if (dial->maximum == dial->minimum) | - | ||||||||||||||||||||||||
| 3078 | a = Q_PI / 2; | - | ||||||||||||||||||||||||
| 3079 | else if (dial->dialWrapping) | - | ||||||||||||||||||||||||
| 3080 | a = Q_PI * 3 / 2 - (currentSliderPosition - dial->minimum) * 2 * Q_PI | - | ||||||||||||||||||||||||
| 3081 | / (dial->maximum - dial->minimum); | - | ||||||||||||||||||||||||
| 3082 | else | - | ||||||||||||||||||||||||
| 3083 | a = (Q_PI * 8 - (currentSliderPosition - dial->minimum) * 10 * Q_PI | - | ||||||||||||||||||||||||
| 3084 | / (dial->maximum - dial->minimum)) / 6; | - | ||||||||||||||||||||||||
| 3085 | - | |||||||||||||||||||||||||
| 3086 | int xc = width / 2; | - | ||||||||||||||||||||||||
| 3087 | int yc = height / 2; | - | ||||||||||||||||||||||||
| 3088 | - | |||||||||||||||||||||||||
| 3089 | int len = r - QStyleHelper::calcBigLineSize(r) - 5; | - | ||||||||||||||||||||||||
| 3090 | if (len < 5) | - | ||||||||||||||||||||||||
| 3091 | len = 5; | - | ||||||||||||||||||||||||
| 3092 | int back = len / 2; | - | ||||||||||||||||||||||||
| 3093 | - | |||||||||||||||||||||||||
| 3094 | StaticPolygonF<3> arrow = {{ | - | ||||||||||||||||||||||||
| 3095 | QPointF(0.5 + xc + len * qCos(a), | - | ||||||||||||||||||||||||
| 3096 | 0.5 + yc - len * qSin(a)), | - | ||||||||||||||||||||||||
| 3097 | QPointF(0.5 + xc + back * qCos(a + Q_PI * 5 / 6), | - | ||||||||||||||||||||||||
| 3098 | 0.5 + yc - back * qSin(a + Q_PI * 5 / 6)), | - | ||||||||||||||||||||||||
| 3099 | QPointF(0.5 + xc + back * qCos(a - Q_PI * 5 / 6), | - | ||||||||||||||||||||||||
| 3100 | 0.5 + yc - back * qSin(a - Q_PI * 5 / 6)), | - | ||||||||||||||||||||||||
| 3101 | }}; | - | ||||||||||||||||||||||||
| 3102 | return arrow; | - | ||||||||||||||||||||||||
| 3103 | } | - | ||||||||||||||||||||||||
| 3104 | - | |||||||||||||||||||||||||
| 3105 | #endif // QT_NO_DIAL | - | ||||||||||||||||||||||||
| 3106 | - | |||||||||||||||||||||||||
| 3107 | /*! | - | ||||||||||||||||||||||||
| 3108 | \reimp | - | ||||||||||||||||||||||||
| 3109 | */ | - | ||||||||||||||||||||||||
| 3110 | void QCommonStyle::drawComplexControl(ComplexControl cc, const QStyleOptionComplex *opt, | - | ||||||||||||||||||||||||
| 3111 | QPainter *p, const QWidget *widget) const | - | ||||||||||||||||||||||||
| 3112 | { | - | ||||||||||||||||||||||||
| 3113 | switch (cc) { | - | ||||||||||||||||||||||||
| 3114 | #ifndef QT_NO_SLIDER | - | ||||||||||||||||||||||||
| 3115 | case CC_Slider: | - | ||||||||||||||||||||||||
| 3116 | if (const QStyleOptionSlider *slider = qstyleoption_cast<const QStyleOptionSlider *>(opt)) { | - | ||||||||||||||||||||||||
| 3117 | if (slider->subControls == SC_SliderTickmarks) { | - | ||||||||||||||||||||||||
| 3118 | int tickOffset = proxy()->pixelMetric(PM_SliderTickmarkOffset, slider, widget); | - | ||||||||||||||||||||||||
| 3119 | int ticks = slider->tickPosition; | - | ||||||||||||||||||||||||
| 3120 | int thickness = proxy()->pixelMetric(PM_SliderControlThickness, slider, widget); | - | ||||||||||||||||||||||||
| 3121 | int len = proxy()->pixelMetric(PM_SliderLength, slider, widget); | - | ||||||||||||||||||||||||
| 3122 | int available = proxy()->pixelMetric(PM_SliderSpaceAvailable, slider, widget); | - | ||||||||||||||||||||||||
| 3123 | int interval = slider->tickInterval; | - | ||||||||||||||||||||||||
| 3124 | if (interval <= 0) { | - | ||||||||||||||||||||||||
| 3125 | interval = slider->singleStep; | - | ||||||||||||||||||||||||
| 3126 | if (QStyle::sliderPositionFromValue(slider->minimum, slider->maximum, interval, | - | ||||||||||||||||||||||||
| 3127 | available) | - | ||||||||||||||||||||||||
| 3128 | - QStyle::sliderPositionFromValue(slider->minimum, slider->maximum, | - | ||||||||||||||||||||||||
| 3129 | 0, available) < 3) | - | ||||||||||||||||||||||||
| 3130 | interval = slider->pageStep; | - | ||||||||||||||||||||||||
| 3131 | } | - | ||||||||||||||||||||||||
| 3132 | if (!interval) | - | ||||||||||||||||||||||||
| 3133 | interval = 1; | - | ||||||||||||||||||||||||
| 3134 | int fudge = len / 2; | - | ||||||||||||||||||||||||
| 3135 | int pos; | - | ||||||||||||||||||||||||
| 3136 | // Since there is no subrect for tickmarks do a translation here. | - | ||||||||||||||||||||||||
| 3137 | p->save(); | - | ||||||||||||||||||||||||
| 3138 | p->translate(slider->rect.x(), slider->rect.y()); | - | ||||||||||||||||||||||||
| 3139 | p->setPen(slider->palette.foreground().color()); | - | ||||||||||||||||||||||||
| 3140 | int v = slider->minimum; | - | ||||||||||||||||||||||||
| 3141 | while (v <= slider->maximum + 1) { | - | ||||||||||||||||||||||||
| 3142 | if (v == slider->maximum + 1 && interval == 1) | - | ||||||||||||||||||||||||
| 3143 | break; | - | ||||||||||||||||||||||||
| 3144 | const int v_ = qMin(v, slider->maximum); | - | ||||||||||||||||||||||||
| 3145 | pos = QStyle::sliderPositionFromValue(slider->minimum, slider->maximum, | - | ||||||||||||||||||||||||
| 3146 | v_, available) + fudge; | - | ||||||||||||||||||||||||
| 3147 | if (slider->orientation == Qt::Horizontal) { | - | ||||||||||||||||||||||||
| 3148 | if (ticks & QSlider::TicksAbove) | - | ||||||||||||||||||||||||
| 3149 | p->drawLine(pos, 0, pos, tickOffset - 2); | - | ||||||||||||||||||||||||
| 3150 | if (ticks & QSlider::TicksBelow) | - | ||||||||||||||||||||||||
| 3151 | p->drawLine(pos, tickOffset + thickness + 1, pos, | - | ||||||||||||||||||||||||
| 3152 | slider->rect.height()-1); | - | ||||||||||||||||||||||||
| 3153 | } else { | - | ||||||||||||||||||||||||
| 3154 | if (ticks & QSlider::TicksAbove) | - | ||||||||||||||||||||||||
| 3155 | p->drawLine(0, pos, tickOffset - 2, pos); | - | ||||||||||||||||||||||||
| 3156 | if (ticks & QSlider::TicksBelow) | - | ||||||||||||||||||||||||
| 3157 | p->drawLine(tickOffset + thickness + 1, pos, | - | ||||||||||||||||||||||||
| 3158 | slider->rect.width()-1, pos); | - | ||||||||||||||||||||||||
| 3159 | } | - | ||||||||||||||||||||||||
| 3160 | // in the case where maximum is max int | - | ||||||||||||||||||||||||
| 3161 | int nextInterval = v + interval; | - | ||||||||||||||||||||||||
| 3162 | if (nextInterval < v) | - | ||||||||||||||||||||||||
| 3163 | break; | - | ||||||||||||||||||||||||
| 3164 | v = nextInterval; | - | ||||||||||||||||||||||||
| 3165 | } | - | ||||||||||||||||||||||||
| 3166 | p->restore(); | - | ||||||||||||||||||||||||
| 3167 | } | - | ||||||||||||||||||||||||
| 3168 | } | - | ||||||||||||||||||||||||
| 3169 | break; | - | ||||||||||||||||||||||||
| 3170 | #endif // QT_NO_SLIDER | - | ||||||||||||||||||||||||
| 3171 | #ifndef QT_NO_SCROLLBAR | - | ||||||||||||||||||||||||
| 3172 | case CC_ScrollBar: | - | ||||||||||||||||||||||||
| 3173 | if (const QStyleOptionSlider *scrollbar = qstyleoption_cast<const QStyleOptionSlider *>(opt)) { | - | ||||||||||||||||||||||||
| 3174 | // Make a copy here and reset it for each primitive. | - | ||||||||||||||||||||||||
| 3175 | QStyleOptionSlider newScrollbar = *scrollbar; | - | ||||||||||||||||||||||||
| 3176 | State saveFlags = scrollbar->state; | - | ||||||||||||||||||||||||
| 3177 | - | |||||||||||||||||||||||||
| 3178 | if (scrollbar->subControls & SC_ScrollBarSubLine) { | - | ||||||||||||||||||||||||
| 3179 | newScrollbar.state = saveFlags; | - | ||||||||||||||||||||||||
| 3180 | newScrollbar.rect = proxy()->subControlRect(cc, &newScrollbar, SC_ScrollBarSubLine, widget); | - | ||||||||||||||||||||||||
| 3181 | if (newScrollbar.rect.isValid()) { | - | ||||||||||||||||||||||||
| 3182 | if (!(scrollbar->activeSubControls & SC_ScrollBarSubLine)) | - | ||||||||||||||||||||||||
| 3183 | newScrollbar.state &= ~(State_Sunken | State_MouseOver); | - | ||||||||||||||||||||||||
| 3184 | proxy()->drawControl(CE_ScrollBarSubLine, &newScrollbar, p, widget); | - | ||||||||||||||||||||||||
| 3185 | } | - | ||||||||||||||||||||||||
| 3186 | } | - | ||||||||||||||||||||||||
| 3187 | if (scrollbar->subControls & SC_ScrollBarAddLine) { | - | ||||||||||||||||||||||||
| 3188 | newScrollbar.rect = scrollbar->rect; | - | ||||||||||||||||||||||||
| 3189 | newScrollbar.state = saveFlags; | - | ||||||||||||||||||||||||
| 3190 | newScrollbar.rect = proxy()->subControlRect(cc, &newScrollbar, SC_ScrollBarAddLine, widget); | - | ||||||||||||||||||||||||
| 3191 | if (newScrollbar.rect.isValid()) { | - | ||||||||||||||||||||||||
| 3192 | if (!(scrollbar->activeSubControls & SC_ScrollBarAddLine)) | - | ||||||||||||||||||||||||
| 3193 | newScrollbar.state &= ~(State_Sunken | State_MouseOver); | - | ||||||||||||||||||||||||
| 3194 | proxy()->drawControl(CE_ScrollBarAddLine, &newScrollbar, p, widget); | - | ||||||||||||||||||||||||
| 3195 | } | - | ||||||||||||||||||||||||
| 3196 | } | - | ||||||||||||||||||||||||
| 3197 | if (scrollbar->subControls & SC_ScrollBarSubPage) { | - | ||||||||||||||||||||||||
| 3198 | newScrollbar.rect = scrollbar->rect; | - | ||||||||||||||||||||||||
| 3199 | newScrollbar.state = saveFlags; | - | ||||||||||||||||||||||||
| 3200 | newScrollbar.rect = proxy()->subControlRect(cc, &newScrollbar, SC_ScrollBarSubPage, widget); | - | ||||||||||||||||||||||||
| 3201 | if (newScrollbar.rect.isValid()) { | - | ||||||||||||||||||||||||
| 3202 | if (!(scrollbar->activeSubControls & SC_ScrollBarSubPage)) | - | ||||||||||||||||||||||||
| 3203 | newScrollbar.state &= ~(State_Sunken | State_MouseOver); | - | ||||||||||||||||||||||||
| 3204 | proxy()->drawControl(CE_ScrollBarSubPage, &newScrollbar, p, widget); | - | ||||||||||||||||||||||||
| 3205 | } | - | ||||||||||||||||||||||||
| 3206 | } | - | ||||||||||||||||||||||||
| 3207 | if (scrollbar->subControls & SC_ScrollBarAddPage) { | - | ||||||||||||||||||||||||
| 3208 | newScrollbar.rect = scrollbar->rect; | - | ||||||||||||||||||||||||
| 3209 | newScrollbar.state = saveFlags; | - | ||||||||||||||||||||||||
| 3210 | newScrollbar.rect = proxy()->subControlRect(cc, &newScrollbar, SC_ScrollBarAddPage, widget); | - | ||||||||||||||||||||||||
| 3211 | if (newScrollbar.rect.isValid()) { | - | ||||||||||||||||||||||||
| 3212 | if (!(scrollbar->activeSubControls & SC_ScrollBarAddPage)) | - | ||||||||||||||||||||||||
| 3213 | newScrollbar.state &= ~(State_Sunken | State_MouseOver); | - | ||||||||||||||||||||||||
| 3214 | proxy()->drawControl(CE_ScrollBarAddPage, &newScrollbar, p, widget); | - | ||||||||||||||||||||||||
| 3215 | } | - | ||||||||||||||||||||||||
| 3216 | } | - | ||||||||||||||||||||||||
| 3217 | if (scrollbar->subControls & SC_ScrollBarFirst) { | - | ||||||||||||||||||||||||
| 3218 | newScrollbar.rect = scrollbar->rect; | - | ||||||||||||||||||||||||
| 3219 | newScrollbar.state = saveFlags; | - | ||||||||||||||||||||||||
| 3220 | newScrollbar.rect = proxy()->subControlRect(cc, &newScrollbar, SC_ScrollBarFirst, widget); | - | ||||||||||||||||||||||||
| 3221 | if (newScrollbar.rect.isValid()) { | - | ||||||||||||||||||||||||
| 3222 | if (!(scrollbar->activeSubControls & SC_ScrollBarFirst)) | - | ||||||||||||||||||||||||
| 3223 | newScrollbar.state &= ~(State_Sunken | State_MouseOver); | - | ||||||||||||||||||||||||
| 3224 | proxy()->drawControl(CE_ScrollBarFirst, &newScrollbar, p, widget); | - | ||||||||||||||||||||||||
| 3225 | } | - | ||||||||||||||||||||||||
| 3226 | } | - | ||||||||||||||||||||||||
| 3227 | if (scrollbar->subControls & SC_ScrollBarLast) { | - | ||||||||||||||||||||||||
| 3228 | newScrollbar.rect = scrollbar->rect; | - | ||||||||||||||||||||||||
| 3229 | newScrollbar.state = saveFlags; | - | ||||||||||||||||||||||||
| 3230 | newScrollbar.rect = proxy()->subControlRect(cc, &newScrollbar, SC_ScrollBarLast, widget); | - | ||||||||||||||||||||||||
| 3231 | if (newScrollbar.rect.isValid()) { | - | ||||||||||||||||||||||||
| 3232 | if (!(scrollbar->activeSubControls & SC_ScrollBarLast)) | - | ||||||||||||||||||||||||
| 3233 | newScrollbar.state &= ~(State_Sunken | State_MouseOver); | - | ||||||||||||||||||||||||
| 3234 | proxy()->drawControl(CE_ScrollBarLast, &newScrollbar, p, widget); | - | ||||||||||||||||||||||||
| 3235 | } | - | ||||||||||||||||||||||||
| 3236 | } | - | ||||||||||||||||||||||||
| 3237 | if (scrollbar->subControls & SC_ScrollBarSlider) { | - | ||||||||||||||||||||||||
| 3238 | newScrollbar.rect = scrollbar->rect; | - | ||||||||||||||||||||||||
| 3239 | newScrollbar.state = saveFlags; | - | ||||||||||||||||||||||||
| 3240 | newScrollbar.rect = proxy()->subControlRect(cc, &newScrollbar, SC_ScrollBarSlider, widget); | - | ||||||||||||||||||||||||
| 3241 | if (newScrollbar.rect.isValid()) { | - | ||||||||||||||||||||||||
| 3242 | if (!(scrollbar->activeSubControls & SC_ScrollBarSlider)) | - | ||||||||||||||||||||||||
| 3243 | newScrollbar.state &= ~(State_Sunken | State_MouseOver); | - | ||||||||||||||||||||||||
| 3244 | proxy()->drawControl(CE_ScrollBarSlider, &newScrollbar, p, widget); | - | ||||||||||||||||||||||||
| 3245 | - | |||||||||||||||||||||||||
| 3246 | if (scrollbar->state & State_HasFocus) { | - | ||||||||||||||||||||||||
| 3247 | QStyleOptionFocusRect fropt; | - | ||||||||||||||||||||||||
| 3248 | fropt.QStyleOption::operator=(newScrollbar); | - | ||||||||||||||||||||||||
| 3249 | fropt.rect.setRect(newScrollbar.rect.x() + 2, newScrollbar.rect.y() + 2, | - | ||||||||||||||||||||||||
| 3250 | newScrollbar.rect.width() - 5, | - | ||||||||||||||||||||||||
| 3251 | newScrollbar.rect.height() - 5); | - | ||||||||||||||||||||||||
| 3252 | proxy()->drawPrimitive(PE_FrameFocusRect, &fropt, p, widget); | - | ||||||||||||||||||||||||
| 3253 | } | - | ||||||||||||||||||||||||
| 3254 | } | - | ||||||||||||||||||||||||
| 3255 | } | - | ||||||||||||||||||||||||
| 3256 | } | - | ||||||||||||||||||||||||
| 3257 | break; | - | ||||||||||||||||||||||||
| 3258 | #endif // QT_NO_SCROLLBAR | - | ||||||||||||||||||||||||
| 3259 | #ifndef QT_NO_SPINBOX | - | ||||||||||||||||||||||||
| 3260 | case CC_SpinBox: | - | ||||||||||||||||||||||||
| 3261 | if (const QStyleOptionSpinBox *sb = qstyleoption_cast<const QStyleOptionSpinBox *>(opt)) { | - | ||||||||||||||||||||||||
| 3262 | QStyleOptionSpinBox copy = *sb; | - | ||||||||||||||||||||||||
| 3263 | PrimitiveElement pe; | - | ||||||||||||||||||||||||
| 3264 | - | |||||||||||||||||||||||||
| 3265 | if (sb->frame && (sb->subControls & SC_SpinBoxFrame)) { | - | ||||||||||||||||||||||||
| 3266 | QRect r = proxy()->subControlRect(CC_SpinBox, sb, SC_SpinBoxFrame, widget); | - | ||||||||||||||||||||||||
| 3267 | qDrawWinPanel(p, r, sb->palette, true); | - | ||||||||||||||||||||||||
| 3268 | } | - | ||||||||||||||||||||||||
| 3269 | - | |||||||||||||||||||||||||
| 3270 | if (sb->subControls & SC_SpinBoxUp) { | - | ||||||||||||||||||||||||
| 3271 | copy.subControls = SC_SpinBoxUp; | - | ||||||||||||||||||||||||
| 3272 | QPalette pal2 = sb->palette; | - | ||||||||||||||||||||||||
| 3273 | if (!(sb->stepEnabled & QAbstractSpinBox::StepUpEnabled)) { | - | ||||||||||||||||||||||||
| 3274 | pal2.setCurrentColorGroup(QPalette::Disabled); | - | ||||||||||||||||||||||||
| 3275 | copy.state &= ~State_Enabled; | - | ||||||||||||||||||||||||
| 3276 | } | - | ||||||||||||||||||||||||
| 3277 | - | |||||||||||||||||||||||||
| 3278 | copy.palette = pal2; | - | ||||||||||||||||||||||||
| 3279 | - | |||||||||||||||||||||||||
| 3280 | if (sb->activeSubControls == SC_SpinBoxUp && (sb->state & State_Sunken)) { | - | ||||||||||||||||||||||||
| 3281 | copy.state |= State_On; | - | ||||||||||||||||||||||||
| 3282 | copy.state |= State_Sunken; | - | ||||||||||||||||||||||||
| 3283 | } else { | - | ||||||||||||||||||||||||
| 3284 | copy.state |= State_Raised; | - | ||||||||||||||||||||||||
| 3285 | copy.state &= ~State_Sunken; | - | ||||||||||||||||||||||||
| 3286 | } | - | ||||||||||||||||||||||||
| 3287 | pe = (sb->buttonSymbols == QAbstractSpinBox::PlusMinus ? PE_IndicatorSpinPlus | - | ||||||||||||||||||||||||
| 3288 | : PE_IndicatorSpinUp); | - | ||||||||||||||||||||||||
| 3289 | - | |||||||||||||||||||||||||
| 3290 | copy.rect = proxy()->subControlRect(CC_SpinBox, sb, SC_SpinBoxUp, widget); | - | ||||||||||||||||||||||||
| 3291 | proxy()->drawPrimitive(PE_PanelButtonBevel, ©, p, widget); | - | ||||||||||||||||||||||||
| 3292 | copy.rect.adjust(3, 0, -4, 0); | - | ||||||||||||||||||||||||
| 3293 | proxy()->drawPrimitive(pe, ©, p, widget); | - | ||||||||||||||||||||||||
| 3294 | } | - | ||||||||||||||||||||||||
| 3295 | - | |||||||||||||||||||||||||
| 3296 | if (sb->subControls & SC_SpinBoxDown) { | - | ||||||||||||||||||||||||
| 3297 | copy.subControls = SC_SpinBoxDown; | - | ||||||||||||||||||||||||
| 3298 | copy.state = sb->state; | - | ||||||||||||||||||||||||
| 3299 | QPalette pal2 = sb->palette; | - | ||||||||||||||||||||||||
| 3300 | if (!(sb->stepEnabled & QAbstractSpinBox::StepDownEnabled)) { | - | ||||||||||||||||||||||||
| 3301 | pal2.setCurrentColorGroup(QPalette::Disabled); | - | ||||||||||||||||||||||||
| 3302 | copy.state &= ~State_Enabled; | - | ||||||||||||||||||||||||
| 3303 | } | - | ||||||||||||||||||||||||
| 3304 | copy.palette = pal2; | - | ||||||||||||||||||||||||
| 3305 | - | |||||||||||||||||||||||||
| 3306 | if (sb->activeSubControls == SC_SpinBoxDown && (sb->state & State_Sunken)) { | - | ||||||||||||||||||||||||
| 3307 | copy.state |= State_On; | - | ||||||||||||||||||||||||
| 3308 | copy.state |= State_Sunken; | - | ||||||||||||||||||||||||
| 3309 | } else { | - | ||||||||||||||||||||||||
| 3310 | copy.state |= State_Raised; | - | ||||||||||||||||||||||||
| 3311 | copy.state &= ~State_Sunken; | - | ||||||||||||||||||||||||
| 3312 | } | - | ||||||||||||||||||||||||
| 3313 | pe = (sb->buttonSymbols == QAbstractSpinBox::PlusMinus ? PE_IndicatorSpinMinus | - | ||||||||||||||||||||||||
| 3314 | : PE_IndicatorSpinDown); | - | ||||||||||||||||||||||||
| 3315 | - | |||||||||||||||||||||||||
| 3316 | copy.rect = proxy()->subControlRect(CC_SpinBox, sb, SC_SpinBoxDown, widget); | - | ||||||||||||||||||||||||
| 3317 | proxy()->drawPrimitive(PE_PanelButtonBevel, ©, p, widget); | - | ||||||||||||||||||||||||
| 3318 | copy.rect.adjust(3, 0, -4, 0); | - | ||||||||||||||||||||||||
| 3319 | proxy()->drawPrimitive(pe, ©, p, widget); | - | ||||||||||||||||||||||||
| 3320 | } | - | ||||||||||||||||||||||||
| 3321 | } | - | ||||||||||||||||||||||||
| 3322 | break; | - | ||||||||||||||||||||||||
| 3323 | #endif // QT_NO_SPINBOX | - | ||||||||||||||||||||||||
| 3324 | #ifndef QT_NO_TOOLBUTTON | - | ||||||||||||||||||||||||
| 3325 | case CC_ToolButton: | - | ||||||||||||||||||||||||
| 3326 | if (const QStyleOptionToolButton *toolbutton | - | ||||||||||||||||||||||||
| 3327 | = qstyleoption_cast<const QStyleOptionToolButton *>(opt)) { | - | ||||||||||||||||||||||||
| 3328 | QRect button, menuarea; | - | ||||||||||||||||||||||||
| 3329 | button = proxy()->subControlRect(cc, toolbutton, SC_ToolButton, widget); | - | ||||||||||||||||||||||||
| 3330 | menuarea = proxy()->subControlRect(cc, toolbutton, SC_ToolButtonMenu, widget); | - | ||||||||||||||||||||||||
| 3331 | - | |||||||||||||||||||||||||
| 3332 | State bflags = toolbutton->state & ~State_Sunken; | - | ||||||||||||||||||||||||
| 3333 | - | |||||||||||||||||||||||||
| 3334 | if (bflags & State_AutoRaise) { | - | ||||||||||||||||||||||||
| 3335 | if (!(bflags & State_MouseOver) || !(bflags & State_Enabled)) { | - | ||||||||||||||||||||||||
| 3336 | bflags &= ~State_Raised; | - | ||||||||||||||||||||||||
| 3337 | } | - | ||||||||||||||||||||||||
| 3338 | } | - | ||||||||||||||||||||||||
| 3339 | State mflags = bflags; | - | ||||||||||||||||||||||||
| 3340 | if (toolbutton->state & State_Sunken) { | - | ||||||||||||||||||||||||
| 3341 | if (toolbutton->activeSubControls & SC_ToolButton) | - | ||||||||||||||||||||||||
| 3342 | bflags |= State_Sunken; | - | ||||||||||||||||||||||||
| 3343 | mflags |= State_Sunken; | - | ||||||||||||||||||||||||
| 3344 | } | - | ||||||||||||||||||||||||
| 3345 | - | |||||||||||||||||||||||||
| 3346 | QStyleOption tool = *toolbutton; | - | ||||||||||||||||||||||||
| 3347 | if (toolbutton->subControls & SC_ToolButton) { | - | ||||||||||||||||||||||||
| 3348 | if (bflags & (State_Sunken | State_On | State_Raised)) { | - | ||||||||||||||||||||||||
| 3349 | tool.rect = button; | - | ||||||||||||||||||||||||
| 3350 | tool.state = bflags; | - | ||||||||||||||||||||||||
| 3351 | proxy()->drawPrimitive(PE_PanelButtonTool, &tool, p, widget); | - | ||||||||||||||||||||||||
| 3352 | } | - | ||||||||||||||||||||||||
| 3353 | } | - | ||||||||||||||||||||||||
| 3354 | - | |||||||||||||||||||||||||
| 3355 | if (toolbutton->state & State_HasFocus) { | - | ||||||||||||||||||||||||
| 3356 | QStyleOptionFocusRect fr; | - | ||||||||||||||||||||||||
| 3357 | fr.QStyleOption::operator=(*toolbutton); | - | ||||||||||||||||||||||||
| 3358 | fr.rect.adjust(3, 3, -3, -3); | - | ||||||||||||||||||||||||
| 3359 | if (toolbutton->features & QStyleOptionToolButton::MenuButtonPopup) | - | ||||||||||||||||||||||||
| 3360 | fr.rect.adjust(0, 0, -proxy()->pixelMetric(QStyle::PM_MenuButtonIndicator, | - | ||||||||||||||||||||||||
| 3361 | toolbutton, widget), 0); | - | ||||||||||||||||||||||||
| 3362 | proxy()->drawPrimitive(PE_FrameFocusRect, &fr, p, widget); | - | ||||||||||||||||||||||||
| 3363 | } | - | ||||||||||||||||||||||||
| 3364 | QStyleOptionToolButton label = *toolbutton; | - | ||||||||||||||||||||||||
| 3365 | label.state = bflags; | - | ||||||||||||||||||||||||
| 3366 | int fw = proxy()->pixelMetric(PM_DefaultFrameWidth, opt, widget); | - | ||||||||||||||||||||||||
| 3367 | label.rect = button.adjusted(fw, fw, -fw, -fw); | - | ||||||||||||||||||||||||
| 3368 | proxy()->drawControl(CE_ToolButtonLabel, &label, p, widget); | - | ||||||||||||||||||||||||
| 3369 | - | |||||||||||||||||||||||||
| 3370 | if (toolbutton->subControls & SC_ToolButtonMenu) { | - | ||||||||||||||||||||||||
| 3371 | tool.rect = menuarea; | - | ||||||||||||||||||||||||
| 3372 | tool.state = mflags; | - | ||||||||||||||||||||||||
| 3373 | if (mflags & (State_Sunken | State_On | State_Raised)) | - | ||||||||||||||||||||||||
| 3374 | proxy()->drawPrimitive(PE_IndicatorButtonDropDown, &tool, p, widget); | - | ||||||||||||||||||||||||
| 3375 | proxy()->drawPrimitive(PE_IndicatorArrowDown, &tool, p, widget); | - | ||||||||||||||||||||||||
| 3376 | } else if (toolbutton->features & QStyleOptionToolButton::HasMenu) { | - | ||||||||||||||||||||||||
| 3377 | int mbi = proxy()->pixelMetric(PM_MenuButtonIndicator, toolbutton, widget); | - | ||||||||||||||||||||||||
| 3378 | QRect ir = toolbutton->rect; | - | ||||||||||||||||||||||||
| 3379 | QStyleOptionToolButton newBtn = *toolbutton; | - | ||||||||||||||||||||||||
| 3380 | newBtn.rect = QRect(ir.right() + 5 - mbi, ir.y() + ir.height() - mbi + 4, mbi - 6, mbi - 6); | - | ||||||||||||||||||||||||
| 3381 | proxy()->drawPrimitive(PE_IndicatorArrowDown, &newBtn, p, widget); | - | ||||||||||||||||||||||||
| 3382 | } | - | ||||||||||||||||||||||||
| 3383 | } | - | ||||||||||||||||||||||||
| 3384 | break; | - | ||||||||||||||||||||||||
| 3385 | #endif // QT_NO_TOOLBUTTON | - | ||||||||||||||||||||||||
| 3386 | case CC_TitleBar: | - | ||||||||||||||||||||||||
| 3387 | if (const QStyleOptionTitleBar *tb = qstyleoption_cast<const QStyleOptionTitleBar *>(opt)) { | - | ||||||||||||||||||||||||
| 3388 | QRect ir; | - | ||||||||||||||||||||||||
| 3389 | if (opt->subControls & SC_TitleBarLabel) { | - | ||||||||||||||||||||||||
| 3390 | QColor left = tb->palette.highlight().color(); | - | ||||||||||||||||||||||||
| 3391 | QColor right = tb->palette.base().color(); | - | ||||||||||||||||||||||||
| 3392 | - | |||||||||||||||||||||||||
| 3393 | QBrush fillBrush(left); | - | ||||||||||||||||||||||||
| 3394 | if (left != right) { | - | ||||||||||||||||||||||||
| 3395 | QPoint p1(tb->rect.x(), tb->rect.top() + tb->rect.height()/2); | - | ||||||||||||||||||||||||
| 3396 | QPoint p2(tb->rect.right(), tb->rect.top() + tb->rect.height()/2); | - | ||||||||||||||||||||||||
| 3397 | QLinearGradient lg(p1, p2); | - | ||||||||||||||||||||||||
| 3398 | lg.setColorAt(0, left); | - | ||||||||||||||||||||||||
| 3399 | lg.setColorAt(1, right); | - | ||||||||||||||||||||||||
| 3400 | fillBrush = lg; | - | ||||||||||||||||||||||||
| 3401 | } | - | ||||||||||||||||||||||||
| 3402 | - | |||||||||||||||||||||||||
| 3403 | p->fillRect(opt->rect, fillBrush); | - | ||||||||||||||||||||||||
| 3404 | - | |||||||||||||||||||||||||
| 3405 | ir = proxy()->subControlRect(CC_TitleBar, tb, SC_TitleBarLabel, widget); | - | ||||||||||||||||||||||||
| 3406 | - | |||||||||||||||||||||||||
| 3407 | p->setPen(tb->palette.highlightedText().color()); | - | ||||||||||||||||||||||||
| 3408 | p->drawText(ir.x() + 2, ir.y(), ir.width() - 2, ir.height(), | - | ||||||||||||||||||||||||
| 3409 | Qt::AlignLeft | Qt::AlignVCenter | Qt::TextSingleLine, tb->text); | - | ||||||||||||||||||||||||
| 3410 | } | - | ||||||||||||||||||||||||
| 3411 | - | |||||||||||||||||||||||||
| 3412 | bool down = false; | - | ||||||||||||||||||||||||
| 3413 | QPixmap pm; | - | ||||||||||||||||||||||||
| 3414 | - | |||||||||||||||||||||||||
| 3415 | QStyleOption tool = *tb; | - | ||||||||||||||||||||||||
| 3416 | if (tb->subControls & SC_TitleBarCloseButton && tb->titleBarFlags & Qt::WindowSystemMenuHint) { | - | ||||||||||||||||||||||||
| 3417 | ir = proxy()->subControlRect(CC_TitleBar, tb, SC_TitleBarCloseButton, widget); | - | ||||||||||||||||||||||||
| 3418 | down = tb->activeSubControls & SC_TitleBarCloseButton && (opt->state & State_Sunken); | - | ||||||||||||||||||||||||
| 3419 | if ((tb->titleBarFlags & Qt::WindowType_Mask) == Qt::Tool | - | ||||||||||||||||||||||||
| 3420 | #ifndef QT_NO_DOCKWIDGET | - | ||||||||||||||||||||||||
| 3421 | || qobject_cast<const QDockWidget *>(widget) | - | ||||||||||||||||||||||||
| 3422 | #endif | - | ||||||||||||||||||||||||
| 3423 | ) | - | ||||||||||||||||||||||||
| 3424 | pm = proxy()->standardIcon(SP_DockWidgetCloseButton, &tool, widget).pixmap(qt_getWindow(widget), QSize(10, 10)); | - | ||||||||||||||||||||||||
| 3425 | else | - | ||||||||||||||||||||||||
| 3426 | pm = proxy()->standardIcon(SP_TitleBarCloseButton, &tool, widget).pixmap(qt_getWindow(widget), QSize(10, 10)); | - | ||||||||||||||||||||||||
| 3427 | tool.rect = ir; | - | ||||||||||||||||||||||||
| 3428 | tool.state = down ? State_Sunken : State_Raised; | - | ||||||||||||||||||||||||
| 3429 | proxy()->drawPrimitive(PE_PanelButtonTool, &tool, p, widget); | - | ||||||||||||||||||||||||
| 3430 | - | |||||||||||||||||||||||||
| 3431 | p->save(); | - | ||||||||||||||||||||||||
| 3432 | if (down) | - | ||||||||||||||||||||||||
| 3433 | p->translate(proxy()->pixelMetric(PM_ButtonShiftHorizontal, tb, widget), | - | ||||||||||||||||||||||||
| 3434 | proxy()->pixelMetric(PM_ButtonShiftVertical, tb, widget)); | - | ||||||||||||||||||||||||
| 3435 | proxy()->drawItemPixmap(p, ir, Qt::AlignCenter, pm); | - | ||||||||||||||||||||||||
| 3436 | p->restore(); | - | ||||||||||||||||||||||||
| 3437 | } | - | ||||||||||||||||||||||||
| 3438 | - | |||||||||||||||||||||||||
| 3439 | if (tb->subControls & SC_TitleBarMaxButton | - | ||||||||||||||||||||||||
| 3440 | && tb->titleBarFlags & Qt::WindowMaximizeButtonHint | - | ||||||||||||||||||||||||
| 3441 | && !(tb->titleBarState & Qt::WindowMaximized)) { | - | ||||||||||||||||||||||||
| 3442 | ir = proxy()->subControlRect(CC_TitleBar, tb, SC_TitleBarMaxButton, widget); | - | ||||||||||||||||||||||||
| 3443 | - | |||||||||||||||||||||||||
| 3444 | down = tb->activeSubControls & SC_TitleBarMaxButton && (opt->state & State_Sunken); | - | ||||||||||||||||||||||||
| 3445 | pm = proxy()->standardIcon(SP_TitleBarMaxButton, &tool, widget).pixmap(qt_getWindow(widget), QSize(10, 10)); | - | ||||||||||||||||||||||||
| 3446 | tool.rect = ir; | - | ||||||||||||||||||||||||
| 3447 | tool.state = down ? State_Sunken : State_Raised; | - | ||||||||||||||||||||||||
| 3448 | proxy()->drawPrimitive(PE_PanelButtonTool, &tool, p, widget); | - | ||||||||||||||||||||||||
| 3449 | - | |||||||||||||||||||||||||
| 3450 | p->save(); | - | ||||||||||||||||||||||||
| 3451 | if (down) | - | ||||||||||||||||||||||||
| 3452 | p->translate(proxy()->pixelMetric(PM_ButtonShiftHorizontal, tb, widget), | - | ||||||||||||||||||||||||
| 3453 | proxy()->pixelMetric(PM_ButtonShiftVertical, tb, widget)); | - | ||||||||||||||||||||||||
| 3454 | proxy()->drawItemPixmap(p, ir, Qt::AlignCenter, pm); | - | ||||||||||||||||||||||||
| 3455 | p->restore(); | - | ||||||||||||||||||||||||
| 3456 | } | - | ||||||||||||||||||||||||
| 3457 | - | |||||||||||||||||||||||||
| 3458 | if (tb->subControls & SC_TitleBarMinButton | - | ||||||||||||||||||||||||
| 3459 | && tb->titleBarFlags & Qt::WindowMinimizeButtonHint | - | ||||||||||||||||||||||||
| 3460 | && !(tb->titleBarState & Qt::WindowMinimized)) { | - | ||||||||||||||||||||||||
| 3461 | ir = proxy()->subControlRect(CC_TitleBar, tb, SC_TitleBarMinButton, widget); | - | ||||||||||||||||||||||||
| 3462 | down = tb->activeSubControls & SC_TitleBarMinButton && (opt->state & State_Sunken); | - | ||||||||||||||||||||||||
| 3463 | pm = proxy()->standardIcon(SP_TitleBarMinButton, &tool, widget).pixmap(qt_getWindow(widget), QSize(10, 10)); | - | ||||||||||||||||||||||||
| 3464 | tool.rect = ir; | - | ||||||||||||||||||||||||
| 3465 | tool.state = down ? State_Sunken : State_Raised; | - | ||||||||||||||||||||||||
| 3466 | proxy()->drawPrimitive(PE_PanelButtonTool, &tool, p, widget); | - | ||||||||||||||||||||||||
| 3467 | - | |||||||||||||||||||||||||
| 3468 | p->save(); | - | ||||||||||||||||||||||||
| 3469 | if (down) | - | ||||||||||||||||||||||||
| 3470 | p->translate(proxy()->pixelMetric(PM_ButtonShiftHorizontal, tb, widget), | - | ||||||||||||||||||||||||
| 3471 | proxy()->pixelMetric(PM_ButtonShiftVertical, tb, widget)); | - | ||||||||||||||||||||||||
| 3472 | proxy()->drawItemPixmap(p, ir, Qt::AlignCenter, pm); | - | ||||||||||||||||||||||||
| 3473 | p->restore(); | - | ||||||||||||||||||||||||
| 3474 | } | - | ||||||||||||||||||||||||
| 3475 | - | |||||||||||||||||||||||||
| 3476 | bool drawNormalButton = (tb->subControls & SC_TitleBarNormalButton) | - | ||||||||||||||||||||||||
| 3477 | && (((tb->titleBarFlags & Qt::WindowMinimizeButtonHint) | - | ||||||||||||||||||||||||
| 3478 | && (tb->titleBarState & Qt::WindowMinimized)) | - | ||||||||||||||||||||||||
| 3479 | || ((tb->titleBarFlags & Qt::WindowMaximizeButtonHint) | - | ||||||||||||||||||||||||
| 3480 | && (tb->titleBarState & Qt::WindowMaximized))); | - | ||||||||||||||||||||||||
| 3481 | - | |||||||||||||||||||||||||
| 3482 | if (drawNormalButton) { | - | ||||||||||||||||||||||||
| 3483 | ir = proxy()->subControlRect(CC_TitleBar, tb, SC_TitleBarNormalButton, widget); | - | ||||||||||||||||||||||||
| 3484 | down = tb->activeSubControls & SC_TitleBarNormalButton && (opt->state & State_Sunken); | - | ||||||||||||||||||||||||
| 3485 | pm = proxy()->standardIcon(SP_TitleBarNormalButton, &tool, widget).pixmap(qt_getWindow(widget), QSize(10, 10)); | - | ||||||||||||||||||||||||
| 3486 | tool.rect = ir; | - | ||||||||||||||||||||||||
| 3487 | tool.state = down ? State_Sunken : State_Raised; | - | ||||||||||||||||||||||||
| 3488 | proxy()->drawPrimitive(PE_PanelButtonTool, &tool, p, widget); | - | ||||||||||||||||||||||||
| 3489 | - | |||||||||||||||||||||||||
| 3490 | p->save(); | - | ||||||||||||||||||||||||
| 3491 | if (down) | - | ||||||||||||||||||||||||
| 3492 | p->translate(proxy()->pixelMetric(PM_ButtonShiftHorizontal, tb, widget), | - | ||||||||||||||||||||||||
| 3493 | proxy()->pixelMetric(PM_ButtonShiftVertical, tb, widget)); | - | ||||||||||||||||||||||||
| 3494 | proxy()->drawItemPixmap(p, ir, Qt::AlignCenter, pm); | - | ||||||||||||||||||||||||
| 3495 | p->restore(); | - | ||||||||||||||||||||||||
| 3496 | } | - | ||||||||||||||||||||||||
| 3497 | - | |||||||||||||||||||||||||
| 3498 | if (tb->subControls & SC_TitleBarShadeButton | - | ||||||||||||||||||||||||
| 3499 | && tb->titleBarFlags & Qt::WindowShadeButtonHint | - | ||||||||||||||||||||||||
| 3500 | && !(tb->titleBarState & Qt::WindowMinimized)) { | - | ||||||||||||||||||||||||
| 3501 | ir = proxy()->subControlRect(CC_TitleBar, tb, SC_TitleBarShadeButton, widget); | - | ||||||||||||||||||||||||
| 3502 | down = (tb->activeSubControls & SC_TitleBarShadeButton && (opt->state & State_Sunken)); | - | ||||||||||||||||||||||||
| 3503 | pm = proxy()->standardIcon(SP_TitleBarShadeButton, &tool, widget).pixmap(qt_getWindow(widget), QSize(10, 10)); | - | ||||||||||||||||||||||||
| 3504 | tool.rect = ir; | - | ||||||||||||||||||||||||
| 3505 | tool.state = down ? State_Sunken : State_Raised; | - | ||||||||||||||||||||||||
| 3506 | proxy()->drawPrimitive(PE_PanelButtonTool, &tool, p, widget); | - | ||||||||||||||||||||||||
| 3507 | p->save(); | - | ||||||||||||||||||||||||
| 3508 | if (down) | - | ||||||||||||||||||||||||
| 3509 | p->translate(proxy()->pixelMetric(PM_ButtonShiftHorizontal, tb, widget), | - | ||||||||||||||||||||||||
| 3510 | proxy()->pixelMetric(PM_ButtonShiftVertical, tb, widget)); | - | ||||||||||||||||||||||||
| 3511 | proxy()->drawItemPixmap(p, ir, Qt::AlignCenter, pm); | - | ||||||||||||||||||||||||
| 3512 | p->restore(); | - | ||||||||||||||||||||||||
| 3513 | } | - | ||||||||||||||||||||||||
| 3514 | - | |||||||||||||||||||||||||
| 3515 | if (tb->subControls & SC_TitleBarUnshadeButton | - | ||||||||||||||||||||||||
| 3516 | && tb->titleBarFlags & Qt::WindowShadeButtonHint | - | ||||||||||||||||||||||||
| 3517 | && tb->titleBarState & Qt::WindowMinimized) { | - | ||||||||||||||||||||||||
| 3518 | ir = proxy()->subControlRect(CC_TitleBar, tb, SC_TitleBarUnshadeButton, widget); | - | ||||||||||||||||||||||||
| 3519 | - | |||||||||||||||||||||||||
| 3520 | down = tb->activeSubControls & SC_TitleBarUnshadeButton && (opt->state & State_Sunken); | - | ||||||||||||||||||||||||
| 3521 | pm = proxy()->standardIcon(SP_TitleBarUnshadeButton, &tool, widget).pixmap(qt_getWindow(widget), QSize(10, 10)); | - | ||||||||||||||||||||||||
| 3522 | tool.rect = ir; | - | ||||||||||||||||||||||||
| 3523 | tool.state = down ? State_Sunken : State_Raised; | - | ||||||||||||||||||||||||
| 3524 | proxy()->drawPrimitive(PE_PanelButtonTool, &tool, p, widget); | - | ||||||||||||||||||||||||
| 3525 | p->save(); | - | ||||||||||||||||||||||||
| 3526 | if (down) | - | ||||||||||||||||||||||||
| 3527 | p->translate(proxy()->pixelMetric(PM_ButtonShiftHorizontal, tb, widget), | - | ||||||||||||||||||||||||
| 3528 | proxy()->pixelMetric(PM_ButtonShiftVertical, tb, widget)); | - | ||||||||||||||||||||||||
| 3529 | proxy()->drawItemPixmap(p, ir, Qt::AlignCenter, pm); | - | ||||||||||||||||||||||||
| 3530 | p->restore(); | - | ||||||||||||||||||||||||
| 3531 | } | - | ||||||||||||||||||||||||
| 3532 | if (tb->subControls & SC_TitleBarContextHelpButton | - | ||||||||||||||||||||||||
| 3533 | && tb->titleBarFlags & Qt::WindowContextHelpButtonHint) { | - | ||||||||||||||||||||||||
| 3534 | ir = proxy()->subControlRect(CC_TitleBar, tb, SC_TitleBarContextHelpButton, widget); | - | ||||||||||||||||||||||||
| 3535 | - | |||||||||||||||||||||||||
| 3536 | down = tb->activeSubControls & SC_TitleBarContextHelpButton && (opt->state & State_Sunken); | - | ||||||||||||||||||||||||
| 3537 | pm = proxy()->standardIcon(SP_TitleBarContextHelpButton, &tool, widget).pixmap(qt_getWindow(widget), QSize(10, 10)); | - | ||||||||||||||||||||||||
| 3538 | tool.rect = ir; | - | ||||||||||||||||||||||||
| 3539 | tool.state = down ? State_Sunken : State_Raised; | - | ||||||||||||||||||||||||
| 3540 | proxy()->drawPrimitive(PE_PanelButtonTool, &tool, p, widget); | - | ||||||||||||||||||||||||
| 3541 | p->save(); | - | ||||||||||||||||||||||||
| 3542 | if (down) | - | ||||||||||||||||||||||||
| 3543 | p->translate(proxy()->pixelMetric(PM_ButtonShiftHorizontal, tb, widget), | - | ||||||||||||||||||||||||
| 3544 | proxy()->pixelMetric(PM_ButtonShiftVertical, tb, widget)); | - | ||||||||||||||||||||||||
| 3545 | proxy()->drawItemPixmap(p, ir, Qt::AlignCenter, pm); | - | ||||||||||||||||||||||||
| 3546 | p->restore(); | - | ||||||||||||||||||||||||
| 3547 | } | - | ||||||||||||||||||||||||
| 3548 | if (tb->subControls & SC_TitleBarSysMenu && tb->titleBarFlags & Qt::WindowSystemMenuHint) { | - | ||||||||||||||||||||||||
| 3549 | ir = proxy()->subControlRect(CC_TitleBar, tb, SC_TitleBarSysMenu, widget); | - | ||||||||||||||||||||||||
| 3550 | if (!tb->icon.isNull()) { | - | ||||||||||||||||||||||||
| 3551 | tb->icon.paint(p, ir); | - | ||||||||||||||||||||||||
| 3552 | } else { | - | ||||||||||||||||||||||||
| 3553 | int iconSize = proxy()->pixelMetric(PM_SmallIconSize, tb, widget); | - | ||||||||||||||||||||||||
| 3554 | pm = proxy()->standardIcon(SP_TitleBarMenuButton, &tool, widget).pixmap(qt_getWindow(widget), QSize(iconSize, iconSize)); | - | ||||||||||||||||||||||||
| 3555 | tool.rect = ir; | - | ||||||||||||||||||||||||
| 3556 | p->save(); | - | ||||||||||||||||||||||||
| 3557 | proxy()->drawItemPixmap(p, ir, Qt::AlignCenter, pm); | - | ||||||||||||||||||||||||
| 3558 | p->restore(); | - | ||||||||||||||||||||||||
| 3559 | } | - | ||||||||||||||||||||||||
| 3560 | } | - | ||||||||||||||||||||||||
| 3561 | } | - | ||||||||||||||||||||||||
| 3562 | break; | - | ||||||||||||||||||||||||
| 3563 | #ifndef QT_NO_DIAL | - | ||||||||||||||||||||||||
| 3564 | case CC_Dial: | - | ||||||||||||||||||||||||
| 3565 | if (const QStyleOptionSlider *dial = qstyleoption_cast<const QStyleOptionSlider *>(opt)) { | - | ||||||||||||||||||||||||
| 3566 | // OK, this is more a port of things over | - | ||||||||||||||||||||||||
| 3567 | p->save(); | - | ||||||||||||||||||||||||
| 3568 | - | |||||||||||||||||||||||||
| 3569 | // avoid dithering | - | ||||||||||||||||||||||||
| 3570 | if (p->paintEngine()->hasFeature(QPaintEngine::Antialiasing)) | - | ||||||||||||||||||||||||
| 3571 | p->setRenderHint(QPainter::Antialiasing); | - | ||||||||||||||||||||||||
| 3572 | - | |||||||||||||||||||||||||
| 3573 | int width = dial->rect.width(); | - | ||||||||||||||||||||||||
| 3574 | int height = dial->rect.height(); | - | ||||||||||||||||||||||||
| 3575 | qreal r = qMin(width, height) / 2; | - | ||||||||||||||||||||||||
| 3576 | qreal d_ = r / 6; | - | ||||||||||||||||||||||||
| 3577 | qreal dx = dial->rect.x() + d_ + (width - 2 * r) / 2 + 1; | - | ||||||||||||||||||||||||
| 3578 | qreal dy = dial->rect.y() + d_ + (height - 2 * r) / 2 + 1; | - | ||||||||||||||||||||||||
| 3579 | QRect br = QRect(int(dx), int(dy), int(r * 2 - 2 * d_ - 2), int(r * 2 - 2 * d_ - 2)); | - | ||||||||||||||||||||||||
| 3580 | - | |||||||||||||||||||||||||
| 3581 | QPalette pal = opt->palette; | - | ||||||||||||||||||||||||
| 3582 | // draw notches | - | ||||||||||||||||||||||||
| 3583 | if (dial->subControls & QStyle::SC_DialTickmarks) { | - | ||||||||||||||||||||||||
| 3584 | p->setPen(pal.foreground().color()); | - | ||||||||||||||||||||||||
| 3585 | p->drawLines(QStyleHelper::calcLines(dial)); | - | ||||||||||||||||||||||||
| 3586 | } | - | ||||||||||||||||||||||||
| 3587 | - | |||||||||||||||||||||||||
| 3588 | if (dial->state & State_Enabled) { | - | ||||||||||||||||||||||||
| 3589 | p->setBrush(pal.brush(QPalette::ColorRole(proxy()->styleHint(SH_Dial_BackgroundRole, | - | ||||||||||||||||||||||||
| 3590 | dial, widget)))); | - | ||||||||||||||||||||||||
| 3591 | p->setPen(Qt::NoPen); | - | ||||||||||||||||||||||||
| 3592 | p->drawEllipse(br); | - | ||||||||||||||||||||||||
| 3593 | p->setBrush(Qt::NoBrush); | - | ||||||||||||||||||||||||
| 3594 | } | - | ||||||||||||||||||||||||
| 3595 | p->setPen(QPen(pal.dark().color())); | - | ||||||||||||||||||||||||
| 3596 | p->drawArc(br, 60 * 16, 180 * 16); | - | ||||||||||||||||||||||||
| 3597 | p->setPen(QPen(pal.light().color())); | - | ||||||||||||||||||||||||
| 3598 | p->drawArc(br, 240 * 16, 180 * 16); | - | ||||||||||||||||||||||||
| 3599 | - | |||||||||||||||||||||||||
| 3600 | qreal a; | - | ||||||||||||||||||||||||
| 3601 | const StaticPolygonF<3> arrow = calcArrow(dial, a); | - | ||||||||||||||||||||||||
| 3602 | - | |||||||||||||||||||||||||
| 3603 | p->setPen(Qt::NoPen); | - | ||||||||||||||||||||||||
| 3604 | p->setBrush(pal.button()); | - | ||||||||||||||||||||||||
| 3605 | p->setRenderHint(QPainter::Qt4CompatiblePainting); | - | ||||||||||||||||||||||||
| 3606 | p->drawPolygon(arrow.cbegin(), arrow.size()); | - | ||||||||||||||||||||||||
| 3607 | - | |||||||||||||||||||||||||
| 3608 | a = QStyleHelper::angle(QPointF(width / 2, height / 2), arrow[0]); | - | ||||||||||||||||||||||||
| 3609 | p->setBrush(Qt::NoBrush); | - | ||||||||||||||||||||||||
| 3610 | - | |||||||||||||||||||||||||
| 3611 | if (a <= 0 || a > 200) { | - | ||||||||||||||||||||||||
| 3612 | p->setPen(pal.light().color()); | - | ||||||||||||||||||||||||
| 3613 | p->drawLine(arrow[2], arrow[0]); | - | ||||||||||||||||||||||||
| 3614 | p->drawLine(arrow[1], arrow[2]); | - | ||||||||||||||||||||||||
| 3615 | p->setPen(pal.dark().color()); | - | ||||||||||||||||||||||||
| 3616 | p->drawLine(arrow[0], arrow[1]); | - | ||||||||||||||||||||||||
| 3617 | } else if (a > 0 && a < 45) { | - | ||||||||||||||||||||||||
| 3618 | p->setPen(pal.light().color()); | - | ||||||||||||||||||||||||
| 3619 | p->drawLine(arrow[2], arrow[0]); | - | ||||||||||||||||||||||||
| 3620 | p->setPen(pal.dark().color()); | - | ||||||||||||||||||||||||
| 3621 | p->drawLine(arrow[1], arrow[2]); | - | ||||||||||||||||||||||||
| 3622 | p->drawLine(arrow[0], arrow[1]); | - | ||||||||||||||||||||||||
| 3623 | } else if (a >= 45 && a < 135) { | - | ||||||||||||||||||||||||
| 3624 | p->setPen(pal.dark().color()); | - | ||||||||||||||||||||||||
| 3625 | p->drawLine(arrow[2], arrow[0]); | - | ||||||||||||||||||||||||
| 3626 | p->drawLine(arrow[1], arrow[2]); | - | ||||||||||||||||||||||||
| 3627 | p->setPen(pal.light().color()); | - | ||||||||||||||||||||||||
| 3628 | p->drawLine(arrow[0], arrow[1]); | - | ||||||||||||||||||||||||
| 3629 | } else if (a >= 135 && a < 200) { | - | ||||||||||||||||||||||||
| 3630 | p->setPen(pal.dark().color()); | - | ||||||||||||||||||||||||
| 3631 | p->drawLine(arrow[2], arrow[0]); | - | ||||||||||||||||||||||||
| 3632 | p->setPen(pal.light().color()); | - | ||||||||||||||||||||||||
| 3633 | p->drawLine(arrow[0], arrow[1]); | - | ||||||||||||||||||||||||
| 3634 | p->drawLine(arrow[1], arrow[2]); | - | ||||||||||||||||||||||||
| 3635 | } | - | ||||||||||||||||||||||||
| 3636 | - | |||||||||||||||||||||||||
| 3637 | // draw focus rect around the dial | - | ||||||||||||||||||||||||
| 3638 | QStyleOptionFocusRect fropt; | - | ||||||||||||||||||||||||
| 3639 | fropt.rect = dial->rect; | - | ||||||||||||||||||||||||
| 3640 | fropt.state = dial->state; | - | ||||||||||||||||||||||||
| 3641 | fropt.palette = dial->palette; | - | ||||||||||||||||||||||||
| 3642 | if (fropt.state & QStyle::State_HasFocus) { | - | ||||||||||||||||||||||||
| 3643 | br.adjust(0, 0, 2, 2); | - | ||||||||||||||||||||||||
| 3644 | if (dial->subControls & SC_DialTickmarks) { | - | ||||||||||||||||||||||||
| 3645 | int r = qMin(width, height) / 2; | - | ||||||||||||||||||||||||
| 3646 | br.translate(-r / 6, - r / 6); | - | ||||||||||||||||||||||||
| 3647 | br.setWidth(br.width() + r / 3); | - | ||||||||||||||||||||||||
| 3648 | br.setHeight(br.height() + r / 3); | - | ||||||||||||||||||||||||
| 3649 | } | - | ||||||||||||||||||||||||
| 3650 | fropt.rect = br.adjusted(-2, -2, 2, 2); | - | ||||||||||||||||||||||||
| 3651 | proxy()->drawPrimitive(QStyle::PE_FrameFocusRect, &fropt, p, widget); | - | ||||||||||||||||||||||||
| 3652 | } | - | ||||||||||||||||||||||||
| 3653 | p->restore(); | - | ||||||||||||||||||||||||
| 3654 | } | - | ||||||||||||||||||||||||
| 3655 | break; | - | ||||||||||||||||||||||||
| 3656 | #endif // QT_NO_DIAL | - | ||||||||||||||||||||||||
| 3657 | #ifndef QT_NO_GROUPBOX | - | ||||||||||||||||||||||||
| 3658 | case CC_GroupBox: | - | ||||||||||||||||||||||||
| 3659 | if (const QStyleOptionGroupBox *groupBox = qstyleoption_cast<const QStyleOptionGroupBox *>(opt)) { | - | ||||||||||||||||||||||||
| 3660 | // Draw frame | - | ||||||||||||||||||||||||
| 3661 | QRect textRect = proxy()->subControlRect(CC_GroupBox, opt, SC_GroupBoxLabel, widget); | - | ||||||||||||||||||||||||
| 3662 | QRect checkBoxRect = proxy()->subControlRect(CC_GroupBox, opt, SC_GroupBoxCheckBox, widget); | - | ||||||||||||||||||||||||
| 3663 | if (groupBox->subControls & QStyle::SC_GroupBoxFrame) { | - | ||||||||||||||||||||||||
| 3664 | QStyleOptionFrame frame; | - | ||||||||||||||||||||||||
| 3665 | frame.QStyleOption::operator=(*groupBox); | - | ||||||||||||||||||||||||
| 3666 | frame.features = groupBox->features; | - | ||||||||||||||||||||||||
| 3667 | frame.lineWidth = groupBox->lineWidth; | - | ||||||||||||||||||||||||
| 3668 | frame.midLineWidth = groupBox->midLineWidth; | - | ||||||||||||||||||||||||
| 3669 | frame.rect = proxy()->subControlRect(CC_GroupBox, opt, SC_GroupBoxFrame, widget); | - | ||||||||||||||||||||||||
| 3670 | p->save(); | - | ||||||||||||||||||||||||
| 3671 | QRegion region(groupBox->rect); | - | ||||||||||||||||||||||||
| 3672 | if (!groupBox->text.isEmpty()) { | - | ||||||||||||||||||||||||
| 3673 | bool ltr = groupBox->direction == Qt::LeftToRight; | - | ||||||||||||||||||||||||
| 3674 | QRect finalRect; | - | ||||||||||||||||||||||||
| 3675 | if (groupBox->subControls & QStyle::SC_GroupBoxCheckBox) { | - | ||||||||||||||||||||||||
| 3676 | finalRect = checkBoxRect.united(textRect); | - | ||||||||||||||||||||||||
| 3677 | finalRect.adjust(ltr ? -4 : 0, 0, ltr ? 0 : 4, 0); | - | ||||||||||||||||||||||||
| 3678 | } else { | - | ||||||||||||||||||||||||
| 3679 | finalRect = textRect; | - | ||||||||||||||||||||||||
| 3680 | } | - | ||||||||||||||||||||||||
| 3681 | region -= finalRect; | - | ||||||||||||||||||||||||
| 3682 | } | - | ||||||||||||||||||||||||
| 3683 | p->setClipRegion(region); | - | ||||||||||||||||||||||||
| 3684 | proxy()->drawPrimitive(PE_FrameGroupBox, &frame, p, widget); | - | ||||||||||||||||||||||||
| 3685 | p->restore(); | - | ||||||||||||||||||||||||
| 3686 | } | - | ||||||||||||||||||||||||
| 3687 | - | |||||||||||||||||||||||||
| 3688 | // Draw title | - | ||||||||||||||||||||||||
| 3689 | if ((groupBox->subControls & QStyle::SC_GroupBoxLabel) && !groupBox->text.isEmpty()) { | - | ||||||||||||||||||||||||
| 3690 | QColor textColor = groupBox->textColor; | - | ||||||||||||||||||||||||
| 3691 | if (textColor.isValid()) | - | ||||||||||||||||||||||||
| 3692 | p->setPen(textColor); | - | ||||||||||||||||||||||||
| 3693 | int alignment = int(groupBox->textAlignment); | - | ||||||||||||||||||||||||
| 3694 | if (!proxy()->styleHint(QStyle::SH_UnderlineShortcut, opt, widget)) | - | ||||||||||||||||||||||||
| 3695 | alignment |= Qt::TextHideMnemonic; | - | ||||||||||||||||||||||||
| 3696 | - | |||||||||||||||||||||||||
| 3697 | proxy()->drawItemText(p, textRect, Qt::TextShowMnemonic | Qt::AlignHCenter | alignment, | - | ||||||||||||||||||||||||
| 3698 | groupBox->palette, groupBox->state & State_Enabled, groupBox->text, | - | ||||||||||||||||||||||||
| 3699 | textColor.isValid() ? QPalette::NoRole : QPalette::WindowText); | - | ||||||||||||||||||||||||
| 3700 | - | |||||||||||||||||||||||||
| 3701 | if (groupBox->state & State_HasFocus) { | - | ||||||||||||||||||||||||
| 3702 | QStyleOptionFocusRect fropt; | - | ||||||||||||||||||||||||
| 3703 | fropt.QStyleOption::operator=(*groupBox); | - | ||||||||||||||||||||||||
| 3704 | fropt.rect = textRect; | - | ||||||||||||||||||||||||
| 3705 | proxy()->drawPrimitive(PE_FrameFocusRect, &fropt, p, widget); | - | ||||||||||||||||||||||||
| 3706 | } | - | ||||||||||||||||||||||||
| 3707 | } | - | ||||||||||||||||||||||||
| 3708 | - | |||||||||||||||||||||||||
| 3709 | // Draw checkbox | - | ||||||||||||||||||||||||
| 3710 | if (groupBox->subControls & SC_GroupBoxCheckBox) { | - | ||||||||||||||||||||||||
| 3711 | QStyleOptionButton box; | - | ||||||||||||||||||||||||
| 3712 | box.QStyleOption::operator=(*groupBox); | - | ||||||||||||||||||||||||
| 3713 | box.rect = checkBoxRect; | - | ||||||||||||||||||||||||
| 3714 | proxy()->drawPrimitive(PE_IndicatorCheckBox, &box, p, widget); | - | ||||||||||||||||||||||||
| 3715 | } | - | ||||||||||||||||||||||||
| 3716 | } | - | ||||||||||||||||||||||||
| 3717 | break; | - | ||||||||||||||||||||||||
| 3718 | #endif // QT_NO_GROUPBOX | - | ||||||||||||||||||||||||
| 3719 | #ifndef QT_NO_MDIAREA | - | ||||||||||||||||||||||||
| 3720 | case CC_MdiControls: | - | ||||||||||||||||||||||||
| 3721 | { | - | ||||||||||||||||||||||||
| 3722 | QStyleOptionButton btnOpt; | - | ||||||||||||||||||||||||
| 3723 | btnOpt.QStyleOption::operator=(*opt); | - | ||||||||||||||||||||||||
| 3724 | btnOpt.state &= ~State_MouseOver; | - | ||||||||||||||||||||||||
| 3725 | int bsx = 0; | - | ||||||||||||||||||||||||
| 3726 | int bsy = 0; | - | ||||||||||||||||||||||||
| 3727 | if (opt->subControls & QStyle::SC_MdiCloseButton) { | - | ||||||||||||||||||||||||
| 3728 | if (opt->activeSubControls & QStyle::SC_MdiCloseButton && (opt->state & State_Sunken)) { | - | ||||||||||||||||||||||||
| 3729 | btnOpt.state |= State_Sunken; | - | ||||||||||||||||||||||||
| 3730 | btnOpt.state &= ~State_Raised; | - | ||||||||||||||||||||||||
| 3731 | bsx = proxy()->pixelMetric(PM_ButtonShiftHorizontal); | - | ||||||||||||||||||||||||
| 3732 | bsy = proxy()->pixelMetric(PM_ButtonShiftVertical); | - | ||||||||||||||||||||||||
| 3733 | } else { | - | ||||||||||||||||||||||||
| 3734 | btnOpt.state |= State_Raised; | - | ||||||||||||||||||||||||
| 3735 | btnOpt.state &= ~State_Sunken; | - | ||||||||||||||||||||||||
| 3736 | bsx = 0; | - | ||||||||||||||||||||||||
| 3737 | bsy = 0; | - | ||||||||||||||||||||||||
| 3738 | } | - | ||||||||||||||||||||||||
| 3739 | btnOpt.rect = proxy()->subControlRect(CC_MdiControls, opt, SC_MdiCloseButton, widget); | - | ||||||||||||||||||||||||
| 3740 | proxy()->drawPrimitive(PE_PanelButtonCommand, &btnOpt, p, widget); | - | ||||||||||||||||||||||||
| 3741 | QPixmap pm = proxy()->standardIcon(SP_TitleBarCloseButton).pixmap(qt_getWindow(widget), QSize(16, 16)); | - | ||||||||||||||||||||||||
| 3742 | proxy()->drawItemPixmap(p, btnOpt.rect.translated(bsx, bsy), Qt::AlignCenter, pm); | - | ||||||||||||||||||||||||
| 3743 | } | - | ||||||||||||||||||||||||
| 3744 | if (opt->subControls & QStyle::SC_MdiNormalButton) { | - | ||||||||||||||||||||||||
| 3745 | if (opt->activeSubControls & QStyle::SC_MdiNormalButton && (opt->state & State_Sunken)) { | - | ||||||||||||||||||||||||
| 3746 | btnOpt.state |= State_Sunken; | - | ||||||||||||||||||||||||
| 3747 | btnOpt.state &= ~State_Raised; | - | ||||||||||||||||||||||||
| 3748 | bsx = proxy()->pixelMetric(PM_ButtonShiftHorizontal); | - | ||||||||||||||||||||||||
| 3749 | bsy = proxy()->pixelMetric(PM_ButtonShiftVertical); | - | ||||||||||||||||||||||||
| 3750 | } else { | - | ||||||||||||||||||||||||
| 3751 | btnOpt.state |= State_Raised; | - | ||||||||||||||||||||||||
| 3752 | btnOpt.state &= ~State_Sunken; | - | ||||||||||||||||||||||||
| 3753 | bsx = 0; | - | ||||||||||||||||||||||||
| 3754 | bsy = 0; | - | ||||||||||||||||||||||||
| 3755 | } | - | ||||||||||||||||||||||||
| 3756 | btnOpt.rect = proxy()->subControlRect(CC_MdiControls, opt, SC_MdiNormalButton, widget); | - | ||||||||||||||||||||||||
| 3757 | proxy()->drawPrimitive(PE_PanelButtonCommand, &btnOpt, p, widget); | - | ||||||||||||||||||||||||
| 3758 | QPixmap pm = proxy()->standardIcon(SP_TitleBarNormalButton).pixmap(qt_getWindow(widget), QSize(16, 16)); | - | ||||||||||||||||||||||||
| 3759 | proxy()->drawItemPixmap(p, btnOpt.rect.translated(bsx, bsy), Qt::AlignCenter, pm); | - | ||||||||||||||||||||||||
| 3760 | } | - | ||||||||||||||||||||||||
| 3761 | if (opt->subControls & QStyle::SC_MdiMinButton) { | - | ||||||||||||||||||||||||
| 3762 | if (opt->activeSubControls & QStyle::SC_MdiMinButton && (opt->state & State_Sunken)) { | - | ||||||||||||||||||||||||
| 3763 | btnOpt.state |= State_Sunken; | - | ||||||||||||||||||||||||
| 3764 | btnOpt.state &= ~State_Raised; | - | ||||||||||||||||||||||||
| 3765 | bsx = proxy()->pixelMetric(PM_ButtonShiftHorizontal); | - | ||||||||||||||||||||||||
| 3766 | bsy = proxy()->pixelMetric(PM_ButtonShiftVertical); | - | ||||||||||||||||||||||||
| 3767 | } else { | - | ||||||||||||||||||||||||
| 3768 | btnOpt.state |= State_Raised; | - | ||||||||||||||||||||||||
| 3769 | btnOpt.state &= ~State_Sunken; | - | ||||||||||||||||||||||||
| 3770 | bsx = 0; | - | ||||||||||||||||||||||||
| 3771 | bsy = 0; | - | ||||||||||||||||||||||||
| 3772 | } | - | ||||||||||||||||||||||||
| 3773 | btnOpt.rect = proxy()->subControlRect(CC_MdiControls, opt, SC_MdiMinButton, widget); | - | ||||||||||||||||||||||||
| 3774 | proxy()->drawPrimitive(PE_PanelButtonCommand, &btnOpt, p, widget); | - | ||||||||||||||||||||||||
| 3775 | QPixmap pm = proxy()->standardIcon(SP_TitleBarMinButton).pixmap(qt_getWindow(widget), QSize(16, 16)); | - | ||||||||||||||||||||||||
| 3776 | proxy()->drawItemPixmap(p, btnOpt.rect.translated(bsx, bsy), Qt::AlignCenter, pm); | - | ||||||||||||||||||||||||
| 3777 | } | - | ||||||||||||||||||||||||
| 3778 | } | - | ||||||||||||||||||||||||
| 3779 | break; | - | ||||||||||||||||||||||||
| 3780 | #endif // QT_NO_MDIAREA | - | ||||||||||||||||||||||||
| 3781 | default: | - | ||||||||||||||||||||||||
| 3782 | qWarning("QCommonStyle::drawComplexControl: Control %d not handled", cc); | - | ||||||||||||||||||||||||
| 3783 | } | - | ||||||||||||||||||||||||
| 3784 | } | - | ||||||||||||||||||||||||
| 3785 | - | |||||||||||||||||||||||||
| 3786 | /*! | - | ||||||||||||||||||||||||
| 3787 | \reimp | - | ||||||||||||||||||||||||
| 3788 | */ | - | ||||||||||||||||||||||||
| 3789 | QStyle::SubControl QCommonStyle::hitTestComplexControl(ComplexControl cc, const QStyleOptionComplex *opt, | - | ||||||||||||||||||||||||
| 3790 | const QPoint &pt, const QWidget *widget) const | - | ||||||||||||||||||||||||
| 3791 | { | - | ||||||||||||||||||||||||
| 3792 | SubControl sc = SC_None; | - | ||||||||||||||||||||||||
| 3793 | switch (cc) { | - | ||||||||||||||||||||||||
| 3794 | #ifndef QT_NO_SLIDER | - | ||||||||||||||||||||||||
| 3795 | case CC_Slider: | - | ||||||||||||||||||||||||
| 3796 | if (const QStyleOptionSlider *slider = qstyleoption_cast<const QStyleOptionSlider *>(opt)) { | - | ||||||||||||||||||||||||
| 3797 | QRect r = proxy()->subControlRect(cc, slider, SC_SliderHandle, widget); | - | ||||||||||||||||||||||||
| 3798 | if (r.isValid() && r.contains(pt)) { | - | ||||||||||||||||||||||||
| 3799 | sc = SC_SliderHandle; | - | ||||||||||||||||||||||||
| 3800 | } else { | - | ||||||||||||||||||||||||
| 3801 | r = proxy()->subControlRect(cc, slider, SC_SliderGroove ,widget); | - | ||||||||||||||||||||||||
| 3802 | if (r.isValid() && r.contains(pt)) | - | ||||||||||||||||||||||||
| 3803 | sc = SC_SliderGroove; | - | ||||||||||||||||||||||||
| 3804 | } | - | ||||||||||||||||||||||||
| 3805 | } | - | ||||||||||||||||||||||||
| 3806 | break; | - | ||||||||||||||||||||||||
| 3807 | #endif // QT_NO_SLIDER | - | ||||||||||||||||||||||||
| 3808 | #ifndef QT_NO_SCROLLBAR | - | ||||||||||||||||||||||||
| 3809 | case CC_ScrollBar: | - | ||||||||||||||||||||||||
| 3810 | if (const QStyleOptionSlider *scrollbar = qstyleoption_cast<const QStyleOptionSlider *>(opt)) { | - | ||||||||||||||||||||||||
| 3811 | QRect r; | - | ||||||||||||||||||||||||
| 3812 | uint ctrl = SC_ScrollBarAddLine; | - | ||||||||||||||||||||||||
| 3813 | while (ctrl <= SC_ScrollBarGroove) { | - | ||||||||||||||||||||||||
| 3814 | r = proxy()->subControlRect(cc, scrollbar, QStyle::SubControl(ctrl), widget); | - | ||||||||||||||||||||||||
| 3815 | if (r.isValid() && r.contains(pt)) { | - | ||||||||||||||||||||||||
| 3816 | sc = QStyle::SubControl(ctrl); | - | ||||||||||||||||||||||||
| 3817 | break; | - | ||||||||||||||||||||||||
| 3818 | } | - | ||||||||||||||||||||||||
| 3819 | ctrl <<= 1; | - | ||||||||||||||||||||||||
| 3820 | } | - | ||||||||||||||||||||||||
| 3821 | } | - | ||||||||||||||||||||||||
| 3822 | break; | - | ||||||||||||||||||||||||
| 3823 | #endif // QT_NO_SCROLLBAR | - | ||||||||||||||||||||||||
| 3824 | #ifndef QT_NO_TOOLBUTTON | - | ||||||||||||||||||||||||
| 3825 | case CC_ToolButton: | - | ||||||||||||||||||||||||
| 3826 | if (const QStyleOptionToolButton *toolbutton = qstyleoption_cast<const QStyleOptionToolButton *>(opt)) { | - | ||||||||||||||||||||||||
| 3827 | QRect r; | - | ||||||||||||||||||||||||
| 3828 | uint ctrl = SC_ToolButton; | - | ||||||||||||||||||||||||
| 3829 | while (ctrl <= SC_ToolButtonMenu) { | - | ||||||||||||||||||||||||
| 3830 | r = proxy()->subControlRect(cc, toolbutton, QStyle::SubControl(ctrl), widget); | - | ||||||||||||||||||||||||
| 3831 | if (r.isValid() && r.contains(pt)) { | - | ||||||||||||||||||||||||
| 3832 | sc = QStyle::SubControl(ctrl); | - | ||||||||||||||||||||||||
| 3833 | break; | - | ||||||||||||||||||||||||
| 3834 | } | - | ||||||||||||||||||||||||
| 3835 | ctrl <<= 1; | - | ||||||||||||||||||||||||
| 3836 | } | - | ||||||||||||||||||||||||
| 3837 | } | - | ||||||||||||||||||||||||
| 3838 | break; | - | ||||||||||||||||||||||||
| 3839 | #endif // QT_NO_TOOLBUTTON | - | ||||||||||||||||||||||||
| 3840 | #ifndef QT_NO_SPINBOX | - | ||||||||||||||||||||||||
| 3841 | case CC_SpinBox: | - | ||||||||||||||||||||||||
| 3842 | if (const QStyleOptionSpinBox *spinbox = qstyleoption_cast<const QStyleOptionSpinBox *>(opt)) { | - | ||||||||||||||||||||||||
| 3843 | QRect r; | - | ||||||||||||||||||||||||
| 3844 | uint ctrl = SC_SpinBoxUp; | - | ||||||||||||||||||||||||
| 3845 | while (ctrl <= SC_SpinBoxEditField) { | - | ||||||||||||||||||||||||
| 3846 | r = proxy()->subControlRect(cc, spinbox, QStyle::SubControl(ctrl), widget); | - | ||||||||||||||||||||||||
| 3847 | if (r.isValid() && r.contains(pt)) { | - | ||||||||||||||||||||||||
| 3848 | sc = QStyle::SubControl(ctrl); | - | ||||||||||||||||||||||||
| 3849 | break; | - | ||||||||||||||||||||||||
| 3850 | } | - | ||||||||||||||||||||||||
| 3851 | ctrl <<= 1; | - | ||||||||||||||||||||||||
| 3852 | } | - | ||||||||||||||||||||||||
| 3853 | } | - | ||||||||||||||||||||||||
| 3854 | break; | - | ||||||||||||||||||||||||
| 3855 | #endif // QT_NO_SPINBOX | - | ||||||||||||||||||||||||
| 3856 | case CC_TitleBar: | - | ||||||||||||||||||||||||
| 3857 | if (const QStyleOptionTitleBar *tb = qstyleoption_cast<const QStyleOptionTitleBar *>(opt)) { | - | ||||||||||||||||||||||||
| 3858 | QRect r; | - | ||||||||||||||||||||||||
| 3859 | uint ctrl = SC_TitleBarSysMenu; | - | ||||||||||||||||||||||||
| 3860 | - | |||||||||||||||||||||||||
| 3861 | while (ctrl <= SC_TitleBarLabel) { | - | ||||||||||||||||||||||||
| 3862 | r = proxy()->subControlRect(cc, tb, QStyle::SubControl(ctrl), widget); | - | ||||||||||||||||||||||||
| 3863 | if (r.isValid() && r.contains(pt)) { | - | ||||||||||||||||||||||||
| 3864 | sc = QStyle::SubControl(ctrl); | - | ||||||||||||||||||||||||
| 3865 | break; | - | ||||||||||||||||||||||||
| 3866 | } | - | ||||||||||||||||||||||||
| 3867 | ctrl <<= 1; | - | ||||||||||||||||||||||||
| 3868 | } | - | ||||||||||||||||||||||||
| 3869 | } | - | ||||||||||||||||||||||||
| 3870 | break; | - | ||||||||||||||||||||||||
| 3871 | #ifndef QT_NO_COMBOBOX | - | ||||||||||||||||||||||||
| 3872 | case CC_ComboBox: | - | ||||||||||||||||||||||||
| 3873 | if (const QStyleOptionComboBox *cb = qstyleoption_cast<const QStyleOptionComboBox *>(opt)) { | - | ||||||||||||||||||||||||
| 3874 | QRect r; | - | ||||||||||||||||||||||||
| 3875 | uint ctrl = SC_ComboBoxArrow; // Start here and go down. | - | ||||||||||||||||||||||||
| 3876 | while (ctrl > 0) { | - | ||||||||||||||||||||||||
| 3877 | r = proxy()->subControlRect(cc, cb, QStyle::SubControl(ctrl), widget); | - | ||||||||||||||||||||||||
| 3878 | if (r.isValid() && r.contains(pt)) { | - | ||||||||||||||||||||||||
| 3879 | sc = QStyle::SubControl(ctrl); | - | ||||||||||||||||||||||||
| 3880 | break; | - | ||||||||||||||||||||||||
| 3881 | } | - | ||||||||||||||||||||||||
| 3882 | ctrl >>= 1; | - | ||||||||||||||||||||||||
| 3883 | } | - | ||||||||||||||||||||||||
| 3884 | } | - | ||||||||||||||||||||||||
| 3885 | break; | - | ||||||||||||||||||||||||
| 3886 | #endif // QT_NO_COMBOBOX | - | ||||||||||||||||||||||||
| 3887 | #ifndef QT_NO_GROUPBOX | - | ||||||||||||||||||||||||
| 3888 | case CC_GroupBox: | - | ||||||||||||||||||||||||
| 3889 | if (const QStyleOptionGroupBox *groupBox = qstyleoption_cast<const QStyleOptionGroupBox *>(opt)) { | - | ||||||||||||||||||||||||
| 3890 | QRect r; | - | ||||||||||||||||||||||||
| 3891 | uint ctrl = SC_GroupBoxCheckBox; | - | ||||||||||||||||||||||||
| 3892 | while (ctrl <= SC_GroupBoxFrame) { | - | ||||||||||||||||||||||||
| 3893 | r = proxy()->subControlRect(cc, groupBox, QStyle::SubControl(ctrl), widget); | - | ||||||||||||||||||||||||
| 3894 | if (r.isValid() && r.contains(pt)) { | - | ||||||||||||||||||||||||
| 3895 | sc = QStyle::SubControl(ctrl); | - | ||||||||||||||||||||||||
| 3896 | break; | - | ||||||||||||||||||||||||
| 3897 | } | - | ||||||||||||||||||||||||
| 3898 | ctrl <<= 1; | - | ||||||||||||||||||||||||
| 3899 | } | - | ||||||||||||||||||||||||
| 3900 | } | - | ||||||||||||||||||||||||
| 3901 | break; | - | ||||||||||||||||||||||||
| 3902 | #endif // QT_NO_GROUPBOX | - | ||||||||||||||||||||||||
| 3903 | case CC_MdiControls: | - | ||||||||||||||||||||||||
| 3904 | { | - | ||||||||||||||||||||||||
| 3905 | QRect r; | - | ||||||||||||||||||||||||
| 3906 | uint ctrl = SC_MdiMinButton; | - | ||||||||||||||||||||||||
| 3907 | while (ctrl <= SC_MdiCloseButton) { | - | ||||||||||||||||||||||||
| 3908 | r = proxy()->subControlRect(CC_MdiControls, opt, QStyle::SubControl(ctrl), widget); | - | ||||||||||||||||||||||||
| 3909 | if (r.isValid() && r.contains(pt) && (opt->subControls & ctrl)) { | - | ||||||||||||||||||||||||
| 3910 | sc = QStyle::SubControl(ctrl); | - | ||||||||||||||||||||||||
| 3911 | return sc; | - | ||||||||||||||||||||||||
| 3912 | } | - | ||||||||||||||||||||||||
| 3913 | ctrl <<= 1; | - | ||||||||||||||||||||||||
| 3914 | } | - | ||||||||||||||||||||||||
| 3915 | } | - | ||||||||||||||||||||||||
| 3916 | break; | - | ||||||||||||||||||||||||
| 3917 | default: | - | ||||||||||||||||||||||||
| 3918 | qWarning("QCommonStyle::hitTestComplexControl: Case %d not handled", cc); | - | ||||||||||||||||||||||||
| 3919 | } | - | ||||||||||||||||||||||||
| 3920 | return sc; | - | ||||||||||||||||||||||||
| 3921 | } | - | ||||||||||||||||||||||||
| 3922 | - | |||||||||||||||||||||||||
| 3923 | /*! | - | ||||||||||||||||||||||||
| 3924 | \reimp | - | ||||||||||||||||||||||||
| 3925 | */ | - | ||||||||||||||||||||||||
| 3926 | QRect QCommonStyle::subControlRect(ComplexControl cc, const QStyleOptionComplex *opt, | - | ||||||||||||||||||||||||
| 3927 | SubControl sc, const QWidget *widget) const | - | ||||||||||||||||||||||||
| 3928 | { | - | ||||||||||||||||||||||||
| 3929 | QRect ret; | - | ||||||||||||||||||||||||
| 3930 | switch (cc) { | - | ||||||||||||||||||||||||
| 3931 | #ifndef QT_NO_SLIDER | - | ||||||||||||||||||||||||
| 3932 | case CC_Slider: | - | ||||||||||||||||||||||||
| 3933 | if (const QStyleOptionSlider *slider = qstyleoption_cast<const QStyleOptionSlider *>(opt)) { | - | ||||||||||||||||||||||||
| 3934 | int tickOffset = proxy()->pixelMetric(PM_SliderTickmarkOffset, slider, widget); | - | ||||||||||||||||||||||||
| 3935 | int thickness = proxy()->pixelMetric(PM_SliderControlThickness, slider, widget); | - | ||||||||||||||||||||||||
| 3936 | - | |||||||||||||||||||||||||
| 3937 | switch (sc) { | - | ||||||||||||||||||||||||
| 3938 | case SC_SliderHandle: { | - | ||||||||||||||||||||||||
| 3939 | int sliderPos = 0; | - | ||||||||||||||||||||||||
| 3940 | int len = proxy()->pixelMetric(PM_SliderLength, slider, widget); | - | ||||||||||||||||||||||||
| 3941 | bool horizontal = slider->orientation == Qt::Horizontal; | - | ||||||||||||||||||||||||
| 3942 | sliderPos = sliderPositionFromValue(slider->minimum, slider->maximum, | - | ||||||||||||||||||||||||
| 3943 | slider->sliderPosition, | - | ||||||||||||||||||||||||
| 3944 | (horizontal ? slider->rect.width() | - | ||||||||||||||||||||||||
| 3945 | : slider->rect.height()) - len, | - | ||||||||||||||||||||||||
| 3946 | slider->upsideDown); | - | ||||||||||||||||||||||||
| 3947 | if (horizontal) | - | ||||||||||||||||||||||||
| 3948 | ret.setRect(slider->rect.x() + sliderPos, slider->rect.y() + tickOffset, len, thickness); | - | ||||||||||||||||||||||||
| 3949 | else | - | ||||||||||||||||||||||||
| 3950 | ret.setRect(slider->rect.x() + tickOffset, slider->rect.y() + sliderPos, thickness, len); | - | ||||||||||||||||||||||||
| 3951 | break; } | - | ||||||||||||||||||||||||
| 3952 | case SC_SliderGroove: | - | ||||||||||||||||||||||||
| 3953 | if (slider->orientation == Qt::Horizontal) | - | ||||||||||||||||||||||||
| 3954 | ret.setRect(slider->rect.x(), slider->rect.y() + tickOffset, | - | ||||||||||||||||||||||||
| 3955 | slider->rect.width(), thickness); | - | ||||||||||||||||||||||||
| 3956 | else | - | ||||||||||||||||||||||||
| 3957 | ret.setRect(slider->rect.x() + tickOffset, slider->rect.y(), | - | ||||||||||||||||||||||||
| 3958 | thickness, slider->rect.height()); | - | ||||||||||||||||||||||||
| 3959 | break; | - | ||||||||||||||||||||||||
| 3960 | default: | - | ||||||||||||||||||||||||
| 3961 | break; | - | ||||||||||||||||||||||||
| 3962 | } | - | ||||||||||||||||||||||||
| 3963 | ret = visualRect(slider->direction, slider->rect, ret); | - | ||||||||||||||||||||||||
| 3964 | } | - | ||||||||||||||||||||||||
| 3965 | break; | - | ||||||||||||||||||||||||
| 3966 | #endif // QT_NO_SLIDER | - | ||||||||||||||||||||||||
| 3967 | #ifndef QT_NO_SCROLLBAR | - | ||||||||||||||||||||||||
| 3968 | case CC_ScrollBar: | - | ||||||||||||||||||||||||
| 3969 | if (const QStyleOptionSlider *scrollbar = qstyleoption_cast<const QStyleOptionSlider *>(opt)) { | - | ||||||||||||||||||||||||
| 3970 | const QRect scrollBarRect = scrollbar->rect; | - | ||||||||||||||||||||||||
| 3971 | int sbextent = 0; | - | ||||||||||||||||||||||||
| 3972 | if (!proxy()->styleHint(SH_ScrollBar_Transient, scrollbar, widget)) | - | ||||||||||||||||||||||||
| 3973 | sbextent = proxy()->pixelMetric(PM_ScrollBarExtent, scrollbar, widget); | - | ||||||||||||||||||||||||
| 3974 | int maxlen = ((scrollbar->orientation == Qt::Horizontal) ? | - | ||||||||||||||||||||||||
| 3975 | scrollBarRect.width() : scrollBarRect.height()) - (sbextent * 2); | - | ||||||||||||||||||||||||
| 3976 | int sliderlen; | - | ||||||||||||||||||||||||
| 3977 | - | |||||||||||||||||||||||||
| 3978 | // calculate slider length | - | ||||||||||||||||||||||||
| 3979 | if (scrollbar->maximum != scrollbar->minimum) { | - | ||||||||||||||||||||||||
| 3980 | uint range = scrollbar->maximum - scrollbar->minimum; | - | ||||||||||||||||||||||||
| 3981 | sliderlen = (qint64(scrollbar->pageStep) * maxlen) / (range + scrollbar->pageStep); | - | ||||||||||||||||||||||||
| 3982 | - | |||||||||||||||||||||||||
| 3983 | int slidermin = proxy()->pixelMetric(PM_ScrollBarSliderMin, scrollbar, widget); | - | ||||||||||||||||||||||||
| 3984 | if (sliderlen < slidermin || range > INT_MAX / 2) | - | ||||||||||||||||||||||||
| 3985 | sliderlen = slidermin; | - | ||||||||||||||||||||||||
| 3986 | if (sliderlen > maxlen) | - | ||||||||||||||||||||||||
| 3987 | sliderlen = maxlen; | - | ||||||||||||||||||||||||
| 3988 | } else { | - | ||||||||||||||||||||||||
| 3989 | sliderlen = maxlen; | - | ||||||||||||||||||||||||
| 3990 | } | - | ||||||||||||||||||||||||
| 3991 | - | |||||||||||||||||||||||||
| 3992 | int sliderstart = sbextent + sliderPositionFromValue(scrollbar->minimum, | - | ||||||||||||||||||||||||
| 3993 | scrollbar->maximum, | - | ||||||||||||||||||||||||
| 3994 | scrollbar->sliderPosition, | - | ||||||||||||||||||||||||
| 3995 | maxlen - sliderlen, | - | ||||||||||||||||||||||||
| 3996 | scrollbar->upsideDown); | - | ||||||||||||||||||||||||
| 3997 | - | |||||||||||||||||||||||||
| 3998 | switch (sc) { | - | ||||||||||||||||||||||||
| 3999 | case SC_ScrollBarSubLine: // top/left button | - | ||||||||||||||||||||||||
| 4000 | if (scrollbar->orientation == Qt::Horizontal) { | - | ||||||||||||||||||||||||
| 4001 | int buttonWidth = qMin(scrollBarRect.width() / 2, sbextent); | - | ||||||||||||||||||||||||
| 4002 | ret.setRect(0, 0, buttonWidth, scrollBarRect.height()); | - | ||||||||||||||||||||||||
| 4003 | } else { | - | ||||||||||||||||||||||||
| 4004 | int buttonHeight = qMin(scrollBarRect.height() / 2, sbextent); | - | ||||||||||||||||||||||||
| 4005 | ret.setRect(0, 0, scrollBarRect.width(), buttonHeight); | - | ||||||||||||||||||||||||
| 4006 | } | - | ||||||||||||||||||||||||
| 4007 | break; | - | ||||||||||||||||||||||||
| 4008 | case SC_ScrollBarAddLine: // bottom/right button | - | ||||||||||||||||||||||||
| 4009 | if (scrollbar->orientation == Qt::Horizontal) { | - | ||||||||||||||||||||||||
| 4010 | int buttonWidth = qMin(scrollBarRect.width()/2, sbextent); | - | ||||||||||||||||||||||||
| 4011 | ret.setRect(scrollBarRect.width() - buttonWidth, 0, buttonWidth, scrollBarRect.height()); | - | ||||||||||||||||||||||||
| 4012 | } else { | - | ||||||||||||||||||||||||
| 4013 | int buttonHeight = qMin(scrollBarRect.height()/2, sbextent); | - | ||||||||||||||||||||||||
| 4014 | ret.setRect(0, scrollBarRect.height() - buttonHeight, scrollBarRect.width(), buttonHeight); | - | ||||||||||||||||||||||||
| 4015 | } | - | ||||||||||||||||||||||||
| 4016 | break; | - | ||||||||||||||||||||||||
| 4017 | case SC_ScrollBarSubPage: // between top/left button and slider | - | ||||||||||||||||||||||||
| 4018 | if (scrollbar->orientation == Qt::Horizontal) | - | ||||||||||||||||||||||||
| 4019 | ret.setRect(sbextent, 0, sliderstart - sbextent, scrollBarRect.height()); | - | ||||||||||||||||||||||||
| 4020 | else | - | ||||||||||||||||||||||||
| 4021 | ret.setRect(0, sbextent, scrollBarRect.width(), sliderstart - sbextent); | - | ||||||||||||||||||||||||
| 4022 | break; | - | ||||||||||||||||||||||||
| 4023 | case SC_ScrollBarAddPage: // between bottom/right button and slider | - | ||||||||||||||||||||||||
| 4024 | if (scrollbar->orientation == Qt::Horizontal) | - | ||||||||||||||||||||||||
| 4025 | ret.setRect(sliderstart + sliderlen, 0, | - | ||||||||||||||||||||||||
| 4026 | maxlen - sliderstart - sliderlen + sbextent, scrollBarRect.height()); | - | ||||||||||||||||||||||||
| 4027 | else | - | ||||||||||||||||||||||||
| 4028 | ret.setRect(0, sliderstart + sliderlen, scrollBarRect.width(), | - | ||||||||||||||||||||||||
| 4029 | maxlen - sliderstart - sliderlen + sbextent); | - | ||||||||||||||||||||||||
| 4030 | break; | - | ||||||||||||||||||||||||
| 4031 | case SC_ScrollBarGroove: | - | ||||||||||||||||||||||||
| 4032 | if (scrollbar->orientation == Qt::Horizontal) | - | ||||||||||||||||||||||||
| 4033 | ret.setRect(sbextent, 0, scrollBarRect.width() - sbextent * 2, | - | ||||||||||||||||||||||||
| 4034 | scrollBarRect.height()); | - | ||||||||||||||||||||||||
| 4035 | else | - | ||||||||||||||||||||||||
| 4036 | ret.setRect(0, sbextent, scrollBarRect.width(), | - | ||||||||||||||||||||||||
| 4037 | scrollBarRect.height() - sbextent * 2); | - | ||||||||||||||||||||||||
| 4038 | break; | - | ||||||||||||||||||||||||
| 4039 | case SC_ScrollBarSlider: | - | ||||||||||||||||||||||||
| 4040 | if (scrollbar->orientation == Qt::Horizontal) | - | ||||||||||||||||||||||||
| 4041 | ret.setRect(sliderstart, 0, sliderlen, scrollBarRect.height()); | - | ||||||||||||||||||||||||
| 4042 | else | - | ||||||||||||||||||||||||
| 4043 | ret.setRect(0, sliderstart, scrollBarRect.width(), sliderlen); | - | ||||||||||||||||||||||||
| 4044 | break; | - | ||||||||||||||||||||||||
| 4045 | default: | - | ||||||||||||||||||||||||
| 4046 | break; | - | ||||||||||||||||||||||||
| 4047 | } | - | ||||||||||||||||||||||||
| 4048 | ret = visualRect(scrollbar->direction, scrollBarRect, ret); | - | ||||||||||||||||||||||||
| 4049 | } | - | ||||||||||||||||||||||||
| 4050 | break; | - | ||||||||||||||||||||||||
| 4051 | #endif // QT_NO_SCROLLBAR | - | ||||||||||||||||||||||||
| 4052 | #ifndef QT_NO_SPINBOX | - | ||||||||||||||||||||||||
| 4053 | case CC_SpinBox: | - | ||||||||||||||||||||||||
| 4054 | if (const QStyleOptionSpinBox *spinbox = qstyleoption_cast<const QStyleOptionSpinBox *>(opt)) { | - | ||||||||||||||||||||||||
| 4055 | QSize bs; | - | ||||||||||||||||||||||||
| 4056 | int fw = spinbox->frame ? proxy()->pixelMetric(PM_SpinBoxFrameWidth, spinbox, widget) : 0; | - | ||||||||||||||||||||||||
| 4057 | bs.setHeight(qMax(8, spinbox->rect.height()/2 - fw)); | - | ||||||||||||||||||||||||
| 4058 | // 1.6 -approximate golden mean | - | ||||||||||||||||||||||||
| 4059 | bs.setWidth(qMax(16, qMin(bs.height() * 8 / 5, spinbox->rect.width() / 4))); | - | ||||||||||||||||||||||||
| 4060 | bs = bs.expandedTo(QApplication::globalStrut()); | - | ||||||||||||||||||||||||
| 4061 | int y = fw + spinbox->rect.y(); | - | ||||||||||||||||||||||||
| 4062 | int x, lx, rx; | - | ||||||||||||||||||||||||
| 4063 | x = spinbox->rect.x() + spinbox->rect.width() - fw - bs.width(); | - | ||||||||||||||||||||||||
| 4064 | lx = fw; | - | ||||||||||||||||||||||||
| 4065 | rx = x - fw; | - | ||||||||||||||||||||||||
| 4066 | switch (sc) { | - | ||||||||||||||||||||||||
| 4067 | case SC_SpinBoxUp: | - | ||||||||||||||||||||||||
| 4068 | if (spinbox->buttonSymbols == QAbstractSpinBox::NoButtons) | - | ||||||||||||||||||||||||
| 4069 | return QRect(); | - | ||||||||||||||||||||||||
| 4070 | ret = QRect(x, y, bs.width(), bs.height()); | - | ||||||||||||||||||||||||
| 4071 | break; | - | ||||||||||||||||||||||||
| 4072 | case SC_SpinBoxDown: | - | ||||||||||||||||||||||||
| 4073 | if (spinbox->buttonSymbols == QAbstractSpinBox::NoButtons) | - | ||||||||||||||||||||||||
| 4074 | return QRect(); | - | ||||||||||||||||||||||||
| 4075 | - | |||||||||||||||||||||||||
| 4076 | ret = QRect(x, y + bs.height(), bs.width(), bs.height()); | - | ||||||||||||||||||||||||
| 4077 | break; | - | ||||||||||||||||||||||||
| 4078 | case SC_SpinBoxEditField: | - | ||||||||||||||||||||||||
| 4079 | if (spinbox->buttonSymbols == QAbstractSpinBox::NoButtons) { | - | ||||||||||||||||||||||||
| 4080 | ret = QRect(lx, fw, spinbox->rect.width() - 2*fw, spinbox->rect.height() - 2*fw); | - | ||||||||||||||||||||||||
| 4081 | } else { | - | ||||||||||||||||||||||||
| 4082 | ret = QRect(lx, fw, rx, spinbox->rect.height() - 2*fw); | - | ||||||||||||||||||||||||
| 4083 | } | - | ||||||||||||||||||||||||
| 4084 | break; | - | ||||||||||||||||||||||||
| 4085 | case SC_SpinBoxFrame: | - | ||||||||||||||||||||||||
| 4086 | ret = spinbox->rect; | - | ||||||||||||||||||||||||
| 4087 | default: | - | ||||||||||||||||||||||||
| 4088 | break; | - | ||||||||||||||||||||||||
| 4089 | } | - | ||||||||||||||||||||||||
| 4090 | ret = visualRect(spinbox->direction, spinbox->rect, ret); | - | ||||||||||||||||||||||||
| 4091 | } | - | ||||||||||||||||||||||||
| 4092 | break; | - | ||||||||||||||||||||||||
| 4093 | #endif // Qt_NO_SPINBOX | - | ||||||||||||||||||||||||
| 4094 | #ifndef QT_NO_TOOLBUTTON | - | ||||||||||||||||||||||||
| 4095 | case CC_ToolButton: | - | ||||||||||||||||||||||||
| 4096 | if (const QStyleOptionToolButton *tb = qstyleoption_cast<const QStyleOptionToolButton *>(opt)) { | - | ||||||||||||||||||||||||
| 4097 | int mbi = proxy()->pixelMetric(PM_MenuButtonIndicator, tb, widget); | - | ||||||||||||||||||||||||
| 4098 | ret = tb->rect; | - | ||||||||||||||||||||||||
| 4099 | switch (sc) { | - | ||||||||||||||||||||||||
| 4100 | case SC_ToolButton: | - | ||||||||||||||||||||||||
| 4101 | if ((tb->features | - | ||||||||||||||||||||||||
| 4102 | & (QStyleOptionToolButton::MenuButtonPopup | QStyleOptionToolButton::PopupDelay)) | - | ||||||||||||||||||||||||
| 4103 | == QStyleOptionToolButton::MenuButtonPopup) | - | ||||||||||||||||||||||||
| 4104 | ret.adjust(0, 0, -mbi, 0); | - | ||||||||||||||||||||||||
| 4105 | break; | - | ||||||||||||||||||||||||
| 4106 | case SC_ToolButtonMenu: | - | ||||||||||||||||||||||||
| 4107 | if ((tb->features | - | ||||||||||||||||||||||||
| 4108 | & (QStyleOptionToolButton::MenuButtonPopup | QStyleOptionToolButton::PopupDelay)) | - | ||||||||||||||||||||||||
| 4109 | == QStyleOptionToolButton::MenuButtonPopup) | - | ||||||||||||||||||||||||
| 4110 | ret.adjust(ret.width() - mbi, 0, 0, 0); | - | ||||||||||||||||||||||||
| 4111 | break; | - | ||||||||||||||||||||||||
| 4112 | default: | - | ||||||||||||||||||||||||
| 4113 | break; | - | ||||||||||||||||||||||||
| 4114 | } | - | ||||||||||||||||||||||||
| 4115 | ret = visualRect(tb->direction, tb->rect, ret); | - | ||||||||||||||||||||||||
| 4116 | } | - | ||||||||||||||||||||||||
| 4117 | break; | - | ||||||||||||||||||||||||
| 4118 | #endif // QT_NO_TOOLBUTTON | - | ||||||||||||||||||||||||
| 4119 | #ifndef QT_NO_COMBOBOX | - | ||||||||||||||||||||||||
| 4120 | case CC_ComboBox: | - | ||||||||||||||||||||||||
| 4121 | if (const QStyleOptionComboBox *cb = qstyleoption_cast<const QStyleOptionComboBox *>(opt)) { | - | ||||||||||||||||||||||||
| 4122 | int x = cb->rect.x(), | - | ||||||||||||||||||||||||
| 4123 | y = cb->rect.y(), | - | ||||||||||||||||||||||||
| 4124 | wi = cb->rect.width(), | - | ||||||||||||||||||||||||
| 4125 | he = cb->rect.height(); | - | ||||||||||||||||||||||||
| 4126 | int xpos = x; | - | ||||||||||||||||||||||||
| 4127 | int margin = cb->frame ? 3 : 0; | - | ||||||||||||||||||||||||
| 4128 | int bmarg = cb->frame ? 2 : 0; | - | ||||||||||||||||||||||||
| 4129 | xpos += wi - bmarg - 16; | - | ||||||||||||||||||||||||
| 4130 | - | |||||||||||||||||||||||||
| 4131 | - | |||||||||||||||||||||||||
| 4132 | switch (sc) { | - | ||||||||||||||||||||||||
| 4133 | case SC_ComboBoxFrame: | - | ||||||||||||||||||||||||
| 4134 | ret = cb->rect; | - | ||||||||||||||||||||||||
| 4135 | break; | - | ||||||||||||||||||||||||
| 4136 | case SC_ComboBoxArrow: | - | ||||||||||||||||||||||||
| 4137 | ret.setRect(xpos, y + bmarg, 16, he - 2*bmarg); | - | ||||||||||||||||||||||||
| 4138 | break; | - | ||||||||||||||||||||||||
| 4139 | case SC_ComboBoxEditField: | - | ||||||||||||||||||||||||
| 4140 | ret.setRect(x + margin, y + margin, wi - 2 * margin - 16, he - 2 * margin); | - | ||||||||||||||||||||||||
| 4141 | break; | - | ||||||||||||||||||||||||
| 4142 | case SC_ComboBoxListBoxPopup: | - | ||||||||||||||||||||||||
| 4143 | ret = cb->rect; | - | ||||||||||||||||||||||||
| 4144 | break; | - | ||||||||||||||||||||||||
| 4145 | default: | - | ||||||||||||||||||||||||
| 4146 | break; | - | ||||||||||||||||||||||||
| 4147 | } | - | ||||||||||||||||||||||||
| 4148 | ret = visualRect(cb->direction, cb->rect, ret); | - | ||||||||||||||||||||||||
| 4149 | } | - | ||||||||||||||||||||||||
| 4150 | break; | - | ||||||||||||||||||||||||
| 4151 | #endif // QT_NO_COMBOBOX | - | ||||||||||||||||||||||||
| 4152 | case CC_TitleBar: | - | ||||||||||||||||||||||||
| 4153 | if (const QStyleOptionTitleBar *tb = qstyleoption_cast<const QStyleOptionTitleBar *>(opt)) { | - | ||||||||||||||||||||||||
| 4154 | const int controlMargin = 2; | - | ||||||||||||||||||||||||
| 4155 | const int controlHeight = tb->rect.height() - controlMargin *2; | - | ||||||||||||||||||||||||
| 4156 | const int delta = controlHeight + controlMargin; | - | ||||||||||||||||||||||||
| 4157 | int offset = 0; | - | ||||||||||||||||||||||||
| 4158 | - | |||||||||||||||||||||||||
| 4159 | bool isMinimized = tb->titleBarState & Qt::WindowMinimized; | - | ||||||||||||||||||||||||
| 4160 | bool isMaximized = tb->titleBarState & Qt::WindowMaximized; | - | ||||||||||||||||||||||||
| 4161 | - | |||||||||||||||||||||||||
| 4162 | switch (sc) { | - | ||||||||||||||||||||||||
| 4163 | case SC_TitleBarLabel: | - | ||||||||||||||||||||||||
| 4164 | if (tb->titleBarFlags & (Qt::WindowTitleHint | Qt::WindowSystemMenuHint)) { | - | ||||||||||||||||||||||||
| 4165 | ret = tb->rect; | - | ||||||||||||||||||||||||
| 4166 | if (tb->titleBarFlags & Qt::WindowSystemMenuHint) | - | ||||||||||||||||||||||||
| 4167 | ret.adjust(delta, 0, -delta, 0); | - | ||||||||||||||||||||||||
| 4168 | if (tb->titleBarFlags & Qt::WindowMinimizeButtonHint) | - | ||||||||||||||||||||||||
| 4169 | ret.adjust(0, 0, -delta, 0); | - | ||||||||||||||||||||||||
| 4170 | if (tb->titleBarFlags & Qt::WindowMaximizeButtonHint) | - | ||||||||||||||||||||||||
| 4171 | ret.adjust(0, 0, -delta, 0); | - | ||||||||||||||||||||||||
| 4172 | if (tb->titleBarFlags & Qt::WindowShadeButtonHint) | - | ||||||||||||||||||||||||
| 4173 | ret.adjust(0, 0, -delta, 0); | - | ||||||||||||||||||||||||
| 4174 | if (tb->titleBarFlags & Qt::WindowContextHelpButtonHint) | - | ||||||||||||||||||||||||
| 4175 | ret.adjust(0, 0, -delta, 0); | - | ||||||||||||||||||||||||
| 4176 | } | - | ||||||||||||||||||||||||
| 4177 | break; | - | ||||||||||||||||||||||||
| 4178 | case SC_TitleBarContextHelpButton: | - | ||||||||||||||||||||||||
| 4179 | if (tb->titleBarFlags & Qt::WindowContextHelpButtonHint) | - | ||||||||||||||||||||||||
| 4180 | offset += delta; | - | ||||||||||||||||||||||||
| 4181 | case SC_TitleBarMinButton: | - | ||||||||||||||||||||||||
| 4182 | if (!isMinimized && (tb->titleBarFlags & Qt::WindowMinimizeButtonHint)) | - | ||||||||||||||||||||||||
| 4183 | offset += delta; | - | ||||||||||||||||||||||||
| 4184 | else if (sc == SC_TitleBarMinButton) | - | ||||||||||||||||||||||||
| 4185 | break; | - | ||||||||||||||||||||||||
| 4186 | case SC_TitleBarNormalButton: | - | ||||||||||||||||||||||||
| 4187 | if (isMinimized && (tb->titleBarFlags & Qt::WindowMinimizeButtonHint)) | - | ||||||||||||||||||||||||
| 4188 | offset += delta; | - | ||||||||||||||||||||||||
| 4189 | else if (isMaximized && (tb->titleBarFlags & Qt::WindowMaximizeButtonHint)) | - | ||||||||||||||||||||||||
| 4190 | offset += delta; | - | ||||||||||||||||||||||||
| 4191 | else if (sc == SC_TitleBarNormalButton) | - | ||||||||||||||||||||||||
| 4192 | break; | - | ||||||||||||||||||||||||
| 4193 | case SC_TitleBarMaxButton: | - | ||||||||||||||||||||||||
| 4194 | if (!isMaximized && (tb->titleBarFlags & Qt::WindowMaximizeButtonHint)) | - | ||||||||||||||||||||||||
| 4195 | offset += delta; | - | ||||||||||||||||||||||||
| 4196 | else if (sc == SC_TitleBarMaxButton) | - | ||||||||||||||||||||||||
| 4197 | break; | - | ||||||||||||||||||||||||
| 4198 | case SC_TitleBarShadeButton: | - | ||||||||||||||||||||||||
| 4199 | if (!isMinimized && (tb->titleBarFlags & Qt::WindowShadeButtonHint)) | - | ||||||||||||||||||||||||
| 4200 | offset += delta; | - | ||||||||||||||||||||||||
| 4201 | else if (sc == SC_TitleBarShadeButton) | - | ||||||||||||||||||||||||
| 4202 | break; | - | ||||||||||||||||||||||||
| 4203 | case SC_TitleBarUnshadeButton: | - | ||||||||||||||||||||||||
| 4204 | if (isMinimized && (tb->titleBarFlags & Qt::WindowShadeButtonHint)) | - | ||||||||||||||||||||||||
| 4205 | offset += delta; | - | ||||||||||||||||||||||||
| 4206 | else if (sc == SC_TitleBarUnshadeButton) | - | ||||||||||||||||||||||||
| 4207 | break; | - | ||||||||||||||||||||||||
| 4208 | case SC_TitleBarCloseButton: | - | ||||||||||||||||||||||||
| 4209 | if (tb->titleBarFlags & Qt::WindowSystemMenuHint) | - | ||||||||||||||||||||||||
| 4210 | offset += delta; | - | ||||||||||||||||||||||||
| 4211 | else if (sc == SC_TitleBarCloseButton) | - | ||||||||||||||||||||||||
| 4212 | break; | - | ||||||||||||||||||||||||
| 4213 | ret.setRect(tb->rect.right() - offset, tb->rect.top() + controlMargin, | - | ||||||||||||||||||||||||
| 4214 | controlHeight, controlHeight); | - | ||||||||||||||||||||||||
| 4215 | break; | - | ||||||||||||||||||||||||
| 4216 | case SC_TitleBarSysMenu: | - | ||||||||||||||||||||||||
| 4217 | if (tb->titleBarFlags & Qt::WindowSystemMenuHint) { | - | ||||||||||||||||||||||||
| 4218 | ret.setRect(tb->rect.left() + controlMargin, tb->rect.top() + controlMargin, | - | ||||||||||||||||||||||||
| 4219 | controlHeight, controlHeight); | - | ||||||||||||||||||||||||
| 4220 | } | - | ||||||||||||||||||||||||
| 4221 | break; | - | ||||||||||||||||||||||||
| 4222 | default: | - | ||||||||||||||||||||||||
| 4223 | break; | - | ||||||||||||||||||||||||
| 4224 | } | - | ||||||||||||||||||||||||
| 4225 | ret = visualRect(tb->direction, tb->rect, ret); | - | ||||||||||||||||||||||||
| 4226 | } | - | ||||||||||||||||||||||||
| 4227 | break; | - | ||||||||||||||||||||||||
| 4228 | #ifndef QT_NO_GROUPBOX | - | ||||||||||||||||||||||||
| 4229 | case CC_GroupBox: { | - | ||||||||||||||||||||||||
| 4230 | if (const QStyleOptionGroupBox *groupBox = qstyleoption_cast<const QStyleOptionGroupBox *>(opt)) { | - | ||||||||||||||||||||||||
| 4231 | switch (sc) { | - | ||||||||||||||||||||||||
| 4232 | case SC_GroupBoxFrame: | - | ||||||||||||||||||||||||
| 4233 | // FALL THROUGH | - | ||||||||||||||||||||||||
| 4234 | case SC_GroupBoxContents: { | - | ||||||||||||||||||||||||
| 4235 | int topMargin = 0; | - | ||||||||||||||||||||||||
| 4236 | int topHeight = 0; | - | ||||||||||||||||||||||||
| 4237 | int verticalAlignment = proxy()->styleHint(SH_GroupBox_TextLabelVerticalAlignment, groupBox, widget); | - | ||||||||||||||||||||||||
| 4238 | if (groupBox->text.size() || (groupBox->subControls & QStyle::SC_GroupBoxCheckBox)) { | - | ||||||||||||||||||||||||
| 4239 | topHeight = groupBox->fontMetrics.height(); | - | ||||||||||||||||||||||||
| 4240 | if (verticalAlignment & Qt::AlignVCenter) | - | ||||||||||||||||||||||||
| 4241 | topMargin = topHeight / 2; | - | ||||||||||||||||||||||||
| 4242 | else if (verticalAlignment & Qt::AlignTop) | - | ||||||||||||||||||||||||
| 4243 | topMargin = topHeight; | - | ||||||||||||||||||||||||
| 4244 | } | - | ||||||||||||||||||||||||
| 4245 | - | |||||||||||||||||||||||||
| 4246 | QRect frameRect = groupBox->rect; | - | ||||||||||||||||||||||||
| 4247 | frameRect.setTop(topMargin); | - | ||||||||||||||||||||||||
| 4248 | - | |||||||||||||||||||||||||
| 4249 | if (sc == SC_GroupBoxFrame) { | - | ||||||||||||||||||||||||
| 4250 | ret = frameRect; | - | ||||||||||||||||||||||||
| 4251 | break; | - | ||||||||||||||||||||||||
| 4252 | } | - | ||||||||||||||||||||||||
| 4253 | - | |||||||||||||||||||||||||
| 4254 | int frameWidth = 0; | - | ||||||||||||||||||||||||
| 4255 | if ((groupBox->features & QStyleOptionFrame::Flat) == 0) | - | ||||||||||||||||||||||||
| 4256 | frameWidth = proxy()->pixelMetric(PM_DefaultFrameWidth, groupBox, widget); | - | ||||||||||||||||||||||||
| 4257 | ret = frameRect.adjusted(frameWidth, frameWidth + topHeight - topMargin, | - | ||||||||||||||||||||||||
| 4258 | -frameWidth, -frameWidth); | - | ||||||||||||||||||||||||
| 4259 | break; | - | ||||||||||||||||||||||||
| 4260 | } | - | ||||||||||||||||||||||||
| 4261 | case SC_GroupBoxCheckBox: | - | ||||||||||||||||||||||||
| 4262 | // FALL THROUGH | - | ||||||||||||||||||||||||
| 4263 | case SC_GroupBoxLabel: { | - | ||||||||||||||||||||||||
| 4264 | QFontMetrics fontMetrics = groupBox->fontMetrics; | - | ||||||||||||||||||||||||
| 4265 | int h = fontMetrics.height(); | - | ||||||||||||||||||||||||
| 4266 | int tw = fontMetrics.size(Qt::TextShowMnemonic, groupBox->text + QLatin1Char(' ')).width(); | - | ||||||||||||||||||||||||
| 4267 | int marg = (groupBox->features & QStyleOptionFrame::Flat) ? 0 : 8; | - | ||||||||||||||||||||||||
| 4268 | ret = groupBox->rect.adjusted(marg, 0, -marg, 0); | - | ||||||||||||||||||||||||
| 4269 | ret.setHeight(h); | - | ||||||||||||||||||||||||
| 4270 | - | |||||||||||||||||||||||||
| 4271 | int indicatorWidth = proxy()->pixelMetric(PM_IndicatorWidth, opt, widget); | - | ||||||||||||||||||||||||
| 4272 | int indicatorSpace = proxy()->pixelMetric(PM_CheckBoxLabelSpacing, opt, widget) - 1; | - | ||||||||||||||||||||||||
| 4273 | bool hasCheckBox = groupBox->subControls & QStyle::SC_GroupBoxCheckBox; | - | ||||||||||||||||||||||||
| 4274 | int checkBoxSize = hasCheckBox ? (indicatorWidth + indicatorSpace) : 0; | - | ||||||||||||||||||||||||
| 4275 | - | |||||||||||||||||||||||||
| 4276 | // Adjusted rect for label + indicatorWidth + indicatorSpace | - | ||||||||||||||||||||||||
| 4277 | QRect totalRect = alignedRect(groupBox->direction, groupBox->textAlignment, | - | ||||||||||||||||||||||||
| 4278 | QSize(tw + checkBoxSize, h), ret); | - | ||||||||||||||||||||||||
| 4279 | - | |||||||||||||||||||||||||
| 4280 | // Adjust totalRect if checkbox is set | - | ||||||||||||||||||||||||
| 4281 | if (hasCheckBox) { | - | ||||||||||||||||||||||||
| 4282 | bool ltr = groupBox->direction == Qt::LeftToRight; | - | ||||||||||||||||||||||||
| 4283 | int left = 0; | - | ||||||||||||||||||||||||
| 4284 | // Adjust for check box | - | ||||||||||||||||||||||||
| 4285 | if (sc == SC_GroupBoxCheckBox) { | - | ||||||||||||||||||||||||
| 4286 | int indicatorHeight = proxy()->pixelMetric(PM_IndicatorHeight, opt, widget); | - | ||||||||||||||||||||||||
| 4287 | left = ltr ? totalRect.left() : (totalRect.right() - indicatorWidth); | - | ||||||||||||||||||||||||
| 4288 | int top = totalRect.top() + qMax(0, fontMetrics.height() - indicatorHeight) / 2; | - | ||||||||||||||||||||||||
| 4289 | totalRect.setRect(left, top, indicatorWidth, indicatorHeight); | - | ||||||||||||||||||||||||
| 4290 | // Adjust for label | - | ||||||||||||||||||||||||
| 4291 | } else { | - | ||||||||||||||||||||||||
| 4292 | left = ltr ? (totalRect.left() + checkBoxSize - 2) : totalRect.left(); | - | ||||||||||||||||||||||||
| 4293 | totalRect.setRect(left, totalRect.top(), | - | ||||||||||||||||||||||||
| 4294 | totalRect.width() - checkBoxSize, totalRect.height()); | - | ||||||||||||||||||||||||
| 4295 | } | - | ||||||||||||||||||||||||
| 4296 | } | - | ||||||||||||||||||||||||
| 4297 | ret = totalRect; | - | ||||||||||||||||||||||||
| 4298 | break; | - | ||||||||||||||||||||||||
| 4299 | } | - | ||||||||||||||||||||||||
| 4300 | default: | - | ||||||||||||||||||||||||
| 4301 | break; | - | ||||||||||||||||||||||||
| 4302 | } | - | ||||||||||||||||||||||||
| 4303 | } | - | ||||||||||||||||||||||||
| 4304 | break; | - | ||||||||||||||||||||||||
| 4305 | } | - | ||||||||||||||||||||||||
| 4306 | #endif // QT_NO_GROUPBOX | - | ||||||||||||||||||||||||
| 4307 | #ifndef QT_NO_MDIAREA | - | ||||||||||||||||||||||||
| 4308 | case CC_MdiControls: | - | ||||||||||||||||||||||||
| 4309 | { | - | ||||||||||||||||||||||||
| 4310 | int numSubControls = 0; | - | ||||||||||||||||||||||||
| 4311 | if (opt->subControls & SC_MdiCloseButton) | - | ||||||||||||||||||||||||
| 4312 | ++numSubControls; | - | ||||||||||||||||||||||||
| 4313 | if (opt->subControls & SC_MdiMinButton) | - | ||||||||||||||||||||||||
| 4314 | ++numSubControls; | - | ||||||||||||||||||||||||
| 4315 | if (opt->subControls & SC_MdiNormalButton) | - | ||||||||||||||||||||||||
| 4316 | ++numSubControls; | - | ||||||||||||||||||||||||
| 4317 | if (numSubControls == 0) | - | ||||||||||||||||||||||||
| 4318 | break; | - | ||||||||||||||||||||||||
| 4319 | - | |||||||||||||||||||||||||
| 4320 | int buttonWidth = opt->rect.width() / numSubControls - 1; | - | ||||||||||||||||||||||||
| 4321 | int offset = 0; | - | ||||||||||||||||||||||||
| 4322 | switch (sc) { | - | ||||||||||||||||||||||||
| 4323 | case SC_MdiCloseButton: | - | ||||||||||||||||||||||||
| 4324 | // Only one sub control, no offset needed. | - | ||||||||||||||||||||||||
| 4325 | if (numSubControls == 1) | - | ||||||||||||||||||||||||
| 4326 | break; | - | ||||||||||||||||||||||||
| 4327 | offset += buttonWidth + 2; | - | ||||||||||||||||||||||||
| 4328 | //FALL THROUGH | - | ||||||||||||||||||||||||
| 4329 | case SC_MdiNormalButton: | - | ||||||||||||||||||||||||
| 4330 | // No offset needed if | - | ||||||||||||||||||||||||
| 4331 | // 1) There's only one sub control | - | ||||||||||||||||||||||||
| 4332 | // 2) We have a close button and a normal button (offset already added in SC_MdiClose) | - | ||||||||||||||||||||||||
| 4333 | if (numSubControls == 1 || (numSubControls == 2 && !(opt->subControls & SC_MdiMinButton))) | - | ||||||||||||||||||||||||
| 4334 | break; | - | ||||||||||||||||||||||||
| 4335 | if (opt->subControls & SC_MdiNormalButton) | - | ||||||||||||||||||||||||
| 4336 | offset += buttonWidth; | - | ||||||||||||||||||||||||
| 4337 | break; | - | ||||||||||||||||||||||||
| 4338 | default: | - | ||||||||||||||||||||||||
| 4339 | break; | - | ||||||||||||||||||||||||
| 4340 | } | - | ||||||||||||||||||||||||
| 4341 | - | |||||||||||||||||||||||||
| 4342 | // Subtract one pixel if we only have one sub control. At this point | - | ||||||||||||||||||||||||
| 4343 | // buttonWidth is the actual width + 1 pixel margin, but we don't want the | - | ||||||||||||||||||||||||
| 4344 | // margin when there are no other controllers. | - | ||||||||||||||||||||||||
| 4345 | if (numSubControls == 1) | - | ||||||||||||||||||||||||
| 4346 | --buttonWidth; | - | ||||||||||||||||||||||||
| 4347 | ret = QRect(offset, 0, buttonWidth, opt->rect.height()); | - | ||||||||||||||||||||||||
| 4348 | break; | - | ||||||||||||||||||||||||
| 4349 | } | - | ||||||||||||||||||||||||
| 4350 | #endif // QT_NO_MDIAREA | - | ||||||||||||||||||||||||
| 4351 | default: | - | ||||||||||||||||||||||||
| 4352 | qWarning("QCommonStyle::subControlRect: Case %d not handled", cc); | - | ||||||||||||||||||||||||
| 4353 | } | - | ||||||||||||||||||||||||
| 4354 | return ret; | - | ||||||||||||||||||||||||
| 4355 | } | - | ||||||||||||||||||||||||
| 4356 | - | |||||||||||||||||||||||||
| 4357 | /*! \reimp */ | - | ||||||||||||||||||||||||
| 4358 | int QCommonStyle::pixelMetric(PixelMetric m, const QStyleOption *opt, const QWidget *widget) const | - | ||||||||||||||||||||||||
| 4359 | { | - | ||||||||||||||||||||||||
| 4360 | int ret; | - | ||||||||||||||||||||||||
| 4361 | - | |||||||||||||||||||||||||
| 4362 | switch (m) { | - | ||||||||||||||||||||||||
| 4363 | case PM_FocusFrameVMargin: | - | ||||||||||||||||||||||||
| 4364 | case PM_FocusFrameHMargin: | - | ||||||||||||||||||||||||
| 4365 | ret = 2; | - | ||||||||||||||||||||||||
| 4366 | break; | - | ||||||||||||||||||||||||
| 4367 | case PM_MenuBarVMargin: | - | ||||||||||||||||||||||||
| 4368 | case PM_MenuBarHMargin: | - | ||||||||||||||||||||||||
| 4369 | ret = 0; | - | ||||||||||||||||||||||||
| 4370 | break; | - | ||||||||||||||||||||||||
| 4371 | case PM_DialogButtonsSeparator: | - | ||||||||||||||||||||||||
| 4372 | ret = int(QStyleHelper::dpiScaled(5.)); | - | ||||||||||||||||||||||||
| 4373 | break; | - | ||||||||||||||||||||||||
| 4374 | case PM_DialogButtonsButtonWidth: | - | ||||||||||||||||||||||||
| 4375 | ret = int(QStyleHelper::dpiScaled(70.)); | - | ||||||||||||||||||||||||
| 4376 | break; | - | ||||||||||||||||||||||||
| 4377 | case PM_DialogButtonsButtonHeight: | - | ||||||||||||||||||||||||
| 4378 | ret = int(QStyleHelper::dpiScaled(30.)); | - | ||||||||||||||||||||||||
| 4379 | break; | - | ||||||||||||||||||||||||
| 4380 | case PM_TitleBarHeight: { | - | ||||||||||||||||||||||||
| 4381 | if (const QStyleOptionTitleBar *tb = qstyleoption_cast<const QStyleOptionTitleBar *>(opt)) { | - | ||||||||||||||||||||||||
| 4382 | if ((tb->titleBarFlags & Qt::WindowType_Mask) == Qt::Tool) { | - | ||||||||||||||||||||||||
| 4383 | ret = qMax(widget ? widget->fontMetrics().height() : opt->fontMetrics.height(), 16); | - | ||||||||||||||||||||||||
| 4384 | #ifndef QT_NO_DOCKWIDGET | - | ||||||||||||||||||||||||
| 4385 | } else if (qobject_cast<const QDockWidget*>(widget)) { | - | ||||||||||||||||||||||||
| 4386 | ret = qMax(widget->fontMetrics().height(), int(QStyleHelper::dpiScaled(13))); | - | ||||||||||||||||||||||||
| 4387 | #endif | - | ||||||||||||||||||||||||
| 4388 | } else { | - | ||||||||||||||||||||||||
| 4389 | ret = qMax(widget ? widget->fontMetrics().height() : opt->fontMetrics.height(), 18); | - | ||||||||||||||||||||||||
| 4390 | } | - | ||||||||||||||||||||||||
| 4391 | } else { | - | ||||||||||||||||||||||||
| 4392 | ret = int(QStyleHelper::dpiScaled(18.)); | - | ||||||||||||||||||||||||
| 4393 | } | - | ||||||||||||||||||||||||
| 4394 | - | |||||||||||||||||||||||||
| 4395 | break; } | - | ||||||||||||||||||||||||
| 4396 | case PM_ScrollBarSliderMin: | - | ||||||||||||||||||||||||
| 4397 | ret = int(QStyleHelper::dpiScaled(9.)); | - | ||||||||||||||||||||||||
| 4398 | break; | - | ||||||||||||||||||||||||
| 4399 | - | |||||||||||||||||||||||||
| 4400 | case PM_ButtonMargin: | - | ||||||||||||||||||||||||
| 4401 | ret = int(QStyleHelper::dpiScaled(6.)); | - | ||||||||||||||||||||||||
| 4402 | break; | - | ||||||||||||||||||||||||
| 4403 | - | |||||||||||||||||||||||||
| 4404 | case PM_DockWidgetTitleBarButtonMargin: | - | ||||||||||||||||||||||||
| 4405 | ret = int(QStyleHelper::dpiScaled(2.)); | - | ||||||||||||||||||||||||
| 4406 | break; | - | ||||||||||||||||||||||||
| 4407 | - | |||||||||||||||||||||||||
| 4408 | case PM_ButtonDefaultIndicator: | - | ||||||||||||||||||||||||
| 4409 | ret = 0; | - | ||||||||||||||||||||||||
| 4410 | break; | - | ||||||||||||||||||||||||
| 4411 | - | |||||||||||||||||||||||||
| 4412 | case PM_MenuButtonIndicator: | - | ||||||||||||||||||||||||
| 4413 | ret = int(QStyleHelper::dpiScaled(12.)); | - | ||||||||||||||||||||||||
| 4414 | break; | - | ||||||||||||||||||||||||
| 4415 | - | |||||||||||||||||||||||||
| 4416 | case PM_ButtonShiftHorizontal: | - | ||||||||||||||||||||||||
| 4417 | case PM_ButtonShiftVertical: | - | ||||||||||||||||||||||||
| 4418 | - | |||||||||||||||||||||||||
| 4419 | case PM_DefaultFrameWidth: | - | ||||||||||||||||||||||||
| 4420 | ret = 2; | - | ||||||||||||||||||||||||
| 4421 | break; | - | ||||||||||||||||||||||||
| 4422 | - | |||||||||||||||||||||||||
| 4423 | case PM_ComboBoxFrameWidth: | - | ||||||||||||||||||||||||
| 4424 | case PM_SpinBoxFrameWidth: | - | ||||||||||||||||||||||||
| 4425 | case PM_MenuPanelWidth: | - | ||||||||||||||||||||||||
| 4426 | case PM_TabBarBaseOverlap: | - | ||||||||||||||||||||||||
| 4427 | case PM_TabBarBaseHeight: | - | ||||||||||||||||||||||||
| 4428 | ret = proxy()->pixelMetric(PM_DefaultFrameWidth, opt, widget); | - | ||||||||||||||||||||||||
| 4429 | break; | - | ||||||||||||||||||||||||
| 4430 | - | |||||||||||||||||||||||||
| 4431 | case PM_MdiSubWindowFrameWidth: | - | ||||||||||||||||||||||||
| 4432 | ret = int(QStyleHelper::dpiScaled(4.)); | - | ||||||||||||||||||||||||
| 4433 | break; | - | ||||||||||||||||||||||||
| 4434 | - | |||||||||||||||||||||||||
| 4435 | case PM_MdiSubWindowMinimizedWidth: | - | ||||||||||||||||||||||||
| 4436 | ret = int(QStyleHelper::dpiScaled(196.)); | - | ||||||||||||||||||||||||
| 4437 | break; | - | ||||||||||||||||||||||||
| 4438 | - | |||||||||||||||||||||||||
| 4439 | #ifndef QT_NO_SCROLLBAR | - | ||||||||||||||||||||||||
| 4440 | case PM_ScrollBarExtent: | - | ||||||||||||||||||||||||
| 4441 | if (const QStyleOptionSlider *sb = qstyleoption_cast<const QStyleOptionSlider *>(opt)) { | - | ||||||||||||||||||||||||
| 4442 | int s = sb->orientation == Qt::Horizontal ? | - | ||||||||||||||||||||||||
| 4443 | QApplication::globalStrut().height() | - | ||||||||||||||||||||||||
| 4444 | : QApplication::globalStrut().width(); | - | ||||||||||||||||||||||||
| 4445 | ret = qMax(16, s); | - | ||||||||||||||||||||||||
| 4446 | } else { | - | ||||||||||||||||||||||||
| 4447 | ret = int(QStyleHelper::dpiScaled(16.)); | - | ||||||||||||||||||||||||
| 4448 | } | - | ||||||||||||||||||||||||
| 4449 | break; | - | ||||||||||||||||||||||||
| 4450 | #endif | - | ||||||||||||||||||||||||
| 4451 | case PM_MaximumDragDistance: | - | ||||||||||||||||||||||||
| 4452 | ret = QGuiApplicationPrivate::platformTheme()->themeHint(QPlatformTheme::MaximumScrollBarDragDistance).toInt(); | - | ||||||||||||||||||||||||
| 4453 | break; | - | ||||||||||||||||||||||||
| 4454 | - | |||||||||||||||||||||||||
| 4455 | #ifndef QT_NO_SLIDER | - | ||||||||||||||||||||||||
| 4456 | case PM_SliderThickness: | - | ||||||||||||||||||||||||
| 4457 | ret = int(QStyleHelper::dpiScaled(16.)); | - | ||||||||||||||||||||||||
| 4458 | break; | - | ||||||||||||||||||||||||
| 4459 | - | |||||||||||||||||||||||||
| 4460 | case PM_SliderTickmarkOffset: | - | ||||||||||||||||||||||||
| 4461 | if (const QStyleOptionSlider *sl = qstyleoption_cast<const QStyleOptionSlider *>(opt)) { | - | ||||||||||||||||||||||||
| 4462 | int space = (sl->orientation == Qt::Horizontal) ? sl->rect.height() | - | ||||||||||||||||||||||||
| 4463 | : sl->rect.width(); | - | ||||||||||||||||||||||||
| 4464 | int thickness = proxy()->pixelMetric(PM_SliderControlThickness, sl, widget); | - | ||||||||||||||||||||||||
| 4465 | int ticks = sl->tickPosition; | - | ||||||||||||||||||||||||
| 4466 | - | |||||||||||||||||||||||||
| 4467 | if (ticks == QSlider::TicksBothSides) | - | ||||||||||||||||||||||||
| 4468 | ret = (space - thickness) / 2; | - | ||||||||||||||||||||||||
| 4469 | else if (ticks == QSlider::TicksAbove) | - | ||||||||||||||||||||||||
| 4470 | ret = space - thickness; | - | ||||||||||||||||||||||||
| 4471 | else | - | ||||||||||||||||||||||||
| 4472 | ret = 0; | - | ||||||||||||||||||||||||
| 4473 | } else { | - | ||||||||||||||||||||||||
| 4474 | ret = 0; | - | ||||||||||||||||||||||||
| 4475 | } | - | ||||||||||||||||||||||||
| 4476 | break; | - | ||||||||||||||||||||||||
| 4477 | - | |||||||||||||||||||||||||
| 4478 | case PM_SliderSpaceAvailable: | - | ||||||||||||||||||||||||
| 4479 | if (const QStyleOptionSlider *sl = qstyleoption_cast<const QStyleOptionSlider *>(opt)) { | - | ||||||||||||||||||||||||
| 4480 | if (sl->orientation == Qt::Horizontal) | - | ||||||||||||||||||||||||
| 4481 | ret = sl->rect.width() - proxy()->pixelMetric(PM_SliderLength, sl, widget); | - | ||||||||||||||||||||||||
| 4482 | else | - | ||||||||||||||||||||||||
| 4483 | ret = sl->rect.height() - proxy()->pixelMetric(PM_SliderLength, sl, widget); | - | ||||||||||||||||||||||||
| 4484 | } else { | - | ||||||||||||||||||||||||
| 4485 | ret = 0; | - | ||||||||||||||||||||||||
| 4486 | } | - | ||||||||||||||||||||||||
| 4487 | break; | - | ||||||||||||||||||||||||
| 4488 | #endif // QT_NO_SLIDER | - | ||||||||||||||||||||||||
| 4489 | #ifndef QT_NO_DOCKWIDGET | - | ||||||||||||||||||||||||
| 4490 | case PM_DockWidgetSeparatorExtent: | - | ||||||||||||||||||||||||
| 4491 | ret = int(QStyleHelper::dpiScaled(6.)); | - | ||||||||||||||||||||||||
| 4492 | break; | - | ||||||||||||||||||||||||
| 4493 | - | |||||||||||||||||||||||||
| 4494 | case PM_DockWidgetHandleExtent: | - | ||||||||||||||||||||||||
| 4495 | ret = int(QStyleHelper::dpiScaled(8.)); | - | ||||||||||||||||||||||||
| 4496 | break; | - | ||||||||||||||||||||||||
| 4497 | case PM_DockWidgetTitleMargin: | - | ||||||||||||||||||||||||
| 4498 | ret = 0; | - | ||||||||||||||||||||||||
| 4499 | break; | - | ||||||||||||||||||||||||
| 4500 | case PM_DockWidgetFrameWidth: | - | ||||||||||||||||||||||||
| 4501 | ret = 1; | - | ||||||||||||||||||||||||
| 4502 | break; | - | ||||||||||||||||||||||||
| 4503 | #endif // QT_NO_DOCKWIDGET | - | ||||||||||||||||||||||||
| 4504 | - | |||||||||||||||||||||||||
| 4505 | case PM_SpinBoxSliderHeight: | - | ||||||||||||||||||||||||
| 4506 | case PM_MenuBarPanelWidth: | - | ||||||||||||||||||||||||
| 4507 | ret = 2; | - | ||||||||||||||||||||||||
| 4508 | break; | - | ||||||||||||||||||||||||
| 4509 | - | |||||||||||||||||||||||||
| 4510 | case PM_MenuBarItemSpacing: | - | ||||||||||||||||||||||||
| 4511 | ret = 0; | - | ||||||||||||||||||||||||
| 4512 | break; | - | ||||||||||||||||||||||||
| 4513 | - | |||||||||||||||||||||||||
| 4514 | #ifndef QT_NO_TOOLBAR | - | ||||||||||||||||||||||||
| 4515 | case PM_ToolBarFrameWidth: | - | ||||||||||||||||||||||||
| 4516 | ret = 1; | - | ||||||||||||||||||||||||
| 4517 | break; | - | ||||||||||||||||||||||||
| 4518 | - | |||||||||||||||||||||||||
| 4519 | case PM_ToolBarItemMargin: | - | ||||||||||||||||||||||||
| 4520 | ret = 0; | - | ||||||||||||||||||||||||
| 4521 | break; | - | ||||||||||||||||||||||||
| 4522 | - | |||||||||||||||||||||||||
| 4523 | case PM_ToolBarItemSpacing: | - | ||||||||||||||||||||||||
| 4524 | ret = int(QStyleHelper::dpiScaled(4.)); | - | ||||||||||||||||||||||||
| 4525 | break; | - | ||||||||||||||||||||||||
| 4526 | - | |||||||||||||||||||||||||
| 4527 | case PM_ToolBarHandleExtent: | - | ||||||||||||||||||||||||
| 4528 | ret = int(QStyleHelper::dpiScaled(8.)); | - | ||||||||||||||||||||||||
| 4529 | break; | - | ||||||||||||||||||||||||
| 4530 | - | |||||||||||||||||||||||||
| 4531 | case PM_ToolBarSeparatorExtent: | - | ||||||||||||||||||||||||
| 4532 | ret = int(QStyleHelper::dpiScaled(6.)); | - | ||||||||||||||||||||||||
| 4533 | break; | - | ||||||||||||||||||||||||
| 4534 | - | |||||||||||||||||||||||||
| 4535 | case PM_ToolBarExtensionExtent: | - | ||||||||||||||||||||||||
| 4536 | ret = int(QStyleHelper::dpiScaled(12.)); | - | ||||||||||||||||||||||||
| 4537 | break; | - | ||||||||||||||||||||||||
| 4538 | #endif // QT_NO_TOOLBAR | - | ||||||||||||||||||||||||
| 4539 | - | |||||||||||||||||||||||||
| 4540 | #ifndef QT_NO_TABBAR | - | ||||||||||||||||||||||||
| 4541 | case PM_TabBarTabOverlap: | - | ||||||||||||||||||||||||
| 4542 | ret = 3; | - | ||||||||||||||||||||||||
| 4543 | break; | - | ||||||||||||||||||||||||
| 4544 | - | |||||||||||||||||||||||||
| 4545 | case PM_TabBarTabHSpace: | - | ||||||||||||||||||||||||
| 4546 | ret = int(QStyleHelper::dpiScaled(24.)); | - | ||||||||||||||||||||||||
| 4547 | break; | - | ||||||||||||||||||||||||
| 4548 | - | |||||||||||||||||||||||||
| 4549 | case PM_TabBarTabShiftHorizontal: | - | ||||||||||||||||||||||||
| 4550 | ret = 0; | - | ||||||||||||||||||||||||
| 4551 | break; | - | ||||||||||||||||||||||||
| 4552 | - | |||||||||||||||||||||||||
| 4553 | case PM_TabBarTabShiftVertical: | - | ||||||||||||||||||||||||
| 4554 | ret = 2; | - | ||||||||||||||||||||||||
| 4555 | break; | - | ||||||||||||||||||||||||
| 4556 | - | |||||||||||||||||||||||||
| 4557 | case PM_TabBarTabVSpace: { | - | ||||||||||||||||||||||||
| 4558 | const QStyleOptionTab *tb = qstyleoption_cast<const QStyleOptionTab *>(opt); | - | ||||||||||||||||||||||||
| 4559 | if (tb && (tb->shape == QTabBar::RoundedNorth || tb->shape == QTabBar::RoundedSouth | - | ||||||||||||||||||||||||
| 4560 | || tb->shape == QTabBar::RoundedWest || tb->shape == QTabBar::RoundedEast)) | - | ||||||||||||||||||||||||
| 4561 | ret = 8; | - | ||||||||||||||||||||||||
| 4562 | else | - | ||||||||||||||||||||||||
| 4563 | if(tb && (tb->shape == QTabBar::TriangularWest || tb->shape == QTabBar::TriangularEast)) | - | ||||||||||||||||||||||||
| 4564 | ret = 3; | - | ||||||||||||||||||||||||
| 4565 | else | - | ||||||||||||||||||||||||
| 4566 | ret = 2; | - | ||||||||||||||||||||||||
| 4567 | break; } | - | ||||||||||||||||||||||||
| 4568 | #endif | - | ||||||||||||||||||||||||
| 4569 | - | |||||||||||||||||||||||||
| 4570 | case PM_ProgressBarChunkWidth: | - | ||||||||||||||||||||||||
| 4571 | ret = 9; | - | ||||||||||||||||||||||||
| 4572 | break; | - | ||||||||||||||||||||||||
| 4573 | - | |||||||||||||||||||||||||
| 4574 | case PM_IndicatorWidth: | - | ||||||||||||||||||||||||
| 4575 | ret = int(QStyleHelper::dpiScaled(13.)); | - | ||||||||||||||||||||||||
| 4576 | break; | - | ||||||||||||||||||||||||
| 4577 | - | |||||||||||||||||||||||||
| 4578 | case PM_IndicatorHeight: | - | ||||||||||||||||||||||||
| 4579 | ret = int(QStyleHelper::dpiScaled(13.)); | - | ||||||||||||||||||||||||
| 4580 | break; | - | ||||||||||||||||||||||||
| 4581 | - | |||||||||||||||||||||||||
| 4582 | case PM_ExclusiveIndicatorWidth: | - | ||||||||||||||||||||||||
| 4583 | ret = int(QStyleHelper::dpiScaled(12.)); | - | ||||||||||||||||||||||||
| 4584 | break; | - | ||||||||||||||||||||||||
| 4585 | - | |||||||||||||||||||||||||
| 4586 | case PM_ExclusiveIndicatorHeight: | - | ||||||||||||||||||||||||
| 4587 | ret = int(QStyleHelper::dpiScaled(12.)); | - | ||||||||||||||||||||||||
| 4588 | break; | - | ||||||||||||||||||||||||
| 4589 | - | |||||||||||||||||||||||||
| 4590 | case PM_MenuTearoffHeight: | - | ||||||||||||||||||||||||
| 4591 | ret = int(QStyleHelper::dpiScaled(10.)); | - | ||||||||||||||||||||||||
| 4592 | break; | - | ||||||||||||||||||||||||
| 4593 | - | |||||||||||||||||||||||||
| 4594 | case PM_MenuScrollerHeight: | - | ||||||||||||||||||||||||
| 4595 | ret = int(QStyleHelper::dpiScaled(10.)); | - | ||||||||||||||||||||||||
| 4596 | break; | - | ||||||||||||||||||||||||
| 4597 | - | |||||||||||||||||||||||||
| 4598 | case PM_MenuDesktopFrameWidth: | - | ||||||||||||||||||||||||
| 4599 | case PM_MenuHMargin: | - | ||||||||||||||||||||||||
| 4600 | case PM_MenuVMargin: | - | ||||||||||||||||||||||||
| 4601 | ret = 0; | - | ||||||||||||||||||||||||
| 4602 | break; | - | ||||||||||||||||||||||||
| 4603 | - | |||||||||||||||||||||||||
| 4604 | case PM_HeaderMargin: | - | ||||||||||||||||||||||||
| 4605 | ret = int(QStyleHelper::dpiScaled(4.)); | - | ||||||||||||||||||||||||
| 4606 | break; | - | ||||||||||||||||||||||||
| 4607 | case PM_HeaderMarkSize: | - | ||||||||||||||||||||||||
| 4608 | ret = int(QStyleHelper::dpiScaled(16.)); | - | ||||||||||||||||||||||||
| 4609 | break; | - | ||||||||||||||||||||||||
| 4610 | case PM_HeaderGripMargin: | - | ||||||||||||||||||||||||
| 4611 | ret = int(QStyleHelper::dpiScaled(4.)); | - | ||||||||||||||||||||||||
| 4612 | break; | - | ||||||||||||||||||||||||
| 4613 | case PM_HeaderDefaultSectionSizeHorizontal: | - | ||||||||||||||||||||||||
| 4614 | ret = int(QStyleHelper::dpiScaled(100.)); | - | ||||||||||||||||||||||||
| 4615 | break; | - | ||||||||||||||||||||||||
| 4616 | case PM_HeaderDefaultSectionSizeVertical: | - | ||||||||||||||||||||||||
| 4617 | ret = int(QStyleHelper::dpiScaled(30.)); | - | ||||||||||||||||||||||||
| 4618 | break; | - | ||||||||||||||||||||||||
| 4619 | case PM_TabBarScrollButtonWidth: | - | ||||||||||||||||||||||||
| 4620 | ret = int(QStyleHelper::dpiScaled(16.)); | - | ||||||||||||||||||||||||
| 4621 | break; | - | ||||||||||||||||||||||||
| 4622 | case PM_LayoutLeftMargin: | - | ||||||||||||||||||||||||
| 4623 | case PM_LayoutTopMargin: | - | ||||||||||||||||||||||||
| 4624 | case PM_LayoutRightMargin: | - | ||||||||||||||||||||||||
| 4625 | case PM_LayoutBottomMargin: | - | ||||||||||||||||||||||||
| 4626 | { | - | ||||||||||||||||||||||||
| 4627 | bool isWindow = false; | - | ||||||||||||||||||||||||
| 4628 | if (opt) { | - | ||||||||||||||||||||||||
| 4629 | isWindow = (opt->state & State_Window); | - | ||||||||||||||||||||||||
| 4630 | } else if (widget) { | - | ||||||||||||||||||||||||
| 4631 | isWindow = widget->isWindow(); | - | ||||||||||||||||||||||||
| 4632 | } | - | ||||||||||||||||||||||||
| 4633 | ret = proxy()->pixelMetric(isWindow ? PM_DefaultTopLevelMargin : PM_DefaultChildMargin); | - | ||||||||||||||||||||||||
| 4634 | } | - | ||||||||||||||||||||||||
| 4635 | break; | - | ||||||||||||||||||||||||
| 4636 | case PM_LayoutHorizontalSpacing: | - | ||||||||||||||||||||||||
| 4637 | case PM_LayoutVerticalSpacing: | - | ||||||||||||||||||||||||
| 4638 | ret = proxy()->pixelMetric(PM_DefaultLayoutSpacing); | - | ||||||||||||||||||||||||
| 4639 | break; | - | ||||||||||||||||||||||||
| 4640 | - | |||||||||||||||||||||||||
| 4641 | case PM_DefaultTopLevelMargin: | - | ||||||||||||||||||||||||
| 4642 | ret = int(QStyleHelper::dpiScaled(11.)); | - | ||||||||||||||||||||||||
| 4643 | break; | - | ||||||||||||||||||||||||
| 4644 | case PM_DefaultChildMargin: | - | ||||||||||||||||||||||||
| 4645 | ret = int(QStyleHelper::dpiScaled(9.)); | - | ||||||||||||||||||||||||
| 4646 | break; | - | ||||||||||||||||||||||||
| 4647 | case PM_DefaultLayoutSpacing: | - | ||||||||||||||||||||||||
| 4648 | ret = int(QStyleHelper::dpiScaled(6.)); | - | ||||||||||||||||||||||||
| 4649 | break; | - | ||||||||||||||||||||||||
| 4650 | - | |||||||||||||||||||||||||
| 4651 | case PM_ToolBarIconSize: | - | ||||||||||||||||||||||||
| 4652 | ret = 0; | - | ||||||||||||||||||||||||
| 4653 | if (const QPlatformTheme *theme = QGuiApplicationPrivate::platformTheme()) | - | ||||||||||||||||||||||||
| 4654 | ret = theme->themeHint(QPlatformTheme::ToolBarIconSize).toInt(); | - | ||||||||||||||||||||||||
| 4655 | if (ret <= 0) | - | ||||||||||||||||||||||||
| 4656 | ret = int(QStyleHelper::dpiScaled(24.)); | - | ||||||||||||||||||||||||
| 4657 | break; | - | ||||||||||||||||||||||||
| 4658 | - | |||||||||||||||||||||||||
| 4659 | case PM_TabBarIconSize: | - | ||||||||||||||||||||||||
| 4660 | case PM_ListViewIconSize: | - | ||||||||||||||||||||||||
| 4661 | ret = proxy()->pixelMetric(PM_SmallIconSize, opt, widget); | - | ||||||||||||||||||||||||
| 4662 | break; | - | ||||||||||||||||||||||||
| 4663 | - | |||||||||||||||||||||||||
| 4664 | case PM_ButtonIconSize: | - | ||||||||||||||||||||||||
| 4665 | case PM_SmallIconSize: | - | ||||||||||||||||||||||||
| 4666 | ret = int(QStyleHelper::dpiScaled(16.)); | - | ||||||||||||||||||||||||
| 4667 | break; | - | ||||||||||||||||||||||||
| 4668 | case PM_IconViewIconSize: | - | ||||||||||||||||||||||||
| 4669 | ret = proxy()->pixelMetric(PM_LargeIconSize, opt, widget); | - | ||||||||||||||||||||||||
| 4670 | break; | - | ||||||||||||||||||||||||
| 4671 | - | |||||||||||||||||||||||||
| 4672 | case PM_LargeIconSize: | - | ||||||||||||||||||||||||
| 4673 | ret = int(QStyleHelper::dpiScaled(32.)); | - | ||||||||||||||||||||||||
| 4674 | break; | - | ||||||||||||||||||||||||
| 4675 | - | |||||||||||||||||||||||||
| 4676 | case PM_ToolTipLabelFrameWidth: | - | ||||||||||||||||||||||||
| 4677 | ret = 1; | - | ||||||||||||||||||||||||
| 4678 | break; | - | ||||||||||||||||||||||||
| 4679 | case PM_CheckBoxLabelSpacing: | - | ||||||||||||||||||||||||
| 4680 | case PM_RadioButtonLabelSpacing: | - | ||||||||||||||||||||||||
| 4681 | ret = int(QStyleHelper::dpiScaled(6.)); | - | ||||||||||||||||||||||||
| 4682 | break; | - | ||||||||||||||||||||||||
| 4683 | case PM_SizeGripSize: | - | ||||||||||||||||||||||||
| 4684 | ret = int(QStyleHelper::dpiScaled(13.)); | - | ||||||||||||||||||||||||
| 4685 | break; | - | ||||||||||||||||||||||||
| 4686 | case PM_MessageBoxIconSize: | - | ||||||||||||||||||||||||
| 4687 | #ifdef Q_OS_MAC | - | ||||||||||||||||||||||||
| 4688 | if (QApplication::desktopSettingsAware()) { | - | ||||||||||||||||||||||||
| 4689 | ret = 64; // No DPI scaling, it's handled elsewhere. | - | ||||||||||||||||||||||||
| 4690 | } else | - | ||||||||||||||||||||||||
| 4691 | #endif | - | ||||||||||||||||||||||||
| 4692 | { | - | ||||||||||||||||||||||||
| 4693 | ret = int(QStyleHelper::dpiScaled(32.)); | - | ||||||||||||||||||||||||
| 4694 | } | - | ||||||||||||||||||||||||
| 4695 | break; | - | ||||||||||||||||||||||||
| 4696 | case PM_TextCursorWidth: | - | ||||||||||||||||||||||||
| 4697 | ret = QGuiApplicationPrivate::platformTheme()->themeHint(QPlatformTheme::TextCursorWidth).toInt(); | - | ||||||||||||||||||||||||
| 4698 | break; | - | ||||||||||||||||||||||||
| 4699 | case PM_TabBar_ScrollButtonOverlap: | - | ||||||||||||||||||||||||
| 4700 | ret = 1; | - | ||||||||||||||||||||||||
| 4701 | break; | - | ||||||||||||||||||||||||
| 4702 | case PM_TabCloseIndicatorWidth: | - | ||||||||||||||||||||||||
| 4703 | case PM_TabCloseIndicatorHeight: | - | ||||||||||||||||||||||||
| 4704 | ret = int(QStyleHelper::dpiScaled(16.)); | - | ||||||||||||||||||||||||
| 4705 | break; | - | ||||||||||||||||||||||||
| 4706 | case PM_ScrollView_ScrollBarSpacing: | - | ||||||||||||||||||||||||
| 4707 | ret = 2 * proxy()->pixelMetric(PM_DefaultFrameWidth, opt, widget); | - | ||||||||||||||||||||||||
| 4708 | break; | - | ||||||||||||||||||||||||
| 4709 | case PM_ScrollView_ScrollBarOverlap: | - | ||||||||||||||||||||||||
| 4710 | ret = 0; | - | ||||||||||||||||||||||||
| 4711 | break; | - | ||||||||||||||||||||||||
| 4712 | case PM_SubMenuOverlap: | - | ||||||||||||||||||||||||
| 4713 | ret = -proxy()->pixelMetric(QStyle::PM_MenuPanelWidth, opt, widget); | - | ||||||||||||||||||||||||
| 4714 | break; | - | ||||||||||||||||||||||||
| 4715 | case PM_TreeViewIndentation: | - | ||||||||||||||||||||||||
| 4716 | ret = int(QStyleHelper::dpiScaled(20.)); | - | ||||||||||||||||||||||||
| 4717 | break; | - | ||||||||||||||||||||||||
| 4718 | default: | - | ||||||||||||||||||||||||
| 4719 | ret = 0; | - | ||||||||||||||||||||||||
| 4720 | break; | - | ||||||||||||||||||||||||
| 4721 | } | - | ||||||||||||||||||||||||
| 4722 | - | |||||||||||||||||||||||||
| 4723 | return ret; | - | ||||||||||||||||||||||||
| 4724 | } | - | ||||||||||||||||||||||||
| 4725 | - | |||||||||||||||||||||||||
| 4726 | /*! | - | ||||||||||||||||||||||||
| 4727 | \reimp | - | ||||||||||||||||||||||||
| 4728 | */ | - | ||||||||||||||||||||||||
| 4729 | QSize QCommonStyle::sizeFromContents(ContentsType ct, const QStyleOption *opt, | - | ||||||||||||||||||||||||
| 4730 | const QSize &csz, const QWidget *widget) const | - | ||||||||||||||||||||||||
| 4731 | { | - | ||||||||||||||||||||||||
| 4732 | Q_D(const QCommonStyle); | - | ||||||||||||||||||||||||
| 4733 | QSize sz(csz); | - | ||||||||||||||||||||||||
| 4734 | switch (ct) { | - | ||||||||||||||||||||||||
| 4735 | case CT_PushButton: | - | ||||||||||||||||||||||||
| 4736 | if (const QStyleOptionButton *btn = qstyleoption_cast<const QStyleOptionButton *>(opt)) { | - | ||||||||||||||||||||||||
| 4737 | int w = csz.width(), | - | ||||||||||||||||||||||||
| 4738 | h = csz.height(), | - | ||||||||||||||||||||||||
| 4739 | bm = proxy()->pixelMetric(PM_ButtonMargin, btn, widget), | - | ||||||||||||||||||||||||
| 4740 | fw = proxy()->pixelMetric(PM_DefaultFrameWidth, btn, widget) * 2; | - | ||||||||||||||||||||||||
| 4741 | w += bm + fw; | - | ||||||||||||||||||||||||
| 4742 | h += bm + fw; | - | ||||||||||||||||||||||||
| 4743 | if (btn->features & QStyleOptionButton::AutoDefaultButton){ | - | ||||||||||||||||||||||||
| 4744 | int dbw = proxy()->pixelMetric(PM_ButtonDefaultIndicator, btn, widget) * 2; | - | ||||||||||||||||||||||||
| 4745 | w += dbw; | - | ||||||||||||||||||||||||
| 4746 | h += dbw; | - | ||||||||||||||||||||||||
| 4747 | } | - | ||||||||||||||||||||||||
| 4748 | sz = QSize(w, h); | - | ||||||||||||||||||||||||
| 4749 | } | - | ||||||||||||||||||||||||
| 4750 | break; | - | ||||||||||||||||||||||||
| 4751 | case CT_RadioButton: | - | ||||||||||||||||||||||||
| 4752 | case CT_CheckBox: | - | ||||||||||||||||||||||||
| 4753 | if (const QStyleOptionButton *btn = qstyleoption_cast<const QStyleOptionButton *>(opt)) { | - | ||||||||||||||||||||||||
| 4754 | bool isRadio = (ct == CT_RadioButton); | - | ||||||||||||||||||||||||
| 4755 | - | |||||||||||||||||||||||||
| 4756 | int w = proxy()->pixelMetric(isRadio ? PM_ExclusiveIndicatorWidth | - | ||||||||||||||||||||||||
| 4757 | : PM_IndicatorWidth, btn, widget); | - | ||||||||||||||||||||||||
| 4758 | int h = proxy()->pixelMetric(isRadio ? PM_ExclusiveIndicatorHeight | - | ||||||||||||||||||||||||
| 4759 | : PM_IndicatorHeight, btn, widget); | - | ||||||||||||||||||||||||
| 4760 | - | |||||||||||||||||||||||||
| 4761 | int margins = 0; | - | ||||||||||||||||||||||||
| 4762 | // we add 4 pixels for label margins | - | ||||||||||||||||||||||||
| 4763 | if (!btn->icon.isNull() || !btn->text.isEmpty()) | - | ||||||||||||||||||||||||
| 4764 | margins = 4 + proxy()->pixelMetric(isRadio ? PM_RadioButtonLabelSpacing | - | ||||||||||||||||||||||||
| 4765 | : PM_CheckBoxLabelSpacing, opt, widget); | - | ||||||||||||||||||||||||
| 4766 | sz += QSize(w + margins, 4); | - | ||||||||||||||||||||||||
| 4767 | sz.setHeight(qMax(sz.height(), h)); | - | ||||||||||||||||||||||||
| 4768 | } | - | ||||||||||||||||||||||||
| 4769 | break; | - | ||||||||||||||||||||||||
| 4770 | #ifndef QT_NO_MENU | - | ||||||||||||||||||||||||
| 4771 | case CT_MenuItem: | - | ||||||||||||||||||||||||
| 4772 | if (const QStyleOptionMenuItem *mi = qstyleoption_cast<const QStyleOptionMenuItem *>(opt)) { | - | ||||||||||||||||||||||||
| 4773 | bool checkable = mi->menuHasCheckableItems; | - | ||||||||||||||||||||||||
| 4774 | int maxpmw = mi->maxIconWidth; | - | ||||||||||||||||||||||||
| 4775 | int w = sz.width(), h = sz.height(); | - | ||||||||||||||||||||||||
| 4776 | if (mi->menuItemType == QStyleOptionMenuItem::Separator) { | - | ||||||||||||||||||||||||
| 4777 | w = 10; | - | ||||||||||||||||||||||||
| 4778 | h = 2; | - | ||||||||||||||||||||||||
| 4779 | } else { | - | ||||||||||||||||||||||||
| 4780 | h = mi->fontMetrics.height() + 8; | - | ||||||||||||||||||||||||
| 4781 | if (!mi->icon.isNull()) { | - | ||||||||||||||||||||||||
| 4782 | int iconExtent = proxy()->pixelMetric(PM_SmallIconSize); | - | ||||||||||||||||||||||||
| 4783 | h = qMax(h, mi->icon.actualSize(QSize(iconExtent, iconExtent)).height() + 4); | - | ||||||||||||||||||||||||
| 4784 | } | - | ||||||||||||||||||||||||
| 4785 | } | - | ||||||||||||||||||||||||
| 4786 | if (mi->text.contains(QLatin1Char('\t'))) | - | ||||||||||||||||||||||||
| 4787 | w += 12; | - | ||||||||||||||||||||||||
| 4788 | if (maxpmw > 0) | - | ||||||||||||||||||||||||
| 4789 | w += maxpmw + 6; | - | ||||||||||||||||||||||||
| 4790 | if (checkable && maxpmw < 20) | - | ||||||||||||||||||||||||
| 4791 | w += 20 - maxpmw; | - | ||||||||||||||||||||||||
| 4792 | if (checkable || maxpmw > 0) | - | ||||||||||||||||||||||||
| 4793 | w += 2; | - | ||||||||||||||||||||||||
| 4794 | w += 12; | - | ||||||||||||||||||||||||
| 4795 | sz = QSize(w, h); | - | ||||||||||||||||||||||||
| 4796 | } | - | ||||||||||||||||||||||||
| 4797 | break; | - | ||||||||||||||||||||||||
| 4798 | #endif // QT_NO_MENU | - | ||||||||||||||||||||||||
| 4799 | #ifndef QT_NO_TOOLBUTTON | - | ||||||||||||||||||||||||
| 4800 | case CT_ToolButton: | - | ||||||||||||||||||||||||
| 4801 | sz = QSize(sz.width() + 6, sz.height() + 5); | - | ||||||||||||||||||||||||
| 4802 | break; | - | ||||||||||||||||||||||||
| 4803 | #endif // QT_NO_TOOLBUTTON | - | ||||||||||||||||||||||||
| 4804 | #ifndef QT_NO_COMBOBOX | - | ||||||||||||||||||||||||
| 4805 | case CT_ComboBox: | - | ||||||||||||||||||||||||
| 4806 | if (const QStyleOptionComboBox *cmb = qstyleoption_cast<const QStyleOptionComboBox *>(opt)) { | - | ||||||||||||||||||||||||
| 4807 | int fw = cmb->frame ? proxy()->pixelMetric(PM_ComboBoxFrameWidth, opt, widget) * 2 : 0; | - | ||||||||||||||||||||||||
| 4808 | const int textMargins = 2*(proxy()->pixelMetric(PM_FocusFrameHMargin) + 1); | - | ||||||||||||||||||||||||
| 4809 | // QItemDelegate::sizeHint expands the textMargins two times, thus the 2*textMargins... | - | ||||||||||||||||||||||||
| 4810 | int other = qMax(23, 2*textMargins + proxy()->pixelMetric(QStyle::PM_ScrollBarExtent, opt, widget)); | - | ||||||||||||||||||||||||
| 4811 | sz = QSize(sz.width() + fw + other, sz.height() + fw); | - | ||||||||||||||||||||||||
| 4812 | } | - | ||||||||||||||||||||||||
| 4813 | break; | - | ||||||||||||||||||||||||
| 4814 | #endif // QT_NO_COMBOBOX | - | ||||||||||||||||||||||||
| 4815 | case CT_HeaderSection: | - | ||||||||||||||||||||||||
| 4816 | if (const QStyleOptionHeader *hdr = qstyleoption_cast<const QStyleOptionHeader *>(opt)) { | - | ||||||||||||||||||||||||
| 4817 | bool nullIcon = hdr->icon.isNull(); | - | ||||||||||||||||||||||||
| 4818 | int margin = proxy()->pixelMetric(QStyle::PM_HeaderMargin, hdr, widget); | - | ||||||||||||||||||||||||
| 4819 | int iconSize = nullIcon ? 0 : proxy()->pixelMetric(QStyle::PM_SmallIconSize, hdr, widget); | - | ||||||||||||||||||||||||
| 4820 | QSize txt = hdr->fontMetrics.size(0, hdr->text); | - | ||||||||||||||||||||||||
| 4821 | sz.setHeight(margin + qMax(iconSize, txt.height()) + margin); | - | ||||||||||||||||||||||||
| 4822 | sz.setWidth((nullIcon ? 0 : margin) + iconSize | - | ||||||||||||||||||||||||
| 4823 | + (hdr->text.isNull() ? 0 : margin) + txt.width() + margin); | - | ||||||||||||||||||||||||
| 4824 | if (hdr->sortIndicator != QStyleOptionHeader::None) { | - | ||||||||||||||||||||||||
| 4825 | int margin = proxy()->pixelMetric(QStyle::PM_HeaderMargin, hdr, widget); | - | ||||||||||||||||||||||||
| 4826 | if (hdr->orientation == Qt::Horizontal) | - | ||||||||||||||||||||||||
| 4827 | sz.rwidth() += sz.height() + margin; | - | ||||||||||||||||||||||||
| 4828 | else | - | ||||||||||||||||||||||||
| 4829 | sz.rheight() += sz.width() + margin; | - | ||||||||||||||||||||||||
| 4830 | } | - | ||||||||||||||||||||||||
| 4831 | } | - | ||||||||||||||||||||||||
| 4832 | break; | - | ||||||||||||||||||||||||
| 4833 | case CT_TabWidget: | - | ||||||||||||||||||||||||
| 4834 | sz += QSize(4, 4); | - | ||||||||||||||||||||||||
| 4835 | break; | - | ||||||||||||||||||||||||
| 4836 | case CT_LineEdit: | - | ||||||||||||||||||||||||
| 4837 | if (const QStyleOptionFrame *f = qstyleoption_cast<const QStyleOptionFrame *>(opt)) | - | ||||||||||||||||||||||||
| 4838 | sz += QSize(2*f->lineWidth, 2*f->lineWidth); | - | ||||||||||||||||||||||||
| 4839 | break; | - | ||||||||||||||||||||||||
| 4840 | #ifndef QT_NO_GROUPBOX | - | ||||||||||||||||||||||||
| 4841 | case CT_GroupBox: | - | ||||||||||||||||||||||||
| 4842 | if (const QGroupBox *grb = static_cast<const QGroupBox *>(widget)) | - | ||||||||||||||||||||||||
| 4843 | sz += QSize(!grb->isFlat() ? 16 : 0, 0); | - | ||||||||||||||||||||||||
| 4844 | break; | - | ||||||||||||||||||||||||
| 4845 | #endif // QT_NO_GROUPBOX | - | ||||||||||||||||||||||||
| 4846 | case CT_MdiControls: | - | ||||||||||||||||||||||||
| 4847 | if (const QStyleOptionComplex *styleOpt = qstyleoption_cast<const QStyleOptionComplex *>(opt)) { | - | ||||||||||||||||||||||||
| 4848 | int width = 1; | - | ||||||||||||||||||||||||
| 4849 | if (styleOpt->subControls & SC_MdiMinButton) | - | ||||||||||||||||||||||||
| 4850 | width += 16 + 1; | - | ||||||||||||||||||||||||
| 4851 | if (styleOpt->subControls & SC_MdiNormalButton) | - | ||||||||||||||||||||||||
| 4852 | width += 16 + 1; | - | ||||||||||||||||||||||||
| 4853 | if (styleOpt->subControls & SC_MdiCloseButton) | - | ||||||||||||||||||||||||
| 4854 | width += 16 + 1; | - | ||||||||||||||||||||||||
| 4855 | sz = QSize(width, 16); | - | ||||||||||||||||||||||||
| 4856 | } else { | - | ||||||||||||||||||||||||
| 4857 | sz = QSize(52, 16); | - | ||||||||||||||||||||||||
| 4858 | } | - | ||||||||||||||||||||||||
| 4859 | break; | - | ||||||||||||||||||||||||
| 4860 | #ifndef QT_NO_ITEMVIEWS | - | ||||||||||||||||||||||||
| 4861 | case CT_ItemViewItem: | - | ||||||||||||||||||||||||
| 4862 | if (const QStyleOptionViewItem *vopt = qstyleoption_cast<const QStyleOptionViewItem *>(opt)) { | - | ||||||||||||||||||||||||
| 4863 | QRect decorationRect, displayRect, checkRect; | - | ||||||||||||||||||||||||
| 4864 | d->viewItemLayout(vopt, &checkRect, &decorationRect, &displayRect, true); | - | ||||||||||||||||||||||||
| 4865 | sz = (decorationRect|displayRect|checkRect).size(); | - | ||||||||||||||||||||||||
| 4866 | } | - | ||||||||||||||||||||||||
| 4867 | break; | - | ||||||||||||||||||||||||
| 4868 | #endif // QT_NO_ITEMVIEWS | - | ||||||||||||||||||||||||
| 4869 | #ifndef QT_NO_SPINBOX | - | ||||||||||||||||||||||||
| 4870 | case CT_SpinBox: | - | ||||||||||||||||||||||||
| 4871 | if (const QStyleOptionSpinBox *vopt = qstyleoption_cast<const QStyleOptionSpinBox *>(opt)) { | - | ||||||||||||||||||||||||
| 4872 | // Add button + frame widths | - | ||||||||||||||||||||||||
| 4873 | int buttonWidth = 20; | - | ||||||||||||||||||||||||
| 4874 | int fw = vopt->frame ? proxy()->pixelMetric(PM_SpinBoxFrameWidth, vopt, widget) : 0; | - | ||||||||||||||||||||||||
| 4875 | sz += QSize(buttonWidth + 2*fw, 2*fw); | - | ||||||||||||||||||||||||
| 4876 | } | - | ||||||||||||||||||||||||
| 4877 | break; | - | ||||||||||||||||||||||||
| 4878 | #endif | - | ||||||||||||||||||||||||
| 4879 | case CT_ScrollBar: | - | ||||||||||||||||||||||||
| 4880 | case CT_MenuBar: | - | ||||||||||||||||||||||||
| 4881 | case CT_Menu: | - | ||||||||||||||||||||||||
| 4882 | case CT_MenuBarItem: | - | ||||||||||||||||||||||||
| 4883 | case CT_Slider: | - | ||||||||||||||||||||||||
| 4884 | case CT_ProgressBar: | - | ||||||||||||||||||||||||
| 4885 | case CT_TabBarTab: | - | ||||||||||||||||||||||||
| 4886 | // just return the contentsSize for now | - | ||||||||||||||||||||||||
| 4887 | // fall through intended | - | ||||||||||||||||||||||||
| 4888 | default: | - | ||||||||||||||||||||||||
| 4889 | break; | - | ||||||||||||||||||||||||
| 4890 | } | - | ||||||||||||||||||||||||
| 4891 | return sz; | - | ||||||||||||||||||||||||
| 4892 | } | - | ||||||||||||||||||||||||
| 4893 | - | |||||||||||||||||||||||||
| 4894 | - | |||||||||||||||||||||||||
| 4895 | /*! \reimp */ | - | ||||||||||||||||||||||||
| 4896 | int QCommonStyle::styleHint(StyleHint sh, const QStyleOption *opt, const QWidget *widget, | - | ||||||||||||||||||||||||
| 4897 | QStyleHintReturn *hret) const | - | ||||||||||||||||||||||||
| 4898 | { | - | ||||||||||||||||||||||||
| 4899 | int ret = 0; | - | ||||||||||||||||||||||||
| 4900 | - | |||||||||||||||||||||||||
| 4901 | switch (sh) { | - | ||||||||||||||||||||||||
| 4902 | case SH_Menu_KeyboardSearch: never executed: case SH_Menu_KeyboardSearch: | 0 | ||||||||||||||||||||||||
| 4903 | ret = false; | - | ||||||||||||||||||||||||
| 4904 | break; never executed: break; | 0 | ||||||||||||||||||||||||
| 4905 | case SH_Slider_AbsoluteSetButtons: never executed: case SH_Slider_AbsoluteSetButtons: | 0 | ||||||||||||||||||||||||
| 4906 | ret = Qt::MidButton; | - | ||||||||||||||||||||||||
| 4907 | break; never executed: break; | 0 | ||||||||||||||||||||||||
| 4908 | case SH_Slider_PageSetButtons: never executed: case SH_Slider_PageSetButtons: | 0 | ||||||||||||||||||||||||
| 4909 | ret = Qt::LeftButton; | - | ||||||||||||||||||||||||
| 4910 | break; never executed: break; | 0 | ||||||||||||||||||||||||
| 4911 | case SH_ScrollBar_ContextMenu: never executed: case SH_ScrollBar_ContextMenu: | 0 | ||||||||||||||||||||||||
| 4912 | ret = true; | - | ||||||||||||||||||||||||
| 4913 | break; never executed: break; | 0 | ||||||||||||||||||||||||
| 4914 | case SH_DialogButtons_DefaultButton: // This value not used anywhere. never executed: case SH_DialogButtons_DefaultButton: | 0 | ||||||||||||||||||||||||
| 4915 | ret = QDialogButtonBox::AcceptRole; | - | ||||||||||||||||||||||||
| 4916 | break; never executed: break; | 0 | ||||||||||||||||||||||||
| 4917 | #ifndef QT_NO_GROUPBOX | - | ||||||||||||||||||||||||
| 4918 | case SH_GroupBox_TextLabelVerticalAlignment: never executed: case SH_GroupBox_TextLabelVerticalAlignment: | 0 | ||||||||||||||||||||||||
| 4919 | ret = Qt::AlignVCenter; | - | ||||||||||||||||||||||||
| 4920 | break; never executed: break; | 0 | ||||||||||||||||||||||||
| 4921 | - | |||||||||||||||||||||||||
| 4922 | case SH_GroupBox_TextLabelColor: never executed: case SH_GroupBox_TextLabelColor: | 0 | ||||||||||||||||||||||||
| 4923 | ret = opt ? int(opt->palette.color(QPalette::Text).rgba()) : 0;
| 0 | ||||||||||||||||||||||||
| 4924 | break; never executed: break; | 0 | ||||||||||||||||||||||||
| 4925 | #endif // QT_NO_GROUPBOX | - | ||||||||||||||||||||||||
| 4926 | - | |||||||||||||||||||||||||
| 4927 | case SH_ListViewExpand_SelectMouseType: never executed: case SH_ListViewExpand_SelectMouseType: | 0 | ||||||||||||||||||||||||
| 4928 | case SH_TabBar_SelectMouseType: never executed: case SH_TabBar_SelectMouseType: | 0 | ||||||||||||||||||||||||
| 4929 | ret = QEvent::MouseButtonPress; | - | ||||||||||||||||||||||||
| 4930 | break; never executed: break; | 0 | ||||||||||||||||||||||||
| 4931 | - | |||||||||||||||||||||||||
| 4932 | - | |||||||||||||||||||||||||
| 4933 | case SH_TabBar_Alignment: never executed: case SH_TabBar_Alignment: | 0 | ||||||||||||||||||||||||
| 4934 | ret = Qt::AlignLeft; | - | ||||||||||||||||||||||||
| 4935 | break; never executed: break; | 0 | ||||||||||||||||||||||||
| 4936 | - | |||||||||||||||||||||||||
| 4937 | case SH_Header_ArrowAlignment: never executed: case SH_Header_ArrowAlignment: | 0 | ||||||||||||||||||||||||
| 4938 | ret = Qt::AlignRight | Qt::AlignVCenter; | - | ||||||||||||||||||||||||
| 4939 | break; never executed: break; | 0 | ||||||||||||||||||||||||
| 4940 | - | |||||||||||||||||||||||||
| 4941 | case SH_TitleBar_AutoRaise: never executed: case SH_TitleBar_AutoRaise: | 0 | ||||||||||||||||||||||||
| 4942 | ret = false; | - | ||||||||||||||||||||||||
| 4943 | break; never executed: break; | 0 | ||||||||||||||||||||||||
| 4944 | - | |||||||||||||||||||||||||
| 4945 | case SH_Menu_SubMenuPopupDelay: never executed: case SH_Menu_SubMenuPopupDelay: | 0 | ||||||||||||||||||||||||
| 4946 | ret = 256; | - | ||||||||||||||||||||||||
| 4947 | break; never executed: break; | 0 | ||||||||||||||||||||||||
| 4948 | - | |||||||||||||||||||||||||
| 4949 | case SH_Menu_SloppySubMenus: never executed: case SH_Menu_SloppySubMenus: | 0 | ||||||||||||||||||||||||
| 4950 | ret = true; | - | ||||||||||||||||||||||||
| 4951 | break; never executed: break; | 0 | ||||||||||||||||||||||||
| 4952 | - | |||||||||||||||||||||||||
| 4953 | case SH_Menu_SubMenuUniDirection: never executed: case SH_Menu_SubMenuUniDirection: | 0 | ||||||||||||||||||||||||
| 4954 | ret = false; | - | ||||||||||||||||||||||||
| 4955 | break; never executed: break; | 0 | ||||||||||||||||||||||||
| 4956 | case SH_Menu_SubMenuUniDirectionFailCount: never executed: case SH_Menu_SubMenuUniDirectionFailCount: | 0 | ||||||||||||||||||||||||
| 4957 | ret = 1; | - | ||||||||||||||||||||||||
| 4958 | break; never executed: break; | 0 | ||||||||||||||||||||||||
| 4959 | case SH_Menu_SubMenuSloppySelectOtherActions: never executed: case SH_Menu_SubMenuSloppySelectOtherActions: | 0 | ||||||||||||||||||||||||
| 4960 | ret = true; | - | ||||||||||||||||||||||||
| 4961 | break; never executed: break; | 0 | ||||||||||||||||||||||||
| 4962 | case SH_Menu_SubMenuSloppyCloseTimeout: never executed: case SH_Menu_SubMenuSloppyCloseTimeout: | 0 | ||||||||||||||||||||||||
| 4963 | ret = 1000; | - | ||||||||||||||||||||||||
| 4964 | break; never executed: break; | 0 | ||||||||||||||||||||||||
| 4965 | case SH_Menu_SubMenuResetWhenReenteringParent: never executed: case SH_Menu_SubMenuResetWhenReenteringParent: | 0 | ||||||||||||||||||||||||
| 4966 | ret = false; | - | ||||||||||||||||||||||||
| 4967 | break; never executed: break; | 0 | ||||||||||||||||||||||||
| 4968 | case SH_Menu_SubMenuDontStartSloppyOnLeave: never executed: case SH_Menu_SubMenuDontStartSloppyOnLeave: | 0 | ||||||||||||||||||||||||
| 4969 | ret = false; | - | ||||||||||||||||||||||||
| 4970 | break; never executed: break; | 0 | ||||||||||||||||||||||||
| 4971 | - | |||||||||||||||||||||||||
| 4972 | case SH_ProgressDialog_TextLabelAlignment: never executed: case SH_ProgressDialog_TextLabelAlignment: | 0 | ||||||||||||||||||||||||
| 4973 | ret = Qt::AlignCenter; | - | ||||||||||||||||||||||||
| 4974 | break; never executed: break; | 0 | ||||||||||||||||||||||||
| 4975 | - | |||||||||||||||||||||||||
| 4976 | case SH_BlinkCursorWhenTextSelected: never executed: case SH_BlinkCursorWhenTextSelected: | 0 | ||||||||||||||||||||||||
| 4977 | #if defined(Q_OS_DARWIN) | - | ||||||||||||||||||||||||
| 4978 | ret = 0; | - | ||||||||||||||||||||||||
| 4979 | #else | - | ||||||||||||||||||||||||
| 4980 | ret = 1; | - | ||||||||||||||||||||||||
| 4981 | #endif | - | ||||||||||||||||||||||||
| 4982 | break; never executed: break; | 0 | ||||||||||||||||||||||||
| 4983 | - | |||||||||||||||||||||||||
| 4984 | case SH_Table_GridLineColor: never executed: case SH_Table_GridLineColor: | 0 | ||||||||||||||||||||||||
| 4985 | if (opt)
| 0 | ||||||||||||||||||||||||
| 4986 | ret = opt->palette.color(QPalette::Mid).rgb(); never executed: ret = opt->palette.color(QPalette::Mid).rgb(); | 0 | ||||||||||||||||||||||||
| 4987 | else | - | ||||||||||||||||||||||||
| 4988 | ret = -1; never executed: ret = -1; | 0 | ||||||||||||||||||||||||
| 4989 | break; never executed: break; | 0 | ||||||||||||||||||||||||
| 4990 | case SH_LineEdit_PasswordCharacter: { never executed: case SH_LineEdit_PasswordCharacter: | 0 | ||||||||||||||||||||||||
| 4991 | const QPlatformTheme *theme = QGuiApplicationPrivate::platformTheme(); | - | ||||||||||||||||||||||||
| 4992 | const QPlatformTheme::ThemeHint hintType = QPlatformTheme::PasswordMaskCharacter; | - | ||||||||||||||||||||||||
| 4993 | const QVariant hint = theme ? theme->themeHint(hintType) : QPlatformTheme::defaultThemeHint(hintType);
| 0 | ||||||||||||||||||||||||
| 4994 | ret = hint.toChar().unicode(); | - | ||||||||||||||||||||||||
| 4995 | break; never executed: break; | 0 | ||||||||||||||||||||||||
| 4996 | } | - | ||||||||||||||||||||||||
| 4997 | case SH_LineEdit_PasswordMaskDelay: never executed: case SH_LineEdit_PasswordMaskDelay: | 0 | ||||||||||||||||||||||||
| 4998 | ret = QGuiApplicationPrivate::platformTheme()->themeHint(QPlatformTheme::PasswordMaskDelay).toInt(); | - | ||||||||||||||||||||||||
| 4999 | break; never executed: break; | 0 | ||||||||||||||||||||||||
| 5000 | case SH_ToolBox_SelectedPageTitleBold: never executed: case SH_ToolBox_SelectedPageTitleBold: | 0 | ||||||||||||||||||||||||
| 5001 | ret = 1; | - | ||||||||||||||||||||||||
| 5002 | break; never executed: break; | 0 | ||||||||||||||||||||||||
| 5003 | - | |||||||||||||||||||||||||
| 5004 | case SH_UnderlineShortcut: never executed: case SH_UnderlineShortcut: | 0 | ||||||||||||||||||||||||
| 5005 | ret = 1; | - | ||||||||||||||||||||||||
| 5006 | break; never executed: break; | 0 | ||||||||||||||||||||||||
| 5007 | - | |||||||||||||||||||||||||
| 5008 | case SH_SpinBox_ClickAutoRepeatRate: never executed: case SH_SpinBox_ClickAutoRepeatRate: | 0 | ||||||||||||||||||||||||
| 5009 | ret = 150; | - | ||||||||||||||||||||||||
| 5010 | break; never executed: break; | 0 | ||||||||||||||||||||||||
| 5011 | - | |||||||||||||||||||||||||
| 5012 | case SH_SpinBox_ClickAutoRepeatThreshold: never executed: case SH_SpinBox_ClickAutoRepeatThreshold: | 0 | ||||||||||||||||||||||||
| 5013 | ret = 500; | - | ||||||||||||||||||||||||
| 5014 | break; never executed: break; | 0 | ||||||||||||||||||||||||
| 5015 | - | |||||||||||||||||||||||||
| 5016 | case SH_SpinBox_KeyPressAutoRepeatRate: never executed: case SH_SpinBox_KeyPressAutoRepeatRate: | 0 | ||||||||||||||||||||||||
| 5017 | ret = 75; | - | ||||||||||||||||||||||||
| 5018 | break; never executed: break; | 0 | ||||||||||||||||||||||||
| 5019 | - | |||||||||||||||||||||||||
| 5020 | case SH_Menu_SelectionWrap: never executed: case SH_Menu_SelectionWrap: | 0 | ||||||||||||||||||||||||
| 5021 | ret = true; | - | ||||||||||||||||||||||||
| 5022 | break; never executed: break; | 0 | ||||||||||||||||||||||||
| 5023 | - | |||||||||||||||||||||||||
| 5024 | case SH_Menu_FillScreenWithScroll: never executed: case SH_Menu_FillScreenWithScroll: | 0 | ||||||||||||||||||||||||
| 5025 | ret = true; | - | ||||||||||||||||||||||||
| 5026 | break; never executed: break; | 0 | ||||||||||||||||||||||||
| 5027 | - | |||||||||||||||||||||||||
| 5028 | case SH_ToolTipLabel_Opacity: never executed: case SH_ToolTipLabel_Opacity: | 0 | ||||||||||||||||||||||||
| 5029 | ret = 255; | - | ||||||||||||||||||||||||
| 5030 | break; never executed: break; | 0 | ||||||||||||||||||||||||
| 5031 | - | |||||||||||||||||||||||||
| 5032 | case SH_Button_FocusPolicy: never executed: case SH_Button_FocusPolicy: | 0 | ||||||||||||||||||||||||
| 5033 | ret = Qt::StrongFocus; | - | ||||||||||||||||||||||||
| 5034 | break; never executed: break; | 0 | ||||||||||||||||||||||||
| 5035 | - | |||||||||||||||||||||||||
| 5036 | case SH_MessageBox_UseBorderForButtonSpacing: never executed: case SH_MessageBox_UseBorderForButtonSpacing: | 0 | ||||||||||||||||||||||||
| 5037 | ret = 0; | - | ||||||||||||||||||||||||
| 5038 | break; never executed: break; | 0 | ||||||||||||||||||||||||
| 5039 | - | |||||||||||||||||||||||||
| 5040 | case SH_ToolButton_PopupDelay: never executed: case SH_ToolButton_PopupDelay: | 0 | ||||||||||||||||||||||||
| 5041 | ret = 600; | - | ||||||||||||||||||||||||
| 5042 | break; never executed: break; | 0 | ||||||||||||||||||||||||
| 5043 | - | |||||||||||||||||||||||||
| 5044 | case SH_FocusFrame_Mask: never executed: case SH_FocusFrame_Mask: | 0 | ||||||||||||||||||||||||
| 5045 | ret = 1; | - | ||||||||||||||||||||||||
| 5046 | if (widget) {
| 0 | ||||||||||||||||||||||||
| 5047 | if(QStyleHintReturnMask *mask = qstyleoption_cast<QStyleHintReturnMask*>(hret)) {
| 0 | ||||||||||||||||||||||||
| 5048 | mask->region = widget->rect(); | - | ||||||||||||||||||||||||
| 5049 | int vmargin = proxy()->pixelMetric(QStyle::PM_FocusFrameVMargin), | - | ||||||||||||||||||||||||
| 5050 | hmargin = proxy()->pixelMetric(QStyle::PM_FocusFrameHMargin); | - | ||||||||||||||||||||||||
| 5051 | mask->region -= QRect(widget->rect().adjusted(hmargin, vmargin, -hmargin, -vmargin)); | - | ||||||||||||||||||||||||
| 5052 | } never executed: end of block | 0 | ||||||||||||||||||||||||
| 5053 | } never executed: end of block | 0 | ||||||||||||||||||||||||
| 5054 | break; never executed: break; | 0 | ||||||||||||||||||||||||
| 5055 | #ifndef QT_NO_RUBBERBAND | - | ||||||||||||||||||||||||
| 5056 | case SH_RubberBand_Mask: never executed: case SH_RubberBand_Mask: | 0 | ||||||||||||||||||||||||
| 5057 | if (const QStyleOptionRubberBand *rbOpt = qstyleoption_cast<const QStyleOptionRubberBand *>(opt)) {
| 0 | ||||||||||||||||||||||||
| 5058 | ret = 0; | - | ||||||||||||||||||||||||
| 5059 | if (rbOpt->shape == QRubberBand::Rectangle) {
| 0 | ||||||||||||||||||||||||
| 5060 | ret = true; | - | ||||||||||||||||||||||||
| 5061 | if(QStyleHintReturnMask *mask = qstyleoption_cast<QStyleHintReturnMask*>(hret)) {
| 0 | ||||||||||||||||||||||||
| 5062 | mask->region = opt->rect; | - | ||||||||||||||||||||||||
| 5063 | int margin = proxy()->pixelMetric(PM_DefaultFrameWidth) * 2; | - | ||||||||||||||||||||||||
| 5064 | mask->region -= opt->rect.adjusted(margin, margin, -margin, -margin); | - | ||||||||||||||||||||||||
| 5065 | } never executed: end of block | 0 | ||||||||||||||||||||||||
| 5066 | } never executed: end of block | 0 | ||||||||||||||||||||||||
| 5067 | } never executed: end of block | 0 | ||||||||||||||||||||||||
| 5068 | break; never executed: break; | 0 | ||||||||||||||||||||||||
| 5069 | #endif // QT_NO_RUBBERBAND | - | ||||||||||||||||||||||||
| 5070 | case SH_SpinControls_DisableOnBounds: never executed: case SH_SpinControls_DisableOnBounds: | 0 | ||||||||||||||||||||||||
| 5071 | ret = 1; | - | ||||||||||||||||||||||||
| 5072 | break; never executed: break; | 0 | ||||||||||||||||||||||||
| 5073 | - | |||||||||||||||||||||||||
| 5074 | case SH_Dial_BackgroundRole: never executed: case SH_Dial_BackgroundRole: | 0 | ||||||||||||||||||||||||
| 5075 | ret = QPalette::Window; | - | ||||||||||||||||||||||||
| 5076 | break; never executed: break; | 0 | ||||||||||||||||||||||||
| 5077 | - | |||||||||||||||||||||||||
| 5078 | case SH_ComboBox_LayoutDirection: never executed: case SH_ComboBox_LayoutDirection: | 0 | ||||||||||||||||||||||||
| 5079 | ret = opt ? opt->direction : Qt::LeftToRight;
| 0 | ||||||||||||||||||||||||
| 5080 | break; never executed: break; | 0 | ||||||||||||||||||||||||
| 5081 | - | |||||||||||||||||||||||||
| 5082 | case SH_ItemView_EllipsisLocation: never executed: case SH_ItemView_EllipsisLocation: | 0 | ||||||||||||||||||||||||
| 5083 | ret = Qt::AlignTrailing; | - | ||||||||||||||||||||||||
| 5084 | break; never executed: break; | 0 | ||||||||||||||||||||||||
| 5085 | - | |||||||||||||||||||||||||
| 5086 | case SH_ItemView_ShowDecorationSelected: never executed: case SH_ItemView_ShowDecorationSelected: | 0 | ||||||||||||||||||||||||
| 5087 | ret = false; | - | ||||||||||||||||||||||||
| 5088 | break; never executed: break; | 0 | ||||||||||||||||||||||||
| 5089 | - | |||||||||||||||||||||||||
| 5090 | case SH_ItemView_ActivateItemOnSingleClick: never executed: case SH_ItemView_ActivateItemOnSingleClick: | 0 | ||||||||||||||||||||||||
| 5091 | ret = 0; | - | ||||||||||||||||||||||||
| 5092 | if (const QPlatformTheme *theme = QGuiApplicationPrivate::platformTheme())
| 0 | ||||||||||||||||||||||||
| 5093 | ret = theme->themeHint(QPlatformTheme::ItemViewActivateItemOnSingleClick).toBool() ? 1 : 0; never executed: ret = theme->themeHint(QPlatformTheme::ItemViewActivateItemOnSingleClick).toBool() ? 1 : 0;
| 0 | ||||||||||||||||||||||||
| 5094 | break; never executed: break; | 0 | ||||||||||||||||||||||||
| 5095 | case SH_TitleBar_ModifyNotification: never executed: case SH_TitleBar_ModifyNotification: | 0 | ||||||||||||||||||||||||
| 5096 | ret = true; | - | ||||||||||||||||||||||||
| 5097 | break; never executed: break; | 0 | ||||||||||||||||||||||||
| 5098 | case SH_ScrollBar_RollBetweenButtons: never executed: case SH_ScrollBar_RollBetweenButtons: | 0 | ||||||||||||||||||||||||
| 5099 | ret = false; | - | ||||||||||||||||||||||||
| 5100 | break; never executed: break; | 0 | ||||||||||||||||||||||||
| 5101 | case SH_TabBar_ElideMode: never executed: case SH_TabBar_ElideMode: | 0 | ||||||||||||||||||||||||
| 5102 | ret = Qt::ElideNone; | - | ||||||||||||||||||||||||
| 5103 | break; never executed: break; | 0 | ||||||||||||||||||||||||
| 5104 | case SH_DialogButtonLayout: never executed: case SH_DialogButtonLayout: | 0 | ||||||||||||||||||||||||
| 5105 | ret = QDialogButtonBox::WinLayout; | - | ||||||||||||||||||||||||
| 5106 | if (const QPlatformTheme *theme = QGuiApplicationPrivate::platformTheme())
| 0 | ||||||||||||||||||||||||
| 5107 | ret = theme->themeHint(QPlatformTheme::DialogButtonBoxLayout).toInt(); never executed: ret = theme->themeHint(QPlatformTheme::DialogButtonBoxLayout).toInt(); | 0 | ||||||||||||||||||||||||
| 5108 | break; never executed: break; | 0 | ||||||||||||||||||||||||
| 5109 | case SH_ComboBox_PopupFrameStyle: never executed: case SH_ComboBox_PopupFrameStyle: | 0 | ||||||||||||||||||||||||
| 5110 | ret = QFrame::StyledPanel | QFrame::Plain; | - | ||||||||||||||||||||||||
| 5111 | break; never executed: break; | 0 | ||||||||||||||||||||||||
| 5112 | case SH_MessageBox_TextInteractionFlags: never executed: case SH_MessageBox_TextInteractionFlags: | 0 | ||||||||||||||||||||||||
| 5113 | ret = Qt::LinksAccessibleByMouse; | - | ||||||||||||||||||||||||
| 5114 | break; never executed: break; | 0 | ||||||||||||||||||||||||
| 5115 | case SH_DialogButtonBox_ButtonsHaveIcons: never executed: case SH_DialogButtonBox_ButtonsHaveIcons: | 0 | ||||||||||||||||||||||||
| 5116 | ret = 0; | - | ||||||||||||||||||||||||
| 5117 | if (const QPlatformTheme *theme = QGuiApplicationPrivate::platformTheme())
| 0 | ||||||||||||||||||||||||
| 5118 | ret = theme->themeHint(QPlatformTheme::DialogButtonBoxButtonsHaveIcons).toBool() ? 1 : 0; never executed: ret = theme->themeHint(QPlatformTheme::DialogButtonBoxButtonsHaveIcons).toBool() ? 1 : 0;
| 0 | ||||||||||||||||||||||||
| 5119 | break; never executed: break; | 0 | ||||||||||||||||||||||||
| 5120 | case SH_SpellCheckUnderlineStyle: never executed: case SH_SpellCheckUnderlineStyle: | 0 | ||||||||||||||||||||||||
| 5121 | ret = QTextCharFormat::WaveUnderline; | - | ||||||||||||||||||||||||
| 5122 | break; never executed: break; | 0 | ||||||||||||||||||||||||
| 5123 | case SH_MessageBox_CenterButtons: never executed: case SH_MessageBox_CenterButtons: | 0 | ||||||||||||||||||||||||
| 5124 | ret = true; | - | ||||||||||||||||||||||||
| 5125 | break; never executed: break; | 0 | ||||||||||||||||||||||||
| 5126 | case SH_ItemView_MovementWithoutUpdatingSelection: never executed: case SH_ItemView_MovementWithoutUpdatingSelection: | 0 | ||||||||||||||||||||||||
| 5127 | ret = true; | - | ||||||||||||||||||||||||
| 5128 | break; never executed: break; | 0 | ||||||||||||||||||||||||
| 5129 | case SH_FocusFrame_AboveWidget: never executed: case SH_FocusFrame_AboveWidget: | 0 | ||||||||||||||||||||||||
| 5130 | ret = false; | - | ||||||||||||||||||||||||
| 5131 | break; never executed: break; | 0 | ||||||||||||||||||||||||
| 5132 | #ifndef QT_NO_TABWIDGET | - | ||||||||||||||||||||||||
| 5133 | case SH_TabWidget_DefaultTabPosition: never executed: case SH_TabWidget_DefaultTabPosition: | 0 | ||||||||||||||||||||||||
| 5134 | ret = QTabWidget::North; | - | ||||||||||||||||||||||||
| 5135 | break; never executed: break; | 0 | ||||||||||||||||||||||||
| 5136 | #endif | - | ||||||||||||||||||||||||
| 5137 | case SH_ToolBar_Movable: never executed: case SH_ToolBar_Movable: | 0 | ||||||||||||||||||||||||
| 5138 | ret = true; | - | ||||||||||||||||||||||||
| 5139 | break; never executed: break; | 0 | ||||||||||||||||||||||||
| 5140 | case SH_TextControl_FocusIndicatorTextCharFormat: never executed: case SH_TextControl_FocusIndicatorTextCharFormat: | 0 | ||||||||||||||||||||||||
| 5141 | ret = true; | - | ||||||||||||||||||||||||
| 5142 | if (QStyleHintReturnVariant *vret = qstyleoption_cast<QStyleHintReturnVariant*>(hret)) {
| 0 | ||||||||||||||||||||||||
| 5143 | QPen outline(opt->palette.color(QPalette::Text), 1, Qt::DotLine); | - | ||||||||||||||||||||||||
| 5144 | QTextCharFormat fmt; | - | ||||||||||||||||||||||||
| 5145 | fmt.setProperty(QTextFormat::OutlinePen, outline); | - | ||||||||||||||||||||||||
| 5146 | vret->variant = fmt; | - | ||||||||||||||||||||||||
| 5147 | } never executed: end of block | 0 | ||||||||||||||||||||||||
| 5148 | break; never executed: break; | 0 | ||||||||||||||||||||||||
| 5149 | #ifndef QT_NO_WIZARD | - | ||||||||||||||||||||||||
| 5150 | case SH_WizardStyle: never executed: case SH_WizardStyle: | 0 | ||||||||||||||||||||||||
| 5151 | ret = QWizard::ClassicStyle; | - | ||||||||||||||||||||||||
| 5152 | break; never executed: break; | 0 | ||||||||||||||||||||||||
| 5153 | #endif | - | ||||||||||||||||||||||||
| 5154 | case SH_FormLayoutWrapPolicy: never executed: case SH_FormLayoutWrapPolicy: | 0 | ||||||||||||||||||||||||
| 5155 | ret = QFormLayout::DontWrapRows; | - | ||||||||||||||||||||||||
| 5156 | break; never executed: break; | 0 | ||||||||||||||||||||||||
| 5157 | case SH_FormLayoutFieldGrowthPolicy: never executed: case SH_FormLayoutFieldGrowthPolicy: | 0 | ||||||||||||||||||||||||
| 5158 | ret = QFormLayout::AllNonFixedFieldsGrow; | - | ||||||||||||||||||||||||
| 5159 | break; never executed: break; | 0 | ||||||||||||||||||||||||
| 5160 | case SH_FormLayoutFormAlignment: never executed: case SH_FormLayoutFormAlignment: | 0 | ||||||||||||||||||||||||
| 5161 | ret = Qt::AlignLeft | Qt::AlignTop; | - | ||||||||||||||||||||||||
| 5162 | break; never executed: break; | 0 | ||||||||||||||||||||||||
| 5163 | case SH_FormLayoutLabelAlignment: never executed: case SH_FormLayoutLabelAlignment: | 0 | ||||||||||||||||||||||||
| 5164 | ret = Qt::AlignLeft; | - | ||||||||||||||||||||||||
| 5165 | break; never executed: break; | 0 | ||||||||||||||||||||||||
| 5166 | case SH_ItemView_ArrowKeysNavigateIntoChildren: never executed: case SH_ItemView_ArrowKeysNavigateIntoChildren: | 0 | ||||||||||||||||||||||||
| 5167 | ret = false; | - | ||||||||||||||||||||||||
| 5168 | break; never executed: break; | 0 | ||||||||||||||||||||||||
| 5169 | case SH_ItemView_DrawDelegateFrame: never executed: case SH_ItemView_DrawDelegateFrame: | 0 | ||||||||||||||||||||||||
| 5170 | ret = 0; | - | ||||||||||||||||||||||||
| 5171 | break; never executed: break; | 0 | ||||||||||||||||||||||||
| 5172 | #ifndef QT_NO_TABBAR | - | ||||||||||||||||||||||||
| 5173 | case SH_TabBar_CloseButtonPosition: never executed: case SH_TabBar_CloseButtonPosition: | 0 | ||||||||||||||||||||||||
| 5174 | ret = QTabBar::RightSide; | - | ||||||||||||||||||||||||
| 5175 | break; never executed: break; | 0 | ||||||||||||||||||||||||
| 5176 | case SH_TabBar_ChangeCurrentDelay: never executed: case SH_TabBar_ChangeCurrentDelay: | 0 | ||||||||||||||||||||||||
| 5177 | ret = 500; | - | ||||||||||||||||||||||||
| 5178 | break; never executed: break; | 0 | ||||||||||||||||||||||||
| 5179 | #endif | - | ||||||||||||||||||||||||
| 5180 | case SH_DockWidget_ButtonsHaveFrame: never executed: case SH_DockWidget_ButtonsHaveFrame: | 0 | ||||||||||||||||||||||||
| 5181 | ret = true; | - | ||||||||||||||||||||||||
| 5182 | break; never executed: break; | 0 | ||||||||||||||||||||||||
| 5183 | case SH_ToolButtonStyle: never executed: case SH_ToolButtonStyle: | 0 | ||||||||||||||||||||||||
| 5184 | ret = 0; | - | ||||||||||||||||||||||||
| 5185 | if (const QPlatformTheme *theme = QGuiApplicationPrivate::platformTheme())
| 0 | ||||||||||||||||||||||||
| 5186 | ret = theme->themeHint(QPlatformTheme::ToolButtonStyle).toInt(); never executed: ret = theme->themeHint(QPlatformTheme::ToolButtonStyle).toInt(); | 0 | ||||||||||||||||||||||||
| 5187 | break; never executed: break; | 0 | ||||||||||||||||||||||||
| 5188 | case SH_RequestSoftwareInputPanel: never executed: case SH_RequestSoftwareInputPanel: | 0 | ||||||||||||||||||||||||
| 5189 | ret = RSIP_OnMouseClick; | - | ||||||||||||||||||||||||
| 5190 | break; never executed: break; | 0 | ||||||||||||||||||||||||
| 5191 | case SH_ScrollBar_Transient: never executed: case SH_ScrollBar_Transient: | 0 | ||||||||||||||||||||||||
| 5192 | ret = false; | - | ||||||||||||||||||||||||
| 5193 | break; never executed: break; | 0 | ||||||||||||||||||||||||
| 5194 | case SH_Menu_SupportsSections: never executed: case SH_Menu_SupportsSections: | 0 | ||||||||||||||||||||||||
| 5195 | ret = false; | - | ||||||||||||||||||||||||
| 5196 | break; never executed: break; | 0 | ||||||||||||||||||||||||
| 5197 | #ifndef QT_NO_TOOLTIP | - | ||||||||||||||||||||||||
| 5198 | case SH_ToolTip_WakeUpDelay: never executed: case SH_ToolTip_WakeUpDelay: | 0 | ||||||||||||||||||||||||
| 5199 | ret = 700; | - | ||||||||||||||||||||||||
| 5200 | break; never executed: break; | 0 | ||||||||||||||||||||||||
| 5201 | case SH_ToolTip_FallAsleepDelay: never executed: case SH_ToolTip_FallAsleepDelay: | 0 | ||||||||||||||||||||||||
| 5202 | ret = 2000; | - | ||||||||||||||||||||||||
| 5203 | break; never executed: break; | 0 | ||||||||||||||||||||||||
| 5204 | #endif | - | ||||||||||||||||||||||||
| 5205 | case SH_Widget_Animate: never executed: case SH_Widget_Animate: | 0 | ||||||||||||||||||||||||
| 5206 | #ifndef QT_NO_TREEVIEW | - | ||||||||||||||||||||||||
| 5207 | if (qobject_cast<const QTreeView*>(widget)) {
| 0 | ||||||||||||||||||||||||
| 5208 | ret = false; | - | ||||||||||||||||||||||||
| 5209 | } else never executed: end of block | 0 | ||||||||||||||||||||||||
| 5210 | #endif | - | ||||||||||||||||||||||||
| 5211 | { | - | ||||||||||||||||||||||||
| 5212 | ret = true; | - | ||||||||||||||||||||||||
| 5213 | } never executed: end of block | 0 | ||||||||||||||||||||||||
| 5214 | break; never executed: break; | 0 | ||||||||||||||||||||||||
| 5215 | case SH_Splitter_OpaqueResize: never executed: case SH_Splitter_OpaqueResize: | 0 | ||||||||||||||||||||||||
| 5216 | ret = true; | - | ||||||||||||||||||||||||
| 5217 | break; never executed: break; | 0 | ||||||||||||||||||||||||
| 5218 | case SH_ItemView_ScrollMode: never executed: case SH_ItemView_ScrollMode: | 0 | ||||||||||||||||||||||||
| 5219 | ret = QAbstractItemView::ScrollPerItem; | - | ||||||||||||||||||||||||
| 5220 | break; never executed: break; | 0 | ||||||||||||||||||||||||
| 5221 | default: never executed: default: | 0 | ||||||||||||||||||||||||
| 5222 | ret = 0; | - | ||||||||||||||||||||||||
| 5223 | break; never executed: break; | 0 | ||||||||||||||||||||||||
| 5224 | } | - | ||||||||||||||||||||||||
| 5225 | - | |||||||||||||||||||||||||
| 5226 | return ret; never executed: return ret; | 0 | ||||||||||||||||||||||||
| 5227 | } | - | ||||||||||||||||||||||||
| 5228 | - | |||||||||||||||||||||||||
| 5229 | static QPixmap cachedPixmapFromXPM(const char * const *xpm) | - | ||||||||||||||||||||||||
| 5230 | { | - | ||||||||||||||||||||||||
| 5231 | QPixmap result; | - | ||||||||||||||||||||||||
| 5232 | const QString tag = QString::asprintf("xpm:0x%p", static_cast<const void*>(xpm)); | - | ||||||||||||||||||||||||
| 5233 | if (!QPixmapCache::find(tag, &result)) { | - | ||||||||||||||||||||||||
| 5234 | result = QPixmap(xpm); | - | ||||||||||||||||||||||||
| 5235 | QPixmapCache::insert(tag, result); | - | ||||||||||||||||||||||||
| 5236 | } | - | ||||||||||||||||||||||||
| 5237 | return result; | - | ||||||||||||||||||||||||
| 5238 | } | - | ||||||||||||||||||||||||
| 5239 | - | |||||||||||||||||||||||||
| 5240 | static inline QPixmap titleBarMenuCachedPixmapFromXPM() { return cachedPixmapFromXPM(qt_menu_xpm); } | - | ||||||||||||||||||||||||
| 5241 | - | |||||||||||||||||||||||||
| 5242 | #ifndef QT_NO_IMAGEFORMAT_PNG | - | ||||||||||||||||||||||||
| 5243 | static inline QString clearText16IconPath() | - | ||||||||||||||||||||||||
| 5244 | { | - | ||||||||||||||||||||||||
| 5245 | return QStringLiteral(":/qt-project.org/styles/commonstyle/images/cleartext-16.png"); | - | ||||||||||||||||||||||||
| 5246 | } | - | ||||||||||||||||||||||||
| 5247 | #endif // !QT_NO_IMAGEFORMAT_PNG | - | ||||||||||||||||||||||||
| 5248 | - | |||||||||||||||||||||||||
| 5249 | static QIcon clearTextIcon(bool rtl) | - | ||||||||||||||||||||||||
| 5250 | { | - | ||||||||||||||||||||||||
| 5251 | const QString directionalThemeName = rtl | - | ||||||||||||||||||||||||
| 5252 | ? QStringLiteral("edit-clear-locationbar-ltr") : QStringLiteral("edit-clear-locationbar-rtl"); | - | ||||||||||||||||||||||||
| 5253 | if (QIcon::hasThemeIcon(directionalThemeName)) | - | ||||||||||||||||||||||||
| 5254 | return QIcon::fromTheme(directionalThemeName); | - | ||||||||||||||||||||||||
| 5255 | const QString themeName = QStringLiteral("edit-clear"); | - | ||||||||||||||||||||||||
| 5256 | if (QIcon::hasThemeIcon(themeName)) | - | ||||||||||||||||||||||||
| 5257 | return QIcon::fromTheme(themeName); | - | ||||||||||||||||||||||||
| 5258 | - | |||||||||||||||||||||||||
| 5259 | QIcon icon; | - | ||||||||||||||||||||||||
| 5260 | #ifndef QT_NO_IMAGEFORMAT_PNG | - | ||||||||||||||||||||||||
| 5261 | QPixmap clearText16(clearText16IconPath()); | - | ||||||||||||||||||||||||
| 5262 | Q_ASSERT(!clearText16.size().isEmpty()); | - | ||||||||||||||||||||||||
| 5263 | icon.addPixmap(clearText16); | - | ||||||||||||||||||||||||
| 5264 | QPixmap clearText32(QStringLiteral(":/qt-project.org/styles/commonstyle/images/cleartext-32.png")); | - | ||||||||||||||||||||||||
| 5265 | Q_ASSERT(!clearText32.size().isEmpty()); | - | ||||||||||||||||||||||||
| 5266 | icon.addPixmap(clearText32); | - | ||||||||||||||||||||||||
| 5267 | clearText32.setDevicePixelRatio(2); // The 32x32 pixmap can also be used for 16x16/devicePixelRatio=2 | - | ||||||||||||||||||||||||
| 5268 | icon.addPixmap(clearText32); | - | ||||||||||||||||||||||||
| 5269 | #endif // !QT_NO_IMAGEFORMAT_PNG | - | ||||||||||||||||||||||||
| 5270 | return icon; | - | ||||||||||||||||||||||||
| 5271 | } | - | ||||||||||||||||||||||||
| 5272 | - | |||||||||||||||||||||||||
| 5273 | /*! \reimp */ | - | ||||||||||||||||||||||||
| 5274 | QPixmap QCommonStyle::standardPixmap(StandardPixmap sp, const QStyleOption *option, | - | ||||||||||||||||||||||||
| 5275 | const QWidget *widget) const | - | ||||||||||||||||||||||||
| 5276 | { | - | ||||||||||||||||||||||||
| 5277 | const bool rtl = (option && option->direction == Qt::RightToLeft) || (!option && QApplication::isRightToLeft()); | - | ||||||||||||||||||||||||
| 5278 | #ifdef QT_NO_IMAGEFORMAT_PNG | - | ||||||||||||||||||||||||
| 5279 | Q_UNUSED(widget); | - | ||||||||||||||||||||||||
| 5280 | Q_UNUSED(sp); | - | ||||||||||||||||||||||||
| 5281 | #else | - | ||||||||||||||||||||||||
| 5282 | QPixmap pixmap; | - | ||||||||||||||||||||||||
| 5283 | - | |||||||||||||||||||||||||
| 5284 | if (QApplication::desktopSettingsAware() && !QIcon::themeName().isEmpty()) { | - | ||||||||||||||||||||||||
| 5285 | switch (sp) { | - | ||||||||||||||||||||||||
| 5286 | case SP_DialogYesButton: | - | ||||||||||||||||||||||||
| 5287 | case SP_DialogOkButton: | - | ||||||||||||||||||||||||
| 5288 | pixmap = QIcon::fromTheme(QLatin1String("dialog-ok")).pixmap(16); | - | ||||||||||||||||||||||||
| 5289 | break; | - | ||||||||||||||||||||||||
| 5290 | case SP_DialogApplyButton: | - | ||||||||||||||||||||||||
| 5291 | pixmap = QIcon::fromTheme(QLatin1String("dialog-ok-apply")).pixmap(16); | - | ||||||||||||||||||||||||
| 5292 | break; | - | ||||||||||||||||||||||||
| 5293 | case SP_DialogDiscardButton: | - | ||||||||||||||||||||||||
| 5294 | pixmap = QIcon::fromTheme(QLatin1String("edit-delete")).pixmap(16); | - | ||||||||||||||||||||||||
| 5295 | break; | - | ||||||||||||||||||||||||
| 5296 | case SP_DialogCloseButton: | - | ||||||||||||||||||||||||
| 5297 | pixmap = QIcon::fromTheme(QLatin1String("dialog-close")).pixmap(16); | - | ||||||||||||||||||||||||
| 5298 | break; | - | ||||||||||||||||||||||||
| 5299 | case SP_DirHomeIcon: | - | ||||||||||||||||||||||||
| 5300 | pixmap = QIcon::fromTheme(QLatin1String("user-home")).pixmap(16); | - | ||||||||||||||||||||||||
| 5301 | break; | - | ||||||||||||||||||||||||
| 5302 | case SP_MessageBoxInformation: | - | ||||||||||||||||||||||||
| 5303 | pixmap = QIcon::fromTheme(QLatin1String("messagebox_info")).pixmap(16); | - | ||||||||||||||||||||||||
| 5304 | break; | - | ||||||||||||||||||||||||
| 5305 | case SP_MessageBoxWarning: | - | ||||||||||||||||||||||||
| 5306 | pixmap = QIcon::fromTheme(QLatin1String("messagebox_warning")).pixmap(16); | - | ||||||||||||||||||||||||
| 5307 | break; | - | ||||||||||||||||||||||||
| 5308 | case SP_MessageBoxCritical: | - | ||||||||||||||||||||||||
| 5309 | pixmap = QIcon::fromTheme(QLatin1String("messagebox_critical")).pixmap(16); | - | ||||||||||||||||||||||||
| 5310 | break; | - | ||||||||||||||||||||||||
| 5311 | case SP_MessageBoxQuestion: | - | ||||||||||||||||||||||||
| 5312 | pixmap = QIcon::fromTheme(QLatin1String("help")).pixmap(16); | - | ||||||||||||||||||||||||
| 5313 | break; | - | ||||||||||||||||||||||||
| 5314 | case SP_DialogOpenButton: | - | ||||||||||||||||||||||||
| 5315 | case SP_DirOpenIcon: | - | ||||||||||||||||||||||||
| 5316 | pixmap = QIcon::fromTheme(QLatin1String("folder-open")).pixmap(16); | - | ||||||||||||||||||||||||
| 5317 | break; | - | ||||||||||||||||||||||||
| 5318 | case SP_FileIcon: | - | ||||||||||||||||||||||||
| 5319 | pixmap = QIcon::fromTheme(QLatin1String("text-x-generic"), | - | ||||||||||||||||||||||||
| 5320 | QIcon::fromTheme(QLatin1String("empty"))).pixmap(16); | - | ||||||||||||||||||||||||
| 5321 | break; | - | ||||||||||||||||||||||||
| 5322 | case SP_DirClosedIcon: | - | ||||||||||||||||||||||||
| 5323 | case SP_DirIcon: | - | ||||||||||||||||||||||||
| 5324 | pixmap = QIcon::fromTheme(QLatin1String("folder")).pixmap(16); | - | ||||||||||||||||||||||||
| 5325 | break; | - | ||||||||||||||||||||||||
| 5326 | case SP_DriveFDIcon: | - | ||||||||||||||||||||||||
| 5327 | pixmap = QIcon::fromTheme(QLatin1String("media-floppy"), | - | ||||||||||||||||||||||||
| 5328 | QIcon::fromTheme(QLatin1String("3floppy_unmount"))).pixmap(16); | - | ||||||||||||||||||||||||
| 5329 | break; | - | ||||||||||||||||||||||||
| 5330 | case SP_ComputerIcon: | - | ||||||||||||||||||||||||
| 5331 | pixmap = QIcon::fromTheme(QLatin1String("computer"), | - | ||||||||||||||||||||||||
| 5332 | QIcon::fromTheme(QLatin1String("system"))).pixmap(16); | - | ||||||||||||||||||||||||
| 5333 | break; | - | ||||||||||||||||||||||||
| 5334 | case SP_DesktopIcon: | - | ||||||||||||||||||||||||
| 5335 | pixmap = QIcon::fromTheme(QLatin1String("user-desktop"), | - | ||||||||||||||||||||||||
| 5336 | QIcon::fromTheme(QLatin1String("desktop"))).pixmap(16); | - | ||||||||||||||||||||||||
| 5337 | break; | - | ||||||||||||||||||||||||
| 5338 | case SP_TrashIcon: | - | ||||||||||||||||||||||||
| 5339 | pixmap = QIcon::fromTheme(QLatin1String("user-trash"), | - | ||||||||||||||||||||||||
| 5340 | QIcon::fromTheme(QLatin1String("trashcan_empty"))).pixmap(16); | - | ||||||||||||||||||||||||
| 5341 | break; | - | ||||||||||||||||||||||||
| 5342 | case SP_DriveCDIcon: | - | ||||||||||||||||||||||||
| 5343 | case SP_DriveDVDIcon: | - | ||||||||||||||||||||||||
| 5344 | pixmap = QIcon::fromTheme(QLatin1String("media-optical"), | - | ||||||||||||||||||||||||
| 5345 | QIcon::fromTheme(QLatin1String("cdrom_unmount"))).pixmap(16); | - | ||||||||||||||||||||||||
| 5346 | break; | - | ||||||||||||||||||||||||
| 5347 | case SP_DriveHDIcon: | - | ||||||||||||||||||||||||
| 5348 | pixmap = QIcon::fromTheme(QLatin1String("drive-harddisk"), | - | ||||||||||||||||||||||||
| 5349 | QIcon::fromTheme(QLatin1String("hdd_unmount"))).pixmap(16); | - | ||||||||||||||||||||||||
| 5350 | break; | - | ||||||||||||||||||||||||
| 5351 | case SP_FileDialogToParent: | - | ||||||||||||||||||||||||
| 5352 | pixmap = QIcon::fromTheme(QLatin1String("go-up"), | - | ||||||||||||||||||||||||
| 5353 | QIcon::fromTheme(QLatin1String("up"))).pixmap(16); | - | ||||||||||||||||||||||||
| 5354 | break; | - | ||||||||||||||||||||||||
| 5355 | case SP_FileDialogNewFolder: | - | ||||||||||||||||||||||||
| 5356 | pixmap = QIcon::fromTheme(QLatin1String("folder_new")).pixmap(16); | - | ||||||||||||||||||||||||
| 5357 | break; | - | ||||||||||||||||||||||||
| 5358 | case SP_ArrowUp: | - | ||||||||||||||||||||||||
| 5359 | pixmap = QIcon::fromTheme(QLatin1String("go-up"), | - | ||||||||||||||||||||||||
| 5360 | QIcon::fromTheme(QLatin1String("up"))).pixmap(16); | - | ||||||||||||||||||||||||
| 5361 | break; | - | ||||||||||||||||||||||||
| 5362 | case SP_ArrowDown: | - | ||||||||||||||||||||||||
| 5363 | pixmap = QIcon::fromTheme(QLatin1String("go-down"), | - | ||||||||||||||||||||||||
| 5364 | QIcon::fromTheme(QLatin1String("down"))).pixmap(16); | - | ||||||||||||||||||||||||
| 5365 | break; | - | ||||||||||||||||||||||||
| 5366 | case SP_ArrowRight: | - | ||||||||||||||||||||||||
| 5367 | pixmap = QIcon::fromTheme(QLatin1String("go-next"), | - | ||||||||||||||||||||||||
| 5368 | QIcon::fromTheme(QLatin1String("forward"))).pixmap(16); | - | ||||||||||||||||||||||||
| 5369 | break; | - | ||||||||||||||||||||||||
| 5370 | case SP_ArrowLeft: | - | ||||||||||||||||||||||||
| 5371 | pixmap = QIcon::fromTheme(QLatin1String("go-previous"), | - | ||||||||||||||||||||||||
| 5372 | QIcon::fromTheme(QLatin1String("back"))).pixmap(16); | - | ||||||||||||||||||||||||
| 5373 | break; | - | ||||||||||||||||||||||||
| 5374 | case SP_FileDialogDetailedView: | - | ||||||||||||||||||||||||
| 5375 | pixmap = QIcon::fromTheme(QLatin1String("view_detailed")).pixmap(16); | - | ||||||||||||||||||||||||
| 5376 | break; | - | ||||||||||||||||||||||||
| 5377 | case SP_FileDialogListView: | - | ||||||||||||||||||||||||
| 5378 | pixmap = QIcon::fromTheme(QLatin1String("view_icon")).pixmap(16); | - | ||||||||||||||||||||||||
| 5379 | break; | - | ||||||||||||||||||||||||
| 5380 | case SP_BrowserReload: | - | ||||||||||||||||||||||||
| 5381 | pixmap = QIcon::fromTheme(QLatin1String("reload")).pixmap(16); | - | ||||||||||||||||||||||||
| 5382 | break; | - | ||||||||||||||||||||||||
| 5383 | case SP_BrowserStop: | - | ||||||||||||||||||||||||
| 5384 | pixmap = QIcon::fromTheme(QLatin1String("process-stop")).pixmap(16); | - | ||||||||||||||||||||||||
| 5385 | break; | - | ||||||||||||||||||||||||
| 5386 | case SP_MediaPlay: | - | ||||||||||||||||||||||||
| 5387 | pixmap = QIcon::fromTheme(QLatin1String("media-playback-start")).pixmap(16); | - | ||||||||||||||||||||||||
| 5388 | break; | - | ||||||||||||||||||||||||
| 5389 | case SP_MediaPause: | - | ||||||||||||||||||||||||
| 5390 | pixmap = QIcon::fromTheme(QLatin1String("media-playback-pause")).pixmap(16); | - | ||||||||||||||||||||||||
| 5391 | break; | - | ||||||||||||||||||||||||
| 5392 | case SP_MediaStop: | - | ||||||||||||||||||||||||
| 5393 | pixmap = QIcon::fromTheme(QLatin1String("media-playback-stop")).pixmap(16); | - | ||||||||||||||||||||||||
| 5394 | break; | - | ||||||||||||||||||||||||
| 5395 | case SP_MediaSeekForward: | - | ||||||||||||||||||||||||
| 5396 | pixmap = QIcon::fromTheme(QLatin1String("media-seek-forward")).pixmap(16); | - | ||||||||||||||||||||||||
| 5397 | break; | - | ||||||||||||||||||||||||
| 5398 | case SP_MediaSeekBackward: | - | ||||||||||||||||||||||||
| 5399 | pixmap = QIcon::fromTheme(QLatin1String("media-seek-backward")).pixmap(16); | - | ||||||||||||||||||||||||
| 5400 | break; | - | ||||||||||||||||||||||||
| 5401 | case SP_MediaSkipForward: | - | ||||||||||||||||||||||||
| 5402 | pixmap = QIcon::fromTheme(QLatin1String("media-skip-forward")).pixmap(16); | - | ||||||||||||||||||||||||
| 5403 | break; | - | ||||||||||||||||||||||||
| 5404 | case SP_MediaSkipBackward: | - | ||||||||||||||||||||||||
| 5405 | pixmap = QIcon::fromTheme(QLatin1String("media-skip-backward")).pixmap(16); | - | ||||||||||||||||||||||||
| 5406 | break; | - | ||||||||||||||||||||||||
| 5407 | case SP_DialogResetButton: | - | ||||||||||||||||||||||||
| 5408 | pixmap = QIcon::fromTheme(QLatin1String("edit-clear")).pixmap(24); | - | ||||||||||||||||||||||||
| 5409 | break; | - | ||||||||||||||||||||||||
| 5410 | case SP_DialogHelpButton: | - | ||||||||||||||||||||||||
| 5411 | pixmap = QIcon::fromTheme(QLatin1String("help-contents")).pixmap(24); | - | ||||||||||||||||||||||||
| 5412 | break; | - | ||||||||||||||||||||||||
| 5413 | case SP_DialogNoButton: | - | ||||||||||||||||||||||||
| 5414 | case SP_DialogCancelButton: | - | ||||||||||||||||||||||||
| 5415 | pixmap = QIcon::fromTheme(QLatin1String("dialog-cancel"), | - | ||||||||||||||||||||||||
| 5416 | QIcon::fromTheme(QLatin1String("process-stop"))).pixmap(24); | - | ||||||||||||||||||||||||
| 5417 | break; | - | ||||||||||||||||||||||||
| 5418 | case SP_DialogSaveButton: | - | ||||||||||||||||||||||||
| 5419 | pixmap = QIcon::fromTheme(QLatin1String("document-save")).pixmap(24); | - | ||||||||||||||||||||||||
| 5420 | break; | - | ||||||||||||||||||||||||
| 5421 | case SP_FileLinkIcon: | - | ||||||||||||||||||||||||
| 5422 | pixmap = QIcon::fromTheme(QLatin1String("emblem-symbolic-link")).pixmap(16); | - | ||||||||||||||||||||||||
| 5423 | if (!pixmap.isNull()) { | - | ||||||||||||||||||||||||
| 5424 | QPixmap fileIcon = QIcon::fromTheme(QLatin1String("text-x-generic")).pixmap(16); | - | ||||||||||||||||||||||||
| 5425 | if (fileIcon.isNull()) | - | ||||||||||||||||||||||||
| 5426 | fileIcon = QIcon::fromTheme(QLatin1String("empty")).pixmap(16); | - | ||||||||||||||||||||||||
| 5427 | if (!fileIcon.isNull()) { | - | ||||||||||||||||||||||||
| 5428 | QPainter painter(&fileIcon); | - | ||||||||||||||||||||||||
| 5429 | painter.drawPixmap(0, 0, 16, 16, pixmap); | - | ||||||||||||||||||||||||
| 5430 | return fileIcon; | - | ||||||||||||||||||||||||
| 5431 | } | - | ||||||||||||||||||||||||
| 5432 | } | - | ||||||||||||||||||||||||
| 5433 | break; | - | ||||||||||||||||||||||||
| 5434 | case SP_DirLinkIcon: | - | ||||||||||||||||||||||||
| 5435 | pixmap = QIcon::fromTheme(QLatin1String("emblem-symbolic-link")).pixmap(16); | - | ||||||||||||||||||||||||
| 5436 | if (!pixmap.isNull()) { | - | ||||||||||||||||||||||||
| 5437 | QPixmap dirIcon = QIcon::fromTheme(QLatin1String("folder")).pixmap(16); | - | ||||||||||||||||||||||||
| 5438 | if (!dirIcon.isNull()) { | - | ||||||||||||||||||||||||
| 5439 | QPainter painter(&dirIcon); | - | ||||||||||||||||||||||||
| 5440 | painter.drawPixmap(0, 0, 16, 16, pixmap); | - | ||||||||||||||||||||||||
| 5441 | return dirIcon; | - | ||||||||||||||||||||||||
| 5442 | } | - | ||||||||||||||||||||||||
| 5443 | } | - | ||||||||||||||||||||||||
| 5444 | break; | - | ||||||||||||||||||||||||
| 5445 | case SP_LineEditClearButton: | - | ||||||||||||||||||||||||
| 5446 | pixmap = clearTextIcon(rtl).pixmap(16); | - | ||||||||||||||||||||||||
| 5447 | break; | - | ||||||||||||||||||||||||
| 5448 | default: | - | ||||||||||||||||||||||||
| 5449 | break; | - | ||||||||||||||||||||||||
| 5450 | } | - | ||||||||||||||||||||||||
| 5451 | } | - | ||||||||||||||||||||||||
| 5452 | - | |||||||||||||||||||||||||
| 5453 | if (!pixmap.isNull()) | - | ||||||||||||||||||||||||
| 5454 | return pixmap; | - | ||||||||||||||||||||||||
| 5455 | #endif //QT_NO_IMAGEFORMAT_PNG | - | ||||||||||||||||||||||||
| 5456 | switch (sp) { | - | ||||||||||||||||||||||||
| 5457 | #ifndef QT_NO_IMAGEFORMAT_XPM | - | ||||||||||||||||||||||||
| 5458 | case SP_ToolBarHorizontalExtensionButton: | - | ||||||||||||||||||||||||
| 5459 | if (rtl) { | - | ||||||||||||||||||||||||
| 5460 | QImage im(tb_extension_arrow_h_xpm); | - | ||||||||||||||||||||||||
| 5461 | im = im.convertToFormat(QImage::Format_ARGB32).mirrored(true, false); | - | ||||||||||||||||||||||||
| 5462 | return QPixmap::fromImage(im); | - | ||||||||||||||||||||||||
| 5463 | } | - | ||||||||||||||||||||||||
| 5464 | return cachedPixmapFromXPM(tb_extension_arrow_h_xpm); | - | ||||||||||||||||||||||||
| 5465 | case SP_ToolBarVerticalExtensionButton: | - | ||||||||||||||||||||||||
| 5466 | return cachedPixmapFromXPM(tb_extension_arrow_v_xpm); | - | ||||||||||||||||||||||||
| 5467 | case SP_FileDialogStart: | - | ||||||||||||||||||||||||
| 5468 | return cachedPixmapFromXPM(filedialog_start_xpm); | - | ||||||||||||||||||||||||
| 5469 | case SP_FileDialogEnd: | - | ||||||||||||||||||||||||
| 5470 | return cachedPixmapFromXPM(filedialog_end_xpm); | - | ||||||||||||||||||||||||
| 5471 | #endif | - | ||||||||||||||||||||||||
| 5472 | #ifndef QT_NO_IMAGEFORMAT_PNG | - | ||||||||||||||||||||||||
| 5473 | case SP_CommandLink: | - | ||||||||||||||||||||||||
| 5474 | case SP_ArrowForward: | - | ||||||||||||||||||||||||
| 5475 | if (rtl) | - | ||||||||||||||||||||||||
| 5476 | return proxy()->standardPixmap(SP_ArrowLeft, option, widget); | - | ||||||||||||||||||||||||
| 5477 | return proxy()->standardPixmap(SP_ArrowRight, option, widget); | - | ||||||||||||||||||||||||
| 5478 | case SP_ArrowBack: | - | ||||||||||||||||||||||||
| 5479 | if (rtl) | - | ||||||||||||||||||||||||
| 5480 | return proxy()->standardPixmap(SP_ArrowRight, option, widget); | - | ||||||||||||||||||||||||
| 5481 | return proxy()->standardPixmap(SP_ArrowLeft, option, widget); | - | ||||||||||||||||||||||||
| 5482 | case SP_ArrowLeft: | - | ||||||||||||||||||||||||
| 5483 | return QPixmap(QLatin1String(":/qt-project.org/styles/commonstyle/images/left-16.png")); | - | ||||||||||||||||||||||||
| 5484 | case SP_ArrowRight: | - | ||||||||||||||||||||||||
| 5485 | return QPixmap(QLatin1String(":/qt-project.org/styles/commonstyle/images/right-16.png")); | - | ||||||||||||||||||||||||
| 5486 | case SP_ArrowUp: | - | ||||||||||||||||||||||||
| 5487 | return QPixmap(QLatin1String(":/qt-project.org/styles/commonstyle/images/up-16.png")); | - | ||||||||||||||||||||||||
| 5488 | case SP_ArrowDown: | - | ||||||||||||||||||||||||
| 5489 | return QPixmap(QLatin1String(":/qt-project.org/styles/commonstyle/images/down-16.png")); | - | ||||||||||||||||||||||||
| 5490 | case SP_FileDialogToParent: | - | ||||||||||||||||||||||||
| 5491 | return proxy()->standardPixmap(SP_ArrowUp, option, widget); | - | ||||||||||||||||||||||||
| 5492 | case SP_FileDialogNewFolder: | - | ||||||||||||||||||||||||
| 5493 | return QPixmap(QLatin1String(":/qt-project.org/styles/commonstyle/images/newdirectory-16.png")); | - | ||||||||||||||||||||||||
| 5494 | case SP_FileDialogDetailedView: | - | ||||||||||||||||||||||||
| 5495 | return QPixmap(QLatin1String(":/qt-project.org/styles/commonstyle/images/viewdetailed-16.png")); | - | ||||||||||||||||||||||||
| 5496 | case SP_FileDialogInfoView: | - | ||||||||||||||||||||||||
| 5497 | return QPixmap(QLatin1String(":/qt-project.org/styles/commonstyle/images/fileinfo-16.png")); | - | ||||||||||||||||||||||||
| 5498 | case SP_FileDialogContentsView: | - | ||||||||||||||||||||||||
| 5499 | return QPixmap(QLatin1String(":/qt-project.org/styles/commonstyle/images/filecontents-16.png")); | - | ||||||||||||||||||||||||
| 5500 | case SP_FileDialogListView: | - | ||||||||||||||||||||||||
| 5501 | return QPixmap(QLatin1String(":/qt-project.org/styles/commonstyle/images/viewlist-16.png")); | - | ||||||||||||||||||||||||
| 5502 | case SP_FileDialogBack: | - | ||||||||||||||||||||||||
| 5503 | return proxy()->standardPixmap(SP_ArrowBack, option, widget); | - | ||||||||||||||||||||||||
| 5504 | case SP_DriveHDIcon: | - | ||||||||||||||||||||||||
| 5505 | return QPixmap(QLatin1String(":/qt-project.org/styles/commonstyle/images/harddrive-16.png")); | - | ||||||||||||||||||||||||
| 5506 | case SP_TrashIcon: | - | ||||||||||||||||||||||||
| 5507 | return QPixmap(QLatin1String(":/qt-project.org/styles/commonstyle/images/trash-16.png")); | - | ||||||||||||||||||||||||
| 5508 | case SP_DriveFDIcon: | - | ||||||||||||||||||||||||
| 5509 | return QPixmap(QLatin1String(":/qt-project.org/styles/commonstyle/images/floppy-16.png")); | - | ||||||||||||||||||||||||
| 5510 | case SP_DriveNetIcon: | - | ||||||||||||||||||||||||
| 5511 | return QPixmap(QLatin1String(":/qt-project.org/styles/commonstyle/images/networkdrive-16.png")); | - | ||||||||||||||||||||||||
| 5512 | case SP_DesktopIcon: | - | ||||||||||||||||||||||||
| 5513 | return QPixmap(QLatin1String(":/qt-project.org/styles/commonstyle/images/desktop-16.png")); | - | ||||||||||||||||||||||||
| 5514 | case SP_ComputerIcon: | - | ||||||||||||||||||||||||
| 5515 | return QPixmap(QLatin1String(":/qt-project.org/styles/commonstyle/images/computer-16.png")); | - | ||||||||||||||||||||||||
| 5516 | case SP_DriveCDIcon: | - | ||||||||||||||||||||||||
| 5517 | return QPixmap(QLatin1String(":/qt-project.org/styles/commonstyle/images/cdr-16.png")); | - | ||||||||||||||||||||||||
| 5518 | case SP_DriveDVDIcon: | - | ||||||||||||||||||||||||
| 5519 | return QPixmap(QLatin1String(":/qt-project.org/styles/commonstyle/images/dvd-16.png")); | - | ||||||||||||||||||||||||
| 5520 | case SP_DirHomeIcon: | - | ||||||||||||||||||||||||
| 5521 | case SP_DirOpenIcon: | - | ||||||||||||||||||||||||
| 5522 | return QPixmap(QLatin1String(":/qt-project.org/styles/commonstyle/images/diropen-16.png")); | - | ||||||||||||||||||||||||
| 5523 | case SP_DirIcon: | - | ||||||||||||||||||||||||
| 5524 | case SP_DirClosedIcon: | - | ||||||||||||||||||||||||
| 5525 | return QPixmap(QLatin1String(":/qt-project.org/styles/commonstyle/images/dirclosed-16.png")); | - | ||||||||||||||||||||||||
| 5526 | case SP_DirLinkIcon: | - | ||||||||||||||||||||||||
| 5527 | return QPixmap(QLatin1String(":/qt-project.org/styles/commonstyle/images/dirlink-16.png")); | - | ||||||||||||||||||||||||
| 5528 | case SP_FileIcon: | - | ||||||||||||||||||||||||
| 5529 | return QPixmap(QLatin1String(":/qt-project.org/styles/commonstyle/images/file-16.png")); | - | ||||||||||||||||||||||||
| 5530 | case SP_FileLinkIcon: | - | ||||||||||||||||||||||||
| 5531 | return QPixmap(QLatin1String(":/qt-project.org/styles/commonstyle/images/filelink-16.png")); | - | ||||||||||||||||||||||||
| 5532 | case SP_DialogOkButton: | - | ||||||||||||||||||||||||
| 5533 | return QPixmap(QLatin1String(":/qt-project.org/styles/commonstyle/images/standardbutton-ok-16.png")); | - | ||||||||||||||||||||||||
| 5534 | case SP_DialogCancelButton: | - | ||||||||||||||||||||||||
| 5535 | return QPixmap(QLatin1String(":/qt-project.org/styles/commonstyle/images/standardbutton-cancel-16.png")); | - | ||||||||||||||||||||||||
| 5536 | case SP_DialogHelpButton: | - | ||||||||||||||||||||||||
| 5537 | return QPixmap(QLatin1String(":/qt-project.org/styles/commonstyle/images/standardbutton-help-16.png")); | - | ||||||||||||||||||||||||
| 5538 | case SP_DialogOpenButton: | - | ||||||||||||||||||||||||
| 5539 | return QPixmap(QLatin1String(":/qt-project.org/styles/commonstyle/images/standardbutton-open-16.png")); | - | ||||||||||||||||||||||||
| 5540 | case SP_DialogSaveButton: | - | ||||||||||||||||||||||||
| 5541 | return QPixmap(QLatin1String(":/qt-project.org/styles/commonstyle/images/standardbutton-save-16.png")); | - | ||||||||||||||||||||||||
| 5542 | case SP_DialogCloseButton: | - | ||||||||||||||||||||||||
| 5543 | return QPixmap(QLatin1String(":/qt-project.org/styles/commonstyle/images/standardbutton-close-16.png")); | - | ||||||||||||||||||||||||
| 5544 | case SP_DialogApplyButton: | - | ||||||||||||||||||||||||
| 5545 | return QPixmap(QLatin1String(":/qt-project.org/styles/commonstyle/images/standardbutton-apply-16.png")); | - | ||||||||||||||||||||||||
| 5546 | case SP_DialogResetButton: | - | ||||||||||||||||||||||||
| 5547 | return QPixmap(QLatin1String(":/qt-project.org/styles/commonstyle/images/standardbutton-clear-16.png")); | - | ||||||||||||||||||||||||
| 5548 | case SP_DialogDiscardButton: | - | ||||||||||||||||||||||||
| 5549 | return QPixmap(QLatin1String(":/qt-project.org/styles/commonstyle/images/standardbutton-delete-16.png")); | - | ||||||||||||||||||||||||
| 5550 | case SP_DialogYesButton: | - | ||||||||||||||||||||||||
| 5551 | return QPixmap(QLatin1String(":/qt-project.org/styles/commonstyle/images/standardbutton-yes-16.png")); | - | ||||||||||||||||||||||||
| 5552 | case SP_DialogNoButton: | - | ||||||||||||||||||||||||
| 5553 | return QPixmap(QLatin1String(":/qt-project.org/styles/commonstyle/images/standardbutton-no-16.png")); | - | ||||||||||||||||||||||||
| 5554 | case SP_BrowserReload: | - | ||||||||||||||||||||||||
| 5555 | return QPixmap(QLatin1String(":/qt-project.org/styles/commonstyle/images/refresh-24.png")); | - | ||||||||||||||||||||||||
| 5556 | case SP_BrowserStop: | - | ||||||||||||||||||||||||
| 5557 | return QPixmap(QLatin1String(":/qt-project.org/styles/commonstyle/images/stop-24.png")); | - | ||||||||||||||||||||||||
| 5558 | case SP_MediaPlay: | - | ||||||||||||||||||||||||
| 5559 | return QPixmap(QLatin1String(":/qt-project.org/styles/commonstyle/images/media-play-32.png")); | - | ||||||||||||||||||||||||
| 5560 | case SP_MediaPause: | - | ||||||||||||||||||||||||
| 5561 | return QPixmap(QLatin1String(":/qt-project.org/styles/commonstyle/images/media-pause-32.png")); | - | ||||||||||||||||||||||||
| 5562 | case SP_MediaStop: | - | ||||||||||||||||||||||||
| 5563 | return QPixmap(QLatin1String(":/qt-project.org/styles/commonstyle/images/media-stop-32.png")); | - | ||||||||||||||||||||||||
| 5564 | case SP_MediaSeekForward: | - | ||||||||||||||||||||||||
| 5565 | return QPixmap(QLatin1String(":/qt-project.org/styles/commonstyle/images/media-seek-forward-32.png")); | - | ||||||||||||||||||||||||
| 5566 | case SP_MediaSeekBackward: | - | ||||||||||||||||||||||||
| 5567 | return QPixmap(QLatin1String(":/qt-project.org/styles/commonstyle/images/media-seek-backward-32.png")); | - | ||||||||||||||||||||||||
| 5568 | case SP_MediaSkipForward: | - | ||||||||||||||||||||||||
| 5569 | return QPixmap(QLatin1String(":/qt-project.org/styles/commonstyle/images/media-skip-forward-32.png")); | - | ||||||||||||||||||||||||
| 5570 | case SP_MediaSkipBackward: | - | ||||||||||||||||||||||||
| 5571 | return QPixmap(QLatin1String(":/qt-project.org/styles/commonstyle/images/media-skip-backward-32.png")); | - | ||||||||||||||||||||||||
| 5572 | case SP_MediaVolume: | - | ||||||||||||||||||||||||
| 5573 | return QPixmap(QLatin1String(":/qt-project.org/styles/commonstyle/images/media-volume-16.png")); | - | ||||||||||||||||||||||||
| 5574 | case SP_MediaVolumeMuted: | - | ||||||||||||||||||||||||
| 5575 | return QPixmap(QLatin1String(":/qt-project.org/styles/commonstyle/images/media-volume-muted-16.png")); | - | ||||||||||||||||||||||||
| 5576 | case SP_LineEditClearButton: | - | ||||||||||||||||||||||||
| 5577 | return QPixmap(clearText16IconPath()); | - | ||||||||||||||||||||||||
| 5578 | #endif // QT_NO_IMAGEFORMAT_PNG | - | ||||||||||||||||||||||||
| 5579 | default: | - | ||||||||||||||||||||||||
| 5580 | break; | - | ||||||||||||||||||||||||
| 5581 | } | - | ||||||||||||||||||||||||
| 5582 | - | |||||||||||||||||||||||||
| 5583 | #ifndef QT_NO_IMAGEFORMAT_XPM | - | ||||||||||||||||||||||||
| 5584 | switch (sp) { | - | ||||||||||||||||||||||||
| 5585 | case SP_TitleBarMenuButton: | - | ||||||||||||||||||||||||
| 5586 | return titleBarMenuCachedPixmapFromXPM(); | - | ||||||||||||||||||||||||
| 5587 | case SP_TitleBarShadeButton: | - | ||||||||||||||||||||||||
| 5588 | return cachedPixmapFromXPM(qt_shade_xpm); | - | ||||||||||||||||||||||||
| 5589 | case SP_TitleBarUnshadeButton: | - | ||||||||||||||||||||||||
| 5590 | return cachedPixmapFromXPM(qt_unshade_xpm); | - | ||||||||||||||||||||||||
| 5591 | case SP_TitleBarNormalButton: | - | ||||||||||||||||||||||||
| 5592 | return cachedPixmapFromXPM(qt_normalizeup_xpm); | - | ||||||||||||||||||||||||
| 5593 | case SP_TitleBarMinButton: | - | ||||||||||||||||||||||||
| 5594 | return cachedPixmapFromXPM(qt_minimize_xpm); | - | ||||||||||||||||||||||||
| 5595 | case SP_TitleBarMaxButton: | - | ||||||||||||||||||||||||
| 5596 | return cachedPixmapFromXPM(qt_maximize_xpm); | - | ||||||||||||||||||||||||
| 5597 | case SP_TitleBarCloseButton: | - | ||||||||||||||||||||||||
| 5598 | return cachedPixmapFromXPM(qt_close_xpm); | - | ||||||||||||||||||||||||
| 5599 | case SP_TitleBarContextHelpButton: | - | ||||||||||||||||||||||||
| 5600 | return cachedPixmapFromXPM(qt_help_xpm); | - | ||||||||||||||||||||||||
| 5601 | case SP_DockWidgetCloseButton: | - | ||||||||||||||||||||||||
| 5602 | return cachedPixmapFromXPM(dock_widget_close_xpm); | - | ||||||||||||||||||||||||
| 5603 | case SP_MessageBoxInformation: | - | ||||||||||||||||||||||||
| 5604 | return cachedPixmapFromXPM(information_xpm); | - | ||||||||||||||||||||||||
| 5605 | case SP_MessageBoxWarning: | - | ||||||||||||||||||||||||
| 5606 | return cachedPixmapFromXPM(warning_xpm); | - | ||||||||||||||||||||||||
| 5607 | case SP_MessageBoxCritical: | - | ||||||||||||||||||||||||
| 5608 | return cachedPixmapFromXPM(critical_xpm); | - | ||||||||||||||||||||||||
| 5609 | case SP_MessageBoxQuestion: | - | ||||||||||||||||||||||||
| 5610 | return cachedPixmapFromXPM(question_xpm); | - | ||||||||||||||||||||||||
| 5611 | default: | - | ||||||||||||||||||||||||
| 5612 | break; | - | ||||||||||||||||||||||||
| 5613 | } | - | ||||||||||||||||||||||||
| 5614 | #endif //QT_NO_IMAGEFORMAT_XPM | - | ||||||||||||||||||||||||
| 5615 | - | |||||||||||||||||||||||||
| 5616 | - | |||||||||||||||||||||||||
| 5617 | return QPixmap(); | - | ||||||||||||||||||||||||
| 5618 | } | - | ||||||||||||||||||||||||
| 5619 | - | |||||||||||||||||||||||||
| 5620 | /*! | - | ||||||||||||||||||||||||
| 5621 | \internal | - | ||||||||||||||||||||||||
| 5622 | */ | - | ||||||||||||||||||||||||
| 5623 | QIcon QCommonStyle::standardIcon(StandardPixmap standardIcon, const QStyleOption *option, | - | ||||||||||||||||||||||||
| 5624 | const QWidget *widget) const | - | ||||||||||||||||||||||||
| 5625 | { | - | ||||||||||||||||||||||||
| 5626 | QIcon icon; | - | ||||||||||||||||||||||||
| 5627 | const bool rtl = (option && option->direction == Qt::RightToLeft) || (!option && QApplication::isRightToLeft());
| 0 | ||||||||||||||||||||||||
| 5628 | - | |||||||||||||||||||||||||
| 5629 | #ifdef Q_OS_WIN | - | ||||||||||||||||||||||||
| 5630 | switch (standardIcon) { | - | ||||||||||||||||||||||||
| 5631 | case SP_DriveCDIcon: | - | ||||||||||||||||||||||||
| 5632 | case SP_DriveDVDIcon: | - | ||||||||||||||||||||||||
| 5633 | case SP_DriveNetIcon: | - | ||||||||||||||||||||||||
| 5634 | case SP_DriveHDIcon: | - | ||||||||||||||||||||||||
| 5635 | case SP_DriveFDIcon: | - | ||||||||||||||||||||||||
| 5636 | case SP_FileIcon: | - | ||||||||||||||||||||||||
| 5637 | case SP_FileLinkIcon: | - | ||||||||||||||||||||||||
| 5638 | case SP_DesktopIcon: | - | ||||||||||||||||||||||||
| 5639 | case SP_ComputerIcon: | - | ||||||||||||||||||||||||
| 5640 | case SP_VistaShield: | - | ||||||||||||||||||||||||
| 5641 | case SP_MessageBoxInformation: | - | ||||||||||||||||||||||||
| 5642 | case SP_MessageBoxWarning: | - | ||||||||||||||||||||||||
| 5643 | case SP_MessageBoxCritical: | - | ||||||||||||||||||||||||
| 5644 | case SP_MessageBoxQuestion: | - | ||||||||||||||||||||||||
| 5645 | if (const QPlatformTheme *theme = QGuiApplicationPrivate::platformTheme()) { | - | ||||||||||||||||||||||||
| 5646 | QPlatformTheme::StandardPixmap sp = static_cast<QPlatformTheme::StandardPixmap>(standardIcon); | - | ||||||||||||||||||||||||
| 5647 | for (int size = 16 ; size <= 32 ; size += 16) { | - | ||||||||||||||||||||||||
| 5648 | QPixmap pixmap = theme->standardPixmap(sp, QSizeF(size, size)); | - | ||||||||||||||||||||||||
| 5649 | icon.addPixmap(pixmap, QIcon::Normal); | - | ||||||||||||||||||||||||
| 5650 | } | - | ||||||||||||||||||||||||
| 5651 | } | - | ||||||||||||||||||||||||
| 5652 | break; | - | ||||||||||||||||||||||||
| 5653 | case SP_DirIcon: | - | ||||||||||||||||||||||||
| 5654 | case SP_DirLinkIcon: | - | ||||||||||||||||||||||||
| 5655 | if (const QPlatformTheme *theme = QGuiApplicationPrivate::platformTheme()) { | - | ||||||||||||||||||||||||
| 5656 | QPlatformTheme::StandardPixmap spOff = static_cast<QPlatformTheme::StandardPixmap>(standardIcon); | - | ||||||||||||||||||||||||
| 5657 | QPlatformTheme::StandardPixmap spOn = standardIcon == SP_DirIcon ? QPlatformTheme::DirOpenIcon : | - | ||||||||||||||||||||||||
| 5658 | QPlatformTheme::DirLinkOpenIcon; | - | ||||||||||||||||||||||||
| 5659 | for (int size = 16 ; size <= 32 ; size += 16) { | - | ||||||||||||||||||||||||
| 5660 | QSizeF pixSize(size, size); | - | ||||||||||||||||||||||||
| 5661 | QPixmap pixmap = theme->standardPixmap(spOff, pixSize); | - | ||||||||||||||||||||||||
| 5662 | icon.addPixmap(pixmap, QIcon::Normal, QIcon::Off); | - | ||||||||||||||||||||||||
| 5663 | pixmap = theme->standardPixmap(spOn, pixSize); | - | ||||||||||||||||||||||||
| 5664 | icon.addPixmap(pixmap, QIcon::Normal, QIcon::On); | - | ||||||||||||||||||||||||
| 5665 | }}break; | - | ||||||||||||||||||||||||
| case SP_VistaShield: | ||||||||||||||||||||||||||
| if (const QPlatformTheme *theme = QGuiApplicationPrivate::platformTheme()) { | ||||||||||||||||||||||||||
| QPlatformTheme::StandardPixmap sp = static_cast<QPlatformTheme::StandardPixmap>(standardIcon); | ||||||||||||||||||||||||||
| QPixmap pixmap = theme->standardPixmap(sp, QSizeF(32, 32)); | ||||||||||||||||||||||||||
| icon.addPixmap(pixmap); | ||||||||||||||||||||||||||
| 5666 | } | - | ||||||||||||||||||||||||
| 5667 | break; | - | ||||||||||||||||||||||||
| 5668 | case SP_LineEditClearButton: | - | ||||||||||||||||||||||||
| 5669 | icon = clearTextIcon(rtl); | - | ||||||||||||||||||||||||
| 5670 | break; | - | ||||||||||||||||||||||||
| 5671 | default: | - | ||||||||||||||||||||||||
| 5672 | break; | - | ||||||||||||||||||||||||
| 5673 | } | - | ||||||||||||||||||||||||
| 5674 | if (!icon.isNull()) | - | ||||||||||||||||||||||||
| 5675 | return icon; | - | ||||||||||||||||||||||||
| 5676 | - | |||||||||||||||||||||||||
| 5677 | #endif | - | ||||||||||||||||||||||||
| 5678 | - | |||||||||||||||||||||||||
| 5679 | if (QApplication::desktopSettingsAware() && !QIcon::themeName().isEmpty()) {
| 0 | ||||||||||||||||||||||||
| 5680 | switch (standardIcon) { | - | ||||||||||||||||||||||||
| 5681 | case SP_DirHomeIcon: never executed: case SP_DirHomeIcon: | 0 | ||||||||||||||||||||||||
| 5682 | icon = QIcon::fromTheme(QLatin1String("user-home")); | - | ||||||||||||||||||||||||
| 5683 | break; never executed: break; | 0 | ||||||||||||||||||||||||
| 5684 | case SP_MessageBoxInformation: never executed: case SP_MessageBoxInformation: | 0 | ||||||||||||||||||||||||
| 5685 | icon = QIcon::fromTheme(QLatin1String("dialog-information")); | - | ||||||||||||||||||||||||
| 5686 | break; never executed: break; | 0 | ||||||||||||||||||||||||
| 5687 | case SP_MessageBoxWarning: never executed: case SP_MessageBoxWarning: | 0 | ||||||||||||||||||||||||
| 5688 | icon = QIcon::fromTheme(QLatin1String("dialog-warning")); | - | ||||||||||||||||||||||||
| 5689 | break; never executed: break; | 0 | ||||||||||||||||||||||||
| 5690 | case SP_MessageBoxCritical: never executed: case SP_MessageBoxCritical: | 0 | ||||||||||||||||||||||||
| 5691 | icon = QIcon::fromTheme(QLatin1String("dialog-error")); | - | ||||||||||||||||||||||||
| 5692 | break; never executed: break; | 0 | ||||||||||||||||||||||||
| 5693 | case SP_MessageBoxQuestion: never executed: case SP_MessageBoxQuestion: | 0 | ||||||||||||||||||||||||
| 5694 | icon = QIcon::fromTheme(QLatin1String("dialog-question")); | - | ||||||||||||||||||||||||
| 5695 | break; never executed: break; | 0 | ||||||||||||||||||||||||
| 5696 | case SP_DialogOpenButton: never executed: case SP_DialogOpenButton: | 0 | ||||||||||||||||||||||||
| 5697 | case SP_DirOpenIcon: never executed: case SP_DirOpenIcon: | 0 | ||||||||||||||||||||||||
| 5698 | icon = QIcon::fromTheme(QLatin1String("folder-open")); | - | ||||||||||||||||||||||||
| 5699 | break; never executed: break; | 0 | ||||||||||||||||||||||||
| 5700 | case SP_DialogSaveButton: never executed: case SP_DialogSaveButton: | 0 | ||||||||||||||||||||||||
| 5701 | icon = QIcon::fromTheme(QLatin1String("document-save")); | - | ||||||||||||||||||||||||
| 5702 | break; never executed: break; | 0 | ||||||||||||||||||||||||
| 5703 | case SP_DialogApplyButton: never executed: case SP_DialogApplyButton: | 0 | ||||||||||||||||||||||||
| 5704 | icon = QIcon::fromTheme(QLatin1String("dialog-ok-apply")); | - | ||||||||||||||||||||||||
| 5705 | break; never executed: break; | 0 | ||||||||||||||||||||||||
| 5706 | case SP_DialogYesButton: never executed: case SP_DialogYesButton: | 0 | ||||||||||||||||||||||||
| 5707 | case SP_DialogOkButton: never executed: case SP_DialogOkButton: | 0 | ||||||||||||||||||||||||
| 5708 | icon = QIcon::fromTheme(QLatin1String("dialog-ok")); | - | ||||||||||||||||||||||||
| 5709 | break; never executed: break; | 0 | ||||||||||||||||||||||||
| 5710 | case SP_DialogDiscardButton: never executed: case SP_DialogDiscardButton: | 0 | ||||||||||||||||||||||||
| 5711 | icon = QIcon::fromTheme(QLatin1String("edit-delete")); | - | ||||||||||||||||||||||||
| 5712 | break; never executed: break; | 0 | ||||||||||||||||||||||||
| 5713 | case SP_DialogResetButton: never executed: case SP_DialogResetButton: | 0 | ||||||||||||||||||||||||
| 5714 | icon = QIcon::fromTheme(QLatin1String("edit-clear")); | - | ||||||||||||||||||||||||
| 5715 | break; never executed: break; | 0 | ||||||||||||||||||||||||
| 5716 | case SP_DialogHelpButton: never executed: case SP_DialogHelpButton: | 0 | ||||||||||||||||||||||||
| 5717 | icon = QIcon::fromTheme(QLatin1String("help-contents")); | - | ||||||||||||||||||||||||
| 5718 | break; never executed: break; | 0 | ||||||||||||||||||||||||
| 5719 | case SP_FileIcon: never executed: case SP_FileIcon: | 0 | ||||||||||||||||||||||||
| 5720 | icon = QIcon::fromTheme(QLatin1String("text-x-generic")); | - | ||||||||||||||||||||||||
| 5721 | break; never executed: break; | 0 | ||||||||||||||||||||||||
| 5722 | case SP_DirClosedIcon: never executed: case SP_DirClosedIcon: | 0 | ||||||||||||||||||||||||
| 5723 | case SP_DirIcon: never executed: case SP_DirIcon: | 0 | ||||||||||||||||||||||||
| 5724 | icon = QIcon::fromTheme(QLatin1String("folder")); | - | ||||||||||||||||||||||||
| 5725 | break; never executed: break; | 0 | ||||||||||||||||||||||||
| 5726 | case SP_DriveFDIcon: never executed: case SP_DriveFDIcon: | 0 | ||||||||||||||||||||||||
| 5727 | icon = QIcon::fromTheme(QLatin1String("floppy_unmount")); | - | ||||||||||||||||||||||||
| 5728 | break; never executed: break; | 0 | ||||||||||||||||||||||||
| 5729 | case SP_ComputerIcon: never executed: case SP_ComputerIcon: | 0 | ||||||||||||||||||||||||
| 5730 | icon = QIcon::fromTheme(QLatin1String("computer"), | - | ||||||||||||||||||||||||
| 5731 | QIcon::fromTheme(QLatin1String("system"))); | - | ||||||||||||||||||||||||
| 5732 | break; never executed: break; | 0 | ||||||||||||||||||||||||
| 5733 | case SP_DesktopIcon: never executed: case SP_DesktopIcon: | 0 | ||||||||||||||||||||||||
| 5734 | icon = QIcon::fromTheme(QLatin1String("user-desktop")); | - | ||||||||||||||||||||||||
| 5735 | break; never executed: break; | 0 | ||||||||||||||||||||||||
| 5736 | case SP_TrashIcon: never executed: case SP_TrashIcon: | 0 | ||||||||||||||||||||||||
| 5737 | icon = QIcon::fromTheme(QLatin1String("user-trash")); | - | ||||||||||||||||||||||||
| 5738 | break; never executed: break; | 0 | ||||||||||||||||||||||||
| 5739 | case SP_DriveCDIcon: never executed: case SP_DriveCDIcon: | 0 | ||||||||||||||||||||||||
| 5740 | case SP_DriveDVDIcon: never executed: case SP_DriveDVDIcon: | 0 | ||||||||||||||||||||||||
| 5741 | icon = QIcon::fromTheme(QLatin1String("media-optical")); | - | ||||||||||||||||||||||||
| 5742 | break; never executed: break; | 0 | ||||||||||||||||||||||||
| 5743 | case SP_DriveHDIcon: never executed: case SP_DriveHDIcon: | 0 | ||||||||||||||||||||||||
| 5744 | icon = QIcon::fromTheme(QLatin1String("drive-harddisk")); | - | ||||||||||||||||||||||||
| 5745 | break; never executed: break; | 0 | ||||||||||||||||||||||||
| 5746 | case SP_FileDialogToParent: never executed: case SP_FileDialogToParent: | 0 | ||||||||||||||||||||||||
| 5747 | icon = QIcon::fromTheme(QLatin1String("go-up")); | - | ||||||||||||||||||||||||
| 5748 | break; never executed: break; | 0 | ||||||||||||||||||||||||
| 5749 | case SP_FileDialogNewFolder: never executed: case SP_FileDialogNewFolder: | 0 | ||||||||||||||||||||||||
| 5750 | icon = QIcon::fromTheme(QLatin1String("folder-new")); | - | ||||||||||||||||||||||||
| 5751 | break; never executed: break; | 0 | ||||||||||||||||||||||||
| 5752 | case SP_ArrowUp: never executed: case SP_ArrowUp: | 0 | ||||||||||||||||||||||||
| 5753 | icon = QIcon::fromTheme(QLatin1String("go-up")); | - | ||||||||||||||||||||||||
| 5754 | break; never executed: break; | 0 | ||||||||||||||||||||||||
| 5755 | case SP_ArrowDown: never executed: case SP_ArrowDown: | 0 | ||||||||||||||||||||||||
| 5756 | icon = QIcon::fromTheme(QLatin1String("go-down")); | - | ||||||||||||||||||||||||
| 5757 | break; never executed: break; | 0 | ||||||||||||||||||||||||
| 5758 | case SP_ArrowRight: never executed: case SP_ArrowRight: | 0 | ||||||||||||||||||||||||
| 5759 | icon = QIcon::fromTheme(QLatin1String("go-next")); | - | ||||||||||||||||||||||||
| 5760 | break; never executed: break; | 0 | ||||||||||||||||||||||||
| 5761 | case SP_ArrowLeft: never executed: case SP_ArrowLeft: | 0 | ||||||||||||||||||||||||
| 5762 | icon = QIcon::fromTheme(QLatin1String("go-previous")); | - | ||||||||||||||||||||||||
| 5763 | break; never executed: break; | 0 | ||||||||||||||||||||||||
| 5764 | case SP_DialogCancelButton: never executed: case SP_DialogCancelButton: | 0 | ||||||||||||||||||||||||
| 5765 | icon = QIcon::fromTheme(QLatin1String("dialog-cancel"), | - | ||||||||||||||||||||||||
| 5766 | QIcon::fromTheme(QLatin1String("process-stop"))); | - | ||||||||||||||||||||||||
| 5767 | break; never executed: break; | 0 | ||||||||||||||||||||||||
| 5768 | case SP_DialogCloseButton: never executed: case SP_DialogCloseButton: | 0 | ||||||||||||||||||||||||
| 5769 | icon = QIcon::fromTheme(QLatin1String("window-close")); | - | ||||||||||||||||||||||||
| 5770 | break; never executed: break; | 0 | ||||||||||||||||||||||||
| 5771 | case SP_FileDialogDetailedView: never executed: case SP_FileDialogDetailedView: | 0 | ||||||||||||||||||||||||
| 5772 | icon = QIcon::fromTheme(QLatin1String("view-list-details")); | - | ||||||||||||||||||||||||
| 5773 | break; never executed: break; | 0 | ||||||||||||||||||||||||
| 5774 | case SP_FileDialogListView: never executed: case SP_FileDialogListView: | 0 | ||||||||||||||||||||||||
| 5775 | icon = QIcon::fromTheme(QLatin1String("view-list-icons")); | - | ||||||||||||||||||||||||
| 5776 | break; never executed: break; | 0 | ||||||||||||||||||||||||
| 5777 | case SP_BrowserReload: never executed: case SP_BrowserReload: | 0 | ||||||||||||||||||||||||
| 5778 | icon = QIcon::fromTheme(QLatin1String("view-refresh")); | - | ||||||||||||||||||||||||
| 5779 | break; never executed: break; | 0 | ||||||||||||||||||||||||
| 5780 | case SP_BrowserStop: never executed: case SP_BrowserStop: | 0 | ||||||||||||||||||||||||
| 5781 | icon = QIcon::fromTheme(QLatin1String("process-stop")); | - | ||||||||||||||||||||||||
| 5782 | break; never executed: break; | 0 | ||||||||||||||||||||||||
| 5783 | case SP_MediaPlay: never executed: case SP_MediaPlay: | 0 | ||||||||||||||||||||||||
| 5784 | icon = QIcon::fromTheme(QLatin1String("media-playback-start")); | - | ||||||||||||||||||||||||
| 5785 | break; never executed: break; | 0 | ||||||||||||||||||||||||
| 5786 | case SP_MediaPause: never executed: case SP_MediaPause: | 0 | ||||||||||||||||||||||||
| 5787 | icon = QIcon::fromTheme(QLatin1String("media-playback-pause")); | - | ||||||||||||||||||||||||
| 5788 | break; never executed: break; | 0 | ||||||||||||||||||||||||
| 5789 | case SP_MediaStop: never executed: case SP_MediaStop: | 0 | ||||||||||||||||||||||||
| 5790 | icon = QIcon::fromTheme(QLatin1String("media-playback-stop")); | - | ||||||||||||||||||||||||
| 5791 | break; never executed: break; | 0 | ||||||||||||||||||||||||
| 5792 | case SP_MediaSeekForward: never executed: case SP_MediaSeekForward: | 0 | ||||||||||||||||||||||||
| 5793 | icon = QIcon::fromTheme(QLatin1String("media-seek-forward")); | - | ||||||||||||||||||||||||
| 5794 | break; never executed: break; | 0 | ||||||||||||||||||||||||
| 5795 | case SP_MediaSeekBackward: never executed: case SP_MediaSeekBackward: | 0 | ||||||||||||||||||||||||
| 5796 | icon = QIcon::fromTheme(QLatin1String("media-seek-backward")); | - | ||||||||||||||||||||||||
| 5797 | break; never executed: break; | 0 | ||||||||||||||||||||||||
| 5798 | case SP_MediaSkipForward: never executed: case SP_MediaSkipForward: | 0 | ||||||||||||||||||||||||
| 5799 | icon = QIcon::fromTheme(QLatin1String("media-skip-forward")); | - | ||||||||||||||||||||||||
| 5800 | break; never executed: break; | 0 | ||||||||||||||||||||||||
| 5801 | case SP_MediaSkipBackward: never executed: case SP_MediaSkipBackward: | 0 | ||||||||||||||||||||||||
| 5802 | icon = QIcon::fromTheme(QLatin1String("media-skip-backward")); | - | ||||||||||||||||||||||||
| 5803 | break; never executed: break; | 0 | ||||||||||||||||||||||||
| 5804 | case SP_MediaVolume: never executed: case SP_MediaVolume: | 0 | ||||||||||||||||||||||||
| 5805 | icon = QIcon::fromTheme(QLatin1String("audio-volume-medium")); | - | ||||||||||||||||||||||||
| 5806 | break; never executed: break; | 0 | ||||||||||||||||||||||||
| 5807 | case SP_MediaVolumeMuted: never executed: case SP_MediaVolumeMuted: | 0 | ||||||||||||||||||||||||
| 5808 | icon = QIcon::fromTheme(QLatin1String("audio-volume-muted")); | - | ||||||||||||||||||||||||
| 5809 | break; never executed: break; | 0 | ||||||||||||||||||||||||
| 5810 | case SP_ArrowForward: never executed: case SP_ArrowForward: | 0 | ||||||||||||||||||||||||
| 5811 | if (rtl)
| 0 | ||||||||||||||||||||||||
| 5812 | return QCommonStyle::standardIcon(SP_ArrowLeft, option, widget); never executed: return QCommonStyle::standardIcon(SP_ArrowLeft, option, widget); | 0 | ||||||||||||||||||||||||
| 5813 | return QCommonStyle::standardIcon(SP_ArrowRight, option, widget); never executed: return QCommonStyle::standardIcon(SP_ArrowRight, option, widget); | 0 | ||||||||||||||||||||||||
| 5814 | case SP_ArrowBack: never executed: case SP_ArrowBack: | 0 | ||||||||||||||||||||||||
| 5815 | if (rtl)
| 0 | ||||||||||||||||||||||||
| 5816 | return QCommonStyle::standardIcon(SP_ArrowRight, option, widget); never executed: return QCommonStyle::standardIcon(SP_ArrowRight, option, widget); | 0 | ||||||||||||||||||||||||
| 5817 | return QCommonStyle::standardIcon(SP_ArrowLeft, option, widget); never executed: return QCommonStyle::standardIcon(SP_ArrowLeft, option, widget); | 0 | ||||||||||||||||||||||||
| 5818 | case SP_FileLinkIcon: never executed: case SP_FileLinkIcon: | 0 | ||||||||||||||||||||||||
| 5819 | { | - | ||||||||||||||||||||||||
| 5820 | QIcon linkIcon = QIcon::fromTheme(QLatin1String("emblem-symbolic-link")); | - | ||||||||||||||||||||||||
| 5821 | if (!linkIcon.isNull()) {
| 0 | ||||||||||||||||||||||||
| 5822 | QIcon baseIcon = QCommonStyle::standardIcon(SP_FileIcon, option, widget); | - | ||||||||||||||||||||||||
| 5823 | const QList<QSize> sizes = baseIcon.availableSizes(QIcon::Normal, QIcon::Off); | - | ||||||||||||||||||||||||
| 5824 | for (int i = 0 ; i < sizes.size() ; ++i) {
| 0 | ||||||||||||||||||||||||
| 5825 | int size = sizes[i].width(); | - | ||||||||||||||||||||||||
| 5826 | QPixmap basePixmap = baseIcon.pixmap(qt_getWindow(widget), QSize(size, size)); | - | ||||||||||||||||||||||||
| 5827 | QPixmap linkPixmap = linkIcon.pixmap(qt_getWindow(widget), QSize(size / 2, size / 2)); | - | ||||||||||||||||||||||||
| 5828 | QPainter painter(&basePixmap); | - | ||||||||||||||||||||||||
| 5829 | painter.drawPixmap(size/2, size/2, linkPixmap); | - | ||||||||||||||||||||||||
| 5830 | icon.addPixmap(basePixmap); | - | ||||||||||||||||||||||||
| 5831 | } never executed: end of block | 0 | ||||||||||||||||||||||||
| 5832 | } never executed: end of block | 0 | ||||||||||||||||||||||||
| 5833 | } | - | ||||||||||||||||||||||||
| 5834 | break; never executed: break; | 0 | ||||||||||||||||||||||||
| 5835 | case SP_DirLinkIcon: never executed: case SP_DirLinkIcon: | 0 | ||||||||||||||||||||||||
| 5836 | { | - | ||||||||||||||||||||||||
| 5837 | QIcon linkIcon = QIcon::fromTheme(QLatin1String("emblem-symbolic-link")); | - | ||||||||||||||||||||||||
| 5838 | if (!linkIcon.isNull()) {
| 0 | ||||||||||||||||||||||||
| 5839 | QIcon baseIcon = QCommonStyle::standardIcon(SP_DirIcon, option, widget); | - | ||||||||||||||||||||||||
| 5840 | const QList<QSize> sizes = baseIcon.availableSizes(QIcon::Normal, QIcon::Off); | - | ||||||||||||||||||||||||
| 5841 | for (int i = 0 ; i < sizes.size() ; ++i) {
| 0 | ||||||||||||||||||||||||
| 5842 | int size = sizes[i].width(); | - | ||||||||||||||||||||||||
| 5843 | QPixmap basePixmap = baseIcon.pixmap(qt_getWindow(widget), QSize(size, size)); | - | ||||||||||||||||||||||||
| 5844 | QPixmap linkPixmap = linkIcon.pixmap(qt_getWindow(widget), QSize(size / 2, size / 2)); | - | ||||||||||||||||||||||||
| 5845 | QPainter painter(&basePixmap); | - | ||||||||||||||||||||||||
| 5846 | painter.drawPixmap(size/2, size/2, linkPixmap); | - | ||||||||||||||||||||||||
| 5847 | icon.addPixmap(basePixmap); | - | ||||||||||||||||||||||||
| 5848 | } never executed: end of block | 0 | ||||||||||||||||||||||||
| 5849 | } never executed: end of block | 0 | ||||||||||||||||||||||||
| 5850 | } | - | ||||||||||||||||||||||||
| 5851 | break; never executed: break; | 0 | ||||||||||||||||||||||||
| 5852 | default: never executed: default: | 0 | ||||||||||||||||||||||||
| 5853 | break; never executed: break; | 0 | ||||||||||||||||||||||||
| 5854 | } | - | ||||||||||||||||||||||||
| 5855 | } // if (QApplication::desktopSettingsAware() && !QIcon::themeName().isEmpty()) | - | ||||||||||||||||||||||||
| 5856 | - | |||||||||||||||||||||||||
| 5857 | if (!icon.isNull())
| 0 | ||||||||||||||||||||||||
| 5858 | return icon; never executed: return icon; | 0 | ||||||||||||||||||||||||
| 5859 | - | |||||||||||||||||||||||||
| 5860 | #if defined(Q_OS_MAC) | - | ||||||||||||||||||||||||
| 5861 | if (QApplication::desktopSettingsAware()) { | - | ||||||||||||||||||||||||
| 5862 | switch (standardIcon) { | - | ||||||||||||||||||||||||
| 5863 | case SP_DirIcon: { | - | ||||||||||||||||||||||||
| 5864 | // A rather special case | - | ||||||||||||||||||||||||
| 5865 | QIcon closeIcon = QCommonStyle::standardIcon(SP_DirClosedIcon, option, widget); | - | ||||||||||||||||||||||||
| 5866 | QIcon openIcon = QCommonStyle::standardIcon(SP_DirOpenIcon, option, widget); | - | ||||||||||||||||||||||||
| 5867 | closeIcon.addPixmap(openIcon.pixmap(16, 16), QIcon::Normal, QIcon::On); | - | ||||||||||||||||||||||||
| 5868 | closeIcon.addPixmap(openIcon.pixmap(32, 32), QIcon::Normal, QIcon::On); | - | ||||||||||||||||||||||||
| 5869 | closeIcon.addPixmap(openIcon.pixmap(64, 64), QIcon::Normal, QIcon::On); | - | ||||||||||||||||||||||||
| 5870 | closeIcon.addPixmap(openIcon.pixmap(128, 128), QIcon::Normal, QIcon::On); | - | ||||||||||||||||||||||||
| 5871 | return closeIcon; | - | ||||||||||||||||||||||||
| 5872 | } | - | ||||||||||||||||||||||||
| 5873 | - | |||||||||||||||||||||||||
| 5874 | case SP_TitleBarNormalButton: | - | ||||||||||||||||||||||||
| 5875 | case SP_TitleBarCloseButton: { | - | ||||||||||||||||||||||||
| 5876 | QIcon titleBarIcon; | - | ||||||||||||||||||||||||
| 5877 | if (standardIcon == SP_TitleBarCloseButton) { | - | ||||||||||||||||||||||||
| 5878 | titleBarIcon.addFile(QLatin1String(":/qt-project.org/styles/macstyle/images/closedock-16.png")); | - | ||||||||||||||||||||||||
| 5879 | titleBarIcon.addFile(QLatin1String(":/qt-project.org/styles/macstyle/images/closedock-down-16.png"), QSize(16, 16), QIcon::Normal, QIcon::On); | - | ||||||||||||||||||||||||
| 5880 | } else { | - | ||||||||||||||||||||||||
| 5881 | titleBarIcon.addFile(QLatin1String(":/qt-project.org/styles/macstyle/images/dockdock-16.png")); | - | ||||||||||||||||||||||||
| 5882 | titleBarIcon.addFile(QLatin1String(":/qt-project.org/styles/macstyle/images/dockdock-down-16.png"), QSize(16, 16), QIcon::Normal, QIcon::On); | - | ||||||||||||||||||||||||
| 5883 | } | - | ||||||||||||||||||||||||
| 5884 | return titleBarIcon; | - | ||||||||||||||||||||||||
| 5885 | } | - | ||||||||||||||||||||||||
| 5886 | - | |||||||||||||||||||||||||
| 5887 | case SP_MessageBoxQuestion: | - | ||||||||||||||||||||||||
| 5888 | case SP_MessageBoxInformation: | - | ||||||||||||||||||||||||
| 5889 | case SP_MessageBoxWarning: | - | ||||||||||||||||||||||||
| 5890 | case SP_MessageBoxCritical: | - | ||||||||||||||||||||||||
| 5891 | case SP_DesktopIcon: | - | ||||||||||||||||||||||||
| 5892 | case SP_TrashIcon: | - | ||||||||||||||||||||||||
| 5893 | case SP_ComputerIcon: | - | ||||||||||||||||||||||||
| 5894 | case SP_DriveFDIcon: | - | ||||||||||||||||||||||||
| 5895 | case SP_DriveHDIcon: | - | ||||||||||||||||||||||||
| 5896 | case SP_DriveCDIcon: | - | ||||||||||||||||||||||||
| 5897 | case SP_DriveDVDIcon: | - | ||||||||||||||||||||||||
| 5898 | case SP_DriveNetIcon: | - | ||||||||||||||||||||||||
| 5899 | case SP_DirOpenIcon: | - | ||||||||||||||||||||||||
| 5900 | case SP_DirClosedIcon: | - | ||||||||||||||||||||||||
| 5901 | case SP_DirLinkIcon: | - | ||||||||||||||||||||||||
| 5902 | case SP_FileLinkIcon: | - | ||||||||||||||||||||||||
| 5903 | case SP_FileIcon: | - | ||||||||||||||||||||||||
| 5904 | if (const QPlatformTheme *theme = QGuiApplicationPrivate::platformTheme()) { | - | ||||||||||||||||||||||||
| 5905 | QPlatformTheme::StandardPixmap sp = static_cast<QPlatformTheme::StandardPixmap>(standardIcon); | - | ||||||||||||||||||||||||
| 5906 | QIcon retIcon; | - | ||||||||||||||||||||||||
| 5907 | QList<int> sizes = theme->themeHint(QPlatformTheme::IconPixmapSizes).value<QList<int> >(); | - | ||||||||||||||||||||||||
| 5908 | Q_FOREACH (int size, sizes) { | - | ||||||||||||||||||||||||
| 5909 | QPixmap mainIcon; | - | ||||||||||||||||||||||||
| 5910 | const QString cacheKey = QLatin1String("qt_mac_constructQIconFromIconRef") + QString::number(standardIcon) + QString::number(size); | - | ||||||||||||||||||||||||
| 5911 | if (standardIcon >= QStyle::SP_CustomBase) { | - | ||||||||||||||||||||||||
| 5912 | mainIcon = theme->standardPixmap(sp, QSizeF(size, size)); | - | ||||||||||||||||||||||||
| 5913 | } else if (QPixmapCache::find(cacheKey, mainIcon) == false) { | - | ||||||||||||||||||||||||
| 5914 | mainIcon = theme->standardPixmap(sp, QSizeF(size, size)); | - | ||||||||||||||||||||||||
| 5915 | QPixmapCache::insert(cacheKey, mainIcon); | - | ||||||||||||||||||||||||
| 5916 | } | - | ||||||||||||||||||||||||
| 5917 | - | |||||||||||||||||||||||||
| 5918 | retIcon.addPixmap(mainIcon); | - | ||||||||||||||||||||||||
| 5919 | } | - | ||||||||||||||||||||||||
| 5920 | if (!retIcon.isNull()) | - | ||||||||||||||||||||||||
| 5921 | return retIcon; | - | ||||||||||||||||||||||||
| 5922 | } | - | ||||||||||||||||||||||||
| 5923 | - | |||||||||||||||||||||||||
| 5924 | default: | - | ||||||||||||||||||||||||
| 5925 | break; | - | ||||||||||||||||||||||||
| 5926 | } | - | ||||||||||||||||||||||||
| 5927 | } // if (QApplication::desktopSettingsAware()) | - | ||||||||||||||||||||||||
| 5928 | #endif // Q_OS_MAC | - | ||||||||||||||||||||||||
| 5929 | - | |||||||||||||||||||||||||
| 5930 | switch (standardIcon) { | - | ||||||||||||||||||||||||
| 5931 | #ifndef QT_NO_IMAGEFORMAT_PNG | - | ||||||||||||||||||||||||
| 5932 | case SP_FileDialogNewFolder: never executed: case SP_FileDialogNewFolder: | 0 | ||||||||||||||||||||||||
| 5933 | icon.addFile(QLatin1String(":/qt-project.org/styles/commonstyle/images/newdirectory-16.png"), QSize(16, 16)); | - | ||||||||||||||||||||||||
| 5934 | icon.addFile(QLatin1String(":/qt-project.org/styles/commonstyle/images/newdirectory-32.png"), QSize(32, 32)); | - | ||||||||||||||||||||||||
| 5935 | icon.addFile(QLatin1String(":/qt-project.org/styles/commonstyle/images/newdirectory-128.png"), QSize(128, 128)); | - | ||||||||||||||||||||||||
| 5936 | break; never executed: break; | 0 | ||||||||||||||||||||||||
| 5937 | case SP_FileDialogBack: never executed: case SP_FileDialogBack: | 0 | ||||||||||||||||||||||||
| 5938 | return QCommonStyle::standardIcon(SP_ArrowBack, option, widget); never executed: return QCommonStyle::standardIcon(SP_ArrowBack, option, widget); | 0 | ||||||||||||||||||||||||
| 5939 | case SP_FileDialogToParent: never executed: case SP_FileDialogToParent: | 0 | ||||||||||||||||||||||||
| 5940 | return QCommonStyle::standardIcon(SP_ArrowUp, option, widget); never executed: return QCommonStyle::standardIcon(SP_ArrowUp, option, widget); | 0 | ||||||||||||||||||||||||
| 5941 | case SP_FileDialogDetailedView: never executed: case SP_FileDialogDetailedView: | 0 | ||||||||||||||||||||||||
| 5942 | icon.addFile(QLatin1String(":/qt-project.org/styles/commonstyle/images/viewdetailed-16.png"), QSize(16, 16)); | - | ||||||||||||||||||||||||
| 5943 | icon.addFile(QLatin1String(":/qt-project.org/styles/commonstyle/images/viewdetailed-32.png"), QSize(32, 32)); | - | ||||||||||||||||||||||||
| 5944 | icon.addFile(QLatin1String(":/qt-project.org/styles/commonstyle/images/viewdetailed-128.png"), QSize(128, 128)); | - | ||||||||||||||||||||||||
| 5945 | break; never executed: break; | 0 | ||||||||||||||||||||||||
| 5946 | case SP_FileDialogInfoView: never executed: case SP_FileDialogInfoView: | 0 | ||||||||||||||||||||||||
| 5947 | icon.addFile(QLatin1String(":/qt-project.org/styles/commonstyle/images/fileinfo-16.png"), QSize(16, 16)); | - | ||||||||||||||||||||||||
| 5948 | icon.addFile(QLatin1String(":/qt-project.org/styles/commonstyle/images/fileinfo-32.png"), QSize(32, 32)); | - | ||||||||||||||||||||||||
| 5949 | icon.addFile(QLatin1String(":/qt-project.org/styles/commonstyle/images/fileinfo-128.png"), QSize(128, 128)); | - | ||||||||||||||||||||||||
| 5950 | break; never executed: break; | 0 | ||||||||||||||||||||||||
| 5951 | case SP_FileDialogContentsView: never executed: case SP_FileDialogContentsView: | 0 | ||||||||||||||||||||||||
| 5952 | icon.addFile(QLatin1String(":/qt-project.org/styles/commonstyle/images/filecontents-16.png"), QSize(16, 16)); | - | ||||||||||||||||||||||||
| 5953 | icon.addFile(QLatin1String(":/qt-project.org/styles/commonstyle/images/filecontents-32.png"), QSize(32, 32)); | - | ||||||||||||||||||||||||
| 5954 | icon.addFile(QLatin1String(":/qt-project.org/styles/commonstyle/images/filecontents-128.png"), QSize(128, 128)); | - | ||||||||||||||||||||||||
| 5955 | break; never executed: break; | 0 | ||||||||||||||||||||||||
| 5956 | case SP_FileDialogListView: never executed: case SP_FileDialogListView: | 0 | ||||||||||||||||||||||||
| 5957 | icon.addFile(QLatin1String(":/qt-project.org/styles/commonstyle/images/viewlist-16.png"), QSize(16, 16)); | - | ||||||||||||||||||||||||
| 5958 | icon.addFile(QLatin1String(":/qt-project.org/styles/commonstyle/images/viewlist-32.png"), QSize(32, 32)); | - | ||||||||||||||||||||||||
| 5959 | icon.addFile(QLatin1String(":/qt-project.org/styles/commonstyle/images/viewlist-128.png"), QSize(128, 128)); | - | ||||||||||||||||||||||||
| 5960 | break; never executed: break; | 0 | ||||||||||||||||||||||||
| 5961 | case SP_DialogOkButton: never executed: case SP_DialogOkButton: | 0 | ||||||||||||||||||||||||
| 5962 | icon.addFile(QLatin1String(":/qt-project.org/styles/commonstyle/images/standardbutton-ok-16.png"), QSize(16, 16)); | - | ||||||||||||||||||||||||
| 5963 | icon.addFile(QLatin1String(":/qt-project.org/styles/commonstyle/images/standardbutton-ok-32.png"), QSize(32, 32)); | - | ||||||||||||||||||||||||
| 5964 | icon.addFile(QLatin1String(":/qt-project.org/styles/commonstyle/images/standardbutton-ok-128.png"), QSize(128, 128)); | - | ||||||||||||||||||||||||
| 5965 | break; never executed: break; | 0 | ||||||||||||||||||||||||
| 5966 | case SP_DialogCancelButton: never executed: case SP_DialogCancelButton: | 0 | ||||||||||||||||||||||||
| 5967 | icon.addFile(QLatin1String(":/qt-project.org/styles/commonstyle/images/standardbutton-cancel-16.png"), QSize(16, 16)); | - | ||||||||||||||||||||||||
| 5968 | icon.addFile(QLatin1String(":/qt-project.org/styles/commonstyle/images/standardbutton-cancel-32.png"), QSize(32, 32)); | - | ||||||||||||||||||||||||
| 5969 | icon.addFile(QLatin1String(":/qt-project.org/styles/commonstyle/images/standardbutton-cancel-128.png"), QSize(128, 128)); | - | ||||||||||||||||||||||||
| 5970 | break; never executed: break; | 0 | ||||||||||||||||||||||||
| 5971 | case SP_DialogHelpButton: never executed: case SP_DialogHelpButton: | 0 | ||||||||||||||||||||||||
| 5972 | icon.addFile(QLatin1String(":/qt-project.org/styles/commonstyle/images/standardbutton-help-16.png"), QSize(16, 16)); | - | ||||||||||||||||||||||||
| 5973 | icon.addFile(QLatin1String(":/qt-project.org/styles/commonstyle/images/standardbutton-help-32.png"), QSize(32, 32)); | - | ||||||||||||||||||||||||
| 5974 | icon.addFile(QLatin1String(":/qt-project.org/styles/commonstyle/images/standardbutton-help-128.png"), QSize(128, 128)); | - | ||||||||||||||||||||||||
| 5975 | break; never executed: break; | 0 | ||||||||||||||||||||||||
| 5976 | case SP_DialogOpenButton: never executed: case SP_DialogOpenButton: | 0 | ||||||||||||||||||||||||
| 5977 | icon.addFile(QLatin1String(":/qt-project.org/styles/commonstyle/images/standardbutton-open-16.png"), QSize(16, 16)); | - | ||||||||||||||||||||||||
| 5978 | icon.addFile(QLatin1String(":/qt-project.org/styles/commonstyle/images/standardbutton-open-32.png"), QSize(32, 32)); | - | ||||||||||||||||||||||||
| 5979 | icon.addFile(QLatin1String(":/qt-project.org/styles/commonstyle/images/standardbutton-open-128.png"), QSize(128, 128)); | - | ||||||||||||||||||||||||
| 5980 | break; never executed: break; | 0 | ||||||||||||||||||||||||
| 5981 | case SP_DialogSaveButton: never executed: case SP_DialogSaveButton: | 0 | ||||||||||||||||||||||||
| 5982 | icon.addFile(QLatin1String(":/qt-project.org/styles/commonstyle/images/standardbutton-save-16.png"), QSize(16, 16)); | - | ||||||||||||||||||||||||
| 5983 | icon.addFile(QLatin1String(":/qt-project.org/styles/commonstyle/images/standardbutton-save-32.png"), QSize(32, 32)); | - | ||||||||||||||||||||||||
| 5984 | icon.addFile(QLatin1String(":/qt-project.org/styles/commonstyle/images/standardbutton-save-128.png"), QSize(128, 128)); | - | ||||||||||||||||||||||||
| 5985 | break; never executed: break; | 0 | ||||||||||||||||||||||||
| 5986 | case SP_DialogCloseButton: never executed: case SP_DialogCloseButton: | 0 | ||||||||||||||||||||||||
| 5987 | icon.addFile(QLatin1String(":/qt-project.org/styles/commonstyle/images/standardbutton-close-16.png"), QSize(16, 16)); | - | ||||||||||||||||||||||||
| 5988 | icon.addFile(QLatin1String(":/qt-project.org/styles/commonstyle/images/standardbutton-close-32.png"), QSize(32, 32)); | - | ||||||||||||||||||||||||
| 5989 | icon.addFile(QLatin1String(":/qt-project.org/styles/commonstyle/images/standardbutton-close-128.png"), QSize(128, 128)); | - | ||||||||||||||||||||||||
| 5990 | break; never executed: break; | 0 | ||||||||||||||||||||||||
| 5991 | case SP_DialogApplyButton: never executed: case SP_DialogApplyButton: | 0 | ||||||||||||||||||||||||
| 5992 | icon.addFile(QLatin1String(":/qt-project.org/styles/commonstyle/images/standardbutton-apply-16.png"), QSize(16, 16)); | - | ||||||||||||||||||||||||
| 5993 | icon.addFile(QLatin1String(":/qt-project.org/styles/commonstyle/images/standardbutton-apply-32.png"), QSize(32, 32)); | - | ||||||||||||||||||||||||
| 5994 | icon.addFile(QLatin1String(":/qt-project.org/styles/commonstyle/images/standardbutton-apply-128.png"), QSize(128, 128)); | - | ||||||||||||||||||||||||
| 5995 | break; never executed: break; | 0 | ||||||||||||||||||||||||
| 5996 | case SP_DialogResetButton: never executed: case SP_DialogResetButton: | 0 | ||||||||||||||||||||||||
| 5997 | icon.addFile(QLatin1String(":/qt-project.org/styles/commonstyle/images/standardbutton-clear-16.png"), QSize(16, 16)); | - | ||||||||||||||||||||||||
| 5998 | icon.addFile(QLatin1String(":/qt-project.org/styles/commonstyle/images/standardbutton-clear-32.png"), QSize(32, 32)); | - | ||||||||||||||||||||||||
| 5999 | icon.addFile(QLatin1String(":/qt-project.org/styles/commonstyle/images/standardbutton-clear-128.png"), QSize(128, 128)); | - | ||||||||||||||||||||||||
| 6000 | break; never executed: break; | 0 | ||||||||||||||||||||||||
| 6001 | case SP_DialogDiscardButton: never executed: case SP_DialogDiscardButton: | 0 | ||||||||||||||||||||||||
| 6002 | icon.addFile(QLatin1String(":/qt-project.org/styles/commonstyle/images/standardbutton-delete-16.png"), QSize(16, 16)); | - | ||||||||||||||||||||||||
| 6003 | icon.addFile(QLatin1String(":/qt-project.org/styles/commonstyle/images/standardbutton-delete-32.png"), QSize(32, 32)); | - | ||||||||||||||||||||||||
| 6004 | icon.addFile(QLatin1String(":/qt-project.org/styles/commonstyle/images/standardbutton-delete-128.png"), QSize(128, 128)); | - | ||||||||||||||||||||||||
| 6005 | break; never executed: break; | 0 | ||||||||||||||||||||||||
| 6006 | case SP_DialogYesButton: never executed: case SP_DialogYesButton: | 0 | ||||||||||||||||||||||||
| 6007 | icon.addFile(QLatin1String(":/qt-project.org/styles/commonstyle/images/standardbutton-yes-16.png"), QSize(16, 16)); | - | ||||||||||||||||||||||||
| 6008 | icon.addFile(QLatin1String(":/qt-project.org/styles/commonstyle/images/standardbutton-yes-32.png"), QSize(32, 32)); | - | ||||||||||||||||||||||||
| 6009 | icon.addFile(QLatin1String(":/qt-project.org/styles/commonstyle/images/standardbutton-yes-128.png"), QSize(128, 128)); | - | ||||||||||||||||||||||||
| 6010 | break; never executed: break; | 0 | ||||||||||||||||||||||||
| 6011 | case SP_DialogNoButton: never executed: case SP_DialogNoButton: | 0 | ||||||||||||||||||||||||
| 6012 | icon.addFile(QLatin1String(":/qt-project.org/styles/commonstyle/images/standardbutton-no-16.png"), QSize(16, 16)); | - | ||||||||||||||||||||||||
| 6013 | icon.addFile(QLatin1String(":/qt-project.org/styles/commonstyle/images/standardbutton-no-32.png"), QSize(32, 32)); | - | ||||||||||||||||||||||||
| 6014 | icon.addFile(QLatin1String(":/qt-project.org/styles/commonstyle/images/standardbutton-no-128.png"), QSize(128, 128)); | - | ||||||||||||||||||||||||
| 6015 | break; never executed: break; | 0 | ||||||||||||||||||||||||
| 6016 | case SP_ArrowForward: never executed: case SP_ArrowForward: | 0 | ||||||||||||||||||||||||
| 6017 | if (rtl)
| 0 | ||||||||||||||||||||||||
| 6018 | return QCommonStyle::standardIcon(SP_ArrowLeft, option, widget); never executed: return QCommonStyle::standardIcon(SP_ArrowLeft, option, widget); | 0 | ||||||||||||||||||||||||
| 6019 | return QCommonStyle::standardIcon(SP_ArrowRight, option, widget); never executed: return QCommonStyle::standardIcon(SP_ArrowRight, option, widget); | 0 | ||||||||||||||||||||||||
| 6020 | case SP_ArrowBack: never executed: case SP_ArrowBack: | 0 | ||||||||||||||||||||||||
| 6021 | if (rtl)
| 0 | ||||||||||||||||||||||||
| 6022 | return QCommonStyle::standardIcon(SP_ArrowRight, option, widget); never executed: return QCommonStyle::standardIcon(SP_ArrowRight, option, widget); | 0 | ||||||||||||||||||||||||
| 6023 | return QCommonStyle::standardIcon(SP_ArrowLeft, option, widget); never executed: return QCommonStyle::standardIcon(SP_ArrowLeft, option, widget); | 0 | ||||||||||||||||||||||||
| 6024 | case SP_ArrowLeft: never executed: case SP_ArrowLeft: | 0 | ||||||||||||||||||||||||
| 6025 | icon.addFile(QLatin1String(":/qt-project.org/styles/commonstyle/images/left-16.png"), QSize(16, 16)); | - | ||||||||||||||||||||||||
| 6026 | icon.addFile(QLatin1String(":/qt-project.org/styles/commonstyle/images/left-32.png"), QSize(32, 32)); | - | ||||||||||||||||||||||||
| 6027 | icon.addFile(QLatin1String(":/qt-project.org/styles/commonstyle/images/left-128.png"), QSize(128, 128)); | - | ||||||||||||||||||||||||
| 6028 | break; never executed: break; | 0 | ||||||||||||||||||||||||
| 6029 | case SP_ArrowRight: never executed: case SP_ArrowRight: | 0 | ||||||||||||||||||||||||
| 6030 | icon.addFile(QLatin1String(":/qt-project.org/styles/commonstyle/images/right-16.png"), QSize(16, 16)); | - | ||||||||||||||||||||||||
| 6031 | icon.addFile(QLatin1String(":/qt-project.org/styles/commonstyle/images/right-32.png"), QSize(32, 32)); | - | ||||||||||||||||||||||||
| 6032 | icon.addFile(QLatin1String(":/qt-project.org/styles/commonstyle/images/right-128.png"), QSize(128, 128)); | - | ||||||||||||||||||||||||
| 6033 | break; never executed: break; | 0 | ||||||||||||||||||||||||
| 6034 | case SP_ArrowUp: never executed: case SP_ArrowUp: | 0 | ||||||||||||||||||||||||
| 6035 | icon.addFile(QLatin1String(":/qt-project.org/styles/commonstyle/images/up-16.png"), QSize(16, 16)); | - | ||||||||||||||||||||||||
| 6036 | icon.addFile(QLatin1String(":/qt-project.org/styles/commonstyle/images/up-32.png"), QSize(32, 32)); | - | ||||||||||||||||||||||||
| 6037 | icon.addFile(QLatin1String(":/qt-project.org/styles/commonstyle/images/up-128.png"), QSize(128, 128)); | - | ||||||||||||||||||||||||
| 6038 | break; never executed: break; | 0 | ||||||||||||||||||||||||
| 6039 | case SP_ArrowDown: never executed: case SP_ArrowDown: | 0 | ||||||||||||||||||||||||
| 6040 | icon.addFile(QLatin1String(":/qt-project.org/styles/commonstyle/images/down-16.png"), QSize(16, 16)); | - | ||||||||||||||||||||||||
| 6041 | icon.addFile(QLatin1String(":/qt-project.org/styles/commonstyle/images/down-32.png"), QSize(32, 32)); | - | ||||||||||||||||||||||||
| 6042 | icon.addFile(QLatin1String(":/qt-project.org/styles/commonstyle/images/down-128.png"), QSize(128, 128)); | - | ||||||||||||||||||||||||
| 6043 | break; never executed: break; | 0 | ||||||||||||||||||||||||
| 6044 | case SP_DirHomeIcon: never executed: case SP_DirHomeIcon: | 0 | ||||||||||||||||||||||||
| 6045 | case SP_DirIcon: never executed: case SP_DirIcon: | 0 | ||||||||||||||||||||||||
| 6046 | icon.addFile(QLatin1String(":/qt-project.org/styles/commonstyle/images/dirclosed-16.png"), | - | ||||||||||||||||||||||||
| 6047 | QSize(), QIcon::Normal, QIcon::Off); | - | ||||||||||||||||||||||||
| 6048 | icon.addFile(QLatin1String(":/qt-project.org/styles/commonstyle/images/diropen-16.png"), | - | ||||||||||||||||||||||||
| 6049 | QSize(), QIcon::Normal, QIcon::On); | - | ||||||||||||||||||||||||
| 6050 | icon.addFile(QLatin1String(":/qt-project.org/styles/commonstyle/images/dirclosed-32.png"), | - | ||||||||||||||||||||||||
| 6051 | QSize(32, 32), QIcon::Normal, QIcon::Off); | - | ||||||||||||||||||||||||
| 6052 | icon.addFile(QLatin1String(":/qt-project.org/styles/commonstyle/images/diropen-32.png"), | - | ||||||||||||||||||||||||
| 6053 | QSize(32, 32), QIcon::Normal, QIcon::On); | - | ||||||||||||||||||||||||
| 6054 | icon.addFile(QLatin1String(":/qt-project.org/styles/commonstyle/images/dirclosed-128.png"), | - | ||||||||||||||||||||||||
| 6055 | QSize(128, 128), QIcon::Normal, QIcon::Off); | - | ||||||||||||||||||||||||
| 6056 | icon.addFile(QLatin1String(":/qt-project.org/styles/commonstyle/images/diropen-128.png"), | - | ||||||||||||||||||||||||
| 6057 | QSize(128, 128), QIcon::Normal, QIcon::On); | - | ||||||||||||||||||||||||
| 6058 | break; never executed: break; | 0 | ||||||||||||||||||||||||
| 6059 | case SP_DriveCDIcon: never executed: case SP_DriveCDIcon: | 0 | ||||||||||||||||||||||||
| 6060 | icon.addFile(QLatin1String(":/qt-project.org/styles/commonstyle/images/cdr-16.png"), QSize(16, 16)); | - | ||||||||||||||||||||||||
| 6061 | icon.addFile(QLatin1String(":/qt-project.org/styles/commonstyle/images/cdr-32.png"), QSize(32, 32)); | - | ||||||||||||||||||||||||
| 6062 | icon.addFile(QLatin1String(":/qt-project.org/styles/commonstyle/images/cdr-128.png"), QSize(128, 128)); | - | ||||||||||||||||||||||||
| 6063 | break; never executed: break; | 0 | ||||||||||||||||||||||||
| 6064 | case SP_DriveDVDIcon: never executed: case SP_DriveDVDIcon: | 0 | ||||||||||||||||||||||||
| 6065 | icon.addFile(QLatin1String(":/qt-project.org/styles/commonstyle/images/dvd-16.png"), QSize(16, 16)); | - | ||||||||||||||||||||||||
| 6066 | icon.addFile(QLatin1String(":/qt-project.org/styles/commonstyle/images/dvd-32.png"), QSize(32, 32)); | - | ||||||||||||||||||||||||
| 6067 | icon.addFile(QLatin1String(":/qt-project.org/styles/commonstyle/images/dvd-128.png"), QSize(128, 128)); | - | ||||||||||||||||||||||||
| 6068 | break; never executed: break; | 0 | ||||||||||||||||||||||||
| 6069 | case SP_FileIcon: never executed: case SP_FileIcon: | 0 | ||||||||||||||||||||||||
| 6070 | icon.addFile(QLatin1String(":/qt-project.org/styles/commonstyle/images/file-16.png"), QSize(16, 16)); | - | ||||||||||||||||||||||||
| 6071 | icon.addFile(QLatin1String(":/qt-project.org/styles/commonstyle/images/file-32.png"), QSize(32, 32)); | - | ||||||||||||||||||||||||
| 6072 | icon.addFile(QLatin1String(":/qt-project.org/styles/commonstyle/images/file-128.png"), QSize(128, 128)); | - | ||||||||||||||||||||||||
| 6073 | break; never executed: break; | 0 | ||||||||||||||||||||||||
| 6074 | case SP_FileLinkIcon: never executed: case SP_FileLinkIcon: | 0 | ||||||||||||||||||||||||
| 6075 | icon.addFile(QLatin1String(":/qt-project.org/styles/commonstyle/images/filelink-16.png"), QSize(16, 16)); | - | ||||||||||||||||||||||||
| 6076 | icon.addFile(QLatin1String(":/qt-project.org/styles/commonstyle/images/filelink-32.png"), QSize(32, 32)); | - | ||||||||||||||||||||||||
| 6077 | icon.addFile(QLatin1String(":/qt-project.org/styles/commonstyle/images/filelink-128.png"), QSize(128, 128)); | - | ||||||||||||||||||||||||
| 6078 | break; never executed: break; | 0 | ||||||||||||||||||||||||
| 6079 | case SP_TrashIcon: never executed: case SP_TrashIcon: | 0 | ||||||||||||||||||||||||
| 6080 | icon.addFile(QLatin1String(":/qt-project.org/styles/commonstyle/images/trash-16.png"), QSize(16, 16)); | - | ||||||||||||||||||||||||
| 6081 | icon.addFile(QLatin1String(":/qt-project.org/styles/commonstyle/images/trash-32.png"), QSize(32, 32)); | - | ||||||||||||||||||||||||
| 6082 | icon.addFile(QLatin1String(":/qt-project.org/styles/commonstyle/images/trash-128.png"), QSize(128, 128)); | - | ||||||||||||||||||||||||
| 6083 | break; never executed: break; | 0 | ||||||||||||||||||||||||
| 6084 | case SP_BrowserReload: never executed: case SP_BrowserReload: | 0 | ||||||||||||||||||||||||
| 6085 | icon.addFile(QLatin1String(":/qt-project.org/styles/commonstyle/images/refresh-24.png"), QSize(24, 24)); | - | ||||||||||||||||||||||||
| 6086 | icon.addFile(QLatin1String(":/qt-project.org/styles/commonstyle/images/refresh-32.png"), QSize(32, 32)); | - | ||||||||||||||||||||||||
| 6087 | break; never executed: break; | 0 | ||||||||||||||||||||||||
| 6088 | case SP_BrowserStop: never executed: case SP_BrowserStop: | 0 | ||||||||||||||||||||||||
| 6089 | icon.addFile(QLatin1String(":/qt-project.org/styles/commonstyle/images/stop-24.png"), QSize(24, 24)); | - | ||||||||||||||||||||||||
| 6090 | icon.addFile(QLatin1String(":/qt-project.org/styles/commonstyle/images/stop-32.png"), QSize(32, 32)); | - | ||||||||||||||||||||||||
| 6091 | break; never executed: break; | 0 | ||||||||||||||||||||||||
| 6092 | case SP_MediaPlay: never executed: case SP_MediaPlay: | 0 | ||||||||||||||||||||||||
| 6093 | icon.addFile(QLatin1String(":/qt-project.org/styles/commonstyle/images/media-play-16.png"), QSize(16, 16)); | - | ||||||||||||||||||||||||
| 6094 | icon.addFile(QLatin1String(":/qt-project.org/styles/commonstyle/images/media-play-32.png"), QSize(32, 32)); | - | ||||||||||||||||||||||||
| 6095 | break; never executed: break; | 0 | ||||||||||||||||||||||||
| 6096 | case SP_MediaPause: never executed: case SP_MediaPause: | 0 | ||||||||||||||||||||||||
| 6097 | icon.addFile(QLatin1String(":/qt-project.org/styles/commonstyle/images/media-pause-16.png"), QSize(16, 16)); | - | ||||||||||||||||||||||||
| 6098 | icon.addFile(QLatin1String(":/qt-project.org/styles/commonstyle/images/media-pause-32.png"), QSize(32, 32)); | - | ||||||||||||||||||||||||
| 6099 | break; never executed: break; | 0 | ||||||||||||||||||||||||
| 6100 | case SP_MediaStop: never executed: case SP_MediaStop: | 0 | ||||||||||||||||||||||||
| 6101 | icon.addFile(QLatin1String(":/qt-project.org/styles/commonstyle/images/media-stop-16.png"), QSize(16, 16)); | - | ||||||||||||||||||||||||
| 6102 | icon.addFile(QLatin1String(":/qt-project.org/styles/commonstyle/images/media-stop-32.png"), QSize(32, 32)); | - | ||||||||||||||||||||||||
| 6103 | break; never executed: break; | 0 | ||||||||||||||||||||||||
| 6104 | case SP_MediaSeekForward: never executed: case SP_MediaSeekForward: | 0 | ||||||||||||||||||||||||
| 6105 | icon.addFile(QLatin1String(":/qt-project.org/styles/commonstyle/images/media-seek-forward-16.png"), QSize(16, 16)); | - | ||||||||||||||||||||||||
| 6106 | icon.addFile(QLatin1String(":/qt-project.org/styles/commonstyle/images/media-seek-forward-32.png"), QSize(32, 32)); | - | ||||||||||||||||||||||||
| 6107 | break; never executed: break; | 0 | ||||||||||||||||||||||||
| 6108 | case SP_MediaSeekBackward: never executed: case SP_MediaSeekBackward: | 0 | ||||||||||||||||||||||||
| 6109 | icon.addFile(QLatin1String(":/qt-project.org/styles/commonstyle/images/media-seek-backward-16.png"), QSize(16, 16)); | - | ||||||||||||||||||||||||
| 6110 | icon.addFile(QLatin1String(":/qt-project.org/styles/commonstyle/images/media-seek-backward-32.png"), QSize(32, 32)); | - | ||||||||||||||||||||||||
| 6111 | break; never executed: break; | 0 | ||||||||||||||||||||||||
| 6112 | case SP_MediaSkipForward: never executed: case SP_MediaSkipForward: | 0 | ||||||||||||||||||||||||
| 6113 | icon.addFile(QLatin1String(":/qt-project.org/styles/commonstyle/images/media-skip-forward-16.png"), QSize(16, 16)); | - | ||||||||||||||||||||||||
| 6114 | icon.addFile(QLatin1String(":/qt-project.org/styles/commonstyle/images/media-skip-forward-32.png"), QSize(32, 32)); | - | ||||||||||||||||||||||||
| 6115 | break; never executed: break; | 0 | ||||||||||||||||||||||||
| 6116 | case SP_MediaSkipBackward: never executed: case SP_MediaSkipBackward: | 0 | ||||||||||||||||||||||||
| 6117 | icon.addFile(QLatin1String(":/qt-project.org/styles/commonstyle/images/media-skip-backward-16.png"), QSize(16, 16)); | - | ||||||||||||||||||||||||
| 6118 | icon.addFile(QLatin1String(":/qt-project.org/styles/commonstyle/images/media-skip-backward-32.png"), QSize(32, 32)); | - | ||||||||||||||||||||||||
| 6119 | break; never executed: break; | 0 | ||||||||||||||||||||||||
| 6120 | case SP_MediaVolume: never executed: case SP_MediaVolume: | 0 | ||||||||||||||||||||||||
| 6121 | icon.addFile(QLatin1String(":/qt-project.org/styles/commonstyle/images/media-volume-16.png"), QSize(16, 16)); | - | ||||||||||||||||||||||||
| 6122 | break; never executed: break; | 0 | ||||||||||||||||||||||||
| 6123 | case SP_MediaVolumeMuted: never executed: case SP_MediaVolumeMuted: | 0 | ||||||||||||||||||||||||
| 6124 | icon.addFile(QLatin1String(":/qt-project.org/styles/commonstyle/images/media-volume-muted-16.png"), QSize(16, 16)); | - | ||||||||||||||||||||||||
| 6125 | break; never executed: break; | 0 | ||||||||||||||||||||||||
| 6126 | case SP_TitleBarMenuButton: never executed: case SP_TitleBarMenuButton: | 0 | ||||||||||||||||||||||||
| 6127 | # ifndef QT_NO_IMAGEFORMAT_XPM | - | ||||||||||||||||||||||||
| 6128 | icon.addPixmap(titleBarMenuCachedPixmapFromXPM()); | - | ||||||||||||||||||||||||
| 6129 | # endif | - | ||||||||||||||||||||||||
| 6130 | icon.addFile(QLatin1String(":/qt-project.org/qmessagebox/images/qtlogo-64.png")); | - | ||||||||||||||||||||||||
| 6131 | break; never executed: break; | 0 | ||||||||||||||||||||||||
| 6132 | #endif // QT_NO_IMAGEFORMAT_PNG | - | ||||||||||||||||||||||||
| 6133 | default: never executed: default: | 0 | ||||||||||||||||||||||||
| 6134 | icon.addPixmap(proxy()->standardPixmap(standardIcon, option, widget)); | - | ||||||||||||||||||||||||
| 6135 | break; never executed: break; | 0 | ||||||||||||||||||||||||
| 6136 | } | - | ||||||||||||||||||||||||
| 6137 | return icon; never executed: return icon; | 0 | ||||||||||||||||||||||||
| 6138 | } | - | ||||||||||||||||||||||||
| 6139 | - | |||||||||||||||||||||||||
| 6140 | static inline uint qt_intensity(uint r, uint g, uint b) | - | ||||||||||||||||||||||||
| 6141 | { | - | ||||||||||||||||||||||||
| 6142 | // 30% red, 59% green, 11% blue | - | ||||||||||||||||||||||||
| 6143 | return (77 * r + 150 * g + 28 * b) / 255; | - | ||||||||||||||||||||||||
| 6144 | } | - | ||||||||||||||||||||||||
| 6145 | - | |||||||||||||||||||||||||
| 6146 | /*! \reimp */ | - | ||||||||||||||||||||||||
| 6147 | QPixmap QCommonStyle::generatedIconPixmap(QIcon::Mode iconMode, const QPixmap &pixmap, | - | ||||||||||||||||||||||||
| 6148 | const QStyleOption *opt) const | - | ||||||||||||||||||||||||
| 6149 | { | - | ||||||||||||||||||||||||
| 6150 | switch (iconMode) { | - | ||||||||||||||||||||||||
| 6151 | case QIcon::Disabled: { | - | ||||||||||||||||||||||||
| 6152 | QImage im = pixmap.toImage().convertToFormat(QImage::Format_ARGB32); | - | ||||||||||||||||||||||||
| 6153 | - | |||||||||||||||||||||||||
| 6154 | // Create a colortable based on the background (black -> bg -> white) | - | ||||||||||||||||||||||||
| 6155 | QColor bg = opt->palette.color(QPalette::Disabled, QPalette::Window); | - | ||||||||||||||||||||||||
| 6156 | int red = bg.red(); | - | ||||||||||||||||||||||||
| 6157 | int green = bg.green(); | - | ||||||||||||||||||||||||
| 6158 | int blue = bg.blue(); | - | ||||||||||||||||||||||||
| 6159 | uchar reds[256], greens[256], blues[256]; | - | ||||||||||||||||||||||||
| 6160 | for (int i=0; i<128; ++i) { | - | ||||||||||||||||||||||||
| 6161 | reds[i] = uchar((red * (i<<1)) >> 8); | - | ||||||||||||||||||||||||
| 6162 | greens[i] = uchar((green * (i<<1)) >> 8); | - | ||||||||||||||||||||||||
| 6163 | blues[i] = uchar((blue * (i<<1)) >> 8); | - | ||||||||||||||||||||||||
| 6164 | } | - | ||||||||||||||||||||||||
| 6165 | for (int i=0; i<128; ++i) { | - | ||||||||||||||||||||||||
| 6166 | reds[i+128] = uchar(qMin(red + (i << 1), 255)); | - | ||||||||||||||||||||||||
| 6167 | greens[i+128] = uchar(qMin(green + (i << 1), 255)); | - | ||||||||||||||||||||||||
| 6168 | blues[i+128] = uchar(qMin(blue + (i << 1), 255)); | - | ||||||||||||||||||||||||
| 6169 | } | - | ||||||||||||||||||||||||
| 6170 | - | |||||||||||||||||||||||||
| 6171 | int intensity = qt_intensity(red, green, blue); | - | ||||||||||||||||||||||||
| 6172 | const int factor = 191; | - | ||||||||||||||||||||||||
| 6173 | - | |||||||||||||||||||||||||
| 6174 | // High intensity colors needs dark shifting in the color table, while | - | ||||||||||||||||||||||||
| 6175 | // low intensity colors needs light shifting. This is to increase the | - | ||||||||||||||||||||||||
| 6176 | // percieved contrast. | - | ||||||||||||||||||||||||
| 6177 | if ((red - factor > green && red - factor > blue) | - | ||||||||||||||||||||||||
| 6178 | || (green - factor > red && green - factor > blue) | - | ||||||||||||||||||||||||
| 6179 | || (blue - factor > red && blue - factor > green)) | - | ||||||||||||||||||||||||
| 6180 | intensity = qMin(255, intensity + 91); | - | ||||||||||||||||||||||||
| 6181 | else if (intensity <= 128) | - | ||||||||||||||||||||||||
| 6182 | intensity -= 51; | - | ||||||||||||||||||||||||
| 6183 | - | |||||||||||||||||||||||||
| 6184 | for (int y=0; y<im.height(); ++y) { | - | ||||||||||||||||||||||||
| 6185 | QRgb *scanLine = (QRgb*)im.scanLine(y); | - | ||||||||||||||||||||||||
| 6186 | for (int x=0; x<im.width(); ++x) { | - | ||||||||||||||||||||||||
| 6187 | QRgb pixel = *scanLine; | - | ||||||||||||||||||||||||
| 6188 | // Calculate color table index, taking intensity adjustment | - | ||||||||||||||||||||||||
| 6189 | // and a magic offset into account. | - | ||||||||||||||||||||||||
| 6190 | uint ci = uint(qGray(pixel)/3 + (130 - intensity / 3)); | - | ||||||||||||||||||||||||
| 6191 | *scanLine = qRgba(reds[ci], greens[ci], blues[ci], qAlpha(pixel)); | - | ||||||||||||||||||||||||
| 6192 | ++scanLine; | - | ||||||||||||||||||||||||
| 6193 | } | - | ||||||||||||||||||||||||
| 6194 | } | - | ||||||||||||||||||||||||
| 6195 | - | |||||||||||||||||||||||||
| 6196 | return QPixmap::fromImage(im); | - | ||||||||||||||||||||||||
| 6197 | } | - | ||||||||||||||||||||||||
| 6198 | case QIcon::Selected: { | - | ||||||||||||||||||||||||
| 6199 | QImage img = pixmap.toImage().convertToFormat(QImage::Format_ARGB32_Premultiplied); | - | ||||||||||||||||||||||||
| 6200 | QColor color = opt->palette.color(QPalette::Normal, QPalette::Highlight); | - | ||||||||||||||||||||||||
| 6201 | color.setAlphaF(qreal(0.3)); | - | ||||||||||||||||||||||||
| 6202 | QPainter painter(&img); | - | ||||||||||||||||||||||||
| 6203 | painter.setCompositionMode(QPainter::CompositionMode_SourceAtop); | - | ||||||||||||||||||||||||
| 6204 | painter.fillRect(0, 0, img.width(), img.height(), color); | - | ||||||||||||||||||||||||
| 6205 | painter.end(); | - | ||||||||||||||||||||||||
| 6206 | return QPixmap::fromImage(img); } | - | ||||||||||||||||||||||||
| 6207 | case QIcon::Active: | - | ||||||||||||||||||||||||
| 6208 | return pixmap; | - | ||||||||||||||||||||||||
| 6209 | default: | - | ||||||||||||||||||||||||
| 6210 | break; | - | ||||||||||||||||||||||||
| 6211 | } | - | ||||||||||||||||||||||||
| 6212 | return pixmap; | - | ||||||||||||||||||||||||
| 6213 | } | - | ||||||||||||||||||||||||
| 6214 | - | |||||||||||||||||||||||||
| 6215 | /*! | - | ||||||||||||||||||||||||
| 6216 | \reimp | - | ||||||||||||||||||||||||
| 6217 | */ | - | ||||||||||||||||||||||||
| 6218 | int QCommonStyle::layoutSpacing(QSizePolicy::ControlType /* control1 */, QSizePolicy::ControlType /* control2 */, | - | ||||||||||||||||||||||||
| 6219 | Qt::Orientation /* orientation */, const QStyleOption * /* option */, | - | ||||||||||||||||||||||||
| 6220 | const QWidget * /* widget */) const | - | ||||||||||||||||||||||||
| 6221 | { | - | ||||||||||||||||||||||||
| 6222 | return -1; | - | ||||||||||||||||||||||||
| 6223 | } | - | ||||||||||||||||||||||||
| 6224 | - | |||||||||||||||||||||||||
| 6225 | /*! | - | ||||||||||||||||||||||||
| 6226 | \reimp | - | ||||||||||||||||||||||||
| 6227 | */ | - | ||||||||||||||||||||||||
| 6228 | void QCommonStyle::polish(QPalette &pal) | - | ||||||||||||||||||||||||
| 6229 | { | - | ||||||||||||||||||||||||
| 6230 | QStyle::polish(pal); | - | ||||||||||||||||||||||||
| 6231 | } | - | ||||||||||||||||||||||||
| 6232 | - | |||||||||||||||||||||||||
| 6233 | /*! | - | ||||||||||||||||||||||||
| 6234 | \reimp | - | ||||||||||||||||||||||||
| 6235 | */ | - | ||||||||||||||||||||||||
| 6236 | void QCommonStyle::polish(QWidget *widget) | - | ||||||||||||||||||||||||
| 6237 | { | - | ||||||||||||||||||||||||
| 6238 | QStyle::polish(widget); | - | ||||||||||||||||||||||||
| 6239 | } | - | ||||||||||||||||||||||||
| 6240 | - | |||||||||||||||||||||||||
| 6241 | /*! | - | ||||||||||||||||||||||||
| 6242 | \reimp | - | ||||||||||||||||||||||||
| 6243 | */ | - | ||||||||||||||||||||||||
| 6244 | void QCommonStyle::unpolish(QWidget *widget) | - | ||||||||||||||||||||||||
| 6245 | { | - | ||||||||||||||||||||||||
| 6246 | QStyle::unpolish(widget); | - | ||||||||||||||||||||||||
| 6247 | } | - | ||||||||||||||||||||||||
| 6248 | - | |||||||||||||||||||||||||
| 6249 | /*! | - | ||||||||||||||||||||||||
| 6250 | \reimp | - | ||||||||||||||||||||||||
| 6251 | */ | - | ||||||||||||||||||||||||
| 6252 | void QCommonStyle::polish(QApplication *app) | - | ||||||||||||||||||||||||
| 6253 | { | - | ||||||||||||||||||||||||
| 6254 | QStyle::polish(app); | - | ||||||||||||||||||||||||
| 6255 | } | - | ||||||||||||||||||||||||
| 6256 | - | |||||||||||||||||||||||||
| 6257 | /*! | - | ||||||||||||||||||||||||
| 6258 | \reimp | - | ||||||||||||||||||||||||
| 6259 | */ | - | ||||||||||||||||||||||||
| 6260 | void QCommonStyle::unpolish(QApplication *application) | - | ||||||||||||||||||||||||
| 6261 | { | - | ||||||||||||||||||||||||
| 6262 | Q_D(const QCommonStyle); | - | ||||||||||||||||||||||||
| 6263 | d->tabBarcloseButtonIcon = QIcon(); | - | ||||||||||||||||||||||||
| 6264 | QStyle::unpolish(application); | - | ||||||||||||||||||||||||
| 6265 | } | - | ||||||||||||||||||||||||
| 6266 | - | |||||||||||||||||||||||||
| 6267 | - | |||||||||||||||||||||||||
| 6268 | QT_END_NAMESPACE | - | ||||||||||||||||||||||||
| 6269 | - | |||||||||||||||||||||||||
| 6270 | #include "moc_qcommonstyle.cpp" | - | ||||||||||||||||||||||||
| Source code | Switch to Preprocessed file |