void FileSelectorWidget::on_FileView_doubleClicked(const QModelIndex& index) { // If the target is a directory, change to that directory. // Otherwise, adjust the selectedFilenames_ list and emit the selectionMade() signal. if (fileSystemModel_.isDir(index)) { setCurrentDirectory(fileSystemModel_.filePath(index)); // Need to clear the current files list, since it will no longer be valid selectedFilenames_.clear(); emit(selectionValid(false)); return; } // Not a dir, so adjust the filenames list and emit the signal QItemSelectionModel* selectionModel = ui.FileView->selectionModel(); QModelIndexList selectedRows = selectionModel->selectedRows(); selectedFilenames_.clear(); for (int n=0; n<selectedRows.count(); ++n) { if (fileSystemModel_.isDir(selectedRows.at(n))) continue; selectedFilenames_ << fileSystemModel_.fileName(selectedRows.at(n)); } emit(selectionValid(selectedFilenames_.count() > 0)); updateWidgets(); emit(selectionMade(false)); }
void MultiMaterial::end () { if( selectionValid() ) subMaterials[ selectedID ]->end(); else Material::EndDefault(); }
void MultiMaterial::begin() { if( selectionValid() ) subMaterials[ selectedID ]->begin(); else Material::BeginDefault(); }
void FileSelectorWidget::on_FileView_clicked(const QModelIndex& index) { // Get current model selection and reconstruct selected files list QItemSelectionModel* selectionModel = ui.FileView->selectionModel(); QModelIndexList selectedRows = selectionModel->selectedRows(); selectedFilenames_.clear(); for (int n=0; n<selectedRows.count(); ++n) { if (fileSystemModel_.isDir(selectedRows.at(n))) continue; selectedFilenames_ << fileSystemModel_.fileName(selectedRows.at(n)); } emit(selectionValid(selectedFilenames_.count() > 0)); updateWidgets(); }
void FileSelectorWidget::on_FilesEdit_textChanged(QString textChanged) { if (refreshing_) return; // Split current string into separate arguments LineParser parser; parser.getArgsDelim(Parser::UseQuotes, ui.FilesEdit->text()); selectedFilenames_.clear(); for (int n = 0; n < parser.nArgs(); ++n) selectedFilenames_ << parser.argc(n); // If we are updating filter/plugin based on the name, do it here bool formatOk = true; if (updatePluginFromFilename_ && (selectedFilenames_.count() > 0)) formatOk = updatePluginFromCurrentFilename() != NULL; emit(selectionValid((selectedFilenames_.count() > 0) && formatOk)); }
bool MultiMaterial::selectSubMaterial( MaterialID id ) { selectedID = id; return selectionValid(); }