Tôi có nhiều lỗi tại QSS đơn giản (tờ kiểu Qt). Có lỗi của Qt không?Qt style sheets lỗi?
Ví dụ:
Style Sheets:
#check1 {
color: red //didn't work here
}
#check2 {
color: red; //but work here
background-color: black
}
#label1 {
color: blue;
text-decoration: underline //work fine here
}
#label2:hover {
color: blue;
text-decoration: underline //but didn't work here
}
Nguồn:
#include <QtGui>
int main(int argc, char *argv[])
{
QApplication app(argc, argv);
app.setStyleSheet(" #check1 {color: red} \
#check2 {color: red; background-color: black} \
#label1 {color: blue; text-decoration: underline} \
#label2:hover {color: blue; text-decoration: underline}");
QWidget w; w.setFixedSize(120,130);
QCheckBox check1("checkbox1",&w);
check1.setObjectName("check1");
check1.move(10,0);
QCheckBox check2("checkbox1",&w);
check2.setObjectName("check2");
check2.move(10,30);
QLabel label1("label1", &w);
label1.setObjectName("label1");
label1.move(10,60);
QLabel label2("label2", &w);
label2.setObjectName("label2");
label2.move(10,90);
w.show();
return app.exec();
}
qt 4.7.3-3; vòm linux; gnome 3 fallback mode
Nhưng màu: màu xanh cho: hover vẫn hoạt động ... – TheHorse
Bạn đã đúng!Đó là lẻ, bởi vì theo tài liệu của họ nó không nên. Tôi biết từ kinh nghiệm, tuy nhiên, việc thay đổi gạch chân không hoạt động như tôi đã cố gắng làm chính xác những gì bạn đang làm ở đây trong quá khứ. – Chris
Qt 4.7 DOES hỗ trợ di chuột http://doc.qt.nokia.com/latest/stylesheet-syntax.html#pseudo-states – spraff