2014-11-06 298 views
2

我嘗試從QComboBox列表中做出列表我認爲它是QListView/QAbstractItemView變得透明。就像在這個例子中,我希望看到列表中的按鈕。QCombobox透明項目列表樣式表

enter image description here

我試圖把:

background: transparent background-color: transparent border-style: transparent border-color: transparent

喜歡到處。

+0

這可能是有幫助的[刪除QListView背景](http://stackoverflow.com/questions/6999027/remove-qlistview-background) – Ezee 2014-11-06 13:58:19

+0

不行,它沒有工作我試過這個,但謝謝。它很容易得到自己的例子來測試解決方案,簡單地添加'QCombobox'及其下的東西,幾個元素組合框。 – kajojeq 2014-11-06 14:15:34

+0

http://www.qtcentre.org/threads/15458-Make-the-QComboBox-popup-translucent-or-transparent你的看法是透明的,但其他的東西不是:QComboBoxPrivateContainer我不知道如何解決這個問題。 – Chernobyl 2014-11-06 15:22:47

回答

3

於是,我問QT的支持,並與答案是不容易做到這一點的樣式表和建議的方法是改變其中繪製的組合框列表中的彈出式窗口的不透明度屬性:

if (combo->view()->parentWidget()) 
    combo->view()->parentWidget()->setWindowOpacity(0.5); 

希望這會有所幫助。

+0

非常感謝! – 2016-09-17 17:21:24