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

0001 import QtQuick 2.6
0002 import QtQuick.XmlListModel 2.0
0003 import QtQuick.Layouts 1.3
0004 import QtQuick.Controls 2.5
0005 
0006 
0007 ListView {
0008     id: listView
0009     spacing: 10
0010     width: parent.width
0011     Layout.fillHeight: true
0012     Layout.fillWidth: true
0013     clip: true
0014 
0015     model: recentProjects
0016     delegate: Column {
0017         id: delegateItem
0018         width: parent.width
0019         //width: delegateItem.ListView.view.width
0020         property string fullUri : modelData
0021         property int textHeight: 100
0022 
0023         spacing: 2
0024         Rectangle {
0025             width: delegateItem.width
0026             height: 50 //delegateItem.textHeight
0027 
0028             RowLayout {
0029                 anchors.fill: parent
0030                 spacing: 10
0031 
0032                 Image {
0033                     id: helperImage
0034                     source: helper.getProjectThumbnail(fullUri);
0035                     fillMode: Image.Stretch
0036                     sourceSize.width: 48
0037                     sourceSize.height: 60
0038                 }
0039 
0040                 Text{
0041                     width: parent.width - helperImage.width - parent.spacing
0042                     Layout.preferredWidth: parent.width - helperImage.width - parent.spacing
0043                     Layout.minimumWidth: parent.width - helperImage.width - parent.spacing
0044                     font.pointSize: 14
0045                     minimumPointSize: 1
0046                     fontSizeMode: Text.Fit
0047                     text: delegateItem.fullUri.substring(delegateItem.fullUri.lastIndexOf('/') +1, delegateItem.fullUri.length);
0048                     font.bold: true
0049                     verticalAlignment: Text.AlignVCenter
0050                     horizontalAlignment: Text.AlignHCenter
0051 
0052                     onPaintedHeightChanged: {
0053                         if( delegateItem.textHeight <  Math.max(paintedHeight + 2 + 2, 64)) {
0054                             delegateItem.textHeight = Math.max(paintedHeight + 2 + 2, 64)
0055                         }
0056                     }
0057 
0058                     Component.onCompleted: {
0059                         if( delegateItem.textHeight <  Math.max(paintedHeight + 2 + 2, 64)) {
0060                             delegateItem.textHeight = Math.max(paintedHeight + 2 + 2, 64)
0061                         }
0062                     }
0063                 }
0064             }
0065 
0066             MouseArea {
0067                 anchors.fill: parent
0068                 hoverEnabled: true
0069                 onEntered: {parent.color = '#fdffbf' }
0070                 onExited: {parent.color = '#ffffff'}
0071                 onClicked: {
0072                     if(recentProjectsFrame.fullScreen)
0073                         recentProjectsFrame.minimize()
0074                     mainWindow.recentProjectClicked(delegateItem.fullUri)
0075                 }
0076             }
0077         }
0078 
0079         Rectangle {
0080             height: 2
0081             width: delegateItem.width
0082             color: '#81827c'
0083         }
0084     }
0085 
0086     ScrollBar.vertical: ScrollBar { }
0087 }