It would be hard to create a combined directory and file dialog. Much because it would be impossible to tell if you pick a directory or just want so enter it to look for other directories or files.
It would be hard to create a combined directory and file dialog. Much because it would be impossible to tell if you pick a directory or just want so enter it to look for other directories or files.
My idee is to change to the directory by pressing Enter or clicking (Focus on the directory) and to pick a directory or a file with the Pushbutton Ok (Clickingwith the mouse on the pushbutton or pressing Enter as the focus is on the pushbutton).
You can use QDirModel to implement your own file chooser or subclass QFileDialog and change it according to your needs.
BUFileDia.hOriginally Posted by illojal
#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();
}
Bookmarks