@@ -2,7 +2,7 | |||
|
2 | 2 | # See http://clang.llvm.org/docs/ClangFormatStyleOptions.html for a definition |
|
3 | 3 | # of the options |
|
4 | 4 | Language: Cpp |
|
5 |
BasedOnStyle: |
|
|
5 | BasedOnStyle: WebKit | |
|
6 | 6 | |
|
7 | 7 | # Line length |
|
8 | 8 | ColumnLimit: 100 |
@@ -12,8 +12,7 IndentWidth: 4 | |||
|
12 | 12 | AccessModifierOffset: -4 # -IndentWidth |
|
13 | 13 | ConstructorInitializerIndentWidth: 8 # 2 * IndentWidth |
|
14 | 14 | |
|
15 | # Break only before function braces | |
|
16 | BreakBeforeBraces: Stroustrup | |
|
15 | BreakBeforeBraces: Allman | |
|
17 | 16 | |
|
18 | 17 | AllowShortFunctionsOnASingleLine: Inline |
|
19 | 18 | AlwaysBreakTemplateDeclarations: true |
@@ -22,5 +21,6 BreakBeforeBinaryOperators: true | |||
|
22 | 21 | ConstructorInitializerAllOnOneLineOrOnePerLine: true |
|
23 | 22 | IndentCaseLabels: true |
|
24 | 23 | MaxEmptyLinesToKeep: 2 |
|
25 |
Standard: Cpp |
|
|
24 | Standard: Cpp11 | |
|
25 | UseTab: Never | |
|
26 | 26 |
@@ -31,7 +31,7 endif() | |||
|
31 | 31 | if(NOT CMAKE_BUILD_TYPE) |
|
32 | 32 | set(CMAKE_BUILD_TYPE "Release" CACHE STRING "" FORCE) |
|
33 | 33 | endif() |
|
34 | set(CMAKE_CXX_FLAGS_DEBUG "${CMAKE_CXX_FLAGS_DEBUG} -O0") | |
|
34 | set(CMAKE_CXX_FLAGS_DEBUG "${CMAKE_CXX_FLAGS_DEBUG} -O0 -g3") | |
|
35 | 35 | |
|
36 | 36 | find_package(Qt5 COMPONENTS Core Widgets Network PrintSupport Svg Test REQUIRED) |
|
37 | 37 |
@@ -169,9 +169,15 struct VisualizationGraphWidget::VisualizationGraphWidgetPrivate { | |||
|
169 | 169 | } |
|
170 | 170 | } |
|
171 | 171 | |
|
172 | void startDrawingZone(const QPoint &pos, VisualizationGraphWidget *graph) | |
|
172 | void selectZone(const QPoint &pos) | |
|
173 | 173 | { |
|
174 | endDrawingZone(graph); | |
|
174 | auto zoneAtPos = selectionZoneAt(pos); | |
|
175 | setSelectionZonesEditionEnabled(sqpApp->plotsInteractionMode() == SqpApplication::PlotsInteractionMode::SelectionZones); | |
|
176 | } | |
|
177 | ||
|
178 | void startDrawingZone(const QPoint &pos) | |
|
179 | { | |
|
180 | endDrawingZone(); | |
|
175 | 181 | |
|
176 | 182 | auto axisPos = posToAxisPos(pos); |
|
177 | 183 | |
@@ -180,7 +186,7 struct VisualizationGraphWidget::VisualizationGraphWidgetPrivate { | |||
|
180 | 186 | m_DrawingZone->setEditionEnabled(false); |
|
181 | 187 | } |
|
182 | 188 | |
|
183 |
void endDrawingZone( |
|
|
189 | void endDrawingZone() | |
|
184 | 190 | { |
|
185 | 191 | if (m_DrawingZone) { |
|
186 | 192 | auto drawingZoneRange = m_DrawingZone->range(); |
@@ -189,14 +195,24 struct VisualizationGraphWidget::VisualizationGraphWidgetPrivate { | |||
|
189 | 195 | addSelectionZone(m_DrawingZone); |
|
190 | 196 | } |
|
191 | 197 | else { |
|
192 |
|
|
|
198 | m_plot->removeItem(m_DrawingZone); | |
|
193 | 199 | } |
|
194 | 200 | |
|
195 |
|
|
|
201 | m_plot->replot(QCustomPlot::rpQueuedReplot); | |
|
196 | 202 | m_DrawingZone = nullptr; |
|
197 | 203 | } |
|
198 | 204 | } |
|
199 | 205 | |
|
206 | void moveSelectionZone(const QPoint& destination) | |
|
207 | { | |
|
208 | /* | |
|
209 | * I give up on this for now | |
|
210 | * @TODO implement this, the difficulty is that selection zones have their own | |
|
211 | * event handling code which seems to rely on QCP GUI event handling propagation | |
|
212 | * which was a realy bad design choice. | |
|
213 | */ | |
|
214 | } | |
|
215 | ||
|
200 | 216 | void setSelectionZonesEditionEnabled(bool value) |
|
201 | 217 | { |
|
202 | 218 | for (auto s : m_SelectionZones) { |
@@ -783,13 +799,22 void VisualizationGraphWidget::mouseMoveEvent(QMouseEvent *event) | |||
|
783 | 799 | } |
|
784 | 800 | else if (event->buttons() == Qt::LeftButton) |
|
785 | 801 | { |
|
802 | switch (sqpApp->plotsInteractionMode()) | |
|
803 | { | |
|
804 | case SqpApplication::PlotsInteractionMode::None: | |
|
786 | 805 | impl->moveGraph(event->pos()); |
|
806 | break; | |
|
807 | case SqpApplication::PlotsInteractionMode::SelectionZones: | |
|
808 | ||
|
809 | break; | |
|
810 | default: | |
|
811 | break; | |
|
812 | } | |
|
787 | 813 | } |
|
788 | 814 | else |
|
789 | 815 | { |
|
790 | 816 | impl->m_RenderingDelegate->updateTooltip(event); |
|
791 | 817 | } |
|
792 | event->accept(); | |
|
793 | 818 | QWidget::mouseMoveEvent(event); |
|
794 | 819 | } |
|
795 | 820 | |
@@ -801,7 +826,7 void VisualizationGraphWidget::mouseReleaseEvent(QMouseEvent *event) | |||
|
801 | 826 | } |
|
802 | 827 | else if(impl->isDrawingZoneRect()) |
|
803 | 828 | { |
|
804 |
impl->endDrawingZone( |
|
|
829 | impl->endDrawingZone(); | |
|
805 | 830 | } |
|
806 | 831 | else |
|
807 | 832 | { |
@@ -812,21 +837,34 void VisualizationGraphWidget::mouseReleaseEvent(QMouseEvent *event) | |||
|
812 | 837 | |
|
813 | 838 | void VisualizationGraphWidget::mousePressEvent(QMouseEvent *event) |
|
814 | 839 | { |
|
815 |
if (event->button() |
|
|
816 | if (event->modifiers() == Qt::ControlModifier) { | |
|
817 | } | |
|
818 | else if (event->modifiers() == Qt::AltModifier) { | |
|
819 | ||
|
840 | if (event->button()==Qt::RightButton) | |
|
841 | { | |
|
842 | onGraphMenuRequested(event->pos()); | |
|
820 | 843 |
|
|
821 | 844 |
|
|
822 | 845 |
|
|
846 | auto selectedZone = impl->selectionZoneAt(event->pos()); | |
|
823 | 847 |
|
|
824 | 848 |
|
|
825 | 849 |
|
|
826 | 850 |
|
|
827 | 851 |
|
|
828 |
|
|
|
829 | impl->startDrawingZone(event->pos(), this); | |
|
852 | impl->setSelectionZonesEditionEnabled(true); | |
|
853 | if ((event->modifiers() == Qt::ControlModifier) && (selectedZone != nullptr)) | |
|
854 | { | |
|
855 | selectedZone->setAssociatedEditedZones(parentVisualizationWidget()->selectionZoneManager().selectedItems()); | |
|
856 | } | |
|
857 | else | |
|
858 | { | |
|
859 | if (!selectedZone) | |
|
860 | { | |
|
861 | parentVisualizationWidget()->selectionZoneManager().clearSelection(); | |
|
862 | impl->startDrawingZone(event->pos()); | |
|
863 | } | |
|
864 | else | |
|
865 | { | |
|
866 | parentVisualizationWidget()->selectionZoneManager().select({ selectedZone }); | |
|
867 | } | |
|
830 | 868 |
|
|
831 | 869 |
|
|
832 | 870 |
|
@@ -837,11 +875,6 void VisualizationGraphWidget::mousePressEvent(QMouseEvent *event) | |||
|
837 | 875 |
|
|
838 | 876 |
|
|
839 | 877 |
|
|
840 | } | |
|
841 | else if (event->button()==Qt::RightButton) | |
|
842 | { | |
|
843 | onGraphMenuRequested(event->pos()); | |
|
844 | } | |
|
845 | 878 | QWidget::mousePressEvent(event); |
|
846 | 879 | } |
|
847 | 880 | |
@@ -1128,7 +1161,7 void VisualizationGraphWidget::onMousePress(QMouseEvent *event) noexcept | |||
|
1128 | 1161 | // Starts a new selection zone |
|
1129 | 1162 | auto zoneAtPos = impl->selectionZoneAt(event->pos()); |
|
1130 | 1163 | if (!zoneAtPos) { |
|
1131 |
impl->startDrawingZone(event->pos() |
|
|
1164 | impl->startDrawingZone(event->pos()); | |
|
1132 | 1165 | } |
|
1133 | 1166 | } |
|
1134 | 1167 | } |
@@ -1191,7 +1224,7 void VisualizationGraphWidget::onMouseRelease(QMouseEvent *event) noexcept | |||
|
1191 | 1224 | } |
|
1192 | 1225 | } |
|
1193 | 1226 | |
|
1194 |
impl->endDrawingZone( |
|
|
1227 | impl->endDrawingZone(); | |
|
1195 | 1228 | |
|
1196 | 1229 | // Selection / Deselection |
|
1197 | 1230 | auto isSelectionZoneMode |
@@ -29,7 +29,6 ALIAS_TEMPLATE_FUNCTION(isReady, static_cast<SqpApplication *>(qApp)->variableCo | |||
|
29 | 29 | while (!isReady(var))\ |
|
30 | 30 | QCoreApplication::processEvents();\ |
|
31 | 31 | w.addVariable(var, range);\ |
|
32 | GET_CHILD_WIDGET_FOR_GUI_TESTS(w, plot, QCustomPlot, "widget");\ | |
|
33 | 32 | auto cent = center(&w); |
|
34 | 33 | |
|
35 | 34 |
General Comments 0
You need to be logged in to leave comments.
Login now