PyQtDarkTheme icon indicating copy to clipboard operation
PyQtDarkTheme copied to clipboard

Tooltip background color

Open bhowiebkr opened this issue 1 year ago • 3 comments

I'm finding that tooltips are showing up incorrectly. Text color appears to be correct but the background is white making it impossible to see. See attached image tooltip_color_issue

This is in Windows 11 and PySide6

bhowiebkr avatar Mar 11 '23 00:03 bhowiebkr

This appears to be an issue with QT or windows 11 itself. With the code below the red background in the stylesheet doesn't change.

image

from PySide6.QtWidgets import QApplication, QWidget, QToolTip, QPushButton

app = QApplication([])

# Set stylesheet to customize tooltip colors
app.setStyleSheet("QToolTip { background-color: red; color: blue; }")

# Create a widget with a button that has a tooltip
widget = QWidget()
button = QPushButton("button", widget)
button.setToolTip("This is a custom tooltip")

widget.show()
app.exec()

To get around this for now, I'm setting the text in the tool tip white so the tips are visible

qdarktheme.setup_theme(additional_qss="QToolTip {color: black;}")

bhowiebkr avatar Mar 11 '23 01:03 bhowiebkr

Just ran into this issue and accidentally discovered a fix. To get the theme to work properly on Windows 11, add an additional qss that removes the border: qdarktheme.setup_theme(additional_qss="QToolTip { border: 0px; }")

For whatever reason, this works and allows QT to render the tool boxes correctly

r-almendarez avatar Apr 09 '23 20:04 r-almendarez

This is a note for the future me:

additional_qss="QToolTip {color: white; background-color: black; border: 0px; }"

SanPen avatar Mar 27 '24 09:03 SanPen