Please refer to the QApplication::mouseButtons()
function that will return the current state of the mouse buttons Qt::MouseButtons
.
Qt::MouseButtons btns = QApplication::mouseButtons();
if (btns & Qt::LeftButton) {
// The left button is pressed.
[..]
}