22 : QAbstractItemModel(parent)
23 , m_rootObject(rootObject)
29 if (role != Qt::DisplayRole || orientation != Qt::Horizontal)
31 return (section == 0) ?
"Name" :
"Value";
40 if (role == Qt::DisplayRole &&
index.column() == 0)
41 return label->title();
46 if (role == Qt::DisplayRole || role == Qt::EditRole) {
47 if (
index.column() == 0)
49 return var->valueOfLink();
59 Qt::ItemFlags result = Qt::ItemIsSelectable | Qt::ItemIsEnabled;
61 result |= Qt::ItemIsDragEnabled;
62 if (
index.column() == 1)
63 result |= Qt::ItemIsEditable;
70 if (!hasIndex(row, column,
parent))
74 return createIndex(row, column,
m_rootObject->children()[row]);
77 return createIndex(row, column, label->children()[row]);
87 QObject* item =
static_cast<QObject*
>(
index.internalPointer());
91 const int row = item->parent()->parent()->children().indexOf(item->parent());
92 return createIndex(row, 0, item->parent());
97 if (
index.column() > 0)
100 if (!
index.isValid())
103 QObject* item =
static_cast<QObject*
>(
index.internalPointer());
104 return item->children().size();
116 for (
auto index : indexes) {
119 data.setNum(
reinterpret_cast<qlonglong
>(parameterItem));
129 return Qt::CopyAction;
134 return Qt::IgnoreAction;
147 if (item->parent()) {
148 const int row = item->parent()->children().indexOf(item);
149 return createIndex(row, 0, item);
157 QObject* item =
static_cast<QObject*
>(
index.internalPointer());
163 QObject* item =
static_cast<QObject*
>(
index.internalPointer());
Defines namespace FitParameterHelper.
Defines classes for ParameterTreeItems.
Defines class ParameterTuningModel.
Defines reader and writer classes for SessionModel.
The ParameterItem class represent a tuning value in a parameter tuning tree.
ParameterTreeItems is a collection of items necessary to form a tuning tree for real time widget.
QModelIndex indexForItem(ParameterItem *item) const
Qt::DropActions supportedDropActions() const override
ParameterTuningModel(QObject *rootObject, QObject *parent=nullptr)
static ParameterLabelItem * toParameterLabelItem(const QModelIndex &index)
static ParameterItem * toParameterItem(const QModelIndex &index)
Qt::ItemFlags flags(const QModelIndex &index) const override
int columnCount(const QModelIndex &parent=QModelIndex()) const override
ParameterItem * getParameterItem(const QModelIndex &index) const
Returns ParameterItem from given index.
QMimeData * mimeData(const QModelIndexList &indexes) const override
int rowCount(const QModelIndex &parent=QModelIndex()) const override
QModelIndex index(int row, int column, const QModelIndex &parent=QModelIndex()) const override
QVariant headerData(int section, Qt::Orientation orientation, int role) const override
Qt::DropActions supportedDragActions() const override
QModelIndex parent(const QModelIndex &index) const override
QVariant data(const QModelIndex &index, int role) const override
constexpr auto LinkMimeType