Commit Graph

1499 Commits

Author SHA1 Message Date
Anton Kudryavtsev
8b07d2c5a5 QTextHtmlParser: adapt parseEntity() to make good use of QStringRef
Avoid unnecessary allocations.

Change-Id: I00923266307b0c73e3f4521c1653f1ebbd594714
Reviewed-by: Edward Welbourne <edward.welbourne@qt.io>
2016-10-13 17:41:38 +00:00
Liang Qi
dfc177e3a9 Merge remote-tracking branch 'origin/5.8' into dev
Conflicts:
	qmake/library/qmakeevaluator.cpp
	(cherry picked from commit 1af6dc2c8fb4d91400fddc5050166f972ae57c9a in qttools)
	src/corelib/kernel/qcore_mac_objc.mm
	src/gui/painting/qcolor.h
	src/plugins/platforms/cocoa/qcocoawindow.mm

Change-Id: I5b3ec468a5a9a73911b528d3d24ff8e19f339f31
2016-10-13 09:49:38 +02:00
John Preston
46804956cb Fix possible crash in calculateRightBearingForPreviousGlyph().
LineBreakHelper saves previousGlyph for calculating right bearing of
this glyph when it is needed. But between the saving of this glyph and
the calculation the fontEngine can change (if we move to the different
item). So we need to save the fontEngine together with the glyph and
use this saved fontEngine for the saved glyph, while still using the
current fontEngine for calculating right bearing of the current glyph.

[ChangeLog][QtGui][QTextLine] Fixed a possible UB in the calculation
of glyph right bearing when a QTextLine layout is performed.

Change-Id: I14c729a1f761a45eaba85754c0b15a27faff7458
Reviewed-by: Eskil Abrahamsen Blomfeldt <eskil.abrahamsen-blomfeldt@qt.io>
2016-10-10 23:03:49 +00:00
Liang Qi
ef25620ac1 Merge remote-tracking branch 'origin/5.7' into 5.8
Conflicts:
	mkspecs/features/mac/default_pre.prf
	mkspecs/features/qpa/genericunixfontdatabase.prf
	mkspecs/features/uikit/default_post.prf
	mkspecs/features/uikit/resolve_config.prf
	mkspecs/macx-ios-clang/features/default_post.prf
	mkspecs/macx-ios-clang/features/resolve_config.prf
	src/corelib/io/qiodevice.cpp

Change-Id: I6f210f71f177a3c3278a4f380542195e14e4b491
2016-10-06 20:12:27 +02:00
Eskil Abrahamsen Blomfeldt
4d552815cf Fix plain text QStaticText with line breaks
The layout isn't actually created until endLayout() or setLineWidth() is
called. So in the case where this was not done, the height of the line
would be 0, thus multiple lines would be placed on top of each other, at
y == 0.

[ChangeLog][QtGui][Text] Fixed QStaticText when manually breaking lines
and no text width was set.

Task-number: QTBUG-56346
Change-Id: I7f6ed6260545882f05fe39b21134315eca7401b9
Reviewed-by: Konstantin Ritt <ritt.ks@gmail.com>
2016-10-04 14:30:13 +00:00
Liang Qi
3e949b75fd Merge remote-tracking branch 'origin/5.6' into 5.7
Conflicts:
	mkspecs/features/mac/default_pre.prf
	mkspecs/macx-ios-clang/features/resolve_config.prf
	qtbase.pro

Change-Id: I65b5ebca4942a4f295bdd4ac1568e5c347333aea
2016-10-01 22:15:55 +02:00
Eskil Abrahamsen Blomfeldt
22bf1f28f9 Freetype: Fix wrong line spacing for Courier New
The regular variant of Monotype's "Courier New" font, the one
which is included by default on Windows, has an EBLC table, which
overrides the ascent and descent for certain sizes. The Freetype
engine doesn't automatically respect this, so there is a hack
in place to fetch the correct values for us.

But there were two issues with that code, which lead to us getting
the wrong line spacing for that particular font: The first was that
we did not update the height metric for the font. This is used,
together with the ascent and descent, to calculate the leading of
the font. So when we set the height of text lines in a layout, we
would get a leading based on the height for the scalable font
and the ascent/descent from the EBLC table, and this would not match
up.

Also, as reported elsewhere on the Internet, the descent value in
the EBLC table for Courier New is set to a positive value instead
of a negative one. This must be a bug in the font, so we special
case it and fix the value to avoid bogus line spacing later.

[ChangeLog][Qt Gui][Text] Fixed line spacing with some scalable fonts
containing bitmaps with the Freetype font engine.

Task-number: QTBUG-50090
Change-Id: I95165dde7b8ffac6d7f9ac43baadb3eb75d28abe
Reviewed-by: Lars Knoll <lars.knoll@qt.io>
2016-09-30 10:32:55 +00:00
Eskil Abrahamsen Blomfeldt
462f6029ed Fix crash when doing many text layouts with superscript/subscript
After e109b8a0f3, it is possible
that the cache will be flushed as a result of inserting a new
font rather than just when the timer event triggers. When doing
superscript and subscript text layouts, we would first get
a regular font engine, then a scaled one, and then reference
the regular font engine *after* getting the scaled one. If the
regular font engine was deleted as a result of inserting the scaled
one, we would get a dangling pointer and crash.

The situation was improved by 49926bb9ef.
You would now to switch between 256 different fonts in the layout
in order to trigger it. The test in the commit will trigger the
crash even with this change.

[ChangeLog][Qt Gui][Text] Fixed a crash that could happen if you
were doing many different text layouts with different fonts
and superscript or subscript alignment.

Task-number: QTBUG-53911
Change-Id: Ia33108252e030eff25924ef1b7c10b9d59b5bc8c
Reviewed-by: Lars Knoll <lars.knoll@qt.io>
2016-09-29 12:43:19 +00:00
Liang Qi
cdb56c42fc Merge remote-tracking branch 'origin/5.7' into 5.8
Conflicts:
	mkspecs/features/uikit/xcodebuild.mk
	tests/auto/other/lancelot/tst_lancelot.cpp
	tests/auto/widgets/widgets/qmdisubwindow/tst_qmdisubwindow.cpp
	tests/auto/widgets/widgets/qmenubar/tst_qmenubar.cpp

Change-Id: Ia0ae2de86094120281abd445138877c2cc3e882c
2016-09-29 00:38:01 +02:00
Liang Qi
680dd3313c Merge remote-tracking branch 'origin/5.6' into 5.7
Conflicts:
	src/corelib/global/qlogging.cpp

Change-Id: I9cc8f25ad897efab6a42cb5c5161b1c9402952f0
2016-09-23 22:28:33 +02:00
Liang Qi
53bd8140bb Merge remote-tracking branch 'origin/5.6.2' into 5.6
Change-Id: I570fa9b06e181d02a4bee83500730733b31d4758
2016-09-23 09:36:23 +02:00
Eskil Abrahamsen Blomfeldt
27d2593e6d Return color bitmap from QRawFont for color fonts
When the font in question is a color font, we should call
the appropriate function bitmapForGlyph() and return the
color bitmap from the font, rather than the alpha map in
QRawFont::alphaMapForGlyph().

Change-Id: I2c3cd66db5a93ddf0cc463f4d136dd6771b9734c
Reviewed-by: Tor Arne Vestbø <tor.arne.vestbo@theqtcompany.com>
Reviewed-by: Konstantin Ritt <ritt.ks@gmail.com>
2016-09-22 10:29:37 +00:00
Konstantin Tokarev
f050f2180f Describe meaning of typographic units in QRawFont documentation
Text is copied from corresponding QFontMetrics methods.

Change-Id: Ife79e0d1b06ca3f691f2fd8bd796b41aeaa76954
Reviewed-by: Eskil Abrahamsen Blomfeldt <eskil.abrahamsen-blomfeldt@qt.io>
2016-09-22 06:06:37 +00:00
Liang Qi
7555a92581 Merge remote-tracking branch 'origin/5.7' into 5.8
5971b88e is not needed in new configure.

This merge also reverts "fix QMAKE_DEFAULT_*DIRS resolution with
apple SDK", 2c9d15d7, because it breaks iOS build with new
configure system.

Conflicts:
	mkspecs/features/default_pre.prf
	mkspecs/features/mac/toolchain.prf
	mkspecs/features/toolchain.prf
	src/dbus/qdbusconnection.cpp
	src/plugins/sqldrivers/mysql/qsql_mysql.cpp
	src/sql/drivers/mysql/qsql_mysql.cpp
	src/widgets/widgets/qmenubar.cpp
	src/widgets/widgets/qmenubar_p.h
	tools/configure/configureapp.cpp
	tools/configure/environment.cpp
	tools/configure/environment.h

Change-Id: I995533dd334211ebd25912db05b639d6f908aaec
2016-09-21 11:57:52 +02:00
Liang Qi
d148019f16 Merge remote-tracking branch 'origin/5.6' into 5.7
Conflicts:
	src/plugins/platforms/qnx/qqnxscreeneventhandler.cpp

Change-Id: I0af32ee55936d523cbd259b6fe82eb9c409f9074
2016-09-16 23:16:25 +02:00
Anton Kudryavtsev
6aa935cd92 Use QString::fromLatin1() less to avoid string allocations
QString::fromLatin1 always allocates memory, but there are
cases where we can avoid/reduce allocations or/and reduce
text size, e.g.:

QStringBuilder expressions
Fix: replace QString::fromLatin1 with QL1S

QString::fromLatin1().arg(String) pattern
Fix: replace with QStringBuilder

Overloaded functions with QL1S arg
Fix: replace QString::fromLatin1 with QL1S

In rare cases if there is no overloaded function
with QL1S and we have deal with string literal,
replace QString::fromLatin1 with QStringLiteral.

Change-Id: Iabe1a3cc0830f40ef78a0548afa4368583c31def
Reviewed-by: Edward Welbourne <edward.welbourne@qt.io>
2016-09-15 15:55:57 +00:00
Anton Kudryavtsev
6b2071c697 Use QStringBuilder more to optimize memory allocations
Change-Id: I2939ffa10496fdc59e0402a9cb54458565ccd657
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
2016-09-15 09:08:45 +00:00
Liang Qi
d892e6f721 Merge remote-tracking branch 'origin/5.7' into 5.8
Conflicts:
	mkspecs/features/qt_common.prf
	src/plugins/platforms/windows/qwindowsdialoghelpers.cpp

Change-Id: I03b92b6b89ecc5a8db7c95f04ebb92ed198098a8
2016-09-05 18:47:27 +02:00
David Schulz
a0d3455ee3 Taking trailing whitespace into account when shaping lines
The calculated end position of script lines, consisting of nothing but
trailing spaces, is lower than the start position. This results in not
shaping those script lines.

Task-number: QTBUG-55255
Change-Id: Ib70c1a800d2f70b7f61e3d05c10618e275f45f12
Reviewed-by: Konstantin Ritt <ritt.ks@gmail.com>
Reviewed-by: Eskil Abrahamsen Blomfeldt <eskil.abrahamsen-blomfeldt@qt.io>
2016-09-05 12:49:16 +00:00
Liang Qi
657c2bfbec Merge remote-tracking branch 'origin/5.6' into 5.7
Conflicts:
	tests/auto/testlib/selftests/generate_expected_output.py

Change-Id: If856162abf9a24ae2c9946d336a7d1da03520fa7
2016-09-05 13:57:12 +02:00
Anton Kudryavtsev
6dbb16a856 Replace QLatin1Literal with QLatin1String
QLatin1Literal is just alias of QLatin1String
for Qt4 compatibility.
So it's style cleanup patch.

Change-Id: Ia3b3e5dc3169f13a1ef819d69be576b8a8bfb258
Reviewed-by: Marc Mutz <marc.mutz@kdab.com>
Reviewed-by: Edward Welbourne <edward.welbourne@qt.io>
2016-09-03 18:55:56 +00:00
Allan Sandfeld Jensen
c8cb188dd4 Ensure the fontdatabase is initialized when requesting fallbacks
Otherwise we will return an empty list of fallbacks if no QFontDatabase
has been created yet.

Task-number: QTBUG-55222
Change-Id: I50508162fad3206e0acf3cc6eb39aefac5c3e197
Reviewed-by: Peter Varga <pvarga@inf.u-szeged.hu>
Reviewed-by: Eskil Abrahamsen Blomfeldt <eskil.abrahamsen-blomfeldt@qt.io>
2016-09-03 08:25:10 +00:00
Liang Qi
1cc571593a Merge remote-tracking branch 'origin/5.7' into 5.8
cf53aa21bf and 3aaa5d6b32
were reverted because of reconstruction in 5.7.

defineTest(qtConfTest_checkCompiler) in configure.pri is smart
enough to cover the case in a9474d1260.

DirectWrite: Fix advances being scaled to 0

Since 131eee5cd, the stretch of a font can be 0, meaning
"whatever the font provides". In combination with ec7fee96,
this would cause advances in the DirectWrite engine to be scaled to
0, causing the QRawFont test to fail.

Conflicts:
	configure
	mkspecs/features/uikit/device_destinations.sh
	mkspecs/features/uikit/xcodebuild.mk
	src/corelib/global/qglobal.cpp
	src/corelib/global/qnamespace.qdoc
	src/plugins/platforms/cocoa/qcocoamenuitem.h
	src/plugins/platforms/windows/qwindowsservices.cpp
	src/plugins/platformthemes/gtk3/qgtk3dialoghelpers.cpp
	src/plugins/platforms/windows/qwindowsfontenginedirectwrite.cpp
	src/widgets/kernel/qapplication.cpp
	tests/auto/widgets/dialogs/qfiledialog/tst_qfiledialog.cpp
	tests/auto/widgets/dialogs/qfiledialog2/tst_qfiledialog2.cpp

Change-Id: I4656d8133da7ee9fcc84ad3f1c7950f924432d1e
2016-08-29 15:30:17 +02:00
Liang Qi
cc74452d6d Merge remote-tracking branch 'origin/5.6' into 5.7
Conflicts:
	configure
	src/plugins/platforms/winrt/qwinrtclipboard.cpp

Change-Id: Ic6d58be3d1ed2bb507f2ba06c82361afd9f9ddb9
2016-08-29 08:13:40 +02:00
Samuel Gaist
e52fcb7dc7 QTextDocument: fix string backward search
[ChangeLog][QtGui][QTextDocument] Fixed a bug that would return a wrong
position when searching backward from the end of the document.

Task-number: QTBUG-48182
Change-Id: I6e88f808a50cb840f61e7bc579e2a28c5300089d
Reviewed-by: Simon Hausmann <simon.hausmann@qt.io>
2016-08-28 15:18:55 +00:00
Liang Qi
c7cdf3aac7 Merge remote-tracking branch 'origin/5.6' into 5.7
Conflicts:
	src/corelib/mimetypes/qmimeprovider.cpp
	src/corelib/mimetypes/qmimetype.cpp

Change-Id: Ib483ddb6bfc380e7c8f195feca535703814c3872
2016-08-25 16:12:11 +02:00
Tor Arne Vestbø
d856d0e146 Limit glyph caches per QFontEngine to four per context, not four in total
The limitation of four glyph caches per font engine was to prevent memory
spikes during rotation of text. But in an application with multiple top
level OpenGL windows, each with their own context, we'd end up trashing
the list of glyph caches during rendering, even if each window just drew
the same static text.

Having a shared context between the windows helped a bit, but had other
performance issues due to the globally shared state, so the better approach
is to limit the caches to four per context.

This brings the multiwindow manual test from a grinding 4fps on macOS
to a smooth 60fps for 20 concurrent windows.

Task-number: QTBUG-52372
Change-Id: I26edd5f6edb5c7818e14b2203af062df19ae7127
Reviewed-by: Simon Hausmann <simon.hausmann@qt.io>
2016-08-24 20:56:14 +00:00
Eskil Abrahamsen Blomfeldt
660c34077e DirectWrite: Fix crash when embedding empty glyphs in PDF
Empty QPainterPaths can have one move-to element, so the test
to detect this case was incomplete. For empty glyphs returned
from DirectWrite this would trigger a crash. This is only
reproducible after also enabling embedding of fonts with the
DirectWrite engine.

Task-number: QTBUG-54740
Change-Id: I3fbbfb8d958818550d5ab5234242d39688b84811
Reviewed-by: Lars Knoll <lars.knoll@qt.io>
2016-08-24 06:11:07 +00:00
Liang Qi
2111bf00fe Merge remote-tracking branch 'origin/5.6' into 5.7
Change-Id: I4f4ab05b2de67cd4b1d29b294b96a8c9ffb964b2
2016-08-22 21:58:45 +02:00
Oswald Buddenhagen
d314819fc0 Merge dev into 5.8
Change-Id: I41ee7b50534b01cf042bed8bb8824ba2e5026a29
2016-08-22 11:30:01 +02:00
Marc Mutz
881bda9e6e QTextHtmlParser: remove 317 unneeded relocations
Same change as in QColor (d38f86e50b).

  relocs: -317
  text:  -6480B
  data:  -5088B

(optimized GCC 6.1 Linux AMD64 build)

Change-Id: I647cd327b421caad45a19a14955de9e3aefaefab
Reviewed-by: Olivier Goffart (Woboq GmbH) <ogoffart@woboq.com>
2016-08-22 06:33:14 +00:00
Marc Mutz
477aab08d3 QCssParser: remove 239 unneeded relocations
Same change as in QColor (d38f86e50b).

  relocs: -239
  text:  +2248B
  data:  -3872B

(optimized GCC 6.1 Linux AMD64 build). The text size increase means
we pushed the data into an immutable section.

Change-Id: Iad10c877d4a4877878dded56a7ef1e14ff92c996
Reviewed-by: Olivier Goffart (Woboq GmbH) <ogoffart@woboq.com>
2016-08-22 06:33:05 +00:00
Allan Sandfeld Jensen
9f888d2fde Support C++17 fallthrough attribute
Replaces our mix of comments for annotating intended absence of break
in switches with the C++17 attribute [[fallthrough]], or its earlier
a clang extension counterpart.

Change-Id: I4b2d0b9b5e4425819c7f1bf01608093c536b6d14
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
2016-08-19 18:38:53 +00:00
Lars Knoll
60985aa42b Use qtConfig throughout in qtbase
Use the new qtConfig macro in all pro/pri files.

This required adding some feature entries, and adding
{private,public}Feature to every referenced already existing entry.

Change-Id: I164214dad1154df6ad84e86d99ed14994ef97cf4
Reviewed-by: Lars Knoll <lars.knoll@qt.io>
Reviewed-by: Oswald Buddenhagen <oswald.buddenhagen@theqtcompany.com>
2016-08-19 04:28:05 +00:00
Liang Qi
0ca4fcbc36 Merge remote-tracking branch 'origin/5.6' into 5.7
Conflicts:
	src/plugins/platforms/xcb/qxcbintegration.cpp

Change-Id: I2d71d06a55f730df19ace0dd3304238584a0497f
2016-08-18 11:07:51 +02:00
Anton Kudryavtsev
1075f6c764 Use QStringRef to optimize memory allocation
Replace substring functions that return QString
with corresponding functions that return QStringRef.

Change-Id: I3c485f89352a1ee66076fba74fd486da9349c354
Reviewed-by: Edward Welbourne <edward.welbourne@qt.io>
2016-08-18 07:29:37 +00:00
Allan Sandfeld Jensen
748aa6b064 Do not disable subpixel rendering on compile time
This is a runtime setting, as the user's freetype version can differ from
the developer's, and freetype already safely handles it internally when
not available.

Task-number: QTBUG-55345
Change-Id: I26e73728196d60ae26e5f1919ecd0dadac393890
Reviewed-by: Eskil Abrahamsen Blomfeldt <eskil.abrahamsen-blomfeldt@qt.io>
2016-08-18 06:11:02 +00:00
Friedemann Kleint
e4bb9395c2 Standardize some "We mean it" comments
Fix the occurrences where the wrong classes are mentioned.

Change-Id: Ia291af77f0f454a39cab93e7376a110c19a07771
Reviewed-by: Lars Knoll <lars.knoll@qt.io>
2016-08-17 19:51:40 +00:00
Anton Kudryavtsev
8617ce5c88 Use QStringRef() more, exploiting its new ::chop()
Change-Id: Id2201639be604b9a32b2dc5d21e675a961bee477
Reviewed-by: Edward Welbourne <edward.welbourne@qt.io>
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
2016-08-16 20:08:31 +00:00
Eskil Abrahamsen Blomfeldt
365a65da70 Remove special case for color fonts from Freetype font engine
When adding color font support to the Freetype engine, we added
a special case to some functions based on the assumption that
color fonts do not contain the latin alphabet. The reason for
the assumption is that color fonts are currently most popular
for emojis and the most popular ones on Linux did not contain
the latin alphabet. But there is nothing special about color
fonts making them less likely to contain latin characters
than other fonts especially made for non-latin writing systems.

If we want an additional fallback when the x character is
not available, this should be implemented for all font engines
and font types.

Change-Id: I1c4aa28d49c38ba7a416c1cae50a1d1c09cbda41
Reviewed-by: Simon Hausmann <simon.hausmann@qt.io>
Reviewed-by: jian liang <jianliang79@gmail.com>
2016-08-16 12:47:06 +00:00
Allan Sandfeld Jensen
5def42f783 Fix alpha from qfontengine_ft to fit qdrawhelper expectations
The short-cuts in qdrawhelper's qt_alphargbblit_argb32 expects the
alpha value of the A32 glyphs to be 0xff.

Since the alpha value is not otherwise used, set it to that.

The reported image format is also changed to RGB32, matching
coretext and windows fontengines, and expected by the OpenGL
paintengine.

Change-Id: I0873156d716566f7f1634249155b6c9983a3d0de
Reviewed-by: Eskil Abrahamsen Blomfeldt <eskil.abrahamsen-blomfeldt@qt.io>
2016-08-16 11:50:34 +00:00
Liang Qi
17198e03ab Merge remote-tracking branch 'origin/5.7' into dev
Conflicts:
	qmake/doc/src/qmake-manual.qdoc
	src/corelib/global/qglobal.cpp
	src/corelib/tools/qstring.cpp
	src/network/socket/qabstractsocket.cpp
	src/network/socket/qnativesocketengine_unix.cpp
	src/plugins/platforms/eglfs/api/qeglfsglobal.h

Change-Id: Id5dfdbd30fa996f9b4b66a0b030b7d3b8c0ef288
2016-08-16 07:58:32 +02:00
Konstantin Tokarev
ac1e87d9f3 Added capHeight() to QRawFont and QFontMetrics(F)
Cap height is an important metric of font, in particular it is
required to make decent implementation of "initial-letter"
CSS property in QtWebKit.

Note that some fonts lack cap height metadata, so we need to
fall back to measuring H letter height.

Change-Id: Icf69d92159d070889085e20d31f2e397d796d940
Reviewed-by: Eskil Abrahamsen Blomfeldt <eskil.abrahamsen-blomfeldt@qt.io>
2016-08-15 18:27:06 +00:00
Allan Sandfeld Jensen
131eee5cd7 Avoid synthesizing stretch on condensed font families
If an entire font family is condensed or stretched and we match by
family name, the default stretch factor of 100 will make the font
engine try to synthesize it back to medium stretched font.

The existing code is already made to deal with a stretch of 0 that is
no longer used. This patch reintroduces 0 stretch to indicate no
specific stretch has been requested. Specifically setting stretch to
100 on a QFont will introduce the old behavior.

[ChangeLog][QtGui][QFont] The default value of QFont::stretch() is
now 0 to indicate any default stretch is acceptable.

Task-number: QTBUG-48043
Change-Id: I574747f980fd4f9893df828818aae99a07b41623
Reviewed-by: Eskil Abrahamsen Blomfeldt <eskil.abrahamsen-blomfeldt@qt.io>
2016-08-15 11:39:44 +00:00
Liang Qi
6b8f422c5e Merge remote-tracking branch 'origin/5.6' into 5.7
Conflicts:
	src/corelib/global/qglobal.cpp
	src/corelib/io/qsettings.cpp
	src/corelib/itemmodels/qstringlistmodel.cpp
	tests/auto/gui/image/qimagewriter/tst_qimagewriter.cpp

Change-Id: I1c6c306ef42c3c0234b19907914b19da706b4a03
2016-08-13 01:05:02 +02:00
Topi Reinio
a2ae631c04 Doc: Change instances of '(Mac) OS X' to 'macOS'
As of version 10.12 (Sierra), the name of Apple's desktop operating
system will be macOS. Change the occurrences where the Mac platform
is discussed to use a macro \macos, which expands to 'macOS'. This
helps with adapting to future renaming.

Update the instructions on mac-specific Q_OS_* macro usage.

Add a \target for the old 'Qt for OS X' topic to keep links working
for other documentation modules that try to link with the old name.

