diff --git a/mainwindow.cpp b/mainwindow.cpp index fa970ee..c346ff0 100644 --- a/mainwindow.cpp +++ b/mainwindow.cpp @@ -41,7 +41,10 @@ MainWindow::MainWindow(QWidget *parent) : model = new CANFrameModel(this); // set parent to mainwindow to prevent canframemodel to change thread (might be done by setModel but just in case) - ui->canFramesView->setModel(model); + QSortFilterProxyModel* proxyModel = new QSortFilterProxyModel; + proxyModel->setSourceModel(model); + + ui->canFramesView->setModel(proxyModel); readSettings(); @@ -54,6 +57,7 @@ MainWindow::MainWindow(QWidget *parent) : ui->canFramesView->setColumnWidth(6, 225); QHeaderView *HorzHdr = ui->canFramesView->horizontalHeader(); HorzHdr->setStretchLastSection(true); //causes the data column to automatically fill the tableview + connect(HorzHdr, SIGNAL(sectionClicked(int)), this, SLOT(headerClicked(int))); graphingWindow = NULL; frameInfoWindow = NULL; @@ -299,6 +303,11 @@ void MainWindow::updateConnectionSettings(QString connectionType, QString port, } } +void MainWindow::headerClicked(int logicalIndex) +{ + ui->canFramesView->sortByColumn(logicalIndex); +} + void MainWindow::gridClicked(QModelIndex idx) { if (ui->canFramesView->rowHeight(idx.row()) > normalRowHeight) diff --git a/mainwindow.h b/mainwindow.h index 9e70597..abdd0a2 100644 --- a/mainwindow.h +++ b/mainwindow.h @@ -95,6 +95,7 @@ private slots: void filterListItemChanged(QListWidgetItem *item); void filterSetAll(); void filterClearAll(); + void headerClicked (int logicalIndex); public slots: void gotFrames(int); diff --git a/re/isotp_interpreterwindow.cpp b/re/isotp_interpreterwindow.cpp index 0907be2..866b5d1 100644 --- a/re/isotp_interpreterwindow.cpp +++ b/re/isotp_interpreterwindow.cpp @@ -42,6 +42,7 @@ ISOTP_InterpreterWindow::ISOTP_InterpreterWindow(const QVector *frames ui->tableIsoFrames->setHorizontalHeaderLabels(headers); QHeaderView *HorzHdr = ui->tableIsoFrames->horizontalHeader(); HorzHdr->setStretchLastSection(true); + connect(HorzHdr, SIGNAL(sectionClicked(int)), this, SLOT(headerClicked(int))); decoder->setReception(true); decoder->setFlowCtrl(false); @@ -154,6 +155,11 @@ void ISOTP_InterpreterWindow::updatedFrames(int numFrames) } } +void ISOTP_InterpreterWindow::headerClicked(int logicalIndex) +{ + ui->tableIsoFrames->sortByColumn(logicalIndex); +} + void ISOTP_InterpreterWindow::showDetailView() { QString buildString; diff --git a/re/isotp_interpreterwindow.h b/re/isotp_interpreterwindow.h index 76c8ce5..753347f 100644 --- a/re/isotp_interpreterwindow.h +++ b/re/isotp_interpreterwindow.h @@ -31,6 +31,7 @@ private slots: void filterNone(); void interpretCapturedFrames(); void useExtendedAddressing(bool checked); + void headerClicked(int logicalIndex); private: Ui::ISOTP_InterpreterWindow *ui;