Results 1 to 20 of 48

Thread: a Text Editor with line numbers...

Hybrid View

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

    Default Re: a Text Editor with line numbers...

    1) Please, don't reimplement the drawing engine. I am not a native english speaker. My native language is Spanish, but since I live in Israel, my real language is Hebrew - which as you may know already it's a complex script (google for RTL or BIDI).

    If you reimplement the drawing code of the QTextEdit, you will loose any BiDI support in that widget. You will probably mess up Chinese, Hindic, and some other languages which Lars has worked so hard to get in perfect shape.

    The setTabStopWidth() seems to beright way. As you will be able to convert the tab to "spaces" and back. This means you do not mess with the text the use loaded.

    2) Reguarding the SH, I will see if there is a way to set it in a callback or something, otherwise th UI gets frezzed for several seconds when the initial painting is done. I also found no eay to rehighlight the code (what if the user wants to use another highlight...?)

    3) current line = current pararaph in QTextDocument terminology. I want to draw the current line with a different background.

    When the cursor is on "}", that char should be drawed with another background color, and the same for the first "{".

    I assume you support only C/C++/H files right now...?

  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: a Text Editor with line numbers...

    Quote Originally Posted by elcuco
    3) current line = current pararaph in QTextDocument terminology. I want to draw the current line with a different background.
    It's planned but not working right now.

    Quote Originally Posted by elcuco
    When the cursor is on "}", that char should be drawed with another background color, and the same for the first "{".
    Would be quite hard!!!

    Quote Originally Posted by elcuco
    I assume you support only C/C++/H files right now...?
    Entierely true.

    Due to the limitations of my wrapper around QTextEdit I started porting QScintilla to Qt4.
    Pretty long and hard as I never learned Qt3!
    Current Qt projects : QCodeEdit, RotiDeCode

  3. #3
    Join Date
    Jan 2006
    Location
    Winnipeg, MB. Canada
    Posts
    17
    Qt products
    Qt4
    Platforms
    Unix/X11 Windows

    Default Re: a Text Editor with line numbers...

    Quote Originally Posted by fullmetalcoder
    Due to the limitations of my wrapper around QTextEdit I started porting QScintilla to Qt4.
    Yea, i played with porting QScintilla to Qt4. Of course if qt3to4 did all the work, it would be too easy, but there is still tons of hand-massaging you have to do. Porting from scratch using Riverbank's code as a guideline might in the end be the best way to go.

  4. #4
    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: a Text Editor with line numbers...

    Quote Originally Posted by rh
    Yea, i played with porting QScintilla to Qt4. Of course if qt3to4 did all the work, it would be too easy, but there is still tons of hand-massaging you have to do. Porting from scratch using Riverbank's code as a guideline might in the end be the best way to go.
    Where to find Riverbak's code? Would be happy to find an easy way!!!
    Current Qt projects : QCodeEdit, RotiDeCode

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

    Default Re: a Text Editor with line numbers...

    QScintilla does not support anything but Latin1 and thus it's unusable for me and many others.

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

    Angry Re: a Text Editor with line numbers...

    I ported QScintilla by hand from Qt3 to Qt4, it compiled without even one warning.
    I then tried to use it in a very simple program and it linked with no problem, the window appeared...
    but not the cursor
    then tryed to copy from another editor... NO WAY!!! but the context menu displayed...
    then tryed to typoe by hand a few words... NO WAY!!! What the fuck is that???
    I spent 4hours porting something that doesn't work!!!
    Current Qt projects : QCodeEdit, RotiDeCode

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

    Default Re: a Text Editor with line numbers...

    Quote Originally Posted by fullmetalcoder
    I ported QScintilla by hand from Qt3 to Qt4, it compiled without even one warning.
    I then tried to use it in a very simple program and it linked with no problem, the window appeared...
    but not the cursor
    then tryed to copy from another editor... NO WAY!!! but the context menu displayed...
    then tryed to typoe by hand a few words... NO WAY!!! What the fuck is that???
    I spent 4hours porting something that doesn't work!!!
    release the code or shut up...

    at last for the first editor!

  8. #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: a Text Editor with line numbers...

    which code??? buggy QScintilla or working QTextEdit???

    QTextEdit based now highlight current line in cyan but there's still a twist:
    no simple way to make it highlight the whole line, as in Dev-C++ for example.
    any ideas on how to do that?

    cheers
    Current Qt projects : QCodeEdit, RotiDeCode

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

    Default Re: a Text Editor with line numbers...

    I would like to see a code based on QTextEdit, because of the reasons I explained before. But that's me

  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: a Text Editor with line numbers...

    I should be able to post it tomorrow.

    No solutions comes to me about current line colouring but I implemented the basis of a breakpoint management system.

    Seems to progress!!!
    Current Qt projects : QCodeEdit, RotiDeCode

  11. #11
    Join Date
    Jan 2006
    Location
    Winnipeg, MB. Canada
    Posts
    17
    Qt products
    Qt4
    Platforms
    Unix/X11 Windows

    Default Re: a Text Editor with line numbers...

    If you want to see more information on scintilla implementations, you may want to check out:

    http://www.codeproject.com

    and search for "scintilla". Of course these will be implemented with MFC or in C#, but you might get some ideas.

    P.S. CodeProject's search isn't very good; you'll get more hits googling the CodeProject site.
    Plan? There ain't no plan!

  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: a Text Editor with line numbers...

    sorry rh but I don't think porting QScintilla would be a good way to reach my goal.

    Elcuco, it's your turn to shut up! Have a look at the code and think before giving feedbacks...
    Last edited by fullmetalcoder; 27th January 2006 at 13:19.
    Current Qt projects : QCodeEdit, RotiDeCode

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

    Talking Re: a Text Editor with line numbers...

    Quote Originally Posted by fullmetalcoder
    I should be able to post it tomorrow.

    No solutions comes to me about current line colouring but I implemented the basis of a breakpoint management system.

    Seems to progress!!!
    Original message said:
    You said tomorrow on the 22, now it's 24.

    SHOW ME THE MONEY!
    SHOW ME THE MONEY!
    SHOW ME THE MONEY!

    Now I do see the code...
    comments tomrrow... /me shuts up now.
    Last edited by elcuco; 24th January 2006 at 21:21.

  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

    Cool Re: a Text Editor with line numbers...

    Quote Originally Posted by elcuco
    Original message said:
    You said tomorrow on the 22, now it's 24.

    SHOW ME THE MONEY!
    SHOW ME THE MONEY!
    SHOW ME THE MONEY!

    Now I do see the code...
    comments tomrrow... /me shuts up now.
    Who's the best ???
    Just kidding!

    Ok implementation is not that perfect!
    a corrected version is coming soon!
    Current Qt projects : QCodeEdit, RotiDeCode

  15. #15
    Join Date
    Jan 2006
    Location
    Minsk, Brest, Belarus
    Posts
    54
    Thanks
    3
    Thanked 3 Times in 3 Posts
    Qt products
    Qt3 Qt4
    Platforms
    Unix/X11 Windows

    Question Re: a Text Editor with line numbers...

    Quote Originally Posted by fullmetalcoder
    I should be able to post it tomorrow.

    No solutions comes to me about current line colouring but I implemented the basis of a breakpoint management system.

    Seems to progress!!!
    Hi! And where is the code?
    All of us want to have a look at it...
    Thanks.

  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

    Talking Re: a Text Editor with line numbers...

    Quote Originally Posted by Xagen
    Hi! And where is the code?
    All of us want to have a look at it...
    Thanks.
    There was a twist in the copyright notice so I removed all zip files yesterday.

    I used this time to :
    - fix highlighting (handles floats and comments after a preprocessor)
    - fix find & replace
    - add a built-in loading/saving API
    - add a print function
    - add both of these to context menu

    But current line highlighting (and breakpoints/errors as well) is still ugly!!!
    No way making it kepp coloring after last character!!!!

    Have fun and please give feedback (and hints about background coloring) !!!
    Last edited by fullmetalcoder; 10th February 2006 at 15:41.
    Current Qt projects : QCodeEdit, RotiDeCode

  17. #17
    Join Date
    Jan 2006
    Posts
    30
    Thanks
    3
    Thanked 1 Time in 1 Post
    Qt products
    Qt3 Qt4
    Platforms
    Unix/X11 Windows

    Default Re: a Text Editor with line numbers...

    QTextEdit was not really designed to be an editor. The best thing to do to make a good editor is make one from scratch using parts of Qt's code as a baseline That's what I am doing currently

Similar Threads

  1. Unhandled exception in qatomic
    By NewGuy in forum Qt Programming
    Replies: 14
    Last Post: 23rd July 2013, 09:49
  2. QTcpSocket exception.
    By Fastman in forum Qt Programming
    Replies: 9
    Last Post: 29th January 2008, 13:51
  3. Qwizard crashed when created in a slot
    By joshlareau in forum Qt Programming
    Replies: 9
    Last Post: 15th January 2008, 09:16
  4. KDE/QWT doubt on debian sarge
    By hildebrand in forum KDE Forum
    Replies: 13
    Last Post: 25th April 2007, 06:13
  5. QTableView paints too much
    By Jimmy2775 in forum Qt Programming
    Replies: 2
    Last Post: 26th July 2006, 18:42

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.