Results 1 to 5 of 5

Thread: QFileDialog: how to choice File or Directory in the same Dialog

Hybrid View

Previous Post Previous Post   Next Post Next Post
  1. #1
    Join Date
    Jan 2006
    Location
    Warsaw, Poland
    Posts
    33,368
    Thanks
    3
    Thanked 5,018 Times in 4,794 Posts
    Qt products
    Qt3 Qt4 Qt5 Qt/Embedded
    Platforms
    Unix/X11 Windows Android Maemo/MeeGo
    Wiki edits
    10

    Default Re: QFileDialog: how to choice File or Directory in the same Dialog

    You can use QDirModel to implement your own file chooser or subclass QFileDialog and change it according to your needs.

  2. #2
    Join Date
    Sep 2006
    Posts
    20
    Qt products
    Qt3 Qt4 Qt/Embedded
    Platforms
    Unix/X11 Windows

    Default Re: QFileDialog: how to choice File or Directory in the same Dialog

    Quote Originally Posted by illojal
    i found a thread where you needed QFileDialog to being able to select files and dirs and im in the exact same situation now so i wonder if you ever made such a dialog. I would be really glad if you could share it with me.
    BUFileDia.h

    #ifndef _BUFILEDIALOG_H_
    #define _BUFILEDIALOG_H_
    #include <QFileDialog>
    class BUFileDialog: public QFileDialog
    {
    public:
    BUFileDialog ( QWidget * parent, Qt::WindowFlags flags ):QFileDialog(parent,flags){}
    BUFileDialog ( QWidget * parent = 0, const QString & caption = QString(), const QString & directory = QString(), const QString & filter = QString() ):
    QFileDialog ( parent ,caption,directory,filter){}
    public slots:
    void accept ();


    };
    #endif

    BUFileDia.cpp
    #include "BUFileDialog.h"

    void BUFileDialog::accept()
    {
    QStringList files = selectedFiles();
    if (files.isEmpty())
    return;
    emit filesSelected(files);
    QDialog::accept();
    }

Similar Threads

  1. errors while installing Qt4.2 in Linux
    By nimmyj in forum Installation and Deployment
    Replies: 11
    Last Post: 13th December 2006, 11:58
  2. Replies: 4
    Last Post: 24th February 2006, 10:30
  3. create file in another directory
    By raphaelf in forum Qt Programming
    Replies: 3
    Last Post: 16th February 2006, 10:04
  4. Am I the only one with "make" error ?
    By probine in forum Installation and Deployment
    Replies: 1
    Last Post: 13th February 2006, 12:54
  5. dialog box
    By Bahar in forum Qt Programming
    Replies: 3
    Last Post: 31st January 2006, 14:52

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  
Qt is a trademark of The Qt Company.