Results 1 to 5 of 5

Thread: QGraphicsView unwanted margin

Threaded View

Previous Post Previous Post   Next Post Next Post
  1. #1
    Join Date
    Jan 2011
    Location
    Munich, Germany
    Posts
    4
    Qt products
    Qt5
    Platforms
    Unix/X11

    Question QGraphicsView unwanted margin

    To experiment a little with QGraphicsView, I wanted to implement a plot widget that plots 2D data points, connecting consecutive points by a line. Both horizontal and vertical scrollbars are set to be always off.

    First test was a plot of a sine function, discretized into 50 equidistant data points on the interval [0, 2*pi]. That yields a y-range of [-0.999486, +0.999486]. The underlying SceneRect's size is set to exactly these width and height, resp. Therefore, I expected the plot to reach all the way to the QGraphicsView's boundary, essentially touching its edges. However, and this is what my question is about: there is always a margin of maybe 1 or 2 pixels. Where does this margin come from, and how can it be removed? What else could I have missed and done wrong?

    Attached you find two images of the plot. In the first one ('plot_centered.jpg'), the QGraphicsView is aligned horizontally and vertically centered, and the margin is clearly visible on each edge. In the other one ('plot_leftTop.jpg'), it is aligned to the "left and top". The result is that the plot starts exactly at the left and top edge, but the gap next to the other 2 edges is accordingly bigger.

    Not sure if it's important, but I'm using Qt 4.7.0 on Linux. Any help or hints are greatly appreciated!
    Attached Images Attached Images

Similar Threads

  1. Avoiding unwanted button signals.
    By Eos Pengwern in forum Newbie
    Replies: 2
    Last Post: 7th January 2010, 15:58
  2. Unwanted padding on QWidget
    By etru1927 in forum Qt Programming
    Replies: 4
    Last Post: 7th August 2008, 07:42
  3. VS2005 proj file has unwanted name
    By Vanir in forum Qt Programming
    Replies: 3
    Last Post: 13th February 2008, 15:53
  4. QMdiArea unwanted actvation
    By fullmetalcoder in forum Qt Programming
    Replies: 7
    Last Post: 12th November 2007, 07:09
  5. How to Set margin
    By suresh in forum Newbie
    Replies: 1
    Last Post: 5th October 2006, 06:13

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
  •  
Qt is a trademark of The Qt Company.