LastElemtnal
8th December 2011, 00:06
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:
#include <QtGui>
#include "QtCore"
void create(int argc, char *argv[]){
QLineEdit *haveauto;
QLineEdit *uprighted;
QLineEdit *parked;
QLineEdit *bowlball;
QLineEdit *lowgoal;
QLineEdit *crategoal;
QLineEdit *cratestack;
QLineEdit *holdcrate;
QLineEdit *magball;
QLineEdit *bowlend;
QApplication app(argc, argv);
QWidget window;
window.resize(300, 300);
window.setWindowTitle(QApplication::translate("toplevel", "Main Recon Window"));
QLabel *autoLabel = new QLabel(QApplication::translate("auto", "AUTONOMOUS"));
haveauto = new QLineEdit();
uprighted = new QLineEdit();
parked = new QLineEdit();
bowlball = new QLineEdit();
QFormLayout *auton;
auton.addRow(QObject::tr(""), autoLabel);
auton.addRow(QObject::tr("Do they have an Auto?"), haveauto);
auton.addRow(QObject::tr("How many crates did they upright?"), uprighted);
auton.addRow(QObject::tr("Where did they park?"), parked);
auton.addRow(QObject::tr("Where did they park the bowling ball?"), bowlball);
lowgoal = new QLineEdit();
crategoal = new QLineEdit();
cratestack = new QLineEdit();
holdcrate = new QLineEdit();
magball = new QLineEdit();
bowlend = new QLineEdit();
auton.addRow(QObject::tr("How many balls are in their low goal?"), lowgoal);
auton.addRow(QObject::tr("How many balls did they drop in crates?"), crategoal);
auton.addRow(QObject::tr("How many crates did they stack? Use either number circled."), cratestack);
auton.addRow(QObject::tr("Can they hold crates?"), holdcrate);
auton.addRow(QObject::tr("Can they find the magnet ball?"), magball);
auton.addRow(QObject::tr("Did they get the bowling ball in either goal?"), bowlend);
window.setLayout(auton);
window.show();
}
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.
#include <QtGui>
#include "QtCore"
void create(int argc, char *argv[]){
QLineEdit *haveauto;
QLineEdit *uprighted;
QLineEdit *parked;
QLineEdit *bowlball;
QLineEdit *lowgoal;
QLineEdit *crategoal;
QLineEdit *cratestack;
QLineEdit *holdcrate;
QLineEdit *magball;
QLineEdit *bowlend;
QApplication app(argc, argv);
QWidget window;
window.resize(300, 300);
window.setWindowTitle(QApplication::translate("toplevel", "Main Recon Window"));
QLabel *autoLabel = new QLabel(QApplication::translate("auto", "AUTONOMOUS"));
haveauto = new QLineEdit();
uprighted = new QLineEdit();
parked = new QLineEdit();
bowlball = new QLineEdit();
QFormLayout *auton;
auton.addRow(QObject::tr(""), autoLabel);
auton.addRow(QObject::tr("Do they have an Auto?"), haveauto);
auton.addRow(QObject::tr("How many crates did they upright?"), uprighted);
auton.addRow(QObject::tr("Where did they park?"), parked);
auton.addRow(QObject::tr("Where did they park the bowling ball?"), bowlball);
lowgoal = new QLineEdit();
crategoal = new QLineEdit();
cratestack = new QLineEdit();
holdcrate = new QLineEdit();
magball = new QLineEdit();
bowlend = new QLineEdit();
auton.addRow(QObject::tr("How many balls are in their low goal?"), lowgoal);
auton.addRow(QObject::tr("How many balls did they drop in crates?"), crategoal);
auton.addRow(QObject::tr("How many crates did they stack? Use either number circled."), cratestack);
auton.addRow(QObject::tr("Can they hold crates?"), holdcrate);
auton.addRow(QObject::tr("Can they find the magnet ball?"), magball);
auton.addRow(QObject::tr("Did they get the bowling ball in either goal?"), bowlend);
window.setLayout(auton);
window.show();
}
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.