pabigot / qcustomplot

Clone of Qt C++ widget for plotting and data visualization
http://www.qcustomplot.com
1 stars 1 forks source link

decouple interaction cues from implementation: mouse drag and zoom #3

Closed pabigot closed 10 years ago

pabigot commented 10 years ago

QCustomPlot tends to hard-code the recognized interactions within event callbacks, and worse integrates the code that responds to the request within the body of the callback. This makes it difficult to correct HIG errors such as recognizing any wheel event as being a request to zoom (Gnome HIG requires that to occur only on Ctrl-Wheel).

Move the implementation of the zoom and drag operations to separate methods where they can be invoked from customized QCustomPlot event handlers that bypass the base class versions.

pabigot commented 10 years ago

While it would be good to do this, in practice the implementation of the interactions generally also needs to be updated (e.g., for zooms to prevent unlimited zoom out). With both the cue and the effect having to be changed, a better approach is to simply subclass QCustomPlot and replace the handlers with ones that call reworked actions.