mirror of
https://github.com/Lurkki14/tuxclocker.git
synced 2024-11-28 02:43:49 -06:00
interface/qt: add IntRange constructor and value getter
This commit is contained in:
parent
943ffc9a64
commit
a8bda3aa58
@ -2,6 +2,7 @@
|
||||
|
||||
IntRangeEditor::IntRangeEditor(QWidget *parent) : QWidget(parent) {
|
||||
m_mainLayout = new QHBoxLayout;
|
||||
m_mainLayout->setMargin(0);
|
||||
|
||||
m_slider = new QSlider(Qt::Horizontal);
|
||||
m_slider->setRange(0, 0);
|
||||
@ -21,9 +22,29 @@ IntRangeEditor::IntRangeEditor(QWidget *parent) : QWidget(parent) {
|
||||
setLayout(m_mainLayout);
|
||||
}
|
||||
|
||||
/*IntRangeEditor::IntRangeEditor(QWidget *parent, const tc_assignable_range_int_t *range) : QWidget(parent){
|
||||
IntRangeEditor::IntRangeEditor(QWidget* parent, const AssignableData &data) : QWidget(parent) {
|
||||
m_mainLayout = new QHBoxLayout;
|
||||
m_mainLayout->setMargin(0);
|
||||
|
||||
}*/
|
||||
m_slider = new QSlider(Qt::Horizontal);
|
||||
m_mainLayout->addWidget(m_slider);
|
||||
|
||||
m_spinBox = new QSpinBox;
|
||||
m_mainLayout->addWidget(m_spinBox);
|
||||
|
||||
connect(m_slider, &QSlider::valueChanged, m_spinBox, &QSpinBox::setValue);
|
||||
connect(m_slider, &QSlider::rangeChanged, m_spinBox, &QSpinBox::setRange);
|
||||
|
||||
connect(m_spinBox, QOverload<int>::of(&QSpinBox::valueChanged), m_slider, &QSlider::setValue);
|
||||
|
||||
m_slider->setRange(data.m_rangeInfo.int_range.min, data.m_rangeInfo.int_range.max);
|
||||
|
||||
setLayout(m_mainLayout);
|
||||
}
|
||||
|
||||
int IntRangeEditor::value() {
|
||||
return m_slider->value();
|
||||
}
|
||||
|
||||
void IntRangeEditor::setRange(const tc_assignable_range_int_t &range) {
|
||||
m_range = range;
|
||||
|
@ -3,6 +3,7 @@
|
||||
// Widget for editing TC_ASSIGNABLE_RANGE_INT nodes
|
||||
|
||||
#include <tc_assignable.h>
|
||||
#include <AssignableData.h>
|
||||
|
||||
#include <QWidget>
|
||||
#include <QHBoxLayout>
|
||||
@ -13,8 +14,8 @@ class IntRangeEditor : public QWidget {
|
||||
Q_OBJECT
|
||||
public:
|
||||
IntRangeEditor(QWidget *parent = nullptr);
|
||||
//IntRangeEditor(QWidget *parent = nullptr, const tc_assignable_range_int_t *range = nullptr);
|
||||
|
||||
IntRangeEditor(QWidget *parent = nullptr, const AssignableData &data = nullptr);
|
||||
int value();
|
||||
void setRange(const tc_assignable_range_int_t &range);
|
||||
private:
|
||||
QHBoxLayout *m_mainLayout;
|
||||
|
Loading…
Reference in New Issue
Block a user