! 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
| 13979 | \see setInteractions, setSelectionRect, QCPSelectionRect |
| 13980 | */ |
| 13981 | void QCustomPlot::setSelectionRectMode(QCP::SelectionRectMode mode) |
| 13982 | { |
| 13983 | if (mSelectionRect) |
| 13984 | { |
| 13985 | if (mode == QCP::srmNone) |
| 13986 | mSelectionRect->cancel(); // when switching to none, we immediately want to abort a potentially active selection rect |
| 13987 | |
| 13988 | // disconnect old connections: |
| 13989 | if (mSelectionRectMode == QCP::srmSelect) |
| 13990 | disconnect(mSelectionRect, SIGNAL(accepted(QRect,QMouseEvent*)), this, SLOT(processRectSelection(QRect,QMouseEvent*))); |
| 13991 | else if (mSelectionRectMode == QCP::srmZoom) |
| 13992 | disconnect(mSelectionRect, SIGNAL(accepted(QRect,QMouseEvent*)), this, SLOT(processRectZoom(QRect,QMouseEvent*))); |
| 13993 | |
| 13994 | // establish new ones: |
| 13995 | if (mode == QCP::srmSelect) |
| 13996 | connect(mSelectionRect, SIGNAL(accepted(QRect,QMouseEvent*)), this, SLOT(processRectSelection(QRect,QMouseEvent*))); |
| 13997 | else if (mode == QCP::srmZoom) |
| 13998 | connect(mSelectionRect, SIGNAL(accepted(QRect,QMouseEvent*)), this, SLOT(processRectZoom(QRect,QMouseEvent*))); |
| 13999 | } |
| 14000 | |
| 14001 | mSelectionRectMode = mode; |
| 14002 | } |
| 14003 | |
| 14004 | /*! |
| 14005 | Sets the \ref QCPSelectionRect instance that QCustomPlot will use if \a mode is not \ref |