Closed aclex closed 8 years ago
I believe it should be qobject_cast<QApplication *>(QCoreApplication::instance())
Isn't it?
Agreed on qobject_cast, but as to casting to QApplication it seems a little tricky: according to the docs, QApplication implies QWidget-based GUI application, so e.g. for QML-based one it would answer false this way. Unfortunately, I don't know the context for this method, so it's hard to say, what behaviour is desired.
Well Ok, let it be QGui* My example was copied from commit deprecating type().
Ok, I seem to have consulted the same commit :) Could you please fix it while merging or should I update the request somehow?
Please update the request. You can rewrite history and force push so it still will be just one commit.
Thank you for the suggestion, just updated it this way.
Thank you very much for the merge!
You have dropped Qt 4.x support due to using of QGuiApplication here.
Oh yes, indeed, that was completely slipped my mind. QApplication, as Ri0n proposed, would be the optimal then. Do we have any chance to rewrite it again?
new pool request then. I didn't notice this too =)
I'd add few ifdefs
Yeah, just done this way: https://github.com/psi-im/iris/pull/40
Avoid using of obsolete (since Qt5) members of QApplication used to check if we are GUI application. Use dynamic_cast to QGuiApplication instead, which could be a little slower, but seems to be the recommended way.
Turned out to be important for KF5-porting of Kopete, which uses internal copy of libiris.