当前位置: 代码迷 >> QT开发 >> qt按钮字体颜色改不了解决方法
  详细解决方案

qt按钮字体颜色改不了解决方法

热度:373   发布时间:2016-04-25 05:11:43.0
qt按钮字体颜色改不了
程序如下,请高手指教,谢谢
QPalette pal1 = ui->pushButton_1->palette();
  pal1.setColor(QPalette::ButtonText,QColor(255,0,0));
  setPalette(pal1);

------解决方案--------------------
多看看Manual:

Warning: Some styles do not use the palette for all drawing, for instance, if they make use of native theme engines. This is the case for both the Windows XP, Windows Vista, and the Mac OS X styles.


Style sheets let you perform all kinds of customizations that are difficult or impossible to perform using QPalette alone
  相关解决方案