Let's say we have more than one widgets and all of them have main menu button. so I connected all of the main menu buttons clicked signal to one slot, which is supposed to h
connect(widget1->mainMenuButton, SIGNAL(clicked()),this, SLOT(mainClicked()));
connect(widget1->mainMenuButton, SIGNAL(clicked()),this, SLOT(mainClicked()));
and I have
private slots:
void mainClicked();
in mainClicked I want to hide whoever triggered the clicked signal. frame1 or frame2 in the above example.
I could use sender() to retrieve the QObject that triggered the signal but then how can I call hide which is QWidget function?
your help is appreciated.
I think this should work:
dynamic_cast<QWidget*>(sender()) -> hide() ;