今天看qcustom源码 Q_UNUSED(details) 看到这一句
/*!
This event gets called when the user presses a mouse button while the cursor is over the
layerable. Whether a cursor is over the layerable is decided by a preceding call to \ref
selectTest.
The current pixel position of the cursor on the QCustomPlot widget is accessible via \c
event->pos(). The parameter \a details contains layerable-specific details about the hit, which
were generated in the previous call to \ref selectTest. For example, One-dimensional plottables
like \ref QCPGraph or \ref QCPBars convey the clicked data point in the \a details parameter, as
\ref QCPDataSelection packed as QVariant. Multi-part objects convey the specific \c
SelectablePart that was hit (e.g. \ref QCPAxis::SelectablePart in the case of axes).
QCustomPlot uses an event propagation system that works the same as Qt’s system. If your
layerable doesn’t reimplement the \ref mousePressEvent or explicitly calls \c event->ignore() in
its reimplementation, the event will be propagated to the next layerable in the stacking order.
Once a layerable has accepted the \ref mousePressEvent, it is considered the mouse grabber and
will receive all following calls to \ref mouseMoveEvent or \ref mouseReleaseEvent for this mouse
interaction (a “mouse interaction” in this context ends with the release).
The default implementation does nothing except explicitly ignoring the event with \c
event->ignore().
\see mouseMoveEvent, mouseReleaseEvent, mouseDoubleClickEvent, wheelEvent
*/
void QCPLayerable::mousePressEvent(QMouseEvent *event, const
QVariant &details)
{
Q_UNUSED(details)
event->ignore();
}
Q_UNUSED() 没有实质性的作用,用来避免编译器警告
比如下图(qt中不用的函数 或变量 也会有个警告的)