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     --------------------------------------------------------------------
0005     Copyright            : (C) 2019 Ferencz Kovacs (kferike98@gmail.com)
0006     Description          : Grid containing example projects
0007  ***************************************************************************/
0008 
0009 /***************************************************************************
0010  *                                                                         *
0011  *  This program is free software; you can redistribute it and/or modify   *
0012  *  it under the terms of the GNU General Public License as published by   *
0013  *  the Free Software Foundation; either version 2 of the License, or      *
0014  *  (at your option) any later version.                                    *
0015  *                                                                         *
0016  *  This program is distributed in the hope that it will be useful,        *
0017  *  but WITHOUT ANY WARRANTY; without even the implied warranty of         *
0018  *  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the          *
0019  *  GNU General Public License for more details.                           *
0020  *                                                                         *
0021  *   You should have received a copy of the GNU General Public License     *
0022  *   along with this program; if not, write to the Free Software           *
0023  *   Foundation, Inc., 51 Franklin Street, Fifth Floor,                    *
0024  *   Boston, MA  02110-1301  USA                                           *
0025  *                                                                         *
0026  ***************************************************************************/
0027 import QtQuick 2.6
0028 import QtQuick.XmlListModel 2.0
0029 import QtQuick.Layouts 1.3
0030 import QtQuick.Controls 2.5
0031 
0032 GridView {
0033     id: exampleGrid
0034     Layout.fillHeight: true
0035     Layout.fillWidth: true
0036     cellWidth: width/4
0037     cellHeight: Math.min(height*0.9, 160)
0038     ScrollBar.vertical: ScrollBar{}
0039     clip: true
0040 
0041     model: helper.getExampleProjects();
0042     delegate: Rectangle {
0043         id: exampleDelegate
0044         property string name : modelData
0045         width: exampleGrid.cellWidth - 5
0046         height: exampleGrid.cellHeight - 5
0047 
0048         MouseArea {
0049             anchors.fill: parent
0050             hoverEnabled: true
0051             //onEntered: {exampleDelegate.color = '#fdffbf'}
0052             //onExited: {exampleDelegate.color = '#ffffff'}
0053             onClicked: {
0054                 if(exampleProjects.fullScreen)
0055                     exampleProjects.minimize()
0056                 mainWindow.openExampleProject(exampleDelegate.name)
0057             }
0058         }
0059 
0060         ColumnLayout {
0061             anchors.fill: parent
0062             //Layout.fillHeight: true
0063             //Layout.fillWidth: true
0064             spacing: 5
0065             Image {
0066                 id: exampleImage
0067                 source: helper.getExampleProjectThumbnail(name)
0068                 fillMode: Image.Stretch
0069                 sourceSize.width: Math.min(120, exampleDelegate.width)
0070                 sourceSize.height: Math.min(100, exampleDelegate.height * 0.6)
0071                 Layout.alignment: Qt.AlignHCenter
0072             }
0073 
0074             Text {
0075                 Layout.preferredWidth: parent.width
0076                 Layout.minimumWidth: parent.width
0077                 width: parent.width
0078                 Layout.preferredHeight:  exampleDelegate.height  * 0.15
0079                 Layout.minimumHeight:  exampleDelegate.height  * 0.15
0080                 height: exampleDelegate.height * 0.15
0081                 wrapMode: Text.WordWrap
0082                 text: exampleDelegate.name
0083                 font.pixelSize: 14
0084                 minimumPixelSize: 10
0085                 fontSizeMode: Text.Fit
0086                 font.bold: true
0087                 Layout.fillWidth: true
0088                 verticalAlignment: Text.AlignVCenter
0089                 horizontalAlignment: Text.AlignHCenter
0090             }
0091 
0092             Text {
0093                 Layout.preferredWidth: parent.width
0094                 Layout.minimumWidth: parent.width
0095                 width: parent.width
0096                 Layout.preferredHeight:  exampleDelegate.height  * 0.25
0097                 Layout.minimumHeight:  exampleDelegate.height  * 0.25
0098                 height: exampleDelegate.height * 0.25
0099                 wrapMode: Text.WordWrap
0100                 text: helper.getExampleProjectTags(exampleDelegate.name)
0101                 minimumPixelSize: 6
0102                 font.pixelSize: 12
0103                 fontSizeMode: Text.Fit
0104                 Layout.fillWidth: true
0105                 verticalAlignment: Text.AlignVCenter
0106                 horizontalAlignment: Text.AlignHCenter
0107             }
0108         }
0109     }
0110 }