Hi and welcome to devnet,
MainWindow's theme is a signal so basically your initial connect line was correct from that perspective. However, your theme function is just a static function somewhere.
If you want it to be called, you should make theme a slot, and add the missing MainWindow:: between void and theme and keep the new version of the connect statement.