Hi,

I'm triying to change the color of the numbers and axis of a Qwt plot. I think there is no simple way to do it (like myplot->setAxisColor(Axis id, QColor c).

So I tried to create a subclass of a QwtScaleDraw, and set the color to it. Then, set this ScaleDraw to my plot.

Here is de code:

Here is my subclass header file
Qt Code:
  1. class myAxisDraw: public QwtScaleDraw
  2. {
  3. public:
  4. myAxisDraw(QColor c);
  5. };
To copy to clipboard, switch view to plain text mode 

Here the cpp file
Qt Code:
  1. myAxisDraw::myAxisDraw(QColor c)
  2. {
  3. QPalette palette(c);
  4. QPainter * painter = new QPainter;
  5. painter->setPen(c);
  6. draw(painter, palette);
  7. }
To copy to clipboard, switch view to plain text mode 

And here is the function to change de color
Qt Code:
  1. void myClass::myFunction()
  2. {
  3. QColor c = QColorDialog::getColor( Qt::white, this );
  4. myAxisDraw * a = new myAxisDraw(c);
  5. myPlot->setAxisScaleDraw(myPlot->xBottom, a );
  6. myPlot->replot();
  7. }
To copy to clipboard, switch view to plain text mode 

It compiles but nothing happends. Any idea?

Thanks in advance!!