PySide2 QToolButton stylesheets
-
Hi, I've question about stylesheets of QToolButton and different
popupMenuproperty values. Because it seems that PySide2 storepopupMenuproperty as object so (for example) this stylesheet is ignored:QToolButton[popupMenu="1"] { padding-right: 20px; }Python part:
tool_btn = QtWidgets.QToolButton() tool_btn.setText("Test") tool_menu = QtWidgets.QMenu(tool_btn) tool_btn.setMenu(toolmenu) tool_btn.setPopupMode(QtWidgets.QToolButton.MenuButtonPopup)I've fake it using custom property but that's not ideal as I want to use it as global stylesheet which should be applied on any widgets outside of my project.
# Set custom propert name tool_btn.setProperty("popup_menu", "1")/* Both properties with same stylesheet */ QToolButton[popupMenu="1"], QToolButton[popup_menu="1"] { padding-right: 20px; }Has anybody idea how it's doable?
Using: Python 3.7.6, PySide2 5.15.2