mirror of
https://github.com/githubuser0xFFFF/Qt-Advanced-Docking-System.git
synced 2025-01-25 05:49:02 +08:00
Fixed start drag distance to be based on QApplication::startDragDistance, fixed dragging of dock widget title bar to support dragging in x and y direction
This commit is contained in:
parent
c973482b2b
commit
74b9d35c7b
@ -15,6 +15,7 @@
|
||||
#include <QDebug>
|
||||
#include <QBoxLayout>
|
||||
#include <QMenu>
|
||||
#include <QApplication>
|
||||
|
||||
#include "FloatingDockContainer.h"
|
||||
#include "DockAreaWidget.h"
|
||||
@ -185,9 +186,10 @@ void CDockAreaTabBar::mouseMoveEvent(QMouseEvent* ev)
|
||||
return;
|
||||
}
|
||||
|
||||
int DragDistanceY = qAbs(d->DragStartMousePos.y() - ev->pos().y());
|
||||
int MinDragDistanceY = this->height() / 2;
|
||||
if (DragDistanceY >= MinDragDistanceY)
|
||||
/*int DragDistanceY = qAbs(d->DragStartMousePos.y() - ev->pos().y());
|
||||
int MinDragDistanceY = this->height() / 2;*/
|
||||
int DragDistance = (d->DragStartMousePos - ev->pos()).manhattanLength();
|
||||
if (DragDistance >= CDockManager::startDragDistance())
|
||||
{
|
||||
qDebug() << "CTabsScrollArea::startFloating";
|
||||
startFloating(d->DragStartMousePos);
|
||||
|
@ -44,6 +44,7 @@
|
||||
#include <QXmlStreamReader>
|
||||
#include <QSettings>
|
||||
#include <QMenu>
|
||||
#include <QApplication>
|
||||
|
||||
#include "FloatingDockContainer.h"
|
||||
#include "DockOverlay.h"
|
||||
@ -629,6 +630,13 @@ bool CDockManager::isRestoringState() const
|
||||
return d->RestoringState;
|
||||
}
|
||||
|
||||
|
||||
//===========================================================================
|
||||
int CDockManager::startDragDistance()
|
||||
{
|
||||
return QApplication::startDragDistance() * 1.5;
|
||||
}
|
||||
|
||||
} // namespace ads
|
||||
|
||||
//---------------------------------------------------------------------------
|
||||
|
@ -270,6 +270,12 @@ public:
|
||||
*/
|
||||
bool isRestoringState() const;
|
||||
|
||||
/**
|
||||
* The distance the user needs to move the mouse with the left button
|
||||
* hold down before a dock widget start floating
|
||||
*/
|
||||
static int startDragDistance();
|
||||
|
||||
public slots:
|
||||
/**
|
||||
* Opens the perspective with the given name.
|
||||
|
@ -281,8 +281,7 @@ void CDockWidgetTab::mouseMoveEvent(QMouseEvent* ev)
|
||||
|
||||
// Maybe a fixed drag distance is better here ?
|
||||
int DragDistanceY = qAbs(d->DragStartMousePosition.y() - ev->pos().y());
|
||||
int MinDragDistanceY = d->DockArea->titleBarGeometry().height() / 2;
|
||||
if (DragDistanceY >= MinDragDistanceY)
|
||||
if (DragDistanceY >= CDockManager::startDragDistance())
|
||||
{
|
||||
// If this is the last dock area in a dock container with only
|
||||
// one single dock widget it does not make sense to move it to a new
|
||||
|
Loading…
Reference in New Issue
Block a user