Results 1 to 2 of 2

Thread: Want to Create a Fixed Grid Size when Printed?

  1. #1
    Join Date
    Jul 2010
    Posts
    1
    Qt products
    Qt4
    Platforms
    Unix/X11 Windows

    Default Want to Create a Fixed Grid Size when Printed?

    I'm an engineer using Qwt to plot data (1,000's plots). I have a requirement that when printed on paper it have following grid design

    - A major division every 2cm with a solid line.
    - A sub division every 1 cm with same grid line type as the major.
    - A sub division every 0.5cm with a densely dotted line type.
    - A sub division every mm with a loosely dotted line type.

    I'm using a QPrinter with a specific setPaperSize (which varies based on the plot) exporting the plots as PDFs.

    First is there a "simple" way to get this grid? I'm guessing not, but it wouldn't be the first I've started to reinvent the wheel.

    Assuming no, is there a way to "print preview" the plot without sending it to the PDF file? i.e. Try to gather the rendered canvas size, based on the paper dimensions from the Qwt:rint command.

    Also, is there going to be some limitation that will prevent me from creating these 4 grid levels? Or should I look at setting the canvas image to this fixed pattern?

    Regards,
    Ryan

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

    Default Re: Want to Create a Fixed Grid Size when Printed?

    The layout engine of the plot widget always distributes a given rectangle to scales/title/legend and the rest goes to the canvas. But what you need is a layout system, that takes the size for the canvas and calculates the other sizes from it ( what is exactly vice versa ). Unfortunately it doesn't exist.

    I would try to use Qwt from SVN trunk, because its render engine is double based now. Then paint to a scalable vector format ( PDF or SVG ). When you overload some of the methods of QwtPlotRenderer ( f.e. renderScale ) it should be possible to find the scaling factor, that is needed to scale your document having a grid of 2 cm.

    Uwe

Similar Threads

  1. Replies: 4
    Last Post: 20th November 2009, 12:25
  2. Replies: 12
    Last Post: 30th May 2009, 14:29
  3. Fixed size axes
    By wim12 in forum Qwt
    Replies: 4
    Last Post: 15th May 2009, 12:37
  4. A fixed size window?
    By adorp in forum Qt Tools
    Replies: 4
    Last Post: 25th July 2007, 18:57
  5. QDockWidget fixed size?
    By Michiel in forum Qt Programming
    Replies: 1
    Last Post: 21st March 2006, 02:48

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.