Details
-
Suggestion
-
Resolution: Unresolved
-
P3: Somewhat important
-
Some future release
-
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
- relates to
-
QTBUG-562 QItemDelegate: Support for richtext
-
- Reported
-
-
QTBUG-2380 QHeaderView should support richtext in the labels
-
- Open
-
-
QTBUG-2867 Rich-text in combo box items
-
- Open
-