Details
-
Bug
-
Resolution: Won't Do
-
P3: Somewhat important
-
None
-
4.6.1
-
None
-
window/symbian/linux
Description
I am using Qt 4.6.1 version, and found a bug in the constructor of QGraphicsView.
originalcode
QGraphicsView::QGraphicsView(QGraphicsScene *scene, QWidget *parent) : QAbstractScrollArea(*new QGraphicsViewPrivate, parent) { setScene(scene); setViewport(0); setAcceptDrops(true); setBackgroundRole(QPalette::Base); // Investigate leaving these disabled by default. setAttribute(Qt::WA_InputMethodEnabled); viewport()->setAttribute(Qt::WA_InputMethodEnabled); }
As SetScene updates the Qt::WA_InputMethodEnabled flag internally and it is overridden by the next lines to true.
And when control reaches to the QApplication (when the first time QGraphicsView launched), QApplication calls QInputContext::setFocusWidget(view_pointer) even if there is no focused item inside the QGraphicsScene, which I feel is not correct. And this is done before sending the focusinevent to the QGraphicsView, so view didn't get a change to update inputmethod sensitivity.
A fix could be.
Fix
QGraphicsView::QGraphicsView(QGraphicsScene *scene, QWidget *parent) : QAbstractScrollArea(*new QGraphicsViewPrivate, parent) { setScene(scene); setViewport(0); setAcceptDrops(true); setBackgroundRole(QPalette::Base); }
Easy to reproduce. Just write below code.
test app
QGraphicsScene scene; QGraphicsView view(&scene); view.show();
And put a break point in the QWinInputContext::setFocusWidget(QWidget *w) if you are on windows system.