diff options
author | akshay-c | 2019-09-13 12:24:18 +0530 |
---|---|---|
committer | akshay-c | 2019-09-13 12:24:18 +0530 |
commit | 13b6349465e26e8cd015e4153aa8843c706275ec (patch) | |
tree | 73cd7302c00957cb6eae1cacdffb77073556beec /ldmicro/iolist.cpp | |
parent | e64d76c057d561e81ad26dcc9acf04f014a855e9 (diff) | |
download | LDmicroQt-13b6349465e26e8cd015e4153aa8843c706275ec.tar.gz LDmicroQt-13b6349465e26e8cd015e4153aa8843c706275ec.tar.bz2 LDmicroQt-13b6349465e26e8cd015e4153aa8843c706275ec.zip |
Patch 1 ToolBar, AnalogSlider Realtime update
Diffstat (limited to 'ldmicro/iolist.cpp')
-rw-r--r-- | ldmicro/iolist.cpp | 18 |
1 files changed, 10 insertions, 8 deletions
diff --git a/ldmicro/iolist.cpp b/ldmicro/iolist.cpp index 5d2f2d5..cd5bb22 100644 --- a/ldmicro/iolist.cpp +++ b/ldmicro/iolist.cpp @@ -60,7 +60,7 @@ static BOOL AnalogSliderCancel; //Slider procedures to display slider values at realtime // and to close slider window on release -void AnalogSliderProc(int Value); +void AnalogSliderProc(int Value, char* name); void AnalogSliderRelProc(char* name); void ListView_RedrawItems(HLIST list, int min, int max); @@ -449,13 +449,14 @@ void ShowAnalogSliderPopup(char *name) AnalogSliderLabel = new QLabel(); char str[5]; - sprintf(str, "%d",currentVal); + sprintf(str, "%d",currentVal); AnalogSliderLabel->setText(str); - // AnalogSliderTrackbar->setTracking(FALSE); AnalogSliderLayout->addWidget(AnalogSliderTrackbar); AnalogSliderLayout->addWidget(AnalogSliderLabel); QObject::connect(AnalogSliderTrackbar, - &QSlider::valueChanged,AnalogSliderProc); + &QSlider::valueChanged, + std::bind(AnalogSliderProc, std::placeholders::_1, name) + ); QObject::connect(AnalogSliderTrackbar, &QSlider::sliderReleased, std::bind(AnalogSliderRelProc, name) @@ -469,10 +470,7 @@ void ShowAnalogSliderPopup(char *name) void AnalogSliderRelProc(char* name) { - SWORD v = AnalogSliderTrackbar->value(); AnalogSliderMain->hide(); - SetAdcShadow(name, v); - SimulateOneCycle(TRUE); } void ListView_RedrawItems(HLIST list, int min, int max) @@ -498,11 +496,15 @@ void ListView_RedrawItems(HLIST list, int min, int max) } } -void AnalogSliderProc(int Value) +void AnalogSliderProc(int Value, char* name) { char str[5]; sprintf(str, "%d", Value); AnalogSliderLabel->setText(str); + SWORD v = AnalogSliderTrackbar->value(); + // AnalogSliderMain->hide(); + SetAdcShadow(name, v); + SimulateOneCycle(TRUE); } static void MakeControls() |