Browse Source

complete qml doc

pull/2/head
Skycoder42 7 years ago
parent
commit
7ae023c530
No known key found for this signature in database GPG Key ID: 8E01AD9EF0578D2B
  1. 13
      doc/Doxyfile
  2. 18
      doc/qtmvvm.dox
  3. 1
      src/imports/mvvmdatasyncquick/plugins.qmltypes
  4. 29
      src/imports/mvvmquick/ColorEdit.qml
  5. 39
      src/imports/mvvmquick/ColorHelper.qml
  6. 2
      src/imports/mvvmquick/ContrastToolBar.qml
  7. 57
      src/imports/mvvmquick/DateEdit.qml
  8. 31
      src/imports/mvvmquick/DecorLabel.qml
  9. 11
      src/imports/mvvmquick/FileDialog.qml
  10. 3
      src/imports/mvvmquick/FolderDialog.qml
  11. 3
      src/imports/mvvmquick/MenuButton.qml
  12. 2
      src/imports/mvvmquick/MsgBoxBase.qml
  13. 59
      src/imports/mvvmquick/MsgDelegate.qml
  14. 4
      src/imports/mvvmquick/OverviewListView.qml
  15. 9
      src/imports/mvvmquick/ProgressDialog.qml
  16. 138
      src/imports/mvvmquick/RoundMenuButton.qml
  17. 88
      src/imports/mvvmquick/SearchBar.qml
  18. 142
      src/imports/mvvmquick/TimeEdit.qml
  19. 22
      src/imports/mvvmquick/TintIcon.qml
  20. 8
      src/imports/mvvmquick/mvvmquick.pro
  21. 1
      src/imports/mvvmquick/plugins.qmltypes
  22. 21
      src/imports/mvvmquick/qmldir
  23. 2
      src/mvvmcore/mvvmcore.pro

13
doc/Doxyfile

