Vertical QLabel, or the equivalent?

前端 未结 5 2202
执念已碎
执念已碎 2021-01-04 03:53

I want axis labels for a plot I\'m making, and naturally the y-axis label should be oriented vertically. I\'m pretty sure QwtPlot does this, but I\'m trying to

5条回答
  •  鱼传尺愫
    2021-01-04 04:49

    You can also create a new QGraphicsScene, add to it QLabel and then rotate it. Like this:

    QLabel* label = QLabel("Y axis"); 
    QGraphicsScene scene;
    QGraphicsProxyWidget  * proxy = scene.addWidget(label);
    proxy->rotate(-45);
    QGraphicsView view(&scene);
    view.show();  
    

    Take a look at the similar example (the output image has a wrong ratio, look at the direct URL).

提交回复
热议问题