• 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
ThumbnailsBase.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.okular 0.1 as Okular
22 import org.kde.plasma.components 0.1 as PlasmaComponents
23 import org.kde.plasma.core 0.1 as PlasmaCore
24 import org.kde.plasma.extras 0.1 as PlasmaExtras
25 import org.kde.plasma.mobilecomponents 0.1 as MobileComponents
26 
27 PlasmaComponents.Page {
28  id: root
29  property alias contentY: resultsGrid.contentY
30  property alias contentHeight: resultsGrid.contentHeight
31  property alias model: resultsGrid.model
32  signal pageClicked(int pageNumber)
33  property Item view: resultsGrid
34 
35  anchors.fill: parent
36 
37  PlasmaExtras.ScrollArea {
38  anchors.fill: parent
39 
40  GridView {
41  id: resultsGrid
42  anchors.fill: parent
43 
44  cellWidth: theme.defaultFont.mSize.width * 14
45  cellHeight: theme.defaultFont.mSize.height * 12
46 
47  delegate: Item {
48  width: resultsGrid.cellWidth
49  height: resultsGrid.cellHeight
50  property bool current: documentItem.currentPage == modelData
51  onCurrentChanged: {
52  if (current) {
53  resultsGrid.currentIndex = index
54  }
55  }
56  PlasmaCore.FrameSvgItem {
57  anchors.centerIn: parent
58  imagePath: "widgets/media-delegate"
59  prefix: "picture"
60  width: thumbnail.width + margins.left + margins.right
61  //FIXME: why bindings with thumbnail.height doesn't work?
62  height: thumbnail.height + margins.top + margins.bottom
63  Okular.ThumbnailItem {
64  id: thumbnail
65  x: parent.margins.left
66  y: parent.margins.top
67  document: documentItem
68  pageNumber: modelData
69  width: theme.defaultFont.mSize.width * 10
70  //value repeated to avoid binding loops
71  height: Math.round(theme.defaultFont.mSize.width * 10 / (implicitWidth/implicitHeight))
72  Rectangle {
73  width: childrenRect.width
74  height: childrenRect.height
75  color: theme.backgroundColor
76  radius: width
77  smooth: true
78  anchors {
79  bottom: parent.bottom
80  right: parent.right
81  }
82  PlasmaComponents.Label {
83  text: modelData + 1
84  }
85  }
86  }
87  MouseArea {
88  anchors.fill: parent
89  onClicked: {
90  resultsGrid.currentIndex = index
91  pageArea.delegate.pageNumber = modelData
92  documentItem.currentPage = modelData
93 
94  resourceBrowser.open = false
95  root.pageClicked(modelData)
96  }
97  }
98  }
99  }
100  highlight: PlasmaComponents.Highlight {}
101  }
102  }
103 }
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