Skip to content

Instantly share code, notes, and snippets.

@FMeinicke
Created May 26, 2023 10:31
Show Gist options
  • Select an option

  • Save FMeinicke/30808ac9622724e4cf369ea3f1fc8a77 to your computer and use it in GitHub Desktop.

Select an option

Save FMeinicke/30808ac9622724e4cf369ea3f1fc8a77 to your computer and use it in GitHub Desktop.
QObjectWrapper - a quick way to wrap any class and make it inherit from `QObject`
template<typename T>
class QObjectWrapper : public T, public QObject
{
Q_OBJECT
public:
explicit QObjectWrapper(QObject* parent = nullptr) : T{}, QObject{parent} {}
};
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment