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/qformlayout.cpp | 10 | ||||
-rw-r--r-- | src/widgets/kernel/qgesturemanager.cpp | 10 | ||||
-rw-r--r-- | src/widgets/kernel/qwhatsthis.cpp | 6 | ||||
-rw-r--r-- | src/widgets/kernel/qwidget.cpp | 35 | ||||
-rw-r--r-- | src/widgets/kernel/qwidget.h | 5 | ||||
-rw-r--r-- | src/widgets/kernel/qwidget_p.h | 3 | ||||
-rw-r--r-- | src/widgets/kernel/qwidgetbackingstore_p.h | 2 |
9 files changed, 50 insertions, 32 deletions
diff --git a/src/widgets/kernel/qapplication.cpp b/src/widgets/kernel/qapplication.cpp index f9db6155af..595bdf621d 100644 --- a/src/widgets/kernel/qapplication.cpp +++ b/src/widgets/kernel/qapplication.cpp @@ -1445,6 +1445,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); } } @@ -3908,6 +3909,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. @@ -3950,6 +3952,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/qformlayout.cpp b/src/widgets/kernel/qformlayout.cpp index 66e8858e21..101ce8b64c 100644 --- a/src/widgets/kernel/qformlayout.cpp +++ b/src/widgets/kernel/qformlayout.cpp @@ -419,13 +419,15 @@ void QFormLayoutPrivate::updateSizes() if (label) { maxMinLblWidth = qMax(maxMinLblWidth, label->minSize.width()); maxShLblWidth = qMax(maxShLblWidth, label->sizeHint.width()); - if (field) { + } + if (field) { + if (field->fullRow) { + maxMinIfldWidth = qMax(maxMinIfldWidth, field->minSize.width()); + maxShIfldWidth = qMax(maxShIfldWidth, field->sizeHint.width()); + } else { maxMinFldWidth = qMax(maxMinFldWidth, field->minSize.width() + field->sbsHSpace); maxShFldWidth = qMax(maxShFldWidth, field->sizeHint.width() + field->sbsHSpace); } - } else if (field) { - maxMinIfldWidth = qMax(maxMinIfldWidth, field->minSize.width()); - maxShIfldWidth = qMax(maxShIfldWidth, field->sizeHint.width()); } prevLbl = label; diff --git a/src/widgets/kernel/qgesturemanager.cpp b/src/widgets/kernel/qgesturemanager.cpp index c4188044cf..57d6994c88 100644 --- a/src/widgets/kernel/qgesturemanager.cpp +++ b/src/widgets/kernel/qgesturemanager.cpp @@ -136,7 +136,7 @@ Qt::GestureType QGestureManager::registerGestureRecognizer(QGestureRecognizer *r ++m_lastCustomGestureId; type = Qt::GestureType(m_lastCustomGestureId); } - m_recognizers.insertMulti(type, recognizer); + m_recognizers.insert(type, recognizer); return type; } @@ -522,7 +522,7 @@ bool QGestureManager::filterEvent(QWidget *receiver, QEvent *event) for(ContextIterator it = w->d_func()->gestureContext.constBegin(), e = w->d_func()->gestureContext.constEnd(); it != e; ++it) { types.insert(it.key(), 0); - contexts.insertMulti(w, it.key()); + contexts.insert(w, it.key()); } } // find all gesture contexts for the widget tree @@ -534,7 +534,7 @@ bool QGestureManager::filterEvent(QWidget *receiver, QEvent *event) if (!(it.value() & Qt::DontStartGestureOnChildren)) { if (!types.contains(it.key())) { types.insert(it.key(), 0); - contexts.insertMulti(w, it.key()); + contexts.insert(w, it.key()); } } } @@ -556,7 +556,7 @@ bool QGestureManager::filterEvent(QGraphicsObject *receiver, QEvent *event) for(ContextIterator it = item->QGraphicsItem::d_func()->gestureContext.constBegin(), e = item->QGraphicsItem::d_func()->gestureContext.constEnd(); it != e; ++it) { types.insert(it.key(), 0); - contexts.insertMulti(item, it.key()); + contexts.insert(item, it.key()); } } // find all gesture contexts for the graphics object tree @@ -569,7 +569,7 @@ bool QGestureManager::filterEvent(QGraphicsObject *receiver, QEvent *event) if (!(it.value() & Qt::DontStartGestureOnChildren)) { if (!types.contains(it.key())) { types.insert(it.key(), 0); - contexts.insertMulti(item, it.key()); + contexts.insert(item, it.key()); } } } diff --git a/src/widgets/kernel/qwhatsthis.cpp b/src/widgets/kernel/qwhatsthis.cpp index 1fa83d3238..4a798a7490 100644 --- a/src/widgets/kernel/qwhatsthis.cpp +++ b/src/widgets/kernel/qwhatsthis.cpp @@ -398,10 +398,10 @@ QWhatsThisPrivate::QWhatsThisPrivate() #ifdef QT_NO_CURSOR Q_UNUSED(sentEvent); #else - QApplication::setOverrideCursor((!sentEvent || !e.isAccepted())? + QGuiApplication::setOverrideCursor((!sentEvent || !e.isAccepted())? Qt::ForbiddenCursor:Qt::WhatsThisCursor); } else { - QApplication::setOverrideCursor(Qt::WhatsThisCursor); + QGuiApplication::setOverrideCursor(Qt::WhatsThisCursor); #endif } #ifndef QT_NO_ACCESSIBILITY @@ -417,7 +417,7 @@ QWhatsThisPrivate::~QWhatsThisPrivate() action->setChecked(false); #endif // QT_CONFIG(action) #ifndef QT_NO_CURSOR - QApplication::restoreOverrideCursor(); + QGuiApplication::restoreOverrideCursor(); #endif #ifndef QT_NO_ACCESSIBILITY QAccessibleEvent event(this, QAccessible::ContextHelpEnd); diff --git a/src/widgets/kernel/qwidget.cpp b/src/widgets/kernel/qwidget.cpp index bcfae46155..ccfd3534cd 100644 --- a/src/widgets/kernel/qwidget.cpp +++ b/src/widgets/kernel/qwidget.cpp @@ -2412,29 +2412,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(); @@ -2446,8 +2451,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); @@ -2455,11 +2463,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) } /* @@ -4916,9 +4919,9 @@ void QWidget::unsetLayoutDirection() Some underlying window implementations will reset the cursor if it leaves a widget even if the mouse is grabbed. If you want to have a cursor set for all widgets, even when outside the window, consider - QApplication::setOverrideCursor(). + QGuiApplication::setOverrideCursor(). - \sa QApplication::setOverrideCursor() + \sa QGuiApplication::setOverrideCursor() */ #ifndef QT_NO_CURSOR 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 be45c4c868..1f995278f4 100644 --- a/src/widgets/kernel/qwidget_p.h +++ b/src/widgets/kernel/qwidget_p.h @@ -150,7 +150,7 @@ public: } private: - Q_DISABLE_COPY(QWidgetBackingStoreTracker) + Q_DISABLE_COPY_MOVE(QWidgetBackingStoreTracker) private: QWidgetBackingStore* m_ptr; @@ -399,6 +399,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); diff --git a/src/widgets/kernel/qwidgetbackingstore_p.h b/src/widgets/kernel/qwidgetbackingstore_p.h index 53ccda850a..41469a04bb 100644 --- a/src/widgets/kernel/qwidgetbackingstore_p.h +++ b/src/widgets/kernel/qwidgetbackingstore_p.h @@ -305,7 +305,7 @@ private: friend class QWidget; friend class QBackingStore; - Q_DISABLE_COPY(QWidgetBackingStore) + Q_DISABLE_COPY_MOVE(QWidgetBackingStore) }; QT_END_NAMESPACE |