diff options
Diffstat (limited to 'src/gui/kernel/qwidget.cpp')
-rw-r--r-- | src/gui/kernel/qwidget.cpp | 46 |
1 files changed, 29 insertions, 17 deletions
diff --git a/src/gui/kernel/qwidget.cpp b/src/gui/kernel/qwidget.cpp index e551a1d..81a9a80 100644 --- a/src/gui/kernel/qwidget.cpp +++ b/src/gui/kernel/qwidget.cpp @@ -1,6 +1,6 @@ /**************************************************************************** ** -** Copyright (C) 2009 Nokia Corporation and/or its subsidiary(-ies). +** Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies). ** All rights reserved. ** Contact: Nokia Corporation (qt-info@nokia.com) ** @@ -3088,7 +3088,8 @@ void QWidgetPrivate::setEnabled_helper(bool enable) QWidget *focusWidget = effectiveFocusWidget(); QInputContext *qic = focusWidget->d_func()->inputContext(); if (enable) { - qic->setFocusWidget(focusWidget); + if (focusWidget->testAttribute(Qt::WA_InputMethodEnabled)) + qic->setFocusWidget(focusWidget); } else { qic->reset(); qic->setFocusWidget(0); @@ -9774,13 +9775,12 @@ void QWidget::setParent(QWidget *parent, Qt::WindowFlags f) } #endif - if (newParent) { - if (QWidgetBackingStore *oldBs = oldtlw->d_func()->maybeBackingStore()) { + if (QWidgetBackingStore *oldBs = oldtlw->d_func()->maybeBackingStore()) { + if (newParent) oldBs->removeDirtyWidget(this); - // Move the widget and all its static children from - // the old backing store to the new one. - oldBs->moveStaticWidgets(this); - } + // Move the widget and all its static children from + // the old backing store to the new one. + oldBs->moveStaticWidgets(this); } if ((QApplicationPrivate::app_compile_version < 0x040200 @@ -10358,17 +10358,22 @@ void QWidget::setAttribute(Qt::WidgetAttribute attribute, bool on) #ifndef QT_NO_IM QWidget *focusWidget = d->effectiveFocusWidget(); QInputContext *ic = 0; - if (on && !internalWinId() && testAttribute(Qt::WA_InputMethodEnabled) && hasFocus()) { + if (on && !internalWinId() && hasFocus() + && focusWidget->testAttribute(Qt::WA_InputMethodEnabled)) { ic = focusWidget->d_func()->inputContext(); - ic->reset(); - ic->setFocusWidget(0); + if (ic) { + ic->reset(); + ic->setFocusWidget(0); + } } if (!qApp->testAttribute(Qt::AA_DontCreateNativeWidgetSiblings) && parentWidget()) parentWidget()->d_func()->enforceNativeChildren(); if (on && !internalWinId() && testAttribute(Qt::WA_WState_Created)) d->createWinId(); - if (ic && isEnabled()) + if (ic && isEnabled() && focusWidget->isEnabled() + && focusWidget->testAttribute(Qt::WA_InputMethodEnabled)) { ic->setFocusWidget(focusWidget); + } #endif //QT_NO_IM break; } @@ -10405,7 +10410,8 @@ void QWidget::setAttribute(Qt::WidgetAttribute attribute, bool on) if (!ic && (!on || hasFocus())) ic = focusWidget->d_func()->inputContext(); if (ic) { - if (on && hasFocus() && ic->focusWidget() != focusWidget && isEnabled()) { + if (on && hasFocus() && ic->focusWidget() != focusWidget && isEnabled() + && focusWidget->testAttribute(Qt::WA_InputMethodEnabled)) { ic->setFocusWidget(focusWidget); } else if (!on && ic->focusWidget() == focusWidget) { ic->reset(); @@ -11872,16 +11878,20 @@ void QWidget::ungrabGesture(Qt::GestureType gesture) mouse when a mouse button is pressed and keeps it until the last button is released. - Note that only visible widgets can grab mouse input. If - isVisible() returns false for a widget, that widget cannot call - grabMouse(). + \note Only visible widgets can grab mouse input. If isVisible() + returns false for a widget, that widget cannot call grabMouse(). + + \note \bold{(Mac OS X developers)} For \e Cocoa, calling + grabMouse() on a widget only works when the mouse is inside the + frame of that widget. For \e Carbon, it works outside the widget's + frame as well, like for Windows and X11. \sa releaseMouse() grabKeyboard() releaseKeyboard() */ /*! \fn void QWidget::grabMouse(const QCursor &cursor) - \overload + \overload grabMouse() Grabs the mouse input and changes the cursor shape. @@ -11891,6 +11901,8 @@ void QWidget::ungrabGesture(Qt::GestureType gesture) \warning Grabbing the mouse might lock the terminal. + \note \bold{(Mac OS X developers)} See the note in QWidget::grabMouse(). + \sa releaseMouse(), grabKeyboard(), releaseKeyboard(), setCursor() */ |