Krish
6th March 2008, 10:17
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"
"Please enter valid data.", QMessageBox::Ok, 0 );
Now from this small client-server example (http://doc.trolltech.com/3.3/clientserver-example.html) you might be familiar with this: -
QString str = ts.readLine();
emit logText( tr("Read: '%1'\n").arg(str) );
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"
"Please enter valid data.", QMessageBox::Ok, 0 );
but i dont know how to or where to insert this
.arg(inpuLineEdit->text()) 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.:)
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"
"Please enter valid data.", QMessageBox::Ok, 0 );
Now from this small client-server example (http://doc.trolltech.com/3.3/clientserver-example.html) you might be familiar with this: -
QString str = ts.readLine();
emit logText( tr("Read: '%1'\n").arg(str) );
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"
"Please enter valid data.", QMessageBox::Ok, 0 );
but i dont know how to or where to insert this
.arg(inpuLineEdit->text()) 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.:)