Well thanks @VRonin as it provided the solution that was unsolvable before. Here is a summary of my problem and how this solved it for the record.
When using a dark stylesheet (dark.qss) the top-left corner button remains untargettable with styling. Calling findChild(QAbstractButton) and forcing a stylesheet in code helped for a moment, but the white square came back on resize, theme change, or first show.
Root cause seemed to be Qt treats that corner button as part of the table header, not as a normal button. Header pieces are styled with the selector QHeaderView::section. The corner is a special header piece called QTableCornerButton::section. If you never tell Qt what colour that piece should be, it falls back to the system’s light colour even in dark mode which seems to be white.
After hacking workarounds in the code and doing all sorts, I was still unable to resolve it permanently until approaching it treating the top-left select-all button as a header, not a button. Styling it with QTableWidget QTableCornerButton::section in my QSS and that was pretty much it. In my case adding this into my dark.qss theme file:
/* Dark-theme top-left corner (select-all button) */
QTableWidget QTableCornerButton::section {
background-color: #2b2b2b; /* same as table background */
border: 1px solid #555555; /* same as table border */
border-bottom: 2px solid #777777; /* optional – matches header underline */
}
also adding into the python script:
app.setStyle("Fusion")
and loading the stylesheet after the style is set.
a simple example as a test was:
import sys
from PySide6.QtWidgets import QApplication, QTableWidget
from pathlib import Path
app = QApplication(sys.argv)
app.setStyle("Fusion")
# ---- dark.qss (only the relevant part) ----
qss = """
QTableWidget { background-color: #2b2b2b; color: #e0e0e0; }
QHeaderView::section { background-color: #2b2b2b; color: #e0e0e0; border: 1px solid #555555; }
QTableWidget QTableCornerButton::section {
background-color: #2b2b2b;
border: 1px solid #555555;
border-bottom: 2px solid #777777;
}
"""
app.setStyleSheet(qss)
w = QTableWidget(5, 3)
w.show()
app.exec()
I hope that helps anyone running into this problem which clearly still exists in 2025 and until I found the info in the link shared by Vronin I was struggling to solve.