Important: Please read the Qt Code of Conduct -

Icon sourceName does not work if application run via QGuiApplication

  • Suppose I wrote this piece of qml code:
    ApplicationWindow {
    visible: true
    ToolButton {
    action: Action {
    id: boldAction
    checkable: true
    iconName: "format-text-bold"
    //iconSource: "textbold.png"

    Now, if in main.cpp I will use
    @QGuiApplication a(argc, argv);@

    (which is from qml module of Qt), then there will not be icon in toolbutton.

    But if I replace above "QGuiApplication a(argc, argv);" by
    QApplication a(argc, argv);

    (which is from old widgets module of Qt), all works perfectly.

    So, my question is - is it a bug, or intended behaviour?
    If it is intended then why QApplication is in widgets module of Qt?
    And must I still use widgets module (and classes from its module) for properly working qml?

    Here is "minimal example":

Log in to reply