Sir i got an other problem i am calling all these statements in my button event handler like this
Qt Code:
  1. void analysis::on_pushButton_clicked()
  2. {
  3. myplot * p = new myplot(gao.structpayloadgraph,gao1.structpayloadgraph, gao.structcol-2, "payload");
  4.  
  5. myplot * p1 = new myplot(gao.structsessiongraph,gao.structsessiongraph ,gao.structcol-2, "session");
  6.  
  7.  
  8. QHBoxLayout * layout = new QHBoxLayout;
  9. ui->horizontalLayout_2->addLayout(layout);
  10. layout->addWidget(p);
  11. layout->addWidget(p1);
  12. }
To copy to clipboard, switch view to plain text mode 

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