Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • Users
  • Groups
  • Search
  • Get Qt Extensions
  • Unsolved
Collapse
Brand Logo
  1. Home
  2. Qt Development
  3. QML and Qt Quick
  4. Qt Quick borderless window not redrawn
Forum Updated to NodeBB v4.3 + New Features

Qt Quick borderless window not redrawn

Scheduled Pinned Locked Moved Unsolved QML and Qt Quick
1 Posts 1 Posters 433 Views 1 Watching
  • Oldest to Newest
  • Newest to Oldest
  • Most Votes
Reply
  • Reply as topic
Log in to reply
This topic has been deleted. Only users with topic management privileges can see it.
  • F Offline
    F Offline
    Fabian Sturm
    wrote on last edited by
    #1

    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
            }
        }
    }
    
    
    
    1 Reply Last reply
    0

    • Login

    • Login or register to search.
    • First post
      Last post
    0
    • Categories
    • Recent
    • Tags
    • Popular
    • Users
    • Groups
    • Search
    • Get Qt Extensions
    • Unsolved