Further renamings.
This commit is contained in:
@@ -12,7 +12,7 @@
|
||||
#include <QPainter>
|
||||
|
||||
#include "bcitemdelegate.h"
|
||||
#include "bcdata.h"
|
||||
#include "bcdataitem.h"
|
||||
#include "qapplication.h"
|
||||
|
||||
|
||||
@@ -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<BCData*>())
|
||||
if (dataValue.canConvert<BCDataItem*>())
|
||||
{
|
||||
BCData& bc = *dataValue.value<BCData*>();
|
||||
BCDataItem& bc = *dataValue.value<BCDataItem*>();
|
||||
qDebug() << " --- YES: " << bc.label;
|
||||
// Hier bauen wir den String zusammen, den man sieht,
|
||||
// wenn KEIN Editor offen ist.
|
||||
@@ -46,13 +46,13 @@ QString BCItemDelegate::displayText(const QVariant& dataValue, const QLocale& lo
|
||||
}
|
||||
|
||||
|
||||
QWidget *BCItemDelegate::createEditor(QWidget *parent, const QStyleOptionViewItem &option, const QModelIndex &index) const
|
||||
QWidget *BCItemDelegate::createEditor(QWidget *parent, const QStyleOptionViewItem &option, const QModelIndex& index) const
|
||||
{
|
||||
QVariant rawData = index.data(Qt::EditRole);
|
||||
if (!rawData.canConvert<BCData*>())
|
||||
if (!rawData.canConvert<BCDataItem*>())
|
||||
return QStyledItemDelegate::createEditor(parent, option, index);
|
||||
|
||||
const BCData& bc = *rawData.value<BCData*>();
|
||||
const BCDataItem& bc = *rawData.value<BCDataItem*>();
|
||||
|
||||
// Nur bei Integern den Slider-Editor bauen
|
||||
if (bc.value.typeId() == QMetaType::Int)
|
||||
@@ -94,10 +94,10 @@ QWidget *BCItemDelegate::createEditor(QWidget *parent, const QStyleOptionViewIte
|
||||
return QStyledItemDelegate::createEditor(parent, option, index);
|
||||
}
|
||||
|
||||
void BCItemDelegate::setEditorData(QWidget *editor, const QModelIndex &index) const
|
||||
void BCItemDelegate::setEditorData(QWidget *editor, const QModelIndex& index) const
|
||||
{
|
||||
// Daten vom Model in den Editor laden
|
||||
const BCData& bc = *index.data(Qt::EditRole).value<BCData*>();
|
||||
const BCDataItem& bc = *index.data(Qt::EditRole).value<BCDataItem*>();
|
||||
|
||||
QSlider *slider = editor->findChild<QSlider*>("slider");
|
||||
QLabel *lblUnit = editor->findChild<QLabel*>("lblUnit");
|
||||
@@ -113,7 +113,7 @@ void BCItemDelegate::setEditorData(QWidget *editor, const QModelIndex &index) co
|
||||
}
|
||||
}
|
||||
|
||||
void BCItemDelegate::setModelData(QWidget *editor, QAbstractItemModel *model, const QModelIndex &index) const
|
||||
void BCItemDelegate::setModelData(QWidget *editor, QAbstractItemModel *model, const QModelIndex& index) const
|
||||
{
|
||||
// Daten vom Editor zurück ins Model speichern (Beim Schließen)
|
||||
QSlider *slider = editor->findChild<QSlider*>("slider");
|
||||
@@ -126,12 +126,12 @@ void BCItemDelegate::setModelData(QWidget *editor, QAbstractItemModel *model, co
|
||||
}
|
||||
}
|
||||
|
||||
void BCItemDelegate::updateEditorGeometry(QWidget *editor, const QStyleOptionViewItem &option, const QModelIndex &index) const
|
||||
void BCItemDelegate::updateEditorGeometry(QWidget *editor, const QStyleOptionViewItem &option, const QModelIndex& index) const
|
||||
{
|
||||
editor->setGeometry(option.rect);
|
||||
}
|
||||
|
||||
QSize BCItemDelegate::sizeHint(const QStyleOptionViewItem &option, const QModelIndex &index) const
|
||||
QSize BCItemDelegate::sizeHint(const QStyleOptionViewItem &option, const QModelIndex& index) const
|
||||
{
|
||||
return QStyledItemDelegate::sizeHint(option,index);
|
||||
/*
|
||||
@@ -326,7 +326,7 @@ void BCItemDelegate::updateRow(int row)
|
||||
}
|
||||
}
|
||||
|
||||
QString BCItemDelegate::formatDisplayString(const QModelIndex &index) const
|
||||
QString BCItemDelegate::formatDisplayString(const QModelIndex& index) const
|
||||
{
|
||||
if (!index.isValid())
|
||||
return QString();
|
||||
|
||||
Reference in New Issue
Block a user