@@ -60,6 +60,7 @@ struct DockAreaTabBarPrivate
60
60
QWidget* TabsContainerWidget;
61
61
QBoxLayout* TabsLayout;
62
62
int CurrentIndex = -1 ;
63
+ eDragState DragState = DraggingInactive;
63
64
64
65
/* *
65
66
* Private data constructor
@@ -71,6 +72,14 @@ struct DockAreaTabBarPrivate
71
72
* The function reassigns the stylesheet to update the tabs
72
73
*/
73
74
void updateTabs ();
75
+
76
+ /* *
77
+ * Test function for current drag state
78
+ */
79
+ bool isDraggingState (eDragState dragState) const
80
+ {
81
+ return this ->DragState == dragState;
82
+ }
74
83
};
75
84
// struct DockAreaTabBarPrivate
76
85
@@ -161,6 +170,7 @@ void CDockAreaTabBar::mousePressEvent(QMouseEvent* ev)
161
170
{
162
171
ev->accept ();
163
172
d->DragStartMousePos = ev->pos ();
173
+ d->DragState = DraggingMousePressed;
164
174
return ;
165
175
}
166
176
QScrollArea::mousePressEvent (ev);
@@ -174,12 +184,12 @@ void CDockAreaTabBar::mouseReleaseEvent(QMouseEvent* ev)
174
184
{
175
185
ADS_PRINT (" CDockAreaTabBar::mouseReleaseEvent" );
176
186
ev->accept ();
187
+ auto CurrentDragState = d->DragState ;
177
188
d->DragStartMousePos = QPoint ();
178
- if (d->FloatingWidget )
189
+ d->DragState = DraggingInactive;
190
+ if (DraggingFloatingWidget == CurrentDragState)
179
191
{
180
- auto FloatingWidget = d->FloatingWidget ;
181
- d->FloatingWidget = nullptr ;
182
- FloatingWidget->finishDragging ();
192
+ d->FloatingWidget ->finishDragging ();
183
193
}
184
194
return ;
185
195
}
@@ -196,11 +206,12 @@ void CDockAreaTabBar::mouseMoveEvent(QMouseEvent* ev)
196
206
return ;
197
207
}
198
208
199
- if (d->FloatingWidget )
200
- {
201
- d->FloatingWidget ->moveFloating ();
202
- return ;
203
- }
209
+ // move floating window
210
+ if (d->isDraggingState (DraggingFloatingWidget))
211
+ {
212
+ d->FloatingWidget ->moveFloating ();
213
+ return ;
214
+ }
204
215
205
216
// If this is the last dock area in a dock container it does not make
206
217
// sense to move it to a new floating widget and leave this one
@@ -254,6 +265,7 @@ void CDockAreaTabBar::mouseDoubleClickEvent(QMouseEvent *event)
254
265
IFloatingWidget* CDockAreaTabBar::makeAreaFloating (const QPoint& Offset, eDragState DragState)
255
266
{
256
267
QSize Size = d->DockArea ->size ();
268
+ d->DragState = DragState;
257
269
bool OpaqueUndocking = CDockManager::configFlags ().testFlag (CDockManager::OpaqueUndocking) ||
258
270
(DraggingFloatingWidget != DragState);
259
271
CFloatingDockContainer* FloatingDockContainer = nullptr ;
0 commit comments