Merge pull request #101 from Semant1ka/sort_col

Add sorting after table header click for main and isotp windows
This commit is contained in:
Collin Kidder
2017-10-26 21:18:39 -04:00
committed by GitHub
4 changed files with 18 additions and 1 deletions
+10 -1
View File
@@ -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) 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(); readSettings();
@@ -54,6 +57,7 @@ MainWindow::MainWindow(QWidget *parent) :
ui->canFramesView->setColumnWidth(6, 225); ui->canFramesView->setColumnWidth(6, 225);
QHeaderView *HorzHdr = ui->canFramesView->horizontalHeader(); QHeaderView *HorzHdr = ui->canFramesView->horizontalHeader();
HorzHdr->setStretchLastSection(true); //causes the data column to automatically fill the tableview HorzHdr->setStretchLastSection(true); //causes the data column to automatically fill the tableview
connect(HorzHdr, SIGNAL(sectionClicked(int)), this, SLOT(headerClicked(int)));
graphingWindow = NULL; graphingWindow = NULL;
frameInfoWindow = 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) void MainWindow::gridClicked(QModelIndex idx)
{ {
if (ui->canFramesView->rowHeight(idx.row()) > normalRowHeight) if (ui->canFramesView->rowHeight(idx.row()) > normalRowHeight)
+1
View File
@@ -95,6 +95,7 @@ private slots:
void filterListItemChanged(QListWidgetItem *item); void filterListItemChanged(QListWidgetItem *item);
void filterSetAll(); void filterSetAll();
void filterClearAll(); void filterClearAll();
void headerClicked (int logicalIndex);
public slots: public slots:
void gotFrames(int); void gotFrames(int);
+6
View File
@@ -42,6 +42,7 @@ ISOTP_InterpreterWindow::ISOTP_InterpreterWindow(const QVector<CANFrame> *frames
ui->tableIsoFrames->setHorizontalHeaderLabels(headers); ui->tableIsoFrames->setHorizontalHeaderLabels(headers);
QHeaderView *HorzHdr = ui->tableIsoFrames->horizontalHeader(); QHeaderView *HorzHdr = ui->tableIsoFrames->horizontalHeader();
HorzHdr->setStretchLastSection(true); HorzHdr->setStretchLastSection(true);
connect(HorzHdr, SIGNAL(sectionClicked(int)), this, SLOT(headerClicked(int)));
decoder->setReception(true); decoder->setReception(true);
decoder->setFlowCtrl(false); 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() void ISOTP_InterpreterWindow::showDetailView()
{ {
QString buildString; QString buildString;
+1
View File
@@ -31,6 +31,7 @@ private slots:
void filterNone(); void filterNone();
void interpretCapturedFrames(); void interpretCapturedFrames();
void useExtendedAddressing(bool checked); void useExtendedAddressing(bool checked);
void headerClicked(int logicalIndex);
private: private:
Ui::ISOTP_InterpreterWindow *ui; Ui::ISOTP_InterpreterWindow *ui;