Auto status change to "Under Review"
@@ -63,6 +63,10 public: | |||||
63 | void setHightlightedDragWidget(VisualizationDragWidget *dragWidget); |
|
63 | void setHightlightedDragWidget(VisualizationDragWidget *dragWidget); | |
64 | VisualizationDragWidget *getHightlightedDragWidget() const; |
|
64 | VisualizationDragWidget *getHightlightedDragWidget() const; | |
65 |
|
65 | |||
|
66 | /// Delays the closing of a widget during a drag&drop operation | |||
|
67 | void delayedCloseWidget(QWidget *widget); | |||
|
68 | void doCloseWidgets(); | |||
|
69 | ||||
66 | private: |
|
70 | private: | |
67 | class DragDropHelperPrivate; |
|
71 | class DragDropHelperPrivate; | |
68 | spimpl::unique_impl_ptr<DragDropHelperPrivate> impl; |
|
72 | spimpl::unique_impl_ptr<DragDropHelperPrivate> impl; |
@@ -38,6 +38,8 struct DragDropHelper::DragDropHelperPrivate { | |||||
38 | QMetaObject::Connection m_DragWidgetDestroyedConnection; |
|
38 | QMetaObject::Connection m_DragWidgetDestroyedConnection; | |
39 | QMetaObject::Connection m_HighlightedWidgetDestroyedConnection; |
|
39 | QMetaObject::Connection m_HighlightedWidgetDestroyedConnection; | |
40 |
|
40 | |||
|
41 | QList<QWidget *> m_WidgetToClose; | |||
|
42 | ||||
41 | explicit DragDropHelperPrivate() |
|
43 | explicit DragDropHelperPrivate() | |
42 | : m_PlaceHolder{std::make_unique<QWidget>()}, |
|
44 | : m_PlaceHolder{std::make_unique<QWidget>()}, | |
43 | m_DragDropScroller{std::make_unique<DragDropScroller>()}, |
|
45 | m_DragDropScroller{std::make_unique<DragDropScroller>()}, | |
@@ -209,6 +211,21 VisualizationDragWidget *DragDropHelper::getHightlightedDragWidget() const | |||||
209 | return impl->m_HighlightedDragWidget; |
|
211 | return impl->m_HighlightedDragWidget; | |
210 | } |
|
212 | } | |
211 |
|
213 | |||
|
214 | void DragDropHelper::delayedCloseWidget(QWidget *widget) | |||
|
215 | { | |||
|
216 | widget->hide(); | |||
|
217 | impl->m_WidgetToClose << widget; | |||
|
218 | } | |||
|
219 | ||||
|
220 | void DragDropHelper::doCloseWidgets() | |||
|
221 | { | |||
|
222 | for (auto widget : impl->m_WidgetToClose) { | |||
|
223 | widget->close(); | |||
|
224 | } | |||
|
225 | ||||
|
226 | impl->m_WidgetToClose.clear(); | |||
|
227 | } | |||
|
228 | ||||
212 | bool DragDropHelper::checkMimeDataForVisualization(const QMimeData *mimeData, |
|
229 | bool DragDropHelper::checkMimeDataForVisualization(const QMimeData *mimeData, | |
213 | VisualizationDragDropContainer *dropContainer) |
|
230 | VisualizationDragDropContainer *dropContainer) | |
214 | { |
|
231 | { |
@@ -210,8 +210,9 void VisualizationDragDropContainer::startDrag(VisualizationDragWidget *dragWidg | |||||
210 | // do not add the placeHolder |
|
210 | // do not add the placeHolder | |
211 | } |
|
211 | } | |
212 |
|
212 | |||
213 | // Note: The exec() is blocking on windows but not on linux and macOS |
|
213 | drag->exec(Qt::MoveAction | Qt::CopyAction, Qt::MoveAction); | |
214 | drag->exec(Qt::MoveAction | Qt::CopyAction); |
|
214 | ||
|
215 | helper.doCloseWidgets(); | |||
215 | } |
|
216 | } | |
216 | else { |
|
217 | else { | |
217 | qCWarning(LOG_VisualizationDragDropContainer()) |
|
218 | qCWarning(LOG_VisualizationDragDropContainer()) |
@@ -237,11 +237,11 void VisualizationTabWidget::VisualizationTabWidgetPrivate::dropGraph( | |||||
237 |
|
237 | |||
238 | if (nbGraph == 1) { |
|
238 | if (nbGraph == 1) { | |
239 | // This is the only graph in the previous zone, close the zone |
|
239 | // This is the only graph in the previous zone, close the zone | |
240 |
graphWidget->parentZoneWidget() |
|
240 | helper.delayedCloseWidget(graphWidget->parentZoneWidget()); | |
241 | } |
|
241 | } | |
242 | else { |
|
242 | else { | |
243 | // Close the graph |
|
243 | // Close the graph | |
244 | graphWidget->close(); |
|
244 | helper.delayedCloseWidget(graphWidget); | |
245 | } |
|
245 | } | |
246 |
|
246 | |||
247 | tabWidget->createZone(variables, index); |
|
247 | tabWidget->createZone(variables, index); | |
@@ -258,7 +258,7 void VisualizationTabWidget::VisualizationTabWidgetPrivate::dropGraph( | |||||
258 |
|
258 | |||
259 | // Close the old zone if it was the only graph inside |
|
259 | // Close the old zone if it was the only graph inside | |
260 | if (nbGraph == 1) { |
|
260 | if (nbGraph == 1) { | |
261 |
parentZoneWidget |
|
261 | helper.delayedCloseWidget(parentZoneWidget); | |
262 | } |
|
262 | } | |
263 | } |
|
263 | } | |
264 | } |
|
264 | } |
@@ -452,11 +452,11 void VisualizationZoneWidget::VisualizationZoneWidgetPrivate::dropGraph( | |||||
452 | auto nbGraph = parentDragDropContainer->countDragWidget(); |
|
452 | auto nbGraph = parentDragDropContainer->countDragWidget(); | |
453 | if (nbGraph == 1) { |
|
453 | if (nbGraph == 1) { | |
454 | // This is the only graph in the previous zone, close the zone |
|
454 | // This is the only graph in the previous zone, close the zone | |
455 |
previousParentZoneWidget |
|
455 | helper.delayedCloseWidget(previousParentZoneWidget); | |
456 | } |
|
456 | } | |
457 | else { |
|
457 | else { | |
458 | // Close the graph |
|
458 | // Close the graph | |
459 | graphWidget->close(); |
|
459 | helper.delayedCloseWidget(graphWidget); | |
460 | } |
|
460 | } | |
461 |
|
461 | |||
462 | // Creates the new graph in the zone |
|
462 | // Creates the new graph in the zone |
General Comments 1
You need to be logged in to leave comments.
Login now