Kirigami2

templates/PageTab.qml
1 /*
2  * SPDX-FileCopyrightText: 2021 Carson Black <[email protected]>
3  *
4  * SPDX-License-Identifier: LGPL-2.0-or-later
5  */
6 
7 import QtQuick 2.12
8 import QtQuick.Layouts 1.12
9 import QtQuick.Controls 2.12 as QQC2
10 import org.kde.kirigami 2.12 as Kirigami
11 import "../../private" as Private
12 
13 // TODO?: refactor into abstractbutton
14 QQC2.Control {
15  id: control
16 
17  enum Presentation {
18  Normal,
19  Large
20  }
21 
22  property string title
23  property bool active
24 
25  property Private.ActionIconGroup icon: Private.ActionIconGroup {}
26  property int presentation: PageTab.Presentation.Normal
27  property bool vertical: false
28  property var progress // type: real?
29  property bool needsAttention: false
30 
31  activeFocusOnTab: true
32 
33  Accessible.name: control.title
34  Accessible.description: {
35  if (!!control.progress) {
36  if (control.active) {
37  //: Accessibility text for a page tab. Keep the text as concise as possible and don't use a percent sign.
38  return qsTr("Current page. Progress: %1 percent.").arg(Math.round(control.progress*100))
39  } else {
40  //: Accessibility text for a page tab. Keep the text as concise as possible.
41  return qsTr("Navigate to %1. Progress: %2 percent.").arg(control.title).arg(Math.round(control.progress*100))
42  }
43  } else {
44  if (control.active) {
45  //: Accessibility text for a page tab. Keep the text as concise as possible.
46  return qsTr("Current page.")
47  } else if (control.needsAttention) {
48  //: Accessibility text for a page tab that's requesting the user's attention. Keep the text as concise as possible.
49  return qsTr("Navigate to %1. Demanding attention.", control.title)
50  } else {
51  //: Accessibility text for a page tab that's requesting the user's attention. Keep the text as concise as possible.
52  return qsTr("Navigate to %1.", control.title)
53  }
54  }
55  }
56  Accessible.role: Accessible.PageTab
57  Accessible.focusable: true
58  Accessible.onPressAction: control.clicked()
59 
60  Keys.onPressed: event => {
61  if (event.key === Qt.Key_Enter || event.key === Qt.Key_Return) {
62  control.clicked()
63  }
64  }
65 }
AKONADI_CALENDAR_EXPORT KCalendarCore::Event::Ptr event(const Akonadi::Item &item)
This file is part of the KDE documentation.
Documentation copyright © 1996-2023 The KDE developers.
Generated on Wed Sep 27 2023 03:57:55 by doxygen 1.8.17 written by Dimitri van Heesch, © 1997-2006

KDE's Doxygen guidelines are available online.