diff --git a/doc/Doxyfile b/doc/Doxyfile index a704f02..23ba9f6 100644 --- a/doc/Doxyfile +++ b/doc/Doxyfile @@ -900,13 +900,14 @@ RECURSIVE = YES EXCLUDE = ../src/3rdparty \ ../src/plugins \ ../src/imports/mvvmquick/settingsuibuilder.h \ - ../src/imports/mvvmquick/TintIcon.qml \ ../src/imports/mvvmquick/MsgBoxBase.qml \ ../src/imports/mvvmquick/MsgBox.qml \ + ../src/imports/mvvmquick/ProgressDialog.qml \ ../src/imports/mvvmquick/InputDialog.qml \ ../src/imports/mvvmquick/ListSection.qml \ ../src/imports/mvvmquick/OverviewListView.qml \ ../src/imports/mvvmquick/SectionListView.qml \ + ../src/imports/mvvmquick/TimeTumbler.qml \ ../src/imports/mvvmquick/AndroidFileDialog.qml \ ../src/imports/mvvmquick/AndroidFolderDialog.qml \ ../src/imports/mvvmdatasyncquick/SubButton.qml \ @@ -936,7 +937,8 @@ EXCLUDE_PATTERNS = moc_* \ *.cpp \ */src/mvvmquick/*.qml \ */src/mvvmdatasyncquick/*.qml \ - */imports/mvvmquick/*model.h + */imports/mvvmquick/*model.h \ + */imports/mvvmquick/*10.qml # The EXCLUDE_SYMBOLS tag can be used to specify one or more symbol names # (namespaces, classes, functions, etc.) that should be excluded from the @@ -972,20 +974,25 @@ EXCLUDE_SYMBOLS = QtMvvm::__helpertypes \ QPaintEngineEx \ QQmlExtensionInterface \ QTechniqueFilter \ + QAbstractXmlReceiver \ \ ApplicationWindow \ + Control \ Dialog \ Drawer \ + GridLayout \ Item \ + ItemDelegate \ Label \ ListView \ Page \ ProgressBar \ QtObject \ RoundButton \ + RowLayout \ StackView \ ToolBar \ - ToolButton + ToolButton \ # The EXAMPLE_PATH tag can be used to specify one or more files or directories # that contain example code fragments that are included (see the \include diff --git a/doc/qtmvvm.dox b/doc/qtmvvm.dox index d4eb170..086f3bd 100644 --- a/doc/qtmvvm.dox +++ b/doc/qtmvvm.dox @@ -49,7 +49,7 @@ The following list shows which classes belong to which Qt module, in alphabetica @brief The QML import for the QtMvvmCore QML module Current Version
-        1.0 +        1.1 Available Types - @ref QtMvvm::MessageConfig "MessageConfig" (uncreatable) @@ -68,12 +68,14 @@ The following list shows which classes belong to which Qt module, in alphabetica @brief The QML import for the QtMvvmQuick QML module Current Version
-        1.0 +        1.1 Available Types - @ref QtMvvm::InputViewFactory "InputViewFactory" (uncreatable) - QuickPresenter (singleton) - FileChooser +- ViewPlaceholder +- ColorHelper - AlertDialog - ContrastToolBar - ToolBarLabel @@ -82,6 +84,14 @@ The following list shows which classes belong to which Qt module, in alphabetica - MenuButton - FileDialog - FolderDialog +- TintIcon +- SearchBar +- RoundMenuButton +- DecorLabel +- MsgDelegate +- TimeEdit +- DateEdit +- ColorEdit - PresenterProgress - PresentingStackView - PopupPresenter @@ -96,7 +106,7 @@ The following list shows which classes belong to which Qt module, in alphabetica @brief The QML import for the QtMvvmDataSyncCore QML module Current Version
-        1.0 +        1.1 Available Types - @ref QtMvvm::AccountModel "AccountModel" @@ -115,7 +125,7 @@ The following list shows which classes belong to which Qt module, in alphabetica @brief The QML import for the QtMvvmDataSyncQuick QML module Current Version
-        1.0 +        1.1 Available Types - DataSyncView diff --git a/src/imports/mvvmdatasyncquick/plugins.qmltypes b/src/imports/mvvmdatasyncquick/plugins.qmltypes index a3271bc..38cf4e0 100644 --- a/src/imports/mvvmdatasyncquick/plugins.qmltypes +++ b/src/imports/mvvmdatasyncquick/plugins.qmltypes @@ -8,6 +8,7 @@ import QtQuick.tooling 1.2 Module { dependencies: [ + "Qt.labs.calendar 1.0", "Qt.labs.platform 1.0", "QtGraphicalEffects 1.0", "QtQml 2.2", diff --git a/src/imports/mvvmquick/ColorEdit.qml b/src/imports/mvvmquick/ColorEdit.qml index fed1943..aaf1435 100644 --- a/src/imports/mvvmquick/ColorEdit.qml +++ b/src/imports/mvvmquick/ColorEdit.qml @@ -5,6 +5,14 @@ import QtQuick.Layouts 1.3 import QtGraphicalEffects 1.0 import de.skycoder42.QtMvvm.Quick 1.1 +/*! @brief A edit view to edit colors by using a color picker + * + * @extends QtQuick.Layouts.GridLayout + * + * You can use this edit if you want to let the user select a color. It is made out of three + * sliders to control hue, saturation and value and a TextField to enter a hex color code, + * next to a small box that previews the color + */ GridLayout { id: _colorPicker columns: 2 @@ -14,7 +22,28 @@ GridLayout { id: helper } + /*! @brief Specifies whether the alpha channel can be edited + * + * @default{`false`} + * + * If set to true, the user can enter a hex color string with an additional alpha value. + * The sliders are uneffected from this property + * + * @accessors{ + * @memberAc{alpha} + * @notifyAc{alphaChanged()} + * } + */ property bool alpha: false + /*! @brief The color currently displayed and edited + * + * @default{`undefined`} + * + * @accessors{ + * @memberAc{color} + * @notifyAc{colorChanged()} + * } + */ property color color onColorChanged: { if(!_p.changing){ diff --git a/src/imports/mvvmquick/ColorHelper.qml b/src/imports/mvvmquick/ColorHelper.qml index 2940722..9eb729a 100644 --- a/src/imports/mvvmquick/ColorHelper.qml +++ b/src/imports/mvvmquick/ColorHelper.qml @@ -4,10 +4,34 @@ import QtQuick.Controls.Material 2.3 import QtQuick.Controls.Universal 2.3 import de.skycoder42.QtMvvm.Quick 1.1 +/*! @brief A helper class to get style-dependant colors + * + * @extends QtQuick.Controls.Control + * + * Simply instanciate a helper within some control. It will pick up the style settings from + * what it is in and provide them via the properties + * + * @sa ContrastToolBar + */ Control { id: _colorHelper visible: false + /*! @brief The color to use to highlight stuff + * + * @default{style dependant} + * + * Style | Value + * -------------|------- + * Material | Material.accent + * Universal | Universal.accent + * Others | palette.highlight + * + * @accessors{ + * @memberAc{highlight} + * @notifyAc{highlightChanged()} + * } + */ readonly property color highlight: { if(QuickPresenter.currentStyle === "Material") return Material.accent; @@ -17,6 +41,21 @@ Control { return palette.highlight; } + /*! @brief The color to use for text + * + * @default{style dependant} + * + * Style | Value + * -------------|------- + * Material | Material.foreground + * Universal | Universal.foreground + * Others | palette.windowText + * + * @accessors{ + * @memberAc{text} + * @notifyAc{textChanged()} + * } + */ readonly property color text: { if(QuickPresenter.currentStyle === "Material") return Material.foreground; diff --git a/src/imports/mvvmquick/ContrastToolBar.qml b/src/imports/mvvmquick/ContrastToolBar.qml index abf5abb..7ff2926 100644 --- a/src/imports/mvvmquick/ContrastToolBar.qml +++ b/src/imports/mvvmquick/ContrastToolBar.qml @@ -17,7 +17,7 @@ ToolBar { height: 56 - // @copydoc QuickPresenter::accentTextColor + //! @copydoc QuickPresenter::accentTextColor function accentTextColor(accentColor, baseColor) { return QuickPresenter.accentTextColor(accentColor, baseColor); } diff --git a/src/imports/mvvmquick/DateEdit.qml b/src/imports/mvvmquick/DateEdit.qml index 15b0a89..16c555a 100644 --- a/src/imports/mvvmquick/DateEdit.qml +++ b/src/imports/mvvmquick/DateEdit.qml @@ -4,24 +4,67 @@ import QtQuick.Layouts 1.3 import Qt.labs.calendar 1.0 import de.skycoder42.QtMvvm.Quick 1.1 +/*! @brief A edit view to edit dates by using a calendar + * + * @extends QtQuick.ListView + * + * You can use this edit if you want to let the user select a date. You can use the properties + * to control wich tumblers are shown and which format they use. + * + * @note This edit currently uses Qt.labs.calendar - an experimental module, and thus might + * not always function perfectly or break after Qt updates + */ ListView { id: _calenderList + /*! @brief The smallest possible date the user can select + * + * @default{`new Date(1970, 0, 1)`} + * + * @note Only the date-componente of the date object is used. + * + * @accessors{ + * @memberAc{firstDate} + * @notifyAc{firstDateChanged()} + * } + */ property date firstDate: new Date(1970, 0, 1) + /*! @brief The highest possible date the user can select + * + * @default{`new Date(9999, 11, 31)`} + * + * @note Only the date-componente of the date object is used. + * + * @accessors{ + * @memberAc{lastDate} + * @notifyAc{lastDateChanged()} + * } + */ property date lastDate: new Date(9999, 11, 31) - property date date: today(); - - function today() { - var cDate = new Date(); - cDate.setHours(0, 0, 0, 0, 0); - return cDate; - } + /*! @brief The date currently displayed and edited + * + * @default{`new Date()`} + * + * @note Only the date-componente of the date object is used. + * + * @accessors{ + * @memberAc{date} + * @notifyAc{dateChanged()} + * } + */ + property date date: _p.today(); QtObject { id: _p property bool _skipNextFocus: false + function today() { + var cDate = new Date(); + cDate.setHours(0, 0, 0, 0, 0); + return cDate; + } + function focusDate() { if(_skipNextFocus) _skipNextFocus = false; diff --git a/src/imports/mvvmquick/DecorLabel.qml b/src/imports/mvvmquick/DecorLabel.qml index 4438e28..c9b0f77 100644 --- a/src/imports/mvvmquick/DecorLabel.qml +++ b/src/imports/mvvmquick/DecorLabel.qml @@ -2,6 +2,16 @@ import QtQuick 2.10 import QtQuick.Controls 2.3 import de.skycoder42.QtMvvm.Quick 1.1 +/*! @brief An extension of the @ref QtQuick.Controls.Label "Label" for better appearance when + * used in FormLayouts + * + * @extends QtQuick.Controls.Label + * + * This label will automatically change it's color to the highlight color if the the edit + * it is connected to has input focus. This serves as a visual cue to the selected input + * + * @sa DecorLabel::edit + */ Label { id: _decorLabel @@ -9,8 +19,29 @@ Label { id: helper } + /*! @brief The edit this label is connected to + * + * @default{`nextItemInFocusChain()`} + * + * If the edit gets the input focus, this label gets highlighted + * + * @accessors{ + * @memberAc{edit} + * @notifyAc{editChanged()} + * } + */ property Item edit: _decorLabel.nextItemInFocusChain() + /*! @brief Checks if the connected edit currently has input focus + * + * @default{`false`} + * + * @accessors{ + * @memberAc{editHasFocus} + * @notifyAc{editHasFocusChanged()} + * @readonlyAc + * } + */ readonly property bool editHasFocus: edit && edit.focus color: editHasFocus ? helper.highlight : helper.text diff --git a/src/imports/mvvmquick/FileDialog.qml b/src/imports/mvvmquick/FileDialog.qml index deb5706..1c24d33 100644 --- a/src/imports/mvvmquick/FileDialog.qml +++ b/src/imports/mvvmquick/FileDialog.qml @@ -13,7 +13,8 @@ import de.skycoder42.QtMvvm.Quick 1.1 * dialog message type * * @note On Android, the dialog extends the FileChooser. For all other platforms, it extends - * the @ref Qt.labs.platform.FileDialog "Qt labs FileDialog" + * the @ref Qt.labs.platform.FileDialog "Qt labs FileDialog" - an experimental module, and + * thus might not always function perfectly or break after Qt updates */ Labs.FileDialog { id: _fileDialog @@ -68,11 +69,11 @@ Labs.FileDialog { modality: Qt.WindowModal folder: msgConfig.defaultValue fileMode: { - if(msgConfig.subType == "open") + if(msgConfig.subType === "open") return Labs.FileDialog.OpenFile; - else if(msgConfig.subType == "files") + else if(msgConfig.subType === "files") return Labs.FileDialog.OpenFiles; - else if(msgConfig.subType == "save") + else if(msgConfig.subType === "save") return Labs.FileDialog.SaveFile; else { return Labs.FileDialog.OpenFile; //fallback @@ -87,7 +88,7 @@ Labs.FileDialog { onAccepted: { if(msgResult) { - if(msgConfig.subType == "files") + if(msgConfig.subType === "files") msgResult.result = _fileDialog.files; else msgResult.result = _fileDialog.file; diff --git a/src/imports/mvvmquick/FolderDialog.qml b/src/imports/mvvmquick/FolderDialog.qml index 67a3712..2442ebe 100644 --- a/src/imports/mvvmquick/FolderDialog.qml +++ b/src/imports/mvvmquick/FolderDialog.qml @@ -13,7 +13,8 @@ import de.skycoder42.QtMvvm.Quick 1.1 * dialog message type * * @note On Android, the dialog extends the FileChooser. For all other platforms, it extends - * the @ref Qt.labs.platform.FolderDialog "Qt labs FolderDialog" + * the @ref Qt.labs.platform.FolderDialog "Qt labs FolderDialog" - an experimental module, and + * thus might not always function perfectly or break after Qt updates */ Labs.FolderDialog { id: _folderDialog diff --git a/src/imports/mvvmquick/MenuButton.qml b/src/imports/mvvmquick/MenuButton.qml index f11b401..3147958 100644 --- a/src/imports/mvvmquick/MenuButton.qml +++ b/src/imports/mvvmquick/MenuButton.qml @@ -23,7 +23,7 @@ import de.skycoder42.QtMvvm.Quick 1.1 * } * @endcode * - * @sa ContrastToolBar + * @sa RoundActionButton */ ActionButton { id: _menuButton @@ -39,7 +39,6 @@ ActionButton { * * @accessors{ * @memberAc{moreMenu} - * @notifyAc{moreMenuChanged()} * @readonlyAc * } * diff --git a/src/imports/mvvmquick/MsgBoxBase.qml b/src/imports/mvvmquick/MsgBoxBase.qml index ae62d18..6093a7d 100644 --- a/src/imports/mvvmquick/MsgBoxBase.qml +++ b/src/imports/mvvmquick/MsgBoxBase.qml @@ -12,7 +12,7 @@ AlertDialog { property MessageResult msgResult property alias iconVisible: _icon.visible - property alias iconSource: _icon.source + property alias iconSource: _icon.icon.source property bool autoHandleBtns: true signal buttonClicked(int button) diff --git a/src/imports/mvvmquick/MsgDelegate.qml b/src/imports/mvvmquick/MsgDelegate.qml index b4fd3e9..c03b976 100644 --- a/src/imports/mvvmquick/MsgDelegate.qml +++ b/src/imports/mvvmquick/MsgDelegate.qml @@ -3,14 +3,73 @@ import QtQuick.Controls 2.3 import QtQuick.Layouts 1.3 import de.skycoder42.QtMvvm.Quick 1.1 +/*! @brief A basic input delegate for the QtMvvm::SettingsViewModel + * + * @extends QtQuick.Controls.ItemDelegate + * + * This delegate will simply display the standard settings properties and a simple value + * preview text based on the formatter. When pressed, it shows an input dialog for the + * delegates type to edit the value. + * + * You can extend this delegate if you want to have a custom value indicator, but keep the + * editing mechanism. + * + * Available roles are: + * + * - group + * - key + * - type + * - title + * - tooltip + * - delegateUrl + * - inputValue + * - properties + * - preview + */ ItemDelegate { id: _msgDelegate + /*! @brief type:Component A @ref QtQml.Component "Component" to be shown as the indicator + * + * @default{`undefined`} + * + * @accessors{ + * @memberAc{indicatorComponent} + * @notifyAc{indicatorComponentChanged()} + * } + * + * @sa @ref QtQuick.Loader "Loader.sourceComponent" + */ property alias indicatorComponent: _indicator.sourceComponent + /*! @brief type:url A url to be shown as the indicator + * + * @default{`undefined`} + * + * @accessors{ + * @memberAc{indicatorSource} + * @notifyAc{indicatorSourceChanged()} + * } + * + * @sa @ref QtQuick.Loader "Loader.source" + */ property alias indicatorSource: _indicator.source + /*! @brief The type id of the edit dialog to be shown + * + * @default{`model.type`} + * + * Normally, the type of the input dialog is the same as the delegates type. But in case + * you want to show a different kind of dialog, you can do so by setting this property to + * the target type. + * + * @accessors{ + * @memberAc{editDialogType} + * @notifyAc{editDialogTypeChanged()} + * } + */ property string editDialogType: type + //! @private Internal signal signal showInput(string key, string title, string type, var defaultValue, var properties); text: title diff --git a/src/imports/mvvmquick/OverviewListView.qml b/src/imports/mvvmquick/OverviewListView.qml index 72ad5de..6520dac 100644 --- a/src/imports/mvvmquick/OverviewListView.qml +++ b/src/imports/mvvmquick/OverviewListView.qml @@ -29,7 +29,7 @@ ListView { TintIcon { id: tintIcon - source: iconUrl + icon.source: iconUrl visible: iconUrl != "" Layout.row: 0 Layout.column: 0 @@ -62,7 +62,7 @@ ListView { TintIcon { id: openIcon - source: "qrc:/de/skycoder42/qtmvvm/quick/icons/ic_chevron_right.svg" + icon.source: "qrc:/de/skycoder42/qtmvvm/quick/icons/ic_chevron_right.svg" Layout.row: 0 Layout.column: 2 Layout.rowSpan: 2 diff --git a/src/imports/mvvmquick/ProgressDialog.qml b/src/imports/mvvmquick/ProgressDialog.qml index 18687c1..6e6b625 100644 --- a/src/imports/mvvmquick/ProgressDialog.qml +++ b/src/imports/mvvmquick/ProgressDialog.qml @@ -23,9 +23,12 @@ MsgBoxBase { msgResult.setCloseTarget(_progressDialog, "finish()"); } - function finish() { + onClosed: { if(progressControl) - notifyClosed.notifyClosed(); + Qt.callLater(progressControl.notifyClosed); + } + + function finish() { if(msgResult) { msgResult.complete(_cancelAction); msgResult = null; @@ -34,7 +37,7 @@ MsgBoxBase { } function tryCancel(button) { - if(_cancelAction == MessageConfig.NoButton) { + if(_cancelAction === MessageConfig.NoButton) { _cancelAction = button; footer.enabled = false; if(progressControl) diff --git a/src/imports/mvvmquick/RoundMenuButton.qml b/src/imports/mvvmquick/RoundMenuButton.qml index 42b752f..2921eff 100644 --- a/src/imports/mvvmquick/RoundMenuButton.qml +++ b/src/imports/mvvmquick/RoundMenuButton.qml @@ -2,21 +2,159 @@ import QtQuick 2.10 import QtQuick.Controls 2.3 import de.skycoder42.QtMvvm.Quick 1.1 +/*! @brief An extension of the RoundActionButton to provide a roudn button with sub-elements + * + * @extends QtQuick.Item + * + * The elment consists of a primary round button. When clicked, the button gets toggled and + * moves out smaller round buttons from it in a row with the given menu actions on them. The + * sub buttons are created from a list of @ref QtQuick.Controls.Action "Action" elements + * + * @code{.qml} + * RoundMenuButton { + * id: mButton + * + * Action { + * text: "Copy" + * icon.name: "copy" + * } + * + * Action { + * text: "Paste" + * icon.name: "paste" + * } + * + * //... + * } + * @endcode + * + * @sa RoundActionButton, MenuButton + */ Item { id: _roundMenuButton + /*! @brief type:string The text/tooltip to be shown for the primary button + * + * @default{empty} + * + * @accessors{ + * @memberAc{text} + * @notifyAc{textChanged()} + * } + */ property alias text: _rootButton.text + /*! @brief type:Icon The icon to be shown for the primary button + * + * @default{empty} + * + * @accessors{ + * @memberAc{icon} + * @notifyAc{iconChanged()} + * } + */ property alias icon: _rootButton.icon + /*! @brief type:bool The current check state of the primary button + * + * @default{`false`} + * + * If set to true, the button is checked and the sub buttons visible. If false, the button + * is not checked and the sub buttons are hidden. + * + * @accessors{ + * @memberAc{checked} + * @notifyAc{checkedChanged()} + * } + */ property alias checked: _rootButton.checked + /*! @brief The spacing between individual sub buttons + * + * @default{`16`} + * + * @accessors{ + * @memberAc{buttonSpacing} + * @notifyAc{buttonSpacingChanged()} + * } + */ property real buttonSpacing: 16 + /*! @brief The angle (in degree) to show the sub buttons in + * + * @default{`0`} + * + * The sub buttons are expanded in a line from the center of the primary buttons. The + * direction in wich they expand is determined by this angle. An angle of 0° means they + * are displayed straight above the button. From there, the angle is counted clockwise, + * i.e. an angle of 90° will show them straight to the right + * + * @accessors{ + * @memberAc{expansionAngle} + * @notifyAc{expansionAngleChanged()} + * } + */ property real expansionAngle: 0 + /*! @brief The size of the sub buttons + * + * @default{`Qt.size(40, 40)`} + * + * @accessors{ + * @memberAc{subButtonSize} + * @notifyAc{subButtonSizeChanged()} + * } + */ property size subButtonSize: Qt.size(40, 40) + /*! @brief Tooltips are automatically shown beneath each sub button + * + * @default{`false`} + * + * Normally, the button tooltips are only visible when the sub buttons are long pressed. + * Setting this to true will automatically show the tooltips on expansion and keep them + * visible as long as the items are expanded. + * + * @accessors{ + * @memberAc{stickyToolTips} + * @notifyAc{stickyToolTipsChanged()} + * } + * + * @sa RoundMenuButton::invertToolTipDirection + */ property bool stickyToolTips: false + /*! @brief Can be used to inverte the tooltip position + * + * @default{`Qt.application.layoutDirection == Qt.RightToLeft`} + * + * The position of the sticky tooltips is determined automatically depending on the + * expansionAngle. It can be to the right or to the left of the buttons. In case you need + * to show them on the exact opposite size, you can set this property to true + * + * @accessors{ + * @memberAc{invertToolTipDirection} + * @notifyAc{invertToolTipDirectionChanged()} + * } + * + * @sa RoundMenuButton::stickyToolTips, RoundMenuButton::expansionAngle + */ property bool invertToolTipDirection: Qt.application.layoutDirection == Qt.RightToLeft + /*! @brief type:RoundActionButton A reference to the primary button + * + * @default{A RoundActionButton instance} + * + * @accessors{ + * @memberAc{rootButton} + * @readonlyAc + * } + */ readonly property alias rootButton: _rootButton + /*! @brief The actions that are displayed as the sub buttons + * + * @default{empty} + * + * @accessors{ + * @memberAc{actions} + * @defaultAc + * } + */ default property list actions implicitWidth: _rootButton.implicitWidth diff --git a/src/imports/mvvmquick/SearchBar.qml b/src/imports/mvvmquick/SearchBar.qml index 6b0acc7..5aa8cac 100644 --- a/src/imports/mvvmquick/SearchBar.qml +++ b/src/imports/mvvmquick/SearchBar.qml @@ -3,20 +3,105 @@ import QtQuick.Controls 2.3 import QtQuick.Layouts 1.3 import de.skycoder42.QtMvvm.Quick 1.1 +/*! @brief A ToolBarLabel with a search button next to it, that can turn into a searchbar + * + * @extends QtQuick.Item + * + * This provides the standard "searchbar in titlebar" style control. In the normal state, it + * displays a normal ToolBarLabel with the title in it, and a simple ActionButton as search + * button next to it. When the button gets pressed, the label gets replaced with a TextField + * and the user can enter a searchText. Clicking the button again closes the edit and clears + * the text. + * + * @sa ToolBarLabel, ActionButton + */ Item { id: _searchBar + /*! @brief type:string The title to be shown in the ToolBarLabel when not searching + * + * @default{empty} + * + * @accessors{ + * @memberAc{title} + * @notifyAc{titleChanged()} + * } + */ property alias title: _titleLabel.text + /*! @brief type:bool Specify, whether searching is currently allowed + * + * @default{`true`} + * + * If disallowed, the search button gets hidden and the title shown. The will not be able + * to start a search until this property gets set to true again. + * + * @accessors{ + * @memberAc{allowSearch} + * @notifyAc{allowSearchChanged()} + * } + */ property alias allowSearch: _searchButton.visible + /*! @brief type:string The tooltip/text of the search button + * + * @default{`Search…` (translated)} + * + * @accessors{ + * @memberAc{searchToolTip} + * @notifyAc{searchToolTipChanged()} + * } + */ property alias searchToolTip: _searchButton.text - property bool inSearchMode: state == "search" + /*! @brief Specifies, whether the bar is currently in search mode or in title mode + * + * @default{`false`} + * + * @accessors{ + * @memberAc{inSearchMode} + * @notifyAc{inSearchModeChanged()} + * @readonlyAc + * } + */ + readonly property bool inSearchMode: state == "search" + /*! @brief type:string The current text of the search TextField + * + * @default{empty} + * + * You can use this property to get the text that was entered by the user and you can + * modify it yourself to change the entered search string. + * + * @accessors{ + * @memberAc{searchText} + * @notifyAc{searchTextChanged()} + * } + */ property alias searchText: _searchField.text + /*! @brief type:ActionButton Specifies, whether the bar is currently in search mode or in title mode + * + * @default{reference to the internal button} + * + * You can use this reference to access the internally used button + * + * @accessors{ + * @memberAc{searchButton} + * @readonlyAc + * } + */ + readonly property alias searchButton: _searchButton + //! @brief Can be called to ensure the title is shown and not the search bar function showTitle() { state = "title"; } + /*! + * @brief Can be called to open the search bar + * + * @param type:string text An optional text to set a search text + * + * Opens the searchbar, if not already open, and replaces the search text by text, if + * valid, or does not change it. + */ function showSearchBar(text) { if(typeof text === "string") searchText = text @@ -39,6 +124,7 @@ Item { } RowLayout { + id: _barLayout anchors.fill: parent spacing: 0 diff --git a/src/imports/mvvmquick/TimeEdit.qml b/src/imports/mvvmquick/TimeEdit.qml index 2fd29da..129cb6a 100644 --- a/src/imports/mvvmquick/TimeEdit.qml +++ b/src/imports/mvvmquick/TimeEdit.qml @@ -2,23 +2,80 @@ import QtQuick 2.10 import QtQuick.Controls 2.3 import QtQuick.Layouts 1.3 +/*! @brief A edit view to edit times by using tumblers + * + * @extends QtQuick.Layouts.RowLayout + * + * You can use this edit if you want to let the user select a time. You can use the properties + * to control wich tumblers are shown and which format they use + */ RowLayout { id: _edit spacing: 0 + /*! @brief The time currently displayed and edited + * + * @default{`new Date()`} + * + * @note Only the time-componente of the date object is used. + * + * @accessors{ + * @memberAc{time} + * @notifyAc{timeChanged()} + * } + */ property date time: new Date() onTimeChanged: { - if(!_skipChange) - _forceTime = time + if(!_p.skipChange) + _p.forceTime = time } - property date _forceTime: new Date() - + /*! @brief Specify, whether the user should be able to edit the hours of the time + * + * @default{`true`} + * + * @accessors{ + * @memberAc{showHours} + * @notifyAc{showHoursChanged()} + * } + */ property bool showHours: true + /*! @brief Specify, whether the user should be able to edit the minutes of the time + * + * @default{`true`} + * + * @accessors{ + * @memberAc{showMinutes} + * @notifyAc{showMinutesChanged()} + * } + */ property bool showMinutes: true + /*! @brief Specify, whether the user should be able to edit the seconds of the time + * + * @default{`false`} + * + * @accessors{ + * @memberAc{showSeconds} + * @notifyAc{showSecondsChanged()} + * } + */ property bool showSeconds: false - readonly property bool is24Hours: { + /*! @brief Holds the time format to use to edit the time + * + * @default{locale dependend} + * + * In 24h format, the hour tumbler shows 0-24 as numbers. In the 12h format, it shows the + * numbers 1-12 and an additional tumbler with "am" and "pm" is shown to the far right. + * The correct version is detected from the locale, but you can always overwrite it to fit + * your needs. + * + * @accessors{ + * @memberAc{use24HourFormat} + * @notifyAc{use24HourFormatChanged()} + * } + */ + property bool use24HourFormat: { var fmStr = Qt.locale().timeFormat(Locale.LongFormat); var isApPm = false; ["A", "AP", "a", "ap"].forEach(function(text){ @@ -28,18 +85,53 @@ RowLayout { return !isApPm; } - readonly property int hours: showHours ? (_hourTumbler.currentIndex + (!is24Hours && _amPmTumbler.currentIndex === 1 ? 12 : 0)) : 0 + /*! @brief Holds the currently displayed hours (in 24h format) + * + * @default{time dependend} + * + * @accessors{ + * @memberAc{hours} + * @notifyAc{hoursChanged()} + * @readonlyAc + * } + */ + readonly property int hours: showHours ? (_hourTumbler.currentIndex + (!use24HourFormat && _amPmTumbler.currentIndex === 1 ? 12 : 0)) : 0 + /*! @brief Holds the currently displayed minutes + * + * @default{time dependend} + * + * @accessors{ + * @memberAc{minutes} + * @notifyAc{minutesChanged()} + * @readonlyAc + * } + */ readonly property int minutes: showMinutes ? _minuteTumbler.currentIndex : 0 + /*! @brief Holds the currently displayed seconds + * + * @default{time dependend} + * + * @accessors{ + * @memberAc{seconds} + * @notifyAc{secondsChanged()} + * @readonlyAc + * } + */ readonly property int seconds: showSeconds ? _secondsTumbler.currentIndex : 0 - property bool _skipChange: false - function recalcTime() { - if(_forceTime.getHours() !== hours || - _forceTime.getMinutes() !== minutes || - _forceTime.getSeconds() !== seconds) { - _skipChange = true; - time = new Date(0, 0, 0, hours, minutes, seconds); - _skipChange = false; + QtObject { + id: _p + property date forceTime: new Date() + property bool skipChange: false + + function recalcTime() { + if(_p.forceTime.getHours() !== hours || + _p.forceTime.getMinutes() !== minutes || + _p.forceTime.getSeconds() !== seconds) { + _p.skipChange = true; + time = new Date(0, 0, 0, hours, minutes, seconds); + _p.skipChange = false; + } } } @@ -54,15 +146,15 @@ RowLayout { id: _hourTumbler visible: showHours model: { - var model = new Array(is24Hours ? 24 : 12); + var model = new Array(use24HourFormat ? 24 : 12); for(var i = 0; i < model.length; i++) model[i] = i.toString(); - if(!is24Hours) + if(!use24HourFormat) model[0] = 12; return model; } - currentIndex: is24Hours ? _forceTime.getHours() : (_forceTime.getHours() % 12) - onCurrentIndexChanged: Qt.callLater(recalcTime) + currentIndex: use24HourFormat ? _p.forceTime.getHours() : (_p.forceTime.getHours() % 12) + onCurrentIndexChanged: Qt.callLater(_p.recalcTime) } Label { @@ -82,8 +174,8 @@ RowLayout { } return mod; } - currentIndex: _forceTime.getMinutes() - onCurrentIndexChanged: Qt.callLater(recalcTime) + currentIndex: _p.forceTime.getMinutes() + onCurrentIndexChanged: Qt.callLater(_p.recalcTime) } Label { @@ -103,19 +195,19 @@ RowLayout { } return mod; } - currentIndex: _forceTime.getSeconds() - onCurrentIndexChanged: Qt.callLater(recalcTime) + currentIndex: _p.forceTime.getSeconds() + onCurrentIndexChanged: Qt.callLater(_p.recalcTime) } TimeTumbler { id: _amPmTumbler - visible: !is24Hours && showHours + visible: !use24HourFormat && showHours model: [ Qt.locale().amText, Qt.locale().pmText, ] - currentIndex: _forceTime.getHours() >= 12 ? 1 : 0 - onCurrentIndexChanged: Qt.callLater(recalcTime) + currentIndex: _p.forceTime.getHours() >= 12 ? 1 : 0 + onCurrentIndexChanged: Qt.callLater(_p.recalcTime) } Item { diff --git a/src/imports/mvvmquick/TintIcon.qml b/src/imports/mvvmquick/TintIcon.qml index a873ecb..aa5f33f 100644 --- a/src/imports/mvvmquick/TintIcon.qml +++ b/src/imports/mvvmquick/TintIcon.qml @@ -3,12 +3,30 @@ import QtQuick.Controls 2.3 import QtGraphicalEffects 1.0 import de.skycoder42.QtMvvm.Quick 1.1 +/*! @brief A simply tinted icon, exactly like you find in i.e. the ActionButton + * + * @extends QtQuick.Item + * + * If you want to use an icon, just like in a ActionButton, you can use this class. It behaves + * exactly the same, but is of course not clickable. + * + * @sa ContrastToolBar, MenuButton + */ Item { id: _tintIcon + /*! @brief type:Icon The icon itself + * + * @default{empty icon} + * + * @accessors{ + * @memberAc{icon} + * @notifyAc{iconChanged()} + * } + * + * @sa @ref QtQuick.Controls.AbstractButton "AbstractButton.icon" + */ property alias icon: _imgBtn.icon - property alias source: _imgBtn.icon.source - property alias color: _imgBtn.icon.color implicitWidth: _imgBtn.icon.width implicitHeight: _imgBtn.icon.height diff --git a/src/imports/mvvmquick/mvvmquick.pro b/src/imports/mvvmquick/mvvmquick.pro index 2edcec2..659c391 100644 --- a/src/imports/mvvmquick/mvvmquick.pro +++ b/src/imports/mvvmquick/mvvmquick.pro @@ -26,14 +26,14 @@ SOURCES += \ QML_FILES += \ QtMvvmApp.qml \ - QtMvvmApp11.qml \ + QtMvvmApp10.qml \ PresentingStackView.qml \ - PresentingStackView11.qml \ + PresentingStackView10.qml \ PresenterProgress.qml \ PopupPresenter.qml \ - PopupPresenter11.qml \ + PopupPresenter10.qml \ DialogPresenter.qml \ - DialogPresenter11.qml \ + DialogPresenter10.qml \ TintIcon.qml \ AlertDialog.qml \ ContrastToolBar.qml \ diff --git a/src/imports/mvvmquick/plugins.qmltypes b/src/imports/mvvmquick/plugins.qmltypes index e67abba..f0e08c3 100644 --- a/src/imports/mvvmquick/plugins.qmltypes +++ b/src/imports/mvvmquick/plugins.qmltypes @@ -8,6 +8,7 @@ import QtQuick.tooling 1.2 Module { dependencies: [ + "Qt.labs.calendar 1.0", "Qt.labs.platform 1.0", "QtGraphicalEffects 1.0", "QtQml 2.2", diff --git a/src/imports/mvvmquick/qmldir b/src/imports/mvvmquick/qmldir index 100f1c1..fbffa63 100644 --- a/src/imports/mvvmquick/qmldir +++ b/src/imports/mvvmquick/qmldir @@ -5,6 +5,7 @@ typeinfo plugins.qmltypes depends QtQuick 2.10 depends QtGraphicalEffects 1.0 depends Qt.labs.platform 1.0 +depends Qt.labs.calendar 1.0 depends de.skycoder42.QtMvvm.Core 1.0 internal MsgBoxBase MsgBoxBase.qml @@ -13,8 +14,8 @@ internal InputDialog InputDialog.qml internal ProgressDialog ProgressDialog.qml internal ListSection ListSection.qml -internal SectionListView SectionListView.qml internal OverviewListView OverviewListView.qml +internal SectionListView SectionListView.qml internal TimeTumbler TimeTumbler.qml @@ -26,8 +27,8 @@ ToolBarLabel 1.0 ToolBarLabel.qml ActionButton 1.0 ActionButton.qml RoundActionButton 1.0 RoundActionButton.qml MenuButton 1.0 MenuButton.qml -TintIcon 1.1 TintIcon.qml +TintIcon 1.1 TintIcon.qml SearchBar 1.1 SearchBar.qml RoundMenuButton 1.1 RoundMenuButton.qml DecorLabel 1.1 DecorLabel.qml @@ -37,15 +38,15 @@ DateEdit 1.1 DateEdit.qml ColorEdit 1.1 ColorEdit.qml PresenterProgress 1.0 PresenterProgress.qml -PresentingStackView 1.0 PresentingStackView.qml -PresentingStackView 1.1 PresentingStackView11.qml -PopupPresenter 1.0 PopupPresenter.qml -PopupPresenter 1.1 PopupPresenter11.qml -DialogPresenter 1.0 DialogPresenter.qml -DialogPresenter 1.1 DialogPresenter11.qml +PresentingStackView 1.0 PresentingStackView10.qml +PresentingStackView 1.1 PresentingStackView.qml +PopupPresenter 1.0 PopupPresenter10.qml +PopupPresenter 1.1 PopupPresenter.qml +DialogPresenter 1.0 DialogPresenter10.qml +DialogPresenter 1.1 DialogPresenter.qml PresentingDrawer 1.0 PresentingDrawer.qml SettingsView 1.0 SettingsView.qml -QtMvvmApp 1.0 QtMvvmApp.qml -QtMvvmApp 1.1 QtMvvmApp11.qml +QtMvvmApp 1.0 QtMvvmApp10.qml +QtMvvmApp 1.1 QtMvvmApp.qml diff --git a/src/mvvmcore/mvvmcore.pro b/src/mvvmcore/mvvmcore.pro index a705e7e..c590548 100644 --- a/src/mvvmcore/mvvmcore.pro +++ b/src/mvvmcore/mvvmcore.pro @@ -42,7 +42,7 @@ SOURCES += \ settingsconfigloader.cpp android { - QT += androidextras + #QT += androidextras HEADERS += \ androidsettingsaccessor.h \