Void RadarDlg: : paintEvent (QPaintEvent *)
{
QPainter * painter=new QPainter (this);
Painter - & gt; SetRenderHint (QPainter: : Antialiasing);
Painter - & gt; SetRenderHint (QPainter: : SmoothPixmapTransform);
Painter - & gt; SetRenderHint (QPainter: : TextAntialiasing);
DrawRadarType (painter);
DrawLabel (painter);
DrawData (painter);
DrawAxisLabel (painter);
}
But when run, will report to:
QBackingStore: : endPaint () is called with an active painter on backingstore paint device
QPaintDevice: always destroy a paint device that is being made
Then add the begin to paintEvent () and end ()
Void CRadarDlg: : paintEvent (QPaintEvent *)
{
QPainter * painter=new QPainter (this);
Painter - & gt; The begin (this);
Painter - & gt; SetRenderHint (QPainter: : Antialiasing);
Painter - & gt; SetRenderHint (QPainter: : SmoothPixmapTransform);
Painter - & gt; SetRenderHint (QPainter: : TextAntialiasing);
DrawRadarType (painter);
DrawLabel (painter);
DrawData (painter);
DrawAxisLabel (painter);
Painter - & gt; The end ();
}
There is warning:
QPainter: : begin: Painter already active
Excuse me how to solve?
CodePudding user response:
Try the delete painter; Painter=NULL;CodePudding user response: