Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • Users
  • Groups
  • Search
  • Get Qt Extensions
  • Unsolved
Collapse
Brand Logo
  1. Home
  2. Qt Development
  3. General and Desktop
  4. Paths to QTreeWidget
Forum Updated to NodeBB v4.3 + New Features

Paths to QTreeWidget

Scheduled Pinned Locked Moved General and Desktop
2 Posts 2 Posters 821 Views 1 Watching
  • Oldest to Newest
  • Newest to Oldest
  • Most Votes
Reply
  • Reply as topic
Log in to reply
This topic has been deleted. Only users with topic management privileges can see it.
  • V Offline
    V Offline
    Votato
    wrote on last edited by
    #1

    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:

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

    Thanks, VOT.

    Joel BodenmannJ 1 Reply Last reply
    0
    • V Votato

      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:

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

      Thanks, VOT.

      Joel BodenmannJ Offline
      Joel BodenmannJ Offline
      Joel Bodenmann
      wrote on last edited by
      #2

      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: http://doc.qt.io/qt-5/qtwidgets-itemviews-simpletreemodel-example.html

      Industrial process automation software: https://simulton.com
      Embedded Graphics & GUI library: https://ugfx.io

      1 Reply Last reply
      0

      • Login

      • Login or register to search.
      • First post
        Last post
      0
      • Categories
      • Recent
      • Tags
      • Popular
      • Users
      • Groups
      • Search
      • Get Qt Extensions
      • Unsolved