Adding scrollbar to objects list

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

View file

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

View file

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