- training_area_telegrams.cpp: Fixed QJsonObject initializer syntax (Qt6 requires {{}} not ({}))
- training_area_telegrams.cpp: Fixed fromJson() methods to access m_* members directly
- training_area_telegrams.cpp: Fixed brace mismatches in multiple toJson() methods
- training_area_telegrams.h: Changed Header struct to public members for consistency
- tx_mixin.cpp: Fixed getEquipmentNumber() template for direct member access
- lts_coordinate.cpp: Added missing #include <iomanip>
- MIGRATION_STATUS.md: Added migration progress tracking document
C++17 constraint enforced due to RTI Connext DDS 7.7.0 incompatibility with C++20+
Build status: BUILD_RTI=OFF successful (0 errors, warnings only)
Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
100 lines
2.6 KiB
C++
100 lines
2.6 KiB
C++
|
|
|
|
#include "PassiveEventContainer.h"
|
|
|
|
#include "EventGraphic.h"
|
|
#include "EventTools.h"
|
|
|
|
#include <QtGui/QBrush>
|
|
#include <QtCore/QDebug>
|
|
#include <QtGui/QGuiApplication>
|
|
#include <QtGui/QPainter>
|
|
#include <QtGui/QPen>
|
|
#include <QStyleOptionViewItem>
|
|
#include <math.h>
|
|
#include <time.h>
|
|
|
|
namespace LtsTimelineClassic
|
|
{
|
|
|
|
PassiveEventContainer::PassiveEventContainer(bool ignoreKnownRanges, QObject* parent)
|
|
: QObject(parent), m_ignoreKnownRanges(ignoreKnownRanges)
|
|
{
|
|
}
|
|
|
|
PassiveEventContainer::~PassiveEventContainer()
|
|
{
|
|
qDeleteAll(m_eventGraphicList);
|
|
}
|
|
|
|
EventGraphicList PassiveEventContainer::getEventGraphicList() const
|
|
{
|
|
return m_eventGraphicList;
|
|
}
|
|
|
|
void PassiveEventContainer::setEventList(const EventGraphicList& eventGraphicList)
|
|
{
|
|
qDeleteAll(m_eventGraphicList);
|
|
|
|
m_eventGraphicList = eventGraphicList;
|
|
}
|
|
|
|
void PassiveEventContainer::paint(QPainter* painter, const QStyleOptionViewItem& option, const LineMap& lineMap,
|
|
const QVector<Range>& knownRanges) const
|
|
{
|
|
EventTools::s_test++;
|
|
|
|
bool alternate = option.features.testFlag(QStyleOptionViewItem::ViewItemFeature::Alternate);
|
|
const QColor bg = QColor(alternate ? QRgb(0xF6D8CE) : QRgb(0xFBF2EF));
|
|
|
|
QColor cachedBg(Qt::white);
|
|
if (alternate)
|
|
cachedBg = cachedBg.darker(110);
|
|
|
|
painter->fillRect(option.rect, QBrush(bg));
|
|
|
|
int posX1 = option.rect.x();
|
|
int posX2 = option.rect.right();
|
|
int posY1 = option.rect.y();
|
|
int posY2 = option.rect.bottom();
|
|
int h = posY2 - posY1 + 1;
|
|
|
|
painter->save();
|
|
painter->setClipping(true);
|
|
painter->setClipRect(option.rect.adjusted(0, 0, 1, 1));
|
|
|
|
int eventWidth = EventTools::eventWidth();
|
|
|
|
if (m_ignoreKnownRanges)
|
|
{
|
|
painter->fillRect(QRect(posX1, posY1, posX2 - posX1, h), cachedBg);
|
|
}
|
|
else
|
|
{
|
|
for (const auto& range : knownRanges)
|
|
{
|
|
int rangeStart = EventTools::getEventPosition(range.start);
|
|
int rangeEnd = EventTools::getEventPosition(range.end);
|
|
|
|
if (rangeEnd >= posX1 && rangeStart <= posX2)
|
|
painter->fillRect(QRect(rangeStart, posY1, rangeEnd - rangeStart + eventWidth + 1, h), cachedBg);
|
|
}
|
|
}
|
|
|
|
painter->restore();
|
|
|
|
for (auto i = lineMap.constBegin(); i != lineMap.constEnd(); ++i)
|
|
{
|
|
int posX = i.key();
|
|
|
|
painter->setPen(QPen(QBrush(QGuiApplication::palette().shadow()), 1.0));
|
|
|
|
if (posX > option.rect.x() && posX < (option.rect.x() + option.rect.width()))
|
|
painter->drawLine(posX, posY1, posX, posY2);
|
|
}
|
|
|
|
EventTools::drawEvents(painter, m_eventGraphicList, option.rect.y());
|
|
}
|
|
|
|
} // namespace LtsTimelineClassic
|