Results 1 to 2 of 2

Thread: Apply different scale on items

  1. #1
    Join Date
    Dec 2006
    Posts
    426
    Thanks
    8
    Thanked 18 Times in 17 Posts
    Qt products
    Qt4
    Platforms
    Unix/X11

    Default Apply different scale on items

    Hi,

    I have two QGraphicsWidget, one on top of the other, managed by QGraphicsGridLayout. When I do view.scale( 2, 2 ), I would like the top one ( QGraphicsWidget 1 ) to accept both x/y scale, and I want the bottom one (QGraphicsWidget 2) to accept X scale, but ignore Y scale, as shown in the chart.

    How can I achieve this?

    Thanks
    Attached Images Attached Images

  2. #2
    Join Date
    Oct 2006
    Location
    New Delhi, India
    Posts
    2,467
    Thanks
    8
    Thanked 334 Times in 317 Posts
    Qt products
    Qt4
    Platforms
    Unix/X11 Windows

    Default Re: Apply different scale on items

    I dont think you can do that with QGraphicsView::scale function. It applies scaling to the view, not to the items.
    You can however try the following -

    1) Make your own function MYScale(int x, int y). In this iterate over all items. You will need to set some property in the items, or you can define the logic in this function itself. From either of 2, you can call QGraphicsItem::scale.

    2) You get zoom level in graphics item. See 40000 chips demo, and you could do something similar to get ur goals

    In my opinion first soln is better. Bec in your case, you want to resize items, not view. and you want to do it based on some parameters. Hence making your own function makes sense

Similar Threads

  1. Some menubar items can not be clicked
    By richardander in forum Qt Programming
    Replies: 4
    Last Post: 11th March 2009, 00:26
  2. Replies: 13
    Last Post: 12th June 2008, 13:23
  3. Light items for the graphicsView
    By maverick_pol in forum Qt Programming
    Replies: 12
    Last Post: 1st November 2007, 18:51
  4. Selective highlighting of Items
    By Kapil in forum Qt Programming
    Replies: 3
    Last Post: 26th May 2006, 12:20

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.