diff options
author | Arno <am@disconnect.de> | 2010-12-05 08:29:05 +0100 |
---|---|---|
committer | Arno <am@disconnect.de> | 2010-12-05 08:29:05 +0100 |
commit | 609e8d6f4ae179243d6f258205701561d94500f5 (patch) | |
tree | 057b5c21086d984c05b9d5e50cf5be59e167b5e6 /filestreemodel.cpp | |
parent | d1837c9c92c9f38a464f0473001db4e9a57d44e7 (diff) | |
download | SheMov-609e8d6f4ae179243d6f258205701561d94500f5.tar.gz SheMov-609e8d6f4ae179243d6f258205701561d94500f5.tar.bz2 SheMov-609e8d6f4ae179243d6f258205701561d94500f5.zip |
Selectable columns in FilesTreeView
Made columns shown in FilesTreeView selectable. Also, the order of
columns is saved and restored.
This was a difficult one. I even had to make a debug build of qt. But I
fixed a serious bug in FilesTreeModel::modeName: don't access the Hash
if modeName == -1.
Diffstat (limited to 'filestreemodel.cpp')
-rw-r--r-- | filestreemodel.cpp | 16 |
1 files changed, 15 insertions, 1 deletions
diff --git a/filestreemodel.cpp b/filestreemodel.cpp index 35ae8bc..f47f8c3 100644 --- a/filestreemodel.cpp +++ b/filestreemodel.cpp @@ -16,6 +16,7 @@ #include <QDataStream> #include <QDesktopServices> #include <QDir> +#include <QFont> #include "filestreemodel.h" #include "smtreeitem.h" @@ -74,7 +75,7 @@ FilesTreeModel::~FilesTreeModel(){ const QString FilesTreeModel::modeName(int mode) const{ if(mode == -1){ - return mModeNames.value(mMode); + return QString(); } return mModeNames.value(mode); } @@ -139,6 +140,14 @@ QVariant FilesTreeModel::data(const QModelIndex &index, int role) const{ } return item->data(Quality); } + if(index.column() == FileType){ + return mFileTypes.value(item->data(FileType).toInt()); + } + if(index.column() == FullPath){ + if(item->data(DvdNo).toInt() > 0){ + return QString("(not available)"); + } + } return item->data(index.column()); } if(role == Qt::ToolTipRole){ @@ -185,6 +194,11 @@ QVariant FilesTreeModel::data(const QModelIndex &index, int role) const{ return QColor(Qt::green); } } + if(role == Qt::FontRole){ + if(index.column() == Md5Sum){ + return QFont("courier"); + } + } if(role == FileNameRole){ return item->data(FileName); } |