Details
-
Bug
-
Resolution: Unresolved
-
P2: Important
-
None
-
6.6.0
-
None
-
-
c2ae0350a (dev), 819591bea (6.5)
Description
I want my two buttons to have the same width. For this I want to use horizontalStretchFactor
Layout.horizontalStretchFactor: 1 . This makes the button with one character actually bigger than the other.
No Layout.horizontalStretchFactor
Is there a way to make the two buttons the same width without doing Layout.preferredWidth: parent.width *.5 ?
import QtQuick import QtQuick.Window import QtQuick.Controls import QtQuick.Controls.Material import QtQuick.Layouts Window { width: 640 height: 480 visible: true title: qsTr("Hello World") RowLayout { anchors.fill: parent spacing: 0 Rectangle { Layout.fillWidth: true Layout.fillHeight: true color: "orange" } Rectangle { Layout.fillWidth: true Layout.fillHeight: true color: "#ff5733" } } RowLayout { anchors.fill: parent Button { text: "a" Layout.fillWidth: true // Layout.horizontalStretchFactor: 1 // Layout.preferredWidth: parent.width * .5 } Button { text: "asdasdasdasdasdasdasd" Layout.fillWidth: true // Layout.horizontalStretchFactor: 1 // Layout.preferredWidth: parent.width * .5 } } }