久久久久久久av_日韩在线中文_看一级毛片视频_日本精品二区_成人深夜福利视频_武道仙尊动漫在线观看

      <bdo id='HFhfW'></bdo><ul id='HFhfW'></ul>
    <tfoot id='HFhfW'></tfoot>

  • <legend id='HFhfW'><style id='HFhfW'><dir id='HFhfW'><q id='HFhfW'></q></dir></style></legend>
    1. <i id='HFhfW'><tr id='HFhfW'><dt id='HFhfW'><q id='HFhfW'><span id='HFhfW'><b id='HFhfW'><form id='HFhfW'><ins id='HFhfW'></ins><ul id='HFhfW'></ul><sub id='HFhfW'></sub></form><legend id='HFhfW'></legend><bdo id='HFhfW'><pre id='HFhfW'><center id='HFhfW'></center></pre></bdo></b><th id='HFhfW'></th></span></q></dt></tr></i><div class="qwawimqqmiuu" id='HFhfW'><tfoot id='HFhfW'></tfoot><dl id='HFhfW'><fieldset id='HFhfW'></fieldset></dl></div>

      1. <small id='HFhfW'></small><noframes id='HFhfW'>

        取消選中所有其他復選框的復選框

        Checkbox to uncheck all other checkboxes(取消選中所有其他復選框的復選框)

          <tfoot id='7mTWx'></tfoot>

            <tbody id='7mTWx'></tbody>

          <small id='7mTWx'></small><noframes id='7mTWx'>

                <legend id='7mTWx'><style id='7mTWx'><dir id='7mTWx'><q id='7mTWx'></q></dir></style></legend>
                • <bdo id='7mTWx'></bdo><ul id='7mTWx'></ul>

                  <i id='7mTWx'><tr id='7mTWx'><dt id='7mTWx'><q id='7mTWx'><span id='7mTWx'><b id='7mTWx'><form id='7mTWx'><ins id='7mTWx'></ins><ul id='7mTWx'></ul><sub id='7mTWx'></sub></form><legend id='7mTWx'></legend><bdo id='7mTWx'><pre id='7mTWx'><center id='7mTWx'></center></pre></bdo></b><th id='7mTWx'></th></span></q></dt></tr></i><div class="qwawimqqmiuu" id='7mTWx'><tfoot id='7mTWx'></tfoot><dl id='7mTWx'><fieldset id='7mTWx'></fieldset></dl></div>
                  本文介紹了取消選中所有其他復選框的復選框的處理方法,對大家解決問題具有一定的參考價值,需要的朋友們下面隨著小編來一起學習吧!

                  問題描述

                  我正在嘗試進行一些驗證,例如:

                  I'm trying to put in some validation such that:

                  • 選中選擇 A"選擇 B" 時,會自動取消選中 未選擇"
                  • 選中未選中"時,選擇 A"選擇 B" 都會自動取消選中
                  • When either "Select A" or "Select B" is checked, "None Selected" is automatically unchecked
                  • When "None Selected" is checked, both "Select A" and "Select B" are automatically unchecked

                  但是當我運行此代碼時,單擊任何復選框都會取消選中 所有 3 個復選框.

                  But when I run this code, clicking any checkbox will uncheck all the 3 checkboxes.

                  即窗口初始化時選中了"None Selected".但是當我點擊 "Select A" 時,它會取消選中 "None Selected",這是有意的,但沒有得到 "Select A"檢查.

                  i.e. The window initializes with "None Selected" checked. But when I click "Select A", it unchecks "None Selected", which is intended, but "Select A" doesn't get checked.

                  我做錯了什么?

                  import sys
                  import PyQt5
                  
                  class Test(QWidget):
                      def __init__(self):
                          super().__init__()
                          self.initUI()
                  
                      def initUI(self):
                          checkBoxNone = QCheckBox("None Selected")
                          checkBoxA    = QCheckBox("Select A")
                          checkBoxB    = QCheckBox("Select B")
                  
                          checkBoxNone.setChecked(True)
                          checkBoxNone.stateChanged.connect(lambda checked: (checkBoxA.setChecked(False), checkBoxB.setChecked(False)))
                          checkBoxA.stateChanged.connect(lambda checked: checkBoxNone.setChecked(False))
                          checkBoxB.stateChanged.connect(lambda checked: checkBoxNone.setChecked(False))
                  
                          grid = QGridLayout()
                  
                          grid.addWidget(checkBoxNone, 1, 0)
                          grid.addWidget(checkBoxA, 2, 0)
                          grid.addWidget(checkBoxB, 3, 0)
                  
                          self.setLayout(grid)
                          self.setWindowTitle('Test')
                          self.show()
                  
                  if __name__ == '__main__':
                      if not QApplication.instance():
                          app = QApplication(sys.argv)
                      else:
                          app = QApplication.instance()
                      ex = Test()
                      sys.exit(app.exec_())
                  

                  推薦答案

                  問題是因為根據您的要求,只有在某些 QCheckBox 被勾選但您不做的情況下才應該做那些選項該驗證,為了能夠正確處理它,創建一個插槽并知道發出信號的對象,sender() 方法:

                  The problem is caused because according to your requirements, you should only make those options if some QCheckBox is checked but you do not do that verification, to be able to handle it properly, create a slot and to know which object the signal was emited, the sender() method:

                  import sys
                  from PyQt5.QtWidgets import *
                  from PyQt5.QtCore import *
                  
                  class Test(QWidget):
                      def __init__(self):
                          super().__init__()
                          self.initUI()
                  
                      def initUI(self):
                          self.checkBoxNone = QCheckBox("None Selected")
                          self.checkBoxA    = QCheckBox("Select A")
                          self.checkBoxB    = QCheckBox("Select B")
                  
                          self.checkBoxNone.setChecked(True)
                          self.checkBoxNone.stateChanged.connect(self.onStateChange)
                          self.checkBoxA.stateChanged.connect(self.onStateChange)
                          self.checkBoxB.stateChanged.connect(self.onStateChange)
                  
                          grid = QGridLayout(self)
                  
                          grid.addWidget(self.checkBoxNone, 1, 0)
                          grid.addWidget(self.checkBoxA, 2, 0)
                          grid.addWidget(self.checkBoxB, 3, 0)
                          self.setWindowTitle('Test')
                          self.show()
                  
                      @pyqtSlot(int)
                      def onStateChange(self, state):
                          if state == Qt.Checked:
                              if self.sender() == self.checkBoxNone:
                                  self.checkBoxA.setChecked(False)
                                  self.checkBoxB.setChecked(False)
                              elif self.sender() in (self.checkBoxA, self.checkBoxB):
                                  self.checkBoxNone.setChecked(False)
                  

                  這篇關于取消選中所有其他復選框的復選框的文章就介紹到這了,希望我們推薦的答案對大家有所幫助,也希望大家多多支持html5模板網!

                  【網站聲明】本站部分內容來源于互聯網,旨在幫助大家更快的解決問題,如果有圖片或者內容侵犯了您的權益,請聯系我們刪除處理,感謝您的支持!

                  相關文檔推薦

                  How to bind a function to an Action from Qt menubar?(如何將函數綁定到 Qt 菜單欄中的操作?)
                  PyQt progress jumps to 100% after it starts(PyQt 啟動后進度躍升至 100%)
                  How to set yaxis tick label in a fixed position so that when i scroll left or right the yaxis tick label should be visible?(如何將 yaxis 刻度標簽設置在固定位置,以便當我向左或向右滾動時,yaxis 刻度標簽應該可見
                  `QImage` constructor has unknown keyword `data`(`QImage` 構造函數有未知關鍵字 `data`)
                  Change x-axis ticks to custom strings(將 x 軸刻度更改為自定義字符串)
                  How to show progress bar while saving file to excel in python?(如何在python中將文件保存為excel時顯示進度條?)
                  <i id='EBg7l'><tr id='EBg7l'><dt id='EBg7l'><q id='EBg7l'><span id='EBg7l'><b id='EBg7l'><form id='EBg7l'><ins id='EBg7l'></ins><ul id='EBg7l'></ul><sub id='EBg7l'></sub></form><legend id='EBg7l'></legend><bdo id='EBg7l'><pre id='EBg7l'><center id='EBg7l'></center></pre></bdo></b><th id='EBg7l'></th></span></q></dt></tr></i><div class="qwawimqqmiuu" id='EBg7l'><tfoot id='EBg7l'></tfoot><dl id='EBg7l'><fieldset id='EBg7l'></fieldset></dl></div>
                    <bdo id='EBg7l'></bdo><ul id='EBg7l'></ul>

                      <legend id='EBg7l'><style id='EBg7l'><dir id='EBg7l'><q id='EBg7l'></q></dir></style></legend>
                        1. <small id='EBg7l'></small><noframes id='EBg7l'>

                            <tbody id='EBg7l'></tbody>

                            <tfoot id='EBg7l'></tfoot>
                            主站蜘蛛池模板: 视频精品一区二区三区 | 欧美一区二区在线 | 日韩字幕| 日韩手机在线看片 | 免费观看羞羞视频网站 | 国产精品久久久久久久久久久免费看 | 波多野结衣二区 | 日韩一区二区免费视频 | 精品欧美一区二区三区 | 久久91精品国产一区二区 | 99reav| 亚洲成人精品一区二区 | 久久中文字幕一区 | 成年女人免费v片 | 久久er99热精品一区二区 | 精品一区二区三区入口 | 日日夜夜精品 | 午夜激情国产 | 成人久久18免费网站图片 | 日韩黄色免费 | 亚洲毛片在线观看 | 久久久精品视 | 国产永久免费 | 精品久久久久久亚洲精品 | 欧美一区在线视频 | 国产高清精品一区二区三区 | 精品国产乱码久久久久久丨区2区 | 国产精品大片 | 日韩精品激情 | 亚洲高清视频在线观看 | 亚洲男人网 | 日韩欧美综合 | 一区二区三区四区在线播放 | 91在线观看视频 | 日本三级视频 | 国产一区二区三区久久久久久久久 | 欧美日韩综合 | 老妇激情毛片免费 | 久久久久久久电影 | 99精品久久| 久久免费观看视频 |