Fix QML warnings regarding use of anchors within layout
'Detected anchors on an item that is managed by a layout. This is undefined behavior; use Layout.alignment instead.'
This commit is contained in:
parent
db4b032179
commit
321d6fdd60
|
@ -2,30 +2,38 @@ import QtQuick 2.7
|
||||||
import QtQuick.Layouts 1.1
|
import QtQuick.Layouts 1.1
|
||||||
import org.kde.plasma.components 2.0 as PlasmaComponents
|
import org.kde.plasma.components 2.0 as PlasmaComponents
|
||||||
|
|
||||||
RowLayout {
|
Item {
|
||||||
id: detailItem
|
id: detailItem
|
||||||
|
|
||||||
property string detailName: name ? name : ""
|
property string detailName: name ? name : ""
|
||||||
property string detailValue: detail ? detail : ""
|
property string detailValue: detail ? detail : ""
|
||||||
|
|
||||||
spacing: theme.defaultFont.pointSize * 0.8
|
width: detailRow.implicitWidth
|
||||||
|
height: detailRow.implicitHeight
|
||||||
|
|
||||||
PlasmaComponents.Label {
|
RowLayout {
|
||||||
Layout.preferredWidth: 100
|
id: detailRow
|
||||||
Layout.leftMargin: units.iconSizes.smallMedium
|
spacing: theme.defaultFont.pointSize * 0.8
|
||||||
text: detailName + ":"
|
|
||||||
font.pointSize: theme.defaultFont.pointSize * 0.8
|
PlasmaComponents.Label {
|
||||||
font.weight: Font.DemiBold
|
Layout.preferredWidth: 100
|
||||||
horizontalAlignment: Qt.AlignRight
|
Layout.leftMargin: units.iconSizes.smallMedium
|
||||||
}
|
text: detailName + ":"
|
||||||
PlasmaComponents.Label {
|
font.pointSize: theme.defaultFont.pointSize * 0.8
|
||||||
Layout.fillWidth: true
|
font.weight: Font.DemiBold
|
||||||
text: detailValue
|
horizontalAlignment: Qt.AlignRight
|
||||||
font.pointSize: theme.defaultFont.pointSize * 0.8
|
}
|
||||||
elide: Text.ElideRight
|
PlasmaComponents.Label {
|
||||||
|
Layout.fillWidth: true
|
||||||
|
text: detailValue
|
||||||
|
font.pointSize: theme.defaultFont.pointSize * 0.8
|
||||||
|
elide: Text.ElideRight
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
MouseArea {
|
MouseArea {
|
||||||
anchors.fill: parent
|
|
||||||
acceptedButtons: Qt.RightButton
|
acceptedButtons: Qt.RightButton
|
||||||
|
anchors.fill: parent
|
||||||
onClicked: {
|
onClicked: {
|
||||||
var view = detailItem.ListView.view
|
var view = detailItem.ListView.view
|
||||||
var coordinates = mapToItem(view, mouseX, mouseY)
|
var coordinates = mapToItem(view, mouseX, mouseY)
|
||||||
|
|
|
@ -33,12 +33,12 @@ Item {
|
||||||
PlasmaCore.IconItem {
|
PlasmaCore.IconItem {
|
||||||
Layout.preferredWidth: units.iconSizes.small
|
Layout.preferredWidth: units.iconSizes.small
|
||||||
Layout.preferredHeight: units.iconSizes.small
|
Layout.preferredHeight: units.iconSizes.small
|
||||||
anchors.verticalCenter: parent.verticalCenter
|
Layout.alignment: Qt.AlignVCenter | Qt.AlignLeft
|
||||||
source: statusIcon
|
source: statusIcon
|
||||||
}
|
}
|
||||||
PlasmaComponents.Label {
|
PlasmaComponents.Label {
|
||||||
Layout.fillWidth: true
|
Layout.fillWidth: true
|
||||||
anchors.verticalCenter: parent.verticalCenter
|
Layout.alignment: Qt.AlignVCenter | Qt.AlignLeft
|
||||||
elide: Text.ElideRight
|
elide: Text.ElideRight
|
||||||
text: name
|
text: name
|
||||||
}
|
}
|
||||||
|
@ -49,7 +49,7 @@ Item {
|
||||||
height: implicitHeight
|
height: implicitHeight
|
||||||
text: statusString
|
text: statusString
|
||||||
color: statusColor ? statusColor : PlasmaCore.ColorScope.textColor
|
color: statusColor ? statusColor : PlasmaCore.ColorScope.textColor
|
||||||
anchors.verticalCenter: parent.verticalCenter
|
Layout.alignment: Qt.AlignVCenter | Qt.AlignLeft
|
||||||
}
|
}
|
||||||
Item {
|
Item {
|
||||||
width: 3
|
width: 3
|
||||||
|
|
|
@ -47,12 +47,12 @@ ColumnLayout {
|
||||||
PlasmaCore.IconItem {
|
PlasmaCore.IconItem {
|
||||||
Layout.preferredWidth: units.iconSizes.small
|
Layout.preferredWidth: units.iconSizes.small
|
||||||
Layout.preferredHeight: units.iconSizes.small
|
Layout.preferredHeight: units.iconSizes.small
|
||||||
anchors.verticalCenter: parent.verticalCenter
|
Layout.alignment: Qt.AlignVCenter | Qt.AlignLeft
|
||||||
source: statusIcon
|
source: statusIcon
|
||||||
}
|
}
|
||||||
PlasmaComponents.Label {
|
PlasmaComponents.Label {
|
||||||
Layout.fillWidth: true
|
Layout.fillWidth: true
|
||||||
anchors.verticalCenter: parent.verticalCenter
|
Layout.alignment: Qt.AlignVCenter | Qt.AlignLeft
|
||||||
elide: Text.ElideRight
|
elide: Text.ElideRight
|
||||||
text: name
|
text: name
|
||||||
}
|
}
|
||||||
|
@ -64,7 +64,7 @@ ColumnLayout {
|
||||||
height: implicitHeight
|
height: implicitHeight
|
||||||
text: statusString
|
text: statusString
|
||||||
color: statusColor ? statusColor : PlasmaCore.ColorScope.textColor
|
color: statusColor ? statusColor : PlasmaCore.ColorScope.textColor
|
||||||
anchors.verticalCenter: parent.verticalCenter
|
Layout.alignment: Qt.AlignVCenter | Qt.AlignLeft
|
||||||
}
|
}
|
||||||
Item {
|
Item {
|
||||||
width: units.smallSpacing
|
width: units.smallSpacing
|
||||||
|
|
|
@ -34,7 +34,7 @@ Item {
|
||||||
RowLayout {
|
RowLayout {
|
||||||
spacing: units.smallSpacing
|
spacing: units.smallSpacing
|
||||||
PlasmaComponents.Label {
|
PlasmaComponents.Label {
|
||||||
anchors.verticalCenter: parent.verticalCenter
|
Layout.alignment: Qt.AlignVCenter | Qt.AlignLeft
|
||||||
elide: Text.ElideRight
|
elide: Text.ElideRight
|
||||||
text: name ? name : "?"
|
text: name ? name : "?"
|
||||||
}
|
}
|
||||||
|
@ -53,7 +53,7 @@ Item {
|
||||||
PlasmaComponents.Label {
|
PlasmaComponents.Label {
|
||||||
height: implicitHeight
|
height: implicitHeight
|
||||||
text: progressLabel ? progressLabel : ""
|
text: progressLabel ? progressLabel : ""
|
||||||
anchors.verticalCenter: parent.verticalCenter
|
Layout.alignment: Qt.AlignVCenter | Qt.AlignLeft
|
||||||
}
|
}
|
||||||
Item {
|
Item {
|
||||||
width: 3
|
width: 3
|
||||||
|
@ -85,7 +85,7 @@ Item {
|
||||||
PlasmaCore.IconItem {
|
PlasmaCore.IconItem {
|
||||||
Layout.preferredWidth: units.iconSizes.medium
|
Layout.preferredWidth: units.iconSizes.medium
|
||||||
Layout.preferredHeight: units.iconSizes.medium
|
Layout.preferredHeight: units.iconSizes.medium
|
||||||
anchors.verticalCenter: parent.verticalCenter
|
Layout.alignment: Qt.AlignVCenter | Qt.AlignLeft
|
||||||
source: fileIcon
|
source: fileIcon
|
||||||
}
|
}
|
||||||
ColumnLayout {
|
ColumnLayout {
|
||||||
|
|
|
@ -481,7 +481,7 @@ ColumnLayout {
|
||||||
PlasmaComponents.TabBar {
|
PlasmaComponents.TabBar {
|
||||||
id: tabBar
|
id: tabBar
|
||||||
tabPosition: Qt.LeftEdge
|
tabPosition: Qt.LeftEdge
|
||||||
anchors.top: parent.top
|
Layout.alignment: Qt.AlignTop | Qt.AlignLeft
|
||||||
|
|
||||||
PlasmaComponents.TabButton {
|
PlasmaComponents.TabButton {
|
||||||
id: dirsTabButton
|
id: dirsTabButton
|
||||||
|
|
|
@ -1,4 +1,3 @@
|
||||||
|
|
||||||
// This is a simplified and adjusted version of Plasma's ToolButtonStyle.
|
// This is a simplified and adjusted version of Plasma's ToolButtonStyle.
|
||||||
// It will make the button only as big as required and allows to disable
|
// It will make the button only as big as required and allows to disable
|
||||||
// padding. This makes the button a little bit more compact. Additionally,
|
// padding. This makes the button a little bit more compact. Additionally,
|
||||||
|
@ -52,7 +51,7 @@ QtQuickControlStyle.ButtonStyle {
|
||||||
|
|
||||||
PlasmaComponents.Label {
|
PlasmaComponents.Label {
|
||||||
id: label
|
id: label
|
||||||
anchors.verticalCenter: parent.verticalCenter
|
Layout.alignment: Qt.AlignVCenter
|
||||||
text: control.text
|
text: control.text
|
||||||
textFormat: Text.StyledText
|
textFormat: Text.StyledText
|
||||||
font: control.font || theme.defaultFont
|
font: control.font || theme.defaultFont
|
||||||
|
|
Loading…
Reference in New Issue