mirror of
https://github.com/johndoe6345789/metabuilder.git
synced 2026-04-24 13:54:57 +00:00
docs: qt6,frontends,qml (2 files)
This commit is contained in:
@@ -26,4 +26,5 @@ You can also embed `main.qml` into a Qt Quick Application project and expose C++
|
||||
- Use `Material.MaterialSurface` and `Material.MaterialDivider` to group controls with Material elevation, spacing, and dividers.
|
||||
- `Material.MaterialButton` now supports icon sources and a built-in ripple animation so interactions feel tactile.
|
||||
- Material badges live in `Material.MaterialBadge` for lightweight status chips (accented, dense, or outlined).
|
||||
- `Material.MaterialBadge` also accepts `iconSource` so you can anchor a micro icon beside the label.
|
||||
- Preview the Material view with `qmlscene frontends/qt6/MaterialLanding.qml` or embed it into your Qt Quick application to reuse the tokens and components across other screens.
|
||||
|
||||
@@ -6,22 +6,39 @@ import "MaterialPalette.qml" as MaterialPalette
|
||||
Rectangle {
|
||||
id: badge
|
||||
property string text: ""
|
||||
property url iconSource: ""
|
||||
property bool accent: false
|
||||
property bool outlined: false
|
||||
property bool dense: false
|
||||
|
||||
height: dense ? 24 : 28
|
||||
radius: height / 2
|
||||
implicitWidth: label.width + 20
|
||||
implicitWidth: label.width + (iconSource.length > 0 ? 32 : 20)
|
||||
color: outlined ? "transparent" : (accent ? MaterialPalette.secondaryContainer : MaterialPalette.surfaceVariant)
|
||||
border.color: outlined ? MaterialPalette.secondary : "transparent"
|
||||
border.width: outlined ? 1 : 0
|
||||
|
||||
Text {
|
||||
id: label
|
||||
anchors.centerIn: parent
|
||||
text: badge.text
|
||||
font.pixelSize: dense ? 12 : 14
|
||||
color: accent ? MaterialPalette.secondary : MaterialPalette.onSurface
|
||||
RowLayout {
|
||||
id: wrapper
|
||||
anchors.fill: parent
|
||||
anchors.margins: 6
|
||||
spacing: iconSource.length > 0 ? 6 : 0
|
||||
Layout.alignment: Qt.AlignCenter
|
||||
|
||||
Image {
|
||||
source: iconSource
|
||||
visible: iconSource.length > 0
|
||||
width: 16
|
||||
height: 16
|
||||
fillMode: Image.PreserveAspectFit
|
||||
opacity: 0.85
|
||||
}
|
||||
|
||||
Text {
|
||||
id: label
|
||||
text: badge.text
|
||||
font.pixelSize: dense ? 12 : 14
|
||||
color: accent ? MaterialPalette.secondary : MaterialPalette.onSurface
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user