Results 1 to 3 of 3

Thread: How to change the size of QGraphicsRectItem within HoverEvent()

  1. #1
    Join Date
    May 2010
    Posts
    6
    Thanks
    1
    Qt products
    Qt4
    Platforms
    Unix/X11

    Default How to change the size of QGraphicsRectItem within HoverEvent()

    Hi,
    i hav created a QGraphicsRectItem to be displayed when HoverEvent() called. its done well.

    But, now i want to display that Rect Item with gradually opening effect.(ie. rect box grow like effect).
    It's not work good. can u help me?
    Ram.

    Note: I m working in Qt 4.6.2 on Linux.

  2. #2
    Join Date
    May 2010
    Posts
    6
    Thanks
    1
    Qt products
    Qt4
    Platforms
    Unix/X11

    Default Re: How to change the size of QGraphicsRectItem within HoverEvent()

    In my code.

    QTimeLine *timer = new QTimeLine(); //timer
    timer->setFrameRange(0, 100);

    QGraphicsItemAnimation *animation = new QGraphicsItemAnimation;
    animation->setItem(rect); // rect is QGraphicsRectItem
    animation->setTimeLine(timer);
    animation->setScaleAt(1,2,2); //size of item is growing as well as item is moving too.
    timer->start();
    ....

    Here, size of item is growing as well as item is moving too.can i get the output without item is moved.?
    Last edited by ramfacts; 3rd May 2010 at 12:20.

  3. #3
    Join Date
    May 2010
    Posts
    6
    Thanks
    1
    Qt products
    Qt4
    Platforms
    Unix/X11

    Default Re: How to change the size of QGraphicsRectItem within HoverEvent()

    Here, x,y are the QGraphicsRectItem 's (x,y) element. &
    r is a pointer to QGraphicsRectItem

    for(float i = 1; i <= 100;i++){
    r->setTransform(QTransform().translate(x, y).scale(i/100, i/100).translate(-x, -y));
    }


    may i know that this is correct?

Similar Threads

  1. Custom QGraphicsRectItem with size grip
    By Bill in forum Newbie
    Replies: 7
    Last Post: 23rd July 2009, 13:43
  2. How do you change the size of a QMenubar
    By JonR79 in forum Qt Programming
    Replies: 1
    Last Post: 21st November 2008, 23:15
  3. QGraphicsItem HoverEvent Doubt
    By arjunasd in forum Qt Programming
    Replies: 1
    Last Post: 7th August 2007, 17:40
  4. change picture size
    By raphaelf in forum Newbie
    Replies: 1
    Last Post: 27th November 2006, 18:15
  5. change font size and button size of QMessageBox
    By nass in forum Qt Programming
    Replies: 6
    Last Post: 13th September 2006, 19:16

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.