PDA

View Full Version : QPushButton signal enter/leave



felo188
25th August 2011, 14:24
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?

high_flyer
25th August 2011, 14:26
You can either subclass and re implement enterEvent() and leaveEvent() or as you suggested, install and event filter to catch these events,

felo188
25th August 2011, 14:38
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.
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?

high_flyer
25th August 2011, 15:07
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?

felo188
25th August 2011, 15:25
What do You mean writing re implement. Maybe problem is my level of english and i don't understand exactly what You wrote.

high_flyer
25th August 2011, 15:50
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.

stampede
25th August 2011, 22:20
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?


class Base{
public:
virtual void method(){ print("method from Base class") }
};

class Derived : public Base{
public:
void method(){ print("method from Derived class") }
// method() is re-implemented in Derived class
};

emadpres
23rd May 2014, 19:40
Hi,
Check out my answer in Stackoverflow here (http://stackoverflow.com/questions/9261175/how-to-do-that-when-the-mouse-pointer-hovers-over-a-qpushbutton-then-the-button/23836186#23836186)and vote it up if you like.