【发布时间】:2015-01-10 16:29:52
【问题描述】:
如何使自定义小部件(源自“QFrame”)包含可检查/可切换的支持? 如何让 Qt 的样式表 (CSS) 知道我的小部件已被用户选中/切换?
我需要在自定义小部件中使用某种信号或属性吗?
我不想使用(即)QPushButton,因为我需要我的按钮小部件来使用 Qt 的 .ui 文件。
即使用 QPushButton 时 - 事情很简单:
QPushButton#btnName:focus:pressed { border-image: url(ThemesPathKey/menu-top-h.png); }
QPushButton#btnName:checked { border-image: url(ThemesPathKey/menu-top-h.png); }
QPushButton#btnName:hover { border-image: url(ThemesPathKey/menu-top-h.png); }
我的自定义按钮小部件需要类似的东西。
谢谢。
【问题讨论】: