From 644b93830aa7bc4407db40359b1bd6c86bc58343 Mon Sep 17 00:00:00 2001 From: Aleix Pol Date: Thu, 12 Mar 2015 18:00:54 +0100 Subject: [PATCH] Don't try to infer sizes when the dialog is not visible It suggests weird sizes and often resizes dialogs into -1x-1 size. Reviewed by David Edmundson and Vishesh Handa --- src/plasmaquick/dialog.cpp | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/src/plasmaquick/dialog.cpp b/src/plasmaquick/dialog.cpp index a6b004293..0d820a66e 100644 --- a/src/plasmaquick/dialog.cpp +++ b/src/plasmaquick/dialog.cpp @@ -551,6 +551,9 @@ void DialogPrivate::syncToMainItemSize() if (!componentComplete || !q->isVisible()) { return; } + if (mainItem->width() <= 0 || mainItem->height() <= 0) { + qWarning() << "trying to show an empty dialog"; + } updateTheme(); if (visualParent) { @@ -608,7 +611,7 @@ void DialogPrivate::slotWindowPositionChanged() { // Tooltips always have all the borders // floating windows have all borders - if ((q->flags() & Qt::ToolTip) || location == Plasma::Types::Floating) { + if (!q->isVisible() || (q->flags() & Qt::ToolTip) || location == Plasma::Types::Floating) { return; } @@ -944,7 +947,7 @@ void Dialog::resizeEvent(QResizeEvent* re) QQuickWindow::resizeEvent(re); //A dialog can be resized even if no mainItem has ever been set - if (!d->mainItem) { + if (!isVisible() || !d->mainItem) { return; }