Go to the documentation of this file.
9 #include <QApplication>
20 , _mouse_pressed(false)
21 , _zoom_enabled(false)
22 , _keep_aspect_ratio(false)
60 QString theme = settings.value(
"Preferences::theme",
"light").toString();
61 const QPixmap& pixmap =
LoadSvg(
":/resources/svg/zoom_in.svg", theme);
62 QCursor zoom_cursor(pixmap.scaled(24, 24));
69 QApplication::setOverrideCursor(zoom_cursor);
76 QApplication::restoreOverrideCursor();
94 QApplication::restoreOverrideCursor();
99 QRect rect = QRect(pa[0], pa[
int(pa.count()) - 1]);
116 const QRectF cr =
canvas()->contentsRect();
117 const double canvas_ratio = cr.width() / cr.height();
120 if (zoom_ratio < canvas_ratio)
122 double new_width =
zoomRect.height() * canvas_ratio;
123 double increment = new_width -
zoomRect.width();
124 rect.setWidth(new_width);
125 rect.moveLeft(rect.left() - 0.5 * increment);
129 double new_height =
zoomRect.width() / canvas_ratio;
130 double increment = new_height -
zoomRect.height();
131 rect.setHeight(new_height);
132 rect.moveTop(rect.top() - 0.5 * increment);
virtual void widgetMousePressEvent(QMouseEvent *)
QwtPlotZoomer provides stacked zooming for a plot widget.
const QVector< MousePattern > & mousePattern() const
const QPixmap & LoadSvg(QString filename, QString style_name="light")
virtual bool accept(QPolygon &) const override
Check and correct a selected rectangle.
QRectF invTransform(const QRect &) const
@ RectRubberBand
A rectangle ( only for QwtPickerMachine::RectSelection )
@ AlwaysOff
Display never.
virtual void widgetMouseMoveEvent(QMouseEvent *event) override
virtual void zoom(const QRectF &rect) override
Zoom in.
virtual void widgetMouseMoveEvent(QMouseEvent *)
bool mouseMatch(MousePatternCode, const QMouseEvent *) const
Compare a mouse event with an event pattern.
virtual void widgetMousePressEvent(QMouseEvent *event) override
virtual void widgetMouseReleaseEvent(QMouseEvent *event) override
virtual QSizeF minZoomSize() const override
Limit zooming by a minimum rectangle.
void setRubberBandPen(const QPen &)
virtual void zoom(const QRectF &)
Zoom in.
virtual void widgetMouseReleaseEvent(QMouseEvent *)
QWidget * parentWidget()
Return the parent widget, where the selection happens.
void setRubberBand(RubberBand)
@ NoRubberBand
No rubberband.
void setTrackerMode(DisplayMode)
Set the display mode of the tracker.
virtual bool accept(QPolygon &) const QWT_OVERRIDE
Check and correct a selected rectangle.
A pattern for mouse events.
plotjuggler
Author(s): Davide Faconti
autogenerated on Mon Nov 11 2024 03:23:45