Files
qt-migration-legatus/qt6-after/qt6-migrated-legatus/Lts/Tools/DdsView/rw/rwwidgets.h
T
torsten d5c13033e2 Session 022: Migrate Lts/Tools (72 submodules) to Qt6
- Copied complete Lts/Tools directory from qt5-before to qt6-after
- Updated 32 CMakeLists.txt files (Qt5:: → Qt6::)
- Tools subdirectory already included in parent Lts/CMakeLists.txt
- All 72 tool submodules now present in qt6-migrated-legatus
- Includes: Adler, ArAssets, ConfigX, DBAdministration, DBUpdate,
  DdsView, InfrastructureManagement, and 67 more tools
- C++17 standard (RTI 7.7.0 compatibility maintained)
- Tests deferred until final validation phase

Migration progress:
✅ Lts/Application (68 files)
✅ Lts/DDS (verified Qt6-ready)
✅ Lts/Plugins (60 submodules, verified)
✅ Lts/Projects (5 submodules, verified)
✅ Lts/Proxies (13 submodules, verified)
✅ Lts/Services (47 submodules, verified)
✅ Lts/Tools (72 submodules, copied + CMake updated)
✅ Lts/Viewer (LtsFileDialog, LtsReportDisplay, SituationMap)
🟡 TetraIF (partial)
🟡 Z (partial: nglwidgets, QtSingleApplication, qsql_informix, WMS_Interface)
2026-08-25 14:07:20 +02:00

203 lines
3.5 KiB
C++
Executable File

/**
* @RDE_HEADER@
*
* Widgets that change from QLabel to Q* if clicked (and not read only)
*
* $Id$
* $HeadURL$
* $Author$
*/
#pragma once
#include <QWidget>
#include <QLabel>
#include <QStackedWidget>
#include <QtCore/QMap>
class QSpinBox;
class QDoubleSpinBox;
class QCheckBox;
class QLineEdit;
class QComboBox;
namespace LtsWidgets {
class LtsBitfieldWidget;
}
enum class RwMode {
ReadOnly,
WriteOnly,
ReadWrite
};
class MyLabel : public QLabel
{
Q_OBJECT
public:
using QLabel::QLabel;
signals:
void clicked();
protected:
void mousePressEvent(QMouseEvent *ev);
};
class ResizableStackedWidget : public QStackedWidget
{
Q_OBJECT
public:
explicit ResizableStackedWidget(QWidget *parent = nullptr);
int addWigdet(QWidget *widget);
int insertWidget(int index, QWidget *widget);
private slots:
void onCurrentChanged(int index);
};
class RWWidget : public QWidget
{
Q_OBJECT
public:
explicit RWWidget(QWidget *parent = nullptr);
void setToolTip(const QString &string);
public slots:
void onSetWritable();
private slots:
void onSetWritablePrivate();
signals:
void writableRequested();
protected:
MyLabel *m_label;
ResizableStackedWidget *m_stackedWidget;
QWidget *m_editableWidget;
};
class RWSpinBox : public RWWidget
{
Q_OBJECT
public:
explicit RWSpinBox(RwMode readOnly = RwMode::ReadWrite, QWidget *parent = nullptr);
void setMinimum(int min);
void setMaximum(int max);
void setValue(int val);
int value() const;
private:
QSpinBox *m_spinBox;
};
class RWDoubleSpinBox : public RWWidget
{
Q_OBJECT
public:
explicit RWDoubleSpinBox(RwMode readOnly = RwMode::ReadWrite, QWidget *parent = nullptr);
void setMinimum(double min);
void setMaximum(double max);
void setDecimals(int prec);
void setValue(double val);
double value() const;
signals:
void valueChanged();
private:
QDoubleSpinBox *m_doubleSpinBox;
int m_precision;
};
class RWCheckBox : public RWWidget
{
Q_OBJECT
public:
explicit RWCheckBox(RwMode readOnly = RwMode::ReadWrite, QWidget *parent = nullptr);
void setChecked(bool val);
bool isChecked() const;
private:
QCheckBox *m_checkBox;
};
class RWLineEdit : public RWWidget
{
Q_OBJECT
public:
explicit RWLineEdit(RwMode readOnly = RwMode::ReadWrite, QWidget *parent = nullptr);
void setMaxLength(int length);
void setText(const QString &text);
QString text() const;
private:
QLineEdit *m_lineEdit;
};
class RWComboBox : public RWWidget
{
Q_OBJECT
public:
explicit RWComboBox(RwMode readOnly = RwMode::ReadWrite, QWidget *parent = nullptr);
void addItem(const QString &text, int ordinal = -1);
void insertItem(int index, const QString &text, int ordinal = -1);
int count() const;
// int currentIndex() const; //Shouldn't be used...
int currentValue() const;
QString currentText() const;
// void setCurrentIndex(int index); //Shouldn't be used...
void setCurrentValue(int ordinal);
private:
QComboBox *m_comboBox;
QMap<int, QString> m_values; // For ReadOnly without ComboBox
};
class RWBitfieldWidget : public RWWidget
{
Q_OBJECT
public:
explicit RWBitfieldWidget(RwMode readOnly = RwMode::ReadWrite, QWidget *parent = nullptr);
void setValue(quint8 val);
quint8 value();
void setHasCaption(bool option);
bool hasCaption();
signals:
void valueChanged(quint8 newValue);
void hasCaptionChanged(bool option);
private:
LtsWidgets::LtsBitfieldWidget *m_bitfield;
};