forked from qt-creator/qt-creator
QmlDesigner: Add item library tracing
Change-Id: I3c9c2130112e3bf8460bab6108435df553d1c3e9 Reviewed-by: Thomas Hartmann <thomas.hartmann@qt.io>
This commit is contained in:
@@ -44,6 +44,10 @@ env_with_default("QTC_ENABLE_NAVIGATOR_TRACING" ENV_QTC_ENABLE_NAVIGATOR_TRACING
|
||||
option(ENABLE_NAVIGATOR_TRACING "Enable navigator tracing" ${ENV_QTC_ENABLE_NAVIGATOR_TRACING})
|
||||
add_feature_info("Navigator tracing" ${ENABLE_NAVIGATOR_TRACING} "")
|
||||
|
||||
env_with_default("QTC_ENABLE_ITEM_LIBRARY_TRACING" ENV_QTC_ENABLE_ITEM_LIBRARY_TRACING OFF)
|
||||
option(ENABLE_ITEM_LIBRARY_TRACING "Enable item library tracing" ${ENV_QTC_ENABLE_ITEM_LIBRARY_TRACING})
|
||||
add_feature_info("Item library tracing" ${ENABLE_ITEM_LIBRARY_TRACING} "")
|
||||
|
||||
if(QDS_DESIGNVIEWER_USE_STAGING)
|
||||
add_definitions(-DQDS_DESIGNVIEWER_USE_STAGING)
|
||||
endif()
|
||||
@@ -354,6 +358,8 @@ extend_qtc_plugin(QmlDesigner
|
||||
|
||||
extend_qtc_plugin(QmlDesigner
|
||||
SOURCES_PREFIX components/itemlibrary
|
||||
PUBLIC_DEFINES
|
||||
$<$<BOOL:${ENABLE_ITEM_LIBRARY_TRACING}>:ENABLE_ITEM_LIBRARY_TRACING>
|
||||
SOURCES
|
||||
itemlibrary.qrc
|
||||
itemlibraryconstants.h
|
||||
@@ -362,6 +368,7 @@ extend_qtc_plugin(QmlDesigner
|
||||
itemlibrarymodel.cpp itemlibrarymodel.h
|
||||
itemlibrarycategory.cpp itemlibrarycategory.h
|
||||
itemlibraryitemsmodel.cpp itemlibraryitemsmodel.h
|
||||
itemlibrarytracing.cpp itemlibrarytracing.h
|
||||
itemlibraryview.cpp itemlibraryview.h
|
||||
itemlibrarywidget.cpp itemlibrarywidget.h
|
||||
itemlibraryiconimageprovider.cpp itemlibraryiconimageprovider.h
|
||||
|
@@ -3,6 +3,7 @@
|
||||
|
||||
#include "itemlibraryaddimportmodel.h"
|
||||
#include "itemlibraryconstants.h"
|
||||
#include "itemlibrarytracing.h"
|
||||
|
||||
#include <designermcumanager.h>
|
||||
#include <utils/algorithm.h>
|
||||
@@ -15,9 +16,13 @@
|
||||
|
||||
namespace QmlDesigner {
|
||||
|
||||
static auto category = ItemLibraryTracing::category;
|
||||
|
||||
ItemLibraryAddImportModel::ItemLibraryAddImportModel(QObject *parent)
|
||||
: QAbstractListModel(parent)
|
||||
{
|
||||
NanotraceHR::Tracer tracer{"item library add import model constructor", category()};
|
||||
|
||||
// add role names
|
||||
m_roleNames.insert(Qt::UserRole + 1, "importUrl");
|
||||
m_roleNames.insert(Qt::UserRole + 2, "importVisible");
|
||||
@@ -26,16 +31,20 @@ ItemLibraryAddImportModel::ItemLibraryAddImportModel(QObject *parent)
|
||||
|
||||
ItemLibraryAddImportModel::~ItemLibraryAddImportModel()
|
||||
{
|
||||
|
||||
NanotraceHR::Tracer tracer{"item library add import model destructor", category()};
|
||||
}
|
||||
|
||||
int ItemLibraryAddImportModel::rowCount(const QModelIndex & /*parent*/) const
|
||||
{
|
||||
NanotraceHR::Tracer tracer{"item library add import model row count", category()};
|
||||
|
||||
return m_importList.size();
|
||||
}
|
||||
|
||||
QVariant ItemLibraryAddImportModel::data(const QModelIndex &index, int role) const
|
||||
{
|
||||
NanotraceHR::Tracer tracer{"item library add import model data", category()};
|
||||
|
||||
if (!index.isValid() || index.row() >= m_importList.size())
|
||||
return {};
|
||||
|
||||
@@ -56,6 +65,8 @@ QVariant ItemLibraryAddImportModel::data(const QModelIndex &index, int role) con
|
||||
|
||||
QHash<int, QByteArray> ItemLibraryAddImportModel::roleNames() const
|
||||
{
|
||||
NanotraceHR::Tracer tracer{"item library add import model role names", category()};
|
||||
|
||||
return m_roleNames;
|
||||
}
|
||||
|
||||
@@ -69,6 +80,8 @@ bool isPriorityImport(QStringView importUrl)
|
||||
|
||||
void ItemLibraryAddImportModel::update(const Imports &possibleImports)
|
||||
{
|
||||
NanotraceHR::Tracer tracer{"item library add import model update", category()};
|
||||
|
||||
beginResetModel();
|
||||
m_importList.clear();
|
||||
|
||||
@@ -140,6 +153,8 @@ void ItemLibraryAddImportModel::update(const Imports &possibleImports)
|
||||
|
||||
Import ItemLibraryAddImportModel::getImport(const QString &importUrl) const
|
||||
{
|
||||
NanotraceHR::Tracer tracer{"item library add import model get import", category()};
|
||||
|
||||
for (const Import &import : std::as_const(m_importList))
|
||||
if (import.url() == importUrl)
|
||||
return import;
|
||||
@@ -149,6 +164,8 @@ Import ItemLibraryAddImportModel::getImport(const QString &importUrl) const
|
||||
|
||||
void ItemLibraryAddImportModel::setSearchText(const QString &searchText)
|
||||
{
|
||||
NanotraceHR::Tracer tracer{"item library add import model set search text", category()};
|
||||
|
||||
QString lowerSearchText = searchText.toLower();
|
||||
|
||||
if (m_searchText != lowerSearchText) {
|
||||
@@ -167,6 +184,8 @@ void ItemLibraryAddImportModel::setSearchText(const QString &searchText)
|
||||
|
||||
Import ItemLibraryAddImportModel::getImportAt(int index) const
|
||||
{
|
||||
NanotraceHR::Tracer tracer{"item library add import model get import at", category()};
|
||||
|
||||
return m_importList.at(index);
|
||||
}
|
||||
|
||||
|
@@ -4,6 +4,7 @@
|
||||
#include "itemlibrarycategoriesmodel.h"
|
||||
#include "itemlibrarycategory.h"
|
||||
#include "itemlibrarymodel.h"
|
||||
#include "itemlibrarytracing.h"
|
||||
|
||||
#include <utils/algorithm.h>
|
||||
#include <utils/qtcassert.h>
|
||||
@@ -15,23 +16,32 @@
|
||||
|
||||
namespace QmlDesigner {
|
||||
|
||||
static auto category = ItemLibraryTracing::category;
|
||||
|
||||
ItemLibraryCategoriesModel::ItemLibraryCategoriesModel(QObject *parent) :
|
||||
QAbstractListModel(parent)
|
||||
{
|
||||
NanotraceHR::Tracer tracer{"item library categories model constructor", category()};
|
||||
|
||||
addRoleNames();
|
||||
}
|
||||
|
||||
ItemLibraryCategoriesModel::~ItemLibraryCategoriesModel()
|
||||
{
|
||||
NanotraceHR::Tracer tracer{"item library categories model destructor", category()};
|
||||
}
|
||||
|
||||
int ItemLibraryCategoriesModel::rowCount(const QModelIndex &) const
|
||||
{
|
||||
NanotraceHR::Tracer tracer{"item library categories model row count", category()};
|
||||
|
||||
return m_categoryList.size();
|
||||
}
|
||||
|
||||
QVariant ItemLibraryCategoriesModel::data(const QModelIndex &index, int role) const
|
||||
{
|
||||
NanotraceHR::Tracer tracer{"item library categories model data", category()};
|
||||
|
||||
if (!index.isValid() || index.row() >= m_categoryList.size()) {
|
||||
qWarning() << Q_FUNC_INFO << "invalid index requested";
|
||||
return {};
|
||||
@@ -53,6 +63,8 @@ QVariant ItemLibraryCategoriesModel::data(const QModelIndex &index, int role) co
|
||||
|
||||
bool ItemLibraryCategoriesModel::setData(const QModelIndex &index, const QVariant &value, int role)
|
||||
{
|
||||
NanotraceHR::Tracer tracer{"item library categories model set data", category()};
|
||||
|
||||
// currently only categoryExpanded and categoryVisible properties is updatable
|
||||
if (index.isValid() && m_roleNames.contains(role)) {
|
||||
QVariant currValue = m_categoryList.at(index.row())->property(m_roleNames.value(role));
|
||||
@@ -76,11 +88,15 @@ bool ItemLibraryCategoriesModel::setData(const QModelIndex &index, const QVarian
|
||||
|
||||
QHash<int, QByteArray> ItemLibraryCategoriesModel::roleNames() const
|
||||
{
|
||||
NanotraceHR::Tracer tracer{"item library categories model role names", category()};
|
||||
|
||||
return m_roleNames;
|
||||
}
|
||||
|
||||
void ItemLibraryCategoriesModel::expandCategories(bool expand)
|
||||
{
|
||||
NanotraceHR::Tracer tracer{"item library categories model expand categories", category()};
|
||||
|
||||
int i = 0;
|
||||
for (const auto &category : std::as_const(m_categoryList)) {
|
||||
if (category->categoryExpanded() != expand) {
|
||||
@@ -94,6 +110,9 @@ void ItemLibraryCategoriesModel::expandCategories(bool expand)
|
||||
|
||||
void ItemLibraryCategoriesModel::addCategory(ItemLibraryCategory *category)
|
||||
{
|
||||
NanotraceHR::Tracer tracer{"item library categories model add category",
|
||||
ItemLibraryTracing::category()};
|
||||
|
||||
m_categoryList.append(category);
|
||||
|
||||
category->setVisible(true);
|
||||
@@ -101,11 +120,15 @@ void ItemLibraryCategoriesModel::addCategory(ItemLibraryCategory *category)
|
||||
|
||||
const QList<QPointer<ItemLibraryCategory>> &ItemLibraryCategoriesModel::categorySections() const
|
||||
{
|
||||
NanotraceHR::Tracer tracer{"item library categories model category sections", category()};
|
||||
|
||||
return m_categoryList;
|
||||
}
|
||||
|
||||
void ItemLibraryCategoriesModel::sortCategorySections()
|
||||
{
|
||||
NanotraceHR::Tracer tracer{"item library categories model sort category sections", category()};
|
||||
|
||||
auto categorySort = [](ItemLibraryCategory *first, ItemLibraryCategory *second) {
|
||||
return QString::localeAwareCompare(first->sortingName(), second->sortingName()) < 0;
|
||||
};
|
||||
@@ -118,12 +141,16 @@ void ItemLibraryCategoriesModel::sortCategorySections()
|
||||
|
||||
void ItemLibraryCategoriesModel::resetModel()
|
||||
{
|
||||
NanotraceHR::Tracer tracer{"item library categories model reset model", category()};
|
||||
|
||||
beginResetModel();
|
||||
endResetModel();
|
||||
}
|
||||
|
||||
bool ItemLibraryCategoriesModel::isAllCategoriesHidden() const
|
||||
{
|
||||
NanotraceHR::Tracer tracer{"item library categories model is all categories hidden", category()};
|
||||
|
||||
for (const auto &category : std::as_const(m_categoryList)) {
|
||||
if (category->isCategoryVisible())
|
||||
return false;
|
||||
@@ -134,6 +161,8 @@ bool ItemLibraryCategoriesModel::isAllCategoriesHidden() const
|
||||
|
||||
void ItemLibraryCategoriesModel::showAllCategories()
|
||||
{
|
||||
NanotraceHR::Tracer tracer{"item library categories model show all categories", category()};
|
||||
|
||||
for (const auto &category : std::as_const(m_categoryList)) {
|
||||
if (!category->isCategoryVisible()) {
|
||||
category->setCategoryVisible(true);
|
||||
@@ -147,6 +176,8 @@ void ItemLibraryCategoriesModel::showAllCategories()
|
||||
|
||||
void ItemLibraryCategoriesModel::hideCategory(const QString &categoryName)
|
||||
{
|
||||
NanotraceHR::Tracer tracer{"item library categories model hide category", category()};
|
||||
|
||||
for (int i = 0; i < m_categoryList.size(); ++i) {
|
||||
const auto category = m_categoryList.at(i);
|
||||
if (category->categoryName() == categoryName) {
|
||||
@@ -161,6 +192,9 @@ void ItemLibraryCategoriesModel::hideCategory(const QString &categoryName)
|
||||
|
||||
int ItemLibraryCategoriesModel::selectFirstVisibleCategory()
|
||||
{
|
||||
NanotraceHR::Tracer tracer{"item library categories model select first visible category",
|
||||
category()};
|
||||
|
||||
for (int i = 0; i < m_categoryList.length(); ++i) {
|
||||
const auto category = m_categoryList.at(i);
|
||||
|
||||
@@ -176,6 +210,8 @@ int ItemLibraryCategoriesModel::selectFirstVisibleCategory()
|
||||
|
||||
void ItemLibraryCategoriesModel::clearSelectedCategory(int categoryIndex)
|
||||
{
|
||||
NanotraceHR::Tracer tracer{"item library categories model clear selected category", category()};
|
||||
|
||||
if (categoryIndex == -1 || m_categoryList.isEmpty())
|
||||
return;
|
||||
|
||||
@@ -185,6 +221,8 @@ void ItemLibraryCategoriesModel::clearSelectedCategory(int categoryIndex)
|
||||
|
||||
QPointer<ItemLibraryCategory> ItemLibraryCategoriesModel::selectCategory(int categoryIndex)
|
||||
{
|
||||
NanotraceHR::Tracer tracer{"item library categories model select category", category()};
|
||||
|
||||
if (m_categoryList.isEmpty() || categoryIndex < 0 || categoryIndex >= m_categoryList.size())
|
||||
return nullptr;
|
||||
|
||||
@@ -200,6 +238,8 @@ QPointer<ItemLibraryCategory> ItemLibraryCategoriesModel::selectCategory(int cat
|
||||
|
||||
void ItemLibraryCategoriesModel::addRoleNames()
|
||||
{
|
||||
NanotraceHR::Tracer tracer{"item library categories model add role names", category()};
|
||||
|
||||
int role = 0;
|
||||
const QMetaObject meta = ItemLibraryCategory::staticMetaObject;
|
||||
for (int i = meta.propertyOffset(); i < meta.propertyCount(); ++i)
|
||||
|
@@ -4,41 +4,55 @@
|
||||
#include "itemlibrarycategory.h"
|
||||
|
||||
#include "itemlibraryitem.h"
|
||||
#include "itemlibrarytracing.h"
|
||||
#include "itemlibrarywidget.h"
|
||||
|
||||
#include <QApplication>
|
||||
|
||||
namespace QmlDesigner {
|
||||
|
||||
static auto category = ItemLibraryTracing::category;
|
||||
|
||||
ItemLibraryCategory::ItemLibraryCategory(const QString &groupName, QObject *parent)
|
||||
: QObject(parent),
|
||||
m_ownerImport(qobject_cast<ItemLibraryImport *>(parent)),
|
||||
m_name(groupName)
|
||||
{
|
||||
NanotraceHR::Tracer tracer{"item library category constructor", category()};
|
||||
}
|
||||
|
||||
QString ItemLibraryCategory::categoryName() const
|
||||
{
|
||||
NanotraceHR::Tracer tracer{"item library category name", category()};
|
||||
|
||||
return m_name;
|
||||
}
|
||||
|
||||
QString ItemLibraryCategory::displayNMame() const
|
||||
{
|
||||
NanotraceHR::Tracer tracer{"item library category display name", category()};
|
||||
|
||||
return QApplication::translate("itemlibrary", m_name.toUtf8());
|
||||
}
|
||||
|
||||
bool ItemLibraryCategory::categoryExpanded() const
|
||||
{
|
||||
NanotraceHR::Tracer tracer{"item library category expanded", category()};
|
||||
|
||||
return m_categoryExpanded;
|
||||
}
|
||||
|
||||
bool ItemLibraryCategory::categorySelected() const
|
||||
{
|
||||
NanotraceHR::Tracer tracer{"item library category selected", category()};
|
||||
|
||||
return m_categorySelected;
|
||||
}
|
||||
|
||||
QString ItemLibraryCategory::sortingName() const
|
||||
{
|
||||
NanotraceHR::Tracer tracer{"item library category sorting name", category()};
|
||||
|
||||
if (ItemLibraryModel::categorySortingHash.contains(categoryName()))
|
||||
return ItemLibraryModel::categorySortingHash.value(categoryName());
|
||||
|
||||
@@ -47,6 +61,8 @@ QString ItemLibraryCategory::sortingName() const
|
||||
|
||||
void ItemLibraryCategory::addItem(ItemLibraryItem *itemEntry)
|
||||
{
|
||||
NanotraceHR::Tracer tracer{"item library category add item", category()};
|
||||
|
||||
m_itemModel.addItem(itemEntry);
|
||||
}
|
||||
|
||||
@@ -57,6 +73,8 @@ QObject *ItemLibraryCategory::itemModel()
|
||||
|
||||
bool ItemLibraryCategory::updateItemVisibility(const QString &searchText, bool *changed)
|
||||
{
|
||||
NanotraceHR::Tracer tracer{"item library category update item visibility", category()};
|
||||
|
||||
bool hasVisibleItems = false;
|
||||
|
||||
*changed = false;
|
||||
@@ -88,6 +106,8 @@ bool ItemLibraryCategory::updateItemVisibility(const QString &searchText, bool *
|
||||
|
||||
void ItemLibraryCategory::setCategoryVisible(bool isVisible)
|
||||
{
|
||||
NanotraceHR::Tracer tracer{"item library category set visible", category()};
|
||||
|
||||
if (isVisible != m_isVisible) {
|
||||
m_isVisible = isVisible;
|
||||
emit categoryVisibilityChanged();
|
||||
@@ -96,6 +116,8 @@ void ItemLibraryCategory::setCategoryVisible(bool isVisible)
|
||||
|
||||
bool ItemLibraryCategory::setVisible(bool isVisible)
|
||||
{
|
||||
NanotraceHR::Tracer tracer{"item library category set visible", category()};
|
||||
|
||||
if (isVisible != m_isVisible) {
|
||||
m_isVisible = isVisible;
|
||||
return true;
|
||||
@@ -106,21 +128,29 @@ bool ItemLibraryCategory::setVisible(bool isVisible)
|
||||
|
||||
bool ItemLibraryCategory::isCategoryVisible() const
|
||||
{
|
||||
NanotraceHR::Tracer tracer{"item library category is visible", category()};
|
||||
|
||||
return m_isVisible;
|
||||
}
|
||||
|
||||
void ItemLibraryCategory::sortItems()
|
||||
{
|
||||
NanotraceHR::Tracer tracer{"item library category sort items", category()};
|
||||
|
||||
m_itemModel.sortItems();
|
||||
}
|
||||
|
||||
void ItemLibraryCategory::setExpanded(bool expanded)
|
||||
{
|
||||
NanotraceHR::Tracer tracer{"item library category set expanded", category()};
|
||||
|
||||
m_categoryExpanded = expanded;
|
||||
}
|
||||
|
||||
void ItemLibraryCategory::setCategorySelected(bool selected)
|
||||
{
|
||||
NanotraceHR::Tracer tracer{"item library category set category selected", category()};
|
||||
|
||||
m_categorySelected = selected;
|
||||
emit categorySelectedChanged();
|
||||
}
|
||||
|
@@ -3,6 +3,8 @@
|
||||
|
||||
#include "itemlibraryiconimageprovider.h"
|
||||
|
||||
#include "itemlibrarytracing.h"
|
||||
|
||||
#include <imagecache/imagecacheimageresponse.h>
|
||||
|
||||
#include <projectexplorer/target.h>
|
||||
@@ -13,9 +15,13 @@
|
||||
|
||||
namespace QmlDesigner {
|
||||
|
||||
static auto category = ItemLibraryTracing::category;
|
||||
|
||||
QQuickImageResponse *ItemLibraryIconImageProvider::requestImageResponse(const QString &id,
|
||||
const QSize &)
|
||||
{
|
||||
NanotraceHR::Tracer tracer{"item library icon image provider request image response", category()};
|
||||
|
||||
auto response = std::make_unique<ImageCacheImageResponse>(QImage{
|
||||
Utils::StyleHelper::dpiSpecificImageFile(":/ItemLibrary/images/item-default-icon.png")});
|
||||
|
||||
|
@@ -3,19 +3,26 @@
|
||||
|
||||
#include "itemlibraryimageprovider.h"
|
||||
|
||||
#include "itemlibrarytracing.h"
|
||||
|
||||
#include <utils/stylehelper.h>
|
||||
|
||||
namespace QmlDesigner {
|
||||
|
||||
static auto category = ItemLibraryTracing::category;
|
||||
|
||||
namespace Internal {
|
||||
|
||||
ItemLibraryImageProvider::ItemLibraryImageProvider() :
|
||||
QQuickImageProvider(QQuickImageProvider::Pixmap)
|
||||
{
|
||||
NanotraceHR::Tracer tracer{"item library image provider constructor", category()};
|
||||
}
|
||||
|
||||
QPixmap ItemLibraryImageProvider::requestPixmap(const QString &id, QSize *size, const QSize &requestedSize)
|
||||
{
|
||||
NanotraceHR::Tracer tracer{"item library image provider request pixmap", category()};
|
||||
|
||||
QPixmap pixmap(Utils::StyleHelper::dpiSpecificImageFile(id));
|
||||
if (size) {
|
||||
size->setWidth(pixmap.width());
|
||||
|
@@ -3,19 +3,26 @@
|
||||
|
||||
#include "itemlibraryimport.h"
|
||||
#include "itemlibrarycategory.h"
|
||||
#include "itemlibrarytracing.h"
|
||||
|
||||
namespace QmlDesigner {
|
||||
|
||||
static auto category = ItemLibraryTracing::category;
|
||||
|
||||
ItemLibraryImport::ItemLibraryImport(const Import &import, QObject *parent, SectionType sectionType)
|
||||
: QObject(parent),
|
||||
m_import(import),
|
||||
m_sectionType(sectionType)
|
||||
{
|
||||
NanotraceHR::Tracer tracer{"item library import constructor", category()};
|
||||
|
||||
updateRemovable();
|
||||
}
|
||||
|
||||
QString ItemLibraryImport::importName() const
|
||||
{
|
||||
NanotraceHR::Tracer tracer{"item library import name", category()};
|
||||
|
||||
if (m_sectionType == SectionType::User)
|
||||
return userComponentsTitle();
|
||||
|
||||
@@ -33,6 +40,8 @@ QString ItemLibraryImport::importName() const
|
||||
|
||||
QString ItemLibraryImport::importUrl() const
|
||||
{
|
||||
NanotraceHR::Tracer tracer{"item library import URL", category()};
|
||||
|
||||
if (m_sectionType == SectionType::User)
|
||||
return userComponentsTitle();
|
||||
|
||||
@@ -47,11 +56,15 @@ QString ItemLibraryImport::importUrl() const
|
||||
|
||||
bool ItemLibraryImport::importExpanded() const
|
||||
{
|
||||
NanotraceHR::Tracer tracer{"item library import expanded", category()};
|
||||
|
||||
return m_importExpanded;
|
||||
}
|
||||
|
||||
QString ItemLibraryImport::sortingName() const
|
||||
{
|
||||
NanotraceHR::Tracer tracer{"item library import sorting name", category()};
|
||||
|
||||
if (m_sectionType == SectionType::User)
|
||||
return "_"; // user components always come first
|
||||
|
||||
@@ -66,21 +79,29 @@ QString ItemLibraryImport::sortingName() const
|
||||
|
||||
void ItemLibraryImport::addCategory(ItemLibraryCategory *category)
|
||||
{
|
||||
NanotraceHR::Tracer tracer{"item library import add category", ItemLibraryTracing::category()};
|
||||
|
||||
m_categoryModel.addCategory(category);
|
||||
}
|
||||
|
||||
QObject *ItemLibraryImport::categoryModel()
|
||||
{
|
||||
NanotraceHR::Tracer tracer{"item library import category model", category()};
|
||||
|
||||
return &m_categoryModel;
|
||||
}
|
||||
|
||||
void ItemLibraryImport::expandCategories(bool expand)
|
||||
{
|
||||
NanotraceHR::Tracer tracer{"item library import expand categories", category()};
|
||||
|
||||
m_categoryModel.expandCategories(expand);
|
||||
}
|
||||
|
||||
bool ItemLibraryImport::updateCategoryVisibility(const QString &searchText, bool *changed)
|
||||
{
|
||||
NanotraceHR::Tracer tracer{"item library import update category visibility", category()};
|
||||
|
||||
bool hasVisibleCategories = false;
|
||||
*changed = false;
|
||||
|
||||
@@ -104,33 +125,45 @@ bool ItemLibraryImport::updateCategoryVisibility(const QString &searchText, bool
|
||||
|
||||
void ItemLibraryImport::showAllCategories()
|
||||
{
|
||||
NanotraceHR::Tracer tracer{"item library import show all categories", category()};
|
||||
|
||||
m_categoryModel.showAllCategories();
|
||||
setAllCategoriesVisible(true);
|
||||
}
|
||||
|
||||
void ItemLibraryImport::hideCategory(const QString &categoryName)
|
||||
{
|
||||
NanotraceHR::Tracer tracer{"item library import hide category", category()};
|
||||
|
||||
m_categoryModel.hideCategory(categoryName);
|
||||
setAllCategoriesVisible(false);
|
||||
}
|
||||
|
||||
ItemLibraryCategory *ItemLibraryImport::selectCategory(int categoryIndex)
|
||||
{
|
||||
NanotraceHR::Tracer tracer{"item library import select category", category()};
|
||||
|
||||
return m_categoryModel.selectCategory(categoryIndex);
|
||||
}
|
||||
|
||||
int ItemLibraryImport::selectFirstVisibleCategory()
|
||||
{
|
||||
NanotraceHR::Tracer tracer{"item library import select first visible category", category()};
|
||||
|
||||
return m_categoryModel.selectFirstVisibleCategory();
|
||||
}
|
||||
|
||||
void ItemLibraryImport::clearSelectedCategory(int categoryIndex)
|
||||
{
|
||||
NanotraceHR::Tracer tracer{"item library import clear selected category", category()};
|
||||
|
||||
m_categoryModel.clearSelectedCategory(categoryIndex);
|
||||
}
|
||||
|
||||
bool ItemLibraryImport::isAllCategoriesHidden() const
|
||||
{
|
||||
NanotraceHR::Tracer tracer{"item library import is all categories hidden", category()};
|
||||
|
||||
if (!m_isVisible)
|
||||
return true;
|
||||
|
||||
@@ -139,11 +172,15 @@ bool ItemLibraryImport::isAllCategoriesHidden() const
|
||||
|
||||
Import ItemLibraryImport::importEntry() const
|
||||
{
|
||||
NanotraceHR::Tracer tracer{"item library import entry", category()};
|
||||
|
||||
return m_import;
|
||||
}
|
||||
|
||||
bool ItemLibraryImport::setVisible(bool isVisible)
|
||||
{
|
||||
NanotraceHR::Tracer tracer{"item library import set visible", category()};
|
||||
|
||||
if (isVisible != m_isVisible) {
|
||||
m_isVisible = isVisible;
|
||||
emit importVisibleChanged();
|
||||
@@ -155,11 +192,15 @@ bool ItemLibraryImport::setVisible(bool isVisible)
|
||||
|
||||
bool ItemLibraryImport::importVisible() const
|
||||
{
|
||||
NanotraceHR::Tracer tracer{"item library import is visible", category()};
|
||||
|
||||
return m_isVisible;
|
||||
}
|
||||
|
||||
void ItemLibraryImport::setImportUsed(bool importUsed)
|
||||
{
|
||||
NanotraceHR::Tracer tracer{"item library import set used", category()};
|
||||
|
||||
if (importUsed != m_importUsed) {
|
||||
m_importUsed = importUsed;
|
||||
updateRemovable();
|
||||
@@ -169,31 +210,43 @@ void ItemLibraryImport::setImportUsed(bool importUsed)
|
||||
|
||||
bool ItemLibraryImport::importUsed() const
|
||||
{
|
||||
NanotraceHR::Tracer tracer{"item library import is used", category()};
|
||||
|
||||
return m_importUsed;
|
||||
}
|
||||
|
||||
bool ItemLibraryImport::importRemovable() const
|
||||
{
|
||||
NanotraceHR::Tracer tracer{"item library import is removable", category()};
|
||||
|
||||
return m_importRemovable;
|
||||
}
|
||||
|
||||
bool ItemLibraryImport::hasCategories() const
|
||||
{
|
||||
NanotraceHR::Tracer tracer{"item library import has categories", category()};
|
||||
|
||||
return m_categoryModel.rowCount() > 0;
|
||||
}
|
||||
|
||||
bool ItemLibraryImport::hasSingleCategory() const
|
||||
{
|
||||
NanotraceHR::Tracer tracer{"item library import has single category", category()};
|
||||
|
||||
return m_categoryModel.rowCount() == 1;
|
||||
}
|
||||
|
||||
void ItemLibraryImport::sortCategorySections()
|
||||
{
|
||||
NanotraceHR::Tracer tracer{"item library import sort category sections", category()};
|
||||
|
||||
m_categoryModel.sortCategorySections();
|
||||
}
|
||||
|
||||
void ItemLibraryImport::setImportExpanded(bool expanded)
|
||||
{
|
||||
NanotraceHR::Tracer tracer{"item library import set expanded", category()};
|
||||
|
||||
if (expanded != m_importExpanded) {
|
||||
m_importExpanded = expanded;
|
||||
emit importExpandChanged();
|
||||
@@ -202,6 +255,8 @@ void ItemLibraryImport::setImportExpanded(bool expanded)
|
||||
|
||||
ItemLibraryCategory *ItemLibraryImport::getCategoryByName(const QString &categoryName) const
|
||||
{
|
||||
NanotraceHR::Tracer tracer{"item library import get category by name", category()};
|
||||
|
||||
for (ItemLibraryCategory *catSec : std::as_const(m_categoryModel.categorySections())) {
|
||||
if (catSec->categoryName() == categoryName)
|
||||
return catSec;
|
||||
@@ -212,6 +267,8 @@ ItemLibraryCategory *ItemLibraryImport::getCategoryByName(const QString &categor
|
||||
|
||||
ItemLibraryCategory *ItemLibraryImport::getCategoryAt(int categoryIndex) const
|
||||
{
|
||||
NanotraceHR::Tracer tracer{"item library import get category at index", category()};
|
||||
|
||||
const QList<QPointer<ItemLibraryCategory>> categories = m_categoryModel.categorySections();
|
||||
|
||||
if (categoryIndex != -1 && !categories.isEmpty())
|
||||
@@ -223,22 +280,30 @@ ItemLibraryCategory *ItemLibraryImport::getCategoryAt(int categoryIndex) const
|
||||
// static
|
||||
QString ItemLibraryImport::userComponentsTitle()
|
||||
{
|
||||
NanotraceHR::Tracer tracer{"item library import user components title", category()};
|
||||
|
||||
return tr("My Components");
|
||||
}
|
||||
|
||||
// static
|
||||
QString ItemLibraryImport::unimportedComponentsTitle()
|
||||
{
|
||||
NanotraceHR::Tracer tracer{"item library import unimported components title", category()};
|
||||
|
||||
return tr("All Other Components");
|
||||
}
|
||||
|
||||
ItemLibraryImport::SectionType ItemLibraryImport::sectionType() const
|
||||
{
|
||||
NanotraceHR::Tracer tracer{"item library import section type", category()};
|
||||
|
||||
return m_sectionType;
|
||||
}
|
||||
|
||||
void ItemLibraryImport::updateRemovable()
|
||||
{
|
||||
NanotraceHR::Tracer tracer{"item library import update removable", category()};
|
||||
|
||||
#ifdef QDS_USE_PROJECTSTORAGE
|
||||
bool importRemovable = m_sectionType == SectionType::Default && m_import.url() != "QtQuick";
|
||||
#else
|
||||
@@ -253,11 +318,15 @@ void ItemLibraryImport::updateRemovable()
|
||||
|
||||
bool ItemLibraryImport::allCategoriesVisible() const
|
||||
{
|
||||
NanotraceHR::Tracer tracer{"item library import all categories visible", category()};
|
||||
|
||||
return m_allCategoriesVisible;
|
||||
}
|
||||
|
||||
void ItemLibraryImport::setAllCategoriesVisible(bool visible)
|
||||
{
|
||||
NanotraceHR::Tracer tracer{"item library import set all categories visible", category()};
|
||||
|
||||
m_allCategoriesVisible = visible;
|
||||
}
|
||||
|
||||
|
@@ -2,32 +2,45 @@
|
||||
// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR GPL-3.0-only WITH Qt-GPL-exception-1.0
|
||||
|
||||
#include "itemlibraryitem.h"
|
||||
#include "itemlibrarytracing.h"
|
||||
|
||||
#include <QApplication>
|
||||
|
||||
namespace QmlDesigner {
|
||||
|
||||
static auto category = ItemLibraryTracing::category;
|
||||
|
||||
ItemLibraryItem::ItemLibraryItem(const ItemLibraryEntry &itemLibraryEntry, bool isUsable, QObject *parent)
|
||||
: QObject(parent)
|
||||
, m_itemLibraryEntry(itemLibraryEntry)
|
||||
, m_isUsable(isUsable)
|
||||
{
|
||||
NanotraceHR::Tracer tracer{"item library item constructor", category()};
|
||||
}
|
||||
|
||||
ItemLibraryItem::~ItemLibraryItem() = default;
|
||||
ItemLibraryItem::~ItemLibraryItem()
|
||||
{
|
||||
NanotraceHR::Tracer tracer{"item library item destructor", category()};
|
||||
}
|
||||
|
||||
QString ItemLibraryItem::itemName() const
|
||||
{
|
||||
NanotraceHR::Tracer tracer{"item library item name", category()};
|
||||
|
||||
return QApplication::translate("itemlibrary", m_itemLibraryEntry.name().toUtf8());
|
||||
}
|
||||
|
||||
QString ItemLibraryItem::typeName() const
|
||||
{
|
||||
NanotraceHR::Tracer tracer{"item library item type name", category()};
|
||||
|
||||
return QString::fromUtf8(m_itemLibraryEntry.typeName());
|
||||
}
|
||||
|
||||
QString ItemLibraryItem::itemLibraryIconPath() const
|
||||
{
|
||||
NanotraceHR::Tracer tracer{"item library item icon path", category()};
|
||||
|
||||
if (m_itemLibraryEntry.customComponentSource().isEmpty()
|
||||
|| !m_itemLibraryEntry.libraryEntryIconPath().isEmpty()) {
|
||||
return QStringLiteral("image://qmldesigner_itemlibrary/")
|
||||
@@ -40,26 +53,36 @@ QString ItemLibraryItem::itemLibraryIconPath() const
|
||||
|
||||
QString ItemLibraryItem::componentPath() const
|
||||
{
|
||||
NanotraceHR::Tracer tracer{"item library item component path", category()};
|
||||
|
||||
return m_itemLibraryEntry.customComponentSource();
|
||||
}
|
||||
|
||||
QString ItemLibraryItem::requiredImport() const
|
||||
{
|
||||
NanotraceHR::Tracer tracer{"item library item required import", category()};
|
||||
|
||||
return m_itemLibraryEntry.requiredImport();
|
||||
}
|
||||
|
||||
QString ItemLibraryItem::componentSource() const
|
||||
{
|
||||
NanotraceHR::Tracer tracer{"item library item component source", category()};
|
||||
|
||||
return m_itemLibraryEntry.customComponentSource();
|
||||
}
|
||||
|
||||
QString ItemLibraryItem::toolTip() const
|
||||
{
|
||||
NanotraceHR::Tracer tracer{"item library item tool tip", category()};
|
||||
|
||||
return m_itemLibraryEntry.toolTip();
|
||||
}
|
||||
|
||||
bool ItemLibraryItem::setVisible(bool isVisible)
|
||||
{
|
||||
NanotraceHR::Tracer tracer{"item library item set visible", category()};
|
||||
|
||||
if (isVisible != m_isVisible) {
|
||||
m_isVisible = isVisible;
|
||||
emit visibilityChanged();
|
||||
@@ -71,16 +94,22 @@ bool ItemLibraryItem::setVisible(bool isVisible)
|
||||
|
||||
bool ItemLibraryItem::isVisible() const
|
||||
{
|
||||
NanotraceHR::Tracer tracer{"item library item is visible", category()};
|
||||
|
||||
return m_isVisible;
|
||||
}
|
||||
|
||||
bool ItemLibraryItem::isUsable() const
|
||||
{
|
||||
NanotraceHR::Tracer tracer{"item library item is usable", category()};
|
||||
|
||||
return m_isUsable;
|
||||
}
|
||||
|
||||
QVariant ItemLibraryItem::itemLibraryEntry() const
|
||||
{
|
||||
NanotraceHR::Tracer tracer{"item library item library entry", category()};
|
||||
|
||||
return QVariant::fromValue(m_itemLibraryEntry);
|
||||
}
|
||||
} // namespace QmlDesigner
|
||||
|
@@ -3,29 +3,40 @@
|
||||
|
||||
#include "itemlibraryitemsmodel.h"
|
||||
#include "itemlibraryitem.h"
|
||||
#include "itemlibrarytracing.h"
|
||||
|
||||
#include <utils/qtcassert.h>
|
||||
#include <QDebug>
|
||||
#include <QMetaProperty>
|
||||
|
||||
namespace QmlDesigner {
|
||||
|
||||
static auto category = ItemLibraryTracing::category;
|
||||
|
||||
ItemLibraryItemsModel::ItemLibraryItemsModel(QObject *parent) :
|
||||
QAbstractListModel(parent)
|
||||
{
|
||||
NanotraceHR::Tracer tracer{"item library items model constructor", category()};
|
||||
|
||||
addRoleNames();
|
||||
}
|
||||
|
||||
ItemLibraryItemsModel::~ItemLibraryItemsModel()
|
||||
{
|
||||
NanotraceHR::Tracer tracer{"item library items model destructor", category()};
|
||||
}
|
||||
|
||||
int ItemLibraryItemsModel::rowCount(const QModelIndex &) const
|
||||
{
|
||||
NanotraceHR::Tracer tracer{"item library items model row count", category()};
|
||||
|
||||
return m_itemList.size();
|
||||
}
|
||||
|
||||
QVariant ItemLibraryItemsModel::data(const QModelIndex &index, int role) const
|
||||
{
|
||||
NanotraceHR::Tracer tracer{"item library items model data", category()};
|
||||
|
||||
if (!index.isValid() || index.row() >= m_itemList.count()) {
|
||||
qDebug() << Q_FUNC_INFO << "invalid index requested";
|
||||
return {};
|
||||
@@ -41,11 +52,15 @@ QVariant ItemLibraryItemsModel::data(const QModelIndex &index, int role) const
|
||||
|
||||
QHash<int, QByteArray> ItemLibraryItemsModel::roleNames() const
|
||||
{
|
||||
NanotraceHR::Tracer tracer{"item library items model role names", category()};
|
||||
|
||||
return m_roleNames;
|
||||
}
|
||||
|
||||
void ItemLibraryItemsModel::addItem(ItemLibraryItem *element)
|
||||
{
|
||||
NanotraceHR::Tracer tracer{"item library items model add item", category()};
|
||||
|
||||
m_itemList.append(element);
|
||||
|
||||
element->setVisible(element->isUsable());
|
||||
@@ -53,11 +68,15 @@ void ItemLibraryItemsModel::addItem(ItemLibraryItem *element)
|
||||
|
||||
const QList<QPointer<ItemLibraryItem>> &ItemLibraryItemsModel::items() const
|
||||
{
|
||||
NanotraceHR::Tracer tracer{"item library items model items", category()};
|
||||
|
||||
return m_itemList;
|
||||
}
|
||||
|
||||
void ItemLibraryItemsModel::sortItems()
|
||||
{
|
||||
NanotraceHR::Tracer tracer{"item library items model sort items", category()};
|
||||
|
||||
int nullPointerSectionCount = m_itemList.removeAll(QPointer<ItemLibraryItem>());
|
||||
QTC_ASSERT(nullPointerSectionCount == 0,;);
|
||||
auto itemSort = [](ItemLibraryItem *first, ItemLibraryItem *second) {
|
||||
@@ -69,12 +88,16 @@ void ItemLibraryItemsModel::sortItems()
|
||||
|
||||
void ItemLibraryItemsModel::resetModel()
|
||||
{
|
||||
NanotraceHR::Tracer tracer{"item library items model reset model", category()};
|
||||
|
||||
beginResetModel();
|
||||
endResetModel();
|
||||
}
|
||||
|
||||
void ItemLibraryItemsModel::addRoleNames()
|
||||
{
|
||||
NanotraceHR::Tracer tracer{"item library items model add role names", category()};
|
||||
|
||||
int role = 0;
|
||||
const QMetaObject meta = ItemLibraryItem::staticMetaObject;
|
||||
for (int i = meta.propertyOffset(); i < meta.propertyCount(); ++i)
|
||||
|
@@ -7,6 +7,7 @@
|
||||
#include "itemlibraryentry.h"
|
||||
#include "itemlibraryimport.h"
|
||||
#include "itemlibraryitem.h"
|
||||
#include "itemlibrarytracing.h"
|
||||
|
||||
#include <designermcumanager.h>
|
||||
#include <model.h>
|
||||
@@ -29,30 +30,41 @@
|
||||
|
||||
namespace QmlDesigner {
|
||||
|
||||
static auto category = ItemLibraryTracing::category;
|
||||
|
||||
// sectionName can be an import url or a category name
|
||||
void ItemLibraryModel::saveExpandedState(bool expanded, const QString §ionName)
|
||||
{
|
||||
NanotraceHR::Tracer tracer{"item library model save expanded state", category()};
|
||||
|
||||
expandedStateHash.insert(sectionName, expanded);
|
||||
}
|
||||
|
||||
bool ItemLibraryModel::loadExpandedState(const QString §ionName)
|
||||
{
|
||||
NanotraceHR::Tracer tracer{"item library model load expanded state", category()};
|
||||
return expandedStateHash.value(sectionName, true);
|
||||
}
|
||||
|
||||
void ItemLibraryModel::saveCategoryVisibleState(bool isVisible, const QString &categoryName,
|
||||
const QString &importName)
|
||||
{
|
||||
NanotraceHR::Tracer tracer{"item library model save category visible state", category()};
|
||||
|
||||
categoryVisibleStateHash.insert(categoryName + '_' + importName, isVisible);
|
||||
}
|
||||
|
||||
bool ItemLibraryModel::loadCategoryVisibleState(const QString &categoryName, const QString &importName)
|
||||
{
|
||||
NanotraceHR::Tracer tracer{"item library model load category visible state", category()};
|
||||
|
||||
return categoryVisibleStateHash.value(categoryName + '_' + importName, true);
|
||||
}
|
||||
|
||||
void ItemLibraryModel::selectImportCategory(const QString &importUrl, int categoryIndex)
|
||||
{
|
||||
NanotraceHR::Tracer tracer{"item library model select import category", category()};
|
||||
|
||||
clearSelectedCategory();
|
||||
|
||||
m_selectedImportUrl = importUrl;
|
||||
@@ -63,6 +75,8 @@ void ItemLibraryModel::selectImportCategory(const QString &importUrl, int catego
|
||||
|
||||
void ItemLibraryModel::clearSelectedCategory()
|
||||
{
|
||||
NanotraceHR::Tracer tracer{"item library model clear selected category", category()};
|
||||
|
||||
if (m_selectedCategoryIndex != -1) {
|
||||
ItemLibraryImport *selectedImport = importByUrl(m_selectedImportUrl);
|
||||
if (selectedImport)
|
||||
@@ -72,6 +86,8 @@ void ItemLibraryModel::clearSelectedCategory()
|
||||
|
||||
void ItemLibraryModel::selectImportFirstVisibleCategory()
|
||||
{
|
||||
NanotraceHR::Tracer tracer{"item library model select import first visible category", category()};
|
||||
|
||||
if (m_selectedCategoryIndex != -1) {
|
||||
ItemLibraryImport *selectedImport = importByUrl(m_selectedImportUrl);
|
||||
if (selectedImport) {
|
||||
@@ -110,11 +126,15 @@ void ItemLibraryModel::selectImportFirstVisibleCategory()
|
||||
|
||||
bool ItemLibraryModel::isAnyCategoryHidden() const
|
||||
{
|
||||
NanotraceHR::Tracer tracer{"item library model is any category hidden", category()};
|
||||
|
||||
return m_isAnyCategoryHidden;
|
||||
}
|
||||
|
||||
void ItemLibraryModel::setIsAnyCategoryHidden(bool state)
|
||||
{
|
||||
NanotraceHR::Tracer tracer{"item library model set is any category hidden", category()};
|
||||
|
||||
if (state != m_isAnyCategoryHidden) {
|
||||
m_isAnyCategoryHidden = state;
|
||||
emit isAnyCategoryHiddenChanged();
|
||||
@@ -123,11 +143,15 @@ void ItemLibraryModel::setIsAnyCategoryHidden(bool state)
|
||||
|
||||
bool ItemLibraryModel::importUnimportedSelected() const
|
||||
{
|
||||
NanotraceHR::Tracer tracer{"item library model import unimported selected", category()};
|
||||
|
||||
return m_importUnimportedSelected;
|
||||
}
|
||||
|
||||
void ItemLibraryModel::setImportUnimportedSelected(bool state)
|
||||
{
|
||||
NanotraceHR::Tracer tracer{"item library model set import unimported selected", category()};
|
||||
|
||||
if (state != m_importUnimportedSelected) {
|
||||
m_importUnimportedSelected = state;
|
||||
emit importUnimportedSelectedChanged();
|
||||
@@ -136,17 +160,23 @@ void ItemLibraryModel::setImportUnimportedSelected(bool state)
|
||||
|
||||
QObject *ItemLibraryModel::itemsModel() const
|
||||
{
|
||||
NanotraceHR::Tracer tracer{"item library model items model", category()};
|
||||
|
||||
return m_itemsModel;
|
||||
}
|
||||
|
||||
void ItemLibraryModel::setItemsModel(QObject *model)
|
||||
{
|
||||
NanotraceHR::Tracer tracer{"item library model set items model", category()};
|
||||
|
||||
m_itemsModel = model;
|
||||
emit itemsModelChanged();
|
||||
}
|
||||
|
||||
void ItemLibraryModel::expandAll()
|
||||
{
|
||||
NanotraceHR::Tracer tracer{"item library model expand all", category()};
|
||||
|
||||
int i = 0;
|
||||
for (const QPointer<ItemLibraryImport> &import : std::as_const(m_importList)) {
|
||||
if (!import->importExpanded()) {
|
||||
@@ -161,6 +191,8 @@ void ItemLibraryModel::expandAll()
|
||||
|
||||
void ItemLibraryModel::collapseAll()
|
||||
{
|
||||
NanotraceHR::Tracer tracer{"item library model collapse all", category()};
|
||||
|
||||
int i = 0;
|
||||
for (const QPointer<ItemLibraryImport> &import : std::as_const(m_importList)) {
|
||||
if (import->hasCategories() && import->importExpanded()) {
|
||||
@@ -174,6 +206,8 @@ void ItemLibraryModel::collapseAll()
|
||||
|
||||
void ItemLibraryModel::hideCategory(const QString &importUrl, const QString &categoryName)
|
||||
{
|
||||
NanotraceHR::Tracer tracer{"item library model hide category", category()};
|
||||
|
||||
ItemLibraryImport *import = importByUrl(importUrl);
|
||||
if (!import)
|
||||
return;
|
||||
@@ -186,6 +220,8 @@ void ItemLibraryModel::hideCategory(const QString &importUrl, const QString &cat
|
||||
|
||||
void ItemLibraryModel::showImportHiddenCategories(const QString &importUrl)
|
||||
{
|
||||
NanotraceHR::Tracer tracer{"item library model show import hidden categories", category()};
|
||||
|
||||
ItemLibraryImport *targetImport = nullptr;
|
||||
bool hiddenCatsExist = false;
|
||||
for (const QPointer<ItemLibraryImport> &import : std::as_const(m_importList)) {
|
||||
@@ -204,6 +240,8 @@ void ItemLibraryModel::showImportHiddenCategories(const QString &importUrl)
|
||||
|
||||
void ItemLibraryModel::showAllHiddenCategories()
|
||||
{
|
||||
NanotraceHR::Tracer tracer{"item library model show all hidden categories", category()};
|
||||
|
||||
for (const QPointer<ItemLibraryImport> &import : std::as_const(m_importList))
|
||||
import->showAllCategories();
|
||||
|
||||
@@ -214,27 +252,37 @@ void ItemLibraryModel::showAllHiddenCategories()
|
||||
|
||||
void ItemLibraryModel::setFlowMode(bool b)
|
||||
{
|
||||
NanotraceHR::Tracer tracer{"item library model set flow mode", category()};
|
||||
|
||||
m_flowMode = b;
|
||||
}
|
||||
|
||||
ItemLibraryModel::ItemLibraryModel(QObject *parent)
|
||||
: QAbstractListModel(parent)
|
||||
{
|
||||
NanotraceHR::Tracer tracer{"item library model constructor", category()};
|
||||
|
||||
addRoleNames();
|
||||
}
|
||||
|
||||
ItemLibraryModel::~ItemLibraryModel()
|
||||
{
|
||||
NanotraceHR::Tracer tracer{"item library model destructor", category()};
|
||||
|
||||
clearSections();
|
||||
}
|
||||
|
||||
int ItemLibraryModel::rowCount(const QModelIndex & /*parent*/) const
|
||||
{
|
||||
NanotraceHR::Tracer tracer{"item library model row count", category()};
|
||||
|
||||
return m_importList.size();
|
||||
}
|
||||
|
||||
QVariant ItemLibraryModel::data(const QModelIndex &index, int role) const
|
||||
{
|
||||
NanotraceHR::Tracer tracer{"item library model data", category()};
|
||||
|
||||
if (!index.isValid() || index.row() >= m_importList.size())
|
||||
return {};
|
||||
|
||||
@@ -255,6 +303,8 @@ QVariant ItemLibraryModel::data(const QModelIndex &index, int role) const
|
||||
|
||||
bool ItemLibraryModel::setData(const QModelIndex &index, const QVariant &value, int role)
|
||||
{
|
||||
NanotraceHR::Tracer tracer{"item library model set data", category()};
|
||||
|
||||
// currently only importExpanded property is updatable
|
||||
if (index.isValid() && m_roleNames.contains(role)) {
|
||||
QVariant currValue = m_importList.at(index.row())->property(m_roleNames.value(role));
|
||||
@@ -271,16 +321,22 @@ bool ItemLibraryModel::setData(const QModelIndex &index, const QVariant &value,
|
||||
|
||||
QHash<int, QByteArray> ItemLibraryModel::roleNames() const
|
||||
{
|
||||
NanotraceHR::Tracer tracer{"item library model role names", category()};
|
||||
|
||||
return m_roleNames;
|
||||
}
|
||||
|
||||
QString ItemLibraryModel::searchText() const
|
||||
{
|
||||
NanotraceHR::Tracer tracer{"item library model search text", category()};
|
||||
|
||||
return m_searchText;
|
||||
}
|
||||
|
||||
void ItemLibraryModel::setSearchText(const QString &searchText)
|
||||
{
|
||||
NanotraceHR::Tracer tracer{"item library model set search text", category()};
|
||||
|
||||
QString lowerSearchText = searchText.toLower();
|
||||
|
||||
if (m_searchText != lowerSearchText) {
|
||||
@@ -298,6 +354,8 @@ void ItemLibraryModel::setSearchText(const QString &searchText)
|
||||
|
||||
Import ItemLibraryModel::entryToImport(const ItemLibraryEntry &entry)
|
||||
{
|
||||
NanotraceHR::Tracer tracer{"item library model entry to import", category()};
|
||||
|
||||
#ifndef QDS_USE_PROJECTSTORAGE
|
||||
if (entry.majorVersion() == -1 && entry.minorVersion() == -1)
|
||||
return Import::createFileImport(entry.requiredImport());
|
||||
@@ -309,6 +367,8 @@ Import ItemLibraryModel::entryToImport(const ItemLibraryEntry &entry)
|
||||
|
||||
void ItemLibraryModel::update(Model *model)
|
||||
{
|
||||
NanotraceHR::Tracer tracer{"item library model update", category()};
|
||||
|
||||
if (!model)
|
||||
return;
|
||||
|
||||
@@ -489,6 +549,8 @@ void ItemLibraryModel::update(Model *model)
|
||||
|
||||
std::unique_ptr<QMimeData> ItemLibraryModel::getMimeData(const ItemLibraryEntry &itemLibraryEntry)
|
||||
{
|
||||
NanotraceHR::Tracer tracer{"item library model get mime data", category()};
|
||||
|
||||
auto mimeData = std::make_unique<QMimeData>();
|
||||
|
||||
QByteArray data;
|
||||
@@ -503,12 +565,16 @@ std::unique_ptr<QMimeData> ItemLibraryModel::getMimeData(const ItemLibraryEntry
|
||||
|
||||
void ItemLibraryModel::clearSections()
|
||||
{
|
||||
NanotraceHR::Tracer tracer{"item library model clear sections", category()};
|
||||
|
||||
qDeleteAll(m_importList);
|
||||
m_importList.clear();
|
||||
}
|
||||
|
||||
void ItemLibraryModel::updateSelection()
|
||||
{
|
||||
NanotraceHR::Tracer tracer{"item library model update selection", category()};
|
||||
|
||||
if (m_selectedCategoryIndex != -1) {
|
||||
ItemLibraryImport *selectedImport = importByUrl(m_selectedImportUrl);
|
||||
if (selectedImport) {
|
||||
@@ -526,11 +592,15 @@ void ItemLibraryModel::updateSelection()
|
||||
|
||||
void ItemLibraryModel::registerQmlTypes()
|
||||
{
|
||||
NanotraceHR::Tracer tracer{"item library model register QML types", category()};
|
||||
|
||||
qmlRegisterAnonymousType<QmlDesigner::ItemLibraryModel>("ItemLibraryModel", 1);
|
||||
}
|
||||
|
||||
ItemLibraryImport *ItemLibraryModel::importByUrl(const QString &importUrl) const
|
||||
{
|
||||
NanotraceHR::Tracer tracer{"item library model import by URL", category()};
|
||||
|
||||
for (ItemLibraryImport *itemLibraryImport : std::as_const(m_importList)) {
|
||||
if (itemLibraryImport->importUrl() == importUrl
|
||||
|| (importUrl.isEmpty() && itemLibraryImport->importUrl() == "QtQuick")
|
||||
@@ -547,6 +617,8 @@ ItemLibraryImport *ItemLibraryModel::importByUrl(const QString &importUrl) const
|
||||
|
||||
void ItemLibraryModel::updateUsedImports(const Imports &usedImports)
|
||||
{
|
||||
NanotraceHR::Tracer tracer{"item library model update used imports", category()};
|
||||
|
||||
// imports in the excludeList are not marked used and thus can always be removed even when in use.
|
||||
const QList<QString> excludeList = {"SimulinkConnector"};
|
||||
|
||||
@@ -558,6 +630,8 @@ void ItemLibraryModel::updateUsedImports(const Imports &usedImports)
|
||||
|
||||
void ItemLibraryModel::updateVisibility(bool *changed)
|
||||
{
|
||||
NanotraceHR::Tracer tracer{"item library model update visibility", category()};
|
||||
|
||||
for (ItemLibraryImport *import : std::as_const(m_importList)) {
|
||||
bool categoryChanged = false;
|
||||
bool hasVisibleItems = import->updateCategoryVisibility(m_searchText, &categoryChanged);
|
||||
@@ -574,6 +648,8 @@ void ItemLibraryModel::updateVisibility(bool *changed)
|
||||
|
||||
void ItemLibraryModel::addRoleNames()
|
||||
{
|
||||
NanotraceHR::Tracer tracer{"item library model add role names", category()};
|
||||
|
||||
int role = 0;
|
||||
const QMetaObject meta = ItemLibraryImport::staticMetaObject;
|
||||
for (int i = meta.propertyOffset(); i < meta.propertyCount(); ++i)
|
||||
@@ -582,6 +658,8 @@ void ItemLibraryModel::addRoleNames()
|
||||
|
||||
void ItemLibraryModel::sortSections()
|
||||
{
|
||||
NanotraceHR::Tracer tracer{"item library model sort sections", category()};
|
||||
|
||||
auto sectionSort = [](ItemLibraryImport *first, ItemLibraryImport *second) {
|
||||
return QString::localeAwareCompare(first->sortingName(), second->sortingName()) < 0;
|
||||
};
|
||||
|
@@ -0,0 +1,26 @@
|
||||
// Copyright (C) 2025 The Qt Company Ltd.
|
||||
// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR GPL-3.0-only WITH Qt-GPL-exception-1.0
|
||||
|
||||
#include "itemlibrarytracing.h"
|
||||
|
||||
#include <tracing/qmldesignertracing.h>
|
||||
|
||||
#include <sqlitebasestatement.h>
|
||||
|
||||
namespace QmlDesigner::ItemLibraryTracing {
|
||||
using namespace NanotraceHR::Literals;
|
||||
namespace {
|
||||
|
||||
thread_local Category category_{"model",
|
||||
Tracing::eventQueueWithStringArguments(),
|
||||
Tracing::eventQueueWithoutArguments(),
|
||||
category};
|
||||
|
||||
} // namespace
|
||||
|
||||
Category &category()
|
||||
{
|
||||
return category_;
|
||||
}
|
||||
|
||||
} // namespace QmlDesigner::ItemLibraryTracing
|
@@ -0,0 +1,26 @@
|
||||
// Copyright (C) 2025 The Qt Company Ltd.
|
||||
// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR GPL-3.0-only WITH Qt-GPL-exception-1.0
|
||||
|
||||
#include <qmldesignercomponents_global.h>
|
||||
|
||||
#include <nanotrace/nanotracehr.h>
|
||||
|
||||
#pragma once
|
||||
|
||||
namespace QmlDesigner::ItemLibraryTracing {
|
||||
|
||||
constexpr NanotraceHR::Tracing tracingStatus()
|
||||
{
|
||||
#ifdef ENABLE_ITEM_LIBRARY_TRACING
|
||||
return NanotraceHR::Tracing::IsEnabled;
|
||||
#else
|
||||
return NanotraceHR::Tracing::IsDisabled;
|
||||
#endif
|
||||
}
|
||||
|
||||
using Category = NanotraceHR::StringViewWithStringArgumentsCategory<tracingStatus()>;
|
||||
using SourceLocation = Category::SourceLocation;
|
||||
|
||||
[[gnu::pure]] QMLDESIGNERCOMPONENTS_EXPORT Category &category();
|
||||
|
||||
} // namespace QmlDesigner::ItemLibraryTracing
|
@@ -2,14 +2,16 @@
|
||||
// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR GPL-3.0-only WITH Qt-GPL-exception-1.0
|
||||
|
||||
#include "itemlibraryview.h"
|
||||
#include "itemlibrarytracing.h"
|
||||
#include "itemlibrarywidget.h"
|
||||
#include "metainfo.h"
|
||||
|
||||
#include <asynchronousimagecache.h>
|
||||
#include <bindingproperty.h>
|
||||
#include <componentcore_constants.h>
|
||||
#include <coreplugin/icore.h>
|
||||
#include <customnotifications.h>
|
||||
#include <import.h>
|
||||
#include <metainfo.h>
|
||||
#include <nodelistproperty.h>
|
||||
#include <projectexplorer/kit.h>
|
||||
#include <projectexplorer/project.h>
|
||||
@@ -24,23 +26,32 @@
|
||||
|
||||
namespace QmlDesigner {
|
||||
|
||||
static auto category = ItemLibraryTracing::category;
|
||||
|
||||
ItemLibraryView::ItemLibraryView(AsynchronousImageCache &imageCache,
|
||||
ExternalDependenciesInterface &externalDependencies)
|
||||
: AbstractView(externalDependencies)
|
||||
, m_imageCache(imageCache)
|
||||
{}
|
||||
{
|
||||
NanotraceHR::Tracer tracer{"item library view constructor", category()};
|
||||
}
|
||||
|
||||
ItemLibraryView::~ItemLibraryView()
|
||||
{
|
||||
NanotraceHR::Tracer tracer{"item library view destructor", category()};
|
||||
}
|
||||
|
||||
bool ItemLibraryView::hasWidget() const
|
||||
{
|
||||
NanotraceHR::Tracer tracer{"item library view has widget", category()};
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
WidgetInfo ItemLibraryView::widgetInfo()
|
||||
{
|
||||
NanotraceHR::Tracer tracer{"item library view widget info", category()};
|
||||
|
||||
if (m_widget.isNull())
|
||||
m_widget = new ItemLibraryWidget{m_imageCache};
|
||||
|
||||
@@ -53,6 +64,8 @@ WidgetInfo ItemLibraryView::widgetInfo()
|
||||
|
||||
void ItemLibraryView::modelAttached(Model *model)
|
||||
{
|
||||
NanotraceHR::Tracer tracer{"item library view model attached", category()};
|
||||
|
||||
AbstractView::modelAttached(model);
|
||||
|
||||
m_widget->clearSearchFilter();
|
||||
@@ -67,6 +80,8 @@ void ItemLibraryView::modelAttached(Model *model)
|
||||
|
||||
void ItemLibraryView::modelAboutToBeDetached(Model *model)
|
||||
{
|
||||
NanotraceHR::Tracer tracer{"item library view model about to be detached", category()};
|
||||
|
||||
AbstractView::modelAboutToBeDetached(model);
|
||||
|
||||
m_widget->setModel(nullptr);
|
||||
@@ -74,22 +89,30 @@ void ItemLibraryView::modelAboutToBeDetached(Model *model)
|
||||
|
||||
void ItemLibraryView::importsChanged(const Imports &, const Imports &)
|
||||
{
|
||||
NanotraceHR::Tracer tracer{"item library view imports changed", category()};
|
||||
|
||||
updateImports();
|
||||
m_widget->updatePossibleImports(model()->possibleImports());
|
||||
}
|
||||
|
||||
void ItemLibraryView::possibleImportsChanged(const Imports &possibleImports)
|
||||
{
|
||||
NanotraceHR::Tracer tracer{"item library view possible imports changed", category()};
|
||||
|
||||
m_widget->updatePossibleImports(possibleImports);
|
||||
}
|
||||
|
||||
void ItemLibraryView::usedImportsChanged(const Imports &usedImports)
|
||||
{
|
||||
NanotraceHR::Tracer tracer{"item library view used imports changed", category()};
|
||||
|
||||
m_widget->updateUsedImports(usedImports);
|
||||
}
|
||||
|
||||
void ItemLibraryView::documentMessagesChanged(const QList<DocumentMessage> &errors, const QList<DocumentMessage> &)
|
||||
{
|
||||
NanotraceHR::Tracer tracer{"item library view document messages changed", category()};
|
||||
|
||||
if (m_hasErrors && errors.isEmpty())
|
||||
updateImports();
|
||||
|
||||
@@ -98,6 +121,8 @@ void ItemLibraryView::documentMessagesChanged(const QList<DocumentMessage> &erro
|
||||
|
||||
void ItemLibraryView::updateImports()
|
||||
{
|
||||
NanotraceHR::Tracer tracer{"item library view update imports", category()};
|
||||
|
||||
m_widget->delayedUpdateModel();
|
||||
}
|
||||
|
||||
@@ -106,6 +131,8 @@ void ItemLibraryView::customNotification(const AbstractView *view,
|
||||
const QList<ModelNode> &nodeList,
|
||||
const QList<QVariant> &data)
|
||||
{
|
||||
NanotraceHR::Tracer tracer{"item library view custom notification", category()};
|
||||
|
||||
if (identifier == UpdateItemlibrary)
|
||||
updateImports();
|
||||
else
|
||||
|
@@ -6,16 +6,17 @@
|
||||
#include "itemlibraryconstants.h"
|
||||
#include "itemlibraryiconimageprovider.h"
|
||||
#include "itemlibraryimport.h"
|
||||
#include "itemlibrarytracing.h"
|
||||
|
||||
#include <theme.h>
|
||||
|
||||
#include "modelnodeoperations.h"
|
||||
#include <designeractionmanager.h>
|
||||
#include <designermcumanager.h>
|
||||
#include <documentmanager.h>
|
||||
#include <itemlibraryaddimportmodel.h>
|
||||
#include <itemlibraryentry.h>
|
||||
#include <itemlibraryimageprovider.h>
|
||||
#include <modelnodeoperations.h>
|
||||
#ifndef QDS_USE_PROJECTSTORAGE
|
||||
# include <itemlibraryinfo.h>
|
||||
#endif
|
||||
@@ -65,6 +66,8 @@
|
||||
|
||||
namespace QmlDesigner {
|
||||
|
||||
static auto category = ItemLibraryTracing::category;
|
||||
|
||||
static QString propertyEditorResourcesPath()
|
||||
{
|
||||
#ifdef SHARE_QML_PATH
|
||||
@@ -76,6 +79,8 @@ static QString propertyEditorResourcesPath()
|
||||
|
||||
bool ItemLibraryWidget::eventFilter(QObject *obj, QEvent *event)
|
||||
{
|
||||
NanotraceHR::Tracer tracer{"item library widget event filter", category()};
|
||||
|
||||
auto document = QmlDesignerPlugin::instance()->currentDesignDocument();
|
||||
Model *model = document ? document->documentModel() : nullptr;
|
||||
|
||||
@@ -123,6 +128,8 @@ bool ItemLibraryWidget::eventFilter(QObject *obj, QEvent *event)
|
||||
|
||||
void ItemLibraryWidget::resizeEvent(QResizeEvent *event)
|
||||
{
|
||||
NanotraceHR::Tracer tracer{"item library widget resize event", category()};
|
||||
|
||||
isHorizontalLayout = event->size().width() >= HORIZONTAL_LAYOUT_WIDTH_LIMIT;
|
||||
}
|
||||
|
||||
@@ -133,6 +140,8 @@ ItemLibraryWidget::ItemLibraryWidget(AsynchronousImageCache &imageCache)
|
||||
, m_itemsWidget(Utils::makeUniqueObjectPtr<StudioQuickWidget>())
|
||||
, m_imageCache{imageCache}
|
||||
{
|
||||
NanotraceHR::Tracer tracer{"item library widget constructor", category()};
|
||||
|
||||
m_compressionTimer.setInterval(1000);
|
||||
m_compressionTimer.setSingleShot(true);
|
||||
ItemLibraryModel::registerQmlTypes();
|
||||
@@ -189,7 +198,10 @@ ItemLibraryWidget::ItemLibraryWidget(AsynchronousImageCache &imageCache)
|
||||
reloadQmlSource();
|
||||
}
|
||||
|
||||
ItemLibraryWidget::~ItemLibraryWidget() = default;
|
||||
ItemLibraryWidget::~ItemLibraryWidget()
|
||||
{
|
||||
NanotraceHR::Tracer tracer{"item library widget destructor", category()};
|
||||
}
|
||||
|
||||
#ifndef QDS_USE_PROJECTSTORAGE
|
||||
void ItemLibraryWidget::setItemLibraryInfo(ItemLibraryInfo *itemLibraryInfo)
|
||||
@@ -212,12 +224,16 @@ void ItemLibraryWidget::setItemLibraryInfo(ItemLibraryInfo *itemLibraryInfo)
|
||||
|
||||
QList<QToolButton *> ItemLibraryWidget::createToolBarWidgets()
|
||||
{
|
||||
NanotraceHR::Tracer tracer{"item library widget create toolbar widgets", category()};
|
||||
|
||||
return {};
|
||||
}
|
||||
|
||||
|
||||
void ItemLibraryWidget::handleSearchFilterChanged(const QString &filterText)
|
||||
{
|
||||
NanotraceHR::Tracer tracer{"item library widget handle search filter changed", category()};
|
||||
|
||||
if (filterText != m_filterText) {
|
||||
m_filterText = filterText;
|
||||
updateSearch();
|
||||
@@ -226,6 +242,8 @@ void ItemLibraryWidget::handleSearchFilterChanged(const QString &filterText)
|
||||
|
||||
QString ItemLibraryWidget::getDependencyImport(const Import &import)
|
||||
{
|
||||
NanotraceHR::Tracer tracer{"item library widget get dependency import", category()};
|
||||
|
||||
static QStringList prefixDependencies = {"QtQuick3D"};
|
||||
|
||||
const QStringList splitImport = import.url().split('.');
|
||||
@@ -240,6 +258,8 @@ QString ItemLibraryWidget::getDependencyImport(const Import &import)
|
||||
|
||||
void ItemLibraryWidget::handleAddImport(int index)
|
||||
{
|
||||
NanotraceHR::Tracer tracer{"item library widget handle add import", category()};
|
||||
|
||||
Import import = m_addModuleModel->getImportAt(index);
|
||||
if (import.isLibraryImport() && (import.url().startsWith("QtQuick")
|
||||
|| import.url().startsWith("SimulinkConnector"))) {
|
||||
@@ -273,12 +293,18 @@ void ItemLibraryWidget::handleAddImport(int index)
|
||||
|
||||
void ItemLibraryWidget::goIntoComponent(const QString &source)
|
||||
{
|
||||
NanotraceHR::Tracer tracer{"item library widget go into component", category()};
|
||||
|
||||
DocumentManager::goIntoComponent(source);
|
||||
}
|
||||
|
||||
void ItemLibraryWidget::delayedUpdateModel()
|
||||
{
|
||||
static bool disableTimer = QmlDesignerPlugin::settings().value(DesignerSettingsKey::DISABLE_ITEM_LIBRARY_UPDATE_TIMER).toBool();
|
||||
NanotraceHR::Tracer tracer{"item library widget delayed update model", category()};
|
||||
|
||||
static bool disableTimer = QmlDesignerPlugin::settings()
|
||||
.value(DesignerSettingsKey::DISABLE_ITEM_LIBRARY_UPDATE_TIMER)
|
||||
.toBool();
|
||||
if (disableTimer)
|
||||
updateModel();
|
||||
else
|
||||
@@ -287,6 +313,8 @@ void ItemLibraryWidget::delayedUpdateModel()
|
||||
|
||||
void ItemLibraryWidget::setModel(Model *model)
|
||||
{
|
||||
NanotraceHR::Tracer tracer{"item library widget set model", category()};
|
||||
|
||||
m_model = model;
|
||||
if (!model) {
|
||||
m_itemToDrag = {};
|
||||
@@ -310,6 +338,8 @@ void ItemLibraryWidget::setModel(Model *model)
|
||||
|
||||
QString ItemLibraryWidget::qmlSourcesPath()
|
||||
{
|
||||
NanotraceHR::Tracer tracer{"item library widget qml sources path", category()};
|
||||
|
||||
#ifdef SHARE_QML_PATH
|
||||
if (::Utils::qtcEnvironmentVariableIsSet("LOAD_QML_FROM_SOURCE"))
|
||||
return QLatin1String(SHARE_QML_PATH) + "/itemLibraryQmlSources";
|
||||
@@ -319,16 +349,22 @@ QString ItemLibraryWidget::qmlSourcesPath()
|
||||
|
||||
void ItemLibraryWidget::clearSearchFilter()
|
||||
{
|
||||
NanotraceHR::Tracer tracer{"item library widget clear search filter", category()};
|
||||
|
||||
QMetaObject::invokeMethod(m_itemsWidget->rootObject(), "clearSearchFilter");
|
||||
}
|
||||
|
||||
void ItemLibraryWidget::switchToComponentsView()
|
||||
{
|
||||
NanotraceHR::Tracer tracer{"item library widget switch to components view", category()};
|
||||
|
||||
QMetaObject::invokeMethod(m_itemsWidget->rootObject(), "switchToComponentsView");
|
||||
}
|
||||
|
||||
void ItemLibraryWidget::reloadQmlSource()
|
||||
{
|
||||
NanotraceHR::Tracer tracer{"item library widget reload qml source", category()};
|
||||
|
||||
const QString itemLibraryQmlPath = qmlSourcesPath() + "/ItemsView.qml";
|
||||
QTC_ASSERT(QFileInfo::exists(itemLibraryQmlPath), return);
|
||||
m_itemsWidget->setSource(QUrl::fromLocalFile(itemLibraryQmlPath));
|
||||
@@ -336,6 +372,8 @@ void ItemLibraryWidget::reloadQmlSource()
|
||||
|
||||
void ItemLibraryWidget::updateModel()
|
||||
{
|
||||
NanotraceHR::Tracer tracer{"item library widget update model", category()};
|
||||
|
||||
QTC_ASSERT(m_itemLibraryModel, return);
|
||||
|
||||
if (m_compressionTimer.isActive()) {
|
||||
@@ -356,17 +394,23 @@ void ItemLibraryWidget::updateModel()
|
||||
|
||||
void ItemLibraryWidget::updatePossibleImports(const Imports &possibleImports)
|
||||
{
|
||||
NanotraceHR::Tracer tracer{"item library widget update possible imports", category()};
|
||||
|
||||
m_addModuleModel->update(set_difference(possibleImports, m_model->imports()));
|
||||
delayedUpdateModel();
|
||||
}
|
||||
|
||||
void ItemLibraryWidget::updateUsedImports(const Imports &usedImports)
|
||||
{
|
||||
NanotraceHR::Tracer tracer{"item library widget update used imports", category()};
|
||||
|
||||
m_itemLibraryModel->updateUsedImports(usedImports);
|
||||
}
|
||||
|
||||
void ItemLibraryWidget::updateSearch()
|
||||
{
|
||||
NanotraceHR::Tracer tracer{"item library widget update search", category()};
|
||||
|
||||
m_itemLibraryModel->setSearchText(m_filterText);
|
||||
m_itemsWidget->update();
|
||||
m_addModuleModel->setSearchText(m_filterText);
|
||||
@@ -374,6 +418,8 @@ void ItemLibraryWidget::updateSearch()
|
||||
|
||||
void ItemLibraryWidget::setIsDragging(bool val)
|
||||
{
|
||||
NanotraceHR::Tracer tracer{"item library widget set is dragging", category()};
|
||||
|
||||
if (m_isDragging != val) {
|
||||
m_isDragging = val;
|
||||
emit isDraggingChanged();
|
||||
@@ -382,6 +428,8 @@ void ItemLibraryWidget::setIsDragging(bool val)
|
||||
|
||||
void ItemLibraryWidget::startDragAndDrop(const QVariant &itemLibEntry, const QPointF &mousePos)
|
||||
{
|
||||
NanotraceHR::Tracer tracer{"item library widget start drag and drop", category()};
|
||||
|
||||
// Actual drag is created after mouse has moved to avoid a QDrag bug that causes drag to stay
|
||||
// active (and blocks mouse release) if mouse is released at the same spot of the drag start.
|
||||
m_itemToDrag = itemLibEntry;
|
||||
@@ -391,16 +439,22 @@ void ItemLibraryWidget::startDragAndDrop(const QVariant &itemLibEntry, const QPo
|
||||
|
||||
bool ItemLibraryWidget::subCompEditMode() const
|
||||
{
|
||||
NanotraceHR::Tracer tracer{"item library widget sub component edit mode", category()};
|
||||
|
||||
return m_subCompEditMode;
|
||||
}
|
||||
|
||||
void ItemLibraryWidget::setFlowMode(bool b)
|
||||
{
|
||||
NanotraceHR::Tracer tracer{"item library widget set flow mode", category()};
|
||||
|
||||
m_itemLibraryModel->setFlowMode(b);
|
||||
}
|
||||
|
||||
void ItemLibraryWidget::removeImport(const QString &importUrl)
|
||||
{
|
||||
NanotraceHR::Tracer tracer{"item library widget remove import", category()};
|
||||
|
||||
QTC_ASSERT(m_model, return);
|
||||
|
||||
ItemLibraryImport *importSection = m_itemLibraryModel->importByUrl(importUrl);
|
||||
@@ -412,6 +466,8 @@ void ItemLibraryWidget::removeImport(const QString &importUrl)
|
||||
|
||||
void ItemLibraryWidget::addImportForItem(const QString &importUrl)
|
||||
{
|
||||
NanotraceHR::Tracer tracer{"item library widget add import for item", category()};
|
||||
|
||||
QTC_ASSERT(m_itemLibraryModel, return);
|
||||
QTC_ASSERT(m_model, return);
|
||||
|
||||
|
@@ -49,7 +49,7 @@ extend_qtc_library(QmlDesignerCore
|
||||
)
|
||||
|
||||
extend_qtc_library(QmlDesignerCore
|
||||
CONDITION ENABLE_PROJECT_STORAGE_TRACING OR ENABLE_SOURCE_PATH_STORAGE_TRACING OR ENABLE_IMAGE_CACHE_TRACING OR ENABLE_MODEL_TRACING OR ENABLE_FORM_EDITOR_TRACING OR ENABLE_PROPERTY_EDITOR_TRACING OR ENABLE_NAVIGATOR_TRACING
|
||||
CONDITION ENABLE_PROJECT_STORAGE_TRACING OR ENABLE_SOURCE_PATH_STORAGE_TRACING OR ENABLE_IMAGE_CACHE_TRACING OR ENABLE_MODEL_TRACING OR ENABLE_FORM_EDITOR_TRACING OR ENABLE_PROPERTY_EDITOR_TRACING OR ENABLE_NAVIGATOR_TRACING OR ENABLE_ITEM_LIBRARY_TRACING
|
||||
PUBLIC_DEPENDS Nanotrace
|
||||
PUBLIC_DEFINES
|
||||
ENABLE_QMLDESIGNER_TRACING
|
||||
|
Reference in New Issue
Block a user