PDA

View Full Version : Problem with MDI framework



a_m_mukul
5th July 2007, 12:45
Hi,

I have created one application as like follow:



MainWindow::MainWindow() : QMainWindow()
{
QWorkspace* workspace = new QWorkspace(this);
setCentralWidget(workspace);
workspace->setScrollBarsEnabled(true);

QGraphicsView* view = new QGraphicsView(workspace);
workspace->addWindow(view);
view->showMaximized();
workspace->setActiveWindow(view);

}

Whenever I am minimizing and then restoring the QGraphicsView window,
I am getting following message:

"QCoreApplication:: postEvent: Unexpected null receiver"

Please can any body tell me why this message might be coming.

I am working on Qt4.2.2 and Fedora core-5 application.

jacek
5th July 2007, 13:54
QGraphicsView* view = new QGraphicsView(workspace);
workspace->addWindow(graphicsView);
graphicsView->showMaximized();
workspace->setActiveWindow(m_graphicsView);
It seems that you have three graphics views (view, graphicsView and m_graphicsView) instead of one.

steg90
5th July 2007, 13:59
Just a point to remember, if you upgrade to Qt4.3, there is better support for MDI using QMdiArea which I believe is a replacement for QWorkspace.

Example :



m_pworkspace = new QMdiArea;
m_pCanView = new CanView( this );
m_pworkspace->addSubWindow( m_pCanView );
m_pCanView->show();



Regards,
Steve

a_m_mukul
5th July 2007, 14:55
it was a typo in demo program, actually i have only one graphicsView

jacek
5th July 2007, 22:12
Try creating the workspace and the graphics view without specifing their parents.

a_m_mukul
6th July 2007, 05:42
I tried but didn't work....i have tried all type of combination of specifying/not-specifying the parents.

jacek
6th July 2007, 11:20
Does it occur if you use Qt 4.2.3?

jpn
6th July 2007, 22:07
I'd like to see and test something compilable that reproduces the problem.