Qt Forum

    • Login
    • Search
    • Categories
    • Recent
    • Tags
    • Popular
    • Users
    • Groups
    • Search
    • Unsolved

    Update: Forum Guidelines & Code of Conduct


    Qt World Summit: Early-Bird Tickets

    Unsolved Qt Labs Controls & icon resources

    QML and Qt Quick
    labs.controls controls 2 resources icons scaling
    2
    2
    1173
    Loading More Posts
    • 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
      morte last edited by morte

      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 Reply Quote 0
      • ekkescorner
        ekkescorner Qt Champions 2016 last edited by

        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
        mobile business apps
        Qt Quick Controls 2 (Material style) for Android / iOS

        1 Reply Last reply Reply Quote 1
        • First post
          Last post