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 as editor in QStyledItemDelegate
Qt 6.11 is out! See what's new in the release blog

QComboBox as editor in QStyledItemDelegate

Scheduled Pinned Locked Moved Unsolved General and Desktop
7 Posts 4 Posters 2.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.
  • DonCoderD Offline
    DonCoderD Offline
    DonCoder
    wrote on last edited by
    #1
    1. The combobox editor has to be created wehn user presses enter/ mouse double click
    2. The combo box is editable, So i should allow the user to change item of combo box using up/down arrow keys. and should close it when he presses enter
    3. for mouse click i should close is when user selected any index.

    Now i tried to handle currentChangedIndex for mouseclick. But this has an issue. when i changes item using arrow key the current changed Index is getting triggered and the ediotor is getting closed on currentChangedIndex signal... ANy Suggessions plzzz

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

      Hi,

      Can you show the code you are currently using ?

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

      1 Reply Last reply
      0
      • DonCoderD DonCoder
        1. The combobox editor has to be created wehn user presses enter/ mouse double click
        2. The combo box is editable, So i should allow the user to change item of combo box using up/down arrow keys. and should close it when he presses enter
        3. for mouse click i should close is when user selected any index.

        Now i tried to handle currentChangedIndex for mouseclick. But this has an issue. when i changes item using arrow key the current changed Index is getting triggered and the ediotor is getting closed on currentChangedIndex signal... ANy Suggessions plzzz

        C Offline
        C Offline
        ChrisW67
        wrote on last edited by
        #3

        @DonCoder said in QComboBox as editor in QStyledItemDelegate:

        1. for mouse click i should close is when user selected any index.

        Now i tried to handle currentChangedIndex for mouseclick. But this has an issue. when i changes item using arrow key the current changed Index is getting triggered and the ediotor is getting closed on currentChangedIndex signal... ANy Suggessions plzzz

        QComboBox::activated()?

        DonCoderD 1 Reply Last reply
        0
        • C ChrisW67

          @DonCoder said in QComboBox as editor in QStyledItemDelegate:

          1. for mouse click i should close is when user selected any index.

          Now i tried to handle currentChangedIndex for mouseclick. But this has an issue. when i changes item using arrow key the current changed Index is getting triggered and the ediotor is getting closed on currentChangedIndex signal... ANy Suggessions plzzz

          QComboBox::activated()?

          DonCoderD Offline
          DonCoderD Offline
          DonCoder
          wrote on last edited by
          #4

          @ChrisW67 : Same with QComboBox::activated() , it is coming upon pressing up/down arrow

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

            Looks like QComboBox::textActivated is what you want for the user selection part.

            For the editing part, you should connect the QComboBox line edit editingFinished signal.

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

            DonCoderD 1 Reply Last reply
            0
            • SGaistS SGaist

              Looks like QComboBox::textActivated is what you want for the user selection part.

              For the editing part, you should connect the QComboBox line edit editingFinished signal.

              DonCoderD Offline
              DonCoderD Offline
              DonCoder
              wrote on last edited by
              #6

              @SGaist Yes, But that is available from Qt 5.14. My Application is using 5.9 version. So is there an alternative that can mimic QComboBox::textActivated in Qt 5.9 ?

              1 Reply Last reply
              0
              • Christian EhrlicherC Offline
                Christian EhrlicherC Offline
                Christian Ehrlicher
                Lifetime Qt Champion
                wrote on last edited by
                #7

                https://doc.qt.io/qt-5/qcombobox-obsolete.html#activated-1

                Qt Online Installer direct download: https://download.qt.io/official_releases/online_installers/
                Visit the Qt Academy at https://academy.qt.io/catalog

                1 Reply Last reply
                1

                • Login

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