basic shell with dual cols

This commit is contained in:
Dan Ballard 2018-10-03 21:34:44 -07:00
parent bcb844977b
commit 5ff6790226
6 changed files with 138 additions and 61 deletions

4
.gitignore vendored
View File

@ -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

64
GroupsColumn.qml Normal file
View File

@ -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: '<b>' + title + '</b>' }
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 }
}
}

44
ProfilesColumn.qml Normal file
View File

@ -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 }
}
}
}
}
}

View File

@ -1,16 +0,0 @@
#include <QGuiApplication>
#include <QQmlApplicationEngine>
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();
}

View File

@ -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: '<b>' + title + '</b>' }
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"}
}
}

View File

@ -3,5 +3,7 @@
<file>main.qml</file>
<file>BlueBox.qml</file>
<file>Box.qml</file>
<file>ProfilesColumn.qml</file>
<file>GroupsColumn.qml</file>
</qresource>
</RCC>