Ignore:
Timestamp:
May 5, 2011, 5:36:53 AM (14 years ago)
Author:
Dmitry A. Kuminov
Message:

trunk: Merged in qt 4.7.2 sources from branches/vendor/nokia/qt.

Location:
trunk
Files:
2 edited

Legend:

Unmodified
Added
Removed
  • trunk

  • trunk/src/gui/itemviews/qdirmodel.cpp

    r651 r846  
    11/****************************************************************************
    22**
    3 ** Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies).
     3** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies).
    44** All rights reserved.
    55** Contact: Nokia Corporation (qt-info@nokia.com)
     
    186186/*!
    187187    \class QDirModel
    188 
     188    \obsolete
    189189    \brief The QDirModel class provides a data model for the local filesystem.
    190190
    191191    \ingroup model-view
    192192
    193     \note The usage of QDirModel is not recommended anymore. The
     193    The usage of QDirModel is not recommended anymore. The
    194194    QFileSystemModel class is a more performant alternative.
    195195
     
    201201    QDirModel keeps a cache with file information. The cache needs to be
    202202    updated with refresh().
    203 
    204     A directory model that displays the contents of a default directory
    205     is usually constructed with a parent object:
    206 
    207     \snippet doc/src/snippets/shareddirmodel/main.cpp 2
    208 
    209     A tree view can be used to display the contents of the model
    210 
    211     \snippet doc/src/snippets/shareddirmodel/main.cpp 4
    212 
    213     and the contents of a particular directory can be displayed by
    214     setting the tree view's root index:
    215 
    216     \snippet doc/src/snippets/shareddirmodel/main.cpp 7
    217 
    218     The view's root index can be used to control how much of a
    219     hierarchical model is displayed. QDirModel provides a convenience
    220     function that returns a suitable model index for a path to a
    221     directory within the model.
    222203
    223204    QDirModel can be accessed using the standard interface provided by
     
    11831164void QDirModelPrivate::init()
    11841165{
     1166    Q_Q(QDirModel);
    11851167    filters = QDir::AllEntries | QDir::NoDotAndDotDot;
    11861168    sort = QDir::Name;
     
    11891171    root.info = QFileInfo();
    11901172    clear(&root);
     1173    QHash<int, QByteArray> roles = q->roleNames();
     1174    roles.insertMulti(QDirModel::FileIconRole, "fileIcon"); // == Qt::decoration
     1175    roles.insert(QDirModel::FilePathRole, "filePath");
     1176    roles.insert(QDirModel::FileNameRole, "fileName");
     1177    q->setRoleNames(roles);
    11911178}
    11921179
Note: See TracChangeset for help on using the changeset viewer.