Qt的窗口背景及窗口风格统一与焕肤

button = new QPushButton(this);
button->setStyleSheet("QPushButton{color:red;background:yellow}"); //设定按钮前景颜色-黄色,就是字体颜色-红色


btn1->setStyleSheet("QPushButton{color:red}"); //设定前景颜色,就是字体颜色

   btn1->setStyleSheet("QPushButton{background:yellow}"); //设定背景颜色为红色

 

 

this->setStyleSheet("color:red; background-image:url(:/33.jpg)"); //字体颜色设置成红色(前景色),背景色设置成图片

QT5  样式随笔

 this->setWindowIcon(QIcon(":/image/1.jpg")); //设置图标    如下图:

QT5  样式随笔

 

 

 

 

 

文本框、按钮等变成圆角(内容填充padding)

ui.comboDriver->setStyleSheet("border:2px groove pink;border-radius:10px;padding:2px 16px;");
ui.editDatabase->setStyleSheet("border:2px groove gray;border-radius:10px;padding:2px 16px;");
ui.editPassword->setStyleSheet("border:2px groove blue;border-radius:10px;padding:2px 16px;");
ui.editHostname->setStyleSheet("border:2px groove yellow;border-radius:10px;padding:2px 16px;");
ui.editUsername->setStyleSheet("border:2px groove green;border-radius:10px;padding:2px 16px;");
ui.portSpinBox->setStyleSheet("border:2px groove blue;border-radius:10px;padding:2px 16px;");
效果如下图:

QT5  样式随笔

pushButton->setStyleSheet("border:2px groove gray;border-radius:10px;padding:2px 4px;");  //按钮圆角


 

相关文章:

  • 2021-05-29
  • 2021-08-13
  • 2021-11-01
  • 2022-12-23
  • 2021-05-19
  • 2021-05-05
  • 2022-12-23
猜你喜欢
  • 2021-06-23
  • 2022-12-23
  • 2021-05-13
  • 2021-08-30
  • 2021-09-09
  • 2021-05-27
相关资源
相似解决方案