Closed qianye216 closed 10 months ago
当输入框设置了PlaceholderText时,未输入内容时,各个输入框的PlaceholderText的字体颜色样式都显示成黑色了,正常应该是灰色样式
Mac
3.9.6
PyQt 5.15.0
v1.4.3
使用原生的QLineEdit正常,LineEdit等输入框组件的不正常,正常应该显示灰色颜色样式
# coding:utf-8 import sys from PyQt5.QtCore import Qt from PyQt5.QtWidgets import QApplication, QWidget, QHBoxLayout, QCompleter, QLineEdit from qfluentwidgets import LineEdit, PushButton, SearchLineEdit, setTheme, Theme class Demo(QWidget): def __init__(self): super().__init__() # self.setStyleSheet("Demo {background: rgb(32, 32, 32)}") # setTheme(Theme.DARK) self.hBoxLayout = QHBoxLayout(self) self.lineEdit = QLineEdit(self) # self.lineEdit.setEnabled(False) self.button = PushButton('Search', self) # add completer stands = [ "Star Platinum", "Hierophant Green", "Made in Haven", "King Crimson", "Silver Chariot", "Crazy diamond", "Metallica", "Another One Bites The Dust", "Heaven's Door", "Killer Queen", "The Grateful Dead", "Stone Free", "The World", "Sticky Fingers", "Ozone Baby", "Love Love Deluxe", "Hermit Purple", "Gold Experience", "King Nothing", "Paper Moon King", "Scary Monster", "Mandom", "20th Century Boy", "Tusk Act 4", "Ball Breaker", "Sex Pistols", "D4C • Love Train", "Born This Way", "SOFT & WET", "Paisley Park", "Wonder of U", "Walking Heart", "Cream Starter", "November Rain", "Smooth Operators", "The Matte Kudasai" ] self.completer = QCompleter(stands, self.lineEdit) self.completer.setCaseSensitivity(Qt.CaseInsensitive) self.completer.setMaxVisibleItems(10) self.lineEdit.setCompleter(self.completer) self.resize(400, 400) self.hBoxLayout.setAlignment(Qt.AlignCenter) self.hBoxLayout.addWidget(self.lineEdit, 0, Qt.AlignCenter) self.hBoxLayout.addWidget(self.button, 0, Qt.AlignCenter) self.lineEdit.setFixedSize(200, 33) self.lineEdit.setClearButtonEnabled(True) self.lineEdit.setPlaceholderText('Search stand') if __name__ == '__main__': # enable dpi scale QApplication.setHighDpiScaleFactorRoundingPolicy( Qt.HighDpiScaleFactorRoundingPolicy.PassThrough) QApplication.setAttribute(Qt.AA_EnableHighDpiScaling) QApplication.setAttribute(Qt.AA_UseHighDpiPixmaps) app = QApplication(sys.argv) w = Demo() w.show() app.exec_()
是不是 qt 版本太低导致的:
5.15.2 就是灰色的
我是5.15.10,应该是最新的版本了
好像是qt版本的问题,我降级到5.15.2也正常了,但是奇怪的是5.15.10版本的话原生的就正常,fluent组件就不正常
之前 pyqt6.3 也有这个问题,换成 6.4.2 就正常了
What happened?
当输入框设置了PlaceholderText时,未输入内容时,各个输入框的PlaceholderText的字体颜色样式都显示成黑色了,正常应该是灰色样式
Operation System
Mac
Python Version
3.9.6
PyQt/PySide Version
PyQt 5.15.0
PyQt/PySide-Fluent-Widgets Version
v1.4.3
How to Reproduce?
使用原生的QLineEdit正常,LineEdit等输入框组件的不正常,正常应该显示灰色颜色样式
Minimum code