View Full Version : How to connect signal to signal in QWidget correctly

5th February 2013, 16:11
Hi everyone!

I am having trouble with conneting two signals.
I have WindowsMenu and there is PlotBackgroundMenuinside.
BackgroundColorChanged(CPlotBackgroundMenu::Backgr oundColor color) signal is emited in PlotColorMenu (Color is enum) when one of the menu's actions is trigged.

I did following in WindowMenu:

void CWindowsMenu::makeConnections()
connect(PlotBackgroundMenu,SIGNAL(BackgroundColorC hanged(CPlotBackgroundMenu::BackgroundColor)),
this,SIGNAL(BackColorChanged(CPlotBackgroundMenu:: BackgroundColor)));

and I called makeConnections() in WindowMenu constractor.

Then I used the signal BackColorChanged in MainWindow to connect it with the slot to actually change the color.

It didn't work.

What am I missing?

P.S. I read QWidget references and searched for examples, still don't get it :(

Thank you!

Santosh Reddy
5th February 2013, 16:28
Check for any error in Application output

6th February 2013, 01:06
It didn't work.

What didn't work?

The MainWindow slot didn't get invoked?

The background color didn't change?

The WindowMenu signal wasn't emitted in the first place?

You've shown us 5 lines of code out of what is obviously a multi-step signal / slot handling sequence. Why do you assume that something is wrong with the connect statement? The error could be anywhere in the code you aren't showing us.

Post a minimal example that demonstrates the problem, and we might be able to help you find what is wrong.