From d79d756d057f20ecc1a6e70a00fe792c2a1f95c8 Mon Sep 17 00:00:00 2001 From: Dean Dettman Date: Tue, 24 Nov 2009 14:25:41 +0100 Subject: Docs : Add details to QMdiArea::removeSubWindow() Clarifying that the behaviour is different depending on what is passed in. Reviewed-by: Morten Engvoldsen --- src/gui/widgets/qmdiarea.cpp | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/src/gui/widgets/qmdiarea.cpp b/src/gui/widgets/qmdiarea.cpp index b3288c3..f3dbe34 100644 --- a/src/gui/widgets/qmdiarea.cpp +++ b/src/gui/widgets/qmdiarea.cpp @@ -1947,8 +1947,10 @@ QMdiSubWindow *QMdiArea::addSubWindow(QWidget *widget, Qt::WindowFlags windowFla /*! Removes \a widget from the MDI area. The \a widget must be either a QMdiSubWindow or a widget that is the internal widget of - a subwindow. Note that the subwindow is not deleted by QMdiArea - and that its parent is set to 0. + a subwindow. Note \a widget is never actually deleted by QMdiArea. + If a QMdiSubWindow is passed in its parent is set to 0 and it is + removed, but if an internal widget is passed in the child widget + is set to 0 but the QMdiSubWindow is not removed. \sa addSubWindow() */ -- cgit v0.12 From 4817debee23a72f44eedbb8f33b6b611b5161174 Mon Sep 17 00:00:00 2001 From: axis Date: Tue, 24 Nov 2009 14:36:08 +0100 Subject: Added some missing build instructions for abld. WebKit will not build unless the mentioned variable is set. RevBy: Aleksandar Sasha Babic --- doc/src/getting-started/installation.qdoc | 7 +++++++ doc/src/snippets/code/doc_src_installation.qdoc | 4 ++++ 2 files changed, 11 insertions(+) diff --git a/doc/src/getting-started/installation.qdoc b/doc/src/getting-started/installation.qdoc index 1a5cd99..057629d 100644 --- a/doc/src/getting-started/installation.qdoc +++ b/doc/src/getting-started/installation.qdoc @@ -599,6 +599,13 @@ If you are using pre-built binaries, follow the instructions given in the emulator. This is done by locating the Carbide.c++ submenu on the Start menu, and choosing "Configure environment for WINSCW command line". + If you are planning to use abld (the default build system that comes with the S60 SDK) + to build Qt, you will also need to set the following environment variable: + + \snippet doc/src/snippets/code/doc_src_installation.qdoc 33 + + This is not necessary for other applications, only when building Qt. + \o Configure Qt To configure Qt for the Symbian platform, do: diff --git a/doc/src/snippets/code/doc_src_installation.qdoc b/doc/src/snippets/code/doc_src_installation.qdoc index 3563a64..50e29d0 100644 --- a/doc/src/snippets/code/doc_src_installation.qdoc +++ b/doc/src/snippets/code/doc_src_installation.qdoc @@ -216,3 +216,7 @@ bldmake bldfiles abld build winscw udeb abld build gcce urel //! [32] + +//! [33] +SYMBIANBUILD_DEPENDENCYOFF=1 +//! [33] -- cgit v0.12 From a0c8e134a284d45520dd3a229e68dbcd155299e6 Mon Sep 17 00:00:00 2001 From: Jason Barron Date: Tue, 24 Nov 2009 15:52:38 +0100 Subject: Fix softkeys for QDialogButtonBoxes created without a parent. Inthe case where a QDialogButtonBox was created without a parent, for example in the FTP example, the softkeys that are automatically created inside the button box were not being added to the right widget when the button box was given a parent (or added to a layout) later. This patch resolves that issue by handling the ParentChange event and then adding the softkeys at this point. Task-number: QTBUG-6086 Reviewed-by: axis --- src/gui/widgets/qdialogbuttonbox.cpp | 24 +++++++++ .../auto/qdialogbuttonbox/tst_qdialogbuttonbox.cpp | 60 ++++++++++++++++------ 2 files changed, 68 insertions(+), 16 deletions(-) diff --git a/src/gui/widgets/qdialogbuttonbox.cpp b/src/gui/widgets/qdialogbuttonbox.cpp index 2ee5751..0e859f1 100644 --- a/src/gui/widgets/qdialogbuttonbox.cpp +++ b/src/gui/widgets/qdialogbuttonbox.cpp @@ -1215,6 +1215,30 @@ bool QDialogButtonBox::event(QEvent *event) }else if (event->type() == QEvent::LanguageChange) { d->retranslateStrings(); } +#ifdef QT_SOFTKEYS_ENABLED + else if (event->type() == QEvent::ParentChange) { + QWidget *dialog = 0; + QWidget *p = this; + while (p && !p->isWindow()) { + p = p->parentWidget(); + if ((dialog = qobject_cast(p))) + break; + } + + // If the parent changes, then move the softkeys + for (QHash::const_iterator it = d->softKeyActions.constBegin(); + it != d->softKeyActions.constEnd(); ++it) { + QAction *current = it.value(); + QList widgets = current->associatedWidgets(); + foreach (QWidget *w, widgets) + w->removeAction(current); + if (dialog) + dialog->addAction(current); + else + addAction(current); + } + } +#endif return QWidget::event(event); } diff --git a/tests/auto/qdialogbuttonbox/tst_qdialogbuttonbox.cpp b/tests/auto/qdialogbuttonbox/tst_qdialogbuttonbox.cpp index 936ebf7..2c49fc8 100644 --- a/tests/auto/qdialogbuttonbox/tst_qdialogbuttonbox.cpp +++ b/tests/auto/qdialogbuttonbox/tst_qdialogbuttonbox.cpp @@ -111,6 +111,9 @@ private slots: void testDefaultButton_data(); void testDefaultButton(); void testS60SoftKeys(); +#ifdef QT_SOFTKEYS_ENABLED + void testSoftKeyReparenting(); +#endif void task191642_default(); private: @@ -715,6 +718,17 @@ void tst_QDialogButtonBox::testDefaultButton_data() QTest::newRow("third accept explicit after add") << 0 << 2 << 2; } +static int softKeyCount(QWidget *widget) +{ + int softkeyCount = 0; + QList actions = widget->actions(); + foreach (QAction *action, actions) { + if (action->softKeyRole() != QAction::NoSoftKey) + softkeyCount++; + } + return softkeyCount; +} + void tst_QDialogButtonBox::testS60SoftKeys() { #ifdef Q_WS_S60 @@ -722,33 +736,47 @@ void tst_QDialogButtonBox::testS60SoftKeys() QDialogButtonBox buttonBox(&dialog); buttonBox.setStandardButtons(QDialogButtonBox::Ok | QDialogButtonBox::Cancel); dialog.show(); - - int softkeyCount = 0; - QList actions = dialog.actions(); - foreach (QAction *action, actions) { - if (action->softKeyRole() != QAction::NoSoftKey) - softkeyCount++; - } - QCOMPARE( softkeyCount, 2); + + QCOMPARE( softKeyCount(&dialog), 2); QDialog dialog2(0); QDialogButtonBox buttonBox2(&dialog2); buttonBox2.setStandardButtons(QDialogButtonBox::Cancel); dialog2.show(); - int softkeyCount2 = 0; - QList actions2 = dialog2.actions(); - foreach (QAction *action, actions2) { - if (action->softKeyRole() != QAction::NoSoftKey) - softkeyCount2++; - } - QCOMPARE( softkeyCount2, 1); - + QCOMPARE( softKeyCount(&dialog2), 1); + #else QSKIP("S60-specific test", SkipAll ); #endif } +#ifdef QT_SOFTKEYS_ENABLED +void tst_QDialogButtonBox::testSoftKeyReparenting() +{ + QDialog dialog; + QDialogButtonBox *buttonBox = new QDialogButtonBox; + buttonBox->addButton(QDialogButtonBox::Ok); + buttonBox->addButton(QDialogButtonBox::Cancel); + + QCOMPARE(softKeyCount(&dialog), 0); + QCOMPARE(softKeyCount(buttonBox), 2); + + // Were the softkeys re-parented correctly? + dialog.setLayout(new QVBoxLayout); + dialog.layout()->addWidget(buttonBox); + QCOMPARE(softKeyCount(&dialog), 2); + QCOMPARE(softKeyCount(buttonBox), 0); + + // Softkeys are only added to QDialog, not QWidget + QWidget *nested = new QWidget; + nested->setLayout(new QVBoxLayout); + nested->layout()->addWidget(buttonBox); + QCOMPARE(softKeyCount(nested), 0); + QCOMPARE(softKeyCount(buttonBox), 2); +} +#endif + void tst_QDialogButtonBox::testDefaultButton() { QFETCH(int, whenToSetDefault); -- cgit v0.12