Page 1 of 2 12 LastLast
Results 1 to 20 of 216

Thread: QCodeEdit

Hybrid View

Previous Post Previous Post   Next Post Next Post
  1. #1
    Join Date
    Jan 2006
    Location
    travelling
    Posts
    1,116
    Thanks
    8
    Thanked 127 Times in 121 Posts
    Qt products
    Qt4
    Platforms
    Unix/X11 Windows

    Default Re: QCodeEdit

    Quote Originally Posted by croftj View Post
    The upside is that it looks like the code is present to make rectangular selections. Can you give me hints where to look if I wanted to see where the markings for a rectangular area get set?
    what do you mean? there is no real rectangular selection but a smartly managed combination of selections actually which, drawn together make up a nice rectangle...

    As for the naming I guess a namspace would be the best solution for consistency...
    Current Qt projects : QCodeEdit, RotiDeCode

  2. #2
    Join Date
    May 2007
    Location
    England
    Posts
    56
    Thanks
    2
    Qt products
    Qt3 Qt4
    Platforms
    Unix/X11 Windows

    Default Re: QCodeEdit

    I think I just found a couple of bugs.
    When using proportional fonts, the horizontal scroll bar appears to significantly under estimate the width of the text and will not allow scrolling to the end of the lines.
    Also try this. Move the cursor to the start of a line either by clicking it there or using home. Now hold shift and press down cursor. In every other editor, this moves the cursor down to the start of the next line and selects all of the line that it left. In QCodeEdit it does this but also selects all of the line it moved to, leaving 2 lines completely selected.

  3. #3
    Join Date
    Jan 2006
    Location
    travelling
    Posts
    1,116
    Thanks
    8
    Thanked 127 Times in 121 Posts
    Qt products
    Qt4
    Platforms
    Unix/X11 Windows

    Default Re: QCodeEdit

    Quote Originally Posted by Usability View Post
    I think I just found a couple of bugs.
    When using proportional fonts, the horizontal scroll bar appears to significantly under estimate the width of the text and will not allow scrolling to the end of the lines.
    Also try this. Move the cursor to the start of a line either by clicking it there or using home. Now hold shift and press down cursor. In every other editor, this moves the cursor down to the start of the next line and selects all of the line that it left. In QCodeEdit it does this but also selects all of the line it moved to, leaving 2 lines completely selected.
    Good news : I fixed both issues.
    Bad news : my network connection is getting kinda weird (some apps can use it, browser for instance and others fail...) so, as svn hung during the commit I'm not quite sure the content of the repository has been updated properly...
    Current Qt projects : QCodeEdit, RotiDeCode

  4. #4
    Join Date
    May 2007
    Location
    England
    Posts
    56
    Thanks
    2
    Qt products
    Qt3 Qt4
    Platforms
    Unix/X11 Windows

    Default Re: QCodeEdit

    It works now, thanks for that fix

    I just suffered using windows again long enough to check this still compiles on MSVC6. There were just two changes needed.

    qeditor.cpp line 1120, do not return a value, its a void function.
    Similarly 1685.

  5. #5
    Join Date
    May 2007
    Location
    England
    Posts
    56
    Thanks
    2
    Qt products
    Qt3 Qt4
    Platforms
    Unix/X11 Windows

    Default Re: QCodeEdit

    Hi Fullmetalcoder, I am having trouble refreshing the content of the editor. I did this

    Qt Code:
    1. QString qsFileName = pEditor->fileName();
    2. pEditor->load(qsFileName);
    To copy to clipboard, switch view to plain text mode 

    and it causes a crash.

    The call stack shows
    • QEditor::load,
    • QEditor::setText,
    • QDocument::setText,
    • qDeleteAll,
    • qDeleteAll,
    • QDocumentLineHandle::~QDocumentLineHandle,
    • QDocumentPrivate::emitLineDeleted,
    • QHash<Key, T>::remove,
    • QHash<Key, T>::detach,
    • QHash<Key, T>::detach_helper


    If I am going about this the right way, hopefully you can bind some event in one of your programs to these two lines and reproduce the crash. If it doesn't just fall out and you need a test case, let me know.

  6. #6
    Join Date
    May 2007
    Location
    England
    Posts
    56
    Thanks
    2
    Qt products
    Qt3 Qt4
    Platforms
    Unix/X11 Windows

    Default Re: QCodeEdit

    Some search related questions.

    I think there is a problem with the "In selection" option on find. A concrete example. I invoke the editor like this:
    example/example lib/qcodeedit.cpp
    Then select lines 35 to 39
    key ctrl-f
    enter new as the search string, and it finds the one on line 28. Note that this is with From cursor off.

    What is the second button from the left in the find bar for? I have never know it do anything and it has no tool tip.

    Is there any way I can set the "From cursor" option to be the default when I create an editor? I think this is what most people would expect of a find, and I want to save them the trouble of figuring out why their first find didn't do what they wanted.

  7. #7
    Join Date
    Jan 2006
    Location
    travelling
    Posts
    1,116
    Thanks
    8
    Thanked 127 Times in 121 Posts
    Qt products
    Qt4
    Platforms
    Unix/X11 Windows

    Default Re: QCodeEdit

    Quote Originally Posted by Usability View Post
    qeditor.cpp line 1120, do not return a value, its a void function.
    Similarly 1685.
    Quote Originally Posted by Usability View Post
    I am having trouble refreshing the content of the editor. I did this

    Qt Code:
    1. QString qsFileName = pEditor->fileName();
    2. pEditor->load(qsFileName);
    To copy to clipboard, switch view to plain text mode 

    I think there is a problem with the "In selection" option on find. A concrete example. I invoke the editor like this:
    example/example lib/qcodeedit.cpp
    Then select lines 35 to 39
    key ctrl-f
    enter new as the search string, and it finds the one on line 28. Note that this is with From cursor off.

    Is there any way I can set the "From cursor" option to be the default when I create an editor? I think this is what most people would expect of a find, and I want to save them the trouble of figuring out why their first find didn't do what they wanted.
    I'll sort these out ASAP (which basically means next week end...)

    Quote Originally Posted by Usability
    What is the second button from the left in the find bar for? I have never know it do anything and it has no tool tip.
    I'm not sure I understand which one you refer to but I think it's the one supposed to somehow "refresh" the search context.
    Current Qt projects : QCodeEdit, RotiDeCode

  8. #8
    Join Date
    May 2007
    Location
    England
    Posts
    56
    Thanks
    2
    Qt products
    Qt3 Qt4
    Platforms
    Unix/X11 Windows

    Default Re: QCodeEdit

    I am having trouble writing the syntax file for a language that uses begin/end as the block start/end delimiters, like { and } in C.

    I started with this:

    Qt Code:
    1. <sequence format="keyword" parenthesis="be_block:open" indent="1" fold="1">begin</sequence>
    2. <sequence format="keyword" parenthesis="be_block:close" indent="1" fold="1">end</sequence>
    To copy to clipboard, switch view to plain text mode 

    And the folding mostly worked well. Unfortunately it spotted the begin in

    int beginning;

    and marked it as the start of a fold-able block.
    So I tried this:

    Qt Code:
    1. <list id="keywords/blocks" format="keyword">
    2. <word parenthesis="be_block:close" indent="1" fold="1">begin</word>
    3. <word parenthesis="be_block:close" indent="1" fold="1">end</word>
    4. </list>
    To copy to clipboard, switch view to plain text mode 

    But that doesn't fold at all. Any suggestions on the solution for this?


    A couple of related but somewhat pedantic questions. There seem to be some gremlins exposed by having begin and end markers on the same line. Try running the example editor, eg

    example/example

    And enter this:

    Qt Code:
    1. if (1) {;} else {
    2.  
    3.  
    4. }
    5. if {
    6.  
    7.  
    8. }
    To copy to clipboard, switch view to plain text mode 

    then collapse the fold starting on the if. For me this produces a corrupt screen showing three if lines. I appreciate that is an ugly example, and I wont be at all surprised if you choose to ignore it.

    This one is a more reasonable code style.

    Qt Code:
    1. if (1) {
    2.  
    3.  
    4. } else {
    5.  
    6.  
    7. }
    To copy to clipboard, switch view to plain text mode 

    Here if you fold up the if statement it folds the complete program. I am not sure this is correct. I was expecting the else branch to remain expanded.

  9. #9
    Join Date
    Jan 2006
    Location
    travelling
    Posts
    1,116
    Thanks
    8
    Thanked 127 Times in 121 Posts
    Qt products
    Qt4
    Platforms
    Unix/X11 Windows

    Default Re: QCodeEdit

    Quote Originally Posted by Usability View Post
    I am having trouble writing the syntax file for a language that uses begin/end as the block start/end delimiters, like { and } in C.
    This should work AFAIK :
    Qt Code:
    1. <word format="keyword" parenthesis="be_block:open" indent="1" fold="1">begin</word>
    2. <word format="keyword" parenthesis="be_block:close" indent="1" fold="1">end</word>
    To copy to clipboard, switch view to plain text mode 

    Quote Originally Posted by Usability View Post
    A couple of related but somewhat pedantic questions. There seem to be some gremlins exposed by having begin and end markers on the same line. Try running the example editor, eg

    example/example

    And enter this:

    Qt Code:
    1. if (1) {;} else {
    2.  
    3.  
    4. }
    5. if {
    6.  
    7.  
    8. }
    To copy to clipboard, switch view to plain text mode 

    then collapse the fold starting on the if. For me this produces a corrupt screen showing three if lines. I appreciate that is an ugly example, and I wont be at all surprised if you choose to ignore it.
    I'll look into it. I can't ignore such a bug if I want the syntax engine to trully be generic...

    Quote Originally Posted by Usability View Post
    This one is a more reasonable code style.

    Qt Code:
    1. if (1) {
    2.  
    3.  
    4. } else {
    5.  
    6.  
    7. }
    To copy to clipboard, switch view to plain text mode 

    Here if you fold up the if statement it folds the complete program. I am not sure this is correct. I was expecting the else branch to remain expanded.
    This is correct... As I can place more than one collapse/fold marker per line I decided to fold "whole" blocks... I can try to change that behavior (and possibly make it configurable) but I'm not sure it would be worth the effort. (correct me if I'm wrong).
    Current Qt projects : QCodeEdit, RotiDeCode

  10. #10
    Join Date
    Jan 2006
    Location
    travelling
    Posts
    1,116
    Thanks
    8
    Thanked 127 Times in 121 Posts
    Qt products
    Qt4
    Platforms
    Unix/X11 Windows

    Default Re: QCodeEdit

    I've corrected all the reported issues so far (or so I believe...)and taken the opportunity to improve the example app a bit.

    I'm waiting for your feedback
    Last edited by fullmetalcoder; 24th November 2007 at 21:49.
    Current Qt projects : QCodeEdit, RotiDeCode

  11. #11
    Join Date
    May 2007
    Location
    England
    Posts
    56
    Thanks
    2
    Qt products
    Qt3 Qt4
    Platforms
    Unix/X11 Windows

    Default Re: QCodeEdit

    Quote Originally Posted by fullmetalcoder View Post
    I've corrected all the reported issues so far (or so I believe...)and taken the opportunity to improve the example app a bit.

    I'm waiting for your feedback
    Thank you, everything looks good.

    Folding works as you say, thanks for the begin/end advice that fixes my problem here.
    I see find in selection working, and from cursor now the default.
    The crash on reload fixed.

    So back to no known defects Cool.

  12. #12
    Join Date
    May 2007
    Location
    England
    Posts
    56
    Thanks
    2
    Qt products
    Qt3 Qt4
    Platforms
    Unix/X11 Windows

    Default Re: QCodeEdit

    Hi Fullmetalcoder.

    I gave a program containing this editor to a college for comments, and got this feedback.

    I'm really getting used to using this editor and growing more fond of it as the days go by, but there are a couple of minor suggestions/irritations:

    1) When scrolling up when the cursor moves up from the top line of the screen it causes an extra line to appear - when scrolling down and the cursor hits the bottom of the screen the next down causes the next page to appear and the cursor is now at the top of this screen. This is extremely irritating!

    2) When using find - what does the green button to the left of the string entry box do? When I click it it appears to do nothing.

    3) There is a tooltip on the close button for the find toolbar, but not on the "green" button or the find forward/reverse buttons

    4) When using the find forward button and then use the find reverse the first hit does not move onto the next match (the line number stays the same, but the column numbers change). The same is true when doing the reverse.

    5) If you do a forward find and then move the cursor to a line above the found string, then hit find forward again it goes to the next match (I would expect that because the line with the cursor is highlighted that the previous match would be highlighted again)

  13. #13
    Join Date
    May 2007
    Location
    England
    Posts
    56
    Thanks
    2
    Qt products
    Qt3 Qt4
    Platforms
    Unix/X11 Windows

    Default Re: QCodeEdit

    Just noticed, prompted find/replace is broken. For example,
    example/example lib/qcodeedit.cpp

    Key ctrl-r, try and replace this with that. The settings I had were, match case, prompt on replace, from cursor.
    I get a box asking "Shall it be replaced?" Clicking yes has no effect (other than to close the QMessageBox).

  14. #14
    Join Date
    Jan 2006
    Location
    travelling
    Posts
    1,116
    Thanks
    8
    Thanked 127 Times in 121 Posts
    Qt products
    Qt4
    Platforms
    Unix/X11 Windows

    Default Re: QCodeEdit

    Quote Originally Posted by Usability View Post
    I gave a program containing this editor to a college for comments, and got this feedback.
    Neat!

    1. I'm not sure I understand this... Could you provide me with a screencast or a precise key sequence leading to this bug
    2. It is supposed to "refresh" the search context (see the QDocumentSearch class) but I guess I could remove it and use a couple signals/slots to make sure it (the search context remains up to date)
    3. There should be a tooltip on *all* buttons since the last commit
    4. I'm aware of that and I'll work on a proper fix ASAP
    5. This is a case where the "green button" should prove useful (but a proper signal/slot connection would probably be better... )
    6. About the wrong replacement behavior it will be pretty easy to fix (qdocumentsearch.cpp there is only one call to QMessageBox)
    7. I'll try to reproduce this (and fix it hopefully) ASAP
    Current Qt projects : QCodeEdit, RotiDeCode

  15. #15
    Join Date
    Jun 2007
    Posts
    11
    Thanks
    4
    Qt products
    Qt4
    Platforms
    Unix/X11 Windows

    Default Re: QCodeEdit

    Hi,
    I got problems with variable width fonts - especially "Times New Roman" (I know you dont like Windows (and probably Windows Fonts), so do I, but it would be nice to be portable as much as possible).

    Bug: When I set font to Times New Roman, black vertical lines are appearing between lines.

    (Using svn 379)
    Attached Images Attached Images
    Last edited by allstar; 28th November 2007 at 18:45.

  16. #16
    Join Date
    Jan 2006
    Posts
    371
    Thanks
    14
    Thanked 18 Times in 17 Posts
    Qt products
    Qt4
    Platforms
    Unix/X11 Windows

    Default Re: QCodeEdit

    .. lets hijack this thread to announce a pet project of mine...

    I have been working outside of QDevelop to develop another code editor control. It's not as sofisticated as the one beeing discussed here, but it has it's own ideas and strong points. If you still want to see, please visit: http://code.google.com/p/qtedit4/wiki/QsvEditorBeta
    Attached Images Attached Images

  17. #17
    Join Date
    Jan 2006
    Location
    travelling
    Posts
    1,116
    Thanks
    8
    Thanked 127 Times in 121 Posts
    Qt products
    Qt4
    Platforms
    Unix/X11 Windows

    Default Re: QCodeEdit

    Quote Originally Posted by allstar
    I got problems with variable width fonts - especially "Times New Roman" (I know you dont like Windows (and probably Windows Fonts), so do I, but it would be nice to be portable as much as possible).

    Bug: When I set font to Times New Roman, black vertical lines are appearing between lines.

    (Using svn 379)
    Unfortunately I can't test under windows so it's hard for me to find proper fixes for such graphical glitches... May you send me the font file so that I can at least try with the most problematic font? BTW does the font size affect the glitches? Try changing font size using CTRL+wheel...

    Quote Originally Posted by elcuco View Post
    .. lets hijack this thread to announce a pet project of mine...

    I have been working outside of QDevelop to develop another code editor control. It's not as sofisticated as the one beeing discussed here, but it has it's own ideas and strong points. If you still want to see, please visit: http://code.google.com/p/qtedit4/wiki/QsvEditorBeta
    Rather unkind of you but as the screenshot looks pretty enough and there are a couple of good ideas exposed on the homepage so I may forgive you .
    Among the important differences that you forgot to mention : the document model used is still QTextDocument (unless you changed your mind recently) hence poor performances and the source are vast and complicated to walk through while they do not offer that much more compared to QCodeEdit or QScintilla...
    Current Qt projects : QCodeEdit, RotiDeCode

  18. #18
    Join Date
    Jun 2007
    Posts
    11
    Thanks
    4
    Qt products
    Qt4
    Platforms
    Unix/X11 Windows

    Default Re: QCodeEdit

    Ok, I am sending a video of the bug when using Ctrl+Wheel resizing.....
    It is not only Times New Roman also Arial. Some fonts are doing big mess. Others are OK.
    Bug.avi
    font.zip
    (I am not sure if the format used in linux fonts is the same.)

  19. #19
    Join Date
    Jan 2006
    Location
    travelling
    Posts
    1,116
    Thanks
    8
    Thanked 127 Times in 121 Posts
    Qt products
    Qt4
    Platforms
    Unix/X11 Windows

    Default Re: QCodeEdit

    • Fixed inconsitency of cursor moves when cursor left the displayed area
    • Fixed most (if not all) display glitches caused by variable width fonts
    • Fixed replacement prompt to work as expected
    • Fixed "double find" when searching forward and then backward (or the contrary)
    • Added "auto refresh" of search context : changing the position of the cursor while the panel is visible will now affect the start point of the next search.
    • Improved the speed of pageUp/pageDown by a factor 5 approximately by rewriting the related subroutines (may have fixed some bugs found when using these commands...)

    That's all for now (until you report more bugs )
    Current Qt projects : QCodeEdit, RotiDeCode

  20. The following user says thank you to fullmetalcoder for this useful post:

    allstar (4th December 2007)

  21. #20
    Join Date
    Jun 2007
    Posts
    11
    Thanks
    4
    Qt products
    Qt4
    Platforms
    Unix/X11 Windows

    Default Re: QCodeEdit

    The new version is much better. QCodeEdit is amazing.

    Unfortunately I found another bug: If you select some text and drag it, but NOT moving the mouse cursor from the selection, the text get copied right behind the selected text, when you release the mouse button. AFAIK this is not "normal" behaviour. The text shouldnt get coped when the mouse cursor is i still under the selected text.

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  
Qt is a trademark of The Qt Company.