File indexing completed on 2024-05-12 16:40:57
0001 /* This file is part of the KDE project 0002 Copyright (C) 2012 Oleg Kukharchuk <oleg.kuh@gmail.com> 0003 0004 This program is free software; you can redistribute it and/or 0005 modify it under the terms of the GNU Library General Public 0006 License as published by the Free Software Foundation; either 0007 version 2 of the License, or (at your option) any later version. 0008 0009 This program is distributed in the hope that it will be useful, 0010 but WITHOUT ANY WARRANTY; without even the implied warranty of 0011 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU 0012 Library General Public License for more details. 0013 0014 You should have received a copy of the GNU Library General Public License 0015 along with this program; see the file COPYING. If not, write to 0016 the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, 0017 * Boston, MA 02110-1301, USA. 0018 */ 0019 0020 #ifndef KEXISLIDER_H 0021 #define KEXISLIDER_H 0022 0023 #include "kexiextwidgets_export.h" 0024 0025 #include <QWidget> 0026 #include <QSlider> 0027 0028 class Slider; 0029 0030 0031 /** 0032 * @brief KexiSlider widget provides slider with spinbox and labels for tickmarks 0033 * 0034 */ 0035 class KEXIEXTWIDGETS_EXPORT KexiSlider : public QWidget 0036 { 0037 Q_OBJECT 0038 Q_PROPERTY(int value READ value WRITE setValue) 0039 Q_PROPERTY(int minimum READ minimum WRITE setMinimum) 0040 Q_PROPERTY(int maximum READ maximum WRITE setMaximum) 0041 Q_PROPERTY(Qt::Orientation orientation READ orientation WRITE setOrientation) 0042 Q_PROPERTY(int tickInterval READ tickInterval WRITE setTickInterval) 0043 Q_PROPERTY(QSlider::TickPosition tickPosition READ tickPosition WRITE setTickPosition) 0044 Q_PROPERTY(int singleStep READ singleStep WRITE setSingleStep) 0045 Q_PROPERTY(int pageStep READ pageStep WRITE setPageStep) 0046 Q_PROPERTY(bool showEditor READ showEditor WRITE setShowEditor) 0047 0048 public: 0049 explicit KexiSlider(QWidget *parent = 0); 0050 explicit KexiSlider(Qt::Orientation orientation, QWidget *parent = 0); 0051 ~KexiSlider(); 0052 0053 void setTickInterval(int ti); 0054 void setTickPosition(QSlider::TickPosition pos); 0055 void setMinimum(int min); 0056 void setMaximum(int max); 0057 void setSingleStep(int step); 0058 void setPageStep(int step); 0059 void setShowEditor(bool show); 0060 0061 int value() const; 0062 int maximum() const; 0063 int minimum() const; 0064 Qt::Orientation orientation() const; 0065 int singleStep() const; 0066 int pageStep() const; 0067 QSlider::TickPosition tickPosition() const; 0068 int tickInterval() const; 0069 bool showEditor() const; 0070 0071 Q_SIGNALS: 0072 void valueChanged(int); 0073 void sliderPressed(); 0074 void sliderReleased(); 0075 public Q_SLOTS: 0076 void setValue(int value); 0077 void setOrientation(Qt::Orientation o); 0078 private: 0079 void updateLayout(); 0080 void init(Qt::Orientation); 0081 0082 class Private; 0083 Private * const d; 0084 }; 0085 #endif // KEXISLIDER_H