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)
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)
+1
View File
@@ -95,6 +95,7 @@ private slots:
void filterListItemChanged(QListWidgetItem *item);
void filterSetAll();
void filterClearAll();
void headerClicked (int logicalIndex);
public slots:
void gotFrames(int);
+6
View File
@@ -42,6 +42,7 @@ ISOTP_InterpreterWindow::ISOTP_InterpreterWindow(const QVector<CANFrame> *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;
+1
View File
@@ -31,6 +31,7 @@ private slots:
void filterNone();
void interpretCapturedFrames();
void useExtendedAddressing(bool checked);
void headerClicked(int logicalIndex);
private:
Ui::ISOTP_InterpreterWindow *ui;