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. Lost QTableWidget's ability to use StyleSheet

Lost QTableWidget's ability to use StyleSheet

Scheduled Pinned Locked Moved Unsolved General and Desktop
5 Posts 2 Posters 490 Views 1 Watching
  • 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.
  • DriftwoodD Offline
    DriftwoodD Offline
    Driftwood
    wrote on last edited by
    #1

    I have a QTableWidget (Qt Creator 4.14.2) that refuses to be styled. This is the code I'm using, code that worked like a charm last year when I was using Qt. But now, it's dead.

     ui->tableWidget_Customers->setStyleSheet("alternate-background-color: #d3eaea;");
     ui->tableWidget_Customers->horizontalHeader()->setStyleSheet
        ("QHeaderView::section { color: white; background-color:teal }"); 
     ui->tableWidget_Customers->verticalHeader()->setStyleSheet
        ("QHeaderView::section { color: white; background-color:teal }");
    

    I've noticed this about Qt: If it works today, just wait for tomorrow and it won't. They have a knack of "fixing" what isn't broken.

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

      Hi,

      Which version of Qt are you using exactly ?
      Can you provide a minimal compilable example that shows that behaviour ?

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

      DriftwoodD 1 Reply Last reply
      0
      • SGaistS SGaist

        Hi,

        Which version of Qt are you using exactly ?
        Can you provide a minimal compilable example that shows that behaviour ?

        DriftwoodD Offline
        DriftwoodD Offline
        Driftwood
        wrote on last edited by Driftwood
        #3

        @SGaist - This is what I have:

        {noformat}
        Qt 5.15.2 (x86_64-little_endian-lp64 shared (dynamic) release build; by GCC 5.3.1 20160406 (Red Hat 5.3.1-6)) on "xcb" 
        OS: Linux Mint 20.2 [linux version 5.4.0-80-generic]
        
        Environment:
          QT_ACCESSIBILITY="1"
          QT_QPA_PLATFORMTHEME="qt5ct"
        
        Features: QT_NO_EXCEPTIONS
        
        Library info:
          PrefixPath: /home/fmc/Qt6/Tools/QtCreator/lib/Qt
          DocumentationPath: /home/fmc/Qt6/Tools/QtCreator/lib/Qt/doc
          HeadersPath: /home/fmc/Qt6/Tools/QtCreator/lib/Qt/include
          LibrariesPath: /home/fmc/Qt6/Tools/QtCreator/lib/Qt/lib
          LibraryExecutablesPath: /home/fmc/Qt6/Tools/QtCreator/lib/Qt/libexec
          BinariesPath: /home/fmc/Qt6/Tools/QtCreator/lib/Qt/bin
          PluginsPath: /home/fmc/Qt6/Tools/QtCreator/lib/Qt/plugins
          ImportsPath: /home/fmc/Qt6/Tools/QtCreator/lib/Qt/imports
          Qml2ImportsPath: /home/fmc/Qt6/Tools/QtCreator/lib/Qt/qml
          ArchDataPath: /home/fmc/Qt6/Tools/QtCreator/lib/Qt
          DataPath: /home/fmc/Qt6/Tools/QtCreator/lib/Qt
          TranslationsPath: /home/fmc/Qt6/Tools/QtCreator/lib/Qt/translations
          ExamplesPath: /home/fmc/Qt6/Tools/QtCreator/lib/Qt/examples
          TestsPath: /home/fmc/Qt6/Tools/QtCreator/lib/Qt/tests
          SettingsPath: /home/fmc/Qt6/Tools/QtCreator/lib/Qt
        

        If needed, I'll create a minimal-usage scenario.

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

          Yes a minimal compilable example will be a good thing.

          Are you using your distribution provided Qt or one that you installed using the online installer ?

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

          DriftwoodD 1 Reply Last reply
          0
          • SGaistS SGaist

            Yes a minimal compilable example will be a good thing.

            Are you using your distribution provided Qt or one that you installed using the online installer ?

            DriftwoodD Offline
            DriftwoodD Offline
            Driftwood
            wrote on last edited by
            #5

            @SGaist - I got it from the Qt website. When I installed it, I watched it use my default Qt e-mail address and password before downloading myriad files.

            As for the minimal asking, I just determined this isn't a Qt issue. Let me explain.

            I don't use Qt's editor. I use CLion instead. When I run this in Qt (which I never do), the styling works fine. However, when I run it in CLion, the app takes on my system-wide theme. So I'm thinking this may be a CLion issue, since the styling works perfectly when I run the app out of Qt Creator. I hate days like this :D

            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