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

  • <tfoot id='Ir4tT'></tfoot>

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

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

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

          <bdo id='Ir4tT'></bdo><ul id='Ir4tT'></ul>

      1. 如何在 PyQt/PySide 中將項目添加到 QComboBox

        How to add items to a QComboBox in PyQt/PySide(如何在 PyQt/PySide 中將項目添加到 QComboBox)

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

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

                    <tbody id='UED4q'></tbody>
                  <tfoot id='UED4q'></tfoot><legend id='UED4q'><style id='UED4q'><dir id='UED4q'><q id='UED4q'></q></dir></style></legend>
                  本文介紹了如何在 PyQt/PySide 中將項目添加到 QComboBox的處理方法,對大家解決問題具有一定的參考價值,需要的朋友們下面隨著小編來一起學習吧!

                  問題描述

                  我需要一些幫助來添加一些項目到 QComboBox.所以我有兩個組合框,一個根據所選項目填充另一個.

                  I need some help adding some items to a QComboBox. So I have two comboboxes, and one populates the other depending on the item selected.

                  我的問題是,將 additem 用于新項目,它可以工作,但如果我為組合框選擇另一個選項,它會添加新項目,但以前的項目已經消失 - 而且有新項目下方的空白項目.

                  My question is that, using additem for new items, it works, but if I choose another option for the combobox, it adds the new items, but the previous items are gone - and there are blank items below the new ones.

                  我以為每次我從第一個組合框中選擇一個新選項來清除第二個組合框的內容.所以我在第二個中使用了 clear() - 但它不起作用.

                  I thought that each time I chose a new option from the first combobox to clear the contents of the second combobox. So I used the clear() on the second - but it didn't work.

                  我是這么想的:

                  self.comboBox_2.clear()
                  for index,i in enumerate(list1):
                    self.comboBox_2.addItem(_fromUtf8(""))
                    self.comboBox_2.setItemText(index+2, QApplication.translate("Dialog", i, None, QApplication.UnicodeUTF8))
                  

                  以上是當第一個combobox改變時執行的函數的一部分.

                  The above is part of a function that executes when the first combobox changes.

                  推薦答案

                  假設 list1 是一個字符串列表,那么您可以簡單地使用 addItems 方法:

                  Assuming list1 is a list of strings, then you can simply add them all at once using the addItems method:

                  self.comboBox_2.clear()
                  self.comboBox_2.addItems(list1)
                  

                  請注意,您可能在示例中以錯誤的方式使用了 QApplication.translate.如果您想讓 list1 中的字符串可以翻譯成不同的語言,您應該在 create 列表時這樣做,并使用 字符串字面量.

                  Note that you are probably using QApplication.translate in the wrong way in your example. If you want to make it possible for the strings in list1 to be translated into a different language, you should do that when you create the the list, and use string literals.

                  例如:

                  list1 = [
                      self.tr('First Item'),
                      self.tr('Second Item'),
                      self.tr('Third Item'),
                      ]
                  

                  另請注意,_fromUtf8 函數只有在您的代碼中使用包含非 ascii 字符的字符串文字時才真正有用 - 否則,它基本上是無操作的.

                  Also note that the _fromUtf8 function is only really useful if you're using string literals containing non-ascii characters in your code - otherwise, it's basically a no-op.

                  編輯

                  如果您的列表包含像素圖和文本的元組,那么您可以使用以下內容:

                  If your list contains, say, tuples of pixmaps and text, then you can use something like this:

                  self.comboBox_2.clear()
                  for pixmap, text in list1:
                      self.comboBox_2.addItem(QIcon(pixmap), text)
                  

                  這篇關于如何在 PyQt/PySide 中將項目添加到 QComboBox的文章就介紹到這了,希望我們推薦的答案對大家有所幫助,也希望大家多多支持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時顯示進度條?)
                  <tfoot id='EUagO'></tfoot>

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

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

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

                            主站蜘蛛池模板: 中文字幕在线一区二区三区 | 国产永久视频 | 国产欧美日韩在线观看 | 亚洲精品乱码 | 午夜免费视频 | 99精品网站 | 国产成人91 | 日韩欧美亚洲国产 | 免费观看一级一片 | 欧美精品在线一区 | 91视频免费观看 | 五月婷婷激情综合 | 黄色片在线播放 | 欧美a一级 | 成人免费视频网址 | 久久综合社区 | 日韩精品久久久久久久酒店 | 国产三级在线播放 | 午夜精品久久久 | 精品免费在线观看 | 亚洲欧美精品 | 丁香婷婷激情 | 中文字幕在线看片 | 国产成人精品三级麻豆 | 婷婷久久综合 | 久久精品久久久久 | xxxxx黄色 | 91久久久久久久久 | 国产日韩精品一区二区 | 91视频在线 | 最新中文字幕av | 欧美va亚洲va | 天天碰天天操 | 日韩精品视频免费播放 | 成年人av | 四虎看片| 91爱视频 | 黄色aaa| 日本伊人网 | 成人爽a毛片一区二区免费 亚洲午夜在线观看 | 日韩二区在线 |