Results 1 to 3 of 3

Thread: How can I make the cursor flash?

Threaded View

Previous Post Previous Post   Next Post Next Post
  1. #1
    Join Date
    Nov 2007
    Posts
    8
    Thanks
    3
    Qt products
    Qt4
    Platforms
    Windows

    Default How can I make the cursor flash?

    I paint a cursor in my textedit ,but it not flash,how can i make the cursor flash?


    Qt Code:
    1. void MYTextEdit:: paintEvent(QPaintEvent *event)
    2. {
    3. QPainter p(viewport());
    4. QTextLayout textLayout(document()->toPlainText());
    5. QPointF t(100,100);
    6.  
    7. int leading = fm.leading();
    8. int height = 0;
    9. qreal widthUsed = 0;
    10. textLayout.beginLayout();
    11. while (1) {
    12. QTextLine line = textLayout.createLine();
    13. if (!line.isValid())
    14. break;
    15.  
    16. line.setLineWidth(200);
    17. height += leading;
    18. line.setPosition(QPoint(0, height));
    19. height += (int) line.height();
    20. widthUsed = qMax(widthUsed, line.naturalTextWidth());
    21. textLayout.drawCursor(&p,t,2,3);
    22. }
    23. }
    To copy to clipboard, switch view to plain text mode 
    Last edited by jpn; 31st December 2007 at 05:31. Reason: missing [code] tags

Similar Threads

  1. QT4 for kde 4 beta 2 configure problem: make not found
    By marcomangiante in forum Installation and Deployment
    Replies: 1
    Last Post: 5th September 2007, 20:35
  2. Window OS make distclean && qmake && make one line
    By patrik08 in forum General Programming
    Replies: 4
    Last Post: 22nd March 2007, 10:43
  3. Compiling with Qmake/Make
    By VireX in forum Newbie
    Replies: 25
    Last Post: 22nd February 2007, 05:57
  4. Replies: 3
    Last Post: 19th October 2006, 22:13
  5. Qt4.1.4 make errors.
    By impeteperry in forum Installation and Deployment
    Replies: 11
    Last Post: 1st July 2006, 17:27

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.