Files
qt-migration-legatus/qt6-after/qt6-migrated-legatus/Lts/Tools/Examples/TestGuiElement/gui_element_plugin.cpp
T
berrux-dev 598fc2560e Complete Qt6 migration: full clean build green across groups G1-G12 incl. runtime plugin set
new_docker_build.sh gains Group 12 (212 GUI/Data plugins); fixes LtsUtilsGuiDds visibility (LTO-stripped exports), LtsProjectionWorkstation unity name shadow, 6 unity-off dirs (dup file-scope statics, ddsftc INTERFACE sources) and reconfigures BUILD_FILTERMANAGEMENT/BUILD_PLUGINS_SERVICEMONITOR=ON
2026-10-20 09:36:57 +02:00

61 lines
1.6 KiB
C++

#include <Plugins/ParticipantManagement/ppm_data_plugin_interface.h>
#include <PluginInterfaces/gui_plugin_interface.h>
#include <LtsSession/lts_session.h>
#include "gui_element_plugin.h"
#include "custom_widget.h"
#include <QDebug>
GuiElementPlugin::GuiElementPlugin()
{
}
QWidget *GuiElementPlugin::createGuiElement(QWidget *parent)
{
m_customWidget = new CustomWidget(parent);
if (!m_ppmDtc)
{
qCritical()<<" ppmDtc not yet init!!!";
return nullptr;
}
connect(m_customWidget, &CustomWidget::finOnMapClicked, this, &GuiElementPlugin::onFindOnMap);
connect(m_ppmDtc.get(), &ParticipantManagement::Interface::Dtc::participantPositionChanged,
m_customWidget, [=](const ParticipantManagement::ParticipantPosition &ppPos){
m_customWidget->onPositionChanged(ppPos.pos, m_participantId);
}, Qt::UniqueConnection);
m_customWidget->onPositionChanged(m_ppmDtc->participantPosition(m_participantId).pos, m_participantId);
return m_customWidget;
}
bool GuiElementPlugin::init(LtsSession::LtsSession *session, int participantId)
{
m_session = session;
if (!m_session->getDtc<ParticipantManagement::DataInterface>(m_ppmDtc))
{
qCritical()<<"couln't init ppmDtc for gui element ";
return false;
}
if (!session->getForeignGuiInterface<SituationMap::ForeignGuiInterface>(m_sitMapGuiIfc))
{
qCritical()<<"couln't init sitMapGuiIfc for gui element ";
return false;
}
m_participantId = participantId;
return true;
}
void GuiElementPlugin::onFindOnMap()
{
if (m_sitMapGuiIfc)
m_sitMapGuiIfc->centerMapToParticipant(m_participantId);
}