Search code examples
qtqt4

How to print QString in quots


I want to print the value in QSting inside Quots

QString data = "Hello";
QMessageBox::warning(NULL, "Job", "Already data" + data+ " exist");

I want the message to be :- Already data "Hello" exist


Solution

  • you most use backslash before quots

    Here's an example of how you'd use this feature:

    QMessageBox::warning(NULL, "Job", "Already data\"" + data+ "\" exist");