34 #include <QListWidget> 36 #include <QVBoxLayout> 37 #include <QHBoxLayout> 38 #include <QPushButton> 40 #include <QTimerEvent> 52 if (dialog.exec() == QDialog::Accepted) {
65 if (dialog.exec() == QDialog::Accepted) {
68 return std::vector<std::string>();
82 QHBoxLayout *filter_box =
new QHBoxLayout();
83 filter_box->addWidget(
new QLabel(
"Filter:"));
86 QHBoxLayout *button_box =
new QHBoxLayout();
87 button_box->addStretch(1);
91 QVBoxLayout *vbox =
new QVBoxLayout();
93 vbox->addLayout(filter_box);
94 vbox->addLayout(button_box);
98 this, SLOT(accept()));
100 this, SLOT(reject()));
101 connect(
name_filter_, SIGNAL(textChanged(
const QString &)),
107 setWindowTitle(
"Select frames...");
126 QDialog::closeEvent(event);
133 list_widget_->setSelectionMode(QAbstractItemView::MultiSelection);
135 list_widget_->setSelectionMode(QAbstractItemView::SingleSelection);
142 if (selection.empty()) {
145 return selection.front();
151 QModelIndexList qt_selection =
list_widget_->selectionModel()->selectedIndexes();
153 std::vector<std::string> selection;
154 selection.resize(qt_selection.size());
155 for (
int i = 0; i < qt_selection.size(); i++) {
156 if (!qt_selection[i].isValid()) {
160 int row = qt_selection[i].row();
173 if (!
tf_) {
return; }
182 const std::vector<std::string> &frames)
const 185 std::vector<std::string> filtered;
187 for (
size_t i = 0; i < frames.size(); i++) {
188 QString frame_name = QString::fromStdString(frames[i]);
189 if (!frame_filter.isEmpty() &&
190 !frame_name.contains(frame_filter, Qt::CaseInsensitive)) {
194 filtered.push_back(frames[i]);
209 std::set<std::string> prev_names;
212 std::set<std::string> next_names;
213 next_names.insert(next_displayed_frames.begin(), next_displayed_frames.end());
215 std::set<std::string> added_names;
216 std::set_difference(next_names.begin(), next_names.end(),
217 prev_names.begin(), prev_names.end(),
218 std::inserter(added_names, added_names.end()));
220 std::set<std::string> removed_names;
221 std::set_difference(prev_names.begin(), prev_names.end(),
222 next_names.begin(), next_names.end(),
223 std::inserter(removed_names, removed_names.end()));
232 QListWidgetItem *item =
list_widget_->takeItem(i - removed);
238 for (
size_t i = 0; i < next_displayed_frames.size(); i++) {
239 if (added_names.count(next_displayed_frames[i]) == 0) {
243 list_widget_->insertItem(i, QString::fromStdString(next_displayed_frames[i]));