Browse Source

added core qml doc

pull/2/head
Skycoder42 7 years ago
parent
commit
510e36b467
No known key found for this signature in database GPG Key ID: 8E01AD9EF0578D2B
  1. 12
      doc/Doxyfile
  2. 9
      doc/binding.dox
  3. 1
      doc/doc.pro
  4. 53
      doc/qmldoc/mvvmcore/Message.h
  5. 119
      doc/qmldoc/mvvmcore/MvvmBinding.h
  6. 14
      src/imports/mvvmcore/plugins.qmltypes
  7. 2
      src/imports/mvvmcore/qqmlmvvmbinding.cpp
  8. 6
      src/imports/mvvmcore/qqmlmvvmmessage.cpp
  9. 2
      src/imports/mvvmcore/qqmlmvvmmessage.h
  10. 5
      src/mvvmcore/binding.h

12
doc/Doxyfile

@ -311,7 +311,7 @@ OPTIMIZE_OUTPUT_VHDL = NO
# Note that for custom extensions you also need to set FILE_PATTERNS otherwise
# the files are not read by doxygen.
EXTENSION_MAPPING =
EXTENSION_MAPPING = qmldoc=C++
# If the MARKDOWN_SUPPORT tag is enabled then doxygen pre-processes all comments
# according to the Markdown format, which allows for more readable
@ -878,7 +878,8 @@ FILE_PATTERNS = *.c \
*.qsf \
*.as \
*.js \
*.qdoc
*.qdoc \
*.qmldoc
# The RECURSIVE tag can be used to specify whether or not subdirectories should
# be searched for input files as well.
@ -893,7 +894,9 @@ RECURSIVE = YES
# Note that relative paths are relative to the directory from which doxygen is
# run.
EXCLUDE = ../src/3rdparty ../src/imports ../src/plugins
EXCLUDE = ../src/3rdparty \
../src/imports/ \
../src/plugins
# The EXCLUDE_SYMLINKS tag can be used to select whether or not files or
# directories that are symbolic links (a Unix file system feature) are excluded
@ -928,6 +931,7 @@ EXCLUDE_PATTERNS = moc_* \
EXCLUDE_SYMBOLS = QtMvvm::__helpertypes \
\
QAbstractAspect \
QAndroidActivityResultReceiver \
QBasicAtomicInteger \
QBasicAtomicPointer \
QBasicMutex \
@ -1002,7 +1006,7 @@ INPUT_FILTER =
# need to set EXTENSION_MAPPING for the extension otherwise the files are not
# properly processed by doxygen.
FILTER_PATTERNS =
FILTER_PATTERNS = *.qmldoc=doxyqml
# If the FILTER_SOURCE_FILES tag is set to YES, the input filter (if set using
# INPUT_FILTER) will also be used to filter the input files that are used for

9
doc/binding.dox

@ -11,18 +11,13 @@ hold any references to it. This class serves as a passive watcher over a binding
*/
/*!
@property QtMvvm::Binding::valid
@fn QtMvvm::Binding::isValid
@default{`false`}
@returns `true` If the binding is valid and active, `false` if invalid or already unbound
A binding is considered valid is if has successfully been set up and has not been unbound yet.
A valid binding means view and viewModel are valid can the properties could be found.
@accessors{
@readAc{isValid()}
@finalAc
}
@sa Binding::unbind, bind()
*/

1
doc/doc.pro

