Clean up data types.
This commit is contained in:
@@ -27,9 +27,9 @@ BCItemDelegate::BCItemDelegate(QListView *view)
|
||||
QString BCItemDelegate::displayText(const QVariant& dataValue, const QLocale& locale) const
|
||||
{
|
||||
// Wir prüfen, ob im Variant unser Struct steckt
|
||||
if (dataValue.canConvert<BCValue>())
|
||||
if (dataValue.canConvert<BCValue*>())
|
||||
{
|
||||
BCValue bc = dataValue.value<BCValue>();
|
||||
BCValue& bc = *dataValue.value<BCValue*>();
|
||||
//qDebug() << " --- YES: " << bc.label;
|
||||
// Hier bauen wir den String zusammen, den man sieht,
|
||||
// wenn KEIN Editor offen ist.
|
||||
@@ -45,10 +45,10 @@ QString BCItemDelegate::displayText(const QVariant& dataValue, const QLocale& lo
|
||||
QWidget *BCItemDelegate::createEditor(QWidget *parent, const QStyleOptionViewItem &option, const QModelIndex &index) const
|
||||
{
|
||||
QVariant rawData = index.data(Qt::EditRole);
|
||||
if (!rawData.canConvert<BCValue>())
|
||||
if (!rawData.canConvert<BCValue*>())
|
||||
return QStyledItemDelegate::createEditor(parent, option, index);
|
||||
|
||||
BCValue bc = rawData.value<BCValue>();
|
||||
const BCValue& bc = *rawData.value<BCValue*>();
|
||||
|
||||
// Nur bei Integern den Slider-Editor bauen
|
||||
if (bc.value.typeId() == QMetaType::Int)
|
||||
@@ -93,7 +93,7 @@ QWidget *BCItemDelegate::createEditor(QWidget *parent, const QStyleOptionViewIte
|
||||
void BCItemDelegate::setEditorData(QWidget *editor, const QModelIndex &index) const
|
||||
{
|
||||
// Daten vom Model in den Editor laden
|
||||
BCValue bc = index.data(Qt::EditRole).value<BCValue>();
|
||||
const BCValue& bc = *index.data(Qt::EditRole).value<BCValue*>();
|
||||
|
||||
QSlider *slider = editor->findChild<QSlider*>("slider");
|
||||
QLabel *lblUnit = editor->findChild<QLabel*>("lblUnit");
|
||||
|
||||
Reference in New Issue
Block a user