diff options
Diffstat (limited to 'src/widgets')
-rw-r--r-- | src/widgets/graphicsview/qgraphicsitem.cpp | 1 | ||||
-rw-r--r-- | src/widgets/graphicsview/qgraphicsproxywidget.cpp | 4 | ||||
-rw-r--r-- | src/widgets/itemviews/qabstractitemview.cpp | 1 | ||||
-rw-r--r-- | src/widgets/itemviews/qtreewidget.cpp | 3 | ||||
-rw-r--r-- | src/widgets/kernel/qapplication.cpp | 5 | ||||
-rw-r--r-- | src/widgets/kernel/qsizepolicy.h | 5 | ||||
-rw-r--r-- | src/widgets/kernel/qwidget.cpp | 9 | ||||
-rw-r--r-- | src/widgets/kernel/qwidgetrepaintmanager.cpp | 15 | ||||
-rw-r--r-- | src/widgets/widgets/qabstractscrollarea.cpp | 4 | ||||
-rw-r--r-- | src/widgets/widgets/qfontcombobox.cpp | 4 | ||||
-rw-r--r-- | src/widgets/widgets/qplaintextedit.cpp | 2 | ||||
-rw-r--r-- | src/widgets/widgets/qscrollarea.cpp | 11 |
12 files changed, 47 insertions, 17 deletions
diff --git a/src/widgets/graphicsview/qgraphicsitem.cpp b/src/widgets/graphicsview/qgraphicsitem.cpp index 8411587bbe..944bd95c82 100644 --- a/src/widgets/graphicsview/qgraphicsitem.cpp +++ b/src/widgets/graphicsview/qgraphicsitem.cpp @@ -10297,6 +10297,7 @@ bool QGraphicsTextItem::sceneEvent(QEvent *event) case QEvent::GraphicsSceneMouseRelease: case QEvent::KeyPress: case QEvent::KeyRelease: + case QEvent::InputMethod: // Reset the focus widget's input context, regardless // of how this item gained or lost focus. if (event->type() == QEvent::FocusIn || event->type() == QEvent::FocusOut) { diff --git a/src/widgets/graphicsview/qgraphicsproxywidget.cpp b/src/widgets/graphicsview/qgraphicsproxywidget.cpp index 6e14827b49..e4253e9282 100644 --- a/src/widgets/graphicsview/qgraphicsproxywidget.cpp +++ b/src/widgets/graphicsview/qgraphicsproxywidget.cpp @@ -1555,6 +1555,10 @@ void QGraphicsProxyWidget::paint(QPainter *painter, const QStyleOptionGraphicsIt if (exposedWidgetRect.isEmpty()) return; + // When rendering to pdf etc. painting may go outside widget boundaries unless clipped + if (painter->device()->devType() != QInternal::Widget && (flags() & ItemClipsChildrenToShape)) + painter->setClipRect(d->widget->geometry(), Qt::IntersectClip); + d->widget->render(painter, exposedWidgetRect.topLeft(), exposedWidgetRect); } diff --git a/src/widgets/itemviews/qabstractitemview.cpp b/src/widgets/itemviews/qabstractitemview.cpp index 1e5a6ccb63..5e65c59796 100644 --- a/src/widgets/itemviews/qabstractitemview.cpp +++ b/src/widgets/itemviews/qabstractitemview.cpp @@ -1755,6 +1755,7 @@ bool QAbstractItemView::viewportEvent(QEvent *event) void QAbstractItemView::mousePressEvent(QMouseEvent *event) { Q_D(QAbstractItemView); + d->releaseFromDoubleClick = false; d->delayedAutoScroll.stop(); //any interaction with the view cancel the auto scrolling QPoint pos = event->pos(); QPersistentModelIndex index = indexAt(pos); diff --git a/src/widgets/itemviews/qtreewidget.cpp b/src/widgets/itemviews/qtreewidget.cpp index 81aed27361..94756049e4 100644 --- a/src/widgets/itemviews/qtreewidget.cpp +++ b/src/widgets/itemviews/qtreewidget.cpp @@ -2597,9 +2597,6 @@ void QTreeWidgetPrivate::_q_dataChanged(const QModelIndex &topLeft, This signal is emitted when the specified \a item is expanded so that all of its children are displayed. - \note This signal will not be emitted if an item changes its state when - expandAll() is invoked. - \sa QTreeWidgetItem::isExpanded(), itemCollapsed(), expandItem() */ diff --git a/src/widgets/kernel/qapplication.cpp b/src/widgets/kernel/qapplication.cpp index 62e188160a..619f2e7364 100644 --- a/src/widgets/kernel/qapplication.cpp +++ b/src/widgets/kernel/qapplication.cpp @@ -2135,7 +2135,10 @@ QWidget *QApplicationPrivate::focusNextPrevChild_helper(QWidget *toplevel, bool // \a next). This is to ensure that we can tab in and out of compound widgets // without getting stuck in a tab-loop between parent and child. QWidget *focusProxy = test->d_func()->deepestFocusProxy(); - const bool canTakeFocus = ((focusProxy ? focusProxy->focusPolicy() : test->focusPolicy()) + auto effectiveFocusPolicy = [](QWidget *widget) { + return widget->isEnabled() ? widget->focusPolicy() : Qt::NoFocus; + }; + const bool canTakeFocus = (effectiveFocusPolicy(focusProxy ? focusProxy : test) & focus_flag) == focus_flag; const bool composites = focusProxy ? (next ? focusProxy->isAncestorOf(test) : test->isAncestorOf(focusProxy)) diff --git a/src/widgets/kernel/qsizepolicy.h b/src/widgets/kernel/qsizepolicy.h index f26923eeb0..f275add923 100644 --- a/src/widgets/kernel/qsizepolicy.h +++ b/src/widgets/kernel/qsizepolicy.h @@ -133,9 +133,10 @@ public: Q_DECL_RELAXED_CONSTEXPR void setVerticalPolicy(Policy d) noexcept { bits.verPolicy = d; } void setControlType(ControlType type) noexcept; + // ### Qt 7: consider making Policy a QFlags and removing these casts QT_SIZEPOLICY_CONSTEXPR Qt::Orientations expandingDirections() const noexcept { - return ( (verticalPolicy() & ExpandFlag) ? Qt::Vertical : Qt::Orientations() ) - | ( (horizontalPolicy() & ExpandFlag) ? Qt::Horizontal : Qt::Orientations() ) ; + return ( (verticalPolicy() & static_cast<Policy>(ExpandFlag)) ? Qt::Vertical : Qt::Orientations() ) + | ( (horizontalPolicy() & static_cast<Policy>(ExpandFlag)) ? Qt::Horizontal : Qt::Orientations() ) ; } Q_DECL_RELAXED_CONSTEXPR void setHeightForWidth(bool b) noexcept { bits.hfw = b; } diff --git a/src/widgets/kernel/qwidget.cpp b/src/widgets/kernel/qwidget.cpp index 41b22676f8..9eba1e001e 100644 --- a/src/widgets/kernel/qwidget.cpp +++ b/src/widgets/kernel/qwidget.cpp @@ -5296,10 +5296,11 @@ void QWidgetPrivate::drawWidget(QPaintDevice *pdev, const QRegion &rgn, const QP QWidgetEffectSourcePrivate *sourced = static_cast<QWidgetEffectSourcePrivate *> (source->d_func()); if (!sourced->context) { - QWidgetPaintContext context(pdev, rgn, offset, flags, sharedPainter, repaintManager); + const QRegion effectRgn(rgn.boundingRect()); + QWidgetPaintContext context(pdev, effectRgn, offset, flags, sharedPainter, repaintManager); sourced->context = &context; if (!sharedPainter) { - setSystemClip(pdev->paintEngine(), pdev->devicePixelRatioF(), rgn.translated(offset)); + setSystemClip(pdev->paintEngine(), pdev->devicePixelRatioF(), effectRgn.translated(offset)); QPainter p(pdev); p.translate(offset); context.painter = &p; @@ -5313,7 +5314,7 @@ void QWidgetPrivate::drawWidget(QPaintDevice *pdev, const QRegion &rgn, const QP } sharedPainter->save(); sharedPainter->translate(offset); - setSystemClip(sharedPainter->paintEngine(), sharedPainter->device()->devicePixelRatioF(), rgn.translated(offset)); + setSystemClip(sharedPainter->paintEngine(), sharedPainter->device()->devicePixelRatioF(), effectRgn.translated(offset)); graphicsEffect->draw(sharedPainter); setSystemClip(sharedPainter->paintEngine(), 1, QRegion()); sharedPainter->restore(); @@ -5321,7 +5322,7 @@ void QWidgetPrivate::drawWidget(QPaintDevice *pdev, const QRegion &rgn, const QP sourced->context = nullptr; if (repaintManager) - repaintManager->markNeedsFlush(q, rgn, offset); + repaintManager->markNeedsFlush(q, effectRgn, offset); return; } diff --git a/src/widgets/kernel/qwidgetrepaintmanager.cpp b/src/widgets/kernel/qwidgetrepaintmanager.cpp index e7e85c39e7..02880b34da 100644 --- a/src/widgets/kernel/qwidgetrepaintmanager.cpp +++ b/src/widgets/kernel/qwidgetrepaintmanager.cpp @@ -801,6 +801,18 @@ bool QWidgetRepaintManager::syncAllowed() return true; } +static bool isDrawnInEffect(const QWidget *w) +{ +#if QT_CONFIG(graphicseffect) + do { + if (w->graphicsEffect()) + return true; + w = w->parentWidget(); + } while (w); +#endif + return false; +} + void QWidgetRepaintManager::paintAndFlush() { qCInfo(lcWidgetPainting) << "Painting and flushing dirty" @@ -888,7 +900,8 @@ void QWidgetRepaintManager::paintAndFlush() } #endif - if (!hasDirtySiblingsAbove && wd->isOpaque && !dirty.intersects(widgetDirty.boundingRect())) { + if (!isDrawnInEffect(w) && !hasDirtySiblingsAbove && wd->isOpaque + && !dirty.intersects(widgetDirty.boundingRect())) { opaqueNonOverlappedWidgets.append(w); } else { resetWidget(w); diff --git a/src/widgets/widgets/qabstractscrollarea.cpp b/src/widgets/widgets/qabstractscrollarea.cpp index 720a9f908a..04cd3fd136 100644 --- a/src/widgets/widgets/qabstractscrollarea.cpp +++ b/src/widgets/widgets/qabstractscrollarea.cpp @@ -442,8 +442,10 @@ void QAbstractScrollAreaPrivate::layoutChildren_helper(bool *needHorizontalScrol viewportRect.adjust(right, top, -left, -bottom); else viewportRect.adjust(left, top, -right, -bottom); + viewportRect = QStyle::visualRect(opt.direction, opt.rect, viewportRect); + viewportRect.translate(-overshoot); + viewport->setGeometry(viewportRect); // resize the viewport last - viewport->setGeometry(QStyle::visualRect(opt.direction, opt.rect, viewportRect)); // resize the viewport last *needHorizontalScrollbar = needh; *needVerticalScrollbar = needv; } diff --git a/src/widgets/widgets/qfontcombobox.cpp b/src/widgets/widgets/qfontcombobox.cpp index 4a99b0f962..289e2bc261 100644 --- a/src/widgets/widgets/qfontcombobox.cpp +++ b/src/widgets/widgets/qfontcombobox.cpp @@ -313,6 +313,10 @@ public: void QFontComboBoxPrivate::_q_updateModel() { Q_Q(QFontComboBox); + + if (QCoreApplication::closingDown()) + return; + const int scalableMask = (QFontComboBox::ScalableFonts | QFontComboBox::NonScalableFonts); const int spacingMask = (QFontComboBox::ProportionalFonts | QFontComboBox::MonospacedFonts); diff --git a/src/widgets/widgets/qplaintextedit.cpp b/src/widgets/widgets/qplaintextedit.cpp index 6694b79dda..144517ee0e 100644 --- a/src/widgets/widgets/qplaintextedit.cpp +++ b/src/widgets/widgets/qplaintextedit.cpp @@ -1942,7 +1942,7 @@ void QPlainTextEdit::paintEvent(QPaintEvent *e) // keep right margin clean from full-width selection int maxX = offset.x() + qMax((qreal)viewportRect.width(), maximumWidth) - - document()->documentMargin(); + - document()->documentMargin() + cursorWidth(); er.setRight(qMin(er.right(), maxX)); painter.setClipRect(er); diff --git a/src/widgets/widgets/qscrollarea.cpp b/src/widgets/widgets/qscrollarea.cpp index f880240ea7..e8fdadb648 100644 --- a/src/widgets/widgets/qscrollarea.cpp +++ b/src/widgets/widgets/qscrollarea.cpp @@ -203,10 +203,13 @@ void QScrollAreaPrivate::updateScrollBars() if (vbarpolicy == Qt::ScrollBarAsNeeded) { int vbarWidth = vbar->sizeHint().width(); QSize m_hfw = m.expandedTo(min).boundedTo(max); - while (h > m.height() && vbarWidth) { - --vbarWidth; - --m_hfw.rwidth(); - h = widget->heightForWidth(m_hfw.width()); + // is there any point in searching? + if (widget->heightForWidth(m_hfw.width() - vbarWidth) <= m.height()) { + while (h > m.height() && vbarWidth) { + --vbarWidth; + --m_hfw.rwidth(); + h = widget->heightForWidth(m_hfw.width()); + } } max = QSize(m_hfw.width(), qMax(m_hfw.height(), h)); } |