~dholbach/ubuntu-rssreader-app/fix-paths

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
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
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
/*
  license GPL v3 ...........

  description of this file:
  a delegate for the ListView in the RssFeedDelegate, each delegate shows an item of a rss feed ;

  Architecture:
  Item
  {
    Column
    {
        UbuntuShape(for item title)
        {
            Label(title)
        }

        UbuntuShape(for item description)
        {
            Label(description)
        }
    }
  }
*/

import QtQuick 2.0
import Ubuntu.Components 0.1
import Ubuntu.Components.ListItems 0.1 as ListItem

Item {
    id: rss_item_delegate
//    width: 100
//    height: 62

    property string rss_title: ""
    property string rss_description: ""

    signal click()

    Column
    {
        spacing: units.gu(1)
        anchors.fill: parent

        /////////////////////////////////////////////////////            item for title
        UbuntuShape
        {
            id: item_title
            height: label_title.paintedHeight + units.gu(1)
            width: rss_item_delegate.width
            color: "orange"

            Label
            {
                id: label_title
                text: rss_title
                anchors.horizontalCenter: parent.horizontalCenter
                width: parent.width - units.gu(1)
                wrapMode: Text.WrapAtWordBoundaryOrAnywhere
                color: "black"
            }
        }

        /////////////////////////////////////////////////////            item for description
        UbuntuShape
        {
            id: item_description
            height: rss_item_delegate.height - item_title.height - units.gu(1)
            width: rss_item_delegate.width
            color: "lightblue"

//            TextArea
//            {
//                id: textarea_description
//                anchors.horizontalCenter: parent.horizontalCenter
//                width: parent.width/* - units.gu(1)*/
//                height: parent.height
//                text: rss_description
//                selectByMouse: false
//                activeFocusOnPress: false
//                contentWidth: parent.width
//                readOnly: true
//            }
            Label
            {
                id: textarea_description
                anchors.horizontalCenter: parent.horizontalCenter
                width: parent.width - units.gu(1)
                height: parent.height
                text: rss_description
                wrapMode: Text.WrapAtWordBoundaryOrAnywhere
                elide: Text.ElideRight
            }
        }
    }

//    MouseArea
//    {
//        anchors.fill: parent
//        onClicked:
//        {
//            click();
//        }
//    }
}