a compiling and sorta working model
This model, built in Rust, works in that functions are getting called and the right pieces are mapped into the model. I've yet to connect things up to see if QML is talking to the model just yet.
This commit is contained in:
parent
08507bfc0d
commit
90c1825b10
4 changed files with 186 additions and 19 deletions
|
@ -24,6 +24,7 @@
|
|||
#include <QStandardPaths>
|
||||
#include <QImage>
|
||||
|
||||
#include "cxx-qt-gen/slide_model.cxxqt.h"
|
||||
|
||||
ServiceItemModel::ServiceItemModel(QObject *parent)
|
||||
: QAbstractListModel(parent) {
|
||||
|
@ -285,7 +286,28 @@ void ServiceItemModel::addItem(const QString &name, const QString &type,
|
|||
item->setSelected(false);
|
||||
item->setActive(false);
|
||||
addItem(item);
|
||||
|
||||
QVariantMap itm;
|
||||
const QModelIndex idx = this->index(rowCount() - 1);
|
||||
qDebug() << idx;
|
||||
qDebug() << rowCount();
|
||||
if( idx.isValid() ) {
|
||||
const QHash<int,QByteArray> rn = roleNames();
|
||||
// qDebug() << rn;
|
||||
QHashIterator<int,QByteArray> it(rn);
|
||||
while (it.hasNext()) {
|
||||
it.next();
|
||||
qDebug() << "trains";
|
||||
qDebug() << it.key() << ":" << it.value() << ":" << idx.data(it.key());
|
||||
itm[it.value()] = idx.data(it.key());
|
||||
}
|
||||
} else
|
||||
qDebug() << "idx isn't valid";
|
||||
qDebug() << "*&";
|
||||
qDebug() << itm;
|
||||
qDebug() << "*&";
|
||||
emit itemAdded(rowCount() - 1, *item);
|
||||
emit itemAddedRust(rowCount() - 1, itm);
|
||||
qDebug() << "EMITTED ITEM ADDED" << rowCount();
|
||||
qDebug() << "#################################";
|
||||
qDebug() << name << type << font << fontSize << slideNumber;
|
||||
|
|
|
@ -115,6 +115,7 @@ public:
|
|||
|
||||
signals:
|
||||
void itemAdded(const int &, const ServiceItem &);
|
||||
void itemAddedRust(const int &, const QVariantMap &);
|
||||
void itemInserted(const int &, const ServiceItem &);
|
||||
void rowMoved(const int &, const int &, const ServiceItem &);
|
||||
void rowRemoved(const int &, const ServiceItem &);
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue