Qt: How to display only Image and hide text in a QCombobox
-
wrote on 18 Dec 2012, 09:54 last edited by
I have a Combobox which has 3 items i.e. Item 1, Item 2 and item 3. I added these 3 items in .ui file and also added an image each for all. Now when I am running the application, it shows the first item in combobox along with a image towards left. When i click on dropdown, I can see all the items along with images.
What I basically want to do is just display the image in the combobox and when user clicks on dropdown, it should show the image and text too.
Scenario: Items and images inside Combobox are added as follows:
Image 1 Item 1
Image 2 Item 2
Image 2 Item 3When I run the app, it should display in combobox as
Image1 since first item gets displayed by default.
-
wrote on 18 Dec 2012, 10:03 last edited by
I think you need to delegate items for your combo box. This topic may be helpful: "SOLVED - QT 4.7 QComboBox Custom Item Delegate Doesn’t affect the current item displayed":http://qt-project.org/forums/viewthread/17880
-
wrote on 18 Dec 2012, 11:02 last edited by
But this is when Combobox is set dynamically. I mean when it is set programmatically. I am doing it vai .ui file. I tried the above method but it doesn't make any difference.
[quote author="AcerExtensa" date="1355825009"]I think you need to delegate items for your combo box. This topic may be helpful: "SOLVED - QT 4.7 QComboBox Custom Item Delegate Doesn’t affect the current item displayed":http://qt-project.org/forums/viewthread/17880[/quote] -
wrote on 18 Dec 2012, 11:15 last edited by
If you want some extra/custom functionality, you should do it yourself... or use it as is....
1/4