@ -5,6 +5,7 @@ OTHER_FILES += Doxyfile \
doxme.py \
../README.md \
*.dox \
qmldoc/mvvmcore/* \
snippets/*.cpp \
images/*

53
doc/qmldoc/mvvmcore/Message.h

@ -0,0 +1,53 @@
#include <QObject>
//! A QML signelton to access the QtMvvm namespace methods for showing simple dialogs
class Message : public QObject
{
public:
//! @brief A QML version of the QtMvvm::information method
//! @copydetails QtMvvm::information(const QString &, const QString &, const std::function<void()> &, const QString &)
static void information(string title, string text, function onResult, string okText);
//! @brief A QML version of the QtMvvm::question method
//! @copydoc QtMvvm::question(const QString &, const QString &, const std::function<void(bool)> &, const QString &, const QString &)
static void question(string title, string text, function onResult, string yesText, string noText);
//! @brief A QML version of the QtMvvm::warning method
//! @copydoc QtMvvm::warning(const QString &, const QString &, const std::function<void()> &, const QString &)
static void warning(string title, string text, function onResult, string okText);
//! @brief A QML version of the QtMvvm::critical method
//! @copydoc QtMvvm::critical(const QString &, const QString &, const std::function<void()> &, const QString &)
static void critical(string title, string text, function onResult, string okText);
//! @brief A QML version of the QtMvvm::about method
//! @copydoc QtMvvm::about
static void about(string description,
url websiteUrl,
string licenseName,
url licenseUrl,
string companyName,
bool addQtVersion,
list extraTopInfos,
string extraBottomInfos);
//! @brief A QML version of the QtMvvm::getInput method
//! @copydoc QtMvvm::getInput(const QString &, const QString &, const char *, const std::function<void(QVariant)> &, const QVariant &, const QVariantMap &, const QString &, const QString &)
static void getInput(string title,
string text,
string inputType,
function onResult,
var defaultValue,
object viewProperties,
string okText,
string cancelText);
//! @brief A QML version of the QtMvvm::getExistingDirectory method
//! @copydoc QtMvvm::getExistingDirectory(const std::function<void(QUrl)> &, const QString &, const QUrl &)
static void getExistingDirectory(function onResult, string title, url dir);
//! @brief A QML version of the QtMvvm::getOpenFile method
//! @copydoc QtMvvm::getOpenFile(const std::function<void(QUrl)> &, const QString &, const QStringList &, const QUrl &)
static void getOpenFile(function onResult, string title, list supportedMimeTypes, url dir);
//! @brief A QML version of the QtMvvm::getOpenFiles method
//! @copydoc QtMvvm::getOpenFiles(const std::function<void(QList<QUrl>)> &, const QString &, const QStringList &, const QUrl &)
static void getOpenFiles(function onResult, string title, list supportedMimeTypes, url dir);
//! @brief A QML version of the QtMvvm::getSaveFile method
//! @copydoc QtMvvm::getSaveFile(const std::function<void(QUrl)> &, const QString &, const QStringList &, const QUrl &)
static void getSaveFile(function onResult, string title, list supportedMimeTypes, url dir);
}

119
doc/qmldoc/mvvmcore/MvvmBinding.h

@ -0,0 +1,119 @@
#include <QObject>
/*! @brief A QML class to create a local mvvm multiway binding
*
* It is basically a wrapper around the QtMvvm::bind method. The parameters are set via the
* properties, and once the binding component is completed, it will create the binding. It is
* possible to modify the properties while running. This will recreate the binding, discarding
* the previous one
*
* @sa QtMvvm::bind
*/
class MvvmBinding : public QObject
{
/*! @brief The object in the role of a viewmodel
*
* @default{`null`}
* @accessors{
* @memberAc{viewModel}
* @notifyAc{viewModelChanged()}
* }
* @sa QtMvvm::bind
*/
Q_PROPERTY(QObject* viewModel MEMBER viewModel NOTIFY viewModelChanged)
/*! @brief The property of the viewmodel to use in the binding
*
* @default{<i>Empty</i>}
* @accessors{
* @memberAc{viewModelProperty}
* @notifyAc{viewModelPropertyChanged()}
* }
* @sa QtMvvm::bind
*/
Q_PROPERTY(QString viewModelProperty MEMBER viewModelProperty NOTIFY viewModelPropertyChanged)
/*! @brief The object in the role of a view
*
* @default{`parent()`}
* @accessors{
* @memberAc{view}
* @notifyAc{viewChanged()}
* }
* @sa QtMvvm::bind
*/
Q_PROPERTY(QObject* view MEMBER view NOTIFY viewChanged)
/*! @brief The property of the view to use in the binding
*
* @default{<i>Empty</i>}
* @accessors{
* @memberAc{viewProperty}
* @notifyAc{viewPropertyChanged()}
* }
* @sa QtMvvm::bind
*/
Q_PROPERTY(QString viewProperty MEMBER viewProperty NOTIFY viewPropertyChanged)
/*! @brief An alternative signal to be used instead of the viewModelProperty notify signal
* to detect property changes
*
* @default{<i>Empty</i>}
* @accessors{
* @memberAc{viewModelChangeSignal}
* @notifyAc{viewModelChangeSignalChanged()}
* }
* @sa QtMvvm::bind
*/
Q_PROPERTY(QString viewModelChangeSignal MEMBER viewModelChangeSignal NOTIFY viewModelChangeSignalChanged)
/*! @brief An alternative signal to be used instead of the viewProperty notify signal to
* detect property changes
*
* @default{<i>Empty</i>}
* @accessors{
* @memberAc{viewChangeSignal}
* @notifyAc{viewChangeSignalChanged()}
* }
* @sa QtMvvm::bind
*/
Q_PROPERTY(QString viewChangeSignal MEMBER viewChangeSignal NOTIFY viewChangeSignalChanged)
/*! @brief The type/direction of binding to create
*
* @default{`MvvmBinding::TwoWay`}
* @accessors{
* @readAc{type}
* @writeAc{setType()}
* @notifyAc{typeChanged()}
* }
* @sa QtMvvm::bind
*/
Q_PROPERTY(BindingDirection type READ type WRITE setType NOTIFY typeChanged)
public:
//! @copydoc QtMvvm::Binding::BindingDirectionFlag
enum BindingDirection {
SingleInit = 1, //!< @copydoc QtMvvm::Binding::SingleInit
OneWayToView = 3, //!< @copydoc QtMvvm::Binding::OneWayToView
OneWayToViewModel = 4, //!< @copydoc QtMvvm::Binding::OneWayToViewModel
TwoWay = 7 //!< @copydoc QtMvvm::Binding::TwoWay
};
//! @copydoc QtMvvm::Binding::unbind
void unbind();
//! @copydoc QtMvvm::Binding::isValid
bool isValid();
//! @writeAcFn{MvvmBinding::type}
void setType(BindingDirection type);
signals:
//! @notifyAcFn{MvvmBinding::viewModel}
void viewModelChanged();
//! @notifyAcFn{MvvmBinding::viewModelProperty}
void viewModelPropertyChanged();
//! @notifyAcFn{MvvmBinding::view}
void viewChanged();
//! @notifyAcFn{MvvmBinding::viewProperty}
void viewPropertyChanged();
//! @notifyAcFn{MvvmBinding::viewModelChangeSignal}
void viewModelChangeSignalChanged();
//! @notifyAcFn{MvvmBinding::viewChangeSignal}
void viewChangeSignalChanged();
//! @notifyAcFn{MvvmBinding::type}
void typeChanged();
};

