Qt Labs Controls & icon resources



  • 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?


  • Qt Champions 2016

    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()......



Looks like your connection to Qt Forum was lost, please wait while we try to reconnect.