Files
qad/libs/widgets/scroll_spin_box.h
peri4 46fd68a0fd SpinSlider and ScrollSpinBox read-only support
PIVariantEdit - support for read-only for all types
PIValueTreeEdit - drop Parent grouping, default now Groups, full grouping control, global read-only support, fix new label error
2023-04-28 19:51:22 +03:00

81 lines
2.1 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 SCROLL_SPIN_BOX_H
#define SCROLL_SPIN_BOX_H
#include "qad_widgets_export.h"
#include <QWidget>
namespace Ui {
class ScrollSpinBox;
}
class EvalSpinBox;
class QAD_WIDGETS_EXPORT ScrollSpinBox: public QWidget {
Q_OBJECT
Q_PROPERTY(double sensivity READ sensivity WRITE setSensivity)
Q_PROPERTY(double value READ value WRITE setValue)
Q_PROPERTY(int minimum READ minimum WRITE setMinimum)
Q_PROPERTY(int maximum READ maximum WRITE setMaximum)
public:
explicit ScrollSpinBox(QWidget * parent = 0);
EvalSpinBox * spin();
double value() const;
double sensivity() const { return sensivity_; }
int minimum() const { return m_minimum; }
int maximum() const { return m_maximum; }
void setReadOnly(bool r);
bool isReadOnly() const { return m_read_only; }
protected:
void changeEvent(QEvent * e);
void resizeEvent(QResizeEvent * e);
bool eventFilter(QObject * o, QEvent * e);
void mousePress(QMouseEvent * e);
void mouseRelease(QMouseEvent * e);
void mouseMove(QMouseEvent * e);
Ui::ScrollSpinBox * ui;
QPoint down_pos;
QString last_text;
double last_value, scroll_scale, sensivity_;
double m_minimum, m_maximum;
bool canceled, m_read_only = false;
public slots:
void setSensivity(double s) { sensivity_ = s; }
void setValue(double v);
void setMinimum(int minimum);
void setMaximum(int maximum);
signals:
void valueChanged(double);
};
#endif // SCROLL_SPIN_BOX_H