Change-Id: Id33fb0cd985df702a4ae4efb4c5fd428e77d9b85
Reviewed-by: Leena Miettinen <riitta-leena.miettinen@qt.io>
2016-08-12 08:30:29 +00:00
Liang Qi
8ba384a564 Merge remote-tracking branch 'origin/5.6' into 5.7
Change-Id: I1a63523de158757964b6fb5ea026cf69a6c5ddcf
2016-08-10 17:43:13 +02:00
Liang Qi
22e96c4d34 Merge remote-tracking branch 'origin/5.7' into dev
Change-Id: I36e6b890b65d12bf6931757540bcc9c553b5eb8f
2016-08-09 17:59:51 +02:00
Liang Qi
ac9d19c986 Merge "Merge remote-tracking branch 'origin/5.6' into 5.7" into refs/staging/5.7 2016-08-05 16:02:50 +00:00
Jesus Fernandez
4cb44c744c Added pointer check in QFontDatabase::load
CID 11131 (#1 of 1): Dereference after null check (FORWARD_NULL)46.
var_deref_op: Dereferencing null pointer fe.

Change-Id: Ifc0cd0b208db511516db93c3d0e0367299df6d80
Reviewed-by: Timur Pocheptsov <timur.pocheptsov@theqtcompany.com>
Reviewed-by: Konstantin Ritt <ritt.ks@gmail.com>
2016-08-05 10:05:49 +00:00
Liang Qi
69ef0481fc Merge remote-tracking branch 'origin/5.6' into 5.7
Conflicts:
	tests/auto/widgets/itemviews/qtreeview/tst_qtreeview.cpp

Change-Id: I6f3878b204464313aa2f9d988d3b35121d4d9867
2016-08-05 08:58:48 +02:00
Andy Shaw
9b3a7ece47 Re-add the space character as a document terminator
With change 208496091d the space character
was replaced with a visual document terminator character. However this
meant that if the whitespace was visualized without the document
terminator character visualized then clicking after the text would cause
it to be positioned off by one.

By bringing back the space character when the terminator is not being
visualized then it will correctly place the cursor at the end of the
text.

Change-Id: I335c1773a37a654f3196bd350562e8f92ffd5369
Reviewed-by: Eskil Abrahamsen Blomfeldt <eskil.abrahamsen-blomfeldt@qt.io>
2016-08-05 05:56:18 +00:00
Konstantin Shegunov
5dd907bf63 Save QFont's style name if present
Font style names are quite irregular and the simplistic matching
implemented in QFontDatabase::styleString(const QFont &) is unable to
properly resolve the style name when font is recreated from a string.
This causes the fonts before and after serialization to be considered
different, even though they are not. The from/toString methods were
made to write and respect the exact font style.

[ChangeLog][QtGui][Important Behavior Changes] QFont::toString() and
QFont::key() were modified to save the font's style name if one is
set, invalidating any stored font identifiers. QFont::fromString()
was also adjusted to accommodate the change.

Task-number: QTBUG-54936
Change-Id: Ibc7c54119acdd8f0950d6049cc89f859bf981504
Reviewed-by: Eskil Abrahamsen Blomfeldt <eskil.abrahamsen-blomfeldt@qt.io>
Reviewed-by: Oswald Buddenhagen <oswald.buddenhagen@theqtcompany.com>
2016-08-03 11:47:58 +00:00
Liang Qi
d875d5e2fc Merge "Merge remote-tracking branch 'origin/5.7' into dev" into refs/staging/dev 2016-08-02 07:54:03 +00:00
Edward Welbourne
f6fc34294f Merge remote-tracking branch 'origin/5.7' into dev
Conflicts:
	configure
5.7 now supports clang on android; but dev re-worked configure

	src/gui/kernel/qevent.h
One side renamed a parameter of a constructor; the other added an
alternate constructor on the next line.  Applied the rename to both
for consistency.

	tests/auto/tools/moc/tst_moc.cpp
Each side added a new test at the end.

	.qmake.conf
Ignored 5.7's change to MODULE_VERSION.

	configure.json
No conflict noticed by git; but changes in 5.7 were needed for the
re-worked configure to accommodate 5.7's stricter handling of C++11.

Change-Id: I9cda53836a32d7bf83828212c7ea00b1de3e09d2
2016-08-01 18:20:00 +02:00
Eskil Abrahamsen Blomfeldt
6f423555eb REG: Fix unwanted cache flush in Freetype engine
The Freetype cache was almost completely disabled by
134c6db858 because after that
change, the lockedAlphaMapForGlyph() function would no longer
cut off early for empty glyphs like spaces, but rather go
through all alpha map functions before it realized that there
was nothing to render. This would in turn invalidate the cache
for every empty glyph, causing all glyphs to be rerendered for
every isolated word.

This change adds back a cut off. This is only needed in the
lockedAlphaMapForGlyph() function, since the superclass implementation
of the other alpha map functions already contains a cut off for
width/height == 0.

[ChangeLog][Qt Gui][Text] Fixed a performance regression in Freetype
engine that was introduced in Qt 5.5.

Change-Id: I381285939909e99cc5fb5f3497fecf9fa871f29a
Task-number: QTBUG-49452
Reviewed-by: Simon Hausmann <simon.hausmann@qt.io>
2016-08-01 11:58:02 +00:00
Andy Shaw
0ec512e90b Export QTextDocumentPrivate with Q_GUI_EXPORT
QTextDocument is used from several different Qt modules so it needs to be
possible to access its privates from outside of Qt Gui.

Change-Id: I8087f8312e0db46bd457a6119d974caa27660d57
Reviewed-by: Eskil Abrahamsen Blomfeldt <eskil.abrahamsen-blomfeldt@qt.io>
2016-08-01 11:03:35 +00:00
Liang Qi
3cb7302480 Merge remote-tracking branch 'origin/5.6' into 5.7
Conflicts:
	src/widgets/itemviews/qabstractitemview.cpp
	src/widgets/itemviews/qabstractitemview_p.h

Change-Id: I54589b1365103cb1749186af92aab03a49c94b64
2016-08-01 10:03:21 +02:00
Allan Sandfeld Jensen
997fa05d90 Handle indirect sibling selector
Adds parsing and handling of the indirect sibling selector, this should
mean we can at least parse all CSS3 selectors even if we do not yet
support all of them.

Also adds tests for previously added CSS3 selectors.

Change-Id: I1ce9afb9466044a38bdec167affc21a87837e4a4
Reviewed-by: Simon Hausmann <simon.hausmann@qt.io>
2016-07-27 20:18:02 +00:00
Eirik Aavitsland
5b64b64717 Fontengine: Avoid invalid alpha maps when antialiasing is off
When font antialising is disabled, the created alpha maps will be Mono
format. Make sure that the created QImage is valid by ensuring that
it has a color table of the right size.

Issue was earlier handled by a4e2f2e687,
but that will be partially reverted because of compatibility break.

Task-number: QTBUG-50745
Change-Id: I7c521288469ae94805a3326644771270d97ab979
Reviewed-by: Konstantin Ritt <ritt.ks@gmail.com>
Reviewed-by: Eskil Abrahamsen Blomfeldt <eskil.abrahamsen-blomfeldt@qt.io>
2016-07-27 09:01:15 +00:00
Eskil Abrahamsen Blomfeldt
4ffdd865b0 Revert "Emit updateBlock signal in QTextDocumentLayout"
This reverts commit 13040043b2.
It introduced a bad regression, noticeable for longer documents, as
it would cause the documentChanged(0, length) to trigger a layout of
the entire document.

The bug report for the commit (or the commit itself) does not contain
a test case, but it is regardless the wrong approach. Note that
QQuickTextEdit already listens to the contentsChange signal and
invalidates the changed parts of the document as a reaction to this,
so it should already work as expected.

[ChangeLog][Qt Gui][Text] Fixed performance hit from showing large
QTextDocuments in a QTextEdit or QTextBrowser. (Regression introduced
in Qt 5.3.0)

Task-number: QTBUG-51411
Change-Id: I6e7fbf8f62a1d68779eef5da3781de14d9fdcad8
Reviewed-by: Simon Hausmann <simon.hausmann@qt.io>
2016-07-27 06:46:04 +00:00
Allan Sandfeld Jensen
b3959b515f Update qcssscanner so it can parse our normal offline documentation CSS
Adds the three CSS3 attribute selectors.

During this the internal naming of the existing attribute-selectors have
been changed to be more clear, and the dash-matching has been fixed to
not just be beginsWith.

A non-breaking space have also been removed from the CSS.

Change-Id: Ia4db4a5a19e3ceee8c3c8a4b744149edd1d32bdc
Reviewed-by: Simon Hausmann <simon.hausmann@qt.io>
2016-07-26 13:26:00 +00:00
Edward Welbourne
6c5de416c9 Merge remote-tracking branch 'origin/5.6' into 5.7
Conflicts:
	src/corelib/io/qtemporarydir.cpp
One side encapsulated a repeated piece of #if-ery in a local define;
the other added to the #if-ery.  Made its addition to the other's.

	src/corelib/kernel/qeventdispatcher_unix_p.h
One side moved some members into a struct; this collided with a #undef
check that neither side now has.  Discarded the #undef part.

	src/gui/opengl/qopengltexturehelper_p.h
5.7 deleted a bunch of methods; not clear why merge got confused.

	src/tools/moc/moc.cpp
One added a name to the copyright header; another changed its URL.

Change-Id: I9e9032b819f030d67f1915445acf2793e98713fa
2016-07-26 10:43:29 +02:00
Eskil Abrahamsen Blomfeldt
49926bb9ef Fix performance regression when changing fonts
Change e109b8a0f3 introduced a
performance regression when rapidly switching fonts as long as
the number of different fonts is over a relatively small number, since
the cost of fonts can be high compared to the limits set on the cache.

Since the original patch was intended to avoid exceeding the
open file limit when using Freetype on Windows, we add an
additional check on the number of engines in the cache as well
for the added, synchronous cache flush.

The limit is set to 256 to make it unlikely that it is exceeded
during a single paint event, but it can also be configured when
building Qt if a higher limit is needed.

[ChangeLog][QtGui][Text] Fixed performance regression when rapidly
switching between a large set of fonts.

Task-number: QTBUG-54180
Change-Id: I92b9fbe14fca4f11c9c6dfdcdbec6d19a61b86a7
Reviewed-by: Konstantin Ritt <ritt.ks@gmail.com>
2016-07-22 12:14:03 +00:00
Edward Welbourne
601019e3f4 Merge "Merge remote-tracking branch 'origin/5.7' into dev" into refs/staging/dev 2016-07-22 10:15:48 +00:00
Fahad Al-Saidi
6e21c3fafd make QFontDatabase().writingSystemSample for Arabic useful
The current QFontDatabase().writingSystemSample for Arabic is an
arbitrary text and meaningless.
This suggested text is used in LibreOffice and it makes sense for Arabic
people.

Task-number: QTBUG-53390
Change-Id: I7456d2741fbc07b4cfffd6151b421cb4427dd3e9
Reviewed-by: Eskil Abrahamsen Blomfeldt <eskil.abrahamsen-blomfeldt@qt.io>
Reviewed-by: Konstantin Ritt <ritt.ks@gmail.com>
2016-07-20 04:28:30 +00:00
Edward Welbourne
782ebeada1 Merge remote-tracking branch 'origin/5.7' into dev
Conflicts:
	qmake/library/qmakebuiltins.cpp
	qmake/library/qmakeevaluator.cpp
	qmake/library/qmakeevaluator.h
	qmake/project.h
QMakeEvaluator:
* evaluateConditional(): one side changed return type, the other
  changed a parameter type.
* split_value_list(): one side changed a parameter adjacent to where ...
* expandVariableReferences(): ... the other killed one overload and
  changed the survivor

	src/corelib/io/qlockfile_unix.cpp
One side changed a #if condition, the other moved NETBSD's part of
what it controlled.

	src/corelib/tools/qdatetime.cpp
One side fixed a reachable Q_UNREACHABLE in toMSecsSinceEpoch(), the
other moved it from the private class to the public one, in the midst
of the "short date-time" optimization, which confused diff entirely.
One side changed a QStringLiteral to QLatin1String, the other rewrote
adjoining code.

	src/network/kernel/qauthenticator.cpp
Both rewrote a line, equivalently; kept the dev version.

	src/platformsupport/fontdatabases/mac/qfontengine_coretext.mm
	src/platformsupport/fontdatabases/mac/qfontengine_coretext_p.h
One side changed #if-ery that the other removed.

	tools/configure/configureapp.cpp
One side added a check to -target parsing; the other killed -target.

	tests/auto/testlib/selftests/expected_cmptest.lightxml
	tests/auto/testlib/selftests/expected_cmptest.teamcity
	tests/auto/testlib/selftests/expected_cmptest.txt
	tests/auto/testlib/selftests/expected_cmptest.xml
	tests/auto/testlib/selftests/expected_cmptest.xunitxml
Regenerated using generate_expected_output.py
I note that quite a few other expected_* come out changed, now.

There was no git-conflict in
	src/widgets/kernel/qformlayout.cpp
but it didn't compile; one side removed some unused methods; the other
found uses for one of them.  Put FixedColumnMatrix<>::removeRow(int)
back for its new user.

Change-Id: I8cc2a71add48c0a848e13cfc47b5a7754e8ca584
2016-07-19 20:14:40 +02:00
Michael Sheldon
267c013905 Preserve the scale of fonts when caching the font engine
Associates the scalableBitmapFactor with the freetype QFontEngine
so that it is preserved when caching the engine

Task-number: QTBUG-53652
Change-Id: I010f9d235ccf30679b112e0c05e01bc247a3693f
Reviewed-by: jian liang <jianliang79@gmail.com>
Reviewed-by: Eskil Abrahamsen Blomfeldt <eskil.abrahamsen-blomfeldt@qt.io>
2016-07-19 06:44:00 +00:00
Anton Kudryavtsev
e46e112eb1 Optimize string usage
Use QStringBuilder more.
Use QL1S directly, without QString construction.

Change-Id: Iad844391367681fc1013b9725403d009e7c346e6
Reviewed-by: Edward Welbourne <edward.welbourne@qt.io>
2016-07-15 08:23:04 +00:00
Robin Burchell
ca9ed9619f Improve performance of Qt::mightBeRichText by using QStringRef
I noted this taking around 1% of QtQuick Text creation with a few simple bindings
which is quite considerable, so hopefully improvements here will add up gradually.

Also add a benchmark measuring changes:

                  Test                 |      From      |       To       |        Details
+--------------------------------------+----------------+----------------+-----------------------+
  mightBeRichText:br-invalidspace      | 14466.00 instr | 10563.00 instr | -26.98% FASTER! :)
  mightBeRichText:br-nospace           | 18581.00 instr | 14635.00 instr | -21.24% FASTER! :)
  mightBeRichText:br-space             | 18470.00 instr | 14377.00 instr | -22.16% FASTER! :)
  mightBeRichText:documentation-header | 16336.00 instr | 12992.00 instr | -20.47% FASTER! :)
  mightBeRichText:empty                | 2618.00 instr  | 2618.00 instr  | more or less the same
  mightBeRichText:invalid closing tag  | 11102.00 instr | 7159.00 instr  | -35.52% FASTER! :)
  mightBeRichText:no tags              | 12503.00 instr | 8581.00 instr  | -31.37% FASTER! :)
  mightBeRichText:simple               | 17316.00 instr | 14074.00 instr | -18.72% FASTER! :)
  mightBeRichText:simple2              | 14394.00 instr | 10745.00 instr | -25.35% FASTER! :)
+--------------------------------------+----------------+----------------+-----------------------+
             Overall result            |                                        -201.81% :)

Change-Id: I1817a69959d176b381bcbf27b72bb751885c3e9b
Reviewed-by: Konstantin Ritt <ritt.ks@gmail.com>
Reviewed-by: Marc Mutz <marc.mutz@kdab.com>
Reviewed-by: Simon Hausmann <simon.hausmann@qt.io>
2016-07-11 12:30:31 +00:00
Anton Kudryavtsev
2788fccd29 Use QStringLiteral more judiciously
Replace it with QL1S in QStringBuilder expressions
and in overloaded functions.

Replace patterns 'QString::number() + QStringLiteral'
and 'QStringLiteral + QString::number()' with
QString::asprintf.

Saves some text size.

Change-Id: Ib39b2332264dfc3df04e77f2c101b47a1030cef4
Reviewed-by: Edward Welbourne <edward.welbourne@qt.io>
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
2016-07-08 06:43:02 +00:00
Anton Kudryavtsev
5dc739ba9b Replace QString::trimmed() with QStringRef::trimmed()
... where it's possible. Reduce allocations.

Change-Id: I023adfd316f94948fe50749f60bf55748dca56e2
Reviewed-by: Edward Welbourne <edward.welbourne@qt.io>
2016-07-06 18:30:26 +00:00
Lars Knoll
e8fe65205c Add qtguiglobal.h and qtguiglobal_p.h
The new modular configuration system requires one global
header per module, that is included by all other files in
this module.

A similar scheme and naming convention is already being used
for many other modules (e.g. printsupport, qml, quick).

That header will later on #include the configuration file
for Qt Gui. For now it defines the Q_GUI_EXPORT macro for
this library.

In addition, add a private global header, qtguiglobal_p.h,
that can later on include the private config header for
Qt Gui for things we don't want to export to the world.

Change-Id: Id9ce2a4f3d2962c3592c35e3d080574789195f24
Reviewed-by: Oswald Buddenhagen <oswald.buddenhagen@theqtcompany.com>
2016-07-03 07:55:57 +00:00
Liang Qi
ea438b2508 Merge remote-tracking branch 'origin/5.7' into dev
Conflicts:
	src/corelib/global/qglobal.cpp
	src/corelib/global/qsysinfo.h
	src/corelib/kernel/qcoreapplication_win.cpp
	src/gui/text/qdistancefield.cpp
	src/gui/text/qdistancefield_p.h
	src/plugins/platforms/windows/qwindowsglcontext.cpp
	src/plugins/platforms/windows/qwindowsglcontext.h

Change-Id: Ib3500acc2b28553bde06758cd9a2e19eb7fe2978
2016-06-21 08:39:41 +02:00
Liang Qi
e32f1a4d61 Merge remote-tracking branch 'origin/5.6' into 5.7
And blacklisted a few tests in tst_QUdpSocket.

Conflicts:
	src/android/jar/src/org/qtproject/qt5/android/QtNative.java
	src/corelib/global/qglobal.cpp
	src/corelib/global/qsystemdetection.h
	src/corelib/io/qfileselector.cpp
	src/plugins/platforms/eglfs/deviceintegration/eglfs_kms_egldevice/qeglfskmsegldeviceintegration.cpp
	tests/auto/network/socket/qudpsocket/BLACKLIST

Task-number: QTBUG-54205
Change-Id: I11dd1c90186eb1b847d45be87a26041f61d89ef6
2016-06-20 08:00:26 +02:00
Liang Qi
3cb56800d5 Merge remote-tracking branch 'origin/5.7' into dev
Conflicts:
	tests/auto/widgets/itemviews/qlistview/tst_qlistview.cpp

Change-Id: If899cda251b4dc8b8a7c6764520e88ab719737cd
2016-06-17 10:53:42 +02:00
Liang Qi
c4e472ea10 Merge remote-tracking branch 'origin/5.7.0' into 5.7
Conflicts:
	src/corelib/tools/qsimd_p.h

Change-Id: I7c6bfc5873d97ad7f51a540dd9c18b9359dde59f
2016-06-16 07:30:02 +02:00
Eskil Abrahamsen Blomfeldt
c165cbaef2 Remove unused macro: QT_DISTANCEFIELD_DEFAULT_TILESIZE
Usage of this macro has been removed, and so can the macro.

Task-number: QTBUG-52389
Change-Id: I28a5459e577b78f0f9907612893d6850848f405d
Reviewed-by: Yoann Lopes <yoann.lopes@qt.io>
2016-06-15 12:54:06 +00:00
Eskil Abrahamsen Blomfeldt
c2d3c2b9f9 Fix crash when creating distance field for large glyph
Do the multiplication of the normal components in floating point to
avoid integer overflows. Also add an assert, since a scale of 0 here
will cause a normal of (0, 0) which will assert further into the
drawRectangle() function, and the cause is not immediately clear.

Task-number: QTBUG-51956
Change-Id: If7187d56af28eaa149f8f362050a587da5adb262
Reviewed-by: Yoann Lopes <yoann.lopes@qt.io>
2016-06-14 08:35:45 +00:00
Eskil Abrahamsen Blomfeldt
fe97ecf408 Make it possible to create distance fields with any height
Assuming a certain max height for glyphs would make it impossible
to render certain fonts. The follow up to this change is in
Qt Quick, where the code must also be adapted to make it work.

Task-number: QTBUG-52389
Change-Id: Iabebb2de21a92d1537b2965aa6603529c1d5d587
Reviewed-by: Yoann Lopes <yoann.lopes@qt.io>
2016-06-14 08:35:38 +00:00
Liang Qi
511790fd1a Merge remote-tracking branch 'origin/5.7' into dev
Conflicts:
	config_help.txt
	configure
	mkspecs/features/uikit/sdk.prf
	src/corelib/global/qhooks.cpp
	src/corelib/io/qfilesystemwatcher.cpp
	src/corelib/io/qlockfile_unix.cpp
	src/corelib/tools/qalgorithms.h
	src/gui/kernel/qwindowsysteminterface.h
	src/gui/text/qtextdocument_p.cpp
	src/network/access/access.pri
	src/network/access/qnetworkaccessmanager.cpp
	src/network/access/qnetworkreplynsurlconnectionimpl.mm
	src/src.pro
	src/testlib/qtestcase.cpp
	src/widgets/kernel/qwidgetbackingstore_p.h
	src/widgets/styles/qwindowscestyle.cpp
	src/widgets/styles/qwindowsmobilestyle.cpp
	tests/auto/corelib/io/qdiriterator/qdiriterator.pro
	tests/auto/corelib/io/qfileinfo/qfileinfo.pro
	tests/auto/gui/kernel/qwindow/BLACKLIST
	tests/auto/widgets/dialogs/qfilesystemmodel/tst_qfilesystemmodel.cpp
	tools/configure/configureapp.cpp

Change-Id: Ibf7fb9c8cf263a810ade82f821345d0725c57c67
2016-06-13 12:46:46 +02:00
Liang Qi
cbe332405a Merge remote-tracking branch 'origin/5.6' into 5.7
Conflicts:
	configure
	mkspecs/macx-ios-clang/features/default_pre.prf
	mkspecs/macx-ios-clang/features/sdk.prf
	mkspecs/unsupported/freebsd-g++46/qplatformdefs.h
	src/widgets/styles/qgtkstyle.cpp
	tests/auto/corelib/io/qdiriterator/qdiriterator.pro
	tests/auto/corelib/io/qfileinfo/qfileinfo.pro

Change-Id: Ia943555d1e59234a66f7dc65bdfda838e40001b5
2016-06-10 23:27:10 +02:00
Thiago Macieira
0a78d918f0 Replace qAllocMore with a pair of more useful functions
The first is "exact", not "more": qCalculateBlockSize. It ensures that
there's no overflow in multiplying, adding the header size or when
converting back to an int.

The second is the replacement for qAllocMore: it calculates the block
size like the first, but increases the block size to accommodate future
appends. The number of elements that fit in the block is also returned.

Task-number: QTBUG-41230
Change-Id: I52dd43c12685407bb9a6ffff13f5da09f816e667
Reviewed-by: Lars Knoll <lars.knoll@qt.io>
2016-06-09 15:32:14 +00:00
Liang Qi
57057f76ad Merge remote-tracking branch 'origin/5.6' into 5.7
Conflicts:
	.qmake.conf
	config.tests/unix/nis/nis.cpp
	mkspecs/unsupported/freebsd-g++/qplatformdefs.h
	src/corelib/tools/qdatetime.cpp
	src/corelib/tools/qsimd.cpp
	src/corelib/tools/qsimd_p.h
	src/network/access/access.pri
	src/network/access/qnetworkreplynsurlconnectionimpl.mm
	src/network/access/qnetworkreplynsurlconnectionimpl_p.h
	src/plugins/platforms/cocoa/qnsview.mm
	src/plugins/printsupport/windows/qwindowsprintdevice.cpp
	tests/auto/corelib/kernel/qobject/tst_qobject.cpp
	tests/auto/network/access/qnetworkreply/BLACKLIST
	tests/auto/widgets/widgets/qopenglwidget/BLACKLIST

Change-Id: I4b32055bbf922392ef0264fd403405416fffee57
2016-06-06 09:04:55 +02:00
Allan Sandfeld Jensen
d5ac97e36f Fix font-weight regression
Do not override the requested font-weight. This was a wrong rewrite of
a now redundant if-statement.

