Trolltech Home | Qt-interest Home | Recent Threads | All Threads | Author | Date
All threads index page 5

Qt-interest Archive, April 2007
slots and using directives


Message 1 in thread

Qt 4.2.2.  Connect  doesn't seem to work when
using declarations are involved.

For example:

namespace foo {

    enum bar {barA, barB};

}

// from SomeClass header
signals:
    void doit(foo::bar);

private slots:
    void it(foo::bar);


Then this works:

connect(a,SIGNAL(doit(foo::bar)),this,SLOT(it(foo::bar)));  


but this doesn't:

using namespace foo;

connect(a,SIGNAL(doit(bar)),this,SLOT(it(:bar)));  

I get errors:
Object::connect: No such signal SomeClass::doit(bar)

or 

Objectt::connect: No such slot SomeClass::it(bar)

Is this intentional?

--
 [ signature omitted ] 

Message 2 in thread

Maybe not intentional, but certainly expected. Remember, there is no parsing
of the SIGNAL() and SLOT() at compile time. And at runtime, the namespace is
gone.

Keith

On 04-19-2007 12:56 PM, "Duane Hebert" wrote:

> Qt 4.2.2.  Connect  doesn't seem to work when
> using declarations are involved.
> 
> For example:
> 
> namespace foo {
> 
>     enum bar {barA, barB};
> 
> }
> 
> // from SomeClass header
> signals:
>     void doit(foo::bar);
> 
> private slots:
>     void it(foo::bar);
> 
> 
> Then this works:
> 
> connect(a,SIGNAL(doit(foo::bar)),this,SLOT(it(foo::bar)));
> 
> 
> but this doesn't:
> 
> using namespace foo;
> 
> connect(a,SIGNAL(doit(bar)),this,SLOT(it(:bar)));
> 
> I get errors:
> Object::connect: No such signal SomeClass::doit(bar)
> 
> or 
> 
> Objectt::connect: No such slot SomeClass::it(bar)
> 
> Is this intentional?


--
 [ signature omitted ] 

Message 3 in thread

"Keith Esau" <keith.esau@xxxxxxx> wrote in message 
news:C24D2673.955D%keith.esau@xxxxxxxxxx
> Maybe not intentional, but certainly expected. Remember, there is no 
> parsing
> of the SIGNAL() and SLOT() at compile time. And at runtime, the namespace 
> is
> gone.
>
Not a big deal as long as it's expected
behavior. 


--
 [ signature omitted ]