如何在Q3DSurface上设置坐标轴标签?
How to set the axis labels on Q3DSurface?
我尝试通过执行以下操作在 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() {}
但是标签没有显示,有什么提示可以显示吗?
为 QValue3DAxis 设置此 属性 没有任何作用,因为它会自动生成标签。
我想你想设置轴标题,而不是标签。默认隐藏的标题
#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() {}
我尝试通过执行以下操作在 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() {}
但是标签没有显示,有什么提示可以显示吗?
为 QValue3DAxis 设置此 属性 没有任何作用,因为它会自动生成标签。
我想你想设置轴标题,而不是标签。默认隐藏的标题
#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() {}