[Python] PyQtDarkTheme: Check‑mark missing for current item in QComboBox popup

Discussão em 'Python' iniciado por Stack, Abril 20, 2025.

  1. Stack

    Stack Membro Participativo

    I'm using PyQt6 with PyQtDarkTheme and have encountered a UI issue:
    When opening a QComboBox popup, the currently selected item doesn't show the usual ✔ checkmark, or it's so low-contrast that it's effectively invisible. This works correctly without PyQtDarkTheme, so it seems to be theme-related.

    How can I fix this so that the dropdown clearly displays the checkmark for the selected item, even with PyQtDarkTheme applied?

    Without PyQtDarkTheme (check-mark visible) With PyQtDarkTheme (check-mark missing)
    [​IMG] [​IMG]
    Minimal reproducible example


    # pip install pyqt6 qdarktheme
    import sys
    import qdarktheme
    from PyQt6.QtWidgets import QApplication, QWidget, QVBoxLayout, QComboBox

    class Demo(QWidget):
    def __init__(self):
    super().__init__()

    combo = QComboBox()
    combo.addItems(["First option", "Second option", "Third option"])

    layout = QVBoxLayout(self)
    layout.addWidget(combo)

    self.setWindowTitle("PyQtDarkTheme – invisible check‑mark")

    if __name__ == "__main__":
    app = QApplication(sys.argv)
    app.setStyleSheet(qdarktheme.load_stylesheet("auto")) # Apply dark theme
    w = Demo()
    w.resize(250, 80)
    w.show()
    sys.exit(app.exec())

    Environment:

    • Python 3.11
    • PyQt6 6.8
    • PyQtDarkTheme 2.1
    • macOS 15

    Continue reading...

Compartilhe esta Página