Use wizard defines a MainWindow class, then the new drawLabel class, drawLabel. CPP, inheritance in QLabel
Problem is 1, the window shows, not shown in Qlabel,
Code for drawing curve:
DrawLabel: : drawLabel (QWidget * parent) : QLabel (parent)
{
for(int i=0; i
QTimer * timer=new QTimer ();
QObject: : connect (timer, SIGNAL (timeout ()), and this, SLOT (flushBuff ()));
The timer - & gt; Start (100);
}
Void drawLabel: : flushBuff ()
{
Int TMP=buffer [0];
for(int i=0; i
If (I==DATA_X - 1)
{
Buffer] [DATA_X - 1=TMP;
break;
}
Buffer [I]=buffer [I + 1);
}
The update ();
}
Void drawLabel: : paintEvent (QPaintEvent *)
{
QPainter painter (this);
The QPoint beginPoint;
QPoint endPoint.
Painter. SetPen (Qt: : red);
for(int i=0; i
QDebug () & lt; & lt;" X="& lt; QWidget: : setSizePolicy (QSizePolicy: : Maximum, QSizePolicy: : Maximum);
DrawLabel * label=new drawLabel;
QMainWindow: : setCentralWidget (label);
}
MainWindow: : ~ MainWindow ()
{
Delete the UI;
}
Problem is to draw the graph has been on the window, not on a drawLabel, how can I draw on drawLabel ah, where I don't know what is problem, all 3 days, and thank you greatly!!!!! There is a problem: how to change the position of the drawLabel in your code, and so many points in total,
CodePudding user response:
QT don't understand,,,, don't look for me,CodePudding user response: