QCustomplot 사용 및 동적 링크 라이브러리 컴파일 과정

#ifndef _HLM_GRAPH_H_
#define _HLM_GRAPH_H_
#include 

class hlm_temp_Graph : public QWidget
{
public:
    explicit hlm_temp_Graph(QWidget *parent = 0);

    ~hlm_temp_Graph();

    bool set_XY_Vector_value(QVector &, QVector &);
private:
    QCustomPlot *customplot;
};




#endif // HLM_GRAPH_H
#include "hlm_graph.h"
#include 


hlm_temp_Graph::hlm_temp_Graph(QWidget *parent) : QWidget(parent)
{
    customplot = new QCustomPlot(this);
    this->resize(800, 480);
    customplot->resize(350, 130);
    customplot->move(440, 310);
}

bool hlm_temp_Graph::set_XY_Vector_value(QVector &X_Vectorcount, QVector &Y_Vectortemp)
{
    QVector Y_tempTickVertor(7); //y        

    for ( int i = 0; i addGraph();

    graph1->setData(X_Vectorcount, Y_Vectortemp);   //          ,      ,     

    customplot->yAxis->setRange(0, 30);     //y     0-30    
    customplot->xAxis->setRange(1, X_Vectorcount.size());     //x     1-20 

    customplot->xAxis->setAutoTicks(false); //x             
    customplot->yAxis->setAutoTicks(false); //y             

    customplot->xAxis->setTickVector(X_Vectorcount);   //x     ,  count      
    customplot->yAxis->setTickVector(Y_tempTickVertor);   //y     ,  tempTickVertor       

    customplot->xAxis->setLabel(QString::fromUtf8("  / ")); //  x      
    customplot->yAxis->setLabel(QString::fromUtf8("  /℃")); //  y      

    //graph1->setPen(QPen(QColor(255, 74, 15), 2));   //          2      
    graph1->setPen(QPen(Qt::NoPen));                  //           

    graph1->setBrush(QColor(255, 116, 21, 125));        //  graph1          125    ,      255


    customplot->xAxis->setSubTickPen(QPen(Qt::NoPen));  //  x           ,            
    customplot->yAxis->setSubTickPen(QPen(Qt::NoPen));  //  y           ,            


    customplot->xAxis->grid()->setPen(QPen(Qt::NoPen)); //  x          (           )Qt::NoPen        , x             
    customplot->yAxis->grid()->setPen(QPen(QColor(227, 227, 227), Qt::SolidLine));  //  y               ,Qt::SolidLine        

    QLinearGradient plotGradient;       //      
    plotGradient.setStart(0, 310);        //         
    plotGradient.setFinalStop(0, 440);  //          

    plotGradient.setColorAt(0, QColor(243, 243, 243)); //              
    plotGradient.setColorAt(1, QColor(50, 50, 50)); //              ,           0    1       ,0 1              
    customplot->setBackground(plotGradient);    //              
}

hlm_temp_Graph::~hlm_temp_Graph()
{
    delete customplot;
}
#include "mainwindow.h"
#include 
#include "hlm_graph.h"

int main(int argc, char *argv[])
{
    QApplication a(argc, argv);

//    MainWindow w;

//    w.show();



    QVector X_Vectorcount(20), Y_Vectortemp(20); //Vectorcount      ,Vectortemp    ,tempTickVertor y        
    Y_Vectortemp[0] = 20.5;
    Y_Vectortemp[1] = 22.5;
    Y_Vectortemp[2] = 22.5;
    Y_Vectortemp[3] = 25.5;
    Y_Vectortemp[4] = 28.5;
    Y_Vectortemp[5] = 26.5;
    Y_Vectortemp[6] = 23.5;
    Y_Vectortemp[7] = 21.5;
    Y_Vectortemp[8] = 25.5;
    Y_Vectortemp[9] = 26.5;
    Y_Vectortemp[10] = 27.5;
    Y_Vectortemp[11] = 25.5;
    Y_Vectortemp[12] = 23.5;
    Y_Vectortemp[13] = 24.5;
    Y_Vectortemp[14] = 24.5;
    Y_Vectortemp[15] = 24.5;
    Y_Vectortemp[16] = 26.5;
    Y_Vectortemp[17] = 26.5;
    Y_Vectortemp[18] = 27.5;
    Y_Vectortemp[19] = 27.5;

    hlm_temp_Graph temp_grap;
    temp_grap.set_XY_Vector_value(X_Vectorcount, Y_Vectortemp);

    temp_grap.show();


    return a.exec();
}

전제는http://www.qcustomplot.com/index.php/support/documentationQCustomPlot - v1 다운로드0.zip에서 qcustomplot.cpp qcustomplot.h를 Qt의 프로젝트에 넣습니다.
대응하는 ui 컨트롤을 원한다면 ui 디자인에서 Widget 구성 요소를 선택한 다음 Widget 구성 요소를 QCustom Plot으로 승급하면 ui->customplot 형식으로 이 Qcustomplot를 조작할 수 있습니다
동적 링크 라이브러리를 컴파일하는 방법:
공식 사이트에 가다http://www.qcustomplot.com/index.php/support/documentationQCustomPlot-sharedlib을 다운로드하십시오.tar.gz, 자신의 버전에 따라 다운로드를 진행합니다.
arm-linux 버전의 동적 연결 라이브러리로 컴파일하려면.so 형식의, 내가 사용하는 방법은 우선 당신의 교차 컴파일 도구 체인이arm-linux-gcc라는 것을 확인한 다음에 다운로드한 QCustom Plot-sharedlib을 사용하는 것입니다.tar.gz를 가상 컴퓨터에 공유 디렉터리를 제외한 디렉터리에 넣은 다음 qcustomplot를 넣습니다.cpp qcustomplot.h를 및 QCustomPlot-sharedlib에 넣습니다.tar.gz가 있는 같은 디렉터리에서 QCustomPlot-sharedlib을 풀십시오.tar.gz,sharedlib-compilation 디렉터리에 들어가서 먼저 qmake,그 다음에 make,그 다음에 GNU/LINUX에서 사용합니다.동적 링크 라이브러리가 나왔습니다. 그 다음에cp*so*xx/-rdf 방식으로 동적 링크 라이브러리를 공유 디렉터리를 제외한 디렉터리에 복사한 다음에 압축 패키지로 압축한 다음에 폴더 형식의 파일 시스템에 넣고 압축을 풀면 됩니다.rdf는 기호 연결이 복사된 후에도 연결에 부합되도록 하기 위해서입니다.

좋은 웹페이지 즐겨찾기