查看完整版本: [-- QSS没有效果。。。求助 --]

QTCN开发网 -> 《C++ GUI Qt 4编程》(第2版)专栏 -> QSS没有效果。。。求助 [打印本页] 登录 -> 注册 -> 回复主题 -> 发表主题

qeesung 2014-12-12 19:41

QSS没有效果。。。求助

写了一个qss文件,内容如下:
  1. QGroupBox#lineEditBox{
        background-image:url(:/images/background.png);
    }


    QLineEdit#lineEdit2{
        color:green;
        background-color:yellow;
    }

    QLineEdit#lineEdit3{
        color:red;
        background-color:blue;
    }
在我的定义的Dialog里面有这么几个成员:
  1. QLineEdit * lineEdit1;

        QGroupBox * lineEditBox;
        QLineEdit * lineEdit2;
        QLineEdit * lineEdit3;

        QTableWidget * tableWidet;
现在想按照上面的qss文件来为对应的兑现设置相应的属性,发现一点作用都没有,其他的'*' ,'[ ]'。。。都还工作正常,为啥‘#’号就是不工作,求大神解答!


jidai 2014-12-13 06:32
代码中调用:
    lineEdit1->setObjectName("xxx1");
qss中:
    QLineEdit#xxx1{
        ......
    }

#号前面是类型名,后面是对象名,对象名要使用setObjectName方法设置,不是直接使用变量名

qeesung 2014-12-13 13:17
jidai:代码中调用:
    lineEdit1->setObjectName("xxx1");
qss中:
    QLineEdit#xxx1{
        ......
....... (2014-12-13 06:32) 

哦哦~原来是这样的,谢谢啦~


查看完整版本: [-- QSS没有效果。。。求助 --] [-- top --]



Powered by phpwind v8.7 Code ©2003-2011 phpwind
Gzip disabled