Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How to display child Window icon in task bar

Tags:

qt

qml

qtquick2

Window {
    Window {
        id: childWindow
    }
}

I have a QML like this, and childWindow icon does not display in task bar when the window is shown. My environment is Windows 7. In a CPP setting I think it would suffice to set parent of childWindow to 0 to have both windows to be top level.

But how to do that in QML?

like image 416
JustWe Avatar asked Nov 23 '25 16:11

JustWe


1 Answers

You can do something like that:

Item
{
    Window
    {
        id: wnd1
        width: 200
        height: 200
        title: "Window1"
        visible: true
        onClosing: wnd2.close();
    }

    Window
    {
        id: wnd2
        width: 200
        height: 200
        title: "Window2"
        visible: true
    }
}

Note that when wnd1 is closed (main/root window) also the second one gets closed onClosing handle ensuring the correct - or expected - behaviour on main window closing.

like image 56
folibis Avatar answered Nov 26 '25 17:11

folibis