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 :

Qt Code:
  1. QPalette::ColorRole role=ui->btn_curveColor->backgroundRole();
  2. curveColor=ui->btn_curveColor->palette().color(role);
  3. int r=curveColor.red();
  4. int g=curveColor.green();
  5. int b=curveColor.blue();
  6. int a=curveColor.alpha();
  7.  
  8. QString role1=ui->btn_curveColor->windowRole();
  9.  
  10. cout<<"Use backgroundRole : r="<<r<<"\tg="<<g<<"\tb="<<b<<"\ta="<<a<<endl;
  11. cout<<"Use windowRole : "<<role1.toAscii().data()<<endl;
To copy to clipboard, switch view to plain text mode 

I get :
Qt Code:
  1. Use backgroundRole : r=236 g=233 b=216 a=255
  2. 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




Quote Originally Posted by anda_skoa View Post
Have you tried the Background or Window roles?

Cheers,
_