File indexing completed on 2024-05-19 04:36:36
0001 /* This file is part of the TikZKit project. 0002 * 0003 * Copyright (C) 2014 Dominik Haumann <dhaumann@kde.org> 0004 * 0005 * This library is free software; you can redistribute it and/or modify 0006 * it under the terms of the GNU Library General Public License as published 0007 * by the Free Software Foundation, either version 2 of the License, or 0008 * (at your option) any later version. 0009 * 0010 * This library is distributed in the hope that it will be useful, 0011 * but WITHOUT ANY WARRANTY; without even the implied warranty of 0012 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 0013 * GNU Library General Public License for more details. 0014 * 0015 * You should have received a copy of the GNU Library General Public License 0016 * along with this library; see the file COPYING.LIB. If not, see 0017 * <http://www.gnu.org/licenses/>. 0018 */ 0019 0020 #ifndef TIKZ_UI_VALUE_PROPERTY_MANAGER_H 0021 #define TIKZ_UI_VALUE_PROPERTY_MANAGER_H 0022 0023 #include <QtAbstractPropertyManager> 0024 #include <tikz/core/Value.h> 0025 0026 namespace tikz { 0027 namespace ui { 0028 0029 class ValuePropertyManagerPrivate; 0030 0031 class ValuePropertyManager : public QtAbstractPropertyManager 0032 { 0033 Q_OBJECT 0034 public: 0035 ValuePropertyManager(QObject *parent = nullptr); 0036 ~ValuePropertyManager(); 0037 0038 tikz::Value value(const QtProperty *property) const; 0039 tikz::Value minimum(const QtProperty *property) const; 0040 tikz::Value maximum(const QtProperty *property) const; 0041 double singleStep(const QtProperty *property) const; 0042 int decimals(const QtProperty *property) const; 0043 bool isReadOnly(const QtProperty *property) const; 0044 0045 public Q_SLOTS: 0046 void setValue(QtProperty *property, const tikz::Value & val); 0047 void setMinimum(QtProperty *property, const tikz::Value & minVal); 0048 void setMaximum(QtProperty *property, const tikz::Value & maxVal); 0049 void setRange(QtProperty *property, const tikz::Value & minVal, const tikz::Value & maxVal); 0050 void setSingleStep(QtProperty *property, double step); 0051 void setDecimals(QtProperty *property, int prec); 0052 void setReadOnly(QtProperty *property, bool readOnly); 0053 Q_SIGNALS: 0054 void valueChanged(QtProperty *property, const tikz::Value & val); 0055 void rangeChanged(QtProperty *property, const tikz::Value & minVal, const tikz::Value & maxVal); 0056 void singleStepChanged(QtProperty *property, double step); 0057 void decimalsChanged(QtProperty *property, int prec); 0058 void readOnlyChanged(QtProperty *property, bool readOnly); 0059 protected: 0060 QString valueText(const QtProperty *property) const override; 0061 void initializeProperty(QtProperty *property) override; 0062 void uninitializeProperty(QtProperty *property) override; 0063 private: 0064 ValuePropertyManagerPrivate *d_ptr; 0065 Q_DECLARE_PRIVATE(ValuePropertyManager) 0066 Q_DISABLE_COPY(ValuePropertyManager) 0067 }; 0068 0069 } 0070 } 0071 0072 #endif // TIKZ_UI_VALUE_PROPERTY_MANAGER_H 0073 0074 // kate: indent-width 4; replace-tabs on;