2015-01-20 7 views
0

Qt에서 그래프를 생성하기 위해 QCustom Plot을 사용하고 있지만 디자인 탭에서 위젯 크기를 최대화 한 후에도 생성 된 그래프가 너무 작습니다. 전체 화면으로 그래프/플롯을 만들 수있는 방법이 있습니까? 코드를 실행하고 gui 창을 최대화하면 플롯 자체의 크기가 변경되지 않습니다.qt의 전체 화면 플롯

setGeometry(QApplication::desktop()->screenGeometry()); /* in your QMainWindow derivative constructor */ 

지금 그래프가 자동 규모해야합니다 : 그것은 충분하지 않으면

ui->customPlot->rescaleAxes(); /* after the graph data is filled */ 

, 당신은 항상 확대 할 수있는 기능을 추가 할 수 있습니다 전체 화면에 Qcustomplot 창 설정에 대한

void Cpp_Fire::on_manual_fire_clicked() 
{ 


    // Code for graph 
    // generate some data: 
    QVector<double> x(variables.nr_samples), y(variables.nr_samples); 

    for (int i=0; i<variables.nr_samples; ++i) 
    { 
     x[i] = x_axis[i]; 
     y[i] = y_axis[i]; 
    } 


    ui->customPlot->addGraph(); 
    ui->customPlot->graph(0)->setData(x, y); 

    ui->customPlot->xAxis->setLabel("x"); 
    ui->customPlot->yAxis->setLabel("y"); 

    ui->customPlot->xAxis->setRange(x[0], x[variables.nr_samples-1]); 
    ui->customPlot->yAxis->setRange(0, 65000); 
    ui->customPlot->replot(); 
} 
+0

setViewport() 함수를 사용해 보셨습니까? 일반적으로 그래프를 내보낼 때 사용되지만 위젯 크기를 초과하여 그래프의 크기를 조정할 수 있습니다. – geekonedge

+0

자세히 수행 한 작업을 지정하십시오. – Tay2510

+0

@ Bosman. 어떻게하면 좋을까요? @Tay, qcustomplot을 사용하여 그래프를 만들었습니다. 팝업 창을 최대화 할 때 그래프가 포함 된 위젯의 크기가 변경되지 않고 그대로 유지되고 최대화하거나 커지 려합니다. – Duanne

답변

0

또는 그래프를 드래그하여 원하는보기를 얻으십시오 :

ui->customPlot->setInteractions(QCP::iRangeDrag | QCP::iRangeZoom);