[vtkusers] QVTKWidget2 window flickered

Clinton Stimpson clinton at elemtech.com
Wed Aug 29 09:58:16 EDT 2012


I added this to the main().

  for(int i=0; i<100; i++)
  {
    wnd.SwitchTo(i%3);
    app.processEvents();
    std::cout << "switch to " << i << std::endl;
  }

But I do not see any flicker on Linux.

What platform are you on?

Clint

On Tuesday, August 28, 2012 06:29:40 PM septem wrote:
> 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&lt;colCount; ++c)
> 			{
> 				gLayout->addWidget(new View(),r,c);
> 			}
> 		}
> 
> 		setLayout(gLayout);
> 	}
> 	~WorkSpace() {}
> };
> 
> class MainWindow : public QMainWindow
> {
> public:
> 	MainWindow(QWidget* parent = 0):QMainWindow(parent)
> 	{
> 		QStackedWidget* 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-tp5715588p571
> 5618.html Sent from the VTK - Users mailing list archive at Nabble.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
-- 
Clinton Stimpson
Elemental Technologies, Inc
Computational Simulation Software, LLC
www.csimsoft.com



More information about the vtkusers mailing list