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 #ifndef _ENABLE_QT_EXPERIMENTAL_
22 #error You should define _ENABLE_QT_EXPERIMENTAL_ in order to use this experimental header file.
23 #endif
24 
25 #include <unity/util/DefinesPtrs.h>
26 
27 #pragma GCC diagnostic push
28 #pragma GCC diagnostic ignored "-Wctor-dtor-privacy"
29 #include <QtCore/QVariant>
30 #pragma GCC diagnostic pop
31 #include <QtCore/QVector>
32 
33 namespace unity
34 {
35 
36 namespace scopes
37 {
38 
39 namespace qt
40 {
41 
42 namespace internal
43 {
44 class QColumnLayoutImpl;
45 class QPreviewReplyImpl;
46 }
47 
58 class QColumnLayout final
59 {
60 public:
62  UNITY_DEFINES_PTRS(QColumnLayout);
64 
70  explicit QColumnLayout(int num_of_columns);
71 
75  //{@
76  QColumnLayout(QColumnLayout const& other);
78  QColumnLayout& operator=(QColumnLayout const& other);
79  QColumnLayout& operator=(QColumnLayout&&);
81 
83  ~QColumnLayout();
85 
95  void add_column(QVector<QString> widget_ids);
96 
101  int size() const noexcept;
102 
107  int number_of_columns() const noexcept;
108 
115  QVector<QString> column(int index) const;
116 
118  QVariantMap serialize() const;
120 
121 private:
122  QColumnLayout(internal::QColumnLayoutImpl* impl);
124  std::unique_ptr<internal::QColumnLayoutImpl> p;
125  friend class internal::QColumnLayoutImpl;
126  friend class internal::QPreviewReplyImpl;
128 };
129 
134 typedef QList<QColumnLayout> QColumnLayoutList;
135 
136 } // namespace qt
137 
138 } // namespace scopes
139 
140 } // namespace unity
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:58