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

Commit e02b588

Browse files
committed
completed the QtMvvmQuick qml doc
1 parent b61870a commit e02b588

21 files changed

+737
-6
lines changed

doc/Doxyfile

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -252,6 +252,7 @@ ALIASES = "accessors{1}=<table><tr><th colspan= 2>Accessors</th><
252252
"constantAc=<tr><td colspan= 2><b>CONSTANT</b></td></tr>" \
253253
"readonlyAc=<tr><td colspan= 2><b>READ ONLY</b></td></tr>" \
254254
"finalAc=<tr><td colspan= 2><b>FINAL</b></td></tr>" \
255+
"defaultAc=<tr><td colspan= 2><b>DEFAULT</b></td></tr>" \
255256
"default{1}=<b>Default:</b> \1 <br>" \
256257
"readAcFn{1}=READ accessor for \1" \
257258
"writeAcFn{1}=WRITE accessor for \1" \
@@ -905,6 +906,7 @@ EXCLUDE = ../src/3rdparty \
905906
../src/imports/mvvmquick/InputDialog.qml \
906907
../src/imports/mvvmquick/ListSection.qml \
907908
../src/imports/mvvmquick/OverviewListView.qml \
909+
../src/imports/mvvmquick/SectionListView.qml \
908910
../src/imports/mvvmquick/AndroidFileDialog.qml \
909911
../src/imports/mvvmquick/AndroidFolderDialog.qml
910912

doc/makedoc.sh

Lines changed: 14 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -41,9 +41,20 @@ if [ "$DOXY_STYLE_EXTRA" ]; then
4141
fi
4242

4343
for tagFile in $(find "$qtDocs" -name *.tags); do
44-
if [ $(basename "$tagFile") != "qtmvvm.tags" ]; then
45-
echo "TAGFILES += \"$tagFile=https://doc.qt.io/qt-5\"" >> $doxyRes
46-
fi
44+
case $(basename "$tagFile") in
45+
qtjsonserializer.tags)
46+
echo "TAGFILES += \"$tagFile=https://skycoder42.github.io/QtJsonSerializer\"" >> $doxyRes
47+
;;
48+
qtdatasync.tags)
49+
echo "TAGFILES += \"$tagFile=https://skycoder42.github.io/QtDataSync\"" >> $doxyRes
50+
;;
51+
qtmvvm.tags|qtquickcontrols.tags)
52+
# skipped
53+
;;
54+
*)
55+
echo "TAGFILES += \"$tagFile=https://doc.qt.io/qt-5\"" >> $doxyRes
56+
;;
57+
esac
4758
done
4859

4960
cd "$srcDir"

