Qt 使用笔记

Qt Style Sheet - Selector语法总结

2019-02-24  本文已影响12人  paresly

控件样式

qss的语法与css基本一致,为某个控件(一般控件都是继承自QWidget)设置样式可以这样写:

selector
{
  attribute_1:value_1;
  attribute_2:value_2;
}

selector的主要用法:

QPushButton{
    border-radius:2px;
    color:#FF0000;
}
QLineEdit{
  max-width:20px;
  min-width:20px;
}
QPushButton #tabButton{
  border-bottom:2px solid #FF0000;
  font-weight:bold;
}
QPushButton #refresh{
  border:0px;
  border-radius:2px;  
}
basewidget QPushButton{
  color:#FF0000;
}
QPushButton[state="2"]{
  border:0px;
  border-radius:0px;
}
上一篇 下一篇

猜你喜欢

热点阅读