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 we can set tooltip of the desired width with multiple lines in a button?
QtWS25 Last Chance

How we can set tooltip of the desired width with multiple lines in a button?

Scheduled Pinned Locked Moved General and Desktop
4 Posts 3 Posters 8.3k 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.
  • P Offline
    P Offline
    pratik041
    wrote on last edited by
    #1

    If the length of tooltip text exceeds the given width the remaining tooltip text will be displayed in the next line, instead of displaying the whole text in single line.

    Pratik Agrawal

    1 Reply Last reply
    0
    • A Offline
      A Offline
      andre
      wrote on last edited by
      #2

      So... you want to prevent a line break?

      First of all, notice that long lines of text are hard to read, especially on a screen. I normally find myself manually breaking tooltip texts as they appear too long for my taste.

      Then: you can use rich text. You might try to use a <span> element around your non-breaking line.

      1 Reply Last reply
      0
      • P Offline
        P Offline
        pratik041
        wrote on last edited by
        #3

        No, i want the multiple lines but according to width i give. I mean each line should be of the given width.

        Pratik Agrawal

        1 Reply Last reply
        0
        • G Offline
          G Offline
          goetz
          wrote on last edited by
          #4

          Maybe this will work:

          @
          QString toolTipText =
          "<nobr>A short line</nobr><br/>"
          "<nobr>This is a much longer line than the first</nobr>";
          @

          I don't understand your last comment:

          [quote author="pratik041" date="1317132756"]No, i want the multiple lines but according to width i give. I mean each line should be of the given width.[/quote]

          What do you want to do? Do you want to set the width of the tooltip manually? Sometimes it's hard to describe something in text, an image with a screenshot of the current situation and a scribble how you want it to look like would be helpful in this case.

          http://www.catb.org/~esr/faqs/smart-questions.html

          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