Qt SDK beta Meego 1.2: problem on ButtonStyle management
-
Hello, I'm here again :)
Following the documentation guidelines I see that the Button element can change the standard Harmattan theme (white and blue) using the ButtonStyle element that inherit the object. The documentation reports an example:
@Button {
platformStyle: ButtonStyle {
fontFamily: "Arial"
fontPixelSize: 21
fontCapitalization: Font.SmallCaps
fontWeight: Font.Light
horizontalAlignment: Text.AlignLeft
textColor: "black"
pressedTextColor: "red"
disabledTextColor: "gray"
checkedTextColor: "blue"
buttonWidth: 200
buttonHeight: 30
position: "[horizontal-center]"
}
}@that works fine. Then I need to change not only these parameters but the button background images to have a different effect in the application. Thus I set my button instance with the following code:
@Button { text: "The button text" platformStyle: ButtonStyle { fontFamily: "Arial" fontPixelSize: 24 fontWeight: Font.bold horizontalAlignment: Text.AlignLeft textColor: "black" backgroundMarginBottom: 1 backgroundMarginLeft: 10 backgroundMarginRight: 10 backgroundMarginTop: 10 background: "image1.png" pressedBackground: "image2.png" checkedBackground: "image3.png" checkedDisabledBackground: "image4.png" buttonWidth: 200 buttonHeight: 50 position: "[horizontal-center]" } }@
image1.png, image2.png, image3.png and image4.png are correctly registered in the project resource file.
Formerly there are no errors but when I run the application I get a File not found error (unable to load etc...) on the custom images and on the position property too (that seems treated as an icon image).
In the ButtonStyle documentation I see that the default for the background different states the default file objects are in@"image://theme/meegotouch-button"+__invertedString+"-background"+(position?"-"+position:"")@
As a matter of fact the system hangs when I ask to try to load a custom registered component. I have no idea of how is possible to set these properties to search in the correct path.
My actual workaround is the definition of a CustomButton.qml object with the same behavior of the original Button accepting my parameters. The same problem can be found to all the components that inherit the ButtonStyle component so it is useful to know a solution different than rebuild locally all the objects.