Uploaded image for project: 'Qt'
  1. Qt
  2. QTBUG-82359

Expose A Way To Draw Elided Item Text with QStyle

    XMLWordPrintable

    Details

    • Platform/s:
      All

      Description

      There seems to be no easy way to draw elided item text inside of a QStyledItemDelegate with QStyle. If all I want to do is draw text in a tree/table view cell exactly as the default implementation would, but just change the position or width of the text, it requires a TON of boilerplate code to get that working.

       

      I tried copying the source code for the default implementation of QStyledItemDelegate::paint, but even this resulted in a dead-end. This method calls QStyle::drawControl with the QStyle::CE_ItemViewItem case. This then calls d->viewItemDrawText(p, vopt, textRect); The problem with that is it's calling private code. I don't have any way of drawing the text using the Qt way other than messing with Qt internals or copying source code which can become outdated with a new Qt release.

       

      Please expose a way to simply draw elided text for a tree/table view item.

        Attachments

        No reviews matched the request. Check your Options in the drop-down menu of this sections header.

          Activity

            People

            Assignee:
            esabraha Eskil Abrahamsen Blomfeldt
            Reporter:
            elveatles Erik Carlson
            Votes:
            0 Vote for this issue
            Watchers:
            1 Start watching this issue

              Dates

              Created:
              Updated:

                Gerrit Reviews

                There are no open Gerrit changes