2012-10-02 09:12:39 +02:00
|
|
|
/****************************************************************************
|
2010-01-07 12:14:35 +01:00
|
|
|
**
|
2016-01-15 14:57:40 +01:00
|
|
|
** Copyright (C) 2016 The Qt Company Ltd.
|
|
|
|
|
** Contact: https://www.qt.io/licensing/
|
2010-01-07 12:14:35 +01:00
|
|
|
**
|
2012-10-02 09:12:39 +02:00
|
|
|
** This file is part of Qt Creator.
|
2010-01-07 12:14:35 +01:00
|
|
|
**
|
2012-10-02 09:12:39 +02:00
|
|
|
** Commercial License Usage
|
|
|
|
|
** Licensees holding valid commercial Qt licenses may use this file in
|
|
|
|
|
** accordance with the commercial license agreement provided with the
|
|
|
|
|
** Software or, alternatively, in accordance with the terms contained in
|
2016-01-15 14:57:40 +01:00
|
|
|
** a written agreement between you and The Qt Company. For licensing terms
|
|
|
|
|
** and conditions see https://www.qt.io/terms-conditions. For further
|
|
|
|
|
** information use the contact form at https://www.qt.io/contact-us.
|
2010-01-07 12:14:35 +01:00
|
|
|
**
|
2015-09-18 11:34:48 +02:00
|
|
|
** GNU General Public License Usage
|
|
|
|
|
** Alternatively, this file may be used under the terms of the GNU
|
2016-01-15 14:57:40 +01:00
|
|
|
** General Public License version 3 as published by the Free Software
|
|
|
|
|
** Foundation with exceptions as appearing in the file LICENSE.GPL3-EXCEPT
|
|
|
|
|
** included in the packaging of this file. Please review the following
|
|
|
|
|
** information to ensure the GNU General Public License requirements will
|
|
|
|
|
** be met: https://www.gnu.org/licenses/gpl-3.0.html.
|
2010-12-17 16:01:08 +01:00
|
|
|
**
|
2012-10-02 09:12:39 +02:00
|
|
|
****************************************************************************/
|
2010-01-07 12:14:35 +01:00
|
|
|
|
|
|
|
|
#ifndef COMPONENTVIEW_H
|
|
|
|
|
#define COMPONENTVIEW_H
|
|
|
|
|
|
|
|
|
|
#include <abstractview.h>
|
|
|
|
|
#include <modelnode.h>
|
|
|
|
|
|
|
|
|
|
#include <QStringList>
|
|
|
|
|
|
2010-02-16 15:13:57 +01:00
|
|
|
QT_BEGIN_NAMESPACE
|
2010-01-07 12:14:35 +01:00
|
|
|
class QStandardItemModel;
|
2013-01-23 12:31:22 +01:00
|
|
|
class QComboBox;
|
2010-02-16 15:13:57 +01:00
|
|
|
QT_END_NAMESPACE
|
2010-01-07 12:14:35 +01:00
|
|
|
|
|
|
|
|
namespace QmlDesigner {
|
|
|
|
|
|
2011-05-24 18:47:33 +02:00
|
|
|
class ComponentAction;
|
|
|
|
|
|
2010-01-07 12:14:35 +01:00
|
|
|
class ComponentView : public AbstractView
|
|
|
|
|
{
|
|
|
|
|
Q_OBJECT
|
|
|
|
|
|
|
|
|
|
public:
|
|
|
|
|
enum UserRoles
|
|
|
|
|
{
|
|
|
|
|
ModelNodeRole = Qt::UserRole
|
|
|
|
|
};
|
|
|
|
|
|
2013-01-23 12:31:22 +01:00
|
|
|
ComponentView(QObject *parent = 0);
|
2010-01-07 12:14:35 +01:00
|
|
|
|
2015-06-03 15:31:53 +02:00
|
|
|
void modelAttached(Model *model) override;
|
|
|
|
|
void modelAboutToBeDetached(Model *model) override;
|
2010-01-07 12:14:35 +01:00
|
|
|
|
2011-05-24 18:47:33 +02:00
|
|
|
ComponentAction *action();
|
|
|
|
|
|
2015-06-03 15:31:53 +02:00
|
|
|
void nodeCreated(const ModelNode &createdNode) override;
|
|
|
|
|
void nodeAboutToBeRemoved(const ModelNode &removedNode) override;
|
2013-03-08 11:27:23 +01:00
|
|
|
void nodeReparented(const ModelNode &node, const NodeAbstractProperty &newPropertyParent,
|
|
|
|
|
const NodeAbstractProperty &oldPropertyParent,
|
2015-06-03 15:31:53 +02:00
|
|
|
AbstractView::PropertyChangeFlags propertyChange) override;
|
|
|
|
|
void nodeIdChanged(const ModelNode& node, const QString& newId, const QString& oldId) override;
|
2010-01-07 12:14:35 +01:00
|
|
|
|
|
|
|
|
QStandardItemModel *standardItemModel() const;
|
|
|
|
|
|
|
|
|
|
ModelNode modelNode(int index) const;
|
|
|
|
|
|
2011-06-27 17:43:44 +02:00
|
|
|
void setComponentNode(const ModelNode &node);
|
2013-09-26 18:46:39 +02:00
|
|
|
void setComponentToMaster();
|
2011-06-27 17:43:44 +02:00
|
|
|
|
2010-01-07 12:14:35 +01:00
|
|
|
signals:
|
|
|
|
|
void componentListChanged(const QStringList &componentList);
|
|
|
|
|
|
|
|
|
|
private: //functions
|
|
|
|
|
void updateModel();
|
|
|
|
|
void searchForComponentAndAddToList(const ModelNode &node);
|
2011-05-24 18:47:33 +02:00
|
|
|
void searchForComponentAndRemoveFromList(const ModelNode &node);
|
2011-06-09 11:34:13 +02:00
|
|
|
void removeSingleNodeFromList(const ModelNode &node);
|
2013-10-16 18:02:31 +02:00
|
|
|
int indexForNode(const ModelNode &node) const;
|
|
|
|
|
int indexOfMaster() const;
|
|
|
|
|
bool hasMasterEntry() const;
|
|
|
|
|
bool hasEntryForNode(const ModelNode &node) const;
|
2013-09-26 18:46:39 +02:00
|
|
|
void addMasterDocument();
|
2013-10-16 18:02:31 +02:00
|
|
|
void removeMasterDocument();
|
|
|
|
|
QString descriptionForNode(const ModelNode &node) const;
|
|
|
|
|
void updateDescription(const ModelNode &node);
|
2010-01-07 12:14:35 +01:00
|
|
|
|
|
|
|
|
private:
|
|
|
|
|
QStandardItemModel *m_standardItemModel;
|
2011-05-24 18:47:33 +02:00
|
|
|
ComponentAction *m_componentAction;
|
2010-01-07 12:14:35 +01:00
|
|
|
};
|
|
|
|
|
|
|
|
|
|
} // namespace QmlDesigner
|
|
|
|
|
|
|
|
|
|
#endif // COMPONENTVIEW_H
|