Qt6 Migration: Merge latest Qt5 devel content and apply migration fixes
- Merged 292 changed files from dlbo snapshot - Fixed IDL enum collisions (PortType, PdmEventType) - Fixed Grantlee template for C++11 scoped enums - Fixed CMake VERSION_GREATER syntax - Added missing directories (THP, LtsRestClient, etc.) Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
This commit is contained in:
310 files changed
+2823
-740
No files matched your search
@@ -0,0 +1,31 @@
|
||||
cmake_minimum_required(VERSION 3.16)
|
||||
project(GuiElementPlugin CXX)
|
||||
|
||||
set(CMAKE_AUTOMOC ON)
|
||||
|
||||
|
||||
SET(gui_element_SRCS
|
||||
custom_widget.cpp
|
||||
custom_widget.h
|
||||
gui_element_plugin.cpp
|
||||
gui_element_plugin.h
|
||||
)
|
||||
|
||||
NGL_WRAP_UI(gui_element_SRCS
|
||||
custom_widget.ui
|
||||
)
|
||||
|
||||
NGL_ADD_LIBRARY(WS GuiElementPlugin MODULE ${gui_element_SRCS})
|
||||
# Pfad zum Interface-Ordner bekannt machen
|
||||
NGL_TARGET_INCLUDE_DIRECTORIES(GuiElementPlugin PRIVATE ${CMAKE_CURRENT_SOURCE_DIR}/..)
|
||||
|
||||
NGL_TARGET_LINK_LIBRARIES(GuiElementPlugin
|
||||
Qt5::Widgets
|
||||
LtsWidgets
|
||||
LtsSession
|
||||
LtsSessionData
|
||||
GuiElementInterface
|
||||
PpmDataPluginInterface
|
||||
PpmCommon
|
||||
LtsCoordTrans
|
||||
)
|
||||
@@ -0,0 +1,33 @@
|
||||
#include "custom_widget.h"
|
||||
#include "LtsCoordTrans/lts_coord_trans.h"
|
||||
#include "ui_custom_widget.h"
|
||||
#include <QDebug>
|
||||
|
||||
CustomWidget::CustomWidget(QWidget *parent)
|
||||
: QWidget(parent)
|
||||
, m_ui(new Ui::CustomWidget)
|
||||
{
|
||||
m_ui->setupUi(this);
|
||||
|
||||
connect(m_ui->pbFindOnMap, &QToolButton::clicked, this, &CustomWidget::finOnMapClicked);
|
||||
}
|
||||
|
||||
CustomWidget::~CustomWidget()
|
||||
{
|
||||
delete m_ui;
|
||||
}
|
||||
|
||||
void CustomWidget::onPositionChanged(const Core::GeoPosition &position, int participantId)
|
||||
{
|
||||
if (participantId == 0 || std::isnan(position.lon()) || std::isnan(position.lat()))
|
||||
m_ui->lblPos->setText(tr("Invalid Position"));
|
||||
else
|
||||
{
|
||||
QString mgrs = LtsCoordTrans::mgrsFromGeographic(position.lon(), position.lat());
|
||||
|
||||
if (!qFuzzyIsNull(position.z()))
|
||||
mgrs += QStringLiteral(" | ") + QString::number(position.z(), 'f', 2);
|
||||
|
||||
m_ui->lblPos->setText(mgrs);
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,24 @@
|
||||
#pragma once
|
||||
|
||||
#include "Core/core.hpp"
|
||||
#include <QWidget>
|
||||
|
||||
namespace Ui {
|
||||
class CustomWidget;
|
||||
}
|
||||
|
||||
class CustomWidget : public QWidget
|
||||
{
|
||||
Q_OBJECT
|
||||
|
||||
public:
|
||||
explicit CustomWidget(QWidget *parent = nullptr);
|
||||
~CustomWidget();
|
||||
void onPositionChanged(const Core::GeoPosition &position, int participantId);
|
||||
|
||||
signals:
|
||||
void finOnMapClicked();
|
||||
private:
|
||||
Ui::CustomWidget *m_ui;
|
||||
};
|
||||
|
||||
@@ -0,0 +1,70 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<ui version="4.0">
|
||||
<class>CustomWidget</class>
|
||||
<widget class="QWidget" name="CustomWidget">
|
||||
<property name="geometry">
|
||||
<rect>
|
||||
<x>0</x>
|
||||
<y>0</y>
|
||||
<width>268</width>
|
||||
<height>88</height>
|
||||
</rect>
|
||||
</property>
|
||||
<property name="windowTitle">
|
||||
<string>Form</string>
|
||||
</property>
|
||||
<layout class="QGridLayout" name="gridLayout_2">
|
||||
<item row="0" column="0">
|
||||
<widget class="QGroupBox" name="groupBox">
|
||||
<property name="title">
|
||||
<string>Plugin-Test-DEBUG ONLY</string>
|
||||
</property>
|
||||
<layout class="QGridLayout" name="gridLayout">
|
||||
<item row="0" column="0">
|
||||
<widget class="QLabel" name="labelPos">
|
||||
<property name="text">
|
||||
<string>Position:</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="0" column="1">
|
||||
<widget class="QLabel" name="lblPos">
|
||||
<property name="text">
|
||||
<string><Position></string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="0" column="2">
|
||||
<widget class="QToolButton" name="pbFindOnMap">
|
||||
<property name="maximumSize">
|
||||
<size>
|
||||
<width>40</width>
|
||||
<height>40</height>
|
||||
</size>
|
||||
</property>
|
||||
<property name="toolTip">
|
||||
<string>Find on map</string>
|
||||
</property>
|
||||
<property name="text">
|
||||
<string notr="true"><TIME OVER TARGET></string>
|
||||
</property>
|
||||
<property name="icon">
|
||||
<iconset>
|
||||
<normaloff>:/style/center_to_object.svg</normaloff>:/style/center_to_object.svg</iconset>
|
||||
</property>
|
||||
<property name="iconSize">
|
||||
<size>
|
||||
<width>40</width>
|
||||
<height>40</height>
|
||||
</size>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
</layout>
|
||||
</widget>
|
||||
</item>
|
||||
</layout>
|
||||
</widget>
|
||||
<resources/>
|
||||
<connections/>
|
||||
</ui>
|
||||
@@ -0,0 +1,60 @@
|
||||
#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);
|
||||
}
|
||||
@@ -0,0 +1,36 @@
|
||||
#pragma once
|
||||
#include <Core/core.hpp>
|
||||
#include <ParticipantManagement/ppm_dtc.h>
|
||||
#include <Plugins/ParticipantManagement/participant_info_gui_element_interface.h>
|
||||
#include <Plugins/SituationMapPlugin/situation_map_gui_plugin_interface.h>
|
||||
#include <QObject>
|
||||
|
||||
|
||||
|
||||
class CustomWidget;
|
||||
|
||||
class GuiElementPlugin : public QObject, public GuiElementInterface
|
||||
{
|
||||
Q_OBJECT
|
||||
Q_PLUGIN_METADATA(IID IGuiElementPlugin)
|
||||
Q_INTERFACES(GuiElementInterface)
|
||||
|
||||
public:
|
||||
GuiElementPlugin();
|
||||
|
||||
QString pluginName() {return QStringLiteral("KeyValueGuiElement_XY");}
|
||||
QWidget* createGuiElement(QWidget *parent = nullptr);
|
||||
|
||||
bool init(LtsSession::LtsSession *session, int participantId = 0);
|
||||
void onFindOnMap();
|
||||
|
||||
|
||||
private:
|
||||
LtsSession::LtsSession *m_session;
|
||||
std::shared_ptr<ParticipantManagement::Interface::Dtc> m_ppmDtc;
|
||||
std::shared_ptr<SituationMap::ForeignGuiInterface> m_sitMapGuiIfc;
|
||||
CustomWidget *m_customWidget;
|
||||
int m_participantId = 0;
|
||||
};
|
||||
|
||||
|
||||
Reference in new issue
Block a user