[Qt-interest] QMdiSubWindow WA_DeleteOnClose problem
Vidit...
vidit10 at gmail.com
Tue Jan 19 17:37:10 CET 2010
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
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://lists.qt-project.org/pipermail/qt-interest-old/attachments/20100119/a3e5b334/attachment.html
More information about the Qt-interest-old
mailing list