Hello,
Thanks for the reply.
I have gone through the link, I could not get solution for the problem I am looking for.
I have a QPushButton for which there are different button images to be shown for a particular button depending on some data change.
I mean I have different button images for same feature like ON, OFF and error. To take a decision on whether to show ON or OFF button image I am depending on some data coming from the lower layers. so, what I am trying to do is when this data changes I want to emit an signal with its value so that I can take decision on which button image to be displayed in slot.
I am trying to do the following but it is not working.
//in .h file
public slots:
void generate(int);
signals:
void PSCvalueChanged(int);
//in .h file
public slots:
void generate(int);
signals:
void PSCvalueChanged(int);
To copy to clipboard, switch view to plain text mode
//Connect in Constructor of child class of QMainWindow
connect(ui.pushButton,SIGNAL(PSCvalueChanged(int)),this,SLOT(generate(int)));
//Connect in Constructor of child class of QMainWindow
connect(ui.pushButton,SIGNAL(PSCvalueChanged(int)),this,SLOT(generate(int)));
To copy to clipboard, switch view to plain text mode
//Helper function called by other class when data changes
void MultiGlWindows::emitSignals(int newValue)
{
emit PSCvalueChanged(newValue);
}
//Slot Defnition
void MultiGlWindows::generate(int value)
{
if(value == 3)
{
emit PSCvalueChanged(value);
ui.pushButton->setGeometry(5, 150, 140, 50);
ui.pushButton->setStyleSheet("image: url(:/debug/Images/APS_notactive.png)\n");
}
else{
ui.pushButton->setGeometry(5, 250, 140, 50);
ui.pushButton->setStyleSheet("image: url(:/debug/Images/APS_active.png)\n");
}
}
//Helper function called by other class when data changes
void MultiGlWindows::emitSignals(int newValue)
{
emit PSCvalueChanged(newValue);
}
//Slot Defnition
void MultiGlWindows::generate(int value)
{
if(value == 3)
{
emit PSCvalueChanged(value);
ui.pushButton->setGeometry(5, 150, 140, 50);
ui.pushButton->setStyleSheet("image: url(:/debug/Images/APS_notactive.png)\n");
}
else{
ui.pushButton->setGeometry(5, 250, 140, 50);
ui.pushButton->setStyleSheet("image: url(:/debug/Images/APS_active.png)\n");
}
}
To copy to clipboard, switch view to plain text mode
Could you please tell me where it went wrong? or do I need to follow any alternate approach?
Thanks in Advance!
Bookmarks