just to correct my previous post, the application does not freezes, it just take a HUGE time to be available.
By the way, I just LOVE your Firefox search like, excelent work!
just to correct my previous post, the application does not freezes, it just take a HUGE time to be available.
By the way, I just LOVE your Firefox search like, excelent work!
--
Thiago dos Santos Alves
Computer Scientist
thiago.salves@gmail.com
-----------------------------------------------------
"A mind that opens to a new idea never gets its original size again."
- Albert Einstein
ok, did that. thanks I learned a lot.
The published code works this way:
The text first loaded by issuing a QTimer::singleShot(). This is done because I don't want that code to block my main application.
After the text has been loaded, I issue another QTimer::singleShot() to color the text. What I did not enticipate, is that the coloring would be done (by QSyntaxHighligther) in a blocking and non incremental way. I expected that lines would be colored one by one, and even slowly, the UI would be usable. Now, as you seen the coloring is done "all at once" and blocks the UI. IMHO this should be filed as a bug report to the trolls.
I also played with the loading/coloring code, and experimened with several loading/coloring methods. The code fixes are really trivial, but they learn a lot.
Loading that file on my PC with the original code: 2:02 (the published code).
Loading that file, by first setting the HL and then loading the file line by line: 4:02
Loading that file, by first setting the HL and then loading the file all at once: ~3:10
So, even tough the highliter is extramly slow, it seems I choosed the "best" way of doying it. I know how to refactor the code, and it will be done soon. Probably by net week, I will have a code which is slow, but usable.
BTW,
is it ok to keep attaching tgz's here? or do I need to upload it to an external site...?
edit:
Tried to do the same using a QThread. No luck, eigther I cannot assign parent objects from another thread, or cannot generate timers from another thread (QTextEdit or QSyntaxHighlighter do that, not sure).
Next, I will see if using the QSyntaxHighlighter from QSA improoves the speed.
Last edited by elcuco; 5th February 2006 at 17:26.
Gonna try your version elcuco.
Not even a pre-alpha of the IDE to post! Sorry but I work hard during the week-end to refactor trolls' code :
I subclassed QFrame and added QAbstractScrollArea's and the QTextEdit's features. After a while I got it compiling and displaying text but I got some troublesome isues:
- disabling word wrap seems to cancel drawing of the QTextDocument I didn't have enough time to understand why but I think I can make it work soon
- scrollbars drive me mad! Each time I attempt to scroll, it cause great troubles in drawing, both inside CoreEdit (the name of my widget) and outside (DevLineNumber for those who tried my last posted code) !!!
But good things have been gained :
- that version highlight current line fastly and flawlessly
- I got total control on shortcuts !!!
- multiline edit will be much easier to implement
- and so on...
If anybody is interested in helping me (that scrollbar bug is so weird and annoying!) I can post the current source
edit : actually I've got something to post and word wrap trouble was fixed
Have fun with my code!
Last edited by fullmetalcoder; 6th February 2006 at 14:16.
Current Qt projects : QCodeEdit, RotiDeCode
Qt Code:
elcuco@linux:~/src/qt4-editors/core-edit> make g++ -c -pipe -g -Wall -W -D_REENTRANT -DQT_GUI_LIB -DQT_CORE_LIB -DQT_SHARED -I/usr/local/Trolltech/Qt-4.1.1-snapshot-20060203/mkspecs/linux-g++ -I. -I/usr/local/Trolltech/Qt-4.1.1-snapshot-20060203/include/QtCore -I/usr/local/Trolltech/Qt-4.1.1-snapshot-20060203/include/QtGui -I/usr/local/Trolltech/Qt-4.1.1-snapshot-20060203/include -I. -I. -I. -o coreedit.o coreedit.cpp In file included from coreedit.cpp:28: coreedit.h:33:43: error: private/qtextdocumentlayout_p.h: No such file or directory coreedit.cpp:126: error: ‘QTextDocumentLayout’ was not declared in this scope coreedit.cpp:126: error: ‘l’ was not declared in this scope coreedit.cpp:127: error: ‘QTextDocumentLayout’ cannot appear in a constant-expression coreedit.cpp:127: error: parse error in template argument list coreedit.cpp:127: error: no matching function for call to ‘qobject_cast(QAbstractTextDocumentLayout*)’ coreedit.cpp: At global scope:To copy to clipboard, switch view to plain text mode
Please, If you want to rewrite a new text editor widget, do this. But don't mess something working. For example, copy this text to your editor and into notepad. Move the cursor arround and understand what are you breaking if you mess too much:
אני אוכל זכוכית וזה לא כואב לי
(google for BIDI).
[QUOTE=fullmetalcoder :: Have fun with my code![/QUOTE]
it's not easy
i can't get it (i mean file)
sorry i get -- just don't use Opera
Last edited by Iam; 7th February 2006 at 09:43.
Looks like a big include problem!Originally Posted by elcuco
I don't plan to mess up something working! I just wanted to refactor Trolls' code to get rid of the Qx / QxPrivate architecture that is awful IMO; to gain a full control on events; to shrink it and make it faster by removing all list formatting stuffs and a few other useless rich text features!
That weird scrollbar bug may stop the development of CoreEdit and make me turn back to the QTextEdit derived one but, well ... I tried!!!
Current Qt projects : QCodeEdit, RotiDeCode
Ok, I got it to stop mucking up the numbers displaying in DevLineNumber by adding
Qt Code:
p.eraseRect(0, 0, width(), height());To copy to clipboard, switch view to plain text mode
after
in
Qt Code:
To copy to clipboard, switch view to plain text mode
I tried to chase down the bug that caused the QMainWindow to go black (very weird) when resizing, but I failed. I'm not very good at paint code . I also tried to figure out the line highlighting problem with using the mousewheel, scrollbar, etc, but I failed. I'm not good at math!
But I was very impressed
Last edited by gesslar; 5th April 2006 at 01:06.
Thank you for your interest but this version is moreless abandonned : the DevQt team is working on a more powerfull editor (folding, multiline editing, persistent selection...) and we started using new patterns and definitely chose to use QTextEdit as a base to avoid all those bugs...
The current version of the editor is already working nice but not finished yet so if you wish to get involved in coding such a widget join us (try Berlios developper forum or IRC to tell us your choice)
Current Qt projects : QCodeEdit, RotiDeCode
Bookmarks