久久久久久久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 被勾選但您不做的情況下才應該做那些選項該驗證,為了能夠正確處理它,創(chuàng)建一個插槽并知道發(fā)出信號的對象,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>
                            主站蜘蛛池模板: 国产美女h视频 | 精品久久久久久 | 亚洲一区二区三区在线 | 欧美中文字幕在线 | 欧洲精品在线观看 | 日日操视频| 中日韩av | 午夜影院在线观看视频 | 国产大片黄色 | 蜜桃精品在线 | 国产第一区二区 | 黄色网一级片 | 亚洲成人自拍 | 日韩超碰在线 | 99精品国产一区二区三区 | 精品9999| 亚洲欧洲在线看 | 欧美片网站免费 | 在线看片网站 | 国产一区二区三区精品久久久 | 国产良家自拍 | 日韩一区二区三区在线看 | 久草日韩 | 久久这里有精品 | 一色桃子av一区二区 | 天天久| 久久亚洲一区二区三区四区 | 一级免费毛片 | 亚洲国产精品一区二区久久 | 黄网免费 | 日韩精品一区二区三区 | 五月激情综合 | 一区二区三 | 欧美精品中文字幕久久二区 | 九九久久国产 | 黄色片免费看视频 | 中国xxxx性xxxx产国 | 欧美一级片在线观看 | 成人在线视频免费观看 | 四虎最新地址 | 95国产精品 |