File indexing completed on 2025-02-23 04:06:48
0001 /* 0002 * SPDX-FileCopyrightText: 2016 Dmitry Kazakov <dimula73@gmail.com> 0003 * 0004 * SPDX-License-Identifier: GPL-2.0-or-later 0005 */ 0006 0007 #include "kis_slider_based_paintop_property.h" 0008 0009 #include "kis_paintop_settings.h" 0010 0011 template<typename T> 0012 KisSliderBasedPaintOpProperty<T>::KisSliderBasedPaintOpProperty(Type type, 0013 SubType subType, 0014 const KoID &id, 0015 KisPaintOpSettingsRestrictedSP settings, 0016 QObject *parent) 0017 : KisSliderBasedPaintOpPropertyBase(type, subType, id, settings, parent) 0018 , m_min(T(0)) 0019 , m_max(T(100)) 0020 , m_singleStep(T(1)) 0021 , m_pageStep(T(10)) 0022 , m_exponentRatio(1.0) 0023 , m_decimals(2) 0024 { 0025 } 0026 0027 template<typename T> 0028 KisSliderBasedPaintOpProperty<T>::KisSliderBasedPaintOpProperty(Type type, const KoID &id, KisPaintOpSettingsRestrictedSP settings, QObject *parent) 0029 : KisSliderBasedPaintOpPropertyBase(type, id, settings, parent) 0030 , m_min(T(0)) 0031 , m_max(T(100)) 0032 , m_singleStep(T(1)) 0033 , m_pageStep(T(10)) 0034 , m_exponentRatio(1.0) 0035 , m_decimals(2) 0036 { 0037 } 0038 0039 template<typename T> 0040 KisSliderBasedPaintOpProperty<T>::KisSliderBasedPaintOpProperty(const KoID &id, KisPaintOpSettingsRestrictedSP settings, QObject *parent) 0041 : KisSliderBasedPaintOpPropertyBase(Int, id, settings, parent) 0042 , m_min(T(0)) 0043 , m_max(T(100)) 0044 , m_singleStep(T(1)) 0045 , m_pageStep(T(10)) 0046 , m_exponentRatio(1.0) 0047 , m_decimals(2) 0048 { 0049 qFatal("Should have never been called!"); 0050 } 0051 0052 template <typename T> 0053 T KisSliderBasedPaintOpProperty<T>::min() const 0054 { 0055 return m_min; 0056 } 0057 0058 template <typename T> 0059 T KisSliderBasedPaintOpProperty<T>::max() const 0060 { 0061 return m_max; 0062 } 0063 0064 template <typename T> 0065 void KisSliderBasedPaintOpProperty<T>::setRange(T min, T max) 0066 { 0067 const bool valueChanged = m_min != min || m_max != max; 0068 0069 m_min = min; 0070 m_max = max; 0071 0072 if (valueChanged) { 0073 Q_EMIT sigRangeChanged(); 0074 } 0075 } 0076 0077 template <typename T> 0078 T KisSliderBasedPaintOpProperty<T>::singleStep() const 0079 { 0080 return m_singleStep; 0081 } 0082 0083 template <typename T> 0084 void KisSliderBasedPaintOpProperty<T>::setSingleStep(T value) 0085 { 0086 m_singleStep = value; 0087 } 0088 0089 template <typename T> 0090 T KisSliderBasedPaintOpProperty<T>::pageStep() const 0091 { 0092 return m_pageStep; 0093 } 0094 0095 template <typename T> 0096 void KisSliderBasedPaintOpProperty<T>::setPageStep(T value) 0097 { 0098 m_pageStep = value; 0099 } 0100 0101 template <typename T> 0102 qreal KisSliderBasedPaintOpProperty<T>::exponentRatio() const 0103 { 0104 return m_exponentRatio; 0105 } 0106 0107 template <typename T> 0108 void KisSliderBasedPaintOpProperty<T>::setExponentRatio(qreal value) 0109 { 0110 m_exponentRatio = value; 0111 } 0112 0113 template <typename T> 0114 int KisSliderBasedPaintOpProperty<T>::decimals() const 0115 { 0116 return m_decimals; 0117 } 0118 0119 template <typename T> 0120 void KisSliderBasedPaintOpProperty<T>::setDecimals(int value) 0121 { 0122 m_decimals = value; 0123 } 0124 0125 template <typename T> 0126 QString KisSliderBasedPaintOpProperty<T>::suffix() const 0127 { 0128 return m_suffix; 0129 } 0130 0131 template <typename T> 0132 void KisSliderBasedPaintOpProperty<T>::setSuffix(QString value) 0133 { 0134 m_suffix = value; 0135 } 0136 0137 0138 #include "kis_callback_based_paintop_property_impl.h" 0139 0140 template class KRITAIMAGE_EXPORT_INSTANCE KisSliderBasedPaintOpProperty<int>; 0141 template class KRITAIMAGE_EXPORT_INSTANCE KisSliderBasedPaintOpProperty<qreal>; 0142 0143 template class KRITAIMAGE_EXPORT_INSTANCE 0144 KisCallbackBasedPaintopProperty<KisSliderBasedPaintOpProperty<int>>; 0145 template class KRITAIMAGE_EXPORT_INSTANCE 0146 KisCallbackBasedPaintopProperty<KisSliderBasedPaintOpProperty<qreal>>;