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 signal when user types text and presses Enter
Forum Updated to NodeBB v4.3 + New Features

QComboBox signal when user types text and presses Enter

Scheduled Pinned Locked Moved Solved General and Desktop
6 Posts 4 Posters 1.2k Views 2 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.
  • T Offline
    T Offline
    Taytoo
    wrote on last edited by
    #1

    How do I get notified when a user types something in combobox edit box and presses enter? Tried editTextChanged but its fired each time a character is typed/erased.

    1 Reply Last reply
    0
    • SGaistS Offline
      SGaistS Offline
      SGaist
      Lifetime Qt Champion
      wrote on last edited by
      #2

      Hi,

      You can use the QLineEdit::editingFinished signal. QComboBox provides a getter for its QLineEdit that is available when in editable mode.

      Interested in AI ? www.idiap.ch
      Please read the Qt Code of Conduct - https://forum.qt.io/topic/113070/qt-code-of-conduct

      T 1 Reply Last reply
      4
      • SGaistS SGaist

        Hi,

        You can use the QLineEdit::editingFinished signal. QComboBox provides a getter for its QLineEdit that is available when in editable mode.

        T Offline
        T Offline
        Taytoo
        wrote on last edited by
        #3

        @SGaist Its working but combobox max item count is set to 5. I was hoping it will show the last 5 items in dropdown, however, once the dropdown fills up with 5 items then new items entered in the Edit are Not added. How do I change this behavior to mimic MRU?

        Is it possible to have 2 sticky items i.e. they always stay in the dropdown menu But remaining 3 items are MRU?

        jsulmJ 1 Reply Last reply
        0
        • T Taytoo

          @SGaist Its working but combobox max item count is set to 5. I was hoping it will show the last 5 items in dropdown, however, once the dropdown fills up with 5 items then new items entered in the Edit are Not added. How do I change this behavior to mimic MRU?

          Is it possible to have 2 sticky items i.e. they always stay in the dropdown menu But remaining 3 items are MRU?

          jsulmJ Offline
          jsulmJ Offline
          jsulm
          Lifetime Qt Champion
          wrote on last edited by
          #4

          @Taytoo said in QComboBox signal when user types text and presses Enter:

          then new items entered in the Edit are Not added

          Are you sure? You probably need to scroll in the drop down box to see new items at the bottom.

          https://forum.qt.io/topic/113070/qt-code-of-conduct

          T 1 Reply Last reply
          0
          • jsulmJ jsulm

            @Taytoo said in QComboBox signal when user types text and presses Enter:

            then new items entered in the Edit are Not added

            Are you sure? You probably need to scroll in the drop down box to see new items at the bottom.

            T Offline
            T Offline
            Taytoo
            wrote on last edited by
            #5

            @jsulm said in QComboBox signal when user types text and presses Enter:

            @Taytoo said in QComboBox signal when user types text and presses Enter:

            then new items entered in the Edit are Not added

            Are you sure? You probably need to scroll in the drop down box to see new items at the bottom.

            Yes, like I mentioned earlier, the problem is once you set maxCount (in my case 5) then no new items are added after 5 limit is reached. It keeps the first 5 items entered by the user, 6th, 7th etc items are not added.

            JonBJ 1 Reply Last reply
            0
            • T Taytoo

              @jsulm said in QComboBox signal when user types text and presses Enter:

              @Taytoo said in QComboBox signal when user types text and presses Enter:

              then new items entered in the Edit are Not added

              Are you sure? You probably need to scroll in the drop down box to see new items at the bottom.

              Yes, like I mentioned earlier, the problem is once you set maxCount (in my case 5) then no new items are added after 5 limit is reached. It keeps the first 5 items entered by the user, 6th, 7th etc items are not added.

              JonBJ Offline
              JonBJ Offline
              JonB
              wrote on last edited by
              #6

              @Taytoo
              Then (presumably) implement the desired behaviour yourself: keep the top 2 items, cycle the bottom 3 items as required when inserting a new item.

              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