MauiKit File Browsing

filebrowsing_plugin.h
1// SPDX-FileCopyrightText: 2020 Camilo Higuita <milo.h@aol.com>
2//
3// SPDX-License-Identifier: LGPL-2.1-or-later
4
5#pragma once
6
7#include <QDir>
8#include <QQmlExtensionPlugin>
9
10/**
11 * @private
12 */
13class FileBrowsingPlugin : public QQmlExtensionPlugin
14{
16 Q_PLUGIN_METADATA(IID QQmlExtensionInterface_iid)
17
18public:
19 void registerTypes(const char *uri) override;
20
21private:
22 QUrl componentUrl(const QString &fileName) const;
23
24 void initializeEngine(QQmlEngine *engine, const char *uri) override;
25
26 QString resolveFileUrl(const QString &filePath) const
27 {
28#if defined(Q_OS_ANDROID)
29 return QStringLiteral(":/qt/qml/org/mauikit/filebrowsing/") + filePath;
30#else
31 return baseUrl().toString() + QLatin1Char('/') + filePath;
32#endif
33 }
34};
Q_OBJECTQ_OBJECT
This file is part of the KDE documentation.
Documentation copyright © 1996-2024 The KDE developers.
Generated on Fri Dec 27 2024 11:48:47 by doxygen 1.12.0 written by Dimitri van Heesch, © 1997-2006

KDE's Doxygen guidelines are available online.