forked from qt-creator/qt-creator
QmlDesigner: Rename SingleCollection to CollectionDetails
* SingleCollectionModel is replaced by CollectionDetailsModel * SingleCollectionView is replaced by CollectionDetailsView Change-Id: Id3e7572b7b7d7e369684cde21b3cc6a34f819369 Reviewed-by: Miikka Heikkinen <miikka.heikkinen@qt.io> Reviewed-by: Mahmoud Badri <mahmoud.badri@qt.io>
This commit is contained in:
@@ -14,7 +14,7 @@ Item {
|
|||||||
|
|
||||||
property var rootView: CollectionEditorBackend.rootView
|
property var rootView: CollectionEditorBackend.rootView
|
||||||
property var model: CollectionEditorBackend.model
|
property var model: CollectionEditorBackend.model
|
||||||
property var singleCollectionModel: CollectionEditorBackend.singleCollectionModel
|
property var collectionDetailsModel: CollectionEditorBackend.collectionDetailsModel
|
||||||
|
|
||||||
function showWarning(title, message) {
|
function showWarning(title, message) {
|
||||||
warningDialog.title = title
|
warningDialog.title = title
|
||||||
@@ -142,8 +142,8 @@ Item {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
SingleCollectionView {
|
CollectionDetailsView {
|
||||||
model: root.singleCollectionModel
|
model: root.collectionDetailsModel
|
||||||
anchors {
|
anchors {
|
||||||
left: collectionsRect.right
|
left: collectionsRect.right
|
||||||
right: parent.right
|
right: parent.right
|
||||||
|
|||||||
@@ -822,12 +822,12 @@ extend_qtc_plugin(QmlDesigner
|
|||||||
SOURCES_PREFIX components/collectioneditor
|
SOURCES_PREFIX components/collectioneditor
|
||||||
SOURCES
|
SOURCES
|
||||||
collectiondetails.cpp collectiondetails.h
|
collectiondetails.cpp collectiondetails.h
|
||||||
|
collectiondetailsmodel.cpp collectiondetailsmodel.h
|
||||||
collectioneditorconstants.h
|
collectioneditorconstants.h
|
||||||
collectionlistmodel.cpp collectionlistmodel.h
|
collectionlistmodel.cpp collectionlistmodel.h
|
||||||
collectionsourcemodel.cpp collectionsourcemodel.h
|
collectionsourcemodel.cpp collectionsourcemodel.h
|
||||||
collectionview.cpp collectionview.h
|
collectionview.cpp collectionview.h
|
||||||
collectionwidget.cpp collectionwidget.h
|
collectionwidget.cpp collectionwidget.h
|
||||||
singlecollectionmodel.cpp singlecollectionmodel.h
|
|
||||||
)
|
)
|
||||||
|
|
||||||
extend_qtc_plugin(QmlDesigner
|
extend_qtc_plugin(QmlDesigner
|
||||||
|
|||||||
@@ -1,7 +1,7 @@
|
|||||||
// Copyright (C) 2023 The Qt Company Ltd.
|
// Copyright (C) 2023 The Qt Company Ltd.
|
||||||
// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR GPL-3.0-only WITH Qt-GPL-exception-1.0
|
// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR GPL-3.0-only WITH Qt-GPL-exception-1.0
|
||||||
|
|
||||||
#include "singlecollectionmodel.h"
|
#include "collectiondetailsmodel.h"
|
||||||
|
|
||||||
#include "collectioneditorconstants.h"
|
#include "collectioneditorconstants.h"
|
||||||
#include "modelnode.h"
|
#include "modelnode.h"
|
||||||
@@ -85,15 +85,15 @@ private:
|
|||||||
|
|
||||||
namespace QmlDesigner {
|
namespace QmlDesigner {
|
||||||
|
|
||||||
SingleCollectionModel::SingleCollectionModel(QObject *parent)
|
CollectionDetailsModel::CollectionDetailsModel(QObject *parent)
|
||||||
: QAbstractTableModel(parent)
|
: QAbstractTableModel(parent)
|
||||||
{
|
{
|
||||||
connect(this, &SingleCollectionModel::modelReset, this, &SingleCollectionModel::updateEmpty);
|
connect(this, &CollectionDetailsModel::modelReset, this, &CollectionDetailsModel::updateEmpty);
|
||||||
connect(this, &SingleCollectionModel::rowsInserted, this, &SingleCollectionModel::updateEmpty);
|
connect(this, &CollectionDetailsModel::rowsInserted, this, &CollectionDetailsModel::updateEmpty);
|
||||||
connect(this, &SingleCollectionModel::rowsRemoved, this, &SingleCollectionModel::updateEmpty);
|
connect(this, &CollectionDetailsModel::rowsRemoved, this, &CollectionDetailsModel::updateEmpty);
|
||||||
}
|
}
|
||||||
|
|
||||||
QHash<int, QByteArray> SingleCollectionModel::roleNames() const
|
QHash<int, QByteArray> CollectionDetailsModel::roleNames() const
|
||||||
{
|
{
|
||||||
static QHash<int, QByteArray> roles;
|
static QHash<int, QByteArray> roles;
|
||||||
if (roles.isEmpty()) {
|
if (roles.isEmpty()) {
|
||||||
@@ -104,17 +104,17 @@ QHash<int, QByteArray> SingleCollectionModel::roleNames() const
|
|||||||
return roles;
|
return roles;
|
||||||
}
|
}
|
||||||
|
|
||||||
int SingleCollectionModel::rowCount([[maybe_unused]] const QModelIndex &parent) const
|
int CollectionDetailsModel::rowCount([[maybe_unused]] const QModelIndex &parent) const
|
||||||
{
|
{
|
||||||
return m_currentCollection.rows();
|
return m_currentCollection.rows();
|
||||||
}
|
}
|
||||||
|
|
||||||
int SingleCollectionModel::columnCount([[maybe_unused]] const QModelIndex &parent) const
|
int CollectionDetailsModel::columnCount([[maybe_unused]] const QModelIndex &parent) const
|
||||||
{
|
{
|
||||||
return m_currentCollection.columns();
|
return m_currentCollection.columns();
|
||||||
}
|
}
|
||||||
|
|
||||||
QVariant SingleCollectionModel::data(const QModelIndex &index, int role) const
|
QVariant CollectionDetailsModel::data(const QModelIndex &index, int role) const
|
||||||
{
|
{
|
||||||
if (!index.isValid())
|
if (!index.isValid())
|
||||||
return {};
|
return {};
|
||||||
@@ -125,12 +125,12 @@ QVariant SingleCollectionModel::data(const QModelIndex &index, int role) const
|
|||||||
return m_currentCollection.data(index.row(), index.column());
|
return m_currentCollection.data(index.row(), index.column());
|
||||||
}
|
}
|
||||||
|
|
||||||
bool SingleCollectionModel::setData(const QModelIndex &, const QVariant &, int)
|
bool CollectionDetailsModel::setData(const QModelIndex &, const QVariant &, int)
|
||||||
{
|
{
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
bool SingleCollectionModel::setHeaderData(int section,
|
bool CollectionDetailsModel::setHeaderData(int section,
|
||||||
Qt::Orientation orientation,
|
Qt::Orientation orientation,
|
||||||
const QVariant &value,
|
const QVariant &value,
|
||||||
[[maybe_unused]] int role)
|
[[maybe_unused]] int role)
|
||||||
@@ -145,7 +145,7 @@ bool SingleCollectionModel::setHeaderData(int section,
|
|||||||
return headerChanged;
|
return headerChanged;
|
||||||
}
|
}
|
||||||
|
|
||||||
bool SingleCollectionModel::insertRows(int row, int count, const QModelIndex &parent)
|
bool CollectionDetailsModel::insertRows(int row, int count, const QModelIndex &parent)
|
||||||
{
|
{
|
||||||
if (count < 1)
|
if (count < 1)
|
||||||
return false;
|
return false;
|
||||||
@@ -158,7 +158,7 @@ bool SingleCollectionModel::insertRows(int row, int count, const QModelIndex &pa
|
|||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
bool SingleCollectionModel::removeColumns(int column, int count, const QModelIndex &parent)
|
bool CollectionDetailsModel::removeColumns(int column, int count, const QModelIndex &parent)
|
||||||
{
|
{
|
||||||
if (column < 0 || column >= columnCount(parent) || count < 1)
|
if (column < 0 || column >= columnCount(parent) || count < 1)
|
||||||
return false;
|
return false;
|
||||||
@@ -171,7 +171,7 @@ bool SingleCollectionModel::removeColumns(int column, int count, const QModelInd
|
|||||||
return columnsRemoved;
|
return columnsRemoved;
|
||||||
}
|
}
|
||||||
|
|
||||||
bool SingleCollectionModel::removeRows(int row, int count, const QModelIndex &parent)
|
bool CollectionDetailsModel::removeRows(int row, int count, const QModelIndex &parent)
|
||||||
{
|
{
|
||||||
if (row < 0 || row >= rowCount(parent) || count < 1)
|
if (row < 0 || row >= rowCount(parent) || count < 1)
|
||||||
return false;
|
return false;
|
||||||
@@ -184,7 +184,7 @@ bool SingleCollectionModel::removeRows(int row, int count, const QModelIndex &pa
|
|||||||
return rowsRemoved;
|
return rowsRemoved;
|
||||||
}
|
}
|
||||||
|
|
||||||
Qt::ItemFlags SingleCollectionModel::flags(const QModelIndex &index) const
|
Qt::ItemFlags CollectionDetailsModel::flags(const QModelIndex &index) const
|
||||||
{
|
{
|
||||||
if (!index.isValid())
|
if (!index.isValid())
|
||||||
return {};
|
return {};
|
||||||
@@ -192,7 +192,7 @@ Qt::ItemFlags SingleCollectionModel::flags(const QModelIndex &index) const
|
|||||||
return {Qt::ItemIsSelectable | Qt::ItemIsEnabled};
|
return {Qt::ItemIsSelectable | Qt::ItemIsEnabled};
|
||||||
}
|
}
|
||||||
|
|
||||||
QVariant SingleCollectionModel::headerData(int section, Qt::Orientation orientation, int role) const
|
QVariant CollectionDetailsModel::headerData(int section, Qt::Orientation orientation, int role) const
|
||||||
{
|
{
|
||||||
if (orientation == Qt::Horizontal) {
|
if (orientation == Qt::Horizontal) {
|
||||||
if (role == DataTypeRole) {
|
if (role == DataTypeRole) {
|
||||||
@@ -212,32 +212,32 @@ QVariant SingleCollectionModel::headerData(int section, Qt::Orientation orientat
|
|||||||
return {};
|
return {};
|
||||||
}
|
}
|
||||||
|
|
||||||
int SingleCollectionModel::selectedColumn() const
|
int CollectionDetailsModel::selectedColumn() const
|
||||||
{
|
{
|
||||||
return m_selectedColumn;
|
return m_selectedColumn;
|
||||||
}
|
}
|
||||||
|
|
||||||
int SingleCollectionModel::selectedRow() const
|
int CollectionDetailsModel::selectedRow() const
|
||||||
{
|
{
|
||||||
return m_selectedRow;
|
return m_selectedRow;
|
||||||
}
|
}
|
||||||
|
|
||||||
QString SingleCollectionModel::propertyName(int column) const
|
QString CollectionDetailsModel::propertyName(int column) const
|
||||||
{
|
{
|
||||||
return m_currentCollection.propertyAt(column);
|
return m_currentCollection.propertyAt(column);
|
||||||
}
|
}
|
||||||
|
|
||||||
QString SingleCollectionModel::propertyType(int column) const
|
QString CollectionDetailsModel::propertyType(int column) const
|
||||||
{
|
{
|
||||||
return CollectionDataTypeHelper::typeToString(m_currentCollection.typeAt(column));
|
return CollectionDataTypeHelper::typeToString(m_currentCollection.typeAt(column));
|
||||||
}
|
}
|
||||||
|
|
||||||
bool SingleCollectionModel::isPropertyAvailable(const QString &name)
|
bool CollectionDetailsModel::isPropertyAvailable(const QString &name)
|
||||||
{
|
{
|
||||||
return m_currentCollection.containsPropertyName(name);
|
return m_currentCollection.containsPropertyName(name);
|
||||||
}
|
}
|
||||||
|
|
||||||
bool SingleCollectionModel::addColumn(int column, const QString &name)
|
bool CollectionDetailsModel::addColumn(int column, const QString &name)
|
||||||
{
|
{
|
||||||
if (m_currentCollection.containsPropertyName(name))
|
if (m_currentCollection.containsPropertyName(name))
|
||||||
return false;
|
return false;
|
||||||
@@ -251,7 +251,7 @@ bool SingleCollectionModel::addColumn(int column, const QString &name)
|
|||||||
return m_currentCollection.containsPropertyName(name);
|
return m_currentCollection.containsPropertyName(name);
|
||||||
}
|
}
|
||||||
|
|
||||||
bool SingleCollectionModel::selectColumn(int section)
|
bool CollectionDetailsModel::selectColumn(int section)
|
||||||
{
|
{
|
||||||
if (m_selectedColumn == section)
|
if (m_selectedColumn == section)
|
||||||
return false;
|
return false;
|
||||||
@@ -283,12 +283,12 @@ bool SingleCollectionModel::selectColumn(int section)
|
|||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
bool SingleCollectionModel::renameColumn(int section, const QString &newValue)
|
bool CollectionDetailsModel::renameColumn(int section, const QString &newValue)
|
||||||
{
|
{
|
||||||
return setHeaderData(section, Qt::Horizontal, newValue);
|
return setHeaderData(section, Qt::Horizontal, newValue);
|
||||||
}
|
}
|
||||||
|
|
||||||
bool SingleCollectionModel::setPropertyType(int column, const QString &newValue, bool force)
|
bool CollectionDetailsModel::setPropertyType(int column, const QString &newValue, bool force)
|
||||||
{
|
{
|
||||||
bool changed = m_currentCollection.forcePropertyType(column,
|
bool changed = m_currentCollection.forcePropertyType(column,
|
||||||
CollectionDataTypeHelper::typeFromString(
|
CollectionDataTypeHelper::typeFromString(
|
||||||
@@ -307,7 +307,7 @@ bool SingleCollectionModel::setPropertyType(int column, const QString &newValue,
|
|||||||
return changed;
|
return changed;
|
||||||
}
|
}
|
||||||
|
|
||||||
bool SingleCollectionModel::selectRow(int row)
|
bool CollectionDetailsModel::selectRow(int row)
|
||||||
{
|
{
|
||||||
if (m_selectedRow == row)
|
if (m_selectedRow == row)
|
||||||
return false;
|
return false;
|
||||||
@@ -336,18 +336,18 @@ bool SingleCollectionModel::selectRow(int row)
|
|||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
void SingleCollectionModel::deselectAll()
|
void CollectionDetailsModel::deselectAll()
|
||||||
{
|
{
|
||||||
selectColumn(-1);
|
selectColumn(-1);
|
||||||
selectRow(-1);
|
selectRow(-1);
|
||||||
}
|
}
|
||||||
|
|
||||||
QStringList SingleCollectionModel::typesList()
|
QStringList CollectionDetailsModel::typesList()
|
||||||
{
|
{
|
||||||
return CollectionDataTypeHelper::typesStringList();
|
return CollectionDataTypeHelper::typesStringList();
|
||||||
}
|
}
|
||||||
|
|
||||||
void SingleCollectionModel::loadCollection(const ModelNode &sourceNode, const QString &collection)
|
void CollectionDetailsModel::loadCollection(const ModelNode &sourceNode, const QString &collection)
|
||||||
{
|
{
|
||||||
QString fileName = sourceNode.variantProperty(CollectionEditor::SOURCEFILE_PROPERTY).value().toString();
|
QString fileName = sourceNode.variantProperty(CollectionEditor::SOURCEFILE_PROPERTY).value().toString();
|
||||||
|
|
||||||
@@ -371,7 +371,7 @@ void SingleCollectionModel::loadCollection(const ModelNode &sourceNode, const QS
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
void SingleCollectionModel::updateEmpty()
|
void CollectionDetailsModel::updateEmpty()
|
||||||
{
|
{
|
||||||
bool isEmptyNow = rowCount() == 0;
|
bool isEmptyNow = rowCount() == 0;
|
||||||
if (m_isEmpty != isEmptyNow) {
|
if (m_isEmpty != isEmptyNow) {
|
||||||
@@ -380,7 +380,7 @@ void SingleCollectionModel::updateEmpty()
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
void SingleCollectionModel::switchToCollection(const CollectionReference &collection)
|
void CollectionDetailsModel::switchToCollection(const CollectionReference &collection)
|
||||||
{
|
{
|
||||||
if (m_currentCollection.reference() == collection)
|
if (m_currentCollection.reference() == collection)
|
||||||
return;
|
return;
|
||||||
@@ -395,7 +395,7 @@ void SingleCollectionModel::switchToCollection(const CollectionReference &collec
|
|||||||
setCollectionName(collection.name);
|
setCollectionName(collection.name);
|
||||||
}
|
}
|
||||||
|
|
||||||
void SingleCollectionModel::closeCollectionIfSaved(const CollectionReference &collection)
|
void CollectionDetailsModel::closeCollectionIfSaved(const CollectionReference &collection)
|
||||||
{
|
{
|
||||||
if (!m_openedCollections.contains(collection))
|
if (!m_openedCollections.contains(collection))
|
||||||
return;
|
return;
|
||||||
@@ -408,13 +408,13 @@ void SingleCollectionModel::closeCollectionIfSaved(const CollectionReference &co
|
|||||||
m_currentCollection = CollectionDetails{};
|
m_currentCollection = CollectionDetails{};
|
||||||
}
|
}
|
||||||
|
|
||||||
void SingleCollectionModel::closeCurrentCollectionIfSaved()
|
void CollectionDetailsModel::closeCurrentCollectionIfSaved()
|
||||||
{
|
{
|
||||||
if (m_currentCollection.isValid())
|
if (m_currentCollection.isValid())
|
||||||
closeCollectionIfSaved(m_currentCollection.reference());
|
closeCollectionIfSaved(m_currentCollection.reference());
|
||||||
}
|
}
|
||||||
|
|
||||||
void SingleCollectionModel::loadJsonCollection(const QString &source, const QString &collection)
|
void CollectionDetailsModel::loadJsonCollection(const QString &source, const QString &collection)
|
||||||
{
|
{
|
||||||
using CollectionEditor::SourceFormat;
|
using CollectionEditor::SourceFormat;
|
||||||
|
|
||||||
@@ -459,7 +459,7 @@ void SingleCollectionModel::loadJsonCollection(const QString &source, const QStr
|
|||||||
endResetModel();
|
endResetModel();
|
||||||
}
|
}
|
||||||
|
|
||||||
void SingleCollectionModel::loadCsvCollection(const QString &source,
|
void CollectionDetailsModel::loadCsvCollection(const QString &source,
|
||||||
[[maybe_unused]] const QString &collectionName)
|
[[maybe_unused]] const QString &collectionName)
|
||||||
{
|
{
|
||||||
using CollectionEditor::SourceFormat;
|
using CollectionEditor::SourceFormat;
|
||||||
@@ -498,7 +498,7 @@ void SingleCollectionModel::loadCsvCollection(const QString &source,
|
|||||||
endResetModel();
|
endResetModel();
|
||||||
}
|
}
|
||||||
|
|
||||||
void SingleCollectionModel::setCollectionName(const QString &newCollectionName)
|
void CollectionDetailsModel::setCollectionName(const QString &newCollectionName)
|
||||||
{
|
{
|
||||||
if (m_collectionName != newCollectionName) {
|
if (m_collectionName != newCollectionName) {
|
||||||
m_collectionName = newCollectionName;
|
m_collectionName = newCollectionName;
|
||||||
@@ -506,7 +506,7 @@ void SingleCollectionModel::setCollectionName(const QString &newCollectionName)
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
bool SingleCollectionModel::saveCollectionAsJson(const QString &collection, const QJsonArray &content, const QString &source)
|
bool CollectionDetailsModel::saveCollectionAsJson(const QString &collection, const QJsonArray &content, const QString &source)
|
||||||
{
|
{
|
||||||
QFile sourceFile(source);
|
QFile sourceFile(source);
|
||||||
if (sourceFile.open(QFile::ReadWrite)) {
|
if (sourceFile.open(QFile::ReadWrite)) {
|
||||||
@@ -527,7 +527,7 @@ bool SingleCollectionModel::saveCollectionAsJson(const QString &collection, cons
|
|||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
bool SingleCollectionModel::saveCollectionAsCsv(const QString &path, const QString &content)
|
bool CollectionDetailsModel::saveCollectionAsCsv(const QString &path, const QString &content)
|
||||||
{
|
{
|
||||||
QFile file(path);
|
QFile file(path);
|
||||||
|
|
||||||
@@ -12,7 +12,7 @@ namespace QmlDesigner {
|
|||||||
|
|
||||||
class ModelNode;
|
class ModelNode;
|
||||||
|
|
||||||
class SingleCollectionModel : public QAbstractTableModel
|
class CollectionDetailsModel : public QAbstractTableModel
|
||||||
{
|
{
|
||||||
Q_OBJECT
|
Q_OBJECT
|
||||||
|
|
||||||
@@ -24,7 +24,7 @@ class SingleCollectionModel : public QAbstractTableModel
|
|||||||
public:
|
public:
|
||||||
enum DataRoles { SelectedRole = Qt::UserRole + 1, DataTypeRole };
|
enum DataRoles { SelectedRole = Qt::UserRole + 1, DataTypeRole };
|
||||||
|
|
||||||
explicit SingleCollectionModel(QObject *parent = nullptr);
|
explicit CollectionDetailsModel(QObject *parent = nullptr);
|
||||||
|
|
||||||
QHash<int, QByteArray> roleNames() const override;
|
QHash<int, QByteArray> roleNames() const override;
|
||||||
int rowCount(const QModelIndex &parent = {}) const override;
|
int rowCount(const QModelIndex &parent = {}) const override;
|
||||||
@@ -3,6 +3,7 @@
|
|||||||
|
|
||||||
#include "collectionview.h"
|
#include "collectionview.h"
|
||||||
|
|
||||||
|
#include "collectiondetailsmodel.h"
|
||||||
#include "collectioneditorconstants.h"
|
#include "collectioneditorconstants.h"
|
||||||
#include "collectionsourcemodel.h"
|
#include "collectionsourcemodel.h"
|
||||||
#include "collectionwidget.h"
|
#include "collectionwidget.h"
|
||||||
@@ -10,7 +11,6 @@
|
|||||||
#include "nodeabstractproperty.h"
|
#include "nodeabstractproperty.h"
|
||||||
#include "nodemetainfo.h"
|
#include "nodemetainfo.h"
|
||||||
#include "qmldesignerplugin.h"
|
#include "qmldesignerplugin.h"
|
||||||
#include "singlecollectionmodel.h"
|
|
||||||
#include "variantproperty.h"
|
#include "variantproperty.h"
|
||||||
|
|
||||||
#include <QJsonArray>
|
#include <QJsonArray>
|
||||||
@@ -55,7 +55,7 @@ QmlDesigner::WidgetInfo CollectionView::widgetInfo()
|
|||||||
&CollectionSourceModel::collectionSelected,
|
&CollectionSourceModel::collectionSelected,
|
||||||
this,
|
this,
|
||||||
[this](const ModelNode &sourceNode, const QString &collection) {
|
[this](const ModelNode &sourceNode, const QString &collection) {
|
||||||
m_widget->singleCollectionModel()->loadCollection(sourceNode, collection);
|
m_widget->collectionDetailsModel()->loadCollection(sourceNode, collection);
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -2,11 +2,12 @@
|
|||||||
// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR GPL-3.0-only WITH Qt-GPL-exception-1.0
|
// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR GPL-3.0-only WITH Qt-GPL-exception-1.0
|
||||||
|
|
||||||
#include "collectionwidget.h"
|
#include "collectionwidget.h"
|
||||||
|
|
||||||
|
#include "collectiondetailsmodel.h"
|
||||||
#include "collectionsourcemodel.h"
|
#include "collectionsourcemodel.h"
|
||||||
#include "collectionview.h"
|
#include "collectionview.h"
|
||||||
#include "qmldesignerconstants.h"
|
#include "qmldesignerconstants.h"
|
||||||
#include "qmldesignerplugin.h"
|
#include "qmldesignerplugin.h"
|
||||||
#include "singlecollectionmodel.h"
|
|
||||||
#include "theme.h"
|
#include "theme.h"
|
||||||
|
|
||||||
#include <studioquickwidget.h>
|
#include <studioquickwidget.h>
|
||||||
@@ -38,7 +39,7 @@ CollectionWidget::CollectionWidget(CollectionView *view)
|
|||||||
: QFrame()
|
: QFrame()
|
||||||
, m_view(view)
|
, m_view(view)
|
||||||
, m_sourceModel(new CollectionSourceModel)
|
, m_sourceModel(new CollectionSourceModel)
|
||||||
, m_singleCollectionModel(new SingleCollectionModel)
|
, m_collectionDetailsModel(new CollectionDetailsModel)
|
||||||
, m_quickWidget(new StudioQuickWidget(this))
|
, m_quickWidget(new StudioQuickWidget(this))
|
||||||
{
|
{
|
||||||
setWindowTitle(tr("Collection View", "Title of collection view widget"));
|
setWindowTitle(tr("Collection View", "Title of collection view widget"));
|
||||||
@@ -67,7 +68,7 @@ CollectionWidget::CollectionWidget(CollectionView *view)
|
|||||||
map->setProperties(
|
map->setProperties(
|
||||||
{{"rootView", QVariant::fromValue(this)},
|
{{"rootView", QVariant::fromValue(this)},
|
||||||
{"model", QVariant::fromValue(m_sourceModel.data())},
|
{"model", QVariant::fromValue(m_sourceModel.data())},
|
||||||
{"singleCollectionModel", QVariant::fromValue(m_singleCollectionModel.data())}});
|
{"collectionDetailsModel", QVariant::fromValue(m_collectionDetailsModel.data())}});
|
||||||
|
|
||||||
auto hotReloadShortcut = new QShortcut(QKeySequence(Qt::CTRL + Qt::Key_F4), this);
|
auto hotReloadShortcut = new QShortcut(QKeySequence(Qt::CTRL + Qt::Key_F4), this);
|
||||||
connect(hotReloadShortcut, &QShortcut::activated, this, &CollectionWidget::reloadQmlSource);
|
connect(hotReloadShortcut, &QShortcut::activated, this, &CollectionWidget::reloadQmlSource);
|
||||||
@@ -88,9 +89,9 @@ QPointer<CollectionSourceModel> CollectionWidget::sourceModel() const
|
|||||||
return m_sourceModel;
|
return m_sourceModel;
|
||||||
}
|
}
|
||||||
|
|
||||||
QPointer<SingleCollectionModel> CollectionWidget::singleCollectionModel() const
|
QPointer<CollectionDetailsModel> CollectionWidget::collectionDetailsModel() const
|
||||||
{
|
{
|
||||||
return m_singleCollectionModel;
|
return m_collectionDetailsModel;
|
||||||
}
|
}
|
||||||
|
|
||||||
void CollectionWidget::reloadQmlSource()
|
void CollectionWidget::reloadQmlSource()
|
||||||
|
|||||||
@@ -11,9 +11,9 @@ class StudioQuickWidget;
|
|||||||
|
|
||||||
namespace QmlDesigner {
|
namespace QmlDesigner {
|
||||||
|
|
||||||
|
class CollectionDetailsModel;
|
||||||
class CollectionSourceModel;
|
class CollectionSourceModel;
|
||||||
class CollectionView;
|
class CollectionView;
|
||||||
class SingleCollectionModel;
|
|
||||||
|
|
||||||
class CollectionWidget : public QFrame
|
class CollectionWidget : public QFrame
|
||||||
{
|
{
|
||||||
@@ -24,7 +24,7 @@ public:
|
|||||||
void contextHelp(const Core::IContext::HelpCallback &callback) const;
|
void contextHelp(const Core::IContext::HelpCallback &callback) const;
|
||||||
|
|
||||||
QPointer<CollectionSourceModel> sourceModel() const;
|
QPointer<CollectionSourceModel> sourceModel() const;
|
||||||
QPointer<SingleCollectionModel> singleCollectionModel() const;
|
QPointer<CollectionDetailsModel> collectionDetailsModel() const;
|
||||||
|
|
||||||
void reloadQmlSource();
|
void reloadQmlSource();
|
||||||
|
|
||||||
@@ -39,7 +39,7 @@ public:
|
|||||||
private:
|
private:
|
||||||
QPointer<CollectionView> m_view;
|
QPointer<CollectionView> m_view;
|
||||||
QPointer<CollectionSourceModel> m_sourceModel;
|
QPointer<CollectionSourceModel> m_sourceModel;
|
||||||
QPointer<SingleCollectionModel> m_singleCollectionModel;
|
QPointer<CollectionDetailsModel> m_collectionDetailsModel;
|
||||||
QScopedPointer<StudioQuickWidget> m_quickWidget;
|
QScopedPointer<StudioQuickWidget> m_quickWidget;
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user