コード例 #1
0
/*
 * This slot uses for setting root index in a current view only if a dir was activated.
 * If there are trying to activate a file, nothing will be done.
 */
void MainWindow::slotActivatedOnlyDirs(const QModelIndex &index)
{
    QAbstractItemView *view = 0;
    if (isDir(index) && (view = dynamic_cast<QAbstractItemView *>(sender()) ) )
        view->setRootIndex(index);
    resetRightView(index);
}
コード例 #2
0
    void doChDir(const QDir& dir)
    {
        QString path = dir.canonicalPath();
        if (fsModel)
            currentModelIndex = fsModel->setRootPath(path);
        if (view)
            view->setRootIndex(fsModel->index(path));

    }