File indexing completed on 2024-06-16 04:16:03

0001 /*
0002  *  SPDX-FileCopyrightText: 2016 Jouni Pentikäinen <joupent@gmail.com>
0003  *
0004  *  SPDX-License-Identifier: GPL-2.0-or-later
0005  */
0006 
0007 #include "kis_zoom_button.h"
0008 
0009 #include <cmath>
0010 #include <QMouseEvent>
0011 
0012 
0013 KisZoomButton::KisZoomButton(QWidget *parent)
0014     : KisDraggableToolButton(parent)
0015 {
0016     connect(this, &KisZoomButton::valueChanged,
0017             this, &KisZoomButton::slotValueChanged);
0018 }
0019 
0020 KisZoomButton::~KisZoomButton()
0021 {}
0022 
0023 void KisZoomButton::slotValueChanged(int value)
0024 {
0025     const int unitRadius = 200;
0026 
0027     emit zoom(qreal(value) / unitRadius);
0028 }