This app should print only valid path args from the command line:
int main(int argc, char *argv[])
{
QApplication a(argc, argv);
QStringList args = QApplication::arguments();
foreach(QString arg, args)
{
QUrl url = QUrl::fromUserInput(arg);
if(url.isValid())
qDebug()<<url;
}
return a.exec();
}
But here is the result:
>app.exe -r 200 asf e:\path\to\something e:\path\to\something2
QUrl( "file:///D:/path/to/app.exe" )
QUrl( "-r" )
QUrl( "200" )
QUrl( "asf" )
QUrl( "file:///e:/path/to/something" )
QUrl( "file:///e:/path/to/something2" )
Clearly the new "fromUserInput" works, identifying correctly only the path
entries and adding the correct "file" schema,
but the docs say
"Returns a valid URL from a user supplied userInput string if one can be
deducted. In the case that is not possible, an invalid QUrl() is returned"
Obviously if all paths are "valid" than all should have "file", if not, isValid
should not pass them through.
Am I missing something?
MihailNaydenov
_______________________________________________
Qt4-preview-feedback mailing list
[email protected]
http://lists.trolltech.com/mailman/listinfo/qt4-preview-feedback