/* * Copyright 2013 Canonical Ltd. * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU Lesser General Public License as published by * the Free Software Foundation; version 3. * * This program is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU Lesser General Public License for more details. * * You should have received a copy of the GNU Lesser General Public License * along with this program. If not, see . * * Author: Zsombor Egri */ #ifndef ULLAYOUTS_P_H #define ULLAYOUTS_P_H #include "ullayouts.h" #include #include "propertychanges_p.h" typedef QHash LaidOutItemsMap; typedef QHashIterator LaidOutItemsMapIterator; class ULItemLayout; class ULLayoutsPrivate : QQmlIncubator { Q_DECLARE_PUBLIC(ULLayouts) public: ULLayoutsPrivate(ULLayouts *qq); void validateConditionalLayouts(); void getLaidOutItems(QQuickItem *item); void updateLayout(); static void error(QObject *item, const QString &message); static void error(QObject *item, const QList &errors); static void warning(QObject *item, const QString &message); protected: // QQmlIncubator stuff void setInitialState(QObject *object) override; void statusChanged(Status status) override; private: ULLayouts *q_ptr; QList layouts; ChangeList changes; LaidOutItemsMap itemsToLayout; QQuickItem* currentLayoutItem; QQuickItem* previousLayoutItem; QQuickItem* contentItem; int currentLayoutIndex; bool ready:1; // callbacks for the "layouts" QQmlListProperty of ULLayouts static void append_layout(QQmlListProperty*, ULConditionalLayout*); #if QT_VERSION >= QT_VERSION_CHECK(6, 0, 0) static qsizetype count_layouts(QQmlListProperty*); static ULConditionalLayout *at_layout(QQmlListProperty*, qsizetype); #else static int count_layouts(QQmlListProperty*); static ULConditionalLayout *at_layout(QQmlListProperty*, int); #endif static void clear_layouts(QQmlListProperty*); void reLayout(); void reparentItems(); QList collectContainers(QQuickItem *fromItem); void reparentToItemLayout(LaidOutItemsMap &map, ULItemLayout *fragment); }; #endif // ULLAYOUTS_P_H