! Sets how QCustomPlot processes mouse click-and-drag interactions by the user. If \a mode is \ref QCP::srmNone, the mouse drag is forwarded to the underlying objects. For example, QCPAxisRect may process a mouse drag by dragging axis ranges, see \ref QCPAxisRect::setRangeDrag. If \a mode is not \ref QCP::srmNone, the current selection rect (\ref selectionRect) becomes activated and all
| 13240 | \see setInteractions, setSelectionRect, QCPSelectionRect |
| 13241 | */ |
| 13242 | void QCustomPlot::setSelectionRectMode(QCP::SelectionRectMode mode) |
| 13243 | { |
| 13244 | if (mSelectionRect) |
| 13245 | { |
| 13246 | if (mode == QCP::srmNone) |
| 13247 | mSelectionRect->cancel(); // when switching to none, we immediately want to abort a potentially active selection rect |
| 13248 | |
| 13249 | // disconnect old connections: |
| 13250 | if (mSelectionRectMode == QCP::srmSelect) |
| 13251 | disconnect(mSelectionRect, SIGNAL(accepted(QRect,QMouseEvent*)), this, SLOT(processRectSelection(QRect,QMouseEvent*))); |
| 13252 | else if (mSelectionRectMode == QCP::srmZoom) |
| 13253 | disconnect(mSelectionRect, SIGNAL(accepted(QRect,QMouseEvent*)), this, SLOT(processRectZoom(QRect,QMouseEvent*))); |
| 13254 | |
| 13255 | // establish new ones: |
| 13256 | if (mode == QCP::srmSelect) |
| 13257 | connect(mSelectionRect, SIGNAL(accepted(QRect,QMouseEvent*)), this, SLOT(processRectSelection(QRect,QMouseEvent*))); |
| 13258 | else if (mode == QCP::srmZoom) |
| 13259 | connect(mSelectionRect, SIGNAL(accepted(QRect,QMouseEvent*)), this, SLOT(processRectZoom(QRect,QMouseEvent*))); |
| 13260 | } |
| 13261 | |
| 13262 | mSelectionRectMode = mode; |
| 13263 | } |
| 13264 | |
| 13265 | /*! |
| 13266 | Sets the \ref QCPSelectionRect instance that QCustomPlot will use if \a mode is not \ref |