Adding scrollbar to objects list

This commit is contained in:
Adsooi 2022-02-01 17:33:36 +01:00
parent 3f107f1ba4
commit 1b5d0725c8
Signed by: Ad5001
GPG key ID: EF45F9C6AFE20160
3 changed files with 201 additions and 186 deletions

View file

@ -52,7 +52,7 @@ Column {
id: createBtn
width: parent.width/3
visible: Objects.types[modelData].createable()
height: visible ? width*0.6 : 0
height: visible ? width*0.8 : 0
// The KDE SDK is kinda buggy, so it respects neither specified color nor display propreties.
//display: AbstractButton.TextUnderIcon
@ -63,7 +63,7 @@ Column {
anchors.left: parent.left
anchors.leftMargin: (parent.width-width)/2
anchors.top: parent.top
anchors.topMargin: 8
anchors.topMargin: (label.y-height)/2
color: sysPalette.windowText
source: '../icons/objects/'+modelData+'.svg'
@ -80,6 +80,7 @@ Column {
horizontalAlignment: Text.AlignHCenter
font.pixelSize: 14
text: Objects.types[modelData].displayType()
wrapMode: Text.WordWrap
clip: true
}

View file

@ -34,22 +34,29 @@ import "../js/historylib.js" as HistoryLib
\sa LogarithmPlotter, ObjectCreationGrid, ObjectLists
*/
ListView {
ScrollView {
id: objectListList
signal changed()
property var listViews: {'':''} // Needs to be initialized or will be undefined -_-
ScrollBar.horizontal.visible: false
ScrollBar.vertical.visible: true
ListView {
id: objectsListView
model: Object.keys(Objects.types)
width: implicitWidth //objectListList.width - (implicitHeight > objectListList.parent.height ? 20 : 0)
implicitHeight: contentItem.childrenRect.height + footer.height + 10
delegate: ListView {
id: objTypeList
property string objType: objectListList.model[index]
property string objType: objectsListView.model[index]
property var editingRows: []
model: Objects.currentObjects[objType]
width: objectListList.width
width: objectsListView.width
implicitHeight: contentItem.childrenRect.height
visible: model != undefined && model.length > 0
interactive: false
@ -226,18 +233,19 @@ ListView {
}
}
// Object editor
EditorDialog {
id: objEditor
}
// Create items
footer: ObjectCreationGrid {
id: createRow
width: parent.width
width: objectsListView.width
objectEditor: objEditor
objectLists: objectListList
}
}
// Object editor
EditorDialog {
id: objEditor
}
/*!
\qmlmethod void ObjectLists::update()

View file

@ -36,13 +36,19 @@ Item {
Path of the icon image source.
*/
property alias source: img.source
/*!
\qmlproperty string Icon::source
Path of the icon image source.
*/
property alias sourceSize: img.sourceSize.width
Image {
id: img
height: parent.height
width: parent.width
smooth: true
//smooth: true
visible: false
sourceSize.height: sourceSize.width
}
ColorOverlay {
anchors.fill: img