diff options
author | Qt Continuous Integration System <qt-info@nokia.com> | 2010-02-06 02:46:37 (GMT) |
---|---|---|
committer | Qt Continuous Integration System <qt-info@nokia.com> | 2010-02-06 02:46:37 (GMT) |
commit | 32290f508b2d250cd7a3a783e8b7d2322e676783 (patch) | |
tree | f2ff88dfecfda81cb3fd1f05dcff71647b0cac35 | |
parent | 941b13d52d975069d10093a873cd3a55bb2fd7dd (diff) | |
parent | 3b7164b3188e9382510bef2211e82ef777faa75c (diff) | |
download | Qt-32290f508b2d250cd7a3a783e8b7d2322e676783.zip Qt-32290f508b2d250cd7a3a783e8b7d2322e676783.tar.gz Qt-32290f508b2d250cd7a3a783e8b7d2322e676783.tar.bz2 |
Merge branch '4.6' of scm.dev.nokia.troll.no:qt/qt-s60-public into 4.6-integration
* '4.6' of scm.dev.nokia.troll.no:qt/qt-s60-public:
Fixed casual crash in initializeDb (Symbian)
Fixed a bug where text would disappear in password fields.
Fixed sendEvent call.
Removed useless member variable and replaced with var on the stack.
Fixed indentation.
Fix to S60 softkey pressed down image.
Whitespace/tab fixes.
s60 application loses normalGeometry when returning from fullscreen
Fixing 'softvfp+vfpv2' compiling issue for Tb9.2
-rw-r--r-- | src/gui/inputmethod/qcoefepinputcontext_p.h | 5 | ||||
-rw-r--r-- | src/gui/inputmethod/qcoefepinputcontext_s60.cpp | 28 | ||||
-rw-r--r-- | src/gui/kernel/qaction.cpp | 4 | ||||
-rw-r--r-- | src/gui/kernel/qapplication_s60.cpp | 17 | ||||
-rw-r--r-- | src/gui/kernel/qsoftkeymanager_s60.cpp | 19 | ||||
-rw-r--r-- | src/gui/kernel/qwidget_s60.cpp | 108 | ||||
-rw-r--r-- | src/gui/painting/qdrawhelper.cpp | 4 | ||||
-rw-r--r-- | src/gui/painting/qmath_p.h | 6 | ||||
-rw-r--r-- | src/gui/text/qfontdatabase_s60.cpp | 11 | ||||
-rw-r--r-- | tests/auto/qwidget/tst_qwidget.cpp | 224 |
10 files changed, 306 insertions, 120 deletions
diff --git a/src/gui/inputmethod/qcoefepinputcontext_p.h b/src/gui/inputmethod/qcoefepinputcontext_p.h index f5034fc..d5243c3 100644 --- a/src/gui/inputmethod/qcoefepinputcontext_p.h +++ b/src/gui/inputmethod/qcoefepinputcontext_p.h @@ -96,7 +96,7 @@ protected: void timerEvent(QTimerEvent *timerEvent); private: - void commitCurrentString(bool triggeredBySymbian); + void commitCurrentString(bool cancelFepTransaction); void updateHints(bool mustUpdateInputCapabilities); void applyHints(Qt::InputMethodHints hints); void applyFormat(QList<QInputMethodEvent::Attribute> *attributes); @@ -127,7 +127,7 @@ public: private: void DoCommitFepInlineEditL(); MCoeFepAwareTextEditor_Extension1* Extension1(TBool& aSetToTrue); - void ReportAknEdStateEvent(MAknEdStateObserver::EAknEdwinStateEvent aEventType); + void ReportAknEdStateEvent(MAknEdStateObserver::EAknEdwinStateEvent aEventType); // From MCoeFepAwareTextEditor_Extension1 public: @@ -151,7 +151,6 @@ private: int m_inlinePosition; MFepInlineTextFormatRetriever *m_formatRetriever; MFepPointerEventHandlerDuringInlineEdit *m_pointerHandler; - int m_longPress; int m_cursorPos; QBasicTimer m_tempPreeditStringTimeout; bool m_hasTempPreeditString; diff --git a/src/gui/inputmethod/qcoefepinputcontext_s60.cpp b/src/gui/inputmethod/qcoefepinputcontext_s60.cpp index e5ab300..2b91711 100644 --- a/src/gui/inputmethod/qcoefepinputcontext_s60.cpp +++ b/src/gui/inputmethod/qcoefepinputcontext_s60.cpp @@ -71,7 +71,6 @@ QCoeFepInputContext::QCoeFepInputContext(QObject *parent) m_inlinePosition(0), m_formatRetriever(0), m_pointerHandler(0), - m_longPress(0), m_cursorPos(0), m_hasTempPreeditString(false) { @@ -101,7 +100,7 @@ QCoeFepInputContext::~QCoeFepInputContext() void QCoeFepInputContext::reset() { - commitCurrentString(false); + commitCurrentString(true); } void QCoeFepInputContext::ReportAknEdStateEvent(MAknEdStateObserver::EAknEdwinStateEvent aEventType) @@ -126,7 +125,7 @@ void QCoeFepInputContext::update() void QCoeFepInputContext::setFocusWidget(QWidget *w) { - commitCurrentString(false); + commitCurrentString(true); QInputContext::setFocusWidget(w); @@ -219,7 +218,7 @@ bool QCoeFepInputContext::filterEvent(const QEvent *event) break; case Qt::Key_Select: if (!m_preeditString.isEmpty()) { - commitCurrentString(false); + commitCurrentString(true); return true; } break; @@ -231,10 +230,11 @@ bool QCoeFepInputContext::filterEvent(const QEvent *event) && focusWidget()->inputMethodHints() & Qt::ImhHiddenText && !keyEvent->text().isEmpty()) { // Send some temporary preedit text in order to make text visible for a moment. + m_cursorPos = focusWidget()->inputMethodQuery(Qt::ImCursorPosition).toInt(); m_preeditString = keyEvent->text(); QList<QInputMethodEvent::Attribute> attributes; QInputMethodEvent imEvent(m_preeditString, attributes); - QApplication::sendEvent(focusWidget(), &imEvent); + sendEvent(imEvent); m_tempPreeditStringTimeout.start(1000, this); m_hasTempPreeditString = true; update(); @@ -293,7 +293,7 @@ void QCoeFepInputContext::mouseHandler( int x, QMouseEvent *event) Q_ASSERT(focusWidget()); if (event->type() == QEvent::MouseButtonPress && event->button() == Qt::LeftButton) { - commitCurrentString(false); + commitCurrentString(true); int pos = focusWidget()->inputMethodQuery(Qt::ImCursorPosition).toInt(); QList<QInputMethodEvent::Attribute> attributes; @@ -739,31 +739,33 @@ void QCoeFepInputContext::GetScreenCoordinatesForFepL(TPoint& aLeftSideOfBaseLin void QCoeFepInputContext::DoCommitFepInlineEditL() { - commitCurrentString(true); + commitCurrentString(false); } -void QCoeFepInputContext::commitCurrentString(bool triggeredBySymbian) +void QCoeFepInputContext::commitCurrentString(bool cancelFepTransaction) { + int longPress = 0; + if (m_preeditString.size() == 0) { QWidget *w = focusWidget(); - if (triggeredBySymbian && w) { + if (!cancelFepTransaction && w) { // We must replace the last character only if the input box has already accepted one if (w->inputMethodQuery(Qt::ImCursorPosition).toInt() != m_cursorPos) - m_longPress = 1; + longPress = 1; } return; } QList<QInputMethodEvent::Attribute> attributes; QInputMethodEvent event(QLatin1String(""), attributes); - event.setCommitString(m_preeditString, 0-m_longPress, m_longPress); + event.setCommitString(m_preeditString, 0-longPress, longPress); m_preeditString.clear(); sendEvent(event); m_hasTempPreeditString = false; - m_longPress = 0; + longPress = 0; - if (!triggeredBySymbian) { + if (cancelFepTransaction) { CCoeFep* fep = CCoeEnv::Static()->Fep(); if (fep) fep->CancelTransaction(); diff --git a/src/gui/kernel/qaction.cpp b/src/gui/kernel/qaction.cpp index 4b7d949..8ddd051 100644 --- a/src/gui/kernel/qaction.cpp +++ b/src/gui/kernel/qaction.cpp @@ -715,6 +715,10 @@ QActionGroup *QAction::actionGroup() const it is displayed to the left of the menu text. There is no default icon. + On Symbian the icons which are passed to softkeys, i.e. to actions with + softkey role, need to have pixmap alpha channel correctly set otherwise + drawing artifacts will appear when softkey is pressed down. + If a null icon (QIcon::isNull() is passed into this function, the icon of the action is cleared. */ diff --git a/src/gui/kernel/qapplication_s60.cpp b/src/gui/kernel/qapplication_s60.cpp index 6e03d7c..4a137ee 100644 --- a/src/gui/kernel/qapplication_s60.cpp +++ b/src/gui/kernel/qapplication_s60.cpp @@ -924,8 +924,8 @@ void QSymbianControl::PositionChanged() cr.moveTopLeft(newPos); qwidget->data->crect = cr; QTLWExtra *top = qwidget->d_func()->maybeTopData(); - if (top) - top->normalGeometry = cr; + if (top && (qwidget->windowState() & (~Qt::WindowActive)) == Qt::WindowNoState) + top->normalGeometry.moveTopLeft(newPos); if (qwidget->isVisible()) { QMoveEvent e(newPos, oldPos); qt_sendSpontaneousEvent(qwidget, &e); @@ -960,15 +960,14 @@ void QSymbianControl::FocusChanged(TDrawNow /* aDrawNow */) qwidget->d_func()->setWindowIcon_sys(true); qwidget->d_func()->setWindowTitle_sys(qwidget->windowTitle()); #ifdef Q_WS_S60 - // If widget is fullscreen, hide status pane and button container - // otherwise show them. + // If widget is fullscreen/minimized, hide status pane and button container otherwise show them. CEikStatusPane* statusPane = S60->statusPane(); CEikButtonGroupContainer* buttonGroup = S60->buttonGroupContainer(); - bool isFullscreen = qwidget->windowState() & Qt::WindowFullScreen; - if (statusPane && (bool)statusPane->IsVisible() == isFullscreen) - statusPane->MakeVisible(!isFullscreen); - if (buttonGroup && (bool)buttonGroup->IsVisible() == isFullscreen) - buttonGroup->MakeVisible(!isFullscreen); + TBool visible = !(qwidget->windowState() & (Qt::WindowFullScreen | Qt::WindowMinimized)); + if (statusPane) + statusPane->MakeVisible(visible); + if (buttonGroup) + buttonGroup->MakeVisible(visible); #endif } else if (QApplication::activeWindow() == qwidget->window()) { if (CCoeEnv::Static()->AppUi()->IsDisplayingMenuOrDialog()) { diff --git a/src/gui/kernel/qsoftkeymanager_s60.cpp b/src/gui/kernel/qsoftkeymanager_s60.cpp index a72d16c..af84a8f 100644 --- a/src/gui/kernel/qsoftkeymanager_s60.cpp +++ b/src/gui/kernel/qsoftkeymanager_s60.cpp @@ -237,21 +237,18 @@ bool QSoftKeyManagerPrivateS60::setSoftkeyImage(CEikButtonGroupContainer *cba, // prepareSoftkeyPixmap creates a new pixmap with requiredIconSize and blits the 'pmWihtAspectRatio' // to correct location of it QPixmap softkeyPixmap = prepareSoftkeyPixmap(pmWihtAspectRatio, position, requiredIconSize); - QBitmap softkeyMask = softkeyPixmap.mask(); - if (softkeyMask.isNull()) { - softkeyMask = QBitmap(softkeyPixmap.size()); - softkeyMask.fill(Qt::color1); - } - // Softkey mask in > SV_S60_5_1 has to be inverted - if(QSysInfo::s60Version() > QSysInfo::SV_S60_5_1) { - QImage maskImage = softkeyMask.toImage(); - maskImage.invertPixels(); - softkeyMask = QPixmap::fromImage(maskImage); + QPixmap softkeyAlpha = softkeyPixmap.alphaChannel(); + // Alpha channel in 5.1 and older devices need to be inverted + // TODO: Switch to use toSymbianCFbsBitmap with invert when available + if(QSysInfo::s60Version() <= QSysInfo::SV_S60_5_1) { + QImage alphaImage = softkeyAlpha.toImage(); + alphaImage.invertPixels(); + softkeyAlpha = QPixmap::fromImage(alphaImage); } CFbsBitmap* nBitmap = softkeyPixmap.toSymbianCFbsBitmap(); - CFbsBitmap* nMask = softkeyMask.toSymbianCFbsBitmap(); + CFbsBitmap* nMask = softkeyAlpha.toSymbianCFbsBitmap(); CEikImage* myimage = new (ELeave) CEikImage; myimage->SetPicture( nBitmap, nMask ); // nBitmap and nMask ownership transfered diff --git a/src/gui/kernel/qwidget_s60.cpp b/src/gui/kernel/qwidget_s60.cpp index 0ce7534..a844430 100644 --- a/src/gui/kernel/qwidget_s60.cpp +++ b/src/gui/kernel/qwidget_s60.cpp @@ -1046,96 +1046,48 @@ void QWidget::setWindowState(Qt::WindowStates newstate) return; if (isWindow()) { -#ifdef Q_WS_S60 - // Change window decoration visibility if switching to or from fullsccreen - // In addition decoration visibility is changed when the initial has been - // WindowNoState. - // The window decoration visibility has to be changed before doing actual - // window state change since in that order the availableGeometry will return - // directly the right size and we will avoid unnecessarty redraws - if ((oldstate & Qt::WindowFullScreen) != (newstate & Qt::WindowFullScreen) || - oldstate == Qt::WindowNoState) { - CEikStatusPane* statusPane = S60->statusPane(); - CEikButtonGroupContainer* buttonGroup = S60->buttonGroupContainer(); - if (newstate & Qt::WindowFullScreen) { - if (statusPane) - statusPane->MakeVisible(false); - if (buttonGroup) - buttonGroup->MakeVisible(false); - } else { - if (statusPane) - statusPane->MakeVisible(true); - if (buttonGroup) - buttonGroup->MakeVisible(true); - } + QSymbianControl *window = static_cast<QSymbianControl *>(effectiveWinId()); + if (window && newstate & Qt::WindowMinimized) { + window->setFocusSafely(false); + window->MakeVisible(false); + } else if (window && oldstate & Qt::WindowMinimized) { + window->setFocusSafely(true); + window->MakeVisible(true); } + +#ifdef Q_WS_S60 + // Hide window decoration when switching to fullsccreen / minimized otherwise show decoration. + // The window decoration visibility has to be changed before doing actual window state + // change since in that order the availableGeometry will return directly the right size and + // we will avoid unnecessarty redraws + CEikStatusPane* statusPane = S60->statusPane(); + CEikButtonGroupContainer* buttonGroup = S60->buttonGroupContainer(); + TBool visible = !(newstate & (Qt::WindowFullScreen | Qt::WindowMinimized)); + if (statusPane) + statusPane->MakeVisible(visible); + if (buttonGroup) + buttonGroup->MakeVisible(visible); #endif // Q_WS_S60 createWinId(); Q_ASSERT(testAttribute(Qt::WA_WState_Created)); - QTLWExtra *top = d->topData(); - // Ensure the initial size is valid, since we store it as normalGeometry below. if (!testAttribute(Qt::WA_Resized) && !isVisible()) adjustSize(); - if ((oldstate & Qt::WindowMaximized) != (newstate & Qt::WindowMaximized)) { - if ((newstate & Qt::WindowMaximized)) { - const QRect normalGeometry = geometry(); + QTLWExtra *top = d->topData(); + const QRect normalGeometry = (top->normalGeometry.width() < 0) ? geometry() : top->normalGeometry; - const QRect r = top->normalGeometry; - setGeometry(qApp->desktop()->availableGeometry(this)); - top->normalGeometry = r; + if (newstate & Qt::WindowFullScreen) + setGeometry(qApp->desktop()->screenGeometry(this)); + else if (newstate & Qt::WindowMaximized) + setGeometry(qApp->desktop()->availableGeometry(this)); + else + setGeometry(normalGeometry); - if (top->normalGeometry.width() < 0) - top->normalGeometry = normalGeometry; - } else { - // restore original geometry - setGeometry(top->normalGeometry); - } - } - if ((oldstate & Qt::WindowFullScreen) != (newstate & Qt::WindowFullScreen)) { - if (newstate & Qt::WindowFullScreen) { - const QRect normalGeometry = geometry(); - const QRect r = top->normalGeometry; - setGeometry(qApp->desktop()->screenGeometry(this)); - - top->normalGeometry = r; - if (top->normalGeometry.width() < 0) - top->normalGeometry = normalGeometry; - } else { - if (newstate & Qt::WindowMaximized) { - const QRect r = top->normalGeometry; - setGeometry(qApp->desktop()->availableGeometry(this)); - top->normalGeometry = r; - } else { - setGeometry(top->normalGeometry); - } - } - } - if ((oldstate & Qt::WindowMinimized) != (newstate & Qt::WindowMinimized)) { - if (newstate & Qt::WindowMinimized) { - if (isVisible()) { - QSymbianControl *id = static_cast<QSymbianControl *>(effectiveWinId()); - if (id->IsFocused()) // Avoid unnecessary calls to FocusChanged() - id->setFocusSafely(false); - id->MakeVisible(false); - } - } else { - if (isVisible()) { - QSymbianControl *id = static_cast<QSymbianControl *>(effectiveWinId()); - id->MakeVisible(true); - if (!id->IsFocused()) // Avoid unnecessary calls to FocusChanged() - id->setFocusSafely(true); - } - const QRect normalGeometry = geometry(); - const QRect r = top->normalGeometry; - top->normalGeometry = r; - if (top->normalGeometry.width() < 0) - top->normalGeometry = normalGeometry; - } - } + //restore normal geometry + top->normalGeometry = normalGeometry; } data->window_state = newstate; diff --git a/src/gui/painting/qdrawhelper.cpp b/src/gui/painting/qdrawhelper.cpp index 194dda3..660a2a8 100644 --- a/src/gui/painting/qdrawhelper.cpp +++ b/src/gui/painting/qdrawhelper.cpp @@ -2408,7 +2408,11 @@ static inline int soft_light_op(int dst, int src, int da, int sa) else if (4 * dst <= da) return (dst * sa * 255 + da * (src2 - sa) * ((((16 * dst_np - 12 * 255) * dst_np + 3 * 65025) * dst_np) / 65025) + temp) / 65025; else { +# ifdef Q_CC_RVCT // needed to avoid compiler crash in RVCT 2.2 + return (dst * sa * 255 + da * (src2 - sa) * (qIntSqrtInt(dst_np * 255) - dst_np) + temp) / 65025; +# else return (dst * sa * 255 + da * (src2 - sa) * (int(sqrt(qreal(dst_np * 255))) - dst_np) + temp) / 65025; +# endif } } diff --git a/src/gui/painting/qmath_p.h b/src/gui/painting/qmath_p.h index cd9f5ea..8a5f5ab 100644 --- a/src/gui/painting/qmath_p.h +++ b/src/gui/painting/qmath_p.h @@ -54,6 +54,7 @@ // #include <math.h> +#include <qmath.h> QT_BEGIN_NAMESPACE @@ -61,6 +62,11 @@ static const qreal Q_PI = qreal(3.14159265358979323846); // pi static const qreal Q_2PI = qreal(6.28318530717958647693); // 2*pi static const qreal Q_PI2 = qreal(1.57079632679489661923); // pi/2 +inline int qIntSqrtInt(int v) +{ + return static_cast<int>(qSqrt(static_cast<qreal>(v))); +} + QT_END_NAMESPACE #endif // QMATH_P_H diff --git a/src/gui/text/qfontdatabase_s60.cpp b/src/gui/text/qfontdatabase_s60.cpp index f8de08f..7e5397d 100644 --- a/src/gui/text/qfontdatabase_s60.cpp +++ b/src/gui/text/qfontdatabase_s60.cpp @@ -246,8 +246,8 @@ static void initializeDb() QSymbianFbsHeapLock lock(QSymbianFbsHeapLock::Unlock); const int numTypeFaces = QS60Data::screenDevice()->NumTypefaces(); - const QFontDatabaseS60StoreImplementation *store = dynamic_cast<const QFontDatabaseS60StoreImplementation*>(db->s60Store); - Q_ASSERT(store); + const QFontDatabaseS60StoreImplementation *store = + static_cast<const QFontDatabaseS60StoreImplementation*>(db->s60Store); bool fontAdded = false; for (int i = 0; i < numTypeFaces; i++) { TTypefaceSupport typefaceSupport; @@ -258,8 +258,7 @@ static void initializeDb() continue; if (font->TypeUid() == KCFbsFontUid) { TOpenFontFaceAttrib faceAttrib; - const CFbsFont *cfbsFont = dynamic_cast<const CFbsFont *>(font); - Q_ASSERT(cfbsFont); + const CFbsFont *cfbsFont = static_cast<const CFbsFont *>(font); cfbsFont->GetFaceAttrib(faceAttrib); QtFontStyle::Key styleKey; @@ -390,8 +389,8 @@ QFontEngine *QFontDatabase::findFont(int script, const QFontPrivate *, const QFo QFontDef request = req; request.family = fontFamily; #if defined(QT_NO_FREETYPE) - const QFontDatabaseS60StoreImplementation *store = dynamic_cast<const QFontDatabaseS60StoreImplementation*>(db->s60Store); - Q_ASSERT(store); + const QFontDatabaseS60StoreImplementation *store = + static_cast<const QFontDatabaseS60StoreImplementation*>(db->s60Store); const QFontEngineS60Extensions *extension = store->extension(fontFamily); fe = new QFontEngineS60(request, extension); #else diff --git a/tests/auto/qwidget/tst_qwidget.cpp b/tests/auto/qwidget/tst_qwidget.cpp index 1fb323e..03eddee 100644 --- a/tests/auto/qwidget/tst_qwidget.cpp +++ b/tests/auto/qwidget/tst_qwidget.cpp @@ -391,6 +391,10 @@ private slots: #ifdef Q_OS_SYMBIAN void cbaVisibility(); + void fullScreenWindowModeTransitions(); + void maximizedWindowModeTransitions(); + void minimizedWindowModeTransitions(); + void normalWindowModeTransitions(); #endif void focusProxyAndInputMethods(); @@ -9689,6 +9693,226 @@ void tst_QWidget::cbaVisibility() CEikButtonGroupContainer* buttonGroup = CEikonEnv::Static()->AppUiFactory()->Cba(); QVERIFY(buttonGroup->IsVisible()); } + +void tst_QWidget::fullScreenWindowModeTransitions() +{ + QWidget widget; + QVBoxLayout *layout = new QVBoxLayout; + QPushButton *button = new QPushButton("test Button"); + layout->addWidget(button); + widget.setLayout(layout); + widget.show(); + + const QRect normalGeometry = widget.normalGeometry(); + const QRect fullScreenGeometry = qApp->desktop()->screenGeometry(&widget); + const QRect maximumScreenGeometry = qApp->desktop()->availableGeometry(&widget); + CEikStatusPane *statusPane = CEikonEnv::Static()->AppUiFactory()->StatusPane(); + CEikButtonGroupContainer *buttonGroup = CEikonEnv::Static()->AppUiFactory()->Cba(); + + //Enter + widget.showNormal(); + widget.showFullScreen(); + QCOMPARE(widget.geometry(), fullScreenGeometry); + QVERIFY(!buttonGroup->IsVisible()); + QVERIFY(!statusPane->IsVisible()); + + widget.showMaximized(); + widget.showFullScreen(); + QCOMPARE(widget.geometry(), fullScreenGeometry); + QVERIFY(!buttonGroup->IsVisible()); + QVERIFY(!statusPane->IsVisible()); + + widget.showMinimized(); + widget.showFullScreen(); + QCOMPARE(widget.geometry(), fullScreenGeometry); + QVERIFY(!buttonGroup->IsVisible()); + QVERIFY(!statusPane->IsVisible()); + + //Exit + widget.showFullScreen(); + widget.showNormal(); + QCOMPARE(widget.geometry(), normalGeometry); + QVERIFY(buttonGroup->IsVisible()); + QVERIFY(statusPane->IsVisible()); + + widget.showFullScreen(); + widget.showMaximized(); + QCOMPARE(widget.geometry(), maximumScreenGeometry); + QVERIFY(buttonGroup->IsVisible()); + QVERIFY(statusPane->IsVisible()); + + widget.showFullScreen(); + widget.showMinimized(); + QCOMPARE(widget.geometry(), fullScreenGeometry); + QVERIFY(!buttonGroup->IsVisible()); + QVERIFY(!statusPane->IsVisible()); +} + +void tst_QWidget::maximizedWindowModeTransitions() +{ + QWidget widget; + QVBoxLayout *layout = new QVBoxLayout; + QPushButton *button = new QPushButton("test Button"); + layout->addWidget(button); + widget.setLayout(layout); + widget.show(); + + const QRect normalGeometry = widget.normalGeometry(); + const QRect fullScreenGeometry = qApp->desktop()->screenGeometry(&widget); + const QRect maximumScreenGeometry = qApp->desktop()->availableGeometry(&widget); + CEikStatusPane *statusPane = CEikonEnv::Static()->AppUiFactory()->StatusPane(); + CEikButtonGroupContainer *buttonGroup = CEikonEnv::Static()->AppUiFactory()->Cba(); + + //Enter + widget.showNormal(); + widget.showMaximized(); + QCOMPARE(widget.geometry(), maximumScreenGeometry); + QVERIFY(buttonGroup->IsVisible()); + QVERIFY(statusPane->IsVisible()); + + widget.showFullScreen(); + widget.showMaximized(); + QCOMPARE(widget.geometry(), maximumScreenGeometry); + QVERIFY(buttonGroup->IsVisible()); + QVERIFY(statusPane->IsVisible()); + + widget.showMinimized(); + widget.showMaximized(); + QCOMPARE(widget.geometry(), maximumScreenGeometry); + QVERIFY(buttonGroup->IsVisible()); + QVERIFY(statusPane->IsVisible()); + + //Exit + widget.showMaximized(); + widget.showNormal(); + QCOMPARE(widget.geometry(), normalGeometry); + QVERIFY(buttonGroup->IsVisible()); + QVERIFY(statusPane->IsVisible()); + + widget.showMaximized(); + widget.showFullScreen(); + QCOMPARE(widget.geometry(), fullScreenGeometry); + QVERIFY(!buttonGroup->IsVisible()); + QVERIFY(!statusPane->IsVisible()); + + widget.showMaximized(); + widget.showMinimized(); + // Since showMinimized hides window decoration availableGeometry gives different value + // than with decoration visible. Altual size does not really matter since widget is invisible. + QCOMPARE(widget.geometry(), qApp->desktop()->availableGeometry(&widget)); + QVERIFY(!buttonGroup->IsVisible()); + QVERIFY(!statusPane->IsVisible()); +} + +void tst_QWidget::minimizedWindowModeTransitions() +{ + QWidget widget; + QVBoxLayout *layout = new QVBoxLayout; + QPushButton *button = new QPushButton("test Button"); + layout->addWidget(button); + widget.setLayout(layout); + widget.show(); + + const QRect normalGeometry = widget.normalGeometry(); + const QRect fullScreenGeometry = qApp->desktop()->screenGeometry(&widget); + const QRect maximumScreenGeometry = qApp->desktop()->availableGeometry(&widget); + CEikStatusPane *statusPane = CEikonEnv::Static()->AppUiFactory()->StatusPane(); + CEikButtonGroupContainer *buttonGroup = CEikonEnv::Static()->AppUiFactory()->Cba(); + + //Enter + widget.showNormal(); + widget.showMinimized(); + QCOMPARE(widget.geometry(), normalGeometry); + QVERIFY(!buttonGroup->IsVisible()); + QVERIFY(!statusPane->IsVisible()); + + widget.showFullScreen(); + widget.showMinimized(); + QCOMPARE(widget.geometry(), fullScreenGeometry); + QVERIFY(!buttonGroup->IsVisible()); + QVERIFY(!statusPane->IsVisible()); + + widget.showMaximized(); + widget.showMinimized(); + // Since showMinimized hides window decoration availableGeometry gives different value + // than with decoration visible. Altual size does not really matter since widget is invisible. + QCOMPARE(widget.geometry(), qApp->desktop()->availableGeometry(&widget)); + QVERIFY(!buttonGroup->IsVisible()); + QVERIFY(!statusPane->IsVisible()); + + //Exit + widget.showMinimized(); + widget.showNormal(); + QCOMPARE(widget.geometry(), normalGeometry); + QVERIFY(buttonGroup->IsVisible()); + QVERIFY(statusPane->IsVisible()); + + widget.showMinimized(); + widget.showFullScreen(); + QCOMPARE(widget.geometry(), fullScreenGeometry); + QVERIFY(!buttonGroup->IsVisible()); + QVERIFY(!statusPane->IsVisible()); + + widget.showMinimized(); + widget.showMaximized(); + QCOMPARE(widget.geometry(), maximumScreenGeometry); + QVERIFY(buttonGroup->IsVisible()); + QVERIFY(statusPane->IsVisible()); +} + +void tst_QWidget::normalWindowModeTransitions() +{ + QWidget widget; + QVBoxLayout *layout = new QVBoxLayout; + QPushButton *button = new QPushButton("test Button"); + layout->addWidget(button); + widget.setLayout(layout); + widget.show(); + + const QRect normalGeometry = widget.normalGeometry(); + const QRect fullScreenGeometry = qApp->desktop()->screenGeometry(&widget); + const QRect maximumScreenGeometry = qApp->desktop()->availableGeometry(&widget); + CEikStatusPane *statusPane = CEikonEnv::Static()->AppUiFactory()->StatusPane(); + CEikButtonGroupContainer *buttonGroup = CEikonEnv::Static()->AppUiFactory()->Cba(); + + //Enter + widget.showMaximized(); + widget.showNormal(); + QCOMPARE(widget.geometry(), normalGeometry); + QVERIFY(buttonGroup->IsVisible()); + QVERIFY(statusPane->IsVisible()); + + widget.showFullScreen(); + widget.showNormal(); + QCOMPARE(widget.geometry(), normalGeometry); + QVERIFY(buttonGroup->IsVisible()); + QVERIFY(statusPane->IsVisible()); + + widget.showMinimized(); + widget.showNormal(); + QCOMPARE(widget.geometry(), normalGeometry); + QVERIFY(buttonGroup->IsVisible()); + QVERIFY(statusPane->IsVisible()); + + //Exit + widget.showNormal(); + widget.showMaximized(); + QCOMPARE(widget.geometry(), maximumScreenGeometry); + QVERIFY(buttonGroup->IsVisible()); + QVERIFY(statusPane->IsVisible()); + + widget.showNormal(); + widget.showFullScreen(); + QCOMPARE(widget.geometry(), fullScreenGeometry); + QVERIFY(!buttonGroup->IsVisible()); + QVERIFY(!statusPane->IsVisible()); + + widget.showNormal(); + widget.showMinimized(); + QCOMPARE(widget.geometry(), normalGeometry); + QVERIFY(!buttonGroup->IsVisible()); + QVERIFY(!statusPane->IsVisible()); +} #endif class InputContextTester : public QInputContext |