• Skip to content
  • Skip to link menu
Brand

API Documentation

  1. KDE API Reference
  2. Kirigami
  • KDE Home
  • Contact Us

Quick Links

Skip menu "Kirigami"
  • Main Page
  • Alphabetical List
  • Class List
  • Class Hierarchy
  • File List
  • Related Pages

Class Picker

About

QtQuick plugins to build user interfaces based on the KDE UX guidelines

Maintainer
Marco Martin
Supported platforms
Android, Linux
Community
IRC: #plasma on Freenode
Mailing list: plasma-devel
Use with CMake
find_package(KF5Kirigami)
target_link_libraries(yourapp KF5::Kirigami)
Clone
git clone git://anongit.kde.org/kirigami1.git
Browse source
Kirigami on cgit.kde.org

Kirigami

  • src
kirigamiplugin.h
1 /*
2  * Copyright 2009 by Alan Alpert <alan.alpert@nokia.com>
3  * Copyright 2010 by Ménard Alexis <menard@kde.org>
4  * Copyright 2010 by Marco Martin <mart@kde.org>
5 
6  * This program is free software; you can redistribute it and/or modify
7  * it under the terms of the GNU Library General Public License as
8  * published by the Free Software Foundation; either version 2, or
9  * (at your option) any later version.
10  *
11  * This program is distributed in the hope that it will be useful,
12  * but WITHOUT ANY WARRANTY; without even the implied warranty of
13  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
14  * GNU Library General Public License for more details
15  *
16  * You should have received a copy of the GNU Library General Public
17  * License along with this program; if not, write to the
18  * Free Software Foundation, Inc.,
19  * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
20  */
21 
22 #ifndef MOBILECOMPONENTSPLUGIN_H
23 #define MOBILECOMPONENTSPLUGIN_H
24 
25 #ifdef KIRIGAMI_BUILD_TYPE_STATIC
26 #include <QObject>
27 #include <QString>
28 #include <QUrl>
29 #else
30 #include <QQmlEngine>
31 #include <QQmlExtensionPlugin>
32 #include <QUrl>
33 #endif
34 
35 
36 #ifdef KIRIGAMI_BUILD_TYPE_STATIC
37 
38 class KirigamiPlugin : public QObject
39 {
40 public:
41  static KirigamiPlugin& getInstance()
42  {
43  static KirigamiPlugin instance;
44  return instance;
45  }
46  KirigamiPlugin(KirigamiPlugin const&) = delete;
47  void operator=(KirigamiPlugin const&) = delete;
48  void registerTypes(const char *uri);
49  static void registerTypes()
50  {
51  getInstance().registerTypes("org.kde.kirigami");
52  }
53 
54 private:
55  KirigamiPlugin() {}
56  QString componentPath(const QString &fileName) const;
57  QString resolveFilePath(const QString &path) const
58  {
59  return QLatin1Char(':') + path;
60  }
61  QString resolveFileUrl(const QString &filePath) const
62  {
63  if (filePath.startsWith(QLatin1Char(':'))) {
64  return QStringLiteral("qrc:") + filePath.right(filePath.length() - 1);
65  }
66  return QStringLiteral("qrc:/") + filePath;
67  }
68  QStringList m_stylesFallbackChain;
69 };
70 
71 #else
72 
73 class KirigamiPlugin : public QQmlExtensionPlugin
74 {
75  Q_OBJECT
76  Q_PLUGIN_METADATA(IID "org.qt-project.Qt.QQmlExtensionInterface")
77 
78 public:
79  void registerTypes(const char *uri);
80 
81 private:
82  QString componentPath(const QString &fileName) const;
83  QString resolveFilePath(const QString &path) const
84  {
85  return baseUrl().toLocalFile() + QLatin1Char('/') + path;
86  }
87  QString resolveFileUrl(const QString &filePath) const
88  {
89  return baseUrl().toString() + QLatin1Char('/') + filePath;
90  }
91  QStringList m_stylesFallbackChain;
92 };
93 
94 #endif
95 
96 #endif
This file is part of the KDE documentation.
Documentation copyright © 1996-2017 The KDE developers.
Generated on Fri Feb 17 2017 11:09:23 by doxygen 1.8.6 written by Dimitri van Heesch, © 1997-2006

KDE's Doxygen guidelines are available online.

Report problems with this website to our bug tracking system.
Contact the specific authors with questions and comments about the page contents.

KDE® and the K Desktop Environment® logo are registered trademarks of KDE e.V. | Legal