I am new to Qt and I want to try to understand it better.
I know from an inheritance perspective that a QMainWindow is derived from QObject. (Directly/Indirectly)
This allows for us to connect signals to slots in the following ways within the QMainWindow:
`
1- QObject::connect(sender, &QObject::signal, this, &MyObject::slot);
2- connect(sender, &QObject::signal, this, &MyObject::slot);
`
Even tough both ways are a possibility, I never understood what the major differences between them are.
Here are my questions:
1- Which method is more performant and why?
2- Why do programmers sometimes use one over the other?
I used both of these methods and they both seem to work similarly.
Consider following code.
If you want to call
Foo::fn()at1, you can just writefn();since static functions is "visible" inside methods in derived classes, you can also writeFoo::fn()and it will do exactly the same. If you want to call it at2, you can only use full nameFoo::fn().