[Qgis-developer] focusInEvent combobox

Luigi Pirelli luipir at gmail.com
Tue Sep 15 10:44:16 PDT 2015


ho! sorry

because it's a protected method, you should create a derivated class
from QComboBox where overload your method, then add your "custom"
class in Qt Creator project promoting your QComboBox to your custom
class (where the include is "your_custom_class_module")... more
details here: http://doc.qt.io/qt-4.8/designer-using-custom-widgets.html

the promoted class will be imported in the uic at the end of the file.

regards
Luigi Pirelli

**************************************************************************************************
* LinkedIn: https://www.linkedin.com/in/luigipirelli
* Elance: https://www.elance.com/s/edit/luigipirelli/
* GitHub: https://github.com/luipir
* Stackexchange: http://gis.stackexchange.com/users/19667/luigi-pirelli
* Mastering QGIS:
https://www.packtpub.com/application-development/mastering-qgis
**************************************************************************************************


On 15 September 2015 at 19:30, Luigi Pirelli <luipir at gmail.com> wrote:
> I don't know if I well understood, but can be simply adding a listener
> without changing the uic
>
> e.g.
> <your GUI instance>.<your combobox
> objectName>.focusInEvent.connect(<your QmessageBox function handler>)
>
> regards
>
>
> Luigi Pirelli
>
> **************************************************************************************************
> * LinkedIn: https://www.linkedin.com/in/luigipirelli
> * Elance: https://www.elance.com/s/edit/luigipirelli/
> * GitHub: https://github.com/luipir
> * Stackexchange: http://gis.stackexchange.com/users/19667/luigi-pirelli
> * Mastering QGIS:
> https://www.packtpub.com/application-development/mastering-qgis
> **************************************************************************************************
>
>
> On 15 September 2015 at 11:27, jawensi <jawensi at gmail.com> wrote:
>> Hello
>>
>> I want to add an event to a combobox. In particular, when the focus change
>> to the combobox I want to show a QmessageBox. Shearching the web I find out
>> that I can do it reimplementing the focus event handler, but that means
>> change the python file generated by the pyuic4 tool. So each time I change
>> the ui file I have to add the reimplemented the event. There is another way
>> to solve this situation without changing the py file generated from ui file.
>>
>> Thank you.
>>
>>
>>
>> --
>> View this message in context: http://osgeo-org.1560.x6.nabble.com/focusInEvent-combobox-tp5224248.html
>> Sent from the Quantum GIS - Developer mailing list archive at Nabble.com.
>> _______________________________________________
>> Qgis-developer mailing list
>> Qgis-developer at lists.osgeo.org
>> http://lists.osgeo.org/mailman/listinfo/qgis-developer


More information about the Qgis-developer mailing list