Results 1 to 2 of 2

Thread: Keep the size of a user defined item

  1. #1
    Join Date
    Jun 2015
    Posts
    1
    Qt products
    Qt5
    Platforms
    Windows

    Default Keep the size of a user defined item

    Hello everybody,

    i wanna draw a user defined symbol - the shape of a small mobile robo - on a qwtpolarplot with enabled qwtpolarmagnifier.

    For the first try i used a qwtpolarmarker with a rectangular qwtsymbol as symbol.

    Qt Code:
    1. QwtSymbol( QwtSymbol::Rect, Qt::NoBrush, QPen( QBrush( Qt::blue ), 4, Qt::SolidLine ), QSize( 70, 50 ) )
    To copy to clipboard, switch view to plain text mode 

    Unfortunately the symbol is not becoming bigger/smaller when i zoom in/out. Is there an easy way to increase/decrease the size of this rectangular when the user is zooming??

    As i understand this the size in painter cord (70;50) is kept constant when i use the zooming function - but i want the real size of the robo (e. g. 1m;0.7m) kept constant. Hope you understand what i try to express.


    My second idea was to subclass qwtpolaritem, but i have no idea how i can achieve my goal that the size of the symbol is increased/decreased when i use the mousewheel to zoom in/out.

    Another question: is there a possibility to rotate a qwtsymbol so that i can display the 2D-angle of the robo??

    Instead of all i could use a qwtcurve to display the shape of the robo (and also the 2D-angle) but this sounds like a quick and dirty solution.


    Hope someone can point me in the right direction.

    Regards

    semeto

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

    Default Re: Keep the size of a user defined item

    I recommend to derive from QwtPolarItem. The attributes of your items are: the position. radius and heading.
    The when painting all you need to do is to use the scalemaps to translate your attributes into paint device coordinates. The scaling is included in the transformations of your map - nothing extra to do for zooming.

    Uwe

Similar Threads

  1. Replies: 6
    Last Post: 3rd December 2012, 07:26
  2. How to get user-defined message?
    By ponponfish in forum Qt Programming
    Replies: 3
    Last Post: 17th May 2011, 16:19
  3. QSqlQueryModel + user defined roles
    By NoRulez in forum Qt Programming
    Replies: 1
    Last Post: 7th December 2009, 07:29
  4. Using User Defined Libraries
    By csvivek in forum Qt Programming
    Replies: 1
    Last Post: 27th May 2008, 19:47
  5. User Defined Signal?
    By rajeshs in forum Newbie
    Replies: 2
    Last Post: 18th December 2007, 11:42

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.