void ScalePicker::mouseRightClicked(const QwtScale *scale, const QPoint &pos) 
{
QRect rect = scaleRect(scale);

int margin = 2; // pixels tolerance
rect.setRect(rect.x() - margin, rect.y() - margin, rect.width() + 2 * margin, rect.height() +  2 * margin);

if (rect.contains(pos)) 
	{
	if (scale->position() == QwtScale::Left || scale->position() == QwtScale::Right)
			emit axisRightClicked(scale->position());
	else if (scale->position() == QwtScale::Top)
		emit axisRightClicked(QwtScale::Bottom);
	else if (scale->position() == QwtScale::Bottom)
		emit axisRightClicked(QwtScale::Top);
	}
else
	{
	if (scale->position() == QwtScale::Left || scale->position() == QwtScale::Right)
		emit axisTitleRightClicked(scale->position());
	else if (scale->position() == QwtScale::Top)
		emit axisTitleRightClicked(QwtScale::Bottom);
	else if (scale->position() == QwtScale::Bottom)
		emit axisTitleRightClicked(QwtScale::Top);
	}
}
Exemple #2
0
void ScalePicker::mouseRightClicked(const QwtScaleWidget *scale,
                                    const QPoint &pos) {
  if (scaleRect(scale).contains(pos))
    emit axisRightClicked(scale->alignment());
  else
    emit axisTitleRightClicked();
}