enbale sorting for main window and isotp

This commit is contained in:
semant1ka
2017-10-26 21:55:51 +03:00
parent 88bd90f51a
commit 0883709f58
4 changed files with 15 additions and 6 deletions
+6 -5
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,7 +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(on_sectionClicked(int))); connect(HorzHdr, SIGNAL(sectionClicked(int)), this, SLOT(headerClicked(int)));
graphingWindow = NULL; graphingWindow = NULL;
frameInfoWindow = NULL; frameInfoWindow = NULL;
@@ -235,10 +238,8 @@ void MainWindow::closeEvent(QCloseEvent *event)
exitApp(); exitApp();
} }
void MainWindow::on_sectionClicked ( int logicalIndex ) void MainWindow::headerClicked(int logicalIndex)
{ {
QHeaderView *HorzHdr = ui->canFramesView->horizontalHeader();
HorzHdr->setSortIndicator(logicalIndex, Qt::AscendingOrder);
ui->canFramesView->sortByColumn(logicalIndex); ui->canFramesView->sortByColumn(logicalIndex);
} }
+1 -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);
@@ -102,7 +103,6 @@ public slots:
void readUpdateableSettings(); void readUpdateableSettings();
void gotCenterTimeID(int32_t ID, double timestamp); void gotCenterTimeID(int32_t ID, double timestamp);
void updateConnectionSettings(QString connectionType, QString port, int speed0, int speed1); void updateConnectionSettings(QString connectionType, QString port, int speed0, int speed1);
void on_sectionClicked ( int logicalIndex );
signals: signals:
void sendCANFrame(const CANFrame *, int); void sendCANFrame(const CANFrame *, int);
+7
View File
@@ -42,12 +42,19 @@ 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);
decoder->setProcessAll(true); decoder->setProcessAll(true);
} }
void ISOTP_InterpreterWindow::headerClicked(int logicalIndex)
{
ui->tableIsoFrames->sortByColumn(logicalIndex);
}
ISOTP_InterpreterWindow::~ISOTP_InterpreterWindow() ISOTP_InterpreterWindow::~ISOTP_InterpreterWindow()
{ {
delete decoder; delete decoder;
+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;