Hello,
I am porting some code from Qt3 to Qt4. I have a form which uses a QtMainWindow, this is showing some canvas obtained with QTRoot (I think this is not important for the bug I am going to explain).
In the constructor the canvas is added to the QtMainWindow, then another class is using this to show some histograms. When I run the executable I see that when I try to plot the histograms, they are correctly showed for a small fraction of second, then they disappear. To show them again I must click inside the QMainWindow where the canvas is put, but if I do something outside then they disappear again. I think this means that the histograms are showed just if the canvas is selected. I tried to solve this with a lot of commands like raise() and so on, but the problem is still occurring.
I can put some simplified code lines to help myself with the explanation:
HistogramView::HistogramView(...)
MyQRootCanvas *my_canvas = new MyQRootCanvas( frame, "my_canvas" );
vboxLayout->addWidget( my_canvas );
}
HistogramView::HistogramView(...)
:QMainWindow() {
MyQRootCanvas *my_canvas = new MyQRootCanvas( frame, "my_canvas" );
vboxLayout->addWidget( my_canvas );
}
To copy to clipboard, switch view to plain text mode
Then the class which calls HistogramView is calling the command:
histogramViewList.push_back( new HistogramView(...) ) {
histogramViewList.back()->show();
}
histogramViewList.push_back( new HistogramView(...) ) {
histogramViewList.back()->show();
}
To copy to clipboard, switch view to plain text mode
The show() command is showing the QmainWindow, the histogram is showed for a very small time and disappears, and appears again just if I click in the canvas, as I described before.
I did not write the code myself, I am just trying to port it to Qt4.
I really say thank you to anybody who can help me solving this problem or gives me any suggestion.
Bookmarks