Results 1 to 20 of 216

Thread: QCodeEdit

Hybrid View

Previous Post Previous Post   Next Post Next Post
  1. #1
    Join Date
    May 2006
    Location
    Germany
    Posts
    108
    Thanks
    2
    Thanked 14 Times in 12 Posts
    Qt products
    Qt4
    Platforms
    Unix/X11 Windows

    Default Re: QCodeEdit

    Hey,

    is there any update on the QCodeEdit / QCodeModel 2 development? :-)

    The framework looked fairly impressive the last time I checked it out.
    "If you lie to the compiler, it will get its revenge." - Henry Spencer

  2. #2
    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 Methedrine View Post
    is there any update on the QCodeEdit / QCodeModel 2 development? :-)

    The framework looked fairly impressive the last time I checked it out.
    There have loads of improvements since I last talked about it here but since I did not get much feedback I stopped reporting progress.... The code is still available through in Edyuk SVN trunk and be tested both independently (a minimal example is provided) and within Edyuk. QCodeModel 2 is fairly mature (try out Edyuk completion... ) and QCodeEdit 2 works pretty well but it will need more testing/polishing before I can release anything (the search functionnalities are quite limited ATM for instance).
    Current Qt projects : QCodeEdit, RotiDeCode

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

    Default Re: QCodeEdit

    This editor looks like it could be very useful to me. In particular I like the ability to extend the syntax highlighting just with XML, as I have a couple of obscure languages I want to support.

    I have it starting up inside my application, but cannot figure out how to make it go to a chosen line number. I need this for locating items in the source when the user clicks on them in my structure view.

    Is this possible?
    I am using the version from Edyuk beta 3.

    Thanks in advance.

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

    Default Re: QCodeEdit

    And another thing...
    Does it work on your machine with a variable width font? Here, unless I go for the default fixed with font, selecting part of a line causes corruption of the text. For example, choose a proportional font, and select a the word in the middle of a line and let me know if the line is still readable for you.

  5. #5
    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
    And another thing...
    Does it work on your machine with a variable width font? Here, unless I go for the default fixed with font, selecting part of a line causes corruption of the text. For example, choose a proportional font, and select a the word in the middle of a line and let me know if the line is still readable for you.
    As it was meant to be a code editor I decided, to make it both simpler to code and faster to run, to restrict the fonts to fixed width... With some slight modifications in a few spots it could be adapted to support variable width fonts but do you really need this???

    As for going to a given line it is extremely simple :
    Qt Code:
    1. // editor being of type QEditor*
    2. editor->setCursor(editor->document()->cursor(line, colum));
    To copy to clipboard, switch view to plain text mode 


    If you want to use bleeding edge QCodeEdit you can get it from Edyuk SVN repository...

    P.S : if you bring support for new languages (or improve the existing ones) please consider sending me the new syntax definition files
    Current Qt projects : QCodeEdit, RotiDeCode

  6. #6
    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
    As it was meant to be a code editor I decided, to make it both simpler to code and faster to run, to restrict the fonts to fixed width... With some slight modifications in a few spots it could be adapted to support variable width fonts but do you really need this???
    I am trying to make this interface as attractive as possible, and would be reluctant to restrict the users choice of fonts so harshly.

    Quote Originally Posted by fullmetalcoder View Post
    As for going to a given line it is extremely simple :
    Qt Code:
    1. // editor being of type QEditor*
    2. editor->setCursor(editor->document()->cursor(line, colum));
    To copy to clipboard, switch view to plain text mode 
    This worked a treat, thanks!

    Quote Originally Posted by fullmetalcoder View Post
    P.S : if you bring support for new languages (or improve the existing ones) please consider sending me the new syntax definition files
    The plan is that the application I am writing will one day be released commercially. So my use of this editor assumes that you are willing to release the code with a commercial license. Obviously you would expect something in return, so we could pay you or contribute all the language templates we create. Do you have a price for commercial use?

  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
    The plan is that the application I am writing will one day be released commercially. So my use of this editor assumes that you are willing to release the code with a commercial license. Obviously you would expect something in return, so we could pay you or contribute all the language templates we create. Do you have a price for commercial use?
    I have nothing against releasing my code under a commercial license and I'm sure we could find an agreement on the "price" (the word is way softer when it's something you get than when you have to pay it ) if it were legally possible... What I mean is simple : I wrote QCodeEdit using Qt Open Source Edition and I'll probably never be able to use a Commercial Edition so I don't know if I am allowed to release my code under a commercial license, even if you DO have a Qt Commercial Edition... I guess we'd need to discuss this with Trolltech...
    Last edited by fullmetalcoder; 21st October 2007 at 16:52. Reason: spelling error
    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 just started creating a new language file, and have a quick question.
    The language I am creating is not case sensitive, i.e. Begin, BEGIN, begin, bEGIN etc are all keywords, indeed all the same keyword.
    Is there some tag I can insert into a .qnfa file to instruct it do case insensitive comparisons?

    Thanks in advance.

  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 just started creating a new language file, and have a quick question.
    The language I am creating is not case sensitive, i.e. Begin, BEGIN, begin, bEGIN etc are all keywords, indeed all the same keyword.
    Is there some tag I can insert into a .qnfa file to instruct it do case insensitive comparisons?
    There's no such tag ATM but I'll add it ASAP... Keep an eye on the SVN...
    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

    Quote Originally Posted by Usability View Post
    And another thing...
    Does it work on your machine with a variable width font? Here, unless I go for the default fixed with font, selecting part of a line causes corruption of the text. For example, choose a proportional font, and select a the word in the middle of a line and let me know if the line is still readable for you.
    Support for variable width font has at last been brought (available in the SVN...)

    Quote Originally Posted by Usability
    The language I am creating is not case sensitive, i.e. Begin, BEGIN, begin, bEGIN etc are all keywords, indeed all the same keyword.
    Is there some tag I can insert into a .qnfa file to instruct it do case insensitive comparisons?
    Done. A new attribute has been added : caseSensitive. It is supported by all tags (except, obviously, by the <embed> one). All element that do not set it inherit the value of their parent and the default value of the root element is "true".BTW, as all boolean attributes it can be set indifferently using "true", "false", "enabled", "disabled", "0" or "1"

    Quote Originally Posted by croftj
    It would be nice if you added the ability to do column based selections with copy/cut and paste like Brief (long long time ago) or CRiSP or SlickEdit (more contemporary).
    I'm thinking about it. I admit it would be extremely nice to have but it's not that easy to implement...
    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

    Cool!

    I confirm I see proportional fonts and the case sensitivity flag works. To save others working back through this thread and dealing with the abbreviated links, here is the svn command to get this.

    Qt Code:
    1. svn checkout http://edyuk.svn.sourceforge.net/svnroot/edyuk/trunk/3rdparty/qcodeedit
    To copy to clipboard, switch view to plain text mode 

    There appear to be a few glitches.

    • On my system, when I use a proportional font, find doesn't work.
    • Also with proportional fonts, the text that is made bold by the syntax highlighting does not increase in character spacing, so gets squashed together.
    • With a fixed width font the find backwards icon (up arrow) behaves strangely. The first reverse find sometimes updates the line number in the status bar, but does not move the cursor at all. Other times it just does nothing.

  12. #12
    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
    • On my system, when I use a proportional font, find doesn't work.
    Well... Quite unsurprisingly it does work for me whatever the font is. However it sometimes isn't triggered when pressing enter from the line edit... That's weird and I'll look into it ASAP

    Quote Originally Posted by Usability View Post
    • Also with proportional fonts, the text that is made bold by the syntax highlighting does not increase in character spacing, so gets squashed together.
    The bold text looked normal to me at first but you're right, spacing could be a little bigger and I'll solve this easily for I know why it happens

    Quote Originally Posted by Usability View Post
    • With a fixed width font the find backwards icon (up arrow) behaves strangely. The first reverse find sometimes updates the line number in the status bar, but does not move the cursor at all. Other times it just does nothing.
    The find backward is known not to work... However I didn't have time to fix it lately. I'll try my best...
    Current Qt projects : QCodeEdit, RotiDeCode

  13. #13
    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
    Well... Quite unsurprisingly it does work for me whatever the font is. However it sometimes isn't triggered when pressing enter from the line edit... That's weird and I'll look into it ASAP
    Your right, the font has nothing to do with it. Find stops working for a while if you search for something thats not in the file, or you repeat the find after the last occurance. Having done this, neither the enter or find forward button work even if you change the search for something that does exist.

    Clicking the reverse find brings it back to life again.

  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
    Your right, the font has nothing to do with it. Find stops working for a while if you search for something thats not in the file, or you repeat the find after the last occurance. Having done this, neither the enter or find forward button work even if you change the search for something that does exist.

    Clicking the reverse find brings it back to life again.
    Find now works as expected:
    • it no longer tries a backward search when asked for a forward one
    • it is now able to perform proper backward searches
    • it now respects boundaries (i.e search within selection)
    • focus is now sent back to the line edit every time a checkbox of the search panel is (un)checked so that pressing enter afterwards triggers search as expected


    BTW I tried to increase spacing for bold fonts by using a proper QFontMetrics object operating on a bold font (instead of the default document font) but it didn't appeared to change much... however as bold characters didn't get squashed on my box it might solve the glitches on yours...
    Current Qt projects : QCodeEdit, RotiDeCode

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

    Default Re: QCodeEdit

    Getting better all the time!
    I confirm find in both directions works now, and that syntax highlighting in bold on proportional fonts is nicely spaced.

    One gremlin I did notice was that if you select some bold text, the background shading breaks up. Its OK if you select a complete line, or if the text isn't bold, its specifically the word selection of bold text that is not working quite right. I attached a snapshot of this below.

    Also I noticed my previous svn command was wrong. Here is the (hopefully) correct version

    Qt Code:
    1. svn checkout http://edyuk.svn.sourceforge.net/svnroot/edyuk/trunk/3rdparty/qcodeedit2
    To copy to clipboard, switch view to plain text mode 
    Attached Images Attached Images

  16. #16
    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
    One gremlin I did notice was that if you select some bold text, the background shading breaks up. Its OK if you select a complete line, or if the text isn't bold, its specifically the word selection of bold text that is not working quite right. I attached a snapshot of this below.
    Side effect of the previous fix... Looks like QFontMetrics behaves differently on Linux and Windows BTW for I did not notice this (could also be my variable width font being more "bold-friendly" ...). Anyway I just fixed it (or so I believe, but I need a confirmation...)
    Current Qt projects : QCodeEdit, RotiDeCode

  17. #17
    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
    Side effect of the previous fix... Looks like QFontMetrics behaves differently on Linux and Windows BTW for I did not notice this (could also be my variable width font being more "bold-friendly" ...). Anyway I just fixed it (or so I believe, but I need a confirmation...)
    Indeed you fixed it, and stunningly quickly too! Thank you.

    You are going to hate me for this, but I found one more....
    When you click on a line that has some bold words to the left of where the mouse cursor was when you clicked, the text cursor is not placed under the mouse cursor. It appears a few characters to the right of where the mouse was.

    If you click on a line with no bold, it works fine. The text cursor is inserted where the mouse cursor was.

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.