| Absolute File Name: | /home/qt/qt5_coco/qt5/qtbase/src/widgets/styles/qfusionstyle.cpp |
| Source code | Switch to Preprocessed file |
| Line | Source | Count | ||||||||||||||||||||||||||||||||||||
|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
| 1 | /**************************************************************************** | - | ||||||||||||||||||||||||||||||||||||
| 2 | ** | - | ||||||||||||||||||||||||||||||||||||
| 3 | ** Copyright (C) 2015 The Qt Company Ltd. | - | ||||||||||||||||||||||||||||||||||||
| 4 | ** Contact: http://www.qt.io/licensing/ | - | ||||||||||||||||||||||||||||||||||||
| 5 | ** | - | ||||||||||||||||||||||||||||||||||||
| 6 | ** This file is part of the QtWidgets module of the Qt Toolkit. | - | ||||||||||||||||||||||||||||||||||||
| 7 | ** | - | ||||||||||||||||||||||||||||||||||||
| 8 | ** $QT_BEGIN_LICENSE:LGPL21$ | - | ||||||||||||||||||||||||||||||||||||
| 9 | ** Commercial License Usage | - | ||||||||||||||||||||||||||||||||||||
| 10 | ** Licensees holding valid commercial Qt licenses may use this file in | - | ||||||||||||||||||||||||||||||||||||
| 11 | ** accordance with the commercial license agreement provided with the | - | ||||||||||||||||||||||||||||||||||||
| 12 | ** Software or, alternatively, in accordance with the terms contained in | - | ||||||||||||||||||||||||||||||||||||
| 13 | ** a written agreement between you and The Qt Company. For licensing terms | - | ||||||||||||||||||||||||||||||||||||
| 14 | ** and conditions see http://www.qt.io/terms-conditions. For further | - | ||||||||||||||||||||||||||||||||||||
| 15 | ** information use the contact form at http://www.qt.io/contact-us. | - | ||||||||||||||||||||||||||||||||||||
| 16 | ** | - | ||||||||||||||||||||||||||||||||||||
| 17 | ** GNU Lesser General Public License Usage | - | ||||||||||||||||||||||||||||||||||||
| 18 | ** Alternatively, this file may be used under the terms of the GNU Lesser | - | ||||||||||||||||||||||||||||||||||||
| 19 | ** General Public License version 2.1 or version 3 as published by the Free | - | ||||||||||||||||||||||||||||||||||||
| 20 | ** Software Foundation and appearing in the file LICENSE.LGPLv21 and | - | ||||||||||||||||||||||||||||||||||||
| 21 | ** LICENSE.LGPLv3 included in the packaging of this file. Please review the | - | ||||||||||||||||||||||||||||||||||||
| 22 | ** following information to ensure the GNU Lesser General Public License | - | ||||||||||||||||||||||||||||||||||||
| 23 | ** requirements will be met: https://www.gnu.org/licenses/lgpl.html and | - | ||||||||||||||||||||||||||||||||||||
| 24 | ** http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. | - | ||||||||||||||||||||||||||||||||||||
| 25 | ** | - | ||||||||||||||||||||||||||||||||||||
| 26 | ** As a special exception, The Qt Company gives you certain additional | - | ||||||||||||||||||||||||||||||||||||
| 27 | ** rights. These rights are described in The Qt Company LGPL Exception | - | ||||||||||||||||||||||||||||||||||||
| 28 | ** version 1.1, included in the file LGPL_EXCEPTION.txt in this package. | - | ||||||||||||||||||||||||||||||||||||
| 29 | ** | - | ||||||||||||||||||||||||||||||||||||
| 30 | ** $QT_END_LICENSE$ | - | ||||||||||||||||||||||||||||||||||||
| 31 | ** | - | ||||||||||||||||||||||||||||||||||||
| 32 | ****************************************************************************/ | - | ||||||||||||||||||||||||||||||||||||
| 33 | - | |||||||||||||||||||||||||||||||||||||
| 34 | #include "qfusionstyle_p.h" | - | ||||||||||||||||||||||||||||||||||||
| 35 | #include "qfusionstyle_p_p.h" | - | ||||||||||||||||||||||||||||||||||||
| 36 | - | |||||||||||||||||||||||||||||||||||||
| 37 | #if !defined(QT_NO_STYLE_FUSION) || defined(QT_PLUGIN) | - | ||||||||||||||||||||||||||||||||||||
| 38 | #include "qcommonstyle_p.h" | - | ||||||||||||||||||||||||||||||||||||
| 39 | #include <qcombobox.h> | - | ||||||||||||||||||||||||||||||||||||
| 40 | #include <qpushbutton.h> | - | ||||||||||||||||||||||||||||||||||||
| 41 | #include <qpainter.h> | - | ||||||||||||||||||||||||||||||||||||
| 42 | #include <qdir.h> | - | ||||||||||||||||||||||||||||||||||||
| 43 | #include <qstyleoption.h> | - | ||||||||||||||||||||||||||||||||||||
| 44 | #include <qapplication.h> | - | ||||||||||||||||||||||||||||||||||||
| 45 | #include <qmainwindow.h> | - | ||||||||||||||||||||||||||||||||||||
| 46 | #include <qfont.h> | - | ||||||||||||||||||||||||||||||||||||
| 47 | #include <qgroupbox.h> | - | ||||||||||||||||||||||||||||||||||||
| 48 | #include <qprocess.h> | - | ||||||||||||||||||||||||||||||||||||
| 49 | #include <qpixmapcache.h> | - | ||||||||||||||||||||||||||||||||||||
| 50 | #include <qdialogbuttonbox.h> | - | ||||||||||||||||||||||||||||||||||||
| 51 | #include <qscrollbar.h> | - | ||||||||||||||||||||||||||||||||||||
| 52 | #include <qspinbox.h> | - | ||||||||||||||||||||||||||||||||||||
| 53 | #include <qslider.h> | - | ||||||||||||||||||||||||||||||||||||
| 54 | #include <qsplitter.h> | - | ||||||||||||||||||||||||||||||||||||
| 55 | #include <qprogressbar.h> | - | ||||||||||||||||||||||||||||||||||||
| 56 | #include <qwizard.h> | - | ||||||||||||||||||||||||||||||||||||
| 57 | #include <qlibrary.h> | - | ||||||||||||||||||||||||||||||||||||
| 58 | #include <qdrawutil.h> | - | ||||||||||||||||||||||||||||||||||||
| 59 | #include <private/qstylehelper_p.h> | - | ||||||||||||||||||||||||||||||||||||
| 60 | #include <private/qdrawhelper_p.h> | - | ||||||||||||||||||||||||||||||||||||
| 61 | #include <private/qapplication_p.h> | - | ||||||||||||||||||||||||||||||||||||
| 62 | - | |||||||||||||||||||||||||||||||||||||
| 63 | QT_BEGIN_NAMESPACE | - | ||||||||||||||||||||||||||||||||||||
| 64 | - | |||||||||||||||||||||||||||||||||||||
| 65 | using namespace QStyleHelper; | - | ||||||||||||||||||||||||||||||||||||
| 66 | - | |||||||||||||||||||||||||||||||||||||
| 67 | enum Direction { | - | ||||||||||||||||||||||||||||||||||||
| 68 | TopDown, | - | ||||||||||||||||||||||||||||||||||||
| 69 | FromLeft, | - | ||||||||||||||||||||||||||||||||||||
| 70 | BottomUp, | - | ||||||||||||||||||||||||||||||||||||
| 71 | FromRight | - | ||||||||||||||||||||||||||||||||||||
| 72 | }; | - | ||||||||||||||||||||||||||||||||||||
| 73 | - | |||||||||||||||||||||||||||||||||||||
| 74 | // from windows style | - | ||||||||||||||||||||||||||||||||||||
| 75 | static const int windowsItemFrame = 2; // menu item frame width | - | ||||||||||||||||||||||||||||||||||||
| 76 | static const int windowsItemHMargin = 3; // menu item hor text margin | - | ||||||||||||||||||||||||||||||||||||
| 77 | static const int windowsItemVMargin = 8; // menu item ver text margin | - | ||||||||||||||||||||||||||||||||||||
| 78 | static const int windowsRightBorder = 15; // right border on windows | - | ||||||||||||||||||||||||||||||||||||
| 79 | - | |||||||||||||||||||||||||||||||||||||
| 80 | static const int groupBoxBottomMargin = 0; // space below the groupbox | - | ||||||||||||||||||||||||||||||||||||
| 81 | static const int groupBoxTopMargin = 3; | - | ||||||||||||||||||||||||||||||||||||
| 82 | - | |||||||||||||||||||||||||||||||||||||
| 83 | - | |||||||||||||||||||||||||||||||||||||
| 84 | /* XPM */ | - | ||||||||||||||||||||||||||||||||||||
| 85 | static const char * const dock_widget_close_xpm[] = { | - | ||||||||||||||||||||||||||||||||||||
| 86 | "11 13 7 1", | - | ||||||||||||||||||||||||||||||||||||
| 87 | " c None", | - | ||||||||||||||||||||||||||||||||||||
| 88 | ". c #D5CFCB", | - | ||||||||||||||||||||||||||||||||||||
| 89 | "+ c #8F8B88", | - | ||||||||||||||||||||||||||||||||||||
| 90 | "@ c #6C6A67", | - | ||||||||||||||||||||||||||||||||||||
| 91 | "# c #ABA6A3", | - | ||||||||||||||||||||||||||||||||||||
| 92 | "$ c #B5B0AC", | - | ||||||||||||||||||||||||||||||||||||
| 93 | "% c #A4A09D", | - | ||||||||||||||||||||||||||||||||||||
| 94 | " ", | - | ||||||||||||||||||||||||||||||||||||
| 95 | " +@@@@@@@+ ", | - | ||||||||||||||||||||||||||||||||||||
| 96 | "+# #+", | - | ||||||||||||||||||||||||||||||||||||
| 97 | "@ $@ @$ @", | - | ||||||||||||||||||||||||||||||||||||
| 98 | "@ @@@ @@@ @", | - | ||||||||||||||||||||||||||||||||||||
| 99 | "@ @@@@@ @", | - | ||||||||||||||||||||||||||||||||||||
| 100 | "@ @@@ @", | - | ||||||||||||||||||||||||||||||||||||
| 101 | "@ @@@@@ @", | - | ||||||||||||||||||||||||||||||||||||
| 102 | "@ @@@ @@@ @", | - | ||||||||||||||||||||||||||||||||||||
| 103 | "@ $@ @$ @", | - | ||||||||||||||||||||||||||||||||||||
| 104 | "+% #+", | - | ||||||||||||||||||||||||||||||||||||
| 105 | " +@@@@@@@+ ", | - | ||||||||||||||||||||||||||||||||||||
| 106 | " "}; | - | ||||||||||||||||||||||||||||||||||||
| 107 | - | |||||||||||||||||||||||||||||||||||||
| 108 | static const char * const dock_widget_restore_xpm[] = { | - | ||||||||||||||||||||||||||||||||||||
| 109 | "11 13 7 1", | - | ||||||||||||||||||||||||||||||||||||
| 110 | " c None", | - | ||||||||||||||||||||||||||||||||||||
| 111 | ". c #D5CFCB", | - | ||||||||||||||||||||||||||||||||||||
| 112 | "+ c #8F8B88", | - | ||||||||||||||||||||||||||||||||||||
| 113 | "@ c #6C6A67", | - | ||||||||||||||||||||||||||||||||||||
| 114 | "# c #ABA6A3", | - | ||||||||||||||||||||||||||||||||||||
| 115 | "$ c #B5B0AC", | - | ||||||||||||||||||||||||||||||||||||
| 116 | "% c #A4A09D", | - | ||||||||||||||||||||||||||||||||||||
| 117 | " ", | - | ||||||||||||||||||||||||||||||||||||
| 118 | " +@@@@@@@+ ", | - | ||||||||||||||||||||||||||||||||||||
| 119 | "+# #+", | - | ||||||||||||||||||||||||||||||||||||
| 120 | "@ #@@@# @", | - | ||||||||||||||||||||||||||||||||||||
| 121 | "@ @ @ @", | - | ||||||||||||||||||||||||||||||||||||
| 122 | "@ #@@@# @ @", | - | ||||||||||||||||||||||||||||||||||||
| 123 | "@ @ @ @ @", | - | ||||||||||||||||||||||||||||||||||||
| 124 | "@ @ @@@ @", | - | ||||||||||||||||||||||||||||||||||||
| 125 | "@ @ @ @", | - | ||||||||||||||||||||||||||||||||||||
| 126 | "@ #@@@# @", | - | ||||||||||||||||||||||||||||||||||||
| 127 | "+% #+", | - | ||||||||||||||||||||||||||||||||||||
| 128 | " +@@@@@@@+ ", | - | ||||||||||||||||||||||||||||||||||||
| 129 | " "}; | - | ||||||||||||||||||||||||||||||||||||
| 130 | - | |||||||||||||||||||||||||||||||||||||
| 131 | static const char * const workspace_minimize[] = { | - | ||||||||||||||||||||||||||||||||||||
| 132 | "11 13 7 1", | - | ||||||||||||||||||||||||||||||||||||
| 133 | " c None", | - | ||||||||||||||||||||||||||||||||||||
| 134 | ". c #D5CFCB", | - | ||||||||||||||||||||||||||||||||||||
| 135 | "+ c #8F8B88", | - | ||||||||||||||||||||||||||||||||||||
| 136 | "@ c #6C6A67", | - | ||||||||||||||||||||||||||||||||||||
| 137 | "# c #ABA6A3", | - | ||||||||||||||||||||||||||||||||||||
| 138 | "$ c #B5B0AC", | - | ||||||||||||||||||||||||||||||||||||
| 139 | "% c #A4A09D", | - | ||||||||||||||||||||||||||||||||||||
| 140 | " ", | - | ||||||||||||||||||||||||||||||||||||
| 141 | " +@@@@@@@+ ", | - | ||||||||||||||||||||||||||||||||||||
| 142 | "+# #+", | - | ||||||||||||||||||||||||||||||||||||
| 143 | "@ @", | - | ||||||||||||||||||||||||||||||||||||
| 144 | "@ @", | - | ||||||||||||||||||||||||||||||||||||
| 145 | "@ @", | - | ||||||||||||||||||||||||||||||||||||
| 146 | "@ @@@@@@@ @", | - | ||||||||||||||||||||||||||||||||||||
| 147 | "@ @@@@@@@ @", | - | ||||||||||||||||||||||||||||||||||||
| 148 | "@ @", | - | ||||||||||||||||||||||||||||||||||||
| 149 | "@ @", | - | ||||||||||||||||||||||||||||||||||||
| 150 | "+% #+", | - | ||||||||||||||||||||||||||||||||||||
| 151 | " +@@@@@@@+ ", | - | ||||||||||||||||||||||||||||||||||||
| 152 | " "}; | - | ||||||||||||||||||||||||||||||||||||
| 153 | - | |||||||||||||||||||||||||||||||||||||
| 154 | - | |||||||||||||||||||||||||||||||||||||
| 155 | static const char * const qt_titlebar_context_help[] = { | - | ||||||||||||||||||||||||||||||||||||
| 156 | "10 10 3 1", | - | ||||||||||||||||||||||||||||||||||||
| 157 | " c None", | - | ||||||||||||||||||||||||||||||||||||
| 158 | "# c #000000", | - | ||||||||||||||||||||||||||||||||||||
| 159 | "+ c #444444", | - | ||||||||||||||||||||||||||||||||||||
| 160 | " +####+ ", | - | ||||||||||||||||||||||||||||||||||||
| 161 | " ### ### ", | - | ||||||||||||||||||||||||||||||||||||
| 162 | " ## ## ", | - | ||||||||||||||||||||||||||||||||||||
| 163 | " +##+ ", | - | ||||||||||||||||||||||||||||||||||||
| 164 | " +## ", | - | ||||||||||||||||||||||||||||||||||||
| 165 | " ## ", | - | ||||||||||||||||||||||||||||||||||||
| 166 | " ## ", | - | ||||||||||||||||||||||||||||||||||||
| 167 | " ", | - | ||||||||||||||||||||||||||||||||||||
| 168 | " ## ", | - | ||||||||||||||||||||||||||||||||||||
| 169 | " ## "}; | - | ||||||||||||||||||||||||||||||||||||
| 170 | - | |||||||||||||||||||||||||||||||||||||
| 171 | - | |||||||||||||||||||||||||||||||||||||
| 172 | static QColor mergedColors(const QColor &colorA, const QColor &colorB, int factor = 50) | - | ||||||||||||||||||||||||||||||||||||
| 173 | { | - | ||||||||||||||||||||||||||||||||||||
| 174 | const int maxFactor = 100; | - | ||||||||||||||||||||||||||||||||||||
| 175 | QColor tmp = colorA; | - | ||||||||||||||||||||||||||||||||||||
| 176 | tmp.setRed((tmp.red() * factor) / maxFactor + (colorB.red() * (maxFactor - factor)) / maxFactor); | - | ||||||||||||||||||||||||||||||||||||
| 177 | tmp.setGreen((tmp.green() * factor) / maxFactor + (colorB.green() * (maxFactor - factor)) / maxFactor); | - | ||||||||||||||||||||||||||||||||||||
| 178 | tmp.setBlue((tmp.blue() * factor) / maxFactor + (colorB.blue() * (maxFactor - factor)) / maxFactor); | - | ||||||||||||||||||||||||||||||||||||
| 179 | return tmp; never executed: return tmp; | 0 | ||||||||||||||||||||||||||||||||||||
| 180 | } | - | ||||||||||||||||||||||||||||||||||||
| 181 | - | |||||||||||||||||||||||||||||||||||||
| 182 | static QPixmap colorizedImage(const QString &fileName, const QColor &color, int rotation = 0) { | - | ||||||||||||||||||||||||||||||||||||
| 183 | - | |||||||||||||||||||||||||||||||||||||
| 184 | QString pixmapName = QLatin1String("$qt_ia-") % fileName % HexString<uint>(color.rgba()) % QString::number(rotation); | - | ||||||||||||||||||||||||||||||||||||
| 185 | QPixmap pixmap; | - | ||||||||||||||||||||||||||||||||||||
| 186 | if (!QPixmapCache::find(pixmapName, pixmap)) {
| 0 | ||||||||||||||||||||||||||||||||||||
| 187 | QImage image(fileName); | - | ||||||||||||||||||||||||||||||||||||
| 188 | - | |||||||||||||||||||||||||||||||||||||
| 189 | if (image.format() != QImage::Format_ARGB32_Premultiplied)
| 0 | ||||||||||||||||||||||||||||||||||||
| 190 | image = image.convertToFormat( QImage::Format_ARGB32_Premultiplied); never executed: image = image.convertToFormat( QImage::Format_ARGB32_Premultiplied); | 0 | ||||||||||||||||||||||||||||||||||||
| 191 | - | |||||||||||||||||||||||||||||||||||||
| 192 | int width = image.width(); | - | ||||||||||||||||||||||||||||||||||||
| 193 | int height = image.height(); | - | ||||||||||||||||||||||||||||||||||||
| 194 | int source = color.rgba(); | - | ||||||||||||||||||||||||||||||||||||
| 195 | - | |||||||||||||||||||||||||||||||||||||
| 196 | unsigned char sourceRed = qRed(source); | - | ||||||||||||||||||||||||||||||||||||
| 197 | unsigned char sourceGreen = qGreen(source); | - | ||||||||||||||||||||||||||||||||||||
| 198 | unsigned char sourceBlue = qBlue(source); | - | ||||||||||||||||||||||||||||||||||||
| 199 | - | |||||||||||||||||||||||||||||||||||||
| 200 | for (int y = 0; y < height; ++y)
| 0 | ||||||||||||||||||||||||||||||||||||
| 201 | { | - | ||||||||||||||||||||||||||||||||||||
| 202 | QRgb *data = (QRgb*) image.scanLine(y); | - | ||||||||||||||||||||||||||||||||||||
| 203 | for (int x = 0 ; x < width ; x++) {
| 0 | ||||||||||||||||||||||||||||||||||||
| 204 | QRgb col = data[x]; | - | ||||||||||||||||||||||||||||||||||||
| 205 | unsigned int colorDiff = (qBlue(col) - qRed(col)); | - | ||||||||||||||||||||||||||||||||||||
| 206 | unsigned char gray = qGreen(col); | - | ||||||||||||||||||||||||||||||||||||
| 207 | unsigned char red = gray + qt_div_255(sourceRed * colorDiff); | - | ||||||||||||||||||||||||||||||||||||
| 208 | unsigned char green = gray + qt_div_255(sourceGreen * colorDiff); | - | ||||||||||||||||||||||||||||||||||||
| 209 | unsigned char blue = gray + qt_div_255(sourceBlue * colorDiff); | - | ||||||||||||||||||||||||||||||||||||
| 210 | unsigned char alpha = qt_div_255(qAlpha(col) * qAlpha(source)); | - | ||||||||||||||||||||||||||||||||||||
| 211 | data[x] = qRgba(std::min(alpha, red), | - | ||||||||||||||||||||||||||||||||||||
| 212 | std::min(alpha, green), | - | ||||||||||||||||||||||||||||||||||||
| 213 | std::min(alpha, blue), | - | ||||||||||||||||||||||||||||||||||||
| 214 | alpha); | - | ||||||||||||||||||||||||||||||||||||
| 215 | } never executed: end of block | 0 | ||||||||||||||||||||||||||||||||||||
| 216 | } never executed: end of block | 0 | ||||||||||||||||||||||||||||||||||||
| 217 | if (rotation != 0) {
| 0 | ||||||||||||||||||||||||||||||||||||
| 218 | QTransform transform; | - | ||||||||||||||||||||||||||||||||||||
| 219 | transform.translate(-image.width()/2, -image.height()/2); | - | ||||||||||||||||||||||||||||||||||||
| 220 | transform.rotate(rotation); | - | ||||||||||||||||||||||||||||||||||||
| 221 | transform.translate(image.width()/2, image.height()/2); | - | ||||||||||||||||||||||||||||||||||||
| 222 | image = image.transformed(transform); | - | ||||||||||||||||||||||||||||||||||||
| 223 | } never executed: end of block | 0 | ||||||||||||||||||||||||||||||||||||
| 224 | - | |||||||||||||||||||||||||||||||||||||
| 225 | pixmap = QPixmap::fromImage(image); | - | ||||||||||||||||||||||||||||||||||||
| 226 | QPixmapCache::insert(pixmapName, pixmap); | - | ||||||||||||||||||||||||||||||||||||
| 227 | } never executed: end of block | 0 | ||||||||||||||||||||||||||||||||||||
| 228 | return pixmap; never executed: return pixmap; | 0 | ||||||||||||||||||||||||||||||||||||
| 229 | } | - | ||||||||||||||||||||||||||||||||||||
| 230 | - | |||||||||||||||||||||||||||||||||||||
| 231 | // The default button and handle gradient | - | ||||||||||||||||||||||||||||||||||||
| 232 | static QLinearGradient qt_fusion_gradient(const QRect &rect, const QBrush &baseColor, Direction direction = TopDown) | - | ||||||||||||||||||||||||||||||||||||
| 233 | { | - | ||||||||||||||||||||||||||||||||||||
| 234 | int x = rect.center().x(); | - | ||||||||||||||||||||||||||||||||||||
| 235 | int y = rect.center().y(); | - | ||||||||||||||||||||||||||||||||||||
| 236 | QLinearGradient gradient; | - | ||||||||||||||||||||||||||||||||||||
| 237 | switch (direction) { | - | ||||||||||||||||||||||||||||||||||||
| 238 | case FromLeft: never executed: case FromLeft: | 0 | ||||||||||||||||||||||||||||||||||||
| 239 | gradient = QLinearGradient(rect.left(), y, rect.right(), y); | - | ||||||||||||||||||||||||||||||||||||
| 240 | break; never executed: break; | 0 | ||||||||||||||||||||||||||||||||||||
| 241 | case FromRight: never executed: case FromRight: | 0 | ||||||||||||||||||||||||||||||||||||
| 242 | gradient = QLinearGradient(rect.right(), y, rect.left(), y); | - | ||||||||||||||||||||||||||||||||||||
| 243 | break; never executed: break; | 0 | ||||||||||||||||||||||||||||||||||||
| 244 | case BottomUp: never executed: case BottomUp: | 0 | ||||||||||||||||||||||||||||||||||||
| 245 | gradient = QLinearGradient(x, rect.bottom(), x, rect.top()); | - | ||||||||||||||||||||||||||||||||||||
| 246 | break; never executed: break; | 0 | ||||||||||||||||||||||||||||||||||||
| 247 | case TopDown: never executed: case TopDown: | 0 | ||||||||||||||||||||||||||||||||||||
| 248 | default: never executed: default: | 0 | ||||||||||||||||||||||||||||||||||||
| 249 | gradient = QLinearGradient(x, rect.top(), x, rect.bottom()); | - | ||||||||||||||||||||||||||||||||||||
| 250 | break; never executed: break; | 0 | ||||||||||||||||||||||||||||||||||||
| 251 | } | - | ||||||||||||||||||||||||||||||||||||
| 252 | if (baseColor.gradient())
| 0 | ||||||||||||||||||||||||||||||||||||
| 253 | gradient.setStops(baseColor.gradient()->stops()); never executed: gradient.setStops(baseColor.gradient()->stops()); | 0 | ||||||||||||||||||||||||||||||||||||
| 254 | else { | - | ||||||||||||||||||||||||||||||||||||
| 255 | QColor gradientStartColor = baseColor.color().lighter(124); | - | ||||||||||||||||||||||||||||||||||||
| 256 | QColor gradientStopColor = baseColor.color().lighter(102); | - | ||||||||||||||||||||||||||||||||||||
| 257 | gradient.setColorAt(0, gradientStartColor); | - | ||||||||||||||||||||||||||||||||||||
| 258 | gradient.setColorAt(1, gradientStopColor); | - | ||||||||||||||||||||||||||||||||||||
| 259 | // Uncomment for adding shiny shading | - | ||||||||||||||||||||||||||||||||||||
| 260 | // QColor midColor1 = mergedColors(gradientStartColor, gradientStopColor, 55); | - | ||||||||||||||||||||||||||||||||||||
| 261 | // QColor midColor2 = mergedColors(gradientStartColor, gradientStopColor, 45); | - | ||||||||||||||||||||||||||||||||||||
| 262 | // gradient.setColorAt(0.5, midColor1); | - | ||||||||||||||||||||||||||||||||||||
| 263 | // gradient.setColorAt(0.501, midColor2); | - | ||||||||||||||||||||||||||||||||||||
| 264 | } never executed: end of block | 0 | ||||||||||||||||||||||||||||||||||||
| 265 | return gradient; never executed: return gradient; | 0 | ||||||||||||||||||||||||||||||||||||
| 266 | } | - | ||||||||||||||||||||||||||||||||||||
| 267 | - | |||||||||||||||||||||||||||||||||||||
| 268 | - | |||||||||||||||||||||||||||||||||||||
| 269 | static void qt_fusion_draw_mdibutton(QPainter *painter, const QStyleOptionTitleBar *option, const QRect &tmp, bool hover, bool sunken) | - | ||||||||||||||||||||||||||||||||||||
| 270 | { | - | ||||||||||||||||||||||||||||||||||||
| 271 | QColor dark; | - | ||||||||||||||||||||||||||||||||||||
| 272 | dark.setHsv(option->palette.button().color().hue(), | - | ||||||||||||||||||||||||||||||||||||
| 273 | qMin(255, (int)(option->palette.button().color().saturation())), | - | ||||||||||||||||||||||||||||||||||||
| 274 | qMin(255, (int)(option->palette.button().color().value()*0.7))); | - | ||||||||||||||||||||||||||||||||||||
| 275 | - | |||||||||||||||||||||||||||||||||||||
| 276 | QColor highlight = option->palette.highlight().color(); | - | ||||||||||||||||||||||||||||||||||||
| 277 | - | |||||||||||||||||||||||||||||||||||||
| 278 | bool active = (option->titleBarState & QStyle::State_Active); | - | ||||||||||||||||||||||||||||||||||||
| 279 | QColor titleBarHighlight(255, 255, 255, 60); | - | ||||||||||||||||||||||||||||||||||||
| 280 | - | |||||||||||||||||||||||||||||||||||||
| 281 | if (sunken)
| 0 | ||||||||||||||||||||||||||||||||||||
| 282 | painter->fillRect(tmp.adjusted(1, 1, -1, -1), option->palette.highlight().color().darker(120)); never executed: painter->fillRect(tmp.adjusted(1, 1, -1, -1), option->palette.highlight().color().darker(120)); | 0 | ||||||||||||||||||||||||||||||||||||
| 283 | else if (hover)
| 0 | ||||||||||||||||||||||||||||||||||||
| 284 | painter->fillRect(tmp.adjusted(1, 1, -1, -1), QColor(255, 255, 255, 20)); never executed: painter->fillRect(tmp.adjusted(1, 1, -1, -1), QColor(255, 255, 255, 20)); | 0 | ||||||||||||||||||||||||||||||||||||
| 285 | - | |||||||||||||||||||||||||||||||||||||
| 286 | QColor mdiButtonGradientStartColor; | - | ||||||||||||||||||||||||||||||||||||
| 287 | QColor mdiButtonGradientStopColor; | - | ||||||||||||||||||||||||||||||||||||
| 288 | - | |||||||||||||||||||||||||||||||||||||
| 289 | mdiButtonGradientStartColor = QColor(0, 0, 0, 40); | - | ||||||||||||||||||||||||||||||||||||
| 290 | mdiButtonGradientStopColor = QColor(255, 255, 255, 60); | - | ||||||||||||||||||||||||||||||||||||
| 291 | - | |||||||||||||||||||||||||||||||||||||
| 292 | if (sunken)
| 0 | ||||||||||||||||||||||||||||||||||||
| 293 | titleBarHighlight = highlight.darker(130); never executed: titleBarHighlight = highlight.darker(130); | 0 | ||||||||||||||||||||||||||||||||||||
| 294 | - | |||||||||||||||||||||||||||||||||||||
| 295 | QLinearGradient gradient(tmp.center().x(), tmp.top(), tmp.center().x(), tmp.bottom()); | - | ||||||||||||||||||||||||||||||||||||
| 296 | gradient.setColorAt(0, mdiButtonGradientStartColor); | - | ||||||||||||||||||||||||||||||||||||
| 297 | gradient.setColorAt(1, mdiButtonGradientStopColor); | - | ||||||||||||||||||||||||||||||||||||
| 298 | QColor mdiButtonBorderColor(active ? option->palette.highlight().color().darker(180): dark.darker(110)); | - | ||||||||||||||||||||||||||||||||||||
| 299 | - | |||||||||||||||||||||||||||||||||||||
| 300 | painter->setPen(QPen(mdiButtonBorderColor)); | - | ||||||||||||||||||||||||||||||||||||
| 301 | const QLine lines[4] = { | - | ||||||||||||||||||||||||||||||||||||
| 302 | QLine(tmp.left() + 2, tmp.top(), tmp.right() - 2, tmp.top()), | - | ||||||||||||||||||||||||||||||||||||
| 303 | QLine(tmp.left() + 2, tmp.bottom(), tmp.right() - 2, tmp.bottom()), | - | ||||||||||||||||||||||||||||||||||||
| 304 | QLine(tmp.left(), tmp.top() + 2, tmp.left(), tmp.bottom() - 2), | - | ||||||||||||||||||||||||||||||||||||
| 305 | QLine(tmp.right(), tmp.top() + 2, tmp.right(), tmp.bottom() - 2) | - | ||||||||||||||||||||||||||||||||||||
| 306 | }; | - | ||||||||||||||||||||||||||||||||||||
| 307 | painter->drawLines(lines, 4); | - | ||||||||||||||||||||||||||||||||||||
| 308 | const QPoint points[4] = { | - | ||||||||||||||||||||||||||||||||||||
| 309 | QPoint(tmp.left() + 1, tmp.top() + 1), | - | ||||||||||||||||||||||||||||||||||||
| 310 | QPoint(tmp.right() - 1, tmp.top() + 1), | - | ||||||||||||||||||||||||||||||||||||
| 311 | QPoint(tmp.left() + 1, tmp.bottom() - 1), | - | ||||||||||||||||||||||||||||||||||||
| 312 | QPoint(tmp.right() - 1, tmp.bottom() - 1) | - | ||||||||||||||||||||||||||||||||||||
| 313 | }; | - | ||||||||||||||||||||||||||||||||||||
| 314 | painter->drawPoints(points, 4); | - | ||||||||||||||||||||||||||||||||||||
| 315 | - | |||||||||||||||||||||||||||||||||||||
| 316 | painter->setPen(titleBarHighlight); | - | ||||||||||||||||||||||||||||||||||||
| 317 | painter->drawLine(tmp.left() + 2, tmp.top() + 1, tmp.right() - 2, tmp.top() + 1); | - | ||||||||||||||||||||||||||||||||||||
| 318 | painter->drawLine(tmp.left() + 1, tmp.top() + 2, tmp.left() + 1, tmp.bottom() - 2); | - | ||||||||||||||||||||||||||||||||||||
| 319 | - | |||||||||||||||||||||||||||||||||||||
| 320 | painter->setPen(QPen(gradient, 1)); | - | ||||||||||||||||||||||||||||||||||||
| 321 | painter->drawLine(tmp.right() + 1, tmp.top() + 2, tmp.right() + 1, tmp.bottom() - 2); | - | ||||||||||||||||||||||||||||||||||||
| 322 | painter->drawPoint(tmp.right() , tmp.top() + 1); | - | ||||||||||||||||||||||||||||||||||||
| 323 | - | |||||||||||||||||||||||||||||||||||||
| 324 | painter->drawLine(tmp.left() + 2, tmp.bottom() + 1, tmp.right() - 2, tmp.bottom() + 1); | - | ||||||||||||||||||||||||||||||||||||
| 325 | painter->drawPoint(tmp.left() + 1, tmp.bottom()); | - | ||||||||||||||||||||||||||||||||||||
| 326 | painter->drawPoint(tmp.right() - 1, tmp.bottom()); | - | ||||||||||||||||||||||||||||||||||||
| 327 | painter->drawPoint(tmp.right() , tmp.bottom() - 1); | - | ||||||||||||||||||||||||||||||||||||
| 328 | } never executed: end of block | 0 | ||||||||||||||||||||||||||||||||||||
| 329 | - | |||||||||||||||||||||||||||||||||||||
| 330 | /* | - | ||||||||||||||||||||||||||||||||||||
| 331 | \internal | - | ||||||||||||||||||||||||||||||||||||
| 332 | */ | - | ||||||||||||||||||||||||||||||||||||
| 333 | QFusionStylePrivate::QFusionStylePrivate() | - | ||||||||||||||||||||||||||||||||||||
| 334 | { | - | ||||||||||||||||||||||||||||||||||||
| 335 | animationFps = 60; | - | ||||||||||||||||||||||||||||||||||||
| 336 | } never executed: end of block | 0 | ||||||||||||||||||||||||||||||||||||
| 337 | - | |||||||||||||||||||||||||||||||||||||
| 338 | /*! | - | ||||||||||||||||||||||||||||||||||||
| 339 | \class QFusionStyle | - | ||||||||||||||||||||||||||||||||||||
| 340 | \brief The QFusionStyle class provides a custom widget style | - | ||||||||||||||||||||||||||||||||||||
| 341 | - | |||||||||||||||||||||||||||||||||||||
| 342 | \inmodule QtWidgets | - | ||||||||||||||||||||||||||||||||||||
| 343 | \internal | - | ||||||||||||||||||||||||||||||||||||
| 344 | - | |||||||||||||||||||||||||||||||||||||
| 345 | The Fusion style provides a custom look and feel that is not | - | ||||||||||||||||||||||||||||||||||||
| 346 | tied to a particular platform. | - | ||||||||||||||||||||||||||||||||||||
| 347 | //{Fusion Style Widget Gallery} | - | ||||||||||||||||||||||||||||||||||||
| 348 | \sa QWindowsStyle, QWindowsVistaStyle, QMacStyle, QCommonStyle | - | ||||||||||||||||||||||||||||||||||||
| 349 | */ | - | ||||||||||||||||||||||||||||||||||||
| 350 | - | |||||||||||||||||||||||||||||||||||||
| 351 | /*! | - | ||||||||||||||||||||||||||||||||||||
| 352 | Constructs a QFusionStyle object. | - | ||||||||||||||||||||||||||||||||||||
| 353 | */ | - | ||||||||||||||||||||||||||||||||||||
| 354 | QFusionStyle::QFusionStyle() : QCommonStyle(*new QFusionStylePrivate) | - | ||||||||||||||||||||||||||||||||||||
| 355 | { | - | ||||||||||||||||||||||||||||||||||||
| 356 | setObjectName(QLatin1String("Fusion")); | - | ||||||||||||||||||||||||||||||||||||
| 357 | } never executed: end of block | 0 | ||||||||||||||||||||||||||||||||||||
| 358 | - | |||||||||||||||||||||||||||||||||||||
| 359 | /*! | - | ||||||||||||||||||||||||||||||||||||
| 360 | \internal | - | ||||||||||||||||||||||||||||||||||||
| 361 | - | |||||||||||||||||||||||||||||||||||||
| 362 | Constructs a QFusionStyle object. | - | ||||||||||||||||||||||||||||||||||||
| 363 | */ | - | ||||||||||||||||||||||||||||||||||||
| 364 | QFusionStyle::QFusionStyle(QFusionStylePrivate &dd) : QCommonStyle(dd) | - | ||||||||||||||||||||||||||||||||||||
| 365 | { | - | ||||||||||||||||||||||||||||||||||||
| 366 | } never executed: end of block | 0 | ||||||||||||||||||||||||||||||||||||
| 367 | - | |||||||||||||||||||||||||||||||||||||
| 368 | /*! | - | ||||||||||||||||||||||||||||||||||||
| 369 | Destroys the QFusionStyle object. | - | ||||||||||||||||||||||||||||||||||||
| 370 | */ | - | ||||||||||||||||||||||||||||||||||||
| 371 | QFusionStyle::~QFusionStyle() | - | ||||||||||||||||||||||||||||||||||||
| 372 | { | - | ||||||||||||||||||||||||||||||||||||
| 373 | } | - | ||||||||||||||||||||||||||||||||||||
| 374 | - | |||||||||||||||||||||||||||||||||||||
| 375 | /*! | - | ||||||||||||||||||||||||||||||||||||
| 376 | \fn void QFusionStyle::drawItemText(QPainter *painter, const QRect &rectangle, int alignment, const QPalette &palette, | - | ||||||||||||||||||||||||||||||||||||
| 377 | bool enabled, const QString& text, QPalette::ColorRole textRole) const | - | ||||||||||||||||||||||||||||||||||||
| 378 | - | |||||||||||||||||||||||||||||||||||||
| 379 | Draws the given \a text in the specified \a rectangle using the | - | ||||||||||||||||||||||||||||||||||||
| 380 | provided \a painter and \a palette. | - | ||||||||||||||||||||||||||||||||||||
| 381 | - | |||||||||||||||||||||||||||||||||||||
| 382 | Text is drawn using the painter's pen. If an explicit \a textRole | - | ||||||||||||||||||||||||||||||||||||
| 383 | is specified, then the text is drawn using the \a palette's color | - | ||||||||||||||||||||||||||||||||||||
| 384 | for the specified role. The \a enabled value indicates whether or | - | ||||||||||||||||||||||||||||||||||||
| 385 | not the item is enabled; when reimplementing, this value should | - | ||||||||||||||||||||||||||||||||||||
| 386 | influence how the item is drawn. | - | ||||||||||||||||||||||||||||||||||||
| 387 | - | |||||||||||||||||||||||||||||||||||||
| 388 | The text is aligned and wrapped according to the specified \a | - | ||||||||||||||||||||||||||||||||||||
| 389 | alignment. | - | ||||||||||||||||||||||||||||||||||||
| 390 | - | |||||||||||||||||||||||||||||||||||||
| 391 | \sa Qt::Alignment | - | ||||||||||||||||||||||||||||||||||||
| 392 | */ | - | ||||||||||||||||||||||||||||||||||||
| 393 | void QFusionStyle::drawItemText(QPainter *painter, const QRect &rect, int alignment, const QPalette &pal, | - | ||||||||||||||||||||||||||||||||||||
| 394 | bool enabled, const QString& text, QPalette::ColorRole textRole) const | - | ||||||||||||||||||||||||||||||||||||
| 395 | { | - | ||||||||||||||||||||||||||||||||||||
| 396 | if (text.isEmpty())
| 0 | ||||||||||||||||||||||||||||||||||||
| 397 | return; never executed: return; | 0 | ||||||||||||||||||||||||||||||||||||
| 398 | - | |||||||||||||||||||||||||||||||||||||
| 399 | QPen savedPen = painter->pen(); | - | ||||||||||||||||||||||||||||||||||||
| 400 | if (textRole != QPalette::NoRole) {
| 0 | ||||||||||||||||||||||||||||||||||||
| 401 | painter->setPen(QPen(pal.brush(textRole), savedPen.widthF())); | - | ||||||||||||||||||||||||||||||||||||
| 402 | } never executed: end of block | 0 | ||||||||||||||||||||||||||||||||||||
| 403 | if (!enabled) {
| 0 | ||||||||||||||||||||||||||||||||||||
| 404 | QPen pen = painter->pen(); | - | ||||||||||||||||||||||||||||||||||||
| 405 | painter->setPen(pen); | - | ||||||||||||||||||||||||||||||||||||
| 406 | } never executed: end of block | 0 | ||||||||||||||||||||||||||||||||||||
| 407 | painter->drawText(rect, alignment, text); | - | ||||||||||||||||||||||||||||||||||||
| 408 | painter->setPen(savedPen); | - | ||||||||||||||||||||||||||||||||||||
| 409 | } never executed: end of block | 0 | ||||||||||||||||||||||||||||||||||||
| 410 | - | |||||||||||||||||||||||||||||||||||||
| 411 | - | |||||||||||||||||||||||||||||||||||||
| 412 | /*! | - | ||||||||||||||||||||||||||||||||||||
| 413 | \reimp | - | ||||||||||||||||||||||||||||||||||||
| 414 | */ | - | ||||||||||||||||||||||||||||||||||||
| 415 | void QFusionStyle::drawPrimitive(PrimitiveElement elem, | - | ||||||||||||||||||||||||||||||||||||
| 416 | const QStyleOption *option, | - | ||||||||||||||||||||||||||||||||||||
| 417 | QPainter *painter, const QWidget *widget) const | - | ||||||||||||||||||||||||||||||||||||
| 418 | { | - | ||||||||||||||||||||||||||||||||||||
| 419 | Q_ASSERT(option); | - | ||||||||||||||||||||||||||||||||||||
| 420 | Q_D (const QFusionStyle); | - | ||||||||||||||||||||||||||||||||||||
| 421 | - | |||||||||||||||||||||||||||||||||||||
| 422 | QRect rect = option->rect; | - | ||||||||||||||||||||||||||||||||||||
| 423 | int state = option->state; | - | ||||||||||||||||||||||||||||||||||||
| 424 | - | |||||||||||||||||||||||||||||||||||||
| 425 | QColor outline = d->outline(option->palette); | - | ||||||||||||||||||||||||||||||||||||
| 426 | QColor highlightedOutline = d->highlightedOutline(option->palette); | - | ||||||||||||||||||||||||||||||||||||
| 427 | - | |||||||||||||||||||||||||||||||||||||
| 428 | QColor tabFrameColor = d->tabFrameColor(option->palette); | - | ||||||||||||||||||||||||||||||||||||
| 429 | - | |||||||||||||||||||||||||||||||||||||
| 430 | switch (elem) { | - | ||||||||||||||||||||||||||||||||||||
| 431 | - | |||||||||||||||||||||||||||||||||||||
| 432 | // No frame drawn | - | ||||||||||||||||||||||||||||||||||||
| 433 | case PE_FrameGroupBox: never executed: case PE_FrameGroupBox: | 0 | ||||||||||||||||||||||||||||||||||||
| 434 | { | - | ||||||||||||||||||||||||||||||||||||
| 435 | QPixmap pixmap(QLatin1String(":/qt-project.org/styles/commonstyle/images/fusion_groupbox.png")); | - | ||||||||||||||||||||||||||||||||||||
| 436 | int topMargin = qMax(pixelMetric(PM_ExclusiveIndicatorHeight), option->fontMetrics.height()) + groupBoxTopMargin; | - | ||||||||||||||||||||||||||||||||||||
| 437 | QRect frame = option->rect.adjusted(0, topMargin, 0, 0); | - | ||||||||||||||||||||||||||||||||||||
| 438 | qDrawBorderPixmap(painter, frame, QMargins(6, 6, 6, 6), pixmap); | - | ||||||||||||||||||||||||||||||||||||
| 439 | break; never executed: break; | 0 | ||||||||||||||||||||||||||||||||||||
| 440 | } | - | ||||||||||||||||||||||||||||||||||||
| 441 | case PE_IndicatorBranch: { never executed: case PE_IndicatorBranch: | 0 | ||||||||||||||||||||||||||||||||||||
| 442 | if (!(option->state & State_Children))
| 0 | ||||||||||||||||||||||||||||||||||||
| 443 | break; never executed: break; | 0 | ||||||||||||||||||||||||||||||||||||
| 444 | if (option->state & State_Open)
| 0 | ||||||||||||||||||||||||||||||||||||
| 445 | drawPrimitive(PE_IndicatorArrowDown, option, painter, widget); never executed: drawPrimitive(PE_IndicatorArrowDown, option, painter, widget); | 0 | ||||||||||||||||||||||||||||||||||||
| 446 | else | - | ||||||||||||||||||||||||||||||||||||
| 447 | drawPrimitive(PE_IndicatorArrowRight, option, painter, widget); never executed: drawPrimitive(PE_IndicatorArrowRight, option, painter, widget); | 0 | ||||||||||||||||||||||||||||||||||||
| 448 | break; never executed: break; | 0 | ||||||||||||||||||||||||||||||||||||
| 449 | } | - | ||||||||||||||||||||||||||||||||||||
| 450 | case PE_FrameTabBarBase: never executed: case PE_FrameTabBarBase: | 0 | ||||||||||||||||||||||||||||||||||||
| 451 | if (const QStyleOptionTabBarBase *tbb
| 0 | ||||||||||||||||||||||||||||||||||||
| 452 | = qstyleoption_cast<const QStyleOptionTabBarBase *>(option)) {
| 0 | ||||||||||||||||||||||||||||||||||||
| 453 | painter->save(); | - | ||||||||||||||||||||||||||||||||||||
| 454 | painter->setPen(QPen(outline.lighter(110))); | - | ||||||||||||||||||||||||||||||||||||
| 455 | switch (tbb->shape) { | - | ||||||||||||||||||||||||||||||||||||
| 456 | case QTabBar::RoundedNorth: { never executed: case QTabBar::RoundedNorth: | 0 | ||||||||||||||||||||||||||||||||||||
| 457 | QRegion region(tbb->rect); | - | ||||||||||||||||||||||||||||||||||||
| 458 | region -= tbb->selectedTabRect; | - | ||||||||||||||||||||||||||||||||||||
| 459 | painter->drawLine(tbb->rect.topLeft(), tbb->rect.topRight()); | - | ||||||||||||||||||||||||||||||||||||
| 460 | painter->setClipRegion(region); | - | ||||||||||||||||||||||||||||||||||||
| 461 | painter->setPen(option->palette.light().color()); | - | ||||||||||||||||||||||||||||||||||||
| 462 | painter->drawLine(tbb->rect.topLeft() + QPoint(0, 1), tbb->rect.topRight() + QPoint(0, 1)); | - | ||||||||||||||||||||||||||||||||||||
| 463 | } | - | ||||||||||||||||||||||||||||||||||||
| 464 | break; never executed: break; | 0 | ||||||||||||||||||||||||||||||||||||
| 465 | case QTabBar::RoundedWest: never executed: case QTabBar::RoundedWest: | 0 | ||||||||||||||||||||||||||||||||||||
| 466 | painter->drawLine(tbb->rect.left(), tbb->rect.top(), tbb->rect.left(), tbb->rect.bottom()); | - | ||||||||||||||||||||||||||||||||||||
| 467 | break; never executed: break; | 0 | ||||||||||||||||||||||||||||||||||||
| 468 | case QTabBar::RoundedSouth: never executed: case QTabBar::RoundedSouth: | 0 | ||||||||||||||||||||||||||||||||||||
| 469 | painter->drawLine(tbb->rect.left(), tbb->rect.bottom(), | - | ||||||||||||||||||||||||||||||||||||
| 470 | tbb->rect.right(), tbb->rect.bottom()); | - | ||||||||||||||||||||||||||||||||||||
| 471 | break; never executed: break; | 0 | ||||||||||||||||||||||||||||||||||||
| 472 | case QTabBar::RoundedEast: never executed: case QTabBar::RoundedEast: | 0 | ||||||||||||||||||||||||||||||||||||
| 473 | painter->drawLine(tbb->rect.topRight(), tbb->rect.bottomRight()); | - | ||||||||||||||||||||||||||||||||||||
| 474 | break; never executed: break; | 0 | ||||||||||||||||||||||||||||||||||||
| 475 | case QTabBar::TriangularNorth: never executed: case QTabBar::TriangularNorth: | 0 | ||||||||||||||||||||||||||||||||||||
| 476 | case QTabBar::TriangularEast: never executed: case QTabBar::TriangularEast: | 0 | ||||||||||||||||||||||||||||||||||||
| 477 | case QTabBar::TriangularWest: never executed: case QTabBar::TriangularWest: | 0 | ||||||||||||||||||||||||||||||||||||
| 478 | case QTabBar::TriangularSouth: never executed: case QTabBar::TriangularSouth: | 0 | ||||||||||||||||||||||||||||||||||||
| 479 | painter->restore(); | - | ||||||||||||||||||||||||||||||||||||
| 480 | QCommonStyle::drawPrimitive(elem, option, painter, widget); | - | ||||||||||||||||||||||||||||||||||||
| 481 | return; never executed: return; | 0 | ||||||||||||||||||||||||||||||||||||
| 482 | } | - | ||||||||||||||||||||||||||||||||||||
| 483 | painter->restore(); | - | ||||||||||||||||||||||||||||||||||||
| 484 | } never executed: end of block | 0 | ||||||||||||||||||||||||||||||||||||
| 485 | return; never executed: return; | 0 | ||||||||||||||||||||||||||||||||||||
| 486 | case PE_PanelScrollAreaCorner: { never executed: case PE_PanelScrollAreaCorner: | 0 | ||||||||||||||||||||||||||||||||||||
| 487 | painter->save(); | - | ||||||||||||||||||||||||||||||||||||
| 488 | QColor alphaOutline = outline; | - | ||||||||||||||||||||||||||||||||||||
| 489 | alphaOutline.setAlpha(180); | - | ||||||||||||||||||||||||||||||||||||
| 490 | painter->setPen(alphaOutline); | - | ||||||||||||||||||||||||||||||||||||
| 491 | painter->setBrush(option->palette.brush(QPalette::Window)); | - | ||||||||||||||||||||||||||||||||||||
| 492 | painter->drawRect(option->rect); | - | ||||||||||||||||||||||||||||||||||||
| 493 | painter->restore(); | - | ||||||||||||||||||||||||||||||||||||
| 494 | } break; never executed: break; | 0 | ||||||||||||||||||||||||||||||||||||
| 495 | case PE_IndicatorArrowUp: never executed: case PE_IndicatorArrowUp: | 0 | ||||||||||||||||||||||||||||||||||||
| 496 | case PE_IndicatorArrowDown: never executed: case PE_IndicatorArrowDown: | 0 | ||||||||||||||||||||||||||||||||||||
| 497 | case PE_IndicatorArrowRight: never executed: case PE_IndicatorArrowRight: | 0 | ||||||||||||||||||||||||||||||||||||
| 498 | case PE_IndicatorArrowLeft: never executed: case PE_IndicatorArrowLeft: | 0 | ||||||||||||||||||||||||||||||||||||
| 499 | { | - | ||||||||||||||||||||||||||||||||||||
| 500 | if (option->rect.width() <= 1 || option->rect.height() <= 1)
| 0 | ||||||||||||||||||||||||||||||||||||
| 501 | break; never executed: break; | 0 | ||||||||||||||||||||||||||||||||||||
| 502 | QColor arrowColor = option->palette.foreground().color(); | - | ||||||||||||||||||||||||||||||||||||
| 503 | QPixmap arrow; | - | ||||||||||||||||||||||||||||||||||||
| 504 | int rotation = 0; | - | ||||||||||||||||||||||||||||||||||||
| 505 | switch (elem) { | - | ||||||||||||||||||||||||||||||||||||
| 506 | case PE_IndicatorArrowDown: never executed: case PE_IndicatorArrowDown: | 0 | ||||||||||||||||||||||||||||||||||||
| 507 | rotation = 180; | - | ||||||||||||||||||||||||||||||||||||
| 508 | break; never executed: break; | 0 | ||||||||||||||||||||||||||||||||||||
| 509 | case PE_IndicatorArrowRight: never executed: case PE_IndicatorArrowRight: | 0 | ||||||||||||||||||||||||||||||||||||
| 510 | rotation = 90; | - | ||||||||||||||||||||||||||||||||||||
| 511 | break; never executed: break; | 0 | ||||||||||||||||||||||||||||||||||||
| 512 | case PE_IndicatorArrowLeft: never executed: case PE_IndicatorArrowLeft: | 0 | ||||||||||||||||||||||||||||||||||||
| 513 | rotation = -90; | - | ||||||||||||||||||||||||||||||||||||
| 514 | break; never executed: break; | 0 | ||||||||||||||||||||||||||||||||||||
| 515 | default: never executed: default: | 0 | ||||||||||||||||||||||||||||||||||||
| 516 | break; never executed: break; | 0 | ||||||||||||||||||||||||||||||||||||
| 517 | } | - | ||||||||||||||||||||||||||||||||||||
| 518 | arrow = colorizedImage(QLatin1String(":/qt-project.org/styles/commonstyle/images/fusion_arrow.png"), arrowColor, rotation); | - | ||||||||||||||||||||||||||||||||||||
| 519 | if (arrow.isNull())
| 0 | ||||||||||||||||||||||||||||||||||||
| 520 | break; never executed: break; | 0 | ||||||||||||||||||||||||||||||||||||
| 521 | - | |||||||||||||||||||||||||||||||||||||
| 522 | QRect rect = option->rect; | - | ||||||||||||||||||||||||||||||||||||
| 523 | QRect arrowRect; | - | ||||||||||||||||||||||||||||||||||||
| 524 | int imageMax = qMin(arrow.height(), arrow.width()); | - | ||||||||||||||||||||||||||||||||||||
| 525 | int rectMax = qMin(rect.height(), rect.width()); | - | ||||||||||||||||||||||||||||||||||||
| 526 | int size = qMin(imageMax, rectMax); | - | ||||||||||||||||||||||||||||||||||||
| 527 | - | |||||||||||||||||||||||||||||||||||||
| 528 | arrowRect.setWidth(size); | - | ||||||||||||||||||||||||||||||||||||
| 529 | arrowRect.setHeight(size); | - | ||||||||||||||||||||||||||||||||||||
| 530 | if (arrow.width() > arrow.height())
| 0 | ||||||||||||||||||||||||||||||||||||
| 531 | arrowRect.setHeight(arrow.height() * size / arrow.width()); never executed: arrowRect.setHeight(arrow.height() * size / arrow.width()); | 0 | ||||||||||||||||||||||||||||||||||||
| 532 | else | - | ||||||||||||||||||||||||||||||||||||
| 533 | arrowRect.setWidth(arrow.width() * size / arrow.height()); never executed: arrowRect.setWidth(arrow.width() * size / arrow.height()); | 0 | ||||||||||||||||||||||||||||||||||||
| 534 | - | |||||||||||||||||||||||||||||||||||||
| 535 | arrowRect.moveTopLeft(rect.center() - arrowRect.center()); | - | ||||||||||||||||||||||||||||||||||||
| 536 | painter->save(); | - | ||||||||||||||||||||||||||||||||||||
| 537 | painter->setRenderHint(QPainter::SmoothPixmapTransform); | - | ||||||||||||||||||||||||||||||||||||
| 538 | painter->drawPixmap(arrowRect, arrow); | - | ||||||||||||||||||||||||||||||||||||
| 539 | painter->restore(); | - | ||||||||||||||||||||||||||||||||||||
| 540 | } | - | ||||||||||||||||||||||||||||||||||||
| 541 | break; never executed: break; | 0 | ||||||||||||||||||||||||||||||||||||
| 542 | case PE_IndicatorViewItemCheck: never executed: case PE_IndicatorViewItemCheck: | 0 | ||||||||||||||||||||||||||||||||||||
| 543 | { | - | ||||||||||||||||||||||||||||||||||||
| 544 | QStyleOptionButton button; | - | ||||||||||||||||||||||||||||||||||||
| 545 | button.QStyleOption::operator=(*option); | - | ||||||||||||||||||||||||||||||||||||
| 546 | button.state &= ~State_MouseOver; | - | ||||||||||||||||||||||||||||||||||||
| 547 | proxy()->drawPrimitive(PE_IndicatorCheckBox, &button, painter, widget); | - | ||||||||||||||||||||||||||||||||||||
| 548 | } | - | ||||||||||||||||||||||||||||||||||||
| 549 | return; never executed: return; | 0 | ||||||||||||||||||||||||||||||||||||
| 550 | case PE_IndicatorHeaderArrow: never executed: case PE_IndicatorHeaderArrow: | 0 | ||||||||||||||||||||||||||||||||||||
| 551 | if (const QStyleOptionHeader *header = qstyleoption_cast<const QStyleOptionHeader *>(option)) {
| 0 | ||||||||||||||||||||||||||||||||||||
| 552 | QRect r = header->rect; | - | ||||||||||||||||||||||||||||||||||||
| 553 | QPixmap arrow; | - | ||||||||||||||||||||||||||||||||||||
| 554 | QColor arrowColor = header->palette.foreground().color(); | - | ||||||||||||||||||||||||||||||||||||
| 555 | QPoint offset = QPoint(0, -1); | - | ||||||||||||||||||||||||||||||||||||
| 556 | - | |||||||||||||||||||||||||||||||||||||
| 557 | #if defined(Q_OS_LINUX) | - | ||||||||||||||||||||||||||||||||||||
| 558 | if (header->sortIndicator & QStyleOptionHeader::SortUp) {
| 0 | ||||||||||||||||||||||||||||||||||||
| 559 | arrow = colorizedImage(QLatin1String(":/qt-project.org/styles/commonstyle/images/fusion_arrow.png"), arrowColor); | - | ||||||||||||||||||||||||||||||||||||
| 560 | } else if (header->sortIndicator & QStyleOptionHeader::SortDown) { never executed: end of block
| 0 | ||||||||||||||||||||||||||||||||||||
| 561 | arrow = colorizedImage(QLatin1String(":/qt-project.org/styles/commonstyle/images/fusion_arrow.png"), arrowColor, 180); | - | ||||||||||||||||||||||||||||||||||||
| 562 | } never executed: end of block | 0 | ||||||||||||||||||||||||||||||||||||
| 563 | #else | - | ||||||||||||||||||||||||||||||||||||
| 564 | if (header->sortIndicator & QStyleOptionHeader::SortUp) { | - | ||||||||||||||||||||||||||||||||||||
| 565 | arrow = colorizedImage(QLatin1String(":/qt-project.org/styles/commonstyle/images/fusion_arrow.png"), arrowColor, 180); | - | ||||||||||||||||||||||||||||||||||||
| 566 | } else if (header->sortIndicator & QStyleOptionHeader::SortDown) { | - | ||||||||||||||||||||||||||||||||||||
| 567 | arrow = colorizedImage(QLatin1String(":/qt-project.org/styles/commonstyle/images/fusion_arrow.png"), arrowColor); | - | ||||||||||||||||||||||||||||||||||||
| 568 | } | - | ||||||||||||||||||||||||||||||||||||
| 569 | #endif | - | ||||||||||||||||||||||||||||||||||||
| 570 | - | |||||||||||||||||||||||||||||||||||||
| 571 | if (!arrow.isNull()) {
| 0 | ||||||||||||||||||||||||||||||||||||
| 572 | r.setSize(QSize(arrow.width()/2, arrow.height()/2)); | - | ||||||||||||||||||||||||||||||||||||
| 573 | r.moveCenter(header->rect.center()); | - | ||||||||||||||||||||||||||||||||||||
| 574 | painter->drawPixmap(r.translated(offset), arrow); | - | ||||||||||||||||||||||||||||||||||||
| 575 | } never executed: end of block | 0 | ||||||||||||||||||||||||||||||||||||
| 576 | } never executed: end of block | 0 | ||||||||||||||||||||||||||||||||||||
| 577 | break; never executed: break; | 0 | ||||||||||||||||||||||||||||||||||||
| 578 | case PE_IndicatorButtonDropDown: never executed: case PE_IndicatorButtonDropDown: | 0 | ||||||||||||||||||||||||||||||||||||
| 579 | proxy()->drawPrimitive(PE_PanelButtonCommand, option, painter, widget); | - | ||||||||||||||||||||||||||||||||||||
| 580 | break; never executed: break; | 0 | ||||||||||||||||||||||||||||||||||||
| 581 | - | |||||||||||||||||||||||||||||||||||||
| 582 | case PE_IndicatorToolBarSeparator: never executed: case PE_IndicatorToolBarSeparator: | 0 | ||||||||||||||||||||||||||||||||||||
| 583 | { | - | ||||||||||||||||||||||||||||||||||||
| 584 | QRect rect = option->rect; | - | ||||||||||||||||||||||||||||||||||||
| 585 | const int margin = 6; | - | ||||||||||||||||||||||||||||||||||||
| 586 | if (option->state & State_Horizontal) {
| 0 | ||||||||||||||||||||||||||||||||||||
| 587 | const int offset = rect.width()/2; | - | ||||||||||||||||||||||||||||||||||||
| 588 | painter->setPen(QPen(option->palette.background().color().darker(110))); | - | ||||||||||||||||||||||||||||||||||||
| 589 | painter->drawLine(rect.bottomLeft().x() + offset, | - | ||||||||||||||||||||||||||||||||||||
| 590 | rect.bottomLeft().y() - margin, | - | ||||||||||||||||||||||||||||||||||||
| 591 | rect.topLeft().x() + offset, | - | ||||||||||||||||||||||||||||||||||||
| 592 | rect.topLeft().y() + margin); | - | ||||||||||||||||||||||||||||||||||||
| 593 | painter->setPen(QPen(option->palette.background().color().lighter(110))); | - | ||||||||||||||||||||||||||||||||||||
| 594 | painter->drawLine(rect.bottomLeft().x() + offset + 1, | - | ||||||||||||||||||||||||||||||||||||
| 595 | rect.bottomLeft().y() - margin, | - | ||||||||||||||||||||||||||||||||||||
| 596 | rect.topLeft().x() + offset + 1, | - | ||||||||||||||||||||||||||||||||||||
| 597 | rect.topLeft().y() + margin); | - | ||||||||||||||||||||||||||||||||||||
| 598 | } else { //Draw vertical separator never executed: end of block | 0 | ||||||||||||||||||||||||||||||||||||
| 599 | const int offset = rect.height()/2; | - | ||||||||||||||||||||||||||||||||||||
| 600 | painter->setPen(QPen(option->palette.background().color().darker(110))); | - | ||||||||||||||||||||||||||||||||||||
| 601 | painter->drawLine(rect.topLeft().x() + margin , | - | ||||||||||||||||||||||||||||||||||||
| 602 | rect.topLeft().y() + offset, | - | ||||||||||||||||||||||||||||||||||||
| 603 | rect.topRight().x() - margin, | - | ||||||||||||||||||||||||||||||||||||
| 604 | rect.topRight().y() + offset); | - | ||||||||||||||||||||||||||||||||||||
| 605 | painter->setPen(QPen(option->palette.background().color().lighter(110))); | - | ||||||||||||||||||||||||||||||||||||
| 606 | painter->drawLine(rect.topLeft().x() + margin , | - | ||||||||||||||||||||||||||||||||||||
| 607 | rect.topLeft().y() + offset + 1, | - | ||||||||||||||||||||||||||||||||||||
| 608 | rect.topRight().x() - margin, | - | ||||||||||||||||||||||||||||||||||||
| 609 | rect.topRight().y() + offset + 1); | - | ||||||||||||||||||||||||||||||||||||
| 610 | } never executed: end of block | 0 | ||||||||||||||||||||||||||||||||||||
| 611 | } | - | ||||||||||||||||||||||||||||||||||||
| 612 | break; never executed: break; | 0 | ||||||||||||||||||||||||||||||||||||
| 613 | case PE_Frame: { never executed: case PE_Frame: | 0 | ||||||||||||||||||||||||||||||||||||
| 614 | if (widget && widget->inherits("QComboBoxPrivateContainer")){
| 0 | ||||||||||||||||||||||||||||||||||||
| 615 | QStyleOption copy = *option; | - | ||||||||||||||||||||||||||||||||||||
| 616 | copy.state |= State_Raised; | - | ||||||||||||||||||||||||||||||||||||
| 617 | proxy()->drawPrimitive(PE_PanelMenu, ©, painter, widget); | - | ||||||||||||||||||||||||||||||||||||
| 618 | break; never executed: break; | 0 | ||||||||||||||||||||||||||||||||||||
| 619 | } | - | ||||||||||||||||||||||||||||||||||||
| 620 | painter->save(); | - | ||||||||||||||||||||||||||||||||||||
| 621 | QPen thePen(outline.lighter(108)); | - | ||||||||||||||||||||||||||||||||||||
| 622 | thePen.setCosmetic(false); | - | ||||||||||||||||||||||||||||||||||||
| 623 | painter->setPen(thePen); | - | ||||||||||||||||||||||||||||||||||||
| 624 | painter->drawRect(option->rect.adjusted(0, 0, -1, -1)); | - | ||||||||||||||||||||||||||||||||||||
| 625 | painter->restore(); } | - | ||||||||||||||||||||||||||||||||||||
| 626 | break; never executed: break; | 0 | ||||||||||||||||||||||||||||||||||||
| 627 | case PE_FrameMenu: never executed: case PE_FrameMenu: | 0 | ||||||||||||||||||||||||||||||||||||
| 628 | painter->save(); | - | ||||||||||||||||||||||||||||||||||||
| 629 | { | - | ||||||||||||||||||||||||||||||||||||
| 630 | painter->setPen(QPen(outline)); | - | ||||||||||||||||||||||||||||||||||||
| 631 | painter->drawRect(option->rect.adjusted(0, 0, -1, -1)); | - | ||||||||||||||||||||||||||||||||||||
| 632 | QColor frameLight = option->palette.background().color().lighter(160); | - | ||||||||||||||||||||||||||||||||||||
| 633 | QColor frameShadow = option->palette.background().color().darker(110); | - | ||||||||||||||||||||||||||||||||||||
| 634 | - | |||||||||||||||||||||||||||||||||||||
| 635 | //paint beveleffect | - | ||||||||||||||||||||||||||||||||||||
| 636 | QRect frame = option->rect.adjusted(1, 1, -1, -1); | - | ||||||||||||||||||||||||||||||||||||
| 637 | painter->setPen(frameLight); | - | ||||||||||||||||||||||||||||||||||||
| 638 | painter->drawLine(frame.topLeft(), frame.bottomLeft()); | - | ||||||||||||||||||||||||||||||||||||
| 639 | painter->drawLine(frame.topLeft(), frame.topRight()); | - | ||||||||||||||||||||||||||||||||||||
| 640 | - | |||||||||||||||||||||||||||||||||||||
| 641 | painter->setPen(frameShadow); | - | ||||||||||||||||||||||||||||||||||||
| 642 | painter->drawLine(frame.topRight(), frame.bottomRight()); | - | ||||||||||||||||||||||||||||||||||||
| 643 | painter->drawLine(frame.bottomLeft(), frame.bottomRight()); | - | ||||||||||||||||||||||||||||||||||||
| 644 | } | - | ||||||||||||||||||||||||||||||||||||
| 645 | painter->restore(); | - | ||||||||||||||||||||||||||||||||||||
| 646 | break; never executed: break; | 0 | ||||||||||||||||||||||||||||||||||||
| 647 | case PE_FrameDockWidget: never executed: case PE_FrameDockWidget: | 0 | ||||||||||||||||||||||||||||||||||||
| 648 | - | |||||||||||||||||||||||||||||||||||||
| 649 | painter->save(); | - | ||||||||||||||||||||||||||||||||||||
| 650 | { | - | ||||||||||||||||||||||||||||||||||||
| 651 | QColor softshadow = option->palette.background().color().darker(120); | - | ||||||||||||||||||||||||||||||||||||
| 652 | - | |||||||||||||||||||||||||||||||||||||
| 653 | QRect rect= option->rect; | - | ||||||||||||||||||||||||||||||||||||
| 654 | painter->setPen(softshadow); | - | ||||||||||||||||||||||||||||||||||||
| 655 | painter->drawRect(option->rect.adjusted(0, 0, -1, -1)); | - | ||||||||||||||||||||||||||||||||||||
| 656 | painter->setPen(QPen(option->palette.light(), 1)); | - | ||||||||||||||||||||||||||||||||||||
| 657 | painter->drawLine(QPoint(rect.left() + 1, rect.top() + 1), QPoint(rect.left() + 1, rect.bottom() - 1)); | - | ||||||||||||||||||||||||||||||||||||
| 658 | painter->setPen(QPen(option->palette.background().color().darker(120))); | - | ||||||||||||||||||||||||||||||||||||
| 659 | painter->drawLine(QPoint(rect.left() + 1, rect.bottom() - 1), QPoint(rect.right() - 2, rect.bottom() - 1)); | - | ||||||||||||||||||||||||||||||||||||
| 660 | painter->drawLine(QPoint(rect.right() - 1, rect.top() + 1), QPoint(rect.right() - 1, rect.bottom() - 1)); | - | ||||||||||||||||||||||||||||||||||||
| 661 | - | |||||||||||||||||||||||||||||||||||||
| 662 | } | - | ||||||||||||||||||||||||||||||||||||
| 663 | painter->restore(); | - | ||||||||||||||||||||||||||||||||||||
| 664 | break; never executed: break; | 0 | ||||||||||||||||||||||||||||||||||||
| 665 | case PE_PanelButtonTool: never executed: case PE_PanelButtonTool: | 0 | ||||||||||||||||||||||||||||||||||||
| 666 | painter->save(); | - | ||||||||||||||||||||||||||||||||||||
| 667 | if ((option->state & State_Enabled || option->state & State_On) || !(option->state & State_AutoRaise)) {
| 0 | ||||||||||||||||||||||||||||||||||||
| 668 | if (widget && widget->inherits("QDockWidgetTitleButton")) {
| 0 | ||||||||||||||||||||||||||||||||||||
| 669 | if (option->state & State_MouseOver)
| 0 | ||||||||||||||||||||||||||||||||||||
| 670 | proxy()->drawPrimitive(PE_PanelButtonCommand, option, painter, widget); never executed: proxy()->drawPrimitive(PE_PanelButtonCommand, option, painter, widget); | 0 | ||||||||||||||||||||||||||||||||||||
| 671 | } else { never executed: end of block | 0 | ||||||||||||||||||||||||||||||||||||
| 672 | proxy()->drawPrimitive(PE_PanelButtonCommand, option, painter, widget); | - | ||||||||||||||||||||||||||||||||||||
| 673 | } never executed: end of block | 0 | ||||||||||||||||||||||||||||||||||||
| 674 | } | - | ||||||||||||||||||||||||||||||||||||
| 675 | painter->restore(); | - | ||||||||||||||||||||||||||||||||||||
| 676 | break; never executed: break; | 0 | ||||||||||||||||||||||||||||||||||||
| 677 | case PE_IndicatorDockWidgetResizeHandle: never executed: case PE_IndicatorDockWidgetResizeHandle: | 0 | ||||||||||||||||||||||||||||||||||||
| 678 | { | - | ||||||||||||||||||||||||||||||||||||
| 679 | QStyleOption dockWidgetHandle = *option; | - | ||||||||||||||||||||||||||||||||||||
| 680 | bool horizontal = option->state & State_Horizontal; | - | ||||||||||||||||||||||||||||||||||||
| 681 | if (horizontal)
| 0 | ||||||||||||||||||||||||||||||||||||
| 682 | dockWidgetHandle.state &= ~State_Horizontal; never executed: dockWidgetHandle.state &= ~State_Horizontal; | 0 | ||||||||||||||||||||||||||||||||||||
| 683 | else | - | ||||||||||||||||||||||||||||||||||||
| 684 | dockWidgetHandle.state |= State_Horizontal; never executed: dockWidgetHandle.state |= State_Horizontal; | 0 | ||||||||||||||||||||||||||||||||||||
| 685 | proxy()->drawControl(CE_Splitter, &dockWidgetHandle, painter, widget); | - | ||||||||||||||||||||||||||||||||||||
| 686 | } | - | ||||||||||||||||||||||||||||||||||||
| 687 | break; never executed: break; | 0 | ||||||||||||||||||||||||||||||||||||
| 688 | case PE_FrameWindow: never executed: case PE_FrameWindow: | 0 | ||||||||||||||||||||||||||||||||||||
| 689 | painter->save(); | - | ||||||||||||||||||||||||||||||||||||
| 690 | { | - | ||||||||||||||||||||||||||||||||||||
| 691 | QRect rect= option->rect; | - | ||||||||||||||||||||||||||||||||||||
| 692 | painter->setPen(QPen(outline.darker(150))); | - | ||||||||||||||||||||||||||||||||||||
| 693 | painter->drawRect(option->rect.adjusted(0, 0, -1, -1)); | - | ||||||||||||||||||||||||||||||||||||
| 694 | painter->setPen(QPen(option->palette.light(), 1)); | - | ||||||||||||||||||||||||||||||||||||
| 695 | painter->drawLine(QPoint(rect.left() + 1, rect.top() + 1), | - | ||||||||||||||||||||||||||||||||||||
| 696 | QPoint(rect.left() + 1, rect.bottom() - 1)); | - | ||||||||||||||||||||||||||||||||||||
| 697 | painter->setPen(QPen(option->palette.background().color().darker(120))); | - | ||||||||||||||||||||||||||||||||||||
| 698 | painter->drawLine(QPoint(rect.left() + 1, rect.bottom() - 1), | - | ||||||||||||||||||||||||||||||||||||
| 699 | QPoint(rect.right() - 2, rect.bottom() - 1)); | - | ||||||||||||||||||||||||||||||||||||
| 700 | painter->drawLine(QPoint(rect.right() - 1, rect.top() + 1), | - | ||||||||||||||||||||||||||||||||||||
| 701 | QPoint(rect.right() - 1, rect.bottom() - 1)); | - | ||||||||||||||||||||||||||||||||||||
| 702 | } | - | ||||||||||||||||||||||||||||||||||||
| 703 | painter->restore(); | - | ||||||||||||||||||||||||||||||||||||
| 704 | break; never executed: break; | 0 | ||||||||||||||||||||||||||||||||||||
| 705 | case PE_FrameLineEdit: never executed: case PE_FrameLineEdit: | 0 | ||||||||||||||||||||||||||||||||||||
| 706 | { | - | ||||||||||||||||||||||||||||||||||||
| 707 | QRect r = rect; | - | ||||||||||||||||||||||||||||||||||||
| 708 | bool hasFocus = option->state & State_HasFocus; | - | ||||||||||||||||||||||||||||||||||||
| 709 | - | |||||||||||||||||||||||||||||||||||||
| 710 | painter->save(); | - | ||||||||||||||||||||||||||||||||||||
| 711 | - | |||||||||||||||||||||||||||||||||||||
| 712 | painter->setRenderHint(QPainter::Antialiasing, true); | - | ||||||||||||||||||||||||||||||||||||
| 713 | // ### highdpi painter bug. | - | ||||||||||||||||||||||||||||||||||||
| 714 | painter->translate(0.5, 0.5); | - | ||||||||||||||||||||||||||||||||||||
| 715 | - | |||||||||||||||||||||||||||||||||||||
| 716 | // Draw Outline | - | ||||||||||||||||||||||||||||||||||||
| 717 | painter->setPen( QPen(hasFocus ? highlightedOutline : outline)); | - | ||||||||||||||||||||||||||||||||||||
| 718 | painter->setBrush(option->palette.base()); | - | ||||||||||||||||||||||||||||||||||||
| 719 | painter->drawRoundedRect(r.adjusted(0, 0, -1, -1), 2, 2); | - | ||||||||||||||||||||||||||||||||||||
| 720 | - | |||||||||||||||||||||||||||||||||||||
| 721 | if (hasFocus) {
| 0 | ||||||||||||||||||||||||||||||||||||
| 722 | QColor softHighlight = highlightedOutline; | - | ||||||||||||||||||||||||||||||||||||
| 723 | softHighlight.setAlpha(40); | - | ||||||||||||||||||||||||||||||||||||
| 724 | painter->setPen(softHighlight); | - | ||||||||||||||||||||||||||||||||||||
| 725 | painter->drawRoundedRect(r.adjusted(1, 1, -2, -2), 1.7, 1.7); | - | ||||||||||||||||||||||||||||||||||||
| 726 | } never executed: end of block | 0 | ||||||||||||||||||||||||||||||||||||
| 727 | // Draw inner shadow | - | ||||||||||||||||||||||||||||||||||||
| 728 | painter->setPen(d->topShadow()); | - | ||||||||||||||||||||||||||||||||||||
| 729 | painter->drawLine(QPoint(r.left() + 2, r.top() + 1), QPoint(r.right() - 2, r.top() + 1)); | - | ||||||||||||||||||||||||||||||||||||
| 730 | - | |||||||||||||||||||||||||||||||||||||
| 731 | painter->restore(); | - | ||||||||||||||||||||||||||||||||||||
| 732 | - | |||||||||||||||||||||||||||||||||||||
| 733 | } | - | ||||||||||||||||||||||||||||||||||||
| 734 | break; never executed: break; | 0 | ||||||||||||||||||||||||||||||||||||
| 735 | case PE_IndicatorCheckBox: never executed: case PE_IndicatorCheckBox: | 0 | ||||||||||||||||||||||||||||||||||||
| 736 | painter->save(); | - | ||||||||||||||||||||||||||||||||||||
| 737 | if (const QStyleOptionButton *checkbox = qstyleoption_cast<const QStyleOptionButton*>(option)) {
| 0 | ||||||||||||||||||||||||||||||||||||
| 738 | painter->setRenderHint(QPainter::Antialiasing, true); | - | ||||||||||||||||||||||||||||||||||||
| 739 | painter->translate(0.5, 0.5); | - | ||||||||||||||||||||||||||||||||||||
| 740 | rect = rect.adjusted(0, 0, -1, -1); | - | ||||||||||||||||||||||||||||||||||||
| 741 | - | |||||||||||||||||||||||||||||||||||||
| 742 | QColor pressedColor = mergedColors(option->palette.base().color(), option->palette.foreground().color(), 85); | - | ||||||||||||||||||||||||||||||||||||
| 743 | painter->setBrush(Qt::NoBrush); | - | ||||||||||||||||||||||||||||||||||||
| 744 | - | |||||||||||||||||||||||||||||||||||||
| 745 | // Gradient fill | - | ||||||||||||||||||||||||||||||||||||
| 746 | QLinearGradient gradient(rect.topLeft(), rect.bottomLeft()); | - | ||||||||||||||||||||||||||||||||||||
| 747 | gradient.setColorAt(0, (state & State_Sunken) ? pressedColor : option->palette.base().color().darker(115)); | - | ||||||||||||||||||||||||||||||||||||
| 748 | gradient.setColorAt(0.15, (state & State_Sunken) ? pressedColor : option->palette.base().color()); | - | ||||||||||||||||||||||||||||||||||||
| 749 | gradient.setColorAt(1, (state & State_Sunken) ? pressedColor : option->palette.base().color()); | - | ||||||||||||||||||||||||||||||||||||
| 750 | - | |||||||||||||||||||||||||||||||||||||
| 751 | painter->setBrush((state & State_Sunken) ? QBrush(pressedColor) : gradient); | - | ||||||||||||||||||||||||||||||||||||
| 752 | painter->setPen(QPen(outline.lighter(110))); | - | ||||||||||||||||||||||||||||||||||||
| 753 | - | |||||||||||||||||||||||||||||||||||||
| 754 | if (option->state & State_HasFocus && option->state & State_KeyboardFocusChange)
| 0 | ||||||||||||||||||||||||||||||||||||
| 755 | painter->setPen(QPen(highlightedOutline)); never executed: painter->setPen(QPen(highlightedOutline)); | 0 | ||||||||||||||||||||||||||||||||||||
| 756 | painter->drawRect(rect); | - | ||||||||||||||||||||||||||||||||||||
| 757 | - | |||||||||||||||||||||||||||||||||||||
| 758 | QColor checkMarkColor = option->palette.text().color().darker(120); | - | ||||||||||||||||||||||||||||||||||||
| 759 | const int checkMarkPadding = QStyleHelper::dpiScaled(3); | - | ||||||||||||||||||||||||||||||||||||
| 760 | - | |||||||||||||||||||||||||||||||||||||
| 761 | if (checkbox->state & State_NoChange) {
| 0 | ||||||||||||||||||||||||||||||||||||
| 762 | gradient = QLinearGradient(rect.topLeft(), rect.bottomLeft()); | - | ||||||||||||||||||||||||||||||||||||
| 763 | checkMarkColor.setAlpha(80); | - | ||||||||||||||||||||||||||||||||||||
| 764 | gradient.setColorAt(0, checkMarkColor); | - | ||||||||||||||||||||||||||||||||||||
| 765 | checkMarkColor.setAlpha(140); | - | ||||||||||||||||||||||||||||||||||||
| 766 | gradient.setColorAt(1, checkMarkColor); | - | ||||||||||||||||||||||||||||||||||||
| 767 | checkMarkColor.setAlpha(180); | - | ||||||||||||||||||||||||||||||||||||
| 768 | painter->setPen(QPen(checkMarkColor, 1)); | - | ||||||||||||||||||||||||||||||||||||
| 769 | painter->setBrush(gradient); | - | ||||||||||||||||||||||||||||||||||||
| 770 | painter->drawRect(rect.adjusted(checkMarkPadding, checkMarkPadding, -checkMarkPadding, -checkMarkPadding)); | - | ||||||||||||||||||||||||||||||||||||
| 771 | - | |||||||||||||||||||||||||||||||||||||
| 772 | } else if (checkbox->state & (State_On)) { never executed: end of block
| 0 | ||||||||||||||||||||||||||||||||||||
| 773 | QPen checkPen = QPen(checkMarkColor, QStyleHelper::dpiScaled(1.8)); | - | ||||||||||||||||||||||||||||||||||||
| 774 | checkMarkColor.setAlpha(210); | - | ||||||||||||||||||||||||||||||||||||
| 775 | painter->translate(-1, 0.5); | - | ||||||||||||||||||||||||||||||||||||
| 776 | painter->setPen(checkPen); | - | ||||||||||||||||||||||||||||||||||||
| 777 | painter->setBrush(Qt::NoBrush); | - | ||||||||||||||||||||||||||||||||||||
| 778 | painter->translate(0.2, 0.0); | - | ||||||||||||||||||||||||||||||||||||
| 779 | - | |||||||||||||||||||||||||||||||||||||
| 780 | // Draw checkmark | - | ||||||||||||||||||||||||||||||||||||
| 781 | QPainterPath path; | - | ||||||||||||||||||||||||||||||||||||
| 782 | path.moveTo(2 + checkMarkPadding, rect.height() / 2.0); | - | ||||||||||||||||||||||||||||||||||||
| 783 | path.lineTo(rect.width() / 2.0, rect.height() - checkMarkPadding); | - | ||||||||||||||||||||||||||||||||||||
| 784 | path.lineTo(rect.width() - checkMarkPadding - 0.5, checkMarkPadding); | - | ||||||||||||||||||||||||||||||||||||
| 785 | painter->drawPath(path.translated(rect.topLeft())); | - | ||||||||||||||||||||||||||||||||||||
| 786 | } never executed: end of block | 0 | ||||||||||||||||||||||||||||||||||||
| 787 | } never executed: end of block | 0 | ||||||||||||||||||||||||||||||||||||
| 788 | painter->restore(); | - | ||||||||||||||||||||||||||||||||||||
| 789 | break; never executed: break; | 0 | ||||||||||||||||||||||||||||||||||||
| 790 | case PE_IndicatorRadioButton: never executed: case PE_IndicatorRadioButton: | 0 | ||||||||||||||||||||||||||||||||||||
| 791 | painter->save(); | - | ||||||||||||||||||||||||||||||||||||
| 792 | { | - | ||||||||||||||||||||||||||||||||||||
| 793 | QColor pressedColor = mergedColors(option->palette.base().color(), option->palette.foreground().color(), 85); | - | ||||||||||||||||||||||||||||||||||||
| 794 | painter->setBrush((state & State_Sunken) ? pressedColor : option->palette.base().color()); | - | ||||||||||||||||||||||||||||||||||||
| 795 | painter->setRenderHint(QPainter::Antialiasing, true); | - | ||||||||||||||||||||||||||||||||||||
| 796 | QPainterPath circle; | - | ||||||||||||||||||||||||||||||||||||
| 797 | const QPointF circleCenter = rect.center() + QPoint(1, 1); | - | ||||||||||||||||||||||||||||||||||||
| 798 | const qreal outlineRadius = (rect.width() + (rect.width() + 1) % 2) / 2.0 - 1; | - | ||||||||||||||||||||||||||||||||||||
| 799 | circle.addEllipse(circleCenter, outlineRadius, outlineRadius); | - | ||||||||||||||||||||||||||||||||||||
| 800 | painter->setPen(QPen(option->palette.background().color().darker(150))); | - | ||||||||||||||||||||||||||||||||||||
| 801 | if (option->state & State_HasFocus && option->state & State_KeyboardFocusChange)
| 0 | ||||||||||||||||||||||||||||||||||||
| 802 | painter->setPen(QPen(highlightedOutline)); never executed: painter->setPen(QPen(highlightedOutline)); | 0 | ||||||||||||||||||||||||||||||||||||
| 803 | painter->drawPath(circle); | - | ||||||||||||||||||||||||||||||||||||
| 804 | - | |||||||||||||||||||||||||||||||||||||
| 805 | if (state & (State_On )) {
| 0 | ||||||||||||||||||||||||||||||||||||
| 806 | circle = QPainterPath(); | - | ||||||||||||||||||||||||||||||||||||
| 807 | const qreal checkmarkRadius = outlineRadius / 2.32; | - | ||||||||||||||||||||||||||||||||||||
| 808 | circle.addEllipse(circleCenter, checkmarkRadius, checkmarkRadius); | - | ||||||||||||||||||||||||||||||||||||
| 809 | QColor checkMarkColor = option->palette.text().color().darker(120); | - | ||||||||||||||||||||||||||||||||||||
| 810 | checkMarkColor.setAlpha(200); | - | ||||||||||||||||||||||||||||||||||||
| 811 | painter->setPen(checkMarkColor); | - | ||||||||||||||||||||||||||||||||||||
| 812 | checkMarkColor.setAlpha(180); | - | ||||||||||||||||||||||||||||||||||||
| 813 | painter->setBrush(checkMarkColor); | - | ||||||||||||||||||||||||||||||||||||
| 814 | painter->drawPath(circle); | - | ||||||||||||||||||||||||||||||||||||
| 815 | } never executed: end of block | 0 | ||||||||||||||||||||||||||||||||||||
| 816 | } | - | ||||||||||||||||||||||||||||||||||||
| 817 | painter->restore(); | - | ||||||||||||||||||||||||||||||||||||
| 818 | break; never executed: break; | 0 | ||||||||||||||||||||||||||||||||||||
| 819 | case PE_IndicatorToolBarHandle: never executed: case PE_IndicatorToolBarHandle: | 0 | ||||||||||||||||||||||||||||||||||||
| 820 | { | - | ||||||||||||||||||||||||||||||||||||
| 821 | //draw grips | - | ||||||||||||||||||||||||||||||||||||
| 822 | if (option->state & State_Horizontal) {
| 0 | ||||||||||||||||||||||||||||||||||||
| 823 | for (int i = -3 ; i < 2 ; i += 3) {
| 0 | ||||||||||||||||||||||||||||||||||||
| 824 | for (int j = -8 ; j < 10 ; j += 3) {
| 0 | ||||||||||||||||||||||||||||||||||||
| 825 | painter->fillRect(rect.center().x() + i, rect.center().y() + j, 2, 2, d->lightShade()); | - | ||||||||||||||||||||||||||||||||||||
| 826 | painter->fillRect(rect.center().x() + i, rect.center().y() + j, 1, 1, d->darkShade()); | - | ||||||||||||||||||||||||||||||||||||
| 827 | } never executed: end of block | 0 | ||||||||||||||||||||||||||||||||||||
| 828 | } never executed: end of block | 0 | ||||||||||||||||||||||||||||||||||||
| 829 | } else { //vertical toolbar never executed: end of block | 0 | ||||||||||||||||||||||||||||||||||||
| 830 | for (int i = -6 ; i < 12 ; i += 3) {
| 0 | ||||||||||||||||||||||||||||||||||||
| 831 | for (int j = -3 ; j < 2 ; j += 3) {
| 0 | ||||||||||||||||||||||||||||||||||||
| 832 | painter->fillRect(rect.center().x() + i, rect.center().y() + j, 2, 2, d->lightShade()); | - | ||||||||||||||||||||||||||||||||||||
| 833 | painter->fillRect(rect.center().x() + i, rect.center().y() + j, 1, 1, d->darkShade()); | - | ||||||||||||||||||||||||||||||||||||
| 834 | } never executed: end of block | 0 | ||||||||||||||||||||||||||||||||||||
| 835 | } never executed: end of block | 0 | ||||||||||||||||||||||||||||||||||||
| 836 | } never executed: end of block | 0 | ||||||||||||||||||||||||||||||||||||
| 837 | break; never executed: break; | 0 | ||||||||||||||||||||||||||||||||||||
| 838 | } | - | ||||||||||||||||||||||||||||||||||||
| 839 | case PE_FrameDefaultButton: never executed: case PE_FrameDefaultButton: | 0 | ||||||||||||||||||||||||||||||||||||
| 840 | break; never executed: break; | 0 | ||||||||||||||||||||||||||||||||||||
| 841 | case PE_FrameFocusRect: never executed: case PE_FrameFocusRect: | 0 | ||||||||||||||||||||||||||||||||||||
| 842 | if (const QStyleOptionFocusRect *fropt = qstyleoption_cast<const QStyleOptionFocusRect *>(option)) {
| 0 | ||||||||||||||||||||||||||||||||||||
| 843 | //### check for d->alt_down | - | ||||||||||||||||||||||||||||||||||||
| 844 | if (!(fropt->state & State_KeyboardFocusChange))
| 0 | ||||||||||||||||||||||||||||||||||||
| 845 | return; never executed: return; | 0 | ||||||||||||||||||||||||||||||||||||
| 846 | QRect rect = option->rect; | - | ||||||||||||||||||||||||||||||||||||
| 847 | - | |||||||||||||||||||||||||||||||||||||
| 848 | painter->save(); | - | ||||||||||||||||||||||||||||||||||||
| 849 | painter->setRenderHint(QPainter::Antialiasing, true); | - | ||||||||||||||||||||||||||||||||||||
| 850 | painter->translate(0.5, 0.5); | - | ||||||||||||||||||||||||||||||||||||
| 851 | QColor fillcolor = highlightedOutline; | - | ||||||||||||||||||||||||||||||||||||
| 852 | fillcolor.setAlpha(80); | - | ||||||||||||||||||||||||||||||||||||
| 853 | painter->setPen(fillcolor.darker(120)); | - | ||||||||||||||||||||||||||||||||||||
| 854 | fillcolor.setAlpha(30); | - | ||||||||||||||||||||||||||||||||||||
| 855 | QLinearGradient gradient(rect.topLeft(), rect.bottomLeft()); | - | ||||||||||||||||||||||||||||||||||||
| 856 | gradient.setColorAt(0, fillcolor.lighter(160)); | - | ||||||||||||||||||||||||||||||||||||
| 857 | gradient.setColorAt(1, fillcolor); | - | ||||||||||||||||||||||||||||||||||||
| 858 | painter->setBrush(gradient); | - | ||||||||||||||||||||||||||||||||||||
| 859 | painter->drawRoundedRect(option->rect.adjusted(0, 0, -1, -1), 1, 1); | - | ||||||||||||||||||||||||||||||||||||
| 860 | painter->restore(); | - | ||||||||||||||||||||||||||||||||||||
| 861 | } never executed: end of block | 0 | ||||||||||||||||||||||||||||||||||||
| 862 | break; never executed: break; | 0 | ||||||||||||||||||||||||||||||||||||
| 863 | case PE_PanelButtonCommand: never executed: case PE_PanelButtonCommand: | 0 | ||||||||||||||||||||||||||||||||||||
| 864 | { | - | ||||||||||||||||||||||||||||||||||||
| 865 | bool isDefault = false; | - | ||||||||||||||||||||||||||||||||||||
| 866 | bool isFlat = false; | - | ||||||||||||||||||||||||||||||||||||
| 867 | bool isDown = (option->state & State_Sunken) || (option->state & State_On);
| 0 | ||||||||||||||||||||||||||||||||||||
| 868 | QRect r; | - | ||||||||||||||||||||||||||||||||||||
| 869 | - | |||||||||||||||||||||||||||||||||||||
| 870 | if (const QStyleOptionButton *button = qstyleoption_cast<const QStyleOptionButton*>(option)) {
| 0 | ||||||||||||||||||||||||||||||||||||
| 871 | isDefault = (button->features & QStyleOptionButton::DefaultButton) && (button->state & State_Enabled);
| 0 | ||||||||||||||||||||||||||||||||||||
| 872 | isFlat = (button->features & QStyleOptionButton::Flat); | - | ||||||||||||||||||||||||||||||||||||
| 873 | } never executed: end of block | 0 | ||||||||||||||||||||||||||||||||||||
| 874 | - | |||||||||||||||||||||||||||||||||||||
| 875 | if (isFlat && !isDown) {
| 0 | ||||||||||||||||||||||||||||||||||||
| 876 | if (isDefault) {
| 0 | ||||||||||||||||||||||||||||||||||||
| 877 | r = option->rect.adjusted(0, 1, 0, -1); | - | ||||||||||||||||||||||||||||||||||||
| 878 | painter->setPen(QPen(Qt::black)); | - | ||||||||||||||||||||||||||||||||||||
| 879 | const QLine lines[4] = { | - | ||||||||||||||||||||||||||||||||||||
| 880 | QLine(QPoint(r.left() + 2, r.top()), | - | ||||||||||||||||||||||||||||||||||||
| 881 | QPoint(r.right() - 2, r.top())), | - | ||||||||||||||||||||||||||||||||||||
| 882 | QLine(QPoint(r.left(), r.top() + 2), | - | ||||||||||||||||||||||||||||||||||||
| 883 | QPoint(r.left(), r.bottom() - 2)), | - | ||||||||||||||||||||||||||||||||||||
| 884 | QLine(QPoint(r.right(), r.top() + 2), | - | ||||||||||||||||||||||||||||||||||||
| 885 | QPoint(r.right(), r.bottom() - 2)), | - | ||||||||||||||||||||||||||||||||||||
| 886 | QLine(QPoint(r.left() + 2, r.bottom()), | - | ||||||||||||||||||||||||||||||||||||
| 887 | QPoint(r.right() - 2, r.bottom())) | - | ||||||||||||||||||||||||||||||||||||
| 888 | }; | - | ||||||||||||||||||||||||||||||||||||
| 889 | painter->drawLines(lines, 4); | - | ||||||||||||||||||||||||||||||||||||
| 890 | const QPoint points[4] = { | - | ||||||||||||||||||||||||||||||||||||
| 891 | QPoint(r.right() - 1, r.bottom() - 1), | - | ||||||||||||||||||||||||||||||||||||
| 892 | QPoint(r.right() - 1, r.top() + 1), | - | ||||||||||||||||||||||||||||||||||||
| 893 | QPoint(r.left() + 1, r.bottom() - 1), | - | ||||||||||||||||||||||||||||||||||||
| 894 | QPoint(r.left() + 1, r.top() + 1) | - | ||||||||||||||||||||||||||||||||||||
| 895 | }; | - | ||||||||||||||||||||||||||||||||||||
| 896 | painter->drawPoints(points, 4); | - | ||||||||||||||||||||||||||||||||||||
| 897 | } never executed: end of block | 0 | ||||||||||||||||||||||||||||||||||||
| 898 | return; never executed: return; | 0 | ||||||||||||||||||||||||||||||||||||
| 899 | } | - | ||||||||||||||||||||||||||||||||||||
| 900 | - | |||||||||||||||||||||||||||||||||||||
| 901 | BEGIN_STYLE_PIXMAPCACHE(QString::fromLatin1("pushbutton-%1").arg(isDefault)) never executed: end of blocknever executed: end of block
| 0 | ||||||||||||||||||||||||||||||||||||
| 902 | r = rect.adjusted(0, 1, -1, 0); | - | ||||||||||||||||||||||||||||||||||||
| 903 | - | |||||||||||||||||||||||||||||||||||||
| 904 | bool isEnabled = option->state & State_Enabled; | - | ||||||||||||||||||||||||||||||||||||
| 905 | bool hasFocus = (option->state & State_HasFocus && option->state & State_KeyboardFocusChange);
| 0 | ||||||||||||||||||||||||||||||||||||
| 906 | QColor buttonColor = d->buttonColor(option->palette); | - | ||||||||||||||||||||||||||||||||||||
| 907 | - | |||||||||||||||||||||||||||||||||||||
| 908 | QColor darkOutline = outline; | - | ||||||||||||||||||||||||||||||||||||
| 909 | if (hasFocus | isDefault) {
| 0 | ||||||||||||||||||||||||||||||||||||
| 910 | darkOutline = highlightedOutline; | - | ||||||||||||||||||||||||||||||||||||
| 911 | } never executed: end of block | 0 | ||||||||||||||||||||||||||||||||||||
| 912 | - | |||||||||||||||||||||||||||||||||||||
| 913 | if (isDefault)
| 0 | ||||||||||||||||||||||||||||||||||||
| 914 | buttonColor = mergedColors(buttonColor, highlightedOutline.lighter(130), 90); never executed: buttonColor = mergedColors(buttonColor, highlightedOutline.lighter(130), 90); | 0 | ||||||||||||||||||||||||||||||||||||
| 915 | - | |||||||||||||||||||||||||||||||||||||
| 916 | p->setRenderHint(QPainter::Antialiasing, true); | - | ||||||||||||||||||||||||||||||||||||
| 917 | p->translate(0.5, -0.5); | - | ||||||||||||||||||||||||||||||||||||
| 918 | - | |||||||||||||||||||||||||||||||||||||
| 919 | QLinearGradient gradient = qt_fusion_gradient(rect, (isEnabled && option->state & State_MouseOver ) ? buttonColor : buttonColor.darker(104)); | - | ||||||||||||||||||||||||||||||||||||
| 920 | p->setPen(Qt::transparent); | - | ||||||||||||||||||||||||||||||||||||
| 921 | p->setBrush(isDown ? QBrush(buttonColor.darker(110)) : gradient); | - | ||||||||||||||||||||||||||||||||||||
| 922 | p->drawRoundedRect(r, 2.0, 2.0); | - | ||||||||||||||||||||||||||||||||||||
| 923 | p->setBrush(Qt::NoBrush); | - | ||||||||||||||||||||||||||||||||||||
| 924 | - | |||||||||||||||||||||||||||||||||||||
| 925 | // Outline | - | ||||||||||||||||||||||||||||||||||||
| 926 | p->setPen(!isEnabled ? QPen(darkOutline.lighter(115)) : QPen(darkOutline)); | - | ||||||||||||||||||||||||||||||||||||
| 927 | p->drawRoundedRect(r, 2.0, 2.0); | - | ||||||||||||||||||||||||||||||||||||
| 928 | - | |||||||||||||||||||||||||||||||||||||
| 929 | p->setPen(d->innerContrastLine()); | - | ||||||||||||||||||||||||||||||||||||
| 930 | p->drawRoundedRect(r.adjusted(1, 1, -1, -1), 2.0, 2.0); | - | ||||||||||||||||||||||||||||||||||||
| 931 | - | |||||||||||||||||||||||||||||||||||||
| 932 | END_STYLE_PIXMAPCACHE never executed: end of blocknever executed: end of block
| 0 | ||||||||||||||||||||||||||||||||||||
| 933 | } | - | ||||||||||||||||||||||||||||||||||||
| 934 | break; never executed: break; | 0 | ||||||||||||||||||||||||||||||||||||
| 935 | case PE_FrameTabWidget: never executed: case PE_FrameTabWidget: | 0 | ||||||||||||||||||||||||||||||||||||
| 936 | painter->save(); | - | ||||||||||||||||||||||||||||||||||||
| 937 | painter->fillRect(option->rect.adjusted(0, 0, -1, -1), tabFrameColor); | - | ||||||||||||||||||||||||||||||||||||
| 938 | if (const QStyleOptionTabWidgetFrame *twf = qstyleoption_cast<const QStyleOptionTabWidgetFrame *>(option)) {
| 0 | ||||||||||||||||||||||||||||||||||||
| 939 | QColor borderColor = outline.lighter(110); | - | ||||||||||||||||||||||||||||||||||||
| 940 | QRect rect = option->rect.adjusted(0, 0, -1, -1); | - | ||||||||||||||||||||||||||||||||||||
| 941 | - | |||||||||||||||||||||||||||||||||||||
| 942 | // Shadow outline | - | ||||||||||||||||||||||||||||||||||||
| 943 | if (twf->shape != QTabBar::RoundedSouth) {
| 0 | ||||||||||||||||||||||||||||||||||||
| 944 | rect.adjust(0, 0, 0, -1); | - | ||||||||||||||||||||||||||||||||||||
| 945 | QColor alphaShadow(Qt::black); | - | ||||||||||||||||||||||||||||||||||||
| 946 | alphaShadow.setAlpha(15); | - | ||||||||||||||||||||||||||||||||||||
| 947 | painter->setPen(alphaShadow); | - | ||||||||||||||||||||||||||||||||||||
| 948 | painter->drawLine(option->rect.bottomLeft(), option->rect.bottomRight()); painter->setPen(borderColor); | - | ||||||||||||||||||||||||||||||||||||
| 949 | } never executed: end of block | 0 | ||||||||||||||||||||||||||||||||||||
| 950 | - | |||||||||||||||||||||||||||||||||||||
| 951 | // outline | - | ||||||||||||||||||||||||||||||||||||
| 952 | painter->setPen(outline); | - | ||||||||||||||||||||||||||||||||||||
| 953 | painter->drawRect(rect); | - | ||||||||||||||||||||||||||||||||||||
| 954 | - | |||||||||||||||||||||||||||||||||||||
| 955 | // Inner frame highlight | - | ||||||||||||||||||||||||||||||||||||
| 956 | painter->setPen(d->innerContrastLine()); | - | ||||||||||||||||||||||||||||||||||||
| 957 | painter->drawRect(rect.adjusted(1, 1, -1, -1)); | - | ||||||||||||||||||||||||||||||||||||
| 958 | - | |||||||||||||||||||||||||||||||||||||
| 959 | } never executed: end of block | 0 | ||||||||||||||||||||||||||||||||||||
| 960 | painter->restore(); | - | ||||||||||||||||||||||||||||||||||||
| 961 | break ; never executed: break ; | 0 | ||||||||||||||||||||||||||||||||||||
| 962 | - | |||||||||||||||||||||||||||||||||||||
| 963 | case PE_FrameStatusBarItem: never executed: case PE_FrameStatusBarItem: | 0 | ||||||||||||||||||||||||||||||||||||
| 964 | break; never executed: break; | 0 | ||||||||||||||||||||||||||||||||||||
| 965 | case PE_IndicatorTabClose: never executed: case PE_IndicatorTabClose: | 0 | ||||||||||||||||||||||||||||||||||||
| 966 | { | - | ||||||||||||||||||||||||||||||||||||
| 967 | Q_D(const QFusionStyle); | - | ||||||||||||||||||||||||||||||||||||
| 968 | if (d->tabBarcloseButtonIcon.isNull())
| 0 | ||||||||||||||||||||||||||||||||||||
| 969 | d->tabBarcloseButtonIcon = proxy()->standardIcon(SP_DialogCloseButton, option, widget); never executed: d->tabBarcloseButtonIcon = proxy()->standardIcon(SP_DialogCloseButton, option, widget); | 0 | ||||||||||||||||||||||||||||||||||||
| 970 | if ((option->state & State_Enabled) && (option->state & State_MouseOver))
| 0 | ||||||||||||||||||||||||||||||||||||
| 971 | proxy()->drawPrimitive(PE_PanelButtonCommand, option, painter, widget); never executed: proxy()->drawPrimitive(PE_PanelButtonCommand, option, painter, widget); | 0 | ||||||||||||||||||||||||||||||||||||
| 972 | QPixmap pixmap = d->tabBarcloseButtonIcon.pixmap(QSize(16, 16), QIcon::Normal, QIcon::On); | - | ||||||||||||||||||||||||||||||||||||
| 973 | proxy()->drawItemPixmap(painter, option->rect, Qt::AlignCenter, pixmap); | - | ||||||||||||||||||||||||||||||||||||
| 974 | } | - | ||||||||||||||||||||||||||||||||||||
| 975 | break; never executed: break; | 0 | ||||||||||||||||||||||||||||||||||||
| 976 | case PE_PanelMenu: { never executed: case PE_PanelMenu: | 0 | ||||||||||||||||||||||||||||||||||||
| 977 | painter->save(); | - | ||||||||||||||||||||||||||||||||||||
| 978 | QColor menuBackground = option->palette.base().color().lighter(108); | - | ||||||||||||||||||||||||||||||||||||
| 979 | QColor borderColor = option->palette.background().color().darker(160); | - | ||||||||||||||||||||||||||||||||||||
| 980 | painter->setPen(borderColor); | - | ||||||||||||||||||||||||||||||||||||
| 981 | painter->setBrush(menuBackground); | - | ||||||||||||||||||||||||||||||||||||
| 982 | painter->drawRect(option->rect.adjusted(0, 0, -1, -1)); | - | ||||||||||||||||||||||||||||||||||||
| 983 | painter->restore(); | - | ||||||||||||||||||||||||||||||||||||
| 984 | } | - | ||||||||||||||||||||||||||||||||||||
| 985 | break; never executed: break; | 0 | ||||||||||||||||||||||||||||||||||||
| 986 | - | |||||||||||||||||||||||||||||||||||||
| 987 | default: never executed: default: | 0 | ||||||||||||||||||||||||||||||||||||
| 988 | QCommonStyle::drawPrimitive(elem, option, painter, widget); | - | ||||||||||||||||||||||||||||||||||||
| 989 | break; never executed: break; | 0 | ||||||||||||||||||||||||||||||||||||
| 990 | } | - | ||||||||||||||||||||||||||||||||||||
| 991 | } | - | ||||||||||||||||||||||||||||||||||||
| 992 | - | |||||||||||||||||||||||||||||||||||||
| 993 | /*! | - | ||||||||||||||||||||||||||||||||||||
| 994 | \reimp | - | ||||||||||||||||||||||||||||||||||||
| 995 | */ | - | ||||||||||||||||||||||||||||||||||||
| 996 | void QFusionStyle::drawControl(ControlElement element, const QStyleOption *option, QPainter *painter, | - | ||||||||||||||||||||||||||||||||||||
| 997 | const QWidget *widget) const | - | ||||||||||||||||||||||||||||||||||||
| 998 | { | - | ||||||||||||||||||||||||||||||||||||
| 999 | Q_D (const QFusionStyle); | - | ||||||||||||||||||||||||||||||||||||
| 1000 | QRect rect = option->rect; | - | ||||||||||||||||||||||||||||||||||||
| 1001 | QColor outline = d->outline(option->palette); | - | ||||||||||||||||||||||||||||||||||||
| 1002 | QColor highlightedOutline = d->highlightedOutline(option->palette); | - | ||||||||||||||||||||||||||||||||||||
| 1003 | QColor shadow = d->darkShade(); | - | ||||||||||||||||||||||||||||||||||||
| 1004 | - | |||||||||||||||||||||||||||||||||||||
| 1005 | switch (element) { | - | ||||||||||||||||||||||||||||||||||||
| 1006 | case CE_ComboBoxLabel: never executed: case CE_ComboBoxLabel: | 0 | ||||||||||||||||||||||||||||||||||||
| 1007 | if (const QStyleOptionComboBox *cb = qstyleoption_cast<const QStyleOptionComboBox *>(option)) {
| 0 | ||||||||||||||||||||||||||||||||||||
| 1008 | QRect editRect = proxy()->subControlRect(CC_ComboBox, cb, SC_ComboBoxEditField, widget); | - | ||||||||||||||||||||||||||||||||||||
| 1009 | painter->save(); | - | ||||||||||||||||||||||||||||||||||||
| 1010 | painter->setClipRect(editRect); | - | ||||||||||||||||||||||||||||||||||||
| 1011 | if (!cb->currentIcon.isNull()) {
| 0 | ||||||||||||||||||||||||||||||||||||
| 1012 | QIcon::Mode mode = cb->state & State_Enabled ? QIcon::Normal
| 0 | ||||||||||||||||||||||||||||||||||||
| 1013 | : QIcon::Disabled; | - | ||||||||||||||||||||||||||||||||||||
| 1014 | QPixmap pixmap = cb->currentIcon.pixmap(cb->iconSize, mode); | - | ||||||||||||||||||||||||||||||||||||
| 1015 | QRect iconRect(editRect); | - | ||||||||||||||||||||||||||||||||||||
| 1016 | iconRect.setWidth(cb->iconSize.width() + 4); | - | ||||||||||||||||||||||||||||||||||||
| 1017 | iconRect = alignedRect(cb->direction, | - | ||||||||||||||||||||||||||||||||||||
| 1018 | Qt::AlignLeft | Qt::AlignVCenter, | - | ||||||||||||||||||||||||||||||||||||
| 1019 | iconRect.size(), editRect); | - | ||||||||||||||||||||||||||||||||||||
| 1020 | if (cb->editable)
| 0 | ||||||||||||||||||||||||||||||||||||
| 1021 | painter->fillRect(iconRect, cb->palette.brush(QPalette::Base)); never executed: painter->fillRect(iconRect, cb->palette.brush(QPalette::Base)); | 0 | ||||||||||||||||||||||||||||||||||||
| 1022 | proxy()->drawItemPixmap(painter, iconRect, Qt::AlignCenter, pixmap); | - | ||||||||||||||||||||||||||||||||||||
| 1023 | - | |||||||||||||||||||||||||||||||||||||
| 1024 | if (cb->direction == Qt::RightToLeft)
| 0 | ||||||||||||||||||||||||||||||||||||
| 1025 | editRect.translate(-4 - cb->iconSize.width(), 0); never executed: editRect.translate(-4 - cb->iconSize.width(), 0); | 0 | ||||||||||||||||||||||||||||||||||||
| 1026 | else | - | ||||||||||||||||||||||||||||||||||||
| 1027 | editRect.translate(cb->iconSize.width() + 4, 0); never executed: editRect.translate(cb->iconSize.width() + 4, 0); | 0 | ||||||||||||||||||||||||||||||||||||
| 1028 | } | - | ||||||||||||||||||||||||||||||||||||
| 1029 | if (!cb->currentText.isEmpty() && !cb->editable) {
| 0 | ||||||||||||||||||||||||||||||||||||
| 1030 | proxy()->drawItemText(painter, editRect.adjusted(1, 0, -1, 0), | - | ||||||||||||||||||||||||||||||||||||
| 1031 | visualAlignment(cb->direction, Qt::AlignLeft | Qt::AlignVCenter), | - | ||||||||||||||||||||||||||||||||||||
| 1032 | cb->palette, cb->state & State_Enabled, cb->currentText, | - | ||||||||||||||||||||||||||||||||||||
| 1033 | cb->editable ? QPalette::Text : QPalette::ButtonText); | - | ||||||||||||||||||||||||||||||||||||
| 1034 | } never executed: end of block | 0 | ||||||||||||||||||||||||||||||||||||
| 1035 | painter->restore(); | - | ||||||||||||||||||||||||||||||||||||
| 1036 | } never executed: end of block | 0 | ||||||||||||||||||||||||||||||||||||
| 1037 | break; never executed: break; | 0 | ||||||||||||||||||||||||||||||||||||
| 1038 | case CE_Splitter: never executed: case CE_Splitter: | 0 | ||||||||||||||||||||||||||||||||||||
| 1039 | { | - | ||||||||||||||||||||||||||||||||||||
| 1040 | // Don't draw handle for single pixel splitters | - | ||||||||||||||||||||||||||||||||||||
| 1041 | if (option->rect.width() > 1 && option->rect.height() > 1) {
| 0 | ||||||||||||||||||||||||||||||||||||
| 1042 | //draw grips | - | ||||||||||||||||||||||||||||||||||||
| 1043 | if (option->state & State_Horizontal) {
| 0 | ||||||||||||||||||||||||||||||||||||
| 1044 | for (int j = -6 ; j< 12 ; j += 3) {
| 0 | ||||||||||||||||||||||||||||||||||||
| 1045 | painter->fillRect(rect.center().x() + 1, rect.center().y() + j, 2, 2, d->lightShade()); | - | ||||||||||||||||||||||||||||||||||||
| 1046 | painter->fillRect(rect.center().x() + 1, rect.center().y() + j, 1, 1, d->darkShade()); | - | ||||||||||||||||||||||||||||||||||||
| 1047 | } never executed: end of block | 0 | ||||||||||||||||||||||||||||||||||||
| 1048 | } else { never executed: end of block | 0 | ||||||||||||||||||||||||||||||||||||
| 1049 | for (int i = -6; i< 12 ; i += 3) {
| 0 | ||||||||||||||||||||||||||||||||||||
| 1050 | painter->fillRect(rect.center().x() + i, rect.center().y(), 2, 2, d->lightShade()); | - | ||||||||||||||||||||||||||||||||||||
| 1051 | painter->fillRect(rect.center().x() + i, rect.center().y(), 1, 1, d->darkShade()); | - | ||||||||||||||||||||||||||||||||||||
| 1052 | } never executed: end of block | 0 | ||||||||||||||||||||||||||||||||||||
| 1053 | } never executed: end of block | 0 | ||||||||||||||||||||||||||||||||||||
| 1054 | } | - | ||||||||||||||||||||||||||||||||||||
| 1055 | break; never executed: break; | 0 | ||||||||||||||||||||||||||||||||||||
| 1056 | } | - | ||||||||||||||||||||||||||||||||||||
| 1057 | case CE_RubberBand: never executed: case CE_RubberBand: | 0 | ||||||||||||||||||||||||||||||||||||
| 1058 | if (qstyleoption_cast<const QStyleOptionRubberBand *>(option)) {
| 0 | ||||||||||||||||||||||||||||||||||||
| 1059 | QColor highlight = option->palette.color(QPalette::Active, QPalette::Highlight); | - | ||||||||||||||||||||||||||||||||||||
| 1060 | painter->save(); | - | ||||||||||||||||||||||||||||||||||||
| 1061 | QColor penColor = highlight.darker(120); | - | ||||||||||||||||||||||||||||||||||||
| 1062 | penColor.setAlpha(180); | - | ||||||||||||||||||||||||||||||||||||
| 1063 | painter->setPen(penColor); | - | ||||||||||||||||||||||||||||||||||||
| 1064 | QColor dimHighlight(qMin(highlight.red()/2 + 110, 255), | - | ||||||||||||||||||||||||||||||||||||
| 1065 | qMin(highlight.green()/2 + 110, 255), | - | ||||||||||||||||||||||||||||||||||||
| 1066 | qMin(highlight.blue()/2 + 110, 255)); | - | ||||||||||||||||||||||||||||||||||||
| 1067 | dimHighlight.setAlpha(widget && widget->isTopLevel() ? 255 : 80); | - | ||||||||||||||||||||||||||||||||||||
| 1068 | QLinearGradient gradient(rect.topLeft(), QPoint(rect.bottomLeft().x(), rect.bottomLeft().y())); | - | ||||||||||||||||||||||||||||||||||||
| 1069 | gradient.setColorAt(0, dimHighlight.lighter(120)); | - | ||||||||||||||||||||||||||||||||||||
| 1070 | gradient.setColorAt(1, dimHighlight); | - | ||||||||||||||||||||||||||||||||||||
| 1071 | painter->setRenderHint(QPainter::Antialiasing, true); | - | ||||||||||||||||||||||||||||||||||||
| 1072 | painter->translate(0.5, 0.5); | - | ||||||||||||||||||||||||||||||||||||
| 1073 | painter->setBrush(dimHighlight); | - | ||||||||||||||||||||||||||||||||||||
| 1074 | painter->drawRoundedRect(option->rect.adjusted(0, 0, -1, -1), 1, 1); | - | ||||||||||||||||||||||||||||||||||||
| 1075 | QColor innerLine = Qt::white; | - | ||||||||||||||||||||||||||||||||||||
| 1076 | innerLine.setAlpha(40); | - | ||||||||||||||||||||||||||||||||||||
| 1077 | painter->setPen(innerLine); | - | ||||||||||||||||||||||||||||||||||||
| 1078 | painter->drawRoundedRect(option->rect.adjusted(1, 1, -2, -2), 1, 1); | - | ||||||||||||||||||||||||||||||||||||
| 1079 | painter->restore(); | - | ||||||||||||||||||||||||||||||||||||
| 1080 | } never executed: end of block | 0 | ||||||||||||||||||||||||||||||||||||
| 1081 | break; never executed: break; | 0 | ||||||||||||||||||||||||||||||||||||
| 1082 | case CE_SizeGrip: never executed: case CE_SizeGrip: | 0 | ||||||||||||||||||||||||||||||||||||
| 1083 | painter->save(); | - | ||||||||||||||||||||||||||||||||||||
| 1084 | { | - | ||||||||||||||||||||||||||||||||||||
| 1085 | //draw grips | - | ||||||||||||||||||||||||||||||||||||
| 1086 | for (int i = -6; i< 12 ; i += 3) {
| 0 | ||||||||||||||||||||||||||||||||||||
| 1087 | for (int j = -6 ; j< 12 ; j += 3) {
| 0 | ||||||||||||||||||||||||||||||||||||
| 1088 | if ((option->direction == Qt::LeftToRight && i > -j) || (option->direction == Qt::RightToLeft && j > i) ) {
| 0 | ||||||||||||||||||||||||||||||||||||
| 1089 | painter->fillRect(rect.center().x() + i, rect.center().y() + j, 2, 2, d->lightShade()); | - | ||||||||||||||||||||||||||||||||||||
| 1090 | painter->fillRect(rect.center().x() + i, rect.center().y() + j, 1, 1, d->darkShade()); | - | ||||||||||||||||||||||||||||||||||||
| 1091 | } never executed: end of block | 0 | ||||||||||||||||||||||||||||||||||||
| 1092 | } never executed: end of block | 0 | ||||||||||||||||||||||||||||||||||||
| 1093 | } never executed: end of block | 0 | ||||||||||||||||||||||||||||||||||||
| 1094 | } | - | ||||||||||||||||||||||||||||||||||||
| 1095 | painter->restore(); | - | ||||||||||||||||||||||||||||||||||||
| 1096 | break; never executed: break; | 0 | ||||||||||||||||||||||||||||||||||||
| 1097 | case CE_ToolBar: never executed: case CE_ToolBar: | 0 | ||||||||||||||||||||||||||||||||||||
| 1098 | if (const QStyleOptionToolBar *toolBar = qstyleoption_cast<const QStyleOptionToolBar *>(option)) {
| 0 | ||||||||||||||||||||||||||||||||||||
| 1099 | // Reserve the beveled appearance only for mainwindow toolbars | - | ||||||||||||||||||||||||||||||||||||
| 1100 | if (widget && !(qobject_cast<const QMainWindow*> (widget->parentWidget())))
| 0 | ||||||||||||||||||||||||||||||||||||
| 1101 | break; never executed: break; | 0 | ||||||||||||||||||||||||||||||||||||
| 1102 | - | |||||||||||||||||||||||||||||||||||||
| 1103 | // Draws the light line above and the dark line below menu bars and | - | ||||||||||||||||||||||||||||||||||||
| 1104 | // tool bars. | - | ||||||||||||||||||||||||||||||||||||
| 1105 | QLinearGradient gradient(option->rect.topLeft(), option->rect.bottomLeft()); | - | ||||||||||||||||||||||||||||||||||||
| 1106 | if (!(option->state & State_Horizontal))
| 0 | ||||||||||||||||||||||||||||||||||||
| 1107 | gradient = QLinearGradient(rect.left(), rect.center().y(), never executed: gradient = QLinearGradient(rect.left(), rect.center().y(), rect.right(), rect.center().y()); | 0 | ||||||||||||||||||||||||||||||||||||
| 1108 | rect.right(), rect.center().y()); never executed: gradient = QLinearGradient(rect.left(), rect.center().y(), rect.right(), rect.center().y()); | 0 | ||||||||||||||||||||||||||||||||||||
| 1109 | gradient.setColorAt(0, option->palette.window().color().lighter(104)); | - | ||||||||||||||||||||||||||||||||||||
| 1110 | gradient.setColorAt(1, option->palette.window().color()); | - | ||||||||||||||||||||||||||||||||||||
| 1111 | painter->fillRect(option->rect, gradient); | - | ||||||||||||||||||||||||||||||||||||
| 1112 | - | |||||||||||||||||||||||||||||||||||||
| 1113 | QColor light = d->lightShade(); | - | ||||||||||||||||||||||||||||||||||||
| 1114 | QColor shadow = d->darkShade(); | - | ||||||||||||||||||||||||||||||||||||
| 1115 | - | |||||||||||||||||||||||||||||||||||||
| 1116 | QPen oldPen = painter->pen(); | - | ||||||||||||||||||||||||||||||||||||
| 1117 | if (toolBar->toolBarArea == Qt::TopToolBarArea) {
| 0 | ||||||||||||||||||||||||||||||||||||
| 1118 | if (toolBar->positionOfLine == QStyleOptionToolBar::End
| 0 | ||||||||||||||||||||||||||||||||||||
| 1119 | || toolBar->positionOfLine == QStyleOptionToolBar::OnlyOne) {
| 0 | ||||||||||||||||||||||||||||||||||||
| 1120 | // The end and onlyone top toolbar lines draw a double | - | ||||||||||||||||||||||||||||||||||||
| 1121 | // line at the bottom to blend with the central | - | ||||||||||||||||||||||||||||||||||||
| 1122 | // widget. | - | ||||||||||||||||||||||||||||||||||||
| 1123 | painter->setPen(light); | - | ||||||||||||||||||||||||||||||||||||
| 1124 | painter->drawLine(option->rect.bottomLeft(), option->rect.bottomRight()); | - | ||||||||||||||||||||||||||||||||||||
| 1125 | painter->setPen(shadow); | - | ||||||||||||||||||||||||||||||||||||
| 1126 | painter->drawLine(option->rect.left(), option->rect.bottom() - 1, | - | ||||||||||||||||||||||||||||||||||||
| 1127 | option->rect.right(), option->rect.bottom() - 1); | - | ||||||||||||||||||||||||||||||||||||
| 1128 | } else { never executed: end of block | 0 | ||||||||||||||||||||||||||||||||||||
| 1129 | // All others draw a single dark line at the bottom. | - | ||||||||||||||||||||||||||||||||||||
| 1130 | painter->setPen(shadow); | - | ||||||||||||||||||||||||||||||||||||
| 1131 | painter->drawLine(option->rect.bottomLeft(), option->rect.bottomRight()); | - | ||||||||||||||||||||||||||||||||||||
| 1132 | } never executed: end of block | 0 | ||||||||||||||||||||||||||||||||||||
| 1133 | // All top toolbar lines draw a light line at the top. | - | ||||||||||||||||||||||||||||||||||||
| 1134 | painter->setPen(light); | - | ||||||||||||||||||||||||||||||||||||
| 1135 | painter->drawLine(option->rect.topLeft(), option->rect.topRight()); | - | ||||||||||||||||||||||||||||||||||||
| 1136 | } else if (toolBar->toolBarArea == Qt::BottomToolBarArea) { never executed: end of block
| 0 | ||||||||||||||||||||||||||||||||||||
| 1137 | if (toolBar->positionOfLine == QStyleOptionToolBar::End
| 0 | ||||||||||||||||||||||||||||||||||||
| 1138 | || toolBar->positionOfLine == QStyleOptionToolBar::Middle) {
| 0 | ||||||||||||||||||||||||||||||||||||
| 1139 | // The end and middle bottom tool bar lines draw a dark | - | ||||||||||||||||||||||||||||||||||||
| 1140 | // line at the bottom. | - | ||||||||||||||||||||||||||||||||||||
| 1141 | painter->setPen(shadow); | - | ||||||||||||||||||||||||||||||||||||
| 1142 | painter->drawLine(option->rect.bottomLeft(), option->rect.bottomRight()); | - | ||||||||||||||||||||||||||||||||||||
| 1143 | } never executed: end of block | 0 | ||||||||||||||||||||||||||||||||||||
| 1144 | if (toolBar->positionOfLine == QStyleOptionToolBar::Beginning
| 0 | ||||||||||||||||||||||||||||||||||||
| 1145 | || toolBar->positionOfLine == QStyleOptionToolBar::OnlyOne) {
| 0 | ||||||||||||||||||||||||||||||||||||
| 1146 | // The beginning and only one tool bar lines draw a | - | ||||||||||||||||||||||||||||||||||||
| 1147 | // double line at the bottom to blend with the | - | ||||||||||||||||||||||||||||||||||||
| 1148 | // status bar. | - | ||||||||||||||||||||||||||||||||||||
| 1149 | // ### The styleoption could contain whether the | - | ||||||||||||||||||||||||||||||||||||
| 1150 | // main window has a menu bar and a status bar, and | - | ||||||||||||||||||||||||||||||||||||
| 1151 | // possibly dock widgets. | - | ||||||||||||||||||||||||||||||||||||
| 1152 | painter->setPen(shadow); | - | ||||||||||||||||||||||||||||||||||||
| 1153 | painter->drawLine(option->rect.left(), option->rect.bottom() - 1, | - | ||||||||||||||||||||||||||||||||||||
| 1154 | option->rect.right(), option->rect.bottom() - 1); | - | ||||||||||||||||||||||||||||||||||||
| 1155 | painter->setPen(light); | - | ||||||||||||||||||||||||||||||||||||
| 1156 | painter->drawLine(option->rect.bottomLeft(), option->rect.bottomRight()); | - | ||||||||||||||||||||||||||||||||||||
| 1157 | } never executed: end of block | 0 | ||||||||||||||||||||||||||||||||||||
| 1158 | if (toolBar->positionOfLine == QStyleOptionToolBar::End) {
| 0 | ||||||||||||||||||||||||||||||||||||
| 1159 | painter->setPen(shadow); | - | ||||||||||||||||||||||||||||||||||||
| 1160 | painter->drawLine(option->rect.topLeft(), option->rect.topRight()); | - | ||||||||||||||||||||||||||||||||||||
| 1161 | painter->setPen(light); | - | ||||||||||||||||||||||||||||||||||||
| 1162 | painter->drawLine(option->rect.left(), option->rect.top() + 1, | - | ||||||||||||||||||||||||||||||||||||
| 1163 | option->rect.right(), option->rect.top() + 1); | - | ||||||||||||||||||||||||||||||||||||
| 1164 | - | |||||||||||||||||||||||||||||||||||||
| 1165 | } else { never executed: end of block | 0 | ||||||||||||||||||||||||||||||||||||
| 1166 | // All other bottom toolbars draw a light line at the top. | - | ||||||||||||||||||||||||||||||||||||
| 1167 | painter->setPen(light); | - | ||||||||||||||||||||||||||||||||||||
| 1168 | painter->drawLine(option->rect.topLeft(), option->rect.topRight()); | - | ||||||||||||||||||||||||||||||||||||
| 1169 | } never executed: end of block | 0 | ||||||||||||||||||||||||||||||||||||
| 1170 | } | - | ||||||||||||||||||||||||||||||||||||
| 1171 | if (toolBar->toolBarArea == Qt::LeftToolBarArea) {
| 0 | ||||||||||||||||||||||||||||||||||||
| 1172 | if (toolBar->positionOfLine == QStyleOptionToolBar::Middle
| 0 | ||||||||||||||||||||||||||||||||||||
| 1173 | || toolBar->positionOfLine == QStyleOptionToolBar::End) {
| 0 | ||||||||||||||||||||||||||||||||||||
| 1174 | // The middle and left end toolbar lines draw a light | - | ||||||||||||||||||||||||||||||||||||
| 1175 | // line to the left. | - | ||||||||||||||||||||||||||||||||||||
| 1176 | painter->setPen(light); | - | ||||||||||||||||||||||||||||||||||||
| 1177 | painter->drawLine(option->rect.topLeft(), option->rect.bottomLeft()); | - | ||||||||||||||||||||||||||||||||||||
| 1178 | } never executed: end of block | 0 | ||||||||||||||||||||||||||||||||||||
| 1179 | if (toolBar->positionOfLine == QStyleOptionToolBar::End) {
| 0 | ||||||||||||||||||||||||||||||||||||
| 1180 | // All other left toolbar lines draw a dark line to the right | - | ||||||||||||||||||||||||||||||||||||
| 1181 | painter->setPen(shadow); | - | ||||||||||||||||||||||||||||||||||||
| 1182 | painter->drawLine(option->rect.right() - 1, option->rect.top(), | - | ||||||||||||||||||||||||||||||||||||
| 1183 | option->rect.right() - 1, option->rect.bottom()); | - | ||||||||||||||||||||||||||||||||||||
| 1184 | painter->setPen(light); | - | ||||||||||||||||||||||||||||||||||||
| 1185 | painter->drawLine(option->rect.topRight(), option->rect.bottomRight()); | - | ||||||||||||||||||||||||||||||||||||
| 1186 | } else { never executed: end of block | 0 | ||||||||||||||||||||||||||||||||||||
| 1187 | // All other left toolbar lines draw a dark line to the right | - | ||||||||||||||||||||||||||||||||||||
| 1188 | painter->setPen(shadow); | - | ||||||||||||||||||||||||||||||||||||
| 1189 | painter->drawLine(option->rect.topRight(), option->rect.bottomRight()); | - | ||||||||||||||||||||||||||||||||||||
| 1190 | } never executed: end of block | 0 | ||||||||||||||||||||||||||||||||||||
| 1191 | } else if (toolBar->toolBarArea == Qt::RightToolBarArea) {
| 0 | ||||||||||||||||||||||||||||||||||||
| 1192 | if (toolBar->positionOfLine == QStyleOptionToolBar::Middle
| 0 | ||||||||||||||||||||||||||||||||||||
| 1193 | || toolBar->positionOfLine == QStyleOptionToolBar::End) {
| 0 | ||||||||||||||||||||||||||||||||||||
| 1194 | // Right middle and end toolbar lines draw the dark right line | - | ||||||||||||||||||||||||||||||||||||
| 1195 | painter->setPen(shadow); | - | ||||||||||||||||||||||||||||||||||||
| 1196 | painter->drawLine(option->rect.topRight(), option->rect.bottomRight()); | - | ||||||||||||||||||||||||||||||||||||
| 1197 | } never executed: end of block | 0 | ||||||||||||||||||||||||||||||||||||
| 1198 | if (toolBar->positionOfLine == QStyleOptionToolBar::End
| 0 | ||||||||||||||||||||||||||||||||||||
| 1199 | || toolBar->positionOfLine == QStyleOptionToolBar::OnlyOne) {
| 0 | ||||||||||||||||||||||||||||||||||||
| 1200 | // The right end and single toolbar draws the dark | - | ||||||||||||||||||||||||||||||||||||
| 1201 | // line on its left edge | - | ||||||||||||||||||||||||||||||||||||
| 1202 | painter->setPen(shadow); | - | ||||||||||||||||||||||||||||||||||||
| 1203 | painter->drawLine(option->rect.topLeft(), option->rect.bottomLeft()); | - | ||||||||||||||||||||||||||||||||||||
| 1204 | // And a light line next to it | - | ||||||||||||||||||||||||||||||||||||
| 1205 | painter->setPen(light); | - | ||||||||||||||||||||||||||||||||||||
| 1206 | painter->drawLine(option->rect.left() + 1, option->rect.top(), | - | ||||||||||||||||||||||||||||||||||||
| 1207 | option->rect.left() + 1, option->rect.bottom()); | - | ||||||||||||||||||||||||||||||||||||
| 1208 | } else { never executed: end of block | 0 | ||||||||||||||||||||||||||||||||||||
| 1209 | // Other right toolbars draw a light line on its left edge | - | ||||||||||||||||||||||||||||||||||||
| 1210 | painter->setPen(light); | - | ||||||||||||||||||||||||||||||||||||
| 1211 | painter->drawLine(option->rect.topLeft(), option->rect.bottomLeft()); | - | ||||||||||||||||||||||||||||||||||||
| 1212 | } never executed: end of block | 0 | ||||||||||||||||||||||||||||||||||||
| 1213 | } | - | ||||||||||||||||||||||||||||||||||||
| 1214 | painter->setPen(oldPen); | - | ||||||||||||||||||||||||||||||||||||
| 1215 | } never executed: end of block | 0 | ||||||||||||||||||||||||||||||||||||
| 1216 | break; never executed: break; | 0 | ||||||||||||||||||||||||||||||||||||
| 1217 | case CE_DockWidgetTitle: never executed: case CE_DockWidgetTitle: | 0 | ||||||||||||||||||||||||||||||||||||
| 1218 | painter->save(); | - | ||||||||||||||||||||||||||||||||||||
| 1219 | if (const QStyleOptionDockWidget *dwOpt = qstyleoption_cast<const QStyleOptionDockWidget *>(option)) {
| 0 | ||||||||||||||||||||||||||||||||||||
| 1220 | bool verticalTitleBar = dwOpt->verticalTitleBar; | - | ||||||||||||||||||||||||||||||||||||
| 1221 | - | |||||||||||||||||||||||||||||||||||||
| 1222 | QRect titleRect = subElementRect(SE_DockWidgetTitleBarText, option, widget); | - | ||||||||||||||||||||||||||||||||||||
| 1223 | if (verticalTitleBar) {
| 0 | ||||||||||||||||||||||||||||||||||||
| 1224 | QRect rect = dwOpt->rect; | - | ||||||||||||||||||||||||||||||||||||
| 1225 | QRect r = rect; | - | ||||||||||||||||||||||||||||||||||||
| 1226 | r.setSize(r.size().transposed()); | - | ||||||||||||||||||||||||||||||||||||
| 1227 | titleRect = QRect(r.left() + rect.bottom() | - | ||||||||||||||||||||||||||||||||||||
| 1228 | - titleRect.bottom(), | - | ||||||||||||||||||||||||||||||||||||
| 1229 | r.top() + titleRect.left() - rect.left(), | - | ||||||||||||||||||||||||||||||||||||
| 1230 | titleRect.height(), titleRect.width()); | - | ||||||||||||||||||||||||||||||||||||
| 1231 | - | |||||||||||||||||||||||||||||||||||||
| 1232 | painter->translate(r.left(), r.top() + r.width()); | - | ||||||||||||||||||||||||||||||||||||
| 1233 | painter->rotate(-90); | - | ||||||||||||||||||||||||||||||||||||
| 1234 | painter->translate(-r.left(), -r.top()); | - | ||||||||||||||||||||||||||||||||||||
| 1235 | } never executed: end of block | 0 | ||||||||||||||||||||||||||||||||||||
| 1236 | - | |||||||||||||||||||||||||||||||||||||
| 1237 | if (!dwOpt->title.isEmpty()) {
| 0 | ||||||||||||||||||||||||||||||||||||
| 1238 | QString titleText | - | ||||||||||||||||||||||||||||||||||||
| 1239 | = painter->fontMetrics().elidedText(dwOpt->title, | - | ||||||||||||||||||||||||||||||||||||
| 1240 | Qt::ElideRight, titleRect.width()); | - | ||||||||||||||||||||||||||||||||||||
| 1241 | proxy()->drawItemText(painter, | - | ||||||||||||||||||||||||||||||||||||
| 1242 | titleRect, | - | ||||||||||||||||||||||||||||||||||||
| 1243 | Qt::AlignLeft | Qt::AlignVCenter | Qt::TextShowMnemonic, dwOpt->palette, | - | ||||||||||||||||||||||||||||||||||||
| 1244 | dwOpt->state & State_Enabled, titleText, | - | ||||||||||||||||||||||||||||||||||||
| 1245 | QPalette::WindowText); | - | ||||||||||||||||||||||||||||||||||||
| 1246 | } never executed: end of block | 0 | ||||||||||||||||||||||||||||||||||||
| 1247 | } never executed: end of block | 0 | ||||||||||||||||||||||||||||||||||||
| 1248 | painter->restore(); | - | ||||||||||||||||||||||||||||||||||||
| 1249 | break; never executed: break; | 0 | ||||||||||||||||||||||||||||||||||||
| 1250 | case CE_HeaderSection: never executed: case CE_HeaderSection: | 0 | ||||||||||||||||||||||||||||||||||||
| 1251 | painter->save(); | - | ||||||||||||||||||||||||||||||||||||
| 1252 | // Draws the header in tables. | - | ||||||||||||||||||||||||||||||||||||
| 1253 | if (const QStyleOptionHeader *header = qstyleoption_cast<const QStyleOptionHeader *>(option)) {
| 0 | ||||||||||||||||||||||||||||||||||||
| 1254 | QString pixmapName = QStyleHelper::uniqueName(QLatin1String("headersection"), option, option->rect.size()); | - | ||||||||||||||||||||||||||||||||||||
| 1255 | pixmapName += QString::number(- int(header->position)); | - | ||||||||||||||||||||||||||||||||||||
| 1256 | pixmapName += QString::number(- int(header->orientation)); | - | ||||||||||||||||||||||||||||||||||||
| 1257 | - | |||||||||||||||||||||||||||||||||||||
| 1258 | QPixmap cache; | - | ||||||||||||||||||||||||||||||||||||
| 1259 | if (!QPixmapCache::find(pixmapName, cache)) {
| 0 | ||||||||||||||||||||||||||||||||||||
| 1260 | cache = styleCachePixmap(rect.size()); | - | ||||||||||||||||||||||||||||||||||||
| 1261 | cache.fill(Qt::transparent); | - | ||||||||||||||||||||||||||||||||||||
| 1262 | QRect pixmapRect(0, 0, rect.width(), rect.height()); | - | ||||||||||||||||||||||||||||||||||||
| 1263 | QPainter cachePainter(&cache); | - | ||||||||||||||||||||||||||||||||||||
| 1264 | QColor buttonColor = d->buttonColor(option->palette); | - | ||||||||||||||||||||||||||||||||||||
| 1265 | QColor gradientStopColor; | - | ||||||||||||||||||||||||||||||||||||
| 1266 | QColor gradientStartColor = buttonColor.lighter(104); | - | ||||||||||||||||||||||||||||||||||||
| 1267 | gradientStopColor = buttonColor.darker(102); | - | ||||||||||||||||||||||||||||||||||||
| 1268 | QLinearGradient gradient(pixmapRect.topLeft(), pixmapRect.bottomLeft()); | - | ||||||||||||||||||||||||||||||||||||
| 1269 | - | |||||||||||||||||||||||||||||||||||||
| 1270 | if (option->palette.background().gradient()) {
| 0 | ||||||||||||||||||||||||||||||||||||
| 1271 | gradient.setStops(option->palette.background().gradient()->stops()); | - | ||||||||||||||||||||||||||||||||||||
| 1272 | } else { never executed: end of block | 0 | ||||||||||||||||||||||||||||||||||||
| 1273 | QColor midColor1 = mergedColors(gradientStartColor, gradientStopColor, 60); | - | ||||||||||||||||||||||||||||||||||||
| 1274 | QColor midColor2 = mergedColors(gradientStartColor, gradientStopColor, 40); | - | ||||||||||||||||||||||||||||||||||||
| 1275 | gradient.setColorAt(0, gradientStartColor); | - | ||||||||||||||||||||||||||||||||||||
| 1276 | gradient.setColorAt(0.5, midColor1); | - | ||||||||||||||||||||||||||||||||||||
| 1277 | gradient.setColorAt(0.501, midColor2); | - | ||||||||||||||||||||||||||||||||||||
| 1278 | gradient.setColorAt(0.92, gradientStopColor); | - | ||||||||||||||||||||||||||||||||||||
| 1279 | gradient.setColorAt(1, gradientStopColor.darker(104)); | - | ||||||||||||||||||||||||||||||||||||
| 1280 | } never executed: end of block | 0 | ||||||||||||||||||||||||||||||||||||
| 1281 | cachePainter.fillRect(pixmapRect, gradient); | - | ||||||||||||||||||||||||||||||||||||
| 1282 | cachePainter.setPen(d->innerContrastLine()); | - | ||||||||||||||||||||||||||||||||||||
| 1283 | cachePainter.setBrush(Qt::NoBrush); | - | ||||||||||||||||||||||||||||||||||||
| 1284 | cachePainter.drawLine(pixmapRect.topLeft(), pixmapRect.topRight()); | - | ||||||||||||||||||||||||||||||||||||
| 1285 | cachePainter.setPen(d->outline(option->palette)); | - | ||||||||||||||||||||||||||||||||||||
| 1286 | cachePainter.drawLine(pixmapRect.bottomLeft(), pixmapRect.bottomRight()); | - | ||||||||||||||||||||||||||||||||||||
| 1287 | - | |||||||||||||||||||||||||||||||||||||
| 1288 | if (header->orientation == Qt::Horizontal &&
| 0 | ||||||||||||||||||||||||||||||||||||
| 1289 | header->position != QStyleOptionHeader::End &&
| 0 | ||||||||||||||||||||||||||||||||||||
| 1290 | header->position != QStyleOptionHeader::OnlyOneSection) {
| 0 | ||||||||||||||||||||||||||||||||||||
| 1291 | cachePainter.setPen(QColor(0, 0, 0, 40)); | - | ||||||||||||||||||||||||||||||||||||
| 1292 | cachePainter.drawLine(pixmapRect.topRight(), pixmapRect.bottomRight() + QPoint(0, -1)); | - | ||||||||||||||||||||||||||||||||||||
| 1293 | cachePainter.setPen(d->innerContrastLine()); | - | ||||||||||||||||||||||||||||||||||||
| 1294 | cachePainter.drawLine(pixmapRect.topRight() + QPoint(-1, 0), pixmapRect.bottomRight() + QPoint(-1, -1)); | - | ||||||||||||||||||||||||||||||||||||
| 1295 | } else if (header->orientation == Qt::Vertical) { never executed: end of block
| 0 | ||||||||||||||||||||||||||||||||||||
| 1296 | cachePainter.setPen(d->outline(option->palette)); | - | ||||||||||||||||||||||||||||||||||||
| 1297 | cachePainter.drawLine(pixmapRect.topRight(), pixmapRect.bottomRight()); | - | ||||||||||||||||||||||||||||||||||||
| 1298 | } never executed: end of block | 0 | ||||||||||||||||||||||||||||||||||||
| 1299 | cachePainter.end(); | - | ||||||||||||||||||||||||||||||||||||
| 1300 | QPixmapCache::insert(pixmapName, cache); | - | ||||||||||||||||||||||||||||||||||||
| 1301 | } never executed: end of block | 0 | ||||||||||||||||||||||||||||||||||||
| 1302 | painter->drawPixmap(rect.topLeft(), cache); | - | ||||||||||||||||||||||||||||||||||||
| 1303 | } never executed: end of block | 0 | ||||||||||||||||||||||||||||||||||||
| 1304 | painter->restore(); | - | ||||||||||||||||||||||||||||||||||||
| 1305 | break; never executed: break; | 0 | ||||||||||||||||||||||||||||||||||||
| 1306 | case CE_ProgressBarGroove: never executed: case CE_ProgressBarGroove: | 0 | ||||||||||||||||||||||||||||||||||||
| 1307 | painter->save(); | - | ||||||||||||||||||||||||||||||||||||
| 1308 | { | - | ||||||||||||||||||||||||||||||||||||
| 1309 | painter->setRenderHint(QPainter::Antialiasing, true); | - | ||||||||||||||||||||||||||||||||||||
| 1310 | painter->translate(0.5, 0.5); | - | ||||||||||||||||||||||||||||||||||||
| 1311 | - | |||||||||||||||||||||||||||||||||||||
| 1312 | QColor shadowAlpha = Qt::black; | - | ||||||||||||||||||||||||||||||||||||
| 1313 | shadowAlpha.setAlpha(16); | - | ||||||||||||||||||||||||||||||||||||
| 1314 | painter->setPen(shadowAlpha); | - | ||||||||||||||||||||||||||||||||||||
| 1315 | painter->drawLine(rect.topLeft() - QPoint(0, 1), rect.topRight() - QPoint(0, 1)); | - | ||||||||||||||||||||||||||||||||||||
| 1316 | - | |||||||||||||||||||||||||||||||||||||
| 1317 | painter->setBrush(option->palette.base()); | - | ||||||||||||||||||||||||||||||||||||
| 1318 | painter->setPen(QPen(outline)); | - | ||||||||||||||||||||||||||||||||||||
| 1319 | painter->drawRoundedRect(rect.adjusted(0, 0, -1, -1), 2, 2); | - | ||||||||||||||||||||||||||||||||||||
| 1320 | - | |||||||||||||||||||||||||||||||||||||
| 1321 | // Inner shadow | - | ||||||||||||||||||||||||||||||||||||
| 1322 | painter->setPen(d->topShadow()); | - | ||||||||||||||||||||||||||||||||||||
| 1323 | painter->drawLine(QPoint(rect.left() + 1, rect.top() + 1), | - | ||||||||||||||||||||||||||||||||||||
| 1324 | QPoint(rect.right() - 1, rect.top() + 1)); | - | ||||||||||||||||||||||||||||||||||||
| 1325 | } | - | ||||||||||||||||||||||||||||||||||||
| 1326 | painter->restore(); | - | ||||||||||||||||||||||||||||||||||||
| 1327 | break; never executed: break; | 0 | ||||||||||||||||||||||||||||||||||||
| 1328 | case CE_ProgressBarContents: never executed: case CE_ProgressBarContents: | 0 | ||||||||||||||||||||||||||||||||||||
| 1329 | painter->save(); | - | ||||||||||||||||||||||||||||||||||||
| 1330 | painter->setRenderHint(QPainter::Antialiasing, true); | - | ||||||||||||||||||||||||||||||||||||
| 1331 | painter->translate(0.5, 0.5); | - | ||||||||||||||||||||||||||||||||||||
| 1332 | if (const QStyleOptionProgressBar *bar = qstyleoption_cast<const QStyleOptionProgressBar *>(option)) {
| 0 | ||||||||||||||||||||||||||||||||||||
| 1333 | bool vertical = false; | - | ||||||||||||||||||||||||||||||||||||
| 1334 | bool inverted = false; | - | ||||||||||||||||||||||||||||||||||||
| 1335 | bool indeterminate = (bar->minimum == 0 && bar->maximum == 0);
| 0 | ||||||||||||||||||||||||||||||||||||
| 1336 | bool complete = bar->progress == bar->maximum; | - | ||||||||||||||||||||||||||||||||||||
| 1337 | - | |||||||||||||||||||||||||||||||||||||
| 1338 | // Get extra style options if version 2 | - | ||||||||||||||||||||||||||||||||||||
| 1339 | vertical = (bar->orientation == Qt::Vertical); | - | ||||||||||||||||||||||||||||||||||||
| 1340 | inverted = bar->invertedAppearance; | - | ||||||||||||||||||||||||||||||||||||
| 1341 | - | |||||||||||||||||||||||||||||||||||||
| 1342 | // If the orientation is vertical, we use a transform to rotate | - | ||||||||||||||||||||||||||||||||||||
| 1343 | // the progress bar 90 degrees clockwise. This way we can use the | - | ||||||||||||||||||||||||||||||||||||
| 1344 | // same rendering code for both orientations. | - | ||||||||||||||||||||||||||||||||||||
| 1345 | if (vertical) {
| 0 | ||||||||||||||||||||||||||||||||||||
| 1346 | rect = QRect(rect.left(), rect.top(), rect.height(), rect.width()); // flip width and height | - | ||||||||||||||||||||||||||||||||||||
| 1347 | QTransform m = QTransform::fromTranslate(rect.height()-1, -1.0); | - | ||||||||||||||||||||||||||||||||||||
| 1348 | m.rotate(90.0); | - | ||||||||||||||||||||||||||||||||||||
| 1349 | painter->setTransform(m, true); | - | ||||||||||||||||||||||||||||||||||||
| 1350 | } never executed: end of block | 0 | ||||||||||||||||||||||||||||||||||||
| 1351 | - | |||||||||||||||||||||||||||||||||||||
| 1352 | int maxWidth = rect.width(); | - | ||||||||||||||||||||||||||||||||||||
| 1353 | int minWidth = 0; | - | ||||||||||||||||||||||||||||||||||||
| 1354 | qreal progress = qMax(bar->progress, bar->minimum); // workaround for bug in QProgressBar | - | ||||||||||||||||||||||||||||||||||||
| 1355 | int progressBarWidth = (progress - bar->minimum) * qreal(maxWidth) / qMax(qreal(1.0), qreal(bar->maximum) - bar->minimum); | - | ||||||||||||||||||||||||||||||||||||
| 1356 | int width = indeterminate ? maxWidth : qMax(minWidth, progressBarWidth);
| 0 | ||||||||||||||||||||||||||||||||||||
| 1357 | - | |||||||||||||||||||||||||||||||||||||
| 1358 | bool reverse = (!vertical && (bar->direction == Qt::RightToLeft)) || vertical;
| 0 | ||||||||||||||||||||||||||||||||||||
| 1359 | if (inverted)
| 0 | ||||||||||||||||||||||||||||||||||||
| 1360 | reverse = !reverse; never executed: reverse = !reverse; | 0 | ||||||||||||||||||||||||||||||||||||
| 1361 | - | |||||||||||||||||||||||||||||||||||||
| 1362 | int step = 0; | - | ||||||||||||||||||||||||||||||||||||
| 1363 | QRect progressBar; | - | ||||||||||||||||||||||||||||||||||||
| 1364 | QColor highlight = d->highlight(option->palette); | - | ||||||||||||||||||||||||||||||||||||
| 1365 | QColor highlightedoutline = highlight.darker(140); | - | ||||||||||||||||||||||||||||||||||||
| 1366 | if (qGray(outline.rgb()) > qGray(highlightedoutline.rgb()))
| 0 | ||||||||||||||||||||||||||||||||||||
| 1367 | outline = highlightedoutline; never executed: outline = highlightedoutline; | 0 | ||||||||||||||||||||||||||||||||||||
| 1368 | - | |||||||||||||||||||||||||||||||||||||
| 1369 | if (!indeterminate) {
| 0 | ||||||||||||||||||||||||||||||||||||
| 1370 | QColor innerShadow(Qt::black); | - | ||||||||||||||||||||||||||||||||||||
| 1371 | innerShadow.setAlpha(35); | - | ||||||||||||||||||||||||||||||||||||
| 1372 | painter->setPen(innerShadow); | - | ||||||||||||||||||||||||||||||||||||
| 1373 | if (!reverse) {
| 0 | ||||||||||||||||||||||||||||||||||||
| 1374 | progressBar.setRect(rect.left(), rect.top(), width - 1, rect.height() - 1); | - | ||||||||||||||||||||||||||||||||||||
| 1375 | if (!complete) {
| 0 | ||||||||||||||||||||||||||||||||||||
| 1376 | painter->drawLine(progressBar.topRight() + QPoint(2, 1), progressBar.bottomRight() + QPoint(2, 0)); | - | ||||||||||||||||||||||||||||||||||||
| 1377 | painter->setPen(QPen(highlight.darker(140))); | - | ||||||||||||||||||||||||||||||||||||
| 1378 | painter->drawLine(progressBar.topRight() + QPoint(1, 1), progressBar.bottomRight() + QPoint(1, 0)); | - | ||||||||||||||||||||||||||||||||||||
| 1379 | } never executed: end of block | 0 | ||||||||||||||||||||||||||||||||||||
| 1380 | } else { never executed: end of block | 0 | ||||||||||||||||||||||||||||||||||||
| 1381 | progressBar.setRect(rect.right() - width - 1, rect.top(), width + 2, rect.height() - 1); | - | ||||||||||||||||||||||||||||||||||||
| 1382 | if (!complete) {
| 0 | ||||||||||||||||||||||||||||||||||||
| 1383 | painter->drawLine(progressBar.topLeft() + QPoint(-2, 1), progressBar.bottomLeft() + QPoint(-2, 0)); | - | ||||||||||||||||||||||||||||||||||||
| 1384 | painter->setPen(QPen(highlight.darker(140))); | - | ||||||||||||||||||||||||||||||||||||
| 1385 | painter->drawLine(progressBar.topLeft() + QPoint(-1, 1), progressBar.bottomLeft() + QPoint(-1, 0)); | - | ||||||||||||||||||||||||||||||||||||
| 1386 | } never executed: end of block | 0 | ||||||||||||||||||||||||||||||||||||
| 1387 | } never executed: end of block | 0 | ||||||||||||||||||||||||||||||||||||
| 1388 | } else { | - | ||||||||||||||||||||||||||||||||||||
| 1389 | progressBar.setRect(rect.left(), rect.top(), rect.width() - 1, rect.height() - 1); | - | ||||||||||||||||||||||||||||||||||||
| 1390 | } never executed: end of block | 0 | ||||||||||||||||||||||||||||||||||||
| 1391 | - | |||||||||||||||||||||||||||||||||||||
| 1392 | if (indeterminate || bar->progress > bar->minimum) {
| 0 | ||||||||||||||||||||||||||||||||||||
| 1393 | - | |||||||||||||||||||||||||||||||||||||
| 1394 | painter->setPen(QPen(outline)); | - | ||||||||||||||||||||||||||||||||||||
| 1395 | - | |||||||||||||||||||||||||||||||||||||
| 1396 | QColor highlightedGradientStartColor = highlight.lighter(120); | - | ||||||||||||||||||||||||||||||||||||
| 1397 | QColor highlightedGradientStopColor = highlight; | - | ||||||||||||||||||||||||||||||||||||
| 1398 | QLinearGradient gradient(rect.topLeft(), QPoint(rect.bottomLeft().x(), rect.bottomLeft().y())); | - | ||||||||||||||||||||||||||||||||||||
| 1399 | gradient.setColorAt(0, highlightedGradientStartColor); | - | ||||||||||||||||||||||||||||||||||||
| 1400 | gradient.setColorAt(1, highlightedGradientStopColor); | - | ||||||||||||||||||||||||||||||||||||
| 1401 | - | |||||||||||||||||||||||||||||||||||||
| 1402 | painter->setBrush(gradient); | - | ||||||||||||||||||||||||||||||||||||
| 1403 | - | |||||||||||||||||||||||||||||||||||||
| 1404 | painter->save(); | - | ||||||||||||||||||||||||||||||||||||
| 1405 | if (!complete && !indeterminate)
| 0 | ||||||||||||||||||||||||||||||||||||
| 1406 | painter->setClipRect(progressBar.adjusted(-1, -1, -1, 1)); never executed: painter->setClipRect(progressBar.adjusted(-1, -1, -1, 1)); | 0 | ||||||||||||||||||||||||||||||||||||
| 1407 | QRect fillRect = progressBar.adjusted( !indeterminate && !complete && reverse ? -2 : 0, 0, | - | ||||||||||||||||||||||||||||||||||||
| 1408 | indeterminate || complete || reverse ? 0 : 2, 0); | - | ||||||||||||||||||||||||||||||||||||
| 1409 | painter->drawRoundedRect(fillRect, 2, 2); | - | ||||||||||||||||||||||||||||||||||||
| 1410 | painter->restore(); | - | ||||||||||||||||||||||||||||||||||||
| 1411 | - | |||||||||||||||||||||||||||||||||||||
| 1412 | painter->setBrush(Qt::NoBrush); | - | ||||||||||||||||||||||||||||||||||||
| 1413 | painter->setPen(QColor(255, 255, 255, 50)); | - | ||||||||||||||||||||||||||||||||||||
| 1414 | painter->drawRoundedRect(progressBar.adjusted(1, 1, -1, -1), 1, 1); | - | ||||||||||||||||||||||||||||||||||||
| 1415 | - | |||||||||||||||||||||||||||||||||||||
| 1416 | if (!indeterminate) {
| 0 | ||||||||||||||||||||||||||||||||||||
| 1417 | #ifndef QT_NO_ANIMATION | - | ||||||||||||||||||||||||||||||||||||
| 1418 | (const_cast<QFusionStylePrivate*>(d))->stopAnimation(option->styleObject); | - | ||||||||||||||||||||||||||||||||||||
| 1419 | #endif | - | ||||||||||||||||||||||||||||||||||||
| 1420 | } else { never executed: end of block | 0 | ||||||||||||||||||||||||||||||||||||
| 1421 | highlightedGradientStartColor.setAlpha(120); | - | ||||||||||||||||||||||||||||||||||||
| 1422 | painter->setPen(QPen(highlightedGradientStartColor, 9.0)); | - | ||||||||||||||||||||||||||||||||||||
| 1423 | painter->setClipRect(progressBar.adjusted(1, 1, -1, -1)); | - | ||||||||||||||||||||||||||||||||||||
| 1424 | #ifndef QT_NO_ANIMATION | - | ||||||||||||||||||||||||||||||||||||
| 1425 | if (QProgressStyleAnimation *animation = qobject_cast<QProgressStyleAnimation*>(d->animation(option->styleObject)))
| 0 | ||||||||||||||||||||||||||||||||||||
| 1426 | step = animation->animationStep() % 22; never executed: step = animation->animationStep() % 22; | 0 | ||||||||||||||||||||||||||||||||||||
| 1427 | else | - | ||||||||||||||||||||||||||||||||||||
| 1428 | (const_cast<QFusionStylePrivate*>(d))->startAnimation(new QProgressStyleAnimation(d->animationFps, option->styleObject)); never executed: (const_cast<QFusionStylePrivate*>(d))->startAnimation(new QProgressStyleAnimation(d->animationFps, option->styleObject)); | 0 | ||||||||||||||||||||||||||||||||||||
| 1429 | #endif | - | ||||||||||||||||||||||||||||||||||||
| 1430 | for (int x = progressBar.left() - rect.height(); x < rect.right() ; x += 22)
| 0 | ||||||||||||||||||||||||||||||||||||
| 1431 | painter->drawLine(x + step, progressBar.bottom() + 1, never executed: painter->drawLine(x + step, progressBar.bottom() + 1, x + rect.height() + step, progressBar.top() - 2); | 0 | ||||||||||||||||||||||||||||||||||||
| 1432 | x + rect.height() + step, progressBar.top() - 2); never executed: painter->drawLine(x + step, progressBar.bottom() + 1, x + rect.height() + step, progressBar.top() - 2); | 0 | ||||||||||||||||||||||||||||||||||||
| 1433 | } never executed: end of block | 0 | ||||||||||||||||||||||||||||||||||||
| 1434 | } | - | ||||||||||||||||||||||||||||||||||||
| 1435 | } never executed: end of block | 0 | ||||||||||||||||||||||||||||||||||||
| 1436 | painter->restore(); | - | ||||||||||||||||||||||||||||||||||||
| 1437 | break; never executed: break; | 0 | ||||||||||||||||||||||||||||||||||||
| 1438 | case CE_ProgressBarLabel: never executed: case CE_ProgressBarLabel: | 0 | ||||||||||||||||||||||||||||||||||||
| 1439 | if (const QStyleOptionProgressBar *bar = qstyleoption_cast<const QStyleOptionProgressBar *>(option)) {
| 0 | ||||||||||||||||||||||||||||||||||||
| 1440 | QRect leftRect; | - | ||||||||||||||||||||||||||||||||||||
| 1441 | QRect rect = bar->rect; | - | ||||||||||||||||||||||||||||||||||||
| 1442 | QColor textColor = option->palette.text().color(); | - | ||||||||||||||||||||||||||||||||||||
| 1443 | QColor alternateTextColor = d->highlightedText(option->palette); | - | ||||||||||||||||||||||||||||||||||||
| 1444 | - | |||||||||||||||||||||||||||||||||||||
| 1445 | painter->save(); | - | ||||||||||||||||||||||||||||||||||||
| 1446 | bool vertical = false, inverted = false; | - | ||||||||||||||||||||||||||||||||||||
| 1447 | vertical = (bar->orientation == Qt::Vertical); | - | ||||||||||||||||||||||||||||||||||||
| 1448 | inverted = bar->invertedAppearance; | - | ||||||||||||||||||||||||||||||||||||
| 1449 | if (vertical)
| 0 | ||||||||||||||||||||||||||||||||||||
| 1450 | rect = QRect(rect.left(), rect.top(), rect.height(), rect.width()); // flip width and height never executed: rect = QRect(rect.left(), rect.top(), rect.height(), rect.width()); | 0 | ||||||||||||||||||||||||||||||||||||
| 1451 | const int progressIndicatorPos = (bar->progress - qreal(bar->minimum)) * rect.width() / | - | ||||||||||||||||||||||||||||||||||||
| 1452 | qMax(qreal(1.0), qreal(bar->maximum) - bar->minimum); | - | ||||||||||||||||||||||||||||||||||||
| 1453 | if (progressIndicatorPos >= 0 && progressIndicatorPos <= rect.width())
| 0 | ||||||||||||||||||||||||||||||||||||
| 1454 | leftRect = QRect(rect.left(), rect.top(), progressIndicatorPos, rect.height()); never executed: leftRect = QRect(rect.left(), rect.top(), progressIndicatorPos, rect.height()); | 0 | ||||||||||||||||||||||||||||||||||||
| 1455 | if (vertical)
| 0 | ||||||||||||||||||||||||||||||||||||
| 1456 | leftRect.translate(rect.width() - progressIndicatorPos, 0); never executed: leftRect.translate(rect.width() - progressIndicatorPos, 0); | 0 | ||||||||||||||||||||||||||||||||||||
| 1457 | - | |||||||||||||||||||||||||||||||||||||
| 1458 | bool flip = (!vertical && (((bar->direction == Qt::RightToLeft) && !inverted) ||
| 0 | ||||||||||||||||||||||||||||||||||||
| 1459 | ((bar->direction == Qt::LeftToRight) && inverted)));
| 0 | ||||||||||||||||||||||||||||||||||||
| 1460 | - | |||||||||||||||||||||||||||||||||||||
| 1461 | QRegion rightRect = rect; | - | ||||||||||||||||||||||||||||||||||||
| 1462 | rightRect = rightRect.subtracted(leftRect); | - | ||||||||||||||||||||||||||||||||||||
| 1463 | painter->setClipRegion(rightRect); | - | ||||||||||||||||||||||||||||||||||||
| 1464 | painter->setPen(flip ? alternateTextColor : textColor); | - | ||||||||||||||||||||||||||||||||||||
| 1465 | painter->drawText(rect, bar->text, QTextOption(Qt::AlignAbsolute | Qt::AlignHCenter | Qt::AlignVCenter)); | - | ||||||||||||||||||||||||||||||||||||
| 1466 | if (!leftRect.isNull()) {
| 0 | ||||||||||||||||||||||||||||||||||||
| 1467 | painter->setPen(flip ? textColor : alternateTextColor); | - | ||||||||||||||||||||||||||||||||||||
| 1468 | painter->setClipRect(leftRect); | - | ||||||||||||||||||||||||||||||||||||
| 1469 | painter->drawText(rect, bar->text, QTextOption(Qt::AlignAbsolute | Qt::AlignHCenter | Qt::AlignVCenter)); | - | ||||||||||||||||||||||||||||||||||||
| 1470 | } never executed: end of block | 0 | ||||||||||||||||||||||||||||||||||||
| 1471 | painter->restore(); | - | ||||||||||||||||||||||||||||||||||||
| 1472 | } never executed: end of block | 0 | ||||||||||||||||||||||||||||||||||||
| 1473 | break; never executed: break; | 0 | ||||||||||||||||||||||||||||||||||||
| 1474 | case CE_MenuBarItem: never executed: case CE_MenuBarItem: | 0 | ||||||||||||||||||||||||||||||||||||
| 1475 | painter->save(); | - | ||||||||||||||||||||||||||||||||||||
| 1476 | if (const QStyleOptionMenuItem *mbi = qstyleoption_cast<const QStyleOptionMenuItem *>(option))
| 0 | ||||||||||||||||||||||||||||||||||||
| 1477 | { | - | ||||||||||||||||||||||||||||||||||||
| 1478 | QStyleOptionMenuItem item = *mbi; | - | ||||||||||||||||||||||||||||||||||||
| 1479 | item.rect = mbi->rect.adjusted(0, 1, 0, -3); | - | ||||||||||||||||||||||||||||||||||||
| 1480 | QColor highlightOutline = option->palette.highlight().color().darker(125); | - | ||||||||||||||||||||||||||||||||||||
| 1481 | painter->fillRect(rect, option->palette.window()); | - | ||||||||||||||||||||||||||||||||||||
| 1482 | - | |||||||||||||||||||||||||||||||||||||
| 1483 | QCommonStyle::drawControl(element, &item, painter, widget); | - | ||||||||||||||||||||||||||||||||||||
| 1484 | - | |||||||||||||||||||||||||||||||||||||
| 1485 | bool act = mbi->state & State_Selected && mbi->state & State_Sunken;
| 0 | ||||||||||||||||||||||||||||||||||||
| 1486 | bool dis = !(mbi->state & State_Enabled); | - | ||||||||||||||||||||||||||||||||||||
| 1487 | - | |||||||||||||||||||||||||||||||||||||
| 1488 | QRect r = option->rect; | - | ||||||||||||||||||||||||||||||||||||
| 1489 | if (act) {
| 0 | ||||||||||||||||||||||||||||||||||||
| 1490 | painter->setBrush(option->palette.highlight().color()); | - | ||||||||||||||||||||||||||||||||||||
| 1491 | painter->setPen(QPen(highlightOutline)); | - | ||||||||||||||||||||||||||||||||||||
| 1492 | painter->drawRect(r.adjusted(0, 0, -1, -1)); | - | ||||||||||||||||||||||||||||||||||||
| 1493 | - | |||||||||||||||||||||||||||||||||||||
| 1494 | // painter->drawRoundedRect(r.adjusted(1, 1, -1, -1), 2, 2); | - | ||||||||||||||||||||||||||||||||||||
| 1495 | - | |||||||||||||||||||||||||||||||||||||
| 1496 | //draw text | - | ||||||||||||||||||||||||||||||||||||
| 1497 | QPalette::ColorRole textRole = dis ? QPalette::Text : QPalette::HighlightedText;
| 0 | ||||||||||||||||||||||||||||||||||||
| 1498 | uint alignment = Qt::AlignCenter | Qt::TextShowMnemonic | Qt::TextDontClip | Qt::TextSingleLine; | - | ||||||||||||||||||||||||||||||||||||
| 1499 | if (!styleHint(SH_UnderlineShortcut, mbi, widget))
| 0 | ||||||||||||||||||||||||||||||||||||
| 1500 | alignment |= Qt::TextHideMnemonic; never executed: alignment |= Qt::TextHideMnemonic; | 0 | ||||||||||||||||||||||||||||||||||||
| 1501 | proxy()->drawItemText(painter, item.rect, alignment, mbi->palette, mbi->state & State_Enabled, mbi->text, textRole); | - | ||||||||||||||||||||||||||||||||||||
| 1502 | } else { never executed: end of block | 0 | ||||||||||||||||||||||||||||||||||||
| 1503 | - | |||||||||||||||||||||||||||||||||||||
| 1504 | QColor shadow = mergedColors(option->palette.background().color().darker(120), | - | ||||||||||||||||||||||||||||||||||||
| 1505 | outline.lighter(140), 60); | - | ||||||||||||||||||||||||||||||||||||
| 1506 | painter->setPen(QPen(shadow)); | - | ||||||||||||||||||||||||||||||||||||
| 1507 | painter->drawLine(option->rect.bottomLeft(), option->rect.bottomRight()); | - | ||||||||||||||||||||||||||||||||||||
| 1508 | } never executed: end of block | 0 | ||||||||||||||||||||||||||||||||||||
| 1509 | } | - | ||||||||||||||||||||||||||||||||||||
| 1510 | painter->restore(); | - | ||||||||||||||||||||||||||||||||||||
| 1511 | break; never executed: break; | 0 | ||||||||||||||||||||||||||||||||||||
| 1512 | case CE_MenuItem: never executed: case CE_MenuItem: | 0 | ||||||||||||||||||||||||||||||||||||
| 1513 | painter->save(); | - | ||||||||||||||||||||||||||||||||||||
| 1514 | // Draws one item in a popup menu. | - | ||||||||||||||||||||||||||||||||||||
| 1515 | if (const QStyleOptionMenuItem *menuItem = qstyleoption_cast<const QStyleOptionMenuItem *>(option)) {
| 0 | ||||||||||||||||||||||||||||||||||||
| 1516 | QColor highlightOutline = highlightedOutline; | - | ||||||||||||||||||||||||||||||||||||
| 1517 | QColor highlight = option->palette.highlight().color(); | - | ||||||||||||||||||||||||||||||||||||
| 1518 | if (menuItem->menuItemType == QStyleOptionMenuItem::Separator) {
| 0 | ||||||||||||||||||||||||||||||||||||
| 1519 | int w = 0; | - | ||||||||||||||||||||||||||||||||||||
| 1520 | if (!menuItem->text.isEmpty()) {
| 0 | ||||||||||||||||||||||||||||||||||||
| 1521 | painter->setFont(menuItem->font); | - | ||||||||||||||||||||||||||||||||||||
| 1522 | proxy()->drawItemText(painter, menuItem->rect.adjusted(5, 0, -5, 0), Qt::AlignLeft | Qt::AlignVCenter, | - | ||||||||||||||||||||||||||||||||||||
| 1523 | menuItem->palette, menuItem->state & State_Enabled, menuItem->text, | - | ||||||||||||||||||||||||||||||||||||
| 1524 | QPalette::Text); | - | ||||||||||||||||||||||||||||||||||||
| 1525 | w = menuItem->fontMetrics.width(menuItem->text) + 5; | - | ||||||||||||||||||||||||||||||||||||
| 1526 | } never executed: end of block | 0 | ||||||||||||||||||||||||||||||||||||
| 1527 | painter->setPen(shadow.lighter(106)); | - | ||||||||||||||||||||||||||||||||||||
| 1528 | bool reverse = menuItem->direction == Qt::RightToLeft; | - | ||||||||||||||||||||||||||||||||||||
| 1529 | painter->drawLine(menuItem->rect.left() + 5 + (reverse ? 0 : w), menuItem->rect.center().y(), | - | ||||||||||||||||||||||||||||||||||||
| 1530 | menuItem->rect.right() - 5 - (reverse ? w : 0), menuItem->rect.center().y()); | - | ||||||||||||||||||||||||||||||||||||
| 1531 | painter->restore(); | - | ||||||||||||||||||||||||||||||||||||
| 1532 | break; never executed: break; | 0 | ||||||||||||||||||||||||||||||||||||
| 1533 | } | - | ||||||||||||||||||||||||||||||||||||
| 1534 | bool selected = menuItem->state & State_Selected && menuItem->state & State_Enabled;
| 0 | ||||||||||||||||||||||||||||||||||||
| 1535 | if (selected) {
| 0 | ||||||||||||||||||||||||||||||||||||
| 1536 | QRect r = option->rect; | - | ||||||||||||||||||||||||||||||||||||
| 1537 | painter->fillRect(r, highlight); | - | ||||||||||||||||||||||||||||||||||||
| 1538 | painter->setPen(QPen(highlightOutline)); | - | ||||||||||||||||||||||||||||||||||||
| 1539 | painter->drawRect(QRectF(r).adjusted(0.5, 0.5, -0.5, -0.5)); | - | ||||||||||||||||||||||||||||||||||||
| 1540 | } never executed: end of block | 0 | ||||||||||||||||||||||||||||||||||||
| 1541 | bool checkable = menuItem->checkType != QStyleOptionMenuItem::NotCheckable; | - | ||||||||||||||||||||||||||||||||||||
| 1542 | bool checked = menuItem->checked; | - | ||||||||||||||||||||||||||||||||||||
| 1543 | bool sunken = menuItem->state & State_Sunken; | - | ||||||||||||||||||||||||||||||||||||
| 1544 | bool enabled = menuItem->state & State_Enabled; | - | ||||||||||||||||||||||||||||||||||||
| 1545 | - | |||||||||||||||||||||||||||||||||||||
| 1546 | bool ignoreCheckMark = false; | - | ||||||||||||||||||||||||||||||||||||
| 1547 | int checkcol = qMax(menuItem->maxIconWidth, 20); | - | ||||||||||||||||||||||||||||||||||||
| 1548 | - | |||||||||||||||||||||||||||||||||||||
| 1549 | if (qobject_cast<const QComboBox*>(widget) ||
| 0 | ||||||||||||||||||||||||||||||||||||
| 1550 | (option->styleObject && option->styleObject->property("_q_isComboBoxPopupItem").toBool()))
| 0 | ||||||||||||||||||||||||||||||||||||
| 1551 | ignoreCheckMark = true; //ignore the checkmarks provided by the QComboMenuDelegate never executed: ignoreCheckMark = true; | 0 | ||||||||||||||||||||||||||||||||||||
| 1552 | - | |||||||||||||||||||||||||||||||||||||
| 1553 | if (!ignoreCheckMark) {
| 0 | ||||||||||||||||||||||||||||||||||||
| 1554 | // Check | - | ||||||||||||||||||||||||||||||||||||
| 1555 | QRect checkRect(option->rect.left() + 7, option->rect.center().y() - 6, 14, 14); | - | ||||||||||||||||||||||||||||||||||||
| 1556 | checkRect = visualRect(menuItem->direction, menuItem->rect, checkRect); | - | ||||||||||||||||||||||||||||||||||||
| 1557 | if (checkable) {
| 0 | ||||||||||||||||||||||||||||||||||||
| 1558 | if (menuItem->checkType & QStyleOptionMenuItem::Exclusive) {
| 0 | ||||||||||||||||||||||||||||||||||||
| 1559 | // Radio button | - | ||||||||||||||||||||||||||||||||||||
| 1560 | if (checked || sunken) {
| 0 | ||||||||||||||||||||||||||||||||||||
| 1561 | painter->setRenderHint(QPainter::Antialiasing); | - | ||||||||||||||||||||||||||||||||||||
| 1562 | painter->setPen(Qt::NoPen); | - | ||||||||||||||||||||||||||||||||||||
| 1563 | - | |||||||||||||||||||||||||||||||||||||
| 1564 | QPalette::ColorRole textRole = !enabled ? QPalette::Text:
| 0 | ||||||||||||||||||||||||||||||||||||
| 1565 | selected ? QPalette::HighlightedText : QPalette::ButtonText;
| 0 | ||||||||||||||||||||||||||||||||||||
| 1566 | painter->setBrush(option->palette.brush( option->palette.currentColorGroup(), textRole)); | - | ||||||||||||||||||||||||||||||||||||
| 1567 | painter->drawEllipse(checkRect.adjusted(4, 4, -4, -4)); | - | ||||||||||||||||||||||||||||||||||||
| 1568 | } never executed: end of block | 0 | ||||||||||||||||||||||||||||||||||||
| 1569 | } else { never executed: end of block | 0 | ||||||||||||||||||||||||||||||||||||
| 1570 | // Check box | - | ||||||||||||||||||||||||||||||||||||
| 1571 | if (menuItem->icon.isNull()) {
| 0 | ||||||||||||||||||||||||||||||||||||
| 1572 | QStyleOptionButton box; | - | ||||||||||||||||||||||||||||||||||||
| 1573 | box.QStyleOption::operator=(*option); | - | ||||||||||||||||||||||||||||||||||||
| 1574 | box.rect = checkRect; | - | ||||||||||||||||||||||||||||||||||||
| 1575 | if (checked)
| 0 | ||||||||||||||||||||||||||||||||||||
| 1576 | box.state |= State_On; never executed: box.state |= State_On; | 0 | ||||||||||||||||||||||||||||||||||||
| 1577 | proxy()->drawPrimitive(PE_IndicatorCheckBox, &box, painter, widget); | - | ||||||||||||||||||||||||||||||||||||
| 1578 | } never executed: end of block | 0 | ||||||||||||||||||||||||||||||||||||
| 1579 | } never executed: end of block | 0 | ||||||||||||||||||||||||||||||||||||
| 1580 | } | - | ||||||||||||||||||||||||||||||||||||
| 1581 | } else { //ignore checkmark never executed: end of block | 0 | ||||||||||||||||||||||||||||||||||||
| 1582 | if (menuItem->icon.isNull())
| 0 | ||||||||||||||||||||||||||||||||||||
| 1583 | checkcol = 0; never executed: checkcol = 0; | 0 | ||||||||||||||||||||||||||||||||||||
| 1584 | else | - | ||||||||||||||||||||||||||||||||||||
| 1585 | checkcol = menuItem->maxIconWidth; never executed: checkcol = menuItem->maxIconWidth; | 0 | ||||||||||||||||||||||||||||||||||||
| 1586 | } | - | ||||||||||||||||||||||||||||||||||||
| 1587 | - | |||||||||||||||||||||||||||||||||||||
| 1588 | // Text and icon, ripped from windows style | - | ||||||||||||||||||||||||||||||||||||
| 1589 | bool dis = !(menuItem->state & State_Enabled); | - | ||||||||||||||||||||||||||||||||||||
| 1590 | bool act = menuItem->state & State_Selected; | - | ||||||||||||||||||||||||||||||||||||
| 1591 | const QStyleOption *opt = option; | - | ||||||||||||||||||||||||||||||||||||
| 1592 | const QStyleOptionMenuItem *menuitem = menuItem; | - | ||||||||||||||||||||||||||||||||||||
| 1593 | - | |||||||||||||||||||||||||||||||||||||
| 1594 | QPainter *p = painter; | - | ||||||||||||||||||||||||||||||||||||
| 1595 | QRect vCheckRect = visualRect(opt->direction, menuitem->rect, | - | ||||||||||||||||||||||||||||||||||||
| 1596 | QRect(menuitem->rect.x() + 4, menuitem->rect.y(), | - | ||||||||||||||||||||||||||||||||||||
| 1597 | checkcol, menuitem->rect.height())); | - | ||||||||||||||||||||||||||||||||||||
| 1598 | if (!menuItem->icon.isNull()) {
| 0 | ||||||||||||||||||||||||||||||||||||
| 1599 | QIcon::Mode mode = dis ? QIcon::Disabled : QIcon::Normal;
| 0 | ||||||||||||||||||||||||||||||||||||
| 1600 | if (act && !dis)
| 0 | ||||||||||||||||||||||||||||||||||||
| 1601 | mode = QIcon::Active; never executed: mode = QIcon::Active; | 0 | ||||||||||||||||||||||||||||||||||||
| 1602 | QPixmap pixmap; | - | ||||||||||||||||||||||||||||||||||||
| 1603 | - | |||||||||||||||||||||||||||||||||||||
| 1604 | int smallIconSize = proxy()->pixelMetric(PM_SmallIconSize, option, widget); | - | ||||||||||||||||||||||||||||||||||||
| 1605 | QSize iconSize(smallIconSize, smallIconSize); | - | ||||||||||||||||||||||||||||||||||||
| 1606 | if (const QComboBox *combo = qobject_cast<const QComboBox*>(widget))
| 0 | ||||||||||||||||||||||||||||||||||||
| 1607 | iconSize = combo->iconSize(); never executed: iconSize = combo->iconSize(); | 0 | ||||||||||||||||||||||||||||||||||||
| 1608 | if (checked)
| 0 | ||||||||||||||||||||||||||||||||||||
| 1609 | pixmap = menuItem->icon.pixmap(iconSize, mode, QIcon::On); never executed: pixmap = menuItem->icon.pixmap(iconSize, mode, QIcon::On); | 0 | ||||||||||||||||||||||||||||||||||||
| 1610 | else | - | ||||||||||||||||||||||||||||||||||||
| 1611 | pixmap = menuItem->icon.pixmap(iconSize, mode); never executed: pixmap = menuItem->icon.pixmap(iconSize, mode); | 0 | ||||||||||||||||||||||||||||||||||||
| 1612 | - | |||||||||||||||||||||||||||||||||||||
| 1613 | const int pixw = pixmap.width() / pixmap.devicePixelRatio(); | - | ||||||||||||||||||||||||||||||||||||
| 1614 | const int pixh = pixmap.height() / pixmap.devicePixelRatio(); | - | ||||||||||||||||||||||||||||||||||||
| 1615 | - | |||||||||||||||||||||||||||||||||||||
| 1616 | QRect pmr(0, 0, pixw, pixh); | - | ||||||||||||||||||||||||||||||||||||
| 1617 | pmr.moveCenter(vCheckRect.center()); | - | ||||||||||||||||||||||||||||||||||||
| 1618 | painter->setPen(menuItem->palette.text().color()); | - | ||||||||||||||||||||||||||||||||||||
| 1619 | if (!ignoreCheckMark && checkable && checked) {
| 0 | ||||||||||||||||||||||||||||||||||||
| 1620 | QStyleOption opt = *option; | - | ||||||||||||||||||||||||||||||||||||
| 1621 | if (act) {
| 0 | ||||||||||||||||||||||||||||||||||||
| 1622 | QColor activeColor = mergedColors(option->palette.background().color(), | - | ||||||||||||||||||||||||||||||||||||
| 1623 | option->palette.highlight().color()); | - | ||||||||||||||||||||||||||||||||||||
| 1624 | opt.palette.setBrush(QPalette::Button, activeColor); | - | ||||||||||||||||||||||||||||||||||||
| 1625 | } never executed: end of block | 0 | ||||||||||||||||||||||||||||||||||||
| 1626 | opt.state |= State_Sunken; | - | ||||||||||||||||||||||||||||||||||||
| 1627 | opt.rect = vCheckRect; | - | ||||||||||||||||||||||||||||||||||||
| 1628 | proxy()->drawPrimitive(PE_PanelButtonCommand, &opt, painter, widget); | - | ||||||||||||||||||||||||||||||||||||
| 1629 | } never executed: end of block | 0 | ||||||||||||||||||||||||||||||||||||
| 1630 | painter->drawPixmap(pmr.topLeft(), pixmap); | - | ||||||||||||||||||||||||||||||||||||
| 1631 | } never executed: end of block | 0 | ||||||||||||||||||||||||||||||||||||
| 1632 | if (selected) {
| 0 | ||||||||||||||||||||||||||||||||||||
| 1633 | painter->setPen(menuItem->palette.highlightedText().color()); | - | ||||||||||||||||||||||||||||||||||||
| 1634 | } else { never executed: end of block | 0 | ||||||||||||||||||||||||||||||||||||
| 1635 | painter->setPen(menuItem->palette.text().color()); | - | ||||||||||||||||||||||||||||||||||||
| 1636 | } never executed: end of block | 0 | ||||||||||||||||||||||||||||||||||||
| 1637 | int x, y, w, h; | - | ||||||||||||||||||||||||||||||||||||
| 1638 | menuitem->rect.getRect(&x, &y, &w, &h); | - | ||||||||||||||||||||||||||||||||||||
| 1639 | int tab = menuitem->tabWidth; | - | ||||||||||||||||||||||||||||||||||||
| 1640 | QColor discol; | - | ||||||||||||||||||||||||||||||||||||
| 1641 | if (dis) {
| 0 | ||||||||||||||||||||||||||||||||||||
| 1642 | discol = menuitem->palette.text().color(); | - | ||||||||||||||||||||||||||||||||||||
| 1643 | p->setPen(discol); | - | ||||||||||||||||||||||||||||||||||||
| 1644 | } never executed: end of block | 0 | ||||||||||||||||||||||||||||||||||||
| 1645 | int xm = windowsItemFrame + checkcol + windowsItemHMargin + 2; | - | ||||||||||||||||||||||||||||||||||||
| 1646 | int xpos = menuitem->rect.x() + xm; | - | ||||||||||||||||||||||||||||||||||||
| 1647 | - | |||||||||||||||||||||||||||||||||||||
| 1648 | QRect textRect(xpos, y + windowsItemVMargin, w - xm - windowsRightBorder - tab + 1, h - 2 * windowsItemVMargin); | - | ||||||||||||||||||||||||||||||||||||
| 1649 | QRect vTextRect = visualRect(opt->direction, menuitem->rect, textRect); | - | ||||||||||||||||||||||||||||||||||||
| 1650 | QString s = menuitem->text; | - | ||||||||||||||||||||||||||||||||||||
| 1651 | if (!s.isEmpty()) { // draw text
| 0 | ||||||||||||||||||||||||||||||||||||
| 1652 | p->save(); | - | ||||||||||||||||||||||||||||||||||||
| 1653 | int t = s.indexOf(QLatin1Char('\t')); | - | ||||||||||||||||||||||||||||||||||||
| 1654 | int text_flags = Qt::AlignVCenter | Qt::TextShowMnemonic | Qt::TextDontClip | Qt::TextSingleLine; | - | ||||||||||||||||||||||||||||||||||||
| 1655 | if (!styleHint(SH_UnderlineShortcut, menuitem, widget))
| 0 | ||||||||||||||||||||||||||||||||||||
| 1656 | text_flags |= Qt::TextHideMnemonic; never executed: text_flags |= Qt::TextHideMnemonic; | 0 | ||||||||||||||||||||||||||||||||||||
| 1657 | text_flags |= Qt::AlignLeft; | - | ||||||||||||||||||||||||||||||||||||
| 1658 | if (t >= 0) {
| 0 | ||||||||||||||||||||||||||||||||||||
| 1659 | QRect vShortcutRect = visualRect(opt->direction, menuitem->rect, | - | ||||||||||||||||||||||||||||||||||||
| 1660 | QRect(textRect.topRight(), QPoint(menuitem->rect.right(), textRect.bottom()))); | - | ||||||||||||||||||||||||||||||||||||
| 1661 | if (dis && !act && proxy()->styleHint(SH_EtchDisabledText, option, widget)) {
| 0 | ||||||||||||||||||||||||||||||||||||
| 1662 | p->setPen(menuitem->palette.light().color()); | - | ||||||||||||||||||||||||||||||||||||
| 1663 | p->drawText(vShortcutRect.adjusted(1, 1, 1, 1), text_flags, s.mid(t + 1)); | - | ||||||||||||||||||||||||||||||||||||
| 1664 | p->setPen(discol); | - | ||||||||||||||||||||||||||||||||||||
| 1665 | } never executed: end of block | 0 | ||||||||||||||||||||||||||||||||||||
| 1666 | p->drawText(vShortcutRect, text_flags, s.mid(t + 1)); | - | ||||||||||||||||||||||||||||||||||||
| 1667 | s = s.left(t); | - | ||||||||||||||||||||||||||||||||||||
| 1668 | } never executed: end of block | 0 | ||||||||||||||||||||||||||||||||||||
| 1669 | QFont font = menuitem->font; | - | ||||||||||||||||||||||||||||||||||||
| 1670 | // font may not have any "hard" flags set. We override | - | ||||||||||||||||||||||||||||||||||||
| 1671 | // the point size so that when it is resolved against the device, this font will win. | - | ||||||||||||||||||||||||||||||||||||
| 1672 | // This is mainly to handle cases where someone sets the font on the window | - | ||||||||||||||||||||||||||||||||||||
| 1673 | // and then the combo inherits it and passes it onward. At that point the resolve mask | - | ||||||||||||||||||||||||||||||||||||
| 1674 | // is very, very weak. This makes it stonger. | - | ||||||||||||||||||||||||||||||||||||
| 1675 | font.setPointSizeF(QFontInfo(menuItem->font).pointSizeF()); | - | ||||||||||||||||||||||||||||||||||||
| 1676 | - | |||||||||||||||||||||||||||||||||||||
| 1677 | if (menuitem->menuItemType == QStyleOptionMenuItem::DefaultItem)
| 0 | ||||||||||||||||||||||||||||||||||||
| 1678 | font.setBold(true); never executed: font.setBold(true); | 0 | ||||||||||||||||||||||||||||||||||||
| 1679 | - | |||||||||||||||||||||||||||||||||||||
| 1680 | p->setFont(font); | - | ||||||||||||||||||||||||||||||||||||
| 1681 | if (dis && !act && proxy()->styleHint(SH_EtchDisabledText, option, widget)) {
| 0 | ||||||||||||||||||||||||||||||||||||
| 1682 | p->setPen(menuitem->palette.light().color()); | - | ||||||||||||||||||||||||||||||||||||
| 1683 | p->drawText(vTextRect.adjusted(1, 1, 1, 1), text_flags, s.left(t)); | - | ||||||||||||||||||||||||||||||||||||
| 1684 | p->setPen(discol); | - | ||||||||||||||||||||||||||||||||||||
| 1685 | } never executed: end of block | 0 | ||||||||||||||||||||||||||||||||||||
| 1686 | p->drawText(vTextRect, text_flags, s.left(t)); | - | ||||||||||||||||||||||||||||||||||||
| 1687 | p->restore(); | - | ||||||||||||||||||||||||||||||||||||
| 1688 | } never executed: end of block | 0 | ||||||||||||||||||||||||||||||||||||
| 1689 | - | |||||||||||||||||||||||||||||||||||||
| 1690 | // Arrow | - | ||||||||||||||||||||||||||||||||||||
| 1691 | if (menuItem->menuItemType == QStyleOptionMenuItem::SubMenu) {// draw sub menu arrow
| 0 | ||||||||||||||||||||||||||||||||||||
| 1692 | int dim = (menuItem->rect.height() - 4) / 2; | - | ||||||||||||||||||||||||||||||||||||
| 1693 | PrimitiveElement arrow; | - | ||||||||||||||||||||||||||||||||||||
| 1694 | arrow = option->direction == Qt::RightToLeft ? PE_IndicatorArrowLeft : PE_IndicatorArrowRight;
| 0 | ||||||||||||||||||||||||||||||||||||
| 1695 | int xpos = menuItem->rect.left() + menuItem->rect.width() - 3 - dim; | - | ||||||||||||||||||||||||||||||||||||
| 1696 | QRect vSubMenuRect = visualRect(option->direction, menuItem->rect, | - | ||||||||||||||||||||||||||||||||||||
| 1697 | QRect(xpos, menuItem->rect.top() + menuItem->rect.height() / 2 - dim / 2, dim, dim)); | - | ||||||||||||||||||||||||||||||||||||
| 1698 | QStyleOptionMenuItem newMI = *menuItem; | - | ||||||||||||||||||||||||||||||||||||
| 1699 | newMI.rect = vSubMenuRect; | - | ||||||||||||||||||||||||||||||||||||
| 1700 | newMI.state = !enabled ? State_None : State_Enabled;
| 0 | ||||||||||||||||||||||||||||||||||||
| 1701 | if (selected)
| 0 | ||||||||||||||||||||||||||||||||||||
| 1702 | newMI.palette.setColor(QPalette::Foreground, never executed: newMI.palette.setColor(QPalette::Foreground, newMI.palette.highlightedText().color()); | 0 | ||||||||||||||||||||||||||||||||||||
| 1703 | newMI.palette.highlightedText().color()); never executed: newMI.palette.setColor(QPalette::Foreground, newMI.palette.highlightedText().color()); | 0 | ||||||||||||||||||||||||||||||||||||
| 1704 | proxy()->drawPrimitive(arrow, &newMI, painter, widget); | - | ||||||||||||||||||||||||||||||||||||
| 1705 | } never executed: end of block | 0 | ||||||||||||||||||||||||||||||||||||
| 1706 | } never executed: end of block | 0 | ||||||||||||||||||||||||||||||||||||
| 1707 | painter->restore(); | - | ||||||||||||||||||||||||||||||||||||
| 1708 | break; never executed: break; | 0 | ||||||||||||||||||||||||||||||||||||
| 1709 | case CE_MenuHMargin: never executed: case CE_MenuHMargin: | 0 | ||||||||||||||||||||||||||||||||||||
| 1710 | case CE_MenuVMargin: never executed: case CE_MenuVMargin: | 0 | ||||||||||||||||||||||||||||||||||||
| 1711 | break; never executed: break; | 0 | ||||||||||||||||||||||||||||||||||||
| 1712 | case CE_MenuEmptyArea: never executed: case CE_MenuEmptyArea: | 0 | ||||||||||||||||||||||||||||||||||||
| 1713 | break; never executed: break; | 0 | ||||||||||||||||||||||||||||||||||||
| 1714 | case CE_PushButton: never executed: case CE_PushButton: | 0 | ||||||||||||||||||||||||||||||||||||
| 1715 | if (const QStyleOptionButton *btn = qstyleoption_cast<const QStyleOptionButton *>(option)) {
| 0 | ||||||||||||||||||||||||||||||||||||
| 1716 | proxy()->drawControl(CE_PushButtonBevel, btn, painter, widget); | - | ||||||||||||||||||||||||||||||||||||
| 1717 | QStyleOptionButton subopt = *btn; | - | ||||||||||||||||||||||||||||||||||||
| 1718 | subopt.rect = subElementRect(SE_PushButtonContents, btn, widget); | - | ||||||||||||||||||||||||||||||||||||
| 1719 | proxy()->drawControl(CE_PushButtonLabel, &subopt, painter, widget); | - | ||||||||||||||||||||||||||||||||||||
| 1720 | } never executed: end of block | 0 | ||||||||||||||||||||||||||||||||||||
| 1721 | break; never executed: break; | 0 | ||||||||||||||||||||||||||||||||||||
| 1722 | case CE_PushButtonLabel: never executed: case CE_PushButtonLabel: | 0 | ||||||||||||||||||||||||||||||||||||
| 1723 | if (const QStyleOptionButton *button = qstyleoption_cast<const QStyleOptionButton *>(option)) {
| 0 | ||||||||||||||||||||||||||||||||||||
| 1724 | QRect ir = button->rect; | - | ||||||||||||||||||||||||||||||||||||
| 1725 | uint tf = Qt::AlignVCenter; | - | ||||||||||||||||||||||||||||||||||||
| 1726 | if (styleHint(SH_UnderlineShortcut, button, widget))
| 0 | ||||||||||||||||||||||||||||||||||||
| 1727 | tf |= Qt::TextShowMnemonic; never executed: tf |= Qt::TextShowMnemonic; | 0 | ||||||||||||||||||||||||||||||||||||
| 1728 | else | - | ||||||||||||||||||||||||||||||||||||
| 1729 | tf |= Qt::TextHideMnemonic; never executed: tf |= Qt::TextHideMnemonic; | 0 | ||||||||||||||||||||||||||||||||||||
| 1730 | - | |||||||||||||||||||||||||||||||||||||
| 1731 | if (!button->icon.isNull()) {
| 0 | ||||||||||||||||||||||||||||||||||||
| 1732 | //Center both icon and text | - | ||||||||||||||||||||||||||||||||||||
| 1733 | QPoint point; | - | ||||||||||||||||||||||||||||||||||||
| 1734 | - | |||||||||||||||||||||||||||||||||||||
| 1735 | QIcon::Mode mode = button->state & State_Enabled ? QIcon::Normal
| 0 | ||||||||||||||||||||||||||||||||||||
| 1736 | : QIcon::Disabled; | - | ||||||||||||||||||||||||||||||||||||
| 1737 | if (mode == QIcon::Normal && button->state & State_HasFocus)
| 0 | ||||||||||||||||||||||||||||||||||||
| 1738 | mode = QIcon::Active; never executed: mode = QIcon::Active; | 0 | ||||||||||||||||||||||||||||||||||||
| 1739 | QIcon::State state = QIcon::Off; | - | ||||||||||||||||||||||||||||||||||||
| 1740 | if (button->state & State_On)
| 0 | ||||||||||||||||||||||||||||||||||||
| 1741 | state = QIcon::On; never executed: state = QIcon::On; | 0 | ||||||||||||||||||||||||||||||||||||
| 1742 | - | |||||||||||||||||||||||||||||||||||||
| 1743 | QPixmap pixmap = button->icon.pixmap(button->iconSize, mode, state); | - | ||||||||||||||||||||||||||||||||||||
| 1744 | int w = pixmap.width() / pixmap.devicePixelRatio(); | - | ||||||||||||||||||||||||||||||||||||
| 1745 | int h = pixmap.height() / pixmap.devicePixelRatio(); | - | ||||||||||||||||||||||||||||||||||||
| 1746 | - | |||||||||||||||||||||||||||||||||||||
| 1747 | if (!button->text.isEmpty())
| 0 | ||||||||||||||||||||||||||||||||||||
| 1748 | w += button->fontMetrics.boundingRect(option->rect, tf, button->text).width() + 2; never executed: w += button->fontMetrics.boundingRect(option->rect, tf, button->text).width() + 2; | 0 | ||||||||||||||||||||||||||||||||||||
| 1749 | - | |||||||||||||||||||||||||||||||||||||
| 1750 | point = QPoint(ir.x() + ir.width() / 2 - w / 2, | - | ||||||||||||||||||||||||||||||||||||
| 1751 | ir.y() + ir.height() / 2 - h / 2); | - | ||||||||||||||||||||||||||||||||||||
| 1752 | - | |||||||||||||||||||||||||||||||||||||
| 1753 | w = pixmap.width() / pixmap.devicePixelRatio(); | - | ||||||||||||||||||||||||||||||||||||
| 1754 | - | |||||||||||||||||||||||||||||||||||||
| 1755 | if (button->direction == Qt::RightToLeft)
| 0 | ||||||||||||||||||||||||||||||||||||
| 1756 | point.rx() += w; never executed: point.rx() += w; | 0 | ||||||||||||||||||||||||||||||||||||
| 1757 | - | |||||||||||||||||||||||||||||||||||||
| 1758 | painter->drawPixmap(visualPos(button->direction, button->rect, point), pixmap); | - | ||||||||||||||||||||||||||||||||||||
| 1759 | - | |||||||||||||||||||||||||||||||||||||
| 1760 | if (button->direction == Qt::RightToLeft)
| 0 | ||||||||||||||||||||||||||||||||||||
| 1761 | ir.translate(-point.x() - 2, 0); never executed: ir.translate(-point.x() - 2, 0); | 0 | ||||||||||||||||||||||||||||||||||||
| 1762 | else | - | ||||||||||||||||||||||||||||||||||||
| 1763 | ir.translate(point.x() + w, 0); never executed: ir.translate(point.x() + w, 0); | 0 | ||||||||||||||||||||||||||||||||||||
| 1764 | - | |||||||||||||||||||||||||||||||||||||
| 1765 | // left-align text if there is | - | ||||||||||||||||||||||||||||||||||||
| 1766 | if (!button->text.isEmpty())
| 0 | ||||||||||||||||||||||||||||||||||||
| 1767 | tf |= Qt::AlignLeft; never executed: tf |= Qt::AlignLeft; | 0 | ||||||||||||||||||||||||||||||||||||
| 1768 | - | |||||||||||||||||||||||||||||||||||||
| 1769 | } else { never executed: end of block | 0 | ||||||||||||||||||||||||||||||||||||
| 1770 | tf |= Qt::AlignHCenter; | - | ||||||||||||||||||||||||||||||||||||
| 1771 | } never executed: end of block | 0 | ||||||||||||||||||||||||||||||||||||
| 1772 | - | |||||||||||||||||||||||||||||||||||||
| 1773 | if (button->features & QStyleOptionButton::HasMenu)
| 0 | ||||||||||||||||||||||||||||||||||||
| 1774 | ir = ir.adjusted(0, 0, -proxy()->pixelMetric(PM_MenuButtonIndicator, button, widget), 0); never executed: ir = ir.adjusted(0, 0, -proxy()->pixelMetric(PM_MenuButtonIndicator, button, widget), 0); | 0 | ||||||||||||||||||||||||||||||||||||
| 1775 | proxy()->drawItemText(painter, ir, tf, button->palette, (button->state & State_Enabled), | - | ||||||||||||||||||||||||||||||||||||
| 1776 | button->text, QPalette::ButtonText); | - | ||||||||||||||||||||||||||||||||||||
| 1777 | } never executed: end of block | 0 | ||||||||||||||||||||||||||||||||||||
| 1778 | break; never executed: break; | 0 | ||||||||||||||||||||||||||||||||||||
| 1779 | case CE_MenuBarEmptyArea: never executed: case CE_MenuBarEmptyArea: | 0 | ||||||||||||||||||||||||||||||||||||
| 1780 | painter->save(); | - | ||||||||||||||||||||||||||||||||||||
| 1781 | { | - | ||||||||||||||||||||||||||||||||||||
| 1782 | painter->fillRect(rect, option->palette.window()); | - | ||||||||||||||||||||||||||||||||||||
| 1783 | QColor shadow = mergedColors(option->palette.background().color().darker(120), | - | ||||||||||||||||||||||||||||||||||||
| 1784 | outline.lighter(140), 60); | - | ||||||||||||||||||||||||||||||||||||
| 1785 | painter->setPen(QPen(shadow)); | - | ||||||||||||||||||||||||||||||||||||
| 1786 | painter->drawLine(option->rect.bottomLeft(), option->rect.bottomRight()); | - | ||||||||||||||||||||||||||||||||||||
| 1787 | } | - | ||||||||||||||||||||||||||||||||||||
| 1788 | painter->restore(); | - | ||||||||||||||||||||||||||||||||||||
| 1789 | break; never executed: break; | 0 | ||||||||||||||||||||||||||||||||||||
| 1790 | case CE_TabBarTabShape: never executed: case CE_TabBarTabShape: | 0 | ||||||||||||||||||||||||||||||||||||
| 1791 | painter->save(); | - | ||||||||||||||||||||||||||||||||||||
| 1792 | if (const QStyleOptionTab *tab = qstyleoption_cast<const QStyleOptionTab *>(option)) {
| 0 | ||||||||||||||||||||||||||||||||||||
| 1793 | - | |||||||||||||||||||||||||||||||||||||
| 1794 | bool rtlHorTabs = (tab->direction == Qt::RightToLeft
| 0 | ||||||||||||||||||||||||||||||||||||
| 1795 | && (tab->shape == QTabBar::RoundedNorth
| 0 | ||||||||||||||||||||||||||||||||||||
| 1796 | || tab->shape == QTabBar::RoundedSouth));
| 0 | ||||||||||||||||||||||||||||||||||||
| 1797 | bool selected = tab->state & State_Selected; | - | ||||||||||||||||||||||||||||||||||||
| 1798 | bool lastTab = ((!rtlHorTabs && tab->position == QStyleOptionTab::End)
| 0 | ||||||||||||||||||||||||||||||||||||
| 1799 | || (rtlHorTabs
| 0 | ||||||||||||||||||||||||||||||||||||
| 1800 | && tab->position == QStyleOptionTab::Beginning));
| 0 | ||||||||||||||||||||||||||||||||||||
| 1801 | bool onlyOne = tab->position == QStyleOptionTab::OnlyOneTab; | - | ||||||||||||||||||||||||||||||||||||
| 1802 | int tabOverlap = pixelMetric(PM_TabBarTabOverlap, option, widget); | - | ||||||||||||||||||||||||||||||||||||
| 1803 | rect = option->rect.adjusted(0, 0, (onlyOne || lastTab) ? 0 : tabOverlap, 0); | - | ||||||||||||||||||||||||||||||||||||
| 1804 | - | |||||||||||||||||||||||||||||||||||||
| 1805 | QRect r2(rect); | - | ||||||||||||||||||||||||||||||||||||
| 1806 | int x1 = r2.left(); | - | ||||||||||||||||||||||||||||||||||||
| 1807 | int x2 = r2.right(); | - | ||||||||||||||||||||||||||||||||||||
| 1808 | int y1 = r2.top(); | - | ||||||||||||||||||||||||||||||||||||
| 1809 | int y2 = r2.bottom(); | - | ||||||||||||||||||||||||||||||||||||
| 1810 | - | |||||||||||||||||||||||||||||||||||||
| 1811 | painter->setPen(d->innerContrastLine()); | - | ||||||||||||||||||||||||||||||||||||
| 1812 | - | |||||||||||||||||||||||||||||||||||||
| 1813 | QTransform rotMatrix; | - | ||||||||||||||||||||||||||||||||||||
| 1814 | bool flip = false; | - | ||||||||||||||||||||||||||||||||||||
| 1815 | painter->setPen(shadow); | - | ||||||||||||||||||||||||||||||||||||
| 1816 | - | |||||||||||||||||||||||||||||||||||||
| 1817 | switch (tab->shape) { | - | ||||||||||||||||||||||||||||||||||||
| 1818 | case QTabBar::RoundedNorth: never executed: case QTabBar::RoundedNorth: | 0 | ||||||||||||||||||||||||||||||||||||
| 1819 | break; never executed: break; | 0 | ||||||||||||||||||||||||||||||||||||
| 1820 | case QTabBar::RoundedSouth: never executed: case QTabBar::RoundedSouth: | 0 | ||||||||||||||||||||||||||||||||||||
| 1821 | rotMatrix.rotate(180); | - | ||||||||||||||||||||||||||||||||||||
| 1822 | rotMatrix.translate(0, -rect.height() + 1); | - | ||||||||||||||||||||||||||||||||||||
| 1823 | rotMatrix.scale(-1, 1); | - | ||||||||||||||||||||||||||||||||||||
| 1824 | painter->setTransform(rotMatrix, true); | - | ||||||||||||||||||||||||||||||||||||
| 1825 | break; never executed: break; | 0 | ||||||||||||||||||||||||||||||||||||
| 1826 | case QTabBar::RoundedWest: never executed: case QTabBar::RoundedWest: | 0 | ||||||||||||||||||||||||||||||||||||
| 1827 | rotMatrix.rotate(180 + 90); | - | ||||||||||||||||||||||||||||||||||||
| 1828 | rotMatrix.scale(-1, 1); | - | ||||||||||||||||||||||||||||||||||||
| 1829 | flip = true; | - | ||||||||||||||||||||||||||||||||||||
| 1830 | painter->setTransform(rotMatrix, true); | - | ||||||||||||||||||||||||||||||||||||
| 1831 | break; never executed: break; | 0 | ||||||||||||||||||||||||||||||||||||
| 1832 | case QTabBar::RoundedEast: never executed: case QTabBar::RoundedEast: | 0 | ||||||||||||||||||||||||||||||||||||
| 1833 | rotMatrix.rotate(90); | - | ||||||||||||||||||||||||||||||||||||
| 1834 | rotMatrix.translate(0, - rect.width() + 1); | - | ||||||||||||||||||||||||||||||||||||
| 1835 | flip = true; | - | ||||||||||||||||||||||||||||||||||||
| 1836 | painter->setTransform(rotMatrix, true); | - | ||||||||||||||||||||||||||||||||||||
| 1837 | break; never executed: break; | 0 | ||||||||||||||||||||||||||||||||||||
| 1838 | default: never executed: default: | 0 | ||||||||||||||||||||||||||||||||||||
| 1839 | painter->restore(); | - | ||||||||||||||||||||||||||||||||||||
| 1840 | QCommonStyle::drawControl(element, tab, painter, widget); | - | ||||||||||||||||||||||||||||||||||||
| 1841 | return; never executed: return; | 0 | ||||||||||||||||||||||||||||||||||||
| 1842 | } | - | ||||||||||||||||||||||||||||||||||||
| 1843 | - | |||||||||||||||||||||||||||||||||||||
| 1844 | if (flip) {
| 0 | ||||||||||||||||||||||||||||||||||||
| 1845 | QRect tmp = rect; | - | ||||||||||||||||||||||||||||||||||||
| 1846 | rect = QRect(tmp.y(), tmp.x(), tmp.height(), tmp.width()); | - | ||||||||||||||||||||||||||||||||||||
| 1847 | int temp = x1; | - | ||||||||||||||||||||||||||||||||||||
| 1848 | x1 = y1; | - | ||||||||||||||||||||||||||||||||||||
| 1849 | y1 = temp; | - | ||||||||||||||||||||||||||||||||||||
| 1850 | temp = x2; | - | ||||||||||||||||||||||||||||||||||||
| 1851 | x2 = y2; | - | ||||||||||||||||||||||||||||||||||||
| 1852 | y2 = temp; | - | ||||||||||||||||||||||||||||||||||||
| 1853 | } never executed: end of block | 0 | ||||||||||||||||||||||||||||||||||||
| 1854 | - | |||||||||||||||||||||||||||||||||||||
| 1855 | painter->setRenderHint(QPainter::Antialiasing, true); | - | ||||||||||||||||||||||||||||||||||||
| 1856 | painter->translate(0.5, 0.5); | - | ||||||||||||||||||||||||||||||||||||
| 1857 | - | |||||||||||||||||||||||||||||||||||||
| 1858 | QColor tabFrameColor = tab->features & QStyleOptionTab::HasFrame ?
| 0 | ||||||||||||||||||||||||||||||||||||
| 1859 | d->tabFrameColor(option->palette) : | - | ||||||||||||||||||||||||||||||||||||
| 1860 | option->palette.window().color(); | - | ||||||||||||||||||||||||||||||||||||
| 1861 | - | |||||||||||||||||||||||||||||||||||||
| 1862 | QLinearGradient fillGradient(rect.topLeft(), rect.bottomLeft()); | - | ||||||||||||||||||||||||||||||||||||
| 1863 | QLinearGradient outlineGradient(rect.topLeft(), rect.bottomLeft()); | - | ||||||||||||||||||||||||||||||||||||
| 1864 | QPen outlinePen = outline.lighter(110); | - | ||||||||||||||||||||||||||||||||||||
| 1865 | if (selected) {
| 0 | ||||||||||||||||||||||||||||||||||||
| 1866 | fillGradient.setColorAt(0, tabFrameColor.lighter(104)); | - | ||||||||||||||||||||||||||||||||||||
| 1867 | // QColor highlight = option->palette.highlight().color(); | - | ||||||||||||||||||||||||||||||||||||
| 1868 | // if (option->state & State_HasFocus && option->state & State_KeyboardFocusChange) { | - | ||||||||||||||||||||||||||||||||||||
| 1869 | // fillGradient.setColorAt(0, highlight.lighter(130)); | - | ||||||||||||||||||||||||||||||||||||
| 1870 | // outlineGradient.setColorAt(0, highlight.darker(130)); | - | ||||||||||||||||||||||||||||||||||||
| 1871 | // fillGradient.setColorAt(0.14, highlight); | - | ||||||||||||||||||||||||||||||||||||
| 1872 | // outlineGradient.setColorAt(0.14, highlight.darker(130)); | - | ||||||||||||||||||||||||||||||||||||
| 1873 | // fillGradient.setColorAt(0.1401, tabFrameColor); | - | ||||||||||||||||||||||||||||||||||||
| 1874 | // outlineGradient.setColorAt(0.1401, highlight.darker(130)); | - | ||||||||||||||||||||||||||||||||||||
| 1875 | // } | - | ||||||||||||||||||||||||||||||||||||
| 1876 | fillGradient.setColorAt(1, tabFrameColor); | - | ||||||||||||||||||||||||||||||||||||
| 1877 | outlineGradient.setColorAt(1, outline); | - | ||||||||||||||||||||||||||||||||||||
| 1878 | outlinePen = QPen(outlineGradient, 1); | - | ||||||||||||||||||||||||||||||||||||
| 1879 | } else { never executed: end of block | 0 | ||||||||||||||||||||||||||||||||||||
| 1880 | fillGradient.setColorAt(0, tabFrameColor.darker(108)); | - | ||||||||||||||||||||||||||||||||||||
| 1881 | fillGradient.setColorAt(0.85, tabFrameColor.darker(108)); | - | ||||||||||||||||||||||||||||||||||||
| 1882 | fillGradient.setColorAt(1, tabFrameColor.darker(116)); | - | ||||||||||||||||||||||||||||||||||||
| 1883 | } never executed: end of block | 0 | ||||||||||||||||||||||||||||||||||||
| 1884 | - | |||||||||||||||||||||||||||||||||||||
| 1885 | QRect drawRect = rect.adjusted(0, selected ? 0 : 2, 0, 3); | - | ||||||||||||||||||||||||||||||||||||
| 1886 | painter->setPen(outlinePen); | - | ||||||||||||||||||||||||||||||||||||
| 1887 | painter->save(); | - | ||||||||||||||||||||||||||||||||||||
| 1888 | painter->setClipRect(rect.adjusted(-1, -1, 1, selected ? -2 : -3)); | - | ||||||||||||||||||||||||||||||||||||
| 1889 | painter->setBrush(fillGradient); | - | ||||||||||||||||||||||||||||||||||||
| 1890 | painter->drawRoundedRect(drawRect.adjusted(0, 0, -1, -1), 2.0, 2.0); | - | ||||||||||||||||||||||||||||||||||||
| 1891 | painter->setBrush(Qt::NoBrush); | - | ||||||||||||||||||||||||||||||||||||
| 1892 | painter->setPen(d->innerContrastLine()); | - | ||||||||||||||||||||||||||||||||||||
| 1893 | painter->drawRoundedRect(drawRect.adjusted(1, 1, -2, -1), 2.0, 2.0); | - | ||||||||||||||||||||||||||||||||||||
| 1894 | painter->restore(); | - | ||||||||||||||||||||||||||||||||||||
| 1895 | - | |||||||||||||||||||||||||||||||||||||
| 1896 | if (selected) {
| 0 | ||||||||||||||||||||||||||||||||||||
| 1897 | painter->fillRect(rect.left() + 1, rect.bottom() - 1, rect.width() - 2, rect.bottom() - 1, tabFrameColor); | - | ||||||||||||||||||||||||||||||||||||
| 1898 | painter->fillRect(QRect(rect.bottomRight() + QPoint(-2, -1), QSize(1, 1)), d->innerContrastLine()); | - | ||||||||||||||||||||||||||||||||||||
| 1899 | painter->fillRect(QRect(rect.bottomLeft() + QPoint(0, -1), QSize(1, 1)), d->innerContrastLine()); | - | ||||||||||||||||||||||||||||||||||||
| 1900 | painter->fillRect(QRect(rect.bottomRight() + QPoint(-1, -1), QSize(1, 1)), d->innerContrastLine()); | - | ||||||||||||||||||||||||||||||||||||
| 1901 | } never executed: end of block | 0 | ||||||||||||||||||||||||||||||||||||
| 1902 | } never executed: end of block | 0 | ||||||||||||||||||||||||||||||||||||
| 1903 | painter->restore(); | - | ||||||||||||||||||||||||||||||||||||
| 1904 | break; never executed: break; | 0 | ||||||||||||||||||||||||||||||||||||
| 1905 | default: never executed: default: | 0 | ||||||||||||||||||||||||||||||||||||
| 1906 | QCommonStyle::drawControl(element,option,painter,widget); | - | ||||||||||||||||||||||||||||||||||||
| 1907 | break; never executed: break; | 0 | ||||||||||||||||||||||||||||||||||||
| 1908 | } | - | ||||||||||||||||||||||||||||||||||||
| 1909 | } | - | ||||||||||||||||||||||||||||||||||||
| 1910 | - | |||||||||||||||||||||||||||||||||||||
| 1911 | extern QPalette qt_fusionPalette(); | - | ||||||||||||||||||||||||||||||||||||
| 1912 | - | |||||||||||||||||||||||||||||||||||||
| 1913 | /*! | - | ||||||||||||||||||||||||||||||||||||
| 1914 | \reimp | - | ||||||||||||||||||||||||||||||||||||
| 1915 | */ | - | ||||||||||||||||||||||||||||||||||||
| 1916 | QPalette QFusionStyle::standardPalette () const | - | ||||||||||||||||||||||||||||||||||||
| 1917 | { | - | ||||||||||||||||||||||||||||||||||||
| 1918 | return qt_fusionPalette(); never executed: return qt_fusionPalette(); | 0 | ||||||||||||||||||||||||||||||||||||
| 1919 | } | - | ||||||||||||||||||||||||||||||||||||
| 1920 | - | |||||||||||||||||||||||||||||||||||||
| 1921 | /*! | - | ||||||||||||||||||||||||||||||||||||
| 1922 | \reimp | - | ||||||||||||||||||||||||||||||||||||
| 1923 | */ | - | ||||||||||||||||||||||||||||||||||||
| 1924 | void QFusionStyle::drawComplexControl(ComplexControl control, const QStyleOptionComplex *option, | - | ||||||||||||||||||||||||||||||||||||
| 1925 | QPainter *painter, const QWidget *widget) const | - | ||||||||||||||||||||||||||||||||||||
| 1926 | { | - | ||||||||||||||||||||||||||||||||||||
| 1927 | - | |||||||||||||||||||||||||||||||||||||
| 1928 | Q_D (const QFusionStyle); | - | ||||||||||||||||||||||||||||||||||||
| 1929 | - | |||||||||||||||||||||||||||||||||||||
| 1930 | QColor buttonColor = d->buttonColor(option->palette); | - | ||||||||||||||||||||||||||||||||||||
| 1931 | QColor gradientStartColor = buttonColor.lighter(118); | - | ||||||||||||||||||||||||||||||||||||
| 1932 | QColor gradientStopColor = buttonColor; | - | ||||||||||||||||||||||||||||||||||||
| 1933 | QColor outline = d->outline(option->palette); | - | ||||||||||||||||||||||||||||||||||||
| 1934 | - | |||||||||||||||||||||||||||||||||||||
| 1935 | QColor alphaCornerColor; | - | ||||||||||||||||||||||||||||||||||||
| 1936 | if (widget) {
| 0 | ||||||||||||||||||||||||||||||||||||
| 1937 | // ### backgroundrole/foregroundrole should be part of the style option | - | ||||||||||||||||||||||||||||||||||||
| 1938 | alphaCornerColor = mergedColors(option->palette.color(widget->backgroundRole()), outline); | - | ||||||||||||||||||||||||||||||||||||
| 1939 | } else { never executed: end of block | 0 | ||||||||||||||||||||||||||||||||||||
| 1940 | alphaCornerColor = mergedColors(option->palette.background().color(), outline); | - | ||||||||||||||||||||||||||||||||||||
| 1941 | } never executed: end of block | 0 | ||||||||||||||||||||||||||||||||||||
| 1942 | - | |||||||||||||||||||||||||||||||||||||
| 1943 | switch (control) { | - | ||||||||||||||||||||||||||||||||||||
| 1944 | case CC_GroupBox: never executed: case CC_GroupBox: | 0 | ||||||||||||||||||||||||||||||||||||
| 1945 | painter->save(); | - | ||||||||||||||||||||||||||||||||||||
| 1946 | if (const QStyleOptionGroupBox *groupBox = qstyleoption_cast<const QStyleOptionGroupBox *>(option)) {
| 0 | ||||||||||||||||||||||||||||||||||||
| 1947 | // Draw frame | - | ||||||||||||||||||||||||||||||||||||
| 1948 | QRect textRect = proxy()->subControlRect(CC_GroupBox, option, SC_GroupBoxLabel, widget); | - | ||||||||||||||||||||||||||||||||||||
| 1949 | QRect checkBoxRect = proxy()->subControlRect(CC_GroupBox, option, SC_GroupBoxCheckBox, widget); | - | ||||||||||||||||||||||||||||||||||||
| 1950 | - | |||||||||||||||||||||||||||||||||||||
| 1951 | if (groupBox->subControls & QStyle::SC_GroupBoxFrame) {
| 0 | ||||||||||||||||||||||||||||||||||||
| 1952 | QStyleOptionFrame frame; | - | ||||||||||||||||||||||||||||||||||||
| 1953 | frame.QStyleOption::operator=(*groupBox); | - | ||||||||||||||||||||||||||||||||||||
| 1954 | frame.features = groupBox->features; | - | ||||||||||||||||||||||||||||||||||||
| 1955 | frame.lineWidth = groupBox->lineWidth; | - | ||||||||||||||||||||||||||||||||||||
| 1956 | frame.midLineWidth = groupBox->midLineWidth; | - | ||||||||||||||||||||||||||||||||||||
| 1957 | frame.rect = proxy()->subControlRect(CC_GroupBox, option, SC_GroupBoxFrame, widget); | - | ||||||||||||||||||||||||||||||||||||
| 1958 | proxy()->drawPrimitive(PE_FrameGroupBox, &frame, painter, widget); | - | ||||||||||||||||||||||||||||||||||||
| 1959 | } never executed: end of block | 0 | ||||||||||||||||||||||||||||||||||||
| 1960 | - | |||||||||||||||||||||||||||||||||||||
| 1961 | // Draw title | - | ||||||||||||||||||||||||||||||||||||
| 1962 | if ((groupBox->subControls & QStyle::SC_GroupBoxLabel) && !groupBox->text.isEmpty()) {
| 0 | ||||||||||||||||||||||||||||||||||||
| 1963 | // groupBox->textColor gets the incorrect palette here | - | ||||||||||||||||||||||||||||||||||||
| 1964 | painter->setPen(QPen(option->palette.windowText(), 1)); | - | ||||||||||||||||||||||||||||||||||||
| 1965 | int alignment = int(groupBox->textAlignment); | - | ||||||||||||||||||||||||||||||||||||
| 1966 | if (!proxy()->styleHint(QStyle::SH_UnderlineShortcut, option, widget))
| 0 | ||||||||||||||||||||||||||||||||||||
| 1967 | alignment |= Qt::TextHideMnemonic; never executed: alignment |= Qt::TextHideMnemonic; | 0 | ||||||||||||||||||||||||||||||||||||
| 1968 | - | |||||||||||||||||||||||||||||||||||||
| 1969 | proxy()->drawItemText(painter, textRect, Qt::TextShowMnemonic | Qt::AlignLeft | alignment, | - | ||||||||||||||||||||||||||||||||||||
| 1970 | groupBox->palette, groupBox->state & State_Enabled, groupBox->text, QPalette::NoRole); | - | ||||||||||||||||||||||||||||||||||||
| 1971 | - | |||||||||||||||||||||||||||||||||||||
| 1972 | if (groupBox->state & State_HasFocus) {
| 0 | ||||||||||||||||||||||||||||||||||||
| 1973 | QStyleOptionFocusRect fropt; | - | ||||||||||||||||||||||||||||||||||||
| 1974 | fropt.QStyleOption::operator=(*groupBox); | - | ||||||||||||||||||||||||||||||||||||
| 1975 | fropt.rect = textRect.adjusted(-2, -1, 2, 1); | - | ||||||||||||||||||||||||||||||||||||
| 1976 | proxy()->drawPrimitive(PE_FrameFocusRect, &fropt, painter, widget); | - | ||||||||||||||||||||||||||||||||||||
| 1977 | } never executed: end of block | 0 | ||||||||||||||||||||||||||||||||||||
| 1978 | } never executed: end of block | 0 | ||||||||||||||||||||||||||||||||||||
| 1979 | - | |||||||||||||||||||||||||||||||||||||
| 1980 | // Draw checkbox | - | ||||||||||||||||||||||||||||||||||||
| 1981 | if (groupBox->subControls & SC_GroupBoxCheckBox) {
| 0 | ||||||||||||||||||||||||||||||||||||
| 1982 | QStyleOptionButton box; | - | ||||||||||||||||||||||||||||||||||||
| 1983 | box.QStyleOption::operator=(*groupBox); | - | ||||||||||||||||||||||||||||||||||||
| 1984 | box.rect = checkBoxRect; | - | ||||||||||||||||||||||||||||||||||||
| 1985 | proxy()->drawPrimitive(PE_IndicatorCheckBox, &box, painter, widget); | - | ||||||||||||||||||||||||||||||||||||
| 1986 | } never executed: end of block | 0 | ||||||||||||||||||||||||||||||||||||
| 1987 | } never executed: end of block | 0 | ||||||||||||||||||||||||||||||||||||
| 1988 | painter->restore(); | - | ||||||||||||||||||||||||||||||||||||
| 1989 | break; never executed: break; | 0 | ||||||||||||||||||||||||||||||||||||
| 1990 | case CC_SpinBox: never executed: case CC_SpinBox: | 0 | ||||||||||||||||||||||||||||||||||||
| 1991 | if (const QStyleOptionSpinBox *spinBox = qstyleoption_cast<const QStyleOptionSpinBox *>(option)) {
| 0 | ||||||||||||||||||||||||||||||||||||
| 1992 | QPixmap cache; | - | ||||||||||||||||||||||||||||||||||||
| 1993 | QString pixmapName = QStyleHelper::uniqueName(QLatin1String("spinbox"), spinBox, spinBox->rect.size()); | - | ||||||||||||||||||||||||||||||||||||
| 1994 | if (!QPixmapCache::find(pixmapName, cache)) {
| 0 | ||||||||||||||||||||||||||||||||||||
| 1995 | - | |||||||||||||||||||||||||||||||||||||
| 1996 | cache = styleCachePixmap(spinBox->rect.size()); | - | ||||||||||||||||||||||||||||||||||||
| 1997 | cache.fill(Qt::transparent); | - | ||||||||||||||||||||||||||||||||||||
| 1998 | - | |||||||||||||||||||||||||||||||||||||
| 1999 | QRect pixmapRect(0, 0, spinBox->rect.width(), spinBox->rect.height()); | - | ||||||||||||||||||||||||||||||||||||
| 2000 | QRect rect = pixmapRect; | - | ||||||||||||||||||||||||||||||||||||
| 2001 | QRect r = rect.adjusted(0, 1, 0, -1); | - | ||||||||||||||||||||||||||||||||||||
| 2002 | QPainter cachePainter(&cache); | - | ||||||||||||||||||||||||||||||||||||
| 2003 | QColor arrowColor = spinBox->palette.foreground().color(); | - | ||||||||||||||||||||||||||||||||||||
| 2004 | arrowColor.setAlpha(220); | - | ||||||||||||||||||||||||||||||||||||
| 2005 | - | |||||||||||||||||||||||||||||||||||||
| 2006 | bool isEnabled = (spinBox->state & State_Enabled); | - | ||||||||||||||||||||||||||||||||||||
| 2007 | bool hover = isEnabled && (spinBox->state & State_MouseOver);
| 0 | ||||||||||||||||||||||||||||||||||||
| 2008 | bool sunken = (spinBox->state & State_Sunken); | - | ||||||||||||||||||||||||||||||||||||
| 2009 | bool upIsActive = (spinBox->activeSubControls == SC_SpinBoxUp); | - | ||||||||||||||||||||||||||||||||||||
| 2010 | bool downIsActive = (spinBox->activeSubControls == SC_SpinBoxDown); | - | ||||||||||||||||||||||||||||||||||||
| 2011 | bool hasFocus = (option->state & State_HasFocus); | - | ||||||||||||||||||||||||||||||||||||
| 2012 | - | |||||||||||||||||||||||||||||||||||||
| 2013 | QStyleOptionSpinBox spinBoxCopy = *spinBox; | - | ||||||||||||||||||||||||||||||||||||
| 2014 | spinBoxCopy.rect = pixmapRect; | - | ||||||||||||||||||||||||||||||||||||
| 2015 | QRect upRect = proxy()->subControlRect(CC_SpinBox, &spinBoxCopy, SC_SpinBoxUp, widget); | - | ||||||||||||||||||||||||||||||||||||
| 2016 | QRect downRect = proxy()->subControlRect(CC_SpinBox, &spinBoxCopy, SC_SpinBoxDown, widget); | - | ||||||||||||||||||||||||||||||||||||
| 2017 | - | |||||||||||||||||||||||||||||||||||||
| 2018 | if (spinBox->frame) {
| 0 | ||||||||||||||||||||||||||||||||||||
| 2019 | cachePainter.save(); | - | ||||||||||||||||||||||||||||||||||||
| 2020 | cachePainter.setRenderHint(QPainter::Antialiasing, true); | - | ||||||||||||||||||||||||||||||||||||
| 2021 | cachePainter.translate(0.5, 0.5); | - | ||||||||||||||||||||||||||||||||||||
| 2022 | - | |||||||||||||||||||||||||||||||||||||
| 2023 | // Fill background | - | ||||||||||||||||||||||||||||||||||||
| 2024 | cachePainter.setPen(Qt::NoPen); | - | ||||||||||||||||||||||||||||||||||||
| 2025 | cachePainter.setBrush(option->palette.base()); | - | ||||||||||||||||||||||||||||||||||||
| 2026 | cachePainter.drawRoundedRect(r.adjusted(0, 0, -1, -1), 2, 2); | - | ||||||||||||||||||||||||||||||||||||
| 2027 | - | |||||||||||||||||||||||||||||||||||||
| 2028 | // Draw inner shadow | - | ||||||||||||||||||||||||||||||||||||
| 2029 | cachePainter.setPen(d->topShadow()); | - | ||||||||||||||||||||||||||||||||||||
| 2030 | cachePainter.drawLine(QPoint(r.left() + 2, r.top() + 1), QPoint(r.right() - 2, r.top() + 1)); | - | ||||||||||||||||||||||||||||||||||||
| 2031 | - | |||||||||||||||||||||||||||||||||||||
| 2032 | // Draw button gradient | - | ||||||||||||||||||||||||||||||||||||
| 2033 | QColor buttonColor = d->buttonColor(option->palette); | - | ||||||||||||||||||||||||||||||||||||
| 2034 | QRect updownRect = upRect.adjusted(0, -2, 0, downRect.height() + 2); | - | ||||||||||||||||||||||||||||||||||||
| 2035 | QLinearGradient gradient = qt_fusion_gradient(updownRect, (isEnabled && option->state & State_MouseOver ) ? buttonColor : buttonColor.darker(104)); | - | ||||||||||||||||||||||||||||||||||||
| 2036 | - | |||||||||||||||||||||||||||||||||||||
| 2037 | // Draw button gradient | - | ||||||||||||||||||||||||||||||||||||
| 2038 | cachePainter.setPen(Qt::NoPen); | - | ||||||||||||||||||||||||||||||||||||
| 2039 | cachePainter.setBrush(gradient); | - | ||||||||||||||||||||||||||||||||||||
| 2040 | - | |||||||||||||||||||||||||||||||||||||
| 2041 | cachePainter.save(); | - | ||||||||||||||||||||||||||||||||||||
| 2042 | cachePainter.setClipRect(updownRect); | - | ||||||||||||||||||||||||||||||||||||
| 2043 | cachePainter.drawRoundedRect(r.adjusted(0, 0, -1, -1), 2, 2); | - | ||||||||||||||||||||||||||||||||||||
| 2044 | cachePainter.setPen(QPen(d->innerContrastLine())); | - | ||||||||||||||||||||||||||||||||||||
| 2045 | cachePainter.setBrush(Qt::NoBrush); | - | ||||||||||||||||||||||||||||||||||||
| 2046 | cachePainter.drawRoundedRect(r.adjusted(1, 1, -2, -2), 2, 2); | - | ||||||||||||||||||||||||||||||||||||
| 2047 | cachePainter.restore(); | - | ||||||||||||||||||||||||||||||||||||
| 2048 | - | |||||||||||||||||||||||||||||||||||||
| 2049 | if ((spinBox->stepEnabled & QAbstractSpinBox::StepUpEnabled) && upIsActive) {
| 0 | ||||||||||||||||||||||||||||||||||||
| 2050 | if (sunken)
| 0 | ||||||||||||||||||||||||||||||||||||
| 2051 | cachePainter.fillRect(upRect.adjusted(0, -1, 0, 0), gradientStopColor.darker(110)); never executed: cachePainter.fillRect(upRect.adjusted(0, -1, 0, 0), gradientStopColor.darker(110)); | 0 | ||||||||||||||||||||||||||||||||||||
| 2052 | else if (hover)
| 0 | ||||||||||||||||||||||||||||||||||||
| 2053 | cachePainter.fillRect(upRect.adjusted(0, -1, 0, 0), d->innerContrastLine()); never executed: cachePainter.fillRect(upRect.adjusted(0, -1, 0, 0), d->innerContrastLine()); | 0 | ||||||||||||||||||||||||||||||||||||
| 2054 | } never executed: end of block | 0 | ||||||||||||||||||||||||||||||||||||
| 2055 | - | |||||||||||||||||||||||||||||||||||||
| 2056 | if ((spinBox->stepEnabled & QAbstractSpinBox::StepDownEnabled) && downIsActive) {
| 0 | ||||||||||||||||||||||||||||||||||||
| 2057 | if (sunken)
| 0 | ||||||||||||||||||||||||||||||||||||
| 2058 | cachePainter.fillRect(downRect.adjusted(0, 0, 0, 1), gradientStopColor.darker(110)); never executed: cachePainter.fillRect(downRect.adjusted(0, 0, 0, 1), gradientStopColor.darker(110)); | 0 | ||||||||||||||||||||||||||||||||||||
| 2059 | else if (hover)
| 0 | ||||||||||||||||||||||||||||||||||||
| 2060 | cachePainter.fillRect(downRect.adjusted(0, 0, 0, 1), d->innerContrastLine()); never executed: cachePainter.fillRect(downRect.adjusted(0, 0, 0, 1), d->innerContrastLine()); | 0 | ||||||||||||||||||||||||||||||||||||
| 2061 | } never executed: end of block | 0 | ||||||||||||||||||||||||||||||||||||
| 2062 | - | |||||||||||||||||||||||||||||||||||||
| 2063 | cachePainter.setPen(hasFocus ? d->highlightedOutline(option->palette) : outline); | - | ||||||||||||||||||||||||||||||||||||
| 2064 | cachePainter.setBrush(Qt::NoBrush); | - | ||||||||||||||||||||||||||||||||||||
| 2065 | cachePainter.drawRoundedRect(r.adjusted(0, 0, -1, -1), 2, 2); | - | ||||||||||||||||||||||||||||||||||||
| 2066 | if (hasFocus) {
| 0 | ||||||||||||||||||||||||||||||||||||
| 2067 | QColor softHighlight = option->palette.highlight().color(); | - | ||||||||||||||||||||||||||||||||||||
| 2068 | softHighlight.setAlpha(40); | - | ||||||||||||||||||||||||||||||||||||
| 2069 | cachePainter.setPen(softHighlight); | - | ||||||||||||||||||||||||||||||||||||
| 2070 | cachePainter.drawRoundedRect(r.adjusted(1, 1, -2, -2), 1.7, 1.7); | - | ||||||||||||||||||||||||||||||||||||
| 2071 | } never executed: end of block | 0 | ||||||||||||||||||||||||||||||||||||
| 2072 | cachePainter.restore(); | - | ||||||||||||||||||||||||||||||||||||
| 2073 | } never executed: end of block | 0 | ||||||||||||||||||||||||||||||||||||
| 2074 | - | |||||||||||||||||||||||||||||||||||||
| 2075 | // outline the up/down buttons | - | ||||||||||||||||||||||||||||||||||||
| 2076 | cachePainter.setPen(outline); | - | ||||||||||||||||||||||||||||||||||||
| 2077 | if (spinBox->direction == Qt::RightToLeft) {
| 0 | ||||||||||||||||||||||||||||||||||||
| 2078 | cachePainter.drawLine(upRect.right(), upRect.top() - 1, upRect.right(), downRect.bottom() + 1); | - | ||||||||||||||||||||||||||||||||||||
| 2079 | } else { never executed: end of block | 0 | ||||||||||||||||||||||||||||||||||||
| 2080 | cachePainter.drawLine(upRect.left(), upRect.top() - 1, upRect.left(), downRect.bottom() + 1); | - | ||||||||||||||||||||||||||||||||||||
| 2081 | } never executed: end of block | 0 | ||||||||||||||||||||||||||||||||||||
| 2082 | - | |||||||||||||||||||||||||||||||||||||
| 2083 | if (upIsActive && sunken) {
| 0 | ||||||||||||||||||||||||||||||||||||
| 2084 | cachePainter.setPen(gradientStopColor.darker(130)); | - | ||||||||||||||||||||||||||||||||||||
| 2085 | cachePainter.drawLine(downRect.left() + 1, downRect.top(), downRect.right(), downRect.top()); | - | ||||||||||||||||||||||||||||||||||||
| 2086 | cachePainter.drawLine(upRect.left() + 1, upRect.top(), upRect.left() + 1, upRect.bottom()); | - | ||||||||||||||||||||||||||||||||||||
| 2087 | cachePainter.drawLine(upRect.left() + 1, upRect.top() - 1, upRect.right(), upRect.top() - 1); | - | ||||||||||||||||||||||||||||||||||||
| 2088 | } never executed: end of block | 0 | ||||||||||||||||||||||||||||||||||||
| 2089 | - | |||||||||||||||||||||||||||||||||||||
| 2090 | if (downIsActive && sunken) {
| 0 | ||||||||||||||||||||||||||||||||||||
| 2091 | cachePainter.setPen(gradientStopColor.darker(130)); | - | ||||||||||||||||||||||||||||||||||||
| 2092 | cachePainter.drawLine(downRect.left() + 1, downRect.top(), downRect.left() + 1, downRect.bottom() + 1); | - | ||||||||||||||||||||||||||||||||||||
| 2093 | cachePainter.drawLine(downRect.left() + 1, downRect.top(), downRect.right(), downRect.top()); | - | ||||||||||||||||||||||||||||||||||||
| 2094 | cachePainter.setPen(gradientStopColor.darker(110)); | - | ||||||||||||||||||||||||||||||||||||
| 2095 | cachePainter.drawLine(downRect.left() + 1, downRect.bottom() + 1, downRect.right(), downRect.bottom() + 1); | - | ||||||||||||||||||||||||||||||||||||
| 2096 | } never executed: end of block | 0 | ||||||||||||||||||||||||||||||||||||
| 2097 | - | |||||||||||||||||||||||||||||||||||||
| 2098 | QColor disabledColor = mergedColors(arrowColor, option->palette.button().color()); | - | ||||||||||||||||||||||||||||||||||||
| 2099 | if (spinBox->buttonSymbols == QAbstractSpinBox::PlusMinus) {
| 0 | ||||||||||||||||||||||||||||||||||||
| 2100 | int centerX = upRect.center().x(); | - | ||||||||||||||||||||||||||||||||||||
| 2101 | int centerY = upRect.center().y(); | - | ||||||||||||||||||||||||||||||||||||
| 2102 | - | |||||||||||||||||||||||||||||||||||||
| 2103 | // plus/minus | - | ||||||||||||||||||||||||||||||||||||
| 2104 | cachePainter.setPen((spinBox->stepEnabled & QAbstractSpinBox::StepUpEnabled) ? arrowColor : disabledColor); | - | ||||||||||||||||||||||||||||||||||||
| 2105 | cachePainter.drawLine(centerX - 1, centerY, centerX + 3, centerY); | - | ||||||||||||||||||||||||||||||||||||
| 2106 | cachePainter.drawLine(centerX + 1, centerY - 2, centerX + 1, centerY + 2); | - | ||||||||||||||||||||||||||||||||||||
| 2107 | - | |||||||||||||||||||||||||||||||||||||
| 2108 | centerX = downRect.center().x(); | - | ||||||||||||||||||||||||||||||||||||
| 2109 | centerY = downRect.center().y(); | - | ||||||||||||||||||||||||||||||||||||
| 2110 | cachePainter.setPen((spinBox->stepEnabled & QAbstractSpinBox::StepDownEnabled) ? arrowColor : disabledColor); | - | ||||||||||||||||||||||||||||||||||||
| 2111 | cachePainter.drawLine(centerX - 1, centerY, centerX + 3, centerY); | - | ||||||||||||||||||||||||||||||||||||
| 2112 | - | |||||||||||||||||||||||||||||||||||||
| 2113 | } else if (spinBox->buttonSymbols == QAbstractSpinBox::UpDownArrows){ never executed: end of block
| 0 | ||||||||||||||||||||||||||||||||||||
| 2114 | // arrows | - | ||||||||||||||||||||||||||||||||||||
| 2115 | painter->setRenderHint(QPainter::SmoothPixmapTransform); | - | ||||||||||||||||||||||||||||||||||||
| 2116 | - | |||||||||||||||||||||||||||||||||||||
| 2117 | QPixmap upArrow = colorizedImage(QLatin1String(":/qt-project.org/styles/commonstyle/images/fusion_arrow.png"), | - | ||||||||||||||||||||||||||||||||||||
| 2118 | (spinBox->stepEnabled & QAbstractSpinBox::StepUpEnabled) ? arrowColor : disabledColor); | - | ||||||||||||||||||||||||||||||||||||
| 2119 | - | |||||||||||||||||||||||||||||||||||||
| 2120 | QRectF upArrowRect = QRectF(upRect.center().x() - upArrow.width() / 4.0 + 1.0, | - | ||||||||||||||||||||||||||||||||||||
| 2121 | upRect.center().y() - upArrow.height() / 4.0 + 1.0, | - | ||||||||||||||||||||||||||||||||||||
| 2122 | upArrow.width() / 2.0, upArrow.height() / 2.0); | - | ||||||||||||||||||||||||||||||||||||
| 2123 | - | |||||||||||||||||||||||||||||||||||||
| 2124 | cachePainter.drawPixmap(upArrowRect, upArrow, QRectF(QPointF(0.0, 0.0), upArrow.size())); | - | ||||||||||||||||||||||||||||||||||||
| 2125 | - | |||||||||||||||||||||||||||||||||||||
| 2126 | QPixmap downArrow = colorizedImage(QLatin1String(":/qt-project.org/styles/commonstyle/images/fusion_arrow.png"), | - | ||||||||||||||||||||||||||||||||||||
| 2127 | (spinBox->stepEnabled & QAbstractSpinBox::StepDownEnabled) ? arrowColor : disabledColor, 180); | - | ||||||||||||||||||||||||||||||||||||
| 2128 | QRectF downArrowRect = QRectF(downRect.center().x() - downArrow.width() / 4.0 + 1.0, | - | ||||||||||||||||||||||||||||||||||||
| 2129 | downRect.center().y() - downArrow.height() / 4.0 + 1.0, | - | ||||||||||||||||||||||||||||||||||||
| 2130 | downArrow.width() / 2.0, downArrow.height() / 2.0); | - | ||||||||||||||||||||||||||||||||||||
| 2131 | cachePainter.drawPixmap(downArrowRect, downArrow, QRectF(QPointF(0.0, 0.0), downArrow.size())); | - | ||||||||||||||||||||||||||||||||||||
| 2132 | } never executed: end of block | 0 | ||||||||||||||||||||||||||||||||||||
| 2133 | - | |||||||||||||||||||||||||||||||||||||
| 2134 | cachePainter.end(); | - | ||||||||||||||||||||||||||||||||||||
| 2135 | QPixmapCache::insert(pixmapName, cache); | - | ||||||||||||||||||||||||||||||||||||
| 2136 | } never executed: end of block | 0 | ||||||||||||||||||||||||||||||||||||
| 2137 | painter->drawPixmap(spinBox->rect.topLeft(), cache); | - | ||||||||||||||||||||||||||||||||||||
| 2138 | } never executed: end of block | 0 | ||||||||||||||||||||||||||||||||||||
| 2139 | break; never executed: break; | 0 | ||||||||||||||||||||||||||||||||||||
| 2140 | case CC_TitleBar: never executed: case CC_TitleBar: | 0 | ||||||||||||||||||||||||||||||||||||
| 2141 | painter->save(); | - | ||||||||||||||||||||||||||||||||||||
| 2142 | if (const QStyleOptionTitleBar *titleBar = qstyleoption_cast<const QStyleOptionTitleBar *>(option)) {
| 0 | ||||||||||||||||||||||||||||||||||||
| 2143 | const int buttonMargin = 5; | - | ||||||||||||||||||||||||||||||||||||
| 2144 | bool active = (titleBar->titleBarState & State_Active); | - | ||||||||||||||||||||||||||||||||||||
| 2145 | QRect fullRect = titleBar->rect; | - | ||||||||||||||||||||||||||||||||||||
| 2146 | QPalette palette = option->palette; | - | ||||||||||||||||||||||||||||||||||||
| 2147 | QColor highlight = option->palette.highlight().color(); | - | ||||||||||||||||||||||||||||||||||||
| 2148 | - | |||||||||||||||||||||||||||||||||||||
| 2149 | QColor titleBarFrameBorder(active ? highlight.darker(180): outline.darker(110)); | - | ||||||||||||||||||||||||||||||||||||
| 2150 | QColor titleBarHighlight(active ? highlight.lighter(120): palette.background().color().lighter(120)); | - | ||||||||||||||||||||||||||||||||||||
| 2151 | QColor textColor(active ? 0xffffff : 0xff000000); | - | ||||||||||||||||||||||||||||||||||||
| 2152 | QColor textAlphaColor(active ? 0xffffff : 0xff000000 ); | - | ||||||||||||||||||||||||||||||||||||
| 2153 | - | |||||||||||||||||||||||||||||||||||||
| 2154 | { | - | ||||||||||||||||||||||||||||||||||||
| 2155 | // Fill title bar gradient | - | ||||||||||||||||||||||||||||||||||||
| 2156 | QColor titlebarColor = QColor(active ? highlight: palette.background().color()); | - | ||||||||||||||||||||||||||||||||||||
| 2157 | QLinearGradient gradient(option->rect.center().x(), option->rect.top(), | - | ||||||||||||||||||||||||||||||||||||
| 2158 | option->rect.center().x(), option->rect.bottom()); | - | ||||||||||||||||||||||||||||||||||||
| 2159 | - | |||||||||||||||||||||||||||||||||||||
| 2160 | gradient.setColorAt(0, titlebarColor.lighter(114)); | - | ||||||||||||||||||||||||||||||||||||
| 2161 | gradient.setColorAt(0.5, titlebarColor.lighter(102)); | - | ||||||||||||||||||||||||||||||||||||
| 2162 | gradient.setColorAt(0.51, titlebarColor.darker(104)); | - | ||||||||||||||||||||||||||||||||||||
| 2163 | gradient.setColorAt(1, titlebarColor); | - | ||||||||||||||||||||||||||||||||||||
| 2164 | painter->fillRect(option->rect.adjusted(1, 1, -1, 0), gradient); | - | ||||||||||||||||||||||||||||||||||||
| 2165 | - | |||||||||||||||||||||||||||||||||||||
| 2166 | // Frame and rounded corners | - | ||||||||||||||||||||||||||||||||||||
| 2167 | painter->setPen(titleBarFrameBorder); | - | ||||||||||||||||||||||||||||||||||||
| 2168 | - | |||||||||||||||||||||||||||||||||||||
| 2169 | // top outline | - | ||||||||||||||||||||||||||||||||||||
| 2170 | painter->drawLine(fullRect.left() + 5, fullRect.top(), fullRect.right() - 5, fullRect.top()); | - | ||||||||||||||||||||||||||||||||||||
| 2171 | painter->drawLine(fullRect.left(), fullRect.top() + 4, fullRect.left(), fullRect.bottom()); | - | ||||||||||||||||||||||||||||||||||||
| 2172 | const QPoint points[5] = { | - | ||||||||||||||||||||||||||||||||||||
| 2173 | QPoint(fullRect.left() + 4, fullRect.top() + 1), | - | ||||||||||||||||||||||||||||||||||||
| 2174 | QPoint(fullRect.left() + 3, fullRect.top() + 1), | - | ||||||||||||||||||||||||||||||||||||
| 2175 | QPoint(fullRect.left() + 2, fullRect.top() + 2), | - | ||||||||||||||||||||||||||||||||||||
| 2176 | QPoint(fullRect.left() + 1, fullRect.top() + 3), | - | ||||||||||||||||||||||||||||||||||||
| 2177 | QPoint(fullRect.left() + 1, fullRect.top() + 4) | - | ||||||||||||||||||||||||||||||||||||
| 2178 | }; | - | ||||||||||||||||||||||||||||||||||||
| 2179 | painter->drawPoints(points, 5); | - | ||||||||||||||||||||||||||||||||||||
| 2180 | - | |||||||||||||||||||||||||||||||||||||
| 2181 | painter->drawLine(fullRect.right(), fullRect.top() + 4, fullRect.right(), fullRect.bottom()); | - | ||||||||||||||||||||||||||||||||||||
| 2182 | const QPoint points2[5] = { | - | ||||||||||||||||||||||||||||||||||||
| 2183 | QPoint(fullRect.right() - 3, fullRect.top() + 1), | - | ||||||||||||||||||||||||||||||||||||
| 2184 | QPoint(fullRect.right() - 4, fullRect.top() + 1), | - | ||||||||||||||||||||||||||||||||||||
| 2185 | QPoint(fullRect.right() - 2, fullRect.top() + 2), | - | ||||||||||||||||||||||||||||||||||||
| 2186 | QPoint(fullRect.right() - 1, fullRect.top() + 3), | - | ||||||||||||||||||||||||||||||||||||
| 2187 | QPoint(fullRect.right() - 1, fullRect.top() + 4) | - | ||||||||||||||||||||||||||||||||||||
| 2188 | }; | - | ||||||||||||||||||||||||||||||||||||
| 2189 | painter->drawPoints(points2, 5); | - | ||||||||||||||||||||||||||||||||||||
| 2190 | - | |||||||||||||||||||||||||||||||||||||
| 2191 | // draw bottomline | - | ||||||||||||||||||||||||||||||||||||
| 2192 | painter->drawLine(fullRect.right(), fullRect.bottom(), fullRect.left(), fullRect.bottom()); | - | ||||||||||||||||||||||||||||||||||||
| 2193 | - | |||||||||||||||||||||||||||||||||||||
| 2194 | // top highlight | - | ||||||||||||||||||||||||||||||||||||
| 2195 | painter->setPen(titleBarHighlight); | - | ||||||||||||||||||||||||||||||||||||
| 2196 | painter->drawLine(fullRect.left() + 6, fullRect.top() + 1, fullRect.right() - 6, fullRect.top() + 1); | - | ||||||||||||||||||||||||||||||||||||
| 2197 | } | - | ||||||||||||||||||||||||||||||||||||
| 2198 | // draw title | - | ||||||||||||||||||||||||||||||||||||
| 2199 | QRect textRect = proxy()->subControlRect(CC_TitleBar, titleBar, SC_TitleBarLabel, widget); | - | ||||||||||||||||||||||||||||||||||||
| 2200 | painter->setPen(active? (titleBar->palette.text().color().lighter(120)) : | - | ||||||||||||||||||||||||||||||||||||
| 2201 | titleBar->palette.text().color() ); | - | ||||||||||||||||||||||||||||||||||||
| 2202 | // Note workspace also does elliding but it does not use the correct font | - | ||||||||||||||||||||||||||||||||||||
| 2203 | QString title = painter->fontMetrics().elidedText(titleBar->text, Qt::ElideRight, textRect.width() - 14); | - | ||||||||||||||||||||||||||||||||||||
| 2204 | painter->drawText(textRect.adjusted(1, 1, 1, 1), title, QTextOption(Qt::AlignHCenter | Qt::AlignVCenter)); | - | ||||||||||||||||||||||||||||||||||||
| 2205 | painter->setPen(Qt::white); | - | ||||||||||||||||||||||||||||||||||||
| 2206 | if (active)
| 0 | ||||||||||||||||||||||||||||||||||||
| 2207 | painter->drawText(textRect, title, QTextOption(Qt::AlignHCenter | Qt::AlignVCenter)); never executed: painter->drawText(textRect, title, QTextOption(Qt::AlignHCenter | Qt::AlignVCenter)); | 0 | ||||||||||||||||||||||||||||||||||||
| 2208 | // min button | - | ||||||||||||||||||||||||||||||||||||
| 2209 | if ((titleBar->subControls & SC_TitleBarMinButton) && (titleBar->titleBarFlags & Qt::WindowMinimizeButtonHint) &&
| 0 | ||||||||||||||||||||||||||||||||||||
| 2210 | !(titleBar->titleBarState& Qt::WindowMinimized)) {
| 0 | ||||||||||||||||||||||||||||||||||||
| 2211 | QRect minButtonRect = proxy()->subControlRect(CC_TitleBar, titleBar, SC_TitleBarMinButton, widget); | - | ||||||||||||||||||||||||||||||||||||
| 2212 | if (minButtonRect.isValid()) {
| 0 | ||||||||||||||||||||||||||||||||||||
| 2213 | bool hover = (titleBar->activeSubControls & SC_TitleBarMinButton) && (titleBar->state & State_MouseOver);
| 0 | ||||||||||||||||||||||||||||||||||||
| 2214 | bool sunken = (titleBar->activeSubControls & SC_TitleBarMinButton) && (titleBar->state & State_Sunken);
| 0 | ||||||||||||||||||||||||||||||||||||
| 2215 | qt_fusion_draw_mdibutton(painter, titleBar, minButtonRect, hover, sunken); | - | ||||||||||||||||||||||||||||||||||||
| 2216 | QRect minButtonIconRect = minButtonRect.adjusted(buttonMargin ,buttonMargin , -buttonMargin, -buttonMargin); | - | ||||||||||||||||||||||||||||||||||||
| 2217 | painter->setPen(textColor); | - | ||||||||||||||||||||||||||||||||||||
| 2218 | painter->drawLine(minButtonIconRect.center().x() - 2, minButtonIconRect.center().y() + 3, | - | ||||||||||||||||||||||||||||||||||||
| 2219 | minButtonIconRect.center().x() + 3, minButtonIconRect.center().y() + 3); | - | ||||||||||||||||||||||||||||||||||||
| 2220 | painter->drawLine(minButtonIconRect.center().x() - 2, minButtonIconRect.center().y() + 4, | - | ||||||||||||||||||||||||||||||||||||
| 2221 | minButtonIconRect.center().x() + 3, minButtonIconRect.center().y() + 4); | - | ||||||||||||||||||||||||||||||||||||
| 2222 | painter->setPen(textAlphaColor); | - | ||||||||||||||||||||||||||||||||||||
| 2223 | painter->drawLine(minButtonIconRect.center().x() - 3, minButtonIconRect.center().y() + 3, | - | ||||||||||||||||||||||||||||||||||||
| 2224 | minButtonIconRect.center().x() - 3, minButtonIconRect.center().y() + 4); | - | ||||||||||||||||||||||||||||||||||||
| 2225 | painter->drawLine(minButtonIconRect.center().x() + 4, minButtonIconRect.center().y() + 3, | - | ||||||||||||||||||||||||||||||||||||
| 2226 | minButtonIconRect.center().x() + 4, minButtonIconRect.center().y() + 4); | - | ||||||||||||||||||||||||||||||||||||
| 2227 | } never executed: end of block | 0 | ||||||||||||||||||||||||||||||||||||
| 2228 | } never executed: end of block | 0 | ||||||||||||||||||||||||||||||||||||
| 2229 | // max button | - | ||||||||||||||||||||||||||||||||||||
| 2230 | if ((titleBar->subControls & SC_TitleBarMaxButton) && (titleBar->titleBarFlags & Qt::WindowMaximizeButtonHint) &&
| 0 | ||||||||||||||||||||||||||||||||||||
| 2231 | !(titleBar->titleBarState & Qt::WindowMaximized)) {
| 0 | ||||||||||||||||||||||||||||||||||||
| 2232 | QRect maxButtonRect = proxy()->subControlRect(CC_TitleBar, titleBar, SC_TitleBarMaxButton, widget); | - | ||||||||||||||||||||||||||||||||||||
| 2233 | if (maxButtonRect.isValid()) {
| 0 | ||||||||||||||||||||||||||||||||||||
| 2234 | bool hover = (titleBar->activeSubControls & SC_TitleBarMaxButton) && (titleBar->state & State_MouseOver);
| 0 | ||||||||||||||||||||||||||||||||||||
| 2235 | bool sunken = (titleBar->activeSubControls & SC_TitleBarMaxButton) && (titleBar->state & State_Sunken);
| 0 | ||||||||||||||||||||||||||||||||||||
| 2236 | qt_fusion_draw_mdibutton(painter, titleBar, maxButtonRect, hover, sunken); | - | ||||||||||||||||||||||||||||||||||||
| 2237 | - | |||||||||||||||||||||||||||||||||||||
| 2238 | QRect maxButtonIconRect = maxButtonRect.adjusted(buttonMargin, buttonMargin, -buttonMargin, -buttonMargin); | - | ||||||||||||||||||||||||||||||||||||
| 2239 | - | |||||||||||||||||||||||||||||||||||||
| 2240 | painter->setPen(textColor); | - | ||||||||||||||||||||||||||||||||||||
| 2241 | painter->drawRect(maxButtonIconRect.adjusted(0, 0, -1, -1)); | - | ||||||||||||||||||||||||||||||||||||
| 2242 | painter->drawLine(maxButtonIconRect.left() + 1, maxButtonIconRect.top() + 1, | - | ||||||||||||||||||||||||||||||||||||
| 2243 | maxButtonIconRect.right() - 1, maxButtonIconRect.top() + 1); | - | ||||||||||||||||||||||||||||||||||||
| 2244 | painter->setPen(textAlphaColor); | - | ||||||||||||||||||||||||||||||||||||
| 2245 | const QPoint points[4] = { | - | ||||||||||||||||||||||||||||||||||||
| 2246 | maxButtonIconRect.topLeft(), | - | ||||||||||||||||||||||||||||||||||||
| 2247 | maxButtonIconRect.topRight(), | - | ||||||||||||||||||||||||||||||||||||
| 2248 | maxButtonIconRect.bottomLeft(), | - | ||||||||||||||||||||||||||||||||||||
| 2249 | maxButtonIconRect.bottomRight() | - | ||||||||||||||||||||||||||||||||||||
| 2250 | }; | - | ||||||||||||||||||||||||||||||||||||
| 2251 | painter->drawPoints(points, 4); | - | ||||||||||||||||||||||||||||||||||||
| 2252 | } never executed: end of block | 0 | ||||||||||||||||||||||||||||||||||||
| 2253 | } never executed: end of block | 0 | ||||||||||||||||||||||||||||||||||||
| 2254 | - | |||||||||||||||||||||||||||||||||||||
| 2255 | // close button | - | ||||||||||||||||||||||||||||||||||||
| 2256 | if ((titleBar->subControls & SC_TitleBarCloseButton) && (titleBar->titleBarFlags & Qt::WindowSystemMenuHint)) {
| 0 | ||||||||||||||||||||||||||||||||||||
| 2257 | QRect closeButtonRect = proxy()->subControlRect(CC_TitleBar, titleBar, SC_TitleBarCloseButton, widget); | - | ||||||||||||||||||||||||||||||||||||
| 2258 | if (closeButtonRect.isValid()) {
| 0 | ||||||||||||||||||||||||||||||||||||
| 2259 | bool hover = (titleBar->activeSubControls & SC_TitleBarCloseButton) && (titleBar->state & State_MouseOver);
| 0 | ||||||||||||||||||||||||||||||||||||
| 2260 | bool sunken = (titleBar->activeSubControls & SC_TitleBarCloseButton) && (titleBar->state & State_Sunken);
| 0 | ||||||||||||||||||||||||||||||||||||
| 2261 | qt_fusion_draw_mdibutton(painter, titleBar, closeButtonRect, hover, sunken); | - | ||||||||||||||||||||||||||||||||||||
| 2262 | QRect closeIconRect = closeButtonRect.adjusted(buttonMargin, buttonMargin, -buttonMargin, -buttonMargin); | - | ||||||||||||||||||||||||||||||||||||
| 2263 | painter->setPen(textAlphaColor); | - | ||||||||||||||||||||||||||||||||||||
| 2264 | const QLine lines[4] = { | - | ||||||||||||||||||||||||||||||||||||
| 2265 | QLine(closeIconRect.left() + 1, closeIconRect.top(), | - | ||||||||||||||||||||||||||||||||||||
| 2266 | closeIconRect.right(), closeIconRect.bottom() - 1), | - | ||||||||||||||||||||||||||||||||||||
| 2267 | QLine(closeIconRect.left(), closeIconRect.top() + 1, | - | ||||||||||||||||||||||||||||||||||||
| 2268 | closeIconRect.right() - 1, closeIconRect.bottom()), | - | ||||||||||||||||||||||||||||||||||||
| 2269 | QLine(closeIconRect.right() - 1, closeIconRect.top(), | - | ||||||||||||||||||||||||||||||||||||
| 2270 | closeIconRect.left(), closeIconRect.bottom() - 1), | - | ||||||||||||||||||||||||||||||||||||
| 2271 | QLine(closeIconRect.right(), closeIconRect.top() + 1, | - | ||||||||||||||||||||||||||||||||||||
| 2272 | closeIconRect.left() + 1, closeIconRect.bottom()) | - | ||||||||||||||||||||||||||||||||||||
| 2273 | }; | - | ||||||||||||||||||||||||||||||||||||
| 2274 | painter->drawLines(lines, 4); | - | ||||||||||||||||||||||||||||||||||||
| 2275 | const QPoint points[4] = { | - | ||||||||||||||||||||||||||||||||||||
| 2276 | closeIconRect.topLeft(), | - | ||||||||||||||||||||||||||||||||||||
| 2277 | closeIconRect.topRight(), | - | ||||||||||||||||||||||||||||||||||||
| 2278 | closeIconRect.bottomLeft(), | - | ||||||||||||||||||||||||||||||||||||
| 2279 | closeIconRect.bottomRight() | - | ||||||||||||||||||||||||||||||||||||
| 2280 | }; | - | ||||||||||||||||||||||||||||||||||||
| 2281 | painter->drawPoints(points, 4); | - | ||||||||||||||||||||||||||||||||||||
| 2282 | - | |||||||||||||||||||||||||||||||||||||
| 2283 | painter->setPen(textColor); | - | ||||||||||||||||||||||||||||||||||||
| 2284 | painter->drawLine(closeIconRect.left() + 1, closeIconRect.top() + 1, | - | ||||||||||||||||||||||||||||||||||||
| 2285 | closeIconRect.right() - 1, closeIconRect.bottom() - 1); | - | ||||||||||||||||||||||||||||||||||||
| 2286 | painter->drawLine(closeIconRect.left() + 1, closeIconRect.bottom() - 1, | - | ||||||||||||||||||||||||||||||||||||
| 2287 | closeIconRect.right() - 1, closeIconRect.top() + 1); | - | ||||||||||||||||||||||||||||||||||||
| 2288 | } never executed: end of block | 0 | ||||||||||||||||||||||||||||||||||||
| 2289 | } never executed: end of block | 0 | ||||||||||||||||||||||||||||||||||||
| 2290 | - | |||||||||||||||||||||||||||||||||||||
| 2291 | // normalize button | - | ||||||||||||||||||||||||||||||||||||
| 2292 | if ((titleBar->subControls & SC_TitleBarNormalButton) &&
| 0 | ||||||||||||||||||||||||||||||||||||
| 2293 | (((titleBar->titleBarFlags & Qt::WindowMinimizeButtonHint) &&
| 0 | ||||||||||||||||||||||||||||||||||||
| 2294 | (titleBar->titleBarState & Qt::WindowMinimized)) ||
| 0 | ||||||||||||||||||||||||||||||||||||
| 2295 | ((titleBar->titleBarFlags & Qt::WindowMaximizeButtonHint) &&
| 0 | ||||||||||||||||||||||||||||||||||||
| 2296 | (titleBar->titleBarState & Qt::WindowMaximized)))) {
| 0 | ||||||||||||||||||||||||||||||||||||
| 2297 | QRect normalButtonRect = proxy()->subControlRect(CC_TitleBar, titleBar, SC_TitleBarNormalButton, widget); | - | ||||||||||||||||||||||||||||||||||||
| 2298 | if (normalButtonRect.isValid()) {
| 0 | ||||||||||||||||||||||||||||||||||||
| 2299 | - | |||||||||||||||||||||||||||||||||||||
| 2300 | bool hover = (titleBar->activeSubControls & SC_TitleBarNormalButton) && (titleBar->state & State_MouseOver);
| 0 | ||||||||||||||||||||||||||||||||||||
| 2301 | bool sunken = (titleBar->activeSubControls & SC_TitleBarNormalButton) && (titleBar->state & State_Sunken);
| 0 | ||||||||||||||||||||||||||||||||||||
| 2302 | QRect normalButtonIconRect = normalButtonRect.adjusted(buttonMargin, buttonMargin, -buttonMargin, -buttonMargin); | - | ||||||||||||||||||||||||||||||||||||
| 2303 | qt_fusion_draw_mdibutton(painter, titleBar, normalButtonRect, hover, sunken); | - | ||||||||||||||||||||||||||||||||||||
| 2304 | - | |||||||||||||||||||||||||||||||||||||
| 2305 | QRect frontWindowRect = normalButtonIconRect.adjusted(0, 3, -3, 0); | - | ||||||||||||||||||||||||||||||||||||
| 2306 | painter->setPen(textColor); | - | ||||||||||||||||||||||||||||||||||||
| 2307 | painter->drawRect(frontWindowRect.adjusted(0, 0, -1, -1)); | - | ||||||||||||||||||||||||||||||||||||
| 2308 | painter->drawLine(frontWindowRect.left() + 1, frontWindowRect.top() + 1, | - | ||||||||||||||||||||||||||||||||||||
| 2309 | frontWindowRect.right() - 1, frontWindowRect.top() + 1); | - | ||||||||||||||||||||||||||||||||||||
| 2310 | painter->setPen(textAlphaColor); | - | ||||||||||||||||||||||||||||||||||||
| 2311 | const QPoint points[4] = { | - | ||||||||||||||||||||||||||||||||||||
| 2312 | frontWindowRect.topLeft(), | - | ||||||||||||||||||||||||||||||||||||
| 2313 | frontWindowRect.topRight(), | - | ||||||||||||||||||||||||||||||||||||
| 2314 | frontWindowRect.bottomLeft(), | - | ||||||||||||||||||||||||||||||||||||
| 2315 | frontWindowRect.bottomRight() | - | ||||||||||||||||||||||||||||||||||||
| 2316 | }; | - | ||||||||||||||||||||||||||||||||||||
| 2317 | painter->drawPoints(points, 4); | - | ||||||||||||||||||||||||||||||||||||
| 2318 | - | |||||||||||||||||||||||||||||||||||||
| 2319 | QRect backWindowRect = normalButtonIconRect.adjusted(3, 0, 0, -3); | - | ||||||||||||||||||||||||||||||||||||
| 2320 | QRegion clipRegion = backWindowRect; | - | ||||||||||||||||||||||||||||||||||||
| 2321 | clipRegion -= frontWindowRect; | - | ||||||||||||||||||||||||||||||||||||
| 2322 | painter->save(); | - | ||||||||||||||||||||||||||||||||||||
| 2323 | painter->setClipRegion(clipRegion); | - | ||||||||||||||||||||||||||||||||||||
| 2324 | painter->setPen(textColor); | - | ||||||||||||||||||||||||||||||||||||
| 2325 | painter->drawRect(backWindowRect.adjusted(0, 0, -1, -1)); | - | ||||||||||||||||||||||||||||||||||||
| 2326 | painter->drawLine(backWindowRect.left() + 1, backWindowRect.top() + 1, | - | ||||||||||||||||||||||||||||||||||||
| 2327 | backWindowRect.right() - 1, backWindowRect.top() + 1); | - | ||||||||||||||||||||||||||||||||||||
| 2328 | painter->setPen(textAlphaColor); | - | ||||||||||||||||||||||||||||||||||||
| 2329 | const QPoint points2[4] = { | - | ||||||||||||||||||||||||||||||||||||
| 2330 | backWindowRect.topLeft(), | - | ||||||||||||||||||||||||||||||||||||
| 2331 | backWindowRect.topRight(), | - | ||||||||||||||||||||||||||||||||||||
| 2332 | backWindowRect.bottomLeft(), | - | ||||||||||||||||||||||||||||||||||||
| 2333 | backWindowRect.bottomRight() | - | ||||||||||||||||||||||||||||||||||||
| 2334 | }; | - | ||||||||||||||||||||||||||||||||||||
| 2335 | painter->drawPoints(points2, 4); | - | ||||||||||||||||||||||||||||||||||||
| 2336 | painter->restore(); | - | ||||||||||||||||||||||||||||||||||||
| 2337 | } never executed: end of block | 0 | ||||||||||||||||||||||||||||||||||||
| 2338 | } never executed: end of block | 0 | ||||||||||||||||||||||||||||||||||||
| 2339 | - | |||||||||||||||||||||||||||||||||||||
| 2340 | // context help button | - | ||||||||||||||||||||||||||||||||||||
| 2341 | if (titleBar->subControls & SC_TitleBarContextHelpButton
| 0 | ||||||||||||||||||||||||||||||||||||
| 2342 | && (titleBar->titleBarFlags & Qt::WindowContextHelpButtonHint)) {
| 0 | ||||||||||||||||||||||||||||||||||||
| 2343 | QRect contextHelpButtonRect = proxy()->subControlRect(CC_TitleBar, titleBar, SC_TitleBarContextHelpButton, widget); | - | ||||||||||||||||||||||||||||||||||||
| 2344 | if (contextHelpButtonRect.isValid()) {
| 0 | ||||||||||||||||||||||||||||||||||||
| 2345 | bool hover = (titleBar->activeSubControls & SC_TitleBarContextHelpButton) && (titleBar->state & State_MouseOver);
| 0 | ||||||||||||||||||||||||||||||||||||
| 2346 | bool sunken = (titleBar->activeSubControls & SC_TitleBarContextHelpButton) && (titleBar->state & State_Sunken);
| 0 | ||||||||||||||||||||||||||||||||||||
| 2347 | qt_fusion_draw_mdibutton(painter, titleBar, contextHelpButtonRect, hover, sunken); | - | ||||||||||||||||||||||||||||||||||||
| 2348 | QImage image(qt_titlebar_context_help); | - | ||||||||||||||||||||||||||||||||||||
| 2349 | QColor alpha = textColor; | - | ||||||||||||||||||||||||||||||||||||
| 2350 | alpha.setAlpha(128); | - | ||||||||||||||||||||||||||||||||||||
| 2351 | image.setColor(1, textColor.rgba()); | - | ||||||||||||||||||||||||||||||||||||
| 2352 | image.setColor(2, alpha.rgba()); | - | ||||||||||||||||||||||||||||||||||||
| 2353 | painter->setRenderHint(QPainter::SmoothPixmapTransform); | - | ||||||||||||||||||||||||||||||||||||
| 2354 | painter->drawImage(contextHelpButtonRect.adjusted(4, 4, -4, -4), image); | - | ||||||||||||||||||||||||||||||||||||
| 2355 | } never executed: end of block | 0 | ||||||||||||||||||||||||||||||||||||
| 2356 | } never executed: end of block | 0 | ||||||||||||||||||||||||||||||||||||
| 2357 | - | |||||||||||||||||||||||||||||||||||||
| 2358 | // shade button | - | ||||||||||||||||||||||||||||||||||||
| 2359 | if (titleBar->subControls & SC_TitleBarShadeButton && (titleBar->titleBarFlags & Qt::WindowShadeButtonHint)) {
| 0 | ||||||||||||||||||||||||||||||||||||
| 2360 | QRect shadeButtonRect = proxy()->subControlRect(CC_TitleBar, titleBar, SC_TitleBarShadeButton, widget); | - | ||||||||||||||||||||||||||||||||||||
| 2361 | if (shadeButtonRect.isValid()) {
| 0 | ||||||||||||||||||||||||||||||||||||
| 2362 | bool hover = (titleBar->activeSubControls & SC_TitleBarShadeButton) && (titleBar->state & State_MouseOver);
| 0 | ||||||||||||||||||||||||||||||||||||
| 2363 | bool sunken = (titleBar->activeSubControls & SC_TitleBarShadeButton) && (titleBar->state & State_Sunken);
| 0 | ||||||||||||||||||||||||||||||||||||
| 2364 | qt_fusion_draw_mdibutton(painter, titleBar, shadeButtonRect, hover, sunken); | - | ||||||||||||||||||||||||||||||||||||
| 2365 | QPixmap arrow = colorizedImage(QLatin1String(":/qt-project.org/styles/commonstyle/images/fusion_arrow.png"), textColor); | - | ||||||||||||||||||||||||||||||||||||
| 2366 | painter->drawPixmap(shadeButtonRect.adjusted(5, 7, -5, -7), arrow); | - | ||||||||||||||||||||||||||||||||||||
| 2367 | } never executed: end of block | 0 | ||||||||||||||||||||||||||||||||||||
| 2368 | } never executed: end of block | 0 | ||||||||||||||||||||||||||||||||||||
| 2369 | - | |||||||||||||||||||||||||||||||||||||
| 2370 | // unshade button | - | ||||||||||||||||||||||||||||||||||||
| 2371 | if (titleBar->subControls & SC_TitleBarUnshadeButton && (titleBar->titleBarFlags & Qt::WindowShadeButtonHint)) {
| 0 | ||||||||||||||||||||||||||||||||||||
| 2372 | QRect unshadeButtonRect = proxy()->subControlRect(CC_TitleBar, titleBar, SC_TitleBarUnshadeButton, widget); | - | ||||||||||||||||||||||||||||||||||||
| 2373 | if (unshadeButtonRect.isValid()) {
| 0 | ||||||||||||||||||||||||||||||||||||
| 2374 | bool hover = (titleBar->activeSubControls & SC_TitleBarUnshadeButton) && (titleBar->state & State_MouseOver);
| 0 | ||||||||||||||||||||||||||||||||||||
| 2375 | bool sunken = (titleBar->activeSubControls & SC_TitleBarUnshadeButton) && (titleBar->state & State_Sunken);
| 0 | ||||||||||||||||||||||||||||||||||||
| 2376 | qt_fusion_draw_mdibutton(painter, titleBar, unshadeButtonRect, hover, sunken); | - | ||||||||||||||||||||||||||||||||||||
| 2377 | QPixmap arrow = colorizedImage(QLatin1String(":/qt-project.org/styles/commonstyle/images/fusion_arrow.png"), textColor, 180); | - | ||||||||||||||||||||||||||||||||||||
| 2378 | painter->drawPixmap(unshadeButtonRect.adjusted(5, 7, -5, -7), arrow); | - | ||||||||||||||||||||||||||||||||||||
| 2379 | } never executed: end of block | 0 | ||||||||||||||||||||||||||||||||||||
| 2380 | } never executed: end of block | 0 | ||||||||||||||||||||||||||||||||||||
| 2381 | - | |||||||||||||||||||||||||||||||||||||
| 2382 | if ((titleBar->subControls & SC_TitleBarSysMenu) && (titleBar->titleBarFlags & Qt::WindowSystemMenuHint)) {
| 0 | ||||||||||||||||||||||||||||||||||||
| 2383 | QRect iconRect = proxy()->subControlRect(CC_TitleBar, titleBar, SC_TitleBarSysMenu, widget); | - | ||||||||||||||||||||||||||||||||||||
| 2384 | if (iconRect.isValid()) {
| 0 | ||||||||||||||||||||||||||||||||||||
| 2385 | if (!titleBar->icon.isNull()) {
| 0 | ||||||||||||||||||||||||||||||||||||
| 2386 | titleBar->icon.paint(painter, iconRect); | - | ||||||||||||||||||||||||||||||||||||
| 2387 | } else { never executed: end of block | 0 | ||||||||||||||||||||||||||||||||||||
| 2388 | QStyleOption tool = *titleBar; | - | ||||||||||||||||||||||||||||||||||||
| 2389 | QPixmap pm = proxy()->standardIcon(SP_TitleBarMenuButton, &tool, widget).pixmap(16, 16); | - | ||||||||||||||||||||||||||||||||||||
| 2390 | tool.rect = iconRect; | - | ||||||||||||||||||||||||||||||||||||
| 2391 | painter->save(); | - | ||||||||||||||||||||||||||||||||||||
| 2392 | proxy()->drawItemPixmap(painter, iconRect, Qt::AlignCenter, pm); | - | ||||||||||||||||||||||||||||||||||||
| 2393 | painter->restore(); | - | ||||||||||||||||||||||||||||||||||||
| 2394 | } never executed: end of block | 0 | ||||||||||||||||||||||||||||||||||||
| 2395 | } | - | ||||||||||||||||||||||||||||||||||||
| 2396 | } never executed: end of block | 0 | ||||||||||||||||||||||||||||||||||||
| 2397 | } never executed: end of block | 0 | ||||||||||||||||||||||||||||||||||||
| 2398 | painter->restore(); | - | ||||||||||||||||||||||||||||||||||||
| 2399 | break; never executed: break; | 0 | ||||||||||||||||||||||||||||||||||||
| 2400 | case CC_ScrollBar: never executed: case CC_ScrollBar: | 0 | ||||||||||||||||||||||||||||||||||||
| 2401 | painter->save(); | - | ||||||||||||||||||||||||||||||||||||
| 2402 | if (const QStyleOptionSlider *scrollBar = qstyleoption_cast<const QStyleOptionSlider *>(option)) {
| 0 | ||||||||||||||||||||||||||||||||||||
| 2403 | bool wasActive = false; | - | ||||||||||||||||||||||||||||||||||||
| 2404 | qreal expandScale = 1.0; | - | ||||||||||||||||||||||||||||||||||||
| 2405 | qreal expandOffset = -1.0; | - | ||||||||||||||||||||||||||||||||||||
| 2406 | QObject *styleObject = option->styleObject; | - | ||||||||||||||||||||||||||||||||||||
| 2407 | if (styleObject && proxy()->styleHint(SH_ScrollBar_Transient, option, widget)) {
| 0 | ||||||||||||||||||||||||||||||||||||
| 2408 | qreal opacity = 0.0; | - | ||||||||||||||||||||||||||||||||||||
| 2409 | bool shouldExpand = false; | - | ||||||||||||||||||||||||||||||||||||
| 2410 | const qreal maxExpandScale = 13.0 / 9.0; | - | ||||||||||||||||||||||||||||||||||||
| 2411 | - | |||||||||||||||||||||||||||||||||||||
| 2412 | int oldPos = styleObject->property("_q_stylepos").toInt(); | - | ||||||||||||||||||||||||||||||||||||
| 2413 | int oldMin = styleObject->property("_q_stylemin").toInt(); | - | ||||||||||||||||||||||||||||||||||||
| 2414 | int oldMax = styleObject->property("_q_stylemax").toInt(); | - | ||||||||||||||||||||||||||||||||||||
| 2415 | QRect oldRect = styleObject->property("_q_stylerect").toRect(); | - | ||||||||||||||||||||||||||||||||||||
| 2416 | int oldState = styleObject->property("_q_stylestate").toInt(); | - | ||||||||||||||||||||||||||||||||||||
| 2417 | uint oldActiveControls = styleObject->property("_q_stylecontrols").toUInt(); | - | ||||||||||||||||||||||||||||||||||||
| 2418 | - | |||||||||||||||||||||||||||||||||||||
| 2419 | // a scrollbar is transient when the the scrollbar itself and | - | ||||||||||||||||||||||||||||||||||||
| 2420 | // its sibling are both inactive (ie. not pressed/hovered/moved) | - | ||||||||||||||||||||||||||||||||||||
| 2421 | bool transient = !option->activeSubControls && !(option->state & State_On);
| 0 | ||||||||||||||||||||||||||||||||||||
| 2422 | - | |||||||||||||||||||||||||||||||||||||
| 2423 | if (!transient ||
| 0 | ||||||||||||||||||||||||||||||||||||
| 2424 | oldPos != scrollBar->sliderPosition ||
| 0 | ||||||||||||||||||||||||||||||||||||
| 2425 | oldMin != scrollBar->minimum ||
| 0 | ||||||||||||||||||||||||||||||||||||
| 2426 | oldMax != scrollBar->maximum ||
| 0 | ||||||||||||||||||||||||||||||||||||
| 2427 | oldRect != scrollBar->rect ||
| 0 | ||||||||||||||||||||||||||||||||||||
| 2428 | oldState != scrollBar->state ||
| 0 | ||||||||||||||||||||||||||||||||||||
| 2429 | oldActiveControls != scrollBar->activeSubControls) {
| 0 | ||||||||||||||||||||||||||||||||||||
| 2430 | - | |||||||||||||||||||||||||||||||||||||
| 2431 | // if the scrollbar is transient or its attributes, geometry or | - | ||||||||||||||||||||||||||||||||||||
| 2432 | // state has changed, the opacity is reset back to 100% opaque | - | ||||||||||||||||||||||||||||||||||||
| 2433 | opacity = 1.0; | - | ||||||||||||||||||||||||||||||||||||
| 2434 | - | |||||||||||||||||||||||||||||||||||||
| 2435 | styleObject->setProperty("_q_stylepos", scrollBar->sliderPosition); | - | ||||||||||||||||||||||||||||||||||||
| 2436 | styleObject->setProperty("_q_stylemin", scrollBar->minimum); | - | ||||||||||||||||||||||||||||||||||||
| 2437 | styleObject->setProperty("_q_stylemax", scrollBar->maximum); | - | ||||||||||||||||||||||||||||||||||||
| 2438 | styleObject->setProperty("_q_stylerect", scrollBar->rect); | - | ||||||||||||||||||||||||||||||||||||
| 2439 | styleObject->setProperty("_q_stylestate", static_cast<int>(scrollBar->state)); | - | ||||||||||||||||||||||||||||||||||||
| 2440 | styleObject->setProperty("_q_stylecontrols", static_cast<uint>(scrollBar->activeSubControls)); | - | ||||||||||||||||||||||||||||||||||||
| 2441 | - | |||||||||||||||||||||||||||||||||||||
| 2442 | #ifndef QT_NO_ANIMATION | - | ||||||||||||||||||||||||||||||||||||
| 2443 | QScrollbarStyleAnimation *anim = qobject_cast<QScrollbarStyleAnimation *>(d->animation(styleObject)); | - | ||||||||||||||||||||||||||||||||||||
| 2444 | if (transient) {
| 0 | ||||||||||||||||||||||||||||||||||||
| 2445 | if (!anim) {
| 0 | ||||||||||||||||||||||||||||||||||||
| 2446 | anim = new QScrollbarStyleAnimation(QScrollbarStyleAnimation::Deactivating, styleObject); | - | ||||||||||||||||||||||||||||||||||||
| 2447 | d->startAnimation(anim); | - | ||||||||||||||||||||||||||||||||||||
| 2448 | } else if (anim->mode() == QScrollbarStyleAnimation::Deactivating) { never executed: end of block
| 0 | ||||||||||||||||||||||||||||||||||||
| 2449 | // the scrollbar was already fading out while the | - | ||||||||||||||||||||||||||||||||||||
| 2450 | // state changed -> restart the fade out animation | - | ||||||||||||||||||||||||||||||||||||
| 2451 | anim->setCurrentTime(0); | - | ||||||||||||||||||||||||||||||||||||
| 2452 | } never executed: end of block | 0 | ||||||||||||||||||||||||||||||||||||
| 2453 | } else if (anim && anim->mode() == QScrollbarStyleAnimation::Deactivating) { never executed: end of block
| 0 | ||||||||||||||||||||||||||||||||||||
| 2454 | d->stopAnimation(styleObject); | - | ||||||||||||||||||||||||||||||||||||
| 2455 | } never executed: end of block | 0 | ||||||||||||||||||||||||||||||||||||
| 2456 | #endif // !QT_NO_ANIMATION | - | ||||||||||||||||||||||||||||||||||||
| 2457 | } never executed: end of block | 0 | ||||||||||||||||||||||||||||||||||||
| 2458 | - | |||||||||||||||||||||||||||||||||||||
| 2459 | #ifndef QT_NO_ANIMATION | - | ||||||||||||||||||||||||||||||||||||
| 2460 | QScrollbarStyleAnimation *anim = qobject_cast<QScrollbarStyleAnimation *>(d->animation(styleObject)); | - | ||||||||||||||||||||||||||||||||||||
| 2461 | if (anim && anim->mode() == QScrollbarStyleAnimation::Deactivating) {
| 0 | ||||||||||||||||||||||||||||||||||||
| 2462 | // once a scrollbar was active (hovered/pressed), it retains | - | ||||||||||||||||||||||||||||||||||||
| 2463 | // the active look even if it's no longer active while fading out | - | ||||||||||||||||||||||||||||||||||||
| 2464 | if (oldActiveControls)
| 0 | ||||||||||||||||||||||||||||||||||||
| 2465 | anim->setActive(true); never executed: anim->setActive(true); | 0 | ||||||||||||||||||||||||||||||||||||
| 2466 | - | |||||||||||||||||||||||||||||||||||||
| 2467 | wasActive = anim->wasActive(); | - | ||||||||||||||||||||||||||||||||||||
| 2468 | opacity = anim->currentValue(); | - | ||||||||||||||||||||||||||||||||||||
| 2469 | } never executed: end of block | 0 | ||||||||||||||||||||||||||||||||||||
| 2470 | - | |||||||||||||||||||||||||||||||||||||
| 2471 | shouldExpand = (option->activeSubControls || wasActive);
| 0 | ||||||||||||||||||||||||||||||||||||
| 2472 | if (shouldExpand) {
| 0 | ||||||||||||||||||||||||||||||||||||
| 2473 | if (!anim && !oldActiveControls) {
| 0 | ||||||||||||||||||||||||||||||||||||
| 2474 | // Start expand animation only once and when entering | - | ||||||||||||||||||||||||||||||||||||
| 2475 | anim = new QScrollbarStyleAnimation(QScrollbarStyleAnimation::Activating, styleObject); | - | ||||||||||||||||||||||||||||||||||||
| 2476 | d->startAnimation(anim); | - | ||||||||||||||||||||||||||||||||||||
| 2477 | } never executed: end of block | 0 | ||||||||||||||||||||||||||||||||||||
| 2478 | if (anim && anim->mode() == QScrollbarStyleAnimation::Activating) {
| 0 | ||||||||||||||||||||||||||||||||||||
| 2479 | expandScale = 1.0 + (maxExpandScale - 1.0) * anim->currentValue(); | - | ||||||||||||||||||||||||||||||||||||
| 2480 | expandOffset = 5.5 * anim->currentValue() - 1; | - | ||||||||||||||||||||||||||||||||||||
| 2481 | } else { never executed: end of block | 0 | ||||||||||||||||||||||||||||||||||||
| 2482 | // Keep expanded state after the animation ends, and when fading out | - | ||||||||||||||||||||||||||||||||||||
| 2483 | expandScale = maxExpandScale; | - | ||||||||||||||||||||||||||||||||||||
| 2484 | expandOffset = 4.5; | - | ||||||||||||||||||||||||||||||||||||
| 2485 | } never executed: end of block | 0 | ||||||||||||||||||||||||||||||||||||
| 2486 | } | - | ||||||||||||||||||||||||||||||||||||
| 2487 | painter->setOpacity(opacity); | - | ||||||||||||||||||||||||||||||||||||
| 2488 | #endif // !QT_NO_ANIMATION | - | ||||||||||||||||||||||||||||||||||||
| 2489 | } never executed: end of block | 0 | ||||||||||||||||||||||||||||||||||||
| 2490 | - | |||||||||||||||||||||||||||||||||||||
| 2491 | bool transient = proxy()->styleHint(SH_ScrollBar_Transient, option, widget); | - | ||||||||||||||||||||||||||||||||||||
| 2492 | bool horizontal = scrollBar->orientation == Qt::Horizontal; | - | ||||||||||||||||||||||||||||||||||||
| 2493 | bool sunken = scrollBar->state & State_Sunken; | - | ||||||||||||||||||||||||||||||||||||
| 2494 | - | |||||||||||||||||||||||||||||||||||||
| 2495 | QRect scrollBarSubLine = proxy()->subControlRect(control, scrollBar, SC_ScrollBarSubLine, widget); | - | ||||||||||||||||||||||||||||||||||||
| 2496 | QRect scrollBarAddLine = proxy()->subControlRect(control, scrollBar, SC_ScrollBarAddLine, widget); | - | ||||||||||||||||||||||||||||||||||||
| 2497 | QRect scrollBarSlider = proxy()->subControlRect(control, scrollBar, SC_ScrollBarSlider, widget); | - | ||||||||||||||||||||||||||||||||||||
| 2498 | QRect scrollBarGroove = proxy()->subControlRect(control, scrollBar, SC_ScrollBarGroove, widget); | - | ||||||||||||||||||||||||||||||||||||
| 2499 | - | |||||||||||||||||||||||||||||||||||||
| 2500 | QRect rect = option->rect; | - | ||||||||||||||||||||||||||||||||||||
| 2501 | QColor alphaOutline = outline; | - | ||||||||||||||||||||||||||||||||||||
| 2502 | alphaOutline.setAlpha(180); | - | ||||||||||||||||||||||||||||||||||||
| 2503 | - | |||||||||||||||||||||||||||||||||||||
| 2504 | QColor arrowColor = option->palette.foreground().color(); | - | ||||||||||||||||||||||||||||||||||||
| 2505 | arrowColor.setAlpha(220); | - | ||||||||||||||||||||||||||||||||||||
| 2506 | - | |||||||||||||||||||||||||||||||||||||
| 2507 | const QColor bgColor = QStyleHelper::backgroundColor(option->palette, widget); | - | ||||||||||||||||||||||||||||||||||||
| 2508 | const bool isDarkBg = bgColor.red() < 128 && bgColor.green() < 128 && bgColor.blue() < 128;
| 0 | ||||||||||||||||||||||||||||||||||||
| 2509 | - | |||||||||||||||||||||||||||||||||||||
| 2510 | if (transient) {
| 0 | ||||||||||||||||||||||||||||||||||||
| 2511 | if (horizontal) {
| 0 | ||||||||||||||||||||||||||||||||||||
| 2512 | rect.setY(rect.y() + 4.5 - expandOffset); | - | ||||||||||||||||||||||||||||||||||||
| 2513 | scrollBarSlider.setY(scrollBarSlider.y() + 4.5 - expandOffset); | - | ||||||||||||||||||||||||||||||||||||
| 2514 | scrollBarGroove.setY(scrollBarGroove.y() + 4.5 - expandOffset); | - | ||||||||||||||||||||||||||||||||||||
| 2515 | - | |||||||||||||||||||||||||||||||||||||
| 2516 | rect.setHeight(rect.height() * expandScale); | - | ||||||||||||||||||||||||||||||||||||
| 2517 | scrollBarGroove.setHeight(scrollBarGroove.height() * expandScale); | - | ||||||||||||||||||||||||||||||||||||
| 2518 | } else { never executed: end of block | 0 | ||||||||||||||||||||||||||||||||||||
| 2519 | rect.setX(rect.x() + 4.5 - expandOffset); | - | ||||||||||||||||||||||||||||||||||||
| 2520 | scrollBarSlider.setX(scrollBarSlider.x() + 4.5 - expandOffset); | - | ||||||||||||||||||||||||||||||||||||
| 2521 | scrollBarGroove.setX(scrollBarGroove.x() + 4.5 - expandOffset); | - | ||||||||||||||||||||||||||||||||||||
| 2522 | - | |||||||||||||||||||||||||||||||||||||
| 2523 | rect.setWidth(rect.width() * expandScale); | - | ||||||||||||||||||||||||||||||||||||
| 2524 | scrollBarGroove.setWidth(scrollBarGroove.width() * expandScale); | - | ||||||||||||||||||||||||||||||||||||
| 2525 | } never executed: end of block | 0 | ||||||||||||||||||||||||||||||||||||
| 2526 | } | - | ||||||||||||||||||||||||||||||||||||
| 2527 | - | |||||||||||||||||||||||||||||||||||||
| 2528 | // Paint groove | - | ||||||||||||||||||||||||||||||||||||
| 2529 | if ((!transient || scrollBar->activeSubControls || wasActive) && scrollBar->subControls & SC_ScrollBarGroove) {
| 0 | ||||||||||||||||||||||||||||||||||||
| 2530 | QLinearGradient gradient(rect.center().x(), rect.top(), | - | ||||||||||||||||||||||||||||||||||||
| 2531 | rect.center().x(), rect.bottom()); | - | ||||||||||||||||||||||||||||||||||||
| 2532 | if (!horizontal)
| 0 | ||||||||||||||||||||||||||||||||||||
| 2533 | gradient = QLinearGradient(rect.left(), rect.center().y(), never executed: gradient = QLinearGradient(rect.left(), rect.center().y(), rect.right(), rect.center().y()); | 0 | ||||||||||||||||||||||||||||||||||||
| 2534 | rect.right(), rect.center().y()); never executed: gradient = QLinearGradient(rect.left(), rect.center().y(), rect.right(), rect.center().y()); | 0 | ||||||||||||||||||||||||||||||||||||
| 2535 | if (!transient || !isDarkBg) {
| 0 | ||||||||||||||||||||||||||||||||||||
| 2536 | gradient.setColorAt(0, buttonColor.darker(107)); | - | ||||||||||||||||||||||||||||||||||||
| 2537 | gradient.setColorAt(0.1, buttonColor.darker(105)); | - | ||||||||||||||||||||||||||||||||||||
| 2538 | gradient.setColorAt(0.9, buttonColor.darker(105)); | - | ||||||||||||||||||||||||||||||||||||
| 2539 | gradient.setColorAt(1, buttonColor.darker(107)); | - | ||||||||||||||||||||||||||||||||||||
| 2540 | } else { never executed: end of block | 0 | ||||||||||||||||||||||||||||||||||||
| 2541 | gradient.setColorAt(0, bgColor.lighter(157)); | - | ||||||||||||||||||||||||||||||||||||
| 2542 | gradient.setColorAt(0.1, bgColor.lighter(155)); | - | ||||||||||||||||||||||||||||||||||||
| 2543 | gradient.setColorAt(0.9, bgColor.lighter(155)); | - | ||||||||||||||||||||||||||||||||||||
| 2544 | gradient.setColorAt(1, bgColor.lighter(157)); | - | ||||||||||||||||||||||||||||||||||||
| 2545 | } never executed: end of block | 0 | ||||||||||||||||||||||||||||||||||||
| 2546 | - | |||||||||||||||||||||||||||||||||||||
| 2547 | painter->save(); | - | ||||||||||||||||||||||||||||||||||||
| 2548 | if (transient)
| 0 | ||||||||||||||||||||||||||||||||||||
| 2549 | painter->setOpacity(0.8); never executed: painter->setOpacity(0.8); | 0 | ||||||||||||||||||||||||||||||||||||
| 2550 | painter->fillRect(rect, gradient); | - | ||||||||||||||||||||||||||||||||||||
| 2551 | painter->setPen(Qt::NoPen); | - | ||||||||||||||||||||||||||||||||||||
| 2552 | if (transient)
| 0 | ||||||||||||||||||||||||||||||||||||
| 2553 | painter->setOpacity(0.4); never executed: painter->setOpacity(0.4); | 0 | ||||||||||||||||||||||||||||||||||||
| 2554 | painter->setPen(alphaOutline); | - | ||||||||||||||||||||||||||||||||||||
| 2555 | if (horizontal)
| 0 | ||||||||||||||||||||||||||||||||||||
| 2556 | painter->drawLine(rect.topLeft(), rect.topRight()); never executed: painter->drawLine(rect.topLeft(), rect.topRight()); | 0 | ||||||||||||||||||||||||||||||||||||
| 2557 | else | - | ||||||||||||||||||||||||||||||||||||
| 2558 | painter->drawLine(rect.topLeft(), rect.bottomLeft()); never executed: painter->drawLine(rect.topLeft(), rect.bottomLeft()); | 0 | ||||||||||||||||||||||||||||||||||||
| 2559 | - | |||||||||||||||||||||||||||||||||||||
| 2560 | QColor subtleEdge = alphaOutline; | - | ||||||||||||||||||||||||||||||||||||
| 2561 | subtleEdge.setAlpha(40); | - | ||||||||||||||||||||||||||||||||||||
| 2562 | painter->setPen(Qt::NoPen); | - | ||||||||||||||||||||||||||||||||||||
| 2563 | painter->setBrush(Qt::NoBrush); | - | ||||||||||||||||||||||||||||||||||||
| 2564 | painter->setClipRect(scrollBarGroove.adjusted(1, 0, -1, -3)); | - | ||||||||||||||||||||||||||||||||||||
| 2565 | painter->drawRect(scrollBarGroove.adjusted(1, 0, -1, -1)); | - | ||||||||||||||||||||||||||||||||||||
| 2566 | painter->restore(); | - | ||||||||||||||||||||||||||||||||||||
| 2567 | } never executed: end of block | 0 | ||||||||||||||||||||||||||||||||||||
| 2568 | - | |||||||||||||||||||||||||||||||||||||
| 2569 | QRect pixmapRect = scrollBarSlider; | - | ||||||||||||||||||||||||||||||||||||
| 2570 | QLinearGradient gradient(pixmapRect.center().x(), pixmapRect.top(), | - | ||||||||||||||||||||||||||||||||||||
| 2571 | pixmapRect.center().x(), pixmapRect.bottom()); | - | ||||||||||||||||||||||||||||||||||||
| 2572 | if (!horizontal)
| 0 | ||||||||||||||||||||||||||||||||||||
| 2573 | gradient = QLinearGradient(pixmapRect.left(), pixmapRect.center().y(), never executed: gradient = QLinearGradient(pixmapRect.left(), pixmapRect.center().y(), pixmapRect.right(), pixmapRect.center().y()); | 0 | ||||||||||||||||||||||||||||||||||||
| 2574 | pixmapRect.right(), pixmapRect.center().y()); never executed: gradient = QLinearGradient(pixmapRect.left(), pixmapRect.center().y(), pixmapRect.right(), pixmapRect.center().y()); | 0 | ||||||||||||||||||||||||||||||||||||
| 2575 | - | |||||||||||||||||||||||||||||||||||||
| 2576 | QLinearGradient highlightedGradient = gradient; | - | ||||||||||||||||||||||||||||||||||||
| 2577 | - | |||||||||||||||||||||||||||||||||||||
| 2578 | QColor midColor2 = mergedColors(gradientStartColor, gradientStopColor, 40); | - | ||||||||||||||||||||||||||||||||||||
| 2579 | gradient.setColorAt(0, d->buttonColor(option->palette).lighter(108)); | - | ||||||||||||||||||||||||||||||||||||
| 2580 | gradient.setColorAt(1, d->buttonColor(option->palette)); | - | ||||||||||||||||||||||||||||||||||||
| 2581 | - | |||||||||||||||||||||||||||||||||||||
| 2582 | highlightedGradient.setColorAt(0, gradientStartColor.darker(102)); | - | ||||||||||||||||||||||||||||||||||||
| 2583 | highlightedGradient.setColorAt(1, gradientStopColor.lighter(102)); | - | ||||||||||||||||||||||||||||||||||||
| 2584 | - | |||||||||||||||||||||||||||||||||||||
| 2585 | // Paint slider | - | ||||||||||||||||||||||||||||||||||||
| 2586 | if (scrollBar->subControls & SC_ScrollBarSlider) {
| 0 | ||||||||||||||||||||||||||||||||||||
| 2587 | if (transient) {
| 0 | ||||||||||||||||||||||||||||||||||||
| 2588 | QRect rect = scrollBarSlider.adjusted(horizontal ? 1 : 2, horizontal ? 2 : 1, -1, -1); | - | ||||||||||||||||||||||||||||||||||||
| 2589 | painter->setPen(Qt::NoPen); | - | ||||||||||||||||||||||||||||||||||||
| 2590 | painter->setBrush(isDarkBg ? d->lightShade() : d->darkShade()); | - | ||||||||||||||||||||||||||||||||||||
| 2591 | int r = qMin(rect.width(), rect.height()) / 2; | - | ||||||||||||||||||||||||||||||||||||
| 2592 | - | |||||||||||||||||||||||||||||||||||||
| 2593 | painter->save(); | - | ||||||||||||||||||||||||||||||||||||
| 2594 | painter->setRenderHint(QPainter::Antialiasing, true); | - | ||||||||||||||||||||||||||||||||||||
| 2595 | painter->drawRoundedRect(rect, r, r); | - | ||||||||||||||||||||||||||||||||||||
| 2596 | painter->restore(); | - | ||||||||||||||||||||||||||||||||||||
| 2597 | } else { never executed: end of block | 0 | ||||||||||||||||||||||||||||||||||||
| 2598 | QRect pixmapRect = scrollBarSlider; | - | ||||||||||||||||||||||||||||||||||||
| 2599 | painter->setPen(QPen(alphaOutline)); | - | ||||||||||||||||||||||||||||||||||||
| 2600 | if (option->state & State_Sunken && scrollBar->activeSubControls & SC_ScrollBarSlider)
| 0 | ||||||||||||||||||||||||||||||||||||
| 2601 | painter->setBrush(midColor2); never executed: painter->setBrush(midColor2); | 0 | ||||||||||||||||||||||||||||||||||||
| 2602 | else if (option->state & State_MouseOver && scrollBar->activeSubControls & SC_ScrollBarSlider)
| 0 | ||||||||||||||||||||||||||||||||||||
| 2603 | painter->setBrush(highlightedGradient); never executed: painter->setBrush(highlightedGradient); | 0 | ||||||||||||||||||||||||||||||||||||
| 2604 | else | - | ||||||||||||||||||||||||||||||||||||
| 2605 | painter->setBrush(gradient); never executed: painter->setBrush(gradient); | 0 | ||||||||||||||||||||||||||||||||||||
| 2606 | - | |||||||||||||||||||||||||||||||||||||
| 2607 | painter->drawRect(pixmapRect.adjusted(horizontal ? -1 : 0, horizontal ? 0 : -1, horizontal ? 0 : 1, horizontal ? 1 : 0)); | - | ||||||||||||||||||||||||||||||||||||
| 2608 | - | |||||||||||||||||||||||||||||||||||||
| 2609 | painter->setPen(d->innerContrastLine()); | - | ||||||||||||||||||||||||||||||||||||
| 2610 | painter->drawRect(scrollBarSlider.adjusted(horizontal ? 0 : 1, horizontal ? 1 : 0, -1, -1)); | - | ||||||||||||||||||||||||||||||||||||
| 2611 | - | |||||||||||||||||||||||||||||||||||||
| 2612 | // Outer shadow | - | ||||||||||||||||||||||||||||||||||||
| 2613 | // painter->setPen(subtleEdge); | - | ||||||||||||||||||||||||||||||||||||
| 2614 | // if (horizontal) { | - | ||||||||||||||||||||||||||||||||||||
| 2615 | //// painter->drawLine(scrollBarSlider.topLeft() + QPoint(-2, 0), scrollBarSlider.bottomLeft() + QPoint(2, 0)); | - | ||||||||||||||||||||||||||||||||||||
| 2616 | //// painter->drawLine(scrollBarSlider.topRight() + QPoint(-2, 0), scrollBarSlider.bottomRight() + QPoint(2, 0)); | - | ||||||||||||||||||||||||||||||||||||
| 2617 | // } else { | - | ||||||||||||||||||||||||||||||||||||
| 2618 | //// painter->drawLine(pixmapRect.topLeft() + QPoint(0, -2), pixmapRect.bottomLeft() + QPoint(0, -2)); | - | ||||||||||||||||||||||||||||||||||||
| 2619 | //// painter->drawLine(pixmapRect.topRight() + QPoint(0, 2), pixmapRect.bottomRight() + QPoint(0, 2)); | - | ||||||||||||||||||||||||||||||||||||
| 2620 | // } | - | ||||||||||||||||||||||||||||||||||||
| 2621 | } never executed: end of block | 0 | ||||||||||||||||||||||||||||||||||||
| 2622 | } | - | ||||||||||||||||||||||||||||||||||||
| 2623 | - | |||||||||||||||||||||||||||||||||||||
| 2624 | // The SubLine (up/left) buttons | - | ||||||||||||||||||||||||||||||||||||
| 2625 | if (!transient && scrollBar->subControls & SC_ScrollBarSubLine) {
| 0 | ||||||||||||||||||||||||||||||||||||
| 2626 | if ((scrollBar->activeSubControls & SC_ScrollBarSubLine) && sunken)
| 0 | ||||||||||||||||||||||||||||||||||||
| 2627 | painter->setBrush(gradientStopColor); never executed: painter->setBrush(gradientStopColor); | 0 | ||||||||||||||||||||||||||||||||||||
| 2628 | else if ((scrollBar->activeSubControls & SC_ScrollBarSubLine))
| 0 | ||||||||||||||||||||||||||||||||||||
| 2629 | painter->setBrush(highlightedGradient); never executed: painter->setBrush(highlightedGradient); | 0 | ||||||||||||||||||||||||||||||||||||
| 2630 | else | - | ||||||||||||||||||||||||||||||||||||
| 2631 | painter->setBrush(gradient); never executed: painter->setBrush(gradient); | 0 | ||||||||||||||||||||||||||||||||||||
| 2632 | - | |||||||||||||||||||||||||||||||||||||
| 2633 | painter->setPen(Qt::NoPen); | - | ||||||||||||||||||||||||||||||||||||
| 2634 | painter->drawRect(scrollBarSubLine.adjusted(horizontal ? 0 : 1, horizontal ? 1 : 0, 0, 0)); | - | ||||||||||||||||||||||||||||||||||||
| 2635 | painter->setPen(QPen(alphaOutline)); | - | ||||||||||||||||||||||||||||||||||||
| 2636 | if (option->state & State_Horizontal) {
| 0 | ||||||||||||||||||||||||||||||||||||
| 2637 | if (option->direction == Qt::RightToLeft) {
| 0 | ||||||||||||||||||||||||||||||||||||
| 2638 | pixmapRect.setLeft(scrollBarSubLine.left()); | - | ||||||||||||||||||||||||||||||||||||
| 2639 | painter->drawLine(pixmapRect.topLeft(), pixmapRect.bottomLeft()); | - | ||||||||||||||||||||||||||||||||||||
| 2640 | } else { never executed: end of block | 0 | ||||||||||||||||||||||||||||||||||||
| 2641 | pixmapRect.setRight(scrollBarSubLine.right()); | - | ||||||||||||||||||||||||||||||||||||
| 2642 | painter->drawLine(pixmapRect.topRight(), pixmapRect.bottomRight()); | - | ||||||||||||||||||||||||||||||||||||
| 2643 | } never executed: end of block | 0 | ||||||||||||||||||||||||||||||||||||
| 2644 | } else { | - | ||||||||||||||||||||||||||||||||||||
| 2645 | pixmapRect.setBottom(scrollBarSubLine.bottom()); | - | ||||||||||||||||||||||||||||||||||||
| 2646 | painter->drawLine(pixmapRect.bottomLeft(), pixmapRect.bottomRight()); | - | ||||||||||||||||||||||||||||||||||||
| 2647 | } never executed: end of block | 0 | ||||||||||||||||||||||||||||||||||||
| 2648 | - | |||||||||||||||||||||||||||||||||||||
| 2649 | painter->setBrush(Qt::NoBrush); | - | ||||||||||||||||||||||||||||||||||||
| 2650 | painter->setPen(d->innerContrastLine()); | - | ||||||||||||||||||||||||||||||||||||
| 2651 | painter->drawRect(scrollBarSubLine.adjusted(horizontal ? 0 : 1, horizontal ? 1 : 0 , horizontal ? -2 : -1, horizontal ? -1 : -2)); | - | ||||||||||||||||||||||||||||||||||||
| 2652 | - | |||||||||||||||||||||||||||||||||||||
| 2653 | // Arrows | - | ||||||||||||||||||||||||||||||||||||
| 2654 | int rotation = 0; | - | ||||||||||||||||||||||||||||||||||||
| 2655 | if (option->state & State_Horizontal)
| 0 | ||||||||||||||||||||||||||||||||||||
| 2656 | rotation = option->direction == Qt::LeftToRight ? -90 : 90; never executed: rotation = option->direction == Qt::LeftToRight ? -90 : 90;
| 0 | ||||||||||||||||||||||||||||||||||||
| 2657 | QRect upRect = scrollBarSubLine.translated(horizontal ? -2 : -1, 0); | - | ||||||||||||||||||||||||||||||||||||
| 2658 | QPixmap arrowPixmap = colorizedImage(QLatin1String(":/qt-project.org/styles/commonstyle/images/fusion_arrow.png"), arrowColor, rotation); | - | ||||||||||||||||||||||||||||||||||||
| 2659 | painter->drawPixmap(QRectF(upRect.center().x() - arrowPixmap.width() / 4.0 + 2.0, | - | ||||||||||||||||||||||||||||||||||||
| 2660 | upRect.center().y() - arrowPixmap.height() / 4.0 + 1.0, | - | ||||||||||||||||||||||||||||||||||||
| 2661 | arrowPixmap.width() / 2.0, arrowPixmap.height() / 2.0), | - | ||||||||||||||||||||||||||||||||||||
| 2662 | arrowPixmap, QRectF(QPoint(0.0, 0.0), arrowPixmap.size())); | - | ||||||||||||||||||||||||||||||||||||
| 2663 | } never executed: end of block | 0 | ||||||||||||||||||||||||||||||||||||
| 2664 | - | |||||||||||||||||||||||||||||||||||||
| 2665 | // The AddLine (down/right) button | - | ||||||||||||||||||||||||||||||||||||
| 2666 | if (!transient && scrollBar->subControls & SC_ScrollBarAddLine) {
| 0 | ||||||||||||||||||||||||||||||||||||
| 2667 | if ((scrollBar->activeSubControls & SC_ScrollBarAddLine) && sunken)
| 0 | ||||||||||||||||||||||||||||||||||||
| 2668 | painter->setBrush(gradientStopColor); never executed: painter->setBrush(gradientStopColor); | 0 | ||||||||||||||||||||||||||||||||||||
| 2669 | else if ((scrollBar->activeSubControls & SC_ScrollBarAddLine))
| 0 | ||||||||||||||||||||||||||||||||||||
| 2670 | painter->setBrush(midColor2); never executed: painter->setBrush(midColor2); | 0 | ||||||||||||||||||||||||||||||||||||
| 2671 | else | - | ||||||||||||||||||||||||||||||||||||
| 2672 | painter->setBrush(gradient); never executed: painter->setBrush(gradient); | 0 | ||||||||||||||||||||||||||||||||||||
| 2673 | - | |||||||||||||||||||||||||||||||||||||
| 2674 | painter->setPen(Qt::NoPen); | - | ||||||||||||||||||||||||||||||||||||
| 2675 | painter->drawRect(scrollBarAddLine.adjusted(horizontal ? 0 : 1, horizontal ? 1 : 0, 0, 0)); | - | ||||||||||||||||||||||||||||||||||||
| 2676 | painter->setPen(QPen(alphaOutline, 1)); | - | ||||||||||||||||||||||||||||||||||||
| 2677 | if (option->state & State_Horizontal) {
| 0 | ||||||||||||||||||||||||||||||||||||
| 2678 | if (option->direction == Qt::LeftToRight) {
| 0 | ||||||||||||||||||||||||||||||||||||
| 2679 | pixmapRect.setLeft(scrollBarAddLine.left()); | - | ||||||||||||||||||||||||||||||||||||
| 2680 | painter->drawLine(pixmapRect.topLeft(), pixmapRect.bottomLeft()); | - | ||||||||||||||||||||||||||||||||||||
| 2681 | } else { never executed: end of block | 0 | ||||||||||||||||||||||||||||||||||||
| 2682 | pixmapRect.setRight(scrollBarAddLine.right()); | - | ||||||||||||||||||||||||||||||||||||
| 2683 | painter->drawLine(pixmapRect.topRight(), pixmapRect.bottomRight()); | - | ||||||||||||||||||||||||||||||||||||
| 2684 | } never executed: end of block | 0 | ||||||||||||||||||||||||||||||||||||
| 2685 | } else { | - | ||||||||||||||||||||||||||||||||||||
| 2686 | pixmapRect.setTop(scrollBarAddLine.top()); | - | ||||||||||||||||||||||||||||||||||||
| 2687 | painter->drawLine(pixmapRect.topLeft(), pixmapRect.topRight()); | - | ||||||||||||||||||||||||||||||||||||
| 2688 | } never executed: end of block | 0 | ||||||||||||||||||||||||||||||||||||
| 2689 | - | |||||||||||||||||||||||||||||||||||||
| 2690 | painter->setPen(d->innerContrastLine()); | - | ||||||||||||||||||||||||||||||||||||
| 2691 | painter->setBrush(Qt::NoBrush); | - | ||||||||||||||||||||||||||||||||||||
| 2692 | painter->drawRect(scrollBarAddLine.adjusted(1, 1, -1, -1)); | - | ||||||||||||||||||||||||||||||||||||
| 2693 | - | |||||||||||||||||||||||||||||||||||||
| 2694 | int rotation = 180; | - | ||||||||||||||||||||||||||||||||||||
| 2695 | if (option->state & State_Horizontal)
| 0 | ||||||||||||||||||||||||||||||||||||
| 2696 | rotation = option->direction == Qt::LeftToRight ? 90 : -90; never executed: rotation = option->direction == Qt::LeftToRight ? 90 : -90;
| 0 | ||||||||||||||||||||||||||||||||||||
| 2697 | QRect downRect = scrollBarAddLine.translated(-1, 1); | - | ||||||||||||||||||||||||||||||||||||
| 2698 | QPixmap arrowPixmap = colorizedImage(QLatin1String(":/qt-project.org/styles/commonstyle/images/fusion_arrow.png"), arrowColor, rotation); | - | ||||||||||||||||||||||||||||||||||||
| 2699 | painter->drawPixmap(QRectF(downRect.center().x() - arrowPixmap.width() / 4.0 + 2.0, | - | ||||||||||||||||||||||||||||||||||||
| 2700 | downRect.center().y() - arrowPixmap.height() / 4.0, | - | ||||||||||||||||||||||||||||||||||||
| 2701 | arrowPixmap.width() / 2.0, arrowPixmap.height() / 2.0), | - | ||||||||||||||||||||||||||||||||||||
| 2702 | arrowPixmap, QRectF(QPoint(0.0, 0.0), arrowPixmap.size())); | - | ||||||||||||||||||||||||||||||||||||
| 2703 | } never executed: end of block | 0 | ||||||||||||||||||||||||||||||||||||
| 2704 | - | |||||||||||||||||||||||||||||||||||||
| 2705 | } never executed: end of block | 0 | ||||||||||||||||||||||||||||||||||||
| 2706 | painter->restore(); | - | ||||||||||||||||||||||||||||||||||||
| 2707 | break;; never executed: break; | 0 | ||||||||||||||||||||||||||||||||||||
| 2708 | case CC_ComboBox: never executed: case CC_ComboBox: | 0 | ||||||||||||||||||||||||||||||||||||
| 2709 | painter->save(); | - | ||||||||||||||||||||||||||||||||||||
| 2710 | if (const QStyleOptionComboBox *comboBox = qstyleoption_cast<const QStyleOptionComboBox *>(option)) {
| 0 | ||||||||||||||||||||||||||||||||||||
| 2711 | bool hasFocus = option->state & State_HasFocus && option->state & State_KeyboardFocusChange;
| 0 | ||||||||||||||||||||||||||||||||||||
| 2712 | bool sunken = comboBox->state & State_On; // play dead, if combobox has no items | - | ||||||||||||||||||||||||||||||||||||
| 2713 | bool isEnabled = (comboBox->state & State_Enabled); | - | ||||||||||||||||||||||||||||||||||||
| 2714 | QPixmap cache; | - | ||||||||||||||||||||||||||||||||||||
| 2715 | QString pixmapName = QStyleHelper::uniqueName(QLatin1String("combobox"), option, comboBox->rect.size()); | - | ||||||||||||||||||||||||||||||||||||
| 2716 | if (sunken)
| 0 | ||||||||||||||||||||||||||||||||||||
| 2717 | pixmapName += QLatin1String("-sunken"); never executed: pixmapName += QLatin1String("-sunken"); | 0 | ||||||||||||||||||||||||||||||||||||
| 2718 | if (comboBox->editable)
| 0 | ||||||||||||||||||||||||||||||||||||
| 2719 | pixmapName += QLatin1String("-editable"); never executed: pixmapName += QLatin1String("-editable"); | 0 | ||||||||||||||||||||||||||||||||||||
| 2720 | if (isEnabled)
| 0 | ||||||||||||||||||||||||||||||||||||
| 2721 | pixmapName += QLatin1String("-enabled"); never executed: pixmapName += QLatin1String("-enabled"); | 0 | ||||||||||||||||||||||||||||||||||||
| 2722 | - | |||||||||||||||||||||||||||||||||||||
| 2723 | if (!QPixmapCache::find(pixmapName, cache)) {
| 0 | ||||||||||||||||||||||||||||||||||||
| 2724 | cache = styleCachePixmap(comboBox->rect.size()); | - | ||||||||||||||||||||||||||||||||||||
| 2725 | cache.fill(Qt::transparent); | - | ||||||||||||||||||||||||||||||||||||
| 2726 | QPainter cachePainter(&cache); | - | ||||||||||||||||||||||||||||||||||||
| 2727 | QRect pixmapRect(0, 0, comboBox->rect.width(), comboBox->rect.height()); | - | ||||||||||||||||||||||||||||||||||||
| 2728 | QStyleOptionComboBox comboBoxCopy = *comboBox; | - | ||||||||||||||||||||||||||||||||||||
| 2729 | comboBoxCopy.rect = pixmapRect; | - | ||||||||||||||||||||||||||||||||||||
| 2730 | - | |||||||||||||||||||||||||||||||||||||
| 2731 | QRect rect = pixmapRect; | - | ||||||||||||||||||||||||||||||||||||
| 2732 | QRect downArrowRect = proxy()->subControlRect(CC_ComboBox, &comboBoxCopy, | - | ||||||||||||||||||||||||||||||||||||
| 2733 | SC_ComboBoxArrow, widget); | - | ||||||||||||||||||||||||||||||||||||
| 2734 | // Draw a line edit | - | ||||||||||||||||||||||||||||||||||||
| 2735 | if (comboBox->editable) {
| 0 | ||||||||||||||||||||||||||||||||||||
| 2736 | QStyleOptionFrame buttonOption; | - | ||||||||||||||||||||||||||||||||||||
| 2737 | buttonOption.QStyleOption::operator=(*comboBox); | - | ||||||||||||||||||||||||||||||||||||
| 2738 | buttonOption.rect = rect; | - | ||||||||||||||||||||||||||||||||||||
| 2739 | buttonOption.state = (comboBox->state & (State_Enabled | State_MouseOver | State_HasFocus)) | - | ||||||||||||||||||||||||||||||||||||
| 2740 | | State_KeyboardFocusChange; // Always show hig | - | ||||||||||||||||||||||||||||||||||||
| 2741 | - | |||||||||||||||||||||||||||||||||||||
| 2742 | if (sunken) {
| 0 | ||||||||||||||||||||||||||||||||||||
| 2743 | buttonOption.state |= State_Sunken; | - | ||||||||||||||||||||||||||||||||||||
| 2744 | buttonOption.state &= ~State_MouseOver; | - | ||||||||||||||||||||||||||||||||||||
| 2745 | } never executed: end of block | 0 | ||||||||||||||||||||||||||||||||||||
| 2746 | - | |||||||||||||||||||||||||||||||||||||
| 2747 | proxy()->drawPrimitive(PE_FrameLineEdit, &buttonOption, &cachePainter, widget); | - | ||||||||||||||||||||||||||||||||||||
| 2748 | - | |||||||||||||||||||||||||||||||||||||
| 2749 | // Draw button clipped | - | ||||||||||||||||||||||||||||||||||||
| 2750 | cachePainter.save(); | - | ||||||||||||||||||||||||||||||||||||
| 2751 | cachePainter.setClipRect(downArrowRect.adjusted(0, 0, 1, 0)); | - | ||||||||||||||||||||||||||||||||||||
| 2752 | buttonOption.rect.setLeft(comboBox->direction == Qt::LeftToRight ? | - | ||||||||||||||||||||||||||||||||||||
| 2753 | downArrowRect.left() - 6: downArrowRect.right() + 6); | - | ||||||||||||||||||||||||||||||||||||
| 2754 | proxy()->drawPrimitive(PE_PanelButtonCommand, &buttonOption, &cachePainter, widget); | - | ||||||||||||||||||||||||||||||||||||
| 2755 | cachePainter.restore(); | - | ||||||||||||||||||||||||||||||||||||
| 2756 | cachePainter.setPen( QPen(hasFocus ? option->palette.highlight() : outline.lighter(110), 1)); | - | ||||||||||||||||||||||||||||||||||||
| 2757 | - | |||||||||||||||||||||||||||||||||||||
| 2758 | if (!sunken) {
| 0 | ||||||||||||||||||||||||||||||||||||
| 2759 | int borderSize = 1; | - | ||||||||||||||||||||||||||||||||||||
| 2760 | if (comboBox->direction == Qt::RightToLeft) {
| 0 | ||||||||||||||||||||||||||||||||||||
| 2761 | cachePainter.drawLine(QPoint(downArrowRect.right() - 1, downArrowRect.top() + borderSize ), | - | ||||||||||||||||||||||||||||||||||||
| 2762 | QPoint(downArrowRect.right() - 1, downArrowRect.bottom() - borderSize)); | - | ||||||||||||||||||||||||||||||||||||
| 2763 | } else { never executed: end of block | 0 | ||||||||||||||||||||||||||||||||||||
| 2764 | cachePainter.drawLine(QPoint(downArrowRect.left() , downArrowRect.top() + borderSize), | - | ||||||||||||||||||||||||||||||||||||
| 2765 | QPoint(downArrowRect.left() , downArrowRect.bottom() - borderSize)); | - | ||||||||||||||||||||||||||||||||||||
| 2766 | } never executed: end of block | 0 | ||||||||||||||||||||||||||||||||||||
| 2767 | } else { | - | ||||||||||||||||||||||||||||||||||||
| 2768 | if (comboBox->direction == Qt::RightToLeft) {
| 0 | ||||||||||||||||||||||||||||||||||||
| 2769 | cachePainter.drawLine(QPoint(downArrowRect.right(), downArrowRect.top() + 2), | - | ||||||||||||||||||||||||||||||||||||
| 2770 | QPoint(downArrowRect.right(), downArrowRect.bottom() - 2)); | - | ||||||||||||||||||||||||||||||||||||
| 2771 | - | |||||||||||||||||||||||||||||||||||||
| 2772 | } else { never executed: end of block | 0 | ||||||||||||||||||||||||||||||||||||
| 2773 | cachePainter.drawLine(QPoint(downArrowRect.left(), downArrowRect.top() + 2), | - | ||||||||||||||||||||||||||||||||||||
| 2774 | QPoint(downArrowRect.left(), downArrowRect.bottom() - 2)); | - | ||||||||||||||||||||||||||||||||||||
| 2775 | } never executed: end of block | 0 | ||||||||||||||||||||||||||||||||||||
| 2776 | } | - | ||||||||||||||||||||||||||||||||||||
| 2777 | } else { | - | ||||||||||||||||||||||||||||||||||||
| 2778 | QStyleOptionButton buttonOption; | - | ||||||||||||||||||||||||||||||||||||
| 2779 | buttonOption.QStyleOption::operator=(*comboBox); | - | ||||||||||||||||||||||||||||||||||||
| 2780 | buttonOption.rect = rect; | - | ||||||||||||||||||||||||||||||||||||
| 2781 | buttonOption.state = comboBox->state & (State_Enabled | State_MouseOver | State_HasFocus | State_KeyboardFocusChange); | - | ||||||||||||||||||||||||||||||||||||
| 2782 | if (sunken) {
| 0 | ||||||||||||||||||||||||||||||||||||
| 2783 | buttonOption.state |= State_Sunken; | - | ||||||||||||||||||||||||||||||||||||
| 2784 | buttonOption.state &= ~State_MouseOver; | - | ||||||||||||||||||||||||||||||||||||
| 2785 | } never executed: end of block | 0 | ||||||||||||||||||||||||||||||||||||
| 2786 | proxy()->drawPrimitive(PE_PanelButtonCommand, &buttonOption, &cachePainter, widget); | - | ||||||||||||||||||||||||||||||||||||
| 2787 | } never executed: end of block | 0 | ||||||||||||||||||||||||||||||||||||
| 2788 | if (comboBox->subControls & SC_ComboBoxArrow) {
| 0 | ||||||||||||||||||||||||||||||||||||
| 2789 | // Draw the up/down arrow | - | ||||||||||||||||||||||||||||||||||||
| 2790 | QColor arrowColor = option->palette.buttonText().color(); | - | ||||||||||||||||||||||||||||||||||||
| 2791 | arrowColor.setAlpha(220); | - | ||||||||||||||||||||||||||||||||||||
| 2792 | QPixmap downArrow = colorizedImage(QLatin1String(":/qt-project.org/styles/commonstyle/images/fusion_arrow.png"), arrowColor, 180); | - | ||||||||||||||||||||||||||||||||||||
| 2793 | cachePainter.drawPixmap(QRectF(downArrowRect.center().x() - downArrow.width() / 4.0 + 1.0, | - | ||||||||||||||||||||||||||||||||||||
| 2794 | downArrowRect.center().y() - downArrow.height() / 4.0 + 1.0, | - | ||||||||||||||||||||||||||||||||||||
| 2795 | downArrow.width() / 2.0, downArrow.height() / 2.0), | - | ||||||||||||||||||||||||||||||||||||
| 2796 | downArrow, QRectF(QPointF(0.0, 0.0), downArrow.size())); | - | ||||||||||||||||||||||||||||||||||||
| 2797 | } never executed: end of block | 0 | ||||||||||||||||||||||||||||||||||||
| 2798 | cachePainter.end(); | - | ||||||||||||||||||||||||||||||||||||
| 2799 | QPixmapCache::insert(pixmapName, cache); | - | ||||||||||||||||||||||||||||||||||||
| 2800 | } never executed: end of block | 0 | ||||||||||||||||||||||||||||||||||||
| 2801 | painter->drawPixmap(comboBox->rect.topLeft(), cache); | - | ||||||||||||||||||||||||||||||||||||
| 2802 | } never executed: end of block | 0 | ||||||||||||||||||||||||||||||||||||
| 2803 | painter->restore(); | - | ||||||||||||||||||||||||||||||||||||
| 2804 | break; never executed: break; | 0 | ||||||||||||||||||||||||||||||||||||
| 2805 | case CC_Slider: never executed: case CC_Slider: | 0 | ||||||||||||||||||||||||||||||||||||
| 2806 | if (const QStyleOptionSlider *slider = qstyleoption_cast<const QStyleOptionSlider *>(option)) {
| 0 | ||||||||||||||||||||||||||||||||||||
| 2807 | QRect groove = proxy()->subControlRect(CC_Slider, option, SC_SliderGroove, widget); | - | ||||||||||||||||||||||||||||||||||||
| 2808 | QRect handle = proxy()->subControlRect(CC_Slider, option, SC_SliderHandle, widget); | - | ||||||||||||||||||||||||||||||||||||
| 2809 | - | |||||||||||||||||||||||||||||||||||||
| 2810 | bool horizontal = slider->orientation == Qt::Horizontal; | - | ||||||||||||||||||||||||||||||||||||
| 2811 | bool ticksAbove = slider->tickPosition & QSlider::TicksAbove; | - | ||||||||||||||||||||||||||||||||||||
| 2812 | bool ticksBelow = slider->tickPosition & QSlider::TicksBelow; | - | ||||||||||||||||||||||||||||||||||||
| 2813 | QColor activeHighlight = d->highlight(option->palette); | - | ||||||||||||||||||||||||||||||||||||
| 2814 | QPixmap cache; | - | ||||||||||||||||||||||||||||||||||||
| 2815 | QBrush oldBrush = painter->brush(); | - | ||||||||||||||||||||||||||||||||||||
| 2816 | QPen oldPen = painter->pen(); | - | ||||||||||||||||||||||||||||||||||||
| 2817 | QColor shadowAlpha(Qt::black); | - | ||||||||||||||||||||||||||||||||||||
| 2818 | shadowAlpha.setAlpha(10); | - | ||||||||||||||||||||||||||||||||||||
| 2819 | if (option->state & State_HasFocus && option->state & State_KeyboardFocusChange)
| 0 | ||||||||||||||||||||||||||||||||||||
| 2820 | outline = d->highlightedOutline(option->palette); never executed: outline = d->highlightedOutline(option->palette); | 0 | ||||||||||||||||||||||||||||||||||||
| 2821 | - | |||||||||||||||||||||||||||||||||||||
| 2822 | - | |||||||||||||||||||||||||||||||||||||
| 2823 | if ((option->subControls & SC_SliderGroove) && groove.isValid()) {
| 0 | ||||||||||||||||||||||||||||||||||||
| 2824 | QColor grooveColor; | - | ||||||||||||||||||||||||||||||||||||
| 2825 | grooveColor.setHsv(buttonColor.hue(), | - | ||||||||||||||||||||||||||||||||||||
| 2826 | qMin(255, (int)(buttonColor.saturation())), | - | ||||||||||||||||||||||||||||||||||||
| 2827 | qMin(255, (int)(buttonColor.value()*0.9))); | - | ||||||||||||||||||||||||||||||||||||
| 2828 | QString groovePixmapName = QStyleHelper::uniqueName(QLatin1String("slider_groove"), option, groove.size()); | - | ||||||||||||||||||||||||||||||||||||
| 2829 | QRect pixmapRect(0, 0, groove.width(), groove.height()); | - | ||||||||||||||||||||||||||||||||||||
| 2830 | - | |||||||||||||||||||||||||||||||||||||
| 2831 | // draw background groove | - | ||||||||||||||||||||||||||||||||||||
| 2832 | if (!QPixmapCache::find(groovePixmapName, cache)) {
| 0 | ||||||||||||||||||||||||||||||||||||
| 2833 | cache = styleCachePixmap(pixmapRect.size()); | - | ||||||||||||||||||||||||||||||||||||
| 2834 | cache.fill(Qt::transparent); | - | ||||||||||||||||||||||||||||||||||||
| 2835 | QPainter groovePainter(&cache); | - | ||||||||||||||||||||||||||||||||||||
| 2836 | groovePainter.setRenderHint(QPainter::Antialiasing, true); | - | ||||||||||||||||||||||||||||||||||||
| 2837 | groovePainter.translate(0.5, 0.5); | - | ||||||||||||||||||||||||||||||||||||
| 2838 | QLinearGradient gradient; | - | ||||||||||||||||||||||||||||||||||||
| 2839 | if (horizontal) {
| 0 | ||||||||||||||||||||||||||||||||||||
| 2840 | gradient.setStart(pixmapRect.center().x(), pixmapRect.top()); | - | ||||||||||||||||||||||||||||||||||||
| 2841 | gradient.setFinalStop(pixmapRect.center().x(), pixmapRect.bottom()); | - | ||||||||||||||||||||||||||||||||||||
| 2842 | } never executed: end of block | 0 | ||||||||||||||||||||||||||||||||||||
| 2843 | else { | - | ||||||||||||||||||||||||||||||||||||
| 2844 | gradient.setStart(pixmapRect.left(), pixmapRect.center().y()); | - | ||||||||||||||||||||||||||||||||||||
| 2845 | gradient.setFinalStop(pixmapRect.right(), pixmapRect.center().y()); | - | ||||||||||||||||||||||||||||||||||||
| 2846 | } never executed: end of block | 0 | ||||||||||||||||||||||||||||||||||||
| 2847 | groovePainter.setPen(QPen(outline)); | - | ||||||||||||||||||||||||||||||||||||
| 2848 | gradient.setColorAt(0, grooveColor.darker(110)); | - | ||||||||||||||||||||||||||||||||||||
| 2849 | gradient.setColorAt(1, grooveColor.lighter(110));//palette.button().color().darker(115)); | - | ||||||||||||||||||||||||||||||||||||
| 2850 | groovePainter.setBrush(gradient); | - | ||||||||||||||||||||||||||||||||||||
| 2851 | groovePainter.drawRoundedRect(pixmapRect.adjusted(1, 1, -2, -2), 1, 1); | - | ||||||||||||||||||||||||||||||||||||
| 2852 | groovePainter.end(); | - | ||||||||||||||||||||||||||||||||||||
| 2853 | QPixmapCache::insert(groovePixmapName, cache); | - | ||||||||||||||||||||||||||||||||||||
| 2854 | } never executed: end of block | 0 | ||||||||||||||||||||||||||||||||||||
| 2855 | painter->drawPixmap(groove.topLeft(), cache); | - | ||||||||||||||||||||||||||||||||||||
| 2856 | - | |||||||||||||||||||||||||||||||||||||
| 2857 | // draw blue groove highlight | - | ||||||||||||||||||||||||||||||||||||
| 2858 | QRect clipRect; | - | ||||||||||||||||||||||||||||||||||||
| 2859 | groovePixmapName += QLatin1String("_blue"); | - | ||||||||||||||||||||||||||||||||||||
| 2860 | if (!QPixmapCache::find(groovePixmapName, cache)) {
| 0 | ||||||||||||||||||||||||||||||||||||
| 2861 | cache = styleCachePixmap(pixmapRect.size()); | - | ||||||||||||||||||||||||||||||||||||
| 2862 | cache.fill(Qt::transparent); | - | ||||||||||||||||||||||||||||||||||||
| 2863 | QPainter groovePainter(&cache); | - | ||||||||||||||||||||||||||||||||||||
| 2864 | QLinearGradient gradient; | - | ||||||||||||||||||||||||||||||||||||
| 2865 | if (horizontal) {
| 0 | ||||||||||||||||||||||||||||||||||||
| 2866 | gradient.setStart(pixmapRect.center().x(), pixmapRect.top()); | - | ||||||||||||||||||||||||||||||||||||
| 2867 | gradient.setFinalStop(pixmapRect.center().x(), pixmapRect.bottom()); | - | ||||||||||||||||||||||||||||||||||||
| 2868 | } never executed: end of block | 0 | ||||||||||||||||||||||||||||||||||||
| 2869 | else { | - | ||||||||||||||||||||||||||||||||||||
| 2870 | gradient.setStart(pixmapRect.left(), pixmapRect.center().y()); | - | ||||||||||||||||||||||||||||||||||||
| 2871 | gradient.setFinalStop(pixmapRect.right(), pixmapRect.center().y()); | - | ||||||||||||||||||||||||||||||||||||
| 2872 | } never executed: end of block | 0 | ||||||||||||||||||||||||||||||||||||
| 2873 | QColor highlight = d->highlight(option->palette); | - | ||||||||||||||||||||||||||||||||||||
| 2874 | QColor highlightedoutline = highlight.darker(140); | - | ||||||||||||||||||||||||||||||||||||
| 2875 | if (qGray(outline.rgb()) > qGray(highlightedoutline.rgb()))
| 0 | ||||||||||||||||||||||||||||||||||||
| 2876 | outline = highlightedoutline; never executed: outline = highlightedoutline; | 0 | ||||||||||||||||||||||||||||||||||||
| 2877 | - | |||||||||||||||||||||||||||||||||||||
| 2878 | - | |||||||||||||||||||||||||||||||||||||
| 2879 | groovePainter.setRenderHint(QPainter::Antialiasing, true); | - | ||||||||||||||||||||||||||||||||||||
| 2880 | groovePainter.translate(0.5, 0.5); | - | ||||||||||||||||||||||||||||||||||||
| 2881 | groovePainter.setPen(QPen(outline)); | - | ||||||||||||||||||||||||||||||||||||
| 2882 | gradient.setColorAt(0, activeHighlight); | - | ||||||||||||||||||||||||||||||||||||
| 2883 | gradient.setColorAt(1, activeHighlight.lighter(130)); | - | ||||||||||||||||||||||||||||||||||||
| 2884 | groovePainter.setBrush(gradient); | - | ||||||||||||||||||||||||||||||||||||
| 2885 | groovePainter.drawRoundedRect(pixmapRect.adjusted(1, 1, -2, -2), 1, 1); | - | ||||||||||||||||||||||||||||||||||||
| 2886 | groovePainter.setPen(d->innerContrastLine()); | - | ||||||||||||||||||||||||||||||||||||
| 2887 | groovePainter.setBrush(Qt::NoBrush); | - | ||||||||||||||||||||||||||||||||||||
| 2888 | groovePainter.drawRoundedRect(pixmapRect.adjusted(2, 2, -3, -3), 1, 1); | - | ||||||||||||||||||||||||||||||||||||
| 2889 | groovePainter.end(); | - | ||||||||||||||||||||||||||||||||||||
| 2890 | QPixmapCache::insert(groovePixmapName, cache); | - | ||||||||||||||||||||||||||||||||||||
| 2891 | } never executed: end of block | 0 | ||||||||||||||||||||||||||||||||||||
| 2892 | if (horizontal) {
| 0 | ||||||||||||||||||||||||||||||||||||
| 2893 | if (slider->upsideDown)
| 0 | ||||||||||||||||||||||||||||||||||||
| 2894 | clipRect = QRect(handle.right(), groove.top(), groove.right() - handle.right(), groove.height()); never executed: clipRect = QRect(handle.right(), groove.top(), groove.right() - handle.right(), groove.height()); | 0 | ||||||||||||||||||||||||||||||||||||
| 2895 | else | - | ||||||||||||||||||||||||||||||||||||
| 2896 | clipRect = QRect(groove.left(), groove.top(), handle.left(), groove.height()); never executed: clipRect = QRect(groove.left(), groove.top(), handle.left(), groove.height()); | 0 | ||||||||||||||||||||||||||||||||||||
| 2897 | } else { | - | ||||||||||||||||||||||||||||||||||||
| 2898 | if (slider->upsideDown)
| 0 | ||||||||||||||||||||||||||||||||||||
| 2899 | clipRect = QRect(groove.left(), handle.bottom(), groove.width(), groove.height() - handle.bottom()); never executed: clipRect = QRect(groove.left(), handle.bottom(), groove.width(), groove.height() - handle.bottom()); | 0 | ||||||||||||||||||||||||||||||||||||
| 2900 | else | - | ||||||||||||||||||||||||||||||||||||
| 2901 | clipRect = QRect(groove.left(), groove.top(), groove.width(), handle.top() - groove.top()); never executed: clipRect = QRect(groove.left(), groove.top(), groove.width(), handle.top() - groove.top()); | 0 | ||||||||||||||||||||||||||||||||||||
| 2902 | } | - | ||||||||||||||||||||||||||||||||||||
| 2903 | painter->save(); | - | ||||||||||||||||||||||||||||||||||||
| 2904 | painter->setClipRect(clipRect.adjusted(0, 0, 1, 1), Qt::IntersectClip); | - | ||||||||||||||||||||||||||||||||||||
| 2905 | painter->drawPixmap(groove.topLeft(), cache); | - | ||||||||||||||||||||||||||||||||||||
| 2906 | painter->restore(); | - | ||||||||||||||||||||||||||||||||||||
| 2907 | } never executed: end of block | 0 | ||||||||||||||||||||||||||||||||||||
| 2908 | - | |||||||||||||||||||||||||||||||||||||
| 2909 | if (option->subControls & SC_SliderTickmarks) {
| 0 | ||||||||||||||||||||||||||||||||||||
| 2910 | painter->setPen(outline); | - | ||||||||||||||||||||||||||||||||||||
| 2911 | int tickSize = proxy()->pixelMetric(PM_SliderTickmarkOffset, option, widget); | - | ||||||||||||||||||||||||||||||||||||
| 2912 | int available = proxy()->pixelMetric(PM_SliderSpaceAvailable, slider, widget); | - | ||||||||||||||||||||||||||||||||||||
| 2913 | int interval = slider->tickInterval; | - | ||||||||||||||||||||||||||||||||||||
| 2914 | if (interval <= 0) {
| 0 | ||||||||||||||||||||||||||||||||||||
| 2915 | interval = slider->singleStep; | - | ||||||||||||||||||||||||||||||||||||
| 2916 | if (QStyle::sliderPositionFromValue(slider->minimum, slider->maximum, interval,
| 0 | ||||||||||||||||||||||||||||||||||||
| 2917 | available)
| 0 | ||||||||||||||||||||||||||||||||||||
| 2918 | - QStyle::sliderPositionFromValue(slider->minimum, slider->maximum,
| 0 | ||||||||||||||||||||||||||||||||||||
| 2919 | 0, available) < 3)
| 0 | ||||||||||||||||||||||||||||||||||||
| 2920 | interval = slider->pageStep; never executed: interval = slider->pageStep; | 0 | ||||||||||||||||||||||||||||||||||||
| 2921 | } never executed: end of block | 0 | ||||||||||||||||||||||||||||||||||||
| 2922 | if (interval <= 0)
| 0 | ||||||||||||||||||||||||||||||||||||
| 2923 | interval = 1; never executed: interval = 1; | 0 | ||||||||||||||||||||||||||||||||||||
| 2924 | - | |||||||||||||||||||||||||||||||||||||
| 2925 | int v = slider->minimum; | - | ||||||||||||||||||||||||||||||||||||
| 2926 | int len = proxy()->pixelMetric(PM_SliderLength, slider, widget); | - | ||||||||||||||||||||||||||||||||||||
| 2927 | while (v <= slider->maximum + 1) {
| 0 | ||||||||||||||||||||||||||||||||||||
| 2928 | if (v == slider->maximum + 1 && interval == 1)
| 0 | ||||||||||||||||||||||||||||||||||||
| 2929 | break; never executed: break; | 0 | ||||||||||||||||||||||||||||||||||||
| 2930 | const int v_ = qMin(v, slider->maximum); | - | ||||||||||||||||||||||||||||||||||||
| 2931 | int pos = sliderPositionFromValue(slider->minimum, slider->maximum, | - | ||||||||||||||||||||||||||||||||||||
| 2932 | v_, (horizontal | - | ||||||||||||||||||||||||||||||||||||
| 2933 | ? slider->rect.width() | - | ||||||||||||||||||||||||||||||||||||
| 2934 | : slider->rect.height()) - len, | - | ||||||||||||||||||||||||||||||||||||
| 2935 | slider->upsideDown) + len / 2; | - | ||||||||||||||||||||||||||||||||||||
| 2936 | int extra = 2 - ((v_ == slider->minimum || v_ == slider->maximum) ? 1 : 0);
| 0 | ||||||||||||||||||||||||||||||||||||
| 2937 | - | |||||||||||||||||||||||||||||||||||||
| 2938 | if (horizontal) {
| 0 | ||||||||||||||||||||||||||||||||||||
| 2939 | if (ticksAbove) {
| 0 | ||||||||||||||||||||||||||||||||||||
| 2940 | painter->drawLine(pos, slider->rect.top() + extra, | - | ||||||||||||||||||||||||||||||||||||
| 2941 | pos, slider->rect.top() + tickSize); | - | ||||||||||||||||||||||||||||||||||||
| 2942 | } never executed: end of block | 0 | ||||||||||||||||||||||||||||||||||||
| 2943 | if (ticksBelow) {
| 0 | ||||||||||||||||||||||||||||||||||||
| 2944 | painter->drawLine(pos, slider->rect.bottom() - extra, | - | ||||||||||||||||||||||||||||||||||||
| 2945 | pos, slider->rect.bottom() - tickSize); | - | ||||||||||||||||||||||||||||||||||||
| 2946 | } never executed: end of block | 0 | ||||||||||||||||||||||||||||||||||||
| 2947 | } else { never executed: end of block | 0 | ||||||||||||||||||||||||||||||||||||
| 2948 | if (ticksAbove) {
| 0 | ||||||||||||||||||||||||||||||||||||
| 2949 | painter->drawLine(slider->rect.left() + extra, pos, | - | ||||||||||||||||||||||||||||||||||||
| 2950 | slider->rect.left() + tickSize, pos); | - | ||||||||||||||||||||||||||||||||||||
| 2951 | } never executed: end of block | 0 | ||||||||||||||||||||||||||||||||||||
| 2952 | if (ticksBelow) {
| 0 | ||||||||||||||||||||||||||||||||||||
| 2953 | painter->drawLine(slider->rect.right() - extra, pos, | - | ||||||||||||||||||||||||||||||||||||
| 2954 | slider->rect.right() - tickSize, pos); | - | ||||||||||||||||||||||||||||||||||||
| 2955 | } never executed: end of block | 0 | ||||||||||||||||||||||||||||||||||||
| 2956 | } never executed: end of block | 0 | ||||||||||||||||||||||||||||||||||||
| 2957 | // in the case where maximum is max int | - | ||||||||||||||||||||||||||||||||||||
| 2958 | int nextInterval = v + interval; | - | ||||||||||||||||||||||||||||||||||||
| 2959 | if (nextInterval < v)
| 0 | ||||||||||||||||||||||||||||||||||||
| 2960 | break; never executed: break; | 0 | ||||||||||||||||||||||||||||||||||||
| 2961 | v = nextInterval; | - | ||||||||||||||||||||||||||||||||||||
| 2962 | } never executed: end of block | 0 | ||||||||||||||||||||||||||||||||||||
| 2963 | } never executed: end of block | 0 | ||||||||||||||||||||||||||||||||||||
| 2964 | // draw handle | - | ||||||||||||||||||||||||||||||||||||
| 2965 | if ((option->subControls & SC_SliderHandle) ) {
| 0 | ||||||||||||||||||||||||||||||||||||
| 2966 | QString handlePixmapName = QStyleHelper::uniqueName(QLatin1String("slider_handle"), option, handle.size()); | - | ||||||||||||||||||||||||||||||||||||
| 2967 | if (!QPixmapCache::find(handlePixmapName, cache)) {
| 0 | ||||||||||||||||||||||||||||||||||||
| 2968 | cache = styleCachePixmap(handle.size()); | - | ||||||||||||||||||||||||||||||||||||
| 2969 | cache.fill(Qt::transparent); | - | ||||||||||||||||||||||||||||||||||||
| 2970 | QRect pixmapRect(0, 0, handle.width(), handle.height()); | - | ||||||||||||||||||||||||||||||||||||
| 2971 | QPainter handlePainter(&cache); | - | ||||||||||||||||||||||||||||||||||||
| 2972 | QRect gradRect = pixmapRect.adjusted(2, 2, -2, -2); | - | ||||||||||||||||||||||||||||||||||||
| 2973 | - | |||||||||||||||||||||||||||||||||||||
| 2974 | // gradient fill | - | ||||||||||||||||||||||||||||||||||||
| 2975 | QRect r = pixmapRect.adjusted(1, 1, -2, -2); | - | ||||||||||||||||||||||||||||||||||||
| 2976 | QLinearGradient gradient = qt_fusion_gradient(gradRect, d->buttonColor(option->palette),horizontal ? TopDown : FromLeft); | - | ||||||||||||||||||||||||||||||||||||
| 2977 | - | |||||||||||||||||||||||||||||||||||||
| 2978 | handlePainter.setRenderHint(QPainter::Antialiasing, true); | - | ||||||||||||||||||||||||||||||||||||
| 2979 | handlePainter.translate(0.5, 0.5); | - | ||||||||||||||||||||||||||||||||||||
| 2980 | - | |||||||||||||||||||||||||||||||||||||
| 2981 | handlePainter.setPen(Qt::NoPen); | - | ||||||||||||||||||||||||||||||||||||
| 2982 | handlePainter.setBrush(QColor(0, 0, 0, 40)); | - | ||||||||||||||||||||||||||||||||||||
| 2983 | handlePainter.drawRect(r.adjusted(-1, 2, 1, -2)); | - | ||||||||||||||||||||||||||||||||||||
| 2984 | - | |||||||||||||||||||||||||||||||||||||
| 2985 | handlePainter.setPen(QPen(d->outline(option->palette))); | - | ||||||||||||||||||||||||||||||||||||
| 2986 | if (option->state & State_HasFocus && option->state & State_KeyboardFocusChange)
| 0 | ||||||||||||||||||||||||||||||||||||
| 2987 | handlePainter.setPen(QPen(d->highlightedOutline(option->palette))); never executed: handlePainter.setPen(QPen(d->highlightedOutline(option->palette))); | 0 | ||||||||||||||||||||||||||||||||||||
| 2988 | - | |||||||||||||||||||||||||||||||||||||
| 2989 | handlePainter.setBrush(gradient); | - | ||||||||||||||||||||||||||||||||||||
| 2990 | handlePainter.drawRoundedRect(r, 2, 2); | - | ||||||||||||||||||||||||||||||||||||
| 2991 | handlePainter.setBrush(Qt::NoBrush); | - | ||||||||||||||||||||||||||||||||||||
| 2992 | handlePainter.setPen(d->innerContrastLine()); | - | ||||||||||||||||||||||||||||||||||||
| 2993 | handlePainter.drawRoundedRect(r.adjusted(1, 1, -1, -1), 2, 2); | - | ||||||||||||||||||||||||||||||||||||
| 2994 | - | |||||||||||||||||||||||||||||||||||||
| 2995 | QColor cornerAlpha = outline.darker(120); | - | ||||||||||||||||||||||||||||||||||||
| 2996 | cornerAlpha.setAlpha(80); | - | ||||||||||||||||||||||||||||||||||||
| 2997 | - | |||||||||||||||||||||||||||||||||||||
| 2998 | //handle shadow | - | ||||||||||||||||||||||||||||||||||||
| 2999 | handlePainter.setPen(shadowAlpha); | - | ||||||||||||||||||||||||||||||||||||
| 3000 | handlePainter.drawLine(QPoint(r.left() + 2, r.bottom() + 1), QPoint(r.right() - 2, r.bottom() + 1)); | - | ||||||||||||||||||||||||||||||||||||
| 3001 | handlePainter.drawLine(QPoint(r.right() + 1, r.bottom() - 3), QPoint(r.right() + 1, r.top() + 4)); | - | ||||||||||||||||||||||||||||||||||||
| 3002 | handlePainter.drawLine(QPoint(r.right() - 1, r.bottom()), QPoint(r.right() + 1, r.bottom() - 2)); | - | ||||||||||||||||||||||||||||||||||||
| 3003 | - | |||||||||||||||||||||||||||||||||||||
| 3004 | handlePainter.end(); | - | ||||||||||||||||||||||||||||||||||||
| 3005 | QPixmapCache::insert(handlePixmapName, cache); | - | ||||||||||||||||||||||||||||||||||||
| 3006 | } never executed: end of block | 0 | ||||||||||||||||||||||||||||||||||||
| 3007 | - | |||||||||||||||||||||||||||||||||||||
| 3008 | painter->drawPixmap(handle.topLeft(), cache); | - | ||||||||||||||||||||||||||||||||||||
| 3009 | - | |||||||||||||||||||||||||||||||||||||
| 3010 | } never executed: end of block | 0 | ||||||||||||||||||||||||||||||||||||
| 3011 | painter->setBrush(oldBrush); | - | ||||||||||||||||||||||||||||||||||||
| 3012 | painter->setPen(oldPen); | - | ||||||||||||||||||||||||||||||||||||
| 3013 | } never executed: end of block | 0 | ||||||||||||||||||||||||||||||||||||
| 3014 | break; never executed: break; | 0 | ||||||||||||||||||||||||||||||||||||
| 3015 | case CC_Dial: never executed: case CC_Dial: | 0 | ||||||||||||||||||||||||||||||||||||
| 3016 | if (const QStyleOptionSlider *dial = qstyleoption_cast<const QStyleOptionSlider *>(option))
| 0 | ||||||||||||||||||||||||||||||||||||
| 3017 | QStyleHelper::drawDial(dial, painter); never executed: QStyleHelper::drawDial(dial, painter); | 0 | ||||||||||||||||||||||||||||||||||||
| 3018 | break; never executed: break; | 0 | ||||||||||||||||||||||||||||||||||||
| 3019 | default: never executed: default: | 0 | ||||||||||||||||||||||||||||||||||||
| 3020 | QCommonStyle::drawComplexControl(control, option, painter, widget); | - | ||||||||||||||||||||||||||||||||||||
| 3021 | break; never executed: break; | 0 | ||||||||||||||||||||||||||||||||||||
| 3022 | } | - | ||||||||||||||||||||||||||||||||||||
| 3023 | } | - | ||||||||||||||||||||||||||||||||||||
| 3024 | - | |||||||||||||||||||||||||||||||||||||
| 3025 | /*! | - | ||||||||||||||||||||||||||||||||||||
| 3026 | \reimp | - | ||||||||||||||||||||||||||||||||||||
| 3027 | */ | - | ||||||||||||||||||||||||||||||||||||
| 3028 | int QFusionStyle::pixelMetric(PixelMetric metric, const QStyleOption *option, const QWidget *widget) const | - | ||||||||||||||||||||||||||||||||||||
| 3029 | { | - | ||||||||||||||||||||||||||||||||||||
| 3030 | int val = -1; | - | ||||||||||||||||||||||||||||||||||||
| 3031 | switch (metric) { | - | ||||||||||||||||||||||||||||||||||||
| 3032 | case PM_SliderTickmarkOffset: never executed: case PM_SliderTickmarkOffset: | 0 | ||||||||||||||||||||||||||||||||||||
| 3033 | val = 4; | - | ||||||||||||||||||||||||||||||||||||
| 3034 | break; never executed: break; | 0 | ||||||||||||||||||||||||||||||||||||
| 3035 | case PM_HeaderMargin: never executed: case PM_HeaderMargin: | 0 | ||||||||||||||||||||||||||||||||||||
| 3036 | case PM_ToolTipLabelFrameWidth: never executed: case PM_ToolTipLabelFrameWidth: | 0 | ||||||||||||||||||||||||||||||||||||
| 3037 | val = 2; | - | ||||||||||||||||||||||||||||||||||||
| 3038 | break; never executed: break; | 0 | ||||||||||||||||||||||||||||||||||||
| 3039 | case PM_ButtonDefaultIndicator: never executed: case PM_ButtonDefaultIndicator: | 0 | ||||||||||||||||||||||||||||||||||||
| 3040 | case PM_ButtonShiftHorizontal: never executed: case PM_ButtonShiftHorizontal: | 0 | ||||||||||||||||||||||||||||||||||||
| 3041 | case PM_ButtonShiftVertical: never executed: case PM_ButtonShiftVertical: | 0 | ||||||||||||||||||||||||||||||||||||
| 3042 | val = 0; | - | ||||||||||||||||||||||||||||||||||||
| 3043 | break; never executed: break; | 0 | ||||||||||||||||||||||||||||||||||||
| 3044 | case PM_MessageBoxIconSize: never executed: case PM_MessageBoxIconSize: | 0 | ||||||||||||||||||||||||||||||||||||
| 3045 | val = 48; | - | ||||||||||||||||||||||||||||||||||||
| 3046 | break; never executed: break; | 0 | ||||||||||||||||||||||||||||||||||||
| 3047 | case PM_ListViewIconSize: never executed: case PM_ListViewIconSize: | 0 | ||||||||||||||||||||||||||||||||||||
| 3048 | val = 24; | - | ||||||||||||||||||||||||||||||||||||
| 3049 | break; never executed: break; | 0 | ||||||||||||||||||||||||||||||||||||
| 3050 | case PM_DialogButtonsSeparator: never executed: case PM_DialogButtonsSeparator: | 0 | ||||||||||||||||||||||||||||||||||||
| 3051 | case PM_ScrollBarSliderMin: never executed: case PM_ScrollBarSliderMin: | 0 | ||||||||||||||||||||||||||||||||||||
| 3052 | val = 26; | - | ||||||||||||||||||||||||||||||||||||
| 3053 | break; never executed: break; | 0 | ||||||||||||||||||||||||||||||||||||
| 3054 | case PM_TitleBarHeight: never executed: case PM_TitleBarHeight: | 0 | ||||||||||||||||||||||||||||||||||||
| 3055 | val = 24; | - | ||||||||||||||||||||||||||||||||||||
| 3056 | break; never executed: break; | 0 | ||||||||||||||||||||||||||||||||||||
| 3057 | case PM_ScrollBarExtent: never executed: case PM_ScrollBarExtent: | 0 | ||||||||||||||||||||||||||||||||||||
| 3058 | val = 14; | - | ||||||||||||||||||||||||||||||||||||
| 3059 | break; never executed: break; | 0 | ||||||||||||||||||||||||||||||||||||
| 3060 | case PM_SliderThickness: never executed: case PM_SliderThickness: | 0 | ||||||||||||||||||||||||||||||||||||
| 3061 | case PM_SliderLength: never executed: case PM_SliderLength: | 0 | ||||||||||||||||||||||||||||||||||||
| 3062 | val = 15; | - | ||||||||||||||||||||||||||||||||||||
| 3063 | break; never executed: break; | 0 | ||||||||||||||||||||||||||||||||||||
| 3064 | case PM_DockWidgetTitleMargin: never executed: case PM_DockWidgetTitleMargin: | 0 | ||||||||||||||||||||||||||||||||||||
| 3065 | val = 1; | - | ||||||||||||||||||||||||||||||||||||
| 3066 | break; never executed: break; | 0 | ||||||||||||||||||||||||||||||||||||
| 3067 | case PM_SpinBoxFrameWidth: never executed: case PM_SpinBoxFrameWidth: | 0 | ||||||||||||||||||||||||||||||||||||
| 3068 | val = 3; | - | ||||||||||||||||||||||||||||||||||||
| 3069 | break; never executed: break; | 0 | ||||||||||||||||||||||||||||||||||||
| 3070 | case PM_MenuVMargin: never executed: case PM_MenuVMargin: | 0 | ||||||||||||||||||||||||||||||||||||
| 3071 | case PM_MenuHMargin: never executed: case PM_MenuHMargin: | 0 | ||||||||||||||||||||||||||||||||||||
| 3072 | case PM_MenuPanelWidth: never executed: case PM_MenuPanelWidth: | 0 | ||||||||||||||||||||||||||||||||||||
| 3073 | val = 0; | - | ||||||||||||||||||||||||||||||||||||
| 3074 | break; never executed: break; | 0 | ||||||||||||||||||||||||||||||||||||
| 3075 | case PM_MenuBarItemSpacing: never executed: case PM_MenuBarItemSpacing: | 0 | ||||||||||||||||||||||||||||||||||||
| 3076 | val = 6; | - | ||||||||||||||||||||||||||||||||||||
| 3077 | break; never executed: break; | 0 | ||||||||||||||||||||||||||||||||||||
| 3078 | case PM_MenuBarVMargin: never executed: case PM_MenuBarVMargin: | 0 | ||||||||||||||||||||||||||||||||||||
| 3079 | case PM_MenuBarHMargin: never executed: case PM_MenuBarHMargin: | 0 | ||||||||||||||||||||||||||||||||||||
| 3080 | case PM_MenuBarPanelWidth: never executed: case PM_MenuBarPanelWidth: | 0 | ||||||||||||||||||||||||||||||||||||
| 3081 | val = 0; | - | ||||||||||||||||||||||||||||||||||||
| 3082 | break; never executed: break; | 0 | ||||||||||||||||||||||||||||||||||||
| 3083 | case PM_ToolBarHandleExtent: never executed: case PM_ToolBarHandleExtent: | 0 | ||||||||||||||||||||||||||||||||||||
| 3084 | val = 9; | - | ||||||||||||||||||||||||||||||||||||
| 3085 | break; never executed: break; | 0 | ||||||||||||||||||||||||||||||||||||
| 3086 | case PM_ToolBarItemSpacing: never executed: case PM_ToolBarItemSpacing: | 0 | ||||||||||||||||||||||||||||||||||||
| 3087 | val = 1; | - | ||||||||||||||||||||||||||||||||||||
| 3088 | break; never executed: break; | 0 | ||||||||||||||||||||||||||||||||||||
| 3089 | case PM_ToolBarFrameWidth: never executed: case PM_ToolBarFrameWidth: | 0 | ||||||||||||||||||||||||||||||||||||
| 3090 | case PM_ToolBarItemMargin: never executed: case PM_ToolBarItemMargin: | 0 | ||||||||||||||||||||||||||||||||||||
| 3091 | val = 2; | - | ||||||||||||||||||||||||||||||||||||
| 3092 | break; never executed: break; | 0 | ||||||||||||||||||||||||||||||||||||
| 3093 | case PM_SmallIconSize: never executed: case PM_SmallIconSize: | 0 | ||||||||||||||||||||||||||||||||||||
| 3094 | case PM_ButtonIconSize: never executed: case PM_ButtonIconSize: | 0 | ||||||||||||||||||||||||||||||||||||
| 3095 | val = 16; | - | ||||||||||||||||||||||||||||||||||||
| 3096 | break; never executed: break; | 0 | ||||||||||||||||||||||||||||||||||||
| 3097 | case PM_DockWidgetTitleBarButtonMargin: never executed: case PM_DockWidgetTitleBarButtonMargin: | 0 | ||||||||||||||||||||||||||||||||||||
| 3098 | val = 2; | - | ||||||||||||||||||||||||||||||||||||
| 3099 | break; never executed: break; | 0 | ||||||||||||||||||||||||||||||||||||
| 3100 | case PM_MaximumDragDistance: never executed: case PM_MaximumDragDistance: | 0 | ||||||||||||||||||||||||||||||||||||
| 3101 | return -1; // Do not dpi-scale because the value is magic never executed: return -1; | 0 | ||||||||||||||||||||||||||||||||||||
| 3102 | case PM_TabCloseIndicatorWidth: never executed: case PM_TabCloseIndicatorWidth: | 0 | ||||||||||||||||||||||||||||||||||||
| 3103 | case PM_TabCloseIndicatorHeight: never executed: case PM_TabCloseIndicatorHeight: | 0 | ||||||||||||||||||||||||||||||||||||
| 3104 | val = 20; | - | ||||||||||||||||||||||||||||||||||||
| 3105 | break; never executed: break; | 0 | ||||||||||||||||||||||||||||||||||||
| 3106 | case PM_TabBarTabVSpace: never executed: case PM_TabBarTabVSpace: | 0 | ||||||||||||||||||||||||||||||||||||
| 3107 | val = 12; | - | ||||||||||||||||||||||||||||||||||||
| 3108 | break; never executed: break; | 0 | ||||||||||||||||||||||||||||||||||||
| 3109 | case PM_TabBarTabOverlap: never executed: case PM_TabBarTabOverlap: | 0 | ||||||||||||||||||||||||||||||||||||
| 3110 | val = 1; | - | ||||||||||||||||||||||||||||||||||||
| 3111 | break; never executed: break; | 0 | ||||||||||||||||||||||||||||||||||||
| 3112 | case PM_TabBarBaseOverlap: never executed: case PM_TabBarBaseOverlap: | 0 | ||||||||||||||||||||||||||||||||||||
| 3113 | val = 2; | - | ||||||||||||||||||||||||||||||||||||
| 3114 | break; never executed: break; | 0 | ||||||||||||||||||||||||||||||||||||
| 3115 | case PM_SubMenuOverlap: never executed: case PM_SubMenuOverlap: | 0 | ||||||||||||||||||||||||||||||||||||
| 3116 | val = -1; | - | ||||||||||||||||||||||||||||||||||||
| 3117 | break; never executed: break; | 0 | ||||||||||||||||||||||||||||||||||||
| 3118 | case PM_DockWidgetHandleExtent: never executed: case PM_DockWidgetHandleExtent: | 0 | ||||||||||||||||||||||||||||||||||||
| 3119 | case PM_SplitterWidth: never executed: case PM_SplitterWidth: | 0 | ||||||||||||||||||||||||||||||||||||
| 3120 | val = 4; | - | ||||||||||||||||||||||||||||||||||||
| 3121 | break; never executed: break; | 0 | ||||||||||||||||||||||||||||||||||||
| 3122 | case PM_IndicatorHeight: never executed: case PM_IndicatorHeight: | 0 | ||||||||||||||||||||||||||||||||||||
| 3123 | case PM_IndicatorWidth: never executed: case PM_IndicatorWidth: | 0 | ||||||||||||||||||||||||||||||||||||
| 3124 | case PM_ExclusiveIndicatorHeight: never executed: case PM_ExclusiveIndicatorHeight: | 0 | ||||||||||||||||||||||||||||||||||||
| 3125 | case PM_ExclusiveIndicatorWidth: never executed: case PM_ExclusiveIndicatorWidth: | 0 | ||||||||||||||||||||||||||||||||||||
| 3126 | val = 14; | - | ||||||||||||||||||||||||||||||||||||
| 3127 | break; never executed: break; | 0 | ||||||||||||||||||||||||||||||||||||
| 3128 | case PM_ScrollView_ScrollBarSpacing: never executed: case PM_ScrollView_ScrollBarSpacing: | 0 | ||||||||||||||||||||||||||||||||||||
| 3129 | val = 0; | - | ||||||||||||||||||||||||||||||||||||
| 3130 | break; never executed: break; | 0 | ||||||||||||||||||||||||||||||||||||
| 3131 | case PM_ScrollView_ScrollBarOverlap: never executed: case PM_ScrollView_ScrollBarOverlap: | 0 | ||||||||||||||||||||||||||||||||||||
| 3132 | if (proxy()->styleHint(SH_ScrollBar_Transient, option, widget))
| 0 | ||||||||||||||||||||||||||||||||||||
| 3133 | return proxy()->pixelMetric(PM_ScrollBarExtent, option, widget); never executed: return proxy()->pixelMetric(PM_ScrollBarExtent, option, widget); | 0 | ||||||||||||||||||||||||||||||||||||
| 3134 | val = 0; | - | ||||||||||||||||||||||||||||||||||||
| 3135 | break; never executed: break; | 0 | ||||||||||||||||||||||||||||||||||||
| 3136 | case PM_DefaultFrameWidth: never executed: case PM_DefaultFrameWidth: | 0 | ||||||||||||||||||||||||||||||||||||
| 3137 | return 1; // Do not dpi-scale because the drawn frame is always exactly 1 pixel thick never executed: return 1; | 0 | ||||||||||||||||||||||||||||||||||||
| 3138 | default: never executed: default: | 0 | ||||||||||||||||||||||||||||||||||||
| 3139 | return QCommonStyle::pixelMetric(metric, option, widget); never executed: return QCommonStyle::pixelMetric(metric, option, widget); | 0 | ||||||||||||||||||||||||||||||||||||
| 3140 | } | - | ||||||||||||||||||||||||||||||||||||
| 3141 | return QStyleHelper::dpiScaled(val); never executed: return QStyleHelper::dpiScaled(val); | 0 | ||||||||||||||||||||||||||||||||||||
| 3142 | } | - | ||||||||||||||||||||||||||||||||||||
| 3143 | - | |||||||||||||||||||||||||||||||||||||
| 3144 | /*! | - | ||||||||||||||||||||||||||||||||||||
| 3145 | \reimp | - | ||||||||||||||||||||||||||||||||||||
| 3146 | */ | - | ||||||||||||||||||||||||||||||||||||
| 3147 | QSize QFusionStyle::sizeFromContents(ContentsType type, const QStyleOption *option, | - | ||||||||||||||||||||||||||||||||||||
| 3148 | const QSize &size, const QWidget *widget) const | - | ||||||||||||||||||||||||||||||||||||
| 3149 | { | - | ||||||||||||||||||||||||||||||||||||
| 3150 | QSize newSize = QCommonStyle::sizeFromContents(type, option, size, widget); | - | ||||||||||||||||||||||||||||||||||||
| 3151 | switch (type) { | - | ||||||||||||||||||||||||||||||||||||
| 3152 | case CT_PushButton: never executed: case CT_PushButton: | 0 | ||||||||||||||||||||||||||||||||||||
| 3153 | if (const QStyleOptionButton *btn = qstyleoption_cast<const QStyleOptionButton *>(option)) {
| 0 | ||||||||||||||||||||||||||||||||||||
| 3154 | if (!btn->text.isEmpty() && newSize.width() < 80)
| 0 | ||||||||||||||||||||||||||||||||||||
| 3155 | newSize.setWidth(80); never executed: newSize.setWidth(80); | 0 | ||||||||||||||||||||||||||||||||||||
| 3156 | if (!btn->icon.isNull() && btn->iconSize.height() > 16)
| 0 | ||||||||||||||||||||||||||||||||||||
| 3157 | newSize -= QSize(0, 2); never executed: newSize -= QSize(0, 2); | 0 | ||||||||||||||||||||||||||||||||||||
| 3158 | } never executed: end of block | 0 | ||||||||||||||||||||||||||||||||||||
| 3159 | break; never executed: break; | 0 | ||||||||||||||||||||||||||||||||||||
| 3160 | case CT_GroupBox: never executed: case CT_GroupBox: | 0 | ||||||||||||||||||||||||||||||||||||
| 3161 | if (option) {
| 0 | ||||||||||||||||||||||||||||||||||||
| 3162 | int topMargin = qMax(pixelMetric(PM_ExclusiveIndicatorHeight), option->fontMetrics.height()) + groupBoxTopMargin; | - | ||||||||||||||||||||||||||||||||||||
| 3163 | newSize += QSize(10, topMargin); // Add some space below the groupbox | - | ||||||||||||||||||||||||||||||||||||
| 3164 | } never executed: end of block | 0 | ||||||||||||||||||||||||||||||||||||
| 3165 | break; never executed: break; | 0 | ||||||||||||||||||||||||||||||||||||
| 3166 | case CT_RadioButton: never executed: case CT_RadioButton: | 0 | ||||||||||||||||||||||||||||||||||||
| 3167 | case CT_CheckBox: never executed: case CT_CheckBox: | 0 | ||||||||||||||||||||||||||||||||||||
| 3168 | newSize += QSize(0, 1); | - | ||||||||||||||||||||||||||||||||||||
| 3169 | break; never executed: break; | 0 | ||||||||||||||||||||||||||||||||||||
| 3170 | case CT_ToolButton: never executed: case CT_ToolButton: | 0 | ||||||||||||||||||||||||||||||||||||
| 3171 | newSize += QSize(2, 2); | - | ||||||||||||||||||||||||||||||||||||
| 3172 | break; never executed: break; | 0 | ||||||||||||||||||||||||||||||||||||
| 3173 | case CT_SpinBox: never executed: case CT_SpinBox: | 0 | ||||||||||||||||||||||||||||||||||||
| 3174 | newSize += QSize(0, -3); | - | ||||||||||||||||||||||||||||||||||||
| 3175 | break; never executed: break; | 0 | ||||||||||||||||||||||||||||||||||||
| 3176 | case CT_ComboBox: never executed: case CT_ComboBox: | 0 | ||||||||||||||||||||||||||||||||||||
| 3177 | newSize += QSize(2, 4); | - | ||||||||||||||||||||||||||||||||||||
| 3178 | break; never executed: break; | 0 | ||||||||||||||||||||||||||||||||||||
| 3179 | case CT_LineEdit: never executed: case CT_LineEdit: | 0 | ||||||||||||||||||||||||||||||||||||
| 3180 | newSize += QSize(0, 4); | - | ||||||||||||||||||||||||||||||||||||
| 3181 | break; never executed: break; | 0 | ||||||||||||||||||||||||||||||||||||
| 3182 | case CT_MenuBarItem: never executed: case CT_MenuBarItem: | 0 | ||||||||||||||||||||||||||||||||||||
| 3183 | newSize += QSize(8, 5); | - | ||||||||||||||||||||||||||||||||||||
| 3184 | break; never executed: break; | 0 | ||||||||||||||||||||||||||||||||||||
| 3185 | case CT_MenuItem: never executed: case CT_MenuItem: | 0 | ||||||||||||||||||||||||||||||||||||
| 3186 | if (const QStyleOptionMenuItem *menuItem = qstyleoption_cast<const QStyleOptionMenuItem *>(option)) {
| 0 | ||||||||||||||||||||||||||||||||||||
| 3187 | int w = newSize.width(); | - | ||||||||||||||||||||||||||||||||||||
| 3188 | int maxpmw = menuItem->maxIconWidth; | - | ||||||||||||||||||||||||||||||||||||
| 3189 | int tabSpacing = 20; | - | ||||||||||||||||||||||||||||||||||||
| 3190 | if (menuItem->text.contains(QLatin1Char('\t')))
| 0 | ||||||||||||||||||||||||||||||||||||
| 3191 | w += tabSpacing; never executed: w += tabSpacing; | 0 | ||||||||||||||||||||||||||||||||||||
| 3192 | else if (menuItem->menuItemType == QStyleOptionMenuItem::SubMenu)
| 0 | ||||||||||||||||||||||||||||||||||||
| 3193 | w += 2 * QFusionStylePrivate::menuArrowHMargin; never executed: w += 2 * QFusionStylePrivate::menuArrowHMargin; | 0 | ||||||||||||||||||||||||||||||||||||
| 3194 | else if (menuItem->menuItemType == QStyleOptionMenuItem::DefaultItem) {
| 0 | ||||||||||||||||||||||||||||||||||||
| 3195 | QFontMetrics fm(menuItem->font); | - | ||||||||||||||||||||||||||||||||||||
| 3196 | QFont fontBold = menuItem->font; | - | ||||||||||||||||||||||||||||||||||||
| 3197 | fontBold.setBold(true); | - | ||||||||||||||||||||||||||||||||||||
| 3198 | QFontMetrics fmBold(fontBold); | - | ||||||||||||||||||||||||||||||||||||
| 3199 | w += fmBold.width(menuItem->text) - fm.width(menuItem->text); | - | ||||||||||||||||||||||||||||||||||||
| 3200 | } never executed: end of block | 0 | ||||||||||||||||||||||||||||||||||||
| 3201 | int checkcol = qMax<int>(maxpmw, QFusionStylePrivate::menuCheckMarkWidth); // Windows always shows a check column | - | ||||||||||||||||||||||||||||||||||||
| 3202 | w += checkcol; | - | ||||||||||||||||||||||||||||||||||||
| 3203 | w += int(QFusionStylePrivate::menuRightBorder) + 10; | - | ||||||||||||||||||||||||||||||||||||
| 3204 | newSize.setWidth(w); | - | ||||||||||||||||||||||||||||||||||||
| 3205 | if (menuItem->menuItemType == QStyleOptionMenuItem::Separator) {
| 0 | ||||||||||||||||||||||||||||||||||||
| 3206 | if (!menuItem->text.isEmpty()) {
| 0 | ||||||||||||||||||||||||||||||||||||
| 3207 | newSize.setHeight(menuItem->fontMetrics.height()); | - | ||||||||||||||||||||||||||||||||||||
| 3208 | } never executed: end of block | 0 | ||||||||||||||||||||||||||||||||||||
| 3209 | } never executed: end of block | 0 | ||||||||||||||||||||||||||||||||||||
| 3210 | else if (!menuItem->icon.isNull()) {
| 0 | ||||||||||||||||||||||||||||||||||||
| 3211 | if (const QComboBox *combo = qobject_cast<const QComboBox*>(widget)) {
| 0 | ||||||||||||||||||||||||||||||||||||
| 3212 | newSize.setHeight(qMax(combo->iconSize().height() + 2, newSize.height())); | - | ||||||||||||||||||||||||||||||||||||
| 3213 | } never executed: end of block | 0 | ||||||||||||||||||||||||||||||||||||
| 3214 | } never executed: end of block | 0 | ||||||||||||||||||||||||||||||||||||
| 3215 | newSize.setWidth(newSize.width() + 12); | - | ||||||||||||||||||||||||||||||||||||
| 3216 | newSize.setWidth(qMax(newSize.width(), 120)); | - | ||||||||||||||||||||||||||||||||||||
| 3217 | } never executed: end of block | 0 | ||||||||||||||||||||||||||||||||||||
| 3218 | break; never executed: break; | 0 | ||||||||||||||||||||||||||||||||||||
| 3219 | case CT_SizeGrip: never executed: case CT_SizeGrip: | 0 | ||||||||||||||||||||||||||||||||||||
| 3220 | newSize += QSize(4, 4); | - | ||||||||||||||||||||||||||||||||||||
| 3221 | break; never executed: break; | 0 | ||||||||||||||||||||||||||||||||||||
| 3222 | case CT_MdiControls: never executed: case CT_MdiControls: | 0 | ||||||||||||||||||||||||||||||||||||
| 3223 | if (const QStyleOptionComplex *styleOpt = qstyleoption_cast<const QStyleOptionComplex *>(option)) {
| 0 | ||||||||||||||||||||||||||||||||||||
| 3224 | int width = 0; | - | ||||||||||||||||||||||||||||||||||||
| 3225 | if (styleOpt->subControls & SC_MdiMinButton)
| 0 | ||||||||||||||||||||||||||||||||||||
| 3226 | width += 19 + 1; never executed: width += 19 + 1; | 0 | ||||||||||||||||||||||||||||||||||||
| 3227 | if (styleOpt->subControls & SC_MdiNormalButton)
| 0 | ||||||||||||||||||||||||||||||||||||
| 3228 | width += 19 + 1; never executed: width += 19 + 1; | 0 | ||||||||||||||||||||||||||||||||||||
| 3229 | if (styleOpt->subControls & SC_MdiCloseButton)
| 0 | ||||||||||||||||||||||||||||||||||||
| 3230 | width += 19 + 1; never executed: width += 19 + 1; | 0 | ||||||||||||||||||||||||||||||||||||
| 3231 | newSize = QSize(width, 19); | - | ||||||||||||||||||||||||||||||||||||
| 3232 | } else { never executed: end of block | 0 | ||||||||||||||||||||||||||||||||||||
| 3233 | newSize = QSize(60, 19); | - | ||||||||||||||||||||||||||||||||||||
| 3234 | } never executed: end of block | 0 | ||||||||||||||||||||||||||||||||||||
| 3235 | break; never executed: break; | 0 | ||||||||||||||||||||||||||||||||||||
| 3236 | default: never executed: default: | 0 | ||||||||||||||||||||||||||||||||||||
| 3237 | break; never executed: break; | 0 | ||||||||||||||||||||||||||||||||||||
| 3238 | } | - | ||||||||||||||||||||||||||||||||||||
| 3239 | return newSize; never executed: return newSize; | 0 | ||||||||||||||||||||||||||||||||||||
| 3240 | } | - | ||||||||||||||||||||||||||||||||||||
| 3241 | - | |||||||||||||||||||||||||||||||||||||
| 3242 | /*! | - | ||||||||||||||||||||||||||||||||||||
| 3243 | \reimp | - | ||||||||||||||||||||||||||||||||||||
| 3244 | */ | - | ||||||||||||||||||||||||||||||||||||
| 3245 | void QFusionStyle::polish(QApplication *app) | - | ||||||||||||||||||||||||||||||||||||
| 3246 | { | - | ||||||||||||||||||||||||||||||||||||
| 3247 | QCommonStyle::polish(app); | - | ||||||||||||||||||||||||||||||||||||
| 3248 | } never executed: end of block | 0 | ||||||||||||||||||||||||||||||||||||
| 3249 | - | |||||||||||||||||||||||||||||||||||||
| 3250 | /*! | - | ||||||||||||||||||||||||||||||||||||
| 3251 | \reimp | - | ||||||||||||||||||||||||||||||||||||
| 3252 | */ | - | ||||||||||||||||||||||||||||||||||||
| 3253 | void QFusionStyle::polish(QWidget *widget) | - | ||||||||||||||||||||||||||||||||||||
| 3254 | { | - | ||||||||||||||||||||||||||||||||||||
| 3255 | QCommonStyle::polish(widget); | - | ||||||||||||||||||||||||||||||||||||
| 3256 | if (qobject_cast<QAbstractButton*>(widget)
| 0 | ||||||||||||||||||||||||||||||||||||
| 3257 | || qobject_cast<QComboBox *>(widget)
| 0 | ||||||||||||||||||||||||||||||||||||
| 3258 | || qobject_cast<QProgressBar *>(widget)
| 0 | ||||||||||||||||||||||||||||||||||||
| 3259 | || qobject_cast<QScrollBar *>(widget)
| 0 | ||||||||||||||||||||||||||||||||||||
| 3260 | || qobject_cast<QSplitterHandle *>(widget)
| 0 | ||||||||||||||||||||||||||||||||||||
| 3261 | || qobject_cast<QAbstractSlider *>(widget)
| 0 | ||||||||||||||||||||||||||||||||||||
| 3262 | || qobject_cast<QAbstractSpinBox *>(widget)
| 0 | ||||||||||||||||||||||||||||||||||||
| 3263 | || (widget->inherits("QDockSeparator"))
| 0 | ||||||||||||||||||||||||||||||||||||
| 3264 | || (widget->inherits("QDockWidgetSeparator"))
| 0 | ||||||||||||||||||||||||||||||||||||
| 3265 | ) { | - | ||||||||||||||||||||||||||||||||||||
| 3266 | widget->setAttribute(Qt::WA_Hover, true); | - | ||||||||||||||||||||||||||||||||||||
| 3267 | widget->setAttribute(Qt::WA_OpaquePaintEvent, false); | - | ||||||||||||||||||||||||||||||||||||
| 3268 | } never executed: end of block | 0 | ||||||||||||||||||||||||||||||||||||
| 3269 | } never executed: end of block | 0 | ||||||||||||||||||||||||||||||||||||
| 3270 | - | |||||||||||||||||||||||||||||||||||||
| 3271 | /*! | - | ||||||||||||||||||||||||||||||||||||
| 3272 | \reimp | - | ||||||||||||||||||||||||||||||||||||
| 3273 | */ | - | ||||||||||||||||||||||||||||||||||||
| 3274 | void QFusionStyle::polish(QPalette &pal) | - | ||||||||||||||||||||||||||||||||||||
| 3275 | { | - | ||||||||||||||||||||||||||||||||||||
| 3276 | QCommonStyle::polish(pal); | - | ||||||||||||||||||||||||||||||||||||
| 3277 | } never executed: end of block | 0 | ||||||||||||||||||||||||||||||||||||
| 3278 | - | |||||||||||||||||||||||||||||||||||||
| 3279 | /*! | - | ||||||||||||||||||||||||||||||||||||
| 3280 | \reimp | - | ||||||||||||||||||||||||||||||||||||
| 3281 | */ | - | ||||||||||||||||||||||||||||||||||||
| 3282 | void QFusionStyle::unpolish(QWidget *widget) | - | ||||||||||||||||||||||||||||||||||||
| 3283 | { | - | ||||||||||||||||||||||||||||||||||||
| 3284 | QCommonStyle::unpolish(widget); | - | ||||||||||||||||||||||||||||||||||||
| 3285 | if (qobject_cast<QAbstractButton*>(widget)
| 0 | ||||||||||||||||||||||||||||||||||||
| 3286 | || qobject_cast<QComboBox *>(widget)
| 0 | ||||||||||||||||||||||||||||||||||||
| 3287 | || qobject_cast<QProgressBar *>(widget)
| 0 | ||||||||||||||||||||||||||||||||||||
| 3288 | || qobject_cast<QScrollBar *>(widget)
| 0 | ||||||||||||||||||||||||||||||||||||
| 3289 | || qobject_cast<QSplitterHandle *>(widget)
| 0 | ||||||||||||||||||||||||||||||||||||
| 3290 | || qobject_cast<QAbstractSlider *>(widget)
| 0 | ||||||||||||||||||||||||||||||||||||
| 3291 | || qobject_cast<QAbstractSpinBox *>(widget)
| 0 | ||||||||||||||||||||||||||||||||||||
| 3292 | || (widget->inherits("QDockSeparator"))
| 0 | ||||||||||||||||||||||||||||||||||||
| 3293 | || (widget->inherits("QDockWidgetSeparator"))
| 0 | ||||||||||||||||||||||||||||||||||||
| 3294 | ) { | - | ||||||||||||||||||||||||||||||||||||
| 3295 | widget->setAttribute(Qt::WA_Hover, false); | - | ||||||||||||||||||||||||||||||||||||
| 3296 | } never executed: end of block | 0 | ||||||||||||||||||||||||||||||||||||
| 3297 | } never executed: end of block | 0 | ||||||||||||||||||||||||||||||||||||
| 3298 | - | |||||||||||||||||||||||||||||||||||||
| 3299 | /*! | - | ||||||||||||||||||||||||||||||||||||
| 3300 | \reimp | - | ||||||||||||||||||||||||||||||||||||
| 3301 | */ | - | ||||||||||||||||||||||||||||||||||||
| 3302 | void QFusionStyle::unpolish(QApplication *app) | - | ||||||||||||||||||||||||||||||||||||
| 3303 | { | - | ||||||||||||||||||||||||||||||||||||
| 3304 | QCommonStyle::unpolish(app); | - | ||||||||||||||||||||||||||||||||||||
| 3305 | } never executed: end of block | 0 | ||||||||||||||||||||||||||||||||||||
| 3306 | - | |||||||||||||||||||||||||||||||||||||
| 3307 | /*! | - | ||||||||||||||||||||||||||||||||||||
| 3308 | \reimp | - | ||||||||||||||||||||||||||||||||||||
| 3309 | */ | - | ||||||||||||||||||||||||||||||||||||
| 3310 | QRect QFusionStyle::subControlRect(ComplexControl control, const QStyleOptionComplex *option, | - | ||||||||||||||||||||||||||||||||||||
| 3311 | SubControl subControl, const QWidget *widget) const | - | ||||||||||||||||||||||||||||||||||||
| 3312 | { | - | ||||||||||||||||||||||||||||||||||||
| 3313 | QRect rect = QCommonStyle::subControlRect(control, option, subControl, widget); | - | ||||||||||||||||||||||||||||||||||||
| 3314 | - | |||||||||||||||||||||||||||||||||||||
| 3315 | switch (control) { | - | ||||||||||||||||||||||||||||||||||||
| 3316 | case CC_Slider: never executed: case CC_Slider: | 0 | ||||||||||||||||||||||||||||||||||||
| 3317 | if (const QStyleOptionSlider *slider = qstyleoption_cast<const QStyleOptionSlider *>(option)) {
| 0 | ||||||||||||||||||||||||||||||||||||
| 3318 | int tickSize = proxy()->pixelMetric(PM_SliderTickmarkOffset, option, widget); | - | ||||||||||||||||||||||||||||||||||||
| 3319 | switch (subControl) { | - | ||||||||||||||||||||||||||||||||||||
| 3320 | case SC_SliderHandle: { never executed: case SC_SliderHandle: | 0 | ||||||||||||||||||||||||||||||||||||
| 3321 | if (slider->orientation == Qt::Horizontal) {
| 0 | ||||||||||||||||||||||||||||||||||||
| 3322 | rect.setHeight(proxy()->pixelMetric(PM_SliderThickness)); | - | ||||||||||||||||||||||||||||||||||||
| 3323 | rect.setWidth(proxy()->pixelMetric(PM_SliderLength)); | - | ||||||||||||||||||||||||||||||||||||
| 3324 | int centerY = slider->rect.center().y() - rect.height() / 2; | - | ||||||||||||||||||||||||||||||||||||
| 3325 | if (slider->tickPosition & QSlider::TicksAbove)
| 0 | ||||||||||||||||||||||||||||||||||||
| 3326 | centerY += tickSize; never executed: centerY += tickSize; | 0 | ||||||||||||||||||||||||||||||||||||
| 3327 | if (slider->tickPosition & QSlider::TicksBelow)
| 0 | ||||||||||||||||||||||||||||||||||||
| 3328 | centerY -= tickSize; never executed: centerY -= tickSize; | 0 | ||||||||||||||||||||||||||||||||||||
| 3329 | rect.moveTop(centerY); | - | ||||||||||||||||||||||||||||||||||||
| 3330 | } else { never executed: end of block | 0 | ||||||||||||||||||||||||||||||||||||
| 3331 | rect.setWidth(proxy()->pixelMetric(PM_SliderThickness)); | - | ||||||||||||||||||||||||||||||||||||
| 3332 | rect.setHeight(proxy()->pixelMetric(PM_SliderLength)); | - | ||||||||||||||||||||||||||||||||||||
| 3333 | int centerX = slider->rect.center().x() - rect.width() / 2; | - | ||||||||||||||||||||||||||||||||||||
| 3334 | if (slider->tickPosition & QSlider::TicksAbove)
| 0 | ||||||||||||||||||||||||||||||||||||
| 3335 | centerX += tickSize; never executed: centerX += tickSize; | 0 | ||||||||||||||||||||||||||||||||||||
| 3336 | if (slider->tickPosition & QSlider::TicksBelow)
| 0 | ||||||||||||||||||||||||||||||||||||
| 3337 | centerX -= tickSize; never executed: centerX -= tickSize; | 0 | ||||||||||||||||||||||||||||||||||||
| 3338 | rect.moveLeft(centerX); | - | ||||||||||||||||||||||||||||||||||||
| 3339 | } never executed: end of block | 0 | ||||||||||||||||||||||||||||||||||||
| 3340 | } | - | ||||||||||||||||||||||||||||||||||||
| 3341 | break; never executed: break; | 0 | ||||||||||||||||||||||||||||||||||||
| 3342 | case SC_SliderGroove: { never executed: case SC_SliderGroove: | 0 | ||||||||||||||||||||||||||||||||||||
| 3343 | QPoint grooveCenter = slider->rect.center(); | - | ||||||||||||||||||||||||||||||||||||
| 3344 | const int grooveThickness = QStyleHelper::dpiScaled(7); | - | ||||||||||||||||||||||||||||||||||||
| 3345 | if (slider->orientation == Qt::Horizontal) {
| 0 | ||||||||||||||||||||||||||||||||||||
| 3346 | rect.setHeight(grooveThickness); | - | ||||||||||||||||||||||||||||||||||||
| 3347 | if (slider->tickPosition & QSlider::TicksAbove)
| 0 | ||||||||||||||||||||||||||||||||||||
| 3348 | grooveCenter.ry() += tickSize; never executed: grooveCenter.ry() += tickSize; | 0 | ||||||||||||||||||||||||||||||||||||
| 3349 | if (slider->tickPosition & QSlider::TicksBelow)
| 0 | ||||||||||||||||||||||||||||||||||||
| 3350 | grooveCenter.ry() -= tickSize; never executed: grooveCenter.ry() -= tickSize; | 0 | ||||||||||||||||||||||||||||||||||||
| 3351 | } else { never executed: end of block | 0 | ||||||||||||||||||||||||||||||||||||
| 3352 | rect.setWidth(grooveThickness); | - | ||||||||||||||||||||||||||||||||||||
| 3353 | if (slider->tickPosition & QSlider::TicksAbove)
| 0 | ||||||||||||||||||||||||||||||||||||
| 3354 | grooveCenter.rx() += tickSize; never executed: grooveCenter.rx() += tickSize; | 0 | ||||||||||||||||||||||||||||||||||||
| 3355 | if (slider->tickPosition & QSlider::TicksBelow)
| 0 | ||||||||||||||||||||||||||||||||||||
| 3356 | grooveCenter.rx() -= tickSize; never executed: grooveCenter.rx() -= tickSize; | 0 | ||||||||||||||||||||||||||||||||||||
| 3357 | } never executed: end of block | 0 | ||||||||||||||||||||||||||||||||||||
| 3358 | rect.moveCenter(grooveCenter); | - | ||||||||||||||||||||||||||||||||||||
| 3359 | break; never executed: break; | 0 | ||||||||||||||||||||||||||||||||||||
| 3360 | } | - | ||||||||||||||||||||||||||||||||||||
| 3361 | default: never executed: default: | 0 | ||||||||||||||||||||||||||||||||||||
| 3362 | break; never executed: break; | 0 | ||||||||||||||||||||||||||||||||||||
| 3363 | } | - | ||||||||||||||||||||||||||||||||||||
| 3364 | } | - | ||||||||||||||||||||||||||||||||||||
| 3365 | break; never executed: break; | 0 | ||||||||||||||||||||||||||||||||||||
| 3366 | case CC_SpinBox: never executed: case CC_SpinBox: | 0 | ||||||||||||||||||||||||||||||||||||
| 3367 | if (const QStyleOptionSpinBox *spinbox = qstyleoption_cast<const QStyleOptionSpinBox *>(option)) {
| 0 | ||||||||||||||||||||||||||||||||||||
| 3368 | int center = spinbox->rect.height() / 2; | - | ||||||||||||||||||||||||||||||||||||
| 3369 | int fw = spinbox->frame ? 3 : 0; // Is drawn with 3 pixels width in drawComplexControl, independently from PM_SpinBoxFrameWidth
| 0 | ||||||||||||||||||||||||||||||||||||
| 3370 | int y = fw; | - | ||||||||||||||||||||||||||||||||||||
| 3371 | const int buttonWidth = QStyleHelper::dpiScaled(14); | - | ||||||||||||||||||||||||||||||||||||
| 3372 | int x, lx, rx; | - | ||||||||||||||||||||||||||||||||||||
| 3373 | x = spinbox->rect.width() - y - buttonWidth + 2; | - | ||||||||||||||||||||||||||||||||||||
| 3374 | lx = fw; | - | ||||||||||||||||||||||||||||||||||||
| 3375 | rx = x - fw; | - | ||||||||||||||||||||||||||||||||||||
| 3376 | switch (subControl) { | - | ||||||||||||||||||||||||||||||||||||
| 3377 | case SC_SpinBoxUp: never executed: case SC_SpinBoxUp: | 0 | ||||||||||||||||||||||||||||||||||||
| 3378 | if (spinbox->buttonSymbols == QAbstractSpinBox::NoButtons)
| 0 | ||||||||||||||||||||||||||||||||||||
| 3379 | return QRect(); never executed: return QRect(); | 0 | ||||||||||||||||||||||||||||||||||||
| 3380 | rect = QRect(x, fw, buttonWidth, center - fw); | - | ||||||||||||||||||||||||||||||||||||
| 3381 | break; never executed: break; | 0 | ||||||||||||||||||||||||||||||||||||
| 3382 | case SC_SpinBoxDown: never executed: case SC_SpinBoxDown: | 0 | ||||||||||||||||||||||||||||||||||||
| 3383 | if (spinbox->buttonSymbols == QAbstractSpinBox::NoButtons)
| 0 | ||||||||||||||||||||||||||||||||||||
| 3384 | return QRect(); never executed: return QRect(); | 0 | ||||||||||||||||||||||||||||||||||||
| 3385 | - | |||||||||||||||||||||||||||||||||||||
| 3386 | rect = QRect(x, center, buttonWidth, spinbox->rect.bottom() - center - fw + 1); | - | ||||||||||||||||||||||||||||||||||||
| 3387 | break; never executed: break; | 0 | ||||||||||||||||||||||||||||||||||||
| 3388 | case SC_SpinBoxEditField: never executed: case SC_SpinBoxEditField: | 0 | ||||||||||||||||||||||||||||||||||||
| 3389 | if (spinbox->buttonSymbols == QAbstractSpinBox::NoButtons) {
| 0 | ||||||||||||||||||||||||||||||||||||
| 3390 | rect = QRect(lx, fw, spinbox->rect.width() - 2*fw, spinbox->rect.height() - 2*fw); | - | ||||||||||||||||||||||||||||||||||||
| 3391 | } else { never executed: end of block | 0 | ||||||||||||||||||||||||||||||||||||
| 3392 | rect = QRect(lx, fw, rx - qMax(fw - 1, 0), spinbox->rect.height() - 2*fw); | - | ||||||||||||||||||||||||||||||||||||
| 3393 | } never executed: end of block | 0 | ||||||||||||||||||||||||||||||||||||
| 3394 | break; never executed: break; | 0 | ||||||||||||||||||||||||||||||||||||
| 3395 | case SC_SpinBoxFrame: never executed: case SC_SpinBoxFrame: | 0 | ||||||||||||||||||||||||||||||||||||
| 3396 | rect = spinbox->rect; | - | ||||||||||||||||||||||||||||||||||||
| 3397 | default: code before this statement never executed: default:never executed: default: | 0 | ||||||||||||||||||||||||||||||||||||
| 3398 | break; never executed: break; | 0 | ||||||||||||||||||||||||||||||||||||
| 3399 | } | - | ||||||||||||||||||||||||||||||||||||
| 3400 | rect = visualRect(spinbox->direction, spinbox->rect, rect); | - | ||||||||||||||||||||||||||||||||||||
| 3401 | } never executed: end of block | 0 | ||||||||||||||||||||||||||||||||||||
| 3402 | break; never executed: break; | 0 | ||||||||||||||||||||||||||||||||||||
| 3403 | - | |||||||||||||||||||||||||||||||||||||
| 3404 | case CC_GroupBox: never executed: case CC_GroupBox: | 0 | ||||||||||||||||||||||||||||||||||||
| 3405 | if (const QStyleOptionGroupBox *groupBox = qstyleoption_cast<const QStyleOptionGroupBox *>(option)) {
| 0 | ||||||||||||||||||||||||||||||||||||
| 3406 | rect = option->rect; | - | ||||||||||||||||||||||||||||||||||||
| 3407 | if (subControl == SC_GroupBoxFrame)
| 0 | ||||||||||||||||||||||||||||||||||||
| 3408 | return rect.adjusted(0, 0, 0, 0); never executed: return rect.adjusted(0, 0, 0, 0); | 0 | ||||||||||||||||||||||||||||||||||||
| 3409 | else if (subControl == SC_GroupBoxContents) {
| 0 | ||||||||||||||||||||||||||||||||||||
| 3410 | QRect frameRect = option->rect.adjusted(0, 0, 0, -groupBoxBottomMargin); | - | ||||||||||||||||||||||||||||||||||||
| 3411 | int margin = 3; | - | ||||||||||||||||||||||||||||||||||||
| 3412 | int leftMarginExtension = 0; | - | ||||||||||||||||||||||||||||||||||||
| 3413 | int topMargin = qMax(pixelMetric(PM_ExclusiveIndicatorHeight), option->fontMetrics.height()) + groupBoxTopMargin; | - | ||||||||||||||||||||||||||||||||||||
| 3414 | return frameRect.adjusted(leftMarginExtension + margin, margin + topMargin, -margin, -margin - groupBoxBottomMargin); never executed: return frameRect.adjusted(leftMarginExtension + margin, margin + topMargin, -margin, -margin - groupBoxBottomMargin); | 0 | ||||||||||||||||||||||||||||||||||||
| 3415 | } | - | ||||||||||||||||||||||||||||||||||||
| 3416 | - | |||||||||||||||||||||||||||||||||||||
| 3417 | QSize textSize = option->fontMetrics.boundingRect(groupBox->text).size() + QSize(2, 2); | - | ||||||||||||||||||||||||||||||||||||
| 3418 | int indicatorWidth = proxy()->pixelMetric(PM_IndicatorWidth, option, widget); | - | ||||||||||||||||||||||||||||||||||||
| 3419 | int indicatorHeight = proxy()->pixelMetric(PM_IndicatorHeight, option, widget); | - | ||||||||||||||||||||||||||||||||||||
| 3420 | - | |||||||||||||||||||||||||||||||||||||
| 3421 | const int width = textSize.width() | - | ||||||||||||||||||||||||||||||||||||
| 3422 | + (option->subControls & QStyle::SC_GroupBoxCheckBox ? indicatorWidth + 5 : 0);
| 0 | ||||||||||||||||||||||||||||||||||||
| 3423 | - | |||||||||||||||||||||||||||||||||||||
| 3424 | rect = QRect(); | - | ||||||||||||||||||||||||||||||||||||
| 3425 | - | |||||||||||||||||||||||||||||||||||||
| 3426 | if (option->rect.width() > width) {
| 0 | ||||||||||||||||||||||||||||||||||||
| 3427 | switch (groupBox->textAlignment & Qt::AlignHorizontal_Mask) { | - | ||||||||||||||||||||||||||||||||||||
| 3428 | case Qt::AlignHCenter: never executed: case Qt::AlignHCenter: | 0 | ||||||||||||||||||||||||||||||||||||
| 3429 | rect.moveLeft((option->rect.width() - width) / 2); | - | ||||||||||||||||||||||||||||||||||||
| 3430 | break; never executed: break; | 0 | ||||||||||||||||||||||||||||||||||||
| 3431 | case Qt::AlignRight: never executed: case Qt::AlignRight: | 0 | ||||||||||||||||||||||||||||||||||||
| 3432 | rect.moveLeft(option->rect.width() - width); | - | ||||||||||||||||||||||||||||||||||||
| 3433 | break; never executed: break; | 0 | ||||||||||||||||||||||||||||||||||||
| 3434 | } | - | ||||||||||||||||||||||||||||||||||||
| 3435 | } never executed: end of block | 0 | ||||||||||||||||||||||||||||||||||||
| 3436 | - | |||||||||||||||||||||||||||||||||||||
| 3437 | if (subControl == SC_GroupBoxCheckBox) {
| 0 | ||||||||||||||||||||||||||||||||||||
| 3438 | rect.setWidth(indicatorWidth); | - | ||||||||||||||||||||||||||||||||||||
| 3439 | rect.setHeight(indicatorHeight); | - | ||||||||||||||||||||||||||||||||||||
| 3440 | rect.moveTop(textSize.height() > indicatorHeight ? (textSize.height() - indicatorHeight) / 2 : 0); | - | ||||||||||||||||||||||||||||||||||||
| 3441 | rect.translate(1, 0); | - | ||||||||||||||||||||||||||||||||||||
| 3442 | } else if (subControl == SC_GroupBoxLabel) { never executed: end of block
| 0 | ||||||||||||||||||||||||||||||||||||
| 3443 | rect.setSize(textSize); | - | ||||||||||||||||||||||||||||||||||||
| 3444 | rect.moveTop(1); | - | ||||||||||||||||||||||||||||||||||||
| 3445 | if (option->subControls & QStyle::SC_GroupBoxCheckBox)
| 0 | ||||||||||||||||||||||||||||||||||||
| 3446 | rect.translate(indicatorWidth + 5, 0); never executed: rect.translate(indicatorWidth + 5, 0); | 0 | ||||||||||||||||||||||||||||||||||||
| 3447 | } never executed: end of block | 0 | ||||||||||||||||||||||||||||||||||||
| 3448 | return visualRect(option->direction, option->rect, rect); never executed: return visualRect(option->direction, option->rect, rect); | 0 | ||||||||||||||||||||||||||||||||||||
| 3449 | } | - | ||||||||||||||||||||||||||||||||||||
| 3450 | - | |||||||||||||||||||||||||||||||||||||
| 3451 | return rect; never executed: return rect; | 0 | ||||||||||||||||||||||||||||||||||||
| 3452 | - | |||||||||||||||||||||||||||||||||||||
| 3453 | case CC_ComboBox: never executed: case CC_ComboBox: | 0 | ||||||||||||||||||||||||||||||||||||
| 3454 | switch (subControl) { | - | ||||||||||||||||||||||||||||||||||||
| 3455 | case SC_ComboBoxArrow: never executed: case SC_ComboBoxArrow: | 0 | ||||||||||||||||||||||||||||||||||||
| 3456 | rect = visualRect(option->direction, option->rect, rect); | - | ||||||||||||||||||||||||||||||||||||
| 3457 | rect.setRect(rect.right() - 18, rect.top() - 2, | - | ||||||||||||||||||||||||||||||||||||
| 3458 | 19, rect.height() + 4); | - | ||||||||||||||||||||||||||||||||||||
| 3459 | rect = visualRect(option->direction, option->rect, rect); | - | ||||||||||||||||||||||||||||||||||||
| 3460 | break; never executed: break; | 0 | ||||||||||||||||||||||||||||||||||||
| 3461 | case SC_ComboBoxEditField: { never executed: case SC_ComboBoxEditField: | 0 | ||||||||||||||||||||||||||||||||||||
| 3462 | int frameWidth = 2; | - | ||||||||||||||||||||||||||||||||||||
| 3463 | rect = visualRect(option->direction, option->rect, rect); | - | ||||||||||||||||||||||||||||||||||||
| 3464 | rect.setRect(option->rect.left() + frameWidth, option->rect.top() + frameWidth, | - | ||||||||||||||||||||||||||||||||||||
| 3465 | option->rect.width() - 19 - 2 * frameWidth, | - | ||||||||||||||||||||||||||||||||||||
| 3466 | option->rect.height() - 2 * frameWidth); | - | ||||||||||||||||||||||||||||||||||||
| 3467 | if (const QStyleOptionComboBox *box = qstyleoption_cast<const QStyleOptionComboBox *>(option)) {
| 0 | ||||||||||||||||||||||||||||||||||||
| 3468 | if (!box->editable) {
| 0 | ||||||||||||||||||||||||||||||||||||
| 3469 | rect.adjust(2, 0, 0, 0); | - | ||||||||||||||||||||||||||||||||||||
| 3470 | if (box->state & (State_Sunken | State_On))
| 0 | ||||||||||||||||||||||||||||||||||||
| 3471 | rect.translate(1, 1); never executed: rect.translate(1, 1); | 0 | ||||||||||||||||||||||||||||||||||||
| 3472 | } never executed: end of block | 0 | ||||||||||||||||||||||||||||||||||||
| 3473 | } never executed: end of block | 0 | ||||||||||||||||||||||||||||||||||||
| 3474 | rect = visualRect(option->direction, option->rect, rect); | - | ||||||||||||||||||||||||||||||||||||
| 3475 | break; never executed: break; | 0 | ||||||||||||||||||||||||||||||||||||
| 3476 | } | - | ||||||||||||||||||||||||||||||||||||
| 3477 | default: never executed: default: | 0 | ||||||||||||||||||||||||||||||||||||
| 3478 | break; never executed: break; | 0 | ||||||||||||||||||||||||||||||||||||
| 3479 | } | - | ||||||||||||||||||||||||||||||||||||
| 3480 | break; never executed: break; | 0 | ||||||||||||||||||||||||||||||||||||
| 3481 | case CC_TitleBar: never executed: case CC_TitleBar: | 0 | ||||||||||||||||||||||||||||||||||||
| 3482 | if (const QStyleOptionTitleBar *tb = qstyleoption_cast<const QStyleOptionTitleBar *>(option)) {
| 0 | ||||||||||||||||||||||||||||||||||||
| 3483 | SubControl sc = subControl; | - | ||||||||||||||||||||||||||||||||||||
| 3484 | QRect &ret = rect; | - | ||||||||||||||||||||||||||||||||||||
| 3485 | const int indent = 3; | - | ||||||||||||||||||||||||||||||||||||
| 3486 | const int controlTopMargin = 3; | - | ||||||||||||||||||||||||||||||||||||
| 3487 | const int controlBottomMargin = 3; | - | ||||||||||||||||||||||||||||||||||||
| 3488 | const int controlWidthMargin = 2; | - | ||||||||||||||||||||||||||||||||||||
| 3489 | const int controlHeight = tb->rect.height() - controlTopMargin - controlBottomMargin ; | - | ||||||||||||||||||||||||||||||||||||
| 3490 | const int delta = controlHeight + controlWidthMargin; | - | ||||||||||||||||||||||||||||||||||||
| 3491 | int offset = 0; | - | ||||||||||||||||||||||||||||||||||||
| 3492 | - | |||||||||||||||||||||||||||||||||||||
| 3493 | bool isMinimized = tb->titleBarState & Qt::WindowMinimized; | - | ||||||||||||||||||||||||||||||||||||
| 3494 | bool isMaximized = tb->titleBarState & Qt::WindowMaximized; | - | ||||||||||||||||||||||||||||||||||||
| 3495 | - | |||||||||||||||||||||||||||||||||||||
| 3496 | switch (sc) { | - | ||||||||||||||||||||||||||||||||||||
| 3497 | case SC_TitleBarLabel: never executed: case SC_TitleBarLabel: | 0 | ||||||||||||||||||||||||||||||||||||
| 3498 | if (tb->titleBarFlags & (Qt::WindowTitleHint | Qt::WindowSystemMenuHint)) {
| 0 | ||||||||||||||||||||||||||||||||||||
| 3499 | ret = tb->rect; | - | ||||||||||||||||||||||||||||||||||||
| 3500 | if (tb->titleBarFlags & Qt::WindowSystemMenuHint)
| 0 | ||||||||||||||||||||||||||||||||||||
| 3501 | ret.adjust(delta, 0, -delta, 0); never executed: ret.adjust(delta, 0, -delta, 0); | 0 | ||||||||||||||||||||||||||||||||||||
| 3502 | if (tb->titleBarFlags & Qt::WindowMinimizeButtonHint)
| 0 | ||||||||||||||||||||||||||||||||||||
| 3503 | ret.adjust(0, 0, -delta, 0); never executed: ret.adjust(0, 0, -delta, 0); | 0 | ||||||||||||||||||||||||||||||||||||
| 3504 | if (tb->titleBarFlags & Qt::WindowMaximizeButtonHint)
| 0 | ||||||||||||||||||||||||||||||||||||
| 3505 | ret.adjust(0, 0, -delta, 0); never executed: ret.adjust(0, 0, -delta, 0); | 0 | ||||||||||||||||||||||||||||||||||||
| 3506 | if (tb->titleBarFlags & Qt::WindowShadeButtonHint)
| 0 | ||||||||||||||||||||||||||||||||||||
| 3507 | ret.adjust(0, 0, -delta, 0); never executed: ret.adjust(0, 0, -delta, 0); | 0 | ||||||||||||||||||||||||||||||||||||
| 3508 | if (tb->titleBarFlags & Qt::WindowContextHelpButtonHint)
| 0 | ||||||||||||||||||||||||||||||||||||
| 3509 | ret.adjust(0, 0, -delta, 0); never executed: ret.adjust(0, 0, -delta, 0); | 0 | ||||||||||||||||||||||||||||||||||||
| 3510 | } never executed: end of block | 0 | ||||||||||||||||||||||||||||||||||||
| 3511 | break; never executed: break; | 0 | ||||||||||||||||||||||||||||||||||||
| 3512 | case SC_TitleBarContextHelpButton: never executed: case SC_TitleBarContextHelpButton: | 0 | ||||||||||||||||||||||||||||||||||||
| 3513 | if (tb->titleBarFlags & Qt::WindowContextHelpButtonHint)
| 0 | ||||||||||||||||||||||||||||||||||||
| 3514 | offset += delta; never executed: offset += delta; | 0 | ||||||||||||||||||||||||||||||||||||
| 3515 | case SC_TitleBarMinButton: code before this statement never executed: case SC_TitleBarMinButton:never executed: case SC_TitleBarMinButton: | 0 | ||||||||||||||||||||||||||||||||||||
| 3516 | if (!isMinimized && (tb->titleBarFlags & Qt::WindowMinimizeButtonHint))
| 0 | ||||||||||||||||||||||||||||||||||||
| 3517 | offset += delta; never executed: offset += delta; | 0 | ||||||||||||||||||||||||||||||||||||
| 3518 | else if (sc == SC_TitleBarMinButton)
| 0 | ||||||||||||||||||||||||||||||||||||
| 3519 | break; never executed: break; | 0 | ||||||||||||||||||||||||||||||||||||
| 3520 | case SC_TitleBarNormalButton: code before this statement never executed: case SC_TitleBarNormalButton:never executed: case SC_TitleBarNormalButton: | 0 | ||||||||||||||||||||||||||||||||||||
| 3521 | if (isMinimized && (tb->titleBarFlags & Qt::WindowMinimizeButtonHint))
| 0 | ||||||||||||||||||||||||||||||||||||
| 3522 | offset += delta; never executed: offset += delta; | 0 | ||||||||||||||||||||||||||||||||||||
| 3523 | else if (isMaximized && (tb->titleBarFlags & Qt::WindowMaximizeButtonHint))
| 0 | ||||||||||||||||||||||||||||||||||||
| 3524 | offset += delta; never executed: offset += delta; | 0 | ||||||||||||||||||||||||||||||||||||
| 3525 | else if (sc == SC_TitleBarNormalButton)
| 0 | ||||||||||||||||||||||||||||||||||||
| 3526 | break; never executed: break; | 0 | ||||||||||||||||||||||||||||||||||||
| 3527 | case SC_TitleBarMaxButton: code before this statement never executed: case SC_TitleBarMaxButton:never executed: case SC_TitleBarMaxButton: | 0 | ||||||||||||||||||||||||||||||||||||
| 3528 | if (!isMaximized && (tb->titleBarFlags & Qt::WindowMaximizeButtonHint))
| 0 | ||||||||||||||||||||||||||||||||||||
| 3529 | offset += delta; never executed: offset += delta; | 0 | ||||||||||||||||||||||||||||||||||||
| 3530 | else if (sc == SC_TitleBarMaxButton)
| 0 | ||||||||||||||||||||||||||||||||||||
| 3531 | break; never executed: break; | 0 | ||||||||||||||||||||||||||||||||||||
| 3532 | case SC_TitleBarShadeButton: code before this statement never executed: case SC_TitleBarShadeButton:never executed: case SC_TitleBarShadeButton: | 0 | ||||||||||||||||||||||||||||||||||||
| 3533 | if (!isMinimized && (tb->titleBarFlags & Qt::WindowShadeButtonHint))
| 0 | ||||||||||||||||||||||||||||||||||||
| 3534 | offset += delta; never executed: offset += delta; | 0 | ||||||||||||||||||||||||||||||||||||
| 3535 | else if (sc == SC_TitleBarShadeButton)
| 0 | ||||||||||||||||||||||||||||||||||||
| 3536 | break; never executed: break; | 0 | ||||||||||||||||||||||||||||||||||||
| 3537 | case SC_TitleBarUnshadeButton: code before this statement never executed: case SC_TitleBarUnshadeButton:never executed: case SC_TitleBarUnshadeButton: | 0 | ||||||||||||||||||||||||||||||||||||
| 3538 | if (isMinimized && (tb->titleBarFlags & Qt::WindowShadeButtonHint))
| 0 | ||||||||||||||||||||||||||||||||||||
| 3539 | offset += delta; never executed: offset += delta; | 0 | ||||||||||||||||||||||||||||||||||||
| 3540 | else if (sc == SC_TitleBarUnshadeButton)
| 0 | ||||||||||||||||||||||||||||||||||||
| 3541 | break; never executed: break; | 0 | ||||||||||||||||||||||||||||||||||||
| 3542 | case SC_TitleBarCloseButton: code before this statement never executed: case SC_TitleBarCloseButton:never executed: case SC_TitleBarCloseButton: | 0 | ||||||||||||||||||||||||||||||||||||
| 3543 | if (tb->titleBarFlags & Qt::WindowSystemMenuHint)
| 0 | ||||||||||||||||||||||||||||||||||||
| 3544 | offset += delta; never executed: offset += delta; | 0 | ||||||||||||||||||||||||||||||||||||
| 3545 | else if (sc == SC_TitleBarCloseButton)
| 0 | ||||||||||||||||||||||||||||||||||||
| 3546 | break; never executed: break; | 0 | ||||||||||||||||||||||||||||||||||||
| 3547 | ret.setRect(tb->rect.right() - indent - offset, tb->rect.top() + controlTopMargin, | - | ||||||||||||||||||||||||||||||||||||
| 3548 | controlHeight, controlHeight); | - | ||||||||||||||||||||||||||||||||||||
| 3549 | break; never executed: break; | 0 | ||||||||||||||||||||||||||||||||||||
| 3550 | case SC_TitleBarSysMenu: never executed: case SC_TitleBarSysMenu: | 0 | ||||||||||||||||||||||||||||||||||||
| 3551 | if (tb->titleBarFlags & Qt::WindowSystemMenuHint) {
| 0 | ||||||||||||||||||||||||||||||||||||
| 3552 | ret.setRect(tb->rect.left() + controlWidthMargin + indent, tb->rect.top() + controlTopMargin, | - | ||||||||||||||||||||||||||||||||||||
| 3553 | controlHeight, controlHeight); | - | ||||||||||||||||||||||||||||||||||||
| 3554 | } never executed: end of block | 0 | ||||||||||||||||||||||||||||||||||||
| 3555 | break; never executed: break; | 0 | ||||||||||||||||||||||||||||||||||||
| 3556 | default: never executed: default: | 0 | ||||||||||||||||||||||||||||||||||||
| 3557 | break; never executed: break; | 0 | ||||||||||||||||||||||||||||||||||||
| 3558 | } | - | ||||||||||||||||||||||||||||||||||||
| 3559 | ret = visualRect(tb->direction, tb->rect, ret); | - | ||||||||||||||||||||||||||||||||||||
| 3560 | } never executed: end of block | 0 | ||||||||||||||||||||||||||||||||||||
| 3561 | break; never executed: break; | 0 | ||||||||||||||||||||||||||||||||||||
| 3562 | default: never executed: default: | 0 | ||||||||||||||||||||||||||||||||||||
| 3563 | break; never executed: break; | 0 | ||||||||||||||||||||||||||||||||||||
| 3564 | } | - | ||||||||||||||||||||||||||||||||||||
| 3565 | - | |||||||||||||||||||||||||||||||||||||
| 3566 | return rect; never executed: return rect; | 0 | ||||||||||||||||||||||||||||||||||||
| 3567 | } | - | ||||||||||||||||||||||||||||||||||||
| 3568 | - | |||||||||||||||||||||||||||||||||||||
| 3569 | - | |||||||||||||||||||||||||||||||||||||
| 3570 | /*! | - | ||||||||||||||||||||||||||||||||||||
| 3571 | \reimp | - | ||||||||||||||||||||||||||||||||||||
| 3572 | */ | - | ||||||||||||||||||||||||||||||||||||
| 3573 | QRect QFusionStyle::itemPixmapRect(const QRect &r, int flags, const QPixmap &pixmap) const | - | ||||||||||||||||||||||||||||||||||||
| 3574 | { | - | ||||||||||||||||||||||||||||||||||||
| 3575 | return QCommonStyle::itemPixmapRect(r, flags, pixmap); never executed: return QCommonStyle::itemPixmapRect(r, flags, pixmap); | 0 | ||||||||||||||||||||||||||||||||||||
| 3576 | } | - | ||||||||||||||||||||||||||||||||||||
| 3577 | - | |||||||||||||||||||||||||||||||||||||
| 3578 | /*! | - | ||||||||||||||||||||||||||||||||||||
| 3579 | \reimp | - | ||||||||||||||||||||||||||||||||||||
| 3580 | */ | - | ||||||||||||||||||||||||||||||||||||
| 3581 | void QFusionStyle::drawItemPixmap(QPainter *painter, const QRect &rect, | - | ||||||||||||||||||||||||||||||||||||
| 3582 | int alignment, const QPixmap &pixmap) const | - | ||||||||||||||||||||||||||||||||||||
| 3583 | { | - | ||||||||||||||||||||||||||||||||||||
| 3584 | QCommonStyle::drawItemPixmap(painter, rect, alignment, pixmap); | - | ||||||||||||||||||||||||||||||||||||
| 3585 | } never executed: end of block | 0 | ||||||||||||||||||||||||||||||||||||
| 3586 | - | |||||||||||||||||||||||||||||||||||||
| 3587 | /*! | - | ||||||||||||||||||||||||||||||||||||
| 3588 | \reimp | - | ||||||||||||||||||||||||||||||||||||
| 3589 | */ | - | ||||||||||||||||||||||||||||||||||||
| 3590 | QStyle::SubControl QFusionStyle::hitTestComplexControl(ComplexControl cc, const QStyleOptionComplex *opt, | - | ||||||||||||||||||||||||||||||||||||
| 3591 | const QPoint &pt, const QWidget *w) const | - | ||||||||||||||||||||||||||||||||||||
| 3592 | { | - | ||||||||||||||||||||||||||||||||||||
| 3593 | return QCommonStyle::hitTestComplexControl(cc, opt, pt, w); never executed: return QCommonStyle::hitTestComplexControl(cc, opt, pt, w); | 0 | ||||||||||||||||||||||||||||||||||||
| 3594 | } | - | ||||||||||||||||||||||||||||||||||||
| 3595 | - | |||||||||||||||||||||||||||||||||||||
| 3596 | /*! | - | ||||||||||||||||||||||||||||||||||||
| 3597 | \reimp | - | ||||||||||||||||||||||||||||||||||||
| 3598 | */ | - | ||||||||||||||||||||||||||||||||||||
| 3599 | QPixmap QFusionStyle::generatedIconPixmap(QIcon::Mode iconMode, const QPixmap &pixmap, | - | ||||||||||||||||||||||||||||||||||||
| 3600 | const QStyleOption *opt) const | - | ||||||||||||||||||||||||||||||||||||
| 3601 | { | - | ||||||||||||||||||||||||||||||||||||
| 3602 | return QCommonStyle::generatedIconPixmap(iconMode, pixmap, opt); never executed: return QCommonStyle::generatedIconPixmap(iconMode, pixmap, opt); | 0 | ||||||||||||||||||||||||||||||||||||
| 3603 | } | - | ||||||||||||||||||||||||||||||||||||
| 3604 | - | |||||||||||||||||||||||||||||||||||||
| 3605 | /*! | - | ||||||||||||||||||||||||||||||||||||
| 3606 | \reimp | - | ||||||||||||||||||||||||||||||||||||
| 3607 | */ | - | ||||||||||||||||||||||||||||||||||||
| 3608 | int QFusionStyle::styleHint(StyleHint hint, const QStyleOption *option, const QWidget *widget, | - | ||||||||||||||||||||||||||||||||||||
| 3609 | QStyleHintReturn *returnData) const | - | ||||||||||||||||||||||||||||||||||||
| 3610 | { | - | ||||||||||||||||||||||||||||||||||||
| 3611 | switch (hint) { | - | ||||||||||||||||||||||||||||||||||||
| 3612 | case SH_Slider_SnapToValue: never executed: case SH_Slider_SnapToValue: | 0 | ||||||||||||||||||||||||||||||||||||
| 3613 | case SH_PrintDialog_RightAlignButtons: never executed: case SH_PrintDialog_RightAlignButtons: | 0 | ||||||||||||||||||||||||||||||||||||
| 3614 | case SH_FontDialog_SelectAssociatedText: never executed: case SH_FontDialog_SelectAssociatedText: | 0 | ||||||||||||||||||||||||||||||||||||
| 3615 | case SH_MenuBar_AltKeyNavigation: never executed: case SH_MenuBar_AltKeyNavigation: | 0 | ||||||||||||||||||||||||||||||||||||
| 3616 | case SH_ComboBox_ListMouseTracking: never executed: case SH_ComboBox_ListMouseTracking: | 0 | ||||||||||||||||||||||||||||||||||||
| 3617 | case SH_ScrollBar_StopMouseOverSlider: never executed: case SH_ScrollBar_StopMouseOverSlider: | 0 | ||||||||||||||||||||||||||||||||||||
| 3618 | case SH_ScrollBar_MiddleClickAbsolutePosition: never executed: case SH_ScrollBar_MiddleClickAbsolutePosition: | 0 | ||||||||||||||||||||||||||||||||||||
| 3619 | case SH_EtchDisabledText: never executed: case SH_EtchDisabledText: | 0 | ||||||||||||||||||||||||||||||||||||
| 3620 | case SH_TitleBar_AutoRaise: never executed: case SH_TitleBar_AutoRaise: | 0 | ||||||||||||||||||||||||||||||||||||
| 3621 | case SH_TitleBar_NoBorder: never executed: case SH_TitleBar_NoBorder: | 0 | ||||||||||||||||||||||||||||||||||||
| 3622 | case SH_ItemView_ShowDecorationSelected: never executed: case SH_ItemView_ShowDecorationSelected: | 0 | ||||||||||||||||||||||||||||||||||||
| 3623 | case SH_ItemView_ArrowKeysNavigateIntoChildren: never executed: case SH_ItemView_ArrowKeysNavigateIntoChildren: | 0 | ||||||||||||||||||||||||||||||||||||
| 3624 | case SH_ItemView_ChangeHighlightOnFocus: never executed: case SH_ItemView_ChangeHighlightOnFocus: | 0 | ||||||||||||||||||||||||||||||||||||
| 3625 | case SH_MenuBar_MouseTracking: never executed: case SH_MenuBar_MouseTracking: | 0 | ||||||||||||||||||||||||||||||||||||
| 3626 | case SH_Menu_MouseTracking: never executed: case SH_Menu_MouseTracking: | 0 | ||||||||||||||||||||||||||||||||||||
| 3627 | case SH_Menu_SupportsSections: never executed: case SH_Menu_SupportsSections: | 0 | ||||||||||||||||||||||||||||||||||||
| 3628 | return 1; never executed: return 1; | 0 | ||||||||||||||||||||||||||||||||||||
| 3629 | - | |||||||||||||||||||||||||||||||||||||
| 3630 | #if defined(Q_OS_IOS) | - | ||||||||||||||||||||||||||||||||||||
| 3631 | case SH_ComboBox_UseNativePopup: | - | ||||||||||||||||||||||||||||||||||||
| 3632 | return 1; | - | ||||||||||||||||||||||||||||||||||||
| 3633 | #endif | - | ||||||||||||||||||||||||||||||||||||
| 3634 | - | |||||||||||||||||||||||||||||||||||||
| 3635 | case SH_ToolBox_SelectedPageTitleBold: never executed: case SH_ToolBox_SelectedPageTitleBold: | 0 | ||||||||||||||||||||||||||||||||||||
| 3636 | case SH_ScrollView_FrameOnlyAroundContents: never executed: case SH_ScrollView_FrameOnlyAroundContents: | 0 | ||||||||||||||||||||||||||||||||||||
| 3637 | case SH_Menu_AllowActiveAndDisabled: never executed: case SH_Menu_AllowActiveAndDisabled: | 0 | ||||||||||||||||||||||||||||||||||||
| 3638 | case SH_MainWindow_SpaceBelowMenuBar: never executed: case SH_MainWindow_SpaceBelowMenuBar: | 0 | ||||||||||||||||||||||||||||||||||||
| 3639 | case SH_DialogButtonBox_ButtonsHaveIcons: never executed: case SH_DialogButtonBox_ButtonsHaveIcons: | 0 | ||||||||||||||||||||||||||||||||||||
| 3640 | case SH_MessageBox_CenterButtons: never executed: case SH_MessageBox_CenterButtons: | 0 | ||||||||||||||||||||||||||||||||||||
| 3641 | case SH_RubberBand_Mask: never executed: case SH_RubberBand_Mask: | 0 | ||||||||||||||||||||||||||||||||||||
| 3642 | return 0; never executed: return 0; | 0 | ||||||||||||||||||||||||||||||||||||
| 3643 | - | |||||||||||||||||||||||||||||||||||||
| 3644 | case SH_ComboBox_Popup: never executed: case SH_ComboBox_Popup: | 0 | ||||||||||||||||||||||||||||||||||||
| 3645 | if (const QStyleOptionComboBox *cmb = qstyleoption_cast<const QStyleOptionComboBox *>(option))
| 0 | ||||||||||||||||||||||||||||||||||||
| 3646 | return !cmb->editable; never executed: return !cmb->editable; | 0 | ||||||||||||||||||||||||||||||||||||
| 3647 | return 0; never executed: return 0; | 0 | ||||||||||||||||||||||||||||||||||||
| 3648 | - | |||||||||||||||||||||||||||||||||||||
| 3649 | case SH_Table_GridLineColor: never executed: case SH_Table_GridLineColor: | 0 | ||||||||||||||||||||||||||||||||||||
| 3650 | return option ? option->palette.background().color().darker(120).rgb() : 0; never executed: return option ? option->palette.background().color().darker(120).rgb() : 0;
| 0 | ||||||||||||||||||||||||||||||||||||
| 3651 | - | |||||||||||||||||||||||||||||||||||||
| 3652 | case SH_MessageBox_TextInteractionFlags: never executed: case SH_MessageBox_TextInteractionFlags: | 0 | ||||||||||||||||||||||||||||||||||||
| 3653 | return Qt::TextSelectableByMouse | Qt::LinksAccessibleByMouse; never executed: return Qt::TextSelectableByMouse | Qt::LinksAccessibleByMouse; | 0 | ||||||||||||||||||||||||||||||||||||
| 3654 | #ifndef QT_NO_WIZARD | - | ||||||||||||||||||||||||||||||||||||
| 3655 | case SH_WizardStyle: never executed: case SH_WizardStyle: | 0 | ||||||||||||||||||||||||||||||||||||
| 3656 | return QWizard::ClassicStyle; never executed: return QWizard::ClassicStyle; | 0 | ||||||||||||||||||||||||||||||||||||
| 3657 | #endif | - | ||||||||||||||||||||||||||||||||||||
| 3658 | case SH_Menu_SubMenuPopupDelay: never executed: case SH_Menu_SubMenuPopupDelay: | 0 | ||||||||||||||||||||||||||||||||||||
| 3659 | return 225; // default from GtkMenu never executed: return 225; | 0 | ||||||||||||||||||||||||||||||||||||
| 3660 | - | |||||||||||||||||||||||||||||||||||||
| 3661 | case SH_WindowFrame_Mask: never executed: case SH_WindowFrame_Mask: | 0 | ||||||||||||||||||||||||||||||||||||
| 3662 | if (QStyleHintReturnMask *mask = qstyleoption_cast<QStyleHintReturnMask *>(returnData)) {
| 0 | ||||||||||||||||||||||||||||||||||||
| 3663 | //left rounded corner | - | ||||||||||||||||||||||||||||||||||||
| 3664 | mask->region = option->rect; | - | ||||||||||||||||||||||||||||||||||||
| 3665 | mask->region -= QRect(option->rect.left(), option->rect.top(), 5, 1); | - | ||||||||||||||||||||||||||||||||||||
| 3666 | mask->region -= QRect(option->rect.left(), option->rect.top() + 1, 3, 1); | - | ||||||||||||||||||||||||||||||||||||
| 3667 | mask->region -= QRect(option->rect.left(), option->rect.top() + 2, 2, 1); | - | ||||||||||||||||||||||||||||||||||||
| 3668 | mask->region -= QRect(option->rect.left(), option->rect.top() + 3, 1, 2); | - | ||||||||||||||||||||||||||||||||||||
| 3669 | - | |||||||||||||||||||||||||||||||||||||
| 3670 | //right rounded corner | - | ||||||||||||||||||||||||||||||||||||
| 3671 | mask->region -= QRect(option->rect.right() - 4, option->rect.top(), 5, 1); | - | ||||||||||||||||||||||||||||||||||||
| 3672 | mask->region -= QRect(option->rect.right() - 2, option->rect.top() + 1, 3, 1); | - | ||||||||||||||||||||||||||||||||||||
| 3673 | mask->region -= QRect(option->rect.right() - 1, option->rect.top() + 2, 2, 1); | - | ||||||||||||||||||||||||||||||||||||
| 3674 | mask->region -= QRect(option->rect.right() , option->rect.top() + 3, 1, 2); | - | ||||||||||||||||||||||||||||||||||||
| 3675 | return 1; never executed: return 1; | 0 | ||||||||||||||||||||||||||||||||||||
| 3676 | } | - | ||||||||||||||||||||||||||||||||||||
| 3677 | default: code before this statement never executed: default:never executed: default: | 0 | ||||||||||||||||||||||||||||||||||||
| 3678 | break; never executed: break; | 0 | ||||||||||||||||||||||||||||||||||||
| 3679 | } | - | ||||||||||||||||||||||||||||||||||||
| 3680 | return QCommonStyle::styleHint(hint, option, widget, returnData); never executed: return QCommonStyle::styleHint(hint, option, widget, returnData); | 0 | ||||||||||||||||||||||||||||||||||||
| 3681 | } | - | ||||||||||||||||||||||||||||||||||||
| 3682 | - | |||||||||||||||||||||||||||||||||||||
| 3683 | /*! \reimp */ | - | ||||||||||||||||||||||||||||||||||||
| 3684 | QRect QFusionStyle::subElementRect(SubElement sr, const QStyleOption *opt, const QWidget *w) const | - | ||||||||||||||||||||||||||||||||||||
| 3685 | { | - | ||||||||||||||||||||||||||||||||||||
| 3686 | QRect r = QCommonStyle::subElementRect(sr, opt, w); | - | ||||||||||||||||||||||||||||||||||||
| 3687 | switch (sr) { | - | ||||||||||||||||||||||||||||||||||||
| 3688 | case SE_ProgressBarLabel: never executed: case SE_ProgressBarLabel: | 0 | ||||||||||||||||||||||||||||||||||||
| 3689 | case SE_ProgressBarContents: never executed: case SE_ProgressBarContents: | 0 | ||||||||||||||||||||||||||||||||||||
| 3690 | case SE_ProgressBarGroove: never executed: case SE_ProgressBarGroove: | 0 | ||||||||||||||||||||||||||||||||||||
| 3691 | return opt->rect; never executed: return opt->rect; | 0 | ||||||||||||||||||||||||||||||||||||
| 3692 | case SE_PushButtonFocusRect: never executed: case SE_PushButtonFocusRect: | 0 | ||||||||||||||||||||||||||||||||||||
| 3693 | r.adjust(0, 1, 0, -1); | - | ||||||||||||||||||||||||||||||||||||
| 3694 | break; never executed: break; | 0 | ||||||||||||||||||||||||||||||||||||
| 3695 | case SE_DockWidgetTitleBarText: { never executed: case SE_DockWidgetTitleBarText: | 0 | ||||||||||||||||||||||||||||||||||||
| 3696 | if (const QStyleOptionDockWidget *titlebar = qstyleoption_cast<const QStyleOptionDockWidget*>(opt)) {
| 0 | ||||||||||||||||||||||||||||||||||||
| 3697 | bool verticalTitleBar = titlebar->verticalTitleBar; | - | ||||||||||||||||||||||||||||||||||||
| 3698 | if (verticalTitleBar) {
| 0 | ||||||||||||||||||||||||||||||||||||
| 3699 | r.adjust(0, 0, 0, -4); | - | ||||||||||||||||||||||||||||||||||||
| 3700 | } else { never executed: end of block | 0 | ||||||||||||||||||||||||||||||||||||
| 3701 | if (opt->direction == Qt::LeftToRight)
| 0 | ||||||||||||||||||||||||||||||||||||
| 3702 | r.adjust(4, 0, 0, 0); never executed: r.adjust(4, 0, 0, 0); | 0 | ||||||||||||||||||||||||||||||||||||
| 3703 | else | - | ||||||||||||||||||||||||||||||||||||
| 3704 | r.adjust(0, 0, -4, 0); never executed: r.adjust(0, 0, -4, 0); | 0 | ||||||||||||||||||||||||||||||||||||
| 3705 | } | - | ||||||||||||||||||||||||||||||||||||
| 3706 | } | - | ||||||||||||||||||||||||||||||||||||
| 3707 | - | |||||||||||||||||||||||||||||||||||||
| 3708 | break; never executed: break; | 0 | ||||||||||||||||||||||||||||||||||||
| 3709 | } | - | ||||||||||||||||||||||||||||||||||||
| 3710 | default: never executed: default: | 0 | ||||||||||||||||||||||||||||||||||||
| 3711 | break; never executed: break; | 0 | ||||||||||||||||||||||||||||||||||||
| 3712 | } | - | ||||||||||||||||||||||||||||||||||||
| 3713 | return r; never executed: return r; | 0 | ||||||||||||||||||||||||||||||||||||
| 3714 | } | - | ||||||||||||||||||||||||||||||||||||
| 3715 | - | |||||||||||||||||||||||||||||||||||||
| 3716 | /*! | - | ||||||||||||||||||||||||||||||||||||
| 3717 | \reimp | - | ||||||||||||||||||||||||||||||||||||
| 3718 | */ | - | ||||||||||||||||||||||||||||||||||||
| 3719 | QIcon QFusionStyle::standardIcon(StandardPixmap standardIcon, const QStyleOption *option, | - | ||||||||||||||||||||||||||||||||||||
| 3720 | const QWidget *widget) const | - | ||||||||||||||||||||||||||||||||||||
| 3721 | { | - | ||||||||||||||||||||||||||||||||||||
| 3722 | return QCommonStyle::standardIcon(standardIcon, option, widget); never executed: return QCommonStyle::standardIcon(standardIcon, option, widget); | 0 | ||||||||||||||||||||||||||||||||||||
| 3723 | } | - | ||||||||||||||||||||||||||||||||||||
| 3724 | - | |||||||||||||||||||||||||||||||||||||
| 3725 | /*! | - | ||||||||||||||||||||||||||||||||||||
| 3726 | \reimp | - | ||||||||||||||||||||||||||||||||||||
| 3727 | */ | - | ||||||||||||||||||||||||||||||||||||
| 3728 | QPixmap QFusionStyle::standardPixmap(StandardPixmap standardPixmap, const QStyleOption *opt, | - | ||||||||||||||||||||||||||||||||||||
| 3729 | const QWidget *widget) const | - | ||||||||||||||||||||||||||||||||||||
| 3730 | { | - | ||||||||||||||||||||||||||||||||||||
| 3731 | #ifndef QT_NO_IMAGEFORMAT_XPM | - | ||||||||||||||||||||||||||||||||||||
| 3732 | switch (standardPixmap) { | - | ||||||||||||||||||||||||||||||||||||
| 3733 | case SP_TitleBarNormalButton: never executed: case SP_TitleBarNormalButton: | 0 | ||||||||||||||||||||||||||||||||||||
| 3734 | return QPixmap(dock_widget_restore_xpm); never executed: return QPixmap(dock_widget_restore_xpm); | 0 | ||||||||||||||||||||||||||||||||||||
| 3735 | case SP_TitleBarMinButton: never executed: case SP_TitleBarMinButton: | 0 | ||||||||||||||||||||||||||||||||||||
| 3736 | return QPixmap(workspace_minimize); never executed: return QPixmap(workspace_minimize); | 0 | ||||||||||||||||||||||||||||||||||||
| 3737 | case SP_TitleBarCloseButton: never executed: case SP_TitleBarCloseButton: | 0 | ||||||||||||||||||||||||||||||||||||
| 3738 | case SP_DockWidgetCloseButton: never executed: case SP_DockWidgetCloseButton: | 0 | ||||||||||||||||||||||||||||||||||||
| 3739 | return QPixmap(dock_widget_close_xpm); never executed: return QPixmap(dock_widget_close_xpm); | 0 | ||||||||||||||||||||||||||||||||||||
| 3740 | - | |||||||||||||||||||||||||||||||||||||
| 3741 | default: never executed: default: | 0 | ||||||||||||||||||||||||||||||||||||
| 3742 | break; never executed: break; | 0 | ||||||||||||||||||||||||||||||||||||
| 3743 | } | - | ||||||||||||||||||||||||||||||||||||
| 3744 | #endif //QT_NO_IMAGEFORMAT_XPM | - | ||||||||||||||||||||||||||||||||||||
| 3745 | - | |||||||||||||||||||||||||||||||||||||
| 3746 | return QCommonStyle::standardPixmap(standardPixmap, opt, widget); never executed: return QCommonStyle::standardPixmap(standardPixmap, opt, widget); | 0 | ||||||||||||||||||||||||||||||||||||
| 3747 | } | - | ||||||||||||||||||||||||||||||||||||
| 3748 | - | |||||||||||||||||||||||||||||||||||||
| 3749 | QT_END_NAMESPACE | - | ||||||||||||||||||||||||||||||||||||
| 3750 | - | |||||||||||||||||||||||||||||||||||||
| 3751 | #include "moc_qfusionstyle_p.cpp" | - | ||||||||||||||||||||||||||||||||||||
| 3752 | - | |||||||||||||||||||||||||||||||||||||
| 3753 | #endif // QT_NO_STYLE_FUSION || QT_PLUGIN | - | ||||||||||||||||||||||||||||||||||||
| Source code | Switch to Preprocessed file |