Results 1 to 1 of 1

Thread: Add widget on top of existing QGLWidget

  1. #1
    Join Date
    May 2013
    Posts
    45
    Thanks
    6
    Thanked 6 Times in 4 Posts
    Qt products
    Qt5
    Platforms
    MacOS X

    Question Add widget on top of existing QGLWidget

    Hello,

    I am trying to add widgets on top of an existing QGLWidget.
    I have followed this and trying to implement it into my code.
    Here is some code:

    Qt Code:
    1. ...
    2. // occView derives QGLWidget
    3. myOccView = new occView(myContext, this);
    4. GraphicsView* view = new GraphicsView();
    5. view->setViewport(myOccView);
    6. view->setViewportUpdateMode(QGraphicsView::FullViewportUpdate);
    7. view->setScene(new OpenGLScene);
    8. view->show();
    9. view->resize(1024, 768);
    10. view->raise();
    11. ...
    To copy to clipboard, switch view to plain text mode 

    It opens the normal QGLWidget, and also opens in a seperate window the graphics view.

    But then programme crashes at view->setViewport(myOccView);
    http://postimg.org/image/wl7fd315t/
    and says:

    QWindowsGLContext::makeCurrent: SetPixelFormat() failed (The pixel format is invalid.)
    ASSERT: "context" in file opengl\qopenglfunctions.cpp, line 194
    qwidget::repaint: recursive repaint detected

    If I remove:
    view->setViewport(myOccView);
    It doesn't crash and opens the two windows :
    http://postimg.org/image/ewmy1uarb/

    So I am wondering how I attach the graphicsView to my QGLWidget. I think this will solve the crash.

    Thank you.
    Last edited by scarecr0w132; 6th December 2013 at 03:15.

  2. The following user says thank you to scarecr0w132 for this useful post:


Similar Threads

  1. Customizing tree widget using existing widgets
    By icarus in forum Qt Programming
    Replies: 0
    Last Post: 25th October 2012, 15:50
  2. QGraphicsView over existing QGLWidget
    By kalos80 in forum Qt Programming
    Replies: 0
    Last Post: 30th August 2012, 17:47
  3. Replies: 1
    Last Post: 3rd December 2010, 13:02
  4. Adding custom widget to an existing layout
    By santana in forum Qt Programming
    Replies: 1
    Last Post: 22nd June 2010, 17:29
  5. Designer: How to promote to a existing Qt Widget?
    By nightghost in forum Qt Programming
    Replies: 2
    Last Post: 9th December 2009, 09:12

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.