Paths to QTreeWidget

  • Hello,
    I am working on a clone of Ark (KDE Archiver program) and my library of choice opens the archive and gives me paths for every file, eg Archive/potato.txt or Potato/usr/lib. This path is originally a const char*, which I've converted to a QStringList for each section of the path.

    The trouble is, I want to put that into a QTreeWidget, but I have absolutely no clue how to adapt it, as the example doesn't cover how to add columns or multiple levels. I want my QTreeWidget to have three columns (Name, Filesize and Date Modified), which are in seperate QStringLists. Ideally the structure should look like this:

    -- usr
    ---- lib
    ------ text.txt
    ------ potato.txt

    Thanks, VOT.

  • From my personal experience I would strongly recommend you using QTreeView and QAbstractItemModel instead. Tasks like this will always call for some custom behavior which will always be a paint to implement with the standard widget versions.

    To learn how to work with a QTreeView I would recommend you having a look at the Simple Tree Model Example:

Log in to reply