Important: Please read the Qt Code of Conduct -

Completer should use an extern library to complete the path

  • In a first try I created a simple tree, where the user can give a symbol via a dialog window (for example a symbol that belongs to a class "sym"). This string is then transferd to a function of a QAbstractItemModel symbolModel, that checks in a external library if this symbol is existing. If it is existing, it creates an AbstactItem for it and in a recursive call all members (for example "foo") of the class are added to the AbstractItem as children (""). With that I can represent the symbols with QTreeView.

    Now in a next step, I want that there is a completer that helps the user to write the possible symbols. But all the possible symbols are in an external library (or on a drive ) and not yet in a model, since I just want the symbols in the model symbolModel that are really needed by the user.

    My only idea is to create an intermediateModel (maybe a QStringListModel) that saves all symbols that start with the first letter given by the user. As soon as the user gives a second letter, the intermediateModel deletes all "twigs" that do not match the second letter (and holds just a subset of the start set). As soon as the user has decided which symbol it should be, this one will then be delegated to the QAbstractItemModel that is used by the QTreeView.

    Does somebody know, how I can code this? Thanks a lot for any help

  • Lifetime Qt Champion

    Hi and welcome to devnet,

    Why not parse that external data at the start of your application to build the data for your completer ?

Log in to reply