Pyqt columnview, qfilesystemmodel, qsplitter, and qtreeview examples (provided by official examples)

Source: Internet
Author: User

From pyqt4.qtgui import (qapplication, qcolumnview, qfilesystemmodel,

Qsplitter, qtreeview)

# Note

"""

The qcolumnview class provides the implementation of a model/View column view, inheriting q1_actitemview

Provides a data model for a local file system that inherits the q1_actitemmodel

Implements a shunt widget that inherits the qframe

Provides the implementation of a default model/view Tree View, inherits qabstractitemview, and inherits qhelpcontentwidget and qtreewidget

"""

Import sys

From pyqt4.qtcore import QT

 

Qtextcodec. setcodecfortr (qtextcodec. codecforname ("utf8 "))

If _ name __= = '_ main __':

APP = qapplication (SYS. argv)

Splitter = qsplitter () # display two parts with the same view

Model = qfilesystemmodel () # Display Module

Model. setrootpath (qdir. rootpath () # setrootpath any path

Views = []

For viewtype in (qcolumnview, qtreeview ):

View = viewtype (splitter) # Created in split view

View. setmodel (model) # view Model

View. setrootindex (model. Index (qdir. homepath () # Set the root index of the view as your home directory.

Splitter. Show () # display

Splitter. setwindowstate (QT. windowmaximized) # maximum allocation window

Sys.exit(app.exe C _ () # Start the main program

:

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.