c++ - Is is possible to pass a QString to a QMessageBox? -


i'm working on qt application user enter information several qlineedits. click son submit button. qmessagebox appear asking if confirm information(ok) or cancel. want messagebox show information entered can check see if it's accurate. here's code far:

qstring infostr = (ui->lastedit->text() + ", " + ui->firstedit->text() + "\n" + ui->addressedit->text() + "\n" + ui->cityedit->text() + ", " + ui->statebox->currenttext() + " " + ui->zipedit->text());   switch( qmessagebox::question(                            this,                            tr("confirm"),                         tr(infostr&),                             qmessagebox::ok |                            qmessagebox::cancel ))                {                  case qmessagebox::ok:                    qmessagebox::information(this, "ok", "confirmed");                    break;                  case qmessagebox::cancel:                    //cancel                    break;                } 

i'm new qt , c++. suggestions appreciated.

you should read proper book on c++. this, need pass string argument, translating not want happen, , & syntax error:

qmessagebox::question(     this, tr("confirm"), infostr, qmessagebox::ok | qmessagebox::cancel ); 

Comments

Popular posts from this blog

sql - text truncated using perl DBI insert -

c++ - Is it possible to compile a VST on linux? -

php - Pass object by reference or value -