Warning, /education/labplot/src/kdefrontend/welcomescreen/ExampleGrid.qml is written in an unsupported language. File is not indexed.

0001 /*
0002     File                 : ExampleGrid.qml
0003     Project              : LabPlot
0004     Description          : Grid containing example projects
0005     --------------------------------------------------------------------
0006     SPDX-FileCopyrightText: 2019 Ferencz Kovacs <kferike98@gmail.com>
0007 
0008     SPDX-License-Identifier: GPL-2.0-or-later
0009 */
0010 import QtQuick 2.6
0011 import QtQuick.XmlListModel 2.0
0012 import QtQuick.Layouts 1.3
0013 import QtQuick.Controls 2.5
0014 
0015 GridView {
0016     id: exampleGrid
0017     Layout.fillHeight: true
0018     Layout.fillWidth: true
0019     cellWidth: width/4
0020     cellHeight: Math.min(height*0.9, 160)
0021     ScrollBar.vertical: ScrollBar{}
0022     clip: true
0023 
0024     model: helper.getExampleProjects();
0025     delegate: Rectangle {
0026         id: exampleDelegate
0027         property string name : modelData
0028         width: exampleGrid.cellWidth - 5
0029         height: exampleGrid.cellHeight - 5
0030 
0031         MouseArea {
0032             anchors.fill: parent
0033             hoverEnabled: true
0034             //onEntered: {exampleDelegate.color = '#fdffbf'}
0035             //onExited: {exampleDelegate.color = '#ffffff'}
0036             onClicked: {
0037                 if(exampleProjects.fullScreen)
0038                     exampleProjects.minimize()
0039                 mainWindow.openExampleProject(exampleDelegate.name)
0040             }
0041         }
0042 
0043         ColumnLayout {
0044             anchors.fill: parent
0045             //Layout.fillHeight: true
0046             //Layout.fillWidth: true
0047             spacing: 5
0048             Image {
0049                 id: exampleImage
0050                 source: helper.getExampleProjectThumbnail(name)
0051                 fillMode: Image.Stretch
0052                 sourceSize.width: Math.min(120, exampleDelegate.width)
0053                 sourceSize.height: Math.min(100, exampleDelegate.height * 0.6)
0054                 Layout.alignment: Qt.AlignHCenter
0055             }
0056 
0057             Text {
0058                 Layout.preferredWidth: parent.width
0059                 Layout.minimumWidth: parent.width
0060                 width: parent.width
0061                 Layout.preferredHeight:  exampleDelegate.height  * 0.15
0062                 Layout.minimumHeight:  exampleDelegate.height  * 0.15
0063                 height: exampleDelegate.height * 0.15
0064                 wrapMode: Text.WordWrap
0065                 text: exampleDelegate.name
0066                 font.pixelSize: 14
0067                 minimumPixelSize: 10
0068                 fontSizeMode: Text.Fit
0069                 font.bold: true
0070                 Layout.fillWidth: true
0071                 verticalAlignment: Text.AlignVCenter
0072                 horizontalAlignment: Text.AlignHCenter
0073             }
0074 
0075             Text {
0076                 Layout.preferredWidth: parent.width
0077                 Layout.minimumWidth: parent.width
0078                 width: parent.width
0079                 Layout.preferredHeight:  exampleDelegate.height  * 0.25
0080                 Layout.minimumHeight:  exampleDelegate.height  * 0.25
0081                 height: exampleDelegate.height * 0.25
0082                 wrapMode: Text.WordWrap
0083                 text: helper.getExampleProjectTags(exampleDelegate.name)
0084                 minimumPixelSize: 6
0085                 font.pixelSize: 12
0086                 fontSizeMode: Text.Fit
0087                 Layout.fillWidth: true
0088                 verticalAlignment: Text.AlignVCenter
0089                 horizontalAlignment: Text.AlignHCenter
0090             }
0091         }
0092     }
0093 }