Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • Users
  • Groups
  • Search
  • Get Qt Extensions
  • Unsolved
Collapse
Brand Logo
  1. Home
  2. Qt Development
  3. General and Desktop
  4. Qt: How to display only Image and hide text in a QCombobox
Forum Update on Monday, May 27th 2025

Qt: How to display only Image and hide text in a QCombobox

Scheduled Pinned Locked Moved General and Desktop
4 Posts 2 Posters 5.4k Views
  • Oldest to Newest
  • Newest to Oldest
  • Most Votes
Reply
  • Reply as topic
Log in to reply
This topic has been deleted. Only users with topic management privileges can see it.
  • S Offline
    S Offline
    Stoned Jesus
    wrote on 18 Dec 2012, 09:54 last edited by
    #1

    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 3

    When I run the app, it should display in combobox as

    Image1 since first item gets displayed by default.

    --
    Thanks & Regards,
    Stoned Jesus

    1 Reply Last reply
    0
    • A Offline
      A Offline
      AcerExtensa
      wrote on 18 Dec 2012, 10:03 last edited by
      #2

      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

      God is Real unless explicitly declared as Integer.

      1 Reply Last reply
      0
      • S Offline
        S Offline
        Stoned Jesus
        wrote on 18 Dec 2012, 11:02 last edited by
        #3

        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]

        --
        Thanks & Regards,
        Stoned Jesus

        1 Reply Last reply
        0
        • A Offline
          A Offline
          AcerExtensa
          wrote on 18 Dec 2012, 11:15 last edited by
          #4

          If you want some extra/custom functionality, you should do it yourself... or use it as is....

          God is Real unless explicitly declared as Integer.

          1 Reply Last reply
          0

          1/4

          18 Dec 2012, 09:54

          • Login

          • Login or register to search.
          1 out of 4
          • First post
            1/4
            Last post
          0
          • Categories
          • Recent
          • Tags
          • Popular
          • Users
          • Groups
          • Search
          • Get Qt Extensions
          • Unsolved