I have started database loading in non-GUI thread with QtCuncurrent::run. In this nonGui thread I have to create QStandardItemModel* and after that I received model in GUI thread with
model = modelWatcher.result();
on QFutureWatcher finished() signal. It works pretty (UI is builded successfully), but itemChanged() signal is not emitted on item data changes (checkbox state changed). When I creates the model in GUI thread, there are no collisions. Connect works without assert fails:
bool ok = connect(model, SIGNAL(itemChanged(QStandardItem*)), this, SLOT(onFolderStateChanged(QStandardItem*)), static_cast<Qt::ConnectionType>(Qt::UniqueConnection));
Q_ASSERT(ok);
As I can see in that thread (there are no code samples and I misunderstood the main idea) I can't to create model (part of Qt5Gui) in nonGui thread. But it works for me! Ui is builded) Also I have to declare sended type with:
qRegisterMetaType<QStandardItemModel*>("QStandardItemModel*");
And my other sends like:
qRegisterMetaType<QList<QTreeWidgetItem*> >("QList<QTreeWidgetItem*>");
works good (though its also Qt5Gui part).
I dont understand how can I **get the model from nonGui thread with full functionality** like itemChanged signals?
It
s something like emit mysignal(QStandardItemModel*);
?
In that case, why other tasks works fine without any emit`s ? including currentChanged signals etc.