diff options
-rw-r--r-- | qt-ui/modeldelegates.cpp | 18 | ||||
-rw-r--r-- | qt-ui/modeldelegates.h | 9 |
2 files changed, 27 insertions, 0 deletions
diff --git a/qt-ui/modeldelegates.cpp b/qt-ui/modeldelegates.cpp index 827e6ab27..8425d03c9 100644 --- a/qt-ui/modeldelegates.cpp +++ b/qt-ui/modeldelegates.cpp @@ -476,3 +476,21 @@ QSize HTMLDelegate::sizeHint ( const QStyleOptionViewItem & option, const QModel doc.setTextWidth(options.rect.width()); return QSize(doc.idealWidth(), doc.size().height()); } + +LocationFilterDelegate::LocationFilterDelegate(QObject *parent) +{ +} + +void LocationFilterDelegate::paint(QPainter *painter, const QStyleOptionViewItem &option, const QModelIndex &index) const +{ + painter->save(); + painter->drawText(QPoint(0, 0), index.data().toString()); + painter->restore(); +} + +QSize LocationFilterDelegate::sizeHint(const QStyleOptionViewItem &option, const QModelIndex &index) const +{ + QSize size; + size.setWidth(option.rect.width()); + size.setHeight(20); +} diff --git a/qt-ui/modeldelegates.h b/qt-ui/modeldelegates.h index f501c5214..95701775a 100644 --- a/qt-ui/modeldelegates.h +++ b/qt-ui/modeldelegates.h @@ -129,4 +129,13 @@ public: virtual void paint(QPainter *painter, const QStyleOptionViewItem &option, const QModelIndex &index) const; virtual QSize sizeHint(const QStyleOptionViewItem &option, const QModelIndex &index) const; }; + +class LocationFilterDelegate : public QStyledItemDelegate { + Q_OBJECT +public: + LocationFilterDelegate(QObject *parent = 0); + void paint(QPainter *painter, const QStyleOptionViewItem &option, const QModelIndex &index) const Q_DECL_OVERRIDE; + QSize sizeHint(const QStyleOptionViewItem &option, const QModelIndex &index) const Q_DECL_OVERRIDE; +}; + #endif // MODELDELEGATES_H |