pyside6 setTooltip显示空白,没有正常显示文字(Pyside6 setTooltip displays blank and does not display text properly)
-
Hi and welcome to devnet,
Which version of PySide6 are you using ?
On a side note, there is a Chinese sub-forum if you would like to get help in your mother tongue.
-
Hi and welcome to devnet,
Which version of PySide6 are you using ?
On a side note, there is a Chinese sub-forum if you would like to get help in your mother tongue.
-
Can you provide a minimal runnable script that shows this behavior ?
-
import sys from PySide6.QtCore import Slot from PySide6.QtWidgets import QApplication, QWidget, QLabel, QPlainTextEdit class Hello(QWidget): def __init__(self): super().__init__() self.setFixedSize(200, 200) self.input0 = QPlainTextEdit(self) self.input0.setStyleSheet("color: white;") self.input0.setGeometry(20, 20, 100, 50) self.input0.textChanged.connect(self.labelChange) @Slot() def labelChange(self): self.input0.setToolTip(self.input0.toPlainText()) if __name__ == '__main__': app = QApplication([]) s = Hello() s.show() sys.exit(app.exec())
!
import sys from PySide6.QtCore import Slot from PySide6.QtWidgets import QApplication, QWidget, QLabel, QPlainTextEdit class Hello(QWidget): def __init__(self): super().__init__() self.setFixedSize(200, 200) self.input0 = QPlainTextEdit(self) self.input0.setStyleSheet("color: white;") self.input0.setGeometry(20, 20, 100, 50) self.input0.textChanged.connect(self.labelChange) @Slot() def labelChange(self): self.input0.setToolTip(self.input0.toPlainText()) if __name__ == '__main__': app = QApplication([]) s = Hello() s.show() sys.exit(app.exec())
!
emmm,如此看来,好像是因为"setStyleSheet"中background-color: rgb(101, 115, 130)无法改变tooltip的"background-color"。
emmm, It seems that it is because the background color: rgb (101, 115, 130) in the "setStyleSheet" cannot change the "background color" of the tooltip.
-
Sorry, I just tested it on macOS (I don't have a Win10 machine at hand), and it's working properly.
Can you test your application using the fusion style ?