Replaced QWidget pointer with a closure to remove uneccesssery de[endancy.