Warning, /plasma/discover/discover/qml/CarouselNavigationButtonsListViewAdapter.qml is written in an unsupported language. File is not indexed.
0001 /* 0002 * SPDX-FileCopyrightText: 2023 ivan tkachenko <me@ratijas.tk> 0003 * 0004 * SPDX-License-Identifier: LGPL-2.0-or-later 0005 */ 0006 0007 import QtQuick 0008 0009 /* 0010 * Helper component to integrate CarouselNavigationButtons with a ListView. 0011 */ 0012 CarouselNavigationButtons { 0013 id: root 0014 0015 required property ListView view 0016 0017 // We experimented with ListView::atXBeginning/atXEnd, but ultimately 0018 // binding on currentIndex provides smoother experience overall. 0019 0020 animated: { 0021 if (view) { 0022 // Zero duration is a trick used to reset currentIndex without animations 0023 return view.highlightMoveDuration !== 0; 0024 } else { 0025 return false; 0026 } 0027 } 0028 0029 atBeginning: { 0030 if (view) { 0031 return view.currentIndex === 0; 0032 } else { 0033 return false; 0034 } 0035 } 0036 0037 atEnd: { 0038 if (view) { 0039 return view.currentIndex === view.count - 1; 0040 } else { 0041 return false; 0042 } 0043 } 0044 0045 onDecrementCurrentIndex: { 0046 view.decrementCurrentIndex(); 0047 } 0048 onIncrementCurrentIndex: { 0049 view.incrementCurrentIndex(); 0050 } 0051 }