Results 1 to 2 of 2

Thread: Draw a line

  1. #1
    Join Date
    Aug 2009
    Posts
    1

    Question Draw a line

    I try to draw a line using the following code:

    bool ok;
    QPainter p;
    ok=p.begin(this);
    QColor qcred(Qt::red);
    p.setPen(qcred);
    p.drawLine(10, 80, 90, 20);
    p.end();

    ok has the value true.

    However, I don't see a line drawn. How do I solve this?

    Daan

  2. #2
    Join Date
    Jan 2006
    Location
    Germany
    Posts
    4,380
    Thanks
    19
    Thanked 1,005 Times in 913 Posts
    Qt products
    Qt4
    Platforms
    Unix/X11 Windows Symbian S60
    Wiki edits
    5

    Default Re: Draw a line

    what is "this"? can you show us some little more code? And eventually the coordinates of your line are outside the visible area of your widget(or whatever you use.)

Similar Threads

  1. Why is my application's CPU usage always > 50%
    By richardander in forum Qt Programming
    Replies: 10
    Last Post: 14th October 2010, 23:22
  2. QTcpSocket exception.
    By Fastman in forum Qt Programming
    Replies: 9
    Last Post: 29th January 2008, 14:51
  3. Qwizard crashed when created in a slot
    By joshlareau in forum Qt Programming
    Replies: 9
    Last Post: 15th January 2008, 10:16
  4. KDE/QWT doubt on debian sarge
    By hildebrand in forum KDE Forum
    Replies: 13
    Last Post: 25th April 2007, 07:13
  5. QTableView paints too much
    By Jimmy2775 in forum Qt Programming
    Replies: 2
    Last Post: 26th July 2006, 19:42

Tags for this Thread

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.