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 & QAbstractItemModel - editable/filtering
QtWS25 Last Chance

QComboBox & QAbstractItemModel - editable/filtering

Scheduled Pinned Locked Moved Solved General and Desktop
qcomboboxqabstractitemmo
3 Posts 2 Posters 1.2k 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.
  • D Offline
    D Offline
    Dariusz
    wrote on 27 Apr 2019, 07:05 last edited by aha_1980
    #1

    Hey

    What function do I have to implement in my abstract model to allow for filtering to work when I plug the model inside combo box? I'm trying to select item/filter while typing - have auto complete...

    I've set combo->setView(new QTreeView()) as well as combo->setView(new myTree()) neither seem to affect it so it must be model related?

    TIA


    Edit I actually even struggle to get text display in the comboBox line edit from model items... hmmm what do I need to link it properly?


    Did more digging, still no luck, none of signals/slots in QComboWidget return a QModelIndex, thus if I click on item inside another item(child) then I get wrong index. As the index is relevant to rootItem not parentItem... oh dear...

    Trying to get a signal from treeView directly seem to not work either?

        connect(mCombo_scene->view(), &QAbstractItemView::activated, [=](const QModelIndex &index) {
            qDebug() << "EH?  " <<"I got correct Index?";
            //mCombo_scene->setCurrentText(index.data(Qt::DisplayRole).toString());
        });
    
    1 Reply Last reply
    0
    • S Offline
      S Offline
      SGaist
      Lifetime Qt Champion
      wrote on 27 Apr 2019, 21:06 last edited by
      #2

      Hi,

      This Wiki entry gives a good starting point.

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

      D 1 Reply Last reply 28 Apr 2019, 07:19
      4
      • S SGaist
        27 Apr 2019, 21:06

        Hi,

        This Wiki entry gives a good starting point.

        D Offline
        D Offline
        Dariusz
        wrote on 28 Apr 2019, 07:19 last edited by
        #3

        @SGaist Awesome thanks! I think I can get it to do my bad biding now :- )

        1 Reply Last reply
        0

        2/3

        27 Apr 2019, 21:06

        • Login

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