{"id":158,"date":"2011-02-22T01:52:18","date_gmt":"2011-02-22T00:52:18","guid":{"rendered":"https:\/\/www.opengis.ch\/?p=158"},"modified":"2020-04-29T16:08:00","modified_gmt":"2020-04-29T14:08:00","slug":"pyqt-signals-with-arguments","status":"publish","type":"post","link":"https:\/\/www.opengis.ch\/it\/2011\/02\/22\/pyqt-signals-with-arguments\/","title":{"rendered":"PyQT signals with arguments"},"content":{"rendered":"<p>so , here a snippet on how to use the different types of signals in PyQt:<\/p>\n<ul>\n<li>connect a signal from C++<br \/>\n<code>QObject.connect(self.sender, SIGNAL(\"signalName( Arg1TYPE, Arg2TYPE )\"), self.slot)<\/code><\/li>\n<li>connect a signal from Python<br \/>\n<code>QObject.connect(self.sender, SIGNAL(\"signalName\" ), self.slot )<\/code><\/li>\n<li>emit a signal in Python<br \/>\n<code>self.emit( SIGNAL( \"signalName\" ), arg1, arg2 )<\/code><\/li>\n<li>emit a signal in c++<br \/>\n<code>emit signalName( arg1, arg2 );<\/code><\/li>\n<\/ul>\n<p>more:\u00a0<a href=\"https:\/\/www.eurion.net\/python-snippets\/snippet\/Connecting%20signals%20and%20slots.html\">https:\/\/www.eurion.net\/python-snippets\/snippet\/Connecting%20signals%20and%20slots.html<\/a><\/p>\n","protected":false},"excerpt":{"rendered":"<p>so , here a snippet on how to use the different types of signals in PyQt: connect a signal from C++ QObject.connect(self.sender, SIGNAL(&#8220;signalName( Arg1TYPE, Arg2TYPE )&#8221;), self.slot) connect a signal from Python QObject.connect(self.sender, SIGNAL(&#8220;signalName&#8221; ), self.slot ) emit a signal in Python self.emit( SIGNAL( &#8220;signalName&#8221; ), arg1, arg2 ) emit [&hellip;]<\/p>\n","protected":false},"author":2,"featured_media":0,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"_themeisle_gutenberg_block_has_review":false,"jetpack_post_was_ever_published":false,"_jetpack_newsletter_access":"","_jetpack_dont_email_post_to_subs":false,"_jetpack_newsletter_tier_id":0,"_jetpack_memberships_contains_paywalled_content":false,"_jetpack_memberships_contains_paid_content":false,"footnotes":""},"categories":[31,14],"tags":[125],"class_list":["post-158","post","type-post","status-publish","format-standard","hentry","category-cpp","category-python","tag-qgis-org"],"jetpack_featured_media_url":"","jetpack-related-posts":[{"id":2115,"url":"https:\/\/www.opengis.ch\/it\/2016\/09\/11\/updating-pyqt-signals-that-use-lambda-in-qgis-with-2to3\/","url_meta":{"origin":158,"position":0},"title":"Updating PyQt signals that use lambda in QGIS with 2to3","author":"Marco Bernasocchi","date":"11 Settembre 2016","format":false,"excerpt":"Just for the sake of documenting things, when running qgis 2to3 on a plugin I encountered a tricky situation regarding signals. MYQGISDIR\/scripts\/2to3 -f signals -w my\/plugin\/path The original code: extra_arg = \"my test argument\" QObject.connect( action, SIGNAL( \"triggered()\"), lambda extra_arg=my_arg: show_extra_arg(extra_arg)) def do_load_project(extra_arg): print extra_arg # \"my test argument\" The\u2026","rel":"","context":"In &quot;PyQt&quot;","block_context":{"text":"PyQt","link":"https:\/\/www.opengis.ch\/it\/category\/programming\/python\/pyqt\/"},"img":{"alt_text":"","src":"","width":0,"height":0},"classes":[]},{"id":2127,"url":"https:\/\/www.opengis.ch\/it\/2016\/09\/19\/qgis2-compatibility-plugin\/","url_meta":{"origin":158,"position":1},"title":"QGIS2 compatibility plugin","author":"Marco Bernasocchi","date":"19 Settembre 2016","format":false,"excerpt":"Lately I've been spending time porting a bigger plugin from QGIS 2.8 to 3 while maintaining 2.8 compatibility. You can find it at https:\/\/github.com\/opengisch\/qgis2compat\/ and https:\/\/plugins.qgis.org\/plugins\/qgis2compat\/ One code to rule them all. My target was to have to edit the source code as little as possible to simulate a lazy\u2026","rel":"","context":"In &quot;PyQt&quot;","block_context":{"text":"PyQt","link":"https:\/\/www.opengis.ch\/it\/category\/programming\/python\/pyqt\/"},"img":{"alt_text":"","src":"","width":0,"height":0},"classes":[]},{"id":1668,"url":"https:\/\/www.opengis.ch\/it\/2016\/09\/07\/using-threads-in-qgis-python-plugins\/","url_meta":{"origin":158,"position":2},"title":"Using threads in QGIS python plugins","author":"Marco Bernasocchi","date":"7 Settembre 2016","format":false,"excerpt":"Here an example on how to work with threads in a consistent and clean manner in QGIS python plugins","rel":"","context":"In &quot;Python&quot;","block_context":{"text":"Python","link":"https:\/\/www.opengis.ch\/it\/category\/programming\/python\/"},"img":{"alt_text":"","src":"","width":0,"height":0},"classes":[]},{"id":11877,"url":"https:\/\/www.opengis.ch\/de\/2020\/11\/02\/pyqgis-kurs-am-27-11-4-12-2020-in-bern\/","url_meta":{"origin":158,"position":3},"title":"PyQGIS Kurs am 27.11. \/ 4.12. 2020 in Bern","author":"Matthias Kuhn","date":"2 Novembre 2020","format":false,"excerpt":"Der Kurs richtet sich an fortgeschrittene QGIS Anwender, die ihre F\u00e4higkeiten durch die Benutzung von Python verbessern wollen . In diesem Kurs werden verschiedene M\u00f6glichkeiten er\u00f6rtert, mit Hilfe der Python API mit QGIS zu interagieren sowie einfache graphische Oberfl\u00e4chen mit PyQt zu implementieren.Die folgenden Themen werden behandelt: Benutzung der Python\u2026","rel":"","context":"In &quot;Unkategorisiert&quot;","block_context":{"text":"Unkategorisiert","link":"https:\/\/www.opengis.ch\/de\/category\/unkategorisiert\/"},"img":{"alt_text":"","src":"https:\/\/i0.wp.com\/www.opengis.ch\/wp-content\/uploads\/2020\/11\/AdobeStock_251268362.resized.jpeg?fit=1120%2C747&ssl=1&resize=350%2C200","width":350,"height":200,"srcset":"https:\/\/i0.wp.com\/www.opengis.ch\/wp-content\/uploads\/2020\/11\/AdobeStock_251268362.resized.jpeg?fit=1120%2C747&ssl=1&resize=350%2C200 1x, https:\/\/i0.wp.com\/www.opengis.ch\/wp-content\/uploads\/2020\/11\/AdobeStock_251268362.resized.jpeg?fit=1120%2C747&ssl=1&resize=525%2C300 1.5x, https:\/\/i0.wp.com\/www.opengis.ch\/wp-content\/uploads\/2020\/11\/AdobeStock_251268362.resized.jpeg?fit=1120%2C747&ssl=1&resize=700%2C400 2x, https:\/\/i0.wp.com\/www.opengis.ch\/wp-content\/uploads\/2020\/11\/AdobeStock_251268362.resized.jpeg?fit=1120%2C747&ssl=1&resize=1050%2C600 3x"},"classes":[]},{"id":7545,"url":"https:\/\/www.opengis.ch\/fr\/2019\/09\/16\/cours-pyqgis-23-1-30-1-2020-a-lausanne\/","url_meta":{"origin":158,"position":4},"title":"Cours PyQGIS 23.1.\/30.1.2020 \u00e0 Lausanne","author":"Matthias Kuhn","date":"16 Settembre 2019","format":false,"excerpt":"Le cours est destin\u00e9 aux utilisateurs avanc\u00e9s de QGIS qui souhaitent accro\u00eetre leurs possibilit\u00e9s gr\u00e2ce \u00e0 l\u2019utilisation de python dans QGIS. Lors de cette formation, nous aborderons diff\u00e9rentes possibilit\u00e9s d\u2019interaction avec l\u2019API QGIS ainsi que la cr\u00e9ation d\u2019interfaces graphiques simples avec PyQt.Les th\u00e8mes suivants seront trait\u00e9s: Utilisation de la console\u2026","rel":"","context":"In &quot;Non classifi\u00e9(e)&quot;","block_context":{"text":"Non classifi\u00e9(e)","link":"https:\/\/www.opengis.ch\/fr\/category\/non-classifiee\/"},"img":{"alt_text":"","src":"","width":0,"height":0},"classes":[]},{"id":2074,"url":"https:\/\/www.opengis.ch\/it\/2016\/05\/04\/qgis-qt5-and-python3-migration-current-state\/","url_meta":{"origin":158,"position":5},"title":"QGIS: Qt5 and Python3 migration, current state","author":"Matthias Kuhn","date":"4 Maggio 2016","format":false,"excerpt":"Behind the scenes a lot has happened to get ready for Qt5 and Python3. On the same codebase that is becoming the next release QGIS 2.16. This is really a great thing since we can focus work on a single master branch and I'm very happy that we got so\u2026","rel":"","context":"In &quot;C++&quot;","block_context":{"text":"C++","link":"https:\/\/www.opengis.ch\/it\/category\/programming\/cpp\/"},"img":{"alt_text":"","src":"","width":0,"height":0},"classes":[]}],"jetpack_shortlink":"https:\/\/wp.me\/pbdBtI-2y","jetpack_sharing_enabled":true,"_links":{"self":[{"href":"https:\/\/www.opengis.ch\/it\/wp-json\/wp\/v2\/posts\/158","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/www.opengis.ch\/it\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/www.opengis.ch\/it\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/www.opengis.ch\/it\/wp-json\/wp\/v2\/users\/2"}],"replies":[{"embeddable":true,"href":"https:\/\/www.opengis.ch\/it\/wp-json\/wp\/v2\/comments?post=158"}],"version-history":[{"count":1,"href":"https:\/\/www.opengis.ch\/it\/wp-json\/wp\/v2\/posts\/158\/revisions"}],"predecessor-version":[{"id":11230,"href":"https:\/\/www.opengis.ch\/it\/wp-json\/wp\/v2\/posts\/158\/revisions\/11230"}],"wp:attachment":[{"href":"https:\/\/www.opengis.ch\/it\/wp-json\/wp\/v2\/media?parent=158"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/www.opengis.ch\/it\/wp-json\/wp\/v2\/categories?post=158"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/www.opengis.ch\/it\/wp-json\/wp\/v2\/tags?post=158"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}