diff options
author | Alexis Menard <alexis.menard@nokia.com> | 2009-04-21 08:17:56 (GMT) |
---|---|---|
committer | Alexis Menard <alexis.menard@nokia.com> | 2009-04-21 08:21:23 (GMT) |
commit | b108e0479c6ec872ab767b8b81420b28ca1886cf (patch) | |
tree | f61d0d4b9147d87debd8685a4b76ea7674493e57 /src/gui/dialogs/qsidebar_p.h | |
parent | 292a37301950a64f211e3a2909ff64884b73e1cc (diff) | |
download | Qt-b108e0479c6ec872ab767b8b81420b28ca1886cf.zip Qt-b108e0479c6ec872ab767b8b81420b28ca1886cf.tar.gz Qt-b108e0479c6ec872ab767b8b81420b28ca1886cf.tar.bz2 |
There is no way to delete a invalid entry in the sidebar of QFileDialog.
We can't remove an item in the sidebar if the bookmark is not valid
(i.e. link to a non existing directory). ItemViews doesn't allow you
to have disabled items and to select them at the same time, so i have
implemented a delegate that paint in gray if the bookmark is invalid.
So you can click on it and delete it.
Task-number: 251341
Reviewed-by: jasplin
Diffstat (limited to 'src/gui/dialogs/qsidebar_p.h')
-rw-r--r-- | src/gui/dialogs/qsidebar_p.h | 13 |
1 files changed, 12 insertions, 1 deletions
diff --git a/src/gui/dialogs/qsidebar_p.h b/src/gui/dialogs/qsidebar_p.h index ecbbb37..56fd6d4 100644 --- a/src/gui/dialogs/qsidebar_p.h +++ b/src/gui/dialogs/qsidebar_p.h @@ -55,6 +55,7 @@ #include <qlistwidget.h> #include <qstandarditemmodel.h> +#include <qstyleditemdelegate.h> #include <qurl.h> #ifndef QT_NO_FILEDIALOG @@ -62,13 +63,23 @@ QT_BEGIN_NAMESPACE class QFileSystemModel; + +class QSideBarDelegate : public QStyledItemDelegate +{ + public: + QSideBarDelegate(QWidget *parent = 0) : QStyledItemDelegate(parent) {} + void initStyleOption(QStyleOptionViewItem *option, + const QModelIndex &index) const; +}; + class Q_AUTOTEST_EXPORT QUrlModel : public QStandardItemModel { Q_OBJECT public: enum Roles { - UrlRole = Qt::UserRole + 1 + UrlRole = Qt::UserRole + 1, + EnabledRole = Qt::UserRole + 2 }; QUrlModel(QObject *parent = 0); |