pgLab/pglab/PgLabItemDelegate.h
eelke 3ac1d21728 Implemented a custom delegate that does the samework as the BaseTableModel class did.
While this might seem to duplicate behaviour I believe having this code in a delegate
is a better solution.
- the logic in BaseTableModel is view logic not model logic
- letting the custom delegate determine the formatting is much more efficient
  then letting the default delegate do many virtual calls to detemine how the
  model wants it formatted.
2018-01-15 12:21:24 +01:00

18 lines
469 B
C++

#ifndef PGLABITEMDELEGATE_H
#define PGLABITEMDELEGATE_H
#include <QStyledItemDelegate>
class PgLabItemDelegate : public QStyledItemDelegate
{
public:
PgLabItemDelegate(QObject *parent = nullptr);
virtual void paint(QPainter *painter, const QStyleOptionViewItem &option, const QModelIndex &index) const override;
protected:
virtual void initStyleOption(QStyleOptionViewItem *option, const QModelIndex &index) const override;
};
#endif // PGLABITEMDELEGATE_H