核心代码为
void Widget::wheelEvent(QWheelEvent *event)
{
qDebug() << "wheel";
if ( QApplication::keyboardModifiers () == Qt::ControlModifier)
{
if (event->delta() > 0) {
zoomIn();
} else {
zoomOut();
}
}
}