libpappsomspp
Library for mass spectrometry
Loading...
Searching...
No Matches
baseplotcontext.cpp
Go to the documentation of this file.
1// Copyright 2021 Filippo Rusconi
2// GPL3+
3
4#include "baseplotcontext.h"
8
9namespace pappso
10{
11
12std::map<Qt::MouseButton, QString> qtMouseButtonMap{
13 {Qt::NoButton, "NoButton"},
14 {Qt::LeftButton, "LeftButton"},
15 {Qt::RightButton, "RightButton"},
16 {Qt::MiddleButton, "MiddleButton"}};
17
18std::map<Qt::MouseButtons, QString> qtMouseButtonsMap{
19 {Qt::NoButton, "NoButton"},
20 {Qt::AllButtons, "AllButtons"},
21 {Qt::LeftButton, "LeftButton"},
22 {Qt::RightButton, "RightButton"},
23 {Qt::MiddleButton, "MiddleButton"},
24 {Qt::LeftButton | Qt::RightButton, "LeftRightButtons"},
25 {Qt::LeftButton | Qt::MiddleButton, "LeftMiddleButtons"},
26 {Qt::RightButton | Qt::MiddleButton, "RightMiddleButtons"},
27};
28
29std::map<Qt::KeyboardModifier, QString> qtKeyboardModifierMap{
30 {Qt::NoModifier, "No modifier"},
31 {Qt::ShiftModifier, "A Shift key"},
32 {Qt::ControlModifier, "A Ctrl key"},
33 {Qt::AltModifier, "An Alt key"},
34 {Qt::MetaModifier, "A Meta key"},
35 {Qt::KeypadModifier, "A keypad button"},
36 {Qt::GroupSwitchModifier, "A Mode_switch key"}};
37
41
43{
44 // qDebug() << "Constructing BasePlotContext by copy.";
45 initialize(other);
46#if 0
47 m_dataKind = other.m_dataKind;
48
52
57
61
63
64 if(mpa_integrationScope != nullptr)
66 if(other.mpa_integrationScope != nullptr)
68
71
72 // The effective range of the axes.
73 m_xRange = other.m_xRange;
74 m_yRange = other.m_yRange;
75
76 // Tell if the mouse move was started onto either axis, because that will
77 // condition if some calculations needs to be performed or not (for example,
78 // if the mouse cursor motion was started on an axis, there is no point to
79 // perform deconvolutions).
82
84
85 // The user-selected region over the plot.
86 // Note that we cannot use QCPRange structures because these are normalized by
87 // QCustomPlot in such a manner that lower is actually < upper. But we need
88 // for a number of our calculations (specifically for the deconvolutions) to
89 // actually have the lower value be start drag point.x even if the drag
90 // direction was from right to left.
93
96
97 m_xDelta = other.m_xDelta;
98 m_yDelta = other.m_yDelta;
99
106
108
111
113
116#endif
117}
118
124
127{
128 return new BasePlotContext(*this);
129}
130
131void
133{
134 m_dataKind = other.m_dataKind;
135
139
144
148
150
151 if(mpa_integrationScope != nullptr)
153 if(other.mpa_integrationScope != nullptr)
155
158
159 // The effective range of the axes.
160 m_xRange = other.m_xRange;
161 m_yRange = other.m_yRange;
162
163 // Tell if the mouse move was started onto either axis, because that will
164 // condition if some calculations needs to be performed or not (for example,
165 // if the mouse cursor motion was started on an axis, there is no point to
166 // perform deconvolutions).
169
171
172 // The user-selected region over the plot.
173 // Note that we cannot use QCPRange structures because these are normalized by
174 // QCustomPlot in such a manner that lower is actually < upper. But we need
175 // for a number of our calculations (specifically for the deconvolutions) to
176 // actually have the lower value be start drag point.x even if the drag
177 // direction was from right to left.
180
183
184 m_xDelta = other.m_xDelta;
185 m_yDelta = other.m_yDelta;
186
193
195
198
200
203}
204
205void
207{
208 // qDebug();
209
210 // By essence, IntegrationScope is 1D scope. The point of the scope is the
211 // left bottom point, and then we document the width.
212
213 double x_range_start = std::min(m_currentDragPoint.x(), m_startDragPoint.x());
214 double x_range_end = std::max(m_currentDragPoint.x(), m_startDragPoint.x());
215
216 double y_position = m_startDragPoint.y();
217
218 QPointF point(x_range_start, y_position);
219 double width = x_range_end - x_range_start;
220
221 // qDebug() << "Going to create an integration scope with point:" << point
222 // << "and width:" << width;
223
224 // Because the nature of the integration scope might change inside
225 // a given context, we need to delete and reallocate.
226 if(mpa_integrationScope != nullptr)
228
229 mpa_integrationScope = new IntegrationScope(point, width);
230
231 // qDebug() << "Created integration scope:" <<
232 // msp_integrationScope->toString();
233}
234
235void
237{
238 // qDebug();
239
240 // By essence, IntegrationScopeRect is a squared rectangle scope. The point of
241 // the scope is the left bottom point, and then we document the width and the
242 // height.
243
244 /* Like this:
245*
246+---------------------------+ -
247| | |
248| | |
249| | m_height
250| | |
251| | |
252P---------------------------+ -
253
254|--------- m_width ---------|
255
256*/
257
258 // We need to find the point that is actually the left bottom point.
259
260 QPointF point;
261 double width = 0;
262 double height = 0;
263
264 if(static_cast<int>(m_dragDirections) &
265 static_cast<int>(DragDirections::LEFT_TO_RIGHT) &&
266 static_cast<int>(m_dragDirections) &
267 static_cast<int>(DragDirections::BOTTOM_TO_TOP))
268 {
269 point.rx() = m_startDragPoint.x();
270 point.ry() = m_startDragPoint.y();
271 width = m_currentDragPoint.x() - point.rx();
272 height = m_currentDragPoint.y() - point.ry();
273 // qDebug() << "left to right - bottom to top";
274 }
275
276 if(static_cast<int>(m_dragDirections) &
277 static_cast<int>(DragDirections::RIGHT_TO_LEFT) &&
278 static_cast<int>(m_dragDirections) &
279 static_cast<int>(DragDirections::BOTTOM_TO_TOP))
280 {
281 point.rx() = m_currentDragPoint.x();
282 point.ry() = m_currentDragPoint.y();
283 width = m_startDragPoint.x() - m_currentDragPoint.x();
284 height = m_startDragPoint.y() - m_currentDragPoint.y();
285 // qDebug() << "right to left - bottom to top";
286 }
287
288 if(static_cast<int>(m_dragDirections) &
289 static_cast<int>(DragDirections::LEFT_TO_RIGHT) &&
290 static_cast<int>(m_dragDirections) &
291 static_cast<int>(DragDirections::TOP_TO_BOTTOM))
292 {
293 point.rx() = m_startDragPoint.x();
294 point.ry() = m_currentDragPoint.y();
295 width = m_currentDragPoint.x() - m_startDragPoint.x();
296 height = m_startDragPoint.y() - m_currentDragPoint.y();
297 // qDebug() << "left to right - top to bottom";
298 }
299
300 if(static_cast<int>(m_dragDirections) &
301 static_cast<int>(DragDirections::RIGHT_TO_LEFT) &&
302 static_cast<int>(m_dragDirections) &
303 static_cast<int>(DragDirections::TOP_TO_BOTTOM))
304 {
305 point.rx() = m_currentDragPoint.x();
306 point.ry() = m_currentDragPoint.y();
307 width = m_startDragPoint.x() - m_currentDragPoint.x();
308 height = m_startDragPoint.y() - m_currentDragPoint.y();
309 // qDebug() << "right to left - top to bottom";
310 }
311
312 // qDebug() << "The data used to update the integration scope:";
313 // qDebug() << "Point:" << point << "width:" << width << "height:" << height;
314 //
315 // qDebug() << "The integration scope before update:" << mpa_integrationScope;
316 //
317 // qDebug() << "Will update IntegrationScopeRect with:" << point << "width"
318 // << width << "height" << height;
319
320 // Because the nature of the integration scope might change inside
321 // a given context, we need to delete and reallocate.
322 if(mpa_integrationScope != nullptr)
324 mpa_integrationScope = new IntegrationScopeRect(point, width, height);
325
326 // if(typeid(*mpa_integrationScope) == typeid(IntegrationScopeInterface))
327 // qDebug() << "The pointer is of type IntegrationScopeInterface";
328 // if(typeid(*mpa_integrationScope) == typeid(IntegrationScope))
329 // qDebug() << "The pointer is of type IntegrationScope";
330 // if(typeid(*mpa_integrationScope) == typeid(IntegrationScopeRect))
331 // qDebug() << "The pointer is of type IntegrationScopeRect";
332 // if(typeid(*mpa_integrationScope) == typeid(IntegrationScopeRhomb))
333 // qDebug() << "The pointer is of type IntegrationScopeRhomb";
334 //
335 // qDebug() << "The integration scope right after update:"
336 // << mpa_integrationScope;
337 //
338 // if(!mpa_integrationScope->getPoint(point))
339 // qFatal("Could not get point.");
340 // qDebug() << "The point:" << point;
341 // if(!mpa_integrationScope->getWidth(width))
342 // qFatal("Oh no!!!! width");
343 // if(!mpa_integrationScope->getWidth(height))
344 // qFatal("Oh no!!!! height");
345}
346
347void
349{
350 // qDebug() << toString();
351
352 /*
353 4+----------+3
354 | |
355 | |
356 | |
357 | |
358 | |
359 | |
360 | |
361 1+----------+2
362 ----width---
363*/
364
365 // As visible here, the fixed size of the rhomboid (using the S key in the
366 // plot widget) is the horizontal side.
367
368 // The points are numbered in a counterclockwise manner, starting from the
369 // starting drag point. The width side is right of the start drag point if
370 // the user drags from left to right and left of the start drag point if
371 // the user drags from left to right. In the figure above, the user
372 // has dragged the mouse from point 1 and to the right and upwards.
373 // Thus the width side is right of point 1. Because the numbering
374 // is counterclockwise, that point happens to be numbered 2.
375
376 // If the user had draggged the mouse starting at point 3 and to the left
377 // and to the bottom, then point 3 above would be point 1, point 4
378 // would be point 2 because the width side is left of the start
379 // drag point; point 1 would be point 3 and finally the last point
380 // would be at point 2.
381
382 // Sanity check
384 qFatal(
385 "The m_integrationScopeRhombWidth of the fixed rhomboid side cannot be "
386 "0.");
387
388 QPointF point;
389 std::vector<QPointF> points;
390
391 // Fill-in the points in the vector in the order they are created
392 // while drawing the rhomboid shape. Thus, the first point (start of the
393 // mouse click & drag operation is always the same.
394
395 point.rx() = m_startDragPoint.x();
396 point.ry() = m_startDragPoint.y();
397 points.push_back(point);
398 // qDebug() << "Start point:" << point;
399
400 if(static_cast<int>(m_dragDirections) &
401 static_cast<int>(DragDirections::LEFT_TO_RIGHT) &&
402 static_cast<int>(m_dragDirections) &
403 static_cast<int>(DragDirections::BOTTOM_TO_TOP))
404 {
405 // Second point.
407 point.ry() = m_startDragPoint.y();
408 points.push_back(point);
409 // qDebug() << "Second point:" << point;
410
411 // Third point.
413 point.ry() = m_currentDragPoint.ry();
414 points.push_back(point);
415 // qDebug() << "Third point:" << point;
416
417 // Fourth point.
418 point.rx() = m_currentDragPoint.rx();
419 point.ry() = m_currentDragPoint.ry();
420 points.push_back(point);
421 // qDebug() << "Last point:" << point;
422 }
423
424 if(static_cast<int>(m_dragDirections) &
425 static_cast<int>(DragDirections::RIGHT_TO_LEFT) &&
426 static_cast<int>(m_dragDirections) &
427 static_cast<int>(DragDirections::BOTTOM_TO_TOP))
428 {
429 // Second point.
430 point.rx() = m_currentDragPoint.rx();
431 point.ry() = m_currentDragPoint.ry();
432 points.push_back(point);
433 // qDebug() << "Second point:" << point;
434
435 // Third point.
437 point.ry() = m_currentDragPoint.ry();
438 points.push_back(point);
439 // qDebug() << "Third point:" << point;
440
441 // Fourth point.
443 point.ry() = m_startDragPoint.ry();
444 points.push_back(point);
445 // qDebug() << "Last point:" << point;
446 }
447
448 if(static_cast<int>(m_dragDirections) &
449 static_cast<int>(DragDirections::LEFT_TO_RIGHT) &&
450 static_cast<int>(m_dragDirections) &
451 static_cast<int>(DragDirections::TOP_TO_BOTTOM))
452 {
453 // Second point.
454 point.rx() = m_currentDragPoint.rx();
455 point.ry() = m_currentDragPoint.ry();
456 points.push_back(point);
457 // qDebug() << "Second point:" << point;
458
459 // Third point.
461 point.ry() = m_currentDragPoint.ry();
462 points.push_back(point);
463 // qDebug() << "Third point:" << point;
464
465 // Fourth point.
467 point.ry() = m_startDragPoint.y();
468 points.push_back(point);
469 // qDebug() << "Last point:" << point;
470 }
471
472 if(static_cast<int>(m_dragDirections) &
473 static_cast<int>(DragDirections::RIGHT_TO_LEFT) &&
474 static_cast<int>(m_dragDirections) &
475 static_cast<int>(DragDirections::TOP_TO_BOTTOM))
476 {
477 // Second point.
479 point.ry() = m_startDragPoint.y();
480 points.push_back(point);
481 // qDebug() << "Second point:" << point;
482
483 // Third point.
485 point.ry() = m_currentDragPoint.ry();
486 points.push_back(point);
487 // qDebug() << "Third point:" << point;
488
489 // Fourth point.
490 point.rx() = m_currentDragPoint.rx();
491 point.ry() = m_currentDragPoint.ry();
492 points.push_back(point);
493 // qDebug() << "Last point:" << point;
494 }
495
496 // Because the nature of the integration scope might change inside
497 // a given context, we need to delete and reallocate.
498 if(mpa_integrationScope != nullptr)
500
502
503 // qDebug() << "Created an integration scope horizontal rhomboid with"
504 // << points.size() << "points:" << msp_integrationScope->toString();
505}
506
507void
509{
510 // qDebug() << toString();
511
512 /*
513 * +3
514 * . |
515 * . |
516 * . |
517 * . +2
518 * . .
519 * . .
520 * . .
521 * 4+ .
522 * | | .
523 * height | | .
524 * | | .
525 * 1+
526 *
527 */
528
529 // As visible here, the fixed size of the rhomboid (using the S key in the
530 // plot widget) is the vertical side.
531
532 // The points are numbered in a counterclockwise manner, starting from the
533 // starting drag point. The height side is below the start drag point if
534 // the user drags from top to bottom and above the start drag point if
535 // the user drags from bottom to top. In the figure above, the user
536 // has dragged the mouse from point 1 and to the right and upwards.
537 // Thus the height side is above the point 1. Because the numbering
538 // is counterclockwise, that point happens to be numbered 4.
539
540 // If the user had draggged the mouse starting at point 3 and to the left
541 // and to the bottom, then point 3 above would be point 1, point 4
542 // would be ponit 2, point 1 would be point 3 and finally, because
543 // the dragging is from top to bottom, the last point would be at point 2
544 // above, because the height side of the rhomboid is below the start
545 // drag point.
546
547 // Sanity check
549 qFatal("The height of the fixed rhomboid side cannot be 0.");
550
551 QPointF point;
552 std::vector<QPointF> points;
553
554 // Fill-in the points in the vector in the order they are created
555 // while drawing the rhomboid shape. Thus, the first point (start of the
556 // mouse click & drag operation is always the same, the leftmost bottom point
557 // of the drawing above (point 1).
558
559 point.rx() = m_startDragPoint.x();
560 point.ry() = m_startDragPoint.y();
561 points.push_back(point);
562 // qDebug() << "Start point:" << point;
563
564 if(static_cast<int>(m_dragDirections) &
565 static_cast<int>(DragDirections::LEFT_TO_RIGHT) &&
566 static_cast<int>(m_dragDirections) &
567 static_cast<int>(DragDirections::BOTTOM_TO_TOP))
568 {
569 // Second point.
570 point.rx() = m_currentDragPoint.rx();
571 point.ry() = m_currentDragPoint.ry();
572 points.push_back(point);
573 // qDebug() << "Second point:" << point;
574
575 // Third point.
576 point.rx() = m_currentDragPoint.rx();
578 points.push_back(point);
579 // qDebug() << "Third point:" << point;
580
581 // Fourth point.
582 point.rx() = m_startDragPoint.x();
584 points.push_back(point);
585 // qDebug() << "Last point:" << point;
586 }
587
588 if(static_cast<int>(m_dragDirections) &
589 static_cast<int>(DragDirections::RIGHT_TO_LEFT) &&
590 static_cast<int>(m_dragDirections) &
591 static_cast<int>(DragDirections::BOTTOM_TO_TOP))
592 {
593 // Second point.
594 point.rx() = m_startDragPoint.rx();
596 points.push_back(point);
597 // qDebug() << "Second point:" << point;
598
599 // Third point.
600 point.rx() = m_currentDragPoint.rx();
602 points.push_back(point);
603 // qDebug() << "Third point:" << point;
604
605 // Fourth point.
606 point.rx() = m_currentDragPoint.x();
607 point.ry() = m_currentDragPoint.y();
608 points.push_back(point);
609 // qDebug() << "Last point:" << point;
610 }
611
612 if(static_cast<int>(m_dragDirections) &
613 static_cast<int>(DragDirections::LEFT_TO_RIGHT) &&
614 static_cast<int>(m_dragDirections) &
615 static_cast<int>(DragDirections::TOP_TO_BOTTOM))
616 {
617 // Second point.
618 point.rx() = m_startDragPoint.x();
620 points.push_back(point);
621 // qDebug() << "Second point:" << point;
622
623 // Third point.
624 point.rx() = m_currentDragPoint.rx();
626 points.push_back(point);
627 // qDebug() << "Third point:" << point;
628
629 // Fourth point.
630 point.rx() = m_currentDragPoint.rx();
631 point.ry() = m_currentDragPoint.ry();
632 points.push_back(point);
633 // qDebug() << "Last point:" << point;
634 }
635
636 if(static_cast<int>(m_dragDirections) &
637 static_cast<int>(DragDirections::RIGHT_TO_LEFT) &&
638 static_cast<int>(m_dragDirections) &
639 static_cast<int>(DragDirections::TOP_TO_BOTTOM))
640 {
641 // Second point.
642 point.rx() = m_currentDragPoint.rx();
643 point.ry() = m_currentDragPoint.ry();
644 points.push_back(point);
645 // qDebug() << "Second point:" << point;
646
647 // Third point.
648 point.rx() = m_currentDragPoint.rx();
650 points.push_back(point);
651 // qDebug() << "Third point:" << point;
652
653 // Fourth point.
654 point.rx() = m_startDragPoint.rx();
656 points.push_back(point);
657 // qDebug() << "Last point:" << point;
658 }
659
660 // Because the nature of the integration scope might change inside
661 // a given context, we need to delete and reallocate.
662 if(mpa_integrationScope != nullptr)
664
666
667 // qDebug() << "Created an integration scope vertical rhomboid with"
668 // << points.size() << "points:" << msp_integrationScope->toString();
669}
670
671void
673{
674 // qDebug() << toString();
675
676 // By essence, IntegrationScopeRhomb is a rhomboid polygon. Just set the
677 // points. There are two kinds of rhomboid integration scopes: horizontal and
678 // vertical.
679
680 /*
681 +----------+
682 | |
683 | |
684 | |
685 | |
686 | |
687 | |
688 | |
689 +----------+
690 ----width---
691*/
692
693 // As visible here, the fixed size of the rhomboid (using the S key in the
694 // plot widget) is the *horizontal* side (that is, the rhomboid has a non-0
695 // width)..
696
697 // However, it might be useful to be able to draw rhomboid integration scopes
698 // like this, that would correspond to the rhomboid above after a transpose
699 // operation.
700
701 /*
702 +
703 . |
704 . |
705 . |
706 . +
707 . .
708 . .
709 . .
710 + .
711 | | .
712 height | | .
713 | | .
714 +
715
716*/
717
718 // As visible here, the fixed size of the rhomboid (using the S key in the
719 // plot widget) is the vertical side (that is, the rhomboid has a non-0
720 // height).
721
722 // The general rule is thus that when the m_integrationScopeRhombWidth is
723 // not-0, then the first shape is considered, while when the
724 // m_integrationScopeRhombHeight is non-0, then the second shape is
725 // considered.
726
727 // This function is called when the user has dragged the cursor (left or right
728 // button, not for or for integration, respectively) with the 'Alt' modifier
729 // key pressed, so that they want to perform a rhomboid integration scope
730 // calculation.
731
732 // Of course, the integration scope in the context might not be a rhomboid
733 // scope, because we might enter this function as a very firt switch from
734 // scope or scopeRect to scopeRhomb. The only indication we have to direct the
735 // creation of a horizontal or vertical rhomboid is the
736 // m_integrationScopeRhombWidth/m_integrationScopeRhombHeight recorded in the
737 // plot widget that owns this plot context.
738
739 // qDebug() << "In updateIntegrationScopeRhomb, m_integrationScopeRhombWidth:"
740 // << m_integrationScopeRhombWidth
741 // << "and m_integrationScopeRhombHeight:"
742 // << m_integrationScopeRhombHeight;
743
745 qFatal(
746 "Both m_integrationScopeRhombWidth and m_integrationScopeRhombHeight of "
747 "rhomboid integration scope cannot be 0.");
748
753}
754
757{
758 if(this == &other)
759 return *this;
760
761 m_dataKind = other.m_dataKind;
762
765
770
774
779
780 // The effective range of the axes.
781 m_xRange = other.m_xRange;
782 m_yRange = other.m_yRange;
783
784 // Tell if the mouse move was started onto either axis, because that will
785 // condition if some calculations needs to be performed or not (for example,
786 // if the mouse cursor motion was started on an axis, there is no point to
787 // perform deconvolutions).
790
792
793 // The user-selected region over the plot.
794 // Note that we cannot use QCPRange structures because these are normalized by
795 // QCustomPlot in such a manner that lower is actually < upper. But we need
796 // for a number of our calculations (specifically for the deconvolutions) to
797 // actually have the lower value be start drag point.x even if the drag
798 // direction was from right to left.
801
804
805 m_xDelta = other.m_xDelta;
806 m_yDelta = other.m_yDelta;
807
812
814
817
819
822
823 return *this;
824}
825
828{
829 int drag_directions = static_cast<int>(DragDirections::NOT_SET);
830
832 drag_directions |= static_cast<int>(DragDirections::LEFT_TO_RIGHT);
833 else
834 drag_directions |= static_cast<int>(DragDirections::RIGHT_TO_LEFT);
835
837 drag_directions |= static_cast<int>(DragDirections::BOTTOM_TO_TOP);
838 else
839 drag_directions |= static_cast<int>(DragDirections::TOP_TO_BOTTOM);
840
841 // qDebug() << "DragDirections:" << drag_directions;
842
843 m_dragDirections = static_cast<DragDirections>(drag_directions);
844
845 return static_cast<DragDirections>(drag_directions);
846}
847
848QString
850{
851 QString text("Context:");
852
853 text += QString(" data kind: %1").arg(static_cast<int>(m_dataKind));
854
855 text += QString(" -- isMouseDragging: %1 -- wasMouseDragging: %2")
856 .arg(m_isMouseDragging ? "true" : "false")
857 .arg(m_wasMouseDragging ? "true" : "false");
858
859 text += QString(" -- startDragPoint : (%1, %2)")
860 .arg(m_startDragPoint.x())
861 .arg(m_startDragPoint.y());
862
863 text += QString(" -- currentDragPoint : (%1, %2)")
864 .arg(m_currentDragPoint.x())
865 .arg(m_currentDragPoint.y());
866
867 text += QString(" -- lastCursorHoveredPoint : (%1, %2)")
869 .arg(m_lastCursorHoveredPoint.y());
870
871 text += dragDirectionsToString();
872
873 if(mpa_integrationScope != nullptr)
874 {
875 // The integration scope
876 text += " -- Integration scope: ";
877 text += mpa_integrationScope->toString();
878 text += " -- ";
879 }
880
881 text += QString(" -- xRange: (%1, %2)").arg(m_xRange.lower).arg(m_xRange.upper);
882
883 text +=
884 QString(" -- yRange: (%1, %2)").arg(m_yRange.lower).arg(m_yRange.upper);
885
886 text += QString(" -- wasClickOnXAxis: %1")
887 .arg(m_wasClickOnXAxis ? "true" : "false");
888 text += QString(" -- wasClickOnYAxis: %1")
889 .arg(m_wasClickOnYAxis ? "true" : "false");
890 text += QString(" -- isMeasuringDistance: %1")
891 .arg(m_isMeasuringDistance ? "true" : "false");
892
893 text += QString(" -- xRegionRangeStart: %1 -- xRegionRangeEnd: %2")
895 .arg(m_xRegionRangeStop);
896
897 text += QString(" -- yRegionRangeStart: %1 -- yRegionRangeEnd: %2")
899 .arg(m_yRegionRangeStop);
900
901 text += QString(" -- xDelta: %1 -- yDelta: %2").arg(m_xDelta).arg(m_yDelta);
902
903 text += QString(" -- pressedKeyCode: %1").arg(m_pressedKeyCode);
904
905 if(m_pressedKeyCodes.size())
906 {
907 for(int key : m_pressedKeyCodes)
908 text += QString(" -- pressedKeyCodes key: %1").arg(key);
909 }
910
911 text += QString(" -- releasedKeyCode: %1").arg(m_releasedKeyCode);
912
913 if(m_releasedKeyCodes.size())
914 {
915 for(int key : m_releasedKeyCodes)
916 text += QString(" -- releasedKeyCodes key: %1").arg(key);
917 }
918
919 // Qt::NoModifier0x00000000No modifier key is pressed.
920 // Qt::ShiftModifier0x02000000A Shift key on the keyboard is pressed.
921 // Qt::ControlModifier0x04000000A Ctrl key on the keyboard is pressed.
922 // Qt::AltModifier0x08000000An Alt key on the keyboard is pressed.
923 // Qt::MetaModifier0x10000000A Meta key on the keyboard is pressed.
924 // Qt::KeypadModifier0x20000000A keypad button is pressed.
925 // Qt::GroupSwitchModifier0x40000000X11 only (unless activated on Windows by a
926 // command line argument).
927 // A Mode_switch key on the keyboard is
928 // pressed.
929
930 text += QString(" -- keyboardModifiers: ");
931
932 if(m_keyboardModifiers == Qt::NoModifier)
933 text += QString("%1 - ").arg(qtKeyboardModifierMap[Qt::NoModifier]);
934
935 if(static_cast<int>(m_keyboardModifiers) & Qt::ShiftModifier)
936 text += QString("%1 - ").arg(qtKeyboardModifierMap[Qt::ShiftModifier]);
937
938 if(static_cast<int>(m_keyboardModifiers) & Qt::ControlModifier)
939 text += QString("%1 - ").arg(qtKeyboardModifierMap[Qt::ControlModifier]);
940
941 if(static_cast<int>(m_keyboardModifiers) & Qt::AltModifier)
942 text += QString("%1 - ").arg(qtKeyboardModifierMap[Qt::AltModifier]);
943
944 if(static_cast<int>(m_keyboardModifiers) & Qt::MetaModifier)
945 text += QString("%1 - ").arg(qtKeyboardModifierMap[Qt::MetaModifier]);
946
947 if(static_cast<int>(m_keyboardModifiers) & Qt::KeypadModifier)
948 text += QString("%1 - ").arg(qtKeyboardModifierMap[Qt::KeypadModifier]);
949
950 if(static_cast<int>(m_keyboardModifiers) & Qt::GroupSwitchModifier)
951 text +=
952 QString("%1 - ").arg(qtKeyboardModifierMap[Qt::GroupSwitchModifier]);
953
954 text += QString(" -- lastPressedMouseButton: %1")
956
957 text += QString(" -- lastReleasedMouseButton: %1")
959
960 text += QString(" -- pressedMouseButtons: %1")
962
963 text += QString(" -- mouseButtonsAtMousePress: %1")
965
966 text += QString(" -- mouseButtonsAtMouseRelease: %1")
968
969 return text;
970}
971
972QString
974{
975 QString text;
976
977 // Document how the mouse cursor is being dragged.
979 {
980 if(static_cast<int>(m_dragDirections) &
981 static_cast<int>(DragDirections::LEFT_TO_RIGHT))
982 text += " -- dragging from left to right";
983 else if(static_cast<int>(m_dragDirections) &
984 static_cast<int>(DragDirections::RIGHT_TO_LEFT))
985 text += " -- dragging from right to left";
986 if(static_cast<int>(m_dragDirections) &
987 static_cast<int>(DragDirections::TOP_TO_BOTTOM))
988 text += " -- dragging from top to bottom";
989 if(static_cast<int>(m_dragDirections) &
990 static_cast<int>(DragDirections::BOTTOM_TO_TOP))
991 text += " -- dragging from bottom to top";
992 }
993
994 return text;
995}
996
997
998} // namespace pappso
Qt::MouseButtons m_mouseButtonsAtMousePress
SelectionPolygon m_selectionPolygon
QString dragDirectionsToString() const
DragDirections recordDragDirections()
Enums::DataKind m_dataKind
Qt::KeyboardModifiers m_keyboardModifiers
Qt::MouseButtons m_lastPressedMouseButton
DragDirections m_dragDirections
void initialize(const BasePlotContext &other)
IntegrationScopeBase * mpa_integrationScope
Qt::MouseButtons m_pressedMouseButtons
Qt::MouseButtons m_mouseButtonsAtMouseRelease
BasePlotContext & operator=(const BasePlotContext &other)
Qt::MouseButtons m_lastReleasedMouseButton
BasePlotContext * clone()
virtual IntegrationScopeBase * clone() const
tries to keep as much as possible monoisotopes, removing any possible C13 peaks and changes multichar...
Definition aa.cpp:39
std::map< Qt::MouseButton, QString > qtMouseButtonMap
std::map< Qt::MouseButtons, QString > qtMouseButtonsMap
std::map< Qt::KeyboardModifier, QString > qtKeyboardModifierMap