Merge pull request #20174 from alalek:issue_20159

pull/20180/head^2
Alexander Alekhin 4 years ago
commit 63256a00ff
  1. 9
      modules/highgui/src/window_QT.cpp
  2. 2
      modules/highgui/src/window_winrt_bridge.cpp

@ -1219,9 +1219,6 @@ void GuiReceiver::addSlider2(QString bar_name, QString window_name, void* value,
if (t) //trackbar exists if (t) //trackbar exists
return; return;
if (!value)
CV_Error(CV_StsNullPtr, "NULL value pointer" );
if (count <= 0) //count is the max value of the slider, so must be bigger than 0 if (count <= 0) //count is the max value of the slider, so must be bigger than 0
CV_Error(CV_StsNullPtr, "Max value of the slider must be bigger than 0" ); CV_Error(CV_StsNullPtr, "Max value of the slider must be bigger than 0" );
@ -1342,7 +1339,8 @@ void CvTrackbar::create(CvWindow* arg, QString name, int* value, int _count)
slider->setMinimum(0); slider->setMinimum(0);
slider->setMaximum(_count); slider->setMaximum(_count);
slider->setPageStep(5); slider->setPageStep(5);
slider->setValue(*value); if (dataSlider)
slider->setValue(*dataSlider);
slider->setTickPosition(QSlider::TicksBelow); slider->setTickPosition(QSlider::TicksBelow);
@ -1409,7 +1407,8 @@ void CvTrackbar::update(int myvalue)
{ {
setLabel(myvalue); setLabel(myvalue);
*dataSlider = myvalue; if (dataSlider)
*dataSlider = myvalue;
if (callback) if (callback)
{ {
callback(myvalue); callback(myvalue);

@ -271,7 +271,7 @@ void CvWindow::createSlider(cv::String name, int* val, int count, CvTrackbarCall
// Image control is loaded. See callback implementation in CvWindow ctor. // Image control is loaded. See callback implementation in CvWindow ctor.
slider->Width = sliderDefaultWidth; slider->Width = sliderDefaultWidth;
} }
slider->Value = *val; slider->Value = val ? *val : 0;
slider->Maximum = count; slider->Maximum = count;
slider->Visibility = Windows::UI::Xaml::Visibility::Visible; slider->Visibility = Windows::UI::Xaml::Visibility::Visible;
slider->Margin = Windows::UI::Xaml::ThicknessHelper::FromLengths(10, 10, 10, 0); slider->Margin = Windows::UI::Xaml::ThicknessHelper::FromLengths(10, 10, 10, 0);

Loading…
Cancel
Save