summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorDavid Boddie <dboddie@trolltech.com>2009-11-24 15:23:16 (GMT)
committerDavid Boddie <dboddie@trolltech.com>2009-11-24 15:23:16 (GMT)
commit8534bf99bb644c6ef410415333b479967155c829 (patch)
tree3fc0e267c403c8eebed3d4ece7fec5f6575432fb
parent97aa8ad5ec6b5d23ad023518db92fa91d5fa7fe0 (diff)
parenta0c8e134a284d45520dd3a229e68dbcd155299e6 (diff)
downloadQt-8534bf99bb644c6ef410415333b479967155c829.zip
Qt-8534bf99bb644c6ef410415333b479967155c829.tar.gz
Qt-8534bf99bb644c6ef410415333b479967155c829.tar.bz2
Merge branch '4.6' of git@scm.dev.nokia.troll.no:qt/qt into 4.6
-rw-r--r--doc/src/getting-started/installation.qdoc7
-rw-r--r--doc/src/snippets/code/doc_src_installation.qdoc4
-rw-r--r--src/gui/widgets/qdialogbuttonbox.cpp24
-rw-r--r--src/gui/widgets/qmdiarea.cpp6
-rw-r--r--tests/auto/qdialogbuttonbox/tst_qdialogbuttonbox.cpp60
5 files changed, 83 insertions, 18 deletions
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]
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<QDialog *>(p)))
+ break;
+ }
+
+ // If the parent changes, then move the softkeys
+ for (QHash<QAbstractButton *, QAction *>::const_iterator it = d->softKeyActions.constBegin();
+ it != d->softKeyActions.constEnd(); ++it) {
+ QAction *current = it.value();
+ QList<QWidget *> 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/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()
*/
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<QAction *> 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<QAction *> 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<QAction *> 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);