File indexing completed on 2024-04-28 04:21:22
0001 // SPDX-FileCopyrightText: 2015-2022 The KPhotoAlbum Development Team 0002 // 0003 // SPDX-License-Identifier: GPL-2.0-or-later 0004 0005 #ifndef GRIDRESIZESLIDER_H 0006 #define GRIDRESIZESLIDER_H 0007 0008 #include "ThumbnailComponent.h" 0009 0010 #include <QSlider> 0011 0012 class QTimer; 0013 0014 namespace ThumbnailView 0015 { 0016 class ThumbnailWidget; 0017 0018 /** 0019 * @brief The GridResizeSlider class 0020 * The GridResizeSlider is a QSlider that ties into the ThumbnailView infrastructure, 0021 * as well as into the SettingsData on thumbnail size. 0022 * 0023 * Moving the slider changes the displayed thumbnail size, and changing the 0024 * thumbnail size in the SettingsData reflects on the slider. 0025 * Changes in SettingsData::thumbnailSize() are reflected in the maximum slider value. 0026 */ 0027 class GridResizeSlider : public QSlider, private ThumbnailComponent 0028 { 0029 Q_OBJECT 0030 public: 0031 explicit GridResizeSlider(ThumbnailFactory *factory); 0032 ~GridResizeSlider() override; 0033 0034 Q_SIGNALS: 0035 void isResizing(bool); 0036 0037 protected: 0038 void mousePressEvent(QMouseEvent *) override; 0039 void mouseReleaseEvent(QMouseEvent *) override; 0040 void wheelEvent(QWheelEvent *) override; 0041 0042 private Q_SLOTS: 0043 void enterGridResizingMode(); 0044 void leaveGridResizingMode(); 0045 void setCellSize(int size); 0046 void setMaximum(int size); 0047 0048 private: 0049 bool m_resizing; 0050 QTimer *m_timer; 0051 }; 0052 } 0053 0054 #endif /* GRIDRESIZESLIDER_H */ 0055 0056 // vi:expandtab:tabstop=4 shiftwidth=4: