diff options
Diffstat (limited to 'src/widgets/kernel')
-rw-r--r-- | src/widgets/kernel/qapplication.cpp | 3 | ||||
-rw-r--r-- | src/widgets/kernel/qapplication.h | 8 | ||||
-rw-r--r-- | src/widgets/kernel/qwidget.cpp | 31 | ||||
-rw-r--r-- | src/widgets/kernel/qwidget.h | 5 | ||||
-rw-r--r-- | src/widgets/kernel/qwidget_p.h | 1 |
5 files changed, 32 insertions, 16 deletions
diff --git a/src/widgets/kernel/qapplication.cpp b/src/widgets/kernel/qapplication.cpp index 45b98e9475..f8f24d1ff0 100644 --- a/src/widgets/kernel/qapplication.cpp +++ b/src/widgets/kernel/qapplication.cpp @@ -1444,6 +1444,7 @@ void QApplicationPrivate::setPalette_helper(const QPalette &palette, const char* else *QApplicationPrivate::set_pal = palette; QCoreApplication::setAttribute(Qt::AA_SetPalette); + emit qGuiApp->paletteChanged(*QGuiApplicationPrivate::app_pal); } } @@ -3907,6 +3908,7 @@ Qt::NavigationMode QApplication::navigationMode() return QApplicationPrivate::navigationMode; } +# if QT_DEPRECATED_SINCE(5, 13) /*! Sets whether Qt should use focus navigation suitable for use with a minimal keypad. @@ -3949,6 +3951,7 @@ bool QApplication::keypadNavigationEnabled() return QApplicationPrivate::navigationMode == Qt::NavigationModeKeypadTabOrder || QApplicationPrivate::navigationMode == Qt::NavigationModeKeypadDirectional; } +# endif #endif /*! diff --git a/src/widgets/kernel/qapplication.h b/src/widgets/kernel/qapplication.h index 7a5d7ba1a9..27e743a28d 100644 --- a/src/widgets/kernel/qapplication.h +++ b/src/widgets/kernel/qapplication.h @@ -180,8 +180,12 @@ public: bool notify(QObject *, QEvent *) override; #ifdef QT_KEYPAD_NAVIGATION - static Q_DECL_DEPRECATED void setKeypadNavigationEnabled(bool); - static bool keypadNavigationEnabled(); +# if QT_DEPRECATED_SINCE(5, 13) + static QT_DEPRECATED_X ("Use QApplication::setNavigationMode() instead") + void setKeypadNavigationEnabled(bool); + static QT_DEPRECATED_X ("Use QApplication::navigationMode() instead") + bool keypadNavigationEnabled(); +# endif static void setNavigationMode(Qt::NavigationMode mode); static Qt::NavigationMode navigationMode(); #endif diff --git a/src/widgets/kernel/qwidget.cpp b/src/widgets/kernel/qwidget.cpp index 8c680560d4..1bca3fc119 100644 --- a/src/widgets/kernel/qwidget.cpp +++ b/src/widgets/kernel/qwidget.cpp @@ -2413,29 +2413,34 @@ static inline void fillRegion(QPainter *painter, const QRegion &rgn, const QBrus } } -void QWidgetPrivate::paintBackground(QPainter *painter, const QRegion &rgn, int flags) const +bool QWidgetPrivate::updateBrushOrigin(QPainter *painter, const QBrush &brush) const { - Q_Q(const QWidget); - #if QT_CONFIG(scrollarea) - bool resetBrushOrigin = false; - QPointF oldBrushOrigin; + Q_Q(const QWidget); //If we are painting the viewport of a scrollarea, we must apply an offset to the brush in case we are drawing a texture + if (brush.style() == Qt::NoBrush || brush.style() == Qt::SolidPattern) + return false; QAbstractScrollArea *scrollArea = qobject_cast<QAbstractScrollArea *>(parent); if (scrollArea && scrollArea->viewport() == q) { QObjectData *scrollPrivate = static_cast<QWidget *>(scrollArea)->d_ptr.data(); QAbstractScrollAreaPrivate *priv = static_cast<QAbstractScrollAreaPrivate *>(scrollPrivate); - oldBrushOrigin = painter->brushOrigin(); - resetBrushOrigin = true; painter->setBrushOrigin(-priv->contentsOffset()); - } #endif // QT_CONFIG(scrollarea) + return true; +} +void QWidgetPrivate::paintBackground(QPainter *painter, const QRegion &rgn, int flags) const +{ + Q_Q(const QWidget); + + bool brushOriginSet = false; const QBrush autoFillBrush = q->palette().brush(q->backgroundRole()); if ((flags & DrawAsRoot) && !(q->autoFillBackground() && autoFillBrush.isOpaque())) { const QBrush bg = q->palette().brush(QPalette::Window); + if (!brushOriginSet) + brushOriginSet = updateBrushOrigin(painter, bg); if (!(flags & DontSetCompositionMode)) { //copy alpha straight in QPainter::CompositionMode oldMode = painter->compositionMode(); @@ -2447,8 +2452,11 @@ void QWidgetPrivate::paintBackground(QPainter *painter, const QRegion &rgn, int } } - if (q->autoFillBackground()) + if (q->autoFillBackground()) { + if (!brushOriginSet) + brushOriginSet = updateBrushOrigin(painter, autoFillBrush); fillRegion(painter, rgn, autoFillBrush); + } if (q->testAttribute(Qt::WA_StyledBackground)) { painter->setClipRegion(rgn); @@ -2456,11 +2464,6 @@ void QWidgetPrivate::paintBackground(QPainter *painter, const QRegion &rgn, int opt.initFrom(q); q->style()->drawPrimitive(QStyle::PE_Widget, &opt, painter, q); } - -#if QT_CONFIG(scrollarea) - if (resetBrushOrigin) - painter->setBrushOrigin(oldBrushOrigin); -#endif // QT_CONFIG(scrollarea) } /* diff --git a/src/widgets/kernel/qwidget.h b/src/widgets/kernel/qwidget.h index 9d5fe89c70..4e5ef5a111 100644 --- a/src/widgets/kernel/qwidget.h +++ b/src/widgets/kernel/qwidget.h @@ -235,7 +235,10 @@ public: bool isEnabled() const; bool isEnabledTo(const QWidget *) const; +#if QT_DEPRECATED_SINCE(5, 13) + QT_DEPRECATED_X ("Use isEnabled() instead") bool isEnabledToTLW() const; +#endif public Q_SLOTS: void setEnabled(bool); @@ -769,8 +772,10 @@ inline bool QWidget::isEnabled() const inline bool QWidget::isModal() const { return data->window_modality != Qt::NonModal; } +#if QT_DEPRECATED_SINCE(5, 13) inline bool QWidget::isEnabledToTLW() const { return isEnabled(); } +#endif inline int QWidget::minimumWidth() const { return minimumSize().width(); } diff --git a/src/widgets/kernel/qwidget_p.h b/src/widgets/kernel/qwidget_p.h index c2fc27a9ad..0c7a5b1944 100644 --- a/src/widgets/kernel/qwidget_p.h +++ b/src/widgets/kernel/qwidget_p.h @@ -400,6 +400,7 @@ public: void setUpdatesEnabled_helper(bool ); + bool updateBrushOrigin(QPainter *, const QBrush &brush) const; void paintBackground(QPainter *, const QRegion &, int flags = DrawAsRoot) const; bool isAboutToShow() const; QRegion prepareToRender(const QRegion ®ion, QWidget::RenderFlags renderFlags); |