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

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

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

      <legend id='oRowP'><style id='oRowP'><dir id='oRowP'><q id='oRowP'></q></dir></style></legend>

      如何將 QCompleter 與 InputDialog 一起使用?

      How to use QCompleter with an InputDialog?(如何將 QCompleter 與 InputDialog 一起使用?)

          <tbody id='F9TWR'></tbody>
            <bdo id='F9TWR'></bdo><ul id='F9TWR'></ul>

              <small id='F9TWR'></small><noframes id='F9TWR'>

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

                <legend id='F9TWR'><style id='F9TWR'><dir id='F9TWR'><q id='F9TWR'></q></dir></style></legend><tfoot id='F9TWR'></tfoot>
                本文介紹了如何將 QCompleter 與 InputDialog 一起使用?的處理方法,對大家解決問題具有一定的參考價值,需要的朋友們下面隨著小編來一起學習吧!

                問題描述

                我正在編寫一個 Python 應用程序,用戶可以在其中在 QInputDialog 中輸入一個字符串.如何使用 QCompleter 使輸入更容易?

                I am writing a Python Application where the user can enter a String in an QInputDialog. How can i use the QCompleter to make Inputs easier?

                我已經在不同的網站上搜索并閱讀了文檔https://doc.qt.io/qt-5/qcompleter.html#詳情但找不到任何解決此問題的方法.

                I've already been searching on different websites and read the doc from https://doc.qt.io/qt-5/qcompleter.html#details but couldn't find any help for this problem.

                在我看來,QCompleter 似乎只適用于 QLineEdit 和 QComboBox.(請證明我錯了)

                To me, it seems like the QCompleter is only available for QLineEdit and QComboBox. (Please proof me wrong)

                ian, okPressed = QInputDialog.getText(self, "IAN", "Please enter IAN:")
                

                如果有人可以向我展示一些如何處理此問題的代碼示例,那將對我有很大幫助.

                It would help me a lot if anyone could show me some code examples how to deal with this problem.

                如果不能在 QInputDialog 中使用 QCompleter,你們有解決方法的想法嗎?

                If it's not possible to use the QCompleter within the QInputDialog, do you guys have an idea for a workaround?

                非常感謝 =)

                推薦答案

                有兩種可能的解決方案:

                There are 2 possible solutions:

                • 通過父級獲取QInputDialog- 使用 findChild():
                from PyQt5 import QtCore, QtGui, QtWidgets
                
                
                class Widget(QtWidgets.QWidget):
                    def __init__(self, parent=None):
                        super(Widget, self).__init__(parent)
                
                        button = QtWidgets.QPushButton("Press me", clicked=self.onClicked)
                        lay = QtWidgets.QVBoxLayout(self)
                        lay.addWidget(button)
                
                    @QtCore.pyqtSlot()
                    def onClicked(self):
                        QtCore.QTimer.singleShot(0, self.onTimeout)
                        ian, okPressed = QtWidgets.QInputDialog.getText(
                            self, "IAN", "Please enter IAN:"
                        )
                
                    @QtCore.pyqtSlot()
                    def onTimeout(self):
                        dialog = self.findChild(QtWidgets.QInputDialog)
                        if dialog is not None:
                            le = dialog.findChild(QtWidgets.QLineEdit)
                            if le is not None:
                                words = ["alpha", "omega", "omicron", "zeta"]
                                completer = QtWidgets.QCompleter(words, le)
                                le.setCompleter(completer)
                
                
                if __name__ == "__main__":
                    import sys
                
                    app = QtWidgets.QApplication(sys.argv)
                    w = Widget()
                    w.resize(320, 240)
                    w.show()
                    sys.exit(app.exec_())
                

                • 不要使用靜態方法并創建 QInputDialog 具有相同的元素:
                • from PyQt5 import QtCore, QtGui, QtWidgets
                  
                  
                  class Widget(QtWidgets.QWidget):
                      def __init__(self, parent=None):
                          super(Widget, self).__init__(parent)
                  
                          button = QtWidgets.QPushButton("Press me", clicked=self.onClicked)
                          lay = QtWidgets.QVBoxLayout(self)
                          lay.addWidget(button)
                  
                      @QtCore.pyqtSlot()
                      def onClicked(self):
                          dialog = QtWidgets.QInputDialog(self)
                          dialog.setWindowTitle("IAN")
                          dialog.setLabelText("Please enter IAN:")
                          dialog.setTextValue("")
                          le = dialog.findChild(QtWidgets.QLineEdit)
                          words = ["alpha", "omega", "omicron", "zeta"]
                          completer = QtWidgets.QCompleter(words, le)
                          le.setCompleter(completer)
                  
                          ok, text = (
                              dialog.exec_() == QtWidgets.QDialog.Accepted,
                              dialog.textValue(),
                          )
                          if ok:
                              print(text)
                  
                  
                  if __name__ == "__main__":
                      import sys
                  
                      app = QtWidgets.QApplication(sys.argv)
                      w = Widget()
                      w.resize(320, 240)
                      w.show()
                      sys.exit(app.exec_())
                  

                  這篇關于如何將 QCompleter 與 InputDialog 一起使用?的文章就介紹到這了,希望我們推薦的答案對大家有所幫助,也希望大家多多支持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時顯示進度條?)

                <small id='0YRgy'></small><noframes id='0YRgy'>

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

                        <tbody id='0YRgy'></tbody>
                          <legend id='0YRgy'><style id='0YRgy'><dir id='0YRgy'><q id='0YRgy'></q></dir></style></legend>
                          <tfoot id='0YRgy'></tfoot>
                        1. 主站蜘蛛池模板: 天天躁日日躁狠狠很躁 | 毛片com| 日韩中文一区二区三区 | 亚洲一区二区视频在线播放 | 国产精品污www一区二区三区 | 亚洲一区久久 | 美女一区 | h视频在线播放 | 亚洲免费福利视频 | 亚洲高清免费观看 | 国产在线a | 中文字幕在线免费视频 | 国产日韩欧美精品一区二区 | 午夜免费在线电影 | 国产精品国产三级国产aⅴ中文 | 国产精品亚洲精品日韩已方 | 成人在线视频免费播放 | 免费av在线 | 成人福利视频网站 | 亚洲精品视频在线观看免费 | 99久久精品一区二区毛片吞精 | 北条麻妃99精品青青久久主播 | 日本一本在线 | 国产精品成人一区二区三区 | 日韩免费1区二区电影 | 91看片在线 | 国产高清精品一区二区三区 | 欧洲一区二区三区 | 欧美成人精品一区二区男人看 | 自拍偷拍亚洲视频 | 亚洲一区二区国产 | 男女羞羞免费网站 | 高清成人av| 做a视频 | 伊人伊成久久人综合网站 | 国产精品日韩欧美一区二区 | 欧美一区二区三区在线 | 成人三区| 久久伊人久久 | 青青草原精品99久久精品66 | 欧美一区二区免费 |