Files
qt5-legatus-legacy/Lts/Common/LtsTimeline/item_delegate.h
T
2026-08-13 18:33:10 +02:00

60 lines
1.6 KiB
C++
Executable File

/**
* @RDE_HEADER@
* manages each row in view which type of container is suitable for current situation
* $Id: ItemDelegate.h 49755 2020-02-04 08:44:47Z ehrlicher $
* $HeadURL: svn://192.168.133.21/TDS/branches/product/features/hotline/Lts/Common/LtsEventTimeline/ItemDelegate.h $
* $Author: ehrlicher $
* Created by Mike Wille, SLSE, 2014-10-01
*/
#pragma once
#include <LtsTimeline/ltstimeline_export.h>
#include <QStyledItemDelegate>
#include <QPushButton>
namespace LtsTimeline
{
class TimelineView;
class TimelineModel;
class LTSTIMELINE_EXPORT ItemDelegate : public QStyledItemDelegate
{
Q_OBJECT
public:
ItemDelegate(TimelineView *parent = nullptr);
~ItemDelegate();
/**
* @brief minimum size a row / column should take
* @param option style options of coherant row & column
* @param index which row & column is affected
* @return
*/
QSize sizeHint(const QStyleOptionViewItem &option = {}, const QModelIndex &index = {}) const override;
/**
* @brief paintDragItems paints dragged items over the view
* @param painter painter to draw all dragged items on the view
*/
virtual void paintDragItems(QPainter *painter) const;
virtual void paintTrackButtons(QPainter *painter, const QStyleOptionViewItem &option, const QModelIndex &index) const;
protected:
virtual void paint(QPainter *painter, const QStyleOptionViewItem &option, const QModelIndex &index) const override;
protected:
TimelineView *m_view { nullptr };
QPushButton *m_pushButton { nullptr };
QPushButton *m_pushButtonPressed { nullptr };
};
} // namespace LtsTimeline