Nominate our 2022 Qt Champions!

QCompleter problem on Mac

  • I recently added a QCompleter to a QComboBox in a legacy application. The code is straightforward:

    m_completer = new QCompleter(predefinedComboBox->model(), this);

    On Windows and Linux, this works just as I expected. Typing a few characters shows a popup with the matching completions, and you can click on one to select it. On Mac, though, clicking on the list of completions has no effect. You have to use up and down keys to select a completion, then press Return.

    Is this the expected behaviour on Mac? Is it a bug in QCompleter or my code? Is there something I can do differently to get this working?

    Using Qt 5.15.0.

  • I don't understand what you are trying to accomplish, QComboBox already has a completer, you don't need to set it manually. predefinedComboBox->setAutoCompletion(true);

  • Thanks for the quick response. I'll try that out, but why isn't it documented at

  • @jules-dentremont

    'By default, for an editable combo box, a QCompleter that performs case insensitive inline completion is automatically created.'

  • It's actually documented as obsolete. The reason is that the completer is already set up by default and you can call predefinedComboBox->setCompleter(nullptr); to disable it

  • Thanks, but that is not my main point, which is that setCompletionMode(QCompleter::PopupCompletion) doesn't work properly on Mac. You can't select from the list of completions using a mouse like you can on Windows or Linux.

  • Unfortunately I don't have a Mac to test. @SGaist you are renown for Mac stuff, could you confirm?

  • Lifetime Qt Champion


    Expected behaviour ? No it's not.

    Can you provide a minimal compilable example that triggers this behaviour ?

    Which version of macOS ?
    Did you also check with a more recent version of 5.15 ?

  • @SGaist
    Here's a compilable program. I don't currently have access to a MacOS build environment, so I can't confirm the behaviour on that system.

    QT += widgets
    HEADERS = \
    SOURCES = \
               main.cpp \


    #include <QApplication>
    #include "complete.h"
    int main(int argc, char *argv[])
        QApplication app(argc, argv);
        Complete complete;;
        return app.exec();


    #ifndef COMPLETE_H
    #define COMPLETE_H
    #include <QWidget>
    class QComboBox;
    class Complete : public QWidget
        Complete(QWidget *parent = 0);
        QComboBox* comboBox;


    #include <QLayout>
    #include <QComboBox>
    #include <QCompleter>
    #include "complete.h"
    Complete::Complete(QWidget *parent)
        : QWidget(parent)
        QHBoxLayout *layout = new QHBoxLayout();
        comboBox = new QComboBox();
        comboBox->addItems({"read", "red giant", "refactor", "rifle"});
        resize(200, 200);

Log in to reply