Results 1 to 20 of 216

Thread: QCodeEdit

Hybrid View

Previous Post Previous Post   Next Post Next Post
  1. #1
    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

  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

    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

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

    No-Nonsense (21st February 2007)

  4. #3
    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.

  5. #4
    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.

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

    @ 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

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

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

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

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

    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

  10. #8
    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

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

    After having a quick glance at QCodeEdit 2, elcuco urged me to do some benchmarks since I claimed my newborn to be MUCH better than QTextDocument, QTextEdit and co.

    Even without considering everything what comes build in in QCodeEdit (line numbers, line marks, folding, generic highlighting definition, foundations for completion, ...) and lacks in the concurrent, these results should be enough to assert the advantage of using QCodeEdit (or at least something that does not rely on QTextDocument ).

    Notes :
    • The archive holds a spreadsheet which sums up the benchmarks result but also the benchmarks output files from which it has been filled...
    • The full code for the benchmarking tool and the files used to benchmark are available in the "benchmark" subdir of the SVN repository mentioned in my previous post
    Current Qt projects : QCodeEdit, RotiDeCode

  12. #10
    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

    Looks promising... When will QCodeEdit 2 be available for use? I tried downloading from svn using below address but was unable to connect.

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

    Default Re: QCodeEdit

    Quote Originally Posted by magland View Post
    I tried downloading from svn using below address but was unable to connect.
    You can't "download" from SVN but, provided you have a Subversion client installed, you can "checkout" the content of a repository... The code is already available through SVN but no package will be issued before at least a week...
    Current Qt projects : QCodeEdit, RotiDeCode

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

    I have a little trouble getting QCodeEdit2 to compile on Ubuntu Feisty, see this log:
    daehlith@nurse:~/projects/edyuk/edyuk/trunk/3rdparty/qcodeedit2$ qmake -v
    QMake version 2.01a
    Using Qt version 4.3.0 in /usr/lib
    daehlith@nurse:~/projects/edyuk/edyuk/trunk/3rdparty/qcodeedit2$ qmake
    daehlith@nurse:~/projects/edyuk/edyuk/trunk/3rdparty/qcodeedit2$ make
    cd lib/ && make -f Makefile
    make[1]: Betrete Verzeichnis '/home/daehlith/projects/edyuk/edyuk/trunk/3rdparty/qcodeedit2/lib'
    g++ -c -pipe -g -Wall -W -D_REENTRANT -fPIC -DQNFA_BUILD -DQT_XML_LIB -DQT_GUI_LIB -DQT_CORE_LIB -I/usr/share/qt4/mkspecs/linux-g++ -I. -I/usr/include/qt4/QtCore -I/usr/include/qt4/QtCore -I/usr/include/qt4/QtGui -I/usr/include/qt4/QtGui -I/usr/include/qt4/QtXml -I/usr/include/qt4/QtXml -I/usr/include/qt4 -I. -Idocument -Ilanguage -Iwidgets -Iqxs -Iqnfa -I../../qpluginsystem -I.build -I.build -o .build/qsearchreplacepanel.o widgets/qsearchreplacepanel.cpp
    .build/ui_searchreplace.h: In member function »void Ui_SearchReplace::setupUi(QWidget*)«:
    .build/ui_searchreplace.h:56: Fehler: »class QVBoxLayout« hat kein Element namens »setLeftMargin«
    .build/ui_searchreplace.h:57: Fehler: »class QVBoxLayout« hat kein Element namens »setTopMargin«
    .build/ui_searchreplace.h:58: Fehler: »class QVBoxLayout« hat kein Element namens »setRightMargin«
    .build/ui_searchreplace.h:59: Fehler: »class QVBoxLayout« hat kein Element namens »setBottomMargin«
    .build/ui_searchreplace.h:73: Fehler: »class QHBoxLayout« hat kein Element namens »setLeftMargin«
    .build/ui_searchreplace.h:74: Fehler: »class QHBoxLayout« hat kein Element namens »setTopMargin«
    .build/ui_searchreplace.h:75: Fehler: »class QHBoxLayout« hat kein Element namens »setRightMargin«
    .build/ui_searchreplace.h:76: Fehler: »class QHBoxLayout« hat kein Element namens »setBottomMargin«
    .build/ui_searchreplace.h:169: Fehler: »class QHBoxLayout« hat kein Element namens »setLeftMargin«
    .build/ui_searchreplace.h:170: Fehler: »class QHBoxLayout« hat kein Element namens »setTopMargin«
    .build/ui_searchreplace.h:171: Fehler: »class QHBoxLayout« hat kein Element namens »setRightMargin«
    .build/ui_searchreplace.h:172: Fehler: »class QHBoxLayout« hat kein Element namens »setBottomMargin«
    make[1]: *** [.build/qsearchreplacepanel.o] Fehler 1
    make[1]: Verlasse Verzeichnis '/home/daehlith/projects/edyuk/edyuk/trunk/3rdparty/qcodeedit2/lib'
    make: *** [sub-lib-make_default] Fehler 2
    daehlith@nurse:~/projects/edyuk/edyuk/trunk/3rdparty/qcodeedit2$
    Sorry that these error message are german, but its just the compiler complaining about missing functions. Solution?
    Last edited by jacek; 30th July 2007 at 21:47. Reason: changed [code] to [quote]
    "If you lie to the compiler, it will get its revenge." - Henry Spencer

  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

    Quote Originally Posted by Methedrine View Post
    Sorry that these error message are german, but its just the compiler complaining about missing functions. Solution?
    This has been discussed in Edyuk thread already : Qt Designer from Qt 4.3.0 generates ui files that uic from Qt 4.2 can not turn into proper code since margin managements of layout has changed... There are several ways to get rid of this :
    • switch to Qt 4.3.0 (obvious but not always affordable)
    • modify ui files (either by hand or, possibly, through designer from Qt 4.2) to replace new properties by old, backward compatible ones
    • wait for the Trolls to fix this (I've submitted a bug report, just wait and see...)
    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.