Commit 58ebd509 authored by Thomas Hartmann's avatar Thomas Hartmann
Browse files

QmlDesigner.GradientLine: fixes several usability issues

To many signals were emitted which lead to unneccary
rewriting.

Eat events to avoid moving the (parent) pane
parent 80c93956
......@@ -684,13 +684,9 @@ void GradientLine::mousePressEvent(QMouseEvent *event)
setCurrentIndex(draggedIndex);
update();
}
} else {
QWidget::mousePressEvent(event);
}
if (draggedIndex == -1)
m_create = true;
} else {
QWidget::mousePressEvent(event);
}
setFocus(Qt::MouseFocusReason);
}
......@@ -706,6 +702,7 @@ void GradientLine::mouseDoubleClickEvent(QMouseEvent *event)
void GradientLine::mouseReleaseEvent(QMouseEvent *event)
{
if (event->button() == Qt::LeftButton) {
event->accept();
if (m_dragActive == false && m_create) {
qreal stopPos = qreal(event->pos().x() - 9) / qreal((width() - 15));
int index = -1;
......@@ -720,14 +717,11 @@ void GradientLine::mouseReleaseEvent(QMouseEvent *event)
updateGradient();
}
}
event->accept();
}
m_dragActive = false;
m_yOffset = 0;
update();
updateGradient();
//QWidget::mouseReleaseEvent(event);
setFocus(Qt::MouseFocusReason);
}
void GradientLine::mouseMoveEvent(QMouseEvent *event)
......@@ -762,8 +756,6 @@ void GradientLine::mouseMoveEvent(QMouseEvent *event)
m_dragStart = event->pos();
update();
}
//QWidget::mouseMoveEvent(event);
}
void GradientLine::setup()
......@@ -841,7 +833,7 @@ void GradientLine::setCurrentIndex(int i)
if (i == m_colorIndex)
return;
m_colorIndex = i;
setActiveColor(m_colorList.at(i));
m_activeColor = m_colorList.at(i);
emit activeColorChanged();
update();
}
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment