using device targets in qml plasmoids
Sebastian Kügler
sebas at kde.org
Wed Oct 24 15:19:35 UTC 2012
On Wednesday, October 24, 2012 16:36:35 Aaron J. Seigo wrote:
> On Wednesday, October 24, 2012 16:09:23 Sebastian Kügler wrote:
> > By the way, something notmart and I discussed a few days ago ... it would
> > be handy if we had the input method ("touch", ...) accessible from the
> > QML
> another approach would be to put your touch specific bits into javascript
> files that are included from the QML to provide the missing functionality.
>
> so, for instance, for SLC it might have a contents/code/platform.js and a
> touch/code/platform.js file that looks like:
>
> function iconSpacing() { return /* some value */ }
>
> or it could even just declare some global variable(s):
>
> var iconSpacing = <some default>
> import platform.js
>
> and platform.js would do:
>
> iconSpacing = <some other value>
>
> (or some such thing .. haven't tested either of the above with actual code,
> but they ought to both work
>
> the nice thing about this approach is that we have just the one concept:
> target-based file loading.
>
> of course, this won't work well if the differences are large and not just
> simple changes to property values.
>
> it would be helpful to gather some real world use cases (like the SLC one)
> to see if this will actually cover our needs. seems you've run into some
> already?
Good idea. So one small js file with one var in plasmacomponents would already
suffice, indeed. (I think it should be something globally accessible, not "per
app" as this is especially useful for other components. I suppose we could
reduce the delta of the touch-specific components and the general ones quite a
bit.)
Other candidates for "global vars" which I often end up more or less
hardcoding:
- sensible iconsize
- margin (for example around text, one can always dynamically adjust it, but
having some globally adjustable knob would be nice)
- "standard" animation duration (though one can just load the .js file from
PlasmaExtras, like the animations in there do)
--
sebas
http://www.kde.org | http://vizZzion.org | GPG Key ID: 9119 0EF9
More information about the Plasma-devel
mailing list