Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

qt c++messageBox with input

Tags:

qt

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

like image 881
user3443063 Avatar asked Nov 01 '25 23:11

user3443063


1 Answers

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

like image 96
Hayt Avatar answered Nov 03 '25 22:11

Hayt



Donate For Us

If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!