summaryrefslogtreecommitdiffstats
path: root/src/gui
diff options
context:
space:
mode:
authorMichael Hasselmann <michael@taschenorakel.de>2010-06-07 15:18:54 (GMT)
committerDenis Dzyubenko <denis.dzyubenko@nokia.com>2010-06-07 16:09:43 (GMT)
commit0c0f22ec0e36d7001c8195dcc6e390a37118e33e (patch)
tree5732513e6405bbd807f7083e18040a28d654be97 /src/gui
parentc28da4dd467c2763bed5c6b31471f078ac26cee6 (diff)
downloadQt-0c0f22ec0e36d7001c8195dcc6e390a37118e33e.zip
Qt-0c0f22ec0e36d7001c8195dcc6e390a37118e33e.tar.gz
Qt-0c0f22ec0e36d7001c8195dcc6e390a37118e33e.tar.bz2
Fix QApplication/QWidget to really take ownership of input contexts
* src/gui/kernel/[qapplication|qwidget].cpp, tests/auto/qapplication/tst_[qapplication|qwidget].cpp (setInputContext): The documentation for [QApplication|QWidget]::setInputContext claims that the [QApplication|QWidget] instance would take ownership. This commit fixes the setter to also reparent the input context. Furthermore, the crappy test for this setter was improved. Reviewed-by: Denis Dzyubenko <denis.dzyubenko@nokia.com>
Diffstat (limited to 'src/gui')
-rw-r--r--src/gui/kernel/qapplication.cpp1
-rw-r--r--src/gui/kernel/qwidget.cpp2
2 files changed, 3 insertions, 0 deletions
diff --git a/src/gui/kernel/qapplication.cpp b/src/gui/kernel/qapplication.cpp
index a2c058a..8529615 100644
--- a/src/gui/kernel/qapplication.cpp
+++ b/src/gui/kernel/qapplication.cpp
@@ -5297,6 +5297,7 @@ void QApplication::setInputContext(QInputContext *inputContext)
}
delete QApplicationPrivate::inputContext;
QApplicationPrivate::inputContext = inputContext;
+ QApplicationPrivate::inputContext->setParent(this);
}
/*!
diff --git a/src/gui/kernel/qwidget.cpp b/src/gui/kernel/qwidget.cpp
index b5879ae..91dfaab 100644
--- a/src/gui/kernel/qwidget.cpp
+++ b/src/gui/kernel/qwidget.cpp
@@ -332,6 +332,8 @@ void QWidget::setInputContext(QInputContext *context)
if (d->ic)
delete d->ic;
d->ic = context;
+ if (d->ic)
+ d->ic->setParent(this);
#endif
}