Change-Id: I20a745cac02d896fdeaa853f20c6b6647084fceb
Reviewed-by: Eskil Abrahamsen Blomfeldt <eskil.abrahamsen-blomfeldt@qt.io>
2016-06-04 22:49:31 +00:00
Jake Petroules
95ea1b1aa8 Remove all code paths related to unsupported Apple platforms.
Now that the minimum deployment target (and thus SDK) is 10.9 for OS X
and 7.0 for iOS, all code paths affecting platform versions lower than
the aforementioned are removed.

Change-Id: Id985c7259c4ac069319d88f2c29c9559ae9e8641
Reviewed-by: Jake Petroules <jake.petroules@qt.io>
2016-06-04 09:24:33 +00:00
Anton Kudryavtsev
84bd6a83a0 QTextDocument: use QString::replace() for replacing
... instead of homebrew algorithm.
Saves some memory allocations and some text size.

Change-Id: I3abb49d3b247dbb132688ea99e6eae731e31615c
Reviewed-by: Edward Welbourne <edward.welbourne@qt.io>
2016-06-02 17:20:44 +00:00
Anton Kudryavtsev
f046205526 QTextDocument: use QL1S::size() to get size of internal string
... instead of call of qstrlen(), because of ctor of QL1S
already do this work for us. The old code is Qt4 legacy.

Change-Id: I449ce7ea481af0efeade258d2cd5652db1f1a8b1
Reviewed-by: Edward Welbourne <edward.welbourne@qt.io>
Reviewed-by: Konstantin Ritt <ritt.ks@gmail.com>
2016-06-02 17:20:05 +00:00
Anton Kudryavtsev
6030e63037 QtGui: use QStringRef to optimize memory allocation
Replace substring functions that return QString with
corresponding functions that return QStringRef where
it's possible.

Create QString from QStringRef only where necessary.

Change-Id: Id83c60cc7568b20ef008b51c582cfdf466a47e35
Reviewed-by: Edward Welbourne <edward.welbourne@qt.io>
2016-06-02 12:57:42 +00:00
Anton Kudryavtsev
90988a2c67 QFontDatabase: append substitutes directly to the family list
Don't create tmp list.

Change-Id: I1aa80f1fb5589eb01ad2a41cf028b920a618a636
Reviewed-by: Edward Welbourne <edward.welbourne@qt.io>
2016-06-02 09:44:24 +00:00
Eskil Abrahamsen Blomfeldt
8fb29ed259 Don't alter input string in QTextLayout with ShowLineAndParagraphSeparators
When ShowLineAndParagraphSeparators was set, we would replace the
separator character in the user's string in some cases, since we never
detached from the input string and just const_cast the pointer to the
shared buffer.

[ChangeLog][QtGui][Text] Fixed bug where a QTextLayout with
ShowLineAndParagraphSeparators would modify the layout's input
string.

Task-number: QTBUG-42033
Change-Id: I92f9100b750f16e52b38b718245c13e5c4a0ebb9
Reviewed-by: Lars Knoll <lars.knoll@theqtcompany.com>
Reviewed-by: Konstantin Ritt <ritt.ks@gmail.com>
2016-06-01 10:04:02 +00:00
Anton Kudryavtsev
a24b90a21c Gui: use const (and const APIs) more
For CoW types, prefer const methods to avoid needless detach()ing.

Change-Id: I88d08d499e1be72c1f6d983fecdcee513df18aa2
Reviewed-by: Edward Welbourne <edward.welbourne@qt.io>
2016-06-01 09:35:29 +00:00
Jake Petroules
a160bd4fcc Fix bugs causing Thin font weights to be ignored or mishandled.
Task-number: QTBUG-53196
Change-Id: If12b3cab3d8de5e0e452fca844b0a484c29e9e86
Reviewed-by: Allan Sandfeld Jensen <allan.jensen@qt.io>
2016-06-01 02:29:51 +00:00
Thiago Macieira
5c2ff22ba1 Use void instead of uchar in the endian-swapping function parameters
This allows us to pass pointers to storage that is not an array of
uchar, which it hardly ever is.

Change-Id: Ifea6e497f11a461db432ffff14490d2c2df21906
Reviewed-by: Konstantin Ritt <ritt.ks@gmail.com>
Reviewed-by: Marc Mutz <marc.mutz@kdab.com>
2016-05-26 18:02:49 +00:00
Eskil Abrahamsen Blomfeldt
4c56466f43 Add line feed and carriage return to blacklisted characters
In order to avoid loading and checking all fonts on the system when
the string contains a line separator, we blacklisted it in
98a23b974509bd1b6d9459e6c79677bdcbaa0108 in Qt 4. The same logic
applies for paragraph separators, line feeds and carriage returns.

Task-number: QTBUG-51934
Change-Id: I121dce17a8ac79b5b790e24c6596438e501e871a
Reviewed-by: Konstantin Ritt <ritt.ks@gmail.com>
2016-05-24 11:35:34 +00:00
Liang Qi
56d6e000f7 Merge remote-tracking branch 'origin/5.7' into dev
Conflicts:
	mkspecs/wince80colibri-armv7-msvc2012/qmake.conf
	qmake/generators/win32/msvc_vcproj.cpp
	src/corelib/global/qnamespace.h
	src/corelib/global/qnamespace.qdoc
	src/corelib/io/qfsfileengine_win.cpp
	src/corelib/tools/tools.pri
	src/network/ssl/qsslconfiguration_p.h
	src/plugins/platforms/linuxfb/qlinuxfbscreen.cpp
	src/plugins/platforms/windows/windows.pri
	src/src.pro
	src/tools/bootstrap/bootstrap.pro
	src/tools/uic/cpp/cppwriteinitialization.cpp
	src/widgets/dialogs/qfilesystemmodel.cpp
	tests/auto/testlib/selftests/expected_cmptest.teamcity
	tests/auto/testlib/selftests/expected_cmptest.txt

Change-Id: I4d2ac78f0dcc97f008186bbbc769c6fe588ab0e5
2016-05-23 21:09:46 +02:00
Eskil Abrahamsen Blomfeldt
78eeb6b066 QFont::exactMatch() should return false for aliases
This is a partial revert of 992f233c in Qt 4 repo. The rest of the
change cannot be reverted, since it added public API, but that
API might be useful anyway.

The patch was wrong, basically. QFont::exactMatch() should not claim
that you can get an exact match for a typeface alias. It also introduced
some weird inconsistencies: For instance, if the first font the alias
resolved to in FontConfig did not exist, then exactMatch() would return
false, even if it then resolved to the next one which existed. This
caused a test failure on OpenSuse, where the preferred font for "sans"
is Arial, which doesn't exist, so Roboto will be used instead.

[ChangeLog][QtGui][Important Behavior Changes] QFont::exactMatch() now
returns false when the provided typeface is an alias.

Task-number: QTBUG-46054
Change-Id: I7532d2879b492544620aa0d1d87dd493a4923af9
Reviewed-by: Simon Hausmann <simon.hausmann@theqtcompany.com>
2016-05-12 10:13:42 +00:00
Liang Qi
990969655c Merge remote-tracking branch 'origin/5.7' into dev
Conflicts:
	config_help.txt
	configure
	src/corelib/io/qprocess_wince.cpp
	src/plugins/platforms/windows/qwindowstheme.cpp
	src/plugins/platforms/xcb/qxcbbackingstore.cpp
	tests/auto/corelib/tools/qtimezone/BLACKLIST
	tests/auto/network/socket/qudpsocket/tst_qudpsocket.cpp
	tests/auto/widgets/kernel/qwidget/tst_qwidget.cpp

Change-Id: I26644d1cb3b78412c8ff285e2a55bea1bd641c01
2016-05-12 08:33:08 +02:00
Friedemann Kleint
a213011a53 QtGui: Introduce delegating constructors.
Reduce code duplication by chaining constructors.

Change-Id: Ida25105e33cc3ef870f416931212e2216e9c6dfb
Reviewed-by: Shawn Rutledge <shawn.rutledge@theqtcompany.com>
Reviewed-by: Lars Knoll <lars.knoll@theqtcompany.com>
2016-05-09 19:47:53 +00:00
Liang Qi
dbef41f43e Merge remote-tracking branch 'origin/5.6' into 5.7
Conflicts:
	examples/qtestlib/tutorial5/containers.cpp
	examples/widgets/tools/tools.pro
	src/corelib/io/qprocess.cpp
	src/corelib/io/qprocess_unix.cpp
	src/corelib/io/qprocess_win.cpp
	src/network/kernel/qdnslookup_unix.cpp
	src/plugins/platforms/xcb/qxcbconnection_xi2.cpp
	src/testlib/qtestcase.cpp
	tools/configure/configureapp.cpp

Change-Id: I838ae7f082535a67a4a53aa13a21ba5580758be8
2016-05-06 15:36:44 +02:00
Friedemann Kleint
722faa8daa Add some QChar::unicode() calls to brush over deprecation warning.
Change-Id: I381226153cdd7bc002476ebc7a33fcb6cf15535d
Reviewed-by: Marc Mutz <marc.mutz@kdab.com>
Reviewed-by: Konstantin Ritt <ritt.ks@gmail.com>
2016-05-06 08:11:19 +00:00
Eskil Abrahamsen Blomfeldt
b75e10684c doc: Clarify how to remove a QTextFrame
The documentation wrongfully recommended deleting QTextFrames
directly. This would cause a crash, since the destructor didn't
update the document's layout at all. The correct way is the same
as when removing other aspects of the document.

Task-number: QTBUG-53082
Change-Id: I64f0ad08f1d063626456fa51d03611871ce6aa45
Reviewed-by: Simon Hausmann <simon.hausmann@theqtcompany.com>
2016-05-04 10:08:08 +00:00
Jian Liang
347832d759 Support color font rendering for freetype engine
This patch mainly do two things:
1) Support color bitmap font for freetype fontengine. This partially
 based on Corentin Jabot's patch

2) Support ARGB opengl glyph cache when workaround_brokenFBOReadBack is
true (It is always true under Android). Some code refactor has been
done in QOpenGLTextureGlyphCache.

This patch also bump the minimal required freetype version to 2.2

[ChangeLog][General][Freetype] Support color font rendering

Task-number: QTBUG-35156
Change-Id: I35aae5f98ba9a27b70a48db3f2647fc070c39c33
Reviewed-by: Eskil Abrahamsen Blomfeldt <eskil.abrahamsen-blomfeldt@qt.io>
2016-05-03 22:58:49 +00:00
Liang Qi
6357813207 Merge remote-tracking branch 'origin/5.7' into dev
Conflicts:
	configure
	src/3rdparty/double-conversion/include/double-conversion/utils.h
	src/corelib/global/qnamespace.qdoc
	src/corelib/tools/qsimd_p.h
	tests/auto/corelib/io/qfile/tst_qfile.cpp

Change-Id: I3ca1007bab5355d251c13002a18e93d81c254d34
2016-05-03 15:49:15 +02:00
Liang Qi
b894a8def5 Merge remote-tracking branch 'origin/5.6' into 5.7
Conflicts:
	mkspecs/features/qml_module.prf
	mkspecs/features/qt_common.prf
	src/gui/text/qzip.cpp
	src/plugins/platforms/cocoa/qnsview.mm
	src/plugins/platforms/windows/array.h
	src/testlib/qtestcase.cpp
	src/widgets/dialogs/qfilesystemmodel.h

Change-Id: Ie41c5868415b81f7693c80e045497035504bb210
2016-04-29 17:55:20 +02:00
Jian Liang
d2304a28ca Change some members of QFontEngineFT::Glyph to short
Some color bitmap fonts will have a size greater than 127 pixels,
 areMetricsTooLarge() will return true(its advance exceed 127) for
 these fonts and we are unable to render these fonts since
 QFontEngineFT::loadGlyph() will simply do nothing if
 areMetricsTooLarge() return true. To support bitmap font whose size
 is between 128 and 255, we change x,y,advance of QFontEngineFT::Glyph
 to short variable to make areMetricsTooLarge() return false, in this
 way we will be able to render such color bitmap fonts.

Change-Id: I9ab244b14884cdde91040a462f2fbca650b91289
Reviewed-by: Konstantin Ritt <ritt.ks@gmail.com>
Reviewed-by: Eskil Abrahamsen Blomfeldt <eskil.abrahamsen-blomfeldt@qt.io>
2016-04-29 09:10:32 +00:00
Konstantin Ritt
c003a18ee3 Fix font fallback for an overridden Common script cases
Always prefer the requested font, even if it doesn't support the
script of interest, and fallback to a font that *does* support that
script, so that the best-matching font always takes a precedence.
The result looks much closer to what CT and GDI/DW does.

Task-number: QTBUG-35836
Task-number: QTBUG-39377
Task-number: QTBUG-43408
Change-Id: I6a89593565683f318f7292ec5ecf271dadc4142a
Reviewed-by: Eskil Abrahamsen Blomfeldt <eskil.abrahamsen-blomfeldt@qt.io>
2016-04-27 00:40:02 +00:00
Timur Pocheptsov
0b35167c20 QZipReader - test that QFile::open was, indeed, successful.
Coverity, CIDs 10917, 10918. This fix looks like purely cosmetic
and unneeded: we check f->error() after f->open(). Unfortunately,
f->open() can fail without setting an error (if you provided an invalid mode).

Change-Id: Idbfcb9305b3f004e5e425cb6076b41e193b8d473
Reviewed-by: Konstantin Ritt <ritt.ks@gmail.com>
2016-04-26 09:36:30 +00:00
Marc Mutz
ebbfc55667 QtGui: mark more types as primitive/movable
These types are held in QVarLengthArrays, so benefit
from being trivially relocatable. They are also part
of the private API, so there's no BC issues with
potential uses of these types in QList, except for
QPainter::PixmapFragment, which consequently has been
marked as relocatable only.

Change-Id: I90fb9a19231c6f5c71c593602fc997ffafe8f047
Reviewed-by: Lars Knoll <lars.knoll@theqtcompany.com>
2016-04-25 07:43:27 +00:00
Eskil Abrahamsen Blomfeldt
7094466f7d Interpret fixed CSS line-height as minimum rather than absolute
The QTextBlockFormat::FixedHeight overrides the line height
regardless of its calculated height. If the line contains
objects or text which is higher than the specified line height,
using FixedHeight will cause them to overlap with the previous
line. This is not what happens in normal web browsers. The
expected behavior is that the line height given in CSS is the
minimum height, but that we still reserve space needed to display
everything without overlaps.

To make it possible for people to retain the old behavior, we
introduce the -qt-line-height-type property, which allows them
to override the default.

This also fixes output from toHtml() to use the new property
rather than set the minimum height of the paragraph or the
"line-spacing" property, which does not exist in either CSS nor
in Qt.

[ChangeLog][QtGui][Important Behavior Changes] When line height
is specified in pixels, this is now interpreted as the minimum
line height rather than an absolute line height to avoid overlaps.
To get the old behavior, use the -qt-line-height-type property in
CSS and set it to "fixed".

Task-number: QTBUG-51962
Change-Id: Ic2dde649b69209672170dad4c2de1e1c432a1078
Reviewed-by: Lars Knoll <lars.knoll@theqtcompany.com>
2016-04-19 09:32:10 +00:00
Liang Qi
b94773c9c8 Merge remote-tracking branch 'origin/5.6' into 5.7
Conflicts:
	config.tests/unix/compile.test
	src/android/jar/src/org/qtproject/qt5/android/QtActivityDelegate.java
	src/testlib/qtestcase.cpp
	src/testlib/qtestcase.qdoc

Change-Id: Ied3c471dbc9a076c8de33d673bd557e88575609d
2016-04-13 06:55:37 +02:00
Liang Qi
f34e73a16a Merge remote-tracking branch 'origin/5.7' into dev
Conflicts:
	src/corelib/kernel/qobject.cpp
	src/gui/painting/qpaintengine_raster.cpp

Change-Id: I74e1779832f43d033708dcfd6b666c7b4f0111fb
2016-04-11 09:12:36 +02:00
Anton Kudryavtsev
8903460093 QtBase: use erase and std::remove_if with QList and QVector
... instead of using removeAt in a loop, with quadratic complexity.

Change-Id: I38b49e56b12c396db9fc0f1b75d8fb43c503a7f6
Reviewed-by: Marc Mutz <marc.mutz@kdab.com>
2016-04-08 19:35:26 +00:00
Eskil Abrahamsen Blomfeldt
53180c430f Add flag for showing document terminator in text
In 208496091d, the behavior of
QTextOption::ShowLineAndParagraphSeparators was changed to also
include a section symbol at the end of the document. This was
an unnecessary behavioral change. Instead we add a separate flag
for this marker.

[ChangeLog][QtGui][Text] Added QTextOption::ShowDocumentTerminator
flag.

Task-number: QTBUG-52048
Change-Id: I2f6f7e5c9c894f46525682f2c6520a7003fa09bc
Reviewed-by: Oswald Buddenhagen <oswald.buddenhagen@theqtcompany.com>
Reviewed-by: Simon Hausmann <simon.hausmann@theqtcompany.com>
2016-04-08 12:30:42 +00:00
Eskil Abrahamsen Blomfeldt
24914b1acb Qt Quick: Fix bug for selections with line wraps and breaks
This fixes yet another bug where the selection spans both line
wraps and explicit line breaks. Offsetting the log clusters by
the text position in 342c909b34
was not entirely correct, because in some cases the script
item will refer to a specific part of the string, as indicated
by si.position, while iterator.itemStart is in the context
of the full string.

In this case, the log cluster array pointer we use refers to the
script item's part of the array, i.e. it is already offset by
si.position. Therefore, we must offset the logClusters pointer by the
text position *relative* to the current script item. Previously
we would actually offset by si.position twice in cases where
si.position != 0.

We want the text range to refer to the full string, though,
so it can be compared to other text ranges later. However,
in some cases when we are requesting only part of a script item,
then iterator.itemStart does not correspond to relativeFrom,
so in order for the text range search to work, we must pass in
the text positions we are using [relativeFrom, relativeTo],
though offset by si.position so that it refers to the full
string and not just the part addressed by the script item.

Task-number: QTBUG-51759
Change-Id: Ib69856d6d3bc1dd501db94c9d295623f436d122c
Reviewed-by: Konstantin Ritt <ritt.ks@gmail.com>
Reviewed-by: Simon Hausmann <simon.hausmann@theqtcompany.com>
2016-04-08 09:44:06 +00:00
Liang Qi
f285687584 Merge remote-tracking branch 'origin/5.7' into dev
Conflicts:
	examples/corelib/ipc/ipc.pro
	src/plugins/platforms/xcb/qxcbbackingstore.cpp
	tests/auto/corelib/tools/qcommandlineparser/tst_qcommandlineparser.cpp

Change-Id: Ia006e10ff1732fe78f90138c41f05b59b49486cf
2016-04-05 14:22:45 +02:00
Liang Qi
216f57ef86 Merge remote-tracking branch 'origin/5.6' into 5.7
Change-Id: I35ca979395620e104e50b06366d0869433a4ffc2
2016-04-04 08:59:18 +02:00
Eskil Abrahamsen Blomfeldt
05ed495191 Fix possible out-of-bounds access when making distance fields
While extremely unlikely, there is a theoretical possibility that
the '0' glyph of a given font will have a width or height of 1 pixel,
in which case the (x + 1) / 2 way of getting the center would give us
an out of bounds pixel. We just default to true in this case, since
we cannot make any assumption based on the 0 glyph if it doesn't make
any sense. If the image is invalid, we default to false.

Change-Id: I36cea0b80c9d55aa10eb65db44d1b7ec8a40fc8c
Reviewed-by: Yoann Lopes <yoann.lopes@theqtcompany.com>
2016-03-31 12:53:26 +00:00
Alexander Volkov
adc4e000fc QFontEngineFT: Apply hinting for non-scaled rotated glyphs
Scaled hinted glyphs looks ugly, see QTBUG-24846. It was fixed
in 6da6845f07 by disabling hinting
for them. But at the same time that commit also disabled hinting
for glyphs with the most common transformation - rotating without
scaling.

Detect this type of transformation and don't disable hinting for it.

Change-Id: I0e69a2b60e7e4bc24e9efc4fdedb984df07ad15c
Task-number: QTBUG-50574
Reviewed-by: Friedemann Kleint <Friedemann.Kleint@theqtcompany.com>
Reviewed-by: Konstantin Ritt <ritt.ks@gmail.com>
Reviewed-by: Eskil Abrahamsen Blomfeldt <eskil.abrahamsen-blomfeldt@theqtcompany.com>
2016-03-30 10:33:12 +00:00
Gabriel de Dietrich
c35795b413 QFontEngine: Add handle() function
Both QFont::handle() and QFont::freetypeFace() used to
be available in Qt 4 but were removed in Qt 5. There's
currently no API to get access to the native font handle,
which the font engine holds in a way or another.

Similar to the way it was in Qt 4, the actual handle type
depends on the font engine currently in use. The types map
as follows:

     Font Engine      Native Handle
    ------------------------------------
     DirectWrite      IDWriteFontFace *
     Freetype         FT_Face
     Mac              CTFontRef
     Win              HFONT

All other font engines return a null handle.

Change-Id: I3bea8259ac1378fd24079723aa6603bf9e74834c
Reviewed-by: Eskil Abrahamsen Blomfeldt <eskil.abrahamsen-blomfeldt@theqtcompany.com>
2016-03-29 17:37:35 +00:00
Simon Hausmann
487844fc62 Merge remote-tracking branch 'origin/5.6' into 5.7
Change-Id: I13c7ea6a74eb98606cf45702ae068101943bec6a
2016-03-24 20:37:33 +01:00
Marc Mutz
2119b86db2 QRawFont: fix UB in supportedWritingSystems()
Found by UBSan:

  src/gui/text/qrawfont.cpp:647:55: runtime error: load of misaligned address 0x000001eeed26 for type 'quint32', which requires 4 byte alignment
  src/gui/text/qrawfont.cpp:648:50: runtime error: load of misaligned address 0x000001eeed02 for type 'quint32', which requires 4 byte alignment

Fix by using the qFromBigEndian() overload that can read from
unaligned memory.

While touching the code, also disentangle the two loops so that
operations are now performed in memory order instead of inter-
leaved, use less magic numbers, and avoid a QByteArray detach.

Change-Id: I26fa39726f6fa2e957b60863fa160280cf1dc9ac
Reviewed-by: Eskil Abrahamsen Blomfeldt <eskil.abrahamsen-blomfeldt@theqtcompany.com>
Reviewed-by: Konstantin Ritt <ritt.ks@gmail.com>
2016-03-23 10:42:45 +00:00
Liang Qi
a02863234d Merge remote-tracking branch 'origin/5.7' into dev
Conflicts:
	configure
	mkspecs/common/wince/qplatformdefs.h
	src/plugins/platforms/directfb/qdirectfbbackingstore.cpp
	src/plugins/platforms/xcb/qxcbbackingstore.cpp

Change-Id: Ied4d31264a9afca9514b51a7eb1494c28712793c
2016-03-22 07:28:42 +01:00
Liang Qi
6cb8121a44 Merge remote-tracking branch 'origin/5.6' into 5.7
Conflicts:
	src/widgets/styles/qgtkstyle_p.cpp
	tests/auto/corelib/io/qtextstream/test/test.pro
	tests/auto/corelib/plugin/plugin.pro

Change-Id: I512bc1b36acf3933ed2b96c00f476ee3819c1f4b
2016-03-21 09:02:57 +01:00
Alberto Mardegan
fb6000a74f Add QAbstractTextDocumentLayout::imageAt(), formatAt()
The new imageAt() method pairs with the existing anchorAt() method, and
allows retrieving the source link of the image under the cursor.
We also expose the common logic between these two methods as an
additional formatAt() method.

[ChangeLog][QtGui][QAbstractTextDocumentLayout] Added imageAt() and
formatAt() methods, which respectively can be used to retrieve the
source link of the image under the cursor, or the QTextFormat of the
text under the cursor.

Change-Id: If09815dde91de6616edcb19c72c462dbf7abd8ef
Reviewed-by: Simon Hausmann <simon.hausmann@theqtcompany.com>
2016-03-18 19:02:13 +00:00
Dmitry Shachnev
9692534de6 QTextCursor: Use RasterOp_NotDestination composition mode for drawing the cursor
This has several advantages over the current “fill the rectangle with the
default text color” approach:

- When the background color for some block of text is black, the cursor will be
  white and visible.

- It is possible to set the cursor width to width of a character (for example
  for monospace edits), and the characters will be visible when the cursor is
  displayed.

