Results 1 to 8 of 8

Thread: Rotate items in qwt

Hybrid View

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

    Default Re: Rotate items in qwt

    Quote Originally Posted by jesse_mark View Post
    but how can i display the QPolygon on qwtpolt after that ??
    The same way like in your code above - or even easier this way:

    Qt Code:
    1. curve1->setSamples( polygon );
    To copy to clipboard, switch view to plain text mode 
    Uwe

  2. #2
    Join Date
    Jun 2012
    Posts
    173
    Thanks
    48
    Thanked 2 Times in 2 Posts
    Qt products
    Qt4
    Platforms
    Unix/X11 Windows

    Default Re: Rotate items in qwt

    [QUOTE=Uwe;224305]
    Qt Code:
    1. QPolygonF points = transform.mapToPolygon( QRectF( 0, 0, rect.width(), rect.height() );
    To copy to clipboard, switch view to plain text mode 

    i used QRect as there is no transform.mapToPolygon takes QRectF

    this is what i wrote :

    Qt Code:
    1. QRect grid;
    2. grid.setTop(Ox);
    3. grid.setLeft(Oy);
    4. grid.setHeight(Hight);
    5. grid.setWidth(Width);
    6.  
    7.  
    8. QTransform Tr;
    9. Tr.translate(grid.top(),grid.left());
    10. Tr.rotate(30);
    11.  
    12. QPolygonF points = Tr.mapToPolygon(QRect(0, 0, grid.width(), grid.height()));
    13.  
    14. curve1->setSamples( points );
    To copy to clipboard, switch view to plain text mode 

    but the resulted graph was not rectangle it was

    qwt.jpeg

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

    Default Re: Rotate items in qwt

    It is a rectangle, but setting a curve brush means that the area below the points ( to the baseline ) is filled - not the area inside the polygon.

    But I already told you in my first answer what type of plot item you need. I recommend to copy the RectItem of the navigation example and modify it so that it works with polygons. In the draw method you have to transform the points of the polygon one by one ( instead of a rectangle once ).

    Another option is to keep the RectItem as it is, beside rotating the translated rectangle inside of the draw method - but I don't know your use case.

    Uwe

Similar Threads

  1. Replies: 3
    Last Post: 5th February 2012, 17:59
  2. Replies: 2
    Last Post: 20th August 2010, 05:18
  3. How to rotate a QMainWindow
    By viet in forum Qt Programming
    Replies: 4
    Last Post: 19th August 2010, 00:31
  4. Rotate QLabel
    By Qt Coder in forum Newbie
    Replies: 2
    Last Post: 19th March 2009, 11:25
  5. Rotate QLabel
    By shader76 in forum Newbie
    Replies: 9
    Last Post: 24th December 2007, 12:31

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