Added tooltips showing the full path to FolderNavigationWidget.

This commit is contained in:
Robert Loehning
2010-02-03 16:52:08 +01:00
parent 40f0d4d7c3
commit 236bb0371e

View File

@@ -90,6 +90,26 @@ bool DotRemovalFilter::filterAcceptsRow(int source_row, const QModelIndex &paren
return fileName != m_dot; return fileName != m_dot;
} }
class FolderNavigationModel : public QFileSystemModel
{
public:
explicit FolderNavigationModel(QObject *parent = 0);
QVariant data(const QModelIndex &index, int role = Qt::DisplayRole) const;
};
FolderNavigationModel::FolderNavigationModel(QObject *parent) :
QFileSystemModel(parent)
{
}
QVariant FolderNavigationModel::data(const QModelIndex &index, int role) const
{
if (role == Qt::ToolTipRole)
return QDir::toNativeSeparators(QDir::cleanPath(filePath(index)));
else
return QFileSystemModel::data(index, role);
}
/*! /*!
/class FolderNavigationWidget /class FolderNavigationWidget
@@ -98,7 +118,7 @@ bool DotRemovalFilter::filterAcceptsRow(int source_row, const QModelIndex &paren
FolderNavigationWidget::FolderNavigationWidget(QWidget *parent) FolderNavigationWidget::FolderNavigationWidget(QWidget *parent)
: QWidget(parent), : QWidget(parent),
m_listView(new QListView(this)), m_listView(new QListView(this)),
m_fileSystemModel(new QFileSystemModel(this)), m_fileSystemModel(new FolderNavigationModel(this)),
m_filterModel(new DotRemovalFilter(this)), m_filterModel(new DotRemovalFilter(this)),
m_title(new QLabel(this)), m_title(new QLabel(this)),
m_autoSync(false) m_autoSync(false)