first commit

This commit is contained in:
bing
2026-04-03 11:32:07 +08:00
commit 003be19522
1142 changed files with 185854 additions and 0 deletions

View File

@@ -0,0 +1,37 @@
import QtQuick 2.1
import QtQuick.Controls 1.0
Item {
width: 400
height: 300
Row {
height: 20
spacing: 20
Button {
text: "Clear"
onClicked: myModel.clear()
}
Button {
text: "Fetch All"
onClicked: myModel.qxFetchAll_()
}
Button {
text: "Save"
onClicked: myModel.qxSave_()
}
}
ListView {
y: 30
height: 270
model: myModel
delegate: Row {
height: 20
spacing: 10
Text { text: "id: " + author_id }
TextField {
text: name
onTextChanged: name = text
}
}
}
}

View File

@@ -0,0 +1,16 @@
import QtQuick 1.0
Item {
width: 400
height: 300
ListView {
anchors.fill: parent
model: myModel
delegate: Row {
height: 20
spacing: 10
Text { text: "id: " + author_id }
Text { text: "name: " + name }
}
}
}

View File

@@ -0,0 +1,37 @@
import QtQuick
import QtQuick.Controls
Item {
width: 400
height: 300
Row {
height: 20
spacing: 20
Button {
text: "Clear"
onClicked: myModel.clear()
}
Button {
text: "Fetch All"
onClicked: myModel.qxFetchAll_()
}
Button {
text: "Save"
onClicked: myModel.qxSave_()
}
}
ListView {
y: 30
height: 270
model: myModel
delegate: Row {
height: 20
spacing: 10
Text { text: "id: " + author_id }
TextField {
text: name
onTextChanged: name = text
}
}
}
}

View File

@@ -0,0 +1,93 @@
import QtQuick 2.1
import QtQuick.Controls 1.0
Item {
width: 500
height: 300
/*
1- How to display a relationship value :
* root model : blog
* child model : author
* display author name using getModelValue() method of qx::IxModel base class
*/
Text {
y: 30
color: "blue"
text: "--- 1. display relationship author name using getModelValue() method of qx::IxModel base class ---"
}
ListView {
y: 50
height: 270
model: myModel
delegate: Row {
height: 20
spacing: 10
Text { text: "blog id : " + blog_id }
TextField {
text: blog_text
onTextChanged: blog_text = text
}
Text { text: "author name : " + myModel.author_id(0).getModelValue(0, "name") } // display author name using getModelValue() method of qx::IxModel base class
}
}
/*
2- How to display a relationship value :
* root model : blog
* child model : author
* display author name passing the author child model to another QML component, then using the role value
*/
Text {
y: 80
color: "blue"
text: "--- 2. display relationship author name passing the author child model to another QML component, then using the author 'name' role value ---"
}
ListView {
y: 100
height: 270
model: myModel
delegate: Row {
height: 20
spacing: 10
Text { text: "blog id : " + blog_id }
TextField {
text: blog_text
onTextChanged: blog_text = text
}
ListView {
x: 200
height: 270
model: myModel.author_id(0) // pass the author child model to another QML component
delegate: Row {
Text { text: "author name : " + name } // use role 'name' defined in author class to display the author name
}
}
}
}
/*
3- Display the author row id in database using the 'author_id' role defined in blog class
*/
Text {
y: 130
color: "blue"
text: "--- 3. display the author row id in database using the 'author_id' role defined in blog class ---"
}
ListView {
y: 150
height: 270
model: myModel
delegate: Row {
height: 20
spacing: 10
Text { text: "blog id : " + blog_id }
TextField {
text: blog_text
onTextChanged: blog_text = text
}
Text { text: "author id : " + author_id }
}
}
}

View File

@@ -0,0 +1,93 @@
import QtQuick
import QtQuick.Controls
Item {
width: 500
height: 300
/*
1- How to display a relationship value :
* root model : blog
* child model : author
* display author name using getModelValue() method of qx::IxModel base class
*/
Text {
y: 30
color: "blue"
text: "--- 1. display relationship author name using getModelValue() method of qx::IxModel base class ---"
}
ListView {
y: 50
height: 270
model: myModel
delegate: Row {
height: 20
spacing: 10
Text { text: "blog id : " + blog_id }
TextField {
text: blog_text
onTextChanged: blog_text = text
}
Text { text: "author name : " + myModel.author_id(0).getModelValue(0, "name") } // display author name using getModelValue() method of qx::IxModel base class
}
}
/*
2- How to display a relationship value :
* root model : blog
* child model : author
* display author name passing the author child model to another QML component, then using the role value
*/
Text {
y: 80
color: "blue"
text: "--- 2. display relationship author name passing the author child model to another QML component, then using the author 'name' role value ---"
}
ListView {
y: 100
height: 270
model: myModel
delegate: Row {
height: 20
spacing: 10
Text { text: "blog id : " + blog_id }
TextField {
text: blog_text
onTextChanged: blog_text = text
}
ListView {
x: 200
height: 270
model: myModel.author_id(0) // pass the author child model to another QML component
delegate: Row {
Text { text: "author name : " + name } // use role 'name' defined in author class to display the author name
}
}
}
}
/*
3- Display the author row id in database using the 'author_id' role defined in blog class
*/
Text {
y: 130
color: "blue"
text: "--- 3. display the author row id in database using the 'author_id' role defined in blog class ---"
}
ListView {
y: 150
height: 270
model: myModel
delegate: Row {
height: 20
spacing: 10
Text { text: "blog id : " + blog_id }
TextField {
text: blog_text
onTextChanged: blog_text = text
}
Text { text: "author id : " + author_id }
}
}
}

View File

@@ -0,0 +1,7 @@
# git does not allow empty directories.
# Yet, we need to add this empty directory on git.
# To achieve that, we created this .gitignore file, so that the directory will not be empty thus enabling us to commit it.
# Since we want all generated files/folders in this directory to be ignored by git, we add a rule for this.
*
# And then add an exception for this specifc file (so that we can commit it).
!.gitignore

View File

@@ -0,0 +1,9 @@
<!DOCTYPE RCC><RCC version="1.0">
<qresource>
<file>documents/main.qml</file>
<file>documents/main_qt4.qml</file>
<file>documents/main_qt6.qml</file>
<file>documents/main_relationship.qml</file>
<file>documents/main_relationship_qt6.qml</file>
</qresource>
</RCC>