qtpyqtpyqt5pyqt4

How to render a Tree made of lengthy text nodes in Qt/PyQt


I'm building an GUI app in which i want to render a tree of lengthy text nodes (something like a typical hackernews webpage). Since Qt has a rich widget system and there are multiple ways to do the same thing, There is always a question of What is the best way to do it.

To render the tree i'm considering two widgets right now

  1. QTreeWidget
  2. QtWebEngine

Are there any other widgets/methods in Qt which handle my use case better?


Solution

  • QTreeWidget is one option, QtWebEngine is extremely heavy and I wouldn't touch it unless you have a clear need to render html content. This stuff can be implemented using a plain QTextDocument as the data model, and QTextEdit as a view.