<html><head><meta http-equiv="content-type" content="text/html; charset=utf-8"></head><body dir="auto"><div>Sorry hit reply instead of reply all.</div><div><br></div><div>On 27 May 2015, at 18:39, c c <<a href="mailto:coastalchaos@hotmail.co.uk">coastalchaos@hotmail.co.uk</a>> wrote:<br><br></div><blockquote type="cite"><div>

<style><!--
.hmmessage P
{
margin:0px;
padding:0px
}
body.hmmessage
{
font-size: 12pt;
font-family:Calibri
}
--></style>
<div dir="ltr">Florian,<br> <br>Thanks for taking the time to answer. I looked at the post on the mailing list and I was compacted but it was ok when it hit my inbox.<br> <br> <br>My confusion regarding the "what happens to..." is that the  QCoreApplication.instance() is no longer in the new signal/slot connection definition.<br> <br>I assume the old way meant that the signal was created for the instance of QCoreApplication but the new way of doing it is nto bringing it into play. Maybe it was the wrong thing to do originally???<br> <br> <br>I'm inheriting this code/project so I thought I might as well bring it up to date regarding Qt5/PyQt5 but staying with python 2.7 due to libraries that are used in the project that haven't been ported (although I guess I should check the latest status of those one by one) but I wanted to change as little as possible while I try and get to grips with it. I felt if I progressed with PyQt4/Qt4 I might end up having to port when I've got a bigger application which would be worse.<br> <br> <br>I've changed the declaration to the new way and the code runs past that point which is good but I've got every single signal/slot to rewrite which is 318. I'm hoping when I've finished that lot I won't run into too may problems due to the transition from 4 to 5 but I see that other commands are falling over :(. <br> <br> <br>Has anyone else gone through the pain of PyQt4/Qt4  to PyQt5/Qt5 migration and is there any general advice?<br> <br> <br> <br>Rob<br> <br> <br> <br> <br><br> <br><div>Date: Wed, 27 May 2015 18:42:02 +0200<br>From: <a href="mailto:me@the-compiler.org">me@the-compiler.org</a><br>To: <a href="mailto:pyqt@riverbankcomputing.com">pyqt@riverbankcomputing.com</a><br>Subject: Re: [PyQt] converting old signal/slot to new signal/slot<br><br><pre>* c c <<a href="mailto:coastalchaos@hotmail.co.uk">coastalchaos@hotmail.co.uk</a>> [2015-05-27 16:53:13 +0100]:<br>> Sorry for the formatting here it is again attached as a text file.<br> <br>Yeah, Hotmail really likes to mangle plaintext mails...<br> <br>> ##############     QT4       ###########################<br>> <br>> class DatabaseProxy<br>> <br>>     def onRegister(self):<br>> <br>>         self.session =  self.new_event_session()<br>> <br>>         # connect signals<br>> <br>>         self.connect(QtCore.QCoreApplication.instance(),<br>>                QtCore.SIGNAL(b"databaseChanged(PyQt_PyObject)"),<br>>                self.on_database_updated_signal,<br>>                Qt.QueuedConnection)<br> <br>I'm not used to the old signal/slot style - so this creates a new<br>databaseChanged signal on QApplication?<br> <br>If you'd really want to do that, you'd need to subclass QApplication<br>and implement your signal there - but I'd prefer the way you outline<br>below.<br> <br>> I've looked at examples such as <a href="http://www.pythoncentral.io/pysidepyqt-tutorial-creating-your-own-signals-and-slots/" target="_blank">http://www.pythoncentral.io/pysidepyqt-tutorial-creating-your-own-signals-and-slots/</a><br>> and I've come up with the below but I feel that something is missing......<br> <br>Looks good to me. What do you think would be missing?<br> <br>> ##############     QT5       ###########################<br>> <br>> [...]<br>>     databaseChanged = pyqtSignal(object)<br>> [...]<br>>    @QtCore.pyqtslot(object)<br>>    def on_database_updated_signal(self, status)<br> <br>If status is something like an int, you might want to use that instead<br>of 'object' here.<br> <br>>            QtCore.QCoreApplication.instance().emit(<br>>                  self.attributeChanged)<br> <br>As you say below, this should probably be:<br> <br>    self.attributeChanged.emit()<br> <br>> My question is, is this correct and what happens to the  QtCore.QCoreApplication.instance()<br> <br>I don't understand the "what happens ..." question.<br> <br>> Oh, I've also looked at the Qt documentation for QtAssistant and I cant see a change between Qt4 and Qt5 Qobject connect() method so I'm at a loss as to why we have the new signal/slot system in PyQt5 (I am aware that it was introduced in Qt4. I'm sure as I get to grips with pyQt / pyQt5 the reson will become apparent but I'm a long way off of that)<br> <br>Probably to make things more pythonic, easier to write, and not based<br>on strings.<br> <br>Note Qt5 actually also has a new signal/slot mechanism:<br> <br><a href="http://wiki.qt.io/New_Signal_Slot_Syntax" target="_blank">http://wiki.qt.io/New_Signal_Slot_Syntax</a><br> <br>But that's mostly unrelated to the PyQt change.<br> <br>Florian<br> <br>-- <br><a href="http://www.the-compiler.org" target="_blank">http://www.the-compiler.org</a> | <a href="mailto:me@the-compiler.org">me@the-compiler.org</a> (Mail/XMPP)<br>   GPG: 916E B0C8 FD55 A072 | <a href="http://the-compiler.org/pubkey.asc" target="_blank">http://the-compiler.org/pubkey.asc</a><br>         I love long mails! | <a href="http://email.is-not-s.ms/" target="_blank">http://email.is-not-s.ms/</a><br></pre><br>_______________________________________________
PyQt mailing list    <a href="mailto:PyQt@riverbankcomputing.com">PyQt@riverbankcomputing.com</a>
<a href="http://www.riverbankcomputing.com/mailman/listinfo/pyqt">http://www.riverbankcomputing.com/mailman/listinfo/pyqt</a></div>                                           </div>
</div></blockquote></body></html>