Warning, /plasma-bigscreen/peertube-voice-application/ui/HighlightType.qml is written in an unsupported language. File is not indexed.
0001 /* 0002 * Copyright 2011 Daker Fernandes Pinheiro <dakerfp@gmail.com> 0003 * 0004 * This program is free software; you can redistribute it and/or modify 0005 * it under the terms of the GNU Library General Public License as 0006 * published by the Free Software Foundation; either version 2, or 0007 * (at your option) any later version. 0008 * 0009 * This program is distributed in the hope that it will be useful, 0010 * but WITHOUT ANY WARRANTY; without even the implied warranty of 0011 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 0012 * GNU General Public License for more details 0013 * 0014 * You should have received a copy of the GNU Library General Public 0015 * License along with this program; if not, write to the 0016 * Free Software Foundation, Inc., 0017 * 51 Franklin Street, Fifth Floor, Boston, MA 2.010-1301, USA. 0018 */ 0019 0020 import QtQuick 2.1 0021 import org.kde.plasma.core 2.0 as PlasmaCore 0022 0023 /** 0024 * Used to highlight an item of a list. to be used only as the "highlight" 0025 * property of the ListView and GridView primitive QML components (or their 0026 * derivates) 0027 * 0028 * Provides built-in animation of Behavior on opacity Easing.OutQuad for a 0029 * duration of 250 (defined in units.longDuration). 0030 * 0031 * (TODO, make optional? e.g. animate: false) 0032 * 0033 * @inherit QtQuick.Item 0034 */ 0035 Item { 0036 id: highlight 0037 0038 /** true if the user is hovering over the component */ 0039 //in the case we are the highlight of a listview, it follows the mouse, so hover = true 0040 property bool hover: ListView ? true : false 0041 0042 /** true if the mouse button is pressed over the component. */ 0043 property bool pressed: false 0044 width: ListView.view ? ListView.view.width : undefined 0045 property alias marginHints: background.margins; 0046 0047 Connections { 0048 target: highlight.ListView.view 0049 onCurrentIndexChanged: { 0050 if (highlight.ListView.view.currentIndex >= 0) { 0051 background.opacity = 1 0052 } else { 0053 background.opacity = 0 0054 } 0055 } 0056 } 0057 0058 Behavior on opacity { 0059 NumberAnimation { 0060 duration: units.longDuration 0061 easing.type: Easing.OutQuad 0062 } 0063 } 0064 0065 PlasmaCore.FrameSvgItem { 0066 id: background 0067 imagePath: "widgets/viewitem" 0068 prefix: { 0069 if (pressed) 0070 return hover ? "selected+hover" : "selected"; 0071 0072 if (hover) 0073 return "hover"; 0074 0075 return "normal"; 0076 } 0077 0078 Behavior on opacity { 0079 NumberAnimation { 0080 duration: units.longDuration 0081 easing.type: Easing.OutQuad 0082 } 0083 } 0084 0085 anchors { 0086 fill: parent 0087 //FIXME: breaks listviews and highlight item 0088 // topMargin: -background.margins.top 0089 // leftMargin: -background.margins.left 0090 // bottomMargin: -background.margins.bottom 0091 // rightMargin: -background.margins.right 0092 } 0093 } 0094 } 0095