Commit 378eb4a7 authored by Kevin Whitaker's avatar Kevin Whitaker

Starting getting list and model together.

parent 69298912
from PySide2 import QtCore
class OTPModel(QtCore.QObject):
name=""
OTPType=""
secret=""
icon=""
def __init__(self,name="",OTPType="",secret="",icon=""):
self.name=name
self.OTPType=OTPType
self.secret=secret
self.icon=icon
class OPTListModel(QtCore.QAbstractListModel):
pass
\ No newline at end of file
_items=[]
def __init__(self,parent = None):
QtCore.QAbstractListModel.__init__(self, parent)
def rowCount(self, parent=QtCore.QModelIndex()):
return len(self._items)
def data(self, index, role=QtCore.Qt.DisplayRole):
if role == QtCore.Qt.DisplayRole:
return None
\ No newline at end of file
from PySide2.QtQml import QQmlApplicationEngine
from PySide2.QtWidgets import QApplication
import OTPListModel
import keyring
import json
qapp = QApplication()
app = QQmlApplicationEngine("qml/main.qml")
app = QQmlApplicationEngine()
model = OTPListModel.OPTListModel()
#keyring.set_password("test","boo","yeah")
app.rootContext().setContextProperty("otpListModel", model)
app.load("qml/main.qml")
qapp.exec_()
......@@ -35,6 +35,18 @@ Item {
}
}
ListView {
id:otpList
id: otpList
anchors.top: otpTimeout.bottom
anchors.right: parent.right
anchors.left: parent.left
anchors.bottom: parent.bottom
Component {
id: otpDelegate
Text {
text: "test"
}
}
model: otpListModel
delegate: otpDelegate
}
}
\ No newline at end of file
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment