How can we create QWaylandSurface programatically? - surface

How can we create QWaylandSurface programatically?
The current QWindow compositor samples do not provide sufficient details.
Is it to be created using native wayland APIs directly or Qt provides a mechanism to wrap a window object as QWayland surface?

When a client connects and creates a surface, the signal QWaylandCompositor::surfaceRequested is emitted. You can attach a signal handler and instantiate a QWaylandSurface yourself there if you need to do something special.
If you don't create a QWaylandSurface or a derivative in that handler, then a QWaylandSurface is created automatically and will be provided in the QWaylandCompositor::surfaceCreated signal.

Related

How to add `c8y_Address` property to a device using API in cumulocity?

Here is the image of the asset information widget, which can add a property called c8y_Address
I would like my device to show their address information on the asset information widget, but I don't really know how to upload these properties to a device.
I am using MQTT. So I created a customised SMQRT Template, which is a POST inventory method 001,<region>,<street>,<territory>. And then I publish it using client.publish('s/uc/TemplateName',001,${region},${address},${territory});. But it doesn't work.
I'm just wondering how can we use API to add the address information as a property of a device?
Thank you.
POST would create a new object. I guess what you want to do is updating the device with this properties. So a PUT template would be the correct choice.
Note that the preview shown in the UI currently is incorrect for PUT templates.
It says:
999,<c8y_Address.region>,<c8y_Address.street>,<c8y_Address.territory>
but it actually needs to be (like described in the SmartREST 2.0 guide):
999,<externalId>,<c8y_Address.region>,<c8y_Address.street>,<c8y_Address.territory>
The externalId needs to be from the device you want to update (if you only have a single device without children it would be what you also use as MQTT clientId).

How to set my canvas drawings visible to anther user who opens same page where actions performed using paper.js script

I am working with paper.js in asp.net mvc4 application ,which helps in drawing on canvas region of HTML. I need your support for my requirement:
When I draw on my canvas I want to make visible these drawings on other canvas who opened same page over internet.
Paper.js provides a global variable called project.activeLayer to access items on view. I saved cavnas data in JSON format from active Layer , then I send this data through server communication. How can I rebuild the view in the canvas with same data. ?
(or)
Is there any way to do this without transmission of data.?
Thanks,
surbob.
This is not going to be simple. What you're talking about is basically the same as a chat room with caht cleints in the browser. You need to send the canvas data to the server, and then have the server update any other clients connected to it.
Probably the best place to start would be a chat-room sample and modify the code to handle the canvas data. The SignalR real-time communications library would probablyhelp to make tings a lot simpler, and it has good samples to get you going.

How to get/set interpretation window scale

3D/2D windows have a Z-scale property. Do intersection/interpretation windows have anything similar?
The simple answer is "no". In 3D window Z-scale is realized via SoScale node, Interpretation/Intersection windows use other engine.
Update: There is no access to viewport's Z-scale for Interpretation/Intersection window. You can simulate pseudo changes via IntersectionWindow.Bounds, but it doesn't affect viewport's Z-scale. You can submit an official enhancement request via www.ocean.slb.com (Developer's pages) if you wish.

Implementing State handling in windows 8 using MVVM Light

How i can implement state handling (running / resume / Terminate states ) using mvvm light. The major issue i a facing is with Navigation. I am totally uncontrolled with the navigation stack. How i can effectively manage this with MVVM Light.
Start a new project using either the GridView or SplitView templates and take a look at SuspensionManager.cs in the Common folder. It has a method called RegisterFrame which, when called, starts tracking all of the navigation events from the frame and attempts to save off and restore state when the application suspends and resumes.
The applications main frame is registered with the SuspensionManager in App.OnLaunched (App.xaml.cs) and Saving is done in App.OnSuspending.
Finally, take a look at LayoutAwarePage.cs, also in the Common folder. You can inherit from LayoutAwarePage to get Portrait and Snapped design time support. It also attempts to handle navigation state caching by leveraging the SuspensionManager. So, no matter whether your page is navigated to from another page or as part of a resume, the virtual method LoadState is called with the correct data.
Obviously this pattern is managing navigation state directly in the page itself, but you could tweak this pattern to create a sort of "SuspensionService" that your ViewModels could leverage in the same way.
You might be interested in the open source Okra App Framework that is freely available on CodePlex and NuGet (disclaimer: I am the lead developer on this project). This has been designed from the ground up for Windows 8 applications, in particular those that use the MVVM pattern (and you can still use the MVVM Light base classes to define your view-models).
Of particular interest it includes,
A navigation manager that understands the Windows 8 navigation model
A navigation stack that can automatically persist its state upon application termination
A mechanism for view-models to persist their own state (via a simple interface)
Automatic view and view-model construction and wiring up (by default using MEF attributes)

state handling in windows 8 using mvvmlight

Implementation of state handling in windows 8 using mvvmlight
Is there any method avilable in mvvmligt to manage states in WinRT? How I can duplicate the functionality of default Suspensionmanager by using WinRT? And the second one is about managing navigation cycle ie if I navigated from page A - > B. and the go for suspend and shutdown state. When I re start the application in need to open page B. and while presses back key I need to load A. How I can effectively implement this using MVVM light in my WinRT application?
These aren't really MVVM Light functionality. You'll need to do these yourself.
One option would be to create your own navigation service (see example here). The navigation service could use the suspension manager to build/manage a breadcrumb trail for the application. If you added an additional method:
public void GoToMostRecentPage()
{//blah}
You'd be able to call this method in the app start-up and take the user to the appropriate page.
I'd stick with the SuspensionManager. If you want to make it more MVVM friendly you can wrap it in a service that is injected into your viewmodels as required.
You might be interested in the open-source Okra App Framework that you can get from NuGet or the CodePlex site I linked to above. It is designed from the ground up to work great with Windows 8 and the MVVM pattern (and you can still use your MVVM Light base classes).
It has a navigation manager that automatically handles everything you mentioned above - managing the application's navigation stack, persistence of the stack on application suspension/termination and even allows view models to persist their own state via a simple interface (like how the SuspensionManager works for pages).
(disclaimer: I am the lead developer on this project)
I wrote this originally for WP7 and have been updating for Win8 RT. It allows you to attach attributes to properties you want to keep in your view models, then the PersistenceManager dehydrates them (serialized to file) when the app is suspended and rehydrates when it resumes.
There are examples for WP7 and Win8, basic MVVM pattern and MVVM Light
Obelisk