Warning, /frameworks/qqc2-desktop-style/org.kde.desktop/TabBar.qml is written in an unsupported language. File is not indexed.
0001 /* 0002 SPDX-FileCopyrightText: 2017 Marco Martin <mart@kde.org> 0003 SPDX-FileCopyrightText: 2017 The Qt Company Ltd. 0004 SPDX-FileCopyrightText: 2023 ivan tkachenko <me@ratijas.tk> 0005 0006 SPDX-License-Identifier: LGPL-3.0-only OR GPL-2.0-or-later 0007 */ 0008 0009 0010 import QtQuick 0011 import org.kde.kirigami as Kirigami 0012 import QtQuick.Templates as T 0013 import org.kde.qqc2desktopstyle.private as StylePrivate 0014 0015 T.TabBar { 0016 id: controlRoot 0017 0018 Kirigami.Theme.colorSet: Kirigami.Theme.Window 0019 Kirigami.Theme.inherit: false 0020 0021 //Some QStyles seem to not return sensible pixelmetrics here 0022 implicitWidth: Math.max(implicitBackgroundWidth + leftInset + rightInset, 0023 contentWidth + leftPadding + rightPadding, 0024 Kirigami.Units.gridUnit * 6) 0025 implicitHeight: Math.max(implicitBackgroundHeight + topInset + bottomInset, 0026 contentHeight + topPadding + bottomPadding) 0027 0028 spacing: 0 0029 0030 contentItem: ListView { 0031 implicitWidth: contentWidth 0032 // The binding to contentModel.count is such that it updates when the TabBar is populated on demand 0033 implicitHeight: controlRoot.contentModel.get(controlRoot.contentModel.count * 0).height 0034 0035 model: controlRoot.contentModel 0036 currentIndex: controlRoot.currentIndex 0037 0038 spacing: -styleItem.pixelMetric("tabOverlap") 0039 orientation: ListView.Horizontal 0040 boundsBehavior: Flickable.StopAtBounds 0041 flickableDirection: Flickable.AutoFlickIfNeeded 0042 snapMode: ListView.SnapToItem 0043 0044 highlightMoveDuration: 0 0045 highlightRangeMode: ListView.ApplyRange 0046 preferredHighlightBegin: 40 0047 preferredHighlightEnd: width - 40 0048 } 0049 0050 StylePrivate.StyleItem { 0051 id: styleItem 0052 control: controlRoot 0053 visible: false 0054 elementType: "tabframe" 0055 properties: { 0056 "orientation": controlRoot.position === T.TabBar.Header ? "Top" : "Bottom" 0057 } 0058 } 0059 0060 background: MouseArea { 0061 acceptedButtons: Qt.NoButton 0062 onWheel: { 0063 if (wheel.pixelDelta.y < 0 || wheel.angleDelta.y < 0) { 0064 controlRoot.currentIndex = Math.min(controlRoot.currentIndex + 1, controlRoot.contentModel.count - 1); 0065 } else { 0066 controlRoot.currentIndex = Math.max(controlRoot.currentIndex - 1, 0); 0067 } 0068 } 0069 } 0070 }