Added compatibility with Qt >=5