summaryrefslogtreecommitdiffstats
path: root/src/gui/widgets/qmainwindow.cpp
diff options
context:
space:
mode:
authorMarkku Luukkainen <markku.luukkainen@digia.com>2009-05-13 14:25:24 (GMT)
committerMarkku Luukkainen <markku.luukkainen@digia.com>2009-05-13 14:25:24 (GMT)
commita28a4bccad5d885bf3ac5f58a8febb8d59fffe0f (patch)
tree31521af622429d7e5ee3e1ed8ed5ab8dc37a8534 /src/gui/widgets/qmainwindow.cpp
parentaf612206adc919e3c13b7856f9f7c020ef9c3a7b (diff)
downloadQt-a28a4bccad5d885bf3ac5f58a8febb8d59fffe0f.zip
Qt-a28a4bccad5d885bf3ac5f58a8febb8d59fffe0f.tar.gz
Qt-a28a4bccad5d885bf3ac5f58a8febb8d59fffe0f.tar.bz2
Added Methods to set and access QSoftKeyStack from QMainWindow.
Diffstat (limited to 'src/gui/widgets/qmainwindow.cpp')
-rw-r--r--src/gui/widgets/qmainwindow.cpp47
1 files changed, 47 insertions, 0 deletions
diff --git a/src/gui/widgets/qmainwindow.cpp b/src/gui/widgets/qmainwindow.cpp
index 502c1e9..43bc098 100644
--- a/src/gui/widgets/qmainwindow.cpp
+++ b/src/gui/widgets/qmainwindow.cpp
@@ -66,6 +66,10 @@ extern OSWindowRef qt_mac_window_for(const QWidget *); // qwidget_mac.cpp
QT_END_NAMESPACE
#endif
+#ifndef QT_NO_SOFTKEYSTACK
+#include <QSoftKeyStack.h>
+#endif
+
QT_BEGIN_NAMESPACE
class QMainWindowPrivate : public QWidgetPrivate
@@ -80,6 +84,9 @@ public:
#if !defined(QT_NO_DOCKWIDGET) && !defined(QT_NO_CURSOR)
, hasOldCursor(false) , cursorAdjusted(false)
#endif
+#ifndef QT_NO_SOFTKEYSTACK
+ , softKeyStack(0)
+#endif
{ }
QMainWindowLayout *layout;
QSize iconSize;
@@ -99,6 +106,10 @@ public:
uint hasOldCursor : 1;
uint cursorAdjusted : 1;
#endif
+
+#ifndef QT_NO_SOFTKEYSTACK
+ QSoftKeyStack* softKeyStack;
+#endif
};
void QMainWindowPrivate::init()
@@ -514,6 +525,42 @@ void QMainWindow::setMenuWidget(QWidget *menuBar)
}
#endif // QT_NO_MENUBAR
+#ifndef QT_NO_SOFTKEYSTACK
+/*!
+ Returns the softkey stack for the main window. This function creates
+ and returns an empty soft key stack if the stack does not exist.
+
+ \sa softKeyStack()
+*/
+QSoftKeyStack *QMainWindow::softKeyStack() const
+{
+ if (!d_func()->softKeyStack) {
+ QMainWindow *self = const_cast<QMainWindow *>(this);
+ QSoftKeyStack* softKeyStack = new QSoftKeyStack(self);
+ self->setSoftKeyStack(softKeyStack);
+ }
+ return d_func()->softKeyStack;
+}
+
+/*!
+ Sets the softkey stackfor the main window to \a softKeyStack.
+
+ Note: QMainWindow takes ownership of the \a softKeyStack pointer and
+ deletes it at the appropriate time.
+
+ \sa softKeyStack()
+*/
+void QMainWindow::setSoftKeyStack(QSoftKeyStack *softKeyStack)
+{
+ Q_D(QMainWindow);
+ if (d->softKeyStack && d->softKeyStack != softKeyStack) {
+ QSoftKeyStack *oldSoftKeyStack = d->softKeyStack;
+ delete oldSoftKeyStack;
+ }
+ d->softKeyStack = softKeyStack;
+}
+#endif // QT_NO_SOFTKEYSTACK
+
#ifndef QT_NO_STATUSBAR
/*!
Returns the status bar for the main window. This function creates