mirror of
https://github.com/tnodir/fort
synced 2024-11-15 08:56:22 +00:00
UI: TableView: Set current cell on select-all
This commit is contained in:
parent
704be268cb
commit
9151d882cf
@ -88,6 +88,18 @@ void TableView::selectCell(int row, int column)
|
|||||||
this->scrollTo(index);
|
this->scrollTo(index);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void TableView::selectionChanged(const QItemSelection &selected, const QItemSelection &deselected)
|
||||||
|
{
|
||||||
|
QTableView::selectionChanged(selected, deselected);
|
||||||
|
|
||||||
|
if (selected.isEmpty())
|
||||||
|
return;
|
||||||
|
|
||||||
|
if (!currentIndex().isValid()) {
|
||||||
|
setCurrentIndex(selected.indexes().first());
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
void TableView::currentChanged(const QModelIndex ¤t, const QModelIndex &previous)
|
void TableView::currentChanged(const QModelIndex ¤t, const QModelIndex &previous)
|
||||||
{
|
{
|
||||||
QTableView::currentChanged(current, previous);
|
QTableView::currentChanged(current, previous);
|
||||||
|
@ -28,6 +28,8 @@ public slots:
|
|||||||
void selectCell(int row, int column = 0);
|
void selectCell(int row, int column = 0);
|
||||||
|
|
||||||
protected:
|
protected:
|
||||||
|
void selectionChanged(
|
||||||
|
const QItemSelection &selected, const QItemSelection &deselected) override;
|
||||||
void currentChanged(const QModelIndex ¤t, const QModelIndex &previous) override;
|
void currentChanged(const QModelIndex ¤t, const QModelIndex &previous) override;
|
||||||
|
|
||||||
void contextMenuEvent(QContextMenuEvent *event) override;
|
void contextMenuEvent(QContextMenuEvent *event) override;
|
||||||
|
Loading…
Reference in New Issue
Block a user