LineEdit Signal
-
You're welcome.. Please have a look at the "doc":http://qt-project.org/doc/qt-4.8/qlabel.html#note-139 note.
Also notice
bq. To make sure other funcionality still works, you also need to call the base class implementation of the event.
in the doc note.
-
Okay ...thanks again
:) -
I think I would listen for the focusIn event. For your goal, it sounds like it makes more sense than a clicked signal, as it would also respond to focus changes having other causes (tab key anyone?) than a mouse click.
-
Am not sure about focus event the interface here in my case is a touchscreen
:( -
Your widget still gets focus. And it can still get that in other ways than clicking on it.
-
How ?? Please explain.....
-
It could get focus by code, or by virtue of the focus being pushed away from a control that becomes invisible or disabled, for instance.
-
I implemented the click signal through event filters and it is working fine.
-
Thanks everyone.....:)
-
moderators note: Please don't reply to your own messages (especially after such a short time), edit the previous message instead. You know how that works, as you already edited your followup-up question.
-
:(
Can anyone help me in understanding eventfilters.....I need to implement eventfilters method for two different object but same type again here the slot is different for each object
How to do it?
what to write in installeventfilters()Please help
-
The trick is to check the object argument in your event filter implementation.
However, it sounds like you want to have several widgets that all get the 'clicked' signal. How about you just build a re-usable component instead?
Simply subclass QLineEdit, and add your clicked signal. Implement it the way you like (using an event filter if you want, though I don't think you need it) to emit the clicked signal. Now, simply use your own class instead of QLineEdit where appropriate.
-
I have different LineEdits, which have different slots....so but all should have same signal "click"
-
Do you mean that these line edits should connect to different slots? If so, I stand by my previous advise: actually create your own LineEditWithClickedSignal class (or whatever you want to know it), and use that class instead of QLineEdit. Then, connect the clicked signal to whatever slot you need. Compare how you can connect the clicked signal of different QPushButtons on your form to different slots as well.
-
Yeah I have to connect different Linedit with different slots but signal in each case shall be "click"
Thanks Andre, will follow your advice, this looks much simpler, hope it will be little easy while implementing also.
:)
But still there is 1 more doubt....will it b possible to use my own linedit, when the LineEdit I meant to use is the one from ui_classname.h file?
-
[quote author="pragati" date="1347357263"]But still there is 1 more doubt....will it b possible to use my own linedit, when the LineEdit I meant to use is the one from ui_classname.h file?[/quote]
Yes. Look for widget promotion in the Qt Designer documentation. -
Great!!!
Thanks... -
:(
Got my lineEdit working as wanted, but am not able to use LineEdits's all functionalities....like setText, and many more.
I need all those too....Is there not any other way with same requirement apart from defining my own class
-
Show us the code then. We can't guess what you're doing wrong if you don't show us what you have.
-
Okay I will do that....But before that I want to ask that
I have a custom lineEdit which inherits from QLineEdit, defines its own click signal. Now if I use my custom lineEdit in my code will it be able to still use all other signals and slots of QLineEdit, or I have to define them again.