Results 1 to 5 of 5

Thread: Marching Ant effect at the border of QRect

  1. #1
    Join Date
    Apr 2011
    Posts
    39
    Thanks
    1
    Qt products
    Qt3 Qt4
    Platforms
    Unix/X11 Windows

    Default Marching Ant effect at the border of QRect

    Hello,
    I just want to know
    How can we give the Marching Ant effect to the Border of the QRect.
    Can Anybody help me.?

  2. #2
    Join Date
    Sep 2009
    Location
    Wroclaw, Poland
    Posts
    1,394
    Thanked 342 Times in 324 Posts
    Qt products
    Qt4 Qt5
    Platforms
    MacOS X Unix/X11 Windows Android

    Default Re: Marching Ant effect at the border of QRect

    Maybe set dash pattern for QPen to [ ant_length, ant_space ] and use QTimer to animate dash offset ?

  3. #3
    Join Date
    Apr 2011
    Posts
    39
    Thanks
    1
    Qt products
    Qt3 Qt4
    Platforms
    Unix/X11 Windows

    Default Re: Marching Ant effect at the border of QRect

    me too thinking the same but,
    if you have some hint then kindly share it with me.
    so that I got some idea.
    how to put the first step,
    it will be definitely lead to some solution.

  4. #4
    Join Date
    Sep 2009
    Location
    Wroclaw, Poland
    Posts
    1,394
    Thanked 342 Times in 324 Posts
    Qt products
    Qt4 Qt5
    Platforms
    MacOS X Unix/X11 Windows Android

    Default Re: Marching Ant effect at the border of QRect

    if you have some hint then kindly share it with me.
    I already did. Keep the pen (with prepared dash pattern) as a member of some QObject-based class that will start the timer (maybe subclass of QGraphicsScene), and on each tick update the dash offset property of the pen. Next, assign this pen to your rect item and call rect->update(). If you move with the dash offset from 0 to ant_length + ant_space (and again from 0) it will look like the moving border, which is what you want to achieve, if I understood correctly.
    I won't give any code, until I see some of yours

  5. #5
    Join Date
    Apr 2011
    Posts
    39
    Thanks
    1
    Qt products
    Qt3 Qt4
    Platforms
    Unix/X11 Windows

    Default Re: Marching Ant effect at the border of QRect

    Thanks man,
    It works and I got what I want.
    Thanks a lot man,

    You helped me a lot yaar,
    Thanks again,

    In future also help if I post some problem,
    okay.

Similar Threads

  1. Replies: 2
    Last Post: 21st March 2012, 14:30
  2. Cannot use QRect::setWidth
    By WilliamSpiderWeb in forum Newbie
    Replies: 3
    Last Post: 4th March 2011, 15:45
  3. AddText to QRect on QGraphicsView
    By mohini in forum Qt Programming
    Replies: 4
    Last Post: 17th February 2011, 21:43
  4. Get QRect of a widget using mouseevent
    By arpspatel in forum Qt Programming
    Replies: 9
    Last Post: 9th March 2010, 04:19
  5. Move QCompleter on QRect x,y
    By patrik08 in forum Qt Programming
    Replies: 1
    Last Post: 8th August 2007, 10:33

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.