Adding New Device Models in Qt Simulator

From Qt Wiki
Jump to navigation Jump to search

Template:ArticleMetaData


Overview[edit | edit source]

Template:Abstract

That is, the size of the area on which Qt Simulator draws the application.

You can also add an image of the device in PNG format. In the configuration file, specify the position of the screen within the image.

How to[edit | edit source]

The graphics and settings for the device models are stored in the models/ folder next to your Qt Simulator executable. The Full path is NokiaQtSDKInstallationDirectory/Simulator/Application/models.

To add a new device, create a subfolder and put a <your device name>.config file into it. It is easiest to copy and modify one of the existing files.

Sample Model created with name ‘NokiaN8’ by adding below files and .config file to NokiaN8 Folder.


File:ModelFiles.jpg

File:QtSimulatorCD.jpg

Configuration File[edit | edit source]

Device configuration files have a key:value syntax, with the following valid keys. Sample code for created NokiaN8 model for Symbian device is as below. For Maemo Model last 4 keys are not required.

name:NokiaN8 resolutionWidth:360 resolutionHeight:640 diagonalInInch:3.5 mockup:N8.png offsetX:66 offsetY:153 defaultFontSize:7 style:s60,nseriesblack nativeOrientation:portrait menuPortrait:N8_portrait.png availableGeometryPortrait:0,92,360,487 menuLandscape:N8_landscape.png availableGeometryLandscape:0,45,640,270 symbianSoftKeyButtonPortrait:0,0,580,180,60 symbianSoftKeyButtonPortrait:1,180,580,180,60 symbianSoftKeyButtonLandscape:0,0,316,212,44 symbianSoftKeyButtonLandscape:1,427,316,212,44

 


Descirption of Keys[edit | edit source]

• name:<string> - required. Name to show in the device selection drop down menu.

• resolutionWidth:<integer> - required. Width of the device screen.

• resolutionHeight:<integer> - required. Height of the device screen.

• diagonalInInch:<float> - required. Length of the screen diagonal in inches.

• mockup:<path> - required. Path to the image for the device. Relative to the .config file.

• offsetX:<integer> - required. Offset of the screen top left corner from the top left corner of the mockup image.

• offsetY:<integer> - required. Offset of the screen top left corner from the top left corner of the mockup image.

• defaultFontSize:<integer> - optional (default: 12). Font size the device uses if it is not set explicitly.

• forceDpi:<integer> - optional. Renders the screen by using this DPI value instead of the physical DPI computed from thediagonalInInch value.

• style:<string>,<string> - optional. The first string names the Qt style to be used for applications running in Qt Simulator. The second string is optional, only used for the s60 style and denotes the theme to be used. The only valid name is "nseriesblack"

• button:<key name>,<key text>,<x>,<y>,<width>,<height> - optional, may be used more than once. When the user clicks inside the rectangle defined by x,y,width,height send the key specified by key name and key text to the application. key name must be the name of a value in the Qt::Keys enum. key text is the value the text() member of the generated QKeyEvent returns. In order to make the comma key work the text has to be escaped. Just use "\," (without quotaion marks) here.

• menuPortrait/-Landscape:<string> - optional. Images to use as menu mockups for portrait or landscape orientation. The images may contain transparent areas to be aligned horizontally or vertically. The images are always positioned in the top left corner of the display. To make the menu appear to the right of the screen, add a transparent area on the left sidee of the image.

• availableGeometryPortrait/-Landscape:<x>,<y>,<width>,<height> - optional. Screen area which is available for an application when menus are shown. If no menus are specified or the window is shown in full screen mode, the whole display is used.




File:Nokian8Model.jpg



In addition, it is possible to run a script whenever your device is chosen in the device selection. Therefore just add a file named <name of your device (given in the .config file)>.qs to scripts/devices.