Files
qt-migration-legatus/qt5-before/dlbo/Lts/Common/LtsTimelineClassic/TimelineHeaderView.cpp
T
torstenandCopilot 7173785915 Qt6 Migration: Complete migration with DDS/RTI support and build validation
Major Changes:
- Merged latest Qt5 devel content from dlbo (292 files changed, 7 new dirs)
- Consolidated forward-declarations and include folders
- Removed unneeded modules per Niklas' repo check list

Build System Fixes:
- Fixed CMake VERSION_GREATER syntax in ParticipantManagement/CMakeLists.txt
- Added VLC packages (libvlc-dev, vlc-plugin-base) to docker_build.sh
- Added PostgreSQL dev packages (libpq-dev, postgresql-server-dev-all) to Dockerfile
- Fixed locale warnings (ANSI_X3.4-1968 → C.UTF-8)
- Fixed ArcGIS SDK path warnings when BUILD_ARCGIS=OFF

Code Generation Fixes:
- Fixed IDL enum collisions (PortType→CorePortType/DdsutPortType, PdmEventType)
- Fixed Grantlee template svc_translation.cpp.grantlee:
  - Changed {{ idl_enum.name }}_def:: to {{ idl_enum.name }}::
  - Fixed .underlying() calls for C++11 scoped enums (enum class)
- Removed generated files from repo (moc_*, *_dtc.h, *_ftc.h)

Validation:
- BUILD_RTI=ON: SUCCESS
- BUILD_RTI=OFF: SUCCESS
- C++17 standard maintained for RTI 7.7 compatibility
- Ubuntu 26.04 Docker environment verified

Remaining Warnings (expected):
- BgViewer, KDChart, KDReports, Poppler-Qt6 not found (optional features)

Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
2026-09-15 18:20:26 +00:00

156 lines
4.0 KiB
C++

/**
* @RDE_HEADER@
* replaces the original header of the view - offers a user-movable position mark
* $Id$
* $HeadURL$
* $Author$
* Created by Mike Wille, SLSE, 2014-10-01
*/
#include "TimelineWidget.h"
#include "TimelineHeaderView.h"
#include <QPainter>
#include <QPainterPath>
#include <QPen>
#include <QPoint>
#include <QRect>
#include <QGuiApplication>
namespace LtsTimelineClassic
{
TimelineHeaderView::TimelineHeaderView(QWidget *parent)
: QHeaderView(Qt::Horizontal, parent)
, m_posMarkTime(0)
, m_paintingRange(rect()) // has to be reset @ slotSectionResized
, m_liveTime(0)
{
setSectionsClickable(true);
setStretchLastSection(true); // so that the whole viewport is filled with the last section (Event Section)
connect(this, &TimelineHeaderView::sectionResized,
this, &TimelineHeaderView::slotSectionResized);
// now wait for slotSectionResized (which is definitly going to be called)
}
#define GET_LOGGER NGL::NGLLoggerBootstrap::getNGLRootLogger().getNGLLogger("Timeline.HeaderView")
void TimelineHeaderView::setPosMarkTime(qint64 time)
{
m_posMarkTime = time;
refreshData(); // new value, now recalc and show on view
}
void TimelineHeaderView::setLiveTime(qint64 time)
{
m_liveTime = time;
refreshData(); // new value, now recalc and show on view
}
void TimelineHeaderView::setPosMarkPos()
{
//QRect sectionRect(0, 0, sectionSize(1), 0);
if (m_posMarkTime > 0) // must be a valid time
{
int posMarkPos = EventTools::getEventPosition(m_posMarkTime);//, sectionRect);
emit signalSetPosMarkPos(posMarkPos);
refreshData();
}
}
void TimelineHeaderView::refreshData()
{
if (EventTools::getTimelineMin() > 0 && EventTools::getTimelineMax() > 1)
{
updateSection(1);
updateSection(0); // because this section is often drawn on when position is very low
}
}
void TimelineHeaderView::slotSectionResized(int logicalIndex, int oldSize, int newSize)
{
(void)oldSize;
if (logicalIndex == 1)
m_paintingRange = QRect(0, 0, newSize, height());
refreshData();
}
void TimelineHeaderView::paintSection(QPainter *painter, const QRect &rect, int logicalIndex) const
{
painter->save(); // otherwise we can not draw.... dunno what paintSection does wrong
QHeaderView::paintSection(painter, rect, logicalIndex);
painter->restore(); // s.a.
// draw posMark
if (logicalIndex == 1)
{
int h = (rect.height() / 3);
int y = rect.height() - h;
int w = h;
//QRect sectionRect(sectionPosition(1), 0, sectionSize(1), 0);
painter->save();
painter->setClipping(true);
if (m_posMarkTime != 0) // if user changed posMark to a valid value
{
double posMark = EventTools::getEventPosition(m_posMarkTime);//, sectionRect);
int x = /*sectionPosition(1)*/ + posMark;
if (x >= sectionPosition(1))
{
painter->setPen(QPen(QGuiApplication::palette().color(QPalette::Inactive, QPalette::Highlight)));
painter->setBrush(QGuiApplication::palette().highlight());
QPolygon pol;
pol.append(QPoint(x + (-w / 2), y + 0)); // p1
pol.append(QPoint(x + 0, y + h)); // p2
pol.append(QPoint(x + (w / 2), y + 0)); // p3
pol.append(QPoint(x + (-w / 2), y + 0)); // p1
QPainterPath path;
path.moveTo(x, y);
path.addPolygon(pol);
painter->drawPath(path);
}
}
if (m_liveTime != 0)
{
int posLive = EventTools::getEventPosition(m_liveTime);//, sectionRect);
int x = posLive;
if (x >= sectionPosition(1))
{
painter->setPen(QPen(QColor("green")));
painter->setBrush(QBrush(QColor("green")));
QPolygon pol;
pol.append(QPoint(x + (-w / 2), y + 0)); // p1
pol.append(QPoint(x + 0, y + h)); // p2
pol.append(QPoint(x + (w / 2), y + 0)); // p3
pol.append(QPoint(x + (-w / 2), y + 0)); // p1
QPainterPath path;
path.moveTo(x, y);
path.addPolygon(pol);
painter->drawPath(path);
}
}
painter->restore();
}
}
}