Results 1 to 8 of 8

Thread: QPushButton signal enter/leave

  1. #1
    Join Date
    Jul 2011
    Posts
    19
    Thanks
    1
    Qt products
    Qt4
    Platforms
    Windows

    Default QPushButton signal enter/leave

    Hi.
    Is QPushButton have SIGNAL leave/enter? I don't see it. If no is some way to repalce leave and enter in eventFilter on Singals and Slots?

  2. #2
    Join Date
    Jan 2006
    Location
    Munich, Germany
    Posts
    4,714
    Thanks
    21
    Thanked 418 Times in 411 Posts
    Qt products
    Qt3 Qt4 Qt5 Qt/Embedded
    Platforms
    Unix/X11 Windows

    Default Re: QPushButton signal enter/leave

    You can either subclass and re implement enterEvent() and leaveEvent() or as you suggested, install and event filter to catch these events,

  3. #3
    Join Date
    Jul 2011
    Posts
    19
    Thanks
    1
    Qt products
    Qt4
    Platforms
    Windows

    Default Re: QPushButton signal enter/leave

    Quote Originally Posted by high_flyer View Post
    or as you suggested, install and event filter to catch these events,
    I'm using it now but i had to use Signals and Slots.
    Quote Originally Posted by high_flyer View Post
    You can either subclass and re implement enterEvent() and leaveEvent()
    I don't know exatly how to do it. Could You explain it on some code?

  4. #4
    Join Date
    Jan 2006
    Location
    Munich, Germany
    Posts
    4,714
    Thanks
    21
    Thanked 418 Times in 411 Posts
    Qt products
    Qt3 Qt4 Qt5 Qt/Embedded
    Platforms
    Unix/X11 Windows

    Default Re: QPushButton signal enter/leave

    I'm using it now but i had to use Signals and Slots.
    Fine, where is the problem?
    I don't know exactly how to do it. Could You explain it on some code?
    What exactly don't you understand?
    You do know how to subclass don't you?
    ==========================signature=============== ==================
    S.O.L.I.D principles (use them!):
    https://en.wikipedia.org/wiki/SOLID_...iented_design)

    Do you write clean code? - if you are TDD'ing then maybe, if not, your not writing clean code.

  5. #5
    Join Date
    Jul 2011
    Posts
    19
    Thanks
    1
    Qt products
    Qt4
    Platforms
    Windows

    Default Re: QPushButton signal enter/leave

    What do You mean writing re implement. Maybe problem is my level of english and i don't understand exactly what You wrote.

  6. #6
    Join Date
    Jan 2006
    Location
    Munich, Germany
    Posts
    4,714
    Thanks
    21
    Thanked 418 Times in 411 Posts
    Qt products
    Qt3 Qt4 Qt5 Qt/Embedded
    Platforms
    Unix/X11 Windows

    Default Re: QPushButton signal enter/leave

    well if you don't know what reimplementing means, either in English or in C++, then it will be hard to explain.
    Implementing a method is filling it with the actual logic it is supposed to do.
    Just like you implemented the eventFilter().
    If the event filter works for you, then leave it , its a good way to do it.
    ==========================signature=============== ==================
    S.O.L.I.D principles (use them!):
    https://en.wikipedia.org/wiki/SOLID_...iented_design)

    Do you write clean code? - if you are TDD'ing then maybe, if not, your not writing clean code.

  7. #7
    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: QPushButton signal enter/leave

    What do You mean writing re implement.
    I think "re-implementing" is quite common term in C++ domain. It's related to virtual methods, which you can "re-define" in new class to provide additional / different functionality for this class. Other common word is "override".
    Could You explain it on some code?
    Qt Code:
    1. class Base{
    2. public:
    3. virtual void method(){ print("method from Base class") }
    4. };
    5.  
    6. class Derived : public Base{
    7. public:
    8. void method(){ print("method from Derived class") }
    9. // method() is re-implemented in Derived class
    10. };
    To copy to clipboard, switch view to plain text mode 

  8. #8
    Join Date
    May 2014
    Posts
    1
    Qt products
    Qt5
    Platforms
    Unix/X11 Windows

    Cool Re: QPushButton signal enter/leave

    Hi,
    Check out my answer in Stackoverflow here and vote it up if you like.

Similar Threads

  1. Qt widget enter/leave event
    By bunjee in forum Qt Programming
    Replies: 11
    Last Post: 28th April 2014, 03:09
  2. Replies: 2
    Last Post: 11th August 2011, 10:55
  3. QGraphicsItem can't receive mouse leave/enter event
    By wshn13 in forum Qt Programming
    Replies: 1
    Last Post: 22nd June 2011, 08:32
  4. QPushbutton leave event
    By mikec in forum Qt Programming
    Replies: 2
    Last Post: 26th April 2010, 08:38
  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.