Qt
Internal/Contributor docs for the Qt SDK. Note: These are NOT official API docs; those are found at https://doc.qt.io/
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
12QT_BEGIN_NAMESPACE
13
14class QRubberBandPrivate;
15class QStyleOptionRubberBand;
16
17class Q_WIDGETS_EXPORT QRubberBand : public QWidget
18{
19 Q_OBJECT
20
21public:
22 enum Shape { Line, Rectangle };
23 explicit QRubberBand(Shape, QWidget * = nullptr);
24 ~QRubberBand();
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
57QT_END_NAMESPACE
58
59#endif // QRUBBERBAND_H
The QRubberBand class provides a rectangle or line that can indicate a selection or a boundary.
Definition qrubberband.h:18
The QStyleHintReturnMask class provides style hints that return a QRegion.
Combined button and popup list for selecting options.
QT_REQUIRE_CONFIG(itemmodel)
#define RUBBERBAND_WINDOW_TYPE