Results 1 to 11 of 11

Thread: Adding Rectangular overlay on graphics view

Hybrid View

Previous Post Previous Post   Next Post Next Post
  1. #1
    Join Date
    Oct 2006
    Posts
    83
    Qt products
    Qt4
    Platforms
    Unix/X11
    Thanks
    1
    Thanked 2 Times in 2 Posts

    Default Re: Adding Rectangular overlay on graphics view

    How exactly am I supposed to call this function for a particular graphicsView? Is there a specific QPainter pointer that I need to pass as a parameter that is related to the specific graphicsView? I'm just unclear as to how and when this drawForeground function is being called.

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

    Default Re: Adding Rectangular overlay on graphics view

    u need not call this function... it is called automatically.
    U just need to override it in ur scene class and do the drawing using the painter pointer provided

  3. #3
    Join Date
    Oct 2006
    Posts
    83
    Qt products
    Qt4
    Platforms
    Unix/X11
    Thanks
    1
    Thanked 2 Times in 2 Posts

    Default Re: Adding Rectangular overlay on graphics view

    I think I'm beginning to understand what you've all been talking about. But the QGraphicsView's that I'm using were all added to the same widget using Qt Designer. Am I supposed to write a class for each graphicsView that I added in designer? If so, how can I write a class for each individual graphicsView? Or am I still way of target?

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

    Default Re: Adding Rectangular overlay on graphics view

    Qt Designer has a widget promotion feature. Subclass QGraphicsView, open context menu over the graphics view widget in the designer and choose "Promote to Custom Widget".
    J-P Nurmi

  5. #5
    Join Date
    Oct 2006
    Posts
    83
    Qt products
    Qt4
    Platforms
    Unix/X11
    Thanks
    1
    Thanked 2 Times in 2 Posts

    Default Re: Adding Rectangular overlay on graphics view

    Thanks everyone! I got it working using a variety of all your tips. Mainly I used the widget promotion in designer, and then subclassed QGraphicsView to do what I wanted.

Similar Threads

  1. Automatic scroll in graphics view
    By Morea in forum Qt Programming
    Replies: 1
    Last Post: 18th November 2006, 14:07

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.