added categories to the accountspage
This commit is contained in:
@@ -0,0 +1,14 @@
|
||||
#pragma once
|
||||
|
||||
#include <QHash>
|
||||
#include <QString>
|
||||
|
||||
namespace std {
|
||||
template <>
|
||||
struct hash<QString> {
|
||||
std::size_t operator()(const QString &s) const
|
||||
{
|
||||
return qHash(s);
|
||||
}
|
||||
};
|
||||
} // namespace std
|
||||
@@ -1 +0,0 @@
|
||||
#include "signalvectormodel.hpp"
|
||||
@@ -28,10 +28,6 @@ public:
|
||||
this->vector = vec;
|
||||
|
||||
auto insert = [this](const SignalVectorItemArgs<TVectorItem> &args) {
|
||||
if (args.caller == this) {
|
||||
return;
|
||||
}
|
||||
|
||||
// get row index
|
||||
int index = this->getModelIndexFromVectorIndex(args.index);
|
||||
assert(index >= 0 && index <= this->rows.size());
|
||||
@@ -58,20 +54,21 @@ public:
|
||||
this->managedConnect(vec->itemInserted, insert);
|
||||
|
||||
this->managedConnect(vec->itemRemoved, [this](auto args) {
|
||||
if (args.caller == this) {
|
||||
return;
|
||||
}
|
||||
|
||||
int row = this->getModelIndexFromVectorIndex(args.index);
|
||||
assert(row >= 0 && row <= this->rows.size());
|
||||
|
||||
// remove row
|
||||
std::vector<QStandardItem *> items = std::move(this->rows[row].items);
|
||||
|
||||
this->beginRemoveRows(QModelIndex(), row, row);
|
||||
for (QStandardItem *item : this->rows[row].items) {
|
||||
delete item;
|
||||
}
|
||||
this->rows.erase(this->rows.begin() + row);
|
||||
this->endRemoveRows();
|
||||
|
||||
this->afterRemoved(args.item, items, row);
|
||||
|
||||
for (QStandardItem *item : items) {
|
||||
delete item;
|
||||
}
|
||||
});
|
||||
|
||||
this->afterInit();
|
||||
@@ -185,7 +182,7 @@ public:
|
||||
assert(row >= 0 && row < this->rows.size());
|
||||
|
||||
int signalVectorRow = this->getVectorIndexFromModelIndex(row);
|
||||
this->vector->removeItem(signalVectorRow);
|
||||
this->vector->removeItem(signalVectorRow, this);
|
||||
|
||||
return true;
|
||||
}
|
||||
@@ -226,6 +223,16 @@ protected:
|
||||
this->endInsertRows();
|
||||
}
|
||||
|
||||
void removeCustomRow(int index)
|
||||
{
|
||||
assert(index >= 0 && index <= this->rows.size());
|
||||
assert(this->rows[index].isCustomRow);
|
||||
|
||||
this->beginRemoveRows(QModelIndex(), index, index);
|
||||
this->rows.erase(this->rows.begin() + index);
|
||||
this->endRemoveRows();
|
||||
}
|
||||
|
||||
std::vector<QStandardItem *> createRow()
|
||||
{
|
||||
std::vector<QStandardItem *> row;
|
||||
|
||||
Reference in New Issue
Block a user