Hi,
I have a window, then I create a new window and want to show it within the first window(with showing title window/minimize window, and it should be movable only within the first window). But set parent does not work.
QQmlApplicationEngine engine;
QQmlComponent component
(&engine,
QUrl("qrc:/main.qml"));
QObject *m_visual
= component.
create();
QQuickWindow *window = (QQuickWindow *)m_visual;
QQmlApplicationEngine engine_sub;
QQmlComponent component_sub
(&engine_sub,
QUrl("qrc:/window2.qml"));
QObject *m_visual_sub
= component_sub.
create();
QQuickWindow *window_sub = (QQuickWindow *)m_visual_sub;
m_visual_sub->setParent(m_visual);
((QQuickItem *)m_visual_sub)->setParentItem(window->contentItem());
QQmlApplicationEngine engine;
QQmlComponent component(&engine, QUrl("qrc:/main.qml"));
QObject *m_visual = component.create();
QQuickWindow *window = (QQuickWindow *)m_visual;
QQmlApplicationEngine engine_sub;
QQmlComponent component_sub(&engine_sub, QUrl("qrc:/window2.qml"));
QObject *m_visual_sub = component_sub.create();
QQuickWindow *window_sub = (QQuickWindow *)m_visual_sub;
m_visual_sub->setParent(m_visual);
((QQuickItem *)m_visual_sub)->setParentItem(window->contentItem());
To copy to clipboard, switch view to plain text mode
Thank you so much!
Bookmarks