user_mail07
12th June 2007, 03:14
I am having trouble while loading disable icon to the application. I want to load two separate icons for instance when the push button is enabled I want to keep same icon that I am loading from UI file (coz it is already embedded in ui file ) but when that push button is disabled I want to load separate icon from some source. I want my icons to switch when the push button is enabled or disabled.
For instance :-
If((False = exitWindow)!!(test_mode =! CurrrenyMode))
{
if(pWarningButton)
{
pWarningButton->setEnabled(false);
//
QString str;
pWarningButton->setIconSet(QPixmap(“…1.pngâ€);
}
}
else
{
pWarningButton->setEnabled(true);
}
//pWarningButton is simple push button that I am loading directly from UI file.
Such as:
pWarningButton = (QPushButton*)LoadWindow(mainWindowDlg,strWarning) ;
if(pWarningButton)
{
pWarningButton ->setEnabled(false);
connect(pWarningButton,SIGNAL(clicked()), this, SLOT(Slot1()));
}
The problem with above code is I got the icon that I have passed as parameter 1.png when button was disabled . But when button is enabled it never switches back to original icon of UI file.
IS there any way to switch icons according to enable/disable states? Or Do i have to define each time the source of bitmap when button is enabled or disabled.
For instance :-
If((False = exitWindow)!!(test_mode =! CurrrenyMode))
{
if(pWarningButton)
{
pWarningButton->setEnabled(false);
//
QString str;
pWarningButton->setIconSet(QPixmap(“…1.pngâ€);
}
}
else
{
pWarningButton->setEnabled(true);
}
//pWarningButton is simple push button that I am loading directly from UI file.
Such as:
pWarningButton = (QPushButton*)LoadWindow(mainWindowDlg,strWarning) ;
if(pWarningButton)
{
pWarningButton ->setEnabled(false);
connect(pWarningButton,SIGNAL(clicked()), this, SLOT(Slot1()));
}
The problem with above code is I got the icon that I have passed as parameter 1.png when button was disabled . But when button is enabled it never switches back to original icon of UI file.
IS there any way to switch icons according to enable/disable states? Or Do i have to define each time the source of bitmap when button is enabled or disabled.