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

142 lines
3.3 KiB
C++

/**
* @RDE_HEADER@
* Bitfield Widget for bitwise displaying and editing of quint8 values
* Created by Christian Kaemmerer
* $Id$
* $HeadURL$
* $Author$
*/
#pragma once
#include <QWidget>
#include <QMouseEvent>
#include "lts_widgets_export.h"
namespace LtsWidgets
{
class LTSWIDGETS_EXPORT LtsBitfieldWidget : public QWidget
{
Q_OBJECT
Q_PROPERTY(quint8 value READ value WRITE setValue NOTIFY valueChanged)
Q_PROPERTY(bool isEditable READ isEditable WRITE setEditable NOTIFY isEditableChanged)
Q_PROPERTY(bool hasCaption READ hasCaption WRITE setHasCaption NOTIFY hasCaptionChanged)
Q_PROPERTY(QColor onColor READ onColor WRITE setOnColor)
Q_PROPERTY(QColor offColor READ offColor WRITE setOffColor)
public:
explicit LtsBitfieldWidget(QWidget *parent = nullptr, quint8 value = 0);
signals:
void valueChanged(quint8 newValue);
void isEditableChanged(bool option);
void hasCaptionChanged(bool option);
public slots:
/**
* @brief setvalue
* sets m_value to the given quint8
* @param quint8 value
*/
void setValue(quint8 value);
/**
* @brief setIsEditable
* sets m_isEditable to option.
* true meaning the value of the widget can be changed via mousePressEvent
* @param bool option
*/
void setEditable(bool editable);
/**
* @brief setHasCaption
* sets m_hasCaption to 0 or 1 which toggels if text should be
* drawn on each bitGraphic
* @param bool hasCaption
*/
void setHasCaption(bool hasCaption);
/**
* @brief setOnColor
* sets the onColor for m_bitGraphic
* @param QColor onColor
*/
void setOnColor(const QColor &onColor);
/**
* @brief setOffColor
* sets the offColor for m_bitGraphic
* @param QColor offColor
*/
void setOffColor(const QColor &offColor);
public:
/**
* @brief value
* get the current value
* @return quint8 of current value
*/
quint8 value() const { return m_value; }
/**
* @brief isEditable
* get the current state of editability
* @return bool of editability state
*/
bool isEditable() const { return m_isEditable; }
/**
* @brief hasCaption
* gets state of m_hasCaption
* @return bool hasCaption
*/
bool hasCaption() const { return m_hasCaption; }
/**
* @brief onColor
* gets the onColor for m_bitGraphic
* @return QColor m_onColor
*/
QColor onColor() const {return m_onColor;}
/**
* @brief offColor
* gets the offColor for m_bitGraphic
* @return QColor m_offColor
*/
QColor offColor() const {return m_offColor;}
private:
/**
* @brief mousePressEvent
* Checks if the click position falls within any of the bit rectangles. If there
* is a match the value of that bit gets flipped
* @param event QMouseEvent
*/
void mousePressEvent(QMouseEvent *event) override;
/**
* @brief paintEvent
* Draws m_bitGraphic.Size() rectangles and depending on the bit value of m_value draw either
* a onColor rectangle with a offColor 1 or a offColor rectangle with a onColor 0
* @param pe QPaintEvent (isn't used to do anything)
*/
void paintEvent(QPaintEvent *pe) override;
private:
quint8 m_value = 0;
bool m_isEditable = true;
bool m_hasCaption = true;
QColor m_onColor = Qt::black;
QColor m_offColor = Qt::white;
};
} // namespace LtsWidgets