引用第8楼charles_gz于2011-10-28 13:28发表的 回 7楼(wxj120bw) 的帖子 :
敢问 代码应该怎么写?setstylesheet()中的参数是??
给你看个例子就明白了:
http://www.cppblog.com/biao/archive/2011/10/27/159209.html // 设置style sheet
/*.SearchButton {
background: gray; color: white; border: 1 solid gray;
min-width: 40px;
}
.SearchButton:hover {
background: black; color: white; border: 1 solid black;
}
.SearchButton:pressed {
background: white;
color: black;
}*/
// 为了方便起见, 帮把 style sheet 写到代码里, 实际工作中应该放到专用的style sheet里, 方便修改
QString qss = QString(".SearchButton {background: gray; color: white; border: 1 solid gray;min-width: 40px;}"
) + QString(".SearchButton:hover {background: black; color: white; border: 1 solid black;}"
) + QString(".SearchButton:pressed {background: white;color: black;}"
); setStyleSheet(qss);
}