新手上路
- 积分
- 30
- 金钱
- 30
- 注册时间
- 2020-9-3
- 在线时间
- 7 小时
|
3金钱
QT中如何获取控件的背景颜色或者边框颜色呢,在网上所找到的
QColor bgColor(0,0,0); this->setStyleSheet("background-color: rgb(254, 41, 252);"); bgColor = ui->label->palette().color(QPalette::Background);
或者
QPalette pal=ui->label->palette(); //这里需要注意,输入性质的控件(如这里的lineEdit)用base(),如果是按钮用button(),不然获取不到 QBrush brush=pal.background(); QColor color=brush.color();
所获取到的label或者其它控件的值 无论怎么修改 rgb的r值都240 求助
|
|