Important: Please read the Qt Code of Conduct -

How to update or create new model of QCompleter?

  • I'm try code:

    completeT = new QCompleter( listString, this );
    	completeT ->setCaseSensitivity( Qt::CaseInsensitive );
    	completeT ->setCompletionMode( QCompleter::PopupCompletion );
    	completeT ->setFilterMode( Qt::MatchContains );
    	ui->txt_lineEdit->setCompleter( completeT );

    and I update by code:

    completeT ->setModel( new QStringListModel( listCompleteT, this) );

    and I have error:57c37b60-d518-4c98-9463-988fad83af10-image.png

    How to update QStringList in my QCompleter?
    if new QCompleter() that increase memory and optimal?

  • Lifetime Qt Champion


    Update the content of the model you use for the completer. No need to recreate stuff again and again.

Log in to reply