| 1 | // For license of this file, see <project-root-folder>/LICENSE.md. |
| 2 | |
| 3 | #ifndef STYLEDITEMDELEGATEWITHOUTFOCUS_H |
| 4 | #define STYLEDITEMDELEGATEWITHOUTFOCUS_H |
| 5 | |
| 6 | #include <QStyledItemDelegate> |
| 7 | |
| 8 | #if QT_VERSION_MAJOR <= 5 |
| 9 | #include <QStyleOptionViewItemV4> |
| 10 | #else |
| 11 | #include <QStyleOptionViewItem> |
| 12 | #endif |
| 13 | |
| 14 | class StyledItemDelegateWithoutFocus : public QStyledItemDelegate { |
| 15 | Q_OBJECT |
| 16 | |
| 17 | public: |
| 18 | explicit StyledItemDelegateWithoutFocus(int height_row, int padding_row, QObject* parent = nullptr); |
| 19 | |
| 20 | virtual void paint(QPainter* painter, const QStyleOptionViewItem& option, const QModelIndex& index) const; |
| 21 | virtual QSize sizeHint(const QStyleOptionViewItem& option, const QModelIndex& index) const; |
| 22 | |
| 23 | private: |
| 24 | int m_rowHeight; |
| 25 | int m_rowPadding; |
| 26 | }; |
| 27 | |
| 28 | #endif // STYLEDITEMDELEGATEWITHOUTFOCUS_H |