#include <QStringList>
#include <QVariantList>
-DbConn::DbConn (QObject* parent) : QObject (parent)
+DbConn::DbConn (QObject* parent) : QAbstractItemModel (parent)
{
db = QSqlDatabase::addDatabase ("QSQLITE");
db.setDatabaseName ("cleaners.db");
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();
#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;
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;
title: qsTr("Cleaning Service")
AddService { id: addservice }
AddCustomer { id: addcustomer }
+ property int stdPadding: 10
menuBar: MenuBar {
Menu {
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"
+ }
}
+
+
}