gpt4 book ai didi

c++ - 在 QT Creator 中更改按钮的颜色

转载 作者:行者123 更新时间:2023-11-30 00:41:07 25 4
gpt4 key购买 nike

如何更改按钮颜色?我已经找到了通过写作来做到这一点的方法

button->setStyleSheet("* { background-color: rgb(255,125,100) }");

在 Ui_Window.h 中

但每次我 qmake 时,Ui_Window.h 都会被重新制作,我会失去颜色。

有谁知道如何永久保留按钮的颜色?我正在使用 QT Creator。如果有人可以指导我 =D

非常感谢!

最佳答案

  • 最简单的方法是在按钮上使用样式表:

    backgroundColourButton->setStyleSheet("background-color: red");

关于c++ - 在 QT Creator 中更改按钮的颜色,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/4394289/

25 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com