Results 1 to 5 of 5

Thread: Qwt dial

  1. #1
    Join Date
    Jun 2018
    Posts
    22
    Qt products
    Qt5 Qt/Embedded
    Platforms
    Unix/X11

    Default Qwt dial

    Hai
    Can anyone please suggest me how to use drawscalecontents() method of qwt dial class to draw a dial. I don’t get any idea of passing values to this function. What values I should pass to this function. Can anyone post a sample code of this line. I stuck up with this issue.

    Pvr

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

    Default Re: Qwt dial

    QwtDial::drawScaleContents() is a hook to be overloaded, that allows the application code to draw whatever you want - the default implementation does nothing.

    F.e.

    Qt Code:
    1. class YourDial: public QwtDial
    2. {
    3. ...
    4.  
    5. virtual drawScaleContents( QPainter *painter,
    6. const QPointF &center, double radius ) const override
    7. {
    8. QRectF rect;
    9. rect.setSize( 0.5 * radius, 0.5 * radius );
    10. rect.moveCenter( center );
    11.  
    12. painter->setPen( Qt::black );
    13. painter->setBrush( Qt::red ):
    14.  
    15. painter->drawRect( rect );
    16. }
    17. };
    To copy to clipboard, switch view to plain text mode 
    Uwe

  3. #3
    Join Date
    Jun 2018
    Posts
    22
    Qt products
    Qt5 Qt/Embedded
    Platforms
    Unix/X11

    Default Re: Qwt dial

    Thanks for the reply. Iam using qwt with qtcreator so I have to call this method from mainwindow.cpp. I have seen this implementation in many places but I don’t know how to call this method from mainwindow. Kindly help me with code to call this function. The dial will get created only when this method is getting called rite? Thanks in advance

  4. #4
    Join Date
    Feb 2006
    Location
    Munich, Germany
    Posts
    3,234
    Thanked 857 Times in 806 Posts
    Qt products
    Qt3 Qt4 Qt/Embedded
    Platforms
    MacOS X Unix/X11 Windows

    Default Re: Qwt dial

    Well this is a very basic question - but in short: you usually don't call those type of methods, it is called by the framework.

    Uwe

  5. #5
    Join Date
    Jun 2018
    Posts
    22
    Qt products
    Qt5 Qt/Embedded
    Platforms
    Unix/X11

    Default Re: Qwt dial

    Sorry I don’t understand I am using ROS for programming and qtcreator for GUI. Iam not able to create a dial using qwt. Can you pls share a line of code to use this method. There is an argument to this as ‘centre’ what should be the value for this. Pls reply me as early as possible

Similar Threads

  1. Generating Dial using Qwt by Qt
    By Navi in forum Qt Programming
    Replies: 8
    Last Post: 15th June 2015, 18:16
  2. Generating Dial using Qwt in Qt
    By Navi in forum Qwt
    Replies: 1
    Last Post: 11th June 2015, 06:41
  3. Dial Controller
    By jeff28 in forum Newbie
    Replies: 1
    Last Post: 22nd August 2012, 23:36
  4. Dial Gauge
    By jeff28 in forum Newbie
    Replies: 1
    Last Post: 22nd August 2012, 23:35
  5. Can I set image for qwt dial
    By validator in forum Qwt
    Replies: 3
    Last Post: 17th December 2010, 06:20

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.