File indexing completed on 2024-04-28 05:43:24

0001 /***************************************************************************
0002  *   Copyright (C) 2002 Lucijan Busch <lucijan@gmx.at>                     *
0003  *   Copyright (C) 2004 Jaroslaw Staniek <js@iidea.pl>                     *
0004  *   Copyright (C) 2006 David Saxton <david@bluehaze.org>                  *
0005  *                                                                         *
0006  *   This program is free software; you can redistribute it and/or modify  *
0007  *   it under the terms of the GNU General Public License as published by  *
0008  *   the Free Software Foundation; either version 2 of the License, or     *
0009  *   (at your option) any later version.                                   *
0010  ***************************************************************************/
0011 
0012 #ifndef PROPERTYEDITORINPUT_H
0013 #define PROPERTYEDITORINPUT_H
0014 
0015 #include "doublespinbox.h"
0016 
0017 #include <QSpinBox>
0018 
0019 #include "propertysubeditor.h"
0020 
0021 class KLineEdit;
0022 class QLineEdit;
0023 class QToolButton;
0024 class QEvent;
0025 
0026 class Variant;
0027 typedef Variant Property;
0028 
0029 class PropertyEditorInput : public PropertySubEditor
0030 {
0031     Q_OBJECT
0032 
0033 public:
0034     PropertyEditorInput(QWidget *parent, Property *property);
0035     ~PropertyEditorInput() override
0036     {
0037         ;
0038     }
0039 
0040 protected slots:
0041     void slotTextChanged(const QString &text);
0042 
0043 protected:
0044     KLineEdit *m_lineedit;
0045 };
0046 
0047 class PropIntSpinBox : public QSpinBox
0048 {
0049     Q_OBJECT
0050 
0051 public:
0052     PropIntSpinBox(int lower, int upper, int step, int value, int base, QWidget *parent);
0053     ~PropIntSpinBox() override
0054     {
0055         ;
0056     }
0057 
0058     bool eventFilter(QObject *o, QEvent *e) override;
0059     QLineEdit *editor() const
0060     {
0061         return QSpinBox::lineEdit();
0062     }
0063 };
0064 
0065 class PropertyEditorSpin : public PropertySubEditor
0066 {
0067     Q_OBJECT
0068 
0069 public:
0070     PropertyEditorSpin(QWidget *parent, Property *property);
0071     ~PropertyEditorSpin() override
0072     {
0073         ;
0074     }
0075 
0076 protected slots:
0077     void valueChange(int);
0078 
0079 protected:
0080     PropIntSpinBox *m_spinBox;
0081 };
0082 
0083 class PropDoubleSpinBox : public DoubleSpinBox
0084 {
0085     Q_OBJECT
0086 
0087 public:
0088     PropDoubleSpinBox(double lower, double upper, double minAbs, double value, const QString &unit, QWidget *parent);
0089     ~PropDoubleSpinBox() override
0090     {
0091         ;
0092     }
0093 
0094     bool eventFilter(QObject *o, QEvent *e) override;
0095     QLineEdit *editor() const
0096     {
0097         return DoubleSpinBox::lineEdit();
0098     }
0099 };
0100 
0101 class PropertyEditorDblSpin : public PropertySubEditor
0102 {
0103     Q_OBJECT
0104 
0105 public:
0106     PropertyEditorDblSpin(QWidget *parent, Property *property);
0107     ~PropertyEditorDblSpin() override
0108     {
0109         ;
0110     }
0111 
0112 protected slots:
0113     void valueChange(double value);
0114 
0115 protected:
0116     PropDoubleSpinBox *m_spinBox;
0117 };
0118 
0119 class PropertyEditorBool : public PropertySubEditor
0120 {
0121     Q_OBJECT
0122 
0123 public:
0124     PropertyEditorBool(QWidget *parent, Property *property);
0125     ~PropertyEditorBool() override
0126     {
0127         ;
0128     }
0129 
0130     bool eventFilter(QObject *watched, QEvent *e) override;
0131 
0132 protected slots:
0133     void setState(bool state);
0134 
0135 protected:
0136     QToolButton *m_toggle;
0137 };
0138 
0139 #endif