Results 1 to 6 of 6

Thread: Draw Line

Hybrid View

Previous Post Previous Post   Next Post Next Post
  1. #1
    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 Line

    On other option is also to install an event filter, catch the paint event and then draw there.

  2. #2
    Join Date
    Oct 2010
    Posts
    4
    Thanked 1 Time in 1 Post
    Qt products
    Qt4
    Platforms
    MacOS X Unix/X11 Windows

    Default Re: Draw Line

    What do you like to draw exactly? Do you like to draw a line on an existing widget?
    Then you have to re-implement the paintEvent()-Method in a subclass of the widget. You can call Subclass:aintEvent(event); to draw the widget and then use QPainter to draw extra stuff on it...

    It is possible to write your own paint()-Funktion but you have to call it from the paintEvent()-Method, otherwise it will not work out.

  3. #3
    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 Line

    Quote Originally Posted by Ceelaz View Post
    It is possible to write your own paint()-Funktion but you have to call it from the paintEvent()-Method, otherwise it will not work out.
    That is as said not true! You can fetch a paint event and draw from outside the widget in any event filter without to touch paintEvent().

  4. #4
    Join Date
    Oct 2006
    Location
    New Delhi, India
    Posts
    2,467
    Thanks
    8
    Thanked 334 Times in 317 Posts
    Qt products
    Qt4
    Platforms
    Unix/X11 Windows

    Default Re: Draw Line

    Well... go ahead.. write your own function..
    in your function.. draw the line onto a pixmap.. and then set this pixmap on a label..

    but that wud be inefficient,, dont you think so ?

Similar Threads

  1. Draw a line
    By Daan in forum KDE Forum
    Replies: 1
    Last Post: 27th August 2009, 17:29
  2. Draw Line
    By aloysiusjegan in forum Qwt
    Replies: 4
    Last Post: 12th February 2009, 11:02
  3. Draw line on Mainwindow
    By sujan.dasmahapatra in forum Qt Programming
    Replies: 1
    Last Post: 5th February 2009, 08:54
  4. Best way to draw a Line
    By JimDaniel in forum Qt Programming
    Replies: 1
    Last Post: 19th January 2008, 09:57

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.