Qt
Internal/Contributor docs for the Qt SDK. <b>Note:</b> These are NOT official API docs; those are found <a href='https://doc.qt.io/'>here</a>.
Loading...
Searching...
No Matches
qframe.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 QFRAME_H
5#define QFRAME_H
6
7#include <QtWidgets/qtwidgetsglobal.h>
8#include <QtWidgets/qwidget.h>
9
11
12
13class QFramePrivate;
15
16class Q_WIDGETS_EXPORT QFrame : public QWidget
17{
19
20 Q_PROPERTY(Shape frameShape READ frameShape WRITE setFrameShape)
21 Q_PROPERTY(Shadow frameShadow READ frameShadow WRITE setFrameShadow)
22 Q_PROPERTY(int lineWidth READ lineWidth WRITE setLineWidth)
23 Q_PROPERTY(int midLineWidth READ midLineWidth WRITE setMidLineWidth)
24 Q_PROPERTY(int frameWidth READ frameWidth)
25 Q_PROPERTY(QRect frameRect READ frameRect WRITE setFrameRect DESIGNABLE false)
26
27public:
28 explicit QFrame(QWidget* parent = nullptr, Qt::WindowFlags f = Qt::WindowFlags());
29 ~QFrame();
30
31 int frameStyle() const;
32 void setFrameStyle(int);
33
34 int frameWidth() const;
35
36 QSize sizeHint() const override;
37
38 enum Shape {
39 NoFrame = 0, // no frame
40 Box = 0x0001, // rectangular box
41 Panel = 0x0002, // rectangular panel
42 WinPanel = 0x0003, // rectangular panel (Windows)
43 HLine = 0x0004, // horizontal line
44 VLine = 0x0005, // vertical line
45 StyledPanel = 0x0006 // rectangular panel depending on the GUI style
46 };
47 Q_ENUM(Shape)
48 enum Shadow {
49 Plain = 0x0010, // plain line
50 Raised = 0x0020, // raised shadow effect
51 Sunken = 0x0030 // sunken shadow effect
52 };
53 Q_ENUM(Shadow)
54
55 enum StyleMask {
56 Shadow_Mask = 0x00f0, // mask for the shadow
57 Shape_Mask = 0x000f // mask for the shape
58 };
59
60 Shape frameShape() const;
61 void setFrameShape(Shape);
62 Shadow frameShadow() const;
63 void setFrameShadow(Shadow);
64
65 int lineWidth() const;
66 void setLineWidth(int);
67
68 int midLineWidth() const;
69 void setMidLineWidth(int);
70
71 QRect frameRect() const;
72 void setFrameRect(const QRect &);
73
74protected:
75 bool event(QEvent *e) override;
76 void paintEvent(QPaintEvent *) override;
77 void changeEvent(QEvent *) override;
78 void drawFrame(QPainter *);
79
80
81protected:
82 QFrame(QFramePrivate &dd, QWidget* parent = nullptr, Qt::WindowFlags f = Qt::WindowFlags());
83 virtual void initStyleOption(QStyleOptionFrame *option) const;
84
85private:
86 Q_DISABLE_COPY(QFrame)
87 Q_DECLARE_PRIVATE(QFrame)
88};
89
91
93
94#endif // QFRAME_H
\inmodule QtCore
Definition qcoreevent.h:45
The QFrame class is the base class of widgets that can have a frame.
Definition qframe.h:17
Shadow
This enum type defines the types of shadow that are used to give a 3D effect to frames.
Definition qframe.h:48
StyleMask
This enum defines two constants that can be used to extract the two components of frameStyle():
Definition qframe.h:55
Shape
This enum type defines the shapes of frame available.
Definition qframe.h:38
The QPaintEvent class contains event parameters for paint events.
Definition qevent.h:486
The QPainter class performs low-level painting on widgets and other paint devices.
Definition qpainter.h:46
\inmodule QtCore\reentrant
Definition qrect.h:30
\inmodule QtCore
Definition qsize.h:25
\variable QStyleOptionFocusRect::backgroundColor
The QWidget class is the base class of all user interface objects.
Definition qwidget.h:99
Combined button and popup list for selecting options.
Definition qcompare.h:63
#define Q_DECLARE_MIXED_ENUM_OPERATORS_SYMMETRIC(Ret, Flags, Enum)
Definition qflags.h:247
GLfloat GLfloat f
struct _cl_event * event
GLuint GLenum option
#define Q_ENUM(x)
#define Q_PROPERTY(...)
#define Q_OBJECT
#define explicit
label setLineWidth(2)
label setFrameStyle(QFrame::Panel|QFrame::Raised)