156 lines
3.3 KiB
C++
156 lines
3.3 KiB
C++
/*
|
|
QAD - Qt ADvanced
|
|
|
|
Ivan Pelipenko peri4ko@yandex.ru, Andrey Bychkov work.a.b@yandex.ru
|
|
|
|
This program is free software: you can redistribute it and/or modify
|
|
it under the terms of the GNU Lesser General Public License as published by
|
|
the Free Software Foundation, either version 3 of the License, or
|
|
(at your option) any later version.
|
|
|
|
This program is distributed in the hope that it will be useful,
|
|
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
|
GNU Lesser General Public License for more details.
|
|
|
|
You should have received a copy of the GNU Lesser General Public License
|
|
along with this program. If not, see <http://www.gnu.org/licenses/>.
|
|
*/
|
|
|
|
#ifndef QVARIANTEDIT_H
|
|
#define QVARIANTEDIT_H
|
|
|
|
#include <QCheckBox>
|
|
#include <QPushButton>
|
|
#include <QDoubleSpinBox>
|
|
#include "qvariantedit_custom.h"
|
|
#include "qad_types.h"
|
|
#include "clineedit.h"
|
|
#include "ecombobox.h"
|
|
#include "colorbutton.h"
|
|
#include "qrectedit.h"
|
|
#include "qpointedit.h"
|
|
#include "evalspinbox.h"
|
|
#include "qad_widgets_export.h"
|
|
|
|
|
|
class QAD_WIDGETS_EXPORT StringListEdit: public QWidget
|
|
{
|
|
Q_OBJECT
|
|
public:
|
|
StringListEdit(QWidget * parent = 0);
|
|
~StringListEdit();
|
|
|
|
QStringList value() const;
|
|
|
|
private:
|
|
virtual void changeEvent(QEvent * e);
|
|
|
|
QBoxLayout lay;
|
|
EComboBox * combo;
|
|
QPushButton * butt_add, * butt_del, * butt_clear;
|
|
|
|
public slots:
|
|
void setValue(const QStringList & v);
|
|
|
|
private slots:
|
|
void editItem();
|
|
void addItem();
|
|
void delItem();
|
|
void clear();
|
|
|
|
signals:
|
|
void valueChanged();
|
|
|
|
};
|
|
|
|
|
|
|
|
|
|
class QAD_WIDGETS_EXPORT PathEdit: public QWidget
|
|
{
|
|
Q_OBJECT
|
|
public:
|
|
PathEdit(QWidget * parent = 0);
|
|
~PathEdit() {delete line; delete butt_select;}
|
|
|
|
QString value() const {return line->text();}
|
|
|
|
bool is_dir, is_abs, is_save;
|
|
QString filter;
|
|
|
|
private:
|
|
virtual void changeEvent(QEvent * e);
|
|
virtual void resizeEvent(QResizeEvent * );
|
|
|
|
QBoxLayout lay;
|
|
CLineEdit * line;
|
|
QPushButton * butt_select;
|
|
|
|
public slots:
|
|
void setValue(const QString & v);
|
|
|
|
private slots:
|
|
void select();
|
|
|
|
signals:
|
|
void valueChanged();
|
|
|
|
};
|
|
|
|
|
|
|
|
|
|
class QAD_WIDGETS_EXPORT QVariantEdit: public QWidget
|
|
{
|
|
Q_OBJECT
|
|
Q_PROPERTY(QVariant value READ value WRITE setValue)
|
|
|
|
public:
|
|
explicit QVariantEdit(QWidget * parent = 0);
|
|
~QVariantEdit();
|
|
|
|
QVariant value() const;
|
|
//QSize sizeHint() const {if (_cur_edit) return _cur_edit->sizeHint(); return QWidget::sizeHint();}
|
|
//QSize minimumSizeHint() const {if (_cur_edit) return _cur_edit->minimumSizeHint(); return QWidget::minimumSizeHint();}
|
|
|
|
protected:
|
|
virtual void resizeEvent(QResizeEvent * );
|
|
void _recreate(const QVariant & new_value);
|
|
void _delete();
|
|
void _resize();
|
|
void _newPath();
|
|
void _setEnum(const QAD::Enum & v);
|
|
void _setFile(const QAD::File & v);
|
|
void _setDir(const QAD::Dir & v);
|
|
void _setCustom(const QVariant & v);
|
|
|
|
|
|
QLabel * _empty;
|
|
CLineEdit * _line;
|
|
QCheckBox * _check;
|
|
ColorButton * _color;
|
|
StringListEdit * _list;
|
|
QDateTimeEdit * _date;
|
|
QDoubleSpinBox * _spin;
|
|
EvalSpinBox * _espin;
|
|
QRectEdit * _rect;
|
|
QPointEdit * _point;
|
|
PathEdit * _path;
|
|
EComboBox * _enum;
|
|
QWidget * _custom, * _cur_edit;
|
|
QVariant _value;
|
|
|
|
private slots:
|
|
void _changed();
|
|
|
|
public slots:
|
|
void setValue(const QVariant & v);
|
|
|
|
signals:
|
|
void valueChanged(QVariant);
|
|
|
|
};
|
|
|
|
#endif // QVARIANTEDIT_H
|