src/imports/mvvmcore/qqmlmvvmbinding.h

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -11,6 +11,7 @@ namespace de::skycoder42::QtMvvm::Core {
1111

1212
/*! @brief A QML class to create a local mvvm multiway binding
1313
*
14+
* @extends QtQml.QtObject
1415
* @since 1.0
1516
*
1617
* It is basically a wrapper around the QtMvvm::bind method. The parameters are set via the

src/imports/mvvmcore/qqmlmvvmmessage.h

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -14,6 +14,7 @@ namespace de::skycoder42::QtMvvm::Core {
1414

1515
/*! @brief A QML signelton to access the QtMvvm namespace methods for showing simple dialogs
1616
*
17+
* @extends QtQml.QtObject
1718
* @since 1.0
1819
*
1920
* @sa QtMvvm::MessageConfig, QtMvvm::CoreApp::showDialog

src/imports/mvvmquick/ActionButton.qml

Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2,9 +2,27 @@ import QtQuick 2.10
22
import QtQuick.Controls 2.3
33
import de.skycoder42.QtMvvm.Quick 1.0
44

5+
/*! @brief An extension of the @ref QtQuick.Controls.ToolButton "ToolButton" for better appearance
6+
*
7+
* @extends QtQuick.Controls.ToolButton
8+
*
9+
* @details This version basically adjusts size, icon size and text display to look better and
10+
* fit the Material guidelines. It also adds a tooltip that can be shown via a long press
11+
*
12+
* @sa ContrastToolBar, MenuButton
13+
*/
514
ToolButton {
615
id: _toolButton
716

17+
/*! @brief A toolTip to be shown when the button is long pressed
18+
*
19+
* @default{`ToolButton.text` (binding)}
20+
*
21+
* @accessors{
22+
* @memberAc{toolTip}
23+
* @notifyAc{toolTipChanged()}
24+
* }
25+
*/
826
property string toolTip: _toolButton.text
927

1028
display: AbstractButton.IconOnly

src/imports/mvvmquick/AlertDialog.qml

Lines changed: 44 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2,10 +2,44 @@ import QtQuick 2.10
22
import QtQuick.Controls 2.3
33
import QtQuick.Window 2.2
44

5+
/*! @brief An extension of the @ref QtQuick.Controls.Dialog "Dialog" for better appearance
6+
*
7+
* @extends QtQuick.Controls.Dialog
8+
*
9+
* @details This version basically adjusts size and makes shure the dialog always appears in
10+
* center of the application. It even takes a possible input method into accout
11+
*/
512
Dialog {
613
id: _alertDialog
714

15+
/*! @brief Additional hight to give to the dialog
16+
*
17+
* @default{`0`}
18+
*
19+
* The dialog basically assumes that the parent is it's normal height plus this value. The
20+
* combined height is then used to calculate where to show the dialog. Can be used if the
21+
* parent does not fill up the whole application.
22+
*
23+
* @accessors{
24+
* @memberAc{extraHeight}
25+
* @notifyAc{extraHeightChanged()}
26+
* }
27+
*/
828
property real extraHeight: 0
29+
/*! @brief The ideal basic width of the dialog
30+
*
31+
* @default{`300`}
32+
*
33+
* Typically, the dialogs width is deduces by using the implicitWidth of it's contents and
34+
* is limited to the parents width. Howver some contents have no useful implicit width.
35+
* With this property, the dialog will try to be at least `baseWidth` or the contents
36+
* implicitWidth wide, whichever is bigger.
37+
*
38+
* @accessors{
39+
* @memberAc{baseWidth}
40+
* @notifyAc{baseWidthChanged()}
41+
* }
42+
*/
943
property real baseWidth: 300
1044

1145
x: parent ? (parent.width - width) / 2 : 0
@@ -15,6 +49,16 @@ Dialog {
1549
modal: true
1650
focus: true
1751

52+
/*! @brief A function that calculates the value for the y coordiante
53+
*
54+
* @return type:real A value to be used as the `y` property value
55+
*
56+
* The value is calculated by taking the parent heigth, the dialog height, the input method
57+
* height and the extraHeight into account. I is calculated to center the dialog in the
58+
* parent.
59+
*
60+
* @sa Dialog::extraHeight
61+
*/
1862
function deltaY() {
1963
var unscaled = Qt.inputMethod.keyboardRectangle.height / Screen.devicePixelRatio;
2064
var availHeight = (parent.height + extraHeight) - unscaled - 24; //margins

src/imports/mvvmquick/ContrastToolBar.qml

Lines changed: 21 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2,11 +2,32 @@ import QtQuick 2.10
22
import QtQuick.Controls 2.3
33
import QtQuick.Controls.Material 2.3
44

5+
/*! @brief An extension of the @ref QtQuick.Controls.ToolBar "ToolBar" for better appearance
6+
*
7+
* @extends QtQuick.Controls.ToolBar
8+
*
9+
* @details This version basically adjusts size and text color of the toolbar itself and
10+
* controls within the toolbar to look better and improve contrast
11+
*
12+
* @sa ActionButton, ToolBarLabel, MenuButton
13+
*/
514
ToolBar {
615
id: _contrastToolBar
716

817
height: 56
918

19+
/*! @brief Calculates the optimal text color based on the background color
20+
*
21+
* @param type:color accentColor The color to find a contrasting text color for
22+
* @param type:color baseColor The current default text color
23+
* @return type:color A color for text that is easy to read when used with accentColor as
24+
* the background
25+
*
26+
* The method calculates whether the color should be light or dark and then either returns
27+
* white or black, depending on which color fits better. If baseColor is specified, then
28+
* the color value is checked, too. If baseColor is easily readable, it is simply returned
29+
* as result. Otherwise the method proceeds as usual.
30+
*/
1031
function accentTextColor(accentColor, baseColor) {
1132
var a = (0.299 * accentColor.r + 0.587 * accentColor.g + 0.144 * accentColor.b);
1233
if(typeof baseColor !== "undefined") {

src/imports/mvvmquick/DialogPresenter.qml

Lines changed: 108 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3,11 +3,69 @@ import QtQuick.Controls 2.3
33
import de.skycoder42.QtMvvm.Core 1.0
44
import de.skycoder42.QtMvvm.Quick 1.0
55

6+
/*! @brief A presentation helper that can present generic mvvm dialogs
7+
*
8+
* @extends QtQml.QtObject
9+
*
10+
* @details You can use this class as presenter for dialogs in case you create your own root
11+
* presenter instead of using the QtMvvmApp. This partial presenter can handle simple dialogs
12+
* (the ones shown via QtMvvm::CoreApp::showDialog). Use it as follows:
13+
*
14+
* @code{.qml}
15+
* MyPresenter {
16+
* id: _root
17+
*
18+
* DialogPresenter {
19+
* id: _rootDialogs
20+
* rootItem: _root.contentItem
21+
* }
22+
*
23+
* function showDialog(config, result) {
24+
* return _rootDialogs.showDialog(config, result);
25+
* }
26+
*
27+
* function closeAction() {
28+
* var closed = false;
29+
* // ...
30+
* if(!closed)
31+
* closed = _rootDialogs.closeAction();
32+
* // ...
33+
* return closed;
34+
* }
35+
* }
36+
* @endcode
37+
*
38+
* @sa QtMvvmApp
39+
*/
640
QtObject {
741
id: _dialogPresenter
842

43+
/*! @brief The root item to present dialogs to
44+
*
45+
* @default{`null`}
46+
*
47+
* This propety **must** be set in order for the presenter to work. It will create new
48+
* dialogs with that item as parent, which decides in which relative are they are
49+
* displayed. Unless you want to explicitly reposition dialogs, this should always be the
50+
* root item of the root component of your application.
51+
*
52+
* @accessors{
53+
* @memberAc{rootItem}
54+
* @notifyAc{rootItemChanged()}
55+
* }
56+
*/
957
property Item rootItem: null
1058

59+
/*! @brief The primary presenting method to present a dialog
60+
*
61+
* @param type:MessageConfig config The message configuration to create a dialog of
62+
* @param type:MessageResult result The result to report the dialog result to
63+
* @return type:bool `true` if successfully presented, `false` if not
64+
*
65+
* Use this method in your main presenter to present dialogs via this sub presenter.
66+
*
67+
* @sa QtMvvm::MessageConfig, QtMvvm::MessageResult, QtMvvmApp::showDialog
68+
*/
1169
function showDialog(config, result) {
1270
if(config.type == "msgbox")
1371
return createMsgBox(config, result)
@@ -19,6 +77,15 @@ QtObject {
1977
return false;
2078
}
2179

80+
/*! @brief Can be called to try to close open dialogs
81+
*
82+
* @return type:bool `true` if a dialog was closed, `false` if not
83+
*
84+
* Use this method in your main presenter react on a close event. It will close the
85+
* latest top level dialog, if one is present.
86+
*
87+
* @sa QtMvvmApp::closeAction
88+
*/
2289
function closeAction() {
2390
if(_popups.length > 0) {
2491
_popups[_popups.length - 1].reject();
@@ -27,7 +94,9 @@ QtObject {
2794
return false;
2895
}
2996

97+
//! Internal property
3098
property var _popups: []
99+
//! Internal property
31100
property Component _msgBoxComponent: MsgBox {
32101
id: __msgBox
33102

@@ -45,6 +114,7 @@ QtObject {
45114
}
46115
}
47116

117+
//! Internal property
48118
property Component _inputComponent: InputDialog {
49119
id: __input
50120

@@ -62,6 +132,7 @@ QtObject {
62132
}
63133
}
64134

135+
//! Internal property
65136
property Component _fileComponent: FileDialog {
66137
id: __file
67138

@@ -79,6 +150,7 @@ QtObject {
79150
}
80151
}
81152

153+
//! Internal property
82154
property Component _folderComponent: FolderDialog {
83155
id: __folder
84156

@@ -96,6 +168,18 @@ QtObject {
96168
}
97169
}
98170

171+
/*! @brief Method present a dialog of the QtMvvm::MessageConfig::TypeMessageBox
172+
*
173+
* @param type:MessageConfig config The message configuration to create a dialog of
174+
* @param type:MessageResult result The result to report the dialog result to
175+
* @return type:bool `true` if successfully presented, `false` if not
176+
*
177+
* Used by the showDialog() method to show a dialog of the message box type. You can use
178+
* it yourself if you want to extend the presenter and still keep the default dialogs it
179+
* supports.
180+
*
181+
* @sa DialogPresenter::showDialog
182+
*/
99183
function createMsgBox(config, result) {
100184
var props = config.viewProperties;
101185
props["msgConfig"] = config;
@@ -104,6 +188,18 @@ QtObject {
104188
return incubator.status !== Component.Error;
105189
}
106190

191+
/*! @brief Method present a dialog of the QtMvvm::MessageConfig::TypeInputDialog
192+
*
193+
* @param type:MessageConfig config The message configuration to create a dialog of
194+
* @param type:MessageResult result The result to report the dialog result to
195+
* @return type:bool `true` if successfully presented, `false` if not
196+
*
197+
* Used by the showDialog() method to show a dialog of the input dialog type. You can use
198+
* it yourself if you want to extend the presenter and still keep the default dialogs it
199+
* supports.
200+
*
201+
* @sa DialogPresenter::showDialog
202+
*/
107203
function createInput(config, result) {
108204
var props = config.viewProperties;
109205
props["msgConfig"] = config;
@@ -112,6 +208,18 @@ QtObject {
112208
return incubator.status !== Component.Error;
113209
}
114210

211+
/*! @brief Method present a dialog of the QtMvvm::MessageConfig::TypeFileDialog
212+
*
213+
* @param type:MessageConfig config The message configuration to create a dialog of
214+
* @param type:MessageResult result The result to report the dialog result to
215+
* @return type:bool `true` if successfully presented, `false` if not
216+
*
217+
* Used by the showDialog() method to show a dialog of the file dialog type. You can use
218+
* it yourself if you want to extend the presenter and still keep the default dialogs it
219+
* supports.
220+
*
221+
* @sa DialogPresenter::showDialog
222+
*/
115223
function createFile(config, result) {
116224
var props = config.viewProperties;
117225
props["msgConfig"] = config;

0 commit comments

Comments
 (0)