How to implement an IconButton with text like IconTextSwitch?
Unfortunately the IconButton of Silica just offers a simple Button
or IconButton
and not an IconTextButton
. Has someone a simple solution or do I have to tinker something from a Rectangle
, MouseArea
, Image
, Label
and many anchor proprterties? I found this workaround at StackOverflow:
Item {
id: button
width: 30
height: 100
property alias text: buttontext
signal clicked
Image {
id: visualImage
anchors.top: parent.top
anchors.left: parent.left
anchors.right: parent.right
anchors.bottom: buttontext.top
source: "qrc:/images/test.png"
}
Text {
id: buttontext
anchors.left: parent.left
anchors.right: parent.right
anchors.bottom: parent.bottom
font.bold: true
text: "Test"
}
}
Maybe there is something in the Silica private API.
It may not be pretty or slick, but this works;
Spam Hunter ( 2019-06-22 22:18:02 +0200 )edit@Edz Perfect. This works fine for me.
jsommer ( 2019-06-23 17:20:28 +0200 )edit