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. Smoothed icons with high dpi support in Qt app

Smoothed icons with high dpi support in Qt app

Scheduled Pinned Locked Moved Unsolved General and Desktop
high dpiimagescalingqt 5.11
2 Posts 2 Posters 3.4k 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
    daljit97
    wrote on last edited by daljit97
    #1

    I have enabled high dpi support in my Qt application using QGuiApplication::setAttribute(Qt::AA_EnableHighDpiScaling); but now my images don't look crisp, instead they look "smoothed" out. For example below there is a picture of some button that are meant to be using high dpi images. When I disable the high dpi support and manually scale the ui, using the same images the icons are crisp and clear.

    0_1533606025933_Screenshot_2018-08-07-01-52-26~2.png
    I have tried to set Qt::AA_UseHighDpiPixmaps with no success.
    Here is a sample code:

    import QtQuick 2.11
    import QtQuick.Window 2.11
    import QtQuick.Controls 2.2
    
    Window {
        visible: true
        width: 640
        height: 480
        title: qsTr("Hello World")
    
        ToolButton{
            anchors.centerIn: parent
            icon.source: "qrc:/ic_star_white_48dp.png"
        }
    }
    

    The icon I am using is from Google material design icons and it is made for a high dpi screen device (resolution is 192x192). Enabling high dpi the icon in the toolbutton appears smoothed out. If I disable the high dpi support and set the height and width of the icon (icon.height and icon.width) to 640/160 * 48 (640 is the dpi of my device) the icon is crisp and clear. However, if I enable high dpi and set the height and width to 48, the icon is not crisp.

    1 Reply Last reply
    0
    • SGaistS Offline
      SGaistS Offline
      SGaist
      Lifetime Qt Champion
      wrote on last edited by
      #2

      Hi,

      Did you already saw the related part of QIcon’s documentation ?

      Interested in AI ? www.idiap.ch
      Please read the Qt Code of Conduct - https://forum.qt.io/topic/113070/qt-code-of-conduct

      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