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

Make views able to render rich text

    XMLWordPrintable

Details

    • Suggestion
    • Resolution: Unresolved
    • P3: Somewhat important
    • Some future release
    • Some future release
    • Widgets: Itemviews
    • None

    Description

      It is often very useful to be able to render rich text in an item view. The current way of styling items only allow for setting styles for a complete item, but that is often not desireable. Being able to render rich text would be a huge improvement.
      Currently, it is very hard to add that functionality yourself. While rendering the rich text itself is doable, it is nigh on impossible to do so in a way that works with the rendering styles in the correct way. Therefor, I think this should be implemented in Qt itself. I think it should be handled by QStyledItemDelegate. Perhaps the current data roles related to styling items could be used as default values, that can be overridden by the rich text itself. This way, current code would continue to work.

      To make the functionality even more useful, it would be great if the delegate provided signals to indicate hovering and clicking of links in the rich text. That way, item views can be made so much more interactive. A suggestion for a signature for such signals would be:

      QStyledItemDelegate::linkActivated(const QModelIndex& index, const QString& link);
      QStyledItemDelegate::linkHovered(const QModelIndex& index, const QString& link);

      This would be analogous to the signals in QLabel. Alternatively, the link could be a QUrl to be more compatible with QTextBrowser (why these two differ in signatures at all is another question, probably historical difference?)

      To make it absolutely rock, the text would be styleable using a stylesheet, and would get properties so you can use the column, row or perhaps even the other data roles to select the correct style for an item. This would result in a great flexibility.

      Attachments

        Issue Links

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

          Activity

            People

              qt.team.quick.subscriptions Qt Quick and Widgets Team
              andre André Somers
              Votes:
              12 Vote for this issue
              Watchers:
              3 Start watching this issue

              Dates

                Created:
                Updated:

                Gerrit Reviews

                  There are no open Gerrit changes