Results 1 to 4 of 4

Thread: How to make a such button? Need help quick

  1. #1
    Join Date
    May 2013
    Posts
    3
    Platforms
    Windows

    Default How to make a such button? Need help quick

    Hey everyone
    I have some kind of a project in my mind and i need some advice to be able to program it. So all i need to do create 1 basic button. When people click the button, the button will move horizontally back and forth (kinda like a wave) for some certain amount of time. I watched many tutorials but i couldnt find anything similar so if you guys have any ideas how to build something like this it would be so great if you would share some ideas with me.
    Anyway thank you and have a nice day

  2. #2
    Join Date
    Sep 2011
    Posts
    1,245
    Thanks
    3
    Thanked 127 Times in 126 Posts
    Qt products
    Qt4
    Platforms
    Windows

    Default Re: How to make a such button? Need help quick

    Make an empty widget to hold the button.
    Make a button
    Make a timer
    Attach clicked() signal of the button to start the timer
    Attach timeout signal of the timer to some slot that moves the position of the button in the form (need to check for 'collisions' with the edge of the form here)

    I'll leave up to you to figure how to deal with stopping the button moving.
    If you have a problem, CUT and PASTE your code. Do not retype or simplify it. Give a COMPLETE and COMPILABLE example of your problem. Otherwise we are all guessing the problem from a fabrication where relevant details are often missing.

  3. #3
    Join Date
    Mar 2009
    Location
    Brisbane, Australia
    Posts
    7,546
    Thanks
    13
    Thanked 1,578 Times in 1,507 Posts
    Qt products
    Qt4 Qt5
    Platforms
    Unix/X11 Windows
    Wiki edits
    17

    Default Re: How to make a such button? Need help quick

    QPropertyAnimation will probably be of interest

  4. #4
    Join Date
    Jan 2006
    Location
    Warsaw, Poland
    Posts
    33,363
    Thanks
    3
    Thanked 5,012 Times in 4,791 Posts
    Qt products
    Qt3 Qt4 Qt5 Qt/Embedded
    Platforms
    Unix/X11 Windows Android Maemo/MeeGo
    Wiki edits
    10

    Default Re: How to make a such button? Need help quick

    Your biological and technological distinctiveness will be added to our own. Resistance is futile.

    Please ask Qt related questions on the forum and not using private messages or visitor messages.


  5. The following user says thank you to wysota for this useful post:


Similar Threads

  1. Replies: 20
    Last Post: 3rd February 2013, 18:07
  2. how to make one button to do two functions
    By Shien in forum Qt Programming
    Replies: 1
    Last Post: 2nd January 2011, 20:18
  3. Replies: 13
    Last Post: 21st May 2009, 07:43
  4. How to make dropdown button bigger
    By Vadi in forum Qt Programming
    Replies: 1
    Last Post: 13th November 2008, 23:54

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
  •  
Digia, Qt and their respective logos are trademarks of Digia Plc in Finland and/or other countries worldwide.