| 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) 2016 The Qt Company Ltd. | - | ||||||||||||||||||||||||||||||||||||
| 4 | ** Contact: https://www.qt.io/licensing/ | - | ||||||||||||||||||||||||||||||||||||
| 5 | ** | - | ||||||||||||||||||||||||||||||||||||
| 6 | ** This file is part of the QtWidgets module of the Qt Toolkit. | - | ||||||||||||||||||||||||||||||||||||
| 7 | ** | - | ||||||||||||||||||||||||||||||||||||
| 8 | ** $QT_BEGIN_LICENSE:LGPL$ | - | ||||||||||||||||||||||||||||||||||||
| 9 | ** Commercial License Usage | - | ||||||||||||||||||||||||||||||||||||
| 10 | ** Licensees holding valid commercial Qt licenses may use this file in | - | ||||||||||||||||||||||||||||||||||||
| 11 | ** accordance with the commercial license agreement provided with the | - | ||||||||||||||||||||||||||||||||||||
| 12 | ** Software or, alternatively, in accordance with the terms contained in | - | ||||||||||||||||||||||||||||||||||||
| 13 | ** a written agreement between you and The Qt Company. For licensing terms | - | ||||||||||||||||||||||||||||||||||||
| 14 | ** and conditions see https://www.qt.io/terms-conditions. For further | - | ||||||||||||||||||||||||||||||||||||
| 15 | ** information use the contact form at https://www.qt.io/contact-us. | - | ||||||||||||||||||||||||||||||||||||
| 16 | ** | - | ||||||||||||||||||||||||||||||||||||
| 17 | ** GNU Lesser General Public License Usage | - | ||||||||||||||||||||||||||||||||||||
| 18 | ** Alternatively, this file may be used under the terms of the GNU Lesser | - | ||||||||||||||||||||||||||||||||||||
| 19 | ** General Public License version 3 as published by the Free Software | - | ||||||||||||||||||||||||||||||||||||
| 20 | ** Foundation and appearing in the file LICENSE.LGPL3 included in the | - | ||||||||||||||||||||||||||||||||||||
| 21 | ** packaging of this file. Please review the following information to | - | ||||||||||||||||||||||||||||||||||||
| 22 | ** ensure the GNU Lesser General Public License version 3 requirements | - | ||||||||||||||||||||||||||||||||||||
| 23 | ** will be met: https://www.gnu.org/licenses/lgpl-3.0.html. | - | ||||||||||||||||||||||||||||||||||||
| 24 | ** | - | ||||||||||||||||||||||||||||||||||||
| 25 | ** GNU General Public License Usage | - | ||||||||||||||||||||||||||||||||||||
| 26 | ** Alternatively, this file may be used under the terms of the GNU | - | ||||||||||||||||||||||||||||||||||||
| 27 | ** General Public License version 2.0 or (at your option) the GNU General | - | ||||||||||||||||||||||||||||||||||||
| 28 | ** Public license version 3 or any later version approved by the KDE Free | - | ||||||||||||||||||||||||||||||||||||
| 29 | ** Qt Foundation. The licenses are as published by the Free Software | - | ||||||||||||||||||||||||||||||||||||
| 30 | ** Foundation and appearing in the file LICENSE.GPL2 and LICENSE.GPL3 | - | ||||||||||||||||||||||||||||||||||||
| 31 | ** included in the packaging of this file. Please review the following | - | ||||||||||||||||||||||||||||||||||||
| 32 | ** information to ensure the GNU General Public License requirements will | - | ||||||||||||||||||||||||||||||||||||
| 33 | ** be met: https://www.gnu.org/licenses/gpl-2.0.html and | - | ||||||||||||||||||||||||||||||||||||
| 34 | ** https://www.gnu.org/licenses/gpl-3.0.html. | - | ||||||||||||||||||||||||||||||||||||
| 35 | ** | - | ||||||||||||||||||||||||||||||||||||
| 36 | ** $QT_END_LICENSE$ | - | ||||||||||||||||||||||||||||||||||||
| 37 | ** | - | ||||||||||||||||||||||||||||||||||||
| 38 | ****************************************************************************/ | - | ||||||||||||||||||||||||||||||||||||
| 39 | - | |||||||||||||||||||||||||||||||||||||
| 40 | #include "qfusionstyle_p.h" | - | ||||||||||||||||||||||||||||||||||||
| 41 | #include "qfusionstyle_p_p.h" | - | ||||||||||||||||||||||||||||||||||||
| 42 | - | |||||||||||||||||||||||||||||||||||||
| 43 | #if !defined(QT_NO_STYLE_FUSION) || defined(QT_PLUGIN) | - | ||||||||||||||||||||||||||||||||||||
| 44 | #include "qcommonstyle_p.h" | - | ||||||||||||||||||||||||||||||||||||
| 45 | #include <qcombobox.h> | - | ||||||||||||||||||||||||||||||||||||
| 46 | #include <qpushbutton.h> | - | ||||||||||||||||||||||||||||||||||||
| 47 | #include <qpainter.h> | - | ||||||||||||||||||||||||||||||||||||
| 48 | #include <qdir.h> | - | ||||||||||||||||||||||||||||||||||||
| 49 | #include <qstyleoption.h> | - | ||||||||||||||||||||||||||||||||||||
| 50 | #include <qapplication.h> | - | ||||||||||||||||||||||||||||||||||||
| 51 | #include <qmainwindow.h> | - | ||||||||||||||||||||||||||||||||||||
| 52 | #include <qfont.h> | - | ||||||||||||||||||||||||||||||||||||
| 53 | #include <qgroupbox.h> | - | ||||||||||||||||||||||||||||||||||||
| 54 | #include <qprocess.h> | - | ||||||||||||||||||||||||||||||||||||
| 55 | #include <qpixmapcache.h> | - | ||||||||||||||||||||||||||||||||||||
| 56 | #include <qdialogbuttonbox.h> | - | ||||||||||||||||||||||||||||||||||||
| 57 | #include <qscrollbar.h> | - | ||||||||||||||||||||||||||||||||||||
| 58 | #include <qspinbox.h> | - | ||||||||||||||||||||||||||||||||||||
| 59 | #include <qslider.h> | - | ||||||||||||||||||||||||||||||||||||
| 60 | #include <qsplitter.h> | - | ||||||||||||||||||||||||||||||||||||
| 61 | #include <qprogressbar.h> | - | ||||||||||||||||||||||||||||||||||||
| 62 | #include <qwizard.h> | - | ||||||||||||||||||||||||||||||||||||
| 63 | #include <qlibrary.h> | - | ||||||||||||||||||||||||||||||||||||
| 64 | #include <qdrawutil.h> | - | ||||||||||||||||||||||||||||||||||||
| 65 | #include <private/qstylehelper_p.h> | - | ||||||||||||||||||||||||||||||||||||
| 66 | #include <private/qdrawhelper_p.h> | - | ||||||||||||||||||||||||||||||||||||
| 67 | #include <private/qapplication_p.h> | - | ||||||||||||||||||||||||||||||||||||
| 68 | - | |||||||||||||||||||||||||||||||||||||
| 69 | QT_BEGIN_NAMESPACE | - | ||||||||||||||||||||||||||||||||||||
| 70 | - | |||||||||||||||||||||||||||||||||||||
| 71 | using namespace QStyleHelper; | - | ||||||||||||||||||||||||||||||||||||
| 72 | - | |||||||||||||||||||||||||||||||||||||
| 73 | enum Direction { | - | ||||||||||||||||||||||||||||||||||||
| 74 | TopDown, | - | ||||||||||||||||||||||||||||||||||||
| 75 | FromLeft, | - | ||||||||||||||||||||||||||||||||||||
| 76 | BottomUp, | - | ||||||||||||||||||||||||||||||||||||
| 77 | FromRight | - | ||||||||||||||||||||||||||||||||||||
| 78 | }; | - | ||||||||||||||||||||||||||||||||||||
| 79 | - | |||||||||||||||||||||||||||||||||||||
| 80 | // from windows style | - | ||||||||||||||||||||||||||||||||||||
| 81 | static const int windowsItemFrame = 2; // menu item frame width | - | ||||||||||||||||||||||||||||||||||||
| 82 | static const int windowsItemHMargin = 3; // menu item hor text margin | - | ||||||||||||||||||||||||||||||||||||
| 83 | static const int windowsItemVMargin = 8; // menu item ver text margin | - | ||||||||||||||||||||||||||||||||||||
| 84 | static const int windowsRightBorder = 15; // right border on windows | - | ||||||||||||||||||||||||||||||||||||
| 85 | - | |||||||||||||||||||||||||||||||||||||
| 86 | static const int groupBoxBottomMargin = 0; // space below the groupbox | - | ||||||||||||||||||||||||||||||||||||
| 87 | static const int groupBoxTopMargin = 3; | - | ||||||||||||||||||||||||||||||||||||
| 88 | - | |||||||||||||||||||||||||||||||||||||
| 89 | - | |||||||||||||||||||||||||||||||||||||
| 90 | /* XPM */ | - | ||||||||||||||||||||||||||||||||||||
| 91 | static const char * const dock_widget_close_xpm[] = { | - | ||||||||||||||||||||||||||||||||||||
| 92 | "11 13 7 1", | - | ||||||||||||||||||||||||||||||||||||
| 93 | " c None", | - | ||||||||||||||||||||||||||||||||||||
| 94 | ". c #D5CFCB", | - | ||||||||||||||||||||||||||||||||||||
| 95 | "+ c #8F8B88", | - | ||||||||||||||||||||||||||||||||||||
| 96 | "@ c #6C6A67", | - | ||||||||||||||||||||||||||||||||||||
| 97 | "# c #ABA6A3", | - | ||||||||||||||||||||||||||||||||||||
| 98 | "$ c #B5B0AC", | - | ||||||||||||||||||||||||||||||||||||
| 99 | "% c #A4A09D", | - | ||||||||||||||||||||||||||||||||||||
| 100 | " ", | - | ||||||||||||||||||||||||||||||||||||
| 101 | " +@@@@@@@+ ", | - | ||||||||||||||||||||||||||||||||||||
| 102 | "+# #+", | - | ||||||||||||||||||||||||||||||||||||
| 103 | "@ $@ @$ @", | - | ||||||||||||||||||||||||||||||||||||
| 104 | "@ @@@ @@@ @", | - | ||||||||||||||||||||||||||||||||||||
| 105 | "@ @@@@@ @", | - | ||||||||||||||||||||||||||||||||||||
| 106 | "@ @@@ @", | - | ||||||||||||||||||||||||||||||||||||
| 107 | "@ @@@@@ @", | - | ||||||||||||||||||||||||||||||||||||
| 108 | "@ @@@ @@@ @", | - | ||||||||||||||||||||||||||||||||||||
| 109 | "@ $@ @$ @", | - | ||||||||||||||||||||||||||||||||||||
| 110 | "+% #+", | - | ||||||||||||||||||||||||||||||||||||
| 111 | " +@@@@@@@+ ", | - | ||||||||||||||||||||||||||||||||||||
| 112 | " "}; | - | ||||||||||||||||||||||||||||||||||||
| 113 | - | |||||||||||||||||||||||||||||||||||||
| 114 | static const char * const dock_widget_restore_xpm[] = { | - | ||||||||||||||||||||||||||||||||||||
| 115 | "11 13 7 1", | - | ||||||||||||||||||||||||||||||||||||
| 116 | " c None", | - | ||||||||||||||||||||||||||||||||||||
| 117 | ". c #D5CFCB", | - | ||||||||||||||||||||||||||||||||||||
| 118 | "+ c #8F8B88", | - | ||||||||||||||||||||||||||||||||||||
| 119 | "@ c #6C6A67", | - | ||||||||||||||||||||||||||||||||||||
| 120 | "# c #ABA6A3", | - | ||||||||||||||||||||||||||||||||||||
| 121 | "$ c #B5B0AC", | - | ||||||||||||||||||||||||||||||||||||
| 122 | "% c #A4A09D", | - | ||||||||||||||||||||||||||||||||||||
| 123 | " ", | - | ||||||||||||||||||||||||||||||||||||
| 124 | " +@@@@@@@+ ", | - | ||||||||||||||||||||||||||||||||||||
| 125 | "+# #+", | - | ||||||||||||||||||||||||||||||||||||
| 126 | "@ #@@@# @", | - | ||||||||||||||||||||||||||||||||||||
| 127 | "@ @ @ @", | - | ||||||||||||||||||||||||||||||||||||
| 128 | "@ #@@@# @ @", | - | ||||||||||||||||||||||||||||||||||||
| 129 | "@ @ @ @ @", | - | ||||||||||||||||||||||||||||||||||||
| 130 | "@ @ @@@ @", | - | ||||||||||||||||||||||||||||||||||||
| 131 | "@ @ @ @", | - | ||||||||||||||||||||||||||||||||||||
| 132 | "@ #@@@# @", | - | ||||||||||||||||||||||||||||||||||||
| 133 | "+% #+", | - | ||||||||||||||||||||||||||||||||||||
| 134 | " +@@@@@@@+ ", | - | ||||||||||||||||||||||||||||||||||||
| 135 | " "}; | - | ||||||||||||||||||||||||||||||||||||
| 136 | - | |||||||||||||||||||||||||||||||||||||
| 137 | static const char * const workspace_minimize[] = { | - | ||||||||||||||||||||||||||||||||||||
| 138 | "11 13 7 1", | - | ||||||||||||||||||||||||||||||||||||
| 139 | " c None", | - | ||||||||||||||||||||||||||||||||||||
| 140 | ". c #D5CFCB", | - | ||||||||||||||||||||||||||||||||||||
| 141 | "+ c #8F8B88", | - | ||||||||||||||||||||||||||||||||||||
| 142 | "@ c #6C6A67", | - | ||||||||||||||||||||||||||||||||||||
| 143 | "# c #ABA6A3", | - | ||||||||||||||||||||||||||||||||||||
| 144 | "$ c #B5B0AC", | - | ||||||||||||||||||||||||||||||||||||
| 145 | "% c #A4A09D", | - | ||||||||||||||||||||||||||||||||||||
| 146 | " ", | - | ||||||||||||||||||||||||||||||||||||
| 147 | " +@@@@@@@+ ", | - | ||||||||||||||||||||||||||||||||||||
| 148 | "+# #+", | - | ||||||||||||||||||||||||||||||||||||
| 149 | "@ @", | - | ||||||||||||||||||||||||||||||||||||
| 150 | "@ @", | - | ||||||||||||||||||||||||||||||||||||
| 151 | "@ @", | - | ||||||||||||||||||||||||||||||||||||
| 152 | "@ @@@@@@@ @", | - | ||||||||||||||||||||||||||||||||||||
| 153 | "@ @@@@@@@ @", | - | ||||||||||||||||||||||||||||||||||||
| 154 | "@ @", | - | ||||||||||||||||||||||||||||||||||||
| 155 | "@ @", | - | ||||||||||||||||||||||||||||||||||||
| 156 | "+% #+", | - | ||||||||||||||||||||||||||||||||||||
| 157 | " +@@@@@@@+ ", | - | ||||||||||||||||||||||||||||||||||||
| 158 | " "}; | - | ||||||||||||||||||||||||||||||||||||
| 159 | - | |||||||||||||||||||||||||||||||||||||
| 160 | - | |||||||||||||||||||||||||||||||||||||
| 161 | static const char * const qt_titlebar_context_help[] = { | - | ||||||||||||||||||||||||||||||||||||
| 162 | "10 10 3 1", | - | ||||||||||||||||||||||||||||||||||||
| 163 | " c None", | - | ||||||||||||||||||||||||||||||||||||
| 164 | "# c #000000", | - | ||||||||||||||||||||||||||||||||||||
| 165 | "+ c #444444", | - | ||||||||||||||||||||||||||||||||||||
| 166 | " +####+ ", | - | ||||||||||||||||||||||||||||||||||||
| 167 | " ### ### ", | - | ||||||||||||||||||||||||||||||||||||
| 168 | " ## ## ", | - | ||||||||||||||||||||||||||||||||||||
| 169 | " +##+ ", | - | ||||||||||||||||||||||||||||||||||||
| 170 | " +## ", | - | ||||||||||||||||||||||||||||||||||||
| 171 | " ## ", | - | ||||||||||||||||||||||||||||||||||||
| 172 | " ## ", | - | ||||||||||||||||||||||||||||||||||||
| 173 | " ", | - | ||||||||||||||||||||||||||||||||||||
| 174 | " ## ", | - | ||||||||||||||||||||||||||||||||||||
| 175 | " ## "}; | - | ||||||||||||||||||||||||||||||||||||
| 176 | - | |||||||||||||||||||||||||||||||||||||
| 177 | - | |||||||||||||||||||||||||||||||||||||
| 178 | static QColor mergedColors(const QColor &colorA, const QColor &colorB, int factor = 50) | - | ||||||||||||||||||||||||||||||||||||
| 179 | { | - | ||||||||||||||||||||||||||||||||||||
| 180 | const int maxFactor = 100; | - | ||||||||||||||||||||||||||||||||||||
| 181 | QColor tmp = colorA; | - | ||||||||||||||||||||||||||||||||||||
| 182 | tmp.setRed((tmp.red() * factor) / maxFactor + (colorB.red() * (maxFactor - factor)) / maxFactor); | - | ||||||||||||||||||||||||||||||||||||
| 183 | tmp.setGreen((tmp.green() * factor) / maxFactor + (colorB.green() * (maxFactor - factor)) / maxFactor); | - | ||||||||||||||||||||||||||||||||||||
| 184 | tmp.setBlue((tmp.blue() * factor) / maxFactor + (colorB.blue() * (maxFactor - factor)) / maxFactor); | - | ||||||||||||||||||||||||||||||||||||
| 185 | return tmp; never executed: return tmp; | 0 | ||||||||||||||||||||||||||||||||||||
| 186 | } | - | ||||||||||||||||||||||||||||||||||||
| 187 | - | |||||||||||||||||||||||||||||||||||||
| 188 | static QPixmap colorizedImage(const QString &fileName, const QColor &color, int rotation = 0) { | - | ||||||||||||||||||||||||||||||||||||
| 189 | - | |||||||||||||||||||||||||||||||||||||
| 190 | QString pixmapName = QLatin1String("$qt_ia-") % fileName % HexString<uint>(color.rgba()) % QString::number(rotation); | - | ||||||||||||||||||||||||||||||||||||
| 191 | QPixmap pixmap; | - | ||||||||||||||||||||||||||||||||||||
| 192 | if (!QPixmapCache::find(pixmapName, pixmap)) {
| 0 | ||||||||||||||||||||||||||||||||||||
| 193 | QImage image(fileName); | - | ||||||||||||||||||||||||||||||||||||
| 194 | - | |||||||||||||||||||||||||||||||||||||
| 195 | if (image.format() != QImage::Format_ARGB32_Premultiplied)
| 0 | ||||||||||||||||||||||||||||||||||||
| 196 | image = image.convertToFormat( QImage::Format_ARGB32_Premultiplied); never executed: image = image.convertToFormat( QImage::Format_ARGB32_Premultiplied); | 0 | ||||||||||||||||||||||||||||||||||||
| 197 | - | |||||||||||||||||||||||||||||||||||||
| 198 | int width = image.width(); | - | ||||||||||||||||||||||||||||||||||||
| 199 | int height = image.height(); | - | ||||||||||||||||||||||||||||||||||||
| 200 | int source = color.rgba(); | - | ||||||||||||||||||||||||||||||||||||
| 201 | - | |||||||||||||||||||||||||||||||||||||
| 202 | unsigned char sourceRed = qRed(source); | - | ||||||||||||||||||||||||||||||||||||
| 203 | unsigned char sourceGreen = qGreen(source); | - | ||||||||||||||||||||||||||||||||||||
| 204 | unsigned char sourceBlue = qBlue(source); | - | ||||||||||||||||||||||||||||||||||||
| 205 | - | |||||||||||||||||||||||||||||||||||||
| 206 | for (int y = 0; y < height; ++y)
| 0 | ||||||||||||||||||||||||||||||||||||
| 207 | { | - | ||||||||||||||||||||||||||||||||||||
| 208 | QRgb *data = (QRgb*) image.scanLine(y); | - | ||||||||||||||||||||||||||||||||||||
| 209 | for (int x = 0 ; x < width ; x++) {
| 0 | ||||||||||||||||||||||||||||||||||||
| 210 | QRgb col = data[x]; | - | ||||||||||||||||||||||||||||||||||||
| 211 | unsigned int colorDiff = (qBlue(col) - qRed(col)); | - | ||||||||||||||||||||||||||||||||||||
| 212 | unsigned char gray = qGreen(col); | - | ||||||||||||||||||||||||||||||||||||
| 213 | unsigned char red = gray + qt_div_255(sourceRed * colorDiff); | - | ||||||||||||||||||||||||||||||||||||
| 214 | unsigned char green = gray + qt_div_255(sourceGreen * colorDiff); | - | ||||||||||||||||||||||||||||||||||||
| 215 | unsigned char blue = gray + qt_div_255(sourceBlue * colorDiff); | - | ||||||||||||||||||||||||||||||||||||
| 216 | unsigned char alpha = qt_div_255(qAlpha(col) * qAlpha(source)); | - | ||||||||||||||||||||||||||||||||||||
| 217 | data[x] = qRgba(std::min(alpha, red), | - | ||||||||||||||||||||||||||||||||||||
| 218 | std::min(alpha, green), | - | ||||||||||||||||||||||||||||||||||||
| 219 | std::min(alpha, blue), | - | ||||||||||||||||||||||||||||||||||||
| 220 | alpha); | - | ||||||||||||||||||||||||||||||||||||
| 221 | } never executed: end of block | 0 | ||||||||||||||||||||||||||||||||||||
| 222 | } never executed: end of block | 0 | ||||||||||||||||||||||||||||||||||||
| 223 | if (rotation != 0) {
| 0 | ||||||||||||||||||||||||||||||||||||
| 224 | QTransform transform; | - | ||||||||||||||||||||||||||||||||||||
| 225 | transform.translate(-image.width()/2, -image.height()/2); | - | ||||||||||||||||||||||||||||||||||||
| 226 | transform.rotate(rotation); | - | ||||||||||||||||||||||||||||||||||||
| 227 | transform.translate(image.width()/2, image.height()/2); | - | ||||||||||||||||||||||||||||||||||||
| 228 | image = image.transformed(transform); | - | ||||||||||||||||||||||||||||||||||||
| 229 | } never executed: end of block | 0 | ||||||||||||||||||||||||||||||||||||
| 230 | - | |||||||||||||||||||||||||||||||||||||
| 231 | pixmap = QPixmap::fromImage(image); | - | ||||||||||||||||||||||||||||||||||||
| 232 | QPixmapCache::insert(pixmapName, pixmap); | - | ||||||||||||||||||||||||||||||||||||
| 233 | } never executed: end of block | 0 | ||||||||||||||||||||||||||||||||||||
| 234 | return pixmap; never executed: return pixmap; | 0 | ||||||||||||||||||||||||||||||||||||
| 235 | } | - | ||||||||||||||||||||||||||||||||||||
| 236 | - | |||||||||||||||||||||||||||||||||||||
| 237 | // The default button and handle gradient | - | ||||||||||||||||||||||||||||||||||||
| 238 | static QLinearGradient qt_fusion_gradient(const QRect &rect, const QBrush &baseColor, Direction direction = TopDown) | - | ||||||||||||||||||||||||||||||||||||
| 239 | { | - | ||||||||||||||||||||||||||||||||||||
| 240 | int x = rect.center().x(); | - | ||||||||||||||||||||||||||||||||||||
| 241 | int y = rect.center().y(); | - | ||||||||||||||||||||||||||||||||||||
| 242 | QLinearGradient gradient; | - | ||||||||||||||||||||||||||||||||||||
| 243 | switch (direction) { | - | ||||||||||||||||||||||||||||||||||||
| 244 | case FromLeft: never executed: case FromLeft: | 0 | ||||||||||||||||||||||||||||||||||||
| 245 | gradient = QLinearGradient(rect.left(), y, rect.right(), y); | - | ||||||||||||||||||||||||||||||||||||
| 246 | break; never executed: break; | 0 | ||||||||||||||||||||||||||||||||||||
| 247 | case FromRight: never executed: case FromRight: | 0 | ||||||||||||||||||||||||||||||||||||
| 248 | gradient = QLinearGradient(rect.right(), y, rect.left(), y); | - | ||||||||||||||||||||||||||||||||||||
| 249 | break; never executed: break; | 0 | ||||||||||||||||||||||||||||||||||||
| 250 | case BottomUp: never executed: case BottomUp: | 0 | ||||||||||||||||||||||||||||||||||||
| 251 | gradient = QLinearGradient(x, rect.bottom(), x, rect.top()); | - | ||||||||||||||||||||||||||||||||||||
| 252 | break; never executed: break; | 0 | ||||||||||||||||||||||||||||||||||||
| 253 | case TopDown: never executed: case TopDown: | 0 | ||||||||||||||||||||||||||||||||||||
| 254 | default: never executed: default: | 0 | ||||||||||||||||||||||||||||||||||||
| 255 | gradient = QLinearGradient(x, rect.top(), x, rect.bottom()); | - | ||||||||||||||||||||||||||||||||||||
| 256 | break; never executed: break; | 0 | ||||||||||||||||||||||||||||||||||||
| 257 | } | - | ||||||||||||||||||||||||||||||||||||
| 258 | if (baseColor.gradient())
| 0 | ||||||||||||||||||||||||||||||||||||
| 259 | gradient.setStops(baseColor.gradient()->stops()); never executed: gradient.setStops(baseColor.gradient()->stops()); | 0 | ||||||||||||||||||||||||||||||||||||
| 260 | else { | - | ||||||||||||||||||||||||||||||||||||
| 261 | QColor gradientStartColor = baseColor.color().lighter(124); | - | ||||||||||||||||||||||||||||||||||||
| 262 | QColor gradientStopColor = baseColor.color().lighter(102); | - | ||||||||||||||||||||||||||||||||||||
| 263 | gradient.setColorAt(0, gradientStartColor); | - | ||||||||||||||||||||||||||||||||||||
| 264 | gradient.setColorAt(1, gradientStopColor); | - | ||||||||||||||||||||||||||||||||||||
| 265 | // Uncomment for adding shiny shading | - | ||||||||||||||||||||||||||||||||||||
| 266 | // QColor midColor1 = mergedColors(gradientStartColor, gradientStopColor, 55); | - | ||||||||||||||||||||||||||||||||||||
| 267 | // QColor midColor2 = mergedColors(gradientStartColor, gradientStopColor, 45); | - | ||||||||||||||||||||||||||||||||||||
| 268 | // gradient.setColorAt(0.5, midColor1); | - | ||||||||||||||||||||||||||||||||||||
| 269 | // gradient.setColorAt(0.501, midColor2); | - | ||||||||||||||||||||||||||||||||||||
| 270 | } never executed: end of block | 0 | ||||||||||||||||||||||||||||||||||||
| 271 | return gradient; never executed: return gradient; | 0 | ||||||||||||||||||||||||||||||||||||
| 272 | } | - | ||||||||||||||||||||||||||||||||||||
| 273 | - | |||||||||||||||||||||||||||||||||||||
| 274 | - | |||||||||||||||||||||||||||||||||||||
| 275 | static void qt_fusion_draw_mdibutton(QPainter *painter, const QStyleOptionTitleBar *option, const QRect &tmp, bool hover, bool sunken) | - | ||||||||||||||||||||||||||||||||||||
| 276 | { | - | ||||||||||||||||||||||||||||||||||||
| 277 | QColor dark; | - | ||||||||||||||||||||||||||||||||||||
| 278 | dark.setHsv(option->palette.button().color().hue(), | - | ||||||||||||||||||||||||||||||||||||
| 279 | qMin(255, (int)(option->palette.button().color().saturation())), | - | ||||||||||||||||||||||||||||||||||||
| 280 | qMin(255, (int)(option->palette.button().color().value()*0.7))); | - | ||||||||||||||||||||||||||||||||||||
| 281 | - | |||||||||||||||||||||||||||||||||||||
| 282 | QColor highlight = option->palette.highlight().color(); | - | ||||||||||||||||||||||||||||||||||||
| 283 | - | |||||||||||||||||||||||||||||||||||||
| 284 | bool active = (option->titleBarState & QStyle::State_Active); | - | ||||||||||||||||||||||||||||||||||||
| 285 | QColor titleBarHighlight(255, 255, 255, 60); | - | ||||||||||||||||||||||||||||||||||||
| 286 | - | |||||||||||||||||||||||||||||||||||||
| 287 | if (sunken)
| 0 | ||||||||||||||||||||||||||||||||||||
| 288 | 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 | ||||||||||||||||||||||||||||||||||||
| 289 | else if (hover)
| 0 | ||||||||||||||||||||||||||||||||||||
| 290 | 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 | ||||||||||||||||||||||||||||||||||||
| 291 | - | |||||||||||||||||||||||||||||||||||||
| 292 | QColor mdiButtonGradientStartColor; | - | ||||||||||||||||||||||||||||||||||||
| 293 | QColor mdiButtonGradientStopColor; | - | ||||||||||||||||||||||||||||||||||||
| 294 | - | |||||||||||||||||||||||||||||||||||||
| 295 | mdiButtonGradientStartColor = QColor(0, 0, 0, 40); | - | ||||||||||||||||||||||||||||||||||||
| 296 | mdiButtonGradientStopColor = QColor(255, 255, 255, 60); | - | ||||||||||||||||||||||||||||||||||||
| 297 | - | |||||||||||||||||||||||||||||||||||||
| 298 | if (sunken)
| 0 | ||||||||||||||||||||||||||||||||||||
| 299 | titleBarHighlight = highlight.darker(130); never executed: titleBarHighlight = highlight.darker(130); | 0 | ||||||||||||||||||||||||||||||||||||
| 300 | - | |||||||||||||||||||||||||||||||||||||
| 301 | QLinearGradient gradient(tmp.center().x(), tmp.top(), tmp.center().x(), tmp.bottom()); | - | ||||||||||||||||||||||||||||||||||||
| 302 | gradient.setColorAt(0, mdiButtonGradientStartColor); | - | ||||||||||||||||||||||||||||||||||||
| 303 | gradient.setColorAt(1, mdiButtonGradientStopColor); | - | ||||||||||||||||||||||||||||||||||||
| 304 | QColor mdiButtonBorderColor(active ? option->palette.highlight().color().darker(180): dark.darker(110)); | - | ||||||||||||||||||||||||||||||||||||
| 305 | - | |||||||||||||||||||||||||||||||||||||
| 306 | painter->setPen(QPen(mdiButtonBorderColor)); | - | ||||||||||||||||||||||||||||||||||||
| 307 | const QLine lines[4] = { | - | ||||||||||||||||||||||||||||||||||||
| 308 | QLine(tmp.left() + 2, tmp.top(), tmp.right() - 2, tmp.top()), | - | ||||||||||||||||||||||||||||||||||||
| 309 | QLine(tmp.left() + 2, tmp.bottom(), tmp.right() - 2, tmp.bottom()), | - | ||||||||||||||||||||||||||||||||||||
| 310 | QLine(tmp.left(), tmp.top() + 2, tmp.left(), tmp.bottom() - 2), | - | ||||||||||||||||||||||||||||||||||||
| 311 | QLine(tmp.right(), tmp.top() + 2, tmp.right(), tmp.bottom() - 2) | - | ||||||||||||||||||||||||||||||||||||
| 312 | }; | - | ||||||||||||||||||||||||||||||||||||
| 313 | painter->drawLines(lines, 4); | - | ||||||||||||||||||||||||||||||||||||
| 314 | const QPoint points[4] = { | - | ||||||||||||||||||||||||||||||||||||
| 315 | QPoint(tmp.left() + 1, tmp.top() + 1), | - | ||||||||||||||||||||||||||||||||||||
| 316 | QPoint(tmp.right() - 1, tmp.top() + 1), | - | ||||||||||||||||||||||||||||||||||||
| 317 | QPoint(tmp.left() + 1, tmp.bottom() - 1), | - | ||||||||||||||||||||||||||||||||||||
| 318 | QPoint(tmp.right() - 1, tmp.bottom() - 1) | - | ||||||||||||||||||||||||||||||||||||
| 319 | }; | - | ||||||||||||||||||||||||||||||||||||
| 320 | painter->drawPoints(points, 4); | - | ||||||||||||||||||||||||||||||||||||
| 321 | - | |||||||||||||||||||||||||||||||||||||
| 322 | painter->setPen(titleBarHighlight); | - | ||||||||||||||||||||||||||||||||||||
| 323 | painter->drawLine(tmp.left() + 2, tmp.top() + 1, tmp.right() - 2, tmp.top() + 1); | - | ||||||||||||||||||||||||||||||||||||
| 324 | painter->drawLine(tmp.left() + 1, tmp.top() + 2, tmp.left() + 1, tmp.bottom() - 2); | - | ||||||||||||||||||||||||||||||||||||
| 325 | - | |||||||||||||||||||||||||||||||||||||
| 326 | painter->setPen(QPen(gradient, 1)); | - | ||||||||||||||||||||||||||||||||||||
| 327 | painter->drawLine(tmp.right() + 1, tmp.top() + 2, tmp.right() + 1, tmp.bottom() - 2); | - | ||||||||||||||||||||||||||||||||||||
| 328 | painter->drawPoint(tmp.right() , tmp.top() + 1); | - | ||||||||||||||||||||||||||||||||||||
| 329 | - | |||||||||||||||||||||||||||||||||||||
| 330 | painter->drawLine(tmp.left() + 2, tmp.bottom() + 1, tmp.right() - 2, tmp.bottom() + 1); | - | ||||||||||||||||||||||||||||||||||||
| 331 | painter->drawPoint(tmp.left() + 1, tmp.bottom()); | - | ||||||||||||||||||||||||||||||||||||
| 332 | painter->drawPoint(tmp.right() - 1, tmp.bottom()); | - | ||||||||||||||||||||||||||||||||||||
| 333 | painter->drawPoint(tmp.right() , tmp.bottom() - 1); | - | ||||||||||||||||||||||||||||||||||||
| 334 | } never executed: end of block | 0 | ||||||||||||||||||||||||||||||||||||
| 335 | - | |||||||||||||||||||||||||||||||||||||
| 336 | /* | - | ||||||||||||||||||||||||||||||||||||
| 337 | \internal | - | ||||||||||||||||||||||||||||||||||||
| 338 | */ | - | ||||||||||||||||||||||||||||||||||||
| 339 | QFusionStylePrivate::QFusionStylePrivate() | - | ||||||||||||||||||||||||||||||||||||
| 340 | { | - | ||||||||||||||||||||||||||||||||||||
| 341 | animationFps = 60; | - | ||||||||||||||||||||||||||||||||||||
| 342 | } never executed: end of block | 0 | ||||||||||||||||||||||||||||||||||||
| 343 | - | |||||||||||||||||||||||||||||||||||||
| 344 | /*! | - | ||||||||||||||||||||||||||||||||||||
| 345 | \class QFusionStyle | - | ||||||||||||||||||||||||||||||||||||
| 346 | \brief The QFusionStyle class provides a custom widget style | - | ||||||||||||||||||||||||||||||||||||
| 347 | - | |||||||||||||||||||||||||||||||||||||
| 348 | \inmodule QtWidgets | - | ||||||||||||||||||||||||||||||||||||
| 349 | \internal | - | ||||||||||||||||||||||||||||||||||||
| 350 | - | |||||||||||||||||||||||||||||||||||||
| 351 | The Fusion style provides a custom look and feel that is not | - | ||||||||||||||||||||||||||||||||||||
| 352 | tied to a particular platform. | - | ||||||||||||||||||||||||||||||||||||
| 353 | //{Fusion Style Widget Gallery} | - | ||||||||||||||||||||||||||||||||||||
| 354 | \sa QWindowsStyle, QWindowsVistaStyle, QMacStyle, QCommonStyle | - | ||||||||||||||||||||||||||||||||||||
| 355 | */ | - | ||||||||||||||||||||||||||||||||||||
| 356 | - | |||||||||||||||||||||||||||||||||||||
| 357 | /*! | - | ||||||||||||||||||||||||||||||||||||
| 358 | Constructs a QFusionStyle object. | - | ||||||||||||||||||||||||||||||||||||
| 359 | */ | - | ||||||||||||||||||||||||||||||||||||
| 360 | QFusionStyle::QFusionStyle() : QCommonStyle(*new QFusionStylePrivate) | - | ||||||||||||||||||||||||||||||||||||
| 361 | { | - | ||||||||||||||||||||||||||||||||||||
| 362 | setObjectName(QLatin1String("Fusion")); | - | ||||||||||||||||||||||||||||||||||||
| 363 | } never executed: end of block | 0 | ||||||||||||||||||||||||||||||||||||
| 364 | - | |||||||||||||||||||||||||||||||||||||
| 365 | /*! | - | ||||||||||||||||||||||||||||||||||||
| 366 | \internal | - | ||||||||||||||||||||||||||||||||||||
| 367 | - | |||||||||||||||||||||||||||||||||||||
| 368 | Constructs a QFusionStyle object. | - | ||||||||||||||||||||||||||||||||||||
| 369 | */ | - | ||||||||||||||||||||||||||||||||||||
| 370 | QFusionStyle::QFusionStyle(QFusionStylePrivate &dd) : QCommonStyle(dd) | - | ||||||||||||||||||||||||||||||||||||
| 371 | { | - | ||||||||||||||||||||||||||||||||||||
| 372 | } never executed: end of block | 0 | ||||||||||||||||||||||||||||||||||||
| 373 | - | |||||||||||||||||||||||||||||||||||||
| 374 | /*! | - | ||||||||||||||||||||||||||||||||||||
| 375 | Destroys the QFusionStyle object. | - | ||||||||||||||||||||||||||||||||||||
| 376 | */ | - | ||||||||||||||||||||||||||||||||||||
| 377 | QFusionStyle::~QFusionStyle() | - | ||||||||||||||||||||||||||||||||||||
| 378 | { | - | ||||||||||||||||||||||||||||||||||||
| 379 | } | - | ||||||||||||||||||||||||||||||||||||
| 380 | - | |||||||||||||||||||||||||||||||||||||
| 381 | /*! | - | ||||||||||||||||||||||||||||||||||||
| 382 | \fn void QFusionStyle::drawItemText(QPainter *painter, const QRect &rectangle, int alignment, const QPalette &palette, | - | ||||||||||||||||||||||||||||||||||||
| 383 | bool enabled, const QString& text, QPalette::ColorRole textRole) const | - | ||||||||||||||||||||||||||||||||||||
| 384 | - | |||||||||||||||||||||||||||||||||||||
| 385 | Draws the given \a text in the specified \a rectangle using the | - | ||||||||||||||||||||||||||||||||||||
| 386 | provided \a painter and \a palette. | - | ||||||||||||||||||||||||||||||||||||
| 387 | - | |||||||||||||||||||||||||||||||||||||
| 388 | Text is drawn using the painter's pen. If an explicit \a textRole | - | ||||||||||||||||||||||||||||||||||||
| 389 | is specified, then the text is drawn using the \a palette's color | - | ||||||||||||||||||||||||||||||||||||
| 390 | for the specified role. The \a enabled value indicates whether or | - | ||||||||||||||||||||||||||||||||||||
| 391 | not the item is enabled; when reimplementing, this value should | - | ||||||||||||||||||||||||||||||||||||
| 392 | influence how the item is drawn. | - | ||||||||||||||||||||||||||||||||||||
| 393 | - | |||||||||||||||||||||||||||||||||||||
| 394 | The text is aligned and wrapped according to the specified \a | - | ||||||||||||||||||||||||||||||||||||
| 395 | alignment. | - | ||||||||||||||||||||||||||||||||||||
| 396 | - | |||||||||||||||||||||||||||||||||||||
| 397 | \sa Qt::Alignment | - | ||||||||||||||||||||||||||||||||||||
| 398 | */ | - | ||||||||||||||||||||||||||||||||||||
| 399 | void QFusionStyle::drawItemText(QPainter *painter, const QRect &rect, int alignment, const QPalette &pal, | - | ||||||||||||||||||||||||||||||||||||
| 400 | bool enabled, const QString& text, QPalette::ColorRole textRole) const | - | ||||||||||||||||||||||||||||||||||||
| 401 | { | - | ||||||||||||||||||||||||||||||||||||
| 402 | if (text.isEmpty())
| 0 | ||||||||||||||||||||||||||||||||||||
| 403 | return; never executed: return; | 0 | ||||||||||||||||||||||||||||||||||||
| 404 | - | |||||||||||||||||||||||||||||||||||||
| 405 | QPen savedPen = painter->pen(); | - | ||||||||||||||||||||||||||||||||||||
| 406 | if (textRole != QPalette::NoRole) {
| 0 | ||||||||||||||||||||||||||||||||||||
| 407 | painter->setPen(QPen(pal.brush(textRole), savedPen.widthF())); | - | ||||||||||||||||||||||||||||||||||||
| 408 | } never executed: end of block | 0 | ||||||||||||||||||||||||||||||||||||
| 409 | if (!enabled) {
| 0 | ||||||||||||||||||||||||||||||||||||
| 410 | QPen pen = painter->pen(); | - | ||||||||||||||||||||||||||||||||||||
| 411 | painter->setPen(pen); | - | ||||||||||||||||||||||||||||||||||||
| 412 | } never executed: end of block | 0 | ||||||||||||||||||||||||||||||||||||
| 413 | painter->drawText(rect, alignment, text); | - | ||||||||||||||||||||||||||||||||||||
| 414 | painter->setPen(savedPen); | - | ||||||||||||||||||||||||||||||||||||
| 415 | } never executed: end of block | 0 | ||||||||||||||||||||||||||||||||||||
| 416 | - | |||||||||||||||||||||||||||||||||||||
| 417 | - | |||||||||||||||||||||||||||||||||||||
| 418 | /*! | - | ||||||||||||||||||||||||||||||||||||
| 419 | \reimp | - | ||||||||||||||||||||||||||||||||||||
| 420 | */ | - | ||||||||||||||||||||||||||||||||||||
| 421 | void QFusionStyle::drawPrimitive(PrimitiveElement elem, | - | ||||||||||||||||||||||||||||||||||||
| 422 | const QStyleOption *option, | - | ||||||||||||||||||||||||||||||||||||
| 423 | QPainter *painter, const QWidget *widget) const | - | ||||||||||||||||||||||||||||||||||||
| 424 | { | - | ||||||||||||||||||||||||||||||||||||
| 425 | Q_ASSERT(option); | - | ||||||||||||||||||||||||||||||||||||
| 426 | Q_D (const QFusionStyle); | - | ||||||||||||||||||||||||||||||||||||
| 427 | - | |||||||||||||||||||||||||||||||||||||
| 428 | QRect rect = option->rect; | - | ||||||||||||||||||||||||||||||||||||
| 429 | int state = option->state; | - | ||||||||||||||||||||||||||||||||||||
| 430 | - | |||||||||||||||||||||||||||||||||||||
| 431 | QColor outline = d->outline(option->palette); | - | ||||||||||||||||||||||||||||||||||||
| 432 | QColor highlightedOutline = d->highlightedOutline(option->palette); | - | ||||||||||||||||||||||||||||||||||||
| 433 | - | |||||||||||||||||||||||||||||||||||||
| 434 | QColor tabFrameColor = d->tabFrameColor(option->palette); | - | ||||||||||||||||||||||||||||||||||||
| 435 | - | |||||||||||||||||||||||||||||||||||||
| 436 | switch (elem) { | - | ||||||||||||||||||||||||||||||||||||
| 437 | - | |||||||||||||||||||||||||||||||||||||
| 438 | // No frame drawn | - | ||||||||||||||||||||||||||||||||||||
| 439 | case PE_FrameGroupBox: never executed: case PE_FrameGroupBox: | 0 | ||||||||||||||||||||||||||||||||||||
| 440 | { | - | ||||||||||||||||||||||||||||||||||||
| 441 | QPixmap pixmap(QLatin1String(":/qt-project.org/styles/commonstyle/images/fusion_groupbox.png")); | - | ||||||||||||||||||||||||||||||||||||
| 442 | int topMargin = qMax(pixelMetric(PM_ExclusiveIndicatorHeight), option->fontMetrics.height()) + groupBoxTopMargin; | - | ||||||||||||||||||||||||||||||||||||
| 443 | QRect frame = option->rect.adjusted(0, topMargin, 0, 0); | - | ||||||||||||||||||||||||||||||||||||
| 444 | qDrawBorderPixmap(painter, frame, QMargins(6, 6, 6, 6), pixmap); | - | ||||||||||||||||||||||||||||||||||||
| 445 | break; never executed: break; | 0 | ||||||||||||||||||||||||||||||||||||
| 446 | } | - | ||||||||||||||||||||||||||||||||||||
| 447 | case PE_IndicatorBranch: { never executed: case PE_IndicatorBranch: | 0 | ||||||||||||||||||||||||||||||||||||
| 448 | if (!(option->state & State_Children))
| 0 | ||||||||||||||||||||||||||||||||||||
| 449 | break; never executed: break; | 0 | ||||||||||||||||||||||||||||||||||||
| 450 | if (option->state & State_Open)
| 0 | ||||||||||||||||||||||||||||||||||||
| 451 | drawPrimitive(PE_IndicatorArrowDown, option, painter, widget); never executed: drawPrimitive(PE_IndicatorArrowDown, option, painter, widget); | 0 | ||||||||||||||||||||||||||||||||||||
| 452 | else | - | ||||||||||||||||||||||||||||||||||||
| 453 | drawPrimitive(PE_IndicatorArrowRight, option, painter, widget); never executed: drawPrimitive(PE_IndicatorArrowRight, option, painter, widget); | 0 | ||||||||||||||||||||||||||||||||||||
| 454 | break; never executed: break; | 0 | ||||||||||||||||||||||||||||||||||||
| 455 | } | - | ||||||||||||||||||||||||||||||||||||
| 456 | case PE_FrameTabBarBase: never executed: case PE_FrameTabBarBase: | 0 | ||||||||||||||||||||||||||||||||||||
| 457 | if (const QStyleOptionTabBarBase *tbb
| 0 | ||||||||||||||||||||||||||||||||||||
| 458 | = qstyleoption_cast<const QStyleOptionTabBarBase *>(option)) {
| 0 | ||||||||||||||||||||||||||||||||||||
| 459 | painter->save(); | - | ||||||||||||||||||||||||||||||||||||
| 460 | painter->setPen(QPen(outline.lighter(110))); | - | ||||||||||||||||||||||||||||||||||||
| 461 | switch (tbb->shape) { | - | ||||||||||||||||||||||||||||||||||||
| 462 | case QTabBar::RoundedNorth: { never executed: case QTabBar::RoundedNorth: | 0 | ||||||||||||||||||||||||||||||||||||
| 463 | QRegion region(tbb->rect); | - | ||||||||||||||||||||||||||||||||||||
| 464 | region -= tbb->selectedTabRect; | - | ||||||||||||||||||||||||||||||||||||
| 465 | painter->drawLine(tbb->rect.topLeft(), tbb->rect.topRight()); | - | ||||||||||||||||||||||||||||||||||||
| 466 | painter->setClipRegion(region); | - | ||||||||||||||||||||||||||||||||||||
| 467 | painter->setPen(option->palette.light().color()); | - | ||||||||||||||||||||||||||||||||||||
| 468 | painter->drawLine(tbb->rect.topLeft() + QPoint(0, 1), tbb->rect.topRight() + QPoint(0, 1)); | - | ||||||||||||||||||||||||||||||||||||
| 469 | } | - | ||||||||||||||||||||||||||||||||||||
| 470 | break; never executed: break; | 0 | ||||||||||||||||||||||||||||||||||||
| 471 | case QTabBar::RoundedWest: never executed: case QTabBar::RoundedWest: | 0 | ||||||||||||||||||||||||||||||||||||
| 472 | painter->drawLine(tbb->rect.left(), tbb->rect.top(), tbb->rect.left(), tbb->rect.bottom()); | - | ||||||||||||||||||||||||||||||||||||
| 473 | break; never executed: break; | 0 | ||||||||||||||||||||||||||||||||||||
| 474 | case QTabBar::RoundedSouth: never executed: case QTabBar::RoundedSouth: | 0 | ||||||||||||||||||||||||||||||||||||
| 475 | painter->drawLine(tbb->rect.left(), tbb->rect.bottom(), | - | ||||||||||||||||||||||||||||||||||||
| 476 | tbb->rect.right(), tbb->rect.bottom()); | - | ||||||||||||||||||||||||||||||||||||
| 477 | break; never executed: break; | 0 | ||||||||||||||||||||||||||||||||||||
| 478 | case QTabBar::RoundedEast: never executed: case QTabBar::RoundedEast: | 0 | ||||||||||||||||||||||||||||||||||||
| 479 | painter->drawLine(tbb->rect.topRight(), tbb->rect.bottomRight()); | - | ||||||||||||||||||||||||||||||||||||
| 480 | break; never executed: break; | 0 | ||||||||||||||||||||||||||||||||||||
| 481 | case QTabBar::TriangularNorth: never executed: case QTabBar::TriangularNorth: | 0 | ||||||||||||||||||||||||||||||||||||
| 482 | case QTabBar::TriangularEast: never executed: case QTabBar::TriangularEast: | 0 | ||||||||||||||||||||||||||||||||||||
| 483 | case QTabBar::TriangularWest: never executed: case QTabBar::TriangularWest: | 0 | ||||||||||||||||||||||||||||||||||||
| 484 | case QTabBar::TriangularSouth: never executed: case QTabBar::TriangularSouth: | 0 | ||||||||||||||||||||||||||||||||||||
| 485 | painter->restore(); | - | ||||||||||||||||||||||||||||||||||||
| 486 | QCommonStyle::drawPrimitive(elem, option, painter, widget); | - | ||||||||||||||||||||||||||||||||||||
| 487 | return; never executed: return; | 0 | ||||||||||||||||||||||||||||||||||||
| 488 | } | - | ||||||||||||||||||||||||||||||||||||
| 489 | painter->restore(); | - | ||||||||||||||||||||||||||||||||||||
| 490 | } never executed: end of block | 0 | ||||||||||||||||||||||||||||||||||||
| 491 | return; never executed: return; | 0 | ||||||||||||||||||||||||||||||||||||
| 492 | case PE_PanelScrollAreaCorner: { never executed: case PE_PanelScrollAreaCorner: | 0 | ||||||||||||||||||||||||||||||||||||
| 493 | painter->save(); | - | ||||||||||||||||||||||||||||||||||||
| 494 | QColor alphaOutline = outline; | - | ||||||||||||||||||||||||||||||||||||
| 495 | alphaOutline.setAlpha(180); | - | ||||||||||||||||||||||||||||||||||||
| 496 | painter->setPen(alphaOutline); | - | ||||||||||||||||||||||||||||||||||||
| 497 | painter->setBrush(option->palette.brush(QPalette::Window)); | - | ||||||||||||||||||||||||||||||||||||
| 498 | painter->drawRect(option->rect); | - | ||||||||||||||||||||||||||||||||||||
| 499 | painter->restore(); | - | ||||||||||||||||||||||||||||||||||||
| 500 | } break; never executed: break; | 0 | ||||||||||||||||||||||||||||||||||||
| 501 | case PE_IndicatorArrowUp: never executed: case PE_IndicatorArrowUp: | 0 | ||||||||||||||||||||||||||||||||||||
| 502 | case PE_IndicatorArrowDown: never executed: case PE_IndicatorArrowDown: | 0 | ||||||||||||||||||||||||||||||||||||
| 503 | case PE_IndicatorArrowRight: never executed: case PE_IndicatorArrowRight: | 0 | ||||||||||||||||||||||||||||||||||||
| 504 | case PE_IndicatorArrowLeft: never executed: case PE_IndicatorArrowLeft: | 0 | ||||||||||||||||||||||||||||||||||||
| 505 | { | - | ||||||||||||||||||||||||||||||||||||
| 506 | if (option->rect.width() <= 1 || option->rect.height() <= 1)
| 0 | ||||||||||||||||||||||||||||||||||||
| 507 | break; never executed: break; | 0 | ||||||||||||||||||||||||||||||||||||
| 508 | QColor arrowColor = option->palette.foreground().color(); | - | ||||||||||||||||||||||||||||||||||||
| 509 | QPixmap arrow; | - | ||||||||||||||||||||||||||||||||||||
| 510 | int rotation = 0; | - | ||||||||||||||||||||||||||||||||||||
| 511 | switch (elem) { | - | ||||||||||||||||||||||||||||||||||||
| 512 | case PE_IndicatorArrowDown: never executed: case PE_IndicatorArrowDown: | 0 | ||||||||||||||||||||||||||||||||||||
| 513 | rotation = 180; | - | ||||||||||||||||||||||||||||||||||||
| 514 | break; never executed: break; | 0 | ||||||||||||||||||||||||||||||||||||
| 515 | case PE_IndicatorArrowRight: never executed: case PE_IndicatorArrowRight: | 0 | ||||||||||||||||||||||||||||||||||||
| 516 | rotation = 90; | - | ||||||||||||||||||||||||||||||||||||
| 517 | break; never executed: break; | 0 | ||||||||||||||||||||||||||||||||||||
| 518 | case PE_IndicatorArrowLeft: never executed: case PE_IndicatorArrowLeft: | 0 | ||||||||||||||||||||||||||||||||||||
| 519 | rotation = -90; | - | ||||||||||||||||||||||||||||||||||||
| 520 | break; never executed: break; | 0 | ||||||||||||||||||||||||||||||||||||
| 521 | default: never executed: default: | 0 | ||||||||||||||||||||||||||||||||||||
| 522 | break; never executed: break; | 0 | ||||||||||||||||||||||||||||||||||||
| 523 | } | - | ||||||||||||||||||||||||||||||||||||
| 524 | arrow = colorizedImage(QLatin1String(":/qt-project.org/styles/commonstyle/images/fusion_arrow.png"), arrowColor, rotation); | - | ||||||||||||||||||||||||||||||||||||
| 525 | if (arrow.isNull())
| 0 | ||||||||||||||||||||||||||||||||||||
| 526 | break; never executed: break; | 0 | ||||||||||||||||||||||||||||||||||||
| 527 | - | |||||||||||||||||||||||||||||||||||||
| 528 | QRect rect = option->rect; | - | ||||||||||||||||||||||||||||||||||||
| 529 | QRect arrowRect; | - | ||||||||||||||||||||||||||||||||||||
| 530 | int imageMax = qMin(arrow.height(), arrow.width()); | - | ||||||||||||||||||||||||||||||||||||
| 531 | int rectMax = qMin(rect.height(), rect.width()); | - | ||||||||||||||||||||||||||||||||||||
| 532 | int size = qMin(imageMax, rectMax); | - | ||||||||||||||||||||||||||||||||||||
| 533 | - | |||||||||||||||||||||||||||||||||||||
| 534 | arrowRect.setWidth(size); | - | ||||||||||||||||||||||||||||||||||||
| 535 | arrowRect.setHeight(size); | - | ||||||||||||||||||||||||||||||||||||
| 536 | if (arrow.width() > arrow.height())
| 0 | ||||||||||||||||||||||||||||||||||||
| 537 | arrowRect.setHeight(arrow.height() * size / arrow.width()); never executed: arrowRect.setHeight(arrow.height() * size / arrow.width()); | 0 | ||||||||||||||||||||||||||||||||||||
| 538 | else | - | ||||||||||||||||||||||||||||||||||||
| 539 | arrowRect.setWidth(arrow.width() * size / arrow.height()); never executed: arrowRect.setWidth(arrow.width() * size / arrow.height()); | 0 | ||||||||||||||||||||||||||||||||||||
| 540 | - | |||||||||||||||||||||||||||||||||||||
| 541 | arrowRect.moveTopLeft(rect.center() - arrowRect.center()); | - | ||||||||||||||||||||||||||||||||||||
| 542 | painter->save(); | - | ||||||||||||||||||||||||||||||||||||
| 543 | painter->setRenderHint(QPainter::SmoothPixmapTransform); | - | ||||||||||||||||||||||||||||||||||||
| 544 | painter->drawPixmap(arrowRect, arrow); | - | ||||||||||||||||||||||||||||||||||||
| 545 | painter->restore(); | - | ||||||||||||||||||||||||||||||||||||
| 546 | } | - | ||||||||||||||||||||||||||||||||||||
| 547 | break; never executed: break; | 0 | ||||||||||||||||||||||||||||||||||||
| 548 | case PE_IndicatorViewItemCheck: never executed: case PE_IndicatorViewItemCheck: | 0 | ||||||||||||||||||||||||||||||||||||
| 549 | { | - | ||||||||||||||||||||||||||||||||||||
| 550 | QStyleOptionButton button; | - | ||||||||||||||||||||||||||||||||||||
| 551 | button.QStyleOption::operator=(*option); | - | ||||||||||||||||||||||||||||||||||||
| 552 | button.state &= ~State_MouseOver; | - | ||||||||||||||||||||||||||||||||||||
| 553 | proxy()->drawPrimitive(PE_IndicatorCheckBox, &button, painter, widget); | - | ||||||||||||||||||||||||||||||||||||
| 554 | } | - | ||||||||||||||||||||||||||||||||||||
| 555 | return; never executed: return; | 0 | ||||||||||||||||||||||||||||||||||||
| 556 | case PE_IndicatorHeaderArrow: never executed: case PE_IndicatorHeaderArrow: | 0 | ||||||||||||||||||||||||||||||||||||
| 557 | if (const QStyleOptionHeader *header = qstyleoption_cast<const QStyleOptionHeader *>(option)) {
| 0 | ||||||||||||||||||||||||||||||||||||
| 558 | QRect r = header->rect; | - | ||||||||||||||||||||||||||||||||||||
| 559 | QPixmap arrow; | - | ||||||||||||||||||||||||||||||||||||
| 560 | QColor arrowColor = header->palette.foreground().color(); | - | ||||||||||||||||||||||||||||||||||||
| 561 | QPoint offset = QPoint(0, -1); | - | ||||||||||||||||||||||||||||||||||||
| 562 | - | |||||||||||||||||||||||||||||||||||||
| 563 | #if defined(Q_OS_LINUX) | - | ||||||||||||||||||||||||||||||||||||
| 564 | if (header->sortIndicator & QStyleOptionHeader::SortUp) {
| 0 | ||||||||||||||||||||||||||||||||||||
| 565 | arrow = colorizedImage(QLatin1String(":/qt-project.org/styles/commonstyle/images/fusion_arrow.png"), arrowColor); | - | ||||||||||||||||||||||||||||||||||||
| 566 | } else if (header->sortIndicator & QStyleOptionHeader::SortDown) { never executed: end of block
| 0 | ||||||||||||||||||||||||||||||||||||
| 567 | arrow = colorizedImage(QLatin1String(":/qt-project.org/styles/commonstyle/images/fusion_arrow.png"), arrowColor, 180); | - | ||||||||||||||||||||||||||||||||||||
| 568 | } never executed: end of block | 0 | ||||||||||||||||||||||||||||||||||||
| 569 | #else | - | ||||||||||||||||||||||||||||||||||||
| 570 | if (header->sortIndicator & QStyleOptionHeader::SortUp) { | - | ||||||||||||||||||||||||||||||||||||
| 571 | arrow = colorizedImage(QLatin1String(":/qt-project.org/styles/commonstyle/images/fusion_arrow.png"), arrowColor, 180); | - | ||||||||||||||||||||||||||||||||||||
| 572 | } else if (header->sortIndicator & QStyleOptionHeader::SortDown) { | - | ||||||||||||||||||||||||||||||||||||
| 573 | arrow = colorizedImage(QLatin1String(":/qt-project.org/styles/commonstyle/images/fusion_arrow.png"), arrowColor); | - | ||||||||||||||||||||||||||||||||||||
| 574 | } | - | ||||||||||||||||||||||||||||||||||||
| 575 | #endif | - | ||||||||||||||||||||||||||||||||||||
| 576 | - | |||||||||||||||||||||||||||||||||||||
| 577 | if (!arrow.isNull()) {
| 0 | ||||||||||||||||||||||||||||||||||||
| 578 | r.setSize(QSize(arrow.width()/2, arrow.height()/2)); | - | ||||||||||||||||||||||||||||||||||||
| 579 | r.moveCenter(header->rect.center()); | - | ||||||||||||||||||||||||||||||||||||
| 580 | painter->drawPixmap(r.translated(offset), arrow); | - | ||||||||||||||||||||||||||||||||||||
| 581 | } never executed: end of block | 0 | ||||||||||||||||||||||||||||||||||||
| 582 | } never executed: end of block | 0 | ||||||||||||||||||||||||||||||||||||
| 583 | break; never executed: break; | 0 | ||||||||||||||||||||||||||||||||||||
| 584 | case PE_IndicatorButtonDropDown: never executed: case PE_IndicatorButtonDropDown: | 0 | ||||||||||||||||||||||||||||||||||||
| 585 | proxy()->drawPrimitive(PE_PanelButtonCommand, option, painter, widget); | - | ||||||||||||||||||||||||||||||||||||
| 586 | break; never executed: break; | 0 | ||||||||||||||||||||||||||||||||||||
| 587 | - | |||||||||||||||||||||||||||||||||||||
| 588 | case PE_IndicatorToolBarSeparator: never executed: case PE_IndicatorToolBarSeparator: | 0 | ||||||||||||||||||||||||||||||||||||
| 589 | { | - | ||||||||||||||||||||||||||||||||||||
| 590 | QRect rect = option->rect; | - | ||||||||||||||||||||||||||||||||||||
| 591 | const int margin = 6; | - | ||||||||||||||||||||||||||||||||||||
| 592 | if (option->state & State_Horizontal) {
| 0 | ||||||||||||||||||||||||||||||||||||
| 593 | const int offset = rect.width()/2; | - | ||||||||||||||||||||||||||||||||||||
| 594 | painter->setPen(QPen(option->palette.background().color().darker(110))); | - | ||||||||||||||||||||||||||||||||||||
| 595 | painter->drawLine(rect.bottomLeft().x() + offset, | - | ||||||||||||||||||||||||||||||||||||
| 596 | rect.bottomLeft().y() - margin, | - | ||||||||||||||||||||||||||||||||||||
| 597 | rect.topLeft().x() + offset, | - | ||||||||||||||||||||||||||||||||||||
| 598 | rect.topLeft().y() + margin); | - | ||||||||||||||||||||||||||||||||||||
| 599 | painter->setPen(QPen(option->palette.background().color().lighter(110))); | - | ||||||||||||||||||||||||||||||||||||
| 600 | painter->drawLine(rect.bottomLeft().x() + offset + 1, | - | ||||||||||||||||||||||||||||||||||||
| 601 | rect.bottomLeft().y() - margin, | - | ||||||||||||||||||||||||||||||||||||
| 602 | rect.topLeft().x() + offset + 1, | - | ||||||||||||||||||||||||||||||||||||
| 603 | rect.topLeft().y() + margin); | - | ||||||||||||||||||||||||||||||||||||
| 604 | } else { //Draw vertical separator never executed: end of block | 0 | ||||||||||||||||||||||||||||||||||||
| 605 | const int offset = rect.height()/2; | - | ||||||||||||||||||||||||||||||||||||
| 606 | painter->setPen(QPen(option->palette.background().color().darker(110))); | - | ||||||||||||||||||||||||||||||||||||
| 607 | painter->drawLine(rect.topLeft().x() + margin , | - | ||||||||||||||||||||||||||||||||||||
| 608 | rect.topLeft().y() + offset, | - | ||||||||||||||||||||||||||||||||||||
| 609 | rect.topRight().x() - margin, | - | ||||||||||||||||||||||||||||||||||||
| 610 | rect.topRight().y() + offset); | - | ||||||||||||||||||||||||||||||||||||
| 611 | painter->setPen(QPen(option->palette.background().color().lighter(110))); | - | ||||||||||||||||||||||||||||||||||||
| 612 | painter->drawLine(rect.topLeft().x() + margin , | - | ||||||||||||||||||||||||||||||||||||
| 613 | rect.topLeft().y() + offset + 1, | - | ||||||||||||||||||||||||||||||||||||
| 614 | rect.topRight().x() - margin, | - | ||||||||||||||||||||||||||||||||||||
| 615 | rect.topRight().y() + offset + 1); | - | ||||||||||||||||||||||||||||||||||||
| 616 | } never executed: end of block | 0 | ||||||||||||||||||||||||||||||||||||
| 617 | } | - | ||||||||||||||||||||||||||||||||||||
| 618 | break; never executed: break; | 0 | ||||||||||||||||||||||||||||||||||||
| 619 | case PE_Frame: { never executed: case PE_Frame: | 0 | ||||||||||||||||||||||||||||||||||||
| 620 | if (widget && widget->inherits("QComboBoxPrivateContainer")){
| 0 | ||||||||||||||||||||||||||||||||||||
| 621 | QStyleOption copy = *option; | - | ||||||||||||||||||||||||||||||||||||
| 622 | copy.state |= State_Raised; | - | ||||||||||||||||||||||||||||||||||||
| 623 | proxy()->drawPrimitive(PE_PanelMenu, ©, painter, widget); | - | ||||||||||||||||||||||||||||||||||||
| 624 | break; never executed: break; | 0 | ||||||||||||||||||||||||||||||||||||
| 625 | } | - | ||||||||||||||||||||||||||||||||||||
| 626 | painter->save(); | - | ||||||||||||||||||||||||||||||||||||
| 627 | QPen thePen(outline.lighter(108)); | - | ||||||||||||||||||||||||||||||||||||
| 628 | thePen.setCosmetic(false); | - | ||||||||||||||||||||||||||||||||||||
| 629 | painter->setPen(thePen); | - | ||||||||||||||||||||||||||||||||||||
| 630 | painter->drawRect(option->rect.adjusted(0, 0, -1, -1)); | - | ||||||||||||||||||||||||||||||||||||
| 631 | painter->restore(); } | - | ||||||||||||||||||||||||||||||||||||
| 632 | break; never executed: break; | 0 | ||||||||||||||||||||||||||||||||||||
| 633 | case PE_FrameMenu: never executed: case PE_FrameMenu: | 0 | ||||||||||||||||||||||||||||||||||||
| 634 | painter->save(); | - | ||||||||||||||||||||||||||||||||||||
| 635 | { | - | ||||||||||||||||||||||||||||||||||||
| 636 | painter->setPen(QPen(outline)); | - | ||||||||||||||||||||||||||||||||||||
| 637 | painter->drawRect(option->rect.adjusted(0, 0, -1, -1)); | - | ||||||||||||||||||||||||||||||||||||
| 638 | QColor frameLight = option->palette.background().color().lighter(160); | - | ||||||||||||||||||||||||||||||||||||
| 639 | QColor frameShadow = option->palette.background().color().darker(110); | - | ||||||||||||||||||||||||||||||||||||
| 640 | - | |||||||||||||||||||||||||||||||||||||
| 641 | //paint beveleffect | - | ||||||||||||||||||||||||||||||||||||
| 642 | QRect frame = option->rect.adjusted(1, 1, -1, -1); | - | ||||||||||||||||||||||||||||||||||||
| 643 | painter->setPen(frameLight); | - | ||||||||||||||||||||||||||||||||||||
| 644 | painter->drawLine(frame.topLeft(), frame.bottomLeft()); | - | ||||||||||||||||||||||||||||||||||||
| 645 | painter->drawLine(frame.topLeft(), frame.topRight()); | - | ||||||||||||||||||||||||||||||||||||
| 646 | - | |||||||||||||||||||||||||||||||||||||
| 647 | painter->setPen(frameShadow); | - | ||||||||||||||||||||||||||||||||||||
| 648 | painter->drawLine(frame.topRight(), frame.bottomRight()); | - | ||||||||||||||||||||||||||||||||||||
| 649 | painter->drawLine(frame.bottomLeft(), frame.bottomRight()); | - | ||||||||||||||||||||||||||||||||||||
| 650 | } | - | ||||||||||||||||||||||||||||||||||||
| 651 | painter->restore(); | - | ||||||||||||||||||||||||||||||||||||
| 652 | break; never executed: break; | 0 | ||||||||||||||||||||||||||||||||||||
| 653 | case PE_FrameDockWidget: never executed: case PE_FrameDockWidget: | 0 | ||||||||||||||||||||||||||||||||||||
| 654 | - | |||||||||||||||||||||||||||||||||||||
| 655 | painter->save(); | - | ||||||||||||||||||||||||||||||||||||
| 656 | { | - | ||||||||||||||||||||||||||||||||||||
| 657 | QColor softshadow = option->palette.background().color().darker(120); | - | ||||||||||||||||||||||||||||||||||||
| 658 | - | |||||||||||||||||||||||||||||||||||||
| 659 | QRect rect= option->rect; | - | ||||||||||||||||||||||||||||||||||||
| 660 | painter->setPen(softshadow); | - | ||||||||||||||||||||||||||||||||||||
| 661 | painter->drawRect(option->rect.adjusted(0, 0, -1, -1)); | - | ||||||||||||||||||||||||||||||||||||
| 662 | painter->setPen(QPen(option->palette.light(), 1)); | - | ||||||||||||||||||||||||||||||||||||
| 663 | painter->drawLine(QPoint(rect.left() + 1, rect.top() + 1), QPoint(rect.left() + 1, rect.bottom() - 1)); | - | ||||||||||||||||||||||||||||||||||||
| 664 | painter->setPen(QPen(option->palette.background().color().darker(120))); | - | ||||||||||||||||||||||||||||||||||||
| 665 | painter->drawLine(QPoint(rect.left() + 1, rect.bottom() - 1), QPoint(rect.right() - 2, rect.bottom() - 1)); | - | ||||||||||||||||||||||||||||||||||||
| 666 | painter->drawLine(QPoint(rect.right() - 1, rect.top() + 1), QPoint(rect.right() - 1, rect.bottom() - 1)); | - | ||||||||||||||||||||||||||||||||||||
| 667 | - | |||||||||||||||||||||||||||||||||||||
| 668 | } | - | ||||||||||||||||||||||||||||||||||||
| 669 | painter->restore(); | - | ||||||||||||||||||||||||||||||||||||
| 670 | break; never executed: break; | 0 | ||||||||||||||||||||||||||||||||||||
| 671 | case PE_PanelButtonTool: never executed: case PE_PanelButtonTool: | 0 | ||||||||||||||||||||||||||||||||||||
| 672 | painter->save(); | - | ||||||||||||||||||||||||||||||||||||
| 673 | if ((option->state & State_Enabled || option->state & State_On) || !(option->state & State_AutoRaise)) {
| 0 | ||||||||||||||||||||||||||||||||||||
| 674 | if (widget && widget->inherits("QDockWidgetTitleButton")) {
| 0 | ||||||||||||||||||||||||||||||||||||
| 675 | if (option->state & State_MouseOver)
| 0 | ||||||||||||||||||||||||||||||||||||
| 676 | proxy()->drawPrimitive(PE_PanelButtonCommand, option, painter, widget); never executed: proxy()->drawPrimitive(PE_PanelButtonCommand, option, painter, widget); | 0 | ||||||||||||||||||||||||||||||||||||
| 677 | } else { never executed: end of block | 0 | ||||||||||||||||||||||||||||||||||||
| 678 | proxy()->drawPrimitive(PE_PanelButtonCommand, option, painter, widget); | - | ||||||||||||||||||||||||||||||||||||
| 679 | } never executed: end of block | 0 | ||||||||||||||||||||||||||||||||||||
| 680 | } | - | ||||||||||||||||||||||||||||||||||||
| 681 | painter->restore(); | - | ||||||||||||||||||||||||||||||||||||
| 682 | break; never executed: break; | 0 | ||||||||||||||||||||||||||||||||||||
| 683 | case PE_IndicatorDockWidgetResizeHandle: never executed: case PE_IndicatorDockWidgetResizeHandle: | 0 | ||||||||||||||||||||||||||||||||||||
| 684 | { | - | ||||||||||||||||||||||||||||||||||||
| 685 | QStyleOption dockWidgetHandle = *option; | - | ||||||||||||||||||||||||||||||||||||
| 686 | bool horizontal = option->state & State_Horizontal; | - | ||||||||||||||||||||||||||||||||||||
| 687 | dockWidgetHandle.state.setFlag(State_Horizontal, !horizontal); | - | ||||||||||||||||||||||||||||||||||||
| 688 | proxy()->drawControl(CE_Splitter, &dockWidgetHandle, painter, widget); | - | ||||||||||||||||||||||||||||||||||||
| 689 | } | - | ||||||||||||||||||||||||||||||||||||
| 690 | break; never executed: break; | 0 | ||||||||||||||||||||||||||||||||||||
| 691 | case PE_FrameWindow: never executed: case PE_FrameWindow: | 0 | ||||||||||||||||||||||||||||||||||||
| 692 | painter->save(); | - | ||||||||||||||||||||||||||||||||||||
| 693 | { | - | ||||||||||||||||||||||||||||||||||||
| 694 | QRect rect= option->rect; | - | ||||||||||||||||||||||||||||||||||||
| 695 | painter->setPen(QPen(outline.darker(150))); | - | ||||||||||||||||||||||||||||||||||||
| 696 | painter->drawRect(option->rect.adjusted(0, 0, -1, -1)); | - | ||||||||||||||||||||||||||||||||||||
| 697 | painter->setPen(QPen(option->palette.light(), 1)); | - | ||||||||||||||||||||||||||||||||||||
| 698 | painter->drawLine(QPoint(rect.left() + 1, rect.top() + 1), | - | ||||||||||||||||||||||||||||||||||||
| 699 | QPoint(rect.left() + 1, rect.bottom() - 1)); | - | ||||||||||||||||||||||||||||||||||||
| 700 | painter->setPen(QPen(option->palette.background().color().darker(120))); | - | ||||||||||||||||||||||||||||||||||||
| 701 | painter->drawLine(QPoint(rect.left() + 1, rect.bottom() - 1), | - | ||||||||||||||||||||||||||||||||||||
| 702 | QPoint(rect.right() - 2, rect.bottom() - 1)); | - | ||||||||||||||||||||||||||||||||||||
| 703 | painter->drawLine(QPoint(rect.right() - 1, rect.top() + 1), | - | ||||||||||||||||||||||||||||||||||||
| 704 | QPoint(rect.right() - 1, rect.bottom() - 1)); | - | ||||||||||||||||||||||||||||||||||||
| 705 | } | - | ||||||||||||||||||||||||||||||||||||
| 706 | painter->restore(); | - | ||||||||||||||||||||||||||||||||||||
| 707 | break; never executed: break; | 0 | ||||||||||||||||||||||||||||||||||||
| 708 | case PE_FrameLineEdit: never executed: case PE_FrameLineEdit: | 0 | ||||||||||||||||||||||||||||||||||||
| 709 | { | - | ||||||||||||||||||||||||||||||||||||
| 710 | QRect r = rect; | - | ||||||||||||||||||||||||||||||||||||
| 711 | bool hasFocus = option->state & State_HasFocus; | - | ||||||||||||||||||||||||||||||||||||
| 712 | - | |||||||||||||||||||||||||||||||||||||
| 713 | painter->save(); | - | ||||||||||||||||||||||||||||||||||||
| 714 | - | |||||||||||||||||||||||||||||||||||||
| 715 | painter->setRenderHint(QPainter::Antialiasing, true); | - | ||||||||||||||||||||||||||||||||||||
| 716 | // ### highdpi painter bug. | - | ||||||||||||||||||||||||||||||||||||
| 717 | painter->translate(0.5, 0.5); | - | ||||||||||||||||||||||||||||||||||||
| 718 | - | |||||||||||||||||||||||||||||||||||||
| 719 | // Draw Outline | - | ||||||||||||||||||||||||||||||||||||
| 720 | painter->setPen( QPen(hasFocus ? highlightedOutline : outline)); | - | ||||||||||||||||||||||||||||||||||||
| 721 | painter->setBrush(option->palette.base()); | - | ||||||||||||||||||||||||||||||||||||
| 722 | painter->drawRoundedRect(r.adjusted(0, 0, -1, -1), 2, 2); | - | ||||||||||||||||||||||||||||||||||||
| 723 | - | |||||||||||||||||||||||||||||||||||||
| 724 | if (hasFocus) {
| 0 | ||||||||||||||||||||||||||||||||||||
| 725 | QColor softHighlight = highlightedOutline; | - | ||||||||||||||||||||||||||||||||||||
| 726 | softHighlight.setAlpha(40); | - | ||||||||||||||||||||||||||||||||||||
| 727 | painter->setPen(softHighlight); | - | ||||||||||||||||||||||||||||||||||||
| 728 | painter->drawRoundedRect(r.adjusted(1, 1, -2, -2), 1.7, 1.7); | - | ||||||||||||||||||||||||||||||||||||
| 729 | } never executed: end of block | 0 | ||||||||||||||||||||||||||||||||||||
| 730 | // Draw inner shadow | - | ||||||||||||||||||||||||||||||||||||
| 731 | painter->setPen(d->topShadow()); | - | ||||||||||||||||||||||||||||||||||||
| 732 | painter->drawLine(QPoint(r.left() + 2, r.top() + 1), QPoint(r.right() - 2, r.top() + 1)); | - | ||||||||||||||||||||||||||||||||||||
| 733 | - | |||||||||||||||||||||||||||||||||||||
| 734 | painter->restore(); | - | ||||||||||||||||||||||||||||||||||||
| 735 | - | |||||||||||||||||||||||||||||||||||||
| 736 | } | - | ||||||||||||||||||||||||||||||||||||
| 737 | break; never executed: break; | 0 | ||||||||||||||||||||||||||||||||||||
| 738 | case PE_IndicatorCheckBox: never executed: case PE_IndicatorCheckBox: | 0 | ||||||||||||||||||||||||||||||||||||
| 739 | painter->save(); | - | ||||||||||||||||||||||||||||||||||||
| 740 | if (const QStyleOptionButton *checkbox = qstyleoption_cast<const QStyleOptionButton*>(option)) {
| 0 | ||||||||||||||||||||||||||||||||||||
| 741 | painter->setRenderHint(QPainter::Antialiasing, true); | - | ||||||||||||||||||||||||||||||||||||
| 742 | painter->translate(0.5, 0.5); | - | ||||||||||||||||||||||||||||||||||||
| 743 | rect = rect.adjusted(0, 0, -1, -1); | - | ||||||||||||||||||||||||||||||||||||
| 744 | - | |||||||||||||||||||||||||||||||||||||
| 745 | QColor pressedColor = mergedColors(option->palette.base().color(), option->palette.foreground().color(), 85); | - | ||||||||||||||||||||||||||||||||||||
| 746 | painter->setBrush(Qt::NoBrush); | - | ||||||||||||||||||||||||||||||||||||
| 747 | - | |||||||||||||||||||||||||||||||||||||
| 748 | // Gradient fill | - | ||||||||||||||||||||||||||||||||||||
| 749 | QLinearGradient gradient(rect.topLeft(), rect.bottomLeft()); | - | ||||||||||||||||||||||||||||||||||||
| 750 | gradient.setColorAt(0, (state & State_Sunken) ? pressedColor : option->palette.base().color().darker(115)); | - | ||||||||||||||||||||||||||||||||||||
| 751 | gradient.setColorAt(0.15, (state & State_Sunken) ? pressedColor : option->palette.base().color()); | - | ||||||||||||||||||||||||||||||||||||
| 752 | gradient.setColorAt(1, (state & State_Sunken) ? pressedColor : option->palette.base().color()); | - | ||||||||||||||||||||||||||||||||||||
| 753 | - | |||||||||||||||||||||||||||||||||||||
| 754 | painter->setBrush((state & State_Sunken) ? QBrush(pressedColor) : gradient); | - | ||||||||||||||||||||||||||||||||||||
| 755 | painter->setPen(QPen(outline.lighter(110))); | - | ||||||||||||||||||||||||||||||||||||
| 756 | - | |||||||||||||||||||||||||||||||||||||
| 757 | if (option->state & State_HasFocus && option->state & State_KeyboardFocusChange)
| 0 | ||||||||||||||||||||||||||||||||||||
| 758 | painter->setPen(QPen(highlightedOutline)); never executed: painter->setPen(QPen(highlightedOutline)); | 0 | ||||||||||||||||||||||||||||||||||||
| 759 | painter->drawRect(rect); | - | ||||||||||||||||||||||||||||||||||||
| 760 | - | |||||||||||||||||||||||||||||||||||||
| 761 | QColor checkMarkColor = option->palette.text().color().darker(120); | - | ||||||||||||||||||||||||||||||||||||
| 762 | const int checkMarkPadding = QStyleHelper::dpiScaled(3); | - | ||||||||||||||||||||||||||||||||||||
| 763 | - | |||||||||||||||||||||||||||||||||||||
| 764 | if (checkbox->state & State_NoChange) {
| 0 | ||||||||||||||||||||||||||||||||||||
| 765 | gradient = QLinearGradient(rect.topLeft(), rect.bottomLeft()); | - | ||||||||||||||||||||||||||||||||||||
| 766 | checkMarkColor.setAlpha(80); | - | ||||||||||||||||||||||||||||||||||||
| 767 | gradient.setColorAt(0, checkMarkColor); | - | ||||||||||||||||||||||||||||||||||||
| 768 | checkMarkColor.setAlpha(140); | - | ||||||||||||||||||||||||||||||||||||
| 769 | gradient.setColorAt(1, checkMarkColor); | - | ||||||||||||||||||||||||||||||||||||
| 770 | checkMarkColor.setAlpha(180); | - | ||||||||||||||||||||||||||||||||||||
| 771 | painter->setPen(QPen(checkMarkColor, 1)); | - | ||||||||||||||||||||||||||||||||||||
| 772 | painter->setBrush(gradient); | - | ||||||||||||||||||||||||||||||||||||
| 773 | painter->drawRect(rect.adjusted(checkMarkPadding, checkMarkPadding, -checkMarkPadding, -checkMarkPadding)); | - | ||||||||||||||||||||||||||||||||||||
| 774 | - | |||||||||||||||||||||||||||||||||||||
| 775 | } else if (checkbox->state & (State_On)) { never executed: end of block
| 0 | ||||||||||||||||||||||||||||||||||||
| 776 | QPen checkPen = QPen(checkMarkColor, QStyleHelper::dpiScaled(1.8)); | - | ||||||||||||||||||||||||||||||||||||
| 777 | checkMarkColor.setAlpha(210); | - | ||||||||||||||||||||||||||||||||||||
| 778 | painter->translate(-1, 0.5); | - | ||||||||||||||||||||||||||||||||||||
| 779 | painter->setPen(checkPen); | - | ||||||||||||||||||||||||||||||||||||
| 780 | painter->setBrush(Qt::NoBrush); | - | ||||||||||||||||||||||||||||||||||||
| 781 | painter->translate(0.2, 0.0); | - | ||||||||||||||||||||||||||||||||||||
| 782 | - | |||||||||||||||||||||||||||||||||||||
| 783 | // Draw checkmark | - | ||||||||||||||||||||||||||||||||||||
| 784 | QPainterPath path; | - | ||||||||||||||||||||||||||||||||||||
| 785 | path.moveTo(2 + checkMarkPadding, rect.height() / 2.0); | - | ||||||||||||||||||||||||||||||||||||
| 786 | path.lineTo(rect.width() / 2.0, rect.height() - checkMarkPadding); | - | ||||||||||||||||||||||||||||||||||||
| 787 | path.lineTo(rect.width() - checkMarkPadding - 0.5, checkMarkPadding); | - | ||||||||||||||||||||||||||||||||||||
| 788 | painter->drawPath(path.translated(rect.topLeft())); | - | ||||||||||||||||||||||||||||||||||||
| 789 | } never executed: end of block | 0 | ||||||||||||||||||||||||||||||||||||
| 790 | } never executed: end of block | 0 | ||||||||||||||||||||||||||||||||||||
| 791 | painter->restore(); | - | ||||||||||||||||||||||||||||||||||||
| 792 | break; never executed: break; | 0 | ||||||||||||||||||||||||||||||||||||
| 793 | case PE_IndicatorRadioButton: never executed: case PE_IndicatorRadioButton: | 0 | ||||||||||||||||||||||||||||||||||||
| 794 | painter->save(); | - | ||||||||||||||||||||||||||||||||||||
| 795 | { | - | ||||||||||||||||||||||||||||||||||||
| 796 | QColor pressedColor = mergedColors(option->palette.base().color(), option->palette.foreground().color(), 85); | - | ||||||||||||||||||||||||||||||||||||
| 797 | painter->setBrush((state & State_Sunken) ? pressedColor : option->palette.base().color()); | - | ||||||||||||||||||||||||||||||||||||
| 798 | painter->setRenderHint(QPainter::Antialiasing, true); | - | ||||||||||||||||||||||||||||||||||||
| 799 | QPainterPath circle; | - | ||||||||||||||||||||||||||||||||||||
| 800 | const QPointF circleCenter = rect.center() + QPoint(1, 1); | - | ||||||||||||||||||||||||||||||||||||
| 801 | const qreal outlineRadius = (rect.width() + (rect.width() + 1) % 2) / 2.0 - 1; | - | ||||||||||||||||||||||||||||||||||||
| 802 | circle.addEllipse(circleCenter, outlineRadius, outlineRadius); | - | ||||||||||||||||||||||||||||||||||||
| 803 | painter->setPen(QPen(option->palette.background().color().darker(150))); | - | ||||||||||||||||||||||||||||||||||||
| 804 | if (option->state & State_HasFocus && option->state & State_KeyboardFocusChange)
| 0 | ||||||||||||||||||||||||||||||||||||
| 805 | painter->setPen(QPen(highlightedOutline)); never executed: painter->setPen(QPen(highlightedOutline)); | 0 | ||||||||||||||||||||||||||||||||||||
| 806 | painter->drawPath(circle); | - | ||||||||||||||||||||||||||||||||||||
| 807 | - | |||||||||||||||||||||||||||||||||||||
| 808 | if (state & (State_On )) {
| 0 | ||||||||||||||||||||||||||||||||||||
| 809 | circle = QPainterPath(); | - | ||||||||||||||||||||||||||||||||||||
| 810 | const qreal checkmarkRadius = outlineRadius / 2.32; | - | ||||||||||||||||||||||||||||||||||||
| 811 | circle.addEllipse(circleCenter, checkmarkRadius, checkmarkRadius); | - | ||||||||||||||||||||||||||||||||||||
| 812 | QColor checkMarkColor = option->palette.text().color().darker(120); | - | ||||||||||||||||||||||||||||||||||||
| 813 | checkMarkColor.setAlpha(200); | - | ||||||||||||||||||||||||||||||||||||
| 814 | painter->setPen(checkMarkColor); | - | ||||||||||||||||||||||||||||||||||||
| 815 | checkMarkColor.setAlpha(180); | - | ||||||||||||||||||||||||||||||||||||
| 816 | painter->setBrush(checkMarkColor); | - | ||||||||||||||||||||||||||||||||||||
| 817 | painter->drawPath(circle); | - | ||||||||||||||||||||||||||||||||||||
| 818 | } never executed: end of block | 0 | ||||||||||||||||||||||||||||||||||||
| 819 | } | - | ||||||||||||||||||||||||||||||||||||
| 820 | painter->restore(); | - | ||||||||||||||||||||||||||||||||||||
| 821 | break; never executed: break; | 0 | ||||||||||||||||||||||||||||||||||||
| 822 | case PE_IndicatorToolBarHandle: never executed: case PE_IndicatorToolBarHandle: | 0 | ||||||||||||||||||||||||||||||||||||
| 823 | { | - | ||||||||||||||||||||||||||||||||||||
| 824 | //draw grips | - | ||||||||||||||||||||||||||||||||||||
| 825 | if (option->state & State_Horizontal) {
| 0 | ||||||||||||||||||||||||||||||||||||
| 826 | for (int i = -3 ; i < 2 ; i += 3) {
| 0 | ||||||||||||||||||||||||||||||||||||
| 827 | for (int j = -8 ; j < 10 ; j += 3) {
| 0 | ||||||||||||||||||||||||||||||||||||
| 828 | painter->fillRect(rect.center().x() + i, rect.center().y() + j, 2, 2, d->lightShade()); | - | ||||||||||||||||||||||||||||||||||||
| 829 | painter->fillRect(rect.center().x() + i, rect.center().y() + j, 1, 1, d->darkShade()); | - | ||||||||||||||||||||||||||||||||||||
| 830 | } never executed: end of block | 0 | ||||||||||||||||||||||||||||||||||||
| 831 | } never executed: end of block | 0 | ||||||||||||||||||||||||||||||||||||
| 832 | } else { //vertical toolbar never executed: end of block | 0 | ||||||||||||||||||||||||||||||||||||
| 833 | for (int i = -6 ; i < 12 ; i += 3) {
| 0 | ||||||||||||||||||||||||||||||||||||
| 834 | for (int j = -3 ; j < 2 ; j += 3) {
| 0 | ||||||||||||||||||||||||||||||||||||
| 835 | painter->fillRect(rect.center().x() + i, rect.center().y() + j, 2, 2, d->lightShade()); | - | ||||||||||||||||||||||||||||||||||||
| 836 | painter->fillRect(rect.center().x() + i, rect.center().y() + j, 1, 1, d->darkShade()); | - | ||||||||||||||||||||||||||||||||||||
| 837 | } never executed: end of block | 0 | ||||||||||||||||||||||||||||||||||||
| 838 | } never executed: end of block | 0 | ||||||||||||||||||||||||||||||||||||
| 839 | } never executed: end of block | 0 | ||||||||||||||||||||||||||||||||||||
| 840 | break; never executed: break; | 0 | ||||||||||||||||||||||||||||||||||||
| 841 | } | - | ||||||||||||||||||||||||||||||||||||
| 842 | case PE_FrameDefaultButton: never executed: case PE_FrameDefaultButton: | 0 | ||||||||||||||||||||||||||||||||||||
| 843 | break; never executed: break; | 0 | ||||||||||||||||||||||||||||||||||||
| 844 | case PE_FrameFocusRect: never executed: case PE_FrameFocusRect: | 0 | ||||||||||||||||||||||||||||||||||||
| 845 | if (const QStyleOptionFocusRect *fropt = qstyleoption_cast<const QStyleOptionFocusRect *>(option)) {
| 0 | ||||||||||||||||||||||||||||||||||||
| 846 | //### check for d->alt_down | - | ||||||||||||||||||||||||||||||||||||
| 847 | if (!(fropt->state & State_KeyboardFocusChange))
| 0 | ||||||||||||||||||||||||||||||||||||
| 848 | return; never executed: return; | 0 | ||||||||||||||||||||||||||||||||||||
| 849 | QRect rect = option->rect; | - | ||||||||||||||||||||||||||||||||||||
| 850 | - | |||||||||||||||||||||||||||||||||||||
| 851 | painter->save(); | - | ||||||||||||||||||||||||||||||||||||
| 852 | painter->setRenderHint(QPainter::Antialiasing, true); | - | ||||||||||||||||||||||||||||||||||||
| 853 | painter->translate(0.5, 0.5); | - | ||||||||||||||||||||||||||||||||||||
| 854 | QColor fillcolor = highlightedOutline; | - | ||||||||||||||||||||||||||||||||||||
| 855 | fillcolor.setAlpha(80); | - | ||||||||||||||||||||||||||||||||||||
| 856 | painter->setPen(fillcolor.darker(120)); | - | ||||||||||||||||||||||||||||||||||||
| 857 | fillcolor.setAlpha(30); | - | ||||||||||||||||||||||||||||||||||||
| 858 | QLinearGradient gradient(rect.topLeft(), rect.bottomLeft()); | - | ||||||||||||||||||||||||||||||||||||
| 859 | gradient.setColorAt(0, fillcolor.lighter(160)); | - | ||||||||||||||||||||||||||||||||||||
| 860 | gradient.setColorAt(1, fillcolor); | - | ||||||||||||||||||||||||||||||||||||
| 861 | painter->setBrush(gradient); | - | ||||||||||||||||||||||||||||||||||||
| 862 | painter->drawRoundedRect(option->rect.adjusted(0, 0, -1, -1), 1, 1); | - | ||||||||||||||||||||||||||||||||||||
| 863 | painter->restore(); | - | ||||||||||||||||||||||||||||||||||||
| 864 | } never executed: end of block | 0 | ||||||||||||||||||||||||||||||||||||
| 865 | break; never executed: break; | 0 | ||||||||||||||||||||||||||||||||||||
| 866 | case PE_PanelButtonCommand: never executed: case PE_PanelButtonCommand: | 0 | ||||||||||||||||||||||||||||||||||||
| 867 | { | - | ||||||||||||||||||||||||||||||||||||
| 868 | bool isDefault = false; | - | ||||||||||||||||||||||||||||||||||||
| 869 | bool isFlat = false; | - | ||||||||||||||||||||||||||||||||||||
| 870 | bool isDown = (option->state & State_Sunken) || (option->state & State_On);
| 0 | ||||||||||||||||||||||||||||||||||||
| 871 | QRect r; | - | ||||||||||||||||||||||||||||||||||||
| 872 | - | |||||||||||||||||||||||||||||||||||||
| 873 | if (const QStyleOptionButton *button = qstyleoption_cast<const QStyleOptionButton*>(option)) {
| 0 | ||||||||||||||||||||||||||||||||||||
| 874 | isDefault = (button->features & QStyleOptionButton::DefaultButton) && (button->state & State_Enabled);
| 0 | ||||||||||||||||||||||||||||||||||||
| 875 | isFlat = (button->features & QStyleOptionButton::Flat); | - | ||||||||||||||||||||||||||||||||||||
| 876 | } never executed: end of block | 0 | ||||||||||||||||||||||||||||||||||||
| 877 | - | |||||||||||||||||||||||||||||||||||||
| 878 | if (isFlat && !isDown) {
| 0 | ||||||||||||||||||||||||||||||||||||
| 879 | if (isDefault) {
| 0 | ||||||||||||||||||||||||||||||||||||
| 880 | r = option->rect.adjusted(0, 1, 0, -1); | - | ||||||||||||||||||||||||||||||||||||
| 881 | painter->setPen(QPen(Qt::black)); | - | ||||||||||||||||||||||||||||||||||||
| 882 | const QLine lines[4] = { | - | ||||||||||||||||||||||||||||||||||||
| 883 | QLine(QPoint(r.left() + 2, r.top()), | - | ||||||||||||||||||||||||||||||||||||
| 884 | QPoint(r.right() - 2, r.top())), | - | ||||||||||||||||||||||||||||||||||||
| 885 | QLine(QPoint(r.left(), r.top() + 2), | - | ||||||||||||||||||||||||||||||||||||
| 886 | QPoint(r.left(), r.bottom() - 2)), | - | ||||||||||||||||||||||||||||||||||||
| 887 | QLine(QPoint(r.right(), r.top() + 2), | - | ||||||||||||||||||||||||||||||||||||
| 888 | QPoint(r.right(), r.bottom() - 2)), | - | ||||||||||||||||||||||||||||||||||||
| 889 | QLine(QPoint(r.left() + 2, r.bottom()), | - | ||||||||||||||||||||||||||||||||||||
| 890 | QPoint(r.right() - 2, r.bottom())) | - | ||||||||||||||||||||||||||||||||||||
| 891 | }; | - | ||||||||||||||||||||||||||||||||||||
| 892 | painter->drawLines(lines, 4); | - | ||||||||||||||||||||||||||||||||||||
| 893 | const QPoint points[4] = { | - | ||||||||||||||||||||||||||||||||||||
| 894 | QPoint(r.right() - 1, r.bottom() - 1), | - | ||||||||||||||||||||||||||||||||||||
| 895 | QPoint(r.right() - 1, r.top() + 1), | - | ||||||||||||||||||||||||||||||||||||
| 896 | QPoint(r.left() + 1, r.bottom() - 1), | - | ||||||||||||||||||||||||||||||||||||
| 897 | QPoint(r.left() + 1, r.top() + 1) | - | ||||||||||||||||||||||||||||||||||||
| 898 | }; | - | ||||||||||||||||||||||||||||||||||||
| 899 | painter->drawPoints(points, 4); | - | ||||||||||||||||||||||||||||||||||||
| 900 | } never executed: end of block | 0 | ||||||||||||||||||||||||||||||||||||
| 901 | return; never executed: return; | 0 | ||||||||||||||||||||||||||||||||||||
| 902 | } | - | ||||||||||||||||||||||||||||||||||||
| 903 | - | |||||||||||||||||||||||||||||||||||||
| 904 | BEGIN_STYLE_PIXMAPCACHE(QString::fromLatin1("pushbutton-%1").arg(isDefault)) never executed: end of blocknever executed: end of block
| 0 | ||||||||||||||||||||||||||||||||||||
| 905 | r = rect.adjusted(0, 1, -1, 0); | - | ||||||||||||||||||||||||||||||||||||
| 906 | - | |||||||||||||||||||||||||||||||||||||
| 907 | bool isEnabled = option->state & State_Enabled; | - | ||||||||||||||||||||||||||||||||||||
| 908 | bool hasFocus = (option->state & State_HasFocus && option->state & State_KeyboardFocusChange);
| 0 | ||||||||||||||||||||||||||||||||||||
| 909 | QColor buttonColor = d->buttonColor(option->palette); | - | ||||||||||||||||||||||||||||||||||||
| 910 | - | |||||||||||||||||||||||||||||||||||||
| 911 | QColor darkOutline = outline; | - | ||||||||||||||||||||||||||||||||||||
| 912 | if (hasFocus | isDefault) {
| 0 | ||||||||||||||||||||||||||||||||||||
| 913 | darkOutline = highlightedOutline; | - | ||||||||||||||||||||||||||||||||||||
| 914 | } never executed: end of block | 0 | ||||||||||||||||||||||||||||||||||||
| 915 | - | |||||||||||||||||||||||||||||||||||||
| 916 | if (isDefault)
| 0 | ||||||||||||||||||||||||||||||||||||
| 917 | buttonColor = mergedColors(buttonColor, highlightedOutline.lighter(130), 90); never executed: buttonColor = mergedColors(buttonColor, highlightedOutline.lighter(130), 90); | 0 | ||||||||||||||||||||||||||||||||||||
| 918 | - | |||||||||||||||||||||||||||||||||||||
| 919 | p->setRenderHint(QPainter::Antialiasing, true); | - | ||||||||||||||||||||||||||||||||||||
| 920 | p->translate(0.5, -0.5); | - | ||||||||||||||||||||||||||||||||||||
| 921 | - | |||||||||||||||||||||||||||||||||||||
| 922 | QLinearGradient gradient = qt_fusion_gradient(rect, (isEnabled && option->state & State_MouseOver ) ? buttonColor : buttonColor.darker(104)); | - | ||||||||||||||||||||||||||||||||||||
| 923 | p->setPen(Qt::transparent); | - | ||||||||||||||||||||||||||||||||||||
| 924 | p->setBrush(isDown ? QBrush(buttonColor.darker(110)) : gradient); | - | ||||||||||||||||||||||||||||||||||||
| 925 | p->drawRoundedRect(r, 2.0, 2.0); | - | ||||||||||||||||||||||||||||||||||||
| 926 | p->setBrush(Qt::NoBrush); | - | ||||||||||||||||||||||||||||||||||||
| 927 | - | |||||||||||||||||||||||||||||||||||||
| 928 | // Outline | - | ||||||||||||||||||||||||||||||||||||
| 929 | p->setPen(!isEnabled ? QPen(darkOutline.lighter(115)) : QPen(darkOutline)); | - | ||||||||||||||||||||||||||||||||||||
| 930 | p->drawRoundedRect(r, 2.0, 2.0); | - | ||||||||||||||||||||||||||||||||||||
| 931 | - | |||||||||||||||||||||||||||||||||||||
| 932 | p->setPen(d->innerContrastLine()); | - | ||||||||||||||||||||||||||||||||||||
| 933 | p->drawRoundedRect(r.adjusted(1, 1, -1, -1), 2.0, 2.0); | - | ||||||||||||||||||||||||||||||||||||
| 934 | - | |||||||||||||||||||||||||||||||||||||
| 935 | END_STYLE_PIXMAPCACHE never executed: end of blocknever executed: end of block
| 0 | ||||||||||||||||||||||||||||||||||||
| 936 | } | - | ||||||||||||||||||||||||||||||||||||
| 937 | break; never executed: break; | 0 | ||||||||||||||||||||||||||||||||||||
| 938 | case PE_FrameTabWidget: never executed: case PE_FrameTabWidget: | 0 | ||||||||||||||||||||||||||||||||||||
| 939 | painter->save(); | - | ||||||||||||||||||||||||||||||||||||
| 940 | painter->fillRect(option->rect.adjusted(0, 0, -1, -1), tabFrameColor); | - | ||||||||||||||||||||||||||||||||||||
| 941 | if (const QStyleOptionTabWidgetFrame *twf = qstyleoption_cast<const QStyleOptionTabWidgetFrame *>(option)) {
| 0 | ||||||||||||||||||||||||||||||||||||
| 942 | QColor borderColor = outline.lighter(110); | - | ||||||||||||||||||||||||||||||||||||
| 943 | QRect rect = option->rect.adjusted(0, 0, -1, -1); | - | ||||||||||||||||||||||||||||||||||||
| 944 | - | |||||||||||||||||||||||||||||||||||||
| 945 | // Shadow outline | - | ||||||||||||||||||||||||||||||||||||
| 946 | if (twf->shape != QTabBar::RoundedSouth) {
| 0 | ||||||||||||||||||||||||||||||||||||
| 947 | rect.adjust(0, 0, 0, -1); | - | ||||||||||||||||||||||||||||||||||||
| 948 | QColor alphaShadow(Qt::black); | - | ||||||||||||||||||||||||||||||||||||
| 949 | alphaShadow.setAlpha(15); | - | ||||||||||||||||||||||||||||||||||||
| 950 | painter->setPen(alphaShadow); | - | ||||||||||||||||||||||||||||||||||||
| 951 | painter->drawLine(option->rect.bottomLeft(), option->rect.bottomRight()); painter->setPen(borderColor); | - | ||||||||||||||||||||||||||||||||||||
| 952 | } never executed: end of block | 0 | ||||||||||||||||||||||||||||||||||||
| 953 | - | |||||||||||||||||||||||||||||||||||||
| 954 | // outline | - | ||||||||||||||||||||||||||||||||||||
| 955 | painter->setPen(outline); | - | ||||||||||||||||||||||||||||||||||||
| 956 | painter->drawRect(rect); | - | ||||||||||||||||||||||||||||||||||||
| 957 | - | |||||||||||||||||||||||||||||||||||||
| 958 | // Inner frame highlight | - | ||||||||||||||||||||||||||||||||||||
| 959 | painter->setPen(d->innerContrastLine()); | - | ||||||||||||||||||||||||||||||||||||
| 960 | painter->drawRect(rect.adjusted(1, 1, -1, -1)); | - | ||||||||||||||||||||||||||||||||||||
| 961 | - | |||||||||||||||||||||||||||||||||||||
| 962 | } never executed: end of block | 0 | ||||||||||||||||||||||||||||||||||||
| 963 | painter->restore(); | - | ||||||||||||||||||||||||||||||||||||
| 964 | break ; never executed: break ; | 0 | ||||||||||||||||||||||||||||||||||||
| 965 | - | |||||||||||||||||||||||||||||||||||||
| 966 | case PE_FrameStatusBarItem: never executed: case PE_FrameStatusBarItem: | 0 | ||||||||||||||||||||||||||||||||||||
| 967 | break; never executed: break; | 0 | ||||||||||||||||||||||||||||||||||||
| 968 | case PE_IndicatorTabClose: never executed: case PE_IndicatorTabClose: | 0 | ||||||||||||||||||||||||||||||||||||
| 969 | { | - | ||||||||||||||||||||||||||||||||||||
| 970 | Q_D(const QFusionStyle); | - | ||||||||||||||||||||||||||||||||||||
| 971 | if (d->tabBarcloseButtonIcon.isNull())
| 0 | ||||||||||||||||||||||||||||||||||||
| 972 | d->tabBarcloseButtonIcon = proxy()->standardIcon(SP_DialogCloseButton, option, widget); never executed: d->tabBarcloseButtonIcon = proxy()->standardIcon(SP_DialogCloseButton, option, widget); | 0 | ||||||||||||||||||||||||||||||||||||
| 973 | if ((option->state & State_Enabled) && (option->state & State_MouseOver))
| 0 | ||||||||||||||||||||||||||||||||||||
| 974 | proxy()->drawPrimitive(PE_PanelButtonCommand, option, painter, widget); never executed: proxy()->drawPrimitive(PE_PanelButtonCommand, option, painter, widget); | 0 | ||||||||||||||||||||||||||||||||||||
| 975 | QPixmap pixmap = d->tabBarcloseButtonIcon.pixmap(QSize(16, 16), QIcon::Normal, QIcon::On); | - | ||||||||||||||||||||||||||||||||||||
| 976 | proxy()->drawItemPixmap(painter, option->rect, Qt::AlignCenter, pixmap); | - | ||||||||||||||||||||||||||||||||||||
| 977 | } | - | ||||||||||||||||||||||||||||||||||||
| 978 | break; never executed: break; | 0 | ||||||||||||||||||||||||||||||||||||
| 979 | case PE_PanelMenu: { never executed: case PE_PanelMenu: | 0 | ||||||||||||||||||||||||||||||||||||
| 980 | painter->save(); | - | ||||||||||||||||||||||||||||||||||||
| 981 | QColor menuBackground = option->palette.base().color().lighter(108); | - | ||||||||||||||||||||||||||||||||||||
| 982 | QColor borderColor = option->palette.background().color().darker(160); | - | ||||||||||||||||||||||||||||||||||||
| 983 | painter->setPen(borderColor); | - | ||||||||||||||||||||||||||||||||||||
| 984 | painter->setBrush(menuBackground); | - | ||||||||||||||||||||||||||||||||||||
| 985 | painter->drawRect(option->rect.adjusted(0, 0, -1, -1)); | - | ||||||||||||||||||||||||||||||||||||
| 986 | painter->restore(); | - | ||||||||||||||||||||||||||||||||||||
| 987 | } | - | ||||||||||||||||||||||||||||||||||||
| 988 | break; never executed: break; | 0 | ||||||||||||||||||||||||||||||||||||
| 989 | - | |||||||||||||||||||||||||||||||||||||
| 990 | default: never executed: default: | 0 | ||||||||||||||||||||||||||||||||||||
| 991 | QCommonStyle::drawPrimitive(elem, option, painter, widget); | - | ||||||||||||||||||||||||||||||||||||
| 992 | break; never executed: break; | 0 | ||||||||||||||||||||||||||||||||||||
| 993 | } | - | ||||||||||||||||||||||||||||||||||||
| 994 | } | - | ||||||||||||||||||||||||||||||||||||
| 995 | - | |||||||||||||||||||||||||||||||||||||
| 996 | /*! | - | ||||||||||||||||||||||||||||||||||||
| 997 | \reimp | - | ||||||||||||||||||||||||||||||||||||
| 998 | */ | - | ||||||||||||||||||||||||||||||||||||
| 999 | void QFusionStyle::drawControl(ControlElement element, const QStyleOption *option, QPainter *painter, | - | ||||||||||||||||||||||||||||||||||||
| 1000 | const QWidget *widget) const | - | ||||||||||||||||||||||||||||||||||||
| 1001 | { | - | ||||||||||||||||||||||||||||||||||||
| 1002 | Q_D (const QFusionStyle); | - | ||||||||||||||||||||||||||||||||||||
| 1003 | QRect rect = option->rect; | - | ||||||||||||||||||||||||||||||||||||
| 1004 | QColor outline = d->outline(option->palette); | - | ||||||||||||||||||||||||||||||||||||
| 1005 | QColor highlightedOutline = d->highlightedOutline(option->palette); | - | ||||||||||||||||||||||||||||||||||||
| 1006 | QColor shadow = d->darkShade(); | - | ||||||||||||||||||||||||||||||||||||
| 1007 | - | |||||||||||||||||||||||||||||||||||||
| 1008 | switch (element) { | - | ||||||||||||||||||||||||||||||||||||
| 1009 | case CE_ComboBoxLabel: never executed: case CE_ComboBoxLabel: | 0 | ||||||||||||||||||||||||||||||||||||
| 1010 | if (const QStyleOptionComboBox *cb = qstyleoption_cast<const QStyleOptionComboBox *>(option)) {
| 0 | ||||||||||||||||||||||||||||||||||||
| 1011 | QRect editRect = proxy()->subControlRect(CC_ComboBox, cb, SC_ComboBoxEditField, widget); | - | ||||||||||||||||||||||||||||||||||||
| 1012 | painter->save(); | - | ||||||||||||||||||||||||||||||||||||
| 1013 | painter->setClipRect(editRect); | - | ||||||||||||||||||||||||||||||||||||
| 1014 | if (!cb->currentIcon.isNull()) {
| 0 | ||||||||||||||||||||||||||||||||||||
| 1015 | QIcon::Mode mode = cb->state & State_Enabled ? QIcon::Normal
| 0 | ||||||||||||||||||||||||||||||||||||
| 1016 | : QIcon::Disabled; | - | ||||||||||||||||||||||||||||||||||||
| 1017 | QPixmap pixmap = cb->currentIcon.pixmap(cb->iconSize, mode); | - | ||||||||||||||||||||||||||||||||||||
| 1018 | QRect iconRect(editRect); | - | ||||||||||||||||||||||||||||||||||||
| 1019 | iconRect.setWidth(cb->iconSize.width() + 4); | - | ||||||||||||||||||||||||||||||||||||
| 1020 | iconRect = alignedRect(cb->direction, | - | ||||||||||||||||||||||||||||||||||||
| 1021 | Qt::AlignLeft | Qt::AlignVCenter, | - | ||||||||||||||||||||||||||||||||||||
| 1022 | iconRect.size(), editRect); | - | ||||||||||||||||||||||||||||||||||||
| 1023 | if (cb->editable)
| 0 | ||||||||||||||||||||||||||||||||||||
| 1024 | painter->fillRect(iconRect, cb->palette.brush(QPalette::Base)); never executed: painter->fillRect(iconRect, cb->palette.brush(QPalette::Base)); | 0 | ||||||||||||||||||||||||||||||||||||
| 1025 | proxy()->drawItemPixmap(painter, iconRect, Qt::AlignCenter, pixmap); | - | ||||||||||||||||||||||||||||||||||||
| 1026 | - | |||||||||||||||||||||||||||||||||||||
| 1027 | if (cb->direction == Qt::RightToLeft)
| 0 | ||||||||||||||||||||||||||||||||||||
| 1028 | editRect.translate(-4 - cb->iconSize.width(), 0); never executed: editRect.translate(-4 - cb->iconSize.width(), 0); | 0 | ||||||||||||||||||||||||||||||||||||
| 1029 | else | - | ||||||||||||||||||||||||||||||||||||
| 1030 | editRect.translate(cb->iconSize.width() + 4, 0); never executed: editRect.translate(cb->iconSize.width() + 4, 0); | 0 | ||||||||||||||||||||||||||||||||||||
| 1031 | } | - | ||||||||||||||||||||||||||||||||||||
| 1032 | if (!cb->currentText.isEmpty() && !cb->editable) {
| 0 | ||||||||||||||||||||||||||||||||||||
| 1033 | proxy()->drawItemText(painter, editRect.adjusted(1, 0, -1, 0), | - | ||||||||||||||||||||||||||||||||||||
| 1034 | visualAlignment(cb->direction, Qt::AlignLeft | Qt::AlignVCenter), | - | ||||||||||||||||||||||||||||||||||||
| 1035 | cb->palette, cb->state & State_Enabled, cb->currentText, | - | ||||||||||||||||||||||||||||||||||||
| 1036 | cb->editable ? QPalette::Text : QPalette::ButtonText); | - | ||||||||||||||||||||||||||||||||||||
| 1037 | } never executed: end of block | 0 | ||||||||||||||||||||||||||||||||||||
| 1038 | painter->restore(); | - | ||||||||||||||||||||||||||||||||||||
| 1039 | } never executed: end of block | 0 | ||||||||||||||||||||||||||||||||||||
| 1040 | break; never executed: break; | 0 | ||||||||||||||||||||||||||||||||||||
| 1041 | case CE_Splitter: never executed: case CE_Splitter: | 0 | ||||||||||||||||||||||||||||||||||||
| 1042 | { | - | ||||||||||||||||||||||||||||||||||||
| 1043 | // Don't draw handle for single pixel splitters | - | ||||||||||||||||||||||||||||||||||||
| 1044 | if (option->rect.width() > 1 && option->rect.height() > 1) {
| 0 | ||||||||||||||||||||||||||||||||||||
| 1045 | //draw grips | - | ||||||||||||||||||||||||||||||||||||
| 1046 | if (option->state & State_Horizontal) {
| 0 | ||||||||||||||||||||||||||||||||||||
| 1047 | for (int j = -6 ; j< 12 ; j += 3) {
| 0 | ||||||||||||||||||||||||||||||||||||
| 1048 | painter->fillRect(rect.center().x() + 1, rect.center().y() + j, 2, 2, d->lightShade()); | - | ||||||||||||||||||||||||||||||||||||
| 1049 | painter->fillRect(rect.center().x() + 1, rect.center().y() + j, 1, 1, d->darkShade()); | - | ||||||||||||||||||||||||||||||||||||
| 1050 | } never executed: end of block | 0 | ||||||||||||||||||||||||||||||||||||
| 1051 | } else { never executed: end of block | 0 | ||||||||||||||||||||||||||||||||||||
| 1052 | for (int i = -6; i< 12 ; i += 3) {
| 0 | ||||||||||||||||||||||||||||||||||||
| 1053 | painter->fillRect(rect.center().x() + i, rect.center().y(), 2, 2, d->lightShade()); | - | ||||||||||||||||||||||||||||||||||||
| 1054 | painter->fillRect(rect.center().x() + i, rect.center().y(), 1, 1, d->darkShade()); | - | ||||||||||||||||||||||||||||||||||||
| 1055 | } never executed: end of block | 0 | ||||||||||||||||||||||||||||||||||||
| 1056 | } never executed: end of block | 0 | ||||||||||||||||||||||||||||||||||||
| 1057 | } | - | ||||||||||||||||||||||||||||||||||||
| 1058 | break; never executed: break; | 0 | ||||||||||||||||||||||||||||||||||||
| 1059 | } | - | ||||||||||||||||||||||||||||||||||||
| 1060 | case CE_RubberBand: never executed: case CE_RubberBand: | 0 | ||||||||||||||||||||||||||||||||||||
| 1061 | if (qstyleoption_cast<const QStyleOptionRubberBand *>(option)) {
| 0 | ||||||||||||||||||||||||||||||||||||
| 1062 | QColor highlight = option->palette.color(QPalette::Active, QPalette::Highlight); | - | ||||||||||||||||||||||||||||||||||||
| 1063 | painter->save(); | - | ||||||||||||||||||||||||||||||||||||
| 1064 | QColor penColor = highlight.darker(120); | - | ||||||||||||||||||||||||||||||||||||
| 1065 | penColor.setAlpha(180); | - | ||||||||||||||||||||||||||||||||||||
| 1066 | painter->setPen(penColor); | - | ||||||||||||||||||||||||||||||||||||
| 1067 | QColor dimHighlight(qMin(highlight.red()/2 + 110, 255), | - | ||||||||||||||||||||||||||||||||||||
| 1068 | qMin(highlight.green()/2 + 110, 255), | - | ||||||||||||||||||||||||||||||||||||
| 1069 | qMin(highlight.blue()/2 + 110, 255)); | - | ||||||||||||||||||||||||||||||||||||
| 1070 | dimHighlight.setAlpha(widget && widget->isTopLevel() ? 255 : 80); | - | ||||||||||||||||||||||||||||||||||||
| 1071 | QLinearGradient gradient(rect.topLeft(), QPoint(rect.bottomLeft().x(), rect.bottomLeft().y())); | - | ||||||||||||||||||||||||||||||||||||
| 1072 | gradient.setColorAt(0, dimHighlight.lighter(120)); | - | ||||||||||||||||||||||||||||||||||||
| 1073 | gradient.setColorAt(1, dimHighlight); | - | ||||||||||||||||||||||||||||||||||||
| 1074 | painter->setRenderHint(QPainter::Antialiasing, true); | - | ||||||||||||||||||||||||||||||||||||
| 1075 | painter->translate(0.5, 0.5); | - | ||||||||||||||||||||||||||||||||||||
| 1076 | painter->setBrush(dimHighlight); | - | ||||||||||||||||||||||||||||||||||||
| 1077 | painter->drawRoundedRect(option->rect.adjusted(0, 0, -1, -1), 1, 1); | - | ||||||||||||||||||||||||||||||||||||
| 1078 | QColor innerLine = Qt::white; | - | ||||||||||||||||||||||||||||||||||||
| 1079 | innerLine.setAlpha(40); | - | ||||||||||||||||||||||||||||||||||||
| 1080 | painter->setPen(innerLine); | - | ||||||||||||||||||||||||||||||||||||
| 1081 | painter->drawRoundedRect(option->rect.adjusted(1, 1, -2, -2), 1, 1); | - | ||||||||||||||||||||||||||||||||||||
| 1082 | painter->restore(); | - | ||||||||||||||||||||||||||||||||||||
| 1083 | } never executed: end of block | 0 | ||||||||||||||||||||||||||||||||||||
| 1084 | break; never executed: break; | 0 | ||||||||||||||||||||||||||||||||||||
| 1085 | case CE_SizeGrip: never executed: case CE_SizeGrip: | 0 | ||||||||||||||||||||||||||||||||||||
| 1086 | painter->save(); | - | ||||||||||||||||||||||||||||||||||||
| 1087 | { | - | ||||||||||||||||||||||||||||||||||||
| 1088 | //draw grips | - | ||||||||||||||||||||||||||||||||||||
| 1089 | for (int i = -6; i< 12 ; i += 3) {
| 0 | ||||||||||||||||||||||||||||||||||||
| 1090 | for (int j = -6 ; j< 12 ; j += 3) {
| 0 | ||||||||||||||||||||||||||||||||||||
| 1091 | if ((option->direction == Qt::LeftToRight && i > -j) || (option->direction == Qt::RightToLeft && j > i) ) {
| 0 | ||||||||||||||||||||||||||||||||||||
| 1092 | painter->fillRect(rect.center().x() + i, rect.center().y() + j, 2, 2, d->lightShade()); | - | ||||||||||||||||||||||||||||||||||||
| 1093 | painter->fillRect(rect.center().x() + i, rect.center().y() + j, 1, 1, d->darkShade()); | - | ||||||||||||||||||||||||||||||||||||
| 1094 | } never executed: end of block | 0 | ||||||||||||||||||||||||||||||||||||
| 1095 | } never executed: end of block | 0 | ||||||||||||||||||||||||||||||||||||
| 1096 | } never executed: end of block | 0 | ||||||||||||||||||||||||||||||||||||
| 1097 | } | - | ||||||||||||||||||||||||||||||||||||
| 1098 | painter->restore(); | - | ||||||||||||||||||||||||||||||||||||
| 1099 | break; never executed: break; | 0 | ||||||||||||||||||||||||||||||||||||
| 1100 | case CE_ToolBar: never executed: case CE_ToolBar: | 0 | ||||||||||||||||||||||||||||||||||||
| 1101 | if (const QStyleOptionToolBar *toolBar = qstyleoption_cast<const QStyleOptionToolBar *>(option)) {
| 0 | ||||||||||||||||||||||||||||||||||||
| 1102 | // Reserve the beveled appearance only for mainwindow toolbars | - | ||||||||||||||||||||||||||||||||||||
| 1103 | if (widget && !(qobject_cast<const QMainWindow*> (widget->parentWidget())))
| 0 | ||||||||||||||||||||||||||||||||||||
| 1104 | break; never executed: break; | 0 | ||||||||||||||||||||||||||||||||||||
| 1105 | - | |||||||||||||||||||||||||||||||||||||
| 1106 | // Draws the light line above and the dark line below menu bars and | - | ||||||||||||||||||||||||||||||||||||
| 1107 | // tool bars. | - | ||||||||||||||||||||||||||||||||||||
| 1108 | QLinearGradient gradient(option->rect.topLeft(), option->rect.bottomLeft()); | - | ||||||||||||||||||||||||||||||||||||
| 1109 | if (!(option->state & State_Horizontal))
| 0 | ||||||||||||||||||||||||||||||||||||
| 1110 | gradient = QLinearGradient(rect.left(), rect.center().y(), never executed: gradient = QLinearGradient(rect.left(), rect.center().y(), rect.right(), rect.center().y()); | 0 | ||||||||||||||||||||||||||||||||||||
| 1111 | rect.right(), rect.center().y()); never executed: gradient = QLinearGradient(rect.left(), rect.center().y(), rect.right(), rect.center().y()); | 0 | ||||||||||||||||||||||||||||||||||||
| 1112 | gradient.setColorAt(0, option->palette.window().color().lighter(104)); | - | ||||||||||||||||||||||||||||||||||||
| 1113 | gradient.setColorAt(1, option->palette.window().color()); | - | ||||||||||||||||||||||||||||||||||||
| 1114 | painter->fillRect(option->rect, gradient); | - | ||||||||||||||||||||||||||||||||||||
| 1115 | - | |||||||||||||||||||||||||||||||||||||
| 1116 | QColor light = d->lightShade(); | - | ||||||||||||||||||||||||||||||||||||
| 1117 | QColor shadow = d->darkShade(); | - | ||||||||||||||||||||||||||||||||||||
| 1118 | - | |||||||||||||||||||||||||||||||||||||
| 1119 | QPen oldPen = painter->pen(); | - | ||||||||||||||||||||||||||||||||||||
| 1120 | if (toolBar->toolBarArea == Qt::TopToolBarArea) {
| 0 | ||||||||||||||||||||||||||||||||||||
| 1121 | if (toolBar->positionOfLine == QStyleOptionToolBar::End
| 0 | ||||||||||||||||||||||||||||||||||||
| 1122 | || toolBar->positionOfLine == QStyleOptionToolBar::OnlyOne) {
| 0 | ||||||||||||||||||||||||||||||||||||
| 1123 | // The end and onlyone top toolbar lines draw a double | - | ||||||||||||||||||||||||||||||||||||
| 1124 | // line at the bottom to blend with the central | - | ||||||||||||||||||||||||||||||||||||
| 1125 | // widget. | - | ||||||||||||||||||||||||||||||||||||
| 1126 | painter->setPen(light); | - | ||||||||||||||||||||||||||||||||||||
| 1127 | painter->drawLine(option->rect.bottomLeft(), option->rect.bottomRight()); | - | ||||||||||||||||||||||||||||||||||||
| 1128 | painter->setPen(shadow); | - | ||||||||||||||||||||||||||||||||||||
| 1129 | painter->drawLine(option->rect.left(), option->rect.bottom() - 1, | - | ||||||||||||||||||||||||||||||||||||
| 1130 | option->rect.right(), option->rect.bottom() - 1); | - | ||||||||||||||||||||||||||||||||||||
| 1131 | } else { never executed: end of block | 0 | ||||||||||||||||||||||||||||||||||||
| 1132 | // All others draw a single dark line at the bottom. | - | ||||||||||||||||||||||||||||||||||||
| 1133 | painter->setPen(shadow); | - | ||||||||||||||||||||||||||||||||||||
| 1134 | painter->drawLine(option->rect.bottomLeft(), option->rect.bottomRight()); | - | ||||||||||||||||||||||||||||||||||||
| 1135 | } never executed: end of block | 0 | ||||||||||||||||||||||||||||||||||||
| 1136 | // All top toolbar lines draw a light line at the top. | - | ||||||||||||||||||||||||||||||||||||
| 1137 | painter->setPen(light); | - | ||||||||||||||||||||||||||||||||||||
| 1138 | painter->drawLine(option->rect.topLeft(), option->rect.topRight()); | - | ||||||||||||||||||||||||||||||||||||
| 1139 | } else if (toolBar->toolBarArea == Qt::BottomToolBarArea) { never executed: end of block
| 0 | ||||||||||||||||||||||||||||||||||||
| 1140 | if (toolBar->positionOfLine == QStyleOptionToolBar::End
| 0 | ||||||||||||||||||||||||||||||||||||
| 1141 | || toolBar->positionOfLine == QStyleOptionToolBar::Middle) {
| 0 | ||||||||||||||||||||||||||||||||||||
| 1142 | // The end and middle bottom tool bar lines draw a dark | - | ||||||||||||||||||||||||||||||||||||
| 1143 | // line at the bottom. | - | ||||||||||||||||||||||||||||||||||||
| 1144 | painter->setPen(shadow); | - | ||||||||||||||||||||||||||||||||||||
| 1145 | painter->drawLine(option->rect.bottomLeft(), option->rect.bottomRight()); | - | ||||||||||||||||||||||||||||||||||||
| 1146 | } never executed: end of block | 0 | ||||||||||||||||||||||||||||||||||||
| 1147 | if (toolBar->positionOfLine == QStyleOptionToolBar::Beginning
| 0 | ||||||||||||||||||||||||||||||||||||
| 1148 | || toolBar->positionOfLine == QStyleOptionToolBar::OnlyOne) {
| 0 | ||||||||||||||||||||||||||||||||||||
| 1149 | // The beginning and only one tool bar lines draw a | - | ||||||||||||||||||||||||||||||||||||
| 1150 | // double line at the bottom to blend with the | - | ||||||||||||||||||||||||||||||||||||
| 1151 | // status bar. | - | ||||||||||||||||||||||||||||||||||||
| 1152 | // ### The styleoption could contain whether the | - | ||||||||||||||||||||||||||||||||||||
| 1153 | // main window has a menu bar and a status bar, and | - | ||||||||||||||||||||||||||||||||||||
| 1154 | // possibly dock widgets. | - | ||||||||||||||||||||||||||||||||||||
| 1155 | painter->setPen(shadow); | - | ||||||||||||||||||||||||||||||||||||
| 1156 | painter->drawLine(option->rect.left(), option->rect.bottom() - 1, | - | ||||||||||||||||||||||||||||||||||||
| 1157 | option->rect.right(), option->rect.bottom() - 1); | - | ||||||||||||||||||||||||||||||||||||
| 1158 | painter->setPen(light); | - | ||||||||||||||||||||||||||||||||||||
| 1159 | painter->drawLine(option->rect.bottomLeft(), option->rect.bottomRight()); | - | ||||||||||||||||||||||||||||||||||||
| 1160 | } never executed: end of block | 0 | ||||||||||||||||||||||||||||||||||||
| 1161 | if (toolBar->positionOfLine == QStyleOptionToolBar::End) {
| 0 | ||||||||||||||||||||||||||||||||||||
| 1162 | painter->setPen(shadow); | - | ||||||||||||||||||||||||||||||||||||
| 1163 | painter->drawLine(option->rect.topLeft(), option->rect.topRight()); | - | ||||||||||||||||||||||||||||||||||||
| 1164 | painter->setPen(light); | - | ||||||||||||||||||||||||||||||||||||
| 1165 | painter->drawLine(option->rect.left(), option->rect.top() + 1, | - | ||||||||||||||||||||||||||||||||||||
| 1166 | option->rect.right(), option->rect.top() + 1); | - | ||||||||||||||||||||||||||||||||||||
| 1167 | - | |||||||||||||||||||||||||||||||||||||
| 1168 | } else { never executed: end of block | 0 | ||||||||||||||||||||||||||||||||||||
| 1169 | // All other bottom toolbars draw a light line at the top. | - | ||||||||||||||||||||||||||||||||||||
| 1170 | painter->setPen(light); | - | ||||||||||||||||||||||||||||||||||||
| 1171 | painter->drawLine(option->rect.topLeft(), option->rect.topRight()); | - | ||||||||||||||||||||||||||||||||||||
| 1172 | } never executed: end of block | 0 | ||||||||||||||||||||||||||||||||||||
| 1173 | } | - | ||||||||||||||||||||||||||||||||||||
| 1174 | if (toolBar->toolBarArea == Qt::LeftToolBarArea) {
| 0 | ||||||||||||||||||||||||||||||||||||
| 1175 | if (toolBar->positionOfLine == QStyleOptionToolBar::Middle
| 0 | ||||||||||||||||||||||||||||||||||||
| 1176 | || toolBar->positionOfLine == QStyleOptionToolBar::End) {
| 0 | ||||||||||||||||||||||||||||||||||||
| 1177 | // The middle and left end toolbar lines draw a light | - | ||||||||||||||||||||||||||||||||||||
| 1178 | // line to the left. | - | ||||||||||||||||||||||||||||||||||||
| 1179 | painter->setPen(light); | - | ||||||||||||||||||||||||||||||||||||
| 1180 | painter->drawLine(option->rect.topLeft(), option->rect.bottomLeft()); | - | ||||||||||||||||||||||||||||||||||||
| 1181 | } never executed: end of block | 0 | ||||||||||||||||||||||||||||||||||||
| 1182 | if (toolBar->positionOfLine == QStyleOptionToolBar::End) {
| 0 | ||||||||||||||||||||||||||||||||||||
| 1183 | // All other left toolbar lines draw a dark line to the right | - | ||||||||||||||||||||||||||||||||||||
| 1184 | painter->setPen(shadow); | - | ||||||||||||||||||||||||||||||||||||
| 1185 | painter->drawLine(option->rect.right() - 1, option->rect.top(), | - | ||||||||||||||||||||||||||||||||||||
| 1186 | option->rect.right() - 1, option->rect.bottom()); | - | ||||||||||||||||||||||||||||||||||||
| 1187 | painter->setPen(light); | - | ||||||||||||||||||||||||||||||||||||
| 1188 | painter->drawLine(option->rect.topRight(), option->rect.bottomRight()); | - | ||||||||||||||||||||||||||||||||||||
| 1189 | } else { never executed: end of block | 0 | ||||||||||||||||||||||||||||||||||||
| 1190 | // All other left toolbar lines draw a dark line to the right | - | ||||||||||||||||||||||||||||||||||||
| 1191 | painter->setPen(shadow); | - | ||||||||||||||||||||||||||||||||||||
| 1192 | painter->drawLine(option->rect.topRight(), option->rect.bottomRight()); | - | ||||||||||||||||||||||||||||||||||||
| 1193 | } never executed: end of block | 0 | ||||||||||||||||||||||||||||||||||||
| 1194 | } else if (toolBar->toolBarArea == Qt::RightToolBarArea) {
| 0 | ||||||||||||||||||||||||||||||||||||
| 1195 | if (toolBar->positionOfLine == QStyleOptionToolBar::Middle
| 0 | ||||||||||||||||||||||||||||||||||||
| 1196 | || toolBar->positionOfLine == QStyleOptionToolBar::End) {
| 0 | ||||||||||||||||||||||||||||||||||||
| 1197 | // Right middle and end toolbar lines draw the dark right line | - | ||||||||||||||||||||||||||||||||||||
| 1198 | painter->setPen(shadow); | - | ||||||||||||||||||||||||||||||||||||
| 1199 | painter->drawLine(option->rect.topRight(), option->rect.bottomRight()); | - | ||||||||||||||||||||||||||||||||||||
| 1200 | } never executed: end of block | 0 | ||||||||||||||||||||||||||||||||||||
| 1201 | if (toolBar->positionOfLine == QStyleOptionToolBar::End
| 0 | ||||||||||||||||||||||||||||||||||||
| 1202 | || toolBar->positionOfLine == QStyleOptionToolBar::OnlyOne) {
| 0 | ||||||||||||||||||||||||||||||||||||
| 1203 | // The right end and single toolbar draws the dark | - | ||||||||||||||||||||||||||||||||||||
| 1204 | // line on its left edge | - | ||||||||||||||||||||||||||||||||||||
| 1205 | painter->setPen(shadow); | - | ||||||||||||||||||||||||||||||||||||
| 1206 | painter->drawLine(option->rect.topLeft(), option->rect.bottomLeft()); | - | ||||||||||||||||||||||||||||||||||||
| 1207 | // And a light line next to it | - | ||||||||||||||||||||||||||||||||||||
| 1208 | painter->setPen(light); | - | ||||||||||||||||||||||||||||||||||||
| 1209 | painter->drawLine(option->rect.left() + 1, option->rect.top(), | - | ||||||||||||||||||||||||||||||||||||
| 1210 | option->rect.left() + 1, option->rect.bottom()); | - | ||||||||||||||||||||||||||||||||||||
| 1211 | } else { never executed: end of block | 0 | ||||||||||||||||||||||||||||||||||||
| 1212 | // Other right toolbars draw a light line on its left edge | - | ||||||||||||||||||||||||||||||||||||
| 1213 | painter->setPen(light); | - | ||||||||||||||||||||||||||||||||||||
| 1214 | painter->drawLine(option->rect.topLeft(), option->rect.bottomLeft()); | - | ||||||||||||||||||||||||||||||||||||
| 1215 | } never executed: end of block | 0 | ||||||||||||||||||||||||||||||||||||
| 1216 | } | - | ||||||||||||||||||||||||||||||||||||
| 1217 | painter->setPen(oldPen); | - | ||||||||||||||||||||||||||||||||||||
| 1218 | } never executed: end of block | 0 | ||||||||||||||||||||||||||||||||||||
| 1219 | break; never executed: break; | 0 | ||||||||||||||||||||||||||||||||||||
| 1220 | case CE_DockWidgetTitle: never executed: case CE_DockWidgetTitle: | 0 | ||||||||||||||||||||||||||||||||||||
| 1221 | painter->save(); | - | ||||||||||||||||||||||||||||||||||||
| 1222 | if (const QStyleOptionDockWidget *dwOpt = qstyleoption_cast<const QStyleOptionDockWidget *>(option)) {
| 0 | ||||||||||||||||||||||||||||||||||||
| 1223 | bool verticalTitleBar = dwOpt->verticalTitleBar; | - | ||||||||||||||||||||||||||||||||||||
| 1224 | - | |||||||||||||||||||||||||||||||||||||
| 1225 | QRect titleRect = subElementRect(SE_DockWidgetTitleBarText, option, widget); | - | ||||||||||||||||||||||||||||||||||||
| 1226 | if (verticalTitleBar) {
| 0 | ||||||||||||||||||||||||||||||||||||
| 1227 | QRect rect = dwOpt->rect; | - | ||||||||||||||||||||||||||||||||||||
| 1228 | QRect r = rect.transposed(); | - | ||||||||||||||||||||||||||||||||||||
| 1229 | titleRect = QRect(r.left() + rect.bottom() | - | ||||||||||||||||||||||||||||||||||||
| 1230 | - titleRect.bottom(), | - | ||||||||||||||||||||||||||||||||||||
| 1231 | r.top() + titleRect.left() - rect.left(), | - | ||||||||||||||||||||||||||||||||||||
| 1232 | titleRect.height(), titleRect.width()); | - | ||||||||||||||||||||||||||||||||||||
| 1233 | - | |||||||||||||||||||||||||||||||||||||
| 1234 | painter->translate(r.left(), r.top() + r.width()); | - | ||||||||||||||||||||||||||||||||||||
| 1235 | painter->rotate(-90); | - | ||||||||||||||||||||||||||||||||||||
| 1236 | painter->translate(-r.left(), -r.top()); | - | ||||||||||||||||||||||||||||||||||||
| 1237 | } never executed: end of block | 0 | ||||||||||||||||||||||||||||||||||||
| 1238 | - | |||||||||||||||||||||||||||||||||||||
| 1239 | if (!dwOpt->title.isEmpty()) {
| 0 | ||||||||||||||||||||||||||||||||||||
| 1240 | QString titleText | - | ||||||||||||||||||||||||||||||||||||
| 1241 | = painter->fontMetrics().elidedText(dwOpt->title, | - | ||||||||||||||||||||||||||||||||||||
| 1242 | Qt::ElideRight, titleRect.width()); | - | ||||||||||||||||||||||||||||||||||||
| 1243 | proxy()->drawItemText(painter, | - | ||||||||||||||||||||||||||||||||||||
| 1244 | titleRect, | - | ||||||||||||||||||||||||||||||||||||
| 1245 | Qt::AlignLeft | Qt::AlignVCenter | Qt::TextShowMnemonic, dwOpt->palette, | - | ||||||||||||||||||||||||||||||||||||
| 1246 | dwOpt->state & State_Enabled, titleText, | - | ||||||||||||||||||||||||||||||||||||
| 1247 | QPalette::WindowText); | - | ||||||||||||||||||||||||||||||||||||
| 1248 | } never executed: end of block | 0 | ||||||||||||||||||||||||||||||||||||
| 1249 | } never executed: end of block | 0 | ||||||||||||||||||||||||||||||||||||
| 1250 | painter->restore(); | - | ||||||||||||||||||||||||||||||||||||
| 1251 | break; never executed: break; | 0 | ||||||||||||||||||||||||||||||||||||
| 1252 | case CE_HeaderSection: never executed: case CE_HeaderSection: | 0 | ||||||||||||||||||||||||||||||||||||
| 1253 | painter->save(); | - | ||||||||||||||||||||||||||||||||||||
| 1254 | // Draws the header in tables. | - | ||||||||||||||||||||||||||||||||||||
| 1255 | if (const QStyleOptionHeader *header = qstyleoption_cast<const QStyleOptionHeader *>(option)) {
| 0 | ||||||||||||||||||||||||||||||||||||
| 1256 | QString pixmapName = QStyleHelper::uniqueName(QLatin1String("headersection"), option, option->rect.size()); | - | ||||||||||||||||||||||||||||||||||||
| 1257 | pixmapName += QString::number(- int(header->position)); | - | ||||||||||||||||||||||||||||||||||||
| 1258 | pixmapName += QString::number(- int(header->orientation)); | - | ||||||||||||||||||||||||||||||||||||
| 1259 | - | |||||||||||||||||||||||||||||||||||||
| 1260 | QPixmap cache; | - | ||||||||||||||||||||||||||||||||||||
| 1261 | if (!QPixmapCache::find(pixmapName, cache)) {
| 0 | ||||||||||||||||||||||||||||||||||||
| 1262 | cache = styleCachePixmap(rect.size()); | - | ||||||||||||||||||||||||||||||||||||
| 1263 | cache.fill(Qt::transparent); | - | ||||||||||||||||||||||||||||||||||||
| 1264 | QRect pixmapRect(0, 0, rect.width(), rect.height()); | - | ||||||||||||||||||||||||||||||||||||
| 1265 | QPainter cachePainter(&cache); | - | ||||||||||||||||||||||||||||||||||||
| 1266 | QColor buttonColor = d->buttonColor(option->palette); | - | ||||||||||||||||||||||||||||||||||||
| 1267 | QColor gradientStopColor; | - | ||||||||||||||||||||||||||||||||||||
| 1268 | QColor gradientStartColor = buttonColor.lighter(104); | - | ||||||||||||||||||||||||||||||||||||
| 1269 | gradientStopColor = buttonColor.darker(102); | - | ||||||||||||||||||||||||||||||||||||
| 1270 | QLinearGradient gradient(pixmapRect.topLeft(), pixmapRect.bottomLeft()); | - | ||||||||||||||||||||||||||||||||||||
| 1271 | - | |||||||||||||||||||||||||||||||||||||
| 1272 | if (option->palette.background().gradient()) {
| 0 | ||||||||||||||||||||||||||||||||||||
| 1273 | gradient.setStops(option->palette.background().gradient()->stops()); | - | ||||||||||||||||||||||||||||||||||||
| 1274 | } else { never executed: end of block | 0 | ||||||||||||||||||||||||||||||||||||
| 1275 | QColor midColor1 = mergedColors(gradientStartColor, gradientStopColor, 60); | - | ||||||||||||||||||||||||||||||||||||
| 1276 | QColor midColor2 = mergedColors(gradientStartColor, gradientStopColor, 40); | - | ||||||||||||||||||||||||||||||||||||
| 1277 | gradient.setColorAt(0, gradientStartColor); | - | ||||||||||||||||||||||||||||||||||||
| 1278 | gradient.setColorAt(0.5, midColor1); | - | ||||||||||||||||||||||||||||||||||||
| 1279 | gradient.setColorAt(0.501, midColor2); | - | ||||||||||||||||||||||||||||||||||||
| 1280 | gradient.setColorAt(0.92, gradientStopColor); | - | ||||||||||||||||||||||||||||||||||||
| 1281 | gradient.setColorAt(1, gradientStopColor.darker(104)); | - | ||||||||||||||||||||||||||||||||||||
| 1282 | } never executed: end of block | 0 | ||||||||||||||||||||||||||||||||||||
| 1283 | cachePainter.fillRect(pixmapRect, gradient); | - | ||||||||||||||||||||||||||||||||||||
| 1284 | cachePainter.setPen(d->innerContrastLine()); | - | ||||||||||||||||||||||||||||||||||||
| 1285 | cachePainter.setBrush(Qt::NoBrush); | - | ||||||||||||||||||||||||||||||||||||
| 1286 | cachePainter.drawLine(pixmapRect.topLeft(), pixmapRect.topRight()); | - | ||||||||||||||||||||||||||||||||||||
| 1287 | cachePainter.setPen(d->outline(option->palette)); | - | ||||||||||||||||||||||||||||||||||||
| 1288 | cachePainter.drawLine(pixmapRect.bottomLeft(), pixmapRect.bottomRight()); | - | ||||||||||||||||||||||||||||||||||||
| 1289 | - | |||||||||||||||||||||||||||||||||||||
| 1290 | if (header->orientation == Qt::Horizontal &&
| 0 | ||||||||||||||||||||||||||||||||||||
| 1291 | header->position != QStyleOptionHeader::End &&
| 0 | ||||||||||||||||||||||||||||||||||||
| 1292 | header->position != QStyleOptionHeader::OnlyOneSection) {
| 0 | ||||||||||||||||||||||||||||||||||||
| 1293 | cachePainter.setPen(QColor(0, 0, 0, 40)); | - | ||||||||||||||||||||||||||||||||||||
| 1294 | cachePainter.drawLine(pixmapRect.topRight(), pixmapRect.bottomRight() + QPoint(0, -1)); | - | ||||||||||||||||||||||||||||||||||||
| 1295 | cachePainter.setPen(d->innerContrastLine()); | - | ||||||||||||||||||||||||||||||||||||
| 1296 | cachePainter.drawLine(pixmapRect.topRight() + QPoint(-1, 0), pixmapRect.bottomRight() + QPoint(-1, -1)); | - | ||||||||||||||||||||||||||||||||||||
| 1297 | } else if (header->orientation == Qt::Vertical) { never executed: end of block
| 0 | ||||||||||||||||||||||||||||||||||||
| 1298 | cachePainter.setPen(d->outline(option->palette)); | - | ||||||||||||||||||||||||||||||||||||
| 1299 | cachePainter.drawLine(pixmapRect.topRight(), pixmapRect.bottomRight()); | - | ||||||||||||||||||||||||||||||||||||
| 1300 | } never executed: end of block | 0 | ||||||||||||||||||||||||||||||||||||
| 1301 | cachePainter.end(); | - | ||||||||||||||||||||||||||||||||||||
| 1302 | QPixmapCache::insert(pixmapName, cache); | - | ||||||||||||||||||||||||||||||||||||
| 1303 | } never executed: end of block | 0 | ||||||||||||||||||||||||||||||||||||
| 1304 | painter->drawPixmap(rect.topLeft(), cache); | - | ||||||||||||||||||||||||||||||||||||
| 1305 | } never executed: end of block | 0 | ||||||||||||||||||||||||||||||||||||
| 1306 | painter->restore(); | - | ||||||||||||||||||||||||||||||||||||
| 1307 | break; never executed: break; | 0 | ||||||||||||||||||||||||||||||||||||
| 1308 | case CE_ProgressBarGroove: never executed: case CE_ProgressBarGroove: | 0 | ||||||||||||||||||||||||||||||||||||
| 1309 | painter->save(); | - | ||||||||||||||||||||||||||||||||||||
| 1310 | { | - | ||||||||||||||||||||||||||||||||||||
| 1311 | painter->setRenderHint(QPainter::Antialiasing, true); | - | ||||||||||||||||||||||||||||||||||||
| 1312 | painter->translate(0.5, 0.5); | - | ||||||||||||||||||||||||||||||||||||
| 1313 | - | |||||||||||||||||||||||||||||||||||||
| 1314 | QColor shadowAlpha = Qt::black; | - | ||||||||||||||||||||||||||||||||||||
| 1315 | shadowAlpha.setAlpha(16); | - | ||||||||||||||||||||||||||||||||||||
| 1316 | painter->setPen(shadowAlpha); | - | ||||||||||||||||||||||||||||||||||||
| 1317 | painter->drawLine(rect.topLeft() - QPoint(0, 1), rect.topRight() - QPoint(0, 1)); | - | ||||||||||||||||||||||||||||||||||||
| 1318 | - | |||||||||||||||||||||||||||||||||||||
| 1319 | painter->setBrush(option->palette.base()); | - | ||||||||||||||||||||||||||||||||||||
| 1320 | painter->setPen(QPen(outline)); | - | ||||||||||||||||||||||||||||||||||||
| 1321 | painter->drawRoundedRect(rect.adjusted(0, 0, -1, -1), 2, 2); | - | ||||||||||||||||||||||||||||||||||||
| 1322 | - | |||||||||||||||||||||||||||||||||||||
| 1323 | // Inner shadow | - | ||||||||||||||||||||||||||||||||||||
| 1324 | painter->setPen(d->topShadow()); | - | ||||||||||||||||||||||||||||||||||||
| 1325 | painter->drawLine(QPoint(rect.left() + 1, rect.top() + 1), | - | ||||||||||||||||||||||||||||||||||||
| 1326 | QPoint(rect.right() - 1, rect.top() + 1)); | - | ||||||||||||||||||||||||||||||||||||
| 1327 | } | - | ||||||||||||||||||||||||||||||||||||
| 1328 | painter->restore(); | - | ||||||||||||||||||||||||||||||||||||
| 1329 | break; never executed: break; | 0 | ||||||||||||||||||||||||||||||||||||
| 1330 | case CE_ProgressBarContents: never executed: case CE_ProgressBarContents: | 0 | ||||||||||||||||||||||||||||||||||||
| 1331 | painter->save(); | - | ||||||||||||||||||||||||||||||||||||
| 1332 | painter->setRenderHint(QPainter::Antialiasing, true); | - | ||||||||||||||||||||||||||||||||||||
| 1333 | painter->translate(0.5, 0.5); | - | ||||||||||||||||||||||||||||||||||||
| 1334 | if (const QStyleOptionProgressBar *bar = qstyleoption_cast<const QStyleOptionProgressBar *>(option)) {
| 0 | ||||||||||||||||||||||||||||||||||||
| 1335 | bool vertical = false; | - | ||||||||||||||||||||||||||||||||||||
| 1336 | bool inverted = false; | - | ||||||||||||||||||||||||||||||||||||
| 1337 | bool indeterminate = (bar->minimum == 0 && bar->maximum == 0);
| 0 | ||||||||||||||||||||||||||||||||||||
| 1338 | bool complete = bar->progress == bar->maximum; | - | ||||||||||||||||||||||||||||||||||||
| 1339 | - | |||||||||||||||||||||||||||||||||||||
| 1340 | // Get extra style options if version 2 | - | ||||||||||||||||||||||||||||||||||||
| 1341 | vertical = (bar->orientation == Qt::Vertical); | - | ||||||||||||||||||||||||||||||||||||
| 1342 | inverted = bar->invertedAppearance; | - | ||||||||||||||||||||||||||||||||||||
| 1343 | - | |||||||||||||||||||||||||||||||||||||
| 1344 | // If the orientation is vertical, we use a transform to rotate | - | ||||||||||||||||||||||||||||||||||||
| 1345 | // the progress bar 90 degrees clockwise. This way we can use the | - | ||||||||||||||||||||||||||||||||||||
| 1346 | // same rendering code for both orientations. | - | ||||||||||||||||||||||||||||||||||||
| 1347 | if (vertical) {
| 0 | ||||||||||||||||||||||||||||||||||||
| 1348 | rect = QRect(rect.left(), rect.top(), rect.height(), rect.width()); // flip width and height | - | ||||||||||||||||||||||||||||||||||||
| 1349 | QTransform m = QTransform::fromTranslate(rect.height()-1, -1.0); | - | ||||||||||||||||||||||||||||||||||||
| 1350 | m.rotate(90.0); | - | ||||||||||||||||||||||||||||||||||||
| 1351 | painter->setTransform(m, true); | - | ||||||||||||||||||||||||||||||||||||
| 1352 | } never executed: end of block | 0 | ||||||||||||||||||||||||||||||||||||
| 1353 | - | |||||||||||||||||||||||||||||||||||||
| 1354 | int maxWidth = rect.width(); | - | ||||||||||||||||||||||||||||||||||||
| 1355 | int minWidth = 0; | - | ||||||||||||||||||||||||||||||||||||
| 1356 | qreal progress = qMax(bar->progress, bar->minimum); // workaround for bug in QProgressBar | - | ||||||||||||||||||||||||||||||||||||
| 1357 | int progressBarWidth = (progress - bar->minimum) * qreal(maxWidth) / qMax(qreal(1.0), qreal(bar->maximum) - bar->minimum); | - | ||||||||||||||||||||||||||||||||||||
| 1358 | int width = indeterminate ? maxWidth : qMax(minWidth, progressBarWidth);
| 0 | ||||||||||||||||||||||||||||||||||||
| 1359 | - | |||||||||||||||||||||||||||||||||||||
| 1360 | bool reverse = (!vertical && (bar->direction == Qt::RightToLeft)) || vertical;
| 0 | ||||||||||||||||||||||||||||||||||||
| 1361 | if (inverted)
| 0 | ||||||||||||||||||||||||||||||||||||
| 1362 | reverse = !reverse; never executed: reverse = !reverse; | 0 | ||||||||||||||||||||||||||||||||||||
| 1363 | - | |||||||||||||||||||||||||||||||||||||
| 1364 | int step = 0; | - | ||||||||||||||||||||||||||||||||||||
| 1365 | QRect progressBar; | - | ||||||||||||||||||||||||||||||||||||
| 1366 | QColor highlight = d->highlight(option->palette); | - | ||||||||||||||||||||||||||||||||||||
| 1367 | QColor highlightedoutline = highlight.darker(140); | - | ||||||||||||||||||||||||||||||||||||
| 1368 | if (qGray(outline.rgb()) > qGray(highlightedoutline.rgb()))
| 0 | ||||||||||||||||||||||||||||||||||||
| 1369 | outline = highlightedoutline; never executed: outline = highlightedoutline; | 0 | ||||||||||||||||||||||||||||||||||||
| 1370 | - | |||||||||||||||||||||||||||||||||||||
| 1371 | if (!indeterminate) {
| 0 | ||||||||||||||||||||||||||||||||||||
| 1372 | QColor innerShadow(Qt::black); | - | ||||||||||||||||||||||||||||||||||||
| 1373 | innerShadow.setAlpha(35); | - | ||||||||||||||||||||||||||||||||||||
| 1374 | painter->setPen(innerShadow); | - | ||||||||||||||||||||||||||||||||||||
| 1375 | if (!reverse) {
| 0 | ||||||||||||||||||||||||||||||||||||
| 1376 | progressBar.setRect(rect.left(), rect.top(), width - 1, rect.height() - 1); | - | ||||||||||||||||||||||||||||||||||||
| 1377 | if (!complete) {
| 0 | ||||||||||||||||||||||||||||||||||||
| 1378 | painter->drawLine(progressBar.topRight() + QPoint(2, 1), progressBar.bottomRight() + QPoint(2, 0)); | - | ||||||||||||||||||||||||||||||||||||
| 1379 | painter->setPen(QPen(highlight.darker(140))); | - | ||||||||||||||||||||||||||||||||||||
| 1380 | painter->drawLine(progressBar.topRight() + QPoint(1, 1), progressBar.bottomRight() + QPoint(1, 0)); | - | ||||||||||||||||||||||||||||||||||||
| 1381 | } never executed: end of block | 0 | ||||||||||||||||||||||||||||||||||||
| 1382 | } else { never executed: end of block | 0 | ||||||||||||||||||||||||||||||||||||
| 1383 | progressBar.setRect(rect.right() - width - 1, rect.top(), width + 2, rect.height() - 1); | - | ||||||||||||||||||||||||||||||||||||
| 1384 | if (!complete) {
| 0 | ||||||||||||||||||||||||||||||||||||
| 1385 | painter->drawLine(progressBar.topLeft() + QPoint(-2, 1), progressBar.bottomLeft() + QPoint(-2, 0)); | - | ||||||||||||||||||||||||||||||||||||
| 1386 | painter->setPen(QPen(highlight.darker(140))); | - | ||||||||||||||||||||||||||||||||||||
| 1387 | painter->drawLine(progressBar.topLeft() + QPoint(-1, 1), progressBar.bottomLeft() + QPoint(-1, 0)); | - | ||||||||||||||||||||||||||||||||||||
| 1388 | } never executed: end of block | 0 | ||||||||||||||||||||||||||||||||||||
| 1389 | } never executed: end of block | 0 | ||||||||||||||||||||||||||||||||||||
| 1390 | } else { | - | ||||||||||||||||||||||||||||||||||||
| 1391 | progressBar.setRect(rect.left(), rect.top(), rect.width() - 1, rect.height() - 1); | - | ||||||||||||||||||||||||||||||||||||
| 1392 | } never executed: end of block | 0 | ||||||||||||||||||||||||||||||||||||
| 1393 | - | |||||||||||||||||||||||||||||||||||||
| 1394 | if (indeterminate || bar->progress > bar->minimum) {
| 0 | ||||||||||||||||||||||||||||||||||||
| 1395 | - | |||||||||||||||||||||||||||||||||||||
| 1396 | painter->setPen(QPen(outline)); | - | ||||||||||||||||||||||||||||||||||||
| 1397 | - | |||||||||||||||||||||||||||||||||||||
| 1398 | QColor highlightedGradientStartColor = highlight.lighter(120); | - | ||||||||||||||||||||||||||||||||||||
| 1399 | QColor highlightedGradientStopColor = highlight; | - | ||||||||||||||||||||||||||||||||||||
| 1400 | QLinearGradient gradient(rect.topLeft(), QPoint(rect.bottomLeft().x(), rect.bottomLeft().y())); | - | ||||||||||||||||||||||||||||||||||||
| 1401 | gradient.setColorAt(0, highlightedGradientStartColor); | - | ||||||||||||||||||||||||||||||||||||
| 1402 | gradient.setColorAt(1, highlightedGradientStopColor); | - | ||||||||||||||||||||||||||||||||||||
| 1403 | - | |||||||||||||||||||||||||||||||||||||
| 1404 | painter->setBrush(gradient); | - | ||||||||||||||||||||||||||||||||||||
| 1405 | - | |||||||||||||||||||||||||||||||||||||
| 1406 | painter->save(); | - | ||||||||||||||||||||||||||||||||||||
| 1407 | if (!complete && !indeterminate)
| 0 | ||||||||||||||||||||||||||||||||||||
| 1408 | painter->setClipRect(progressBar.adjusted(-1, -1, -1, 1)); never executed: painter->setClipRect(progressBar.adjusted(-1, -1, -1, 1)); | 0 | ||||||||||||||||||||||||||||||||||||
| 1409 | QRect fillRect = progressBar.adjusted( !indeterminate && !complete && reverse ? -2 : 0, 0, | - | ||||||||||||||||||||||||||||||||||||
| 1410 | indeterminate || complete || reverse ? 0 : 2, 0); | - | ||||||||||||||||||||||||||||||||||||
| 1411 | painter->drawRoundedRect(fillRect, 2, 2); | - | ||||||||||||||||||||||||||||||||||||
| 1412 | painter->restore(); | - | ||||||||||||||||||||||||||||||||||||
| 1413 | - | |||||||||||||||||||||||||||||||||||||
| 1414 | painter->setBrush(Qt::NoBrush); | - | ||||||||||||||||||||||||||||||||||||
| 1415 | painter->setPen(QColor(255, 255, 255, 50)); | - | ||||||||||||||||||||||||||||||||||||
| 1416 | painter->drawRoundedRect(progressBar.adjusted(1, 1, -1, -1), 1, 1); | - | ||||||||||||||||||||||||||||||||||||
| 1417 | - | |||||||||||||||||||||||||||||||||||||
| 1418 | if (!indeterminate) {
| 0 | ||||||||||||||||||||||||||||||||||||
| 1419 | #ifndef QT_NO_ANIMATION | - | ||||||||||||||||||||||||||||||||||||
| 1420 | (const_cast<QFusionStylePrivate*>(d))->stopAnimation(option->styleObject); | - | ||||||||||||||||||||||||||||||||||||
| 1421 | #endif | - | ||||||||||||||||||||||||||||||||||||
| 1422 | } else { never executed: end of block | 0 | ||||||||||||||||||||||||||||||||||||
| 1423 | highlightedGradientStartColor.setAlpha(120); | - | ||||||||||||||||||||||||||||||||||||
| 1424 | painter->setPen(QPen(highlightedGradientStartColor, 9.0)); | - | ||||||||||||||||||||||||||||||||||||
| 1425 | painter->setClipRect(progressBar.adjusted(1, 1, -1, -1)); | - | ||||||||||||||||||||||||||||||||||||
| 1426 | #ifndef QT_NO_ANIMATION | - | ||||||||||||||||||||||||||||||||||||
| 1427 | if (QProgressStyleAnimation *animation = qobject_cast<QProgressStyleAnimation*>(d->animation(option->styleObject)))
| 0 | ||||||||||||||||||||||||||||||||||||
| 1428 | step = animation->animationStep() % 22; never executed: step = animation->animationStep() % 22; | 0 | ||||||||||||||||||||||||||||||||||||
| 1429 | else | - | ||||||||||||||||||||||||||||||||||||
| 1430 | (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 | ||||||||||||||||||||||||||||||||||||
| 1431 | #endif | - | ||||||||||||||||||||||||||||||||||||
| 1432 | for (int x = progressBar.left() - rect.height(); x < rect.right() ; x += 22)
| 0 | ||||||||||||||||||||||||||||||||||||
| 1433 | painter->drawLine(x + step, progressBar.bottom() + 1, never executed: painter->drawLine(x + step, progressBar.bottom() + 1, x + rect.height() + step, progressBar.top() - 2); | 0 | ||||||||||||||||||||||||||||||||||||
| 1434 | x + rect.height() + step, progressBar.top() - 2); never executed: painter->drawLine(x + step, progressBar.bottom() + 1, x + rect.height() + step, progressBar.top() - 2); | 0 | ||||||||||||||||||||||||||||||||||||
| 1435 | } never executed: end of block | 0 | ||||||||||||||||||||||||||||||||||||
| 1436 | } | - | ||||||||||||||||||||||||||||||||||||
| 1437 | } never executed: end of block | 0 | ||||||||||||||||||||||||||||||||||||
| 1438 | painter->restore(); | - | ||||||||||||||||||||||||||||||||||||
| 1439 | break; never executed: break; | 0 | ||||||||||||||||||||||||||||||||||||
| 1440 | case CE_ProgressBarLabel: never executed: case CE_ProgressBarLabel: | 0 | ||||||||||||||||||||||||||||||||||||
| 1441 | if (const QStyleOptionProgressBar *bar = qstyleoption_cast<const QStyleOptionProgressBar *>(option)) {
| 0 | ||||||||||||||||||||||||||||||||||||
| 1442 | QRect leftRect; | - | ||||||||||||||||||||||||||||||||||||
| 1443 | QRect rect = bar->rect; | - | ||||||||||||||||||||||||||||||||||||
| 1444 | QColor textColor = option->palette.text().color(); | - | ||||||||||||||||||||||||||||||||||||
| 1445 | QColor alternateTextColor = d->highlightedText(option->palette); | - | ||||||||||||||||||||||||||||||||||||
| 1446 | - | |||||||||||||||||||||||||||||||||||||
| 1447 | painter->save(); | - | ||||||||||||||||||||||||||||||||||||
| 1448 | bool vertical = false, inverted = false; | - | ||||||||||||||||||||||||||||||||||||
| 1449 | vertical = (bar->orientation == Qt::Vertical); | - | ||||||||||||||||||||||||||||||||||||
| 1450 | inverted = bar->invertedAppearance; | - | ||||||||||||||||||||||||||||||||||||
| 1451 | if (vertical)
| 0 | ||||||||||||||||||||||||||||||||||||
| 1452 | 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 | ||||||||||||||||||||||||||||||||||||
| 1453 | const int progressIndicatorPos = (bar->progress - qreal(bar->minimum)) * rect.width() / | - | ||||||||||||||||||||||||||||||||||||
| 1454 | qMax(qreal(1.0), qreal(bar->maximum) - bar->minimum); | - | ||||||||||||||||||||||||||||||||||||
| 1455 | if (progressIndicatorPos >= 0 && progressIndicatorPos <= rect.width())
| 0 | ||||||||||||||||||||||||||||||||||||
| 1456 | leftRect = QRect(rect.left(), rect.top(), progressIndicatorPos, rect.height()); never executed: leftRect = QRect(rect.left(), rect.top(), progressIndicatorPos, rect.height()); | 0 | ||||||||||||||||||||||||||||||||||||
| 1457 | if (vertical)
| 0 | ||||||||||||||||||||||||||||||||||||
| 1458 | leftRect.translate(rect.width() - progressIndicatorPos, 0); never executed: leftRect.translate(rect.width() - progressIndicatorPos, 0); | 0 | ||||||||||||||||||||||||||||||||||||
| 1459 | - | |||||||||||||||||||||||||||||||||||||
| 1460 | bool flip = (!vertical && (((bar->direction == Qt::RightToLeft) && !inverted) ||
| 0 | ||||||||||||||||||||||||||||||||||||
| 1461 | ((bar->direction == Qt::LeftToRight) && inverted)));
| 0 | ||||||||||||||||||||||||||||||||||||
| 1462 | - | |||||||||||||||||||||||||||||||||||||
| 1463 | QRegion rightRect = rect; | - | ||||||||||||||||||||||||||||||||||||
| 1464 | rightRect = rightRect.subtracted(leftRect); | - | ||||||||||||||||||||||||||||||||||||
| 1465 | painter->setClipRegion(rightRect); | - | ||||||||||||||||||||||||||||||||||||
| 1466 | painter->setPen(flip ? alternateTextColor : textColor); | - | ||||||||||||||||||||||||||||||||||||
| 1467 | painter->drawText(rect, bar->text, QTextOption(Qt::AlignAbsolute | Qt::AlignHCenter | Qt::AlignVCenter)); | - | ||||||||||||||||||||||||||||||||||||
| 1468 | if (!leftRect.isNull()) {
| 0 | ||||||||||||||||||||||||||||||||||||
| 1469 | painter->setPen(flip ? textColor : alternateTextColor); | - | ||||||||||||||||||||||||||||||||||||
| 1470 | painter->setClipRect(leftRect); | - | ||||||||||||||||||||||||||||||||||||
| 1471 | painter->drawText(rect, bar->text, QTextOption(Qt::AlignAbsolute | Qt::AlignHCenter | Qt::AlignVCenter)); | - | ||||||||||||||||||||||||||||||||||||
| 1472 | } never executed: end of block | 0 | ||||||||||||||||||||||||||||||||||||
| 1473 | painter->restore(); | - | ||||||||||||||||||||||||||||||||||||
| 1474 | } never executed: end of block | 0 | ||||||||||||||||||||||||||||||||||||
| 1475 | break; never executed: break; | 0 | ||||||||||||||||||||||||||||||||||||
| 1476 | case CE_MenuBarItem: never executed: case CE_MenuBarItem: | 0 | ||||||||||||||||||||||||||||||||||||
| 1477 | painter->save(); | - | ||||||||||||||||||||||||||||||||||||
| 1478 | if (const QStyleOptionMenuItem *mbi = qstyleoption_cast<const QStyleOptionMenuItem *>(option))
| 0 | ||||||||||||||||||||||||||||||||||||
| 1479 | { | - | ||||||||||||||||||||||||||||||||||||
| 1480 | QStyleOptionMenuItem item = *mbi; | - | ||||||||||||||||||||||||||||||||||||
| 1481 | item.rect = mbi->rect.adjusted(0, 1, 0, -3); | - | ||||||||||||||||||||||||||||||||||||
| 1482 | QColor highlightOutline = option->palette.highlight().color().darker(125); | - | ||||||||||||||||||||||||||||||||||||
| 1483 | painter->fillRect(rect, option->palette.window()); | - | ||||||||||||||||||||||||||||||||||||
| 1484 | - | |||||||||||||||||||||||||||||||||||||
| 1485 | QCommonStyle::drawControl(element, &item, painter, widget); | - | ||||||||||||||||||||||||||||||||||||
| 1486 | - | |||||||||||||||||||||||||||||||||||||
| 1487 | bool act = mbi->state & State_Selected && mbi->state & State_Sunken;
| 0 | ||||||||||||||||||||||||||||||||||||
| 1488 | bool dis = !(mbi->state & State_Enabled); | - | ||||||||||||||||||||||||||||||||||||
| 1489 | - | |||||||||||||||||||||||||||||||||||||
| 1490 | QRect r = option->rect; | - | ||||||||||||||||||||||||||||||||||||
| 1491 | if (act) {
| 0 | ||||||||||||||||||||||||||||||||||||
| 1492 | painter->setBrush(option->palette.highlight().color()); | - | ||||||||||||||||||||||||||||||||||||
| 1493 | painter->setPen(QPen(highlightOutline)); | - | ||||||||||||||||||||||||||||||||||||
| 1494 | painter->drawRect(r.adjusted(0, 0, -1, -1)); | - | ||||||||||||||||||||||||||||||||||||
| 1495 | - | |||||||||||||||||||||||||||||||||||||
| 1496 | // painter->drawRoundedRect(r.adjusted(1, 1, -1, -1), 2, 2); | - | ||||||||||||||||||||||||||||||||||||
| 1497 | - | |||||||||||||||||||||||||||||||||||||
| 1498 | //draw text | - | ||||||||||||||||||||||||||||||||||||
| 1499 | QPalette::ColorRole textRole = dis ? QPalette::Text : QPalette::HighlightedText;
| 0 | ||||||||||||||||||||||||||||||||||||
| 1500 | uint alignment = Qt::AlignCenter | Qt::TextShowMnemonic | Qt::TextDontClip | Qt::TextSingleLine; | - | ||||||||||||||||||||||||||||||||||||
| 1501 | if (!styleHint(SH_UnderlineShortcut, mbi, widget))
| 0 | ||||||||||||||||||||||||||||||||||||
| 1502 | alignment |= Qt::TextHideMnemonic; never executed: alignment |= Qt::TextHideMnemonic; | 0 | ||||||||||||||||||||||||||||||||||||
| 1503 | proxy()->drawItemText(painter, item.rect, alignment, mbi->palette, mbi->state & State_Enabled, mbi->text, textRole); | - | ||||||||||||||||||||||||||||||||||||
| 1504 | } else { never executed: end of block | 0 | ||||||||||||||||||||||||||||||||||||
| 1505 | - | |||||||||||||||||||||||||||||||||||||
| 1506 | QColor shadow = mergedColors(option->palette.background().color().darker(120), | - | ||||||||||||||||||||||||||||||||||||
| 1507 | outline.lighter(140), 60); | - | ||||||||||||||||||||||||||||||||||||
| 1508 | painter->setPen(QPen(shadow)); | - | ||||||||||||||||||||||||||||||||||||
| 1509 | painter->drawLine(option->rect.bottomLeft(), option->rect.bottomRight()); | - | ||||||||||||||||||||||||||||||||||||
| 1510 | } never executed: end of block | 0 | ||||||||||||||||||||||||||||||||||||
| 1511 | } | - | ||||||||||||||||||||||||||||||||||||
| 1512 | painter->restore(); | - | ||||||||||||||||||||||||||||||||||||
| 1513 | break; never executed: break; | 0 | ||||||||||||||||||||||||||||||||||||
| 1514 | case CE_MenuItem: never executed: case CE_MenuItem: | 0 | ||||||||||||||||||||||||||||||||||||
| 1515 | painter->save(); | - | ||||||||||||||||||||||||||||||||||||
| 1516 | // Draws one item in a popup menu. | - | ||||||||||||||||||||||||||||||||||||
| 1517 | if (const QStyleOptionMenuItem *menuItem = qstyleoption_cast<const QStyleOptionMenuItem *>(option)) {
| 0 | ||||||||||||||||||||||||||||||||||||
| 1518 | QColor highlightOutline = highlightedOutline; | - | ||||||||||||||||||||||||||||||||||||
| 1519 | QColor highlight = option->palette.highlight().color(); | - | ||||||||||||||||||||||||||||||||||||
| 1520 | if (menuItem->menuItemType == QStyleOptionMenuItem::Separator) {
| 0 | ||||||||||||||||||||||||||||||||||||
| 1521 | int w = 0; | - | ||||||||||||||||||||||||||||||||||||
| 1522 | if (!menuItem->text.isEmpty()) {
| 0 | ||||||||||||||||||||||||||||||||||||
| 1523 | painter->setFont(menuItem->font); | - | ||||||||||||||||||||||||||||||||||||
| 1524 | proxy()->drawItemText(painter, menuItem->rect.adjusted(5, 0, -5, 0), Qt::AlignLeft | Qt::AlignVCenter, | - | ||||||||||||||||||||||||||||||||||||
| 1525 | menuItem->palette, menuItem->state & State_Enabled, menuItem->text, | - | ||||||||||||||||||||||||||||||||||||
| 1526 | QPalette::Text); | - | ||||||||||||||||||||||||||||||||||||
| 1527 | w = menuItem->fontMetrics.width(menuItem->text) + 5; | - | ||||||||||||||||||||||||||||||||||||
| 1528 | } never executed: end of block | 0 | ||||||||||||||||||||||||||||||||||||
| 1529 | painter->setPen(shadow.lighter(106)); | - | ||||||||||||||||||||||||||||||||||||
| 1530 | bool reverse = menuItem->direction == Qt::RightToLeft; | - | ||||||||||||||||||||||||||||||||||||
| 1531 | painter->drawLine(menuItem->rect.left() + 5 + (reverse ? 0 : w), menuItem->rect.center().y(), | - | ||||||||||||||||||||||||||||||||||||
| 1532 | menuItem->rect.right() - 5 - (reverse ? w : 0), menuItem->rect.center().y()); | - | ||||||||||||||||||||||||||||||||||||
| 1533 | painter->restore(); | - | ||||||||||||||||||||||||||||||||||||
| 1534 | break; never executed: break; | 0 | ||||||||||||||||||||||||||||||||||||
| 1535 | } | - | ||||||||||||||||||||||||||||||||||||
| 1536 | bool selected = menuItem->state & State_Selected && menuItem->state & State_Enabled;
| 0 | ||||||||||||||||||||||||||||||||||||
| 1537 | if (selected) {
| 0 | ||||||||||||||||||||||||||||||||||||
| 1538 | QRect r = option->rect; | - | ||||||||||||||||||||||||||||||||||||
| 1539 | painter->fillRect(r, highlight); | - | ||||||||||||||||||||||||||||||||||||
| 1540 | painter->setPen(QPen(highlightOutline)); | - | ||||||||||||||||||||||||||||||||||||
| 1541 | painter->drawRect(QRectF(r).adjusted(0.5, 0.5, -0.5, -0.5)); | - | ||||||||||||||||||||||||||||||||||||
| 1542 | } never executed: end of block | 0 | ||||||||||||||||||||||||||||||||||||
| 1543 | bool checkable = menuItem->checkType != QStyleOptionMenuItem::NotCheckable; | - | ||||||||||||||||||||||||||||||||||||
| 1544 | bool checked = menuItem->checked; | - | ||||||||||||||||||||||||||||||||||||
| 1545 | bool sunken = menuItem->state & State_Sunken; | - | ||||||||||||||||||||||||||||||||||||
| 1546 | bool enabled = menuItem->state & State_Enabled; | - | ||||||||||||||||||||||||||||||||||||
| 1547 | - | |||||||||||||||||||||||||||||||||||||
| 1548 | bool ignoreCheckMark = false; | - | ||||||||||||||||||||||||||||||||||||
| 1549 | int checkcol = qMax(menuItem->maxIconWidth, 20); | - | ||||||||||||||||||||||||||||||||||||
| 1550 | - | |||||||||||||||||||||||||||||||||||||
| 1551 | if (qobject_cast<const QComboBox*>(widget) ||
| 0 | ||||||||||||||||||||||||||||||||||||
| 1552 | (option->styleObject && option->styleObject->property("_q_isComboBoxPopupItem").toBool()))
| 0 | ||||||||||||||||||||||||||||||||||||
| 1553 | ignoreCheckMark = true; //ignore the checkmarks provided by the QComboMenuDelegate never executed: ignoreCheckMark = true; | 0 | ||||||||||||||||||||||||||||||||||||
| 1554 | - | |||||||||||||||||||||||||||||||||||||
| 1555 | if (!ignoreCheckMark) {
| 0 | ||||||||||||||||||||||||||||||||||||
| 1556 | // Check | - | ||||||||||||||||||||||||||||||||||||
| 1557 | QRect checkRect(option->rect.left() + 7, option->rect.center().y() - 6, 14, 14); | - | ||||||||||||||||||||||||||||||||||||
| 1558 | checkRect = visualRect(menuItem->direction, menuItem->rect, checkRect); | - | ||||||||||||||||||||||||||||||||||||
| 1559 | if (checkable) {
| 0 | ||||||||||||||||||||||||||||||||||||
| 1560 | if (menuItem->checkType & QStyleOptionMenuItem::Exclusive) {
| 0 | ||||||||||||||||||||||||||||||||||||
| 1561 | // Radio button | - | ||||||||||||||||||||||||||||||||||||
| 1562 | if (checked || sunken) {
| 0 | ||||||||||||||||||||||||||||||||||||
| 1563 | painter->setRenderHint(QPainter::Antialiasing); | - | ||||||||||||||||||||||||||||||||||||
| 1564 | painter->setPen(Qt::NoPen); | - | ||||||||||||||||||||||||||||||||||||
| 1565 | - | |||||||||||||||||||||||||||||||||||||
| 1566 | QPalette::ColorRole textRole = !enabled ? QPalette::Text:
| 0 | ||||||||||||||||||||||||||||||||||||
| 1567 | selected ? QPalette::HighlightedText : QPalette::ButtonText;
| 0 | ||||||||||||||||||||||||||||||||||||
| 1568 | painter->setBrush(option->palette.brush( option->palette.currentColorGroup(), textRole)); | - | ||||||||||||||||||||||||||||||||||||
| 1569 | painter->drawEllipse(checkRect.adjusted(4, 4, -4, -4)); | - | ||||||||||||||||||||||||||||||||||||
| 1570 | } never executed: end of block | 0 | ||||||||||||||||||||||||||||||||||||
| 1571 | } else { never executed: end of block | 0 | ||||||||||||||||||||||||||||||||||||
| 1572 | // Check box | - | ||||||||||||||||||||||||||||||||||||
| 1573 | if (menuItem->icon.isNull()) {
| 0 | ||||||||||||||||||||||||||||||||||||
| 1574 | QStyleOptionButton box; | - | ||||||||||||||||||||||||||||||||||||
| 1575 | box.QStyleOption::operator=(*option); | - | ||||||||||||||||||||||||||||||||||||
| 1576 | box.rect = checkRect; | - | ||||||||||||||||||||||||||||||||||||
| 1577 | if (checked)
| 0 | ||||||||||||||||||||||||||||||||||||
| 1578 | box.state |= State_On; never executed: box.state |= State_On; | 0 | ||||||||||||||||||||||||||||||||||||
| 1579 | proxy()->drawPrimitive(PE_IndicatorCheckBox, &box, painter, widget); | - | ||||||||||||||||||||||||||||||||||||
| 1580 | } never executed: end of block | 0 | ||||||||||||||||||||||||||||||||||||
| 1581 | } never executed: end of block | 0 | ||||||||||||||||||||||||||||||||||||
| 1582 | } | - | ||||||||||||||||||||||||||||||||||||
| 1583 | } else { //ignore checkmark never executed: end of block | 0 | ||||||||||||||||||||||||||||||||||||
| 1584 | if (menuItem->icon.isNull())
| 0 | ||||||||||||||||||||||||||||||||||||
| 1585 | checkcol = 0; never executed: checkcol = 0; | 0 | ||||||||||||||||||||||||||||||||||||
| 1586 | else | - | ||||||||||||||||||||||||||||||||||||
| 1587 | checkcol = menuItem->maxIconWidth; never executed: checkcol = menuItem->maxIconWidth; | 0 | ||||||||||||||||||||||||||||||||||||
| 1588 | } | - | ||||||||||||||||||||||||||||||||||||
| 1589 | - | |||||||||||||||||||||||||||||||||||||
| 1590 | // Text and icon, ripped from windows style | - | ||||||||||||||||||||||||||||||||||||
| 1591 | bool dis = !(menuItem->state & State_Enabled); | - | ||||||||||||||||||||||||||||||||||||
| 1592 | bool act = menuItem->state & State_Selected; | - | ||||||||||||||||||||||||||||||||||||
| 1593 | const QStyleOption *opt = option; | - | ||||||||||||||||||||||||||||||||||||
| 1594 | const QStyleOptionMenuItem *menuitem = menuItem; | - | ||||||||||||||||||||||||||||||||||||
| 1595 | - | |||||||||||||||||||||||||||||||||||||
| 1596 | QPainter *p = painter; | - | ||||||||||||||||||||||||||||||||||||
| 1597 | QRect vCheckRect = visualRect(opt->direction, menuitem->rect, | - | ||||||||||||||||||||||||||||||||||||
| 1598 | QRect(menuitem->rect.x() + 4, menuitem->rect.y(), | - | ||||||||||||||||||||||||||||||||||||
| 1599 | checkcol, menuitem->rect.height())); | - | ||||||||||||||||||||||||||||||||||||
| 1600 | if (!menuItem->icon.isNull()) {
| 0 | ||||||||||||||||||||||||||||||||||||
| 1601 | QIcon::Mode mode = dis ? QIcon::Disabled : QIcon::Normal;
| 0 | ||||||||||||||||||||||||||||||||||||
| 1602 | if (act && !dis)
| 0 | ||||||||||||||||||||||||||||||||||||
| 1603 | mode = QIcon::Active; never executed: mode = QIcon::Active; | 0 | ||||||||||||||||||||||||||||||||||||
| 1604 | QPixmap pixmap; | - | ||||||||||||||||||||||||||||||||||||
| 1605 | - | |||||||||||||||||||||||||||||||||||||
| 1606 | int smallIconSize = proxy()->pixelMetric(PM_SmallIconSize, option, widget); | - | ||||||||||||||||||||||||||||||||||||
| 1607 | QSize iconSize(smallIconSize, smallIconSize); | - | ||||||||||||||||||||||||||||||||||||
| 1608 | if (const QComboBox *combo = qobject_cast<const QComboBox*>(widget))
| 0 | ||||||||||||||||||||||||||||||||||||
| 1609 | iconSize = combo->iconSize(); never executed: iconSize = combo->iconSize(); | 0 | ||||||||||||||||||||||||||||||||||||
| 1610 | if (checked)
| 0 | ||||||||||||||||||||||||||||||||||||
| 1611 | pixmap = menuItem->icon.pixmap(iconSize, mode, QIcon::On); never executed: pixmap = menuItem->icon.pixmap(iconSize, mode, QIcon::On); | 0 | ||||||||||||||||||||||||||||||||||||
| 1612 | else | - | ||||||||||||||||||||||||||||||||||||
| 1613 | pixmap = menuItem->icon.pixmap(iconSize, mode); never executed: pixmap = menuItem->icon.pixmap(iconSize, mode); | 0 | ||||||||||||||||||||||||||||||||||||
| 1614 | - | |||||||||||||||||||||||||||||||||||||
| 1615 | const int pixw = pixmap.width() / pixmap.devicePixelRatio(); | - | ||||||||||||||||||||||||||||||||||||
| 1616 | const int pixh = pixmap.height() / pixmap.devicePixelRatio(); | - | ||||||||||||||||||||||||||||||||||||
| 1617 | - | |||||||||||||||||||||||||||||||||||||
| 1618 | QRect pmr(0, 0, pixw, pixh); | - | ||||||||||||||||||||||||||||||||||||
| 1619 | pmr.moveCenter(vCheckRect.center()); | - | ||||||||||||||||||||||||||||||||||||
| 1620 | painter->setPen(menuItem->palette.text().color()); | - | ||||||||||||||||||||||||||||||||||||
| 1621 | if (!ignoreCheckMark && checkable && checked) {
| 0 | ||||||||||||||||||||||||||||||||||||
| 1622 | QStyleOption opt = *option; | - | ||||||||||||||||||||||||||||||||||||
| 1623 | if (act) {
| 0 | ||||||||||||||||||||||||||||||||||||
| 1624 | QColor activeColor = mergedColors(option->palette.background().color(), | - | ||||||||||||||||||||||||||||||||||||
| 1625 | option->palette.highlight().color()); | - | ||||||||||||||||||||||||||||||||||||
| 1626 | opt.palette.setBrush(QPalette::Button, activeColor); | - | ||||||||||||||||||||||||||||||||||||
| 1627 | } never executed: end of block | 0 | ||||||||||||||||||||||||||||||||||||
| 1628 | opt.state |= State_Sunken; | - | ||||||||||||||||||||||||||||||||||||
| 1629 | opt.rect = vCheckRect; | - | ||||||||||||||||||||||||||||||||||||
| 1630 | proxy()->drawPrimitive(PE_PanelButtonCommand, &opt, painter, widget); | - | ||||||||||||||||||||||||||||||||||||
| 1631 | } never executed: end of block | 0 | ||||||||||||||||||||||||||||||||||||
| 1632 | painter->drawPixmap(pmr.topLeft(), pixmap); | - | ||||||||||||||||||||||||||||||||||||
| 1633 | } never executed: end of block | 0 | ||||||||||||||||||||||||||||||||||||
| 1634 | if (selected) {
| 0 | ||||||||||||||||||||||||||||||||||||
| 1635 | painter->setPen(menuItem->palette.highlightedText().color()); | - | ||||||||||||||||||||||||||||||||||||
| 1636 | } else { never executed: end of block | 0 | ||||||||||||||||||||||||||||||||||||
| 1637 | painter->setPen(menuItem->palette.text().color()); | - | ||||||||||||||||||||||||||||||||||||
| 1638 | } never executed: end of block | 0 | ||||||||||||||||||||||||||||||||||||
| 1639 | int x, y, w, h; | - | ||||||||||||||||||||||||||||||||||||
| 1640 | menuitem->rect.getRect(&x, &y, &w, &h); | - | ||||||||||||||||||||||||||||||||||||
| 1641 | int tab = menuitem->tabWidth; | - | ||||||||||||||||||||||||||||||||||||
| 1642 | QColor discol; | - | ||||||||||||||||||||||||||||||||||||
| 1643 | if (dis) {
| 0 | ||||||||||||||||||||||||||||||||||||
| 1644 | discol = menuitem->palette.text().color(); | - | ||||||||||||||||||||||||||||||||||||
| 1645 | p->setPen(discol); | - | ||||||||||||||||||||||||||||||||||||
| 1646 | } never executed: end of block | 0 | ||||||||||||||||||||||||||||||||||||
| 1647 | int xm = windowsItemFrame + checkcol + windowsItemHMargin + 2; | - | ||||||||||||||||||||||||||||||||||||
| 1648 | int xpos = menuitem->rect.x() + xm; | - | ||||||||||||||||||||||||||||||||||||
| 1649 | - | |||||||||||||||||||||||||||||||||||||
| 1650 | QRect textRect(xpos, y + windowsItemVMargin, w - xm - windowsRightBorder - tab + 1, h - 2 * windowsItemVMargin); | - | ||||||||||||||||||||||||||||||||||||
| 1651 | QRect vTextRect = visualRect(opt->direction, menuitem->rect, textRect); | - | ||||||||||||||||||||||||||||||||||||
| 1652 | QStringRef s(&menuitem->text); | - | ||||||||||||||||||||||||||||||||||||
| 1653 | if (!s.isEmpty()) { // draw text
| 0 | ||||||||||||||||||||||||||||||||||||
| 1654 | p->save(); | - | ||||||||||||||||||||||||||||||||||||
| 1655 | int t = s.indexOf(QLatin1Char('\t')); | - | ||||||||||||||||||||||||||||||||||||
| 1656 | int text_flags = Qt::AlignVCenter | Qt::TextShowMnemonic | Qt::TextDontClip | Qt::TextSingleLine; | - | ||||||||||||||||||||||||||||||||||||
| 1657 | if (!styleHint(SH_UnderlineShortcut, menuitem, widget))
| 0 | ||||||||||||||||||||||||||||||||||||
| 1658 | text_flags |= Qt::TextHideMnemonic; never executed: text_flags |= Qt::TextHideMnemonic; | 0 | ||||||||||||||||||||||||||||||||||||
| 1659 | text_flags |= Qt::AlignLeft; | - | ||||||||||||||||||||||||||||||||||||
| 1660 | if (t >= 0) {
| 0 | ||||||||||||||||||||||||||||||||||||
| 1661 | QRect vShortcutRect = visualRect(opt->direction, menuitem->rect, | - | ||||||||||||||||||||||||||||||||||||
| 1662 | QRect(textRect.topRight(), QPoint(menuitem->rect.right(), textRect.bottom()))); | - | ||||||||||||||||||||||||||||||||||||
| 1663 | const QString textToDraw = s.mid(t + 1).toString(); | - | ||||||||||||||||||||||||||||||||||||
| 1664 | if (dis && !act && proxy()->styleHint(SH_EtchDisabledText, option, widget)) {
| 0 | ||||||||||||||||||||||||||||||||||||
| 1665 | p->setPen(menuitem->palette.light().color()); | - | ||||||||||||||||||||||||||||||||||||
| 1666 | p->drawText(vShortcutRect.adjusted(1, 1, 1, 1), text_flags, textToDraw); | - | ||||||||||||||||||||||||||||||||||||
| 1667 | p->setPen(discol); | - | ||||||||||||||||||||||||||||||||||||
| 1668 | } never executed: end of block | 0 | ||||||||||||||||||||||||||||||||||||
| 1669 | p->drawText(vShortcutRect, text_flags, textToDraw); | - | ||||||||||||||||||||||||||||||||||||
| 1670 | s = s.left(t); | - | ||||||||||||||||||||||||||||||||||||
| 1671 | } never executed: end of block | 0 | ||||||||||||||||||||||||||||||||||||
| 1672 | QFont font = menuitem->font; | - | ||||||||||||||||||||||||||||||||||||
| 1673 | // font may not have any "hard" flags set. We override | - | ||||||||||||||||||||||||||||||||||||
| 1674 | // the point size so that when it is resolved against the device, this font will win. | - | ||||||||||||||||||||||||||||||||||||
| 1675 | // This is mainly to handle cases where someone sets the font on the window | - | ||||||||||||||||||||||||||||||||||||
| 1676 | // and then the combo inherits it and passes it onward. At that point the resolve mask | - | ||||||||||||||||||||||||||||||||||||
| 1677 | // is very, very weak. This makes it stonger. | - | ||||||||||||||||||||||||||||||||||||
| 1678 | font.setPointSizeF(QFontInfo(menuItem->font).pointSizeF()); | - | ||||||||||||||||||||||||||||||||||||
| 1679 | - | |||||||||||||||||||||||||||||||||||||
| 1680 | if (menuitem->menuItemType == QStyleOptionMenuItem::DefaultItem)
| 0 | ||||||||||||||||||||||||||||||||||||
| 1681 | font.setBold(true); never executed: font.setBold(true); | 0 | ||||||||||||||||||||||||||||||||||||
| 1682 | - | |||||||||||||||||||||||||||||||||||||
| 1683 | p->setFont(font); | - | ||||||||||||||||||||||||||||||||||||
| 1684 | const QString textToDraw = s.left(t).toString(); | - | ||||||||||||||||||||||||||||||||||||
| 1685 | if (dis && !act && proxy()->styleHint(SH_EtchDisabledText, option, widget)) {
| 0 | ||||||||||||||||||||||||||||||||||||
| 1686 | p->setPen(menuitem->palette.light().color()); | - | ||||||||||||||||||||||||||||||||||||
| 1687 | p->drawText(vTextRect.adjusted(1, 1, 1, 1), text_flags, textToDraw); | - | ||||||||||||||||||||||||||||||||||||
| 1688 | p->setPen(discol); | - | ||||||||||||||||||||||||||||||||||||
| 1689 | } never executed: end of block | 0 | ||||||||||||||||||||||||||||||||||||
| 1690 | p->drawText(vTextRect, text_flags, textToDraw); | - | ||||||||||||||||||||||||||||||||||||
| 1691 | p->restore(); | - | ||||||||||||||||||||||||||||||||||||
| 1692 | } never executed: end of block | 0 | ||||||||||||||||||||||||||||||||||||
| 1693 | - | |||||||||||||||||||||||||||||||||||||
| 1694 | // Arrow | - | ||||||||||||||||||||||||||||||||||||
| 1695 | if (menuItem->menuItemType == QStyleOptionMenuItem::SubMenu) {// draw sub menu arrow
| 0 | ||||||||||||||||||||||||||||||||||||
| 1696 | int dim = (menuItem->rect.height() - 4) / 2; | - | ||||||||||||||||||||||||||||||||||||
| 1697 | PrimitiveElement arrow; | - | ||||||||||||||||||||||||||||||||||||
| 1698 | arrow = option->direction == Qt::RightToLeft ? PE_IndicatorArrowLeft : PE_IndicatorArrowRight;
| 0 | ||||||||||||||||||||||||||||||||||||
| 1699 | int xpos = menuItem->rect.left() + menuItem->rect.width() - 3 - dim; | - | ||||||||||||||||||||||||||||||||||||
| 1700 | QRect vSubMenuRect = visualRect(option->direction, menuItem->rect, | - | ||||||||||||||||||||||||||||||||||||
| 1701 | QRect(xpos, menuItem->rect.top() + menuItem->rect.height() / 2 - dim / 2, dim, dim)); | - | ||||||||||||||||||||||||||||||||||||
| 1702 | QStyleOptionMenuItem newMI = *menuItem; | - | ||||||||||||||||||||||||||||||||||||
| 1703 | newMI.rect = vSubMenuRect; | - | ||||||||||||||||||||||||||||||||||||
| 1704 | newMI.state = !enabled ? State_None : State_Enabled;
| 0 | ||||||||||||||||||||||||||||||||||||
| 1705 | if (selected)
| 0 | ||||||||||||||||||||||||||||||||||||
| 1706 | newMI.palette.setColor(QPalette::Foreground, never executed: newMI.palette.setColor(QPalette::Foreground, newMI.palette.highlightedText().color()); | 0 | ||||||||||||||||||||||||||||||||||||
| 1707 | newMI.palette.highlightedText().color()); never executed: newMI.palette.setColor(QPalette::Foreground, newMI.palette.highlightedText().color()); | 0 | ||||||||||||||||||||||||||||||||||||
| 1708 | proxy()->drawPrimitive(arrow, &newMI, painter, widget); | - | ||||||||||||||||||||||||||||||||||||
| 1709 | } never executed: end of block | 0 | ||||||||||||||||||||||||||||||||||||
| 1710 | } never executed: end of block | 0 | ||||||||||||||||||||||||||||||||||||
| 1711 | painter->restore(); | - | ||||||||||||||||||||||||||||||||||||
| 1712 | break; never executed: break; | 0 | ||||||||||||||||||||||||||||||||||||
| 1713 | case CE_MenuHMargin: never executed: case CE_MenuHMargin: | 0 | ||||||||||||||||||||||||||||||||||||
| 1714 | case CE_MenuVMargin: never executed: case CE_MenuVMargin: | 0 | ||||||||||||||||||||||||||||||||||||
| 1715 | break; never executed: break; | 0 | ||||||||||||||||||||||||||||||||||||
| 1716 | case CE_MenuEmptyArea: never executed: case CE_MenuEmptyArea: | 0 | ||||||||||||||||||||||||||||||||||||
| 1717 | break; never executed: break; | 0 | ||||||||||||||||||||||||||||||||||||
| 1718 | case CE_PushButton: never executed: case CE_PushButton: | 0 | ||||||||||||||||||||||||||||||||||||
| 1719 | if (const QStyleOptionButton *btn = qstyleoption_cast<const QStyleOptionButton *>(option)) {
| 0 | ||||||||||||||||||||||||||||||||||||
| 1720 | proxy()->drawControl(CE_PushButtonBevel, btn, painter, widget); | - | ||||||||||||||||||||||||||||||||||||
| 1721 | QStyleOptionButton subopt = *btn; | - | ||||||||||||||||||||||||||||||||||||
| 1722 | subopt.rect = subElementRect(SE_PushButtonContents, btn, widget); | - | ||||||||||||||||||||||||||||||||||||
| 1723 | proxy()->drawControl(CE_PushButtonLabel, &subopt, painter, widget); | - | ||||||||||||||||||||||||||||||||||||
| 1724 | } never executed: end of block | 0 | ||||||||||||||||||||||||||||||||||||
| 1725 | break; never executed: break; | 0 | ||||||||||||||||||||||||||||||||||||
| 1726 | case CE_PushButtonLabel: never executed: case CE_PushButtonLabel: | 0 | ||||||||||||||||||||||||||||||||||||
| 1727 | if (const QStyleOptionButton *button = qstyleoption_cast<const QStyleOptionButton *>(option)) {
| 0 | ||||||||||||||||||||||||||||||||||||
| 1728 | QRect ir = button->rect; | - | ||||||||||||||||||||||||||||||||||||
| 1729 | uint tf = Qt::AlignVCenter; | - | ||||||||||||||||||||||||||||||||||||
| 1730 | if (styleHint(SH_UnderlineShortcut, button, widget))
| 0 | ||||||||||||||||||||||||||||||||||||
| 1731 | tf |= Qt::TextShowMnemonic; never executed: tf |= Qt::TextShowMnemonic; | 0 | ||||||||||||||||||||||||||||||||||||
| 1732 | else | - | ||||||||||||||||||||||||||||||||||||
| 1733 | tf |= Qt::TextHideMnemonic; never executed: tf |= Qt::TextHideMnemonic; | 0 | ||||||||||||||||||||||||||||||||||||
| 1734 | - | |||||||||||||||||||||||||||||||||||||
| 1735 | if (!button->icon.isNull()) {
| 0 | ||||||||||||||||||||||||||||||||||||
| 1736 | //Center both icon and text | - | ||||||||||||||||||||||||||||||||||||
| 1737 | QPoint point; | - | ||||||||||||||||||||||||||||||||||||
| 1738 | - | |||||||||||||||||||||||||||||||||||||
| 1739 | QIcon::Mode mode = button->state & State_Enabled ? QIcon::Normal
| 0 | ||||||||||||||||||||||||||||||||||||
| 1740 | : QIcon::Disabled; | - | ||||||||||||||||||||||||||||||||||||
| 1741 | if (mode == QIcon::Normal && button->state & State_HasFocus)
| 0 | ||||||||||||||||||||||||||||||||||||
| 1742 | mode = QIcon::Active; never executed: mode = QIcon::Active; | 0 | ||||||||||||||||||||||||||||||||||||
| 1743 | QIcon::State state = QIcon::Off; | - | ||||||||||||||||||||||||||||||||||||
| 1744 | if (button->state & State_On)
| 0 | ||||||||||||||||||||||||||||||||||||
| 1745 | state = QIcon::On; never executed: state = QIcon::On; | 0 | ||||||||||||||||||||||||||||||||||||
| 1746 | - | |||||||||||||||||||||||||||||||||||||
| 1747 | QPixmap pixmap = button->icon.pixmap(button->iconSize, mode, state); | - | ||||||||||||||||||||||||||||||||||||
| 1748 | int w = pixmap.width() / pixmap.devicePixelRatio(); | - | ||||||||||||||||||||||||||||||||||||
| 1749 | int h = pixmap.height() / pixmap.devicePixelRatio(); | - | ||||||||||||||||||||||||||||||||||||
| 1750 | - | |||||||||||||||||||||||||||||||||||||
| 1751 | if (!button->text.isEmpty())
| 0 | ||||||||||||||||||||||||||||||||||||
| 1752 | 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 | ||||||||||||||||||||||||||||||||||||
| 1753 | - | |||||||||||||||||||||||||||||||||||||
| 1754 | point = QPoint(ir.x() + ir.width() / 2 - w / 2, | - | ||||||||||||||||||||||||||||||||||||
| 1755 | ir.y() + ir.height() / 2 - h / 2); | - | ||||||||||||||||||||||||||||||||||||
| 1756 | - | |||||||||||||||||||||||||||||||||||||
| 1757 | w = pixmap.width() / pixmap.devicePixelRatio(); | - | ||||||||||||||||||||||||||||||||||||
| 1758 | - | |||||||||||||||||||||||||||||||||||||
| 1759 | if (button->direction == Qt::RightToLeft)
| 0 | ||||||||||||||||||||||||||||||||||||
| 1760 | point.rx() += w; never executed: point.rx() += w; | 0 | ||||||||||||||||||||||||||||||||||||
| 1761 | - | |||||||||||||||||||||||||||||||||||||
| 1762 | painter->drawPixmap(visualPos(button->direction, button->rect, point), pixmap); | - | ||||||||||||||||||||||||||||||||||||
| 1763 | - | |||||||||||||||||||||||||||||||||||||
| 1764 | if (button->direction == Qt::RightToLeft)
| 0 | ||||||||||||||||||||||||||||||||||||
| 1765 | ir.translate(-point.x() - 2, 0); never executed: ir.translate(-point.x() - 2, 0); | 0 | ||||||||||||||||||||||||||||||||||||
| 1766 | else | - | ||||||||||||||||||||||||||||||||||||
| 1767 | ir.translate(point.x() + w, 0); never executed: ir.translate(point.x() + w, 0); | 0 | ||||||||||||||||||||||||||||||||||||
| 1768 | - | |||||||||||||||||||||||||||||||||||||
| 1769 | // left-align text if there is | - | ||||||||||||||||||||||||||||||||||||
| 1770 | if (!button->text.isEmpty())
| 0 | ||||||||||||||||||||||||||||||||||||
| 1771 | tf |= Qt::AlignLeft; never executed: tf |= Qt::AlignLeft; | 0 | ||||||||||||||||||||||||||||||||||||
| 1772 | - | |||||||||||||||||||||||||||||||||||||
| 1773 | } else { never executed: end of block | 0 | ||||||||||||||||||||||||||||||||||||
| 1774 | tf |= Qt::AlignHCenter; | - | ||||||||||||||||||||||||||||||||||||
| 1775 | } never executed: end of block | 0 | ||||||||||||||||||||||||||||||||||||
| 1776 | - | |||||||||||||||||||||||||||||||||||||
| 1777 | if (button->features & QStyleOptionButton::HasMenu)
| 0 | ||||||||||||||||||||||||||||||||||||
| 1778 | 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 | ||||||||||||||||||||||||||||||||||||
| 1779 | proxy()->drawItemText(painter, ir, tf, button->palette, (button->state & State_Enabled), | - | ||||||||||||||||||||||||||||||||||||
| 1780 | button->text, QPalette::ButtonText); | - | ||||||||||||||||||||||||||||||||||||
| 1781 | } never executed: end of block | 0 | ||||||||||||||||||||||||||||||||||||
| 1782 | break; never executed: break; | 0 | ||||||||||||||||||||||||||||||||||||
| 1783 | case CE_MenuBarEmptyArea: never executed: case CE_MenuBarEmptyArea: | 0 | ||||||||||||||||||||||||||||||||||||
| 1784 | painter->save(); | - | ||||||||||||||||||||||||||||||||||||
| 1785 | { | - | ||||||||||||||||||||||||||||||||||||
| 1786 | painter->fillRect(rect, option->palette.window()); | - | ||||||||||||||||||||||||||||||||||||
| 1787 | QColor shadow = mergedColors(option->palette.background().color().darker(120), | - | ||||||||||||||||||||||||||||||||||||
| 1788 | outline.lighter(140), 60); | - | ||||||||||||||||||||||||||||||||||||
| 1789 | painter->setPen(QPen(shadow)); | - | ||||||||||||||||||||||||||||||||||||
| 1790 | painter->drawLine(option->rect.bottomLeft(), option->rect.bottomRight()); | - | ||||||||||||||||||||||||||||||||||||
| 1791 | } | - | ||||||||||||||||||||||||||||||||||||
| 1792 | painter->restore(); | - | ||||||||||||||||||||||||||||||||||||
| 1793 | break; never executed: break; | 0 | ||||||||||||||||||||||||||||||||||||
| 1794 | case CE_TabBarTabShape: never executed: case CE_TabBarTabShape: | 0 | ||||||||||||||||||||||||||||||||||||
| 1795 | painter->save(); | - | ||||||||||||||||||||||||||||||||||||
| 1796 | if (const QStyleOptionTab *tab = qstyleoption_cast<const QStyleOptionTab *>(option)) {
| 0 | ||||||||||||||||||||||||||||||||||||
| 1797 | - | |||||||||||||||||||||||||||||||||||||
| 1798 | bool rtlHorTabs = (tab->direction == Qt::RightToLeft
| 0 | ||||||||||||||||||||||||||||||||||||
| 1799 | && (tab->shape == QTabBar::RoundedNorth
| 0 | ||||||||||||||||||||||||||||||||||||
| 1800 | || tab->shape == QTabBar::RoundedSouth));
| 0 | ||||||||||||||||||||||||||||||||||||
| 1801 | bool selected = tab->state & State_Selected; | - | ||||||||||||||||||||||||||||||||||||
| 1802 | bool lastTab = ((!rtlHorTabs && tab->position == QStyleOptionTab::End)
| 0 | ||||||||||||||||||||||||||||||||||||
| 1803 | || (rtlHorTabs
| 0 | ||||||||||||||||||||||||||||||||||||
| 1804 | && tab->position == QStyleOptionTab::Beginning));
| 0 | ||||||||||||||||||||||||||||||||||||
| 1805 | bool onlyOne = tab->position == QStyleOptionTab::OnlyOneTab; | - | ||||||||||||||||||||||||||||||||||||
| 1806 | int tabOverlap = pixelMetric(PM_TabBarTabOverlap, option, widget); | - | ||||||||||||||||||||||||||||||||||||
| 1807 | rect = option->rect.adjusted(0, 0, (onlyOne || lastTab) ? 0 : tabOverlap, 0); | - | ||||||||||||||||||||||||||||||||||||
| 1808 | - | |||||||||||||||||||||||||||||||||||||
| 1809 | QRect r2(rect); | - | ||||||||||||||||||||||||||||||||||||
| 1810 | int x1 = r2.left(); | - | ||||||||||||||||||||||||||||||||||||
| 1811 | int x2 = r2.right(); | - | ||||||||||||||||||||||||||||||||||||
| 1812 | int y1 = r2.top(); | - | ||||||||||||||||||||||||||||||||||||
| 1813 | int y2 = r2.bottom(); | - | ||||||||||||||||||||||||||||||||||||
| 1814 | - | |||||||||||||||||||||||||||||||||||||
| 1815 | painter->setPen(d->innerContrastLine()); | - | ||||||||||||||||||||||||||||||||||||
| 1816 | - | |||||||||||||||||||||||||||||||||||||
| 1817 | QTransform rotMatrix; | - | ||||||||||||||||||||||||||||||||||||
| 1818 | bool flip = false; | - | ||||||||||||||||||||||||||||||||||||
| 1819 | painter->setPen(shadow); | - | ||||||||||||||||||||||||||||||||||||
| 1820 | - | |||||||||||||||||||||||||||||||||||||
| 1821 | switch (tab->shape) { | - | ||||||||||||||||||||||||||||||||||||
| 1822 | case QTabBar::RoundedNorth: never executed: case QTabBar::RoundedNorth: | 0 | ||||||||||||||||||||||||||||||||||||
| 1823 | break; never executed: break; | 0 | ||||||||||||||||||||||||||||||||||||
| 1824 | case QTabBar::RoundedSouth: never executed: case QTabBar::RoundedSouth: | 0 | ||||||||||||||||||||||||||||||||||||
| 1825 | rotMatrix.rotate(180); | - | ||||||||||||||||||||||||||||||||||||
| 1826 | rotMatrix.translate(0, -rect.height() + 1); | - | ||||||||||||||||||||||||||||||||||||
| 1827 | rotMatrix.scale(-1, 1); | - | ||||||||||||||||||||||||||||||||||||
| 1828 | painter->setTransform(rotMatrix, true); | - | ||||||||||||||||||||||||||||||||||||
| 1829 | break; never executed: break; | 0 | ||||||||||||||||||||||||||||||||||||
| 1830 | case QTabBar::RoundedWest: never executed: case QTabBar::RoundedWest: | 0 | ||||||||||||||||||||||||||||||||||||
| 1831 | rotMatrix.rotate(180 + 90); | - | ||||||||||||||||||||||||||||||||||||
| 1832 | rotMatrix.scale(-1, 1); | - | ||||||||||||||||||||||||||||||||||||
| 1833 | flip = true; | - | ||||||||||||||||||||||||||||||||||||
| 1834 | painter->setTransform(rotMatrix, true); | - | ||||||||||||||||||||||||||||||||||||
| 1835 | break; never executed: break; | 0 | ||||||||||||||||||||||||||||||||||||
| 1836 | case QTabBar::RoundedEast: never executed: case QTabBar::RoundedEast: | 0 | ||||||||||||||||||||||||||||||||||||
| 1837 | rotMatrix.rotate(90); | - | ||||||||||||||||||||||||||||||||||||
| 1838 | rotMatrix.translate(0, - rect.width() + 1); | - | ||||||||||||||||||||||||||||||||||||
| 1839 | flip = true; | - | ||||||||||||||||||||||||||||||||||||
| 1840 | painter->setTransform(rotMatrix, true); | - | ||||||||||||||||||||||||||||||||||||
| 1841 | break; never executed: break; | 0 | ||||||||||||||||||||||||||||||||||||
| 1842 | default: never executed: default: | 0 | ||||||||||||||||||||||||||||||||||||
| 1843 | painter->restore(); | - | ||||||||||||||||||||||||||||||||||||
| 1844 | QCommonStyle::drawControl(element, tab, painter, widget); | - | ||||||||||||||||||||||||||||||||||||
| 1845 | return; never executed: return; | 0 | ||||||||||||||||||||||||||||||||||||
| 1846 | } | - | ||||||||||||||||||||||||||||||||||||
| 1847 | - | |||||||||||||||||||||||||||||||||||||
| 1848 | if (flip) {
| 0 | ||||||||||||||||||||||||||||||||||||
| 1849 | QRect tmp = rect; | - | ||||||||||||||||||||||||||||||||||||
| 1850 | rect = QRect(tmp.y(), tmp.x(), tmp.height(), tmp.width()); | - | ||||||||||||||||||||||||||||||||||||
| 1851 | int temp = x1; | - | ||||||||||||||||||||||||||||||||||||
| 1852 | x1 = y1; | - | ||||||||||||||||||||||||||||||||||||
| 1853 | y1 = temp; | - | ||||||||||||||||||||||||||||||||||||
| 1854 | temp = x2; | - | ||||||||||||||||||||||||||||||||||||
| 1855 | x2 = y2; | - | ||||||||||||||||||||||||||||||||||||
| 1856 | y2 = temp; | - | ||||||||||||||||||||||||||||||||||||
| 1857 | } never executed: end of block | 0 | ||||||||||||||||||||||||||||||||||||
| 1858 | - | |||||||||||||||||||||||||||||||||||||
| 1859 | painter->setRenderHint(QPainter::Antialiasing, true); | - | ||||||||||||||||||||||||||||||||||||
| 1860 | painter->translate(0.5, 0.5); | - | ||||||||||||||||||||||||||||||||||||
| 1861 | - | |||||||||||||||||||||||||||||||||||||
| 1862 | QColor tabFrameColor = tab->features & QStyleOptionTab::HasFrame ?
| 0 | ||||||||||||||||||||||||||||||||||||
| 1863 | d->tabFrameColor(option->palette) : | - | ||||||||||||||||||||||||||||||||||||
| 1864 | option->palette.window().color(); | - | ||||||||||||||||||||||||||||||||||||
| 1865 | - | |||||||||||||||||||||||||||||||||||||
| 1866 | QLinearGradient fillGradient(rect.topLeft(), rect.bottomLeft()); | - | ||||||||||||||||||||||||||||||||||||
| 1867 | QLinearGradient outlineGradient(rect.topLeft(), rect.bottomLeft()); | - | ||||||||||||||||||||||||||||||||||||
| 1868 | QPen outlinePen = outline.lighter(110); | - | ||||||||||||||||||||||||||||||||||||
| 1869 | if (selected) {
| 0 | ||||||||||||||||||||||||||||||||||||
| 1870 | fillGradient.setColorAt(0, tabFrameColor.lighter(104)); | - | ||||||||||||||||||||||||||||||||||||
| 1871 | // QColor highlight = option->palette.highlight().color(); | - | ||||||||||||||||||||||||||||||||||||
| 1872 | // if (option->state & State_HasFocus && option->state & State_KeyboardFocusChange) { | - | ||||||||||||||||||||||||||||||||||||
| 1873 | // fillGradient.setColorAt(0, highlight.lighter(130)); | - | ||||||||||||||||||||||||||||||||||||
| 1874 | // outlineGradient.setColorAt(0, highlight.darker(130)); | - | ||||||||||||||||||||||||||||||||||||
| 1875 | // fillGradient.setColorAt(0.14, highlight); | - | ||||||||||||||||||||||||||||||||||||
| 1876 | // outlineGradient.setColorAt(0.14, highlight.darker(130)); | - | ||||||||||||||||||||||||||||||||||||
| 1877 | // fillGradient.setColorAt(0.1401, tabFrameColor); | - | ||||||||||||||||||||||||||||||||||||
| 1878 | // outlineGradient.setColorAt(0.1401, highlight.darker(130)); | - | ||||||||||||||||||||||||||||||||||||
| 1879 | // } | - | ||||||||||||||||||||||||||||||||||||
| 1880 | fillGradient.setColorAt(1, tabFrameColor); | - | ||||||||||||||||||||||||||||||||||||
| 1881 | outlineGradient.setColorAt(1, outline); | - | ||||||||||||||||||||||||||||||||||||
| 1882 | outlinePen = QPen(outlineGradient, 1); | - | ||||||||||||||||||||||||||||||||||||
| 1883 | } else { never executed: end of block | 0 | ||||||||||||||||||||||||||||||||||||
| 1884 | fillGradient.setColorAt(0, tabFrameColor.darker(108)); | - | ||||||||||||||||||||||||||||||||||||
| 1885 | fillGradient.setColorAt(0.85, tabFrameColor.darker(108)); | - | ||||||||||||||||||||||||||||||||||||
| 1886 | fillGradient.setColorAt(1, tabFrameColor.darker(116)); | - | ||||||||||||||||||||||||||||||||||||
| 1887 | } never executed: end of block | 0 | ||||||||||||||||||||||||||||||||||||
| 1888 | - | |||||||||||||||||||||||||||||||||||||
| 1889 | QRect drawRect = rect.adjusted(0, selected ? 0 : 2, 0, 3); | - | ||||||||||||||||||||||||||||||||||||
| 1890 | painter->setPen(outlinePen); | - | ||||||||||||||||||||||||||||||||||||
| 1891 | painter->save(); | - | ||||||||||||||||||||||||||||||||||||
| 1892 | painter->setClipRect(rect.adjusted(-1, -1, 1, selected ? -2 : -3)); | - | ||||||||||||||||||||||||||||||||||||
| 1893 | painter->setBrush(fillGradient); | - | ||||||||||||||||||||||||||||||||||||
| 1894 | painter->drawRoundedRect(drawRect.adjusted(0, 0, -1, -1), 2.0, 2.0); | - | ||||||||||||||||||||||||||||||||||||
| 1895 | painter->setBrush(Qt::NoBrush); | - | ||||||||||||||||||||||||||||||||||||
| 1896 | painter->setPen(d->innerContrastLine()); | - | ||||||||||||||||||||||||||||||||||||
| 1897 | painter->drawRoundedRect(drawRect.adjusted(1, 1, -2, -1), 2.0, 2.0); | - | ||||||||||||||||||||||||||||||||||||
| 1898 | painter->restore(); | - | ||||||||||||||||||||||||||||||||||||
| 1899 | - | |||||||||||||||||||||||||||||||||||||
| 1900 | if (selected) {
| 0 | ||||||||||||||||||||||||||||||||||||
| 1901 | painter->fillRect(rect.left() + 1, rect.bottom() - 1, rect.width() - 2, rect.bottom() - 1, tabFrameColor); | - | ||||||||||||||||||||||||||||||||||||
| 1902 | painter->fillRect(QRect(rect.bottomRight() + QPoint(-2, -1), QSize(1, 1)), d->innerContrastLine()); | - | ||||||||||||||||||||||||||||||||||||
| 1903 | painter->fillRect(QRect(rect.bottomLeft() + QPoint(0, -1), QSize(1, 1)), d->innerContrastLine()); | - | ||||||||||||||||||||||||||||||||||||
| 1904 | painter->fillRect(QRect(rect.bottomRight() + QPoint(-1, -1), QSize(1, 1)), d->innerContrastLine()); | - | ||||||||||||||||||||||||||||||||||||
| 1905 | } never executed: end of block | 0 | ||||||||||||||||||||||||||||||||||||
| 1906 | } never executed: end of block | 0 | ||||||||||||||||||||||||||||||||||||
| 1907 | painter->restore(); | - | ||||||||||||||||||||||||||||||||||||
| 1908 | break; never executed: break; | 0 | ||||||||||||||||||||||||||||||||||||
| 1909 | default: never executed: default: | 0 | ||||||||||||||||||||||||||||||||||||
| 1910 | QCommonStyle::drawControl(element,option,painter,widget); | - | ||||||||||||||||||||||||||||||||||||
| 1911 | break; never executed: break; | 0 | ||||||||||||||||||||||||||||||||||||
| 1912 | } | - | ||||||||||||||||||||||||||||||||||||
| 1913 | } | - | ||||||||||||||||||||||||||||||||||||
| 1914 | - | |||||||||||||||||||||||||||||||||||||
| 1915 | extern QPalette qt_fusionPalette(); | - | ||||||||||||||||||||||||||||||||||||
| 1916 | - | |||||||||||||||||||||||||||||||||||||
| 1917 | /*! | - | ||||||||||||||||||||||||||||||||||||
| 1918 | \reimp | - | ||||||||||||||||||||||||||||||||||||
| 1919 | */ | - | ||||||||||||||||||||||||||||||||||||
| 1920 | QPalette QFusionStyle::standardPalette () const | - | ||||||||||||||||||||||||||||||||||||
| 1921 | { | - | ||||||||||||||||||||||||||||||||||||
| 1922 | return qt_fusionPalette(); never executed: return qt_fusionPalette(); | 0 | ||||||||||||||||||||||||||||||||||||
| 1923 | } | - | ||||||||||||||||||||||||||||||||||||
| 1924 | - | |||||||||||||||||||||||||||||||||||||
| 1925 | /*! | - | ||||||||||||||||||||||||||||||||||||
| 1926 | \reimp | - | ||||||||||||||||||||||||||||||||||||
| 1927 | */ | - | ||||||||||||||||||||||||||||||||||||
| 1928 | void QFusionStyle::drawComplexControl(ComplexControl control, const QStyleOptionComplex *option, | - | ||||||||||||||||||||||||||||||||||||
| 1929 | QPainter *painter, const QWidget *widget) const | - | ||||||||||||||||||||||||||||||||||||
| 1930 | { | - | ||||||||||||||||||||||||||||||||||||
| 1931 | - | |||||||||||||||||||||||||||||||||||||
| 1932 | Q_D (const QFusionStyle); | - | ||||||||||||||||||||||||||||||||||||
| 1933 | - | |||||||||||||||||||||||||||||||||||||
| 1934 | QColor buttonColor = d->buttonColor(option->palette); | - | ||||||||||||||||||||||||||||||||||||
| 1935 | QColor gradientStartColor = buttonColor.lighter(118); | - | ||||||||||||||||||||||||||||||||||||
| 1936 | QColor gradientStopColor = buttonColor; | - | ||||||||||||||||||||||||||||||||||||
| 1937 | QColor outline = d->outline(option->palette); | - | ||||||||||||||||||||||||||||||||||||
| 1938 | - | |||||||||||||||||||||||||||||||||||||
| 1939 | QColor alphaCornerColor; | - | ||||||||||||||||||||||||||||||||||||
| 1940 | if (widget) {
| 0 | ||||||||||||||||||||||||||||||||||||
| 1941 | // ### backgroundrole/foregroundrole should be part of the style option | - | ||||||||||||||||||||||||||||||||||||
| 1942 | alphaCornerColor = mergedColors(option->palette.color(widget->backgroundRole()), outline); | - | ||||||||||||||||||||||||||||||||||||
| 1943 | } else { never executed: end of block | 0 | ||||||||||||||||||||||||||||||||||||
| 1944 | alphaCornerColor = mergedColors(option->palette.background().color(), outline); | - | ||||||||||||||||||||||||||||||||||||
| 1945 | } never executed: end of block | 0 | ||||||||||||||||||||||||||||||||||||
| 1946 | - | |||||||||||||||||||||||||||||||||||||
| 1947 | switch (control) { | - | ||||||||||||||||||||||||||||||||||||
| 1948 | case CC_GroupBox: never executed: case CC_GroupBox: | 0 | ||||||||||||||||||||||||||||||||||||
| 1949 | painter->save(); | - | ||||||||||||||||||||||||||||||||||||
| 1950 | if (const QStyleOptionGroupBox *groupBox = qstyleoption_cast<const QStyleOptionGroupBox *>(option)) {
| 0 | ||||||||||||||||||||||||||||||||||||
| 1951 | // Draw frame | - | ||||||||||||||||||||||||||||||||||||
| 1952 | QRect textRect = proxy()->subControlRect(CC_GroupBox, option, SC_GroupBoxLabel, widget); | - | ||||||||||||||||||||||||||||||||||||
| 1953 | QRect checkBoxRect = proxy()->subControlRect(CC_GroupBox, option, SC_GroupBoxCheckBox, widget); | - | ||||||||||||||||||||||||||||||||||||
| 1954 | - | |||||||||||||||||||||||||||||||||||||
| 1955 | if (groupBox->subControls & QStyle::SC_GroupBoxFrame) {
| 0 | ||||||||||||||||||||||||||||||||||||
| 1956 | QStyleOptionFrame frame; | - | ||||||||||||||||||||||||||||||||||||
| 1957 | frame.QStyleOption::operator=(*groupBox); | - | ||||||||||||||||||||||||||||||||||||
| 1958 | frame.features = groupBox->features; | - | ||||||||||||||||||||||||||||||||||||
| 1959 | frame.lineWidth = groupBox->lineWidth; | - | ||||||||||||||||||||||||||||||||||||
| 1960 | frame.midLineWidth = groupBox->midLineWidth; | - | ||||||||||||||||||||||||||||||||||||
| 1961 | frame.rect = proxy()->subControlRect(CC_GroupBox, option, SC_GroupBoxFrame, widget); | - | ||||||||||||||||||||||||||||||||||||
| 1962 | proxy()->drawPrimitive(PE_FrameGroupBox, &frame, painter, widget); | - | ||||||||||||||||||||||||||||||||||||
| 1963 | } never executed: end of block | 0 | ||||||||||||||||||||||||||||||||||||
| 1964 | - | |||||||||||||||||||||||||||||||||||||
| 1965 | // Draw title | - | ||||||||||||||||||||||||||||||||||||
| 1966 | if ((groupBox->subControls & QStyle::SC_GroupBoxLabel) && !groupBox->text.isEmpty()) {
| 0 | ||||||||||||||||||||||||||||||||||||
| 1967 | // groupBox->textColor gets the incorrect palette here | - | ||||||||||||||||||||||||||||||||||||
| 1968 | painter->setPen(QPen(option->palette.windowText(), 1)); | - | ||||||||||||||||||||||||||||||||||||
| 1969 | int alignment = int(groupBox->textAlignment); | - | ||||||||||||||||||||||||||||||||||||
| 1970 | if (!proxy()->styleHint(QStyle::SH_UnderlineShortcut, option, widget))
| 0 | ||||||||||||||||||||||||||||||||||||
| 1971 | alignment |= Qt::TextHideMnemonic; never executed: alignment |= Qt::TextHideMnemonic; | 0 | ||||||||||||||||||||||||||||||||||||
| 1972 | - | |||||||||||||||||||||||||||||||||||||
| 1973 | proxy()->drawItemText(painter, textRect, Qt::TextShowMnemonic | Qt::AlignLeft | alignment, | - | ||||||||||||||||||||||||||||||||||||
| 1974 | groupBox->palette, groupBox->state & State_Enabled, groupBox->text, QPalette::NoRole); | - | ||||||||||||||||||||||||||||||||||||
| 1975 | - | |||||||||||||||||||||||||||||||||||||
| 1976 | if (groupBox->state & State_HasFocus) {
| 0 | ||||||||||||||||||||||||||||||||||||
| 1977 | QStyleOptionFocusRect fropt; | - | ||||||||||||||||||||||||||||||||||||
| 1978 | fropt.QStyleOption::operator=(*groupBox); | - | ||||||||||||||||||||||||||||||||||||
| 1979 | fropt.rect = textRect.adjusted(-2, -1, 2, 1); | - | ||||||||||||||||||||||||||||||||||||
| 1980 | proxy()->drawPrimitive(PE_FrameFocusRect, &fropt, painter, widget); | - | ||||||||||||||||||||||||||||||||||||
| 1981 | } never executed: end of block | 0 | ||||||||||||||||||||||||||||||||||||
| 1982 | } never executed: end of block | 0 | ||||||||||||||||||||||||||||||||||||
| 1983 | - | |||||||||||||||||||||||||||||||||||||
| 1984 | // Draw checkbox | - | ||||||||||||||||||||||||||||||||||||
| 1985 | if (groupBox->subControls & SC_GroupBoxCheckBox) {
| 0 | ||||||||||||||||||||||||||||||||||||
| 1986 | QStyleOptionButton box; | - | ||||||||||||||||||||||||||||||||||||
| 1987 | box.QStyleOption::operator=(*groupBox); | - | ||||||||||||||||||||||||||||||||||||
| 1988 | box.rect = checkBoxRect; | - | ||||||||||||||||||||||||||||||||||||
| 1989 | proxy()->drawPrimitive(PE_IndicatorCheckBox, &box, painter, widget); | - | ||||||||||||||||||||||||||||||||||||
| 1990 | } never executed: end of block | 0 | ||||||||||||||||||||||||||||||||||||
| 1991 | } never executed: end of block | 0 | ||||||||||||||||||||||||||||||||||||
| 1992 | painter->restore(); | - | ||||||||||||||||||||||||||||||||||||
| 1993 | break; never executed: break; | 0 | ||||||||||||||||||||||||||||||||||||
| 1994 | case CC_SpinBox: never executed: case CC_SpinBox: | 0 | ||||||||||||||||||||||||||||||||||||
| 1995 | if (const QStyleOptionSpinBox *spinBox = qstyleoption_cast<const QStyleOptionSpinBox *>(option)) {
| 0 | ||||||||||||||||||||||||||||||||||||
| 1996 | QPixmap cache; | - | ||||||||||||||||||||||||||||||||||||
| 1997 | QString pixmapName = QStyleHelper::uniqueName(QLatin1String("spinbox"), spinBox, spinBox->rect.size()); | - | ||||||||||||||||||||||||||||||||||||
| 1998 | if (!QPixmapCache::find(pixmapName, cache)) {
| 0 | ||||||||||||||||||||||||||||||||||||
| 1999 | - | |||||||||||||||||||||||||||||||||||||
| 2000 | cache = styleCachePixmap(spinBox->rect.size()); | - | ||||||||||||||||||||||||||||||||||||
| 2001 | cache.fill(Qt::transparent); | - | ||||||||||||||||||||||||||||||||||||
| 2002 | - | |||||||||||||||||||||||||||||||||||||
| 2003 | QRect pixmapRect(0, 0, spinBox->rect.width(), spinBox->rect.height()); | - | ||||||||||||||||||||||||||||||||||||
| 2004 | QRect rect = pixmapRect; | - | ||||||||||||||||||||||||||||||||||||
| 2005 | QRect r = rect.adjusted(0, 1, 0, -1); | - | ||||||||||||||||||||||||||||||||||||
| 2006 | QPainter cachePainter(&cache); | - | ||||||||||||||||||||||||||||||||||||
| 2007 | QColor arrowColor = spinBox->palette.foreground().color(); | - | ||||||||||||||||||||||||||||||||||||
| 2008 | arrowColor.setAlpha(220); | - | ||||||||||||||||||||||||||||||||||||
| 2009 | - | |||||||||||||||||||||||||||||||||||||
| 2010 | bool isEnabled = (spinBox->state & State_Enabled); | - | ||||||||||||||||||||||||||||||||||||
| 2011 | bool hover = isEnabled && (spinBox->state & State_MouseOver);
| 0 | ||||||||||||||||||||||||||||||||||||
| 2012 | bool sunken = (spinBox->state & State_Sunken); | - | ||||||||||||||||||||||||||||||||||||
| 2013 | bool upIsActive = (spinBox->activeSubControls == SC_SpinBoxUp); | - | ||||||||||||||||||||||||||||||||||||
| 2014 | bool downIsActive = (spinBox->activeSubControls == SC_SpinBoxDown); | - | ||||||||||||||||||||||||||||||||||||
| 2015 | bool hasFocus = (option->state & State_HasFocus); | - | ||||||||||||||||||||||||||||||||||||
| 2016 | - | |||||||||||||||||||||||||||||||||||||
| 2017 | QStyleOptionSpinBox spinBoxCopy = *spinBox; | - | ||||||||||||||||||||||||||||||||||||
| 2018 | spinBoxCopy.rect = pixmapRect; | - | ||||||||||||||||||||||||||||||||||||
| 2019 | QRect upRect = proxy()->subControlRect(CC_SpinBox, &spinBoxCopy, SC_SpinBoxUp, widget); | - | ||||||||||||||||||||||||||||||||||||
| 2020 | QRect downRect = proxy()->subControlRect(CC_SpinBox, &spinBoxCopy, SC_SpinBoxDown, widget); | - | ||||||||||||||||||||||||||||||||||||
| 2021 | - | |||||||||||||||||||||||||||||||||||||
| 2022 | if (spinBox->frame) {
| 0 | ||||||||||||||||||||||||||||||||||||
| 2023 | cachePainter.save(); | - | ||||||||||||||||||||||||||||||||||||
| 2024 | cachePainter.setRenderHint(QPainter::Antialiasing, true); | - | ||||||||||||||||||||||||||||||||||||
| 2025 | cachePainter.translate(0.5, 0.5); | - | ||||||||||||||||||||||||||||||||||||
| 2026 | - | |||||||||||||||||||||||||||||||||||||
| 2027 | // Fill background | - | ||||||||||||||||||||||||||||||||||||
| 2028 | cachePainter.setPen(Qt::NoPen); | - | ||||||||||||||||||||||||||||||||||||
| 2029 | cachePainter.setBrush(option->palette.base()); | - | ||||||||||||||||||||||||||||||||||||
| 2030 | cachePainter.drawRoundedRect(r.adjusted(0, 0, -1, -1), 2, 2); | - | ||||||||||||||||||||||||||||||||||||
| 2031 | - | |||||||||||||||||||||||||||||||||||||
| 2032 | // Draw inner shadow | - | ||||||||||||||||||||||||||||||||||||
| 2033 | cachePainter.setPen(d->topShadow()); | - | ||||||||||||||||||||||||||||||||||||
| 2034 | cachePainter.drawLine(QPoint(r.left() + 2, r.top() + 1), QPoint(r.right() - 2, r.top() + 1)); | - | ||||||||||||||||||||||||||||||||||||
| 2035 | - | |||||||||||||||||||||||||||||||||||||
| 2036 | // Draw button gradient | - | ||||||||||||||||||||||||||||||||||||
| 2037 | QColor buttonColor = d->buttonColor(option->palette); | - | ||||||||||||||||||||||||||||||||||||
| 2038 | QRect updownRect = upRect.adjusted(0, -2, 0, downRect.height() + 2); | - | ||||||||||||||||||||||||||||||||||||
| 2039 | QLinearGradient gradient = qt_fusion_gradient(updownRect, (isEnabled && option->state & State_MouseOver ) ? buttonColor : buttonColor.darker(104)); | - | ||||||||||||||||||||||||||||||||||||
| 2040 | - | |||||||||||||||||||||||||||||||||||||
| 2041 | // Draw button gradient | - | ||||||||||||||||||||||||||||||||||||
| 2042 | cachePainter.setPen(Qt::NoPen); | - | ||||||||||||||||||||||||||||||||||||
| 2043 | cachePainter.setBrush(gradient); | - | ||||||||||||||||||||||||||||||||||||
| 2044 | - | |||||||||||||||||||||||||||||||||||||
| 2045 | cachePainter.save(); | - | ||||||||||||||||||||||||||||||||||||
| 2046 | cachePainter.setClipRect(updownRect); | - | ||||||||||||||||||||||||||||||||||||
| 2047 | cachePainter.drawRoundedRect(r.adjusted(0, 0, -1, -1), 2, 2); | - | ||||||||||||||||||||||||||||||||||||
| 2048 | cachePainter.setPen(QPen(d->innerContrastLine())); | - | ||||||||||||||||||||||||||||||||||||
| 2049 | cachePainter.setBrush(Qt::NoBrush); | - | ||||||||||||||||||||||||||||||||||||
| 2050 | cachePainter.drawRoundedRect(r.adjusted(1, 1, -2, -2), 2, 2); | - | ||||||||||||||||||||||||||||||||||||
| 2051 | cachePainter.restore(); | - | ||||||||||||||||||||||||||||||||||||
| 2052 | - | |||||||||||||||||||||||||||||||||||||
| 2053 | if ((spinBox->stepEnabled & QAbstractSpinBox::StepUpEnabled) && upIsActive) {
| 0 | ||||||||||||||||||||||||||||||||||||
| 2054 | if (sunken)
| 0 | ||||||||||||||||||||||||||||||||||||
| 2055 | 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 | ||||||||||||||||||||||||||||||||||||
| 2056 | else if (hover)
| 0 | ||||||||||||||||||||||||||||||||||||
| 2057 | cachePainter.fillRect(upRect.adjusted(0, -1, 0, 0), d->innerContrastLine()); never executed: cachePainter.fillRect(upRect.adjusted(0, -1, 0, 0), d->innerContrastLine()); | 0 | ||||||||||||||||||||||||||||||||||||
| 2058 | } never executed: end of block | 0 | ||||||||||||||||||||||||||||||||||||
| 2059 | - | |||||||||||||||||||||||||||||||||||||
| 2060 | if ((spinBox->stepEnabled & QAbstractSpinBox::StepDownEnabled) && downIsActive) {
| 0 | ||||||||||||||||||||||||||||||||||||
| 2061 | if (sunken)
| 0 | ||||||||||||||||||||||||||||||||||||
| 2062 | 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 | ||||||||||||||||||||||||||||||||||||
| 2063 | else if (hover)
| 0 | ||||||||||||||||||||||||||||||||||||
| 2064 | cachePainter.fillRect(downRect.adjusted(0, 0, 0, 1), d->innerContrastLine()); never executed: cachePainter.fillRect(downRect.adjusted(0, 0, 0, 1), d->innerContrastLine()); | 0 | ||||||||||||||||||||||||||||||||||||
| 2065 | } never executed: end of block | 0 | ||||||||||||||||||||||||||||||||||||
| 2066 | - | |||||||||||||||||||||||||||||||||||||
| 2067 | cachePainter.setPen(hasFocus ? d->highlightedOutline(option->palette) : outline); | - | ||||||||||||||||||||||||||||||||||||
| 2068 | cachePainter.setBrush(Qt::NoBrush); | - | ||||||||||||||||||||||||||||||||||||
| 2069 | cachePainter.drawRoundedRect(r.adjusted(0, 0, -1, -1), 2, 2); | - | ||||||||||||||||||||||||||||||||||||
| 2070 | if (hasFocus) {
| 0 | ||||||||||||||||||||||||||||||||||||
| 2071 | QColor softHighlight = option->palette.highlight().color(); | - | ||||||||||||||||||||||||||||||||||||
| 2072 | softHighlight.setAlpha(40); | - | ||||||||||||||||||||||||||||||||||||
| 2073 | cachePainter.setPen(softHighlight); | - | ||||||||||||||||||||||||||||||||||||
| 2074 | cachePainter.drawRoundedRect(r.adjusted(1, 1, -2, -2), 1.7, 1.7); | - | ||||||||||||||||||||||||||||||||||||
| 2075 | } never executed: end of block | 0 | ||||||||||||||||||||||||||||||||||||
| 2076 | cachePainter.restore(); | - | ||||||||||||||||||||||||||||||||||||
| 2077 | } never executed: end of block | 0 | ||||||||||||||||||||||||||||||||||||
| 2078 | - | |||||||||||||||||||||||||||||||||||||
| 2079 | // outline the up/down buttons | - | ||||||||||||||||||||||||||||||||||||
| 2080 | cachePainter.setPen(outline); | - | ||||||||||||||||||||||||||||||||||||
| 2081 | if (spinBox->direction == Qt::RightToLeft) {
| 0 | ||||||||||||||||||||||||||||||||||||
| 2082 | cachePainter.drawLine(upRect.right(), upRect.top() - 1, upRect.right(), downRect.bottom() + 1); | - | ||||||||||||||||||||||||||||||||||||
| 2083 | } else { never executed: end of block | 0 | ||||||||||||||||||||||||||||||||||||
| 2084 | cachePainter.drawLine(upRect.left(), upRect.top() - 1, upRect.left(), downRect.bottom() + 1); | - | ||||||||||||||||||||||||||||||||||||
| 2085 | } never executed: end of block | 0 | ||||||||||||||||||||||||||||||||||||
| 2086 | - | |||||||||||||||||||||||||||||||||||||
| 2087 | if (upIsActive && sunken) {
| 0 | ||||||||||||||||||||||||||||||||||||
| 2088 | cachePainter.setPen(gradientStopColor.darker(130)); | - | ||||||||||||||||||||||||||||||||||||
| 2089 | cachePainter.drawLine(downRect.left() + 1, downRect.top(), downRect.right(), downRect.top()); | - | ||||||||||||||||||||||||||||||||||||
| 2090 | cachePainter.drawLine(upRect.left() + 1, upRect.top(), upRect.left() + 1, upRect.bottom()); | - | ||||||||||||||||||||||||||||||||||||
| 2091 | cachePainter.drawLine(upRect.left() + 1, upRect.top() - 1, upRect.right(), upRect.top() - 1); | - | ||||||||||||||||||||||||||||||||||||
| 2092 | } never executed: end of block | 0 | ||||||||||||||||||||||||||||||||||||
| 2093 | - | |||||||||||||||||||||||||||||||||||||
| 2094 | if (downIsActive && sunken) {
| 0 | ||||||||||||||||||||||||||||||||||||
| 2095 | cachePainter.setPen(gradientStopColor.darker(130)); | - | ||||||||||||||||||||||||||||||||||||
| 2096 | cachePainter.drawLine(downRect.left() + 1, downRect.top(), downRect.left() + 1, downRect.bottom() + 1); | - | ||||||||||||||||||||||||||||||||||||
| 2097 | cachePainter.drawLine(downRect.left() + 1, downRect.top(), downRect.right(), downRect.top()); | - | ||||||||||||||||||||||||||||||||||||
| 2098 | cachePainter.setPen(gradientStopColor.darker(110)); | - | ||||||||||||||||||||||||||||||||||||
| 2099 | cachePainter.drawLine(downRect.left() + 1, downRect.bottom() + 1, downRect.right(), downRect.bottom() + 1); | - | ||||||||||||||||||||||||||||||||||||
| 2100 | } never executed: end of block | 0 | ||||||||||||||||||||||||||||||||||||
| 2101 | - | |||||||||||||||||||||||||||||||||||||
| 2102 | QColor disabledColor = mergedColors(arrowColor, option->palette.button().color()); | - | ||||||||||||||||||||||||||||||||||||
| 2103 | if (spinBox->buttonSymbols == QAbstractSpinBox::PlusMinus) {
| 0 | ||||||||||||||||||||||||||||||||||||
| 2104 | int centerX = upRect.center().x(); | - | ||||||||||||||||||||||||||||||||||||
| 2105 | int centerY = upRect.center().y(); | - | ||||||||||||||||||||||||||||||||||||
| 2106 | - | |||||||||||||||||||||||||||||||||||||
| 2107 | // plus/minus | - | ||||||||||||||||||||||||||||||||||||
| 2108 | cachePainter.setPen((spinBox->stepEnabled & QAbstractSpinBox::StepUpEnabled) ? arrowColor : disabledColor); | - | ||||||||||||||||||||||||||||||||||||
| 2109 | cachePainter.drawLine(centerX - 1, centerY, centerX + 3, centerY); | - | ||||||||||||||||||||||||||||||||||||
| 2110 | cachePainter.drawLine(centerX + 1, centerY - 2, centerX + 1, centerY + 2); | - | ||||||||||||||||||||||||||||||||||||
| 2111 | - | |||||||||||||||||||||||||||||||||||||
| 2112 | centerX = downRect.center().x(); | - | ||||||||||||||||||||||||||||||||||||
| 2113 | centerY = downRect.center().y(); | - | ||||||||||||||||||||||||||||||||||||
| 2114 | cachePainter.setPen((spinBox->stepEnabled & QAbstractSpinBox::StepDownEnabled) ? arrowColor : disabledColor); | - | ||||||||||||||||||||||||||||||||||||
| 2115 | cachePainter.drawLine(centerX - 1, centerY, centerX + 3, centerY); | - | ||||||||||||||||||||||||||||||||||||
| 2116 | - | |||||||||||||||||||||||||||||||||||||
| 2117 | } else if (spinBox->buttonSymbols == QAbstractSpinBox::UpDownArrows){ never executed: end of block
| 0 | ||||||||||||||||||||||||||||||||||||
| 2118 | // arrows | - | ||||||||||||||||||||||||||||||||||||
| 2119 | painter->setRenderHint(QPainter::SmoothPixmapTransform); | - | ||||||||||||||||||||||||||||||||||||
| 2120 | - | |||||||||||||||||||||||||||||||||||||
| 2121 | QPixmap upArrow = colorizedImage(QLatin1String(":/qt-project.org/styles/commonstyle/images/fusion_arrow.png"), | - | ||||||||||||||||||||||||||||||||||||
| 2122 | (spinBox->stepEnabled & QAbstractSpinBox::StepUpEnabled) ? arrowColor : disabledColor); | - | ||||||||||||||||||||||||||||||||||||
| 2123 | - | |||||||||||||||||||||||||||||||||||||
| 2124 | QRectF upArrowRect = QRectF(upRect.center().x() - upArrow.width() / 4.0 + 1.0, | - | ||||||||||||||||||||||||||||||||||||
| 2125 | upRect.center().y() - upArrow.height() / 4.0 + 1.0, | - | ||||||||||||||||||||||||||||||||||||
| 2126 | upArrow.width() / 2.0, upArrow.height() / 2.0); | - | ||||||||||||||||||||||||||||||||||||
| 2127 | - | |||||||||||||||||||||||||||||||||||||
| 2128 | cachePainter.drawPixmap(upArrowRect, upArrow, QRectF(QPointF(0.0, 0.0), upArrow.size())); | - | ||||||||||||||||||||||||||||||||||||
| 2129 | - | |||||||||||||||||||||||||||||||||||||
| 2130 | QPixmap downArrow = colorizedImage(QLatin1String(":/qt-project.org/styles/commonstyle/images/fusion_arrow.png"), | - | ||||||||||||||||||||||||||||||||||||
| 2131 | (spinBox->stepEnabled & QAbstractSpinBox::StepDownEnabled) ? arrowColor : disabledColor, 180); | - | ||||||||||||||||||||||||||||||||||||
| 2132 | QRectF downArrowRect = QRectF(downRect.center().x() - downArrow.width() / 4.0 + 1.0, | - | ||||||||||||||||||||||||||||||||||||
| 2133 | downRect.center().y() - downArrow.height() / 4.0 + 1.0, | - | ||||||||||||||||||||||||||||||||||||
| 2134 | downArrow.width() / 2.0, downArrow.height() / 2.0); | - | ||||||||||||||||||||||||||||||||||||
| 2135 | cachePainter.drawPixmap(downArrowRect, downArrow, QRectF(QPointF(0.0, 0.0), downArrow.size())); | - | ||||||||||||||||||||||||||||||||||||
| 2136 | } never executed: end of block | 0 | ||||||||||||||||||||||||||||||||||||
| 2137 | - | |||||||||||||||||||||||||||||||||||||
| 2138 | cachePainter.end(); | - | ||||||||||||||||||||||||||||||||||||
| 2139 | QPixmapCache::insert(pixmapName, cache); | - | ||||||||||||||||||||||||||||||||||||
| 2140 | } never executed: end of block | 0 | ||||||||||||||||||||||||||||||||||||
| 2141 | painter->drawPixmap(spinBox->rect.topLeft(), cache); | - | ||||||||||||||||||||||||||||||||||||
| 2142 | } never executed: end of block | 0 | ||||||||||||||||||||||||||||||||||||
| 2143 | break; never executed: break; | 0 | ||||||||||||||||||||||||||||||||||||
| 2144 | case CC_TitleBar: never executed: case CC_TitleBar: | 0 | ||||||||||||||||||||||||||||||||||||
| 2145 | painter->save(); | - | ||||||||||||||||||||||||||||||||||||
| 2146 | if (const QStyleOptionTitleBar *titleBar = qstyleoption_cast<const QStyleOptionTitleBar *>(option)) {
| 0 | ||||||||||||||||||||||||||||||||||||
| 2147 | const int buttonMargin = 5; | - | ||||||||||||||||||||||||||||||||||||
| 2148 | bool active = (titleBar->titleBarState & State_Active); | - | ||||||||||||||||||||||||||||||||||||
| 2149 | QRect fullRect = titleBar->rect; | - | ||||||||||||||||||||||||||||||||||||
| 2150 | QPalette palette = option->palette; | - | ||||||||||||||||||||||||||||||||||||
| 2151 | QColor highlight = option->palette.highlight().color(); | - | ||||||||||||||||||||||||||||||||||||
| 2152 | - | |||||||||||||||||||||||||||||||||||||
| 2153 | QColor titleBarFrameBorder(active ? highlight.darker(180): outline.darker(110)); | - | ||||||||||||||||||||||||||||||||||||
| 2154 | QColor titleBarHighlight(active ? highlight.lighter(120): palette.background().color().lighter(120)); | - | ||||||||||||||||||||||||||||||||||||
| 2155 | QColor textColor(active ? 0xffffff : 0xff000000); | - | ||||||||||||||||||||||||||||||||||||
| 2156 | QColor textAlphaColor(active ? 0xffffff : 0xff000000 ); | - | ||||||||||||||||||||||||||||||||||||
| 2157 | - | |||||||||||||||||||||||||||||||||||||
| 2158 | { | - | ||||||||||||||||||||||||||||||||||||
| 2159 | // Fill title bar gradient | - | ||||||||||||||||||||||||||||||||||||
| 2160 | QColor titlebarColor = QColor(active ? highlight: palette.background().color()); | - | ||||||||||||||||||||||||||||||||||||
| 2161 | QLinearGradient gradient(option->rect.center().x(), option->rect.top(), | - | ||||||||||||||||||||||||||||||||||||
| 2162 | option->rect.center().x(), option->rect.bottom()); | - | ||||||||||||||||||||||||||||||||||||
| 2163 | - | |||||||||||||||||||||||||||||||||||||
| 2164 | gradient.setColorAt(0, titlebarColor.lighter(114)); | - | ||||||||||||||||||||||||||||||||||||
| 2165 | gradient.setColorAt(0.5, titlebarColor.lighter(102)); | - | ||||||||||||||||||||||||||||||||||||
| 2166 | gradient.setColorAt(0.51, titlebarColor.darker(104)); | - | ||||||||||||||||||||||||||||||||||||
| 2167 | gradient.setColorAt(1, titlebarColor); | - | ||||||||||||||||||||||||||||||||||||
| 2168 | painter->fillRect(option->rect.adjusted(1, 1, -1, 0), gradient); | - | ||||||||||||||||||||||||||||||||||||
| 2169 | - | |||||||||||||||||||||||||||||||||||||
| 2170 | // Frame and rounded corners | - | ||||||||||||||||||||||||||||||||||||
| 2171 | painter->setPen(titleBarFrameBorder); | - | ||||||||||||||||||||||||||||||||||||
| 2172 | - | |||||||||||||||||||||||||||||||||||||
| 2173 | // top outline | - | ||||||||||||||||||||||||||||||||||||
| 2174 | painter->drawLine(fullRect.left() + 5, fullRect.top(), fullRect.right() - 5, fullRect.top()); | - | ||||||||||||||||||||||||||||||||||||
| 2175 | painter->drawLine(fullRect.left(), fullRect.top() + 4, fullRect.left(), fullRect.bottom()); | - | ||||||||||||||||||||||||||||||||||||
| 2176 | const QPoint points[5] = { | - | ||||||||||||||||||||||||||||||||||||
| 2177 | QPoint(fullRect.left() + 4, fullRect.top() + 1), | - | ||||||||||||||||||||||||||||||||||||
| 2178 | QPoint(fullRect.left() + 3, fullRect.top() + 1), | - | ||||||||||||||||||||||||||||||||||||
| 2179 | QPoint(fullRect.left() + 2, fullRect.top() + 2), | - | ||||||||||||||||||||||||||||||||||||
| 2180 | QPoint(fullRect.left() + 1, fullRect.top() + 3), | - | ||||||||||||||||||||||||||||||||||||
| 2181 | QPoint(fullRect.left() + 1, fullRect.top() + 4) | - | ||||||||||||||||||||||||||||||||||||
| 2182 | }; | - | ||||||||||||||||||||||||||||||||||||
| 2183 | painter->drawPoints(points, 5); | - | ||||||||||||||||||||||||||||||||||||
| 2184 | - | |||||||||||||||||||||||||||||||||||||
| 2185 | painter->drawLine(fullRect.right(), fullRect.top() + 4, fullRect.right(), fullRect.bottom()); | - | ||||||||||||||||||||||||||||||||||||
| 2186 | const QPoint points2[5] = { | - | ||||||||||||||||||||||||||||||||||||
| 2187 | QPoint(fullRect.right() - 3, fullRect.top() + 1), | - | ||||||||||||||||||||||||||||||||||||
| 2188 | QPoint(fullRect.right() - 4, fullRect.top() + 1), | - | ||||||||||||||||||||||||||||||||||||
| 2189 | QPoint(fullRect.right() - 2, fullRect.top() + 2), | - | ||||||||||||||||||||||||||||||||||||
| 2190 | QPoint(fullRect.right() - 1, fullRect.top() + 3), | - | ||||||||||||||||||||||||||||||||||||
| 2191 | QPoint(fullRect.right() - 1, fullRect.top() + 4) | - | ||||||||||||||||||||||||||||||||||||
| 2192 | }; | - | ||||||||||||||||||||||||||||||||||||
| 2193 | painter->drawPoints(points2, 5); | - | ||||||||||||||||||||||||||||||||||||
| 2194 | - | |||||||||||||||||||||||||||||||||||||
| 2195 | // draw bottomline | - | ||||||||||||||||||||||||||||||||||||
| 2196 | painter->drawLine(fullRect.right(), fullRect.bottom(), fullRect.left(), fullRect.bottom()); | - | ||||||||||||||||||||||||||||||||||||
| 2197 | - | |||||||||||||||||||||||||||||||||||||
| 2198 | // top highlight | - | ||||||||||||||||||||||||||||||||||||
| 2199 | painter->setPen(titleBarHighlight); | - | ||||||||||||||||||||||||||||||||||||
| 2200 | painter->drawLine(fullRect.left() + 6, fullRect.top() + 1, fullRect.right() - 6, fullRect.top() + 1); | - | ||||||||||||||||||||||||||||||||||||
| 2201 | } | - | ||||||||||||||||||||||||||||||||||||
| 2202 | // draw title | - | ||||||||||||||||||||||||||||||||||||
| 2203 | QRect textRect = proxy()->subControlRect(CC_TitleBar, titleBar, SC_TitleBarLabel, widget); | - | ||||||||||||||||||||||||||||||||||||
| 2204 | painter->setPen(active? (titleBar->palette.text().color().lighter(120)) : | - | ||||||||||||||||||||||||||||||||||||
| 2205 | titleBar->palette.text().color() ); | - | ||||||||||||||||||||||||||||||||||||
| 2206 | // Note workspace also does elliding but it does not use the correct font | - | ||||||||||||||||||||||||||||||||||||
| 2207 | QString title = painter->fontMetrics().elidedText(titleBar->text, Qt::ElideRight, textRect.width() - 14); | - | ||||||||||||||||||||||||||||||||||||
| 2208 | painter->drawText(textRect.adjusted(1, 1, 1, 1), title, QTextOption(Qt::AlignHCenter | Qt::AlignVCenter)); | - | ||||||||||||||||||||||||||||||||||||
| 2209 | painter->setPen(Qt::white); | - | ||||||||||||||||||||||||||||||||||||
| 2210 | if (active)
| 0 | ||||||||||||||||||||||||||||||||||||
| 2211 | painter->drawText(textRect, title, QTextOption(Qt::AlignHCenter | Qt::AlignVCenter)); never executed: painter->drawText(textRect, title, QTextOption(Qt::AlignHCenter | Qt::AlignVCenter)); | 0 | ||||||||||||||||||||||||||||||||||||
| 2212 | // min button | - | ||||||||||||||||||||||||||||||||||||
| 2213 | if ((titleBar->subControls & SC_TitleBarMinButton) && (titleBar->titleBarFlags & Qt::WindowMinimizeButtonHint) &&
| 0 | ||||||||||||||||||||||||||||||||||||
| 2214 | !(titleBar->titleBarState& Qt::WindowMinimized)) {
| 0 | ||||||||||||||||||||||||||||||||||||
| 2215 | QRect minButtonRect = proxy()->subControlRect(CC_TitleBar, titleBar, SC_TitleBarMinButton, widget); | - | ||||||||||||||||||||||||||||||||||||
| 2216 | if (minButtonRect.isValid()) {
| 0 | ||||||||||||||||||||||||||||||||||||
| 2217 | bool hover = (titleBar->activeSubControls & SC_TitleBarMinButton) && (titleBar->state & State_MouseOver);
| 0 | ||||||||||||||||||||||||||||||||||||
| 2218 | bool sunken = (titleBar->activeSubControls & SC_TitleBarMinButton) && (titleBar->state & State_Sunken);
| 0 | ||||||||||||||||||||||||||||||||||||
| 2219 | qt_fusion_draw_mdibutton(painter, titleBar, minButtonRect, hover, sunken); | - | ||||||||||||||||||||||||||||||||||||
| 2220 | QRect minButtonIconRect = minButtonRect.adjusted(buttonMargin ,buttonMargin , -buttonMargin, -buttonMargin); | - | ||||||||||||||||||||||||||||||||||||
| 2221 | painter->setPen(textColor); | - | ||||||||||||||||||||||||||||||||||||
| 2222 | painter->drawLine(minButtonIconRect.center().x() - 2, minButtonIconRect.center().y() + 3, | - | ||||||||||||||||||||||||||||||||||||
| 2223 | minButtonIconRect.center().x() + 3, minButtonIconRect.center().y() + 3); | - | ||||||||||||||||||||||||||||||||||||
| 2224 | painter->drawLine(minButtonIconRect.center().x() - 2, minButtonIconRect.center().y() + 4, | - | ||||||||||||||||||||||||||||||||||||
| 2225 | minButtonIconRect.center().x() + 3, minButtonIconRect.center().y() + 4); | - | ||||||||||||||||||||||||||||||||||||
| 2226 | painter->setPen(textAlphaColor); | - | ||||||||||||||||||||||||||||||||||||
| 2227 | painter->drawLine(minButtonIconRect.center().x() - 3, minButtonIconRect.center().y() + 3, | - | ||||||||||||||||||||||||||||||||||||
| 2228 | minButtonIconRect.center().x() - 3, minButtonIconRect.center().y() + 4); | - | ||||||||||||||||||||||||||||||||||||
| 2229 | painter->drawLine(minButtonIconRect.center().x() + 4, minButtonIconRect.center().y() + 3, | - | ||||||||||||||||||||||||||||||||||||
| 2230 | minButtonIconRect.center().x() + 4, minButtonIconRect.center().y() + 4); | - | ||||||||||||||||||||||||||||||||||||
| 2231 | } never executed: end of block | 0 | ||||||||||||||||||||||||||||||||||||
| 2232 | } never executed: end of block | 0 | ||||||||||||||||||||||||||||||||||||
| 2233 | // max button | - | ||||||||||||||||||||||||||||||||||||
| 2234 | if ((titleBar->subControls & SC_TitleBarMaxButton) && (titleBar->titleBarFlags & Qt::WindowMaximizeButtonHint) &&
| 0 | ||||||||||||||||||||||||||||||||||||
| 2235 | !(titleBar->titleBarState & Qt::WindowMaximized)) {
| 0 | ||||||||||||||||||||||||||||||||||||
| 2236 | QRect maxButtonRect = proxy()->subControlRect(CC_TitleBar, titleBar, SC_TitleBarMaxButton, widget); | - | ||||||||||||||||||||||||||||||||||||
| 2237 | if (maxButtonRect.isValid()) {
| 0 | ||||||||||||||||||||||||||||||||||||
| 2238 | bool hover = (titleBar->activeSubControls & SC_TitleBarMaxButton) && (titleBar->state & State_MouseOver);
| 0 | ||||||||||||||||||||||||||||||||||||
| 2239 | bool sunken = (titleBar->activeSubControls & SC_TitleBarMaxButton) && (titleBar->state & State_Sunken);
| 0 | ||||||||||||||||||||||||||||||||||||
| 2240 | qt_fusion_draw_mdibutton(painter, titleBar, maxButtonRect, hover, sunken); | - | ||||||||||||||||||||||||||||||||||||
| 2241 | - | |||||||||||||||||||||||||||||||||||||
| 2242 | QRect maxButtonIconRect = maxButtonRect.adjusted(buttonMargin, buttonMargin, -buttonMargin, -buttonMargin); | - | ||||||||||||||||||||||||||||||||||||
| 2243 | - | |||||||||||||||||||||||||||||||||||||
| 2244 | painter->setPen(textColor); | - | ||||||||||||||||||||||||||||||||||||
| 2245 | painter->drawRect(maxButtonIconRect.adjusted(0, 0, -1, -1)); | - | ||||||||||||||||||||||||||||||||||||
| 2246 | painter->drawLine(maxButtonIconRect.left() + 1, maxButtonIconRect.top() + 1, | - | ||||||||||||||||||||||||||||||||||||
| 2247 | maxButtonIconRect.right() - 1, maxButtonIconRect.top() + 1); | - | ||||||||||||||||||||||||||||||||||||
| 2248 | painter->setPen(textAlphaColor); | - | ||||||||||||||||||||||||||||||||||||
| 2249 | const QPoint points[4] = { | - | ||||||||||||||||||||||||||||||||||||
| 2250 | maxButtonIconRect.topLeft(), | - | ||||||||||||||||||||||||||||||||||||
| 2251 | maxButtonIconRect.topRight(), | - | ||||||||||||||||||||||||||||||||||||
| 2252 | maxButtonIconRect.bottomLeft(), | - | ||||||||||||||||||||||||||||||||||||
| 2253 | maxButtonIconRect.bottomRight() | - | ||||||||||||||||||||||||||||||||||||
| 2254 | }; | - | ||||||||||||||||||||||||||||||||||||
| 2255 | painter->drawPoints(points, 4); | - | ||||||||||||||||||||||||||||||||||||
| 2256 | } never executed: end of block | 0 | ||||||||||||||||||||||||||||||||||||
| 2257 | } never executed: end of block | 0 | ||||||||||||||||||||||||||||||||||||
| 2258 | - | |||||||||||||||||||||||||||||||||||||
| 2259 | // close button | - | ||||||||||||||||||||||||||||||||||||
| 2260 | if ((titleBar->subControls & SC_TitleBarCloseButton) && (titleBar->titleBarFlags & Qt::WindowSystemMenuHint)) {
| 0 | ||||||||||||||||||||||||||||||||||||
| 2261 | QRect closeButtonRect = proxy()->subControlRect(CC_TitleBar, titleBar, SC_TitleBarCloseButton, widget); | - | ||||||||||||||||||||||||||||||||||||
| 2262 | if (closeButtonRect.isValid()) {
| 0 | ||||||||||||||||||||||||||||||||||||
| 2263 | bool hover = (titleBar->activeSubControls & SC_TitleBarCloseButton) && (titleBar->state & State_MouseOver);
| 0 | ||||||||||||||||||||||||||||||||||||
| 2264 | bool sunken = (titleBar->activeSubControls & SC_TitleBarCloseButton) && (titleBar->state & State_Sunken);
| 0 | ||||||||||||||||||||||||||||||||||||
| 2265 | qt_fusion_draw_mdibutton(painter, titleBar, closeButtonRect, hover, sunken); | - | ||||||||||||||||||||||||||||||||||||
| 2266 | QRect closeIconRect = closeButtonRect.adjusted(buttonMargin, buttonMargin, -buttonMargin, -buttonMargin); | - | ||||||||||||||||||||||||||||||||||||
| 2267 | painter->setPen(textAlphaColor); | - | ||||||||||||||||||||||||||||||||||||
| 2268 | const QLine lines[4] = { | - | ||||||||||||||||||||||||||||||||||||
| 2269 | QLine(closeIconRect.left() + 1, closeIconRect.top(), | - | ||||||||||||||||||||||||||||||||||||
| 2270 | closeIconRect.right(), closeIconRect.bottom() - 1), | - | ||||||||||||||||||||||||||||||||||||
| 2271 | QLine(closeIconRect.left(), closeIconRect.top() + 1, | - | ||||||||||||||||||||||||||||||||||||
| 2272 | closeIconRect.right() - 1, closeIconRect.bottom()), | - | ||||||||||||||||||||||||||||||||||||
| 2273 | QLine(closeIconRect.right() - 1, closeIconRect.top(), | - | ||||||||||||||||||||||||||||||||||||
| 2274 | closeIconRect.left(), closeIconRect.bottom() - 1), | - | ||||||||||||||||||||||||||||||||||||
| 2275 | QLine(closeIconRect.right(), closeIconRect.top() + 1, | - | ||||||||||||||||||||||||||||||||||||
| 2276 | closeIconRect.left() + 1, closeIconRect.bottom()) | - | ||||||||||||||||||||||||||||||||||||
| 2277 | }; | - | ||||||||||||||||||||||||||||||||||||
| 2278 | painter->drawLines(lines, 4); | - | ||||||||||||||||||||||||||||||||||||
| 2279 | const QPoint points[4] = { | - | ||||||||||||||||||||||||||||||||||||
| 2280 | closeIconRect.topLeft(), | - | ||||||||||||||||||||||||||||||||||||
| 2281 | closeIconRect.topRight(), | - | ||||||||||||||||||||||||||||||||||||
| 2282 | closeIconRect.bottomLeft(), | - | ||||||||||||||||||||||||||||||||||||
| 2283 | closeIconRect.bottomRight() | - | ||||||||||||||||||||||||||||||||||||
| 2284 | }; | - | ||||||||||||||||||||||||||||||||||||
| 2285 | painter->drawPoints(points, 4); | - | ||||||||||||||||||||||||||||||||||||
| 2286 | - | |||||||||||||||||||||||||||||||||||||
| 2287 | painter->setPen(textColor); | - | ||||||||||||||||||||||||||||||||||||
| 2288 | painter->drawLine(closeIconRect.left() + 1, closeIconRect.top() + 1, | - | ||||||||||||||||||||||||||||||||||||
| 2289 | closeIconRect.right() - 1, closeIconRect.bottom() - 1); | - | ||||||||||||||||||||||||||||||||||||
| 2290 | painter->drawLine(closeIconRect.left() + 1, closeIconRect.bottom() - 1, | - | ||||||||||||||||||||||||||||||||||||
| 2291 | closeIconRect.right() - 1, closeIconRect.top() + 1); | - | ||||||||||||||||||||||||||||||||||||
| 2292 | } never executed: end of block | 0 | ||||||||||||||||||||||||||||||||||||
| 2293 | } never executed: end of block | 0 | ||||||||||||||||||||||||||||||||||||
| 2294 | - | |||||||||||||||||||||||||||||||||||||
| 2295 | // normalize button | - | ||||||||||||||||||||||||||||||||||||
| 2296 | if ((titleBar->subControls & SC_TitleBarNormalButton) &&
| 0 | ||||||||||||||||||||||||||||||||||||
| 2297 | (((titleBar->titleBarFlags & Qt::WindowMinimizeButtonHint) &&
| 0 | ||||||||||||||||||||||||||||||||||||
| 2298 | (titleBar->titleBarState & Qt::WindowMinimized)) ||
| 0 | ||||||||||||||||||||||||||||||||||||
| 2299 | ((titleBar->titleBarFlags & Qt::WindowMaximizeButtonHint) &&
| 0 | ||||||||||||||||||||||||||||||||||||
| 2300 | (titleBar->titleBarState & Qt::WindowMaximized)))) {
| 0 | ||||||||||||||||||||||||||||||||||||
| 2301 | QRect normalButtonRect = proxy()->subControlRect(CC_TitleBar, titleBar, SC_TitleBarNormalButton, widget); | - | ||||||||||||||||||||||||||||||||||||
| 2302 | if (normalButtonRect.isValid()) {
| 0 | ||||||||||||||||||||||||||||||||||||
| 2303 | - | |||||||||||||||||||||||||||||||||||||
| 2304 | bool hover = (titleBar->activeSubControls & SC_TitleBarNormalButton) && (titleBar->state & State_MouseOver);
| 0 | ||||||||||||||||||||||||||||||||||||
| 2305 | bool sunken = (titleBar->activeSubControls & SC_TitleBarNormalButton) && (titleBar->state & State_Sunken);
| 0 | ||||||||||||||||||||||||||||||||||||
| 2306 | QRect normalButtonIconRect = normalButtonRect.adjusted(buttonMargin, buttonMargin, -buttonMargin, -buttonMargin); | - | ||||||||||||||||||||||||||||||||||||
| 2307 | qt_fusion_draw_mdibutton(painter, titleBar, normalButtonRect, hover, sunken); | - | ||||||||||||||||||||||||||||||||||||
| 2308 | - | |||||||||||||||||||||||||||||||||||||
| 2309 | QRect frontWindowRect = normalButtonIconRect.adjusted(0, 3, -3, 0); | - | ||||||||||||||||||||||||||||||||||||
| 2310 | painter->setPen(textColor); | - | ||||||||||||||||||||||||||||||||||||
| 2311 | painter->drawRect(frontWindowRect.adjusted(0, 0, -1, -1)); | - | ||||||||||||||||||||||||||||||||||||
| 2312 | painter->drawLine(frontWindowRect.left() + 1, frontWindowRect.top() + 1, | - | ||||||||||||||||||||||||||||||||||||
| 2313 | frontWindowRect.right() - 1, frontWindowRect.top() + 1); | - | ||||||||||||||||||||||||||||||||||||
| 2314 | painter->setPen(textAlphaColor); | - | ||||||||||||||||||||||||||||||||||||
| 2315 | const QPoint points[4] = { | - | ||||||||||||||||||||||||||||||||||||
| 2316 | frontWindowRect.topLeft(), | - | ||||||||||||||||||||||||||||||||||||
| 2317 | frontWindowRect.topRight(), | - | ||||||||||||||||||||||||||||||||||||
| 2318 | frontWindowRect.bottomLeft(), | - | ||||||||||||||||||||||||||||||||||||
| 2319 | frontWindowRect.bottomRight() | - | ||||||||||||||||||||||||||||||||||||
| 2320 | }; | - | ||||||||||||||||||||||||||||||||||||
| 2321 | painter->drawPoints(points, 4); | - | ||||||||||||||||||||||||||||||||||||
| 2322 | - | |||||||||||||||||||||||||||||||||||||
| 2323 | QRect backWindowRect = normalButtonIconRect.adjusted(3, 0, 0, -3); | - | ||||||||||||||||||||||||||||||||||||
| 2324 | QRegion clipRegion = backWindowRect; | - | ||||||||||||||||||||||||||||||||||||
| 2325 | clipRegion -= frontWindowRect; | - | ||||||||||||||||||||||||||||||||||||
| 2326 | painter->save(); | - | ||||||||||||||||||||||||||||||||||||
| 2327 | painter->setClipRegion(clipRegion); | - | ||||||||||||||||||||||||||||||||||||
| 2328 | painter->setPen(textColor); | - | ||||||||||||||||||||||||||||||||||||
| 2329 | painter->drawRect(backWindowRect.adjusted(0, 0, -1, -1)); | - | ||||||||||||||||||||||||||||||||||||
| 2330 | painter->drawLine(backWindowRect.left() + 1, backWindowRect.top() + 1, | - | ||||||||||||||||||||||||||||||||||||
| 2331 | backWindowRect.right() - 1, backWindowRect.top() + 1); | - | ||||||||||||||||||||||||||||||||||||
| 2332 | painter->setPen(textAlphaColor); | - | ||||||||||||||||||||||||||||||||||||
| 2333 | const QPoint points2[4] = { | - | ||||||||||||||||||||||||||||||||||||
| 2334 | backWindowRect.topLeft(), | - | ||||||||||||||||||||||||||||||||||||
| 2335 | backWindowRect.topRight(), | - | ||||||||||||||||||||||||||||||||||||
| 2336 | backWindowRect.bottomLeft(), | - | ||||||||||||||||||||||||||||||||||||
| 2337 | backWindowRect.bottomRight() | - | ||||||||||||||||||||||||||||||||||||
| 2338 | }; | - | ||||||||||||||||||||||||||||||||||||
| 2339 | painter->drawPoints(points2, 4); | - | ||||||||||||||||||||||||||||||||||||
| 2340 | painter->restore(); | - | ||||||||||||||||||||||||||||||||||||
| 2341 | } never executed: end of block | 0 | ||||||||||||||||||||||||||||||||||||
| 2342 | } never executed: end of block | 0 | ||||||||||||||||||||||||||||||||||||
| 2343 | - | |||||||||||||||||||||||||||||||||||||
| 2344 | // context help button | - | ||||||||||||||||||||||||||||||||||||
| 2345 | if (titleBar->subControls & SC_TitleBarContextHelpButton
| 0 | ||||||||||||||||||||||||||||||||||||
| 2346 | && (titleBar->titleBarFlags & Qt::WindowContextHelpButtonHint)) {
| 0 | ||||||||||||||||||||||||||||||||||||
| 2347 | QRect contextHelpButtonRect = proxy()->subControlRect(CC_TitleBar, titleBar, SC_TitleBarContextHelpButton, widget); | - | ||||||||||||||||||||||||||||||||||||
| 2348 | if (contextHelpButtonRect.isValid()) {
| 0 | ||||||||||||||||||||||||||||||||||||
| 2349 | bool hover = (titleBar->activeSubControls & SC_TitleBarContextHelpButton) && (titleBar->state & State_MouseOver);
| 0 | ||||||||||||||||||||||||||||||||||||
| 2350 | bool sunken = (titleBar->activeSubControls & SC_TitleBarContextHelpButton) && (titleBar->state & State_Sunken);
| 0 | ||||||||||||||||||||||||||||||||||||
| 2351 | qt_fusion_draw_mdibutton(painter, titleBar, contextHelpButtonRect, hover, sunken); | - | ||||||||||||||||||||||||||||||||||||
| 2352 | QImage image(qt_titlebar_context_help); | - | ||||||||||||||||||||||||||||||||||||
| 2353 | QColor alpha = textColor; | - | ||||||||||||||||||||||||||||||||||||
| 2354 | alpha.setAlpha(128); | - | ||||||||||||||||||||||||||||||||||||
| 2355 | image.setColor(1, textColor.rgba()); | - | ||||||||||||||||||||||||||||||||||||
| 2356 | image.setColor(2, alpha.rgba()); | - | ||||||||||||||||||||||||||||||||||||
| 2357 | painter->setRenderHint(QPainter::SmoothPixmapTransform); | - | ||||||||||||||||||||||||||||||||||||
| 2358 | painter->drawImage(contextHelpButtonRect.adjusted(4, 4, -4, -4), image); | - | ||||||||||||||||||||||||||||||||||||
| 2359 | } never executed: end of block | 0 | ||||||||||||||||||||||||||||||||||||
| 2360 | } never executed: end of block | 0 | ||||||||||||||||||||||||||||||||||||
| 2361 | - | |||||||||||||||||||||||||||||||||||||
| 2362 | // shade button | - | ||||||||||||||||||||||||||||||||||||
| 2363 | if (titleBar->subControls & SC_TitleBarShadeButton && (titleBar->titleBarFlags & Qt::WindowShadeButtonHint)) {
| 0 | ||||||||||||||||||||||||||||||||||||
| 2364 | QRect shadeButtonRect = proxy()->subControlRect(CC_TitleBar, titleBar, SC_TitleBarShadeButton, widget); | - | ||||||||||||||||||||||||||||||||||||
| 2365 | if (shadeButtonRect.isValid()) {
| 0 | ||||||||||||||||||||||||||||||||||||
| 2366 | bool hover = (titleBar->activeSubControls & SC_TitleBarShadeButton) && (titleBar->state & State_MouseOver);
| 0 | ||||||||||||||||||||||||||||||||||||
| 2367 | bool sunken = (titleBar->activeSubControls & SC_TitleBarShadeButton) && (titleBar->state & State_Sunken);
| 0 | ||||||||||||||||||||||||||||||||||||
| 2368 | qt_fusion_draw_mdibutton(painter, titleBar, shadeButtonRect, hover, sunken); | - | ||||||||||||||||||||||||||||||||||||
| 2369 | QPixmap arrow = colorizedImage(QLatin1String(":/qt-project.org/styles/commonstyle/images/fusion_arrow.png"), textColor); | - | ||||||||||||||||||||||||||||||||||||
| 2370 | painter->drawPixmap(shadeButtonRect.adjusted(5, 7, -5, -7), arrow); | - | ||||||||||||||||||||||||||||||||||||
| 2371 | } never executed: end of block | 0 | ||||||||||||||||||||||||||||||||||||
| 2372 | } never executed: end of block | 0 | ||||||||||||||||||||||||||||||||||||
| 2373 | - | |||||||||||||||||||||||||||||||||||||
| 2374 | // unshade button | - | ||||||||||||||||||||||||||||||||||||
| 2375 | if (titleBar->subControls & SC_TitleBarUnshadeButton && (titleBar->titleBarFlags & Qt::WindowShadeButtonHint)) {
| 0 | ||||||||||||||||||||||||||||||||||||
| 2376 | QRect unshadeButtonRect = proxy()->subControlRect(CC_TitleBar, titleBar, SC_TitleBarUnshadeButton, widget); | - | ||||||||||||||||||||||||||||||||||||
| 2377 | if (unshadeButtonRect.isValid()) {
| 0 | ||||||||||||||||||||||||||||||||||||
| 2378 | bool hover = (titleBar->activeSubControls & SC_TitleBarUnshadeButton) && (titleBar->state & State_MouseOver);
| 0 | ||||||||||||||||||||||||||||||||||||
| 2379 | bool sunken = (titleBar->activeSubControls & SC_TitleBarUnshadeButton) && (titleBar->state & State_Sunken);
| 0 | ||||||||||||||||||||||||||||||||||||
| 2380 | qt_fusion_draw_mdibutton(painter, titleBar, unshadeButtonRect, hover, sunken); | - | ||||||||||||||||||||||||||||||||||||
| 2381 | QPixmap arrow = colorizedImage(QLatin1String(":/qt-project.org/styles/commonstyle/images/fusion_arrow.png"), textColor, 180); | - | ||||||||||||||||||||||||||||||||||||
| 2382 | painter->drawPixmap(unshadeButtonRect.adjusted(5, 7, -5, -7), arrow); | - | ||||||||||||||||||||||||||||||||||||
| 2383 | } never executed: end of block | 0 | ||||||||||||||||||||||||||||||||||||
| 2384 | } never executed: end of block | 0 | ||||||||||||||||||||||||||||||||||||
| 2385 | - | |||||||||||||||||||||||||||||||||||||
| 2386 | if ((titleBar->subControls & SC_TitleBarSysMenu) && (titleBar->titleBarFlags & Qt::WindowSystemMenuHint)) {
| 0 | ||||||||||||||||||||||||||||||||||||
| 2387 | QRect iconRect = proxy()->subControlRect(CC_TitleBar, titleBar, SC_TitleBarSysMenu, widget); | - | ||||||||||||||||||||||||||||||||||||
| 2388 | if (iconRect.isValid()) {
| 0 | ||||||||||||||||||||||||||||||||||||
| 2389 | if (!titleBar->icon.isNull()) {
| 0 | ||||||||||||||||||||||||||||||||||||
| 2390 | titleBar->icon.paint(painter, iconRect); | - | ||||||||||||||||||||||||||||||||||||
| 2391 | } else { never executed: end of block | 0 | ||||||||||||||||||||||||||||||||||||
| 2392 | QStyleOption tool = *titleBar; | - | ||||||||||||||||||||||||||||||||||||
| 2393 | QPixmap pm = proxy()->standardIcon(SP_TitleBarMenuButton, &tool, widget).pixmap(16, 16); | - | ||||||||||||||||||||||||||||||||||||
| 2394 | tool.rect = iconRect; | - | ||||||||||||||||||||||||||||||||||||
| 2395 | painter->save(); | - | ||||||||||||||||||||||||||||||||||||
| 2396 | proxy()->drawItemPixmap(painter, iconRect, Qt::AlignCenter, pm); | - | ||||||||||||||||||||||||||||||||||||
| 2397 | painter->restore(); | - | ||||||||||||||||||||||||||||||||||||
| 2398 | } never executed: end of block | 0 | ||||||||||||||||||||||||||||||||||||
| 2399 | } | - | ||||||||||||||||||||||||||||||||||||
| 2400 | } never executed: end of block | 0 | ||||||||||||||||||||||||||||||||||||
| 2401 | } never executed: end of block | 0 | ||||||||||||||||||||||||||||||||||||
| 2402 | painter->restore(); | - | ||||||||||||||||||||||||||||||||||||
| 2403 | break; never executed: break; | 0 | ||||||||||||||||||||||||||||||||||||
| 2404 | case CC_ScrollBar: never executed: case CC_ScrollBar: | 0 | ||||||||||||||||||||||||||||||||||||
| 2405 | painter->save(); | - | ||||||||||||||||||||||||||||||||||||
| 2406 | if (const QStyleOptionSlider *scrollBar = qstyleoption_cast<const QStyleOptionSlider *>(option)) {
| 0 | ||||||||||||||||||||||||||||||||||||
| 2407 | bool wasActive = false; | - | ||||||||||||||||||||||||||||||||||||
| 2408 | qreal expandScale = 1.0; | - | ||||||||||||||||||||||||||||||||||||
| 2409 | qreal expandOffset = -1.0; | - | ||||||||||||||||||||||||||||||||||||
| 2410 | QObject *styleObject = option->styleObject; | - | ||||||||||||||||||||||||||||||||||||
| 2411 | if (styleObject && proxy()->styleHint(SH_ScrollBar_Transient, option, widget)) {
| 0 | ||||||||||||||||||||||||||||||||||||
| 2412 | qreal opacity = 0.0; | - | ||||||||||||||||||||||||||||||||||||
| 2413 | bool shouldExpand = false; | - | ||||||||||||||||||||||||||||||||||||
| 2414 | const qreal maxExpandScale = 13.0 / 9.0; | - | ||||||||||||||||||||||||||||||||||||
| 2415 | - | |||||||||||||||||||||||||||||||||||||
| 2416 | int oldPos = styleObject->property("_q_stylepos").toInt(); | - | ||||||||||||||||||||||||||||||||||||
| 2417 | int oldMin = styleObject->property("_q_stylemin").toInt(); | - | ||||||||||||||||||||||||||||||||||||
| 2418 | int oldMax = styleObject->property("_q_stylemax").toInt(); | - | ||||||||||||||||||||||||||||||||||||
| 2419 | QRect oldRect = styleObject->property("_q_stylerect").toRect(); | - | ||||||||||||||||||||||||||||||||||||
| 2420 | int oldState = styleObject->property("_q_stylestate").toInt(); | - | ||||||||||||||||||||||||||||||||||||
| 2421 | uint oldActiveControls = styleObject->property("_q_stylecontrols").toUInt(); | - | ||||||||||||||||||||||||||||||||||||
| 2422 | - | |||||||||||||||||||||||||||||||||||||
| 2423 | // a scrollbar is transient when the the scrollbar itself and | - | ||||||||||||||||||||||||||||||||||||
| 2424 | // its sibling are both inactive (ie. not pressed/hovered/moved) | - | ||||||||||||||||||||||||||||||||||||
| 2425 | bool transient = !option->activeSubControls && !(option->state & State_On);
| 0 | ||||||||||||||||||||||||||||||||||||
| 2426 | - | |||||||||||||||||||||||||||||||||||||
| 2427 | if (!transient ||
| 0 | ||||||||||||||||||||||||||||||||||||
| 2428 | oldPos != scrollBar->sliderPosition ||
| 0 | ||||||||||||||||||||||||||||||||||||
| 2429 | oldMin != scrollBar->minimum ||
| 0 | ||||||||||||||||||||||||||||||||||||
| 2430 | oldMax != scrollBar->maximum ||
| 0 | ||||||||||||||||||||||||||||||||||||
| 2431 | oldRect != scrollBar->rect ||
| 0 | ||||||||||||||||||||||||||||||||||||
| 2432 | oldState != scrollBar->state ||
| 0 | ||||||||||||||||||||||||||||||||||||
| 2433 | oldActiveControls != scrollBar->activeSubControls) {
| 0 | ||||||||||||||||||||||||||||||||||||
| 2434 | - | |||||||||||||||||||||||||||||||||||||
| 2435 | // if the scrollbar is transient or its attributes, geometry or | - | ||||||||||||||||||||||||||||||||||||
| 2436 | // state has changed, the opacity is reset back to 100% opaque | - | ||||||||||||||||||||||||||||||||||||
| 2437 | opacity = 1.0; | - | ||||||||||||||||||||||||||||||||||||
| 2438 | - | |||||||||||||||||||||||||||||||||||||
| 2439 | styleObject->setProperty("_q_stylepos", scrollBar->sliderPosition); | - | ||||||||||||||||||||||||||||||||||||
| 2440 | styleObject->setProperty("_q_stylemin", scrollBar->minimum); | - | ||||||||||||||||||||||||||||||||||||
| 2441 | styleObject->setProperty("_q_stylemax", scrollBar->maximum); | - | ||||||||||||||||||||||||||||||||||||
| 2442 | styleObject->setProperty("_q_stylerect", scrollBar->rect); | - | ||||||||||||||||||||||||||||||||||||
| 2443 | styleObject->setProperty("_q_stylestate", static_cast<int>(scrollBar->state)); | - | ||||||||||||||||||||||||||||||||||||
| 2444 | styleObject->setProperty("_q_stylecontrols", static_cast<uint>(scrollBar->activeSubControls)); | - | ||||||||||||||||||||||||||||||||||||
| 2445 | - | |||||||||||||||||||||||||||||||||||||
| 2446 | #ifndef QT_NO_ANIMATION | - | ||||||||||||||||||||||||||||||||||||
| 2447 | QScrollbarStyleAnimation *anim = qobject_cast<QScrollbarStyleAnimation *>(d->animation(styleObject)); | - | ||||||||||||||||||||||||||||||||||||
| 2448 | if (transient) {
| 0 | ||||||||||||||||||||||||||||||||||||
| 2449 | if (!anim) {
| 0 | ||||||||||||||||||||||||||||||||||||
| 2450 | anim = new QScrollbarStyleAnimation(QScrollbarStyleAnimation::Deactivating, styleObject); | - | ||||||||||||||||||||||||||||||||||||
| 2451 | d->startAnimation(anim); | - | ||||||||||||||||||||||||||||||||||||
| 2452 | } else if (anim->mode() == QScrollbarStyleAnimation::Deactivating) { never executed: end of block
| 0 | ||||||||||||||||||||||||||||||||||||
| 2453 | // the scrollbar was already fading out while the | - | ||||||||||||||||||||||||||||||||||||
| 2454 | // state changed -> restart the fade out animation | - | ||||||||||||||||||||||||||||||||||||
| 2455 | anim->setCurrentTime(0); | - | ||||||||||||||||||||||||||||||||||||
| 2456 | } never executed: end of block | 0 | ||||||||||||||||||||||||||||||||||||
| 2457 | } else if (anim && anim->mode() == QScrollbarStyleAnimation::Deactivating) { never executed: end of block
| 0 | ||||||||||||||||||||||||||||||||||||
| 2458 | d->stopAnimation(styleObject); | - | ||||||||||||||||||||||||||||||||||||
| 2459 | } never executed: end of block | 0 | ||||||||||||||||||||||||||||||||||||
| 2460 | #endif // !QT_NO_ANIMATION | - | ||||||||||||||||||||||||||||||||||||
| 2461 | } never executed: end of block | 0 | ||||||||||||||||||||||||||||||||||||
| 2462 | - | |||||||||||||||||||||||||||||||||||||
| 2463 | #ifndef QT_NO_ANIMATION | - | ||||||||||||||||||||||||||||||||||||
| 2464 | QScrollbarStyleAnimation *anim = qobject_cast<QScrollbarStyleAnimation *>(d->animation(styleObject)); | - | ||||||||||||||||||||||||||||||||||||
| 2465 | if (anim && anim->mode() == QScrollbarStyleAnimation::Deactivating) {
| 0 | ||||||||||||||||||||||||||||||||||||
| 2466 | // once a scrollbar was active (hovered/pressed), it retains | - | ||||||||||||||||||||||||||||||||||||
| 2467 | // the active look even if it's no longer active while fading out | - | ||||||||||||||||||||||||||||||||||||
| 2468 | if (oldActiveControls)
| 0 | ||||||||||||||||||||||||||||||||||||
| 2469 | anim->setActive(true); never executed: anim->setActive(true); | 0 | ||||||||||||||||||||||||||||||||||||
| 2470 | - | |||||||||||||||||||||||||||||||||||||
| 2471 | wasActive = anim->wasActive(); | - | ||||||||||||||||||||||||||||||||||||
| 2472 | opacity = anim->currentValue(); | - | ||||||||||||||||||||||||||||||||||||
| 2473 | } never executed: end of block | 0 | ||||||||||||||||||||||||||||||||||||
| 2474 | - | |||||||||||||||||||||||||||||||||||||
| 2475 | shouldExpand = (option->activeSubControls || wasActive);
| 0 | ||||||||||||||||||||||||||||||||||||
| 2476 | if (shouldExpand) {
| 0 | ||||||||||||||||||||||||||||||||||||
| 2477 | if (!anim && !oldActiveControls) {
| 0 | ||||||||||||||||||||||||||||||||||||
| 2478 | // Start expand animation only once and when entering | - | ||||||||||||||||||||||||||||||||||||
| 2479 | anim = new QScrollbarStyleAnimation(QScrollbarStyleAnimation::Activating, styleObject); | - | ||||||||||||||||||||||||||||||||||||
| 2480 | d->startAnimation(anim); | - | ||||||||||||||||||||||||||||||||||||
| 2481 | } never executed: end of block | 0 | ||||||||||||||||||||||||||||||||||||
| 2482 | if (anim && anim->mode() == QScrollbarStyleAnimation::Activating) {
| 0 | ||||||||||||||||||||||||||||||||||||
| 2483 | expandScale = 1.0 + (maxExpandScale - 1.0) * anim->currentValue(); | - | ||||||||||||||||||||||||||||||||||||
| 2484 | expandOffset = 5.5 * anim->currentValue() - 1; | - | ||||||||||||||||||||||||||||||||||||
| 2485 | } else { never executed: end of block | 0 | ||||||||||||||||||||||||||||||||||||
| 2486 | // Keep expanded state after the animation ends, and when fading out | - | ||||||||||||||||||||||||||||||||||||
| 2487 | expandScale = maxExpandScale; | - | ||||||||||||||||||||||||||||||||||||
| 2488 | expandOffset = 4.5; | - | ||||||||||||||||||||||||||||||||||||
| 2489 | } never executed: end of block | 0 | ||||||||||||||||||||||||||||||||||||
| 2490 | } | - | ||||||||||||||||||||||||||||||||||||
| 2491 | painter->setOpacity(opacity); | - | ||||||||||||||||||||||||||||||||||||
| 2492 | #endif // !QT_NO_ANIMATION | - | ||||||||||||||||||||||||||||||||||||
| 2493 | } never executed: end of block | 0 | ||||||||||||||||||||||||||||||||||||
| 2494 | - | |||||||||||||||||||||||||||||||||||||
| 2495 | bool transient = proxy()->styleHint(SH_ScrollBar_Transient, option, widget); | - | ||||||||||||||||||||||||||||||||||||
| 2496 | bool horizontal = scrollBar->orientation == Qt::Horizontal; | - | ||||||||||||||||||||||||||||||||||||
| 2497 | bool sunken = scrollBar->state & State_Sunken; | - | ||||||||||||||||||||||||||||||||||||
| 2498 | - | |||||||||||||||||||||||||||||||||||||
| 2499 | QRect scrollBarSubLine = proxy()->subControlRect(control, scrollBar, SC_ScrollBarSubLine, widget); | - | ||||||||||||||||||||||||||||||||||||
| 2500 | QRect scrollBarAddLine = proxy()->subControlRect(control, scrollBar, SC_ScrollBarAddLine, widget); | - | ||||||||||||||||||||||||||||||||||||
| 2501 | QRect scrollBarSlider = proxy()->subControlRect(control, scrollBar, SC_ScrollBarSlider, widget); | - | ||||||||||||||||||||||||||||||||||||
| 2502 | QRect scrollBarGroove = proxy()->subControlRect(control, scrollBar, SC_ScrollBarGroove, widget); | - | ||||||||||||||||||||||||||||||||||||
| 2503 | - | |||||||||||||||||||||||||||||||||||||
| 2504 | QRect rect = option->rect; | - | ||||||||||||||||||||||||||||||||||||
| 2505 | QColor alphaOutline = outline; | - | ||||||||||||||||||||||||||||||||||||
| 2506 | alphaOutline.setAlpha(180); | - | ||||||||||||||||||||||||||||||||||||
| 2507 | - | |||||||||||||||||||||||||||||||||||||
| 2508 | QColor arrowColor = option->palette.foreground().color(); | - | ||||||||||||||||||||||||||||||||||||
| 2509 | arrowColor.setAlpha(220); | - | ||||||||||||||||||||||||||||||||||||
| 2510 | - | |||||||||||||||||||||||||||||||||||||
| 2511 | const QColor bgColor = QStyleHelper::backgroundColor(option->palette, widget); | - | ||||||||||||||||||||||||||||||||||||
| 2512 | const bool isDarkBg = bgColor.red() < 128 && bgColor.green() < 128 && bgColor.blue() < 128;
| 0 | ||||||||||||||||||||||||||||||||||||
| 2513 | - | |||||||||||||||||||||||||||||||||||||
| 2514 | if (transient) {
| 0 | ||||||||||||||||||||||||||||||||||||
| 2515 | if (horizontal) {
| 0 | ||||||||||||||||||||||||||||||||||||
| 2516 | rect.setY(rect.y() + 4.5 - expandOffset); | - | ||||||||||||||||||||||||||||||||||||
| 2517 | scrollBarSlider.setY(scrollBarSlider.y() + 4.5 - expandOffset); | - | ||||||||||||||||||||||||||||||||||||
| 2518 | scrollBarGroove.setY(scrollBarGroove.y() + 4.5 - expandOffset); | - | ||||||||||||||||||||||||||||||||||||
| 2519 | - | |||||||||||||||||||||||||||||||||||||
| 2520 | rect.setHeight(rect.height() * expandScale); | - | ||||||||||||||||||||||||||||||||||||
| 2521 | scrollBarGroove.setHeight(scrollBarGroove.height() * expandScale); | - | ||||||||||||||||||||||||||||||||||||
| 2522 | } else { never executed: end of block | 0 | ||||||||||||||||||||||||||||||||||||
| 2523 | rect.setX(rect.x() + 4.5 - expandOffset); | - | ||||||||||||||||||||||||||||||||||||
| 2524 | scrollBarSlider.setX(scrollBarSlider.x() + 4.5 - expandOffset); | - | ||||||||||||||||||||||||||||||||||||
| 2525 | scrollBarGroove.setX(scrollBarGroove.x() + 4.5 - expandOffset); | - | ||||||||||||||||||||||||||||||||||||
| 2526 | - | |||||||||||||||||||||||||||||||||||||
| 2527 | rect.setWidth(rect.width() * expandScale); | - | ||||||||||||||||||||||||||||||||||||
| 2528 | scrollBarGroove.setWidth(scrollBarGroove.width() * expandScale); | - | ||||||||||||||||||||||||||||||||||||
| 2529 | } never executed: end of block | 0 | ||||||||||||||||||||||||||||||||||||
| 2530 | } | - | ||||||||||||||||||||||||||||||||||||
| 2531 | - | |||||||||||||||||||||||||||||||||||||
| 2532 | // Paint groove | - | ||||||||||||||||||||||||||||||||||||
| 2533 | if ((!transient || scrollBar->activeSubControls || wasActive) && scrollBar->subControls & SC_ScrollBarGroove) {
| 0 | ||||||||||||||||||||||||||||||||||||
| 2534 | QLinearGradient gradient(rect.center().x(), rect.top(), | - | ||||||||||||||||||||||||||||||||||||
| 2535 | rect.center().x(), rect.bottom()); | - | ||||||||||||||||||||||||||||||||||||
| 2536 | if (!horizontal)
| 0 | ||||||||||||||||||||||||||||||||||||
| 2537 | gradient = QLinearGradient(rect.left(), rect.center().y(), never executed: gradient = QLinearGradient(rect.left(), rect.center().y(), rect.right(), rect.center().y()); | 0 | ||||||||||||||||||||||||||||||||||||
| 2538 | rect.right(), rect.center().y()); never executed: gradient = QLinearGradient(rect.left(), rect.center().y(), rect.right(), rect.center().y()); | 0 | ||||||||||||||||||||||||||||||||||||
| 2539 | if (!transient || !isDarkBg) {
| 0 | ||||||||||||||||||||||||||||||||||||
| 2540 | gradient.setColorAt(0, buttonColor.darker(107)); | - | ||||||||||||||||||||||||||||||||||||
| 2541 | gradient.setColorAt(0.1, buttonColor.darker(105)); | - | ||||||||||||||||||||||||||||||||||||
| 2542 | gradient.setColorAt(0.9, buttonColor.darker(105)); | - | ||||||||||||||||||||||||||||||||||||
| 2543 | gradient.setColorAt(1, buttonColor.darker(107)); | - | ||||||||||||||||||||||||||||||||||||
| 2544 | } else { never executed: end of block | 0 | ||||||||||||||||||||||||||||||||||||
| 2545 | gradient.setColorAt(0, bgColor.lighter(157)); | - | ||||||||||||||||||||||||||||||||||||
| 2546 | gradient.setColorAt(0.1, bgColor.lighter(155)); | - | ||||||||||||||||||||||||||||||||||||
| 2547 | gradient.setColorAt(0.9, bgColor.lighter(155)); | - | ||||||||||||||||||||||||||||||||||||
| 2548 | gradient.setColorAt(1, bgColor.lighter(157)); | - | ||||||||||||||||||||||||||||||||||||
| 2549 | } never executed: end of block | 0 | ||||||||||||||||||||||||||||||||||||
| 2550 | - | |||||||||||||||||||||||||||||||||||||
| 2551 | painter->save(); | - | ||||||||||||||||||||||||||||||||||||
| 2552 | if (transient)
| 0 | ||||||||||||||||||||||||||||||||||||
| 2553 | painter->setOpacity(0.8); never executed: painter->setOpacity(0.8); | 0 | ||||||||||||||||||||||||||||||||||||
| 2554 | painter->fillRect(rect, gradient); | - | ||||||||||||||||||||||||||||||||||||
| 2555 | painter->setPen(Qt::NoPen); | - | ||||||||||||||||||||||||||||||||||||
| 2556 | if (transient)
| 0 | ||||||||||||||||||||||||||||||||||||
| 2557 | painter->setOpacity(0.4); never executed: painter->setOpacity(0.4); | 0 | ||||||||||||||||||||||||||||||||||||
| 2558 | painter->setPen(alphaOutline); | - | ||||||||||||||||||||||||||||||||||||
| 2559 | if (horizontal)
| 0 | ||||||||||||||||||||||||||||||||||||
| 2560 | painter->drawLine(rect.topLeft(), rect.topRight()); never executed: painter->drawLine(rect.topLeft(), rect.topRight()); | 0 | ||||||||||||||||||||||||||||||||||||
| 2561 | else | - | ||||||||||||||||||||||||||||||||||||
| 2562 | painter->drawLine(rect.topLeft(), rect.bottomLeft()); never executed: painter->drawLine(rect.topLeft(), rect.bottomLeft()); | 0 | ||||||||||||||||||||||||||||||||||||
| 2563 | - | |||||||||||||||||||||||||||||||||||||
| 2564 | QColor subtleEdge = alphaOutline; | - | ||||||||||||||||||||||||||||||||||||
| 2565 | subtleEdge.setAlpha(40); | - | ||||||||||||||||||||||||||||||||||||
| 2566 | painter->setPen(subtleEdge); | - | ||||||||||||||||||||||||||||||||||||
| 2567 | painter->setBrush(Qt::NoBrush); | - | ||||||||||||||||||||||||||||||||||||
| 2568 | painter->setClipRect(scrollBarGroove.adjusted(1, 0, -1, -3)); | - | ||||||||||||||||||||||||||||||||||||
| 2569 | painter->drawRect(scrollBarGroove.adjusted(1, 0, -1, -1)); | - | ||||||||||||||||||||||||||||||||||||
| 2570 | painter->restore(); | - | ||||||||||||||||||||||||||||||||||||
| 2571 | } never executed: end of block | 0 | ||||||||||||||||||||||||||||||||||||
| 2572 | - | |||||||||||||||||||||||||||||||||||||
| 2573 | QRect pixmapRect = scrollBarSlider; | - | ||||||||||||||||||||||||||||||||||||
| 2574 | QLinearGradient gradient(pixmapRect.center().x(), pixmapRect.top(), | - | ||||||||||||||||||||||||||||||||||||
| 2575 | pixmapRect.center().x(), pixmapRect.bottom()); | - | ||||||||||||||||||||||||||||||||||||
| 2576 | if (!horizontal)
| 0 | ||||||||||||||||||||||||||||||||||||
| 2577 | gradient = QLinearGradient(pixmapRect.left(), pixmapRect.center().y(), never executed: gradient = QLinearGradient(pixmapRect.left(), pixmapRect.center().y(), pixmapRect.right(), pixmapRect.center().y()); | 0 | ||||||||||||||||||||||||||||||||||||
| 2578 | pixmapRect.right(), pixmapRect.center().y()); never executed: gradient = QLinearGradient(pixmapRect.left(), pixmapRect.center().y(), pixmapRect.right(), pixmapRect.center().y()); | 0 | ||||||||||||||||||||||||||||||||||||
| 2579 | - | |||||||||||||||||||||||||||||||||||||
| 2580 | QLinearGradient highlightedGradient = gradient; | - | ||||||||||||||||||||||||||||||||||||
| 2581 | - | |||||||||||||||||||||||||||||||||||||
| 2582 | QColor midColor2 = mergedColors(gradientStartColor, gradientStopColor, 40); | - | ||||||||||||||||||||||||||||||||||||
| 2583 | gradient.setColorAt(0, d->buttonColor(option->palette).lighter(108)); | - | ||||||||||||||||||||||||||||||||||||
| 2584 | gradient.setColorAt(1, d->buttonColor(option->palette)); | - | ||||||||||||||||||||||||||||||||||||
| 2585 | - | |||||||||||||||||||||||||||||||||||||
| 2586 | highlightedGradient.setColorAt(0, gradientStartColor.darker(102)); | - | ||||||||||||||||||||||||||||||||||||
| 2587 | highlightedGradient.setColorAt(1, gradientStopColor.lighter(102)); | - | ||||||||||||||||||||||||||||||||||||
| 2588 | - | |||||||||||||||||||||||||||||||||||||
| 2589 | // Paint slider | - | ||||||||||||||||||||||||||||||||||||
| 2590 | if (scrollBar->subControls & SC_ScrollBarSlider) {
| 0 | ||||||||||||||||||||||||||||||||||||
| 2591 | if (transient) {
| 0 | ||||||||||||||||||||||||||||||||||||
| 2592 | QRect rect = scrollBarSlider.adjusted(horizontal ? 1 : 2, horizontal ? 2 : 1, -1, -1); | - | ||||||||||||||||||||||||||||||||||||
| 2593 | painter->setPen(Qt::NoPen); | - | ||||||||||||||||||||||||||||||||||||
| 2594 | painter->setBrush(isDarkBg ? d->lightShade() : d->darkShade()); | - | ||||||||||||||||||||||||||||||||||||
| 2595 | int r = qMin(rect.width(), rect.height()) / 2; | - | ||||||||||||||||||||||||||||||||||||
| 2596 | - | |||||||||||||||||||||||||||||||||||||
| 2597 | painter->save(); | - | ||||||||||||||||||||||||||||||||||||
| 2598 | painter->setRenderHint(QPainter::Antialiasing, true); | - | ||||||||||||||||||||||||||||||||||||
| 2599 | painter->drawRoundedRect(rect, r, r); | - | ||||||||||||||||||||||||||||||||||||
| 2600 | painter->restore(); | - | ||||||||||||||||||||||||||||||||||||
| 2601 | } else { never executed: end of block | 0 | ||||||||||||||||||||||||||||||||||||
| 2602 | QRect pixmapRect = scrollBarSlider; | - | ||||||||||||||||||||||||||||||||||||
| 2603 | painter->setPen(QPen(alphaOutline)); | - | ||||||||||||||||||||||||||||||||||||
| 2604 | if (option->state & State_Sunken && scrollBar->activeSubControls & SC_ScrollBarSlider)
| 0 | ||||||||||||||||||||||||||||||||||||
| 2605 | painter->setBrush(midColor2); never executed: painter->setBrush(midColor2); | 0 | ||||||||||||||||||||||||||||||||||||
| 2606 | else if (option->state & State_MouseOver && scrollBar->activeSubControls & SC_ScrollBarSlider)
| 0 | ||||||||||||||||||||||||||||||||||||
| 2607 | painter->setBrush(highlightedGradient); never executed: painter->setBrush(highlightedGradient); | 0 | ||||||||||||||||||||||||||||||||||||
| 2608 | else | - | ||||||||||||||||||||||||||||||||||||
| 2609 | painter->setBrush(gradient); never executed: painter->setBrush(gradient); | 0 | ||||||||||||||||||||||||||||||||||||
| 2610 | - | |||||||||||||||||||||||||||||||||||||
| 2611 | painter->drawRect(pixmapRect.adjusted(horizontal ? -1 : 0, horizontal ? 0 : -1, horizontal ? 0 : 1, horizontal ? 1 : 0)); | - | ||||||||||||||||||||||||||||||||||||
| 2612 | - | |||||||||||||||||||||||||||||||||||||
| 2613 | painter->setPen(d->innerContrastLine()); | - | ||||||||||||||||||||||||||||||||||||
| 2614 | painter->drawRect(scrollBarSlider.adjusted(horizontal ? 0 : 1, horizontal ? 1 : 0, -1, -1)); | - | ||||||||||||||||||||||||||||||||||||
| 2615 | - | |||||||||||||||||||||||||||||||||||||
| 2616 | // Outer shadow | - | ||||||||||||||||||||||||||||||||||||
| 2617 | // painter->setPen(subtleEdge); | - | ||||||||||||||||||||||||||||||||||||
| 2618 | // if (horizontal) { | - | ||||||||||||||||||||||||||||||||||||
| 2619 | //// painter->drawLine(scrollBarSlider.topLeft() + QPoint(-2, 0), scrollBarSlider.bottomLeft() + QPoint(2, 0)); | - | ||||||||||||||||||||||||||||||||||||
| 2620 | //// painter->drawLine(scrollBarSlider.topRight() + QPoint(-2, 0), scrollBarSlider.bottomRight() + QPoint(2, 0)); | - | ||||||||||||||||||||||||||||||||||||
| 2621 | // } else { | - | ||||||||||||||||||||||||||||||||||||
| 2622 | //// painter->drawLine(pixmapRect.topLeft() + QPoint(0, -2), pixmapRect.bottomLeft() + QPoint(0, -2)); | - | ||||||||||||||||||||||||||||||||||||
| 2623 | //// painter->drawLine(pixmapRect.topRight() + QPoint(0, 2), pixmapRect.bottomRight() + QPoint(0, 2)); | - | ||||||||||||||||||||||||||||||||||||
| 2624 | // } | - | ||||||||||||||||||||||||||||||||||||
| 2625 | } never executed: end of block | 0 | ||||||||||||||||||||||||||||||||||||
| 2626 | } | - | ||||||||||||||||||||||||||||||||||||
| 2627 | - | |||||||||||||||||||||||||||||||||||||
| 2628 | // The SubLine (up/left) buttons | - | ||||||||||||||||||||||||||||||||||||
| 2629 | if (!transient && scrollBar->subControls & SC_ScrollBarSubLine) {
| 0 | ||||||||||||||||||||||||||||||||||||
| 2630 | if ((scrollBar->activeSubControls & SC_ScrollBarSubLine) && sunken)
| 0 | ||||||||||||||||||||||||||||||||||||
| 2631 | painter->setBrush(gradientStopColor); never executed: painter->setBrush(gradientStopColor); | 0 | ||||||||||||||||||||||||||||||||||||
| 2632 | else if ((scrollBar->activeSubControls & SC_ScrollBarSubLine))
| 0 | ||||||||||||||||||||||||||||||||||||
| 2633 | painter->setBrush(highlightedGradient); never executed: painter->setBrush(highlightedGradient); | 0 | ||||||||||||||||||||||||||||||||||||
| 2634 | else | - | ||||||||||||||||||||||||||||||||||||
| 2635 | painter->setBrush(gradient); never executed: painter->setBrush(gradient); | 0 | ||||||||||||||||||||||||||||||||||||
| 2636 | - | |||||||||||||||||||||||||||||||||||||
| 2637 | painter->setPen(Qt::NoPen); | - | ||||||||||||||||||||||||||||||||||||
| 2638 | painter->drawRect(scrollBarSubLine.adjusted(horizontal ? 0 : 1, horizontal ? 1 : 0, 0, 0)); | - | ||||||||||||||||||||||||||||||||||||
| 2639 | painter->setPen(QPen(alphaOutline)); | - | ||||||||||||||||||||||||||||||||||||
| 2640 | if (option->state & State_Horizontal) {
| 0 | ||||||||||||||||||||||||||||||||||||
| 2641 | if (option->direction == Qt::RightToLeft) {
| 0 | ||||||||||||||||||||||||||||||||||||
| 2642 | pixmapRect.setLeft(scrollBarSubLine.left()); | - | ||||||||||||||||||||||||||||||||||||
| 2643 | painter->drawLine(pixmapRect.topLeft(), pixmapRect.bottomLeft()); | - | ||||||||||||||||||||||||||||||||||||
| 2644 | } else { never executed: end of block | 0 | ||||||||||||||||||||||||||||||||||||
| 2645 | pixmapRect.setRight(scrollBarSubLine.right()); | - | ||||||||||||||||||||||||||||||||||||
| 2646 | painter->drawLine(pixmapRect.topRight(), pixmapRect.bottomRight()); | - | ||||||||||||||||||||||||||||||||||||
| 2647 | } never executed: end of block | 0 | ||||||||||||||||||||||||||||||||||||
| 2648 | } else { | - | ||||||||||||||||||||||||||||||||||||
| 2649 | pixmapRect.setBottom(scrollBarSubLine.bottom()); | - | ||||||||||||||||||||||||||||||||||||
| 2650 | painter->drawLine(pixmapRect.bottomLeft(), pixmapRect.bottomRight()); | - | ||||||||||||||||||||||||||||||||||||
| 2651 | } never executed: end of block | 0 | ||||||||||||||||||||||||||||||||||||
| 2652 | - | |||||||||||||||||||||||||||||||||||||
| 2653 | painter->setBrush(Qt::NoBrush); | - | ||||||||||||||||||||||||||||||||||||
| 2654 | painter->setPen(d->innerContrastLine()); | - | ||||||||||||||||||||||||||||||||||||
| 2655 | painter->drawRect(scrollBarSubLine.adjusted(horizontal ? 0 : 1, horizontal ? 1 : 0 , horizontal ? -2 : -1, horizontal ? -1 : -2)); | - | ||||||||||||||||||||||||||||||||||||
| 2656 | - | |||||||||||||||||||||||||||||||||||||
| 2657 | // Arrows | - | ||||||||||||||||||||||||||||||||||||
| 2658 | int rotation = 0; | - | ||||||||||||||||||||||||||||||||||||
| 2659 | if (option->state & State_Horizontal)
| 0 | ||||||||||||||||||||||||||||||||||||
| 2660 | rotation = option->direction == Qt::LeftToRight ? -90 : 90; never executed: rotation = option->direction == Qt::LeftToRight ? -90 : 90;
| 0 | ||||||||||||||||||||||||||||||||||||
| 2661 | QRect upRect = scrollBarSubLine.translated(horizontal ? -2 : -1, 0); | - | ||||||||||||||||||||||||||||||||||||
| 2662 | QPixmap arrowPixmap = colorizedImage(QLatin1String(":/qt-project.org/styles/commonstyle/images/fusion_arrow.png"), arrowColor, rotation); | - | ||||||||||||||||||||||||||||||||||||
| 2663 | painter->drawPixmap(QRectF(upRect.center().x() - arrowPixmap.width() / 4.0 + 2.0, | - | ||||||||||||||||||||||||||||||||||||
| 2664 | upRect.center().y() - arrowPixmap.height() / 4.0 + 1.0, | - | ||||||||||||||||||||||||||||||||||||
| 2665 | arrowPixmap.width() / 2.0, arrowPixmap.height() / 2.0), | - | ||||||||||||||||||||||||||||||||||||
| 2666 | arrowPixmap, QRectF(QPoint(0.0, 0.0), arrowPixmap.size())); | - | ||||||||||||||||||||||||||||||||||||
| 2667 | } never executed: end of block | 0 | ||||||||||||||||||||||||||||||||||||
| 2668 | - | |||||||||||||||||||||||||||||||||||||
| 2669 | // The AddLine (down/right) button | - | ||||||||||||||||||||||||||||||||||||
| 2670 | if (!transient && scrollBar->subControls & SC_ScrollBarAddLine) {
| 0 | ||||||||||||||||||||||||||||||||||||
| 2671 | if ((scrollBar->activeSubControls & SC_ScrollBarAddLine) && sunken)
| 0 | ||||||||||||||||||||||||||||||||||||
| 2672 | painter->setBrush(gradientStopColor); never executed: painter->setBrush(gradientStopColor); | 0 | ||||||||||||||||||||||||||||||||||||
| 2673 | else if ((scrollBar->activeSubControls & SC_ScrollBarAddLine))
| 0 | ||||||||||||||||||||||||||||||||||||
| 2674 | painter->setBrush(midColor2); never executed: painter->setBrush(midColor2); | 0 | ||||||||||||||||||||||||||||||||||||
| 2675 | else | - | ||||||||||||||||||||||||||||||||||||
| 2676 | painter->setBrush(gradient); never executed: painter->setBrush(gradient); | 0 | ||||||||||||||||||||||||||||||||||||
| 2677 | - | |||||||||||||||||||||||||||||||||||||
| 2678 | painter->setPen(Qt::NoPen); | - | ||||||||||||||||||||||||||||||||||||
| 2679 | painter->drawRect(scrollBarAddLine.adjusted(horizontal ? 0 : 1, horizontal ? 1 : 0, 0, 0)); | - | ||||||||||||||||||||||||||||||||||||
| 2680 | painter->setPen(QPen(alphaOutline, 1)); | - | ||||||||||||||||||||||||||||||||||||
| 2681 | if (option->state & State_Horizontal) {
| 0 | ||||||||||||||||||||||||||||||||||||
| 2682 | if (option->direction == Qt::LeftToRight) {
| 0 | ||||||||||||||||||||||||||||||||||||
| 2683 | pixmapRect.setLeft(scrollBarAddLine.left()); | - | ||||||||||||||||||||||||||||||||||||
| 2684 | painter->drawLine(pixmapRect.topLeft(), pixmapRect.bottomLeft()); | - | ||||||||||||||||||||||||||||||||||||
| 2685 | } else { never executed: end of block | 0 | ||||||||||||||||||||||||||||||||||||
| 2686 | pixmapRect.setRight(scrollBarAddLine.right()); | - | ||||||||||||||||||||||||||||||||||||
| 2687 | painter->drawLine(pixmapRect.topRight(), pixmapRect.bottomRight()); | - | ||||||||||||||||||||||||||||||||||||
| 2688 | } never executed: end of block | 0 | ||||||||||||||||||||||||||||||||||||
| 2689 | } else { | - | ||||||||||||||||||||||||||||||||||||
| 2690 | pixmapRect.setTop(scrollBarAddLine.top()); | - | ||||||||||||||||||||||||||||||||||||
| 2691 | painter->drawLine(pixmapRect.topLeft(), pixmapRect.topRight()); | - | ||||||||||||||||||||||||||||||||||||
| 2692 | } never executed: end of block | 0 | ||||||||||||||||||||||||||||||||||||
| 2693 | - | |||||||||||||||||||||||||||||||||||||
| 2694 | painter->setPen(d->innerContrastLine()); | - | ||||||||||||||||||||||||||||||||||||
| 2695 | painter->setBrush(Qt::NoBrush); | - | ||||||||||||||||||||||||||||||||||||
| 2696 | painter->drawRect(scrollBarAddLine.adjusted(1, 1, -1, -1)); | - | ||||||||||||||||||||||||||||||||||||
| 2697 | - | |||||||||||||||||||||||||||||||||||||
| 2698 | int rotation = 180; | - | ||||||||||||||||||||||||||||||||||||
| 2699 | if (option->state & State_Horizontal)
| 0 | ||||||||||||||||||||||||||||||||||||
| 2700 | rotation = option->direction == Qt::LeftToRight ? 90 : -90; never executed: rotation = option->direction == Qt::LeftToRight ? 90 : -90;
| 0 | ||||||||||||||||||||||||||||||||||||
| 2701 | QRect downRect = scrollBarAddLine.translated(-1, 1); | - | ||||||||||||||||||||||||||||||||||||
| 2702 | QPixmap arrowPixmap = colorizedImage(QLatin1String(":/qt-project.org/styles/commonstyle/images/fusion_arrow.png"), arrowColor, rotation); | - | ||||||||||||||||||||||||||||||||||||
| 2703 | painter->drawPixmap(QRectF(downRect.center().x() - arrowPixmap.width() / 4.0 + 2.0, | - | ||||||||||||||||||||||||||||||||||||
| 2704 | downRect.center().y() - arrowPixmap.height() / 4.0, | - | ||||||||||||||||||||||||||||||||||||
| 2705 | arrowPixmap.width() / 2.0, arrowPixmap.height() / 2.0), | - | ||||||||||||||||||||||||||||||||||||
| 2706 | arrowPixmap, QRectF(QPoint(0.0, 0.0), arrowPixmap.size())); | - | ||||||||||||||||||||||||||||||||||||
| 2707 | } never executed: end of block | 0 | ||||||||||||||||||||||||||||||||||||
| 2708 | - | |||||||||||||||||||||||||||||||||||||
| 2709 | } never executed: end of block | 0 | ||||||||||||||||||||||||||||||||||||
| 2710 | painter->restore(); | - | ||||||||||||||||||||||||||||||||||||
| 2711 | break;; never executed: break; | 0 | ||||||||||||||||||||||||||||||||||||
| 2712 | case CC_ComboBox: never executed: case CC_ComboBox: | 0 | ||||||||||||||||||||||||||||||||||||
| 2713 | painter->save(); | - | ||||||||||||||||||||||||||||||||||||
| 2714 | if (const QStyleOptionComboBox *comboBox = qstyleoption_cast<const QStyleOptionComboBox *>(option)) {
| 0 | ||||||||||||||||||||||||||||||||||||
| 2715 | bool hasFocus = option->state & State_HasFocus && option->state & State_KeyboardFocusChange;
| 0 | ||||||||||||||||||||||||||||||||||||
| 2716 | bool sunken = comboBox->state & State_On; // play dead, if combobox has no items | - | ||||||||||||||||||||||||||||||||||||
| 2717 | bool isEnabled = (comboBox->state & State_Enabled); | - | ||||||||||||||||||||||||||||||||||||
| 2718 | QPixmap cache; | - | ||||||||||||||||||||||||||||||||||||
| 2719 | QString pixmapName = QStyleHelper::uniqueName(QLatin1String("combobox"), option, comboBox->rect.size()); | - | ||||||||||||||||||||||||||||||||||||
| 2720 | if (sunken)
| 0 | ||||||||||||||||||||||||||||||||||||
| 2721 | pixmapName += QLatin1String("-sunken"); never executed: pixmapName += QLatin1String("-sunken"); | 0 | ||||||||||||||||||||||||||||||||||||
| 2722 | if (comboBox->editable)
| 0 | ||||||||||||||||||||||||||||||||||||
| 2723 | pixmapName += QLatin1String("-editable"); never executed: pixmapName += QLatin1String("-editable"); | 0 | ||||||||||||||||||||||||||||||||||||
| 2724 | if (isEnabled)
| 0 | ||||||||||||||||||||||||||||||||||||
| 2725 | pixmapName += QLatin1String("-enabled"); never executed: pixmapName += QLatin1String("-enabled"); | 0 | ||||||||||||||||||||||||||||||||||||
| 2726 | - | |||||||||||||||||||||||||||||||||||||
| 2727 | if (!QPixmapCache::find(pixmapName, cache)) {
| 0 | ||||||||||||||||||||||||||||||||||||
| 2728 | cache = styleCachePixmap(comboBox->rect.size()); | - | ||||||||||||||||||||||||||||||||||||
| 2729 | cache.fill(Qt::transparent); | - | ||||||||||||||||||||||||||||||||||||
| 2730 | QPainter cachePainter(&cache); | - | ||||||||||||||||||||||||||||||||||||
| 2731 | QRect pixmapRect(0, 0, comboBox->rect.width(), comboBox->rect.height()); | - | ||||||||||||||||||||||||||||||||||||
| 2732 | QStyleOptionComboBox comboBoxCopy = *comboBox; | - | ||||||||||||||||||||||||||||||||||||
| 2733 | comboBoxCopy.rect = pixmapRect; | - | ||||||||||||||||||||||||||||||||||||
| 2734 | - | |||||||||||||||||||||||||||||||||||||
| 2735 | QRect rect = pixmapRect; | - | ||||||||||||||||||||||||||||||||||||
| 2736 | QRect downArrowRect = proxy()->subControlRect(CC_ComboBox, &comboBoxCopy, | - | ||||||||||||||||||||||||||||||||||||
| 2737 | SC_ComboBoxArrow, widget); | - | ||||||||||||||||||||||||||||||||||||
| 2738 | // Draw a line edit | - | ||||||||||||||||||||||||||||||||||||
| 2739 | if (comboBox->editable) {
| 0 | ||||||||||||||||||||||||||||||||||||
| 2740 | QStyleOptionFrame buttonOption; | - | ||||||||||||||||||||||||||||||||||||
| 2741 | buttonOption.QStyleOption::operator=(*comboBox); | - | ||||||||||||||||||||||||||||||||||||
| 2742 | buttonOption.rect = rect; | - | ||||||||||||||||||||||||||||||||||||
| 2743 | buttonOption.state = (comboBox->state & (State_Enabled | State_MouseOver | State_HasFocus)) | - | ||||||||||||||||||||||||||||||||||||
| 2744 | | State_KeyboardFocusChange; // Always show hig | - | ||||||||||||||||||||||||||||||||||||
| 2745 | - | |||||||||||||||||||||||||||||||||||||
| 2746 | if (sunken) {
| 0 | ||||||||||||||||||||||||||||||||||||
| 2747 | buttonOption.state |= State_Sunken; | - | ||||||||||||||||||||||||||||||||||||
| 2748 | buttonOption.state &= ~State_MouseOver; | - | ||||||||||||||||||||||||||||||||||||
| 2749 | } never executed: end of block | 0 | ||||||||||||||||||||||||||||||||||||
| 2750 | - | |||||||||||||||||||||||||||||||||||||
| 2751 | proxy()->drawPrimitive(PE_FrameLineEdit, &buttonOption, &cachePainter, widget); | - | ||||||||||||||||||||||||||||||||||||
| 2752 | - | |||||||||||||||||||||||||||||||||||||
| 2753 | // Draw button clipped | - | ||||||||||||||||||||||||||||||||||||
| 2754 | cachePainter.save(); | - | ||||||||||||||||||||||||||||||||||||
| 2755 | cachePainter.setClipRect(downArrowRect.adjusted(0, 0, 1, 0)); | - | ||||||||||||||||||||||||||||||||||||
| 2756 | buttonOption.rect.setLeft(comboBox->direction == Qt::LeftToRight ? | - | ||||||||||||||||||||||||||||||||||||
| 2757 | downArrowRect.left() - 6: downArrowRect.right() + 6); | - | ||||||||||||||||||||||||||||||||||||
| 2758 | proxy()->drawPrimitive(PE_PanelButtonCommand, &buttonOption, &cachePainter, widget); | - | ||||||||||||||||||||||||||||||||||||
| 2759 | cachePainter.restore(); | - | ||||||||||||||||||||||||||||||||||||
| 2760 | cachePainter.setPen( QPen(hasFocus ? option->palette.highlight() : outline.lighter(110), 1)); | - | ||||||||||||||||||||||||||||||||||||
| 2761 | - | |||||||||||||||||||||||||||||||||||||
| 2762 | if (!sunken) {
| 0 | ||||||||||||||||||||||||||||||||||||
| 2763 | int borderSize = 1; | - | ||||||||||||||||||||||||||||||||||||
| 2764 | if (comboBox->direction == Qt::RightToLeft) {
| 0 | ||||||||||||||||||||||||||||||||||||
| 2765 | cachePainter.drawLine(QPoint(downArrowRect.right() - 1, downArrowRect.top() + borderSize ), | - | ||||||||||||||||||||||||||||||||||||
| 2766 | QPoint(downArrowRect.right() - 1, downArrowRect.bottom() - borderSize)); | - | ||||||||||||||||||||||||||||||||||||
| 2767 | } else { never executed: end of block | 0 | ||||||||||||||||||||||||||||||||||||
| 2768 | cachePainter.drawLine(QPoint(downArrowRect.left() , downArrowRect.top() + borderSize), | - | ||||||||||||||||||||||||||||||||||||
| 2769 | QPoint(downArrowRect.left() , downArrowRect.bottom() - borderSize)); | - | ||||||||||||||||||||||||||||||||||||
| 2770 | } never executed: end of block | 0 | ||||||||||||||||||||||||||||||||||||
| 2771 | } else { | - | ||||||||||||||||||||||||||||||||||||
| 2772 | if (comboBox->direction == Qt::RightToLeft) {
| 0 | ||||||||||||||||||||||||||||||||||||
| 2773 | cachePainter.drawLine(QPoint(downArrowRect.right(), downArrowRect.top() + 2), | - | ||||||||||||||||||||||||||||||||||||
| 2774 | QPoint(downArrowRect.right(), downArrowRect.bottom() - 2)); | - | ||||||||||||||||||||||||||||||||||||
| 2775 | - | |||||||||||||||||||||||||||||||||||||
| 2776 | } else { never executed: end of block | 0 | ||||||||||||||||||||||||||||||||||||
| 2777 | cachePainter.drawLine(QPoint(downArrowRect.left(), downArrowRect.top() + 2), | - | ||||||||||||||||||||||||||||||||||||
| 2778 | QPoint(downArrowRect.left(), downArrowRect.bottom() - 2)); | - | ||||||||||||||||||||||||||||||||||||
| 2779 | } never executed: end of block | 0 | ||||||||||||||||||||||||||||||||||||
| 2780 | } | - | ||||||||||||||||||||||||||||||||||||
| 2781 | } else { | - | ||||||||||||||||||||||||||||||||||||
| 2782 | QStyleOptionButton buttonOption; | - | ||||||||||||||||||||||||||||||||||||
| 2783 | buttonOption.QStyleOption::operator=(*comboBox); | - | ||||||||||||||||||||||||||||||||||||
| 2784 | buttonOption.rect = rect; | - | ||||||||||||||||||||||||||||||||||||
| 2785 | buttonOption.state = comboBox->state & (State_Enabled | State_MouseOver | State_HasFocus | State_KeyboardFocusChange); | - | ||||||||||||||||||||||||||||||||||||
| 2786 | if (sunken) {
| 0 | ||||||||||||||||||||||||||||||||||||
| 2787 | buttonOption.state |= State_Sunken; | - | ||||||||||||||||||||||||||||||||||||
| 2788 | buttonOption.state &= ~State_MouseOver; | - | ||||||||||||||||||||||||||||||||||||
| 2789 | } never executed: end of block | 0 | ||||||||||||||||||||||||||||||||||||
| 2790 | proxy()->drawPrimitive(PE_PanelButtonCommand, &buttonOption, &cachePainter, widget); | - | ||||||||||||||||||||||||||||||||||||
| 2791 | } never executed: end of block | 0 | ||||||||||||||||||||||||||||||||||||
| 2792 | if (comboBox->subControls & SC_ComboBoxArrow) {
| 0 | ||||||||||||||||||||||||||||||||||||
| 2793 | // Draw the up/down arrow | - | ||||||||||||||||||||||||||||||||||||
| 2794 | QColor arrowColor = option->palette.buttonText().color(); | - | ||||||||||||||||||||||||||||||||||||
| 2795 | arrowColor.setAlpha(220); | - | ||||||||||||||||||||||||||||||||||||
| 2796 | QPixmap downArrow = colorizedImage(QLatin1String(":/qt-project.org/styles/commonstyle/images/fusion_arrow.png"), arrowColor, 180); | - | ||||||||||||||||||||||||||||||||||||
| 2797 | cachePainter.drawPixmap(QRectF(downArrowRect.center().x() - downArrow.width() / 4.0 + 1.0, | - | ||||||||||||||||||||||||||||||||||||
| 2798 | downArrowRect.center().y() - downArrow.height() / 4.0 + 1.0, | - | ||||||||||||||||||||||||||||||||||||
| 2799 | downArrow.width() / 2.0, downArrow.height() / 2.0), | - | ||||||||||||||||||||||||||||||||||||
| 2800 | downArrow, QRectF(QPointF(0.0, 0.0), downArrow.size())); | - | ||||||||||||||||||||||||||||||||||||
| 2801 | } never executed: end of block | 0 | ||||||||||||||||||||||||||||||||||||
| 2802 | cachePainter.end(); | - | ||||||||||||||||||||||||||||||||||||
| 2803 | QPixmapCache::insert(pixmapName, cache); | - | ||||||||||||||||||||||||||||||||||||
| 2804 | } never executed: end of block | 0 | ||||||||||||||||||||||||||||||||||||
| 2805 | painter->drawPixmap(comboBox->rect.topLeft(), cache); | - | ||||||||||||||||||||||||||||||||||||
| 2806 | } never executed: end of block | 0 | ||||||||||||||||||||||||||||||||||||
| 2807 | painter->restore(); | - | ||||||||||||||||||||||||||||||||||||
| 2808 | break; never executed: break; | 0 | ||||||||||||||||||||||||||||||||||||
| 2809 | case CC_Slider: never executed: case CC_Slider: | 0 | ||||||||||||||||||||||||||||||||||||
| 2810 | if (const QStyleOptionSlider *slider = qstyleoption_cast<const QStyleOptionSlider *>(option)) {
| 0 | ||||||||||||||||||||||||||||||||||||
| 2811 | QRect groove = proxy()->subControlRect(CC_Slider, option, SC_SliderGroove, widget); | - | ||||||||||||||||||||||||||||||||||||
| 2812 | QRect handle = proxy()->subControlRect(CC_Slider, option, SC_SliderHandle, widget); | - | ||||||||||||||||||||||||||||||||||||
| 2813 | - | |||||||||||||||||||||||||||||||||||||
| 2814 | bool horizontal = slider->orientation == Qt::Horizontal; | - | ||||||||||||||||||||||||||||||||||||
| 2815 | bool ticksAbove = slider->tickPosition & QSlider::TicksAbove; | - | ||||||||||||||||||||||||||||||||||||
| 2816 | bool ticksBelow = slider->tickPosition & QSlider::TicksBelow; | - | ||||||||||||||||||||||||||||||||||||
| 2817 | QColor activeHighlight = d->highlight(option->palette); | - | ||||||||||||||||||||||||||||||||||||
| 2818 | QPixmap cache; | - | ||||||||||||||||||||||||||||||||||||
| 2819 | QBrush oldBrush = painter->brush(); | - | ||||||||||||||||||||||||||||||||||||
| 2820 | QPen oldPen = painter->pen(); | - | ||||||||||||||||||||||||||||||||||||
| 2821 | QColor shadowAlpha(Qt::black); | - | ||||||||||||||||||||||||||||||||||||
| 2822 | shadowAlpha.setAlpha(10); | - | ||||||||||||||||||||||||||||||||||||
| 2823 | if (option->state & State_HasFocus && option->state & State_KeyboardFocusChange)
| 0 | ||||||||||||||||||||||||||||||||||||
| 2824 | outline = d->highlightedOutline(option->palette); never executed: outline = d->highlightedOutline(option->palette); | 0 | ||||||||||||||||||||||||||||||||||||
| 2825 | - | |||||||||||||||||||||||||||||||||||||
| 2826 | - | |||||||||||||||||||||||||||||||||||||
| 2827 | if ((option->subControls & SC_SliderGroove) && groove.isValid()) {
| 0 | ||||||||||||||||||||||||||||||||||||
| 2828 | QColor grooveColor; | - | ||||||||||||||||||||||||||||||||||||
| 2829 | grooveColor.setHsv(buttonColor.hue(), | - | ||||||||||||||||||||||||||||||||||||
| 2830 | qMin(255, (int)(buttonColor.saturation())), | - | ||||||||||||||||||||||||||||||||||||
| 2831 | qMin(255, (int)(buttonColor.value()*0.9))); | - | ||||||||||||||||||||||||||||||||||||
| 2832 | QString groovePixmapName = QStyleHelper::uniqueName(QLatin1String("slider_groove"), option, groove.size()); | - | ||||||||||||||||||||||||||||||||||||
| 2833 | QRect pixmapRect(0, 0, groove.width(), groove.height()); | - | ||||||||||||||||||||||||||||||||||||
| 2834 | - | |||||||||||||||||||||||||||||||||||||
| 2835 | // draw background groove | - | ||||||||||||||||||||||||||||||||||||
| 2836 | if (!QPixmapCache::find(groovePixmapName, cache)) {
| 0 | ||||||||||||||||||||||||||||||||||||
| 2837 | cache = styleCachePixmap(pixmapRect.size()); | - | ||||||||||||||||||||||||||||||||||||
| 2838 | cache.fill(Qt::transparent); | - | ||||||||||||||||||||||||||||||||||||
| 2839 | QPainter groovePainter(&cache); | - | ||||||||||||||||||||||||||||||||||||
| 2840 | groovePainter.setRenderHint(QPainter::Antialiasing, true); | - | ||||||||||||||||||||||||||||||||||||
| 2841 | groovePainter.translate(0.5, 0.5); | - | ||||||||||||||||||||||||||||||||||||
| 2842 | QLinearGradient gradient; | - | ||||||||||||||||||||||||||||||||||||
| 2843 | if (horizontal) {
| 0 | ||||||||||||||||||||||||||||||||||||
| 2844 | gradient.setStart(pixmapRect.center().x(), pixmapRect.top()); | - | ||||||||||||||||||||||||||||||||||||
| 2845 | gradient.setFinalStop(pixmapRect.center().x(), pixmapRect.bottom()); | - | ||||||||||||||||||||||||||||||||||||
| 2846 | } never executed: end of block | 0 | ||||||||||||||||||||||||||||||||||||
| 2847 | else { | - | ||||||||||||||||||||||||||||||||||||
| 2848 | gradient.setStart(pixmapRect.left(), pixmapRect.center().y()); | - | ||||||||||||||||||||||||||||||||||||
| 2849 | gradient.setFinalStop(pixmapRect.right(), pixmapRect.center().y()); | - | ||||||||||||||||||||||||||||||||||||
| 2850 | } never executed: end of block | 0 | ||||||||||||||||||||||||||||||||||||
| 2851 | groovePainter.setPen(QPen(outline)); | - | ||||||||||||||||||||||||||||||||||||
| 2852 | gradient.setColorAt(0, grooveColor.darker(110)); | - | ||||||||||||||||||||||||||||||||||||
| 2853 | gradient.setColorAt(1, grooveColor.lighter(110));//palette.button().color().darker(115)); | - | ||||||||||||||||||||||||||||||||||||
| 2854 | groovePainter.setBrush(gradient); | - | ||||||||||||||||||||||||||||||||||||
| 2855 | groovePainter.drawRoundedRect(pixmapRect.adjusted(1, 1, -2, -2), 1, 1); | - | ||||||||||||||||||||||||||||||||||||
| 2856 | groovePainter.end(); | - | ||||||||||||||||||||||||||||||||||||
| 2857 | QPixmapCache::insert(groovePixmapName, cache); | - | ||||||||||||||||||||||||||||||||||||
| 2858 | } never executed: end of block | 0 | ||||||||||||||||||||||||||||||||||||
| 2859 | painter->drawPixmap(groove.topLeft(), cache); | - | ||||||||||||||||||||||||||||||||||||
| 2860 | - | |||||||||||||||||||||||||||||||||||||
| 2861 | // draw blue groove highlight | - | ||||||||||||||||||||||||||||||||||||
| 2862 | QRect clipRect; | - | ||||||||||||||||||||||||||||||||||||
| 2863 | groovePixmapName += QLatin1String("_blue"); | - | ||||||||||||||||||||||||||||||||||||
| 2864 | if (!QPixmapCache::find(groovePixmapName, cache)) {
| 0 | ||||||||||||||||||||||||||||||||||||
| 2865 | cache = styleCachePixmap(pixmapRect.size()); | - | ||||||||||||||||||||||||||||||||||||
| 2866 | cache.fill(Qt::transparent); | - | ||||||||||||||||||||||||||||||||||||
| 2867 | QPainter groovePainter(&cache); | - | ||||||||||||||||||||||||||||||||||||
| 2868 | QLinearGradient gradient; | - | ||||||||||||||||||||||||||||||||||||
| 2869 | if (horizontal) {
| 0 | ||||||||||||||||||||||||||||||||||||
| 2870 | gradient.setStart(pixmapRect.center().x(), pixmapRect.top()); | - | ||||||||||||||||||||||||||||||||||||
| 2871 | gradient.setFinalStop(pixmapRect.center().x(), pixmapRect.bottom()); | - | ||||||||||||||||||||||||||||||||||||
| 2872 | } never executed: end of block | 0 | ||||||||||||||||||||||||||||||||||||
| 2873 | else { | - | ||||||||||||||||||||||||||||||||||||
| 2874 | gradient.setStart(pixmapRect.left(), pixmapRect.center().y()); | - | ||||||||||||||||||||||||||||||||||||
| 2875 | gradient.setFinalStop(pixmapRect.right(), pixmapRect.center().y()); | - | ||||||||||||||||||||||||||||||||||||
| 2876 | } never executed: end of block | 0 | ||||||||||||||||||||||||||||||||||||
| 2877 | QColor highlight = d->highlight(option->palette); | - | ||||||||||||||||||||||||||||||||||||
| 2878 | QColor highlightedoutline = highlight.darker(140); | - | ||||||||||||||||||||||||||||||||||||
| 2879 | if (qGray(outline.rgb()) > qGray(highlightedoutline.rgb()))
| 0 | ||||||||||||||||||||||||||||||||||||
| 2880 | outline = highlightedoutline; never executed: outline = highlightedoutline; | 0 | ||||||||||||||||||||||||||||||||||||
| 2881 | - | |||||||||||||||||||||||||||||||||||||
| 2882 | - | |||||||||||||||||||||||||||||||||||||
| 2883 | groovePainter.setRenderHint(QPainter::Antialiasing, true); | - | ||||||||||||||||||||||||||||||||||||
| 2884 | groovePainter.translate(0.5, 0.5); | - | ||||||||||||||||||||||||||||||||||||
| 2885 | groovePainter.setPen(QPen(outline)); | - | ||||||||||||||||||||||||||||||||||||
| 2886 | gradient.setColorAt(0, activeHighlight); | - | ||||||||||||||||||||||||||||||||||||
| 2887 | gradient.setColorAt(1, activeHighlight.lighter(130)); | - | ||||||||||||||||||||||||||||||||||||
| 2888 | groovePainter.setBrush(gradient); | - | ||||||||||||||||||||||||||||||||||||
| 2889 | groovePainter.drawRoundedRect(pixmapRect.adjusted(1, 1, -2, -2), 1, 1); | - | ||||||||||||||||||||||||||||||||||||
| 2890 | groovePainter.setPen(d->innerContrastLine()); | - | ||||||||||||||||||||||||||||||||||||
| 2891 | groovePainter.setBrush(Qt::NoBrush); | - | ||||||||||||||||||||||||||||||||||||
| 2892 | groovePainter.drawRoundedRect(pixmapRect.adjusted(2, 2, -3, -3), 1, 1); | - | ||||||||||||||||||||||||||||||||||||
| 2893 | groovePainter.end(); | - | ||||||||||||||||||||||||||||||||||||
| 2894 | QPixmapCache::insert(groovePixmapName, cache); | - | ||||||||||||||||||||||||||||||||||||
| 2895 | } never executed: end of block | 0 | ||||||||||||||||||||||||||||||||||||
| 2896 | if (horizontal) {
| 0 | ||||||||||||||||||||||||||||||||||||
| 2897 | if (slider->upsideDown)
| 0 | ||||||||||||||||||||||||||||||||||||
| 2898 | 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 | ||||||||||||||||||||||||||||||||||||
| 2899 | else | - | ||||||||||||||||||||||||||||||||||||
| 2900 | clipRect = QRect(groove.left(), groove.top(), handle.left(), groove.height()); never executed: clipRect = QRect(groove.left(), groove.top(), handle.left(), groove.height()); | 0 | ||||||||||||||||||||||||||||||||||||
| 2901 | } else { | - | ||||||||||||||||||||||||||||||||||||
| 2902 | if (slider->upsideDown)
| 0 | ||||||||||||||||||||||||||||||||||||
| 2903 | 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 | ||||||||||||||||||||||||||||||||||||
| 2904 | else | - | ||||||||||||||||||||||||||||||||||||
| 2905 | 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 | ||||||||||||||||||||||||||||||||||||
| 2906 | } | - | ||||||||||||||||||||||||||||||||||||
| 2907 | painter->save(); | - | ||||||||||||||||||||||||||||||||||||
| 2908 | painter->setClipRect(clipRect.adjusted(0, 0, 1, 1), Qt::IntersectClip); | - | ||||||||||||||||||||||||||||||||||||
| 2909 | painter->drawPixmap(groove.topLeft(), cache); | - | ||||||||||||||||||||||||||||||||||||
| 2910 | painter->restore(); | - | ||||||||||||||||||||||||||||||||||||
| 2911 | } never executed: end of block | 0 | ||||||||||||||||||||||||||||||||||||
| 2912 | - | |||||||||||||||||||||||||||||||||||||
| 2913 | if (option->subControls & SC_SliderTickmarks) {
| 0 | ||||||||||||||||||||||||||||||||||||
| 2914 | painter->setPen(outline); | - | ||||||||||||||||||||||||||||||||||||
| 2915 | int tickSize = proxy()->pixelMetric(PM_SliderTickmarkOffset, option, widget); | - | ||||||||||||||||||||||||||||||||||||
| 2916 | int available = proxy()->pixelMetric(PM_SliderSpaceAvailable, slider, widget); | - | ||||||||||||||||||||||||||||||||||||
| 2917 | int interval = slider->tickInterval; | - | ||||||||||||||||||||||||||||||||||||
| 2918 | if (interval <= 0) {
| 0 | ||||||||||||||||||||||||||||||||||||
| 2919 | interval = slider->singleStep; | - | ||||||||||||||||||||||||||||||||||||
| 2920 | if (QStyle::sliderPositionFromValue(slider->minimum, slider->maximum, interval,
| 0 | ||||||||||||||||||||||||||||||||||||
| 2921 | available)
| 0 | ||||||||||||||||||||||||||||||||||||
| 2922 | - QStyle::sliderPositionFromValue(slider->minimum, slider->maximum,
| 0 | ||||||||||||||||||||||||||||||||||||
| 2923 | 0, available) < 3)
| 0 | ||||||||||||||||||||||||||||||||||||
| 2924 | interval = slider->pageStep; never executed: interval = slider->pageStep; | 0 | ||||||||||||||||||||||||||||||||||||
| 2925 | } never executed: end of block | 0 | ||||||||||||||||||||||||||||||||||||
| 2926 | if (interval <= 0)
| 0 | ||||||||||||||||||||||||||||||||||||
| 2927 | interval = 1; never executed: interval = 1; | 0 | ||||||||||||||||||||||||||||||||||||
| 2928 | - | |||||||||||||||||||||||||||||||||||||
| 2929 | int v = slider->minimum; | - | ||||||||||||||||||||||||||||||||||||
| 2930 | int len = proxy()->pixelMetric(PM_SliderLength, slider, widget); | - | ||||||||||||||||||||||||||||||||||||
| 2931 | while (v <= slider->maximum + 1) {
| 0 | ||||||||||||||||||||||||||||||||||||
| 2932 | if (v == slider->maximum + 1 && interval == 1)
| 0 | ||||||||||||||||||||||||||||||||||||
| 2933 | break; never executed: break; | 0 | ||||||||||||||||||||||||||||||||||||
| 2934 | const int v_ = qMin(v, slider->maximum); | - | ||||||||||||||||||||||||||||||||||||
| 2935 | int pos = sliderPositionFromValue(slider->minimum, slider->maximum, | - | ||||||||||||||||||||||||||||||||||||
| 2936 | v_, (horizontal | - | ||||||||||||||||||||||||||||||||||||
| 2937 | ? slider->rect.width() | - | ||||||||||||||||||||||||||||||||||||
| 2938 | : slider->rect.height()) - len, | - | ||||||||||||||||||||||||||||||||||||
| 2939 | slider->upsideDown) + len / 2; | - | ||||||||||||||||||||||||||||||||||||
| 2940 | int extra = 2 - ((v_ == slider->minimum || v_ == slider->maximum) ? 1 : 0);
| 0 | ||||||||||||||||||||||||||||||||||||
| 2941 | - | |||||||||||||||||||||||||||||||||||||
| 2942 | if (horizontal) {
| 0 | ||||||||||||||||||||||||||||||||||||
| 2943 | if (ticksAbove) {
| 0 | ||||||||||||||||||||||||||||||||||||
| 2944 | painter->drawLine(pos, slider->rect.top() + extra, | - | ||||||||||||||||||||||||||||||||||||
| 2945 | pos, slider->rect.top() + tickSize); | - | ||||||||||||||||||||||||||||||||||||
| 2946 | } never executed: end of block | 0 | ||||||||||||||||||||||||||||||||||||
| 2947 | if (ticksBelow) {
| 0 | ||||||||||||||||||||||||||||||||||||
| 2948 | painter->drawLine(pos, slider->rect.bottom() - extra, | - | ||||||||||||||||||||||||||||||||||||
| 2949 | pos, slider->rect.bottom() - tickSize); | - | ||||||||||||||||||||||||||||||||||||
| 2950 | } never executed: end of block | 0 | ||||||||||||||||||||||||||||||||||||
| 2951 | } else { never executed: end of block | 0 | ||||||||||||||||||||||||||||||||||||
| 2952 | if (ticksAbove) {
| 0 | ||||||||||||||||||||||||||||||||||||
| 2953 | painter->drawLine(slider->rect.left() + extra, pos, | - | ||||||||||||||||||||||||||||||||||||
| 2954 | slider->rect.left() + tickSize, pos); | - | ||||||||||||||||||||||||||||||||||||
| 2955 | } never executed: end of block | 0 | ||||||||||||||||||||||||||||||||||||
| 2956 | if (ticksBelow) {
| 0 | ||||||||||||||||||||||||||||||||||||
| 2957 | painter->drawLine(slider->rect.right() - extra, pos, | - | ||||||||||||||||||||||||||||||||||||
| 2958 | slider->rect.right() - tickSize, pos); | - | ||||||||||||||||||||||||||||||||||||
| 2959 | } never executed: end of block | 0 | ||||||||||||||||||||||||||||||||||||
| 2960 | } never executed: end of block | 0 | ||||||||||||||||||||||||||||||||||||
| 2961 | // in the case where maximum is max int | - | ||||||||||||||||||||||||||||||||||||
| 2962 | int nextInterval = v + interval; | - | ||||||||||||||||||||||||||||||||||||
| 2963 | if (nextInterval < v)
| 0 | ||||||||||||||||||||||||||||||||||||
| 2964 | break; never executed: break; | 0 | ||||||||||||||||||||||||||||||||||||
| 2965 | v = nextInterval; | - | ||||||||||||||||||||||||||||||||||||
| 2966 | } never executed: end of block | 0 | ||||||||||||||||||||||||||||||||||||
| 2967 | } never executed: end of block | 0 | ||||||||||||||||||||||||||||||||||||
| 2968 | // draw handle | - | ||||||||||||||||||||||||||||||||||||
| 2969 | if ((option->subControls & SC_SliderHandle) ) {
| 0 | ||||||||||||||||||||||||||||||||||||
| 2970 | QString handlePixmapName = QStyleHelper::uniqueName(QLatin1String("slider_handle"), option, handle.size()); | - | ||||||||||||||||||||||||||||||||||||
| 2971 | if (!QPixmapCache::find(handlePixmapName, cache)) {
| 0 | ||||||||||||||||||||||||||||||||||||
| 2972 | cache = styleCachePixmap(handle.size()); | - | ||||||||||||||||||||||||||||||||||||
| 2973 | cache.fill(Qt::transparent); | - | ||||||||||||||||||||||||||||||||||||
| 2974 | QRect pixmapRect(0, 0, handle.width(), handle.height()); | - | ||||||||||||||||||||||||||||||||||||
| 2975 | QPainter handlePainter(&cache); | - | ||||||||||||||||||||||||||||||||||||
| 2976 | QRect gradRect = pixmapRect.adjusted(2, 2, -2, -2); | - | ||||||||||||||||||||||||||||||||||||
| 2977 | - | |||||||||||||||||||||||||||||||||||||
| 2978 | // gradient fill | - | ||||||||||||||||||||||||||||||||||||
| 2979 | QRect r = pixmapRect.adjusted(1, 1, -2, -2); | - | ||||||||||||||||||||||||||||||||||||
| 2980 | QLinearGradient gradient = qt_fusion_gradient(gradRect, d->buttonColor(option->palette),horizontal ? TopDown : FromLeft); | - | ||||||||||||||||||||||||||||||||||||
| 2981 | - | |||||||||||||||||||||||||||||||||||||
| 2982 | handlePainter.setRenderHint(QPainter::Antialiasing, true); | - | ||||||||||||||||||||||||||||||||||||
| 2983 | handlePainter.translate(0.5, 0.5); | - | ||||||||||||||||||||||||||||||||||||
| 2984 | - | |||||||||||||||||||||||||||||||||||||
| 2985 | handlePainter.setPen(Qt::NoPen); | - | ||||||||||||||||||||||||||||||||||||
| 2986 | handlePainter.setBrush(QColor(0, 0, 0, 40)); | - | ||||||||||||||||||||||||||||||||||||
| 2987 | handlePainter.drawRect(r.adjusted(-1, 2, 1, -2)); | - | ||||||||||||||||||||||||||||||||||||
| 2988 | - | |||||||||||||||||||||||||||||||||||||
| 2989 | handlePainter.setPen(QPen(d->outline(option->palette))); | - | ||||||||||||||||||||||||||||||||||||
| 2990 | if (option->state & State_HasFocus && option->state & State_KeyboardFocusChange)
| 0 | ||||||||||||||||||||||||||||||||||||
| 2991 | handlePainter.setPen(QPen(d->highlightedOutline(option->palette))); never executed: handlePainter.setPen(QPen(d->highlightedOutline(option->palette))); | 0 | ||||||||||||||||||||||||||||||||||||
| 2992 | - | |||||||||||||||||||||||||||||||||||||
| 2993 | handlePainter.setBrush(gradient); | - | ||||||||||||||||||||||||||||||||||||
| 2994 | handlePainter.drawRoundedRect(r, 2, 2); | - | ||||||||||||||||||||||||||||||||||||
| 2995 | handlePainter.setBrush(Qt::NoBrush); | - | ||||||||||||||||||||||||||||||||||||
| 2996 | handlePainter.setPen(d->innerContrastLine()); | - | ||||||||||||||||||||||||||||||||||||
| 2997 | handlePainter.drawRoundedRect(r.adjusted(1, 1, -1, -1), 2, 2); | - | ||||||||||||||||||||||||||||||||||||
| 2998 | - | |||||||||||||||||||||||||||||||||||||
| 2999 | QColor cornerAlpha = outline.darker(120); | - | ||||||||||||||||||||||||||||||||||||
| 3000 | cornerAlpha.setAlpha(80); | - | ||||||||||||||||||||||||||||||||||||
| 3001 | - | |||||||||||||||||||||||||||||||||||||
| 3002 | //handle shadow | - | ||||||||||||||||||||||||||||||||||||
| 3003 | handlePainter.setPen(shadowAlpha); | - | ||||||||||||||||||||||||||||||||||||
| 3004 | handlePainter.drawLine(QPoint(r.left() + 2, r.bottom() + 1), QPoint(r.right() - 2, r.bottom() + 1)); | - | ||||||||||||||||||||||||||||||||||||
| 3005 | handlePainter.drawLine(QPoint(r.right() + 1, r.bottom() - 3), QPoint(r.right() + 1, r.top() + 4)); | - | ||||||||||||||||||||||||||||||||||||
| 3006 | handlePainter.drawLine(QPoint(r.right() - 1, r.bottom()), QPoint(r.right() + 1, r.bottom() - 2)); | - | ||||||||||||||||||||||||||||||||||||
| 3007 | - | |||||||||||||||||||||||||||||||||||||
| 3008 | handlePainter.end(); | - | ||||||||||||||||||||||||||||||||||||
| 3009 | QPixmapCache::insert(handlePixmapName, cache); | - | ||||||||||||||||||||||||||||||||||||
| 3010 | } never executed: end of block | 0 | ||||||||||||||||||||||||||||||||||||
| 3011 | - | |||||||||||||||||||||||||||||||||||||
| 3012 | painter->drawPixmap(handle.topLeft(), cache); | - | ||||||||||||||||||||||||||||||||||||
| 3013 | - | |||||||||||||||||||||||||||||||||||||
| 3014 | } never executed: end of block | 0 | ||||||||||||||||||||||||||||||||||||
| 3015 | painter->setBrush(oldBrush); | - | ||||||||||||||||||||||||||||||||||||
| 3016 | painter->setPen(oldPen); | - | ||||||||||||||||||||||||||||||||||||
| 3017 | } never executed: end of block | 0 | ||||||||||||||||||||||||||||||||||||
| 3018 | break; never executed: break; | 0 | ||||||||||||||||||||||||||||||||||||
| 3019 | case CC_Dial: never executed: case CC_Dial: | 0 | ||||||||||||||||||||||||||||||||||||
| 3020 | if (const QStyleOptionSlider *dial = qstyleoption_cast<const QStyleOptionSlider *>(option))
| 0 | ||||||||||||||||||||||||||||||||||||
| 3021 | QStyleHelper::drawDial(dial, painter); never executed: QStyleHelper::drawDial(dial, painter); | 0 | ||||||||||||||||||||||||||||||||||||
| 3022 | break; never executed: break; | 0 | ||||||||||||||||||||||||||||||||||||
| 3023 | default: never executed: default: | 0 | ||||||||||||||||||||||||||||||||||||
| 3024 | QCommonStyle::drawComplexControl(control, option, painter, widget); | - | ||||||||||||||||||||||||||||||||||||
| 3025 | break; never executed: break; | 0 | ||||||||||||||||||||||||||||||||||||
| 3026 | } | - | ||||||||||||||||||||||||||||||||||||
| 3027 | } | - | ||||||||||||||||||||||||||||||||||||
| 3028 | - | |||||||||||||||||||||||||||||||||||||
| 3029 | /*! | - | ||||||||||||||||||||||||||||||||||||
| 3030 | \reimp | - | ||||||||||||||||||||||||||||||||||||
| 3031 | */ | - | ||||||||||||||||||||||||||||||||||||
| 3032 | int QFusionStyle::pixelMetric(PixelMetric metric, const QStyleOption *option, const QWidget *widget) const | - | ||||||||||||||||||||||||||||||||||||
| 3033 | { | - | ||||||||||||||||||||||||||||||||||||
| 3034 | int val = -1; | - | ||||||||||||||||||||||||||||||||||||
| 3035 | switch (metric) { | - | ||||||||||||||||||||||||||||||||||||
| 3036 | case PM_SliderTickmarkOffset: never executed: case PM_SliderTickmarkOffset: | 0 | ||||||||||||||||||||||||||||||||||||
| 3037 | val = 4; | - | ||||||||||||||||||||||||||||||||||||
| 3038 | break; never executed: break; | 0 | ||||||||||||||||||||||||||||||||||||
| 3039 | case PM_HeaderMargin: never executed: case PM_HeaderMargin: | 0 | ||||||||||||||||||||||||||||||||||||
| 3040 | case PM_ToolTipLabelFrameWidth: never executed: case PM_ToolTipLabelFrameWidth: | 0 | ||||||||||||||||||||||||||||||||||||
| 3041 | val = 2; | - | ||||||||||||||||||||||||||||||||||||
| 3042 | break; never executed: break; | 0 | ||||||||||||||||||||||||||||||||||||
| 3043 | case PM_ButtonDefaultIndicator: never executed: case PM_ButtonDefaultIndicator: | 0 | ||||||||||||||||||||||||||||||||||||
| 3044 | case PM_ButtonShiftHorizontal: never executed: case PM_ButtonShiftHorizontal: | 0 | ||||||||||||||||||||||||||||||||||||
| 3045 | case PM_ButtonShiftVertical: never executed: case PM_ButtonShiftVertical: | 0 | ||||||||||||||||||||||||||||||||||||
| 3046 | val = 0; | - | ||||||||||||||||||||||||||||||||||||
| 3047 | break; never executed: break; | 0 | ||||||||||||||||||||||||||||||||||||
| 3048 | case PM_MessageBoxIconSize: never executed: case PM_MessageBoxIconSize: | 0 | ||||||||||||||||||||||||||||||||||||
| 3049 | val = 48; | - | ||||||||||||||||||||||||||||||||||||
| 3050 | break; never executed: break; | 0 | ||||||||||||||||||||||||||||||||||||
| 3051 | case PM_ListViewIconSize: never executed: case PM_ListViewIconSize: | 0 | ||||||||||||||||||||||||||||||||||||
| 3052 | val = 24; | - | ||||||||||||||||||||||||||||||||||||
| 3053 | break; never executed: break; | 0 | ||||||||||||||||||||||||||||||||||||
| 3054 | case PM_DialogButtonsSeparator: never executed: case PM_DialogButtonsSeparator: | 0 | ||||||||||||||||||||||||||||||||||||
| 3055 | case PM_ScrollBarSliderMin: never executed: case PM_ScrollBarSliderMin: | 0 | ||||||||||||||||||||||||||||||||||||
| 3056 | val = 26; | - | ||||||||||||||||||||||||||||||||||||
| 3057 | break; never executed: break; | 0 | ||||||||||||||||||||||||||||||||||||
| 3058 | case PM_TitleBarHeight: never executed: case PM_TitleBarHeight: | 0 | ||||||||||||||||||||||||||||||||||||
| 3059 | val = 24; | - | ||||||||||||||||||||||||||||||||||||
| 3060 | break; never executed: break; | 0 | ||||||||||||||||||||||||||||||||||||
| 3061 | case PM_ScrollBarExtent: never executed: case PM_ScrollBarExtent: | 0 | ||||||||||||||||||||||||||||||||||||
| 3062 | val = 14; | - | ||||||||||||||||||||||||||||||||||||
| 3063 | break; never executed: break; | 0 | ||||||||||||||||||||||||||||||||||||
| 3064 | case PM_SliderThickness: never executed: case PM_SliderThickness: | 0 | ||||||||||||||||||||||||||||||||||||
| 3065 | case PM_SliderLength: never executed: case PM_SliderLength: | 0 | ||||||||||||||||||||||||||||||||||||
| 3066 | val = 15; | - | ||||||||||||||||||||||||||||||||||||
| 3067 | break; never executed: break; | 0 | ||||||||||||||||||||||||||||||||||||
| 3068 | case PM_DockWidgetTitleMargin: never executed: case PM_DockWidgetTitleMargin: | 0 | ||||||||||||||||||||||||||||||||||||
| 3069 | val = 1; | - | ||||||||||||||||||||||||||||||||||||
| 3070 | break; never executed: break; | 0 | ||||||||||||||||||||||||||||||||||||
| 3071 | case PM_SpinBoxFrameWidth: never executed: case PM_SpinBoxFrameWidth: | 0 | ||||||||||||||||||||||||||||||||||||
| 3072 | val = 3; | - | ||||||||||||||||||||||||||||||||||||
| 3073 | break; never executed: break; | 0 | ||||||||||||||||||||||||||||||||||||
| 3074 | case PM_MenuVMargin: never executed: case PM_MenuVMargin: | 0 | ||||||||||||||||||||||||||||||||||||
| 3075 | case PM_MenuHMargin: never executed: case PM_MenuHMargin: | 0 | ||||||||||||||||||||||||||||||||||||
| 3076 | case PM_MenuPanelWidth: never executed: case PM_MenuPanelWidth: | 0 | ||||||||||||||||||||||||||||||||||||
| 3077 | val = 0; | - | ||||||||||||||||||||||||||||||||||||
| 3078 | break; never executed: break; | 0 | ||||||||||||||||||||||||||||||||||||
| 3079 | case PM_MenuBarItemSpacing: never executed: case PM_MenuBarItemSpacing: | 0 | ||||||||||||||||||||||||||||||||||||
| 3080 | val = 6; | - | ||||||||||||||||||||||||||||||||||||
| 3081 | break; never executed: break; | 0 | ||||||||||||||||||||||||||||||||||||
| 3082 | case PM_MenuBarVMargin: never executed: case PM_MenuBarVMargin: | 0 | ||||||||||||||||||||||||||||||||||||
| 3083 | case PM_MenuBarHMargin: never executed: case PM_MenuBarHMargin: | 0 | ||||||||||||||||||||||||||||||||||||
| 3084 | case PM_MenuBarPanelWidth: never executed: case PM_MenuBarPanelWidth: | 0 | ||||||||||||||||||||||||||||||||||||
| 3085 | val = 0; | - | ||||||||||||||||||||||||||||||||||||
| 3086 | break; never executed: break; | 0 | ||||||||||||||||||||||||||||||||||||
| 3087 | case PM_ToolBarHandleExtent: never executed: case PM_ToolBarHandleExtent: | 0 | ||||||||||||||||||||||||||||||||||||
| 3088 | val = 9; | - | ||||||||||||||||||||||||||||||||||||
| 3089 | break; never executed: break; | 0 | ||||||||||||||||||||||||||||||||||||
| 3090 | case PM_ToolBarItemSpacing: never executed: case PM_ToolBarItemSpacing: | 0 | ||||||||||||||||||||||||||||||||||||
| 3091 | val = 1; | - | ||||||||||||||||||||||||||||||||||||
| 3092 | break; never executed: break; | 0 | ||||||||||||||||||||||||||||||||||||
| 3093 | case PM_ToolBarFrameWidth: never executed: case PM_ToolBarFrameWidth: | 0 | ||||||||||||||||||||||||||||||||||||
| 3094 | case PM_ToolBarItemMargin: never executed: case PM_ToolBarItemMargin: | 0 | ||||||||||||||||||||||||||||||||||||
| 3095 | val = 2; | - | ||||||||||||||||||||||||||||||||||||
| 3096 | break; never executed: break; | 0 | ||||||||||||||||||||||||||||||||||||
| 3097 | case PM_SmallIconSize: never executed: case PM_SmallIconSize: | 0 | ||||||||||||||||||||||||||||||||||||
| 3098 | case PM_ButtonIconSize: never executed: case PM_ButtonIconSize: | 0 | ||||||||||||||||||||||||||||||||||||
| 3099 | val = 16; | - | ||||||||||||||||||||||||||||||||||||
| 3100 | break; never executed: break; | 0 | ||||||||||||||||||||||||||||||||||||
| 3101 | case PM_DockWidgetTitleBarButtonMargin: never executed: case PM_DockWidgetTitleBarButtonMargin: | 0 | ||||||||||||||||||||||||||||||||||||
| 3102 | val = 2; | - | ||||||||||||||||||||||||||||||||||||
| 3103 | break; never executed: break; | 0 | ||||||||||||||||||||||||||||||||||||
| 3104 | case PM_MaximumDragDistance: never executed: case PM_MaximumDragDistance: | 0 | ||||||||||||||||||||||||||||||||||||
| 3105 | return -1; // Do not dpi-scale because the value is magic never executed: return -1; | 0 | ||||||||||||||||||||||||||||||||||||
| 3106 | case PM_TabCloseIndicatorWidth: never executed: case PM_TabCloseIndicatorWidth: | 0 | ||||||||||||||||||||||||||||||||||||
| 3107 | case PM_TabCloseIndicatorHeight: never executed: case PM_TabCloseIndicatorHeight: | 0 | ||||||||||||||||||||||||||||||||||||
| 3108 | val = 20; | - | ||||||||||||||||||||||||||||||||||||
| 3109 | break; never executed: break; | 0 | ||||||||||||||||||||||||||||||||||||
| 3110 | case PM_TabBarTabVSpace: never executed: case PM_TabBarTabVSpace: | 0 | ||||||||||||||||||||||||||||||||||||
| 3111 | val = 12; | - | ||||||||||||||||||||||||||||||||||||
| 3112 | break; never executed: break; | 0 | ||||||||||||||||||||||||||||||||||||
| 3113 | case PM_TabBarTabOverlap: never executed: case PM_TabBarTabOverlap: | 0 | ||||||||||||||||||||||||||||||||||||
| 3114 | val = 1; | - | ||||||||||||||||||||||||||||||||||||
| 3115 | break; never executed: break; | 0 | ||||||||||||||||||||||||||||||||||||
| 3116 | case PM_TabBarBaseOverlap: never executed: case PM_TabBarBaseOverlap: | 0 | ||||||||||||||||||||||||||||||||||||
| 3117 | val = 2; | - | ||||||||||||||||||||||||||||||||||||
| 3118 | break; never executed: break; | 0 | ||||||||||||||||||||||||||||||||||||
| 3119 | case PM_SubMenuOverlap: never executed: case PM_SubMenuOverlap: | 0 | ||||||||||||||||||||||||||||||||||||
| 3120 | val = -1; | - | ||||||||||||||||||||||||||||||||||||
| 3121 | break; never executed: break; | 0 | ||||||||||||||||||||||||||||||||||||
| 3122 | case PM_DockWidgetHandleExtent: never executed: case PM_DockWidgetHandleExtent: | 0 | ||||||||||||||||||||||||||||||||||||
| 3123 | case PM_SplitterWidth: never executed: case PM_SplitterWidth: | 0 | ||||||||||||||||||||||||||||||||||||
| 3124 | val = 4; | - | ||||||||||||||||||||||||||||||||||||
| 3125 | break; never executed: break; | 0 | ||||||||||||||||||||||||||||||||||||
| 3126 | case PM_IndicatorHeight: never executed: case PM_IndicatorHeight: | 0 | ||||||||||||||||||||||||||||||||||||
| 3127 | case PM_IndicatorWidth: never executed: case PM_IndicatorWidth: | 0 | ||||||||||||||||||||||||||||||||||||
| 3128 | case PM_ExclusiveIndicatorHeight: never executed: case PM_ExclusiveIndicatorHeight: | 0 | ||||||||||||||||||||||||||||||||||||
| 3129 | case PM_ExclusiveIndicatorWidth: never executed: case PM_ExclusiveIndicatorWidth: | 0 | ||||||||||||||||||||||||||||||||||||
| 3130 | val = 14; | - | ||||||||||||||||||||||||||||||||||||
| 3131 | break; never executed: break; | 0 | ||||||||||||||||||||||||||||||||||||
| 3132 | case PM_ScrollView_ScrollBarSpacing: never executed: case PM_ScrollView_ScrollBarSpacing: | 0 | ||||||||||||||||||||||||||||||||||||
| 3133 | val = 0; | - | ||||||||||||||||||||||||||||||||||||
| 3134 | break; never executed: break; | 0 | ||||||||||||||||||||||||||||||||||||
| 3135 | case PM_ScrollView_ScrollBarOverlap: never executed: case PM_ScrollView_ScrollBarOverlap: | 0 | ||||||||||||||||||||||||||||||||||||
| 3136 | if (proxy()->styleHint(SH_ScrollBar_Transient, option, widget))
| 0 | ||||||||||||||||||||||||||||||||||||
| 3137 | return proxy()->pixelMetric(PM_ScrollBarExtent, option, widget); never executed: return proxy()->pixelMetric(PM_ScrollBarExtent, option, widget); | 0 | ||||||||||||||||||||||||||||||||||||
| 3138 | val = 0; | - | ||||||||||||||||||||||||||||||||||||
| 3139 | break; never executed: break; | 0 | ||||||||||||||||||||||||||||||||||||
| 3140 | case PM_DefaultFrameWidth: never executed: case PM_DefaultFrameWidth: | 0 | ||||||||||||||||||||||||||||||||||||
| 3141 | return 1; // Do not dpi-scale because the drawn frame is always exactly 1 pixel thick never executed: return 1; | 0 | ||||||||||||||||||||||||||||||||||||
| 3142 | default: never executed: default: | 0 | ||||||||||||||||||||||||||||||||||||
| 3143 | return QCommonStyle::pixelMetric(metric, option, widget); never executed: return QCommonStyle::pixelMetric(metric, option, widget); | 0 | ||||||||||||||||||||||||||||||||||||
| 3144 | } | - | ||||||||||||||||||||||||||||||||||||
| 3145 | return QStyleHelper::dpiScaled(val); never executed: return QStyleHelper::dpiScaled(val); | 0 | ||||||||||||||||||||||||||||||||||||
| 3146 | } | - | ||||||||||||||||||||||||||||||||||||
| 3147 | - | |||||||||||||||||||||||||||||||||||||
| 3148 | /*! | - | ||||||||||||||||||||||||||||||||||||
| 3149 | \reimp | - | ||||||||||||||||||||||||||||||||||||
| 3150 | */ | - | ||||||||||||||||||||||||||||||||||||
| 3151 | QSize QFusionStyle::sizeFromContents(ContentsType type, const QStyleOption *option, | - | ||||||||||||||||||||||||||||||||||||
| 3152 | const QSize &size, const QWidget *widget) const | - | ||||||||||||||||||||||||||||||||||||
| 3153 | { | - | ||||||||||||||||||||||||||||||||||||
| 3154 | QSize newSize = QCommonStyle::sizeFromContents(type, option, size, widget); | - | ||||||||||||||||||||||||||||||||||||
| 3155 | switch (type) { | - | ||||||||||||||||||||||||||||||||||||
| 3156 | case CT_PushButton: never executed: case CT_PushButton: | 0 | ||||||||||||||||||||||||||||||||||||
| 3157 | if (const QStyleOptionButton *btn = qstyleoption_cast<const QStyleOptionButton *>(option)) {
| 0 | ||||||||||||||||||||||||||||||||||||
| 3158 | if (!btn->text.isEmpty() && newSize.width() < 80)
| 0 | ||||||||||||||||||||||||||||||||||||
| 3159 | newSize.setWidth(80); never executed: newSize.setWidth(80); | 0 | ||||||||||||||||||||||||||||||||||||
| 3160 | if (!btn->icon.isNull() && btn->iconSize.height() > 16)
| 0 | ||||||||||||||||||||||||||||||||||||
| 3161 | newSize -= QSize(0, 2); never executed: newSize -= QSize(0, 2); | 0 | ||||||||||||||||||||||||||||||||||||
| 3162 | } never executed: end of block | 0 | ||||||||||||||||||||||||||||||||||||
| 3163 | break; never executed: break; | 0 | ||||||||||||||||||||||||||||||||||||
| 3164 | case CT_GroupBox: never executed: case CT_GroupBox: | 0 | ||||||||||||||||||||||||||||||||||||
| 3165 | if (option) {
| 0 | ||||||||||||||||||||||||||||||||||||
| 3166 | int topMargin = qMax(pixelMetric(PM_ExclusiveIndicatorHeight), option->fontMetrics.height()) + groupBoxTopMargin; | - | ||||||||||||||||||||||||||||||||||||
| 3167 | newSize += QSize(10, topMargin); // Add some space below the groupbox | - | ||||||||||||||||||||||||||||||||||||
| 3168 | } never executed: end of block | 0 | ||||||||||||||||||||||||||||||||||||
| 3169 | break; never executed: break; | 0 | ||||||||||||||||||||||||||||||||||||
| 3170 | case CT_RadioButton: never executed: case CT_RadioButton: | 0 | ||||||||||||||||||||||||||||||||||||
| 3171 | case CT_CheckBox: never executed: case CT_CheckBox: | 0 | ||||||||||||||||||||||||||||||||||||
| 3172 | newSize += QSize(0, 1); | - | ||||||||||||||||||||||||||||||||||||
| 3173 | break; never executed: break; | 0 | ||||||||||||||||||||||||||||||||||||
| 3174 | case CT_ToolButton: never executed: case CT_ToolButton: | 0 | ||||||||||||||||||||||||||||||||||||
| 3175 | newSize += QSize(2, 2); | - | ||||||||||||||||||||||||||||||||||||
| 3176 | break; never executed: break; | 0 | ||||||||||||||||||||||||||||||||||||
| 3177 | case CT_SpinBox: never executed: case CT_SpinBox: | 0 | ||||||||||||||||||||||||||||||||||||
| 3178 | newSize += QSize(0, -3); | - | ||||||||||||||||||||||||||||||||||||
| 3179 | break; never executed: break; | 0 | ||||||||||||||||||||||||||||||||||||
| 3180 | case CT_ComboBox: never executed: case CT_ComboBox: | 0 | ||||||||||||||||||||||||||||||||||||
| 3181 | newSize += QSize(2, 4); | - | ||||||||||||||||||||||||||||||||||||
| 3182 | break; never executed: break; | 0 | ||||||||||||||||||||||||||||||||||||
| 3183 | case CT_LineEdit: never executed: case CT_LineEdit: | 0 | ||||||||||||||||||||||||||||||||||||
| 3184 | newSize += QSize(0, 4); | - | ||||||||||||||||||||||||||||||||||||
| 3185 | break; never executed: break; | 0 | ||||||||||||||||||||||||||||||||||||
| 3186 | case CT_MenuBarItem: never executed: case CT_MenuBarItem: | 0 | ||||||||||||||||||||||||||||||||||||
| 3187 | newSize += QSize(8, 5); | - | ||||||||||||||||||||||||||||||||||||
| 3188 | break; never executed: break; | 0 | ||||||||||||||||||||||||||||||||||||
| 3189 | case CT_MenuItem: never executed: case CT_MenuItem: | 0 | ||||||||||||||||||||||||||||||||||||
| 3190 | if (const QStyleOptionMenuItem *menuItem = qstyleoption_cast<const QStyleOptionMenuItem *>(option)) {
| 0 | ||||||||||||||||||||||||||||||||||||
| 3191 | int w = newSize.width(); | - | ||||||||||||||||||||||||||||||||||||
| 3192 | int maxpmw = menuItem->maxIconWidth; | - | ||||||||||||||||||||||||||||||||||||
| 3193 | int tabSpacing = 20; | - | ||||||||||||||||||||||||||||||||||||
| 3194 | if (menuItem->text.contains(QLatin1Char('\t')))
| 0 | ||||||||||||||||||||||||||||||||||||
| 3195 | w += tabSpacing; never executed: w += tabSpacing; | 0 | ||||||||||||||||||||||||||||||||||||
| 3196 | else if (menuItem->menuItemType == QStyleOptionMenuItem::SubMenu)
| 0 | ||||||||||||||||||||||||||||||||||||
| 3197 | w += 2 * QFusionStylePrivate::menuArrowHMargin; never executed: w += 2 * QFusionStylePrivate::menuArrowHMargin; | 0 | ||||||||||||||||||||||||||||||||||||
| 3198 | else if (menuItem->menuItemType == QStyleOptionMenuItem::DefaultItem) {
| 0 | ||||||||||||||||||||||||||||||||||||
| 3199 | QFontMetrics fm(menuItem->font); | - | ||||||||||||||||||||||||||||||||||||
| 3200 | QFont fontBold = menuItem->font; | - | ||||||||||||||||||||||||||||||||||||
| 3201 | fontBold.setBold(true); | - | ||||||||||||||||||||||||||||||||||||
| 3202 | QFontMetrics fmBold(fontBold); | - | ||||||||||||||||||||||||||||||||||||
| 3203 | w += fmBold.width(menuItem->text) - fm.width(menuItem->text); | - | ||||||||||||||||||||||||||||||||||||
| 3204 | } never executed: end of block | 0 | ||||||||||||||||||||||||||||||||||||
| 3205 | int checkcol = qMax<int>(maxpmw, QFusionStylePrivate::menuCheckMarkWidth); // Windows always shows a check column | - | ||||||||||||||||||||||||||||||||||||
| 3206 | w += checkcol; | - | ||||||||||||||||||||||||||||||||||||
| 3207 | w += int(QFusionStylePrivate::menuRightBorder) + 10; | - | ||||||||||||||||||||||||||||||||||||
| 3208 | newSize.setWidth(w); | - | ||||||||||||||||||||||||||||||||||||
| 3209 | if (menuItem->menuItemType == QStyleOptionMenuItem::Separator) {
| 0 | ||||||||||||||||||||||||||||||||||||
| 3210 | if (!menuItem->text.isEmpty()) {
| 0 | ||||||||||||||||||||||||||||||||||||
| 3211 | newSize.setHeight(menuItem->fontMetrics.height()); | - | ||||||||||||||||||||||||||||||||||||
| 3212 | } never executed: end of block | 0 | ||||||||||||||||||||||||||||||||||||
| 3213 | } never executed: end of block | 0 | ||||||||||||||||||||||||||||||||||||
| 3214 | else if (!menuItem->icon.isNull()) {
| 0 | ||||||||||||||||||||||||||||||||||||
| 3215 | if (const QComboBox *combo = qobject_cast<const QComboBox*>(widget)) {
| 0 | ||||||||||||||||||||||||||||||||||||
| 3216 | newSize.setHeight(qMax(combo->iconSize().height() + 2, newSize.height())); | - | ||||||||||||||||||||||||||||||||||||
| 3217 | } never executed: end of block | 0 | ||||||||||||||||||||||||||||||||||||
| 3218 | } never executed: end of block | 0 | ||||||||||||||||||||||||||||||||||||
| 3219 | newSize.setWidth(newSize.width() + 12); | - | ||||||||||||||||||||||||||||||||||||
| 3220 | newSize.setWidth(qMax(newSize.width(), 120)); | - | ||||||||||||||||||||||||||||||||||||
| 3221 | } never executed: end of block | 0 | ||||||||||||||||||||||||||||||||||||
| 3222 | break; never executed: break; | 0 | ||||||||||||||||||||||||||||||||||||
| 3223 | case CT_SizeGrip: never executed: case CT_SizeGrip: | 0 | ||||||||||||||||||||||||||||||||||||
| 3224 | newSize += QSize(4, 4); | - | ||||||||||||||||||||||||||||||||||||
| 3225 | break; never executed: break; | 0 | ||||||||||||||||||||||||||||||||||||
| 3226 | case CT_MdiControls: never executed: case CT_MdiControls: | 0 | ||||||||||||||||||||||||||||||||||||
| 3227 | if (const QStyleOptionComplex *styleOpt = qstyleoption_cast<const QStyleOptionComplex *>(option)) {
| 0 | ||||||||||||||||||||||||||||||||||||
| 3228 | int width = 0; | - | ||||||||||||||||||||||||||||||||||||
| 3229 | if (styleOpt->subControls & SC_MdiMinButton)
| 0 | ||||||||||||||||||||||||||||||||||||
| 3230 | width += 19 + 1; never executed: width += 19 + 1; | 0 | ||||||||||||||||||||||||||||||||||||
| 3231 | if (styleOpt->subControls & SC_MdiNormalButton)
| 0 | ||||||||||||||||||||||||||||||||||||
| 3232 | width += 19 + 1; never executed: width += 19 + 1; | 0 | ||||||||||||||||||||||||||||||||||||
| 3233 | if (styleOpt->subControls & SC_MdiCloseButton)
| 0 | ||||||||||||||||||||||||||||||||||||
| 3234 | width += 19 + 1; never executed: width += 19 + 1; | 0 | ||||||||||||||||||||||||||||||||||||
| 3235 | newSize = QSize(width, 19); | - | ||||||||||||||||||||||||||||||||||||
| 3236 | } else { never executed: end of block | 0 | ||||||||||||||||||||||||||||||||||||
| 3237 | newSize = QSize(60, 19); | - | ||||||||||||||||||||||||||||||||||||
| 3238 | } never executed: end of block | 0 | ||||||||||||||||||||||||||||||||||||
| 3239 | break; never executed: break; | 0 | ||||||||||||||||||||||||||||||||||||
| 3240 | default: never executed: default: | 0 | ||||||||||||||||||||||||||||||||||||
| 3241 | break; never executed: break; | 0 | ||||||||||||||||||||||||||||||||||||
| 3242 | } | - | ||||||||||||||||||||||||||||||||||||
| 3243 | return newSize; never executed: return newSize; | 0 | ||||||||||||||||||||||||||||||||||||
| 3244 | } | - | ||||||||||||||||||||||||||||||||||||
| 3245 | - | |||||||||||||||||||||||||||||||||||||
| 3246 | /*! | - | ||||||||||||||||||||||||||||||||||||
| 3247 | \reimp | - | ||||||||||||||||||||||||||||||||||||
| 3248 | */ | - | ||||||||||||||||||||||||||||||||||||
| 3249 | void QFusionStyle::polish(QApplication *app) | - | ||||||||||||||||||||||||||||||||||||
| 3250 | { | - | ||||||||||||||||||||||||||||||||||||
| 3251 | QCommonStyle::polish(app); | - | ||||||||||||||||||||||||||||||||||||
| 3252 | } never executed: end of block | 0 | ||||||||||||||||||||||||||||||||||||
| 3253 | - | |||||||||||||||||||||||||||||||||||||
| 3254 | /*! | - | ||||||||||||||||||||||||||||||||||||
| 3255 | \reimp | - | ||||||||||||||||||||||||||||||||||||
| 3256 | */ | - | ||||||||||||||||||||||||||||||||||||
| 3257 | void QFusionStyle::polish(QWidget *widget) | - | ||||||||||||||||||||||||||||||||||||
| 3258 | { | - | ||||||||||||||||||||||||||||||||||||
| 3259 | QCommonStyle::polish(widget); | - | ||||||||||||||||||||||||||||||||||||
| 3260 | if (qobject_cast<QAbstractButton*>(widget)
| 0 | ||||||||||||||||||||||||||||||||||||
| 3261 | || qobject_cast<QComboBox *>(widget)
| 0 | ||||||||||||||||||||||||||||||||||||
| 3262 | || qobject_cast<QProgressBar *>(widget)
| 0 | ||||||||||||||||||||||||||||||||||||
| 3263 | || qobject_cast<QScrollBar *>(widget)
| 0 | ||||||||||||||||||||||||||||||||||||
| 3264 | || qobject_cast<QSplitterHandle *>(widget)
| 0 | ||||||||||||||||||||||||||||||||||||
| 3265 | || qobject_cast<QAbstractSlider *>(widget)
| 0 | ||||||||||||||||||||||||||||||||||||
| 3266 | || qobject_cast<QAbstractSpinBox *>(widget)
| 0 | ||||||||||||||||||||||||||||||||||||
| 3267 | || (widget->inherits("QDockSeparator"))
| 0 | ||||||||||||||||||||||||||||||||||||
| 3268 | || (widget->inherits("QDockWidgetSeparator"))
| 0 | ||||||||||||||||||||||||||||||||||||
| 3269 | ) { | - | ||||||||||||||||||||||||||||||||||||
| 3270 | widget->setAttribute(Qt::WA_Hover, true); | - | ||||||||||||||||||||||||||||||||||||
| 3271 | widget->setAttribute(Qt::WA_OpaquePaintEvent, false); | - | ||||||||||||||||||||||||||||||||||||
| 3272 | } never executed: end of block | 0 | ||||||||||||||||||||||||||||||||||||
| 3273 | } never executed: end of block | 0 | ||||||||||||||||||||||||||||||||||||
| 3274 | - | |||||||||||||||||||||||||||||||||||||
| 3275 | /*! | - | ||||||||||||||||||||||||||||||||||||
| 3276 | \reimp | - | ||||||||||||||||||||||||||||||||||||
| 3277 | */ | - | ||||||||||||||||||||||||||||||||||||
| 3278 | void QFusionStyle::polish(QPalette &pal) | - | ||||||||||||||||||||||||||||||||||||
| 3279 | { | - | ||||||||||||||||||||||||||||||||||||
| 3280 | QCommonStyle::polish(pal); | - | ||||||||||||||||||||||||||||||||||||
| 3281 | } never executed: end of block | 0 | ||||||||||||||||||||||||||||||||||||
| 3282 | - | |||||||||||||||||||||||||||||||||||||
| 3283 | /*! | - | ||||||||||||||||||||||||||||||||||||
| 3284 | \reimp | - | ||||||||||||||||||||||||||||||||||||
| 3285 | */ | - | ||||||||||||||||||||||||||||||||||||
| 3286 | void QFusionStyle::unpolish(QWidget *widget) | - | ||||||||||||||||||||||||||||||||||||
| 3287 | { | - | ||||||||||||||||||||||||||||||||||||
| 3288 | QCommonStyle::unpolish(widget); | - | ||||||||||||||||||||||||||||||||||||
| 3289 | if (qobject_cast<QAbstractButton*>(widget)
| 0 | ||||||||||||||||||||||||||||||||||||
| 3290 | || qobject_cast<QComboBox *>(widget)
| 0 | ||||||||||||||||||||||||||||||||||||
| 3291 | || qobject_cast<QProgressBar *>(widget)
| 0 | ||||||||||||||||||||||||||||||||||||
| 3292 | || qobject_cast<QScrollBar *>(widget)
| 0 | ||||||||||||||||||||||||||||||||||||
| 3293 | || qobject_cast<QSplitterHandle *>(widget)
| 0 | ||||||||||||||||||||||||||||||||||||
| 3294 | || qobject_cast<QAbstractSlider *>(widget)
| 0 | ||||||||||||||||||||||||||||||||||||
| 3295 | || qobject_cast<QAbstractSpinBox *>(widget)
| 0 | ||||||||||||||||||||||||||||||||||||
| 3296 | || (widget->inherits("QDockSeparator"))
| 0 | ||||||||||||||||||||||||||||||||||||
| 3297 | || (widget->inherits("QDockWidgetSeparator"))
| 0 | ||||||||||||||||||||||||||||||||||||
| 3298 | ) { | - | ||||||||||||||||||||||||||||||||||||
| 3299 | widget->setAttribute(Qt::WA_Hover, false); | - | ||||||||||||||||||||||||||||||||||||
| 3300 | } never executed: end of block | 0 | ||||||||||||||||||||||||||||||||||||
| 3301 | } never executed: end of block | 0 | ||||||||||||||||||||||||||||||||||||
| 3302 | - | |||||||||||||||||||||||||||||||||||||
| 3303 | /*! | - | ||||||||||||||||||||||||||||||||||||
| 3304 | \reimp | - | ||||||||||||||||||||||||||||||||||||
| 3305 | */ | - | ||||||||||||||||||||||||||||||||||||
| 3306 | void QFusionStyle::unpolish(QApplication *app) | - | ||||||||||||||||||||||||||||||||||||
| 3307 | { | - | ||||||||||||||||||||||||||||||||||||
| 3308 | QCommonStyle::unpolish(app); | - | ||||||||||||||||||||||||||||||||||||
| 3309 | } never executed: end of block | 0 | ||||||||||||||||||||||||||||||||||||
| 3310 | - | |||||||||||||||||||||||||||||||||||||
| 3311 | /*! | - | ||||||||||||||||||||||||||||||||||||
| 3312 | \reimp | - | ||||||||||||||||||||||||||||||||||||
| 3313 | */ | - | ||||||||||||||||||||||||||||||||||||
| 3314 | QRect QFusionStyle::subControlRect(ComplexControl control, const QStyleOptionComplex *option, | - | ||||||||||||||||||||||||||||||||||||
| 3315 | SubControl subControl, const QWidget *widget) const | - | ||||||||||||||||||||||||||||||||||||
| 3316 | { | - | ||||||||||||||||||||||||||||||||||||
| 3317 | QRect rect = QCommonStyle::subControlRect(control, option, subControl, widget); | - | ||||||||||||||||||||||||||||||||||||
| 3318 | - | |||||||||||||||||||||||||||||||||||||
| 3319 | switch (control) { | - | ||||||||||||||||||||||||||||||||||||
| 3320 | case CC_Slider: never executed: case CC_Slider: | 0 | ||||||||||||||||||||||||||||||||||||
| 3321 | if (const QStyleOptionSlider *slider = qstyleoption_cast<const QStyleOptionSlider *>(option)) {
| 0 | ||||||||||||||||||||||||||||||||||||
| 3322 | int tickSize = proxy()->pixelMetric(PM_SliderTickmarkOffset, option, widget); | - | ||||||||||||||||||||||||||||||||||||
| 3323 | switch (subControl) { | - | ||||||||||||||||||||||||||||||||||||
| 3324 | case SC_SliderHandle: { never executed: case SC_SliderHandle: | 0 | ||||||||||||||||||||||||||||||||||||
| 3325 | if (slider->orientation == Qt::Horizontal) {
| 0 | ||||||||||||||||||||||||||||||||||||
| 3326 | rect.setHeight(proxy()->pixelMetric(PM_SliderThickness)); | - | ||||||||||||||||||||||||||||||||||||
| 3327 | rect.setWidth(proxy()->pixelMetric(PM_SliderLength)); | - | ||||||||||||||||||||||||||||||||||||
| 3328 | int centerY = slider->rect.center().y() - rect.height() / 2; | - | ||||||||||||||||||||||||||||||||||||
| 3329 | if (slider->tickPosition & QSlider::TicksAbove)
| 0 | ||||||||||||||||||||||||||||||||||||
| 3330 | centerY += tickSize; never executed: centerY += tickSize; | 0 | ||||||||||||||||||||||||||||||||||||
| 3331 | if (slider->tickPosition & QSlider::TicksBelow)
| 0 | ||||||||||||||||||||||||||||||||||||
| 3332 | centerY -= tickSize; never executed: centerY -= tickSize; | 0 | ||||||||||||||||||||||||||||||||||||
| 3333 | rect.moveTop(centerY); | - | ||||||||||||||||||||||||||||||||||||
| 3334 | } else { never executed: end of block | 0 | ||||||||||||||||||||||||||||||||||||
| 3335 | rect.setWidth(proxy()->pixelMetric(PM_SliderThickness)); | - | ||||||||||||||||||||||||||||||||||||
| 3336 | rect.setHeight(proxy()->pixelMetric(PM_SliderLength)); | - | ||||||||||||||||||||||||||||||||||||
| 3337 | int centerX = slider->rect.center().x() - rect.width() / 2; | - | ||||||||||||||||||||||||||||||||||||
| 3338 | if (slider->tickPosition & QSlider::TicksAbove)
| 0 | ||||||||||||||||||||||||||||||||||||
| 3339 | centerX += tickSize; never executed: centerX += tickSize; | 0 | ||||||||||||||||||||||||||||||||||||
| 3340 | if (slider->tickPosition & QSlider::TicksBelow)
| 0 | ||||||||||||||||||||||||||||||||||||
| 3341 | centerX -= tickSize; never executed: centerX -= tickSize; | 0 | ||||||||||||||||||||||||||||||||||||
| 3342 | rect.moveLeft(centerX); | - | ||||||||||||||||||||||||||||||||||||
| 3343 | } never executed: end of block | 0 | ||||||||||||||||||||||||||||||||||||
| 3344 | } | - | ||||||||||||||||||||||||||||||||||||
| 3345 | break; never executed: break; | 0 | ||||||||||||||||||||||||||||||||||||
| 3346 | case SC_SliderGroove: { never executed: case SC_SliderGroove: | 0 | ||||||||||||||||||||||||||||||||||||
| 3347 | QPoint grooveCenter = slider->rect.center(); | - | ||||||||||||||||||||||||||||||||||||
| 3348 | const int grooveThickness = QStyleHelper::dpiScaled(7); | - | ||||||||||||||||||||||||||||||||||||
| 3349 | if (slider->orientation == Qt::Horizontal) {
| 0 | ||||||||||||||||||||||||||||||||||||
| 3350 | rect.setHeight(grooveThickness); | - | ||||||||||||||||||||||||||||||||||||
| 3351 | if (slider->tickPosition & QSlider::TicksAbove)
| 0 | ||||||||||||||||||||||||||||||||||||
| 3352 | grooveCenter.ry() += tickSize; never executed: grooveCenter.ry() += tickSize; | 0 | ||||||||||||||||||||||||||||||||||||
| 3353 | if (slider->tickPosition & QSlider::TicksBelow)
| 0 | ||||||||||||||||||||||||||||||||||||
| 3354 | grooveCenter.ry() -= tickSize; never executed: grooveCenter.ry() -= tickSize; | 0 | ||||||||||||||||||||||||||||||||||||
| 3355 | } else { never executed: end of block | 0 | ||||||||||||||||||||||||||||||||||||
| 3356 | rect.setWidth(grooveThickness); | - | ||||||||||||||||||||||||||||||||||||
| 3357 | if (slider->tickPosition & QSlider::TicksAbove)
| 0 | ||||||||||||||||||||||||||||||||||||
| 3358 | grooveCenter.rx() += tickSize; never executed: grooveCenter.rx() += tickSize; | 0 | ||||||||||||||||||||||||||||||||||||
| 3359 | if (slider->tickPosition & QSlider::TicksBelow)
| 0 | ||||||||||||||||||||||||||||||||||||
| 3360 | grooveCenter.rx() -= tickSize; never executed: grooveCenter.rx() -= tickSize; | 0 | ||||||||||||||||||||||||||||||||||||
| 3361 | } never executed: end of block | 0 | ||||||||||||||||||||||||||||||||||||
| 3362 | rect.moveCenter(grooveCenter); | - | ||||||||||||||||||||||||||||||||||||
| 3363 | break; never executed: break; | 0 | ||||||||||||||||||||||||||||||||||||
| 3364 | } | - | ||||||||||||||||||||||||||||||||||||
| 3365 | default: never executed: default: | 0 | ||||||||||||||||||||||||||||||||||||
| 3366 | break; never executed: break; | 0 | ||||||||||||||||||||||||||||||||||||
| 3367 | } | - | ||||||||||||||||||||||||||||||||||||
| 3368 | } | - | ||||||||||||||||||||||||||||||||||||
| 3369 | break; never executed: break; | 0 | ||||||||||||||||||||||||||||||||||||
| 3370 | case CC_SpinBox: never executed: case CC_SpinBox: | 0 | ||||||||||||||||||||||||||||||||||||
| 3371 | if (const QStyleOptionSpinBox *spinbox = qstyleoption_cast<const QStyleOptionSpinBox *>(option)) {
| 0 | ||||||||||||||||||||||||||||||||||||
| 3372 | int center = spinbox->rect.height() / 2; | - | ||||||||||||||||||||||||||||||||||||
| 3373 | int fw = spinbox->frame ? 3 : 0; // Is drawn with 3 pixels width in drawComplexControl, independently from PM_SpinBoxFrameWidth
| 0 | ||||||||||||||||||||||||||||||||||||
| 3374 | int y = fw; | - | ||||||||||||||||||||||||||||||||||||
| 3375 | const int buttonWidth = QStyleHelper::dpiScaled(14); | - | ||||||||||||||||||||||||||||||||||||
| 3376 | int x, lx, rx; | - | ||||||||||||||||||||||||||||||||||||
| 3377 | x = spinbox->rect.width() - y - buttonWidth + 2; | - | ||||||||||||||||||||||||||||||||||||
| 3378 | lx = fw; | - | ||||||||||||||||||||||||||||||||||||
| 3379 | rx = x - fw; | - | ||||||||||||||||||||||||||||||||||||
| 3380 | switch (subControl) { | - | ||||||||||||||||||||||||||||||||||||
| 3381 | case SC_SpinBoxUp: never executed: case SC_SpinBoxUp: | 0 | ||||||||||||||||||||||||||||||||||||
| 3382 | if (spinbox->buttonSymbols == QAbstractSpinBox::NoButtons)
| 0 | ||||||||||||||||||||||||||||||||||||
| 3383 | return QRect(); never executed: return QRect(); | 0 | ||||||||||||||||||||||||||||||||||||
| 3384 | rect = QRect(x, fw, buttonWidth, center - fw); | - | ||||||||||||||||||||||||||||||||||||
| 3385 | break; never executed: break; | 0 | ||||||||||||||||||||||||||||||||||||
| 3386 | case SC_SpinBoxDown: never executed: case SC_SpinBoxDown: | 0 | ||||||||||||||||||||||||||||||||||||
| 3387 | if (spinbox->buttonSymbols == QAbstractSpinBox::NoButtons)
| 0 | ||||||||||||||||||||||||||||||||||||
| 3388 | return QRect(); never executed: return QRect(); | 0 | ||||||||||||||||||||||||||||||||||||
| 3389 | - | |||||||||||||||||||||||||||||||||||||
| 3390 | rect = QRect(x, center, buttonWidth, spinbox->rect.bottom() - center - fw + 1); | - | ||||||||||||||||||||||||||||||||||||
| 3391 | break; never executed: break; | 0 | ||||||||||||||||||||||||||||||||||||
| 3392 | case SC_SpinBoxEditField: never executed: case SC_SpinBoxEditField: | 0 | ||||||||||||||||||||||||||||||||||||
| 3393 | if (spinbox->buttonSymbols == QAbstractSpinBox::NoButtons) {
| 0 | ||||||||||||||||||||||||||||||||||||
| 3394 | rect = QRect(lx, fw, spinbox->rect.width() - 2*fw, spinbox->rect.height() - 2*fw); | - | ||||||||||||||||||||||||||||||||||||
| 3395 | } else { never executed: end of block | 0 | ||||||||||||||||||||||||||||||||||||
| 3396 | rect = QRect(lx, fw, rx - qMax(fw - 1, 0), spinbox->rect.height() - 2*fw); | - | ||||||||||||||||||||||||||||||||||||
| 3397 | } never executed: end of block | 0 | ||||||||||||||||||||||||||||||||||||
| 3398 | break; never executed: break; | 0 | ||||||||||||||||||||||||||||||||||||
| 3399 | case SC_SpinBoxFrame: never executed: case SC_SpinBoxFrame: | 0 | ||||||||||||||||||||||||||||||||||||
| 3400 | rect = spinbox->rect; | - | ||||||||||||||||||||||||||||||||||||
| 3401 | default: code before this statement never executed: default:never executed: default: | 0 | ||||||||||||||||||||||||||||||||||||
| 3402 | break; never executed: break; | 0 | ||||||||||||||||||||||||||||||||||||
| 3403 | } | - | ||||||||||||||||||||||||||||||||||||
| 3404 | rect = visualRect(spinbox->direction, spinbox->rect, rect); | - | ||||||||||||||||||||||||||||||||||||
| 3405 | } never executed: end of block | 0 | ||||||||||||||||||||||||||||||||||||
| 3406 | break; never executed: break; | 0 | ||||||||||||||||||||||||||||||||||||
| 3407 | - | |||||||||||||||||||||||||||||||||||||
| 3408 | case CC_GroupBox: never executed: case CC_GroupBox: | 0 | ||||||||||||||||||||||||||||||||||||
| 3409 | if (const QStyleOptionGroupBox *groupBox = qstyleoption_cast<const QStyleOptionGroupBox *>(option)) {
| 0 | ||||||||||||||||||||||||||||||||||||
| 3410 | rect = option->rect; | - | ||||||||||||||||||||||||||||||||||||
| 3411 | if (subControl == SC_GroupBoxFrame)
| 0 | ||||||||||||||||||||||||||||||||||||
| 3412 | return rect.adjusted(0, 0, 0, 0); never executed: return rect.adjusted(0, 0, 0, 0); | 0 | ||||||||||||||||||||||||||||||||||||
| 3413 | else if (subControl == SC_GroupBoxContents) {
| 0 | ||||||||||||||||||||||||||||||||||||
| 3414 | QRect frameRect = option->rect.adjusted(0, 0, 0, -groupBoxBottomMargin); | - | ||||||||||||||||||||||||||||||||||||
| 3415 | int margin = 3; | - | ||||||||||||||||||||||||||||||||||||
| 3416 | int leftMarginExtension = 0; | - | ||||||||||||||||||||||||||||||||||||
| 3417 | int topMargin = qMax(pixelMetric(PM_ExclusiveIndicatorHeight), option->fontMetrics.height()) + groupBoxTopMargin; | - | ||||||||||||||||||||||||||||||||||||
| 3418 | return frameRect.adjusted(leftMarginExtension + margin, margin + topMargin, -margin, -margin - groupBoxBottomMargin); never executed: return frameRect.adjusted(leftMarginExtension + margin, margin + topMargin, -margin, -margin - groupBoxBottomMargin); | 0 | ||||||||||||||||||||||||||||||||||||
| 3419 | } | - | ||||||||||||||||||||||||||||||||||||
| 3420 | - | |||||||||||||||||||||||||||||||||||||
| 3421 | QSize textSize = option->fontMetrics.boundingRect(groupBox->text).size() + QSize(2, 2); | - | ||||||||||||||||||||||||||||||||||||
| 3422 | int indicatorWidth = proxy()->pixelMetric(PM_IndicatorWidth, option, widget); | - | ||||||||||||||||||||||||||||||||||||
| 3423 | int indicatorHeight = proxy()->pixelMetric(PM_IndicatorHeight, option, widget); | - | ||||||||||||||||||||||||||||||||||||
| 3424 | - | |||||||||||||||||||||||||||||||||||||
| 3425 | const int width = textSize.width() | - | ||||||||||||||||||||||||||||||||||||
| 3426 | + (option->subControls & QStyle::SC_GroupBoxCheckBox ? indicatorWidth + 5 : 0);
| 0 | ||||||||||||||||||||||||||||||||||||
| 3427 | - | |||||||||||||||||||||||||||||||||||||
| 3428 | rect = QRect(); | - | ||||||||||||||||||||||||||||||||||||
| 3429 | - | |||||||||||||||||||||||||||||||||||||
| 3430 | if (option->rect.width() > width) {
| 0 | ||||||||||||||||||||||||||||||||||||
| 3431 | switch (groupBox->textAlignment & Qt::AlignHorizontal_Mask) { | - | ||||||||||||||||||||||||||||||||||||
| 3432 | case Qt::AlignHCenter: never executed: case Qt::AlignHCenter: | 0 | ||||||||||||||||||||||||||||||||||||
| 3433 | rect.moveLeft((option->rect.width() - width) / 2); | - | ||||||||||||||||||||||||||||||||||||
| 3434 | break; never executed: break; | 0 | ||||||||||||||||||||||||||||||||||||
| 3435 | case Qt::AlignRight: never executed: case Qt::AlignRight: | 0 | ||||||||||||||||||||||||||||||||||||
| 3436 | rect.moveLeft(option->rect.width() - width); | - | ||||||||||||||||||||||||||||||||||||
| 3437 | break; never executed: break; | 0 | ||||||||||||||||||||||||||||||||||||
| 3438 | } | - | ||||||||||||||||||||||||||||||||||||
| 3439 | } never executed: end of block | 0 | ||||||||||||||||||||||||||||||||||||
| 3440 | - | |||||||||||||||||||||||||||||||||||||
| 3441 | if (subControl == SC_GroupBoxCheckBox) {
| 0 | ||||||||||||||||||||||||||||||||||||
| 3442 | rect.setWidth(indicatorWidth); | - | ||||||||||||||||||||||||||||||||||||
| 3443 | rect.setHeight(indicatorHeight); | - | ||||||||||||||||||||||||||||||||||||
| 3444 | rect.moveTop(textSize.height() > indicatorHeight ? (textSize.height() - indicatorHeight) / 2 : 0); | - | ||||||||||||||||||||||||||||||||||||
| 3445 | rect.translate(1, 0); | - | ||||||||||||||||||||||||||||||||||||
| 3446 | } else if (subControl == SC_GroupBoxLabel) { never executed: end of block
| 0 | ||||||||||||||||||||||||||||||||||||
| 3447 | rect.setSize(textSize); | - | ||||||||||||||||||||||||||||||||||||
| 3448 | rect.moveTop(1); | - | ||||||||||||||||||||||||||||||||||||
| 3449 | if (option->subControls & QStyle::SC_GroupBoxCheckBox)
| 0 | ||||||||||||||||||||||||||||||||||||
| 3450 | rect.translate(indicatorWidth + 5, 0); never executed: rect.translate(indicatorWidth + 5, 0); | 0 | ||||||||||||||||||||||||||||||||||||
| 3451 | } never executed: end of block | 0 | ||||||||||||||||||||||||||||||||||||
| 3452 | return visualRect(option->direction, option->rect, rect); never executed: return visualRect(option->direction, option->rect, rect); | 0 | ||||||||||||||||||||||||||||||||||||
| 3453 | } | - | ||||||||||||||||||||||||||||||||||||
| 3454 | - | |||||||||||||||||||||||||||||||||||||
| 3455 | return rect; never executed: return rect; | 0 | ||||||||||||||||||||||||||||||||||||
| 3456 | - | |||||||||||||||||||||||||||||||||||||
| 3457 | case CC_ComboBox: never executed: case CC_ComboBox: | 0 | ||||||||||||||||||||||||||||||||||||
| 3458 | switch (subControl) { | - | ||||||||||||||||||||||||||||||||||||
| 3459 | case SC_ComboBoxArrow: never executed: case SC_ComboBoxArrow: | 0 | ||||||||||||||||||||||||||||||||||||
| 3460 | rect = visualRect(option->direction, option->rect, rect); | - | ||||||||||||||||||||||||||||||||||||
| 3461 | rect.setRect(rect.right() - 18, rect.top() - 2, | - | ||||||||||||||||||||||||||||||||||||
| 3462 | 19, rect.height() + 4); | - | ||||||||||||||||||||||||||||||||||||
| 3463 | rect = visualRect(option->direction, option->rect, rect); | - | ||||||||||||||||||||||||||||||||||||
| 3464 | break; never executed: break; | 0 | ||||||||||||||||||||||||||||||||||||
| 3465 | case SC_ComboBoxEditField: { never executed: case SC_ComboBoxEditField: | 0 | ||||||||||||||||||||||||||||||||||||
| 3466 | int frameWidth = 2; | - | ||||||||||||||||||||||||||||||||||||
| 3467 | rect = visualRect(option->direction, option->rect, rect); | - | ||||||||||||||||||||||||||||||||||||
| 3468 | rect.setRect(option->rect.left() + frameWidth, option->rect.top() + frameWidth, | - | ||||||||||||||||||||||||||||||||||||
| 3469 | option->rect.width() - 19 - 2 * frameWidth, | - | ||||||||||||||||||||||||||||||||||||
| 3470 | option->rect.height() - 2 * frameWidth); | - | ||||||||||||||||||||||||||||||||||||
| 3471 | if (const QStyleOptionComboBox *box = qstyleoption_cast<const QStyleOptionComboBox *>(option)) {
| 0 | ||||||||||||||||||||||||||||||||||||
| 3472 | if (!box->editable) {
| 0 | ||||||||||||||||||||||||||||||||||||
| 3473 | rect.adjust(2, 0, 0, 0); | - | ||||||||||||||||||||||||||||||||||||
| 3474 | if (box->state & (State_Sunken | State_On))
| 0 | ||||||||||||||||||||||||||||||||||||
| 3475 | rect.translate(1, 1); never executed: rect.translate(1, 1); | 0 | ||||||||||||||||||||||||||||||||||||
| 3476 | } never executed: end of block | 0 | ||||||||||||||||||||||||||||||||||||
| 3477 | } never executed: end of block | 0 | ||||||||||||||||||||||||||||||||||||
| 3478 | rect = visualRect(option->direction, option->rect, rect); | - | ||||||||||||||||||||||||||||||||||||
| 3479 | break; never executed: break; | 0 | ||||||||||||||||||||||||||||||||||||
| 3480 | } | - | ||||||||||||||||||||||||||||||||||||
| 3481 | default: never executed: default: | 0 | ||||||||||||||||||||||||||||||||||||
| 3482 | break; never executed: break; | 0 | ||||||||||||||||||||||||||||||||||||
| 3483 | } | - | ||||||||||||||||||||||||||||||||||||
| 3484 | break; never executed: break; | 0 | ||||||||||||||||||||||||||||||||||||
| 3485 | case CC_TitleBar: never executed: case CC_TitleBar: | 0 | ||||||||||||||||||||||||||||||||||||
| 3486 | if (const QStyleOptionTitleBar *tb = qstyleoption_cast<const QStyleOptionTitleBar *>(option)) {
| 0 | ||||||||||||||||||||||||||||||||||||
| 3487 | SubControl sc = subControl; | - | ||||||||||||||||||||||||||||||||||||
| 3488 | QRect &ret = rect; | - | ||||||||||||||||||||||||||||||||||||
| 3489 | const int indent = 3; | - | ||||||||||||||||||||||||||||||||||||
| 3490 | const int controlTopMargin = 3; | - | ||||||||||||||||||||||||||||||||||||
| 3491 | const int controlBottomMargin = 3; | - | ||||||||||||||||||||||||||||||||||||
| 3492 | const int controlWidthMargin = 2; | - | ||||||||||||||||||||||||||||||||||||
| 3493 | const int controlHeight = tb->rect.height() - controlTopMargin - controlBottomMargin ; | - | ||||||||||||||||||||||||||||||||||||
| 3494 | const int delta = controlHeight + controlWidthMargin; | - | ||||||||||||||||||||||||||||||||||||
| 3495 | int offset = 0; | - | ||||||||||||||||||||||||||||||||||||
| 3496 | - | |||||||||||||||||||||||||||||||||||||
| 3497 | bool isMinimized = tb->titleBarState & Qt::WindowMinimized; | - | ||||||||||||||||||||||||||||||||||||
| 3498 | bool isMaximized = tb->titleBarState & Qt::WindowMaximized; | - | ||||||||||||||||||||||||||||||||||||
| 3499 | - | |||||||||||||||||||||||||||||||||||||
| 3500 | switch (sc) { | - | ||||||||||||||||||||||||||||||||||||
| 3501 | case SC_TitleBarLabel: never executed: case SC_TitleBarLabel: | 0 | ||||||||||||||||||||||||||||||||||||
| 3502 | if (tb->titleBarFlags & (Qt::WindowTitleHint | Qt::WindowSystemMenuHint)) {
| 0 | ||||||||||||||||||||||||||||||||||||
| 3503 | ret = tb->rect; | - | ||||||||||||||||||||||||||||||||||||
| 3504 | if (tb->titleBarFlags & Qt::WindowSystemMenuHint)
| 0 | ||||||||||||||||||||||||||||||||||||
| 3505 | ret.adjust(delta, 0, -delta, 0); never executed: ret.adjust(delta, 0, -delta, 0); | 0 | ||||||||||||||||||||||||||||||||||||
| 3506 | if (tb->titleBarFlags & Qt::WindowMinimizeButtonHint)
| 0 | ||||||||||||||||||||||||||||||||||||
| 3507 | ret.adjust(0, 0, -delta, 0); never executed: ret.adjust(0, 0, -delta, 0); | 0 | ||||||||||||||||||||||||||||||||||||
| 3508 | if (tb->titleBarFlags & Qt::WindowMaximizeButtonHint)
| 0 | ||||||||||||||||||||||||||||||||||||
| 3509 | ret.adjust(0, 0, -delta, 0); never executed: ret.adjust(0, 0, -delta, 0); | 0 | ||||||||||||||||||||||||||||||||||||
| 3510 | if (tb->titleBarFlags & Qt::WindowShadeButtonHint)
| 0 | ||||||||||||||||||||||||||||||||||||
| 3511 | ret.adjust(0, 0, -delta, 0); never executed: ret.adjust(0, 0, -delta, 0); | 0 | ||||||||||||||||||||||||||||||||||||
| 3512 | if (tb->titleBarFlags & Qt::WindowContextHelpButtonHint)
| 0 | ||||||||||||||||||||||||||||||||||||
| 3513 | ret.adjust(0, 0, -delta, 0); never executed: ret.adjust(0, 0, -delta, 0); | 0 | ||||||||||||||||||||||||||||||||||||
| 3514 | } never executed: end of block | 0 | ||||||||||||||||||||||||||||||||||||
| 3515 | break; never executed: break; | 0 | ||||||||||||||||||||||||||||||||||||
| 3516 | case SC_TitleBarContextHelpButton: never executed: case SC_TitleBarContextHelpButton: | 0 | ||||||||||||||||||||||||||||||||||||
| 3517 | if (tb->titleBarFlags & Qt::WindowContextHelpButtonHint)
| 0 | ||||||||||||||||||||||||||||||||||||
| 3518 | offset += delta; never executed: offset += delta; | 0 | ||||||||||||||||||||||||||||||||||||
| 3519 | case SC_TitleBarMinButton: code before this statement never executed: case SC_TitleBarMinButton:never executed: case SC_TitleBarMinButton: | 0 | ||||||||||||||||||||||||||||||||||||
| 3520 | if (!isMinimized && (tb->titleBarFlags & Qt::WindowMinimizeButtonHint))
| 0 | ||||||||||||||||||||||||||||||||||||
| 3521 | offset += delta; never executed: offset += delta; | 0 | ||||||||||||||||||||||||||||||||||||
| 3522 | else if (sc == SC_TitleBarMinButton)
| 0 | ||||||||||||||||||||||||||||||||||||
| 3523 | break; never executed: break; | 0 | ||||||||||||||||||||||||||||||||||||
| 3524 | case SC_TitleBarNormalButton: code before this statement never executed: case SC_TitleBarNormalButton:never executed: case SC_TitleBarNormalButton: | 0 | ||||||||||||||||||||||||||||||||||||
| 3525 | if (isMinimized && (tb->titleBarFlags & Qt::WindowMinimizeButtonHint))
| 0 | ||||||||||||||||||||||||||||||||||||
| 3526 | offset += delta; never executed: offset += delta; | 0 | ||||||||||||||||||||||||||||||||||||
| 3527 | else if (isMaximized && (tb->titleBarFlags & Qt::WindowMaximizeButtonHint))
| 0 | ||||||||||||||||||||||||||||||||||||
| 3528 | offset += delta; never executed: offset += delta; | 0 | ||||||||||||||||||||||||||||||||||||
| 3529 | else if (sc == SC_TitleBarNormalButton)
| 0 | ||||||||||||||||||||||||||||||||||||
| 3530 | break; never executed: break; | 0 | ||||||||||||||||||||||||||||||||||||
| 3531 | case SC_TitleBarMaxButton: code before this statement never executed: case SC_TitleBarMaxButton:never executed: case SC_TitleBarMaxButton: | 0 | ||||||||||||||||||||||||||||||||||||
| 3532 | if (!isMaximized && (tb->titleBarFlags & Qt::WindowMaximizeButtonHint))
| 0 | ||||||||||||||||||||||||||||||||||||
| 3533 | offset += delta; never executed: offset += delta; | 0 | ||||||||||||||||||||||||||||||||||||
| 3534 | else if (sc == SC_TitleBarMaxButton)
| 0 | ||||||||||||||||||||||||||||||||||||
| 3535 | break; never executed: break; | 0 | ||||||||||||||||||||||||||||||||||||
| 3536 | case SC_TitleBarShadeButton: code before this statement never executed: case SC_TitleBarShadeButton:never executed: case SC_TitleBarShadeButton: | 0 | ||||||||||||||||||||||||||||||||||||
| 3537 | if (!isMinimized && (tb->titleBarFlags & Qt::WindowShadeButtonHint))
| 0 | ||||||||||||||||||||||||||||||||||||
| 3538 | offset += delta; never executed: offset += delta; | 0 | ||||||||||||||||||||||||||||||||||||
| 3539 | else if (sc == SC_TitleBarShadeButton)
| 0 | ||||||||||||||||||||||||||||||||||||
| 3540 | break; never executed: break; | 0 | ||||||||||||||||||||||||||||||||||||
| 3541 | case SC_TitleBarUnshadeButton: code before this statement never executed: case SC_TitleBarUnshadeButton:never executed: case SC_TitleBarUnshadeButton: | 0 | ||||||||||||||||||||||||||||||||||||
| 3542 | if (isMinimized && (tb->titleBarFlags & Qt::WindowShadeButtonHint))
| 0 | ||||||||||||||||||||||||||||||||||||
| 3543 | offset += delta; never executed: offset += delta; | 0 | ||||||||||||||||||||||||||||||||||||
| 3544 | else if (sc == SC_TitleBarUnshadeButton)
| 0 | ||||||||||||||||||||||||||||||||||||
| 3545 | break; never executed: break; | 0 | ||||||||||||||||||||||||||||||||||||
| 3546 | case SC_TitleBarCloseButton: code before this statement never executed: case SC_TitleBarCloseButton:never executed: case SC_TitleBarCloseButton: | 0 | ||||||||||||||||||||||||||||||||||||
| 3547 | if (tb->titleBarFlags & Qt::WindowSystemMenuHint)
| 0 | ||||||||||||||||||||||||||||||||||||
| 3548 | offset += delta; never executed: offset += delta; | 0 | ||||||||||||||||||||||||||||||||||||
| 3549 | else if (sc == SC_TitleBarCloseButton)
| 0 | ||||||||||||||||||||||||||||||||||||
| 3550 | break; never executed: break; | 0 | ||||||||||||||||||||||||||||||||||||
| 3551 | ret.setRect(tb->rect.right() - indent - offset, tb->rect.top() + controlTopMargin, | - | ||||||||||||||||||||||||||||||||||||
| 3552 | controlHeight, controlHeight); | - | ||||||||||||||||||||||||||||||||||||
| 3553 | break; never executed: break; | 0 | ||||||||||||||||||||||||||||||||||||
| 3554 | case SC_TitleBarSysMenu: never executed: case SC_TitleBarSysMenu: | 0 | ||||||||||||||||||||||||||||||||||||
| 3555 | if (tb->titleBarFlags & Qt::WindowSystemMenuHint) {
| 0 | ||||||||||||||||||||||||||||||||||||
| 3556 | ret.setRect(tb->rect.left() + controlWidthMargin + indent, tb->rect.top() + controlTopMargin, | - | ||||||||||||||||||||||||||||||||||||
| 3557 | controlHeight, controlHeight); | - | ||||||||||||||||||||||||||||||||||||
| 3558 | } never executed: end of block | 0 | ||||||||||||||||||||||||||||||||||||
| 3559 | break; never executed: break; | 0 | ||||||||||||||||||||||||||||||||||||
| 3560 | default: never executed: default: | 0 | ||||||||||||||||||||||||||||||||||||
| 3561 | break; never executed: break; | 0 | ||||||||||||||||||||||||||||||||||||
| 3562 | } | - | ||||||||||||||||||||||||||||||||||||
| 3563 | ret = visualRect(tb->direction, tb->rect, ret); | - | ||||||||||||||||||||||||||||||||||||
| 3564 | } never executed: end of block | 0 | ||||||||||||||||||||||||||||||||||||
| 3565 | break; never executed: break; | 0 | ||||||||||||||||||||||||||||||||||||
| 3566 | default: never executed: default: | 0 | ||||||||||||||||||||||||||||||||||||
| 3567 | break; never executed: break; | 0 | ||||||||||||||||||||||||||||||||||||
| 3568 | } | - | ||||||||||||||||||||||||||||||||||||
| 3569 | - | |||||||||||||||||||||||||||||||||||||
| 3570 | return rect; never executed: return rect; | 0 | ||||||||||||||||||||||||||||||||||||
| 3571 | } | - | ||||||||||||||||||||||||||||||||||||
| 3572 | - | |||||||||||||||||||||||||||||||||||||
| 3573 | - | |||||||||||||||||||||||||||||||||||||
| 3574 | /*! | - | ||||||||||||||||||||||||||||||||||||
| 3575 | \reimp | - | ||||||||||||||||||||||||||||||||||||
| 3576 | */ | - | ||||||||||||||||||||||||||||||||||||
| 3577 | QRect QFusionStyle::itemPixmapRect(const QRect &r, int flags, const QPixmap &pixmap) const | - | ||||||||||||||||||||||||||||||||||||
| 3578 | { | - | ||||||||||||||||||||||||||||||||||||
| 3579 | return QCommonStyle::itemPixmapRect(r, flags, pixmap); never executed: return QCommonStyle::itemPixmapRect(r, flags, pixmap); | 0 | ||||||||||||||||||||||||||||||||||||
| 3580 | } | - | ||||||||||||||||||||||||||||||||||||
| 3581 | - | |||||||||||||||||||||||||||||||||||||
| 3582 | /*! | - | ||||||||||||||||||||||||||||||||||||
| 3583 | \reimp | - | ||||||||||||||||||||||||||||||||||||
| 3584 | */ | - | ||||||||||||||||||||||||||||||||||||
| 3585 | void QFusionStyle::drawItemPixmap(QPainter *painter, const QRect &rect, | - | ||||||||||||||||||||||||||||||||||||
| 3586 | int alignment, const QPixmap &pixmap) const | - | ||||||||||||||||||||||||||||||||||||
| 3587 | { | - | ||||||||||||||||||||||||||||||||||||
| 3588 | QCommonStyle::drawItemPixmap(painter, rect, alignment, pixmap); | - | ||||||||||||||||||||||||||||||||||||
| 3589 | } never executed: end of block | 0 | ||||||||||||||||||||||||||||||||||||
| 3590 | - | |||||||||||||||||||||||||||||||||||||
| 3591 | /*! | - | ||||||||||||||||||||||||||||||||||||
| 3592 | \reimp | - | ||||||||||||||||||||||||||||||||||||
| 3593 | */ | - | ||||||||||||||||||||||||||||||||||||
| 3594 | QStyle::SubControl QFusionStyle::hitTestComplexControl(ComplexControl cc, const QStyleOptionComplex *opt, | - | ||||||||||||||||||||||||||||||||||||
| 3595 | const QPoint &pt, const QWidget *w) const | - | ||||||||||||||||||||||||||||||||||||
| 3596 | { | - | ||||||||||||||||||||||||||||||||||||
| 3597 | return QCommonStyle::hitTestComplexControl(cc, opt, pt, w); never executed: return QCommonStyle::hitTestComplexControl(cc, opt, pt, w); | 0 | ||||||||||||||||||||||||||||||||||||
| 3598 | } | - | ||||||||||||||||||||||||||||||||||||
| 3599 | - | |||||||||||||||||||||||||||||||||||||
| 3600 | /*! | - | ||||||||||||||||||||||||||||||||||||
| 3601 | \reimp | - | ||||||||||||||||||||||||||||||||||||
| 3602 | */ | - | ||||||||||||||||||||||||||||||||||||
| 3603 | QPixmap QFusionStyle::generatedIconPixmap(QIcon::Mode iconMode, const QPixmap &pixmap, | - | ||||||||||||||||||||||||||||||||||||
| 3604 | const QStyleOption *opt) const | - | ||||||||||||||||||||||||||||||||||||
| 3605 | { | - | ||||||||||||||||||||||||||||||||||||
| 3606 | return QCommonStyle::generatedIconPixmap(iconMode, pixmap, opt); never executed: return QCommonStyle::generatedIconPixmap(iconMode, pixmap, opt); | 0 | ||||||||||||||||||||||||||||||||||||
| 3607 | } | - | ||||||||||||||||||||||||||||||||||||
| 3608 | - | |||||||||||||||||||||||||||||||||||||
| 3609 | /*! | - | ||||||||||||||||||||||||||||||||||||
| 3610 | \reimp | - | ||||||||||||||||||||||||||||||||||||
| 3611 | */ | - | ||||||||||||||||||||||||||||||||||||
| 3612 | int QFusionStyle::styleHint(StyleHint hint, const QStyleOption *option, const QWidget *widget, | - | ||||||||||||||||||||||||||||||||||||
| 3613 | QStyleHintReturn *returnData) const | - | ||||||||||||||||||||||||||||||||||||
| 3614 | { | - | ||||||||||||||||||||||||||||||||||||
| 3615 | switch (hint) { | - | ||||||||||||||||||||||||||||||||||||
| 3616 | case SH_Slider_SnapToValue: never executed: case SH_Slider_SnapToValue: | 0 | ||||||||||||||||||||||||||||||||||||
| 3617 | case SH_PrintDialog_RightAlignButtons: never executed: case SH_PrintDialog_RightAlignButtons: | 0 | ||||||||||||||||||||||||||||||||||||
| 3618 | case SH_FontDialog_SelectAssociatedText: never executed: case SH_FontDialog_SelectAssociatedText: | 0 | ||||||||||||||||||||||||||||||||||||
| 3619 | case SH_MenuBar_AltKeyNavigation: never executed: case SH_MenuBar_AltKeyNavigation: | 0 | ||||||||||||||||||||||||||||||||||||
| 3620 | case SH_ComboBox_ListMouseTracking: never executed: case SH_ComboBox_ListMouseTracking: | 0 | ||||||||||||||||||||||||||||||||||||
| 3621 | case SH_ScrollBar_StopMouseOverSlider: never executed: case SH_ScrollBar_StopMouseOverSlider: | 0 | ||||||||||||||||||||||||||||||||||||
| 3622 | case SH_ScrollBar_MiddleClickAbsolutePosition: never executed: case SH_ScrollBar_MiddleClickAbsolutePosition: | 0 | ||||||||||||||||||||||||||||||||||||
| 3623 | case SH_EtchDisabledText: never executed: case SH_EtchDisabledText: | 0 | ||||||||||||||||||||||||||||||||||||
| 3624 | case SH_TitleBar_AutoRaise: never executed: case SH_TitleBar_AutoRaise: | 0 | ||||||||||||||||||||||||||||||||||||
| 3625 | case SH_TitleBar_NoBorder: never executed: case SH_TitleBar_NoBorder: | 0 | ||||||||||||||||||||||||||||||||||||
| 3626 | case SH_ItemView_ShowDecorationSelected: never executed: case SH_ItemView_ShowDecorationSelected: | 0 | ||||||||||||||||||||||||||||||||||||
| 3627 | case SH_ItemView_ArrowKeysNavigateIntoChildren: never executed: case SH_ItemView_ArrowKeysNavigateIntoChildren: | 0 | ||||||||||||||||||||||||||||||||||||
| 3628 | case SH_ItemView_ChangeHighlightOnFocus: never executed: case SH_ItemView_ChangeHighlightOnFocus: | 0 | ||||||||||||||||||||||||||||||||||||
| 3629 | case SH_MenuBar_MouseTracking: never executed: case SH_MenuBar_MouseTracking: | 0 | ||||||||||||||||||||||||||||||||||||
| 3630 | case SH_Menu_MouseTracking: never executed: case SH_Menu_MouseTracking: | 0 | ||||||||||||||||||||||||||||||||||||
| 3631 | case SH_Menu_SupportsSections: never executed: case SH_Menu_SupportsSections: | 0 | ||||||||||||||||||||||||||||||||||||
| 3632 | return 1; never executed: return 1; | 0 | ||||||||||||||||||||||||||||||||||||
| 3633 | - | |||||||||||||||||||||||||||||||||||||
| 3634 | #if defined(Q_OS_IOS) | - | ||||||||||||||||||||||||||||||||||||
| 3635 | case SH_ComboBox_UseNativePopup: | - | ||||||||||||||||||||||||||||||||||||
| 3636 | return 1; | - | ||||||||||||||||||||||||||||||||||||
| 3637 | #endif | - | ||||||||||||||||||||||||||||||||||||
| 3638 | - | |||||||||||||||||||||||||||||||||||||
| 3639 | case SH_ToolBox_SelectedPageTitleBold: never executed: case SH_ToolBox_SelectedPageTitleBold: | 0 | ||||||||||||||||||||||||||||||||||||
| 3640 | case SH_ScrollView_FrameOnlyAroundContents: never executed: case SH_ScrollView_FrameOnlyAroundContents: | 0 | ||||||||||||||||||||||||||||||||||||
| 3641 | case SH_Menu_AllowActiveAndDisabled: never executed: case SH_Menu_AllowActiveAndDisabled: | 0 | ||||||||||||||||||||||||||||||||||||
| 3642 | case SH_MainWindow_SpaceBelowMenuBar: never executed: case SH_MainWindow_SpaceBelowMenuBar: | 0 | ||||||||||||||||||||||||||||||||||||
| 3643 | case SH_DialogButtonBox_ButtonsHaveIcons: never executed: case SH_DialogButtonBox_ButtonsHaveIcons: | 0 | ||||||||||||||||||||||||||||||||||||
| 3644 | case SH_MessageBox_CenterButtons: never executed: case SH_MessageBox_CenterButtons: | 0 | ||||||||||||||||||||||||||||||||||||
| 3645 | case SH_RubberBand_Mask: never executed: case SH_RubberBand_Mask: | 0 | ||||||||||||||||||||||||||||||||||||
| 3646 | return 0; never executed: return 0; | 0 | ||||||||||||||||||||||||||||||||||||
| 3647 | - | |||||||||||||||||||||||||||||||||||||
| 3648 | case SH_ComboBox_Popup: never executed: case SH_ComboBox_Popup: | 0 | ||||||||||||||||||||||||||||||||||||
| 3649 | if (const QStyleOptionComboBox *cmb = qstyleoption_cast<const QStyleOptionComboBox *>(option))
| 0 | ||||||||||||||||||||||||||||||||||||
| 3650 | return !cmb->editable; never executed: return !cmb->editable; | 0 | ||||||||||||||||||||||||||||||||||||
| 3651 | return 0; never executed: return 0; | 0 | ||||||||||||||||||||||||||||||||||||
| 3652 | - | |||||||||||||||||||||||||||||||||||||
| 3653 | case SH_Table_GridLineColor: never executed: case SH_Table_GridLineColor: | 0 | ||||||||||||||||||||||||||||||||||||
| 3654 | return option ? option->palette.background().color().darker(120).rgb() : 0; never executed: return option ? option->palette.background().color().darker(120).rgb() : 0; | 0 | ||||||||||||||||||||||||||||||||||||
| 3655 | - | |||||||||||||||||||||||||||||||||||||
| 3656 | case SH_MessageBox_TextInteractionFlags: never executed: case SH_MessageBox_TextInteractionFlags: | 0 | ||||||||||||||||||||||||||||||||||||
| 3657 | return Qt::TextSelectableByMouse | Qt::LinksAccessibleByMouse; never executed: return Qt::TextSelectableByMouse | Qt::LinksAccessibleByMouse; | 0 | ||||||||||||||||||||||||||||||||||||
| 3658 | #ifndef QT_NO_WIZARD | - | ||||||||||||||||||||||||||||||||||||
| 3659 | case SH_WizardStyle: never executed: case SH_WizardStyle: | 0 | ||||||||||||||||||||||||||||||||||||
| 3660 | return QWizard::ClassicStyle; never executed: return QWizard::ClassicStyle; | 0 | ||||||||||||||||||||||||||||||||||||
| 3661 | #endif | - | ||||||||||||||||||||||||||||||||||||
| 3662 | case SH_Menu_SubMenuPopupDelay: never executed: case SH_Menu_SubMenuPopupDelay: | 0 | ||||||||||||||||||||||||||||||||||||
| 3663 | return 225; // default from GtkMenu never executed: return 225; | 0 | ||||||||||||||||||||||||||||||||||||
| 3664 | - | |||||||||||||||||||||||||||||||||||||
| 3665 | case SH_WindowFrame_Mask: never executed: case SH_WindowFrame_Mask: | 0 | ||||||||||||||||||||||||||||||||||||
| 3666 | if (QStyleHintReturnMask *mask = qstyleoption_cast<QStyleHintReturnMask *>(returnData)) {
| 0 | ||||||||||||||||||||||||||||||||||||
| 3667 | //left rounded corner | - | ||||||||||||||||||||||||||||||||||||
| 3668 | mask->region = option->rect; | - | ||||||||||||||||||||||||||||||||||||
| 3669 | mask->region -= QRect(option->rect.left(), option->rect.top(), 5, 1); | - | ||||||||||||||||||||||||||||||||||||
| 3670 | mask->region -= QRect(option->rect.left(), option->rect.top() + 1, 3, 1); | - | ||||||||||||||||||||||||||||||||||||
| 3671 | mask->region -= QRect(option->rect.left(), option->rect.top() + 2, 2, 1); | - | ||||||||||||||||||||||||||||||||||||
| 3672 | mask->region -= QRect(option->rect.left(), option->rect.top() + 3, 1, 2); | - | ||||||||||||||||||||||||||||||||||||
| 3673 | - | |||||||||||||||||||||||||||||||||||||
| 3674 | //right rounded corner | - | ||||||||||||||||||||||||||||||||||||
| 3675 | mask->region -= QRect(option->rect.right() - 4, option->rect.top(), 5, 1); | - | ||||||||||||||||||||||||||||||||||||
| 3676 | mask->region -= QRect(option->rect.right() - 2, option->rect.top() + 1, 3, 1); | - | ||||||||||||||||||||||||||||||||||||
| 3677 | mask->region -= QRect(option->rect.right() - 1, option->rect.top() + 2, 2, 1); | - | ||||||||||||||||||||||||||||||||||||
| 3678 | mask->region -= QRect(option->rect.right() , option->rect.top() + 3, 1, 2); | - | ||||||||||||||||||||||||||||||||||||
| 3679 | return 1; never executed: return 1; | 0 | ||||||||||||||||||||||||||||||||||||
| 3680 | } | - | ||||||||||||||||||||||||||||||||||||
| 3681 | default: code before this statement never executed: default:never executed: default: | 0 | ||||||||||||||||||||||||||||||||||||
| 3682 | break; never executed: break; | 0 | ||||||||||||||||||||||||||||||||||||
| 3683 | } | - | ||||||||||||||||||||||||||||||||||||
| 3684 | return QCommonStyle::styleHint(hint, option, widget, returnData); never executed: return QCommonStyle::styleHint(hint, option, widget, returnData); | 0 | ||||||||||||||||||||||||||||||||||||
| 3685 | } | - | ||||||||||||||||||||||||||||||||||||
| 3686 | - | |||||||||||||||||||||||||||||||||||||
| 3687 | /*! \reimp */ | - | ||||||||||||||||||||||||||||||||||||
| 3688 | QRect QFusionStyle::subElementRect(SubElement sr, const QStyleOption *opt, const QWidget *w) const | - | ||||||||||||||||||||||||||||||||||||
| 3689 | { | - | ||||||||||||||||||||||||||||||||||||
| 3690 | QRect r = QCommonStyle::subElementRect(sr, opt, w); | - | ||||||||||||||||||||||||||||||||||||
| 3691 | switch (sr) { | - | ||||||||||||||||||||||||||||||||||||
| 3692 | case SE_ProgressBarLabel: never executed: case SE_ProgressBarLabel: | 0 | ||||||||||||||||||||||||||||||||||||
| 3693 | case SE_ProgressBarContents: never executed: case SE_ProgressBarContents: | 0 | ||||||||||||||||||||||||||||||||||||
| 3694 | case SE_ProgressBarGroove: never executed: case SE_ProgressBarGroove: | 0 | ||||||||||||||||||||||||||||||||||||
| 3695 | return opt->rect; never executed: return opt->rect; | 0 | ||||||||||||||||||||||||||||||||||||
| 3696 | case SE_PushButtonFocusRect: never executed: case SE_PushButtonFocusRect: | 0 | ||||||||||||||||||||||||||||||||||||
| 3697 | r.adjust(0, 1, 0, -1); | - | ||||||||||||||||||||||||||||||||||||
| 3698 | break; never executed: break; | 0 | ||||||||||||||||||||||||||||||||||||
| 3699 | case SE_DockWidgetTitleBarText: { never executed: case SE_DockWidgetTitleBarText: | 0 | ||||||||||||||||||||||||||||||||||||
| 3700 | if (const QStyleOptionDockWidget *titlebar = qstyleoption_cast<const QStyleOptionDockWidget*>(opt)) {
| 0 | ||||||||||||||||||||||||||||||||||||
| 3701 | bool verticalTitleBar = titlebar->verticalTitleBar; | - | ||||||||||||||||||||||||||||||||||||
| 3702 | if (verticalTitleBar) {
| 0 | ||||||||||||||||||||||||||||||||||||
| 3703 | r.adjust(0, 0, 0, -4); | - | ||||||||||||||||||||||||||||||||||||
| 3704 | } else { never executed: end of block | 0 | ||||||||||||||||||||||||||||||||||||
| 3705 | if (opt->direction == Qt::LeftToRight)
| 0 | ||||||||||||||||||||||||||||||||||||
| 3706 | r.adjust(4, 0, 0, 0); never executed: r.adjust(4, 0, 0, 0); | 0 | ||||||||||||||||||||||||||||||||||||
| 3707 | else | - | ||||||||||||||||||||||||||||||||||||
| 3708 | r.adjust(0, 0, -4, 0); never executed: r.adjust(0, 0, -4, 0); | 0 | ||||||||||||||||||||||||||||||||||||
| 3709 | } | - | ||||||||||||||||||||||||||||||||||||
| 3710 | } | - | ||||||||||||||||||||||||||||||||||||
| 3711 | - | |||||||||||||||||||||||||||||||||||||
| 3712 | break; never executed: break; | 0 | ||||||||||||||||||||||||||||||||||||
| 3713 | } | - | ||||||||||||||||||||||||||||||||||||
| 3714 | default: never executed: default: | 0 | ||||||||||||||||||||||||||||||||||||
| 3715 | break; never executed: break; | 0 | ||||||||||||||||||||||||||||||||||||
| 3716 | } | - | ||||||||||||||||||||||||||||||||||||
| 3717 | return r; never executed: return r; | 0 | ||||||||||||||||||||||||||||||||||||
| 3718 | } | - | ||||||||||||||||||||||||||||||||||||
| 3719 | - | |||||||||||||||||||||||||||||||||||||
| 3720 | /*! | - | ||||||||||||||||||||||||||||||||||||
| 3721 | \reimp | - | ||||||||||||||||||||||||||||||||||||
| 3722 | */ | - | ||||||||||||||||||||||||||||||||||||
| 3723 | QIcon QFusionStyle::standardIcon(StandardPixmap standardIcon, const QStyleOption *option, | - | ||||||||||||||||||||||||||||||||||||
| 3724 | const QWidget *widget) const | - | ||||||||||||||||||||||||||||||||||||
| 3725 | { | - | ||||||||||||||||||||||||||||||||||||
| 3726 | return QCommonStyle::standardIcon(standardIcon, option, widget); never executed: return QCommonStyle::standardIcon(standardIcon, option, widget); | 0 | ||||||||||||||||||||||||||||||||||||
| 3727 | } | - | ||||||||||||||||||||||||||||||||||||
| 3728 | - | |||||||||||||||||||||||||||||||||||||
| 3729 | /*! | - | ||||||||||||||||||||||||||||||||||||
| 3730 | \reimp | - | ||||||||||||||||||||||||||||||||||||
| 3731 | */ | - | ||||||||||||||||||||||||||||||||||||
| 3732 | QPixmap QFusionStyle::standardPixmap(StandardPixmap standardPixmap, const QStyleOption *opt, | - | ||||||||||||||||||||||||||||||||||||
| 3733 | const QWidget *widget) const | - | ||||||||||||||||||||||||||||||||||||
| 3734 | { | - | ||||||||||||||||||||||||||||||||||||
| 3735 | #ifndef QT_NO_IMAGEFORMAT_XPM | - | ||||||||||||||||||||||||||||||||||||
| 3736 | switch (standardPixmap) { | - | ||||||||||||||||||||||||||||||||||||
| 3737 | case SP_TitleBarNormalButton: never executed: case SP_TitleBarNormalButton: | 0 | ||||||||||||||||||||||||||||||||||||
| 3738 | return QPixmap(dock_widget_restore_xpm); never executed: return QPixmap(dock_widget_restore_xpm); | 0 | ||||||||||||||||||||||||||||||||||||
| 3739 | case SP_TitleBarMinButton: never executed: case SP_TitleBarMinButton: | 0 | ||||||||||||||||||||||||||||||||||||
| 3740 | return QPixmap(workspace_minimize); never executed: return QPixmap(workspace_minimize); | 0 | ||||||||||||||||||||||||||||||||||||
| 3741 | case SP_TitleBarCloseButton: never executed: case SP_TitleBarCloseButton: | 0 | ||||||||||||||||||||||||||||||||||||
| 3742 | case SP_DockWidgetCloseButton: never executed: case SP_DockWidgetCloseButton: | 0 | ||||||||||||||||||||||||||||||||||||
| 3743 | return QPixmap(dock_widget_close_xpm); never executed: return QPixmap(dock_widget_close_xpm); | 0 | ||||||||||||||||||||||||||||||||||||
| 3744 | - | |||||||||||||||||||||||||||||||||||||
| 3745 | default: never executed: default: | 0 | ||||||||||||||||||||||||||||||||||||
| 3746 | break; never executed: break; | 0 | ||||||||||||||||||||||||||||||||||||
| 3747 | } | - | ||||||||||||||||||||||||||||||||||||
| 3748 | #endif //QT_NO_IMAGEFORMAT_XPM | - | ||||||||||||||||||||||||||||||||||||
| 3749 | - | |||||||||||||||||||||||||||||||||||||
| 3750 | return QCommonStyle::standardPixmap(standardPixmap, opt, widget); never executed: return QCommonStyle::standardPixmap(standardPixmap, opt, widget); | 0 | ||||||||||||||||||||||||||||||||||||
| 3751 | } | - | ||||||||||||||||||||||||||||||||||||
| 3752 | - | |||||||||||||||||||||||||||||||||||||
| 3753 | QT_END_NAMESPACE | - | ||||||||||||||||||||||||||||||||||||
| 3754 | - | |||||||||||||||||||||||||||||||||||||
| 3755 | #include "moc_qfusionstyle_p.cpp" | - | ||||||||||||||||||||||||||||||||||||
| 3756 | - | |||||||||||||||||||||||||||||||||||||
| 3757 | #endif // QT_NO_STYLE_FUSION || QT_PLUGIN | - | ||||||||||||||||||||||||||||||||||||
| Source code | Switch to Preprocessed file |