mirror of
https://github.com/githubuser0xFFFF/Qt-Advanced-Docking-System.git
synced 2025-01-13 16:42:06 +08:00
Blocked display of context menu when dragging floating widget
This commit is contained in:
parent
c0cde1e31e
commit
2af4b1f75c
@ -173,7 +173,7 @@ void CDockAreaTabBar::mousePressEvent(QMouseEvent* ev)
|
|||||||
d->DragState = DraggingMousePressed;
|
d->DragState = DraggingMousePressed;
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
QScrollArea::mousePressEvent(ev);
|
Super::mousePressEvent(ev);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
@ -193,14 +193,14 @@ void CDockAreaTabBar::mouseReleaseEvent(QMouseEvent* ev)
|
|||||||
}
|
}
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
QScrollArea::mouseReleaseEvent(ev);
|
Super::mouseReleaseEvent(ev);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
//============================================================================
|
//============================================================================
|
||||||
void CDockAreaTabBar::mouseMoveEvent(QMouseEvent* ev)
|
void CDockAreaTabBar::mouseMoveEvent(QMouseEvent* ev)
|
||||||
{
|
{
|
||||||
QScrollArea::mouseMoveEvent(ev);
|
Super::mouseMoveEvent(ev);
|
||||||
if (!(ev->buttons() & Qt::LeftButton) || d->isDraggingState(DraggingInactive))
|
if (!(ev->buttons() & Qt::LeftButton) || d->isDraggingState(DraggingInactive))
|
||||||
{
|
{
|
||||||
d->DragState = DraggingInactive;
|
d->DragState = DraggingInactive;
|
||||||
@ -618,6 +618,7 @@ QSize CDockAreaTabBar::minimumSizeHint() const
|
|||||||
return Size;
|
return Size;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
//===========================================================================
|
//===========================================================================
|
||||||
QSize CDockAreaTabBar::sizeHint() const
|
QSize CDockAreaTabBar::sizeHint() const
|
||||||
{
|
{
|
||||||
@ -626,6 +627,13 @@ QSize CDockAreaTabBar::sizeHint() const
|
|||||||
return Size;
|
return Size;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
//===========================================================================
|
||||||
|
eDragState CDockAreaTabBar::dragState() const
|
||||||
|
{
|
||||||
|
return d->DragState;
|
||||||
|
}
|
||||||
|
|
||||||
} // namespace ads
|
} // namespace ads
|
||||||
|
|
||||||
//---------------------------------------------------------------------------
|
//---------------------------------------------------------------------------
|
||||||
|
@ -98,6 +98,11 @@ protected:
|
|||||||
*/
|
*/
|
||||||
IFloatingWidget* makeAreaFloating(const QPoint& Offset, eDragState DragState);
|
IFloatingWidget* makeAreaFloating(const QPoint& Offset, eDragState DragState);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Returns the current drag state
|
||||||
|
*/
|
||||||
|
eDragState dragState() const;
|
||||||
|
|
||||||
|
|
||||||
public:
|
public:
|
||||||
using Super = QScrollArea;
|
using Super = QScrollArea;
|
||||||
|
@ -364,6 +364,11 @@ void CDockAreaTitleBar::setVisible(bool Visible)
|
|||||||
//============================================================================
|
//============================================================================
|
||||||
void CDockAreaTitleBar::showContextMenu(const QPoint& pos)
|
void CDockAreaTitleBar::showContextMenu(const QPoint& pos)
|
||||||
{
|
{
|
||||||
|
if (d->TabBar->dragState() == DraggingFloatingWidget)
|
||||||
|
{
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
QMenu Menu(this);
|
QMenu Menu(this);
|
||||||
auto Action = Menu.addAction(tr("Detach Area"), this, SLOT(onUndockButtonClicked()));
|
auto Action = Menu.addAction(tr("Detach Area"), this, SLOT(onUndockButtonClicked()));
|
||||||
Action->setEnabled(d->DockArea->features().testFlag(CDockWidget::DockWidgetFloatable));
|
Action->setEnabled(d->DockArea->features().testFlag(CDockWidget::DockWidgetFloatable));
|
||||||
|
@ -317,6 +317,8 @@ void CDockWidgetTab::mousePressEvent(QMouseEvent* ev)
|
|||||||
//============================================================================
|
//============================================================================
|
||||||
void CDockWidgetTab::mouseReleaseEvent(QMouseEvent* ev)
|
void CDockWidgetTab::mouseReleaseEvent(QMouseEvent* ev)
|
||||||
{
|
{
|
||||||
|
if (ev->button() == Qt::LeftButton)
|
||||||
|
{
|
||||||
auto CurrentDragState = d->DragState;
|
auto CurrentDragState = d->DragState;
|
||||||
d->DragStartMousePosition = QPoint();
|
d->DragStartMousePosition = QPoint();
|
||||||
d->DragState = DraggingInactive;
|
d->DragState = DraggingInactive;
|
||||||
@ -337,6 +339,7 @@ void CDockWidgetTab::mouseReleaseEvent(QMouseEvent* ev)
|
|||||||
|
|
||||||
default:; // do nothing
|
default:; // do nothing
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
Super::mouseReleaseEvent(ev);
|
Super::mouseReleaseEvent(ev);
|
||||||
}
|
}
|
||||||
@ -416,6 +419,10 @@ void CDockWidgetTab::mouseMoveEvent(QMouseEvent* ev)
|
|||||||
void CDockWidgetTab::contextMenuEvent(QContextMenuEvent* ev)
|
void CDockWidgetTab::contextMenuEvent(QContextMenuEvent* ev)
|
||||||
{
|
{
|
||||||
ev->accept();
|
ev->accept();
|
||||||
|
if (d->isDraggingState(DraggingFloatingWidget))
|
||||||
|
{
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
d->DragStartMousePosition = ev->pos();
|
d->DragStartMousePosition = ev->pos();
|
||||||
QMenu Menu(this);
|
QMenu Menu(this);
|
||||||
|
Loading…
Reference in New Issue
Block a user