Results 1 to 5 of 5

Thread: Qwt with QWidget or QGraphicsView+QGraphicsScene

  1. #1
    Join Date
    Jun 2011
    Location
    Porto Alegre, Brazil
    Posts
    482
    Thanks
    165
    Thanked 2 Times in 2 Posts
    Qt products
    Qt5
    Platforms
    Unix/X11 Windows

    Default Qwt with QWidget or QGraphicsView+QGraphicsScene

    Hello!

    I want to show a QwtPlot 2D graphic in my Qt application (and I'm using the UI interface for that). In previous software, what I did was I created a personal class with QwtPlot inherited and used the function setParent() pointing to a QWidget inside the UI interface.

    But I noticed that the QGraphicsView + QGraphicsScene provides some painting functionality that simple QWidget don't provide, so I figured out, if it turned to be necessary, that probably it would be better if I connected the QwtPlot not with a QWidget, but with a QGraphicsView/QGraphicsScene so I could use not only the functions Qwt provide, but also what QGraphicsView/Scene provides.

    I would like to know, given this desire, what are the advantages/disavantages of linking a QwtPlot to a QGraphicsView instead of a QWidget, what can I loose and if my previous, written thoughs are correct. Notice that I don't want only to plot, but to use many "special" functionality for the QwtPlot such as zoom and pan.


    Thanks,


    Momergil

  2. #2
    Join Date
    Feb 2006
    Location
    Munich, Germany
    Posts
    3,318
    Thanked 879 Times in 827 Posts
    Qt products
    Qt3 Qt4 Qt/Embedded
    Platforms
    MacOS X Unix/X11 Windows

    Default Re: Qwt with QWidget or QGraphicsView+QGraphicsScene

    Quote Originally Posted by Momergil View Post
    I would like to know, given this desire, what are the advantages ...
    When you are trying to use OpenGL you might find a way to tunnel QWidgets ( here Qwt widgets ) by using the OpenGL mode of the QGL canvas. Never tried this hack myself, but I wouldn't expect that it works out of the box.

    Beside this I wouldn't expect anything useful from stacking Qwt and QGV as both are on the same level of abstraction ( somewhere between QPainter and QWidget ).

    Uwe

  3. #3
    Join Date
    Jun 2011
    Location
    Porto Alegre, Brazil
    Posts
    482
    Thanks
    165
    Thanked 2 Times in 2 Posts
    Qt products
    Qt5
    Platforms
    Unix/X11 Windows

    Default Re: Qwt with QWidget or QGraphicsView+QGraphicsScene

    Quote Originally Posted by Uwe View Post
    When you are trying to use OpenGL you might find a way to tunnel QWidgets ( here Qwt widgets ) by using the OpenGL mode of the QGL canvas. Never tried this hack myself, but I wouldn't expect that it works out of the box.
    To be sincere I'm not sure if I understood what you mean in this explanation.


    Beside this I wouldn't expect anything useful from stacking Qwt and QGV as both are on the same level of abstraction ( somewhere between QPainter and QWidget ).
    Hmm, Ok. But does this garantee to me that all functionality that QGV+QGS provides will be avaliable if I stack Qwt in a QWidget?*


    Now, given you mentioned OpenGL and some days ago I was studying what would be better to use to display graphics in my software - Qwt or OpenGL -, could you also say to me if there is the possibility to use OpenGL functions inside a QwtPlot? Let's imagine that I want to do something that Qwt classes/functions don't do or don't do very well while OpenGL offers exactly what I need. Is there a way to work with both of them in the same plot?

    Thanks!

    Momergil


    *Notice that my greatest interest in using QGV+QGS by now is to be able to use the write text function in the Qt example Diagram Scene.

  4. #4
    Join Date
    Feb 2006
    Location
    Munich, Germany
    Posts
    3,318
    Thanked 879 Times in 827 Posts
    Qt products
    Qt3 Qt4 Qt/Embedded
    Platforms
    MacOS X Unix/X11 Windows

    Default Re: Qwt with QWidget or QGraphicsView+QGraphicsScene

    To be sincere I'm not sure if I understood what you mean in this explanation.
    Then it is of no importance for you.

    Ok. But does this garantee to me that all functionality that QGV+QGS provides will be avaliable if I stack Qwt in a QWidget?*
    Of course not - stacking Qwt on QGV doesn't offer you to put QGraphicsItems on the plot canvas or QwtPlotItems on the QG scene. You can't have Qwt and QGV features together.

    Uwe

  5. #5
    Join Date
    Jun 2011
    Location
    Porto Alegre, Brazil
    Posts
    482
    Thanks
    165
    Thanked 2 Times in 2 Posts
    Qt products
    Qt5
    Platforms
    Unix/X11 Windows

    Default Re: Qwt with QWidget or QGraphicsView+QGraphicsScene

    Quote Originally Posted by Uwe View Post
    Then it is of no importance for you.


    Of course not - stacking Qwt on QGV doesn't offer you to put QGraphicsItems on the plot canvas or QwtPlotItems on the QG scene. You can't have Qwt and QGV features together.

    Uwe
    Hmm, ok. And what about OpenGL and Qwt together?


    Momergil

Similar Threads

  1. How can I move a QWidget across a QGraphicsScene
    By Maduka in forum Qt Programming
    Replies: 0
    Last Post: 8th November 2011, 13:40
  2. QWidget in QGraphicsScene not drawing
    By stevel in forum Qt Programming
    Replies: 3
    Last Post: 19th September 2008, 20:19
  3. QWidget in a QGraphicsScene ..!!!
    By salmanmanekia in forum Qt Programming
    Replies: 7
    Last Post: 17th July 2008, 07:07
  4. When to use QGraphicsScene or QWidget
    By fossill in forum Qt Programming
    Replies: 2
    Last Post: 10th February 2007, 00:58
  5. QWidget item in QGraphicsScene
    By IUnknown in forum Qt Programming
    Replies: 4
    Last Post: 4th November 2006, 01:05

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.