I want to make Dialog with only 1 button ("OK"). But when I use "standardButtons: Dialog.Ok" it positions it to the right. How it may be positioned in the middle? I would like to keep current button dimensions.
I've tried to use DialogButtonBox, and also Rectangle and Buttons in footer, but every time it not worked, or look like a mess
Code:
import QtQuick 2.15
import QtQuick.Window 2.15
import QtQuick.Controls 2.15
Window {
id: window
width: 640
height: 480
visible: true
title: qsTr("Hello World")
Button {
id: button
text: qsTr("Button")
anchors.verticalCenter: parent.verticalCenter
anchors.horizontalCenter: parent.horizontalCenter
onClicked: dialog.open()
}
Dialog {
id: dialog
modal: true
font.bold: true
title: "WARNING!!!"
Text {
id: dialogMessage
text: "Lorem ipsum dolor sit amet, consectetur adipiscing elit, \nsed do eiusmod tempor incididunt ut labore et dolore magna aliqua."
horizontalAlignment: Text.AlignHCenter
}
parent: Overlay.overlay
x: parent.width/2 - width/2
y: parent.height/2 - height/2
standardButtons: Dialog.Ok
}
}
