Results 1 to 7 of 7

Thread: How can I draw needle for dial in Qwt

  1. #1
    Join Date
    Feb 2008
    Posts
    36
    Thanks
    1
    Qt products
    Qt4
    Platforms
    Windows

    Default How can I draw needle for dial in Qwt

    I write this code ( QwtDial *d=new QwtDial(ui.label) I create a dial but there is no needle .I look end I see that drawNeedle method is protected .How can I draw a needle for qwtdial .Please can you write sample code

  2. #2
    Join Date
    Jan 2006
    Location
    Warsaw, Poland
    Posts
    5,372
    Thanks
    28
    Thanked 976 Times in 912 Posts
    Qt products
    Qt3 Qt4
    Platforms
    Unix/X11 Windows

    Default Re: How can I draw needle for dial in Qwt

    You can set the needle using QwtDial::setNeedle() method.

  3. #3
    Join Date
    Feb 2008
    Posts
    36
    Thanks
    1
    Qt products
    Qt4
    Platforms
    Windows

    Default Re: How can I draw needle for dial in Qwt

    I use setNeedle Method but this method want QwtDialNeedle object but QwtDialNeedle is abstract class.How can I do this .

    I write this code but I take access violation error.
    Qt Code:
    1. ui.setupUi(this);
    2. QwtDial *d=new QwtDial(ui.label);
    3. d->setScaleArc(30,330);
    4. d->setScale(100,10,60);
    5. /*d->setOrigin(100);*/
    6. d->setLineWidth(15);
    7. d->setValue(5);
    8. d->setWrapping(false);
    9. d->setNeedle(nd);
    To copy to clipboard, switch view to plain text mode 
    Last edited by jpn; 3rd February 2008 at 16:01. Reason: missing [code] tags

  4. #4
    Join Date
    Feb 2006
    Location
    Oslo, Norway
    Posts
    6,264
    Thanks
    36
    Thanked 1,519 Times in 1,389 Posts
    Qt products
    Qt4
    Platforms
    MacOS X Unix/X11 Windows Symbian S60 Maemo/MeeGo

    Default Re: How can I draw needle for dial in Qwt

    Quote Originally Posted by validator View Post
    I use setNeedle Method but this method want QwtDialNeedle object but QwtDialNeedle is abstract class.How can I do this .

    I write this code but I take access violation error.
    Qt Code:
    1. d->setNeedle(nd);
    To copy to clipboard, switch view to plain text mode 
    Yes, because you pass an uninitialized pointer which points to some random memory garbage. Instantiate one of QwtDialNeedle non-abstract subclasses. From the docs you'll see which classes inherit QwtDialNeedle.
    J-P Nurmi

  5. #5
    Join Date
    Feb 2008
    Posts
    36
    Thanks
    1
    Qt products
    Qt4
    Platforms
    Windows

    Default Re: How can I draw needle for dial in Qwt

    yes I examine docs but I can not understand .if you have time , can you write an example.
    Thanks

  6. #6
    Join Date
    Jan 2006
    Location
    Warsaw, Poland
    Posts
    5,372
    Thanks
    28
    Thanked 976 Times in 912 Posts
    Qt products
    Qt3 Qt4
    Platforms
    Unix/X11 Windows

    Default Re: How can I draw needle for dial in Qwt

    Quote Originally Posted by validator View Post
    yes I examine docs but I can not understand .
    Use QwtCompassWindArrow, QwtDialSimpleNeedle or QwtCompassMagnetNeedle instead and make sure you create the needle object using new operator.

  7. The following user says thank you to jacek for this useful post:

    validator (3rd February 2008)

  8. #7
    Join Date
    Feb 2008
    Posts
    36
    Thanks
    1
    Qt products
    Qt4
    Platforms
    Windows

    Default Re: How can I draw needle for dial in Qwt

    Thank you .I did
    Last edited by validator; 3rd February 2008 at 23:41.

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.