forked from qt-creator/qt-creator
Replace the deprecated QWheelEvent::delta() -> QWheelEvent::angleDelta()
Replaced the usages of deprecated QWheelEvent::delta() with QWheelEvent::angleDelta().y(), assuming that it's acceptable to use only the vertical component of angle delta. Task-number: QTBUG-76491 Change-Id: I4aa0a5a0e9ba7f33321bdb879b66ffb589b53e42 Reviewed-by: Eike Ziller <eike.ziller@qt.io>
This commit is contained in:
@@ -941,7 +941,7 @@ void PreviewDialog::setPixmap(const QPixmap &p, int zoom)
|
|||||||
|
|
||||||
void PreviewDialog::wheelEvent(QWheelEvent* event)
|
void PreviewDialog::wheelEvent(QWheelEvent* event)
|
||||||
{
|
{
|
||||||
int delta = event->delta();
|
const auto delta = event->angleDelta().y();
|
||||||
event->accept();
|
event->accept();
|
||||||
if (delta > 0) {
|
if (delta > 0) {
|
||||||
if (m_zoom == 1)
|
if (m_zoom == 1)
|
||||||
|
|||||||
@@ -83,9 +83,9 @@ QModelIndex TreeViewComboBox::lastIndex(const QModelIndex &index)
|
|||||||
void TreeViewComboBox::wheelEvent(QWheelEvent *e)
|
void TreeViewComboBox::wheelEvent(QWheelEvent *e)
|
||||||
{
|
{
|
||||||
QModelIndex index = m_view->currentIndex();
|
QModelIndex index = m_view->currentIndex();
|
||||||
if (e->delta() > 0)
|
if (e->angleDelta().y() > 0)
|
||||||
index = indexAbove(index);
|
index = indexAbove(index);
|
||||||
else if (e->delta() < 0)
|
else if (e->angleDelta().y() < 0)
|
||||||
index = indexBelow(index);
|
index = indexBelow(index);
|
||||||
|
|
||||||
e->accept();
|
e->accept();
|
||||||
|
|||||||
@@ -176,7 +176,7 @@ void HelpViewer::wheelEvent(QWheelEvent *event)
|
|||||||
{
|
{
|
||||||
if (m_scrollWheelZoomingEnabled && event->modifiers() == Qt::ControlModifier) {
|
if (m_scrollWheelZoomingEnabled && event->modifiers() == Qt::ControlModifier) {
|
||||||
event->accept();
|
event->accept();
|
||||||
event->delta() > 0 ? scaleUp() : scaleDown();
|
event->angleDelta().y() > 0 ? scaleUp() : scaleDown();
|
||||||
} else {
|
} else {
|
||||||
QWidget::wheelEvent(event);
|
QWidget::wheelEvent(event);
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -286,7 +286,7 @@ void ImageView::doScale(qreal factor)
|
|||||||
|
|
||||||
void ImageView::wheelEvent(QWheelEvent *event)
|
void ImageView::wheelEvent(QWheelEvent *event)
|
||||||
{
|
{
|
||||||
qreal factor = qPow(Constants::DEFAULT_SCALE_FACTOR, event->delta() / 240.0);
|
qreal factor = qPow(Constants::DEFAULT_SCALE_FACTOR, event->angleDelta().y() / 240.0);
|
||||||
doScale(factor);
|
doScale(factor);
|
||||||
event->accept();
|
event->accept();
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -209,7 +209,7 @@ void FormEditorWidget::resetNodeInstanceView()
|
|||||||
void FormEditorWidget::wheelEvent(QWheelEvent *event)
|
void FormEditorWidget::wheelEvent(QWheelEvent *event)
|
||||||
{
|
{
|
||||||
if (event->modifiers().testFlag(Qt::ControlModifier)) {
|
if (event->modifiers().testFlag(Qt::ControlModifier)) {
|
||||||
if (event->delta() > 0)
|
if (event->angleDelta().y() > 0)
|
||||||
zoomAction()->zoomOut();
|
zoomAction()->zoomOut();
|
||||||
else
|
else
|
||||||
zoomAction()->zoomIn();
|
zoomAction()->zoomIn();
|
||||||
|
|||||||
@@ -138,7 +138,7 @@ void GraphicsView::zoomOut()
|
|||||||
void GraphicsView::wheelEvent(QWheelEvent *event)
|
void GraphicsView::wheelEvent(QWheelEvent *event)
|
||||||
{
|
{
|
||||||
if (Qt::ControlModifier & event->modifiers()) {
|
if (Qt::ControlModifier & event->modifiers()) {
|
||||||
if (event->delta() > 0)
|
if (event->angleDelta().y() > 0)
|
||||||
zoomIn();
|
zoomIn();
|
||||||
else
|
else
|
||||||
zoomOut();
|
zoomOut();
|
||||||
|
|||||||
@@ -89,7 +89,7 @@ void Magnifier::wheelEvent(QWheelEvent *e)
|
|||||||
{
|
{
|
||||||
QWidget::wheelEvent(e);
|
QWidget::wheelEvent(e);
|
||||||
|
|
||||||
if (e->delta() > 0)
|
if (e->angleDelta().y() > 0)
|
||||||
m_ui.m_graphicsView->scale(1.1, 1.1);
|
m_ui.m_graphicsView->scale(1.1, 1.1);
|
||||||
else
|
else
|
||||||
m_ui.m_graphicsView->scale(1.0 / 1.1, 1.0 / 1.1);
|
m_ui.m_graphicsView->scale(1.0 / 1.1, 1.0 / 1.1);
|
||||||
|
|||||||
@@ -75,7 +75,7 @@ void NavigatorGraphicsView::paintEvent(QPaintEvent *e)
|
|||||||
void NavigatorGraphicsView::wheelEvent(QWheelEvent *event)
|
void NavigatorGraphicsView::wheelEvent(QWheelEvent *event)
|
||||||
{
|
{
|
||||||
if (Qt::ControlModifier & event->modifiers()) {
|
if (Qt::ControlModifier & event->modifiers()) {
|
||||||
if (event->delta() > 0)
|
if (event->angleDelta().y() > 0)
|
||||||
emit zoomIn();
|
emit zoomIn();
|
||||||
else
|
else
|
||||||
emit zoomOut();
|
emit zoomOut();
|
||||||
|
|||||||
@@ -310,7 +310,7 @@ bool FunctionHintProposalWidget::eventFilter(QObject *obj, QEvent *e)
|
|||||||
if (d->m_popupFrame && !d->m_popupFrame->isAncestorOf(widget)) {
|
if (d->m_popupFrame && !d->m_popupFrame->isAncestorOf(widget)) {
|
||||||
abort();
|
abort();
|
||||||
} else if (e->type() == QEvent::Wheel) {
|
} else if (e->type() == QEvent::Wheel) {
|
||||||
if (static_cast<QWheelEvent*>(e)->delta() > 0)
|
if (static_cast<QWheelEvent*>(e)->angleDelta().y() > 0)
|
||||||
previousPage();
|
previousPage();
|
||||||
else
|
else
|
||||||
nextPage();
|
nextPage();
|
||||||
|
|||||||
Reference in New Issue
Block a user