return minimumSizeHint();
}
+void CustomTableView::keyPressEvent(QKeyEvent *event)
+{
+ if ((event->key() == Qt::Key_Return) || (event->key() == Qt::Key_Enter))
+ activatedByKey(currentIndex());
+ else
+ QTableView::keyPressEvent(event);
+}
+
View::View(Session &session, bool is_main_view, QMainWindow *parent) :
ViewBase(session, is_main_view, parent),
this, SLOT(on_table_item_clicked(const QModelIndex&)));
connect(table_view_, SIGNAL(doubleClicked(const QModelIndex&)),
this, SLOT(on_table_item_double_clicked(const QModelIndex&)));
+ connect(table_view_, SIGNAL(activatedByKey(const QModelIndex&)),
+ this, SLOT(on_table_item_double_clicked(const QModelIndex&)));
connect(table_view_->horizontalHeader(), SIGNAL(customContextMenuRequested(const QPoint&)),
this, SLOT(on_table_header_requested(const QPoint&)));
}
update_data();
+
+ // Force repaint, otherwise the new selection isn't shown for some reason
+ table_view_->viewport()->update();
}
void View::on_hide_hidden_changed(bool checked)
{
(void)color;
- table_view_->update();
+ // Force immediate repaint, otherwise it's updated after the header popup is closed
+ table_view_->viewport()->update();
}
void View::on_new_annotations()
{
if (view_mode_selector_->currentIndex() == ViewModeLatest) {
update_data();
- table_view_->scrollTo(model_->index(model_->rowCount() - 1, 0),
+ table_view_->scrollTo(
+ filter_proxy_model_->index(filter_proxy_model_->rowCount() - 1, 0),
QAbstractItemView::PositionAtBottom);
} else {
if (!delayed_view_updater_.isActive())
void View::on_table_item_double_clicked(const QModelIndex& index)
{
- const Annotation* ann = static_cast<const Annotation*>(index.internalPointer());
+ const QModelIndex src_idx = filter_proxy_model_->mapToSource(index);
+
+ const Annotation* ann = static_cast<const Annotation*>(src_idx.internalPointer());
+ assert(ann);
shared_ptr<views::ViewBase> main_view = session_.main_view();
for (int i = 0; i < table_view_->horizontalHeader()->count(); i++) {
int column = table_view_->horizontalHeader()->logicalIndex(i);
- const QString title = model_->headerData(column, Qt::Horizontal, Qt::DisplayRole).toString();
+ const QString title =
+ filter_proxy_model_->headerData(column, Qt::Horizontal, Qt::DisplayRole).toString();
QAction* action = new QAction(title, this);
action->setCheckable(true);
const QModelIndex idx = filter_proxy_model_->mapFromSource(first_highlighted_idx);
table_view_->scrollTo(idx, QAbstractItemView::EnsureVisible);
}
+
+ // Force repaint, otherwise the table doesn't immediately update for some reason
+ table_view_->viewport()->update();
}
}
}