Results 1 to 15 of 15

Thread: How to create a mouse offer effect for pushbuttons??

Hybrid View

Previous Post Previous Post   Next Post Next Post
  1. #1
    Join Date
    Jul 2011
    Posts
    81
    Qt products
    Qt4
    Platforms
    Windows Symbian S60 Maemo/MeeGo
    Thanks
    8
    Thanked 2 Times in 2 Posts

    Default How to create a mouse offer effect for pushbuttons??

    How can i provide mouse over effect to all the pushbuttons in my mainwindow??

  2. #2
    Join Date
    Oct 2010
    Location
    Berlin, Germany
    Posts
    358
    Qt products
    Qt4
    Platforms
    Windows
    Thanks
    18
    Thanked 68 Times in 66 Posts

    Default Re: How to create a mouse offer effect for pushbuttons??

    use stylesheets:

    setStyleSheet(QPushbutton:hover{background-color: red;});

  3. #3
    Join Date
    Jul 2011
    Posts
    81
    Qt products
    Qt4
    Platforms
    Windows Symbian S60 Maemo/MeeGo
    Thanks
    8
    Thanked 2 Times in 2 Posts

    Default Re: How to create a mouse offer effect for pushbuttons??

    i have already used stylesheet background image fro button. I just want to bounce or zoom the button a little on mouse over

  4. #4
    Join Date
    Oct 2010
    Location
    Berlin, Germany
    Posts
    358
    Qt products
    Qt4
    Platforms
    Windows
    Thanks
    18
    Thanked 68 Times in 66 Posts

    Default Re: How to create a mouse offer effect for pushbuttons??

    it was just a demonstration how to use the ":hover"-property. you can define anything you want... larger text, other border color, other text color, other margins etc...

  5. #5
    Join Date
    Jul 2011
    Posts
    81
    Qt products
    Qt4
    Platforms
    Windows Symbian S60 Maemo/MeeGo
    Thanks
    8
    Thanked 2 Times in 2 Posts

    Default Re: How to create a mouse offer effect for pushbuttons??

    Qt Code:
    1. ui->pushButton->setStyleSheet("hover{background-color:red};");
    To copy to clipboard, switch view to plain text mode 
    I have used the code in my constructor. even if it doesnot work??

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

    Default Re: How to create a mouse offer effect for pushbuttons??

    It is :hover, not hover.
    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.


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

    athulms (15th September 2011)

Similar Threads

  1. Replies: 2
    Last Post: 22nd April 2011, 14:38
  2. Create PushButtons in Loop
    By homerun4711 in forum Newbie
    Replies: 4
    Last Post: 8th December 2010, 12:39
  3. Replies: 3
    Last Post: 12th May 2010, 14:11
  4. Water waves effect at mouse passage
    By QAlex in forum Qt Programming
    Replies: 0
    Last Post: 24th November 2009, 09:46
  5. Replies: 9
    Last Post: 5th March 2006, 04:31

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
  •  
Qt is a trademark of The Qt Company.