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

How to get my Fullscreen-Window to the second Screen?



  • I try to get this sample Window on my second screen, i tried serveral ways but the window always appears on screen 0

    My System: Dual-Monitor, nearly fresh Ubuntu 18.04 x64 installation with all updates, default Unity Window-Manager, NVIDIA Quadro M3000M with latest closed source driver (NVIDIA-SMI 390.116)

    import QtQuick 2.5
    import QtQuick.Window 2.5
    
    Window {
        color: "black" // is always white
        
        //tried but gives me not the correct size
        //i don't know if these flags are needed
        //modality: Qt.ApplicationModal
        //flags: Qt.Dialog | Qt.FramelessWindowHint | Qt.WindowFullScreen
        
        // correct width, height but warning:
        // Conflicting properties 'visible' and 'visibility' for Window 'fullScreen'
        visibility : Window.FullScreen
        
        // the window always appears on screen 0
        // Qt.application.screens[1] puts the window also to screen 0
        screen: Qt.application.screens[0]
        
        Rectangle {
            anchors.fill: parent
            border { width: 10; color: "yellow" }
        }
        
        MouseArea {
            anchors.fill: parent
            onClicked: {
                Qt.quit()
            }
        }
        
        Component.onCompleted : {
            var screens = Qt.application.screens;
            for (var i = 0; i < screens.length; ++i)
                console.log("screen " + screens[i].name + " has geometry " +
                            screens[i].virtualX + ", " + screens[i].virtualY + " " +
                            screens[i].width + "x" + screens[i].height)
            //output:
            //qml: screen eDP-1-1 has geometry 0, 0 1920x1080
            //qml: screen HDMI-1-1 has geometry 1920, 0 1920x1080
        }
    }
    

    My Screen settings:
    0_1564556029030_Screenshot from 2019-07-31 08-53-16.png



  • Have you tried Component.onCompleted: showFullScreen() (without any flags and visibility props) for your window?



  • @intruderexcluder

    I've already fixed my problem

    i also need to set

    Window
    x: screen.virtualX
    y: screen.virtualY

    the screen property own its own does just nothing


Log in to reply