maarvi
27th June 2011, 15:26
hello ever one here is my code i am calling all these statements in my button event handler like this
void analysis::on_pushButton_clicked()
{
myplot * p = new myplot(gao.structpayloadgraph,gao1.structpayloadgr aph, gao.structcol-2, "payload");
myplot * p1 = new myplot(gao.structsessiongraph,gao.structsessiongra ph ,gao.structcol-2, "session");
QHBoxLayout * layout = new QHBoxLayout;
ui->horizontalLayout_2->addLayout(layout);
layout->addWidget(p);
layout->addWidget(p1);
}
myplot is graph plotting class but the problem is that each time i click the button new graph appear and previous remains, like one !st click 2 appear on second they become 4 then 6...... how to i destroy QHBoxLayout in my button event handler
thanks
void analysis::on_pushButton_clicked()
{
myplot * p = new myplot(gao.structpayloadgraph,gao1.structpayloadgr aph, gao.structcol-2, "payload");
myplot * p1 = new myplot(gao.structsessiongraph,gao.structsessiongra ph ,gao.structcol-2, "session");
QHBoxLayout * layout = new QHBoxLayout;
ui->horizontalLayout_2->addLayout(layout);
layout->addWidget(p);
layout->addWidget(p1);
}
myplot is graph plotting class but the problem is that each time i click the button new graph appear and previous remains, like one !st click 2 appear on second they become 4 then 6...... how to i destroy QHBoxLayout in my button event handler
thanks