Porting the Qt Bubble Level to Windows Phone 7 Silverlight
The Bubble Level Silverlight was ported from Qt Bubble Level made with QML. This page describes observations and issues faced during the port.
The features and UI of the application was tried to be made exactly the same in the Silverlight version as it was on the Qt version. This decision was made due to the custom nature of the application, no Metro UI elements were decided to be used.
Porting the UI
The defining of the UI with QML and XAML are somewhat similar process. They both use elements and properties to define the structure of the UI, the syntax is just a little different.
When implementing the Silverlight version I found myself using the XAML designer while coding directly on the XAML by hand. This speed up the implementation as the results of the code changes were seen at instant. I could have used the same procedure when implementing the Qt Bubble Level with the QML, but the Qt Quick Designer was not mature enough to be used in the implementation at that time.
The flipping of the Bubble Level sign was a lot harder to implement in the Silverlight version due to the lack of flippable control, which is available in the QML. The flipping effect had to be implemented manually by rotating the front side of the sign by it's x-axis of 90 degrees and then continue by rotating another UI control (which represents the back side of the sign). The result was as good as in Qt Quick version though, it was just harder to implement.
Another 'tough thing' for a novice WP7 developer was to change the look of the button when it was pressed. After some study I found out to use Microsoft Expression Blend 4 to define a new button style and attach this style to the corresponding button. A lot of code were automatically added to the XAML. This could have been really hard to code by hand - in the QML all the code is reasonable to edit without designer tools.
Reading of the accelerometer sensor
In the Qt Bubble Level, the reading of the accelerometer information was done in Qt code and transmitted to the UI via Signals and Slots mechanism. In the Silverlight version the accelerometer data was processed in the C#-code, so they share similarities here as well.
Both of the technologies had classes named Accelerometer (QAccelerometer in Qt) and they both needed to be started in order to begin the measuring of the values. Same low pass filtering code was used to filter the noise from the readings in the both of the applications.
Storing the calibration factor
The saving and restoring of the calibration value was done in quite same way in both technologies.
In Qt there is class called QSettings which knows how to store application parameters to the persistent storage. In the .Net framework there is consept called Isolated Storage to store and retrieve application data to the persistent storage. Class QSettings in Qt and class System.IO.IsolatedStorage.IsolatedStorageSettings in .Net both had similar way to save and restore key-value pairs to the application's persistent storage.
Screen orientation
One deviation between Symbian and the WP7 / Silverlight platforms is the orientations that the platforms supports. In Symbian and WP7, the orientation can be locked to the portrait, but the landscape orientation can be either 'landscape left' or 'landscape right' on the WP7. Orientation cannot be locked to just 'landscape left' or 'landscape right' in Silverlight (I have heard, that it is possible with XNA). In Symbian, there is no way to set the orientation to 'landscape right'.
This required code to the Silverlight version to invert the value of the accelerometer value (and the calibration factor) when the application was in the 'landscape right' orientation.

