|
| 1 | +/*! |
| 2 | +@class QtMvvm::InputViewFactory |
| 3 | + |
| 4 | +The factory is used by the QuickPresenter to create input views and delegates for various |
| 5 | +types. This is used to for example create the edits of input dialogs or for the list delegates |
| 6 | +of a SettingsView. |
| 7 | + |
| 8 | +@sa QuickPresenter, QuickPresenter::inputViewFactory, MessageConfig::TypeInputDialog, |
| 9 | +QtMvvm::getInput, SettingsViewModel |
| 10 | +*/ |
| 11 | + |
| 12 | +/*! |
| 13 | +@fn QtMvvm::InputViewFactory::getInputUrl |
| 14 | + |
| 15 | +@param type The input type to create a view for |
| 16 | +@param viewProperties A map with extra properties to be set on the edit |
| 17 | +@returns A url to a QML component suitable for editing input of the given type |
| 18 | + |
| 19 | +The factory first checks if the given type is registered as alias. If yes, it continues with |
| 20 | +the aliased type. Then it checks for a url registered as simple view exists for the given |
| 21 | +type and uses that one if present. If no simple view is set the default mapping for type to |
| 22 | +urls is used (See MessageConfig::TypeInputDialog for a full table of supported types). If no |
| 23 | +url can be found for a type, an invalid url is returned. |
| 24 | + |
| 25 | +The viewProperties are used to setup the created view by settings them as properties on the |
| 26 | +view. For every key-value-pair in the map, QObject::setProperty is called on the view to |
| 27 | +set the property. |
| 28 | + |
| 29 | +@sa MessageConfig::TypeInputDialog, InputViewFactory::addSimpleInput, |
| 30 | +InputViewFactory::addInputAlias, InputViewFactory::getDelegate |
| 31 | +*/ |
| 32 | + |
| 33 | +/*! |
| 34 | +@fn QtMvvm::InputViewFactory::getDelegate |
| 35 | + |
| 36 | +@param type The input type to create a delegate for |
| 37 | +@param viewProperties A map with extra properties to be set on the delegate |
| 38 | +@returns A url to a QML component suitable for editing input of the given type, as a delegate |
| 39 | + |
| 40 | +Delegates can be used to provide "editabel" list items for ListViews. (For example, the |
| 41 | +SettingsView makes use of them). Available roles are: |
| 42 | +- group |
| 43 | +- key |
| 44 | +- type |
| 45 | +- title |
| 46 | +- tooltip |
| 47 | +- delegateUrl |
| 48 | +- inputValue |
| 49 | +- properties |
| 50 | + |
| 51 | +The factory first checks if the given type is registered as alias. If yes, it continues with |
| 52 | +the aliased type. Then it checks for a url registered as simple delegate exists for the given |
| 53 | +type and uses that one if present. If no simple delegate is set the default mapping for type |
| 54 | +to urls is used (See MessageConfig::TypeInputDialog for a full table of supported types). If |
| 55 | +no url can be found for a type, the MsgDelegate is returned, which will simply show an input |
| 56 | +of the given type. Thus, for all not explicitly supported delegate types, the getInputUrl() is |
| 57 | +used to find an edit for the dialog. |
| 58 | + |
| 59 | +The viewProperties are used to setup the created delegate by settings them as properties on |
| 60 | +the delegate. For every key-value-pair in the map, QObject::setProperty is called on the |
| 61 | +delegate to set the property. |
| 62 | + |
| 63 | +@sa MessageConfig::TypeInputDialog, InputViewFactory::addSimpleDelegate, |
| 64 | +InputViewFactory::addDelegateAlias, InputViewFactory::getInputUrl |
| 65 | +*/ |
| 66 | + |
| 67 | +/*! |
| 68 | +@fn QtMvvm::InputViewFactory::addSimpleInput(const QUrl &) |
| 69 | + |
| 70 | +@tparam TType The type to add an input view for |
| 71 | +@param qmlFileUrl The URL of the QML file that contains the component |
| 72 | + |
| 73 | +The qmlFileUrl must be a valid URL to a QML file with a displayable quick item. The item must |
| 74 | +have a property named `inputValue` that is used to read and write the edit data. |
| 75 | + |
| 76 | +@sa InputViewFactory::getInputUrl, InputViewFactory::addInputAlias |
| 77 | +*/ |
| 78 | + |
| 79 | +/*! |
| 80 | +@fn QtMvvm::InputViewFactory::addSimpleInput(const QByteArray &, const QUrl &) |
| 81 | + |
| 82 | +@param type The type to add an input view for |
| 83 | +@param qmlFileUrl The URL of the QML file that contains the component |
| 84 | + |
| 85 | +The qmlFileUrl must be a valid URL to a QML file with a displayable quick item. The item must |
| 86 | +have a property named `inputValue` that is used to read and write the edit data. |
| 87 | + |
| 88 | +@sa InputViewFactory::getInputUrl, InputViewFactory::addInputAlias |
| 89 | +*/ |
| 90 | + |
| 91 | +/*! |
| 92 | +@fn QtMvvm::InputViewFactory::addSimpleDelegate(const QUrl &) |
| 93 | + |
| 94 | +@tparam TType The type to add a delegate view for |
| 95 | +@param qmlFileUrl The URL of the QML file that contains the component |
| 96 | + |
| 97 | +The qmlFileUrl must be a valid URL to a QML file with a displayable quick item that can be |
| 98 | +used as a delegate for a ListView. |
| 99 | + |
| 100 | +@sa InputViewFactory::getDelegate, InputViewFactory::addDelegateAlias |
| 101 | +*/ |
| 102 | + |
| 103 | +/*! |
| 104 | +@fn QtMvvm::InputViewFactory::addSimpleDelegate(const QByteArray &, const QUrl &) |
| 105 | + |
| 106 | +@param type The type to add a delegate view for |
| 107 | +@param qmlFileUrl The URL of the QML file that contains the component |
| 108 | + |
| 109 | +The qmlFileUrl must be a valid URL to a QML file with a displayable quick item that can be |
| 110 | +used as a delegate for a ListView. |
| 111 | + |
| 112 | +@sa InputViewFactory::getDelegate, InputViewFactory::addDelegateAlias |
| 113 | +*/ |
| 114 | + |
| 115 | +/*! |
| 116 | +@fn QtMvvm::InputViewFactory::addInputAlias() |
| 117 | + |
| 118 | +@tparam TAliasType The type to add as a new alias |
| 119 | +@tparam TTargetType The type the alias should be translated to |
| 120 | + |
| 121 | +If an input view for the alias type is requested, one of the target type is created instead. |
| 122 | + |
| 123 | +@sa InputViewFactory::getInputUrl, InputViewFactory::addSimpleInput |
| 124 | +*/ |
| 125 | + |
| 126 | +/*! |
| 127 | +@fn QtMvvm::InputViewFactory::addInputAlias(const QByteArray &, const QByteArray &) |
| 128 | + |
| 129 | +@param alias The type to add as a new alias |
| 130 | +@param targetType The type the alias should be translated to |
| 131 | + |
| 132 | +If an input view for the alias type is requested, one of the target type is created instead. |
| 133 | + |
| 134 | +@sa InputViewFactory::getInputUrl, InputViewFactory::addSimpleInput |
| 135 | +*/ |
| 136 | + |
| 137 | +/*! |
| 138 | +@fn QtMvvm::InputViewFactory::addDelegateAlias() |
| 139 | + |
| 140 | +@tparam TAliasType The type to add as a new alias |
| 141 | +@tparam TTargetType The type the alias should be translated to |
| 142 | + |
| 143 | +If an delegate view for the alias type is requested, one of the target type is created |
| 144 | +instead. |
| 145 | + |
| 146 | +@sa InputViewFactory::getDelegate, InputViewFactory::addSimpleDelegate |
| 147 | +*/ |
| 148 | + |
| 149 | +/*! |
| 150 | +@fn QtMvvm::InputViewFactory::addDelegateAlias(const QByteArray &, const QByteArray &) |
| 151 | + |
| 152 | +@param alias The type to add as a new alias |
| 153 | +@param targetType The type the alias should be translated to |
| 154 | + |
| 155 | +If an delegate view for the alias type is requested, one of the target type is created |
| 156 | +instead. |
| 157 | + |
| 158 | +@sa InputViewFactory::getDelegate, InputViewFactory::addSimpleDelegate |
| 159 | +*/ |
0 commit comments