From 500681fb696eb602b7e415fc4136122b36b5e70e Mon Sep 17 00:00:00 2001 From: Andreas Traczyk <andreas.traczyk@savoirfairelinux.com> Date: Mon, 27 Nov 2023 08:31:35 -0500 Subject: [PATCH] misc-qml: remove some dead code Causes Binding loops in MaterialButton. Seems like support for a previous Qt/QML version. Change-Id: I32f71cb50a20c81e0354635c56a308821c6f5832 --- src/app/commoncomponents/MaterialButton.qml | 120 +++++++++----------- src/app/mainview/components/AboutPopUp.qml | 1 - 2 files changed, 52 insertions(+), 69 deletions(-) diff --git a/src/app/commoncomponents/MaterialButton.qml b/src/app/commoncomponents/MaterialButton.qml index 6c29fe958..f3f67d25f 100644 --- a/src/app/commoncomponents/MaterialButton.qml +++ b/src/app/commoncomponents/MaterialButton.qml @@ -94,87 +94,71 @@ AbstractButton { return root.color; } - contentItem: Item { - id: item + contentItem: RowLayout { + anchors.verticalCenter: parent.verticalCenter + spacing: hasIcon ? JamiTheme.preferredMarginSize : 0 - Binding on implicitWidth { - when: root.preferredWidth === undefined || !root.Layout.fillWidth - value: item.childrenRect.width - } - - implicitHeight: childrenRect.height - - RowLayout { - anchors.verticalCenter: parent.verticalCenter - Binding on width { - when: root.preferredWidth !== undefined || root.Layout.fillWidth - value: root.availableWidth - } + Component { + id: iconComponent - spacing: hasIcon ? JamiTheme.preferredMarginSize : 0 - - Component { - id: iconComponent - - ResponsiveImage { - source: source_ - Layout.preferredWidth: iconSize - Layout.preferredHeight: iconSize - color: contentColorProvider - } + ResponsiveImage { + source: source_ + Layout.preferredWidth: iconSize + Layout.preferredHeight: iconSize + color: contentColorProvider } + } - Component { - id: animatedIconComponent - - AnimatedImage { - source: animatedSource_ - Layout.preferredWidth: iconSize - Layout.preferredHeight: iconSize - width: iconSize - height: iconSize - playing: true - fillMode: Image.PreserveAspectFit - mipmap: true - } + Component { + id: animatedIconComponent + + AnimatedImage { + source: animatedSource_ + Layout.preferredWidth: iconSize + Layout.preferredHeight: iconSize + width: iconSize + height: iconSize + playing: true + fillMode: Image.PreserveAspectFit + mipmap: true } + } - Loader { - id: icon - - property string source_ - property string animatedSource_ - - active: hasIcon + Loader { + id: icon - Layout.preferredWidth: active * width + property string source_ + property string animatedSource_ - Layout.alignment: Qt.AlignVCenter - Layout.leftMargin: hasIcon ? JamiTheme.preferredMarginSize : undefined - sourceComponent: animatedSource_.length !== 0 ? animatedIconComponent : iconComponent - } + active: hasIcon - Text { - id: textButton + Layout.preferredWidth: active * width - Layout.rightMargin: { - if ((!hasIcon || root.preferredWidth === undefined) && !root.Layout.fillWidth) - return undefined; - return icon.width + JamiTheme.preferredMarginSize / 2 + parent.spacing; - } + Layout.alignment: Qt.AlignVCenter + Layout.leftMargin: hasIcon ? JamiTheme.preferredMarginSize : undefined + sourceComponent: animatedSource_.length !== 0 ? animatedIconComponent : iconComponent + } - Layout.fillWidth: true - Layout.alignment: Qt.AlignHCenter + Text { + id: textButton - leftPadding: root.primary ? JamiTheme.buttontextWizzardPadding : textLeftPadding - rightPadding: root.primary ? JamiTheme.buttontextWizzardPadding : textRightPadding - text: root.text - elide: Text.ElideRight - verticalAlignment: Text.AlignVCenter - horizontalAlignment: root.textAlignment - color: contentColorProvider - font.pixelSize: fontSize + Layout.rightMargin: { + if ((!hasIcon || root.preferredWidth === undefined) && !root.Layout.fillWidth) + return undefined; + return icon.width + JamiTheme.preferredMarginSize / 2 + parent.spacing; } + + Layout.fillWidth: true + Layout.alignment: Qt.AlignHCenter + + leftPadding: root.primary ? JamiTheme.buttontextWizzardPadding : textLeftPadding + rightPadding: root.primary ? JamiTheme.buttontextWizzardPadding : textRightPadding + text: root.text + elide: Text.ElideRight + verticalAlignment: Text.AlignVCenter + horizontalAlignment: root.textAlignment + color: contentColorProvider + font.pixelSize: fontSize } } diff --git a/src/app/mainview/components/AboutPopUp.qml b/src/app/mainview/components/AboutPopUp.qml index bed8e508e..fb474fe18 100644 --- a/src/app/mainview/components/AboutPopUp.qml +++ b/src/app/mainview/components/AboutPopUp.qml @@ -41,7 +41,6 @@ BaseModalDialog { width: aboutPopUpContentRectColumnLayout.implicitWidth height: Math.min(root.implicitHeight, aboutPopUpContentRectColumnLayout.implicitHeight) - Component.onCompleted: print(root.height, aboutPopUpContentRectColumnLayout.implicitHeight) contentHeight: aboutPopUpContentRectColumnLayout.implicitHeight ColumnLayout { -- GitLab