Plasma

TabViewStyle.qml
1 /*
2  SPDX-FileCopyrightText: 2014 Marco Martin <[email protected]>
3 
4  SPDX-License-Identifier: LGPL-2.0-or-later
5 */
6 
7 import QtQuick 2.2
8 import QtQuick.Controls 1.2
9 import QtQuick.Controls.Private 1.0
10 import QtQuick.Controls.Styles 1.2 as QtQuickControlStyle
11 import org.kde.plasma.core 2.0 as PlasmaCore
12 import org.kde.plasma.components 2.0 as PlasmaComponents
13 
14 
15 QtQuickControlStyle.TabViewStyle {
16  tabsMovable: false
17 
18  tabsAlignment: Qt.AlignLeft
19 
20  tabOverlap: 1
21 
22  frameOverlap: 2
23 
25  property Component frame: Item {}
26 
27 
28  property Component tab: Item {
29  property int totalOverlap: tabOverlap * (control.count - 1)
30  property real maxTabWidth: control.count > 0 ? (styleData.availableWidth + totalOverlap) / control.count : 0
31 
32  implicitWidth: Math.round(Math.min(maxTabWidth, textitem.implicitWidth + 20))
33  implicitHeight: Math.round(textitem.implicitHeight + 10)
34 
35  PlasmaCore.FrameSvgItem {
36  anchors.fill: parent
37  opacity: styleData.selected ? 1 : (styleData.hovered ? 0.4 : 0)
38  imagePath: "widgets/tabbar"
39  prefix: control.tabPosition === Qt.TopEdge ? "north-active-tab" : "south-active-tab"
40  colorGroup: PlasmaCore.ColorScope.colorGroup
41  Behavior on opacity {
42  PropertyAnimation {
43  duration: units.longDuration
44  }
45  }
46  }
47 
48  PlasmaComponents.Label {
49  id: textitem
50  anchors.fill: parent
51  anchors.leftMargin: 4
52  anchors.rightMargin: 4
53  verticalAlignment: Text.AlignVCenter
54  horizontalAlignment: Text.AlignHCenter
55  text: styleData.title
56  elide: Text.ElideMiddle
57  }
58  }
59 
60  property Component leftCorner: null
61 
62  property Component rightCorner: null
63 
64  property Component tabBar: null
65 }
This file is part of the KDE documentation.
Documentation copyright © 1996-2021 The KDE developers.
Generated on Wed Jan 20 2021 22:44:25 by doxygen 1.8.11 written by Dimitri van Heesch, © 1997-2006

KDE's Doxygen guidelines are available online.