setparent/setparentitem for window
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.
Code:
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());
Thank you so much!
Re: setparent/setparentitem for window
Quote:
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.
Code:
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());
Thank you so much!
any update
got stuck in the same place
Re: setparent/setparentitem for window
The owner can be set, but the parent is a read-only property.
Code:
var w = new Window ();
w.Owner = Window.GetWindow (this);
w.Show ();
Re: setparent/setparentitem for window
Quote:
var w = new Window ();
w.Owner = Window.GetWindow (this);
w.Show ();
What is this? It isn't Qt code. It isn't even C++, it's C#. So why are you posting this in a Qt forum?