Files
qt-migration-legatus/qt5-before/dlbo/Lts/Common/LtsWidgets/ui_requirement.h
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

99 lines
3.5 KiB
C++

/**
* @RDE_HEADER@
* Helper Classes to manage requirements for end-users to ui elements
* $Id$
* $HeadURL$
* $Author$
*
* Created by Mike Wille, SLSE, 2016-08-19
*/
#pragma once
#include "lts_widgets_export.h"
#include <QWidget>
#include <QVector>
#include <functional>
class QLabel;
namespace LtsWidgets
{
/**
* @brief The UiRequirement class describes a single UiRequirement. An UiRequirement is used to check that (valid) data is entered
* by a user into an editable Widget. After an UiRequirement is created, it automatically changes the description Label of the
* editable Widget by adding "[*]" to visualize that this Widget must be filled. If an UiRequirement is not met after executing the
* checkRequirement-Method, the Label is colored red to visualize an error to the user.
*
*/
class LTSWIDGETS_EXPORT UiRequirement // TODO: optional requirements => simply non-marked labels with advanced requirement checks (MessageDialog with message that e.g. "val of [widget-description] is too small")
{
public:
explicit UiRequirement() = default;
/**
* @brief UiRequirement
* @param descriptionLabel the Label, usually left of the editable Widget in a Form Layout, which describes the editable Widget to be checked
* @param requirementCheck the routine (c++11) to check if requirements are met for the editable Widget to be checked - return values: true when requirement(s) are met, false when not
*/
UiRequirement(QLabel *descriptionLabel, const std::function<bool()> &requirementCheck, const QString &userWarningMessage = QString());
void reset();
/**
* @brief checkRequirement executes the requirementCheck function. If the description Label of the editable Widget is not visible,
* the requirement check is ignored (as, logically, the Widget is then optional). If the requirement is not met, the
* description Label of the editable Widget is colored red.
* @return true if requirement is met (or description Label of Widget is hidden (optional)), false if not met
*/
bool checkRequirement();
bool isValid() const { return m_descriptionLabel != nullptr; }
void retranslate();
private:
void setTexts();
QLabel *m_descriptionLabel;
std::function<bool()> m_requirementCheck;
QString m_originalText;
QString m_originalTooltip;
bool m_lastResult;
QString m_userWarningMessage;
};
/**
* @brief The UiRequirementList class provides a list which contains UiRequirements, that can all be checked by one method call.
*/
class LTSWIDGETS_EXPORT UiRequirementList
{
public:
UiRequirementList() = default;
/**
* @brief checkRequirements checks every requirement in this list. If one or more requirements are not met, this method returns false.
* @param messageOnThisParent set this pointer to a QWidget to let the UiRequirementList generate a LtsMessageDialog which states that there are non-met requirements for the user, set to nullptr to not show a message
* @return true if all requirements are met, false if one or more requirements have NOT met
*/
bool checkRequirements(QWidget *messageOnThisParent = nullptr);
/**
* @brief addRequirement adds an UiRequirement to this list.
* @param uiRequirement the UiRequirement to be copied & added.
*/
void addRequirement(const UiRequirement &uiRequirement);
void clear();
void retranslate(); // TODO: remove after every UiReq is inside retranslate()-method
private:
QVector<UiRequirement> m_requirementList; // TODo: to ptr as QVector does a graceful copy of the UiReq class, causing the original class to be destroyed
};
} // namespace LtsWidgets