No member named 'setAxisColor' in QwtPlot
时间: 2023-10-08 09:14:40 浏览: 42
Ap for the confusion. You are correct, QwtPlot class does have a `setAxisColor()` function. Instead, you set the axis color by the QwtPlot's QPlot::axisWidget() QwtScaleWidget::setPalette() functions.'s an example:
```cpp
#include <qwt_plot.h>
#include <qwt_scale_widget.h>
// Create a QwtPlot object
QwtPlot plot;
// Get the x-axis scale widget
QwtScaleWidget *xAxisWidget = plot.axisWidget(QwtPlot::xBottom);
// Set the color palette of the x-axis to white
QPalette xPalette = xAxisWidget->palette();
xPalette.setColor(QPalette::WindowText, Qt::white);
xAxisWidget->setPalette(xPalette);
// Draw the plot...
```
In this example, we first get the scale widget of the x-axis using `axisWidget()` function. Then, we create a new palette and set the window text color to white using `setWindowTextColor()`. Finally, we set the updated palette to the x-axis scale widget using `setPalette()`. This will effectively set the x-axis color to white.
相关推荐
![apk](https://img-home.csdnimg.cn/images/20210720083646.png)
![zip](https://img-home.csdnimg.cn/images/20210720083736.png)
![](https://csdnimg.cn/download_wenku/file_type_ask_c1.png)
![](https://csdnimg.cn/download_wenku/file_type_ask_c1.png)
![](https://csdnimg.cn/download_wenku/file_type_ask_c1.png)
![](https://csdnimg.cn/download_wenku/file_type_ask_c1.png)
![](https://csdnimg.cn/download_wenku/file_type_ask_c1.png)
![](https://csdnimg.cn/download_wenku/file_type_ask_c1.png)
![](https://csdnimg.cn/download_wenku/file_type_ask_c1.png)
![](https://csdnimg.cn/download_wenku/file_type_ask_c1.png)
![](https://csdnimg.cn/download_wenku/file_type_ask_c1.png)
![](https://csdnimg.cn/download_wenku/file_type_ask_c1.png)
![](https://csdnimg.cn/download_wenku/file_type_ask_c1.png)
![](https://csdnimg.cn/download_wenku/file_type_ask_c1.png)
![](https://csdnimg.cn/download_wenku/file_type_ask_c1.png)
![](https://csdnimg.cn/download_wenku/file_type_ask_c1.png)
![](https://csdnimg.cn/download_wenku/file_type_ask_c1.png)