I have trouble in using qss file on different platforms.



  • I used two QSS files(a.qss, b.qss) in my program. a.qss is loaded before b.qss.
    Everything works fine on my Win7. When I run it on a Mac, only the a.qss takes effect, the b.qss doesn't. I also try to merge b.qss into a.qss as one file using in the program, the b.qss part now works as expected. Is that mean we just could use one QSS file in each single program?

    a.qss
    @#leftpan > QPushButton{
    border-image: url(:/images/but_color_normal.png);
    height: 27px;
    text-align : left;
    padding-left :15px;
    color: rgb(73,73,73);
    font-size: 11px ;
    font-weight:bold;
    background-color:none;
    }
    #leftpan > QPushButton:hover{
    border-image: url(:/images/but_color_hover.png);
    color: rgb(68,68,68);
    }

    #leftpan > QPushButton:checked{
    color: rgb(255,255,255);
    border-image: url(:/images/but_color_selected.png);
    }
    @

    b.qss
    @QLabel#m_pName
    {
    font: 75 12px ;
    font-weight:bold;
    }

    QLabel#m_pSize
    {
    font: 75 12px ;
    font-weight:bold;
    }
    @

    In the main widget:
    @
    QFile qss(":/res/a.qss");
    qss.open(QIODevice::ReadOnly);
    setStyleSheet(qss.readAll());
    qss.close();
    @

    And the member widget of main:
    @
    QFile qb(":/res/b.qss");
    qb.open(QIODevice::ReadOnly);
    pAppListWidget->setStyleSheet(qb.readAll());
    qb.close();
    @


  • Lifetime Qt Champion

    Hi and welcome to devnet,

    Can you show a minimal example with two qss files and how you are using them ? That may help determine what is going on



  • Updated.
    [quote author="SGaist" date="1405409292"]Hi and welcome to devnet,

    Can you show a minimal example with two qss files and how you are using them ? That may help determine what is going on[/quote]


  • Lifetime Qt Champion

    Can you also add the example widget ? To be sure the testing conditions are the same



  • [quote author="SGaist" date="1405461126"]Can you also add the example widget ? To be sure the testing conditions are the same[/quote]

    Did you mean this should not be the case? If so, it would be fairly enough to hear about this. Actually, these files are far more than I listed(two QSS files of 11 + 22 KB in size). It's not a good idea to ask others to do the dirty work. I'll test it out myself. As soon as it comes out, I'll let you know. Thank you.


  • Lifetime Qt Champion

    It's not asking for other to do the dirty job. I'm just asking you to provide a mean of replicating your issue and help you find a solution. And since it's look like a platform specific behavior, then it's best that everybody who wants to help do it with the same code base.

    It's the same thing as when you report a bug, if you give a minimal compilable example project then the devs can directly test the bug, time gain and ensures everybody is on the same page.


Log in to reply
 

Looks like your connection to Qt Forum was lost, please wait while we try to reconnect.