Results 1 to 10 of 10

Thread: QGraphicsView rendering issue

  1. #1
    Join Date
    Jan 2006
    Location
    Paris, France
    Posts
    227
    Thanks
    3
    Thanked 21 Times in 21 Posts
    Qt products
    Qt4
    Platforms
    MacOS X Unix/X11 Windows

    Question QGraphicsView rendering issue

    Hi !

    I'm working on a QGraphicsView widget, meant to display interactive graphical items, that I can move / reshape / delete as I want.

    It works perfectly fine, the QGraphicsView framework is really good

    In order to filter this view with a color or a texture, I wanted to set a custom foreground brush to the scene, with this line :
    my_view->setForegroundBrush(QColor(255, 255, 255, 127));

    It applies well to the whole view, but when I move any item, I have some painting problems, described by the snapshot in attachment.

    I checked all the render hints, the painting methods for items, but I can't point the mistake.

    Any idea ?

    Thanks,
    Guilugi.
    Attached Images Attached Images

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

    Default Re: QGraphicsView rendering issue

    Are you using the built-in QGraphicsItem::ItemIsMovable flag for moving the items?
    J-P Nurmi

  3. #3
    Join Date
    Jan 2006
    Location
    Norway
    Posts
    124
    Thanked 38 Times in 30 Posts
    Qt products
    Qt3 Qt4 Qt/Embedded
    Platforms
    MacOS X Unix/X11 Windows

    Smile Re: QGraphicsView rendering issue

    Please show us some code, guilugi. If it's a bug in Qt, it should be possible to nail down.
    Bitto / Andreas Aardal Hanssen - andreas dot aardal dot hanssen at nokia
    Nokia Software Manager, Qt Development

  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: QGraphicsView rendering issue

    Check the bounding rectangles of the items... I guess your problem might be related to it.

    Also for debugging purposes, I usually draw the boundingRect in paint function. It helps u to identify the boundaries... and mistakes too

    Hope this helps

  5. #5
    Join Date
    Jan 2006
    Location
    Paris, France
    Posts
    227
    Thanks
    3
    Thanked 21 Times in 21 Posts
    Qt products
    Qt4
    Platforms
    MacOS X Unix/X11 Windows

    Default Re: QGraphicsView rendering issue

    Ok !
    Thanks for these answers guys

    Jpn : yes, I'm using the flag ItemIsMovable.

    Bitto : I'm currently making a small simple example, I'll post it quickly here.

    Aamer4yu : I use the predefined Qt items to render text, shapes, and images, I didn't subclassed one of them at all.
    I only subclassed my QGraphicScene class in order to draw background manually...

    I'll try to reimplement one of them to see if it helps ;-)

    Thanks again,
    Guilugi.

  6. #6
    Join Date
    Jan 2006
    Location
    Paris, France
    Posts
    227
    Thanks
    3
    Thanked 21 Times in 21 Posts
    Qt products
    Qt4
    Platforms
    MacOS X Unix/X11 Windows

    Default Re: QGraphicsView rendering issue

    Here comes the sample of code !

    There's a button below the graphics view, enabling / disabling the foreground filter.

    Guilugi.
    Attached Files Attached Files

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

    Default Re: QGraphicsView rendering issue

    Nice sample. I can reproduce the problem with both 4.2.3 and 4.3.0beta.
    J-P Nurmi

  8. #8
    Join Date
    Jan 2006
    Location
    Paris, France
    Posts
    227
    Thanks
    3
    Thanked 21 Times in 21 Posts
    Qt products
    Qt4
    Platforms
    MacOS X Unix/X11 Windows

    Default Re: QGraphicsView rendering issue

    Ok, thanks for your feedback jpn !

    Have you already posted this bug on Task Tracker, or may I do it ?

    Guilugi.
    Last edited by guilugi; 2nd April 2007 at 14:54.

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

    Default Re: QGraphicsView rendering issue

    Quote Originally Posted by guilugi View Post
    Have you already posted this bug on Task Tracker, or may I do it ?
    No, actually I haven't. I was kindly waiting for comments from Andreas aka Bitto. But sure, go ahead and report the issue.
    J-P Nurmi

  10. #10
    Join Date
    Jan 2006
    Location
    Paris, France
    Posts
    227
    Thanks
    3
    Thanked 21 Times in 21 Posts
    Qt products
    Qt4
    Platforms
    MacOS X Unix/X11 Windows

    Default Re: QGraphicsView rendering issue

    Ok, bug confirmed, here are the tracker details :

    Fix scheduled for Qt 4.3.0

    http://www.trolltech.com/developer/t...ntry&id=157400

Similar Threads

  1. QGraphicsView, QGraphicsItem, QGraphicsScene
    By Shuchi Agrawal in forum Newbie
    Replies: 10
    Last Post: 23rd March 2011, 20:50
  2. Simulating Video on QLabel or QGraphicsView
    By forrestfsu in forum Qt Programming
    Replies: 9
    Last Post: 21st March 2007, 10:39
  3. How to make MDI editor with QGraphicsView support
    By Kuzemko in forum Qt Programming
    Replies: 4
    Last Post: 14th February 2007, 17:31
  4. Using QGraphicsView with model/view programming
    By JLP in forum Qt Programming
    Replies: 3
    Last Post: 29th January 2007, 11:04
  5. How to use QGraphicsView and Scene right ...
    By Mike in forum Qt Programming
    Replies: 6
    Last Post: 22nd January 2007, 08:51

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.