Files
xtree.old.ng/src/items/xqitemdelegate.h

59 lines
2.1 KiB
C
Raw Normal View History

2025-08-05 22:39:41 +02:00
/***************************************************************************
source::worx xtree
Copyright © 2024-2025 c.holzheuer
christoph.holzheuer@gmail.com
This program is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation; either version 2 of the License, or
(at your option) any later version.
***************************************************************************/
#ifndef XQITEMDELEGATE_H
#define XQITEMDELEGATE_H
#include <QStyledItemDelegate>
#include <xqappdata.h>
class XQItem;
2025-08-07 03:11:56 +02:00
class XQTreeTable;
class XQViewModel;
2025-08-05 22:39:41 +02:00
/**
* @brief A specialized QItemDelegate class to draw different XQItem styles.
*/
class XQItemDelegate : public QStyledItemDelegate
{
Q_OBJECT
public:
2025-08-07 03:11:56 +02:00
explicit XQItemDelegate(XQViewModel& modelView);
2025-08-05 22:39:41 +02:00
2025-08-07 10:39:42 +02:00
XQTreeTable* treeTable() const;
2025-08-05 22:39:41 +02:00
XQItem& xqItemFromIndex( const QModelIndex& index ) const;
void paint(QPainter *painter, const QStyleOptionViewItem &option, const QModelIndex &index) const override;
QSize sizeHint(const QStyleOptionViewItem &option, const QModelIndex &index) const override;
QWidget* createEditor(QWidget *parent, const QStyleOptionViewItem &option, const QModelIndex &index) const override;
void setEditorData(QWidget *editor, const QModelIndex &index) const override;
void setModelData(QWidget *editor, QAbstractItemModel *model, const QModelIndex &index) const override;
void updateEditorGeometry(QWidget *editor, const QStyleOptionViewItem &option, const QModelIndex &index) const override;
protected:
void drawHeaderStyle(QPainter *painter, const QStyleOptionViewItem &option, const QModelIndex &index) const;
void drawProgressBarStyle(QPainter *painter, const QStyleOptionViewItem &option, const QModelIndex &index) const;
void drawComboBoxStyle(QPainter *painter, const QStyleOptionViewItem &option, const QModelIndex &index) const;
void drawSpinBoxStyle(QPainter *painter, const QStyleOptionViewItem &option, const QModelIndex &index) const;
2025-08-07 03:11:56 +02:00
XQViewModel& _modelView;
2025-08-05 22:39:41 +02:00
};
#endif // XQITEMDELEGATE_H