Advertisement
Guest User

Untitled

a guest
Dec 8th, 2016
66
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.51 KB | None | 0 0
  1. std::vector<QPushButton*> lista;
  2.  
  3. while(lista.size() < 10)
  4. {
  5. QPushButton* ptr = new QPushButton(this);
  6. ptr->setText(texto);
  7. // ...
  8.  
  9. lista.push_back(ptr);
  10. }
  11.  
  12. auto NewButton = [](QWidget* parent, QString texto)
  13. {
  14. QPushButton* ptr = new QPushButton(parent);
  15. ptr->setText(texto);
  16. return ptr;
  17. };
  18.  
  19. std::vector<QPushButton*> lista;
  20.  
  21. while(lista.size() < 10)
  22. {
  23. lista.push_back(NewButton(this,"prueba"));
  24. }
  25.  
  26. for(i=0; i<10; i++)
  27. {
  28. QPushButton* ptr =new QPushButton(this);
  29. ptr->setText(texto);
  30. // ...
  31. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement