I second what Marcel says. I'd even suggest subclassing QApplication and putting your object as a member of the application.
public:
m_x = new X(this);
}
X *x() const { return m_x; }
private:
X *m_x;
};
class MyApp : public QApplication{
public:
MyApp(int a, char **b) : QApplication(a,b){
m_x = new X(this);
}
X *x() const { return m_x; }
private:
X *m_x;
};
To copy to clipboard, switch view to plain text mode
A redefinition of qApp might also come in handy:
#ifdef qApp
#undef qApp
#endif
#define qApp static_cast<MyApp*>(QCoreApplication::instance())
#ifdef qApp
#undef qApp
#endif
#define qApp static_cast<MyApp*>(QCoreApplication::instance())
To copy to clipboard, switch view to plain text mode
Bookmarks