[Qt-interest] QMdiSubWindow WA_DeleteOnClose problem
Vidit...
vidit10 at gmail.com
Wed Jan 20 15:05:17 CET 2010
Thanks for reply Alex,
The instance of QMdiArea is not deleted, infact there are other instances of
QMdiSubWindows still open (in the same QMdiArea), so the slot should be
called, right?
Vidit
On Tue, Jan 19, 2010 at 7:31 PM, Malyushytsky, Alex <alex at wai.com> wrote:
> Your slot might never be called cause its owner ( instance of QMdiArea)
> might be already deleted.
> Check under the debugger if TraceWindowArea instance is deleted before
> Window.
>
> Regards,
> Alex
>
>
>
>
> From: qt-interest-bounces at trolltech.com [mailto:
> qt-interest-bounces at trolltech.com] On Behalf Of Vidit...
> Sent: Tuesday, January 19, 2010 8:37 AM
> To: qt-interest at trolltech.com
> Subject: [Qt-interest] QMdiSubWindow WA_DeleteOnClose problem
>
> Hello
>
> I have just started learning QT and I'm doing pretty well. But I'm stuck on
> this problem for weeks now. If someone could help me, I appreciate.
>
> I create a QMdiSubwindow and set its attribute to DeleteOnClose.
> The signal destroyed(QObject*) is connected to a custom slot.
>
> The problem is when I call delete QMdiSubWindow explicitly (in the code),
> the slot is called, but if I close the window using GUI, the subwindow gets
> deleted but the slot is never called.
>
> Here is the simplified code:
>
>
> class TraceWindowArea : public QMdiArea
> {
> Q_OBJECT
> public:
> TraceWindowArea(QWidget *parent);
>
> public slots:
> void openNewWindow(const HostStruct *);
>
> private slots:
> void TraceWindowClosing(QObject*);
>
> //some other stuff too...
> };
>
> void TraceWindowArea::openNewWindow()
> {
> Window = new QMdiSubWindow(this);
>
> Window->setAttribute(Qt::WA_DeleteOnClose);
>
> QTextEdit *TextBrowser = new QTextEdit(Window);
> Window->setWidget(TextBrowser);
>
> Window->show();
>
> connect(Window, SIGNAL(destroyed(QObject*)), this,
> SLOT(TraceWindowClosing(QObject*)));
> }
>
> void TraceWindowArea::TraceWindowClosing(QObject* ClosingWindow)
> {
> //just for testing purpose
> QWidget * a = new QWidget(0);
> a->show();
> }
>
>
> Thanks
> Vidit
>
>
>
> ---------------------------------------------------------------------------------------------------
> Weidlinger Associates, Inc. made the following annotations.
>
> "This message and any attachments are solely for the intended recipient and
> may contain confidential or privileged information. If you are not the
> intended recipient, any disclosure, copying, use, or distribution of the
> information included in this message and any attachments is prohibited. If
> you have received this communication in error, please notify us by reply
> e-mail and immediately and permanently delete this message and any
> attachments. Thank you."
>
> "Please consider our environment before printing this email."
>
> _______________________________________________
> 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/20100120/c634723d/attachment.html
More information about the Qt-interest-old
mailing list