work on main panel: sections and sub sections - subitem not working yet

This commit is contained in:
Dan Ballard 2018-09-18 12:51:38 -07:00
parent 35796610b4
commit dde8888d87
4 changed files with 161 additions and 12 deletions

127
main.qml
View File

@ -8,7 +8,7 @@ Window {
title: qsTr("Hello World")
ListView {
id: "navColumn"
id: navColumn
height: parent.height
width: 300
anchors.top: parent.top
@ -38,7 +38,19 @@ Window {
Text { text: '<b>' + title + '</b>' }
Text { text: groupid }
}
MouseArea {
id: mouse_area1
z: 1
hoverEnabled: false
anchors.fill: parent
onClicked: {
navColumn.currentIndex = index
}
}
}
}
Component {
@ -47,13 +59,17 @@ Window {
BlueBox {
width: ListView.view.width
height: 20
text: section
//text: section
fontColor: '#e0e0e0'
Column {
Text { text: section + " (" + section.count + ")"}
}
}
}
ListModel {
id: "groups"
id: groups
ListElement {type: "group"; title: "Work Friends"; groupid: "710829b408e8b368273cbc20b07f1c0d"}
ListElement {type: "group"; title: "Cwtch Dev"; groupid: "a219b9740fc76367833cbc20b07d1cee" }
@ -62,4 +78,109 @@ Window {
ListElement {type: "bulletin"; title: "Vancouver Listings"; groupid: "890a47403e87368273cbc2ebf7f1cdc"}
ListElement {type: "bulletin"; title: "Game Discussions"; groupid: "cc45892408123879273ec2a435cc4234"}
}
ListModel {
id: leafStructure
ListElement { title: "Community";
count: 3
subItems: [
ListElement { title: "activities" },
ListElement { title: "artists" },
ListElement { title: "childcare" }
]
}
ListElement { title: "Services";
count: 4
subItems: [
ListElement { title: "automotive" },
ListElement { title: "beauty" },
ListElement { title: "cell/mobile" },
ListElement { title: "computer" }
]
}
}
ListView {
id: content
height: parent.height
width: parent.width - 300
anchors.top: parent.top
anchors.left: navColumn.right
anchors.right: parent.right
anchors.bottom: parent.bottom
anchors.margins: 2
anchors.leftMargin: 20
clip: true
model: leafStructure
delegate: sectionDelegate
}
Component {
id: sectionDelegate
Column {
height: 200
Text {
text: title + " (" + count + ")"
font.bold: true
}
Loader {
id: subItemLoader
visible: true
property variant subItemModel : subItems
sourceComponent: subSectionDelegate
}
}
}
Component {
id: subSectionDelegate
Rectangle {
border.color: "red"
border.width: 2
width: 60
height: 100
Text { text: "foo" }
Column {
property alias model : subItemRepeater.model
width: 200
Repeater {
id: subItemRepeater
delegate: Rectangle {
color: "#cccccc"
height: 40
width: 200
border.color: "black"
border.width: 2
Text {
anchors.verticalCenter: parent.verticalCenter
x: 30
font.pixelSize: 18
text: title
}
}
}
}
}
}
}

BIN
qtCwtchBulletinCMock Executable file

Binary file not shown.

28
qtCwtchBulletinCMock.pro Normal file
View File

@ -0,0 +1,28 @@
QT += quick
CONFIG += c++11
# The following define makes your compiler emit warnings if you use
# any feature of Qt which as been marked deprecated (the exact warnings
# depend on your compiler). Please consult the documentation of the
# deprecated API in order to know how to port your code away from it.
DEFINES += QT_DEPRECATED_WARNINGS
# You can also make your code fail to compile if you use deprecated APIs.
# In order to do so, uncomment the following line.
# You can also select to disable deprecated APIs only up to a certain version of Qt.
#DEFINES += QT_DISABLE_DEPRECATED_BEFORE=0x060000 # disables all the APIs deprecated before Qt 6.0.0
SOURCES += main.cpp
RESOURCES += qml.qrc
# Additional import path used to resolve QML modules in Qt Creator's code model
QML_IMPORT_PATH =
# Additional import path used to resolve QML modules just for Qt Quick Designer
QML_DESIGNER_IMPORT_PATH =
# Default rules for deployment.
qnx: target.path = /tmp/$${TARGET}/bin
else: unix:!android: target.path = /opt/$${TARGET}/bin
!isEmpty(target.path): INSTALLS += target

18
rcc.cpp
View File

@ -7,7 +7,7 @@
*****************************************************************************/
static const unsigned char qt_resource_data[] = {
// /home/dan/src/projects/qtCwtchBulletin/Box.qml
// /home/dan/src/projects/qtCwtchBulletinCMock/Box.qml
0x0,0x0,0x1,0x52,
0x69,
0x6d,0x70,0x6f,0x72,0x74,0x20,0x51,0x74,0x51,0x75,0x69,0x63,0x6b,0x20,0x32,0x2e,
@ -32,7 +32,7 @@ static const unsigned char qt_resource_data[] = {
0x20,0x20,0x20,0x63,0x6f,0x6c,0x6f,0x72,0x3a,0x20,0x72,0x6f,0x6f,0x74,0x2e,0x66,
0x6f,0x6e,0x74,0x43,0x6f,0x6c,0x6f,0x72,0xa,0x20,0x20,0x20,0x20,0x7d,0xa,0x7d,
0xa,
// /home/dan/src/projects/qtCwtchBulletin/main.qml
// /home/dan/src/projects/qtCwtchBulletinCMock/main.qml
0x0,0x0,0x6,0xc5,
0x69,
0x6d,0x70,0x6f,0x72,0x74,0x20,0x51,0x74,0x51,0x75,0x69,0x63,0x6b,0x20,0x32,0x2e,
@ -144,7 +144,7 @@ static const unsigned char qt_resource_data[] = {
0x34,0x30,0x38,0x31,0x32,0x33,0x38,0x37,0x39,0x32,0x37,0x33,0x65,0x63,0x32,0x61,
0x34,0x33,0x35,0x63,0x63,0x34,0x32,0x33,0x34,0x22,0x7d,0xa,0x20,0x20,0x20,0x20,
0x7d,0xa,0x7d,0xa,
// /home/dan/src/projects/qtCwtchBulletin/BlueBox.qml
// /home/dan/src/projects/qtCwtchBulletinCMock/BlueBox.qml
0x0,0x0,0x0,0x32,
0x69,
0x6d,0x70,0x6f,0x72,0x74,0x20,0x51,0x74,0x51,0x75,0x69,0x63,0x6b,0x20,0x32,0x2e,
@ -213,16 +213,16 @@ bool qUnregisterResourceData(int, const unsigned char *, const unsigned char *,
}
#endif
int QT_RCC_MANGLE_NAMESPACE(qInitResources___home_dan_src_projects_qtCwtchBulletin)();
int QT_RCC_MANGLE_NAMESPACE(qInitResources___home_dan_src_projects_qtCwtchBulletin)()
int QT_RCC_MANGLE_NAMESPACE(qInitResources___home_dan_src_projects_qtCwtchBulletinCMock)();
int QT_RCC_MANGLE_NAMESPACE(qInitResources___home_dan_src_projects_qtCwtchBulletinCMock)()
{
QT_RCC_PREPEND_NAMESPACE(qRegisterResourceData)
(0x2, qt_resource_struct, qt_resource_name, qt_resource_data);
return 1;
}
int QT_RCC_MANGLE_NAMESPACE(qCleanupResources___home_dan_src_projects_qtCwtchBulletin)();
int QT_RCC_MANGLE_NAMESPACE(qCleanupResources___home_dan_src_projects_qtCwtchBulletin)()
int QT_RCC_MANGLE_NAMESPACE(qCleanupResources___home_dan_src_projects_qtCwtchBulletinCMock)();
int QT_RCC_MANGLE_NAMESPACE(qCleanupResources___home_dan_src_projects_qtCwtchBulletinCMock)()
{
QT_RCC_PREPEND_NAMESPACE(qUnregisterResourceData)
(0x2, qt_resource_struct, qt_resource_name, qt_resource_data);
@ -231,7 +231,7 @@ int QT_RCC_MANGLE_NAMESPACE(qCleanupResources___home_dan_src_projects_qtCwtchBul
namespace {
struct initializer {
initializer() { QT_RCC_MANGLE_NAMESPACE(qInitResources___home_dan_src_projects_qtCwtchBulletin)(); }
~initializer() { QT_RCC_MANGLE_NAMESPACE(qCleanupResources___home_dan_src_projects_qtCwtchBulletin)(); }
initializer() { QT_RCC_MANGLE_NAMESPACE(qInitResources___home_dan_src_projects_qtCwtchBulletinCMock)(); }
~initializer() { QT_RCC_MANGLE_NAMESPACE(qCleanupResources___home_dan_src_projects_qtCwtchBulletinCMock)(); }
} dummy;
}