久久久久久久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 中將項(xiàng)目添加到 QComboBox

        How to add items to a QComboBox in PyQt/PySide(如何在 PyQt/PySide 中將項(xiàng)目添加到 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 中將項(xiàng)目添加到 QComboBox的處理方法,對(duì)大家解決問題具有一定的參考價(jià)值,需要的朋友們下面隨著小編來一起學(xué)習(xí)吧!

                  問題描述

                  我需要一些幫助來添加一些項(xiàng)目到 QComboBox.所以我有兩個(gè)組合框,一個(gè)根據(jù)所選項(xiàng)目填充另一個(gè).

                  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 用于新項(xiàng)目,它可以工作,但如果我為組合框選擇另一個(gè)選項(xiàng),它會(huì)添加新項(xiàng)目,但以前的項(xiàng)目已經(jīng)消失 - 而且有新項(xiàng)目下方的空白項(xiàng)目.

                  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.

                  我以為每次我從第一個(gè)組合框中選擇一個(gè)新選項(xiàng)來清除第二個(gè)組合框的內(nèi)容.所以我在第二個(gè)中使用了 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))
                  

                  以上是當(dāng)?shù)谝粋€(gè)combobox改變時(shí)執(zhí)行的函數(shù)的一部分.

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

                  推薦答案

                  假設(shè) list1 是一個(gè)字符串列表,那么您可以簡(jiǎn)單地使用 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)
                  

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

                  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'),
                      ]
                  

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

                  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.

                  編輯

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

                  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)
                  

                  這篇關(guān)于如何在 PyQt/PySide 中將項(xiàng)目添加到 QComboBox的文章就介紹到這了,希望我們推薦的答案對(duì)大家有所幫助,也希望大家多多支持html5模板網(wǎng)!

                  【網(wǎng)站聲明】本站部分內(nèi)容來源于互聯(lián)網(wǎng),旨在幫助大家更快的解決問題,如果有圖片或者內(nèi)容侵犯了您的權(quán)益,請(qǐng)聯(lián)系我們刪除處理,感謝您的支持!

                  相關(guān)文檔推薦

                  How to bind a function to an Action from Qt menubar?(如何將函數(shù)綁定到 Qt 菜單欄中的操作?)
                  PyQt progress jumps to 100% after it starts(PyQt 啟動(dòng)后進(jìn)度躍升至 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 刻度標(biāo)簽設(shè)置在固定位置,以便當(dāng)我向左或向右滾動(dòng)時(shí),yaxis 刻度標(biāo)簽應(yīng)該可見
                  `QImage` constructor has unknown keyword `data`(`QImage` 構(gòu)造函數(shù)有未知關(guān)鍵字 `data`)
                  Change x-axis ticks to custom strings(將 x 軸刻度更改為自定義字符串)
                  How to show progress bar while saving file to excel in python?(如何在python中將文件保存為excel時(shí)顯示進(jìn)度條?)
                  <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>

                            主站蜘蛛池模板: 看a网站 | 日韩www| 特一级黄色毛片 | 丁香婷婷综合激情五月色 | 国产免费一区二区三区 | 欧美一区二区三区精品免费 | 99综合在线 | 中文字幕亚洲在线 | 亚洲精品二区 | 99热在线免费 | 这里只有精品99re | 久久男人 | 欧美精品一区二区三区四区 | 男女啪啪高潮无遮挡免费动态 | 成人一级片在线观看 | 91 在线| 欧美在线天堂 | 九九热在线视频 | 中文字幕在线观看第一页 | h视频在线观看免费 | 亚洲欧美中文字幕在线观看 | 欧美综合国产精品久久丁香 | 久久久一区二区三区 | 国产精品一区二区电影 | 91精品国产欧美一区二区成人 | 精品一区二区三区四区视频 | 亚洲成人黄色 | h视频免费在线观看 | 午夜寂寞影院在线观看 | 亚洲日韩中文字幕一区 | 天天躁日日躁狠狠躁白人 | 中文字幕高清视频 | 亚洲日本乱码在线观看 | 日日碰狠狠躁久久躁婷婷 | 欧美天堂| 亚洲成人一区 | www亚洲一区| 亚洲视频精品 | 亚洲欧美国产精品久久 | 午夜大片| 黄在线免费观看 |