Change-Id: I2e6303166d5d63c8dd11ec4fcf3d734cdf440e7e
Reviewed-by: Lars Knoll <lars.knoll@theqtcompany.com>
Reviewed-by: Konstantin Ritt <ritt.ks@gmail.com>
Reviewed-by: Eskil Abrahamsen Blomfeldt <eskil.abrahamsen-blomfeldt@theqtcompany.com>
2016-03-16 23:34:02 +00:00
Allan Sandfeld Jensen
f8f3f0fbd4 Correct qt_defaultDpi X/Y with just a QCoreApplication
Makes the 96DPI attribute check avoid undefined behavior by using
QCoreApplication::instance() directly, instead of calling through
qApp, which performs an invalid cast to QGuiApplication.

Change-Id: Ib86e7d2461b462a2d623f1364414f7d4d2293f22
Reviewed-by: Marc Mutz <marc.mutz@kdab.com>
2016-03-16 10:37:39 +00:00
Sérgio Martins
c4b52b42ab gui: Pass large types by const-ref
sizeof:

Operator            : 144
QTransform          : 88
QGlyphLayout        : 48
QTextFrame::Iterator: 32
QRectF              : 32
QCss::Value         : 24

(Linux/x86_64)

Change-Id: I4965bf0959683c0bc8909428fca86d66851af92c
Reviewed-by: Marc Mutz <marc.mutz@kdab.com>
Reviewed-by: Olivier Goffart (Woboq GmbH) <ogoffart@woboq.com>
2016-03-15 21:25:59 +00:00
Marc Mutz
9739cae4c8 QRawFont: fix UB (misaligned load) in fontTable()
Found by UBSan:

  qrawfont.cpp:618:60: runtime error: load of misaligned address 0x2acee92a5569 for type 'const quint32', which requires 4 byte alignment

Fix by using MAKE_TAG(), like everywhere else, instead
of a load through a type-punned and misaligned pointer.

Change-Id: I52b88ca05a57f7d8c5e5bce953384de49514079b
Reviewed-by: Konstantin Ritt <ritt.ks@gmail.com>
Reviewed-by: Lars Knoll <lars.knoll@theqtcompany.com>
2016-03-15 10:39:24 +00:00
Liang Qi
59a3ca679e Merge "Merge remote-tracking branch 'origin/5.6' into 5.7" into refs/staging/5.7 2016-03-13 19:27:21 +00:00
Anton Kudryavtsev
a3def2869d QtGui: de-duplicate calls and cache results
Change-Id: Iaf232c31d6780b49dc6a3d0faafb9717f3c36e65
Reviewed-by: Marc Mutz <marc.mutz@kdab.com>
Reviewed-by: Lars Knoll <lars.knoll@theqtcompany.com>
Reviewed-by: Olivier Goffart (Woboq GmbH) <ogoffart@woboq.com>
2016-03-13 17:00:31 +00:00
Liang Qi
50d0f57b77 Merge remote-tracking branch 'origin/5.6' into 5.7
This change partially reverts 1bfc7f68 about QT_HAS_BUILTIN define
and undef in src/corelib/tools/qsimd_p.h.

This change is also squashed with "Fall back to c++11 standard
compiler flag for host builds" which is done by Peter Seiderer.

Conflicts:
	mkspecs/features/default_post.prf
	src/3rdparty/sqlite/0001-Fixing-the-SQLite3-build-for-WEC2013-again.patch
	src/3rdparty/sqlite/sqlite3.c
	src/corelib/tools/qsimd_p.h
	src/gui/kernel/qevent.cpp
	src/gui/kernel/qwindowsysteminterface.cpp
	src/gui/kernel/qwindowsysteminterface_p.h
	src/plugins/bearer/blackberry/blackberry.pro
	src/plugins/platforms/cocoa/qcocoasystemsettings.mm
	src/plugins/platformthemes/gtk2/gtk2.pro
	src/plugins/styles/bb10style/bb10style.pro
	src/sql/drivers/sqlite2/qsql_sqlite2.cpp
	tools/configure/configureapp.cpp

Task-number: QTBUG-51644
Done-with: Peter Seiderer <ps.report@gmx.net>
Change-Id: I6100d6ace31b2e8d41a95f0b5d5ebf8f1fd88b44
2016-03-11 20:08:50 +01:00
Aram So
a7fc1cef91 Add environment variable QT_DISTANCEFIELD
DistanceField technique was not intended for rendering very large glyph.
In some case need the qEnvironmentVariable.

Change-Id: Ied11ed00f0c67bae3c92155e17721d8d2f224cca
Task-number: QTBUG-51714
Reviewed-by: Aram So <aram.so@lge.com>
Reviewed-by: Yoann Lopes <yoann.lopes@theqtcompany.com>
2016-03-11 10:44:19 +00:00
Konstantin Ritt
229c519785 Increase chances of finding the ellipsis glyph in elided text
The glyph for the ellipsis could be absent in the main font, so we should
try to find it in a fallback font; otherwise fall back to "...".

Change-Id: Ic53060ed42f3c800aba055d2be2a1c7c3cfeec64
Reviewed-by: Eskil Abrahamsen Blomfeldt <eskil.abrahamsen-blomfeldt@theqtcompany.com>
2016-03-07 14:05:04 +00:00
Marc Mutz
ec29c76e18 Fix UB in QFontEngineFT::loadGlyph()
Reported by UBSan:

   src/gui/text/qfontengine_ft.cpp:1079:54: runtime error: null pointer passed as argument 1, which is declared to never be null

The default-constructed QScopedArrayPointer is not
reset() in every code path. In fact, in the code
path leading to this memset, the only reset() call
is in the if block right above it, so move the
memset into the if block.

Change-Id: I1f793c313ca56f3315c6bdd55456cb025cafc089
Reviewed-by: Konstantin Ritt <ritt.ks@gmail.com>
2016-03-05 12:02:47 +00:00
Marc Mutz
7d2c7ca8fa QFontEngine: use RAII for font_, face_ members
Wrap the pairs of (void *ptr, void (*dtor)(void*)) in essentially
a std::unique_ptr. This simplifies code and provides the correct
implicit destruction, so we can drop the explicit glyph-cache
clear()ing in ~QFontEngine(), leaving that job to ~QLinkedList.
A subsequent change will turn the QLinkedList into a C array, the
clearing of which would otherwise cause excessive code bloat.

Since we can't use std::unique_ptr, yet, provide a hand-rolled
replacement for now, marking it for replacement with unique_ptr
once we can use it. Make that a local type instead of providing
a Qt-wide unique_ptr so we don't accidentally lock ourselves into
a half-baked std clone we can't get rid of anymore.

To prepare unique_ptr use with the same type-erased deleter
(function pointer) as now, replace a nullptr destroy_function
with a no-op function, so ~unique_ptr doesn't crash when we
port to it later.

Because QFreetypeFace contains the same construct and shares
payloads with QFontEngine, use the Holder there, too.

Even saves 150b in text size on optimized GCC 5.3 AMD64 builds.

Change-Id: I5ca11a3e6e1ff9e06199124403d96e1b280f3eb2
Reviewed-by: Konstantin Ritt <ritt.ks@gmail.com>
Reviewed-by: Lars Knoll <lars.knoll@theqtcompany.com>
2016-03-04 10:37:25 +00:00
Marc Mutz
600529e07a QtGui: use printf-style qWarning/qDebug where possible (I)
The printf-style version of QDebug expands to a lot less code than the
std::ostream-style version. Of course, you pay in type safety (but
compilers warn about it these days), you cannot stream complex Qt
types and streaming QStrings is awkward, but in many cases you
actually improve on readability.

But the main reason is that something that's not supposed to be
executed under normal operation has no business bloating executable
code size.

This is not an attempt at converting all qWarnings() to printf-style,
only the low-hanging fruit.

In this first part, replace
   qWarning() << "...";
with
   qWarning("...");

In QTransform shared warning strings.

Saves 3KiB in text size on optimized GCC 5.3 AMD64 builds.

Change-Id: I142a8020eaab043d78465178192f2c8c6d1cc4f9
Reviewed-by: Friedemann Kleint <Friedemann.Kleint@theqtcompany.com>
Reviewed-by: Kai Koehne <kai.koehne@theqtcompany.com>
2016-03-04 10:29:08 +00:00
Marc Mutz
53abb8267b QtGui: mark some more types as movable/primitive
These are already held in QVectors.

Public API types need to wait until Qt 6, for BC reasons. Even
though Q_RELOCATABLE_TYPE deals with most of them, we lack a way
to mark a type as primitive, but still isStatic - for QList.

Change-Id: I91392b01ae6f94cc847007636e12d4e64c43b2bc
Reviewed-by: Jędrzej Nowacki <jedrzej.nowacki@theqtcompany.com>
2016-03-03 16:22:27 +00:00
Dan Cape
36ecf2c025 Fix QTextEdit/QQuickTextEdit undo bug - Part #2
If a user selected the text "foo" and typed "bar", upon pressing undo,
the text would change to "b". This is incorrect and does not match the
functionality of QLineEdit or the default behaviours of Windows/OSX/Ubuntu.
This was fixed by a change made to always merge two sequential inserts
if they are not part of the same block. Previously the selection delete
and the "b" were part of one edit block and "ar" was part of another.
With this change, the selection delete and "bar" are part of the same
edit block.

