WARNING: USE THIS SOFTWARE AT YOUR OWN RISK! THIS IS EXPERIMENTAL SOFTWARE NOT INTENDED FOR PRODUCTION USE! Zuble is currently an early stage prototype. As such Zuble is minimally tested and inherently unstable. It is provided for experimental, development, and demonstration purposes only. Zuble QML Types   |  Zuble C++ Classes   |  Zuble Overview
Zuble  0.1
Zuble Framework C++/QML extension API
ZTableColumnList.cpp
Go to the documentation of this file.
1 /*
2  * Zuble - A run-time system for QML/Javascript applications
3  * Copyright (C) 2016 Bob Dinitto
4  *
5  * Filename:
6  * Created on: 2/29/2016
7  * Author: Bob Dinitto
8  *
9  * Zuble is free software; you can redistribute it and/or
10  * modify it under the terms of the GNU Lesser General Public
11  * License as published by the Free Software Foundation; either
12  * version 2.1 of the License, or (at your option) any later version.
13  *
14  * This library is distributed in the hope that it will be useful,
15  * but WITHOUT ANY WARRANTY; without even the implied warranty of
16  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
17  * Lesser General Public License for more details.
18  *
19  * You should have received a copy of the GNU Lesser General Public
20  * License along with this library; if not, write to the Free Software
21  * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
22  *
23  */
24 
25 #include "ZTableColumnList.h"
26 #include <QtQml>
27 
28 namespace Zbl
29 
30 {
31 
32 ZTableColumnList::ZTableColumnList(QObject *parent) : QObject(parent)
33 {
34 
35 }
36 
38 {
39  qmlRegisterType<ZTableColumnList>("org.zuble.qml", 1, 0, "ZTableColumnList");
40 }
41 
42 
43 QQmlListProperty<Zbl::ZTableColumn> ZTableColumnList::getColumns()
44 {
45  return QQmlListProperty<Zbl::ZTableColumn>(this, NULL,
46  &append, &count, &at, &clear);
47 
48 }
49 
50 void ZTableColumnList::append(QQmlListProperty<ZTableColumn> *list, ZTableColumn *column)
51 {
52  ZTableColumnList* zColumns = qobject_cast<ZTableColumnList*>(list->object);
53 
54  if(column)
55  zColumns->m_columns.append(column);
56 }
57 
58 Zbl::ZTableColumn* ZTableColumnList::at(QQmlListProperty<ZTableColumn> *list, int index)
59 {
60  ZTableColumnList* zColumns = qobject_cast<ZTableColumnList*>(list->object);
61 
62  return zColumns->m_columns.at(index);
63 }
64 
65 void ZTableColumnList::clear(QQmlListProperty<ZTableColumn> *list)
66 {
67  ZTableColumnList* zColumns = qobject_cast<ZTableColumnList*>(list->object);
68 
69  zColumns->m_columns.clear();
70 }
71 
72 int ZTableColumnList::count(QQmlListProperty<ZTableColumn> *list)
73 {
74  ZTableColumnList* zColumns = qobject_cast<ZTableColumnList*>(list->object);
75 
76  return zColumns->m_columns.count();
77 
78 }
79 
80 
81 
82 } // Zbl
QQmlListProperty< Zbl::ZTableColumn > getColumns()
ZTableColumnList(QObject *parent=0)
QList< ZTableColumn * > m_columns
static void registerType()
Registers ZTableColumnList as a QML type.
static void append(QQmlListProperty< ZTableColumn > *list, ZTableColumn *column)
static ZTableColumn * at(QQmlListProperty< ZTableColumn > *list, int index)
Definition: ZAndGate.cpp:6
static void clear(QQmlListProperty< ZTableColumn > *list)
Defines a column in a ZTableView.
Definition: ZTableColumn.h:38
Defines columns in a ZTableView.
static int count(QQmlListProperty< ZTableColumn > *list)