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. Change popup background to transparent
Forum Updated to NodeBB v4.3 + New Features

Change popup background to transparent

Scheduled Pinned Locked Moved Unsolved QML and Qt Quick
2 Posts 2 Posters 1.6k 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.
  • N Offline
    N Offline
    newbiSoso
    wrote on last edited by
    #1

    I have the following popup to appear when the game finishes:

    Popup {
            id: popup
            anchors.centerIn: parent
            Text{
                text: "Game Over!!" + "\n\n" + "New High Score: "+ score_val
                anchors.centerIn: canvas
                color: "grey"
                font.pixelSize: 70
                font.family: gill.name
            }
            modal: true
            focus: true
            closePolicy: Popup.CloseOnEscape | Popup.CloseOnPressOutsideParent
        }
    

    It's all good but the background is white and there seems no background color property, what should I do?

    and I can't center align the text ,how do I make it centered if it's multiple lines?

    KroMignonK 1 Reply Last reply
    0
    • N newbiSoso

      I have the following popup to appear when the game finishes:

      Popup {
              id: popup
              anchors.centerIn: parent
              Text{
                  text: "Game Over!!" + "\n\n" + "New High Score: "+ score_val
                  anchors.centerIn: canvas
                  color: "grey"
                  font.pixelSize: 70
                  font.family: gill.name
              }
              modal: true
              focus: true
              closePolicy: Popup.CloseOnEscape | Popup.CloseOnPressOutsideParent
          }
      

      It's all good but the background is white and there seems no background color property, what should I do?

      and I can't center align the text ,how do I make it centered if it's multiple lines?

      KroMignonK Offline
      KroMignonK Offline
      KroMignon
      wrote on last edited by KroMignon
      #2

      @newbiSoso I think you have to play with the background property, something like this:

      Popup {
          id: popup
          anchors.centerIn: parent
          background: Rectangle {
                  anchors.fill: popup
                  border.color: "black"
                  color: "transparent"
          }
          Text{
              text: "Game Over!!" + "\n\n" + "New High Score: "+ score_val
              anchors.centerIn: canvas
              color: "grey"
              font.pixelSize: 70
              font.family: gill.name
          }
          modal: true
          focus: true
          closePolicy: Popup.CloseOnEscape | Popup.CloseOnPressOutsideParent
      }
      

      It is an old maxim of mine that when you have excluded the impossible, whatever remains, however improbable, must be the truth. (Sherlock Holmes)

      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