qtdialogqml

error dialog box with Qt quick


i'm programming a Qt Quick application and I'm looking for a possibility to display the user errors. In Qt widgets there is QMessageBox but i can not find any equivalent to this in Qt Quick.

Sure i can create a MessageBox by myself but I can't imagine that there is no given possibility?

I found an ebook on the official site here and there is an Dialog described on page 67 but it doesn't work anymore and i can't find any further information about that. Is it dropped in the current version?

Thanks in advance


Solution

  • There is no Qt-Quick component for this yet. What I do in my application is using the Window QML component. I set the modality property to Qt.WindowModal to have it as a modal Window. You can then use the Button component to create OK/Cancel buttons.

    Another thing I do is create these modals dynamically when something wrong occurs using Qt.createComponent() in QML.

    Edit: Just discovered a new Dialog component that will be released in Qt5.2 that seems to match what you are looking for: MessageDialog