summaryrefslogtreecommitdiffstats
path: root/qt-ui/maintab.cpp
diff options
context:
space:
mode:
authorGravatar Dirk Hohndel <dirk@hohndel.org>2013-05-01 15:37:41 -0700
committerGravatar Dirk Hohndel <dirk@hohndel.org>2013-05-01 16:02:34 -0700
commitf45618f0c7ce5af85e0f69aab49ef20a1663bca1 (patch)
tree839eab034e60bd663e61810e1d4c84d1ac7b85ca /qt-ui/maintab.cpp
parent482bea84c2f218f515b3b16556197379623a8028 (diff)
downloadsubsurface-f45618f0c7ce5af85e0f69aab49ef20a1663bca1.tar.gz
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>
Diffstat (limited to 'qt-ui/maintab.cpp')
-rw-r--r--qt-ui/maintab.cpp14
1 files changed, 11 insertions, 3 deletions
diff --git a/qt-ui/maintab.cpp b/qt-ui/maintab.cpp
index 4174ce5dd..f26a72a8a 100644
--- a/qt-ui/maintab.cpp
+++ b/qt-ui/maintab.cpp
@@ -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);
}