Nominate our 2022 Qt Champions!

QDBusConnection doesn't awake a slot

  • so I found the same problem here: but the solution didn't work for me. My qdbusconnection returns that it is connected, but doesn't awake a slot.

    here is the code:
    @void connectToDesktop()
    if (QDBusConnection::sessionBus().isConnected())
    bool res = QDBusConnection::sessionBus().connect("org.kde.Solid.PowerManagement",
    Log()<<"connectToDesktop: --- connected!\n";

    if (res==false)
    Log() << "connection to desktop failed.\n";

    void myFn()
    Log()<<"myFn: --- in myFn\n";

    so, my program gets into the if(res==true) scope and prints that it is connected, but doesn't print log in myFn.

    This code is a part of a bigger one, so QApplication is included and used elsewhere. Can someone help me? Thanks...


    I understood what was wrong. My application runs from root that's why dbus doesn't awake a slot. When I run the same code in the different project, which runs as usual user, it works.

    But now I don't know how to make it work from root...

  • Lifetime Qt Champion

    Hi and welcome to devnet,

    If I understood the doc correctly your slot signature doesn't match the brightnessChanged signature. That's why it doesn't work. myFn should be myFn(int)

  • Hello an thank you :)

    I did what you said, but it still doesn't work =(

    I also tried different services, but it does the same: returns true, but doesn't awake the slot.

  • Lifetime Qt Champion

    You should check that you currently have the service registered with


Log in to reply