mirror of
https://github.com/githubuser0xFFFF/Qt-Advanced-Docking-System.git
synced 2024-12-25 23:51:33 +08:00
Improved and fixed handling of CDockWidget::DockWidgetMovable - moving the tab in the tabbar is always allowed, only moving the complete dock widget can be blocked by clearing this flag
This commit is contained in:
parent
6b93ae9c39
commit
3f40c997e5
@ -18,9 +18,9 @@ class CDockAreaWidget;
|
||||
struct DockAreaTabBarPrivate;
|
||||
|
||||
/**
|
||||
* Custom scroll bar implementation for dock area tab bar
|
||||
* This scroll area enables floating of a whole dock area including all
|
||||
* dock widgets
|
||||
* Custom tabbar implementation for tab area that is shown on top of a
|
||||
* dock area widget.
|
||||
* The tabbar displays the tab widgets of the contained dock widgets.
|
||||
*/
|
||||
class CDockAreaTabBar : public QScrollArea
|
||||
{
|
||||
|
@ -45,7 +45,7 @@ class CDockWidget;
|
||||
|
||||
|
||||
/**
|
||||
* DockAreaWidget manages multiple instances of DckWidgets.
|
||||
* DockAreaWidget manages multiple instances of DockWidgets.
|
||||
* It displays a title tab, which is clickable and will switch to
|
||||
* the contents associated to the title when clicked.
|
||||
*/
|
||||
|
@ -240,7 +240,6 @@ void CDockWidgetTab::mouseReleaseEvent(QMouseEvent* ev)
|
||||
// End of tab moving, change order now
|
||||
if (d->isDraggingState(DraggingTab) && d->DockArea)
|
||||
{
|
||||
if (d->DockWidget->features() & CDockWidget::DockWidgetMovable) {
|
||||
// Find tab under mouse
|
||||
QPoint pos = d->DockArea->mapFromGlobal(ev->globalPos());
|
||||
int fromIndex = d->DockArea->tabIndex(d->DockWidget);
|
||||
@ -253,8 +252,6 @@ void CDockWidgetTab::mouseReleaseEvent(QMouseEvent* ev)
|
||||
d->DockArea->reorderDockWidget(fromIndex, toIndex);
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
if (!d->DragStartMousePosition.isNull())
|
||||
{
|
||||
emit clicked();
|
||||
@ -276,11 +273,10 @@ void CDockWidgetTab::mouseMoveEvent(QMouseEvent* ev)
|
||||
return;
|
||||
}
|
||||
|
||||
// move floating winwdow
|
||||
if (d->isDraggingState(DraggingFloatingWidget))
|
||||
{
|
||||
if (d->DockWidget->features() & CDockWidget::DockWidgetMovable) {
|
||||
d->FloatingWidget->moveFloating();
|
||||
}
|
||||
QFrame::mouseMoveEvent(ev);
|
||||
return;
|
||||
}
|
||||
@ -288,15 +284,17 @@ void CDockWidgetTab::mouseMoveEvent(QMouseEvent* ev)
|
||||
// move tab
|
||||
if (d->isDraggingState(DraggingTab))
|
||||
{
|
||||
if (d->DockWidget->features() & CDockWidget::DockWidgetMovable) {
|
||||
// Moving the tab is always allowed because it does not mean moving the
|
||||
// dock widget around
|
||||
d->moveTab(ev);
|
||||
}
|
||||
}
|
||||
|
||||
bool MouseInsideTitleArea = d->titleAreaGeometryContains(ev->globalPos());
|
||||
if (!MouseInsideTitleArea)
|
||||
{
|
||||
if (d->DockWidget->features() & CDockWidget::DockWidgetMovable) {
|
||||
// Floating is only allowed for widgets that are movable
|
||||
if (d->DockWidget->features().testFlag(CDockWidget::DockWidgetMovable))
|
||||
{
|
||||
d->startFloating();
|
||||
}
|
||||
return;
|
||||
@ -304,9 +302,7 @@ void CDockWidgetTab::mouseMoveEvent(QMouseEvent* ev)
|
||||
else if (d->DockArea->count() > 1
|
||||
&& (ev->pos() - d->DragStartMousePosition).manhattanLength() >= QApplication::startDragDistance()) // Wait a few pixels before start moving
|
||||
{
|
||||
if (d->DockWidget->features() & CDockWidget::DockWidgetMovable) {
|
||||
d->DragState = DraggingTab;
|
||||
}
|
||||
return;
|
||||
}
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user