1

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

QCPItemText::QCPItemText ( QCustomPlot * parentPlot)

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

これは私のコードの一部です。

    //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));

wheredynamicWidgetHashは、指定された for eachQHashを格納するオブジェクトです。QCustomPlot *key

この行を使用しようとするとエラーが発生します

currentWidget->addIem(itemText);

4

1 に答える 1