Waiting for qt signal in c++ function
-
wrote on 24 Jul 2023, 18:59 last edited by
Hi,
im search way to recive signal from qt object in c++fnx(){
QSharedPointer client; //pointer to qt object
client->doSomeWork(); //its emit done when finished.
...
next operations.
} -
Its function only, but i will try pass it to doSomeWork, thanks for help :)
@NewbieQTUser You can also connect a function:
void fnx() { client->doSomeWork(); QObject::connect(client, &ClientClass::done, &doStuff); } void doStuff() { // following operations }
-
Hi,
Why not connect that signal to a function that will continue the processing ?
-
Hi,
im search way to recive signal from qt object in c++fnx(){
QSharedPointer client; //pointer to qt object
client->doSomeWork(); //its emit done when finished.
...
next operations.
}void MyClass::fnx() { client->doSomeWork(); connect(client, &ClientClass::done, this, &MyClass::doStuff); } void MyClass::doStuff() { // following operations }
-
wrote on 24 Jul 2023, 19:26 last edited by
Im calling it from generic c++ app, i cant use connect syntax
-
Im calling it from generic c++ app, i cant use connect syntax
@NewbieQTUser What do you mean you can't? If
client
emits a signal it means it's a QObject. If you're accessing QObjects you can access connect. Qt is generic C++, so could you explain what's your problem exactly? -
Im calling it from generic c++ app, i cant use connect syntax
connect is a static method so you still can.
Otherwise, you can pass that method to your doSomeWork function so that it can be connected to by your class.
-
connect is a static method so you still can.
Otherwise, you can pass that method to your doSomeWork function so that it can be connected to by your class.
wrote on 24 Jul 2023, 19:44 last edited byIts function only, but i will try pass it to doSomeWork, thanks for help :)
-
Its function only, but i will try pass it to doSomeWork, thanks for help :)
@NewbieQTUser You can also connect a function:
void fnx() { client->doSomeWork(); QObject::connect(client, &ClientClass::done, &doStuff); } void doStuff() { // following operations }
-
@NewbieQTUser You can also connect a function:
void fnx() { client->doSomeWork(); QObject::connect(client, &ClientClass::done, &doStuff); } void doStuff() { // following operations }
wrote on 24 Jul 2023, 20:11 last edited by@Chris-Kawa said in Waiting for qt signal in c++ function:
@NewbieQTUser You can also connect a function:
void fnx() { client->doSomeWork(); QObject::connect(client, &ClientClass::done, &doStuff); } void doStuff() { // following operations }
Also thx, looks like a good solution
-
1/9