@@ -90,7 +90,7 struct VisualizationGraphWidget::VisualizationGraphWidgetPrivate { | |||||
90 | VisualizationSelectionZoneItem *m_HoveredZone = nullptr; |
|
90 | VisualizationSelectionZoneItem *m_HoveredZone = nullptr; | |
91 | QVector<VisualizationSelectionZoneItem *> m_SelectionZones; |
|
91 | QVector<VisualizationSelectionZoneItem *> m_SelectionZones; | |
92 |
|
92 | |||
93 | bool m_HasMovedMouse = false; //Indicates if the mouse moved in a releaseMouse even |
|
93 | bool m_HasMovedMouse = false; // Indicates if the mouse moved in a releaseMouse even | |
94 |
|
94 | |||
95 | void startDrawingRect(const QPoint &pos, QCustomPlot &plot) |
|
95 | void startDrawingRect(const QPoint &pos, QCustomPlot &plot) | |
96 | { |
|
96 | { | |
@@ -778,7 +778,7 void VisualizationGraphWidget::onMousePress(QMouseEvent *event) noexcept | |||||
778 | // Allows zone edition only in selection zone mode without drag&drop |
|
778 | // Allows zone edition only in selection zone mode without drag&drop | |
779 | impl->setSelectionZonesEditionEnabled(isSelectionZoneMode && !isDragDropClick); |
|
779 | impl->setSelectionZonesEditionEnabled(isSelectionZoneMode && !isDragDropClick); | |
780 |
|
780 | |||
781 | // Selection / Deselection |
|
781 | // Selection / Deselection | |
782 | if (isSelectionZoneMode) { |
|
782 | if (isSelectionZoneMode) { | |
783 | auto isMultiSelectionClick = event->modifiers().testFlag(MULTI_ZONE_SELECTION_MODIFIER); |
|
783 | auto isMultiSelectionClick = event->modifiers().testFlag(MULTI_ZONE_SELECTION_MODIFIER); | |
784 | auto selectionZoneItemUnderCursor = impl->selectionZoneAt(event->pos(), plot()); |
|
784 | auto selectionZoneItemUnderCursor = impl->selectionZoneAt(event->pos(), plot()); |
@@ -84,6 +84,11 VisualizationSelectionZoneItem::VisualizationSelectionZoneItem(QCustomPlot *plot | |||||
84 | impl->m_LeftLine->point2->setTypeY(QCPItemPosition::ptAbsolute); |
|
84 | impl->m_LeftLine->point2->setTypeY(QCPItemPosition::ptAbsolute); | |
85 | impl->m_LeftLine->setSelectable(false); |
|
85 | impl->m_LeftLine->setSelectable(false); | |
86 |
|
86 | |||
|
87 | connect(this, &VisualizationSelectionZoneItem::selectionChanged, impl->m_RightLine, | |||
|
88 | &QCPItemStraightLine::setSelected); | |||
|
89 | connect(this, &VisualizationSelectionZoneItem::selectionChanged, impl->m_LeftLine, | |||
|
90 | &QCPItemStraightLine::setSelected); | |||
|
91 | ||||
87 | setColor(QColor(DEFAULT_COLOR)); |
|
92 | setColor(QColor(DEFAULT_COLOR)); | |
88 | } |
|
93 | } | |
89 |
|
94 | |||
@@ -149,21 +154,22 void VisualizationSelectionZoneItem::setColor(const QColor &color) | |||||
149 | impl->m_Color = color; |
|
154 | impl->m_Color = color; | |
150 |
|
155 | |||
151 | auto brushColor = color; |
|
156 | auto brushColor = color; | |
152 |
brushColor.setAlpha( |
|
157 | brushColor.setAlpha(80); | |
153 | setBrush(QBrush(brushColor)); |
|
158 | setBrush(QBrush(brushColor)); | |
154 | setPen(QPen(Qt::NoPen)); |
|
159 | setPen(QPen(Qt::NoPen)); | |
155 |
|
160 | |||
156 | auto selectedBrushColor = brushColor; |
|
161 | auto selectedBrushColor = brushColor; | |
157 |
selectedBrushColor.setAlpha( |
|
162 | selectedBrushColor.setAlpha(150); | |
158 | setSelectedBrush(QBrush(selectedBrushColor)); |
|
163 | setSelectedBrush(QBrush(selectedBrushColor)); | |
159 | setSelectedPen(QPen(Qt::NoPen)); |
|
164 | setSelectedPen(QPen(Qt::NoPen)); | |
160 |
|
165 | |||
161 | auto linePen = QPen(color); |
|
166 | auto linePen = QPen(color); | |
162 | linePen.setStyle(Qt::SolidLine); |
|
167 | linePen.setStyle(Qt::SolidLine); | |
163 |
linePen.setWidth( |
|
168 | linePen.setWidth(4); | |
164 |
|
169 | |||
165 | auto selectedLinePen = linePen; |
|
170 | auto selectedLinePen = linePen; | |
166 |
selectedLinePen.setColor(color.darker( |
|
171 | selectedLinePen.setColor(color.darker(120)); | |
|
172 | selectedLinePen.setWidth(4); | |||
167 |
|
173 | |||
168 | impl->m_LeftLine->setPen(linePen); |
|
174 | impl->m_LeftLine->setPen(linePen); | |
169 | impl->m_RightLine->setPen(linePen); |
|
175 | impl->m_RightLine->setPen(linePen); |
General Comments 0
You need to be logged in to leave comments.
Login now