diff mbox series

[2/3] kernel-shark: Always clear the marker after resizing the table.

Message ID 20190715132042.5154-3-y.karadz@gmail.com (mailing list archive)
State Accepted
Headers show
Series Fixes needed befor KS 1.0 | expand

Commit Message

Yordan Karadzhov July 15, 2019, 1:20 p.m. UTC
It looks more like a Qt bug, but sometimes the automatic resize of
the table widget done in KsTraceViewer::_resizeToContents() has the
parasitic effect to select the first row of the table (making the row
green). If this is happening clear the selection by hand.

Signed-off-by: Yordan Karadzhov (VMware) <y.karadz@gmail.com>
---
 kernel-shark/src/KsTraceViewer.cpp | 10 +++++++++-
 1 file changed, 9 insertions(+), 1 deletion(-)
diff mbox series

Patch

diff --git a/kernel-shark/src/KsTraceViewer.cpp b/kernel-shark/src/KsTraceViewer.cpp
index 89e5dba..c176cef 100644
--- a/kernel-shark/src/KsTraceViewer.cpp
+++ b/kernel-shark/src/KsTraceViewer.cpp
@@ -563,12 +563,20 @@  void KsTraceViewer::keyReleaseEvent(QKeyEvent *event)
 
 void KsTraceViewer::_resizeToContents()
 {
-	int rows, columnSize;
+	int rows, columnSize, markRow = selectedRow();
 
 	_view.setVisible(false);
 	_view.resizeColumnsToContents();
 	_view.setVisible(true);
 
+	/*
+	 * It looks like a Qt bug, but sometimes when no row is selected in
+	 * the table, the automatic resize of the widget (the lines above) has
+	 * the parasitic effect to select the first row of the table.
+	 */
+	if (markRow == KS_NO_ROW_SELECTED)
+		_view.clearSelection();
+
 	/*
 	 * Because of some unknown reason the first column doesn't get
 	 * resized properly by the code above. We will resize this