mirror of
https://github.com/githubuser0xFFFF/Qt-Advanced-Docking-System.git
synced 2024-12-24 23:31:32 +08:00
Fix using escape button when dragging non-opaque preview to cancel drag operation (#114)
* Added missing overrides. * Escape button to cancel dragging was not working in Windows either. Using the event filter added for Linux works.
This commit is contained in:
parent
8a16230213
commit
a4ef161f4f
@ -207,12 +207,9 @@ CFloatingDragPreview::CFloatingDragPreview(QWidget* Content, QWidget* parent) :
|
||||
connect(qApp, SIGNAL(applicationStateChanged(Qt::ApplicationState)),
|
||||
SLOT(onApplicationStateChanged(Qt::ApplicationState)));
|
||||
|
||||
#ifdef Q_OS_LINUX
|
||||
// In Windows this widget directly receives the escape key press events
|
||||
// in Linux we need to install an event filter for the given Content
|
||||
// widget to receive the escape key press
|
||||
Content->installEventFilter(this);
|
||||
#endif
|
||||
// We need to install an event filter for the given Content
|
||||
// widget to receive the escape key press
|
||||
Content->installEventFilter(this);
|
||||
}
|
||||
|
||||
|
||||
@ -355,18 +352,6 @@ void CFloatingDragPreview::paintEvent(QPaintEvent* event)
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
//============================================================================
|
||||
void CFloatingDragPreview::keyPressEvent(QKeyEvent *event)
|
||||
{
|
||||
Super::keyPressEvent(event);
|
||||
if (event->key() == Qt::Key_Escape)
|
||||
{
|
||||
d->cancelDragging();
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
//============================================================================
|
||||
void CFloatingDragPreview::onApplicationStateChanged(Qt::ApplicationState state)
|
||||
{
|
||||
|
@ -49,11 +49,6 @@ protected:
|
||||
*/
|
||||
virtual void paintEvent(QPaintEvent *e) override;
|
||||
|
||||
/**
|
||||
* Cancel non opaque undocking with escape key
|
||||
*/
|
||||
virtual void keyPressEvent(QKeyEvent *event) override;
|
||||
|
||||
/**
|
||||
* The content is a DockArea or a DockWidget
|
||||
*/
|
||||
|
Loading…
Reference in New Issue
Block a user