Mini Milestone: Driver loads and connects.
This commit is contained in:
@@ -8,15 +8,20 @@
|
||||
#include "bcvalue.h"
|
||||
|
||||
|
||||
BCValueDelegate::BCValueDelegate(QObject *parent) : QStyledItemDelegate(parent) {}
|
||||
BCValueDelegate::BCValueDelegate(QObject *parent)
|
||||
: QStyledItemDelegate(parent)
|
||||
{
|
||||
|
||||
// --- TEIL 1: DIE NORMALE ANZEIGE ---
|
||||
QString BCValueDelegate::displayText(const QVariant &value, const QLocale &locale) const
|
||||
}
|
||||
|
||||
|
||||
QString BCValueDelegate::displayText(const QVariant& dataValue, const QLocale& locale) const
|
||||
{
|
||||
// Wir prüfen, ob im Variant unser Struct steckt
|
||||
if (value.canConvert<BCValue>()) {
|
||||
BCValue bc = value.value<BCValue>();
|
||||
|
||||
if (dataValue.canConvert<BCValue>())
|
||||
{
|
||||
BCValue bc = dataValue.value<BCValue>();
|
||||
//qDebug() << " --- YES: " << bc.label;
|
||||
// Hier bauen wir den String zusammen, den man sieht,
|
||||
// wenn KEIN Editor offen ist.
|
||||
// Format: "Label: Wert Einheit"
|
||||
@@ -24,10 +29,10 @@ QString BCValueDelegate::displayText(const QVariant &value, const QLocale &local
|
||||
}
|
||||
|
||||
// Fallback für normale Strings/Zahlen
|
||||
return QStyledItemDelegate::displayText(value, locale);
|
||||
return QStyledItemDelegate::displayText(dataValue, locale);
|
||||
}
|
||||
|
||||
// --- TEIL 2: DER EDITOR (SLIDER) ---
|
||||
|
||||
QWidget *BCValueDelegate::createEditor(QWidget *parent, const QStyleOptionViewItem &option, const QModelIndex &index) const
|
||||
{
|
||||
QVariant rawData = index.data(Qt::EditRole);
|
||||
|
||||
Reference in New Issue
Block a user