[Qt-interest] Force the emission of a signal

Thiago Macieira thiago.macieira at trolltech.com
Fri Mar 20 17:50:46 CET 2009


Em Sexta-feira 20 Março 2009, às 17:36:35, Andrea Franceschini escreveu:
> Anyway, so far Qt is the framework with the most scarce
> workaroundability I've ever seen -- and it's not wrong to say that
> this is one of the reasons because I love it :)

You can try this too (this is found in Qt 3 source code, edited for 
simplicity), which confirms the rule that you can do anything in C++ with an 
extra level of indirection:

class QDnsUgleHack: public QDns {
public:
    void ugle( bool emitAnyway=FALSE );
};

void QDnsUgleHack::ugle( bool emitAnyway)
{
    if ( emitAnyway || !isWorking() ) {
        emit resultsReady();
    }
}

And in the code:
                ((QDnsUgleHack*)dns)->ugle( TRUE );

On second thought... maybe you shouldn't :-)

-- 
Thiago Macieira - thiago.macieira (AT) nokia.com
  Senior Product Manager - Nokia, Qt Software
     Sandakerveien 116, NO-0402 Oslo, Norway
-------------- next part --------------
A non-text attachment was scrubbed...
Name: not available
Type: application/pgp-signature
Size: 189 bytes
Desc: This is a digitally signed message part.
Url : http://lists.qt-project.org/pipermail/qt-interest-old/attachments/20090320/cf5d4db9/attachment.bin 


More information about the Qt-interest-old mailing list