在真实的 MeeGo 设备上进行开发
如果你有一个安装了 MeeGo 系统的设备,你同样可以使用 Qt Creator 来创建和调试程序。
准备设备使用 Qt Creator 为 MeeGo 设备进行开发前,你需要在设备上安装一些额外的软件包,并进行一些设置。你可以按照以下步骤,在终端下进行设置:
在 MeeGo 设备上部署 Qt Creator 开发环境,需要使用 SSH 。所以,先安装 OpenSSH server : sudo zypper install openssh-server然后执行下面命令(在安装完毕后执行, 否则需要等到重启设备后,才可以使用 ssh ):
sudo /etc/init.d/sshd start将这个增加到自启动中,这样在设备启动时,就可以自动启动 sshd 了:
sudo chkconfig --add sshd 如果你需要远程调试程序, 那你还需要安装 gdbserver : sudo zypper install gdb-gdbserver Run the application on the deviceIn Qt Creator (still running from the chroot):
With a project selected, click on the Projects icon to show the project configuration tabs. Select the Run Settings tab. Click on the Add drop-down and select testapp on MeeGo device (testapp will be set to the name you gave your project). Click on the Manage device configurations link to display the MeeGo Device Configurations dialog. Click on the Add button (top-right) and complete the fields so they resemble the screenshot below:You'll need to set Host Name to the IP address or domain name of the netbook, and enter the User Name and Password you used when you set up the netbook. The other options can be left at their defaults. Click on the Test button to check the connection. If it's configured correctly, you should see a message like the one in the screenshot above ("Device configuration successful"). Click on OK to save your changes. This returns you to the Run Settings tab. Select the new MeeGo netbook option from the Device Configuration drop-down.
Once you've completed this, you should be able to deploy and run the application on the netbook:
At the bottom-left of the Qt Creator window is a panel for selecting the build and run environments:Click on the computer monitor icon, then use the arrows to select testapp on MeeGo device from the Run drop-down. The Build drop-down can be left at Debug. Click on the green arrow (the normal run arrow) to deploy the application and run it. This copies the application binary to the home folder of the user you specified in the SSH settings and runs it.
If you can't see the application, it may be because it hasn't been given focus. You can use the zones icon in the toolbar to show the running application and select it.
Here's an example of what the application looks like running on a netbook:
Debug the application on the deviceThis works almost the same on a remote device as it does inside the Simulator.
Configure the remote device as explained above. In Qt Creator, click on the Target settings (bottom left with a monitor icon). Ensure you have Build set to Debug and Run set to testapp on MeeGo device (the remote device). Click on the green arrow overlaid with a bug to start the application remotely in debug mode.If you used the same code as above, try clicking on the Click me button in the application (running on the netbook). The application should pause at the breakpoint; and in Qt Creator, the message variable should then be visible in the Locals and Watchers tab, set to "I have been well and truly clicked". (No screenshot this time, as Qt Creator looks the same as it does for local debugging.)