• Skip to content
  • Skip to link menu
KDE API Reference
  • KDE API Reference
  • kdegraphics API Reference
  • KDE Home
  • Contact Us
 

okular

  • sources
  • kde-4.12
  • kdegraphics
  • okular
  • active
  • app
  • package
  • contents
  • ui
TreeDelegate.qml
Go to the documentation of this file.
1 /*
2  * Copyright 2012 Marco Martin <mart@kde.org>
3  *
4  * This program is free software; you can redistribute it and/or modify
5  * it under the terms of the GNU General Public License as
6  * published by the Free Software Foundation; either version 2,
7  * or (at your option) any later version.
8  *
9  * This program is distributed in the hope that it will be useful,
10  * but WITHOUT ANY WARRANTY; without even the implied warranty of
11  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
12  * GNU General Public License for more details
13  *
14  * You should have received a copy of the GNU General Public
15  * License along with this program; if not, write to the
16  * Free Software Foundation, Inc.,
17  * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
18  */
19 
20 import QtQuick 1.1
21 import org.kde.plasma.components 0.1 as PlasmaComponents
22 import org.kde.plasma.core 0.1 as PlasmaCore
23 import org.kde.qtextracomponents 0.1
24 
25 Column {
26  id: treeDelegate
27  property variant sourceModel
28  property int rowIndex: index
29  width: parent.width
30 
31  property bool matches: searchField.searchQuery.length < 3 || display.toLowerCase().indexOf(searchField.searchQuery.toLowerCase()) !== -1
32 
33 
34  MouseArea {
35  id: delegateArea
36  width: parent.width
37  height: label.height
38  opacity: matches ? 1 : 0
39  Behavior on opacity {
40  NumberAnimation {
41  duration: 250
42  }
43  }
44 
45 
46  onClicked: {
47  pageArea.delegate.pageNumber = page-1
48  documentItem.currentPage = page-1
49 
50  resourceBrowser.open = false
51  }
52 
53  QIconItem {
54  id: icon
55  icon: decoration
56  width: theme.smallIconSize
57  height: width
58  anchors.verticalCenter: parent.verticalCenter
59  }
60  PlasmaComponents.Label {
61  id: label
62  text: display
63  verticalAlignment: Text.AlignBottom
64  anchors.left: icon.right
65  }
66  //there isn't a sane way to do a dotted line in QML1
67  Rectangle {
68  color: theme.textColor
69  opacity: 0.1
70  height: 1
71  anchors {
72  bottom: parent.bottom
73  left: label.right
74  right: pageNumber.left
75  }
76  }
77  PlasmaComponents.Label {
78  id: pageNumber
79  text: pageLabel ? pageLabel : page
80  anchors.right: parent.right
81  verticalAlignment: Text.AlignBottom
82  anchors.rightMargin: 40
83  }
84  }
85  Column {
86  id: col
87  x: 20
88  width: parent.width - 20
89  property variant model: childrenModel
90  Repeater {
91  id: rep
92  model: VisualDataModel {
93  id: childrenModel
94  model: documentItem.tableOfContents
95  }
96  }
97  }
98  onParentChanged: {
99  if (treeDelegate.parent && treeDelegate.parent.model) {
100  sourceModel = treeDelegate.parent.model
101  }
102 
103  childrenModel.rootIndex = sourceModel.modelIndex(index)
104 
105  if (model.hasModelChildren) {
106  childrenModel.delegate = Qt.createComponent("TreeDelegate.qml")
107  }
108  }
109 }
Column
This file is part of the KDE documentation.
Documentation copyright © 1996-2014 The KDE developers.
Generated on Tue Oct 14 2014 22:45:03 by doxygen 1.8.7 written by Dimitri van Heesch, © 1997-2006

KDE's Doxygen guidelines are available online.

okular

Skip menu "okular"
  • Main Page
  • Namespace List
  • Namespace Members
  • Alphabetical List
  • Class List
  • Class Hierarchy
  • Class Members
  • File List
  • File Members
  • Related Pages

kdegraphics API Reference

Skip menu "kdegraphics API Reference"
  •     libkdcraw
  •     libkexiv2
  •     libkipi
  •     libksane
  • okular

Search



Report problems with this website to our bug tracking system.
Contact the specific authors with questions and comments about the page contents.

KDE® and the K Desktop Environment® logo are registered trademarks of KDE e.V. | Legal