Hello. I am making a program, for a team at my high school, I am close to finishing it but each time I think I'm done with this source file some pointers kill all momentum at the moment I am trying to add a QFormLayout to a QWidget(the main window) using setLayout() but it seems I can't do that and use the .addRow(...) method. Here is my code:
Qt Code:
  1. #include <QtGui>
  2. #include "QtCore"
  3.  
  4. void create(int argc, char *argv[]){
  5. QLineEdit *haveauto;
  6. QLineEdit *uprighted;
  7. QLineEdit *parked;
  8. QLineEdit *bowlball;
  9.  
  10. QLineEdit *lowgoal;
  11. QLineEdit *crategoal;
  12. QLineEdit *cratestack;
  13. QLineEdit *holdcrate;
  14. QLineEdit *magball;
  15. QLineEdit *bowlend;
  16.  
  17. QApplication app(argc, argv);
  18. QWidget window;
  19. window.resize(300, 300);
  20.  
  21. window.setWindowTitle(QApplication::translate("toplevel", "Main Recon Window"));
  22.  
  23. QLabel *autoLabel = new QLabel(QApplication::translate("auto", "AUTONOMOUS"));
  24.  
  25. haveauto = new QLineEdit();
  26. uprighted = new QLineEdit();
  27. parked = new QLineEdit();
  28. bowlball = new QLineEdit();
  29.  
  30. QFormLayout *auton;
  31. auton.addRow(QObject::tr(""), autoLabel);
  32. auton.addRow(QObject::tr("Do they have an Auto?"), haveauto);
  33. auton.addRow(QObject::tr("How many crates did they upright?"), uprighted);
  34. auton.addRow(QObject::tr("Where did they park?"), parked);
  35. auton.addRow(QObject::tr("Where did they park the bowling ball?"), bowlball);
  36.  
  37. lowgoal = new QLineEdit();
  38. crategoal = new QLineEdit();
  39. cratestack = new QLineEdit();
  40. holdcrate = new QLineEdit();
  41. magball = new QLineEdit();
  42. bowlend = new QLineEdit();
  43.  
  44. auton.addRow(QObject::tr("How many balls are in their low goal?"), lowgoal);
  45. auton.addRow(QObject::tr("How many balls did they drop in crates?"), crategoal);
  46. auton.addRow(QObject::tr("How many crates did they stack? Use either number circled."), cratestack);
  47. auton.addRow(QObject::tr("Can they hold crates?"), holdcrate);
  48. auton.addRow(QObject::tr("Can they find the magnet ball?"), magball);
  49. auton.addRow(QObject::tr("Did they get the bowling ball in either goal?"), bowlend);
  50.  
  51. window.setLayout(auton);
  52. window.show();
  53. }
To copy to clipboard, switch view to plain text mode 
The first thing that main() does is call create(...). I have been trying to solve this for a while now but it seems from what I've experienced that pointers make doing certain tasks mutually exclusive. Any help is welcomed and appreciated.