hello, anda_skoa:
According to your opinion ,i use Background or Window roles. however, i don't get the result as i except.
my code is :
QPalette::ColorRole role
=ui
->btn_curveColor
->backgroundRole
();
curveColor=ui->btn_curveColor->palette().color(role);
int r=curveColor.red();
int g=curveColor.green();
int b=curveColor.blue();
int a=curveColor.alpha();
QString role1
=ui
->btn_curveColor
->windowRole
();
cout<<"Use backgroundRole : r="<<r<<"\tg="<<g<<"\tb="<<b<<"\ta="<<a<<endl;
cout<<"Use windowRole : "<<role1.toAscii().data()<<endl;
QPalette::ColorRole role=ui->btn_curveColor->backgroundRole();
curveColor=ui->btn_curveColor->palette().color(role);
int r=curveColor.red();
int g=curveColor.green();
int b=curveColor.blue();
int a=curveColor.alpha();
QString role1=ui->btn_curveColor->windowRole();
cout<<"Use backgroundRole : r="<<r<<"\tg="<<g<<"\tb="<<b<<"\ta="<<a<<endl;
cout<<"Use windowRole : "<<role1.toAscii().data()<<endl;
To copy to clipboard, switch view to plain text mode
I get :
Use backgroundRole : r=236 g=233 b=216 a=255
Use windowRole :
Use backgroundRole : r=236 g=233 b=216 a=255
Use windowRole :
To copy to clipboard, switch view to plain text mode
in debug mode. i check the value of role is Button(1), and the role1 is a empty string.
help me please.
Micky Jhon

Originally Posted by
anda_skoa
Have you tried the Background or Window roles?
Cheers,
_
Bookmarks