SVN commit 859660 by alexmerry: Fix the calendar dialog popping up in the wrong place the first time.
The issue is that we are using a QProxyWidget, and it seems that QWidgets don't have a sensible size() until they're shown for the first time. So we use sizeHint() (or effectiveSizeHint() in this case) instead. The only issue I can see is that if the widget passed to the dialog is in a layout, its size() and effectiveSizeHint(Qt::PreferredSize) might not match. Is this something we need to deal with? If so, how? CCMAIL: plasma-devel@kde.org M +9 -3 dialog.cpp --- trunk/KDE/kdebase/workspace/libs/plasma/dialog.cpp #859659:859660 @@ -94,12 +94,18 @@ void DialogPrivate::adjustView() { if (view && widget) { - kDebug() << "resize the view."; QSize prevSize = q->size(); + kDebug() << "Widget size:" << widget->size() + << "| Widget size hint:" << widget->effectiveSizeHint(Qt::PreferredSize) + << "| Widget bounding rect:" << widget->boundingRect(); + + QRectF boundingRect = widget->boundingRect(); + boundingRect.setSize(widget->effectiveSizeHint(Qt::PreferredSize)); + //reposition and resize the view. - view->setSceneRect(widget->mapToScene(widget->boundingRect()).boundingRect()); - view->resize(widget->size().toSize()); + view->setSceneRect(widget->mapToScene(boundingRect).boundingRect()); + view->resize(view->mapFromScene(view->sceneRect()).boundingRect().size()); view->centerOn(widget); //set the sizehints correctly: _______________________________________________ Plasma-devel mailing list Plasma-devel@kde.org https://mail.kde.org/mailman/listinfo/plasma-devel