Quantcast
Viewing all articles
Browse latest Browse all 13965

Multiple windows signal slot problem

Hi guys, happy new year! I am a very new bird with Qt and am writing a small project with 2 windows: a preference window and a bargraph window. In preference window you can change the configurations like color, size usw., and the bar in the bargraph window should be changed correspongdingly. Now I am focus on the color change function. I added a color choose button on the preference window and with clicking it the slot function selectBarColor will be called and a QColorDialog can be opened. At the end of this funtion I tried to send the signal like this: connect(&d, SIGNAL(colorSelected(const QColor&)), &bargraph, SLOT(setColor(const QColor&))); with d is the QColorDialog object and bargraph is a Bargraph object. And I wrote the slot setColor in Bargraph like this: void Bargraph::setColor(const QColor & color) {     barColor = color;     update(); } But it didn’t work, it seems the setColor slot didn’t get the signal. What could be the problems here? Thanks a lot!

Viewing all articles
Browse latest Browse all 13965

Trending Articles