Results 1 to 8 of 8

Thread: Axis problem with tiling QWTplots

  1. #1
    Join Date
    Jul 2010
    Posts
    5
    Thanks
    2
    Qt products
    Qt4
    Platforms
    Windows

    Default Axis problem with tiling QWTplots

    Hello,

    I use qwt-5.2.1. I want to make a grid of graphs and to put y-axis only in the graphs on the left column and put x-axis only in the graphs on the bottom row. A picture is attached to give the idea. I have done this with Qwtplot with enableAxis and QGridLayout. However, as one can see in the picture, the size of a plot window with axes becomes smaller than that witout axis. For example, the size of the top left graph is smaller than the one on the right.

    Would there be a way to fix this without changing the code too much? If not, what is the best way to handle this?

    Thanks a lot,

    Daisuke
    Attached Images Attached Images

  2. #2
    Join Date
    Oct 2010
    Location
    Berlin, Germany
    Posts
    358
    Thanks
    18
    Thanked 68 Times in 66 Posts
    Qt products
    Qt4
    Platforms
    Windows

    Default Re: Axis problem with tiling QWTplots

    just an idea:

    Qt Code:
    1. plotWithoutAxis->setWidth(plotWithAxis->canvas()->width())
    To copy to clipboard, switch view to plain text mode 

  3. #3
    Join Date
    Jul 2010
    Posts
    5
    Thanks
    2
    Qt products
    Qt4
    Platforms
    Windows

    Default Re: Axis problem with tiling QWTplots

    Thank you for the reply. Would it be possible to get a width (or size) of a canvas? canvas()->width() doesn't seem to work and I can't find a relevant member function in the document on QwtPlotCanvas class.

    Thanks,

    daisuke

  4. #4
    Join Date
    Oct 2010
    Location
    Berlin, Germany
    Posts
    358
    Thanks
    18
    Thanked 68 Times in 66 Posts
    Qt products
    Qt4
    Platforms
    Windows

    Default Re: Axis problem with tiling QWTplots

    since QwtPlotCanvas) is inherited from QFrame, "int QFrame::frameWidth()" should do it...

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

    dtakeshita (6th December 2010)

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

    Default Re: Axis problem with tiling QWTplots

    You could calculate the additional space for the left/bottom axis from the sizeHints and try to adjust the stretch factors for the first row and last column of your grid layout with it.

    But in the end better forget about the grid layout and reimplement the resize event of your container widget where you do setGeometry manually for all of your plot widgets.

    Uwe

  7. #6
    Join Date
    Jul 2010
    Posts
    5
    Thanks
    2
    Qt products
    Qt4
    Platforms
    Windows

    Default Re: Axis problem with tiling QWTplots

    Quote Originally Posted by Uwe View Post
    reimplement the resize event of your container widget where you do setGeometry manually for all of your plot widgets.
    Uwe
    I don't have a clear idea how one could do this since I don't have a lot of eypereince with Qwt. I would appreciate if you could give me more detailed explanation.

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

    Default Re: Axis problem with tiling QWTplots

    Quote Originally Posted by dtakeshita View Post
    I don't have a clear idea how one could do this since I don't have a lot of eypereince with Qwt. I would appreciate if you could give me more detailed explanation.
    This is Qt ( no Qwt ) know how. Overload the resizeEvent of the widget, where you have your QGridLayout and lay out your plot widgets manually using QWidget::setGeometry.

    Uwe

  9. The following user says thank you to Uwe for this useful post:

    dtakeshita (6th December 2010)

  10. #8
    Join Date
    Jul 2010
    Posts
    5
    Thanks
    2
    Qt products
    Qt4
    Platforms
    Windows

    Default Re: Axis problem with tiling QWTplots

    Quote Originally Posted by Uwe View Post
    This is Qt ( no Qwt ) know how. Overload the resizeEvent of the widget, where you have your QGridLayout and lay out your plot widgets manually using QWidget::setGeometry.

    Uwe
    Thank you for educating me! I will look into this option.

Similar Threads

  1. Replies: 0
    Last Post: 9th August 2010, 11:46
  2. Multiple QwtPlots in one frame?
    By rambo83 in forum Qwt
    Replies: 0
    Last Post: 7th January 2010, 09:03
  3. Tiling with OpenGL and textures
    By soxs060389 in forum Qt Programming
    Replies: 1
    Last Post: 25th September 2009, 22:06
  4. QGraphicsView/Item Tiling Problem
    By tomf in forum Qt Programming
    Replies: 4
    Last Post: 29th August 2008, 09:58
  5. QBrush pixmap tiling
    By rbp in forum Qt Programming
    Replies: 6
    Last Post: 19th June 2008, 13:54

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.