diff --git a/src/QmlControls/SubMenuButton.qml b/src/QmlControls/SubMenuButton.qml index 05533114dbd267df9348abd948e411128d4e2216..4d4538b13205b3f06d330ce2c93b98c89894ec92 100644 --- a/src/QmlControls/SubMenuButton.qml +++ b/src/QmlControls/SubMenuButton.qml @@ -13,8 +13,8 @@ Button { text: "Button" ///< Pass in your own button text - checkable: true - height: ScreenTools.defaultFontPixelHeight * 2.5 + checkable: true + implicitHeight: ScreenTools.defaultFontPixelHeight * 2.5 style: ButtonStyle { id: buttonStyle @@ -30,6 +30,8 @@ Button { id: innerRect color: showHighlight ? qgcPal.buttonHighlight : qgcPal.windowShade + implicitWidth: titleBar.x + titleBar.contentWidth + ScreenTools.defaultFontPixelWidth + QGCColoredImage { id: image anchors.leftMargin: ScreenTools.defaultFontPixelWidth diff --git a/src/VehicleSetup/SetupView.qml b/src/VehicleSetup/SetupView.qml index 1a782466098b6f24b9072a3d470a4d1decd7f7d3..27e8c33a131e69f4cd1650d530799dba793e4f8b 100644 --- a/src/VehicleSetup/SetupView.qml +++ b/src/VehicleSetup/SetupView.qml @@ -213,24 +213,42 @@ Rectangle { Flickable { id: buttonScroll - width: mainWindow.menuButtonWidth + width: buttonColumn.width anchors.topMargin: _defaultTextHeight / 2 anchors.top: parent.top anchors.bottom: parent.bottom clip: true contentHeight: buttonColumn.height - contentWidth: parent.width + contentWidth: buttonColumn.width boundsBehavior: Flickable.StopAtBounds flickableDirection: Flickable.VerticalFlick Column { id: buttonColumn - width: mainWindow.menuButtonWidth + width: _maxButtonWidth spacing: _defaultTextHeight / 2 + property real _maxButtonWidth: 0 + + Component.onCompleted: reflowWidths() + + Connections { + target: componentRepeater + + onModelChanged: buttonColumn.reflowWidths() + } + + function reflowWidths() { + for (var i=0; i