From: John Janus <john@evo.fritz.box>
Date: Thu, 24 Aug 2017 05:30:48 +0000 (+0200)
Subject: start change to item model
X-Git-Url: https://git.johnzone.org/?a=commitdiff_plain;h=HEAD;p=CleaningService.git

start change to item model
---

diff --git a/dbconn.cpp b/dbconn.cpp
index 94feb15..2d4e3e1 100644
--- a/dbconn.cpp
+++ b/dbconn.cpp
@@ -4,7 +4,7 @@
 #include <QStringList>
 #include <QVariantList>
 
-DbConn::DbConn (QObject* parent) : QObject (parent)
+DbConn::DbConn (QObject* parent) : QAbstractItemModel (parent)
 {
   db = QSqlDatabase::addDatabase ("QSQLITE");
   db.setDatabaseName ("cleaners.db");
@@ -14,6 +14,31 @@ DbConn::DbConn (QObject* parent) : QObject (parent)
   qCDebug (dbase) << initDB();
 }
 
+QModelIndex DbConn::index (int, int, const QModelIndex&) const
+{
+
+}
+
+QModelIndex DbConn::parent (const QModelIndex& index) const
+{
+
+}
+
+int DbConn::rowCount (const QModelIndex& index) const
+{
+
+}
+
+int DbConn::columnCount (const QModelIndex& index) const
+{
+
+}
+
+QVariant DbConn::data (const QModelIndex& index, int role) const
+{
+
+}
+
 QSqlError DbConn::initDB() const
 {
   QStringList tables = db.tables();
diff --git a/dbconn.h b/dbconn.h
index 74d881e..668d60a 100644
--- a/dbconn.h
+++ b/dbconn.h
@@ -1,13 +1,13 @@
 #ifndef DBCONN_H
 #define DBCONN_H
 
-#include <QObject>
+#include <QAbstractItemModel>
 #include <QVariant>
 #include <QtSql/QSqlDatabase>
 #include <QtSql/QSqlError>
 #include <QList>
 
-class DbConn : public QObject
+class DbConn : public QAbstractItemModel
 {
   Q_OBJECT
   QSqlDatabase db;
@@ -15,6 +15,13 @@ class DbConn : public QObject
 
 public:
   explicit DbConn (QObject* parent = nullptr);
+  QModelIndex index (int, int, const QModelIndex&) const;
+  QModelIndex parent (const QModelIndex& index) const;
+  int rowCount (const QModelIndex& index) const;
+  int columnCount (const QModelIndex& index) const;
+  QVariant data (const QModelIndex& index, int role) const;
+
+
 
 signals:
   void servicesChanged() const;
diff --git a/main.qml b/main.qml
index 725c05e..1b815d2 100644
--- a/main.qml
+++ b/main.qml
@@ -11,6 +11,7 @@ ApplicationWindow {
   title: qsTr("Cleaning Service")
   AddService { id: addservice }
   AddCustomer { id: addcustomer }
+  property int stdPadding: 10
 
   menuBar: MenuBar {
     Menu {
@@ -28,7 +29,29 @@ ApplicationWindow {
         onTriggered: Qt.quit()
       }
     }
+  }
+
+  Rectangle {
+    id: leftView
+
+    anchors.left: parent.left
+    anchors.leftMargin: stdPadding
+    width: parent.width/2
+    Label {
+      text: "TEST"
+    }
+  }
 
+  Rectangle {
+    id: rightView
+    anchors.left: leftView.right
+    anchors.leftMargin: stdPadding
+    width: parent.width/2
+    Label {
+      text: "TEST Right"
+    }
   }
 
+
+
 }