View Full Version : qwtscalewidget: setting scale to the widget..
halberdier83
3rd December 2007, 18:09
Hi all,
I added a qwtscalewidget to my widget. I am trying to set a scale it, but i cant manage. I am trying to use setScaleDiv() or setScaleDraw() methods of QwtScaleWidget class, but i didnt understand how to use them. I think setScaleDiv() method will do my job. But it requires a QwtValueList object. But i cant find any class declaration of this object. So i am stucked.
Thanks.
Uwe
3rd December 2007, 20:11
A QwtScaleDiv contains the upper/lower bounds and the positions of the ticks of a scale. You can define an individual one, or calculate a regular scale using a QwtScaleEngine.
A QwtScaleDraw is responsible for drawing the scale. You can modify the tick labels and tick lengths here.
In Qt4 QwtValueList is simply a QList<double> ( look into qwt_valuelist.h ). The only intention behind this declaration is to hide Qt3/Qt4 incompatibilities.
Uwe
halberdier83
3rd December 2007, 20:42
Hi Uwe,
First of all, thank you very much for you interest. You helped me many times. Uwe, i am doing something like that. But, i got some errors. I can send you errors tomarrow. Because i am at home now.
QList<double> mList;
for(int i=0; i<100; i++)
mList.push_back(0); // 0 is for TickType = MinorTick
QwtScaleDiv *scale = new QwtScaleDiv(0, 100, (QwtValueList)mList );
xScale->setScaleDiv (NULL, const QwtScaleDiv &sd);
there is no compilation error, but when i try to run the program i encounter a segmentation fault. it is about QList<double>. i can send you whole log if you like tomarrow.
thanks,
halberdier83
4th December 2007, 08:08
A QwtScaleDiv contains the upper/lower bounds and the positions of the ticks of a scale. You can define an individual one, or calculate a regular scale using a QwtScaleEngine.
A QwtScaleDraw is responsible for drawing the scale. You can modify the tick labels and tick lengths here.
In Qt4 QwtValueList is simply a QList<double> ( look into qwt_valuelist.h ). The only intention behind this declaration is to hide Qt3/Qt4 incompatibilities.
Uwe
Hi all,
I solved the problem by using QwtScaleEngine. I created a linearscaleengine object and set the scales with divideScale method. this returns a QScaleDiv object. Then i used the QwtScaleDiv::setScaleDiv method and it is done.
Powered by vBulletin® Version 4.2.5 Copyright © 2024 vBulletin Solutions Inc. All rights reserved.