It was required to call the lambda on the signal, but not directly, but from the event queue. Trying to connect:
connect(model, &MyModel::modelReset, [this]() {}, Qt::QueuedConnection); The compiler starts swearing. How to win without the need to create a full-fledged method in the classroom?
Addition
Swears at the lack of a suitable method for connect() :
error: no matching function for call to 'MyClass :: connect (MyModel * &, void (QAbstractItemModel :: *) (QAbstractItemModel :: QPrivateSignal), MyClass :: myMethod () ::, Qt :: ConnectionType)' connect (model , & MyModel :: modelReset, this {}, Qt :: QueuedConnection);
Qt::ConnectionTypeworks only if the QObject inheritor is used. - Vladimir GamalyanMyClassis a successor toQAbstractItemModeland, accordingly,QObject. - alexis031182