Project directory structure

Thiago Macieira thiago at macieira.org
Tue Apr 2 11:19:06 PDT 2013


On terça-feira, 2 de abril de 2013 11.08.40, Dirk Hohndel wrote:
> >> on a side note, if you are using the ui, the 'on_' methods do an
> >> autoconnect, but while this is nice, if you change the name of the
> >> variable to anything else, you will have broken but compilled code.
> > 
> > You don't rename widgets :-), and have run-time warnings anyway. But I
> > don't mind -- if you prefer connecting signals by hand, that's OK with me.
> > Anyone else has a different opinion here?
> 
> Magic names worry me. Can you explain how this works and what the
> benefits are?

The last line of the setupUi function that uic generates is:

        QMetaObject::connectSlotsByName(<object var>);

<http://qt-project.org/doc/qt-4.8/qmetaobject.html#connectSlotsByName> says:

Searches recursively for all child objects of the given object, and connects 
matching signals from them to slots of object that follow the following form:

 void on_<object name>_<signal name>(<signal parameters>);

Let's assume our object has a child object of type QPushButton with the object 
name button1. The slot to catch the button's clicked() signal would be:

 void on_button1_clicked();

-- 
Thiago Macieira - thiago (AT) macieira.info - thiago (AT) kde.org
   Software Architect - Intel Open Source Technology Center
      PGP/GPG: 0x6EF45358; fingerprint:
      E067 918B B660 DBD1 105C  966C 33F5 F005 6EF4 5358
-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 190 bytes
Desc: This is a digitally signed message part.
URL: <http://lists.hohndel.org/pipermail/subsurface/attachments/20130402/a7fe1e21/attachment.sig>


More information about the subsurface mailing list