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

    • <bdo id='ZbUaZ'></bdo><ul id='ZbUaZ'></ul>
    <tfoot id='ZbUaZ'></tfoot>

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

      1. <legend id='ZbUaZ'><style id='ZbUaZ'><dir id='ZbUaZ'><q id='ZbUaZ'></q></dir></style></legend>
        <i id='ZbUaZ'><tr id='ZbUaZ'><dt id='ZbUaZ'><q id='ZbUaZ'><span id='ZbUaZ'><b id='ZbUaZ'><form id='ZbUaZ'><ins id='ZbUaZ'></ins><ul id='ZbUaZ'></ul><sub id='ZbUaZ'></sub></form><legend id='ZbUaZ'></legend><bdo id='ZbUaZ'><pre id='ZbUaZ'><center id='ZbUaZ'></center></pre></bdo></b><th id='ZbUaZ'></th></span></q></dt></tr></i><div class="qwawimqqmiuu" id='ZbUaZ'><tfoot id='ZbUaZ'></tfoot><dl id='ZbUaZ'><fieldset id='ZbUaZ'></fieldset></dl></div>
      2. 將焦點放在 QlineEdit 小部件上

        Setting focus on QlineEdit widget(將焦點放在 QlineEdit 小部件上)
        <tfoot id='MH3oG'></tfoot>

            <tbody id='MH3oG'></tbody>

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

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

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

                  本文介紹了將焦點放在 QlineEdit 小部件上的處理方法,對大家解決問題具有一定的參考價值,需要的朋友們下面隨著小編來一起學習吧!

                  問題描述

                  我正在嘗試組合一個簡單的小部件,其中焦點自動放在 QLineEdit 小部件上(它用于條形碼掃描儀輸入,我不希望最終用戶必須單擊小部件).

                  I am trying to put together a simple widget where the focus is automatically put to a QLineEdit widget (It is for a barcode scanner input, and I don't want the end users to have to click in the widget).

                  相關代碼如下:

                  from qtmodern import styles, windows
                  from qtpy import QtGui, QtCore
                  from qtpy.QtWidgets import *
                  from qtpy.QtCore import Qt
                  
                  class MyGui(QWidget):
                      def __init__(self, parent=None):
                          super(MyGui, self).__init__(parent)
                  
                          layout = QVBoxLayout()
                  
                          self.lineEdit = QLineEdit(self)
                          self.lineEdit.setPlaceholderText('foobar')  
                          self.lineEdit.setFocusPolicy(Qt.StrongFocus)      
                          self.lineEdit.setFocus()
                  
                          layout.addWidget(self.lineEdit)
                  
                          self.setLayout(layout)
                          self.show()
                  
                  def main():
                      app = QApplication([])
                      styles.dark(app)
                  
                      g = windows.ModernWindow(MyGui())
                      g.resize(350,100)
                      location = (50, 100)
                      g.move(location[0], location[1])
                      g.setWindowTitle('SmallTest')
                  
                      g.show()
                      app.exec_()
                  
                  if __name__ == '__main__':
                     main()
                  

                  它不想將焦點放在 lineEdit 小部件上.我猜這是我錯過的非常明顯的東西,但我已經挖了一段時間試圖找到它,但還沒有偶然發現它.

                  And it doesn't want to put the focus on the lineEdit widget. I'm guessing its something really obvious that I've missed, but I've been digging around for a while trying to find it, and haven't stumbled upon it yet.

                  推薦答案

                  你必須使用 setFocus() 小部件顯示后.

                  You must use setFocus() after the widget is displayed.

                  from qtmodern import styles, windows
                  from qtpy import QtGui, QtCore
                  from qtpy.QtWidgets import *
                  from qtpy.QtCore import Qt
                  
                  class MyGui(QWidget):
                      def __init__(self, parent=None):
                          super(MyGui, self).__init__(parent)
                          layout = QVBoxLayout(self)
                          self.lineEdit = QLineEdit(self)
                          self.lineEdit.setPlaceholderText('foobar')  
                          self.lineEdit.setFocusPolicy(Qt.StrongFocus)
                          layout.addWidget(self.lineEdit)
                  
                  def main():
                      app = QApplication([])
                      styles.dark(app)
                      gui = MyGui()
                      g = windows.ModernWindow(gui)
                      g.resize(350,100)
                      location = (50, 100)
                      g.move(*location)
                      g.setWindowTitle('SmallTest')
                      g.show()
                      gui.lineEdit.setFocus()
                      app.exec_()
                  
                  if __name__ == '__main__':
                     main()
                  

                  這篇關于將焦點放在 QlineEdit 小部件上的文章就介紹到這了,希望我們推薦的答案對大家有所幫助,也希望大家多多支持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時顯示進度條?)
                      <bdo id='UHCoc'></bdo><ul id='UHCoc'></ul>

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

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

                              <tbody id='UHCoc'></tbody>
                            主站蜘蛛池模板: 国产精品欧美在线 | 欧美午夜精品久久久久免费视 | 伊人9999 | 日韩一级淫片 | 九色视频丨porny丨丝袜 | 日日夜夜干 | 国产黄色av | 九色在线视频 | 天天看天天操 | 日本理伦片午夜理伦片 | 国产不卡在线观看 | 精品aaa | 久久毛片视频 | 三级黄色在线观看 | 亚洲综合免费 | 中文字幕在线观看一区 | 久久精品99久久久久久 | 中文字幕永久在线 | 福利视频一区二区 | 亚洲综合色网 | 丁香六月激情 | 久久久久久久免费视频 | 欧美日韩视频在线 | 日韩三级精品 | 天天插天天狠天天透 | 亚洲天堂男人 | 日韩欧美一区二区三区 | 日韩欧美小视频 | 欧美日韩91 | 婷婷六月综合 | 大乳女喂男人吃奶 | 亚洲毛片av | 亚洲精品一区二区三区在线 | 欧美日韩国产在线观看 | 亚洲日本一区二区 | 国产成人午夜高潮毛片 | 麻豆国产一区二区三区四区 | 亚洲永久免费视频 | 天天干网站 | 一区二区欧美日韩 | 成人羞羞国产免费游戏 |