Results 1 to 3 of 3

Thread: An Editor for source view - help

  1. #1
    Join Date
    Oct 2007
    Posts
    14
    Thanks
    2
    Qt products
    Qt4
    Platforms
    Unix/X11 Windows

    Question An Editor for source view - help

    hi,

    I'm a newbie to Qt stuff. Currently I'm developing an application which displayes the source [i.e. code snippet from source files] code, within is its workspace, when triggered. I wanted to know, which class would be better to use for this purpose. I'm thinking of utilizing QTextEdit. But I'm also interested in showing the source code with proper indentation and, if possible, with stylised color display, like that of Linux Console/Vi editor. is that possible with QTextEdit? How?. Basically a simple source viewer editor app.
    oh, btw, I'm using Qt 3.3, and I'm not to upgrade to Qt 4.x, because rest of the code is in Qt 3.3, with which I'll have to cope.
    I'd really appreciate, if any of you will guide me in this regard or will point me to the right material/examples on this topic.

    Thanks for spending time.

  2. #2
    Join Date
    Oct 2008
    Posts
    70
    Thanks
    1
    Thanked 9 Times in 9 Posts

    Default Re: An Editor for source view - help

    You can use QSyntaxHighlighter for that.

  3. #3
    Join Date
    Oct 2007
    Posts
    14
    Thanks
    2
    Qt products
    Qt4
    Platforms
    Unix/X11 Windows

    Default Re: An Editor for source view - help

    Thank you pastor for that valuable suggestion.
    I'll surely look into it.


    I've another problem, though. I'm intending to put the cursor, on opening of the source code in the editor, at a particular line number, in order to point out the function call or function name or variable declaration, which is the intention of showing up of source code [ since user would be directed to the point in the source code where he is interested in, when source code is displayed].
    With the help of setCursorPosition() I'm able to move my cursor to a particular line number I wish to highlight. But I'm unable to place the cursor 'at' the real code, since it gets placed at the first index or 0th column[ for example, in case of indentation the code line would be tabbed from the first column, so the cursor will be at the start of the line and not at the start of the code!]

    I'd really appreciate if anyone of you'll guide me and help me in this matter.

    Thanks for spending the time.

Similar Threads

  1. World View Zooming factor
    By Pharell in forum General Programming
    Replies: 0
    Last Post: 6th November 2008, 13:04
  2. View, Scene, Item and thread??
    By dungsivn in forum Qt Programming
    Replies: 5
    Last Post: 20th August 2008, 19:21
  3. Model, View and Proxy
    By No-Nonsense in forum Qt Programming
    Replies: 2
    Last Post: 21st November 2006, 08:50
  4. Model - View Programming doubt.
    By munna in forum Qt Programming
    Replies: 4
    Last Post: 28th April 2006, 13:01
  5. Replies: 6
    Last Post: 20th April 2006, 10:23

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
  •  
Digia, Qt and their respective logos are trademarks of Digia Plc in Finland and/or other countries worldwide.