Skip to content
This repository was archived by the owner on Mar 4, 2023. It is now read-only.

Commit 510e36b

Browse files
committed
added core qml doc
1 parent 36fdab3 commit 510e36b

File tree

10 files changed

+196
-27
lines changed

10 files changed

+196
-27
lines changed

doc/Doxyfile

Lines changed: 8 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -311,7 +311,7 @@ OPTIMIZE_OUTPUT_VHDL = NO
311311
# Note that for custom extensions you also need to set FILE_PATTERNS otherwise
312312
# the files are not read by doxygen.
313313

314-
EXTENSION_MAPPING =
314+
EXTENSION_MAPPING = qmldoc=C++
315315

316316
# If the MARKDOWN_SUPPORT tag is enabled then doxygen pre-processes all comments
317317
# according to the Markdown format, which allows for more readable
@@ -878,7 +878,8 @@ FILE_PATTERNS = *.c \
878878
*.qsf \
879879
*.as \
880880
*.js \
881-
*.qdoc
881+
*.qdoc \
882+
*.qmldoc
882883

883884
# The RECURSIVE tag can be used to specify whether or not subdirectories should
884885
# be searched for input files as well.
@@ -893,7 +894,9 @@ RECURSIVE = YES
893894
# Note that relative paths are relative to the directory from which doxygen is
894895
# run.
895896

896-
EXCLUDE = ../src/3rdparty ../src/imports ../src/plugins
897+
EXCLUDE = ../src/3rdparty \
898+
../src/imports/ \
899+
../src/plugins
897900

898901
# The EXCLUDE_SYMLINKS tag can be used to select whether or not files or
899902
# directories that are symbolic links (a Unix file system feature) are excluded
@@ -928,6 +931,7 @@ EXCLUDE_PATTERNS = moc_* \
928931
EXCLUDE_SYMBOLS = QtMvvm::__helpertypes \
929932
\
930933
QAbstractAspect \
934+
QAndroidActivityResultReceiver \
931935
QBasicAtomicInteger \
932936
QBasicAtomicPointer \
933937
QBasicMutex \
@@ -1002,7 +1006,7 @@ INPUT_FILTER =
10021006
# need to set EXTENSION_MAPPING for the extension otherwise the files are not
10031007
# properly processed by doxygen.
10041008

1005-
FILTER_PATTERNS =
1009+
FILTER_PATTERNS = *.qmldoc=doxyqml
10061010

10071011
# If the FILTER_SOURCE_FILES tag is set to YES, the input filter (if set using
10081012
# INPUT_FILTER) will also be used to filter the input files that are used for

doc/binding.dox

Lines changed: 2 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -11,18 +11,13 @@ hold any references to it. This class serves as a passive watcher over a binding
1111
*/
1212

1313
/*!
14-
@property QtMvvm::Binding::valid
14+
@fn QtMvvm::Binding::isValid
1515

16-
@default{`false`}
16+
@returns `true` If the binding is valid and active, `false` if invalid or already unbound
1717

1818
A binding is considered valid is if has successfully been set up and has not been unbound yet.
1919
A valid binding means view and viewModel are valid can the properties could be found.
2020

21-
@accessors{
22-
@readAc{isValid()}
23-
@finalAc
24-
}
25-
2621
@sa Binding::unbind, bind()
2722
*/
2823

