summaryrefslogtreecommitdiffstats
path: root/src/gui/widgets/qmainwindowlayout.cpp
diff options
context:
space:
mode:
authorThierry Bastian <thierry.bastian@nokia.com>2009-07-01 12:14:29 +0200
committerThierry Bastian <thierry.bastian@nokia.com>2009-07-01 17:16:10 +0200
commitd0299745e511640df3e0a26e8c447d0960ac4546 (patch)
tree860cd92c3dcfbc0fa91337a1e1410c8c35312953 /src/gui/widgets/qmainwindowlayout.cpp
parentfef6f4469d4c856abdaaefe1d914c120396ff365 (diff)
QMainWindow: cleanup of code in QWidgetAnimator
Diffstat (limited to 'src/gui/widgets/qmainwindowlayout.cpp')
-rw-r--r--src/gui/widgets/qmainwindowlayout.cpp50
1 files changed, 16 insertions, 34 deletions
diff --git a/src/gui/widgets/qmainwindowlayout.cpp b/src/gui/widgets/qmainwindowlayout.cpp
index 526e7a50fe..0318f53c50 100644
--- a/src/gui/widgets/qmainwindowlayout.cpp
+++ b/src/gui/widgets/qmainwindowlayout.cpp
@@ -1361,7 +1361,7 @@ QLayoutItem *QMainWindowLayout::takeAt(int index)
if (QLayoutItem *ret = layoutState.takeAt(index, &x)) {
// the widget might in fact have been destroyed by now
if (QWidget *w = ret->widget()) {
- widgetAnimator->abort(w);
+ widgetAnimator.abort(w);
if (w == pluggingWidget)
pluggingWidget = 0;
}
@@ -1542,25 +1542,9 @@ bool QMainWindowLayout::plug(QLayoutItem *widgetItem)
}
}
#endif
- widgetAnimator->animate(widget, globalRect,
- dockOptions & QMainWindow::AnimatedDocks);
+ widgetAnimator.animate(widget, globalRect, true);
} else {
-#ifndef QT_NO_DOCKWIDGET
- if (QDockWidget *dw = qobject_cast<QDockWidget*>(widget))
- dw->d_func()->plug(currentGapRect);
-#endif
-#ifndef QT_NO_TOOLBAR
- if (QToolBar *tb = qobject_cast<QToolBar*>(widget))
- tb->d_func()->plug(currentGapRect);
-#endif
- applyState(layoutState);
- savedState.clear();
-#ifndef QT_NO_DOCKWIDGET
- parentWidget()->update(layoutState.dockAreaLayout.separatorRegion());
-#endif
- currentGapPos.clear();
- updateGapIndicator();
- pluggingWidget = 0;
+ animationFinished(widget);
}
return true;
@@ -1667,6 +1651,11 @@ QMainWindowLayout::QMainWindowLayout(QMainWindow *mainwindow)
#endif
#endif
#endif // QT_NO_DOCKWIDGET
+ , widgetAnimator(this)
+ , pluggingWidget(0)
+#ifndef QT_NO_RUBBERBAND
+ , gapIndicator(QRubberBand::Rectangle, mainwindow)
+#endif //QT_NO_RUBBERBAND
{
#ifndef QT_NO_DOCKWIDGET
#ifndef QT_NO_TABBAR
@@ -1680,20 +1669,13 @@ QMainWindowLayout::QMainWindowLayout(QMainWindow *mainwindow)
#endif // QT_NO_DOCKWIDGET
#ifndef QT_NO_RUBBERBAND
- gapIndicator = new QRubberBand(QRubberBand::Rectangle, mainwindow);
// For accessibility to identify this special widget.
- gapIndicator->setObjectName(QLatin1String("qt_rubberband"));
-
- gapIndicator->hide();
+ gapIndicator.setObjectName(QLatin1String("qt_rubberband"));
+ gapIndicator.hide();
#endif
pluggingWidget = 0;
setObjectName(mainwindow->objectName() + QLatin1String("_layout"));
- widgetAnimator = new QWidgetAnimator(this);
- connect(widgetAnimator, SIGNAL(finished(QWidget*)),
- this, SLOT(animationFinished(QWidget*)), Qt::QueuedConnection);
- connect(widgetAnimator, SIGNAL(finishedAll()),
- this, SLOT(allAnimationsFinished()));
}
QMainWindowLayout::~QMainWindowLayout()
@@ -1795,13 +1777,13 @@ QLayoutItem *QMainWindowLayout::unplug(QWidget *widget)
void QMainWindowLayout::updateGapIndicator()
{
#ifndef QT_NO_RUBBERBAND
- if (widgetAnimator->animating() || currentGapPos.isEmpty()) {
- gapIndicator->hide();
+ if (widgetAnimator.animating() || currentGapPos.isEmpty()) {
+ gapIndicator.hide();
} else {
- if (gapIndicator->geometry() != currentGapRect)
- gapIndicator->setGeometry(currentGapRect);
- if (!gapIndicator->isVisible())
- gapIndicator->show();
+ if (gapIndicator.geometry() != currentGapRect)
+ gapIndicator.setGeometry(currentGapRect);
+ if (!gapIndicator.isVisible())
+ gapIndicator.show();
}
#endif
}