[Qt-interest] Signal-Slot not working

Felipe Romero Gonzalez fjromerog at gmail.com
Fri Mar 27 19:52:52 CET 2009


why you dont try to debug first, in spite of see what is happen at the
moment that you call the corresponding signal.

2009/3/27 Timothy Greaves <tgreaves21227 at yahoo.com>

> Did you declare the signal and slot in your header?
>
> "John Smith" <invalid at example.com> wrote in message
> news:gq8gl7$egt$1 at eple.troll.no...
> > "Martin Fiala" <fialkam at gmail.com> wrote in message
> > news:b7e0f19a0903230334i78eee280l805b1a3456c56820 at mail.gmail.com...
> >>I don't really clearly understand.. But to me it looks like
> >> "contactos_created" stays false all the time..
> >> If you want to change it, you could assign it after creating the
> >> newForm, where it sems logical to be set to true...
> >> But it surely doesn't explain why the program finishes unexpectedly...
> >>
> >> On Sun, Mar 22, 2009 at 8:15 PM, algajard <algajard at gmail.com> wrote:
> >>> Hey list,
> >>>
> >>> I've a problem with signals and slots. I created a signal for a QWidget
> >>> for closing and a slot in other QWidget with a slot that receive this
> >>> signal and update somes inner states. The problem is that apparently
> the
> >>> signal is not recieved by the slot.
> >>>
> >>> Here is the signal
> >>>
> >>>
> >>> void ContactosForm::closeEvent(QCloseEvent *event)
> >>> {
> >>> emit closing();
> >>> event->accept();
> >>> }
> >>>
> >>> Here is the slot (is a private slot).
> >>>
> >>> void ClientesForm::contactos_closing()
> >>> {
> >>> this->contactos_created=false;
> >>> }
> >>>
> >>> and this is the Constructor of the second widget.
> >>>
> >>> ClientesForm::ClientesForm(QWidget *parent) :
> >>> QWidget(parent){
> >>> setupUi(this);
> >>> contactos_created=false;
> >>> newForm=new ContactosForm;
> >>> connect(newForm,SIGNAL(closing()),this,SLOT(contactos_closing()));
> >>> }
> >
> > Also, check the return value of connect
> >
> > bool b =
> > connect(newForm,SIGNAL(closing()),this,SLOT(contactos_closing()));
> > assert(b);
> >
> >
> >
>
>
> _______________________________________________
> Qt-interest mailing list
> Qt-interest at trolltech.com
> http://lists.trolltech.com/mailman/listinfo/qt-interest
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://lists.qt-project.org/pipermail/qt-interest-old/attachments/20090327/13a7a7d3/attachment.html 


More information about the Qt-interest-old mailing list