Category : qobject

I have a couple of classes: A.h class Abase_obj : public QObject { Q_OBJECT Q_PROPERTY(QAction* playAction READ playAction CONSTANT) /* Question: should I define playAction() in this class or can just declare it here as pure virtual and define it in Abase class? */ public: Abase_obj(QObject* parent = nullptr) : QObject(parent) {} signals: void someSignal() ..

Read more

In Qt, how does one avoid race conditions if signals can be emitted around the same time when I connect to them? Consider the following naïve example: MySignalSender *sender = new MySignalSender(); // starts async operation that emits `fooSignal` // <– Possibility (1): `fooSignal` can be emitted here MySignalReceiver *receiver = new MySignalReceiver(); // <– ..

Read more

In Qt, how does one avoid race conditions if signals can be emitted around the same time when I connect to them? Consider the following naïve example: MySignalSender *sender = new MySignalSender(); // starts async operation that emits `fooSignal` // <– Possibility (1): `fooSignal` can be emitted here MySignalReceiver *receiver = new MySignalReceiver(); // <– ..

Read more

I have a QObject SystemdDBusManager that can return other QObjects (Unit class). Those objects do not have any reason to be owned by SystemdDBusManager, but according to the Qt documentation, this can imply that the returned object is owned by SystemdDBusManager. class SystemdDBusManager : public QObject { Q_OBJECT public: Unit *getUnit(QString const &name); }; What ..

Read more