Skip to content

Commit

Permalink
GUI: Add completer to directory selector
Browse files Browse the repository at this point in the history
Directory selector now suggest directory names

Probably similar fixes should be applied to FileChooser in File mode

Signed-off-by: Przemo Firszt <przemo@firszt.eu>
  • Loading branch information
PrzemoF authored and wwmayer committed Oct 19, 2015
1 parent 8c93b29 commit 0b31017
Show file tree
Hide file tree
Showing 2 changed files with 13 additions and 1 deletion.
10 changes: 9 additions & 1 deletion src/Gui/FileDialog.cpp
Expand Up @@ -25,6 +25,7 @@
#ifndef _PreComp_
# include <QApplication>
# include <QButtonGroup>
# include <QCompleter>
# include <QComboBox>
# include <QDesktopServices>
# include <QGridLayout>
Expand Down Expand Up @@ -521,7 +522,14 @@ FileChooser::FileChooser ( QWidget * parent )
layout->setMargin( 0 );
layout->setSpacing( 6 );

lineEdit = new QLineEdit( this );
lineEdit = new QLineEdit ( this );
completer = new QCompleter ( this );
completer->setMaxVisibleItems( 12 );
fs_model = new QFileSystemModel( completer );
fs_model->setRootPath(QString::fromUtf8(""));
completer->setModel( fs_model );
lineEdit->setCompleter( completer );

layout->addWidget( lineEdit );

connect(lineEdit, SIGNAL(textChanged(const QString &)),
Expand Down
4 changes: 4 additions & 0 deletions src/Gui/FileDialog.h
Expand Up @@ -26,6 +26,8 @@

#include <QFileDialog>
#include <QFileIconProvider>
#include <QFileSystemModel>
#include <QCompleter>

class QButtonGroup;
class QGridLayout;
Expand Down Expand Up @@ -177,6 +179,8 @@ private Q_SLOTS:

private:
QLineEdit *lineEdit;
QCompleter *completer;
QFileSystemModel *fs_model;
QPushButton *button;
Mode md;
QString _filter;
Expand Down

0 comments on commit 0b31017

Please sign in to comment.