void FileView::showEvent(QShowEvent* e) { QWidget::showEvent(e); if (model_) return; model_ = new QFileSystemModel(this); model_->setNameFilters(filter_list_); // if an item fails the filter, hide it model_->setNameFilterDisables(false); ui_->list->setModel(model_); ChangeFilePathWithoutUndo(QDir::homePath()); if (!lazy_set_path_.isEmpty()) ChangeFilePathWithoutUndo(lazy_set_path_); }
void FileView::SetPath(const QString& path) { if (!model_) lazy_set_path_ = path; else ChangeFilePathWithoutUndo(path); }