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. Model - view problem
Forum Updated to NodeBB v4.3 + New Features

Model - view problem

Scheduled Pinned Locked Moved General and Desktop
1 Posts 1 Posters 488 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.
  • R Offline
    R Offline
    Ric01
    wrote on last edited by
    #1

    I create a file browser with additional functions and data.
    I implemented an own hierarchical model derived from QAbstractItemModel for my data structure.
    I want to display hierarchical data (files and directories) two ways;

    1. with a tree view, like this:

    plants
    ---rose
    ---fruits
    ------grape
    ------apple
    ------pear
    animals
    ---dog

    1. with a table view (nodes have columns), like this (only files):

    plants/rose
    plants/fruits/grape
    plants/fruits/apple
    plants/fruits/pear
    animals/dog

    My problem is QTableView can display data directly under a specified node (QModelIndex), on one level.
    I can set the root node (QModelIndex) with setRootIndex(), but I want to
    display all hierarchical data (except directories), as shown.

    Creating a model is useful, because I want to edit data, too, using the different widgets.

    What is the correct way to solve this problem? Creating an own view derived from QTableView?

    Thanks.

    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