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. Use of transparent .png and .gif

Use of transparent .png and .gif

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

    Seems to me the goal of Qt Quick is to help make a UI as easy to program as a webpage. However, the failure to handle transparent images in QML as easily as in HTML is disappointing. (Always get opaque white replacing the transparency.)

    I have seen several "solutions" on the web, but none seem to cause the view window to behave as expected. Just a suggestion, but it seems like there should be one simple attribute to set in the QDeclarativeView object for this expected behavior...

    D

    1 Reply Last reply
    0
    • D Offline
      D Offline
      denkelly
      wrote on last edited by
      #2

      I got this to work - thankfully, changing only my qml. For the benefit of others, here is what was needed:

      @
      Rectangle {
      id: btn1
      color:"transparent" <<<<<<<<<<<< add this or the "transparent" area is the color of the 'Rectangle' (defaults to white)
      width: 154; height: 101
      x: 107; y: 218
      Image { id:btn1up; source: "images/all_transparent.png" }
      MouseArea { id: mouseArea1; anchors.fill: parent; onPressed: { someData.btnMode() } }
      states: State {
      when: mouseArea1.pressed
      PropertyChanges { target: btn1up; source: "images/some_transparent.png" }
      }
      }
      @

      [EDIT: code formatting, please wrap in @-tags, Volker]

      1 Reply Last reply
      1

      • Login

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