there are several solutions
but all of them require that you have access to pointers of both classes(button and mainwindow),
you if you are working in button class
//suppose your main window is two level above parent
connect(this,SIGNAL(clicked()),this->parent()->parent(),SLOT(slot()));
//suppose your main window is two level above parent
connect(this,SIGNAL(clicked()),this->parent()->parent(),SLOT(slot()));
To copy to clipboard, switch view to plain text mode
if your are woking in mainwindow class... then somehow get the pointer to button(usually button is directly a memeber of your mainwindow class)
connect(getButton(), SIGNAL(clicked()),this,SLOT(slot()));
connect(getButton(), SIGNAL(clicked()),this,SLOT(slot()));
To copy to clipboard, switch view to plain text mode
Bookmarks