Skip to content

Commit 24e31f4

Browse files
committed
[SearchResultView] auto scroll the search results list
whenever the autoscroll is enabled for the main table, enable it for the SearchResultView as well. Signed-off-by: sudomgamal <mg.moh.gamal@gmail.com>
1 parent 19239a7 commit 24e31f4

File tree

6 files changed

+31
-1
lines changed

6 files changed

+31
-1
lines changed

dltmessageanalyzerplugin/src/components/searchView/src/CSearchResultView.cpp

+5
Original file line numberDiff line numberDiff line change
@@ -352,6 +352,11 @@ void CSearchResultView::dataChanged(const QModelIndex &topLeft, const QModelInde
352352
mbIsVerticalScrollBarVisible = isVerticalScrollBarVisible_;
353353
}
354354
}
355+
356+
if(hasAutoScroll())
357+
{
358+
scrollToBottom();
359+
}
355360
}
356361

357362
void CSearchResultView::currentChanged(const QModelIndex &current,

dltmessageanalyzerplugin/src/dltmessageanalyzerplugin.cpp

+9
Original file line numberDiff line numberDiff line change
@@ -749,6 +749,15 @@ bool DLTMessageAnalyzerPlugin::stateChanged(int, QDltConnection::QDltConnectionS
749749
return true;
750750
}
751751

752+
bool DLTMessageAnalyzerPlugin::autoscrollStateChanged(bool autoScoll)
753+
{
754+
if( mpDLTMessageAnalyzer )
755+
{
756+
mpDLTMessageAnalyzer->autoscrollStateChanged(autoScoll);
757+
}
758+
return true;
759+
}
760+
752761
#ifndef PLUGIN_API_COMPATIBILITY_MODE_1_0_0
753762
void DLTMessageAnalyzerPlugin::initMainTableView(QTableView* pMainTableView)
754763
{

dltmessageanalyzerplugin/src/dltmessageanalyzerplugin.hpp

+1-1
Original file line numberDiff line numberDiff line change
@@ -96,7 +96,7 @@ public slots:
9696
bool initConnections(QStringList) final override { return true; }
9797
bool controlMsg(int, QDltMsg &) final override { return true; }
9898
bool stateChanged(int index, QDltConnection::QDltConnectionState connectionState,QString hostname) final override;
99-
bool autoscrollStateChanged(bool) final override { return true; }
99+
bool autoscrollStateChanged(bool) final override;
100100

101101
#ifndef PLUGIN_API_COMPATIBILITY_MODE_1_0_0
102102
void initMainTableView(QTableView* pMainTableView) override;

dltmessageanalyzerplugin/src/plugin/api/CDLTMessageAnalyzer.hpp

+6
Original file line numberDiff line numberDiff line change
@@ -204,6 +204,12 @@ class CDLTMessageAnalyzer : public IDLTMessageAnalyzerControllerConsumer,
204204
*/
205205
void connectionChanged(bool connected);
206206

207+
/**
208+
* @brief autoscrollStateChanged - notifies this controller, that autoscroll state has changed.
209+
* @param state - autoscroll state.
210+
*/
211+
void autoscrollStateChanged(bool state);
212+
207213
/**
208214
* @brief decodeMsg - allows to decode the message.
209215
* @param msg - message to be decoded.

dltmessageanalyzerplugin/src/plugin/src/CDLTMessageAnalyzer.cpp

+9
Original file line numberDiff line numberDiff line change
@@ -2536,6 +2536,15 @@ void CDLTMessageAnalyzer::connectionChanged(bool connected)
25362536
mbIsConnected = connected;
25372537
}
25382538

2539+
void CDLTMessageAnalyzer::autoscrollStateChanged(bool state)
2540+
{
2541+
mpSearchResultView->setAutoScroll(state);
2542+
if(state)
2543+
{
2544+
mpSearchResultView->scrollToBottom();
2545+
}
2546+
}
2547+
25392548
void CDLTMessageAnalyzer::triggerContinuousAnalysis(bool checked)
25402549
{
25412550
if(false == checked)

dltmessageanalyzerplugin/src/plugin/src/form.cpp

+1
Original file line numberDiff line numberDiff line change
@@ -128,6 +128,7 @@ Form::Form(DLTMessageAnalyzerPlugin* pDLTMessageAnalyzerPlugin,
128128
mpUI->patternsTreeView->setHorizontalScrollBarPolicy(Qt::ScrollBarPolicy::ScrollBarAlwaysOff);
129129
mpUI->searchView->horizontalHeader()->setVisible(true);
130130
mpUI->groupedView->header()->setVisible(true);
131+
mpUI->searchView->setAutoScroll(true);
131132
}
132133

133134
if(mpUI->CNSplitter_1)

0 commit comments

Comments
 (0)