Details
-
Bug
-
Resolution: Done
-
P2: Important
-
5.11.1, 5.12.1
-
-
5135bec50762955b3a1138ecda10214a9d0bf62a (qt/qtquickcontrols2/5.12)
Description
I'd like to be able to use DialogButtonBox for its styling, but without using the functionality to automatically order buttons based on the platform. I tried adding buttons without providing DialogButtonBox.buttonRole and hoped that it would show my custom buttons in the order I specify. However, it orders the buttons randomly.
I peeked at the Qt source and it seems that it's ordering by the memory address of the QQuickAbstractButtons.
Here is a QML document that shows the random ordering:
import QtQuick 2.9 import QtQuick.Window 2.2 import QtQuick.Controls 2.2 Window { id: root visible: true width: 640 height: 480 Component { id: myComponent Dialog { width: parent.width * .9 footer: DialogButtonBox { Button { text: "A" } Button { text: "B" } Button { text: "C" } } } } property var thing: null SequentialAnimation { running: true loops: Animation.Infinite ScriptAction { script: { thing = myComponent.createObject(root) thing.open() }} PauseAnimation { duration: 500} ScriptAction { script: thing.destroy() } PauseAnimation { duration: 100} } }