author | Eckhart Koeppen <eckhart.koppen@nokia.com> |
Wed, 21 Apr 2010 11:15:19 +0300 | |
branch | RCL_3 |
changeset 11 | 25a739ee40f4 |
parent 4 | 3b1da2848fc7 |
child 13 | c0432d11811c |
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 QGRAPHICSVIEW_P_H |
|
43 |
#define QGRAPHICSVIEW_P_H |
|
44 |
||
45 |
// |
|
46 |
// W A R N I N G |
|
47 |
// ------------- |
|
48 |
// |
|
49 |
// This file is not part of the Qt API. It exists for the convenience |
|
50 |
// of other Qt classes. This header file may change from version to |
|
51 |
// version without notice, or even be removed. |
|
52 |
// |
|
53 |
// We mean it. |
|
54 |
// |
|
55 |
||
56 |
#include "qgraphicsview.h" |
|
57 |
||
58 |
#if !defined(QT_NO_GRAPHICSVIEW) || (QT_EDITION & QT_MODULE_GRAPHICSVIEW) != QT_MODULE_GRAPHICSVIEW |
|
59 |
||
60 |
#include <QtGui/qevent.h> |
|
61 |
#include <QtCore/qcoreapplication.h> |
|
62 |
#include "qgraphicssceneevent.h" |
|
63 |
#include <QtGui/qstyleoption.h> |
|
64 |
#include <private/qabstractscrollarea_p.h> |
|
65 |
||
66 |
QT_BEGIN_NAMESPACE |
|
67 |
||
68 |
class Q_AUTOTEST_EXPORT QGraphicsViewPrivate : public QAbstractScrollAreaPrivate |
|
69 |
{ |
|
70 |
Q_DECLARE_PUBLIC(QGraphicsView) |
|
71 |
public: |
|
72 |
QGraphicsViewPrivate(); |
|
73 |
||
74 |
void recalculateContentSize(); |
|
75 |
void centerView(QGraphicsView::ViewportAnchor anchor); |
|
76 |
||
77 |
QPainter::RenderHints renderHints; |
|
78 |
||
79 |
QGraphicsView::DragMode dragMode; |
|
80 |
bool sceneInteractionAllowed; |
|
81 |
QRectF sceneRect; |
|
82 |
bool hasSceneRect; |
|
83 |
void updateLastCenterPoint(); |
|
84 |
bool connectedToScene; |
|
85 |
||
86 |
qint64 horizontalScroll() const; |
|
87 |
qint64 verticalScroll() const; |
|
88 |
||
3
41300fa6a67c
Revision: 201003
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
0
diff
changeset
|
89 |
QRectF mapRectToScene(const QRect &rect) const; |
41300fa6a67c
Revision: 201003
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
0
diff
changeset
|
90 |
QRectF mapRectFromScene(const QRectF &rect) const; |
41300fa6a67c
Revision: 201003
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
0
diff
changeset
|
91 |
|
0 | 92 |
QPointF mousePressItemPoint; |
93 |
QPointF mousePressScenePoint; |
|
94 |
QPoint mousePressViewPoint; |
|
95 |
QPoint mousePressScreenPoint; |
|
96 |
QPointF lastMouseMoveScenePoint; |
|
97 |
QPoint lastMouseMoveScreenPoint; |
|
98 |
QPoint dirtyScrollOffset; |
|
99 |
Qt::MouseButton mousePressButton; |
|
100 |
QTransform matrix; |
|
101 |
bool identityMatrix; |
|
102 |
qint64 scrollX, scrollY; |
|
103 |
bool dirtyScroll; |
|
104 |
void updateScroll(); |
|
105 |
||
106 |
bool accelerateScrolling; |
|
107 |
qreal leftIndent; |
|
108 |
qreal topIndent; |
|
109 |
||
110 |
// Replaying mouse events |
|
111 |
QMouseEvent lastMouseEvent; |
|
112 |
bool useLastMouseEvent; |
|
113 |
void replayLastMouseEvent(); |
|
114 |
void storeMouseEvent(QMouseEvent *event); |
|
115 |
void mouseMoveEventHandler(QMouseEvent *event); |
|
116 |
||
117 |
QPointF lastCenterPoint; |
|
118 |
bool keepLastCenterPoint; |
|
119 |
Qt::Alignment alignment; |
|
120 |
bool transforming; |
|
121 |
||
122 |
QGraphicsView::ViewportAnchor transformationAnchor; |
|
123 |
QGraphicsView::ViewportAnchor resizeAnchor; |
|
124 |
QGraphicsView::ViewportUpdateMode viewportUpdateMode; |
|
125 |
QGraphicsView::OptimizationFlags optimizationFlags; |
|
126 |
||
127 |
QPointer<QGraphicsScene> scene; |
|
128 |
#ifndef QT_NO_RUBBERBAND |
|
129 |
QRect rubberBandRect; |
|
130 |
QRegion rubberBandRegion(const QWidget *widget, const QRect &rect) const; |
|
131 |
bool rubberBanding; |
|
132 |
Qt::ItemSelectionMode rubberBandSelectionMode; |
|
133 |
#endif |
|
134 |
bool handScrolling; |
|
135 |
int handScrollMotions; |
|
136 |
||
137 |
QGraphicsView::CacheMode cacheMode; |
|
138 |
||
139 |
QVector<QStyleOptionGraphicsItem> styleOptions; |
|
140 |
bool mustAllocateStyleOptions; |
|
141 |
QStyleOptionGraphicsItem *allocStyleOptionsArray(int numItems); |
|
142 |
void freeStyleOptionsArray(QStyleOptionGraphicsItem *array); |
|
143 |
||
144 |
QBrush backgroundBrush; |
|
145 |
QBrush foregroundBrush; |
|
146 |
QPixmap backgroundPixmap; |
|
147 |
bool mustResizeBackgroundPixmap; |
|
148 |
QRegion backgroundPixmapExposed; |
|
149 |
||
150 |
#ifndef QT_NO_CURSOR |
|
151 |
QCursor originalCursor; |
|
152 |
bool hasStoredOriginalCursor; |
|
153 |
void _q_setViewportCursor(const QCursor &cursor); |
|
154 |
void _q_unsetViewportCursor(); |
|
155 |
#endif |
|
156 |
||
157 |
QGraphicsSceneDragDropEvent *lastDragDropEvent; |
|
158 |
void storeDragDropEvent(const QGraphicsSceneDragDropEvent *event); |
|
159 |
void populateSceneDragDropEvent(QGraphicsSceneDragDropEvent *dest, |
|
160 |
QDropEvent *source); |
|
161 |
||
162 |
QRect mapToViewRect(const QGraphicsItem *item, const QRectF &rect) const; |
|
163 |
QRegion mapToViewRegion(const QGraphicsItem *item, const QRectF &rect) const; |
|
164 |
bool fullUpdatePending; |
|
165 |
QRegion dirtyRegion; |
|
166 |
QRect dirtyBoundingRect; |
|
167 |
void processPendingUpdates(); |
|
168 |
inline void updateAll() |
|
169 |
{ |
|
170 |
viewport->update(); |
|
171 |
fullUpdatePending = true; |
|
172 |
dirtyBoundingRect = QRect(); |
|
173 |
dirtyRegion = QRegion(); |
|
174 |
} |
|
175 |
||
176 |
inline void dispatchPendingUpdateRequests() |
|
177 |
{ |
|
3
41300fa6a67c
Revision: 201003
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
0
diff
changeset
|
178 |
#ifndef Q_WS_MAC |
41300fa6a67c
Revision: 201003
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
0
diff
changeset
|
179 |
// QWidget::update() works slightly different on the Mac; it's not part of |
41300fa6a67c
Revision: 201003
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
0
diff
changeset
|
180 |
// our backing store so it needs special threatment. |
0 | 181 |
if (qt_widget_private(viewport)->paintOnScreen()) |
182 |
QCoreApplication::sendPostedEvents(viewport, QEvent::UpdateRequest); |
|
183 |
else |
|
184 |
QCoreApplication::sendPostedEvents(viewport->window(), QEvent::UpdateRequest); |
|
3
41300fa6a67c
Revision: 201003
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
0
diff
changeset
|
185 |
#else |
41300fa6a67c
Revision: 201003
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
0
diff
changeset
|
186 |
QCoreApplication::processEvents(QEventLoop::AllEvents | QEventLoop::ExcludeSocketNotifiers |
41300fa6a67c
Revision: 201003
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
0
diff
changeset
|
187 |
| QEventLoop::ExcludeUserInputEvents); |
41300fa6a67c
Revision: 201003
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
0
diff
changeset
|
188 |
#endif |
0 | 189 |
} |
190 |
||
191 |
bool updateRect(const QRect &rect); |
|
192 |
bool updateRegion(const QRegion ®ion); |
|
193 |
bool updateSceneSlotReimplementedChecked; |
|
194 |
QRegion exposedRegion; |
|
195 |
||
196 |
QList<QGraphicsItem *> findItems(const QRegion &exposedRegion, bool *allItems, |
|
197 |
const QTransform &viewTransform) const; |
|
198 |
||
199 |
QPointF mapToScene(const QPointF &point) const; |
|
200 |
QRectF mapToScene(const QRectF &rect) const; |
|
201 |
static void translateTouchEvent(QGraphicsViewPrivate *d, QTouchEvent *touchEvent); |
|
202 |
void updateInputMethodSensitivity(); |
|
203 |
}; |
|
204 |
||
205 |
QT_END_NAMESPACE |
|
206 |
||
207 |
#endif // QT_NO_GRAPHICSVIEW |
|
208 |
||
209 |
#endif |