pgLab/pglab/PgLabItemDelegate.h

24 lines
743 B
C++

#ifndef PGLABITEMDELEGATE_H
#define PGLABITEMDELEGATE_H
#include <QStyledItemDelegate>
/** Delegate for rendering SQL data types in tableviews
*
* This delegate removes the need for the model to provide formatting information
* which in many cases solely based on the datatype so this delegate can determine
* on its own what the correct formatting is.
*/
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