Skip to content

Commit

Permalink
Link selected row in table customers with tree
Browse files Browse the repository at this point in the history
  • Loading branch information
Cédric Rohaut committed Feb 16, 2015
1 parent 4f10c99 commit 851c2ba
Show file tree
Hide file tree
Showing 2 changed files with 11 additions and 4 deletions.
12 changes: 8 additions & 4 deletions src/mainwindow.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,7 @@ MainWindow::MainWindow(QWidget *parent) :
SLOT(openContextualMenuTree(const QPoint &)));

updateUser();
updateBtn();
demo();
}

Expand Down Expand Up @@ -232,9 +233,6 @@ void MainWindow::updateTree(QString filter)
{
ui->trCustomers->setModel(
Databases::CustomerDatabase::instance()->getTree(filter));


ui->trCustomers->header()->close();
}

void MainWindow::newProject()
Expand Down Expand Up @@ -328,13 +326,18 @@ void MainWindow::changeTree()
default: // Other
break;
}

updateBtn();
}

void MainWindow::changeCustomerTable()
{
ui->wdgCustomerData->printInformations(getCurrentCustomerId());
int row = ui->tblCustomers->currentIndex().row();
QModelIndex index(ui->trCustomers->indexAt(QPoint()));
for (int i = 0 ; i <= row ; ++i) {
index = ui->trCustomers->indexBelow(index);
}
ui->trCustomers->setCurrentIndex(index);
updateBtn();
}

Expand Down Expand Up @@ -379,6 +382,7 @@ void MainWindow::updateBtn()
} else {
ui->btnEdit->setEnabled(false);
ui->btnDelCustomer->setEnabled(false);
ui->trCustomers->setCurrentIndex(ui->trCustomers->indexAt(QPoint()));
}

if (ui->tblProjects->currentIndex().row() > -1
Expand Down
3 changes: 3 additions & 0 deletions src/mainwindow.ui
Original file line number Diff line number Diff line change
Expand Up @@ -589,6 +589,9 @@ border: 1px solid #bbb;</string>
<property name="expandsOnDoubleClick">
<bool>false</bool>
</property>
<attribute name="headerVisible">
<bool>false</bool>
</attribute>
</widget>
</item>
</layout>
Expand Down

0 comments on commit 851c2ba

Please sign in to comment.