summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorTasuku Suzuki <tasuku.suzuki@nokia.com>2010-04-12 11:30:04 (GMT)
committerThierry Bastian <thierry.bastian@nokia.com>2010-04-12 11:30:04 (GMT)
commitc4c8f9cbad91222364f5262753c6d0dbb931a57a (patch)
tree0b24aa242c8795e3c446e1c30fdaa79d55958747
parent787f713f87b365d8385af97073540c7ee565fde0 (diff)
downloadQt-c4c8f9cbad91222364f5262753c6d0dbb931a57a.zip
Qt-c4c8f9cbad91222364f5262753c6d0dbb931a57a.tar.gz
Qt-c4c8f9cbad91222364f5262753c6d0dbb931a57a.tar.bz2
Fix compile error with QT_NO_ACTION in QtGui
Merge-request: 2321 Reviewed-by: Thierry Bastian <thierry.bastian@nokia.com>
-rw-r--r--src/gui/widgets/qdialogbuttonbox.cpp15
-rw-r--r--tests/auto/qdialogbuttonbox/tst_qdialogbuttonbox.cpp12
2 files changed, 20 insertions, 7 deletions
diff --git a/src/gui/widgets/qdialogbuttonbox.cpp b/src/gui/widgets/qdialogbuttonbox.cpp
index cc74a53..732dbc9 100644
--- a/src/gui/widgets/qdialogbuttonbox.cpp
+++ b/src/gui/widgets/qdialogbuttonbox.cpp
@@ -258,6 +258,7 @@ static const int layouts[2][5][14] =
}
};
+#if defined(QT_SOFTKEYS_ENABLED) && !defined(QT_NO_ACTION)
class QDialogButtonEnabledProxy : public QObject
{
public:
@@ -281,7 +282,7 @@ private:
QWidget *source;
QAction *target;
};
-
+#endif
class QDialogButtonBoxPrivate : public QWidgetPrivate
{
@@ -314,7 +315,7 @@ public:
void addButtonsToLayout(const QList<QAbstractButton *> &buttonList, bool reverse);
void retranslateStrings();
const char *standardButtonText(QDialogButtonBox::StandardButton sbutton) const;
-#ifdef QT_SOFTKEYS_ENABLED
+#if defined(QT_SOFTKEYS_ENABLED) && !defined(QT_NO_ACTION)
QAction *createSoftKey(QAbstractButton *button, QDialogButtonBox::ButtonRole role);
#endif
};
@@ -571,7 +572,7 @@ void QDialogButtonBoxPrivate::addButton(QAbstractButton *button, QDialogButtonBo
QObject::connect(button, SIGNAL(clicked()), q, SLOT(_q_handleButtonClicked()));
QObject::connect(button, SIGNAL(destroyed()), q, SLOT(_q_handleButtonDestroyed()));
buttonLists[role].append(button);
-#ifdef QT_SOFTKEYS_ENABLED
+#if defined(QT_SOFTKEYS_ENABLED) && !defined(QT_NO_ACTION)
QAction *action = createSoftKey(button, role);
softKeyActions.insert(button, action);
new QDialogButtonEnabledProxy(action, button, action);
@@ -580,7 +581,7 @@ void QDialogButtonBoxPrivate::addButton(QAbstractButton *button, QDialogButtonBo
layoutButtons();
}
-#ifdef QT_SOFTKEYS_ENABLED
+#if defined(QT_SOFTKEYS_ENABLED) && !defined(QT_NO_ACTION)
QAction* QDialogButtonBoxPrivate::createSoftKey(QAbstractButton *button, QDialogButtonBox::ButtonRole role)
{
Q_Q(QDialogButtonBox);
@@ -718,7 +719,7 @@ void QDialogButtonBoxPrivate::retranslateStrings()
if (buttonText) {
QPushButton *button = it.key();
button->setText(QDialogButtonBox::tr(buttonText));
-#ifdef QT_SOFTKEYS_ENABLED
+#if defined(QT_SOFTKEYS_ENABLED) && !defined(QT_NO_ACTION)
QAction *action = softKeyActions.value(button, 0);
if (action)
action->setText(button->text());
@@ -997,7 +998,7 @@ void QDialogButtonBox::removeButton(QAbstractButton *button)
}
}
}
-#ifdef QT_SOFTKEYS_ENABLED
+#if defined(QT_SOFTKEYS_ENABLED) && !defined(QT_NO_ACTION)
QAction *action = d->softKeyActions.value(button, 0);
if (action) {
d->softKeyActions.remove(button);
@@ -1243,7 +1244,7 @@ bool QDialogButtonBox::event(QEvent *event)
}else if (event->type() == QEvent::LanguageChange) {
d->retranslateStrings();
}
-#ifdef QT_SOFTKEYS_ENABLED
+#if defined(QT_SOFTKEYS_ENABLED) && !defined(QT_NO_ACTION)
else if (event->type() == QEvent::ParentChange) {
QWidget *dialog = 0;
QWidget *p = this;
diff --git a/tests/auto/qdialogbuttonbox/tst_qdialogbuttonbox.cpp b/tests/auto/qdialogbuttonbox/tst_qdialogbuttonbox.cpp
index bf4ea5f..195f8b6 100644
--- a/tests/auto/qdialogbuttonbox/tst_qdialogbuttonbox.cpp
+++ b/tests/auto/qdialogbuttonbox/tst_qdialogbuttonbox.cpp
@@ -721,11 +721,13 @@ void tst_QDialogButtonBox::testDefaultButton_data()
static int softKeyCount(QWidget *widget)
{
int softkeyCount = 0;
+#ifndef QT_NO_ACTION
QList<QAction *> actions = widget->actions();
foreach (QAction *action, actions) {
if (action->softKeyRole() != QAction::NoSoftKey)
softkeyCount++;
}
+#endif
return softkeyCount;
}
@@ -737,14 +739,18 @@ void tst_QDialogButtonBox::testS60SoftKeys()
buttonBox.setStandardButtons(QDialogButtonBox::Ok | QDialogButtonBox::Cancel);
dialog.show();
+#ifndef QT_NO_ACTION
QCOMPARE( softKeyCount(&dialog), 2);
+#endif
QDialog dialog2(0);
QDialogButtonBox buttonBox2(&dialog2);
buttonBox2.setStandardButtons(QDialogButtonBox::Cancel);
dialog2.show();
+#ifndef QT_NO_ACTION
QCOMPARE( softKeyCount(&dialog2), 1);
+#endif
#else
QSKIP("S60-specific test", SkipAll );
@@ -759,21 +765,27 @@ void tst_QDialogButtonBox::testSoftKeyReparenting()
buttonBox->addButton(QDialogButtonBox::Ok);
buttonBox->addButton(QDialogButtonBox::Cancel);
+#ifndef QT_NO_ACTION
QCOMPARE(softKeyCount(&dialog), 0);
QCOMPARE(softKeyCount(buttonBox), 2);
+#endif
// Were the softkeys re-parented correctly?
dialog.setLayout(new QVBoxLayout);
dialog.layout()->addWidget(buttonBox);
+#ifndef QT_NO_ACTION
QCOMPARE(softKeyCount(&dialog), 2);
QCOMPARE(softKeyCount(buttonBox), 0);
+#endif
// Softkeys are only added to QDialog, not QWidget
QWidget *nested = new QWidget;
nested->setLayout(new QVBoxLayout);
nested->layout()->addWidget(buttonBox);
+#ifndef QT_NO_ACTION
QCOMPARE(softKeyCount(nested), 0);
QCOMPARE(softKeyCount(buttonBox), 2);
+#endif
}
#endif