##// END OF EJS Templates
Move the GRAPH_MINIMUM_HEIGHT constant in a place accessible everywhere and use it in the drag&drop
trabillard -
r851:1ba93038a6bd
parent child
Show More
@@ -0,0 +1,7
1 #ifndef SCIQLOP_VISUALIZATIONDEF_H
2 #define SCIQLOP_VISUALIZATIONDEF_H
3
4 /// Minimum height for graph added in zones (in pixels)
5 extern const int GRAPH_MINIMUM_HEIGHT;
6
7 #endif // SCIQLOP_VISUALIZATIONDEF_H
@@ -0,0 +1,3
1 #include "Common/VisualizationDef.h"
2
3 const int GRAPH_MINIMUM_HEIGHT = 300;
@@ -169,7 +169,7 struct DragDropHelper::DragDropHelperPrivate {
169 169 // Configuration of the placeHolder when there is no dragWidget
170 170 // (for instance with a drag from a variable)
171 171
172 m_PlaceHolder->setMinimumSize(400, 300);
172 m_PlaceHolder->setMinimumSize(0, GRAPH_MINIMUM_HEIGHT);
173 173 m_PlaceHolder->setSizePolicy(QSizePolicy::Expanding, QSizePolicy::Expanding);
174 174 }
175 175 }
@@ -3,6 +3,8
3 3 #include "SqpApplication.h"
4 4 #include "Visualization/VisualizationDragWidget.h"
5 5
6 #include "Common/VisualizationDef.h"
7
6 8 #include <QDrag>
7 9 #include <QDragEnterEvent>
8 10 #include <QVBoxLayout>
@@ -262,7 +264,8 void VisualizationDragDropContainer::dragMoveEvent(QDragMoveEvent *event)
262 264
263 265 auto nbDragWidget = countDragWidget();
264 266 if (nbDragWidget > 0) {
265 auto graphHeight = size().height() / nbDragWidget;
267 auto graphHeight = qMax(size().height() / nbDragWidget, GRAPH_MINIMUM_HEIGHT);
268
266 269 auto dropIndex = floor(event->pos().y() / graphHeight);
267 270 auto zoneSize = qMin(graphHeight / 3.0, 150.0);
268 271
@@ -7,6 +7,8
7 7 #include "ui_VisualizationZoneWidget.h"
8 8
9 9 #include "Common/MimeTypesDef.h"
10 #include "Common/VisualizationDef.h"
11
10 12 #include <Data/SqpRange.h>
11 13 #include <Variable/Variable.h>
12 14 #include <Variable/VariableController.h>
@@ -24,8 +26,6 Q_LOGGING_CATEGORY(LOG_VisualizationZoneWidget, "VisualizationZoneWidget")
24 26
25 27 namespace {
26 28
27 /// Minimum height for graph added in zones (in pixels)
28 const auto GRAPH_MINIMUM_HEIGHT = 300;
29 29
30 30 /// Generates a default name for a new graph, according to the number of graphs already displayed in
31 31 /// the zone
General Comments 0
You need to be logged in to leave comments. Login now