I´m working in a program with scanning capabilities. For this work I use an ActiveX control from Pegasus. To this ActiveX control I make several dynamicCall(). All work fine , but I have find a problem.
the following code:
QList<QVariant> vars;
str2
=QInputDialog::getText(this,
"Write file´s name",
"Name: ");
vars<<str2;
str="SaveFile(QString)";
qDebug()<<str;
qDebug()<<str2;
qDebug()<<vars;
wmp->dynamicCall(str.toLatin1(),vars);
QString str;
QString str2;
QList<QVariant> vars;
str2=QInputDialog::getText(this,"Write file´s name","Name: ");
vars<<str2;
str="SaveFile(QString)";
qDebug()<<str;
qDebug()<<str2;
qDebug()<<vars;
wmp->dynamicCall(str.toLatin1(),vars);
To copy to clipboard, switch view to plain text mode
creates the folowing debugger output:
"SaveFile(QString)"
"c:\nnimagen"
"SaveFile(QString)"
"c:\nnimagen"
(QVariant(QString, "c:\nnimagen") )
To copy to clipboard, switch view to plain text mode
All is ok and the dynamicCall works fine. I can save the scanned imagen.
But this other code:
QList<QVariant> vars;
str2="c:\nnimagen.bmp";
vars<<str2;
str="SaveFile(QString)";
qDebug()<<str;
qDebug()<<str2;
qDebug()<<vars;
wmp->dynamicCall(str.toLatin1(),vars);
QString str;
QString str2;
QList<QVariant> vars;
str2="c:\nnimagen.bmp";
vars<<str2;
str="SaveFile(QString)";
qDebug()<<str;
qDebug()<<str2;
qDebug()<<vars;
wmp->dynamicCall(str.toLatin1(),vars);
To copy to clipboard, switch view to plain text mode
creates this other debugger output:
"SaveFile(QString)"
"c:
nnimagen.bmp"
nimagen.bmp") )
"SaveFile(QString)"
"c:
nnimagen.bmp"
(QVariant(QString, "c:
nimagen.bmp") )
To copy to clipboard, switch view to plain text mode
In this case the "\n"caracters (from "c:\nnimage.bmp") are taken like a escape sequence, and the dynamicCall() produces an error.
If it is supposed that QInputDialog::getText returns a QString, ¿how is it posible? ?What is the diffecence betwen str2="c:\nnimagen.bmp" and str2=QInputDialog::getText(.......).
Why this error happens?.
How I must initializates the str2 QString?
Bookmarks