pMyWidget->setStyleSheet(
"MyWidget {" // What type is it?
"min-width: 80em;" // If the dimension
"min-height: 40em;" // attribute is
"width: 160em;" // applicable
"height: 80em;" // to this type.
// margin: // See the list
// padding: // of related
// spacing: // attributes
"}");
em
" 指的是大写字母"M"的字号,如果你能应用这样的样式表,关键在于实际的MyWidget类型是什么。在样式MyWidget {}
中,你可以省略窗口小部件类型,但需要保留其内容,因为它应该修改所有父级小部件。