void QToolBarPrivate::startDrag(bool moving) { Q_Q(QToolBar); Q_ASSERT(state != 0); if ((moving && state->moving) || state->dragging) return; QMainWindow *win = qobject_cast<QMainWindow*>(parent); Q_ASSERT(win != 0); QMainWindowLayout *layout = qobject_cast<QMainWindowLayout*>(win->layout()); Q_ASSERT(layout != 0); if (!moving) { state->widgetItem = layout->unplug(q); #if defined(Q_WS_MAC) && !defined(QT_MAC_USE_COCOA) if (q->isWindow()) { setWindowState(true, true); //set it to floating } #endif Q_ASSERT(state->widgetItem != 0); } state->dragging = !moving; state->moving = moving; }
void QDockWidgetPrivate::startDrag() { Q_Q(QDockWidget); if (state == 0 || state->dragging) return; QMainWindowLayout *layout = qt_mainwindow_layout(qobject_cast<QMainWindow *>(q->parentWidget())); Q_ASSERT(layout != 0); state->widgetItem = layout->unplug(q); if (state->widgetItem == 0) { /* I have a QMainWindow parent, but I was never inserted with QMainWindow::addDockWidget, so the QMainWindowLayout has no widget item for me. :( I have to create it myself, and then delete it if I don't get dropped into a dock area. */ state->widgetItem = new QDockWidgetItem(q); state->ownWidgetItem = true; } if (state->ctrlDrag) layout->restore(); state->dragging = true; }
void QToolBarPrivate::startDrag(bool moving) { Q_Q(QToolBar); Q_ASSERT(state != 0); if ((moving && state->moving) || state->dragging) return; QMainWindow *win = qobject_cast<QMainWindow*>(parent); Q_ASSERT(win != 0); QMainWindowLayout *layout = qt_mainwindow_layout(win); Q_ASSERT(layout != 0); if (!moving) { state->widgetItem = layout->unplug(q); Q_ASSERT(state->widgetItem != 0); } state->dragging = !moving; state->moving = moving; }