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. [SOLVED] stylesheet on QTableWidgetItem just edited
Forum Updated to NodeBB v4.3 + New Features

[SOLVED] stylesheet on QTableWidgetItem just edited

Scheduled Pinned Locked Moved General and Desktop
9 Posts 2 Posters 6.7k 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.
  • E Offline
    E Offline
    evergreen
    wrote on last edited by
    #1

    Hello,

    I'm currently working on a QTableWidget custom with stylesheet.
    When I modify an item and press enter to apply, the item changes automatically to some creemy background color.

    I can't find a way to disable it via the doc. Do you know some possibilities?

    Thanks

    1 Reply Last reply
    0
    • L Offline
      L Offline
      loladiro
      wrote on last edited by
      #2

      Could you show us the QSS you use?

      1 Reply Last reply
      0
      • E Offline
        E Offline
        evergreen
        wrote on last edited by
        #3

        @ QString styleSheet = QString(

            "QWidget {"
            "    color: white;"
         "    background-color: rgba(0, 0, 0, 0);"
            "}"
        

        "QLabel {"
        " color: white;"
        "}"
        "QLineEdit {"
        " border: 1px solid blue ;"
        " border-radius: 3px;"
        " border-style: ridge ;"
        "}"
        "QScrollBar:vertical {"
        " width: 12px;"
        " background-color:green;"
        "}"
        "QHeaderView::section {"
        "background-color: rgba(62, 78, 104, 160);"
        "color: white;"
        "}"
        "QComboBox {"
        "background-color: rgba(62, 78, 104, 160);"
        "color: white;"
        "}"
        "QTableWidget QLineEdit {"
        "background-color: rgba(62, 78, 104, 255);"
        "}"
        );
        setStyleSheet(styleSheet);@

        I really don't do anything that involve that cream color which is a default color in Qt for QTableWifdget I think

        1 Reply Last reply
        0
        • L Offline
          L Offline
          loladiro
          wrote on last edited by
          #4

          You're making your widgets transparent and Qt is thus showing the form background (which is different depending on your OS/Windows Manager/Selected Style)

          1 Reply Last reply
          0
          • E Offline
            E Offline
            evergreen
            wrote on last edited by
            #5

            I don't understand, what is the class of the "form" you are talking about?

            1 Reply Last reply
            0
            • L Offline
              L Offline
              loladiro
              wrote on last edited by
              #6

              I used form as a generalization of MainWindow/Dialog/Widget.

              1 Reply Last reply
              0
              • E Offline
                E Offline
                evergreen
                wrote on last edited by
                #7

                I don't think so, I've got a pixmap as background of my window so if the problem is that my edited QTableWidgeItem is transparent it would be the pixmap that would be shown

                1 Reply Last reply
                0
                • L Offline
                  L Offline
                  loladiro
                  wrote on last edited by
                  #8

                  Try calling update on your parent window after settings the QSS then.

                  1 Reply Last reply
                  0
                  • E Offline
                    E Offline
                    evergreen
                    wrote on last edited by
                    #9

                    I just found a solution :

                    " QAbstractItemView {"
                    "selection-background-color: rgba(0,0,0,0);"

                    It makes the cream background disappear thanks to transparncy.
                    Hope it could help someone.

                    Thnaks for help anyway.

                    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