Unit test changes are part of a separate review (Part #1) since they
required changes in qtdeclarative.

[ChangeLog][QtGui][Important Behavior Changes] Fixed QTextEdit to match
undo functionality of QLineEdit to group two sequential inserts into one
undo action.

Task-number: QTBUG-38825
Change-Id: I76bf30e331e3526277c3e0ade58cf95b611fc117
Reviewed-by: Eskil Abrahamsen Blomfeldt <eskil.abrahamsen-blomfeldt@theqtcompany.com>
2016-03-02 16:00:02 +00:00
Marc Mutz
a7885c9756 QVector: preserve capacity in clear()
This is what std::vector implementations usually do,
because it minimizes memory fragmentation and useless
allocations since no user will call clear() unless
she intends to append new data afterwards.

Fix calls to resize(0) that show how existing code
tried to work around the issue.

Adjust test. Port from QVERIFY(==) to QCOMPARE as a
drive-by.

[ChangeLog][QtCore][QVector] clear() now preserves
capacity. To shed capacity, call squeeze() or swap
with a default-constructed QVector object, see the
documentation for an example.

Change-Id: I9cebe611a97e027a89e821e64408a4741b31f1f6
Reviewed-by: Lars Knoll <lars.knoll@theqtcompany.com>
2016-02-29 07:57:47 +00:00
Anton Kudryavtsev
97965a0908 QtGui: use reserve to optimize memory allocation.
Change-Id: I34a571b67840557de19ab496cadebd698c7f4f6a
Reviewed-by: Marc Mutz <marc.mutz@kdab.com>
2016-02-25 04:56:31 +00:00
Liang Qi
1fadc7292b Merge remote-tracking branch 'origin/5.6' into 5.7
Conflicts:
	src/android/jar/src/org/qtproject/qt5/android/QtActivityDelegate.java
	src/plugins/platforms/windows/qwindowsfontengine.cpp
	src/plugins/platforms/windows/qwindowsnativeimage.cpp
	tests/auto/gui/kernel/qwindow/BLACKLIST
	tests/auto/gui/kernel/qwindow/tst_qwindow.cpp

Change-Id: I649b32b260ce0ed2d6a5089021daa0d6a8db85f7
2016-02-24 13:31:14 +01:00
Eskil Abrahamsen Blomfeldt
63b5f5cb98 Disable ligatures using existing mechanism in HB, not workaround
This is a partial revert of fef629cd91.
When doing the original fix, I didn't realize that there was a
mechanism for disabling specific OpenType features in Harfbuzz.

This commit reverts the hack to disable GSUB completely and disables
the ligature features instead.

Task-number: QTBUG-44393
Change-Id: I30f0080eb3897f37219df7f2d50843f3a4556e13
Reviewed-by: Konstantin Ritt <ritt.ks@gmail.com>
2016-02-24 09:01:29 +00:00
Friedemann Kleint
8ce7441892 QFontEngineFT: Fix Clang warning about using uninitialized variables.
gui/text/qfontengine_ft.cpp(1743,5) :  warning: variable 'bytesPerLine' is used uninitialized whenever switch default is taken [-Wsometimes-uninitialized]
gui/text/qfontengine_ft.cpp(1743,5) :  warning: variable 'format' is used uninitialized whenever switch default is taken [-Wsometimes-uninitialized]

The default branch is marked Q_UNREACHABLE, but apparently Clang does
not recognize it.

Task-number: QTBUG-50804
Change-Id: Idfce8cb2b9a481dd67a18d9952b920ad4f71e0f4
Reviewed-by: Konstantin Ritt <ritt.ks@gmail.com>
2016-02-21 20:04:14 +00:00
Eskil Abrahamsen Blomfeldt
342c909b34 Qt Quick: Fix selection when mixing line breaks and line wraps
The enabler for finding selection ranges in Qt Quick had two bugs
which caused some selected text to disappear. Specifically, this
was the case for selected text where a line contained both an
explicit break and a break due to line wrapping.

First of all, the glyphsEnd that is passed into glyphRunsWithInfo()
is expected to be inclusive, since we are actually searching for
its index in the log cluster array. We would in certain cases
not find the glyph at all in the log clusters, thus the glyph
run would be set to overlap with any glyph run coming after it
in the same item.

Second of all, we need to start searching at the correct position
in the log clusters when searching for the correct rangeStart,
since rangeStart is initialized with textPosition. Otherwise, we
would in some cases never reach the start of the range, and
rangeStart would be set to textPosition + textLength, which is the
end of the range.

Task-number: QTBUG-49596
Change-Id: I436ba3f1c7414d4f5044d9b70aa04c60b01755e4
Reviewed-by: Simon Hausmann <simon.hausmann@theqtcompany.com>
2016-02-19 10:47:57 +00:00
Eskil Abrahamsen Blomfeldt
fef629cd91 Disable unneeded ligatures when letter spacing is set
For writing systems where glyph substitutions are purely
cosmetic, we should disable them when letter spacing is set,
otherwise we get ligatures where the spacing is not applied.

To avoid changing Harfbuzz-NG upstream, we detect this
case when fetching the GSUB table and return an empty
blob instead.

Task-number: QTBUG-44393
Change-Id: Ie5f6b2d795d7fecbba0ece3941fb70ba7f04c395
Reviewed-by: Lars Knoll <lars.knoll@theqtcompany.com>
Reviewed-by: Simon Hausmann <simon.hausmann@theqtcompany.com>
2016-02-19 10:47:54 +00:00
Liang Qi
4fe2fbcf82 Merge remote-tracking branch 'origin/5.6' into 5.7
This also reverts commit 018e670a26.

The change was introduced in 5.6. After the refactoring, 14960f52,
in 5.7 branch and a merge, it is not needed any more.

Conflicts:
	.qmake.conf
	src/corelib/io/qstandardpaths_mac.mm
	src/corelib/tools/qsharedpointer_impl.h
	tests/auto/widgets/itemviews/qlistview/tst_qlistview.cpp

Change-Id: If4fdff0ebf2b9b5df9f9db93ea0022d5ee3da2a4
2016-02-18 20:50:35 +01:00
Samuel Gaist
58141642b6 Doc: Fixed Qt::TextWordBreak to Qt::TextWordWrap
Change-Id: I0c50eab22c7ffaa7f39111b37979b92fd5c7f35f
Reviewed-by: Sze Howe Koh <szehowe.koh@gmail.com>
2016-02-15 14:22:29 +00:00
Liang Qi
80bf4bfe3d Merge remote-tracking branch 'origin/5.6.0' into 5.6
Change-Id: I0b190005377a23a91da3563428e223b8a3b18333
2016-02-15 08:09:50 +01:00
Friedemann Kleint
ac8a3b948d QtGui: Use QImage::constBits()/constScanLine() in non-const contexts.
Prevent potential detaching by using constBits()/constScanLine() instead
of bits()/scanLine().

Change-Id: If03f8d4d3b8ed4c07aed5eff7f580e57ca771919
Reviewed-by: Gunnar Sletta <gunnar@sletta.org>
Reviewed-by: Marc Mutz <marc.mutz@kdab.com>
2016-02-13 08:17:00 +00:00
Andre Somers
0df5c366e5 Use QFlags::setFlag where prudent in qtbase
QFlags::setFlag is most useful to replace explicit constructs like

if (condition) {
   someFlags |= TheConditionFlag;
} else {
   someFlags &= ~TheConditionFlag;
}

with

someFlags.setFlag(TheConditionFlag, condition);

Change-Id: Ie4586681c83e0af812d5bbf14965aad51941a960
Reviewed-by: Marc Mutz <marc.mutz@kdab.com>
2016-02-12 19:32:05 +00:00
Marc Mutz
7f48655fb8 QTextFrame::iterator: restore nothrow move special members
The user-defined copy assignment and copy constructors
inhibit the move special member functions.

We cannot do something about it in Qt 5, because the
class is exported (which it shouldn't be), and because
making it trivially-copyable might change how it is
passed to functions by value, so we need to supply all
the missing member functions manually.

Change-Id: Ic710b449f6abd386449fa6df71e8bc9bd0f98d2b
Reviewed-by: Lars Knoll <lars.knoll@theqtcompany.com>
2016-02-12 18:29:54 +00:00
Marc Mutz
10742cf894 QtGui: eradicate Q_FOREACH loops [const-& returns]
... by replacing them with C++11 range-for loops.

The function QObject::children() returns by const-reference,
so they can be passed to range-for without further changes.

Change-Id: I8cd2921165c45020914dd3a23b1f18b519fe7900
Reviewed-by: Gunnar Sletta <gunnar@sletta.org>
Reviewed-by: Lars Knoll <lars.knoll@theqtcompany.com>
2016-02-11 23:18:44 +00:00
Marc Mutz
37a933c2b1 QtGui: eradicate Q_FOREACH loops [needing qAsConst()]
... by replacing them with C++11 range-for loops.
To avoid detaches of these mutable Qt containers,
wrap the container in qAsConst().

Change-Id: I90fd517ad542ef92034403c15ebb8300a56ac693
Reviewed-by: Lars Knoll <lars.knoll@theqtcompany.com>
Reviewed-by: Gunnar Sletta <gunnar@sletta.org>
2016-02-11 23:18:39 +00:00
Marc Mutz
d09cfe04b8 QtGui: eradicate Q_FOREACH loops [already const]
(or trivially marked const) ... by replacing them
with C++11 range-for loops.

Change-Id: I3cce92b9d77a3ff96fad877d1d989145e530646f
Reviewed-by: Olivier Goffart (Woboq GmbH) <ogoffart@woboq.com>
Reviewed-by: Lars Knoll <lars.knoll@theqtcompany.com>
2016-02-11 23:18:35 +00:00
Marc Mutz
3ff5251740 QtGui: eradicate Q_FOREACH loops [QVarLengthArray]
Q_FOREACH over a QVarLengthArray is a partcularly
bad idea.

Use C++11 range-for (without qAsConst(), because
QVLA isn't CoW).

Change-Id: I5ee55557577f183151d3871e4518382c4adf0237
Reviewed-by: Olivier Goffart (Woboq GmbH) <ogoffart@woboq.com>
Reviewed-by: Gunnar Sletta <gunnar@sletta.org>
Reviewed-by: Lars Knoll <lars.knoll@theqtcompany.com>
2016-02-11 19:25:38 +00:00
Liang Qi
d456f87ece Merge remote-tracking branch 'origin/5.6' into dev
Conflicts:
	src/corelib/io/qfilesystemwatcher_win.cpp
	src/corelib/plugin/plugin.pri
	src/plugins/platforms/cocoa/qcocoaaccessibility.mm
	tests/auto/corelib/tools/qlocale/tst_qlocale.cpp

Change-Id: Id6824631252609a75eff8b68792e4d10095c8fc1
2016-02-11 08:25:04 +01:00
Aleix Pol
8b4ac65e29 Provide QCss with the correct font for <pre> blocks
Labels would use a statically defined font for <pre> blocks.
Use the one defined by the QPlatformTheme instead, through
QFontDatabase::systemFont(FixedFont)

Task-number: QTBUG-50564
Change-Id: I5491bd0defce651bdf809bcbc6a529a900f4959b
Reviewed-by: Milian Wolff <milian.wolff@kdab.com>
2016-02-09 21:24:46 +00:00
Marc Mutz
b034a14dc5 Replace some QList<int> with QVector<int>
On 64-bit platforms, QVector<int> uses only 50% of QList<int>
per-element memory.

Change-Id: I3057781e7fb58007ea2619cc91965a626d01473b
Reviewed-by: Olivier Goffart (Woboq GmbH) <ogoffart@woboq.com>
Reviewed-by: Lars Knoll <lars.knoll@theqtcompany.com>
2016-02-08 19:58:01 +00:00
Sérgio Martins
01859cc121 Reduce allocations by using reserve()
Change-Id: If34fa53402985f6b3c5e7217bce4a1177af835b6
Reviewed-by: Marc Mutz <marc.mutz@kdab.com>
2016-02-07 16:50:26 +00:00
Liang Qi
d3e6e732c7 Merge remote-tracking branch 'origin/5.6' into dev
Conflicts:
	config.tests/unix/compile.test
	src/plugins/platforms/cocoa/qcocoahelpers.mm
	src/tools/qlalr/cppgenerator.cpp

Change-Id: I0103ca076a9aca7118b2fd99f0fdaf81055998c3
2016-02-02 15:57:44 +01:00
Oswald Buddenhagen
615534f14c Merge 5.6 into 5.6.0
Change-Id: I95962e28b6fc101cbbad41230585e2b61f1f6c0f
2016-02-02 13:12:21 +01:00
Eskil Abrahamsen Blomfeldt
dce530b64e Fix bounding rect of glyph runs in multi-line QTextLayout
When getting the glyph runs from a QTextLayout with multiple
lines, the glyph runs would be merged if possible, but not their
bounding rects. This was an oversight.

[ChangeLog][Text][QTextLayout] QTextLayout::glyphRuns() now returns
united bounding rects for glyph runs that are merged.

Change-Id: Ibbeaa99ecfc4e82e7965342efdae7c3c2b637343
Task-number: QTBUG-50715
Reviewed-by: Konstantin Ritt <ritt.ks@gmail.com>
Reviewed-by: Lars Knoll <lars.knoll@theqtcompany.com>
2016-01-30 06:53:44 +00:00
Konstantin Ritt
3e5719ae7b QFont: Fix possible cache misses due to misprepared cache key
Parse the requested family before we're looking/saving into the cache,
thus hitting the cached EngineData for:
* quoted family names (eg. QFont("'Arial'"))
* non-simplified family names (eg. QFont(" Arial  "))
* substituted family names (\sa QFont::insertSubstitution())
* explicit fallback list, where possible (eg. QFont("Tahoma, Arial"))

This also improves the cache hitting for the font engines in some cases.

Change-Id: I18cdc3e8d669cccec961f84e9b27329402e2b7ed
Reviewed-by: Eskil Abrahamsen Blomfeldt <eskil.abrahamsen-blomfeldt@theqtcompany.com>
2016-01-29 11:24:49 +00:00
hjk
3f482fad3c Revert some changes to QTextCursor constructors
This partially reverts the source and binary incompatible parts of change
d921a9bd15 that made public members in an
exported class private and changed signature in one case.

Task-number: QTBUG-50703
Change-Id: I2719f276256206347d3c27d80a16db34a4ea2888
Reviewed-by: Lars Knoll <lars.knoll@theqtcompany.com>
2016-01-28 18:42:14 +00:00
Konstantin Ritt
5f472cae71 QFontCache: Centralize the engine type safety check
We depend on the assumption QFontCache::findEngine(key) for key.multi=1
returns a font engine of type QFontEngine::Multi;
guarantee that by checking it in a single place.

Change-Id: I287da4fd62deb22fc5520cde5b0505bc44547609
Reviewed-by: Eskil Abrahamsen Blomfeldt <eskil.abrahamsen-blomfeldt@theqtcompany.com>
2016-01-28 18:24:08 +00:00
Konstantin Ritt
c195fde37a QFont*: Optimize by caching the QFontCache::instance() result
The QFontCache instance is stored in QThreadStorage and thus calling
QFontCache::instance() isn't really cheap; avoid calling it multiple
times where possible.

Change-Id: I1b7a83089698a06c49dac08b2a3a8e9c3c75a500
Reviewed-by: Friedemann Kleint <Friedemann.Kleint@theqtcompany.com>
Reviewed-by: Eskil Abrahamsen Blomfeldt <eskil.abrahamsen-blomfeldt@theqtcompany.com>
2016-01-26 22:39:45 +00:00
Liang Qi
a15c3d086d Merge remote-tracking branch 'origin/5.6' into dev
Conflicts:
	src/android/jar/src/org/qtproject/qt5/android/QtActivityDelegate.java
	src/dbus/qdbusconnection_p.h
	src/dbus/qdbusintegrator.cpp
	src/dbus/qdbusintegrator_p.h
	tests/auto/corelib/io/qdir/qdir.pro
	tests/auto/corelib/io/qiodevice/tst_qiodevice.cpp

Change-Id: I3d3fd07aed015c74b1f545f1327aa73d5f365fcc
2016-01-26 16:27:28 +01:00
Eskil Abrahamsen Blomfeldt
a67a905190 Fix artihmetic exception when using non-scalable fonts
For non-scalable fonts, the units_per_EM in FreeType is
documented to be undefined and will default to 0, which means
that any division by it will cause an exception.

The emSquareSize() function already checks if the font is scalable
and returns y_ppem if not, so lets use it instead in all locations
where we're not already sure the font is scalable.

[ChangeLog][Text][Freetype] Fixed a divide-by-zero exception
when accessing bitmap fonts.

Change-Id: I8839d4c83047fb3f6bb4d69af0258e94a258a4d9
Task-number: QTBUG-45963
Reviewed-by: Konstantin Ritt <ritt.ks@gmail.com>
2016-01-26 14:14:34 +00:00
Konstantin Ritt
c3b261f3f0 Deduplicate and clarify the code a bit
Makes it clear that the engine for font with no Latin WS support
won't be cached as "shared" engine and thus shouldn't be normally
expected in the cache, so don't even try to find it there.

Change-Id: I9e6275b4919607f4057a193b446825c98932bd23
Reviewed-by: Eskil Abrahamsen Blomfeldt <eskil.abrahamsen-blomfeldt@theqtcompany.com>
2016-01-26 14:13:39 +00:00
Konstantin Ritt
f5e02d4128 Avoid needless string comparison
by inlining and reordering the condition.

Change-Id: I68a91e75071975a4cc26333094db3433afbaeb72
Reviewed-by: Eskil Abrahamsen Blomfeldt <eskil.abrahamsen-blomfeldt@theqtcompany.com>
2016-01-26 14:13:36 +00:00
Thiago Macieira
d921a9bd15 Hide better the private API QTextCursor constructors
Both constructors were taking a pointer, so they participated in
overload resolution along with QTextDocument and QTextFrame pointers.

Instead, make them take references and move them to the private section
of QTextCursor. That necessitated adding a method to QTextCursorPrivate
to access that private constructor from non-friend classes.

Change-Id: I7e6338336dd6468ead24ffff1410e3bc534d77dd
Reviewed-by: Konstantin Ritt <ritt.ks@gmail.com>
2016-01-22 03:36:16 +00:00
Liang Qi
158a3a4159 Merge remote-tracking branch 'origin/5.6' into dev
Conflicts:
	src/corelib/io/qiodevice_p.h
	src/corelib/kernel/qvariant_p.h
	src/corelib/tools/qsimd.cpp
	src/gui/kernel/qguiapplication.cpp
	tests/auto/network/socket/qtcpsocket/tst_qtcpsocket.cpp

Change-Id: I742a093cbb231b282b43e463ec67173e0d29f57a
2016-01-21 08:17:21 +01:00
Friedemann Kleint
acb2e873f0 QtPlatformSupport: Remove virtual from declarations with override.
Change-Id: If94207596411680dfc2dbe33f298dc48fd5b7cc0
Reviewed-by: Konstantin Ritt <ritt.ks@gmail.com>
Reviewed-by: Marc Mutz <marc.mutz@kdab.com>
2016-01-21 07:17:18 +00:00
Liang Qi
8f569c740a Merge remote-tracking branch 'origin/5.5' into 5.6
Conflicts:
	config.tests/common/atomic64/atomic64.cpp
	configure
	src/3rdparty/forkfd/forkfd.c
	src/corelib/io/forkfd_qt.cpp
	src/widgets/kernel/qwidgetwindow.cpp
	tests/auto/corelib/statemachine/qstatemachine/tst_qstatemachine.cpp
	tests/auto/network/socket/qtcpsocket/tst_qtcpsocket.cpp
	tests/auto/widgets/widgets/qcombobox/tst_qcombobox.cpp
	tools/configure/configureapp.cpp

Change-Id: Ic6168d82e51a0ef1862c3a63bee6722e8f138414
2016-01-19 10:03:01 +01:00
Allan Sandfeld Jensen
8fd75739ef Lock qfontdatabase mutex in qt_fallbacksForFamily
When called from outside of qfontdatabase, the qfontdatabase mutex will
not be locked upon entry to qt_fallbacksForFamily, so we need to add
it to the exported version.

Change-Id: I16a21708d7cca15730c12de3dbeeaab13ffbd315
Reviewed-by: Konstantin Ritt <ritt.ks@gmail.com>
Reviewed-by: Oswald Buddenhagen <oswald.buddenhagen@theqtcompany.com>
Reviewed-by: Eskil Abrahamsen Blomfeldt <eskil.abrahamsen-blomfeldt@theqtcompany.com>
2016-01-15 19:22:45 +00:00
Jani Heikkinen
1a88b2f768 Updated license headers
From Qt 5.7 -> LGPL v2.1 isn't an option anymore, see
http://blog.qt.io/blog/2016/01/13/new-agreement-with-the-kde-free-qt-foundation/

Updated license headers to use new LGPL header instead of LGPL21 one
(in those files which will be under LGPL v3)

Change-Id: I046ec3e47b1876cd7b4b0353a576b352e3a946d9
Reviewed-by: Lars Knoll <lars.knoll@theqtcompany.com>
2016-01-15 12:25:24 +00:00
Marc Mutz
68e915c623 QStaticTextItem: use smart pointer members
... so we can drop the user-defined copy special member
functions and the destructor.

As a side-effect, enables the move special member functions,
which were previously inhibited by the presence of the
now-removed functions, and makes the copy constructor safe
for self-assignment.

Change-Id: I430f83a6a08b1f5ee94b52f52e4d80fa1139d1c1
Reviewed-by: Olivier Goffart (Woboq GmbH) <ogoffart@woboq.com>
2016-01-12 22:01:28 +00:00
Anton Kudryavtsev
2ccacfb5c9 QSyntaxHighlighterPrivate: use erase and std::remove_if with QVector
... instead of using erase in a loop, with quadratic complexity.

Change-Id: If30c6c99a775aec07eef9ddf953e944dc916b5a2
Reviewed-by: Lars Knoll <lars.knoll@theqtcompany.com>
Reviewed-by: Marc Mutz <marc.mutz@kdab.com>
2016-01-11 09:33:40 +00:00
Frederik Gladhorn
ad16478a76 Merge remote-tracking branch 'origin/5.6' into dev
Based on merge done by Liang Qi

Change-Id: Id566e5b9f284d29bff2199f13f9417c660f5b26f
2016-01-08 12:35:24 +01:00
Frank Meerkoetter
64857434e2 Fix broken permission to mode mapping
Fixes coverity CID154258.

Change-Id: Ia958d24c533c4f0077abd363ee4c041cc2cdb6f0
Reviewed-by: Konstantin Ritt <ritt.ks@gmail.com>
2015-12-19 15:03:55 +00:00
Marc Mutz
66441d7a82 Make use of new QHash::erase(const_iterator) overload
Drive-by changes:
- use auto for iterators
- add Q_UNLIKELY for conditions leading to a qWarning etc

Change-Id: Iff8f36d67c96674d354a501b26640f73c15ce58d
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
Reviewed-by: Sérgio Martins <iamsergio@gmail.com>
2015-12-19 07:41:50 +00:00
Liang Qi
beb65dcd79 Merge remote-tracking branch 'origin/5.6' into dev
Conflicts:
	src/gui/painting/painting.pri
	src/plugins/platforms/xcb/qxcbconnection.cpp
	tests/auto/corelib/thread/qthreadstorage/qthreadstorage.pro
	tests/auto/corelib/tools/qlocale/test/test.pro
	tests/auto/gui/kernel/qwindow/tst_qwindow.cpp
	tools/configure/environment.cpp

Change-Id: I9c40f458b89b2c206de2d2c24e90b5f679c93495
2015-12-18 08:37:31 +01:00
Andy Shaw
a88da6377d The cache_cost is measured in bytes and not kilobytes.
When increaseCost() is called then it will convert from bytes to kilobytes
so we need to specify the cache_cost to be in bytes.

Task-number: QTBUG-47812
Change-Id: I842514c9ab4d86b60b2beb6c80979156ea0de59c
Reviewed-by: Eskil Abrahamsen Blomfeldt <eskil.abrahamsen-blomfeldt@theqtcompany.com>
2015-12-16 13:15:12 +00:00
Andy Shaw
e109b8a0f3 Decrease the cache if necessary when adding a new font
It was possible for the cache to increase too quickly since it was
relying on the timer to decrease which caused problems with FreeType.
So by checking if it will be increased to be over the limit first before
adding the new font, we can decrease it earlier in preparation.

Task-number: QTBUG-47812
Task-number: QTBUG-49535
Change-Id: Iedc042d8903949140aa8c5257a9d54cde31a51be
Reviewed-by: Eskil Abrahamsen Blomfeldt <eskil.abrahamsen-blomfeldt@theqtcompany.com>
2015-12-16 13:13:02 +00:00
Konstantin Ritt
e664251a77 Cache font fallback families to reduce startup time
Change-Id: I593708d76d513028ba1b59621b83cbc32e63d4e6
Reviewed-by: Lars Knoll <lars.knoll@theqtcompany.com>
2015-12-16 12:46:06 +00:00
Konstantin Ritt
b8189ddd80 Use the cached font fallback families list in QFont::defaultFamily()
Change-Id: Iba1d9db05f7a09aabb81d0429e6081cd7710d381
Reviewed-by: Marc Mutz <marc.mutz@kdab.com>
Reviewed-by: Lars Knoll <lars.knoll@theqtcompany.com>
2015-12-15 12:06:06 +00:00
Simon Hausmann
3ec31ef9c5 Merge remote-tracking branch 'origin/5.6' into dev
Change-Id: I2532c7f7db5e6cc3ef09753d886279816dd662b2
2015-12-08 07:09:47 +01:00
Rolland Dudemaine
012e4b81fa Give names to enum used in templates.
The GHS toolchain needs names for enumerations that are used for
template instantiation.

Change-Id: I4e184cd77074fd7ece89f21317536e6006ab257d
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
2015-12-04 00:52:12 +00:00
Nico Vertriest
ed59376239 Doc: Clarified QTextTable::mergeCells() documentation
Task-number: QTBUG-37928
Change-Id: I8d3ae3b540f9483d1e93d4c8135f777dea13f967
Reviewed-by: Topi Reiniö <topi.reinio@theqtcompany.com>
2015-12-03 15:16:57 +00:00
Friedemann Kleint
d508c6697b Freetype font engine: Restrict bold depending on OS2 weight class.
Limit setting bold to weights <=750.

Task-number: QTBUG-48922
Change-Id: Id38b636698e58b0686dda9711ee1b3426a3b45b9
Reviewed-by: Gunnar Roth <gunnar.roth@gmx.net>
Reviewed-by: Eskil Abrahamsen Blomfeldt <eskil.abrahamsen-blomfeldt@theqtcompany.com>
2015-12-03 15:03:33 +00:00
Liang Qi
72f5867f14 Merge remote-tracking branch 'origin/5.6' into dev
Conflicts:
	src/corelib/kernel/qcoreapplication.cpp
	src/corelib/kernel/qeventdispatcher_blackberry.cpp
	src/network/bearer/qnetworkconfiguration.cpp
	src/plugins/bearer/blackberry/qbbengine.cpp
	src/plugins/platforms/android/androidjnimain.cpp
	src/plugins/platforms/android/qandroidplatformtheme.cpp
	src/plugins/platforms/qnx/qqnxbpseventfilter.cpp
	src/plugins/platforms/qnx/qqnxfiledialoghelper_bb10.cpp
	src/plugins/platforms/qnx/qqnxinputcontext_imf.cpp
	src/plugins/platforms/qnx/qqnxintegration.cpp
	src/plugins/platforms/qnx/qqnxnavigatorbps.cpp
	src/plugins/platforms/qnx/qqnxvirtualkeyboardbps.cpp
	src/plugins/platforms/qnx/qqnxwindow.cpp
	src/widgets/kernel/qwidgetwindow.cpp
	src/widgets/styles/qwindowsvistastyle.cpp
	src/widgets/styles/qwindowsxpstyle.cpp
	src/widgets/widgets/qtoolbararealayout.cpp
	tests/auto/corelib/global/qflags/qflags.pro
	tests/auto/corelib/itemmodels/qitemmodel/modelstotest.cpp
	tests/auto/corelib/tools/qversionnumber/qversionnumber.pro
	tests/auto/widgets/dialogs/qfilesystemmodel/tst_qfilesystemmodel.cpp

Change-Id: I37be88c6c185bb85404823353e027a0a6acdbce4
2015-12-02 23:33:06 +01:00
Eskil Abrahamsen Blomfeldt
bf0af8b5a2 Round advances if subpixel position not supported
Due to kerning and other OpenType features, it's possible
that the advances from the shaping process are fractional, but
this gives uneven glyph positioning for font engines that don't
support subpixel positioning (since the glyph will not match the
expected position, some gaps will look too large and some
too small). To match how e.g. GDI renders this, we round the
advances before setting the glyph positions for engines that
do not support subpixel positions.

[ChangeLog][Windows] Fixed uneven kerning for some fonts.

Task-number: QTBUG-48546
Change-Id: Ic00dc402abf7149aab6bf9b05b42827b805c1a15
Reviewed-by: Konstantin Ritt <ritt.ks@gmail.com>
2015-12-02 18:25:45 +00:00
Ilija Ristevski
6302fb07e7 QTextOdfWriter: Added support for hyperlinks.
Hyperlink added in QTextDocument becomes "<span>" tag after exporting
the document to ODF with QTextDocumentWriter. Fixed by adding "<a>" tag
around it with attribute "href" pointing to hyperlink location.

Task-number: QTBUG-48853
Change-Id: I2bd689a88c9d0a5b14369777718b9cb36e4cfa19
Reviewed-by: Konstantin Ritt <ritt.ks@gmail.com>
Reviewed-by: Lars Knoll <lars.knoll@theqtcompany.com>
2015-11-30 02:24:32 +00:00
Marc Mutz
51089a5742 Use Q_UNLIKELY for every qFatal()/qCritical()
If, after checking a condition, we issue a qFatal()
or a qCritical(), by definition that check is
unlikely to be true.

Tell the compiler so it can move the error handling
code out of the normal code path to increase the
effective icache size.

Moved conditional code around where possible so that
we could always use Q_UNLIKELY, instead of having to
revert to Q_LIKELY here and there.

In some cases, simplified the expressions newly wrapped
in Q_UNLIKELY as a drive-by.

Change-Id: I67537d62b04bc6977d69254690c5ebbdf98bfd6d
Reviewed-by: Konstantin Ritt <ritt.ks@gmail.com>
Reviewed-by: Olivier Goffart (Woboq GmbH) <ogoffart@woboq.com>
2015-11-29 22:59:17 +00:00
Sérgio Martins
f7ab19955f Make a couple of iterators trivially-copyable in Qt 6
Change-Id: I1d1c382fa6214590b3a51d77b18c7df390f2dc70
Reviewed-by: Marc Mutz <marc.mutz@kdab.com>
2015-11-29 11:45:29 +00:00
Marc Mutz
bfdcbe8bfb QFont*: fix some const-incorrectnesses involving QFontPrivate
Detected with a modified (deep const propagating) shared data pointer.

Most are fixed by using copy constructor and assignment operator
of the shared pointer instead of feeding it .data(). The rest
required adding const locally.

Change-Id: I51e36b9e7040dc2211ef4c5dadfbda73ad22c414
Reviewed-by: Konstantin Ritt <ritt.ks@gmail.com>
Reviewed-by: Olivier Goffart (Woboq GmbH) <ogoffart@woboq.com>
2015-11-27 13:50:13 +00:00
Simon Hausmann
ea5f40a788 Merge remote-tracking branch 'origin/5.6' into dev
Change-Id: Ib43c6f126998eefcfed9a7c1f2bcbac8b4dd05ec
2015-11-27 08:27:53 +01:00
J-P Nurmi
d06d7413d5 Fix QTextLine::cursorToX()
0e99f3c broke tst_qquicktextinput::horizontalAlignment_RightToLeft()
and tst_qquicktextedit::hAlign_RightToLeft(). This fix was proposed
by Konstantin.

Change-Id: I602b7301d415f266224ae2c1ffd81244e9565862
Reviewed-by: Simon Hausmann <simon.hausmann@theqtcompany.com>
Reviewed-by: Lars Knoll <lars.knoll@theqtcompany.com>
2015-11-25 20:41:12 +00:00
Konstantin Ritt
fa00afe7d7 Optimize QTextEngine::findItem() usage cases
Since the item positions are guaranteed to grow, we could safely re-use
the obtained first item while looking for the last item in the chain.

Change-Id: I5e42f5de820c62a51a109a4b227b031c697aa898
Reviewed-by: Lars Knoll <lars.knoll@theqtcompany.com>
2015-11-23 18:52:46 +00:00
Konstantin Ritt
073a16e50e QTextLine::cursorToX: Optimize by re-using the cached values
(and move some code around)

Change-Id: I2e26dcc7b769fdbcc750332845da11ec88e332dd
Reviewed-by: Lars Knoll <lars.knoll@theqtcompany.com>
2015-11-23 18:52:43 +00:00
Konstantin Ritt
0e99f3c853 QTextLine::cursorToX: Always return the nearest valid cursor position
The documentation already states we're doing this, so stop lying
and implement it properly :)

Change-Id: Ic78980d76f61e8aa64e59ea058a8105d9c507774
Reviewed-by: Lars Knoll <lars.knoll@theqtcompany.com>
2015-11-23 18:52:40 +00:00
Liang Qi
1ed7a67a4c Merge remote-tracking branch 'origin/5.6' into dev
Conflicts:
	src/corelib/kernel/qcoreapplication.cpp
	src/corelib/thread/qthread_unix.cpp

Change-Id: Ia08d613c3f0bd08cb6dc3e3a57257207dfd4a099
2015-11-23 07:13:00 +01:00
Konstantin Ritt
6a2b17eeec QTextLine::cursorToX: Fix typo in the documentation
Change-Id: Iecdcab5145b147edbab78b08bd6c9e2dc2f18d48
Reviewed-by: Lars Knoll <lars.knoll@theqtcompany.com>
2015-11-22 21:55:50 +00:00
John Cumming
208496091d Add Section Symbol at end of text flow when showing paragraphs
Insert a section symbol (U+00A7) to the end of a text flow instead of a
space as many text layout applications do.

Task-number: QTBUG-49252
Change-Id: Ib1276b508c24824b6329e0458ae5171bc1a288c3
Reviewed-by: Simon Hausmann <simon.hausmann@theqtcompany.com>
Reviewed-by: Eskil Abrahamsen Blomfeldt <eskil.abrahamsen-blomfeldt@theqtcompany.com>
2015-11-19 11:53:30 +00:00
Liang Qi
c7934f2489 Merge remote-tracking branch 'origin/5.6' into dev
Conflicts:
	src/corelib/io/qprocess.cpp
	src/corelib/io/qprocess_unix.cpp
	src/network/kernel/qnetworkinterface_winrt.cpp
	tools/configure/configureapp.cpp

Change-Id: I47df00a01597d2e63b334b492b3b4221b29f58ea
2015-11-18 09:01:51 +01:00
Konstantin Ritt
4d5b57825a QFontEngineFT: Optimize format convertion code with template magic
Avoids in-loop check for every pixel by costs of slightly bigger code.

Change-Id: I8321d0945ac6b677786431670b2316c60e4db492
Reviewed-by: Friedemann Kleint <Friedemann.Kleint@theqtcompany.com>
Reviewed-by: Lars Knoll <lars.knoll@theqtcompany.com>
2015-11-16 14:33:51 +00:00
Konstantin Ritt
6a7155997b QFontEngineFT: Revise the legacy LCD filter implementation
Use an optimized version of the intra-pixel filter found
in FreeType's _ft_lcd_filter_legacy().
Gives us somewhat better accuracy and better performance.

Change-Id: Id4200b67e6ff55f605037c3e5464fef8bb03fbde
Reviewed-by: Friedemann Kleint <Friedemann.Kleint@theqtcompany.com>
Reviewed-by: Lars Knoll <lars.knoll@theqtcompany.com>
Reviewed-by: Eskil Abrahamsen Blomfeldt <eskil.abrahamsen-blomfeldt@theqtcompany.com>
2015-11-16 14:33:37 +00:00
Eskil Abrahamsen Blomfeldt
a856c4a902 Fix falsely reported style for fallback font
In change 8f6b328410 we override
the fontDef of the fallback font with the fontDef of the
original font (with the family name replaced) to fix a
regression where boldness was not inherited by the fallback
font.

This caused a bug, though, since the contents of the fontDef
would now misrepresent the actual font used. The side effect
of this was that isSmoothlyScalable() returned false because
the family and styleName combination we claim to have did
not exist in the font database. Result: We fell back to
native rendering for the font even though it's scalable.

Weight and style are the only parts that should be inherited,
since they are synthesized. So rather than overwriting
the fontDef completely, we copy the weight and style when
needed.

The bug in QTBUG-42963 is still fixed after this change.

[ChangeLog][Text] Fixed problem where fallback fonts for text
with certain styles would be reported as unscalable.

Change-Id: I95ef67f818852aea5a6ae8df789a52364ecb59a6
Task-number: QTBUG-47547
Reviewed-by: Lars Knoll <lars.knoll@theqtcompany.com>
Reviewed-by: Konstantin Ritt <ritt.ks@gmail.com>
2015-11-16 14:33:23 +00:00
Konstantin Ritt
26e66694fa QFontEngineFT: Minor optimization to convertGRAYToARGB()
Precalculate everything we can and use faster loop.
Make inlined as it is used just in a single place.

Change-Id: If3c33d60739eb4ce896020321442ae81edd1c13d
Reviewed-by: Friedemann Kleint <Friedemann.Kleint@theqtcompany.com>
Reviewed-by: Lars Knoll <lars.knoll@theqtcompany.com>
2015-11-13 20:43:27 +00:00
Konstantin Ritt
c1da13f6db QTextEngine: Apply CoreText specific post-processing for QFE::Mac only
These tricks has no meaning to other font engines (i.e. to FreeType).

Change-Id: I0410693d4d159367d760433062506691dc7c4610
Reviewed-by: Lars Knoll <lars.knoll@theqtcompany.com>
2015-11-13 20:43:13 +00:00
Konstantin Ritt
50af66293d QTextEngine: Do not disable graphite2 HB shaper backend
This fixes-up bf013c9e74 by specifying
graphite2 shaper in a "safe" shaper list, one used for non-CoreText
font engines (currently, FreeType font engine only).

Make the the comment and the code a bit cleaner about the fallback
shaper list.

Change-Id: Ib0cedc0b593023c9ee771e8e98c314d9c8f13037
Reviewed-by: Lars Knoll <lars.knoll@theqtcompany.com>
2015-11-13 20:43:10 +00:00
Konstantin Ritt
2316db05a8 QFontEngine: Check for AAT support only with HB-NG
HB-old is unable to handle these anyways.

Change-Id: Ibe69b5d030134b8a0a76dc966b6dfc6b5ff9a883
Reviewed-by: Lars Knoll <lars.knoll@theqtcompany.com>
2015-11-13 20:43:06 +00:00
Olivier Goffart
d6b45853f5 Make qt_findAtNxFile return the source device pixel ratio
QTextImageHandler needs it.
And QQuickImageBase will also need it.

Change-Id: Ica5d17519c4c6c06e25bab7d2b1d3733f4058425
Reviewed-by: Tor Arne Vestbø <tor.arne.vestbo@theqtcompany.com>
2015-11-13 15:05:12 +00:00
Konstantin Ritt
0e1f3aab11 Update Unicode data & algorithms up to v8.0
* Georgian lari currency symbol
* A large collection of CJK unified ideographs
* Emoji symbols and symbol modifiers
* Letters to support the Ik language in Uganda, Kulango in
  the Côte d’Ivoire, and other languages of Africa
* A set of lowercase Cherokee syllables, forming case pairs
  with the existing Cherokee characters
* The Ahom script for support of the Tai Ahom language in India
* Arabic letters to support Arwi—the Tamil language written in the Arabic script

For more details, see http://www.unicode.org/versions/Unicode8.0.0/

[ChangeLog][QtCore] Unicode data updated to v.8.0

Change-Id: If255f95c9c45655b721369a116299da3cabbba0a
Reviewed-by: Lars Knoll <lars.knoll@theqtcompany.com>
2015-11-05 08:25:02 +00:00
Liang Qi
4159ee8405 Merge remote-tracking branch 'origin/5.6' into dev
Conflicts:
	config.tests/unix/ptrsize.test
	configure
	src/corelib/global/qnamespace.h
	src/network/socket/qabstractsocket.cpp
	tests/auto/other/networkselftest/networkselftest.pro

Change-Id: Ic78abb4a34f9068567cea876861d4220f5a07672
2015-11-04 20:18:14 +01:00
Eskil Abrahamsen Blomfeldt
39e023b805 Remove historical +4 padding in QFontEngine::alphaMapForGlyph()
Back in the old days, we would pad the output from the font engines
to work around problems with the GL1 paint engine such as issues
with linear sampling, etc. This is no longer needed. Padding is
moved into the glyph cache, and in addition to reducing performance,
the extra padding is also making alphaMapForGlyph() and
alphaMapBoundingBox() fall out of sync when you fall back to
QPainterPath drawing the glyph. The result of this was that,
when prepared, the glyph cache was sometimes not made large enough
to hold what alphaMapForGlyph() actually produced, depending on
the size and order of glyphs, and glyphs ending up at the end of rows
would sometimes be missing from the output.

[ChangeLog][Text] Fixed some instances of missing glyphs when
drawing large fonts.

Change-Id: Ia5982392fe1637f6ebc740db9f226fbb91f75166
Task-number: QTBUG-47547
Reviewed-by: Gunnar Sletta <gunnar@sletta.org>
Reviewed-by: Konstantin Ritt <ritt.ks@gmail.com>
2015-10-27 09:01:47 +00:00
Eskil Abrahamsen Blomfeldt
4f4da7462b Support overlapping contours in glyph rasterizer fallback
Truetype fonts should be rasterized with a winding fill
as documented in e.g. Microsoft's specs.

Failing to do this caused a bug when doing native
rendering in Qt Quick for fonts that were large enough
that the fallback path was taken when drawing the glyphs
into the cache. If the glyph had overlapping contours,
they would be subtracted from the shape.

[ChangeLog][Text] Fixed an uncommon rendering error with
fonts containing overlapping contours.

Task-number: QTBUG-41197
Change-Id: I0e4a4432ba3f902bc3ea59d8f4dbd12a295630b2
Reviewed-by: Konstantin Ritt <ritt.ks@gmail.com>
2015-10-26 08:07:55 +00:00
Liang Qi
790aef362f Merge remote-tracking branch 'origin/5.6' into dev
Conflicts:
	.qmake.conf
	configure
	src/corelib/global/qglobal.h
	src/tools/qdoc/node.cpp
	src/tools/qdoc/qdocdatabase.cpp
	tests/auto/corelib/io/qsettings/tst_qsettings.cpp
	tools/configure/configureapp.cpp

Change-Id: I66028ae5e441a06b73ee85ba72a03a3af3e8593f
2015-10-23 14:45:03 +02:00
Morten Johan Sørvig
068a545339 Add support for "@3x" image loading.
Implement as generic "@Nx" support in an exported
qt_findAtNxFile function.

3x devices now get one extra file existence test
in cases where @3x versions are not present. 1x
devices are still on the fast path where there are
no extra file system accesses.

Add an @3x image to the highdpi manual test.

Change-Id: I4ce3fc245ada01ea410abe1443ceb1e3abf7c17f
Reviewed-by: Timur Pocheptsov <timur.pocheptsov@theqtcompany.com>
Reviewed-by: Tor Arne Vestbø <tor.arne.vestbo@theqtcompany.com>
2015-10-16 21:47:25 +00:00
Liang Qi
4456984da7 Merge remote-tracking branch 'origin/5.6' into dev
Conflicts:
	tests/auto/corelib/io/qfile/tst_qfile.cpp
	tests/auto/corelib/io/qprocess/tst_qprocess.cpp
	tests/auto/corelib/tools/qversionnumber/qversionnumber.pro

Change-Id: Ia93ce500349d96a2fbf0b4a37b73f088cc505c6e
2015-10-14 15:45:35 +02:00
Ulf Hermann
54b5287adf Insert leading after each line, not before
Task-number: QTBUG-45791
Change-Id: I763d9d1ba00989d0c6b1e0b955173dadbef26b10
Reviewed-by: Stephen Chu <stephen@ju-ju.com>
Reviewed-by: Lars Knoll <lars.knoll@theqtcompany.com>
2015-10-09 15:18:11 +00:00
Friedemann Kleint
9ff6d513e4 qevent.h: Add fixme comments to remove include directives for Qt 6.
Mark include directives in qevent.h for removal and preemptively
add missing headers in code base.

Change-Id: I81011d7bfad4a09d80deeda6d1bed67b5c0e63c2
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
2015-10-02 06:37:03 +00:00
Dan Vrátil
2a70677b64 Implement support for 'none' value for list-style CSS property
'none' is a valid value specified in CSS standard. In combination
with '-qt-list-indent: 0' it allows for using lists in Qt for better
structuring text

Change-Id: I1dd324a3ea81b26e21a9d4d9f93ef9b5edcf3e93
Task-number: QTBUG-6501
Reviewed-by: Lars Knoll <lars.knoll@theqtcompany.com>
2015-09-30 10:36:49 +00:00
Tor Arne Vestbø
9c71f55ef9 QFontEngine: Read minimum left and right glyph bearings from 'hhea' table
This table has values precomputed based on every single glyph in
the font, not just the subset we use as a fallback, which should
improve both performance and correctness.

The fallback codepath of computing the minimum values based on a
subset of the characters in the font is left in, as we still need
that for bitmap fonts, and some font tables that have invalid
values.

Change-Id: I71aac1e09c9f9de80446b023ba15a9e2afe7d226
Reviewed-by: Eskil Abrahamsen Blomfeldt <eskil.abrahamsen-blomfeldt@theqtcompany.com>
2015-09-22 21:19:12 +00:00
Andy Shaw
d36a1dfb51 Serialize the capitalization value of QFont
By serializing the capitalization value of QFont, it ensures that it is
correctly preserved when QPicture streams it and later plays it back.

Subsequently the QDataStream version has been bumped up to account for the
change of the data format for serializing QFont.

[ChangeLog][QtGui][QFont] QFont now serializes the capitalization setting.
[ChangeLog][Important Behavior Changes] QDataStream version bumped up to
17 to account for changes in the serialization of QFont.

Task-number: QTBUG-15214
Change-Id: I042680760e5a69d18d41e786b7500a3eebbe562f
Reviewed-by: Mitch Curtis <mitch.curtis@theqtcompany.com>
2015-09-15 13:30:09 +00:00
Friedemann Kleint
47b3e7d130 Fix some doc warnings.
qtbase/src/gui/text/qzip.cpp:797:warn:Cannot find 'FileInfo::d' specified with '\variable' in any header file
qtbase/src/opengl/doc/src/qtopengl-index.qdoc:28:warn:Can't link to 'Qt Gui'
qtbase/src/opengl/doc/src/qtopengl-module.qdoc:28:warn:Can't link to 'Qt Gui'
qtbase/src/widgets/widgets/qcombobox.cpp:3033:warn:Cannot find base function for '\reimp' in showPopupFromMouseEvent()
qtbase/src/corelib/plugin/quuid.cpp:849: warning: Can't link to 'variant()'
qtbase/src/corelib/plugin/quuid.cpp:863: warning: Can't link to 'variant()'
qtbase/src/widgets/dialogs/qsidebar.cpp:72: warning: Cannot find base function for '\reimp' in mimeTypes()
qtbase/src/widgets/dialogs/qsidebar.cpp:80: warning: Cannot find base function for '\reimp' in flags()
qtbase/src/widgets/dialogs/qsidebar.cpp:98: warning: Cannot find base function for '\reimp' in mimeData()
qtbase/src/widgets/dialogs/qsidebar.cpp:134: warning: Cannot find base function for '\reimp' in dropMimeData()
qtbase/src/widgets/dialogs/qsidebar.cpp:151: warning: Cannot find base function for '\reimp' in setData()

Change-Id: I39d6494eb8179f0f7532f99458736fa5e30cdc25
Reviewed-by: Leena Miettinen <riitta-leena.miettinen@theqtcompany.com>
2015-09-11 07:41:39 +00:00
Tor Arne Vestbø
54dbdc26ba Move min left/right bearing calculations to QFontEngine baseclass
The logic used in the FreeType font engine can be generalized
and move to the QFontEngine baseclass. This allows the CoreText
font engine to correctly report the minimum left/right bearings,
which decreases the chance that an optimization in QTextLayout's
line breaking algorithm will produce wrong results.

The calculation of left and right bearing has been moved to the
glyph_metrics_t type to reduce code duplication. This allows us
to use the with and height of the bounding box to determine if
the glyph has any contours.

Change-Id: I864697d3f31ed56f22f04666199b6c5023c5e585
Reviewed-by: Eskil Abrahamsen Blomfeldt <eskil.abrahamsen-blomfeldt@theqtcompany.com>
2015-09-02 09:11:31 +00:00
Liang Qi
afab1546a7 Merge remote-tracking branch 'origin/5.5' into 5.6
Conflicts:
	qmake/doc/snippets/code/doc_src_qmake-manual.pro
	qmake/doc/src/qmake-manual.qdoc
	src/corelib/io/qstorageinfo_unix.cpp
	src/corelib/tools/qbytearray.cpp
	src/widgets/kernel/qwidgetwindow.cpp
	tests/auto/corelib/io/qprocess/tst_qprocess.cpp
	tests/auto/corelib/mimetypes/qmimedatabase/tst_qmimedatabase.cpp
	tests/auto/network/access/qnetworkreply/BLACKLIST

Change-Id: I9efcd7e1cce1c394eed425c43aa6fce7d2edf31c
2015-08-26 20:06:57 +02:00
Sérgio Martins
385202c27c OSX FreeType: Add support for sub pixel font rendering.
Task-number: QTBUG-42839
Change-Id: Iea4552d766936a55fd177e4287591d2715202d9c
Reviewed-by: Morten Johan Sørvig <morten.sorvig@theqtcompany.com>
2015-08-14 23:34:26 +00:00
Andreas Hartmetz
b71b36fa22 Move setter for QFont::HintingPreference to QFontEngineFT.
Preparation for also using it from QCoreTextFontDatabase.

Change-Id: I9cbef59c21f343a88a5cb3fdbee1ed4791d7a36e
Reviewed-by: Morten Johan Sørvig <morten.sorvig@theqtcompany.com>
2015-08-14 19:07:11 +00:00
Oswald Buddenhagen
a47cd2cc82 Merge "Merge remote-tracking branch 'origin/5.4' into 5.5" into refs/staging/5.5 2015-08-12 09:53:52 +00:00
Mathias Hasselmann
bf013c9e74 OSX: Add initial FreeType support
This permits text rendering consistent with other FreeType enabled platforms,
like Windows and Linux.

Task-number: QTBUG-42839
Change-Id: I8c99bcaa3fb07c16e935a0c3705af467bc3da584
Reviewed-by: Paul Lemire <paul.lemire@kdab.com>
2015-08-11 09:40:30 +00:00
Tor Arne Vestbø
e92c2e119b Improve readability of QTextLine's handling of (negative) right bearing
- Helper functions in LineBreakHelper have been renamed from
    adjustFoo to calculateFoo, to signal that they do work, and
    are not adjusting something relative to something else.

  - The use of QFixed(1) and >= 0 has been replaced with an explicit
    constant for the case of the bearing not being calculated yet.

  - A helper function negativeRightBearing() has been added that
    returns the absolute value of any negative right bearing, making
    the width computations simpler.

  - Comments have been added and rewritten to make the logic clearer.

Change-Id: I1d3a0214cfa8b4fed4551f3444b43a37d55bd69b
Reviewed-by: Eskil Abrahamsen Blomfeldt <eskil.abrahamsen-blomfeldt@theqtcompany.com>
Reviewed-by: Tor Arne Vestbø <tor.arne.vestbo@theqtcompany.com>
2015-08-07 15:46:18 +00:00
Frederik Gladhorn
77da617dc8 Merge remote-tracking branch 'origin/5.5' into dev
Conflicts:
	doc/global/qt-cpp-defines.qdocconf
	src/3rdparty/forkfd/forkfd.c
	src/corelib/codecs/qtextcodec.cpp
	src/corelib/kernel/qmetatype.cpp
	src/corelib/tools/qset.qdoc
	src/gui/accessible/qaccessible.cpp
	src/gui/image/qpixmapcache.cpp
	src/opengl/qgl.cpp
	src/tools/qdoc/generator.cpp
	src/widgets/kernel/qwidget.cpp
	tests/auto/widgets/widgets/qcombobox/tst_qcombobox.cpp

Change-Id: I4fbe1fa756a54c6843aa75f4ef70a1069ba7b085
2015-08-06 10:54:01 +02:00
Konstantin Ritt
c57c89b3c1 Don't expose qt_setQtEnableTestFont(bool) by default
Build it only in -developer-build mode for tests that might depend
on exact-matching font behavior.
Return earlier to avoid doing any useless job.

Change-Id: I966ee5689f03403e45f4c957b63e3113f0467803
Reviewed-by: Eskil Abrahamsen Blomfeldt <eskil.abrahamsen-blomfeldt@theqtcompany.com>
2015-07-31 09:50:17 +00:00
Konstantin Ritt
5e3e34731b Default implementation for QPlatformFontDatabase::fallbacksForFamily()
...mainly for platforms that do not provide a native/unified way
to obtain system-defined font fallbacks list
(ie !CoreText && !FontConfig).

Change-Id: I23c5589d79ddecb6311ccc52ec8b29977f06d408
Reviewed-by: Eskil Abrahamsen Blomfeldt <eskil.abrahamsen-blomfeldt@theqtcompany.com>
2015-07-31 09:51:35 +00:00
Konstantin Ritt
735cd0ccf3 [QFontDatabase] Defer the fallback families list initialization
Use the same trick the WebKit related path has used for years:
if there is no explicit list that takes a precedence over the
default one (i.e. QFont("Arial,SimHei")), then defer the fallback
families list initialization until it gets requested.

Change-Id: If5a74294bdebb24865c619bc0d7328b3e706de76
Reviewed-by: Eskil Abrahamsen Blomfeldt <eskil.abrahamsen-blomfeldt@theqtcompany.com>
2015-07-31 09:49:21 +00:00
Morten Johan Sørvig
dcd2debe62 Enable non-integer device pixel ratio
Work around QPaintDevice::metric's int return type
by adding a new metric that returns a scaled devicePixelRatio.
Choose a scale factor that gives us more than enough
range.

The QPaintDevice::devicePixelRatio() convenience accessor
is public API and can unfortunately not be changed
to return a qreal. Add devicePixelRatioF() which
returns the (unscaled) devicePixelRatio.

Change all call sites of QPaintDevice::devicePixelRatio()
to use QPainDevice::devicePixelRatioF().

Task-number: QTBUG-46615
Change-Id: I97ec4000fe379b7ff5e1624a871ae2512790aad9
Reviewed-by: Paul Olav Tvete <paul.tvete@theqtcompany.com>
Reviewed-by: Lars Knoll <lars.knoll@theqtcompany.com>
2015-07-30 04:04:01 +00:00
Marc Mutz
5329d739ee Fix qHash(QFontEngine::FaceId)
There were two problems:

1. qHash() hashed FaceId::uuid, but op== didn't use it for
   determining equality. Thus, x == y => qHash(x) == qHash(y)
   might be broken if fileName and uuid have an orthogonal
   component, if you excuse my vector analogy.

2. To hash fileName and uuid, it concatenated the two,
   causing a temporary QByteArray to be created just for
   hashing its contents. That prevented marking qHash()
   as nothrow.

Fix by using new QtPrivate::QHashCombine and adding
uuid to the list of fields compared in op==.

Change-Id: I49f2379d514d6d3669929e737562cf6de823127e
Reviewed-by: Eskil Abrahamsen Blomfeldt <eskil.abrahamsen-blomfeldt@theqtcompany.com>
2015-07-23 08:48:25 +00:00
Kavindra Palaraja
f8441c071f Clarified the documentation for QTextDocument::find.
QTextDocument::find has a behavior that is different from the typical
QRegExp/QRegularExpression behavior where finding a given expression is
always constrained by the paragraph (block), regardless of newline
characters in the expression.

Task-number: QTBUG-21785
Change-Id: Ia6a061c6feb5a19e6b8caa3d8009da5ca31ec422
Reviewed-by: Konstantin Ritt <ritt.ks@gmail.com>
Reviewed-by: Simon Hausmann <simon.hausmann@theqtcompany.com>
2015-07-22 20:20:12 +00:00
Nico Vertriest
e6ddae07e1 Doc:added doc to undocumented functions
Task-number: QTBUG-36985
Change-Id: Ic358682b276d67ef804f727bcf14191718613469
Reviewed-by: Topi Reiniö <topi.reinio@digia.com>
2015-07-22 13:47:23 +00:00
Sérgio Martins
1236b1827c QtGui: Pass types with copy-ctor or dtor by const-ref
... except if the function is a ctor, callers pass rvalues,
and the type has a fast move ctor. In that case, keep passing
by-value and qMove() into place.

Change-Id: I2c0be7d4436327834ddee0531c51c5af352ac74c
Reviewed-by: Marc Mutz <marc.mutz@kdab.com>
2015-07-19 10:46:53 +00:00
Marc Mutz
aa2efdfa97 QZip*: return FileInfo by value
Makes for much more readable callers, and, d/t NRVO, isn't less efficient
than the old code, either. Transparently enables moves when QVector should
get them, at some point, too.

Change-Id: I77327cf665272b80277deaaa6dd2ee9c00806464
Reviewed-by: Olivier Goffart (Woboq GmbH) <ogoffart@woboq.com>
2015-07-19 10:35:51 +00:00
Marc Mutz
0abd207052 QZip*: don't hold QZipReader::FileInfo in QList
FileInfo is larger than a void*, so holding them in a QList is needlessly
inefficient. Worse, the code could come to depend on the fragile property
of (inefficient) QLists that references to elements therein never are
invalidated.

Change-Id: I772177c5ac544a5fecce2368f628148308ef260f
Reviewed-by: Konstantin Ritt <ritt.ks@gmail.com>
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
2015-07-19 10:35:41 +00:00
Marc Mutz
78bba7b002 Clean up QZipReader::FileInfo
- don't define special member functions if the compiler-generated
  ones are just fine (inhibits move semantics)
- implement all remaining methods inline
- unexport
- remove unused (and, to add insult to injury, never init'ed)
  d-pointer. This is private API. No need for a d-pointer,
  much less an unused one.

Change-Id: I6979cb5103a361c0313c252d3bf7073a3c47addd
Reviewed-by: Konstantin Ritt <ritt.ks@gmail.com>
2015-07-19 10:35:26 +00:00
Marc Mutz
c27d4981e9 Fix nullptr literal 0s which would look odd as nullptr
These all invoke the QFlags<>(Zero *) ctor, which is designed to
accept a 0, but no other int. But in doing so, it requires passing
a nullptr literal, and 0 is not a nullptr literal accepted under
-Wzero-as-null-pointer-constant or similar warnings.

Fix by using the QFlags::QFlags() ctor instead.

Task-number: QTBUG-45291
Change-Id: I73f9c9f4de11eeb1ba04ace6c7121d17510ea29f
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
2015-07-19 10:33:12 +00:00
Marc Mutz
a767014167 QtGui: Use Q_NULLPTR instead of 0 in all public headers
This is in preparation of adding -Wzero-as-null-pointer-constant (or similar)
to the headers check.

Task-number: QTBUG-45291
Change-Id: I72ab40b21a9499b53a639564fa45884de17b6c98
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
2015-07-19 10:32:55 +00:00
Oswald Buddenhagen
68316e6584 Merge remote-tracking branch 'origin/5.4' into 5.5
Conflicts:
	doc/global/manifest-meta.qdocconf
	src/corelib/global/qnamespace.qdoc
	src/corelib/io/qstorageinfo_unix.cpp
	src/corelib/tools/qtools_p.h
	src/sql/drivers/psql/qsql_psql.cpp

Change-Id: I23a15ac84e03ad61d865e3df872b013eb0752949
2015-07-17 17:53:19 +02:00
Simon Hausmann
b2603b7665 Merge remote-tracking branch 'origin/5.5' into HEAD
Conflicts:
	src/plugins/platforms/windows/qwindowsopengltester.cpp

Change-Id: Ia7abeba9395ccf84e2fa81b91a5725a86dedb9fe
2015-07-17 16:35:42 +02:00
Marc Mutz
2c235303c2 QPlatformFontDatabase: compress an array of ushorts
First, all values in the array fit into 8-bit, so change the type
from ushort to quint8.

Then, instead of appending a zero as end marker, statically
determine the size of the array and use that number.

Also fixes (benign) off-by-one error in the existing reserve()
call.

Change-Id: Id05b6a56b55d2e0769b00496a55808bb7351b084
Reviewed-by: Olivier Goffart (Woboq GmbH) <ogoffart@woboq.com>
2015-07-16 13:21:15 +00:00
Marc Mutz
a082b41d2c QTextEngine: don't hold ItemDecoration in QList
ItemDecoration is larger than a void*, so holding it in QLists
is needlessly inefficient. Worse, the code could come to depend
on the fragile property of (inefficient) QLists that references
to elements therein never are invalidated.

Fix by marking the type movable and holding in QVector instead.

Change-Id: I06d7a77529f7cff2ba503c5e8d6e5df0ad801a21
Reviewed-by: Olivier Goffart (Woboq GmbH) <ogoffart@woboq.com>
Reviewed-by: Konstantin Ritt <ritt.ks@gmail.com>
2015-07-13 22:27:14 +00:00
Marc Mutz
fa4b57e8c5 QPlatformFontDatabase: compress requiredUnicodeBits table
All values in the table fit into 8 bits, so don't use a
16-bit type.

Change-Id: I685727e16a264a49ea501d36eb6815c6d5aaa9b2
Reviewed-by: Olivier Goffart (Woboq GmbH) <ogoffart@woboq.com>
Reviewed-by: Konstantin Ritt <ritt.ks@gmail.com>
2015-07-13 10:36:22 +00:00
Friedemann Kleint
a299ae3dc4 Fix some qdoc-warnings.
qtbase/src/corelib/io/qdatastream.cpp:501: warning: Undocumented enum item 'Qt_5_6' in QDataStream::Version
qtbase/src/corelib/itemmodels/qitemselectionmodel.cpp:1764: warning: Undocumented parameter 'model' in QItemSelectionModel::setModel()
qtbase/src/corelib/statemachine/qabstractstate.cpp:216: warning: Undocumented parameter 'active' in QAbstractState::activeChanged()
qtbase/src/corelib/statemachine/qstatemachine.cpp:3262: warning: Undocumented parameter 'running' in QStateMachine::runningChanged()
qtbase/src/corelib/tools/qchar.cpp:160: warning: Undocumented enum item 'Unicode_7_0' in QChar::UnicodeVersion
qtbase/src/gui/image/qimagereader.cpp:1168: warning: Undocumented parameter 'enabled' in QImageReader::setAutoTransform()
qtbase/src/gui/image/qimagewriter.cpp:621: warning: Undocumented parameter 'transform' in QImageWriter::setTransformation()
qtbase/src/gui/itemmodels/qstandarditemmodel.cpp:1268: warning: Undocumented parameter 'tristate' in QStandardItem::setAutoTristate()
qtbase/src/gui/kernel/qscreen.cpp:590: warning: Undocumented parameter 'orientation' in QScreen::orientationChanged()
qtbase/src/gui/kernel/qscreen.cpp:599: warning: Undocumented parameter 'orientation' in QScreen::primaryOrientationChanged()
qtbase/src/gui/text/qtextdocument.cpp:1455: warning: No such parameter 'from' in QTextDocument::find()
qtbase/src/gui/text/qtextdocument.cpp:533: warning: Undocumented parameter 'option' in QTextDocument::setDefaultTextOption()
qtbase/src/widgets/itemviews/qtableview.cpp:2546: warning: Undocumented parameter 'enable' in QTableView::setSortingEnabled()
qtbase/src/widgets/statemachine/qkeyeventtransition.cpp:119: warning: Undocumented parameter 'key' in QKeyEventTransition::setKey()
qtbase/src/widgets/widgets/qplaintextedit.cpp:1610: warning: Can't link to 'toText()'
qtbase/src/opengl/qgl.cpp:4371: warning: No documentation for 'QGLWidget::event()'

Remove the documentation as they are properties:
qtbase/src/widgets/widgets/qfontcombobox.cpp:407: warning: Undocumented parameter 'font' in QFontComboBox::setCurrentFont()
qtbase/src/widgets/widgets/qfontcombobox.cpp:403: warning: Undocumented parameter 'script' in QFontComboBox::setWritingSystem()

Change-Id: If599a3ce747bbb8a3418dd973810923b87246371
Reviewed-by: Leena Miettinen <riitta-leena.miettinen@theqtcompany.com>
2015-07-10 18:01:39 +00:00
Eskil Abrahamsen Blomfeldt
4a1e5dbade Better handling of invalid font tables
Specifically when reading files with broken cmap tables, we could
get some undeterministic results. We handle this more gracefully
by verifying that the offsets are sane and bailing out early if not.
This replaces the current pattern throughout the font engine for
consistency.

Change-Id: I507bba49c0be634afca77d1eb3d199a427451bee
Reviewed-by: Simon Hausmann <simon.hausmann@theqtcompany.com>
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
2015-07-10 10:13:11 +00:00
Thiago Macieira
153b0e50b1 Fix ambiguous overload call on OS X
Found by ICC:
qtextengine.cpp(1259): error: more than one instance of constructor "QFixed::QFixed" matches the argument list:
            function "QFixed::QFixed(int)"
            function "QFixed::QFixed(long)"
            function "QFixed::QFixed(qreal={double})"
            argument types are: (uint)
              QFixed stretch = QFixed(actualFontEngine->fontDef.stretch) / QFixed(100);
                               ^

Change-Id: I790fb4cae1abc692705253a7863291bc8743b832
Reviewed-by: Konstantin Ritt <ritt.ks@gmail.com>
Reviewed-by: Jake Petroules <jake.petroules@petroules.com>
2015-07-08 03:20:56 +00:00
Martin Smith
6384c4e940 qdoc:Fixed a few qdoc errors
Fixed a few qdoc error messages caused by errors in qmetatype.cpp and
qtextlayout.cpp and qtestcase.cpp and qpointer.cpp

Change-Id: I662aa25bedba057e125e289c34787e81793941ff
Task-number: QTBUG-46939
Reviewed-by: Martin Smith <martin.smith@digia.com>
2015-07-07 12:58:55 +00:00
Marc Mutz
861dca57d7 QTextLayout: deprecate QList API for additionalFormat
This is a separate commit to allow other modules to do the transition
before this may vanish or cause a warning.

Change-Id: I556837bf0d2c667f067f4e1fa7918bd1a3f55025
Reviewed-by: Konstantin Ritt <ritt.ks@gmail.com>
Reviewed-by: Simon Hausmann <simon.hausmann@theqtcompany.com>
2015-07-04 06:03:59 +00:00
Liang Qi
0aa2d318b1 Merge remote-tracking branch 'origin/5.5' into dev
Conflicts:
	src/corelib/global/qglobal.cpp
	src/corelib/global/qglobal.h
	src/corelib/global/qsysinfo.h
	src/corelib/global/qsystemdetection.h
	src/corelib/kernel/qobjectdefs.h
	src/plugins/plugins.pro
	tests/auto/widgets/itemviews/qlistview/qlistview.pro

Change-Id: Ib55aa79d707c4c1453fb9d697f6cf92211ed665c
2015-07-01 11:05:26 +02:00
Marc Mutz
6aaac9a3b1 QtGui: make all Q_DECLARE_SHARED types nothrow move-assignable
Excepting QBitmap and the QTextFormat heirarchy, which don't
have 100% value semantics (still pondering them).

In QPolygon(F), adding the move assignment operator disables
the implicitly-defined copy assignment operator, which therefore
have to be made user-defined. That doesn't change the ABI of
the class, since the base class QVector already had a user-defined
copy assignment operator.

Change-Id: I0b111c1d21cf47f559ada6357c982e3dc26aca68
Reviewed-by: Olivier Goffart (Woboq GmbH) <ogoffart@woboq.com>
2015-06-30 16:34:26 +00:00
Nico Vertriest
a7f2af0911 Replace MAC OS X with OS X
Task-number: QTBUG-46374
Change-Id: I7bc633ab551740bd328a24b0ccae1d534af47138
Reviewed-by: Martin Smith <martin.smith@digia.com>
2015-06-30 07:33:31 +00:00
Konstantin Ritt
12b36aec2b [QZip] Do not depend on platform definitions
Guarantee the values are exactly the same on all platforms
and avoid the macro redefinition(s) on a newer MinGW.

This also fixes a typo in #define S_IFLNK 020000 (<-- must be 0120000).

Change-Id: I4993d2a9bdb4b0871af110b89c137ce0ac0e953a
Reviewed-by: Friedemann Kleint <Friedemann.Kleint@theqtcompany.com>
Reviewed-by: Oswald Buddenhagen <oswald.buddenhagen@theqtcompany.com>
Reviewed-by: Konstantin Ritt <ritt.ks@gmail.com>
2015-06-27 02:29:53 +00:00
Tor Arne Vestbø
dc6191ccb4 Treat color (ARGB) glyphs, e.g. Emoji, as having unreliable glyph outlines
This is used by the scene graph to automatically switch over from distance
field text to native text rendering for the given glyph node, which allows
mixing regular text with Emoji in e.g. a Text item without having to set
renderType to Text.NativeRendering.

Change-Id: I5d96d1dab329a975e3442284bf4c5a82174177c9
Reviewed-by: Eskil Abrahamsen Blomfeldt <eskil.abrahamsen-blomfeldt@theqtcompany.com>
2015-06-26 10:56:42 +00:00
Konstantin Ritt
9901bfe914 Simplify permission flag handling a bit
Change-Id: I753f7a398c39e7300821658f27e4813c591eebc3
Reviewed-by: Friedemann Kleint <Friedemann.Kleint@theqtcompany.com>
Reviewed-by: Oswald Buddenhagen <oswald.buddenhagen@theqtcompany.com>
2015-06-25 16:53:57 +00:00
Konstantin Ritt
7082c20e4a [QFontMetrics] Mark obsolete charWidth() method for deletion in 6.0
It was obsoleted for quite a while already and we forgot to get rid
of it the last time.

Change-Id: Ib15e71829e80648aa667a6b0af31698460b99cc1
Reviewed-by: Lars Knoll <lars.knoll@theqtcompany.com>
2015-06-25 00:17:17 +00:00
Marc Mutz
1f46321717 QZip*: mark various types movable and primitive
... even if they are not (currently) held in Qt containers
(though FileInfo is).

Change-Id: Id14d4af89fed8bcefdbb9b28d11c1c43fccf7190
Reviewed-by: Olivier Goffart (Woboq GmbH) <ogoffart@woboq.com>
2015-06-24 13:22:09 +00:00
Sérgio Martins
eca8f1bf98 gui: Add several QList::reserve() calls.
Reduces reallocations.

Change-Id: I0db16726f413a67b76a73fabd013f910ab5f5109
Reviewed-by: Marc Mutz <marc.mutz@kdab.com>
2015-06-22 14:03:39 +00:00
Marc Mutz
3e6f36175a QTextDocumentLayout: don't hold QPointers in QList
QPointer is larger than a void*, so holding them in a QList is needlessly
inefficient. Worse, the code could come to depend on the fragile property
of (inefficient) QLists that references to elements therein never are
invalidated.

Change-Id: I104d11cc530c9c1579e82bf4e28e3353c00b34b4
Reviewed-by: Konstantin Ritt <ritt.ks@gmail.com>
Reviewed-by: Olivier Goffart (Woboq GmbH) <ogoffart@woboq.com>
2015-06-22 10:45:11 +00:00
Marc Mutz
90da7ba49c QFontSubset: mark local types movable and hold in QVector, not QList
Virtually all of these types are too large to fit into a QList.

Change-Id: If55496ef3fb26d6531e9ef1bb1558887d9077a3b
Reviewed-by: Konstantin Ritt <ritt.ks@gmail.com>
Reviewed-by: Lars Knoll <lars.knoll@theqtcompany.com>
2015-06-20 04:38:40 +00:00
Marc Mutz
452ece9c02 Remove quadratic behavior in QFontDatabase::writingSystems()
Looping over QList::contains() constitutes O(N²) behavior,
the more so as this QList is horribly inefficient since
WritingSystem is not a Q_MOVABLE_TYPE.

Since the range of possible unique values in the result
is severly limited (by virtue of being enumerated values),
use a bitmask to remember which WritingSystems were
encountered, then, after releaseing the mutex again, use
that bitmask to populate the QList.

Change-Id: I1d12eb487513ec17faa6f38942f8b681819dc0e8
Reviewed-by: Adam Majer <adamm@zombino.com>
Reviewed-by: Konstantin Ritt <ritt.ks@gmail.com>
Reviewed-by: Lars Knoll <lars.knoll@theqtcompany.com>
2015-06-19 18:37:30 +00:00
Mikhail Lappo
d82d5b1c43 Check for integer overflows in places where qAllocMore is used
Task-number: QTBUG-41230
Change-Id: Ic2167364e326092482657f2d2b4ab6ad3e5af631
(partially cherry-picked from 880986be23)
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
2015-06-19 15:18:15 +00:00
Allan Sandfeld Jensen
46e8ac0308 Extend generated style strings to include new font weights
When a font style-name is not directly available from the font we
need to generate it with the data we have, so we should include all
the new supported weights.

Change-Id: I45cc0114f8c76f45bc7a639f9d0d8096a064bc51
Reviewed-by: Konstantin Ritt <ritt.ks@gmail.com>
Reviewed-by: René J.V. Bertin <rjvbertin@gmail.com>
Reviewed-by: Pierre Rossi <pierre.rossi@theqtcompany.com>
2015-06-15 23:16:07 +00:00
Martin Smith
79a97be9f3 doc: Remove uses of \mainclass
This qdoc command is deprecated.

Task-number: QTBUG-46476
Change-Id: Iee36f91bdcf500c2e88022a5f8a9c3accc6048c2
Reviewed-by: Martin Smith <martin.smith@digia.com>
2015-06-05 09:37:55 +00:00
Simon Hausmann
ccad00121d Merge "Merge remote-tracking branch 'origin/5.5' into dev" into refs/staging/dev 2015-06-04 05:56:06 +00:00
Allan Sandfeld Jensen
f04ed82ca2 Font definitions with different style names are not equal
Since we added font matching by style name, the style name is not just
a derived property and should not be ignored in comparisons.

The QFontDef::exactMatch comparison is left unchanged, since it tests
if a loaded font matches a requested one.

Task-number: QTBUG-30851
Change-Id: I4187c5b993815001f35bcf24dc449059bfdcba6f
Reviewed-by: Eskil Abrahamsen Blomfeldt <eskil.abrahamsen-blomfeldt@theqtcompany.com>
2015-06-03 14:00:07 +00:00
Marc Mutz
8d9d609e63 De-duplicate vtables, part II: exported public classes
By making the destructor (usually the first non-inline, non-pure,
virtual function, and therefore the trigger for most compilers to
emit the vtable and type_info structures for the class in that TU)
out-of-line, vtables and, more importantly, type_info structures for
the class are pinned to a single TU. This prevents false negative
dynamic_cast and catch evaluation.

In this second and last batch, we de-inline destructors of exported
public classes.

Since they are already exported, users of these classes are unaffected
by the change, but since it's public API, and the dtors may have been
de-virtualized and inlined into application code, we need to avoid
adding code to the out-of-line destructor until Qt 6.

Change-Id: Ieda9553cb4b0dae7217c37cc7cde321dd7302122
Reported-by: Volker Krause <volker.krause@kdab.com>
Task-number: QTBUG-45582
Reviewed-by: Friedemann Kleint <Friedemann.Kleint@theqtcompany.com>
Reviewed-by: Konstantin Ritt <ritt.ks@gmail.com>
Reviewed-by: Lars Knoll <lars.knoll@digia.com>
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
2015-06-03 12:02:59 +00:00
Marc Mutz
b295afb064 QStaticTextUserData: declare dtor out-of-line and export class
De-duplicates vtables and enables RTTI on this class
hierarchy.

Export, as QOpenGLStaticTextUserData (QtOpenGL) inherits it.

Change-Id: I0662870538c35f23baf6bde4594ec8b9055efae7
Reported-by: Volker Krause <volker.krause@kdab.com>
Task-number: QTBUG-45582
Reviewed-by: Konstantin Ritt <ritt.ks@gmail.com>
Reviewed-by: Friedemann Kleint <Friedemann.Kleint@theqtcompany.com>
Reviewed-by: Lars Knoll <lars.knoll@digia.com>
2015-06-03 12:02:49 +00:00
Simon Hausmann
e2f66f9215 Merge remote-tracking branch 'origin/5.5' into dev
Conflicts:
	src/corelib/global/qnamespace.qdoc
	src/corelib/io/qwindowspipereader.cpp
	src/corelib/io/qwindowspipereader_p.h
	src/corelib/statemachine/qstatemachine.cpp
	src/corelib/statemachine/qstatemachine_p.h
	src/plugins/platforms/xcb/qxcbconnection.h
	tests/auto/network/access/qnetworkreply/tst_qnetworkreply.cpp
	tests/auto/tools/qmake/tst_qmake.cpp
	tests/manual/touch/main.cpp

Change-Id: I917d694890e79ee3da7d65134b5b085e23e0dd62
2015-06-03 10:23:56 +02:00
Sérgio Martins
f44a59f390 Don't assign iterator to const_iterator
It should also be possible to use QT_STRICT_ITERATORS in Qt's own code base

Change-Id: I0914db480d4d2b06e71e3a2588163efdd3ff6d27
Reviewed-by: Marc Mutz <marc.mutz@kdab.com>
Reviewed-by: Olivier Goffart (Woboq GmbH) <ogoffart@woboq.com>
2015-06-02 19:41:16 +00:00
Marc Mutz
4ca16e99e7 QAbstractTextDocumentLayoutPrivate: declare dtor out-of-line and export class
De-duplicates vtables and enables RTTI on this class
hierarchy.

Export, as QPlainTextDocumentLayoutPrivate (QtWidgets)
inherits it.

Change-Id: I8aee43b43898a72430d8bc1247ea76c7d4e9031d
Reported-by: Volker Krause <volker.krause@kdab.com>
Task-number: QTBUG-45582
Reviewed-by: Konstantin Ritt <ritt.ks@gmail.com>
Reviewed-by: Simon Hausmann <simon.hausmann@theqtcompany.com>
2015-06-01 05:23:38 +00:00
Marc Mutz
60f4d5165a src/gui/text/text.pri: add missing header qabstracttextdocumentlayout_p.h
Change-Id: Ia825ef6d932fbd45ceaf8c54a3207f207fa40994
Reviewed-by: Konstantin Ritt <ritt.ks@gmail.com>
Reviewed-by: Simon Hausmann <simon.hausmann@theqtcompany.com>
2015-06-01 05:22:05 +00:00
Marc Mutz
87d57d1994 Fix users of QTextLayout::additionalFormats to use the new API
QTextLayout::additionalFormats setters and getters using QList<FormatRange> have
been deprecated; port to the QVector versions.

Moved op== definition for FormatRange needed in tst_qsyntaxhighlighter.cpp
to a friend declaration in FormatRange itself, because MSVC 2008 doesn't find
it otherwise.

Change-Id: Ibab6589df057f02377d895079b56395859e3401e
Reviewed-by: Konstantin Ritt <ritt.ks@gmail.com>
2015-05-30 10:56:24 +00:00
Marc Mutz
c0ddd5fa12 QTextLayout: replace a use of an inefficient QList with QVector
The QTextLayout::FormatRange is larger than void* and thus should not be held in
QList. Use a QVector instead.

Other parts of Qt already hold FormatRanges in QVectors, so this also makes
handling FormatRanges more consistent.

To avoid ugly names for the getter which doesn't overload on return type alone),
rename the set of function to format (from additionalFormats).

[ChangeLog][QtGui][QTextLayout] Added QVector-based alternatives setFormat(),
format(), and clearFormat() to setAdditionalFormats(), additionalFormats(),
and clearAdditionalFormats(), resp.

Change-Id: Ie04a561b43c91c3b2befb3cac2981821f84d5f77
Reviewed-by: Konstantin Ritt <ritt.ks@gmail.com>
Reviewed-by: Simon Hausmann <simon.hausmann@theqtcompany.com>
2015-05-29 14:00:10 +00:00
Marc Mutz
16b95b65a6 Q*GlyphCache: de-inline dtor and export vtable
The destructor is the first virtual method. By not defining it
out-of-line, we provoke multiple copies of vtables, not all of
which can be merged by the linker. If the linker fails, RTTI
such as dynamic_cast and catch-blocks involving the type will
not work.

Additionally, QFontEngineGlyphCache was not exported, and
therefore also not its vtable, making it impossible for
users outside of QtGui to get a unique RTTI for the class.

Change-Id: Ib265945934216bb609629431eb4c71996d4fd39d
Reported-by: Volker Krause <volker.krause@kdab.com>
Task-number: QTBUG-45582
Reviewed-by: Konstantin Ritt <ritt.ks@gmail.com>
Reviewed-by: Friedemann Kleint <Friedemann.Kleint@theqtcompany.com>
Reviewed-by: Eskil Abrahamsen Blomfeldt <eskil.abrahamsen-blomfeldt@theqtcompany.com>
2015-05-26 17:51:47 +00:00
Allan Sandfeld Jensen
e905526090 Better match thin font styles
A style name 'Extra Thin' or 'Thin Italic' should be parsed as Thin
font weight.

Change-Id: I8acebed7330c23231b3742d887081d8b3d0aeb19
Reviewed-by: Konstantin Ritt <ritt.ks@gmail.com>
2015-05-14 00:28:06 +00:00
Konstantin Ritt
43cab86802 Fix overcaching the fallback families list for a requested family
The cached list didn't take fontStyle, styleHint and script into account.
As long as QFontCache isn't explicitly disabled, loadEngine() rarely
called for the same family, foundry, style and size - so avoid caching
anything here at all.

Change-Id: I7779bf33fc074edc00799f9a39d67327f8c88ccc
Reviewed-by: Simon Hausmann <simon.hausmann@theqtcompany.com>
2015-05-13 01:08:36 +00:00
Konstantin Ritt
c874e10cbc Simplify QFontDatabase::findFont()
QFontDatabase::load() is the only caller that passes non-null
QFontPrivate* to QFontDatabase::findFont(), to adjust the pointSize
with regards to the font's dpi; do that right in QFontDatabase::load().
The `multi` param's meaning is, in fact, an absence of the
QFont::NoFontMerging flag,
so prefer the latter and prevent ambiguity in the future.

Change-Id: Icc7751044e454ca438e7627364faa415287bf1ae
Reviewed-by: Eskil Abrahamsen Blomfeldt <eskil.abrahamsen-blomfeldt@theqtcompany.com>
2015-05-13 01:08:33 +00:00
Konstantin Ritt
994a7476ef [QFontDatabase::findFont] Get rid of the refactoring leftovers
The logic this code was aimed for has been covered by a more complete
solution in QFontDatabase::load() years ago; simply drop the dead code.

Change-Id: Id8860353ff4f4d2f1529aa89810d6c5725e97d24
Reviewed-by: Eskil Abrahamsen Blomfeldt <eskil.abrahamsen-blomfeldt@theqtcompany.com>
2015-05-13 01:08:30 +00:00
David Faure
5d78584523 QTextTable/QTextDocumentLayout: remove dead code
Change-Id: I3eb72a43129c58574036b6ca8c8c8413ca24b43a
Reviewed-by: Friedemann Kleint <Friedemann.Kleint@theqtcompany.com>
2015-05-06 11:28:55 +00:00
Volker Krause
337c279215 Make data tables const.
Moves some of them to the .rodata section, the rest at least to
.data.rel.ro[.local].

Change-Id: I85676ddf22b0c0097f3f0dce4c3dc018dc29d045
Reviewed-by: Marc Mutz <marc.mutz@kdab.com>
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
Reviewed-by: Giuseppe D'Angelo <giuseppe.dangelo@kdab.com>
2015-05-05 05:31:32 +00:00
Allan Sandfeld Jensen
e445f3c47b Add noexcept to move constructors and assignment operators
Add the noexcept attribute to all move constructors and assignment
operators in QtGui that didn't already have it.

Change-Id: Idcdf79ae8349b8793e7394b5ae7c08e6111fbc9a
Reviewed-by: Konstantin Ritt <ritt.ks@gmail.com>
Reviewed-by: Gunnar Sletta <gunnar@sletta.org>
2015-05-04 11:27:48 +00:00
Simon Hausmann
7f8719e663 Merge remote-tracking branch 'origin/5.5' into HEAD
Change-Id: I487a4b7c05687a10c498ac219c31367d4db6fbc0
2015-05-04 13:19:31 +02:00
Thiago Macieira
eb82959d66 Fix undefined behavior in left-shifting into negative
It's undefined behavior to left or right-shift a signed integer such
that the sign changes. Since SymbolCsbBit is 31, make sure we use
unsigned numbers.

Found by ICC
qplatformfontdatabase.cpp(614): error #68: integer conversion resulted in a change of sign

Change-Id: Idf715b895bac4d56b4afffff13da78d294b1248e
Reviewed-by: Konstantin Ritt <ritt.ks@gmail.com>
2015-05-04 06:00:39 +00:00
Konstantin Ritt
3ce2dd391e [QFontDatabase] Get rid of QtFontEncoding
This one has not been unsed for ages (since Qt3?).

Change-Id: Iaf514db1b698b34a303f34c150b72db989eb176c
Reviewed-by: Simon Hausmann <simon.hausmann@theqtcompany.com>
Reviewed-by: Friedemann Kleint <Friedemann.Kleint@theqtcompany.com>
2015-05-01 05:36:11 +00:00
Konstantin Ritt
a77dc1a669 [QFontDatabase] Drop QtFontDesc's familyIndex member
Many times set but never used.

Change-Id: I297f21d4b9878e5f9559a2dfdb2d3de34107bb7d
Reviewed-by: Simon Hausmann <simon.hausmann@theqtcompany.com>
Reviewed-by: Friedemann Kleint <Friedemann.Kleint@theqtcompany.com>
2015-05-01 05:36:09 +00:00
Konstantin Ritt
9bf6ea7fde [QFontDatabase] Get rid of some dead code
1. Checking if `db->count == 0` inside the
`for (int x = 0; x < db->count; ++x)` loop makes absolutely no sense;
2. The family gets loaded just a line above (ensurePopulated()).

Change-Id: I72dbd42565c4f5a5d9ff8879f10ee0ece7298fa7
Reviewed-by: Simon Hausmann <simon.hausmann@theqtcompany.com>
2015-05-01 05:36:04 +00:00
Konstantin Ritt
7443b3c949 Optimize QFont::resolve(const QFont &other)
When resolve_mask is 0, the font inherits just everything, and there is
no need in checking for any resolved attributes;
the resolved font always inherits dpi, so do not check it either.

Change-Id: Ie5d7ced0859d46a9237447e29051a22569480a51
Reviewed-by: Simon Hausmann <simon.hausmann@theqtcompany.com>
2015-05-01 05:35:53 +00:00
Liang Qi
aed5a71683 Merge remote-tracking branch 'origin/5.5' into dev
Conflicts:
	src/corelib/statemachine/qstatemachine.cpp
	src/corelib/statemachine/qstatemachine_p.h
	src/gui/painting/qdrawhelper.cpp
	src/plugins/platforms/xcb/qxcbnativeinterface.cpp
	src/plugins/platforms/xcb/qxcbwindow.cpp
	src/plugins/platforms/xcb/qxcbwindow.h
	src/testlib/qtestblacklist.cpp
	src/tools/qdoc/node.cpp
	src/tools/qdoc/node.h
	tests/auto/gui/painting/qcolor/tst_qcolor.cpp

Change-Id: I6c78b7b162001712d5774293f501b06b4ff32684
2015-04-22 09:25:54 +02:00
Marc Mutz
1b5f29e28a Remove <qhash.h> where it's not used
To avoid source-incompatibilites, wrap in QT_DEPRECATED_SINCE(5, 5)
in public headers.

Change-Id: I6117e8a6b11200d2f1a0a94a0e87d5c27538218e
Reviewed-by: Olivier Goffart (Woboq GmbH) <ogoffart@woboq.com>
2015-04-20 07:41:34 +00:00
Marc Mutz
103086e379 Replace <qhash.h> with <qhashfunctions.h> where applicable
To avoid source-incompatibilites, wrap in QT_DEPRECATED_SINCE(5, 5)
in public headers.

Change-Id: Ic3398f4f330e15a3b55065858add26b90fd70e6c
Reviewed-by: Olivier Goffart (Woboq GmbH) <ogoffart@woboq.com>
2015-04-20 07:41:27 +00:00
Konstantin Ritt
ba5af03a5a [QTextCursor] Better use of the cached whiteSpace attribute
In compare to QTextEngine::atSpace(), this also handles the less-common
"white spaces" and the exceptional control codes.

Change-Id: I52878932926b7f9fe36c9dd01007963b9691fbf0
Reviewed-by: Simon Hausmann <simon.hausmann@theqtcompany.com>
2015-04-15 11:07:44 +00:00
Konstantin Ritt
c586f958b3 Fix trivial copy-paste typo in QTextBlock::previous() docu
Change-Id: Ia5d260af00aecf40400653e41248b5dd5f074b74
Reviewed-by: Simon Hausmann <simon.hausmann@theqtcompany.com>
2015-04-15 11:07:01 +00:00
Alessandro Portale
6c6fe766a8 Improve QTextDocument::toPlainText doc related to inline images
"Embedded objects, such as images, are represented by a
Unicode value U+FFFC (OBJECT REPLACEMENT CHARACTER)."

Also updated the QTextImageFormat docs with the same wording.

Task-number: QTBUG-44538
Change-Id: I64dd5f5be4a0ecc64b30758a72f8b4281c17924b
Reviewed-by: Lars Knoll <lars.knoll@digia.com>
Reviewed-by: Konstantin Ritt <ritt.ks@gmail.com>
2015-04-10 15:37:06 +00:00
Konstantin Ritt
5b5d25cc41 [QtFontFamily] Get rid of unused member
Change-Id: I8c70995767bfb5fdbd6e9e9464029beeccf41f53
Reviewed-by: Friedemann Kleint <Friedemann.Kleint@theqtcompany.com>
Reviewed-by: Simon Hausmann <simon.hausmann@theqtcompany.com>
2015-04-08 15:17:47 +00:00
Friedemann Kleint
a21a24ee48 [QFontEngineFT::loadGlyph] Fix reversed condition.
Introduced by 237cb0d082
(Consolidate paths for fetchMetricsOnly cases).

Task-number: QTBUG-45444
Change-Id: Icd642c09490f1cfc5804313d60d467290ae599ba
Reviewed-by: Friedemann Kleint <Friedemann.Kleint@theqtcompany.com>
Reviewed-by: Laszlo Agocs <laszlo.agocs@theqtcompany.com>
2015-04-08 12:10:12 +00:00
Konstantin Ritt
237cb0d082 [QFontEngineFT::loadGlyph] Consolidate paths for fetchMetricsOnly cases
Use GlyphInfo as a temporary buffer for storing the glyph metrics
and go through the same code for fetchMetricsOnly and !fetchMetricsOnly.

Change-Id: If8bb85056e5f09588cc3956b43dc51a54d5aecfe
Reviewed-by: Friedemann Kleint <Friedemann.Kleint@theqtcompany.com>
Reviewed-by: Lars Knoll <lars.knoll@digia.com>
2015-04-07 13:09:27 +00:00
Konstantin Ritt
550fb85b65 [QFontEngineFT] Move code around to improve readability (no-op)
Move some variables initialization closer to the usage context.

Change-Id: I0f1de0ddc9f0fbe3ec4a56455ccc14f9e8d94e5a
Reviewed-by: Friedemann Kleint <Friedemann.Kleint@theqtcompany.com>
Reviewed-by: Lars Knoll <lars.knoll@digia.com>
2015-04-07 13:09:00 +00:00
Konstantin Ritt
037ad03182 [QFontEngineFT] Avoid double-negation of info.x
Make it consistent with fetchMetricsOnly path.

Change-Id: I6a2d2568d5579255582217515a4e598722547c60
Reviewed-by: Friedemann Kleint <Friedemann.Kleint@theqtcompany.com>
Reviewed-by: Lars Knoll <lars.knoll@digia.com>
2015-04-07 13:08:02 +00:00
Konstantin Ritt
3fb6014ce7 [QFontEngineFT] Guarantee correct metrics for alphamap and its bounding box
...for both cached and non-cached modes, by disabling hinting
for transformed glyphs in loadGlyphFor().

Change-Id: I13766a653ebd72cbed0f5c38ca3536d042aed762
Reviewed-by: Lars Knoll <lars.knoll@digia.com>
2015-04-07 13:07:40 +00:00
Konstantin Ritt
134c6db858 [QFontEngineFT] Consolidate .*lpha.*MapForGlyph() behavior
...and decrease code duplication.

Change-Id: I5eb3c0694dde9030405a3bd3d410ff9784ed7717
Reviewed-by: Lars Knoll <lars.knoll@digia.com>
2015-04-07 13:06:55 +00:00
Liang Qi
ce9519593a Merge remote-tracking branch 'origin/5.4' into 5.5
Conflicts:
	mkspecs/android-g++/qmake.conf
	qmake/generators/unix/unixmake2.cpp
	src/gui/image/qimage_conversions.cpp

Change-Id: Ib76264b8c2d29a0228438ec02bd97d4b97545be0
2015-03-31 10:03:31 +02:00
Friedemann Kleint
3203ac3f4e Use QDebugStateSaver to restore space setting in stream operators.
Returning dbg.space() breaks formatting on streams that already
have nospace() set.

Change-Id: I55e38b018679a67eb40be6b4664505483a3a7d8e
Reviewed-by: David Faure <david.faure@kdab.com>
2015-03-30 12:59:58 +00:00
Andrew Knight
d1ee1c52d1 Fix "'QCss::Property' is not a class or namespace"
As reported by GCC 4.9.2 x86_64-linux-gnu. The error message is correct;
QCss::Property is the name of an enum.

Change-Id: I9fb29d39ac11a644b7b08227f102594b3f3017f0
Reviewed-by: Konstantin Ritt <ritt.ks@gmail.com>
Reviewed-by: Debao Zhang <hello@debao.me>
Reviewed-by: Simon Hausmann <simon.hausmann@theqtcompany.com>
Reviewed-by: Andy Shaw <andy.shaw@digia.com>
2015-03-30 06:12:59 +00:00
Konstantin Ritt
dec451cf67 Update Unicode data up to v7.0
* Two newly adopted currency symbols:
  the Azerbaijan manat and the Russia ruble
* Pictographic symbols (including many emoji), geometric symbols,
  arrows, and ornaments originating from the Wingdings and Webdings sets
* Twenty-three new lesser-used and historic scripts
  extending support for written languages of North America, China, India,
  other Asian countries, and Africa
* Letters used in Teuthonista and other transcriptional systems,
  and a new notational set, Duployan

For more details, see http://www.unicode.org/versions/Unicode7.0.0/

The Properties struct's .*Diff members were narrowed down
to signed 15 bits and the unicodeVersion has been expanded to 8 bits.

[ChangeLog][QtCore] Unicode data updated to v.7.0

Change-Id: I93ab6f79fa3b05f61abc7279f1d046834c1c1a0b
Reviewed-by: Lars Knoll <lars.knoll@digia.com>
2015-03-27 16:40:06 +00:00
Konstantin Ritt
cd1cdd1516 Fix soft-hyphen appearance at line-break
Replace it with '-' and set dontPrint to true;
later we unset the dontPrint flag if soft-hyphen appears at the
end of a line after line breaking.

Task-number: QTBUG-44234
Change-Id: I05b69bcbbe07e1ee8a5d35d24372356ce8ab9db8
Reviewed-by: Eskil Abrahamsen Blomfeldt <eskil.abrahamsen-blomfeldt@theqtcompany.com>
2015-03-26 20:00:45 +00:00
Konstantin Ritt
cfe3ac9c65 Set dontPrint flag for the respective glyph
The str_pos variable hasn't been incremented prior to string[str_pos].
Ouch!

Change-Id: I54a160c26e23821037bf6ee8aea3e0a94a5e71f9
Reviewed-by: Eskil Abrahamsen Blomfeldt <eskil.abrahamsen-blomfeldt@theqtcompany.com>
2015-03-26 20:00:41 +00:00
Konstantin Ritt
a8e3245b50 Better detection of Symbol fonts
> Symbol character sets have a special meaning.
> If the symbol bit (31) is set, and the font file contains a 'cmap'
> subtable for platform of 3 and encoding ID of 1,
> then all of the characters in the Unicode range 0xF000 - 0xF0FF
> (inclusive) will be used to enumerate the symbol character set.

If we detected the font has a symbol character set, report no other
writing systems support.

Change-Id: I1030f3339c166ffd03c7caee1b1b26010dfdc314
Reviewed-by: Eskil Abrahamsen Blomfeldt <eskil.abrahamsen-blomfeldt@theqtcompany.com>
2015-03-26 20:00:38 +00:00
Konstantin Ritt
951e8a52ae Detect Thai writing system support from the font's Code Page Bitfields
https://msdn.microsoft.com/en-us/library/windows/desktop/dd317754(v=vs.85).aspx

Change-Id: I893746210dc71b9de6f6c064fd9fcaf6340e3c71
Reviewed-by: Eskil Abrahamsen Blomfeldt <eskil.abrahamsen-blomfeldt@theqtcompany.com>
2015-03-26 20:00:35 +00:00
Andy Shaw
2e4a107e7e Ensure that CSS rules are inherited from the parent tags
When CSS is set in a head tag then it was not being inherited by the child
tags when the CSS specification indicates that the properties are in fact
inherited. This ensures that those properties are inherited and the non
inheritable ones are unchanged.

A test is added to cover the different situations with inheritance and a
fix is done for the QTextDocumentFragment test which was passing despite
having incorrect defaults.

Task-number: QTBUG-28770
Task-number: QTBUG-34153
Change-Id: I55966240845a885852a04ecb82c61926dea9f800
Reviewed-by: Simon Hausmann <simon.hausmann@theqtcompany.com>
2015-03-25 11:55:47 +00:00
Konstantin Ritt
202a3deec7 [QFontEngineFT] Get rid of redundant lockFace()/unlockFace() calls
loadGlyphFor() locks the face when needed.

Change-Id: Ia02dce08243499f9f11b345dcdfa5d9e0a3bc889
Reviewed-by: Lars Knoll <lars.knoll@digia.com>
2015-03-20 13:43:08 +00:00
Konstantin Ritt
7cd1c0e420 [QFontEngineFT] Fix memory leaks and possible double deletions
The glyph returned by loadGlyph() must be freed manually when caching
is not enabled, except when it is a placeholder for a missing glyph.
This is a fix-up for d18ccbb5be.

Task-number: QTBUG-32792
Task-number: QTBUG-44812
Change-Id: I410fa1b7703e306739d9dae35fff06af6c79dce0
Reviewed-by: Lars Knoll <lars.knoll@digia.com>
2015-03-20 13:43:05 +00:00
Allan Sandfeld Jensen
90461979bc Avoid using the current frame as the previous in layout
When continuing a previous layout, we would in some cases add a wrong
margin because we would treat the current frame as preceding itself.

Task-number: QTBUG-42269
Change-Id: Idf00fadbed890ce34b073cf670cc9b8e1d4b0d5d
Reviewed-by: Lars Knoll <lars.knoll@digia.com>
2015-03-18 22:55:47 +00:00
Konstantin Ritt
fd826c112e [QFontEngineFT] Fix alphamap creation for a cached glyph with no data
In case the loadGlyph() was called for a glyph to fetch metrics only,
loadGlyphFor() never fetches the data for that glyph
but returns a non-null result.

Change-Id: I2b258c4b7880059d41dc02f1e5a43903706d3888
Reviewed-by: Lars Knoll <lars.knoll@digia.com>
2015-03-12 07:43:15 +00:00
Konstantin Ritt
69504803a9 [QFontEngineFT] Avoid caching a transformed glyph in defaultGlyphSet
and only cache non-scalable glyphs in defaultGlyphSet
if a requested transform is translation.

Change-Id: I49d936736871bd455e573335c014ddefe8bb915e
Reviewed-by: Lars Knoll <lars.knoll@digia.com>
2015-03-12 07:42:58 +00:00
Konstantin Ritt
08aa2c9297 [QFontEngineFT] Move some code around to improve readability
And avoid conversion when the cached FT transform could be used.

Change-Id: I9f6bf0a6c6fa166092de698f3ddbbf203e2b3820
Reviewed-by: Lars Knoll <lars.knoll@digia.com>
2015-03-12 07:42:32 +00:00
Konstantin Ritt
066daf750f Unbreak QTextLine::glyphRuns() in a multi-threaded usage scenario
QFontEngineMulti expects the fallback families list to be initialized
prior to the first call to engine(int), however in some scenarios,
the initialized and cached engine gets destroyed and re-created later,
with no fallback families list set, which causes an assertion.

Change-Id: I8d19cc91f3a067f6bf77b36bd87010dd967b4c49
Reviewed-by: Lars Knoll <lars.knoll@digia.com>
2015-03-12 07:41:52 +00:00
Thiago Macieira
ce30394686 QtGui: Fix const correctness in old style casts
Found with GCC's -Wcast-qual.

Change-Id: Ia0aac2f09e9245339951ffff13c946844bc31eb8
Reviewed-by: Allan Sandfeld Jensen <allan.jensen@theqtcompany.com>
2015-03-12 04:23:50 +00:00
Konstantin Ritt
bad3325c0b [QFontEngineFT] Use QScopedArrayPointer to auto-free the bitmap buffer
Also track the allocated buffer length and re-use the existing
buffer instead of allocating a smaller one, where possible.

Change-Id: I494519d653522622b1fe4ec80ac9035e2c3d9714
Reviewed-by: Friedemann Kleint <Friedemann.Kleint@theqtcompany.com>
Reviewed-by: Lars Knoll <lars.knoll@digia.com>
2015-03-11 21:47:33 +00:00
Konstantin Ritt
6ca406d43d Bring harfbuzzng.pri naming in par with the other .pri-s in src/3rdparty
Change-Id: I59bf922e3085a03a4c2c370f42418cb005456d3e
Reviewed-by: Oswald Buddenhagen <oswald.buddenhagen@theqtcompany.com>
2015-03-11 21:46:58 +00:00
Konstantin Ritt
58073a02fc [QFontEngineFT] Use FT_Library associated with a given face
Change-Id: I4f9927e2c5cb014523bebbe9c719aca89bb86019
Reviewed-by: Friedemann Kleint <Friedemann.Kleint@theqtcompany.com>
Reviewed-by: Simon Hausmann <simon.hausmann@theqtcompany.com>
2015-03-09 12:34:56 +00:00
Martin Smith
94bad40392 qdoc: Remove unnecessary ifndef Q_QDOC
It was preventing some functions in the Qt namespace
from being documented and hence auto-links to these
functions failed.

Change-Id: Ie820eb7c8172deac40554e993e4d61a765a616f4
Task-number: QTBUG-44688
Reviewed-by: Topi Reiniö <topi.reinio@digia.com>
2015-03-07 09:47:13 +00:00
Oswald Buddenhagen
2b5982aac8 Merge remote-tracking branch 'origin/5.4' into 5.5
Change-Id: I95b3a87c5068c6b8068b30a35655b4c2419e7f9e
2015-03-02 09:23:07 +01:00
Joni Poikelin
fc3733cba4 Fix drawing of background for multipage QTextTable cells
Task-number: QTBUG-31330
Change-Id: I0103919ee2864b7cd8bed41e6d6fe4ac5b84142e
Reviewed-by: Lars Knoll <lars.knoll@digia.com>
2015-03-02 06:07:18 +00:00
Friedemann Kleint
28fedba03b Fix various qdoc-warnings.
qtbase/src/corelib/itemmodels/qitemselectionmodel.cpp:1199: warning: Undocumented parameter 'model' in QItemSelectionModel::modelChanged()
qtbase/src/corelib/plugin/qpluginloader.cpp:420: warning: Can't link to 'staticPlugin()'
qtbase/src/gui/text/qtextdocument.cpp:1452: warning: No such parameter 'from' in QTextDocument::find()
qtbase/src/testlib/qtestcase.cpp:2770: warning: No documentation for 'QTest::qExtractTestData()'

Change-Id: I76758dbdf3ad7b0ae1f14de0407a6fde523827d0
Reviewed-by: Konstantin Ritt <ritt.ks@gmail.com>
2015-02-25 15:26:04 +00:00
Michael Brasser
bf16940d33 Allow QDistanceField to be directly constructed from a QPainterPath.
Enables optimization in the case of an already existing QPainterPath.

Change-Id: I7f038673ce245ea19e400e6d2c728f07cb55e366
Task-number: QTBUG-42853
Reviewed-by: Lars Knoll <lars.knoll@digia.com>
Reviewed-by: Yoann Lopes <yoann.lopes@theqtcompany.com>
Reviewed-by: Gunnar Sletta <gunnar@sletta.org>
2015-02-25 14:35:46 +00:00
Friedemann Kleint
7bbde34ee0 Fix invocations of static methods of QGuiApplication/QApplication.
Change-Id: I99ba58763f6063fa2a6f511adbea0163cce7ea32
Reviewed-by: Konstantin Ritt <ritt.ks@gmail.com>
Reviewed-by: Shawn Rutledge <shawn.rutledge@digia.com>
2015-02-25 14:06:27 +00:00
Frederik Gladhorn
34b14a8472 Merge remote-tracking branch 'origin/5.4' into 5.5
Conflicts:
	examples/xml/htmlinfo/simpleexample.html
	examples/xml/rsslisting/rsslisting.cpp
	qmake/generators/win32/msbuild_objectmodel.cpp
	src/3rdparty/harfbuzz-ng/src/hb-private.hh
	src/corelib/global/qlogging.cpp
	src/corelib/io/qstorageinfo_unix.cpp
	src/corelib/thread/qwaitcondition_unix.cpp
	src/gui/kernel/qguiapplication.cpp
	src/plugins/platforms/linuxfb/qlinuxfbintegration.cpp
	src/testlib/doc/src/qt-webpages.qdoc
	tests/auto/other/qaccessibility/tst_qaccessibility.cpp

Change-Id: Ib272ff0bc30a1a5d51275eb3cd2f201dc82c11ff
2015-02-24 21:02:08 +01:00
Friedemann Kleint
7113bb23ba Add explanatory text to translated strings in font database.
Notify the translator that those are substrings used for searching.

Change-Id: I242f701ff23929fe84099c40a696acfca3388f7b
Reviewed-by: Konstantin Ritt <ritt.ks@gmail.com>
2015-02-20 00:21:34 +00:00
Konstantin Ritt
1214e59e73 [QFreetypeFace::addBitmapToPath] Get rid of unused param
Change-Id: I09bd94c1c82ce198406dd71e96311e56cbfe0ab5
Reviewed-by: Friedemann Kleint <Friedemann.Kleint@theqtcompany.com>
2015-02-20 00:20:14 +00:00
Allan Sandfeld Jensen
515e802ae2 Use C++ <cmath> instead of <math.h>
Including math.h can pollute the default namespace, and break
some compilers if cmath versions of the method are declared as using.

Switching to C++ math functions also greatly simplifies handling of
float qreal as C++ automatically chooses the right method.

[ChangeLog][QtCore][QtMath] qmath.h no longer includes math.h, so any
sources depending on that indirect inclusion may fail to build.

Change-Id: I4d0e331dafba354ec05dc5052e61ef4ff8d387fe
Reviewed-by: Rafael Roquetto <rafael.roquetto@kdab.com>
2015-02-16 16:21:15 +00:00
Robin Burchell
dbd21d0879 QTextLayout: Reserve space ahead of time.
We know the size, so use it instead of allowing QVector to reallocate.

Change-Id: I2d18c30ef0d050326bb03c54da61459c40eb7af6
Reviewed-by: Konstantin Ritt <ritt.ks@gmail.com>
2015-02-15 03:50:26 +00:00
Robin Burchell
ce86d73850 QFontDatabase: Move style key near usage to avoid heap allocs
Raises delegates_text.qml to 233 ops/frame

Change-Id: I88a26d2a9e4dc12ebbbc07329141976c194555ec
Reviewed-by: Konstantin Ritt <ritt.ks@gmail.com>
2015-02-15 03:49:46 +00:00
Robin Burchell
5a23fcfa8a QFontDatabase: Optimize QtFontStyle::Key::Key().
Similar to 46b2c74eaf, skip the translations at
all costs. They allocate, and are very expensive. To ensure we try harder to
skip them, also avoid checking styles at all unless one has been provided.

This increases delegates_text from 209 items to 221 items for me.

Change-Id: Ia18b07de7b48cee356e9506a0c5d7129621d79d2
Reviewed-by: Konstantin Ritt <ritt.ks@gmail.com>
2015-02-15 03:49:33 +00:00
Sérgio Martins
fbc3d75354 FreeType: Support RGB rendering when not using FontConfig
Windows+FreeType, Linux with -no-fontconfig and the forthcoming
OSX FreeType engine can now use sub pixel rendering.

The function to get the subpixel type is in QPlatformScreen because
we're moving to per screen font settings in the future.

This patch is safe, as no functionality is changed for existing users,
if one wants sub pixel rendering they'll still have to pass -DFT_CONFIG_OPTION_SUBPIXEL_RENDERING
to configure.

Task-number: QTBUG-44269
Change-Id: Ib6c22d48a1b7c7b85ee316d5d9e3b6eae0c1ecc0
Reviewed-by: Allan Sandfeld Jensen <allan.jensen@theqtcompany.com>
Reviewed-by: Eskil Abrahamsen Blomfeldt <eskil.abrahamsen-blomfeldt@theqtcompany.com>
2015-02-14 01:15:11 +00:00
Konstantin Ritt
9b67d89c24 Pass params of shareable type by const-ref rather than by value
...where passing them by value was not intentional.

Change-Id: Ifd5036d57b41fddeeacfbd3f5890881605b80647
Reviewed-by: Shawn Rutledge <shawn.rutledge@digia.com>
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
2015-02-13 16:29:16 +00:00
Jani Heikkinen
83a5694dc2 Update copyright headers
Qt copyrights are now in The Qt Company, so we could update the source
code headers accordingly. In the same go we should also fix the links to
point to qt.io.

Outdated header.LGPL removed (use header.LGPL21 instead)

Old header.LGPL3 renamed to header.LGPL3-COMM to match actual licensing
combination. New header.LGPL-COMM taken in the use file which were
using old header.LGPL3 (src/plugins/platforms/android/extract.cpp)

Added new header.LGPL3 containing Commercial + LGPLv3 + GPLv2 license
combination

Change-Id: I6f49b819a8a20cc4f88b794a8f6726d975e8ffbe
Reviewed-by: Matti Paaso <matti.paaso@theqtcompany.com>
2015-02-11 06:49:51 +00:00
Frederik Gladhorn
51ce5b4829 Merge remote-tracking branch 'origin/5.4.1' into 5.4
Change-Id: I9d668a655b548feab43e9d4b03e2437bdff76437
2015-02-10 09:55:09 +01:00
Frederik Gladhorn
fc35f71434 Merge remote-tracking branch 'origin/5.4' into dev
Conflicts:
	src/3rdparty/harfbuzz-ng/harfbuzz-ng.pro
	src/gui/image/qimage_conversions.cpp
	src/gui/opengl/qopenglextensions_p.h
	src/gui/text/qtextengine.cpp
	src/network/ssl/qsslsocket_openssl.cpp
	src/plugins/platforms/eglfs/qeglfshooks_stub.cpp
	src/plugins/platforms/eglfs/qeglfsscreen.cpp
	src/plugins/platforms/eglfs/qeglfswindow.cpp
	src/plugins/platforms/windows/qwindowsfontdatabase.cpp
	src/plugins/platforms/windows/qwindowsfontdatabase_ft.cpp
	src/plugins/platforms/windows/qwindowsnativeinterface.cpp
	src/plugins/platforms/windows/qwindowsscreen.cpp
	src/plugins/platforms/windows/qwindowswindow.cpp
	src/plugins/platforms/windows/qwindowswindow.h
	src/plugins/platforms/xcb/qxcbdrag.h
	src/widgets/itemviews/qabstractitemview.cpp
	src/widgets/kernel/qwidget.cpp
	src/widgets/util/qsystemtrayicon_p.h
	tests/auto/corelib/itemmodels/qsortfilterproxymodel/tst_qsortfilterproxymodel.cpp

Thanks to Friedemann Kleint for resolving the qwindowsfontdatabase.cpp
conflicts.

Change-Id: I937232c30523d5121c195d947d92aec6f129b03e
2015-02-10 09:42:25 +01:00
Maks Naumov
c2f26d6d0b Use prefix instead of postfix for iterators
The postfix increment(decrement) creates a temp copy of *this before the
modification and then returns that copy. It's needed only when using the
old iterator and then incrementing it.

Change-Id: I7f6702de78f5f987cec3556047e76049b4ee063a
Reviewed-by: Konstantin Ritt <ritt.ks@gmail.com>
Reviewed-by: Marc Mutz <marc.mutz@kdab.com>
2015-02-08 12:25:12 +00:00
Olivier Goffart
e768d96e8b QtGui: use Q_ENUM instead of Q_ENUMS
Change-Id: I92ac2ea218e9134aa36ecb179b8ae790a2dba56a
Reviewed-by: Marc Mutz <marc.mutz@kdab.com>
2015-02-08 12:18:52 +00:00