Results 1 to 11 of 11

Thread: Painting problem

Hybrid View

Previous Post Previous Post   Next Post Next Post
  1. #1
    Join Date
    Feb 2006
    Location
    Romania
    Posts
    2,744
    Qt products
    Qt4
    Platforms
    Unix/X11 Windows
    Thanks
    8
    Thanked 541 Times in 521 Posts

    Default Re: Painting problem

    OK.
    A painter draws in paint device (widget in this case ) local coordinates.
    Meaning that when you used my previous suggestion, something got filled, but not the right thing .

    Thus, everything must be drawn relative to (0,0).
    Calling p.fillRect( 0, 0, size().width(), size().height(), Qt:red ) will fill the ENTIRE widget.
    For what you were trying to achieve call p.fillRect( 0, 0, 30, 6, Qt:red ). This will fill a small rect in the top left corner of the widget.

    To be sure just do a drawRect( 0, 0, size().width(), size().height() ) - draw a frame around the widget.

    If this works ( and it will ), draw everything relative to (0, 0 ) - lines, etc.

    It's probably late in your area, but do you have any last suggestions for today?
    It's 11 PM, not so late.

    Regards

  2. #2
    Join Date
    May 2007
    Posts
    7
    Qt products
    Qt4
    Platforms
    Unix/X11

    Default Re: Painting problem

    Sigh ... Of course it's relative! I knew there was some fundamental point I was missing! I adjusted my numbers, and painted the rectangle and the line I was trying to paint.

    I can't thank you enough for your help, Marcel. I have a lot of work still ahead, but your help has removed a big roadblock. I put my question out to this group, because they had advertised a 95% success rate in solving users' problems. Mine can certainly be added to the success list thanks to your efforts.

    Thanks again for your time and patience.

    Cheers,
    Mel

  3. #3
    Join Date
    Feb 2006
    Location
    Romania
    Posts
    2,744
    Qt products
    Qt4
    Platforms
    Unix/X11 Windows
    Thanks
    8
    Thanked 541 Times in 521 Posts

    Default Re: Painting problem

    Happy to be of some help!

    Regards

Similar Threads

  1. Painting problem
    By ScoOteR in forum Qt Programming
    Replies: 5
    Last Post: 11th March 2007, 12:03
  2. Painting Problem
    By shyam prasad in forum Qt Programming
    Replies: 3
    Last Post: 5th February 2007, 15:07
  3. QTimer problem ... it runs but never triggs
    By yellowmat in forum Newbie
    Replies: 4
    Last Post: 4th July 2006, 13:54
  4. Problem with bitBlt
    By yellowmat in forum Newbie
    Replies: 1
    Last Post: 5th April 2006, 15:08
  5. Replies: 16
    Last Post: 7th March 2006, 16: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.