ColinDuquesnoy / QDarkStyleSheet

A dark style sheet for QtWidgets application
Other
2.76k stars 725 forks source link

The QComboBox looks too thick in "other applications" #352

Open hmaarrfk opened 1 month ago

hmaarrfk commented 1 month ago

I'm really not sure why this happens, but there seems to be some discrepancies between the demo application and "other applications".

I wonder if the original issues reported in #103 and #111 are still valid in 2024. I removed the line that had the comments relating to them:

https://github.com/ColinDuquesnoy/QDarkStyleSheet/blob/6f3962e63749893f951be73ebfec93e83fffebf2/qdarkstyle/qss/_styles.scss#L1309C1-L1310C23

and things seem OK.

The problem with these lines is that they make the QComboBox look too high compared to other widgets that might be next to it like a button.

import re
from PySide6.QtWidgets import QApplication, QMainWindow, QWidget, QHBoxLayout, QComboBox, QPushButton
from qdarkstyle import load_stylesheet
class MainWindow(QMainWindow):
    def __init__(self):
        super().__init__()

        # Create central widget
        central_widget = QWidget()
        self.setCentralWidget(central_widget)

        # Create layout
        layout = QHBoxLayout()
        central_widget.setLayout(layout)

        # Create combo box with 3 items
        combo_box = QComboBox()
        combo_box.addItems(["Item 1 gyjqtA", "Item 2", "Item 3"])

        # Create push button
        button = QPushButton("hello")

        # Add widgets to layout
        layout.addWidget(combo_box)
        layout.addWidget(button)

app = QApplication([])
stylesheet = load_stylesheet()
# stylesheet = re.sub(r'\s*/\* Fixes #103, #111 \*/\s*\n\s*min-height: 1\.5em;\s*', '', stylesheet)
app.setStyleSheet(stylesheet)
window = MainWindow()
window.show()
app.exec()

With those two lines image

import re
stylesheet = re.sub(r'\s*/\* Fixes #103, #111 \*/\s*\n\s*min-height: 1\.5em;\s*', '', stylesheet)

Patching them out: image

Thanks making this theme cool!