[Qt-interest] Destroyed signal of QWidget is not emitted

Yuvaraj R yuvaraj at ongobiz.com
Thu Oct 15 12:32:39 CEST 2009


Hi
 same issue  am facing but little different.

I have two ui files..

new_user = new Ui::newuser_conference;

QWidget *w = new QWidget;

new_user->setupUi(w);

new_user->pushButton->setEnabled(false);

for(int i=0;i<friends_details.size();i++)

{

QListWidgetItem *item = new QListWidgetItem(new_user->listWidget);

item->setText(friends_details.at(i));

}

w->show();

connect(new_user->listWidget,SIGNAL(itemClicked(QListWidgetItem*)),this,SLOT(enable_button()));

connect(new_user->pushButton,SIGNAL(clicked()),this,SLOT(add_new_user()));

connect(w,SIGNAL(destroyed()),this,SLOT(close_window()));


When destroyed signal is emitted slot is not called.



Thanks


Yuvaraj R


On Thu, Oct 15, 2009 at 3:42 PM, elizabeta petreska <
elizabeta.petreska at gmail.com> wrote:

> Ok , I am sorry for stupid question. The signal is emitted, but the slot is
> not called for the obvious reason, that is because object is already
> deleted.
>
> On Thu, Oct 15, 2009 at 12:03 PM, elizabeta petreska <
> elizabeta.petreska at gmail.com> wrote:
>
>> Ok, this is not completly true.
>> My widget is QDialog.
>>
>> In the ctr of my dialog I am doing this :
>>
>> connect(this,SIGNAL(destroyed()),this,SLOT(someslot()));
>>
>> Only when the signal is connected with slot of the same dialog, the
>> destroyed signal is not emitted.
>>
>> If I write the following :
>>
>> connect(this,SIGNAL(destroyed()),otherDlgPtr,SLOT(otherDlgSlot()));
>> the destroyed signal is emitted.
>>
>> why
>>
>>
>>
>> On Thu, Oct 15, 2009 at 11:30 AM, elizabeta petreska <
>> elizabeta.petreska at gmail.com> wrote:
>>
>>>
>>> Hello
>>>
>>> I connected my widget destroyed signal with some slot function. And my
>>> slot function is never called. The connection between the signal and the
>>> slot itself is ok, i.e connect returns true. Then I discovered that the
>>> destroyed signal is not emitted when QWidget is destroyed, that is the
>>> Qwidget dtr is called but the destroyed signal is not emitted. Is this by
>>> design ? Thanks
>>>
>>
>>
>
> _______________________________________________
> 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/20091015/ed334398/attachment.html 


More information about the Qt-interest-old mailing list