久久久久久久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>
                            主站蜘蛛池模板: 久草在线 | 国产区精品在线观看 | 99re免费 | 成年人在线观看视频 | 99热视| 国产午夜精品一区二区三区在线观看 | 日韩欧美在线播放 | 亚洲欧美中文日韩在线v日本 | 少妇av片| 国产欧美一区二区三区久久手机版 | 99国产精品99久久久久久 | 91在线免费视频 | 精品视频在线免费观看 | 精品一二区 | 亚洲大片一区 | 免费高清av | 亚洲成人一区二区 | 国产免费一区二区三区 | 北条麻妃一区二区三区在线视频 | 99久久免费精品视频 | 尤物视频在线免费观看 | 久草电影网 | 极品一区 | 欧美日韩国产三级 | 久久精品亚洲精品国产欧美 | 久久精品美女 | 日韩一区在线播放 | 成人av电影网 | 国产精品久久久久久久久久免费看 | 亚洲国产精品va在线看黑人 | com.色.www在线观看 | 久久国产精品视频免费看 | 国产成人精品一区二区三区网站观看 | 欧美aa在线| 中文成人在线 | 精品91久久 | 成人久久18免费网站图片 | 欧美狠狠操 | 欧美性受 | 亚洲免费婷婷 | 国产成人免费在线观看 |