Results 1 to 4 of 4

Thread: Adding QGraphicsProxyWidget items into QGraphicsScene

  1. #1
    Join Date
    Dec 2007
    Location
    London
    Posts
    206
    Thanks
    40
    Qt products
    Qt4 Qt5 Qt/Embedded
    Platforms
    Unix/X11 Windows Android

    Default Adding QGraphicsProxyWidget items into QGraphicsScene

    Hello,

    I have got several widgets which I should add into a GraphicsScene...
    I found a new class in Qt4.4 "QGraphicsProxyWidget " that makes easier adding widgets into graphicsscene .
    I succesfully added most of my widgets as in the embeddeddialogs example of qt; but on some of my widgets I use QGLWidget to make some drawings. At that point qt gives a warning and that widget is not shown on the screen:

    QPainter::begin: A paint device can only be painted by one painter at a time

    I am adding the widgets as follow:
    Qt Code:
    1. CustomProxy *proxy = new CustomProxy(0, Qt::Window);
    2. myDialog *dialog1=new myDialog;
    3. proxy->setWidget(dialog1);
    4. scene.addItem(proxy);
    To copy to clipboard, switch view to plain text mode 

    Should i use a different design pattern? Any idea?..

    Thanks, regards..

  2. #2
    Join Date
    Jan 2006
    Location
    Warsaw, Poland
    Posts
    33,359
    Thanks
    3
    Thanked 5,015 Times in 4,792 Posts
    Qt products
    Qt3 Qt4 Qt5 Qt/Embedded
    Platforms
    Unix/X11 Windows Android Maemo/MeeGo
    Wiki edits
    10

    Default Re: Adding QGraphicsProxyWidget items into QGraphicsScene

    As far as I know currently you shouldn't add GL widgets to graphicsview. You can instead add a custom widget with a GL context where you will render its content to a pixel buffer and then render the resulting pixmap as the item in graphics view.

  3. The following user says thank you to wysota for this useful post:

    yagabey (21st November 2008)

  4. #3
    Join Date
    Jul 2008
    Posts
    139
    Thanks
    9
    Thanked 18 Times in 15 Posts
    Qt products
    Qt/Embedded
    Platforms
    Unix/X11

    Default Re: Adding QGraphicsProxyWidget items into QGraphicsScene

    hi,
    I am rendering a pixmap image using a proxy widget. Take a look at the /examples/graphicsview/pad_navigator example 'roundrectitem'.

  5. The following user says thank you to QbelcorT for this useful post:

    yagabey (21st November 2008)

  6. #4
    Join Date
    Dec 2007
    Location
    London
    Posts
    206
    Thanks
    40
    Qt products
    Qt4 Qt5 Qt/Embedded
    Platforms
    Unix/X11 Windows Android

    Default Re: Adding QGraphicsProxyWidget items into QGraphicsScene

    I think , you are right; i converted tht qglwidget to qwidget, and it worked. It would be nice if graphicsview supported qglwidgets. Anyway...

Similar Threads

  1. Adding QGLWidget to QGraphicsScene problem
    By sanjayshelke in forum Qt Programming
    Replies: 10
    Last Post: 26th April 2016, 15:03
  2. Replies: 0
    Last Post: 7th April 2008, 14:27
  3. Limitation when adding more than 256 items to a model
    By darkadept in forum Qt Programming
    Replies: 5
    Last Post: 25th May 2006, 15:26
  4. [Qt4]: Adding centered items in QListWidget
    By Jojo in forum Qt Programming
    Replies: 4
    Last Post: 16th March 2006, 20:04
  5. Adding tooltips to canvas items
    By jnana in forum Qt Programming
    Replies: 2
    Last Post: 2nd March 2006, 10:53

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.