8#include <QtCore/private/qobject_p.h>
10#include <QCoreApplication>
11#include <QtQml/QQmlInfo>
12#include <QtLocation/QPlaceManager>
13#include <QtLocation/QPlaceIcon>
167 if (
row > node->childIds.count())
181 PlaceCategoryNode *childNode =
static_cast<PlaceCategoryNode *
>(
child.internalPointer());
185 return index(childNode->parentId);
193 PlaceCategoryNode *node =
static_cast<PlaceCategoryNode *
>(
index.internalPointer());
237 if (serviceProvider) {
241 this, &QDeclarativeSupportedCategoriesModel::addedCategory);
243 this, &QDeclarativeSupportedCategoriesModel::updatedCategory);
245 this, &QDeclarativeSupportedCategoriesModel::removedCategory);
247 this, &QDeclarativeSupportedCategoriesModel::emitDataChanged);
257 connectNotificationSignals();
263 this, &QDeclarativeSupportedCategoriesModel::connectNotificationSignals);
298 return m_hierarchical;
304void QDeclarativeSupportedCategoriesModel::replyFinished()
312 m_errorString.
clear();
314 m_response =
nullptr;
321 m_response =
nullptr;
336 if (!m_categoriesTree.
contains(parentId))
339 if (
category.categoryId().isEmpty())
346 int rowToBeAdded = rowToAddChild(parentNode,
category);
374 if (!m_categoriesTree.
contains(parentId))
377 if (
category.categoryId().isEmpty() || !m_categoriesTree.
contains(categoryId))
388 categoryNode->declCategory->setCategory(
category);
390 if (categoryNode->
parentId == parentId) {
392 int rowToBeAdded = rowToAddChild(newParentNode,
category);
393 int oldRow = newParentNode->
childIds.indexOf(categoryId);
396 if (
qAbs(rowToBeAdded - newParentNode->
childIds.indexOf(categoryId)) > 1) {
399 parentIndex, rowToBeAdded);
401 newParentNode->
childIds.removeAll(categoryId);
402 newParentNode->
childIds.insert(rowToBeAdded, categoryId);
416 int rowToBeAdded = rowToAddChild(newParentNode,
category);
418 oldParentNode->
childIds.indexOf(categoryId), newParentIndex, rowToBeAdded);
420 newParentNode->
childIds.insert(rowToBeAdded, categoryId);
434void QDeclarativeSupportedCategoriesModel::removedCategory(
const QString &categoryId,
const QString &parentId)
439 if (!m_categoriesTree.
contains(categoryId) || !m_categoriesTree.
contains(parentId))
447 parentNode->
childIds.removeAll(categoryId);
448 delete m_categoriesTree.
take(categoryId);
455void QDeclarativeSupportedCategoriesModel::connectNotificationSignals()
471 this, &QDeclarativeSupportedCategoriesModel::addedCategory);
473 this, &QDeclarativeSupportedCategoriesModel::updatedCategory);
475 this, &QDeclarativeSupportedCategoriesModel::removedCategory);
477 this, &QDeclarativeSupportedCategoriesModel::emitDataChanged);
518 this, &QDeclarativeSupportedCategoriesModel::replyFinished);
529void QDeclarativeSupportedCategoriesModel::updateLayout()
533 m_categoriesTree.
clear();
554 return m_errorString;
581 Status originalStatus = m_status;
585 if (originalStatus != m_status)
604 return lhs.
name() < rhs.name();
618 m_categoriesTree.
insert(node->declCategory->categoryId(), node);
619 childIds.append(
category.categoryId());
621 if (!m_hierarchical) {
622 childIds.append(populateCategories(
manager,node->declCategory->
category()));
636 if (!m_categoriesTree.
contains(categoryId))
Q_INVOKABLE int const QModelIndex & parent
Returns the parent of the model item with the given index.
void endResetModel()
Completes a model reset operation.
bool beginMoveRows(const QModelIndex &sourceParent, int sourceFirst, int sourceLast, const QModelIndex &destinationParent, int destinationRow)
void endRemoveRows()
Ends a row removal operation.
void endMoveRows()
Ends a row move operation.
virtual QHash< int, QByteArray > roleNames() const
void endInsertRows()
Ends a row insertion operation.
void beginResetModel()
Begins a model reset operation.
QModelIndex createIndex(int row, int column, const void *data=nullptr) const
Creates a model index for the given row and column with the internal pointer ptr.
void beginRemoveRows(const QModelIndex &parent, int first, int last)
Begins a row removal operation.
void beginInsertRows(const QModelIndex &parent, int first, int last)
Begins a row insertion operation.
static QString translate(const char *context, const char *key, const char *disambiguation=nullptr, int n=-1)
\threadsafe
QGeoServiceProvider * sharedGeoServiceProvider() const
int rowCount(const QModelIndex &parent) const override
Q_INVOKABLE QVariant data(const QModelIndex &index, int role) const override
void setPlugin(QDeclarativeGeoServiceProvider *plugin)
QModelIndex index(int row, int column, const QModelIndex &parent) const override
Q_INVOKABLE QString errorString() const
QDeclarativeSupportedCategoriesModel(QObject *parent=nullptr)
void componentComplete() override
virtual ~QDeclarativeSupportedCategoriesModel()
QDeclarativeGeoServiceProvider * plugin
QHash< int, QByteArray > roleNames() const override
void hierarchicalChanged()
void setStatus(Status status, const QString &errorString=QString())
\qmlproperty enumeration CategoryModel::status
void setHierarchical(bool hierarchical)
int columnCount(const QModelIndex &parent) const override
Error error() const
Returns an error code describing the error which occurred during the last operation that was performe...
QPlaceManager * placeManager() const
Returns the QPlaceManager made available by the service provider.
QString errorString() const
Returns a string describing the error which occurred during the last operation that was performed by ...
T take(const Key &key)
Removes the item with the key from the hash and returns the value associated with it.
QList< Key > keys() const
Returns a list containing all the keys in the hash, in an arbitrary order.
bool contains(const Key &key) const noexcept
Returns true if the hash contains an item with the key; otherwise returns false.
T value(const Key &key) const noexcept
void clear() noexcept(std::is_nothrow_destructible< Node >::value)
Removes all items from the hash and frees up all memory used by it.
iterator insert(const Key &key, const T &value)
Inserts a new item with the key and a value of value.
bool isEmpty() const noexcept
constexpr int row() const noexcept
Returns the row this model index refers to.
void * internalPointer() const noexcept
Returns a {void} {*} pointer used by the model to associate the index with the internal data structur...
static QMetaObject::Connection connect(const QObject *sender, const char *signal, const QObject *receiver, const char *member, Qt::ConnectionType=Qt::AutoConnection)
\threadsafe
void deleteLater()
\threadsafe
QString categoryId() const
Returns the identifier of the category.
QString name() const
Returns the name of category.
void categoryAdded(const QPlaceCategory &category, const QString &parentId)
This signal is emitted if a category has been added to the manager's datastore.
QPlaceReply * initializeCategories()
Initializes the categories of the manager.
void categoryRemoved(const QString &categoryId, const QString &parentId)
This signal is emitted when the category corresponding to categoryId has been removed from the manage...
void dataChanged()
This signal is emitted by the manager if there are large scale changes to its underlying datastore an...
void categoryUpdated(const QPlaceCategory &category, const QString &parentId)
This signal is emitted if a category has been modified in the manager's datastore.
QPlaceReply::Error error() const
Returns the error code.
void finished()
This signal is emitted when this reply has finished processing.
QString errorString() const
Returns the error string of the reply.
\macro QT_RESTRICTED_CAST_FROM_ASCII
void clear()
Clears the contents of the string and makes it null.
const QChar at(qsizetype i) const
Returns the character at the given index position in the string.
bool isEmpty() const
Returns true if the string has no characters; otherwise returns false.
static auto fromValue(T &&value) noexcept(std::is_nothrow_copy_constructible_v< T > &&Private::CanUseInternalSpace< T >) -> std::enable_if_t< std::conjunction_v< std::is_copy_constructible< T >, std::is_destructible< T > >, QVariant >
const QLoggingCategory & category()
[1]
qDeleteAll(list.begin(), list.end())
QT_BEGIN_NAMESPACE const char CONTEXT_NAME[]
const char PLUGIN_ERROR[]
const char PLUGIN_PROVIDER_ERROR[]
const char PLUGIN_PROPERTY_NOT_SET[]
const char CATEGORIES_NOT_INITIALIZED[]
Combined button and popup list for selecting options.
constexpr T qAbs(const T &t)
GLenum GLenum GLsizei void GLsizei void * column
GLsizei GLenum * categories
GLenum GLenum GLsizei void * row
myObject disconnect()
[26]
QNetworkAccessManager manager
bool contains(const AT &t) const noexcept
IUIAutomationTreeWalker __RPC__deref_out_opt IUIAutomationElement ** parent