fix(@desktop/statusq): Change id for StatusListItem to root.
Fix some equal signs to be === and !==. Removed iconHoverEnabled property for StatusListItem. Fixes #8599
This commit is contained in:
parent
19436c0e58
commit
1c7c0d7d81
|
@ -10,7 +10,7 @@ import QtGraphicalEffects 1.14
|
||||||
import "private"
|
import "private"
|
||||||
|
|
||||||
Rectangle {
|
Rectangle {
|
||||||
id: statusListItem
|
id: root
|
||||||
|
|
||||||
property string itemId: ""
|
property string itemId: ""
|
||||||
property string titleId: ""
|
property string titleId: ""
|
||||||
|
@ -34,7 +34,6 @@ Rectangle {
|
||||||
property Component inlineTagDelegate
|
property Component inlineTagDelegate
|
||||||
property bool loading: false
|
property bool loading: false
|
||||||
property bool loadingFailed: false
|
property bool loadingFailed: false
|
||||||
property bool iconHoverEnabled: false
|
|
||||||
|
|
||||||
property StatusAssetSettings asset: StatusAssetSettings {
|
property StatusAssetSettings asset: StatusAssetSettings {
|
||||||
height: isImage ? 40 : 20
|
height: isImage ? 40 : 20
|
||||||
|
@ -97,7 +96,7 @@ Rectangle {
|
||||||
return Math.max(64, statusListItemTitleArea.height + 90)
|
return Math.max(64, statusListItemTitleArea.height + 90)
|
||||||
}
|
}
|
||||||
color: {
|
color: {
|
||||||
if (sensor.containsMouse || statusListItem.highlighted) {
|
if (sensor.containsMouse || root.highlighted) {
|
||||||
switch(type) {
|
switch(type) {
|
||||||
case StatusListItem.Type.Primary:
|
case StatusListItem.Type.Primary:
|
||||||
return Theme.palette.baseColor2
|
return Theme.palette.baseColor2
|
||||||
|
@ -123,7 +122,7 @@ Rectangle {
|
||||||
anchors.fill: parent
|
anchors.fill: parent
|
||||||
acceptedButtons: Qt.LeftButton | Qt.RightButton
|
acceptedButtons: Qt.LeftButton | Qt.RightButton
|
||||||
onClicked: {
|
onClicked: {
|
||||||
statusListItem.clicked(statusListItem.itemId, mouse)
|
root.clicked(root.itemId, mouse)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -138,19 +137,18 @@ Rectangle {
|
||||||
StatusSmartIdenticon {
|
StatusSmartIdenticon {
|
||||||
id: iconOrImage
|
id: iconOrImage
|
||||||
anchors.left: parent.left
|
anchors.left: parent.left
|
||||||
anchors.leftMargin: statusListItem.leftPadding
|
anchors.leftMargin: root.leftPadding
|
||||||
anchors.verticalCenter: parent.verticalCenter
|
anchors.verticalCenter: parent.verticalCenter
|
||||||
asset: statusListItem.asset
|
asset: root.asset
|
||||||
name: statusListItem.title
|
name: root.title
|
||||||
active: statusListItem.asset.isLetterIdenticon ||
|
active: root.asset.isLetterIdenticon ||
|
||||||
!!statusListItem.asset.name ||
|
!!root.asset.name ||
|
||||||
!!statusListItem.asset.emoji
|
!!root.asset.emoji
|
||||||
badge.border.color: statusListItem.color
|
badge.border.color: root.color
|
||||||
ringSettings: statusListItem.ringSettings
|
ringSettings: root.ringSettings
|
||||||
loading: statusListItem.loading
|
loading: root.loading
|
||||||
hoverEnabled: statusListItem.iconHoverEnabled
|
|
||||||
|
|
||||||
onClicked: statusListItem.iconClicked(mouse)
|
onClicked: root.iconClicked(mouse)
|
||||||
}
|
}
|
||||||
|
|
||||||
Item {
|
Item {
|
||||||
|
@ -161,20 +159,20 @@ Rectangle {
|
||||||
if(titleIconsRow.item) {
|
if(titleIconsRow.item) {
|
||||||
isIconsRowVisible = true//titleIconsRow.item.visible
|
isIconsRowVisible = true//titleIconsRow.item.visible
|
||||||
}
|
}
|
||||||
return !statusListItem.titleAsideText && !isIconsRowVisible ? statusListItemTitleArea.right : undefined
|
return !root.titleAsideText && !isIconsRowVisible ? statusListItemTitleArea.right : undefined
|
||||||
}
|
}
|
||||||
|
|
||||||
anchors.left: iconOrImage.active ? iconOrImage.right : parent.left
|
anchors.left: iconOrImage.active ? iconOrImage.right : parent.left
|
||||||
anchors.right: statusListItemLabel.visible ? statusListItemLabel.left : statusListItemComponentsSlot.left
|
anchors.right: statusListItemLabel.visible ? statusListItemLabel.left : statusListItemComponentsSlot.left
|
||||||
anchors.leftMargin: iconOrImage.active ? 16 : statusListItem.leftPadding
|
anchors.leftMargin: iconOrImage.active ? 16 : root.leftPadding
|
||||||
anchors.rightMargin: Math.max(statusListItem.rightPadding, titleIconsRow.requiredWidth)
|
anchors.rightMargin: Math.max(root.rightPadding, titleIconsRow.requiredWidth)
|
||||||
anchors.verticalCenter: bottomModel.length === 0 ? parent.verticalCenter : undefined
|
anchors.verticalCenter: bottomModel.length === 0 ? parent.verticalCenter : undefined
|
||||||
|
|
||||||
height: childrenRect.height
|
height: childrenRect.height
|
||||||
|
|
||||||
StatusTextWithLoadingState {
|
StatusTextWithLoadingState {
|
||||||
id: statusListItemTitle
|
id: statusListItemTitle
|
||||||
text: statusListItem.title
|
text: root.title
|
||||||
font.pixelSize: 15
|
font.pixelSize: 15
|
||||||
height: visible ? contentHeight : 0
|
height: visible ? contentHeight : 0
|
||||||
elide: Text.ElideRight
|
elide: Text.ElideRight
|
||||||
|
@ -183,10 +181,10 @@ Rectangle {
|
||||||
anchors.topMargin: bottomModel.length === 0 ? undefined : 20
|
anchors.topMargin: bottomModel.length === 0 ? undefined : 20
|
||||||
width: Math.min(implicitWidth, parent.width)
|
width: Math.min(implicitWidth, parent.width)
|
||||||
customColor: {
|
customColor: {
|
||||||
if (!statusListItem.enabled) {
|
if (!root.enabled) {
|
||||||
return Theme.palette.baseColor1
|
return Theme.palette.baseColor1
|
||||||
}
|
}
|
||||||
switch (statusListItem.type) {
|
switch (root.type) {
|
||||||
case StatusListItem.Type.Primary:
|
case StatusListItem.Type.Primary:
|
||||||
return Theme.palette.directColor1
|
return Theme.palette.directColor1
|
||||||
case StatusListItem.Type.Secondary:
|
case StatusListItem.Type.Secondary:
|
||||||
|
@ -195,16 +193,16 @@ Rectangle {
|
||||||
return Theme.palette.dangerColor1
|
return Theme.palette.dangerColor1
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
loading: statusListItem.loading
|
loading: root.loading
|
||||||
|
|
||||||
StatusIcon {
|
StatusIcon {
|
||||||
width: visible ? 12 : 0
|
width: visible ? 12 : 0
|
||||||
height: visible ? 12 : 0
|
height: visible ? 12 : 0
|
||||||
visible: !!statusListItem.titleTextIcon
|
visible: !!root.titleTextIcon
|
||||||
anchors.verticalCenter: parent.verticalCenter
|
anchors.verticalCenter: parent.verticalCenter
|
||||||
anchors.left: parent.left
|
anchors.left: parent.left
|
||||||
anchors.leftMargin: statusListItemTitle.contentWidth + 6
|
anchors.leftMargin: statusListItemTitle.contentWidth + 6
|
||||||
icon: statusListItem.titleTextIcon
|
icon: root.titleTextIcon
|
||||||
}
|
}
|
||||||
|
|
||||||
StatusToolTip {
|
StatusToolTip {
|
||||||
|
@ -217,12 +215,12 @@ Rectangle {
|
||||||
MouseArea {
|
MouseArea {
|
||||||
id: statusListItemTitleMouseArea
|
id: statusListItemTitleMouseArea
|
||||||
anchors.fill: parent
|
anchors.fill: parent
|
||||||
enabled: statusListItem.enabled
|
enabled: root.enabled
|
||||||
cursorShape: sensor.enabled && containsMouse ? Qt.PointingHandCursor : Qt.ArrowCursor
|
cursorShape: sensor.enabled && containsMouse ? Qt.PointingHandCursor : Qt.ArrowCursor
|
||||||
hoverEnabled: true
|
hoverEnabled: true
|
||||||
propagateComposedEvents: statusListItem.propagateTitleClicks
|
propagateComposedEvents: root.propagateTitleClicks
|
||||||
onClicked: {
|
onClicked: {
|
||||||
statusListItem.titleClicked(statusListItem.titleId)
|
root.titleClicked(root.titleId)
|
||||||
mouse.accepted = false
|
mouse.accepted = false
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -235,11 +233,11 @@ Rectangle {
|
||||||
anchors.verticalCenter: statusListItemTitle.verticalCenter
|
anchors.verticalCenter: statusListItemTitle.verticalCenter
|
||||||
anchors.top: bottomModel.length === 0 ? undefined: parent.top
|
anchors.top: bottomModel.length === 0 ? undefined: parent.top
|
||||||
anchors.topMargin: bottomModel.length === 0 ? undefined : 20
|
anchors.topMargin: bottomModel.length === 0 ? undefined : 20
|
||||||
text: statusListItem.titleAsideText
|
text: root.titleAsideText
|
||||||
font.pixelSize: 10
|
font.pixelSize: 10
|
||||||
customColor: Theme.palette.baseColor1
|
customColor: Theme.palette.baseColor1
|
||||||
visible: !!statusListItem.titleAsideText
|
visible: !!root.titleAsideText
|
||||||
loading: statusListItem.loading
|
loading: root.loading
|
||||||
}
|
}
|
||||||
|
|
||||||
Loader {
|
Loader {
|
||||||
|
@ -247,7 +245,7 @@ Rectangle {
|
||||||
|
|
||||||
readonly property int requiredWidth: active ? width + anchors.leftMargin * 2 : 0
|
readonly property int requiredWidth: active ? width + anchors.leftMargin * 2 : 0
|
||||||
|
|
||||||
anchors.left: !statusListItem.titleAsideText ? statusListItemTitle.right : statusListItemTitleAsideText.right
|
anchors.left: !root.titleAsideText ? statusListItemTitle.right : statusListItemTitleAsideText.right
|
||||||
anchors.verticalCenter: statusListItemTitle.verticalCenter
|
anchors.verticalCenter: statusListItemTitle.verticalCenter
|
||||||
anchors.leftMargin: 4
|
anchors.leftMargin: 4
|
||||||
}
|
}
|
||||||
|
@ -265,13 +263,13 @@ Rectangle {
|
||||||
Layout.alignment: Qt.AlignVCenter
|
Layout.alignment: Qt.AlignVCenter
|
||||||
Layout.preferredWidth: inlineTagModelRepeater.count > 0 ? contentWidth : parent.width
|
Layout.preferredWidth: inlineTagModelRepeater.count > 0 ? contentWidth : parent.width
|
||||||
|
|
||||||
text: statusListItem.subTitle
|
text: root.subTitle
|
||||||
font.pixelSize: 15
|
font.pixelSize: 15
|
||||||
customColor: !statusListItem.enabled || !statusListItem.tertiaryTitle ?
|
customColor: !root.enabled || !root.tertiaryTitle ?
|
||||||
Theme.palette.baseColor1 : Theme.palette.directColor1
|
Theme.palette.baseColor1 : Theme.palette.directColor1
|
||||||
visible: !!statusListItem.subTitle
|
visible: !!root.subTitle
|
||||||
wrapMode: Text.WrapAtWordBoundaryOrAnywhere
|
wrapMode: Text.WrapAtWordBoundaryOrAnywhere
|
||||||
loading: statusListItem.loading
|
loading: root.loading
|
||||||
}
|
}
|
||||||
|
|
||||||
StatusTextWithLoadingState {
|
StatusTextWithLoadingState {
|
||||||
|
@ -315,12 +313,12 @@ Rectangle {
|
||||||
anchors.top: statusListItemSubtitleTagsRow.bottom
|
anchors.top: statusListItemSubtitleTagsRow.bottom
|
||||||
width: parent.width
|
width: parent.width
|
||||||
height: visible ? contentHeight : 0
|
height: visible ? contentHeight : 0
|
||||||
text: statusListItem.tertiaryTitle
|
text: root.tertiaryTitle
|
||||||
customColor: Theme.palette.baseColor1
|
customColor: Theme.palette.baseColor1
|
||||||
font.pixelSize: 13
|
font.pixelSize: 13
|
||||||
visible: !!statusListItem.tertiaryTitle
|
visible: !!root.tertiaryTitle
|
||||||
wrapMode: Text.WrapAtWordBoundaryOrAnywhere
|
wrapMode: Text.WrapAtWordBoundaryOrAnywhere
|
||||||
loading: statusListItem.loading
|
loading: root.loading
|
||||||
}
|
}
|
||||||
|
|
||||||
StatusListItemBadge {
|
StatusListItemBadge {
|
||||||
|
@ -375,17 +373,17 @@ Rectangle {
|
||||||
anchors.right: statusListItemComponentsSlot.left
|
anchors.right: statusListItemComponentsSlot.left
|
||||||
anchors.rightMargin: statusListItemComponentsSlot.width > 0 ? 10 : 0
|
anchors.rightMargin: statusListItemComponentsSlot.width > 0 ? 10 : 0
|
||||||
|
|
||||||
text: statusListItem.label
|
text: root.label
|
||||||
font.pixelSize: 15
|
font.pixelSize: 15
|
||||||
customColor: Theme.palette.baseColor1
|
customColor: Theme.palette.baseColor1
|
||||||
visible: !!statusListItem.label
|
visible: !!root.label
|
||||||
loading: statusListItem.loading
|
loading: root.loading
|
||||||
}
|
}
|
||||||
|
|
||||||
Row {
|
Row {
|
||||||
id: statusListItemComponentsSlot
|
id: statusListItemComponentsSlot
|
||||||
anchors.right: parent.right
|
anchors.right: parent.right
|
||||||
anchors.rightMargin: statusListItem.rightPadding
|
anchors.rightMargin: root.rightPadding
|
||||||
anchors.verticalCenter: bottomModel.length === 0 ? parent.verticalCenter : undefined
|
anchors.verticalCenter: bottomModel.length === 0 ? parent.verticalCenter : undefined
|
||||||
anchors.top: bottomModel.length === 0 ? undefined: parent.top
|
anchors.top: bottomModel.length === 0 ? undefined: parent.top
|
||||||
anchors.topMargin: bottomModel.length === 0 ? undefined : 12
|
anchors.topMargin: bottomModel.length === 0 ? undefined : 12
|
||||||
|
|
|
@ -144,7 +144,7 @@ Loader {
|
||||||
|
|
||||||
Connections {
|
Connections {
|
||||||
target: item
|
target: item
|
||||||
enabled: status == Loader.Ready
|
enabled: status === Loader.Ready
|
||||||
ignoreUnknownSignals: true
|
ignoreUnknownSignals: true
|
||||||
|
|
||||||
function onClicked(mouse) {
|
function onClicked(mouse) {
|
||||||
|
|
|
@ -368,7 +368,7 @@ Item {
|
||||||
onCursorRectangleChanged: Utils.ensureVisible(flick, cursorRectangle)
|
onCursorRectangleChanged: Utils.ensureVisible(flick, cursorRectangle)
|
||||||
onActiveFocusChanged: if (root.pristine) root.pristine = false
|
onActiveFocusChanged: if (root.pristine) root.pristine = false
|
||||||
onTextChanged: {
|
onTextChanged: {
|
||||||
if (previousText === text || (previousText == "" && length == 0 && length != text.length)) {
|
if (previousText === text || (previousText === "" && length === 0 && length !== text.length)) {
|
||||||
// Not sure why, but the textChanged event was triggered even if it didn't really
|
// Not sure why, but the textChanged event was triggered even if it didn't really
|
||||||
|
|
||||||
// Avoid further processing on initial condition when previousText is empty
|
// Avoid further processing on initial condition when previousText is empty
|
||||||
|
|
Loading…
Reference in New Issue