The purpose is to install the RPM file generated by QT Creator on the tablet
1. The program uses images to display images normally.
2. If the program needs to use other files, you can copy the files to the specified folder on the tablet.
3. You can generate shortcuts on the desktop with icons
The above functions are implemented in sequence below
1. The program uses images to display images normally.
In QT, if the program uses images, right-click the project and select the Add file... option. The following window is displayed:
Select QT> QT resource file and click Select.
Enter the name and location. It is recommended that the path of the image be placed in your project, for example:/projectname/images/
Then, click Next.
Then add the prefix to the resource file.
The default prefix is/New/prefix1. For convenience, change :/.
Click Add> Add file to add the image you need.
I wrote an image.png image, which is in the images folder under your project directory.
When using image resources in the program, the image path is
":/Image.png" the colon indicates that you are using resources in the resource file, and it is irrelevant to the path on the hard disk.
In this way, the program will have images when running in meego.
2. If the program needs to use other files, you can copy the files to the specified folder on the tablet.
This is the most important aspect. The implementation method is to modify the. Pro file of the project. I have not studied how to compile this file, but I have a rough understanding of it.
As shown in the preceding hello. Pro file:
QT += core guiTARGET = HelloTEMPLATE = apptarget.path=/usr/local/binINSTALLS=targetSOURCES += main.cpp\ dialog.cppHEADERS += dialog.hFORMS += dialog.uiRESOURCES += \ Images/resouces.qrc
It is easy to understand. The last section is automatically added by Qt after the resource file is added.
It is important to use the installoptions.
Install= the target behind it represents the executable file of the program. Put it in the/usr/local/bin folder of the meego system. We can write the file in this way to copy the file into the meego system.
target.path=/usr/local/binname1.files=1234.txtname1.path=/usr/share/1234/INSTALLS=target name1
The ghost file is copied to the/usr/share/1234/folder of the meego system. If no 1234 folder exists, it is automatically created.
In this example, the generated rpmfile is carried with 1234.txt, And the 1234.txt file is installed in the/usr/share/1234/folder at the time of meegoinstallation.
3. You can generate shortcuts on the desktop with icons
With the foundation of Article 2, this function is well implemented.
First, find an icon in the project directory and copy it to a folder in meego. In this way, the icon enters the meego system.
Then write a shortcut and put it in the folder/usr/share/applications on the meego desktop. The desktop shortcut is solved.
It is best to use the PNG format for icons.
Then let's talk about writing the shortcut file:
Create a file in the desktop format, such as hello. desktop. Then write
[Desktop Entry]Name=HelloExec=/usr/local/bin/HelloIcon=/usr/share/icons/hello.pngType=ApplicationTerminal=falseStartupNotify=true
Name is the name displayed on the desktop.
Exec: Executable File Location
The icon is the position of the icon. You can write it wherever you copy it.
You do not need to change it later.
Modify the. Pro file:
config.files = 1234.txt config.path = /usr/share/hello/ icon.files = hello.png icon.path = /usr/share/icons/ desk.files = hello.desktop desk.path = /usr/share/applications/ INSTALLS += target config icon desk
Finally, the RPM file generated in.../Hello-Build-meego/rrpmbuild is the packaged program.
If you do not use QT creator to directly connect to the tablet for debugging, you can copy the RPM file to the tablet.
Then execute
rpm -ivh --force hello-0.0.1-1.i586.rpm
Now the program is successfully installed. Go to the desktop and check if your program is already there!