Please use the code tags to post code, it will keep the indent and make the code more readable
You can do something like:
Make the pointer to the button a member in MyClick class (i'm talking about mybutton)
create a signal MyClick::myButtonWasClicked(); this will signal to outside world that inside your MyClicked object something changed (a button was clicked)
in MyClick constructor connect the mybutton clicked() signal with this myButtonWasClicked() (you can connect a signal to another signal), or since i see you already have a slot connected to the button clicked, you can use emit myButtonWasClicked(); inside that slot.
And then in main:
int main(int argc, char *argv[])
{
MyClick aClick;
OtherClass other;
QObject::connect(aClick,
SIGNAL(myButtonWasClicked
()), other,
SLOT(WHAT_EVER_SLOT_YOU_WANT_TO_CALL
()) );
aClick.show();
other.show();
return a.exec();
}
int main(int argc, char *argv[])
{
QApplication a(argc, argv);
MyClick aClick;
OtherClass other;
QObject::connect(aClick, SIGNAL(myButtonWasClicked()), other, SLOT(WHAT_EVER_SLOT_YOU_WANT_TO_CALL()) );
aClick.show();
other.show();
return a.exec();
}
To copy to clipboard, switch view to plain text mode
Bookmarks