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. QComboBox, how to detect user edits
Forum Updated to NodeBB v4.3 + New Features

QComboBox, how to detect user edits

Scheduled Pinned Locked Moved Unsolved General and Desktop
7 Posts 4 Posters 560 Views
  • 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.
  • B Offline
    B Offline
    Buller
    wrote on last edited by
    #1

    I have got an editable QComboBox and wish to detect when the text changes due to a user edits (i.e. when the user types) , but I do not want a signal when the text is changed from code. Is there a way to do that?

    JonBJ 1 Reply Last reply
    0
    • B Offline
      B Offline
      Bonnie
      wrote on last edited by
      #2

      Use QLineEdit::textEdited(const QString &text) signal of QComboBox::lineEdit().

      1 Reply Last reply
      4
      • B Buller

        I have got an editable QComboBox and wish to detect when the text changes due to a user edits (i.e. when the user types) , but I do not want a signal when the text is changed from code. Is there a way to do that?

        JonBJ Online
        JonBJ Online
        JonB
        wrote on last edited by
        #3

        @Buller
        As @Bonnie has said. Note the docs difference between https://doc.qt.io/qt-5/qlineedit.html#textChanged versus https://doc.qt.io/qt-5/qlineedit.html#textEdited, which is what you are asking about.

        1 Reply Last reply
        1
        • B Offline
          B Offline
          Buller
          wrote on last edited by
          #4

          @Buller said in QComboBox, how to detect user edits:

          QComboBox

          The problem is that I cannot input the QComboBox's QLineEdit::textEdited to connect. What I think I need is:
          connect(m_combo_name, &QComboBox::QLineEdit::textEdited, this, &MyWidget::slot_handle_text);
          But "&QComboBox::QLineEdit::textEdited" is not valid syntax. Neither is "&QComboBox::textEdited". So what is the correct syntax here?

          J.HilkJ B 2 Replies Last reply
          0
          • B Buller

            @Buller said in QComboBox, how to detect user edits:

            QComboBox

            The problem is that I cannot input the QComboBox's QLineEdit::textEdited to connect. What I think I need is:
            connect(m_combo_name, &QComboBox::QLineEdit::textEdited, this, &MyWidget::slot_handle_text);
            But "&QComboBox::QLineEdit::textEdited" is not valid syntax. Neither is "&QComboBox::textEdited". So what is the correct syntax here?

            J.HilkJ Online
            J.HilkJ Online
            J.Hilk
            Moderators
            wrote on last edited by
            #5

            @Buller
            editTextChanged probably

            https://doc.qt.io/qt-5/qcombobox.html#editTextChanged


            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
            2
            • B Buller

              @Buller said in QComboBox, how to detect user edits:

              QComboBox

              The problem is that I cannot input the QComboBox's QLineEdit::textEdited to connect. What I think I need is:
              connect(m_combo_name, &QComboBox::QLineEdit::textEdited, this, &MyWidget::slot_handle_text);
              But "&QComboBox::QLineEdit::textEdited" is not valid syntax. Neither is "&QComboBox::textEdited". So what is the correct syntax here?

              B Offline
              B Offline
              Bonnie
              wrote on last edited by Bonnie
              #6

              @Buller I expected a developer would figure this out with these enough information...fine...

              connect(m_combo_name->lineEdit(), &QLineEdit::textEdited, this, &MyWidget::slot_handle_text);
              
              1 Reply Last reply
              1
              • B Offline
                B Offline
                Buller
                wrote on last edited by
                #7

                @Bonnie said in QComboBox, how to detect user edits:

                m_combo_name->lineEdit()

                m_combo_name->lineEdit() works. 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