How to set selected filter on QFileDialog ?

How to set selected filter on QFileDialog ?

Asked on January 7, 2019 in Qt.
Add Comment


  • 2 Answer(s)

    Select the filter on QFileDialog:

    QString selfilter = tr("JPEG (*.jpg *.jpeg)");
    QString fileName = QFileDialog::getOpenFileName(
            this,
            title,
            directory,
            tr("All files (*.*);;JPEG (*.jpg *.jpeg);;TIFF (*.tif)" ),
            &selfilter
    );
    

    Just try this link docs   are the bit vague

     

     

     

     

    Answered on January 7, 2019.
    Add Comment

    QString selfilter = tr(“JPEG (*.jpg *.jpeg)”);
    QString fileName = QFileDialog::getOpenFileName(
    this,
    title
    ,
    directory
    ,
    tr
    (“All files (*.*);;JPEG (*.jpg *.jpeg);;TIFF (*.tif)” ),
    &selfilter
    );

    Answered on March 5, 2019.
    Add Comment


  • Your Answer

    By posting your answer, you agree to the privacy policy and terms of service.