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. QComboBox with multiple lines of text
Forum Updated to NodeBB v4.3 + New Features

QComboBox with multiple lines of text

Scheduled Pinned Locked Moved Unsolved General and Desktop
4 Posts 2 Posters 2.7k Views 2 Watching
  • 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.
  • J Offline
    J Offline
    jonny_mac_99
    wrote on last edited by
    #1

    I am trying to make a QCombobox which would have multiple lines of text in the format of a title and a description. This seems to me to be something which would be a common requirement and should be simple to implement but I cant find a simple example or method to do this.

    I am planning on looking into using a delegate to do this but I'm wondering if anyone has any better ideas or examples of this being done before?

    1 Reply Last reply
    0
    • J Offline
      J Offline
      jonny_mac_99
      wrote on last edited by
      #2

      Or possibly rather than using a delegate I should just create a new class with QComboBox as the base class and override the paintEvent to draw the description text?

      1 Reply Last reply
      1
      • SGaistS Offline
        SGaistS Offline
        SGaist
        Lifetime Qt Champion
        wrote on last edited by
        #3

        Hi,

        AFAIK, the delegate is the right thing to do in this case.

        As for your other question, I haven't seen very often a combo box with several lines worth of text for an entry. It would not necessarily make it nice to read/use.

        Interested in AI ? www.idiap.ch
        Please read the Qt Code of Conduct - https://forum.qt.io/topic/113070/qt-code-of-conduct

        J 1 Reply Last reply
        0
        • SGaistS SGaist

          Hi,

          AFAIK, the delegate is the right thing to do in this case.

          As for your other question, I haven't seen very often a combo box with several lines worth of text for an entry. It would not necessarily make it nice to read/use.

          J Offline
          J Offline
          jonny_mac_99
          wrote on last edited by
          #4

          @SGaist In this case the combobox has a minimum size which makes it easily readable. The layout would also only be a title and a one line (possibly even only a few words) description so it should really just be two lines.
          I'll update with my solution when completed. I've parked this for the moment as its not vital to the project.

          1 Reply Last reply
          0

          • Login

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