PDA

View Full Version : singal send twice?



masoroso
12th April 2007, 14:43
Hi all,

It's been a while since I tried to programme with Qt and I already encoutered my first problem :-)

Why does the following QMessage appear twice after the signal is emitted?

This is my code (parts of it)


connect(ui.tvDir, SIGNAL(activated(QModelIndex)), this, SLOT(on_tvDir_activated(QModelIndex)));

and


void MainForm::on_tvDir_activated(QModelIndex index)
{
...

if( ext.toUpper() == "GEF" )
QMessageBox::information(this, "test", "found gef file");
//ThisMessage is shown twice?!
}

Thanks in advance

jpn
12th April 2007, 14:47
Looks like the slot uses the naming convention *) of automatic connections (http://doc.trolltech.com/4.2/designer-using-a-component.html#a-dialog-with-auto-connect). This is why the signal slot connection is established twice; 1) by hand 2) automatically.

*) void on_<widget name>_<signal name>(<signal parameters>)