Unsolved QTScript and getOpenFileNames
-
Hi Colleagues,
maybe someone can help. I have to implemented a file open Dialog from a QTScript Script. Let us seee a Code Snippet:
var lastOpenFileDir = "F:/Developement/D-A/Datas/Polyline Reduction";
var appWin = EAction.getMainWindow();
var strFilters = "DA 2017 DXF Files (dxflib) (.dxf);;All CAD Files (Teigha) (.dxf *.dwg *.dwt *.dxb *.dgn .dwf);;SVG Files (.svg)"// var strSelectedFilter = "Yo ho, and a bottle of rum for that";
// var strSelectedFilter = ['a','b','c'];
// var strSelectedFilter = { str : "" };// var strS = "test";
// var strSelectedFilter = new String(strS);var FileNames = QFileDialog.getOpenFileNames(appWin, qsTr("Open Drawing(s)"), lastOpenFileDir, strFilters, strSelectedFilter);
Everything works fine, but I can't get the strSelectedFilter-String with the selected Filter from the FileOpen Dialog. Now you want tell me that Strings in Javascript immutable. Yes, I know, but QT generate two function calls for this function with 5 and 6 Arguments:
if(context->argumentCount() == 5)
{
QWidget _q_arg0 = qscriptvalue_cast<QWidget>(context->argument(0));
QString _q_arg1 = context->argument(1).toString();
QString _q_arg2 = context->argument(2).toString();
QString _q_arg3 = context->argument(3).toString();
QString _q_arg4 = qscriptvalue_cast<QString>(context->argument(4));
QString _q_result = QFileDialog::getOpenFileName(_q_arg0, _q_arg1, _q_arg2, _q_arg3, _q_arg4);return QScriptValue(context->engine(), _q_result);
}
if(context->argumentCount() == 6)
{
QWidget _q_arg0 = qscriptvalue_cast<QWidget>(context->argument(0));
QString _q_arg1 = context->argument(1).toString();
QString _q_arg2 = context->argument(2).toString();
QString _q_arg3 = context->argument(3).toString();
QString _q_arg4 = qscriptvalue_cast<QString>(context->argument(4));
QFlagsQFileDialog::Option _q_arg5 = qscriptvalue_cast<QFlagsQFileDialog::Option >(context->argument(5));
QString _q_result = QFileDialog::getOpenFileName(_q_arg0, _q_arg1, _q_arg2, _q_arg3, _q_arg4, _q_arg5);
return QScriptValue(context->engine(), _q_result);
}The wizzard argument is the _q_arg4. I try many, really many ways to get the result of this call. If someone ask me I answer that I think it's a bug and their is no way to get the data back in this way. But why QT generates this wrapper ? So I want ask in this forum. Is there anyone who knows how I have to declare, define a variable in Javascript that I can get this value ? I programming Javascript since 24 hours, and be sure. I don't like it.
Thanks a lot, for every answer
John Doe