社区
Qt
帖子详情
qpushbutton的背景色
笑笑小懒猪
2012-11-15 10:21:35
通过 ui->jiQiJianShi->setStyleSheet("background-color: rgb(255, 85, 255);");jiQiJianShi为一个qpushbutton,将qpushbutton的背景色改变了,我想恢复为默认的颜色,请问用代码如何实现?用代码如何获取默认的颜色?
...全文
234
2
打赏
收藏
qpushbutton的背景色
通过 ui->jiQiJianShi->setStyleSheet("background-color: rgb(255, 85, 255);");jiQiJianShi为一个qpushbutton,将qpushbutton的背景色改变了,我想恢复为默认的颜色,请问用代码如何实现?用代码如何获取默认的颜色?
复制链接
扫一扫
分享
转发到动态
举报
写回复
配置赞助广告
用AI写文章
2 条
回复
切换为时间正序
请发表友善的回复…
发表回复
打赏红包
__阿飞__
2012-11-16
打赏
举报
回复
默认的话,直接把样式清空即可.
jdwx
2012-11-16
打赏
举报
回复
只要一个空的样式表, ui->jiQiJianShi->setStyleSheet("");
Qt Q
push
button
设置
背景色
的问题
今天发现一个问题,Qt Q
push
button
设置
背景色
只能用代码如下设置,StyleSheet在qt creator中居然只能设置前景色!!!
push
button
->setStyleSheet("background-color:rgb(234,234,234)"); 如下使用palette也无法设置
背景色
! QPalette P=
push
button
->pale
Qt中设置Q
Push
Button
背景色
刚开始编写的设置
背景色
代码用的是QPalette类: QPalette palette1=ui->
push
Button
->palette(); palette1.setColor(QPalette::
Button
Text,Qt::red);//设置字体颜色为红色 palette1.setColor(QPalette::
Button
,Qt::green);//设...
使用QPalette设置Q
Push
Button
背景色
Q
Push
Button
的三个属性中,boolflat 属性会影响到QPalette::
Button
的应用 #include <QtWidgets> int main(int argc, char *argv[]) { QApplication a(argc, argv); Q
Push
Button
btn("Qt::Palette"); QPalette p = btn.palette(); p.setColor(QPalette::
Button
,Qt::.
QT 如何设置 Q
Push
Button
的
背景色
.
//弹出颜色选择框 QColor color = QColorDialog::getColor(Qt::white, this); QPalette pal = ui->
push
Button
_BackGroundColor->palette(); pal.setColor(QPalette::
Button
,color); ui->
push
Button
_BackGroundColor
Qt Q
Push
Button
背景色
正常状态:黑底(
背景色
),白字(前景色),圆角,向外凸起 鼠标停留:背景和前景反色 鼠标按下:
背景色
变为淡蓝色,向内凹陷ui->
push
Button
->setStyleSheet("Q
Push
Button
{background-color:black; color: white; border-radius:10px; border:2px groove gray; border-style:
Qt
21,498
社区成员
26,692
社区内容
发帖
与我相关
我的任务
Qt
Qt 是一个跨平台应用程序框架。通过使用 Qt,您可以一次性开发应用程序和用户界面,然后将其部署到多个桌面和嵌入式操作系统,而无需重复编写源代码。
复制链接
扫一扫
分享
社区描述
Qt 是一个跨平台应用程序框架。通过使用 Qt,您可以一次性开发应用程序和用户界面,然后将其部署到多个桌面和嵌入式操作系统,而无需重复编写源代码。
社区管理员
加入社区
获取链接或二维码
近7日
近30日
至今
加载中
查看更多榜单
社区公告
暂无公告
试试用AI创作助手写篇文章吧
+ 用AI写文章