Important: Please read the Qt Code of Conduct -

sddm returns a QT error

  • I am trying to get sddm working under linux. I am trying to make it use the KDE 5 default theme and getting these error messages :

    QObject::installEventFilter(): Cannot filter events for objects in a different thread.
    QObject: Cannot create children for a parent that is in a different thread.
    (Parent is SDDM::GreeterApp(0x7fffba842e70), parent's thread is QThread(0x244ae60), current thread is QThread(0x24876d0).

    Why am I getting these messages ?

  • Moderators

    You're going to need to ask sddm devs/support forums on that one. I can tell you why that would be happening Qt wise but it wouldn't help you get sddm working.

    That being said I use sddm-0.11.0 with no problems during build. I'm using Qt 5.4.2 for sddm's build if that helps you.

    I can try to help you get it working,

    1. what linux distro/ver are you using
    2. how did you install sddm? Did you build it? or use a binary dist?
    3. What version of Qt is sddm built against?
    4. What version of Qt are you running on your system"?
    5. What version of sddm are you trying to use?
    6. What rc system are you using? systemd/openrc?
    7. How did you start sddm?
    8. Are you using a custom sddm config file? i.e. I used sddm --example-config > /etc/sddm.conf to create my config file, then modified that. This may be distro specific though.

  • I digged a little into sddm source code to find the code causing this and this is what I found. I added setenv manually so it finds the KDE QML files. Is there some kind of initialization not done ? The messages appear when ScreenModel() is called.

    //// GreeterApp.cpp

    GreeterApp::GreeterApp(int &argc, char **argv) : QGuiApplication(argc, argv) {
        // point instance to this
        self = this;
        // Parse arguments
        bool testing = false;
        if (arguments().contains("--test-mode"))
            testing = true;
        // get socket name
        QString socket = parameter(arguments(), "--socket", "");
        setenv("QML2_IMPORT_PATH", "/opt/qt5/lib/qt5/qml:/usr/lib/qt5/qml:/lib/qt5/qml:/opt/kf5/lib/qt5/qml", 1);
        setenv("QML_IMPORT_PATH", "/opt/qt5/lib/qt5/qml:/usr/lib/qt5/qml:/lib/qt5/qml:/opt/kf5/lib/qt5/qml", 1);
        // get theme path
        QString themePath = parameter(arguments(), "--theme", "");
        // create view
        m_view = new QQuickView();
        // read theme metadata
        m_metadata = new ThemeMetadata(QString("%1/metadata.desktop").arg(themePath));
        // Translations
        // Components translation
        m_components_tranlator = new QTranslator();
        if (m_components_tranlator->load(QLocale::system(), "", "", COMPONENTS_TRANSLATION_DIR))
        // Theme specific translation
        m_theme_translator = new QTranslator();
        if (m_theme_translator->load(QLocale::system(), "", "",
                           QString("%1/%2/").arg(themePath, m_metadata->translationsDirectory())))
        // get theme config file
        QString configFile = QString("%1/%2").arg(themePath).arg(m_metadata->configFile());
        // read theme config
        m_themeConfig = new ThemeConfig(configFile);
        // set default icon theme from greeter theme
        if (m_themeConfig->contains("iconTheme"))
        // set cursor theme according to greeter theme
        if (m_themeConfig->contains("cursorTheme"))
            qputenv("XCURSOR_THEME", m_themeConfig->value("cursorTheme").toString().toUtf8());
        // create models
        m_sessionModel = new SessionModel();
    /////////// ScreenModel() is called here
        m_screenModel = new ScreenModel();
        m_userModel = new UserModel();
        m_proxy = new GreeterProxy(socket);
        m_keyboard = new KeyboardModel();
        if(!testing && !m_proxy->isConnected()) {
            qCritical() << "Cannot connect to the daemon - is it running?";
        // Set numlock upon start
        if (m_keyboard->enabled()) {
            if (mainConfig.Numlock.get() == MainConfig::NUM_SET_ON)
            else if (mainConfig.Numlock.get() == MainConfig::NUM_SET_OFF)
        // connect proxy signals
        QObject::connect(m_proxy, SIGNAL(loginSucceeded()), m_view, SLOT(close()));
        // set context properties
        m_view->rootContext()->setContextProperty("sessionModel", m_sessionModel);
        m_view->rootContext()->setContextProperty("screenModel", m_screenModel);
        m_view->rootContext()->setContextProperty("userModel", m_userModel);
        m_view->rootContext()->setContextProperty("config", *m_themeConfig);
        m_view->rootContext()->setContextProperty("sddm", m_proxy);
        m_view->rootContext()->setContextProperty("keyboard", m_keyboard);
        // get theme main script
        QString mainScript = QString("%1/%2").arg(themePath).arg(m_metadata->mainScript());
        // set main script as source
        // connect screen update signals
        connect(m_screenModel, SIGNAL(primaryChanged()), this, SLOT(show()));

    //// ScreenModel.cpp

    ScreenModel::ScreenModel(QObject *parent) : QAbstractListModel(parent), d(new ScreenModelPrivate()) {
        // The messages appear at this code
        connect(QGuiApplication::instance(), SIGNAL(screenAdded(QScreen*)), this, SLOT(onScreenAdded(QScreen*)));

Log in to reply