PDA

View Full Version : Log browser suggestions?



NRGizeR
13th July 2006, 15:47
Hey *wink*

I've been dabbling in Qt for a while now, and written an appliaction or two, but I wouldn't by any means say that I know Qt. :)

What I'm trying to do atm, is to write a Log viewer, that would have the functionality of showing a sequence number. This could work somewhat like a line number in for example kate, connected to a certain line, but not a line number per say. Another functionality that I would like is to be able to show/hide any given line in the log on the fly, so that I'm able to filter out unwanted/unneeded data quickly. Syntax highlighting is another thing that I want/need.

Now to the question; I've been looking at different options on how to do this, including browsing this forum, but I've yet to come up with a "good" way to do this. I've looked especially at QTextBrowser, but I'm not really sure about where to start to be able to add the functionality I need to this. So, oh gurus, do you have any suggestions on how I could tackle this problem? :confused:

Thanks,
-NRGizeR

Oh, and I'm using Qt 3.3.

jacek
13th July 2006, 16:05
How about QListView?

NRGizeR
14th July 2006, 08:46
How about QListView?

Isn't that like a tree structure? Or can it be used as a richtext text display widget as well? Some kind of table formatting wouldn't be that bad actually, but the most important part is really to be able to easily (in code) distinguish one line from another, and hide/show any given line quickly... Am I missing something about QListView?

Thanks,
-NRGizeR

jacek
14th July 2006, 10:20
Isn't that like a tree structure?
It can display a tree, but it doesn't have to.


Or can it be used as a richtext text display widget as well?
You can subclass QListViewItem and make it display richtext using QSimpleRichText.


the most important part is really to be able to easily (in code) distinguish one line from another, and hide/show any given line quickly...
With QListView each line will be a different object, so you won't have problems with it.

I'm not sure how large log file QListView can handle, but since you have to create a lot of QListViewItems, it might not be enough.

The alternative is QTextEdit or QTextBrowser. QTextEdit even can operate in Log mode (in which it should be able to display more text than in other modes, but it also supports less formatting tags). Unfortunately it won't be easy to hide and show particular lines, but maybe you can have two representations --- one internal on which you can operate easily and one for the QTextEdit, that contains processed log visible to the user (of course it will increase memory usage).

Third solution is to create your own widget and if you want only to display logs, it might not be that hard.