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

Qt-interest Archive, May 2008
Signals being triggered twice on a dialog window


Message 1 in thread

Hi all,

I have an application with a main window, that calls a dialog window. On the
dialog constructor I have some connect() oeprations and stuff.
The problem is that every signal is triggered twice... If I press a button,
the application executes its method twice.

For example, I have this on the dialog constructor:
    connect(configDialog.btnSelectColor, SIGNAL(clicked()), this,
SLOT(on_btnSelectColor_clicked()));

And this is the slot method:
void JSSConfigurator::on_btnSelectColor_clicked(void)
{
    // QMessageBox::critical(this, "Test", QString("Triggered!"));
    QColor newcolor = QColorDialog::getColor(cellColor, this);

    if(newcolor.isValid())
    {
        cellColor = newcolor;
        colorPalette.setColor(QPalette::Background, cellColor);
        configDialog.frColor->repaint();
    }
}

Every time i click on the button the ColorDialog appears twice... It is the
same for every signal/slot I have on this dialog.
I tried using other signals like released() but got no luck.

Any ideas??

Thanks a lot!!
Marcos

Message 2 in thread

Hi,

markinhos wrote:
> I have an application with a main window, that calls a dialog window. On 
> the dialog constructor I have some connect() oeprations and stuff.
> The problem is that every signal is triggered twice... If I press a 
> button, the application executes its method twice.
> 
> For example, I have this on the dialog constructor:
>     connect(configDialog.btnSelectColor, SIGNAL(clicked()), this, 
> SLOT(on_btnSelectColor_clicked()));

I guess you're making a call to setupUi() also... your slot naming 
scheme conforms to the Trolltech auto connection scheme:

http://doc.trolltech.com/4.4/designer-using-a-component.html#widgets-and-dialogs-with-auto-connect

Tim
----------------------------------------------------------------------
dr. t. dewhirst                                [t] +44 (0)1738 450 465
director                                       [w] www.bugless.co.uk
bugless software development ltd.

[a] algo business centre, glenearn road, perth, PH2 0NJ

--
 [ signature omitted ] 

Message 3 in thread

Hi Tim,

Didn't know about that one!!! I'll try to comment out the connections I made
and see if it solves the problem!!

Thanks a lot!
Marcos

2008/5/15 Tim Dewhirst <tim@xxxxxxxxxxxxx>:

> Hi,
>
> markinhos wrote:
>
>> I have an application with a main window, that calls a dialog window. On
>> the dialog constructor I have some connect() oeprations and stuff.
>> The problem is that every signal is triggered twice... If I press a
>> button, the application executes its method twice.
>>
>> For example, I have this on the dialog constructor:
>>    connect(configDialog.btnSelectColor, SIGNAL(clicked()), this,
>> SLOT(on_btnSelectColor_clicked()));
>>
>
> I guess you're making a call to setupUi() also... your slot naming scheme
> conforms to the Trolltech auto connection scheme:
>
>
> http://doc.trolltech.com/4.4/designer-using-a-component.html#widgets-and-dialogs-with-auto-connect
>
> Tim
> ----------------------------------------------------------------------
> dr. t. dewhirst                                [t] +44 (0)1738 450 465
> director                                       [w] www.bugless.co.uk
> bugless software development ltd.
>
> [a] algo business centre, glenearn road, perth, PH2 0NJ
>