| Line |
Branch |
Decision |
Call |
Exec |
Source |
| 1 |
|
|
|
|
#ifndef CHRYSALIS_BASEDELEGATE_H |
| 2 |
|
|
|
|
#define CHRYSALIS_BASEDELEGATE_H |
| 3 |
|
|
|
|
|
| 4 |
|
|
|
|
#include <QStyledItemDelegate> |
| 5 |
|
|
|
|
|
| 6 |
|
|
|
|
namespace CLO3D::UI { |
| 7 |
|
|
|
|
template<typename W, typename C> |
| 8 |
|
|
|
|
requires std::is_base_of_v<QWidget, W> |
| 9 |
|
|
|
|
class BaseDelegate: public QStyledItemDelegate { |
| 10 |
|
|
|
|
public: |
| 11 |
|
|
0/6
✗ Call 0 not invoked.
✗ Call 1 not invoked.
✗ Call 2 not invoked.
✗ Call 3 not invoked.
✗ Call 4 not invoked.
✗ Call 5 not invoked.
|
✗ |
explicit BaseDelegate(QObject* parent): QStyledItemDelegate(parent) {} |
| 12 |
|
|
|
|
|
| 13 |
|
|
|
✗ |
QSize sizeHint(const QStyleOptionViewItem& option, const QModelIndex& index) const override { |
| 14 |
|
|
0/13
✗ Call 2 not invoked.
✗ Call 5 not invoked.
✗ Call 6 not invoked.
✗ Call 9 not invoked.
✗ Call 10 not invoked.
✗ Call 11 not invoked.
✗ Call 12 not invoked.
✗ Call 13 not invoked.
✗ Call 14 not invoked.
✗ Call 15 not invoked.
✗ Call 16 not invoked.
✗ Call 17 not invoked.
✗ Call 20 not invoked.
|
✗ |
static int height = W().height(); |
| 15 |
|
|
0/3
✗ Call 0 not invoked.
✗ Call 1 not invoked.
✗ Call 2 not invoked.
|
✗ |
return {0, height}; |
| 16 |
|
|
|
|
} |
| 17 |
|
|
|
✗ |
void updateEditorGeometry(QWidget* editor, const QStyleOptionViewItem& option, const QModelIndex& index) const override { |
| 18 |
|
|
0/15
✗ Call 2 not invoked.
✗ Call 5 not invoked.
✗ Call 6 not invoked.
✗ Call 7 not invoked.
✗ Call 8 not invoked.
✗ Call 9 not invoked.
✗ Call 10 not invoked.
✗ Call 11 not invoked.
✗ Call 12 not invoked.
✗ Call 15 not invoked.
✗ Call 16 not invoked.
✗ Call 17 not invoked.
✗ Call 18 not invoked.
✗ Call 19 not invoked.
✗ Call 22 not invoked.
|
✗ |
static int height = editor->sizeHint().height(); |
| 19 |
|
|
0/12
✗ Call 0 not invoked.
✗ Call 1 not invoked.
✗ Call 2 not invoked.
✗ Call 3 not invoked.
✗ Call 4 not invoked.
✗ Call 5 not invoked.
✗ Call 6 not invoked.
✗ Call 7 not invoked.
✗ Call 8 not invoked.
✗ Call 9 not invoked.
✗ Call 10 not invoked.
✗ Call 11 not invoked.
|
✗ |
const int y = option.rect.y() + (option.rect.height() - height) / 2; |
| 20 |
|
|
0/16
✗ Call 0 not invoked.
✗ Call 1 not invoked.
✗ Call 2 not invoked.
✗ Call 3 not invoked.
✗ Call 4 not invoked.
✗ Call 5 not invoked.
✗ Call 6 not invoked.
✗ Call 7 not invoked.
✗ Call 8 not invoked.
✗ Call 9 not invoked.
✗ Call 10 not invoked.
✗ Call 11 not invoked.
✗ Call 12 not invoked.
✗ Call 13 not invoked.
✗ Call 14 not invoked.
✗ Call 15 not invoked.
|
✗ |
editor->setGeometry(option.rect.x(), y, option.rect.width(), height); |
| 21 |
|
|
|
✗ |
} |
| 22 |
|
|
|
|
|
| 23 |
|
|
|
✗ |
void setEditorData(QWidget* editor, const QModelIndex& index) const override { |
| 24 |
|
|
0/13
✗ Call 0 not invoked.
✗ Call 1 not invoked.
✗ Call 2 not invoked.
✗ Call 3 not invoked.
✗ Call 4 not invoked.
✗ Call 5 not invoked.
✗ Call 8 not invoked.
✗ Call 9 not invoked.
✗ Call 12 not invoked.
✗ Call 15 not invoked.
✗ Call 16 not invoked.
✗ Call 17 not invoked.
✗ Call 18 not invoked.
|
✗ |
qobject_cast<W*>(editor)->set(index.data(Qt::UserRole).value<C*>()); |
| 25 |
|
|
|
✗ |
} |
| 26 |
|
|
|
✗ |
QWidget* createEditor(QWidget* parent, const QStyleOptionViewItem& option, const QModelIndex& index) const override { |
| 27 |
|
|
0/4
✗ Call 0 not invoked.
✗ Call 1 not invoked.
✗ Call 2 not invoked.
✗ Call 7 not invoked.
|
✗ |
return new W(parent); |
| 28 |
|
|
|
|
} |
| 29 |
|
|
|
|
}; |
| 30 |
|
|
|
|
} |
| 31 |
|
|
|
|
|
| 32 |
|
|
|
|
#endif //CHRYSALIS_BASEDELEGATE_H |
| 33 |
|
|
|
|
|