Qt Quick borderless window not redrawn



  • Hi,

    I try to create a simple application where the user needs to enter a date. For this I want to connect a button with a calendar popup. This works fine as long as the popup is its own window and has a border. But the moment I make the window borderless it seems to be not drawn anymore. Actually if you move the underlaying window around you see that the area with the calendar widget stays undrawn.

    import QtQuick 2.2
    import QtQuick.Controls 1.2
    import QtQuick.Layouts 1.1
    import QtQuick.Window 2.1
    
    ApplicationWindow {
        width: 800
        height: 600
        property var pos : getOffset(dateField)
    
        Button {
            id: dateField
            width: 100
            height: 50
            anchors.centerIn: parent
            text: "show widget"
            onClicked:{ toggleModal() }
        }
    
        function getOffset(item) {
            var offset = {
                "x": item.x,
                "y": item.y + item.height
            };
            while(item.parent) {
                item = item.parent;
                offset.x += item.x;
                offset.y += item.y;
            }
            console.debug("total", "x", offset.x, "y", offset.y)
    
            return offset;
        }
    
        function toggleModal() {
            if(modal.active) {
                console.log("hide calendar")
                loseFocus();
            }
            else {
                console.log("show calendar")
                modal.show()
                modal.requestActivate()
            }
        }
    
        function loseFocus(newDate) {
            modal.close();
        }
    
        Window {
            id: modal
            flags: Qt.Window | Qt.FramelessWindowHint
            //flags: Qt.Window
            //modality: Qt.ApplicationModal
            minimumHeight: calendar.height; minimumWidth: calendar.width
            maximumHeight: calendar.height; maximumWidth: calendar.width
            x: pos.x
            y: pos.y
    
            Calendar {
                id: calendar
                width: 200
                height: 300
            }
        }
    }
    
    
    

Log in to reply
 

Looks like your connection to Qt Forum was lost, please wait while we try to reconnect.