Important: Please read the Qt Code of Conduct - https://forum.qt.io/topic/113070/qt-code-of-conduct

How to solve QML ToolButton Icon blurred?



  • I am new to QML, and I used a 48x48 pixal ico file as the ToolButton Icon. But the icon display is blurred. How to solve this?
    QML:
    header: ToolBar {
    RowLayout {
    ToolButton {
    display: AbstractButton.IconOnly
    text: qsTr("NewProject")
    icon.source: "qrc:/images/icon/NewProject.ico"
    icon.color: "transparent"
    smooth: False
    icon.width: 16
    icon.height: 16
    onClicked: stack.pop()
    }
    }
    }
    Main:
    int main(int argc, char *argv[]) {
    QGuiApplication app(argc, argv);
    QGuiApplication::setAttribute(Qt::AA_EnableHighDpiScaling );
    QGuiApplication::setAttribute(Qt::AA_UseHighDpiPixmaps);
    QQmlComponent component(new QQmlApplicationEngine(), "qrc:/main.qml");
    qDebug() << component.errors();
    QWindow window = (QWindow)component.create();
    window->setIcon(QIcon(":/images/icon/Logo.ico"));
    window->showMaximized();
    return app.exec();
    }


Log in to reply