MCPcopy Create free account
hub / github.com/CloudCompare/CloudCompare / mouseMoveEvent

Method mouseMoveEvent

libs/CCPluginAPI/src/ccColorScaleEditorWidget.cpp:394–427  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

392}
393
394void SlidersWidget::mouseMoveEvent(QMouseEvent* e)
395{
396 if (!m_sliders || m_sliders->size() <= 2)
397 return;
398
399 int pos = (m_orientation == Qt::Horizontal ? e->pos().x() : e->pos().y());
400 double relativePos = static_cast<double>(pos - DEFAULT_MARGIN) / static_cast<double>(length());
401
402 if (relativePos > 0.0 && relativePos < 1.0)
403 {
404 int activeSliderIndex = m_sliders->selected();
405
406 if (activeSliderIndex > 0 && activeSliderIndex + 1 < m_sliders->size()) //first and last sliders can't move!
407 {
408 ColorScaleElementSlider* slider = m_sliders->element(activeSliderIndex);
409 assert(slider && slider->isSelected());
410
411 if (m_orientation == Qt::Horizontal)
412 slider->move(pos - slider->width() / 2, 0);
413 else
414 slider->move(0, pos - slider->height() / 2);
415
416 slider->setRelativePos(relativePos);
417
418 m_sliders->sort();
419
420 Q_EMIT sliderModified(activeSliderIndex);
421
422 e->accept();
423
424 //update();
425 }
426 }
427}
428
429//void SlidersWidget::mouseReleaseEvent(QMouseEvent* e)
430//{

Callers

nothing calls this directly

Calls 10

posMethod · 0.80
selectedMethod · 0.80
elementMethod · 0.80
widthMethod · 0.80
heightMethod · 0.80
setRelativePosMethod · 0.80
lengthFunction · 0.50
sizeMethod · 0.45
sortMethod · 0.45
acceptMethod · 0.45

Tested by

no test coverage detected