Important: Please read the Qt Code of Conduct - https://forum.qt.io/topic/113070/qt-code-of-conduct

[SOLVED] stylesheet on QTableWidgetItem just edited



  • 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



  • Could you show us the QSS you use?



  • @ 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



  • 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)



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



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



  • 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



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



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


Log in to reply