diff options
author | Markku Luukkainen <markku.luukkainen@digia.com> | 2009-05-27 08:43:32 (GMT) |
---|---|---|
committer | Markku Luukkainen <markku.luukkainen@digia.com> | 2009-05-27 08:43:32 (GMT) |
commit | 5e38702684529cf7c3d1ab8ac6cd14900ca20b89 (patch) | |
tree | 18803707f4f7f285342a84399abb5ef55341e018 | |
parent | 9d5308b95bed09e72203eb53ced1a57c21744c71 (diff) | |
download | Qt-5e38702684529cf7c3d1ab8ac6cd14900ca20b89.zip Qt-5e38702684529cf7c3d1ab8ac6cd14900ca20b89.tar.gz Qt-5e38702684529cf7c3d1ab8ac6cd14900ca20b89.tar.bz2 |
Added method bool hasSoftKeyStack() so that user can check if
QMainWindow has a softkeystack or not.
Making method QSoftKeyStack *softKeyStack() const return 0 when
there is no softkeystack was also evaluated. Returning 0 was discarded
as it would make softKeyStack() behave differently than statusBar() and
menuBar() methods. It would be bad API design to have methods
in same class behave differently.
-rw-r--r-- | src/gui/widgets/qmainwindow.cpp | 15 | ||||
-rw-r--r-- | src/gui/widgets/qmainwindow.h | 1 |
2 files changed, 15 insertions, 1 deletions
diff --git a/src/gui/widgets/qmainwindow.cpp b/src/gui/widgets/qmainwindow.cpp index e12b879..618023e 100644 --- a/src/gui/widgets/qmainwindow.cpp +++ b/src/gui/widgets/qmainwindow.cpp @@ -543,7 +543,7 @@ QSoftKeyStack *QMainWindow::softKeyStack() const } /*! - Sets the softkey stackfor the main window to \a softKeyStack. + Sets the softkey stack for the main window to \a softKeyStack. Note: QMainWindow takes ownership of the \a softKeyStack pointer and deletes it at the appropriate time. @@ -559,6 +559,19 @@ void QMainWindow::setSoftKeyStack(QSoftKeyStack *softKeyStack) } d->softKeyStack = softKeyStack; } + +/*! + Returns true if QMainWindow has a softkeystack and false otherwise + + \sa softKeyStack() +*/ +bool QMainWindow::hasSoftKeyStack() +{ + Q_D(QMainWindow); + if (d->softKeyStack ) + return true; + return false; +} #endif // QT_NO_SOFTKEYSTACK #ifndef QT_NO_STATUSBAR diff --git a/src/gui/widgets/qmainwindow.h b/src/gui/widgets/qmainwindow.h index e2dcd5e..01b275e 100644 --- a/src/gui/widgets/qmainwindow.h +++ b/src/gui/widgets/qmainwindow.h @@ -135,6 +135,7 @@ public: #ifndef QT_NO_SOFTKEYSTACK QSoftKeyStack *softKeyStack() const; void setSoftKeyStack(QSoftKeyStack *softKeyStack); + bool hasSoftKeyStack(); #endif #ifndef QT_NO_STATUSBAR |