擅长:python、mysql、java
<p>假设<code>self._settings.value("test_value", True)</code>返回一个值为<code>"true"</code>的字符串,可以这样做</p>
<pre><code>self._chk_test.setChecked(
self._settings.value("test_value", True) == "true")
</code></pre>
<p>但是,如果您需要多次执行此操作,我将保留自定义方法(但要像@furas建议的那样使其更紧凑):</p>
^{pr2}$