Results 1 to 7 of 7

Thread: How can I implement a text editor which display it's contents from top to bottom?

Hybrid View

Previous Post Previous Post   Next Post Next Post
  1. #1
    Join Date
    Feb 2006
    Location
    Oslo, Norway
    Posts
    6,264
    Thanks
    36
    Thanked 1,519 Times in 1,389 Posts
    Qt products
    Qt4
    Platforms
    MacOS X Unix/X11 Windows Symbian S60 Maemo/MeeGo

    Default Re: How can I implement a text editor which display it's contents from top to bottom?

    J-P Nurmi

  2. The following user says thank you to jpn for this useful post:

    cslijy (26th November 2007)

  3. #2
    Join Date
    Nov 2007
    Posts
    8
    Thanks
    3
    Qt products
    Qt4
    Platforms
    Windows

    Question Re: How can I implement a text editor which display it's contents from top to bottom?

    Quote Originally Posted by jpn View Post

    I rotate the item,but the secord line appeared on left of first line.How can I make the secorn line displayed on right of the first line?

  4. #3
    Join Date
    Feb 2006
    Location
    Oslo, Norway
    Posts
    6,264
    Thanks
    36
    Thanked 1,519 Times in 1,389 Posts
    Qt products
    Qt4
    Platforms
    MacOS X Unix/X11 Windows Symbian S60 Maemo/MeeGo

    Default Re: How can I implement a text editor which display it's contents from top to bottom?

    Man, that's weird requirement. Perhaps you could lay the text by hand with help of QTextLayout.
    J-P Nurmi

  5. #4
    Join Date
    Nov 2007
    Posts
    8
    Thanks
    3
    Qt products
    Qt4
    Platforms
    Windows

    Question Re: How can I implement a text editor which display it's contents from top to bottom?

    Quote Originally Posted by jpn View Post
    Perhaps you could lay the text by hand with help of QTextLayout.


    I tried QTextLayout and got the right alignment.But the Item does not display when I am typing.As soon as I press Enter,the Item displays the line that I just input at one moment.And the textcursor does not flash.I guess it may be the item refresh region is not my layout region.Can you give me some advise?

    Qt Code:
    1. //Here is some code in paint
    2. textLayout.beginLayout();
    3. while (1) {
    4. QTextLine line = textLayout.createLine();
    5. if (!line.isValid())
    6. break;
    7. line.setLineWidth(200);
    8. line.setPosition(QPoint(0,height));
    9. height += (int) line.height();
    10. }
    11. myheight+=height;
    12. textLayout.endLayout();
    13. textLayout.draw(painter,QPointF(0,myheight));
    To copy to clipboard, switch view to plain text mode 
    Last edited by jpn; 9th January 2008 at 15:50.

  6. #5
    Join Date
    Feb 2006
    Location
    Oslo, Norway
    Posts
    6,264
    Thanks
    36
    Thanked 1,519 Times in 1,389 Posts
    Qt products
    Qt4
    Platforms
    MacOS X Unix/X11 Windows Symbian S60 Maemo/MeeGo

    Default Re: How can I implement a text editor which display it's contents from top to bottom?

    You'll need to do the blinking cursor yourself with help of a timer.
    J-P Nurmi

Similar Threads

  1. Unhandled exception in qatomic
    By NewGuy in forum Qt Programming
    Replies: 14
    Last Post: 23rd July 2013, 09:49

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.