diff options
Diffstat (limited to 'src/gui/kernel/qwidget_s60.cpp')
-rw-r--r-- | src/gui/kernel/qwidget_s60.cpp | 77 |
1 files changed, 58 insertions, 19 deletions
diff --git a/src/gui/kernel/qwidget_s60.cpp b/src/gui/kernel/qwidget_s60.cpp index 744d20f..522ce33 100644 --- a/src/gui/kernel/qwidget_s60.cpp +++ b/src/gui/kernel/qwidget_s60.cpp @@ -188,7 +188,7 @@ void QWidgetPrivate::setGeometry_sys(int x, int y, int w, int h, bool isMove) if (isResize) data.window_state &= ~Qt::WindowMaximized; - if(q->isWindow()) { + if (q->isWindow()) { if (w == 0 || h == 0) { q->setAttribute(Qt::WA_OutsideWSRange, true); if (q->isVisible() && q->testAttribute(Qt::WA_Mapped)) @@ -287,7 +287,7 @@ void QWidgetPrivate::create_sys(WId window, bool /* initializeWindow */, bool de TSize screenSize = S60->screenDevice()->SizeInPixels(); data.crect.setRect(0, 0, screenSize.iWidth, screenSize.iHeight); q->setAttribute(Qt::WA_DontShowOnScreen); - } else if(topLevel && !q->testAttribute(Qt::WA_Resized)){ + } else if (topLevel && !q->testAttribute(Qt::WA_Resized)){ int width = sw; int height = sh; if (extra) { @@ -300,7 +300,7 @@ void QWidgetPrivate::create_sys(WId window, bool /* initializeWindow */, bool de CCoeControl *destroyw = 0; createExtra(); - if(window) { + if (window) { if (destroyOldWindow) destroyw = data.winid; id = window; @@ -416,7 +416,7 @@ void QWidgetPrivate::hide_sys() deactivateWidgetCleanup(); WId id = q->internalWinId(); if (q->isWindow() && id) { - if(id->IsFocused()) // Avoid unnecessary calls to FocusChanged() + if (id->IsFocused()) // Avoid unnecessary calls to FocusChanged() id->SetFocus(false); id->MakeVisible(false); if (QWidgetBackingStore *bs = maybeBackingStore()) @@ -432,7 +432,7 @@ void QWidgetPrivate::setFocus_sys() { Q_Q(QWidget); if (q->testAttribute(Qt::WA_WState_Created) && q->window()->windowType() != Qt::Popup) - if(!q->effectiveWinId()->IsFocused()) // Avoid unnecessry calls to FocusChanged() + if (!q->effectiveWinId()->IsFocused()) // Avoid unnecessry calls to FocusChanged() q->effectiveWinId()->SetFocus(true); } @@ -482,7 +482,7 @@ void QWidgetPrivate::lower_sys() if (q->internalWinId() && tlwExtra) { tlwExtra->rwindow->SetOrdinalPosition(-1); } - if(!q->isWindow()) + if (!q->isWindow()) invalidateBuffer(q->rect()); } @@ -499,7 +499,7 @@ void QWidgetPrivate::stackUnder_sys(QWidget* w) QTLWExtra *tlwExtraSibling = w->d_func()->maybeTopData(); if (q->internalWinId() && tlwExtra && w->internalWinId() && tlwExtraSibling) tlwExtra->rwindow->SetOrdinalPosition(tlwExtraSibling->rwindow->OrdinalPosition() + 1); - if(!q->isWindow() || !w->internalWinId()) + if (!q->isWindow() || !w->internalWinId()) invalidateBuffer(q->rect()); } @@ -553,7 +553,7 @@ void QWidgetPrivate::setParent_sys(QWidget *parent, Qt::WindowFlags f) // destroyed when emitting the child remove event below. See QWorkspace. if (wasCreated && old_winid) { old_winid->MakeVisible(false); - if(old_winid->IsFocused()) // Avoid unnecessary calls to FocusChanged() + if (old_winid->IsFocused()) // Avoid unnecessary calls to FocusChanged() old_winid->SetFocus(false); old_winid->SetParent(0); } @@ -660,7 +660,7 @@ CFbsBitmap* qt_pixmapToNativeBitmap(QPixmap pixmap, bool invert) fbsBitmap->LockHeap(); QImage image = pixmap.toImage(); - if(invert) + if (invert) image.invertPixels(); int height = pixmap.size().height(); @@ -764,8 +764,8 @@ void QWidgetPrivate::setWindowTitle_sys(const QString &caption) if (q->isWindow()) { Q_ASSERT(q->testAttribute(Qt::WA_WState_Created)); CAknTitlePane* titlePane = S60->titlePane(); - if(titlePane) { - if(caption.isEmpty()) { + if (titlePane) { + if (caption.isEmpty()) { QT_TRAP_THROWING(titlePane->SetTextToDefaultL()); } else { QT_TRAP_THROWING(titlePane->SetTextL(qt_QString2TPtrC(caption))); @@ -996,7 +996,7 @@ void QWidget::setWindowState(Qt::WindowStates newstate) // The window decoration visibility has to be changed before doing actual // window state change since in that order the availableGeometry will return // directly the right size and we will avoid unnecessarty redraws - if((oldstate & Qt::WindowFullScreen) != (newstate & Qt::WindowFullScreen) || + if ((oldstate & Qt::WindowFullScreen) != (newstate & Qt::WindowFullScreen) || oldstate == Qt::WindowNoState) { CEikStatusPane* statusPane = S60->statusPane(); CEikButtonGroupContainer* buttonGroup = S60->buttonGroupContainer(); @@ -1061,7 +1061,7 @@ void QWidget::setWindowState(Qt::WindowStates newstate) if (newstate & Qt::WindowMinimized) { if (isVisible()) { WId id = effectiveWinId(); - if(id->IsFocused()) // Avoid unnecessary calls to FocusChanged() + if (id->IsFocused()) // Avoid unnecessary calls to FocusChanged() id->SetFocus(false); id->MakeVisible(false); } @@ -1069,7 +1069,7 @@ void QWidget::setWindowState(Qt::WindowStates newstate) if (isVisible()) { WId id = effectiveWinId(); id->MakeVisible(true); - if(!id->IsFocused()) // Avoid unnecessary calls to FocusChanged() + if (!id->IsFocused()) // Avoid unnecessary calls to FocusChanged() id->SetFocus(true); } const QRect normalGeometry = geometry(); @@ -1111,6 +1111,10 @@ void QWidget::destroy(bool destroyWindow, bool destroySubWindows) } #endif + if (QWidgetPrivate::mouseGrabber == this) + releaseMouse(); + if (QWidgetPrivate::keyboardGrabber == this) + releaseKeyboard(); setAttribute(Qt::WA_WState_Created, false); QObjectList childList = children(); for (int i = 0; i < childList.size(); ++i) { // destroy all widget children @@ -1119,12 +1123,8 @@ void QWidget::destroy(bool destroyWindow, bool destroySubWindows) static_cast<QWidget*>(obj)->destroy(destroySubWindows, destroySubWindows); } - if (QWidgetPrivate::mouseGrabber == this) - releaseMouse(); - if (QWidgetPrivate::keyboardGrabber == this) - releaseKeyboard(); if (destroyWindow && !(windowType() == Qt::Desktop) && id) { - if(id->IsFocused()) // Avoid unnecessry calls to FocusChanged() + if (id->IsFocused()) // Avoid unnecessry calls to FocusChanged() id->SetFocus(false); id->ControlEnv()->AppUi()->RemoveFromStack(id); @@ -1192,8 +1192,28 @@ void QWidget::grabMouse() WId id = effectiveWinId(); id->SetPointerCapture(true); QWidgetPrivate::mouseGrabber = this; + +#ifndef QT_NO_CURSOR + QApplication::setOverrideCursor(cursor()); +#endif + } +} + +#ifndef QT_NO_CURSOR +void QWidget::grabMouse(const QCursor &cursor) +{ + if (!qt_nograb()) { + if (QWidgetPrivate::mouseGrabber && QWidgetPrivate::mouseGrabber != this) + QWidgetPrivate::mouseGrabber->releaseMouse(); + Q_ASSERT(testAttribute(Qt::WA_WState_Created)); + WId id = effectiveWinId(); + id->SetPointerCapture(true); + QWidgetPrivate::mouseGrabber = this; + + QApplication::setOverrideCursor(cursor); } } +#endif void QWidget::releaseMouse() { @@ -1202,6 +1222,8 @@ void QWidget::releaseMouse() WId id = effectiveWinId(); id->SetPointerCapture(false); QWidgetPrivate::mouseGrabber = 0; + + QApplication::restoreOverrideCursor(); } } @@ -1215,4 +1237,21 @@ void QWidget::activateWindow() id->SetFocus(true); } } + +#ifndef QT_NO_CURSOR + +void QWidgetPrivate::setCursor_sys(const QCursor &cursor) +{ + Q_UNUSED(cursor); + Q_Q(QWidget); + qt_symbian_set_cursor(q, false); +} + +void QWidgetPrivate::unsetCursor_sys() +{ + Q_Q(QWidget); + qt_symbian_set_cursor(q, false); +} +#endif + QT_END_NAMESPACE |