Back to home page

EIC code displayed by LXR

 
 

    


File indexing completed on 2026-09-23 09:24:08

0001 // Copyright (C) 2016 The Qt Company Ltd.
0002 // SPDX-License-Identifier: LicenseRef-Qt-Commercial OR LGPL-3.0-only OR GPL-2.0-only OR GPL-3.0-only
0003 // Qt-Security score:significant reason:default
0004 
0005 #ifndef QRUBBERBAND_H
0006 #define QRUBBERBAND_H
0007 
0008 #include <QtWidgets/qtwidgetsglobal.h>
0009 #include <QtWidgets/qwidget.h>
0010 
0011 QT_REQUIRE_CONFIG(rubberband);
0012 
0013 QT_BEGIN_NAMESPACE
0014 
0015 class QRubberBandPrivate;
0016 class QStyleOptionRubberBand;
0017 
0018 class Q_WIDGETS_EXPORT QRubberBand : public QWidget
0019 {
0020     Q_OBJECT
0021 
0022 public:
0023     enum Shape { Line, Rectangle };
0024     explicit QRubberBand(Shape, QWidget * = nullptr);
0025     ~QRubberBand();
0026 
0027     Shape shape() const;
0028 
0029     void setGeometry(const QRect &r);
0030 
0031     inline void setGeometry(int x, int y, int w, int h);
0032     inline void move(int x, int y);
0033     inline void move(const QPoint &p)
0034     { move(p.x(), p.y()); }
0035     inline void resize(int w, int h)
0036     { setGeometry(geometry().x(), geometry().y(), w, h); }
0037     inline void resize(const QSize &s)
0038     { resize(s.width(), s.height()); }
0039 
0040 protected:
0041     bool event(QEvent *e) override;
0042     void paintEvent(QPaintEvent *) override;
0043     void changeEvent(QEvent *) override;
0044     void showEvent(QShowEvent *) override;
0045     void resizeEvent(QResizeEvent *) override;
0046     void moveEvent(QMoveEvent *) override;
0047     virtual void initStyleOption(QStyleOptionRubberBand *option) const;
0048 
0049 private:
0050     Q_DECLARE_PRIVATE(QRubberBand)
0051 };
0052 
0053 inline void QRubberBand::setGeometry(int ax, int ay, int aw, int ah)
0054 { setGeometry(QRect(ax, ay, aw, ah)); }
0055 inline void QRubberBand::move(int ax, int ay)
0056 { setGeometry(ax, ay, width(), height()); }
0057 
0058 QT_END_NAMESPACE
0059 
0060 #endif // QRUBBERBAND_H