4

I am using a Qt 4's QFileSystemModel and QTreeView. I am writing a Windows Explorer like file manager, and want to make a tree more similar to Windows', where tree consist some shortcut paths like Desktop, My Documents. The only thing I want is to make a tree look like this:

  • My Computer
    • Desktop
    • My Documents
    • C:\
    • D:\
    • ...

I heard that it can be achieved with QAbstractProxyModel. Have any one used the QAbstractProxyModel and get it working? If yes please provide any appropriate example. Thanks in advance.

This question is the same as How to add custom row in QFileSystemModel?

Community
  • 1
  • 1
  • I think you mixed up QGraphicsProxyWidget with QAbstractProxyModel – leemes Oct 05 '12 at 11:06
  • Now as you mentioned it, I remind that it should be `QIdentityProxyModel` or `QAbstractProxyModel`, or even both at the same time. Is there a way to change the title? – Aziz Latypov Oct 05 '12 at 13:50
  • So essentially you want to have "aliases" in the tree, where one item virtually points to another item. I never did so and can't help you, but I think this should be possible with `QAbstractItemModel` I think the `QIdentityProxyModel` is the wrong one. – leemes Oct 05 '12 at 17:01

1 Answers1

0

Can you explain more what is missing in QTreeView to handle your example tree?

What about using a simple QTreeView example like http://www.java2s.com/Code/Cpp/Qt/QTreeViewdemoandQStandardItem.htm as a starting point to get what you are looking for?

Zane
  • 926
  • 8
  • 21
  • 1
    In example you have provided they use `QStandardItemModel`, so you can add to standard model whatever you need. But `QFileSystemModel` takes its content from your file system, and by default it only contains _Drives_ (in Windows), so it looks like: C:\, D:\, .... The thing I need is - to add here two things: a shortcut to Desktop and My Documents. As I said before seems that this can be achieved using `QGraphicsProxyWidget`, but I can not get it working=( – Aziz Latypov Oct 05 '12 at 13:35