5yutan5 / PyQtDarkTheme

A flat dark theme for PySide and PyQt.
https://pyqtdarktheme.readthedocs.io
MIT License
545 stars 84 forks source link

Tooltip background color #239

Open bhowiebkr opened 1 year ago

bhowiebkr commented 1 year ago

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 commented 1 year ago

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;}")
r-almendarez commented 1 year ago

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

SanPen commented 6 months ago

This is a note for the future me:

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