-
-
Notifications
You must be signed in to change notification settings - Fork 0
/
RegionWidget.cpp
37 lines (28 loc) · 853 Bytes
/
RegionWidget.cpp
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
//
// Created by Kamil Rojewski on 16.07.2021.
//
#include <QHBoxLayout>
#include <QSlider>
#include "RegionWidget.h"
RegionWidget::RegionWidget(QWidget *parent)
: QWidget{parent}
{
const auto layout = new QHBoxLayout{this};
fromSlider = new QSlider{Qt::Horizontal};
connect(fromSlider, &QSlider::valueChanged, this, [=](auto from) {
emit regionChanged(from, toSlider->value());
});
layout->addWidget(fromSlider);
toSlider = new QSlider{Qt::Horizontal};
connect(toSlider, &QSlider::valueChanged, this, [=](auto to) {
emit regionChanged(fromSlider->value(), to);
});
layout->addWidget(toSlider);
}
void RegionWidget::setConfiguration(int max, int from, int to)
{
fromSlider->setMaximum(max);
toSlider->setMaximum(max);
fromSlider->setValue(from);
toSlider->setValue(to);
}