I want to overwrite an axis label (with a QLineEdit in z direction, not C++) in order to give the user a possibility to change axis boundaries directly on a label. I found that the axis labels don't use the applications font - please consider this program:

Qt Code:
  1. #include <QApplication>
  2. #include <QMainWindow>
  3. #include "qwt_plot.h"
  4. #include <QDebug>
  5. #include "qwt_scale_draw.h"
  6. #include "qwt_text.h"
  9. class Demo : public QMainWindow
  10. {
  11. public:
  12. Demo(QWidget *parent = 0) : QMainWindow(parent){
  13. _plot = new QwtPlot(this);
  14. }
  16. QwtPlot *plot() {
  17. return _plot;
  18. }
  20. private:
  21. QwtPlot *_plot;
  22. };
  24. int main(int argc, char *argv[])
  25. {
  27. QApplication a(argc, argv);
  29. Demo w;
  30. w.setFont(QFont("Arial"));
  31. w.show();
  32. qDebug() << "Plot" << w.plot()->font();
  33. qDebug() << "ScaleDraw label" << w.plot()->axisScaleDraw(QwtPlot::xBottom)->label(450).font();
  34. return a.exec();
  35. }
To copy to clipboard, switch view to plain text mode 

This program gives the output:

Plot QFont( "Arial,8.14286,-1,5,50,0,0,0,0,0" )
ScaleDraw label QFont( "MS Shell Dlg 2,8.14286,-1,5,50,0,0,0,0,0" )

So obviously the applications font isn't propagated to QwtScaleDraw. QwtScaleDraw is not a QWidget, so this must be done by hand actually. (feature request if it is not implemented in the mean time - I'm using qwt6.1.2)

But back to the labels: if I use the font MS Shell Dlg on my QLineEdit, the text looks different from the other labels. I'm confused now: on the one hand the label says, MS Shell Dlg is used for rendering the text, on the other hand it doesn't look like MS Shell Dlg.

How can I get the font used to render the labels?

Best regards,