| 79 | } |
| 80 | |
| 81 | void InputFileList::keyPressEvent(QKeyEvent* e) { |
| 82 | // when Ctrl-C is pressed, copy all selected files to clipboard as text |
| 83 | if (e->matches(QKeySequence::Copy)) |
| 84 | { |
| 85 | QStringList strings; |
| 86 | QList<QListWidgetItem*> selected_items = ui_->input_file_list->selectedItems(); |
| 87 | foreach(QListWidgetItem * item, selected_items) |
| 88 | { |
| 89 | strings << item->text(); |
| 90 | } |
| 91 | QApplication::clipboard()->setText(strings.join("\n")); |
| 92 | e->accept(); // do not propagate upstream |
| 93 | } |
| 94 | // exit on escape (without saving the list) |
| 95 | else if (e->key() == Qt::Key_Escape) |
| 96 | { |
| 97 | this->close(); |
| 98 | } |
| 99 | // delete currently selected items |
| 100 | else if (e->key() == Qt::Key_Delete) |
| 101 | { |
| 102 | removeSelected(); |
| 103 | } |
| 104 | } |
| 105 | |
| 106 | void InputFileList::showFileDialog() |
| 107 | { |