File indexing completed on 2025-01-18 10:09:33
0001
0002
0003
0004 #ifndef QFRAME_H
0005 #define QFRAME_H
0006
0007 #include <QtWidgets/qtwidgetsglobal.h>
0008 #include <QtWidgets/qwidget.h>
0009
0010 QT_BEGIN_NAMESPACE
0011
0012
0013 class QFramePrivate;
0014 class QStyleOptionFrame;
0015
0016 class Q_WIDGETS_EXPORT QFrame : public QWidget
0017 {
0018 Q_OBJECT
0019
0020 Q_PROPERTY(Shape frameShape READ frameShape WRITE setFrameShape)
0021 Q_PROPERTY(Shadow frameShadow READ frameShadow WRITE setFrameShadow)
0022 Q_PROPERTY(int lineWidth READ lineWidth WRITE setLineWidth)
0023 Q_PROPERTY(int midLineWidth READ midLineWidth WRITE setMidLineWidth)
0024 Q_PROPERTY(int frameWidth READ frameWidth)
0025 Q_PROPERTY(QRect frameRect READ frameRect WRITE setFrameRect DESIGNABLE false)
0026
0027 public:
0028 explicit QFrame(QWidget* parent = nullptr, Qt::WindowFlags f = Qt::WindowFlags());
0029 ~QFrame();
0030
0031 int frameStyle() const;
0032 void setFrameStyle(int);
0033
0034 int frameWidth() const;
0035
0036 QSize sizeHint() const override;
0037
0038 enum Shape {
0039 NoFrame = 0,
0040 Box = 0x0001,
0041 Panel = 0x0002,
0042 WinPanel = 0x0003,
0043 HLine = 0x0004,
0044 VLine = 0x0005,
0045 StyledPanel = 0x0006
0046 };
0047 Q_ENUM(Shape)
0048 enum Shadow {
0049 Plain = 0x0010,
0050 Raised = 0x0020,
0051 Sunken = 0x0030
0052 };
0053 Q_ENUM(Shadow)
0054
0055 enum StyleMask {
0056 Shadow_Mask = 0x00f0,
0057 Shape_Mask = 0x000f
0058 };
0059
0060 Shape frameShape() const;
0061 void setFrameShape(Shape);
0062 Shadow frameShadow() const;
0063 void setFrameShadow(Shadow);
0064
0065 int lineWidth() const;
0066 void setLineWidth(int);
0067
0068 int midLineWidth() const;
0069 void setMidLineWidth(int);
0070
0071 QRect frameRect() const;
0072 void setFrameRect(const QRect &);
0073
0074 protected:
0075 bool event(QEvent *e) override;
0076 void paintEvent(QPaintEvent *) override;
0077 void changeEvent(QEvent *) override;
0078 void drawFrame(QPainter *);
0079
0080
0081 protected:
0082 QFrame(QFramePrivate &dd, QWidget* parent = nullptr, Qt::WindowFlags f = Qt::WindowFlags());
0083 virtual void initStyleOption(QStyleOptionFrame *option) const;
0084
0085 private:
0086 Q_DISABLE_COPY(QFrame)
0087 Q_DECLARE_PRIVATE(QFrame)
0088 };
0089
0090 Q_DECLARE_MIXED_ENUM_OPERATORS_SYMMETRIC(int, QFrame::Shape, QFrame::Shadow)
0091
0092 QT_END_NAMESPACE
0093
0094 #endif