author | Eckhart Koeppen <eckhart.koppen@nokia.com> |
Wed, 21 Apr 2010 20:15:53 +0300 | |
branch | RCL_3 |
changeset 14 | c0432d11811c |
parent 13 | cc75c76972ee |
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 |
** |
|
3
41300fa6a67c
Revision: 201003
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
0
diff
changeset
|
7 |
** This file is part of the QtGui module of the Qt Toolkit. |
0 | 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 |
#include "qwidget_p.h" |
|
43 |
#include "qdesktopwidget.h" |
|
44 |
#include "qapplication.h" |
|
45 |
#include "qapplication_p.h" |
|
46 |
#include "private/qbackingstore_p.h" |
|
47 |
#include "qevent.h" |
|
48 |
#include "qt_s60_p.h" |
|
49 |
||
50 |
#include "qbitmap.h" |
|
51 |
#include "private/qwindowsurface_s60_p.h" |
|
52 |
||
53 |
#include <qinputcontext.h> |
|
54 |
||
55 |
#ifdef Q_WS_S60 |
|
56 |
#include <aknappui.h> |
|
57 |
#endif |
|
58 |
||
59 |
// This is necessary in order to be able to perform delayed invokation on slots |
|
60 |
// which take arguments of type WId. One example is |
|
61 |
// QWidgetPrivate::_q_delayedDestroy, which is used to delay destruction of |
|
62 |
// CCoeControl objects until after the CONE event handler has finished running. |
|
63 |
Q_DECLARE_METATYPE(WId) |
|
64 |
||
65 |
QT_BEGIN_NAMESPACE |
|
66 |
||
67 |
extern bool qt_nograb(); |
|
68 |
||
69 |
QWidget *QWidgetPrivate::mouseGrabber = 0; |
|
70 |
QWidget *QWidgetPrivate::keyboardGrabber = 0; |
|
71 |
||
72 |
static bool isEqual(const QList<QAction*>& a, const QList<QAction*>& b) |
|
73 |
{ |
|
74 |
if ( a.count() != b.count()) |
|
75 |
return false; |
|
76 |
int index=0; |
|
77 |
while (index<a.count()) { |
|
78 |
if (a.at(index)->softKeyRole() != b.at(index)->softKeyRole()) |
|
79 |
return false; |
|
80 |
if (a.at(index)->text().compare(b.at(index)->text())!=0) |
|
81 |
return false; |
|
82 |
index++; |
|
83 |
} |
|
84 |
return true; |
|
85 |
} |
|
86 |
||
87 |
void QWidgetPrivate::setWSGeometry(bool dontShow, const QRect &) |
|
88 |
{ |
|
89 |
// Note: based on x11 implementation |
|
90 |
||
91 |
static const int XCOORD_MAX = 16383; |
|
92 |
static const int WRECT_MAX = 16383; |
|
93 |
||
94 |
Q_Q(QWidget); |
|
95 |
||
96 |
Q_ASSERT(q->testAttribute(Qt::WA_WState_Created)); |
|
97 |
||
98 |
/* |
|
99 |
There are up to four different coordinate systems here: |
|
100 |
Qt coordinate system for this widget. |
|
101 |
Symbian coordinate system for this widget (relative to wrect). |
|
102 |
Qt coordinate system for parent |
|
103 |
Symbian coordinate system for parent (relative to parent's wrect). |
|
104 |
*/ |
|
105 |
||
106 |
QRect validRange(-XCOORD_MAX,-XCOORD_MAX, 2*XCOORD_MAX, 2*XCOORD_MAX); |
|
107 |
QRect wrectRange(-WRECT_MAX,-WRECT_MAX, 2*WRECT_MAX, 2*WRECT_MAX); |
|
108 |
QRect wrect; |
|
109 |
//xrect is the Symbian geometry of my widget. (starts out in parent's Qt coord sys, and ends up in parent's Symbian coord sys) |
|
110 |
QRect xrect = data.crect; |
|
111 |
||
112 |
const QWidget *const parent = q->parentWidget(); |
|
113 |
QRect parentWRect = parent->data->wrect; |
|
114 |
||
115 |
if (parentWRect.isValid()) { |
|
116 |
// parent is clipped, and we have to clip to the same limit as parent |
|
117 |
if (!parentWRect.contains(xrect)) { |
|
118 |
xrect &= parentWRect; |
|
119 |
wrect = xrect; |
|
120 |
//translate from parent's to my Qt coord sys |
|
121 |
wrect.translate(-data.crect.topLeft()); |
|
122 |
} |
|
123 |
//translate from parent's Qt coords to parent's X coords |
|
124 |
xrect.translate(-parentWRect.topLeft()); |
|
125 |
||
126 |
} else { |
|
127 |
// parent is not clipped, we may or may not have to clip |
|
128 |
||
129 |
if (data.wrect.isValid() && QRect(QPoint(),data.crect.size()).contains(data.wrect)) { |
|
130 |
// This is where the main optimization is: we are already |
|
131 |
// clipped, and if our clip is still valid, we can just |
|
132 |
// move our window, and do not need to move or clip |
|
133 |
// children |
|
134 |
||
135 |
QRect vrect = xrect & parent->rect(); |
|
136 |
vrect.translate(-data.crect.topLeft()); //the part of me that's visible through parent, in my Qt coords |
|
137 |
if (data.wrect.contains(vrect)) { |
|
138 |
xrect = data.wrect; |
|
139 |
xrect.translate(data.crect.topLeft()); |
|
140 |
if (data.winid) |
|
141 |
data.winid->SetExtent(TPoint(xrect.x(), xrect.y()), TSize(xrect.width(), xrect.height())); |
|
142 |
return; |
|
143 |
} |
|
144 |
} |
|
145 |
||
146 |
if (!validRange.contains(xrect)) { |
|
147 |
// we are too big, and must clip |
|
148 |
xrect &=wrectRange; |
|
149 |
wrect = xrect; |
|
150 |
wrect.translate(-data.crect.topLeft()); |
|
151 |
//parent's X coord system is equal to parent's Qt coord |
|
152 |
//sys, so we don't need to map xrect. |
|
153 |
} |
|
154 |
} |
|
155 |
||
156 |
// unmap if we are outside the valid window system coord system |
|
157 |
bool outsideRange = !xrect.isValid(); |
|
158 |
bool mapWindow = false; |
|
159 |
if (q->testAttribute(Qt::WA_OutsideWSRange) != outsideRange) { |
|
160 |
q->setAttribute(Qt::WA_OutsideWSRange, outsideRange); |
|
161 |
if (outsideRange) { |
|
162 |
if (data.winid) |
|
163 |
data.winid->DrawableWindow()->SetVisible(EFalse); |
|
164 |
q->setAttribute(Qt::WA_Mapped, false); |
|
165 |
} else if (!q->isHidden()) { |
|
166 |
mapWindow = true; |
|
167 |
} |
|
168 |
} |
|
169 |
||
170 |
if (outsideRange) |
|
171 |
return; |
|
172 |
||
173 |
bool jump = (data.wrect != wrect); |
|
174 |
data.wrect = wrect; |
|
175 |
||
176 |
// and now recursively for all children... |
|
177 |
for (int i = 0; i < children.size(); ++i) { |
|
178 |
QObject *object = children.at(i); |
|
179 |
if (object->isWidgetType()) { |
|
180 |
QWidget *w = static_cast<QWidget *>(object); |
|
181 |
if (!w->isWindow() && w->testAttribute(Qt::WA_WState_Created)) |
|
182 |
w->d_func()->setWSGeometry(jump); |
|
183 |
} |
|
184 |
} |
|
185 |
||
186 |
if (data.winid) { |
|
187 |
// move ourselves to the new position and map (if necessary) after |
|
188 |
// the movement. Rationale: moving unmapped windows is much faster |
|
189 |
// than moving mapped windows |
|
190 |
if (!parent->internalWinId()) |
|
191 |
xrect.translate(parent->mapTo(q->nativeParentWidget(), QPoint(0, 0))); |
|
192 |
||
193 |
data.winid->SetExtent(TPoint(xrect.x(), xrect.y()), TSize(xrect.width(), xrect.height())); |
|
194 |
} |
|
195 |
||
196 |
if (mapWindow and !dontShow) { |
|
197 |
q->setAttribute(Qt::WA_Mapped); |
|
198 |
if (q->internalWinId()) |
|
199 |
q->internalWinId()->DrawableWindow()->SetVisible(ETrue); |
|
200 |
} |
|
201 |
||
202 |
if (jump && data.winid) { |
|
203 |
RWindow *const window = static_cast<RWindow *>(data.winid->DrawableWindow()); |
|
204 |
window->Invalidate(TRect(0, 0, wrect.width(), wrect.height())); |
|
205 |
} |
|
206 |
} |
|
207 |
||
208 |
void QWidgetPrivate::setGeometry_sys(int x, int y, int w, int h, bool isMove) |
|
209 |
{ |
|
210 |
Q_Q(QWidget); |
|
211 |
||
212 |
Q_ASSERT(q->testAttribute(Qt::WA_WState_Created)); |
|
213 |
||
214 |
if ((q->windowType() == Qt::Desktop)) |
|
215 |
return; |
|
3
41300fa6a67c
Revision: 201003
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
0
diff
changeset
|
216 |
|
41300fa6a67c
Revision: 201003
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
0
diff
changeset
|
217 |
QPoint oldPos(q->pos()); |
41300fa6a67c
Revision: 201003
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
0
diff
changeset
|
218 |
QSize oldSize(q->size()); |
41300fa6a67c
Revision: 201003
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
0
diff
changeset
|
219 |
QRect oldGeom(data.crect); |
41300fa6a67c
Revision: 201003
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
0
diff
changeset
|
220 |
|
41300fa6a67c
Revision: 201003
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
0
diff
changeset
|
221 |
// Lose maximized status if deliberate resize |
41300fa6a67c
Revision: 201003
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
0
diff
changeset
|
222 |
if (w != oldSize.width() || h != oldSize.height()) |
41300fa6a67c
Revision: 201003
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
0
diff
changeset
|
223 |
data.window_state &= ~Qt::WindowMaximized; |
41300fa6a67c
Revision: 201003
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
0
diff
changeset
|
224 |
|
0 | 225 |
if (extra) { // any size restrictions? |
226 |
w = qMin(w,extra->maxw); |
|
227 |
h = qMin(h,extra->maxh); |
|
228 |
w = qMax(w,extra->minw); |
|
229 |
h = qMax(h,extra->minh); |
|
230 |
} |
|
231 |
||
232 |
if (q->isWindow()) |
|
233 |
topData()->normalGeometry = QRect(0, 0, -1, -1); |
|
234 |
else { |
|
235 |
uint s = data.window_state; |
|
236 |
s &= ~(Qt::WindowMaximized | Qt::WindowFullScreen); |
|
237 |
data.window_state = s; |
|
238 |
} |
|
239 |
||
240 |
bool isResize = w != oldSize.width() || h != oldSize.height(); |
|
241 |
if (!isMove && !isResize) |
|
242 |
return; |
|
243 |
||
244 |
if (q->isWindow()) { |
|
245 |
if (w == 0 || h == 0) { |
|
246 |
q->setAttribute(Qt::WA_OutsideWSRange, true); |
|
247 |
if (q->isVisible() && q->testAttribute(Qt::WA_Mapped)) |
|
248 |
hide_sys(); |
|
249 |
data.crect = QRect(x, y, w, h); |
|
250 |
data.window_state &= ~Qt::WindowFullScreen; |
|
251 |
} else if (q->isVisible() && q->testAttribute(Qt::WA_OutsideWSRange)) { |
|
252 |
q->setAttribute(Qt::WA_OutsideWSRange, false); |
|
253 |
||
254 |
// put the window in its place and show it |
|
255 |
q->internalWinId()->SetRect(TRect(TPoint(x, y), TSize(w, h))); |
|
256 |
data.crect.setRect(x, y, w, h); |
|
257 |
show_sys(); |
|
258 |
} else { |
|
259 |
QRect r = QRect(x, y, w, h); |
|
260 |
data.crect = r; |
|
261 |
q->internalWinId()->SetRect(TRect(TPoint(x, y), TSize(w, h))); |
|
262 |
topData()->normalGeometry = data.crect; |
|
263 |
} |
|
264 |
} else { |
|
265 |
data.crect.setRect(x, y, w, h); |
|
266 |
||
267 |
QTLWExtra *tlwExtra = q->window()->d_func()->maybeTopData(); |
|
268 |
const bool inTopLevelResize = tlwExtra ? tlwExtra->inTopLevelResize : false; |
|
269 |
||
270 |
if (q->isVisible() && (!inTopLevelResize || q->internalWinId())) { |
|
271 |
// Top-level resize optimization does not work for native child widgets; |
|
272 |
// disable it for this particular widget. |
|
273 |
if (inTopLevelResize) |
|
274 |
tlwExtra->inTopLevelResize = false; |
|
275 |
if (!isResize && maybeBackingStore()) |
|
276 |
moveRect(QRect(oldPos, oldSize), x - oldPos.x(), y - oldPos.y()); |
|
277 |
else |
|
278 |
invalidateBuffer_resizeHelper(oldPos, oldSize); |
|
279 |
||
280 |
if (inTopLevelResize) |
|
281 |
tlwExtra->inTopLevelResize = true; |
|
282 |
} |
|
283 |
if (q->testAttribute(Qt::WA_WState_Created)) |
|
284 |
setWSGeometry(); |
|
285 |
} |
|
286 |
||
287 |
if (q->isVisible()) { |
|
288 |
if (isMove && q->pos() != oldPos) { |
|
289 |
QMoveEvent e(q->pos(), oldPos); |
|
290 |
QApplication::sendEvent(q, &e); |
|
291 |
} |
|
292 |
if (isResize) { |
|
293 |
bool slowResize = qgetenv("QT_SLOW_TOPLEVEL_RESIZE").toInt(); |
|
294 |
const bool setTopLevelResize = !slowResize && q->isWindow() && extra && extra->topextra |
|
295 |
&& !extra->topextra->inTopLevelResize; |
|
296 |
if (setTopLevelResize) |
|
297 |
extra->topextra->inTopLevelResize = true; |
|
298 |
QResizeEvent e(q->size(), oldSize); |
|
299 |
QApplication::sendEvent(q, &e); |
|
300 |
if (!q->testAttribute(Qt::WA_StaticContents) && q->internalWinId()) |
|
301 |
q->internalWinId()->DrawDeferred(); |
|
302 |
if (setTopLevelResize) |
|
303 |
extra->topextra->inTopLevelResize = false; |
|
304 |
} |
|
305 |
} else { |
|
306 |
if (isMove && q->pos() != oldPos) |
|
307 |
q->setAttribute(Qt::WA_PendingMoveEvent, true); |
|
308 |
if (isResize) |
|
309 |
q->setAttribute(Qt::WA_PendingResizeEvent, true); |
|
310 |
} |
|
311 |
} |
|
312 |
||
313 |
void QWidgetPrivate::create_sys(WId window, bool /* initializeWindow */, bool destroyOldWindow) |
|
314 |
{ |
|
315 |
Q_Q(QWidget); |
|
316 |
||
317 |
Qt::WindowType type = q->windowType(); |
|
318 |
Qt::WindowFlags &flags = data.window_flags; |
|
319 |
QWidget *parentWidget = q->parentWidget(); |
|
320 |
||
321 |
bool topLevel = (flags & Qt::Window); |
|
322 |
bool popup = (type == Qt::Popup); |
|
323 |
bool dialog = (type == Qt::Dialog |
|
324 |
|| type == Qt::Sheet |
|
325 |
|| (flags & Qt::MSWindowsFixedSizeDialogHint)); |
|
326 |
bool desktop = (type == Qt::Desktop); |
|
327 |
//bool tool = (type == Qt::Tool || type == Qt::Drawer); |
|
328 |
||
329 |
if (popup) |
|
330 |
flags |= Qt::WindowStaysOnTopHint; // a popup stays on top |
|
331 |
||
332 |
TRect clientRect = static_cast<CEikAppUi*>(S60->appUi())->ClientRect(); |
|
333 |
int sw = clientRect.Width(); |
|
334 |
int sh = clientRect.Height(); |
|
335 |
||
336 |
if (desktop) { |
|
337 |
TSize screenSize = S60->screenDevice()->SizeInPixels(); |
|
338 |
data.crect.setRect(0, 0, screenSize.iWidth, screenSize.iHeight); |
|
339 |
q->setAttribute(Qt::WA_DontShowOnScreen); |
|
340 |
} else if (topLevel && !q->testAttribute(Qt::WA_Resized)){ |
|
341 |
int width = sw; |
|
342 |
int height = sh; |
|
343 |
if (extra) { |
|
344 |
width = qMax(qMin(width, extra->maxw), extra->minw); |
|
345 |
height = qMax(qMin(height, extra->maxh), extra->minh); |
|
346 |
} |
|
347 |
data.crect.setSize(QSize(width, height)); |
|
348 |
} |
|
349 |
||
350 |
CCoeControl *const destroyw = destroyOldWindow ? data.winid : 0; |
|
351 |
||
352 |
createExtra(); |
|
353 |
if (window) { |
|
354 |
setWinId(window); |
|
355 |
TRect tr = window->Rect(); |
|
356 |
data.crect.setRect(tr.iTl.iX, tr.iTl.iY, tr.Width(), tr.Height()); |
|
357 |
||
358 |
} else if (topLevel) { |
|
359 |
if (!q->testAttribute(Qt::WA_Moved) && !q->testAttribute(Qt::WA_DontShowOnScreen)) |
|
360 |
data.crect.moveTopLeft(QPoint(clientRect.iTl.iX, clientRect.iTl.iY)); |
|
361 |
||
362 |
QScopedPointer<QSymbianControl> control( q_check_ptr(new QSymbianControl(q)) ); |
|
363 |
QT_TRAP_THROWING(control->ConstructL(true, desktop)); |
|
3
41300fa6a67c
Revision: 201003
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
0
diff
changeset
|
364 |
control->SetMopParent(static_cast<CEikAppUi*>(S60->appUi())); |
0 | 365 |
|
366 |
// Symbian windows are always created in an inactive state |
|
367 |
// We perform this assignment for the case where the window is being re-created |
|
368 |
// as aa result of a call to setParent_sys, on either this widget or one of its |
|
369 |
// ancestors. |
|
370 |
extra->activated = 0; |
|
371 |
||
372 |
if (!desktop) { |
|
373 |
TInt stackingFlags; |
|
374 |
if ((q->windowType() & Qt::Popup) == Qt::Popup) { |
|
375 |
stackingFlags = ECoeStackFlagRefusesAllKeys | ECoeStackFlagRefusesFocus; |
|
376 |
} else { |
|
377 |
stackingFlags = ECoeStackFlagStandard; |
|
378 |
} |
|
379 |
control->MakeVisible(false); |
|
380 |
QT_TRAP_THROWING(control->ControlEnv()->AppUi()->AddToStackL(control.data(), ECoeStackPriorityDefault, stackingFlags)); |
|
381 |
// Avoid keyboard focus to a hidden window. |
|
382 |
control->setFocusSafely(false); |
|
383 |
||
384 |
RDrawableWindow *const drawableWindow = control->DrawableWindow(); |
|
385 |
// Request mouse move events. |
|
386 |
drawableWindow->PointerFilter(EPointerFilterEnterExit |
|
387 |
| EPointerFilterMove | EPointerFilterDrag, 0); |
|
388 |
drawableWindow->EnableVisibilityChangeEvents(); |
|
389 |
||
12
25a739ee40f4
3a438a6e0b41f1ef657ef0e648d352db636204aa
Eckhart Koeppen <eckhart.koppen@nokia.com>
parents:
8
diff
changeset
|
390 |
s60UpdateIsOpaque(); |
0 | 391 |
} |
392 |
||
393 |
q->setAttribute(Qt::WA_WState_Created); |
|
394 |
||
395 |
int x, y, w, h; |
|
396 |
data.crect.getRect(&x, &y, &w, &h); |
|
397 |
control->SetRect(TRect(TPoint(x, y), TSize(w, h))); |
|
398 |
||
399 |
// We wait until the control is fully constructed before calling setWinId, because |
|
400 |
// this generates a WinIdChanged event. |
|
401 |
setWinId(control.take()); |
|
402 |
||
403 |
} else if (q->testAttribute(Qt::WA_NativeWindow) || paintOnScreen()) { // create native child widget |
|
404 |
||
405 |
QScopedPointer<QSymbianControl> control( q_check_ptr(new QSymbianControl(q)) ); |
|
406 |
QT_TRAP_THROWING(control->ConstructL(!parentWidget)); |
|
407 |
||
408 |
// Symbian windows are always created in an inactive state |
|
409 |
// We perform this assignment for the case where the window is being re-created |
|
410 |
// as aa result of a call to setParent_sys, on either this widget or one of its |
|
411 |
// ancestors. |
|
412 |
extra->activated = 0; |
|
413 |
||
414 |
TInt stackingFlags; |
|
415 |
if ((q->windowType() & Qt::Popup) == Qt::Popup) { |
|
416 |
stackingFlags = ECoeStackFlagRefusesAllKeys | ECoeStackFlagRefusesFocus; |
|
417 |
} else { |
|
418 |
stackingFlags = ECoeStackFlagStandard; |
|
419 |
} |
|
420 |
control->MakeVisible(false); |
|
421 |
QT_TRAP_THROWING(control->ControlEnv()->AppUi()->AddToStackL(control.data(), ECoeStackPriorityDefault, stackingFlags)); |
|
422 |
// Avoid keyboard focus to a hidden window. |
|
423 |
control->setFocusSafely(false); |
|
424 |
||
425 |
q->setAttribute(Qt::WA_WState_Created); |
|
426 |
int x, y, w, h; |
|
427 |
data.crect.getRect(&x, &y, &w, &h); |
|
428 |
control->SetRect(TRect(TPoint(x, y), TSize(w, h))); |
|
429 |
||
430 |
RDrawableWindow *const drawableWindow = control->DrawableWindow(); |
|
431 |
// Request mouse move events. |
|
432 |
drawableWindow->PointerFilter(EPointerFilterEnterExit |
|
433 |
| EPointerFilterMove | EPointerFilterDrag, 0); |
|
434 |
||
3
41300fa6a67c
Revision: 201003
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
0
diff
changeset
|
435 |
if (q->isVisible() && q->testAttribute(Qt::WA_Mapped)) { |
0 | 436 |
activateSymbianWindow(control.data()); |
3
41300fa6a67c
Revision: 201003
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
0
diff
changeset
|
437 |
control->MakeVisible(true); |
41300fa6a67c
Revision: 201003
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
0
diff
changeset
|
438 |
} |
0 | 439 |
|
440 |
// We wait until the control is fully constructed before calling setWinId, because |
|
441 |
// this generates a WinIdChanged event. |
|
442 |
setWinId(control.take()); |
|
443 |
} |
|
444 |
||
445 |
if (destroyw) { |
|
446 |
destroyw->ControlEnv()->AppUi()->RemoveFromStack(destroyw); |
|
447 |
||
448 |
// Delay deletion of the control in case this function is called in the |
|
449 |
// context of a CONE event handler such as |
|
450 |
// CCoeControl::ProcessPointerEventL |
|
451 |
QMetaObject::invokeMethod(q, "_q_delayedDestroy", |
|
452 |
Qt::QueuedConnection, Q_ARG(WId, destroyw)); |
|
453 |
} |
|
454 |
||
455 |
if (q->testAttribute(Qt::WA_AcceptTouchEvents)) |
|
456 |
registerTouchWindow(); |
|
457 |
} |
|
458 |
||
459 |
||
460 |
void QWidgetPrivate::show_sys() |
|
461 |
{ |
|
462 |
Q_Q(QWidget); |
|
463 |
||
464 |
if (q->testAttribute(Qt::WA_OutsideWSRange)) |
|
465 |
return; |
|
466 |
||
467 |
Q_ASSERT(q->testAttribute(Qt::WA_WState_Created)); |
|
468 |
||
469 |
q->setAttribute(Qt::WA_Mapped); |
|
470 |
||
471 |
if (q->testAttribute(Qt::WA_DontShowOnScreen)) { |
|
472 |
invalidateBuffer(q->rect()); |
|
473 |
return; |
|
474 |
} |
|
475 |
||
476 |
if (q->internalWinId()) { |
|
477 |
if (!extra->activated) |
|
478 |
activateSymbianWindow(); |
|
479 |
||
480 |
QSymbianControl *id = static_cast<QSymbianControl *>(q->internalWinId()); |
|
481 |
||
14
c0432d11811c
eb175c3290cd7ea85da4a590db9461504a4904bc
Eckhart Koeppen <eckhart.koppen@nokia.com>
parents:
13
diff
changeset
|
482 |
#ifdef Q_WS_S60 |
c0432d11811c
eb175c3290cd7ea85da4a590db9461504a4904bc
Eckhart Koeppen <eckhart.koppen@nokia.com>
parents:
13
diff
changeset
|
483 |
// Lazily initialize the S60 screen furniture when the first window is shown. |
c0432d11811c
eb175c3290cd7ea85da4a590db9461504a4904bc
Eckhart Koeppen <eckhart.koppen@nokia.com>
parents:
13
diff
changeset
|
484 |
if (!QApplication::testAttribute(Qt::AA_S60DontConstructApplicationPanes) |
c0432d11811c
eb175c3290cd7ea85da4a590db9461504a4904bc
Eckhart Koeppen <eckhart.koppen@nokia.com>
parents:
13
diff
changeset
|
485 |
&& !S60->buttonGroupContainer() && !S60->statusPane()) { |
c0432d11811c
eb175c3290cd7ea85da4a590db9461504a4904bc
Eckhart Koeppen <eckhart.koppen@nokia.com>
parents:
13
diff
changeset
|
486 |
|
c0432d11811c
eb175c3290cd7ea85da4a590db9461504a4904bc
Eckhart Koeppen <eckhart.koppen@nokia.com>
parents:
13
diff
changeset
|
487 |
bool isFullscreen = q->windowState() & Qt::WindowFullScreen; |
c0432d11811c
eb175c3290cd7ea85da4a590db9461504a4904bc
Eckhart Koeppen <eckhart.koppen@nokia.com>
parents:
13
diff
changeset
|
488 |
bool cbaRequested = q->windowFlags() & Qt::WindowSoftkeysVisibleHint; |
c0432d11811c
eb175c3290cd7ea85da4a590db9461504a4904bc
Eckhart Koeppen <eckhart.koppen@nokia.com>
parents:
13
diff
changeset
|
489 |
|
c0432d11811c
eb175c3290cd7ea85da4a590db9461504a4904bc
Eckhart Koeppen <eckhart.koppen@nokia.com>
parents:
13
diff
changeset
|
490 |
// If the window is fullscreen and has not explicitly requested that the CBA be visible |
c0432d11811c
eb175c3290cd7ea85da4a590db9461504a4904bc
Eckhart Koeppen <eckhart.koppen@nokia.com>
parents:
13
diff
changeset
|
491 |
// we delay the creation even more. |
c0432d11811c
eb175c3290cd7ea85da4a590db9461504a4904bc
Eckhart Koeppen <eckhart.koppen@nokia.com>
parents:
13
diff
changeset
|
492 |
if ((!isFullscreen || cbaRequested) && !q->testAttribute(Qt::WA_DontShowOnScreen)) { |
c0432d11811c
eb175c3290cd7ea85da4a590db9461504a4904bc
Eckhart Koeppen <eckhart.koppen@nokia.com>
parents:
13
diff
changeset
|
493 |
|
c0432d11811c
eb175c3290cd7ea85da4a590db9461504a4904bc
Eckhart Koeppen <eckhart.koppen@nokia.com>
parents:
13
diff
changeset
|
494 |
// Create the status pane and CBA here |
c0432d11811c
eb175c3290cd7ea85da4a590db9461504a4904bc
Eckhart Koeppen <eckhart.koppen@nokia.com>
parents:
13
diff
changeset
|
495 |
CEikAppUi *ui = static_cast<CEikAppUi *>(S60->appUi()); |
c0432d11811c
eb175c3290cd7ea85da4a590db9461504a4904bc
Eckhart Koeppen <eckhart.koppen@nokia.com>
parents:
13
diff
changeset
|
496 |
MEikAppUiFactory *factory = CEikonEnv::Static()->AppUiFactory(); |
c0432d11811c
eb175c3290cd7ea85da4a590db9461504a4904bc
Eckhart Koeppen <eckhart.koppen@nokia.com>
parents:
13
diff
changeset
|
497 |
TRAP_IGNORE(factory->ReadAppInfoResourceL(0, ui)); |
c0432d11811c
eb175c3290cd7ea85da4a590db9461504a4904bc
Eckhart Koeppen <eckhart.koppen@nokia.com>
parents:
13
diff
changeset
|
498 |
if (S60->buttonGroupContainer()) |
c0432d11811c
eb175c3290cd7ea85da4a590db9461504a4904bc
Eckhart Koeppen <eckhart.koppen@nokia.com>
parents:
13
diff
changeset
|
499 |
S60->buttonGroupContainer()->SetCommandSetL(R_AVKON_SOFTKEYS_EMPTY_WITH_IDS); |
c0432d11811c
eb175c3290cd7ea85da4a590db9461504a4904bc
Eckhart Koeppen <eckhart.koppen@nokia.com>
parents:
13
diff
changeset
|
500 |
|
c0432d11811c
eb175c3290cd7ea85da4a590db9461504a4904bc
Eckhart Koeppen <eckhart.koppen@nokia.com>
parents:
13
diff
changeset
|
501 |
if (S60->statusPane()) { |
c0432d11811c
eb175c3290cd7ea85da4a590db9461504a4904bc
Eckhart Koeppen <eckhart.koppen@nokia.com>
parents:
13
diff
changeset
|
502 |
// Use QDesktopWidget as the status pane observer to proxy for the AppUi. |
c0432d11811c
eb175c3290cd7ea85da4a590db9461504a4904bc
Eckhart Koeppen <eckhart.koppen@nokia.com>
parents:
13
diff
changeset
|
503 |
// Can't use AppUi directly because it privately inherits from MEikStatusPaneObserver. |
c0432d11811c
eb175c3290cd7ea85da4a590db9461504a4904bc
Eckhart Koeppen <eckhart.koppen@nokia.com>
parents:
13
diff
changeset
|
504 |
QSymbianControl *desktopControl = static_cast<QSymbianControl *>(QApplication::desktop()->winId()); |
c0432d11811c
eb175c3290cd7ea85da4a590db9461504a4904bc
Eckhart Koeppen <eckhart.koppen@nokia.com>
parents:
13
diff
changeset
|
505 |
S60->statusPane()->SetObserver(desktopControl); |
c0432d11811c
eb175c3290cd7ea85da4a590db9461504a4904bc
Eckhart Koeppen <eckhart.koppen@nokia.com>
parents:
13
diff
changeset
|
506 |
|
c0432d11811c
eb175c3290cd7ea85da4a590db9461504a4904bc
Eckhart Koeppen <eckhart.koppen@nokia.com>
parents:
13
diff
changeset
|
507 |
// Hide the status pane if fullscreen OR |
c0432d11811c
eb175c3290cd7ea85da4a590db9461504a4904bc
Eckhart Koeppen <eckhart.koppen@nokia.com>
parents:
13
diff
changeset
|
508 |
// Fill client area if maximized OR |
c0432d11811c
eb175c3290cd7ea85da4a590db9461504a4904bc
Eckhart Koeppen <eckhart.koppen@nokia.com>
parents:
13
diff
changeset
|
509 |
// Put window below status pane unless the window has an explicit position. |
c0432d11811c
eb175c3290cd7ea85da4a590db9461504a4904bc
Eckhart Koeppen <eckhart.koppen@nokia.com>
parents:
13
diff
changeset
|
510 |
if (isFullscreen) { |
c0432d11811c
eb175c3290cd7ea85da4a590db9461504a4904bc
Eckhart Koeppen <eckhart.koppen@nokia.com>
parents:
13
diff
changeset
|
511 |
S60->statusPane()->MakeVisible(false); |
c0432d11811c
eb175c3290cd7ea85da4a590db9461504a4904bc
Eckhart Koeppen <eckhart.koppen@nokia.com>
parents:
13
diff
changeset
|
512 |
} else if (q->windowState() & Qt::WindowMaximized) { |
c0432d11811c
eb175c3290cd7ea85da4a590db9461504a4904bc
Eckhart Koeppen <eckhart.koppen@nokia.com>
parents:
13
diff
changeset
|
513 |
TRect r = static_cast<CEikAppUi*>(S60->appUi())->ClientRect(); |
c0432d11811c
eb175c3290cd7ea85da4a590db9461504a4904bc
Eckhart Koeppen <eckhart.koppen@nokia.com>
parents:
13
diff
changeset
|
514 |
id->SetExtent(r.iTl, r.Size()); |
c0432d11811c
eb175c3290cd7ea85da4a590db9461504a4904bc
Eckhart Koeppen <eckhart.koppen@nokia.com>
parents:
13
diff
changeset
|
515 |
} else if (!q->testAttribute(Qt::WA_Moved)) { |
c0432d11811c
eb175c3290cd7ea85da4a590db9461504a4904bc
Eckhart Koeppen <eckhart.koppen@nokia.com>
parents:
13
diff
changeset
|
516 |
id->SetPosition(static_cast<CEikAppUi*>(S60->appUi())->ClientRect().iTl); |
c0432d11811c
eb175c3290cd7ea85da4a590db9461504a4904bc
Eckhart Koeppen <eckhart.koppen@nokia.com>
parents:
13
diff
changeset
|
517 |
} |
c0432d11811c
eb175c3290cd7ea85da4a590db9461504a4904bc
Eckhart Koeppen <eckhart.koppen@nokia.com>
parents:
13
diff
changeset
|
518 |
} |
c0432d11811c
eb175c3290cd7ea85da4a590db9461504a4904bc
Eckhart Koeppen <eckhart.koppen@nokia.com>
parents:
13
diff
changeset
|
519 |
} |
c0432d11811c
eb175c3290cd7ea85da4a590db9461504a4904bc
Eckhart Koeppen <eckhart.koppen@nokia.com>
parents:
13
diff
changeset
|
520 |
} |
c0432d11811c
eb175c3290cd7ea85da4a590db9461504a4904bc
Eckhart Koeppen <eckhart.koppen@nokia.com>
parents:
13
diff
changeset
|
521 |
#endif |
c0432d11811c
eb175c3290cd7ea85da4a590db9461504a4904bc
Eckhart Koeppen <eckhart.koppen@nokia.com>
parents:
13
diff
changeset
|
522 |
|
0 | 523 |
id->MakeVisible(true); |
524 |
||
525 |
if(q->isWindow()) |
|
526 |
id->setFocusSafely(true); |
|
527 |
} |
|
528 |
||
529 |
invalidateBuffer(q->rect()); |
|
530 |
} |
|
531 |
||
532 |
void QWidgetPrivate::activateSymbianWindow(WId wid) |
|
533 |
{ |
|
534 |
Q_Q(QWidget); |
|
535 |
||
536 |
Q_ASSERT(q->testAttribute(Qt::WA_WState_Created)); |
|
537 |
Q_ASSERT(q->testAttribute(Qt::WA_Mapped)); |
|
538 |
Q_ASSERT(!extra->activated); |
|
539 |
||
540 |
if(!wid) |
|
541 |
wid = q->internalWinId(); |
|
542 |
||
543 |
Q_ASSERT(wid); |
|
544 |
||
545 |
QT_TRAP_THROWING(wid->ActivateL()); |
|
546 |
extra->activated = 1; |
|
547 |
} |
|
548 |
||
549 |
void QWidgetPrivate::hide_sys() |
|
550 |
{ |
|
551 |
Q_Q(QWidget); |
|
552 |
||
553 |
Q_ASSERT(q->testAttribute(Qt::WA_WState_Created)); |
|
554 |
deactivateWidgetCleanup(); |
|
555 |
QSymbianControl *id = static_cast<QSymbianControl *>(q->internalWinId()); |
|
556 |
||
557 |
if (id) { |
|
558 |
//Incorrect optimisation - for popup windows, Qt's focus is moved before |
|
559 |
//hide_sys is called, resulting in the popup window keeping its elevated |
|
560 |
//position in the CONE control stack. |
|
561 |
//This can result in keyboard focus being in an invisible widget in some |
|
562 |
//conditions - e.g. QTBUG-4733 |
|
563 |
//if(id->IsFocused()) // Avoid unnecessary calls to FocusChanged() |
|
564 |
id->setFocusSafely(false); |
|
565 |
id->MakeVisible(false); |
|
566 |
if (QWidgetBackingStore *bs = maybeBackingStore()) |
|
567 |
bs->releaseBuffer(); |
|
568 |
} else { |
|
569 |
invalidateBuffer(q->rect()); |
|
570 |
} |
|
571 |
||
572 |
q->setAttribute(Qt::WA_Mapped, false); |
|
573 |
} |
|
574 |
||
575 |
void QWidgetPrivate::setFocus_sys() |
|
576 |
{ |
|
577 |
Q_Q(QWidget); |
|
578 |
if (q->testAttribute(Qt::WA_WState_Created) && q->window()->windowType() != Qt::Popup) |
|
579 |
if (!q->effectiveWinId()->IsFocused()) // Avoid unnecessry calls to FocusChanged() |
|
580 |
static_cast<QSymbianControl *>(q->effectiveWinId())->setFocusSafely(true); |
|
581 |
} |
|
582 |
||
583 |
void QWidgetPrivate::raise_sys() |
|
584 |
{ |
|
585 |
Q_Q(QWidget); |
|
586 |
||
587 |
Q_ASSERT(q->testAttribute(Qt::WA_WState_Created)); |
|
588 |
if (q->internalWinId()) { |
|
589 |
q->internalWinId()->DrawableWindow()->SetOrdinalPosition(0); |
|
590 |
||
591 |
// If toplevel widget, raise app to foreground |
|
592 |
if (q->isWindow()) |
|
593 |
S60->wsSession().SetWindowGroupOrdinalPosition(S60->windowGroup().Identifier(), 0); |
|
594 |
} |
|
595 |
} |
|
596 |
||
597 |
void QWidgetPrivate::lower_sys() |
|
598 |
{ |
|
599 |
Q_Q(QWidget); |
|
600 |
||
601 |
Q_ASSERT(q->testAttribute(Qt::WA_WState_Created)); |
|
3
41300fa6a67c
Revision: 201003
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
0
diff
changeset
|
602 |
if (q->internalWinId()) { |
41300fa6a67c
Revision: 201003
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
0
diff
changeset
|
603 |
// If toplevel widget, lower app to background |
41300fa6a67c
Revision: 201003
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
0
diff
changeset
|
604 |
if (q->isWindow()) |
41300fa6a67c
Revision: 201003
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
0
diff
changeset
|
605 |
S60->wsSession().SetWindowGroupOrdinalPosition(S60->windowGroup().Identifier(), -1); |
41300fa6a67c
Revision: 201003
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
0
diff
changeset
|
606 |
else |
41300fa6a67c
Revision: 201003
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
0
diff
changeset
|
607 |
q->internalWinId()->DrawableWindow()->SetOrdinalPosition(-1); |
41300fa6a67c
Revision: 201003
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
0
diff
changeset
|
608 |
} |
0 | 609 |
|
610 |
if (!q->isWindow()) |
|
611 |
invalidateBuffer(q->rect()); |
|
612 |
} |
|
613 |
||
614 |
void QWidgetPrivate::setModal_sys() |
|
615 |
{ |
|
616 |
||
617 |
} |
|
618 |
||
619 |
void QWidgetPrivate::stackUnder_sys(QWidget* w) |
|
620 |
{ |
|
621 |
Q_Q(QWidget); |
|
622 |
Q_ASSERT(q->testAttribute(Qt::WA_WState_Created)); |
|
623 |
||
624 |
if (q->internalWinId() && w->internalWinId()) { |
|
625 |
RDrawableWindow *const thisWindow = q->internalWinId()->DrawableWindow(); |
|
626 |
RDrawableWindow *const otherWindow = w->internalWinId()->DrawableWindow(); |
|
627 |
thisWindow->SetOrdinalPosition(otherWindow->OrdinalPosition() + 1); |
|
628 |
} |
|
629 |
||
630 |
if (!q->isWindow() || !w->internalWinId()) |
|
631 |
invalidateBuffer(q->rect()); |
|
632 |
} |
|
633 |
||
634 |
void QWidgetPrivate::reparentChildren() |
|
635 |
{ |
|
636 |
Q_Q(QWidget); |
|
637 |
||
638 |
QObjectList chlist = q->children(); |
|
639 |
for (int i = 0; i < chlist.size(); ++i) { // reparent children |
|
640 |
QObject *obj = chlist.at(i); |
|
641 |
if (obj->isWidgetType()) { |
|
642 |
QWidget *w = (QWidget *)obj; |
|
643 |
if (!w->testAttribute(Qt::WA_WState_Created)) |
|
644 |
continue; |
|
645 |
if (!w->isWindow()) { |
|
646 |
w->d_func()->invalidateBuffer(w->rect()); |
|
647 |
WId parent = q->effectiveWinId(); |
|
648 |
WId child = w->effectiveWinId(); |
|
649 |
if (parent != child) { |
|
650 |
// Child widget is native. Because Symbian windows cannot be |
|
651 |
// re-parented, we must re-create the window. |
|
652 |
const WId window = 0; |
|
653 |
const bool initializeWindow = false; |
|
654 |
const bool destroyOldWindow = true; |
|
655 |
w->d_func()->create_sys(window, initializeWindow, destroyOldWindow); |
|
656 |
} |
|
657 |
// ### TODO: We probably also need to update the component array here |
|
658 |
w->d_func()->reparentChildren(); |
|
659 |
} else { |
|
660 |
bool showIt = w->isVisible(); |
|
661 |
QPoint old_pos = w->pos(); |
|
662 |
w->setParent(q, w->windowFlags()); |
|
663 |
w->move(old_pos); |
|
664 |
if (showIt) |
|
665 |
w->show(); |
|
666 |
} |
|
667 |
} |
|
668 |
} |
|
669 |
} |
|
670 |
||
671 |
void QWidgetPrivate::setParent_sys(QWidget *parent, Qt::WindowFlags f) |
|
672 |
{ |
|
673 |
Q_Q(QWidget); |
|
674 |
||
675 |
bool wasCreated = q->testAttribute(Qt::WA_WState_Created); |
|
676 |
||
677 |
if (q->isVisible() && q->parentWidget() && parent != q->parentWidget()) |
|
678 |
q->parentWidget()->d_func()->invalidateBuffer(q->geometry()); |
|
679 |
||
680 |
if (q->testAttribute(Qt::WA_DropSiteRegistered)) |
|
681 |
q->setAttribute(Qt::WA_DropSiteRegistered, false); |
|
682 |
||
683 |
QSymbianControl *old_winid = static_cast<QSymbianControl *>(wasCreated ? data.winid : 0); |
|
684 |
if ((q->windowType() == Qt::Desktop)) |
|
685 |
old_winid = 0; |
|
686 |
setWinId(0); |
|
687 |
||
688 |
// hide and reparent our own window away. Otherwise we might get |
|
689 |
// destroyed when emitting the child remove event below. See QWorkspace. |
|
690 |
if (wasCreated && old_winid) { |
|
691 |
old_winid->MakeVisible(false); |
|
692 |
if (old_winid->IsFocused()) // Avoid unnecessary calls to FocusChanged() |
|
693 |
old_winid->setFocusSafely(false); |
|
694 |
old_winid->SetParent(0); |
|
695 |
} |
|
696 |
||
697 |
QObjectPrivate::setParent_helper(parent); |
|
698 |
bool explicitlyHidden = q->testAttribute(Qt::WA_WState_Hidden) && q->testAttribute(Qt::WA_WState_ExplicitShowHide); |
|
699 |
||
700 |
data.window_flags = f; |
|
701 |
data.fstrut_dirty = true; |
|
702 |
q->setAttribute(Qt::WA_WState_Created, false); |
|
703 |
q->setAttribute(Qt::WA_WState_Visible, false); |
|
704 |
q->setAttribute(Qt::WA_WState_Hidden, false); |
|
705 |
adjustFlags(data.window_flags, q); |
|
706 |
// keep compatibility with previous versions, we need to preserve the created state |
|
707 |
// (but we recreate the winId for the widget being reparented, again for compatibility) |
|
708 |
if (wasCreated || (!q->isWindow() && parent->testAttribute(Qt::WA_WState_Created))) |
|
709 |
createWinId(); |
|
710 |
if (q->isWindow() || (!parent || parent->isVisible()) || explicitlyHidden) |
|
711 |
q->setAttribute(Qt::WA_WState_Hidden); |
|
712 |
q->setAttribute(Qt::WA_WState_ExplicitShowHide, explicitlyHidden); |
|
713 |
||
714 |
if (wasCreated) |
|
715 |
reparentChildren(); |
|
716 |
||
717 |
if (old_winid) { |
|
718 |
CBase::Delete(old_winid); |
|
719 |
} |
|
720 |
||
721 |
if (q->testAttribute(Qt::WA_AcceptDrops) |
|
722 |
|| (!q->isWindow() && q->parentWidget() && q->parentWidget()->testAttribute(Qt::WA_DropSiteRegistered))) |
|
723 |
q->setAttribute(Qt::WA_DropSiteRegistered, true); |
|
724 |
||
725 |
invalidateBuffer(q->rect()); |
|
726 |
} |
|
727 |
||
728 |
void QWidgetPrivate::setConstraints_sys() |
|
729 |
{ |
|
730 |
||
731 |
} |
|
732 |
||
733 |
||
734 |
void QWidgetPrivate::s60UpdateIsOpaque() |
|
735 |
{ |
|
736 |
Q_Q(QWidget); |
|
737 |
||
738 |
if (!q->testAttribute(Qt::WA_WState_Created) || !q->testAttribute(Qt::WA_TranslucentBackground)) |
|
739 |
return; |
|
740 |
||
741 |
if ((data.window_flags & Qt::FramelessWindowHint) == 0) |
|
742 |
return; |
|
743 |
||
744 |
RWindow *const window = static_cast<RWindow *>(q->effectiveWinId()->DrawableWindow()); |
|
745 |
||
4
3b1da2848fc7
Revision: 201003
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
3
diff
changeset
|
746 |
#ifdef Q_SYMBIAN_SEMITRANSPARENT_BG_SURFACE |
3b1da2848fc7
Revision: 201003
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
3
diff
changeset
|
747 |
window->SetSurfaceTransparency(!isOpaque); |
3b1da2848fc7
Revision: 201003
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
3
diff
changeset
|
748 |
#else |
0 | 749 |
if (!isOpaque) { |
750 |
const TDisplayMode displayMode = static_cast<TDisplayMode>(window->SetRequiredDisplayMode(EColor16MA)); |
|
751 |
if (window->SetTransparencyAlphaChannel() == KErrNone) |
|
752 |
window->SetBackgroundColor(TRgb(255, 255, 255, 0)); |
|
753 |
} else |
|
754 |
window->SetTransparentRegion(TRegionFix<1>()); |
|
4
3b1da2848fc7
Revision: 201003
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
3
diff
changeset
|
755 |
#endif |
0 | 756 |
} |
757 |
||
758 |
void QWidgetPrivate::setWindowIcon_sys(bool forceReset) |
|
759 |
{ |
|
760 |
#ifdef Q_WS_S60 |
|
761 |
Q_Q(QWidget); |
|
762 |
||
763 |
if (!q->testAttribute(Qt::WA_WState_Created) || !q->isWindow() ) |
|
764 |
return; |
|
765 |
||
766 |
QTLWExtra* topData = this->topData(); |
|
767 |
if (topData->iconPixmap && !forceReset) |
|
768 |
// already been set |
|
769 |
return; |
|
770 |
||
771 |
TRect cPaneRect; |
|
772 |
TBool found = AknLayoutUtils::LayoutMetricsRect( AknLayoutUtils::EContextPane, cPaneRect ); |
|
773 |
CAknContextPane* contextPane = S60->contextPane(); |
|
774 |
if (found && contextPane) { // We have context pane with valid metrics |
|
775 |
QIcon icon = q->windowIcon(); |
|
776 |
if (!icon.isNull()) { |
|
777 |
// Valid icon -> set it as an context pane picture |
|
778 |
QSize size = icon.actualSize(QSize(cPaneRect.Size().iWidth, cPaneRect.Size().iHeight)); |
|
779 |
QPixmap pm = icon.pixmap(size); |
|
780 |
QBitmap mask = pm.mask(); |
|
781 |
if (mask.isNull()) { |
|
782 |
mask = QBitmap(pm.size()); |
|
783 |
mask.fill(Qt::color1); |
|
784 |
} |
|
785 |
||
3
41300fa6a67c
Revision: 201003
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
0
diff
changeset
|
786 |
CFbsBitmap* nBitmap = pm.toSymbianCFbsBitmap(); |
41300fa6a67c
Revision: 201003
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
0
diff
changeset
|
787 |
CFbsBitmap* nMask = mask.toSymbianCFbsBitmap(); |
0 | 788 |
contextPane->SetPicture(nBitmap,nMask); |
789 |
} else { |
|
790 |
// Icon set to null -> set context pane picture to default |
|
791 |
QT_TRAP_THROWING(contextPane->SetPictureToDefaultL()); |
|
792 |
} |
|
793 |
} else { |
|
794 |
// Context pane does not exist, try setting small icon to title pane |
|
795 |
TRect titlePaneRect; |
|
796 |
TBool found = AknLayoutUtils::LayoutMetricsRect( AknLayoutUtils::ETitlePane, titlePaneRect ); |
|
797 |
CAknTitlePane* titlePane = S60->titlePane(); |
|
798 |
if (found && titlePane) { // We have title pane with valid metrics |
|
799 |
// The API to get title_pane graphics size is not public -> assume square space based |
|
800 |
// on titlebar font height. CAknBitmap would be optimum, wihtout setting the size, since |
|
801 |
// then title pane would automatically scale the bitmap. Unfortunately it is not public API |
|
802 |
// Also this function is leaving, although it is not named as such. |
|
803 |
const CFont * font; |
|
804 |
QT_TRAP_THROWING(font = AknLayoutUtils::FontFromId(EAknLogicalFontTitleFont)); |
|
805 |
TSize iconSize(font->HeightInPixels(), font->HeightInPixels()); |
|
806 |
||
807 |
QIcon icon = q->windowIcon(); |
|
808 |
if (!icon.isNull()) { |
|
809 |
// Valid icon -> set it as an title pane small picture |
|
810 |
QSize size = icon.actualSize(QSize(iconSize.iWidth, iconSize.iHeight)); |
|
811 |
QPixmap pm = icon.pixmap(size); |
|
812 |
QBitmap mask = pm.mask(); |
|
813 |
if (mask.isNull()) { |
|
814 |
mask = QBitmap(pm.size()); |
|
815 |
mask.fill(Qt::color1); |
|
816 |
} |
|
817 |
||
3
41300fa6a67c
Revision: 201003
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
0
diff
changeset
|
818 |
CFbsBitmap* nBitmap = pm.toSymbianCFbsBitmap(); |
41300fa6a67c
Revision: 201003
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
0
diff
changeset
|
819 |
CFbsBitmap* nMask = mask.toSymbianCFbsBitmap(); |
0 | 820 |
titlePane->SetSmallPicture( nBitmap, nMask, ETrue ); |
821 |
} else { |
|
822 |
// Icon set to null -> set context pane picture to default |
|
823 |
titlePane->SetSmallPicture( NULL, NULL, EFalse ); |
|
824 |
} |
|
825 |
} |
|
826 |
} |
|
827 |
||
828 |
#else |
|
829 |
Q_UNUSED(forceReset) |
|
830 |
#endif |
|
831 |
} |
|
832 |
||
833 |
void QWidgetPrivate::setWindowTitle_sys(const QString &caption) |
|
834 |
{ |
|
835 |
#ifdef Q_WS_S60 |
|
836 |
Q_Q(QWidget); |
|
837 |
if (q->isWindow()) { |
|
838 |
Q_ASSERT(q->testAttribute(Qt::WA_WState_Created)); |
|
839 |
CAknTitlePane* titlePane = S60->titlePane(); |
|
840 |
if (titlePane) { |
|
841 |
if (caption.isEmpty()) { |
|
842 |
QT_TRAP_THROWING(titlePane->SetTextToDefaultL()); |
|
843 |
} else { |
|
844 |
QT_TRAP_THROWING(titlePane->SetTextL(qt_QString2TPtrC(caption))); |
|
845 |
} |
|
846 |
} |
|
847 |
} |
|
848 |
#else |
|
849 |
Q_UNUSED(caption) |
|
850 |
#endif |
|
851 |
} |
|
852 |
||
853 |
void QWidgetPrivate::setWindowIconText_sys(const QString & /*iconText */) |
|
854 |
{ |
|
855 |
||
856 |
} |
|
857 |
||
858 |
void QWidgetPrivate::scroll_sys(int dx, int dy) |
|
859 |
{ |
|
860 |
Q_Q(QWidget); |
|
861 |
||
862 |
scrollChildren(dx, dy); |
|
863 |
if (!paintOnScreen() || !q->internalWinId() || !q->internalWinId()->OwnsWindow()) { |
|
864 |
scrollRect(q->rect(), dx, dy); |
|
865 |
} else { |
|
866 |
Q_ASSERT(q->testAttribute(Qt::WA_WState_Created)); |
|
867 |
RDrawableWindow *const window = q->internalWinId()->DrawableWindow(); |
|
868 |
window->Scroll(TPoint(dx, dy)); |
|
869 |
} |
|
870 |
} |
|
871 |
||
872 |
void QWidgetPrivate::scroll_sys(int dx, int dy, const QRect &r) |
|
873 |
{ |
|
874 |
Q_Q(QWidget); |
|
875 |
||
876 |
if (!paintOnScreen() || !q->internalWinId() || !q->internalWinId()->OwnsWindow()) { |
|
877 |
scrollRect(r, dx, dy); |
|
878 |
} else { |
|
879 |
Q_ASSERT(q->testAttribute(Qt::WA_WState_Created)); |
|
880 |
RDrawableWindow *const window = q->internalWinId()->DrawableWindow(); |
|
881 |
window->Scroll(TPoint(dx, dy), qt_QRect2TRect(r)); |
|
882 |
} |
|
883 |
} |
|
884 |
||
885 |
/*! |
|
886 |
For this function to work in the emulator, you must add: |
|
887 |
TRANSPARENCY |
|
888 |
To a line in the wsini.ini file. |
|
889 |
*/ |
|
890 |
void QWidgetPrivate::setWindowOpacity_sys(qreal) |
|
891 |
{ |
|
892 |
// ### TODO: Implement uniform window transparency |
|
893 |
} |
|
894 |
||
895 |
void QWidgetPrivate::updateFrameStrut() |
|
896 |
{ |
|
897 |
||
898 |
} |
|
899 |
||
900 |
void QWidgetPrivate::updateSystemBackground() |
|
901 |
{ |
|
902 |
||
903 |
} |
|
904 |
||
905 |
void QWidgetPrivate::registerDropSite(bool /* on */) |
|
906 |
{ |
|
907 |
||
908 |
} |
|
909 |
||
910 |
void QWidgetPrivate::createTLSysExtra() |
|
911 |
{ |
|
912 |
extra->topextra->backingStore = 0; |
|
8
3f74d0d4af4c
qt:70947f0f93d948bc89b3b43d00da758a51f1ef84
Eckhart Koeppen <eckhart.koppen@nokia.com>
parents:
4
diff
changeset
|
913 |
extra->topextra->inExpose = 0; |
0 | 914 |
} |
915 |
||
916 |
void QWidgetPrivate::deleteTLSysExtra() |
|
917 |
{ |
|
8
3f74d0d4af4c
qt:70947f0f93d948bc89b3b43d00da758a51f1ef84
Eckhart Koeppen <eckhart.koppen@nokia.com>
parents:
4
diff
changeset
|
918 |
delete extra->topextra->backingStore; |
3f74d0d4af4c
qt:70947f0f93d948bc89b3b43d00da758a51f1ef84
Eckhart Koeppen <eckhart.koppen@nokia.com>
parents:
4
diff
changeset
|
919 |
extra->topextra->backingStore = 0; |
0 | 920 |
} |
921 |
||
922 |
void QWidgetPrivate::createSysExtra() |
|
923 |
{ |
|
924 |
extra->activated = 0; |
|
3
41300fa6a67c
Revision: 201003
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
0
diff
changeset
|
925 |
extra->nativePaintMode = QWExtra::Default; |
41300fa6a67c
Revision: 201003
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
0
diff
changeset
|
926 |
extra->receiveNativePaintEvents = 0; |
0 | 927 |
} |
928 |
||
929 |
void QWidgetPrivate::deleteSysExtra() |
|
930 |
{ |
|
931 |
// this should only be non-zero if destroy() has not run due to constructor fail |
|
932 |
if (data.winid) { |
|
933 |
data.winid->ControlEnv()->AppUi()->RemoveFromStack(data.winid); |
|
934 |
delete data.winid; |
|
935 |
data.winid = 0; |
|
936 |
} |
|
937 |
} |
|
938 |
||
939 |
QWindowSurface *QWidgetPrivate::createDefaultWindowSurface_sys() |
|
940 |
{ |
|
941 |
return new QS60WindowSurface(q_func()); |
|
942 |
} |
|
943 |
||
944 |
void QWidgetPrivate::setMask_sys(const QRegion& /* region */) |
|
945 |
{ |
|
946 |
||
947 |
} |
|
948 |
||
949 |
void QWidgetPrivate::registerTouchWindow() |
|
950 |
{ |
|
951 |
#ifdef QT_SYMBIAN_SUPPORTS_ADVANCED_POINTER |
|
952 |
Q_Q(QWidget); |
|
953 |
if (q->testAttribute(Qt::WA_WState_Created) && q->windowType() != Qt::Desktop) { |
|
954 |
RWindow *rwindow = static_cast<RWindow *>(q->effectiveWinId()->DrawableWindow()); |
|
955 |
rwindow->EnableAdvancedPointers(); |
|
956 |
} |
|
957 |
#endif |
|
958 |
} |
|
959 |
||
960 |
int QWidget::metric(PaintDeviceMetric m) const |
|
961 |
{ |
|
962 |
Q_D(const QWidget); |
|
963 |
int val; |
|
964 |
if (m == PdmWidth) { |
|
965 |
val = data->crect.width(); |
|
966 |
} else if (m == PdmHeight) { |
|
967 |
val = data->crect.height(); |
|
968 |
} else { |
|
969 |
CWsScreenDevice *scr = S60->screenDevice(); |
|
970 |
switch(m) { |
|
971 |
case PdmDpiX: |
|
972 |
case PdmPhysicalDpiX: |
|
973 |
if (d->extra && d->extra->customDpiX) { |
|
974 |
val = d->extra->customDpiX; |
|
975 |
} else { |
|
976 |
const QWidgetPrivate *p = d; |
|
977 |
while (p->parent) { |
|
978 |
p = static_cast<const QWidget *>(p->parent)->d_func(); |
|
979 |
if (p->extra && p->extra->customDpiX) { |
|
980 |
val = p->extra->customDpiX; |
|
981 |
break; |
|
982 |
} |
|
983 |
} |
|
984 |
if (p == d || !(p->extra && p->extra->customDpiX)) |
|
985 |
val = S60->defaultDpiX; |
|
986 |
} |
|
987 |
break; |
|
988 |
case PdmDpiY: |
|
989 |
case PdmPhysicalDpiY: |
|
990 |
if (d->extra && d->extra->customDpiY) { |
|
991 |
val = d->extra->customDpiY; |
|
992 |
} else { |
|
993 |
const QWidgetPrivate *p = d; |
|
994 |
while (p->parent) { |
|
995 |
p = static_cast<const QWidget *>(p->parent)->d_func(); |
|
996 |
if (p->extra && p->extra->customDpiY) { |
|
997 |
val = p->extra->customDpiY; |
|
998 |
break; |
|
999 |
} |
|
1000 |
} |
|
1001 |
if (p == d || !(p->extra && p->extra->customDpiY)) |
|
1002 |
val = S60->defaultDpiY; |
|
1003 |
} |
|
1004 |
break; |
|
1005 |
case PdmWidthMM: |
|
1006 |
{ |
|
1007 |
TInt twips = scr->HorizontalPixelsToTwips(data->crect.width()); |
|
1008 |
val = (int)(twips * (25.4/KTwipsPerInch)); |
|
1009 |
break; |
|
1010 |
} |
|
1011 |
case PdmHeightMM: |
|
1012 |
{ |
|
1013 |
TInt twips = scr->VerticalPixelsToTwips(data->crect.height()); |
|
1014 |
val = (int)(twips * (25.4/KTwipsPerInch)); |
|
1015 |
break; |
|
1016 |
} |
|
1017 |
case PdmNumColors: |
|
1018 |
val = TDisplayModeUtils::NumDisplayModeColors(scr->DisplayMode()); |
|
1019 |
break; |
|
1020 |
case PdmDepth: |
|
1021 |
val = TDisplayModeUtils::NumDisplayModeBitsPerPixel(scr->DisplayMode()); |
|
1022 |
break; |
|
1023 |
default: |
|
1024 |
val = 0; |
|
1025 |
qWarning("QWidget::metric: Invalid metric command"); |
|
1026 |
} |
|
1027 |
} |
|
1028 |
return val; |
|
1029 |
} |
|
1030 |
||
1031 |
QPaintEngine *QWidget::paintEngine() const |
|
1032 |
{ |
|
1033 |
return 0; |
|
1034 |
} |
|
1035 |
||
1036 |
QPoint QWidget::mapToGlobal(const QPoint &pos) const |
|
1037 |
{ |
|
1038 |
Q_D(const QWidget); |
|
1039 |
if (!testAttribute(Qt::WA_WState_Created) || !internalWinId()) { |
|
1040 |
||
1041 |
QPoint p = pos + data->crect.topLeft(); |
|
1042 |
return (isWindow() || !parentWidget()) ? p : parentWidget()->mapToGlobal(p); |
|
1043 |
||
1044 |
} else if ((d->data.window_flags & Qt::Window) && internalWinId()) { //toplevel |
|
1045 |
QPoint tp = geometry().topLeft(); |
|
1046 |
return pos + tp; |
|
1047 |
} |
|
1048 |
||
1049 |
// Native window case |
|
1050 |
const TPoint widgetScreenOffset = internalWinId()->PositionRelativeToScreen(); |
|
1051 |
const QPoint globalPos = QPoint(widgetScreenOffset.iX, widgetScreenOffset.iY) + pos; |
|
1052 |
return globalPos; |
|
1053 |
} |
|
1054 |
||
1055 |
QPoint QWidget::mapFromGlobal(const QPoint &pos) const |
|
1056 |
{ |
|
1057 |
Q_D(const QWidget); |
|
1058 |
if (!testAttribute(Qt::WA_WState_Created) || !internalWinId()) { |
|
1059 |
QPoint p = (isWindow() || !parentWidget()) ? pos : parentWidget()->mapFromGlobal(pos); |
|
1060 |
return p - data->crect.topLeft(); |
|
1061 |
} else if ((d->data.window_flags & Qt::Window) && internalWinId()) { //toplevel |
|
1062 |
QPoint tp = geometry().topLeft(); |
|
1063 |
return pos - tp; |
|
1064 |
} |
|
1065 |
||
1066 |
// Native window case |
|
1067 |
const TPoint widgetScreenOffset = internalWinId()->PositionRelativeToScreen(); |
|
1068 |
const QPoint widgetPos = pos - QPoint(widgetScreenOffset.iX, widgetScreenOffset.iY); |
|
1069 |
return widgetPos; |
|
1070 |
} |
|
1071 |
||
8
3f74d0d4af4c
qt:70947f0f93d948bc89b3b43d00da758a51f1ef84
Eckhart Koeppen <eckhart.koppen@nokia.com>
parents:
4
diff
changeset
|
1072 |
static Qt::WindowStates effectiveState(Qt::WindowStates state) |
3f74d0d4af4c
qt:70947f0f93d948bc89b3b43d00da758a51f1ef84
Eckhart Koeppen <eckhart.koppen@nokia.com>
parents:
4
diff
changeset
|
1073 |
{ |
3f74d0d4af4c
qt:70947f0f93d948bc89b3b43d00da758a51f1ef84
Eckhart Koeppen <eckhart.koppen@nokia.com>
parents:
4
diff
changeset
|
1074 |
if (state & Qt::WindowMinimized) |
3f74d0d4af4c
qt:70947f0f93d948bc89b3b43d00da758a51f1ef84
Eckhart Koeppen <eckhart.koppen@nokia.com>
parents:
4
diff
changeset
|
1075 |
return Qt::WindowMinimized; |
3f74d0d4af4c
qt:70947f0f93d948bc89b3b43d00da758a51f1ef84
Eckhart Koeppen <eckhart.koppen@nokia.com>
parents:
4
diff
changeset
|
1076 |
else if (state & Qt::WindowFullScreen) |
3f74d0d4af4c
qt:70947f0f93d948bc89b3b43d00da758a51f1ef84
Eckhart Koeppen <eckhart.koppen@nokia.com>
parents:
4
diff
changeset
|
1077 |
return Qt::WindowFullScreen; |
3f74d0d4af4c
qt:70947f0f93d948bc89b3b43d00da758a51f1ef84
Eckhart Koeppen <eckhart.koppen@nokia.com>
parents:
4
diff
changeset
|
1078 |
else if (state & Qt::WindowMaximized) |
3f74d0d4af4c
qt:70947f0f93d948bc89b3b43d00da758a51f1ef84
Eckhart Koeppen <eckhart.koppen@nokia.com>
parents:
4
diff
changeset
|
1079 |
return Qt::WindowMaximized; |
3f74d0d4af4c
qt:70947f0f93d948bc89b3b43d00da758a51f1ef84
Eckhart Koeppen <eckhart.koppen@nokia.com>
parents:
4
diff
changeset
|
1080 |
return Qt::WindowNoState; |
3f74d0d4af4c
qt:70947f0f93d948bc89b3b43d00da758a51f1ef84
Eckhart Koeppen <eckhart.koppen@nokia.com>
parents:
4
diff
changeset
|
1081 |
} |
3f74d0d4af4c
qt:70947f0f93d948bc89b3b43d00da758a51f1ef84
Eckhart Koeppen <eckhart.koppen@nokia.com>
parents:
4
diff
changeset
|
1082 |
|
0 | 1083 |
void QWidget::setWindowState(Qt::WindowStates newstate) |
1084 |
{ |
|
1085 |
Q_D(QWidget); |
|
1086 |
||
1087 |
Qt::WindowStates oldstate = windowState(); |
|
8
3f74d0d4af4c
qt:70947f0f93d948bc89b3b43d00da758a51f1ef84
Eckhart Koeppen <eckhart.koppen@nokia.com>
parents:
4
diff
changeset
|
1088 |
|
3f74d0d4af4c
qt:70947f0f93d948bc89b3b43d00da758a51f1ef84
Eckhart Koeppen <eckhart.koppen@nokia.com>
parents:
4
diff
changeset
|
1089 |
const TBool isFullscreen = newstate & Qt::WindowFullScreen; |
3f74d0d4af4c
qt:70947f0f93d948bc89b3b43d00da758a51f1ef84
Eckhart Koeppen <eckhart.koppen@nokia.com>
parents:
4
diff
changeset
|
1090 |
const TBool cbaRequested = windowFlags() & Qt::WindowSoftkeysVisibleHint; |
3f74d0d4af4c
qt:70947f0f93d948bc89b3b43d00da758a51f1ef84
Eckhart Koeppen <eckhart.koppen@nokia.com>
parents:
4
diff
changeset
|
1091 |
const TBool cbaVisible = CEikButtonGroupContainer::Current() ? true : false; |
3f74d0d4af4c
qt:70947f0f93d948bc89b3b43d00da758a51f1ef84
Eckhart Koeppen <eckhart.koppen@nokia.com>
parents:
4
diff
changeset
|
1092 |
const TBool softkeyVisibilityChange = isFullscreen && (cbaRequested != cbaVisible); |
3f74d0d4af4c
qt:70947f0f93d948bc89b3b43d00da758a51f1ef84
Eckhart Koeppen <eckhart.koppen@nokia.com>
parents:
4
diff
changeset
|
1093 |
|
3f74d0d4af4c
qt:70947f0f93d948bc89b3b43d00da758a51f1ef84
Eckhart Koeppen <eckhart.koppen@nokia.com>
parents:
4
diff
changeset
|
1094 |
if (oldstate == newstate && !softkeyVisibilityChange) |
0 | 1095 |
return; |
1096 |
||
1097 |
if (isWindow()) { |
|
12
25a739ee40f4
3a438a6e0b41f1ef657ef0e648d352db636204aa
Eckhart Koeppen <eckhart.koppen@nokia.com>
parents:
8
diff
changeset
|
1098 |
createWinId(); |
25a739ee40f4
3a438a6e0b41f1ef657ef0e648d352db636204aa
Eckhart Koeppen <eckhart.koppen@nokia.com>
parents:
8
diff
changeset
|
1099 |
Q_ASSERT(testAttribute(Qt::WA_WState_Created)); |
25a739ee40f4
3a438a6e0b41f1ef657ef0e648d352db636204aa
Eckhart Koeppen <eckhart.koppen@nokia.com>
parents:
8
diff
changeset
|
1100 |
|
8
3f74d0d4af4c
qt:70947f0f93d948bc89b3b43d00da758a51f1ef84
Eckhart Koeppen <eckhart.koppen@nokia.com>
parents:
4
diff
changeset
|
1101 |
const bool wasResized = testAttribute(Qt::WA_Resized); |
3f74d0d4af4c
qt:70947f0f93d948bc89b3b43d00da758a51f1ef84
Eckhart Koeppen <eckhart.koppen@nokia.com>
parents:
4
diff
changeset
|
1102 |
const bool wasMoved = testAttribute(Qt::WA_Moved); |
3f74d0d4af4c
qt:70947f0f93d948bc89b3b43d00da758a51f1ef84
Eckhart Koeppen <eckhart.koppen@nokia.com>
parents:
4
diff
changeset
|
1103 |
|
3f74d0d4af4c
qt:70947f0f93d948bc89b3b43d00da758a51f1ef84
Eckhart Koeppen <eckhart.koppen@nokia.com>
parents:
4
diff
changeset
|
1104 |
QSymbianControl *window = static_cast<QSymbianControl *>(effectiveWinId()); |
3f74d0d4af4c
qt:70947f0f93d948bc89b3b43d00da758a51f1ef84
Eckhart Koeppen <eckhart.koppen@nokia.com>
parents:
4
diff
changeset
|
1105 |
if (window && newstate & Qt::WindowMinimized) { |
3f74d0d4af4c
qt:70947f0f93d948bc89b3b43d00da758a51f1ef84
Eckhart Koeppen <eckhart.koppen@nokia.com>
parents:
4
diff
changeset
|
1106 |
window->setFocusSafely(false); |
3f74d0d4af4c
qt:70947f0f93d948bc89b3b43d00da758a51f1ef84
Eckhart Koeppen <eckhart.koppen@nokia.com>
parents:
4
diff
changeset
|
1107 |
window->MakeVisible(false); |
3f74d0d4af4c
qt:70947f0f93d948bc89b3b43d00da758a51f1ef84
Eckhart Koeppen <eckhart.koppen@nokia.com>
parents:
4
diff
changeset
|
1108 |
} else if (window && oldstate & Qt::WindowMinimized) { |
3f74d0d4af4c
qt:70947f0f93d948bc89b3b43d00da758a51f1ef84
Eckhart Koeppen <eckhart.koppen@nokia.com>
parents:
4
diff
changeset
|
1109 |
window->setFocusSafely(true); |
3f74d0d4af4c
qt:70947f0f93d948bc89b3b43d00da758a51f1ef84
Eckhart Koeppen <eckhart.koppen@nokia.com>
parents:
4
diff
changeset
|
1110 |
window->MakeVisible(true); |
3f74d0d4af4c
qt:70947f0f93d948bc89b3b43d00da758a51f1ef84
Eckhart Koeppen <eckhart.koppen@nokia.com>
parents:
4
diff
changeset
|
1111 |
} |
3f74d0d4af4c
qt:70947f0f93d948bc89b3b43d00da758a51f1ef84
Eckhart Koeppen <eckhart.koppen@nokia.com>
parents:
4
diff
changeset
|
1112 |
|
0 | 1113 |
#ifdef Q_WS_S60 |
8
3f74d0d4af4c
qt:70947f0f93d948bc89b3b43d00da758a51f1ef84
Eckhart Koeppen <eckhart.koppen@nokia.com>
parents:
4
diff
changeset
|
1114 |
// Hide window decoration when switching to fullsccreen / minimized otherwise show decoration. |
3f74d0d4af4c
qt:70947f0f93d948bc89b3b43d00da758a51f1ef84
Eckhart Koeppen <eckhart.koppen@nokia.com>
parents:
4
diff
changeset
|
1115 |
// The window decoration visibility has to be changed before doing actual window state |
3f74d0d4af4c
qt:70947f0f93d948bc89b3b43d00da758a51f1ef84
Eckhart Koeppen <eckhart.koppen@nokia.com>
parents:
4
diff
changeset
|
1116 |
// change since in that order the availableGeometry will return directly the right size and |
3f74d0d4af4c
qt:70947f0f93d948bc89b3b43d00da758a51f1ef84
Eckhart Koeppen <eckhart.koppen@nokia.com>
parents:
4
diff
changeset
|
1117 |
// we will avoid unnecessarty redraws |
3f74d0d4af4c
qt:70947f0f93d948bc89b3b43d00da758a51f1ef84
Eckhart Koeppen <eckhart.koppen@nokia.com>
parents:
4
diff
changeset
|
1118 |
CEikStatusPane *statusPane = S60->statusPane(); |
3f74d0d4af4c
qt:70947f0f93d948bc89b3b43d00da758a51f1ef84
Eckhart Koeppen <eckhart.koppen@nokia.com>
parents:
4
diff
changeset
|
1119 |
CEikButtonGroupContainer *buttonGroup = S60->buttonGroupContainer(); |
3f74d0d4af4c
qt:70947f0f93d948bc89b3b43d00da758a51f1ef84
Eckhart Koeppen <eckhart.koppen@nokia.com>
parents:
4
diff
changeset
|
1120 |
TBool visible = !(newstate & (Qt::WindowFullScreen | Qt::WindowMinimized)); |
3f74d0d4af4c
qt:70947f0f93d948bc89b3b43d00da758a51f1ef84
Eckhart Koeppen <eckhart.koppen@nokia.com>
parents:
4
diff
changeset
|
1121 |
if (statusPane) |
3f74d0d4af4c
qt:70947f0f93d948bc89b3b43d00da758a51f1ef84
Eckhart Koeppen <eckhart.koppen@nokia.com>
parents:
4
diff
changeset
|
1122 |
statusPane->MakeVisible(visible); |
3f74d0d4af4c
qt:70947f0f93d948bc89b3b43d00da758a51f1ef84
Eckhart Koeppen <eckhart.koppen@nokia.com>
parents:
4
diff
changeset
|
1123 |
if (buttonGroup) { |
3f74d0d4af4c
qt:70947f0f93d948bc89b3b43d00da758a51f1ef84
Eckhart Koeppen <eckhart.koppen@nokia.com>
parents:
4
diff
changeset
|
1124 |
// Visibility |
3f74d0d4af4c
qt:70947f0f93d948bc89b3b43d00da758a51f1ef84
Eckhart Koeppen <eckhart.koppen@nokia.com>
parents:
4
diff
changeset
|
1125 |
buttonGroup->MakeVisible(visible || (isFullscreen && cbaRequested)); |
0 | 1126 |
|
8
3f74d0d4af4c
qt:70947f0f93d948bc89b3b43d00da758a51f1ef84
Eckhart Koeppen <eckhart.koppen@nokia.com>
parents:
4
diff
changeset
|
1127 |
// Responsiviness |
3f74d0d4af4c
qt:70947f0f93d948bc89b3b43d00da758a51f1ef84
Eckhart Koeppen <eckhart.koppen@nokia.com>
parents:
4
diff
changeset
|
1128 |
CEikCba *cba = static_cast<CEikCba *>( buttonGroup->ButtonGroup() ); // downcast from MEikButtonGroup |
3f74d0d4af4c
qt:70947f0f93d948bc89b3b43d00da758a51f1ef84
Eckhart Koeppen <eckhart.koppen@nokia.com>
parents:
4
diff
changeset
|
1129 |
TUint cbaFlags = cba->ButtonGroupFlags(); |
3f74d0d4af4c
qt:70947f0f93d948bc89b3b43d00da758a51f1ef84
Eckhart Koeppen <eckhart.koppen@nokia.com>
parents:
4
diff
changeset
|
1130 |
if(windowFlags() & Qt::WindowSoftkeysRespondHint) |
3f74d0d4af4c
qt:70947f0f93d948bc89b3b43d00da758a51f1ef84
Eckhart Koeppen <eckhart.koppen@nokia.com>
parents:
4
diff
changeset
|
1131 |
cbaFlags |= EAknCBAFlagRespondWhenInvisible; |
3f74d0d4af4c
qt:70947f0f93d948bc89b3b43d00da758a51f1ef84
Eckhart Koeppen <eckhart.koppen@nokia.com>
parents:
4
diff
changeset
|
1132 |
else |
3f74d0d4af4c
qt:70947f0f93d948bc89b3b43d00da758a51f1ef84
Eckhart Koeppen <eckhart.koppen@nokia.com>
parents:
4
diff
changeset
|
1133 |
cbaFlags &= ~EAknCBAFlagRespondWhenInvisible; |
3f74d0d4af4c
qt:70947f0f93d948bc89b3b43d00da758a51f1ef84
Eckhart Koeppen <eckhart.koppen@nokia.com>
parents:
4
diff
changeset
|
1134 |
cba->SetButtonGroupFlags(cbaFlags); |
0 | 1135 |
} |
1136 |
#endif // Q_WS_S60 |
|
1137 |
||
1138 |
// Ensure the initial size is valid, since we store it as normalGeometry below. |
|
8
3f74d0d4af4c
qt:70947f0f93d948bc89b3b43d00da758a51f1ef84
Eckhart Koeppen <eckhart.koppen@nokia.com>
parents:
4
diff
changeset
|
1139 |
if (!wasResized && !isVisible()) |
0 | 1140 |
adjustSize(); |
1141 |
||
8
3f74d0d4af4c
qt:70947f0f93d948bc89b3b43d00da758a51f1ef84
Eckhart Koeppen <eckhart.koppen@nokia.com>
parents:
4
diff
changeset
|
1142 |
QTLWExtra *top = d->topData(); |
12
25a739ee40f4
3a438a6e0b41f1ef657ef0e648d352db636204aa
Eckhart Koeppen <eckhart.koppen@nokia.com>
parents:
8
diff
changeset
|
1143 |
QRect normalGeometry = (top->normalGeometry.width() < 0) ? geometry() : top->normalGeometry; |
0 | 1144 |
|
8
3f74d0d4af4c
qt:70947f0f93d948bc89b3b43d00da758a51f1ef84
Eckhart Koeppen <eckhart.koppen@nokia.com>
parents:
4
diff
changeset
|
1145 |
const bool cbaVisibilityHint = windowFlags() & Qt::WindowSoftkeysVisibleHint; |
12
25a739ee40f4
3a438a6e0b41f1ef657ef0e648d352db636204aa
Eckhart Koeppen <eckhart.koppen@nokia.com>
parents:
8
diff
changeset
|
1146 |
if (newstate & Qt::WindowFullScreen && !cbaVisibilityHint) { |
25a739ee40f4
3a438a6e0b41f1ef657ef0e648d352db636204aa
Eckhart Koeppen <eckhart.koppen@nokia.com>
parents:
8
diff
changeset
|
1147 |
window->SetExtentToWholeScreen(); |
25a739ee40f4
3a438a6e0b41f1ef657ef0e648d352db636204aa
Eckhart Koeppen <eckhart.koppen@nokia.com>
parents:
8
diff
changeset
|
1148 |
} else if (newstate & Qt::WindowMaximized || ((newstate & Qt::WindowFullScreen) && cbaVisibilityHint)) { |
25a739ee40f4
3a438a6e0b41f1ef657ef0e648d352db636204aa
Eckhart Koeppen <eckhart.koppen@nokia.com>
parents:
8
diff
changeset
|
1149 |
TRect maxExtent = qt_QRect2TRect(qApp->desktop()->availableGeometry(this)); |
25a739ee40f4
3a438a6e0b41f1ef657ef0e648d352db636204aa
Eckhart Koeppen <eckhart.koppen@nokia.com>
parents:
8
diff
changeset
|
1150 |
window->SetExtent(maxExtent.iTl, maxExtent.Size()); |
25a739ee40f4
3a438a6e0b41f1ef657ef0e648d352db636204aa
Eckhart Koeppen <eckhart.koppen@nokia.com>
parents:
8
diff
changeset
|
1151 |
} else { |
25a739ee40f4
3a438a6e0b41f1ef657ef0e648d352db636204aa
Eckhart Koeppen <eckhart.koppen@nokia.com>
parents:
8
diff
changeset
|
1152 |
#ifdef Q_WS_S60 |
25a739ee40f4
3a438a6e0b41f1ef657ef0e648d352db636204aa
Eckhart Koeppen <eckhart.koppen@nokia.com>
parents:
8
diff
changeset
|
1153 |
// With delayed creation of S60 app panes, the normalGeometry calculated above is not |
25a739ee40f4
3a438a6e0b41f1ef657ef0e648d352db636204aa
Eckhart Koeppen <eckhart.koppen@nokia.com>
parents:
8
diff
changeset
|
1154 |
// accurate because it did not consider the status pane. This means that when returning |
25a739ee40f4
3a438a6e0b41f1ef657ef0e648d352db636204aa
Eckhart Koeppen <eckhart.koppen@nokia.com>
parents:
8
diff
changeset
|
1155 |
// normal mode after showing the status pane, the geometry would overlap so we should |
25a739ee40f4
3a438a6e0b41f1ef657ef0e648d352db636204aa
Eckhart Koeppen <eckhart.koppen@nokia.com>
parents:
8
diff
changeset
|
1156 |
// move it if it never had an explicit position. |
25a739ee40f4
3a438a6e0b41f1ef657ef0e648d352db636204aa
Eckhart Koeppen <eckhart.koppen@nokia.com>
parents:
8
diff
changeset
|
1157 |
if (!wasMoved && statusPane && visible) { |
25a739ee40f4
3a438a6e0b41f1ef657ef0e648d352db636204aa
Eckhart Koeppen <eckhart.koppen@nokia.com>
parents:
8
diff
changeset
|
1158 |
TPoint tl = static_cast<CEikAppUi*>(S60->appUi())->ClientRect().iTl; |
25a739ee40f4
3a438a6e0b41f1ef657ef0e648d352db636204aa
Eckhart Koeppen <eckhart.koppen@nokia.com>
parents:
8
diff
changeset
|
1159 |
normalGeometry.setTopLeft(QPoint(tl.iX, tl.iY)); |
25a739ee40f4
3a438a6e0b41f1ef657ef0e648d352db636204aa
Eckhart Koeppen <eckhart.koppen@nokia.com>
parents:
8
diff
changeset
|
1160 |
} |
25a739ee40f4
3a438a6e0b41f1ef657ef0e648d352db636204aa
Eckhart Koeppen <eckhart.koppen@nokia.com>
parents:
8
diff
changeset
|
1161 |
#endif |
8
3f74d0d4af4c
qt:70947f0f93d948bc89b3b43d00da758a51f1ef84
Eckhart Koeppen <eckhart.koppen@nokia.com>
parents:
4
diff
changeset
|
1162 |
setGeometry(normalGeometry); |
12
25a739ee40f4
3a438a6e0b41f1ef657ef0e648d352db636204aa
Eckhart Koeppen <eckhart.koppen@nokia.com>
parents:
8
diff
changeset
|
1163 |
} |
8
3f74d0d4af4c
qt:70947f0f93d948bc89b3b43d00da758a51f1ef84
Eckhart Koeppen <eckhart.koppen@nokia.com>
parents:
4
diff
changeset
|
1164 |
|
3f74d0d4af4c
qt:70947f0f93d948bc89b3b43d00da758a51f1ef84
Eckhart Koeppen <eckhart.koppen@nokia.com>
parents:
4
diff
changeset
|
1165 |
//restore normal geometry |
3f74d0d4af4c
qt:70947f0f93d948bc89b3b43d00da758a51f1ef84
Eckhart Koeppen <eckhart.koppen@nokia.com>
parents:
4
diff
changeset
|
1166 |
top->normalGeometry = normalGeometry; |
3f74d0d4af4c
qt:70947f0f93d948bc89b3b43d00da758a51f1ef84
Eckhart Koeppen <eckhart.koppen@nokia.com>
parents:
4
diff
changeset
|
1167 |
|
3f74d0d4af4c
qt:70947f0f93d948bc89b3b43d00da758a51f1ef84
Eckhart Koeppen <eckhart.koppen@nokia.com>
parents:
4
diff
changeset
|
1168 |
// FixMe QTBUG-8977 |
3f74d0d4af4c
qt:70947f0f93d948bc89b3b43d00da758a51f1ef84
Eckhart Koeppen <eckhart.koppen@nokia.com>
parents:
4
diff
changeset
|
1169 |
// In some platforms, WA_Resized and WA_Moved are also not set when application window state is |
3f74d0d4af4c
qt:70947f0f93d948bc89b3b43d00da758a51f1ef84
Eckhart Koeppen <eckhart.koppen@nokia.com>
parents:
4
diff
changeset
|
1170 |
// anything else than normal. In Symbian we can restore them only for normal window state since |
3f74d0d4af4c
qt:70947f0f93d948bc89b3b43d00da758a51f1ef84
Eckhart Koeppen <eckhart.koppen@nokia.com>
parents:
4
diff
changeset
|
1171 |
// restoring for other modes, will make fluidlauncher to be launched in wrong size (200x100) |
3f74d0d4af4c
qt:70947f0f93d948bc89b3b43d00da758a51f1ef84
Eckhart Koeppen <eckhart.koppen@nokia.com>
parents:
4
diff
changeset
|
1172 |
if (effectiveState(newstate) == Qt::WindowNoState) { |
3f74d0d4af4c
qt:70947f0f93d948bc89b3b43d00da758a51f1ef84
Eckhart Koeppen <eckhart.koppen@nokia.com>
parents:
4
diff
changeset
|
1173 |
setAttribute(Qt::WA_Resized, wasResized); |
3f74d0d4af4c
qt:70947f0f93d948bc89b3b43d00da758a51f1ef84
Eckhart Koeppen <eckhart.koppen@nokia.com>
parents:
4
diff
changeset
|
1174 |
setAttribute(Qt::WA_Moved, wasMoved); |
0 | 1175 |
} |
1176 |
} |
|
1177 |
||
1178 |
data->window_state = newstate; |
|
1179 |
||
1180 |
if (newstate & Qt::WindowActive) |
|
1181 |
activateWindow(); |
|
1182 |
||
1183 |
QWindowStateChangeEvent e(oldstate); |
|
1184 |
QApplication::sendEvent(this, &e); |
|
1185 |
} |
|
1186 |
||
1187 |
||
1188 |
void QWidget::destroy(bool destroyWindow, bool destroySubWindows) |
|
1189 |
{ |
|
1190 |
Q_D(QWidget); |
|
1191 |
if (!isWindow() && parentWidget()) |
|
1192 |
parentWidget()->d_func()->invalidateBuffer(geometry()); |
|
1193 |
d->deactivateWidgetCleanup(); |
|
1194 |
QSymbianControl *id = static_cast<QSymbianControl *>(internalWinId()); |
|
1195 |
if (testAttribute(Qt::WA_WState_Created)) { |
|
1196 |
||
1197 |
#ifndef QT_NO_IM |
|
1198 |
if (d->ic) { |
|
1199 |
delete d->ic; |
|
1200 |
} else { |
|
4
3b1da2848fc7
Revision: 201003
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
3
diff
changeset
|
1201 |
QInputContext *ic = QApplicationPrivate::inputContext; |
0 | 1202 |
if (ic) { |
1203 |
ic->widgetDestroyed(this); |
|
1204 |
} |
|
1205 |
} |
|
1206 |
#endif |
|
1207 |
||
1208 |
if (QWidgetPrivate::mouseGrabber == this) |
|
1209 |
releaseMouse(); |
|
1210 |
if (QWidgetPrivate::keyboardGrabber == this) |
|
1211 |
releaseKeyboard(); |
|
1212 |
setAttribute(Qt::WA_WState_Created, false); |
|
1213 |
QObjectList childList = children(); |
|
1214 |
for (int i = 0; i < childList.size(); ++i) { // destroy all widget children |
|
1215 |
register QObject *obj = childList.at(i); |
|
1216 |
if (obj->isWidgetType()) |
|
1217 |
static_cast<QWidget*>(obj)->destroy(destroySubWindows, |
|
1218 |
destroySubWindows); |
|
1219 |
} |
|
1220 |
if (destroyWindow && !(windowType() == Qt::Desktop) && id) { |
|
1221 |
if (id->IsFocused()) // Avoid unnecessry calls to FocusChanged() |
|
1222 |
id->setFocusSafely(false); |
|
1223 |
id->ControlEnv()->AppUi()->RemoveFromStack(id); |
|
1224 |
} |
|
1225 |
} |
|
1226 |
||
1227 |
QT_TRY { |
|
1228 |
d->setWinId(0); |
|
1229 |
} QT_CATCH (const std::bad_alloc &) { |
|
1230 |
// swallow - destructors must not throw |
|
1231 |
} |
|
1232 |
||
1233 |
if (destroyWindow) { |
|
8
3f74d0d4af4c
qt:70947f0f93d948bc89b3b43d00da758a51f1ef84
Eckhart Koeppen <eckhart.koppen@nokia.com>
parents:
4
diff
changeset
|
1234 |
delete id; |
3f74d0d4af4c
qt:70947f0f93d948bc89b3b43d00da758a51f1ef84
Eckhart Koeppen <eckhart.koppen@nokia.com>
parents:
4
diff
changeset
|
1235 |
// At this point the backing store should already be destroyed |
3f74d0d4af4c
qt:70947f0f93d948bc89b3b43d00da758a51f1ef84
Eckhart Koeppen <eckhart.koppen@nokia.com>
parents:
4
diff
changeset
|
1236 |
// so we flush the command buffer to ensure that the freeing of |
3f74d0d4af4c
qt:70947f0f93d948bc89b3b43d00da758a51f1ef84
Eckhart Koeppen <eckhart.koppen@nokia.com>
parents:
4
diff
changeset
|
1237 |
// those resources and deleting the window can happen "atomically" |
3f74d0d4af4c
qt:70947f0f93d948bc89b3b43d00da758a51f1ef84
Eckhart Koeppen <eckhart.koppen@nokia.com>
parents:
4
diff
changeset
|
1238 |
S60->wsSession().Flush(); |
0 | 1239 |
} |
1240 |
} |
|
1241 |
||
1242 |
QWidget *QWidget::mouseGrabber() |
|
1243 |
{ |
|
1244 |
return QWidgetPrivate::mouseGrabber; |
|
1245 |
} |
|
1246 |
||
1247 |
QWidget *QWidget::keyboardGrabber() |
|
1248 |
{ |
|
1249 |
return QWidgetPrivate::keyboardGrabber; |
|
1250 |
} |
|
1251 |
||
1252 |
void QWidget::grabKeyboard() |
|
1253 |
{ |
|
1254 |
if (!qt_nograb()) { |
|
1255 |
if (QWidgetPrivate::keyboardGrabber && QWidgetPrivate::keyboardGrabber != this) |
|
1256 |
QWidgetPrivate::keyboardGrabber->releaseKeyboard(); |
|
1257 |
||
1258 |
// ### TODO: Native keyboard grab |
|
1259 |
||
1260 |
QWidgetPrivate::keyboardGrabber = this; |
|
1261 |
} |
|
1262 |
} |
|
1263 |
||
1264 |
void QWidget::releaseKeyboard() |
|
1265 |
{ |
|
1266 |
if (!qt_nograb() && QWidgetPrivate::keyboardGrabber == this) { |
|
1267 |
// ### TODO: Native keyboard release |
|
1268 |
QWidgetPrivate::keyboardGrabber = 0; |
|
1269 |
} |
|
1270 |
} |
|
1271 |
||
1272 |
void QWidget::grabMouse() |
|
1273 |
{ |
|
3
41300fa6a67c
Revision: 201003
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
0
diff
changeset
|
1274 |
if (isVisible() && !qt_nograb()) { |
0 | 1275 |
if (QWidgetPrivate::mouseGrabber && QWidgetPrivate::mouseGrabber != this) |
1276 |
QWidgetPrivate::mouseGrabber->releaseMouse(); |
|
1277 |
Q_ASSERT(testAttribute(Qt::WA_WState_Created)); |
|
1278 |
WId id = effectiveWinId(); |
|
1279 |
id->SetPointerCapture(true); |
|
1280 |
QWidgetPrivate::mouseGrabber = this; |
|
1281 |
||
1282 |
#ifndef QT_NO_CURSOR |
|
1283 |
QApplication::setOverrideCursor(cursor()); |
|
1284 |
#endif |
|
1285 |
} |
|
1286 |
} |
|
1287 |
||
1288 |
#ifndef QT_NO_CURSOR |
|
1289 |
void QWidget::grabMouse(const QCursor &cursor) |
|
1290 |
{ |
|
3
41300fa6a67c
Revision: 201003
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
0
diff
changeset
|
1291 |
if (isVisible() && !qt_nograb()) { |
0 | 1292 |
if (QWidgetPrivate::mouseGrabber && QWidgetPrivate::mouseGrabber != this) |
1293 |
QWidgetPrivate::mouseGrabber->releaseMouse(); |
|
1294 |
Q_ASSERT(testAttribute(Qt::WA_WState_Created)); |
|
1295 |
WId id = effectiveWinId(); |
|
1296 |
id->SetPointerCapture(true); |
|
1297 |
QWidgetPrivate::mouseGrabber = this; |
|
1298 |
||
1299 |
QApplication::setOverrideCursor(cursor); |
|
1300 |
} |
|
1301 |
} |
|
1302 |
#endif |
|
1303 |
||
1304 |
void QWidget::releaseMouse() |
|
1305 |
{ |
|
1306 |
if (!qt_nograb() && QWidgetPrivate::mouseGrabber == this) { |
|
1307 |
Q_ASSERT(testAttribute(Qt::WA_WState_Created)); |
|
8
3f74d0d4af4c
qt:70947f0f93d948bc89b3b43d00da758a51f1ef84
Eckhart Koeppen <eckhart.koppen@nokia.com>
parents:
4
diff
changeset
|
1308 |
if(!window()->isModal()) { |
3f74d0d4af4c
qt:70947f0f93d948bc89b3b43d00da758a51f1ef84
Eckhart Koeppen <eckhart.koppen@nokia.com>
parents:
4
diff
changeset
|
1309 |
WId id = effectiveWinId(); |
3f74d0d4af4c
qt:70947f0f93d948bc89b3b43d00da758a51f1ef84
Eckhart Koeppen <eckhart.koppen@nokia.com>
parents:
4
diff
changeset
|
1310 |
id->SetPointerCapture(false); |
3f74d0d4af4c
qt:70947f0f93d948bc89b3b43d00da758a51f1ef84
Eckhart Koeppen <eckhart.koppen@nokia.com>
parents:
4
diff
changeset
|
1311 |
} |
0 | 1312 |
QWidgetPrivate::mouseGrabber = 0; |
1313 |
#ifndef QT_NO_CURSOR |
|
1314 |
QApplication::restoreOverrideCursor(); |
|
1315 |
#endif |
|
1316 |
} |
|
1317 |
} |
|
1318 |
||
1319 |
void QWidget::activateWindow() |
|
1320 |
{ |
|
1321 |
Q_D(QWidget); |
|
1322 |
||
1323 |
QWidget *tlw = window(); |
|
1324 |
if (tlw->isVisible()) { |
|
1325 |
window()->createWinId(); |
|
1326 |
QSymbianControl *id = static_cast<QSymbianControl *>(tlw->internalWinId()); |
|
1327 |
id->setFocusSafely(true); |
|
1328 |
} |
|
1329 |
} |
|
1330 |
||
1331 |
#ifndef QT_NO_CURSOR |
|
1332 |
||
1333 |
void QWidgetPrivate::setCursor_sys(const QCursor &cursor) |
|
1334 |
{ |
|
1335 |
Q_UNUSED(cursor); |
|
1336 |
Q_Q(QWidget); |
|
1337 |
qt_symbian_set_cursor(q, false); |
|
1338 |
} |
|
1339 |
||
1340 |
void QWidgetPrivate::unsetCursor_sys() |
|
1341 |
{ |
|
1342 |
Q_Q(QWidget); |
|
1343 |
qt_symbian_set_cursor(q, false); |
|
1344 |
} |
|
1345 |
#endif |
|
1346 |
||
1347 |
QT_END_NAMESPACE |