Hello! Friends,
I have QLineEdit in my designer form and QMessageBox::information() widget to show error's as: -
QMessageBox::information( this,
"Invalid Data Entered",
"You have entered invalid data\n" "Valid Range is 1 - 1000\n"
QMessageBox::information( this, "Invalid Data Entered", "You have entered invalid data\n"
"Valid Range is 1 - 1000\n"
"Please enter valid data.", QMessageBox::Ok, 0 );
To copy to clipboard, switch view to plain text mode
Now from this small client-server example you might be familiar with this: -
emit logText( tr("Read: '%1'\n").arg(str) );
QString str = ts.readLine();
emit logText( tr("Read: '%1'\n").arg(str) );
To copy to clipboard, switch view to plain text mode
concept where logText() is having a QString-->"Read: '%1' ". In which '%1' is nothing but the 'str' i.e. readLine() which is passed to it.
So just as in this example where the string from outside is displayed, can i use same concept to show string in QMessageBox taken from LineEdit->text()?
To change the above QMessage::information(), i tired this: -
QMessageBox::information( this,
"Invalid Data Entered",
"You have entered" '%1' "which is an invalid data\n" "Valid Range is 1 - 1000\n"
QMessageBox::information( this, "Invalid Data Entered","You have entered" '%1' "which is an invalid data\n"
"Valid Range is 1 - 1000\n"
"Please enter valid data.", QMessageBox::Ok, 0 );
To copy to clipboard, switch view to plain text mode
but i dont know how to or where to insert this
.arg(inpuLineEdit->text())
.arg(inpuLineEdit->text())
To copy to clipboard, switch view to plain text mode
statement so that it will take the input & display it in QMessageBox.
Can anyone please help me out in this? I will be grateful.
Thanks in advance.
Bookmarks