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. Where are the Signals?
Qt 6.11 is out! See what's new in the release blog

Where are the Signals?

Scheduled Pinned Locked Moved Solved General and Desktop
10 Posts 4 Posters 3.0k 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.
  • lonnieL Offline
    lonnieL Offline
    lonnie
    wrote on last edited by
    #1

    Am I missing something or does the QTextEdit widget not have a signal for key pressed , especially return to let you know that the user has accepted the input?

    I might also be missing the obvious, but QPushButton seems to have no signals at all, according to the class reference. I would expect a mouse click at least.

    If the class reference in Help is wrong, is there any sort of definitive list signals?

    J.HilkJ 1 Reply Last reply
    0
    • lonnieL lonnie

      Am I missing something or does the QTextEdit widget not have a signal for key pressed , especially return to let you know that the user has accepted the input?

      I might also be missing the obvious, but QPushButton seems to have no signals at all, according to the class reference. I would expect a mouse click at least.

      If the class reference in Help is wrong, is there any sort of definitive list signals?

      J.HilkJ Offline
      J.HilkJ Offline
      J.Hilk
      Moderators
      wrote on last edited by
      #2

      @lonnie hi,
      IIRC QTextEdit has no Signal for that, you'll have to derive that class if you want such signals. However you should look into QTextEdit, that one has build in Signals you want.

      void	editingFinished()
      void	returnPressed()
      

      QPushButton has no own new Signals, however it inherits from QAbstractButton, therefore it has Signals

      void	clicked(bool checked = false)
      void	pressed()
      void	released()
      void	toggled(bool checked)
      

      Be aware of the Qt Code of Conduct, when posting : https://forum.qt.io/topic/113070/qt-code-of-conduct


      Q: What's that?
      A: It's blue light.
      Q: What does it do?
      A: It turns blue.

      lonnieL 1 Reply Last reply
      1
      • sneubertS Offline
        sneubertS Offline
        sneubert
        wrote on last edited by
        #3

        Hi Ionnie,

        there is a virtual protected keyPressed Event in QTextEdit inherited from QWidget. So you can subclass QTextEdit and overwrite it.

        For QPushButton the signal is inheited from QAbstractButton as you can see here:
        http://doc.qt.io/qt-5/qabstractbutton.html#clicked

        For a definite list you can click on "List of all members, including inherited members" in Help of a Class.

        lonnieL 2 Replies Last reply
        0
        • lonnieL Offline
          lonnieL Offline
          lonnie
          wrote on last edited by
          #4

          Skip this post. Sorry.

          QPushButton does in fact have a clicked signal. The help is a bit deficient and that is frustrating because it, at first, seemed to be so well done and thorough. Now I am seeing it is "mostly" well done and rough around the edges. I got quite used to the trial and error method in C#, so I guess I am back to that.

          QTextEdit emits signals for textChanged but only when the widget is initially loaded. Nothing happens when I type a bunch of stuff and hit enter. Kind of makes it difficult if you wanted to validate the contents before moving to another field.

          Note to others:

          I found this out by messing with the line:
          connect(edit, SIGNAL(textChanged()), this, SLOT(on_lineEditReturn()));

          Just edit it to become: connect(edit, SIGNAL)), this, SLOT(on_lineEditReturn()));
          and as soon as you type the opening bracket after SIGNAL it pops up a list of the available signals. Very helpful.

          VRoninV 1 Reply Last reply
          0
          • sneubertS sneubert

            Hi Ionnie,

            there is a virtual protected keyPressed Event in QTextEdit inherited from QWidget. So you can subclass QTextEdit and overwrite it.

            For QPushButton the signal is inheited from QAbstractButton as you can see here:
            http://doc.qt.io/qt-5/qabstractbutton.html#clicked

            For a definite list you can click on "List of all members, including inherited members" in Help of a Class.

            lonnieL Offline
            lonnieL Offline
            lonnie
            wrote on last edited by
            #5

            @sneubert said in Where are the Signals?:

            For a definite list you can click on "List of all members, including inherited members" in Help of a Class.

            Very helpful thanks. I guess I was distracted by the fact that some of the Class References list all the Slots and Signals.

            1 Reply Last reply
            1
            • J.HilkJ J.Hilk

              @lonnie hi,
              IIRC QTextEdit has no Signal for that, you'll have to derive that class if you want such signals. However you should look into QTextEdit, that one has build in Signals you want.

              void	editingFinished()
              void	returnPressed()
              

              QPushButton has no own new Signals, however it inherits from QAbstractButton, therefore it has Signals

              void	clicked(bool checked = false)
              void	pressed()
              void	released()
              void	toggled(bool checked)
              
              lonnieL Offline
              lonnieL Offline
              lonnie
              wrote on last edited by lonnie
              #6

              @J.Hilk said in Where are the Signals?:

              However you should look into QTextEdit, that one has build in Signals you want.

              Thanks. I assume you meant QLineEdit which does seem to have a BUNCH of things. I guess it is time to step away from the keyboard and do some in depth class info skimming. Also, I need to forget C#. haha

              J.HilkJ 1 Reply Last reply
              0
              • lonnieL lonnie

                @J.Hilk said in Where are the Signals?:

                However you should look into QTextEdit, that one has build in Signals you want.

                Thanks. I assume you meant QLineEdit which does seem to have a BUNCH of things. I guess it is time to step away from the keyboard and do some in depth class info skimming. Also, I need to forget C#. haha

                J.HilkJ Offline
                J.HilkJ Offline
                J.Hilk
                Moderators
                wrote on last edited by
                #7

                @lonnie
                you assume correct x) copy past error on my side. SORRY!


                Be aware of the Qt Code of Conduct, when posting : https://forum.qt.io/topic/113070/qt-code-of-conduct


                Q: What's that?
                A: It's blue light.
                Q: What does it do?
                A: It turns blue.

                1 Reply Last reply
                0
                • sneubertS sneubert

                  Hi Ionnie,

                  there is a virtual protected keyPressed Event in QTextEdit inherited from QWidget. So you can subclass QTextEdit and overwrite it.

                  For QPushButton the signal is inheited from QAbstractButton as you can see here:
                  http://doc.qt.io/qt-5/qabstractbutton.html#clicked

                  For a definite list you can click on "List of all members, including inherited members" in Help of a Class.

                  lonnieL Offline
                  lonnieL Offline
                  lonnie
                  wrote on last edited by
                  #8

                  @sneubert I will have to look at subclassing because I want the multiline capability of QTextEdit. Only problem, and I see why it was left out, is that Enter is not the end of edit in a Multiline. It merely inserts another line. I'll take at look at the Focus events.

                  Thanks for your suggestion.

                  1 Reply Last reply
                  0
                  • lonnieL lonnie

                    Skip this post. Sorry.

                    QPushButton does in fact have a clicked signal. The help is a bit deficient and that is frustrating because it, at first, seemed to be so well done and thorough. Now I am seeing it is "mostly" well done and rough around the edges. I got quite used to the trial and error method in C#, so I guess I am back to that.

                    QTextEdit emits signals for textChanged but only when the widget is initially loaded. Nothing happens when I type a bunch of stuff and hit enter. Kind of makes it difficult if you wanted to validate the contents before moving to another field.

                    Note to others:

                    I found this out by messing with the line:
                    connect(edit, SIGNAL(textChanged()), this, SLOT(on_lineEditReturn()));

                    Just edit it to become: connect(edit, SIGNAL)), this, SLOT(on_lineEditReturn()));
                    and as soon as you type the opening bracket after SIGNAL it pops up a list of the available signals. Very helpful.

                    VRoninV Offline
                    VRoninV Offline
                    VRonin
                    wrote on last edited by
                    #9

                    @lonnie said in Where are the Signals?:

                    Nothing happens when I type a bunch of stuff and hit enter.

                    that's when editingFinished() gets emitted

                    @lonnie said in Where are the Signals?:

                    Kind of makes it difficult if you wanted to validate the contents before moving to another field.

                    That's what QValidator and its subclasses are for. You can use QTextEdit::setValidator to apply it to your edit

                    "La mort n'est rien, mais vivre vaincu et sans gloire, c'est mourir tous les jours"
                    ~Napoleon Bonaparte

                    On a crusade to banish setIndexWidget() from the holy land of Qt

                    lonnieL 1 Reply Last reply
                    4
                    • VRoninV VRonin

                      @lonnie said in Where are the Signals?:

                      Nothing happens when I type a bunch of stuff and hit enter.

                      that's when editingFinished() gets emitted

                      @lonnie said in Where are the Signals?:

                      Kind of makes it difficult if you wanted to validate the contents before moving to another field.

                      That's what QValidator and its subclasses are for. You can use QTextEdit::setValidator to apply it to your edit

                      lonnieL Offline
                      lonnieL Offline
                      lonnie
                      wrote on last edited by
                      #10

                      @VRonin hehe, I'm not used to having things done for me. I never had validators and had to do it all myself. I will check the validator out.

                      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