2
votes

I have a very simple setup just to exemplify the problem:

import QtQuick.Controls 1.4
import QtQuick.Window 2.2

ApplicationWindow {
    visible: true
    width: 640
    height: 480
    title: qsTr("Hello World")
    menuBar:MenuBar{
        Menu{
            id:mainmenu
            title:"&File"
            MenuItem{action: settingsAction}
        }
    }
    Action {
            id: settingsAction
            text: "Settings"
            iconName: "icon-settings"
            iconSource: "qrc:///images/images/cog.png"
        }
    Button{
        text:"Push"
        iconSource: "qrc:///images/images/cog.png"
        anchors.centerIn: parent
    }

}

As you ca see, the button and the menu item has the same url as iconSource. The button shows the image, but the menu item doesn't.

screencapture

Can you please tell me what i'm doing wrong here?

Thank you.

1
Probably related to this Bug: bugreports.qt.io/browse/QTBUG-37083 - When inspected with qmlscene at least a placeholder for the Icon was shown, while it isn't when running the code normaly.derM

1 Answers

3
votes

Indeed the problem of yours is a bug that is already know, but as QtQuick.Controls 1.x is not maintained any more, I don't know if it will ever be fixed (unless it is a bug in QtGuiApplication?)

As described in the bugreport, you may use QApplication instead of QGuiApplication in your main to have it shown.

What you are doing wrong?
Nothing. It's all QT's fault.