This function will be obsolete with the signals and slots connections.