doc/doc.pro

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,7 @@ OTHER_FILES += Doxyfile \
55
doxme.py \
66
../README.md \
77
*.dox \
8+
qmldoc/mvvmcore/* \
89
snippets/*.cpp \
910
images/*
1011

doc/qmldoc/mvvmcore/Message.h

Lines changed: 53 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,53 @@
1+
#include <QObject>
2+
3+
//! A QML signelton to access the QtMvvm namespace methods for showing simple dialogs
4+
class Message : public QObject
5+
{
6+
public:
7+
//! @brief A QML version of the QtMvvm::information method
8+
//! @copydetails QtMvvm::information(const QString &, const QString &, const std::function<void()> &, const QString &)
9+
static void information(string title, string text, function onResult, string okText);
10+
//! @brief A QML version of the QtMvvm::question method
11+
//! @copydoc QtMvvm::question(const QString &, const QString &, const std::function<void(bool)> &, const QString &, const QString &)
12+
static void question(string title, string text, function onResult, string yesText, string noText);
13+
//! @brief A QML version of the QtMvvm::warning method
14+
//! @copydoc QtMvvm::warning(const QString &, const QString &, const std::function<void()> &, const QString &)
15+
static void warning(string title, string text, function onResult, string okText);
16+
//! @brief A QML version of the QtMvvm::critical method
17+
//! @copydoc QtMvvm::critical(const QString &, const QString &, const std::function<void()> &, const QString &)
18+
static void critical(string title, string text, function onResult, string okText);
19+
//! @brief A QML version of the QtMvvm::about method
20+
//! @copydoc QtMvvm::about
21+
static void about(string description,
22+
url websiteUrl,
23+
string licenseName,
24+
url licenseUrl,
25+
string companyName,
26+
bool addQtVersion,
27+
list extraTopInfos,
28+
string extraBottomInfos);
29+
30+
//! @brief A QML version of the QtMvvm::getInput method
31+
//! @copydoc QtMvvm::getInput(const QString &, const QString &, const char *, const std::function<void(QVariant)> &, const QVariant &, const QVariantMap &, const QString &, const QString &)
32+
static void getInput(string title,
33+
string text,
34+
string inputType,
35+
function onResult,
36+
var defaultValue,
37+
object viewProperties,
38+
string okText,
39+
string cancelText);
40+
41+
//! @brief A QML version of the QtMvvm::getExistingDirectory method
42+
//! @copydoc QtMvvm::getExistingDirectory(const std::function<void(QUrl)> &, const QString &, const QUrl &)
43+
static void getExistingDirectory(function onResult, string title, url dir);
44+
//! @brief A QML version of the QtMvvm::getOpenFile method
45+
//! @copydoc QtMvvm::getOpenFile(const std::function<void(QUrl)> &, const QString &, const QStringList &, const QUrl &)
46+
static void getOpenFile(function onResult, string title, list supportedMimeTypes, url dir);
47+
//! @brief A QML version of the QtMvvm::getOpenFiles method
48+
//! @copydoc QtMvvm::getOpenFiles(const std::function<void(QList<QUrl>)> &, const QString &, const QStringList &, const QUrl &)
49+
static void getOpenFiles(function onResult, string title, list supportedMimeTypes, url dir);
50+
//! @brief A QML version of the QtMvvm::getSaveFile method
51+
//! @copydoc QtMvvm::getSaveFile(const std::function<void(QUrl)> &, const QString &, const QStringList &, const QUrl &)
52+
static void getSaveFile(function onResult, string title, list supportedMimeTypes, url dir);
53+
}

doc/qmldoc/mvvmcore/MvvmBinding.h

Lines changed: 119 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,119 @@
1+
#include <QObject>
2+
3+
/*! @brief A QML class to create a local mvvm multiway binding
4+
*
5+
* It is basically a wrapper around the QtMvvm::bind method. The parameters are set via the
6+
* properties, and once the binding component is completed, it will create the binding. It is
7+
* possible to modify the properties while running. This will recreate the binding, discarding
8+
* the previous one
9+
*
10+
* @sa QtMvvm::bind
11+
*/
12+
class MvvmBinding : public QObject
13+
{
14+
/*! @brief The object in the role of a viewmodel
15+
*
16+
* @default{`null`}
17+
* @accessors{
18+
* @memberAc{viewModel}
19+
* @notifyAc{viewModelChanged()}
20+
* }
21+
* @sa QtMvvm::bind
22+
*/
23+
Q_PROPERTY(QObject* viewModel MEMBER viewModel NOTIFY viewModelChanged)
24+
/*! @brief The property of the viewmodel to use in the binding
25+
*
26+
* @default{<i>Empty</i>}
27+
* @accessors{
28+
* @memberAc{viewModelProperty}
29+
* @notifyAc{viewModelPropertyChanged()}
30+
* }
31+
* @sa QtMvvm::bind
32+
*/
33+
Q_PROPERTY(QString viewModelProperty MEMBER viewModelProperty NOTIFY viewModelPropertyChanged)
34+
/*! @brief The object in the role of a view
35+
*
36+
* @default{`parent()`}
37+
* @accessors{
38+
* @memberAc{view}
39+
* @notifyAc{viewChanged()}
40+
* }
41+
* @sa QtMvvm::bind
42+
*/
43+
Q_PROPERTY(QObject* view MEMBER view NOTIFY viewChanged)
44+
/*! @brief The property of the view to use in the binding
45+
*
46+
* @default{<i>Empty</i>}
47+
* @accessors{
48+
* @memberAc{viewProperty}
49+
* @notifyAc{viewPropertyChanged()}
50+
* }
51+
* @sa QtMvvm::bind
52+
*/
53+
Q_PROPERTY(QString viewProperty MEMBER viewProperty NOTIFY viewPropertyChanged)
54+
/*! @brief An alternative signal to be used instead of the viewModelProperty notify signal
55+
* to detect property changes
56+
*
57+
* @default{<i>Empty</i>}
58+
* @accessors{
59+
* @memberAc{viewModelChangeSignal}
60+
* @notifyAc{viewModelChangeSignalChanged()}
61+
* }
62+
* @sa QtMvvm::bind
63+
*/
64+
Q_PROPERTY(QString viewModelChangeSignal MEMBER viewModelChangeSignal NOTIFY viewModelChangeSignalChanged)
65+
/*! @brief An alternative signal to be used instead of the viewProperty notify signal to
66+
* detect property changes
67+
*
68+
* @default{<i>Empty</i>}
69+
* @accessors{
70+
* @memberAc{viewChangeSignal}
71+
* @notifyAc{viewChangeSignalChanged()}
72+
* }
73+
* @sa QtMvvm::bind
74+
*/
75+
Q_PROPERTY(QString viewChangeSignal MEMBER viewChangeSignal NOTIFY viewChangeSignalChanged)
76+
/*! @brief The type/direction of binding to create
77+
*
78+
* @default{`MvvmBinding::TwoWay`}
79+
* @accessors{
80+
* @readAc{type}
81+
* @writeAc{setType()}
82+
* @notifyAc{typeChanged()}
83+
* }
84+
* @sa QtMvvm::bind
85+
*/
86+
Q_PROPERTY(BindingDirection type READ type WRITE setType NOTIFY typeChanged)
87+
88+
public:
89+
//! @copydoc QtMvvm::Binding::BindingDirectionFlag
90+
enum BindingDirection {
91+
SingleInit = 1, //!< @copydoc QtMvvm::Binding::SingleInit
92+
OneWayToView = 3, //!< @copydoc QtMvvm::Binding::OneWayToView
93+
OneWayToViewModel = 4, //!< @copydoc QtMvvm::Binding::OneWayToViewModel
94+
TwoWay = 7 //!< @copydoc QtMvvm::Binding::TwoWay
95+
};
96+
97+
//! @copydoc QtMvvm::Binding::unbind
98+
void unbind();
99+
//! @copydoc QtMvvm::Binding::isValid
100+
bool isValid();
101+
//! @writeAcFn{MvvmBinding::type}
102+
void setType(BindingDirection type);
103+
104+
signals:
105+
//! @notifyAcFn{MvvmBinding::viewModel}
106+
void viewModelChanged();
107+
//! @notifyAcFn{MvvmBinding::viewModelProperty}
108+
void viewModelPropertyChanged();
109+
//! @notifyAcFn{MvvmBinding::view}
110+
void viewChanged();
111+
//! @notifyAcFn{MvvmBinding::viewProperty}
112+
void viewPropertyChanged();
113+
//! @notifyAcFn{MvvmBinding::viewModelChangeSignal}
114+
void viewModelChangeSignalChanged();
115+
//! @notifyAcFn{MvvmBinding::viewChangeSignal}
116+
void viewChangeSignalChanged();
117+
//! @notifyAcFn{MvvmBinding::type}
118+
void typeChanged();
119+
};

