Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • Users
  • Groups
  • Search
  • Get Qt Extensions
  • Unsolved
Collapse
Brand Logo
  1. Home
  2. Qt Development
  3. General and Desktop
  4. I have trouble in using qss file on different platforms.

I have trouble in using qss file on different platforms.

Scheduled Pinned Locked Moved General and Desktop
6 Posts 2 Posters 1.6k Views
  • Oldest to Newest
  • Newest to Oldest
  • Most Votes
Reply
  • Reply as topic
Log in to reply
This topic has been deleted. Only users with topic management privileges can see it.
  • M Offline
    M Offline
    MachoX
    wrote on last edited by
    #1

    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();
    @

    1 Reply Last reply
    0
    • SGaistS Offline
      SGaistS Offline
      SGaist
      Lifetime Qt Champion
      wrote on last edited by
      #2

      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

      Interested in AI ? www.idiap.ch
      Please read the Qt Code of Conduct - https://forum.qt.io/topic/113070/qt-code-of-conduct

      1 Reply Last reply
      0
      • M Offline
        M Offline
        MachoX
        wrote on last edited by
        #3

        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]

        1 Reply Last reply
        0
        • SGaistS Offline
          SGaistS Offline
          SGaist
          Lifetime Qt Champion
          wrote on last edited by
          #4

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

          Interested in AI ? www.idiap.ch
          Please read the Qt Code of Conduct - https://forum.qt.io/topic/113070/qt-code-of-conduct

          1 Reply Last reply
          0
          • M Offline
            M Offline
            MachoX
            wrote on last edited by
            #5

            [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.

            1 Reply Last reply
            0
            • SGaistS Offline
              SGaistS Offline
              SGaist
              Lifetime Qt Champion
              wrote on last edited by
              #6

              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.

              Interested in AI ? www.idiap.ch
              Please read the Qt Code of Conduct - https://forum.qt.io/topic/113070/qt-code-of-conduct

              1 Reply Last reply
              0

              • Login

              • Login or register to search.
              • First post
                Last post
              0
              • Categories
              • Recent
              • Tags
              • Popular
              • Users
              • Groups
              • Search
              • Get Qt Extensions
              • Unsolved