2017-03-08 17 views
1

QCustomPlotウィジェットにテキスト項目を追加しようとしています。 QCPItemTextコンストラクタは、QCustomPlotウィジェットへのポインタを引数として取ります。QCustomPlot QCustomItemTextを追加する

QCPItemText::QCPItemText (QCustomPlot * parentPlot)

QCPItemTextオブジェクトを作成した後、それは、QCustomPlot::addItem()をメンバー関数を使用してウィジェットを追加することができます。しかし、私の問題は、プログラムがコンパイルされないということです。それはQCustomPlot::addItem()と呼ばれるメンバー関数はないと言います。でもこれはexampleと思われます。私は混乱しています。

これは私のコードの一部です。 dynamicWidgetHash各所与keyためQCustomPlot *を格納QHashオブジェクトが、ある

//hash out current widget 
    QCustomPlot *currentWidget = GraphWindow::dynamicWidgetHash.value(slot); 

    //Setup font 
    QFont plotFont; 
    plotFont.setStyleHint(QFont::Helvetica); 
    plotFont.setBold(true); 
    plotFont.setWeight(8); 
    plotFont.setPointSize(16); 

    GraphWindow::setupBackground(slot);   
    QCPItemText itemText(currentWidget); 
    QString dataText = "No " + xLabel + " data found. \nPossibly the firm may not possess " + xLabel; 
    itemText.setText(dataText); 
    itemText.setPositionAlignment(Qt::AlignTop|Qt::AlignCenter); 
    itemText.position->setType(QCPItemPosition::ptAxisRectRatio); 
    itemText.position->setCoords(2,2); 
    itemText.setFont(plotFont); 
    itemText.setPen(QPen(Qt::white)); 

。私は

currentWidget->addIem(itemText);

パスをインストール QcustomPlotに存在する changelog.txtファイル内の79行で

答えて

0

、あなたはそれを読み込むことがわかります。この行を使用しようとすると

エラーが発生します:

削除されましたQCustomPlot::addItemは今やアイテムとしてはもう必要ありません 自動的にregisそのコンストラクタで

だから、currentWidget->addIem(itemText)の必要はありません。

関連する問題