Fix rubberband position for tabbed mdi windows

Place the rubberband over the tabs instead of where the hidden
subwindows happen to be.

[ChangeLog][QtWidgets][QMdiArea] Fix rubberband position for tabbed mdi windows

Task-number: QTBUG-42612
Change-Id: I41e81ab8b99ab9e0fa533fd4ed1b2a8141d19753
Reviewed-by: Friedemann Kleint <Friedemann.Kleint@theqtcompany.com>
bb10
Paul Olav Tvete 2014-11-13 13:52:05 +01:00
parent 85a4aaa5ce
commit 42b4dda39c
3 changed files with 17 additions and 10 deletions

View File

@ -1511,7 +1511,7 @@ void QMdiAreaPrivate::highlightNextSubWindow(int increaseFactor)
#ifndef QT_NO_RUBBERBAND
if (!rubberBand) {
rubberBand = new QRubberBand(QRubberBand::Rectangle, viewport);
rubberBand = new QRubberBand(QRubberBand::Rectangle, q);
// For accessibility to identify this special widget.
rubberBand->setObjectName(QLatin1String("qt_rubberband"));
rubberBand->setWindowFlags(rubberBand->windowFlags() | Qt::WindowStaysOnTopHint);
@ -1528,6 +1528,20 @@ void QMdiAreaPrivate::highlightNextSubWindow(int increaseFactor)
Q_ASSERT(indexToHighlighted >= 0);
}
void QMdiAreaPrivate::showRubberBandFor(QMdiSubWindow *subWindow)
{
if (!subWindow || !rubberBand)
return;
if (viewMode == QMdiArea::TabbedView)
rubberBand->setGeometry(tabBar->tabRect(childWindows.indexOf(subWindow)));
else
rubberBand->setGeometry(subWindow->geometry());
rubberBand->raise();
rubberBand->show();
}
/*!
\internal
\since 4.4

View File

@ -248,14 +248,7 @@ public:
}
#ifndef QT_NO_RUBBERBAND
inline void showRubberBandFor(QMdiSubWindow *subWindow)
{
if (!subWindow || !rubberBand)
return;
rubberBand->setGeometry(subWindow->geometry());
rubberBand->raise();
rubberBand->show();
}
void showRubberBandFor(QMdiSubWindow *subWindow);
inline void hideRubberBand()
{

View File

@ -104,7 +104,7 @@ static bool tabBetweenSubWindowsIn(QMdiArea *mdiArea, int tabCount = -1, bool re
if (tabCount > 1)
QTest::qWait(500);
if (walkThrough) {
QRubberBand *rubberBand = mdiArea->viewport()->findChild<QRubberBand *>();
QRubberBand *rubberBand = mdiArea->findChild<QRubberBand *>();
if (!rubberBand) {
qWarning("No rubber band");
return false;