| Home | ![]() |
The QtDirectoryBrowser class provides a tree view of a directory in the file system. More...
#include <qtdirectorybrowser.h>
QtDirectoryBrowser is based on QListView, and displays the contents of one or more directories in a tree view. The paths can be specified in the constructor or using setStartPaths().
QtDirectoryBrowser can display several columns for each object in a directory, including the file or directory name, type, size, date, owner, group, and the access permissions. To show or hide a column, call setColumnEnabled(). The user can also show or hide a column by right-clicking the QListView header.
The class emits itemClicked(), itemDoubleClicked(), and itemRightClicked() signals when the user clicks on an item in the view. Each signal is emitted with the relevant QtDirectoryBrowserItem as the argument. In addition to these, all the standard signals from QListView are also emitted.
The user can change the path displayed in the directory browser using drag and drop or copy and paste. Both features can be disabled with setCopyPasteEnabled() and setDragDropEnabled().
Dropping a directory on the list view causes that directory to become the currently displayed directory.
The copy and paste menu can be accessed by right-clicking the view. Pasting a directory path causes this path to be currently displayed directory.
Example:
QStringList rootPaths << "/" << "/home/robert" << "/usr";
QtDirectoryBrowser *dirBrowser = new QtDirectoryBrowser(rootPaths);
dirBrowser->show();
See also
See also setColumnHidden().
This enum specifies the different file permission styles.
See also flagStyle.
This enum specifies the different folder icons that are used in the directory browser.
See also setFolderIcon().
This enum specifies the different size display styles.
See also sizeStyle.
See also startPaths.
Returns the format for displaying file attributes. See the "flagStyle" property for details.
Returns TRUE if copy and paste is enabled If this property is true, a copy and paste popup menu is displayed when the user right-clicks inside the directory browser; otherwise returns FALSE. See the "copyPasteEnabled" property for details.
Returns TRUE if only directories are displayed in the directory browser; otherwise returns FALSE. See the "displayDirectoriesOnly" property for details.
Returns TRUE if the directory browser should show symbolic link targets; otherwise returns FALSE. See the "displaySymlinkTargets" property for details.
Returns TRUE if drag and drop is enabled; otherwise returns FALSE. See the "dragDropEnabled" property for details.
This signal is emitted whenever the user clicks on an item in the list view. item is the directory browser item that was clicked.
This signal is emitted whenever an item is double-clicked. It is emitted on the second button press, not the second button release. item is the directory browser item that was double-clicked.
This signal is emitted when the right button is clicked. item is the directory browser item that was clicked.
Resets the paths displayed in the directory browser view. See the "startPaths" property for details.
Sets whether copy and paste is enabled If this property is true, a copy and paste popup menu is displayed when the user right-clicks inside the directory browser to enable. See the "copyPasteEnabled" property for details.
Sets whether only directories are displayed in the directory browser to enable. See the "displayDirectoriesOnly" property for details.
Sets whether the directory browser should show symbolic link targets to enable. See the "displaySymlinkTargets" property for details.
Sets whether drag and drop is enabled to enable. See the "dragDropEnabled" property for details.
Sets the format for displaying file attributes to style. See the "flagStyle" property for details.
Sets the style used when displying file sizes to style. See the "sizeStyle" property for details.
Sets the paths displayed in the directory browser view to startPaths. See the "startPaths" property for details.
Returns the style used when displying file sizes. See the "sizeStyle" property for details.
Returns the paths displayed in the directory browser view. See the "startPaths" property for details.
This property holds whether copy and paste is enabled If this property is true, a copy and paste popup menu is displayed when the user right-clicks inside the directory browser.
This menu can be used to copy file or directory paths to the clipboard, or to display a directory by pasting its path from the clipboard.
The default is true (copy and paste is enabled).
Set this property's value with setCopyPasteEnabled() and get this property's value with isCopyPasteEnabled().
This property holds whether only directories are displayed in the directory browser.
By default, this property is false (files will also be displayed).
See also displaySymlinkTargets.
Set this property's value with setDisplayDirectoriesOnly() and get this property's value with isDisplayDirectoriesOnlyEnabled().
This property holds whether the directory browser should show symbolic link targets.
If this property is true then the symbolic link target is displayed after each symbolic link in the Name column.
The default is true (link targets are shown).
Set this property's value with setDisplaySymlinkTargetsEnabled() and get this property's value with isDisplaySymlinkTargetsEnabled().
This property holds whether drag and drop is enabled.
If this property is true, the user can drag and drop filenames to and from the directory browser.
When a directory is dropped on the view, the view is updated to display the new directory.
The default is true (drag and drop is enabled).
Set this property's value with setDragDropEnabled() and get this property's value with isDragDropEnabled().
This property holds the format for displaying file attributes.
FlagStyle selects whether file attributes are displayed like a Unix file permission string (UnixStyle) or as Windows read/write/execute attributes (WindowsStyle).
The default is WindowsStyle on windows and UnixStyle on other systems. Note that UnixStyle can be slow when viewing directory structures residing on an NTFS file system.
Set this property's value with setFlagStyle() and get this property's value with flagStyle().
This property holds the style used when displying file sizes.
The size style can be either UnformattedSize or FormattedSize. UnformattedSize shows the size in bytes, while FormattedSize displays the size in a style that is easier to read by showing the size in bytes, kilobytes, megabytes, or gigabytes.
The default is QtDirectoryBrowser::FormattedSize.
Set this property's value with setSizeStyle() and get this property's value with sizeStyle().
This property holds the paths displayed in the directory browser view.
The start paths are the directories that are shown in the directory browser if no other paths are specified when it is constructed.
The default is the system's root path(s) (for example, "A:\", "C:\", "D:\" on Windows, and "/" on Unix and Mac OS X).
Set this property's value with setStartPaths(), get this property's value with startPaths(), and reset this property's value with resetStartPaths().
This file is part of the Qt Solutions.
Copyright © 2003-2005
Trolltech. All Rights Reserved.
| Copyright © 2003-2005 Trolltech | Trademarks | Qt Solutions
|