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. Can modal Popup have mazimum darkness?

Can modal Popup have mazimum darkness?

Scheduled Pinned Locked Moved Unsolved QML and Qt Quick
1 Posts 1 Posters 129 Views
  • 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.
  • C Offline
    C Offline
    christofer
    wrote on last edited by
    #1

    I'm looking for a way to have multiple modal popups with opacity of %60 maximum.

    I have a popup something like this...

    Popup {
        id: myPopup
        width: 400
        height: 400
        visible: true
        modal: true
        Overlay.modal: Rectangle {
            color: "#9A000000"  // #9A means 60% opacity
        }
    }
    

    But if two open then the opacity adds and the background becomes darker. I'd like to to remain 60% no mater how many popups there are at one time.

    So far, the only solution I've found is to have a reference counter var and use it. If the count is greater than 1, then the popup dim is set to false.

    Popup {
        id: myPopup
        width: 400
        height: 400
        visible: true
        dim: !(window.popupCount > 1)
        modal: true
        Overlay.modal: Rectangle {
            color: "#9A000000"  // #9A means 60% opacity
        }
        onOpened: {
            window.popupCount++
        }
        onClosed: {
            window.popupCount--
        }
    }
    

    This works, but it's led to the popupCount calculations spreading around the code base. Is there something like a global modal max opacity setting I could use instead?

    Thanks,
    Chris

    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