Fluid
Loading...
Searching...
No Matches
controlsutils.h
Go to the documentation of this file.
1/*
2 * This file is part of Fluid.
3 *
4 * Copyright (C) 2018 Pier Luigi Fiorini <pierluigi.fiorini@gmail.com>
5 *
6 * $BEGIN_LICENSE:MPL2$
7 *
8 * This Source Code Form is subject to the terms of the Mozilla Public
9 * License, v. 2.0. If a copy of the MPL was not distributed with this
10 * file, You can obtain one at http://mozilla.org/MPL/2.0/.
11 *
12 * $END_LICENSE$
13 */
14
15#pragma once
16
17#include <QObject>
18#include <QUrl>
19#include <QQmlEngine>
20
24class ControlsUtils : public QObject
25{
26 Q_OBJECT
27 QML_NAMED_ELEMENT(Utils)
28 QML_SINGLETON
29public:
30 explicit ControlsUtils(const QUrl &baseUrl, QObject *parent = nullptr);
31
35 Q_INVOKABLE qreal scale(qreal percent, qreal start, qreal end);
36
63 Q_INVOKABLE QUrl iconUrl(const QString &name);
64
65 static ControlsUtils *create(QQmlEngine *engine, QJSEngine *jsEngine);
66
67private:
68 QUrl m_baseUrl;
69};
70
A collection of helpful utility methods.
Definition controlsutils.h:25
Q_INVOKABLE QUrl iconUrl(const QString &name)
Definition controlsutils.cpp:28
static ControlsUtils * create(QQmlEngine *engine, QJSEngine *jsEngine)
Definition controlsutils.cpp:37
Q_INVOKABLE qreal scale(qreal percent, qreal start, qreal end)
Definition controlsutils.cpp:23