[vtkusers] QVTKWidget2 window flickered
septem
septem.wu at gmail.com
Tue Aug 28 21:36:17 EDT 2012
Clinton Stimpson wrote
>
> On Monday, August 27, 2012 06:40:25 PM septem wrote:
>> Hello
>>
>> I am trying to embed sevel QVTKWidget2 into a QStackedWidget.
>>
>> For example,
>>
>> the first layout contains 2*2 QVTKWidget2,
>> and the second contains 1*3 QVTKWidget2
>> ...
>>
>> when I switch between these layouts use the QStackedWidget's method,
>> the QVTKWidget2 flickered.
>>
>> Is there anyway to Solve this problem?
>>
>> Thanks very much.
>>
>
> Have you seen this yet?
> http://www.vtk.org/pipermail/vtkusers/2012-June/123744.html
>
> If that doesn't help, you probably need to be more specific explaining
> your
> problem.
>
> --
> Clinton Stimpson
> Elemental Technologies, Inc
> Computational Simulation Software, LLC
> www.csimsoft.com
> _______________________________________________
> Powered by www.kitware.com
>
> Visit other Kitware open-source projects at
> http://www.kitware.com/opensource/opensource.html
>
> Please keep messages on-topic and check the VTK FAQ at:
> http://www.vtk.org/Wiki/VTK_FAQ
>
> Follow this link to subscribe/unsubscribe:
> http://www.vtk.org/mailman/listinfo/vtkusers
>
Thank you for your reply.
I have read the topic, but my QVTKWidget2 already has a parent widget, so
when I call QStackedWidget's method SetCurrentWidget(), QVTKWidget2's parent
will not be changed.
Here's my Code:
class View : public QWidget
{
public:
View(QWidget* parent = 0):QWidget(parent)
{
QVTKWidget2* myVtkWnd = new QVTKWidget2();
QToolBar* myTB = new QToolBar();
//... initial renderer and set background color
QVBoxLayout* vLayout = new QVBoxLayout();
vLayout->addWidget(myTB);
vLayout->addWidget(myVtkWnd);
setLayout(vLayout);
}
~View() {}
};
class WorkSpace : public QWidget
{
public:
WorkSpace(int rowCount, int colCount, QWidget* parent =
0):QWidget(parent)
{
QGridLayout* gLayout = new QGridLayout();
for(int r=0; r<rowCount; ++r)
{
for(int c=0; c<colCount; ++c)
{
gLayout->addWidget(new View(),r,c);
}
}
setLayout(gLayout);
}
~WorkSpace() {}
};
class MainWindow : public QMainWindow
{
QStackedWidget* myStack;
public:
MainWindow(QWidget* parent = 0):QMainWindow(parent)
{
myStack = new QStackedWidget();
myStack->addWidget(new WorkSpace(1,3));
myStack->addWidget(new WorkSpace(2,2));
myStack->addWidget(new WorkSpace(1,1));
setCenterWidget(myStack);
}
~MainWindow() {}
void SwitchTo(int index)
{
myStack->setCurrentIndex(index);
}
};
int main(int argc,char* argv[])
{
QApplication app(argc,argv);
MainWindow wnd;
wnd.show();
return app.exec();
}
When I call SwitchTo(int) method to change WorkSpace Layout, the QVTKWidget2
is flickering..
Thank you
--
View this message in context: http://vtk.1045678.n5.nabble.com/QVTKWidget2-window-flickered-tp5715588p5715619.html
Sent from the VTK - Users mailing list archive at Nabble.com.
More information about the vtkusers
mailing list