mirror of
https://github.com/subsurface/subsurface.git
synced 2025-02-19 22:16:15 +00:00
code to show profile again
Signed-off-by: Tomaz Canabrava <tcanabrava@kde.org>
This commit is contained in:
parent
5868b37e6b
commit
b0374047dd
5 changed files with 39 additions and 8 deletions
|
@ -55,6 +55,24 @@ void DiveListView::keyReleaseEvent(QKeyEvent* event)
|
|||
QWidget::keyReleaseEvent(event);
|
||||
}
|
||||
|
||||
void DiveListView::currentChanged(const QModelIndex& current, const QModelIndex& previous)
|
||||
{
|
||||
if (!current.isValid())
|
||||
return;
|
||||
const QAbstractItemModel *model = current.model();
|
||||
int selectedDive = 0;
|
||||
struct dive *dive = (struct dive*) model->data(current, TreeItemDT::DIVE_ROLE).value<void*>();
|
||||
if (!dive) { // it's a trip! select first child.
|
||||
dive = (struct dive*) model->data(current.child(0,0), TreeItemDT::DIVE_ROLE).value<void*>();
|
||||
selectedDive = get_divenr(dive);
|
||||
}else{
|
||||
selectedDive = get_divenr(dive);
|
||||
}
|
||||
if (selectedDive == selected_dive)
|
||||
return;
|
||||
Q_EMIT currentDiveChanged(selectedDive);
|
||||
}
|
||||
|
||||
void DiveListView::selectionChanged(const QItemSelection& selected, const QItemSelection& deselected)
|
||||
{
|
||||
QList<QModelIndex> parents;
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue