[Solved]What is the data type of list<string> on c++ site?



  • Want to do some postprocessing on the FileUrls of the FileDialog
    @
    FileDialog{
    id: fileDialog

        selectMultiple: true
        nameFilters: [ "Image files (*.bmp *.jpg *.JPEG *.png *.ppm *.tiff *.xbm *.xpm)" ]
        onAccepted: {            
                fileProcess.print_strs(fileDialog.fileUrls)               
        }
    }
    

    @

    The signature of cpp site
    @
    void fileProcess::print_strs(QList<QString> const &strs)
    {
    qDebug()<<"print strs";
    for(auto const &str: strs){
    qDebug()<<"print strs : "<<str;
    }
    }
    @

    QList do not map to the type of list in qml
    which type should I use?



  • I'd say, fom the name of the variable that maybe it is not the QList that is the problem but maybe the QString. Have you tried QUrl?



  • Thanks, looks like QUrl is the correct answer



  • Whatever, the document of the FileDialog and FileDialog itself are mismatch.

    document
    @
    filePath : string
    filePaths : list<string>
    @

    But in Qt5.1RC, I have to use fileUrl or fileUrls to access the address of the files.Maybe this is because this is RC but not a formal release


Log in to reply
 

Looks like your connection to Qt Forum was lost, please wait while we try to reconnect.