-
Notifications
You must be signed in to change notification settings - Fork 5
Expand file tree
/
Copy pathiconsetdelegate.h
More file actions
35 lines (31 loc) · 1.13 KB
/
iconsetdelegate.h
File metadata and controls
35 lines (31 loc) · 1.13 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
#ifndef ICONSETDELEGATE_H
#define ICONSETDELEGATE_H
#include <QHash>
#include <QPainter>
#include <QModelIndex>
#include <QItemDelegate>
#include "utilsexport.h"
#include "iconstorage.h"
enum IconsetDataRoles {
IDR_STORAGE_NAME = Qt::UserRole,
IDR_STORAGE_SUBDIR,
IDR_ICON_ROWS,
IDR_HIDE_ICONSET_NAME
};
class UTILS_EXPORT IconsetDelegate :
public QItemDelegate
{
public:
IconsetDelegate(QObject *AParent = NULL);
virtual ~IconsetDelegate();
virtual void paint(QPainter *APainter, const QStyleOptionViewItem &AOption, const QModelIndex &AIndex) const;
virtual QSize sizeHint(const QStyleOptionViewItem &AOption, const QModelIndex &AIndex) const;
protected:
virtual void drawBackground(QPainter *APainter, const QStyleOptionViewItem &AOption, const QModelIndex &AIndex) const;
virtual bool editorEvent(QEvent *AEvent, QAbstractItemModel *AModel, const QStyleOptionViewItem &AOption, const QModelIndex &AIndex);
protected:
void uniqueKeys(IconStorage *AStorage, QList<QString> &AKeys) const;
private:
mutable QHash<QString, QHash<QString, IconStorage *> > FStorages;
};
#endif // ICONSETDELEGATE_H