View Full Version : 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
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.
class YourDial: public QwtDial
{
...
virtual drawScaleContents( QPainter *painter,
const QPointF ¢er, double radius ) const override
{
QRectF rect;
rect.setSize( 0.5 * radius, 0.5 * radius );
rect.moveCenter( center );
painter->setPen( Qt::black );
painter->setBrush( Qt::red ):
painter->drawRect( rect );
}
};Uwe
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
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
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
Powered by vBulletin® Version 4.2.5 Copyright © 2024 vBulletin Solutions Inc. All rights reserved.