PDA

View Full Version : connectSlotsByName and clicked()



becrux
23rd June 2008, 18:15
Hi,

I'm using the wonderful Qt shortcut "connectSlotsByName" in my application, mostly with clicked() signals in QPushButtons.

The problem is that attached slots are called twice. As far as I was able to search about that up to now, it seems that Qt fires all slots that are compatible with SIGNAL signature, like clicked that has a default parameter.

Is it true? Anyway, how can I solve this issue?

I tried to use normalizedSignature, with no success :(

Thank you so much for all help you can give.

Regards,
Tony.

aamer4yu
23rd June 2008, 19:21
I'm using the wonderful Qt shortcut "connectSlotsByName" in my application, mostly with clicked() signals in QPushButtons.
How are you using it ? As far as I guess "connectSlotsByName" is function of QMetaObject and is handled by the qmake.

What do u want to achieve, ad what are u trying ? Can u elaborate ?

jpn
23rd June 2008, 20:10
Just be aware that setupUi() method already calls connectSlotsByName(). That would result to double connections if you, in addition that, do it by hand.

becrux
23rd June 2008, 20:44
Yes, you're right!

I was thinking of it, travelling from work to home :)

Qt's too automatic for me! :o

Thanks so much,

Tony.

xkazielx
1st December 2009, 19:34
I'm having problem that is driving me nuts. I'm also using setupUi with on_objectName_signalName() connections. When I call:

void on_DateButton_clicked()
{
this->setWindowTitle("Some title");
}
this works fine but:

void on_DateButton_clicked()
{
lineEdit_2->insert("Some text");
}
app crushes.
Any ideas?
I appologize for my poor English.

spirit
2nd December 2009, 08:05
are you sure that "lineEdit_2" is class member? are you sure that "lineEdit_2" contains not null pointer? maybe you should use "ui->lineEdit_2" instead.