mirror of
https://github.com/githubuser0xFFFF/Qt-Advanced-Docking-System.git
synced 2024-12-25 23:51:33 +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;
|
||||
return;
|
||||
}
|
||||
QScrollArea::mousePressEvent(ev);
|
||||
Super::mousePressEvent(ev);
|
||||
}
|
||||
|
||||
|
||||
@ -193,14 +193,14 @@ void CDockAreaTabBar::mouseReleaseEvent(QMouseEvent* ev)
|
||||
}
|
||||
return;
|
||||
}
|
||||
QScrollArea::mouseReleaseEvent(ev);
|
||||
Super::mouseReleaseEvent(ev);
|
||||
}
|
||||
|
||||
|
||||
//============================================================================
|
||||
void CDockAreaTabBar::mouseMoveEvent(QMouseEvent* ev)
|
||||
{
|
||||
QScrollArea::mouseMoveEvent(ev);
|
||||
Super::mouseMoveEvent(ev);
|
||||
if (!(ev->buttons() & Qt::LeftButton) || d->isDraggingState(DraggingInactive))
|
||||
{
|
||||
d->DragState = DraggingInactive;
|
||||
@ -618,6 +618,7 @@ QSize CDockAreaTabBar::minimumSizeHint() const
|
||||
return Size;
|
||||
}
|
||||
|
||||
|
||||
//===========================================================================
|
||||
QSize CDockAreaTabBar::sizeHint() const
|
||||
{
|
||||
@ -626,6 +627,13 @@ QSize CDockAreaTabBar::sizeHint() const
|
||||
return Size;
|
||||
}
|
||||
|
||||
|
||||
//===========================================================================
|
||||
eDragState CDockAreaTabBar::dragState() const
|
||||
{
|
||||
return d->DragState;
|
||||
}
|
||||
|
||||
} // namespace ads
|
||||
|
||||
//---------------------------------------------------------------------------
|
||||
|
@ -98,6 +98,11 @@ protected:
|
||||
*/
|
||||
IFloatingWidget* makeAreaFloating(const QPoint& Offset, eDragState DragState);
|
||||
|
||||
/**
|
||||
* Returns the current drag state
|
||||
*/
|
||||
eDragState dragState() const;
|
||||
|
||||
|
||||
public:
|
||||
using Super = QScrollArea;
|
||||
|
@ -364,6 +364,11 @@ void CDockAreaTitleBar::setVisible(bool Visible)
|
||||
//============================================================================
|
||||
void CDockAreaTitleBar::showContextMenu(const QPoint& pos)
|
||||
{
|
||||
if (d->TabBar->dragState() == DraggingFloatingWidget)
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
QMenu Menu(this);
|
||||
auto Action = Menu.addAction(tr("Detach Area"), this, SLOT(onUndockButtonClicked()));
|
||||
Action->setEnabled(d->DockArea->features().testFlag(CDockWidget::DockWidgetFloatable));
|
||||
|
@ -317,26 +317,29 @@ void CDockWidgetTab::mousePressEvent(QMouseEvent* ev)
|
||||
//============================================================================
|
||||
void CDockWidgetTab::mouseReleaseEvent(QMouseEvent* ev)
|
||||
{
|
||||
auto CurrentDragState = d->DragState;
|
||||
d->DragStartMousePosition = QPoint();
|
||||
d->DragState = DraggingInactive;
|
||||
if (ev->button() == Qt::LeftButton)
|
||||
{
|
||||
auto CurrentDragState = d->DragState;
|
||||
d->DragStartMousePosition = QPoint();
|
||||
d->DragState = DraggingInactive;
|
||||
|
||||
switch (CurrentDragState)
|
||||
{
|
||||
case DraggingTab:
|
||||
// End of tab moving, emit signal
|
||||
if (d->DockArea)
|
||||
switch (CurrentDragState)
|
||||
{
|
||||
emit moved(ev->globalPos());
|
||||
case DraggingTab:
|
||||
// End of tab moving, emit signal
|
||||
if (d->DockArea)
|
||||
{
|
||||
emit moved(ev->globalPos());
|
||||
}
|
||||
break;
|
||||
|
||||
case DraggingFloatingWidget:
|
||||
d->FloatingWidget->finishDragging();
|
||||
break;
|
||||
|
||||
default:; // do nothing
|
||||
}
|
||||
break;
|
||||
|
||||
case DraggingFloatingWidget:
|
||||
d->FloatingWidget->finishDragging();
|
||||
break;
|
||||
|
||||
default:; // do nothing
|
||||
}
|
||||
}
|
||||
|
||||
Super::mouseReleaseEvent(ev);
|
||||
}
|
||||
@ -416,6 +419,10 @@ void CDockWidgetTab::mouseMoveEvent(QMouseEvent* ev)
|
||||
void CDockWidgetTab::contextMenuEvent(QContextMenuEvent* ev)
|
||||
{
|
||||
ev->accept();
|
||||
if (d->isDraggingState(DraggingFloatingWidget))
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
d->DragStartMousePosition = ev->pos();
|
||||
QMenu Menu(this);
|
||||
|
Loading…
Reference in New Issue
Block a user