14
src/imports/mvvmcore/plugins.qmltypes

@ -298,7 +298,7 @@ Module {
name: "getInput"
Parameter { name: "title"; type: "string" }
Parameter { name: "text"; type: "string" }
Parameter { name: "inputType"; type: "const char"; isPointer: true }
Parameter { name: "inputType"; type: "string" }
Parameter { name: "onResult"; type: "QJSValue" }
Parameter { name: "defaultValue"; type: "QVariant" }
Parameter { name: "viewProperties"; type: "QVariantMap" }
@ -309,7 +309,7 @@ Module {
name: "getInput"
Parameter { name: "title"; type: "string" }
Parameter { name: "text"; type: "string" }
Parameter { name: "inputType"; type: "const char"; isPointer: true }
Parameter { name: "inputType"; type: "string" }
Parameter { name: "onResult"; type: "QJSValue" }
Parameter { name: "defaultValue"; type: "QVariant" }
Parameter { name: "viewProperties"; type: "QVariantMap" }
@ -319,7 +319,7 @@ Module {
name: "getInput"
Parameter { name: "title"; type: "string" }
Parameter { name: "text"; type: "string" }
Parameter { name: "inputType"; type: "const char"; isPointer: true }
Parameter { name: "inputType"; type: "string" }
Parameter { name: "onResult"; type: "QJSValue" }
Parameter { name: "defaultValue"; type: "QVariant" }
Parameter { name: "viewProperties"; type: "QVariantMap" }
@ -328,7 +328,7 @@ Module {
name: "getInput"
Parameter { name: "title"; type: "string" }
Parameter { name: "text"; type: "string" }
Parameter { name: "inputType"; type: "const char"; isPointer: true }
Parameter { name: "inputType"; type: "string" }
Parameter { name: "onResult"; type: "QJSValue" }
Parameter { name: "defaultValue"; type: "QVariant" }
}
@ -336,14 +336,14 @@ Module {
name: "getInput"
Parameter { name: "title"; type: "string" }
Parameter { name: "text"; type: "string" }
Parameter { name: "inputType"; type: "const char"; isPointer: true }
Parameter { name: "inputType"; type: "string" }
Parameter { name: "onResult"; type: "QJSValue" }
}
Method {
name: "getInput"
Parameter { name: "title"; type: "string" }
Parameter { name: "text"; type: "string" }
Parameter { name: "inputType"; type: "const char"; isPointer: true }
Parameter { name: "inputType"; type: "string" }
}
Method {
name: "getExistingDirectory"
@ -446,7 +446,7 @@ Module {
Signal { name: "beginLoadSetup" }
Method {
name: "callAction"
Parameter { name: "entryId"; type: "string" }
Parameter { name: "key"; type: "string" }
Parameter { name: "parameters"; type: "QVariantMap" }
}
Method {

2
src/imports/mvvmcore/qqmlmvvmbinding.cpp

@ -8,7 +8,7 @@ QQmlMvvmBinding::QQmlMvvmBinding(QObject *parent) :
_completed(false),
_viewModel(nullptr),
_viewModelProperty(),
_view(nullptr),
_view(parent),
_viewProperty(),
_type(TwoWay),
_viewModelChangeSignal(),

6
src/imports/mvvmcore/qqmlmvvmmessage.cpp

@ -51,15 +51,15 @@ void QQmlMvvmMessage::about(const QString &description, const QUrl &websiteUrl,
QtMvvm::about(description, websiteUrl, licenseName, licenseUrl, companyName, addQtVersion, extraTopInfos, extraBottomInfos);
}
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)
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)
{
if(onResult.isCallable()) {
auto engine = _engine;
QtMvvm::getInput(title, text, inputType, this, [engine, onResult](QVariant result){
QtMvvm::getInput(title, text, qUtf8Printable(inputType), this, [engine, onResult](QVariant result){
QJSValue(onResult).call({engine->toScriptValue(result)});
}, defaultValue, viewProperties, okText, cancelText);
} else
QtMvvm::getInput(title, text, inputType, defaultValue, viewProperties, okText, cancelText);
QtMvvm::getInput(title, text, qUtf8Printable(inputType), defaultValue, viewProperties, okText, cancelText);
}
void QQmlMvvmMessage::getExistingDirectory(const QJSValue &onResult, const QString &title, const QUrl &dir)

2
src/imports/mvvmcore/qqmlmvvmmessage.h

@ -48,7 +48,7 @@ public Q_SLOTS:
void getInput(const QString &title,
const QString &text,
const char *inputType,
const QString &inputType,
const QJSValue &onResult = {},
const QVariant &defaultValue = {},
const QVariantMap &viewProperties = {},

5
src/mvvmcore/binding.h

@ -15,9 +15,6 @@ class Q_MVVMCORE_EXPORT Binding
{
Q_GADGET
//! Specifies whether the binding is a valid and active binding
Q_PROPERTY(bool valid READ isValid FINAL)
public:
//! Flags to control how to bind the properties
enum BindingDirectionFlag {
@ -34,7 +31,7 @@ public:
Binding(QPointer<BindingPrivate> d_ptr);
~Binding();
//! @readAcFn{Binding::valid}
//! Specifies whether the binding is a valid and active binding
bool isValid() const;
//! Remove the binding by disconnecting all change signals

Loading…
Cancel
Save