Thanks for Your help!
After the correction of the first 2 errors and changes in mainWidget
mainWidget
::mainWidget(const QUrl &Urlh
):histUrl
(Urlh
){
setWindowTitle ( "paintEvent - Demo");
resize( 1000, 400 );
}
FileDownloader demo(histUrl);
connect(&demo,SIGNAL(DataA(const QByteArray&)),
painter.begin( this );
painter.
setPen( QPen(Qt
::black,
2) );
painter.drawEllipse( 40, 40, 100, 100 );
painter.drawLine(0,200,80,200);
painter.drawLine(340,200,800,200);
painter.setPen(
QPen(Qt
::black,
5, Qt
::DotLine, Qt
::RoundCap));
//painter.drawRect( 160, 40, 120, 150 );
painter.
setPen( QPen(Qt
::green,
2) );
int u,x1,ku,ku1;
for(int i=1;i<8;i++)
{
u=10*i;
x1=15*i;
ku=CloseAdj[i+2];
ku1=CloseAdj[i+7];
painter.drawLine(u,ku,x1,ku1);
}
}
A=QBA;
int j=0;
while(A[j]!='2')
{j++;
}
QVector<QString> days;
// QVector<float> CloseAdj;
QVector<int> Volume;
for(int i=j;i<1100;i++)
qint32 volume_=0;
float Close=0;
for (int k=0;k<10;k++)
{day+=A[i+k];
}
i+=9;
while(A[i]!=',')
{//qDebug(" Problem bis Komma ");
i++;
}
while(A[i+1]!=',')
{i++;}
while(A[i+2]!=',')
{i++;}
while(A[i+3]!=',')
{i++;}
while(A[i+4]!=',')
{i++;}
while(A[i+5]!=',')
{volume+=A[i+5];
i++;
}
while(((A[i+6]>='0' && A[i+6]<='9') || A[i+6]== '.')&& !(A[i+6]=='2' && A[i+7]=='0' && A[i+8]<='1' && A[i+9]<='5') )
{CloseAd+=A[i+6];
i++;
}
i+=6;
Close=CloseAd.toFloat();
days.append(day);
CloseAdj.append(Close);
volume_=volume.toInt();
Volume.append(volume_);
}
for(int l=0;l<10;l++)
}
return;
}
mainWidget::mainWidget(const QUrl &Urlh):histUrl(Urlh)
{
setWindowTitle ( "paintEvent - Demo");
resize( 1000, 400 );
}
void mainWidget::paintEvent ( QPaintEvent * event ) {
FileDownloader demo(histUrl);
connect(&demo,SIGNAL(DataA(const QByteArray&)),
SLOT(Receiver(const QByteArray &QBA)));
QPainter painter(this);
painter.begin( this );
painter.setPen( QPen(Qt::black, 2) );
painter.drawEllipse( 40, 40, 100, 100 );
painter.drawLine(0,200,80,200);
painter.drawLine(340,200,800,200);
painter.setPen(
QPen(Qt::black, 5, Qt::DotLine, Qt::RoundCap));
//painter.drawRect( 160, 40, 120, 150 );
painter.setPen( QPen(Qt::green, 2) );
int u,x1,ku,ku1;
for(int i=1;i<8;i++)
{
u=10*i;
x1=15*i;
ku=CloseAdj[i+2];
ku1=CloseAdj[i+7];
painter.drawLine(u,ku,x1,ku1);
}
}
void mainWidget::Receiver(const QByteArray &QBA){
A=QBA;
int j=0;
while(A[j]!='2')
{j++;
}
QVector<QString> days;
// QVector<float> CloseAdj;
QVector<int> Volume;
for(int i=j;i<1100;i++)
{QString day =" ";
QString volume = " ";
QString CloseAd =" ";
qint32 volume_=0;
float Close=0;
for (int k=0;k<10;k++)
{day+=A[i+k];
}
i+=9;
while(A[i]!=',')
{//qDebug(" Problem bis Komma ");
i++;
}
while(A[i+1]!=',')
{i++;}
while(A[i+2]!=',')
{i++;}
while(A[i+3]!=',')
{i++;}
while(A[i+4]!=',')
{i++;}
while(A[i+5]!=',')
{volume+=A[i+5];
i++;
}
while(((A[i+6]>='0' && A[i+6]<='9') || A[i+6]== '.')&& !(A[i+6]=='2' && A[i+7]=='0' && A[i+8]<='1' && A[i+9]<='5') )
{CloseAd+=A[i+6];
i++;
}
i+=6;
Close=CloseAd.toFloat();
days.append(day);
CloseAdj.append(Close);
volume_=volume.toInt();
Volume.append(volume_);
}
for(int l=0;l<10;l++)
{QString tag=days[l];
}
return;
}
To copy to clipboard, switch view to plain text mode
{
Q_OBJECT
public:
mainWidget
(const QUrl &Urlh
);
public slots:
void Receiver(const QByteArray&);
//void Receiver(const QByteArray &QBA);
protected:
QVector<float> CloseAdj;
};
class mainWidget : public QWidget
{
Q_OBJECT
public:
mainWidget(const QUrl &Urlh);
public slots:
void Receiver(const QByteArray&);
//void Receiver(const QByteArray &QBA);
protected:
void paintEvent(QPaintEvent *event);
QUrl histUrl;
QVector<float> CloseAdj;
QByteArray A;
};
To copy to clipboard, switch view to plain text mode
the program is compiled without error messages and "paintEvent - Demo" is showed according to
painter.begin( this );
painter.
setPen( QPen(Qt
::black,
2) );
painter.drawEllipse( 40, 40, 100, 100 );
painter.drawLine(0,200,80,200);
painter.drawLine(340,200,800,200);
painter.setPen(
QPen(Qt
::black,
5, Qt
::DotLine, Qt
::RoundCap));
//painter.drawRect( 160, 40, 120, 150 );
painter.
setPen( QPen(Qt
::green,
2) );
int u,x1,ku,ku1;
for(int i=1;i<8;i++)
{
u=10*i;
x1=15*i;
ku=CloseAdj[i+2];
ku1=CloseAdj[i+7];
painter.drawLine(u,ku,x1,ku1);
}
painter.begin( this );
painter.setPen( QPen(Qt::black, 2) );
painter.drawEllipse( 40, 40, 100, 100 );
painter.drawLine(0,200,80,200);
painter.drawLine(340,200,800,200);
painter.setPen(
QPen(Qt::black, 5, Qt::DotLine, Qt::RoundCap));
//painter.drawRect( 160, 40, 120, 150 );
painter.setPen( QPen(Qt::green, 2) );
int u,x1,ku,ku1;
for(int i=1;i<8;i++)
{
u=10*i;
x1=15*i;
ku=CloseAdj[i+2];
ku1=CloseAdj[i+7];
painter.drawLine(u,ku,x1,ku1);
}
To copy to clipboard, switch view to plain text mode
with CloseAdj[ ]=0 because filedownloader.cpp is not called and I receive the message
Object
::connect: No such
slot mainWidget
::Receiver(const QByteArray &QBA
)Object
::connect: No such
slot mainWidget
::Receiver(const QByteArray &QBA
)
Object::connect: No such slot mainWidget::Receiver(const QByteArray &QBA)
QPainter::begin: Painter already active
Object::connect: No such slot mainWidget::Receiver(const QByteArray &QBA)
QPainter::begin: Painter already active
To copy to clipboard, switch view to plain text mode
. Some errors like mainWidget w(const QUrl &Urlh) or the former missing of the creation of a FileDownloader came only into the program because of the many changes and the copying of lines.
Bookmarks