Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • Users
  • Groups
  • Search
  • Get Qt Extensions
  • Unsolved
Collapse
Brand Logo
  1. Home
  2. Qt Development
  3. General and Desktop
  4. LineEdit Signal
Forum Updated to NodeBB v4.3 + New Features

LineEdit Signal

Scheduled Pinned Locked Moved General and Desktop
27 Posts 3 Posters 13.3k Views 1 Watching
  • Oldest to Newest
  • Newest to Oldest
  • Most Votes
Reply
  • Reply as topic
Log in to reply
This topic has been deleted. Only users with topic management privileges can see it.
  • P Offline
    P Offline
    pragati
    wrote on last edited by
    #1

    Hi All,

    Like a pushbutton, can lineEdit have a signal "clicked"
    It seems cursorpositionchanged signal(int, int) similiar to clicked signal but this signal works only once.
    Suppose, I have a slot to open another widget like a keypad when this signal is emitted. Now this signal "cursorpositionchanged signal(int, int)" opens keypad only once, if I try to do it again it wont. It works again only if I close the prog. and run it again.

    Dont have any idea about cursorpositionchanged signal(int old, intnew) signal, how to implement it.

    Any suggestions

    Thanks

    1 Reply Last reply
    0
    • R Offline
      R Offline
      Rahul Das
      wrote on last edited by
      #2

      You can emit "Clicked" signal from lineEdit. Subclass and implement your own signals.

      Similarly, there is no "Clicked" signal for QLabel as well. "Here":http://qt-project.org/wiki/Make-a-QLabel-Clickable is the wiki how to make it.


      Declaration of (Platform) independence.

      1 Reply Last reply
      0
      • P Offline
        P Offline
        pragati
        wrote on last edited by
        #3

        Thanks Rahul....
        I was just trying to find some other option other than defining own signal.....but I guess this is the only option

        anyways ....thanks a lot!!!

        1 Reply Last reply
        0
        • R Offline
          R Offline
          Rahul Das
          wrote on last edited by
          #4

          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.


          Declaration of (Platform) independence.

          1 Reply Last reply
          0
          • P Offline
            P Offline
            pragati
            wrote on last edited by
            #5

            Okay ...thanks again
            :)

            1 Reply Last reply
            0
            • A Offline
              A Offline
              andre
              wrote on last edited by
              #6

              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.

              1 Reply Last reply
              0
              • P Offline
                P Offline
                pragati
                wrote on last edited by
                #7

                Am not sure about focus event the interface here in my case is a touchscreen
                :(

                1 Reply Last reply
                0
                • A Offline
                  A Offline
                  andre
                  wrote on last edited by
                  #8

                  Your widget still gets focus. And it can still get that in other ways than clicking on it.

                  1 Reply Last reply
                  0
                  • P Offline
                    P Offline
                    pragati
                    wrote on last edited by
                    #9

                    How ?? Please explain.....

                    1 Reply Last reply
                    0
                    • A Offline
                      A Offline
                      andre
                      wrote on last edited by
                      #10

                      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.

                      1 Reply Last reply
                      0
                      • P Offline
                        P Offline
                        pragati
                        wrote on last edited by
                        #11

                        I implemented the click signal through event filters and it is working fine.

                        1 Reply Last reply
                        0
                        • P Offline
                          P Offline
                          pragati
                          wrote on last edited by
                          #12

                          Thanks everyone.....:)

                          1 Reply Last reply
                          0
                          • A Offline
                            A Offline
                            andre
                            wrote on last edited by
                            #13

                            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.

                            1 Reply Last reply
                            0
                            • P Offline
                              P Offline
                              pragati
                              wrote on last edited by
                              #14

                              :(

                              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

                              1 Reply Last reply
                              0
                              • A Offline
                                A Offline
                                andre
                                wrote on last edited by
                                #15

                                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.

                                1 Reply Last reply
                                0
                                • P Offline
                                  P Offline
                                  pragati
                                  wrote on last edited by
                                  #16

                                  I have different LineEdits, which have different slots....so but all should have same signal "click"

                                  1 Reply Last reply
                                  0
                                  • A Offline
                                    A Offline
                                    andre
                                    wrote on last edited by
                                    #17

                                    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.

                                    1 Reply Last reply
                                    0
                                    • P Offline
                                      P Offline
                                      pragati
                                      wrote on last edited by
                                      #18

                                      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?

                                      1 Reply Last reply
                                      0
                                      • A Offline
                                        A Offline
                                        andre
                                        wrote on last edited by
                                        #19

                                        [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.

                                        1 Reply Last reply
                                        0
                                        • P Offline
                                          P Offline
                                          pragati
                                          wrote on last edited by
                                          #20

                                          Great!!!
                                          Thanks...

                                          1 Reply Last reply
                                          0

                                          • Login

                                          • Login or register to search.
                                          • First post
                                            Last post
                                          0
                                          • Categories
                                          • Recent
                                          • Tags
                                          • Popular
                                          • Users
                                          • Groups
                                          • Search
                                          • Get Qt Extensions
                                          • Unsolved