Hi,
Does the Q(Plain)TextEdit widget supports column selection ?
I have heard it was the case in Qt3, but I saw nothing about it in Qt4.
If not, any idea about how to implement such a thing ?
thanks.
Hi,
Does the Q(Plain)TextEdit widget supports column selection ?
I have heard it was the case in Qt3, but I saw nothing about it in Qt4.
If not, any idea about how to implement such a thing ?
thanks.
Neither QPlainTextEdit nor QTextEdit support column selection and I doubt that such a feature is on the TODO list of the Trolls (Noks now...).
Implementing this for QTextEdit/QTextDocument (or the plain text counterpart) will probably be hackish and quite painful (if doable at all). The only Qt-based editor that I know of which features column selection is QCodeEdit.
Current Qt projects : QCodeEdit, RotiDeCode
kib2 (25th October 2008)
Thanks fullmetalcoder,
Does that mean that we always have to stay with the awfull Scintilla control to write a descent editor (it's a good control, but you have to write your own parser for any new langage : a pain ).
I've tried it, but got errors when compiling.
How did you implemented the folding ? (I'm' just curious, I found nothing about this).
Do you project to make a QtPlugin for it ?
Please send me more informations about this (version used, compiler, platform, Qt version, compile log...) so that I may be able to fix things (if they are still broken in the latest version).I've tried it, but got errors when compiling.
IMO QScintilla sucks for two main reasons :it's a good control, but you have to write your own parser for any new langage : a pain
- it lacks flexibility
- its API is really crappy
In QCodeEdit I tried to address both issues :
- By adding a syntax engine that fetches languages definitions from XML files, thus relieving developers of the complicated parser writing phase
- By adding the concept of panels which allow complete customization of the editor (line number, line marks, folding indicators, ... are all done in separate panels which can be easily enabled/disabled)
- QCodeEdit API has been designed to be close to QTextEdit API
In QCodeEdit I implemented folding in the most straightforward way : giving a HIDDEN flag to the lines (or blocks to speak in QTextDocument). This is possible because I reimplmented my document and editor classes from scratch.How did you implemented the folding ? (I'm' just curious, I found nothing about this).
In a previous version that still used QTextEdit as a base class I hacked a crappy code folding by deleting the text to hide but keeping it in a custom QTextBlockUserData object attached to the first line of the folded block. This worked but messed up the undo stack so it was not a viable solution.
Do you mean Qt Designer plugin? It was not on my TODO list but I may consider doing it if some people show interest for such a feature.Do you project to make a QtPlugin for it ?
Current Qt projects : QCodeEdit, RotiDeCode
Ok, I'll retry tomorrow and send you a report.
Yes, and it's really annoying ; everyone is using it because it's the only one that provides a rather "good" syntax highlighting (good does not means configurable here, rather functionnal), code folding, and column selection too for free. But once you get it, you're stuck with the given lexers, and writting your own is just a pain.
I really think it's the way to go for any descent editor.
Yes, I've already think of this : text is a list of lines, and when you fold it, you just
hide some parts of the list contents, but what are the penalties (in speed ) ?
I've never used QTextBlockUserData before; when looking at it quickly, it seems good for matching pairs of parenthesis, etc. If I can use it for folding too, it may be a good idea.
I suppose you've also made controls for margins too : folding and line numbers (I've made the last one, but it became slow on large files).
That's what I meant In fact, I'm not programming in C++, I use Python, but if I can use your control with some of the things I've made with my older one (sort of "multi cursors" [you can drag them everywhere, then type something : all the cursors are updated once you enter some text], snippets, etc), I'll be near heaven
The speed is really a matter of implementation. In QCodeEdit I got incredible speed (you can fold tens of thousands of lines in a matter of milliseconds) by storing a map of hidden regions (start line and size) which allows fast coordinate transforms (visual line <=> actual text line) and get rid of the need to iterate over the whole document to draw line numbers (or line marks and similar things... however folding indicator still require complete iteration right now).
Not such a good solution actually (unless you're tied to QTextEdit) for the reasons I've explained above. If you're interested in implementing code folding this way you may be interested in having a look at old Edyuk versions (up until 0.9.x)
Are you sure a designer plugin is enough to use a component within Python? I'd have thought it would be necessary to wrap the whole lib just like QScintilla does...
Current Qt projects : QCodeEdit, RotiDeCode
That seems impressive.
Ok, thanks I'll take a closer look at it.
No, not at all. I think we must wrap it using SIP, like QScintila does.
Here's my report on trying to build QCodeEdit 2.1:
http://share11.appspot.com/3421
It did require some work but line wrapping is even more of a challenge (almost done in SVN)
Just remember that this solution is FAR from ideal (even QScintilla ought to be prefered unless you have pretty good reasons to stick to QTextEdit)
That's what I thought. I thought about giving it a try some time ago but it looked like a lot of work (no automating as far as I could tell).
The file which causes compilation to fail should not even be compiled actually... It is a remnant from the early genesis of the syntax engine (I had to test it outside of the editing framework to make sure it worked properly before integrating it into the bigger entity). You can safely remove this file (lib/qnfa/main.cpp). Then re-run qmake, then make and everything should go fine.
Thanks for reporting this. I'll remove this file from the next release (it is already removed from SVN btw).
Current Qt projects : QCodeEdit, RotiDeCode
FullMetalCoder,
I've removed main.cpp from "\lib\qnfa", then the corresponding line from "qcodeedit-2.1.pro" (I suppose I have to do that too).
Here's what I've got : http://share11.appspot.com/3222
I did not find any Edyuk versions < 0.9 to study the old code ...where are they ?
I've installed Edyuk for the first time : really great piece of work
Is it possible to continue talking on IRC or by mail ?
Errr... Would you, by any chance, have generated a qmake project with "qmake -project" ? (The main project file should be qcodeedit.pro which is a subdirs project for the lib and the example app). This would explain why everything goes wrong.
The TuxFamily download server only provide the most recent packages. All the versions are available on sourceforge : http://sourceforge.net/project/showf...kage_id=191461
Thanks. And version 1.1.0 will be even better
Sure. You can use the MSN address in my profile to contact me by mail or IM
Current Qt projects : QCodeEdit, RotiDeCode
Dear fullmetalcoder,
I'm a beginner and now I'm also get stucked in the column select in QPlainTextEdit, could you please help me with this? Thanks a lot!!
Bookmarks