summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorBogDan Vatra <bogdan.vatra.ford@kdab.com>2015-05-14 16:29:00 +0300
committerBogDan Vatra <bogdan@kde.org>2015-05-20 06:50:51 +0000
commit6d3f81b095bbab4c9ccf1ab92d2fd5c9643244a7 (patch)
tree540f358badca39b9a3ca3843dd1f2b548fd44078
parent0171f5f6b771e80e8fcc947ffc8141a61a57a039 (diff)
downloadqt-creator-6d3f81b095bbab4c9ccf1ab92d2fd5c9643244a7.tar.gz
Fix DockWidget
DockWidget keeps a pointer to the initial inner widget which might change/delete. Ex: QWidget *w = new QWidget; w->setWindowTitle("title"); QDockWidget *dock = addDockForWidget(w); //... dock->setWidget(0); // we want to set another widget delete w; Change-Id: I04e3d1075787092f3789f32442990aa76848d1b7 Reviewed-by: Daniel Teske <daniel.teske@theqtcompany.com> Reviewed-by: hjk <hjk@theqtcompany.com> Reviewed-by: BogDan Vatra <bogdan@kde.org>
-rw-r--r--src/libs/utils/fancymainwindow.cpp5
1 files changed, 2 insertions, 3 deletions
diff --git a/src/libs/utils/fancymainwindow.cpp b/src/libs/utils/fancymainwindow.cpp
index 097771a2c2..9477f173bb 100644
--- a/src/libs/utils/fancymainwindow.cpp
+++ b/src/libs/utils/fancymainwindow.cpp
@@ -85,7 +85,6 @@ public:
private:
QPoint m_startPos;
- QWidget *m_inner;
TitleBarWidget *m_titleBar;
QTimer m_timer;
};
@@ -245,7 +244,7 @@ public:
};
DockWidget::DockWidget(QWidget *inner, FancyMainWindow *parent)
- : QDockWidget(parent), q(parent), m_inner(inner)
+ : QDockWidget(parent), q(parent)
{
setWidget(inner);
setFeatures(QDockWidget::DockWidgetMovable | QDockWidget::DockWidgetClosable | QDockWidget::DockWidgetFloatable);
@@ -288,7 +287,7 @@ bool DockWidget::eventFilter(QObject *, QEvent *event)
int y = me->pos().y();
int x = me->pos().x();
int h = m_titleBar->m_floatButton->height();
- if (!isFloating() && 0 <= x && x < m_inner->width() && 0 <= y && y <= h) {
+ if (!isFloating() && widget() && 0 <= x && x < widget()->width() && 0 <= y && y <= h) {
m_timer.start();
m_startPos = mapToGlobal(me->pos());
}