Results 1 to 4 of 4

Thread: canvas size

  1. #1
    Join Date
    Jun 2011
    Location
    Chennai, India
    Posts
    30
    Thanks
    13
    Thanked 6 Times in 3 Posts
    Qt products
    Qt4
    Platforms
    Windows

    Question canvas size

    I'm implementing a custom bar chart by extending QwtPlot and overriding the drawItems() method. I set the number of bars i have to draw on the canvas in a particular method(in which i create the plotItems). I dont want the bar width to be too small or too big. How do i restrict the canvas size for this? (i compute the bar width in draw items as canvas()->width() / Number_of_items).

  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: canvas size

    Do it the other way round: calculatate the width of the bars from the canvas size.

    Uwe

  3. #3
    Join Date
    Jun 2011
    Location
    Chennai, India
    Posts
    30
    Thanks
    13
    Thanked 6 Times in 3 Posts
    Qt products
    Qt4
    Platforms
    Windows

    Default Re: canvas size

    That is what i do now. But if the the number of bars is very small and the canvas size is very big, the bars do not look so nice. that is why i want to limit the canvas size from (Number_of_Bars * Min_Bar_Width) to (Number_of_Bars * Max_Bar_Width)

  4. #4
    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: canvas size

    You can limit the size of the complete plot widget like for any other Qt widget.

    Uwe

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

    gkarthick5 (20th July 2011)

Similar Threads

  1. QwtPlot Canvas Size Hint?
    By umituzun84 in forum Qwt
    Replies: 8
    Last Post: 22nd September 2011, 16:21
  2. Canvas in QT
    By chandan in forum Newbie
    Replies: 5
    Last Post: 11th April 2011, 04:46
  3. How to manually pan canvas
    By novackb in forum Qwt
    Replies: 4
    Last Post: 18th February 2011, 17:46
  4. Qwt canvas using QGLWidget?
    By alex_sh in forum Qwt
    Replies: 4
    Last Post: 28th January 2011, 10:36
  5. Canvas problems
    By Tommytrojan in forum Qt Programming
    Replies: 22
    Last Post: 9th May 2006, 16:46

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.