Use Q_SIGNALS/Q_EMIT instead of signals/emit in generated sources
Summary: Avoid potential clashes on symbols/macros from other libraries Allows to use the generated header in projects which have DQT_NO_SIGNALS_SLOTS_KEYWORDS or DQT_NO_KEYWORDS set Reviewers: vandenoever Reviewed By: vandenoever Differential Revision: https://phabricator.kde.org/D15545master
parent
c970b1c417
commit
d5029d7217
|
@ -53,19 +53,19 @@ namespace {
|
|||
}
|
||||
inline void fibonacciInputChanged(Fibonacci* o)
|
||||
{
|
||||
emit o->inputChanged();
|
||||
Q_EMIT o->inputChanged();
|
||||
}
|
||||
inline void fibonacciResultChanged(Fibonacci* o)
|
||||
{
|
||||
emit o->resultChanged();
|
||||
Q_EMIT o->resultChanged();
|
||||
}
|
||||
inline void fileSystemTreePathChanged(FileSystemTree* o)
|
||||
{
|
||||
emit o->pathChanged();
|
||||
Q_EMIT o->pathChanged();
|
||||
}
|
||||
inline void processesActiveChanged(Processes* o)
|
||||
{
|
||||
emit o->activeChanged();
|
||||
Q_EMIT o->activeChanged();
|
||||
}
|
||||
}
|
||||
extern "C" {
|
||||
|
@ -923,7 +923,7 @@ bool TimeSeries::setCos(int row, float value)
|
|||
set = time_series_set_data_cos(m_d, row, value);
|
||||
if (set) {
|
||||
QModelIndex index = createIndex(row, 0, row);
|
||||
emit dataChanged(index, index);
|
||||
Q_EMIT dataChanged(index, index);
|
||||
}
|
||||
return set;
|
||||
}
|
||||
|
@ -939,7 +939,7 @@ bool TimeSeries::setSin(int row, float value)
|
|||
set = time_series_set_data_sin(m_d, row, value);
|
||||
if (set) {
|
||||
QModelIndex index = createIndex(row, 0, row);
|
||||
emit dataChanged(index, index);
|
||||
Q_EMIT dataChanged(index, index);
|
||||
}
|
||||
return set;
|
||||
}
|
||||
|
@ -955,7 +955,7 @@ bool TimeSeries::setTime(int row, float value)
|
|||
set = time_series_set_data_time(m_d, row, value);
|
||||
if (set) {
|
||||
QModelIndex index = createIndex(row, 0, row);
|
||||
emit dataChanged(index, index);
|
||||
Q_EMIT dataChanged(index, index);
|
||||
}
|
||||
return set;
|
||||
}
|
||||
|
@ -1107,14 +1107,14 @@ Demo::Demo(QObject *parent):
|
|||
fibonacciInputChanged,
|
||||
fibonacciResultChanged, m_fibonacciList,
|
||||
[](const FibonacciList* o) {
|
||||
emit o->newDataReady(QModelIndex());
|
||||
Q_EMIT o->newDataReady(QModelIndex());
|
||||
},
|
||||
[](FibonacciList* o) {
|
||||
emit o->layoutAboutToBeChanged();
|
||||
Q_EMIT o->layoutAboutToBeChanged();
|
||||
},
|
||||
[](FibonacciList* o) {
|
||||
o->updatePersistentIndexes();
|
||||
emit o->layoutChanged();
|
||||
Q_EMIT o->layoutChanged();
|
||||
},
|
||||
[](FibonacciList* o, quintptr first, quintptr last) {
|
||||
o->dataChanged(o->createIndex(first, 0, first),
|
||||
|
@ -1149,17 +1149,17 @@ Demo::Demo(QObject *parent):
|
|||
[](const FileSystemTree* o, option_quintptr id) {
|
||||
if (id.some) {
|
||||
int row = file_system_tree_row(o->m_d, id.value);
|
||||
emit o->newDataReady(o->createIndex(row, 0, id.value));
|
||||
Q_EMIT o->newDataReady(o->createIndex(row, 0, id.value));
|
||||
} else {
|
||||
emit o->newDataReady(QModelIndex());
|
||||
Q_EMIT o->newDataReady(QModelIndex());
|
||||
}
|
||||
},
|
||||
[](FileSystemTree* o) {
|
||||
emit o->layoutAboutToBeChanged();
|
||||
Q_EMIT o->layoutAboutToBeChanged();
|
||||
},
|
||||
[](FileSystemTree* o) {
|
||||
o->updatePersistentIndexes();
|
||||
emit o->layoutChanged();
|
||||
Q_EMIT o->layoutChanged();
|
||||
},
|
||||
[](FileSystemTree* o, quintptr first, quintptr last) {
|
||||
quintptr frow = file_system_tree_row(o->m_d, first);
|
||||
|
@ -1216,17 +1216,17 @@ Demo::Demo(QObject *parent):
|
|||
[](const Processes* o, option_quintptr id) {
|
||||
if (id.some) {
|
||||
int row = processes_row(o->m_d, id.value);
|
||||
emit o->newDataReady(o->createIndex(row, 0, id.value));
|
||||
Q_EMIT o->newDataReady(o->createIndex(row, 0, id.value));
|
||||
} else {
|
||||
emit o->newDataReady(QModelIndex());
|
||||
Q_EMIT o->newDataReady(QModelIndex());
|
||||
}
|
||||
},
|
||||
[](Processes* o) {
|
||||
emit o->layoutAboutToBeChanged();
|
||||
Q_EMIT o->layoutAboutToBeChanged();
|
||||
},
|
||||
[](Processes* o) {
|
||||
o->updatePersistentIndexes();
|
||||
emit o->layoutChanged();
|
||||
Q_EMIT o->layoutChanged();
|
||||
},
|
||||
[](Processes* o, quintptr first, quintptr last) {
|
||||
quintptr frow = processes_row(o->m_d, first);
|
||||
|
@ -1280,14 +1280,14 @@ Demo::Demo(QObject *parent):
|
|||
}
|
||||
, m_timeSeries,
|
||||
[](const TimeSeries* o) {
|
||||
emit o->newDataReady(QModelIndex());
|
||||
Q_EMIT o->newDataReady(QModelIndex());
|
||||
},
|
||||
[](TimeSeries* o) {
|
||||
emit o->layoutAboutToBeChanged();
|
||||
Q_EMIT o->layoutAboutToBeChanged();
|
||||
},
|
||||
[](TimeSeries* o) {
|
||||
o->updatePersistentIndexes();
|
||||
emit o->layoutChanged();
|
||||
Q_EMIT o->layoutChanged();
|
||||
},
|
||||
[](TimeSeries* o, quintptr first, quintptr last) {
|
||||
o->dataChanged(o->createIndex(first, 0, first),
|
||||
|
@ -1428,14 +1428,14 @@ FibonacciList::FibonacciList(QObject *parent):
|
|||
QAbstractItemModel(parent),
|
||||
m_d(fibonacci_list_new(this,
|
||||
[](const FibonacciList* o) {
|
||||
emit o->newDataReady(QModelIndex());
|
||||
Q_EMIT o->newDataReady(QModelIndex());
|
||||
},
|
||||
[](FibonacciList* o) {
|
||||
emit o->layoutAboutToBeChanged();
|
||||
Q_EMIT o->layoutAboutToBeChanged();
|
||||
},
|
||||
[](FibonacciList* o) {
|
||||
o->updatePersistentIndexes();
|
||||
emit o->layoutChanged();
|
||||
Q_EMIT o->layoutChanged();
|
||||
},
|
||||
[](FibonacciList* o, quintptr first, quintptr last) {
|
||||
o->dataChanged(o->createIndex(first, 0, first),
|
||||
|
@ -1498,17 +1498,17 @@ FileSystemTree::FileSystemTree(QObject *parent):
|
|||
[](const FileSystemTree* o, option_quintptr id) {
|
||||
if (id.some) {
|
||||
int row = file_system_tree_row(o->m_d, id.value);
|
||||
emit o->newDataReady(o->createIndex(row, 0, id.value));
|
||||
Q_EMIT o->newDataReady(o->createIndex(row, 0, id.value));
|
||||
} else {
|
||||
emit o->newDataReady(QModelIndex());
|
||||
Q_EMIT o->newDataReady(QModelIndex());
|
||||
}
|
||||
},
|
||||
[](FileSystemTree* o) {
|
||||
emit o->layoutAboutToBeChanged();
|
||||
Q_EMIT o->layoutAboutToBeChanged();
|
||||
},
|
||||
[](FileSystemTree* o) {
|
||||
o->updatePersistentIndexes();
|
||||
emit o->layoutChanged();
|
||||
Q_EMIT o->layoutChanged();
|
||||
},
|
||||
[](FileSystemTree* o, quintptr first, quintptr last) {
|
||||
quintptr frow = file_system_tree_row(o->m_d, first);
|
||||
|
@ -1609,17 +1609,17 @@ Processes::Processes(QObject *parent):
|
|||
[](const Processes* o, option_quintptr id) {
|
||||
if (id.some) {
|
||||
int row = processes_row(o->m_d, id.value);
|
||||
emit o->newDataReady(o->createIndex(row, 0, id.value));
|
||||
Q_EMIT o->newDataReady(o->createIndex(row, 0, id.value));
|
||||
} else {
|
||||
emit o->newDataReady(QModelIndex());
|
||||
Q_EMIT o->newDataReady(QModelIndex());
|
||||
}
|
||||
},
|
||||
[](Processes* o) {
|
||||
emit o->layoutAboutToBeChanged();
|
||||
Q_EMIT o->layoutAboutToBeChanged();
|
||||
},
|
||||
[](Processes* o) {
|
||||
o->updatePersistentIndexes();
|
||||
emit o->layoutChanged();
|
||||
Q_EMIT o->layoutChanged();
|
||||
},
|
||||
[](Processes* o, quintptr first, quintptr last) {
|
||||
quintptr frow = processes_row(o->m_d, first);
|
||||
|
@ -1709,14 +1709,14 @@ TimeSeries::TimeSeries(QObject *parent):
|
|||
QAbstractItemModel(parent),
|
||||
m_d(time_series_new(this,
|
||||
[](const TimeSeries* o) {
|
||||
emit o->newDataReady(QModelIndex());
|
||||
Q_EMIT o->newDataReady(QModelIndex());
|
||||
},
|
||||
[](TimeSeries* o) {
|
||||
emit o->layoutAboutToBeChanged();
|
||||
Q_EMIT o->layoutAboutToBeChanged();
|
||||
},
|
||||
[](TimeSeries* o) {
|
||||
o->updatePersistentIndexes();
|
||||
emit o->layoutChanged();
|
||||
Q_EMIT o->layoutChanged();
|
||||
},
|
||||
[](TimeSeries* o, quintptr first, quintptr last) {
|
||||
o->dataChanged(o->createIndex(first, 0, first),
|
||||
|
|
|
@ -44,7 +44,7 @@ public:
|
|||
Processes* processes();
|
||||
const TimeSeries* timeSeries() const;
|
||||
TimeSeries* timeSeries();
|
||||
signals:
|
||||
Q_SIGNALS:
|
||||
void fibonacciChanged();
|
||||
void fibonacciListChanged();
|
||||
void fileSystemTreeChanged();
|
||||
|
@ -70,7 +70,7 @@ public:
|
|||
quint32 input() const;
|
||||
void setInput(quint32 v);
|
||||
quint64 result() const;
|
||||
signals:
|
||||
Q_SIGNALS:
|
||||
void inputChanged();
|
||||
void resultChanged();
|
||||
};
|
||||
|
@ -108,14 +108,14 @@ public:
|
|||
Q_INVOKABLE quint64 fibonacciNumber(int row) const;
|
||||
Q_INVOKABLE quint64 row(int row) const;
|
||||
|
||||
signals:
|
||||
Q_SIGNALS:
|
||||
// new data is ready to be made available to the model with fetchMore()
|
||||
void newDataReady(const QModelIndex &parent) const;
|
||||
private:
|
||||
QHash<QPair<int,Qt::ItemDataRole>, QVariant> m_headerData;
|
||||
void initHeaderData();
|
||||
void updatePersistentIndexes();
|
||||
signals:
|
||||
Q_SIGNALS:
|
||||
};
|
||||
|
||||
class FileSystemTree : public QAbstractItemModel
|
||||
|
@ -158,14 +158,14 @@ public:
|
|||
Q_INVOKABLE QVariant fileSize(const QModelIndex& index) const;
|
||||
Q_INVOKABLE qint32 fileType(const QModelIndex& index) const;
|
||||
|
||||
signals:
|
||||
Q_SIGNALS:
|
||||
// new data is ready to be made available to the model with fetchMore()
|
||||
void newDataReady(const QModelIndex &parent) const;
|
||||
private:
|
||||
QHash<QPair<int,Qt::ItemDataRole>, QVariant> m_headerData;
|
||||
void initHeaderData();
|
||||
void updatePersistentIndexes();
|
||||
signals:
|
||||
Q_SIGNALS:
|
||||
void pathChanged();
|
||||
};
|
||||
|
||||
|
@ -210,14 +210,14 @@ public:
|
|||
Q_INVOKABLE quint32 pid(const QModelIndex& index) const;
|
||||
Q_INVOKABLE quint32 uid(const QModelIndex& index) const;
|
||||
|
||||
signals:
|
||||
Q_SIGNALS:
|
||||
// new data is ready to be made available to the model with fetchMore()
|
||||
void newDataReady(const QModelIndex &parent) const;
|
||||
private:
|
||||
QHash<QPair<int,Qt::ItemDataRole>, QVariant> m_headerData;
|
||||
void initHeaderData();
|
||||
void updatePersistentIndexes();
|
||||
signals:
|
||||
Q_SIGNALS:
|
||||
void activeChanged();
|
||||
};
|
||||
|
||||
|
@ -259,13 +259,13 @@ public:
|
|||
Q_INVOKABLE float time(int row) const;
|
||||
Q_INVOKABLE bool setTime(int row, float value);
|
||||
|
||||
signals:
|
||||
Q_SIGNALS:
|
||||
// new data is ready to be made available to the model with fetchMore()
|
||||
void newDataReady(const QModelIndex &parent) const;
|
||||
private:
|
||||
QHash<QPair<int,Qt::ItemDataRole>, QVariant> m_headerData;
|
||||
void initHeaderData();
|
||||
void updatePersistentIndexes();
|
||||
signals:
|
||||
Q_SIGNALS:
|
||||
};
|
||||
#endif // BINDINGS_H
|
||||
|
|
24
src/cpp.cpp
24
src/cpp.cpp
|
@ -111,7 +111,7 @@ void writeHeaderItemModel(QTextStream& h, const Object& o) {
|
|||
}
|
||||
}
|
||||
h << R"(
|
||||
signals:
|
||||
Q_SIGNALS:
|
||||
// new data is ready to be made available to the model with fetchMore()
|
||||
void newDataReady(const QModelIndex &parent) const;
|
||||
private:
|
||||
|
@ -215,7 +215,7 @@ void writeModelGetterSetter(QTextStream& cpp, const QString& index,
|
|||
if (o.type == ObjectType::List) {
|
||||
cpp << R"( if (set) {
|
||||
QModelIndex index = createIndex(row, 0, row);
|
||||
emit dataChanged(index, index);
|
||||
Q_EMIT dataChanged(index, index);
|
||||
}
|
||||
return set;
|
||||
}
|
||||
|
@ -223,7 +223,7 @@ void writeModelGetterSetter(QTextStream& cpp, const QString& index,
|
|||
)";
|
||||
} else {
|
||||
cpp << R"( if (set) {
|
||||
emit dataChanged(index, index);
|
||||
Q_EMIT dataChanged(index, index);
|
||||
}
|
||||
return set;
|
||||
}
|
||||
|
@ -636,7 +636,7 @@ public:
|
|||
if (baseType(o) == "QAbstractItemModel") {
|
||||
writeHeaderItemModel(h, o);
|
||||
}
|
||||
h << "signals:" << endl;
|
||||
h << "Q_SIGNALS:" << endl;
|
||||
for (auto p: o.properties) {
|
||||
h << " void " << p.name << "Changed();" << endl;
|
||||
}
|
||||
|
@ -703,14 +703,14 @@ void constructorArgs(QTextStream& cpp, const QString& prefix, const Object& o, c
|
|||
if (o.type == ObjectType::List) {
|
||||
cpp << QString(R"(,
|
||||
[](const %1* o) {
|
||||
emit o->newDataReady(QModelIndex());
|
||||
Q_EMIT o->newDataReady(QModelIndex());
|
||||
},
|
||||
[](%1* o) {
|
||||
emit o->layoutAboutToBeChanged();
|
||||
Q_EMIT o->layoutAboutToBeChanged();
|
||||
},
|
||||
[](%1* o) {
|
||||
o->updatePersistentIndexes();
|
||||
emit o->layoutChanged();
|
||||
Q_EMIT o->layoutChanged();
|
||||
},
|
||||
[](%1* o, quintptr first, quintptr last) {
|
||||
o->dataChanged(o->createIndex(first, 0, first),
|
||||
|
@ -747,17 +747,17 @@ void constructorArgs(QTextStream& cpp, const QString& prefix, const Object& o, c
|
|||
[](const %1* o, option_quintptr id) {
|
||||
if (id.some) {
|
||||
int row = %2_row(o->m_d, id.value);
|
||||
emit o->newDataReady(o->createIndex(row, 0, id.value));
|
||||
Q_EMIT o->newDataReady(o->createIndex(row, 0, id.value));
|
||||
} else {
|
||||
emit o->newDataReady(QModelIndex());
|
||||
Q_EMIT o->newDataReady(QModelIndex());
|
||||
}
|
||||
},
|
||||
[](%1* o) {
|
||||
emit o->layoutAboutToBeChanged();
|
||||
Q_EMIT o->layoutAboutToBeChanged();
|
||||
},
|
||||
[](%1* o) {
|
||||
o->updatePersistentIndexes();
|
||||
emit o->layoutChanged();
|
||||
Q_EMIT o->layoutChanged();
|
||||
},
|
||||
[](%1* o, quintptr first, quintptr last) {
|
||||
quintptr frow = %2_row(o->m_d, first);
|
||||
|
@ -1173,7 +1173,7 @@ namespace {
|
|||
continue;
|
||||
}
|
||||
cpp << " inline void " << changedF(o, p) << "(" << o.name << "* o)\n";
|
||||
cpp << " {\n emit o->" << p.name << "Changed();\n }\n";
|
||||
cpp << " {\n Q_EMIT o->" << p.name << "Changed();\n }\n";
|
||||
}
|
||||
}
|
||||
cpp << "}\n";
|
||||
|
|
|
@ -19,7 +19,7 @@ namespace {
|
|||
}
|
||||
inline void personUserNameChanged(Person* o)
|
||||
{
|
||||
emit o->userNameChanged();
|
||||
Q_EMIT o->userNameChanged();
|
||||
}
|
||||
}
|
||||
extern "C" {
|
||||
|
|
|
@ -28,7 +28,7 @@ public:
|
|||
Q_INVOKABLE QString quote(const QString& prefix, const QString& suffix) const;
|
||||
Q_INVOKABLE QByteArray quoteBytes(const QByteArray& prefix, const QByteArray& suffix) const;
|
||||
Q_INVOKABLE quint8 vowelsInName() const;
|
||||
signals:
|
||||
Q_SIGNALS:
|
||||
void userNameChanged();
|
||||
};
|
||||
#endif // TEST_FUNCTIONS_RUST_H
|
||||
|
|
|
@ -117,7 +117,7 @@ bool NoRole::setUserAge(int row, quint8 value)
|
|||
set = no_role_set_data_user_age(m_d, row, value);
|
||||
if (set) {
|
||||
QModelIndex index = createIndex(row, 0, row);
|
||||
emit dataChanged(index, index);
|
||||
Q_EMIT dataChanged(index, index);
|
||||
}
|
||||
return set;
|
||||
}
|
||||
|
@ -135,7 +135,7 @@ bool NoRole::setUserName(int row, const QString& value)
|
|||
set = no_role_set_data_user_name(m_d, row, value.utf16(), value.length());
|
||||
if (set) {
|
||||
QModelIndex index = createIndex(row, 0, row);
|
||||
emit dataChanged(index, index);
|
||||
Q_EMIT dataChanged(index, index);
|
||||
}
|
||||
return set;
|
||||
}
|
||||
|
@ -312,7 +312,7 @@ bool Persons::setUserName(int row, const QString& value)
|
|||
set = persons_set_data_user_name(m_d, row, value.utf16(), value.length());
|
||||
if (set) {
|
||||
QModelIndex index = createIndex(row, 0, row);
|
||||
emit dataChanged(index, index);
|
||||
Q_EMIT dataChanged(index, index);
|
||||
}
|
||||
return set;
|
||||
}
|
||||
|
@ -407,14 +407,14 @@ NoRole::NoRole(QObject *parent):
|
|||
QAbstractItemModel(parent),
|
||||
m_d(no_role_new(this,
|
||||
[](const NoRole* o) {
|
||||
emit o->newDataReady(QModelIndex());
|
||||
Q_EMIT o->newDataReady(QModelIndex());
|
||||
},
|
||||
[](NoRole* o) {
|
||||
emit o->layoutAboutToBeChanged();
|
||||
Q_EMIT o->layoutAboutToBeChanged();
|
||||
},
|
||||
[](NoRole* o) {
|
||||
o->updatePersistentIndexes();
|
||||
emit o->layoutChanged();
|
||||
Q_EMIT o->layoutChanged();
|
||||
},
|
||||
[](NoRole* o, quintptr first, quintptr last) {
|
||||
o->dataChanged(o->createIndex(first, 0, first),
|
||||
|
@ -472,14 +472,14 @@ Persons::Persons(QObject *parent):
|
|||
QAbstractItemModel(parent),
|
||||
m_d(persons_new(this,
|
||||
[](const Persons* o) {
|
||||
emit o->newDataReady(QModelIndex());
|
||||
Q_EMIT o->newDataReady(QModelIndex());
|
||||
},
|
||||
[](Persons* o) {
|
||||
emit o->layoutAboutToBeChanged();
|
||||
Q_EMIT o->layoutAboutToBeChanged();
|
||||
},
|
||||
[](Persons* o) {
|
||||
o->updatePersistentIndexes();
|
||||
emit o->layoutChanged();
|
||||
Q_EMIT o->layoutChanged();
|
||||
},
|
||||
[](Persons* o, quintptr first, quintptr last) {
|
||||
o->dataChanged(o->createIndex(first, 0, first),
|
||||
|
|
|
@ -43,14 +43,14 @@ public:
|
|||
Q_INVOKABLE QString userName(int row) const;
|
||||
Q_INVOKABLE bool setUserName(int row, const QString& value);
|
||||
|
||||
signals:
|
||||
Q_SIGNALS:
|
||||
// new data is ready to be made available to the model with fetchMore()
|
||||
void newDataReady(const QModelIndex &parent) const;
|
||||
private:
|
||||
QHash<QPair<int,Qt::ItemDataRole>, QVariant> m_headerData;
|
||||
void initHeaderData();
|
||||
void updatePersistentIndexes();
|
||||
signals:
|
||||
Q_SIGNALS:
|
||||
};
|
||||
|
||||
class Persons : public QAbstractItemModel
|
||||
|
@ -86,13 +86,13 @@ public:
|
|||
Q_INVOKABLE QString userName(int row) const;
|
||||
Q_INVOKABLE bool setUserName(int row, const QString& value);
|
||||
|
||||
signals:
|
||||
Q_SIGNALS:
|
||||
// new data is ready to be made available to the model with fetchMore()
|
||||
void newDataReady(const QModelIndex &parent) const;
|
||||
private:
|
||||
QHash<QPair<int,Qt::ItemDataRole>, QVariant> m_headerData;
|
||||
void initHeaderData();
|
||||
void updatePersistentIndexes();
|
||||
signals:
|
||||
Q_SIGNALS:
|
||||
};
|
||||
#endif // TEST_LIST_RUST_H
|
||||
|
|
|
@ -171,7 +171,7 @@ bool List::setBoolean(int row, bool value)
|
|||
set = list_set_data_boolean(m_d, row, value);
|
||||
if (set) {
|
||||
QModelIndex index = createIndex(row, 0, row);
|
||||
emit dataChanged(index, index);
|
||||
Q_EMIT dataChanged(index, index);
|
||||
}
|
||||
return set;
|
||||
}
|
||||
|
@ -189,7 +189,7 @@ bool List::setBytearray(int row, const QByteArray& value)
|
|||
set = list_set_data_bytearray(m_d, row, value.data(), value.length());
|
||||
if (set) {
|
||||
QModelIndex index = createIndex(row, 0, row);
|
||||
emit dataChanged(index, index);
|
||||
Q_EMIT dataChanged(index, index);
|
||||
}
|
||||
return set;
|
||||
}
|
||||
|
@ -205,7 +205,7 @@ bool List::setF32(int row, float value)
|
|||
set = list_set_data_f32(m_d, row, value);
|
||||
if (set) {
|
||||
QModelIndex index = createIndex(row, 0, row);
|
||||
emit dataChanged(index, index);
|
||||
Q_EMIT dataChanged(index, index);
|
||||
}
|
||||
return set;
|
||||
}
|
||||
|
@ -221,7 +221,7 @@ bool List::setF64(int row, double value)
|
|||
set = list_set_data_f64(m_d, row, value);
|
||||
if (set) {
|
||||
QModelIndex index = createIndex(row, 0, row);
|
||||
emit dataChanged(index, index);
|
||||
Q_EMIT dataChanged(index, index);
|
||||
}
|
||||
return set;
|
||||
}
|
||||
|
@ -237,7 +237,7 @@ bool List::setI16(int row, qint16 value)
|
|||
set = list_set_data_i16(m_d, row, value);
|
||||
if (set) {
|
||||
QModelIndex index = createIndex(row, 0, row);
|
||||
emit dataChanged(index, index);
|
||||
Q_EMIT dataChanged(index, index);
|
||||
}
|
||||
return set;
|
||||
}
|
||||
|
@ -253,7 +253,7 @@ bool List::setI32(int row, qint32 value)
|
|||
set = list_set_data_i32(m_d, row, value);
|
||||
if (set) {
|
||||
QModelIndex index = createIndex(row, 0, row);
|
||||
emit dataChanged(index, index);
|
||||
Q_EMIT dataChanged(index, index);
|
||||
}
|
||||
return set;
|
||||
}
|
||||
|
@ -269,7 +269,7 @@ bool List::setI64(int row, qint64 value)
|
|||
set = list_set_data_i64(m_d, row, value);
|
||||
if (set) {
|
||||
QModelIndex index = createIndex(row, 0, row);
|
||||
emit dataChanged(index, index);
|
||||
Q_EMIT dataChanged(index, index);
|
||||
}
|
||||
return set;
|
||||
}
|
||||
|
@ -285,7 +285,7 @@ bool List::setI8(int row, qint8 value)
|
|||
set = list_set_data_i8(m_d, row, value);
|
||||
if (set) {
|
||||
QModelIndex index = createIndex(row, 0, row);
|
||||
emit dataChanged(index, index);
|
||||
Q_EMIT dataChanged(index, index);
|
||||
}
|
||||
return set;
|
||||
}
|
||||
|
@ -310,7 +310,7 @@ bool List::setOptionalBoolean(int row, const QVariant& value)
|
|||
}
|
||||
if (set) {
|
||||
QModelIndex index = createIndex(row, 0, row);
|
||||
emit dataChanged(index, index);
|
||||
Q_EMIT dataChanged(index, index);
|
||||
}
|
||||
return set;
|
||||
}
|
||||
|
@ -332,7 +332,7 @@ bool List::setOptionalBytearray(int row, const QByteArray& value)
|
|||
}
|
||||
if (set) {
|
||||
QModelIndex index = createIndex(row, 0, row);
|
||||
emit dataChanged(index, index);
|
||||
Q_EMIT dataChanged(index, index);
|
||||
}
|
||||
return set;
|
||||
}
|
||||
|
@ -354,7 +354,7 @@ bool List::setOptionalString(int row, const QString& value)
|
|||
}
|
||||
if (set) {
|
||||
QModelIndex index = createIndex(row, 0, row);
|
||||
emit dataChanged(index, index);
|
||||
Q_EMIT dataChanged(index, index);
|
||||
}
|
||||
return set;
|
||||
}
|
||||
|
@ -372,7 +372,7 @@ bool List::setString(int row, const QString& value)
|
|||
set = list_set_data_string(m_d, row, value.utf16(), value.length());
|
||||
if (set) {
|
||||
QModelIndex index = createIndex(row, 0, row);
|
||||
emit dataChanged(index, index);
|
||||
Q_EMIT dataChanged(index, index);
|
||||
}
|
||||
return set;
|
||||
}
|
||||
|
@ -388,7 +388,7 @@ bool List::setU16(int row, quint16 value)
|
|||
set = list_set_data_u16(m_d, row, value);
|
||||
if (set) {
|
||||
QModelIndex index = createIndex(row, 0, row);
|
||||
emit dataChanged(index, index);
|
||||
Q_EMIT dataChanged(index, index);
|
||||
}
|
||||
return set;
|
||||
}
|
||||
|
@ -404,7 +404,7 @@ bool List::setU32(int row, quint32 value)
|
|||
set = list_set_data_u32(m_d, row, value);
|
||||
if (set) {
|
||||
QModelIndex index = createIndex(row, 0, row);
|
||||
emit dataChanged(index, index);
|
||||
Q_EMIT dataChanged(index, index);
|
||||
}
|
||||
return set;
|
||||
}
|
||||
|
@ -420,7 +420,7 @@ bool List::setU64(int row, quint64 value)
|
|||
set = list_set_data_u64(m_d, row, value);
|
||||
if (set) {
|
||||
QModelIndex index = createIndex(row, 0, row);
|
||||
emit dataChanged(index, index);
|
||||
Q_EMIT dataChanged(index, index);
|
||||
}
|
||||
return set;
|
||||
}
|
||||
|
@ -436,7 +436,7 @@ bool List::setU8(int row, quint8 value)
|
|||
set = list_set_data_u8(m_d, row, value);
|
||||
if (set) {
|
||||
QModelIndex index = createIndex(row, 0, row);
|
||||
emit dataChanged(index, index);
|
||||
Q_EMIT dataChanged(index, index);
|
||||
}
|
||||
return set;
|
||||
}
|
||||
|
@ -649,14 +649,14 @@ List::List(QObject *parent):
|
|||
QAbstractItemModel(parent),
|
||||
m_d(list_new(this,
|
||||
[](const List* o) {
|
||||
emit o->newDataReady(QModelIndex());
|
||||
Q_EMIT o->newDataReady(QModelIndex());
|
||||
},
|
||||
[](List* o) {
|
||||
emit o->layoutAboutToBeChanged();
|
||||
Q_EMIT o->layoutAboutToBeChanged();
|
||||
},
|
||||
[](List* o) {
|
||||
o->updatePersistentIndexes();
|
||||
emit o->layoutChanged();
|
||||
Q_EMIT o->layoutChanged();
|
||||
},
|
||||
[](List* o, quintptr first, quintptr last) {
|
||||
o->dataChanged(o->createIndex(first, 0, first),
|
||||
|
|
|
@ -70,13 +70,13 @@ public:
|
|||
Q_INVOKABLE quint8 u8(int row) const;
|
||||
Q_INVOKABLE bool setU8(int row, quint8 value);
|
||||
|
||||
signals:
|
||||
Q_SIGNALS:
|
||||
// new data is ready to be made available to the model with fetchMore()
|
||||
void newDataReady(const QModelIndex &parent) const;
|
||||
private:
|
||||
QHash<QPair<int,Qt::ItemDataRole>, QVariant> m_headerData;
|
||||
void initHeaderData();
|
||||
void updatePersistentIndexes();
|
||||
signals:
|
||||
Q_SIGNALS:
|
||||
};
|
||||
#endif // TEST_LIST_TYPES_RUST_H
|
||||
|
|
|
@ -9,7 +9,7 @@ namespace {
|
|||
}
|
||||
inline void personUserNameChanged(Person* o)
|
||||
{
|
||||
emit o->userNameChanged();
|
||||
Q_EMIT o->userNameChanged();
|
||||
}
|
||||
}
|
||||
extern "C" {
|
||||
|
|
|
@ -22,7 +22,7 @@ public:
|
|||
~Person();
|
||||
QString userName() const;
|
||||
void setUserName(const QString& v);
|
||||
signals:
|
||||
Q_SIGNALS:
|
||||
void userNameChanged();
|
||||
};
|
||||
#endif // TEST_OBJECT_RUST_H
|
||||
|
|
|
@ -45,75 +45,75 @@ namespace {
|
|||
}
|
||||
inline void objectBooleanChanged(Object* o)
|
||||
{
|
||||
emit o->booleanChanged();
|
||||
Q_EMIT o->booleanChanged();
|
||||
}
|
||||
inline void objectBytearrayChanged(Object* o)
|
||||
{
|
||||
emit o->bytearrayChanged();
|
||||
Q_EMIT o->bytearrayChanged();
|
||||
}
|
||||
inline void objectF32Changed(Object* o)
|
||||
{
|
||||
emit o->f32Changed();
|
||||
Q_EMIT o->f32Changed();
|
||||
}
|
||||
inline void objectF64Changed(Object* o)
|
||||
{
|
||||
emit o->f64Changed();
|
||||
Q_EMIT o->f64Changed();
|
||||
}
|
||||
inline void objectI16Changed(Object* o)
|
||||
{
|
||||
emit o->i16Changed();
|
||||
Q_EMIT o->i16Changed();
|
||||
}
|
||||
inline void objectI32Changed(Object* o)
|
||||
{
|
||||
emit o->i32Changed();
|
||||
Q_EMIT o->i32Changed();
|
||||
}
|
||||
inline void objectI64Changed(Object* o)
|
||||
{
|
||||
emit o->i64Changed();
|
||||
Q_EMIT o->i64Changed();
|
||||
}
|
||||
inline void objectI8Changed(Object* o)
|
||||
{
|
||||
emit o->i8Changed();
|
||||
Q_EMIT o->i8Changed();
|
||||
}
|
||||
inline void objectOptionalBooleanChanged(Object* o)
|
||||
{
|
||||
emit o->optionalBooleanChanged();
|
||||
Q_EMIT o->optionalBooleanChanged();
|
||||
}
|
||||
inline void objectOptionalBytearrayChanged(Object* o)
|
||||
{
|
||||
emit o->optionalBytearrayChanged();
|
||||
Q_EMIT o->optionalBytearrayChanged();
|
||||
}
|
||||
inline void objectOptionalStringChanged(Object* o)
|
||||
{
|
||||
emit o->optionalStringChanged();
|
||||
Q_EMIT o->optionalStringChanged();
|
||||
}
|
||||
inline void objectOptionalU64Changed(Object* o)
|
||||
{
|
||||
emit o->optionalU64Changed();
|
||||
Q_EMIT o->optionalU64Changed();
|
||||
}
|
||||
inline void objectStringChanged(Object* o)
|
||||
{
|
||||
emit o->stringChanged();
|
||||
Q_EMIT o->stringChanged();
|
||||
}
|
||||
inline void objectStringByFunctionChanged(Object* o)
|
||||
{
|
||||
emit o->stringByFunctionChanged();
|
||||
Q_EMIT o->stringByFunctionChanged();
|
||||
}
|
||||
inline void objectU16Changed(Object* o)
|
||||
{
|
||||
emit o->u16Changed();
|
||||
Q_EMIT o->u16Changed();
|
||||
}
|
||||
inline void objectU32Changed(Object* o)
|
||||
{
|
||||
emit o->u32Changed();
|
||||
Q_EMIT o->u32Changed();
|
||||
}
|
||||
inline void objectU64Changed(Object* o)
|
||||
{
|
||||
emit o->u64Changed();
|
||||
Q_EMIT o->u64Changed();
|
||||
}
|
||||
inline void objectU8Changed(Object* o)
|
||||
{
|
||||
emit o->u8Changed();
|
||||
Q_EMIT o->u8Changed();
|
||||
}
|
||||
}
|
||||
extern "C" {
|
||||
|
|
|
@ -73,7 +73,7 @@ public:
|
|||
void setU64(quint64 v);
|
||||
quint8 u8() const;
|
||||
void setU8(quint8 v);
|
||||
signals:
|
||||
Q_SIGNALS:
|
||||
void booleanChanged();
|
||||
void bytearrayChanged();
|
||||
void f32Changed();
|
||||
|
|
|
@ -9,7 +9,7 @@ namespace {
|
|||
}
|
||||
inline void innerObjectDescriptionChanged(InnerObject* o)
|
||||
{
|
||||
emit o->descriptionChanged();
|
||||
Q_EMIT o->descriptionChanged();
|
||||
}
|
||||
}
|
||||
extern "C" {
|
||||
|
|
|
@ -26,7 +26,7 @@ public:
|
|||
~Group();
|
||||
const Person* person() const;
|
||||
Person* person();
|
||||
signals:
|
||||
Q_SIGNALS:
|
||||
void personChanged();
|
||||
};
|
||||
|
||||
|
@ -47,7 +47,7 @@ public:
|
|||
~InnerObject();
|
||||
QString description() const;
|
||||
void setDescription(const QString& v);
|
||||
signals:
|
||||
Q_SIGNALS:
|
||||
void descriptionChanged();
|
||||
};
|
||||
|
||||
|
@ -68,7 +68,7 @@ public:
|
|||
~Person();
|
||||
const InnerObject* object() const;
|
||||
InnerObject* object();
|
||||
signals:
|
||||
Q_SIGNALS:
|
||||
void objectChanged();
|
||||
};
|
||||
#endif // TEST_OBJECTS_RUST_H
|
||||
|
|
|
@ -163,7 +163,7 @@ bool Persons::setUserName(const QModelIndex& index, const QString& value)
|
|||
bool set = false;
|
||||
set = persons_set_data_user_name(m_d, index.internalId(), value.utf16(), value.length());
|
||||
if (set) {
|
||||
emit dataChanged(index, index);
|
||||
Q_EMIT dataChanged(index, index);
|
||||
}
|
||||
return set;
|
||||
}
|
||||
|
@ -260,17 +260,17 @@ Persons::Persons(QObject *parent):
|
|||
[](const Persons* o, option_quintptr id) {
|
||||
if (id.some) {
|
||||
int row = persons_row(o->m_d, id.value);
|
||||
emit o->newDataReady(o->createIndex(row, 0, id.value));
|
||||
Q_EMIT o->newDataReady(o->createIndex(row, 0, id.value));
|
||||
} else {
|
||||
emit o->newDataReady(QModelIndex());
|
||||
Q_EMIT o->newDataReady(QModelIndex());
|
||||
}
|
||||
},
|
||||
[](Persons* o) {
|
||||
emit o->layoutAboutToBeChanged();
|
||||
Q_EMIT o->layoutAboutToBeChanged();
|
||||
},
|
||||
[](Persons* o) {
|
||||
o->updatePersistentIndexes();
|
||||
emit o->layoutChanged();
|
||||
Q_EMIT o->layoutChanged();
|
||||
},
|
||||
[](Persons* o, quintptr first, quintptr last) {
|
||||
quintptr frow = persons_row(o->m_d, first);
|
||||
|
|
|
@ -40,13 +40,13 @@ public:
|
|||
Q_INVOKABLE QString userName(const QModelIndex& index) const;
|
||||
Q_INVOKABLE bool setUserName(const QModelIndex& index, const QString& value);
|
||||
|
||||
signals:
|
||||
Q_SIGNALS:
|
||||
// new data is ready to be made available to the model with fetchMore()
|
||||
void newDataReady(const QModelIndex &parent) const;
|
||||
private:
|
||||
QHash<QPair<int,Qt::ItemDataRole>, QVariant> m_headerData;
|
||||
void initHeaderData();
|
||||
void updatePersistentIndexes();
|
||||
signals:
|
||||
Q_SIGNALS:
|
||||
};
|
||||
#endif // TEST_TREE_RUST_H
|
||||
|
|
Loading…
Reference in New Issue