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 Labs Controls & icon resources
QtWS25 Last Chance

Qt Labs Controls & icon resources

Scheduled Pinned Locked Moved Unsolved QML and Qt Quick
labs.controlscontrols 2resourcesiconsscaling
2 Posts 2 Posters 1.5k 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.
  • M Offline
    M Offline
    morte
    wrote on last edited by morte
    #1

    I trying to place an familiar ToolButton with icon. ToolButton have no property like iconSource so i set Image to background:

    ToolButton {
    	background: Image {
    		source: icon("ic_chevron_left_white_24dp.png");
    	}
    }
    

    From here i meet issues with bad image appearance (size/stretching/etc. )

    In Qt Quick Controls 1 i can set an ldpi/mdpi/hdpi/etc. icon image depending on screen DPI and ToolButton icon looks as it should.
    Qt Labs Controls designed to be used with new Qt 5.6 scaling feature (Qt::AA_EnableHighDpiScaling), what is proper way to deal with icon resources in Qt Quick Controls 2 application?

    1 Reply Last reply
    0
    • ekkescornerE Offline
      ekkescornerE Offline
      ekkescorner
      Qt Champions 2016
      wrote on last edited by
      #2

      icons depend on DevicePixelRatio and are named this way:

      myIcon.png - corresponds to 1.0 and mdpi - use this name in qml
      myIcon@2x.png - 2.0 and xhdpi
      myIcon@3x.png - 3.0 and xxhdpi
      myIcon@4x.png - 4.0 and xxxhdpi

      if you want to know the DevicePixelRatio:

      C++
      qApp->primaryScreen()......

      ekke ... Qt Champion 2016 | 2024 ... mobile business apps
      5.15 --> 6.8 https://t1p.de/ekkeChecklist
      QMake --> CMake https://t1p.de/ekkeCMakeMobileApps

      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