Qt中使用stylesheet方式将按钮设置成圆角按钮,代码如下:

setStyleSheet("border:2px groove gray;border-radius:10px;padding:2px 4px;");

如pushButton如下用法:

pushButton->setStyleSheet("border:2px groove gray;border-radius:10px;padding:2px 4px;");


更多>setStyleSheet用法如下:

qApp->setStyleSheet("QLineEdit { background-color: yellow }");

myDialog->setStyleSheet("QLineEdit { background-color: yellow }");

myDialog->setStyleSheet("QLineEdit#nameEdit { background-color: yellow }");

nameEdit->setStyleSheet("background-color: yellow");

nameEdit->setStyleSheet("color: blue; background-color: yellow");

nameEdit->setStyleSheet("color: blue;"
                         "background-color: yellow;"
                         "selection-color: yellow;"
                         "selection-background-color: blue;");

相关文章:

  • 2022-12-23
  • 2022-12-23
  • 2021-07-18
  • 2022-12-23
  • 2022-12-23
  • 2022-12-23
  • 2021-11-15
  • 2021-06-29
猜你喜欢
  • 2022-12-23
  • 2022-12-23
  • 2021-10-21
  • 2022-12-23
  • 2022-12-23
  • 2021-07-13
相关资源
相似解决方案