void DirTreeView::pasteFromClipboard() { qDebug() << "pasteFromClipboard()"; FileSystemSortFilterProxyModel* proxyModel = qobject_cast<FileSystemSortFilterProxyModel*>(model()); QFileSystemModel* dirModel = qobject_cast<QFileSystemModel*>(proxyModel->sourceModel()); QString to(dirModel->filePath(proxyModel->mapToSource(currentIndex()))); QClipboard* clipboard = QApplication::clipboard(); const QMimeData* mime = clipboard->mimeData(); if (mime->hasFormat(UrlListMimeData::format(UrlListMimeData::CopyAction))) { qDebug() << "pasteFromClipboard()" << "Copy list" << UrlListMimeData::listFrom(mime); emit paste(UrlListMimeData::listFrom(mime), to); } else if (mime->hasFormat(UrlListMimeData::format(UrlListMimeData::CutAction))) { qDebug() << "pasteFromClipboard()" << "Cut list" << UrlListMimeData::listFrom(mime, UrlListMimeData::CutAction); emit paste(UrlListMimeData::listFrom(mime, UrlListMimeData::CutAction), to, false); clipboard->clear(); } }
MainWindow::MainWindow(QWidget *parent) : QMainWindow(parent) { setupUi(this); Settings *settings = Settings::getInstance(); this->setWindowIcon(QIcon(":/icons/mmmmp.ico")); this->filesystem->header()->setResizeMode(QHeaderView::ResizeToContents); this->setStyleSheet(settings->styleSheet(this)); leftTabs->setStyleSheet(settings->styleSheet(leftTabs)); widgetSearchBar->setStyleSheet(settings->styleSheet(0)); splitter->setStyleSheet(settings->styleSheet(splitter)); volumeSlider->setStyleSheet(settings->styleSheet(volumeSlider)); seekSlider->setStyleSheet(settings->styleSheet(seekSlider)); QFileSystemModel *fileSystemModel = new QFileSystemModel(this); fileSystemModel->setFilter(QDir::AllDirs | QDir::Files | QDir::NoDotAndDotDot); QStringList filters; filters << "*.mp3"; fileSystemModel->setNameFilters(filters); filesystem->setModel(fileSystemModel); filesystem->setRootIndex(fileSystemModel->setRootPath(QDesktopServices::storageLocation(QDesktopServices::MusicLocation))); // Hide columns "size" and "date modified" columns, useless for almost everyone filesystem->setColumnHidden(1, true); filesystem->setColumnHidden(3, true); // Special behaviour for media buttons mediaButtons << skipBackwardButton << seekBackwardButton << playButton << pauseButton << stopButton << seekForwardButton << skipForwardButton << repeatButton << shuffleButton; foreach (MediaButton *b, mediaButtons) { b->setStyleSheet(settings->styleSheet(b)); }
bool QFileFilterModel::filterAcceptsRow(int source_row, const QModelIndex &source_parent) const { QModelIndex idx = sourceModel()->index(source_row, 0, source_parent); QFileSystemModel *fs = qobject_cast<QFileSystemModel *>(sourceModel()); if(!fs) { qCritical() << "Expected a QFileSystemModel as the source model!"; return true; } if(fs->isDir(idx)) return true; QFile::Permissions permissions = (QFile::Permissions)sourceModel()->data(idx, QFileSystemModel::FilePermissions).toInt(); if((m_requireMask & QDir::Readable) && !(permissions & QFile::ReadUser)) return false; if((m_requireMask & QDir::Writable) && !(permissions & QFile::WriteUser)) return false; if((m_requireMask & QDir::Executable) && !(permissions & QFile::ExeUser)) return false; if((m_excludeMask & QDir::Readable) && (permissions & QFile::ReadUser)) return false; if((m_excludeMask & QDir::Writable) && (permissions & QFile::WriteUser)) return false; if((m_excludeMask & QDir::Executable) && (permissions & QFile::ExeUser)) return false; return true; }
int main(int argc, char *argv[]) { QApplication app(argc, argv); QFileSystemModel model; QWidget window; QTreeView *tree = new QTreeView(&window); tree->setMaximumSize(1000, 600); QHBoxLayout *layout = new QHBoxLayout; layout->setSizeConstraint(QLayout::SetFixedSize); layout->addWidget(tree); window.setLayout(layout); model.setRootPath(""); tree->setSizeAdjustPolicy(QAbstractScrollArea::AdjustToContents); tree->setModel(&model); tree->setAnimated(false); tree->setIndentation(20); tree->setSortingEnabled(true); tree->header()->setStretchLastSection(false); window.setWindowTitle(QObject::tr("Dir View")); tree->header()->setSectionResizeMode(QHeaderView::ResizeToContents); window.show(); return app.exec(); }
FolderChooser::FolderChooser(const QString & start_folder,QWidget *parent) : QDialog(parent), ui(new Ui::FolderChooser) { ui->setupUi(this); QFileSystemModel *model = new QFileSystemModel(ui->folderView); model->setFilter(QDir::Dirs|QDir::Drives|QDir::NoDotAndDotDot); ui->folderView->setModel(model); QModelIndex root_index = model->setRootPath(start_folder); if (root_index.isValid()) { QItemSelection selection(root_index,model->index(root_index.row(),model->columnCount()-1,root_index.parent())); ui->folderView->selectionModel()->select(selection,QItemSelectionModel::ClearAndSelect); ui->folderView->scrollTo(root_index); ui->folderView->expand(root_index); } connect(ui->folderView->selectionModel(),SIGNAL(selectionChanged(const QItemSelection&,const QItemSelection&)),this,SLOT(selectionChanged())); #if QT_VERSION >= 0x050000 ui->folderView->header()->setSectionResizeMode(0, QHeaderView::ResizeToContents); #else ui->folderView->header()->setResizeMode(0, QHeaderView::ResizeToContents); #endif ui->folderView->header()->hideSection(1); ui->folderView->header()->hideSection(2); ui->folderView->header()->hideSection(3); selectionChanged(); }
void TagEditor::searchAndAddFiles(){ QModelIndexList indexes = TreeView->selectionModel()->selectedRows(0); QFileSystemModel *m = (QFileSystemModel *)TreeView->model(); QList<QFileInfo> infos; for(int i=0;i<indexes.size();i++){ QModelIndex index = indexes[i]; bool isdir = m->isDir(index); if(isdir){ QString folder = m->filePath(index); QList<QFileInfo> info = Global::getDirContent( folder, extensions, subfolders ); infos.append(info); }else{ infos.append( QFileInfo(m->filePath(index)) ); } } SearchForTagsDialog r(infos,this); if( r.exec()==QDialog::Accepted){ QList<QFileInfo> files = r.files(); for(int j=0;j<files.size();j++){ TagItem *newItem = new TagItem( files[j].filePath() ); TreeWidget_->addItem( newItem ); } } }
void TagEditor::addFiles(){ QModelIndexList indexes = TreeView->selectionModel()->selectedRows(0); QFileSystemModel *m = static_cast<QFileSystemModel*>(TreeView->model()); for(int i=0;i<indexes.size();i++){ QModelIndex index = indexes[i]; qDebug()<<index.row()<<index.column(); bool isdir = m->isDir(index); if(isdir){ QString folder = m->filePath(index); QList<QFileInfo> info = Global::getDirContent( folder, extensions, subfolders ); for(int j=0;j<info.size();j++){ TagItem *newItem = new TagItem( info[j].filePath() ); TreeWidget_->addItem( newItem ); } }else{ QFileInfo f(m->filePath(index)); TagItem *newItem = new TagItem( f.filePath() ); TreeWidget_->addItem( newItem ); } } }
void MainWindow::createDockWindows() { /* Add HOL widget */ QDockWidget *dock = new QDockWidget(tr("HOL Process"), this); dock->setAllowedAreas(Qt::LeftDockWidgetArea | Qt::RightDockWidgetArea); mHOLWidget = new HOLWidget; dock->setWidget(mHOLWidget); addDockWidget(Qt::RightDockWidgetArea, dock); /* File System View */ QDockWidget *fileDock = new QDockWidget(tr("Project"), this); fileDock->setAllowedAreas(Qt::LeftDockWidgetArea | Qt::RightDockWidgetArea); mFileViewSplitter = new QSplitter; QFileSystemModel *fileSystemModel = new QFileSystemModel; fileSystemModel->setRootPath(QDir::currentPath()); QItemSelectionModel *itemSelectionModel = new QItemSelectionModel(fileSystemModel); connect(itemSelectionModel, SIGNAL(currentChanged(QModelIndex,QModelIndex)), this, SLOT(fileViewItemSelected(QModelIndex,QModelIndex))); QTreeView* tree = new QTreeView(mFileViewSplitter); tree->setModel(fileSystemModel); tree->setRootIndex(fileSystemModel->index(QDir::currentPath())); tree->setSelectionModel(itemSelectionModel); tree->hideColumn(2); tree->hideColumn(3); tree->hideColumn(1); fileDock->setWidget(mFileViewSplitter); addDockWidget(Qt::RightDockWidgetArea, fileDock); }
LaunchPage::LaunchPage(QWidget *parent) : QWidget(parent), ui(new Ui::LaunchPage), m_argsModel(new QStringListModel(this)) { ui->setupUi(this); connect(ui->progSelectButton, SIGNAL(clicked()), SLOT(showFileDialog())); connect(ui->addArgButton, SIGNAL(clicked()), SLOT(addArgument())); connect(ui->removeArgButton, SIGNAL(clicked()), SLOT(removeArgument())); connect(ui->progEdit, SIGNAL(textChanged(QString)), SIGNAL(updateButtonState())); ui->argsBox->setModel(m_argsModel); QCompleter *pathCompleter = new QCompleter(this); QFileSystemModel *fsModel = new QFileSystemModel(this); fsModel->setRootPath(QDir::rootPath()); pathCompleter->setModel(fsModel); ui->progEdit->setCompleter(pathCompleter); QSettings settings; ui->progEdit->setText(settings.value(QLatin1String("Launcher/Program")).toString()); m_argsModel->setStringList(settings.value(QLatin1String("Launcher/Arguments")).toStringList()); ui->accessMode->setCurrentIndex(settings.value(QLatin1String("Launcher/AccessMode")).toInt()); updateArgumentButtons(); }
int main(int argc, char *argv[]) { QApplication app(argc, argv); // 创建文件系统模型 QFileSystemModel model; // 指定要监视的目录 model.setRootPath(QDir::currentPath()); // 创建树型视图 QTreeView tree; // 为视图指定模型 tree.setModel(&model); // 指定根索引 tree.setRootIndex(model.index(QDir::currentPath())); // 创建列表视图 QListView list; list.setModel(&model); list.setRootIndex(model.index(QDir::currentPath())); tree.show(); list.show(); return app.exec(); }
//! [0] //! [1] int main(int argc, char *argv[]) { QApplication app(argc, argv); QSplitter *splitter = new QSplitter; //! [2] //! [3] QFileSystemModel *model = new QFileSystemModel; model->setRootPath(QDir::currentPath()); //! [0] //! [2] //! [4] //! [5] QTreeView *tree = new QTreeView(splitter); //! [3] //! [6] tree->setModel(model); //! [4] //! [6] //! [7] tree->setRootIndex(model->index(QDir::currentPath())); //! [7] QListView *list = new QListView(splitter); list->setModel(model); list->setRootIndex(model->index(QDir::currentPath())); //! [5] QItemSelectionModel *selection = new QItemSelectionModel(model); tree->setSelectionModel(selection); list->setSelectionModel(selection); //! [8] splitter->setWindowTitle("Two views onto the same file system model"); splitter->show(); return app.exec(); }
void MainWindow::on_path_returnPressed() { QFileSystemModel *FSM; QStringList sImageFilters; QDir d; QString sPath; sImageFilters << "*.png"; //Show files in the tree view sPath = ui->path->text(); FSM = new QFileSystemModel(this); FSM->setFilter(QDir::NoDotAndDotDot | QDir::AllEntries); FSM->setRootPath(sPath); FSM->setNameFilters(sImageFilters); ui->file_browser->setModel(FSM); ui->file_browser->setRootIndex(FSM->index(sPath)); ui->file_browser->hideColumn(1); ui->file_browser->hideColumn(2); ui->file_browser->hideColumn(3); //initiate the filelist to the image d.setPath(ui->path->text()); d.setFilter( QDir::Files | QDir::NoSymLinks ); d.setNameFilters(sImageFilters); filelist = d.entryInfoList(); //initiate the dir for the yml files ymlFileDir = ui->path->text(); ymlFileDir.append("/data/"); }
void fileWorker::listFile(QTreeView *tree, QString path) { QFileSystemModel *model; model = (QFileSystemModel*)tree->model(); model->setRootPath(path); tree->setRootIndex(model->index(path)); }
Q_DECL_EXPORT int main(int argc, char **argv) { qmlRegisterType<QAbstractItemModel>(); qmlRegisterType<QTimer>("net.mkiol.kaktus", 1, 0, "QTimer"); qmlRegisterType < AbstractItemModel > ("com.kdab.components", 1, 0, "AbstractItemModel"); qmlRegisterType < WebImageView > ("org.labsquare", 1, 0, "WebImageView"); qRegisterMetaType < DatabaseManager::CacheItem > ("CacheItem"); Application app(argc, argv); app.setApplicationName(APP_NAME); app.setApplicationVersion(VERSION); Settings* settings = Settings::instance(); /*QTranslator translator; const QString filename = QString::fromLatin1("kaktus_%1").arg( settings->getLocale()=="" ? QLocale().name() : settings->getLocale()); if (translator.load(filename, "app/native/qm")) app.installTranslator(&translator);*/ settings->qml = QmlDocument::create("asset:///main.qml"); settings->qml->documentContext()->setContextProperty("APP_NAME", APP_NAME); settings->qml->documentContext()->setContextProperty("VERSION", VERSION); settings->qml->documentContext()->setContextProperty("AUTHOR", AUTHOR); settings->qml->documentContext()->setContextProperty("PAGE", PAGE); NetworkAccessManagerFactory factory(settings->getDmUserAgent()); settings->qml->defaultDeclarativeEngine()->setNetworkAccessManagerFactory(&factory); DatabaseManager db; settings->db = &db; DownloadManager dm; settings->dm = &dm; CacheServer cache(&db); settings->cache = &cache; Utils utils; bb::device::DisplayInfo display; QFileSystemModel *model = new QFileSystemModel(&app); model->setRootPath("app/"); settings->qml->setContextProperty("db", &db); settings->qml->setContextProperty("utils", &utils); settings->qml->setContextProperty("dm", &dm); settings->qml->setContextProperty("cache", &cache); settings->qml->setContextProperty("settings", settings); settings->qml->setContextProperty("_fileSystemModel", model); settings->qml->setContextProperty("display", &display); QObject::connect(settings->qml->defaultDeclarativeEngine(), SIGNAL(quit()), QCoreApplication::instance(), SLOT(quit())); AbstractPane *root = settings->qml->createRootObject<AbstractPane>(); Application::instance()->setScene(root); return Application::exec(); }
bool MainWindow::isDir(const QModelIndex &indexProxy) const { const QSortFilterProxyModel *proxyModel = 0; QFileSystemModel *sourceModel = 0; if ( !( proxyModel = dynamic_cast<const QSortFilterProxyModel*>(indexProxy.model()) ) || !( sourceModel = dynamic_cast<QFileSystemModel*>(proxyModel->sourceModel()) ) ) return false; return sourceModel->isDir( proxyModel->mapToSource(indexProxy) ); }
void CMainWindow::OnFolderSelected(QTreeWidgetItem *p_pItem, int) { //ui->folderViewer->SetFolder(p_pItem->data(0, Qt::UserRole).value<CFolder*>()); CFolder *pFolder = p_pItem->data(0, Qt::UserRole).value<CFolder*>(); QString sPath = pFolder->GetDir().absolutePath(); QFileSystemModel *pModel = (QFileSystemModel *)ui->folderViewer->model(); pModel->setRootPath(sPath); ui->folderViewer->setRootIndex(pModel->index(sPath)); }
bool MainWindow::pathIsValid(QString path){ QFileSystemModel *fileSystemModel = new QFileSystemModel(this); QModelIndex rootIndex = fileSystemModel->index(QDir::cleanPath(path)); if (!rootIndex.isValid() || path.isEmpty()) { return false; } return true; }
void MainWindow::dirViewClicked(QModelIndex idx){ if(NULL != currentFile){ fileSave(); } QFileSystemModel *model = (QFileSystemModel*) ui->listView->model(); openFile(model->filePath(idx)); }
void FilterDialog::setUpCompleter() { QCompleter* completer = new QCompleter(this); QFileSystemModel* fsmodel = new QFileSystemModel(completer); fsmodel->setReadOnly(true); fsmodel->setRootPath(""); completer->setModel(fsmodel); folderPathLineEdit->setCompleter(completer); }
bool lessThan(const QModelIndex &left, const QModelIndex &right) const { QFileSystemModel *model = dynamic_cast<QFileSystemModel*>(sourceModel()); if (!model->isDir(left) && model->isDir(right)) return false; else if (model->isDir(left) && !model->isDir(right)) return true; else return left.data().toString().toLower() < right.data().toString().toLower(); // for files and dirs }
virtual bool filterAcceptsRow(int source_row, const QModelIndex& source_parent) const { QFileSystemModel* model = static_cast<QFileSystemModel*>(sourceModel()); QModelIndex index = sourceModel()->index(source_row, 0, source_parent); if(model->isDir(index)) return true; m_reader.setFileName(model->filePath(index)); return m_reader.canRead(); }
void MainWindow::fileBrowserItemDblClicked(const QModelIndex& index) { QFileSystemModel *fsModel = qobject_cast<QFileSystemModel*>(treeView->model()); _lastFileBrowserItem = fsModel->fileInfo(index).absoluteFilePath(); QFileInfo fileInfo(_lastFileBrowserItem); if (fileInfo.exists() && fileInfo.isFile()) openFile(_lastFileBrowserItem); }
void MainWindow::on_m_pushButtonOk_clicked() { QFileSystemModel *fsm = new QFileSystemModel(); fsm->setRootPath("D:/Movies"); //fsm->setNameFilters(QString("A*,B*").split(',')); //ui->m_listView->setCurrentIndex(fsm->index("c:/windows")); //ui->m_listView->setModel(fsm); ui->m_treeView->setModel(fsm); }
void TestQTestComplex::pl_filesystemmodel() { QFileSystemModel *model = new QFileSystemModel(); // Start to read the path (this starts a new thread) model->setRootPath(QDir::currentPath()); QCoreApplication::processEvents(QEventLoop::AllEvents, 100); delete model; }
void FileViewer::setRoot(const QString & dirname) { if (dirname.isNull()) { return; } else { QFileSystemModel* model = static_cast<QFileSystemModel *>(this->model()); setRootIndex(model->index(dirname)); model->setRootPath(dirname); this->header()->resizeSections(QHeaderView::ResizeToContents); } }
//! [11] void MainWindow::changeModel() { delete completer; completer = new QCompleter(this); completer->setMaxVisibleItems(maxVisibleSpinBox->value()); switch (modelCombo->currentIndex()) { default: case 0: { // Unsorted QFileSystemModel QFileSystemModel *fsModel = new QFileSystemModel(completer); fsModel->setRootPath(""); completer->setModel(fsModel); contentsLabel->setText(tr("Enter file path")); } break; //! [11] //! [12] case 1: { // FileSystemModel that shows full paths FileSystemModel *fsModel = new FileSystemModel(completer); completer->setModel(fsModel); fsModel->setRootPath(""); contentsLabel->setText(tr("Enter file path")); } break; //! [12] //! [13] case 2: { // Country List completer->setModel(modelFromFile(":/resources/countries.txt")); QTreeView *treeView = new QTreeView; completer->setPopup(treeView); treeView->setRootIsDecorated(false); treeView->header()->hide(); treeView->header()->setStretchLastSection(false); treeView->header()->setResizeMode(0, QHeaderView::Stretch); treeView->header()->setResizeMode(1, QHeaderView::ResizeToContents); contentsLabel->setText(tr("Enter name of your country")); } break; //! [13] //! [14] case 3: { // Word list completer->setModel(modelFromFile(":/resources/wordlist.txt")); completer->setModelSorting(QCompleter::CaseInsensitivelySortedModel); contentsLabel->setText(tr("Enter a word")); } break; } changeMode(modeCombo->currentIndex()); changeCase(caseCombo->currentIndex()); completer->setWrapAround(wrapCheckBox->isChecked()); lineEdit->setCompleter(completer); connect(wrapCheckBox, SIGNAL(clicked(bool)), completer, SLOT(setWrapAround(bool))); }
FlowWidgetListTab::FlowWidgetListTab(QWidget *parent) : QWidget(parent) { DUI::DListView *listView = new DUI::DListView(this); QFileSystemModel *model = new QFileSystemModel(this); ItemDelegate *delegate = new ItemDelegate(listView); listView->setItemDelegate(delegate); listView->setSpacing(10); listView->setResizeMode(QListView::Adjust); listView->setCacheBuffer(50); listView->setModel(model); listView->setOrientation(QListView::LeftToRight, true); model->setRootPath("/"); listView->setRootIndex(model->index("/")); connect(listView, &DUI::DListView::doubleClicked, this, [listView](const QModelIndex &index) { listView->setRootIndex(index); }); QWidget *button_widget = new QWidget; QHBoxLayout *buttonLayout = new QHBoxLayout(button_widget); QPushButton *button_back = new QPushButton("^"); QPushButton *button_switch = new QPushButton("switch view mode"); connect(button_back, &QPushButton::clicked, listView, [listView] { listView->setRootIndex(listView->rootIndex().parent()); }); connect(button_switch, &QPushButton::clicked, button_switch, [listView, delegate] { if(listView->isWrapping()) { listView->setOrientation(QListView::TopToBottom, false); listView->clear(); } else { listView->setOrientation(QListView::LeftToRight, true); } delegate->viewIsWrapping = listView->isWrapping(); }); buttonLayout->addWidget(button_back); buttonLayout->addWidget(button_switch); listView->addFooterWidget(button_widget); QVBoxLayout *main_layout = new QVBoxLayout(this); main_layout->setMargin(0); main_layout->setSpacing(0); main_layout->addWidget(listView); }
void TagEditor::readSettings(){ /* guiSettings->beginGroup("MainWindow"); //this->resize(guiSettings->value("size", QSize(630, 750)).toSize()); //this->move(guiSettings->value("pos", QPoint(200, 200)).toPoint()); guiSettings->endGroup(); */ style = guiSettings->value("style","WindowsXP").toString(); startupFolder = guiSettings->value("startupFolder","").toString(); QString defaultExt = "*.mp3;*.wma;*.wav;*.ogg;*.aac;*.ac3;*.m4a"; extensions = guiSettings->value("extensions",defaultExt.split(";")).toStringList(); QFileSystemModel *model = static_cast<QFileSystemModel*>(TreeView->model()); model->setRootPath(startupFolder); model->setNameFilters(extensions); model->setNameFilterDisables(false); TreeView->setRootIndex(model->index(startupFolder)); treeViewLabel->setText(startupFolder); //api_key = guiSettings->value("api_key","").toString(); showSaveTagWarning = guiSettings->value("showSaveTagWarning",true).toBool(); subfolders = guiSettings->value("subfolders",true).toBool(); ArtistCheckbox->setChecked( guiSettings->value("artistChecked",true).toBool() ); TitleCheckbox->setChecked( guiSettings->value("titleChecked",true).toBool() ); AlbumCheckbox->setChecked( guiSettings->value("albumChecked",true).toBool() ); YearCheckbox->setChecked( guiSettings->value("yearChecked",true).toBool() ); TrackCheckbox->setChecked( guiSettings->value("trackChecked",true).toBool() ); GenreCheckbox->setChecked( guiSettings->value("genreChecked",true).toBool() ); CommentCheckbox->setChecked( guiSettings->value("commentChecked",true).toBool() ); lastStyleSheetFolder = guiSettings->value("lastStyleSheetFolder","").toString(); TreeWidget_->setShowFullFileName( guiSettings->value("showFullFileName",false).toBool() ); TreeWidget_->setShowTagInfo( guiSettings->value("showTagInfo",false).toBool() ); TreeWidget_->setSortingEnabled( guiSettings->value("sortingEnabled",true).toBool() ); if(TreeWidget_->isSortingEnabled()){ TreeWidget_->header()->setSortIndicator( guiSettings->value("sortColumn",0).toInt(), static_cast<Qt::SortOrder>(guiSettings->value("sortOrder",0).toInt()) ); TreeWidget_->header()->setSortIndicatorShown(true); } QVariantList colstmp = guiSettings->value("columns").toList(); QList<Global::TagField> cols; for(int i=0;i<colstmp.size();i++){ qDebug()<<"colstmp[i] "<<colstmp[i]; cols.append(static_cast<Global::TagField>(colstmp[i].toInt())); } TreeWidget_->setColumnsList(cols); restoreState(guiSettings->value("windowState").toByteArray()); restoreGeometry(guiSettings->value("geometry").toByteArray()); //splitter->setSizes(guiSettings->value("splittersizes").value< QList<int> >() ); scriptEditor_->setText(guiSettings->value("script","").toString()); }
void RestoreBackup::buildDialog() { m_BackupTreeview = new QTreeView(); QFileSystemModel *model = new QFileSystemModel; model->setRootPath(QDir::currentPath()); //model->setRootPath("/andrew0/home/andy/Devsrc/Qt/"); m_BackupTreeview->setModel(model); QHBoxLayout *hLayout = new QHBoxLayout(); //hLayout->addChildWidget(m_BackupTreeview); hLayout->addWidget(m_BackupTreeview); setLayout(hLayout); }
int main(int argc, char *argv[]) { QApplication app(argc, argv); QFileSystemModel dir; dir.setRootPath("/"); QtTreeModelAdaptor adaptor(&dir); QtTreeWidgetNG widget; widget.controller()->setModel(&adaptor); widget.show(); return app.exec(); }