Take the 2-minute tour ×
Ask Ubuntu is a question and answer site for Ubuntu users and developers. It's 100% free, no registration required.

If i use the PopupUtils.open() command in the Component.onCompleted property of the any item it does nothing, example:

Rectangle {
    id: rect
    height: 600
    width: height
    Component.onCompleted: {
        PopupUtils.open(dialog, rect)
        }

    Component {
         id: dialog
         Dialog {
             id: dialogue
             title: "Save file"
             text: "Are you sure that you want to save this file?"
             Button {
                 text: "cancel"
                 onClicked: PopupUtils.close(dialogue)
             }
             Button {
                 text: "overwrite previous version"
                 color: "orange"
                 onClicked: PopupUtils.close(dialogue)
             }
             Button {
                 text: "save a copy"
                 color: "orange"
                 onClicked: PopupUtils.close(dialogue)
             }
         }
    }

how can i properly display a popup dialog just after the app has started?

share|improve this question
add comment

2 Answers 2

PopupUtils.Open(dialog, id) is meant to wok for buttons.

Hence, add a button with the visible property as false and pass the id of that hidden button in place of "id" above (Without quotation of course).

Source:

Had the same problem :)

share|improve this answer
add comment
up vote 0 down vote accepted

For some reason, it works using a Timer, ie:

Rectangle {
    id: rect
    height: 600
    width: height
    Component.onCompleted: {
        start_timer.start()
     }

    Timer {
        id: start_timer
        interval: 200;
        onTriggered: PopupUtils.open(dialog, rect)
    }

    Component {
         id: dialog
         Dialog {
             id: dialogue
             title: "Save file"
             text: "Are you sure that you want to save this file?"
             Button {
                 text: "cancel"
                 onClicked: PopupUtils.close(dialogue)
             }
             Button {
                 text: "overwrite previous version"
                 color: "orange"
                 onClicked: PopupUtils.close(dialogue)
             }
             Button {
                 text: "save a copy"
                 color: "orange"
                 onClicked: PopupUtils.close(dialogue)
             }
         }
    }
share|improve this answer
add comment

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.