是否可以通过按键检查QCheckBox?

时间:2019-04-25 05:08:54

标签: python pyqt pyqt5 qcheckbox

我正在PyQt5中工作,并且希望能够像QPushButton一样在按键按下时选中/取消选中QCheckBox。我已经检查了文档和Google,但找不到解决方法。

1 个答案:

答案 0 :(得分:1)

您必须覆盖<!-- SMIL for IE --> <script src="https://cdn.jsdelivr.net/gh/Kaiido/FakeSmile@1e50d675df616a8e784e0e6e931b3f0d595367d4/smil.user.js"></script> <svg id="svg1413" class="svg-pg" width="154" height="83" version="1.1" viewBox="0 0 178 254" xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink"> <animate class="viewBoxAnimator" attributeType="XML" attributeName="viewBox" from="0 0 178 254" to="0 0 178 254" dur="0.6s" fill="freeze"/> <image id="image1966" width="178" height="254" xlink:href="https://i.imgur.com/yiZFUK4.jpg" /> <g id="SvgjsG1413" class="click-panels"> <polygon fill="transparent" points=" 12,13 88,13 88,49 12,49"></polygon> <polygon fill="transparent" points=" 81,44 166,44 166,74 81,74"></polygon> <polygon fill="transparent" points=" 12,13 166,13 166,75 12,75"></polygon> <polygon fill="transparent" points=" 101,80 166,80 166,118 101,118"></polygon> <polygon fill="transparent" points=" 12,80 166,80 166,147 12,147"></polygon> <polygon fill="transparent" points=" 12,152 91,152 91,200 12,200"></polygon> <polygon fill="transparent" points=" 73,171 155,171 155,209 73,209"></polygon> <polygon fill="transparent" points=" 12,198 79,198 79,235 12,235"></polygon> <polygon fill="transparent" points=" 12,152 166,152 166,235 12,235"></polygon> </g> </svg>方法并调用nextCheckState()方法以更改QCheckBox的状态:

keyPressEvent