Qt WebKit Plugin-related knowledge

Source: Internet
Author: User

1 , using WebKit browser core in Qtuse Qtwebkit to include in the project Document (*.pro):
1.   QT +=webkit
2.   QT + = Network
2 , Qtwebkit Flash supportQtwebkitto the fixed path (the installation path of the NPAPI plugin manufacturer) into the Flash control, if flash support is required, ensure that the file exists:
1.   C:\WINDOWS\system32\Macromed\Flash\NPSWF32.dll
Npswf32.dllis the Flash plug-in required by Qtwebkit, provided by the Micromedia official. 3 , using the QT pluginwhen distributing the program, you need to package the DLL files in the Qt\plugins\imageformats directory (they are the QT graphics plugin) in order to support JPG, PNG, GIF and other graphic image formats; preferably even plugins\codecs. DLL files in the directory are packaged together, they are used to support various language encodings (including Chinese support), and there are some other QT plugins. 4 , if you use the QT plugin, you need to set the QT plugin pathQTThe application needs to specify the directory in which the QT plugin is loaded in order to load DLL files in directories such as Plugins\imageformats, plugins\codecs, etc. mentioned above. The standard way is to set the path of the plug-in directory through the qt.conf file (which is placed in the same folder as the QT application). However, absolute paths must be used within the qt.conf, which is not easy to determine. You can specify the path to the QT plugin directly within the application, for example:
1.    qapplication Aapp (ARGC,ARGV); 
2.   qapplication::setlibrarypaths (Qstringlist (Qcoreapplication::applicationdirpath () + "/plugins/"));
before calling Qcoreapplication::applicationdirpath (), you must first create an Qapplication object 5 , Chinese support:
1.   Qtextcodec * codec = Qtextcodec  :: Codecforname ("GB2312"); 
2.    Qtextcodec::setcodecforlocale (codec); 
3.    qtextcodec::setcodecforcstrings (codec); 
4.   QTEXTCODEC::SETCODECFORTR (codec);
6 , using the Windows APIas long as #include <windows.h> can use the Windows API functions like MFC, as well as the data type of Windows, for example: LPCTSTR. to maintain cross-platform features, add macros to the Windows API functions and Windows data types:
1.   #ifdefined (Q_ws_win)
2.   ... ...  
3.   #endif
7 , let Qtwebkit use the cache
1.   Qnetworkdiskcache * DiskCache = Newqnetworkdiskcache  (this); 
2.   QString  Location = qdesktopservices  :: Storagelocation (Qdesktopservices::cachelocation); 
3.   diskcache- >  setcachedirectory (location); 
4.   this- > ui- > wndhtmlview- > page ()- > Networkaccessmanager ()- >  Setcache (DiskCache); 
5.   qdesktopservices::storagelocation (qdesktopservices::cachelocation);
returns the path to the system's cache directory 8 , debug cannot be started in Windows Eclipse, error:
1.   Gdb:unknown Target Exception 0xc0000135 at 0x7c984ed1
It may be that you cannot find the DLL for the QT library when you start your program with Gdb.exe, as long as the environment variable joins the Qt/bin path . 9 , UAC support in Windows7/vistaBuild a resource file resource.rc, content:
1.   1 "manifest.xml"
The resource type is 1, the resource content is in manifest.xml; the content of the manifest.xml is:
  1.                version    =    "1.0"      encoding    =        standalone    =       
2.    <Assembly  xmlns = "Urn:schemas-microsoft-com:asm.v1" manifestversion = "1.0" >    
3.    <assemblyidentity     
4.   version = "1.0.0.0"    
5.   processorarchitecture = "X86"    
6.   name = "Test.exe.manifest"    
7.   type = "Win32"    
8.   />    
9.    <TrustInfo  xmlns = "Urn:schemas-microsoft-com:asm.v3" >    
.    <security>     
One by one .    <requestedprivileges>     
.    <requestedExecutionLevel   Level = "Requireadministrator" uiAccess = "false" />    
.    </requestedprivileges>     
.    </security>     
A .    </trustinfo>     
.    </Assembly>    
in the project's. Pro (or. pri) file, add:
1.   Rc_file  =  Resource . RC
2.   ( Rc_file only in Windows available on the platform)
then clean project recompile Ten , EXE version information, add in the resource file:
1.   # if defined (UNDER_CE)
2.   # include  <winbase.h> 
3.   # Else
4.   # include  <winver.h> 
5.   # endif
6.  
7.   Vs_version_info versioninfo
8.   FileVersion 1,0,0,0
9.   productversion 1,0,0,0
.   Fileflagsmask 0X3FL
One by one .   #ifdef _DEBUG
.   fileflags Vs_ff_debug
.   #else
.   fileflags 0x0l
A .   #endif
.   Fileos vos__windows32
.   FILETYPE Vft_dll
.   Filesubtype 0x0l
.   BEGIN
.   BLOCK "Stringfileinfo"
.   BEGIN
.   BLOCK "040904b0"
.   BEGIN
A .   VALUE "CompanyName", " Company Name "
.   VALUE "FileDescription", " File Description "
.   VALUE "FileVersion", " file Version "
.   VALUE "ProductName", " Product Name "
.   VALUE " Product Version " ," 0.1.0\0 "
.   VALUE "Legalcopyright", " Copyright Information "
.   END
.   END
.   END
.   / * End of Version info * /

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.