diff options
author | Fabien Freling <fabien.freling@nokia.com> | 2011-02-24 15:36:44 (GMT) |
---|---|---|
committer | Fabien Freling <fabien.freling@nokia.com> | 2011-02-25 10:09:02 (GMT) |
commit | 2b9e7bcede5ca6ba9de2534839244cc621f17e1c (patch) | |
tree | 477d5077cc2dcfb0a6ba2a576445f4640ecba837 /src/gui/painting/qunifiedtoolbarsurface_mac.cpp | |
parent | f41e395e9ebc6db33c21ff082b59f2d7b6d2a3b2 (diff) | |
download | Qt-2b9e7bcede5ca6ba9de2534839244cc621f17e1c.zip Qt-2b9e7bcede5ca6ba9de2534839244cc621f17e1c.tar.gz Qt-2b9e7bcede5ca6ba9de2534839244cc621f17e1c.tar.bz2 |
Add the ability to remove a toolbar from the unified toolbar.
This allows to toggle the unified look of the
toolbar. This is useful for apps going fullscreen
since we have to turn the unified look off when
entering fullscreen mode.
Reviewed-by: Samuel Rødal
Diffstat (limited to 'src/gui/painting/qunifiedtoolbarsurface_mac.cpp')
-rw-r--r-- | src/gui/painting/qunifiedtoolbarsurface_mac.cpp | 26 |
1 files changed, 26 insertions, 0 deletions
diff --git a/src/gui/painting/qunifiedtoolbarsurface_mac.cpp b/src/gui/painting/qunifiedtoolbarsurface_mac.cpp index 6abcf2c..87206f3 100644 --- a/src/gui/painting/qunifiedtoolbarsurface_mac.cpp +++ b/src/gui/painting/qunifiedtoolbarsurface_mac.cpp @@ -99,6 +99,32 @@ void QUnifiedToolbarSurface::insertToolbar(QWidget *toolbar, const QPoint &offse recursiveRedirect(toolbar, toolbar, offset); } +// We basically undo what we set in recursiveRedirect(). +void QUnifiedToolbarSurface::recursiveRemoval(QObject *object) +{ + if (object != 0) { + if (object->isWidgetType()) { + QWidget *widget = qobject_cast<QWidget *>(object); + + if (!(widget->windowType() & Qt::Window)) { + widget->d_func()->unifiedSurface = 0; + widget->d_func()->isInUnifiedToolbar = false; + widget->d_func()->toolbar_offset = QPoint(); + widget->d_func()->toolbar_ancestor = 0; + + for (int i = 0; i < object->children().size(); ++i) { + recursiveRemoval(object->children().at(i)); + } + } + } + } +} + +void QUnifiedToolbarSurface::removeToolbar(QToolBar *toolbar) +{ + recursiveRemoval(toolbar); +} + void QUnifiedToolbarSurface::setGeometry(const QRect &rect) { QWindowSurface::setGeometry(rect); |