src/imports/mvvmcore/plugins.qmltypes

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -298,7 +298,7 @@ Module {
298298
name: "getInput"
299299
Parameter { name: "title"; type: "string" }
300300
Parameter { name: "text"; type: "string" }
301-
Parameter { name: "inputType"; type: "const char"; isPointer: true }
301+
Parameter { name: "inputType"; type: "string" }
302302
Parameter { name: "onResult"; type: "QJSValue" }
303303
Parameter { name: "defaultValue"; type: "QVariant" }
304304
Parameter { name: "viewProperties"; type: "QVariantMap" }
@@ -309,7 +309,7 @@ Module {
309309
name: "getInput"
310310
Parameter { name: "title"; type: "string" }
311311
Parameter { name: "text"; type: "string" }
312-
Parameter { name: "inputType"; type: "const char"; isPointer: true }
312+
Parameter { name: "inputType"; type: "string" }
313313
Parameter { name: "onResult"; type: "QJSValue" }
314314
Parameter { name: "defaultValue"; type: "QVariant" }
315315
Parameter { name: "viewProperties"; type: "QVariantMap" }
@@ -319,7 +319,7 @@ Module {
319319
name: "getInput"
320320
Parameter { name: "title"; type: "string" }
321321
Parameter { name: "text"; type: "string" }
322-
Parameter { name: "inputType"; type: "const char"; isPointer: true }
322+
Parameter { name: "inputType"; type: "string" }
323323
Parameter { name: "onResult"; type: "QJSValue" }
324324
Parameter { name: "defaultValue"; type: "QVariant" }
325325
Parameter { name: "viewProperties"; type: "QVariantMap" }
@@ -328,22 +328,22 @@ Module {
328328
name: "getInput"
329329
Parameter { name: "title"; type: "string" }
330330
Parameter { name: "text"; type: "string" }
331-
Parameter { name: "inputType"; type: "const char"; isPointer: true }
331+
Parameter { name: "inputType"; type: "string" }
332332
Parameter { name: "onResult"; type: "QJSValue" }
333333
Parameter { name: "defaultValue"; type: "QVariant" }
334334
}
335335
Method {
336336
name: "getInput"
337337
Parameter { name: "title"; type: "string" }
338338
Parameter { name: "text"; type: "string" }
339-
Parameter { name: "inputType"; type: "const char"; isPointer: true }
339+
Parameter { name: "inputType"; type: "string" }
340340
Parameter { name: "onResult"; type: "QJSValue" }
341341
}
342342
Method {
343343
name: "getInput"
344344
Parameter { name: "title"; type: "string" }
345345
Parameter { name: "text"; type: "string" }
346-
Parameter { name: "inputType"; type: "const char"; isPointer: true }
346+
Parameter { name: "inputType"; type: "string" }
347347
}
348348
Method {
349349
name: "getExistingDirectory"
@@ -446,7 +446,7 @@ Module {
446446
Signal { name: "beginLoadSetup" }
447447
Method {
448448
name: "callAction"
449-
Parameter { name: "entryId"; type: "string" }
449+
Parameter { name: "key"; type: "string" }
450450
Parameter { name: "parameters"; type: "QVariantMap" }
451451
}
452452
Method {

src/imports/mvvmcore/qqmlmvvmbinding.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@ QQmlMvvmBinding::QQmlMvvmBinding(QObject *parent) :
88
_completed(false),
99
_viewModel(nullptr),
1010
_viewModelProperty(),
11-
_view(nullptr),
11+
_view(parent),
1212
_viewProperty(),
1313
_type(TwoWay),
1414
_viewModelChangeSignal(),

src/imports/mvvmcore/qqmlmvvmmessage.cpp

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -51,15 +51,15 @@ void QQmlMvvmMessage::about(const QString &description, const QUrl &websiteUrl,
5151
QtMvvm::about(description, websiteUrl, licenseName, licenseUrl, companyName, addQtVersion, extraTopInfos, extraBottomInfos);
5252
}
5353

54-
void QQmlMvvmMessage::getInput(const QString &title, const QString &text, const char *inputType, const QJSValue &onResult, const QVariant &defaultValue, const QVariantMap &viewProperties, const QString &okText, const QString &cancelText)
54+
void QQmlMvvmMessage::getInput(const QString &title, const QString &text, const QString &inputType, const QJSValue &onResult, const QVariant &defaultValue, const QVariantMap &viewProperties, const QString &okText, const QString &cancelText)
5555
{
5656
if(onResult.isCallable()) {
5757
auto engine = _engine;
58-
QtMvvm::getInput(title, text, inputType, this, [engine, onResult](QVariant result){
58+
QtMvvm::getInput(title, text, qUtf8Printable(inputType), this, [engine, onResult](QVariant result){
5959
QJSValue(onResult).call({engine->toScriptValue(result)});
6060
}, defaultValue, viewProperties, okText, cancelText);
6161
} else
62-
QtMvvm::getInput(title, text, inputType, defaultValue, viewProperties, okText, cancelText);
62+
QtMvvm::getInput(title, text, qUtf8Printable(inputType), defaultValue, viewProperties, okText, cancelText);
6363
}
6464

6565
void QQmlMvvmMessage::getExistingDirectory(const QJSValue &onResult, const QString &title, const QUrl &dir)

src/imports/mvvmcore/qqmlmvvmmessage.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -48,7 +48,7 @@ public Q_SLOTS:
4848

4949
void getInput(const QString &title,
5050
const QString &text,
51-
const char *inputType,
51+
const QString &inputType,
5252
const QJSValue &onResult = {},
5353
const QVariant &defaultValue = {},
5454
const QVariantMap &viewProperties = {},

src/mvvmcore/binding.h

Lines changed: 1 addition & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -15,9 +15,6 @@ class Q_MVVMCORE_EXPORT Binding
1515
{
1616
Q_GADGET
1717

18-
//! Specifies whether the binding is a valid and active binding
19-
Q_PROPERTY(bool valid READ isValid FINAL)
20-
2118
public:
2219
//! Flags to control how to bind the properties
2320
enum BindingDirectionFlag {
@@ -34,7 +31,7 @@ class Q_MVVMCORE_EXPORT Binding
3431
Binding(QPointer<BindingPrivate> d_ptr);
3532
~Binding();
3633

37-
//! @readAcFn{Binding::valid}
34+
//! Specifies whether the binding is a valid and active binding
3835
bool isValid() const;
3936

4037
//! Remove the binding by disconnecting all change signals

0 commit comments

Comments
 (0)