Create Add Weightsystem dialog

My first attempt to create a Qt dialog and to hook it up with the program.
Unsurprisingly this doesn't quite work as expected (i.e., the values I
enter aren't populated in the model), but it's a start...

Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
This commit is contained in:
Dirk Hohndel 2013-05-01 15:37:41 -07:00
parent 482bea84c2
commit f45618f0c7
5 changed files with 190 additions and 3 deletions

View file

@ -7,6 +7,7 @@
#include "maintab.h"
#include "ui_maintab.h"
#include "addcylinderdialog.h"
#include "addweightsystemdialog.h"
#include <QLabel>
@ -91,10 +92,17 @@ void MainTab::on_addWeight_clicked()
if (weightModel->rowCount() >= MAX_WEIGHTSYSTEMS)
return;
/* this needs a dialog - right now we just fill in a dummy */
AddWeightsystemDialog dialog(this);
weightsystem_t *newWeightsystem = (weightsystem_t *) malloc(sizeof(weightsystem_t));
newWeightsystem->description = "Just testing";
newWeightsystem->weight.grams = 15000;
newWeightsystem->description = "";
newWeightsystem->weight.grams = 0;
dialog.setWeightsystem(newWeightsystem);
int result = dialog.exec();
if (result == QDialog::Rejected)
return;
dialog.updateWeightsystem();
weightModel->add(newWeightsystem);
}