Important: Please read the Qt Code of Conduct - https://forum.qt.io/topic/113070/qt-code-of-conduct

How to make qml window embedded in desktop?



  • The effect I need is: Even showing or hiding (Win+D) the desktop does not affect it.

    import QtQuick 2.12
    import QtQuick.Window 2.12
    
    Window {
        visible: true
        width: 640
        height: 480
        title: qsTr("Hello World")
        color: "transparent"
        flags: Qt.FramelessWindowHint
    
        Rectangle {
            anchors.fill: parent
            color:"transparent"
            Column {
                Text {
                    text:"hello world"
                    color: "white"
                    font.pointSize: 60
                }
            }
        }
    }
    


  • I have 2 desktop apps created with QML, both of them hide when doing 'Win+D'. Both apps are using only 'Qt.FramelessWindowHint'. In fact, they hide from desktop whether run from SDK or desktop.

    Perhaps there is a .dll missing from your apps deployment folder?



  • @Markkyboy Thanks. It seems that I did not express the problem clearly, and revised the problem again. I need to embed the window in the desktop.



  • So,........you want to embed a Window (made with QML) in to your Windows desktop?, if so, you are then saying that you don't want your embedded window to be affected (remain showing) when Win+D is used?



  • @Markkyboy bingo, I found the following solution:

    BOOL Widget::enumUserWindowsCB(HWND hwnd,LPARAM lParam)
    {
        long wflags = GetWindowLong(hwnd, GWL_STYLE);
        if(!(wflags & WS_VISIBLE)) return TRUE;
    
        HWND sndWnd;
        if( !(sndWnd=FindWindowEx(hwnd, NULL, L"SHELLDLL_DefView", NULL)) ) return TRUE;
        HWND targetWnd;
        if( !(targetWnd=FindWindowEx(sndWnd, NULL, L"SysListView32", L"FolderView")) ) return TRUE;
    
        HWND* resultHwnd = (HWND*)lParam;
        *resultHwnd = targetWnd;
        return FALSE;
    }
    
    
    HWND Widget::findDesktopIconWnd()
    {
        HWND resultHwnd = NULL;
        EnumWindows((WNDENUMPROC)enumUserWindowsCB, (LPARAM)&resultHwnd);
        return resultHwnd;
    }
    

    but the compiler not found BOOL, LPARAM


Log in to reply