我尝试通过以下操作在Q3DSurface
上设置轴标签:
#include "mainwindow.h"
#include <Q3DSurface>
using namespace QtDataVisualization;
MainWindow::MainWindow(QWidget *parent) : QMainWindow(parent)
{
Q3DSurface *graph = new Q3DSurface;
QWidget *widget = QWidget::createWindowContainer(graph);
setCentralWidget(widget);
graph->axisX()->setLabels(QStringList{"a", "b", "c"});
}
MainWindow::~MainWindow() {}
但是标签没有显示,如何显示它们的提示?
答案 0 :(得分:0)
为QValue3DAxis设置此属性不会执行任何操作,因为它会自动生成标签。
答案 1 :(得分:0)
我认为您想设置轴标题,而不是标签。默认隐藏的标题
#include "mainwindow.h"
#include <Q3DSurface>
using namespace QtDataVisualization;
MainWindow::MainWindow(QWidget *parent) : QMainWindow(parent)
{
Q3DSurface *graph = new Q3DSurface;
QWidget *widget = QWidget::createWindowContainer(graph);
setCentralWidget(widget);
m_graph->axisX()->setTitle(QStringLiteral("a"));
m_graph->axisY()->setTitle(QStringLiteral("b"));
m_graph->axisZ()->setTitle(QStringLiteral("c"));
m_graph->axisX()->setTitleVisible(true);
m_graph->axisY()->setTitleVisible(true);
m_graph->axisZ()->setTitleVisible(true);
}
MainWindow::~MainWindow() {}