Files
qt-migration-legatus/qt5-before/dlbo/Lts/Common/LtsScriptTimeline/track_select_handler.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

183 lines
5.8 KiB
C++

#include "track_select_handler.h"
#include "track_content_widget.h"
#include "track_entry.h"
#include "tools.h"
#include <QKeyEvent>
#include <QMenu>
#include <QInputDialog>
#include <QCoreApplication>
#include <QGuiApplication>
#include <QMouseEvent>
#include <QDebug>
namespace LtsScriptTimeline
{
void SelectHandler::slotSetDescription()
{
if (m_pressedEntry == nullptr)
return;
bool ok;
QString iniDescription = m_pressedEntry->m_description;
QString text = QInputDialog::getText(tcw,
tr("Operator Application"),
tr("Topic Description:"), QLineEdit::Normal,
iniDescription, &ok, Qt::Popup | Qt::WindowTitleHint | Qt::CustomizeWindowHint);
if (ok)
{
m_pressedEntry->m_description = text;
emit tcw->signalChangesMade();
}
}
void SelectHandler::mouseDoubleClick(QMouseEvent *event)
{
if (m_pressedEntry != nullptr
&& tcw->m_selected.count() == 1
&& !tcw->m_isMultiLineMultiSelectionMode
&& event->buttons() == Qt::LeftButton)
emit tcw->signalEditEntry(m_pressedEntry->m_topicId);
}
void SelectHandler::mousePressEvent(QMouseEvent *event)
{
if (event->buttons() == Qt::LeftButton)
{
m_pressedEntry = nullptr;
QPoint clickedPos = tcw->mapFromGlobal(event->globalPos());
int clickedPosY = clickedPos.y();
int clickedPosX = clickedPos.x();
if (clickedPosY < 0 || clickedPosY > tcw->height())
return;
int clickedTime = tcw->m_tools->getTime(clickedPosX, tcw->m_isFilter);
m_pressedEntry = tcw->getTrackEntryAt(clickedTime);
}
else if (event->buttons() == Qt::RightButton)
{
QMenu *contextMenu = new QMenu(tcw);
contextMenu->setAttribute(Qt::WA_DeleteOnClose);
contextMenu->addSection(tr("All tracks"));
{
QAction *action = new QAction(tr("Set topic description"), tcw);
action->setShortcut(QKeySequence(Qt::CTRL + Qt::Key_D));
#if QT_VERSION >= QT_VERSION_CHECK(5, 10, 0)
action->setShortcutVisibleInContextMenu(true);
#endif
action->setIcon(QIcon(QStringLiteral("icon:document-edit.svg")));
action->setEnabled(m_pressedEntry);
if (!m_pressedEntry)
action->setToolTip(tr("Right click directly on a single Topic to edit its description."));
connect(action, &QAction::triggered, this, &SelectHandler::slotSetDescription);
contextMenu->addAction(action);
}
{
QAction *action = new QAction(tr("Remove selected Topic(s)"), tcw);
action->setShortcut(QKeySequence(Qt::Key_Delete));
#if QT_VERSION >= QT_VERSION_CHECK(5, 10, 0)
action->setShortcutVisibleInContextMenu(true);
#endif
action->setIcon(QIcon(QStringLiteral("icon:delete.svg")));
connect(action, &QAction::triggered, tcw, &TrackContentWidget::signalDeleteSelectedTopics);
contextMenu->addAction(action);
}
contextMenu->addSection(tr("Main track only"));
{
QAction *action = new QAction(tr("Select all topics"), tcw);
action->setShortcut(QKeySequence(Qt::CTRL + Qt::Key_A));
#if QT_VERSION >= QT_VERSION_CHECK(5, 10, 0)
action->setShortcutVisibleInContextMenu(true);
#endif
action->setIcon(QIcon(QStringLiteral("icon:selection_rec.svg")));
connect(action, &QAction::triggered, tcw, &TrackContentWidget::signalSelectAllGlobal);
contextMenu->addAction(action);
}
{
QAction *action = new QAction(tr("Cut selected topic(s)"), tcw);
action->setShortcut(QKeySequence(Qt::CTRL + Qt::Key_X));
#if QT_VERSION >= QT_VERSION_CHECK(5, 10, 0)
action->setShortcutVisibleInContextMenu(true);
#endif
action->setIcon(QIcon(QStringLiteral("icon:edit-cut.svg")));
connect(action, &QAction::triggered, tcw, &TrackContentWidget::signalCutTopics);
contextMenu->addAction(action);
}
{
QAction *action = new QAction(tr("Copy selected topic(s)"), tcw);
action->setShortcut(QKeySequence(Qt::CTRL + Qt::Key_C));
#if QT_VERSION >= QT_VERSION_CHECK(5, 10, 0)
action->setShortcutVisibleInContextMenu(true);
#endif
action->setIcon(QIcon(QStringLiteral("icon:edit-copy.svg")));
connect(action, &QAction::triggered, tcw, &TrackContentWidget::signalCopyTopics);
contextMenu->addAction(action);
}
{
QAction *action = new QAction(tr("Paste topic(s) at indicator position"), tcw);
action->setShortcut(QKeySequence(Qt::CTRL + Qt::Key_V));
#if QT_VERSION >= QT_VERSION_CHECK(5, 10, 0)
action->setShortcutVisibleInContextMenu(true);
#endif
action->setIcon(QIcon(QStringLiteral("icon:edit-paste.svg")));
connect(action, &QAction::triggered, tcw, &TrackContentWidget::signalPasteTopics);
contextMenu->addAction(action);
}
contextMenu->popup(event->globalPos());
}
}
//#error FIXME: Er denkt ich dragge, wenn ich resize! verstaendlich.... Loesung???
void SelectHandler::mouseReleaseEvent(QMouseEvent *event) // an Entry is selected if pressed and release both were executed on a valid & the same Entry
{
QPoint clickedPos = tcw->mapFromGlobal(event->globalPos());
int clickedPosX = clickedPos.x();
int clickedTime = tcw->m_tools->getTime(clickedPosX, tcw->m_isFilter);
TrackEntry *releasedEntry = tcw->getTrackEntryAt(clickedTime);
if (!QGuiApplication::keyboardModifiers().testFlag(Qt::ControlModifier) && (!m_pressedEntry || !releasedEntry)) // do not unselect if ctrl active
{
emit tcw->signalUnselectAll();
emit tcw->signalTrackEntrySelectionChanged(nullptr);
}
else
{
if (m_pressedEntry == releasedEntry)
tcw->selectEntry(releasedEntry);
}
}
void SelectHandler::keyPressEvent(QKeyEvent *event)
{
if (event->key() == Qt::Key_Escape)
{
m_pressedEntry = nullptr;
emit tcw->signalUnselectAll();
emit tcw->signalTrackEntrySelectionChanged(nullptr);
}
}
} // namespace LtsScriptTimeline