try to reposition before showing

to minimize dialog repositions, try to put it at the proper position before showing.

besides making things a bit snappier,
showing at 0,0 for an instant has some interesting sideeffects:
MouseArea has a rather strange way to manage hoverevents:
at window show, it will check if the item is under the absolute mouse position,
if so, will emit an entered() signal. This causes the Kickoff menu to
automatically select the last tab on first show, because for an instant
(that never gets drawn on the screen) all the tabs will actually be under the mouse cursor

Change-Id: Ie9fc45f2a5076c3f49b42e8a7cee109b04db46b9
This commit is contained in:
Marco Martin 2015-01-30 14:33:58 +01:00
parent 867098ea14
commit ea8974fa93

View File

@ -1210,6 +1210,9 @@ void Dialog::setVisible(bool visible)
d->visible = visible; d->visible = visible;
if (d->componentComplete) { if (d->componentComplete) {
if (d->visualParent) {
setPosition(popupPosition(d->visualParent, size()));
}
QQuickWindow::setVisible(visible); QQuickWindow::setVisible(visible);
//signal will be emitted and proxied from the QQuickWindow code //signal will be emitted and proxied from the QQuickWindow code
} else { } else {