[prev in list] [next in list] [prev in thread] [next in thread]
List: kwrite-devel
Subject: Re: using ktexteditor as a base for a disassembly viewer
From: Sven Brauch <mail () svenbrauch ! de>
Date: 2020-12-11 15:52:25
Message-ID: 938b9285-67fc-fb99-13cb-0de79a696a06 () svenbrauch ! de
[Download RAW message or body]
Hi,
> PS: How would one even use KSyntaxHighlighting for rendering into a
> QAbstractItemView? That also sounds somewhat nasty hmmm
That doesn't sound too complicated, or maybe I'm mistaken? For one of my \
applications, I needed HTML rendering once, which I implemented by creating a \
delegate holding a QTextDocument. The delegate just sets the text on the document and \
then draws its contents. The same should work when you set a highlighter. Like this \
(sorry, not the cleanest code, it's already a few years old): \
http://pastie.org/p/6yTw8HZl47KcgvrjSBaDG8
Otherwise, I'm not sure either. I personally think it will be easier if you just use \
a QTableView, unless you need column-wise text selection. I think you could hook \
everything you need into KTextEditor as well (by e.g. setting custom context menus \
depending on the column that was clicked etc) but it will require more lines of hacks \
than you would otherwise need to re-create the needed functionality yourself ;) Some \
applications use the text editor for a lot of stuff, maybe that can serve you as \
inspiration -- e.g. sublime text comes to mind, which presents its search results \
(and probably other things) as an interactive text document.
All the best,
Sven
On 12/11/20 3:46 PM, Milian Wolff wrote:
> Hey all,
>
> I'm wondering what to use for hotspot to show a disassembly view. Basically
> this view consists of multiple columns:
>
> - address
> - instructions
> - costs (cycles, instructions, branch misses, whatever...)
>
> Initially I thought: Let's use a read-only ktexteditor part for this, as it
> will get us highlighting and copy'n'paste features for free. But we'd have to
> put the costs into ktexteditor annotations then, I guess?
>
> So I'm not so sure whether that's a good fit after all: While we get some
> features for free, we lose others, such as reordering of columns and selection
> of more.
>
> What would you use to build something like this:
> https://docs.wasmtime.dev/assets/perf-annotate-fib.png
>
> Ideally, we would even eventually get the ability to show the source code too,
> like here:
> https://chrisdietri.ch/img/perf-report-annotate2.png
>
> But I have to say that instead of the mixed view above, I much prefer
> godbolt's view: https://danlarkorg.files.wordpress.com/
> 2020/10/2020-10-04-223128_947x626_scrot.png?w=947
>
> So, any input and suggestions would be welcome on how to tackle this.
>
[Attachment #3 (text/html)]
<html>
<head>
<meta http-equiv="Content-Type" content="text/html;
charset=windows-1252">
</head>
<body>
<pre>Hi,</pre>
<pre class="moz-quote-pre" wrap="">> PS: How would one even use \
KSyntaxHighlighting for rendering into a > QAbstractItemView? That also sounds \
somewhat nasty hmmm
That doesn't sound too complicated, or maybe I'm mistaken? For one of my \
applications, I needed HTML rendering once, which I implemented by creating a \
delegate holding a QTextDocument. The delegate just sets the text on the document and \
then draws its contents. The same should work when you set a highlighter. Like this \
(sorry, not the cleanest code, it's already a few years old): <a \
class="moz-txt-link-freetext" \
href="http://pastie.org/p/6yTw8HZl47KcgvrjSBaDG8">http://pastie.org/p/6yTw8HZl47KcgvrjSBaDG8</a>
Otherwise, I'm not sure either. I personally think it will be easier if you just use \
a QTableView, unless you need column-wise text selection. I think you could hook \
everything you need into KTextEditor as well (by e.g. setting custom context menus \
depending on the column that was clicked etc) but it will require more lines of hacks \
than you would otherwise need to re-create the needed functionality yourself ;) Some \
applications use the text editor for a lot of stuff, maybe that can serve you as \
inspiration -- e.g. sublime text comes to mind, which presents its search results \
(and probably other things) as an interactive text document.
All the best,
Sven
</pre>
<div class="moz-cite-prefix">On 12/11/20 3:46 PM, Milian Wolff
wrote:<br>
</div>
<blockquote type="cite"
cite="mid:53591533.DjNjmu2oIh@milian-workstation">
<pre class="moz-quote-pre" wrap="">Hey all,
I'm wondering what to use for hotspot to show a disassembly view. Basically
this view consists of multiple columns:
- address
- instructions
- costs (cycles, instructions, branch misses, whatever...)
Initially I thought: Let's use a read-only ktexteditor part for this, as it
will get us highlighting and copy'n'paste features for free. But we'd have to
put the costs into ktexteditor annotations then, I guess?
So I'm not so sure whether that's a good fit after all: While we get some
features for free, we lose others, such as reordering of columns and selection
of more.
What would you use to build something like this:
<a class="moz-txt-link-freetext" \
href="https://docs.wasmtime.dev/assets/perf-annotate-fib.png">https://docs.wasmtime.dev/assets/perf-annotate-fib.png</a>
Ideally, we would even eventually get the ability to show the source code too,
like here:
<a class="moz-txt-link-freetext" \
href="https://chrisdietri.ch/img/perf-report-annotate2.png">https://chrisdietri.ch/img/perf-report-annotate2.png</a>
But I have to say that instead of the mixed view above, I much prefer
godbolt's view: <a class="moz-txt-link-freetext" \
href="https://danlarkorg.files.wordpress.com/">https://danlarkorg.files.wordpress.com/</a>
2020/10/2020-10-04-223128_947x626_scrot.png?w=947
So, any input and suggestions would be welcome on how to tackle this.
</pre>
</blockquote>
</body>
</html>
[prev in list] [next in list] [prev in thread] [next in thread]
Configure |
About |
News |
Add a list |
Sponsored by KoreLogic