mirror of
https://github.com/githubuser0xFFFF/Qt-Advanced-Docking-System.git
synced 2025-01-15 01:12:05 +08:00
Added FloatingWidgetDragStartEvent to hide AutoHideContainer if user drags floating widget
This commit is contained in:
parent
b50e2017e6
commit
7f58877a47
@ -471,7 +471,7 @@ void CAutoHideDockContainer::setSize(int Size)
|
|||||||
//============================================================================
|
//============================================================================
|
||||||
bool CAutoHideDockContainer::eventFilter(QObject* watched, QEvent* event)
|
bool CAutoHideDockContainer::eventFilter(QObject* watched, QEvent* event)
|
||||||
{
|
{
|
||||||
if (event->type() == QEvent::Resize)
|
if (event->type() == QEvent::Resize)
|
||||||
{
|
{
|
||||||
if (!d->ResizeHandle->isResizing())
|
if (!d->ResizeHandle->isResizing())
|
||||||
{
|
{
|
||||||
@ -539,6 +539,10 @@ bool CAutoHideDockContainer::eventFilter(QObject* watched, QEvent* event)
|
|||||||
collapseView(true);
|
collapseView(true);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
else if (event->type() == internal::FloatingWidgetDragStartEvent)
|
||||||
|
{
|
||||||
|
collapseView(true);
|
||||||
|
}
|
||||||
|
|
||||||
return Super::eventFilter(watched, event);
|
return Super::eventFilter(watched, event);
|
||||||
}
|
}
|
||||||
|
@ -406,7 +406,13 @@ struct FloatingDockContainerPrivate
|
|||||||
|
|
||||||
void setState(eDragState StateId)
|
void setState(eDragState StateId)
|
||||||
{
|
{
|
||||||
|
auto OldState = DraggingState;
|
||||||
DraggingState = StateId;
|
DraggingState = StateId;
|
||||||
|
if (DraggingInactive == OldState && DraggingFloatingWidget == DraggingState)
|
||||||
|
{
|
||||||
|
qDebug() << "Start dragging floating widget " << internal::FloatingWidgetDragStartEvent;
|
||||||
|
qApp->postEvent(DockManager, new QEvent((QEvent::Type)internal::FloatingWidgetDragStartEvent));
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
void setWindowTitle(const QString &Text)
|
void setWindowTitle(const QString &Text)
|
||||||
@ -1281,12 +1287,13 @@ void CFloatingDockContainer::moveEvent(QMoveEvent *event)
|
|||||||
Super::moveEvent(event);
|
Super::moveEvent(event);
|
||||||
if (!d->IsResizing && event->spontaneous() && s_mousePressed)
|
if (!d->IsResizing && event->spontaneous() && s_mousePressed)
|
||||||
{
|
{
|
||||||
d->DraggingState = DraggingFloatingWidget;
|
d->setState(DraggingFloatingWidget);
|
||||||
d->updateDropOverlays(QCursor::pos());
|
d->updateDropOverlays(QCursor::pos());
|
||||||
}
|
}
|
||||||
d->IsResizing = false;
|
d->IsResizing = false;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
//============================================================================
|
//============================================================================
|
||||||
bool CFloatingDockContainer::event(QEvent *e)
|
bool CFloatingDockContainer::event(QEvent *e)
|
||||||
{
|
{
|
||||||
|
@ -53,6 +53,7 @@ namespace internal
|
|||||||
#ifdef Q_OS_LINUX
|
#ifdef Q_OS_LINUX
|
||||||
static QString _window_manager;
|
static QString _window_manager;
|
||||||
static QHash<QString, xcb_atom_t> _xcb_atom_cache;
|
static QHash<QString, xcb_atom_t> _xcb_atom_cache;
|
||||||
|
const int FloatingWidgetDragStartEvent = QEvent::registerEventType();
|
||||||
|
|
||||||
|
|
||||||
//============================================================================
|
//============================================================================
|
||||||
|
@ -151,6 +151,7 @@ static const bool RestoreTesting = true;
|
|||||||
static const bool Restore = false;
|
static const bool Restore = false;
|
||||||
static const char* const ClosedProperty = "close";
|
static const char* const ClosedProperty = "close";
|
||||||
static const char* const DirtyProperty = "dirty";
|
static const char* const DirtyProperty = "dirty";
|
||||||
|
extern const int FloatingWidgetDragStartEvent;
|
||||||
|
|
||||||
#ifdef Q_OS_LINUX
|
#ifdef Q_OS_LINUX
|
||||||
// Utils to directly communicate with the X server
|
// Utils to directly communicate with the X server
|
||||||
|
Loading…
Reference in New Issue
Block a user