From 31bc791cb48e110db8f7b994931c1879974168a1 Mon Sep 17 00:00:00 2001 From: Arno Date: Sun, 31 Oct 2010 08:26:07 +0100 Subject: Added ".." entry to FileView Show ".." entry in FileView and make it go to the parent directory. Had to work around QT Bug 14760: NoDot doesn't work so the "." entry has to be filtered in filterAcceptsRow() --- filesystemwidget.cpp | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) (limited to 'filesystemwidget.cpp') diff --git a/filesystemwidget.cpp b/filesystemwidget.cpp index 67facb9..52aede8 100644 --- a/filesystemwidget.cpp +++ b/filesystemwidget.cpp @@ -35,7 +35,7 @@ FilesystemWidget::FilesystemWidget(QWidget *parent) : QWidget(parent) { mModel = new QFileSystemModel; mModel->setRootPath("/"); - mModel->setFilter(QDir::AllEntries | QDir::NoDotAndDotDot); + mModel->setFilter(QDir::AllEntries | QDir::NoDot); mModel->setReadOnly(false); SheMovIconProvider *p = new SheMovIconProvider; mModel->setIconProvider(p); @@ -134,6 +134,10 @@ void FilesystemWidget::directoryEdited(){ void FilesystemWidget::fileViewActivated(const QModelIndex &idx){ QModelIndex real = mFileProxy->mapToSource(idx); if(mModel->isDir(real)){ + if(idx.data().toString() == ".."){ + parentDir(); + return; + } fileView()->selectionModel()->select(idx, QItemSelectionModel::Deselect); mDirView->setCurrentIndex(mDirProxy->mapFromSource(real)); return; -- cgit v1.2.3-70-g09d2