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. How to show full text of QComboBox without resizing
Forum Updated to NodeBB v4.3 + New Features

How to show full text of QComboBox without resizing

Scheduled Pinned Locked Moved Solved General and Desktop
7 Posts 2 Posters 2.9k 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.
  • ? Offline
    ? Offline
    A Former User
    wrote on last edited by
    #1

    Hello All,
    I've a QcomboBox which should display the full text of current item when mouse is hovered on it. This should happen without resizing the QComboBox.
    The solution that i can think of is to have a QLabel which can show rich text on QCombobox when mouse is hovered on it. I tried tooltips and they weren't visually appealing, so i thought of using QLabel.
    But how can i do this, i mean how can i capture mouse hover event and display QLabel exactly on top of QcomboBox?
    I'm new to GUI programmig & to Qt. Please share your ideas.

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

      Hi and welcome to devnet,

      Are you looking for something like QToolTip ?

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

      ? 1 Reply Last reply
      0
      • SGaistS SGaist

        Hi and welcome to devnet,

        Are you looking for something like QToolTip ?

        ? Offline
        ? Offline
        A Former User
        wrote on last edited by
        #3

        @SGaist
        Hi,
        I tried tool tip but it din't look that good visually,
        So i want to have something which can show rich text & QLabel is what i thought of using.
        Btw does tooltip allow text fromating & changing background colors & stuff like that.
        But still tooltip is for small text & some of my items are dynamically changing which can be of large length at times.

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

          Yes you can use rich text in tool tip, there's a link in the detailed description of the class for that.

          How big can your items be ?

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

          1 Reply Last reply
          0
          • ? Offline
            ? Offline
            A Former User
            wrote on last edited by
            #5

            thanks for the quick replies @SGaist & i'll check that link in class detailed description now,
            Well, some items of combo boxes have several object names so i can't guess how big that item is gonna be. I just want the user to be able to see all those object names when they hover mouse on QComboBox.
            This is the reason i want to use something else like QLabel but i donno how to show exactly on top of combobox and this should work cross platform too.

            1 Reply Last reply
            0
            • ? Offline
              ? Offline
              A Former User
              wrote on last edited by
              #6

              Well, I'm happy with QToolTip. That means that i'll have a tool tip which displays full text of combobox currently selected item which changes with the current item.
              Thanks to @SGaist .

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

                You're welcome !

                Since you have it working now please mark the thread as solved with the "Topic Tool" button so other forum users may know a solution has been found :)

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

                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