-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathtableviewcompilationunits.cpp
More file actions
30 lines (24 loc) · 987 Bytes
/
Copy pathtableviewcompilationunits.cpp
File metadata and controls
30 lines (24 loc) · 987 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
#include <QHeaderView>
#include <QItemSelectionModel>
#include "tableviewcompilationunits.h"
TableViewCompilationUnits::TableViewCompilationUnits(QAbstractItemModel *model)
{
horizontalHeader()->setVisible(true);
verticalHeader()->setVisible(true);
setSelectionBehavior(QAbstractItemView::SelectRows);
setSelectionMode(QAbstractItemView::SingleSelection);
//verticalHeader()->setSectionResizeMode(QHeaderView::Stretch);
setModel(model);
connect(selectionModel(), &QItemSelectionModel::currentRowChanged, this, &TableViewCompilationUnits::onSelectionChanged);
}
void TableViewCompilationUnits::setSelectCu(ISelectCu *selectCu)
{
m_selectCu = selectCu;
}
void TableViewCompilationUnits::onSelectionChanged(const QModelIndex ¤t, const QModelIndex &previous)
{
const int row = current.row();
QModelIndex modelIndex = model()->index(current.row(), 0);
QString fileName = model()->data(modelIndex).toString();
m_selectCu->selectCu(fileName);
}