Results 1 to 20 of 216

Thread: QCodeEdit

Hybrid View

Previous Post Previous Post   Next Post Next Post
  1. #1
    Join Date
    Nov 2006
    Posts
    35
    Thanks
    25
    Qt products
    Qt4
    Platforms
    Unix/X11 Windows

    Default Re: QCodeEdit

    Quote Originally Posted by fullmetalcoder View Post
    QCodeEdit is a componnent and when released as is it contains a pro file to compile it as a static or shared lib.
    This may be OT here, but with my simple extended QTextEdit (only line-number-gutter) I had problems to get it working as a static library. I could get it to work as a shared library (plugin for Qt Designer) or by simply adding all files to the source an header variable in the *.pro and using "promote to custom widget".

    I already searched the forums here, but did not find any usefull hints. I only changed the plugin pro file and added the static keyword there. Do I have to change anything else to get this to work? Maybe I can send you my test sources?

    Another problem I had was acessing member objects of my custom TextEdit (i.e. the Gutter). I always had to include the header (ok) but also add the *.h and *.cpp to the project sources & headers when using as a plugin. Is there a way to only use the library and the *.h files? Because if not the plugin makes no sense to me as I could use it directly by including all files.

    Quote Originally Posted by fullmetalcoder View Post
    If you want to start playing with QCodeEdit I really recommend to use the iclude() function at first because it will spare you the pain of compiling an lib and then linking your app to it... However if you need a sample pro file to build and install QCodeEdit as a regular lib on your system : just ask me, I'll craft you one in a few minutes...
    Could you provide me a samle project please?


    Quote Originally Posted by fullmetalcoder View Post
    I don't quite understand your last sentence...
    In the Kate syntax definition you define some sort of a statemachine. There is a start context and rules that can stay or change the context. Then you are able to push and pop the current context while changing it. An example is given here: http://docs.kde.org/stable/en/kdebas...ml-format.html

    Thanks in advance,
    -Jens

  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 No-Nonsense View Post
    Could you provide me a samle project please?
    Sure! But I need an e-mail address...

    Quote Originally Posted by No-Nonsense View Post
    In the Kate syntax definition you define some sort of a statemachine. There is a start context and rules that can stay or change the context. Then you are able to push and pop the current context while changing it. An example is given here: http://docs.kde.org/stable/en/kdebas...ml-format.html
    The Kate syntax engine sounds nice and as far as I've played with it, decently fast... However the problem I have is simple : time... Unless their implementation is small enough and can easily be ported to Qt4/QCodeEdit I won't try to use their definition format because I'm quite busy ATM...
    Current Qt projects : QCodeEdit, RotiDeCode

  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

    Here comes the fun! I finally took a few minutes to package the last source of QcodeEdit and released them as QCodeEdit 1.0 on Edyuk's Sf.net donwload server.

    Hoping this will help those who need a ready-made editing framework and motivate those asking for a new syntax engine...
    Current Qt projects : QCodeEdit, RotiDeCode

  4. #4
    Join Date
    Feb 2007
    Location
    Philadelphia, USA
    Posts
    255
    Thanks
    43
    Thanked 21 Times in 21 Posts
    Qt products
    Qt4
    Platforms
    Unix/X11

    Default Re: QCodeEdit

    Looking forward to trying it out...

    Had some trouble compiling. The readme.txt is confusing, because there are three .pro files in the main directory of distribution.

    ... so I tried
    >> qmake qcodeedit.pro
    >> make

    But this sent me into a recursive situation ??
    qmake -win32 -o Makefile qcodeedit.pro
    qmake -win32 -o Makefile qcodeedit.pro
    qmake -win32 -o Makefile qcodeedit.pro
    qmake -win32 -o Makefile qcodeedit.pro
    qmake -win32 -o Makefile qcodeedit.pro
    qmake -win32 -o Makefile qcodeedit.pro
    ....

    I'm using Windows with MinGW
    Help?

  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 magland View Post
    Looking forward to trying it out...
    I'm using Windows with MinGW
    Help?
    Apologies... I made a shell script but no batch equivalent... Anyway it shouldn't be to hard... Just copy makeall.sh as makeall.bat, open it as text and remove the first line (you may also need to replace every occurence of "make" by "mingw32-make") and everything should be fine.
    Current Qt projects : QCodeEdit, RotiDeCode

  6. #6
    Join Date
    Feb 2007
    Location
    Philadelphia, USA
    Posts
    255
    Thanks
    43
    Thanked 21 Times in 21 Posts
    Qt products
    Qt4
    Platforms
    Unix/X11

    Default Re: QCodeEdit

    Thanks, the library seemed to compile, but now I'm having trouble compiling example.pro. I get the following error. Any advice?

    tmp\obj\main.o(.text+0x171): In function `Z5qMainiPPc':
    C:/cstuff/qcodeedit-1.0/main.cpp:26: undefined reference to `QPlainTextEditCreat
    or::id()'
    tmp\obj\main.o(.text+0x192):C:/cstuff/qcodeedit-1.0/main.cpp:26: undefined refer
    ence to `QFoldPanelCreator::id()'
    tmp\obj\main.o(.text+0x1b3):C:/cstuff/qcodeedit-1.0/main.cpp:26: undefined refer
    ence to `QLineNumberPanelCreator::id()'
    tmp\obj\main.o(.text+0x1d4):C:/cstuff/qcodeedit-1.0/main.cpp:26: undefined refer
    ence to `QLineMarkPanelCreator::id()'
    collect2: ld returned 1 exit status
    mingw32-make[1]: *** [release\example.exe] Error 1
    mingw32-make[1]: Leaving directory `C:/cstuff/qcodeedit-1.0'
    mingw32-make: *** [release] Error 2

  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

    Whoops... I almost forgot how stupid Window$ is since I have moved to Linux...

    The problem is that some classes need explicit export so the linking to a shared lib fails. You can either fall back to the standalone program (standalone.pro) or set the library to compile as static (the first option is the best because you are likely to face the opposite problem with the second one... i.e. explicit shared import from a static lib...)

    A third option would be to patch files by hand :

    in src/defs.h :
    replace : class c##Creator : public Q##t##Creator \
    by : class Q_API c##Creator : public Q##t##Creator \
    Current Qt projects : QCodeEdit, RotiDeCode

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

    No-Nonsense (21st February 2007)

  9. #8
    Join Date
    Mar 2006
    Posts
    8
    Thanks
    1
    Thanked 3 Times in 2 Posts
    Qt products
    Qt4
    Platforms
    Unix/X11 Windows

    Default Re: QCodeEdit

    Thaks a lot for your library! The idea is very good, you made a very important and common used component

    Libary
    I build QCodeEdit on Win with Qt 4.2.2, but project need some small changes to be compiled

    1. qmargin.h should be included in qeditor.h
    #include "qmargin.h"

    2. qlanguagefactory.h line 61
    void setLanguage(QCodeEdit *e, QLanguageDefinition *d, QCompletionEngine *e);
    here was the redefinition of variable.'e'
    btw, variable names like a,b,c,d is a bad style

    Eample project.
    1. Makefiles for example, generated by qmake, should be edited a bit.
    To compile axample I added a full path to qcodeedit.lib to Makefiles.

    2. Then Q_ID in main.cpp statement
    def << Q_ID(QLineMarkPanel)
    << Q_ID(QLineNumberPanel)
    << Q_ID(QFoldPanel)
    << Q_ID(QPlainTextEdit);
    does not work properly and generate 4 unresolved externals for functions like QLineMarkPanelCreator, QFoldPanelCreator and so on.
    Btw macros are evil, a bad, unclear programming way.

    3. To resolve externals file #include "qeditorfactory.h" should be included i n main.cpp

    4. But file qeditorfactory.h sontains to links to
    #include "edyuk.h"
    #include "qsettingsclient.h"
    These are not present in the project at all. This comes us to lots of errors.

    Thus example can not be compiled unfortunately and it remains unclear what this QCodeEdit does.
    Good library but useless, because nobody, except author, knows how to use it
    Last edited by mikhailt; 9th March 2007 at 14:07.

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

    Default Re: QCodeEdit

    I have tested this library today. Here are my toughts:

    1. The instructions for building are wrong. The instructions for building the project says to run qmake; make. The project is buildable using the makeall.sh scripts. Note that you also point to the documentation, but it's not shiped, and you do not explain how to create it.
    2. No Doxyfile available. There is not Doxyfile (or something similar) on the project, which makes it impossible to create the documentation. I have to build a Doxyfile myself. I can also note that the documentatino tries to be very detailed but it fails, and many things (for example the XLD specifications) are just not done.
    3. The build system is not smart. Using a subdirs project and keeping a single Makefile per directory, will be smarter. Porting the demo/librabry to other build systems might be also a good idea.
    4. Some files on the tarball are +X. For example LGPL.txt. Nothing important.
    5. The some subdirectories contain a .svn directory. Which means the tarball is not really clean, see (4) as well. Nothing important.
    6. The language defintions, are not done in a smart way. For example, there is not separation of language definitions and dispplay: the colors and fonts are embbeded into the language definitions, what if I don't want keywords to be hightlighted? Also, the hightlight/keyword/words list is definetly a bad idea. The word list is saved as a single string instead of a list of nodes, which means that the library needs to load that node and then re-parse it. Also, the doxygen implementation is not optimal, as it only takes into account words, and is not aware of contents. While we are talking about doxygen, the c++ and python share the same doxygen definitions, which means that I hoped that both syntaxes would include the doxygen domain. Instead, you have 3 implementations of doxygen: in cpp.xld, python.xld and dox.xld.
    7. Using popups for search, is not a good idea. Modern applications should use something similar to vim/Firefox search. And besides, the search was not triggere on my box by the ctfl+f shortcut. Actually, even after I choosed it from the pop-up menu, it did not find the word "include" in a cpp file.
    8. When I run the application, is uses 100% cpu, and 50% for X, even at idle states. The library needs a little more fine tunning, otherwise it is just not usable.
    9. The license is not clear. The text says "You may use, distribute and copy QCodeEdit binaries under the terms of GNU Library General Public License (LGPL) version 2", and then "QCodeEdit sources are considered as part of Edyuk and thus GNU General Public License (GPL) version 2". Note also that LGPL and GPL talk generally about source code and not binaries. What are my rights regarding the library?
    10. The code is not FreeSoftware. At the top of GPL.txt you add new restrictions to the GPL, which is is not permitted by the GPL. Look at point (6) of the GPL.
    11. I could not make the completion work.

  11. #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

    @ mikhailt :

    I don't like macros myself but I didn't find any other way to achieve editor modularization... Besides if the example did not build it is most likely due not using the build script (but I should have made this clearer and provided a window equivalent... ). FYI information the QEditorFactory is a convinience class that's not fully part of the QCodeEdit library because of its dependency on Edyuk. However I left it here because it can always be ported to any other app just by replacing (or removing) the exporting macros and implement another settings handling. I might take time to remove these dependencies later on while keeping all QEditorFactory's functionalities but I've not much time now...

    @ elcuco :

    1,2,3,4,5 : Whoops... You're right once again... Got to correct this.
    6 : I've explained already why definitions are what they are currently. I probably won't have time to change that before a long time but after having a look at the generic components that are bundled (and handle the XLD files) one, especially you , should be able to build proper interfaces to support Kate (or any other) syntax definitions.
    7 : that's your opinion but I assume I should just provide default search/replace widget of both type...
    8 : Well, whe I use QCodeEdit, even from Edyuk, I never face such a situation except maybe on loading of big files but at least the UI doesn't freeze...
    9 : Not clear? Well I think it would be... There are basically two cases :
    • One embeds QCodeEdit into an app or modify it and thus MUST release its work under GPL
    • One just links to an UNMODIFIED version of QCodeEdit and undergo no restrictions apart from these stated by the LGPL (which are not very tough, are they?)
    10 : Someone told me this already but I forgot to modify the files...
    11 : the completion is not build-in... There is just a ready framework that only needs a proper QCompletionEngine to be implemented and registered by the app. It seemed to me that it would be impossible to implement an efficient completion in a generic way so I only kept the raw C++ interface.

    I will try to issue a fixed version of QCodeEdit ASAP taking all your remarks into account but please remember that I'm rather busy ATM.
    Current Qt projects : QCodeEdit, RotiDeCode

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

    Smile Re: QCodeEdit

    Good news from the front line!

    After a cleanup of Edyuk's SVN trunk the latest sources of QCodeEdit are now available directly from SVN with bundled examples and proper project files :

    $ svn checkout http://edyuk.svn.sourceforge.net/svn...arty/qcodeedit qcodeedit

    I'm working on a new spec for generic highlighting definitions which should be much more flexible and fix most (if not all) issues reported here.
    Current Qt projects : QCodeEdit, RotiDeCode

  13. The following 2 users say thank you to fullmetalcoder for this useful post:

    mikhailt (23rd March 2007), zfq7112 (25th July 2007)

  14. #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

    The new version of QCodeEdit bringing a new approach on generic definitions is now available. The spec has evolved a lot :
    • Each syntax element is represented by an "entity", which can be of various type
    • Entity have a name which correspond to the tag name of an XML element
    • There are no built-in entities... Entities implementation (actually they are private components) are loaded from plugins
    • The syntactic rules and formatting data are now split into two XML files
    • Formats can be inherited. i.e if an entity do not specify a format key it automatically grabs one from its first parent that supply one.
    The entities are of two types. "Primitives" which, just like in gfx, are small elements that perform "real" tasks and "complex" which combines several "primitives" according to predefined rules.

    Available "primitive" standards entities are :
    • Sequence entity (<sequence> tag) : match a character sequence
    • Word entity (<word> tag) : match a word i.e. a sequence of word characters delimited by non words characters
    • Special entity (<special> tag) : match a special character (e.g an end-of-line)
    Available "primitive" standards entities are :
    • Context entity (<context> tag) : the most interesting one. match a start entity (if any specified) then processes children until a stop entity (if any) is matched. Supports two other handy special children : escape and jump. The first one should be self explanatory. The second corresponds to an entity that MUST be matched in order to span over several lines if stop entity is valid but did not match in the current line.
    • List entity (<list> tag) : a list of entities among which one must match (i.e it's basically a convinient OR). In addition it supports prefix and suffix which may or may not be mandatory
    Along with these (already sufficient to craft a syntax definition for most (if not all) existing programming languages) come another that can't be classified easily :
    • Href entity (<href> tag) : all entities can have an id attribute and this entity allow reducing code duplication by referencing an existing entity through its id. For more flexibility the href can be resolved either on build or on first call to one of its method or every time a method is called.
    The code available on SVN already handle highlighting very well but do not yet perform any of the other generic tasks (parenthesis matching, text indenting and code folding) thus, due to some internal dependencies, completion is no longer working but don't worry... it'll come back soon (maybe next monday if I find enough time to hack it back )

    Note : the plugin system used by QCodeEdit generic components is very flexible and light-weight. For convinience I did not put it directly inside QCodeEdit but as another Edyuk 3rdparty module. You can grab it this way :
    $ svn checkout http://edyuk.svn.sourceforge.net/svn.../qpluginsystem qpluginsystem
    Also note that for compilation to succeed, qpluginsystem and qcodeedit dirs grabbed from SVN must be at the same level i.e. a dir tree might look like this :
    prog
    |-- qcodeedit
    |-- qpluginsystem
    |-- etc..
    Current Qt projects : QCodeEdit, RotiDeCode

  15. #13
    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

    QCodeEdit 2 is on the road!

    This new version bring speed and lower memory usage by dropping QTextDocument. Yet, it keeps most (if not all) it non-rich-text-related features (i.e. bidi rendering, smart cursors, ...). This is achieved by mixing a homemade rendering and QTextLayout, the latter being summoned only when really needed which helps preserving the performance and memory gains for anyone who don't need such fancy features (are there much coders that write anything but english in their sources anyway???).

    Other important progress have been made since my last report here :
    • the panel system evolved quite a lot and those enjoying the firefox-like search panels should be happy enough
    • the highlighting engine also evolved a great deal. The use of NFAs, discussed in another thread, made it way faster than it ever had been and also a lot more flexible
    • the API become simpler and the code lighter

    The code is available, through SVN, here : https://edyuk.svn.sf.net/svnroot/edy...ty/qcodeedit2/

    I'd be glad to get as much feedback as possible to improve it and make it a solid codebase for text editing applications. Feedback about bidi handling would be especially valued since I can't really know how good it is being an evil Westerner which only uses Latin-1 charset.
    Current Qt projects : QCodeEdit, RotiDeCode

  16. #14
    Join Date
    Jul 2010
    Posts
    6
    Thanks
    1
    Qt products
    Qt4
    Platforms
    Windows

    Default Re: QCodeEdit

    Comment, but's not qt lib

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.