Initial commit
This commit is contained in:
commit
b7d90b9afe
16245 files changed
+3396666
No files matched your search
+68
@@ -0,0 +1,68 @@
|
||||
/**
|
||||
* @RDE_HEADER@
|
||||
* manages each row in view which type of container is suitable for current situation
|
||||
* $Id$
|
||||
* $HeadURL$
|
||||
* $Author$
|
||||
* Created by Mike Wille, SLSE, 2014-10-01
|
||||
*/
|
||||
|
||||
#include "EventDelegate.h"
|
||||
#include "PassiveEventContainer.h"
|
||||
|
||||
#include <QModelIndex>
|
||||
|
||||
#include <QDebug>
|
||||
|
||||
|
||||
namespace LtsTimelineClassic
|
||||
{
|
||||
|
||||
EventDelegate::EventDelegate(QWidget *parent)
|
||||
: QStyledItemDelegate(parent)
|
||||
, m_liveTime(0)
|
||||
{
|
||||
|
||||
}
|
||||
|
||||
QSize EventDelegate::sizeHint(const QStyleOptionViewItem &option, const QModelIndex &index) const
|
||||
{
|
||||
(void)option;
|
||||
(void)index;
|
||||
|
||||
return QSize(50, 20);
|
||||
}
|
||||
|
||||
void EventDelegate::setKnownRanges(const QVector<Range> &knownRanges)
|
||||
{
|
||||
m_knownRanges = knownRanges;
|
||||
}
|
||||
|
||||
void EventDelegate::setLiveTime(qint64 liveTime)
|
||||
{
|
||||
m_liveTime = liveTime;
|
||||
}
|
||||
|
||||
void EventDelegate::slotAddLine(int posX, qint64 time) // add posX to a list, so that the view can draw them on itself
|
||||
{
|
||||
m_lineMap.insert(posX, time);
|
||||
}
|
||||
|
||||
void EventDelegate::slotResetLineList()
|
||||
{
|
||||
m_lineMap.clear();
|
||||
}
|
||||
|
||||
void EventDelegate::paint(QPainter *painter, const QStyleOptionViewItem &option, const QModelIndex &index) const
|
||||
{
|
||||
if (index.data().canConvert<PassiveEventContainer *>())
|
||||
{
|
||||
PassiveEventContainer *passiveEventContainer = qvariant_cast<PassiveEventContainer *>(index.data());
|
||||
|
||||
passiveEventContainer->paint(painter, option, m_lineMap, m_knownRanges);
|
||||
}
|
||||
else
|
||||
QStyledItemDelegate::paint(painter, option, index);
|
||||
}
|
||||
|
||||
} // namespace LtsTimelineClassic
|
||||
Reference in new issue
Block a user