Details
-
Bug
-
Resolution: Done
-
P2: Important
-
5.12.0 Beta 1
-
None
-
-
402efef57bb6a04ad778d3139100becc2cba31eb (qt/qtbase/5.12)
Description
Consider:
#include <QtCore/qtimer.h> #include <QtGui/qguiapplication.h> #include <QtQml/qqmlengine.h> #include <QtQuick/qquickview.h> #include <QtQuick/qquickitem.h> int main(int argc, char ** argv) { const QByteArray qml = "import QtQuick 2.3\n" "TextEdit {\n" " text: 'Switch Delegate'\n" "}"; QGuiApplication app(argc, argv); QQmlEngine engine; QQmlComponent component(&engine); component.setData(qml, QUrl()); QQuickItem *contentItem = qobject_cast<QQuickItem *>(component.create()); QQuickView window(&engine, nullptr); window.setContent(QUrl(), &component, contentItem); window.show(); QTimer::singleShot(100, [&](){ // window.close() here and it works for (QQuickItem *oldItem : window.contentItem()->childItems()) delete oldItem; window.close(); QQuickItem *item = qobject_cast<QQuickItem *>(component.create()); item->setParentItem(window.contentItem()); window.setVisible(true); }); return app.exec(); }
With 5.11.2 this works nicely, replacing the contents of the scene after 100ms and the TextEdit still gains focus when you click it. With 5.12 it replaces the contents, but the TextEdit is not focused anymore when you click it.
If you close the window first, before changing the contents, the TextEdit still works after re-opening it. If you keep the window open the whole time it also works. If you don't delete the contents but merely unparent them, it also works.
Attachments
Issue Links
- resulted in
-
QDS-234 Touch input does not work for live preview on boot 2 qt
- Closed