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. Combobox select line by letter

Combobox select line by letter

Scheduled Pinned Locked Moved General and Desktop
3 Posts 2 Posters 891 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.
  • S Offline
    S Offline
    skammers
    wrote on last edited by
    #1

    Hey!

    I have a combobox where I want to be able to just press any key on the keyboard and jump to the first line which starts with this letter. The problem is, it is working when the combobox is closed but still have the focus. But when you open the combobox and the drop down menu comes down, it doesnt work anymore? Guess the focus needs to be on the drop down menu? Is that correct? cant get it to work!

    Any help?

    @
    //Drop down menu for the language list
    ComboBox{
    id: comboBox;
    width: caText.width;
    model: languageList.langList;
    textRole: "langDescription";
    style: ComboBoxStyle{
    __dropDownStyle: MenuStyle{
    itemDelegate.label: Text {
    text: formatMnemonic(styleData.text, styleData.underlineMnemonic)
    color: __currentTextColor
    font.pixelSize: __labelFontPixelSize
    renderType: Text.NativeRendering
    }
    }
    }
    onPressedChanged: {
    focus = true;
    }

                    Keys.onPressed: {
                        console.log(currentIndex = languageList.sortByLetter(event.text, currentIndex));
                    }
    
                    }
    

    @

    1 Reply Last reply
    0
    • JeroentjehomeJ Offline
      JeroentjehomeJ Offline
      Jeroentjehome
      wrote on last edited by
      #2

      I would think you should do it yourself and catch the keypress event and find the first one in the list and set that index as focus.

      Greetz, Jeroen

      1 Reply Last reply
      0
      • S Offline
        S Offline
        skammers
        wrote on last edited by
        #3

        I do do it myself. I get the correct index, but that is only when the combobox is closed. When it is open it doesnt work.

        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