I am currently using something like this:
QString text = QInputDialog::getText(this, tr("title"),"Hello World !! What goes in here", QLineEdit::Normal, QString(""), &ok);
Now I want the text in the Dialog
"Hello World !! What goes in here"
to be spread over two lines. like this
Hello World !!
What goes in here
Any suggestions on what I could do ??
Simply insert a line break:
"Hello World!!\nWhat goes in here"
The complete compileable example shows why sometimes using an application framework isn't that bad of an idea. It's no longer than a comparable command-line variant would be, assuming that you had a proper, Unicode-based standard library to start with.
#include <QApplication>
#include <QInputDialog>
int main(int argc, char *argv[])
{
QApplication a(argc, argv);
QInputDialog::getText(nullptr, "Title", "Hello World !!\nWhat goes in here");
return 0;
}
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.