commit bcb844977b99542dcaac8635c0bf0a5e390e1b38 Author: Dan Ballard Date: Mon Sep 17 14:21:57 2018 -0700 add sidepanel; become go app diff --git a/.gitignore b/.gitignore new file mode 100644 index 0000000..fab7372 --- /dev/null +++ b/.gitignore @@ -0,0 +1,73 @@ +# This file is used to ignore files which are generated +# ---------------------------------------------------------------------------- + +*~ +*.autosave +*.a +*.core +*.moc +*.o +*.obj +*.orig +*.rej +*.so +*.so.* +*_pch.h.cpp +*_resource.rc +*.qm +.#* +*.*# +core +!core/ +tags +.DS_Store +.directory +*.debug +Makefile* +*.prl +*.app +moc_*.cpp +ui_*.h +qrc_*.cpp +Thumbs.db +*.res +*.rc +/.qmake.cache +/.qmake.stash + +# qtcreator generated files +*.pro.user* + +# xemacs temporary files +*.flc + +# Vim temporary files +.*.swp + +# Visual Studio generated files +*.ib_pdb_index +*.idb +*.ilk +*.pdb +*.sln +*.suo +*.vcproj +*vcproj.*.*.user +*.ncb +*.sdf +*.opensdf +*.vcxproj +*vcxproj.* + +# MinGW generated files +*.Debug +*.Release + +# Python byte code +*.pyc + +# Binaries +# -------- +*.dll +*.exe + diff --git a/BlueBox.qml b/BlueBox.qml new file mode 100644 index 0000000..760dd53 --- /dev/null +++ b/BlueBox.qml @@ -0,0 +1,6 @@ +import QtQuick 2.0 + + +Box { + color: "#157efb" +} diff --git a/Box.qml b/Box.qml new file mode 100644 index 0000000..6ee4522 --- /dev/null +++ b/Box.qml @@ -0,0 +1,17 @@ +import QtQuick 2.0 + +Rectangle { + id: root + width: 64 + height: 64 + color: "#ffffff" + border.color: Qt.darker(color, 1.2) + property alias text: label.text + property color fontColor: '#1f1f1f' + Text { + id: label + anchors.centerIn: parent + font.pixelSize: 14 + color: root.fontColor + } +} diff --git a/main.cpp b/main.cpp new file mode 100644 index 0000000..6333b85 --- /dev/null +++ b/main.cpp @@ -0,0 +1,16 @@ +#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.go b/main.go new file mode 100644 index 0000000..4b12096 --- /dev/null +++ b/main.go @@ -0,0 +1,44 @@ +package main + +import ( + "os" + + "github.com/therecipe/qt/core" + "github.com/therecipe/qt/gui" + "github.com/therecipe/qt/qml" + "github.com/therecipe/qt/quickcontrols2" +) + +func main() { + + // enable high dpi scaling + // useful for devices with high pixel density displays + // such as smartphones, retina displays, ... + core.QCoreApplication_SetAttribute(core.Qt__AA_EnableHighDpiScaling, true) + + // needs to be called once before you can start using QML + gui.NewQGuiApplication(len(os.Args), os.Args) + + // use the material style + // the other inbuild styles are: + // Default, Fusion, Imagine, Universal + quickcontrols2.QQuickStyle_SetStyle("Material") + + // create the qml application engine + engine := qml.NewQQmlApplicationEngine(nil) + + // load the embeeded qml file + // created by either qtrcc or qtdeploy + //engine.Load(core.NewQUrl3("qrc:./Box.qml", 0)) + //engine.Load(core.NewQUrl3("qrc:./BlueBox.qml", 0)) + //engine.Load(core.NewQUrl3("qrc:./main.qml", 0)) + engine.Load(core.NewQUrl3("qrc:/main.qml", 0)) + // you can also load a local file like this instead: + //engine.Load(core.QUrl_FromLocalFile("./qml/main.qml")) + + // start the main Qt event loop + // and block until app.Exit() is called + // or the window is closed by the user + gui.QGuiApplication_Exec() +} + diff --git a/main.qml b/main.qml new file mode 100644 index 0000000..ed56f0c --- /dev/null +++ b/main.qml @@ -0,0 +1,65 @@ +import QtQuick 2.9 +import QtQuick.Window 2.2 + +Window { + visible: true + width: 1024 + height: 800 + title: qsTr("Hello World") + + ListView { + id: "navColumn" + height: parent.height + width: 300 + anchors.top: parent.top + anchors.left: parent.left + anchors.margins: 2 + + 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' + } + } + + ListModel { + id: "groups" + + ListElement {type: "group"; title: "Work Friends"; groupid: "710829b408e8b368273cbc20b07f1c0d"} + ListElement {type: "group"; title: "Cwtch Dev"; groupid: "a219b9740fc76367833cbc20b07d1cee" } + ListElement {type: "group"; title: "Gaming Squad"; groupid: "930829b408e8b364563cbc20b07a6560" } + + ListElement {type: "bulletin"; title: "Vancouver Listings"; groupid: "890a47403e87368273cbc2ebf7f1cdc"} + ListElement {type: "bulletin"; title: "Game Discussions"; groupid: "cc45892408123879273ec2a435cc4234"} + } +} diff --git a/qml.qrc b/qml.qrc new file mode 100644 index 0000000..b26ed3b --- /dev/null +++ b/qml.qrc @@ -0,0 +1,7 @@ + + + main.qml + BlueBox.qml + Box.qml + + diff --git a/qtCwtchBulletin.pro b/qtCwtchBulletin.pro new file mode 100644 index 0000000..e2173bc --- /dev/null +++ b/qtCwtchBulletin.pro @@ -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