QT Directory tree Implementation

Source: Internet
Author: User

1 View

Depending on the description of reference [4], you can use Qtreeview or qlistview to display the directory tree.

2 Model

2.1 File System Model

Implement a System file directory tree mode, you can choose to use Qfilesystemmodel or qdirmodel[4],qt routines "Dir View Example" is a good example of a directory tree, as shown in the figure below:


Many times we only need to display the file name/directory list in the directory tree, without additional information. Reference [4] shows a method that displays only the 1th column names, not the other property columns.

2.2 Custom Model

If you want to customize the node content of the tree, you can use Qstandarditemmodel, as described in "Qstandarditemmodel memory Management".

Resources

[1] A Qtreeview development example of tree control in QT

[2] Tree control Qtreeview Implementation

[3] Easy picture viewing with Qfilesystemmodel and ListView

[4] Qfilesystemmodel Usage Summary

[5] From a relative path (c + + to QT)

[6] QT Traversal folder

[7] The realization of the Qt qtreewidget tree-shaped structure

[8] Qtreeview how to get the signal and get the contents of the current node when the keyboard is selected

[9] The use of QT tree control Qtreeview

[11] File browsing in QT


Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.