void TupConfigurationArea::shrink() { #ifdef K_DEBUG T_FUNCINFO; #endif QMainWindow *mainWindow = dynamic_cast<QMainWindow *>(parentWidget()); if (!mainWindow || !widget()) { #ifdef K_DEBUG tError() << "TupConfigurationArea::shrink() - Fatal error!"; #endif return; } bool hmt = mainWindow->hasMouseTracking(); int pm = style()->pixelMetric(QStyle::PM_DockWidgetSeparatorExtent); mainWindow->setMouseTracking(true); int wOffset = 0; int hOffset= 0; Qt::DockWidgetArea position = mainWindow->dockWidgetArea(this); if (position == Qt::BottomDockWidgetArea) { wOffset = 20; hOffset = -(y() * 2 + pm - 1); // SQA: FIXME FIXME FIXME } else if (position == Qt::LeftDockWidgetArea) { wOffset = width()+(pm/2)+1; hOffset = height() / 2; } else if (position == Qt::RightDockWidgetArea) { wOffset = -(pm/2)+1; hOffset = height() / 2; } QMouseEvent press(QEvent::MouseButtonPress, mapToParent( QPoint(this->x(), this->y()))/2 + QPoint(wOffset, hOffset), Qt::LeftButton, 0, 0); if (! QApplication::sendEvent(mainWindow, &press)) qWarning("Fail pressing"); qApp->processEvents(); int df = 0; int x1 = 0; int x2 = 0; int y1 = 0; int y2 = 0; int xRelease = 0; int yRelease = 0; if (position == Qt::BottomDockWidgetArea) { df = widget()->height(); x1 = press.pos().x(); y1 = press.pos().y() + df; x2 = press.globalPos().x(); y2 = press.globalPos().y() + df; xRelease = this->x(); yRelease = 10; } else if (position == Qt::LeftDockWidgetArea) { df = widget()->width(); x1 = press.pos().x() - df; y1 = press.pos().y(); x2 = press.globalPos().x() - df; y2 = press.globalPos().y(); xRelease = 10; yRelease = this->y(); } else if (position == Qt::RightDockWidgetArea) { df = widget()->width(); x1 = press.pos().x() + df; y1 = press.pos().y(); x2 = press.globalPos().x() + df; y2 = press.globalPos().y(); xRelease = mainWindow->width(); yRelease = this->y(); } QMouseEvent move(QEvent::MouseMove, QPoint(x1, y1), QPoint(x2, y2), Qt::LeftButton, 0, 0); if (! QApplication::sendEvent(mainWindow, &move)) qWarning("Fail moving"); qApp->processEvents(); QMouseEvent release(QEvent::MouseButtonRelease, QPoint(xRelease, yRelease), Qt::LeftButton, 0, 0); if (! QApplication::sendEvent(mainWindow, &release)) qWarning("Fail releasing"); qApp->processEvents(); mainWindow->setMouseTracking(hmt); }