summaryrefslogtreecommitdiffstats
path: root/src/gui/painting
diff options
context:
space:
mode:
Diffstat (limited to 'src/gui/painting')
-rw-r--r--src/gui/painting/qunifiedtoolbarsurface_mac.cpp26
-rw-r--r--src/gui/painting/qunifiedtoolbarsurface_mac_p.h5
2 files changed, 30 insertions, 1 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);
diff --git a/src/gui/painting/qunifiedtoolbarsurface_mac_p.h b/src/gui/painting/qunifiedtoolbarsurface_mac_p.h
index f7ad02e..99839fa 100644
--- a/src/gui/painting/qunifiedtoolbarsurface_mac_p.h
+++ b/src/gui/painting/qunifiedtoolbarsurface_mac_p.h
@@ -55,6 +55,7 @@
#include <private/qwindowsurface_raster_p.h>
#include <QWidget>
+#include <QToolBar>
#include <private/qwidget_p.h>
#include <private/qnativeimage_p.h>
@@ -82,15 +83,17 @@ public:
void setGeometry(const QRect &rect);
void beginPaint(const QRegion &rgn);
void insertToolbar(QWidget *toolbar, const QPoint &offset);
+ void removeToolbar(QToolBar *toolbar);
void updateToolbarOffset(QWidget *widget);
+ void renderToolbar(QWidget *widget, bool forceFlush = false);
QPaintDevice *paintDevice();
CGContextRef imageContext();
- void renderToolbar(QWidget *widget, bool forceFlush = false);
private:
void prepareBuffer(QImage::Format format, QWidget *widget);
void recursiveRedirect(QObject *widget, QWidget *parent_toolbar, const QPoint &offset);
+ void recursiveRemoval(QObject *object);
Q_DECLARE_PRIVATE(QUnifiedToolbarSurface)
QScopedPointer<QUnifiedToolbarSurfacePrivate> d_ptr;