Qt4 some issues with upgrading to QT5

Source: Internet
Author: User

Since the QT version of the recent project has been upgraded from qt4.8 to qt5.5, although the change from 4 to 5 is small, there are a number of questions that need to be recorded to help more people.

1. Because QT5 has moved most of the desktop components to the QT widgets module, it is necessary to include the Qtwidgets module where the Qtgui is protected

2, garbled problem.

For VS, because of window history, the std::string (standard string) is garbled when using UTF8 encoding on VS, so GBK encoding is temporarily used on vs. QT5 removes the qtextcodec::setcodecforcstrings () function, so when it comes to writing Chinese constants directly in CPP, use macros qstringliteral parcels directly, such as qstringliteral ("I am a kanji"); If the kanji are stored in a variable, the fromlocal8bit static method is used.

For Linux, using GBK encoding directly, QString has a member method tostdstring, which converts the string of the QString type to std::string,qstring: Fromstdstring method to convert standard string to qstring type

3. Add JSON module

Are the standard jion strings described in the form of key-value pairs?, the key is a string, the value can be a JSON object, a JSON array, or a JSON value

The value of the Qjsonvalue:json string

Qjsonobject:json Object

Qjsonarray:json array?

4, the use of Qwebview and other WebKit related visual parts, Qt5 alone into the Qtwebkitwidgets module, so add header file # # #

5, join multiple Connect overloaded method, when the new Connect link, will use type detection, if the compiler does not match will error?

6, Qtmutimedia replaced the phonon?

C + + interface changes

porting C + + applying QT 5

by the way: Qt can use Qaxwidget or Qwebview to embed the Web page, but Qt UI refreshes in the main thread, so when the web window refreshes, the entire app will feign animation, it is recommended to use CEF to embed the browser, powerful , but the dynamic library is large

Qt4 some issues with upgrading to QT5

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.