Qchart, legend()->setGeometry 不起作用
Qchart, legend()->setGeometry does not work
我按照 qt 文档 https://doc-snapshots.qt.io/qt5-5.11/qtcharts-legend-example.html 将图例从图表中分离并设置分离的图例尺寸
legend->detachFromChart();
m_chart->legend()->setBackgroundVisible(true);
m_chart->legend()->setBrush(QBrush(QColor(128, 128, 128, 128)));
m_chart->legend()->setPen(QPen(QColor(192, 192, 192, 192)));
m_chart->legend()->setGeometry(QRectF(80, 50, 100, 180));
m_chart->legend((->setGeometry(QRectF(80, 50, 100, 180(( 不起作用。前两个参数有效。图例的位置是(80,50(。但是,最后两个参数不起作用。图例的宽度不是 100,图例的高度不是 180。
设置几何图形后update()
应调用QLegend
函数:
m_chart->legend()->update();
设置图例的几何图形后更新图例。m_chart->legend((->update((.
重要说明:添加线系后设置图例的几何图形.这对我有用. 当我们在添加线系列之前设置图例和图表的属性时,它将不起作用。即使在某些情况下,也会导致应用程序崩溃。
相关文章:
- EASTL矢量<向量<int>>连续的
- C - 创建矢量&lt; vector&lt; double&gt;&gt;矩阵具有分配而不是inizializ
- C 字符串比较“祝您好运”&gt;“再见”
- 为什么将此对向量&lt; map&lt; int,int&gt;&gt;中的地图进行更新.失败
- Qchart, legend()->setGeometry 不起作用
- OpenCV & Qt - SetGeometry-Error
- C :对矢量进行排序&lt; struct&gt;(结构有2个整数)基于结构的整数之一
- C 操作员&gt;&gt;与突变器过载
- 明确的专业化“ CheckIntmap&lt;&gt;”实例化
- 是否需要使用 - &gt;运算符在C 中调用成员函数时
- 什么是模板&lt;&gt;inline bla bla
- 编辑C Qlist&lt; object*&gt; gt;QML代码和一些QML警告中的模型
- eigen :: llt&lt;eigen :: matrixxd&gt;具有不完整的类型
- 错误,包括&lt; ctype&gt;在原子上使用C 11
- 错误c++visual studio c2227左侧'->;Init';必须指向类/结构/联合/泛型类型
- std::vector<;uint8_t>;当C++11/14启用时,手动复制而不是调用memcpy
- ``这个''不能用this-&gt;指针变量
- 如何加入向量&lt; int&gt;到C 中的单个INT
- 是std :: set&lt; std :: future&gt;不可能存在
- 使用shared_ptr<字符串>转换为一个无序集合<字符串>