2016-09-16 14 views
1

오른쪽 축을 드래그 가능하게하려고합니다.두 번째 오른쪽에 QCustomPlot 및 iRangeDrag yAxis

바로 지금 첫 번째 yAxis을 두 번 클릭하여 드래그 할 수있는 사이트 예제 중 하나를 사용합니다.

void MainWindow::mousePress() 
{ 
// if an axis is selected, only allow the direction of that axis to be dragged 
// if no axis is selected, both directions may be dragged 

if (ui->customPlot->xAxis->selectedParts().testFlag(QCPAxis::spAxis)) 
    ui->customPlot->axisRect()->setRangeDrag(ui->customPlot->xAxis->orientation()); 
else if (ui->customPlot->yAxis->selectedParts().testFlag(QCPAxis::spAxis)) 
    ui->customPlot->axisRect()->setRangeDrag(ui->customPlot->yAxis->orientation()); 
else if (ui->customPlot->yAxis2->selectedParts().testFlag(QCPAxis::spAxis)) 
    ui->customPlot->axisRect()->setRangeDrag(ui->customPlot->yAxis2->orientation()); 
else 
    ui->customPlot->axisRect()->setRangeDrag(Qt::Horizontal|Qt::Vertical); 
} 

내 그래프에 각각 yAxis이있는 두 행이 있습니다. 달성하고자하는 것은 yAxis2라고하는 yAxis의 두 번째 (오른쪽)에있는 동일한 드래그 가능한 효과입니다. yAxis2을 선택한 경우에도 아래 코드를 사용하면 세로로 드래그되는 것은 yAxis입니다.

왼쪽의 yAxis와 관련이있는 axisRect()에 문제가있는 것 같습니다.

+0

누구나 아이디어가 있으십니까? – user217354

답변

0

오른쪽 축에도 드래그 호출을 수행하기 위해 코드를 수정하여 해결했습니다. 왼쪽 축에서 어떤 일이 일어나는지 살펴 보는 것은 매우 간단합니다.