Qt 4.8
qframe.h
Go to the documentation of this file.
1 /****************************************************************************
2 **
3 ** Copyright (C) 2014 Digia Plc and/or its subsidiary(-ies).
4 ** Contact: http://www.qt-project.org/legal
5 **
6 ** This file is part of the QtGui module of the Qt Toolkit.
7 **
8 ** $QT_BEGIN_LICENSE:LGPL$
9 ** Commercial License Usage
10 ** Licensees holding valid commercial Qt licenses may use this file in
11 ** accordance with the commercial license agreement provided with the
12 ** Software or, alternatively, in accordance with the terms contained in
13 ** a written agreement between you and Digia. For licensing terms and
14 ** conditions see http://qt.digia.com/licensing. For further information
15 ** use the contact form at http://qt.digia.com/contact-us.
16 **
17 ** GNU Lesser General Public License Usage
18 ** Alternatively, this file may be used under the terms of the GNU Lesser
19 ** General Public License version 2.1 as published by the Free Software
20 ** Foundation and appearing in the file LICENSE.LGPL included in the
21 ** packaging of this file. Please review the following information to
22 ** ensure the GNU Lesser General Public License version 2.1 requirements
23 ** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
24 **
25 ** In addition, as a special exception, Digia gives you certain additional
26 ** rights. These rights are described in the Digia Qt LGPL Exception
27 ** version 1.1, included in the file LGPL_EXCEPTION.txt in this package.
28 **
29 ** GNU General Public License Usage
30 ** Alternatively, this file may be used under the terms of the GNU
31 ** General Public License version 3.0 as published by the Free Software
32 ** Foundation and appearing in the file LICENSE.GPL included in the
33 ** packaging of this file. Please review the following information to
34 ** ensure the GNU General Public License version 3.0 requirements will be
35 ** met: http://www.gnu.org/copyleft/gpl.html.
36 **
37 **
38 ** $QT_END_LICENSE$
39 **
40 ****************************************************************************/
41 
42 #ifndef QFRAME_H
43 #define QFRAME_H
44 
45 #include <QtGui/qwidget.h>
46 
48 
50 
51 QT_MODULE(Gui)
52 
53 class QFramePrivate;
54 
55 class Q_GUI_EXPORT QFrame : public QWidget
56 {
57  Q_OBJECT
58 
60  Shape frameShape;
61  Shadow frameShadow;
62  int lineWidth;
63  int midLineWidth;
64  int frameWidth;
65  QRect frameRect;
66 
67 public:
68  explicit QFrame(QWidget* parent = 0, Qt::WindowFlags f = 0);
69  ~QFrame();
70 
71  int frameStyle() const;
72  void setFrameStyle(int);
73 
74  int frameWidth() const;
75 
76  QSize sizeHint() const;
77 
78  enum Shape {
79  NoFrame = 0, // no frame
80  Box = 0x0001, // rectangular box
81  Panel = 0x0002, // rectangular panel
82  WinPanel = 0x0003, // rectangular panel (Windows)
83  HLine = 0x0004, // horizontal line
84  VLine = 0x0005, // vertical line
85  StyledPanel = 0x0006 // rectangular panel depending on the GUI style
86 
87 #if defined(QT3_SUPPORT) && !defined(Q_MOC_RUN)
88  ,PopupPanel = StyledPanel, // rectangular panel depending on the GUI style
89  MenuBarPanel = StyledPanel,
90  ToolBarPanel = StyledPanel,
91  LineEditPanel = StyledPanel,
92  TabWidgetPanel = StyledPanel,
93  GroupBoxPanel = StyledPanel
94 #endif
95  };
96  enum Shadow {
97  Plain = 0x0010, // plain line
98  Raised = 0x0020, // raised shadow effect
99  Sunken = 0x0030 // sunken shadow effect
100  };
101 
102  enum StyleMask {
103  Shadow_Mask = 0x00f0, // mask for the shadow
104  Shape_Mask = 0x000f // mask for the shape
105 #if defined(QT3_SUPPORT)
106  ,MShadow = Shadow_Mask,
107  MShape = Shape_Mask
108 #endif
109  };
110 
111  Shape frameShape() const;
112  void setFrameShape(Shape);
113  Shadow frameShadow() const;
114  void setFrameShadow(Shadow);
115 
116  int lineWidth() const;
117  void setLineWidth(int);
118 
119  int midLineWidth() const;
120  void setMidLineWidth(int);
121 
122  QRect frameRect() const;
123  void setFrameRect(const QRect &);
124 
125 protected:
126  bool event(QEvent *e);
127  void paintEvent(QPaintEvent *);
128  void changeEvent(QEvent *);
129  void drawFrame(QPainter *);
130 
131 public:
132 #ifdef QT3_SUPPORT
133  QT3_SUPPORT_CONSTRUCTOR QFrame(QWidget* parent, const char* name, Qt::WindowFlags f = 0);
134 #endif
135 
136 protected:
137  QFrame(QFramePrivate &dd, QWidget* parent = 0, Qt::WindowFlags f = 0);
138 
139 private:
142 };
143 
145 
147 
148 #endif // QFRAME_H
The QPainter class performs low-level painting on widgets and other paint devices.
Definition: qpainter.h:86
#define QT_END_NAMESPACE
This macro expands to.
Definition: qglobal.h:90
#define QT_MODULE(x)
Definition: qglobal.h:2783
#define QT_BEGIN_HEADER
Definition: qglobal.h:136
#define Q_GUI_EXPORT
Definition: qglobal.h:1450
The QWidget class is the base class of all user interface objects.
Definition: qwidget.h:150
#define Q_DISABLE_COPY(Class)
Disables the use of copy constructors and assignment operators for the given Class.
Definition: qglobal.h:2523
Shape
This enum type defines the shapes of frame available.
Definition: qframe.h:78
#define Q_ENUMS(x)
Definition: qobjectdefs.h:84
virtual void paintEvent(QPaintEvent *)
This event handler can be reimplemented in a subclass to receive paint events passed in event...
Definition: qwidget.cpp:9548
#define QT_BEGIN_NAMESPACE
This macro expands to.
Definition: qglobal.h:89
Shadow
This enum type defines the types of shadow that are used to give a 3D effect to frames.
Definition: qframe.h:96
const char * name
virtual void changeEvent(QEvent *)
This event handler can be reimplemented to handle state changes.
Definition: qwidget.cpp:9170
#define Q_OBJECT
Definition: qobjectdefs.h:157
StyleMask
This enum defines two constants that can be used to extract the two components of frameStyle(): ...
Definition: qframe.h:102
The QRect class defines a rectangle in the plane using integer precision.
Definition: qrect.h:58
Definition: qnamespace.h:54
The QSize class defines the size of a two-dimensional object using integer point precision.
Definition: qsize.h:53
#define Q_DECLARE_PRIVATE(Class)
Definition: qglobal.h:2467
bool event(QEvent *)
This is the main event handler; it handles event event.
Definition: qwidget.cpp:8636
The QPaintEvent class contains event parameters for paint events.
Definition: qevent.h:298
The QEvent class is the base class of all event classes.
Definition: qcoreevent.h:56
The QFrame class is the base class of widgets that can have a frame.
Definition: qframe.h:55
#define QT_END_HEADER
Definition: qglobal.h:137