1

I am curious why there is facility within QT Designer to create signals and slots as, to my surprise, I did not need to do this. All of the necessary coding was accomplished completely within the plugin, and without using QT Designer.

I installed QGIS 2.6.0, lately, and have successfully created a signal / slot in a test plugin (an effort beginning with PluginBuilder): getting a ListView widget to respond to a combobox change

Can someone explain to me a) what is the use of the slot/signal facility in QT Desginer, when using QGIS and python and b) how is that slot/signal facility in QT Designer used?

Maybe a pointer to a full web-explanation on this point would be helpful. The QT tutorials I've found, so far, don't help, or, at least, don't help in the context of a QGIS plugin.

5
  • Signals and slots are event driven, an action emits a signal and the slot responds. There may be many listeners to a given signal (or none) - to keep from emitting/responding to every little thing which would (potentially) slow down the system you need to customize which signals will be emitted and which you will listen to. I hope that helps. Commented Nov 16, 2014 at 23:47
  • Sorry, @Michael, your answer leans in the wrong direction...I've narrowed the question, rewording it clarified the confusion. This is not a general question about how/why slots/signals work, rather, why QT Designer has the facility to create them, in the context of making qgis plugins.
    – John
    Commented Nov 17, 2014 at 14:40
  • @John: Some find it easier to create the slot/signal connections using a graphical tool, rather than "hand-coding". You could ask the same question about Qt Designers facilities for creating GUIs: You could also just write the .ui file by hand, but the Qt Designer provides an interface to help you.
    – Jake
    Commented Nov 17, 2014 at 17:14
  • Thanks, @Jake. The code for the QT slot/signal will therefore end up in the ui_test.py file, as opposed to in the file containing most of my code, the test.py file. Correct? What is the practical consequence? Using QT, how would one connect to a specific python function? I guess I'm still missing the manual pieces for making the QT variant work. And: how and what code pieces it is adding, using which entries there in QT?. Is it telling that none of the instructions manuals for QGIS/plugins/etc which I've found use QT for the connections?
    – John
    Commented Nov 17, 2014 at 20:54
  • 1
    Oh I get it... in the same way that a form can be created in .net using the toolbox or specified textually. I know I find it easier to use the GUI and then modify the fiddly bits that don't do exactly what I want - remembering that once modified it can't/shouldn't be modified in designer again or the modifications will be lost. QT is not just QGIS, it's a generic library for creating forms that is valid across platforms and some languages (python, C) in the same way that python isn't just QGIS but a generic scripting language. To integrate it's a matter of making the function match. Commented Nov 17, 2014 at 21:36

0

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Browse other questions tagged or ask your own question.