[vtkusers] QVTKWidget and Layers

Clinton Stimpson clinton at elemtech.com
Thu Apr 26 10:08:26 EDT 2012


Does adding Qt widgets as children of the QVTKWidget do what you want?

int main(int argc, char* argv[])
{
  QApplication app(argc, argv);

  QVTKWidget widget;
  vtkNew<vtkRenderer> renderer;
  renderer->SetBackground(1., 1., 0.);
  renderer->SetBackground2(0., 1., 1.);
  renderer->SetGradientBackground(true);
  widget.GetRenderWindow()->AddRenderer(renderer.GetPointer());

  QVBoxLayout* l = new QVBoxLayout(&widget);
  QComboBox* box = new QComboBox(&widget);
  box->addItem("item 1");
  box->addItem("item 2");
  l->addWidget(box);
  l->addStretch();

  widget.show();
  return app.exec();
}

If not, perhaps you can give an example that isn't working.

Clint

On Apr 26, 2012, at 6:10 AM, Ale wrote:

> I need to define a View that is consistent and compact at the same time so no context menu and things displayed on the same "rectangle". So the QVTKWidget area should contain everything...
> 
> Il giorno 26/apr/2012, alle ore 13.58, Jothybasu Selvaraj ha scritto:
> 
>> Why can't you have your QtWidgets somewhere on the GUi other than the QVTkWidegt?
>> 
>> You could add your actions as context menu in the qvtkwidget.
>> 
>> Jothy
>> 
>> On Thu, Apr 26, 2012 at 12:54 PM, Ale <notinmyhead at gmail.com> wrote:
>> But can I set actors from QT widgets? It sound a bit strange to me...
>> 
>> Ale
>> 
>> Il giorno 26/apr/2012, alle ore 13.08, Jothybasu Selvaraj ha scritto:
>> 
>>> You could manipulate the Z positon of the actors yuo add to the vtkRenderer, so that they all stay above the image.
>>> 
>>> 
>>> Jothy
>>> 
>>> On Thu, Apr 26, 2012 at 12:01 PM, Ale <notinmyhead at gmail.com> wrote:
>>> Hello,
>>> 
>>> I'm going crazy trying to add extra "layers" to a qvtkwidget in order to have text labels, combo boxes and so on, among the qvtkwidget main view (such as a single slice of a 3dvolume). Is there a way to do it properly resorting to a mix of vtk and qt? Is there some "canonical" approach I'm missing?
>>> 
>>> Thanks,
>>> Ale
>>> _______________________________________________
>>> 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
>>> 
>>> 
>>> 
>>> --
>>> Jothy
>>> 
>> 
>> 
>> 
>> 
>> -- 
>> Jothy
>> 
> 
> _______________________________________________
> 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




More information about the vtkusers mailing list