Results 1 to 5 of 5

Thread: QGraphicsView with custom QGLWidget

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

    Default QGraphicsView with custom QGLWidget

    I am trying to integrate this:
    http://doc.qt.digia.com/qq/qq26-openglcanvas.html
    But I want to use a third party library that does the rendering.
    The class that currently renders is derived from QGLWidget.

    This is how it currently draws:

    Qt Code:
    1. void occView::paintEvent( QPaintEvent* e )
    2. {
    3. aView->Redraw();
    4. }
    To copy to clipboard, switch view to plain text mode 

    My current code:

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

    this results in http://postimg.org/image/wl7fd315t/
    You can also see that they are in different windows.
    Qt Code:
    1. QWindowsGLContext::makeCurrent: SetPixelFormat() failed (The pixel format is invalid.)
    2. ASSERT: "context" in file opengl\qopenglfunctions.cpp, line 194
    3. qwidget::repaint: recursive repaint detected
    To copy to clipboard, switch view to plain text mode 

    So I am obviously doing something wrong..
    Do I have to redraw it in
    Qt Code:
    1. QGraphicScene::DrawBackground
    To copy to clipboard, switch view to plain text mode 

    Thank you
    Last edited by scarecr0w132; 9th December 2013 at 05:27.

  2. #2
    Join Date
    Mar 2009
    Location
    Brisbane, Australia
    Posts
    7,729
    Thanks
    13
    Thanked 1,610 Times in 1,537 Posts
    Qt products
    Qt4 Qt5
    Platforms
    Unix/X11 Windows
    Wiki edits
    17

    Default Re: QGraphicsView with custom QGLWidget

    We have insufficient information to tell you exactly what is going on. The first code snippet is from a class called myView is unrelated to the second code snippet.

  3. The following 2 users say thank you to ChrisW67 for this useful post:


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

    Default Re: QGraphicsView with custom QGLWidget

    Quote Originally Posted by ChrisW67 View Post
    We have insufficient information to tell you exactly what is going on. The first code snippet is from a class called myView is unrelated to the second code snippet.
    Thank you for pointing that out
    Last edited by scarecr0w132; 9th December 2013 at 06:07.

  5. The following 2 users say thank you to scarecr0w132 for this useful post:


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

    Default Re: QGraphicsView with custom QGLWidget

    bump

  7. The following 2 users say thank you to scarecr0w132 for this useful post:


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

    Default Re: QGraphicsView with custom QGLWidget

    I have attached a basic version of my program.
    Could someone who has experience please help me with adding QWidgets to custom QGLWidget.

    Thank you!
    Attached Files Attached Files

Similar Threads

  1. Replies: 3
    Last Post: 12th October 2012, 10:44
  2. QGraphicsView over existing QGLWidget
    By kalos80 in forum Qt Programming
    Replies: 0
    Last Post: 30th August 2012, 17:47
  3. Replies: 5
    Last Post: 9th January 2012, 21:22
  4. Replies: 0
    Last Post: 17th August 2008, 17:31
  5. Mystic Problem (QGraphicsView + QGLWidget)
    By NoRulez in forum Qt Programming
    Replies: 2
    Last Post: 28th April 2008, 10:39

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.