diff options
author | Tarja Sundqvist <tarja.sundqvist@qt.io> | 2022-09-12 18:29:34 +0300 |
---|---|---|
committer | Tarja Sundqvist <tarja.sundqvist@qt.io> | 2022-09-12 18:29:34 +0300 |
commit | 6efece8c8fe18ec3cc01dbc9c02fed3f17208ef4 (patch) | |
tree | 243504aa152967c5586bc848f9f62679d51551d0 /src/widgets/widgets | |
parent | a5984e059385e93ab06eb95cbe12bea5215f7b9d (diff) | |
parent | dbf21da8a66e4cf1a050792c3a5816d2c686a846 (diff) |
Merge remote-tracking branch 'origin/tqtc/lts-5.15.7' into tqtc/lts-5.15-opensource
Change-Id: I976ce0c3664c9953dd0019b7d76d3f603583634f
Diffstat (limited to 'src/widgets/widgets')
-rw-r--r-- | src/widgets/widgets/qdockwidget.cpp | 2 | ||||
-rw-r--r-- | src/widgets/widgets/qscrollarea.cpp | 15 |
2 files changed, 15 insertions, 2 deletions
diff --git a/src/widgets/widgets/qdockwidget.cpp b/src/widgets/widgets/qdockwidget.cpp index d9379b0f33..93362f4210 100644 --- a/src/widgets/widgets/qdockwidget.cpp +++ b/src/widgets/widgets/qdockwidget.cpp @@ -975,7 +975,7 @@ bool QDockWidgetPrivate::mouseMoveEvent(QMouseEvent *event) > QApplication::startDragDistance()) { #ifdef Q_OS_MACOS - if (windowHandle()) { + if (windowHandle() && !q->isFloating()) { // When using native widgets on mac, we have not yet been successful in // starting a drag on an NSView that belongs to one window (QMainWindow), // but continue the drag on another (QDockWidget). This is what happens if diff --git a/src/widgets/widgets/qscrollarea.cpp b/src/widgets/widgets/qscrollarea.cpp index f7a4f8e446..f880240ea7 100644 --- a/src/widgets/widgets/qscrollarea.cpp +++ b/src/widgets/widgets/qscrollarea.cpp @@ -196,7 +196,20 @@ void QScrollAreaPrivate::updateScrollBars() if (resizable) { if ((widget->layout() ? widget->layout()->hasHeightForWidth() : widget->sizePolicy().hasHeightForWidth())) { QSize p_hfw = p.expandedTo(min).boundedTo(max); - int h = widget->heightForWidth( p_hfw.width() ); + int h = widget->heightForWidth(p_hfw.width()); + // If the height we calculated requires a vertical scrollbar, + // then we need to constrain the width and calculate the height again, + // otherwise we end up flipping the scrollbar on and off all the time. + 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()); + } + max = QSize(m_hfw.width(), qMax(m_hfw.height(), h)); + } min = QSize(p_hfw.width(), qMax(p_hfw.height(), h)); } } |