In a subclass of QMainWindow, I have created a pointer to a QPushButton:
{
Q_OBJECT
public:
appWindow();
class appWindow : public QMainWindow
{
Q_OBJECT
public:
appWindow();
QPushButton *quit;
To copy to clipboard, switch view to plain text mode
I am trying to use this button to exit the application in main.cpp:
int main(int argc, char *argv[])
{
appWindow mainWindow; //instance of class appWindow
QObject::connect(mainWindow.
*quit,
SIGNAL(clicked
()),
&VocabAide,
SLOT(quit
()));
int main(int argc, char *argv[])
{
QApplication VocabAide(argc, argv);
appWindow mainWindow; //instance of class appWindow
QObject::connect(mainWindow.*quit, SIGNAL(clicked()), &VocabAide, SLOT(quit()));
To copy to clipboard, switch view to plain text mode
appwindow.h is included in main.cpp. I am receiving a single error: ‘quit’ was not declared in this scope.
I'm wondering if the problem has to do with class instance mainWindow not being a child of the QApplication. I don't understand how QApplication fits (or how I make it fit) into the parent-child hierarchy since it doesn't derive from QObject.
Bookmarks