File indexing completed on 2024-06-23 05:49:19
0001 /* 0002 This file is part of the Kasten Framework, made within the KDE community. 0003 0004 SPDX-FileCopyrightText: 2008-2009 Friedrich W. H. Kossebau <kossebau@kde.org> 0005 0006 SPDX-License-Identifier: LGPL-2.1-only OR LGPL-3.0-only OR LicenseRef-KDE-Accepted-LGPL 0007 */ 0008 0009 #ifndef KASTEN_ZOOMSLIDER_HPP 0010 #define KASTEN_ZOOMSLIDER_HPP 0011 0012 // Qt 0013 #include <QWidget> 0014 0015 class QSlider; 0016 class QToolButton; 0017 0018 namespace Kasten { 0019 0020 class AbstractModel; 0021 namespace If { 0022 class Zoomable; 0023 } 0024 0025 class ZoomSlider : public QWidget 0026 { 0027 Q_OBJECT 0028 0029 public: 0030 explicit ZoomSlider(QWidget* parent); 0031 ~ZoomSlider() override; 0032 0033 public: 0034 void setTargetModel(AbstractModel* model); 0035 0036 private: 0037 void updateToolTip(int sliderValue); 0038 0039 private Q_SLOTS: // action slots 0040 void zoomIn(); 0041 void zoomOut(); 0042 void onSliderValueChanged(int sliderValue); 0043 void onSliderMoved(int sliderValue); 0044 0045 private Q_SLOTS: 0046 void onZoomLevelChange(double level); 0047 0048 private: 0049 AbstractModel* mModel = nullptr; 0050 If::Zoomable* mZoomControl = nullptr; 0051 0052 double mZoomLevel; 0053 0054 QSlider* mSlider; 0055 QToolButton* mZoomInButton; 0056 QToolButton* mZoomOutButton; 0057 }; 0058 0059 } 0060 0061 #endif