MauiKit Controls

tabview.h
1/*
2 * <one line to give the program's name and a brief idea of what it does.>
3 * Copyright (C) 2019 camilo <chiguitar@unal.edu.co>
4 *
5 * This program is free software: you can redistribute it and/or modify
6 * it under the terms of the GNU General Public License as published by
7 * the Free Software Foundation, either version 3 of the License, or
8 * (at your option) any later version.
9 *
10 * This program is distributed in the hope that it will be useful,
11 * but WITHOUT ANY WARRANTY; without even the implied warranty of
12 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
13 * GNU General Public License for more details.
14 *
15 * You should have received a copy of the GNU General Public License
16 * along with this program. If not, see <http://www.gnu.org/licenses/>.
17 */
18
19#pragma once
20
21#include <QObject>
22#include <QQmlEngine>
23
24/**
25 * @brief The TabViewInfo class.
26 * Groups the attached properties used for setting the data information for the TabView children views.
27 * @see TabView
28 * @see TabViewItem
29 *
30 * @code
31 * Item
32 * {
33 * Maui.TabVieInfo.tabTitle: "Tab1"
34 * Maui.TabViewInfo.tabIcon: "folder"
35 * }
36 * @endcode
37 */
38class TabViewInfo : public QObject
39{
41 QML_ELEMENT
42 QML_ATTACHED(AppView)
43 QML_UNCREATABLE("Cannot be created Controls")
44 /**
45 * The title for the tab view. Used in the tab button.
46 */
47 Q_PROPERTY(QString tabTitle READ tabTitle WRITE setTabTitle NOTIFY tabTitleChanged)
48
49 /**
50 * The text to be shown in the tool-tip when hovering over the tab button representing the view.
51 */
52 Q_PROPERTY(QString tabToolTipText READ tabToolTipText WRITE setTabToolTipText NOTIFY tabToolTipTextChanged)
53
54 /**
55 * The color to be used as an indicator in the tab button representing the view.
56 */
57 Q_PROPERTY(QString tabColor READ tabColor WRITE setTabColor NOTIFY tabColorChanged)
58
59 /**
60 * The icon to be used in the tab button representing the view.
61 */
62 Q_PROPERTY(QString tabIcon READ tabIcon WRITE setTabIcon NOTIFY tabIconChanged)
63
64public:
65 static TabViewInfo *qmlAttachedProperties(QObject *object)
66 {
67 Q_UNUSED(object)
68
69 return new TabViewInfo(object);
70 }
71
72 inline void setTabTitle(const QString &value)
73 {
74 if (value == m_tabTitle)
75 return;
76
77 m_tabTitle = value;
78 Q_EMIT tabTitleChanged();
79 }
80
81 inline void setTabToolTipText(const QString &value)
82 {
83 if (value == m_tabToolTipText)
84 return;
85
86 m_tabToolTipText = value;
87 Q_EMIT tabToolTipTextChanged();
88 }
89
90 inline void setTabColor(const QString &value)
91 {
92 if (value == m_tabColor)
93 return;
94
95 m_tabColor = value;
96 Q_EMIT tabColorChanged();
97 }
98
99 inline void setTabIcon(const QString &value)
100 {
101 if (value == m_tabIcon)
102 return;
103
104 m_tabIcon = value;
105 Q_EMIT tabIconChanged();
106 }
107
108 inline const QString tabTitle() const
109 {
110 return m_tabTitle;
111 }
112
113 inline const QString tabToolTipText() const
114 {
115 return m_tabToolTipText;
116 }
117
118 inline const QString tabColor() const
119 {
120 return m_tabColor;
121 }
122
123 inline const QString tabIcon() const
124 {
125 return m_tabIcon;
126 }
127
128private:
129 using QObject::QObject;
130
131 QString m_tabTitle;
132 QString m_tabToolTipText;
133 QString m_tabIcon;
134 QString m_tabColor;
135
137 void tabTitleChanged();
138 void tabToolTipTextChanged();
139 void tabColorChanged();
140 void tabIconChanged();
141};
142
143QML_DECLARE_TYPEINFO(TabViewInfo, QML_HAS_ATTACHED_PROPERTIES)
144
The AppView class.
Definition appview.h:42
The TabViewInfo class.
Definition tabview.h:39
QString tabIcon
The icon to be used in the tab button representing the view.
Definition tabview.h:62
QString tabToolTipText
The text to be shown in the tool-tip when hovering over the tab button representing the view.
Definition tabview.h:52
QML_ELEMENTQString tabTitle
The title for the tab view.
Definition tabview.h:47
QString tabColor
The color to be used as an indicator in the tab button representing the view.
Definition tabview.h:57
QObject(QObject *parent)
Q_EMITQ_EMIT
Q_OBJECTQ_OBJECT
Q_PROPERTY(...)
Q_SIGNALSQ_SIGNALS
This file is part of the KDE documentation.
Documentation copyright © 1996-2024 The KDE developers.
Generated on Fri May 17 2024 11:56:16 by doxygen 1.10.0 written by Dimitri van Heesch, © 1997-2006

KDE's Doxygen guidelines are available online.