[Qt-interest] Focus Bug In 4.6 GraphicsView?
Cheung Yik Pang
yp.cheung at valueplatforms.com
Fri Oct 2 12:23:21 CEST 2009
Hi all,
I discovered a behavior change in the 4.6 git head against the 4.5 branch.
The attached test program starts by showing green widget in a parent
widget. Then a 3-second timer will trigger hide() on the green widget,
and shows a view.
The view contains a scene with a blue rectangle at the center. In
focusInEvent() of the view, a onFocus() signal is emitted to trigger the
obtainFocus() slot in the scene, to set the focus to the blue rectangle
by setFocusItem().
In 4.5.x, setFocusItem() will succeed and focusItem() returns the
rectangle item.
In 4.6, setFocusItem() will fail, unless
viewportEvent(QEvent::WindowActivate) is called in the view before
emitting onFocus() signal. If viewportEvent() is omitted, the scene
will have focus, but one cannot set a focus item to the scene.
Anyone has the same experience?
Thanks in advance.
Regards,
Cheung
-------------- next part --------------
A non-text attachment was scrubbed...
Name: graphicsscene_focus.zip
Type: application/zip
Size: 2567 bytes
Desc: not available
Url : http://lists.qt-project.org/pipermail/qt-interest-old/attachments/20091002/96b4332b/attachment.zip
More information about the Qt-interest-old
mailing list