[vtkusers] vtkChartXY point selection with mouse button and qvtkWidget renderview problem on qt MDI area

Marcus D. Hanwell marcus.hanwell at kitware.com
Wed Jun 8 13:31:52 EDT 2011


On Fri, Jun 3, 2011 at 3:05 PM, Eric E. Monson <emonson at cs.duke.edu> wrote:
> Hello,
>
> The Charts (like vtkChartXY) don't use the normal VTK interactors for handling mouse events, so I'm afraid the example you found won't help you much with this. Also, how the Charts are implemented will depend on which version of VTK you are using: 5.6 had a much earlier version of the 2D Charts API, and there has been a lot of work since then in the development version (which you can get from the Git repository). Hopefully there will be a 5.8 release soon, but for now if you are using the Charts I'd recommend working from the development head rather than 5.6 so you can take advantage of some of the improvements.
>
> Hopefully Marcus will chime in if I get any of this wrong, but currently the only type of selection that is handled in the XY Charts is a rubber-band type selection of a point or group of points. You can set which mouse button is used for Pan, Zoom or Select, but how the selections are done is hard-coded in the vtkChartXY mouse event handlers. So, right now there isn't any support built in for single click selections, or for adding to or subtracting from selection (by pressing Shift, or something). So, as things stand now (and I don't know whether there is any work going on currently to change this), you would have to subclass vtkChartXY and override the mouse event handlers, among other things, to change how selections are done.

I recently added a single click selection mode (by default the same
mouse button as the selection). We should add modifier, and grow
selections on shift - that would be very useful generally but is not
in there yet.
>
> Also, right now tooltips are only shown for a single point you are hovering over, not for multiple selected points, and I don't think there is support built in for point labels. You would have to add this behavior in to your new chart subclass.

That is certainly the case, if you wanted to label all points you
would be best subclassing vtkPlotPoints/Line, and adding in rendering
of point labels there.
>
> Sorry I don't have any idea about the overlapping windows problem. Hopefully someone else has used the Qt MDIArea and might have some ideas.
>
I have not seen that either, the charts are rendered using OpenGL and
with normal windows respect window order. Simple example Qt code to
reproduce the issue would be helpful if that were available.

Marcus



More information about the vtkusers mailing list