@ -900,13 +900,14 @@ RECURSIVE = YES
EXCLUDE = ../src/3rdparty \ EXCLUDE = ../src/3rdparty \
../src/plugins \ ../src/plugins \
../src/imports/mvvmquick/settingsuibuilder.h \ ../src/imports/mvvmquick/settingsuibuilder.h \
../src/imports/mvvmquick/TintIcon.qml \
../src/imports/mvvmquick/MsgBoxBase.qml \ ../src/imports/mvvmquick/MsgBoxBase.qml \
../src/imports/mvvmquick/MsgBox.qml \ ../src/imports/mvvmquick/MsgBox.qml \
../src/imports/mvvmquick/ProgressDialog.qml \
../src/imports/mvvmquick/InputDialog.qml \ ../src/imports/mvvmquick/InputDialog.qml \
../src/imports/mvvmquick/ListSection.qml \ ../src/imports/mvvmquick/ListSection.qml \
../src/imports/mvvmquick/OverviewListView.qml \ ../src/imports/mvvmquick/OverviewListView.qml \
../src/imports/mvvmquick/SectionListView.qml \ ../src/imports/mvvmquick/SectionListView.qml \
../src/imports/mvvmquick/TimeTumbler.qml \
../src/imports/mvvmquick/AndroidFileDialog.qml \ ../src/imports/mvvmquick/AndroidFileDialog.qml \
../src/imports/mvvmquick/AndroidFolderDialog.qml \ ../src/imports/mvvmquick/AndroidFolderDialog.qml \
../src/imports/mvvmdatasyncquick/SubButton.qml \ ../src/imports/mvvmdatasyncquick/SubButton.qml \
@ -936,7 +937,8 @@ EXCLUDE_PATTERNS = moc_* \
*.cpp \ *.cpp \
*/src/mvvmquick/*.qml \ */src/mvvmquick/*.qml \
*/src/mvvmdatasyncquick/*.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 # The EXCLUDE_SYMBOLS tag can be used to specify one or more symbol names
# (namespaces, classes, functions, etc.) that should be excluded from the # (namespaces, classes, functions, etc.) that should be excluded from the
@ -972,20 +974,25 @@ EXCLUDE_SYMBOLS = QtMvvm::__helpertypes \
QPaintEngineEx \ QPaintEngineEx \
QQmlExtensionInterface \ QQmlExtensionInterface \
QTechniqueFilter \ QTechniqueFilter \
QAbstractXmlReceiver \
\ \
ApplicationWindow \ ApplicationWindow \
Control \
Dialog \ Dialog \
Drawer \ Drawer \
GridLayout \
Item \ Item \
ItemDelegate \
Label \ Label \
ListView \ ListView \
Page \ Page \
ProgressBar \ ProgressBar \
QtObject \ QtObject \
RoundButton \ RoundButton \
RowLayout \
StackView \ StackView \
ToolBar \ ToolBar \
ToolButton ToolButton \
# The EXAMPLE_PATH tag can be used to specify one or more files or directories # 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 # that contain example code fragments that are included (see the \include

18
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 @brief The QML import for the QtMvvmCore QML module
<b>Current Version</b><br/> <b>Current Version</b><br/>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;1.0 &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;1.1
<b>Available Types</b> <b>Available Types</b>
- @ref QtMvvm::MessageConfig "MessageConfig" (uncreatable) - @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 @brief The QML import for the QtMvvmQuick QML module
<b>Current Version</b><br/> <b>Current Version</b><br/>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;1.0 &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;1.1
<b>Available Types</b> <b>Available Types</b>
- @ref QtMvvm::InputViewFactory "InputViewFactory" (uncreatable) - @ref QtMvvm::InputViewFactory "InputViewFactory" (uncreatable)
- QuickPresenter (singleton) - QuickPresenter (singleton)
- FileChooser - FileChooser
- ViewPlaceholder
- ColorHelper
- AlertDialog - AlertDialog
- ContrastToolBar - ContrastToolBar
- ToolBarLabel - ToolBarLabel
@ -82,6 +84,14 @@ The following list shows which classes belong to which Qt module, in alphabetica
- MenuButton - MenuButton
- FileDialog - FileDialog
- FolderDialog - FolderDialog
- TintIcon
- SearchBar
- RoundMenuButton
- DecorLabel
- MsgDelegate
- TimeEdit
- DateEdit
- ColorEdit
- PresenterProgress - PresenterProgress
- PresentingStackView - PresentingStackView
- PopupPresenter - 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 @brief The QML import for the QtMvvmDataSyncCore QML module
<b>Current Version</b><br/> <b>Current Version</b><br/>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;1.0 &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;1.1
<b>Available Types</b> <b>Available Types</b>
- @ref QtMvvm::AccountModel "AccountModel" - @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 @brief The QML import for the QtMvvmDataSyncQuick QML module
<b>Current Version</b><br/> <b>Current Version</b><br/>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;1.0 &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;1.1
<b>Available Types</b> <b>Available Types</b>
- DataSyncView - DataSyncView

1
src/imports/mvvmdatasyncquick/plugins.qmltypes

@ -8,6 +8,7 @@ import QtQuick.tooling 1.2
Module { Module {
dependencies: [ dependencies: [
"Qt.labs.calendar 1.0",
"Qt.labs.platform 1.0", "Qt.labs.platform 1.0",
"QtGraphicalEffects 1.0", "QtGraphicalEffects 1.0",
"QtQml 2.2", "QtQml 2.2",

29
src/imports/mvvmquick/ColorEdit.qml

@ -5,6 +5,14 @@ import QtQuick.Layouts 1.3
import QtGraphicalEffects 1.0 import QtGraphicalEffects 1.0
import de.skycoder42.QtMvvm.Quick 1.1 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 { GridLayout {
id: _colorPicker id: _colorPicker
columns: 2 columns: 2
@ -14,7 +22,28 @@ GridLayout {
id: helper 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 property bool alpha: false
/*! @brief The color currently displayed and edited
*
* @default{`undefined`}
*
* @accessors{
* @memberAc{color}
* @notifyAc{colorChanged()}
* }
*/
property color color property color color
onColorChanged: { onColorChanged: {
if(!_p.changing){ if(!_p.changing){

39
src/imports/mvvmquick/ColorHelper.qml

@ -4,10 +4,34 @@ import QtQuick.Controls.Material 2.3
import QtQuick.Controls.Universal 2.3 import QtQuick.Controls.Universal 2.3
import de.skycoder42.QtMvvm.Quick 1.1 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 { Control {
id: _colorHelper id: _colorHelper
visible: false visible: false
/*! @brief The color to use to highlight stuff
*
* @default{<i>style dependant</i>}
*
* Style | Value
* -------------|-------
* Material | Material.accent
* Universal | Universal.accent
* Others | palette.highlight
*
* @accessors{
* @memberAc{highlight}
* @notifyAc{highlightChanged()}
* }
*/
readonly property color highlight: { readonly property color highlight: {
if(QuickPresenter.currentStyle === "Material") if(QuickPresenter.currentStyle === "Material")
return Material.accent; return Material.accent;
@ -17,6 +41,21 @@ Control {
return palette.highlight; return palette.highlight;
} }
/*! @brief The color to use for text
*
* @default{<i>style dependant</i>}
*
* Style | Value
* -------------|-------
* Material | Material.foreground
* Universal | Universal.foreground
* Others | palette.windowText
*
* @accessors{
* @memberAc{text}
* @notifyAc{textChanged()}
* }
*/
readonly property color text: { readonly property color text: {
if(QuickPresenter.currentStyle === "Material") if(QuickPresenter.currentStyle === "Material")
return Material.foreground; return Material.foreground;

2
src/imports/mvvmquick/ContrastToolBar.qml

@ -17,7 +17,7 @@ ToolBar {
height: 56 height: 56
// @copydoc QuickPresenter::accentTextColor //! @copydoc QuickPresenter::accentTextColor
function accentTextColor(accentColor, baseColor) { function accentTextColor(accentColor, baseColor) {
return QuickPresenter.accentTextColor(accentColor, baseColor); return QuickPresenter.accentTextColor(accentColor, baseColor);
} }

57
src/imports/mvvmquick/DateEdit.qml

@ -4,24 +4,67 @@ import QtQuick.Layouts 1.3
import Qt.labs.calendar 1.0 import Qt.labs.calendar 1.0
import de.skycoder42.QtMvvm.Quick 1.1 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 { ListView {
id: _calenderList 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) 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 lastDate: new Date(9999, 11, 31)
property date date: today(); /*! @brief The date currently displayed and edited
*
function today() { * @default{`new Date()`}
var cDate = new Date(); *
cDate.setHours(0, 0, 0, 0, 0); * @note Only the date-componente of the date object is used.
return cDate; *
} * @accessors{
* @memberAc{date}
* @notifyAc{dateChanged()}
* }
*/
property date date: _p.today();
QtObject { QtObject {
id: _p id: _p
property bool _skipNextFocus: false property bool _skipNextFocus: false
function today() {
var cDate = new Date();
cDate.setHours(0, 0, 0, 0, 0);
return cDate;
}
function focusDate() { function focusDate() {
if(_skipNextFocus) if(_skipNextFocus)
_skipNextFocus = false; _skipNextFocus = false;

31
src/imports/mvvmquick/DecorLabel.qml

@ -2,6 +2,16 @@ import QtQuick 2.10
import QtQuick.Controls 2.3 import QtQuick.Controls 2.3
import de.skycoder42.QtMvvm.Quick 1.1 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 { Label {
id: _decorLabel id: _decorLabel
@ -9,8 +19,29 @@ Label {
id: helper 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() 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 readonly property bool editHasFocus: edit && edit.focus
color: editHasFocus ? helper.highlight : helper.text color: editHasFocus ? helper.highlight : helper.text

11
src/imports/mvvmquick/FileDialog.qml

@ -13,7 +13,8 @@ import de.skycoder42.QtMvvm.Quick 1.1
* dialog message type * dialog message type
* *
* @note On Android, the dialog extends the FileChooser. For all other platforms, it extends * @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 { Labs.FileDialog {
id: _fileDialog id: _fileDialog
@ -68,11 +69,11 @@ Labs.FileDialog {
modality: Qt.WindowModal modality: Qt.WindowModal
folder: msgConfig.defaultValue folder: msgConfig.defaultValue
fileMode: { fileMode: {
if(msgConfig.subType == "open") if(msgConfig.subType === "open")
return Labs.FileDialog.OpenFile; return Labs.FileDialog.OpenFile;
else if(msgConfig.subType == "files") else if(msgConfig.subType === "files")
return Labs.FileDialog.OpenFiles; return Labs.FileDialog.OpenFiles;
else if(msgConfig.subType == "save") else if(msgConfig.subType === "save")
return Labs.FileDialog.SaveFile; return Labs.FileDialog.SaveFile;
else { else {
return Labs.FileDialog.OpenFile; //fallback return Labs.FileDialog.OpenFile; //fallback
@ -87,7 +88,7 @@ Labs.FileDialog {
onAccepted: { onAccepted: {
if(msgResult) { if(msgResult) {
if(msgConfig.subType == "files") if(msgConfig.subType === "files")
msgResult.result = _fileDialog.files; msgResult.result = _fileDialog.files;
else else
msgResult.result = _fileDialog.file; msgResult.result = _fileDialog.file;

3
src/imports/mvvmquick/FolderDialog.qml

@ -13,7 +13,8 @@ import de.skycoder42.QtMvvm.Quick 1.1
* dialog message type * dialog message type
* *
* @note On Android, the dialog extends the FileChooser. For all other platforms, it extends * @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 { Labs.FolderDialog {
id: _folderDialog id: _folderDialog

3
src/imports/mvvmquick/MenuButton.qml

@ -23,7 +23,7 @@ import de.skycoder42.QtMvvm.Quick 1.1
* } * }
* @endcode * @endcode
* *
* @sa ContrastToolBar * @sa RoundActionButton
*/ */
ActionButton { ActionButton {
id: _menuButton id: _menuButton
@ -39,7 +39,6 @@ ActionButton {
* *
* @accessors{ * @accessors{
* @memberAc{moreMenu} * @memberAc{moreMenu}
* @notifyAc{moreMenuChanged()}
* @readonlyAc * @readonlyAc
* } * }
* *

2
src/imports/mvvmquick/MsgBoxBase.qml

@ -12,7 +12,7 @@ AlertDialog {
property MessageResult msgResult property MessageResult msgResult
property alias iconVisible: _icon.visible property alias iconVisible: _icon.visible
property alias iconSource: _icon.source property alias iconSource: _icon.icon.source
property bool autoHandleBtns: true property bool autoHandleBtns: true
signal buttonClicked(int button) signal buttonClicked(int button)

59
src/imports/mvvmquick/MsgDelegate.qml

@ -3,14 +3,73 @@ import QtQuick.Controls 2.3
import QtQuick.Layouts 1.3 import QtQuick.Layouts 1.3
import de.skycoder42.QtMvvm.Quick 1.1 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 { ItemDelegate {
id: _msgDelegate 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 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 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 property string editDialogType: type
//! @private Internal signal
signal showInput(string key, string title, string type, var defaultValue, var properties); signal showInput(string key, string title, string type, var defaultValue, var properties);
text: title text: title

4
src/imports/mvvmquick/OverviewListView.qml

@ -29,7 +29,7 @@ ListView {
TintIcon { TintIcon {
id: tintIcon id: tintIcon
source: iconUrl icon.source: iconUrl
visible: iconUrl != "" visible: iconUrl != ""
Layout.row: 0 Layout.row: 0
Layout.column: 0 Layout.column: 0
@ -62,7 +62,7 @@ ListView {
TintIcon { TintIcon {
id: openIcon 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.row: 0
Layout.column: 2 Layout.column: 2
Layout.rowSpan: 2 Layout.rowSpan: 2

9
src/imports/mvvmquick/ProgressDialog.qml

@ -23,9 +23,12 @@ MsgBoxBase {
msgResult.setCloseTarget(_progressDialog, "finish()"); msgResult.setCloseTarget(_progressDialog, "finish()");
} }
function finish() { onClosed: {
if(progressControl) if(progressControl)
notifyClosed.notifyClosed(); Qt.callLater(progressControl.notifyClosed);
}
function finish() {
if(msgResult) { if(msgResult) {
msgResult.complete(_cancelAction); msgResult.complete(_cancelAction);
msgResult = null; msgResult = null;
@ -34,7 +37,7 @@ MsgBoxBase {
} }
function tryCancel(button) { function tryCancel(button) {
if(_cancelAction == MessageConfig.NoButton) { if(_cancelAction === MessageConfig.NoButton) {
_cancelAction = button; _cancelAction = button;
footer.enabled = false; footer.enabled = false;
if(progressControl) if(progressControl)

138
src/imports/mvvmquick/RoundMenuButton.qml

@ -2,21 +2,159 @@ import QtQuick 2.10
import QtQuick.Controls 2.3 import QtQuick.Controls 2.3
import de.skycoder42.QtMvvm.Quick 1.1 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 { Item {
id: _roundMenuButton id: _roundMenuButton
/*! @brief type:string The text/tooltip to be shown for the primary button
*
* @default{<i>empty</i>}
*
* @accessors{
* @memberAc{text}
* @notifyAc{textChanged()}
* }
*/
property alias text: _rootButton.text property alias text: _rootButton.text
/*! @brief type:Icon The icon to be shown for the primary button
*
* @default{<i>empty</i>}
*
* @accessors{
* @memberAc{icon}
* @notifyAc{iconChanged()}
* }
*/
property alias icon: _rootButton.icon 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 property alias checked: _rootButton.checked
/*! @brief The spacing between individual sub buttons
*
* @default{`16`}
*
* @accessors{
* @memberAc{buttonSpacing}
* @notifyAc{buttonSpacingChanged()}
* }
*/
property real buttonSpacing: 16 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 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) 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 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 property bool invertToolTipDirection: Qt.application.layoutDirection == Qt.RightToLeft
/*! @brief type:RoundActionButton A reference to the primary button
*
* @default{<i>A RoundActionButton instance</i>}
*
* @accessors{
* @memberAc{rootButton}
* @readonlyAc
* }
*/
readonly property alias rootButton: _rootButton readonly property alias rootButton: _rootButton
/*! @brief The actions that are displayed as the sub buttons
*
* @default{<i>empty</i>}
*
* @accessors{
* @memberAc{actions}
* @defaultAc
* }
*/
default property list<Action> actions default property list<Action> actions
implicitWidth: _rootButton.implicitWidth implicitWidth: _rootButton.implicitWidth

88
src/imports/mvvmquick/SearchBar.qml

@ -3,20 +3,105 @@ import QtQuick.Controls 2.3
import QtQuick.Layouts 1.3 import QtQuick.Layouts 1.3
import de.skycoder42.QtMvvm.Quick 1.1 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 { Item {
id: _searchBar id: _searchBar
/*! @brief type:string The title to be shown in the ToolBarLabel when not searching
*
* @default{<i>empty</i>}
*
* @accessors{
* @memberAc{title}
* @notifyAc{titleChanged()}
* }
*/
property alias title: _titleLabel.text 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 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 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{<i>empty</i>}
*
* 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 property alias searchText: _searchField.text
/*! @brief type:ActionButton Specifies, whether the bar is currently in search mode or in title mode
*
* @default{<i>reference to the internal button</i>}
*
* 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() { function showTitle() {
state = "title"; 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) { function showSearchBar(text) {
if(typeof text === "string") if(typeof text === "string")
searchText = text searchText = text
@ -39,6 +124,7 @@ Item {
} }
RowLayout { RowLayout {
id: _barLayout
anchors.fill: parent anchors.fill: parent
spacing: 0 spacing: 0

142
src/imports/mvvmquick/TimeEdit.qml

@ -2,23 +2,80 @@ import QtQuick 2.10
import QtQuick.Controls 2.3 import QtQuick.Controls 2.3
import QtQuick.Layouts 1.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 { RowLayout {
id: _edit id: _edit
spacing: 0 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() property date time: new Date()
onTimeChanged: { onTimeChanged: {
if(!_skipChange) if(!_p.skipChange)
_forceTime = time _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 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 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 property bool showSeconds: false
readonly property bool is24Hours: { /*! @brief Holds the time format to use to edit the time
*
* @default{<i>locale dependend</i>}
*
* 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 fmStr = Qt.locale().timeFormat(Locale.LongFormat);
var isApPm = false; var isApPm = false;
["A", "AP", "a", "ap"].forEach(function(text){ ["A", "AP", "a", "ap"].forEach(function(text){
@ -28,18 +85,53 @@ RowLayout {
return !isApPm; 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{<i>time dependend</i>}
*
* @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{<i>time dependend</i>}
*
* @accessors{
* @memberAc{minutes}
* @notifyAc{minutesChanged()}
* @readonlyAc
* }
*/
readonly property int minutes: showMinutes ? _minuteTumbler.currentIndex : 0 readonly property int minutes: showMinutes ? _minuteTumbler.currentIndex : 0
/*! @brief Holds the currently displayed seconds
*
* @default{<i>time dependend</i>}
*
* @accessors{
* @memberAc{seconds}
* @notifyAc{secondsChanged()}
* @readonlyAc
* }
*/
readonly property int seconds: showSeconds ? _secondsTumbler.currentIndex : 0 readonly property int seconds: showSeconds ? _secondsTumbler.currentIndex : 0
property bool _skipChange: false
function recalcTime() { QtObject {
if(_forceTime.getHours() !== hours || id: _p
_forceTime.getMinutes() !== minutes || property date forceTime: new Date()
_forceTime.getSeconds() !== seconds) { property bool skipChange: false
_skipChange = true;
time = new Date(0, 0, 0, hours, minutes, seconds); function recalcTime() {
_skipChange = false; 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 id: _hourTumbler
visible: showHours visible: showHours
model: { model: {
var model = new Array(is24Hours ? 24 : 12); var model = new Array(use24HourFormat ? 24 : 12);
for(var i = 0; i < model.length; i++) for(var i = 0; i < model.length; i++)
model[i] = i.toString(); model[i] = i.toString();
if(!is24Hours) if(!use24HourFormat)
model[0] = 12; model[0] = 12;
return model; return model;
} }
currentIndex: is24Hours ? _forceTime.getHours() : (_forceTime.getHours() % 12) currentIndex: use24HourFormat ? _p.forceTime.getHours() : (_p.forceTime.getHours() % 12)
onCurrentIndexChanged: Qt.callLater(recalcTime) onCurrentIndexChanged: Qt.callLater(_p.recalcTime)
} }
Label { Label {
@ -82,8 +174,8 @@ RowLayout {
} }
return mod; return mod;
} }
currentIndex: _forceTime.getMinutes() currentIndex: _p.forceTime.getMinutes()
onCurrentIndexChanged: Qt.callLater(recalcTime) onCurrentIndexChanged: Qt.callLater(_p.recalcTime)
} }
Label { Label {
@ -103,19 +195,19 @@ RowLayout {
} }
return mod; return mod;
} }
currentIndex: _forceTime.getSeconds() currentIndex: _p.forceTime.getSeconds()
onCurrentIndexChanged: Qt.callLater(recalcTime) onCurrentIndexChanged: Qt.callLater(_p.recalcTime)
} }
TimeTumbler { TimeTumbler {
id: _amPmTumbler id: _amPmTumbler
visible: !is24Hours && showHours visible: !use24HourFormat && showHours
model: [ model: [
Qt.locale().amText, Qt.locale().amText,
Qt.locale().pmText, Qt.locale().pmText,
] ]
currentIndex: _forceTime.getHours() >= 12 ? 1 : 0 currentIndex: _p.forceTime.getHours() >= 12 ? 1 : 0
onCurrentIndexChanged: Qt.callLater(recalcTime) onCurrentIndexChanged: Qt.callLater(_p.recalcTime)
} }
Item { Item {

22
src/imports/mvvmquick/TintIcon.qml

@ -3,12 +3,30 @@ import QtQuick.Controls 2.3
import QtGraphicalEffects 1.0 import QtGraphicalEffects 1.0
import de.skycoder42.QtMvvm.Quick 1.1 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 { Item {
id: _tintIcon id: _tintIcon
/*! @brief type:Icon The icon itself
*
* @default{<i>empty icon</i>}
*
* @accessors{
* @memberAc{icon}
* @notifyAc{iconChanged()}
* }
*
* @sa @ref QtQuick.Controls.AbstractButton "AbstractButton.icon"
*/
property alias icon: _imgBtn.icon property alias icon: _imgBtn.icon
property alias source: _imgBtn.icon.source
property alias color: _imgBtn.icon.color
implicitWidth: _imgBtn.icon.width implicitWidth: _imgBtn.icon.width
implicitHeight: _imgBtn.icon.height implicitHeight: _imgBtn.icon.height

8
src/imports/mvvmquick/mvvmquick.pro

@ -26,14 +26,14 @@ SOURCES += \
QML_FILES += \ QML_FILES += \
QtMvvmApp.qml \ QtMvvmApp.qml \
QtMvvmApp11.qml \ QtMvvmApp10.qml \
PresentingStackView.qml \ PresentingStackView.qml \
PresentingStackView11.qml \ PresentingStackView10.qml \
PresenterProgress.qml \ PresenterProgress.qml \
PopupPresenter.qml \ PopupPresenter.qml \
PopupPresenter11.qml \ PopupPresenter10.qml \
DialogPresenter.qml \ DialogPresenter.qml \
DialogPresenter11.qml \ DialogPresenter10.qml \
TintIcon.qml \ TintIcon.qml \
AlertDialog.qml \ AlertDialog.qml \
ContrastToolBar.qml \ ContrastToolBar.qml \

1
src/imports/mvvmquick/plugins.qmltypes

@ -8,6 +8,7 @@ import QtQuick.tooling 1.2
Module { Module {
dependencies: [ dependencies: [
"Qt.labs.calendar 1.0",
"Qt.labs.platform 1.0", "Qt.labs.platform 1.0",
"QtGraphicalEffects 1.0", "QtGraphicalEffects 1.0",
"QtQml 2.2", "QtQml 2.2",

21
src/imports/mvvmquick/qmldir

@ -5,6 +5,7 @@ typeinfo plugins.qmltypes
depends QtQuick 2.10 depends QtQuick 2.10
depends QtGraphicalEffects 1.0 depends QtGraphicalEffects 1.0
depends Qt.labs.platform 1.0 depends Qt.labs.platform 1.0
depends Qt.labs.calendar 1.0
depends de.skycoder42.QtMvvm.Core 1.0 depends de.skycoder42.QtMvvm.Core 1.0
internal MsgBoxBase MsgBoxBase.qml internal MsgBoxBase MsgBoxBase.qml
@ -13,8 +14,8 @@ internal InputDialog InputDialog.qml
internal ProgressDialog ProgressDialog.qml internal ProgressDialog ProgressDialog.qml
internal ListSection ListSection.qml internal ListSection ListSection.qml
internal SectionListView SectionListView.qml
internal OverviewListView OverviewListView.qml internal OverviewListView OverviewListView.qml
internal SectionListView SectionListView.qml
internal TimeTumbler TimeTumbler.qml internal TimeTumbler TimeTumbler.qml
@ -26,8 +27,8 @@ ToolBarLabel 1.0 ToolBarLabel.qml
ActionButton 1.0 ActionButton.qml ActionButton 1.0 ActionButton.qml
RoundActionButton 1.0 RoundActionButton.qml RoundActionButton 1.0 RoundActionButton.qml
MenuButton 1.0 MenuButton.qml MenuButton 1.0 MenuButton.qml
TintIcon 1.1 TintIcon.qml
TintIcon 1.1 TintIcon.qml
SearchBar 1.1 SearchBar.qml SearchBar 1.1 SearchBar.qml
RoundMenuButton 1.1 RoundMenuButton.qml RoundMenuButton 1.1 RoundMenuButton.qml
DecorLabel 1.1 DecorLabel.qml DecorLabel 1.1 DecorLabel.qml
@ -37,15 +38,15 @@ DateEdit 1.1 DateEdit.qml
ColorEdit 1.1 ColorEdit.qml ColorEdit 1.1 ColorEdit.qml
PresenterProgress 1.0 PresenterProgress.qml PresenterProgress 1.0 PresenterProgress.qml
PresentingStackView 1.0 PresentingStackView.qml PresentingStackView 1.0 PresentingStackView10.qml
PresentingStackView 1.1 PresentingStackView11.qml PresentingStackView 1.1 PresentingStackView.qml
PopupPresenter 1.0 PopupPresenter.qml PopupPresenter 1.0 PopupPresenter10.qml
PopupPresenter 1.1 PopupPresenter11.qml PopupPresenter 1.1 PopupPresenter.qml
DialogPresenter 1.0 DialogPresenter.qml DialogPresenter 1.0 DialogPresenter10.qml
DialogPresenter 1.1 DialogPresenter11.qml DialogPresenter 1.1 DialogPresenter.qml
PresentingDrawer 1.0 PresentingDrawer.qml PresentingDrawer 1.0 PresentingDrawer.qml
SettingsView 1.0 SettingsView.qml SettingsView 1.0 SettingsView.qml
QtMvvmApp 1.0 QtMvvmApp.qml QtMvvmApp 1.0 QtMvvmApp10.qml
QtMvvmApp 1.1 QtMvvmApp11.qml QtMvvmApp 1.1 QtMvvmApp.qml

2
src/mvvmcore/mvvmcore.pro

@ -42,7 +42,7 @@ SOURCES += \
settingsconfigloader.cpp settingsconfigloader.cpp
android { android {
QT += androidextras #QT += androidextras
HEADERS += \ HEADERS += \
androidsettingsaccessor.h \ androidsettingsaccessor.h \

Loading…
Cancel
Save