##// END OF EJS Templates
Multi selection improvements
trabillard -
r1119:8c4e23ece78b
parent child
Show More
@@ -842,16 +842,24 void VisualizationGraphWidget::onMousePress(QMouseEvent *event) noexcept
842 842 if (isSelectionZoneMode) {
843 843 auto isMultiSelectionClick = event->modifiers().testFlag(MULTI_ZONE_SELECTION_MODIFIER);
844 844 auto selectionZoneItemUnderCursor = impl->selectionZoneAt(event->pos(), plot());
845 if (selectionZoneItemUnderCursor && isLeftClick) {
846 selectionZoneItemUnderCursor->setAssociatedEditedZones(
847 parentVisualizationWidget()->selectionZoneManager().selectedItems());
845
846
847 if (selectionZoneItemUnderCursor && !selectionZoneItemUnderCursor->selected()
848 && !isMultiSelectionClick) {
849 parentVisualizationWidget()->selectionZoneManager().select(
850 {selectionZoneItemUnderCursor});
848 851 }
849 else if (!isMultiSelectionClick && isLeftClick) {
852 else if (!selectionZoneItemUnderCursor && !isMultiSelectionClick && isLeftClick) {
850 853 parentVisualizationWidget()->selectionZoneManager().clearSelection();
851 854 }
852 855 else {
853 856 // No selection change
854 857 }
858
859 if (selectionZoneItemUnderCursor && isLeftClick) {
860 selectionZoneItemUnderCursor->setAssociatedEditedZones(
861 parentVisualizationWidget()->selectionZoneManager().selectedItems());
862 }
855 863 }
856 864
857 865
@@ -1,5 +1,7
1 1 #include "Visualization/VisualizationSelectionZoneItem.h"
2 2 #include "Visualization/VisualizationGraphWidget.h"
3 #include "Visualization/VisualizationSelectionZoneManager.h"
4 #include "Visualization/VisualizationWidget.h"
3 5
4 6 const QString &DEFAULT_COLOR = QStringLiteral("#E79D41");
5 7
@@ -344,6 +346,12 void VisualizationSelectionZoneItem::mousePressEvent(QMouseEvent *event, const Q
344 346 void VisualizationSelectionZoneItem::mouseMoveEvent(QMouseEvent *event, const QPointF &startPos)
345 347 {
346 348 if (isEditionEnabled()) {
349 if (!selected()) {
350 // Force the item to be selected during the edition
351 parentGraphWidget()->parentVisualizationWidget()->selectionZoneManager().setSelected(
352 this, true);
353 }
354
347 355 auto axis = impl->m_Plot->axisRect()->axis(QCPAxis::atBottom);
348 356 auto pixelDiff = event->pos().x() - startPos.x();
349 357 auto diff = impl->pixelSizeToAxisXSize(pixelDiff);
General Comments 4
Under Review
author

Auto status change to "Under Review"

Approved

Status change > Approved

Approved

Status change > Approved

You need to be logged in to leave comments. Login now