Add function QMLArray::removeLater()
This commit is contained in:
parent
5b3b669997
commit
5ce0b81e39
2 changed files with 8 additions and 0 deletions
|
@ -1,4 +1,5 @@
|
||||||
#include "qmlarray.h"
|
#include "qmlarray.h"
|
||||||
|
#include <QMetaMethod>
|
||||||
|
|
||||||
class QMLArray::PrivateData {
|
class QMLArray::PrivateData {
|
||||||
public:
|
public:
|
||||||
|
@ -39,6 +40,12 @@ void QMLArray::remove(int index) {
|
||||||
endRemoveRows();
|
endRemoveRows();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void QMLArray::removeLater(int index) {
|
||||||
|
int methodIndex = this->metaObject()->indexOfMethod(QMetaObject::normalizedSignature("remove(int)"));
|
||||||
|
QMetaMethod method = this->metaObject()->method(methodIndex);
|
||||||
|
method.invoke(this, Qt::QueuedConnection, Q_ARG(int, index));
|
||||||
|
}
|
||||||
|
|
||||||
int QMLArray::rowCount(const QModelIndex &parent) const {
|
int QMLArray::rowCount(const QModelIndex &parent) const {
|
||||||
return d->list.size();
|
return d->list.size();
|
||||||
}
|
}
|
||||||
|
|
|
@ -20,6 +20,7 @@ signals:
|
||||||
public slots:
|
public slots:
|
||||||
void push(const QScriptValue &v);
|
void push(const QScriptValue &v);
|
||||||
void remove(int index);
|
void remove(int index);
|
||||||
|
void removeLater(int index);
|
||||||
QVariant get(int index) const;
|
QVariant get(int index) const;
|
||||||
|
|
||||||
|
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue