import sys from PySide6 import QtGui, QtCore, QtWidgets class TestWindow(QtWidgets.QMainWindow): def __init__(self): super(TestWindow, self).__init__() self.setWindowTitle("TestTreeView") def setWidget(self, widget): self.setCentralWidget(widget) def loadStyleSheet(qssFile: str) -> str: qssData = None with open(qssFile, mode="rt", encoding="utf-8") as f: qssData = f.read() return qssData if (__name__ == "__main__"): app = QtWidgets.QApplication(sys.argv) app.setStyleSheet(loadStyleSheet("stylesheet.qss")) dialog = TestWindow() dialog.show() test = QtWidgets.QPushButton("TestToopTip-Button") test.setToolTip("TestToolTip") dialog.setWidget(test) sys.exit(app.exec())