27 #include <QFileDialog>
28 #include <QToolButton>
45 QCompleter* complt =
new QCompleter(
this);
46 complt->setModel(
new QDirModel(
48 QDir::AllDirs | QDir::NoDotAndDotDot,
59 QLineEdit(content, p) {
68 newVal = QFileDialog::getSaveFileName(
69 this,tr(
"select file to save to"), text());
71 QStringList list = QFileDialog::getOpenFileNames(
72 this, tr(
"select one or more file(s) to open"), text());
73 if (list.size() > 0) {
74 newVal = list.join(
";");
79 newVal = QFileDialog::getExistingDirectory(
80 this, tr(
"select directory"),text());
89 QDirModel* dirModel = qobject_cast<QDirModel*>(completer()->model());
93 QDir::AllDirs | QDir::Files | QDir::NoDotAndDotDot);
96 QDir::AllDirs | QDir::NoDotAndDotDot);
101 int h = e->size().height();
103 setContentsMargins(0, 0, h, 0);
Declaration of class DirEdit.
bool _files
look for files instead of directories
QDirEdit(QWidget *parent=0)
inherited constructor
void resizeEvent(QResizeEvent *e)
handle resize events
bool _writeFile
use saveFile dialog instead of openFile dialog
void acceptFiles(bool files=true, bool write=true)
allow files instead of directories
void _init()
set initial values
void dialogOpen(bool status)
emit status of file dialog
QToolButton * _browseButton
browse button
void fileDialog()
show open dialog and use the selected directory as entry