Permalink
Browse files

Added ID to qtableview for stations

  • Loading branch information...
1 parent ba35c54 commit ec6a2905f9ac0fca0c1bc8c0a8b11c583867c8f4 @gnuvince committed Apr 25, 2011
Showing with 5 additions and 3 deletions.
  1. +3 −2 pages/selectstationpage.cpp
  2. +2 −1 stationsortproxy.cpp
@@ -18,8 +18,9 @@ SelectStationPage::SelectStationPage(
view->setSelectionBehavior(QAbstractItemView::SelectRows);
view->setSelectionMode(QAbstractItemView::SingleSelection);
view->verticalHeader()->hide();
- view->resizeColumnToContents(1);
+ view->hideColumn(0);
view->resizeColumnToContents(2);
+ view->resizeColumnToContents(3);
view->resizeRowsToContents();
connect(view, SIGNAL(clicked(QModelIndex)), this, SLOT(showInformation(QModelIndex)));
@@ -51,7 +52,7 @@ void SelectStationPage::stationSelected(QModelIndex index) {
void SelectStationPage::showInformation(QModelIndex index) {
- if (index.column() == 2) {
+ if (index.column() == 3) {
QModelIndex index2 = index.model()->index(index.row(), 0);
QString stationName = index2.data().toString();
QMessageBox::information(this, tr("Info"), stationName, 0);
@@ -9,7 +9,8 @@ StationSortProxy::StationSortProxy(QObject *parent) :
}
bool StationSortProxy::filterAcceptsColumn(int source_column, const QModelIndex &source_parent) const {
- return source_column == Station::COL_NOM
+ return source_column == Station::COL_ID
+ || source_column == Station::COL_NOM
|| source_column == Station::COL_DIST
|| source_column == Station::COL_INFO;
}

0 comments on commit ec6a290

Please sign in to comment.