Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • Users
  • Groups
  • Search
  • Get Qt Extensions
  • Unsolved
Collapse
Brand Logo
  1. Home
  2. Qt Development
  3. General and Desktop
  4. QML Image fill from Icon resource
Qt 6.11 is out! See what's new in the release blog

QML Image fill from Icon resource

Scheduled Pinned Locked Moved Unsolved General and Desktop
1 Posts 1 Posters 658 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.
  • Andy314A Offline
    Andy314A Offline
    Andy314
    wrote on last edited by
    #1

    Hello,
    in the widget area its is easy to work with icons but how to do in QML.
    This is my code.

                Image
                {
                    id: leftimage
                     source: "qrc:///images/OK.ico"
                    width: 16
                    height: 16
                    fillMode: Image.Stretch
                       //fillMode: Image.PreserveAspectFit
                }
    

    I have a icon file with different sizes in it 16x16 24x24 ...... 48x48.
    It seem that the Image takes the large size and and scales to it.
    How can I resize such an Image, or better pick the optimal icon image for a specific fixed size (as the QPushButton performes it) ?
    Explicit setting of with and height did not work - the Image has alway a large size

    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