Details
-
Bug
-
Resolution: Done
-
Not Evaluated
-
5.3.1
-
None
-
Linux, KDE
Description
Once TextEdit element lost focus, it can never get back again unless the top level widget lost and get focus again.
Please see next codes:
main.cpp
#include <QApplication> #include <QLabel> #include <QQuickView> #include <QTemporaryFile> #include <QVBoxLayout> const char *src = "import QtQuick 2.3\n" "Rectangle {\n" " TextEdit {\n" " anchors.fill: parent\n" " text: \"Hello World!\"\n" " focus: true\n" " selectByMouse: true\n" " selectByKeyboard: true\n" " }\n" "}\n"; int main(int argc, char *argv[]) { QApplication a(argc, argv); QTemporaryFile file; file.open(); file.write(src); file.flush(); QWidget w; QQuickView *view = new QQuickView; view->setSource(QUrl::fromLocalFile(file.fileName())); QVBoxLayout *vbox = new QVBoxLayout(&w); vbox->addWidget(new QLabel("Label")); vbox->addWidget(QWidget::createWindowContainer(view)); w.resize(200, 200); w.show(); return a.exec(); }
When run this code, the TextEdit accepts keyboard inputs.
However, once click other place outside of QQuickView, that is, the 'label area', TextEdit never works again even if you click the element again.
The only method I found to make it work again is to make the top level widget lose focus and get again, for instance, hide and show or select other window and return, etc.