(Strings)
m
Line 15: Line 15:
 
This means the macros Qt without the Q_ 'namespace' will not work.
 
This means the macros Qt without the Q_ 'namespace' will not work.
  
This includes "foreach" "emit", "signals", and "slots". They should be replaced by Q_FOREACH, Q_EMIT, Q_SIGNALS and Q_SLOTS repsectively.
+
This includes "foreach" "emit", "signals", and "slots". They should be replaced by Q_FOREACH, Q_EMIT, Q_SIGNALS and Q_SLOTS respectively.
  
 
====Strings====
 
====Strings====
  
In Frameworks 5 any string on its own such as "foo" will not be automatically converted to a QString.  
+
In Frameworks 5 any string on its own such as "foo" will not be automatically converted to a QString. Instead, you should use one of:
 
 
Instead you should use one of:
 
 
* QLatin1String() for string comparisons i.e (if myString == QLatin1String("SomeText))
 
* QLatin1String() for string comparisons i.e (if myString == QLatin1String("SomeText))
 
* QLiteralString for string creation i.e QIcon::fromTheme(QLiteralString("document-new"));
 
* QLiteralString for string creation i.e QIcon::fromTheme(QLiteralString("document-new"));
 
* tr() for translatable strings in frameworks that cannot use i18n
 
* tr() for translatable strings in frameworks that cannot use i18n
 
* i18n for translatable strings in frameworks that can use i18n
 
* i18n for translatable strings in frameworks that can use i18n

Revision as of 11:57, 7 June 2013

Getting Started

Useful Reading

Information about the changes between Qt4 and Qt5 can be found in the dist/changes-5.x of each submodule

Changes regarding changes to kdelibs can be found at kdelibs/KDE5PORTING.html

Other Changes

Qt Keywords

KDE Frameworks now enforces -DQT_NO_KEYWORDS

This means the macros Qt without the Q_ 'namespace' will not work.

This includes "foreach" "emit", "signals", and "slots". They should be replaced by Q_FOREACH, Q_EMIT, Q_SIGNALS and Q_SLOTS respectively.

Strings

In Frameworks 5 any string on its own such as "foo" will not be automatically converted to a QString. Instead, you should use one of:

  • QLatin1String() for string comparisons i.e (if myString == QLatin1String("SomeText))
  • QLiteralString for string creation i.e QIcon::fromTheme(QLiteralString("document-new"));
  • tr() for translatable strings in frameworks that cannot use i18n
  • i18n for translatable strings in frameworks that can use i18n

Content is available under Creative Commons License SA 4.0 unless otherwise noted.