{"action":"created","issue":{"url":"https://api.github.com/repos/mltframework/shotcut/issues/127","labels_url":"https://api.github.com/repos/mltframework/shotcut/issues/127/labels{/name}","comments_url":"https://api.github.com/repos/mltframework/shotcut/issues/127/comments","events_url":"https://api.github.com/repos/mltframework/shotcut/issues/127/events","html_url":"https://github.com/mltframework/shotcut/issues/127","id":110872519,"number":127,"title":"Keyboard focus gets stuck sometimes","user":{"login":"metellius","id":9467,"avatar_url":"https://avatars.githubusercontent.com/u/9467?v=3","gravatar_id":"","url":"https://api.github.com/users/metellius","html_url":"https://github.com/metellius","followers_url":"https://api.github.com/users/metellius/followers","following_url":"https://api.github.com/users/metellius/following{/other_user}","gists_url":"https://api.github.com/users/metellius/gists{/gist_id}","starred_url":"https://api.github.com/users/metellius/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/metellius/subscriptions","organizations_url":"https://api.github.com/users/metellius/orgs","repos_url":"https://api.github.com/users/metellius/repos","events_url":"https://api.github.com/users/metellius/events{/privacy}","received_events_url":"https://api.github.com/users/metellius/received_events","type":"User","site_admin":false},"labels":[],"state":"open","locked":false,"assignee":null,"milestone":null,"comments":9,"created_at":"2015-10-11T17:56:21Z","updated_at":"2015-10-12T05:58:56Z","closed_at":null,"body":"One way to reproduce:\r\n\r\n* Create a video or audio track\r\n* Type something into trackhead text field\r\n* Click once on toolbar (or any other qwidget-based component)\r\n* Click in the text field again\r\n\r\nThe text field will not show the caret, and you cannot type anything into the field. Clicking on another qml-based embedded component (for example the filter menu) then clicking back is a workaround for restoring the focus.\r\n\r\nI have reproduced this behavior outside shotcut in a minimal example with a qwidget and qquickview, using createWindowContainer. I then wrote it into a QTest testcase:\r\n\r\n\r\n```\r\n#include <QWidget>\r\n#include <QDebug>\r\n#include <QTest>\r\n\r\nclass Bug : public QObject\r\n{\r\n    Q_OBJECT\r\nprivate slots:\r\n    void testDoubleWindowActivation();\r\n};\r\n\r\nvoid Bug::testDoubleWindowActivation()\r\n{\r\n    QWindow * view = new QWindow;\r\n\r\n    QWidget w;\r\n    QWidget * container = QWidget::createWindowContainer(view, &w);\r\n    w.show();\r\n\r\n    QTest::qWait(100);\r\n    qDebug() << qApp->focusObject();\r\n    QCOMPARE(qApp->focusObject(), &w);\r\n\r\n    view->requestActivate();\r\n    QTest::qWait(100);\r\n    qDebug() << qApp->focusObject();\r\n    QCOMPARE(qApp->focusObject(), view);\r\n\r\n    w.setFocus();\r\n    QTest::qWait(100);\r\n    qDebug() << qApp->focusObject();\r\n    QCOMPARE(qApp->focusObject(), &w);\r\n\r\n    view->requestActivate();\r\n    QTest::qWait(100);\r\n    qDebug() << qApp->focusObject();\r\n    //the following check fails because focusObject was never set back to the qquickview\r\n    QCOMPARE(qApp->focusObject(), view);\r\n}\r\n\r\nQTEST_MAIN(Bug)\r\n#include \"main.moc\"\r\n```\r\n\r\nObserving focus events inside qt, I see that at least all the way up to the QWindow+wm-event layer there is no trace of focus events coming in when clicking on the qml component, so I don't see myself fixing this easily without help. Reading bug reports and googling around, I get the feeling that QQuickWidget is regarded as a more robust way of embedding qquickviews. I modified my testcase to use QQuickWidget, and now the focus actually behaved as expected.\r\n\r\nI'm looking into having shotcut using qquickwidgets instead of createWindowContainer for embedded qml components."},"comment":{"url":"https://api.github.com/repos/mltframework/shotcut/issues/comments/147297840","html_url":"https://github.com/mltframework/shotcut/issues/127#issuecomment-147297840","issue_url":"https://api.github.com/repos/mltframework/shotcut/issues/127","id":147297840,"user":{"login":"metellius","id":9467,"avatar_url":"https://avatars.githubusercontent.com/u/9467?v=3","gravatar_id":"","url":"https://api.github.com/users/metellius","html_url":"https://github.com/metellius","followers_url":"https://api.github.com/users/metellius/followers","following_url":"https://api.github.com/users/metellius/following{/other_user}","gists_url":"https://api.github.com/users/metellius/gists{/gist_id}","starred_url":"https://api.github.com/users/metellius/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/metellius/subscriptions","organizations_url":"https://api.github.com/users/metellius/orgs","repos_url":"https://api.github.com/users/metellius/repos","events_url":"https://api.github.com/users/metellius/events{/privacy}","received_events_url":"https://api.github.com/users/metellius/received_events","type":"User","site_admin":false},"created_at":"2015-10-12T05:58:56Z","updated_at":"2015-10-12T05:58:56Z","body":"Branch tip now includes a fix for the keyevent propagation - evidently qquickwidget has not yet fixed the bug that caused us to make ForwardingQuickViewWorkaround in the first place."}}