Qt
Internal/Contributor docs for the Qt SDK. <b>Note:</b> These are NOT official API docs; those are found <a href='https://doc.qt.io/'>here</a>.
Loading...
Searching...
No Matches
qrubberband.h
Go to the documentation of this file.
1// Copyright (C) 2016 The Qt Company Ltd.
2// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR LGPL-3.0-only OR GPL-2.0-only OR GPL-3.0-only
3
4#ifndef QRUBBERBAND_H
5#define QRUBBERBAND_H
6
7#include <QtWidgets/qtwidgetsglobal.h>
8#include <QtWidgets/qwidget.h>
9
11
13
15class QStyleOptionRubberBand;
16
17class Q_WIDGETS_EXPORT QRubberBand : public QWidget
18{
20
21public:
22 enum Shape { Line, Rectangle };
23 explicit QRubberBand(Shape, QWidget * = nullptr);
25
26 Shape shape() const;
27
28 void setGeometry(const QRect &r);
29
30 inline void setGeometry(int x, int y, int w, int h);
31 inline void move(int x, int y);
32 inline void move(const QPoint &p)
33 { move(p.x(), p.y()); }
34 inline void resize(int w, int h)
35 { setGeometry(geometry().x(), geometry().y(), w, h); }
36 inline void resize(const QSize &s)
37 { resize(s.width(), s.height()); }
38
39protected:
40 bool event(QEvent *e) override;
41 void paintEvent(QPaintEvent *) override;
42 void changeEvent(QEvent *) override;
43 void showEvent(QShowEvent *) override;
44 void resizeEvent(QResizeEvent *) override;
45 void moveEvent(QMoveEvent *) override;
46 virtual void initStyleOption(QStyleOptionRubberBand *option) const;
47
48private:
49 Q_DECLARE_PRIVATE(QRubberBand)
50};
51
52inline void QRubberBand::setGeometry(int ax, int ay, int aw, int ah)
53{ setGeometry(QRect(ax, ay, aw, ah)); }
54inline void QRubberBand::move(int ax, int ay)
55{ setGeometry(ax, ay, width(), height()); }
56
58
59#endif // QRUBBERBAND_H
\inmodule QtCore
Definition qcoreevent.h:45
The QMoveEvent class contains event parameters for move events.
Definition qevent.h:502
The QPaintEvent class contains event parameters for paint events.
Definition qevent.h:486
\inmodule QtCore\reentrant
Definition qpoint.h:25
\inmodule QtCore\reentrant
Definition qrect.h:30
The QResizeEvent class contains event parameters for resize events.
Definition qevent.h:548
The QRubberBand class provides a rectangle or line that can indicate a selection or a boundary.
Definition qrubberband.h:18
Shape
This enum specifies what shape a QRubberBand should have.
Definition qrubberband.h:22
void move(const QPoint &p)
This is an overloaded member function, provided for convenience. It differs from the above function o...
Definition qrubberband.h:32
void move(int x, int y)
Moves the rubberband to point (x, y).
Definition qrubberband.h:54
void setGeometry(const QRect &r)
Sets the geometry of the rubber band to rect, specified in the coordinate system of its parent widget...
void resize(int w, int h)
Resizes the rubberband so that its width is width, and its height is height.
Definition qrubberband.h:34
void resize(const QSize &s)
This is an overloaded member function, provided for convenience. It differs from the above function o...
Definition qrubberband.h:36
The QShowEvent class provides an event that is sent when a widget is shown.
Definition qevent.h:578
\inmodule QtCore
Definition qsize.h:25
The QWidget class is the base class of all user interface objects.
Definition qwidget.h:99
int width
the width of the widget excluding any window frame
Definition qwidget.h:114
int height
the height of the widget excluding any window frame
Definition qwidget.h:115
a resize(100000)
Combined button and popup list for selecting options.
GLint GLint GLint GLint GLint x
[0]
GLfloat GLfloat GLfloat w
[0]
GLboolean r
[2]
GLint y
GLfloat GLfloat GLfloat GLfloat h
struct _cl_event * event
GLdouble s
[6]
Definition qopenglext.h:235
GLfloat GLfloat p
[1]
GLuint GLenum option
#define QT_REQUIRE_CONFIG(feature)
#define Q_OBJECT