How to make Dialog fit it's contents?



  • I have something like this:

    Dialog {
            id: dialog
            title: qsTr("Choose someText")
            standardButtons: StandardButton.Ok | StandardButton.Cancel
    
            Row {
                id: row
                spacing: 5
                Label {text: qsTr("this is someText:");anchors.verticalCenter: tf.verticalCenter}
                TextField {
                    id:tf
                    text: someText
                }
                Label {text: "text2";anchors.verticalCenter: tf.verticalCenter}
            }
        }
    

    But no matter what (changing spacing, commenting out labels), Dialog width always stays at 225 cutting part from leftmost label. In docs it said it should fit the content of it's content item but it doesn't! How to solve this? I don't want to recreate dialog with all of it's buttons and signals using window.
    P.S. sort of unrelated question: is there a way to wait until dialog is closed? For example if I want to use value retrieved from dialoge in signal, I want to .open() dialog and wait until it closes to send signal. connecting to onAccepted() won't work because I don't want to send this signal every time this dialog closes, only after I open it from specific place.


Log in to reply
 

Looks like your connection to Qt Forum was lost, please wait while we try to reconnect.