TabPhotos.qml 1.99 KB
Newer Older
Artem Sidyakin's avatar
Artem Sidyakin committed
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18
import QtQuick 2.11
import QtQuick.Layouts 1.11
import QtQuick.Controls 2.4
import Qt.labs.folderlistmodel 2.11

Item {
    RowLayout {
        anchors.fill: parent
        //anchors.topMargin: 15
        spacing: 0

        Rectangle {
            Layout.preferredWidth: parent.width * 0.3
            Layout.fillHeight: true

            ListView {
                id: files
                anchors.fill: parent
Artem Sidyakin's avatar
Artem Sidyakin committed
19
                //clip: true
Artem Sidyakin's avatar
Artem Sidyakin committed
20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60

                FolderListModel {
                    id: folderModel
                    folder: "file:" + basePath + "shots/"
                    nameFilters: ["*.jpg"]
                }

                model: folderModel
                delegate: ItemDelegate {
                    width: parent.width
                    text: model.fileName
                    font.pixelSize: 15
                    contentItem: Text {
                        text: parent.text
                        font: parent.font
                        elide: Text.ElideRight
                        horizontalAlignment: Text.AlignRight
                        verticalAlignment: Text.AlignVCenter
                        wrapMode: Text.Wrap
                    }

                    highlighted: ListView.isCurrentItem

                    onClicked: { files.currentIndex = model.index; }
                }
            }
        }

        Rectangle {
            Layout.fillWidth: true
            Layout.fillHeight: true
            color: "lightgray"

            Image {
                id: currentPhoto
                anchors.fill: parent
                anchors.margins: 20
                source: folderModel.get(files.currentIndex, "fileURL");
                fillMode: Image.PreserveAspectFit
                autoTransform: true
            }
61 62 63 64 65 66 67 68

            Image {
                anchors.fill: parent
                anchors.margins: 15
                source: "img/photo-frame.png"
                fillMode: Image.PreserveAspectFit
                autoTransform: true
            }
Artem Sidyakin's avatar
Artem Sidyakin committed
69 70 71
        }
    }
}