Signal slot confusion

  • Hi
    I have a main window class that makes use of another class services (for example loading of a configuration file).
    My question regards how best to set up the communication between the two classes.
    At the moment I am creating the connections is the Main Window class -
    connect (m_fileManager,&FileManagement::FileManager::fileLoaded,this,&MainWindow::onfileLoaded);
    I am wondering if this is the recommended way - rather than having the first connect statement in the FileManager class?
    The reason I have done this way is so that I do not have to include the header for Main window in FileManager.
    Are there any alternative approaches.

    I know this example seems trivial but in reality things are likely to be more complex and I want to get the design correct before it is too late

    Thanks for your time


  • Well signal and slot mechanism is most recommended way for connecting between classes and it is definitely better than passing pointer of MainWindow to FileManagement.

Log in to reply

Looks like your connection to Qt Forum was lost, please wait while we try to reconnect.