- 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>
77 lines
1.6 KiB
C++
77 lines
1.6 KiB
C++
#include "track_entry_previewer.h"
|
|
|
|
#include "track_content_widget.h"
|
|
#include "track_entry.h"
|
|
#include "track_entry_painters.h"
|
|
|
|
#include <QDrag>
|
|
#include <QMimeData>
|
|
#include <QtGui/QMouseEvent>
|
|
#include <QtGui/QPainter>
|
|
|
|
namespace LtsScriptTimeline
|
|
{
|
|
|
|
QDataStream& operator<<(QDataStream& ds, const TrackEntry& te);
|
|
QDataStream& operator>>(QDataStream& ds, TrackEntry& te);
|
|
|
|
TrackEntryPreviewer::TrackEntryPreviewer(QWidget* parent) : QWidget(parent), m_te(nullptr)
|
|
{
|
|
|
|
setVisible(false);
|
|
}
|
|
|
|
TrackEntryPreviewer::~TrackEntryPreviewer() {}
|
|
|
|
void TrackEntryPreviewer::setTrackEntry(TrackEntry* te)
|
|
{
|
|
m_te = te;
|
|
|
|
if (m_te->isSet)
|
|
return;
|
|
|
|
connect(m_te, &TrackEntry::destroyed, this, [this]() {
|
|
m_te = nullptr;
|
|
emit signalDelete();
|
|
});
|
|
}
|
|
|
|
void TrackEntryPreviewer::mousePressEvent(QMouseEvent* event)
|
|
{
|
|
|
|
if (!m_te || event->buttons() != Qt::LeftButton)
|
|
return;
|
|
|
|
m_te->isSet = true;
|
|
QByteArray itemData(TrackContentWidget::itemsToData({m_te}, 0));
|
|
m_te->isSet = false;
|
|
|
|
QMimeData* mimeData = new QMimeData;
|
|
mimeData->setData(TrackContentWidget::mime, itemData);
|
|
|
|
QDrag* drag = new QDrag(this);
|
|
drag->setDragCursor(QPixmap(), Qt::CopyAction);
|
|
drag->setMimeData(mimeData);
|
|
|
|
emit signalStartDrag();
|
|
|
|
if (drag->exec(Qt::CopyAction) == Qt::CopyAction)
|
|
emit signalDelete();
|
|
|
|
emit signalStopDrag();
|
|
}
|
|
|
|
void TrackEntryPreviewer::paintEvent(QPaintEvent* event)
|
|
{
|
|
QWidget::paintEvent(event);
|
|
|
|
QPainter painter(this);
|
|
|
|
if (!m_te)
|
|
return;
|
|
|
|
drawTrackEntry(m_te, painter, rect().adjusted(0, 0, -1, -1), false, isEnabled());
|
|
}
|
|
|
|
} // namespace LtsScriptTimeline
|