| Absolute File Name: | /home/qt/qt5_coco/qt5/qtbase/src/widgets/styles/qproxystyle.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 <qstyle.h> | - | ||||||||||||
| 41 | #include <private/qproxystyle_p.h> | - | ||||||||||||
| 42 | #include <private/qapplication_p.h> | - | ||||||||||||
| 43 | #include "qproxystyle.h" | - | ||||||||||||
| 44 | #include "qstylefactory.h" | - | ||||||||||||
| 45 | #include <private/qstyle_p.h> | - | ||||||||||||
| 46 | - | |||||||||||||
| 47 | #if !defined(QT_NO_STYLE_PROXY) || defined(QT_PLUGIN) | - | ||||||||||||
| 48 | - | |||||||||||||
| 49 | QT_BEGIN_NAMESPACE | - | ||||||||||||
| 50 | - | |||||||||||||
| 51 | /*! | - | ||||||||||||
| 52 | \class QProxyStyle | - | ||||||||||||
| 53 | - | |||||||||||||
| 54 | \brief The QProxyStyle class is a convenience class that simplifies | - | ||||||||||||
| 55 | dynamically overriding QStyle elements. | - | ||||||||||||
| 56 | - | |||||||||||||
| 57 | \since 4.6 | - | ||||||||||||
| 58 | - | |||||||||||||
| 59 | \inmodule QtWidgets | - | ||||||||||||
| 60 | - | |||||||||||||
| 61 | A QProxyStyle wraps a QStyle (usually the default system style) for the | - | ||||||||||||
| 62 | purpose of dynamically overriding painting or other specific style behavior. | - | ||||||||||||
| 63 | - | |||||||||||||
| 64 | The following example shows how to override the shortcut underline | - | ||||||||||||
| 65 | behavior on any platform: | - | ||||||||||||
| 66 | - | |||||||||||||
| 67 | \snippet code/src_gui_qproxystyle.cpp 1 | - | ||||||||||||
| 68 | - | |||||||||||||
| 69 | Warning: The \l {QCommonStyle} {common styles} provided by Qt will | - | ||||||||||||
| 70 | respect this hint, because they call QStyle::proxy(), but there is | - | ||||||||||||
| 71 | no guarantee that QStyle::proxy() will be called for user defined | - | ||||||||||||
| 72 | or system controlled styles. It would not work on a Mac, for | - | ||||||||||||
| 73 | example, where menus are handled by the operating system. | - | ||||||||||||
| 74 | - | |||||||||||||
| 75 | \sa QStyle | - | ||||||||||||
| 76 | */ | - | ||||||||||||
| 77 | - | |||||||||||||
| 78 | void QProxyStylePrivate::ensureBaseStyle() const | - | ||||||||||||
| 79 | { | - | ||||||||||||
| 80 | Q_Q(const QProxyStyle); | - | ||||||||||||
| 81 | - | |||||||||||||
| 82 | if (baseStyle)
| 0 | ||||||||||||
| 83 | return; never executed: return; | 0 | ||||||||||||
| 84 | - | |||||||||||||
| 85 | if (!baseStyle && !QApplicationPrivate::styleOverride.isEmpty()) {
| 0 | ||||||||||||
| 86 | baseStyle = QStyleFactory::create(QApplicationPrivate::styleOverride); | - | ||||||||||||
| 87 | if (baseStyle) {
| 0 | ||||||||||||
| 88 | // If baseStyle is an instance of the same proxyStyle | - | ||||||||||||
| 89 | // we destroy it and fall back to the desktop style | - | ||||||||||||
| 90 | if (qstrcmp(baseStyle->metaObject()->className(),
| 0 | ||||||||||||
| 91 | q->metaObject()->className()) == 0) {
| 0 | ||||||||||||
| 92 | delete baseStyle; | - | ||||||||||||
| 93 | baseStyle = 0; | - | ||||||||||||
| 94 | } never executed: end of block | 0 | ||||||||||||
| 95 | } never executed: end of block | 0 | ||||||||||||
| 96 | } never executed: end of block | 0 | ||||||||||||
| 97 | - | |||||||||||||
| 98 | if (!baseStyle) // Use application desktop style
| 0 | ||||||||||||
| 99 | baseStyle = QStyleFactory::create(QApplicationPrivate::desktopStyleKey()); never executed: baseStyle = QStyleFactory::create(QApplicationPrivate::desktopStyleKey()); | 0 | ||||||||||||
| 100 | - | |||||||||||||
| 101 | if (!baseStyle) // Fallback to windows style
| 0 | ||||||||||||
| 102 | baseStyle = QStyleFactory::create(QLatin1String("windows")); never executed: baseStyle = QStyleFactory::create(QLatin1String("windows")); | 0 | ||||||||||||
| 103 | - | |||||||||||||
| 104 | baseStyle->setProxy(const_cast<QProxyStyle*>(q)); | - | ||||||||||||
| 105 | baseStyle->setParent(const_cast<QProxyStyle*>(q)); // Take ownership | - | ||||||||||||
| 106 | } never executed: end of block | 0 | ||||||||||||
| 107 | - | |||||||||||||
| 108 | /*! | - | ||||||||||||
| 109 | Constructs a QProxyStyle object for overriding behavior in the | - | ||||||||||||
| 110 | specified \a style, or in the default native \l{QApplication::style()} | - | ||||||||||||
| 111 | {style} if \a style is not specified. | - | ||||||||||||
| 112 | - | |||||||||||||
| 113 | Ownership of \a style is transferred to QProxyStyle. | - | ||||||||||||
| 114 | */ | - | ||||||||||||
| 115 | QProxyStyle::QProxyStyle(QStyle *style) : | - | ||||||||||||
| 116 | QCommonStyle(*new QProxyStylePrivate()) | - | ||||||||||||
| 117 | { | - | ||||||||||||
| 118 | Q_D(QProxyStyle); | - | ||||||||||||
| 119 | if (style) {
| 0 | ||||||||||||
| 120 | d->baseStyle = style; | - | ||||||||||||
| 121 | style->setProxy(this); | - | ||||||||||||
| 122 | style->setParent(this); // Take ownership | - | ||||||||||||
| 123 | } never executed: end of block | 0 | ||||||||||||
| 124 | } never executed: end of block | 0 | ||||||||||||
| 125 | - | |||||||||||||
| 126 | /*! | - | ||||||||||||
| 127 | Constructs a QProxyStyle object for overriding behavior in | - | ||||||||||||
| 128 | the base style specified by style \a key, or in the current | - | ||||||||||||
| 129 | \l{QApplication::style()}{application style} if the specified | - | ||||||||||||
| 130 | style \a key is unrecognized. | - | ||||||||||||
| 131 | - | |||||||||||||
| 132 | \sa QStyleFactory::create() | - | ||||||||||||
| 133 | */ | - | ||||||||||||
| 134 | QProxyStyle::QProxyStyle(const QString &key) : | - | ||||||||||||
| 135 | QCommonStyle(*new QProxyStylePrivate()) | - | ||||||||||||
| 136 | { | - | ||||||||||||
| 137 | Q_D(QProxyStyle); | - | ||||||||||||
| 138 | QStyle *style = QStyleFactory::create(key); | - | ||||||||||||
| 139 | if (style) {
| 0 | ||||||||||||
| 140 | d->baseStyle = style; | - | ||||||||||||
| 141 | style->setProxy(this); | - | ||||||||||||
| 142 | style->setParent(this); // Take ownership | - | ||||||||||||
| 143 | } never executed: end of block | 0 | ||||||||||||
| 144 | } never executed: end of block | 0 | ||||||||||||
| 145 | - | |||||||||||||
| 146 | /*! | - | ||||||||||||
| 147 | Destroys the QProxyStyle object. | - | ||||||||||||
| 148 | */ | - | ||||||||||||
| 149 | QProxyStyle::~QProxyStyle() | - | ||||||||||||
| 150 | { | - | ||||||||||||
| 151 | } | - | ||||||||||||
| 152 | - | |||||||||||||
| 153 | /*! | - | ||||||||||||
| 154 | Returns the proxy base style object. If no base style | - | ||||||||||||
| 155 | is set on the proxy style, QProxyStyle will create | - | ||||||||||||
| 156 | an instance of the application style instead. | - | ||||||||||||
| 157 | - | |||||||||||||
| 158 | \sa setBaseStyle(), QStyle | - | ||||||||||||
| 159 | */ | - | ||||||||||||
| 160 | QStyle *QProxyStyle::baseStyle() const | - | ||||||||||||
| 161 | { | - | ||||||||||||
| 162 | Q_D (const QProxyStyle); | - | ||||||||||||
| 163 | d->ensureBaseStyle(); | - | ||||||||||||
| 164 | return d->baseStyle; never executed: return d->baseStyle; | 0 | ||||||||||||
| 165 | } | - | ||||||||||||
| 166 | - | |||||||||||||
| 167 | /*! | - | ||||||||||||
| 168 | Sets the base style that should be proxied. | - | ||||||||||||
| 169 | - | |||||||||||||
| 170 | Ownership of \a style is transferred to QProxyStyle. | - | ||||||||||||
| 171 | - | |||||||||||||
| 172 | If style is zero, a desktop-dependant style will be | - | ||||||||||||
| 173 | assigned automatically. | - | ||||||||||||
| 174 | */ | - | ||||||||||||
| 175 | void QProxyStyle::setBaseStyle(QStyle *style) | - | ||||||||||||
| 176 | { | - | ||||||||||||
| 177 | Q_D (QProxyStyle); | - | ||||||||||||
| 178 | - | |||||||||||||
| 179 | if (d->baseStyle && d->baseStyle->parent() == this)
| 0 | ||||||||||||
| 180 | d->baseStyle->deleteLater(); never executed: d->baseStyle->deleteLater(); | 0 | ||||||||||||
| 181 | - | |||||||||||||
| 182 | d->baseStyle = style; | - | ||||||||||||
| 183 | - | |||||||||||||
| 184 | if (d->baseStyle) {
| 0 | ||||||||||||
| 185 | d->baseStyle->setProxy(this); | - | ||||||||||||
| 186 | d->baseStyle->setParent(this); | - | ||||||||||||
| 187 | } never executed: end of block | 0 | ||||||||||||
| 188 | } never executed: end of block | 0 | ||||||||||||
| 189 | - | |||||||||||||
| 190 | /*! \reimp | - | ||||||||||||
| 191 | */ | - | ||||||||||||
| 192 | void QProxyStyle::drawPrimitive(PrimitiveElement element, const QStyleOption *option, QPainter *painter, const QWidget *widget) const | - | ||||||||||||
| 193 | { | - | ||||||||||||
| 194 | Q_D (const QProxyStyle); | - | ||||||||||||
| 195 | d->ensureBaseStyle(); | - | ||||||||||||
| 196 | d->baseStyle->drawPrimitive(element, option, painter, widget); | - | ||||||||||||
| 197 | } never executed: end of block | 0 | ||||||||||||
| 198 | - | |||||||||||||
| 199 | /*! | - | ||||||||||||
| 200 | \reimp | - | ||||||||||||
| 201 | */ | - | ||||||||||||
| 202 | void QProxyStyle::drawControl(ControlElement element, const QStyleOption *option, QPainter *painter, const QWidget *widget) const | - | ||||||||||||
| 203 | { | - | ||||||||||||
| 204 | Q_D (const QProxyStyle); | - | ||||||||||||
| 205 | d->ensureBaseStyle(); | - | ||||||||||||
| 206 | d->baseStyle->drawControl(element, option, painter, widget); | - | ||||||||||||
| 207 | } never executed: end of block | 0 | ||||||||||||
| 208 | - | |||||||||||||
| 209 | /*! \reimp | - | ||||||||||||
| 210 | */ | - | ||||||||||||
| 211 | void QProxyStyle::drawComplexControl(ComplexControl control, const QStyleOptionComplex *option, QPainter *painter, const QWidget *widget) const | - | ||||||||||||
| 212 | { | - | ||||||||||||
| 213 | Q_D (const QProxyStyle); | - | ||||||||||||
| 214 | d->ensureBaseStyle(); | - | ||||||||||||
| 215 | d->baseStyle->drawComplexControl(control, option, painter, widget); | - | ||||||||||||
| 216 | } never executed: end of block | 0 | ||||||||||||
| 217 | - | |||||||||||||
| 218 | /*! \reimp | - | ||||||||||||
| 219 | */ | - | ||||||||||||
| 220 | void QProxyStyle::drawItemText(QPainter *painter, const QRect &rect, int flags, const QPalette &pal, bool enabled, | - | ||||||||||||
| 221 | const QString &text, QPalette::ColorRole textRole) const | - | ||||||||||||
| 222 | { | - | ||||||||||||
| 223 | Q_D (const QProxyStyle); | - | ||||||||||||
| 224 | d->ensureBaseStyle(); | - | ||||||||||||
| 225 | d->baseStyle->drawItemText(painter, rect, flags, pal, enabled, text, textRole); | - | ||||||||||||
| 226 | } never executed: end of block | 0 | ||||||||||||
| 227 | - | |||||||||||||
| 228 | /*! \reimp | - | ||||||||||||
| 229 | */ | - | ||||||||||||
| 230 | void QProxyStyle::drawItemPixmap(QPainter *painter, const QRect &rect, int alignment, const QPixmap &pixmap) const | - | ||||||||||||
| 231 | { | - | ||||||||||||
| 232 | Q_D (const QProxyStyle); | - | ||||||||||||
| 233 | d->ensureBaseStyle(); | - | ||||||||||||
| 234 | d->baseStyle->drawItemPixmap(painter, rect, alignment, pixmap); | - | ||||||||||||
| 235 | } never executed: end of block | 0 | ||||||||||||
| 236 | - | |||||||||||||
| 237 | /*! \reimp | - | ||||||||||||
| 238 | */ | - | ||||||||||||
| 239 | QSize QProxyStyle::sizeFromContents(ContentsType type, const QStyleOption *option, const QSize &size, const QWidget *widget) const | - | ||||||||||||
| 240 | { | - | ||||||||||||
| 241 | Q_D (const QProxyStyle); | - | ||||||||||||
| 242 | d->ensureBaseStyle(); | - | ||||||||||||
| 243 | return d->baseStyle->sizeFromContents(type, option, size, widget); never executed: return d->baseStyle->sizeFromContents(type, option, size, widget); | 0 | ||||||||||||
| 244 | } | - | ||||||||||||
| 245 | - | |||||||||||||
| 246 | /*! \reimp | - | ||||||||||||
| 247 | */ | - | ||||||||||||
| 248 | QRect QProxyStyle::subElementRect(SubElement element, const QStyleOption *option, const QWidget *widget) const | - | ||||||||||||
| 249 | { | - | ||||||||||||
| 250 | Q_D (const QProxyStyle); | - | ||||||||||||
| 251 | d->ensureBaseStyle(); | - | ||||||||||||
| 252 | return d->baseStyle->subElementRect(element, option, widget); never executed: return d->baseStyle->subElementRect(element, option, widget); | 0 | ||||||||||||
| 253 | } | - | ||||||||||||
| 254 | - | |||||||||||||
| 255 | /*! \reimp | - | ||||||||||||
| 256 | */ | - | ||||||||||||
| 257 | QRect QProxyStyle::subControlRect(ComplexControl cc, const QStyleOptionComplex *option, SubControl sc, const QWidget *widget) const | - | ||||||||||||
| 258 | { | - | ||||||||||||
| 259 | Q_D (const QProxyStyle); | - | ||||||||||||
| 260 | d->ensureBaseStyle(); | - | ||||||||||||
| 261 | return d->baseStyle->subControlRect(cc, option, sc, widget); never executed: return d->baseStyle->subControlRect(cc, option, sc, widget); | 0 | ||||||||||||
| 262 | } | - | ||||||||||||
| 263 | - | |||||||||||||
| 264 | /*! \reimp | - | ||||||||||||
| 265 | */ | - | ||||||||||||
| 266 | QRect QProxyStyle::itemTextRect(const QFontMetrics &fm, const QRect &r, int flags, bool enabled, const QString &text) const | - | ||||||||||||
| 267 | { | - | ||||||||||||
| 268 | Q_D (const QProxyStyle); | - | ||||||||||||
| 269 | d->ensureBaseStyle(); | - | ||||||||||||
| 270 | return d->baseStyle->itemTextRect(fm, r, flags, enabled, text); never executed: return d->baseStyle->itemTextRect(fm, r, flags, enabled, text); | 0 | ||||||||||||
| 271 | } | - | ||||||||||||
| 272 | - | |||||||||||||
| 273 | /*! \reimp | - | ||||||||||||
| 274 | */ | - | ||||||||||||
| 275 | QRect QProxyStyle::itemPixmapRect(const QRect &r, int flags, const QPixmap &pixmap) const | - | ||||||||||||
| 276 | { | - | ||||||||||||
| 277 | Q_D (const QProxyStyle); | - | ||||||||||||
| 278 | d->ensureBaseStyle(); | - | ||||||||||||
| 279 | return d->baseStyle->itemPixmapRect(r, flags, pixmap); never executed: return d->baseStyle->itemPixmapRect(r, flags, pixmap); | 0 | ||||||||||||
| 280 | } | - | ||||||||||||
| 281 | - | |||||||||||||
| 282 | /*! \reimp | - | ||||||||||||
| 283 | */ | - | ||||||||||||
| 284 | QStyle::SubControl QProxyStyle::hitTestComplexControl(ComplexControl control, const QStyleOptionComplex *option, const QPoint &pos, const QWidget *widget) const | - | ||||||||||||
| 285 | { | - | ||||||||||||
| 286 | Q_D (const QProxyStyle); | - | ||||||||||||
| 287 | d->ensureBaseStyle(); | - | ||||||||||||
| 288 | return d->baseStyle->hitTestComplexControl(control, option, pos, widget); never executed: return d->baseStyle->hitTestComplexControl(control, option, pos, widget); | 0 | ||||||||||||
| 289 | } | - | ||||||||||||
| 290 | - | |||||||||||||
| 291 | /*! \reimp | - | ||||||||||||
| 292 | */ | - | ||||||||||||
| 293 | int QProxyStyle::styleHint(StyleHint hint, const QStyleOption *option, const QWidget *widget, QStyleHintReturn *returnData) const | - | ||||||||||||
| 294 | { | - | ||||||||||||
| 295 | Q_D (const QProxyStyle); | - | ||||||||||||
| 296 | d->ensureBaseStyle(); | - | ||||||||||||
| 297 | return d->baseStyle->styleHint(hint, option, widget, returnData); never executed: return d->baseStyle->styleHint(hint, option, widget, returnData); | 0 | ||||||||||||
| 298 | } | - | ||||||||||||
| 299 | - | |||||||||||||
| 300 | /*! \reimp | - | ||||||||||||
| 301 | */ | - | ||||||||||||
| 302 | int QProxyStyle::pixelMetric(PixelMetric metric, const QStyleOption *option, const QWidget *widget) const | - | ||||||||||||
| 303 | { | - | ||||||||||||
| 304 | Q_D (const QProxyStyle); | - | ||||||||||||
| 305 | d->ensureBaseStyle(); | - | ||||||||||||
| 306 | return d->baseStyle->pixelMetric(metric, option, widget); never executed: return d->baseStyle->pixelMetric(metric, option, widget); | 0 | ||||||||||||
| 307 | } | - | ||||||||||||
| 308 | - | |||||||||||||
| 309 | /*! \reimp | - | ||||||||||||
| 310 | */ | - | ||||||||||||
| 311 | QPixmap QProxyStyle::standardPixmap(StandardPixmap standardPixmap, const QStyleOption *opt, const QWidget *widget) const | - | ||||||||||||
| 312 | { | - | ||||||||||||
| 313 | Q_D (const QProxyStyle); | - | ||||||||||||
| 314 | d->ensureBaseStyle(); | - | ||||||||||||
| 315 | return d->baseStyle->standardPixmap(standardPixmap, opt, widget); never executed: return d->baseStyle->standardPixmap(standardPixmap, opt, widget); | 0 | ||||||||||||
| 316 | } | - | ||||||||||||
| 317 | - | |||||||||||||
| 318 | /*! \reimp | - | ||||||||||||
| 319 | */ | - | ||||||||||||
| 320 | QPixmap QProxyStyle::generatedIconPixmap(QIcon::Mode iconMode, const QPixmap &pixmap, const QStyleOption *opt) const | - | ||||||||||||
| 321 | { | - | ||||||||||||
| 322 | Q_D (const QProxyStyle); | - | ||||||||||||
| 323 | d->ensureBaseStyle(); | - | ||||||||||||
| 324 | return d->baseStyle->generatedIconPixmap(iconMode, pixmap, opt); never executed: return d->baseStyle->generatedIconPixmap(iconMode, pixmap, opt); | 0 | ||||||||||||
| 325 | } | - | ||||||||||||
| 326 | - | |||||||||||||
| 327 | /*! \reimp | - | ||||||||||||
| 328 | */ | - | ||||||||||||
| 329 | QPalette QProxyStyle::standardPalette() const | - | ||||||||||||
| 330 | { | - | ||||||||||||
| 331 | Q_D (const QProxyStyle); | - | ||||||||||||
| 332 | d->ensureBaseStyle(); | - | ||||||||||||
| 333 | return d->baseStyle->standardPalette(); never executed: return d->baseStyle->standardPalette(); | 0 | ||||||||||||
| 334 | } | - | ||||||||||||
| 335 | - | |||||||||||||
| 336 | /*! \reimp | - | ||||||||||||
| 337 | */ | - | ||||||||||||
| 338 | void QProxyStyle::polish(QWidget *widget) | - | ||||||||||||
| 339 | { | - | ||||||||||||
| 340 | Q_D (QProxyStyle); | - | ||||||||||||
| 341 | d->ensureBaseStyle(); | - | ||||||||||||
| 342 | d->baseStyle->polish(widget); | - | ||||||||||||
| 343 | } never executed: end of block | 0 | ||||||||||||
| 344 | - | |||||||||||||
| 345 | /*! \reimp | - | ||||||||||||
| 346 | */ | - | ||||||||||||
| 347 | void QProxyStyle::polish(QPalette &pal) | - | ||||||||||||
| 348 | { | - | ||||||||||||
| 349 | Q_D (QProxyStyle); | - | ||||||||||||
| 350 | d->ensureBaseStyle(); | - | ||||||||||||
| 351 | d->baseStyle->polish(pal); | - | ||||||||||||
| 352 | } never executed: end of block | 0 | ||||||||||||
| 353 | - | |||||||||||||
| 354 | /*! \reimp | - | ||||||||||||
| 355 | */ | - | ||||||||||||
| 356 | void QProxyStyle::polish(QApplication *app) | - | ||||||||||||
| 357 | { | - | ||||||||||||
| 358 | Q_D (QProxyStyle); | - | ||||||||||||
| 359 | d->ensureBaseStyle(); | - | ||||||||||||
| 360 | d->baseStyle->polish(app); | - | ||||||||||||
| 361 | } never executed: end of block | 0 | ||||||||||||
| 362 | - | |||||||||||||
| 363 | /*! \reimp | - | ||||||||||||
| 364 | */ | - | ||||||||||||
| 365 | void QProxyStyle::unpolish(QWidget *widget) | - | ||||||||||||
| 366 | { | - | ||||||||||||
| 367 | Q_D (QProxyStyle); | - | ||||||||||||
| 368 | d->ensureBaseStyle(); | - | ||||||||||||
| 369 | d->baseStyle->unpolish(widget); | - | ||||||||||||
| 370 | } never executed: end of block | 0 | ||||||||||||
| 371 | - | |||||||||||||
| 372 | /*! \reimp | - | ||||||||||||
| 373 | */ | - | ||||||||||||
| 374 | void QProxyStyle::unpolish(QApplication *app) | - | ||||||||||||
| 375 | { | - | ||||||||||||
| 376 | Q_D (QProxyStyle); | - | ||||||||||||
| 377 | d->ensureBaseStyle(); | - | ||||||||||||
| 378 | d->baseStyle->unpolish(app); | - | ||||||||||||
| 379 | } never executed: end of block | 0 | ||||||||||||
| 380 | - | |||||||||||||
| 381 | /*! \reimp | - | ||||||||||||
| 382 | */ | - | ||||||||||||
| 383 | bool QProxyStyle::event(QEvent *e) | - | ||||||||||||
| 384 | { | - | ||||||||||||
| 385 | Q_D (QProxyStyle); | - | ||||||||||||
| 386 | d->ensureBaseStyle(); | - | ||||||||||||
| 387 | return d->baseStyle->event(e); never executed: return d->baseStyle->event(e); | 0 | ||||||||||||
| 388 | } | - | ||||||||||||
| 389 | - | |||||||||||||
| 390 | /*! | - | ||||||||||||
| 391 | Returns an icon for the given \a standardIcon. | - | ||||||||||||
| 392 | - | |||||||||||||
| 393 | Reimplement this slot to provide your own icons in a QStyle | - | ||||||||||||
| 394 | subclass. The \a option argument can be used to pass extra | - | ||||||||||||
| 395 | information required to find the appropriate icon. The \a widget | - | ||||||||||||
| 396 | argument is optional and can also be used to help find the icon. | - | ||||||||||||
| 397 | */ | - | ||||||||||||
| 398 | QIcon QProxyStyle::standardIcon(StandardPixmap standardIcon, | - | ||||||||||||
| 399 | const QStyleOption *option, | - | ||||||||||||
| 400 | const QWidget *widget) const | - | ||||||||||||
| 401 | { | - | ||||||||||||
| 402 | Q_D (const QProxyStyle); | - | ||||||||||||
| 403 | d->ensureBaseStyle(); | - | ||||||||||||
| 404 | return d->baseStyle->standardIcon(standardIcon, option, widget); never executed: return d->baseStyle->standardIcon(standardIcon, option, widget); | 0 | ||||||||||||
| 405 | } | - | ||||||||||||
| 406 | - | |||||||||||||
| 407 | /*! | - | ||||||||||||
| 408 | This slot is called by layoutSpacing() to determine the spacing that | - | ||||||||||||
| 409 | should be used between \a control1 and \a control2 in a layout. \a | - | ||||||||||||
| 410 | orientation specifies whether the controls are laid out side by side | - | ||||||||||||
| 411 | or stacked vertically. The \a option parameter can be used to pass | - | ||||||||||||
| 412 | extra information about the parent widget. The \a widget parameter | - | ||||||||||||
| 413 | is optional and can also be used if \a option is 0. | - | ||||||||||||
| 414 | - | |||||||||||||
| 415 | The default implementation returns -1. | - | ||||||||||||
| 416 | - | |||||||||||||
| 417 | \sa combinedLayoutSpacing() | - | ||||||||||||
| 418 | */ | - | ||||||||||||
| 419 | int QProxyStyle::layoutSpacing(QSizePolicy::ControlType control1, | - | ||||||||||||
| 420 | QSizePolicy::ControlType control2, | - | ||||||||||||
| 421 | Qt::Orientation orientation, | - | ||||||||||||
| 422 | const QStyleOption *option, | - | ||||||||||||
| 423 | const QWidget *widget) const | - | ||||||||||||
| 424 | { | - | ||||||||||||
| 425 | Q_D (const QProxyStyle); | - | ||||||||||||
| 426 | d->ensureBaseStyle(); | - | ||||||||||||
| 427 | return d->baseStyle->layoutSpacing(control1, control2, orientation, option, widget); never executed: return d->baseStyle->layoutSpacing(control1, control2, orientation, option, widget); | 0 | ||||||||||||
| 428 | } | - | ||||||||||||
| 429 | - | |||||||||||||
| 430 | QT_END_NAMESPACE | - | ||||||||||||
| 431 | - | |||||||||||||
| 432 | #include "moc_qproxystyle.cpp" | - | ||||||||||||
| 433 | - | |||||||||||||
| 434 | #endif // QT_NO_STYLE_PROXY | - | ||||||||||||
| Source code | Switch to Preprocessed file |