Results 1 to 4 of 4

Thread: QGraphicsView stop drawing objects when a glwidget with GLVersion>3.1 set as viewport

Threaded View

Previous Post Previous Post   Next Post Next Post
  1. #1
    Join Date
    Jul 2012
    Posts
    3
    Qt products
    Qt4
    Platforms
    Windows

    Default QGraphicsView stop drawing objects when a glwidget with GLVersion>3.1 set as viewport

    When I create a QGLWidget with a custom GLFormat and set that widget as viewport of a qgraphicsview, if the glformat is higher than 3.1, the graphicsview stop drawing graphicsobjects or graphicsitems.

    example( if I setVersion(3,1) the img pixmap is drawn, if I setVersion(3,3) the img pixmap doesn't appear in the scene):
    Qt Code:
    1. QGLFormat glFormat;
    2. glFormat.setVersion(3,1);
    3. //glFormat.setVersion(3,3);
    4. glFormat.setProfile(QGLFormat::CoreProfile);
    5. glFormat.setOption(QGL::DoubleBuffer);
    6. glFormat.setOption(QGL::DepthBuffer);
    7. glFormat.setOption(QGL::Rgba);
    8. QGLWidget* widget = new QGLWidget(glFormat);
    9. QGraphicsView *graphicsView = new QGraphicsView();
    10. QGraphicsPixmapItem *img = new QGraphicsPixmapItem(QPixmap("btn-easy.png"));
    11. img->setPos(100,100);
    12. scene->addItem(img);
    13. graphicsView->setViewport(widget);
    14. graphicsView->setViewportUpdateMode(QGraphicsView::FullViewportUpdate);
    15. graphicsView->setScene(scene);
    To copy to clipboard, switch view to plain text mode 

    Any idea if it can be fixed? Or something that I'm doing wrong?

    I was using the http://doc.qt.digia.com/qq/qq26-openglcanvas.html openglcanvas approach to draw transparent items on top of a GLWidget. But since my custom GLWidget (it happens with default QGLWidget like on the example) requires OpenGL higher than 3.1 (actually should be 4.x), I cannot keep this approach.

    Anyone know another efficient approach to draw transparent widgets on top of a QGLWidget or how to set a graphicview viewport with a qglwidget using glcontext 4.x?
    QT5 handles the graphic pipeline differently from the QT4 , can QT5 be a solution? Did anyone successfully made an openGLCanvas on QT5?

    Thanks in advance.
    Last edited by raziel; 11th December 2012 at 18:56.

Similar Threads

  1. Replies: 2
    Last Post: 15th June 2021, 16:00
  2. QGraphicsView inside of QAbstractItemView viewport
    By Paladin12 in forum Qt Programming
    Replies: 5
    Last Post: 24th January 2016, 14:15
  3. Replies: 5
    Last Post: 9th January 2012, 21:22
  4. Replies: 0
    Last Post: 28th April 2010, 11:41
  5. Replies: 0
    Last Post: 8th April 2010, 16:06

Tags for this Thread

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.