From 5ff6790226cd3479954b6b74538b0ae4184ede9e Mon Sep 17 00:00:00 2001 From: Dan Ballard Date: Wed, 3 Oct 2018 21:34:44 -0700 Subject: [PATCH] basic shell with dual cols --- .gitignore | 4 +++ GroupsColumn.qml | 64 ++++++++++++++++++++++++++++++++++++++++++ ProfilesColumn.qml | 44 +++++++++++++++++++++++++++++ main.cpp | 16 ----------- main.qml | 69 ++++++++++++++++------------------------------ qml.qrc | 2 ++ 6 files changed, 138 insertions(+), 61 deletions(-) create mode 100644 GroupsColumn.qml create mode 100644 ProfilesColumn.qml delete mode 100644 main.cpp diff --git a/.gitignore b/.gitignore index fab7372..0e7f8c5 100644 --- a/.gitignore +++ b/.gitignore @@ -1,5 +1,9 @@ # This file is used to ignore files which are generated # ---------------------------------------------------------------------------- +.idea/ +deploy/ +rcc.cpp +rcc_cgo_linux_linux_amd64.go *~ *.autosave diff --git a/GroupsColumn.qml b/GroupsColumn.qml new file mode 100644 index 0000000..0af9931 --- /dev/null +++ b/GroupsColumn.qml @@ -0,0 +1,64 @@ +import QtQuick 2.0 + +Rectangle { + height: parent.height + width: 300 + anchors.top: parent.top + + color: "#4a3458" + + property alias model: list.model + + ListView { + id: list + height: parent.height + width: parent.width + clip: true + + delegate: Component { + id: groupsDelegate + + Item { + width: ListView.view.width + height: 40 + + Column { + Text { color: "#a0a0a0"; text: '' + title + '' } + Text { color: "#a0a0a0"; text: groupid } + } + + MouseArea { + id: mouse_area1 + z: 1 + hoverEnabled: false + anchors.fill: parent + onClicked: { + list.currentIndex = index + } + } + } + } + + section.property: "type" + section.delegate: Component { + id: groupsSectionDelegate + + Item { + width: ListView.view.width + height: 20 + //text: section + + Column { + Text { color: "#a0a0a0"; text: section + " (" + section.count + ")"} + } + } + } + + + highlight: Rectangle { color: "#ffffff"; radius: 5 } + + + + } +} + diff --git a/ProfilesColumn.qml b/ProfilesColumn.qml new file mode 100644 index 0000000..ef1cea4 --- /dev/null +++ b/ProfilesColumn.qml @@ -0,0 +1,44 @@ +import QtQuick 2.0 + + +Rectangle { + + color: "#381F47" + + height: parent.height + width: 100 + anchors.top: parent.top + anchors.left: parent.left + + property alias model: list.model + + + ListView { + id: list + height: parent.height + width: parent.width + + //highlight: Rectangle { border-color: "white"; radius: 5 } + + delegate: Component { + id: profileDelegate + + Item { + height: 100 + width: 100 + + Column { + Rectangle { width: 80; height: 80; color: pcolor } + Text { color: "#a0a0a0"; text: name } + } + } + } + + + + + } + + +} + diff --git a/main.cpp b/main.cpp deleted file mode 100644 index 6333b85..0000000 --- a/main.cpp +++ /dev/null @@ -1,16 +0,0 @@ -#include -#include - -int main(int argc, char *argv[]) -{ - QCoreApplication::setAttribute(Qt::AA_EnableHighDpiScaling); - - QGuiApplication app(argc, argv); - - QQmlApplicationEngine engine; - engine.load(QUrl(QStringLiteral("qrc:/main.qml"))); - if (engine.rootObjects().isEmpty()) - return -1; - - return app.exec(); -} diff --git a/main.qml b/main.qml index ed56f0c..cba37d4 100644 --- a/main.qml +++ b/main.qml @@ -5,55 +5,30 @@ Window { visible: true width: 1024 height: 800 - title: qsTr("Hello World") + title: qsTr("Bulletin") - ListView { - id: "navColumn" - height: parent.height - width: 300 - anchors.top: parent.top - anchors.left: parent.left - anchors.margins: 2 + ProfilesColumn { + id: profilesColumn + model: profiles + } - clip: true - - model: groups - - delegate: groupsDelegate - - section.property: "type" - section.delegate: groupsSectionDelegate - - highlight: Rectangle { color: "lightsteelblue"; radius: 5 } - - } - - Component { - id: groupsDelegate - - Item { - width: ListView.view.width - height: 40 - Column { - Text { text: '' + title + '' } - Text { text: groupid } - } - } - } - - Component { - id: groupsSectionDelegate - - BlueBox { - width: ListView.view.width - height: 20 - text: section - fontColor: '#e0e0e0' - } - } + GroupsColumn { + id: groupsColumn + anchors.left: profilesColumn.right + model: groups + } ListModel { - id: "groups" + id: profiles + + ListElement {name: "alice"; onion: "710829b408e8b368273cbc20b07f1c0d"; pcolor: "#ff0000"} + ListElement {name: "bob"; onion: "a219b9740fc76367833cbc20b07d1cee"; pcolor: "#00ff00" } + ListElement {name: "carol"; onion: "930829b408e8b364563cbc20b07a6560"; pcolor: "#0000ff" } + + } + + ListModel { + id: groups ListElement {type: "group"; title: "Work Friends"; groupid: "710829b408e8b368273cbc20b07f1c0d"} ListElement {type: "group"; title: "Cwtch Dev"; groupid: "a219b9740fc76367833cbc20b07d1cee" } @@ -62,4 +37,8 @@ Window { ListElement {type: "bulletin"; title: "Vancouver Listings"; groupid: "890a47403e87368273cbc2ebf7f1cdc"} ListElement {type: "bulletin"; title: "Game Discussions"; groupid: "cc45892408123879273ec2a435cc4234"} } + + + + } diff --git a/qml.qrc b/qml.qrc index b26ed3b..90156e9 100644 --- a/qml.qrc +++ b/qml.qrc @@ -3,5 +3,7 @@ main.qml BlueBox.qml Box.qml + ProfilesColumn.qml + GroupsColumn.qml