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

  • <small id='Gyz1S'></small><noframes id='Gyz1S'>

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

        QCompleter 給 pyqt5 中的 lineEdit 帶來奇怪的錯誤

        QCompleter giving weird bug to lineEdit in pyqt5(QCompleter 給 pyqt5 中的 lineEdit 帶來奇怪的錯誤)

          <tfoot id='naAIg'></tfoot>

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

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

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

                • <i id='naAIg'><tr id='naAIg'><dt id='naAIg'><q id='naAIg'><span id='naAIg'><b id='naAIg'><form id='naAIg'><ins id='naAIg'></ins><ul id='naAIg'></ul><sub id='naAIg'></sub></form><legend id='naAIg'></legend><bdo id='naAIg'><pre id='naAIg'><center id='naAIg'></center></pre></bdo></b><th id='naAIg'></th></span></q></dt></tr></i><div class="qwawimqqmiuu" id='naAIg'><tfoot id='naAIg'></tfoot><dl id='naAIg'><fieldset id='naAIg'></fieldset></dl></div>
                  本文介紹了QCompleter 給 pyqt5 中的 lineEdit 帶來奇怪的錯誤的處理方法,對大家解決問題具有一定的參考價值,需要的朋友們下面隨著小編來一起學習吧!

                  問題描述

                  我設置了兩個 lineEdit,其中一個設置了 QCompleter.當用戶選擇建議的文本時,兩個 lineEdits 都應填寫建議的文本.逗號右邊的詞進入第一行編輯,左邊的詞進入第二行編輯.目前,只有第二個 lineEdit 獲得了它的文本集,但第一個 lineEdit 在再次按 Enter 后才獲得它的文本集.例如,如果用戶選擇chikin,pizza"并點擊進入第二行編輯應該設置為chikin,第一個設置為pizza.目前,第二行編輯確實說 chikin,但第一個仍然說chikin,pizza",直到您再次按 Enter 鍵.我怎樣才能解決它,以便用戶不必按兩次回車?

                  I have two lineEdits set up where one of them has a QCompleter setup to it. When a user selects the suggested text, both lineEdits should be filled in with the suggested text. The word to the right of the comma goes into the first lineedit and the word to the left goes into the second lineEdit. At the moment, only the second lineEdit gets its text set, but the first one only gets its text set after hitting enter again. For example, if a user selects "chikin, pizza" and hits enter the second lineEdit should be set to chikin and the first one set to pizza. Currently, the second lineedit does say chikin, but the first one still says "chikin, pizza" until you hit enter again. How can i fix it so that the user doesn't have to hit enter twice?

                  from PyQt5 import QtCore, QtGui, QtWidgets
                  from PyQt5.QtWidgets import QCompleter
                  
                  
                  class Ui_MainWindow(object):
                  
                  
                      def on_button(self):
                  
                          print('Button clicked')
                  
                          fullName = self.lineEdit.text()
                  
                          nameList = fullName.split(', ')
                  
                          firstName = nameList[1]
                          lastName = nameList[0]
                  
                          self.lineEdit_2.setText(lastName)
                          self.lineEdit.setText(firstName)
                  
                      def setupUi(self, MainWindow):
                          MainWindow.setObjectName("MainWindow")
                          MainWindow.resize(439, 254)
                  
                          self.centralwidget = QtWidgets.QWidget(MainWindow)
                          self.centralwidget.setObjectName("centralwidget")
                          self.lineEdit = QtWidgets.QLineEdit(self.centralwidget)
                          self.lineEdit.setGeometry(QtCore.QRect(20, 90, 180, 25))
                          self.lineEdit.setObjectName("lineEdit")
                          self.lineEdit_2 = QtWidgets.QLineEdit(self.centralwidget)
                          self.lineEdit_2.setGeometry(QtCore.QRect(240, 90, 180, 25))
                          self.lineEdit_2.setObjectName("lineEdit_2")
                  
                  
                          food = ["pizza, chikin", "chikin, pizza", "chikin, pizza pizza", "chikin, pizza", "fried, pizza"]
                  
                          completer = QCompleter(food)
                          completer.setCaseSensitivity(QtCore.Qt.CaseInsensitive)
                          completer.setFilterMode(QtCore.Qt.MatchContains)
                  
                          self.lineEdit.setCompleter(completer)
                          self.lineEdit.editingFinished.connect(lambda: self.on_button())
                  
                          MainWindow.setCentralWidget(self.centralwidget)
                  
                  
                  if __name__ == "__main__":
                      import sys
                      app = QtWidgets.QApplication(sys.argv)
                      MainWindow = QtWidgets.QMainWindow()
                      ui = Ui_MainWindow()
                      ui.setupUi(MainWindow)
                      MainWindow.show()
                      sys.exit(app.exec_())
                  

                  推薦答案

                  試試看:

                  from PyQt5 import QtCore, QtGui, QtWidgets
                  from PyQt5.QtWidgets import QCompleter
                  
                  
                  class Ui_MainWindow(object):
                  
                  #    def on_button(self):
                      def on_button(self, text):                                                    # +++
                          nameList = text.split(', ')
                  
                          self.lineEdit_2.setText(nameList[0])
                  #        self.lineEdit.setText(nameList[1])
                          QtCore.QTimer.singleShot(200, lambda: self.lineEdit.setText(nameList[1]))  # +++
                  
                      def setupUi(self, MainWindow):
                          MainWindow.setObjectName("MainWindow")
                          MainWindow.resize(439, 254)
                          self.centralwidget = QtWidgets.QWidget(MainWindow)
                          self.centralwidget.setObjectName("centralwidget")
                          self.lineEdit = QtWidgets.QLineEdit(self.centralwidget)
                          self.lineEdit.setGeometry(QtCore.QRect(20, 90, 180, 25))
                          self.lineEdit.setObjectName("lineEdit")
                          self.lineEdit_2 = QtWidgets.QLineEdit(self.centralwidget)
                          self.lineEdit_2.setGeometry(QtCore.QRect(240, 90, 180, 25))
                          self.lineEdit_2.setObjectName("lineEdit_2")
                  
                          food = ["pizza, chikin", "chikin, pizza", "chikin, pizza pizza", "chikin, pizza", "fried, pizza"]
                  
                          completer = QCompleter(food)
                          completer.setCaseSensitivity(QtCore.Qt.CaseInsensitive)
                          completer.setFilterMode(QtCore.Qt.MatchContains)
                          self.lineEdit.setCompleter(completer)
                  
                  #        self.lineEdit.editingFinished.connect(lambda: self.on_button())
                          completer.activated.connect(self.on_button)                                    # +++
                  
                          MainWindow.setCentralWidget(self.centralwidget)
                  
                  
                  if __name__ == "__main__":
                      import sys
                      app = QtWidgets.QApplication(sys.argv)
                      MainWindow = QtWidgets.QMainWindow()
                      ui = Ui_MainWindow()
                      ui.setupUi(MainWindow)
                      MainWindow.show()
                      sys.exit(app.exec_())
                  

                  這篇關于QCompleter 給 pyqt5 中的 lineEdit 帶來奇怪的錯誤的文章就介紹到這了,希望我們推薦的答案對大家有所幫助,也希望大家多多支持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='iGN03'></small><noframes id='iGN03'>

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

                    • <bdo id='iGN03'></bdo><ul id='iGN03'></ul>

                        <tfoot id='iGN03'></tfoot>

                              <tbody id='iGN03'></tbody>
                            主站蜘蛛池模板: 日本视频在线 | 久久麻豆精品 | 精品久久香蕉国产线看观看亚洲 | 成人免费在线观看视频 | 亚洲精品电影在线观看 | 青青草中文字幕 | 天堂色 | 国产在线一区二区 | 国产成人精品久久二区二区91 | 日韩av资源站 | 91av视频在线| 免费成人在线网站 | 国产精选一区 | 水蜜桃久久夜色精品一区 | 一区二区三区亚洲视频 | 亚洲日本免费 | 911精品美国片911久久久 | 中文字幕成人网 | 久久精品女人天堂av | 户外露出一区二区三区 | 狠狠视频 | 欧美中文字幕 | caoporn国产精品免费公开 | 日韩一级在线 | 婷婷中文在线 | 国产精品综合视频 | 久久久久久精 | 久久人人网 | 黄色一级免费看 | 一区二区三区免费在线观看 | 人人干人人爽 | 亚洲精品久久久久久久久久吃药 | 久久精品女人天堂av | 亚洲午夜视频 | 久草在线高清 | 亚洲欧美日韩精品久久亚洲区 | 久久网一区二区三区 | 亚洲视频在线观看 | 午夜丁香视频在线观看 | 日韩在线观看中文字幕 | 在线看片网站 |