Back to home page

EIC code displayed by LXR

 
 

    


File indexing completed on 2025-01-18 10:09:37

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