Qt背景设置成黑色,前景设置成白色可以用以下二种方法:[喝小酒的网摘]http://blog./a/8331.htm 方法一、paltette方式,经测试,该方法不会影响到其他控件,推荐使用 QPalette bgpal = palette(); bgpal.setColor (QPalette::Background, QColor (0, 0 , 0, 255)); //bgpal.setColor (QPalette::Background, Qt::transparent); bgpal.setColor (QPalette::Foreground, QColor (255,255,255,255)); setPalette (bgpal); 方法二、stylesheet方式 影响子控件的方法是: setStyleSheet ("background-color: rgb(0,0,0);color: rgb(255,255,255);"); 不影响子控件的方法是: setStyleSheet ("venus--TitleBar {background-color: rgb(0,0,0);color: rgb(255,255,255);}");[喝小酒的网摘]http://blog./a/8331.htm |
|