Results 1 to 13 of 13

Thread: Light items for the graphicsView

Hybrid View

Previous Post Previous Post   Next Post Next Post
  1. #1
    Join Date
    Jan 2007
    Posts
    177
    Thanks
    8
    Thanked 10 Times in 9 Posts
    Qt products
    Qt4
    Platforms
    Unix/X11 Windows

    Default Re: Light items for the graphicsView

    By default, QGraphicsView provides a regular QWidget for the viewport widget. You can access this widget by calling viewport(), or you can replace it by calling setViewport(). To render using OpenGL, simply call setViewport(new QGLWidget). QGraphicsView takes ownership of the viewport widget.

    Yep!

  2. #2
    Join Date
    May 2007
    Location
    Lublin, Poland
    Posts
    345
    Thanks
    40
    Thanked 8 Times in 4 Posts
    Qt products
    Qt3 Qt4
    Platforms
    MacOS X Unix/X11 Windows

    Default Re: Light items for the graphicsView

    Yes I know that, but after including the headers (ading QT+=opengl) in the pro. when I compile(it ok, no errors) and run it I get unhandled exception in this line:
    m_view->setViewport(new QGLWidget).

    : )
    Qt allows you to use everything you want
    wysota
    --------------------------------------------------------------------------------
    #if defined(Q_OS_UNIX) && defined(QT_DEBUG)
    abort(); // trap; generates core dump
    #else
    exit(1); // goodbye cruel world
    #endif

  3. #3
    Join Date
    Jan 2007
    Posts
    177
    Thanks
    8
    Thanked 10 Times in 9 Posts
    Qt products
    Qt4
    Platforms
    Unix/X11 Windows

    Default Re: Light items for the graphicsView

    hmmm....
    me not....
    where do you call it?
    bevore initialisation of your view, or bevore setupUi() ??

  4. #4
    Join Date
    May 2007
    Location
    Lublin, Poland
    Posts
    345
    Thanks
    40
    Thanked 8 Times in 4 Posts
    Qt products
    Qt3 Qt4
    Platforms
    MacOS X Unix/X11 Windows

    Default Re: Light items for the graphicsView

    I have added that line just after creating the view, after setting all the data(scene), etc. but still it crashes just 1 sec after the app starts to run.
    Just run it in the debug mode, and the line is not invoking the error directly(because while running) compiler goes smoothly through that line, but then crashes after a sec.

    Maverick
    Qt allows you to use everything you want
    wysota
    --------------------------------------------------------------------------------
    #if defined(Q_OS_UNIX) && defined(QT_DEBUG)
    abort(); // trap; generates core dump
    #else
    exit(1); // goodbye cruel world
    #endif

  5. #5
    Join Date
    Oct 2006
    Posts
    279
    Thanks
    6
    Thanked 40 Times in 39 Posts
    Qt products
    Qt4
    Platforms
    MacOS X Unix/X11 Windows

    Default Re: Light items for the graphicsView

    Even if you are not using OpenGL, rendering 100 simple items shouldn't be a problem at all. Chances are you are doing something wrong. Try adding 100 pixmap items and see if that's slow. If not you need to show us some code, or at least a screen shot of the kind of scenario you are creating (how big images. how many are visible at the same time...).
    And another thing. Why is moving the mouse slowing down your app? Are you reacting on hover events?

Similar Threads

  1. Zoom GraphicsView but not Items
    By abbapatris in forum Qt Programming
    Replies: 2
    Last Post: 15th October 2007, 19:47

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.