Results 1 to 5 of 5

Thread: how to call a function when i enter and leave a qpushbutton

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

    Default how to call a function when i enter and leave a qpushbutton

    how to call a function when i enter and leave a qpushbutton.
    I have to change the style sheet on enter and leave of pushbutton.
    It works in stylesheets
    Qt Code:
    1. ui->savename->setStyleSheet("QPushButton{background-repeat:no-repeat; background:none; border:none; background-image: url(images/PlayernamesaveOff.png);} QPushButton:hover{background-repeat:no-repeat; background:none; border:none; background-image:url(images/PlayernamesaveOn.png)};");
    To copy to clipboard, switch view to plain text mode 


    when i resize my window resize event is called. I resize event i change the size of my pushbutton also.Since the picture does not resize i used seticon property and set the image as scaled pixmap. Its works but i cannot apply the mouse over and leave effects

  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: how to call a function when i enter and leave a qpushbutton

    how to call a function when i enter and leave a qpushbutton.
    Reimplement QWidget::enterEvent and QWidget::leaveEvent

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

    Default Re: how to call a function when i enter and leave a qpushbutton

    how can i reimplement enterevent. Some more help needed pls... example codes???

  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: how to call a function when i enter and leave a qpushbutton

    Create a subclass of QPushButton and re-define needed methods there, its basic C++

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

    Default Re: how to call a function when i enter and leave a qpushbutton

    k fine i will do it

Similar Threads

  1. QPushButton signal enter/leave
    By felo188 in forum Qt Programming
    Replies: 7
    Last Post: 23rd May 2014, 19:40
  2. Qt widget enter/leave event
    By bunjee in forum Qt Programming
    Replies: 11
    Last Post: 28th April 2014, 03:09
  3. Replies: 2
    Last Post: 11th August 2011, 10:55
  4. QGraphicsItem can't receive mouse leave/enter event
    By wshn13 in forum Qt Programming
    Replies: 1
    Last Post: 22nd June 2011, 08:32
  5. Tooltip enter/leave event.
    By bunjee in forum Qt Programming
    Replies: 3
    Last Post: 15th December 2007, 11:46

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.