The error arises because the first argument to connect is wrong but there are several issues here.
Qt Code:
To copy to clipboard, switch view to plain text mode
- The compiler is expecting to see a pointer-to QObject. The identifier MainWindow is the name of a class not an object of that class, you would be closer with w.g_sld (w is not a pointer so not w->g_sld).
- The identifier g_sld is associated with a private member variable in the class MainWindow, and that is not accessible outside the class implementation.
- The three argument connect() can only be used inside a QObject implementation because the target object is an implied "this".
Move the connect() into the MainWindow implementation. Usually in the constructor after the setupUi().
Bookmarks