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 QTreeWidgetItem::QTooltip setFixedWidth ?

How QTreeWidgetItem::QTooltip setFixedWidth ?

Scheduled Pinned Locked Moved Unsolved General and Desktop
3 Posts 3 Posters 410 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.
  • sonichyS Offline
    sonichyS Offline
    sonichy
    wrote on last edited by
    #1

    QTreeWidgetItem.setTooltip(s) is too wide, need fixed width.

    https://github.com/sonichy

    JonBJ 1 Reply Last reply
    0
    • B Offline
      B Offline
      Bonnie
      wrote on last edited by
      #2

      As far as I know, you can't.
      But it accepts rich text, so you can add html <br/> tag to your text to make it start a new line.

      1 Reply Last reply
      3
      • sonichyS sonichy

        QTreeWidgetItem.setTooltip(s) is too wide, need fixed width.

        JonBJ Offline
        JonBJ Offline
        JonB
        wrote on last edited by JonB
        #3

        @sonichy
        As @Bonnie has written, <br/>. I reply to illustrate this because I actually found them too narrow! I wanted to make it so they only wrap on <br/>, and so have:

        QString UIUtils::tooltipTextNoWrap(const QString &text)
        {
            //make tooltip text not wrap, so that it is wide and only breaks on explicit embedded "<br/>"
            return QString("<style>p { margin: 0 0 0 0 }</style><p style=\"white-space:pre\">%1</p>").arg(text);;
        }
        

        If you wish to control exactly where your tooltips wrap this can be used.

        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