that's right.
browsing the code I can see that the problem is the orientation, and if I set the right orientation the value are the same:
//
QList< double > ld;
double q;
for(q=-60.0; q<=0.0; q+=5.0)
ld.append(q);
w->setScaleDiv(*sd);
qDebug("orient w %d", w->scaleDraw()->orientation()); // here is Qt::Vertical
qDebug("extent 2 %f", w->scaleDraw()->extent(w->font())); // is 31.0
sdraw->setScaleDiv(*sd);
qDebug("orient sdraw %d", sdraw->orientation()); // here is Qt:Horizontal
sdraw
->setAlignment
(QwtScaleDraw::LeftScale);
// Change to vertical
qDebug("extent 1 %f", sdraw->extent(w->font())); // here is also 31.0
//
QwtScaleDiv *sd = new QwtScaleDiv(-60, 0);
QList< double > ld;
double q;
for(q=-60.0; q<=0.0; q+=5.0)
ld.append(q);
sd->setTicks(QwtScaleDiv::MajorTick, ld);
QwtScaleWidget *w = new QwtScaleWidget;
w->setScaleDiv(*sd);
qDebug("orient w %d", w->scaleDraw()->orientation()); // here is Qt::Vertical
qDebug("extent 2 %f", w->scaleDraw()->extent(w->font())); // is 31.0
QwtScaleDraw *sdraw = new QwtScaleDraw;
sdraw->setScaleDiv(*sd);
qDebug("orient sdraw %d", sdraw->orientation()); // here is Qt:Horizontal
sdraw->setAlignment(QwtScaleDraw::LeftScale); // Change to vertical
qDebug("extent 1 %f", sdraw->extent(w->font())); // here is also 31.0
To copy to clipboard, switch view to plain text mode
best regards
max
Bookmarks