Results 1 to 4 of 4

Thread: qwtscalewidget: setting scale to the widget..

  1. #1
    Join Date
    Oct 2007
    Posts
    13
    Thanks
    1
    Thanked 1 Time in 1 Post
    Qt products
    Qt4
    Platforms
    Unix/X11

    Default qwtscalewidget: setting scale to the widget..

    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.

  2. #2
    Join Date
    Feb 2006
    Location
    Munich, Germany
    Posts
    3,309
    Thanked 879 Times in 827 Posts
    Qt products
    Qt3 Qt4 Qt/Embedded
    Platforms
    MacOS X Unix/X11 Windows

    Default Re: qwtscalewidget: setting scale to the widget..

    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

  3. #3
    Join Date
    Oct 2007
    Posts
    13
    Thanks
    1
    Thanked 1 Time in 1 Post
    Qt products
    Qt4
    Platforms
    Unix/X11

    Default Re: qwtscalewidget: setting scale to the widget..

    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,

  4. #4
    Join Date
    Oct 2007
    Posts
    13
    Thanks
    1
    Thanked 1 Time in 1 Post
    Qt products
    Qt4
    Platforms
    Unix/X11

    Default Re: qwtscalewidget: setting scale to the widget..

    Quote Originally Posted by Uwe View Post
    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.

  5. The following user says thank you to halberdier83 for this useful post:

    maxpyne (18th July 2013)

Similar Threads

  1. setting widget as modal, disables button
    By munna in forum Qt Programming
    Replies: 3
    Last Post: 27th November 2006, 10:49
  2. My own scale widget in Qwt
    By igrms in forum Qwt
    Replies: 7
    Last Post: 15th June 2006, 22:18

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  
Digia, Qt and their respective logos are trademarks of Digia Plc in Finland and/or other countries worldwide.