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// Qt-Security score:significant reason:default
4
5#ifndef QRUBBERBAND_H
6#define QRUBBERBAND_H
7
8#include <QtWidgets/qtwidgetsglobal.h>
9#include <QtWidgets/qwidget.h>
10
12
13QT_BEGIN_NAMESPACE
14
15class QRubberBandPrivate;
16class QStyleOptionRubberBand;
17
18class Q_WIDGETS_EXPORT QRubberBand : public QWidget
19{
20 Q_OBJECT
21
22public:
23 enum Shape { Line, Rectangle };
24 explicit QRubberBand(Shape, QWidget * = nullptr);
25 ~QRubberBand();
26
27 Shape shape() const;
28
29 void setGeometry(const QRect &r);
30
31 inline void setGeometry(int x, int y, int w, int h);
32 inline void move(int x, int y);
33 inline void move(const QPoint &p)
34 { move(p.x(), p.y()); }
35 inline void resize(int w, int h)
36 { setGeometry(geometry().x(), geometry().y(), w, h); }
37 inline void resize(const QSize &s)
38 { resize(s.width(), s.height()); }
39
40protected:
41 bool event(QEvent *e) override;
42 void paintEvent(QPaintEvent *) override;
43 void changeEvent(QEvent *) override;
44 void showEvent(QShowEvent *) override;
45 void resizeEvent(QResizeEvent *) override;
46 void moveEvent(QMoveEvent *) override;
47 virtual void initStyleOption(QStyleOptionRubberBand *option) const;
48
49private:
50 Q_DECLARE_PRIVATE(QRubberBand)
51};
52
53inline void QRubberBand::setGeometry(int ax, int ay, int aw, int ah)
54{ setGeometry(QRect(ax, ay, aw, ah)); }
55inline void QRubberBand::move(int ax, int ay)
56{ setGeometry(ax, ay, width(), height()); }
57
58QT_END_NAMESPACE
59
60#endif // QRUBBERBAND_H
The QRubberBand class provides a rectangle or line that can indicate a selection or a boundary.
Definition qrubberband.h:19
The QStyleHintReturnMask class provides style hints that return a QRegion.
QT_REQUIRE_CONFIG(thread)
#define RUBBERBAND_WINDOW_TYPE