diff mbox series

kernel-shark: Fix function_graph indent monospace

Message ID ce193c5260178313eaaab3dcf49dfcbb9526be0b.1664810553.git.andrej.stender@thermalcircle.de (mailing list archive)
State Accepted
Commit 843903f5cd12990c5786ae6c9bbc6422f8746bb4
Headers show
Series kernel-shark: Fix function_graph indent monospace | expand

Commit Message

Andrej Stender Oct. 3, 2022, 3:40 p.m. UTC
Show content of KsTraceViewer table in monospaced font. When using
function_graph tracer, its C-style indentation of traced functions is
now shown correctly.

Use system font, so the font used in the table can still can be
configured via window manager, same as the fonts in title and menus. The
font in the horizontal header of the table stays regular non-monospaced
as before.

Tested on KDE Plasma 5.25.4, Qt 5.15.4.

Bugzilla: https://bugzilla.kernel.org/show_bug.cgi?id=216404
Signed-off-by: Andrej Stender <andrej.stender@thermalcircle.de>
---
 src/KsTraceViewer.cpp | 3 +++
 1 file changed, 3 insertions(+)

Comments

Yordan Karadzhov Oct. 8, 2022, 3:40 p.m. UTC | #1
Applied. Thanks Andrej!
Yordan


On 10/3/22 18:40, Andrej Stender wrote:
> Show content of KsTraceViewer table in monospaced font. When using
> function_graph tracer, its C-style indentation of traced functions is
> now shown correctly.
> 
> Use system font, so the font used in the table can still can be
> configured via window manager, same as the fonts in title and menus. The
> font in the horizontal header of the table stays regular non-monospaced
> as before.
> 
> Tested on KDE Plasma 5.25.4, Qt 5.15.4.
> 
> Bugzilla: https://bugzilla.kernel.org/show_bug.cgi?id=216404
> Signed-off-by: Andrej Stender <andrej.stender@thermalcircle.de>
> ---
>   src/KsTraceViewer.cpp | 3 +++
>   1 file changed, 3 insertions(+)
> 
> diff --git a/src/KsTraceViewer.cpp b/src/KsTraceViewer.cpp
> index afd5a859de72..be0a41941db2 100644
> --- a/src/KsTraceViewer.cpp
> +++ b/src/KsTraceViewer.cpp
> @@ -129,6 +129,9 @@ KsTraceViewer::KsTraceViewer(QWidget *parent)
>   	_view.setSelectionBehavior(QAbstractItemView::SelectRows);
>   	_view.setSelectionMode(QAbstractItemView::SingleSelection);
>   	_view.verticalHeader()->setDefaultSectionSize(FONT_HEIGHT * 1.25);
> +	_view.setFont(QFontDatabase::systemFont(QFontDatabase::FixedFont));
> +	_view.horizontalHeader()->setFont(
> +		QFontDatabase::systemFont(QFontDatabase::GeneralFont));
>   
>   	 _proxyModel.setSource(&_model);
>   	_view.setModel(&_proxyModel);
diff mbox series

Patch

diff --git a/src/KsTraceViewer.cpp b/src/KsTraceViewer.cpp
index afd5a859de72..be0a41941db2 100644
--- a/src/KsTraceViewer.cpp
+++ b/src/KsTraceViewer.cpp
@@ -129,6 +129,9 @@  KsTraceViewer::KsTraceViewer(QWidget *parent)
 	_view.setSelectionBehavior(QAbstractItemView::SelectRows);
 	_view.setSelectionMode(QAbstractItemView::SingleSelection);
 	_view.verticalHeader()->setDefaultSectionSize(FONT_HEIGHT * 1.25);
+	_view.setFont(QFontDatabase::systemFont(QFontDatabase::FixedFont));
+	_view.horizontalHeader()->setFont(
+		QFontDatabase::systemFont(QFontDatabase::GeneralFont));
 
 	 _proxyModel.setSource(&_model);
 	_view.setModel(&_proxyModel);