From ad68c845e3e368dc4235e64b54e15a9ee886b078 Mon Sep 17 00:00:00 2001 From: Sami Merila Date: Thu, 9 Dec 2010 14:25:16 +0200 Subject: QLabel wraps text at fixed lengths There are multiple problems with text wrapping and dialogs. First, teh CBA height was assumed to be zero, or fetch from previous layout, which caused the dialog to be half under the CBA. Now, CBA height is always asked from AVKON metrics, since asking it from actual component might fail (or produce incorrect results) due to that the component is not created yet (or might still have previous layout active). Additionally, qinputDialog label is now having a size policy to restrict its growing out of dialog borders. Task-number: QT-4354 Reviewed-by: Janne Koskinen --- src/gui/dialogs/qdialog.cpp | 13 ++++++------- src/gui/dialogs/qinputdialog.cpp | 2 ++ 2 files changed, 8 insertions(+), 7 deletions(-) diff --git a/src/gui/dialogs/qdialog.cpp b/src/gui/dialogs/qdialog.cpp index fbdc522..16ea045 100644 --- a/src/gui/dialogs/qdialog.cpp +++ b/src/gui/dialogs/qdialog.cpp @@ -901,15 +901,13 @@ bool QDialog::symbianAdjustedPosition() QPoint p; const bool doS60Positioning = !(isFullScreen()||isMaximized()); if (doS60Positioning) { + QPoint oldPos = pos(); // naive way to deduce screen orientation if (S60->screenHeightInPixels > S60->screenWidthInPixels) { int cbaHeight; - const CEikButtonGroupContainer* bgContainer = S60->buttonGroupContainer(); - if (!bgContainer) { - cbaHeight = 0; - } else { - cbaHeight = qt_TSize2QSize(bgContainer->Size()).height(); - } + TRect rect; + AknLayoutUtils::LayoutMetricsRect(AknLayoutUtils::EControlPane, rect); + cbaHeight = rect.Height(); p.setY(S60->screenHeightInPixels - height() - cbaHeight); p.setX(0); } else { @@ -939,7 +937,8 @@ bool QDialog::symbianAdjustedPosition() p.setX(qMax(0,S60->screenWidthInPixels - width())); } } - move(p); + if (oldPos != p || p.y() < 0) + move(p); } return doS60Positioning; #else diff --git a/src/gui/dialogs/qinputdialog.cpp b/src/gui/dialogs/qinputdialog.cpp index ce27bd3..a29376a 100644 --- a/src/gui/dialogs/qinputdialog.cpp +++ b/src/gui/dialogs/qinputdialog.cpp @@ -234,6 +234,8 @@ void QInputDialogPrivate::ensureLayout() //we want to let the input dialog grow to available size on Symbian. #ifndef Q_OS_SYMBIAN mainLayout->setSizeConstraint(QLayout::SetMinAndMaxSize); +#else + label->setSizePolicy(QSizePolicy::Expanding, QSizePolicy::Expanding); #endif mainLayout->addWidget(label); mainLayout->addWidget(inputWidget); -- cgit v0.12