diff --git a/cmd/main.go b/cmd/main.go new file mode 100644 index 0000000..728f20c --- /dev/null +++ b/cmd/main.go @@ -0,0 +1,242 @@ +package main + +import ( + "os" + + "github.com/therecipe/qt/core" + "github.com/therecipe/qt/quick" + "github.com/therecipe/qt/widgets" +) + +func init() { + CustomTreeModel_QmlRegisterType2("CustomQmlTypes", 1, 0, "CustomTreeModel") +} + +const something = 1<<31 - 1 + +const ( + FirstName = int(core.Qt__UserRole) + 1< 0) { //fmt.Println("source (provider): ", id) - i1 := strings.Index(id, `;`) - i, _ := strconv.Atoi(id[:i1]) - img1 = slides[i].getImage(width, height) + // i1 := strings.Index(id, `;`) + // i, _ := strconv.Atoi(id[:i1]) + // img1 = slides[i].getImage(width, height) } else { img1 = image.NewRGBA(image.Rect(0, 0, 340, 480)) } return img1 } - -//clear cache dosen't actually clear the cache -//just gives a new source so that the cache isn't used -func (cl *Cell) clearcache() { - str := cl.image.qmlImage.String("source") - i := strings.Index(str, `;`) - str1 := str[:i] - i1, _ := strconv.Atoi(str[i+1:]) - str = str1 + `;` + strconv.Itoa(i1+1) - //fmt.Println("new source (click): ", str) - cl.image.qmlImage.Set("source", str) -} diff --git a/qml/Cell.qml b/qml/Cell.qml index cdfda78..2f12bcd 100644 --- a/qml/Cell.qml +++ b/qml/Cell.qml @@ -1,83 +1,37 @@ import QtQuick 2.4 +import QtQuick.Layouts 1.11 Rectangle { - objectName: "cellRect" - property int index: 0 + id: itm height: 100 - border.width: 2 - border.color: "black" anchors.right: parent.right anchors.left: parent.left - - Text { - id: cellText - enabled: true - objectName: "cellText" - text: "" - clip: true - wrapMode: Text.WrapAtWordBoundaryOrAnywhere - anchors.fill: parent - anchors.right: parent.right - anchors.rightMargin: 0 - anchors.left: parent.left - anchors.leftMargin: 2 - - MouseArea { - id: cellMouse - hoverEnabled: true - enabled: true - objectName: "cellMouse" + property alias text: cellText.text + Rectangle { + id: half1 + height: 100 + Layout.fillWidth: true + Layout.minimumWidth: 100 + Rectangle { + objectName: "cellRect" + property int index: 0 anchors.fill: parent - acceptedButtons: Qt.AllButtons - - onMouseXChanged: cellHover() - onExited: focusChanged(focus) - - function cellHover() { - if (containsMouse) { - parent.parent.border.color = "skyblue" - parent.parent.color = "darkblue" - parent.color = "white" - } else if (focus) { - parent.color = "black" - } - } - - function notSelected() { - - parent.parent.border.color = "black" - parent.parent.color = "white" - parent.color = "black" - cellHover() - } - - function selected() { - parent.parent.border.color = "blue" - parent.color = "black" - parent.parent.color = "gainsboro" - cellHover() + border.width: 2 + border.color: "black" + Text { + id: cellText + enabled: true + objectName: "cellText" + // text: "itm.model.text" + renderType: Text.NativeRendering + clip: true + wrapMode: Text.WrapAtWordBoundaryOrAnywhere + anchors.fill: parent + anchors.right: parent.right + anchors.rightMargin: 0 + anchors.left: parent.left + anchors.leftMargin: 2 } } } - Image { - id: img - antialiasing: true - source: "image://images/" - objectName: "cellImg" - property int index: 0 - height: 100 - transformOrigin: Item.TopLeft - fillMode: Image.PreserveAspectFit - anchors.right: parent.right - anchors.left: parent.left - //cache: false - MouseArea { - id: imgMouse - hoverEnabled: true - enabled: true - objectName: "cellMouse" - anchors.fill: parent - acceptedButtons: Qt.AllButtons - } -} } diff --git a/qml/Display.qml b/qml/Display.qml index 5ebd864..ca8a118 100644 --- a/qml/Display.qml +++ b/qml/Display.qml @@ -1,5 +1,5 @@ import QtQuick 2.4 -import QtQuick.Controls 1.3 +import QtQuick.Controls 2.4 ApplicationWindow { flags: Qt.MaximumSize @@ -13,5 +13,9 @@ ApplicationWindow { antialiasing: true anchors.fill: parent } - } + +/*##^## Designer { + D{i:0;autoSize:true;height:480;width:640} +} + ##^##*/ diff --git a/qml/img.qml b/qml/Img.qml similarity index 61% rename from qml/img.qml rename to qml/Img.qml index 1614a19..2d3552b 100644 --- a/qml/img.qml +++ b/qml/Img.qml @@ -13,11 +13,11 @@ Image { anchors.left: parent.left //cache: false MouseArea { - id: cellMouse - hoverEnabled: true - enabled: true - objectName: "cellMouse" - anchors.fill: parent - acceptedButtons: Qt.AllButtons - } + id: cellMouse + hoverEnabled: true + enabled: true + objectName: "cellMouse" + anchors.fill: parent + acceptedButtons: Qt.AllButtons + } } diff --git a/qml/Main.qml b/qml/Main.qml index 7e5f22c..55de047 100644 --- a/qml/Main.qml +++ b/qml/Main.qml @@ -1,9 +1,9 @@ import QtQuick 2.4 -import QtQuick.Dialogs 1.2 -import QtQuick.Controls 1.3 -import QtQuick.Window 2.0 -//import "qml" -import QtQuick.Layouts 1.0 +import QtQuick.Controls 1.6 as Quick +import QtQuick.Controls 2.4 +import QtQuick.Dialogs 1.3 +import QtQuick.Window 2.11 +import QtQuick.Layouts 1.11 ApplicationWindow { id: applicationWindow1 @@ -12,23 +12,108 @@ ApplicationWindow { objectName: "applicationWindow1" minimumWidth: 500 minimumHeight: 500 - width: 1000 - height: 600 FileDialog { id: imgpicker - // @disable-check M16 - title: "Choose an image for this slide" - // @disable-check M16 objectName: "imgpicker" + title: "Choose an image for this slide" } - Action { - id: aboutAction - text: "About" - onTriggered: aboutDialog.open() - } + Quick.SplitView { + id: spview + anchors.fill: parent + Rectangle { + id: preview + objectName: "col1" + border.width: 0 + Layout.minimumWidth: 150 + Layout.fillWidth: true + Flickable { + id: scview + objectName: "scview" + anchors.fill: parent + boundsBehavior: Flickable.OvershootBounds + flickableDirection: Flickable.VerticalFlick + pixelAligned: true + //verticalScrollBarPolicy: Qt.ScrollBarAlwaysOn + //horizontalScrollBarPolicy: Qt.ScrollBarAlwaysOff + //highlightOnFocus: false + //frameVisible: true + contentHeight: contentItem.childrenRect.height + + Quick.SplitView { + anchors.fill: parent + } + + Rectangle { + id: textEdit + objectName: "textEdit" + visible: false + property bool keepText: true + Keys.onPressed: { + if ((event.key == Qt.Key_Return) + && (event.modifiers & Qt.ControlModifier)) { + keepText = true + textEdit1.focus = false + event.accepted = true + } + + if (event.key == Qt.Key_Escape) { + keepText = false + textEdit1.focus = false + event.accepted = true + } + } + + TextArea { + id: textEdit1 + objectName: "textEdit1" + anchors.fill: parent + clip: true + textFormat: Text.AutoText + visible: true + font.pixelSize: 12 + z: 99 + hoverEnabled: false + } + } + } + } + + Rectangle { + id: mainView + objectName: "mainView" + Layout.minimumWidth: 100 + Layout.fillWidth: false + + Button { + id: button1 + objectName: "btnAdd" + x: 8 + y: 8 + text: qsTr("Add") + onClicked: sv.addLst("fail") + } + + Button { + id: button2 + x: 8 + y: 49 + text: qsTr("Remove") + objectName: "btnRem" + } + + Button { + id: button3 + x: 8 + y: 90 + text: qsTr("Button ") + objectName: "btnMem" + } + } + } + /* menuBar: MenuBar { Menu { title: "&File" @@ -55,13 +140,13 @@ ApplicationWindow { } Menu { - title: "&Help" + MenuItem { - action: aboutAction + text: "&help" } } } - +*/ Menu { objectName: "mnuCtx" title: "new image..." @@ -71,174 +156,4 @@ ApplicationWindow { onTriggered: imgpicker.open() } } - - SplitView { - id: mainSlider - objectName: "mainSlider" - anchors.right: parent.right - anchors.bottom: parent.bottom - anchors.top: parent.top - anchors.left: parent.left - anchors.rightMargin: 0 - anchors.bottomMargin: 0 - anchors.leftMargin: 0 - anchors.topMargin: 0 - orientation: Qt.Horizontal - onResizingChanged: col1.width = gridData.width / 2 - - Rectangle { - id: gridRect - objectName: "gridRect" - width: 300 - color: "#00000000" - border.width: 4 - anchors.left: parent.left - anchors.leftMargin: 0 - anchors.bottom: parent.bottom - anchors.bottomMargin: 0 - anchors.top: parent.top - anchors.topMargin: 0 - property int count: 1 - property int expcount: 1 - - ScrollView { - id: scview - anchors.fill: parent - anchors.margins: 4 - horizontalScrollBarPolicy: Qt.ScrollBarAlwaysOff - verticalScrollBarPolicy: Qt.ScrollBarAlwaysOn - - SplitView { - id: gridData - objectName: "gridData" - width: scview.width - 1 - height: data1.childrenRect.height //gridRect.count * 101 - - Rectangle { - id: col1 - objectName: "col1" - width: gridData.width / 2 - color: "#00000000" - transformOrigin: Item.TopLeft - border.width: 0 - height: data1.childrenRect.height - Rectangle { - id: textEdit - property int cell - x: 232 - y: 622 - objectName: "textEdit" - width: 200 - height: 200 - color: "#ffffff" - visible: false - property bool txt: true - Keys.onPressed: { - if ((event.key == Qt.Key_Return) - && (event.modifiers & Qt.ControlModifier)) { - txt = true - - x = -100 - y = -100 - visible = false - focus = true - enabled = false - opacity = 0 - textEdit1.focus = false - - event.accepted = true - } - - if (event.key == Qt.Key_Escape) { - txt = false - x = -100 - y = -100 - visible = false - focus = true - enabled = false - opacity = 0 - textEdit1.focus = false - - event.accepted = true - } - } - - TextArea { - id: textEdit1 - objectName: "textEdit1" - anchors.fill: parent - clip: true - textFormat: Text.AutoText - visible: true - font.pixelSize: 12 - z: 99 - } - } - - Column { - id: data1 - objectName: "data1" - spacing: 1 - anchors.fill: parent - clip: true - height: data1.childrenRect.height - } - } - - Rectangle { - id: col2 - objectName: "col2" - color: "#00000000" - border.width: 0 - - Column { - id: data2 - spacing: 1 - objectName: "data2" - anchors.fill: parent - } - } - } - } - } - - Rectangle { - id: mainView - border.width: 0 - objectName: "mainView" - anchors.right: parent.right - anchors.rightMargin: 0 - anchors.leftMargin: 0 - anchors.left: gridRect.right - anchors.bottom: parent.bottom - anchors.top: parent.top - z: 1 - clip: false - visible: true - - Button { - id: button1 - objectName: "btnAdd" - x: 8 - y: 8 - text: qsTr("Button") + data1.childrenRect.height - } - - Button { - id: button2 - x: 8 - y: 43 - text: qsTr("Button ") - objectName: "btnRem" - } - - Button { - id: button3 - x: 8 - y: 78 - text: qsTr("Button ") - objectName: "btnMem" - } - } - } } diff --git a/qml/Service.qml b/qml/Service.qml index 088434d..e4398c3 100644 --- a/qml/Service.qml +++ b/qml/Service.qml @@ -1,197 +1,35 @@ //https://gist.github.com/elpuri/3753756 import QtQuick 2.4 +import QtQuick.Controls 1.6 +import QtQuick.Controls.Styles 1.4 -Item { - id: rt - property ListElement def: ListElement { - property string cellText: " - - - - -Untitled 1 - - - - -

Header text

-This is paragraph text - -
- - -" - property int collectionIndex: 0 - property string imageSource: "image://images/list:;cell:" +TreeView { + id: view + anchors.fill: parent + anchors.margins: 2 * 12 + row.height + model: colors + alternatingRowColors: false + style: TreeViewStyle { + branchDelegate: Rectangle { + width: 16 + height: 16 + color: styleData.isExpanded ? "green" : "red" + } + frame: Rectangle {border {color: "blue"}} + backgroundColor: "blue" } - Component.onCompleted: addLst("Haha :-P") - height: ((lst.count) * 50) + (lst.subCount * 100) - - anchors.right: parent.right - anchors.left: parent.left - anchors.leftMargin: 0 - function remove(List, index) { - lst.subCount-- - nestedModel.get(List).subItems.remove(index, 1) - } - - function pop(List) { - lst.subCount-- - nestedModel.get(List).subItems.remove(nestedModel.get( - List).subItems.count - 1, 1) - } - function newdef(index, txt, src) { - var item = Object.create(def) - item.collectionIndex = index - item.text = txt - item.imageSource = src - return item - } - function remLst() { - nestedModel.remove(nestedModel.count - 1, 1) - } - - function apppend(List, obj) { - lst.subCount++ - nestedModel.get(List).subItems.append(obj) - } - - function insert(List, index, obj) { - lst.subCount++ - nestedModel.get(List).subItems.insert(index, obj) - } - - function get(List, index) { - return nestedModel.get(List).subItems.get(index) - } - - function set(List, index, obj) { - nestedModel.get(List).subItems.set(index, obj) - } - - function addLst(str) { - var newCollection - var i = 0 - var temp = Qt.createComponent("Sublist.qml").createObject(rt, { - - }) - - newCollection = temp.get(0) - newCollection.name = str - newCollection.subItems.clear() - for (i = 0; i < 1; i++) { - newCollection.subItems.append(newdef(nestedModel.count, "idiot")) - } - - nestedModel.append(newCollection) - } - - ListView { - id: lst - anchors.fill: parent - y: 0 - height: ((lst.count) * 55) + (lst.subCount * 100) - interactive: false - property int subCount: 0 - model: nestedModel - delegate: Component { - id: categoryDelegate - Column { - anchors.right: parent.right - anchors.left: parent.left - - //width: 200 - Rectangle { - id: categoryItem - anchors.right: parent.right - anchors.left: parent.left - border.color: "black" - border.width: 5 - color: "white" - height: 50 - - //width: 200 - Text { - anchors.verticalCenter: parent.verticalCenter - x: 15 - font.pixelSize: 24 - text: name - clip: true - anchors.left: parent.left - anchors.right: parent.right - anchors.rightMargin: 15 - anchors.leftMargin: 5 - } - - Rectangle { - color: "red" - width: 30 - height: 30 - anchors.right: parent.right - anchors.rightMargin: 15 - anchors.verticalCenter: parent.verticalCenter - - MouseArea { - anchors.fill: parent - - // Toggle the 'collapsed' property - onClicked: { - nestedModel.setProperty(index, "collapsed", - !collapsed) - if (!nestedModel.get(index).collapsed) { - lst.subCount = lst.subCount + subItemLoader.subItemModel.count - } else { - lst.subCount = lst.subCount - subItemLoader.subItemModel.count - } - } - } - } - } - - Loader { - id: subItemLoader - - // This is a workaround for a bug/feature in the Loader element. If sourceComponent is set to null - // the Loader element retains the same height it had when sourceComponent was set. Setting visible - // to false makes the parent Column treat it as if it's height was 0. - visible: !collapsed - property variant subItemModel: subItems - sourceComponent: subItemColumnDelegate - onStatusChanged: if (status == Loader.Ready) { - item.model = subItemModel - } - } - } + TableViewColumn { + title: "Name" + role: "display" + resizable: true + delegate: Cell { + text: "hell" } } - - Component { - id: subItemColumnDelegate - Column { - property alias model: subItemRepeater.model - - width: rt.width - Repeater { - id: subItemRepeater - objectName: "repeater" - delegate: Cell { - } - } - } - } - ListModel { - id: nestedModel - objectName: "nestedModel" - } } + +/*##^## Designer { + D{i:0;autoSize:true;height:480;width:640} +} + ##^##*/ diff --git a/qml/SongEdit.qml b/qml/SongEdit.qml index 3859e31..b6b2242 100644 --- a/qml/SongEdit.qml +++ b/qml/SongEdit.qml @@ -1,8 +1,7 @@ import QtQuick 2.4 -import QtQuick.Controls 1.4 -import QtQuick.Layouts 1.1 -import QtQuick.Dialogs 1.2 -//import Qt.labs.controls 1.0 +import QtQuick.Controls 1.6 +import QtQuick.Layouts 1.11 +import QtQuick.Dialogs 1.3 ApplicationWindow { minimumHeight: 480 @@ -79,7 +78,7 @@ ApplicationWindow { } ListView { id: lstVerses - objectName: "lstVerses" + objectName: "lstVerses" clip: true highlight: Rectangle { color: "lightsteelblue" @@ -119,7 +118,7 @@ ApplicationWindow { } ListView { id: lstOrder - objectName: "lstOrder" + objectName: "lstOrder" clip: true highlight: Rectangle { color: "lightsteelblue" @@ -180,11 +179,6 @@ ApplicationWindow { objectName: "fontPicker" Layout.alignment: Qt.AlignLeft | Qt.AlignTop model: go.fontList.split("\n") - /*// @disable-check M16 - delegate:Text { - text: go.fontList(index) - }*/ - } SpinBox { @@ -228,7 +222,7 @@ ApplicationWindow { ComboBox { id: imgPicker objectName: "imgPicker" - model: go.img.split("\n") + //model: go.img.split("\n") /*// @disable-check M16 delegate: Text { text: go.img(index) @@ -236,7 +230,7 @@ ApplicationWindow { } TextArea { id: txtVerse - objectName: "txtVerse" + objectName: "txtVerse" width: 80 height: 20 text: qsTr("Text Edit") diff --git a/qml/Sublist.qml b/qml/Sublist.qml index 9765b6f..6f87bb3 100644 --- a/qml/Sublist.qml +++ b/qml/Sublist.qml @@ -8,7 +8,7 @@ ListModel { return get(0) } ListElement { - categoryName: "Cars" + title: "Cars" collapsed: true subItems: [ ListElement { diff --git a/qml/fileDialogs.qml b/qml/fileDialogs.qml index a725a8b..e6e0f76 100644 --- a/qml/fileDialogs.qml +++ b/qml/fileDialogs.qml @@ -1,13 +1,15 @@ -import QtQuick 2.2 -import QtQuick.Dialogs 1.0 +import QtQuick 2.4 +import QtQuick.Dialogs 1.3 FileDialog { id: imgDialog title: "Please choose an image" folder: shortcuts.home onAccepted: { + } onRejected: { + } Component.onCompleted: visible = true } diff --git a/qrc.go b/qrc.go index 5fe4aeb..8d1f8c1 100644 --- a/qrc.go +++ b/qrc.go @@ -39,7 +39,11 @@ func qrcRepackResources() error { if err != nil { return err } - rp.Add(filepath.ToSlash(path), data) + if filepath.Ext(info.Name()) == ".conf" { + rp.Add("/", data) + } else { + rp.Add(filepath.ToSlash(path), data) + } return nil }) if err != nil { @@ -51,3 +55,4 @@ func qrcRepackResources() error { } var qrcResourcesRepacked []byte +var qrcResourcesData = "qres\x00\x00\x00\x01\x00\x00X\xed\x00\x00\x00\x14\x00\x00W\xdb\x00\x00\x026import QtQuick 2.4\n\nListModel {\n id: nestedModel\n objectName: \"nestedModel\"\n function get1() {\n console.log(get(0))\n return get(0)\n }\n ListElement {\n title: \"Cars\"\n collapsed: true\n subItems: [\n ListElement {\n itemName: \"tst\"\n },\n ListElement {\n itemName: \"Tota\"\n },\n ListElement {\n itemName: \"vy\"\n },\n ListElement {\n itemName: \"Audio Adrenaline\"\n }\n ]\n }\n}\n\x00\x00\x01\xfdimport QtQuick 2.4\n\nImage {\n id: img\n antialiasing: true\n source: \"image://images/\"\n objectName: \"cellImg\"\n property int index: 0\n height: 100\n transformOrigin: Item.TopLeft\n fillMode: Image.PreserveAspectFit\n anchors.right: parent.right\n anchors.left: parent.left\n //cache: false\n MouseArea {\n id: cellMouse\n hoverEnabled: true\n enabled: true\n objectName: \"cellMouse\"\n anchors.fill: parent\n acceptedButtons: Qt.AllButtons\n }\n}\n\x00\x00\x1e.import QtQuick 2.4\nimport QtQuick.Controls 1.3\nimport QtQuick.Layouts 1.1\nimport QtQuick.Dialogs 1.2\n\nApplicationWindow {\n minimumHeight: 480\n minimumWidth: 640\n\n ColorDialog {\n id: textClrDialog\n //objectname: \"textClrDialog\"\n title: \"Please choose a color for the text\"\n showAlphaChannel: true\n }\n\n ColorDialog {\n id: outlineClrDialog\n //objectname: \"outlineClrDialog\"\n title: \"Please choose a color for the text\"\n showAlphaChannel: true\n }\n\n menuBar: MenuBar {\n Menu {\n title: \"&File\"\n MenuItem {\n text: \"Close\"\n }\n }\n Menu {\n title: \"&Edit\"\n MenuItem {\n text: \"quick edit\"\n objectName: \"mnuEdit\"\n }\n }\n\n Menu {\n title: \"Window\"\n\n MenuItem {\n text: \"Display\"\n objectName: \"mnuDisplay\"\n }\n }\n\n Menu {\n title: \"&Help\"\n MenuItem {\n //action: aboutAction\n }\n }\n }\n\n RowLayout {\n id: rowLayout1\n enabled: true\n smooth: true\n antialiasing: true\n anchors.fill: parent\n\n RowLayout {\n id: rowlayout3\n Layout.fillHeight: true\n Layout.alignment: Qt.AlignTop\n Layout.maximumWidth: 225\n\n ColumnLayout {\n id: columnlayout2\n Layout.alignment: Qt.AlignLeft | Qt.AlignTop\n Layout.fillHeight: true\n\n Label {\n id: label1\n text: qsTr(\"Verses\")\n Layout.alignment: Qt.AlignLeft | Qt.AlignTop\n }\n ListView {\n id: lstVerses\n objectName: \"lstVerses\"\n clip: true\n highlight: Rectangle {\n color: \"lightsteelblue\"\n radius: 5\n }\n width: 110\n Layout.fillHeight: true\n Layout.alignment: Qt.AlignLeft | Qt.AlignTop\n focus: true\n keyNavigationWraps: true\n boundsBehavior: Flickable.StopAtBounds\n model: go.verseLen\n\n delegate: Item {\n x: 5\n width: 80\n height: 40\n\n Text {\n text: go.verses(index)\n anchors.verticalCenter: parent.verticalCenter\n font.bold: true\n }\n }\n }\n }\n\n ColumnLayout {\n id: columnlayout3\n Layout.alignment: Qt.AlignLeft | Qt.AlignTop\n Layout.fillHeight: true\n\n Label {\n id: label2\n text: qsTr(\"Verse Order\")\n Layout.alignment: Qt.AlignLeft | Qt.AlignTop\n }\n ListView {\n id: lstOrder\n objectName: \"lstOrder\"\n clip: true\n highlight: Rectangle {\n color: \"lightsteelblue\"\n radius: 5\n }\n width: 110\n Layout.fillHeight: true\n Layout.alignment: Qt.AlignLeft | Qt.AlignTop\n boundsBehavior: Flickable.StopAtBounds\n model: go.orderLen\n delegate: Item {\n x: 5\n width: 80\n height: 40\n\n Text {\n text: go.verseOrder(index)\n anchors.verticalCenter: parent.verticalCenter\n font.bold: true\n }\n }\n }\n }\n }\n\n ColumnLayout {\n id: columnlayout4\n Layout.fillWidth: true\n Layout.alignment: Qt.AlignLeft | Qt.AlignTop\n Layout.fillHeight: true\n\n RowLayout {\n id: rowLayout3\n Layout.alignment: Qt.AlignLeft | Qt.AlignTop\n Layout.maximumHeight: 30\n Layout.minimumHeight: 30\n Layout.preferredHeight: 30\n Layout.fillWidth: true\n\n ToolButton {\n id: textColorPicker\n objectName: \"textColorPicker\"\n text: \"Text Color\"\n Layout.alignment: Qt.AlignLeft | Qt.AlignTop\n tooltip: \"Pick the color of the text\"\n }\n\n ToolButton {\n id: outlineColorPicker\n objectName: \"outlineColorPicker\"\n text: \"Outline Color\"\n Layout.alignment: Qt.AlignLeft | Qt.AlignTop\n tooltip: \"Pick the color of the text outline\"\n }\n\n ComboBox {\n id: fontPicker\n objectName: \"fontPicker\"\n Layout.alignment: Qt.AlignLeft | Qt.AlignTop\n model: go.fontList.split(\"\\n\")\n /*// @disable-check M16\n delegate:Text {\n text: go.fontList(index)\n }*/\n }\n\n SpinBox {\n id: fontSize\n objectName: \"fontSize\"\n Layout.alignment: Qt.AlignLeft | Qt.AlignTop\n maximumValue: 1000\n value: 1\n suffix: \"Pt\"\n }\n\n SpinBox {\n id: outlineSize\n stepSize: 0.1\n decimals: 1\n Layout.alignment: Qt.AlignLeft | Qt.AlignTop\n objectName: \"outlineSize\"\n maximumValue: 10\n value: 1\n }\n }\n RowLayout {\n id: rowLayout2\n Layout.preferredHeight: 30\n Layout.maximumHeight: 30\n Layout.minimumHeight: 30\n Layout.alignment: Qt.AlignLeft | Qt.AlignTop\n Layout.fillHeight: true\n Layout.fillWidth: true\n\n ComboBox {\n id: versePicker\n objectName: \"versePicker\"\n model: go.verses.split(\"\\n\")\n /*// @disable-check M16\n delegate: Text {\n text: go.verses(index)\n }*/\n }\n\n ComboBox {\n id: imgPicker\n objectName: \"imgPicker\"\n //model: go.img.split(\"\\n\")\n /*// @disable-check M16\n delegate: Text {\n text: go.img(index)\n }*/\n }\n TextArea {\n id: txtVerse\n objectName: \"txtVerse\"\n width: 80\n height: 20\n text: qsTr(\"Text Edit\")\n textFormat: Text.AutoText\n Layout.fillHeight: true\n Layout.fillWidth: true\n Layout.alignment: Qt.AlignLeft | Qt.AlignTop\n font.pixelSize: 12\n selectByKeyboard: true\n selectByMouse: true\n }\n }\n }\n }\n}\n\x00\x00\x00\xebimport QtQuick 2.2\nimport QtQuick.Dialogs 1.0\n\nFileDialog {\n id: imgDialog\n title: \"Please choose an image\"\n folder: shortcuts.home\n onAccepted: {\n\n }\n onRejected: {\n\n }\n Component.onCompleted: visible = true\n}\n\x00\x00\x01nimport QtQuick 2.4\nimport QtQuick.Controls 1.3 as Quick\nimport QtQuick.Controls 2.1\n\nApplicationWindow {\n flags: Qt.MaximumSize\n Component.onCompleted: visible = true\n\n Image {\n id: image1\n objectName: \"displayImage\"\n sourceSize.height: 768\n sourceSize.width: 1024\n antialiasing: true\n anchors.fill: parent\n }\n}\n\x00\x00\x12 150) {\n temp = 150\n }\n\n itm.height = temp\n }\n\n Img {\n id: cellImg\n anchors.fill: parent\n objectName: \"cellImg\"\n source: \"itm.model.imageSource\"\n }\n }\n }\n}\n\x00\x00\x13\x86//https://gist.github.com/elpuri/3753756\nimport QtQuick 2.4\n\nItem {\n id: rt\n property ListElement def: ListElement {\n property string cellText: \"DOCTYPE html PUBLIC\"\n property int collectionIndex: 0\n property string imageSource: \"image://images/list:;cell:\"\n }\n\n Component.onCompleted: addLst(\"Haha :-P\")\n height: lst.contentHeight\n anchors.right: parent.right\n anchors.left: parent.left\n anchors.leftMargin: 0\n function remove(List, index) {\n lst.subCount--\n lst.model[List].subItems.remove(index, 1)\n }\n\n function pop(List) {\n lst.subCount--\n lst.model[List].subItems.remove(lst.model[List].subItems.count - 1, 1)\n }\n function newdef(index, txt, src) {\n var item = Object.create(def)\n item.collectionIndex = index\n item.title = txt\n item.imageSource = src\n return item\n }\n function remLst() {\n lst.model.remove(lst.model.count - 1, 1)\n }\n\n function apppend(List, obj) {\n lst.subCount++\n lst.model[List].subItems.append(obj)\n }\n\n function insert(List, index, obj) {\n lst.subCount++\n lst.model[List].subItems.insert(index, obj)\n }\n\n function get(List, index) {\n return lst.model[List].subItems.get(index)\n }\n\n function set(List, index, obj) {\n lst.model[List].subItems.set(index, obj)\n }\n\n function addLst(str) {\n var newCollection\n var count = 2\n var i = 0\n var temp = Qt.createComponent(\"Sublist.qml\").createObject(rt, {\n\n })\n\n newCollection = temp.get(0)\n newCollection.title = str\n newCollection.subItems.clear()\n for (i = 0; i < count; i++) {\n newCollection.subItems.append(newdef(lst.model.count, \"idiot\"))\n }\n\n lst.model.append(newCollection)\n }\n\n ListView {\n id: lst\n anchors.fill: parent\n y: 0\n interactive: false\n model: nestedModel\n delegate: Component {\n id: categoryDelegate\n Column {\n anchors.right: parent.right\n anchors.left: parent.left\n\n Rectangle {\n id: categoryItem\n anchors.right: parent.right\n anchors.left: parent.left\n border.color: \"black\"\n border.width: 5\n color: \"white\"\n height: 50\n\n Text {\n anchors.verticalCenter: parent.verticalCenter\n x: 15\n font.pixelSize: 24\n text: index + ' ' + cellText\n clip: true\n anchors.left: parent.left\n anchors.right: parent.right\n anchors.rightMargin: 15\n anchors.leftMargin: 5\n }\n\n Rectangle {\n color: \"red\"\n width: 30\n height: 30\n anchors.right: parent.right\n anchors.rightMargin: 15\n anchors.verticalCenter: parent.verticalCenter\n\n MouseArea {\n anchors.fill: parent\n\n // Toggle the 'collapsed' property\n onClicked: {\n lst.model.setProperty(index, \"collapsed\",\n !collapsed)\n }\n }\n }\n }\n\n Loader {\n id: subItemLoader\n\n // This is a workaround for a bug/feature in the Loader element. If sourceComponent is set to null\n // the Loader element retains the same height it had when sourceComponent was set. Setting visible\n // to false makes the parent Column treat it as if it's height was 0.\n visible: !collapsed\n property variant subItemModel: subItems\n sourceComponent: subItemColumnDelegate\n onStatusChanged: if (status == Loader.Ready) {\n item.model = subItemModel\n }\n }\n }\n }\n }\n\n Component {\n id: subItemColumnDelegate\n Column {\n property alias model: subItemRepeater.model\n\n width: rt.width\n Repeater {\n anchors.right: parent.right\n anchors.left: parent.left\n id: subItemRepeater\n objectName: \"repeater\"\n delegate: Cell {\n }\n }\n }\n }\n ListModel {\n id: nestedModel\n objectName: \"nestedModel\"\n }\n}\n\x00\x03\x00\x00x<\x00q\x00m\x00l\x00\v\x00\x12&\\\x00S\x00u\x00b\x00l\x00i\x00s\x00t\x00.\x00q\x00m\x00l\x00\a\x00:X\x9c\x00I\x00m\x00g\x00.\x00q\x00m\x00l\x00\f\x00K\xc3\\\x00S\x00o\x00n\x00g\x00E\x00d\x00i\x00t\x00.\x00q\x00m\x00l\x00\x0f\x00\xd2\f\\\x00f\x00i\x00l\x00e\x00D\x00i\x00a\x00l\x00o\x00g\x00s\x00.\x00q\x00m\x00l\x00\v\x02\x1eD\xdc\x00D\x00i\x00s\x00p\x00l\x00a\x00y\x00.\x00q\x00m\x00l\x00\b\b\x01^\\\x00M\x00a\x00i\x00n\x00.\x00q\x00m\x00l\x00\x15\b\x1e\x16f\x00q\x00t\x00q\x00u\x00i\x00c\x00k\x00c\x00o\x00n\x00t\x00r\x00o\x00l\x00s\x002\x00.\x00c\x00o\x00n\x00f\x00\b\f/a\x1c\x00C\x00e\x00l\x00l\x00.\x00q\x00m\x00l\x00\v\x0f'Ǽ\x00S\x00e\x00r\x00v\x00i\x00c\x00e\x00.\x00q\x00m\x00l\x00\x00\x00\x00\x00\x02\x00\x00\x00\x01\x00\x00\x00\x01\x00\x00\x00\x00\x00\x02\x00\x00\x00\t\x00\x00\x00\x02\x00\x00\x00\f\x00\x00\x00\x00\x00\x01\x00\x00\x00\x00\x00\x00\x00(\x00\x00\x00\x00\x00\x01\x00\x00\x02:\x00\x00\x00<\x00\x00\x00\x00\x00\x01\x00\x00\x04;\x00\x00\x00Z\x00\x00\x00\x00\x00\x01\x00\x00\"m\x00\x00\x00~\x00\x00\x00\x00\x00\x01\x00\x00#\\\x00\x00\x00\x9a\x00\x00\x00\x00\x00\x01\x00\x00$\xce\x00\x00\x00\xb0\x00\x00\x00\x00\x00\x01\x00\x007\x0e\x00\x00\x00\xe0\x00\x00\x00\x00\x00\x01\x00\x007,\x00\x00\x00\xf6\x00\x00\x00\x00\x00\x01\x00\x00D=" diff --git a/tst.qml b/tst.qml deleted file mode 100644 index 4969692..0000000 --- a/tst.qml +++ /dev/null @@ -1,173 +0,0 @@ -//https://gist.github.com/elpuri/3753756 -import QtQuick 2.4 -import QtQuick.Controls 1.3 - -ApplicationWindow { - id: app1 - minimumWidth: 200 - minimumHeight: 50 - - Item { - id: tst4 - height: 50 + ((tst3.count-1)*50) + (tst3.subCount * 40) - anchors.right: parent.right - anchors.rightMargin: 0 - anchors.left: parent.left - anchors.leftMargin: 0 - - - ListView { - id: tst3 - anchors.fill: parent - property int subCount: 0 - model: nestedModel - delegate: Component { - id: categoryDelegate - Column { - anchors.right: parent.right - anchors.left: parent.left - - //width: 200 - Rectangle { - id: categoryItem - anchors.right: parent.right - anchors.left: parent.left - border.color: "black" - border.width: 5 - color: "white" - height: 50 - - //width: 200 - Text { - anchors.verticalCenter: parent.verticalCenter - x: 15 - font.pixelSize: 24 - text: categoryName - } - - Rectangle { - color: "red" - width: 30 - height: 30 - anchors.right: parent.right - anchors.rightMargin: 15 - anchors.verticalCenter: parent.verticalCenter - - MouseArea { - anchors.fill: parent - - // Toggle the 'collapsed' property - onClicked: { - nestedModel.setProperty(index, "collapsed", !collapsed) - if (!nestedModel.get(index).collapsed) { - tst3.subCount = tst3.subCount + subItemLoader.subItemModel.count - } else { - tst3.subCount = tst3.subCount - subItemLoader.subItemModel.count - } - } - } - } - } - - Loader { - id: subItemLoader - - // This is a workaround for a bug/feature in the Loader element. If sourceComponent is set to null - // the Loader element retains the same height it had when sourceComponent was set. Setting visible - // to false makes the parent Column treat it as if it's height was 0. - visible: !collapsed - property variant subItemModel: subItems - sourceComponent: collapsed ? null : subItemColumnDelegate - onStatusChanged: if (status == Loader.Ready) - item.model = subItemModel - } - } - } - } - - Component { - id: subItemColumnDelegate - Column { - property alias model: subItemRepeater.model - - width: tst4.width - Repeater { - id: subItemRepeater - delegate: Rectangle { - color: "#cccccc" - height: 40 - anchors.right: parent.right - anchors.left: parent.left - //width: 200 - border.color: "black" - border.width: 2 - - Text { - anchors.verticalCenter: parent.verticalCenter - x: 30 - font.pixelSize: 18 - text: itemName - } - } - } - } - } - ListModel { - id: nestedModel - ListElement { - categoryName: "Cars" - collapsed: true - subItems: [ - ListElement { - itemName: "Nissan" - }, - ListElement { - itemName: "Toyota" - }, - ListElement { - itemName: "Chevy" - }, - ListElement { - itemName: "Audi" - } - ] - } - ListElement { - categoryName: "Cars" - collapsed: true - subItems: [ - ListElement { - itemName: "Nissan" - }, - ListElement { - itemName: "Toyota" - }, - ListElement { - itemName: "Chevy" - }, - ListElement { - itemName: "Audi" - } - ] - } - ListElement { - categoryName: "Cars" - collapsed: true - subItems: [ - ListElement { - itemName: "Nissan" - }, - ListElement { - itemName: "Toyota" - }, - ListElement { - itemName: "Chevy" - }, - ListElement { - itemName: "Audi" - } - ] - } - } - } -}