Unity Scopes API
QColumnLayout.h
1 /*
2  * Copyright (C) 2015 Canonical Ltd
3  *
4  * This program is free software: you can redistribute it and/or modify
5  * it under the terms of the GNU Lesser General Public License version 3 as
6  * published by the Free Software Foundation.
7  *
8  * This program is distributed in the hope that it will be useful,
9  * but WITHOUT ANY WARRANTY; without even the implied warranty of
10  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
11  * GNU Lesser General Public License for more details.
12  *
13  * You should have received a copy of the GNU Lesser General Public License
14  * along with this program. If not, see <http://www.gnu.org/licenses/>.
15  *
16  * Authored by: Xavi Garcia <xavi.garcia.mena@canonical.com>
17  */
18 
19 #pragma once
20 
21 #include <unity/util/DefinesPtrs.h>
22 
23 #include <QtCore/QVariant>
24 #include <QtCore/QVector>
25 
26 namespace unity
27 {
28 
29 namespace scopes
30 {
31 
32 namespace qt
33 {
34 
35 namespace internal
36 {
37 class QColumnLayoutImpl;
38 class QPreviewReplyImpl;
39 }
40 
51 class QColumnLayout final
52 {
53 public:
55  UNITY_DEFINES_PTRS(QColumnLayout);
57 
63  explicit QColumnLayout(int num_of_columns);
64 
68  //{@
69  QColumnLayout(QColumnLayout const& other);
71  QColumnLayout& operator=(QColumnLayout const& other);
72  QColumnLayout& operator=(QColumnLayout&&);
74 
76  ~QColumnLayout();
78 
88  void add_column(QVector<QString> widget_ids);
89 
94  int size() const noexcept;
95 
100  int number_of_columns() const noexcept;
101 
108  QVector<QString> column(int index) const;
109 
111  QVariantMap serialize() const;
113 
114 private:
115  QColumnLayout(internal::QColumnLayoutImpl* impl);
117  std::unique_ptr<internal::QColumnLayoutImpl> p;
118  friend class internal::QColumnLayoutImpl;
119  friend class internal::QPreviewReplyImpl;
121 };
122 
127 typedef QList<QColumnLayout> QColumnLayoutList;
128 
129 } // namespace qt
130 
131 } // namespace scopes
132 
133 } // namespace unity
Definition: HttpAsyncReader.h:45
int number_of_columns() const noexcept
Get the number of columns expected by this layout as specified in the constructor.
int size() const noexcept
Get the current number of columns in this layout.
Top-level namespace for all things Unity-related.
Definition: Version.h:49
QVector< QString > column(int index) const
Retrieve the list of widgets for given column.
Definition: ActionMetadata.h:31
void add_column(QVector< QString > widget_ids)
Adds a new column and assigns widgets to it.
QColumnLayout(int num_of_columns)
Creates a layout definition that expects num_of_columns columns to be added with ColumnLayout::add_co...
Represents a column layout.
Definition: QColumnLayout.h:51