author | Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com> |
Fri, 12 Mar 2010 15:46:37 +0200 | |
branch | RCL_3 |
changeset 5 | d3bac044e0f0 |
parent 4 | 3b1da2848fc7 |
child 7 | 3f74d0d4af4c |
permissions | -rw-r--r-- |
0 | 1 |
/**************************************************************************** |
2 |
** |
|
4
3b1da2848fc7
Revision: 201003
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
3
diff
changeset
|
3 |
** Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies). |
0 | 4 |
** All rights reserved. |
5 |
** Contact: Nokia Corporation (qt-info@nokia.com) |
|
6 |
** |
|
7 |
** This file is part of the QtGui module of the Qt Toolkit. |
|
8 |
** |
|
9 |
** $QT_BEGIN_LICENSE:LGPL$ |
|
10 |
** No Commercial Usage |
|
11 |
** This file contains pre-release code and may not be distributed. |
|
12 |
** You may use this file in accordance with the terms and conditions |
|
13 |
** contained in the Technology Preview License Agreement accompanying |
|
14 |
** this package. |
|
15 |
** |
|
16 |
** GNU Lesser General Public License Usage |
|
17 |
** Alternatively, this file may be used under the terms of the GNU Lesser |
|
18 |
** General Public License version 2.1 as published by the Free Software |
|
19 |
** Foundation and appearing in the file LICENSE.LGPL included in the |
|
20 |
** packaging of this file. Please review the following information to |
|
21 |
** ensure the GNU Lesser General Public License version 2.1 requirements |
|
22 |
** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. |
|
23 |
** |
|
24 |
** In addition, as a special exception, Nokia gives you certain additional |
|
25 |
** rights. These rights are described in the Nokia Qt LGPL Exception |
|
26 |
** version 1.1, included in the file LGPL_EXCEPTION.txt in this package. |
|
27 |
** |
|
28 |
** If you have questions regarding the use of this file, please contact |
|
29 |
** Nokia at qt-info@nokia.com. |
|
30 |
** |
|
31 |
** |
|
32 |
** |
|
33 |
** |
|
34 |
** |
|
35 |
** |
|
36 |
** |
|
37 |
** |
|
38 |
** $QT_END_LICENSE$ |
|
39 |
** |
|
40 |
****************************************************************************/ |
|
41 |
||
42 |
#ifndef QGRAPHICSWIDGET_H |
|
43 |
#define QGRAPHICSWIDGET_H |
|
44 |
||
45 |
#include <QtGui/qfont.h> |
|
46 |
#include <QtGui/qgraphicslayoutitem.h> |
|
47 |
#include <QtGui/qgraphicsitem.h> |
|
48 |
#include <QtGui/qpalette.h> |
|
49 |
||
50 |
QT_BEGIN_HEADER |
|
51 |
||
52 |
QT_BEGIN_NAMESPACE |
|
53 |
||
54 |
QT_MODULE(Gui) |
|
55 |
||
56 |
class QFont; |
|
57 |
class QFontMetrics; |
|
58 |
class QGraphicsLayout; |
|
59 |
class QGraphicsSceneMoveEvent; |
|
60 |
class QGraphicsWidgetPrivate; |
|
61 |
class QGraphicsSceneResizeEvent; |
|
62 |
class QStyle; |
|
63 |
class QStyleOption; |
|
64 |
||
65 |
#if !defined(QT_NO_GRAPHICSVIEW) || (QT_EDITION & QT_MODULE_GRAPHICSVIEW) != QT_MODULE_GRAPHICSVIEW |
|
66 |
||
67 |
class QGraphicsWidgetPrivate; |
|
68 |
||
69 |
class Q_GUI_EXPORT QGraphicsWidget : public QGraphicsObject, public QGraphicsLayoutItem |
|
70 |
{ |
|
71 |
Q_OBJECT |
|
72 |
Q_INTERFACES(QGraphicsItem QGraphicsLayoutItem) |
|
73 |
Q_PROPERTY(QPalette palette READ palette WRITE setPalette) |
|
74 |
Q_PROPERTY(QFont font READ font WRITE setFont) |
|
75 |
Q_PROPERTY(Qt::LayoutDirection layoutDirection READ layoutDirection WRITE setLayoutDirection RESET unsetLayoutDirection) |
|
76 |
Q_PROPERTY(QSizeF size READ size WRITE resize) |
|
3
41300fa6a67c
Revision: 201003
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
0
diff
changeset
|
77 |
Q_PROPERTY(QSizeF minimumSize READ minimumSize WRITE setMinimumSize) |
41300fa6a67c
Revision: 201003
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
0
diff
changeset
|
78 |
Q_PROPERTY(QSizeF preferredSize READ preferredSize WRITE setPreferredSize) |
41300fa6a67c
Revision: 201003
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
0
diff
changeset
|
79 |
Q_PROPERTY(QSizeF maximumSize READ maximumSize WRITE setMaximumSize) |
41300fa6a67c
Revision: 201003
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
0
diff
changeset
|
80 |
Q_PROPERTY(QSizePolicy sizePolicy READ sizePolicy WRITE setSizePolicy) |
0 | 81 |
Q_PROPERTY(Qt::FocusPolicy focusPolicy READ focusPolicy WRITE setFocusPolicy) |
82 |
Q_PROPERTY(Qt::WindowFlags windowFlags READ windowFlags WRITE setWindowFlags) |
|
83 |
Q_PROPERTY(QString windowTitle READ windowTitle WRITE setWindowTitle) |
|
84 |
Q_PROPERTY(QRectF geometry READ geometry WRITE setGeometry) |
|
85 |
public: |
|
86 |
QGraphicsWidget(QGraphicsItem *parent = 0, Qt::WindowFlags wFlags = 0); |
|
87 |
~QGraphicsWidget(); |
|
88 |
||
89 |
QGraphicsLayout *layout() const; |
|
90 |
void setLayout(QGraphicsLayout *layout); |
|
91 |
void adjustSize(); |
|
92 |
||
93 |
Qt::LayoutDirection layoutDirection() const; |
|
94 |
void setLayoutDirection(Qt::LayoutDirection direction); |
|
95 |
void unsetLayoutDirection(); |
|
96 |
||
97 |
QStyle *style() const; |
|
98 |
void setStyle(QStyle *style); |
|
99 |
||
100 |
QFont font() const; |
|
101 |
void setFont(const QFont &font); |
|
102 |
||
103 |
QPalette palette() const; |
|
104 |
void setPalette(const QPalette &palette); |
|
105 |
||
106 |
void resize(const QSizeF &size); |
|
107 |
inline void resize(qreal w, qreal h) { resize(QSizeF(w, h)); } |
|
108 |
QSizeF size() const; |
|
109 |
||
110 |
void setGeometry(const QRectF &rect); |
|
111 |
inline void setGeometry(qreal x, qreal y, qreal w, qreal h); |
|
112 |
inline QRectF rect() const { return QRectF(QPointF(), size()); } |
|
113 |
||
114 |
void setContentsMargins(qreal left, qreal top, qreal right, qreal bottom); |
|
115 |
void getContentsMargins(qreal *left, qreal *top, qreal *right, qreal *bottom) const; |
|
116 |
||
117 |
void setWindowFrameMargins(qreal left, qreal top, qreal right, qreal bottom); |
|
118 |
void getWindowFrameMargins(qreal *left, qreal *top, qreal *right, qreal *bottom) const; |
|
119 |
void unsetWindowFrameMargins(); |
|
120 |
QRectF windowFrameGeometry() const; |
|
121 |
QRectF windowFrameRect() const; |
|
122 |
||
123 |
// Window handling |
|
124 |
Qt::WindowFlags windowFlags() const; |
|
125 |
Qt::WindowType windowType() const; |
|
126 |
void setWindowFlags(Qt::WindowFlags wFlags); |
|
127 |
bool isActiveWindow() const; |
|
128 |
void setWindowTitle(const QString &title); |
|
129 |
QString windowTitle() const; |
|
130 |
||
131 |
// Focus handling |
|
132 |
Qt::FocusPolicy focusPolicy() const; |
|
133 |
void setFocusPolicy(Qt::FocusPolicy policy); |
|
134 |
static void setTabOrder(QGraphicsWidget *first, QGraphicsWidget *second); |
|
135 |
QGraphicsWidget *focusWidget() const; |
|
136 |
||
137 |
#ifndef QT_NO_SHORTCUT |
|
138 |
int grabShortcut(const QKeySequence &sequence, Qt::ShortcutContext context = Qt::WindowShortcut); |
|
139 |
void releaseShortcut(int id); |
|
140 |
void setShortcutEnabled(int id, bool enabled = true); |
|
141 |
void setShortcutAutoRepeat(int id, bool enabled = true); |
|
142 |
#endif |
|
143 |
||
144 |
#ifndef QT_NO_ACTION |
|
145 |
//actions |
|
146 |
void addAction(QAction *action); |
|
147 |
void addActions(QList<QAction*> actions); |
|
148 |
void insertAction(QAction *before, QAction *action); |
|
149 |
void insertActions(QAction *before, QList<QAction*> actions); |
|
150 |
void removeAction(QAction *action); |
|
151 |
QList<QAction*> actions() const; |
|
152 |
#endif |
|
153 |
||
154 |
void setAttribute(Qt::WidgetAttribute attribute, bool on = true); |
|
155 |
bool testAttribute(Qt::WidgetAttribute attribute) const; |
|
156 |
||
157 |
enum { |
|
158 |
Type = 11 |
|
159 |
}; |
|
160 |
int type() const; |
|
161 |
||
162 |
void paint(QPainter *painter, const QStyleOptionGraphicsItem *option, QWidget *widget = 0); |
|
163 |
virtual void paintWindowFrame(QPainter *painter, const QStyleOptionGraphicsItem *option, QWidget *widget = 0); |
|
164 |
QRectF boundingRect() const; |
|
165 |
QPainterPath shape() const; |
|
166 |
||
167 |
#if 0 |
|
168 |
void dumpFocusChain(); |
|
169 |
#endif |
|
170 |
||
171 |
// ### Qt 5: Disambiguate |
|
172 |
#ifdef Q_NO_USING_KEYWORD |
|
173 |
const QObjectList &children() const { return QObject::children(); } |
|
174 |
#else |
|
175 |
using QObject::children; |
|
176 |
#endif |
|
177 |
||
178 |
public Q_SLOTS: |
|
179 |
bool close(); |
|
180 |
||
181 |
protected: |
|
182 |
virtual void initStyleOption(QStyleOption *option) const; |
|
183 |
||
184 |
QSizeF sizeHint(Qt::SizeHint which, const QSizeF &constraint = QSizeF()) const; |
|
185 |
void updateGeometry(); |
|
186 |
||
187 |
// Notification |
|
188 |
QVariant itemChange(GraphicsItemChange change, const QVariant &value); |
|
189 |
virtual QVariant propertyChange(const QString &propertyName, const QVariant &value); |
|
190 |
||
191 |
// Scene events |
|
192 |
bool sceneEvent(QEvent *event); |
|
193 |
virtual bool windowFrameEvent(QEvent *e); |
|
194 |
virtual Qt::WindowFrameSection windowFrameSectionAt(const QPointF& pos) const; |
|
195 |
||
196 |
// Base event handlers |
|
197 |
bool event(QEvent *event); |
|
198 |
//virtual void actionEvent(QActionEvent *event); |
|
199 |
virtual void changeEvent(QEvent *event); |
|
200 |
virtual void closeEvent(QCloseEvent *event); |
|
201 |
//void create(WId window = 0, bool initializeWindow = true, bool destroyOldWindow = true); |
|
202 |
//void destroy(bool destroyWindow = true, bool destroySubWindows = true); |
|
203 |
void focusInEvent(QFocusEvent *event); |
|
204 |
virtual bool focusNextPrevChild(bool next); |
|
205 |
void focusOutEvent(QFocusEvent *event); |
|
206 |
virtual void hideEvent(QHideEvent *event); |
|
207 |
//virtual bool macEvent(EventHandlerCallRef caller, EventRef event); |
|
208 |
//virtual int metric(PaintDeviceMetric m ) const; |
|
209 |
virtual void moveEvent(QGraphicsSceneMoveEvent *event); |
|
210 |
virtual void polishEvent(); |
|
211 |
//virtual bool qwsEvent(QWSEvent *event); |
|
212 |
//void resetInputContext (); |
|
213 |
virtual void resizeEvent(QGraphicsSceneResizeEvent *event); |
|
214 |
virtual void showEvent(QShowEvent *event); |
|
215 |
//virtual void tabletEvent(QTabletEvent *event); |
|
216 |
//virtual bool winEvent(MSG *message, long *result); |
|
217 |
//virtual bool x11Event(XEvent *event); |
|
218 |
virtual void hoverMoveEvent(QGraphicsSceneHoverEvent *event); |
|
219 |
virtual void hoverLeaveEvent(QGraphicsSceneHoverEvent *event); |
|
220 |
virtual void grabMouseEvent(QEvent *event); |
|
221 |
virtual void ungrabMouseEvent(QEvent *event); |
|
222 |
virtual void grabKeyboardEvent(QEvent *event); |
|
223 |
virtual void ungrabKeyboardEvent(QEvent *event); |
|
224 |
QGraphicsWidget(QGraphicsWidgetPrivate &, QGraphicsItem *parent, QGraphicsScene *, Qt::WindowFlags wFlags = 0); |
|
225 |
||
226 |
private: |
|
227 |
Q_DISABLE_COPY(QGraphicsWidget) |
|
228 |
Q_DECLARE_PRIVATE_D(QGraphicsItem::d_ptr.data(), QGraphicsWidget) |
|
229 |
friend class QGraphicsScene; |
|
230 |
friend class QGraphicsScenePrivate; |
|
231 |
friend class QGraphicsView; |
|
232 |
friend class QGraphicsItem; |
|
233 |
friend class QGraphicsItemPrivate; |
|
234 |
friend class QGraphicsLayout; |
|
235 |
friend class QWidget; |
|
236 |
friend class QApplication; |
|
237 |
}; |
|
238 |
||
239 |
inline void QGraphicsWidget::setGeometry(qreal ax, qreal ay, qreal aw, qreal ah) |
|
240 |
{ setGeometry(QRectF(ax, ay, aw, ah)); } |
|
241 |
||
242 |
#endif |
|
243 |
||
244 |
QT_END_NAMESPACE |
|
245 |
||
246 |
QT_END_HEADER |
|
247 |
||
248 |
#endif |
|
249 |