Buttons and icons align left?
-
@ankou29666 I mean customize the layout inside the button.
@jialuo see https://doc.qt.io/qt-5/qtquickcontrols2-customize.html#customizing-button
your content item perhaps Row of Icon and Text -
Hi
I'd anchor the icons to the left with appropriate left margin.
Something like
Rectangle { id: parentRect anchors, height, and width: whatever you want Icon { id: icon anchors.left: parent.left anchors.leftMargin: someValue other anchors, height and width: as you need } Label { anchors.left: icon.right anchors.leftMargin: someValue } }
-
@JoeCFD ```
Column{Button{ height: 30 width: 100 icon.source:"./Image/fluent_star_filled.svg" spacing: 10 text: "未分类" } Button{ height: 30 width: 100 icon.source:"./Image/fluent_star_filled.svg" spacing: 10 text: "未标签" } Button{ height: 30 width: 100 icon.source:"./Image/fluent_star_filled.svg" spacing: 10 text: "标签管理" } Button{ height: 30 width: 100 icon.source:"./Image/fluent_star_filled.svg" spacing: 10 text: "回收站" }
}
-
Hi
I'd anchor the icons to the left with appropriate left margin.
Something like
Rectangle { id: parentRect anchors, height, and width: whatever you want Icon { id: icon anchors.left: parent.left anchors.leftMargin: someValue other anchors, height and width: as you need } Label { anchors.left: icon.right anchors.leftMargin: someValue } }
@ankou29666 I mean customize the layout inside the button.
-
@ankou29666 I mean customize the layout inside the button.
@jialuo see https://doc.qt.io/qt-5/qtquickcontrols2-customize.html#customizing-button
your content item perhaps Row of Icon and Text -
@JoeCFD ```
Column{Button{ height: 30 width: 100 icon.source:"./Image/fluent_star_filled.svg" spacing: 10 text: "未分类" } Button{ height: 30 width: 100 icon.source:"./Image/fluent_star_filled.svg" spacing: 10 text: "未标签" } Button{ height: 30 width: 100 icon.source:"./Image/fluent_star_filled.svg" spacing: 10 text: "标签管理" } Button{ height: 30 width: 100 icon.source:"./Image/fluent_star_filled.svg" spacing: 10 text: "回收站" }
}
@jialuo
add this to each buttoncontentItem: Label { anchors.fill: parent Row { Image { id: myImage height: root.height width: root.height source: "./Image/fluent_star_filled.svg" } Text { text: root.text height: root.height width: root.availableWidth color: "white" horizontalAlignment: Text.AlignLeft verticalAlignment: Text.AlignVCenter } } }
Better to create a customized button and you may have more settings like font.
-
@jialuo
add this to each buttoncontentItem: Label { anchors.fill: parent Row { Image { id: myImage height: root.height width: root.height source: "./Image/fluent_star_filled.svg" } Text { text: root.text height: root.height width: root.availableWidth color: "white" horizontalAlignment: Text.AlignLeft verticalAlignment: Text.AlignVCenter } } }
Better to create a customized button and you may have more settings like font.
-