/
indicatingmsgwidget.cpp
48 lines (42 loc) · 1.22 KB
/
indicatingmsgwidget.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
38
39
40
41
42
43
44
45
46
47
48
#include "indicatingmsgwidget.h"
IndicatingMsgWidget::IndicatingMsgWidget(QWidget *parent) :
QWidget(parent)
{
setPalette(QPalette(QColor(0, 0, 0)));
setAutoFillBackground(true);
pIndicateHeight = new MySlider(this);
pIndicateHeight->setEnabled(false);
pIndicateHeight->setGeometry(30, 0, 20, 200);
pIndicateHeight->setTickPosition(QSlider::TicksLeft);
pIndicateHeight->setTickInterval(50);
pIndicateHeight->setRange(500, 1500);
pMinLabel = new QLabel(this);
pMinLabel->setGeometry(0, 190, 20, 10);
pMinLabel->setText("500");
pMaxLabel = new QLabel(this);
pMaxLabel->setGeometry(0, 0, 20, 10);
pMaxLabel->setText("1500");
pMidLabel = new QLabel(this);
pMidLabel->setGeometry(0, 100, 20, 10);
pMidLabel->setText("1000");
}
IndicatingMsgWidget::~IndicatingMsgWidget()
{
delete pMinLabel;
delete pMaxLabel;
delete pMidLabel;
delete pIndicateHeight;
}
void IndicatingMsgWidget::setHeightRange(int min, int max)
{
pIndicateHeight->setRange(min, max);
pMaxLabel->setText(QString::number(max));
pMinLabel->setText(QString::number(min));
pMidLabel->setText(QString::number((min+max)/2));
update();
}
void IndicatingMsgWidget::setHeight(int vle)
{
pIndicateHeight->setValue(vle);
update();
}