How to insert double quotes in the contents of a QString?
-
I have an option in my GUI that I select a program I want to open and keep his path into a QString.
To open it I need to insert double quotes because the prompt only opens so.
How to insert double quotes in a QString?
@ QProcess pr1;
QStringList argss;
argss << "D:\example\progam1\temp\esseaqui" << "-P" << "pythoon2.py";
pr1.start(_version249b, argss); //_version249b is the string that I want to insert double quotes in your content@
-
Hi,
Do you mean double quotes or backslashes ?
-
" and \\ to have a a double quote and a double backslash in your string.
-
@
QString word = "outside..."inside double quote"...outside";
@
or better more:
@
QString word = tr("outside..."inside my double quotes"...outside");
@
(tr() serve after for translation of everything string style inside tr() ).in your situation:
@
QProcess pr1;
QStringList argss;
argss << ""D:\example\progam1\temp\esseaqui"" << ""-P"" << ""pythoon2.py"";
pr1.start(_version249b, argss);
@there is also some other way to add these doubles quote automatically after include datas in you QStringList... with QString::insert method at render time, or, for have it definitly, between the entri and the render by a foreach loop with this insertion inside... there is many ideas for do it...
depend of what you really need.