4

I have a program that at one point lets the user choose between 2 values. To do this, I want to open a box with 2 Buttons ( OK, Cancel) plus a field to choose from or write in the values. Just something like a QMessageBox with the possibility to fill in/choose data. I could create a class and code everything myself but I wonder if there is a standard-dialog for that.

Does anybody know of a standard-dialog like that in QT?

Thank you

itelly

2

1 Answer 1

6

Qt provides several standard dialogues. The one for this is called QInputDialog

For easy use you can use its static functions like this.

QString text = QInputDialog::getText(parent,"Title","text");

They can be further customized and static functions for StringLists, int, double and multiline edit exist already.

You can check here for further details on this class: http://doc.qt.io/qt-5/qinputdialog.html

Sign up to request clarification or add additional context in comments.

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.