Skip to content

Commit 0598811

Browse files
committed
feat: convert documentation of C++ types to Doxygen
1 parent 6b026fc commit 0598811

File tree

6 files changed

+70
-96
lines changed

6 files changed

+70
-96
lines changed

src/imports/controls/clipboard.cpp

-18
Original file line numberDiff line numberDiff line change
@@ -17,26 +17,13 @@
1717

1818
#include "clipboard.h"
1919

20-
/*!
21-
\qmltype Clipboard
22-
\inqmlmodule Fluid
23-
\ingroup fluid
24-
25-
\brief Clipboard.
26-
*/
27-
2820
Clipboard::Clipboard(QObject *parent)
2921
: QObject(parent)
3022
, m_clipboard(QGuiApplication::clipboard())
3123
{
3224
connect(m_clipboard, &QClipboard::dataChanged, this, &Clipboard::textChanged);
3325
}
3426

35-
/*!
36-
\qmlproperty string Clipboard::text
37-
38-
This property holds the clipboard text.
39-
*/
4027
QString Clipboard::text() const
4128
{
4229
return m_clipboard->text();
@@ -47,11 +34,6 @@ void Clipboard::setText(const QString &text)
4734
m_clipboard->setText(text);
4835
}
4936

50-
/*!
51-
\qmlmethod void Clipboard::clear()
52-
53-
Clear the global clipboard contents.
54-
*/
5537
void Clipboard::clear()
5638
{
5739
m_clipboard->clear();

src/imports/controls/clipboard.h

+9
Original file line numberDiff line numberDiff line change
@@ -18,6 +18,9 @@
1818
#include <QClipboard>
1919
#include <QtQml/qqmlregistration.h>
2020

21+
/*!
22+
\brief Clipboard.
23+
*/
2124
class Clipboard : public QObject
2225
{
2326
Q_OBJECT
@@ -26,8 +29,14 @@ class Clipboard : public QObject
2629
public:
2730
explicit Clipboard(QObject *parent = nullptr);
2831

32+
/*!
33+
This property holds the clipboard text.
34+
*/
2935
QString text() const;
3036

37+
/*!
38+
Clear the global clipboard contents.
39+
*/
3140
Q_INVOKABLE void clear();
3241

3342
public Q_SLOTS:

src/imports/controls/color.cpp

-38
Original file line numberDiff line numberDiff line change
@@ -14,37 +14,16 @@
1414

1515
#include "color.h"
1616

17-
/*!
18-
\qmltype Color
19-
\instantiates Color
20-
\inqmlmodule Fluid
21-
22-
\brief Utility functions for colors.
23-
24-
Utility functions to manipulate colors.
25-
*/
26-
2717
Color::Color(QObject *parent)
2818
: QObject(parent)
2919
{
3020
}
3121

32-
/*!
33-
\qmlmethod color Fluid.Controls::Color::transparent(color color, real alpha)
34-
35-
A utility method for changing the \a alpha on \a color.
36-
Returns a new object, and does not modify the original color at all.
37-
*/
3822
QColor Color::transparent(const QColor &color, qreal alpha)
3923
{
4024
return QColor(color.red(), color.green(), color.blue(), int(qBound<qreal>(0.0, alpha, 1.0) * 255));
4125
}
4226

43-
/*!
44-
\qmlmethod color Fluid.Controls::Color::blend(color color1, color color2, real alpha)
45-
46-
Blend \a color1 and \a color2 together and set alpha to \a alpha.
47-
*/
4827
QColor Color::blend(const QColor &color1, const QColor &color2, qreal alpha)
4928
{
5029
QColor color;
@@ -54,34 +33,17 @@ QColor Color::blend(const QColor &color1, const QColor &color2, qreal alpha)
5433
return transparent(color, alpha);
5534
}
5635

57-
/*!
58-
\qmlmethod real Fluid.Controls::Color::luminance(color color)
59-
60-
Calculate luminance of \a color.
61-
*/
6236
qreal Color::luminance(const QColor &color)
6337
{
6438
return (color.redF() * 0.2126) + (color.greenF() * 0.7152) + (color.blueF() * 0.0722);
6539
}
6640

67-
/*!
68-
\qmlmethod bool Fluid.Controls::Color::isDarkColor(color color)
69-
70-
Returns \c true if \a color is dark and should have light content on top.
71-
*/
7241
bool Color::isDarkColor(const QColor &color)
7342
{
7443
auto a = 1.0 - (0.299 * color.redF() + 0.587 * color.greenF() + 0.114 * color.blueF());
7544
return color.alphaF() > 0.0 && a >= 0.3;
7645
}
7746

78-
/*!
79-
\qmlmethod color Fluid.Controls::Color::lightDark(color background, color lightColor, color darkColor)
80-
81-
Select a color depending on whether \a background color is light or dark.
82-
Returns \a lightColor if \a background is a light color, otherwise
83-
returns \a darkColor.
84-
*/
8547
QColor Color::lightDark(const QColor &background, const QColor &lightColor, const QColor &darkColor)
8648
{
8749
return isDarkColor(background) ? darkColor : lightColor;

src/imports/controls/color.h

+28
Original file line numberDiff line numberDiff line change
@@ -18,6 +18,11 @@
1818
#include <QObject>
1919
#include <QQmlEngine>
2020

21+
/*!
22+
\brief Utility functions for colors.
23+
24+
Utility functions to manipulate colors.
25+
*/
2126
class Color : public QObject
2227
{
2328
Q_OBJECT
@@ -26,10 +31,33 @@ class Color : public QObject
2631
public:
2732
explicit Color(QObject *parent = nullptr);
2833

34+
/*!
35+
A utility method for changing the \a alpha on \a color.
36+
Returns a new object, and does not modify the original color at all.
37+
*/
2938
Q_INVOKABLE QColor transparent(const QColor &color, qreal alpha);
39+
40+
41+
/*!
42+
Blend \a color1 and \a color2 together and set alpha to \a alpha.
43+
*/
3044
Q_INVOKABLE QColor blend(const QColor &color1, const QColor &color2, qreal alpha);
45+
46+
/*!
47+
Calculate luminance of \a color.
48+
*/
3149
Q_INVOKABLE qreal luminance(const QColor &color);
50+
51+
/*!
52+
Returns \c true if \a color is dark and should have light content on top.
53+
*/
3254
Q_INVOKABLE bool isDarkColor(const QColor &color);
55+
56+
/*!
57+
Select a color depending on whether \a background color is light or dark.
58+
Returns \a lightColor if \a background is a light color, otherwise
59+
returns \a darkColor.
60+
*/
3361
Q_INVOKABLE QColor lightDark(const QColor &background, const QColor &lightColor,
3462
const QColor &darkColor);
3563

src/imports/controls/controlsutils.cpp

-40
Original file line numberDiff line numberDiff line change
@@ -14,57 +14,17 @@
1414

1515
#include "controlsutils.h"
1616

17-
/*!
18-
\qmltype Fluid.Controls::Utils
19-
\inqmlmodule Fluid
20-
\ingroup fluid
21-
22-
\brief A collection of helpful utility methods.
23-
*/
2417
ControlsUtils::ControlsUtils(const QUrl &baseUrl, QObject *parent)
2518
: QObject(parent)
2619
, m_baseUrl(baseUrl)
2720
{
2821
}
2922

30-
/*!
31-
\qmlmethod real Fluid::Utils::scale(real percent, real start, real end)
32-
33-
Scale \a percent in the range between \a start and \a end.
34-
*/
3523
qreal ControlsUtils::scale(qreal percent, qreal start, qreal end)
3624
{
3725
return start + ((end - start) * (percent / 100));
3826
}
3927

40-
/*!
41-
\qmlmethod url Fluid::Utils::iconUrl(string name)
42-
43-
Returns an URL for the Material Design icon \a name.
44-
Use this URL with Image or icon grouped property with controls.
45-
46-
\code
47-
import QtQuick
48-
import Fluid as Fluid
49-
50-
Image {
51-
source: Fluid.Utils.iconUrl("action/alarm")
52-
width: 64
53-
height: 64
54-
}
55-
\endcode
56-
57-
\code
58-
import QtQuick
59-
import QtQuick.Controls
60-
import Fluid as Fluid
61-
62-
Button {
63-
icon.source: Fluid.Utils.iconUrl("action/alarm")
64-
text: qsTr("Alarm")
65-
}
66-
\endcode
67-
*/
6828
QUrl ControlsUtils::iconUrl(const QString &name)
6929
{
7030
#if FLUID_INSTALL_ICONS == 1

src/imports/controls/controlsutils.h

+33
Original file line numberDiff line numberDiff line change
@@ -18,6 +18,9 @@
1818
#include <QUrl>
1919
#include <QQmlEngine>
2020

21+
/*!
22+
\brief A collection of helpful utility methods.
23+
*/
2124
class ControlsUtils : public QObject
2225
{
2326
Q_OBJECT
@@ -26,7 +29,37 @@ class ControlsUtils : public QObject
2629
public:
2730
explicit ControlsUtils(const QUrl &baseUrl, QObject *parent = nullptr);
2831

32+
/*!
33+
Scale \a percent in the range between \a start and \a end.
34+
*/
2935
Q_INVOKABLE qreal scale(qreal percent, qreal start, qreal end);
36+
37+
/*!
38+
Returns an URL for the Material Design icon \a name.
39+
Use this URL with Image or icon grouped property with controls.
40+
41+
\code{.qml}
42+
import QtQuick
43+
import Fluid as Fluid
44+
45+
Image {
46+
source: Fluid.Utils.iconUrl("action/alarm")
47+
width: 64
48+
height: 64
49+
}
50+
\endcode
51+
52+
\code{.qml}
53+
import QtQuick
54+
import QtQuick.Controls
55+
import Fluid as Fluid
56+
57+
Button {
58+
icon.source: Fluid.Utils.iconUrl("action/alarm")
59+
text: qsTr("Alarm")
60+
}
61+
\endcode
62+
*/
3063
Q_INVOKABLE QUrl iconUrl(const QString &name);
3164

3265
static ControlsUtils *create(QQmlEngine *engine, QJSEngine *jsEngine);

0 commit comments

Comments
 (0)