Results 1 to 4 of 4

Thread: probelm in setting the QGLWidget as viewport of QGraphicsView

  1. #1
    Join Date
    Sep 2008
    Location
    Bangalore
    Posts
    659
    Thanks
    116
    Thanked 42 Times in 41 Posts
    Qt products
    Qt4
    Platforms
    Unix/X11 Windows

    Default probelm in setting the QGLWidget as viewport of QGraphicsView

    Hi friends,

    Im facing a problem of adding a QGLWidget as a viewport of the GraphicsView ...
    when i tried to show my QGLWidget it looks perfect ..
    but when i tried to add as a QGrraphicsView viewport() im facing a problem...

    this is how i added..

    Qt Code:
    1. QApplication app(argc, argv);
    2.  
    3. scene->setSceneRect(QRectF(0, 0, 1024, 800));
    4.  
    5.  
    6. GLWidget *window = new GLWidget();
    7. window->makeCurrent();
    8. view.setViewport(window);
    9. view.setViewportUpdateMode(QGraphicsView::FullViewportUpdate);
    10. view.setScene(scene);
    11. view.show();
    To copy to clipboard, switch view to plain text mode 

    the window looks white blank screen.. but when i show GLWidget alone it looks ok.. i drawn a polygon on a balck background QGLWidget ..
    please help me ... thanks in advance !
    "Behind every great fortune lies a crime" - Balzac

  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: probelm in setting the QGLWidget as viewport of QGraphicsView

    Quote Originally Posted by wagmare View Post
    the window looks white blank screen..
    That's what a graphics view viewport is supposed to look like by default since the view clears its background with QPalette::Base.
    Your biological and technological distinctiveness will be added to our own. Resistance is futile.

    Please ask Qt related questions on the forum and not using private messages or visitor messages.


  3. #3
    Join Date
    Sep 2008
    Location
    Bangalore
    Posts
    659
    Thanks
    116
    Thanked 42 Times in 41 Posts
    Qt products
    Qt4
    Platforms
    Unix/X11 Windows

    Default Re: probelm in setting the QGLWidget as viewport of QGraphicsView

    Quote Originally Posted by wysota View Post
    That's what a graphics view viewport is supposed to look like by default since the view clears its background with QPalette::Base.
    Wysota!
    first thanks for the reply ..
    i thought it will set the viewport of QGLWidget with the polygon i drawn on it...
    is it possible to show the QGLWidget ..?
    QGraphicsProxyItem is the only way..?
    "Behind every great fortune lies a crime" - Balzac

  4. #4
    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: probelm in setting the QGLWidget as viewport of QGraphicsView

    You can use drawBackground() to execute your OpenGL code or you can probably prevent the view from clearing the background.
    Your biological and technological distinctiveness will be added to our own. Resistance is futile.

    Please ask Qt related questions on the forum and not using private messages or visitor messages.


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

    wagmare (12th October 2012)

Similar Threads

  1. Replies: 5
    Last Post: 9th January 2012, 22:22
  2. QGLWidget render or QGraphicsView with GL viewport render
    By QTInfinity in forum Qt Programming
    Replies: 2
    Last Post: 28th November 2011, 12:34
  3. Replies: 0
    Last Post: 8th April 2010, 17:06
  4. Replies: 0
    Last Post: 29th September 2009, 03:28
  5. Replies: 0
    Last Post: 17th August 2008, 18:31

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.