Details
-
Bug
-
Resolution: Unresolved
-
P3: Somewhat important
-
5.1.1
-
None
-
Windows 8 32bit. Qt 5.1.1 MSVC2010 32bit
Description
In 5.1.0 the iconSource had no effect at all (no icon was loaded despite setting this property).
In 5.1.1 the icon is loaded, but the scaling does not behave as expected (as one would expect from working with widgets)
For example, if we put the button into a layout and give it a preferred height, the button is the correct height but the icon is drawn at original size as shown in the first attachement:
Button { text: "Start" iconSource: "qrc:/images/start.png" Layout.preferredHeight: 50 Layout.fillWidth: true onClicked: { console.log("Start game") shellInterface.startGame("boxes") //root.state = "playing" } }
If we do not use a preferred height, the button height gets expanded to fit the icon size (second attachment).
Button { text: qsTr("Start") iconSource: "qrc:/images/start.png" //Layout.preferredHeight: 40 Layout.fillWidth: true onClicked: { console.log("Start game") shellInterface.startGame("cpt") stimPresenter.sequence = shellInterface.getCPTGameSequence() root.state = "playing" } }
Even outside of a layout, specifying the heihgt of the button has no effect on the size of the displayed icon. The button height gets set to the specified size, and the icon is drawn at the original size.
I think the icon should be scaled to the button if a height is set. Or have a new property to specify iconSize as in QAbstractButton.