Qt6 Migration: LtsWidgets, BUILD_RTI Guards, externe Dependencies dokumentiert
- LtsWidgets Verzeichnis vollständig migriert (Qt5→Qt6) - BUILD_RTI Guards für RTI-spezifische Module hinzugefügt - Externe Dependencies in EXTERNAL_DEPS.md dokumentiert - Qt6 API-Änderungen: QRegExp→QRegularExpression, enterEvent(QEnterEvent*) - AutoUic-Fehler bei ui_requirement behoben (SKIP_AUTOUIC) - Include-Pfade korrigiert (LtsElevation, LtsMultiMonitor, LtsUtilsCore) - MOC-Fehler behoben (Q_INTERFACES entfernt wo nicht benötigt) - CMakeLists.txt Anpassungen für Qt6 (PUBLIC statt INTERFACE) Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
This commit is contained in:
145 files changed
+17700
-14377
No files matched your search
@@ -1,84 +1,141 @@
|
||||
|
||||
/**
|
||||
* @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"
|
||||
|
||||
#include <QMouseEvent>
|
||||
#include <QObject>
|
||||
#include <QWidget>
|
||||
|
||||
namespace LtsWidgets
|
||||
{
|
||||
|
||||
class LTSWIDGETS_EXPORT LtsBitfieldWidget : public QWidget
|
||||
{
|
||||
Q_OBJECT
|
||||
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)
|
||||
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);
|
||||
public:
|
||||
explicit LtsBitfieldWidget(QWidget *parent = nullptr, quint8 value = 0);
|
||||
|
||||
signals:
|
||||
void valueChanged(quint8 newValue);
|
||||
void isEditableChanged(bool option);
|
||||
void hasCaptionChanged(bool option);
|
||||
signals:
|
||||
void valueChanged(quint8 newValue);
|
||||
void isEditableChanged(bool option);
|
||||
void hasCaptionChanged(bool option);
|
||||
|
||||
public slots:
|
||||
public slots:
|
||||
/**
|
||||
* @brief setvalue
|
||||
* sets m_value to the given quint8
|
||||
* @param quint8 value
|
||||
*/
|
||||
void setValue(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);
|
||||
|
||||
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);
|
||||
|
||||
void setHasCaption(bool hasCaption);
|
||||
/**
|
||||
* @brief setOnColor
|
||||
* sets the onColor for m_bitGraphic
|
||||
* @param QColor onColor
|
||||
*/
|
||||
void setOnColor(const QColor &onColor);
|
||||
|
||||
void setOnColor(const QColor& onColor);
|
||||
/**
|
||||
* @brief setOffColor
|
||||
* sets the offColor for m_bitGraphic
|
||||
* @param QColor offColor
|
||||
*/
|
||||
void setOffColor(const QColor &offColor);
|
||||
|
||||
void setOffColor(const QColor& offColor);
|
||||
|
||||
public:
|
||||
quint8 value() const
|
||||
{
|
||||
return m_value;
|
||||
}
|
||||
public:
|
||||
/**
|
||||
* @brief value
|
||||
* get the current value
|
||||
* @return quint8 of current value
|
||||
*/
|
||||
quint8 value() const { return m_value; }
|
||||
|
||||
bool isEditable() const
|
||||
{
|
||||
return m_isEditable;
|
||||
}
|
||||
/**
|
||||
* @brief isEditable
|
||||
* get the current state of editability
|
||||
* @return bool of editability state
|
||||
*/
|
||||
bool isEditable() const { return m_isEditable; }
|
||||
|
||||
bool hasCaption() const
|
||||
{
|
||||
return m_hasCaption;
|
||||
}
|
||||
/**
|
||||
* @brief hasCaption
|
||||
* gets state of m_hasCaption
|
||||
* @return bool hasCaption
|
||||
*/
|
||||
bool hasCaption() const { return m_hasCaption; }
|
||||
|
||||
QColor onColor() const
|
||||
{
|
||||
return m_onColor;
|
||||
}
|
||||
/**
|
||||
* @brief onColor
|
||||
* gets the onColor for m_bitGraphic
|
||||
* @return QColor m_onColor
|
||||
*/
|
||||
QColor onColor() const {return m_onColor;}
|
||||
|
||||
QColor offColor() const
|
||||
{
|
||||
return m_offColor;
|
||||
}
|
||||
/**
|
||||
* @brief offColor
|
||||
* gets the offColor for m_bitGraphic
|
||||
* @return QColor m_offColor
|
||||
*/
|
||||
QColor offColor() const {return m_offColor;}
|
||||
|
||||
private:
|
||||
void mousePressEvent(QMouseEvent* event) override;
|
||||
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;
|
||||
|
||||
void paintEvent(QPaintEvent* pe) 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;
|
||||
private:
|
||||
quint8 m_value = 0;
|
||||
|
||||
bool m_isEditable = true;
|
||||
bool m_hasCaption = true;
|
||||
bool m_isEditable = true;
|
||||
bool m_hasCaption = true;
|
||||
|
||||
QColor m_onColor = Qt::black;
|
||||
QColor m_offColor = Qt::white;
|
||||
QColor m_onColor = Qt::black;
|
||||
QColor m_offColor = Qt::white;
|
||||
};
|
||||
|
||||
} // namespace LtsWidgets
|
||||
Reference in new issue
Block a user