summaryrefslogtreecommitdiffstats
path: root/src
diff options
context:
space:
mode:
Diffstat (limited to 'src')
-rw-r--r--src/3rdparty/harfbuzz-ng/NEWS276
-rw-r--r--src/3rdparty/harfbuzz-ng/README9
-rw-r--r--src/3rdparty/harfbuzz-ng/harfbuzz-ng.pro19
-rw-r--r--src/3rdparty/harfbuzz-ng/include/harfbuzz/hb-ot-var.h1
-rw-r--r--src/3rdparty/harfbuzz-ng/patches/0001-Qt-specific-workaround-for-AAT-shaper.patch58
-rw-r--r--src/3rdparty/harfbuzz-ng/qt_attribution.json2
-rw-r--r--src/3rdparty/harfbuzz-ng/src/hb-atomic-private.hh12
-rw-r--r--src/3rdparty/harfbuzz-ng/src/hb-blob.cc27
-rw-r--r--src/3rdparty/harfbuzz-ng/src/hb-buffer-private.hh144
-rw-r--r--src/3rdparty/harfbuzz-ng/src/hb-buffer-serialize.cc42
-rw-r--r--src/3rdparty/harfbuzz-ng/src/hb-buffer.cc230
-rw-r--r--src/3rdparty/harfbuzz-ng/src/hb-buffer.h67
-rw-r--r--src/3rdparty/harfbuzz-ng/src/hb-common.cc470
-rw-r--r--src/3rdparty/harfbuzz-ng/src/hb-common.h60
-rw-r--r--src/3rdparty/harfbuzz-ng/src/hb-coretext.cc337
-rw-r--r--src/3rdparty/harfbuzz-ng/src/hb-coretext.h4
-rw-r--r--src/3rdparty/harfbuzz-ng/src/hb-debug.hh431
-rw-r--r--src/3rdparty/harfbuzz-ng/src/hb-deprecated.h4
-rw-r--r--src/3rdparty/harfbuzz-ng/src/hb-dsalgs.hh167
-rw-r--r--src/3rdparty/harfbuzz-ng/src/hb-face-private.hh12
-rw-r--r--src/3rdparty/harfbuzz-ng/src/hb-face.cc53
-rw-r--r--src/3rdparty/harfbuzz-ng/src/hb-face.h5
-rw-r--r--src/3rdparty/harfbuzz-ng/src/hb-fallback-shape.cc8
-rw-r--r--src/3rdparty/harfbuzz-ng/src/hb-font-private.hh2
-rw-r--r--src/3rdparty/harfbuzz-ng/src/hb-font.cc210
-rw-r--r--src/3rdparty/harfbuzz-ng/src/hb-font.h29
-rw-r--r--src/3rdparty/harfbuzz-ng/src/hb-mutex-private.hh2
-rw-r--r--src/3rdparty/harfbuzz-ng/src/hb-object-private.hh10
-rw-r--r--src/3rdparty/harfbuzz-ng/src/hb-open-file-private.hh56
-rw-r--r--src/3rdparty/harfbuzz-ng/src/hb-open-type-private.hh277
-rw-r--r--src/3rdparty/harfbuzz-ng/src/hb-ot-cbdt-table.hh183
-rw-r--r--src/3rdparty/harfbuzz-ng/src/hb-ot-cmap-table.hh247
-rw-r--r--src/3rdparty/harfbuzz-ng/src/hb-ot-font.cc534
-rw-r--r--src/3rdparty/harfbuzz-ng/src/hb-ot-glyf-table.hh120
-rw-r--r--src/3rdparty/harfbuzz-ng/src/hb-ot-head-table.hh28
-rw-r--r--src/3rdparty/harfbuzz-ng/src/hb-ot-hhea-table.hh23
-rw-r--r--src/3rdparty/harfbuzz-ng/src/hb-ot-hmtx-table.hh123
-rw-r--r--src/3rdparty/harfbuzz-ng/src/hb-ot-kern-table.hh394
-rw-r--r--src/3rdparty/harfbuzz-ng/src/hb-ot-layout-common-private.hh261
-rw-r--r--src/3rdparty/harfbuzz-ng/src/hb-ot-layout-gdef-table.hh32
-rw-r--r--src/3rdparty/harfbuzz-ng/src/hb-ot-layout-gpos-table.hh142
-rw-r--r--src/3rdparty/harfbuzz-ng/src/hb-ot-layout-gsub-table.hh102
-rw-r--r--src/3rdparty/harfbuzz-ng/src/hb-ot-layout-gsubgpos-private.hh478
-rw-r--r--src/3rdparty/harfbuzz-ng/src/hb-ot-layout-jstf-table.hh4
-rw-r--r--src/3rdparty/harfbuzz-ng/src/hb-ot-layout-private.hh44
-rw-r--r--src/3rdparty/harfbuzz-ng/src/hb-ot-layout.cc91
-rw-r--r--src/3rdparty/harfbuzz-ng/src/hb-ot-map-private.hh38
-rw-r--r--src/3rdparty/harfbuzz-ng/src/hb-ot-map.cc25
-rw-r--r--src/3rdparty/harfbuzz-ng/src/hb-ot-math-table.hh722
-rw-r--r--src/3rdparty/harfbuzz-ng/src/hb-ot-math.cc33
-rw-r--r--src/3rdparty/harfbuzz-ng/src/hb-ot-maxp-table.hh2
-rw-r--r--src/3rdparty/harfbuzz-ng/src/hb-ot-name-table.hh24
-rw-r--r--src/3rdparty/harfbuzz-ng/src/hb-ot-os2-table.hh70
-rw-r--r--src/3rdparty/harfbuzz-ng/src/hb-ot-post-macroman.hh294
-rw-r--r--src/3rdparty/harfbuzz-ng/src/hb-ot-post-table.hh187
-rw-r--r--src/3rdparty/harfbuzz-ng/src/hb-ot-shape-complex-arabic-fallback.hh18
-rw-r--r--src/3rdparty/harfbuzz-ng/src/hb-ot-shape-complex-arabic-table.hh29
-rw-r--r--src/3rdparty/harfbuzz-ng/src/hb-ot-shape-complex-arabic-win1256.hh32
-rw-r--r--src/3rdparty/harfbuzz-ng/src/hb-ot-shape-complex-arabic.cc134
-rw-r--r--src/3rdparty/harfbuzz-ng/src/hb-ot-shape-complex-default.cc22
-rw-r--r--src/3rdparty/harfbuzz-ng/src/hb-ot-shape-complex-hangul.cc36
-rw-r--r--src/3rdparty/harfbuzz-ng/src/hb-ot-shape-complex-hebrew.cc20
-rw-r--r--src/3rdparty/harfbuzz-ng/src/hb-ot-shape-complex-indic-machine.hh1616
-rw-r--r--src/3rdparty/harfbuzz-ng/src/hb-ot-shape-complex-indic-private.hh11
-rw-r--r--src/3rdparty/harfbuzz-ng/src/hb-ot-shape-complex-indic-table.cc92
-rw-r--r--src/3rdparty/harfbuzz-ng/src/hb-ot-shape-complex-indic.cc129
-rw-r--r--src/3rdparty/harfbuzz-ng/src/hb-ot-shape-complex-myanmar-machine.hh378
-rw-r--r--src/3rdparty/harfbuzz-ng/src/hb-ot-shape-complex-myanmar.cc52
-rw-r--r--src/3rdparty/harfbuzz-ng/src/hb-ot-shape-complex-private.hh58
-rw-r--r--src/3rdparty/harfbuzz-ng/src/hb-ot-shape-complex-thai.cc35
-rw-r--r--src/3rdparty/harfbuzz-ng/src/hb-ot-shape-complex-tibetan.cc20
-rw-r--r--src/3rdparty/harfbuzz-ng/src/hb-ot-shape-complex-use-machine.hh437
-rw-r--r--src/3rdparty/harfbuzz-ng/src/hb-ot-shape-complex-use-private.hh3
-rw-r--r--src/3rdparty/harfbuzz-ng/src/hb-ot-shape-complex-use-table.cc147
-rw-r--r--src/3rdparty/harfbuzz-ng/src/hb-ot-shape-complex-use.cc44
-rw-r--r--src/3rdparty/harfbuzz-ng/src/hb-ot-shape-fallback.cc9
-rw-r--r--src/3rdparty/harfbuzz-ng/src/hb-ot-shape-normalize.cc74
-rw-r--r--src/3rdparty/harfbuzz-ng/src/hb-ot-shape-private.hh6
-rw-r--r--src/3rdparty/harfbuzz-ng/src/hb-ot-shape.cc151
-rw-r--r--src/3rdparty/harfbuzz-ng/src/hb-ot-tag.cc110
-rw-r--r--src/3rdparty/harfbuzz-ng/src/hb-ot-var-avar-table.hh149
-rw-r--r--src/3rdparty/harfbuzz-ng/src/hb-ot-var-fvar-table.hh209
-rw-r--r--src/3rdparty/harfbuzz-ng/src/hb-ot-var-hvar-table.hh165
-rw-r--r--src/3rdparty/harfbuzz-ng/src/hb-ot-var-mvar-table.hh114
-rw-r--r--src/3rdparty/harfbuzz-ng/src/hb-ot-var.cc159
-rw-r--r--src/3rdparty/harfbuzz-ng/src/hb-ot-var.h105
-rw-r--r--src/3rdparty/harfbuzz-ng/src/hb-ot.h1
-rw-r--r--src/3rdparty/harfbuzz-ng/src/hb-private.hh587
-rw-r--r--src/3rdparty/harfbuzz-ng/src/hb-set-digest-private.hh179
-rw-r--r--src/3rdparty/harfbuzz-ng/src/hb-set-private.hh647
-rw-r--r--src/3rdparty/harfbuzz-ng/src/hb-set.cc9
-rw-r--r--src/3rdparty/harfbuzz-ng/src/hb-set.h3
-rw-r--r--src/3rdparty/harfbuzz-ng/src/hb-shape-plan.cc65
-rw-r--r--src/3rdparty/harfbuzz-ng/src/hb-shape.cc258
-rw-r--r--src/3rdparty/harfbuzz-ng/src/hb-shape.h16
-rw-r--r--src/3rdparty/harfbuzz-ng/src/hb-shaper-private.hh32
-rw-r--r--src/3rdparty/harfbuzz-ng/src/hb-shaper.cc6
-rw-r--r--src/3rdparty/harfbuzz-ng/src/hb-string-array.hh81
-rw-r--r--src/3rdparty/harfbuzz-ng/src/hb-unicode-private.hh33
-rw-r--r--src/3rdparty/harfbuzz-ng/src/hb-unicode.cc4
-rw-r--r--src/3rdparty/harfbuzz-ng/src/hb-utf-private.hh18
-rw-r--r--src/3rdparty/harfbuzz-ng/src/hb-version.h6
-rw-r--r--src/android/jar/bundledjar.pro3
-rw-r--r--src/android/jar/distributedjar.pro2
-rw-r--r--src/android/jar/jar.pri26
-rw-r--r--src/android/jar/jar.pro30
-rw-r--r--src/concurrent/doc/snippets/code/src_concurrent_qtconcurrentfilter.cpp14
-rw-r--r--src/concurrent/doc/snippets/code/src_concurrent_qtconcurrentmap.cpp12
-rw-r--r--src/concurrent/qtconcurrentexception.h9
-rw-r--r--src/concurrent/qtconcurrentfilter.cpp92
-rw-r--r--src/concurrent/qtconcurrentfilter.h60
-rw-r--r--src/concurrent/qtconcurrentfilterkernel.h8
-rw-r--r--src/concurrent/qtconcurrentfunctionwrappers.h6
-rw-r--r--src/concurrent/qtconcurrentiteratekernel.cpp50
-rw-r--r--src/concurrent/qtconcurrentiteratekernel.h6
-rw-r--r--src/concurrent/qtconcurrentmap.cpp143
-rw-r--r--src/concurrent/qtconcurrentmap.h50
-rw-r--r--src/concurrent/qtconcurrentmapkernel.h9
-rw-r--r--src/concurrent/qtconcurrentmedian.h4
-rw-r--r--src/concurrent/qtconcurrentreducekernel.h20
-rw-r--r--src/concurrent/qtconcurrentrun.cpp9
-rw-r--r--src/concurrent/qtconcurrentrun.h7
-rw-r--r--src/concurrent/qtconcurrentthreadengine.cpp42
-rw-r--r--src/concurrent/qtconcurrentthreadengine.h12
-rw-r--r--src/corelib/animation/qabstractanimation.h10
-rw-r--r--src/corelib/animation/qabstractanimation_p.h10
-rw-r--r--src/corelib/animation/qanimationgroup.h4
-rw-r--r--src/corelib/animation/qparallelanimationgroup.h12
-rw-r--r--src/corelib/animation/qparallelanimationgroup_p.h2
-rw-r--r--src/corelib/animation/qpauseanimation.h10
-rw-r--r--src/corelib/animation/qpropertyanimation.h10
-rw-r--r--src/corelib/animation/qsequentialanimationgroup.h12
-rw-r--r--src/corelib/animation/qsequentialanimationgroup_p.h4
-rw-r--r--src/corelib/animation/qvariantanimation.h12
-rw-r--r--src/corelib/arch/qatomic_cxx11.h8
-rw-r--r--src/corelib/codecs/qiconvcodec.cpp4
-rw-r--r--src/corelib/codecs/qicucodec_p.h10
-rw-r--r--src/corelib/codecs/qisciicodec_p.h8
-rw-r--r--src/corelib/codecs/qlatincodec_p.h20
-rw-r--r--src/corelib/codecs/qtextcodec.cpp4
-rw-r--r--src/corelib/codecs/qtextcodec.h6
-rw-r--r--src/corelib/codecs/qtsciicodec_p.h8
-rw-r--r--src/corelib/codecs/qutfcodec_p.h52
-rw-r--r--src/corelib/corelib.pro7
-rw-r--r--src/corelib/global/global.pri21
-rw-r--r--src/corelib/global/qcompilerdetection.h33
-rw-r--r--src/corelib/global/qconfig-bootstrapped.h1
-rw-r--r--src/corelib/global/qendian.h4
-rw-r--r--src/corelib/global/qendian.qdoc84
-rw-r--r--src/corelib/global/qflags.h48
-rw-r--r--src/corelib/global/qfloat16.cpp97
-rw-r--r--src/corelib/global/qfloat16.h3
-rw-r--r--src/corelib/global/qfloat16_f16c.c89
-rw-r--r--src/corelib/global/qglobal.cpp341
-rw-r--r--src/corelib/global/qglobal.h70
-rw-r--r--src/corelib/global/qglobalstatic.qdoc12
-rw-r--r--src/corelib/global/qlogging.h17
-rw-r--r--src/corelib/global/qnamespace.h2
-rw-r--r--src/corelib/global/qnamespace.qdoc5
-rw-r--r--src/corelib/global/qnumeric_p.h3
-rw-r--r--src/corelib/global/qrandom.cpp142
-rw-r--r--src/corelib/global/qsysinfo.h2
-rw-r--r--src/corelib/global/qsystemdetection.h35
-rw-r--r--src/corelib/global/qversiontagging.cpp10
-rw-r--r--src/corelib/io/qbuffer.cpp4
-rw-r--r--src/corelib/io/qbuffer.h26
-rw-r--r--src/corelib/io/qdatastream.cpp5
-rw-r--r--src/corelib/io/qdatastream.h5
-rw-r--r--src/corelib/io/qdebug.cpp123
-rw-r--r--src/corelib/io/qdir.cpp1
-rw-r--r--src/corelib/io/qfile.h14
-rw-r--r--src/corelib/io/qfiledevice.h20
-rw-r--r--src/corelib/io/qfiledevice_p.h2
-rw-r--r--src/corelib/io/qfileselector.h2
-rw-r--r--src/corelib/io/qfilesystemiterator_unix.cpp17
-rw-r--r--src/corelib/io/qfilesystemwatcher.h4
-rw-r--r--src/corelib/io/qfilesystemwatcher_fsevents.mm2
-rw-r--r--src/corelib/io/qfilesystemwatcher_inotify_p.h4
-rw-r--r--src/corelib/io/qfilesystemwatcher_polling_p.h4
-rw-r--r--src/corelib/io/qfsfileengine.cpp12
-rw-r--r--src/corelib/io/qfsfileengine_iterator_p.h8
-rw-r--r--src/corelib/io/qfsfileengine_p.h70
-rw-r--r--src/corelib/io/qiodevice.h2
-rw-r--r--src/corelib/io/qiodevice_p.h4
-rw-r--r--src/corelib/io/qlockfile.cpp31
-rw-r--r--src/corelib/io/qlockfile_p.h16
-rw-r--r--src/corelib/io/qlockfile_unix.cpp2
-rw-r--r--src/corelib/io/qlockfile_win.cpp4
-rw-r--r--src/corelib/io/qnoncontiguousbytedevice_p.h58
-rw-r--r--src/corelib/io/qprocess.cpp9
-rw-r--r--src/corelib/io/qprocess.h26
-rw-r--r--src/corelib/io/qprocess_p.h2
-rw-r--r--src/corelib/io/qprocess_unix.cpp2
-rw-r--r--src/corelib/io/qprocess_win.cpp4
-rw-r--r--src/corelib/io/qresource.cpp6
-rw-r--r--src/corelib/io/qresource_iterator_p.h6
-rw-r--r--src/corelib/io/qresource_p.h60
-rw-r--r--src/corelib/io/qsavefile.h10
-rw-r--r--src/corelib/io/qsettings.h12
-rw-r--r--src/corelib/io/qsettings_mac.cpp2
-rw-r--r--src/corelib/io/qsettings_p.h18
-rw-r--r--src/corelib/io/qstandardpaths_mac.mm29
-rw-r--r--src/corelib/io/qstandardpaths_unix.cpp4
-rw-r--r--src/corelib/io/qstorageinfo_mac.cpp6
-rw-r--r--src/corelib/io/qstorageinfo_unix.cpp239
-rw-r--r--src/corelib/io/qstorageinfo_win.cpp4
-rw-r--r--src/corelib/io/qtemporarydir.cpp6
-rw-r--r--src/corelib/io/qtemporarydir.h2
-rw-r--r--src/corelib/io/qtemporaryfile.h4
-rw-r--r--src/corelib/io/qtextstream.h4
-rw-r--r--src/corelib/io/qurl.h2
-rw-r--r--src/corelib/itemmodels/qabstractitemmodel.cpp16
-rw-r--r--src/corelib/itemmodels/qabstractitemmodel.h42
-rw-r--r--src/corelib/itemmodels/qabstractproxymodel.h46
-rw-r--r--src/corelib/itemmodels/qidentityproxymodel.h40
-rw-r--r--src/corelib/itemmodels/qitemselectionmodel.cpp10
-rw-r--r--src/corelib/itemmodels/qitemselectionmodel.h2
-rw-r--r--src/corelib/itemmodels/qsortfilterproxymodel.cpp7
-rw-r--r--src/corelib/itemmodels/qsortfilterproxymodel.h62
-rw-r--r--src/corelib/itemmodels/qstringlistmodel.h22
-rw-r--r--src/corelib/json/qjsonarray.h4
-rw-r--r--src/corelib/json/qjsondocument.cpp4
-rw-r--r--src/corelib/json/qjsondocument.h6
-rw-r--r--src/corelib/json/qjsonobject.h4
-rw-r--r--src/corelib/json/qjsonvalue.h2
-rw-r--r--src/corelib/kernel/qabstracteventdispatcher.cpp4
-rw-r--r--src/corelib/kernel/qabstracteventdispatcher.h10
-rw-r--r--src/corelib/kernel/qcore_unix.cpp2
-rw-r--r--src/corelib/kernel/qcore_unix_p.h2
-rw-r--r--src/corelib/kernel/qcoreapplication.cpp8
-rw-r--r--src/corelib/kernel/qcoreapplication.h10
-rw-r--r--src/corelib/kernel/qeventdispatcher_glib_p.h24
-rw-r--r--src/corelib/kernel/qeventdispatcher_unix_p.h26
-rw-r--r--src/corelib/kernel/qeventloop.h4
-rw-r--r--src/corelib/kernel/qfunctions_vxworks.h3
-rw-r--r--src/corelib/kernel/qjni.cpp2
-rw-r--r--src/corelib/kernel/qjnihelpers.cpp14
-rw-r--r--src/corelib/kernel/qjnionload.cpp2
-rw-r--r--src/corelib/kernel/qmetaobject.cpp46
-rw-r--r--src/corelib/kernel/qmetaobject.h38
-rw-r--r--src/corelib/kernel/qmetatype.h92
-rw-r--r--src/corelib/kernel/qobject.cpp11
-rw-r--r--src/corelib/kernel/qobject.h46
-rw-r--r--src/corelib/kernel/qobject_impl.h4
-rw-r--r--src/corelib/kernel/qobject_p.h16
-rw-r--r--src/corelib/kernel/qobjectdefs.h34
-rw-r--r--src/corelib/kernel/qobjectdefs_impl.h6
-rw-r--r--src/corelib/kernel/qpointer.cpp44
-rw-r--r--src/corelib/kernel/qsharedmemory.cpp8
-rw-r--r--src/corelib/kernel/qsharedmemory.h4
-rw-r--r--src/corelib/kernel/qsocketnotifier.h4
-rw-r--r--src/corelib/kernel/qsystemerror_p.h52
-rw-r--r--src/corelib/kernel/qtimer.cpp2
-rw-r--r--src/corelib/kernel/qtimer.h4
-rw-r--r--src/corelib/kernel/qtranslator.cpp2
-rw-r--r--src/corelib/kernel/qtranslator.h4
-rw-r--r--src/corelib/kernel/qvariant.h16
-rw-r--r--src/corelib/kernel/qvariant_p.h6
-rw-r--r--src/corelib/kernel/qwineventnotifier.h4
-rw-r--r--src/corelib/mimetypes/mimetypes.qrc2
-rw-r--r--src/corelib/mimetypes/qmimedatabase.cpp235
-rw-r--r--src/corelib/mimetypes/qmimedatabase_p.h27
-rw-r--r--src/corelib/mimetypes/qmimeglobpattern.cpp5
-rw-r--r--src/corelib/mimetypes/qmimeglobpattern_p.h2
-rw-r--r--src/corelib/mimetypes/qmimemagicrule.cpp2
-rw-r--r--src/corelib/mimetypes/qmimemagicrule_p.h2
-rw-r--r--src/corelib/mimetypes/qmimeprovider.cpp521
-rw-r--r--src/corelib/mimetypes/qmimeprovider_p.h80
-rw-r--r--src/corelib/mimetypes/qmimetype.cpp23
-rw-r--r--src/corelib/mimetypes/qmimetype_p.h3
-rw-r--r--src/corelib/mimetypes/qmimetypeparser.cpp1
-rw-r--r--src/corelib/plugin/qlibrary.h8
-rw-r--r--src/corelib/plugin/qpluginloader.h4
-rw-r--r--src/corelib/plugin/quuid.h12
-rw-r--r--src/corelib/statemachine/qabstractstate.h4
-rw-r--r--src/corelib/statemachine/qabstracttransition.cpp2
-rw-r--r--src/corelib/statemachine/qabstracttransition.h4
-rw-r--r--src/corelib/statemachine/qeventtransition.h10
-rw-r--r--src/corelib/statemachine/qfinalstate.h8
-rw-r--r--src/corelib/statemachine/qhistorystate.cpp2
-rw-r--r--src/corelib/statemachine/qhistorystate.h10
-rw-r--r--src/corelib/statemachine/qsignaltransition.h14
-rw-r--r--src/corelib/statemachine/qsignaltransition_p.h2
-rw-r--r--src/corelib/statemachine/qstate.cpp6
-rw-r--r--src/corelib/statemachine/qstate.h10
-rw-r--r--src/corelib/statemachine/qstatemachine.cpp14
-rw-r--r--src/corelib/statemachine/qstatemachine.h12
-rw-r--r--src/corelib/thread/qatomic.cpp182
-rw-r--r--src/corelib/thread/qatomic.h8
-rw-r--r--src/corelib/thread/qbasicatomic.h1
-rw-r--r--src/corelib/thread/qexception.cpp12
-rw-r--r--src/corelib/thread/qexception.h16
-rw-r--r--src/corelib/thread/qfutex_p.h142
-rw-r--r--src/corelib/thread/qfuture.h11
-rw-r--r--src/corelib/thread/qfuture.qdoc124
-rw-r--r--src/corelib/thread/qfutureinterface.cpp5
-rw-r--r--src/corelib/thread/qfutureinterface.h8
-rw-r--r--src/corelib/thread/qfutureinterface_p.h2
-rw-r--r--src/corelib/thread/qfuturesynchronizer.h3
-rw-r--r--src/corelib/thread/qfuturesynchronizer.qdoc20
-rw-r--r--src/corelib/thread/qfuturewatcher.cpp69
-rw-r--r--src/corelib/thread/qfuturewatcher.h24
-rw-r--r--src/corelib/thread/qfuturewatcher_p.h9
-rw-r--r--src/corelib/thread/qmutex.h10
-rw-r--r--src/corelib/thread/qmutex_linux.cpp83
-rw-r--r--src/corelib/thread/qreadwritelock.h4
-rw-r--r--src/corelib/thread/qresultstore.cpp4
-rw-r--r--src/corelib/thread/qresultstore.h12
-rw-r--r--src/corelib/thread/qsemaphore.cpp206
-rw-r--r--src/corelib/thread/qsemaphore.h5
-rw-r--r--src/corelib/thread/qthread.cpp20
-rw-r--r--src/corelib/thread/qthread.h6
-rw-r--r--src/corelib/thread/qthread_p.h5
-rw-r--r--src/corelib/thread/qthread_unix.cpp57
-rw-r--r--src/corelib/thread/qthreadpool.cpp2
-rw-r--r--src/corelib/thread/qthreadpool.h2
-rw-r--r--src/corelib/thread/thread.pri31
-rw-r--r--src/corelib/tools/qalgorithms.qdoc58
-rw-r--r--src/corelib/tools/qarraydata.h4
-rw-r--r--src/corelib/tools/qbytearray.h20
-rw-r--r--src/corelib/tools/qbytearraylist.h2
-rw-r--r--src/corelib/tools/qbytearraymatcher.cpp2
-rw-r--r--src/corelib/tools/qcache.qdoc32
-rw-r--r--src/corelib/tools/qcollator.h2
-rw-r--r--src/corelib/tools/qcollator_win.cpp8
-rw-r--r--src/corelib/tools/qcontiguouscache.cpp76
-rw-r--r--src/corelib/tools/qdatetime.h2
-rw-r--r--src/corelib/tools/qdatetimeparser.cpp26
-rw-r--r--src/corelib/tools/qdatetimeparser_p.h2
-rw-r--r--src/corelib/tools/qeasingcurve.cpp20
-rw-r--r--src/corelib/tools/qeasingcurve.h2
-rw-r--r--src/corelib/tools/qhash.cpp252
-rw-r--r--src/corelib/tools/qhash.h8
-rw-r--r--src/corelib/tools/qhashfunctions.h2
-rw-r--r--src/corelib/tools/qiterator.qdoc472
-rw-r--r--src/corelib/tools/qlinkedlist.cpp211
-rw-r--r--src/corelib/tools/qlinkedlist.h4
-rw-r--r--src/corelib/tools/qlist.cpp294
-rw-r--r--src/corelib/tools/qlist.h4
-rw-r--r--src/corelib/tools/qlocale.cpp86
-rw-r--r--src/corelib/tools/qlocale.h32
-rw-r--r--src/corelib/tools/qlocale_tools.cpp5
-rw-r--r--src/corelib/tools/qlocale_tools_p.h1
-rw-r--r--src/corelib/tools/qlocale_win.cpp12
-rw-r--r--src/corelib/tools/qmap.cpp280
-rw-r--r--src/corelib/tools/qmap.h46
-rw-r--r--src/corelib/tools/qpair.qdoc34
-rw-r--r--src/corelib/tools/qringbuffer.cpp196
-rw-r--r--src/corelib/tools/qringbuffer_p.h143
-rw-r--r--src/corelib/tools/qscopedpointer.cpp53
-rw-r--r--src/corelib/tools/qscopedpointer.h17
-rw-r--r--src/corelib/tools/qset.qdoc196
-rw-r--r--src/corelib/tools/qshareddata.cpp126
-rw-r--r--src/corelib/tools/qshareddata.h12
-rw-r--r--src/corelib/tools/qsharedpointer.cpp187
-rw-r--r--src/corelib/tools/qsharedpointer.h1
-rw-r--r--src/corelib/tools/qsharedpointer_impl.h39
-rw-r--r--src/corelib/tools/qsimd_p.h17
-rw-r--r--src/corelib/tools/qstring.cpp6
-rw-r--r--src/corelib/tools/qstring.h52
-rw-r--r--src/corelib/tools/qtextboundaryfinder.h2
-rw-r--r--src/corelib/tools/qtimeline.h4
-rw-r--r--src/corelib/tools/qtimezoneprivate.cpp4
-rw-r--r--src/corelib/tools/qtimezoneprivate_p.h185
-rw-r--r--src/corelib/tools/qtimezoneprivate_win.cpp560
-rw-r--r--src/corelib/tools/qvarlengtharray.qdoc150
-rw-r--r--src/corelib/tools/qvector.h4
-rw-r--r--src/corelib/tools/qvector.qdoc220
-rw-r--r--src/corelib/tools/qversionnumber.h2
-rw-r--r--src/corelib/tools/tools.pri1
-rw-r--r--src/corelib/xml/qxmlstream.cpp79
-rw-r--r--src/corelib/xml/qxmlstream.h2
-rw-r--r--src/dbus/qdbusabstractinterface.cpp4
-rw-r--r--src/dbus/qdbusabstractinterface.h6
-rw-r--r--src/dbus/qdbusargument.cpp6
-rw-r--r--src/dbus/qdbusargument.h6
-rw-r--r--src/dbus/qdbusconnection.cpp16
-rw-r--r--src/dbus/qdbusconnection.h2
-rw-r--r--src/dbus/qdbusconnection_p.h12
-rw-r--r--src/dbus/qdbusconnectioninterface.h4
-rw-r--r--src/dbus/qdbusconnectionmanager_p.h2
-rw-r--r--src/dbus/qdbuserror.cpp6
-rw-r--r--src/dbus/qdbusextratypes.cpp18
-rw-r--r--src/dbus/qdbusintegrator.cpp29
-rw-r--r--src/dbus/qdbusintegrator_p.h8
-rw-r--r--src/dbus/qdbusinterface.h8
-rw-r--r--src/dbus/qdbusmessage.cpp16
-rw-r--r--src/dbus/qdbusmetatype.cpp12
-rw-r--r--src/dbus/qdbuspendingcall.cpp2
-rw-r--r--src/dbus/qdbuspendingcall.h4
-rw-r--r--src/dbus/qdbuspendingreply.cpp6
-rw-r--r--src/dbus/qdbuspendingreply.h23
-rw-r--r--src/dbus/qdbusreply.h2
-rw-r--r--src/dbus/qdbusserver.cpp2
-rw-r--r--src/dbus/qdbusserver.h4
-rw-r--r--src/dbus/qdbusservicewatcher.h4
-rw-r--r--src/dbus/qdbusthreaddebug_p.h40
-rw-r--r--src/dbus/qdbusvirtualobject.h2
-rw-r--r--src/gui/accessible/qaccessible.cpp1
-rw-r--r--src/gui/accessible/qaccessible.h4
-rw-r--r--src/gui/accessible/qaccessiblebridge.h2
-rw-r--r--src/gui/accessible/qaccessiblecache.cpp2
-rw-r--r--src/gui/accessible/qaccessibleobject.h28
-rw-r--r--src/gui/accessible/qaccessibleplugin.h2
-rw-r--r--src/gui/configure.json27
-rw-r--r--src/gui/doc/snippets/code/src_gui_text_qfont.cpp2
-rw-r--r--src/gui/doc/snippets/code/src_gui_text_qfontmetrics.cpp4
-rw-r--r--src/gui/image/qbitmap.h2
-rw-r--r--src/gui/image/qicon.h4
-rw-r--r--src/gui/image/qicon_p.h22
-rw-r--r--src/gui/image/qiconengineplugin.h2
-rw-r--r--src/gui/image/qiconloader_p.h20
-rw-r--r--src/gui/image/qimage.cpp72
-rw-r--r--src/gui/image/qimage.h34
-rw-r--r--src/gui/image/qimageiohandler.h2
-rw-r--r--src/gui/image/qmovie.h6
-rw-r--r--src/gui/image/qpaintengine_pic_p.h22
-rw-r--r--src/gui/image/qpicture.cpp4
-rw-r--r--src/gui/image/qpicture.h14
-rw-r--r--src/gui/image/qpictureformatplugin.h2
-rw-r--r--src/gui/image/qpixmap.h22
-rw-r--r--src/gui/image/qpixmap_blitter_p.h22
-rw-r--r--src/gui/image/qpixmap_raster_p.h38
-rw-r--r--src/gui/image/qpixmapcache.cpp2
-rw-r--r--src/gui/image/qpixmapcache.h2
-rw-r--r--src/gui/itemmodels/qstandarditemmodel.cpp93
-rw-r--r--src/gui/itemmodels/qstandarditemmodel.h50
-rw-r--r--src/gui/itemmodels/qstandarditemmodel_p.h11
-rw-r--r--src/gui/kernel/qcursor.h2
-rw-r--r--src/gui/kernel/qdnd_p.h6
-rw-r--r--src/gui/kernel/qdrag.cpp7
-rw-r--r--src/gui/kernel/qevent.cpp22
-rw-r--r--src/gui/kernel/qevent.h6
-rw-r--r--src/gui/kernel/qgenericplugin.h2
-rw-r--r--src/gui/kernel/qguiapplication.cpp280
-rw-r--r--src/gui/kernel/qguiapplication.h6
-rw-r--r--src/gui/kernel/qguiapplication_p.h8
-rw-r--r--src/gui/kernel/qhighdpiscaling.cpp6
-rw-r--r--src/gui/kernel/qkeysequence.h2
-rw-r--r--src/gui/kernel/qoffscreensurface.h10
-rw-r--r--src/gui/kernel/qopenglcontext.h2
-rw-r--r--src/gui/kernel/qopenglcontext_p.h8
-rw-r--r--src/gui/kernel/qopenglwindow.cpp10
-rw-r--r--src/gui/kernel/qopenglwindow.h12
-rw-r--r--src/gui/kernel/qpaintdevicewindow.h8
-rw-r--r--src/gui/kernel/qpalette.h2
-rw-r--r--src/gui/kernel/qplatformcursor.cpp2
-rw-r--r--src/gui/kernel/qplatformdialoghelper.cpp1
-rw-r--r--src/gui/kernel/qplatformgraphicsbuffer.cpp4
-rw-r--r--src/gui/kernel/qplatformgraphicsbufferhelper.h2
-rw-r--r--src/gui/kernel/qplatformnativeinterface.cpp4
-rw-r--r--src/gui/kernel/qplatformoffscreensurface.cpp2
-rw-r--r--src/gui/kernel/qplatformoffscreensurface.h4
-rw-r--r--src/gui/kernel/qplatformsurface.h4
-rw-r--r--src/gui/kernel/qplatformtheme.cpp3
-rw-r--r--src/gui/kernel/qplatformwindow.cpp2
-rw-r--r--src/gui/kernel/qplatformwindow.h4
-rw-r--r--src/gui/kernel/qrasterwindow.cpp6
-rw-r--r--src/gui/kernel/qrasterwindow.h6
-rw-r--r--src/gui/kernel/qshapedpixmapdndwindow_p.h2
-rw-r--r--src/gui/kernel/qsimpledrag.cpp2
-rw-r--r--src/gui/kernel/qsimpledrag_p.h14
-rw-r--r--src/gui/kernel/qwindow.h16
-rw-r--r--src/gui/kernel/qwindowsysteminterface.cpp85
-rw-r--r--src/gui/kernel/qwindowsysteminterface.h37
-rw-r--r--src/gui/kernel/qwindowsysteminterface_p.h29
-rw-r--r--src/gui/math3d/qgenericmatrix.cpp58
-rw-r--r--src/gui/math3d/qmatrix4x4.h2
-rw-r--r--src/gui/opengl/qopengl.cpp4
-rw-r--r--src/gui/opengl/qopengl.h4
-rw-r--r--src/gui/opengl/qopenglbuffer.h2
-rw-r--r--src/gui/opengl/qopengldebug.h2
-rw-r--r--src/gui/opengl/qopenglengineshadermanager.cpp4
-rw-r--r--src/gui/opengl/qopenglext.h4
-rw-r--r--src/gui/opengl/qopenglextrafunctions.h2
-rw-r--r--src/gui/opengl/qopenglframebufferobject.cpp19
-rw-r--r--src/gui/opengl/qopenglframebufferobject.h12
-rw-r--r--src/gui/opengl/qopenglfunctions.cpp10
-rw-r--r--src/gui/opengl/qopenglfunctions.h25
-rw-r--r--src/gui/opengl/qopenglfunctions_1_0.h2
-rw-r--r--src/gui/opengl/qopenglfunctions_1_1.h2
-rw-r--r--src/gui/opengl/qopenglfunctions_1_2.h2
-rw-r--r--src/gui/opengl/qopenglfunctions_1_3.h2
-rw-r--r--src/gui/opengl/qopenglfunctions_1_4.h2
-rw-r--r--src/gui/opengl/qopenglfunctions_1_5.h2
-rw-r--r--src/gui/opengl/qopenglfunctions_2_0.cpp2
-rw-r--r--src/gui/opengl/qopenglfunctions_2_0.h2
-rw-r--r--src/gui/opengl/qopenglfunctions_2_1.cpp2
-rw-r--r--src/gui/opengl/qopenglfunctions_2_1.h2
-rw-r--r--src/gui/opengl/qopenglfunctions_3_0.cpp4
-rw-r--r--src/gui/opengl/qopenglfunctions_3_0.h2
-rw-r--r--src/gui/opengl/qopenglfunctions_3_1.h2
-rw-r--r--src/gui/opengl/qopenglfunctions_3_2_compatibility.cpp4
-rw-r--r--src/gui/opengl/qopenglfunctions_3_2_compatibility.h2
-rw-r--r--src/gui/opengl/qopenglfunctions_3_2_core.h2
-rw-r--r--src/gui/opengl/qopenglfunctions_3_3_compatibility.cpp2
-rw-r--r--src/gui/opengl/qopenglfunctions_3_3_compatibility.h2
-rw-r--r--src/gui/opengl/qopenglfunctions_3_3_core.h2
-rw-r--r--src/gui/opengl/qopenglfunctions_4_0_compatibility.cpp2
-rw-r--r--src/gui/opengl/qopenglfunctions_4_0_compatibility.h2
-rw-r--r--src/gui/opengl/qopenglfunctions_4_0_core.h2
-rw-r--r--src/gui/opengl/qopenglfunctions_4_1_compatibility.cpp2
-rw-r--r--src/gui/opengl/qopenglfunctions_4_1_compatibility.h2
-rw-r--r--src/gui/opengl/qopenglfunctions_4_1_core.h2
-rw-r--r--src/gui/opengl/qopenglfunctions_4_2_compatibility.cpp2
-rw-r--r--src/gui/opengl/qopenglfunctions_4_2_compatibility.h2
-rw-r--r--src/gui/opengl/qopenglfunctions_4_2_core.h2
-rw-r--r--src/gui/opengl/qopenglfunctions_4_3_compatibility.cpp2
-rw-r--r--src/gui/opengl/qopenglfunctions_4_3_compatibility.h2
-rw-r--r--src/gui/opengl/qopenglfunctions_4_3_core.h2
-rw-r--r--src/gui/opengl/qopenglfunctions_4_4_compatibility.h2
-rw-r--r--src/gui/opengl/qopenglfunctions_4_4_core.h2
-rw-r--r--src/gui/opengl/qopenglfunctions_4_5_compatibility.h2
-rw-r--r--src/gui/opengl/qopenglfunctions_4_5_core.h2
-rw-r--r--src/gui/opengl/qopenglfunctions_es2.h2
-rw-r--r--src/gui/opengl/qopenglgradientcache_p.h4
-rw-r--r--src/gui/opengl/qopenglpaintengine_p.h56
-rw-r--r--src/gui/opengl/qopenglshaderprogram.h8
-rw-r--r--src/gui/opengl/qopengltexture.h36
-rw-r--r--src/gui/opengl/qopengltexturecache_p.h4
-rw-r--r--src/gui/opengl/qopengltextureglyphcache_p.h16
-rw-r--r--src/gui/opengl/qopengltimerquery.h4
-rw-r--r--src/gui/opengl/qopenglversionfunctions.h2
-rw-r--r--src/gui/opengl/qopenglvertexarrayobject.h2
-rw-r--r--src/gui/opengl/qopenglvertexarrayobject_p.h8
-rw-r--r--src/gui/painting/qcolor.h16
-rw-r--r--src/gui/painting/qcompositionfunctions.cpp223
-rw-r--r--src/gui/painting/qcoregraphics.mm107
-rw-r--r--src/gui/painting/qcoregraphics_p.h3
-rw-r--r--src/gui/painting/qdrawhelper.cpp2
-rw-r--r--src/gui/painting/qdrawhelper_neon.cpp40
-rw-r--r--src/gui/painting/qdrawhelper_p.h14
-rw-r--r--src/gui/painting/qmatrix.h2
-rw-r--r--src/gui/painting/qpaintengine_blitter_p.h64
-rw-r--r--src/gui/painting/qpaintengine_raster.cpp12
-rw-r--r--src/gui/painting/qpaintengine_raster_p.h82
-rw-r--r--src/gui/painting/qpaintengineex.cpp37
-rw-r--r--src/gui/painting/qpaintengineex_p.h30
-rw-r--r--src/gui/painting/qpainter.cpp4
-rw-r--r--src/gui/painting/qpainter.h8
-rw-r--r--src/gui/painting/qpdf_p.h26
-rw-r--r--src/gui/painting/qpdfwriter.cpp12
-rw-r--r--src/gui/painting/qpen.h2
-rw-r--r--src/gui/painting/qplatformbackingstore.cpp2
-rw-r--r--src/gui/painting/qregion.cpp73
-rw-r--r--src/gui/painting/qregion.h3
-rw-r--r--src/gui/painting/qt_mips_asm_dsp_p.h2
-rw-r--r--src/gui/painting/qtextureglyphcache_p.h6
-rw-r--r--src/gui/painting/qtransform.cpp8
-rw-r--r--src/gui/painting/qtransform.h6
-rw-r--r--src/gui/text/qabstracttextdocumentlayout.h2
-rw-r--r--src/gui/text/qfont.cpp4
-rw-r--r--src/gui/text/qfont_p.h2
-rw-r--r--src/gui/text/qfontdatabase.cpp12
-rw-r--r--src/gui/text/qfontengine.cpp6
-rw-r--r--src/gui/text/qfontengine_p.h92
-rw-r--r--src/gui/text/qfontengine_qpf2_p.h48
-rw-r--r--src/gui/text/qfontmetrics.cpp170
-rw-r--r--src/gui/text/qfontmetrics.h25
-rw-r--r--src/gui/text/qharfbuzzng.cpp24
-rw-r--r--src/gui/text/qstatictext.cpp18
-rw-r--r--src/gui/text/qtextdocument.cpp8
-rw-r--r--src/gui/text/qtextdocument.h6
-rw-r--r--src/gui/text/qtextdocumentlayout.cpp6
-rw-r--r--src/gui/text/qtextdocumentlayout_p.h22
-rw-r--r--src/gui/text/qtextengine.cpp4
-rw-r--r--src/gui/text/qtextformat.cpp8
-rw-r--r--src/gui/text/qtexthtmlparser.cpp16
-rw-r--r--src/gui/text/qtextimagehandler_p.h4
-rw-r--r--src/gui/text/qtextlayout.cpp4
-rw-r--r--src/gui/text/qtextlayout.h8
-rw-r--r--src/gui/text/qtextobject.h6
-rw-r--r--src/gui/text/qtextodfwriter.cpp4
-rw-r--r--src/gui/text/qtexttable.h4
-rw-r--r--src/gui/text/qtexttable_p.h4
-rw-r--r--src/gui/util/qvalidator.h28
-rw-r--r--src/network/access/access.pri59
-rw-r--r--src/network/access/http2/hpack.cpp22
-rw-r--r--src/network/access/http2/http2streams_p.h2
-rw-r--r--src/network/access/http2/huffman_p.h13
-rw-r--r--src/network/access/qabstractnetworkcache.h2
-rw-r--r--src/network/access/qabstractprotocolhandler.cpp4
-rw-r--r--src/network/access/qabstractprotocolhandler_p.h4
-rw-r--r--src/network/access/qhsts.cpp16
-rw-r--r--src/network/access/qhsts_p.h5
-rw-r--r--src/network/access/qhstspolicy.cpp18
-rw-r--r--src/network/access/qhttp2protocolhandler.cpp7
-rw-r--r--src/network/access/qhttp2protocolhandler_p.h6
-rw-r--r--src/network/access/qhttpmultipart.h6
-rw-r--r--src/network/access/qhttpmultipart_p.h20
-rw-r--r--src/network/access/qhttpnetworkconnection.cpp12
-rw-r--r--src/network/access/qhttpnetworkconnection_p.h7
-rw-r--r--src/network/access/qhttpnetworkconnectionchannel.cpp30
-rw-r--r--src/network/access/qhttpnetworkconnectionchannel_p.h6
-rw-r--r--src/network/access/qhttpnetworkheader.cpp4
-rw-r--r--src/network/access/qhttpnetworkheader_p.h8
-rw-r--r--src/network/access/qhttpnetworkreply.cpp4
-rw-r--r--src/network/access/qhttpnetworkreply_p.h25
-rw-r--r--src/network/access/qhttpnetworkrequest.cpp18
-rw-r--r--src/network/access/qhttpnetworkrequest_p.h29
-rw-r--r--src/network/access/qhttpprotocolhandler.cpp4
-rw-r--r--src/network/access/qhttpprotocolhandler_p.h10
-rw-r--r--src/network/access/qhttpthreaddelegate.cpp12
-rw-r--r--src/network/access/qhttpthreaddelegate_p.h16
-rw-r--r--src/network/access/qnetworkaccessauthenticationmanager.cpp2
-rw-r--r--src/network/access/qnetworkaccesscache_p.h2
-rw-r--r--src/network/access/qnetworkaccesscachebackend_p.h6
-rw-r--r--src/network/access/qnetworkaccessdebugpipebackend_p.h10
-rw-r--r--src/network/access/qnetworkaccessfilebackend_p.h10
-rw-r--r--src/network/access/qnetworkaccessftpbackend.cpp2
-rw-r--r--src/network/access/qnetworkaccessftpbackend_p.h10
-rw-r--r--src/network/access/qnetworkaccessmanager.cpp24
-rw-r--r--src/network/access/qnetworkaccessmanager.h13
-rw-r--r--src/network/access/qnetworkaccessmanager_p.h2
-rw-r--r--src/network/access/qnetworkcookiejar.h2
-rw-r--r--src/network/access/qnetworkdiskcache.h18
-rw-r--r--src/network/access/qnetworkfile_p.h2
-rw-r--r--src/network/access/qnetworkreply.h8
-rw-r--r--src/network/access/qnetworkreplydataimpl_p.h12
-rw-r--r--src/network/access/qnetworkreplyfileimpl_p.h12
-rw-r--r--src/network/access/qnetworkreplyhttpimpl.cpp14
-rw-r--r--src/network/access/qnetworkreplyhttpimpl_p.h28
-rw-r--r--src/network/access/qnetworkreplyimpl_p.h24
-rw-r--r--src/network/access/qnetworkrequest.cpp14
-rw-r--r--src/network/access/qnetworkrequest.h2
-rw-r--r--src/network/access/qspdyprotocolhandler.cpp4
-rw-r--r--src/network/access/qspdyprotocolhandler_p.h12
-rw-r--r--src/network/bearer/qnetworkconfigmanager.h2
-rw-r--r--src/network/bearer/qnetworksession.h6
-rw-r--r--src/network/configure.json34
-rw-r--r--src/network/kernel/kernel.pri29
-rw-r--r--src/network/kernel/qdnslookup.h8
-rw-r--r--src/network/kernel/qdnslookup_p.h4
-rw-r--r--src/network/kernel/qhostaddress.cpp222
-rw-r--r--src/network/kernel/qhostaddress.h6
-rw-r--r--src/network/kernel/qhostaddress_p.h45
-rw-r--r--src/network/kernel/qhostinfo_p.h4
-rw-r--r--src/network/kernel/qhostinfo_unix.cpp74
-rw-r--r--src/network/kernel/qnetworkdatagram.cpp11
-rw-r--r--src/network/kernel/qnetworkdatagram.h4
-rw-r--r--src/network/kernel/qnetworkinterface.cpp318
-rw-r--r--src/network/kernel/qnetworkinterface.h43
-rw-r--r--src/network/kernel/qnetworkinterface_linux.cpp443
-rw-r--r--src/network/kernel/qnetworkinterface_p.h23
-rw-r--r--src/network/kernel/qnetworkinterface_uikit_p.h262
-rw-r--r--src/network/kernel/qnetworkinterface_unix.cpp193
-rw-r--r--src/network/kernel/qnetworkinterface_unix_p.h102
-rw-r--r--src/network/kernel/qnetworkinterface_win.cpp58
-rw-r--r--src/network/kernel/qnetworkproxy.cpp12
-rw-r--r--src/network/network.pro2
-rw-r--r--src/network/socket/qabstractsocket.cpp33
-rw-r--r--src/network/socket/qabstractsocket.h27
-rw-r--r--src/network/socket/qabstractsocket_p.h3
-rw-r--r--src/network/socket/qabstractsocketengine_p.h3
-rw-r--r--src/network/socket/qhttpsocketengine.cpp21
-rw-r--r--src/network/socket/qhttpsocketengine_p.h74
-rw-r--r--src/network/socket/qlocalserver.h4
-rw-r--r--src/network/socket/qlocalsocket.h22
-rw-r--r--src/network/socket/qlocalsocket_p.h2
-rw-r--r--src/network/socket/qlocalsocket_tcp.cpp5
-rw-r--r--src/network/socket/qlocalsocket_unix.cpp5
-rw-r--r--src/network/socket/qnativesocketengine_p.h68
-rw-r--r--src/network/socket/qnativesocketengine_unix.cpp30
-rw-r--r--src/network/socket/qnativesocketengine_win.cpp26
-rw-r--r--src/network/socket/qnativesocketengine_winrt.cpp4
-rw-r--r--src/network/socket/qnet_unix_p.h3
-rw-r--r--src/network/socket/qsctpserver.h2
-rw-r--r--src/network/socket/qsctpserver_p.h2
-rw-r--r--src/network/socket/qsctpsocket.h8
-rw-r--r--src/network/socket/qsctpsocket_p.h6
-rw-r--r--src/network/socket/qsocks5socketengine.cpp2
-rw-r--r--src/network/socket/qsocks5socketengine_p.h78
-rw-r--r--src/network/socket/qtcpserver.h6
-rw-r--r--src/network/socket/qtcpserver_p.h12
-rw-r--r--src/network/socket/qtcpsocket.h6
-rw-r--r--src/network/socket/qudpsocket.h4
-rw-r--r--src/network/socket/socket.pri9
-rw-r--r--src/network/ssl/qsslcertificate.h2
-rw-r--r--src/network/ssl/qssldiffiehellmanparameters_openssl.cpp4
-rw-r--r--src/network/ssl/qsslkey_qt.cpp7
-rw-r--r--src/network/ssl/qsslsocket.cpp14
-rw-r--r--src/network/ssl/qsslsocket.h38
-rw-r--r--src/network/ssl/qsslsocket_mac.cpp70
-rw-r--r--src/network/ssl/qsslsocket_mac_p.h16
-rw-r--r--src/network/ssl/qsslsocket_openssl_p.h18
-rw-r--r--src/network/ssl/qsslsocket_openssl_symbols.cpp2
-rw-r--r--src/network/ssl/qsslsocket_openssl_symbols_p.h8
-rw-r--r--src/network/ssl/qsslsocket_opensslpre11.cpp3
-rw-r--r--src/network/ssl/qsslsocket_p.h9
-rw-r--r--src/network/ssl/qsslsocket_winrt.cpp2
-rw-r--r--src/network/ssl/qsslsocket_winrt_p.h16
-rw-r--r--src/opengl/gl2paintengineex/qglengineshadermanager.cpp4
-rw-r--r--src/opengl/gl2paintengineex/qpaintengineex_opengl2_p.h56
-rw-r--r--src/opengl/gl2paintengineex/qtextureglyphcache_gl_p.h16
-rw-r--r--src/opengl/opengl.pro1
-rw-r--r--src/opengl/qgl.h36
-rw-r--r--src/opengl/qgl_p.h8
-rw-r--r--src/opengl/qglbuffer.h2
-rw-r--r--src/opengl/qglcolormap.h2
-rw-r--r--src/opengl/qglframebufferobject.h6
-rw-r--r--src/opengl/qglframebufferobject_p.h10
-rw-r--r--src/opengl/qglfunctions.cpp4
-rw-r--r--src/opengl/qglfunctions.h6
-rw-r--r--src/opengl/qglpaintdevice_p.h14
-rw-r--r--src/opengl/qglpixelbuffer.h10
-rw-r--r--src/opengl/qglshaderprogram.h23
-rw-r--r--src/opengl/qgraphicsshadereffect.cpp2
-rw-r--r--src/opengl/qgraphicsshadereffect_p.h2
-rw-r--r--src/openglextensions/qopenglextensions.h502
-rw-r--r--src/platformsupport/devicediscovery/qdevicediscovery_dummy_p.h2
-rw-r--r--src/platformsupport/devicediscovery/qdevicediscovery_static_p.h2
-rw-r--r--src/platformsupport/devicediscovery/qdevicediscovery_udev_p.h2
-rw-r--r--src/platformsupport/edid/qedidvendortable_p.h9
-rw-r--r--src/platformsupport/eglconvenience/qeglpbuffer_p.h4
-rw-r--r--src/platformsupport/eglconvenience/qeglplatformcontext_p.h16
-rw-r--r--src/platformsupport/eventdispatchers/qeventdispatcher_glib_p.h2
-rw-r--r--src/platformsupport/eventdispatchers/qwindowsguieventdispatcher_p.h4
-rw-r--r--src/platformsupport/fbconvenience/qfbbackingstore.cpp5
-rw-r--r--src/platformsupport/fbconvenience/qfbbackingstore_p.h10
-rw-r--r--src/platformsupport/fbconvenience/qfbscreen.cpp5
-rw-r--r--src/platformsupport/fbconvenience/qfbscreen_p.h14
-rw-r--r--src/platformsupport/fbconvenience/qfbwindow_p.h20
-rw-r--r--src/platformsupport/fontdatabases/fontconfig/qfontconfigdatabase.cpp4
-rw-r--r--src/platformsupport/fontdatabases/fontconfig/qfontconfigdatabase_p.h18
-rw-r--r--src/platformsupport/fontdatabases/fontconfig/qfontenginemultifontconfig_p.h2
-rw-r--r--src/platformsupport/fontdatabases/fontdatabases.pro30
-rw-r--r--src/platformsupport/fontdatabases/freetype/qfontengine_ft.cpp10
-rw-r--r--src/platformsupport/fontdatabases/freetype/qfontengine_ft_p.h86
-rw-r--r--src/platformsupport/fontdatabases/freetype/qfreetypefontdatabase_p.h10
-rw-r--r--src/platformsupport/fontdatabases/mac/qcoretextfontdatabase_p.h18
-rw-r--r--src/platformsupport/fontdatabases/mac/qfontengine_coretext.mm6
-rw-r--r--src/platformsupport/fontdatabases/mac/qfontengine_coretext_p.h74
-rw-r--r--src/platformsupport/fontdatabases/windows/qwindowsfontdatabase.cpp67
-rw-r--r--src/platformsupport/fontdatabases/windows/qwindowsfontdatabase_ft.cpp6
-rw-r--r--src/platformsupport/fontdatabases/windows/qwindowsfontdatabase_ft_p.h14
-rw-r--r--src/platformsupport/fontdatabases/windows/qwindowsfontdatabase_p.h26
-rw-r--r--src/platformsupport/fontdatabases/windows/qwindowsfontengine.cpp29
-rw-r--r--src/platformsupport/fontdatabases/windows/qwindowsfontengine_p.h72
-rw-r--r--src/platformsupport/fontdatabases/windows/qwindowsfontenginedirectwrite.cpp14
-rw-r--r--src/platformsupport/fontdatabases/windows/qwindowsfontenginedirectwrite_p.h50
-rw-r--r--src/platformsupport/fontdatabases/windows/qwindowsnativeimage.cpp2
-rw-r--r--src/platformsupport/graphics/qrasterbackingstore_p.h10
-rw-r--r--src/platformsupport/input/evdevkeyboard/qevdevkeyboardhandler.cpp4
-rw-r--r--src/platformsupport/input/evdevmouse/qevdevmousehandler.cpp7
-rw-r--r--src/platformsupport/input/evdevmouse/qevdevmousehandler_p.h6
-rw-r--r--src/platformsupport/input/evdevmouse/qevdevmousemanager.cpp6
-rw-r--r--src/platformsupport/input/evdevmouse/qevdevmousemanager_p.h3
-rw-r--r--src/platformsupport/input/evdevtablet/qevdevtablethandler_p.h2
-rw-r--r--src/platformsupport/input/evdevtouch/qevdevtouchhandler.cpp18
-rw-r--r--src/platformsupport/input/evdevtouch/qevdevtouchhandler_p.h8
-rw-r--r--src/platformsupport/input/integrityhid/qintegrityhidmanager.cpp8
-rw-r--r--src/platformsupport/input/libinput/qlibinputhandler.cpp4
-rw-r--r--src/platformsupport/input/libinput/qlibinputkeyboard.cpp7
-rw-r--r--src/platformsupport/input/libinput/qlibinputpointer.cpp13
-rw-r--r--src/platformsupport/input/libinput/qlibinputtouch.cpp6
-rw-r--r--src/platformsupport/kmsconvenience/qkmsdevice.cpp345
-rw-r--r--src/platformsupport/kmsconvenience/qkmsdevice_p.h124
-rw-r--r--src/platformsupport/linuxaccessibility/bridge_p.h2
-rw-r--r--src/platformsupport/platformcompositor/qopenglcompositorbackingstore.cpp6
-rw-r--r--src/platformsupport/platformcompositor/qopenglcompositorbackingstore_p.h12
-rw-r--r--src/platformsupport/platformsupport.pro3
-rw-r--r--src/platformsupport/services/genericunix/qgenericunixservices.cpp107
-rw-r--r--src/platformsupport/services/genericunix/qgenericunixservices_p.h6
-rw-r--r--src/platformsupport/services/services.pro5
-rw-r--r--src/platformsupport/themes/genericunix/dbusmenu/qdbusmenuadaptor.cpp2
-rw-r--r--src/platformsupport/themes/genericunix/dbusmenu/qdbusmenubar_p.h12
-rw-r--r--src/platformsupport/themes/genericunix/dbusmenu/qdbusplatformmenu.cpp10
-rw-r--r--src/platformsupport/themes/genericunix/dbusmenu/qdbusplatformmenu_p.h64
-rw-r--r--src/platformsupport/themes/genericunix/dbustray/qdbustrayicon.cpp18
-rw-r--r--src/platformsupport/themes/genericunix/dbustray/qdbustrayicon_p.h20
-rw-r--r--src/platformsupport/themes/genericunix/qgenericunixthemes.cpp10
-rw-r--r--src/platformsupport/themes/genericunix/qgenericunixthemes_p.h28
-rw-r--r--src/platformsupport/themes/themes.pro2
-rw-r--r--src/platformsupport/windowsuiautomation/qwindowsuiawrapper.cpp117
-rw-r--r--src/platformsupport/windowsuiautomation/qwindowsuiawrapper_p.h100
-rw-r--r--src/platformsupport/windowsuiautomation/uiaattributeids_p.h88
-rw-r--r--src/platformsupport/windowsuiautomation/uiaclientinterfaces_p.h255
-rw-r--r--src/platformsupport/windowsuiautomation/uiacontroltypeids_p.h85
-rw-r--r--src/platformsupport/windowsuiautomation/uiaerrorids_p.h51
-rw-r--r--src/platformsupport/windowsuiautomation/uiaeventids_p.h79
-rw-r--r--src/platformsupport/windowsuiautomation/uiageneralids_p.h46
-rw-r--r--src/platformsupport/windowsuiautomation/uiapatternids_p.h78
-rw-r--r--src/platformsupport/windowsuiautomation/uiapropertyids_p.h212
-rw-r--r--src/platformsupport/windowsuiautomation/uiaserverinterfaces_p.h352
-rw-r--r--src/platformsupport/windowsuiautomation/uiatypes_p.h145
-rw-r--r--src/platformsupport/windowsuiautomation/windowsuiautomation.pro23
-rw-r--r--src/plugins/bearer/android/jar/bundledjar.pro3
-rw-r--r--src/plugins/bearer/android/jar/distributedjar.pro2
-rw-r--r--src/plugins/bearer/android/jar/jar.pri11
-rw-r--r--src/plugins/bearer/android/jar/jar.pro15
-rw-r--r--src/plugins/bearer/android/src/main.cpp2
-rw-r--r--src/plugins/bearer/android/src/qandroidbearerengine.h28
-rw-r--r--src/plugins/bearer/generic/main.cpp2
-rw-r--r--src/plugins/bearer/generic/qgenericengine.h18
-rw-r--r--src/plugins/bearer/qnetworksession_impl.h44
-rw-r--r--src/plugins/generic/evdevkeyboard/main.cpp2
-rw-r--r--src/plugins/generic/evdevmouse/main.cpp2
-rw-r--r--src/plugins/generic/evdevtablet/main.cpp2
-rw-r--r--src/plugins/generic/evdevtouch/main.cpp2
-rw-r--r--src/plugins/generic/generic.pro4
-rw-r--r--src/plugins/imageformats/jpeg/qjpeghandler.cpp3
-rw-r--r--src/plugins/platforminputcontexts/compose/qcomposeplatforminputcontext.h10
-rw-r--r--src/plugins/platforminputcontexts/compose/qcomposeplatforminputcontextmain.cpp2
-rw-r--r--src/plugins/platforminputcontexts/ibus/main.cpp2
-rw-r--r--src/plugins/platforminputcontexts/ibus/qibusplatforminputcontext.cpp71
-rw-r--r--src/plugins/platforminputcontexts/ibus/qibusplatforminputcontext.h21
-rw-r--r--src/plugins/platforms/android/qandroidplatformscreen.cpp5
-rw-r--r--src/plugins/platforms/bsdfb/qbsdfbscreen.cpp3
-rw-r--r--src/plugins/platforms/cocoa/cocoa.pro2
-rw-r--r--src/plugins/platforms/cocoa/qcocoaaccessibility.h8
-rw-r--r--src/plugins/platforms/cocoa/qcocoaaccessibilityelement.mm20
-rw-r--r--src/plugins/platforms/cocoa/qcocoaapplicationdelegate.mm41
-rw-r--r--src/plugins/platforms/cocoa/qcocoabackingstore.h4
-rw-r--r--src/plugins/platforms/cocoa/qcocoaclipboard.h8
-rw-r--r--src/plugins/platforms/cocoa/qcocoacolordialoghelper.h10
-rw-r--r--src/plugins/platforms/cocoa/qcocoacursor.h6
-rw-r--r--src/plugins/platforms/cocoa/qcocoacursor.mm5
-rw-r--r--src/plugins/platforms/cocoa/qcocoadrag.h4
-rw-r--r--src/plugins/platforms/cocoa/qcocoadrag.mm2
-rw-r--r--src/plugins/platforms/cocoa/qcocoafiledialoghelper.h22
-rw-r--r--src/plugins/platforms/cocoa/qcocoafiledialoghelper.mm10
-rw-r--r--src/plugins/platforms/cocoa/qcocoafontdialoghelper.h10
-rw-r--r--src/plugins/platforms/cocoa/qcocoaglcontext.h14
-rw-r--r--src/plugins/platforms/cocoa/qcocoahelpers.h22
-rw-r--r--src/plugins/platforms/cocoa/qcocoahelpers.mm68
-rw-r--r--src/plugins/platforms/cocoa/qcocoainputcontext.h6
-rw-r--r--src/plugins/platforms/cocoa/qcocoaintegration.h40
-rw-r--r--src/plugins/platforms/cocoa/qcocoamenu.h39
-rw-r--r--src/plugins/platforms/cocoa/qcocoamenu.mm234
-rw-r--r--src/plugins/platforms/cocoa/qcocoamenubar.h10
-rw-r--r--src/plugins/platforms/cocoa/qcocoamenubar.mm2
-rw-r--r--src/plugins/platforms/cocoa/qcocoamenuitem.h26
-rw-r--r--src/plugins/platforms/cocoa/qcocoamenuitem.mm4
-rw-r--r--src/plugins/platforms/cocoa/qcocoamenuloader.mm8
-rw-r--r--src/plugins/platforms/cocoa/qcocoanativeinterface.h8
-rw-r--r--src/plugins/platforms/cocoa/qcocoanativeinterface.mm2
-rw-r--r--src/plugins/platforms/cocoa/qcocoansmenu.h86
-rw-r--r--src/plugins/platforms/cocoa/qcocoansmenu.mm296
-rw-r--r--src/plugins/platforms/cocoa/qcocoaprintdevice.h34
-rw-r--r--src/plugins/platforms/cocoa/qcocoaprintdevice.mm11
-rw-r--r--src/plugins/platforms/cocoa/qcocoaprintersupport.h10
-rw-r--r--src/plugins/platforms/cocoa/qcocoascreen.h40
-rw-r--r--src/plugins/platforms/cocoa/qcocoascreen.mm97
-rw-r--r--src/plugins/platforms/cocoa/qcocoaservices.h4
-rw-r--r--src/plugins/platforms/cocoa/qcocoasystemtrayicon.h18
-rw-r--r--src/plugins/platforms/cocoa/qcocoatheme.h24
-rw-r--r--src/plugins/platforms/cocoa/qcocoatheme.mm6
-rw-r--r--src/plugins/platforms/cocoa/qcocoawindow.h58
-rw-r--r--src/plugins/platforms/cocoa/qcocoawindow.mm23
-rw-r--r--src/plugins/platforms/cocoa/qmultitouch_mac.mm3
-rw-r--r--src/plugins/platforms/cocoa/qnsview.mm21
-rw-r--r--src/plugins/platforms/cocoa/qpaintengine_mac.mm98
-rw-r--r--src/plugins/platforms/cocoa/qpaintengine_mac_p.h6
-rw-r--r--src/plugins/platforms/cocoa/qprintengine_mac.mm2
-rw-r--r--src/plugins/platforms/cocoa/qprintengine_mac_p.h4
-rw-r--r--src/plugins/platforms/direct2d/qwindowsdirect2dbackingstore.h10
-rw-r--r--src/plugins/platforms/direct2d/qwindowsdirect2ddevicecontext.cpp2
-rw-r--r--src/plugins/platforms/direct2d/qwindowsdirect2dintegration.cpp2
-rw-r--r--src/plugins/platforms/direct2d/qwindowsdirect2dintegration.h10
-rw-r--r--src/plugins/platforms/direct2d/qwindowsdirect2dnativeinterface.h2
-rw-r--r--src/plugins/platforms/direct2d/qwindowsdirect2dpaintdevice.h6
-rw-r--r--src/plugins/platforms/direct2d/qwindowsdirect2dpaintengine.cpp2
-rw-r--r--src/plugins/platforms/direct2d/qwindowsdirect2dpaintengine.h50
-rw-r--r--src/plugins/platforms/direct2d/qwindowsdirect2dplatformpixmap.h20
-rw-r--r--src/plugins/platforms/direct2d/qwindowsdirect2dwindow.cpp6
-rw-r--r--src/plugins/platforms/direct2d/qwindowsdirect2dwindow.h2
-rw-r--r--src/plugins/platforms/eglfs/api/qeglfsdeviceintegration.cpp16
-rw-r--r--src/plugins/platforms/eglfs/api/qeglfsdeviceintegration_p.h2
-rw-r--r--src/plugins/platforms/eglfs/api/qeglfsintegration.cpp5
-rw-r--r--src/plugins/platforms/eglfs/api/qeglfswindow_p.h2
-rw-r--r--src/plugins/platforms/eglfs/deviceintegration/eglfs_kms/eglfs_kms.pro6
-rw-r--r--src/plugins/platforms/eglfs/deviceintegration/eglfs_kms/qeglfskmsgbmcursor.cpp6
-rw-r--r--src/plugins/platforms/eglfs/deviceintegration/eglfs_kms/qeglfskmsgbmdevice.cpp50
-rw-r--r--src/plugins/platforms/eglfs/deviceintegration/eglfs_kms/qeglfskmsgbmdevice.h12
-rw-r--r--src/plugins/platforms/eglfs/deviceintegration/eglfs_kms/qeglfskmsgbmintegration.cpp56
-rw-r--r--src/plugins/platforms/eglfs/deviceintegration/eglfs_kms/qeglfskmsgbmscreen.cpp240
-rw-r--r--src/plugins/platforms/eglfs/deviceintegration/eglfs_kms/qeglfskmsgbmscreen.h34
-rw-r--r--src/plugins/platforms/eglfs/deviceintegration/eglfs_kms/qeglfskmsgbmwindow.cpp80
-rw-r--r--src/plugins/platforms/eglfs/deviceintegration/eglfs_kms/qeglfskmsgbmwindow.h (renamed from src/plugins/platforms/windows/accessible/comutils.h)35
-rw-r--r--src/plugins/platforms/eglfs/deviceintegration/eglfs_kms_egldevice/qeglfskmsegldevice.cpp2
-rw-r--r--src/plugins/platforms/eglfs/deviceintegration/eglfs_kms_egldevice/qeglfskmsegldeviceintegration.cpp10
-rw-r--r--src/plugins/platforms/eglfs/deviceintegration/eglfs_kms_egldevice/qeglfskmsegldevicescreen.cpp10
-rw-r--r--src/plugins/platforms/eglfs/deviceintegration/eglfs_kms_support/qeglfskmsintegration.cpp12
-rw-r--r--src/plugins/platforms/eglfs/deviceintegration/eglfs_kms_support/qeglfskmsintegration.h1
-rw-r--r--src/plugins/platforms/eglfs/deviceintegration/eglfs_kms_support/qeglfskmsscreen.cpp47
-rw-r--r--src/plugins/platforms/eglfs/deviceintegration/eglfs_kms_support/qeglfskmsscreen.h8
-rw-r--r--src/plugins/platforms/haiku/main.cpp2
-rw-r--r--src/plugins/platforms/haiku/main.h2
-rw-r--r--src/plugins/platforms/haiku/qhaikuapplication.h4
-rw-r--r--src/plugins/platforms/haiku/qhaikubuffer.cpp6
-rw-r--r--src/plugins/platforms/haiku/qhaikuclipboard.cpp10
-rw-r--r--src/plugins/platforms/haiku/qhaikuclipboard.h10
-rw-r--r--src/plugins/platforms/haiku/qhaikucursor.h2
-rw-r--r--src/plugins/platforms/haiku/qhaikuintegration.cpp6
-rw-r--r--src/plugins/platforms/haiku/qhaikuintegration.h14
-rw-r--r--src/plugins/platforms/haiku/qhaikurasterbackingstore.cpp6
-rw-r--r--src/plugins/platforms/haiku/qhaikurasterbackingstore.h6
-rw-r--r--src/plugins/platforms/haiku/qhaikurasterwindow.cpp4
-rw-r--r--src/plugins/platforms/haiku/qhaikurasterwindow.h16
-rw-r--r--src/plugins/platforms/haiku/qhaikuscreen.cpp8
-rw-r--r--src/plugins/platforms/haiku/qhaikuscreen.h10
-rw-r--r--src/plugins/platforms/haiku/qhaikuservices.h6
-rw-r--r--src/plugins/platforms/haiku/qhaikuwindow.cpp8
-rw-r--r--src/plugins/platforms/haiku/qhaikuwindow.h36
-rw-r--r--src/plugins/platforms/integrity/main.cpp2
-rw-r--r--src/plugins/platforms/integrity/qintegrityfbintegration.h18
-rw-r--r--src/plugins/platforms/integrity/qintegrityfbscreen.cpp13
-rw-r--r--src/plugins/platforms/integrity/qintegrityfbscreen.h4
-rw-r--r--src/plugins/platforms/integrity/qintegrityhidmanager.cpp8
-rw-r--r--src/plugins/platforms/ios/optional/nsphotolibrarysupport/qiosfileengineassetslibrary.mm8
-rw-r--r--src/plugins/platforms/ios/qiosbackingstore.h2
-rw-r--r--src/plugins/platforms/ios/qiosclipboard.h8
-rw-r--r--src/plugins/platforms/ios/qiosclipboard.mm4
-rw-r--r--src/plugins/platforms/ios/qioscontext.h16
-rw-r--r--src/plugins/platforms/ios/qioseventdispatcher.h4
-rw-r--r--src/plugins/platforms/ios/qiosfiledialog.h22
-rw-r--r--src/plugins/platforms/ios/qiosfiledialog.mm4
-rw-r--r--src/plugins/platforms/ios/qiosinputcontext.h22
-rw-r--r--src/plugins/platforms/ios/qiosintegration.h34
-rw-r--r--src/plugins/platforms/ios/qiosintegration.mm7
-rw-r--r--src/plugins/platforms/ios/qiosmenu.h52
-rw-r--r--src/plugins/platforms/ios/qiosmessagedialog.h6
-rw-r--r--src/plugins/platforms/ios/qiosmessagedialog.mm4
-rw-r--r--src/plugins/platforms/ios/qiosoptionalplugininterface.h2
-rw-r--r--src/plugins/platforms/ios/qiosscreen.h20
-rw-r--r--src/plugins/platforms/ios/qiostextinputoverlay.mm18
-rw-r--r--src/plugins/platforms/ios/qiostheme.h14
-rw-r--r--src/plugins/platforms/ios/qioswindow.h34
-rw-r--r--src/plugins/platforms/ios/quiview.h1
-rw-r--r--src/plugins/platforms/ios/quiview.mm94
-rw-r--r--src/plugins/platforms/linuxfb/main.cpp2
-rw-r--r--src/plugins/platforms/linuxfb/qlinuxfbdrmscreen.cpp76
-rw-r--r--src/plugins/platforms/linuxfb/qlinuxfbintegration.h18
-rw-r--r--src/plugins/platforms/minimal/main.cpp2
-rw-r--r--src/plugins/platforms/minimal/minimal.pro2
-rw-r--r--src/plugins/platforms/minimal/qminimalbackingstore.h6
-rw-r--r--src/plugins/platforms/minimal/qminimalintegration.cpp34
-rw-r--r--src/plugins/platforms/minimal/qminimalintegration.h19
-rw-r--r--src/plugins/platforms/minimalegl/main.cpp2
-rw-r--r--src/plugins/platforms/minimalegl/qminimaleglbackingstore.h10
-rw-r--r--src/plugins/platforms/minimalegl/qminimaleglintegration.cpp4
-rw-r--r--src/plugins/platforms/minimalegl/qminimaleglintegration.h14
-rw-r--r--src/plugins/platforms/minimalegl/qminimaleglscreen.cpp2
-rw-r--r--src/plugins/platforms/minimalegl/qminimaleglscreen.h6
-rw-r--r--src/plugins/platforms/minimalegl/qminimaleglwindow.h4
-rw-r--r--src/plugins/platforms/offscreen/main.cpp2
-rw-r--r--src/plugins/platforms/offscreen/qoffscreencommon.cpp6
-rw-r--r--src/plugins/platforms/offscreen/qoffscreencommon.h20
-rw-r--r--src/plugins/platforms/offscreen/qoffscreenintegration.h18
-rw-r--r--src/plugins/platforms/offscreen/qoffscreenintegration_x11.h18
-rw-r--r--src/plugins/platforms/offscreen/qoffscreenwindow.h12
-rw-r--r--src/plugins/platforms/qnx/qqnxrasterbackingstore.cpp5
-rw-r--r--src/plugins/platforms/qnx/qqnxrasterwindow.cpp7
-rw-r--r--src/plugins/platforms/qnx/qqnxwindow.cpp19
-rw-r--r--src/plugins/platforms/qnx/qqnxwindow.h2
-rw-r--r--src/plugins/platforms/vnc/qvnc.cpp9
-rw-r--r--src/plugins/platforms/windows/accessible/accessible.pri19
-rw-r--r--src/plugins/platforms/windows/accessible/comutils.cpp280
-rw-r--r--src/plugins/platforms/windows/accessible/iaccessible2.cpp1640
-rw-r--r--src/plugins/platforms/windows/accessible/iaccessible2.h358
-rw-r--r--src/plugins/platforms/windows/accessible/qwindowsaccessibility.cpp245
-rw-r--r--src/plugins/platforms/windows/accessible/qwindowsmsaaaccessible.cpp1223
-rw-r--r--src/plugins/platforms/windows/accessible/qwindowsmsaaaccessible.h176
-rw-r--r--src/plugins/platforms/windows/qwin10helpers.cpp3
-rw-r--r--src/plugins/platforms/windows/qwindowsbackingstore.cpp2
-rw-r--r--src/plugins/platforms/windows/qwindowscontext.cpp34
-rw-r--r--src/plugins/platforms/windows/qwindowscontext.h14
-rw-r--r--src/plugins/platforms/windows/qwindowscursor.cpp2
-rw-r--r--src/plugins/platforms/windows/qwindowscursor.h6
-rw-r--r--src/plugins/platforms/windows/qwindowsdialoghelpers.cpp29
-rw-r--r--src/plugins/platforms/windows/qwindowseglcontext.h2
-rw-r--r--src/plugins/platforms/windows/qwindowsglcontext.cpp4
-rw-r--r--src/plugins/platforms/windows/qwindowsinputcontext.cpp22
-rw-r--r--src/plugins/platforms/windows/qwindowsinputcontext.h4
-rw-r--r--src/plugins/platforms/windows/qwindowsintegration.cpp14
-rw-r--r--src/plugins/platforms/windows/qwindowsmousehandler.cpp40
-rw-r--r--src/plugins/platforms/windows/qwindowsnativeinterface.cpp4
-rw-r--r--src/plugins/platforms/windows/qwindowsscreen.cpp2
-rw-r--r--src/plugins/platforms/windows/qwindowswindow.cpp25
-rw-r--r--src/plugins/platforms/windows/uiautomation/qwindowsuiaaccessibility.cpp140
-rw-r--r--src/plugins/platforms/windows/uiautomation/qwindowsuiaaccessibility.h (renamed from src/plugins/platforms/windows/accessible/qwindowsaccessibility.h)28
-rw-r--r--src/plugins/platforms/windows/uiautomation/qwindowsuiabaseprovider.cpp81
-rw-r--r--src/plugins/platforms/windows/uiautomation/qwindowsuiabaseprovider.h78
-rw-r--r--src/plugins/platforms/windows/uiautomation/qwindowsuiagriditemprovider.cpp176
-rw-r--r--src/plugins/platforms/windows/uiautomation/qwindowsuiagriditemprovider.h71
-rw-r--r--src/plugins/platforms/windows/uiautomation/qwindowsuiagridprovider.cpp136
-rw-r--r--src/plugins/platforms/windows/uiautomation/qwindowsuiagridprovider.h69
-rw-r--r--src/plugins/platforms/windows/uiautomation/qwindowsuiainvokeprovider.cpp84
-rw-r--r--src/plugins/platforms/windows/uiautomation/qwindowsuiainvokeprovider.h67
-rw-r--r--src/plugins/platforms/windows/uiautomation/qwindowsuiamainprovider.cpp638
-rw-r--r--src/plugins/platforms/windows/uiautomation/qwindowsuiamainprovider.h105
-rw-r--r--src/plugins/platforms/windows/uiautomation/qwindowsuiaprovidercache.cpp106
-rw-r--r--src/plugins/platforms/windows/uiautomation/qwindowsuiaprovidercache.h77
-rw-r--r--src/plugins/platforms/windows/uiautomation/qwindowsuiarangevalueprovider.cpp190
-rw-r--r--src/plugins/platforms/windows/uiautomation/qwindowsuiarangevalueprovider.h73
-rw-r--r--src/plugins/platforms/windows/uiautomation/qwindowsuiaselectionitemprovider.cpp201
-rw-r--r--src/plugins/platforms/windows/uiautomation/qwindowsuiaselectionitemprovider.h71
-rw-r--r--src/plugins/platforms/windows/uiautomation/qwindowsuiaselectionprovider.cpp147
-rw-r--r--src/plugins/platforms/windows/uiautomation/qwindowsuiaselectionprovider.h69
-rw-r--r--src/plugins/platforms/windows/uiautomation/qwindowsuiatableitemprovider.cpp129
-rw-r--r--src/plugins/platforms/windows/uiautomation/qwindowsuiatableitemprovider.h68
-rw-r--r--src/plugins/platforms/windows/uiautomation/qwindowsuiatableprovider.cpp154
-rw-r--r--src/plugins/platforms/windows/uiautomation/qwindowsuiatableprovider.h69
-rw-r--r--src/plugins/platforms/windows/uiautomation/qwindowsuiatextprovider.cpp261
-rw-r--r--src/plugins/platforms/windows/uiautomation/qwindowsuiatextprovider.h80
-rw-r--r--src/plugins/platforms/windows/uiautomation/qwindowsuiatextrangeprovider.cpp554
-rw-r--r--src/plugins/platforms/windows/uiautomation/qwindowsuiatextrangeprovider.h88
-rw-r--r--src/plugins/platforms/windows/uiautomation/qwindowsuiatoggleprovider.cpp105
-rw-r--r--src/plugins/platforms/windows/uiautomation/qwindowsuiatoggleprovider.h68
-rw-r--r--src/plugins/platforms/windows/uiautomation/qwindowsuiautils.cpp221
-rw-r--r--src/plugins/platforms/windows/uiautomation/qwindowsuiautils.h89
-rw-r--r--src/plugins/platforms/windows/uiautomation/qwindowsuiavalueprovider.cpp132
-rw-r--r--src/plugins/platforms/windows/uiautomation/qwindowsuiavalueprovider.h70
-rw-r--r--src/plugins/platforms/windows/uiautomation/uiautomation.pri43
-rw-r--r--src/plugins/platforms/windows/windows.pri4
-rw-r--r--src/plugins/platforms/winrt/qwinrtclipboard.cpp2
-rw-r--r--src/plugins/platforms/winrt/qwinrtcursor.cpp2
-rw-r--r--src/plugins/platforms/winrt/qwinrtdrag.cpp2
-rw-r--r--src/plugins/platforms/winrt/qwinrtfiledialoghelper.cpp2
-rw-r--r--src/plugins/platforms/winrt/qwinrtfileengine.cpp2
-rw-r--r--src/plugins/platforms/winrt/qwinrtscreen.cpp8
-rw-r--r--src/plugins/platforms/winrt/qwinrtwindow.h4
-rw-r--r--src/plugins/platforms/xcb/gl_integrations/qxcbglintegration.h2
-rw-r--r--src/plugins/platforms/xcb/gl_integrations/qxcbnativeinterfacehandler.cpp12
-rw-r--r--src/plugins/platforms/xcb/gl_integrations/xcb_egl/qxcbeglintegration.cpp2
-rw-r--r--src/plugins/platforms/xcb/gl_integrations/xcb_egl/qxcbeglnativeinterfacehandler.cpp10
-rw-r--r--src/plugins/platforms/xcb/gl_integrations/xcb_egl/qxcbeglwindow.cpp2
-rw-r--r--src/plugins/platforms/xcb/gl_integrations/xcb_glx/qglxintegration.cpp4
-rw-r--r--src/plugins/platforms/xcb/gl_integrations/xcb_glx/qxcbglxintegration.cpp2
-rw-r--r--src/plugins/platforms/xcb/gl_integrations/xcb_glx/qxcbglxnativeinterfacehandler.cpp2
-rw-r--r--src/plugins/platforms/xcb/gl_integrations/xcb_glx/qxcbglxwindow.cpp4
-rw-r--r--src/plugins/platforms/xcb/nativepainting/qbackingstore_x11.cpp6
-rw-r--r--src/plugins/platforms/xcb/nativepainting/qpaintengine_x11_p.h38
-rw-r--r--src/plugins/platforms/xcb/nativepainting/qpixmap_x11_p.h34
-rw-r--r--src/plugins/platforms/xcb/nativepainting/qxcbnativepainting.cpp6
-rw-r--r--src/plugins/platforms/xcb/qxcbbackingstore.cpp215
-rw-r--r--src/plugins/platforms/xcb/qxcbclipboard.cpp5
-rw-r--r--src/plugins/platforms/xcb/qxcbconnection.cpp29
-rw-r--r--src/plugins/platforms/xcb/qxcbconnection.h27
-rw-r--r--src/plugins/platforms/xcb/qxcbconnection_xi2.cpp8
-rw-r--r--src/plugins/platforms/xcb/qxcbcursor.cpp72
-rw-r--r--src/plugins/platforms/xcb/qxcbdrag.cpp6
-rw-r--r--src/plugins/platforms/xcb/qxcbimage.cpp170
-rw-r--r--src/plugins/platforms/xcb/qxcbimage.h4
-rw-r--r--src/plugins/platforms/xcb/qxcbintegration.cpp8
-rw-r--r--src/plugins/platforms/xcb/qxcbkeyboard.cpp116
-rw-r--r--src/plugins/platforms/xcb/qxcbkeyboard.h2
-rw-r--r--src/plugins/platforms/xcb/qxcbmime.cpp11
-rw-r--r--src/plugins/platforms/xcb/qxcbnativeinterface.cpp54
-rw-r--r--src/plugins/platforms/xcb/qxcbscreen.cpp6
-rw-r--r--src/plugins/platforms/xcb/qxcbscreen.h2
-rw-r--r--src/plugins/platforms/xcb/qxcbwindow.cpp184
-rw-r--r--src/plugins/platforms/xcb/qxcbwindow.h14
-rw-r--r--src/plugins/platforms/xcb/xcb-plugin.pro2
-rw-r--r--src/plugins/platformthemes/flatpak/flatpak.json3
-rw-r--r--src/plugins/platformthemes/flatpak/flatpak.pro17
-rw-r--r--src/plugins/platformthemes/flatpak/main.cpp65
-rw-r--r--src/plugins/platformthemes/flatpak/qflatpakfiledialog.cpp347
-rw-r--r--src/plugins/platformthemes/flatpak/qflatpakfiledialog_p.h105
-rw-r--r--src/plugins/platformthemes/flatpak/qflatpaktheme.cpp254
-rw-r--r--src/plugins/platformthemes/flatpak/qflatpaktheme.h90
-rw-r--r--src/plugins/platformthemes/gtk3/main.cpp2
-rw-r--r--src/plugins/platformthemes/gtk3/qgtk3dialoghelpers.h42
-rw-r--r--src/plugins/platformthemes/gtk3/qgtk3theme.h12
-rw-r--r--src/plugins/platformthemes/platformthemes.pro2
-rw-r--r--src/plugins/printsupport/cups/main.cpp2
-rw-r--r--src/plugins/printsupport/cups/qcupsprintengine.cpp7
-rw-r--r--src/plugins/printsupport/cups/qcupsprintengine_p.h8
-rw-r--r--src/plugins/printsupport/cups/qcupsprintersupport_p.h10
-rw-r--r--src/plugins/printsupport/cups/qppdprintdevice.cpp33
-rw-r--r--src/plugins/printsupport/cups/qppdprintdevice.h37
-rw-r--r--src/plugins/printsupport/windows/qwindowsprintdevice.cpp4
-rw-r--r--src/plugins/printsupport/windows/qwindowsprintdevice.h30
-rw-r--r--src/plugins/printsupport/windows/qwindowsprintersupport.h10
-rw-r--r--src/plugins/sqldrivers/db2/qsql_db2.cpp32
-rw-r--r--src/plugins/sqldrivers/db2/qsql_db2_p.h26
-rw-r--r--src/plugins/sqldrivers/ibase/qsql_ibase.cpp16
-rw-r--r--src/plugins/sqldrivers/ibase/qsql_ibase_p.h32
-rw-r--r--src/plugins/sqldrivers/mysql/main.cpp2
-rw-r--r--src/plugins/sqldrivers/mysql/qsql_mysql.cpp32
-rw-r--r--src/plugins/sqldrivers/mysql/qsql_mysql_p.h28
-rw-r--r--src/plugins/sqldrivers/oci/qsql_oci.cpp229
-rw-r--r--src/plugins/sqldrivers/oci/qsql_oci_p.h24
-rw-r--r--src/plugins/sqldrivers/odbc/qsql_odbc.cpp36
-rw-r--r--src/plugins/sqldrivers/odbc/qsql_odbc_p.h28
-rw-r--r--src/plugins/sqldrivers/psql/main.cpp2
-rw-r--r--src/plugins/sqldrivers/psql/qsql_psql.cpp232
-rw-r--r--src/plugins/sqldrivers/psql/qsql_psql_p.h34
-rw-r--r--src/plugins/sqldrivers/sqlite/qsql_sqlite.cpp22
-rw-r--r--src/plugins/sqldrivers/sqlite/qsql_sqlite_p.h30
-rw-r--r--src/plugins/sqldrivers/sqlite/smain.cpp2
-rw-r--r--src/plugins/sqldrivers/sqlite2/qsql_sqlite2.cpp16
-rw-r--r--src/plugins/sqldrivers/sqlite2/qsql_sqlite2_p.h24
-rw-r--r--src/plugins/sqldrivers/tds/qsql_tds.cpp12
-rw-r--r--src/plugins/sqldrivers/tds/qsql_tds_p.h26
-rw-r--r--src/plugins/styles/mac/qmacstyle.qdoc28
-rw-r--r--src/plugins/styles/mac/qmacstyle_mac.mm9
-rw-r--r--src/plugins/styles/windowsvista/qwindowsxpstyle.cpp38
-rw-r--r--src/plugins/styles/windowsvista/qwindowsxpstyle_p_p.h8
-rw-r--r--src/printsupport/dialogs/qpagesetupdialog.h6
-rw-r--r--src/printsupport/dialogs/qpagesetupdialog_unix.cpp19
-rw-r--r--src/printsupport/dialogs/qpagesetupdialog_unix_p.h6
-rw-r--r--src/printsupport/dialogs/qprintdialog.h8
-rw-r--r--src/printsupport/dialogs/qprintdialog_unix.cpp533
-rw-r--r--src/printsupport/dialogs/qprintpreviewdialog.cpp10
-rw-r--r--src/printsupport/dialogs/qprintpreviewdialog.h4
-rw-r--r--src/printsupport/dialogs/qprintpropertieswidget.ui14
-rw-r--r--src/printsupport/kernel/qcups.cpp57
-rw-r--r--src/printsupport/kernel/qcups_p.h21
-rw-r--r--src/printsupport/kernel/qpaintengine_alpha.cpp9
-rw-r--r--src/printsupport/kernel/qplatformprintdevice.cpp37
-rw-r--r--src/printsupport/kernel/qplatformprintdevice.h20
-rw-r--r--src/printsupport/kernel/qprint_p.h1
-rw-r--r--src/printsupport/kernel/qprintdevice.cpp26
-rw-r--r--src/printsupport/kernel/qprintdevice_p.h15
-rw-r--r--src/printsupport/kernel/qprintengine_pdf_p.h16
-rw-r--r--src/printsupport/kernel/qprintengine_win.cpp8
-rw-r--r--src/printsupport/kernel/qprinter.cpp12
-rw-r--r--src/printsupport/kernel/qprinter.h14
-rw-r--r--src/printsupport/kernel/qprinterinfo.cpp2
-rw-r--r--src/printsupport/widgets/qcupsjobwidget.cpp53
-rw-r--r--src/printsupport/widgets/qcupsjobwidget_p.h5
-rw-r--r--src/printsupport/widgets/qprintpreviewwidget.cpp8
-rw-r--r--src/printsupport/widgets/qprintpreviewwidget.h2
-rw-r--r--src/sql/kernel/qsqlcachedresult_p.h20
-rw-r--r--src/sql/kernel/qsqldatabase.cpp4
-rw-r--r--src/sql/kernel/qsqldatabase.h2
-rw-r--r--src/sql/kernel/qsqldriver.h4
-rw-r--r--src/sql/kernel/qsqldriverplugin.h2
-rw-r--r--src/sql/kernel/qsqlnulldriver_p.h52
-rw-r--r--src/sql/models/qsqlrelationaltablemodel.cpp8
-rw-r--r--src/sql/models/qsqlrelationaltablemodel.h24
-rw-r--r--src/sql/models/qsqltablemodel.h30
-rw-r--r--src/testlib/3rdparty/cycle_p.h17
-rw-r--r--src/testlib/doc/qttestlib.qdocconf1
-rw-r--r--src/testlib/qbenchmarkperfevents_p.h20
-rw-r--r--src/testlib/qcsvbenchmarklogger_p.h14
-rw-r--r--src/testlib/qsignalspy.h4
-rw-r--r--src/testlib/qtest.h2
-rw-r--r--src/testlib/qtest_gui.h26
-rw-r--r--src/testlib/qtest_network.h12
-rw-r--r--src/testlib/qtestaccessible.h8
-rw-r--r--src/testlib/qtestcase.cpp105
-rw-r--r--src/testlib/qtestcase.h14
-rw-r--r--src/testlib/qtestcase.qdoc4
-rw-r--r--src/testlib/qtesteventloop.h6
-rw-r--r--src/testlib/qtestmouse.h37
-rw-r--r--src/testlib/qtesttable.cpp6
-rw-r--r--src/testlib/qtesttouch.h16
-rw-r--r--src/testlib/qxctestlogger_p.h16
-rw-r--r--src/tools/bootstrap/bootstrap.pro1
-rw-r--r--src/tools/moc/generator.cpp2
-rw-r--r--src/tools/rcc/rcc.cpp6
-rw-r--r--src/tools/uic/cpp/cppwritedeclaration.h14
-rw-r--r--src/tools/uic/cpp/cppwriteincludes.h18
-rw-r--r--src/tools/uic/cpp/cppwriteinitialization.h28
-rw-r--r--src/tools/uic/customwidgetsinfo.h6
-rw-r--r--src/tools/uic/databaseinfo.h4
-rw-r--r--src/tools/uic/validator.h12
-rw-r--r--src/widgets/accessible/complexwidgets.cpp32
-rw-r--r--src/widgets/accessible/complexwidgets_p.h36
-rw-r--r--src/widgets/accessible/itemviews_p.h178
-rw-r--r--src/widgets/accessible/qaccessiblemenu.cpp2
-rw-r--r--src/widgets/accessible/qaccessiblemenu_p.h54
-rw-r--r--src/widgets/accessible/qaccessiblewidget.h36
-rw-r--r--src/widgets/accessible/qaccessiblewidgets.cpp2
-rw-r--r--src/widgets/accessible/qaccessiblewidgets_p.h132
-rw-r--r--src/widgets/accessible/rangecontrols.cpp2
-rw-r--r--src/widgets/accessible/rangecontrols_p.h72
-rw-r--r--src/widgets/accessible/simplewidgets.cpp4
-rw-r--r--src/widgets/accessible/simplewidgets_p.h118
-rw-r--r--src/widgets/dialogs/qcolordialog.cpp87
-rw-r--r--src/widgets/dialogs/qcolordialog.h14
-rw-r--r--src/widgets/dialogs/qdialog.h2
-rw-r--r--src/widgets/dialogs/qdialog_p.h2
-rw-r--r--src/widgets/dialogs/qerrormessage.cpp4
-rw-r--r--src/widgets/dialogs/qerrormessage.h6
-rw-r--r--src/widgets/dialogs/qfiledialog.cpp12
-rw-r--r--src/widgets/dialogs/qfiledialog.h38
-rw-r--r--src/widgets/dialogs/qfiledialog_p.h22
-rw-r--r--src/widgets/dialogs/qfileinfogatherer_p.h2
-rw-r--r--src/widgets/dialogs/qfilesystemmodel.h42
-rw-r--r--src/widgets/dialogs/qfontdialog.cpp2
-rw-r--r--src/widgets/dialogs/qfontdialog.h16
-rw-r--r--src/widgets/dialogs/qfontdialog_p.h6
-rw-r--r--src/widgets/dialogs/qfscompleter_p.h4
-rw-r--r--src/widgets/dialogs/qinputdialog.cpp11
-rw-r--r--src/widgets/dialogs/qinputdialog.h22
-rw-r--r--src/widgets/dialogs/qmessagebox.cpp14
-rw-r--r--src/widgets/dialogs/qmessagebox.h18
-rw-r--r--src/widgets/dialogs/qprogressdialog.h14
-rw-r--r--src/widgets/dialogs/qsidebar_p.h20
-rw-r--r--src/widgets/dialogs/qwizard.cpp12
-rw-r--r--src/widgets/dialogs/qwizard.h22
-rw-r--r--src/widgets/dialogs/qwizard_win.cpp5
-rw-r--r--src/widgets/dialogs/qwizard_win_p.h4
-rw-r--r--src/widgets/doc/snippets/javastyle.cpp8
-rw-r--r--src/widgets/effects/qgraphicseffect.h26
-rw-r--r--src/widgets/effects/qpixmapfilter_p.h14
-rw-r--r--src/widgets/graphicsview/qgraphicsanchorlayout.h14
-rw-r--r--src/widgets/graphicsview/qgraphicsanchorlayout_p.h4
-rw-r--r--src/widgets/graphicsview/qgraphicsgridlayout.h14
-rw-r--r--src/widgets/graphicsview/qgraphicsgridlayoutengine_p.h14
-rw-r--r--src/widgets/graphicsview/qgraphicsitem.cpp90
-rw-r--r--src/widgets/graphicsview/qgraphicsitem.h270
-rw-r--r--src/widgets/graphicsview/qgraphicsitem_p.h22
-rw-r--r--src/widgets/graphicsview/qgraphicsitemanimation.h2
-rw-r--r--src/widgets/graphicsview/qgraphicslayout.h6
-rw-r--r--src/widgets/graphicsview/qgraphicslayoutitem.h2
-rw-r--r--src/widgets/graphicsview/qgraphicslayoutstyleinfo_p.h10
-rw-r--r--src/widgets/graphicsview/qgraphicslinearlayout.h16
-rw-r--r--src/widgets/graphicsview/qgraphicsproxywidget.cpp8
-rw-r--r--src/widgets/graphicsview/qgraphicsproxywidget.h66
-rw-r--r--src/widgets/graphicsview/qgraphicsscene.h16
-rw-r--r--src/widgets/graphicsview/qgraphicsscene_bsp.cpp6
-rw-r--r--src/widgets/graphicsview/qgraphicsscenebsptreeindex_p.h20
-rw-r--r--src/widgets/graphicsview/qgraphicsscenelinearindex_p.h10
-rw-r--r--src/widgets/graphicsview/qgraphicstransform.h10
-rw-r--r--src/widgets/graphicsview/qgraphicsview.h56
-rw-r--r--src/widgets/graphicsview/qgraphicswidget.cpp10
-rw-r--r--src/widgets/graphicsview/qgraphicswidget.h34
-rw-r--r--src/widgets/graphicsview/qgraphicswidget_p.h16
-rw-r--r--src/widgets/itemviews/qabstractitemdelegate.cpp9
-rw-r--r--src/widgets/itemviews/qabstractitemdelegate.h4
-rw-r--r--src/widgets/itemviews/qabstractitemview.h44
-rw-r--r--src/widgets/itemviews/qcolumnview.h40
-rw-r--r--src/widgets/itemviews/qcolumnview_p.h26
-rw-r--r--src/widgets/itemviews/qcolumnviewgrip_p.h10
-rw-r--r--src/widgets/itemviews/qdatawidgetmapper.h2
-rw-r--r--src/widgets/itemviews/qdirmodel.h34
-rw-r--r--src/widgets/itemviews/qheaderview.cpp28
-rw-r--r--src/widgets/itemviews/qheaderview.h59
-rw-r--r--src/widgets/itemviews/qheaderview_p.h4
-rw-r--r--src/widgets/itemviews/qitemdelegate.cpp5
-rw-r--r--src/widgets/itemviews/qitemdelegate.h18
-rw-r--r--src/widgets/itemviews/qitemeditorfactory.cpp6
-rw-r--r--src/widgets/itemviews/qitemeditorfactory_p.h2
-rw-r--r--src/widgets/itemviews/qlistview.h70
-rw-r--r--src/widgets/itemviews/qlistwidget.cpp19
-rw-r--r--src/widgets/itemviews/qlistwidget.h23
-rw-r--r--src/widgets/itemviews/qlistwidget_p.h2
-rw-r--r--src/widgets/itemviews/qstyleditemdelegate.h18
-rw-r--r--src/widgets/itemviews/qtableview.cpp2
-rw-r--r--src/widgets/itemviews/qtableview.h54
-rw-r--r--src/widgets/itemviews/qtablewidget.cpp16
-rw-r--r--src/widgets/itemviews/qtablewidget.h17
-rw-r--r--src/widgets/itemviews/qtreeview.cpp21
-rw-r--r--src/widgets/itemviews/qtreeview.h77
-rw-r--r--src/widgets/itemviews/qtreewidget.cpp15
-rw-r--r--src/widgets/itemviews/qtreewidget.h16
-rw-r--r--src/widgets/itemviews/qtreewidget_p.h40
-rw-r--r--src/widgets/kernel/mac.pri2
-rw-r--r--src/widgets/kernel/qaction.h4
-rw-r--r--src/widgets/kernel/qapplication.cpp27
-rw-r--r--src/widgets/kernel/qapplication.h10
-rw-r--r--src/widgets/kernel/qapplication_p.h29
-rw-r--r--src/widgets/kernel/qboxlayout.cpp2
-rw-r--r--src/widgets/kernel/qboxlayout.h28
-rw-r--r--src/widgets/kernel/qdesktopwidget.cpp43
-rw-r--r--src/widgets/kernel/qdesktopwidget.h60
-rw-r--r--src/widgets/kernel/qdesktopwidget.qdoc56
-rw-r--r--src/widgets/kernel/qdesktopwidget_p.h2
-rw-r--r--src/widgets/kernel/qformlayout.cpp2
-rw-r--r--src/widgets/kernel/qformlayout.h28
-rw-r--r--src/widgets/kernel/qgesture.h12
-rw-r--r--src/widgets/kernel/qgridlayout.cpp2
-rw-r--r--src/widgets/kernel/qgridlayout.h26
-rw-r--r--src/widgets/kernel/qlayout.h20
-rw-r--r--src/widgets/kernel/qlayoutitem.cpp4
-rw-r--r--src/widgets/kernel/qopenglwidget.cpp26
-rw-r--r--src/widgets/kernel/qopenglwidget.h14
-rw-r--r--src/widgets/kernel/qshortcut.h4
-rw-r--r--src/widgets/kernel/qstackedlayout.cpp2
-rw-r--r--src/widgets/kernel/qstackedlayout.h18
-rw-r--r--src/widgets/kernel/qstandardgestures_p.h30
-rw-r--r--src/widgets/kernel/qtooltip.cpp13
-rw-r--r--src/widgets/kernel/qtooltip.h2
-rw-r--r--src/widgets/kernel/qwhatsthis.cpp14
-rw-r--r--src/widgets/kernel/qwhatsthis.h4
-rw-r--r--src/widgets/kernel/qwidget.cpp14
-rw-r--r--src/widgets/kernel/qwidget.h22
-rw-r--r--src/widgets/kernel/qwidget_p.h22
-rw-r--r--src/widgets/kernel/qwidgetaction.h4
-rw-r--r--src/widgets/kernel/qwidgetbackingstore.cpp2
-rw-r--r--src/widgets/kernel/qwidgetwindow.cpp21
-rw-r--r--src/widgets/kernel/qwidgetwindow_p.h8
-rw-r--r--src/widgets/kernel/qwindowcontainer_p.h2
-rw-r--r--src/widgets/statemachine/qbasickeyeventtransition_p.h4
-rw-r--r--src/widgets/statemachine/qbasicmouseeventtransition_p.h4
-rw-r--r--src/widgets/statemachine/qkeyeventtransition.h8
-rw-r--r--src/widgets/statemachine/qmouseeventtransition.h8
-rw-r--r--src/widgets/styles/qcommonstyle.cpp2
-rw-r--r--src/widgets/styles/qcommonstyle.h46
-rw-r--r--src/widgets/styles/qdrawutil.h20
-rw-r--r--src/widgets/styles/qfusionstyle.cpp4
-rw-r--r--src/widgets/styles/qfusionstyle_p.h42
-rw-r--r--src/widgets/styles/qpixmapstyle_p.h32
-rw-r--r--src/widgets/styles/qproxystyle.h50
-rw-r--r--src/widgets/styles/qstyle.h34
-rw-r--r--src/widgets/styles/qstyleanimation_p.h12
-rw-r--r--src/widgets/styles/qstyleoption.h8
-rw-r--r--src/widgets/styles/qstylepainter.h2
-rw-r--r--src/widgets/styles/qstyleplugin.h2
-rw-r--r--src/widgets/styles/qstylesheetstyle.cpp26
-rw-r--r--src/widgets/styles/qstylesheetstyle_p.h48
-rw-r--r--src/widgets/styles/qwindowsstyle.cpp4
-rw-r--r--src/widgets/styles/qwindowsstyle_p.h30
-rw-r--r--src/widgets/styles/qwindowsstyle_p_p.h2
-rw-r--r--src/widgets/util/qcompleter.h10
-rw-r--r--src/widgets/util/qcompleter_p.h26
-rw-r--r--src/widgets/util/qflickgesture.cpp2
-rw-r--r--src/widgets/util/qscroller.cpp54
-rw-r--r--src/widgets/util/qscroller_p.h1
-rw-r--r--src/widgets/util/qsystemtrayicon.h6
-rw-r--r--src/widgets/util/qsystemtrayicon_p.h8
-rw-r--r--src/widgets/util/qsystemtrayicon_x11.cpp12
-rw-r--r--src/widgets/util/qundogroup.h2
-rw-r--r--src/widgets/util/qundostack.h6
-rw-r--r--src/widgets/util/qundoview.cpp10
-rw-r--r--src/widgets/util/qundoview.h6
-rw-r--r--src/widgets/widgets.pro1
-rw-r--r--src/widgets/widgets/qabstractbutton.h26
-rw-r--r--src/widgets/widgets/qabstractscrollarea.h38
-rw-r--r--src/widgets/widgets/qabstractscrollarea_p.h2
-rw-r--r--src/widgets/widgets/qabstractslider.h14
-rw-r--r--src/widgets/widgets/qabstractspinbox.cpp12
-rw-r--r--src/widgets/widgets/qabstractspinbox.h4
-rw-r--r--src/widgets/widgets/qbuttongroup.h2
-rw-r--r--src/widgets/widgets/qcalendarwidget.cpp84
-rw-r--r--src/widgets/widgets/qcalendarwidget.h16
-rw-r--r--src/widgets/widgets/qcheckbox.cpp15
-rw-r--r--src/widgets/widgets/qcheckbox.h20
-rw-r--r--src/widgets/widgets/qcombobox.cpp6
-rw-r--r--src/widgets/widgets/qcombobox.h38
-rw-r--r--src/widgets/widgets/qcommandlinkbutton.cpp2
-rw-r--r--src/widgets/widgets/qcommandlinkbutton.h16
-rw-r--r--src/widgets/widgets/qdatetimeedit.cpp10
-rw-r--r--src/widgets/widgets/qdatetimeedit.h18
-rw-r--r--src/widgets/widgets/qdatetimeedit_p.h34
-rw-r--r--src/widgets/widgets/qdial.cpp2
-rw-r--r--src/widgets/widgets/qdial.h20
-rw-r--r--src/widgets/widgets/qdialogbuttonbox.h12
-rw-r--r--src/widgets/widgets/qdockwidget.cpp12
-rw-r--r--src/widgets/widgets/qdockwidget.h12
-rw-r--r--src/widgets/widgets/qdockwidget_p.h22
-rw-r--r--src/widgets/widgets/qeffects.cpp13
-rw-r--r--src/widgets/widgets/qfocusframe.h8
-rw-r--r--src/widgets/widgets/qfontcombobox.cpp10
-rw-r--r--src/widgets/widgets/qfontcombobox.h6
-rw-r--r--src/widgets/widgets/qframe.h12
-rw-r--r--src/widgets/widgets/qgroupbox.cpp2
-rw-r--r--src/widgets/widgets/qgroupbox.h24
-rw-r--r--src/widgets/widgets/qkeysequenceedit.h12
-rw-r--r--src/widgets/widgets/qlabel.cpp14
-rw-r--r--src/widgets/widgets/qlabel.h32
-rw-r--r--src/widgets/widgets/qlcdnumber.h10
-rw-r--r--src/widgets/widgets/qlineedit.cpp2
-rw-r--r--src/widgets/widgets/qlineedit.h42
-rw-r--r--src/widgets/widgets/qlineedit_p.cpp4
-rw-r--r--src/widgets/widgets/qlineedit_p.h4
-rw-r--r--src/widgets/widgets/qmaccocoaviewcontainer_mac.h2
-rw-r--r--src/widgets/widgets/qmacnativewidget_mac.h2
-rw-r--r--src/widgets/widgets/qmainwindow.h6
-rw-r--r--src/widgets/widgets/qmainwindowlayout.cpp22
-rw-r--r--src/widgets/widgets/qmainwindowlayout_p.h26
-rw-r--r--src/widgets/widgets/qmdiarea.cpp4
-rw-r--r--src/widgets/widgets/qmdiarea.h26
-rw-r--r--src/widgets/widgets/qmdiarea_p.h16
-rw-r--r--src/widgets/widgets/qmdisubwindow.cpp26
-rw-r--r--src/widgets/widgets/qmdisubwindow.h46
-rw-r--r--src/widgets/widgets/qmdisubwindow_p.h2
-rw-r--r--src/widgets/widgets/qmenu.cpp27
-rw-r--r--src/widgets/widgets/qmenu.h44
-rw-r--r--src/widgets/widgets/qmenu_p.h6
-rw-r--r--src/widgets/widgets/qmenubar.cpp8
-rw-r--r--src/widgets/widgets/qmenubar.h2
-rw-r--r--src/widgets/widgets/qplaintextedit.cpp45
-rw-r--r--src/widgets/widgets/qplaintextedit.h67
-rw-r--r--src/widgets/widgets/qplaintextedit_p.h18
-rw-r--r--src/widgets/widgets/qprogressbar.cpp2
-rw-r--r--src/widgets/widgets/qprogressbar.h10
-rw-r--r--src/widgets/widgets/qpushbutton.h22
-rw-r--r--src/widgets/widgets/qradiobutton.h16
-rw-r--r--src/widgets/widgets/qrubberband.h14
-rw-r--r--src/widgets/widgets/qscrollarea.h18
-rw-r--r--src/widgets/widgets/qscrollbar.h24
-rw-r--r--src/widgets/widgets/qsizegrip.h22
-rw-r--r--src/widgets/widgets/qslider.h18
-rw-r--r--src/widgets/widgets/qspinbox.cpp12
-rw-r--r--src/widgets/widgets/qspinbox.h4
-rw-r--r--src/widgets/widgets/qsplashscreen.h4
-rw-r--r--src/widgets/widgets/qsplitter.h30
-rw-r--r--src/widgets/widgets/qstackedwidget.h4
-rw-r--r--src/widgets/widgets/qstatusbar.h10
-rw-r--r--src/widgets/widgets/qtabbar.h30
-rw-r--r--src/widgets/widgets/qtabbar_p.h18
-rw-r--r--src/widgets/widgets/qtabwidget.h22
-rw-r--r--src/widgets/widgets/qtextbrowser.cpp2
-rw-r--r--src/widgets/widgets/qtextbrowser.h20
-rw-r--r--src/widgets/widgets/qtextedit.cpp6
-rw-r--r--src/widgets/widgets/qtextedit.h52
-rw-r--r--src/widgets/widgets/qtoolbar.h12
-rw-r--r--src/widgets/widgets/qtoolbarextension_p.h4
-rw-r--r--src/widgets/widgets/qtoolbarlayout_p.h24
-rw-r--r--src/widgets/widgets/qtoolbarseparator_p.h4
-rw-r--r--src/widgets/widgets/qtoolbox.cpp6
-rw-r--r--src/widgets/widgets/qtoolbox.h8
-rw-r--r--src/widgets/widgets/qtoolbutton.cpp2
-rw-r--r--src/widgets/widgets/qtoolbutton.h32
-rw-r--r--src/widgets/widgets/qwidgetlinecontrol_p.h2
-rw-r--r--src/widgets/widgets/qwidgetresizehandler_p.h2
-rw-r--r--src/widgets/widgets/qwidgettextcontrol.cpp4
-rw-r--r--src/widgets/widgets/qwidgettextcontrol_p.h8
-rw-r--r--src/winmain/qtmain_win.cpp2
-rw-r--r--src/winmain/qtmain_winrt.cpp18
-rw-r--r--src/xml/dom/qdom.cpp120
-rw-r--r--src/xml/dom/qdom.h16
-rw-r--r--src/xml/sax/qxml.cpp4
-rw-r--r--src/xml/sax/qxml.h118
1419 files changed, 35028 insertions, 20975 deletions
diff --git a/src/3rdparty/harfbuzz-ng/NEWS b/src/3rdparty/harfbuzz-ng/NEWS
index 8c3ef117dd..7434bcada0 100644
--- a/src/3rdparty/harfbuzz-ng/NEWS
+++ b/src/3rdparty/harfbuzz-ng/NEWS
@@ -1,3 +1,261 @@
+Overview of changes leading to 1.7.4
+Wednesday, December 20, 2017
+====================================
+
+- Fix collect_glyphs() regression caused by hb_set_t changes.
+
+
+Overview of changes leading to 1.7.3
+Monday, December 18, 2017
+====================================
+
+- hb_set_t performance tuning and optimizations.
+- Speed up collect_glyphs() and reject garbage data.
+- In hb_coretext_font_create() set font point-size (ptem).
+- Misc fixes.
+
+
+Overview of changes leading to 1.7.2
+Monday, December 4, 2017
+====================================
+
+- Optimize hb_set_add_range().
+- Misc fixes.
+- New API:
+hb_coretext_font_create()
+
+
+Overview of changes leading to 1.7.1
+Tuesday, November 14, 2017
+====================================
+
+- Fix atexit object destruction regression.
+- Fix minor integer-overflow.
+
+
+Overview of changes leading to 1.7.0
+Monday, November 13, 2017
+====================================
+
+- Minor Indic fixes.
+- Implement kerning and glyph names in hb-ot-font.
+- Various DSO optimization re .data and .bss sizes.
+- Make C++11 optional; build fixes.
+- Mark all other backends "unsafe-to-break".
+- Graphite fix.
+
+
+Overview of changes leading to 1.6.3
+Thursday, October 26th, 2017
+====================================
+
+- Fix hb_set_t some more. Should be solid now.
+- Implement get_glyph_name() for hb-ot-font.
+- Misc fixes.
+
+
+Overview of changes leading to 1.6.2
+Monday, October 23nd, 2017
+====================================
+
+- Yesterday's release had a bad crasher; don't use it. That's what
+ happens when one works on Sunday...
+ https://github.com/harfbuzz/harfbuzz/issues/578
+- Build fixes for FreeBSD and Chrome Android.
+
+
+Overview of changes leading to 1.6.1
+Sunday, October 22nd, 2017
+====================================
+
+- Don't skip over COMBINING GRAPHEME JOINER when ligating, etc.
+ To be refined: https://github.com/harfbuzz/harfbuzz/issues/554
+- Faster hb_set_t implementation.
+- Don't use deprecated ICU API.
+- Fix undefined-behavior in Myanmar shaper, introduced in 1.6.0
+- Deprecated API:
+ hb_set_invert()
+
+
+Overview of changes leading to 1.6.0
+Friday, October the 13th, 2017
+====================================
+
+- Update to Unicode 10.
+
+- Various Indic and Universal Shaping Engine fixes as a result of
+ HarfBuzz Hackfest with Jonathan Kew at Web Engines Hackfest at
+ the Igalia offices in A Coruña, Spain. Thanks Igalia for having
+ us!
+
+- Implement Unicode Arabic Mark Ordering Algorithm UTR#53.
+
+- Implement optical sizing / tracking in CoreText backend, using
+ new API hb_font_set_ptem().
+
+- Allow notifying hb_font_t that underlying FT_Face changed sizing,
+ using new API hb_ft_font_changed().
+
+- More Graphite backend RTL fixes.
+
+- Fix caching of variable font shaping plans.
+
+- hb-view / hb-shape now accept following new arguments:
+
+ o --unicodes: takes a list of hex numbers that represent Unicode
+ codepoints.
+
+New API:
++hb_face_get_table_tags()
++hb_font_set_ptem()
++hb_font_get_ptem()
++hb_ft_font_changed()
+
+
+Overview of changes leading to 1.5.1
+Tuesday, September 5, 2017
+====================================
+
+- Fix "unsafe-to-break" in fallback shaping and other corner cases.
+ All our tests pass with --verify now, meaning unsafe-to-break API
+ works as expected.
+- Add --unicodes to hb-view / hb-shape.
+- [indic] Treat Consonant_With_Stacker as consonant. This will need
+ further tweaking.
+- hb_buffer_diff() tweaks.
+
+
+Overview of changes leading to 1.5.0
+Wednesday, August 23, 2017
+====================================
+
+- Misc new API, for appending a buffer to another, and for comparing
+ contents of two buffers for types of differences.
+
+- New "unsafe-to-break" API. Can be used to speed up reshaping
+ in line-breaking situations. Essentially, after shaping, it returns
+ positions in the input string (some of the cluster boundaries) that
+ are "safe to break" in that if the text is segmented at that position
+ and two sides reshaped and concatenated, the shaping result is
+ exactly the same as shaping the text in one piece.
+
+ hb-view and hb-shape and hb-shape now take --verify, which verifies
+ the above property.
+
+ Some corner cases of the implementation are still not quite working.
+ Those will be fixed in subsequent releases.
+
+- New API:
+
+hb_buffer_append()
+
+hb_glyph_flags_t
+HB_GLYPH_FLAG_UNSAFE_TO_BREAK
+HB_GLYPH_FLAG_DEFINED
+hb_glyph_info_get_glyph_flags()
+
+HB_BUFFER_SERIALIZE_FLAG_GLYPH_FLAGS
+
+hb_buffer_diff_flags_t
+HB_BUFFER_DIFF_FLAG_EQUAL
+HB_BUFFER_DIFF_FLAG_CONTENT_TYPE_MISMATCH
+HB_BUFFER_DIFF_FLAG_LENGTH_MISMATCH
+HB_BUFFER_DIFF_FLAG_NOTDEF_PRESENT
+HB_BUFFER_DIFF_FLAG_DOTTED_CIRCLE_PRESENT
+HB_BUFFER_DIFF_FLAG_CODEPOINT_MISMATCH
+HB_BUFFER_DIFF_FLAG_CLUSTER_MISMATCH
+HB_BUFFER_DIFF_FLAG_GLYPH_FLAGS_MISMATCH
+HB_BUFFER_DIFF_FLAG_POSITION_MISMATCH
+hb_buffer_diff
+
+
+Overview of changes leading to 1.4.8
+Tuesday, August 8, 2017
+====================================
+
+- Major fix to avar table handling.
+- Rename hb-shape --show-message to --trace.
+- Build fixes.
+
+
+Overview of changes leading to 1.4.7
+Tuesday, July 18, 2017
+====================================
+
+- Multiple Indic, Tibetan, and Cham fixes.
+- CoreText: Allow disabling kerning.
+- Adjust Arabic feature order again.
+- Misc build fixes.
+
+
+Overview of changes leading to 1.4.6
+Sunday, April 23, 2017
+====================================
+
+- Graphite2: Fix RTL positioning issue.
+- Backlist GDEF of more versions of Padauk and Tahoma.
+- New, experimental, cmake alternative build system.
+
+
+Overview of changes leading to 1.4.5
+Friday, March 10, 2017
+====================================
+
+- Revert "Fix Context lookup application when moving back after a glyph..."
+ This introduced memory access problems. To be fixed properly soon.
+
+
+Overview of changes leading to 1.4.4
+Sunday, March 5, 2017
+====================================
+
+- Fix Context lookup application when moving back after a glyph deletion.
+- Fix buffer-overrun in Bengali.
+
+
+Overview of changes leading to 1.4.3
+Saturday, February 25, 2017
+====================================
+
+- Route Adlam script to Arabic shaper.
+- Misc fixes.
+- New API:
+ hb_font_set_face()
+- Deprecate API:
+ hb_graphite2_font_get_gr_font()
+
+
+Overview of changes leading to 1.4.2
+Monday, January 23, 2017
+====================================
+
+- Implement OpenType Font Variation tables avar/fvar/HVAR/VVAR.
+- hb-shape and hb-view now accept --variations.
+- New API:
+
+hb_variation_t
+hb_variation_from_string()
+hb_variation_to_string()
+
+hb_font_set_variations()
+hb_font_set_var_coords_design()
+hb_font_get_var_coords_normalized()
+
+hb-ot-var.h:
+hb_ot_var_axis_t
+hb_ot_var_has_data()
+hb_ot_var_get_axis_count()
+hb_ot_var_get_axes()
+hb_ot_var_find_axis()
+hb_ot_var_normalize_variations()
+hb_ot_var_normalize_coords()
+
+- MVAR to be implemented later. Access to named instances to be
+ implemented later as well.
+
+- Misc fixes.
+
+
Overview of changes leading to 1.4.1
Thursday, January 5, 2017
====================================
@@ -212,7 +470,7 @@ Tuesday, February 23, 2016
- CoreText: Drastically speed up font initialization.
- CoreText: Fix tiny leak.
- Group ZWJ/ZWNJ with previous syllable under cluster-level=0.
- https://github.com/behdad/harfbuzz/issues/217
+ https://github.com/harfbuzz/harfbuzz/issues/217
- Add test/shaping/README.md about how to add tests to the suite.
@@ -228,8 +486,8 @@ Friday, February 19, 2016
- Allow GPOS cursive connection on marks, and fix the interaction with
mark attachment. This work resulted in some changes to how mark
attachments work. See:
- https://github.com/behdad/harfbuzz/issues/211
- https://github.com/behdad/harfbuzz/commit/86c68c7a2c971efe8e35b1f1bd99401dc8b688d2
+ https://github.com/harfbuzz/harfbuzz/issues/211
+ https://github.com/harfbuzz/harfbuzz/commit/86c68c7a2c971efe8e35b1f1bd99401dc8b688d2
- Graphite2 shaper: improved negative advance handling (eg. Nastaliq).
- Add nmake-based build system for Windows.
- Minor speedup.
@@ -270,7 +528,7 @@ Wednesday, November 26, 2015
====================================
- Fix badly-broken fallback shaper that affected terminology.
- https://github.com/behdad/harfbuzz/issues/187
+ https://github.com/harfbuzz/harfbuzz/issues/187
- Fix y_scaling in Graphite shaper.
- API changes:
* An unset glyph_h_origin() function in font-funcs now (sensibly)
@@ -292,11 +550,11 @@ Wednesday, November 18, 2015
====================================
- Implement 'stch' stretch feature for Syriac Abbreviation Mark.
- https://github.com/behdad/harfbuzz/issues/141
+ https://github.com/harfbuzz/harfbuzz/issues/141
- Disable use of decompose_compatibility() callback.
- Implement "shaping" of various Unicode space characters, even
if the font does not support them.
- https://github.com/behdad/harfbuzz/issues/153
+ https://github.com/harfbuzz/harfbuzz/issues/153
- If font does not support U+2011 NO-BREAK HYPHEN, fallback to
U+2010 HYPHEN.
- Changes resulting from libFuzzer continuous fuzzing:
@@ -319,7 +577,7 @@ Thursday, October 15, 2015
- Revert default load-flags of fonts created using hb_ft_font_create()
back to FT_LOAD_DEFAULT|FT_LOAD_NO_HINTING. This was changed in
last release (1.0.5), but caused major issues, so revert.
- https://github.com/behdad/harfbuzz/issues/143
+ https://github.com/harfbuzz/harfbuzz/issues/143
Overview of changes leading to 1.0.5
@@ -327,7 +585,7 @@ Tuesday, October 13, 2015
====================================
- Fix multiple memory access bugs discovered using libFuzzer.
- https://github.com/behdad/harfbuzz/issues/139
+ https://github.com/harfbuzz/harfbuzz/issues/139
Everyone should upgrade to this version as soon as possible.
We now have continuous fuzzing set up, to avoid issues like
these creeping in again.
@@ -598,7 +856,7 @@ Wednesday, July 16, 2014
U+FFFD REPLACEMENT CHARACTER now.
- With all changes in this release, the buffer will contain fully
valid Unicode after hb_buffer_add_utf8/16/32 no matter how
- broken the input is. This can be overriden though. See below.
+ broken the input is. This can be overridden though. See below.
- Fix Mongolian Variation Selectors for fonts without GDEF.
- Fix minor invalid buffer access.
- Accept zh-Hant and zh-Hans language tags. hb_ot_tag_to_language()
diff --git a/src/3rdparty/harfbuzz-ng/README b/src/3rdparty/harfbuzz-ng/README
index 69a1bdd9ff..aa055169d5 100644
--- a/src/3rdparty/harfbuzz-ng/README
+++ b/src/3rdparty/harfbuzz-ng/README
@@ -1,6 +1,7 @@
-[![Build Status](https://travis-ci.org/behdad/harfbuzz.svg)](https://travis-ci.org/behdad/harfbuzz)
-[![Build Status](https://ci.appveyor.com/api/projects/status/4oaq58ns2h0m2soa?svg=true)](https://ci.appveyor.com/project/behdad/harfbuzz)
-[![Coverage Status](https://img.shields.io/coveralls/behdad/harfbuzz.svg)](https://coveralls.io/r/behdad/harfbuzz)
+[![Build Status](https://travis-ci.org/harfbuzz/harfbuzz.svg)](https://travis-ci.org/harfbuzz/harfbuzz)
+[![Build status](https://ci.appveyor.com/api/projects/status/0t0flrxpstj9lb9w?svg=true)](https://ci.appveyor.com/project/harfbuzz/harfbuzz)
+[![CircleCI](https://circleci.com/gh/harfbuzz/harfbuzz.svg?style=svg)](https://circleci.com/gh/harfbuzz/harfbuzz)
+[![Coverage Status](https://img.shields.io/coveralls/harfbuzz/harfbuzz.svg)](https://coveralls.io/r/harfbuzz/harfbuzz)
[ABI Tracker](http://abi-laboratory.pro/tracker/timeline/harfbuzz/)
This is HarfBuzz, a text shaping library.
@@ -10,3 +11,5 @@ For bug reports, mailing list, and other information please visit:
http://harfbuzz.org/
For license information, see the file COPYING.
+
+Documentation: https://harfbuzz.github.io
diff --git a/src/3rdparty/harfbuzz-ng/harfbuzz-ng.pro b/src/3rdparty/harfbuzz-ng/harfbuzz-ng.pro
index e5746bf3eb..ad40b98753 100644
--- a/src/3rdparty/harfbuzz-ng/harfbuzz-ng.pro
+++ b/src/3rdparty/harfbuzz-ng/harfbuzz-ng.pro
@@ -56,6 +56,8 @@ HEADERS += \
$$PWD/src/hb-buffer-deserialize-json.hh \
$$PWD/src/hb-buffer-deserialize-text.hh \
$$PWD/src/hb-cache-private.hh \
+ $$PWD/src/hb-debug.hh \
+ $$PWD/src/hb-dsalgs.hh \
$$PWD/src/hb-face-private.hh \
$$PWD/src/hb-font-private.hh \
$$PWD/src/hb-mutex-private.hh \
@@ -73,11 +75,13 @@ HEADERS += \
$$PWD/src/hb-ot-os2-table.hh \
$$PWD/src/hb-ot-post-table.hh \
$$PWD/src/hb-private.hh \
+ $$PWD/src/hb-set-digest-private.hh \
$$PWD/src/hb-set-private.hh \
$$PWD/src/hb-shape-plan-private.hh \
$$PWD/src/hb-shaper-impl-private.hh \
$$PWD/src/hb-shaper-list.hh \
$$PWD/src/hb-shaper-private.hh \
+ $$PWD/src/hb-string-array.hh \
$$PWD/src/hb-unicode-private.hh \
$$PWD/src/hb-utf-private.hh
@@ -116,9 +120,11 @@ contains(SHAPERS, opentype) {
$$PWD/src/hb-ot-shape-complex-use.cc \
$$PWD/src/hb-ot-shape-complex-use-table.cc \
$$PWD/src/hb-ot-shape-fallback.cc \
- $$PWD/src/hb-ot-shape-normalize.cc
+ $$PWD/src/hb-ot-shape-normalize.cc \
+ $$PWD/src/hb-ot-var.cc
HEADERS += \
+ $$PWD/src/hb-ot-kern-table.hh \
$$PWD/src/hb-ot-layout-common-private.hh \
$$PWD/src/hb-ot-layout-gdef-table.hh \
$$PWD/src/hb-ot-layout-gpos-table.hh \
@@ -128,6 +134,8 @@ contains(SHAPERS, opentype) {
$$PWD/src/hb-ot-layout-math-table.hh \
$$PWD/src/hb-ot-layout-private.hh \
$$PWD/src/hb-ot-map-private.hh \
+ $$PWD/src/hb-ot-math-table.hh \
+ $$PWD/src/hb-ot-post-macroman.hh \
$$PWD/src/hb-ot-shape-complex-arabic-fallback.hh \
$$PWD/src/hb-ot-shape-complex-arabic-private.hh \
$$PWD/src/hb-ot-shape-complex-arabic-table.hh \
@@ -140,7 +148,11 @@ contains(SHAPERS, opentype) {
$$PWD/src/hb-ot-shape-complex-use-private.hh \
$$PWD/src/hb-ot-shape-fallback-private.hh \
$$PWD/src/hb-ot-shape-normalize-private.hh \
- $$PWD/src/hb-ot-shape-private.hh
+ $$PWD/src/hb-ot-shape-private.hh \
+ $$PWD/src/hb-ot-var-avar-table.hh \
+ $$PWD/src/hb-ot-var-fvar-table.hh \
+ $$PWD/src/hb-ot-var-hvar-table.hh \
+ $$PWD/src/hb-ot-var-mvar-table.hh
HEADERS += \
$$PWD/src/hb-ot.h \
@@ -148,7 +160,8 @@ contains(SHAPERS, opentype) {
$$PWD/src/hb-ot-layout.h \
$$PWD/src/hb-ot-math.h \
$$PWD/src/hb-ot-shape.h \
- $$PWD/src/hb-ot-tag.h
+ $$PWD/src/hb-ot-tag.h \
+ $$PWD/src/hb-ot-var.h
}
contains(SHAPERS, coretext) {
diff --git a/src/3rdparty/harfbuzz-ng/include/harfbuzz/hb-ot-var.h b/src/3rdparty/harfbuzz-ng/include/harfbuzz/hb-ot-var.h
new file mode 100644
index 0000000000..629acbcb64
--- /dev/null
+++ b/src/3rdparty/harfbuzz-ng/include/harfbuzz/hb-ot-var.h
@@ -0,0 +1 @@
+#include "../../src/hb-ot-var.h"
diff --git a/src/3rdparty/harfbuzz-ng/patches/0001-Qt-specific-workaround-for-AAT-shaper.patch b/src/3rdparty/harfbuzz-ng/patches/0001-Qt-specific-workaround-for-AAT-shaper.patch
new file mode 100644
index 0000000000..470e0ffe5a
--- /dev/null
+++ b/src/3rdparty/harfbuzz-ng/patches/0001-Qt-specific-workaround-for-AAT-shaper.patch
@@ -0,0 +1,58 @@
+From: Konstantin Ritt <ritt.ks@gmail.com>
+Date: Sun, 17 Dec 2017 07:46:20 +0400
+Subject: Qt-specific workaround for AAT shaper
+
+CoreText API doesn't give us a fontdata to reconstruct the original font,
+so we have to store the CTFont and CGFont of interest in context object
+passed to HB from native font engine
+---
+ src/3rdparty/harfbuzz-ng/src/hb-coretext.cc | 20 ++++++++++++++++++++
+ 1 file changed, 20 insertions(+)
+
+diff --git a/src/3rdparty/harfbuzz-ng/src/hb-coretext.cc b/src/3rdparty/harfbuzz-ng/src/hb-coretext.cc
+index 2dd10d2..c993ec0 100644
+--- a/src/3rdparty/harfbuzz-ng/src/hb-coretext.cc
++++ b/src/3rdparty/harfbuzz-ng/src/hb-coretext.cc
+@@ -35,6 +35,20 @@
+ #include "hb-coretext.h"
+ #include <math.h>
+
++
++typedef bool (*qt_get_font_table_func_t) (void *user_data, unsigned int tag, unsigned char *buffer, unsigned int *length);
++
++struct FontEngineFaceData {
++ void *user_data;
++ qt_get_font_table_func_t get_font_table;
++};
++
++struct CoreTextFontEngineData {
++ CTFontRef ctFont;
++ CGFontRef cgFont;
++};
++
++
+ /* https://developer.apple.com/documentation/coretext/1508745-ctfontcreatewithgraphicsfont */
+ #define HB_CORETEXT_DEFAULT_FONT_SIZE 12.f
+
+@@ -129,6 +143,7 @@ create_cg_font (hb_face_t *face)
+ }
+ else
+ {
++#if 0
+ hb_blob_t *blob = hb_face_reference_blob (face);
+ unsigned int blob_length;
+ const char *blob_data = hb_blob_get_data (blob, &blob_length);
+@@ -143,6 +158,11 @@ create_cg_font (hb_face_t *face)
+ DEBUG_MSG (CORETEXT, face, "Face CGFontCreateWithDataProvider() failed");
+ CGDataProviderRelease (provider);
+ }
++#else
++ FontEngineFaceData *fontEngineFaceData = (FontEngineFaceData *) face->user_data;
++ CoreTextFontEngineData *coreTextFontEngineData = (CoreTextFontEngineData *) fontEngineFaceData->user_data;
++ cg_font = CGFontRetain (coreTextFontEngineData->cgFont);
++#endif
+ }
+ return cg_font;
+ }
+--
+
diff --git a/src/3rdparty/harfbuzz-ng/qt_attribution.json b/src/3rdparty/harfbuzz-ng/qt_attribution.json
index a5eee600d6..0cf6a746f5 100644
--- a/src/3rdparty/harfbuzz-ng/qt_attribution.json
+++ b/src/3rdparty/harfbuzz-ng/qt_attribution.json
@@ -6,7 +6,7 @@
"Description": "HarfBuzz is an OpenType text shaping engine.",
"Homepage": "http://harfbuzz.org",
- "Version": "1.4.1",
+ "Version": "1.7.4",
"License": "MIT License",
"LicenseId": "MIT",
diff --git a/src/3rdparty/harfbuzz-ng/src/hb-atomic-private.hh b/src/3rdparty/harfbuzz-ng/src/hb-atomic-private.hh
index 100ba539e3..9343840140 100644
--- a/src/3rdparty/harfbuzz-ng/src/hb-atomic-private.hh
+++ b/src/3rdparty/harfbuzz-ng/src/hb-atomic-private.hh
@@ -89,9 +89,9 @@ typedef int32_t hb_atomic_int_impl_t;
#define hb_atomic_ptr_impl_cmpexch(P,O,N) OSAtomicCompareAndSwapPtrBarrier ((void *) (O), (void *) (N), (void **) (P))
#else
#if __ppc64__ || __x86_64__ || __aarch64__
-#define hb_atomic_ptr_impl_cmpexch(P,O,N) OSAtomicCompareAndSwap64Barrier ((int64_t) (O), (int64_t) (N), (int64_t*) (P))
+#define hb_atomic_ptr_impl_cmpexch(P,O,N) OSAtomicCompareAndSwap64Barrier ((int64_t) (void *) (O), (int64_t) (void *) (N), (int64_t*) (P))
#else
-#define hb_atomic_ptr_impl_cmpexch(P,O,N) OSAtomicCompareAndSwap32Barrier ((int32_t) (O), (int32_t) (N), (int32_t*) (P))
+#define hb_atomic_ptr_impl_cmpexch(P,O,N) OSAtomicCompareAndSwap32Barrier ((int32_t) (void *) (O), (int32_t) (void *) (N), (int32_t*) (P))
#endif
#endif
@@ -124,13 +124,13 @@ typedef unsigned int hb_atomic_int_impl_t;
#include <builtins.h>
-static inline int hb_fetch_and_add(volatile int* AI, unsigned int V) {
+static inline int _hb_fetch_and_add(volatile int* AI, unsigned int V) {
__lwsync();
int result = __fetch_and_add(AI, V);
__isync();
return result;
}
-static inline int hb_compare_and_swaplp(volatile long* P, long O, long N) {
+static inline int _hb_compare_and_swaplp(volatile long* P, long O, long N) {
__sync();
int result = __compare_and_swaplp (P, &O, N);
__sync();
@@ -139,10 +139,10 @@ static inline int hb_compare_and_swaplp(volatile long* P, long O, long N) {
typedef int hb_atomic_int_impl_t;
#define HB_ATOMIC_INT_IMPL_INIT(V) (V)
-#define hb_atomic_int_impl_add(AI, V) hb_fetch_and_add (&(AI), (V))
+#define hb_atomic_int_impl_add(AI, V) _hb_fetch_and_add (&(AI), (V))
#define hb_atomic_ptr_impl_get(P) (__sync(), (void *) *(P))
-#define hb_atomic_ptr_impl_cmpexch(P,O,N) hb_compare_and_swaplp ((long*)(P), (long)(O), (long)(N))
+#define hb_atomic_ptr_impl_cmpexch(P,O,N) _hb_compare_and_swaplp ((long*)(P), (long)(O), (long)(N))
#elif !defined(HB_NO_MT)
diff --git a/src/3rdparty/harfbuzz-ng/src/hb-blob.cc b/src/3rdparty/harfbuzz-ng/src/hb-blob.cc
index fb48f03cab..59c8333637 100644
--- a/src/3rdparty/harfbuzz-ng/src/hb-blob.cc
+++ b/src/3rdparty/harfbuzz-ng/src/hb-blob.cc
@@ -30,6 +30,7 @@
#endif
#include "hb-private.hh"
+#include "hb-debug.hh"
#include "hb-object-private.hh"
@@ -44,12 +45,6 @@
#include <errno.h>
-
-#ifndef HB_DEBUG_BLOB
-#define HB_DEBUG_BLOB (HB_DEBUG+0)
-#endif
-
-
struct hb_blob_t {
hb_object_header_t header;
ASSERT_POD ();
@@ -72,8 +67,8 @@ _hb_blob_destroy_user_data (hb_blob_t *blob)
{
if (blob->destroy) {
blob->destroy (blob->user_data);
- blob->user_data = NULL;
- blob->destroy = NULL;
+ blob->user_data = nullptr;
+ blob->destroy = nullptr;
}
}
@@ -128,6 +123,12 @@ hb_blob_create (const char *data,
return blob;
}
+static void
+_hb_blob_destroy (void *data)
+{
+ hb_blob_destroy ((hb_blob_t *) data);
+}
+
/**
* hb_blob_create_sub_blob:
* @parent: Parent blob.
@@ -164,7 +165,7 @@ hb_blob_create_sub_blob (hb_blob_t *parent,
MIN (length, parent->length - offset),
HB_MEMORY_MODE_READONLY,
hb_blob_reference (parent),
- (hb_destroy_func_t) hb_blob_destroy);
+ _hb_blob_destroy);
return blob;
}
@@ -188,12 +189,12 @@ hb_blob_get_empty (void)
true, /* immutable */
- NULL, /* data */
+ nullptr, /* data */
0, /* length */
HB_MEMORY_MODE_READONLY, /* mode */
- NULL, /* user_data */
- NULL /* destroy */
+ nullptr, /* user_data */
+ nullptr /* destroy */
};
return const_cast<hb_blob_t *> (&_hb_blob_nil);
@@ -373,7 +374,7 @@ hb_blob_get_data_writable (hb_blob_t *blob, unsigned int *length)
if (length)
*length = 0;
- return NULL;
+ return nullptr;
}
if (length)
diff --git a/src/3rdparty/harfbuzz-ng/src/hb-buffer-private.hh b/src/3rdparty/harfbuzz-ng/src/hb-buffer-private.hh
index bca308da2f..97bdc1be30 100644
--- a/src/3rdparty/harfbuzz-ng/src/hb-buffer-private.hh
+++ b/src/3rdparty/harfbuzz-ng/src/hb-buffer-private.hh
@@ -35,8 +35,8 @@
#include "hb-unicode-private.hh"
-#ifndef HB_BUFFER_MAX_EXPANSION_FACTOR
-#define HB_BUFFER_MAX_EXPANSION_FACTOR 32
+#ifndef HB_BUFFER_MAX_LEN_FACTOR
+#define HB_BUFFER_MAX_LEN_FACTOR 32
#endif
#ifndef HB_BUFFER_MAX_LEN_MIN
#define HB_BUFFER_MAX_LEN_MIN 8192
@@ -45,11 +45,22 @@
#define HB_BUFFER_MAX_LEN_DEFAULT 0x3FFFFFFF /* Shaping more than a billion chars? Let us know! */
#endif
-ASSERT_STATIC (sizeof (hb_glyph_info_t) == 20);
-ASSERT_STATIC (sizeof (hb_glyph_info_t) == sizeof (hb_glyph_position_t));
+#ifndef HB_BUFFER_MAX_OPS_FACTOR
+#define HB_BUFFER_MAX_OPS_FACTOR 64
+#endif
+#ifndef HB_BUFFER_MAX_OPS_MIN
+#define HB_BUFFER_MAX_OPS_MIN 1024
+#endif
+#ifndef HB_BUFFER_MAX_OPS_DEFAULT
+#define HB_BUFFER_MAX_OPS_DEFAULT 0x1FFFFFFF /* Shaping more than a billion operations? Let us know! */
+#endif
+
+static_assert ((sizeof (hb_glyph_info_t) == 20), "");
+static_assert ((sizeof (hb_glyph_info_t) == sizeof (hb_glyph_position_t)), "");
HB_MARK_AS_FLAG_T (hb_buffer_flags_t);
HB_MARK_AS_FLAG_T (hb_buffer_serialize_flags_t);
+HB_MARK_AS_FLAG_T (hb_buffer_diff_flags_t);
enum hb_buffer_scratch_flags_t {
HB_BUFFER_SCRATCH_FLAG_DEFAULT = 0x00000000u,
@@ -57,6 +68,8 @@ enum hb_buffer_scratch_flags_t {
HB_BUFFER_SCRATCH_FLAG_HAS_DEFAULT_IGNORABLES = 0x00000002u,
HB_BUFFER_SCRATCH_FLAG_HAS_SPACE_FALLBACK = 0x00000004u,
HB_BUFFER_SCRATCH_FLAG_HAS_GPOS_ATTACHMENT = 0x00000008u,
+ HB_BUFFER_SCRATCH_FLAG_HAS_UNSAFE_TO_BREAK = 0x00000010u,
+
/* Reserved for complex shapers' internal use. */
HB_BUFFER_SCRATCH_FLAG_COMPLEX0 = 0x01000000u,
HB_BUFFER_SCRATCH_FLAG_COMPLEX1 = 0x02000000u,
@@ -81,6 +94,7 @@ struct hb_buffer_t {
hb_codepoint_t replacement; /* U+FFFD or something else. */
hb_buffer_scratch_flags_t scratch_flags; /* Have space-flallback, etc. */
unsigned int max_len; /* Maximum allowed len. */
+ int max_ops; /* Maximum allowed operations. */
/* Buffer contents */
hb_buffer_content_type_t content_type;
@@ -99,17 +113,6 @@ struct hb_buffer_t {
hb_glyph_info_t *out_info;
hb_glyph_position_t *pos;
- inline hb_glyph_info_t &cur (unsigned int i = 0) { return info[idx + i]; }
- inline hb_glyph_info_t cur (unsigned int i = 0) const { return info[idx + i]; }
-
- inline hb_glyph_position_t &cur_pos (unsigned int i = 0) { return pos[idx + i]; }
- inline hb_glyph_position_t cur_pos (unsigned int i = 0) const { return pos[idx + i]; }
-
- inline hb_glyph_info_t &prev (void) { return out_info[out_len ? out_len - 1 : 0]; }
- inline hb_glyph_info_t prev (void) const { return out_info[out_len ? out_len - 1 : 0]; }
-
- inline bool has_separate_output (void) const { return info != out_info; }
-
unsigned int serial;
/* Text before / after the main buffer contents.
@@ -129,6 +132,10 @@ struct hb_buffer_t {
#ifndef HB_NDEBUG
uint8_t allocated_var_bits;
#endif
+
+
+ /* Methods */
+
inline void allocate_var (unsigned int start, unsigned int count)
{
#ifndef HB_NDEBUG
@@ -165,8 +172,17 @@ struct hb_buffer_t {
#endif
}
+ inline hb_glyph_info_t &cur (unsigned int i = 0) { return info[idx + i]; }
+ inline hb_glyph_info_t cur (unsigned int i = 0) const { return info[idx + i]; }
+
+ inline hb_glyph_position_t &cur_pos (unsigned int i = 0) { return pos[idx + i]; }
+ inline hb_glyph_position_t cur_pos (unsigned int i = 0) const { return pos[idx + i]; }
+
+ inline hb_glyph_info_t &prev (void) { return out_info[out_len ? out_len - 1 : 0]; }
+ inline hb_glyph_info_t prev (void) const { return out_info[out_len ? out_len - 1 : 0]; }
+
+ inline bool has_separate_output (void) const { return info != out_info; }
- /* Methods */
HB_INTERNAL void reset (void);
HB_INTERNAL void clear (void);
@@ -232,25 +248,31 @@ struct hb_buffer_t {
for (unsigned int j = 0; j < len; j++)
info[j].mask |= mask;
}
- HB_INTERNAL void set_masks (hb_mask_t value,
- hb_mask_t mask,
- unsigned int cluster_start,
- unsigned int cluster_end);
+ HB_INTERNAL void set_masks (hb_mask_t value, hb_mask_t mask,
+ unsigned int cluster_start, unsigned int cluster_end);
- HB_INTERNAL void merge_clusters (unsigned int start,
- unsigned int end)
+ inline void merge_clusters (unsigned int start, unsigned int end)
{
if (end - start < 2)
return;
merge_clusters_impl (start, end);
}
- HB_INTERNAL void merge_clusters_impl (unsigned int start,
- unsigned int end);
- HB_INTERNAL void merge_out_clusters (unsigned int start,
- unsigned int end);
+ HB_INTERNAL void merge_clusters_impl (unsigned int start, unsigned int end);
+ HB_INTERNAL void merge_out_clusters (unsigned int start, unsigned int end);
/* Merge clusters for deleting current glyph, and skip it. */
HB_INTERNAL void delete_glyph (void);
+ inline void unsafe_to_break (unsigned int start,
+ unsigned int end)
+ {
+ if (end - start < 2)
+ return;
+ unsafe_to_break_impl (start, end);
+ }
+ HB_INTERNAL void unsafe_to_break_impl (unsigned int start, unsigned int end);
+ HB_INTERNAL void unsafe_to_break_from_outbuffer (unsigned int start, unsigned int end);
+
+
/* Internal methods */
HB_INTERNAL bool enlarge (unsigned int size);
@@ -282,9 +304,79 @@ struct hb_buffer_t {
return ret;
}
HB_INTERNAL bool message_impl (hb_font_t *font, const char *fmt, va_list ap) HB_PRINTF_FUNC(3, 0);
+
+ static inline void
+ set_cluster (hb_glyph_info_t &info, unsigned int cluster, unsigned int mask = 0)
+ {
+ if (info.cluster != cluster)
+ {
+ if (mask & HB_GLYPH_FLAG_UNSAFE_TO_BREAK)
+ info.mask |= HB_GLYPH_FLAG_UNSAFE_TO_BREAK;
+ else
+ info.mask &= ~HB_GLYPH_FLAG_UNSAFE_TO_BREAK;
+ }
+ info.cluster = cluster;
+ }
+
+ inline int
+ _unsafe_to_break_find_min_cluster (const hb_glyph_info_t *info,
+ unsigned int start, unsigned int end,
+ unsigned int cluster) const
+ {
+ for (unsigned int i = start; i < end; i++)
+ cluster = MIN<unsigned int> (cluster, info[i].cluster);
+ return cluster;
+ }
+ inline void
+ _unsafe_to_break_set_mask (hb_glyph_info_t *info,
+ unsigned int start, unsigned int end,
+ unsigned int cluster)
+ {
+ for (unsigned int i = start; i < end; i++)
+ if (cluster != info[i].cluster)
+ {
+ scratch_flags |= HB_BUFFER_SCRATCH_FLAG_HAS_UNSAFE_TO_BREAK;
+ info[i].mask |= HB_GLYPH_FLAG_UNSAFE_TO_BREAK;
+ }
+ }
+
+ inline void
+ unsafe_to_break_all (void)
+ {
+ for (unsigned int i = 0; i < len; i++)
+ info[i].mask |= HB_GLYPH_FLAG_UNSAFE_TO_BREAK;
+ }
+ inline void
+ safe_to_break_all (void)
+ {
+ for (unsigned int i = 0; i < len; i++)
+ info[i].mask &= ~HB_GLYPH_FLAG_UNSAFE_TO_BREAK;
+ }
};
+/* Loop over clusters. Duplicated in foreach_syllable(). */
+#define foreach_cluster(buffer, start, end) \
+ for (unsigned int \
+ _count = buffer->len, \
+ start = 0, end = _count ? _next_cluster (buffer, 0) : 0; \
+ start < _count; \
+ start = end, end = _next_cluster (buffer, start))
+
+static inline unsigned int
+_next_cluster (hb_buffer_t *buffer, unsigned int start)
+{
+ hb_glyph_info_t *info = buffer->info;
+ unsigned int count = buffer->len;
+
+ unsigned int cluster = info[start].cluster;
+ while (++start < count && cluster == info[start].cluster)
+ ;
+
+ return start;
+}
+
+
#define HB_BUFFER_XALLOCATE_VAR(b, func, var) \
b->func (offsetof (hb_glyph_info_t, var) - offsetof(hb_glyph_info_t, var1), \
sizeof (b->info[0].var))
diff --git a/src/3rdparty/harfbuzz-ng/src/hb-buffer-serialize.cc b/src/3rdparty/harfbuzz-ng/src/hb-buffer-serialize.cc
index 63a0f34669..ea62e9ffdb 100644
--- a/src/3rdparty/harfbuzz-ng/src/hb-buffer-serialize.cc
+++ b/src/3rdparty/harfbuzz-ng/src/hb-buffer-serialize.cc
@@ -30,7 +30,7 @@
static const char *serialize_formats[] = {
"text",
"json",
- NULL
+ nullptr
};
/**
@@ -90,7 +90,7 @@ hb_buffer_serialize_format_to_string (hb_buffer_serialize_format_t format)
case HB_BUFFER_SERIALIZE_FORMAT_TEXT: return serialize_formats[0];
case HB_BUFFER_SERIALIZE_FORMAT_JSON: return serialize_formats[1];
default:
- case HB_BUFFER_SERIALIZE_FORMAT_INVALID: return NULL;
+ case HB_BUFFER_SERIALIZE_FORMAT_INVALID: return nullptr;
}
}
@@ -104,9 +104,9 @@ _hb_buffer_serialize_glyphs_json (hb_buffer_t *buffer,
hb_font_t *font,
hb_buffer_serialize_flags_t flags)
{
- hb_glyph_info_t *info = hb_buffer_get_glyph_infos (buffer, NULL);
+ hb_glyph_info_t *info = hb_buffer_get_glyph_infos (buffer, nullptr);
hb_glyph_position_t *pos = (flags & HB_BUFFER_SERIALIZE_FLAG_NO_POSITIONS) ?
- NULL : hb_buffer_get_glyph_positions (buffer, NULL);
+ nullptr : hb_buffer_get_glyph_positions (buffer, nullptr);
*buf_consumed = 0;
for (unsigned int i = start; i < end; i++)
@@ -145,10 +145,16 @@ _hb_buffer_serialize_glyphs_json (hb_buffer_t *buffer,
if (!(flags & HB_BUFFER_SERIALIZE_FLAG_NO_POSITIONS))
{
- p += snprintf (p, ARRAY_LENGTH (b) - (p - b), ",\"dx\":%d,\"dy\":%d",
- pos[i].x_offset, pos[i].y_offset);
- p += snprintf (p, ARRAY_LENGTH (b) - (p - b), ",\"ax\":%d,\"ay\":%d",
- pos[i].x_advance, pos[i].y_advance);
+ p += MAX (0, snprintf (p, ARRAY_LENGTH (b) - (p - b), ",\"dx\":%d,\"dy\":%d",
+ pos[i].x_offset, pos[i].y_offset));
+ p += MAX (0, snprintf (p, ARRAY_LENGTH (b) - (p - b), ",\"ax\":%d,\"ay\":%d",
+ pos[i].x_advance, pos[i].y_advance));
+ }
+
+ if (flags & HB_BUFFER_SERIALIZE_FLAG_GLYPH_FLAGS)
+ {
+ if (info[i].mask & HB_GLYPH_FLAG_DEFINED)
+ p += MAX (0, snprintf (p, ARRAY_LENGTH (b) - (p - b), ",\"fl\":%u", info[i].mask & HB_GLYPH_FLAG_DEFINED));
}
if (flags & HB_BUFFER_SERIALIZE_FLAG_GLYPH_EXTENTS)
@@ -156,9 +162,9 @@ _hb_buffer_serialize_glyphs_json (hb_buffer_t *buffer,
hb_glyph_extents_t extents;
hb_font_get_glyph_extents(font, info[i].codepoint, &extents);
p += MAX (0, snprintf (p, ARRAY_LENGTH (b) - (p - b), ",\"xb\":%d,\"yb\":%d",
- extents.x_bearing, extents.y_bearing));
+ extents.x_bearing, extents.y_bearing));
p += MAX (0, snprintf (p, ARRAY_LENGTH (b) - (p - b), ",\"w\":%d,\"h\":%d",
- extents.width, extents.height));
+ extents.width, extents.height));
}
*p++ = '}';
@@ -188,9 +194,9 @@ _hb_buffer_serialize_glyphs_text (hb_buffer_t *buffer,
hb_font_t *font,
hb_buffer_serialize_flags_t flags)
{
- hb_glyph_info_t *info = hb_buffer_get_glyph_infos (buffer, NULL);
+ hb_glyph_info_t *info = hb_buffer_get_glyph_infos (buffer, nullptr);
hb_glyph_position_t *pos = (flags & HB_BUFFER_SERIALIZE_FLAG_NO_POSITIONS) ?
- NULL : hb_buffer_get_glyph_positions (buffer, NULL);
+ nullptr : hb_buffer_get_glyph_positions (buffer, nullptr);
*buf_consumed = 0;
for (unsigned int i = start; i < end; i++)
@@ -226,6 +232,12 @@ _hb_buffer_serialize_glyphs_text (hb_buffer_t *buffer,
p += MAX (0, snprintf (p, ARRAY_LENGTH (b) - (p - b), ",%d", pos[i].y_advance));
}
+ if (flags & HB_BUFFER_SERIALIZE_FLAG_GLYPH_FLAGS)
+ {
+ if (info[i].mask &HB_GLYPH_FLAG_DEFINED)
+ p += MAX (0, snprintf (p, ARRAY_LENGTH (b) - (p - b), "#%X", info[i].mask &HB_GLYPH_FLAG_DEFINED));
+ }
+
if (flags & HB_BUFFER_SERIALIZE_FLAG_GLYPH_EXTENTS)
{
hb_glyph_extents_t extents;
@@ -311,6 +323,8 @@ hb_buffer_serialize_glyphs (hb_buffer_t *buffer,
if (!buf_consumed)
buf_consumed = &sconsumed;
*buf_consumed = 0;
+ if (buf_size)
+ *buf = '\0';
assert ((!buffer->len && buffer->content_type == HB_BUFFER_CONTENT_TYPE_INVALID) ||
buffer->content_type == HB_BUFFER_CONTENT_TYPE_GLYPHS);
@@ -408,8 +422,8 @@ hb_bool_t
hb_buffer_deserialize_glyphs (hb_buffer_t *buffer,
const char *buf,
int buf_len, /* -1 means nul-terminated */
- const char **end_ptr, /* May be NULL */
- hb_font_t *font, /* May be NULL */
+ const char **end_ptr, /* May be nullptr */
+ hb_font_t *font, /* May be nullptr */
hb_buffer_serialize_format_t format)
{
const char *end;
diff --git a/src/3rdparty/harfbuzz-ng/src/hb-buffer.cc b/src/3rdparty/harfbuzz-ng/src/hb-buffer.cc
index 3940a3dbf8..7ead43b018 100644
--- a/src/3rdparty/harfbuzz-ng/src/hb-buffer.cc
+++ b/src/3rdparty/harfbuzz-ng/src/hb-buffer.cc
@@ -31,10 +31,6 @@
#include "hb-utf-private.hh"
-#ifndef HB_DEBUG_BUFFER
-#define HB_DEBUG_BUFFER (HB_DEBUG+0)
-#endif
-
/**
* SECTION: hb-buffer
* @title: Buffers
@@ -124,8 +120,8 @@ hb_buffer_t::enlarge (unsigned int size)
}
unsigned int new_allocated = allocated;
- hb_glyph_position_t *new_pos = NULL;
- hb_glyph_info_t *new_info = NULL;
+ hb_glyph_position_t *new_pos = nullptr;
+ hb_glyph_info_t *new_info = nullptr;
bool separate_out = out_info != info;
if (unlikely (_hb_unsigned_int_mul_overflows (size, sizeof (info[0]))))
@@ -134,7 +130,7 @@ hb_buffer_t::enlarge (unsigned int size)
while (size >= new_allocated)
new_allocated += (new_allocated >> 1) + 32;
- ASSERT_STATIC (sizeof (info[0]) == sizeof (pos[0]));
+ static_assert ((sizeof (info[0]) == sizeof (pos[0])), "");
if (unlikely (_hb_unsigned_int_mul_overflows (new_allocated, sizeof (info[0]))))
goto done;
@@ -267,7 +263,7 @@ hb_buffer_t::add (hb_codepoint_t codepoint,
memset (glyph, 0, sizeof (*glyph));
glyph->codepoint = codepoint;
- glyph->mask = 1;
+ glyph->mask = 0;
glyph->cluster = cluster;
len++;
@@ -550,12 +546,15 @@ hb_buffer_t::merge_clusters_impl (unsigned int start,
unsigned int end)
{
if (cluster_level == HB_BUFFER_CLUSTER_LEVEL_CHARACTERS)
+ {
+ unsafe_to_break (start, end);
return;
+ }
unsigned int cluster = info[start].cluster;
for (unsigned int i = start + 1; i < end; i++)
- cluster = MIN (cluster, info[i].cluster);
+ cluster = MIN<unsigned int> (cluster, info[i].cluster);
/* Extend end */
while (end < len && info[end - 1].cluster == info[end].cluster)
@@ -568,10 +567,10 @@ hb_buffer_t::merge_clusters_impl (unsigned int start,
/* If we hit the start of buffer, continue in out-buffer. */
if (idx == start)
for (unsigned int i = out_len; i && out_info[i - 1].cluster == info[start].cluster; i--)
- out_info[i - 1].cluster = cluster;
+ set_cluster (out_info[i - 1], cluster);
for (unsigned int i = start; i < end; i++)
- info[i].cluster = cluster;
+ set_cluster (info[i], cluster);
}
void
hb_buffer_t::merge_out_clusters (unsigned int start,
@@ -586,7 +585,7 @@ hb_buffer_t::merge_out_clusters (unsigned int start,
unsigned int cluster = out_info[start].cluster;
for (unsigned int i = start + 1; i < end; i++)
- cluster = MIN (cluster, out_info[i].cluster);
+ cluster = MIN<unsigned int> (cluster, out_info[i].cluster);
/* Extend start */
while (start && out_info[start - 1].cluster == out_info[start].cluster)
@@ -599,14 +598,16 @@ hb_buffer_t::merge_out_clusters (unsigned int start,
/* If we hit the end of out-buffer, continue in buffer. */
if (end == out_len)
for (unsigned int i = idx; i < len && info[i].cluster == out_info[end - 1].cluster; i++)
- info[i].cluster = cluster;
+ set_cluster (info[i], cluster);
for (unsigned int i = start; i < end; i++)
- out_info[i].cluster = cluster;
+ set_cluster (out_info[i], cluster);
}
void
hb_buffer_t::delete_glyph ()
{
+ /* The logic here is duplicated in hb_ot_hide_default_ignorables(). */
+
unsigned int cluster = info[idx].cluster;
if (idx + 1 < len && cluster == info[idx + 1].cluster)
{
@@ -619,9 +620,10 @@ hb_buffer_t::delete_glyph ()
/* Merge cluster backward. */
if (cluster < out_info[out_len - 1].cluster)
{
+ unsigned int mask = info[idx].mask;
unsigned int old_cluster = out_info[out_len - 1].cluster;
for (unsigned i = out_len; i && out_info[i - 1].cluster == old_cluster; i--)
- out_info[i - 1].cluster = cluster;
+ set_cluster (out_info[i - 1], cluster, mask);
}
goto done;
}
@@ -638,6 +640,32 @@ done:
}
void
+hb_buffer_t::unsafe_to_break_impl (unsigned int start, unsigned int end)
+{
+ unsigned int cluster = (unsigned int) -1;
+ cluster = _unsafe_to_break_find_min_cluster (info, start, end, cluster);
+ _unsafe_to_break_set_mask (info, start, end, cluster);
+}
+void
+hb_buffer_t::unsafe_to_break_from_outbuffer (unsigned int start, unsigned int end)
+{
+ if (!have_output)
+ {
+ unsafe_to_break_impl (start, end);
+ return;
+ }
+
+ assert (start <= out_len);
+ assert (idx <= end);
+
+ unsigned int cluster = (unsigned int) -1;
+ cluster = _unsafe_to_break_find_min_cluster (out_info, start, out_len, cluster);
+ cluster = _unsafe_to_break_find_min_cluster (info, idx, end, cluster);
+ _unsafe_to_break_set_mask (out_info, start, out_len, cluster);
+ _unsafe_to_break_set_mask (info, idx, end, cluster);
+}
+
+void
hb_buffer_t::guess_segment_properties (void)
{
assert (content_type == HB_BUFFER_CONTENT_TYPE_UNICODE ||
@@ -694,6 +722,7 @@ hb_buffer_create (void)
return hb_buffer_get_empty ();
buffer->max_len = HB_BUFFER_MAX_LEN_DEFAULT;
+ buffer->max_ops = HB_BUFFER_MAX_OPS_DEFAULT;
buffer->reset ();
@@ -721,6 +750,7 @@ hb_buffer_get_empty (void)
HB_BUFFER_REPLACEMENT_CODEPOINT_DEFAULT,
HB_BUFFER_SCRATCH_FLAG_DEFAULT,
HB_BUFFER_MAX_LEN_DEFAULT,
+ HB_BUFFER_MAX_OPS_DEFAULT,
HB_BUFFER_CONTENT_TYPE_INVALID,
HB_SEGMENT_PROPERTIES_DEFAULT,
@@ -1380,6 +1410,23 @@ hb_buffer_get_glyph_positions (hb_buffer_t *buffer,
}
/**
+ * hb_glyph_info_get_glyph_flags:
+ * @info: a #hb_glyph_info_t.
+ *
+ * Returns glyph flags encoded within a #hb_glyph_info_t.
+ *
+ * Return value:
+ * The #hb_glyph_flags_t encoded within @info.
+ *
+ * Since: 1.5.0
+ **/
+hb_glyph_flags_t
+(hb_glyph_info_get_glyph_flags) (const hb_glyph_info_t *info)
+{
+ return hb_glyph_info_get_glyph_flags (info);
+}
+
+/**
* hb_buffer_reverse:
* @buffer: an #hb_buffer_t.
*
@@ -1666,6 +1713,58 @@ hb_buffer_add_codepoints (hb_buffer_t *buffer,
}
+/**
+ * hb_buffer_append:
+ * @buffer: an #hb_buffer_t.
+ * @source: source #hb_buffer_t.
+ * @start: start index into source buffer to copy. Use 0 to copy from start of buffer.
+ * @end: end index into source buffer to copy. Use (unsigned int) -1 to copy to end of buffer.
+ *
+ * Append (part of) contents of another buffer to this buffer.
+ *
+ * Since: 1.5.0
+ **/
+HB_EXTERN void
+hb_buffer_append (hb_buffer_t *buffer,
+ hb_buffer_t *source,
+ unsigned int start,
+ unsigned int end)
+{
+ assert (!buffer->have_output && !source->have_output);
+ assert (buffer->have_positions == source->have_positions ||
+ !buffer->len || !source->len);
+ assert (buffer->content_type == source->content_type ||
+ !buffer->len || !source->len);
+
+ if (end > source->len)
+ end = source->len;
+ if (start > end)
+ start = end;
+ if (start == end)
+ return;
+
+ if (!buffer->len)
+ buffer->content_type = source->content_type;
+ if (!buffer->have_positions && source->have_positions)
+ buffer->clear_positions ();
+
+ if (buffer->len + (end - start) < buffer->len) /* Overflows. */
+ {
+ buffer->in_error = true;
+ return;
+ }
+
+ unsigned int orig_len = buffer->len;
+ hb_buffer_set_length (buffer, buffer->len + (end - start));
+ if (buffer->in_error)
+ return;
+
+ memcpy (buffer->info + orig_len, source->info + start, (end - start) * sizeof (buffer->info[0]));
+ if (buffer->have_positions)
+ memcpy (buffer->pos + orig_len, source->pos + start, (end - start) * sizeof (buffer->pos[0]));
+}
+
+
static int
compare_info_codepoint (const hb_glyph_info_t *pa,
const hb_glyph_info_t *pb)
@@ -1736,7 +1835,8 @@ void
hb_buffer_normalize_glyphs (hb_buffer_t *buffer)
{
assert (buffer->have_positions);
- assert (buffer->content_type == HB_BUFFER_CONTENT_TYPE_GLYPHS);
+ assert (buffer->content_type == HB_BUFFER_CONTENT_TYPE_GLYPHS ||
+ (!buffer->len && buffer->content_type == HB_BUFFER_CONTENT_TYPE_INVALID));
bool backward = HB_DIRECTION_IS_BACKWARD (buffer->props.direction);
@@ -1775,6 +1875,98 @@ hb_buffer_t::sort (unsigned int start, unsigned int end, int(*compar)(const hb_g
}
}
+
+/*
+ * Comparing buffers.
+ */
+
+/**
+ * hb_buffer_diff:
+ *
+ * If dottedcircle_glyph is (hb_codepoint_t) -1 then %HB_BUFFER_DIFF_FLAG_DOTTED_CIRCLE_PRESENT
+ * and %HB_BUFFER_DIFF_FLAG_NOTDEF_PRESENT are never returned. This should be used by most
+ * callers if just comparing two buffers is needed.
+ *
+ * Since: 1.5.0
+ **/
+hb_buffer_diff_flags_t
+hb_buffer_diff (hb_buffer_t *buffer,
+ hb_buffer_t *reference,
+ hb_codepoint_t dottedcircle_glyph,
+ unsigned int position_fuzz)
+{
+ if (buffer->content_type != reference->content_type && buffer->len && reference->len)
+ return HB_BUFFER_DIFF_FLAG_CONTENT_TYPE_MISMATCH;
+
+ hb_buffer_diff_flags_t result = HB_BUFFER_DIFF_FLAG_EQUAL;
+ bool contains = dottedcircle_glyph != (hb_codepoint_t) -1;
+
+ unsigned int count = reference->len;
+
+ if (buffer->len != count)
+ {
+ /*
+ * we can't compare glyph-by-glyph, but we do want to know if there
+ * are .notdef or dottedcircle glyphs present in the reference buffer
+ */
+ const hb_glyph_info_t *info = reference->info;
+ unsigned int i;
+ for (i = 0; i < count; i++)
+ {
+ if (contains && info[i].codepoint == dottedcircle_glyph)
+ result |= HB_BUFFER_DIFF_FLAG_DOTTED_CIRCLE_PRESENT;
+ if (contains && info[i].codepoint == 0)
+ result |= HB_BUFFER_DIFF_FLAG_NOTDEF_PRESENT;
+ }
+ result |= HB_BUFFER_DIFF_FLAG_LENGTH_MISMATCH;
+ return hb_buffer_diff_flags_t (result);
+ }
+
+ if (!count)
+ return hb_buffer_diff_flags_t (result);
+
+ const hb_glyph_info_t *buf_info = buffer->info;
+ const hb_glyph_info_t *ref_info = reference->info;
+ for (unsigned int i = 0; i < count; i++)
+ {
+ if (buf_info->codepoint != ref_info->codepoint)
+ result |= HB_BUFFER_DIFF_FLAG_CODEPOINT_MISMATCH;
+ if (buf_info->cluster != ref_info->cluster)
+ result |= HB_BUFFER_DIFF_FLAG_CLUSTER_MISMATCH;
+ if ((buf_info->mask & HB_GLYPH_FLAG_DEFINED) != (ref_info->mask & HB_GLYPH_FLAG_DEFINED))
+ result |= HB_BUFFER_DIFF_FLAG_GLYPH_FLAGS_MISMATCH;
+ if (contains && ref_info->codepoint == dottedcircle_glyph)
+ result |= HB_BUFFER_DIFF_FLAG_DOTTED_CIRCLE_PRESENT;
+ if (contains && ref_info->codepoint == 0)
+ result |= HB_BUFFER_DIFF_FLAG_NOTDEF_PRESENT;
+ buf_info++;
+ ref_info++;
+ }
+
+ if (buffer->content_type == HB_BUFFER_CONTENT_TYPE_GLYPHS)
+ {
+ assert (buffer->have_positions);
+ const hb_glyph_position_t *buf_pos = buffer->pos;
+ const hb_glyph_position_t *ref_pos = reference->pos;
+ for (unsigned int i = 0; i < count; i++)
+ {
+ if ((unsigned int) abs (buf_pos->x_advance - ref_pos->x_advance) > position_fuzz ||
+ (unsigned int) abs (buf_pos->y_advance - ref_pos->y_advance) > position_fuzz ||
+ (unsigned int) abs (buf_pos->x_offset - ref_pos->x_offset) > position_fuzz ||
+ (unsigned int) abs (buf_pos->y_offset - ref_pos->y_offset) > position_fuzz)
+ {
+ result |= HB_BUFFER_DIFF_FLAG_POSITION_MISMATCH;
+ break;
+ }
+ buf_pos++;
+ ref_pos++;
+ }
+ }
+
+ return result;
+}
+
+
/*
* Debugging.
*/
@@ -1803,9 +1995,9 @@ hb_buffer_set_message_func (hb_buffer_t *buffer,
buffer->message_data = user_data;
buffer->message_destroy = destroy;
} else {
- buffer->message_func = NULL;
- buffer->message_data = NULL;
- buffer->message_destroy = NULL;
+ buffer->message_func = nullptr;
+ buffer->message_data = nullptr;
+ buffer->message_destroy = nullptr;
}
}
diff --git a/src/3rdparty/harfbuzz-ng/src/hb-buffer.h b/src/3rdparty/harfbuzz-ng/src/hb-buffer.h
index bf289c19b3..a8a4b84e97 100644
--- a/src/3rdparty/harfbuzz-ng/src/hb-buffer.h
+++ b/src/3rdparty/harfbuzz-ng/src/hb-buffer.h
@@ -63,7 +63,7 @@ HB_BEGIN_DECLS
*/
typedef struct hb_glyph_info_t {
hb_codepoint_t codepoint;
- hb_mask_t mask;
+ hb_mask_t mask; /* Holds hb_glyph_flags_t after hb_shape(), plus other things. */
uint32_t cluster;
/*< private >*/
@@ -71,6 +71,19 @@ typedef struct hb_glyph_info_t {
hb_var_int_t var2;
} hb_glyph_info_t;
+typedef enum { /*< flags >*/
+ HB_GLYPH_FLAG_UNSAFE_TO_BREAK = 0x00000001,
+
+ HB_GLYPH_FLAG_DEFINED = 0x00000001 /* OR of all defined flags */
+} hb_glyph_flags_t;
+
+HB_EXTERN hb_glyph_flags_t
+hb_glyph_info_get_glyph_flags (const hb_glyph_info_t *info);
+
+#define hb_glyph_info_get_glyph_flags(info) \
+ ((hb_glyph_flags_t) ((unsigned int) (info)->mask & HB_GLYPH_FLAG_DEFINED))
+
+
/**
* hb_glyph_position_t:
* @x_advance: how much the line advances after drawing this glyph when setting
@@ -119,8 +132,8 @@ typedef struct hb_segment_properties_t {
#define HB_SEGMENT_PROPERTIES_DEFAULT {HB_DIRECTION_INVALID, \
HB_SCRIPT_INVALID, \
HB_LANGUAGE_INVALID, \
- NULL, \
- NULL}
+ (void *) 0, \
+ (void *) 0}
HB_EXTERN hb_bool_t
hb_segment_properties_equal (const hb_segment_properties_t *a,
@@ -163,6 +176,7 @@ HB_EXTERN void *
hb_buffer_get_user_data (hb_buffer_t *buffer,
hb_user_data_key_t *key);
+
/**
* hb_buffer_content_type_t:
* @HB_BUFFER_CONTENT_TYPE_INVALID: Initial value for new buffer.
@@ -359,6 +373,11 @@ hb_buffer_add_codepoints (hb_buffer_t *buffer,
unsigned int item_offset,
int item_length);
+HB_EXTERN void
+hb_buffer_append (hb_buffer_t *buffer,
+ hb_buffer_t *source,
+ unsigned int start,
+ unsigned int end);
HB_EXTERN hb_bool_t
hb_buffer_set_length (hb_buffer_t *buffer,
@@ -403,7 +422,8 @@ typedef enum { /*< flags >*/
HB_BUFFER_SERIALIZE_FLAG_NO_CLUSTERS = 0x00000001u,
HB_BUFFER_SERIALIZE_FLAG_NO_POSITIONS = 0x00000002u,
HB_BUFFER_SERIALIZE_FLAG_NO_GLYPH_NAMES = 0x00000004u,
- HB_BUFFER_SERIALIZE_FLAG_GLYPH_EXTENTS = 0x00000008u
+ HB_BUFFER_SERIALIZE_FLAG_GLYPH_EXTENTS = 0x00000008u,
+ HB_BUFFER_SERIALIZE_FLAG_GLYPH_FLAGS = 0x00000010u
} hb_buffer_serialize_flags_t;
/**
@@ -453,6 +473,45 @@ hb_buffer_deserialize_glyphs (hb_buffer_t *buffer,
/*
+ * Compare buffers
+ */
+
+typedef enum { /*< flags >*/
+ HB_BUFFER_DIFF_FLAG_EQUAL = 0x0000,
+
+ /* Buffers with different content_type cannot be meaningfully compared
+ * in any further detail. */
+ HB_BUFFER_DIFF_FLAG_CONTENT_TYPE_MISMATCH = 0x0001,
+
+ /* For buffers with differing length, the per-glyph comparison is not
+ * attempted, though we do still scan reference for dottedcircle / .notdef
+ * glyphs. */
+ HB_BUFFER_DIFF_FLAG_LENGTH_MISMATCH = 0x0002,
+
+ /* We want to know if dottedcircle / .notdef glyphs are present in the
+ * reference, as we may not care so much about other differences in this
+ * case. */
+ HB_BUFFER_DIFF_FLAG_NOTDEF_PRESENT = 0x0004,
+ HB_BUFFER_DIFF_FLAG_DOTTED_CIRCLE_PRESENT = 0x0008,
+
+ /* If the buffers have the same length, we compare them glyph-by-glyph
+ * and report which aspect(s) of the glyph info/position are different. */
+ HB_BUFFER_DIFF_FLAG_CODEPOINT_MISMATCH = 0x0010,
+ HB_BUFFER_DIFF_FLAG_CLUSTER_MISMATCH = 0x0020,
+ HB_BUFFER_DIFF_FLAG_GLYPH_FLAGS_MISMATCH = 0x0040,
+ HB_BUFFER_DIFF_FLAG_POSITION_MISMATCH = 0x0080
+
+} hb_buffer_diff_flags_t;
+
+/* Compare the contents of two buffers, report types of differences. */
+HB_EXTERN hb_buffer_diff_flags_t
+hb_buffer_diff (hb_buffer_t *buffer,
+ hb_buffer_t *reference,
+ hb_codepoint_t dottedcircle_glyph,
+ unsigned int position_fuzz);
+
+
+/*
* Debugging.
*/
diff --git a/src/3rdparty/harfbuzz-ng/src/hb-common.cc b/src/3rdparty/harfbuzz-ng/src/hb-common.cc
index 3564e43557..cb1fb43ffb 100644
--- a/src/3rdparty/harfbuzz-ng/src/hb-common.cc
+++ b/src/3rdparty/harfbuzz-ng/src/hb-common.cc
@@ -32,6 +32,9 @@
#include "hb-object-private.hh"
#include <locale.h>
+#ifdef HAVE_XLOCALE_H
+#include <xlocale.h>
+#endif
/* hb_options_t */
@@ -82,7 +85,7 @@ hb_tag_from_string (const char *str, int len)
for (; i < 4; i++)
tag[i] = ' ';
- return HB_TAG_CHAR4 (tag);
+ return HB_TAG (tag[0], tag[1], tag[2], tag[3]);
}
/**
@@ -186,8 +189,10 @@ lang_equal (hb_language_t v1,
const unsigned char *p1 = (const unsigned char *) v1;
const unsigned char *p2 = (const unsigned char *) v2;
- while (*p1 && *p1 == canon_map[*p2])
- p1++, p2++;
+ while (*p1 && *p1 == canon_map[*p2]) {
+ p1++;
+ p2++;
+ }
return *p1 == canon_map[*p2];
}
@@ -219,9 +224,18 @@ struct hb_language_item_t {
}
inline hb_language_item_t & operator = (const char *s) {
- lang = (hb_language_t) strdup (s);
- for (unsigned char *p = (unsigned char *) lang; *p; p++)
- *p = canon_map[*p];
+ /* If a custom allocated is used calling strdup() pairs
+ badly with a call to the custom free() in finish() below.
+ Therefore don't call strdup(), implement its behavior.
+ */
+ size_t len = strlen(s) + 1;
+ lang = (hb_language_t) malloc(len);
+ if (likely (lang))
+ {
+ memcpy((unsigned char *) lang, s, len);
+ for (unsigned char *p = (unsigned char *) lang; *p; p++)
+ *p = canon_map[*p];
+ }
return *this;
}
@@ -235,8 +249,8 @@ struct hb_language_item_t {
static hb_language_item_t *langs;
#ifdef HB_USE_ATEXIT
-static
-void free_langs (void)
+static void
+free_langs (void)
{
while (langs) {
hb_language_item_t *next = langs->next;
@@ -260,9 +274,14 @@ retry:
/* Not found; allocate one. */
hb_language_item_t *lang = (hb_language_item_t *) calloc (1, sizeof (hb_language_item_t));
if (unlikely (!lang))
- return NULL;
+ return nullptr;
lang->next = first_lang;
*lang = key;
+ if (unlikely (!lang->lang))
+ {
+ free (lang);
+ return nullptr;
+ }
if (!hb_atomic_ptr_cmpexch (&langs, first_lang, lang)) {
lang->finish ();
@@ -299,7 +318,7 @@ hb_language_from_string (const char *str, int len)
if (!str || !len || !*str)
return HB_LANGUAGE_INVALID;
- hb_language_item_t *item = NULL;
+ hb_language_item_t *item = nullptr;
if (len >= 0)
{
/* NUL-terminate it. */
@@ -330,7 +349,7 @@ hb_language_from_string (const char *str, int len)
const char *
hb_language_to_string (hb_language_t language)
{
- /* This is actually NULL-safe! */
+ /* This is actually nullptr-safe! */
return language->s;
}
@@ -350,7 +369,7 @@ hb_language_get_default (void)
hb_language_t language = (hb_language_t) hb_atomic_ptr_get (&default_language);
if (unlikely (language == HB_LANGUAGE_INVALID)) {
- language = hb_language_from_string (setlocale (LC_CTYPE, NULL), -1);
+ language = hb_language_from_string (setlocale (LC_CTYPE, nullptr), -1);
(void) hb_atomic_ptr_cmpexch (&default_language, HB_LANGUAGE_INVALID, language);
}
@@ -543,9 +562,9 @@ hb_user_data_array_t::set (hb_user_data_key_t *key,
void *
hb_user_data_array_t::get (hb_user_data_key_t *key)
{
- hb_user_data_item_t item = {NULL, NULL, NULL};
+ hb_user_data_item_t item = {nullptr, nullptr, nullptr};
- return items.find (key, &item, lock) ? item.data : NULL;
+ return items.find (key, &item, lock) ? item.data : nullptr;
}
@@ -605,3 +624,426 @@ hb_version_atleast (unsigned int major,
{
return HB_VERSION_ATLEAST (major, minor, micro);
}
+
+
+
+/* hb_feature_t and hb_variation_t */
+
+static bool
+parse_space (const char **pp, const char *end)
+{
+ while (*pp < end && ISSPACE (**pp))
+ (*pp)++;
+ return true;
+}
+
+static bool
+parse_char (const char **pp, const char *end, char c)
+{
+ parse_space (pp, end);
+
+ if (*pp == end || **pp != c)
+ return false;
+
+ (*pp)++;
+ return true;
+}
+
+static bool
+parse_uint (const char **pp, const char *end, unsigned int *pv)
+{
+ char buf[32];
+ unsigned int len = MIN (ARRAY_LENGTH (buf) - 1, (unsigned int) (end - *pp));
+ strncpy (buf, *pp, len);
+ buf[len] = '\0';
+
+ char *p = buf;
+ char *pend = p;
+ unsigned int v;
+
+ /* Intentionally use strtol instead of strtoul, such that
+ * -1 turns into "big number"... */
+ errno = 0;
+ v = strtol (p, &pend, 0);
+ if (errno || p == pend)
+ return false;
+
+ *pv = v;
+ *pp += pend - p;
+ return true;
+}
+
+static bool
+parse_uint32 (const char **pp, const char *end, uint32_t *pv)
+{
+ char buf[32];
+ unsigned int len = MIN (ARRAY_LENGTH (buf) - 1, (unsigned int) (end - *pp));
+ strncpy (buf, *pp, len);
+ buf[len] = '\0';
+
+ char *p = buf;
+ char *pend = p;
+ unsigned int v;
+
+ /* Intentionally use strtol instead of strtoul, such that
+ * -1 turns into "big number"... */
+ errno = 0;
+ v = strtol (p, &pend, 0);
+ if (errno || p == pend)
+ return false;
+
+ *pv = v;
+ *pp += pend - p;
+ return true;
+}
+
+#if defined (HAVE_NEWLOCALE) && defined (HAVE_STRTOD_L)
+#define USE_XLOCALE 1
+#define HB_LOCALE_T locale_t
+#define HB_CREATE_LOCALE(locName) newlocale (LC_ALL_MASK, locName, nullptr)
+#define HB_FREE_LOCALE(loc) freelocale (loc)
+#elif defined(_MSC_VER)
+#define USE_XLOCALE 1
+#define HB_LOCALE_T _locale_t
+#define HB_CREATE_LOCALE(locName) _create_locale (LC_ALL, locName)
+#define HB_FREE_LOCALE(loc) _free_locale (loc)
+#define strtod_l(a, b, c) _strtod_l ((a), (b), (c))
+#endif
+
+#ifdef USE_XLOCALE
+
+static HB_LOCALE_T C_locale;
+
+#ifdef HB_USE_ATEXIT
+static void
+free_C_locale (void)
+{
+ if (C_locale)
+ HB_FREE_LOCALE (C_locale);
+}
+#endif
+
+static HB_LOCALE_T
+get_C_locale (void)
+{
+retry:
+ HB_LOCALE_T C = (HB_LOCALE_T) hb_atomic_ptr_get (&C_locale);
+
+ if (unlikely (!C))
+ {
+ C = HB_CREATE_LOCALE ("C");
+
+ if (!hb_atomic_ptr_cmpexch (&C_locale, nullptr, C))
+ {
+ HB_FREE_LOCALE (C_locale);
+ goto retry;
+ }
+
+#ifdef HB_USE_ATEXIT
+ atexit (free_C_locale); /* First person registers atexit() callback. */
+#endif
+ }
+
+ return C;
+}
+#endif
+
+static bool
+parse_float (const char **pp, const char *end, float *pv)
+{
+ char buf[32];
+ unsigned int len = MIN (ARRAY_LENGTH (buf) - 1, (unsigned int) (end - *pp));
+ strncpy (buf, *pp, len);
+ buf[len] = '\0';
+
+ char *p = buf;
+ char *pend = p;
+ float v;
+
+ errno = 0;
+#ifdef USE_XLOCALE
+ v = strtod_l (p, &pend, get_C_locale ());
+#else
+ v = strtod (p, &pend);
+#endif
+ if (errno || p == pend)
+ return false;
+
+ *pv = v;
+ *pp += pend - p;
+ return true;
+}
+
+static bool
+parse_bool (const char **pp, const char *end, uint32_t *pv)
+{
+ parse_space (pp, end);
+
+ const char *p = *pp;
+ while (*pp < end && ISALPHA(**pp))
+ (*pp)++;
+
+ /* CSS allows on/off as aliases 1/0. */
+ if (*pp - p == 2 && 0 == strncmp (p, "on", 2))
+ *pv = 1;
+ else if (*pp - p == 3 && 0 == strncmp (p, "off", 3))
+ *pv = 0;
+ else
+ return false;
+
+ return true;
+}
+
+/* hb_feature_t */
+
+static bool
+parse_feature_value_prefix (const char **pp, const char *end, hb_feature_t *feature)
+{
+ if (parse_char (pp, end, '-'))
+ feature->value = 0;
+ else {
+ parse_char (pp, end, '+');
+ feature->value = 1;
+ }
+
+ return true;
+}
+
+static bool
+parse_tag (const char **pp, const char *end, hb_tag_t *tag)
+{
+ parse_space (pp, end);
+
+ char quote = 0;
+
+ if (*pp < end && (**pp == '\'' || **pp == '"'))
+ {
+ quote = **pp;
+ (*pp)++;
+ }
+
+ const char *p = *pp;
+ while (*pp < end && ISALNUM(**pp))
+ (*pp)++;
+
+ if (p == *pp || *pp - p > 4)
+ return false;
+
+ *tag = hb_tag_from_string (p, *pp - p);
+
+ if (quote)
+ {
+ /* CSS expects exactly four bytes. And we only allow quotations for
+ * CSS compatibility. So, enforce the length. */
+ if (*pp - p != 4)
+ return false;
+ if (*pp == end || **pp != quote)
+ return false;
+ (*pp)++;
+ }
+
+ return true;
+}
+
+static bool
+parse_feature_indices (const char **pp, const char *end, hb_feature_t *feature)
+{
+ parse_space (pp, end);
+
+ bool has_start;
+
+ feature->start = 0;
+ feature->end = (unsigned int) -1;
+
+ if (!parse_char (pp, end, '['))
+ return true;
+
+ has_start = parse_uint (pp, end, &feature->start);
+
+ if (parse_char (pp, end, ':')) {
+ parse_uint (pp, end, &feature->end);
+ } else {
+ if (has_start)
+ feature->end = feature->start + 1;
+ }
+
+ return parse_char (pp, end, ']');
+}
+
+static bool
+parse_feature_value_postfix (const char **pp, const char *end, hb_feature_t *feature)
+{
+ bool had_equal = parse_char (pp, end, '=');
+ bool had_value = parse_uint32 (pp, end, &feature->value) ||
+ parse_bool (pp, end, &feature->value);
+ /* CSS doesn't use equal-sign between tag and value.
+ * If there was an equal-sign, then there *must* be a value.
+ * A value without an eqaul-sign is ok, but not required. */
+ return !had_equal || had_value;
+}
+
+static bool
+parse_one_feature (const char **pp, const char *end, hb_feature_t *feature)
+{
+ return parse_feature_value_prefix (pp, end, feature) &&
+ parse_tag (pp, end, &feature->tag) &&
+ parse_feature_indices (pp, end, feature) &&
+ parse_feature_value_postfix (pp, end, feature) &&
+ parse_space (pp, end) &&
+ *pp == end;
+}
+
+/**
+ * hb_feature_from_string:
+ * @str: (array length=len) (element-type uint8_t): a string to parse
+ * @len: length of @str, or -1 if string is %NULL terminated
+ * @feature: (out): the #hb_feature_t to initialize with the parsed values
+ *
+ * Parses a string into a #hb_feature_t.
+ *
+ * TODO: document the syntax here.
+ *
+ * Return value:
+ * %true if @str is successfully parsed, %false otherwise.
+ *
+ * Since: 0.9.5
+ **/
+hb_bool_t
+hb_feature_from_string (const char *str, int len,
+ hb_feature_t *feature)
+{
+ hb_feature_t feat;
+
+ if (len < 0)
+ len = strlen (str);
+
+ if (likely (parse_one_feature (&str, str + len, &feat)))
+ {
+ if (feature)
+ *feature = feat;
+ return true;
+ }
+
+ if (feature)
+ memset (feature, 0, sizeof (*feature));
+ return false;
+}
+
+/**
+ * hb_feature_to_string:
+ * @feature: an #hb_feature_t to convert
+ * @buf: (array length=size) (out): output string
+ * @size: the allocated size of @buf
+ *
+ * Converts a #hb_feature_t into a %NULL-terminated string in the format
+ * understood by hb_feature_from_string(). The client in responsible for
+ * allocating big enough size for @buf, 128 bytes is more than enough.
+ *
+ * Since: 0.9.5
+ **/
+void
+hb_feature_to_string (hb_feature_t *feature,
+ char *buf, unsigned int size)
+{
+ if (unlikely (!size)) return;
+
+ char s[128];
+ unsigned int len = 0;
+ if (feature->value == 0)
+ s[len++] = '-';
+ hb_tag_to_string (feature->tag, s + len);
+ len += 4;
+ while (len && s[len - 1] == ' ')
+ len--;
+ if (feature->start != 0 || feature->end != (unsigned int) -1)
+ {
+ s[len++] = '[';
+ if (feature->start)
+ len += MAX (0, snprintf (s + len, ARRAY_LENGTH (s) - len, "%u", feature->start));
+ if (feature->end != feature->start + 1) {
+ s[len++] = ':';
+ if (feature->end != (unsigned int) -1)
+ len += MAX (0, snprintf (s + len, ARRAY_LENGTH (s) - len, "%u", feature->end));
+ }
+ s[len++] = ']';
+ }
+ if (feature->value > 1)
+ {
+ s[len++] = '=';
+ len += MAX (0, snprintf (s + len, ARRAY_LENGTH (s) - len, "%u", feature->value));
+ }
+ assert (len < ARRAY_LENGTH (s));
+ len = MIN (len, size - 1);
+ memcpy (buf, s, len);
+ buf[len] = '\0';
+}
+
+/* hb_variation_t */
+
+static bool
+parse_variation_value (const char **pp, const char *end, hb_variation_t *variation)
+{
+ parse_char (pp, end, '='); /* Optional. */
+ return parse_float (pp, end, &variation->value);
+}
+
+static bool
+parse_one_variation (const char **pp, const char *end, hb_variation_t *variation)
+{
+ return parse_tag (pp, end, &variation->tag) &&
+ parse_variation_value (pp, end, variation) &&
+ parse_space (pp, end) &&
+ *pp == end;
+}
+
+/**
+ * hb_variation_from_string:
+ *
+ * Since: 1.4.2
+ */
+hb_bool_t
+hb_variation_from_string (const char *str, int len,
+ hb_variation_t *variation)
+{
+ hb_variation_t var;
+
+ if (len < 0)
+ len = strlen (str);
+
+ if (likely (parse_one_variation (&str, str + len, &var)))
+ {
+ if (variation)
+ *variation = var;
+ return true;
+ }
+
+ if (variation)
+ memset (variation, 0, sizeof (*variation));
+ return false;
+}
+
+/**
+ * hb_variation_to_string:
+ *
+ * Since: 1.4.2
+ */
+void
+hb_variation_to_string (hb_variation_t *variation,
+ char *buf, unsigned int size)
+{
+ if (unlikely (!size)) return;
+
+ char s[128];
+ unsigned int len = 0;
+ hb_tag_to_string (variation->tag, s + len);
+ len += 4;
+ while (len && s[len - 1] == ' ')
+ len--;
+ s[len++] = '=';
+ len += MAX (0, snprintf (s + len, ARRAY_LENGTH (s) - len, "%g", variation->value));
+
+ assert (len < ARRAY_LENGTH (s));
+ len = MIN (len, size - 1);
+ memcpy (buf, s, len);
+ buf[len] = '\0';
+}
diff --git a/src/3rdparty/harfbuzz-ng/src/hb-common.h b/src/3rdparty/harfbuzz-ng/src/hb-common.h
index 2cbee76a8f..26200ce125 100644
--- a/src/3rdparty/harfbuzz-ng/src/hb-common.h
+++ b/src/3rdparty/harfbuzz-ng/src/hb-common.h
@@ -43,30 +43,16 @@
# endif /* !__cplusplus */
#endif
-#if !defined (HB_DONT_DEFINE_STDINT)
-
#if defined (_SVR4) || defined (SVR4) || defined (__OpenBSD__) || \
defined (_sgi) || defined (__sun) || defined (sun) || \
defined (__digital__) || defined (__HP_cc)
# include <inttypes.h>
#elif defined (_AIX)
# include <sys/inttypes.h>
-/* VS 2010 (_MSC_VER 1600) has stdint.h */
-#elif defined (_MSC_VER) && _MSC_VER < 1600
-typedef __int8 int8_t;
-typedef unsigned __int8 uint8_t;
-typedef __int16 int16_t;
-typedef unsigned __int16 uint16_t;
-typedef __int32 int32_t;
-typedef unsigned __int32 uint32_t;
-typedef __int64 int64_t;
-typedef unsigned __int64 uint64_t;
#else
# include <stdint.h>
#endif
-#endif
-
HB_BEGIN_DECLS
@@ -148,7 +134,7 @@ hb_language_from_string (const char *str, int len);
HB_EXTERN const char *
hb_language_to_string (hb_language_t language);
-#define HB_LANGUAGE_INVALID ((hb_language_t) NULL)
+#define HB_LANGUAGE_INVALID ((hb_language_t) 0)
HB_EXTERN hb_language_t
hb_language_get_default (void);
@@ -321,6 +307,14 @@ typedef enum
/*9.0*/ HB_SCRIPT_TANGUT = HB_TAG ('T','a','n','g'),
/*9.0*/ HB_SCRIPT_NEWA = HB_TAG ('N','e','w','a'),
+ /*
+ * Since 1.6.0
+ */
+ /*10.0*/HB_SCRIPT_MASARAM_GONDI = HB_TAG ('G','o','n','m'),
+ /*10.0*/HB_SCRIPT_NUSHU = HB_TAG ('N','s','h','u'),
+ /*10.0*/HB_SCRIPT_SOYOMBO = HB_TAG ('S','o','y','o'),
+ /*10.0*/HB_SCRIPT_ZANABAZAR_SQUARE = HB_TAG ('Z','a','n','b'),
+
/* No script set. */
HB_SCRIPT_INVALID = HB_TAG_NONE,
@@ -362,6 +356,42 @@ typedef struct hb_user_data_key_t {
typedef void (*hb_destroy_func_t) (void *user_data);
+/* Font features and variations. */
+
+typedef struct hb_feature_t {
+ hb_tag_t tag;
+ uint32_t value;
+ unsigned int start;
+ unsigned int end;
+} hb_feature_t;
+
+HB_EXTERN hb_bool_t
+hb_feature_from_string (const char *str, int len,
+ hb_feature_t *feature);
+
+HB_EXTERN void
+hb_feature_to_string (hb_feature_t *feature,
+ char *buf, unsigned int size);
+
+/**
+ * hb_variation_t:
+ *
+ * Since: 1.4.2
+ */
+typedef struct hb_variation_t {
+ hb_tag_t tag;
+ float value;
+} hb_variation_t;
+
+HB_EXTERN hb_bool_t
+hb_variation_from_string (const char *str, int len,
+ hb_variation_t *variation);
+
+HB_EXTERN void
+hb_variation_to_string (hb_variation_t *variation,
+ char *buf, unsigned int size);
+
+
HB_END_DECLS
#endif /* HB_COMMON_H */
diff --git a/src/3rdparty/harfbuzz-ng/src/hb-coretext.cc b/src/3rdparty/harfbuzz-ng/src/hb-coretext.cc
index 9865bbba41..9431ba5fe1 100644
--- a/src/3rdparty/harfbuzz-ng/src/hb-coretext.cc
+++ b/src/3rdparty/harfbuzz-ng/src/hb-coretext.cc
@@ -27,14 +27,13 @@
*/
#define HB_SHAPER coretext
+
+#include "hb-private.hh"
+#include "hb-debug.hh"
#include "hb-shaper-impl-private.hh"
#include "hb-coretext.h"
-
-
-#ifndef HB_DEBUG_CORETEXT
-#define HB_DEBUG_CORETEXT (HB_DEBUG+0)
-#endif
+#include <math.h>
typedef bool (*qt_get_font_table_func_t) (void *user_data, unsigned int tag, unsigned char *buffer, unsigned int *length);
@@ -50,6 +49,27 @@ struct CoreTextFontEngineData {
};
+/* https://developer.apple.com/documentation/coretext/1508745-ctfontcreatewithgraphicsfont */
+#define HB_CORETEXT_DEFAULT_FONT_SIZE 12.f
+
+static CGFloat
+coretext_font_size_from_ptem (float ptem)
+{
+ /* CoreText points are CSS pixels (96 per inch),
+ * NOT typographic points (72 per inch).
+ *
+ * https://developer.apple.com/library/content/documentation/GraphicsAnimation/Conceptual/HighResolutionOSX/Explained/Explained.html
+ */
+ ptem *= 96.f / 72.f;
+ return ptem <= 0.f ? HB_CORETEXT_DEFAULT_FONT_SIZE : ptem;
+}
+static float
+coretext_font_size_to_ptem (CGFloat size)
+{
+ size *= 72.f / 96.f;
+ return size <= 0.f ? 0 : size;
+}
+
static void
release_table_data (void *user_data)
{
@@ -63,32 +83,29 @@ reference_table (hb_face_t *face HB_UNUSED, hb_tag_t tag, void *user_data)
CGFontRef cg_font = reinterpret_cast<CGFontRef> (user_data);
CFDataRef cf_data = CGFontCopyTableForTag (cg_font, tag);
if (unlikely (!cf_data))
- return NULL;
+ return nullptr;
const char *data = reinterpret_cast<const char*> (CFDataGetBytePtr (cf_data));
const size_t length = CFDataGetLength (cf_data);
if (!data || !length)
- return NULL;
+ return nullptr;
return hb_blob_create (data, length, HB_MEMORY_MODE_READONLY,
reinterpret_cast<void *> (const_cast<__CFData *> (cf_data)),
release_table_data);
}
-hb_face_t *
-hb_coretext_face_create (CGFontRef cg_font)
+static void
+_hb_cg_font_release (void *data)
{
- return hb_face_create_for_tables (reference_table, CGFontRetain (cg_font), (hb_destroy_func_t) CGFontRelease);
+ CGFontRelease ((CGFontRef) data);
}
-HB_SHAPER_DATA_ENSURE_DECLARE(coretext, face)
-HB_SHAPER_DATA_ENSURE_DECLARE(coretext, font)
-
-
-/*
- * shaper face data
- */
+HB_SHAPER_DATA_ENSURE_DEFINE(coretext, face)
+HB_SHAPER_DATA_ENSURE_DEFINE_WITH_CONDITION(coretext, font,
+ fabs (CTFontGetSize((CTFontRef) data) - coretext_font_size_from_ptem (font->ptem)) <= .5
+)
static CTFontDescriptorRef
get_last_resort_font_desc (void)
@@ -117,7 +134,7 @@ static void
release_data (void *info, const void *data, size_t size)
{
assert (hb_blob_get_length ((hb_blob_t *) info) == size &&
- hb_blob_get_data ((hb_blob_t *) info, NULL) == data);
+ hb_blob_get_data ((hb_blob_t *) info, nullptr) == data);
hb_blob_destroy ((hb_blob_t *) info);
}
@@ -125,14 +142,14 @@ release_data (void *info, const void *data, size_t size)
static CGFontRef
create_cg_font (hb_face_t *face)
{
- CGFontRef cg_font = NULL;
-#if 0
- if (face->destroy == (hb_destroy_func_t) CGFontRelease)
+ CGFontRef cg_font = nullptr;
+ if (face->destroy == _hb_cg_font_release)
{
cg_font = CGFontRetain ((CGFontRef) face->user_data);
}
else
{
+#if 0
hb_blob_t *blob = hb_face_reference_blob (face);
unsigned int blob_length;
const char *blob_data = hb_blob_get_data (blob, &blob_length);
@@ -147,22 +164,48 @@ create_cg_font (hb_face_t *face)
DEBUG_MSG (CORETEXT, face, "Face CGFontCreateWithDataProvider() failed");
CGDataProviderRelease (provider);
}
- }
#else
- FontEngineFaceData *fontEngineFaceData = (FontEngineFaceData *) face->user_data;
- CoreTextFontEngineData *coreTextFontEngineData = (CoreTextFontEngineData *) fontEngineFaceData->user_data;
- cg_font = CGFontRetain (coreTextFontEngineData->cgFont);
+ FontEngineFaceData *fontEngineFaceData = (FontEngineFaceData *) face->user_data;
+ CoreTextFontEngineData *coreTextFontEngineData = (CoreTextFontEngineData *) fontEngineFaceData->user_data;
+ cg_font = CGFontRetain (coreTextFontEngineData->cgFont);
#endif
+ }
return cg_font;
}
static CTFontRef
create_ct_font (CGFontRef cg_font, CGFloat font_size)
{
- CTFontRef ct_font = CTFontCreateWithGraphicsFont (cg_font, font_size, NULL, NULL);
+ CTFontRef ct_font = nullptr;
+
+ /* CoreText does not enable trak table usage / tracking when creating a CTFont
+ * using CTFontCreateWithGraphicsFont. The only way of enabling tracking seems
+ * to be through the CTFontCreateUIFontForLanguage call. */
+ CFStringRef cg_postscript_name = CGFontCopyPostScriptName (cg_font);
+ if (CFStringHasPrefix (cg_postscript_name, CFSTR (".SFNSText")) ||
+ CFStringHasPrefix (cg_postscript_name, CFSTR (".SFNSDisplay")))
+ {
+ CTFontUIFontType font_type = kCTFontUIFontSystem;
+ if (CFStringHasSuffix (cg_postscript_name, CFSTR ("-Bold")))
+ font_type = kCTFontUIFontEmphasizedSystem;
+
+ ct_font = CTFontCreateUIFontForLanguage (font_type, font_size, nullptr);
+ CFStringRef ct_result_name = CTFontCopyPostScriptName(ct_font);
+ if (CFStringCompare (ct_result_name, cg_postscript_name, 0) != kCFCompareEqualTo)
+ {
+ CFRelease(ct_font);
+ ct_font = nullptr;
+ }
+ CFRelease (ct_result_name);
+ }
+ CFRelease (cg_postscript_name);
+
+ if (!ct_font)
+ ct_font = CTFontCreateWithGraphicsFont (cg_font, font_size, nullptr, nullptr);
+
if (unlikely (!ct_font)) {
DEBUG_MSG (CORETEXT, cg_font, "Font CTFontCreateWithGraphicsFont() failed");
- return NULL;
+ return nullptr;
}
/* crbug.com/576941 and crbug.com/625902 and the investigation in the latter
@@ -172,7 +215,7 @@ create_ct_font (CGFontRef cg_font, CGFloat font_size)
* reconfiguring the cascade list causes CoreText crashes. For details, see
* crbug.com/549610 */
// 0x00070000 stands for "kCTVersionNumber10_10", see CoreText.h
- if (&CTGetCoreTextVersion != NULL && CTGetCoreTextVersion() < 0x00070000) {
+ if (&CTGetCoreTextVersion != nullptr && CTGetCoreTextVersion() < 0x00070000) {
CFStringRef fontName = CTFontCopyPostScriptName (ct_font);
bool isEmojiFont = CFStringCompare (fontName, CFSTR("AppleColorEmoji"), 0) == kCFCompareEqualTo;
CFRelease (fontName);
@@ -186,7 +229,7 @@ create_ct_font (CGFontRef cg_font, CGFloat font_size)
* font fallback which we don't need anyway. */
{
CTFontDescriptorRef last_resort_font_desc = get_last_resort_font_desc ();
- CTFontRef new_ct_font = CTFontCreateCopyWithAttributes (ct_font, 0.0, NULL, last_resort_font_desc);
+ CTFontRef new_ct_font = CTFontCreateCopyWithAttributes (ct_font, 0.0, nullptr, last_resort_font_desc);
CFRelease (last_resort_font_desc);
if (new_ct_font)
{
@@ -221,51 +264,30 @@ create_ct_font (CGFontRef cg_font, CGFloat font_size)
return ct_font;
}
-struct hb_coretext_shaper_face_data_t {
- CGFontRef cg_font;
- CTFontRef ct_font;
-};
-
hb_coretext_shaper_face_data_t *
_hb_coretext_shaper_face_data_create (hb_face_t *face)
{
- hb_coretext_shaper_face_data_t *data = (hb_coretext_shaper_face_data_t *) calloc (1, sizeof (hb_coretext_shaper_face_data_t));
- if (unlikely (!data))
- return NULL;
+ CGFontRef cg_font = create_cg_font (face);
- data->cg_font = create_cg_font (face);
- if (unlikely (!data->cg_font))
+ if (unlikely (!cg_font))
{
DEBUG_MSG (CORETEXT, face, "CGFont creation failed..");
- free (data);
- return NULL;
+ return nullptr;
}
- /* We use 36pt size instead of UPEM, because CoreText implements the 'trak' table,
- * which can make the font too tight at large sizes. 36pt should be a good semi-neutral
- * size.
- *
- * Since we always create CTFont at a fixed size, our CTFont lives in face_data
- * instead of font_data. Which is good, because when people change scale on
- * hb_font_t, we won't need to update our CTFont. */
- data->ct_font = create_ct_font (data->cg_font, 36.);
- if (unlikely (!data->ct_font))
- {
- DEBUG_MSG (CORETEXT, face, "CTFont creation failed.");
- CFRelease (data->cg_font);
- free (data);
- return NULL;
- }
-
- return data;
+ return (hb_coretext_shaper_face_data_t *) cg_font;
}
void
_hb_coretext_shaper_face_data_destroy (hb_coretext_shaper_face_data_t *data)
{
- CFRelease (data->ct_font);
- CFRelease (data->cg_font);
- free (data);
+ CFRelease ((CGFontRef) data);
+}
+
+hb_face_t *
+hb_coretext_face_create (CGFontRef cg_font)
+{
+ return hb_face_create_for_tables (reference_table, CGFontRetain (cg_font), _hb_cg_font_release);
}
/*
@@ -274,29 +296,66 @@ _hb_coretext_shaper_face_data_destroy (hb_coretext_shaper_face_data_t *data)
CGFontRef
hb_coretext_face_get_cg_font (hb_face_t *face)
{
- if (unlikely (!hb_coretext_shaper_face_data_ensure (face))) return NULL;
- hb_coretext_shaper_face_data_t *face_data = HB_SHAPER_DATA_GET (face);
- return face_data->cg_font;
+ if (unlikely (!hb_coretext_shaper_face_data_ensure (face))) return nullptr;
+ return (CGFontRef) HB_SHAPER_DATA_GET (face);
}
-/*
- * shaper font data
- */
-
-struct hb_coretext_shaper_font_data_t {};
-
hb_coretext_shaper_font_data_t *
-_hb_coretext_shaper_font_data_create (hb_font_t *font HB_UNUSED)
+_hb_coretext_shaper_font_data_create (hb_font_t *font)
{
- return (hb_coretext_shaper_font_data_t *) HB_SHAPER_DATA_SUCCEEDED;
+ hb_face_t *face = font->face;
+ if (unlikely (!hb_coretext_shaper_face_data_ensure (face))) return nullptr;
+ CGFontRef cg_font = (CGFontRef) HB_SHAPER_DATA_GET (face);
+
+ CTFontRef ct_font = create_ct_font (cg_font, coretext_font_size_from_ptem (font->ptem));
+
+ if (unlikely (!ct_font))
+ {
+ DEBUG_MSG (CORETEXT, font, "CGFont creation failed..");
+ return nullptr;
+ }
+
+ return (hb_coretext_shaper_font_data_t *) ct_font;
}
void
_hb_coretext_shaper_font_data_destroy (hb_coretext_shaper_font_data_t *data)
{
+ CFRelease ((CTFontRef) data);
}
+/*
+ * Since: 1.7.2
+ */
+hb_font_t *
+hb_coretext_font_create (CTFontRef ct_font)
+{
+ CGFontRef cg_font = CTFontCopyGraphicsFont (ct_font, 0);
+ hb_face_t *face = hb_coretext_face_create (cg_font);
+ CFRelease (cg_font);
+ hb_font_t *font = hb_font_create (face);
+ hb_face_destroy (face);
+
+ if (unlikely (hb_object_is_inert (font)))
+ return font;
+
+ hb_font_set_ptem (font, coretext_font_size_to_ptem (CTFontGetSize(ct_font)));
+
+ /* Let there be dragons here... */
+ HB_SHAPER_DATA_GET (font) = (hb_coretext_shaper_font_data_t *) CFRetain (ct_font);
+
+ return font;
+}
+
+CTFontRef
+hb_coretext_font_get_ct_font (hb_font_t *font)
+{
+ if (unlikely (!hb_coretext_shaper_font_data_ensure (font))) return nullptr;
+ return (CTFontRef) HB_SHAPER_DATA_GET (font);
+}
+
+
/*
* shaper shape_plan data
@@ -319,15 +378,6 @@ _hb_coretext_shaper_shape_plan_data_destroy (hb_coretext_shaper_shape_plan_data_
{
}
-CTFontRef
-hb_coretext_font_get_ct_font (hb_font_t *font)
-{
- hb_face_t *face = font->face;
- if (unlikely (!hb_coretext_shaper_face_data_ensure (face))) return NULL;
- hb_coretext_shaper_face_data_t *face_data = HB_SHAPER_DATA_GET (face);
- return face_data->ct_font;
-}
-
/*
* shaper
@@ -342,7 +392,9 @@ struct active_feature_t {
feature_record_t rec;
unsigned int order;
- static int cmp (const active_feature_t *a, const active_feature_t *b) {
+ static int cmp (const void *pa, const void *pb) {
+ const active_feature_t *a = (const active_feature_t *) pa;
+ const active_feature_t *b = (const active_feature_t *) pb;
return a->rec.feature < b->rec.feature ? -1 : a->rec.feature > b->rec.feature ? 1 :
a->order < b->order ? -1 : a->order > b->order ? 1 :
a->rec.setting < b->rec.setting ? -1 : a->rec.setting > b->rec.setting ? 1 :
@@ -358,7 +410,9 @@ struct feature_event_t {
bool start;
active_feature_t feature;
- static int cmp (const feature_event_t *a, const feature_event_t *b) {
+ static int cmp (const void *pa, const void *pb) {
+ const feature_event_t *a = (const feature_event_t *) pa;
+ const feature_event_t *b = (const feature_event_t *) pb;
return a->index < b->index ? -1 : a->index > b->index ? 1 :
a->start < b->start ? -1 : a->start > b->start ? 1 :
active_feature_t::cmp (&a->feature, &b->feature);
@@ -557,9 +611,10 @@ _hb_coretext_shape (hb_shape_plan_t *shape_plan,
unsigned int num_features)
{
hb_face_t *face = font->face;
- hb_coretext_shaper_face_data_t *face_data = HB_SHAPER_DATA_GET (face);
+ CGFontRef cg_font = (CGFontRef) HB_SHAPER_DATA_GET (face);
+ CTFontRef ct_font = (CTFontRef) HB_SHAPER_DATA_GET (font);
- CGFloat ct_font_size = CTFontGetSize (face_data->ct_font);
+ CGFloat ct_font_size = CTFontGetSize (ct_font);
CGFloat x_mult = (CGFloat) font->x_scale / ct_font_size;
CGFloat y_mult = (CGFloat) font->y_scale / ct_font_size;
@@ -660,22 +715,23 @@ _hb_coretext_shape (hb_shape_plan_t *shape_plan,
/* active_features.qsort (); */
for (unsigned int j = 0; j < active_features.len; j++)
{
- CFStringRef keys[2] = {
+ CFStringRef keys[] = {
kCTFontFeatureTypeIdentifierKey,
kCTFontFeatureSelectorIdentifierKey
};
- CFNumberRef values[2] = {
+ CFNumberRef values[] = {
CFNumberCreate (kCFAllocatorDefault, kCFNumberIntType, &active_features[j].rec.feature),
CFNumberCreate (kCFAllocatorDefault, kCFNumberIntType, &active_features[j].rec.setting)
};
+ static_assert ((ARRAY_LENGTH_CONST (keys) == ARRAY_LENGTH_CONST (values)), "");
CFDictionaryRef dict = CFDictionaryCreate (kCFAllocatorDefault,
(const void **) keys,
(const void **) values,
- 2,
+ ARRAY_LENGTH (keys),
&kCFTypeDictionaryKeyCallBacks,
&kCFTypeDictionaryValueCallBacks);
- CFRelease (values[0]);
- CFRelease (values[1]);
+ for (unsigned int i = 0; i < ARRAY_LENGTH (values); i++)
+ CFRelease (values[i]);
CFArrayAppendValue (features_array, dict);
CFRelease (dict);
@@ -693,12 +749,12 @@ _hb_coretext_shape (hb_shape_plan_t *shape_plan,
CTFontDescriptorRef font_desc = CTFontDescriptorCreateWithAttributes (attributes);
CFRelease (attributes);
- range->font = CTFontCreateCopyWithAttributes (face_data->ct_font, 0.0, NULL, font_desc);
+ range->font = CTFontCreateCopyWithAttributes (ct_font, 0.0, nullptr, font_desc);
CFRelease (font_desc);
}
else
{
- range->font = NULL;
+ range->font = nullptr;
}
range->index_first = last_index;
@@ -718,9 +774,6 @@ _hb_coretext_shape (hb_shape_plan_t *shape_plan,
active_features.remove (feature - active_features.array);
}
}
-
- if (!range_records.len) /* No active feature found. */
- goto fail_features;
}
else
{
@@ -771,14 +824,14 @@ _hb_coretext_shape (hb_shape_plan_t *shape_plan,
#define FAIL(...) \
HB_STMT_START { \
- DEBUG_MSG (CORETEXT, NULL, __VA_ARGS__); \
+ DEBUG_MSG (CORETEXT, nullptr, __VA_ARGS__); \
ret = false; \
goto fail; \
} HB_STMT_END;
bool ret = true;
- CFStringRef string_ref = NULL;
- CTLineRef line = NULL;
+ CFStringRef string_ref = nullptr;
+ CTLineRef line = nullptr;
if (0)
{
@@ -790,8 +843,8 @@ resize_and_retry:
assert (line);
CFRelease (string_ref);
CFRelease (line);
- string_ref = NULL;
- line = NULL;
+ string_ref = nullptr;
+ line = nullptr;
/* Get previous start-of-scratch-area, that we use later for readjusting
* our existing scratch arrays. */
@@ -812,7 +865,7 @@ resize_and_retry:
scratch_size -= old_scratch_used;
}
{
- string_ref = CFStringCreateWithCharactersNoCopy (NULL,
+ string_ref = CFStringCreateWithCharactersNoCopy (nullptr,
pchars, chars_len,
kCFAllocatorNull);
if (unlikely (!string_ref))
@@ -850,9 +903,9 @@ resize_and_retry:
CFRelease (lang);
}
CFAttributedStringSetAttribute (attr_string, CFRangeMake (0, chars_len),
- kCTFontAttributeName, face_data->ct_font);
+ kCTFontAttributeName, ct_font);
- if (num_features)
+ if (num_features && range_records.len)
{
unsigned int start = 0;
range_record_t *last_range = &range_records[0];
@@ -878,6 +931,30 @@ resize_and_retry:
CFAttributedStringSetAttribute (attr_string, CFRangeMake (start, chars_len - start),
kCTFontAttributeName, last_range->font);
}
+ /* Enable/disable kern if requested.
+ *
+ * Note: once kern is disabled, reenabling it doesn't currently seem to work in CoreText.
+ */
+ if (num_features)
+ {
+ unsigned int zeroint = 0;
+ CFNumberRef zero = CFNumberCreate (kCFAllocatorDefault, kCFNumberIntType, &zeroint);
+ for (unsigned int i = 0; i < num_features; i++)
+ {
+ const hb_feature_t &feature = features[i];
+ if (feature.tag == HB_TAG('k','e','r','n') &&
+ feature.start < chars_len && feature.start < feature.end)
+ {
+ CFRange feature_range = CFRangeMake (feature.start,
+ MIN (feature.end, chars_len) - feature.start);
+ if (feature.value)
+ CFAttributedStringRemoveAttribute (attr_string, feature_range, kCTKernAttributeName);
+ else
+ CFAttributedStringSetAttribute (attr_string, feature_range, kCTKernAttributeName, zero);
+ }
+ }
+ CFRelease (zero);
+ }
int level = HB_DIRECTION_IS_FORWARD (buffer->props.direction) ? 0 : 1;
CFNumberRef level_number = CFNumberCreate (kCFAllocatorDefault, kCFNumberIntType, &level);
@@ -887,6 +964,7 @@ resize_and_retry:
1,
&kCFTypeDictionaryKeyCallBacks,
&kCFTypeDictionaryValueCallBacks);
+ CFRelease (level_number);
if (unlikely (!options))
FAIL ("CFDictionaryCreate failed");
@@ -904,7 +982,7 @@ resize_and_retry:
CFArrayRef glyph_runs = CTLineGetGlyphRuns (line);
unsigned int num_runs = CFArrayGetCount (glyph_runs);
- DEBUG_MSG (CORETEXT, NULL, "Num runs: %d", num_runs);
+ DEBUG_MSG (CORETEXT, nullptr, "Num runs: %d", num_runs);
buffer->len = 0;
uint32_t status_and = ~0, status_or = 0;
@@ -930,7 +1008,7 @@ resize_and_retry:
status_or |= run_status;
status_and &= run_status;
DEBUG_MSG (CORETEXT, run, "CTRunStatus: %x", run_status);
- double run_advance = CTRunGetTypographicBounds (run, range_all, NULL, NULL, NULL);
+ double run_advance = CTRunGetTypographicBounds (run, range_all, nullptr, nullptr, nullptr);
if (HB_DIRECTION_IS_VERTICAL (buffer->props.direction))
run_advance = -run_advance;
DEBUG_MSG (CORETEXT, run, "Run advance: %g", run_advance);
@@ -943,7 +1021,7 @@ resize_and_retry:
*/
CFDictionaryRef attributes = CTRunGetAttributes (run);
CTFontRef run_ct_font = static_cast<CTFontRef>(CFDictionaryGetValue (attributes, kCTFontAttributeName));
- if (!CFEqual (run_ct_font, face_data->ct_font))
+ if (!CFEqual (run_ct_font, ct_font))
{
/* The run doesn't use our main font instance. We have to figure out
* whether font fallback happened, or this is just CoreText giving us
@@ -965,7 +1043,7 @@ resize_and_retry:
* However, even that wouldn't work if we were passed in the CGFont to
* construct a hb_face to begin with.
*
- * See: http://github.com/behdad/harfbuzz/pull/36
+ * See: http://github.com/harfbuzz/harfbuzz/pull/36
*
* Also see: https://bugs.chromium.org/p/chromium/issues/detail?id=597098
*/
@@ -981,13 +1059,13 @@ resize_and_retry:
CGFontRef run_cg_font = CTFontCopyGraphicsFont (run_ct_font, 0);
if (run_cg_font)
{
- matched = CFEqual (run_cg_font, face_data->cg_font);
+ matched = CFEqual (run_cg_font, cg_font);
CFRelease (run_cg_font);
}
}
if (!matched)
{
- CFStringRef font_ps_name = CTFontCopyName (face_data->ct_font, kCTFontPostScriptNameKey);
+ CFStringRef font_ps_name = CTFontCopyName (ct_font, kCTFontPostScriptNameKey);
CFStringRef run_ps_name = CTFontCopyName (run_ct_font, kCTFontPostScriptNameKey);
CFComparisonResult result = CFStringCompare (run_ps_name, font_ps_name, 0);
CFRelease (run_ps_name);
@@ -1056,7 +1134,7 @@ resize_and_retry:
/* Testing used to indicate that CTRunGetGlyphsPtr, etc (almost?) always
* succeed, and so copying data to our own buffer will be rare. Reports
- * have it that this changed in OS X 10.10 Yosemite, and NULL is returned
+ * have it that this changed in OS X 10.10 Yosemite, and nullptr is returned
* frequently. At any rate, we can test that codepath by setting USE_PTR
* to false. */
@@ -1072,13 +1150,13 @@ resize_and_retry:
{ /* Setup glyphs */
SCRATCH_SAVE();
- const CGGlyph* glyphs = USE_PTR ? CTRunGetGlyphsPtr (run) : NULL;
+ const CGGlyph* glyphs = USE_PTR ? CTRunGetGlyphsPtr (run) : nullptr;
if (!glyphs) {
ALLOCATE_ARRAY (CGGlyph, glyph_buf, num_glyphs, goto resize_and_retry);
CTRunGetGlyphs (run, range_all, glyph_buf);
glyphs = glyph_buf;
}
- const CFIndex* string_indices = USE_PTR ? CTRunGetStringIndicesPtr (run) : NULL;
+ const CFIndex* string_indices = USE_PTR ? CTRunGetStringIndicesPtr (run) : nullptr;
if (!string_indices) {
ALLOCATE_ARRAY (CFIndex, index_buf, num_glyphs, goto resize_and_retry);
CTRunGetStringIndices (run, range_all, index_buf);
@@ -1100,7 +1178,7 @@ resize_and_retry:
* advance (in the advance direction only), and for last glyph we set
* whatever is needed to make the whole run's advance add up. */
SCRATCH_SAVE();
- const CGPoint* positions = USE_PTR ? CTRunGetPositionsPtr (run) : NULL;
+ const CGPoint* positions = USE_PTR ? CTRunGetPositionsPtr (run) : nullptr;
if (!positions) {
ALLOCATE_ARRAY (CGPoint, position_buf, num_glyphs, goto resize_and_retry);
CTRunGetPositions (run, range_all, position_buf);
@@ -1176,6 +1254,9 @@ resize_and_retry:
pos->x_advance = info->mask;
pos->x_offset = info->var1.i32;
pos->y_offset = info->var2.i32;
+
+ info->mask = HB_GLYPH_FLAG_UNSAFE_TO_BREAK;
+
info++, pos++;
}
else
@@ -1184,6 +1265,9 @@ resize_and_retry:
pos->y_advance = info->mask;
pos->x_offset = info->var1.i32;
pos->y_offset = info->var2.i32;
+
+ info->mask = HB_GLYPH_FLAG_UNSAFE_TO_BREAK;
+
info++, pos++;
}
@@ -1221,6 +1305,8 @@ resize_and_retry:
}
}
+ buffer->unsafe_to_break_all ();
+
#undef FAIL
fail:
@@ -1241,6 +1327,9 @@ fail:
* AAT shaper
*/
+HB_SHAPER_DATA_ENSURE_DEFINE(coretext_aat, face)
+HB_SHAPER_DATA_ENSURE_DEFINE(coretext_aat, font)
+
/*
* shaper face data
*/
@@ -1250,22 +1339,20 @@ struct hb_coretext_aat_shaper_face_data_t {};
hb_coretext_aat_shaper_face_data_t *
_hb_coretext_aat_shaper_face_data_create (hb_face_t *face)
{
- hb_blob_t *mort_blob = face->reference_table (HB_CORETEXT_TAG_MORT);
- /* Umm, we just reference the table to check whether it exists.
- * Maybe add better API for this? */
- if (!hb_blob_get_length (mort_blob))
+ static const hb_tag_t tags[] = {HB_CORETEXT_TAG_MORX, HB_CORETEXT_TAG_MORT, HB_CORETEXT_TAG_KERX};
+
+ for (unsigned int i = 0; i < ARRAY_LENGTH (tags); i++)
{
- hb_blob_destroy (mort_blob);
- mort_blob = face->reference_table (HB_CORETEXT_TAG_MORX);
- if (!hb_blob_get_length (mort_blob))
+ hb_blob_t *blob = face->reference_table (tags[i]);
+ if (hb_blob_get_length (blob))
{
- hb_blob_destroy (mort_blob);
- return NULL;
+ hb_blob_destroy (blob);
+ return hb_coretext_shaper_face_data_ensure (face) ? (hb_coretext_aat_shaper_face_data_t *) HB_SHAPER_DATA_SUCCEEDED : nullptr;
}
+ hb_blob_destroy (blob);
}
- hb_blob_destroy (mort_blob);
- return hb_coretext_shaper_face_data_ensure (face) ? (hb_coretext_aat_shaper_face_data_t *) HB_SHAPER_DATA_SUCCEEDED : NULL;
+ return nullptr;
}
void
@@ -1283,7 +1370,7 @@ struct hb_coretext_aat_shaper_font_data_t {};
hb_coretext_aat_shaper_font_data_t *
_hb_coretext_aat_shaper_font_data_create (hb_font_t *font)
{
- return hb_coretext_shaper_font_data_ensure (font) ? (hb_coretext_aat_shaper_font_data_t *) HB_SHAPER_DATA_SUCCEEDED : NULL;
+ return hb_coretext_shaper_font_data_ensure (font) ? (hb_coretext_aat_shaper_font_data_t *) HB_SHAPER_DATA_SUCCEEDED : nullptr;
}
void
diff --git a/src/3rdparty/harfbuzz-ng/src/hb-coretext.h b/src/3rdparty/harfbuzz-ng/src/hb-coretext.h
index 82066e4e0d..4b0a6f01b6 100644
--- a/src/3rdparty/harfbuzz-ng/src/hb-coretext.h
+++ b/src/3rdparty/harfbuzz-ng/src/hb-coretext.h
@@ -42,11 +42,15 @@ HB_BEGIN_DECLS
#define HB_CORETEXT_TAG_MORT HB_TAG('m','o','r','t')
#define HB_CORETEXT_TAG_MORX HB_TAG('m','o','r','x')
+#define HB_CORETEXT_TAG_KERX HB_TAG('k','e','r','x')
HB_EXTERN hb_face_t *
hb_coretext_face_create (CGFontRef cg_font);
+HB_EXTERN hb_font_t *
+hb_coretext_font_create (CTFontRef ct_font);
+
HB_EXTERN CGFontRef
hb_coretext_face_get_cg_font (hb_face_t *face);
diff --git a/src/3rdparty/harfbuzz-ng/src/hb-debug.hh b/src/3rdparty/harfbuzz-ng/src/hb-debug.hh
new file mode 100644
index 0000000000..6c425f7b9d
--- /dev/null
+++ b/src/3rdparty/harfbuzz-ng/src/hb-debug.hh
@@ -0,0 +1,431 @@
+/*
+ * Copyright © 2017 Google, Inc.
+ *
+ * This is part of HarfBuzz, a text shaping library.
+ *
+ * Permission is hereby granted, without written agreement and without
+ * license or royalty fees, to use, copy, modify, and distribute this
+ * software and its documentation for any purpose, provided that the
+ * above copyright notice and the following two paragraphs appear in
+ * all copies of this software.
+ *
+ * IN NO EVENT SHALL THE COPYRIGHT HOLDER BE LIABLE TO ANY PARTY FOR
+ * DIRECT, INDIRECT, SPECIAL, INCIDENTAL, OR CONSEQUENTIAL DAMAGES
+ * ARISING OUT OF THE USE OF THIS SOFTWARE AND ITS DOCUMENTATION, EVEN
+ * IF THE COPYRIGHT HOLDER HAS BEEN ADVISED OF THE POSSIBILITY OF SUCH
+ * DAMAGE.
+ *
+ * THE COPYRIGHT HOLDER SPECIFICALLY DISCLAIMS ANY WARRANTIES, INCLUDING,
+ * BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND
+ * FITNESS FOR A PARTICULAR PURPOSE. THE SOFTWARE PROVIDED HEREUNDER IS
+ * ON AN "AS IS" BASIS, AND THE COPYRIGHT HOLDER HAS NO OBLIGATION TO
+ * PROVIDE MAINTENANCE, SUPPORT, UPDATES, ENHANCEMENTS, OR MODIFICATIONS.
+ *
+ * Google Author(s): Behdad Esfahbod
+ */
+
+#ifndef HB_DEBUG_HH
+#define HB_DEBUG_HH
+
+#include "hb-private.hh"
+
+
+#ifndef HB_DEBUG
+#define HB_DEBUG 0
+#endif
+
+static inline bool
+_hb_debug (unsigned int level,
+ unsigned int max_level)
+{
+ return level < max_level;
+}
+
+#define DEBUG_LEVEL_ENABLED(WHAT, LEVEL) (_hb_debug ((LEVEL), HB_DEBUG_##WHAT))
+#define DEBUG_ENABLED(WHAT) (DEBUG_LEVEL_ENABLED (WHAT, 0))
+
+static inline void
+_hb_print_func (const char *func)
+{
+ if (func)
+ {
+ unsigned int func_len = strlen (func);
+ /* Skip "static" */
+ if (0 == strncmp (func, "static ", 7))
+ func += 7;
+ /* Skip "typename" */
+ if (0 == strncmp (func, "typename ", 9))
+ func += 9;
+ /* Skip return type */
+ const char *space = strchr (func, ' ');
+ if (space)
+ func = space + 1;
+ /* Skip parameter list */
+ const char *paren = strchr (func, '(');
+ if (paren)
+ func_len = paren - func;
+ fprintf (stderr, "%.*s", func_len, func);
+ }
+}
+
+template <int max_level> static inline void
+_hb_debug_msg_va (const char *what,
+ const void *obj,
+ const char *func,
+ bool indented,
+ unsigned int level,
+ int level_dir,
+ const char *message,
+ va_list ap) HB_PRINTF_FUNC(7, 0);
+template <int max_level> static inline void
+_hb_debug_msg_va (const char *what,
+ const void *obj,
+ const char *func,
+ bool indented,
+ unsigned int level,
+ int level_dir,
+ const char *message,
+ va_list ap)
+{
+ if (!_hb_debug (level, max_level))
+ return;
+
+ fprintf (stderr, "%-10s", what ? what : "");
+
+ if (obj)
+ fprintf (stderr, "(%*p) ", (unsigned int) (2 * sizeof (void *)), obj);
+ else
+ fprintf (stderr, " %*s ", (unsigned int) (2 * sizeof (void *)), "");
+
+ if (indented) {
+#define VBAR "\342\224\202" /* U+2502 BOX DRAWINGS LIGHT VERTICAL */
+#define VRBAR "\342\224\234" /* U+251C BOX DRAWINGS LIGHT VERTICAL AND RIGHT */
+#define DLBAR "\342\225\256" /* U+256E BOX DRAWINGS LIGHT ARC DOWN AND LEFT */
+#define ULBAR "\342\225\257" /* U+256F BOX DRAWINGS LIGHT ARC UP AND LEFT */
+#define LBAR "\342\225\264" /* U+2574 BOX DRAWINGS LIGHT LEFT */
+ static const char bars[] =
+ VBAR VBAR VBAR VBAR VBAR VBAR VBAR VBAR VBAR VBAR
+ VBAR VBAR VBAR VBAR VBAR VBAR VBAR VBAR VBAR VBAR
+ VBAR VBAR VBAR VBAR VBAR VBAR VBAR VBAR VBAR VBAR
+ VBAR VBAR VBAR VBAR VBAR VBAR VBAR VBAR VBAR VBAR
+ VBAR VBAR VBAR VBAR VBAR VBAR VBAR VBAR VBAR VBAR;
+ fprintf (stderr, "%2u %s" VRBAR "%s",
+ level,
+ bars + sizeof (bars) - 1 - MIN ((unsigned int) sizeof (bars) - 1, (unsigned int) (sizeof (VBAR) - 1) * level),
+ level_dir ? (level_dir > 0 ? DLBAR : ULBAR) : LBAR);
+ } else
+ fprintf (stderr, " " VRBAR LBAR);
+
+ _hb_print_func (func);
+
+ if (message)
+ {
+ fprintf (stderr, ": ");
+ vfprintf (stderr, message, ap);
+ }
+
+ fprintf (stderr, "\n");
+}
+template <> inline void
+_hb_debug_msg_va<0> (const char *what HB_UNUSED,
+ const void *obj HB_UNUSED,
+ const char *func HB_UNUSED,
+ bool indented HB_UNUSED,
+ unsigned int level HB_UNUSED,
+ int level_dir HB_UNUSED,
+ const char *message HB_UNUSED,
+ va_list ap HB_UNUSED) {}
+
+template <int max_level> static inline void
+_hb_debug_msg (const char *what,
+ const void *obj,
+ const char *func,
+ bool indented,
+ unsigned int level,
+ int level_dir,
+ const char *message,
+ ...) HB_PRINTF_FUNC(7, 8);
+template <int max_level> static inline void
+_hb_debug_msg (const char *what,
+ const void *obj,
+ const char *func,
+ bool indented,
+ unsigned int level,
+ int level_dir,
+ const char *message,
+ ...)
+{
+ va_list ap;
+ va_start (ap, message);
+ _hb_debug_msg_va<max_level> (what, obj, func, indented, level, level_dir, message, ap);
+ va_end (ap);
+}
+template <> inline void
+_hb_debug_msg<0> (const char *what HB_UNUSED,
+ const void *obj HB_UNUSED,
+ const char *func HB_UNUSED,
+ bool indented HB_UNUSED,
+ unsigned int level HB_UNUSED,
+ int level_dir HB_UNUSED,
+ const char *message HB_UNUSED,
+ ...) HB_PRINTF_FUNC(7, 8);
+template <> inline void
+_hb_debug_msg<0> (const char *what HB_UNUSED,
+ const void *obj HB_UNUSED,
+ const char *func HB_UNUSED,
+ bool indented HB_UNUSED,
+ unsigned int level HB_UNUSED,
+ int level_dir HB_UNUSED,
+ const char *message HB_UNUSED,
+ ...) {}
+
+#define DEBUG_MSG_LEVEL(WHAT, OBJ, LEVEL, LEVEL_DIR, ...) _hb_debug_msg<HB_DEBUG_##WHAT> (#WHAT, (OBJ), nullptr, true, (LEVEL), (LEVEL_DIR), __VA_ARGS__)
+#define DEBUG_MSG(WHAT, OBJ, ...) _hb_debug_msg<HB_DEBUG_##WHAT> (#WHAT, (OBJ), nullptr, false, 0, 0, __VA_ARGS__)
+#define DEBUG_MSG_FUNC(WHAT, OBJ, ...) _hb_debug_msg<HB_DEBUG_##WHAT> (#WHAT, (OBJ), HB_FUNC, false, 0, 0, __VA_ARGS__)
+
+
+/*
+ * Printer
+ */
+
+template <typename T>
+struct hb_printer_t {
+ const char *print (const T&) { return "something"; }
+};
+
+template <>
+struct hb_printer_t<bool> {
+ const char *print (bool v) { return v ? "true" : "false"; }
+};
+
+template <>
+struct hb_printer_t<hb_void_t> {
+ const char *print (hb_void_t) { return ""; }
+};
+
+
+/*
+ * Trace
+ */
+
+template <typename T>
+static inline void _hb_warn_no_return (bool returned)
+{
+ if (unlikely (!returned)) {
+ fprintf (stderr, "OUCH, returned with no call to return_trace(). This is a bug, please report.\n");
+ }
+}
+template <>
+/*static*/ inline void _hb_warn_no_return<hb_void_t> (bool returned HB_UNUSED)
+{}
+
+template <int max_level, typename ret_t>
+struct hb_auto_trace_t
+{
+ explicit inline hb_auto_trace_t (unsigned int *plevel_,
+ const char *what_,
+ const void *obj_,
+ const char *func,
+ const char *message,
+ ...) HB_PRINTF_FUNC(6, 7)
+ : plevel (plevel_), what (what_), obj (obj_), returned (false)
+ {
+ if (plevel) ++*plevel;
+
+ va_list ap;
+ va_start (ap, message);
+ _hb_debug_msg_va<max_level> (what, obj, func, true, plevel ? *plevel : 0, +1, message, ap);
+ va_end (ap);
+ }
+ inline ~hb_auto_trace_t (void)
+ {
+ _hb_warn_no_return<ret_t> (returned);
+ if (!returned) {
+ _hb_debug_msg<max_level> (what, obj, nullptr, true, plevel ? *plevel : 1, -1, " ");
+ }
+ if (plevel) --*plevel;
+ }
+
+ inline ret_t ret (ret_t v, unsigned int line = 0)
+ {
+ if (unlikely (returned)) {
+ fprintf (stderr, "OUCH, double calls to return_trace(). This is a bug, please report.\n");
+ return v;
+ }
+
+ _hb_debug_msg<max_level> (what, obj, nullptr, true, plevel ? *plevel : 1, -1,
+ "return %s (line %d)",
+ hb_printer_t<ret_t>().print (v), line);
+ if (plevel) --*plevel;
+ plevel = nullptr;
+ returned = true;
+ return v;
+ }
+
+ private:
+ unsigned int *plevel;
+ const char *what;
+ const void *obj;
+ bool returned;
+};
+template <typename ret_t> /* Make sure we don't use hb_auto_trace_t when not tracing. */
+struct hb_auto_trace_t<0, ret_t>
+{
+ explicit inline hb_auto_trace_t (unsigned int *plevel_,
+ const char *what_,
+ const void *obj_,
+ const char *func,
+ const char *message,
+ ...) HB_PRINTF_FUNC(6, 7) {}
+
+ inline ret_t ret (ret_t v, unsigned int line HB_UNUSED = 0) { return v; }
+};
+
+/* For disabled tracing; optimize out everything.
+ * https://github.com/harfbuzz/harfbuzz/pull/605 */
+template <typename ret_t>
+struct hb_no_trace_t {
+ inline ret_t ret (ret_t v, unsigned int line HB_UNUSED = 0) { return v; }
+};
+
+#define return_trace(RET) return trace.ret (RET, __LINE__)
+
+
+/*
+ * Instances.
+ */
+
+#ifndef HB_DEBUG_ARABIC
+#define HB_DEBUG_ARABIC (HB_DEBUG+0)
+#endif
+
+#ifndef HB_DEBUG_BLOB
+#define HB_DEBUG_BLOB (HB_DEBUG+0)
+#endif
+
+#ifndef HB_DEBUG_CORETEXT
+#define HB_DEBUG_CORETEXT (HB_DEBUG+0)
+#endif
+
+#ifndef HB_DEBUG_DIRECTWRITE
+#define HB_DEBUG_DIRECTWRITE (HB_DEBUG+0)
+#endif
+
+#ifndef HB_DEBUG_FT
+#define HB_DEBUG_FT (HB_DEBUG+0)
+#endif
+
+#ifndef HB_DEBUG_GET_COVERAGE
+#define HB_DEBUG_GET_COVERAGE (HB_DEBUG+0)
+#endif
+
+#ifndef HB_DEBUG_OBJECT
+#define HB_DEBUG_OBJECT (HB_DEBUG+0)
+#endif
+
+#ifndef HB_DEBUG_SHAPE_PLAN
+#define HB_DEBUG_SHAPE_PLAN (HB_DEBUG+0)
+#endif
+
+#ifndef HB_DEBUG_UNISCRIBE
+#define HB_DEBUG_UNISCRIBE (HB_DEBUG+0)
+#endif
+
+/*
+ * With tracing.
+ */
+
+#ifndef HB_DEBUG_APPLY
+#define HB_DEBUG_APPLY (HB_DEBUG+0)
+#endif
+#if HB_DEBUG_APPLY
+#define TRACE_APPLY(this) \
+ hb_auto_trace_t<HB_DEBUG_APPLY, bool> trace \
+ (&c->debug_depth, c->get_name (), this, HB_FUNC, \
+ "idx %d gid %u lookup %d", \
+ c->buffer->idx, c->buffer->cur().codepoint, (int) c->lookup_index)
+#else
+#define TRACE_APPLY(this) hb_no_trace_t<bool> trace
+#endif
+
+#ifndef HB_DEBUG_CLOSURE
+#define HB_DEBUG_CLOSURE (HB_DEBUG+0)
+#endif
+#if HB_DEBUG_CLOSURE
+#define TRACE_CLOSURE(this) \
+ hb_auto_trace_t<HB_DEBUG_CLOSURE, hb_void_t> trace \
+ (&c->debug_depth, c->get_name (), this, HB_FUNC, \
+ " ")
+#else
+#define TRACE_CLOSURE(this) hb_no_trace_t<hb_void_t> trace HB_UNUSED
+#endif
+
+#ifndef HB_DEBUG_COLLECT_GLYPHS
+#define HB_DEBUG_COLLECT_GLYPHS (HB_DEBUG+0)
+#endif
+#if HB_DEBUG_COLLECT_GLYPHS
+#define TRACE_COLLECT_GLYPHS(this) \
+ hb_auto_trace_t<HB_DEBUG_COLLECT_GLYPHS, hb_void_t> trace \
+ (&c->debug_depth, c->get_name (), this, HB_FUNC, \
+ " ")
+#else
+#define TRACE_COLLECT_GLYPHS(this) hb_no_trace_t<hb_void_t> trace HB_UNUSED
+#endif
+
+#ifndef HB_DEBUG_SANITIZE
+#define HB_DEBUG_SANITIZE (HB_DEBUG+0)
+#endif
+#if HB_DEBUG_SANITIZE
+#define TRACE_SANITIZE(this) \
+ hb_auto_trace_t<HB_DEBUG_SANITIZE, bool> trace \
+ (&c->debug_depth, c->get_name (), this, HB_FUNC, \
+ " ");
+#else
+#define TRACE_SANITIZE(this) hb_no_trace_t<bool> trace
+#endif
+
+#ifndef HB_DEBUG_SERIALIZE
+#define HB_DEBUG_SERIALIZE (HB_DEBUG+0)
+#endif
+#if HB_DEBUG_SERIALIZE
+#define TRACE_SERIALIZE(this) \
+ hb_auto_trace_t<HB_DEBUG_SERIALIZE, bool> trace \
+ (&c->debug_depth, "SERIALIZE", c, HB_FUNC, \
+ " ");
+#else
+#define TRACE_SERIALIZE(this) hb_no_trace_t<bool> trace
+#endif
+
+#ifndef HB_DEBUG_WOULD_APPLY
+#define HB_DEBUG_WOULD_APPLY (HB_DEBUG+0)
+#endif
+#if HB_DEBUG_WOULD_APPLY
+#define TRACE_WOULD_APPLY(this) \
+ hb_auto_trace_t<HB_DEBUG_WOULD_APPLY, bool> trace \
+ (&c->debug_depth, c->get_name (), this, HB_FUNC, \
+ "%d glyphs", c->len);
+#else
+#define TRACE_WOULD_APPLY(this) hb_no_trace_t<bool> trace
+#endif
+
+#ifndef HB_DEBUG_DISPATCH
+#define HB_DEBUG_DISPATCH ( \
+ HB_DEBUG_APPLY + \
+ HB_DEBUG_CLOSURE + \
+ HB_DEBUG_COLLECT_GLYPHS + \
+ HB_DEBUG_SANITIZE + \
+ HB_DEBUG_SERIALIZE + \
+ HB_DEBUG_WOULD_APPLY + \
+ 0)
+#endif
+#if HB_DEBUG_DISPATCH
+#define TRACE_DISPATCH(this, format) \
+ hb_auto_trace_t<context_t::max_debug_depth, typename context_t::return_t> trace \
+ (&c->debug_depth, c->get_name (), this, HB_FUNC, \
+ "format %d", (int) format);
+#else
+#define TRACE_DISPATCH(this, format) hb_no_trace_t<typename context_t::return_t> trace
+#endif
+
+
+#endif /* HB_DEBUG_HH */
diff --git a/src/3rdparty/harfbuzz-ng/src/hb-deprecated.h b/src/3rdparty/harfbuzz-ng/src/hb-deprecated.h
index 0398dfae60..eac7efb42f 100644
--- a/src/3rdparty/harfbuzz-ng/src/hb-deprecated.h
+++ b/src/3rdparty/harfbuzz-ng/src/hb-deprecated.h
@@ -34,6 +34,7 @@
#include "hb-common.h"
#include "hb-unicode.h"
#include "hb-font.h"
+#include "hb-set.h"
HB_BEGIN_DECLS
@@ -54,6 +55,9 @@ hb_font_funcs_set_glyph_func (hb_font_funcs_t *ffuncs,
hb_font_get_glyph_func_t func,
void *user_data, hb_destroy_func_t destroy);
+HB_EXTERN void
+hb_set_invert (hb_set_t *set);
+
#endif
HB_END_DECLS
diff --git a/src/3rdparty/harfbuzz-ng/src/hb-dsalgs.hh b/src/3rdparty/harfbuzz-ng/src/hb-dsalgs.hh
new file mode 100644
index 0000000000..4e8f0431c6
--- /dev/null
+++ b/src/3rdparty/harfbuzz-ng/src/hb-dsalgs.hh
@@ -0,0 +1,167 @@
+/*
+ * Copyright © 2017 Google, Inc.
+ *
+ * This is part of HarfBuzz, a text shaping library.
+ *
+ * Permission is hereby granted, without written agreement and without
+ * license or royalty fees, to use, copy, modify, and distribute this
+ * software and its documentation for any purpose, provided that the
+ * above copyright notice and the following two paragraphs appear in
+ * all copies of this software.
+ *
+ * IN NO EVENT SHALL THE COPYRIGHT HOLDER BE LIABLE TO ANY PARTY FOR
+ * DIRECT, INDIRECT, SPECIAL, INCIDENTAL, OR CONSEQUENTIAL DAMAGES
+ * ARISING OUT OF THE USE OF THIS SOFTWARE AND ITS DOCUMENTATION, EVEN
+ * IF THE COPYRIGHT HOLDER HAS BEEN ADVISED OF THE POSSIBILITY OF SUCH
+ * DAMAGE.
+ *
+ * THE COPYRIGHT HOLDER SPECIFICALLY DISCLAIMS ANY WARRANTIES, INCLUDING,
+ * BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND
+ * FITNESS FOR A PARTICULAR PURPOSE. THE SOFTWARE PROVIDED HEREUNDER IS
+ * ON AN "AS IS" BASIS, AND THE COPYRIGHT HOLDER HAS NO OBLIGATION TO
+ * PROVIDE MAINTENANCE, SUPPORT, UPDATES, ENHANCEMENTS, OR MODIFICATIONS.
+ *
+ * Google Author(s): Behdad Esfahbod
+ */
+
+#ifndef HB_DSALGS_HH
+#define HB_DSALGS_HH
+
+#include "hb-private.hh"
+
+#if defined(__ghs)
+// GHS compiler doesn't support the __restrict keyword
+#define __restrict
+#endif
+
+
+
+static inline void *
+hb_bsearch_r (const void *key, const void *base,
+ size_t nmemb, size_t size,
+ int (*compar)(const void *_key, const void *_item, void *_arg),
+ void *arg)
+{
+ int min = 0, max = (int) nmemb - 1;
+ while (min <= max)
+ {
+ int mid = (min + max) / 2;
+ const void *p = (const void *) (((const char *) base) + (mid * size));
+ int c = compar (key, p, arg);
+ if (c < 0)
+ max = mid - 1;
+ else if (c > 0)
+ min = mid + 1;
+ else
+ return (void *) p;
+ }
+ return NULL;
+}
+
+
+
+/* From https://github.com/noporpoise/sort_r */
+
+/* Isaac Turner 29 April 2014 Public Domain */
+
+/*
+
+hb_sort_r function to be exported.
+
+Parameters:
+ base is the array to be sorted
+ nel is the number of elements in the array
+ width is the size in bytes of each element of the array
+ compar is the comparison function
+ arg is a pointer to be passed to the comparison function
+
+void hb_sort_r(void *base, size_t nel, size_t width,
+ int (*compar)(const void *_a, const void *_b, void *_arg),
+ void *arg);
+*/
+
+
+/* swap a, b iff a>b */
+/* __restrict is same as restrict but better support on old machines */
+static int sort_r_cmpswap(char *__restrict a, char *__restrict b, size_t w,
+ int (*compar)(const void *_a, const void *_b,
+ void *_arg),
+ void *arg)
+{
+ char tmp, *end = a+w;
+ if(compar(a, b, arg) > 0) {
+ for(; a < end; a++, b++) { tmp = *a; *a = *b; *b = tmp; }
+ return 1;
+ }
+ return 0;
+}
+
+/* Note: quicksort is not stable, equivalent values may be swapped */
+static inline void sort_r_simple(void *base, size_t nel, size_t w,
+ int (*compar)(const void *_a, const void *_b,
+ void *_arg),
+ void *arg)
+{
+ char *b = (char *)base, *end = b + nel*w;
+ if(nel < 7) {
+ /* Insertion sort for arbitrarily small inputs */
+ char *pi, *pj;
+ for(pi = b+w; pi < end; pi += w) {
+ for(pj = pi; pj > b && sort_r_cmpswap(pj-w,pj,w,compar,arg); pj -= w) {}
+ }
+ }
+ else
+ {
+ /* nel > 6; Quicksort */
+
+ /* Use median of first, middle and last items as pivot */
+ char *x, *y, *xend, ch;
+ char *pl, *pr;
+ char *last = b+w*(nel-1), *tmp;
+ char *l[3];
+ l[0] = b;
+ l[1] = b+w*(nel/2);
+ l[2] = last;
+
+ if(compar(l[0],l[1],arg) > 0) { tmp=l[0]; l[0]=l[1]; l[1]=tmp; }
+ if(compar(l[1],l[2],arg) > 0) {
+ tmp=l[1]; l[1]=l[2]; l[2]=tmp; /* swap(l[1],l[2]) */
+ if(compar(l[0],l[1],arg) > 0) { tmp=l[0]; l[0]=l[1]; l[1]=tmp; }
+ }
+
+ /* swap l[id], l[2] to put pivot as last element */
+ for(x = l[1], y = last, xend = x+w; x<xend; x++, y++) {
+ ch = *x; *x = *y; *y = ch;
+ }
+
+ pl = b;
+ pr = last;
+
+ while(pl < pr) {
+ for(; pl < pr; pl += w) {
+ if(sort_r_cmpswap(pl, pr, w, compar, arg)) {
+ pr -= w; /* pivot now at pl */
+ break;
+ }
+ }
+ for(; pl < pr; pr -= w) {
+ if(sort_r_cmpswap(pl, pr, w, compar, arg)) {
+ pl += w; /* pivot now at pr */
+ break;
+ }
+ }
+ }
+
+ sort_r_simple(b, (pl-b)/w, w, compar, arg);
+ sort_r_simple(pl+w, (end-(pl+w))/w, w, compar, arg);
+ }
+}
+
+static inline void hb_sort_r(void *base, size_t nel, size_t width,
+ int (*compar)(const void *_a, const void *_b, void *_arg),
+ void *arg)
+{
+ sort_r_simple(base, nel, width, compar, arg);
+}
+
+#endif /* HB_DSALGS_HH */
diff --git a/src/3rdparty/harfbuzz-ng/src/hb-face-private.hh b/src/3rdparty/harfbuzz-ng/src/hb-face-private.hh
index c4266fff4f..43e7b1cb3f 100644
--- a/src/3rdparty/harfbuzz-ng/src/hb-face-private.hh
+++ b/src/3rdparty/harfbuzz-ng/src/hb-face-private.hh
@@ -50,12 +50,16 @@ struct hb_face_t {
void *user_data;
hb_destroy_func_t destroy;
- unsigned int index;
- mutable unsigned int upem;
- mutable unsigned int num_glyphs;
+ unsigned int index; /* Face index in a collection, zero-based. */
+ mutable unsigned int upem; /* Units-per-EM. */
+ mutable unsigned int num_glyphs; /* Number of glyphs. */
- struct hb_shaper_data_t shaper_data;
+ struct hb_shaper_data_t shaper_data; /* Various shaper data. */
+ /* Various non-shaping data. */
+ /* ... */
+
+ /* Cache */
struct plan_node_t {
hb_shape_plan_t *shape_plan;
plan_node_t *next;
diff --git a/src/3rdparty/harfbuzz-ng/src/hb-face.cc b/src/3rdparty/harfbuzz-ng/src/hb-face.cc
index 6b563bc8f1..26fddbe529 100644
--- a/src/3rdparty/harfbuzz-ng/src/hb-face.cc
+++ b/src/3rdparty/harfbuzz-ng/src/hb-face.cc
@@ -28,15 +28,11 @@
#include "hb-private.hh"
-#include "hb-ot-layout-private.hh"
-
-#include "hb-font-private.hh"
+#include "hb-face-private.hh"
#include "hb-open-file-private.hh"
#include "hb-ot-head-table.hh"
#include "hb-ot-maxp-table.hh"
-#include <string.h>
-
/*
* hb_face_t
@@ -47,9 +43,9 @@ const hb_face_t _hb_face_nil = {
true, /* immutable */
- NULL, /* reference_table_func */
- NULL, /* user_data */
- NULL, /* destroy */
+ nullptr, /* reference_table_func */
+ nullptr, /* user_data */
+ nullptr, /* destroy */
0, /* index */
1000, /* upem */
@@ -61,7 +57,7 @@ const hb_face_t _hb_face_nil = {
#undef HB_SHAPER_IMPLEMENT
},
- NULL, /* shape_plans */
+ nullptr, /* shape_plans */
};
@@ -113,7 +109,7 @@ _hb_face_for_data_closure_create (hb_blob_t *blob, unsigned int index)
closure = (hb_face_for_data_closure_t *) calloc (1, sizeof (hb_face_for_data_closure_t));
if (unlikely (!closure))
- return NULL;
+ return nullptr;
closure->blob = blob;
closure->index = index;
@@ -122,8 +118,10 @@ _hb_face_for_data_closure_create (hb_blob_t *blob, unsigned int index)
}
static void
-_hb_face_for_data_closure_destroy (hb_face_for_data_closure_t *closure)
+_hb_face_for_data_closure_destroy (void *data)
{
+ hb_face_for_data_closure_t *closure = (hb_face_for_data_closure_t *) data;
+
hb_blob_destroy (closure->blob);
free (closure);
}
@@ -173,9 +171,9 @@ hb_face_create (hb_blob_t *blob,
face = hb_face_create_for_tables (_hb_face_for_data_reference_table,
closure,
- (hb_destroy_func_t) _hb_face_for_data_closure_destroy);
+ _hb_face_for_data_closure_destroy);
- hb_face_set_index (face, index);
+ face->index = index;
return face;
}
@@ -476,4 +474,33 @@ hb_face_t::load_num_glyphs (void) const
hb_blob_destroy (maxp_blob);
}
+/**
+ * hb_face_get_table_tags:
+ * @face: a face.
+ *
+ * Retrieves table tags for a face, if possible.
+ *
+ * Return value: total number of tables, or 0 if not possible to list.
+ *
+ * Since: 1.6.0
+ **/
+unsigned int
+hb_face_get_table_tags (hb_face_t *face,
+ unsigned int start_offset,
+ unsigned int *table_count, /* IN/OUT */
+ hb_tag_t *table_tags /* OUT */)
+{
+ if (face->destroy != _hb_face_for_data_closure_destroy)
+ {
+ if (table_count)
+ *table_count = 0;
+ return 0;
+ }
+
+ hb_face_for_data_closure_t *data = (hb_face_for_data_closure_t *) face->user_data;
+ const OT::OpenTypeFontFile &ot_file = *OT::Sanitizer<OT::OpenTypeFontFile>::lock_instance (data->blob);
+ const OT::OpenTypeFontFace &ot_face = ot_file.get_face (data->index);
+
+ return ot_face.get_table_tags (start_offset, table_count, table_tags);
+}
diff --git a/src/3rdparty/harfbuzz-ng/src/hb-face.h b/src/3rdparty/harfbuzz-ng/src/hb-face.h
index 91237b7085..9842d52b65 100644
--- a/src/3rdparty/harfbuzz-ng/src/hb-face.h
+++ b/src/3rdparty/harfbuzz-ng/src/hb-face.h
@@ -111,6 +111,11 @@ hb_face_set_glyph_count (hb_face_t *face,
HB_EXTERN unsigned int
hb_face_get_glyph_count (hb_face_t *face);
+HB_EXTERN unsigned int
+hb_face_get_table_tags (hb_face_t *face,
+ unsigned int start_offset,
+ unsigned int *table_count, /* IN/OUT */
+ hb_tag_t *table_tags /* OUT */);
HB_END_DECLS
diff --git a/src/3rdparty/harfbuzz-ng/src/hb-fallback-shape.cc b/src/3rdparty/harfbuzz-ng/src/hb-fallback-shape.cc
index ac6d4b00f5..3f09c3f530 100644
--- a/src/3rdparty/harfbuzz-ng/src/hb-fallback-shape.cc
+++ b/src/3rdparty/harfbuzz-ng/src/hb-fallback-shape.cc
@@ -28,6 +28,10 @@
#include "hb-shaper-impl-private.hh"
+HB_SHAPER_DATA_ENSURE_DEFINE(fallback, face)
+HB_SHAPER_DATA_ENSURE_DEFINE(fallback, font)
+
+
/*
* shaper face data
*/
@@ -125,7 +129,7 @@ _hb_fallback_shape (hb_shape_plan_t *shape_plan HB_UNUSED,
pos[i].y_advance = 0;
continue;
}
- font->get_nominal_glyph (info[i].codepoint, &info[i].codepoint);
+ (void) font->get_nominal_glyph (info[i].codepoint, &info[i].codepoint);
font->get_glyph_advance_for_direction (info[i].codepoint,
direction,
&pos[i].x_advance,
@@ -139,5 +143,7 @@ _hb_fallback_shape (hb_shape_plan_t *shape_plan HB_UNUSED,
if (HB_DIRECTION_IS_BACKWARD (direction))
hb_buffer_reverse (buffer);
+ buffer->safe_to_break_all ();
+
return true;
}
diff --git a/src/3rdparty/harfbuzz-ng/src/hb-font-private.hh b/src/3rdparty/harfbuzz-ng/src/hb-font-private.hh
index 53671d78d2..d2801fb86e 100644
--- a/src/3rdparty/harfbuzz-ng/src/hb-font-private.hh
+++ b/src/3rdparty/harfbuzz-ng/src/hb-font-private.hh
@@ -108,6 +108,8 @@ struct hb_font_t {
unsigned int x_ppem;
unsigned int y_ppem;
+ float ptem;
+
/* Font variation coordinates. */
unsigned int num_coords;
int *coords;
diff --git a/src/3rdparty/harfbuzz-ng/src/hb-font.cc b/src/3rdparty/harfbuzz-ng/src/hb-font.cc
index 2935c4b4fd..f3534b686b 100644
--- a/src/3rdparty/harfbuzz-ng/src/hb-font.cc
+++ b/src/3rdparty/harfbuzz-ng/src/hb-font.cc
@@ -28,14 +28,7 @@
#include "hb-private.hh"
-#include "hb-ot-layout-private.hh"
-
#include "hb-font-private.hh"
-#include "hb-open-file-private.hh"
-#include "hb-ot-head-table.hh"
-#include "hb-ot-maxp-table.hh"
-
-#include <string.h>
/*
@@ -43,7 +36,7 @@
*/
static hb_bool_t
-hb_font_get_font_h_extents_nil (hb_font_t *font,
+hb_font_get_font_h_extents_nil (hb_font_t *font HB_UNUSED,
void *font_data HB_UNUSED,
hb_font_extents_t *metrics,
void *user_data HB_UNUSED)
@@ -67,7 +60,7 @@ hb_font_get_font_h_extents_parent (hb_font_t *font,
}
static hb_bool_t
-hb_font_get_font_v_extents_nil (hb_font_t *font,
+hb_font_get_font_v_extents_nil (hb_font_t *font HB_UNUSED,
void *font_data HB_UNUSED,
hb_font_extents_t *metrics,
void *user_data HB_UNUSED)
@@ -354,12 +347,12 @@ static const hb_font_funcs_t _hb_font_funcs_nil = {
true, /* immutable */
{
-#define HB_FONT_FUNC_IMPLEMENT(name) NULL,
+#define HB_FONT_FUNC_IMPLEMENT(name) nullptr,
HB_FONT_FUNCS_IMPLEMENT_CALLBACKS
#undef HB_FONT_FUNC_IMPLEMENT
},
{
-#define HB_FONT_FUNC_IMPLEMENT(name) NULL,
+#define HB_FONT_FUNC_IMPLEMENT(name) nullptr,
HB_FONT_FUNCS_IMPLEMENT_CALLBACKS
#undef HB_FONT_FUNC_IMPLEMENT
},
@@ -377,12 +370,12 @@ static const hb_font_funcs_t _hb_font_funcs_parent = {
true, /* immutable */
{
-#define HB_FONT_FUNC_IMPLEMENT(name) NULL,
+#define HB_FONT_FUNC_IMPLEMENT(name) nullptr,
HB_FONT_FUNCS_IMPLEMENT_CALLBACKS
#undef HB_FONT_FUNC_IMPLEMENT
},
{
-#define HB_FONT_FUNC_IMPLEMENT(name) NULL,
+#define HB_FONT_FUNC_IMPLEMENT(name) nullptr,
HB_FONT_FUNCS_IMPLEMENT_CALLBACKS
#undef HB_FONT_FUNC_IMPLEMENT
},
@@ -570,8 +563,8 @@ hb_font_funcs_set_##name##_func (hb_font_funcs_t *ffuncs, \
ffuncs->destroy.name = destroy; \
} else { \
ffuncs->get.f.name = hb_font_get_##name##_parent; \
- ffuncs->user_data.name = NULL; \
- ffuncs->destroy.name = NULL; \
+ ffuncs->user_data.name = nullptr; \
+ ffuncs->destroy.name = nullptr; \
} \
}
@@ -1164,8 +1157,20 @@ hb_font_create_sub_font (hb_font_t *parent)
font->y_scale = parent->y_scale;
font->x_ppem = parent->x_ppem;
font->y_ppem = parent->y_ppem;
+ font->ptem = parent->ptem;
- /* TODO: copy variation coordinates. */
+ font->num_coords = parent->num_coords;
+ if (!font->num_coords)
+ font->coords = nullptr;
+ else
+ {
+ unsigned int size = parent->num_coords * sizeof (parent->coords[0]);
+ font->coords = (int *) malloc (size);
+ if (unlikely (!font->coords))
+ font->num_coords = 0;
+ else
+ memcpy (font->coords, parent->coords, size);
+ }
return font;
}
@@ -1187,7 +1192,7 @@ hb_font_get_empty (void)
true, /* immutable */
- NULL, /* parent */
+ nullptr, /* parent */
const_cast<hb_face_t *> (&_hb_face_nil),
1000, /* x_scale */
@@ -1195,13 +1200,14 @@ hb_font_get_empty (void)
0, /* x_ppem */
0, /* y_ppem */
+ 0, /* ptem */
0, /* num_coords */
- NULL, /* coords */
+ nullptr, /* coords */
const_cast<hb_font_funcs_t *> (&_hb_font_funcs_nil), /* klass */
- NULL, /* user_data */
- NULL, /* destroy */
+ nullptr, /* user_data */
+ nullptr, /* destroy */
{
#define HB_SHAPER_IMPLEMENT(shaper) HB_SHAPER_DATA_INVALID,
@@ -1379,6 +1385,32 @@ hb_font_get_parent (hb_font_t *font)
}
/**
+ * hb_font_set_face:
+ * @font: a font.
+ * @face: new face.
+ *
+ * Sets font-face of @font.
+ *
+ * Since: 1.4.3
+ **/
+void
+hb_font_set_face (hb_font_t *font,
+ hb_face_t *face)
+{
+ if (font->immutable)
+ return;
+
+ if (unlikely (!face))
+ face = hb_face_get_empty ();
+
+ hb_face_t *old = font->face;
+
+ font->face = hb_face_reference (face);
+
+ hb_face_destroy (old);
+}
+
+/**
* hb_font_get_face:
* @font: a font.
*
@@ -1543,30 +1575,146 @@ hb_font_get_ppem (hb_font_t *font,
if (y_ppem) *y_ppem = font->y_ppem;
}
+/**
+ * hb_font_set_ptem:
+ * @font: a font.
+ * @ptem:
+ *
+ * Sets "point size" of the font.
+ *
+ * Since: 1.6.0
+ **/
+void
+hb_font_set_ptem (hb_font_t *font, float ptem)
+{
+ if (font->immutable)
+ return;
+
+ font->ptem = ptem;
+}
+
+/**
+ * hb_font_get_ptem:
+ * @font: a font.
+ *
+ * Gets the "point size" of the font. A value of 0 means unset.
+ *
+ * Return value: Point size.
+ *
+ * Since: 0.9.2
+ **/
+float
+hb_font_get_ptem (hb_font_t *font)
+{
+ return font->ptem;
+}
+/*
+ * Variations
+ */
+
+static void
+_hb_font_adopt_var_coords_normalized (hb_font_t *font,
+ int *coords, /* 2.14 normalized */
+ unsigned int coords_length)
+{
+ free (font->coords);
+
+ font->coords = coords;
+ font->num_coords = coords_length;
+}
+
+/**
+ * hb_font_set_variations:
+ *
+ * Since: 1.4.2
+ */
+void
+hb_font_set_variations (hb_font_t *font,
+ const hb_variation_t *variations,
+ unsigned int variations_length)
+{
+ if (font->immutable)
+ return;
+
+ if (!variations_length)
+ {
+ hb_font_set_var_coords_normalized (font, nullptr, 0);
+ return;
+ }
+
+ unsigned int coords_length = hb_ot_var_get_axis_count (font->face);
+
+ int *normalized = coords_length ? (int *) calloc (coords_length, sizeof (int)) : nullptr;
+ if (unlikely (coords_length && !normalized))
+ return;
+
+ hb_ot_var_normalize_variations (font->face,
+ variations, variations_length,
+ normalized, coords_length);
+ _hb_font_adopt_var_coords_normalized (font, normalized, coords_length);
+}
+
+/**
+ * hb_font_set_var_coords_design:
+ *
+ * Since: 1.4.2
+ */
+void
+hb_font_set_var_coords_design (hb_font_t *font,
+ const float *coords,
+ unsigned int coords_length)
+{
+ if (font->immutable)
+ return;
+
+ int *normalized = coords_length ? (int *) calloc (coords_length, sizeof (int)) : nullptr;
+ if (unlikely (coords_length && !normalized))
+ return;
+
+ hb_ot_var_normalize_coords (font->face, coords_length, coords, normalized);
+ _hb_font_adopt_var_coords_normalized (font, normalized, coords_length);
+}
+
+/**
+ * hb_font_set_var_coords_normalized:
+ *
+ * Since: 1.4.2
+ */
void
hb_font_set_var_coords_normalized (hb_font_t *font,
- int *coords, /* XXX 2.14 normalized */
+ const int *coords, /* 2.14 normalized */
unsigned int coords_length)
{
if (font->immutable)
return;
- /* Skip tail zero entries. */
- while (coords_length && !coords[coords_length - 1])
- coords_length--;
-
- int *copy = coords_length ? (int *) calloc (coords_length, sizeof (coords[0])) : NULL;
+ int *copy = coords_length ? (int *) calloc (coords_length, sizeof (coords[0])) : nullptr;
if (unlikely (coords_length && !copy))
return;
- free (font->coords);
-
if (coords_length)
memcpy (copy, coords, coords_length * sizeof (coords[0]));
- font->coords = copy;
- font->num_coords = coords_length;
+ _hb_font_adopt_var_coords_normalized (font, copy, coords_length);
+}
+
+/**
+ * hb_font_get_var_coords_normalized:
+ *
+ * Return value is valid as long as variation coordinates of the font
+ * are not modified.
+ *
+ * Since: 1.4.2
+ */
+const int *
+hb_font_get_var_coords_normalized (hb_font_t *font,
+ unsigned int *length)
+{
+ if (length)
+ *length = font->num_coords;
+
+ return font->coords;
}
@@ -1601,7 +1749,7 @@ trampoline_create (FuncType func,
trampoline_t *trampoline = (trampoline_t *) calloc (1, sizeof (trampoline_t));
if (unlikely (!trampoline))
- return NULL;
+ return nullptr;
trampoline->closure.user_data = user_data;
trampoline->closure.destroy = destroy;
diff --git a/src/3rdparty/harfbuzz-ng/src/hb-font.h b/src/3rdparty/harfbuzz-ng/src/hb-font.h
index 8813286726..540cdcab95 100644
--- a/src/3rdparty/harfbuzz-ng/src/hb-font.h
+++ b/src/3rdparty/harfbuzz-ng/src/hb-font.h
@@ -563,6 +563,10 @@ hb_font_set_parent (hb_font_t *font,
HB_EXTERN hb_font_t *
hb_font_get_parent (hb_font_t *font);
+HB_EXTERN void
+hb_font_set_face (hb_font_t *font,
+ hb_face_t *face);
+
HB_EXTERN hb_face_t *
hb_font_get_face (hb_font_t *font);
@@ -603,12 +607,35 @@ hb_font_get_ppem (hb_font_t *font,
unsigned int *x_ppem,
unsigned int *y_ppem);
+/*
+ * Point size per EM. Used for optical-sizing in CoreText.
+ * A value of zero means "not set".
+ */
+HB_EXTERN void
+hb_font_set_ptem (hb_font_t *font, float ptem);
+
+HB_EXTERN float
+hb_font_get_ptem (hb_font_t *font);
+
+HB_EXTERN void
+hb_font_set_variations (hb_font_t *font,
+ const hb_variation_t *variations,
+ unsigned int variations_length);
+
+HB_EXTERN void
+hb_font_set_var_coords_design (hb_font_t *font,
+ const float *coords,
+ unsigned int coords_length);
HB_EXTERN void
hb_font_set_var_coords_normalized (hb_font_t *font,
- int *coords, /* XXX 2.14 normalized */
+ const int *coords, /* 2.14 normalized */
unsigned int coords_length);
+HB_EXTERN const int *
+hb_font_get_var_coords_normalized (hb_font_t *font,
+ unsigned int *length);
+
HB_END_DECLS
#endif /* HB_FONT_H */
diff --git a/src/3rdparty/harfbuzz-ng/src/hb-mutex-private.hh b/src/3rdparty/harfbuzz-ng/src/hb-mutex-private.hh
index ed2703571c..49ed10e08a 100644
--- a/src/3rdparty/harfbuzz-ng/src/hb-mutex-private.hh
+++ b/src/3rdparty/harfbuzz-ng/src/hb-mutex-private.hh
@@ -68,7 +68,7 @@ typedef CRITICAL_SECTION hb_mutex_impl_t;
#include <pthread.h>
typedef pthread_mutex_t hb_mutex_impl_t;
#define HB_MUTEX_IMPL_INIT PTHREAD_MUTEX_INITIALIZER
-#define hb_mutex_impl_init(M) pthread_mutex_init (M, NULL)
+#define hb_mutex_impl_init(M) pthread_mutex_init (M, nullptr)
#define hb_mutex_impl_lock(M) pthread_mutex_lock (M)
#define hb_mutex_impl_unlock(M) pthread_mutex_unlock (M)
#define hb_mutex_impl_finish(M) pthread_mutex_destroy (M)
diff --git a/src/3rdparty/harfbuzz-ng/src/hb-object-private.hh b/src/3rdparty/harfbuzz-ng/src/hb-object-private.hh
index 6b73ff92d0..baa1f8f05c 100644
--- a/src/3rdparty/harfbuzz-ng/src/hb-object-private.hh
+++ b/src/3rdparty/harfbuzz-ng/src/hb-object-private.hh
@@ -33,18 +33,12 @@
#define HB_OBJECT_PRIVATE_HH
#include "hb-private.hh"
+#include "hb-debug.hh"
#include "hb-atomic-private.hh"
#include "hb-mutex-private.hh"
-/* Debug */
-
-#ifndef HB_DEBUG_OBJECT
-#define HB_DEBUG_OBJECT (HB_DEBUG+0)
-#endif
-
-
/* reference_count */
#define HB_REFERENCE_COUNT_INERT_VALUE -1
@@ -193,7 +187,7 @@ static inline void *hb_object_get_user_data (Type *obj,
hb_user_data_key_t *key)
{
if (unlikely (!obj || hb_object_is_inert (obj)))
- return NULL;
+ return nullptr;
assert (hb_object_is_valid (obj));
return obj->header.user_data.get (key);
}
diff --git a/src/3rdparty/harfbuzz-ng/src/hb-open-file-private.hh b/src/3rdparty/harfbuzz-ng/src/hb-open-file-private.hh
index 5357ddcf5b..644e0b40f6 100644
--- a/src/3rdparty/harfbuzz-ng/src/hb-open-file-private.hh
+++ b/src/3rdparty/harfbuzz-ng/src/hb-open-file-private.hh
@@ -53,6 +53,9 @@ struct TTCHeader;
typedef struct TableRecord
{
+ int cmp (Tag t) const
+ { return t.cmp (tag); }
+
inline bool sanitize (hb_sanitize_context_t *c) const
{
TRACE_SANITIZE (this);
@@ -61,9 +64,9 @@ typedef struct TableRecord
Tag tag; /* 4-byte identifier. */
CheckSum checkSum; /* CheckSum for this table. */
- ULONG offset; /* Offset from beginning of TrueType font
+ UINT32 offset; /* Offset from beginning of TrueType font
* file. */
- ULONG length; /* Length of this table. */
+ UINT32 length; /* Length of this table. */
public:
DEFINE_SIZE_STATIC (16);
} OpenTypeTable;
@@ -73,27 +76,39 @@ typedef struct OffsetTable
friend struct OpenTypeFontFile;
inline unsigned int get_table_count (void) const
- { return numTables; }
+ { return tables.len; }
inline const TableRecord& get_table (unsigned int i) const
{
- if (unlikely (i >= numTables)) return Null(TableRecord);
return tables[i];
}
+ inline unsigned int get_table_tags (unsigned int start_offset,
+ unsigned int *table_count, /* IN/OUT */
+ hb_tag_t *table_tags /* OUT */) const
+ {
+ if (table_count)
+ {
+ if (start_offset >= tables.len)
+ *table_count = 0;
+ else
+ *table_count = MIN<unsigned int> (*table_count, tables.len - start_offset);
+
+ const TableRecord *sub_tables = tables.array + start_offset;
+ unsigned int count = *table_count;
+ for (unsigned int i = 0; i < count; i++)
+ table_tags[i] = sub_tables[i].tag;
+ }
+ return tables.len;
+ }
inline bool find_table_index (hb_tag_t tag, unsigned int *table_index) const
{
Tag t;
t.set (tag);
- unsigned int count = numTables;
- for (unsigned int i = 0; i < count; i++)
- {
- if (t == tables[i].tag)
- {
- if (table_index) *table_index = i;
- return true;
- }
- }
- if (table_index) *table_index = Index::NOT_FOUND_INDEX;
- return false;
+ /* Linear-search for small tables to work around fonts with unsorted
+ * table list. */
+ int i = tables.len < 64 ? tables.lsearch (t) : tables.bsearch (t);
+ if (table_index)
+ *table_index = i == -1 ? Index::NOT_FOUND_INDEX : (unsigned int) i;
+ return i != -1;
}
inline const TableRecord& get_table_by_tag (hb_tag_t tag) const
{
@@ -106,16 +121,13 @@ typedef struct OffsetTable
inline bool sanitize (hb_sanitize_context_t *c) const
{
TRACE_SANITIZE (this);
- return_trace (c->check_struct (this) && c->check_array (tables, TableRecord::static_size, numTables));
+ return_trace (c->check_struct (this) && tables.sanitize (c));
}
protected:
Tag sfnt_version; /* '\0\001\0\00' if TrueType / 'OTTO' if CFF */
- USHORT numTables; /* Number of tables. */
- USHORT searchRangeZ; /* (Maximum power of 2 <= numTables) x 16 */
- USHORT entrySelectorZ; /* Log2(maximum power of 2 <= numTables). */
- USHORT rangeShiftZ; /* NumTables x 16-searchRange. */
- TableRecord tables[VAR]; /* TableRecord entries. numTables items */
+ BinSearchArrayOf<TableRecord>
+ tables;
public:
DEFINE_SIZE_ARRAY (12, tables);
} OpenTypeFontFace;
@@ -142,7 +154,7 @@ struct TTCHeaderVersion1
Tag ttcTag; /* TrueType Collection ID string: 'ttcf' */
FixedVersion<>version; /* Version of the TTC Header (1.0),
* 0x00010000u */
- ArrayOf<OffsetTo<OffsetTable, ULONG>, ULONG>
+ ArrayOf<LOffsetTo<OffsetTable>, UINT32>
table; /* Array of offsets to the OffsetTable for each font
* from the beginning of the file */
public:
diff --git a/src/3rdparty/harfbuzz-ng/src/hb-open-type-private.hh b/src/3rdparty/harfbuzz-ng/src/hb-open-type-private.hh
index 2cc1fb20d2..2f4e1b9e9e 100644
--- a/src/3rdparty/harfbuzz-ng/src/hb-open-type-private.hh
+++ b/src/3rdparty/harfbuzz-ng/src/hb-open-type-private.hh
@@ -30,6 +30,8 @@
#define HB_OPEN_TYPE_PRIVATE_HH
#include "hb-private.hh"
+#include "hb-debug.hh"
+#include "hb-face-private.hh"
namespace OT {
@@ -84,7 +86,7 @@ static inline Type& StructAfter(TObject &X)
#define _DEFINE_INSTANCE_ASSERTION1(_line, _assertion) \
inline void _instance_assertion_on_line_##_line (void) const \
{ \
- ASSERT_STATIC (_assertion); \
+ static_assert ((_assertion), ""); \
ASSERT_INSTANCE_POD (*this); /* Make sure it's POD. */ \
}
# define _DEFINE_INSTANCE_ASSERTION0(_line, _assertion) _DEFINE_INSTANCE_ASSERTION1 (_line, _assertion)
@@ -129,14 +131,16 @@ static inline Type& StructAfter(TObject &X)
*/
/* Global nul-content Null pool. Enlarge as necessary. */
-/* TODO This really should be a extern HB_INTERNAL and defined somewhere... */
-static const void *_NullPool[(256+8) / sizeof (void *)];
+
+#define HB_NULL_POOL_SIZE 264
+static_assert (HB_NULL_POOL_SIZE % sizeof (void *) == 0, "Align HB_NULL_POOL_SIZE.");
+extern HB_INTERNAL const void * const _hb_NullPool[HB_NULL_POOL_SIZE / sizeof (void *)];
/* Generic nul-content Null objects. */
template <typename Type>
static inline const Type& Null (void) {
- ASSERT_STATIC (sizeof (Type) <= sizeof (_NullPool));
- return *CastP<Type> (_NullPool);
+ static_assert (sizeof (Type) <= HB_NULL_POOL_SIZE, "Increase HB_NULL_POOL_SIZE.");
+ return *CastP<Type> (_hb_NullPool);
}
/* Specializaiton for arbitrary-content arbitrary-sized Null objects. */
@@ -146,7 +150,7 @@ template <> \
/*static*/ inline const Type& Null<Type> (void) { \
return *CastP<Type> (_Null##Type); \
} /* The following line really exists such that we end in a place needing semicolon */ \
-ASSERT_STATIC (Type::min_size + 1 <= sizeof (_Null##Type))
+static_assert (Type::min_size + 1 <= sizeof (_Null##Type), "Null pool too small. Enlarge.")
/* Accessor macro. */
#define Null(Type) Null<Type>()
@@ -171,16 +175,6 @@ struct hb_dispatch_context_t
* Sanitize
*/
-#ifndef HB_DEBUG_SANITIZE
-#define HB_DEBUG_SANITIZE (HB_DEBUG+0)
-#endif
-
-
-#define TRACE_SANITIZE(this) \
- hb_auto_trace_t<HB_DEBUG_SANITIZE, bool> trace \
- (&c->debug_depth, c->get_name (), this, HB_FUNC, \
- "");
-
/* This limits sanitizing time on really broken fonts. */
#ifndef HB_SANITIZE_MAX_EDITS
#define HB_SANITIZE_MAX_EDITS 32
@@ -191,9 +185,9 @@ struct hb_sanitize_context_t :
{
inline hb_sanitize_context_t (void) :
debug_depth (0),
- start (NULL), end (NULL),
+ start (nullptr), end (nullptr),
writable (false), edit_count (0),
- blob (NULL) {}
+ blob (nullptr) {}
inline const char *get_name (void) { return "SANITIZE"; }
template <typename T, typename F>
@@ -213,7 +207,7 @@ struct hb_sanitize_context_t :
inline void start_processing (void)
{
- this->start = hb_blob_get_data (this->blob, NULL);
+ this->start = hb_blob_get_data (this->blob, nullptr);
this->end = this->start + hb_blob_get_length (this->blob);
assert (this->start <= this->end); /* Must not overflow. */
this->edit_count = 0;
@@ -232,8 +226,8 @@ struct hb_sanitize_context_t :
this->start, this->end, this->edit_count);
hb_blob_destroy (this->blob);
- this->blob = NULL;
- this->start = this->end = NULL;
+ this->blob = nullptr;
+ this->start = this->end = nullptr;
}
inline bool check_range (const void *base, unsigned int len) const
@@ -348,7 +342,7 @@ struct Sanitizer
} else {
unsigned int edit_count = c->edit_count;
if (edit_count && !c->writable) {
- c->start = hb_blob_get_data_writable (blob, NULL);
+ c->start = hb_blob_get_data_writable (blob, nullptr);
c->end = c->start + hb_blob_get_length (blob);
if (c->start) {
@@ -373,7 +367,7 @@ struct Sanitizer
static const Type* lock_instance (hb_blob_t *blob) {
hb_blob_make_immutable (blob);
- const char *base = hb_blob_get_data (blob, NULL);
+ const char *base = hb_blob_get_data (blob, nullptr);
return unlikely (!base) ? &Null(Type) : CastP<Type> (base);
}
};
@@ -384,16 +378,6 @@ struct Sanitizer
* Serialize
*/
-#ifndef HB_DEBUG_SERIALIZE
-#define HB_DEBUG_SERIALIZE (HB_DEBUG+0)
-#endif
-
-
-#define TRACE_SERIALIZE(this) \
- hb_auto_trace_t<HB_DEBUG_SERIALIZE, bool> trace \
- (&c->debug_depth, "SERIALIZE", c, HB_FUNC, \
- "");
-
struct hb_serialize_context_t
{
@@ -444,7 +428,7 @@ struct hb_serialize_context_t
{
if (unlikely (this->ran_out_of_room || this->end - this->head < ptrdiff_t (size))) {
this->ran_out_of_room = true;
- return NULL;
+ return nullptr;
}
memset (this->head, 0, size);
char *ret = this->head;
@@ -470,7 +454,7 @@ struct hb_serialize_context_t
{
unsigned int size = obj.get_size ();
Type *ret = this->allocate_size<Type> (size);
- if (unlikely (!ret)) return NULL;
+ if (unlikely (!ret)) return nullptr;
memcpy (ret, obj, size);
return ret;
}
@@ -480,7 +464,7 @@ struct hb_serialize_context_t
{
unsigned int size = obj.min_size;
assert (this->start <= (char *) &obj && (char *) &obj <= this->head && (char *) &obj + size >= this->head);
- if (unlikely (!this->allocate_size<Type> (((char *) &obj) + size - this->head))) return NULL;
+ if (unlikely (!this->allocate_size<Type> (((char *) &obj) + size - this->head))) return nullptr;
return reinterpret_cast<Type *> (&obj);
}
@@ -489,7 +473,7 @@ struct hb_serialize_context_t
{
unsigned int size = obj.get_size ();
assert (this->start < (char *) &obj && (char *) &obj <= this->head && (char *) &obj + size >= this->head);
- if (unlikely (!this->allocate_size<Type> (((char *) &obj) + size - this->head))) return NULL;
+ if (unlikely (!this->allocate_size<Type> (((char *) &obj) + size - this->head))) return nullptr;
return reinterpret_cast<Type *> (&obj);
}
@@ -631,10 +615,11 @@ struct IntType
inline bool operator == (const IntType<Type,Size> &o) const { return (Type) v == (Type) o.v; }
inline bool operator != (const IntType<Type,Size> &o) const { return !(*this == o); }
static inline int cmp (const IntType<Type,Size> *a, const IntType<Type,Size> *b) { return b->cmp (*a); }
- inline int cmp (Type a) const
+ template <typename Type2>
+ inline int cmp (Type2 a) const
{
Type b = v;
- if (sizeof (Type) < sizeof (int))
+ if (sizeof (Type) < sizeof (int) && sizeof (Type2) < sizeof (int))
return (int) a - (int) b;
else
return a < b ? -1 : a == b ? 0 : +1;
@@ -650,23 +635,22 @@ struct IntType
DEFINE_SIZE_STATIC (Size);
};
-typedef IntType<int8_t , 1> CHAR; /* 8-bit signed integer. */
-typedef IntType<uint8_t , 1> BYTE; /* 8-bit unsigned integer. */
-typedef IntType<int8_t , 1> INT8; /* 8-bit signed integer. */
-typedef IntType<uint16_t, 2> USHORT; /* 16-bit unsigned integer. */
-typedef IntType<int16_t, 2> SHORT; /* 16-bit signed integer. */
-typedef IntType<uint32_t, 4> ULONG; /* 32-bit unsigned integer. */
-typedef IntType<int32_t, 4> LONG; /* 32-bit signed integer. */
+typedef IntType<uint8_t, 1> UINT8; /* 8-bit unsigned integer. */
+typedef IntType<int8_t, 1> INT8; /* 8-bit signed integer. */
+typedef IntType<uint16_t, 2> UINT16; /* 16-bit unsigned integer. */
+typedef IntType<int16_t, 2> INT16; /* 16-bit signed integer. */
+typedef IntType<uint32_t, 4> UINT32; /* 32-bit unsigned integer. */
+typedef IntType<int32_t, 4> INT32; /* 32-bit signed integer. */
typedef IntType<uint32_t, 3> UINT24; /* 24-bit unsigned integer. */
-/* 16-bit signed integer (SHORT) that describes a quantity in FUnits. */
-typedef SHORT FWORD;
+/* 16-bit signed integer (INT16) that describes a quantity in FUnits. */
+typedef INT16 FWORD;
-/* 16-bit unsigned integer (USHORT) that describes a quantity in FUnits. */
-typedef USHORT UFWORD;
+/* 16-bit unsigned integer (UINT16) that describes a quantity in FUnits. */
+typedef UINT16 UFWORD;
/* 16-bit signed fixed number with the low 14 bits of fraction (2.14). */
-struct F2DOT14 : SHORT
+struct F2DOT14 : INT16
{
//inline float to_float (void) const { return ???; }
//inline void set_float (float f) { v.set (f * ???); }
@@ -675,7 +659,7 @@ struct F2DOT14 : SHORT
};
/* 32-bit signed fixed-point number (16.16). */
-struct Fixed: LONG
+struct Fixed: INT32
{
//inline float to_float (void) const { return ???; }
//inline void set_float (float f) { v.set (f * ???); }
@@ -693,15 +677,15 @@ struct LONGDATETIME
return_trace (likely (c->check_struct (this)));
}
protected:
- LONG major;
- ULONG minor;
+ INT32 major;
+ UINT32 minor;
public:
DEFINE_SIZE_STATIC (8);
};
/* Array of four uint8s (length = 32 bits) used to identify a script, language
* system, feature, or baseline */
-struct Tag : ULONG
+struct Tag : UINT32
{
/* What the char* converters return is NOT nul-terminated. Print using "%.4s" */
inline operator const char* (void) const { return reinterpret_cast<const char *> (&this->v); }
@@ -712,19 +696,16 @@ struct Tag : ULONG
DEFINE_NULL_DATA (Tag, " ");
/* Glyph index number, same as uint16 (length = 16 bits) */
-struct GlyphID : USHORT {
- static inline int cmp (const GlyphID *a, const GlyphID *b) { return b->USHORT::cmp (*a); }
- inline int cmp (hb_codepoint_t a) const { return (int) a - (int) *this; }
-};
+typedef UINT16 GlyphID;
/* Script/language-system/feature index */
-struct Index : USHORT {
+struct Index : UINT16 {
static const unsigned int NOT_FOUND_INDEX = 0xFFFFu;
};
DEFINE_NULL_DATA (Index, "\xff\xff");
/* Offset, Null offset = 0 */
-template <typename Type=USHORT>
+template <typename Type>
struct Offset : Type
{
inline bool is_null (void) const { return 0 == *this; }
@@ -732,15 +713,18 @@ struct Offset : Type
DEFINE_SIZE_STATIC (sizeof(Type));
};
+typedef Offset<UINT16> Offset16;
+typedef Offset<UINT32> Offset32;
+
/* CheckSum */
-struct CheckSum : ULONG
+struct CheckSum : UINT32
{
/* This is reference implementation from the spec. */
- static inline uint32_t CalcTableChecksum (const ULONG *Table, uint32_t Length)
+ static inline uint32_t CalcTableChecksum (const UINT32 *Table, uint32_t Length)
{
uint32_t Sum = 0L;
- const ULONG *EndPtr = Table+((Length+3) & ~3) / ULONG::static_size;
+ const UINT32 *EndPtr = Table+((Length+3) & ~3) / UINT32::static_size;
while (Table < EndPtr)
Sum += *Table++;
@@ -749,7 +733,7 @@ struct CheckSum : ULONG
/* Note: data should be 4byte aligned and have 4byte padding at the end. */
inline void set_for_data (const void *data, unsigned int length)
- { set (CalcTableChecksum ((const ULONG *) data, length)); }
+ { set (CalcTableChecksum ((const UINT32 *) data, length)); }
public:
DEFINE_SIZE_STATIC (4);
@@ -760,7 +744,7 @@ struct CheckSum : ULONG
* Version Numbers
*/
-template <typename FixedType=USHORT>
+template <typename FixedType=UINT16>
struct FixedVersion
{
inline uint32_t to_int (void) const { return (major << (sizeof(FixedType) * 8)) + minor; }
@@ -784,7 +768,7 @@ struct FixedVersion
* Use: (base+offset)
*/
-template <typename Type, typename OffsetType=USHORT>
+template <typename Type, typename OffsetType=UINT16>
struct OffsetTo : Offset<OffsetType>
{
inline const Type& operator () (const void *base) const
@@ -829,6 +813,7 @@ struct OffsetTo : Offset<OffsetType>
}
DEFINE_SIZE_STATIC (sizeof(OffsetType));
};
+template <typename Type> struct LOffsetTo : OffsetTo<Type, UINT32> {};
template <typename Base, typename OffsetType, typename Type>
static inline const Type& operator + (const Base &base, const OffsetTo<Type, OffsetType> &offset) { return offset (base); }
template <typename Base, typename OffsetType, typename Type>
@@ -840,7 +825,7 @@ static inline Type& operator + (Base &base, OffsetTo<Type, OffsetType> &offset)
*/
/* An array with a number of elements. */
-template <typename Type, typename LenType=USHORT>
+template <typename Type, typename LenType=UINT16>
struct ArrayOf
{
const Type *sub_array (unsigned int start_offset, unsigned int *pcount /* IN/OUT */) const
@@ -941,7 +926,7 @@ struct ArrayOf
inline bool sanitize_shallow (hb_sanitize_context_t *c) const
{
TRACE_SANITIZE (this);
- return_trace (c->check_struct (this) && c->check_array (array, Type::static_size, len));
+ return_trace (len.sanitize (c) && c->check_array (array, Type::static_size, len));
}
public:
@@ -950,9 +935,10 @@ struct ArrayOf
public:
DEFINE_SIZE_ARRAY (sizeof (LenType), array);
};
+template <typename Type> struct LArrayOf : ArrayOf<Type, UINT32> {};
/* Array of Offset's */
-template <typename Type, typename OffsetType=USHORT>
+template <typename Type, typename OffsetType=UINT16>
struct OffsetArrayOf : ArrayOf<OffsetTo<Type, OffsetType> > {};
/* Array of offsets relative to the beginning of the array itself. */
@@ -980,7 +966,7 @@ struct OffsetListOf : OffsetArrayOf<Type>
/* An array starting at second element. */
-template <typename Type, typename LenType=USHORT>
+template <typename Type, typename LenType=UINT16>
struct HeadlessArrayOf
{
inline const Type& operator [] (unsigned int i) const
@@ -1006,12 +992,6 @@ struct HeadlessArrayOf
return_trace (true);
}
- inline bool sanitize_shallow (hb_sanitize_context_t *c) const
- {
- return c->check_struct (this)
- && c->check_array (this, Type::static_size, len);
- }
-
inline bool sanitize (hb_sanitize_context_t *c) const
{
TRACE_SANITIZE (this);
@@ -1029,6 +1009,15 @@ struct HeadlessArrayOf
return_trace (true);
}
+ private:
+ inline bool sanitize_shallow (hb_sanitize_context_t *c) const
+ {
+ TRACE_SANITIZE (this);
+ return_trace (len.sanitize (c) &&
+ (!len || c->check_array (array, Type::static_size, len - 1)));
+ }
+
+ public:
LenType len;
Type array[VAR];
public:
@@ -1036,19 +1025,22 @@ struct HeadlessArrayOf
};
-/* An array with sorted elements. Supports binary searching. */
-template <typename Type, typename LenType=USHORT>
+/*
+ * An array with sorted elements. Supports binary searching.
+ */
+template <typename Type, typename LenType=UINT16>
struct SortedArrayOf : ArrayOf<Type, LenType>
{
template <typename SearchType>
inline int bsearch (const SearchType &x) const
{
/* Hand-coded bsearch here since this is in the hot inner loop. */
+ const Type *array = this->array;
int min = 0, max = (int) this->len - 1;
while (min <= max)
{
int mid = (min + max) / 2;
- int c = this->array[mid].cmp (x);
+ int c = array[mid].cmp (x);
if (c < 0)
max = mid - 1;
else if (c > 0)
@@ -1060,6 +1052,131 @@ struct SortedArrayOf : ArrayOf<Type, LenType>
}
};
+/*
+ * Binary-search arrays
+ */
+
+struct BinSearchHeader
+{
+ inline operator uint32_t (void) const { return len; }
+
+ inline bool sanitize (hb_sanitize_context_t *c) const
+ {
+ TRACE_SANITIZE (this);
+ return_trace (c->check_struct (this));
+ }
+
+ protected:
+ UINT16 len;
+ UINT16 searchRangeZ;
+ UINT16 entrySelectorZ;
+ UINT16 rangeShiftZ;
+
+ public:
+ DEFINE_SIZE_STATIC (8);
+};
+
+template <typename Type>
+struct BinSearchArrayOf : SortedArrayOf<Type, BinSearchHeader> {};
+
+
+/* Lazy struct and blob loaders. */
+
+/* Logic is shared between hb_lazy_loader_t and hb_lazy_table_loader_t */
+template <typename T>
+struct hb_lazy_loader_t
+{
+ inline void init (hb_face_t *face_)
+ {
+ face = face_;
+ instance = nullptr;
+ }
+
+ inline void fini (void)
+ {
+ if (instance && instance != &OT::Null(T))
+ {
+ instance->fini();
+ free (instance);
+ }
+ }
+
+ inline const T* get (void) const
+ {
+ retry:
+ T *p = (T *) hb_atomic_ptr_get (&instance);
+ if (unlikely (!p))
+ {
+ p = (T *) calloc (1, sizeof (T));
+ if (unlikely (!p))
+ p = const_cast<T *> (&OT::Null(T));
+ else
+ p->init (face);
+ if (unlikely (!hb_atomic_ptr_cmpexch (const_cast<T **>(&instance), nullptr, p)))
+ {
+ if (p != &OT::Null(T))
+ p->fini ();
+ goto retry;
+ }
+ }
+ return p;
+ }
+
+ inline const T* operator-> (void) const
+ {
+ return get ();
+ }
+
+ private:
+ hb_face_t *face;
+ T *instance;
+};
+
+/* Logic is shared between hb_lazy_loader_t and hb_lazy_table_loader_t */
+template <typename T>
+struct hb_lazy_table_loader_t
+{
+ inline void init (hb_face_t *face_)
+ {
+ face = face_;
+ instance = nullptr;
+ blob = nullptr;
+ }
+
+ inline void fini (void)
+ {
+ hb_blob_destroy (blob);
+ }
+
+ inline const T* get (void) const
+ {
+ retry:
+ T *p = (T *) hb_atomic_ptr_get (&instance);
+ if (unlikely (!p))
+ {
+ hb_blob_t *blob_ = OT::Sanitizer<T>::sanitize (face->reference_table (T::tableTag));
+ p = const_cast<T *>(OT::Sanitizer<T>::lock_instance (blob_));
+ if (!hb_atomic_ptr_cmpexch (const_cast<T **>(&instance), nullptr, p))
+ {
+ hb_blob_destroy (blob_);
+ goto retry;
+ }
+ blob = blob_;
+ }
+ return p;
+ }
+
+ inline const T* operator-> (void) const
+ {
+ return get();
+ }
+
+ private:
+ hb_face_t *face;
+ T *instance;
+ mutable hb_blob_t *blob;
+};
+
} /* namespace OT */
diff --git a/src/3rdparty/harfbuzz-ng/src/hb-ot-cbdt-table.hh b/src/3rdparty/harfbuzz-ng/src/hb-ot-cbdt-table.hh
index 52897abd3a..415625e5f8 100644
--- a/src/3rdparty/harfbuzz-ng/src/hb-ot-cbdt-table.hh
+++ b/src/3rdparty/harfbuzz-ng/src/hb-ot-cbdt-table.hh
@@ -47,20 +47,20 @@ struct SmallGlyphMetrics
extents->height = -height;
}
- BYTE height;
- BYTE width;
- CHAR bearingX;
- CHAR bearingY;
- BYTE advance;
+ UINT8 height;
+ UINT8 width;
+ INT8 bearingX;
+ INT8 bearingY;
+ UINT8 advance;
DEFINE_SIZE_STATIC(5);
};
struct BigGlyphMetrics : SmallGlyphMetrics
{
- CHAR vertBearingX;
- CHAR vertBearingY;
- BYTE vertAdvance;
+ INT8 vertBearingX;
+ INT8 vertBearingY;
+ UINT8 vertAdvance;
DEFINE_SIZE_STATIC(8);
};
@@ -73,18 +73,18 @@ struct SBitLineMetrics
return_trace (c->check_struct (this));
}
- CHAR ascender;
- CHAR decender;
- BYTE widthMax;
- CHAR caretSlopeNumerator;
- CHAR caretSlopeDenominator;
- CHAR caretOffset;
- CHAR minOriginSB;
- CHAR minAdvanceSB;
- CHAR maxBeforeBL;
- CHAR minAfterBL;
- CHAR padding1;
- CHAR padding2;
+ INT8 ascender;
+ INT8 decender;
+ UINT8 widthMax;
+ INT8 caretSlopeNumerator;
+ INT8 caretSlopeDenominator;
+ INT8 caretOffset;
+ INT8 minOriginSB;
+ INT8 minAdvanceSB;
+ INT8 maxBeforeBL;
+ INT8 minAfterBL;
+ INT8 padding1;
+ INT8 padding2;
DEFINE_SIZE_STATIC(12);
};
@@ -102,9 +102,9 @@ struct IndexSubtableHeader
return_trace (c->check_struct (this));
}
- USHORT indexFormat;
- USHORT imageFormat;
- ULONG imageDataOffset;
+ UINT16 indexFormat;
+ UINT16 imageFormat;
+ UINT32 imageDataOffset;
DEFINE_SIZE_STATIC(8);
};
@@ -137,8 +137,8 @@ struct IndexSubtableFormat1Or3
DEFINE_SIZE_ARRAY(8, offsetArrayZ);
};
-struct IndexSubtableFormat1 : IndexSubtableFormat1Or3<ULONG> {};
-struct IndexSubtableFormat3 : IndexSubtableFormat1Or3<USHORT> {};
+struct IndexSubtableFormat1 : IndexSubtableFormat1Or3<UINT32> {};
+struct IndexSubtableFormat3 : IndexSubtableFormat1Or3<UINT16> {};
struct IndexSubtable
{
@@ -214,9 +214,9 @@ struct IndexSubtableRecord
offset, length, format);
}
- USHORT firstGlyphIndex;
- USHORT lastGlyphIndex;
- OffsetTo<IndexSubtable, ULONG> offsetToSubtable;
+ UINT16 firstGlyphIndex;
+ UINT16 lastGlyphIndex;
+ LOffsetTo<IndexSubtable> offsetToSubtable;
DEFINE_SIZE_STATIC(8);
};
@@ -245,7 +245,7 @@ struct IndexSubtableArray
return &indexSubtablesZ[i];
}
}
- return NULL;
+ return nullptr;
}
protected:
@@ -275,20 +275,20 @@ struct BitmapSizeTable
}
protected:
- OffsetTo<IndexSubtableArray, ULONG> indexSubtableArrayOffset;
- ULONG indexTablesSize;
- ULONG numberOfIndexSubtables;
- ULONG colorRef;
+ LOffsetTo<IndexSubtableArray> indexSubtableArrayOffset;
+ UINT32 indexTablesSize;
+ UINT32 numberOfIndexSubtables;
+ UINT32 colorRef;
SBitLineMetrics horizontal;
SBitLineMetrics vertical;
- USHORT startGlyphIndex;
- USHORT endGlyphIndex;
- BYTE ppemX;
- BYTE ppemY;
- BYTE bitDepth;
- CHAR flags;
-
-public:
+ UINT16 startGlyphIndex;
+ UINT16 endGlyphIndex;
+ UINT8 ppemX;
+ UINT8 ppemY;
+ UINT8 bitDepth;
+ INT8 flags;
+
+ public:
DEFINE_SIZE_STATIC(48);
};
@@ -300,8 +300,8 @@ public:
struct GlyphBitmapDataFormat17
{
SmallGlyphMetrics glyphMetrics;
- ULONG dataLen;
- BYTE dataZ[VAR];
+ UINT32 dataLen;
+ UINT8 dataZ[VAR];
DEFINE_SIZE_ARRAY(9, dataZ);
};
@@ -315,6 +315,8 @@ struct GlyphBitmapDataFormat17
struct CBLC
{
+ friend struct CBDT;
+
static const hb_tag_t tableTag = HB_OT_TAG_CBLC;
inline bool sanitize (hb_sanitize_context_t *c) const
@@ -325,7 +327,7 @@ struct CBLC
sizeTables.sanitize (c, this));
}
- public:
+ protected:
const IndexSubtableRecord *find_table (hb_codepoint_t glyph,
unsigned int *x_ppem, unsigned int *y_ppem) const
{
@@ -344,12 +346,12 @@ struct CBLC
}
}
- return NULL;
+ return nullptr;
}
protected:
- FixedVersion<>version;
- ArrayOf<BitmapSizeTable, ULONG> sizeTables;
+ FixedVersion<> version;
+ LArrayOf<BitmapSizeTable> sizeTables;
public:
DEFINE_SIZE_ARRAY(8, sizeTables);
@@ -371,9 +373,94 @@ struct CBDT
likely (version.major == 2 || version.major == 3));
}
+ struct accelerator_t
+ {
+ inline void init (hb_face_t *face)
+ {
+ upem = face->get_upem();
+
+ cblc_blob = Sanitizer<CBLC>::sanitize (face->reference_table (HB_OT_TAG_CBLC));
+ cbdt_blob = Sanitizer<CBDT>::sanitize (face->reference_table (HB_OT_TAG_CBDT));
+ cbdt_len = hb_blob_get_length (cbdt_blob);
+
+ if (hb_blob_get_length (cblc_blob) == 0) {
+ cblc = nullptr;
+ cbdt = nullptr;
+ return; /* Not a bitmap font. */
+ }
+ cblc = Sanitizer<CBLC>::lock_instance (cblc_blob);
+ cbdt = Sanitizer<CBDT>::lock_instance (cbdt_blob);
+
+ }
+
+ inline void fini (void)
+ {
+ hb_blob_destroy (this->cblc_blob);
+ hb_blob_destroy (this->cbdt_blob);
+ }
+
+ inline bool get_extents (hb_codepoint_t glyph, hb_glyph_extents_t *extents) const
+ {
+ unsigned int x_ppem = upem, y_ppem = upem; /* TODO Use font ppem if available. */
+
+ if (!cblc)
+ return false; // Not a color bitmap font.
+
+ const IndexSubtableRecord *subtable_record = this->cblc->find_table(glyph, &x_ppem, &y_ppem);
+ if (!subtable_record || !x_ppem || !y_ppem)
+ return false;
+
+ if (subtable_record->get_extents (extents))
+ return true;
+
+ unsigned int image_offset = 0, image_length = 0, image_format = 0;
+ if (!subtable_record->get_image_data (glyph, &image_offset, &image_length, &image_format))
+ return false;
+
+ {
+ if (unlikely (image_offset > cbdt_len || cbdt_len - image_offset < image_length))
+ return false;
+
+ switch (image_format)
+ {
+ case 17: {
+ if (unlikely (image_length < GlyphBitmapDataFormat17::min_size))
+ return false;
+
+ const GlyphBitmapDataFormat17& glyphFormat17 =
+ StructAtOffset<GlyphBitmapDataFormat17> (this->cbdt, image_offset);
+ glyphFormat17.glyphMetrics.get_extents (extents);
+ }
+ break;
+ default:
+ // TODO: Support other image formats.
+ return false;
+ }
+ }
+
+ /* Convert to the font units. */
+ extents->x_bearing *= upem / (float) x_ppem;
+ extents->y_bearing *= upem / (float) y_ppem;
+ extents->width *= upem / (float) x_ppem;
+ extents->height *= upem / (float) y_ppem;
+
+ return true;
+ }
+
+ private:
+ hb_blob_t *cblc_blob;
+ hb_blob_t *cbdt_blob;
+ const CBLC *cblc;
+ const CBDT *cbdt;
+
+ unsigned int cbdt_len;
+ unsigned int upem;
+ };
+
+
protected:
FixedVersion<>version;
- BYTE dataZ[VAR];
+ UINT8 dataZ[VAR];
public:
DEFINE_SIZE_ARRAY(4, dataZ);
diff --git a/src/3rdparty/harfbuzz-ng/src/hb-ot-cmap-table.hh b/src/3rdparty/harfbuzz-ng/src/hb-ot-cmap-table.hh
index d7a94a1ef0..883d7b3f0b 100644
--- a/src/3rdparty/harfbuzz-ng/src/hb-ot-cmap-table.hh
+++ b/src/3rdparty/harfbuzz-ng/src/hb-ot-cmap-table.hh
@@ -58,10 +58,10 @@ struct CmapSubtableFormat0
}
protected:
- USHORT format; /* Format number is set to 0. */
- USHORT lengthZ; /* Byte length of this subtable. */
- USHORT languageZ; /* Ignore. */
- BYTE glyphIdArray[256];/* An array that maps character
+ UINT16 format; /* Format number is set to 0. */
+ UINT16 lengthZ; /* Byte length of this subtable. */
+ UINT16 languageZ; /* Ignore. */
+ UINT8 glyphIdArray[256];/* An array that maps character
* code to glyph index values. */
public:
DEFINE_SIZE_STATIC (6 + 256);
@@ -88,8 +88,8 @@ struct CmapSubtableFormat4
/* Custom two-array bsearch. */
int min = 0, max = (int) thiz->segCount - 1;
- const USHORT *startCount = thiz->startCount;
- const USHORT *endCount = thiz->endCount;
+ const UINT16 *startCount = thiz->startCount;
+ const UINT16 *endCount = thiz->endCount;
unsigned int i;
while (min <= max)
{
@@ -127,11 +127,11 @@ struct CmapSubtableFormat4
return true;
}
- const USHORT *endCount;
- const USHORT *startCount;
- const USHORT *idDelta;
- const USHORT *idRangeOffset;
- const USHORT *glyphIdArray;
+ const UINT16 *endCount;
+ const UINT16 *startCount;
+ const UINT16 *idDelta;
+ const UINT16 *idRangeOffset;
+ const UINT16 *glyphIdArray;
unsigned int segCount;
unsigned int glyphIdArrayLength;
};
@@ -165,24 +165,24 @@ struct CmapSubtableFormat4
}
protected:
- USHORT format; /* Format number is set to 4. */
- USHORT length; /* This is the length in bytes of the
+ UINT16 format; /* Format number is set to 4. */
+ UINT16 length; /* This is the length in bytes of the
* subtable. */
- USHORT languageZ; /* Ignore. */
- USHORT segCountX2; /* 2 x segCount. */
- USHORT searchRangeZ; /* 2 * (2**floor(log2(segCount))) */
- USHORT entrySelectorZ; /* log2(searchRange/2) */
- USHORT rangeShiftZ; /* 2 x segCount - searchRange */
+ UINT16 languageZ; /* Ignore. */
+ UINT16 segCountX2; /* 2 x segCount. */
+ UINT16 searchRangeZ; /* 2 * (2**floor(log2(segCount))) */
+ UINT16 entrySelectorZ; /* log2(searchRange/2) */
+ UINT16 rangeShiftZ; /* 2 x segCount - searchRange */
- USHORT values[VAR];
+ UINT16 values[VAR];
#if 0
- USHORT endCount[segCount]; /* End characterCode for each segment,
+ UINT16 endCount[segCount]; /* End characterCode for each segment,
* last=0xFFFFu. */
- USHORT reservedPad; /* Set to 0. */
- USHORT startCount[segCount]; /* Start character code for each segment. */
- SHORT idDelta[segCount]; /* Delta for all character codes in segment. */
- USHORT idRangeOffset[segCount];/* Offsets into glyphIdArray or 0 */
- USHORT glyphIdArray[VAR]; /* Glyph index array (arbitrary length) */
+ UINT16 reservedPad; /* Set to 0. */
+ UINT16 startCount[segCount]; /* Start character code for each segment. */
+ INT16 idDelta[segCount]; /* Delta for all character codes in segment. */
+ UINT16 idRangeOffset[segCount];/* Offsets into glyphIdArray or 0 */
+ UINT16 glyphIdArray[VAR]; /* Glyph index array (arbitrary length) */
#endif
public:
@@ -208,9 +208,9 @@ struct CmapSubtableLongGroup
}
private:
- ULONG startCharCode; /* First character code in this group. */
- ULONG endCharCode; /* Last character code in this group. */
- ULONG glyphID; /* Glyph index; interpretation depends on
+ UINT32 startCharCode; /* First character code in this group. */
+ UINT32 endCharCode; /* Last character code in this group. */
+ UINT32 glyphID; /* Glyph index; interpretation depends on
* subtable format. */
public:
DEFINE_SIZE_STATIC (12);
@@ -247,8 +247,8 @@ struct CmapSubtableTrimmed
DEFINE_SIZE_ARRAY (5 * sizeof (UINT), glyphIdArray);
};
-struct CmapSubtableFormat6 : CmapSubtableTrimmed<USHORT> {};
-struct CmapSubtableFormat10 : CmapSubtableTrimmed<ULONG > {};
+struct CmapSubtableFormat6 : CmapSubtableTrimmed<UINT16> {};
+struct CmapSubtableFormat10 : CmapSubtableTrimmed<UINT32 > {};
template <typename T>
struct CmapSubtableLongSegmented
@@ -269,11 +269,11 @@ struct CmapSubtableLongSegmented
}
protected:
- USHORT format; /* Subtable format; set to 12. */
- USHORT reservedZ; /* Reserved; set to 0. */
- ULONG lengthZ; /* Byte length of this subtable. */
- ULONG languageZ; /* Ignore. */
- SortedArrayOf<CmapSubtableLongGroup, ULONG>
+ UINT16 format; /* Subtable format; set to 12. */
+ UINT16 reservedZ; /* Reserved; set to 0. */
+ UINT32 lengthZ; /* Byte length of this subtable. */
+ UINT32 languageZ; /* Ignore. */
+ SortedArrayOf<CmapSubtableLongGroup, UINT32>
groups; /* Groupings. */
public:
DEFINE_SIZE_ARRAY (16, groups);
@@ -316,13 +316,13 @@ struct UnicodeValueRange
}
UINT24 startUnicodeValue; /* First value in this range. */
- BYTE additionalCount; /* Number of additional values in this
+ UINT8 additionalCount; /* Number of additional values in this
* range. */
public:
DEFINE_SIZE_STATIC (4);
};
-typedef SortedArrayOf<UnicodeValueRange, ULONG> DefaultUVS;
+typedef SortedArrayOf<UnicodeValueRange, UINT32> DefaultUVS;
struct UVSMapping
{
@@ -343,7 +343,7 @@ struct UVSMapping
DEFINE_SIZE_STATIC (5);
};
-typedef SortedArrayOf<UVSMapping, ULONG> NonDefaultUVS;
+typedef SortedArrayOf<UVSMapping, UINT32> NonDefaultUVS;
struct VariationSelectorRecord
{
@@ -380,9 +380,9 @@ struct VariationSelectorRecord
}
UINT24 varSelector; /* Variation selector. */
- OffsetTo<DefaultUVS, ULONG>
+ LOffsetTo<DefaultUVS>
defaultUVS; /* Offset to Default UVS Table. May be 0. */
- OffsetTo<NonDefaultUVS, ULONG>
+ LOffsetTo<NonDefaultUVS>
nonDefaultUVS; /* Offset to Non-Default UVS Table. May be 0. */
public:
DEFINE_SIZE_STATIC (11);
@@ -405,9 +405,9 @@ struct CmapSubtableFormat14
}
protected:
- USHORT format; /* Format number is set to 14. */
- ULONG lengthZ; /* Byte length of this subtable. */
- SortedArrayOf<VariationSelectorRecord, ULONG>
+ UINT16 format; /* Format number is set to 14. */
+ UINT32 lengthZ; /* Byte length of this subtable. */
+ SortedArrayOf<VariationSelectorRecord, UINT32>
record; /* Variation selector records; sorted
* in increasing order of `varSelector'. */
public:
@@ -451,7 +451,7 @@ struct CmapSubtable
public:
union {
- USHORT format; /* Format identifier */
+ UINT16 format; /* Format identifier */
CmapSubtableFormat0 format0;
CmapSubtableFormat4 format4;
CmapSubtableFormat6 format6;
@@ -484,9 +484,9 @@ struct EncodingRecord
subtable.sanitize (c, base));
}
- USHORT platformID; /* Platform ID. */
- USHORT encodingID; /* Platform-specific encoding ID. */
- OffsetTo<CmapSubtable, ULONG>
+ UINT16 platformID; /* Platform ID. */
+ UINT16 encodingID; /* Platform-specific encoding ID. */
+ LOffsetTo<CmapSubtable>
subtable; /* Byte offset from beginning of table to the subtable for this encoding. */
public:
DEFINE_SIZE_STATIC (8);
@@ -496,6 +496,146 @@ struct cmap
{
static const hb_tag_t tableTag = HB_OT_TAG_cmap;
+ inline bool sanitize (hb_sanitize_context_t *c) const
+ {
+ TRACE_SANITIZE (this);
+ return_trace (c->check_struct (this) &&
+ likely (version == 0) &&
+ encodingRecord.sanitize (c, this));
+ }
+
+ struct accelerator_t
+ {
+ inline void init (hb_face_t *face)
+ {
+ this->blob = OT::Sanitizer<OT::cmap>::sanitize (face->reference_table (HB_OT_TAG_cmap));
+ const OT::cmap *cmap = OT::Sanitizer<OT::cmap>::lock_instance (this->blob);
+ const OT::CmapSubtable *subtable = nullptr;
+ const OT::CmapSubtableFormat14 *subtable_uvs = nullptr;
+
+ bool symbol = false;
+ /* 32-bit subtables. */
+ if (!subtable) subtable = cmap->find_subtable (3, 10);
+ if (!subtable) subtable = cmap->find_subtable (0, 6);
+ if (!subtable) subtable = cmap->find_subtable (0, 4);
+ /* 16-bit subtables. */
+ if (!subtable) subtable = cmap->find_subtable (3, 1);
+ if (!subtable) subtable = cmap->find_subtable (0, 3);
+ if (!subtable) subtable = cmap->find_subtable (0, 2);
+ if (!subtable) subtable = cmap->find_subtable (0, 1);
+ if (!subtable) subtable = cmap->find_subtable (0, 0);
+ if (!subtable)
+ {
+ subtable = cmap->find_subtable (3, 0);
+ if (subtable) symbol = true;
+ }
+ /* Meh. */
+ if (!subtable) subtable = &OT::Null(OT::CmapSubtable);
+
+ /* UVS subtable. */
+ if (!subtable_uvs)
+ {
+ const OT::CmapSubtable *st = cmap->find_subtable (0, 5);
+ if (st && st->u.format == 14)
+ subtable_uvs = &st->u.format14;
+ }
+ /* Meh. */
+ if (!subtable_uvs) subtable_uvs = &OT::Null(OT::CmapSubtableFormat14);
+
+ this->uvs_table = subtable_uvs;
+
+ this->get_glyph_data = subtable;
+ if (unlikely (symbol))
+ this->get_glyph_func = get_glyph_from_symbol<OT::CmapSubtable>;
+ else
+ switch (subtable->u.format) {
+ /* Accelerate format 4 and format 12. */
+ default: this->get_glyph_func = get_glyph_from<OT::CmapSubtable>; break;
+ case 12: this->get_glyph_func = get_glyph_from<OT::CmapSubtableFormat12>; break;
+ case 4:
+ {
+ this->format4_accel.init (&subtable->u.format4);
+ this->get_glyph_data = &this->format4_accel;
+ this->get_glyph_func = this->format4_accel.get_glyph_func;
+ }
+ break;
+ }
+ }
+
+ inline void fini (void)
+ {
+ hb_blob_destroy (this->blob);
+ }
+
+ inline bool get_nominal_glyph (hb_codepoint_t unicode,
+ hb_codepoint_t *glyph) const
+ {
+ return this->get_glyph_func (this->get_glyph_data, unicode, glyph);
+ }
+
+ inline bool get_variation_glyph (hb_codepoint_t unicode,
+ hb_codepoint_t variation_selector,
+ hb_codepoint_t *glyph) const
+ {
+ switch (this->uvs_table->get_glyph_variant (unicode,
+ variation_selector,
+ glyph))
+ {
+ case OT::GLYPH_VARIANT_NOT_FOUND: return false;
+ case OT::GLYPH_VARIANT_FOUND: return true;
+ case OT::GLYPH_VARIANT_USE_DEFAULT: break;
+ }
+
+ return get_nominal_glyph (unicode, glyph);
+ }
+
+ protected:
+ typedef bool (*hb_cmap_get_glyph_func_t) (const void *obj,
+ hb_codepoint_t codepoint,
+ hb_codepoint_t *glyph);
+
+ template <typename Type>
+ static inline bool get_glyph_from (const void *obj,
+ hb_codepoint_t codepoint,
+ hb_codepoint_t *glyph)
+ {
+ const Type *typed_obj = (const Type *) obj;
+ return typed_obj->get_glyph (codepoint, glyph);
+ }
+
+ template <typename Type>
+ static inline bool get_glyph_from_symbol (const void *obj,
+ hb_codepoint_t codepoint,
+ hb_codepoint_t *glyph)
+ {
+ const Type *typed_obj = (const Type *) obj;
+ if (likely (typed_obj->get_glyph (codepoint, glyph)))
+ return true;
+
+ if (codepoint <= 0x00FFu)
+ {
+ /* For symbol-encoded OpenType fonts, we duplicate the
+ * U+F000..F0FF range at U+0000..U+00FF. That's what
+ * Windows seems to do, and that's hinted about at:
+ * http://www.microsoft.com/typography/otspec/recom.htm
+ * under "Non-Standard (Symbol) Fonts". */
+ return typed_obj->get_glyph (0xF000u + codepoint, glyph);
+ }
+
+ return false;
+ }
+
+ private:
+ hb_cmap_get_glyph_func_t get_glyph_func;
+ const void *get_glyph_data;
+ OT::CmapSubtableFormat4::accelerator_t format4_accel;
+
+ const OT::CmapSubtableFormat14 *uvs_table;
+ hb_blob_t *blob;
+ };
+
+ protected:
+
inline const CmapSubtable *find_subtable (unsigned int platform_id,
unsigned int encoding_id) const
{
@@ -508,20 +648,13 @@ struct cmap
* unsorted subtable list. */
int result = encodingRecord./*bsearch*/lsearch (key);
if (result == -1 || !encodingRecord[result].subtable)
- return NULL;
+ return nullptr;
return &(this+encodingRecord[result].subtable);
}
- inline bool sanitize (hb_sanitize_context_t *c) const
- {
- TRACE_SANITIZE (this);
- return_trace (c->check_struct (this) &&
- likely (version == 0) &&
- encodingRecord.sanitize (c, this));
- }
-
- USHORT version; /* Table version number (0). */
+ protected:
+ UINT16 version; /* Table version number (0). */
SortedArrayOf<EncodingRecord>
encodingRecord; /* Encoding tables. */
public:
diff --git a/src/3rdparty/harfbuzz-ng/src/hb-ot-font.cc b/src/3rdparty/harfbuzz-ng/src/hb-ot-font.cc
index 5be055d344..9864064b11 100644
--- a/src/3rdparty/harfbuzz-ng/src/hb-ot-font.cc
+++ b/src/3rdparty/harfbuzz-ng/src/hb-ot-font.cc
@@ -33,443 +33,20 @@
#include "hb-ot-cmap-table.hh"
#include "hb-ot-cbdt-table.hh"
#include "hb-ot-glyf-table.hh"
-#include "hb-ot-head-table.hh"
-#include "hb-ot-hhea-table.hh"
#include "hb-ot-hmtx-table.hh"
-#include "hb-ot-os2-table.hh"
-//#include "hb-ot-post-table.hh"
+#include "hb-ot-kern-table.hh"
+#include "hb-ot-post-table.hh"
-struct hb_ot_face_metrics_accelerator_t
-{
- unsigned int num_metrics;
- unsigned int num_advances;
- unsigned int default_advance;
- unsigned short ascender;
- unsigned short descender;
- unsigned short line_gap;
- bool has_font_extents;
-
- const OT::_mtx *table;
- hb_blob_t *blob;
-
- inline void init (hb_face_t *face,
- hb_tag_t _hea_tag,
- hb_tag_t _mtx_tag,
- hb_tag_t os2_tag,
- unsigned int default_advance = 0)
- {
- this->default_advance = default_advance ? default_advance : face->get_upem ();
-
- bool got_font_extents = false;
- if (os2_tag)
- {
- hb_blob_t *os2_blob = OT::Sanitizer<OT::os2>::sanitize (face->reference_table (os2_tag));
- const OT::os2 *os2 = OT::Sanitizer<OT::os2>::lock_instance (os2_blob);
-#define USE_TYPO_METRICS (1u<<7)
- if (0 != (os2->fsSelection & USE_TYPO_METRICS))
- {
- this->ascender = os2->sTypoAscender;
- this->descender = os2->sTypoDescender;
- this->line_gap = os2->sTypoLineGap;
- got_font_extents = (this->ascender | this->descender) != 0;
- }
- hb_blob_destroy (os2_blob);
- }
-
- hb_blob_t *_hea_blob = OT::Sanitizer<OT::_hea>::sanitize (face->reference_table (_hea_tag));
- const OT::_hea *_hea = OT::Sanitizer<OT::_hea>::lock_instance (_hea_blob);
- this->num_advances = _hea->numberOfLongMetrics;
- if (!got_font_extents)
- {
- this->ascender = _hea->ascender;
- this->descender = _hea->descender;
- this->line_gap = _hea->lineGap;
- got_font_extents = (this->ascender | this->descender) != 0;
- }
- hb_blob_destroy (_hea_blob);
-
- this->has_font_extents = got_font_extents;
-
- this->blob = OT::Sanitizer<OT::_mtx>::sanitize (face->reference_table (_mtx_tag));
-
- /* Cap num_metrics() and num_advances() based on table length. */
- unsigned int len = hb_blob_get_length (this->blob);
- if (unlikely (this->num_advances * 4 > len))
- this->num_advances = len / 4;
- this->num_metrics = this->num_advances + (len - 4 * this->num_advances) / 2;
-
- /* We MUST set num_metrics to zero if num_advances is zero.
- * Our get_advance() depends on that. */
- if (unlikely (!this->num_advances))
- {
- this->num_metrics = this->num_advances = 0;
- hb_blob_destroy (this->blob);
- this->blob = hb_blob_get_empty ();
- }
- this->table = OT::Sanitizer<OT::_mtx>::lock_instance (this->blob);
- }
-
- inline void fini (void)
- {
- hb_blob_destroy (this->blob);
- }
-
- inline unsigned int get_advance (hb_codepoint_t glyph) const
- {
- if (unlikely (glyph >= this->num_metrics))
- {
- /* If this->num_metrics is zero, it means we don't have the metrics table
- * for this direction: return default advance. Otherwise, it means that the
- * glyph index is out of bound: return zero. */
- if (this->num_metrics)
- return 0;
- else
- return this->default_advance;
- }
-
- if (glyph >= this->num_advances)
- glyph = this->num_advances - 1;
-
- return this->table->longMetric[glyph].advance;
- }
-};
-
-struct hb_ot_face_glyf_accelerator_t
-{
- bool short_offset;
- unsigned int num_glyphs;
- const OT::loca *loca;
- const OT::glyf *glyf;
- hb_blob_t *loca_blob;
- hb_blob_t *glyf_blob;
- unsigned int glyf_len;
-
- inline void init (hb_face_t *face)
- {
- hb_blob_t *head_blob = OT::Sanitizer<OT::head>::sanitize (face->reference_table (HB_OT_TAG_head));
- const OT::head *head = OT::Sanitizer<OT::head>::lock_instance (head_blob);
- if ((unsigned int) head->indexToLocFormat > 1 || head->glyphDataFormat != 0)
- {
- /* Unknown format. Leave num_glyphs=0, that takes care of disabling us. */
- hb_blob_destroy (head_blob);
- return;
- }
- this->short_offset = 0 == head->indexToLocFormat;
- hb_blob_destroy (head_blob);
-
- this->loca_blob = OT::Sanitizer<OT::loca>::sanitize (face->reference_table (HB_OT_TAG_loca));
- this->loca = OT::Sanitizer<OT::loca>::lock_instance (this->loca_blob);
- this->glyf_blob = OT::Sanitizer<OT::glyf>::sanitize (face->reference_table (HB_OT_TAG_glyf));
- this->glyf = OT::Sanitizer<OT::glyf>::lock_instance (this->glyf_blob);
-
- this->num_glyphs = MAX (1u, hb_blob_get_length (this->loca_blob) / (this->short_offset ? 2 : 4)) - 1;
- this->glyf_len = hb_blob_get_length (this->glyf_blob);
- }
-
- inline void fini (void)
- {
- hb_blob_destroy (this->loca_blob);
- hb_blob_destroy (this->glyf_blob);
- }
-
- inline bool get_extents (hb_codepoint_t glyph,
- hb_glyph_extents_t *extents) const
- {
- if (unlikely (glyph >= this->num_glyphs))
- return false;
-
- unsigned int start_offset, end_offset;
- if (this->short_offset)
- {
- start_offset = 2 * this->loca->u.shortsZ[glyph];
- end_offset = 2 * this->loca->u.shortsZ[glyph + 1];
- }
- else
- {
- start_offset = this->loca->u.longsZ[glyph];
- end_offset = this->loca->u.longsZ[glyph + 1];
- }
-
- if (start_offset > end_offset || end_offset > this->glyf_len)
- return false;
-
- if (end_offset - start_offset < OT::glyfGlyphHeader::static_size)
- return true; /* Empty glyph; zero extents. */
-
- const OT::glyfGlyphHeader &glyph_header = OT::StructAtOffset<OT::glyfGlyphHeader> (this->glyf, start_offset);
-
- extents->x_bearing = MIN (glyph_header.xMin, glyph_header.xMax);
- extents->y_bearing = MAX (glyph_header.yMin, glyph_header.yMax);
- extents->width = MAX (glyph_header.xMin, glyph_header.xMax) - extents->x_bearing;
- extents->height = MIN (glyph_header.yMin, glyph_header.yMax) - extents->y_bearing;
-
- return true;
- }
-};
-
-struct hb_ot_face_cbdt_accelerator_t
-{
- hb_blob_t *cblc_blob;
- hb_blob_t *cbdt_blob;
- const OT::CBLC *cblc;
- const OT::CBDT *cbdt;
-
- unsigned int cbdt_len;
- float upem;
-
- inline void init (hb_face_t *face)
- {
- upem = face->get_upem();
-
- cblc_blob = OT::Sanitizer<OT::CBLC>::sanitize (face->reference_table (HB_OT_TAG_CBLC));
- cbdt_blob = OT::Sanitizer<OT::CBDT>::sanitize (face->reference_table (HB_OT_TAG_CBDT));
- cbdt_len = hb_blob_get_length (cbdt_blob);
-
- if (hb_blob_get_length (cblc_blob) == 0) {
- cblc = NULL;
- cbdt = NULL;
- return; /* Not a bitmap font. */
- }
- cblc = OT::Sanitizer<OT::CBLC>::lock_instance (cblc_blob);
- cbdt = OT::Sanitizer<OT::CBDT>::lock_instance (cbdt_blob);
-
- }
-
- inline void fini (void)
- {
- hb_blob_destroy (this->cblc_blob);
- hb_blob_destroy (this->cbdt_blob);
- }
-
- inline bool get_extents (hb_codepoint_t glyph, hb_glyph_extents_t *extents) const
- {
- unsigned int x_ppem = upem, y_ppem = upem; /* TODO Use font ppem if available. */
-
- if (cblc == NULL)
- return false; // Not a color bitmap font.
-
- const OT::IndexSubtableRecord *subtable_record = this->cblc->find_table(glyph, &x_ppem, &y_ppem);
- if (subtable_record == NULL)
- return false;
-
- if (subtable_record->get_extents (extents))
- return true;
-
- unsigned int image_offset = 0, image_length = 0, image_format = 0;
- if (!subtable_record->get_image_data (glyph, &image_offset, &image_length, &image_format))
- return false;
-
- {
- /* TODO Move the following into CBDT struct when adding more formats. */
-
- if (unlikely (image_offset > cbdt_len || cbdt_len - image_offset < image_length))
- return false;
-
- switch (image_format)
- {
- case 17: {
- if (unlikely (image_length < OT::GlyphBitmapDataFormat17::min_size))
- return false;
-
- const OT::GlyphBitmapDataFormat17& glyphFormat17 =
- OT::StructAtOffset<OT::GlyphBitmapDataFormat17> (this->cbdt, image_offset);
- glyphFormat17.glyphMetrics.get_extents (extents);
- }
- break;
- default:
- // TODO: Support other image formats.
- return false;
- }
- }
-
- /* Convert to the font units. */
- extents->x_bearing *= upem / (float) x_ppem;
- extents->y_bearing *= upem / (float) y_ppem;
- extents->width *= upem / (float) x_ppem;
- extents->height *= upem / (float) y_ppem;
-
- return true;
- }
-};
-
-typedef bool (*hb_cmap_get_glyph_func_t) (const void *obj,
- hb_codepoint_t codepoint,
- hb_codepoint_t *glyph);
-
-template <typename Type>
-static inline bool get_glyph_from (const void *obj,
- hb_codepoint_t codepoint,
- hb_codepoint_t *glyph)
-{
- const Type *typed_obj = (const Type *) obj;
- return typed_obj->get_glyph (codepoint, glyph);
-}
-
-template <typename Type>
-static inline bool get_glyph_from_symbol (const void *obj,
- hb_codepoint_t codepoint,
- hb_codepoint_t *glyph)
-{
- const Type *typed_obj = (const Type *) obj;
- if (likely (typed_obj->get_glyph (codepoint, glyph)))
- return true;
-
- if (codepoint <= 0x00FFu)
- {
- /* For symbol-encoded OpenType fonts, we duplicate the
- * U+F000..F0FF range at U+0000..U+00FF. That's what
- * Windows seems to do, and that's hinted about at:
- * http://www.microsoft.com/typography/otspec/recom.htm
- * under "Non-Standard (Symbol) Fonts". */
- return typed_obj->get_glyph (0xF000u + codepoint, glyph);
- }
-
- return false;
-}
-
-struct hb_ot_face_cmap_accelerator_t
-{
- hb_cmap_get_glyph_func_t get_glyph_func;
- const void *get_glyph_data;
- OT::CmapSubtableFormat4::accelerator_t format4_accel;
-
- const OT::CmapSubtableFormat14 *uvs_table;
- hb_blob_t *blob;
-
- inline void init (hb_face_t *face)
- {
- this->blob = OT::Sanitizer<OT::cmap>::sanitize (face->reference_table (HB_OT_TAG_cmap));
- const OT::cmap *cmap = OT::Sanitizer<OT::cmap>::lock_instance (this->blob);
- const OT::CmapSubtable *subtable = NULL;
- const OT::CmapSubtableFormat14 *subtable_uvs = NULL;
-
- bool symbol = false;
- /* 32-bit subtables. */
- if (!subtable) subtable = cmap->find_subtable (3, 10);
- if (!subtable) subtable = cmap->find_subtable (0, 6);
- if (!subtable) subtable = cmap->find_subtable (0, 4);
- /* 16-bit subtables. */
- if (!subtable) subtable = cmap->find_subtable (3, 1);
- if (!subtable) subtable = cmap->find_subtable (0, 3);
- if (!subtable) subtable = cmap->find_subtable (0, 2);
- if (!subtable) subtable = cmap->find_subtable (0, 1);
- if (!subtable) subtable = cmap->find_subtable (0, 0);
- if (!subtable)
- {
- subtable = cmap->find_subtable (3, 0);
- if (subtable) symbol = true;
- }
- /* Meh. */
- if (!subtable) subtable = &OT::Null(OT::CmapSubtable);
-
- /* UVS subtable. */
- if (!subtable_uvs)
- {
- const OT::CmapSubtable *st = cmap->find_subtable (0, 5);
- if (st && st->u.format == 14)
- subtable_uvs = &st->u.format14;
- }
- /* Meh. */
- if (!subtable_uvs) subtable_uvs = &OT::Null(OT::CmapSubtableFormat14);
-
- this->uvs_table = subtable_uvs;
-
- this->get_glyph_data = subtable;
- if (unlikely (symbol))
- this->get_glyph_func = get_glyph_from_symbol<OT::CmapSubtable>;
- else
- switch (subtable->u.format) {
- /* Accelerate format 4 and format 12. */
- default: this->get_glyph_func = get_glyph_from<OT::CmapSubtable>; break;
- case 12: this->get_glyph_func = get_glyph_from<OT::CmapSubtableFormat12>; break;
- case 4:
- {
- this->format4_accel.init (&subtable->u.format4);
- this->get_glyph_data = &this->format4_accel;
- this->get_glyph_func = this->format4_accel.get_glyph_func;
- }
- break;
- }
- }
-
- inline void fini (void)
- {
- hb_blob_destroy (this->blob);
- }
-
- inline bool get_nominal_glyph (hb_codepoint_t unicode,
- hb_codepoint_t *glyph) const
- {
- return this->get_glyph_func (this->get_glyph_data, unicode, glyph);
- }
-
- inline bool get_variation_glyph (hb_codepoint_t unicode,
- hb_codepoint_t variation_selector,
- hb_codepoint_t *glyph) const
- {
- switch (this->uvs_table->get_glyph_variant (unicode,
- variation_selector,
- glyph))
- {
- case OT::GLYPH_VARIANT_NOT_FOUND: return false;
- case OT::GLYPH_VARIANT_FOUND: return true;
- case OT::GLYPH_VARIANT_USE_DEFAULT: break;
- }
-
- return get_nominal_glyph (unicode, glyph);
- }
-};
-
-template <typename T>
-struct hb_lazy_loader_t
-{
- inline void init (hb_face_t *face_)
- {
- face = face_;
- instance = NULL;
- }
-
- inline void fini (void)
- {
- if (instance && instance != &OT::Null(T))
- {
- instance->fini();
- free (instance);
- }
- }
-
- inline const T* operator-> (void) const
- {
- retry:
- T *p = (T *) hb_atomic_ptr_get (&instance);
- if (unlikely (!p))
- {
- p = (T *) calloc (1, sizeof (T));
- if (unlikely (!p))
- return &OT::Null(T);
- p->init (face);
- if (unlikely (!hb_atomic_ptr_cmpexch (const_cast<T **>(&instance), NULL, p)))
- {
- p->fini ();
- goto retry;
- }
- }
- return p;
- }
-
- private:
- hb_face_t *face;
- T *instance;
-};
-
struct hb_ot_font_t
{
- hb_ot_face_cmap_accelerator_t cmap;
- hb_ot_face_metrics_accelerator_t h_metrics;
- hb_ot_face_metrics_accelerator_t v_metrics;
- hb_lazy_loader_t<hb_ot_face_glyf_accelerator_t> glyf;
- hb_lazy_loader_t<hb_ot_face_cbdt_accelerator_t> cbdt;
+ OT::cmap::accelerator_t cmap;
+ OT::hmtx::accelerator_t h_metrics;
+ OT::vmtx::accelerator_t v_metrics;
+ OT::hb_lazy_loader_t<OT::glyf::accelerator_t> glyf;
+ OT::hb_lazy_loader_t<OT::CBDT::accelerator_t> cbdt;
+ OT::hb_lazy_loader_t<OT::post::accelerator_t> post;
+ OT::hb_lazy_loader_t<OT::kern::accelerator_t> kern;
};
@@ -479,26 +56,31 @@ _hb_ot_font_create (hb_face_t *face)
hb_ot_font_t *ot_font = (hb_ot_font_t *) calloc (1, sizeof (hb_ot_font_t));
if (unlikely (!ot_font))
- return NULL;
+ return nullptr;
ot_font->cmap.init (face);
- ot_font->h_metrics.init (face, HB_OT_TAG_hhea, HB_OT_TAG_hmtx, HB_OT_TAG_os2);
- ot_font->v_metrics.init (face, HB_OT_TAG_vhea, HB_OT_TAG_vmtx, HB_TAG_NONE,
- ot_font->h_metrics.ascender - ot_font->h_metrics.descender); /* TODO Can we do this lazily? */
+ ot_font->h_metrics.init (face);
+ ot_font->v_metrics.init (face, ot_font->h_metrics.ascender - ot_font->h_metrics.descender); /* TODO Can we do this lazily? */
ot_font->glyf.init (face);
ot_font->cbdt.init (face);
+ ot_font->post.init (face);
+ ot_font->kern.init (face);
return ot_font;
}
static void
-_hb_ot_font_destroy (hb_ot_font_t *ot_font)
+_hb_ot_font_destroy (void *data)
{
+ hb_ot_font_t *ot_font = (hb_ot_font_t *) data;
+
ot_font->cmap.fini ();
ot_font->h_metrics.fini ();
ot_font->v_metrics.fini ();
ot_font->glyf.fini ();
ot_font->cbdt.fini ();
+ ot_font->post.fini ();
+ ot_font->kern.fini ();
free (ot_font);
}
@@ -529,23 +111,34 @@ hb_ot_get_variation_glyph (hb_font_t *font HB_UNUSED,
}
static hb_position_t
-hb_ot_get_glyph_h_advance (hb_font_t *font HB_UNUSED,
+hb_ot_get_glyph_h_advance (hb_font_t *font,
void *font_data,
hb_codepoint_t glyph,
void *user_data HB_UNUSED)
{
const hb_ot_font_t *ot_font = (const hb_ot_font_t *) font_data;
- return font->em_scale_x (ot_font->h_metrics.get_advance (glyph));
+ return font->em_scale_x (ot_font->h_metrics.get_advance (glyph, font));
}
static hb_position_t
-hb_ot_get_glyph_v_advance (hb_font_t *font HB_UNUSED,
+hb_ot_get_glyph_v_advance (hb_font_t *font,
void *font_data,
hb_codepoint_t glyph,
void *user_data HB_UNUSED)
{
const hb_ot_font_t *ot_font = (const hb_ot_font_t *) font_data;
- return font->em_scale_y (-(int) ot_font->v_metrics.get_advance (glyph));
+ return font->em_scale_y (-(int) ot_font->v_metrics.get_advance (glyph, font));
+}
+
+static hb_position_t
+hb_ot_get_glyph_h_kerning (hb_font_t *font,
+ void *font_data,
+ hb_codepoint_t left_glyph,
+ hb_codepoint_t right_glyph,
+ void *user_data HB_UNUSED)
+{
+ const hb_ot_font_t *ot_font = (const hb_ot_font_t *) font_data;
+ return font->em_scale_x (ot_font->kern->get_h_kerning (left_glyph, right_glyph));
}
static hb_bool_t
@@ -559,6 +152,7 @@ hb_ot_get_glyph_extents (hb_font_t *font HB_UNUSED,
bool ret = ot_font->glyf->get_extents (glyph, extents);
if (!ret)
ret = ot_font->cbdt->get_extents (glyph, extents);
+ // TODO Hook up side-bearings variations.
extents->x_bearing = font->em_scale_x (extents->x_bearing);
extents->y_bearing = font->em_scale_y (extents->y_bearing);
extents->width = font->em_scale_x (extents->width);
@@ -567,6 +161,28 @@ hb_ot_get_glyph_extents (hb_font_t *font HB_UNUSED,
}
static hb_bool_t
+hb_ot_get_glyph_name (hb_font_t *font HB_UNUSED,
+ void *font_data,
+ hb_codepoint_t glyph,
+ char *name, unsigned int size,
+ void *user_data HB_UNUSED)
+{
+ const hb_ot_font_t *ot_font = (const hb_ot_font_t *) font_data;
+ return ot_font->post->get_glyph_name (glyph, name, size);
+}
+
+static hb_bool_t
+hb_ot_get_glyph_from_name (hb_font_t *font HB_UNUSED,
+ void *font_data,
+ const char *name, int len,
+ hb_codepoint_t *glyph,
+ void *user_data HB_UNUSED)
+{
+ const hb_ot_font_t *ot_font = (const hb_ot_font_t *) font_data;
+ return ot_font->post->get_glyph_from_name (name, len, glyph);
+}
+
+static hb_bool_t
hb_ot_get_font_h_extents (hb_font_t *font HB_UNUSED,
void *font_data,
hb_font_extents_t *metrics,
@@ -576,6 +192,7 @@ hb_ot_get_font_h_extents (hb_font_t *font HB_UNUSED,
metrics->ascender = font->em_scale_y (ot_font->h_metrics.ascender);
metrics->descender = font->em_scale_y (ot_font->h_metrics.descender);
metrics->line_gap = font->em_scale_y (ot_font->h_metrics.line_gap);
+ // TODO Hook up variations.
return ot_font->h_metrics.has_font_extents;
}
@@ -589,10 +206,11 @@ hb_ot_get_font_v_extents (hb_font_t *font HB_UNUSED,
metrics->ascender = font->em_scale_x (ot_font->v_metrics.ascender);
metrics->descender = font->em_scale_x (ot_font->v_metrics.descender);
metrics->line_gap = font->em_scale_x (ot_font->v_metrics.line_gap);
+ // TODO Hook up variations.
return ot_font->v_metrics.has_font_extents;
}
-static hb_font_funcs_t *static_ot_funcs = NULL;
+static hb_font_funcs_t *static_ot_funcs = nullptr;
#ifdef HB_USE_ATEXIT
static
@@ -612,24 +230,24 @@ retry:
{
funcs = hb_font_funcs_create ();
- hb_font_funcs_set_font_h_extents_func (funcs, hb_ot_get_font_h_extents, NULL, NULL);
- hb_font_funcs_set_font_v_extents_func (funcs, hb_ot_get_font_v_extents, NULL, NULL);
- hb_font_funcs_set_nominal_glyph_func (funcs, hb_ot_get_nominal_glyph, NULL, NULL);
- hb_font_funcs_set_variation_glyph_func (funcs, hb_ot_get_variation_glyph, NULL, NULL);
- hb_font_funcs_set_glyph_h_advance_func (funcs, hb_ot_get_glyph_h_advance, NULL, NULL);
- hb_font_funcs_set_glyph_v_advance_func (funcs, hb_ot_get_glyph_v_advance, NULL, NULL);
- //hb_font_funcs_set_glyph_h_origin_func (funcs, hb_ot_get_glyph_h_origin, NULL, NULL);
- //hb_font_funcs_set_glyph_v_origin_func (funcs, hb_ot_get_glyph_v_origin, NULL, NULL);
- //hb_font_funcs_set_glyph_h_kerning_func (funcs, hb_ot_get_glyph_h_kerning, NULL, NULL); TODO
- //hb_font_funcs_set_glyph_v_kerning_func (funcs, hb_ot_get_glyph_v_kerning, NULL, NULL);
- hb_font_funcs_set_glyph_extents_func (funcs, hb_ot_get_glyph_extents, NULL, NULL);
- //hb_font_funcs_set_glyph_contour_point_func (funcs, hb_ot_get_glyph_contour_point, NULL, NULL); TODO
- //hb_font_funcs_set_glyph_name_func (funcs, hb_ot_get_glyph_name, NULL, NULL); TODO
- //hb_font_funcs_set_glyph_from_name_func (funcs, hb_ot_get_glyph_from_name, NULL, NULL); TODO
+ hb_font_funcs_set_font_h_extents_func (funcs, hb_ot_get_font_h_extents, nullptr, nullptr);
+ hb_font_funcs_set_font_v_extents_func (funcs, hb_ot_get_font_v_extents, nullptr, nullptr);
+ hb_font_funcs_set_nominal_glyph_func (funcs, hb_ot_get_nominal_glyph, nullptr, nullptr);
+ hb_font_funcs_set_variation_glyph_func (funcs, hb_ot_get_variation_glyph, nullptr, nullptr);
+ hb_font_funcs_set_glyph_h_advance_func (funcs, hb_ot_get_glyph_h_advance, nullptr, nullptr);
+ hb_font_funcs_set_glyph_v_advance_func (funcs, hb_ot_get_glyph_v_advance, nullptr, nullptr);
+ //hb_font_funcs_set_glyph_h_origin_func (funcs, hb_ot_get_glyph_h_origin, nullptr, nullptr);
+ //hb_font_funcs_set_glyph_v_origin_func (funcs, hb_ot_get_glyph_v_origin, nullptr, nullptr);
+ hb_font_funcs_set_glyph_h_kerning_func (funcs, hb_ot_get_glyph_h_kerning, nullptr, nullptr);
+ //hb_font_funcs_set_glyph_v_kerning_func (funcs, hb_ot_get_glyph_v_kerning, nullptr, nullptr);
+ hb_font_funcs_set_glyph_extents_func (funcs, hb_ot_get_glyph_extents, nullptr, nullptr);
+ //hb_font_funcs_set_glyph_contour_point_func (funcs, hb_ot_get_glyph_contour_point, nullptr, nullptr);
+ hb_font_funcs_set_glyph_name_func (funcs, hb_ot_get_glyph_name, nullptr, nullptr);
+ hb_font_funcs_set_glyph_from_name_func (funcs, hb_ot_get_glyph_from_name, nullptr, nullptr);
hb_font_funcs_make_immutable (funcs);
- if (!hb_atomic_ptr_cmpexch (&static_ot_funcs, NULL, funcs)) {
+ if (!hb_atomic_ptr_cmpexch (&static_ot_funcs, nullptr, funcs)) {
hb_font_funcs_destroy (funcs);
goto retry;
}
@@ -658,5 +276,5 @@ hb_ot_font_set_funcs (hb_font_t *font)
hb_font_set_funcs (font,
_hb_ot_get_font_funcs (),
ot_font,
- (hb_destroy_func_t) _hb_ot_font_destroy);
+ _hb_ot_font_destroy);
}
diff --git a/src/3rdparty/harfbuzz-ng/src/hb-ot-glyf-table.hh b/src/3rdparty/harfbuzz-ng/src/hb-ot-glyf-table.hh
index dc7aa8469a..88d3850b6e 100644
--- a/src/3rdparty/harfbuzz-ng/src/hb-ot-glyf-table.hh
+++ b/src/3rdparty/harfbuzz-ng/src/hb-ot-glyf-table.hh
@@ -28,6 +28,7 @@
#define HB_OT_GLYF_TABLE_HH
#include "hb-open-type-private.hh"
+#include "hb-ot-head-table.hh"
namespace OT {
@@ -42,6 +43,8 @@ namespace OT {
struct loca
{
+ friend struct glyf;
+
static const hb_tag_t tableTag = HB_OT_TAG_loca;
inline bool sanitize (hb_sanitize_context_t *c) const
@@ -50,12 +53,9 @@ struct loca
return_trace (true);
}
- public:
- union {
- USHORT shortsZ[VAR]; /* Location offset divided by 2. */
- ULONG longsZ[VAR]; /* Location offset. */
- } u;
- DEFINE_SIZE_ARRAY (0, u.longsZ);
+ protected:
+ UINT8 dataX[VAR]; /* Location data. */
+ DEFINE_SIZE_ARRAY (0, dataX);
};
@@ -78,26 +78,102 @@ struct glyf
return_trace (true);
}
- public:
- BYTE dataX[VAR]; /* Glyphs data. */
+ struct GlyphHeader
+ {
+ INT16 numberOfContours; /* If the number of contours is
+ * greater than or equal to zero,
+ * this is a simple glyph; if negative,
+ * this is a composite glyph. */
+ FWORD xMin; /* Minimum x for coordinate data. */
+ FWORD yMin; /* Minimum y for coordinate data. */
+ FWORD xMax; /* Maximum x for coordinate data. */
+ FWORD yMax; /* Maximum y for coordinate data. */
+
+ DEFINE_SIZE_STATIC (10);
+ };
+
+ struct accelerator_t
+ {
+ inline void init (hb_face_t *face)
+ {
+ hb_blob_t *head_blob = Sanitizer<head>::sanitize (face->reference_table (HB_OT_TAG_head));
+ const head *head_table = Sanitizer<head>::lock_instance (head_blob);
+ if ((unsigned int) head_table->indexToLocFormat > 1 || head_table->glyphDataFormat != 0)
+ {
+ /* Unknown format. Leave num_glyphs=0, that takes care of disabling us. */
+ hb_blob_destroy (head_blob);
+ return;
+ }
+ short_offset = 0 == head_table->indexToLocFormat;
+ hb_blob_destroy (head_blob);
+
+ loca_blob = Sanitizer<loca>::sanitize (face->reference_table (HB_OT_TAG_loca));
+ loca_table = Sanitizer<loca>::lock_instance (loca_blob);
+ glyf_blob = Sanitizer<glyf>::sanitize (face->reference_table (HB_OT_TAG_glyf));
+ glyf_table = Sanitizer<glyf>::lock_instance (glyf_blob);
+
+ num_glyphs = MAX (1u, hb_blob_get_length (loca_blob) / (short_offset ? 2 : 4)) - 1;
+ glyf_len = hb_blob_get_length (glyf_blob);
+ }
+
+ inline void fini (void)
+ {
+ hb_blob_destroy (loca_blob);
+ hb_blob_destroy (glyf_blob);
+ }
+
+ inline bool get_extents (hb_codepoint_t glyph,
+ hb_glyph_extents_t *extents) const
+ {
+ if (unlikely (glyph >= num_glyphs))
+ return false;
+
+ unsigned int start_offset, end_offset;
+ if (short_offset)
+ {
+ const UINT16 *offsets = (const UINT16 *) loca_table->dataX;
+ start_offset = 2 * offsets[glyph];
+ end_offset = 2 * offsets[glyph + 1];
+ }
+ else
+ {
+ const UINT32 *offsets = (const UINT32 *) loca_table->dataX;
+ start_offset = offsets[glyph];
+ end_offset = offsets[glyph + 1];
+ }
+
+ if (start_offset > end_offset || end_offset > glyf_len)
+ return false;
+
+ if (end_offset - start_offset < GlyphHeader::static_size)
+ return true; /* Empty glyph; zero extents. */
+
+ const GlyphHeader &glyph_header = StructAtOffset<GlyphHeader> (glyf_table, start_offset);
+
+ extents->x_bearing = MIN (glyph_header.xMin, glyph_header.xMax);
+ extents->y_bearing = MAX (glyph_header.yMin, glyph_header.yMax);
+ extents->width = MAX (glyph_header.xMin, glyph_header.xMax) - extents->x_bearing;
+ extents->height = MIN (glyph_header.yMin, glyph_header.yMax) - extents->y_bearing;
+
+ return true;
+ }
+
+ private:
+ bool short_offset;
+ unsigned int num_glyphs;
+ const loca *loca_table;
+ const glyf *glyf_table;
+ hb_blob_t *loca_blob;
+ hb_blob_t *glyf_blob;
+ unsigned int glyf_len;
+ };
+
+ protected:
+ UINT8 dataX[VAR]; /* Glyphs data. */
DEFINE_SIZE_ARRAY (0, dataX);
};
-struct glyfGlyphHeader
-{
- SHORT numberOfContours; /* If the number of contours is
- * greater than or equal to zero,
- * this is a simple glyph; if negative,
- * this is a composite glyph. */
- FWORD xMin; /* Minimum x for coordinate data. */
- FWORD yMin; /* Minimum y for coordinate data. */
- FWORD xMax; /* Maximum x for coordinate data. */
- FWORD yMax; /* Maximum y for coordinate data. */
-
- DEFINE_SIZE_STATIC (10);
-};
-
} /* namespace OT */
diff --git a/src/3rdparty/harfbuzz-ng/src/hb-ot-head-table.hh b/src/3rdparty/harfbuzz-ng/src/hb-ot-head-table.hh
index 9c3e51eb08..dd4349ef85 100644
--- a/src/3rdparty/harfbuzz-ng/src/hb-ot-head-table.hh
+++ b/src/3rdparty/harfbuzz-ng/src/hb-ot-head-table.hh
@@ -64,11 +64,11 @@ struct head
FixedVersion<>version; /* Version of the head table--currently
* 0x00010000u for version 1.0. */
FixedVersion<>fontRevision; /* Set by font manufacturer. */
- ULONG checkSumAdjustment; /* To compute: set it to 0, sum the
- * entire font as ULONG, then store
+ UINT32 checkSumAdjustment; /* To compute: set it to 0, sum the
+ * entire font as UINT32, then store
* 0xB1B0AFBAu - sum. */
- ULONG magicNumber; /* Set to 0x5F0F3CF5u. */
- USHORT flags; /* Bit 0: Baseline for font at y=0;
+ UINT32 magicNumber; /* Set to 0x5F0F3CF5u. */
+ UINT16 flags; /* Bit 0: Baseline for font at y=0;
* Bit 1: Left sidebearing point at x=0;
* Bit 2: Instructions may depend on point size;
* Bit 3: Force ppem to integer values for all
@@ -114,18 +114,18 @@ struct head
* encoded in the cmap subtables represent proper
* support for those code points.
* Bit 15: Reserved, set to 0. */
- USHORT unitsPerEm; /* Valid range is from 16 to 16384. This value
+ UINT16 unitsPerEm; /* Valid range is from 16 to 16384. This value
* should be a power of 2 for fonts that have
* TrueType outlines. */
LONGDATETIME created; /* Number of seconds since 12:00 midnight,
January 1, 1904. 64-bit integer */
LONGDATETIME modified; /* Number of seconds since 12:00 midnight,
January 1, 1904. 64-bit integer */
- SHORT xMin; /* For all glyph bounding boxes. */
- SHORT yMin; /* For all glyph bounding boxes. */
- SHORT xMax; /* For all glyph bounding boxes. */
- SHORT yMax; /* For all glyph bounding boxes. */
- USHORT macStyle; /* Bit 0: Bold (if set to 1);
+ INT16 xMin; /* For all glyph bounding boxes. */
+ INT16 yMin; /* For all glyph bounding boxes. */
+ INT16 xMax; /* For all glyph bounding boxes. */
+ INT16 yMax; /* For all glyph bounding boxes. */
+ UINT16 macStyle; /* Bit 0: Bold (if set to 1);
* Bit 1: Italic (if set to 1)
* Bit 2: Underline (if set to 1)
* Bit 3: Outline (if set to 1)
@@ -133,16 +133,16 @@ struct head
* Bit 5: Condensed (if set to 1)
* Bit 6: Extended (if set to 1)
* Bits 7-15: Reserved (set to 0). */
- USHORT lowestRecPPEM; /* Smallest readable size in pixels. */
- SHORT fontDirectionHint; /* Deprecated (Set to 2).
+ UINT16 lowestRecPPEM; /* Smallest readable size in pixels. */
+ INT16 fontDirectionHint; /* Deprecated (Set to 2).
* 0: Fully mixed directional glyphs;
* 1: Only strongly left to right;
* 2: Like 1 but also contains neutrals;
* -1: Only strongly right to left;
* -2: Like -1 but also contains neutrals. */
public:
- SHORT indexToLocFormat; /* 0 for short offsets, 1 for long. */
- SHORT glyphDataFormat; /* 0 for current format. */
+ INT16 indexToLocFormat; /* 0 for short offsets, 1 for long. */
+ INT16 glyphDataFormat; /* 0 for current format. */
DEFINE_SIZE_STATIC (54);
};
diff --git a/src/3rdparty/harfbuzz-ng/src/hb-ot-hhea-table.hh b/src/3rdparty/harfbuzz-ng/src/hb-ot-hhea-table.hh
index c8e9536cf1..dca014148e 100644
--- a/src/3rdparty/harfbuzz-ng/src/hb-ot-hhea-table.hh
+++ b/src/3rdparty/harfbuzz-ng/src/hb-ot-hhea-table.hh
@@ -44,11 +44,6 @@ namespace OT {
struct _hea
{
- static const hb_tag_t tableTag = HB_TAG('_','h','e','a');
-
- static const hb_tag_t hheaTag = HB_OT_TAG_hhea;
- static const hb_tag_t vheaTag = HB_OT_TAG_vhea;
-
inline bool sanitize (hb_sanitize_context_t *c) const
{
TRACE_SANITIZE (this);
@@ -69,21 +64,21 @@ struct _hea
* (xMax - xMin)) for horizontal. */
FWORD maxExtent; /* horizontal: Max(lsb + (xMax - xMin)),
* vertical: minLeadingBearing+(yMax-yMin). */
- SHORT caretSlopeRise; /* Used to calculate the slope of the
+ INT16 caretSlopeRise; /* Used to calculate the slope of the
* cursor (rise/run); 1 for vertical caret,
* 0 for horizontal.*/
- SHORT caretSlopeRun; /* 0 for vertical caret, 1 for horizontal. */
- SHORT caretOffset; /* The amount by which a slanted
+ INT16 caretSlopeRun; /* 0 for vertical caret, 1 for horizontal. */
+ INT16 caretOffset; /* The amount by which a slanted
* highlight on a glyph needs
* to be shifted to produce the
* best appearance. Set to 0 for
* non-slanted fonts. */
- SHORT reserved1; /* Set to 0. */
- SHORT reserved2; /* Set to 0. */
- SHORT reserved3; /* Set to 0. */
- SHORT reserved4; /* Set to 0. */
- SHORT metricDataFormat; /* 0 for current format. */
- USHORT numberOfLongMetrics; /* Number of LongMetric entries in metric
+ INT16 reserved1; /* Set to 0. */
+ INT16 reserved2; /* Set to 0. */
+ INT16 reserved3; /* Set to 0. */
+ INT16 reserved4; /* Set to 0. */
+ INT16 metricDataFormat; /* 0 for current format. */
+ UINT16 numberOfLongMetrics; /* Number of LongMetric entries in metric
* table. */
public:
DEFINE_SIZE_STATIC (36);
diff --git a/src/3rdparty/harfbuzz-ng/src/hb-ot-hmtx-table.hh b/src/3rdparty/harfbuzz-ng/src/hb-ot-hmtx-table.hh
index a9606b3d27..e710aee42e 100644
--- a/src/3rdparty/harfbuzz-ng/src/hb-ot-hmtx-table.hh
+++ b/src/3rdparty/harfbuzz-ng/src/hb-ot-hmtx-table.hh
@@ -28,6 +28,9 @@
#define HB_OT_HMTX_TABLE_HH
#include "hb-open-type-private.hh"
+#include "hb-ot-hhea-table.hh"
+#include "hb-ot-os2-table.hh"
+#include "hb-ot-var-hvar-table.hh"
namespace OT {
@@ -50,13 +53,9 @@ struct LongMetric
DEFINE_SIZE_STATIC (4);
};
-struct _mtx
+template <typename T>
+struct hmtxvmtx
{
- static const hb_tag_t tableTag = HB_TAG('_','m','t','x');
-
- static const hb_tag_t hmtxTag = HB_OT_TAG_hmtx;
- static const hb_tag_t vmtxTag = HB_OT_TAG_vmtx;
-
inline bool sanitize (hb_sanitize_context_t *c) const
{
TRACE_SANITIZE (this);
@@ -65,7 +64,107 @@ struct _mtx
return_trace (true);
}
- public:
+ struct accelerator_t
+ {
+ inline void init (hb_face_t *face,
+ unsigned int default_advance_ = 0)
+ {
+ default_advance = default_advance_ ? default_advance_ : face->get_upem ();
+
+ bool got_font_extents = false;
+ if (T::os2Tag)
+ {
+ hb_blob_t *os2_blob = Sanitizer<os2>::sanitize (face->reference_table (T::os2Tag));
+ const os2 *os2_table = Sanitizer<os2>::lock_instance (os2_blob);
+#define USE_TYPO_METRICS (1u<<7)
+ if (0 != (os2_table->fsSelection & USE_TYPO_METRICS))
+ {
+ ascender = os2_table->sTypoAscender;
+ descender = os2_table->sTypoDescender;
+ line_gap = os2_table->sTypoLineGap;
+ got_font_extents = (ascender | descender) != 0;
+ }
+ hb_blob_destroy (os2_blob);
+ }
+
+ hb_blob_t *_hea_blob = Sanitizer<_hea>::sanitize (face->reference_table (T::headerTag));
+ const _hea *_hea_table = Sanitizer<_hea>::lock_instance (_hea_blob);
+ num_advances = _hea_table->numberOfLongMetrics;
+ if (!got_font_extents)
+ {
+ ascender = _hea_table->ascender;
+ descender = _hea_table->descender;
+ line_gap = _hea_table->lineGap;
+ got_font_extents = (ascender | descender) != 0;
+ }
+ hb_blob_destroy (_hea_blob);
+
+ has_font_extents = got_font_extents;
+
+ blob = Sanitizer<hmtxvmtx>::sanitize (face->reference_table (T::tableTag));
+
+ /* Cap num_metrics() and num_advances() based on table length. */
+ unsigned int len = hb_blob_get_length (blob);
+ if (unlikely (num_advances * 4 > len))
+ num_advances = len / 4;
+ num_metrics = num_advances + (len - 4 * num_advances) / 2;
+
+ /* We MUST set num_metrics to zero if num_advances is zero.
+ * Our get_advance() depends on that. */
+ if (unlikely (!num_advances))
+ {
+ num_metrics = num_advances = 0;
+ hb_blob_destroy (blob);
+ blob = hb_blob_get_empty ();
+ }
+ table = Sanitizer<hmtxvmtx>::lock_instance (blob);
+
+ var_blob = Sanitizer<HVARVVAR>::sanitize (face->reference_table (T::variationsTag));
+ var_table = Sanitizer<HVARVVAR>::lock_instance (var_blob);
+ }
+
+ inline void fini (void)
+ {
+ hb_blob_destroy (blob);
+ hb_blob_destroy (var_blob);
+ }
+
+ inline unsigned int get_advance (hb_codepoint_t glyph,
+ hb_font_t *font) const
+ {
+ if (unlikely (glyph >= num_metrics))
+ {
+ /* If num_metrics is zero, it means we don't have the metrics table
+ * for this direction: return default advance. Otherwise, it means that the
+ * glyph index is out of bound: return zero. */
+ if (num_metrics)
+ return 0;
+ else
+ return default_advance;
+ }
+
+ return table->longMetric[MIN (glyph, (uint32_t) num_advances - 1)].advance
+ + var_table->get_advance_var (glyph, font->coords, font->num_coords); // TODO Optimize?!
+ }
+
+ public:
+ bool has_font_extents;
+ unsigned short ascender;
+ unsigned short descender;
+ unsigned short line_gap;
+
+ private:
+ unsigned int num_metrics;
+ unsigned int num_advances;
+ unsigned int default_advance;
+
+ const hmtxvmtx *table;
+ hb_blob_t *blob;
+ const HVARVVAR *var_table;
+ hb_blob_t *var_blob;
+ };
+
+ protected:
LongMetric longMetric[VAR]; /* Paired advance width and leading
* bearing values for each glyph. The
* value numOfHMetrics comes from
@@ -91,11 +190,17 @@ struct _mtx
DEFINE_SIZE_ARRAY2 (0, longMetric, leadingBearingX);
};
-struct hmtx : _mtx {
+struct hmtx : hmtxvmtx<hmtx> {
static const hb_tag_t tableTag = HB_OT_TAG_hmtx;
+ static const hb_tag_t headerTag = HB_OT_TAG_hhea;
+ static const hb_tag_t variationsTag = HB_OT_TAG_HVAR;
+ static const hb_tag_t os2Tag = HB_OT_TAG_os2;
};
-struct vmtx : _mtx {
+struct vmtx : hmtxvmtx<vmtx> {
static const hb_tag_t tableTag = HB_OT_TAG_vmtx;
+ static const hb_tag_t headerTag = HB_OT_TAG_vhea;
+ static const hb_tag_t variationsTag = HB_OT_TAG_VVAR;
+ static const hb_tag_t os2Tag = HB_TAG_NONE;
};
} /* namespace OT */
diff --git a/src/3rdparty/harfbuzz-ng/src/hb-ot-kern-table.hh b/src/3rdparty/harfbuzz-ng/src/hb-ot-kern-table.hh
new file mode 100644
index 0000000000..e07faca63f
--- /dev/null
+++ b/src/3rdparty/harfbuzz-ng/src/hb-ot-kern-table.hh
@@ -0,0 +1,394 @@
+/*
+ * Copyright © 2017 Google, Inc.
+ *
+ * This is part of HarfBuzz, a text shaping library.
+ *
+ * Permission is hereby granted, without written agreement and without
+ * license or royalty fees, to use, copy, modify, and distribute this
+ * software and its documentation for any purpose, provided that the
+ * above copyright notice and the following two paragraphs appear in
+ * all copies of this software.
+ *
+ * IN NO EVENT SHALL THE COPYRIGHT HOLDER BE LIABLE TO ANY PARTY FOR
+ * DIRECT, INDIRECT, SPECIAL, INCIDENTAL, OR CONSEQUENTIAL DAMAGES
+ * ARISING OUT OF THE USE OF THIS SOFTWARE AND ITS DOCUMENTATION, EVEN
+ * IF THE COPYRIGHT HOLDER HAS BEEN ADVISED OF THE POSSIBILITY OF SUCH
+ * DAMAGE.
+ *
+ * THE COPYRIGHT HOLDER SPECIFICALLY DISCLAIMS ANY WARRANTIES, INCLUDING,
+ * BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND
+ * FITNESS FOR A PARTICULAR PURPOSE. THE SOFTWARE PROVIDED HEREUNDER IS
+ * ON AN "AS IS" BASIS, AND THE COPYRIGHT HOLDER HAS NO OBLIGATION TO
+ * PROVIDE MAINTENANCE, SUPPORT, UPDATES, ENHANCEMENTS, OR MODIFICATIONS.
+ *
+ * Google Author(s): Behdad Esfahbod
+ */
+
+#ifndef HB_OT_KERN_TABLE_HH
+#define HB_OT_KERN_TABLE_HH
+
+#include "hb-open-type-private.hh"
+
+namespace OT {
+
+
+/*
+ * kern -- Kerning
+ */
+
+#define HB_OT_TAG_kern HB_TAG('k','e','r','n')
+
+struct hb_glyph_pair_t
+{
+ hb_codepoint_t left;
+ hb_codepoint_t right;
+};
+
+struct KernPair
+{
+ inline int get_kerning (void) const
+ { return value; }
+
+ inline int cmp (const hb_glyph_pair_t &o) const
+ {
+ int ret = left.cmp (o.left);
+ if (ret) return ret;
+ return right.cmp (o.right);
+ }
+
+ inline bool sanitize (hb_sanitize_context_t *c) const
+ {
+ TRACE_SANITIZE (this);
+ return_trace (c->check_struct (this));
+ }
+
+ protected:
+ GlyphID left;
+ GlyphID right;
+ FWORD value;
+ public:
+ DEFINE_SIZE_STATIC (6);
+};
+
+struct KernSubTableFormat0
+{
+ inline int get_kerning (hb_codepoint_t left, hb_codepoint_t right) const
+ {
+ hb_glyph_pair_t pair = {left, right};
+ int i = pairs.bsearch (pair);
+ if (i == -1)
+ return 0;
+ return pairs[i].get_kerning ();
+ }
+
+ inline bool sanitize (hb_sanitize_context_t *c) const
+ {
+ TRACE_SANITIZE (this);
+ return_trace (pairs.sanitize (c));
+ }
+
+ protected:
+ BinSearchArrayOf<KernPair> pairs; /* Array of kerning pairs. */
+ public:
+ DEFINE_SIZE_ARRAY (8, pairs);
+};
+
+struct KernClassTable
+{
+ inline unsigned int get_class (hb_codepoint_t g) const { return classes[g - firstGlyph]; }
+
+ inline bool sanitize (hb_sanitize_context_t *c) const
+ {
+ TRACE_SANITIZE (this);
+ return_trace (firstGlyph.sanitize (c) && classes.sanitize (c));
+ }
+
+ protected:
+ UINT16 firstGlyph; /* First glyph in class range. */
+ ArrayOf<UINT16> classes; /* Glyph classes. */
+ public:
+ DEFINE_SIZE_ARRAY (4, classes);
+};
+
+struct KernSubTableFormat2
+{
+ inline int get_kerning (hb_codepoint_t left, hb_codepoint_t right, const char *end) const
+ {
+ unsigned int l = (this+leftClassTable).get_class (left);
+ unsigned int r = (this+leftClassTable).get_class (left);
+ unsigned int offset = l * rowWidth + r * sizeof (FWORD);
+ const FWORD *arr = &(this+array);
+ if (unlikely ((const void *) arr < (const void *) this || (const void *) arr >= (const void *) end))
+ return 0;
+ const FWORD *v = &StructAtOffset<FWORD> (arr, offset);
+ if (unlikely ((const void *) v < (const void *) arr || (const void *) (v + 1) > (const void *) end))
+ return 0;
+ return *v;
+ }
+
+ inline bool sanitize (hb_sanitize_context_t *c) const
+ {
+ TRACE_SANITIZE (this);
+ return_trace (rowWidth.sanitize (c) &&
+ leftClassTable.sanitize (c, this) &&
+ rightClassTable.sanitize (c, this) &&
+ array.sanitize (c, this));
+ }
+
+ protected:
+ UINT16 rowWidth; /* The width, in bytes, of a row in the table. */
+ OffsetTo<KernClassTable>
+ leftClassTable; /* Offset from beginning of this subtable to
+ * left-hand class table. */
+ OffsetTo<KernClassTable>
+ rightClassTable;/* Offset from beginning of this subtable to
+ * right-hand class table. */
+ OffsetTo<FWORD>
+ array; /* Offset from beginning of this subtable to
+ * the start of the kerning array. */
+ public:
+ DEFINE_SIZE_MIN (8);
+};
+
+struct KernSubTable
+{
+ inline int get_kerning (hb_codepoint_t left, hb_codepoint_t right, const char *end, unsigned int format) const
+ {
+ switch (format) {
+ case 0: return u.format0.get_kerning (left, right);
+ case 2: return u.format2.get_kerning (left, right, end);
+ default:return 0;
+ }
+ }
+
+ inline bool sanitize (hb_sanitize_context_t *c, unsigned int format) const
+ {
+ TRACE_SANITIZE (this);
+ switch (format) {
+ case 0: return_trace (u.format0.sanitize (c));
+ case 2: return_trace (u.format2.sanitize (c));
+ default:return_trace (true);
+ }
+ }
+
+ protected:
+ union {
+ KernSubTableFormat0 format0;
+ KernSubTableFormat2 format2;
+ } u;
+ public:
+ DEFINE_SIZE_MIN (0);
+};
+
+
+template <typename T>
+struct KernSubTableWrapper
+{
+ /* https://en.wikipedia.org/wiki/Curiously_recurring_template_pattern */
+ inline const T* thiz (void) const { return static_cast<const T *> (this); }
+
+ inline bool is_horizontal (void) const
+ { return (thiz()->coverage & T::COVERAGE_CHECK_FLAGS) == T::COVERAGE_CHECK_HORIZONTAL; }
+
+ inline bool is_override (void) const
+ { return bool (thiz()->coverage & T::COVERAGE_OVERRIDE_FLAG); }
+
+ inline int get_kerning (hb_codepoint_t left, hb_codepoint_t right, const char *end) const
+ { return thiz()->subtable.get_kerning (left, right, end, thiz()->format); }
+
+ inline int get_h_kerning (hb_codepoint_t left, hb_codepoint_t right, const char *end) const
+ { return is_horizontal () ? get_kerning (left, right, end) : 0; }
+
+ inline unsigned int get_size (void) const { return thiz()->length; }
+
+ inline bool sanitize (hb_sanitize_context_t *c) const
+ {
+ TRACE_SANITIZE (this);
+ return_trace (c->check_struct (thiz()) &&
+ thiz()->length >= thiz()->min_size &&
+ c->check_array (thiz(), 1, thiz()->length) &&
+ thiz()->subtable.sanitize (c, thiz()->format));
+ }
+};
+
+template <typename T>
+struct KernTable
+{
+ /* https://en.wikipedia.org/wiki/Curiously_recurring_template_pattern */
+ inline const T* thiz (void) const { return static_cast<const T *> (this); }
+
+ inline int get_h_kerning (hb_codepoint_t left, hb_codepoint_t right, unsigned int table_length) const
+ {
+ int v = 0;
+ const typename T::SubTableWrapper *st = CastP<typename T::SubTableWrapper> (thiz()->data);
+ unsigned int count = thiz()->nTables;
+ for (unsigned int i = 0; i < count; i++)
+ {
+ if (st->is_override ())
+ v = 0;
+ v += st->get_h_kerning (left, right, table_length + (const char *) this);
+ st = &StructAfter<typename T::SubTableWrapper> (*st);
+ }
+ return v;
+ }
+
+ inline bool sanitize (hb_sanitize_context_t *c) const
+ {
+ TRACE_SANITIZE (this);
+ if (unlikely (!c->check_struct (thiz()) ||
+ thiz()->version != T::VERSION))
+ return_trace (false);
+
+ const typename T::SubTableWrapper *st = CastP<typename T::SubTableWrapper> (thiz()->data);
+ unsigned int count = thiz()->nTables;
+ for (unsigned int i = 0; i < count; i++)
+ {
+ if (unlikely (!st->sanitize (c)))
+ return_trace (false);
+ st = &StructAfter<typename T::SubTableWrapper> (*st);
+ }
+
+ return_trace (true);
+ }
+};
+
+struct KernOT : KernTable<KernOT>
+{
+ friend struct KernTable<KernOT>;
+
+ static const uint16_t VERSION = 0x0000u;
+
+ struct SubTableWrapper : KernSubTableWrapper<SubTableWrapper>
+ {
+ friend struct KernSubTableWrapper<SubTableWrapper>;
+
+ enum coverage_flags_t {
+ COVERAGE_DIRECTION_FLAG = 0x01u,
+ COVERAGE_MINIMUM_FLAG = 0x02u,
+ COVERAGE_CROSSSTREAM_FLAG = 0x04u,
+ COVERAGE_OVERRIDE_FLAG = 0x08u,
+
+ COVERAGE_VARIATION_FLAG = 0x00u, /* Not supported. */
+
+ COVERAGE_CHECK_FLAGS = 0x07u,
+ COVERAGE_CHECK_HORIZONTAL = 0x01u
+ };
+
+ protected:
+ UINT16 versionZ; /* Unused. */
+ UINT16 length; /* Length of the subtable (including this header). */
+ UINT8 format; /* Subtable format. */
+ UINT8 coverage; /* Coverage bits. */
+ KernSubTable subtable; /* Subtable data. */
+ public:
+ DEFINE_SIZE_MIN (6);
+ };
+
+ protected:
+ UINT16 version; /* Version--0x0000u */
+ UINT16 nTables; /* Number of subtables in the kerning table. */
+ UINT8 data[VAR];
+ public:
+ DEFINE_SIZE_ARRAY (4, data);
+};
+
+struct KernAAT : KernTable<KernAAT>
+{
+ friend struct KernTable<KernAAT>;
+
+ static const uint32_t VERSION = 0x00010000u;
+
+ struct SubTableWrapper : KernSubTableWrapper<SubTableWrapper>
+ {
+ friend struct KernSubTableWrapper<SubTableWrapper>;
+
+ enum coverage_flags_t {
+ COVERAGE_DIRECTION_FLAG = 0x80u,
+ COVERAGE_CROSSSTREAM_FLAG = 0x40u,
+ COVERAGE_VARIATION_FLAG = 0x20u,
+
+ COVERAGE_OVERRIDE_FLAG = 0x00u, /* Not supported. */
+
+ COVERAGE_CHECK_FLAGS = 0xE0u,
+ COVERAGE_CHECK_HORIZONTAL = 0x00u
+ };
+
+ protected:
+ UINT32 length; /* Length of the subtable (including this header). */
+ UINT8 coverage; /* Coverage bits. */
+ UINT8 format; /* Subtable format. */
+ UINT16 tupleIndex; /* The tuple index (used for variations fonts).
+ * This value specifies which tuple this subtable covers. */
+ KernSubTable subtable; /* Subtable data. */
+ public:
+ DEFINE_SIZE_MIN (8);
+ };
+
+ protected:
+ UINT32 version; /* Version--0x00010000u */
+ UINT32 nTables; /* Number of subtables in the kerning table. */
+ UINT8 data[VAR];
+ public:
+ DEFINE_SIZE_ARRAY (8, data);
+};
+
+struct kern
+{
+ static const hb_tag_t tableTag = HB_OT_TAG_kern;
+
+ inline int get_h_kerning (hb_codepoint_t left, hb_codepoint_t right, unsigned int table_length) const
+ {
+ switch (u.major) {
+ case 0: return u.ot.get_h_kerning (left, right, table_length);
+ case 1: return u.aat.get_h_kerning (left, right, table_length);
+ default:return 0;
+ }
+ }
+
+ inline bool sanitize (hb_sanitize_context_t *c) const
+ {
+ TRACE_SANITIZE (this);
+ if (!u.major.sanitize (c)) return_trace (false);
+ switch (u.major) {
+ case 0: return_trace (u.ot.sanitize (c));
+ case 1: return_trace (u.aat.sanitize (c));
+ default:return_trace (true);
+ }
+ }
+
+ struct accelerator_t
+ {
+ inline void init (hb_face_t *face)
+ {
+ blob = Sanitizer<kern>::sanitize (face->reference_table (HB_OT_TAG_kern));
+ table = Sanitizer<kern>::lock_instance (blob);
+ table_length = hb_blob_get_length (blob);
+ }
+ inline void fini (void)
+ {
+ hb_blob_destroy (blob);
+ }
+
+ inline int get_h_kerning (hb_codepoint_t left, hb_codepoint_t right) const
+ { return table->get_h_kerning (left, right, table_length); }
+
+ private:
+ hb_blob_t *blob;
+ const kern *table;
+ unsigned int table_length;
+ };
+
+ protected:
+ union {
+ UINT16 major;
+ KernOT ot;
+ KernAAT aat;
+ } u;
+ public:
+ DEFINE_SIZE_UNION (2, major);
+};
+
+} /* namespace OT */
+
+
+#endif /* HB_OT_KERN_TABLE_HH */
diff --git a/src/3rdparty/harfbuzz-ng/src/hb-ot-layout-common-private.hh b/src/3rdparty/harfbuzz-ng/src/hb-ot-layout-common-private.hh
index 62ca7a348e..5e699e1967 100644
--- a/src/3rdparty/harfbuzz-ng/src/hb-ot-layout-common-private.hh
+++ b/src/3rdparty/harfbuzz-ng/src/hb-ot-layout-common-private.hh
@@ -29,6 +29,8 @@
#ifndef HB_OT_LAYOUT_COMMON_PRIVATE_HH
#define HB_OT_LAYOUT_COMMON_PRIVATE_HH
+#include "hb-private.hh"
+#include "hb-debug.hh"
#include "hb-ot-layout-private.hh"
#include "hb-open-type-private.hh"
#include "hb-set-private.hh"
@@ -45,12 +47,6 @@
namespace OT {
-#define TRACE_DISPATCH(this, format) \
- hb_auto_trace_t<context_t::max_debug_depth, typename context_t::return_t> trace \
- (&c->debug_depth, c->get_name (), this, HB_FUNC, \
- "format %d", (int) format);
-
-
#define NOT_COVERED ((unsigned int) -1)
@@ -159,13 +155,13 @@ struct RangeRecord
}
template <typename set_t>
- inline void add_coverage (set_t *glyphs) const {
- glyphs->add_range (start, end);
+ inline bool add_coverage (set_t *glyphs) const {
+ return glyphs->add_range (start, end);
}
GlyphID start; /* First GlyphID in the range */
GlyphID end; /* Last GlyphID in the range */
- USHORT value; /* Value */
+ UINT16 value; /* Value */
public:
DEFINE_SIZE_STATIC (6);
};
@@ -179,7 +175,7 @@ struct IndexArray : ArrayOf<Index>
unsigned int *_indexes /* OUT */) const
{
if (_count) {
- const USHORT *arr = this->sub_array (start_offset, _count);
+ const UINT16 *arr = this->sub_array (start_offset, _count);
unsigned int count = *_count;
for (unsigned int i = 0; i < count; i++)
_indexes[i] = arr[i];
@@ -214,15 +210,15 @@ struct LangSys
}
inline bool sanitize (hb_sanitize_context_t *c,
- const Record<LangSys>::sanitize_closure_t * = NULL) const
+ const Record<LangSys>::sanitize_closure_t * = nullptr) const
{
TRACE_SANITIZE (this);
return_trace (c->check_struct (this) && featureIndex.sanitize (c));
}
- Offset<> lookupOrderZ; /* = Null (reserved for an offset to a
+ Offset16 lookupOrderZ; /* = Null (reserved for an offset to a
* reordering table) */
- USHORT reqFeatureIndex;/* Index of a feature required for this
+ UINT16 reqFeatureIndex;/* Index of a feature required for this
* language system--if no required features
* = 0xFFFFu */
IndexArray featureIndex; /* Array of indices into the FeatureList */
@@ -254,7 +250,7 @@ struct Script
inline const LangSys& get_default_lang_sys (void) const { return this+defaultLangSys; }
inline bool sanitize (hb_sanitize_context_t *c,
- const Record<Script>::sanitize_closure_t * = NULL) const
+ const Record<Script>::sanitize_closure_t * = nullptr) const
{
TRACE_SANITIZE (this);
return_trace (defaultLangSys.sanitize (c, this) && langSys.sanitize (c, this));
@@ -347,12 +343,12 @@ struct FeatureParamsSize
return_trace (true);
}
- USHORT designSize; /* Represents the design size in 720/inch
+ UINT16 designSize; /* Represents the design size in 720/inch
* units (decipoints). The design size entry
* must be non-zero. When there is a design
* size but no recommended size range, the
* rest of the array will consist of zeros. */
- USHORT subfamilyID; /* Has no independent meaning, but serves
+ UINT16 subfamilyID; /* Has no independent meaning, but serves
* as an identifier that associates fonts
* in a subfamily. All fonts which share a
* Preferred or Font Family name and which
@@ -362,7 +358,7 @@ struct FeatureParamsSize
* same subfamily value. If this value is
* zero, the remaining fields in the array
* will be ignored. */
- USHORT subfamilyNameID;/* If the preceding value is non-zero, this
+ UINT16 subfamilyNameID;/* If the preceding value is non-zero, this
* value must be set in the range 256 - 32767
* (inclusive). It records the value of a
* field in the name table, which must
@@ -376,10 +372,10 @@ struct FeatureParamsSize
* subfamily in a menu. Applications will
* choose the appropriate version based on
* their selection criteria. */
- USHORT rangeStart; /* Large end of the recommended usage range
+ UINT16 rangeStart; /* Large end of the recommended usage range
* (inclusive), stored in 720/inch units
* (decipoints). */
- USHORT rangeEnd; /* Small end of the recommended usage range
+ UINT16 rangeEnd; /* Small end of the recommended usage range
(exclusive), stored in 720/inch units
* (decipoints). */
public:
@@ -397,12 +393,12 @@ struct FeatureParamsStylisticSet
return_trace (c->check_struct (this));
}
- USHORT version; /* (set to 0): This corresponds to a “minor”
+ UINT16 version; /* (set to 0): This corresponds to a “minor”
* version number. Additional data may be
* added to the end of this Feature Parameters
* table in the future. */
- USHORT uiNameID; /* The 'name' table name ID that specifies a
+ UINT16 uiNameID; /* The 'name' table name ID that specifies a
* string (or strings, for multiple languages)
* for a user-interface label for this
* feature. The values of uiLabelNameId and
@@ -430,25 +426,25 @@ struct FeatureParamsCharacterVariants
characters.sanitize (c));
}
- USHORT format; /* Format number is set to 0. */
- USHORT featUILableNameID; /* The ‘name’ table name ID that
+ UINT16 format; /* Format number is set to 0. */
+ UINT16 featUILableNameID; /* The ‘name’ table name ID that
* specifies a string (or strings,
* for multiple languages) for a
* user-interface label for this
- * feature. (May be NULL.) */
- USHORT featUITooltipTextNameID;/* The ‘name’ table name ID that
+ * feature. (May be nullptr.) */
+ UINT16 featUITooltipTextNameID;/* The ‘name’ table name ID that
* specifies a string (or strings,
* for multiple languages) that an
* application can use for tooltip
* text for this feature. (May be
- * NULL.) */
- USHORT sampleTextNameID; /* The ‘name’ table name ID that
+ * nullptr.) */
+ UINT16 sampleTextNameID; /* The ‘name’ table name ID that
* specifies sample text that
* illustrates the effect of this
- * feature. (May be NULL.) */
- USHORT numNamedParameters; /* Number of named parameters. (May
+ * feature. (May be nullptr.) */
+ UINT16 numNamedParameters; /* Number of named parameters. (May
* be zero.) */
- USHORT firstParamUILabelNameID;/* The first ‘name’ table name ID
+ UINT16 firstParamUILabelNameID;/* The first ‘name’ table name ID
* used to specify strings for
* user-interface labels for the
* feature parameters. (Must be zero
@@ -507,7 +503,7 @@ struct Feature
{ return this+featureParams; }
inline bool sanitize (hb_sanitize_context_t *c,
- const Record<Feature>::sanitize_closure_t *closure = NULL) const
+ const Record<Feature>::sanitize_closure_t *closure = nullptr) const
{
TRACE_SANITIZE (this);
if (unlikely (!(c->check_struct (this) && lookupIndex.sanitize (c))))
@@ -566,7 +562,7 @@ struct Feature
typedef RecordListOf<Feature> FeatureList;
-struct LookupFlag : USHORT
+struct LookupFlag : UINT16
{
enum Flags {
RightToLeft = 0x0001u,
@@ -612,7 +608,7 @@ struct Lookup
unsigned int flag = lookupFlag;
if (unlikely (flag & LookupFlag::UseMarkFilteringSet))
{
- const USHORT &markFilteringSet = StructAfter<USHORT> (subTable);
+ const UINT16 &markFilteringSet = StructAfter<UINT16> (subTable);
flag += (markFilteringSet << 16);
}
return flag;
@@ -644,7 +640,7 @@ struct Lookup
if (unlikely (!subTable.serialize (c, num_subtables))) return_trace (false);
if (lookupFlag & LookupFlag::UseMarkFilteringSet)
{
- USHORT &markFilteringSet = StructAfter<USHORT> (subTable);
+ UINT16 &markFilteringSet = StructAfter<UINT16> (subTable);
markFilteringSet.set (lookup_props >> 16);
}
return_trace (true);
@@ -657,18 +653,18 @@ struct Lookup
if (!(c->check_struct (this) && subTable.sanitize (c))) return_trace (false);
if (lookupFlag & LookupFlag::UseMarkFilteringSet)
{
- const USHORT &markFilteringSet = StructAfter<USHORT> (subTable);
+ const UINT16 &markFilteringSet = StructAfter<UINT16> (subTable);
if (!markFilteringSet.sanitize (c)) return_trace (false);
}
return_trace (true);
}
private:
- USHORT lookupType; /* Different enumerations for GSUB and GPOS */
- USHORT lookupFlag; /* Lookup qualifiers */
- ArrayOf<Offset<> >
+ UINT16 lookupType; /* Different enumerations for GSUB and GPOS */
+ UINT16 lookupFlag; /* Lookup qualifiers */
+ ArrayOf<Offset16>
subTable; /* Array of SubTables */
- USHORT markFilteringSetX[VAR]; /* Index (base 0) into GDEF mark glyph sets
+ UINT16 markFilteringSetX[VAR]; /* Index (base 0) into GDEF mark glyph sets
* structure. This field is only present if bit
* UseMarkFilteringSet of lookup flags is set. */
public:
@@ -690,7 +686,7 @@ struct CoverageFormat1
inline unsigned int get_coverage (hb_codepoint_t glyph_id) const
{
int i = glyphArray.bsearch (glyph_id);
- ASSERT_STATIC (((unsigned int) -1) == NOT_COVERED);
+ static_assert ((((unsigned int) -1) == NOT_COVERED), "");
return i;
}
@@ -719,10 +715,8 @@ struct CoverageFormat1
}
template <typename set_t>
- inline void add_coverage (set_t *glyphs) const {
- unsigned int count = glyphArray.len;
- for (unsigned int i = 0; i < count; i++)
- glyphs->add (glyphArray[i]);
+ inline bool add_coverage (set_t *glyphs) const {
+ return glyphs->add_sorted_array (glyphArray.array, glyphArray.len);
}
public:
@@ -741,7 +735,7 @@ struct CoverageFormat1
private:
protected:
- USHORT coverageFormat; /* Format identifier--format = 1 */
+ UINT16 coverageFormat; /* Format identifier--format = 1 */
SortedArrayOf<GlyphID>
glyphArray; /* Array of GlyphIDs--in numerical order */
public:
@@ -821,10 +815,12 @@ struct CoverageFormat2
}
template <typename set_t>
- inline void add_coverage (set_t *glyphs) const {
+ inline bool add_coverage (set_t *glyphs) const {
unsigned int count = rangeRecord.len;
for (unsigned int i = 0; i < count; i++)
- rangeRecord[i].add_coverage (glyphs);
+ if (unlikely (!rangeRecord[i].add_coverage (glyphs)))
+ return false;
+ return true;
}
public:
@@ -864,7 +860,7 @@ struct CoverageFormat2
private:
protected:
- USHORT coverageFormat; /* Format identifier--format = 2 */
+ UINT16 coverageFormat; /* Format identifier--format = 2 */
SortedArrayOf<RangeRecord>
rangeRecord; /* Array of glyph ranges--ordered by
* Start GlyphID. rangeCount entries
@@ -931,17 +927,19 @@ struct Coverage
}
}
+ /* Might return false if array looks unsorted.
+ * Used for faster rejection of corrupt data. */
template <typename set_t>
- inline void add_coverage (set_t *glyphs) const {
+ inline bool add_coverage (set_t *glyphs) const {
switch (u.format) {
- case 1: u.format1.add_coverage (glyphs); break;
- case 2: u.format2.add_coverage (glyphs); break;
- default: break;
+ case 1: return u.format1.add_coverage (glyphs);
+ case 2: return u.format2.add_coverage (glyphs);
+ default:return false;
}
}
struct Iter {
- Iter (void) : format (0) {};
+ Iter (void) : format (0), u () {};
inline void init (const Coverage &c_) {
format = c_.u.format;
switch (format) {
@@ -982,14 +980,14 @@ struct Coverage
private:
unsigned int format;
union {
+ CoverageFormat2::Iter format2; /* Put this one first since it's larger; helps shut up compiler. */
CoverageFormat1::Iter format1;
- CoverageFormat2::Iter format2;
} u;
};
protected:
union {
- USHORT format; /* Format identifier */
+ UINT16 format; /* Format identifier */
CoverageFormat1 format1;
CoverageFormat2 format2;
} u;
@@ -1022,11 +1020,36 @@ struct ClassDefFormat1
}
template <typename set_t>
- inline void add_class (set_t *glyphs, unsigned int klass) const {
+ inline bool add_coverage (set_t *glyphs) const {
+ unsigned int start = 0;
unsigned int count = classValue.len;
for (unsigned int i = 0; i < count; i++)
+ {
+ if (classValue[i])
+ continue;
+
+ if (start != i)
+ if (unlikely (!glyphs->add_range (startGlyph + start, startGlyph + i)))
+ return false;
+
+ start = i + 1;
+ }
+ if (start != count)
+ if (unlikely (!glyphs->add_range (startGlyph + start, startGlyph + count)))
+ return false;
+
+ return true;
+ }
+
+ template <typename set_t>
+ inline bool add_class (set_t *glyphs, unsigned int klass) const {
+ unsigned int count = classValue.len;
+ for (unsigned int i = 0; i < count; i++)
+ {
if (classValue[i] == klass)
glyphs->add (startGlyph + i);
+ }
+ return true;
}
inline bool intersects_class (const hb_set_t *glyphs, unsigned int klass) const {
@@ -1051,9 +1074,9 @@ struct ClassDefFormat1
}
protected:
- USHORT classFormat; /* Format identifier--format = 1 */
+ UINT16 classFormat; /* Format identifier--format = 1 */
GlyphID startGlyph; /* First GlyphID of the classValueArray */
- ArrayOf<USHORT>
+ ArrayOf<UINT16>
classValue; /* Array of Class Values--one per GlyphID */
public:
DEFINE_SIZE_ARRAY (6, classValue);
@@ -1079,11 +1102,25 @@ struct ClassDefFormat2
}
template <typename set_t>
- inline void add_class (set_t *glyphs, unsigned int klass) const {
+ inline bool add_coverage (set_t *glyphs) const {
unsigned int count = rangeRecord.len;
for (unsigned int i = 0; i < count; i++)
+ if (rangeRecord[i].value)
+ if (unlikely (!rangeRecord[i].add_coverage (glyphs)))
+ return false;
+ return true;
+ }
+
+ template <typename set_t>
+ inline bool add_class (set_t *glyphs, unsigned int klass) const {
+ unsigned int count = rangeRecord.len;
+ for (unsigned int i = 0; i < count; i++)
+ {
if (rangeRecord[i].value == klass)
- rangeRecord[i].add_coverage (glyphs);
+ if (unlikely (!rangeRecord[i].add_coverage (glyphs)))
+ return false;
+ }
+ return true;
}
inline bool intersects_class (const hb_set_t *glyphs, unsigned int klass) const {
@@ -1111,7 +1148,7 @@ struct ClassDefFormat2
}
protected:
- USHORT classFormat; /* Format identifier--format = 2 */
+ UINT16 classFormat; /* Format identifier--format = 2 */
SortedArrayOf<RangeRecord>
rangeRecord; /* Array of glyph ranges--ordered by
* Start GlyphID */
@@ -1141,11 +1178,25 @@ struct ClassDef
}
}
- inline void add_class (hb_set_t *glyphs, unsigned int klass) const {
+ /* Might return false if array looks unsorted.
+ * Used for faster rejection of corrupt data. */
+ template <typename set_t>
+ inline bool add_coverage (set_t *glyphs) const {
+ switch (u.format) {
+ case 1: return u.format1.add_coverage (glyphs);
+ case 2: return u.format2.add_coverage (glyphs);
+ default:return false;
+ }
+ }
+
+ /* Might return false if array looks unsorted.
+ * Used for faster rejection of corrupt data. */
+ template <typename set_t>
+ inline bool add_class (set_t *glyphs, unsigned int klass) const {
switch (u.format) {
- case 1: u.format1.add_class (glyphs, klass); return;
- case 2: u.format2.add_class (glyphs, klass); return;
- default:return;
+ case 1: return u.format1.add_class (glyphs, klass);
+ case 2: return u.format2.add_class (glyphs, klass);
+ default:return false;
}
}
@@ -1159,7 +1210,7 @@ struct ClassDef
protected:
union {
- USHORT format; /* Format identifier */
+ UINT16 format; /* Format identifier */
ClassDefFormat1 format1;
ClassDefFormat2 format2;
} u;
@@ -1244,8 +1295,8 @@ struct VarRegionList
}
protected:
- USHORT axisCount;
- USHORT regionCount;
+ UINT16 axisCount;
+ UINT16 regionCount;
VarRegionAxis axesZ[VAR];
public:
DEFINE_SIZE_ARRAY (4, axesZ);
@@ -1269,13 +1320,13 @@ struct VarData
unsigned int count = regionIndices.len;
unsigned int scount = shortCount;
- const BYTE *bytes = &StructAfter<BYTE> (regionIndices);
- const BYTE *row = bytes + inner * (scount + count);
+ const UINT8 *bytes = &StructAfter<UINT8> (regionIndices);
+ const UINT8 *row = bytes + inner * (scount + count);
float delta = 0.;
unsigned int i = 0;
- const SHORT *scursor = reinterpret_cast<const SHORT *> (row);
+ const INT16 *scursor = reinterpret_cast<const INT16 *> (row);
for (; i < scount; i++)
{
float scalar = regions.evaluate (regionIndices.array[i], coords, coord_count);
@@ -1297,15 +1348,15 @@ struct VarData
return_trace (c->check_struct (this) &&
regionIndices.sanitize(c) &&
shortCount <= regionIndices.len &&
- c->check_array (&StructAfter<BYTE> (regionIndices),
+ c->check_array (&StructAfter<UINT8> (regionIndices),
get_row_size (), itemCount));
}
protected:
- USHORT itemCount;
- USHORT shortCount;
- ArrayOf<USHORT> regionIndices;
- BYTE bytesX[VAR];
+ UINT16 itemCount;
+ UINT16 shortCount;
+ ArrayOf<UINT16> regionIndices;
+ UINT8 bytesX[VAR];
public:
DEFINE_SIZE_ARRAY2 (6, regionIndices, bytesX);
};
@@ -1323,6 +1374,14 @@ struct VariationStore
this+regions);
}
+ inline float get_delta (unsigned int index,
+ int *coords, unsigned int coord_count) const
+ {
+ unsigned int outer = index >> 16;
+ unsigned int inner = index & 0xFFFF;
+ return get_delta (outer, inner, coords, coord_count);
+ }
+
inline bool sanitize (hb_sanitize_context_t *c) const
{
TRACE_SANITIZE (this);
@@ -1333,9 +1392,9 @@ struct VariationStore
}
protected:
- USHORT format;
- OffsetTo<VarRegionList, ULONG> regions;
- OffsetArrayOf<VarData, ULONG> dataSets;
+ UINT16 format;
+ LOffsetTo<VarRegionList> regions;
+ OffsetArrayOf<VarData, UINT32> dataSets;
public:
DEFINE_SIZE_ARRAY (8, dataSets);
};
@@ -1362,8 +1421,8 @@ struct ConditionFormat1
}
protected:
- USHORT format; /* Format identifier--format = 1 */
- USHORT axisIndex;
+ UINT16 format; /* Format identifier--format = 1 */
+ UINT16 axisIndex;
F2DOT14 filterRangeMinValue;
F2DOT14 filterRangeMaxValue;
public:
@@ -1392,7 +1451,7 @@ struct Condition
protected:
union {
- USHORT format; /* Format identifier */
+ UINT16 format; /* Format identifier */
ConditionFormat1 format1;
} u;
public:
@@ -1417,7 +1476,7 @@ struct ConditionSet
}
protected:
- OffsetArrayOf<Condition, ULONG> conditions;
+ OffsetArrayOf<Condition, UINT32> conditions;
public:
DEFINE_SIZE_ARRAY (2, conditions);
};
@@ -1433,8 +1492,8 @@ struct FeatureTableSubstitutionRecord
}
protected:
- USHORT featureIndex;
- OffsetTo<Feature, ULONG> feature;
+ UINT16 featureIndex;
+ LOffsetTo<Feature> feature;
public:
DEFINE_SIZE_STATIC (6);
};
@@ -1450,7 +1509,7 @@ struct FeatureTableSubstitution
if (record.featureIndex == feature_index)
return &(this+record.feature);
}
- return NULL;
+ return nullptr;
}
inline bool sanitize (hb_sanitize_context_t *c) const
@@ -1481,9 +1540,9 @@ struct FeatureVariationRecord
}
protected:
- OffsetTo<ConditionSet, ULONG>
+ LOffsetTo<ConditionSet>
conditions;
- OffsetTo<FeatureTableSubstitution, ULONG>
+ LOffsetTo<FeatureTableSubstitution>
substitutions;
public:
DEFINE_SIZE_STATIC (8);
@@ -1527,7 +1586,7 @@ struct FeatureVariations
protected:
FixedVersion<> version; /* Version--0x00010000u */
- ArrayOf<FeatureVariationRecord, ULONG>
+ LArrayOf<FeatureVariationRecord>
varRecords;
public:
DEFINE_SIZE_ARRAY (8, varRecords);
@@ -1553,8 +1612,8 @@ struct HintingDevice
inline unsigned int get_size (void) const
{
unsigned int f = deltaFormat;
- if (unlikely (f < 1 || f > 3 || startSize > endSize)) return 3 * USHORT::static_size;
- return USHORT::static_size * (4 + ((endSize - startSize) >> (4 - f)));
+ if (unlikely (f < 1 || f > 3 || startSize > endSize)) return 3 * UINT16::static_size;
+ return UINT16::static_size * (4 + ((endSize - startSize) >> (4 - f)));
}
inline bool sanitize (hb_sanitize_context_t *c) const
@@ -1599,14 +1658,14 @@ struct HintingDevice
}
protected:
- USHORT startSize; /* Smallest size to correct--in ppem */
- USHORT endSize; /* Largest size to correct--in ppem */
- USHORT deltaFormat; /* Format of DeltaValue array data: 1, 2, or 3
+ UINT16 startSize; /* Smallest size to correct--in ppem */
+ UINT16 endSize; /* Largest size to correct--in ppem */
+ UINT16 deltaFormat; /* Format of DeltaValue array data: 1, 2, or 3
* 1 Signed 2-bit value, 8 values per uint16
* 2 Signed 4-bit value, 4 values per uint16
* 3 Signed 8-bit value, 2 values per uint16
*/
- USHORT deltaValue[VAR]; /* Array of compressed data */
+ UINT16 deltaValue[VAR]; /* Array of compressed data */
public:
DEFINE_SIZE_ARRAY (6, deltaValue);
};
@@ -1637,9 +1696,9 @@ struct VariationDevice
}
protected:
- USHORT outerIndex;
- USHORT innerIndex;
- USHORT deltaFormat; /* Format identifier for this table: 0x0x8000 */
+ UINT16 outerIndex;
+ UINT16 innerIndex;
+ UINT16 deltaFormat; /* Format identifier for this table: 0x0x8000 */
public:
DEFINE_SIZE_STATIC (6);
};
@@ -1647,10 +1706,10 @@ struct VariationDevice
struct DeviceHeader
{
protected:
- USHORT reserved1;
- USHORT reserved2;
+ UINT16 reserved1;
+ UINT16 reserved2;
public:
- USHORT format; /* Format identifier */
+ UINT16 format; /* Format identifier */
public:
DEFINE_SIZE_STATIC (6);
};
diff --git a/src/3rdparty/harfbuzz-ng/src/hb-ot-layout-gdef-table.hh b/src/3rdparty/harfbuzz-ng/src/hb-ot-layout-gdef-table.hh
index b70cbb7a38..eed46dd672 100644
--- a/src/3rdparty/harfbuzz-ng/src/hb-ot-layout-gdef-table.hh
+++ b/src/3rdparty/harfbuzz-ng/src/hb-ot-layout-gdef-table.hh
@@ -41,7 +41,7 @@ namespace OT {
* Attachment List Table
*/
-typedef ArrayOf<USHORT> AttachPoint; /* Array of contour point indices--in
+typedef ArrayOf<UINT16> AttachPoint; /* Array of contour point indices--in
* increasing numerical order */
struct AttachList
@@ -62,7 +62,7 @@ struct AttachList
const AttachPoint &points = this+attachPoint[index];
if (point_count) {
- const USHORT *array = points.sub_array (start_offset, point_count);
+ const UINT16 *array = points.sub_array (start_offset, point_count);
unsigned int count = *point_count;
for (unsigned int i = 0; i < count; i++)
point_array[i] = array[i];
@@ -109,8 +109,8 @@ struct CaretValueFormat1
}
protected:
- USHORT caretValueFormat; /* Format identifier--format = 1 */
- SHORT coordinate; /* X or Y value, in design units */
+ UINT16 caretValueFormat; /* Format identifier--format = 1 */
+ INT16 coordinate; /* X or Y value, in design units */
public:
DEFINE_SIZE_STATIC (4);
};
@@ -136,8 +136,8 @@ struct CaretValueFormat2
}
protected:
- USHORT caretValueFormat; /* Format identifier--format = 2 */
- USHORT caretValuePoint; /* Contour point index on glyph */
+ UINT16 caretValueFormat; /* Format identifier--format = 2 */
+ UINT16 caretValuePoint; /* Contour point index on glyph */
public:
DEFINE_SIZE_STATIC (4);
};
@@ -160,8 +160,8 @@ struct CaretValueFormat3
}
protected:
- USHORT caretValueFormat; /* Format identifier--format = 3 */
- SHORT coordinate; /* X or Y value, in design units */
+ UINT16 caretValueFormat; /* Format identifier--format = 3 */
+ INT16 coordinate; /* X or Y value, in design units */
OffsetTo<Device>
deviceTable; /* Offset to Device table for X or Y
* value--from beginning of CaretValue
@@ -199,7 +199,7 @@ struct CaretValue
protected:
union {
- USHORT format; /* Format identifier */
+ UINT16 format; /* Format identifier */
CaretValueFormat1 format1;
CaretValueFormat2 format2;
CaretValueFormat3 format3;
@@ -294,8 +294,8 @@ struct MarkGlyphSetsFormat1
}
protected:
- USHORT format; /* Format identifier--format = 1 */
- ArrayOf<OffsetTo<Coverage, ULONG> >
+ UINT16 format; /* Format identifier--format = 1 */
+ ArrayOf<LOffsetTo<Coverage> >
coverage; /* Array of long offsets to mark set
* coverage tables */
public:
@@ -324,7 +324,7 @@ struct MarkGlyphSets
protected:
union {
- USHORT format; /* Format identifier */
+ UINT16 format; /* Format identifier */
MarkGlyphSetsFormat1 format1;
} u;
public:
@@ -404,9 +404,9 @@ struct GDEF
{
unsigned int klass = get_glyph_class (glyph);
- ASSERT_STATIC ((unsigned int) HB_OT_LAYOUT_GLYPH_PROPS_BASE_GLYPH == (unsigned int) LookupFlag::IgnoreBaseGlyphs);
- ASSERT_STATIC ((unsigned int) HB_OT_LAYOUT_GLYPH_PROPS_LIGATURE == (unsigned int) LookupFlag::IgnoreLigatures);
- ASSERT_STATIC ((unsigned int) HB_OT_LAYOUT_GLYPH_PROPS_MARK == (unsigned int) LookupFlag::IgnoreMarks);
+ static_assert (((unsigned int) HB_OT_LAYOUT_GLYPH_PROPS_BASE_GLYPH == (unsigned int) LookupFlag::IgnoreBaseGlyphs), "");
+ static_assert (((unsigned int) HB_OT_LAYOUT_GLYPH_PROPS_LIGATURE == (unsigned int) LookupFlag::IgnoreLigatures), "");
+ static_assert (((unsigned int) HB_OT_LAYOUT_GLYPH_PROPS_MARK == (unsigned int) LookupFlag::IgnoreMarks), "");
switch (klass) {
default: return 0;
@@ -443,7 +443,7 @@ struct GDEF
* definitions--from beginning of GDEF
* header (may be NULL). Introduced
* in version 0x00010002. */
- OffsetTo<VariationStore, ULONG>
+ LOffsetTo<VariationStore>
varStore; /* Offset to the table of Item Variation
* Store--from beginning of GDEF
* header (may be NULL). Introduced
diff --git a/src/3rdparty/harfbuzz-ng/src/hb-ot-layout-gpos-table.hh b/src/3rdparty/harfbuzz-ng/src/hb-ot-layout-gpos-table.hh
index 952fd60fec..b344d793c7 100644
--- a/src/3rdparty/harfbuzz-ng/src/hb-ot-layout-gpos-table.hh
+++ b/src/3rdparty/harfbuzz-ng/src/hb-ot-layout-gpos-table.hh
@@ -51,11 +51,11 @@ enum attach_type_t {
/* Shared Tables: ValueRecord, Anchor Table, and MarkArray */
-typedef USHORT Value;
+typedef UINT16 Value;
typedef Value ValueRecord[VAR];
-struct ValueFormat : USHORT
+struct ValueFormat : UINT16
{
enum Flags {
xPlacement = 0x0001u, /* Includes horizontal adjustment for placement */
@@ -74,14 +74,14 @@ struct ValueFormat : USHORT
/* All fields are options. Only those available advance the value pointer. */
#if 0
- SHORT xPlacement; /* Horizontal adjustment for
+ INT16 xPlacement; /* Horizontal adjustment for
* placement--in design units */
- SHORT yPlacement; /* Vertical adjustment for
+ INT16 yPlacement; /* Vertical adjustment for
* placement--in design units */
- SHORT xAdvance; /* Horizontal adjustment for
+ INT16 xAdvance; /* Horizontal adjustment for
* advance--in design units (only used
* for horizontal writing) */
- SHORT yAdvance; /* Vertical adjustment for advance--in
+ INT16 yAdvance; /* Vertical adjustment for advance--in
* design units (only used for vertical
* writing) */
Offset xPlaDevice; /* Offset to Device table for
@@ -178,8 +178,8 @@ struct ValueFormat : USHORT
static inline const OffsetTo<Device>& get_device (const Value* value)
{ return *CastP<OffsetTo<Device> > (value); }
- static inline const SHORT& get_short (const Value* value)
- { return *CastP<SHORT> (value); }
+ static inline const INT16& get_short (const Value* value)
+ { return *CastP<INT16> (value); }
public:
@@ -247,9 +247,9 @@ struct AnchorFormat1
}
protected:
- USHORT format; /* Format identifier--format = 1 */
- SHORT xCoordinate; /* Horizontal value--in design units */
- SHORT yCoordinate; /* Vertical value--in design units */
+ UINT16 format; /* Format identifier--format = 1 */
+ INT16 xCoordinate; /* Horizontal value--in design units */
+ INT16 yCoordinate; /* Vertical value--in design units */
public:
DEFINE_SIZE_STATIC (6);
};
@@ -278,10 +278,10 @@ struct AnchorFormat2
}
protected:
- USHORT format; /* Format identifier--format = 2 */
- SHORT xCoordinate; /* Horizontal value--in design units */
- SHORT yCoordinate; /* Vertical value--in design units */
- USHORT anchorPoint; /* Index to glyph contour point */
+ UINT16 format; /* Format identifier--format = 2 */
+ INT16 xCoordinate; /* Horizontal value--in design units */
+ INT16 yCoordinate; /* Vertical value--in design units */
+ UINT16 anchorPoint; /* Index to glyph contour point */
public:
DEFINE_SIZE_STATIC (8);
};
@@ -308,9 +308,9 @@ struct AnchorFormat3
}
protected:
- USHORT format; /* Format identifier--format = 3 */
- SHORT xCoordinate; /* Horizontal value--in design units */
- SHORT yCoordinate; /* Vertical value--in design units */
+ UINT16 format; /* Format identifier--format = 3 */
+ INT16 xCoordinate; /* Horizontal value--in design units */
+ INT16 yCoordinate; /* Vertical value--in design units */
OffsetTo<Device>
xDeviceTable; /* Offset to Device table for X
* coordinate-- from beginning of
@@ -351,7 +351,7 @@ struct Anchor
protected:
union {
- USHORT format; /* Format identifier */
+ UINT16 format; /* Format identifier */
AnchorFormat1 format1;
AnchorFormat2 format2;
AnchorFormat3 format3;
@@ -382,7 +382,7 @@ struct AnchorMatrix
return_trace (true);
}
- USHORT rows; /* Number of rows */
+ UINT16 rows; /* Number of rows */
protected:
OffsetTo<Anchor>
matrixZ[VAR]; /* Matrix of offsets to Anchor tables--
@@ -403,7 +403,7 @@ struct MarkRecord
}
protected:
- USHORT klass; /* Class defined for this mark */
+ UINT16 klass; /* Class defined for this mark */
OffsetTo<Anchor>
markAnchor; /* Offset to Anchor table--from
* beginning of MarkArray table */
@@ -432,6 +432,7 @@ struct MarkArray : ArrayOf<MarkRecord> /* Array of MarkRecords--in Coverage orde
hb_position_t mark_x, mark_y, base_x, base_y;
+ buffer->unsafe_to_break (glyph_pos, buffer->idx);
mark_anchor.get_anchor (c, buffer->cur().codepoint, &mark_x, &mark_y);
glyph_anchor.get_anchor (c, buffer->info[glyph_pos].codepoint, &base_x, &base_y);
@@ -461,7 +462,7 @@ struct SinglePosFormat1
inline void collect_glyphs (hb_collect_glyphs_context_t *c) const
{
TRACE_COLLECT_GLYPHS (this);
- (this+coverage).add_coverage (c->input);
+ if (unlikely (!(this+coverage).add_coverage (c->input))) return;
}
inline const Coverage &get_coverage (void) const
@@ -491,7 +492,7 @@ struct SinglePosFormat1
}
protected:
- USHORT format; /* Format identifier--format = 1 */
+ UINT16 format; /* Format identifier--format = 1 */
OffsetTo<Coverage>
coverage; /* Offset to Coverage table--from
* beginning of subtable */
@@ -509,7 +510,7 @@ struct SinglePosFormat2
inline void collect_glyphs (hb_collect_glyphs_context_t *c) const
{
TRACE_COLLECT_GLYPHS (this);
- (this+coverage).add_coverage (c->input);
+ if (unlikely (!(this+coverage).add_coverage (c->input))) return;
}
inline const Coverage &get_coverage (void) const
@@ -543,13 +544,13 @@ struct SinglePosFormat2
}
protected:
- USHORT format; /* Format identifier--format = 2 */
+ UINT16 format; /* Format identifier--format = 2 */
OffsetTo<Coverage>
coverage; /* Offset to Coverage table--from
* beginning of subtable */
ValueFormat valueFormat; /* Defines the types of data in the
* ValueRecord */
- USHORT valueCount; /* Number of ValueRecords */
+ UINT16 valueCount; /* Number of ValueRecords */
ValueRecord values; /* Array of ValueRecords--positioning
* values applied to glyphs */
public:
@@ -572,7 +573,7 @@ struct SinglePos
protected:
union {
- USHORT format; /* Format identifier */
+ UINT16 format; /* Format identifier */
SinglePosFormat1 format1;
SinglePosFormat2 format2;
} u;
@@ -603,15 +604,10 @@ struct PairSet
TRACE_COLLECT_GLYPHS (this);
unsigned int len1 = valueFormats[0].get_len ();
unsigned int len2 = valueFormats[1].get_len ();
- unsigned int record_size = USHORT::static_size * (1 + len1 + len2);
+ unsigned int record_size = UINT16::static_size * (1 + len1 + len2);
const PairValueRecord *record = CastP<PairValueRecord> (arrayZ);
- unsigned int count = len;
- for (unsigned int i = 0; i < count; i++)
- {
- c->input->add (record->secondGlyph);
- record = &StructAtOffset<PairValueRecord> (record, record_size);
- }
+ c->input->add_array (&record->secondGlyph, len, record_size);
}
inline bool apply (hb_apply_context_t *c,
@@ -622,7 +618,7 @@ struct PairSet
hb_buffer_t *buffer = c->buffer;
unsigned int len1 = valueFormats[0].get_len ();
unsigned int len2 = valueFormats[1].get_len ();
- unsigned int record_size = USHORT::static_size * (1 + len1 + len2);
+ unsigned int record_size = UINT16::static_size * (1 + len1 + len2);
const PairValueRecord *record_array = CastP<PairValueRecord> (arrayZ);
unsigned int count = len;
@@ -643,6 +639,7 @@ struct PairSet
min = mid + 1;
else
{
+ buffer->unsafe_to_break (buffer->idx, pos + 1);
valueFormats[0].apply_value (c, this, &record->values[0], buffer->cur_pos());
valueFormats[1].apply_value (c, this, &record->values[len1], buffer->pos[pos]);
if (len2)
@@ -666,7 +663,7 @@ struct PairSet
{
TRACE_SANITIZE (this);
if (!(c->check_struct (this)
- && c->check_array (arrayZ, USHORT::static_size * closure->stride, len))) return_trace (false);
+ && c->check_array (arrayZ, UINT16::static_size * closure->stride, len))) return_trace (false);
unsigned int count = len;
const PairValueRecord *record = CastP<PairValueRecord> (arrayZ);
@@ -675,8 +672,8 @@ struct PairSet
}
protected:
- USHORT len; /* Number of PairValueRecords */
- USHORT arrayZ[VAR]; /* Array of PairValueRecords--ordered
+ UINT16 len; /* Number of PairValueRecords */
+ UINT16 arrayZ[VAR]; /* Array of PairValueRecords--ordered
* by GlyphID of the second glyph */
public:
DEFINE_SIZE_ARRAY (2, arrayZ);
@@ -687,7 +684,7 @@ struct PairPosFormat1
inline void collect_glyphs (hb_collect_glyphs_context_t *c) const
{
TRACE_COLLECT_GLYPHS (this);
- (this+coverage).add_coverage (c->input);
+ if (unlikely (!(this+coverage).add_coverage (c->input))) return;
unsigned int count = pairSet.len;
for (unsigned int i = 0; i < count; i++)
(this+pairSet[i]).collect_glyphs (c, valueFormat);
@@ -731,7 +728,7 @@ struct PairPosFormat1
}
protected:
- USHORT format; /* Format identifier--format = 1 */
+ UINT16 format; /* Format identifier--format = 1 */
OffsetTo<Coverage>
coverage; /* Offset to Coverage table--from
* beginning of subtable */
@@ -753,17 +750,8 @@ struct PairPosFormat2
inline void collect_glyphs (hb_collect_glyphs_context_t *c) const
{
TRACE_COLLECT_GLYPHS (this);
- (this+coverage).add_coverage (c->input);
-
- unsigned int count1 = class1Count;
- const ClassDef &klass1 = this+classDef1;
- for (unsigned int i = 0; i < count1; i++)
- klass1.add_class (c->input, i);
-
- unsigned int count2 = class2Count;
- const ClassDef &klass2 = this+classDef2;
- for (unsigned int i = 0; i < count2; i++)
- klass2.add_class (c->input, i);
+ if (unlikely (!(this+coverage).add_coverage (c->input))) return;
+ if (unlikely (!(this+classDef2).add_coverage (c->input))) return;
}
inline const Coverage &get_coverage (void) const
@@ -790,6 +778,7 @@ struct PairPosFormat2
unsigned int klass2 = (this+classDef2).get_class (buffer->info[skippy_iter.idx].codepoint);
if (unlikely (klass1 >= class1Count || klass2 >= class2Count)) return_trace (false);
+ buffer->unsafe_to_break (buffer->idx, skippy_iter.idx + 1);
const Value *v = &values[record_len * (klass1 * class2Count + klass2)];
valueFormat1.apply_value (c, this, v, buffer->cur_pos());
valueFormat2.apply_value (c, this, v + len1, buffer->pos[skippy_iter.idx]);
@@ -820,7 +809,7 @@ struct PairPosFormat2
}
protected:
- USHORT format; /* Format identifier--format = 2 */
+ UINT16 format; /* Format identifier--format = 2 */
OffsetTo<Coverage>
coverage; /* Offset to Coverage table--from
* beginning of subtable */
@@ -838,9 +827,9 @@ struct PairPosFormat2
classDef2; /* Offset to ClassDef table--from
* beginning of PairPos subtable--for
* the second glyph of the pair */
- USHORT class1Count; /* Number of classes in ClassDef1
+ UINT16 class1Count; /* Number of classes in ClassDef1
* table--includes Class0 */
- USHORT class2Count; /* Number of classes in ClassDef2
+ UINT16 class2Count; /* Number of classes in ClassDef2
* table--includes Class0 */
ValueRecord values; /* Matrix of value pairs:
* class1-major, class2-minor,
@@ -865,7 +854,7 @@ struct PairPos
protected:
union {
- USHORT format; /* Format identifier */
+ UINT16 format; /* Format identifier */
PairPosFormat1 format1;
PairPosFormat2 format2;
} u;
@@ -903,7 +892,7 @@ struct CursivePosFormat1
inline void collect_glyphs (hb_collect_glyphs_context_t *c) const
{
TRACE_COLLECT_GLYPHS (this);
- (this+coverage).add_coverage (c->input);
+ if (unlikely (!(this+coverage).add_coverage (c->input))) return;
}
inline const Coverage &get_coverage (void) const
@@ -929,6 +918,7 @@ struct CursivePosFormat1
unsigned int i = buffer->idx;
unsigned int j = skippy_iter.idx;
+ buffer->unsafe_to_break (i, j);
hb_position_t entry_x, entry_y, exit_x, exit_y;
(this+this_record.exitAnchor).get_anchor (c, buffer->info[i].codepoint, &exit_x, &exit_y);
(this+next_record.entryAnchor).get_anchor (c, buffer->info[j].codepoint, &entry_x, &entry_y);
@@ -1018,7 +1008,7 @@ struct CursivePosFormat1
}
protected:
- USHORT format; /* Format identifier--format = 1 */
+ UINT16 format; /* Format identifier--format = 1 */
OffsetTo<Coverage>
coverage; /* Offset to Coverage table--from
* beginning of subtable */
@@ -1044,7 +1034,7 @@ struct CursivePos
protected:
union {
- USHORT format; /* Format identifier */
+ UINT16 format; /* Format identifier */
CursivePosFormat1 format1;
} u;
};
@@ -1060,8 +1050,8 @@ struct MarkBasePosFormat1
inline void collect_glyphs (hb_collect_glyphs_context_t *c) const
{
TRACE_COLLECT_GLYPHS (this);
- (this+markCoverage).add_coverage (c->input);
- (this+baseCoverage).add_coverage (c->input);
+ if (unlikely (!(this+markCoverage).add_coverage (c->input))) return;
+ if (unlikely (!(this+baseCoverage).add_coverage (c->input))) return;
}
inline const Coverage &get_coverage (void) const
@@ -1083,7 +1073,9 @@ struct MarkBasePosFormat1
do {
if (!skippy_iter.prev ()) return_trace (false);
/* We only want to attach to the first of a MultipleSubst sequence. Reject others. */
- if (0 == _hb_glyph_info_get_lig_comp (&buffer->info[skippy_iter.idx])) break;
+ if (!_hb_glyph_info_multiplied (&buffer->info[skippy_iter.idx]) ||
+ 0 == _hb_glyph_info_get_lig_comp (&buffer->info[skippy_iter.idx]))
+ break;
skippy_iter.reject ();
} while (1);
@@ -1107,14 +1099,14 @@ struct MarkBasePosFormat1
}
protected:
- USHORT format; /* Format identifier--format = 1 */
+ UINT16 format; /* Format identifier--format = 1 */
OffsetTo<Coverage>
markCoverage; /* Offset to MarkCoverage table--from
* beginning of MarkBasePos subtable */
OffsetTo<Coverage>
baseCoverage; /* Offset to BaseCoverage table--from
* beginning of MarkBasePos subtable */
- USHORT classCount; /* Number of classes defined for marks */
+ UINT16 classCount; /* Number of classes defined for marks */
OffsetTo<MarkArray>
markArray; /* Offset to MarkArray table--from
* beginning of MarkBasePos subtable */
@@ -1140,7 +1132,7 @@ struct MarkBasePos
protected:
union {
- USHORT format; /* Format identifier */
+ UINT16 format; /* Format identifier */
MarkBasePosFormat1 format1;
} u;
};
@@ -1161,8 +1153,8 @@ struct MarkLigPosFormat1
inline void collect_glyphs (hb_collect_glyphs_context_t *c) const
{
TRACE_COLLECT_GLYPHS (this);
- (this+markCoverage).add_coverage (c->input);
- (this+ligatureCoverage).add_coverage (c->input);
+ if (unlikely (!(this+markCoverage).add_coverage (c->input))) return;
+ if (unlikely (!(this+ligatureCoverage).add_coverage (c->input))) return;
}
inline const Coverage &get_coverage (void) const
@@ -1224,7 +1216,7 @@ struct MarkLigPosFormat1
}
protected:
- USHORT format; /* Format identifier--format = 1 */
+ UINT16 format; /* Format identifier--format = 1 */
OffsetTo<Coverage>
markCoverage; /* Offset to Mark Coverage table--from
* beginning of MarkLigPos subtable */
@@ -1232,7 +1224,7 @@ struct MarkLigPosFormat1
ligatureCoverage; /* Offset to Ligature Coverage
* table--from beginning of MarkLigPos
* subtable */
- USHORT classCount; /* Number of defined mark classes */
+ UINT16 classCount; /* Number of defined mark classes */
OffsetTo<MarkArray>
markArray; /* Offset to MarkArray table--from
* beginning of MarkLigPos subtable */
@@ -1258,7 +1250,7 @@ struct MarkLigPos
protected:
union {
- USHORT format; /* Format identifier */
+ UINT16 format; /* Format identifier */
MarkLigPosFormat1 format1;
} u;
};
@@ -1274,8 +1266,8 @@ struct MarkMarkPosFormat1
inline void collect_glyphs (hb_collect_glyphs_context_t *c) const
{
TRACE_COLLECT_GLYPHS (this);
- (this+mark1Coverage).add_coverage (c->input);
- (this+mark2Coverage).add_coverage (c->input);
+ if (unlikely (!(this+mark1Coverage).add_coverage (c->input))) return;
+ if (unlikely (!(this+mark2Coverage).add_coverage (c->input))) return;
}
inline const Coverage &get_coverage (void) const
@@ -1338,7 +1330,7 @@ struct MarkMarkPosFormat1
}
protected:
- USHORT format; /* Format identifier--format = 1 */
+ UINT16 format; /* Format identifier--format = 1 */
OffsetTo<Coverage>
mark1Coverage; /* Offset to Combining Mark1 Coverage
* table--from beginning of MarkMarkPos
@@ -1347,7 +1339,7 @@ struct MarkMarkPosFormat1
mark2Coverage; /* Offset to Combining Mark2 Coverage
* table--from beginning of MarkMarkPos
* subtable */
- USHORT classCount; /* Number of defined mark classes */
+ UINT16 classCount; /* Number of defined mark classes */
OffsetTo<MarkArray>
mark1Array; /* Offset to Mark1Array table--from
* beginning of MarkMarkPos subtable */
@@ -1373,7 +1365,7 @@ struct MarkMarkPos
protected:
union {
- USHORT format; /* Format identifier */
+ UINT16 format; /* Format identifier */
MarkMarkPosFormat1 format1;
} u;
};
@@ -1432,7 +1424,7 @@ struct PosLookupSubTable
protected:
union {
- USHORT sub_format;
+ UINT16 sub_format;
SinglePos single;
PairPos pair;
CursivePos cursive;
diff --git a/src/3rdparty/harfbuzz-ng/src/hb-ot-layout-gsub-table.hh b/src/3rdparty/harfbuzz-ng/src/hb-ot-layout-gsub-table.hh
index 66fcb3f3af..0b09c4e4a1 100644
--- a/src/3rdparty/harfbuzz-ng/src/hb-ot-layout-gsub-table.hh
+++ b/src/3rdparty/harfbuzz-ng/src/hb-ot-layout-gsub-table.hh
@@ -44,7 +44,7 @@ struct SingleSubstFormat1
for (iter.init (this+coverage); iter.more (); iter.next ())
{
/* TODO Switch to range-based API to work around malicious fonts.
- * https://github.com/behdad/harfbuzz/issues/363 */
+ * https://github.com/harfbuzz/harfbuzz/issues/363 */
hb_codepoint_t glyph_id = iter.get_glyph ();
if (c->glyphs->has (glyph_id))
c->glyphs->add ((glyph_id + deltaGlyphID) & 0xFFFFu);
@@ -54,13 +54,13 @@ struct SingleSubstFormat1
inline void collect_glyphs (hb_collect_glyphs_context_t *c) const
{
TRACE_COLLECT_GLYPHS (this);
+ if (unlikely (!(this+coverage).add_coverage (c->input))) return;
Coverage::Iter iter;
for (iter.init (this+coverage); iter.more (); iter.next ())
{
/* TODO Switch to range-based API to work around malicious fonts.
- * https://github.com/behdad/harfbuzz/issues/363 */
+ * https://github.com/harfbuzz/harfbuzz/issues/363 */
hb_codepoint_t glyph_id = iter.get_glyph ();
- c->input->add (glyph_id);
c->output->add ((glyph_id + deltaGlyphID) & 0xFFFFu);
}
}
@@ -110,11 +110,11 @@ struct SingleSubstFormat1
}
protected:
- USHORT format; /* Format identifier--format = 1 */
+ UINT16 format; /* Format identifier--format = 1 */
OffsetTo<Coverage>
coverage; /* Offset to Coverage table--from
* beginning of Substitution table */
- SHORT deltaGlyphID; /* Add to original GlyphID to get
+ INT16 deltaGlyphID; /* Add to original GlyphID to get
* substitute GlyphID */
public:
DEFINE_SIZE_STATIC (6);
@@ -130,7 +130,7 @@ struct SingleSubstFormat2
for (iter.init (this+coverage); iter.more (); iter.next ())
{
if (unlikely (iter.get_coverage () >= count))
- break; /* Work around malicious fonts. https://github.com/behdad/harfbuzz/issues/363 */
+ break; /* Work around malicious fonts. https://github.com/harfbuzz/harfbuzz/issues/363 */
if (c->glyphs->has (iter.get_glyph ()))
c->glyphs->add (substitute[iter.get_coverage ()]);
}
@@ -139,13 +139,13 @@ struct SingleSubstFormat2
inline void collect_glyphs (hb_collect_glyphs_context_t *c) const
{
TRACE_COLLECT_GLYPHS (this);
+ if (unlikely (!(this+coverage).add_coverage (c->input))) return;
Coverage::Iter iter;
unsigned int count = substitute.len;
for (iter.init (this+coverage); iter.more (); iter.next ())
{
if (unlikely (iter.get_coverage () >= count))
- break; /* Work around malicious fonts. https://github.com/behdad/harfbuzz/issues/363 */
- c->input->add (iter.get_glyph ());
+ break; /* Work around malicious fonts. https://github.com/harfbuzz/harfbuzz/issues/363 */
c->output->add (substitute[iter.get_coverage ()]);
}
}
@@ -195,7 +195,7 @@ struct SingleSubstFormat2
}
protected:
- USHORT format; /* Format identifier--format = 2 */
+ UINT16 format; /* Format identifier--format = 2 */
OffsetTo<Coverage>
coverage; /* Offset to Coverage table--from
* beginning of Substitution table */
@@ -249,7 +249,7 @@ struct SingleSubst
protected:
union {
- USHORT format; /* Format identifier */
+ UINT16 format; /* Format identifier */
SingleSubstFormat1 format1;
SingleSubstFormat2 format2;
} u;
@@ -269,9 +269,7 @@ struct Sequence
inline void collect_glyphs (hb_collect_glyphs_context_t *c) const
{
TRACE_COLLECT_GLYPHS (this);
- unsigned int count = substitute.len;
- for (unsigned int i = 0; i < count; i++)
- c->output->add (substitute[i]);
+ c->output->add_array (substitute.array, substitute.len);
}
inline bool apply (hb_apply_context_t *c) const
@@ -287,7 +285,7 @@ struct Sequence
return_trace (true);
}
/* Spec disallows this, but Uniscribe allows it.
- * https://github.com/behdad/harfbuzz/issues/253 */
+ * https://github.com/harfbuzz/harfbuzz/issues/253 */
else if (unlikely (count == 0))
{
c->buffer->delete_glyph ();
@@ -339,7 +337,7 @@ struct MultipleSubstFormat1
for (iter.init (this+coverage); iter.more (); iter.next ())
{
if (unlikely (iter.get_coverage () >= count))
- break; /* Work around malicious fonts. https://github.com/behdad/harfbuzz/issues/363 */
+ break; /* Work around malicious fonts. https://github.com/harfbuzz/harfbuzz/issues/363 */
if (c->glyphs->has (iter.get_glyph ()))
(this+sequence[iter.get_coverage ()]).closure (c);
}
@@ -348,7 +346,7 @@ struct MultipleSubstFormat1
inline void collect_glyphs (hb_collect_glyphs_context_t *c) const
{
TRACE_COLLECT_GLYPHS (this);
- (this+coverage).add_coverage (c->input);
+ if (unlikely (!(this+coverage).add_coverage (c->input))) return;
unsigned int count = sequence.len;
for (unsigned int i = 0; i < count; i++)
(this+sequence[i]).collect_glyphs (c);
@@ -400,7 +398,7 @@ struct MultipleSubstFormat1
}
protected:
- USHORT format; /* Format identifier--format = 1 */
+ UINT16 format; /* Format identifier--format = 1 */
OffsetTo<Coverage>
coverage; /* Offset to Coverage table--from
* beginning of Substitution table */
@@ -442,7 +440,7 @@ struct MultipleSubst
protected:
union {
- USHORT format; /* Format identifier */
+ UINT16 format; /* Format identifier */
MultipleSubstFormat1 format1;
} u;
};
@@ -461,7 +459,7 @@ struct AlternateSubstFormat1
for (iter.init (this+coverage); iter.more (); iter.next ())
{
if (unlikely (iter.get_coverage () >= count))
- break; /* Work around malicious fonts. https://github.com/behdad/harfbuzz/issues/363 */
+ break; /* Work around malicious fonts. https://github.com/harfbuzz/harfbuzz/issues/363 */
if (c->glyphs->has (iter.get_glyph ())) {
const AlternateSet &alt_set = this+alternateSet[iter.get_coverage ()];
unsigned int count = alt_set.len;
@@ -474,17 +472,15 @@ struct AlternateSubstFormat1
inline void collect_glyphs (hb_collect_glyphs_context_t *c) const
{
TRACE_COLLECT_GLYPHS (this);
+ if (unlikely (!(this+coverage).add_coverage (c->input))) return;
Coverage::Iter iter;
unsigned int count = alternateSet.len;
for (iter.init (this+coverage); iter.more (); iter.next ())
{
if (unlikely (iter.get_coverage () >= count))
- break; /* Work around malicious fonts. https://github.com/behdad/harfbuzz/issues/363 */
- c->input->add (iter.get_glyph ());
+ break; /* Work around malicious fonts. https://github.com/harfbuzz/harfbuzz/issues/363 */
const AlternateSet &alt_set = this+alternateSet[iter.get_coverage ()];
- unsigned int count = alt_set.len;
- for (unsigned int i = 0; i < count; i++)
- c->output->add (alt_set[i]);
+ c->output->add_array (alt_set.array, alt_set.len);
}
}
@@ -552,7 +548,7 @@ struct AlternateSubstFormat1
}
protected:
- USHORT format; /* Format identifier--format = 1 */
+ UINT16 format; /* Format identifier--format = 1 */
OffsetTo<Coverage>
coverage; /* Offset to Coverage table--from
* beginning of Substitution table */
@@ -594,7 +590,7 @@ struct AlternateSubst
protected:
union {
- USHORT format; /* Format identifier */
+ UINT16 format; /* Format identifier */
AlternateSubstFormat1 format1;
} u;
};
@@ -615,9 +611,7 @@ struct Ligature
inline void collect_glyphs (hb_collect_glyphs_context_t *c) const
{
TRACE_COLLECT_GLYPHS (this);
- unsigned int count = component.len;
- for (unsigned int i = 1; i < count; i++)
- c->input->add (component[i]);
+ c->input->add_array (component.array, component.len ? component.len - 1 : 0);
c->output->add (ligGlyph);
}
@@ -658,7 +652,7 @@ struct Ligature
if (likely (!match_input (c, count,
&component[1],
match_glyph,
- NULL,
+ nullptr,
&match_length,
match_positions,
&is_mark_ligature,
@@ -792,7 +786,7 @@ struct LigatureSubstFormat1
for (iter.init (this+coverage); iter.more (); iter.next ())
{
if (unlikely (iter.get_coverage () >= count))
- break; /* Work around malicious fonts. https://github.com/behdad/harfbuzz/issues/363 */
+ break; /* Work around malicious fonts. https://github.com/harfbuzz/harfbuzz/issues/363 */
if (c->glyphs->has (iter.get_glyph ()))
(this+ligatureSet[iter.get_coverage ()]).closure (c);
}
@@ -801,13 +795,13 @@ struct LigatureSubstFormat1
inline void collect_glyphs (hb_collect_glyphs_context_t *c) const
{
TRACE_COLLECT_GLYPHS (this);
+ if (unlikely (!(this+coverage).add_coverage (c->input))) return;
Coverage::Iter iter;
unsigned int count = ligatureSet.len;
for (iter.init (this+coverage); iter.more (); iter.next ())
{
if (unlikely (iter.get_coverage () >= count))
- break; /* Work around malicious fonts. https://github.com/behdad/harfbuzz/issues/363 */
- c->input->add (iter.get_glyph ());
+ break; /* Work around malicious fonts. https://github.com/harfbuzz/harfbuzz/issues/363 */
(this+ligatureSet[iter.get_coverage ()]).collect_glyphs (c);
}
}
@@ -868,7 +862,7 @@ struct LigatureSubstFormat1
}
protected:
- USHORT format; /* Format identifier--format = 1 */
+ UINT16 format; /* Format identifier--format = 1 */
OffsetTo<Coverage>
coverage; /* Offset to Coverage table--from
* beginning of Substitution table */
@@ -918,7 +912,7 @@ struct LigatureSubst
protected:
union {
- USHORT format; /* Format identifier */
+ UINT16 format; /* Format identifier */
LigatureSubstFormat1 format1;
} u;
};
@@ -961,7 +955,7 @@ struct ReverseChainSingleSubstFormat1
for (iter.init (this+coverage); iter.more (); iter.next ())
{
if (unlikely (iter.get_coverage () >= count))
- break; /* Work around malicious fonts. https://github.com/behdad/harfbuzz/issues/363 */
+ break; /* Work around malicious fonts. https://github.com/harfbuzz/harfbuzz/issues/363 */
if (c->glyphs->has (iter.get_glyph ()))
c->glyphs->add (substitute[iter.get_coverage ()]);
}
@@ -970,25 +964,22 @@ struct ReverseChainSingleSubstFormat1
inline void collect_glyphs (hb_collect_glyphs_context_t *c) const
{
TRACE_COLLECT_GLYPHS (this);
-
- const OffsetArrayOf<Coverage> &lookahead = StructAfter<OffsetArrayOf<Coverage> > (backtrack);
+ if (unlikely (!(this+coverage).add_coverage (c->input))) return;
unsigned int count;
- (this+coverage).add_coverage (c->input);
-
count = backtrack.len;
for (unsigned int i = 0; i < count; i++)
- (this+backtrack[i]).add_coverage (c->before);
+ if (unlikely (!(this+backtrack[i]).add_coverage (c->before))) return;
+ const OffsetArrayOf<Coverage> &lookahead = StructAfter<OffsetArrayOf<Coverage> > (backtrack);
count = lookahead.len;
for (unsigned int i = 0; i < count; i++)
- (this+lookahead[i]).add_coverage (c->after);
+ if (unlikely (!(this+lookahead[i]).add_coverage (c->after))) return;
const ArrayOf<GlyphID> &substitute = StructAfter<ArrayOf<GlyphID> > (lookahead);
count = substitute.len;
- for (unsigned int i = 0; i < count; i++)
- c->output->add (substitute[i]);
+ c->output->add_array (substitute.array, substitute.len);
}
inline const Coverage &get_coverage (void) const
@@ -1014,14 +1005,17 @@ struct ReverseChainSingleSubstFormat1
const OffsetArrayOf<Coverage> &lookahead = StructAfter<OffsetArrayOf<Coverage> > (backtrack);
const ArrayOf<GlyphID> &substitute = StructAfter<ArrayOf<GlyphID> > (lookahead);
+ unsigned int start_index = 0, end_index = 0;
if (match_backtrack (c,
- backtrack.len, (USHORT *) backtrack.array,
- match_coverage, this) &&
+ backtrack.len, (UINT16 *) backtrack.array,
+ match_coverage, this,
+ &start_index) &&
match_lookahead (c,
- lookahead.len, (USHORT *) lookahead.array,
+ lookahead.len, (UINT16 *) lookahead.array,
match_coverage, this,
- 1))
+ 1, &end_index))
{
+ c->buffer->unsafe_to_break_from_outbuffer (start_index, end_index);
c->replace_glyph_inplace (substitute[index]);
/* Note: We DON'T decrease buffer->idx. The main loop does it
* for us. This is useful for preventing surprises if someone
@@ -1045,7 +1039,7 @@ struct ReverseChainSingleSubstFormat1
}
protected:
- USHORT format; /* Format identifier--format = 1 */
+ UINT16 format; /* Format identifier--format = 1 */
OffsetTo<Coverage>
coverage; /* Offset to Coverage table--from
* beginning of table */
@@ -1079,7 +1073,7 @@ struct ReverseChainSingleSubst
protected:
union {
- USHORT format; /* Format identifier */
+ UINT16 format; /* Format identifier */
ReverseChainSingleSubstFormat1 format1;
} u;
};
@@ -1125,7 +1119,7 @@ struct SubstLookupSubTable
protected:
union {
- USHORT sub_format;
+ UINT16 sub_format;
SingleSubst single;
MultipleSubst multiple;
AlternateSubst alternate;
@@ -1277,9 +1271,11 @@ struct SubstLookup : Lookup
if (unlikely (get_type () == SubstLookupSubTable::Extension))
{
/* The spec says all subtables of an Extension lookup should
- * have the same type. This is specially important if one has
- * a reverse type! */
+ * have the same type, which shall not be the Extension type
+ * itself. This is specially important if one has a reverse type! */
unsigned int type = get_subtable (0).u.extension.get_type ();
+ if (unlikely (type == SubstLookupSubTable::Extension))
+ return_trace (false);
unsigned int count = get_subtable_count ();
for (unsigned int i = 1; i < count; i++)
if (get_subtable (i).u.extension.get_type () != type)
diff --git a/src/3rdparty/harfbuzz-ng/src/hb-ot-layout-gsubgpos-private.hh b/src/3rdparty/harfbuzz-ng/src/hb-ot-layout-gsubgpos-private.hh
index fd75c5425a..b08a59138e 100644
--- a/src/3rdparty/harfbuzz-ng/src/hb-ot-layout-gsubgpos-private.hh
+++ b/src/3rdparty/harfbuzz-ng/src/hb-ot-layout-gsubgpos-private.hh
@@ -29,6 +29,8 @@
#ifndef HB_OT_LAYOUT_GSUBGPOS_PRIVATE_HH
#define HB_OT_LAYOUT_GSUBGPOS_PRIVATE_HH
+#include "hb-private.hh"
+#include "hb-debug.hh"
#include "hb-buffer-private.hh"
#include "hb-ot-layout-gdef-table.hh"
#include "hb-set-private.hh"
@@ -37,15 +39,6 @@
namespace OT {
-#ifndef HB_DEBUG_CLOSURE
-#define HB_DEBUG_CLOSURE (HB_DEBUG+0)
-#endif
-
-#define TRACE_CLOSURE(this) \
- hb_auto_trace_t<HB_DEBUG_CLOSURE, hb_void_t> trace \
- (&c->debug_depth, c->get_name (), this, HB_FUNC, \
- "");
-
struct hb_closure_context_t :
hb_dispatch_context_t<hb_closure_context_t, hb_void_t, HB_DEBUG_CLOSURE>
{
@@ -77,7 +70,7 @@ struct hb_closure_context_t :
unsigned int nesting_level_left_ = HB_MAX_NESTING_LEVEL) :
face (face_),
glyphs (glyphs_),
- recurse_func (NULL),
+ recurse_func (nullptr),
nesting_level_left (nesting_level_left_),
debug_depth (0) {}
@@ -85,16 +78,6 @@ struct hb_closure_context_t :
};
-
-#ifndef HB_DEBUG_WOULD_APPLY
-#define HB_DEBUG_WOULD_APPLY (HB_DEBUG+0)
-#endif
-
-#define TRACE_WOULD_APPLY(this) \
- hb_auto_trace_t<HB_DEBUG_WOULD_APPLY, bool> trace \
- (&c->debug_depth, c->get_name (), this, HB_FUNC, \
- "%d glyphs", c->len);
-
struct hb_would_apply_context_t :
hb_dispatch_context_t<hb_would_apply_context_t, bool, HB_DEBUG_WOULD_APPLY>
{
@@ -122,16 +105,6 @@ struct hb_would_apply_context_t :
};
-
-#ifndef HB_DEBUG_COLLECT_GLYPHS
-#define HB_DEBUG_COLLECT_GLYPHS (HB_DEBUG+0)
-#endif
-
-#define TRACE_COLLECT_GLYPHS(this) \
- hb_auto_trace_t<HB_DEBUG_COLLECT_GLYPHS, hb_void_t> trace \
- (&c->debug_depth, c->get_name (), this, HB_FUNC, \
- "");
-
struct hb_collect_glyphs_context_t :
hb_dispatch_context_t<hb_collect_glyphs_context_t, hb_void_t, HB_DEBUG_COLLECT_GLYPHS>
{
@@ -146,7 +119,7 @@ struct hb_collect_glyphs_context_t :
if (unlikely (nesting_level_left == 0 || !recurse_func))
return default_return_value ();
- /* Note that GPOS sets recurse_func to NULL already, so it doesn't get
+ /* Note that GPOS sets recurse_func to nullptr already, so it doesn't get
* past the previous check. For GSUB, we only want to collect the output
* glyphs in the recursion. If output is not requested, we can go home now.
*
@@ -160,7 +133,7 @@ struct hb_collect_glyphs_context_t :
return HB_VOID;
/* Return if new lookup was recursed to before. */
- if (recursed_lookups.has (lookup_index))
+ if (recursed_lookups->has (lookup_index))
return HB_VOID;
hb_set_t *old_before = before;
@@ -176,7 +149,7 @@ struct hb_collect_glyphs_context_t :
input = old_input;
after = old_after;
- recursed_lookups.add (lookup_index);
+ recursed_lookups->add (lookup_index);
return HB_VOID;
}
@@ -187,31 +160,31 @@ struct hb_collect_glyphs_context_t :
hb_set_t *after;
hb_set_t *output;
recurse_func_t recurse_func;
- hb_set_t recursed_lookups;
+ hb_set_t *recursed_lookups;
unsigned int nesting_level_left;
unsigned int debug_depth;
hb_collect_glyphs_context_t (hb_face_t *face_,
- hb_set_t *glyphs_before, /* OUT. May be NULL */
- hb_set_t *glyphs_input, /* OUT. May be NULL */
- hb_set_t *glyphs_after, /* OUT. May be NULL */
- hb_set_t *glyphs_output, /* OUT. May be NULL */
+ hb_set_t *glyphs_before, /* OUT. May be nullptr */
+ hb_set_t *glyphs_input, /* OUT. May be nullptr */
+ hb_set_t *glyphs_after, /* OUT. May be nullptr */
+ hb_set_t *glyphs_output, /* OUT. May be nullptr */
unsigned int nesting_level_left_ = HB_MAX_NESTING_LEVEL) :
face (face_),
before (glyphs_before ? glyphs_before : hb_set_get_empty ()),
input (glyphs_input ? glyphs_input : hb_set_get_empty ()),
after (glyphs_after ? glyphs_after : hb_set_get_empty ()),
output (glyphs_output ? glyphs_output : hb_set_get_empty ()),
- recurse_func (NULL),
- recursed_lookups (),
+ recurse_func (nullptr),
+ recursed_lookups (nullptr),
nesting_level_left (nesting_level_left_),
debug_depth (0)
{
- recursed_lookups.init ();
+ recursed_lookups = hb_set_create ();
}
~hb_collect_glyphs_context_t (void)
{
- recursed_lookups.fini ();
+ hb_set_destroy (recursed_lookups);
}
void set_recurse_func (recurse_func_t func) { recurse_func = func; }
@@ -219,10 +192,6 @@ struct hb_collect_glyphs_context_t :
-#ifndef HB_DEBUG_GET_COVERAGE
-#define HB_DEBUG_GET_COVERAGE (HB_DEBUG+0)
-#endif
-
/* XXX Can we remove this? */
template <typename set_t>
@@ -249,17 +218,6 @@ struct hb_add_coverage_context_t :
};
-
-#ifndef HB_DEBUG_APPLY
-#define HB_DEBUG_APPLY (HB_DEBUG+0)
-#endif
-
-#define TRACE_APPLY(this) \
- hb_auto_trace_t<HB_DEBUG_APPLY, bool> trace \
- (&c->debug_depth, c->get_name (), this, HB_FUNC, \
- "idx %d gid %u lookup %d", \
- c->buffer->idx, c->buffer->cur().codepoint, (int) c->lookup_index);
-
struct hb_apply_context_t :
hb_dispatch_context_t<hb_apply_context_t, bool, HB_DEBUG_APPLY>
{
@@ -273,10 +231,10 @@ struct hb_apply_context_t :
#define arg1(arg) (arg) /* Remove the macro to see why it's needed! */
syllable arg1(0),
#undef arg1
- match_func (NULL),
- match_data (NULL) {};
+ match_func (nullptr),
+ match_data (nullptr) {};
- typedef bool (*match_func_t) (hb_codepoint_t glyph_id, const USHORT &value, const void *data);
+ typedef bool (*match_func_t) (hb_codepoint_t glyph_id, const UINT16 &value, const void *data);
inline void set_ignore_zwnj (bool ignore_zwnj_) { ignore_zwnj = ignore_zwnj_; }
inline void set_ignore_zwj (bool ignore_zwj_) { ignore_zwj = ignore_zwj_; }
@@ -294,7 +252,7 @@ struct hb_apply_context_t :
};
inline may_match_t may_match (const hb_glyph_info_t &info,
- const USHORT *glyph_data) const
+ const UINT16 *glyph_data) const
{
if (!(info.mask & mask) ||
(syllable && syllable != info.syllable ()))
@@ -319,7 +277,7 @@ struct hb_apply_context_t :
if (!c->check_glyph_property (&info, lookup_props))
return SKIP_YES;
- if (unlikely (_hb_glyph_info_is_default_ignorable_and_not_fvs (&info) &&
+ if (unlikely (_hb_glyph_info_is_default_ignorable_and_not_hidden (&info) &&
(ignore_zwnj || !_hb_glyph_info_is_zwnj (&info)) &&
(ignore_zwj || !_hb_glyph_info_is_zwj (&info))))
return SKIP_MAYBE;
@@ -342,13 +300,13 @@ struct hb_apply_context_t :
inline void init (hb_apply_context_t *c_, bool context_match = false)
{
c = c_;
- match_glyph_data = NULL,
- matcher.set_match_func (NULL, NULL);
+ match_glyph_data = nullptr;
+ matcher.set_match_func (nullptr, nullptr);
matcher.set_lookup_props (c->lookup_props);
/* Ignore ZWNJ if we are matching GSUB context, or matching GPOS. */
- matcher.set_ignore_zwnj (context_match || c->table_index == 1);
+ matcher.set_ignore_zwnj (c->table_index == 1 || (context_match && c->auto_zwnj));
/* Ignore ZWJ if we are matching GSUB context, or matching GPOS, or if asked to. */
- matcher.set_ignore_zwj (context_match || c->table_index == 1 || c->auto_zwj);
+ matcher.set_ignore_zwj (c->table_index == 1 || (context_match || c->auto_zwj));
matcher.set_mask (context_match ? -1 : c->lookup_mask);
}
inline void set_lookup_props (unsigned int lookup_props)
@@ -357,7 +315,7 @@ struct hb_apply_context_t :
}
inline void set_match_func (matcher_t::match_func_t match_func_,
const void *match_data_,
- const USHORT glyph_data[])
+ const UINT16 glyph_data[])
{
matcher.set_match_func (match_func_, match_data_);
match_glyph_data = glyph_data;
@@ -374,6 +332,13 @@ struct hb_apply_context_t :
inline void reject (void) { num_items++; match_glyph_data--; }
+ inline matcher_t::may_skip_t
+ may_skip (const hb_apply_context_t *c,
+ const hb_glyph_info_t &info) const
+ {
+ return matcher.may_skip (c, info);
+ }
+
inline bool next (void)
{
assert (num_items > 0);
@@ -433,7 +398,7 @@ struct hb_apply_context_t :
protected:
hb_apply_context_t *c;
matcher_t matcher;
- const USHORT *match_glyph_data;
+ const UINT16 *match_glyph_data;
unsigned int num_items;
unsigned int end;
@@ -448,7 +413,7 @@ struct hb_apply_context_t :
bool stop_sublookup_iteration (return_t r) const { return r; }
return_t recurse (unsigned int lookup_index)
{
- if (unlikely (nesting_level_left == 0 || !recurse_func))
+ if (unlikely (nesting_level_left == 0 || !recurse_func || buffer->max_ops-- <= 0))
return default_return_value ();
nesting_level_left--;
@@ -457,45 +422,50 @@ struct hb_apply_context_t :
return ret;
}
- unsigned int table_index; /* GSUB/GPOS */
+ skipping_iterator_t iter_input, iter_context;
+
hb_font_t *font;
hb_face_t *face;
hb_buffer_t *buffer;
- hb_direction_t direction;
- hb_mask_t lookup_mask;
- bool auto_zwj;
recurse_func_t recurse_func;
- unsigned int nesting_level_left;
- unsigned int lookup_props;
const GDEF &gdef;
- bool has_glyph_classes;
const VariationStore &var_store;
- skipping_iterator_t iter_input, iter_context;
+
+ hb_direction_t direction;
+ hb_mask_t lookup_mask;
+ unsigned int table_index; /* GSUB/GPOS */
unsigned int lookup_index;
+ unsigned int lookup_props;
+ unsigned int nesting_level_left;
unsigned int debug_depth;
+ bool auto_zwnj;
+ bool auto_zwj;
+ bool has_glyph_classes;
+
hb_apply_context_t (unsigned int table_index_,
hb_font_t *font_,
hb_buffer_t *buffer_) :
- table_index (table_index_),
+ iter_input (), iter_context (),
font (font_), face (font->face), buffer (buffer_),
- direction (buffer_->props.direction),
- lookup_mask (1),
- auto_zwj (true),
- recurse_func (NULL),
- nesting_level_left (HB_MAX_NESTING_LEVEL),
- lookup_props (0),
+ recurse_func (nullptr),
gdef (*hb_ot_layout_from_face (face)->gdef),
- has_glyph_classes (gdef.has_glyph_classes ()),
var_store (gdef.get_var_store ()),
- iter_input (),
- iter_context (),
+ direction (buffer_->props.direction),
+ lookup_mask (1),
+ table_index (table_index_),
lookup_index ((unsigned int) -1),
- debug_depth (0) {}
+ lookup_props (0),
+ nesting_level_left (HB_MAX_NESTING_LEVEL),
+ debug_depth (0),
+ auto_zwnj (true),
+ auto_zwj (true),
+ has_glyph_classes (gdef.has_glyph_classes ()) {}
inline void set_lookup_mask (hb_mask_t mask) { lookup_mask = mask; }
inline void set_auto_zwj (bool auto_zwj_) { auto_zwj = auto_zwj_; }
+ inline void set_auto_zwnj (bool auto_zwnj_) { auto_zwnj = auto_zwnj_; }
inline void set_recurse_func (recurse_func_t func) { recurse_func = func; }
inline void set_lookup_index (unsigned int lookup_index_) { lookup_index = lookup_index_; }
inline void set_lookup_props (unsigned int lookup_props_)
@@ -598,9 +568,9 @@ struct hb_apply_context_t :
-typedef bool (*intersects_func_t) (hb_set_t *glyphs, const USHORT &value, const void *data);
-typedef void (*collect_glyphs_func_t) (hb_set_t *glyphs, const USHORT &value, const void *data);
-typedef bool (*match_func_t) (hb_codepoint_t glyph_id, const USHORT &value, const void *data);
+typedef bool (*intersects_func_t) (hb_set_t *glyphs, const UINT16 &value, const void *data);
+typedef void (*collect_glyphs_func_t) (hb_set_t *glyphs, const UINT16 &value, const void *data);
+typedef bool (*match_func_t) (hb_codepoint_t glyph_id, const UINT16 &value, const void *data);
struct ContextClosureFuncs
{
@@ -616,16 +586,16 @@ struct ContextApplyFuncs
};
-static inline bool intersects_glyph (hb_set_t *glyphs, const USHORT &value, const void *data HB_UNUSED)
+static inline bool intersects_glyph (hb_set_t *glyphs, const UINT16 &value, const void *data HB_UNUSED)
{
return glyphs->has (value);
}
-static inline bool intersects_class (hb_set_t *glyphs, const USHORT &value, const void *data)
+static inline bool intersects_class (hb_set_t *glyphs, const UINT16 &value, const void *data)
{
const ClassDef &class_def = *reinterpret_cast<const ClassDef *>(data);
return class_def.intersects_class (glyphs, value);
}
-static inline bool intersects_coverage (hb_set_t *glyphs, const USHORT &value, const void *data)
+static inline bool intersects_coverage (hb_set_t *glyphs, const UINT16 &value, const void *data)
{
const OffsetTo<Coverage> &coverage = (const OffsetTo<Coverage>&)value;
return (data+coverage).intersects (glyphs);
@@ -633,7 +603,7 @@ static inline bool intersects_coverage (hb_set_t *glyphs, const USHORT &value, c
static inline bool intersects_array (hb_closure_context_t *c,
unsigned int count,
- const USHORT values[],
+ const UINT16 values[],
intersects_func_t intersects_func,
const void *intersects_data)
{
@@ -644,16 +614,16 @@ static inline bool intersects_array (hb_closure_context_t *c,
}
-static inline void collect_glyph (hb_set_t *glyphs, const USHORT &value, const void *data HB_UNUSED)
+static inline void collect_glyph (hb_set_t *glyphs, const UINT16 &value, const void *data HB_UNUSED)
{
glyphs->add (value);
}
-static inline void collect_class (hb_set_t *glyphs, const USHORT &value, const void *data)
+static inline void collect_class (hb_set_t *glyphs, const UINT16 &value, const void *data)
{
const ClassDef &class_def = *reinterpret_cast<const ClassDef *>(data);
class_def.add_class (glyphs, value);
}
-static inline void collect_coverage (hb_set_t *glyphs, const USHORT &value, const void *data)
+static inline void collect_coverage (hb_set_t *glyphs, const UINT16 &value, const void *data)
{
const OffsetTo<Coverage> &coverage = (const OffsetTo<Coverage>&)value;
(data+coverage).add_coverage (glyphs);
@@ -661,7 +631,7 @@ static inline void collect_coverage (hb_set_t *glyphs, const USHORT &value, cons
static inline void collect_array (hb_collect_glyphs_context_t *c HB_UNUSED,
hb_set_t *glyphs,
unsigned int count,
- const USHORT values[],
+ const UINT16 values[],
collect_glyphs_func_t collect_func,
const void *collect_data)
{
@@ -670,16 +640,16 @@ static inline void collect_array (hb_collect_glyphs_context_t *c HB_UNUSED,
}
-static inline bool match_glyph (hb_codepoint_t glyph_id, const USHORT &value, const void *data HB_UNUSED)
+static inline bool match_glyph (hb_codepoint_t glyph_id, const UINT16 &value, const void *data HB_UNUSED)
{
return glyph_id == value;
}
-static inline bool match_class (hb_codepoint_t glyph_id, const USHORT &value, const void *data)
+static inline bool match_class (hb_codepoint_t glyph_id, const UINT16 &value, const void *data)
{
const ClassDef &class_def = *reinterpret_cast<const ClassDef *>(data);
return class_def.get_class (glyph_id) == value;
}
-static inline bool match_coverage (hb_codepoint_t glyph_id, const USHORT &value, const void *data)
+static inline bool match_coverage (hb_codepoint_t glyph_id, const UINT16 &value, const void *data)
{
const OffsetTo<Coverage> &coverage = (const OffsetTo<Coverage>&)value;
return (data+coverage).get_coverage (glyph_id) != NOT_COVERED;
@@ -687,7 +657,7 @@ static inline bool match_coverage (hb_codepoint_t glyph_id, const USHORT &value,
static inline bool would_match_input (hb_would_apply_context_t *c,
unsigned int count, /* Including the first glyph (not matched) */
- const USHORT input[], /* Array of input values--start with second glyph */
+ const UINT16 input[], /* Array of input values--start with second glyph */
match_func_t match_func,
const void *match_data)
{
@@ -702,15 +672,15 @@ static inline bool would_match_input (hb_would_apply_context_t *c,
}
static inline bool match_input (hb_apply_context_t *c,
unsigned int count, /* Including the first glyph (not matched) */
- const USHORT input[], /* Array of input values--start with second glyph */
+ const UINT16 input[], /* Array of input values--start with second glyph */
match_func_t match_func,
const void *match_data,
unsigned int *end_offset,
unsigned int match_positions[HB_MAX_CONTEXT_LENGTH],
- bool *p_is_mark_ligature = NULL,
- unsigned int *p_total_component_count = NULL)
+ bool *p_is_mark_ligature = nullptr,
+ unsigned int *p_total_component_count = nullptr)
{
- TRACE_APPLY (NULL);
+ TRACE_APPLY (nullptr);
if (unlikely (count > HB_MAX_CONTEXT_LENGTH)) return_trace (false);
@@ -731,11 +701,17 @@ static inline bool match_input (hb_apply_context_t *c,
* - Ligatures cannot be formed across glyphs attached to different components
* of previous ligatures. Eg. the sequence is LAM,SHADDA,LAM,FATHA,HEH, and
* LAM,LAM,HEH form a ligature, leaving SHADDA,FATHA next to eachother.
- * However, it would be wrong to ligate that SHADDA,FATHA sequence.o
- * There is an exception to this: If a ligature tries ligating with marks that
- * belong to it itself, go ahead, assuming that the font designer knows what
- * they are doing (otherwise it can break Indic stuff when a matra wants to
- * ligate with a conjunct...)
+ * However, it would be wrong to ligate that SHADDA,FATHA sequence.
+ * There are a couple of exceptions to this:
+ *
+ * o If a ligature tries ligating with marks that belong to it itself, go ahead,
+ * assuming that the font designer knows what they are doing (otherwise it can
+ * break Indic stuff when a matra wants to ligate with a conjunct,
+ *
+ * o If two marks want to ligate and they belong to different components of the
+ * same ligature glyph, and said ligature glyph is to be ignored according to
+ * mark-filtering rules, then allow.
+ * https://github.com/harfbuzz/harfbuzz/issues/545
*/
bool is_mark_ligature = _hb_glyph_info_is_mark (&buffer->cur());
@@ -746,6 +722,12 @@ static inline bool match_input (hb_apply_context_t *c,
unsigned int first_lig_id = _hb_glyph_info_get_lig_id (&buffer->cur());
unsigned int first_lig_comp = _hb_glyph_info_get_lig_comp (&buffer->cur());
+ enum {
+ LIGBASE_NOT_CHECKED,
+ LIGBASE_MAY_NOT_SKIP,
+ LIGBASE_MAY_SKIP
+ } ligbase = LIGBASE_NOT_CHECKED;
+
match_positions[0] = buffer->idx;
for (unsigned int i = 1; i < count; i++)
{
@@ -756,13 +738,43 @@ static inline bool match_input (hb_apply_context_t *c,
unsigned int this_lig_id = _hb_glyph_info_get_lig_id (&buffer->info[skippy_iter.idx]);
unsigned int this_lig_comp = _hb_glyph_info_get_lig_comp (&buffer->info[skippy_iter.idx]);
- if (first_lig_id && first_lig_comp) {
+ if (first_lig_id && first_lig_comp)
+ {
/* If first component was attached to a previous ligature component,
* all subsequent components should be attached to the same ligature
- * component, otherwise we shouldn't ligate them. */
+ * component, otherwise we shouldn't ligate them... */
if (first_lig_id != this_lig_id || first_lig_comp != this_lig_comp)
- return_trace (false);
- } else {
+ {
+ /* ...unless, we are attached to a base ligature and that base
+ * ligature is ignorable. */
+ if (ligbase == LIGBASE_NOT_CHECKED)
+ {
+ bool found = false;
+ const hb_glyph_info_t *out = buffer->out_info;
+ unsigned int j = buffer->out_len;
+ while (j && _hb_glyph_info_get_lig_id (&out[j - 1]) == first_lig_id)
+ {
+ if (_hb_glyph_info_get_lig_comp (&out[j - 1]) == 0)
+ {
+ j--;
+ found = true;
+ break;
+ }
+ j--;
+ }
+
+ if (found && skippy_iter.may_skip (c, out[j]) == hb_apply_context_t::matcher_t::SKIP_YES)
+ ligbase = LIGBASE_MAY_SKIP;
+ else
+ ligbase = LIGBASE_MAY_NOT_SKIP;
+ }
+
+ if (ligbase == LIGBASE_MAY_NOT_SKIP)
+ return_trace (false);
+ }
+ }
+ else
+ {
/* If first component was NOT attached to a previous ligature component,
* all subsequent components should also NOT be attached to any ligature
* component, unless they are attached to the first component itself! */
@@ -792,7 +804,7 @@ static inline bool ligate_input (hb_apply_context_t *c,
bool is_mark_ligature,
unsigned int total_component_count)
{
- TRACE_APPLY (NULL);
+ TRACE_APPLY (nullptr);
hb_buffer_t *buffer = c->buffer;
@@ -884,11 +896,12 @@ static inline bool ligate_input (hb_apply_context_t *c,
static inline bool match_backtrack (hb_apply_context_t *c,
unsigned int count,
- const USHORT backtrack[],
+ const UINT16 backtrack[],
match_func_t match_func,
- const void *match_data)
+ const void *match_data,
+ unsigned int *match_start)
{
- TRACE_APPLY (NULL);
+ TRACE_APPLY (nullptr);
hb_apply_context_t::skipping_iterator_t &skippy_iter = c->iter_context;
skippy_iter.reset (c->buffer->backtrack_len (), count);
@@ -898,17 +911,20 @@ static inline bool match_backtrack (hb_apply_context_t *c,
if (!skippy_iter.prev ())
return_trace (false);
+ *match_start = skippy_iter.idx;
+
return_trace (true);
}
static inline bool match_lookahead (hb_apply_context_t *c,
unsigned int count,
- const USHORT lookahead[],
+ const UINT16 lookahead[],
match_func_t match_func,
const void *match_data,
- unsigned int offset)
+ unsigned int offset,
+ unsigned int *end_index)
{
- TRACE_APPLY (NULL);
+ TRACE_APPLY (nullptr);
hb_apply_context_t::skipping_iterator_t &skippy_iter = c->iter_context;
skippy_iter.reset (c->buffer->idx + offset - 1, count);
@@ -918,6 +934,8 @@ static inline bool match_lookahead (hb_apply_context_t *c,
if (!skippy_iter.next ())
return_trace (false);
+ *end_index = skippy_iter.idx + 1;
+
return_trace (true);
}
@@ -931,9 +949,9 @@ struct LookupRecord
return_trace (c->check_struct (this));
}
- USHORT sequenceIndex; /* Index into current glyph
+ UINT16 sequenceIndex; /* Index into current glyph
* sequence--first glyph = 0 */
- USHORT lookupListIndex; /* Lookup to apply to that
+ UINT16 lookupListIndex; /* Lookup to apply to that
* position--zero--based */
public:
DEFINE_SIZE_STATIC (4);
@@ -956,10 +974,10 @@ static inline bool apply_lookup (hb_apply_context_t *c,
const LookupRecord lookupRecord[], /* Array of LookupRecords--in design order */
unsigned int match_length)
{
- TRACE_APPLY (NULL);
+ TRACE_APPLY (nullptr);
hb_buffer_t *buffer = c->buffer;
- unsigned int end;
+ int end;
/* All positions are distance from beginning of *output* buffer.
* Adjust. */
@@ -984,7 +1002,11 @@ static inline bool apply_lookup (hb_apply_context_t *c,
if (idx == 0 && lookupRecord[i].lookupListIndex == c->lookup_index)
continue;
- buffer->move_to (match_positions[idx]);
+ if (unlikely (!buffer->move_to (match_positions[idx])))
+ break;
+
+ if (unlikely (buffer->max_ops <= 0))
+ break;
unsigned int orig_len = buffer->backtrack_len () + buffer->lookahead_len ();
if (!c->recurse (lookupRecord[i].lookupListIndex))
@@ -996,10 +1018,32 @@ static inline bool apply_lookup (hb_apply_context_t *c,
if (!delta)
continue;
- /* Recursed lookup changed buffer len. Adjust. */
+ /* Recursed lookup changed buffer len. Adjust.
+ *
+ * TODO:
+ *
+ * Right now, if buffer length increased by n, we assume n new glyphs
+ * were added right after the current position, and if buffer length
+ * was decreased by n, we assume n match positions after the current
+ * one where removed. The former (buffer length increased) case is
+ * fine, but the decrease case can be improved in at least two ways,
+ * both of which are significant:
+ *
+ * - If recursed-to lookup is MultipleSubst and buffer length
+ * decreased, then it's current match position that was deleted,
+ * NOT the one after it.
+ *
+ * - If buffer length was decreased by n, it does not necessarily
+ * mean that n match positions where removed, as there might
+ * have been marks and default-ignorables in the sequence. We
+ * should instead drop match positions between current-position
+ * and current-position + n instead.
+ *
+ * It should be possible to construct tests for both of these cases.
+ */
- end = int (end) + delta;
- if (end <= match_positions[idx])
+ end += delta;
+ if (end <= int (match_positions[idx]))
{
/* End might end up being smaller than match_positions[idx] if the recursed
* lookup ended up removing many items, more than we have had matched.
@@ -1068,7 +1112,7 @@ struct ContextApplyLookupContext
static inline void context_closure_lookup (hb_closure_context_t *c,
unsigned int inputCount, /* Including the first glyph (not matched) */
- const USHORT input[], /* Array of input values--start with second glyph */
+ const UINT16 input[], /* Array of input values--start with second glyph */
unsigned int lookupCount,
const LookupRecord lookupRecord[],
ContextClosureLookupContext &lookup_context)
@@ -1082,7 +1126,7 @@ static inline void context_closure_lookup (hb_closure_context_t *c,
static inline void context_collect_glyphs_lookup (hb_collect_glyphs_context_t *c,
unsigned int inputCount, /* Including the first glyph (not matched) */
- const USHORT input[], /* Array of input values--start with second glyph */
+ const UINT16 input[], /* Array of input values--start with second glyph */
unsigned int lookupCount,
const LookupRecord lookupRecord[],
ContextCollectGlyphsLookupContext &lookup_context)
@@ -1096,7 +1140,7 @@ static inline void context_collect_glyphs_lookup (hb_collect_glyphs_context_t *c
static inline bool context_would_apply_lookup (hb_would_apply_context_t *c,
unsigned int inputCount, /* Including the first glyph (not matched) */
- const USHORT input[], /* Array of input values--start with second glyph */
+ const UINT16 input[], /* Array of input values--start with second glyph */
unsigned int lookupCount HB_UNUSED,
const LookupRecord lookupRecord[] HB_UNUSED,
ContextApplyLookupContext &lookup_context)
@@ -1107,7 +1151,7 @@ static inline bool context_would_apply_lookup (hb_would_apply_context_t *c,
}
static inline bool context_apply_lookup (hb_apply_context_t *c,
unsigned int inputCount, /* Including the first glyph (not matched) */
- const USHORT input[], /* Array of input values--start with second glyph */
+ const UINT16 input[], /* Array of input values--start with second glyph */
unsigned int lookupCount,
const LookupRecord lookupRecord[],
ContextApplyLookupContext &lookup_context)
@@ -1118,10 +1162,11 @@ static inline bool context_apply_lookup (hb_apply_context_t *c,
inputCount, input,
lookup_context.funcs.match, lookup_context.match_data,
&match_length, match_positions)
- && apply_lookup (c,
+ && (c->buffer->unsafe_to_break (c->buffer->idx, c->buffer->idx + match_length),
+ apply_lookup (c,
inputCount, match_positions,
lookupCount, lookupRecord,
- match_length);
+ match_length));
}
struct Rule
@@ -1164,19 +1209,19 @@ struct Rule
inline bool sanitize (hb_sanitize_context_t *c) const
{
TRACE_SANITIZE (this);
- return inputCount.sanitize (c)
- && lookupCount.sanitize (c)
- && c->check_range (inputZ,
- inputZ[0].static_size * inputCount
- + lookupRecordX[0].static_size * lookupCount);
+ return_trace (inputCount.sanitize (c) &&
+ lookupCount.sanitize (c) &&
+ c->check_range (inputZ,
+ inputZ[0].static_size * inputCount +
+ lookupRecordX[0].static_size * lookupCount));
}
protected:
- USHORT inputCount; /* Total number of glyphs in input
+ UINT16 inputCount; /* Total number of glyphs in input
* glyph sequence--includes the first
* glyph */
- USHORT lookupCount; /* Number of LookupRecords */
- USHORT inputZ[VAR]; /* Array of match inputs--start with
+ UINT16 lookupCount; /* Number of LookupRecords */
+ UINT16 inputZ[VAR]; /* Array of match inputs--start with
* second glyph */
LookupRecord lookupRecordX[VAR]; /* Array of LookupRecords--in
* design order */
@@ -1251,7 +1296,7 @@ struct ContextFormat1
struct ContextClosureLookupContext lookup_context = {
{intersects_glyph},
- NULL
+ nullptr
};
unsigned int count = ruleSet.len;
@@ -1269,7 +1314,7 @@ struct ContextFormat1
struct ContextCollectGlyphsLookupContext lookup_context = {
{collect_glyph},
- NULL
+ nullptr
};
unsigned int count = ruleSet.len;
@@ -1284,7 +1329,7 @@ struct ContextFormat1
const RuleSet &rule_set = this+ruleSet[(this+coverage).get_coverage (c->glyphs[0])];
struct ContextApplyLookupContext lookup_context = {
{match_glyph},
- NULL
+ nullptr
};
return_trace (rule_set.would_apply (c, lookup_context));
}
@@ -1304,7 +1349,7 @@ struct ContextFormat1
const RuleSet &rule_set = this+ruleSet[index];
struct ContextApplyLookupContext lookup_context = {
{match_glyph},
- NULL
+ nullptr
};
return_trace (rule_set.apply (c, lookup_context));
}
@@ -1316,7 +1361,7 @@ struct ContextFormat1
}
protected:
- USHORT format; /* Format identifier--format = 1 */
+ UINT16 format; /* Format identifier--format = 1 */
OffsetTo<Coverage>
coverage; /* Offset to Coverage table--from
* beginning of table */
@@ -1409,7 +1454,7 @@ struct ContextFormat2
}
protected:
- USHORT format; /* Format identifier--format = 2 */
+ UINT16 format; /* Format identifier--format = 2 */
OffsetTo<Coverage>
coverage; /* Offset to Coverage table--from
* beginning of table */
@@ -1438,7 +1483,7 @@ struct ContextFormat3
this
};
context_closure_lookup (c,
- glyphCount, (const USHORT *) (coverageZ + 1),
+ glyphCount, (const UINT16 *) (coverageZ + 1),
lookupCount, lookupRecord,
lookup_context);
}
@@ -1455,7 +1500,7 @@ struct ContextFormat3
};
context_collect_glyphs_lookup (c,
- glyphCount, (const USHORT *) (coverageZ + 1),
+ glyphCount, (const UINT16 *) (coverageZ + 1),
lookupCount, lookupRecord,
lookup_context);
}
@@ -1469,7 +1514,7 @@ struct ContextFormat3
{match_coverage},
this
};
- return_trace (context_would_apply_lookup (c, glyphCount, (const USHORT *) (coverageZ + 1), lookupCount, lookupRecord, lookup_context));
+ return_trace (context_would_apply_lookup (c, glyphCount, (const UINT16 *) (coverageZ + 1), lookupCount, lookupRecord, lookup_context));
}
inline const Coverage &get_coverage (void) const
@@ -1488,7 +1533,7 @@ struct ContextFormat3
{match_coverage},
this
};
- return_trace (context_apply_lookup (c, glyphCount, (const USHORT *) (coverageZ + 1), lookupCount, lookupRecord, lookup_context));
+ return_trace (context_apply_lookup (c, glyphCount, (const UINT16 *) (coverageZ + 1), lookupCount, lookupRecord, lookup_context));
}
inline bool sanitize (hb_sanitize_context_t *c) const
@@ -1505,10 +1550,10 @@ struct ContextFormat3
}
protected:
- USHORT format; /* Format identifier--format = 3 */
- USHORT glyphCount; /* Number of glyphs in the input glyph
+ UINT16 format; /* Format identifier--format = 3 */
+ UINT16 glyphCount; /* Number of glyphs in the input glyph
* sequence */
- USHORT lookupCount; /* Number of LookupRecords */
+ UINT16 lookupCount; /* Number of LookupRecords */
OffsetTo<Coverage>
coverageZ[VAR]; /* Array of offsets to Coverage
* table in glyph sequence order */
@@ -1535,7 +1580,7 @@ struct Context
protected:
union {
- USHORT format; /* Format identifier */
+ UINT16 format; /* Format identifier */
ContextFormat1 format1;
ContextFormat2 format2;
ContextFormat3 format3;
@@ -1565,11 +1610,11 @@ struct ChainContextApplyLookupContext
static inline void chain_context_closure_lookup (hb_closure_context_t *c,
unsigned int backtrackCount,
- const USHORT backtrack[],
+ const UINT16 backtrack[],
unsigned int inputCount, /* Including the first glyph (not matched) */
- const USHORT input[], /* Array of input values--start with second glyph */
+ const UINT16 input[], /* Array of input values--start with second glyph */
unsigned int lookaheadCount,
- const USHORT lookahead[],
+ const UINT16 lookahead[],
unsigned int lookupCount,
const LookupRecord lookupRecord[],
ChainContextClosureLookupContext &lookup_context)
@@ -1589,11 +1634,11 @@ static inline void chain_context_closure_lookup (hb_closure_context_t *c,
static inline void chain_context_collect_glyphs_lookup (hb_collect_glyphs_context_t *c,
unsigned int backtrackCount,
- const USHORT backtrack[],
+ const UINT16 backtrack[],
unsigned int inputCount, /* Including the first glyph (not matched) */
- const USHORT input[], /* Array of input values--start with second glyph */
+ const UINT16 input[], /* Array of input values--start with second glyph */
unsigned int lookaheadCount,
- const USHORT lookahead[],
+ const UINT16 lookahead[],
unsigned int lookupCount,
const LookupRecord lookupRecord[],
ChainContextCollectGlyphsLookupContext &lookup_context)
@@ -1613,11 +1658,11 @@ static inline void chain_context_collect_glyphs_lookup (hb_collect_glyphs_contex
static inline bool chain_context_would_apply_lookup (hb_would_apply_context_t *c,
unsigned int backtrackCount,
- const USHORT backtrack[] HB_UNUSED,
+ const UINT16 backtrack[] HB_UNUSED,
unsigned int inputCount, /* Including the first glyph (not matched) */
- const USHORT input[], /* Array of input values--start with second glyph */
+ const UINT16 input[], /* Array of input values--start with second glyph */
unsigned int lookaheadCount,
- const USHORT lookahead[] HB_UNUSED,
+ const UINT16 lookahead[] HB_UNUSED,
unsigned int lookupCount HB_UNUSED,
const LookupRecord lookupRecord[] HB_UNUSED,
ChainContextApplyLookupContext &lookup_context)
@@ -1630,16 +1675,16 @@ static inline bool chain_context_would_apply_lookup (hb_would_apply_context_t *c
static inline bool chain_context_apply_lookup (hb_apply_context_t *c,
unsigned int backtrackCount,
- const USHORT backtrack[],
+ const UINT16 backtrack[],
unsigned int inputCount, /* Including the first glyph (not matched) */
- const USHORT input[], /* Array of input values--start with second glyph */
+ const UINT16 input[], /* Array of input values--start with second glyph */
unsigned int lookaheadCount,
- const USHORT lookahead[],
+ const UINT16 lookahead[],
unsigned int lookupCount,
const LookupRecord lookupRecord[],
ChainContextApplyLookupContext &lookup_context)
{
- unsigned int match_length = 0;
+ unsigned int start_index = 0, match_length = 0, end_index = 0;
unsigned int match_positions[HB_MAX_CONTEXT_LENGTH];
return match_input (c,
inputCount, input,
@@ -1647,15 +1692,17 @@ static inline bool chain_context_apply_lookup (hb_apply_context_t *c,
&match_length, match_positions)
&& match_backtrack (c,
backtrackCount, backtrack,
- lookup_context.funcs.match, lookup_context.match_data[0])
+ lookup_context.funcs.match, lookup_context.match_data[0],
+ &start_index)
&& match_lookahead (c,
lookaheadCount, lookahead,
lookup_context.funcs.match, lookup_context.match_data[2],
- match_length)
- && apply_lookup (c,
+ match_length, &end_index)
+ && (c->buffer->unsafe_to_break_from_outbuffer (start_index, end_index),
+ apply_lookup (c,
inputCount, match_positions,
lookupCount, lookupRecord,
- match_length);
+ match_length));
}
struct ChainRule
@@ -1663,8 +1710,8 @@ struct ChainRule
inline void closure (hb_closure_context_t *c, ChainContextClosureLookupContext &lookup_context) const
{
TRACE_CLOSURE (this);
- const HeadlessArrayOf<USHORT> &input = StructAfter<HeadlessArrayOf<USHORT> > (backtrack);
- const ArrayOf<USHORT> &lookahead = StructAfter<ArrayOf<USHORT> > (input);
+ const HeadlessArrayOf<UINT16> &input = StructAfter<HeadlessArrayOf<UINT16> > (backtrack);
+ const ArrayOf<UINT16> &lookahead = StructAfter<ArrayOf<UINT16> > (input);
const ArrayOf<LookupRecord> &lookup = StructAfter<ArrayOf<LookupRecord> > (lookahead);
chain_context_closure_lookup (c,
backtrack.len, backtrack.array,
@@ -1677,8 +1724,8 @@ struct ChainRule
inline void collect_glyphs (hb_collect_glyphs_context_t *c, ChainContextCollectGlyphsLookupContext &lookup_context) const
{
TRACE_COLLECT_GLYPHS (this);
- const HeadlessArrayOf<USHORT> &input = StructAfter<HeadlessArrayOf<USHORT> > (backtrack);
- const ArrayOf<USHORT> &lookahead = StructAfter<ArrayOf<USHORT> > (input);
+ const HeadlessArrayOf<UINT16> &input = StructAfter<HeadlessArrayOf<UINT16> > (backtrack);
+ const ArrayOf<UINT16> &lookahead = StructAfter<ArrayOf<UINT16> > (input);
const ArrayOf<LookupRecord> &lookup = StructAfter<ArrayOf<LookupRecord> > (lookahead);
chain_context_collect_glyphs_lookup (c,
backtrack.len, backtrack.array,
@@ -1691,8 +1738,8 @@ struct ChainRule
inline bool would_apply (hb_would_apply_context_t *c, ChainContextApplyLookupContext &lookup_context) const
{
TRACE_WOULD_APPLY (this);
- const HeadlessArrayOf<USHORT> &input = StructAfter<HeadlessArrayOf<USHORT> > (backtrack);
- const ArrayOf<USHORT> &lookahead = StructAfter<ArrayOf<USHORT> > (input);
+ const HeadlessArrayOf<UINT16> &input = StructAfter<HeadlessArrayOf<UINT16> > (backtrack);
+ const ArrayOf<UINT16> &lookahead = StructAfter<ArrayOf<UINT16> > (input);
const ArrayOf<LookupRecord> &lookup = StructAfter<ArrayOf<LookupRecord> > (lookahead);
return_trace (chain_context_would_apply_lookup (c,
backtrack.len, backtrack.array,
@@ -1704,8 +1751,8 @@ struct ChainRule
inline bool apply (hb_apply_context_t *c, ChainContextApplyLookupContext &lookup_context) const
{
TRACE_APPLY (this);
- const HeadlessArrayOf<USHORT> &input = StructAfter<HeadlessArrayOf<USHORT> > (backtrack);
- const ArrayOf<USHORT> &lookahead = StructAfter<ArrayOf<USHORT> > (input);
+ const HeadlessArrayOf<UINT16> &input = StructAfter<HeadlessArrayOf<UINT16> > (backtrack);
+ const ArrayOf<UINT16> &lookahead = StructAfter<ArrayOf<UINT16> > (input);
const ArrayOf<LookupRecord> &lookup = StructAfter<ArrayOf<LookupRecord> > (lookahead);
return_trace (chain_context_apply_lookup (c,
backtrack.len, backtrack.array,
@@ -1718,23 +1765,23 @@ struct ChainRule
{
TRACE_SANITIZE (this);
if (!backtrack.sanitize (c)) return_trace (false);
- const HeadlessArrayOf<USHORT> &input = StructAfter<HeadlessArrayOf<USHORT> > (backtrack);
+ const HeadlessArrayOf<UINT16> &input = StructAfter<HeadlessArrayOf<UINT16> > (backtrack);
if (!input.sanitize (c)) return_trace (false);
- const ArrayOf<USHORT> &lookahead = StructAfter<ArrayOf<USHORT> > (input);
+ const ArrayOf<UINT16> &lookahead = StructAfter<ArrayOf<UINT16> > (input);
if (!lookahead.sanitize (c)) return_trace (false);
const ArrayOf<LookupRecord> &lookup = StructAfter<ArrayOf<LookupRecord> > (lookahead);
return_trace (lookup.sanitize (c));
}
protected:
- ArrayOf<USHORT>
+ ArrayOf<UINT16>
backtrack; /* Array of backtracking values
* (to be matched before the input
* sequence) */
- HeadlessArrayOf<USHORT>
+ HeadlessArrayOf<UINT16>
inputX; /* Array of input values (start with
* second glyph) */
- ArrayOf<USHORT>
+ ArrayOf<UINT16>
lookaheadX; /* Array of lookahead values's (to be
* matched after the input sequence) */
ArrayOf<LookupRecord>
@@ -1807,7 +1854,7 @@ struct ChainContextFormat1
struct ChainContextClosureLookupContext lookup_context = {
{intersects_glyph},
- {NULL, NULL, NULL}
+ {nullptr, nullptr, nullptr}
};
unsigned int count = ruleSet.len;
@@ -1825,7 +1872,7 @@ struct ChainContextFormat1
struct ChainContextCollectGlyphsLookupContext lookup_context = {
{collect_glyph},
- {NULL, NULL, NULL}
+ {nullptr, nullptr, nullptr}
};
unsigned int count = ruleSet.len;
@@ -1840,7 +1887,7 @@ struct ChainContextFormat1
const ChainRuleSet &rule_set = this+ruleSet[(this+coverage).get_coverage (c->glyphs[0])];
struct ChainContextApplyLookupContext lookup_context = {
{match_glyph},
- {NULL, NULL, NULL}
+ {nullptr, nullptr, nullptr}
};
return_trace (rule_set.would_apply (c, lookup_context));
}
@@ -1859,7 +1906,7 @@ struct ChainContextFormat1
const ChainRuleSet &rule_set = this+ruleSet[index];
struct ChainContextApplyLookupContext lookup_context = {
{match_glyph},
- {NULL, NULL, NULL}
+ {nullptr, nullptr, nullptr}
};
return_trace (rule_set.apply (c, lookup_context));
}
@@ -1871,7 +1918,7 @@ struct ChainContextFormat1
}
protected:
- USHORT format; /* Format identifier--format = 1 */
+ UINT16 format; /* Format identifier--format = 1 */
OffsetTo<Coverage>
coverage; /* Offset to Coverage table--from
* beginning of table */
@@ -1986,7 +2033,7 @@ struct ChainContextFormat2
}
protected:
- USHORT format; /* Format identifier--format = 2 */
+ UINT16 format; /* Format identifier--format = 2 */
OffsetTo<Coverage>
coverage; /* Offset to Coverage table--from
* beginning of table */
@@ -2026,9 +2073,9 @@ struct ChainContextFormat3
{this, this, this}
};
chain_context_closure_lookup (c,
- backtrack.len, (const USHORT *) backtrack.array,
- input.len, (const USHORT *) input.array + 1,
- lookahead.len, (const USHORT *) lookahead.array,
+ backtrack.len, (const UINT16 *) backtrack.array,
+ input.len, (const UINT16 *) input.array + 1,
+ lookahead.len, (const UINT16 *) lookahead.array,
lookup.len, lookup.array,
lookup_context);
}
@@ -2047,9 +2094,9 @@ struct ChainContextFormat3
{this, this, this}
};
chain_context_collect_glyphs_lookup (c,
- backtrack.len, (const USHORT *) backtrack.array,
- input.len, (const USHORT *) input.array + 1,
- lookahead.len, (const USHORT *) lookahead.array,
+ backtrack.len, (const UINT16 *) backtrack.array,
+ input.len, (const UINT16 *) input.array + 1,
+ lookahead.len, (const UINT16 *) lookahead.array,
lookup.len, lookup.array,
lookup_context);
}
@@ -2066,9 +2113,9 @@ struct ChainContextFormat3
{this, this, this}
};
return_trace (chain_context_would_apply_lookup (c,
- backtrack.len, (const USHORT *) backtrack.array,
- input.len, (const USHORT *) input.array + 1,
- lookahead.len, (const USHORT *) lookahead.array,
+ backtrack.len, (const UINT16 *) backtrack.array,
+ input.len, (const UINT16 *) input.array + 1,
+ lookahead.len, (const UINT16 *) lookahead.array,
lookup.len, lookup.array, lookup_context));
}
@@ -2093,9 +2140,9 @@ struct ChainContextFormat3
{this, this, this}
};
return_trace (chain_context_apply_lookup (c,
- backtrack.len, (const USHORT *) backtrack.array,
- input.len, (const USHORT *) input.array + 1,
- lookahead.len, (const USHORT *) lookahead.array,
+ backtrack.len, (const UINT16 *) backtrack.array,
+ input.len, (const UINT16 *) input.array + 1,
+ lookahead.len, (const UINT16 *) lookahead.array,
lookup.len, lookup.array, lookup_context));
}
@@ -2113,7 +2160,7 @@ struct ChainContextFormat3
}
protected:
- USHORT format; /* Format identifier--format = 3 */
+ UINT16 format; /* Format identifier--format = 3 */
OffsetArrayOf<Coverage>
backtrack; /* Array of coverage tables
* in backtracking sequence, in glyph
@@ -2150,7 +2197,7 @@ struct ChainContext
protected:
union {
- USHORT format; /* Format identifier */
+ UINT16 format; /* Format identifier */
ChainContextFormat1 format1;
ChainContextFormat2 format2;
ChainContextFormat3 format3;
@@ -2187,11 +2234,11 @@ struct ExtensionFormat1
}
protected:
- USHORT format; /* Format identifier. Set to 1. */
- USHORT extensionLookupType; /* Lookup type of subtable referenced
+ UINT16 format; /* Format identifier. Set to 1. */
+ UINT16 extensionLookupType; /* Lookup type of subtable referenced
* by ExtensionOffset (i.e. the
* extension subtable). */
- ULONG extensionOffset; /* Offset to the extension subtable,
+ UINT32 extensionOffset; /* Offset to the extension subtable,
* of lookup type subtable. */
public:
DEFINE_SIZE_STATIC (8);
@@ -2229,7 +2276,7 @@ struct Extension
protected:
union {
- USHORT format; /* Format identifier */
+ UINT16 format; /* Format identifier */
ExtensionFormat1<T> format1;
} u;
};
@@ -2241,9 +2288,6 @@ struct Extension
struct GSUBGPOS
{
- static const hb_tag_t GSUBTag = HB_OT_TAG_GSUB;
- static const hb_tag_t GPOSTag = HB_OT_TAG_GPOS;
-
inline unsigned int get_script_count (void) const
{ return (this+scriptList).len; }
inline const Tag& get_script_tag (unsigned int i) const
@@ -2313,7 +2357,7 @@ struct GSUBGPOS
featureList; /* FeatureList table */
OffsetTo<LookupList>
lookupList; /* LookupList table */
- OffsetTo<FeatureVariations, ULONG>
+ LOffsetTo<FeatureVariations>
featureVars; /* Offset to Feature Variations
table--from beginning of table
* (may be NULL). Introduced
diff --git a/src/3rdparty/harfbuzz-ng/src/hb-ot-layout-jstf-table.hh b/src/3rdparty/harfbuzz-ng/src/hb-ot-layout-jstf-table.hh
index c3068491be..adbaad64f3 100644
--- a/src/3rdparty/harfbuzz-ng/src/hb-ot-layout-jstf-table.hh
+++ b/src/3rdparty/harfbuzz-ng/src/hb-ot-layout-jstf-table.hh
@@ -124,7 +124,7 @@ struct JstfPriority
struct JstfLangSys : OffsetListOf<JstfPriority>
{
inline bool sanitize (hb_sanitize_context_t *c,
- const Record<JstfLangSys>::sanitize_closure_t * = NULL) const
+ const Record<JstfLangSys>::sanitize_closure_t * = nullptr) const
{
TRACE_SANITIZE (this);
return_trace (OffsetListOf<JstfPriority>::sanitize (c));
@@ -165,7 +165,7 @@ struct JstfScript
inline const JstfLangSys& get_default_lang_sys (void) const { return this+defaultLangSys; }
inline bool sanitize (hb_sanitize_context_t *c,
- const Record<JstfScript>::sanitize_closure_t * = NULL) const
+ const Record<JstfScript>::sanitize_closure_t * = nullptr) const
{
TRACE_SANITIZE (this);
return_trace (extenderGlyphs.sanitize (c, this) &&
diff --git a/src/3rdparty/harfbuzz-ng/src/hb-ot-layout-private.hh b/src/3rdparty/harfbuzz-ng/src/hb-ot-layout-private.hh
index a4272de631..0f0926f890 100644
--- a/src/3rdparty/harfbuzz-ng/src/hb-ot-layout-private.hh
+++ b/src/3rdparty/harfbuzz-ng/src/hb-ot-layout-private.hh
@@ -33,7 +33,8 @@
#include "hb-font-private.hh"
#include "hb-buffer-private.hh"
-#include "hb-set-private.hh"
+#include "hb-set-digest-private.hh"
+#include "hb-open-type-private.hh"
/* Private API corresponding to hb-ot-layout.h: */
@@ -125,6 +126,8 @@ namespace OT {
struct GSUB;
struct GPOS;
struct MATH;
+ struct fvar;
+ struct avar;
}
struct hb_ot_layout_lookup_accelerator_t
@@ -153,12 +156,15 @@ struct hb_ot_layout_t
hb_blob_t *gdef_blob;
hb_blob_t *gsub_blob;
hb_blob_t *gpos_blob;
- hb_blob_t *math_blob;
const struct OT::GDEF *gdef;
const struct OT::GSUB *gsub;
const struct OT::GPOS *gpos;
- const struct OT::MATH *math;
+
+ /* TODO Move the following out of this struct. */
+ OT::hb_lazy_table_loader_t<struct OT::MATH> math;
+ OT::hb_lazy_table_loader_t<struct OT::fvar> fvar;
+ OT::hb_lazy_table_loader_t<struct OT::avar> avar;
unsigned int gsub_lookup_count;
unsigned int gpos_lookup_count;
@@ -191,8 +197,7 @@ _hb_ot_layout_destroy (hb_ot_layout_t *layout);
#define syllable() var1.u8[3] /* GSUB/GPOS shaping boundaries */
-/* loop over syllables */
-
+/* Loop over syllables. Based on foreach_cluster(). */
#define foreach_syllable(buffer, start, end) \
for (unsigned int \
_count = buffer->len, \
@@ -221,7 +226,9 @@ _next_syllable (hb_buffer_t *buffer, unsigned int start)
* - General_Category: 5 bits.
* - A bit each for:
* * Is it Default_Ignorable(); we have a modified Default_Ignorable().
- * * Whether it's one of the three Mongolian Free Variation Selectors.
+ * * Whether it's one of the three Mongolian Free Variation Selectors,
+ * CGJ, or other characters that are hidden but should not be ignored
+ * like most other Default_Ignorable()s do during matching.
* * One free bit right now.
*
* The high-byte has different meanings, switched by the Gen-Cat:
@@ -234,7 +241,8 @@ _next_syllable (hb_buffer_t *buffer, unsigned int start)
enum hb_unicode_props_flags_t {
UPROPS_MASK_GEN_CAT = 0x001Fu,
UPROPS_MASK_IGNORABLE = 0x0020u,
- UPROPS_MASK_FVS = 0x0040u, /* MONGOLIAN FREE VARIATION SELECTOR 1..3 */
+ UPROPS_MASK_HIDDEN = 0x0040u, /* MONGOLIAN FREE VARIATION SELECTOR 1..3,
+ * or TAG characters */
/* If GEN_CAT=FORMAT, top byte masks: */
UPROPS_MASK_Cf_ZWJ = 0x0100u,
@@ -258,16 +266,21 @@ _hb_glyph_info_set_unicode_props (hb_glyph_info_t *info, hb_buffer_t *buffer)
buffer->scratch_flags |= HB_BUFFER_SCRATCH_FLAG_HAS_DEFAULT_IGNORABLES;
props |= UPROPS_MASK_IGNORABLE;
if (u == 0x200Cu) props |= UPROPS_MASK_Cf_ZWNJ;
- if (u == 0x200Du) props |= UPROPS_MASK_Cf_ZWJ;
+ else if (u == 0x200Du) props |= UPROPS_MASK_Cf_ZWJ;
/* Mongolian Free Variation Selectors need to be remembered
* because although we need to hide them like default-ignorables,
* they need to non-ignorable during shaping. This is similar to
* what we do for joiners in Indic-like shapers, but since the
* FVSes are GC=Mn, we have use a separate bit to remember them.
* Fixes:
- * https://github.com/behdad/harfbuzz/issues/234
- */
- if (unlikely (hb_in_range (u, 0x180Bu, 0x180Du))) props |= UPROPS_MASK_FVS;
+ * https://github.com/harfbuzz/harfbuzz/issues/234 */
+ else if (unlikely (hb_in_range (u, 0x180Bu, 0x180Du))) props |= UPROPS_MASK_HIDDEN;
+ /* TAG characters need similar treatment. Fixes:
+ * https://github.com/harfbuzz/harfbuzz/issues/463 */
+ else if (unlikely (hb_in_range (u, 0xE0020u, 0xE007Fu))) props |= UPROPS_MASK_HIDDEN;
+ /* COMBINING GRAPHEME JOINER should not be skipped; at least some times.
+ * https://github.com/harfbuzz/harfbuzz/issues/554 */
+ else if (unlikely (u == 0x034Fu)) props |= UPROPS_MASK_HIDDEN;
}
else if (unlikely (HB_UNICODE_GENERAL_CATEGORY_IS_NON_ENCLOSING_MARK_OR_MODIFIER_SYMBOL (gen_cat)))
{
@@ -292,7 +305,7 @@ _hb_glyph_info_set_unicode_props (hb_glyph_info_t *info, hb_buffer_t *buffer)
/* Recategorize emoji skin-tone modifiers as Unicode mark, so they
* behave correctly in non-native directionality. They originally
* are MODIFIER_SYMBOL. Fixes:
- * https://github.com/behdad/harfbuzz/issues/169
+ * https://github.com/harfbuzz/harfbuzz/issues/169
*/
if (unlikely (hb_in_range (u, 0x1F3FBu, 0x1F3FFu)))
{
@@ -337,6 +350,8 @@ _hb_glyph_info_get_modified_combining_class (const hb_glyph_info_t *info)
return _hb_glyph_info_is_unicode_mark (info) ? info->unicode_props()>>8 : 0;
}
+#define info_cc(info) (_hb_glyph_info_get_modified_combining_class (&(info)))
+
static inline bool
_hb_glyph_info_is_unicode_space (const hb_glyph_info_t *info)
{
@@ -367,9 +382,9 @@ _hb_glyph_info_is_default_ignorable (const hb_glyph_info_t *info)
!_hb_glyph_info_ligated (info);
}
static inline hb_bool_t
-_hb_glyph_info_is_default_ignorable_and_not_fvs (const hb_glyph_info_t *info)
+_hb_glyph_info_is_default_ignorable_and_not_hidden (const hb_glyph_info_t *info)
{
- return ((info->unicode_props() & (UPROPS_MASK_IGNORABLE|UPROPS_MASK_FVS))
+ return ((info->unicode_props() & (UPROPS_MASK_IGNORABLE|UPROPS_MASK_HIDDEN))
== UPROPS_MASK_IGNORABLE) &&
!_hb_glyph_info_ligated (info);
}
@@ -617,5 +632,4 @@ _hb_buffer_assert_gsubgpos_vars (hb_buffer_t *buffer)
#undef lig_props
#undef glyph_props
-
#endif /* HB_OT_LAYOUT_PRIVATE_HH */
diff --git a/src/3rdparty/harfbuzz-ng/src/hb-ot-layout.cc b/src/3rdparty/harfbuzz-ng/src/hb-ot-layout.cc
index 145ec76389..8845889827 100644
--- a/src/3rdparty/harfbuzz-ng/src/hb-ot-layout.cc
+++ b/src/3rdparty/harfbuzz-ng/src/hb-ot-layout.cc
@@ -34,22 +34,21 @@
#include "hb-ot-layout-gdef-table.hh"
#include "hb-ot-layout-gsub-table.hh"
#include "hb-ot-layout-gpos-table.hh"
-#include "hb-ot-layout-jstf-table.hh"
+#include "hb-ot-layout-jstf-table.hh" // Just so we compile it; unused otherwise.
+#include "hb-ot-name-table.hh" // Just so we compile it; unused otherwise.
#include "hb-ot-map-private.hh"
-#include <stdlib.h>
-#include <string.h>
+const void * const OT::_hb_NullPool[HB_NULL_POOL_SIZE / sizeof (void *)] = {};
-HB_SHAPER_DATA_ENSURE_DECLARE(ot, face)
hb_ot_layout_t *
_hb_ot_layout_create (hb_face_t *face)
{
hb_ot_layout_t *layout = (hb_ot_layout_t *) calloc (1, sizeof (hb_ot_layout_t));
if (unlikely (!layout))
- return NULL;
+ return nullptr;
layout->gdef_blob = OT::Sanitizer<OT::GDEF>::sanitize (face->reference_table (HB_OT_TAG_GDEF));
layout->gdef = OT::Sanitizer<OT::GDEF>::lock_instance (layout->gdef_blob);
@@ -60,9 +59,9 @@ _hb_ot_layout_create (hb_face_t *face)
layout->gpos_blob = OT::Sanitizer<OT::GPOS>::sanitize (face->reference_table (HB_OT_TAG_GPOS));
layout->gpos = OT::Sanitizer<OT::GPOS>::lock_instance (layout->gpos_blob);
- /* The MATH table is rarely used, so only try and load it in _get_math. */
- layout->math_blob = NULL;
- layout->math = NULL;
+ layout->math.init (face);
+ layout->fvar.init (face);
+ layout->avar.init (face);
{
/*
@@ -106,14 +105,28 @@ _hb_ot_layout_create (hb_face_t *face)
|| (928 == gdef_len && 59332 == gpos_len && 23298 == gsub_len)
/* sha1sum:6d400781948517c3c0441ba42acb309584b73033 tahomabd.ttf from Windows 8.1 */
|| (940 == gdef_len && 60732 == gpos_len && 23310 == gsub_len)
+ /* tahoma.ttf v6.04 from Windows 8.1 x64, see https://bugzilla.mozilla.org/show_bug.cgi?id=1279925 */
+ || (964 == gdef_len && 60072 == gpos_len && 23836 == gsub_len)
+ /* tahomabd.ttf v6.04 from Windows 8.1 x64, see https://bugzilla.mozilla.org/show_bug.cgi?id=1279925 */
+ || (976 == gdef_len && 61456 == gpos_len && 23832 == gsub_len)
/* sha1sum:e55fa2dfe957a9f7ec26be516a0e30b0c925f846 tahoma.ttf from Windows 10 */
|| (994 == gdef_len && 60336 == gpos_len && 24474 == gsub_len)
/* sha1sum:7199385abb4c2cc81c83a151a7599b6368e92343 tahomabd.ttf from Windows 10 */
|| (1006 == gdef_len && 61740 == gpos_len && 24470 == gsub_len)
+ /* tahoma.ttf v6.91 from Windows 10 x64, see https://bugzilla.mozilla.org/show_bug.cgi?id=1279925 */
+ || (1006 == gdef_len && 61346 == gpos_len && 24576 == gsub_len)
+ /* tahomabd.ttf v6.91 from Windows 10 x64, see https://bugzilla.mozilla.org/show_bug.cgi?id=1279925 */
+ || (1018 == gdef_len && 62828 == gpos_len && 24572 == gsub_len)
+ /* sha1sum:b9c84d820c49850d3d27ec498be93955b82772b5 tahoma.ttf from Windows 10 AU */
+ || (1006 == gdef_len && 61352 == gpos_len && 24576 == gsub_len)
+ /* sha1sum:2bdfaab28174bdadd2f3d4200a30a7ae31db79d2 tahomabd.ttf from Windows 10 AU */
+ || (1018 == gdef_len && 62834 == gpos_len && 24572 == gsub_len)
/* sha1sum:b0d36cf5a2fbe746a3dd277bffc6756a820807a7 Tahoma.ttf from Mac OS X 10.9 */
|| (832 == gdef_len && 47162 == gpos_len && 7324 == gsub_len)
/* sha1sum:12fc4538e84d461771b30c18b5eb6bd434e30fba Tahoma Bold.ttf from Mac OS X 10.9 */
|| (844 == gdef_len && 45474 == gpos_len && 7302 == gsub_len)
+ /* sha1sum:eb8afadd28e9cf963e886b23a30b44ab4fd83acc himalaya.ttf from Windows 7 */
+ || (180 == gdef_len && 7254 == gpos_len && 13054 == gsub_len)
/* sha1sum:73da7f025b238a3f737aa1fde22577a6370f77b0 himalaya.ttf from Windows 8 */
|| (192 == gdef_len && 7254 == gpos_len && 12638 == gsub_len)
/* sha1sum:6e80fd1c0b059bbee49272401583160dc1e6a427 himalaya.ttf from Windows 8.1 */
@@ -124,6 +137,14 @@ _hb_ot_layout_create (hb_face_t *face)
/* 2c0c90c6f6087ffbfea76589c93113a9cbb0e75f cantarell-fonts-0.0.21/otf/Cantarell-Bold.otf */
/* 55461f5b853c6da88069ffcdf7f4dd3f8d7e3e6b cantarell-fonts-0.0.21/otf/Cantarell-Bold-Oblique.otf */
|| (188 == gdef_len && 3426 == gpos_len && 264 == gsub_len)
+ /* d125afa82a77a6475ac0e74e7c207914af84b37a padauk-2.80/Padauk.ttf RHEL 7.2 */
+ || (1058 == gdef_len && 11818 == gpos_len && 47032 == gsub_len)
+ /* 0f7b80437227b90a577cc078c0216160ae61b031 padauk-2.80/Padauk-Bold.ttf RHEL 7.2*/
+ || (1046 == gdef_len && 12600 == gpos_len && 47030 == gsub_len)
+ /* d3dde9aa0a6b7f8f6a89ef1002e9aaa11b882290 padauk-2.80/Padauk.ttf Ubuntu 16.04 */
+ || (1058 == gdef_len && 16770 == gpos_len && 71796 == gsub_len)
+ /* 5f3c98ccccae8a953be2d122c1b3a77fd805093f padauk-2.80/Padauk-Bold.ttf Ubuntu 16.04 */
+ || (1046 == gdef_len && 17862 == gpos_len && 71790 == gsub_len)
/* 6c93b63b64e8b2c93f5e824e78caca555dc887c7 padauk-2.80/Padauk-book.ttf */
|| (1046 == gdef_len && 17112 == gpos_len && 71788 == gsub_len)
/* d89b1664058359b8ec82e35d3531931125991fb9 padauk-2.80/Padauk-bookbold.ttf */
@@ -132,6 +153,9 @@ _hb_ot_layout_create (hb_face_t *face)
|| (1330 == gdef_len && 57938 == gpos_len && 109904 == gsub_len)
/* 91fcc10cf15e012d27571e075b3b4dfe31754a8a padauk-3.0/Padauk-bookbold.ttf */
|| (1330 == gdef_len && 58972 == gpos_len && 109904 == gsub_len)
+ /* sha1sum: c26e41d567ed821bed997e937bc0c41435689e85 Padauk.ttf
+ * "Padauk Regular" "Version 2.5", see https://crbug.com/681813 */
+ || (1004 == gdef_len && 14836 == gpos_len && 59092 == gsub_len)
)
{
/* Many versions of Tahoma have bad GDEF tables that incorrectly classify some spacing marks
@@ -156,7 +180,7 @@ _hb_ot_layout_create (hb_face_t *face)
(layout->gpos_lookup_count && !layout->gpos_accels)))
{
_hb_ot_layout_destroy (layout);
- return NULL;
+ return nullptr;
}
for (unsigned int i = 0; i < layout->gsub_lookup_count; i++)
@@ -181,7 +205,10 @@ _hb_ot_layout_destroy (hb_ot_layout_t *layout)
hb_blob_destroy (layout->gdef_blob);
hb_blob_destroy (layout->gsub_blob);
hb_blob_destroy (layout->gpos_blob);
- hb_blob_destroy (layout->math_blob);
+
+ layout->math.fini ();
+ layout->fvar.fini ();
+ layout->avar.fini ();
free (layout);
}
@@ -256,7 +283,7 @@ hb_ot_layout_get_ligature_carets (hb_font_t *font,
hb_codepoint_t glyph,
unsigned int start_offset,
unsigned int *caret_count /* IN/OUT */,
- int *caret_array /* OUT */)
+ hb_position_t *caret_array /* OUT */)
{
return _get_gdef (font->face).get_lig_carets (font, direction, glyph, start_offset, caret_count, caret_array);
}
@@ -298,7 +325,7 @@ hb_ot_layout_table_find_script (hb_face_t *face,
hb_tag_t script_tag,
unsigned int *script_index)
{
- ASSERT_STATIC (OT::Index::NOT_FOUND_INDEX == HB_OT_LAYOUT_NO_SCRIPT_INDEX);
+ static_assert ((OT::Index::NOT_FOUND_INDEX == HB_OT_LAYOUT_NO_SCRIPT_INDEX), "");
const OT::GSUBGPOS &g = get_gsubgpos_table (face, table_tag);
if (g.find_script_index (script_tag, script_index))
@@ -329,7 +356,7 @@ hb_ot_layout_table_choose_script (hb_face_t *face,
unsigned int *script_index,
hb_tag_t *chosen_script)
{
- ASSERT_STATIC (OT::Index::NOT_FOUND_INDEX == HB_OT_LAYOUT_NO_SCRIPT_INDEX);
+ static_assert ((OT::Index::NOT_FOUND_INDEX == HB_OT_LAYOUT_NO_SCRIPT_INDEX), "");
const OT::GSUBGPOS &g = get_gsubgpos_table (face, table_tag);
while (*script_tags)
@@ -388,7 +415,7 @@ hb_ot_layout_table_find_feature (hb_face_t *face,
hb_tag_t feature_tag,
unsigned int *feature_index)
{
- ASSERT_STATIC (OT::Index::NOT_FOUND_INDEX == HB_OT_LAYOUT_NO_FEATURE_INDEX);
+ static_assert ((OT::Index::NOT_FOUND_INDEX == HB_OT_LAYOUT_NO_FEATURE_INDEX), "");
const OT::GSUBGPOS &g = get_gsubgpos_table (face, table_tag);
unsigned int num_features = g.get_feature_count ();
@@ -425,7 +452,7 @@ hb_ot_layout_script_find_language (hb_face_t *face,
hb_tag_t language_tag,
unsigned int *language_index)
{
- ASSERT_STATIC (OT::Index::NOT_FOUND_INDEX == HB_OT_LAYOUT_DEFAULT_LANGUAGE_INDEX);
+ static_assert ((OT::Index::NOT_FOUND_INDEX == HB_OT_LAYOUT_DEFAULT_LANGUAGE_INDEX), "");
const OT::Script &s = get_gsubgpos_table (face, table_tag).get_script (script_index);
if (s.find_lang_sys_index (language_tag, language_index))
@@ -451,7 +478,7 @@ hb_ot_layout_language_get_required_feature_index (hb_face_t *face,
script_index,
language_index,
feature_index,
- NULL);
+ nullptr);
}
/**
@@ -504,7 +531,7 @@ hb_ot_layout_language_get_feature_tags (hb_face_t *face,
const OT::GSUBGPOS &g = get_gsubgpos_table (face, table_tag);
const OT::LangSys &l = g.get_script (script_index).get_lang_sys (language_index);
- ASSERT_STATIC (sizeof (unsigned int) == sizeof (hb_tag_t));
+ static_assert ((sizeof (unsigned int) == sizeof (hb_tag_t)), "");
unsigned int ret = l.get_feature_indexes (start_offset, feature_count, (unsigned int *) feature_tags);
if (feature_tags) {
@@ -525,7 +552,7 @@ hb_ot_layout_language_find_feature (hb_face_t *face,
hb_tag_t feature_tag,
unsigned int *feature_index)
{
- ASSERT_STATIC (OT::Index::NOT_FOUND_INDEX == HB_OT_LAYOUT_NO_FEATURE_INDEX);
+ static_assert ((OT::Index::NOT_FOUND_INDEX == HB_OT_LAYOUT_NO_FEATURE_INDEX), "");
const OT::GSUBGPOS &g = get_gsubgpos_table (face, table_tag);
const OT::LangSys &l = g.get_script (script_index).get_lang_sys (language_index);
@@ -574,6 +601,7 @@ unsigned int
hb_ot_layout_table_get_lookup_count (hb_face_t *face,
hb_tag_t table_tag)
{
+ if (unlikely (!hb_ot_shaper_face_data_ensure (face))) return 0;
switch (table_tag)
{
case HB_OT_TAG_GSUB:
@@ -629,7 +657,7 @@ _hb_ot_layout_collect_lookups_features (hb_face_t *face,
script_index,
language_index,
&required_feature_index,
- NULL))
+ nullptr))
_hb_ot_layout_collect_lookups_lookups (face,
table_tag,
required_feature_index,
@@ -698,7 +726,7 @@ _hb_ot_layout_collect_lookups_languages (hb_face_t *face,
unsigned int count = hb_ot_layout_script_get_language_tags (face,
table_tag,
script_index,
- 0, NULL, NULL);
+ 0, nullptr, nullptr);
for (unsigned int language_index = 0; language_index < count; language_index++)
_hb_ot_layout_collect_lookups_features (face,
table_tag,
@@ -745,7 +773,7 @@ hb_ot_layout_collect_lookups (hb_face_t *face,
/* All scripts */
unsigned int count = hb_ot_layout_table_get_script_tags (face,
table_tag,
- 0, NULL, NULL);
+ 0, nullptr, nullptr);
for (unsigned int script_index = 0; script_index < count; script_index++)
_hb_ot_layout_collect_lookups_languages (face,
table_tag,
@@ -782,10 +810,10 @@ void
hb_ot_layout_lookup_collect_glyphs (hb_face_t *face,
hb_tag_t table_tag,
unsigned int lookup_index,
- hb_set_t *glyphs_before, /* OUT. May be NULL */
- hb_set_t *glyphs_input, /* OUT. May be NULL */
- hb_set_t *glyphs_after, /* OUT. May be NULL */
- hb_set_t *glyphs_output /* OUT. May be NULL */)
+ hb_set_t *glyphs_before, /* OUT. May be nullptr */
+ hb_set_t *glyphs_input, /* OUT. May be nullptr */
+ hb_set_t *glyphs_after, /* OUT. May be nullptr */
+ hb_set_t *glyphs_output /* OUT. May be nullptr */)
{
if (unlikely (!hb_ot_shaper_face_data_ensure (face))) return;
@@ -836,7 +864,7 @@ hb_ot_layout_feature_with_variations_get_lookups (hb_face_t *face,
unsigned int *lookup_count /* IN/OUT */,
unsigned int *lookup_indexes /* OUT */)
{
- ASSERT_STATIC (OT::FeatureVariations::NOT_FOUND_INDEX == HB_OT_LAYOUT_NO_VARIATIONS_INDEX);
+ static_assert ((OT::FeatureVariations::NOT_FOUND_INDEX == HB_OT_LAYOUT_NO_VARIATIONS_INDEX), "");
const OT::GSUBGPOS &g = get_gsubgpos_table (face, table_tag);
const OT::Feature &f = g.get_feature_variation (feature_index, variations_index);
@@ -944,11 +972,11 @@ hb_ot_layout_position_finish_offsets (hb_font_t *font, hb_buffer_t *buffer)
**/
hb_bool_t
hb_ot_layout_get_size_params (hb_face_t *face,
- unsigned int *design_size, /* OUT. May be NULL */
- unsigned int *subfamily_id, /* OUT. May be NULL */
- unsigned int *subfamily_name_id, /* OUT. May be NULL */
- unsigned int *range_start, /* OUT. May be NULL */
- unsigned int *range_end /* OUT. May be NULL */)
+ unsigned int *design_size, /* OUT. May be nullptr */
+ unsigned int *subfamily_id, /* OUT. May be nullptr */
+ unsigned int *subfamily_name_id, /* OUT. May be nullptr */
+ unsigned int *range_start, /* OUT. May be nullptr */
+ unsigned int *range_end /* OUT. May be nullptr */)
{
const OT::GPOS &gpos = _get_gpos (face);
const hb_tag_t tag = HB_TAG ('s','i','z','e');
@@ -1196,6 +1224,7 @@ inline void hb_ot_map_t::apply (const Proxy &proxy,
c.set_lookup_index (lookup_index);
c.set_lookup_mask (lookups[table_index][i].mask);
c.set_auto_zwj (lookups[table_index][i].auto_zwj);
+ c.set_auto_zwnj (lookups[table_index][i].auto_zwnj);
apply_string<Proxy> (&c,
proxy.table.get_lookup (lookup_index),
proxy.accels[lookup_index]);
diff --git a/src/3rdparty/harfbuzz-ng/src/hb-ot-map-private.hh b/src/3rdparty/harfbuzz-ng/src/hb-ot-map-private.hh
index 0395c9c22f..97b92cc9a8 100644
--- a/src/3rdparty/harfbuzz-ng/src/hb-ot-map-private.hh
+++ b/src/3rdparty/harfbuzz-ng/src/hb-ot-map-private.hh
@@ -50,19 +50,25 @@ struct hb_ot_map_t
hb_mask_t mask;
hb_mask_t _1_mask; /* mask for value=1, for quick access */
unsigned int needs_fallback : 1;
+ unsigned int auto_zwnj : 1;
unsigned int auto_zwj : 1;
- static int cmp (const feature_map_t *a, const feature_map_t *b)
- { return a->tag < b->tag ? -1 : a->tag > b->tag ? 1 : 0; }
+ inline int cmp (const hb_tag_t *tag_) const
+ { return *tag_ < tag ? -1 : *tag_ > tag ? 1 : 0; }
};
struct lookup_map_t {
unsigned short index;
+ unsigned short auto_zwnj : 1;
unsigned short auto_zwj : 1;
hb_mask_t mask;
- static int cmp (const lookup_map_t *a, const lookup_map_t *b)
- { return a->index < b->index ? -1 : a->index > b->index ? 1 : 0; }
+ static int cmp (const void *pa, const void *pb)
+ {
+ const lookup_map_t *a = (const lookup_map_t *) pa;
+ const lookup_map_t *b = (const lookup_map_t *) pb;
+ return a->index < b->index ? -1 : a->index > b->index ? 1 : 0;
+ }
};
typedef void (*pause_func_t) (const struct hb_ot_shape_plan_t *plan, hb_font_t *font, hb_buffer_t *buffer);
@@ -77,7 +83,7 @@ struct hb_ot_map_t
inline hb_mask_t get_global_mask (void) const { return global_mask; }
- inline hb_mask_t get_mask (hb_tag_t feature_tag, unsigned int *shift = NULL) const {
+ inline hb_mask_t get_mask (hb_tag_t feature_tag, unsigned int *shift = nullptr) const {
const feature_map_t *map = features.bsearch (&feature_tag);
if (shift) *shift = map ? map->shift : 0;
return map ? map->mask : 0;
@@ -106,14 +112,14 @@ struct hb_ot_map_t
inline void get_stage_lookups (unsigned int table_index, unsigned int stage,
const struct lookup_map_t **plookups, unsigned int *lookup_count) const {
if (unlikely (stage == (unsigned int) -1)) {
- *plookups = NULL;
+ *plookups = nullptr;
*lookup_count = 0;
return;
}
assert (stage <= stages[table_index].len);
unsigned int start = stage ? stages[table_index][stage - 1].last_lookup : 0;
unsigned int end = stage < stages[table_index].len ? stages[table_index][stage].last_lookup : lookups[table_index].len;
- *plookups = &lookups[table_index][start];
+ *plookups = end == start ? nullptr : &lookups[table_index][start];
*lookup_count = end - start;
}
@@ -150,8 +156,9 @@ enum hb_ot_map_feature_flags_t {
F_NONE = 0x0000u,
F_GLOBAL = 0x0001u, /* Feature applies to all characters; results in no mask allocated for it. */
F_HAS_FALLBACK = 0x0002u, /* Has fallback implementation, so include mask bit even if feature not found. */
- F_MANUAL_ZWJ = 0x0004u, /* Don't skip over ZWJ when matching. */
- F_GLOBAL_SEARCH = 0x0008u /* If feature not found in LangSys, look for it in global feature list and pick one. */
+ F_MANUAL_ZWNJ = 0x0004u, /* Don't skip over ZWNJ when matching **context**. */
+ F_MANUAL_ZWJ = 0x0008u, /* Don't skip over ZWJ when matching **input**. */
+ F_GLOBAL_SEARCH = 0x0010u /* If feature not found in LangSys, look for it in global feature list and pick one. */
};
HB_MARK_AS_FLAG_T (hb_ot_map_feature_flags_t);
/* Macro version for where const is desired. */
@@ -196,7 +203,8 @@ struct hb_ot_map_builder_t
unsigned int feature_index,
unsigned int variations_index,
hb_mask_t mask,
- bool auto_zwj);
+ bool auto_zwnj = true,
+ bool auto_zwj = true);
struct feature_info_t {
hb_tag_t tag;
@@ -206,9 +214,13 @@ struct hb_ot_map_builder_t
unsigned int default_value; /* for non-global features, what should the unset glyphs take */
unsigned int stage[2]; /* GSUB/GPOS */
- static int cmp (const feature_info_t *a, const feature_info_t *b)
- { return (a->tag != b->tag) ? (a->tag < b->tag ? -1 : 1) :
- (a->seq < b->seq ? -1 : a->seq > b->seq ? 1 : 0); }
+ static int cmp (const void *pa, const void *pb)
+ {
+ const feature_info_t *a = (const feature_info_t *) pa;
+ const feature_info_t *b = (const feature_info_t *) pb;
+ return (a->tag != b->tag) ? (a->tag < b->tag ? -1 : 1) :
+ (a->seq < b->seq ? -1 : a->seq > b->seq ? 1 : 0);
+ }
};
struct stage_info_t {
diff --git a/src/3rdparty/harfbuzz-ng/src/hb-ot-map.cc b/src/3rdparty/harfbuzz-ng/src/hb-ot-map.cc
index 9b331d5210..ea9bde9a66 100644
--- a/src/3rdparty/harfbuzz-ng/src/hb-ot-map.cc
+++ b/src/3rdparty/harfbuzz-ng/src/hb-ot-map.cc
@@ -85,6 +85,7 @@ hb_ot_map_builder_t::add_lookups (hb_ot_map_t &m,
unsigned int feature_index,
unsigned int variations_index,
hb_mask_t mask,
+ bool auto_zwnj,
bool auto_zwj)
{
unsigned int lookup_indices[32];
@@ -112,6 +113,7 @@ hb_ot_map_builder_t::add_lookups (hb_ot_map_t &m,
return;
lookup->mask = mask;
lookup->index = lookup_indices[i];
+ lookup->auto_zwnj = auto_zwnj;
lookup->auto_zwj = auto_zwj;
}
@@ -136,7 +138,11 @@ hb_ot_map_builder_t::compile (hb_ot_map_t &m,
const int *coords,
unsigned int num_coords)
{
- m.global_mask = 1;
+ static_assert ((!(HB_GLYPH_FLAG_DEFINED & (HB_GLYPH_FLAG_DEFINED + 1))), "");
+ unsigned int global_bit_mask = HB_GLYPH_FLAG_DEFINED + 1;
+ unsigned int global_bit_shift = _hb_popcount32 (HB_GLYPH_FLAG_DEFINED);
+
+ m.global_mask = global_bit_mask;
unsigned int required_feature_index[2];
hb_tag_t required_feature_tag[2];
@@ -188,7 +194,8 @@ hb_ot_map_builder_t::compile (hb_ot_map_t &m,
/* Allocate bits now */
- unsigned int next_bit = 1;
+ unsigned int next_bit = global_bit_shift + 1;
+
for (unsigned int i = 0; i < feature_infos.len; i++)
{
const feature_info_t *info = &feature_infos[i];
@@ -243,11 +250,12 @@ hb_ot_map_builder_t::compile (hb_ot_map_t &m,
map->index[1] = feature_index[1];
map->stage[0] = info->stage[0];
map->stage[1] = info->stage[1];
+ map->auto_zwnj = !(info->flags & F_MANUAL_ZWNJ);
map->auto_zwj = !(info->flags & F_MANUAL_ZWJ);
if ((info->flags & F_GLOBAL) && info->max_value == 1) {
/* Uses the global bit */
- map->shift = 0;
- map->mask = 1;
+ map->shift = global_bit_shift;
+ map->mask = global_bit_mask;
} else {
map->shift = next_bit;
map->mask = (1u << (next_bit + bits_needed)) - (1u << next_bit);
@@ -261,8 +269,8 @@ hb_ot_map_builder_t::compile (hb_ot_map_t &m,
feature_infos.shrink (0); /* Done with these */
- add_gsub_pause (NULL);
- add_gpos_pause (NULL);
+ add_gsub_pause (nullptr);
+ add_gpos_pause (nullptr);
for (unsigned int table_index = 0; table_index < 2; table_index++)
{
@@ -284,8 +292,7 @@ hb_ot_map_builder_t::compile (hb_ot_map_t &m,
add_lookups (m, face, table_index,
required_feature_index[table_index],
variations_index,
- 1 /* mask */,
- true /* auto_zwj */);
+ global_bit_mask);
for (unsigned i = 0; i < m.features.len; i++)
if (m.features[i].stage[table_index] == stage)
@@ -293,6 +300,7 @@ hb_ot_map_builder_t::compile (hb_ot_map_t &m,
m.features[i].index[table_index],
variations_index,
m.features[i].mask,
+ m.features[i].auto_zwnj,
m.features[i].auto_zwj);
/* Sort lookups and merge duplicates */
@@ -307,6 +315,7 @@ hb_ot_map_builder_t::compile (hb_ot_map_t &m,
else
{
m.lookups[table_index][j].mask |= m.lookups[table_index][i].mask;
+ m.lookups[table_index][j].auto_zwnj &= m.lookups[table_index][i].auto_zwnj;
m.lookups[table_index][j].auto_zwj &= m.lookups[table_index][i].auto_zwj;
}
m.lookups[table_index].shrink (j + 1);
diff --git a/src/3rdparty/harfbuzz-ng/src/hb-ot-math-table.hh b/src/3rdparty/harfbuzz-ng/src/hb-ot-math-table.hh
new file mode 100644
index 0000000000..7dc3283a28
--- /dev/null
+++ b/src/3rdparty/harfbuzz-ng/src/hb-ot-math-table.hh
@@ -0,0 +1,722 @@
+/*
+ * Copyright © 2016 Igalia S.L.
+ *
+ * This is part of HarfBuzz, a text shaping library.
+ *
+ * Permission is hereby granted, without written agreement and without
+ * license or royalty fees, to use, copy, modify, and distribute this
+ * software and its documentation for any purpose, provided that the
+ * above copyright notice and the following two paragraphs appear in
+ * all copies of this software.
+ *
+ * IN NO EVENT SHALL THE COPYRIGHT HOLDER BE LIABLE TO ANY PARTY FOR
+ * DIRECT, INDIRECT, SPECIAL, INCIDENTAL, OR CONSEQUENTIAL DAMAGES
+ * ARISING OUT OF THE USE OF THIS SOFTWARE AND ITS DOCUMENTATION, EVEN
+ * IF THE COPYRIGHT HOLDER HAS BEEN ADVISED OF THE POSSIBILITY OF SUCH
+ * DAMAGE.
+ *
+ * THE COPYRIGHT HOLDER SPECIFICALLY DISCLAIMS ANY WARRANTIES, INCLUDING,
+ * BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND
+ * FITNESS FOR A PARTICULAR PURPOSE. THE SOFTWARE PROVIDED HEREUNDER IS
+ * ON AN "AS IS" BASIS, AND THE COPYRIGHT HOLDER HAS NO OBLIGATION TO
+ * PROVIDE MAINTENANCE, SUPPORT, UPDATES, ENHANCEMENTS, OR MODIFICATIONS.
+ *
+ * Igalia Author(s): Frédéric Wang
+ */
+
+#ifndef HB_OT_MATH_TABLE_HH
+#define HB_OT_MATH_TABLE_HH
+
+#include "hb-open-type-private.hh"
+#include "hb-ot-layout-common-private.hh"
+#include "hb-ot-math.h"
+
+namespace OT {
+
+
+struct MathValueRecord
+{
+ inline hb_position_t get_x_value (hb_font_t *font, const void *base) const
+ { return font->em_scale_x (value) + (base+deviceTable).get_x_delta (font); }
+ inline hb_position_t get_y_value (hb_font_t *font, const void *base) const
+ { return font->em_scale_y (value) + (base+deviceTable).get_y_delta (font); }
+
+ inline bool sanitize (hb_sanitize_context_t *c, const void *base) const
+ {
+ TRACE_SANITIZE (this);
+ return_trace (c->check_struct (this) && deviceTable.sanitize (c, base));
+ }
+
+ protected:
+ INT16 value; /* The X or Y value in design units */
+ OffsetTo<Device> deviceTable; /* Offset to the device table - from the
+ * beginning of parent table. May be nullptr.
+ * Suggested format for device table is 1. */
+
+ public:
+ DEFINE_SIZE_STATIC (4);
+};
+
+struct MathConstants
+{
+ inline bool sanitize_math_value_records (hb_sanitize_context_t *c) const
+ {
+ TRACE_SANITIZE (this);
+
+ unsigned int count = ARRAY_LENGTH (mathValueRecords);
+ for (unsigned int i = 0; i < count; i++)
+ if (!mathValueRecords[i].sanitize (c, this))
+ return_trace (false);
+
+ return_trace (true);
+ }
+
+ inline bool sanitize (hb_sanitize_context_t *c) const
+ {
+ TRACE_SANITIZE (this);
+ return_trace (c->check_struct (this) && sanitize_math_value_records(c));
+ }
+
+ inline hb_position_t get_value (hb_ot_math_constant_t constant,
+ hb_font_t *font) const
+ {
+ switch (constant) {
+
+ case HB_OT_MATH_CONSTANT_SCRIPT_PERCENT_SCALE_DOWN:
+ case HB_OT_MATH_CONSTANT_SCRIPT_SCRIPT_PERCENT_SCALE_DOWN:
+ return percentScaleDown[constant - HB_OT_MATH_CONSTANT_SCRIPT_PERCENT_SCALE_DOWN];
+
+ case HB_OT_MATH_CONSTANT_DELIMITED_SUB_FORMULA_MIN_HEIGHT:
+ case HB_OT_MATH_CONSTANT_DISPLAY_OPERATOR_MIN_HEIGHT:
+ return font->em_scale_y (minHeight[constant - HB_OT_MATH_CONSTANT_DELIMITED_SUB_FORMULA_MIN_HEIGHT]);
+
+ case HB_OT_MATH_CONSTANT_RADICAL_KERN_AFTER_DEGREE:
+ case HB_OT_MATH_CONSTANT_RADICAL_KERN_BEFORE_DEGREE:
+ case HB_OT_MATH_CONSTANT_SKEWED_FRACTION_HORIZONTAL_GAP:
+ case HB_OT_MATH_CONSTANT_SPACE_AFTER_SCRIPT:
+ return mathValueRecords[constant - HB_OT_MATH_CONSTANT_MATH_LEADING].get_x_value(font, this);
+
+ case HB_OT_MATH_CONSTANT_ACCENT_BASE_HEIGHT:
+ case HB_OT_MATH_CONSTANT_AXIS_HEIGHT:
+ case HB_OT_MATH_CONSTANT_FLATTENED_ACCENT_BASE_HEIGHT:
+ case HB_OT_MATH_CONSTANT_FRACTION_DENOMINATOR_DISPLAY_STYLE_SHIFT_DOWN:
+ case HB_OT_MATH_CONSTANT_FRACTION_DENOMINATOR_GAP_MIN:
+ case HB_OT_MATH_CONSTANT_FRACTION_DENOMINATOR_SHIFT_DOWN:
+ case HB_OT_MATH_CONSTANT_FRACTION_DENOM_DISPLAY_STYLE_GAP_MIN:
+ case HB_OT_MATH_CONSTANT_FRACTION_NUMERATOR_DISPLAY_STYLE_SHIFT_UP:
+ case HB_OT_MATH_CONSTANT_FRACTION_NUMERATOR_GAP_MIN:
+ case HB_OT_MATH_CONSTANT_FRACTION_NUMERATOR_SHIFT_UP:
+ case HB_OT_MATH_CONSTANT_FRACTION_NUM_DISPLAY_STYLE_GAP_MIN:
+ case HB_OT_MATH_CONSTANT_FRACTION_RULE_THICKNESS:
+ case HB_OT_MATH_CONSTANT_LOWER_LIMIT_BASELINE_DROP_MIN:
+ case HB_OT_MATH_CONSTANT_LOWER_LIMIT_GAP_MIN:
+ case HB_OT_MATH_CONSTANT_MATH_LEADING:
+ case HB_OT_MATH_CONSTANT_OVERBAR_EXTRA_ASCENDER:
+ case HB_OT_MATH_CONSTANT_OVERBAR_RULE_THICKNESS:
+ case HB_OT_MATH_CONSTANT_OVERBAR_VERTICAL_GAP:
+ case HB_OT_MATH_CONSTANT_RADICAL_DISPLAY_STYLE_VERTICAL_GAP:
+ case HB_OT_MATH_CONSTANT_RADICAL_EXTRA_ASCENDER:
+ case HB_OT_MATH_CONSTANT_RADICAL_RULE_THICKNESS:
+ case HB_OT_MATH_CONSTANT_RADICAL_VERTICAL_GAP:
+ case HB_OT_MATH_CONSTANT_SKEWED_FRACTION_VERTICAL_GAP:
+ case HB_OT_MATH_CONSTANT_STACK_BOTTOM_DISPLAY_STYLE_SHIFT_DOWN:
+ case HB_OT_MATH_CONSTANT_STACK_BOTTOM_SHIFT_DOWN:
+ case HB_OT_MATH_CONSTANT_STACK_DISPLAY_STYLE_GAP_MIN:
+ case HB_OT_MATH_CONSTANT_STACK_GAP_MIN:
+ case HB_OT_MATH_CONSTANT_STACK_TOP_DISPLAY_STYLE_SHIFT_UP:
+ case HB_OT_MATH_CONSTANT_STACK_TOP_SHIFT_UP:
+ case HB_OT_MATH_CONSTANT_STRETCH_STACK_BOTTOM_SHIFT_DOWN:
+ case HB_OT_MATH_CONSTANT_STRETCH_STACK_GAP_ABOVE_MIN:
+ case HB_OT_MATH_CONSTANT_STRETCH_STACK_GAP_BELOW_MIN:
+ case HB_OT_MATH_CONSTANT_STRETCH_STACK_TOP_SHIFT_UP:
+ case HB_OT_MATH_CONSTANT_SUBSCRIPT_BASELINE_DROP_MIN:
+ case HB_OT_MATH_CONSTANT_SUBSCRIPT_SHIFT_DOWN:
+ case HB_OT_MATH_CONSTANT_SUBSCRIPT_TOP_MAX:
+ case HB_OT_MATH_CONSTANT_SUB_SUPERSCRIPT_GAP_MIN:
+ case HB_OT_MATH_CONSTANT_SUPERSCRIPT_BASELINE_DROP_MAX:
+ case HB_OT_MATH_CONSTANT_SUPERSCRIPT_BOTTOM_MAX_WITH_SUBSCRIPT:
+ case HB_OT_MATH_CONSTANT_SUPERSCRIPT_BOTTOM_MIN:
+ case HB_OT_MATH_CONSTANT_SUPERSCRIPT_SHIFT_UP:
+ case HB_OT_MATH_CONSTANT_SUPERSCRIPT_SHIFT_UP_CRAMPED:
+ case HB_OT_MATH_CONSTANT_UNDERBAR_EXTRA_DESCENDER:
+ case HB_OT_MATH_CONSTANT_UNDERBAR_RULE_THICKNESS:
+ case HB_OT_MATH_CONSTANT_UNDERBAR_VERTICAL_GAP:
+ case HB_OT_MATH_CONSTANT_UPPER_LIMIT_BASELINE_RISE_MIN:
+ case HB_OT_MATH_CONSTANT_UPPER_LIMIT_GAP_MIN:
+ return mathValueRecords[constant - HB_OT_MATH_CONSTANT_MATH_LEADING].get_y_value(font, this);
+
+ case HB_OT_MATH_CONSTANT_RADICAL_DEGREE_BOTTOM_RAISE_PERCENT:
+ return radicalDegreeBottomRaisePercent;
+
+ default:
+ return 0;
+ }
+ }
+
+ protected:
+ INT16 percentScaleDown[2];
+ UINT16 minHeight[2];
+ MathValueRecord mathValueRecords[51];
+ INT16 radicalDegreeBottomRaisePercent;
+
+ public:
+ DEFINE_SIZE_STATIC (214);
+};
+
+struct MathItalicsCorrectionInfo
+{
+ inline bool sanitize (hb_sanitize_context_t *c) const
+ {
+ TRACE_SANITIZE (this);
+ return_trace (c->check_struct (this) &&
+ coverage.sanitize (c, this) &&
+ italicsCorrection.sanitize (c, this));
+ }
+
+ inline hb_position_t get_value (hb_codepoint_t glyph,
+ hb_font_t *font) const
+ {
+ unsigned int index = (this+coverage).get_coverage (glyph);
+ return italicsCorrection[index].get_x_value (font, this);
+ }
+
+ protected:
+ OffsetTo<Coverage> coverage; /* Offset to Coverage table -
+ * from the beginning of
+ * MathItalicsCorrectionInfo
+ * table. */
+ ArrayOf<MathValueRecord> italicsCorrection; /* Array of MathValueRecords
+ * defining italics correction
+ * values for each
+ * covered glyph. */
+
+ public:
+ DEFINE_SIZE_ARRAY (4, italicsCorrection);
+};
+
+struct MathTopAccentAttachment
+{
+ inline bool sanitize (hb_sanitize_context_t *c) const
+ {
+ TRACE_SANITIZE (this);
+ return_trace (c->check_struct (this) &&
+ topAccentCoverage.sanitize (c, this) &&
+ topAccentAttachment.sanitize (c, this));
+ }
+
+ inline hb_position_t get_value (hb_codepoint_t glyph,
+ hb_font_t *font) const
+ {
+ unsigned int index = (this+topAccentCoverage).get_coverage (glyph);
+ if (index == NOT_COVERED)
+ return font->get_glyph_h_advance (glyph) / 2;
+ return topAccentAttachment[index].get_x_value(font, this);
+ }
+
+ protected:
+ OffsetTo<Coverage> topAccentCoverage; /* Offset to Coverage table -
+ * from the beginning of
+ * MathTopAccentAttachment
+ * table. */
+ ArrayOf<MathValueRecord> topAccentAttachment; /* Array of MathValueRecords
+ * defining top accent
+ * attachment points for each
+ * covered glyph. */
+
+ public:
+ DEFINE_SIZE_ARRAY (2 + 2, topAccentAttachment);
+};
+
+struct MathKern
+{
+ inline bool sanitize_math_value_records (hb_sanitize_context_t *c) const
+ {
+ TRACE_SANITIZE (this);
+ unsigned int count = 2 * heightCount + 1;
+ for (unsigned int i = 0; i < count; i++)
+ if (!mathValueRecords[i].sanitize (c, this)) return_trace (false);
+ return_trace (true);
+ }
+
+ inline bool sanitize (hb_sanitize_context_t *c) const
+ {
+ TRACE_SANITIZE (this);
+ return_trace (c->check_struct (this) &&
+ c->check_array (mathValueRecords,
+ mathValueRecords[0].static_size,
+ 2 * heightCount + 1) &&
+ sanitize_math_value_records (c));
+ }
+
+ inline hb_position_t get_value (hb_position_t correction_height, hb_font_t *font) const
+ {
+ const MathValueRecord* correctionHeight = mathValueRecords;
+ const MathValueRecord* kernValue = mathValueRecords + heightCount;
+ int sign = font->y_scale < 0 ? -1 : +1;
+
+ /* The description of the MathKern table is a ambiguous, but interpreting
+ * "between the two heights found at those indexes" for 0 < i < len as
+ *
+ * correctionHeight[i-1] < correction_height <= correctionHeight[i]
+ *
+ * makes the result consistent with the limit cases and we can just use the
+ * binary search algorithm of std::upper_bound:
+ */
+ unsigned int i = 0;
+ unsigned int count = heightCount;
+ while (count > 0)
+ {
+ unsigned int half = count / 2;
+ hb_position_t height = correctionHeight[i + half].get_y_value(font, this);
+ if (sign * height < sign * correction_height)
+ {
+ i += half + 1;
+ count -= half + 1;
+ } else
+ count = half;
+ }
+ return kernValue[i].get_x_value(font, this);
+ }
+
+ protected:
+ UINT16 heightCount;
+ MathValueRecord mathValueRecords[VAR]; /* Array of correction heights at
+ * which the kern value changes.
+ * Sorted by the height value in
+ * design units (heightCount entries),
+ * Followed by:
+ * Array of kern values corresponding
+ * to heights. (heightCount+1 entries).
+ */
+
+ public:
+ DEFINE_SIZE_ARRAY (2, mathValueRecords);
+};
+
+struct MathKernInfoRecord
+{
+ inline bool sanitize (hb_sanitize_context_t *c, const void *base) const
+ {
+ TRACE_SANITIZE (this);
+
+ unsigned int count = ARRAY_LENGTH (mathKern);
+ for (unsigned int i = 0; i < count; i++)
+ if (unlikely (!mathKern[i].sanitize (c, base)))
+ return_trace (false);
+
+ return_trace (true);
+ }
+
+ inline hb_position_t get_kerning (hb_ot_math_kern_t kern,
+ hb_position_t correction_height,
+ hb_font_t *font,
+ const void *base) const
+ {
+ unsigned int idx = kern;
+ if (unlikely (idx >= ARRAY_LENGTH (mathKern))) return 0;
+ return (base+mathKern[idx]).get_value (correction_height, font);
+ }
+
+ protected:
+ /* Offset to MathKern table for each corner -
+ * from the beginning of MathKernInfo table. May be nullptr. */
+ OffsetTo<MathKern> mathKern[4];
+
+ public:
+ DEFINE_SIZE_STATIC (8);
+};
+
+struct MathKernInfo
+{
+ inline bool sanitize (hb_sanitize_context_t *c) const
+ {
+ TRACE_SANITIZE (this);
+ return_trace (c->check_struct (this) &&
+ mathKernCoverage.sanitize (c, this) &&
+ mathKernInfoRecords.sanitize (c, this));
+ }
+
+ inline hb_position_t get_kerning (hb_codepoint_t glyph,
+ hb_ot_math_kern_t kern,
+ hb_position_t correction_height,
+ hb_font_t *font) const
+ {
+ unsigned int index = (this+mathKernCoverage).get_coverage (glyph);
+ return mathKernInfoRecords[index].get_kerning (kern, correction_height, font, this);
+ }
+
+ protected:
+ OffsetTo<Coverage> mathKernCoverage; /* Offset to Coverage table -
+ * from the beginning of the
+ * MathKernInfo table. */
+ ArrayOf<MathKernInfoRecord> mathKernInfoRecords; /* Array of
+ * MathKernInfoRecords,
+ * per-glyph information for
+ * mathematical positioning
+ * of subscripts and
+ * superscripts. */
+
+ public:
+ DEFINE_SIZE_ARRAY (4, mathKernInfoRecords);
+};
+
+struct MathGlyphInfo
+{
+ inline bool sanitize (hb_sanitize_context_t *c) const
+ {
+ TRACE_SANITIZE (this);
+ return_trace (c->check_struct (this) &&
+ mathItalicsCorrectionInfo.sanitize (c, this) &&
+ mathTopAccentAttachment.sanitize (c, this) &&
+ extendedShapeCoverage.sanitize (c, this) &&
+ mathKernInfo.sanitize(c, this));
+ }
+
+ inline hb_position_t
+ get_italics_correction (hb_codepoint_t glyph, hb_font_t *font) const
+ { return (this+mathItalicsCorrectionInfo).get_value (glyph, font); }
+
+ inline hb_position_t
+ get_top_accent_attachment (hb_codepoint_t glyph, hb_font_t *font) const
+ { return (this+mathTopAccentAttachment).get_value (glyph, font); }
+
+ inline bool is_extended_shape (hb_codepoint_t glyph) const
+ { return (this+extendedShapeCoverage).get_coverage (glyph) != NOT_COVERED; }
+
+ inline hb_position_t get_kerning (hb_codepoint_t glyph,
+ hb_ot_math_kern_t kern,
+ hb_position_t correction_height,
+ hb_font_t *font) const
+ { return (this+mathKernInfo).get_kerning (glyph, kern, correction_height, font); }
+
+ protected:
+ /* Offset to MathItalicsCorrectionInfo table -
+ * from the beginning of MathGlyphInfo table. */
+ OffsetTo<MathItalicsCorrectionInfo> mathItalicsCorrectionInfo;
+
+ /* Offset to MathTopAccentAttachment table -
+ * from the beginning of MathGlyphInfo table. */
+ OffsetTo<MathTopAccentAttachment> mathTopAccentAttachment;
+
+ /* Offset to coverage table for Extended Shape glyphs -
+ * from the beginning of MathGlyphInfo table. When the left or right glyph of
+ * a box is an extended shape variant, the (ink) box (and not the default
+ * position defined by values in MathConstants table) should be used for
+ * vertical positioning purposes. May be nullptr.. */
+ OffsetTo<Coverage> extendedShapeCoverage;
+
+ /* Offset to MathKernInfo table -
+ * from the beginning of MathGlyphInfo table. */
+ OffsetTo<MathKernInfo> mathKernInfo;
+
+ public:
+ DEFINE_SIZE_STATIC (8);
+};
+
+struct MathGlyphVariantRecord
+{
+ friend struct MathGlyphConstruction;
+
+ inline bool sanitize (hb_sanitize_context_t *c) const
+ {
+ TRACE_SANITIZE (this);
+ return_trace (c->check_struct (this));
+ }
+
+ protected:
+ GlyphID variantGlyph; /* Glyph ID for the variant. */
+ UINT16 advanceMeasurement; /* Advance width/height, in design units, of the
+ * variant, in the direction of requested
+ * glyph extension. */
+
+ public:
+ DEFINE_SIZE_STATIC (4);
+};
+
+struct PartFlags : UINT16
+{
+ enum Flags {
+ Extender = 0x0001u, /* If set, the part can be skipped or repeated. */
+
+ Defined = 0x0001u, /* All defined flags. */
+ };
+
+ public:
+ DEFINE_SIZE_STATIC (2);
+};
+
+struct MathGlyphPartRecord
+{
+ inline bool sanitize (hb_sanitize_context_t *c) const
+ {
+ TRACE_SANITIZE (this);
+ return_trace (c->check_struct (this));
+ }
+
+ inline void extract (hb_ot_math_glyph_part_t &out,
+ int scale,
+ hb_font_t *font) const
+ {
+ out.glyph = glyph;
+
+ out.start_connector_length = font->em_scale (startConnectorLength, scale);
+ out.end_connector_length = font->em_scale (endConnectorLength, scale);
+ out.full_advance = font->em_scale (fullAdvance, scale);
+
+ static_assert ((unsigned int) HB_MATH_GLYPH_PART_FLAG_EXTENDER ==
+ (unsigned int) PartFlags::Extender, "");
+
+ out.flags = (hb_ot_math_glyph_part_flags_t)
+ (unsigned int)
+ (partFlags & PartFlags::Defined);
+ }
+
+ protected:
+ GlyphID glyph; /* Glyph ID for the part. */
+ UINT16 startConnectorLength; /* Advance width/ height of the straight bar
+ * connector material, in design units, is at
+ * the beginning of the glyph, in the
+ * direction of the extension. */
+ UINT16 endConnectorLength; /* Advance width/ height of the straight bar
+ * connector material, in design units, is at
+ * the end of the glyph, in the direction of
+ * the extension. */
+ UINT16 fullAdvance; /* Full advance width/height for this part,
+ * in the direction of the extension.
+ * In design units. */
+ PartFlags partFlags; /* Part qualifiers. */
+
+ public:
+ DEFINE_SIZE_STATIC (10);
+};
+
+struct MathGlyphAssembly
+{
+ inline bool sanitize (hb_sanitize_context_t *c) const
+ {
+ TRACE_SANITIZE (this);
+ return_trace (c->check_struct (this) &&
+ italicsCorrection.sanitize(c, this) &&
+ partRecords.sanitize(c));
+ }
+
+ inline unsigned int get_parts (hb_direction_t direction,
+ hb_font_t *font,
+ unsigned int start_offset,
+ unsigned int *parts_count, /* IN/OUT */
+ hb_ot_math_glyph_part_t *parts /* OUT */,
+ hb_position_t *italics_correction /* OUT */) const
+ {
+ if (parts_count)
+ {
+ int scale = font->dir_scale (direction);
+ const MathGlyphPartRecord *arr =
+ partRecords.sub_array (start_offset, parts_count);
+ unsigned int count = *parts_count;
+ for (unsigned int i = 0; i < count; i++)
+ arr[i].extract (parts[i], scale, font);
+ }
+
+ if (italics_correction)
+ *italics_correction = italicsCorrection.get_x_value (font, this);
+
+ return partRecords.len;
+ }
+
+ protected:
+ MathValueRecord italicsCorrection; /* Italics correction of this
+ * MathGlyphAssembly. Should not
+ * depend on the assembly size. */
+ ArrayOf<MathGlyphPartRecord> partRecords; /* Array of part records, from
+ * left to right and bottom to
+ * top. */
+
+ public:
+ DEFINE_SIZE_ARRAY (6, partRecords);
+};
+
+struct MathGlyphConstruction
+{
+ inline bool sanitize (hb_sanitize_context_t *c) const
+ {
+ TRACE_SANITIZE (this);
+ return_trace (c->check_struct (this) &&
+ glyphAssembly.sanitize(c, this) &&
+ mathGlyphVariantRecord.sanitize(c));
+ }
+
+ inline const MathGlyphAssembly &get_assembly (void) const
+ { return this+glyphAssembly; }
+
+ inline unsigned int get_variants (hb_direction_t direction,
+ hb_font_t *font,
+ unsigned int start_offset,
+ unsigned int *variants_count, /* IN/OUT */
+ hb_ot_math_glyph_variant_t *variants /* OUT */) const
+ {
+ if (variants_count)
+ {
+ int scale = font->dir_scale (direction);
+ const MathGlyphVariantRecord *arr =
+ mathGlyphVariantRecord.sub_array (start_offset, variants_count);
+ unsigned int count = *variants_count;
+ for (unsigned int i = 0; i < count; i++)
+ {
+ variants[i].glyph = arr[i].variantGlyph;
+ variants[i].advance = font->em_scale (arr[i].advanceMeasurement, scale);
+ }
+ }
+ return mathGlyphVariantRecord.len;
+ }
+
+ protected:
+ /* Offset to MathGlyphAssembly table for this shape - from the beginning of
+ MathGlyphConstruction table. May be nullptr. */
+ OffsetTo<MathGlyphAssembly> glyphAssembly;
+
+ /* MathGlyphVariantRecords for alternative variants of the glyphs. */
+ ArrayOf<MathGlyphVariantRecord> mathGlyphVariantRecord;
+
+ public:
+ DEFINE_SIZE_ARRAY (4, mathGlyphVariantRecord);
+};
+
+struct MathVariants
+{
+ inline bool sanitize_offsets (hb_sanitize_context_t *c) const
+ {
+ TRACE_SANITIZE (this);
+ unsigned int count = vertGlyphCount + horizGlyphCount;
+ for (unsigned int i = 0; i < count; i++)
+ if (!glyphConstruction[i].sanitize (c, this)) return_trace (false);
+ return_trace (true);
+ }
+
+ inline bool sanitize (hb_sanitize_context_t *c) const
+ {
+ TRACE_SANITIZE (this);
+ return_trace (c->check_struct (this) &&
+ vertGlyphCoverage.sanitize (c, this) &&
+ horizGlyphCoverage.sanitize (c, this) &&
+ c->check_array (glyphConstruction,
+ glyphConstruction[0].static_size,
+ vertGlyphCount + horizGlyphCount) &&
+ sanitize_offsets (c));
+ }
+
+ inline hb_position_t get_min_connector_overlap (hb_direction_t direction,
+ hb_font_t *font) const
+ { return font->em_scale_dir (minConnectorOverlap, direction); }
+
+ inline unsigned int get_glyph_variants (hb_codepoint_t glyph,
+ hb_direction_t direction,
+ hb_font_t *font,
+ unsigned int start_offset,
+ unsigned int *variants_count, /* IN/OUT */
+ hb_ot_math_glyph_variant_t *variants /* OUT */) const
+ { return get_glyph_construction (glyph, direction, font)
+ .get_variants (direction, font, start_offset, variants_count, variants); }
+
+ inline unsigned int get_glyph_parts (hb_codepoint_t glyph,
+ hb_direction_t direction,
+ hb_font_t *font,
+ unsigned int start_offset,
+ unsigned int *parts_count, /* IN/OUT */
+ hb_ot_math_glyph_part_t *parts /* OUT */,
+ hb_position_t *italics_correction /* OUT */) const
+ { return get_glyph_construction (glyph, direction, font)
+ .get_assembly ()
+ .get_parts (direction, font,
+ start_offset, parts_count, parts,
+ italics_correction); }
+
+ private:
+ inline const MathGlyphConstruction &
+ get_glyph_construction (hb_codepoint_t glyph,
+ hb_direction_t direction,
+ hb_font_t *font) const
+ {
+ bool vertical = HB_DIRECTION_IS_VERTICAL (direction);
+ unsigned int count = vertical ? vertGlyphCount : horizGlyphCount;
+ const OffsetTo<Coverage> &coverage = vertical ? vertGlyphCoverage
+ : horizGlyphCoverage;
+
+ unsigned int index = (this+coverage).get_coverage (glyph);
+ if (unlikely (index >= count)) return Null(MathGlyphConstruction);
+
+ if (!vertical)
+ index += vertGlyphCount;
+
+ return this+glyphConstruction[index];
+ }
+
+ protected:
+ UINT16 minConnectorOverlap; /* Minimum overlap of connecting
+ * glyphs during glyph construction,
+ * in design units. */
+ OffsetTo<Coverage> vertGlyphCoverage; /* Offset to Coverage table -
+ * from the beginning of MathVariants
+ * table. */
+ OffsetTo<Coverage> horizGlyphCoverage; /* Offset to Coverage table -
+ * from the beginning of MathVariants
+ * table. */
+ UINT16 vertGlyphCount; /* Number of glyphs for which
+ * information is provided for
+ * vertically growing variants. */
+ UINT16 horizGlyphCount; /* Number of glyphs for which
+ * information is provided for
+ * horizontally growing variants. */
+
+ /* Array of offsets to MathGlyphConstruction tables - from the beginning of
+ the MathVariants table, for shapes growing in vertical/horizontal
+ direction. */
+ OffsetTo<MathGlyphConstruction> glyphConstruction[VAR];
+
+ public:
+ DEFINE_SIZE_ARRAY (10, glyphConstruction);
+};
+
+
+/*
+ * MATH -- The MATH Table
+ */
+
+struct MATH
+{
+ static const hb_tag_t tableTag = HB_OT_TAG_MATH;
+
+ inline bool sanitize (hb_sanitize_context_t *c) const
+ {
+ TRACE_SANITIZE (this);
+ return_trace (version.sanitize (c) &&
+ likely (version.major == 1) &&
+ mathConstants.sanitize (c, this) &&
+ mathGlyphInfo.sanitize (c, this) &&
+ mathVariants.sanitize (c, this));
+ }
+
+ inline hb_position_t get_constant (hb_ot_math_constant_t constant,
+ hb_font_t *font) const
+ { return (this+mathConstants).get_value (constant, font); }
+
+ inline const MathGlyphInfo &get_math_glyph_info (void) const
+ { return this+mathGlyphInfo; }
+
+ inline const MathVariants &get_math_variants (void) const
+ { return this+mathVariants; }
+
+ protected:
+ FixedVersion<>version; /* Version of the MATH table
+ * initially set to 0x00010000u */
+ OffsetTo<MathConstants> mathConstants;/* MathConstants table */
+ OffsetTo<MathGlyphInfo> mathGlyphInfo;/* MathGlyphInfo table */
+ OffsetTo<MathVariants> mathVariants; /* MathVariants table */
+
+ public:
+ DEFINE_SIZE_STATIC (10);
+};
+
+} /* namespace OT */
+
+
+#endif /* HB_OT_MATH_TABLE_HH */
diff --git a/src/3rdparty/harfbuzz-ng/src/hb-ot-math.cc b/src/3rdparty/harfbuzz-ng/src/hb-ot-math.cc
index 9ef21d2995..f82a07353c 100644
--- a/src/3rdparty/harfbuzz-ng/src/hb-ot-math.cc
+++ b/src/3rdparty/harfbuzz-ng/src/hb-ot-math.cc
@@ -26,33 +26,15 @@
#include "hb-open-type-private.hh"
-#include "hb-ot-layout-math-table.hh"
-
-HB_SHAPER_DATA_ENSURE_DECLARE(ot, face)
+#include "hb-ot-layout-private.hh"
+#include "hb-ot-math-table.hh"
static inline const OT::MATH&
_get_math (hb_face_t *face)
{
if (unlikely (!hb_ot_shaper_face_data_ensure (face))) return OT::Null(OT::MATH);
-
hb_ot_layout_t * layout = hb_ot_layout_from_face (face);
-
-retry:
- const OT::MATH *math = (const OT::MATH *) hb_atomic_ptr_get (&layout->math);
-
- if (unlikely (!math))
- {
- hb_blob_t *blob = OT::Sanitizer<OT::MATH>::sanitize (face->reference_table (HB_OT_TAG_MATH));
- math = OT::Sanitizer<OT::MATH>::lock_instance (blob);
- if (!hb_atomic_ptr_cmpexch (&layout->math, NULL, math))
- {
- hb_blob_destroy (blob);
- goto retry;
- }
- layout->math_blob = blob;
- }
-
- return *math;
+ return *(layout->math.get ());
}
/*
@@ -64,10 +46,9 @@ retry:
* @face: #hb_face_t to test
*
* This function allows to verify the presence of an OpenType MATH table on the
- * face. If so, such a table will be loaded into memory and sanitized. You can
- * then safely call other functions for math layout and shaping.
+ * face.
*
- * Return value: #TRUE if face has a MATH table and #FALSE otherwise
+ * Return value: true if face has a MATH table, false otherwise
*
* Since: 1.3.3
**/
@@ -136,10 +117,10 @@ hb_ot_math_get_glyph_top_accent_attachment (hb_font_t *font,
/**
* hb_ot_math_is_glyph_extended_shape:
- * @font: a #hb_font_t to test
+ * @face: a #hb_face_t to test
* @glyph: a glyph index to test
*
- * Return value: #TRUE if the glyph is an extended shape and #FALSE otherwise
+ * Return value: true if the glyph is an extended shape, false otherwise
*
* Since: 1.3.3
**/
diff --git a/src/3rdparty/harfbuzz-ng/src/hb-ot-maxp-table.hh b/src/3rdparty/harfbuzz-ng/src/hb-ot-maxp-table.hh
index 943e3908c7..f6d283eb14 100644
--- a/src/3rdparty/harfbuzz-ng/src/hb-ot-maxp-table.hh
+++ b/src/3rdparty/harfbuzz-ng/src/hb-ot-maxp-table.hh
@@ -60,7 +60,7 @@ struct maxp
protected:
FixedVersion<>version; /* Version of the maxp table (0.5 or 1.0),
* 0x00005000u or 0x00010000u. */
- USHORT numGlyphs; /* The number of glyphs in the font. */
+ UINT16 numGlyphs; /* The number of glyphs in the font. */
public:
DEFINE_SIZE_STATIC (6);
};
diff --git a/src/3rdparty/harfbuzz-ng/src/hb-ot-name-table.hh b/src/3rdparty/harfbuzz-ng/src/hb-ot-name-table.hh
index 870f123325..4c5b3c0f98 100644
--- a/src/3rdparty/harfbuzz-ng/src/hb-ot-name-table.hh
+++ b/src/3rdparty/harfbuzz-ng/src/hb-ot-name-table.hh
@@ -42,8 +42,10 @@ namespace OT {
struct NameRecord
{
- static int cmp (const NameRecord *a, const NameRecord *b)
+ static int cmp (const void *pa, const void *pb)
{
+ const NameRecord *a = (const NameRecord *) pa;
+ const NameRecord *b = (const NameRecord *) pb;
int ret;
ret = b->platformID.cmp (a->platformID);
if (ret) return ret;
@@ -63,12 +65,12 @@ struct NameRecord
return_trace (c->check_struct (this) && c->check_range ((char *) base, (unsigned int) length + offset));
}
- USHORT platformID; /* Platform ID. */
- USHORT encodingID; /* Platform-specific encoding ID. */
- USHORT languageID; /* Language ID. */
- USHORT nameID; /* Name ID. */
- USHORT length; /* String length (in bytes). */
- USHORT offset; /* String offset from start of storage area (in bytes). */
+ UINT16 platformID; /* Platform ID. */
+ UINT16 encodingID; /* Platform-specific encoding ID. */
+ UINT16 languageID; /* Language ID. */
+ UINT16 nameID; /* Name ID. */
+ UINT16 length; /* String length (in bytes). */
+ UINT16 offset; /* String offset from start of storage area (in bytes). */
public:
DEFINE_SIZE_STATIC (12);
};
@@ -89,7 +91,7 @@ struct name
key.encodingID.set (encoding_id);
key.languageID.set (language_id);
key.nameID.set (name_id);
- NameRecord *match = (NameRecord *) bsearch (&key, nameRecord, count, sizeof (nameRecord[0]), (hb_compare_func_t) NameRecord::cmp);
+ NameRecord *match = (NameRecord *) bsearch (&key, nameRecord, count, sizeof (nameRecord[0]), NameRecord::cmp);
if (!match)
return 0;
@@ -121,9 +123,9 @@ struct name
}
/* We only implement format 0 for now. */
- USHORT format; /* Format selector (=0/1). */
- USHORT count; /* Number of name records. */
- Offset<> stringOffset; /* Offset to start of string storage (from start of table). */
+ UINT16 format; /* Format selector (=0/1). */
+ UINT16 count; /* Number of name records. */
+ Offset16 stringOffset; /* Offset to start of string storage (from start of table). */
NameRecord nameRecord[VAR]; /* The name records where count is the number of records. */
public:
DEFINE_SIZE_ARRAY (6, nameRecord);
diff --git a/src/3rdparty/harfbuzz-ng/src/hb-ot-os2-table.hh b/src/3rdparty/harfbuzz-ng/src/hb-ot-os2-table.hh
index 4709cd6e87..aa78f1e0a6 100644
--- a/src/3rdparty/harfbuzz-ng/src/hb-ot-os2-table.hh
+++ b/src/3rdparty/harfbuzz-ng/src/hb-ot-os2-table.hh
@@ -50,50 +50,50 @@ struct os2
}
public:
- USHORT version;
+ UINT16 version;
/* Version 0 */
- SHORT xAvgCharWidth;
- USHORT usWeightClass;
- USHORT usWidthClass;
- USHORT fsType;
- SHORT ySubscriptXSize;
- SHORT ySubscriptYSize;
- SHORT ySubscriptXOffset;
- SHORT ySubscriptYOffset;
- SHORT ySuperscriptXSize;
- SHORT ySuperscriptYSize;
- SHORT ySuperscriptXOffset;
- SHORT ySuperscriptYOffset;
- SHORT yStrikeoutSize;
- SHORT yStrikeoutPosition;
- SHORT sFamilyClass;
- BYTE panose[10];
- ULONG ulUnicodeRange[4];
+ INT16 xAvgCharWidth;
+ UINT16 usWeightClass;
+ UINT16 usWidthClass;
+ UINT16 fsType;
+ INT16 ySubscriptXSize;
+ INT16 ySubscriptYSize;
+ INT16 ySubscriptXOffset;
+ INT16 ySubscriptYOffset;
+ INT16 ySuperscriptXSize;
+ INT16 ySuperscriptYSize;
+ INT16 ySuperscriptXOffset;
+ INT16 ySuperscriptYOffset;
+ INT16 yStrikeoutSize;
+ INT16 yStrikeoutPosition;
+ INT16 sFamilyClass;
+ UINT8 panose[10];
+ UINT32 ulUnicodeRange[4];
Tag achVendID;
- USHORT fsSelection;
- USHORT usFirstCharIndex;
- USHORT usLastCharIndex;
- SHORT sTypoAscender;
- SHORT sTypoDescender;
- SHORT sTypoLineGap;
- USHORT usWinAscent;
- USHORT usWinDescent;
+ UINT16 fsSelection;
+ UINT16 usFirstCharIndex;
+ UINT16 usLastCharIndex;
+ INT16 sTypoAscender;
+ INT16 sTypoDescender;
+ INT16 sTypoLineGap;
+ UINT16 usWinAscent;
+ UINT16 usWinDescent;
/* Version 1 */
- //ULONG ulCodePageRange1;
- //ULONG ulCodePageRange2;
+ //UINT32 ulCodePageRange1;
+ //UINT32 ulCodePageRange2;
/* Version 2 */
- //SHORT sxHeight;
- //SHORT sCapHeight;
- //USHORT usDefaultChar;
- //USHORT usBreakChar;
- //USHORT usMaxContext;
+ //INT16 sxHeight;
+ //INT16 sCapHeight;
+ //UINT16 usDefaultChar;
+ //UINT16 usBreakChar;
+ //UINT16 usMaxContext;
/* Version 5 */
- //USHORT usLowerOpticalPointSize;
- //USHORT usUpperOpticalPointSize;
+ //UINT16 usLowerOpticalPointSize;
+ //UINT16 usUpperOpticalPointSize;
public:
DEFINE_SIZE_STATIC (78);
diff --git a/src/3rdparty/harfbuzz-ng/src/hb-ot-post-macroman.hh b/src/3rdparty/harfbuzz-ng/src/hb-ot-post-macroman.hh
new file mode 100644
index 0000000000..dbbb97e5a9
--- /dev/null
+++ b/src/3rdparty/harfbuzz-ng/src/hb-ot-post-macroman.hh
@@ -0,0 +1,294 @@
+/*
+ * Copyright © 2017 Google, Inc.
+ *
+ * This is part of HarfBuzz, a text shaping library.
+ *
+ * Permission is hereby granted, without written agreement and without
+ * license or royalty fees, to use, copy, modify, and distribute this
+ * software and its documentation for any purpose, provided that the
+ * above copyright notice and the following two paragraphs appear in
+ * all copies of this software.
+ *
+ * IN NO EVENT SHALL THE COPYRIGHT HOLDER BE LIABLE TO ANY PARTY FOR
+ * DIRECT, INDIRECT, SPECIAL, INCIDENTAL, OR CONSEQUENTIAL DAMAGES
+ * ARISING OUT OF THE USE OF THIS SOFTWARE AND ITS DOCUMENTATION, EVEN
+ * IF THE COPYRIGHT HOLDER HAS BEEN ADVISED OF THE POSSIBILITY OF SUCH
+ * DAMAGE.
+ *
+ * THE COPYRIGHT HOLDER SPECIFICALLY DISCLAIMS ANY WARRANTIES, INCLUDING,
+ * BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND
+ * FITNESS FOR A PARTICULAR PURPOSE. THE SOFTWARE PROVIDED HEREUNDER IS
+ * ON AN "AS IS" BASIS, AND THE COPYRIGHT HOLDER HAS NO OBLIGATION TO
+ * PROVIDE MAINTENANCE, SUPPORT, UPDATES, ENHANCEMENTS, OR MODIFICATIONS.
+ *
+ * Google Author(s): Behdad Esfahbod
+ */
+
+#ifndef HB_OT_POST_MACROMAN_HH
+#if 0 /* Make checks happy. */
+#define HB_OT_POST_MACROMAN_HH
+#include "hb-private.hh"
+#endif
+
+
+_S(".notdef")
+_S(".null")
+_S("nonmarkingreturn")
+_S("space")
+_S("exclam")
+_S("quotedbl")
+_S("numbersign")
+_S("dollar")
+_S("percent")
+_S("ampersand")
+_S("quotesingle")
+_S("parenleft")
+_S("parenright")
+_S("asterisk")
+_S("plus")
+_S("comma")
+_S("hyphen")
+_S("period")
+_S("slash")
+_S("zero")
+_S("one")
+_S("two")
+_S("three")
+_S("four")
+_S("five")
+_S("six")
+_S("seven")
+_S("eight")
+_S("nine")
+_S("colon")
+_S("semicolon")
+_S("less")
+_S("equal")
+_S("greater")
+_S("question")
+_S("at")
+_S("A")
+_S("B")
+_S("C")
+_S("D")
+_S("E")
+_S("F")
+_S("G")
+_S("H")
+_S("I")
+_S("J")
+_S("K")
+_S("L")
+_S("M")
+_S("N")
+_S("O")
+_S("P")
+_S("Q")
+_S("R")
+_S("S")
+_S("T")
+_S("U")
+_S("V")
+_S("W")
+_S("X")
+_S("Y")
+_S("Z")
+_S("bracketleft")
+_S("backslash")
+_S("bracketright")
+_S("asciicircum")
+_S("underscore")
+_S("grave")
+_S("a")
+_S("b")
+_S("c")
+_S("d")
+_S("e")
+_S("f")
+_S("g")
+_S("h")
+_S("i")
+_S("j")
+_S("k")
+_S("l")
+_S("m")
+_S("n")
+_S("o")
+_S("p")
+_S("q")
+_S("r")
+_S("s")
+_S("t")
+_S("u")
+_S("v")
+_S("w")
+_S("x")
+_S("y")
+_S("z")
+_S("braceleft")
+_S("bar")
+_S("braceright")
+_S("asciitilde")
+_S("Adieresis")
+_S("Aring")
+_S("Ccedilla")
+_S("Eacute")
+_S("Ntilde")
+_S("Odieresis")
+_S("Udieresis")
+_S("aacute")
+_S("agrave")
+_S("acircumflex")
+_S("adieresis")
+_S("atilde")
+_S("aring")
+_S("ccedilla")
+_S("eacute")
+_S("egrave")
+_S("ecircumflex")
+_S("edieresis")
+_S("iacute")
+_S("igrave")
+_S("icircumflex")
+_S("idieresis")
+_S("ntilde")
+_S("oacute")
+_S("ograve")
+_S("ocircumflex")
+_S("odieresis")
+_S("otilde")
+_S("uacute")
+_S("ugrave")
+_S("ucircumflex")
+_S("udieresis")
+_S("dagger")
+_S("degree")
+_S("cent")
+_S("sterling")
+_S("section")
+_S("bullet")
+_S("paragraph")
+_S("germandbls")
+_S("registered")
+_S("copyright")
+_S("trademark")
+_S("acute")
+_S("dieresis")
+_S("notequal")
+_S("AE")
+_S("Oslash")
+_S("infinity")
+_S("plusminus")
+_S("lessequal")
+_S("greaterequal")
+_S("yen")
+_S("mu")
+_S("partialdiff")
+_S("summation")
+_S("product")
+_S("pi")
+_S("integral")
+_S("ordfeminine")
+_S("ordmasculine")
+_S("Omega")
+_S("ae")
+_S("oslash")
+_S("questiondown")
+_S("exclamdown")
+_S("logicalnot")
+_S("radical")
+_S("florin")
+_S("approxequal")
+_S("Delta")
+_S("guillemotleft")
+_S("guillemotright")
+_S("ellipsis")
+_S("nonbreakingspace")
+_S("Agrave")
+_S("Atilde")
+_S("Otilde")
+_S("OE")
+_S("oe")
+_S("endash")
+_S("emdash")
+_S("quotedblleft")
+_S("quotedblright")
+_S("quoteleft")
+_S("quoteright")
+_S("divide")
+_S("lozenge")
+_S("ydieresis")
+_S("Ydieresis")
+_S("fraction")
+_S("currency")
+_S("guilsinglleft")
+_S("guilsinglright")
+_S("fi")
+_S("fl")
+_S("daggerdbl")
+_S("periodcentered")
+_S("quotesinglbase")
+_S("quotedblbase")
+_S("perthousand")
+_S("Acircumflex")
+_S("Ecircumflex")
+_S("Aacute")
+_S("Edieresis")
+_S("Egrave")
+_S("Iacute")
+_S("Icircumflex")
+_S("Idieresis")
+_S("Igrave")
+_S("Oacute")
+_S("Ocircumflex")
+_S("apple")
+_S("Ograve")
+_S("Uacute")
+_S("Ucircumflex")
+_S("Ugrave")
+_S("dotlessi")
+_S("circumflex")
+_S("tilde")
+_S("macron")
+_S("breve")
+_S("dotaccent")
+_S("ring")
+_S("cedilla")
+_S("hungarumlaut")
+_S("ogonek")
+_S("caron")
+_S("Lslash")
+_S("lslash")
+_S("Scaron")
+_S("scaron")
+_S("Zcaron")
+_S("zcaron")
+_S("brokenbar")
+_S("Eth")
+_S("eth")
+_S("Yacute")
+_S("yacute")
+_S("Thorn")
+_S("thorn")
+_S("minus")
+_S("multiply")
+_S("onesuperior")
+_S("twosuperior")
+_S("threesuperior")
+_S("onehalf")
+_S("onequarter")
+_S("threequarters")
+_S("franc")
+_S("Gbreve")
+_S("gbreve")
+_S("Idotaccent")
+_S("Scedilla")
+_S("scedilla")
+_S("Cacute")
+_S("cacute")
+_S("Ccaron")
+_S("ccaron")
+_S("dcroat")
+
+
+#endif /* HB_OT_POST_MACROMAN_HH */
diff --git a/src/3rdparty/harfbuzz-ng/src/hb-ot-post-table.hh b/src/3rdparty/harfbuzz-ng/src/hb-ot-post-table.hh
index 82ab3882a8..7f1c2c420f 100644
--- a/src/3rdparty/harfbuzz-ng/src/hb-ot-post-table.hh
+++ b/src/3rdparty/harfbuzz-ng/src/hb-ot-post-table.hh
@@ -28,7 +28,15 @@
#define HB_OT_POST_TABLE_HH
#include "hb-open-type-private.hh"
+#include "hb-dsalgs.hh"
+#define HB_STRING_ARRAY_NAME format1_names
+#define HB_STRING_ARRAY_LIST "hb-ot-post-macroman.hh"
+#include "hb-string-array.hh"
+#undef HB_STRING_ARRAY_LIST
+#undef HB_STRING_ARRAY_NAME
+
+#define NUM_FORMAT1_NAMES 258
namespace OT {
@@ -45,16 +53,13 @@ struct postV2Tail
inline bool sanitize (hb_sanitize_context_t *c) const
{
TRACE_SANITIZE (this);
- return_trace (numberOfGlyphs.sanitize (c) &&
- c->check_array (glyphNameIndex, sizeof (USHORT), numberOfGlyphs));
+ return_trace (glyphNameIndex.sanitize (c));
}
- USHORT numberOfGlyphs; /* Number of glyphs (this should be the
- * same as numGlyphs in 'maxp' table). */
- USHORT glyphNameIndex[VAR]; /* This is not an offset, but is the
+ ArrayOf<UINT16>glyphNameIndex; /* This is not an offset, but is the
* ordinal number of the glyph in 'post'
* string tables. */
- BYTE namesX[VAR]; /* Glyph names with length bytes [variable]
+ UINT8 namesX[VAR]; /* Glyph names with length bytes [variable]
* (a Pascal string). */
DEFINE_SIZE_ARRAY2 (2, glyphNameIndex, namesX);
@@ -71,12 +76,170 @@ struct post
return_trace (false);
if (version.to_int () == 0x00020000)
{
- const postV2Tail &v2 = StructAfter<postV2Tail>(*this);
+ const postV2Tail &v2 = StructAfter<postV2Tail> (*this);
return_trace (v2.sanitize (c));
}
return_trace (true);
}
+ struct accelerator_t
+ {
+ inline void init (hb_face_t *face)
+ {
+ blob = Sanitizer<post>::sanitize (face->reference_table (HB_OT_TAG_post));
+ const post *table = Sanitizer<post>::lock_instance (blob);
+ unsigned int table_length = hb_blob_get_length (blob);
+
+ version = table->version.to_int ();
+ index_to_offset.init ();
+ if (version != 0x00020000)
+ return;
+
+ const postV2Tail &v2 = StructAfter<postV2Tail> (*table);
+
+ glyphNameIndex = &v2.glyphNameIndex;
+ pool = &StructAfter<uint8_t> (v2.glyphNameIndex);
+
+ const uint8_t *end = (uint8_t *) table + table_length;
+ for (const uint8_t *data = pool; data < end && data + *data <= end; data += 1 + *data)
+ {
+ uint32_t *offset = index_to_offset.push ();
+ if (unlikely (!offset))
+ break;
+ *offset = data - pool;
+ }
+ }
+ inline void fini (void)
+ {
+ index_to_offset.finish ();
+ free (gids_sorted_by_name);
+ }
+
+ inline bool get_glyph_name (hb_codepoint_t glyph,
+ char *buf, unsigned int buf_len) const
+ {
+ hb_string_t s = find_glyph_name (glyph);
+ if (!s.len)
+ return false;
+ if (!buf_len)
+ return true;
+ if (buf_len <= s.len) /* What to do with truncation? Returning false for now. */
+ return false;
+ strncpy (buf, s.bytes, s.len);
+ buf[s.len] = '\0';
+ return true;
+ }
+
+ inline bool get_glyph_from_name (const char *name, int len,
+ hb_codepoint_t *glyph) const
+ {
+ unsigned int count = get_glyph_count ();
+ if (unlikely (!count))
+ return false;
+
+ if (len < 0)
+ len = strlen (name);
+
+ if (unlikely (!len))
+ return false;
+
+ retry:
+ uint16_t *gids = (uint16_t *) hb_atomic_ptr_get (&gids_sorted_by_name);
+
+ if (unlikely (!gids))
+ {
+ gids = (uint16_t *) malloc (count * sizeof (gids[0]));
+ if (unlikely (!gids))
+ return false; /* Anything better?! */
+
+ for (unsigned int i = 0; i < count; i++)
+ gids[i] = i;
+ hb_sort_r (gids, count, sizeof (gids[0]), cmp_gids, (void *) this);
+
+ if (!hb_atomic_ptr_cmpexch (&gids_sorted_by_name, nullptr, gids)) {
+ free (gids);
+ goto retry;
+ }
+ }
+
+ hb_string_t st (name, len);
+ const uint16_t *gid = (const uint16_t *) hb_bsearch_r (&st, gids, count, sizeof (gids[0]), cmp_key, (void *) this);
+ if (gid)
+ {
+ *glyph = *gid;
+ return true;
+ }
+
+ return false;
+ }
+
+ protected:
+
+ inline unsigned int get_glyph_count (void) const
+ {
+ if (version == 0x00010000)
+ return NUM_FORMAT1_NAMES;
+
+ if (version == 0x00020000)
+ return glyphNameIndex->len;
+
+ return 0;
+ }
+
+ static inline int cmp_gids (const void *pa, const void *pb, void *arg)
+ {
+ const accelerator_t *thiz = (const accelerator_t *) arg;
+ uint16_t a = * (const uint16_t *) pa;
+ uint16_t b = * (const uint16_t *) pb;
+ return thiz->find_glyph_name (b).cmp (thiz->find_glyph_name (a));
+ }
+
+ static inline int cmp_key (const void *pk, const void *po, void *arg)
+ {
+ const accelerator_t *thiz = (const accelerator_t *) arg;
+ const hb_string_t *key = (const hb_string_t *) pk;
+ uint16_t o = * (const uint16_t *) po;
+ return thiz->find_glyph_name (o).cmp (*key);
+ }
+
+ inline hb_string_t find_glyph_name (hb_codepoint_t glyph) const
+ {
+ if (version == 0x00010000)
+ {
+ if (glyph >= NUM_FORMAT1_NAMES)
+ return hb_string_t ();
+
+ return format1_names (glyph);
+ }
+
+ if (version != 0x00020000 || glyph >= glyphNameIndex->len)
+ return hb_string_t ();
+
+ unsigned int index = glyphNameIndex->array[glyph];
+ if (index < NUM_FORMAT1_NAMES)
+ return format1_names (index);
+ index -= NUM_FORMAT1_NAMES;
+
+ if (index >= index_to_offset.len)
+ return hb_string_t ();
+ unsigned int offset = index_to_offset.array[index];
+
+ const uint8_t *data = pool + offset;
+ unsigned int name_length = *data;
+ data++;
+
+ return hb_string_t ((const char *) data, name_length);
+ }
+
+ private:
+ hb_blob_t *blob;
+ uint32_t version;
+ const ArrayOf<UINT16> *glyphNameIndex;
+ hb_prealloced_array_t<uint32_t, 1> index_to_offset;
+ const uint8_t *pool;
+ mutable uint16_t *gids_sorted_by_name;
+ };
+
public:
FixedVersion<>version; /* 0x00010000 for version 1.0
* 0x00020000 for version 2.0
@@ -98,16 +261,16 @@ struct post
* from the value of this field. */
FWORD underlineThickness; /* Suggested values for the underline
thickness. */
- ULONG isFixedPitch; /* Set to 0 if the font is proportionally
+ UINT32 isFixedPitch; /* Set to 0 if the font is proportionally
* spaced, non-zero if the font is not
* proportionally spaced (i.e. monospaced). */
- ULONG minMemType42; /* Minimum memory usage when an OpenType font
+ UINT32 minMemType42; /* Minimum memory usage when an OpenType font
* is downloaded. */
- ULONG maxMemType42; /* Maximum memory usage when an OpenType font
+ UINT32 maxMemType42; /* Maximum memory usage when an OpenType font
* is downloaded. */
- ULONG minMemType1; /* Minimum memory usage when an OpenType font
+ UINT32 minMemType1; /* Minimum memory usage when an OpenType font
* is downloaded as a Type 1 font. */
- ULONG maxMemType1; /* Maximum memory usage when an OpenType font
+ UINT32 maxMemType1; /* Maximum memory usage when an OpenType font
* is downloaded as a Type 1 font. */
/*postV2Tail v2[VAR];*/
DEFINE_SIZE_STATIC (32);
diff --git a/src/3rdparty/harfbuzz-ng/src/hb-ot-shape-complex-arabic-fallback.hh b/src/3rdparty/harfbuzz-ng/src/hb-ot-shape-complex-arabic-fallback.hh
index d97d285210..d98cde121c 100644
--- a/src/3rdparty/harfbuzz-ng/src/hb-ot-shape-complex-arabic-fallback.hh
+++ b/src/3rdparty/harfbuzz-ng/src/hb-ot-shape-complex-arabic-fallback.hh
@@ -73,11 +73,11 @@ arabic_fallback_synthesize_lookup_single (const hb_ot_shape_plan_t *plan HB_UNUS
}
if (!num_glyphs)
- return NULL;
+ return nullptr;
/* Bubble-sort or something equally good!
* May not be good-enough for presidential candidate interviews, but good-enough for us... */
- hb_stable_sort (&glyphs[0], num_glyphs, OT::GlyphID::cmp, &substitutes[0]);
+ hb_stable_sort (&glyphs[0], num_glyphs, (int(*)(const OT::GlyphID*, const OT::GlyphID *)) OT::GlyphID::cmp, &substitutes[0]);
OT::Supplier<OT::GlyphID> glyphs_supplier (glyphs, num_glyphs);
OT::Supplier<OT::GlyphID> substitutes_supplier (substitutes, num_glyphs);
@@ -94,7 +94,7 @@ arabic_fallback_synthesize_lookup_single (const hb_ot_shape_plan_t *plan HB_UNUS
c.end_serialize ();
/* TODO sanitize the results? */
- return ret ? c.copy<OT::SubstLookup> () : NULL;
+ return ret ? c.copy<OT::SubstLookup> () : nullptr;
}
static OT::SubstLookup *
@@ -126,7 +126,7 @@ arabic_fallback_synthesize_lookup_ligature (const hb_ot_shape_plan_t *plan HB_UN
first_glyphs_indirection[num_first_glyphs] = first_glyph_idx;
num_first_glyphs++;
}
- hb_stable_sort (&first_glyphs[0], num_first_glyphs, OT::GlyphID::cmp, &first_glyphs_indirection[0]);
+ hb_stable_sort (&first_glyphs[0], num_first_glyphs, (int(*)(const OT::GlyphID*, const OT::GlyphID *)) OT::GlyphID::cmp, &first_glyphs_indirection[0]);
/* Now that the first-glyphs are sorted, walk again, populate ligatures. */
for (unsigned int i = 0; i < num_first_glyphs; i++)
@@ -153,7 +153,7 @@ arabic_fallback_synthesize_lookup_ligature (const hb_ot_shape_plan_t *plan HB_UN
}
if (!num_ligatures)
- return NULL;
+ return nullptr;
OT::Supplier<OT::GlyphID> first_glyphs_supplier (first_glyphs, num_first_glyphs);
OT::Supplier<unsigned int > ligature_per_first_glyph_count_supplier (ligature_per_first_glyph_count_list, num_first_glyphs);
@@ -177,7 +177,7 @@ arabic_fallback_synthesize_lookup_ligature (const hb_ot_shape_plan_t *plan HB_UN
c.end_serialize ();
/* TODO sanitize the results? */
- return ret ? c.copy<OT::SubstLookup> () : NULL;
+ return ret ? c.copy<OT::SubstLookup> () : nullptr;
}
static OT::SubstLookup *
@@ -237,8 +237,8 @@ arabic_fallback_plan_init_win1256 (arabic_fallback_plan_t *fallback_plan,
return false;
const Manifest &manifest = reinterpret_cast<const Manifest&> (arabic_win1256_gsub_lookups.manifest);
- ASSERT_STATIC (sizeof (arabic_win1256_gsub_lookups.manifestData) / sizeof (ManifestLookup)
- <= ARABIC_FALLBACK_MAX_LOOKUPS);
+ static_assert (sizeof (arabic_win1256_gsub_lookups.manifestData) / sizeof (ManifestLookup)
+ <= ARABIC_FALLBACK_MAX_LOOKUPS, "");
/* TODO sanitize the table? */
unsigned j = 0;
@@ -271,7 +271,7 @@ arabic_fallback_plan_init_unicode (arabic_fallback_plan_t *fallback_plan,
const hb_ot_shape_plan_t *plan,
hb_font_t *font)
{
- ASSERT_STATIC (ARRAY_LENGTH_CONST(arabic_fallback_features) <= ARABIC_FALLBACK_MAX_LOOKUPS);
+ static_assert ((ARRAY_LENGTH_CONST(arabic_fallback_features) <= ARABIC_FALLBACK_MAX_LOOKUPS), "");
unsigned int j = 0;
for (unsigned int i = 0; i < ARRAY_LENGTH(arabic_fallback_features) ; i++)
{
diff --git a/src/3rdparty/harfbuzz-ng/src/hb-ot-shape-complex-arabic-table.hh b/src/3rdparty/harfbuzz-ng/src/hb-ot-shape-complex-arabic-table.hh
index 736c7f76b3..cd6e4058b5 100644
--- a/src/3rdparty/harfbuzz-ng/src/hb-ot-shape-complex-arabic-table.hh
+++ b/src/3rdparty/harfbuzz-ng/src/hb-ot-shape-complex-arabic-table.hh
@@ -6,10 +6,10 @@
*
* on files with these headers:
*
- * # ArabicShaping-9.0.0.txt
- * # Date: 2016-02-24, 22:25:00 GMT [RP]
- * # Blocks-9.0.0.txt
- * # Date: 2016-02-05, 23:48:00 GMT [KW]
+ * # ArabicShaping-10.0.0.txt
+ * # Date: 2017-02-16, 00:00:00 GMT [RP, KW]
+ * # Blocks-10.0.0.txt
+ * # Date: 2017-04-12, 17:30:00 GMT [KW]
* UnicodeData.txt does not have a header.
*/
@@ -72,7 +72,10 @@ static const uint8_t joining_table[] =
/* Mandaic */
/* 0840 */ R,D,D,D,D,D,R,R,D,R,D,D,D,D,D,D,D,D,D,D,R,D,U,U,U,X,X,X,X,X,X,X,
- /* 0860 */ X,X,X,X,X,X,X,X,X,X,X,X,X,X,X,X,X,X,X,X,X,X,X,X,X,X,X,X,X,X,X,X,
+
+ /* Syriac Supplement */
+
+ /* 0860 */ D,U,D,D,D,D,U,R,D,R,R,X,X,X,X,X,X,X,X,X,X,X,X,X,X,X,X,X,X,X,X,X,
/* 0880 */ X,X,X,X,X,X,X,X,X,X,X,X,X,X,X,X,X,X,X,X,X,X,X,X,X,X,X,X,X,X,X,X,
/* Arabic Extended-A */
@@ -130,7 +133,7 @@ static const uint8_t joining_table[] =
/* 1E920 */ D,D,D,D,D,D,D,D,D,D,D,D,D,D,D,D,D,D,D,D,D,D,D,D,D,D,D,D,D,D,D,D,
/* 1E940 */ D,D,D,D,
-}; /* Table items: 1214; occupancy: 54% */
+}; /* Table items: 1214; occupancy: 55% */
static unsigned int
@@ -139,28 +142,28 @@ joining_type (hb_codepoint_t u)
switch (u >> 12)
{
case 0x0u:
- if (hb_in_range (u, 0x0600u, 0x08E2u)) return joining_table[u - 0x0600u + joining_offset_0x0600u];
+ if (hb_in_range<hb_codepoint_t> (u, 0x0600u, 0x08E2u)) return joining_table[u - 0x0600u + joining_offset_0x0600u];
break;
case 0x1u:
- if (hb_in_range (u, 0x1806u, 0x18AAu)) return joining_table[u - 0x1806u + joining_offset_0x1806u];
+ if (hb_in_range<hb_codepoint_t> (u, 0x1806u, 0x18AAu)) return joining_table[u - 0x1806u + joining_offset_0x1806u];
break;
case 0x2u:
- if (hb_in_range (u, 0x200Cu, 0x2069u)) return joining_table[u - 0x200Cu + joining_offset_0x200cu];
+ if (hb_in_range<hb_codepoint_t> (u, 0x200Cu, 0x2069u)) return joining_table[u - 0x200Cu + joining_offset_0x200cu];
break;
case 0xAu:
- if (hb_in_range (u, 0xA840u, 0xA873u)) return joining_table[u - 0xA840u + joining_offset_0xa840u];
+ if (hb_in_range<hb_codepoint_t> (u, 0xA840u, 0xA873u)) return joining_table[u - 0xA840u + joining_offset_0xa840u];
break;
case 0x10u:
- if (hb_in_range (u, 0x10AC0u, 0x10AEFu)) return joining_table[u - 0x10AC0u + joining_offset_0x10ac0u];
- if (hb_in_range (u, 0x10B80u, 0x10BAFu)) return joining_table[u - 0x10B80u + joining_offset_0x10b80u];
+ if (hb_in_range<hb_codepoint_t> (u, 0x10AC0u, 0x10AEFu)) return joining_table[u - 0x10AC0u + joining_offset_0x10ac0u];
+ if (hb_in_range<hb_codepoint_t> (u, 0x10B80u, 0x10BAFu)) return joining_table[u - 0x10B80u + joining_offset_0x10b80u];
break;
case 0x1Eu:
- if (hb_in_range (u, 0x1E900u, 0x1E943u)) return joining_table[u - 0x1E900u + joining_offset_0x1e900u];
+ if (hb_in_range<hb_codepoint_t> (u, 0x1E900u, 0x1E943u)) return joining_table[u - 0x1E900u + joining_offset_0x1e900u];
break;
default:
diff --git a/src/3rdparty/harfbuzz-ng/src/hb-ot-shape-complex-arabic-win1256.hh b/src/3rdparty/harfbuzz-ng/src/hb-ot-shape-complex-arabic-win1256.hh
index e70c48f427..54c6cdc24f 100644
--- a/src/3rdparty/harfbuzz-ng/src/hb-ot-shape-complex-arabic-win1256.hh
+++ b/src/3rdparty/harfbuzz-ng/src/hb-ot-shape-complex-arabic-win1256.hh
@@ -43,16 +43,16 @@
#define OT_TABLE_END }
#define OT_LABEL_START(Name) unsigned char Name[
#define OT_LABEL_END ];
-#define OT_BYTE(u8) +1/*byte*/
-#define OT_USHORT(u16) +2/*bytes*/
+#define OT_UINT8(u8) +1/*byte*/
+#define OT_UINT16(u16) +2/*bytes*/
#else
#undef OT_MEASURE
#define OT_TABLE_START TABLE_NAME = {
#define OT_TABLE_END };
#define OT_LABEL_START(Name) {
#define OT_LABEL_END },
-#define OT_BYTE(u8) (u8),
-#define OT_USHORT(u16) (unsigned char)((u16)>>8), (unsigned char)((u16)&0xFFu),
+#define OT_UINT8(u8) (u8),
+#define OT_UINT16(u16) (unsigned char)((u16)>>8), (unsigned char)((u16)&0xFFu),
#define OT_COUNT(Name, ItemSize) ((unsigned int) sizeof(((struct TABLE_NAME*)0)->Name) \
/ (unsigned int)(ItemSize) \
/* OT_ASSERT it's divisible (and positive). */)
@@ -80,24 +80,24 @@
*/
#define OT_TAG(a,b,c,d) \
- OT_BYTE(a) OT_BYTE(b) OT_BYTE(c) OT_BYTE(d)
+ OT_UINT8(a) OT_UINT8(b) OT_UINT8(c) OT_UINT8(d)
#define OT_OFFSET(From, To) /* Offset from From to To in bytes */ \
- OT_USHORT(OT_DISTANCE(From, To))
+ OT_UINT16(OT_DISTANCE(From, To))
#define OT_GLYPHID /* GlyphID */ \
- OT_USHORT
+ OT_UINT16
#define OT_UARRAY(Name, Items) \
OT_LABEL_START(Name) \
- OT_USHORT(OT_COUNT(Name##Data, 2)) \
+ OT_UINT16(OT_COUNT(Name##Data, 2)) \
OT_LABEL(Name##Data) \
Items \
OT_LABEL_END
#define OT_UHEADLESSARRAY(Name, Items) \
OT_LABEL_START(Name) \
- OT_USHORT(OT_COUNT(Name##Data, 2) + 1) \
+ OT_UINT16(OT_COUNT(Name##Data, 2) + 1) \
OT_LABEL(Name##Data) \
Items \
OT_LABEL_END
@@ -111,19 +111,19 @@
#define OT_LOOKUP(Name, LookupType, LookupFlag, SubLookupOffsets) \
OT_LABEL_START(Name) \
- OT_USHORT(LookupType) \
- OT_USHORT(LookupFlag) \
+ OT_UINT16(LookupType) \
+ OT_UINT16(LookupFlag) \
OT_LABEL_END \
OT_UARRAY(Name##SubLookupOffsetsArray, OT_LIST(SubLookupOffsets))
#define OT_SUBLOOKUP(Name, SubFormat, Items) \
OT_LABEL_START(Name) \
- OT_USHORT(SubFormat) \
+ OT_UINT16(SubFormat) \
Items
#define OT_COVERAGE1(Name, Items) \
OT_LABEL_START(Name) \
- OT_USHORT(1) \
+ OT_UINT16(1) \
OT_LABEL_END \
OT_UARRAY(Name##Glyphs, OT_LIST(Items))
@@ -174,7 +174,7 @@
/* Table manifest. */
#define MANIFEST(Items) \
OT_LABEL_START(manifest) \
- OT_USHORT(OT_COUNT(manifestData, 6)) \
+ OT_UINT16(OT_COUNT(manifestData, 6)) \
OT_LABEL(manifestData) \
Items \
OT_LABEL_END
@@ -304,8 +304,8 @@ OT_TABLE_END
#undef OT_TABLE_END
#undef OT_LABEL_START
#undef OT_LABEL_END
-#undef OT_BYTE
-#undef OT_USHORT
+#undef OT_UINT8
+#undef OT_UINT16
#undef OT_DISTANCE
#undef OT_COUNT
diff --git a/src/3rdparty/harfbuzz-ng/src/hb-ot-shape-complex-arabic.cc b/src/3rdparty/harfbuzz-ng/src/hb-ot-shape-complex-arabic.cc
index 56ec5cd65c..eb9d36ff1d 100644
--- a/src/3rdparty/harfbuzz-ng/src/hb-ot-shape-complex-arabic.cc
+++ b/src/3rdparty/harfbuzz-ng/src/hb-ot-shape-complex-arabic.cc
@@ -24,24 +24,21 @@
* Google Author(s): Behdad Esfahbod
*/
+#include "hb-private.hh"
+#include "hb-debug.hh"
#include "hb-ot-shape-complex-arabic-private.hh"
#include "hb-ot-shape-private.hh"
-#ifndef HB_DEBUG_ARABIC
-#define HB_DEBUG_ARABIC (HB_DEBUG+0)
-#endif
-
-
/* buffer var allocations */
#define arabic_shaping_action() complex_var_u8_0() /* arabic shaping action */
#define HB_BUFFER_SCRATCH_FLAG_ARABIC_HAS_STCH HB_BUFFER_SCRATCH_FLAG_COMPLEX0
/* See:
- * https://github.com/behdad/harfbuzz/commit/6e6f82b6f3dde0fc6c3c7d991d9ec6cfff57823d#commitcomment-14248516 */
+ * https://github.com/harfbuzz/harfbuzz/commit/6e6f82b6f3dde0fc6c3c7d991d9ec6cfff57823d#commitcomment-14248516 */
#define HB_ARABIC_GENERAL_CATEGORY_IS_WORD(gen_cat) \
- (FLAG_SAFE (gen_cat) & \
+ (FLAG_UNSAFE (gen_cat) & \
(FLAG (HB_UNICODE_GENERAL_CATEGORY_UNASSIGNED) | \
FLAG (HB_UNICODE_GENERAL_CATEGORY_PRIVATE_USE) | \
/*FLAG (HB_UNICODE_GENERAL_CATEGORY_LOWERCASE_LETTER) |*/ \
@@ -90,7 +87,7 @@ static unsigned int get_joining_type (hb_codepoint_t u, hb_unicode_general_categ
if (likely (j_type != JOINING_TYPE_X))
return j_type;
- return (FLAG_SAFE(gen_cat) &
+ return (FLAG_UNSAFE(gen_cat) &
(FLAG(HB_UNICODE_GENERAL_CATEGORY_NON_SPACING_MARK) |
FLAG(HB_UNICODE_GENERAL_CATEGORY_ENCLOSING_MARK) |
FLAG(HB_UNICODE_GENERAL_CATEGORY_FORMAT))
@@ -199,6 +196,9 @@ collect_features_arabic (hb_ot_shape_planner_t *plan)
* work. However, testing shows that rlig and calt are applied
* together for Mongolian in Uniscribe. As such, we only add a
* pause for Arabic, not other scripts.
+ *
+ * A pause after calt is required to make KFGQPC Uthmanic Script HAFS
+ * work correctly. See https://github.com/harfbuzz/harfbuzz/issues/505
*/
map->add_gsub_pause (nuke_joiners);
@@ -209,20 +209,23 @@ collect_features_arabic (hb_ot_shape_planner_t *plan)
map->add_global_bool_feature (HB_TAG('c','c','m','p'));
map->add_global_bool_feature (HB_TAG('l','o','c','l'));
- map->add_gsub_pause (NULL);
+ map->add_gsub_pause (nullptr);
for (unsigned int i = 0; i < ARABIC_NUM_FEATURES; i++)
{
bool has_fallback = plan->props.script == HB_SCRIPT_ARABIC && !FEATURE_IS_SYRIAC (arabic_features[i]);
map->add_feature (arabic_features[i], 1, has_fallback ? F_HAS_FALLBACK : F_NONE);
- map->add_gsub_pause (NULL);
+ map->add_gsub_pause (nullptr);
}
map->add_feature (HB_TAG('r','l','i','g'), 1, F_GLOBAL|F_HAS_FALLBACK);
if (plan->props.script == HB_SCRIPT_ARABIC)
map->add_gsub_pause (arabic_fallback_shape);
+ /* No pause after rclt. See 98460779bae19e4d64d29461ff154b3527bf8420. */
+ map->add_global_bool_feature (HB_TAG('r','c','l','t'));
map->add_global_bool_feature (HB_TAG('c','a','l','t'));
+ map->add_gsub_pause (nullptr);
/* The spec includes 'cswh'. Earlier versions of Windows
* used to enable this by default, but testing suggests
@@ -232,7 +235,6 @@ collect_features_arabic (hb_ot_shape_planner_t *plan)
* Note that IranNastaliq uses this feature extensively
* to fixup broken glyph sequences. Oh well...
* Test case: U+0643,U+0640,U+0631. */
- //map->add_gsub_pause (NULL);
//map->add_global_bool_feature (HB_TAG('c','s','w','h'));
map->add_global_bool_feature (HB_TAG('m','s','e','t'));
}
@@ -260,7 +262,7 @@ data_create_arabic (const hb_ot_shape_plan_t *plan)
{
arabic_shape_plan_t *arabic_plan = (arabic_shape_plan_t *) calloc (1, sizeof (arabic_shape_plan_t));
if (unlikely (!arabic_plan))
- return NULL;
+ return nullptr;
arabic_plan->do_fallback = plan->props.script == HB_SCRIPT_ARABIC;
arabic_plan->has_stch = !!plan->map.get_1_mask (HB_TAG ('s','t','c','h'));
@@ -316,7 +318,10 @@ arabic_joining (hb_buffer_t *buffer)
const arabic_state_table_entry *entry = &arabic_state_table[state][this_type];
if (entry->prev_action != NONE && prev != (unsigned int) -1)
+ {
info[prev].arabic_shaping_action() = entry->prev_action;
+ buffer->unsafe_to_break (prev, i + 1);
+ }
info[i].arabic_shaping_action() = entry->curr_action;
@@ -345,7 +350,7 @@ mongolian_variation_selectors (hb_buffer_t *buffer)
unsigned int count = buffer->len;
hb_glyph_info_t *info = buffer->info;
for (unsigned int i = 1; i < count; i++)
- if (unlikely (hb_in_range (info[i].codepoint, 0x180Bu, 0x180Du)))
+ if (unlikely (hb_in_range<hb_codepoint_t> (info[i].codepoint, 0x180Bu, 0x180Du)))
info[i].arabic_shaping_action() = info[i - 1].arabic_shaping_action();
}
@@ -404,7 +409,7 @@ retry:
{
/* This sucks. We need a font to build the fallback plan... */
fallback_plan = arabic_fallback_plan_create (plan, font);
- if (unlikely (!hb_atomic_ptr_cmpexch (&(const_cast<arabic_shape_plan_t *> (arabic_plan))->fallback_plan, NULL, fallback_plan))) {
+ if (unlikely (!hb_atomic_ptr_cmpexch (&(const_cast<arabic_shape_plan_t *> (arabic_plan))->fallback_plan, nullptr, fallback_plan))) {
arabic_fallback_plan_destroy (fallback_plan);
goto retry;
}
@@ -524,11 +529,11 @@ apply_stch (const hb_ot_shape_plan_t *plan,
}
i++; // Don't touch i again.
- DEBUG_MSG (ARABIC, NULL, "%s stretch at (%d,%d,%d)",
+ DEBUG_MSG (ARABIC, nullptr, "%s stretch at (%d,%d,%d)",
step == MEASURE ? "measuring" : "cutting", context, start, end);
- DEBUG_MSG (ARABIC, NULL, "rest of word: count=%d width %d", start - context, w_total);
- DEBUG_MSG (ARABIC, NULL, "fixed tiles: count=%d width=%d", n_fixed, w_fixed);
- DEBUG_MSG (ARABIC, NULL, "repeating tiles: count=%d width=%d", n_repeating, w_repeating);
+ DEBUG_MSG (ARABIC, nullptr, "rest of word: count=%d width %d", start - context, w_total);
+ DEBUG_MSG (ARABIC, nullptr, "fixed tiles: count=%d width=%d", n_fixed, w_fixed);
+ DEBUG_MSG (ARABIC, nullptr, "repeating tiles: count=%d width=%d", n_repeating, w_repeating);
/* Number of additional times to repeat each repeating tile. */
int n_copies = 0;
@@ -540,7 +545,7 @@ apply_stch (const hb_ot_shape_plan_t *plan,
/* See if we can improve the fit by adding an extra repeat and squeezing them together a bit. */
hb_position_t extra_repeat_overlap = 0;
hb_position_t shortfall = sign * w_remaining - sign * w_repeating * (n_copies + 1);
- if (shortfall > 0)
+ if (shortfall > 0 && n_repeating > 0)
{
++n_copies;
hb_position_t excess = (n_copies + 1) * sign * w_repeating - sign * w_remaining;
@@ -551,10 +556,11 @@ apply_stch (const hb_ot_shape_plan_t *plan,
if (step == MEASURE)
{
extra_glyphs_needed += n_copies * n_repeating;
- DEBUG_MSG (ARABIC, NULL, "will add extra %d copies of repeating tiles", n_copies);
+ DEBUG_MSG (ARABIC, nullptr, "will add extra %d copies of repeating tiles", n_copies);
}
else
{
+ buffer->unsafe_to_break (context, end);
hb_position_t x_offset = 0;
for (unsigned int k = end; k > start; k--)
{
@@ -564,7 +570,7 @@ apply_stch (const hb_ot_shape_plan_t *plan,
if (info[k - 1].arabic_shaping_action() == STCH_REPEATING)
repeat += n_copies;
- DEBUG_MSG (ARABIC, NULL, "appending %d copies of glyph %d; j=%d",
+ DEBUG_MSG (ARABIC, nullptr, "appending %d copies of glyph %d; j=%d",
repeat, info[k - 1].codepoint, j);
for (unsigned int n = 0; n < repeat; n++)
{
@@ -605,20 +611,94 @@ postprocess_glyphs_arabic (const hb_ot_shape_plan_t *plan,
HB_BUFFER_DEALLOCATE_VAR (buffer, arabic_shaping_action);
}
+/* http://www.unicode.org/reports/tr53/tr53-1.pdf */
+
+static hb_codepoint_t
+modifier_combining_marks[] =
+{
+ 0x0654u, /* ARABIC HAMZA ABOVE */
+ 0x0655u, /* ARABIC HAMZA BELOW */
+ 0x0658u, /* ARABIC MARK NOON GHUNNA */
+ 0x06DCu, /* ARABIC SMALL HIGH SEEN */
+ 0x06E3u, /* ARABIC SMALL LOW SEEN */
+ 0x06E7u, /* ARABIC SMALL HIGH YEH */
+ 0x06E8u, /* ARABIC SMALL HIGH NOON */
+ 0x08F3u, /* ARABIC SMALL HIGH WAW */
+};
+
+static inline bool
+info_is_mcm (const hb_glyph_info_t &info)
+{
+ hb_codepoint_t u = info.codepoint;
+ for (unsigned int i = 0; i < ARRAY_LENGTH (modifier_combining_marks); i++)
+ if (u == modifier_combining_marks[i])
+ return true;
+ return false;
+}
+
+static void
+reorder_marks_arabic (const hb_ot_shape_plan_t *plan,
+ hb_buffer_t *buffer,
+ unsigned int start,
+ unsigned int end)
+{
+ hb_glyph_info_t *info = buffer->info;
+
+ unsigned int i = start;
+ for (unsigned int cc = 220; cc <= 230; cc += 10)
+ {
+ DEBUG_MSG (ARABIC, buffer, "Looking for %d's starting at %d\n", cc, i);
+ while (i < end && info_cc(info[i]) < cc)
+ i++;
+ DEBUG_MSG (ARABIC, buffer, "Looking for %d's stopped at %d\n", cc, i);
+
+ if (i == end)
+ break;
+
+ if (info_cc(info[i]) > cc)
+ continue;
+
+ /* Technically we should also check "info_cc(info[j]) == cc"
+ * in the following loop. But not doing it is safe; we might
+ * end up moving all the 220 MCMs and 230 MCMs together in one
+ * move and be done. */
+ unsigned int j = i;
+ while (j < end && info_is_mcm (info[j]))
+ j++;
+ DEBUG_MSG (ARABIC, buffer, "Found %d's from %d to %d\n", cc, i, j);
+
+ if (i == j)
+ continue;
+
+ /* Shift it! */
+ DEBUG_MSG (ARABIC, buffer, "Shifting %d's: %d %d\n", cc, i, j);
+ hb_glyph_info_t temp[HB_OT_SHAPE_COMPLEX_MAX_COMBINING_MARKS];
+ assert (j - i <= ARRAY_LENGTH (temp));
+ buffer->merge_clusters (start, j);
+ memmove (temp, &info[i], (j - i) * sizeof (hb_glyph_info_t));
+ memmove (&info[start + j - i], &info[start], (i - start) * sizeof (hb_glyph_info_t));
+ memmove (&info[start], temp, (j - i) * sizeof (hb_glyph_info_t));
+
+ start += j - i;
+
+ i = j;
+ }
+}
+
const hb_ot_complex_shaper_t _hb_ot_complex_shaper_arabic =
{
- "arabic",
collect_features_arabic,
- NULL, /* override_features */
+ nullptr, /* override_features */
data_create_arabic,
data_destroy_arabic,
- NULL, /* preprocess_text */
+ nullptr, /* preprocess_text */
postprocess_glyphs_arabic,
HB_OT_SHAPE_NORMALIZATION_MODE_DEFAULT,
- NULL, /* decompose */
- NULL, /* compose */
+ nullptr, /* decompose */
+ nullptr, /* compose */
setup_masks_arabic,
- NULL, /* disable_otl */
+ nullptr, /* disable_otl */
+ reorder_marks_arabic,
HB_OT_SHAPE_ZERO_WIDTH_MARKS_BY_GDEF_LATE,
true, /* fallback_position */
};
diff --git a/src/3rdparty/harfbuzz-ng/src/hb-ot-shape-complex-default.cc b/src/3rdparty/harfbuzz-ng/src/hb-ot-shape-complex-default.cc
index 42830ab618..68a62a10d4 100644
--- a/src/3rdparty/harfbuzz-ng/src/hb-ot-shape-complex-default.cc
+++ b/src/3rdparty/harfbuzz-ng/src/hb-ot-shape-complex-default.cc
@@ -29,18 +29,18 @@
const hb_ot_complex_shaper_t _hb_ot_complex_shaper_default =
{
- "default",
- NULL, /* collect_features */
- NULL, /* override_features */
- NULL, /* data_create */
- NULL, /* data_destroy */
- NULL, /* preprocess_text */
- NULL, /* postprocess_glyphs */
+ nullptr, /* collect_features */
+ nullptr, /* override_features */
+ nullptr, /* data_create */
+ nullptr, /* data_destroy */
+ nullptr, /* preprocess_text */
+ nullptr, /* postprocess_glyphs */
HB_OT_SHAPE_NORMALIZATION_MODE_DEFAULT,
- NULL, /* decompose */
- NULL, /* compose */
- NULL, /* setup_masks */
- NULL, /* disable_otl */
+ nullptr, /* decompose */
+ nullptr, /* compose */
+ nullptr, /* setup_masks */
+ nullptr, /* disable_otl */
+ nullptr, /* reorder_marks */
HB_OT_SHAPE_ZERO_WIDTH_MARKS_BY_GDEF_LATE,
true, /* fallback_position */
};
diff --git a/src/3rdparty/harfbuzz-ng/src/hb-ot-shape-complex-hangul.cc b/src/3rdparty/harfbuzz-ng/src/hb-ot-shape-complex-hangul.cc
index eb95a28c09..7508c223c4 100644
--- a/src/3rdparty/harfbuzz-ng/src/hb-ot-shape-complex-hangul.cc
+++ b/src/3rdparty/harfbuzz-ng/src/hb-ot-shape-complex-hangul.cc
@@ -32,7 +32,7 @@
/* Same order as the feature array below */
enum {
- NONE,
+ _JMO,
LJMO,
VJMO,
@@ -80,7 +80,7 @@ data_create_hangul (const hb_ot_shape_plan_t *plan)
{
hangul_shape_plan_t *hangul_plan = (hangul_shape_plan_t *) calloc (1, sizeof (hangul_shape_plan_t));
if (unlikely (!hangul_plan))
- return NULL;
+ return nullptr;
for (unsigned int i = 0; i < HANGUL_FEATURE_COUNT; i++)
hangul_plan->mask_array[i] = plan->map.get_1_mask (hangul_features[i]);
@@ -105,16 +105,16 @@ data_destroy_hangul (void *data)
#define NCount (VCount * TCount)
#define SCount (LCount * NCount)
-#define isCombiningL(u) (hb_in_range ((u), LBase, LBase+LCount-1))
-#define isCombiningV(u) (hb_in_range ((u), VBase, VBase+VCount-1))
-#define isCombiningT(u) (hb_in_range ((u), TBase+1, TBase+TCount-1))
-#define isCombinedS(u) (hb_in_range ((u), SBase, SBase+SCount-1))
+#define isCombiningL(u) (hb_in_range<hb_codepoint_t> ((u), LBase, LBase+LCount-1))
+#define isCombiningV(u) (hb_in_range<hb_codepoint_t> ((u), VBase, VBase+VCount-1))
+#define isCombiningT(u) (hb_in_range<hb_codepoint_t> ((u), TBase+1, TBase+TCount-1))
+#define isCombinedS(u) (hb_in_range<hb_codepoint_t> ((u), SBase, SBase+SCount-1))
-#define isL(u) (hb_in_ranges ((u), 0x1100u, 0x115Fu, 0xA960u, 0xA97Cu))
-#define isV(u) (hb_in_ranges ((u), 0x1160u, 0x11A7u, 0xD7B0u, 0xD7C6u))
-#define isT(u) (hb_in_ranges ((u), 0x11A8u, 0x11FFu, 0xD7CBu, 0xD7FBu))
+#define isL(u) (hb_in_ranges<hb_codepoint_t> ((u), 0x1100u, 0x115Fu, 0xA960u, 0xA97Cu))
+#define isV(u) (hb_in_ranges<hb_codepoint_t> ((u), 0x1160u, 0x11A7u, 0xD7B0u, 0xD7C6u))
+#define isT(u) (hb_in_ranges<hb_codepoint_t> ((u), 0x11A8u, 0x11FFu, 0xD7CBu, 0xD7FBu))
-#define isHangulTone(u) (hb_in_range ((u), 0x302Eu, 0x302Fu))
+#define isHangulTone(u) (hb_in_range<hb_codepoint_t> ((u), 0x302Eu, 0x302Fu))
/* buffer var allocations */
#define hangul_shaping_feature() complex_var_u8_0() /* hangul jamo shaping feature */
@@ -202,6 +202,7 @@ preprocess_text_hangul (const hb_ot_shape_plan_t *plan,
if (start < end && end == buffer->out_len)
{
/* Tone mark follows a valid syllable; move it in front, unless it's zero width. */
+ buffer->unsafe_to_break_from_outbuffer (start, buffer->idx);
buffer->next_glyph ();
if (!is_zero_width_char (font, u))
{
@@ -258,6 +259,7 @@ preprocess_text_hangul (const hb_ot_shape_plan_t *plan,
else
t = 0; /* The next character was not a trailing jamo. */
}
+ buffer->unsafe_to_break (buffer->idx, buffer->idx + (t ? 3 : 2));
/* We've got a syllable <L,V,T?>; see if it can potentially be composed. */
if (isCombiningL (l) && isCombiningV (v) && (t == 0 || isCombiningT (t)))
@@ -322,6 +324,8 @@ preprocess_text_hangul (const hb_ot_shape_plan_t *plan,
end = start + 1;
continue;
}
+ else
+ buffer->unsafe_to_break (buffer->idx, buffer->idx + 2); /* Mark unsafe between LV and T. */
}
/* Otherwise, decompose if font doesn't support <LV> or <LVT>,
@@ -368,6 +372,8 @@ preprocess_text_hangul (const hb_ot_shape_plan_t *plan,
buffer->merge_out_clusters (start, end);
continue;
}
+ else if ((!tindex && buffer->idx + 1 < count && isT (buffer->cur(+1).codepoint)))
+ buffer->unsafe_to_break (buffer->idx, buffer->idx + 2); /* Mark unsafe between LV and T. */
}
if (has_glyph)
@@ -408,18 +414,18 @@ setup_masks_hangul (const hb_ot_shape_plan_t *plan,
const hb_ot_complex_shaper_t _hb_ot_complex_shaper_hangul =
{
- "hangul",
collect_features_hangul,
override_features_hangul,
data_create_hangul,
data_destroy_hangul,
preprocess_text_hangul,
- NULL, /* postprocess_glyphs */
+ nullptr, /* postprocess_glyphs */
HB_OT_SHAPE_NORMALIZATION_MODE_NONE,
- NULL, /* decompose */
- NULL, /* compose */
+ nullptr, /* decompose */
+ nullptr, /* compose */
setup_masks_hangul,
- NULL, /* disable_otl */
+ nullptr, /* disable_otl */
+ nullptr, /* reorder_marks */
HB_OT_SHAPE_ZERO_WIDTH_MARKS_NONE,
false, /* fallback_position */
};
diff --git a/src/3rdparty/harfbuzz-ng/src/hb-ot-shape-complex-hebrew.cc b/src/3rdparty/harfbuzz-ng/src/hb-ot-shape-complex-hebrew.cc
index 96f2494616..34cf28b8e2 100644
--- a/src/3rdparty/harfbuzz-ng/src/hb-ot-shape-complex-hebrew.cc
+++ b/src/3rdparty/harfbuzz-ng/src/hb-ot-shape-complex-hebrew.cc
@@ -161,7 +161,7 @@ disable_otl_hebrew (const hb_ot_shape_plan_t *plan)
* script. This matches Uniscribe better, and makes fonts like
* Arial that have GSUB/GPOS/GDEF but no data for Hebrew work.
* See:
- * https://github.com/behdad/harfbuzz/issues/347#issuecomment-267838368
+ * https://github.com/harfbuzz/harfbuzz/issues/347#issuecomment-267838368
*/
return plan->map.chosen_script[1] != HB_TAG ('h','e','b','r');
}
@@ -169,18 +169,18 @@ disable_otl_hebrew (const hb_ot_shape_plan_t *plan)
const hb_ot_complex_shaper_t _hb_ot_complex_shaper_hebrew =
{
- "hebrew",
- NULL, /* collect_features */
- NULL, /* override_features */
- NULL, /* data_create */
- NULL, /* data_destroy */
- NULL, /* preprocess_text */
- NULL, /* postprocess_glyphs */
+ nullptr, /* collect_features */
+ nullptr, /* override_features */
+ nullptr, /* data_create */
+ nullptr, /* data_destroy */
+ nullptr, /* preprocess_text */
+ nullptr, /* postprocess_glyphs */
HB_OT_SHAPE_NORMALIZATION_MODE_DEFAULT,
- NULL, /* decompose */
+ nullptr, /* decompose */
compose_hebrew,
- NULL, /* setup_masks */
+ nullptr, /* setup_masks */
disable_otl_hebrew,
+ nullptr, /* reorder_marks */
HB_OT_SHAPE_ZERO_WIDTH_MARKS_BY_GDEF_LATE,
true, /* fallback_position */
};
diff --git a/src/3rdparty/harfbuzz-ng/src/hb-ot-shape-complex-indic-machine.hh b/src/3rdparty/harfbuzz-ng/src/hb-ot-shape-complex-indic-machine.hh
index 5a7a265c87..7eaba4e4e7 100644
--- a/src/3rdparty/harfbuzz-ng/src/hb-ot-shape-complex-indic-machine.hh
+++ b/src/3rdparty/harfbuzz-ng/src/hb-ot-shape-complex-indic-machine.hh
@@ -56,7 +56,7 @@ static const unsigned char _indic_syllable_machine_trans_keys[] = {
5u, 7u, 5u, 8u, 5u, 7u, 7u, 7u, 5u, 8u, 5u, 7u, 7u, 7u, 5u, 8u,
5u, 7u, 7u, 7u, 8u, 8u, 1u, 16u, 8u, 13u, 4u, 8u, 6u, 6u, 16u, 16u,
4u, 8u, 6u, 6u, 16u, 16u, 4u, 8u, 6u, 6u, 16u, 16u, 4u, 8u, 6u, 6u,
- 16u, 16u, 8u, 8u, 1u, 18u, 3u, 17u, 3u, 17u, 4u, 17u, 1u, 16u, 3u, 17u,
+ 16u, 16u, 8u, 8u, 1u, 19u, 3u, 17u, 3u, 17u, 4u, 17u, 1u, 16u, 3u, 17u,
3u, 17u, 4u, 17u, 1u, 16u, 3u, 17u, 3u, 17u, 4u, 17u, 1u, 16u, 3u, 17u,
3u, 17u, 4u, 17u, 1u, 16u, 3u, 17u, 3u, 17u, 4u, 17u, 5u, 14u, 5u, 14u,
5u, 10u, 9u, 10u, 9u, 9u, 9u, 10u, 9u, 10u, 9u, 9u, 5u, 10u, 3u, 13u,
@@ -101,7 +101,7 @@ static const unsigned char _indic_syllable_machine_trans_keys[] = {
3u, 14u, 4u, 14u, 5u, 14u, 3u, 14u, 4u, 14u, 5u, 14u, 3u, 14u, 4u, 14u,
5u, 14u, 3u, 14u, 4u, 14u, 5u, 14u, 3u, 13u, 3u, 10u, 5u, 10u, 3u, 10u,
3u, 13u, 1u, 16u, 3u, 10u, 5u, 10u, 5u, 10u, 9u, 10u, 9u, 9u, 9u, 10u,
- 9u, 10u, 9u, 9u, 5u, 10u, 0
+ 9u, 10u, 9u, 9u, 5u, 10u, 1u, 16u, 0
};
static const char _indic_syllable_machine_key_spans[] = {
@@ -127,7 +127,7 @@ static const char _indic_syllable_machine_key_spans[] = {
3, 4, 3, 1, 4, 3, 1, 4,
3, 1, 1, 16, 6, 5, 1, 1,
5, 1, 1, 5, 1, 1, 5, 1,
- 1, 1, 18, 15, 15, 14, 16, 15,
+ 1, 1, 19, 15, 15, 14, 16, 15,
15, 14, 16, 15, 15, 14, 16, 15,
15, 14, 16, 15, 15, 14, 10, 10,
6, 2, 1, 2, 2, 1, 6, 11,
@@ -172,7 +172,7 @@ static const char _indic_syllable_machine_key_spans[] = {
12, 11, 10, 12, 11, 10, 12, 11,
10, 12, 11, 10, 11, 8, 6, 8,
11, 16, 8, 6, 6, 2, 1, 2,
- 2, 1, 6
+ 2, 1, 6, 16
};
static const short _indic_syllable_machine_index_offsets[] = {
@@ -198,52 +198,52 @@ static const short _indic_syllable_machine_index_offsets[] = {
954, 958, 963, 967, 969, 974, 978, 980,
985, 989, 991, 993, 1010, 1017, 1023, 1025,
1027, 1033, 1035, 1037, 1043, 1045, 1047, 1053,
- 1055, 1057, 1059, 1078, 1094, 1110, 1125, 1142,
- 1158, 1174, 1189, 1206, 1222, 1238, 1253, 1270,
- 1286, 1302, 1317, 1334, 1350, 1366, 1381, 1392,
- 1403, 1410, 1413, 1415, 1418, 1421, 1423, 1430,
- 1442, 1451, 1458, 1467, 1479, 1492, 1505, 1517,
- 1528, 1541, 1553, 1564, 1577, 1589, 1600, 1613,
- 1625, 1636, 1649, 1666, 1678, 1694, 1710, 1727,
- 1744, 1761, 1778, 1795, 1811, 1827, 1844, 1861,
- 1878, 1895, 1912, 1928, 1944, 1961, 1978, 1995,
- 2012, 2029, 2045, 2061, 2078, 2095, 2112, 2129,
- 2146, 2162, 2178, 2194, 2210, 2225, 2242, 2258,
- 2274, 2289, 2306, 2322, 2338, 2353, 2370, 2386,
- 2402, 2417, 2434, 2450, 2466, 2481, 2492, 2503,
- 2510, 2513, 2515, 2518, 2521, 2523, 2530, 2542,
- 2551, 2558, 2567, 2579, 2592, 2605, 2617, 2628,
- 2641, 2653, 2664, 2677, 2689, 2700, 2713, 2725,
- 2736, 2749, 2766, 2778, 2794, 2810, 2827, 2844,
- 2861, 2878, 2895, 2911, 2927, 2944, 2961, 2978,
- 2995, 3012, 3028, 3044, 3061, 3078, 3095, 3112,
- 3129, 3145, 3161, 3178, 3195, 3212, 3229, 3241,
- 3258, 3274, 3290, 3305, 3322, 3338, 3354, 3369,
- 3386, 3402, 3418, 3433, 3450, 3466, 3482, 3497,
- 3514, 3530, 3546, 3561, 3572, 3583, 3590, 3593,
- 3595, 3598, 3601, 3603, 3610, 3622, 3631, 3638,
- 3647, 3659, 3672, 3685, 3697, 3708, 3721, 3733,
- 3744, 3757, 3769, 3780, 3793, 3805, 3816, 3829,
- 3846, 3858, 3874, 3890, 3907, 3924, 3941, 3958,
- 3975, 3991, 4007, 4024, 4041, 4058, 4075, 4092,
- 4108, 4124, 4141, 4158, 4175, 4192, 4209, 4225,
- 4241, 4258, 4275, 4292, 4309, 4326, 4338, 4354,
- 4366, 4382, 4398, 4413, 4430, 4446, 4462, 4477,
- 4494, 4510, 4526, 4541, 4558, 4574, 4590, 4605,
- 4622, 4638, 4654, 4669, 4680, 4691, 4698, 4701,
- 4703, 4706, 4709, 4711, 4718, 4730, 4739, 4746,
- 4755, 4767, 4780, 4793, 4805, 4816, 4829, 4841,
- 4852, 4865, 4877, 4888, 4901, 4913, 4924, 4937,
- 4954, 4966, 4982, 4998, 5015, 5032, 5049, 5066,
- 5083, 5099, 5115, 5132, 5149, 5166, 5183, 5200,
- 5216, 5232, 5249, 5266, 5283, 5300, 5317, 5333,
- 5349, 5366, 5383, 5400, 5417, 5434, 5450, 5468,
- 5484, 5502, 5514, 5521, 5524, 5526, 5529, 5532,
- 5534, 5541, 5558, 5574, 5590, 5605, 5621, 5637,
- 5654, 5667, 5679, 5690, 5703, 5715, 5726, 5739,
- 5751, 5762, 5775, 5787, 5798, 5810, 5819, 5826,
- 5835, 5847, 5864, 5873, 5880, 5887, 5890, 5892,
- 5895, 5898, 5900
+ 1055, 1057, 1059, 1079, 1095, 1111, 1126, 1143,
+ 1159, 1175, 1190, 1207, 1223, 1239, 1254, 1271,
+ 1287, 1303, 1318, 1335, 1351, 1367, 1382, 1393,
+ 1404, 1411, 1414, 1416, 1419, 1422, 1424, 1431,
+ 1443, 1452, 1459, 1468, 1480, 1493, 1506, 1518,
+ 1529, 1542, 1554, 1565, 1578, 1590, 1601, 1614,
+ 1626, 1637, 1650, 1667, 1679, 1695, 1711, 1728,
+ 1745, 1762, 1779, 1796, 1812, 1828, 1845, 1862,
+ 1879, 1896, 1913, 1929, 1945, 1962, 1979, 1996,
+ 2013, 2030, 2046, 2062, 2079, 2096, 2113, 2130,
+ 2147, 2163, 2179, 2195, 2211, 2226, 2243, 2259,
+ 2275, 2290, 2307, 2323, 2339, 2354, 2371, 2387,
+ 2403, 2418, 2435, 2451, 2467, 2482, 2493, 2504,
+ 2511, 2514, 2516, 2519, 2522, 2524, 2531, 2543,
+ 2552, 2559, 2568, 2580, 2593, 2606, 2618, 2629,
+ 2642, 2654, 2665, 2678, 2690, 2701, 2714, 2726,
+ 2737, 2750, 2767, 2779, 2795, 2811, 2828, 2845,
+ 2862, 2879, 2896, 2912, 2928, 2945, 2962, 2979,
+ 2996, 3013, 3029, 3045, 3062, 3079, 3096, 3113,
+ 3130, 3146, 3162, 3179, 3196, 3213, 3230, 3242,
+ 3259, 3275, 3291, 3306, 3323, 3339, 3355, 3370,
+ 3387, 3403, 3419, 3434, 3451, 3467, 3483, 3498,
+ 3515, 3531, 3547, 3562, 3573, 3584, 3591, 3594,
+ 3596, 3599, 3602, 3604, 3611, 3623, 3632, 3639,
+ 3648, 3660, 3673, 3686, 3698, 3709, 3722, 3734,
+ 3745, 3758, 3770, 3781, 3794, 3806, 3817, 3830,
+ 3847, 3859, 3875, 3891, 3908, 3925, 3942, 3959,
+ 3976, 3992, 4008, 4025, 4042, 4059, 4076, 4093,
+ 4109, 4125, 4142, 4159, 4176, 4193, 4210, 4226,
+ 4242, 4259, 4276, 4293, 4310, 4327, 4339, 4355,
+ 4367, 4383, 4399, 4414, 4431, 4447, 4463, 4478,
+ 4495, 4511, 4527, 4542, 4559, 4575, 4591, 4606,
+ 4623, 4639, 4655, 4670, 4681, 4692, 4699, 4702,
+ 4704, 4707, 4710, 4712, 4719, 4731, 4740, 4747,
+ 4756, 4768, 4781, 4794, 4806, 4817, 4830, 4842,
+ 4853, 4866, 4878, 4889, 4902, 4914, 4925, 4938,
+ 4955, 4967, 4983, 4999, 5016, 5033, 5050, 5067,
+ 5084, 5100, 5116, 5133, 5150, 5167, 5184, 5201,
+ 5217, 5233, 5250, 5267, 5284, 5301, 5318, 5334,
+ 5350, 5367, 5384, 5401, 5418, 5435, 5451, 5469,
+ 5485, 5503, 5515, 5522, 5525, 5527, 5530, 5533,
+ 5535, 5542, 5559, 5575, 5591, 5606, 5622, 5638,
+ 5655, 5668, 5680, 5691, 5704, 5716, 5727, 5740,
+ 5752, 5763, 5776, 5788, 5799, 5811, 5820, 5827,
+ 5836, 5848, 5865, 5874, 5881, 5888, 5891, 5893,
+ 5896, 5899, 5901, 5908
};
static const short _indic_syllable_machine_indicies[] = {
@@ -381,611 +381,613 @@ static const short _indic_syllable_machine_indicies[] = {
161, 161, 162, 157, 0, 183, 0, 184,
0, 186, 185, 188, 189, 190, 191, 192,
193, 84, 79, 194, 195, 196, 196, 156,
- 197, 198, 199, 200, 201, 187, 203, 204,
- 205, 206, 6, 1, 207, 208, 202, 202,
- 38, 209, 202, 202, 210, 202, 211, 204,
- 212, 212, 6, 1, 207, 208, 202, 202,
- 202, 209, 202, 202, 210, 202, 204, 212,
- 212, 6, 1, 207, 208, 202, 202, 202,
- 209, 202, 202, 210, 202, 213, 202, 202,
- 202, 19, 214, 202, 1, 207, 208, 202,
- 202, 202, 215, 202, 213, 202, 216, 217,
- 218, 219, 6, 1, 207, 208, 202, 202,
- 36, 220, 202, 202, 210, 202, 221, 217,
- 222, 222, 6, 1, 207, 208, 202, 202,
- 202, 220, 202, 202, 210, 202, 217, 222,
- 222, 6, 1, 207, 208, 202, 202, 202,
- 220, 202, 202, 210, 202, 223, 202, 202,
- 202, 19, 224, 202, 1, 207, 208, 202,
- 202, 202, 215, 202, 223, 202, 225, 226,
- 227, 228, 6, 1, 207, 208, 202, 202,
- 34, 229, 202, 202, 210, 202, 230, 226,
- 231, 231, 6, 1, 207, 208, 202, 202,
- 202, 229, 202, 202, 210, 202, 226, 231,
- 231, 6, 1, 207, 208, 202, 202, 202,
- 229, 202, 202, 210, 202, 232, 202, 202,
- 202, 19, 233, 202, 1, 207, 208, 202,
- 202, 202, 215, 202, 232, 202, 234, 235,
- 236, 237, 6, 1, 207, 208, 202, 202,
- 32, 238, 202, 202, 210, 202, 239, 235,
- 240, 240, 6, 1, 207, 208, 202, 202,
- 202, 238, 202, 202, 210, 202, 235, 240,
- 240, 6, 1, 207, 208, 202, 202, 202,
- 238, 202, 202, 210, 202, 241, 202, 202,
- 202, 19, 242, 202, 1, 207, 208, 202,
- 202, 202, 215, 202, 241, 202, 243, 244,
- 245, 246, 6, 1, 207, 208, 202, 202,
- 30, 247, 202, 202, 210, 202, 248, 244,
- 249, 249, 6, 1, 207, 208, 202, 202,
- 202, 247, 202, 202, 210, 202, 244, 249,
- 249, 6, 1, 207, 208, 202, 202, 202,
- 247, 202, 202, 210, 202, 19, 250, 202,
- 1, 207, 208, 202, 202, 202, 215, 202,
- 251, 251, 202, 1, 207, 208, 202, 202,
- 202, 215, 202, 252, 202, 202, 253, 207,
- 208, 202, 207, 208, 202, 254, 202, 207,
- 255, 202, 207, 256, 202, 207, 202, 252,
- 202, 202, 202, 207, 208, 202, 257, 202,
- 258, 259, 202, 1, 207, 208, 202, 202,
- 4, 202, 3, 202, 251, 251, 202, 1,
- 207, 208, 202, 251, 251, 202, 1, 207,
- 208, 202, 257, 202, 251, 251, 202, 1,
- 207, 208, 202, 257, 202, 258, 251, 202,
- 1, 207, 208, 202, 202, 4, 202, 19,
- 202, 260, 260, 6, 1, 207, 208, 202,
- 202, 202, 215, 202, 261, 28, 262, 263,
- 9, 1, 207, 208, 202, 202, 202, 215,
- 202, 28, 262, 263, 9, 1, 207, 208,
- 202, 202, 202, 215, 202, 262, 262, 9,
- 1, 207, 208, 202, 202, 202, 215, 202,
- 264, 25, 265, 266, 12, 1, 207, 208,
- 202, 202, 202, 215, 202, 25, 265, 266,
- 12, 1, 207, 208, 202, 202, 202, 215,
- 202, 265, 265, 12, 1, 207, 208, 202,
- 202, 202, 215, 202, 267, 22, 268, 269,
- 15, 1, 207, 208, 202, 202, 202, 215,
- 202, 22, 268, 269, 15, 1, 207, 208,
- 202, 202, 202, 215, 202, 268, 268, 15,
- 1, 207, 208, 202, 202, 202, 215, 202,
- 270, 19, 251, 271, 202, 1, 207, 208,
- 202, 202, 202, 215, 202, 19, 251, 271,
- 202, 1, 207, 208, 202, 202, 202, 215,
- 202, 251, 272, 202, 1, 207, 208, 202,
- 202, 202, 215, 202, 19, 202, 251, 251,
- 202, 1, 207, 208, 202, 202, 202, 215,
- 202, 2, 3, 202, 202, 19, 250, 202,
- 1, 207, 208, 202, 202, 202, 215, 202,
- 2, 202, 244, 249, 249, 6, 1, 207,
- 208, 202, 202, 202, 247, 202, 243, 244,
- 249, 249, 6, 1, 207, 208, 202, 202,
- 202, 247, 202, 202, 210, 202, 243, 244,
- 245, 249, 6, 1, 207, 208, 202, 202,
- 30, 247, 202, 202, 210, 202, 241, 202,
- 273, 202, 260, 260, 6, 1, 207, 208,
- 202, 202, 202, 215, 202, 241, 202, 241,
- 202, 202, 202, 251, 251, 202, 1, 207,
- 208, 202, 202, 202, 215, 202, 241, 202,
- 241, 202, 202, 202, 251, 274, 202, 1,
- 207, 208, 202, 202, 202, 215, 202, 241,
- 202, 241, 202, 273, 202, 251, 251, 202,
- 1, 207, 208, 202, 202, 202, 215, 202,
- 241, 202, 241, 3, 202, 202, 19, 242,
- 202, 1, 207, 208, 202, 202, 202, 215,
- 202, 241, 202, 234, 235, 240, 240, 6,
- 1, 207, 208, 202, 202, 202, 238, 202,
- 202, 210, 202, 234, 235, 236, 240, 6,
- 1, 207, 208, 202, 202, 32, 238, 202,
- 202, 210, 202, 232, 202, 275, 202, 260,
- 260, 6, 1, 207, 208, 202, 202, 202,
- 215, 202, 232, 202, 232, 202, 202, 202,
- 251, 251, 202, 1, 207, 208, 202, 202,
- 202, 215, 202, 232, 202, 232, 202, 202,
- 202, 251, 276, 202, 1, 207, 208, 202,
- 202, 202, 215, 202, 232, 202, 232, 202,
- 275, 202, 251, 251, 202, 1, 207, 208,
- 202, 202, 202, 215, 202, 232, 202, 232,
- 3, 202, 202, 19, 233, 202, 1, 207,
- 208, 202, 202, 202, 215, 202, 232, 202,
- 225, 226, 231, 231, 6, 1, 207, 208,
- 202, 202, 202, 229, 202, 202, 210, 202,
- 225, 226, 227, 231, 6, 1, 207, 208,
- 202, 202, 34, 229, 202, 202, 210, 202,
- 223, 202, 277, 202, 260, 260, 6, 1,
- 207, 208, 202, 202, 202, 215, 202, 223,
- 202, 223, 202, 202, 202, 251, 251, 202,
- 1, 207, 208, 202, 202, 202, 215, 202,
- 223, 202, 223, 202, 202, 202, 251, 278,
- 202, 1, 207, 208, 202, 202, 202, 215,
- 202, 223, 202, 223, 202, 277, 202, 251,
- 251, 202, 1, 207, 208, 202, 202, 202,
- 215, 202, 223, 202, 223, 3, 202, 202,
- 19, 224, 202, 1, 207, 208, 202, 202,
- 202, 215, 202, 223, 202, 216, 217, 222,
- 222, 6, 1, 207, 208, 202, 202, 202,
- 220, 202, 202, 210, 202, 216, 217, 218,
- 222, 6, 1, 207, 208, 202, 202, 36,
- 220, 202, 202, 210, 202, 213, 202, 279,
- 202, 260, 260, 6, 1, 207, 208, 202,
- 202, 202, 215, 202, 213, 202, 213, 202,
- 202, 202, 251, 251, 202, 1, 207, 208,
- 202, 202, 202, 215, 202, 213, 202, 213,
- 202, 202, 202, 251, 280, 202, 1, 207,
- 208, 202, 202, 202, 215, 202, 213, 202,
- 213, 202, 279, 202, 251, 251, 202, 1,
- 207, 208, 202, 202, 202, 215, 202, 213,
- 202, 213, 3, 202, 202, 19, 214, 202,
- 1, 207, 208, 202, 202, 202, 215, 202,
- 213, 202, 203, 204, 212, 212, 6, 1,
- 207, 208, 202, 202, 202, 209, 202, 202,
- 210, 202, 203, 204, 205, 212, 6, 1,
- 207, 208, 202, 202, 38, 209, 202, 202,
- 210, 202, 282, 283, 284, 285, 45, 40,
- 286, 287, 281, 281, 77, 288, 281, 281,
- 289, 281, 290, 283, 291, 285, 45, 40,
- 286, 287, 281, 281, 281, 288, 281, 281,
- 289, 281, 283, 291, 285, 45, 40, 286,
- 287, 281, 281, 281, 288, 281, 281, 289,
- 281, 292, 281, 281, 281, 58, 293, 281,
- 40, 286, 287, 281, 281, 281, 294, 281,
- 292, 281, 295, 296, 297, 298, 45, 40,
- 286, 287, 281, 281, 75, 299, 281, 281,
- 289, 281, 300, 296, 301, 301, 45, 40,
- 286, 287, 281, 281, 281, 299, 281, 281,
- 289, 281, 296, 301, 301, 45, 40, 286,
- 287, 281, 281, 281, 299, 281, 281, 289,
- 281, 302, 281, 281, 281, 58, 303, 281,
- 40, 286, 287, 281, 281, 281, 294, 281,
- 302, 281, 304, 305, 306, 307, 45, 40,
- 286, 287, 281, 281, 73, 308, 281, 281,
- 289, 281, 309, 305, 310, 310, 45, 40,
- 286, 287, 281, 281, 281, 308, 281, 281,
- 289, 281, 305, 310, 310, 45, 40, 286,
- 287, 281, 281, 281, 308, 281, 281, 289,
- 281, 311, 281, 281, 281, 58, 312, 281,
- 40, 286, 287, 281, 281, 281, 294, 281,
- 311, 281, 313, 314, 315, 316, 45, 40,
- 286, 287, 281, 281, 71, 317, 281, 281,
- 289, 281, 318, 314, 319, 319, 45, 40,
- 286, 287, 281, 281, 281, 317, 281, 281,
- 289, 281, 314, 319, 319, 45, 40, 286,
- 287, 281, 281, 281, 317, 281, 281, 289,
- 281, 320, 281, 281, 281, 58, 321, 281,
- 40, 286, 287, 281, 281, 281, 294, 281,
- 320, 281, 322, 323, 324, 325, 45, 40,
- 286, 287, 281, 281, 69, 326, 281, 281,
- 289, 281, 327, 323, 328, 328, 45, 40,
- 286, 287, 281, 281, 281, 326, 281, 281,
- 289, 281, 323, 328, 328, 45, 40, 286,
- 287, 281, 281, 281, 326, 281, 281, 289,
- 281, 58, 329, 281, 40, 286, 287, 281,
- 281, 281, 294, 281, 330, 330, 281, 40,
- 286, 287, 281, 281, 281, 294, 281, 331,
- 281, 281, 332, 286, 287, 281, 286, 287,
- 281, 333, 281, 286, 334, 281, 286, 335,
- 281, 286, 281, 331, 281, 281, 281, 286,
- 287, 281, 336, 281, 337, 338, 281, 40,
- 286, 287, 281, 281, 43, 281, 42, 281,
- 330, 330, 281, 40, 286, 287, 281, 330,
- 330, 281, 40, 286, 287, 281, 336, 281,
- 330, 330, 281, 40, 286, 287, 281, 336,
- 281, 337, 330, 281, 40, 286, 287, 281,
- 281, 43, 281, 58, 281, 339, 339, 45,
- 40, 286, 287, 281, 281, 281, 294, 281,
- 340, 67, 341, 342, 48, 40, 286, 287,
- 281, 281, 281, 294, 281, 67, 341, 342,
- 48, 40, 286, 287, 281, 281, 281, 294,
- 281, 341, 341, 48, 40, 286, 287, 281,
- 281, 281, 294, 281, 343, 64, 344, 345,
- 51, 40, 286, 287, 281, 281, 281, 294,
- 281, 64, 344, 345, 51, 40, 286, 287,
- 281, 281, 281, 294, 281, 344, 344, 51,
- 40, 286, 287, 281, 281, 281, 294, 281,
- 346, 61, 347, 348, 54, 40, 286, 287,
- 281, 281, 281, 294, 281, 61, 347, 348,
- 54, 40, 286, 287, 281, 281, 281, 294,
- 281, 347, 347, 54, 40, 286, 287, 281,
- 281, 281, 294, 281, 349, 58, 330, 350,
- 281, 40, 286, 287, 281, 281, 281, 294,
- 281, 58, 330, 350, 281, 40, 286, 287,
- 281, 281, 281, 294, 281, 330, 351, 281,
- 40, 286, 287, 281, 281, 281, 294, 281,
- 58, 281, 330, 330, 281, 40, 286, 287,
- 281, 281, 281, 294, 281, 41, 42, 281,
- 281, 58, 329, 281, 40, 286, 287, 281,
- 281, 281, 294, 281, 41, 281, 323, 328,
- 328, 45, 40, 286, 287, 281, 281, 281,
- 326, 281, 322, 323, 328, 328, 45, 40,
- 286, 287, 281, 281, 281, 326, 281, 281,
- 289, 281, 322, 323, 324, 328, 45, 40,
- 286, 287, 281, 281, 69, 326, 281, 281,
- 289, 281, 320, 281, 352, 281, 339, 339,
- 45, 40, 286, 287, 281, 281, 281, 294,
- 281, 320, 281, 320, 281, 281, 281, 330,
- 330, 281, 40, 286, 287, 281, 281, 281,
- 294, 281, 320, 281, 320, 281, 281, 281,
- 330, 353, 281, 40, 286, 287, 281, 281,
- 281, 294, 281, 320, 281, 320, 281, 352,
- 281, 330, 330, 281, 40, 286, 287, 281,
- 281, 281, 294, 281, 320, 281, 320, 42,
- 281, 281, 58, 321, 281, 40, 286, 287,
- 281, 281, 281, 294, 281, 320, 281, 313,
- 314, 319, 319, 45, 40, 286, 287, 281,
- 281, 281, 317, 281, 281, 289, 281, 313,
- 314, 315, 319, 45, 40, 286, 287, 281,
- 281, 71, 317, 281, 281, 289, 281, 311,
- 281, 354, 281, 339, 339, 45, 40, 286,
- 287, 281, 281, 281, 294, 281, 311, 281,
- 311, 281, 281, 281, 330, 330, 281, 40,
- 286, 287, 281, 281, 281, 294, 281, 311,
- 281, 311, 281, 281, 281, 330, 355, 281,
- 40, 286, 287, 281, 281, 281, 294, 281,
- 311, 281, 311, 281, 354, 281, 330, 330,
- 281, 40, 286, 287, 281, 281, 281, 294,
- 281, 311, 281, 311, 42, 281, 281, 58,
- 312, 281, 40, 286, 287, 281, 281, 281,
- 294, 281, 311, 281, 304, 305, 310, 310,
- 45, 40, 286, 287, 281, 281, 281, 308,
- 281, 281, 289, 281, 304, 305, 306, 310,
- 45, 40, 286, 287, 281, 281, 73, 308,
- 281, 281, 289, 281, 302, 281, 356, 281,
- 339, 339, 45, 40, 286, 287, 281, 281,
- 281, 294, 281, 302, 281, 302, 281, 281,
- 281, 330, 330, 281, 40, 286, 287, 281,
- 281, 281, 294, 281, 302, 281, 302, 281,
- 281, 281, 330, 357, 281, 40, 286, 287,
- 281, 281, 281, 294, 281, 302, 281, 302,
- 281, 356, 281, 330, 330, 281, 40, 286,
- 287, 281, 281, 281, 294, 281, 302, 281,
- 302, 42, 281, 281, 58, 303, 281, 40,
- 286, 287, 281, 281, 281, 294, 281, 302,
- 281, 295, 296, 301, 301, 45, 40, 286,
- 287, 281, 281, 281, 299, 281, 281, 289,
- 281, 295, 296, 297, 301, 45, 40, 286,
- 287, 281, 281, 75, 299, 281, 281, 289,
- 281, 292, 281, 358, 281, 339, 339, 45,
- 40, 286, 287, 281, 281, 281, 294, 281,
- 292, 281, 292, 281, 281, 281, 330, 330,
- 281, 40, 286, 287, 281, 281, 281, 294,
- 281, 292, 281, 292, 281, 281, 281, 330,
- 359, 281, 40, 286, 287, 281, 281, 281,
- 294, 281, 292, 281, 292, 281, 358, 281,
- 330, 330, 281, 40, 286, 287, 281, 281,
- 281, 294, 281, 292, 281, 76, 44, 44,
- 45, 40, 281, 281, 281, 281, 281, 76,
- 281, 292, 42, 281, 281, 58, 293, 281,
- 40, 286, 287, 281, 281, 281, 294, 281,
- 292, 281, 282, 283, 291, 285, 45, 40,
- 286, 287, 281, 281, 281, 288, 281, 281,
- 289, 281, 361, 191, 362, 362, 84, 79,
- 194, 195, 360, 360, 360, 197, 360, 360,
- 200, 360, 191, 362, 362, 84, 79, 194,
- 195, 360, 360, 360, 197, 360, 360, 200,
- 360, 363, 360, 360, 360, 98, 364, 360,
- 79, 194, 195, 360, 360, 360, 365, 360,
- 363, 360, 366, 367, 368, 369, 84, 79,
- 194, 195, 360, 360, 115, 370, 360, 360,
- 200, 360, 371, 367, 372, 372, 84, 79,
- 194, 195, 360, 360, 360, 370, 360, 360,
- 200, 360, 367, 372, 372, 84, 79, 194,
- 195, 360, 360, 360, 370, 360, 360, 200,
- 360, 373, 360, 360, 360, 98, 374, 360,
- 79, 194, 195, 360, 360, 360, 365, 360,
- 373, 360, 375, 376, 377, 378, 84, 79,
- 194, 195, 360, 360, 113, 379, 360, 360,
- 200, 360, 380, 376, 381, 381, 84, 79,
- 194, 195, 360, 360, 360, 379, 360, 360,
- 200, 360, 376, 381, 381, 84, 79, 194,
- 195, 360, 360, 360, 379, 360, 360, 200,
- 360, 382, 360, 360, 360, 98, 383, 360,
- 79, 194, 195, 360, 360, 360, 365, 360,
- 382, 360, 384, 385, 386, 387, 84, 79,
- 194, 195, 360, 360, 111, 388, 360, 360,
- 200, 360, 389, 385, 390, 390, 84, 79,
- 194, 195, 360, 360, 360, 388, 360, 360,
- 200, 360, 385, 390, 390, 84, 79, 194,
- 195, 360, 360, 360, 388, 360, 360, 200,
- 360, 391, 360, 360, 360, 98, 392, 360,
- 79, 194, 195, 360, 360, 360, 365, 360,
- 391, 360, 393, 394, 395, 396, 84, 79,
- 194, 195, 360, 360, 109, 397, 360, 360,
- 200, 360, 398, 394, 399, 399, 84, 79,
- 194, 195, 360, 360, 360, 397, 360, 360,
- 200, 360, 394, 399, 399, 84, 79, 194,
- 195, 360, 360, 360, 397, 360, 360, 200,
- 360, 98, 400, 360, 79, 194, 195, 360,
- 360, 360, 365, 360, 401, 401, 360, 79,
- 194, 195, 360, 360, 360, 365, 360, 402,
- 360, 360, 403, 194, 195, 360, 194, 195,
- 360, 404, 360, 194, 405, 360, 194, 406,
- 360, 194, 360, 402, 360, 360, 360, 194,
- 195, 360, 407, 360, 408, 409, 360, 79,
- 194, 195, 360, 360, 82, 360, 81, 360,
- 401, 401, 360, 79, 194, 195, 360, 401,
- 401, 360, 79, 194, 195, 360, 407, 360,
- 401, 401, 360, 79, 194, 195, 360, 407,
- 360, 408, 401, 360, 79, 194, 195, 360,
- 360, 82, 360, 98, 360, 410, 410, 84,
- 79, 194, 195, 360, 360, 360, 365, 360,
- 411, 107, 412, 413, 88, 79, 194, 195,
- 360, 360, 360, 365, 360, 107, 412, 413,
- 88, 79, 194, 195, 360, 360, 360, 365,
- 360, 412, 412, 88, 79, 194, 195, 360,
- 360, 360, 365, 360, 414, 104, 415, 416,
- 91, 79, 194, 195, 360, 360, 360, 365,
- 360, 104, 415, 416, 91, 79, 194, 195,
- 360, 360, 360, 365, 360, 415, 415, 91,
- 79, 194, 195, 360, 360, 360, 365, 360,
- 417, 101, 418, 419, 94, 79, 194, 195,
- 360, 360, 360, 365, 360, 101, 418, 419,
- 94, 79, 194, 195, 360, 360, 360, 365,
- 360, 418, 418, 94, 79, 194, 195, 360,
- 360, 360, 365, 360, 420, 98, 401, 421,
- 360, 79, 194, 195, 360, 360, 360, 365,
- 360, 98, 401, 421, 360, 79, 194, 195,
- 360, 360, 360, 365, 360, 401, 422, 360,
- 79, 194, 195, 360, 360, 360, 365, 360,
- 98, 360, 401, 401, 360, 79, 194, 195,
- 360, 360, 360, 365, 360, 80, 81, 360,
- 360, 98, 400, 360, 79, 194, 195, 360,
- 360, 360, 365, 360, 80, 360, 394, 399,
- 399, 84, 79, 194, 195, 360, 360, 360,
- 397, 360, 393, 394, 399, 399, 84, 79,
- 194, 195, 360, 360, 360, 397, 360, 360,
- 200, 360, 393, 394, 395, 399, 84, 79,
- 194, 195, 360, 360, 109, 397, 360, 360,
- 200, 360, 391, 360, 423, 360, 410, 410,
- 84, 79, 194, 195, 360, 360, 360, 365,
- 360, 391, 360, 391, 360, 360, 360, 401,
- 401, 360, 79, 194, 195, 360, 360, 360,
- 365, 360, 391, 360, 391, 360, 360, 360,
- 401, 424, 360, 79, 194, 195, 360, 360,
- 360, 365, 360, 391, 360, 391, 360, 423,
- 360, 401, 401, 360, 79, 194, 195, 360,
- 360, 360, 365, 360, 391, 360, 391, 81,
- 360, 360, 98, 392, 360, 79, 194, 195,
- 360, 360, 360, 365, 360, 391, 360, 384,
- 385, 390, 390, 84, 79, 194, 195, 360,
- 360, 360, 388, 360, 360, 200, 360, 384,
- 385, 386, 390, 84, 79, 194, 195, 360,
- 360, 111, 388, 360, 360, 200, 360, 382,
- 360, 425, 360, 410, 410, 84, 79, 194,
- 195, 360, 360, 360, 365, 360, 382, 360,
- 382, 360, 360, 360, 401, 401, 360, 79,
- 194, 195, 360, 360, 360, 365, 360, 382,
- 360, 382, 360, 360, 360, 401, 426, 360,
- 79, 194, 195, 360, 360, 360, 365, 360,
- 382, 360, 382, 360, 425, 360, 401, 401,
- 360, 79, 194, 195, 360, 360, 360, 365,
- 360, 382, 360, 382, 81, 360, 360, 98,
- 383, 360, 79, 194, 195, 360, 360, 360,
- 365, 360, 382, 360, 375, 376, 381, 381,
- 84, 79, 194, 195, 360, 360, 360, 379,
- 360, 360, 200, 360, 375, 376, 377, 381,
- 84, 79, 194, 195, 360, 360, 113, 379,
- 360, 360, 200, 360, 373, 360, 427, 360,
- 410, 410, 84, 79, 194, 195, 360, 360,
- 360, 365, 360, 373, 360, 373, 360, 360,
- 360, 401, 401, 360, 79, 194, 195, 360,
- 360, 360, 365, 360, 373, 360, 373, 360,
- 360, 360, 401, 428, 360, 79, 194, 195,
- 360, 360, 360, 365, 360, 373, 360, 373,
- 360, 427, 360, 401, 401, 360, 79, 194,
- 195, 360, 360, 360, 365, 360, 373, 360,
- 373, 81, 360, 360, 98, 374, 360, 79,
- 194, 195, 360, 360, 360, 365, 360, 373,
- 360, 366, 367, 372, 372, 84, 79, 194,
- 195, 360, 360, 360, 370, 360, 360, 200,
- 360, 366, 367, 368, 372, 84, 79, 194,
- 195, 360, 360, 115, 370, 360, 360, 200,
- 360, 363, 360, 429, 360, 410, 410, 84,
- 79, 194, 195, 360, 360, 360, 365, 360,
- 363, 360, 363, 360, 360, 360, 401, 401,
- 360, 79, 194, 195, 360, 360, 360, 365,
- 360, 363, 360, 363, 360, 360, 360, 401,
- 430, 360, 79, 194, 195, 360, 360, 360,
- 365, 360, 363, 360, 363, 360, 429, 360,
- 401, 401, 360, 79, 194, 195, 360, 360,
- 360, 365, 360, 363, 360, 363, 81, 360,
- 360, 98, 364, 360, 79, 194, 195, 360,
- 360, 360, 365, 360, 363, 360, 116, 83,
- 83, 84, 79, 431, 431, 431, 431, 156,
- 116, 431, 190, 191, 362, 362, 84, 79,
- 194, 195, 360, 360, 360, 197, 360, 360,
- 200, 360, 116, 83, 83, 84, 79, 431,
- 431, 431, 431, 431, 116, 431, 433, 434,
- 435, 436, 123, 118, 437, 438, 432, 432,
- 155, 439, 432, 432, 440, 432, 441, 434,
- 436, 436, 123, 118, 437, 438, 432, 432,
- 432, 439, 432, 432, 440, 432, 434, 436,
- 436, 123, 118, 437, 438, 432, 432, 432,
- 439, 432, 432, 440, 432, 442, 432, 432,
- 432, 136, 443, 432, 118, 437, 438, 432,
- 432, 432, 444, 432, 442, 432, 445, 446,
- 447, 448, 123, 118, 437, 438, 432, 432,
- 153, 449, 432, 432, 440, 432, 450, 446,
- 451, 451, 123, 118, 437, 438, 432, 432,
- 432, 449, 432, 432, 440, 432, 446, 451,
- 451, 123, 118, 437, 438, 432, 432, 432,
- 449, 432, 432, 440, 432, 452, 432, 432,
- 432, 136, 453, 432, 118, 437, 438, 432,
- 432, 432, 444, 432, 452, 432, 454, 455,
- 456, 457, 123, 118, 437, 438, 432, 432,
- 151, 458, 432, 432, 440, 432, 459, 455,
- 460, 460, 123, 118, 437, 438, 432, 432,
- 432, 458, 432, 432, 440, 432, 455, 460,
- 460, 123, 118, 437, 438, 432, 432, 432,
- 458, 432, 432, 440, 432, 461, 432, 432,
- 432, 136, 462, 432, 118, 437, 438, 432,
- 432, 432, 444, 432, 461, 432, 463, 464,
- 465, 466, 123, 118, 437, 438, 432, 432,
- 149, 467, 432, 432, 440, 432, 468, 464,
- 469, 469, 123, 118, 437, 438, 432, 432,
- 432, 467, 432, 432, 440, 432, 464, 469,
- 469, 123, 118, 437, 438, 432, 432, 432,
- 467, 432, 432, 440, 432, 470, 432, 432,
- 432, 136, 471, 432, 118, 437, 438, 432,
- 432, 432, 444, 432, 470, 432, 472, 473,
- 474, 475, 123, 118, 437, 438, 432, 432,
- 147, 476, 432, 432, 440, 432, 477, 473,
- 478, 478, 123, 118, 437, 438, 432, 432,
- 432, 476, 432, 432, 440, 432, 473, 478,
- 478, 123, 118, 437, 438, 432, 432, 432,
- 476, 432, 432, 440, 432, 136, 479, 432,
- 118, 437, 438, 432, 432, 432, 444, 432,
- 480, 480, 432, 118, 437, 438, 432, 432,
- 432, 444, 432, 481, 432, 432, 482, 437,
- 438, 432, 437, 438, 432, 483, 432, 437,
- 484, 432, 437, 485, 432, 437, 432, 481,
- 432, 432, 432, 437, 438, 432, 486, 432,
- 487, 488, 432, 118, 437, 438, 432, 432,
- 121, 432, 120, 432, 480, 480, 432, 118,
- 437, 438, 432, 480, 480, 432, 118, 437,
- 438, 432, 486, 432, 480, 480, 432, 118,
- 437, 438, 432, 486, 432, 487, 480, 432,
- 118, 437, 438, 432, 432, 121, 432, 136,
- 432, 489, 489, 123, 118, 437, 438, 432,
- 432, 432, 444, 432, 490, 145, 491, 492,
- 126, 118, 437, 438, 432, 432, 432, 444,
- 432, 145, 491, 492, 126, 118, 437, 438,
- 432, 432, 432, 444, 432, 491, 491, 126,
- 118, 437, 438, 432, 432, 432, 444, 432,
- 493, 142, 494, 495, 129, 118, 437, 438,
- 432, 432, 432, 444, 432, 142, 494, 495,
- 129, 118, 437, 438, 432, 432, 432, 444,
- 432, 494, 494, 129, 118, 437, 438, 432,
- 432, 432, 444, 432, 496, 139, 497, 498,
- 132, 118, 437, 438, 432, 432, 432, 444,
- 432, 139, 497, 498, 132, 118, 437, 438,
- 432, 432, 432, 444, 432, 497, 497, 132,
- 118, 437, 438, 432, 432, 432, 444, 432,
- 499, 136, 480, 500, 432, 118, 437, 438,
- 432, 432, 432, 444, 432, 136, 480, 500,
- 432, 118, 437, 438, 432, 432, 432, 444,
- 432, 480, 501, 432, 118, 437, 438, 432,
- 432, 432, 444, 432, 136, 432, 480, 480,
- 432, 118, 437, 438, 432, 432, 432, 444,
- 432, 119, 120, 432, 432, 136, 479, 432,
- 118, 437, 438, 432, 432, 432, 444, 432,
- 119, 432, 473, 478, 478, 123, 118, 437,
- 438, 432, 432, 432, 476, 432, 472, 473,
- 478, 478, 123, 118, 437, 438, 432, 432,
- 432, 476, 432, 432, 440, 432, 472, 473,
- 474, 478, 123, 118, 437, 438, 432, 432,
- 147, 476, 432, 432, 440, 432, 470, 432,
- 502, 432, 489, 489, 123, 118, 437, 438,
- 432, 432, 432, 444, 432, 470, 432, 470,
- 432, 432, 432, 480, 480, 432, 118, 437,
- 438, 432, 432, 432, 444, 432, 470, 432,
- 470, 432, 432, 432, 480, 503, 432, 118,
- 437, 438, 432, 432, 432, 444, 432, 470,
- 432, 470, 432, 502, 432, 480, 480, 432,
- 118, 437, 438, 432, 432, 432, 444, 432,
- 470, 432, 470, 120, 432, 432, 136, 471,
- 432, 118, 437, 438, 432, 432, 432, 444,
- 432, 470, 432, 463, 464, 469, 469, 123,
- 118, 437, 438, 432, 432, 432, 467, 432,
- 432, 440, 432, 463, 464, 465, 469, 123,
- 118, 437, 438, 432, 432, 149, 467, 432,
- 432, 440, 432, 461, 432, 504, 432, 489,
- 489, 123, 118, 437, 438, 432, 432, 432,
- 444, 432, 461, 432, 461, 432, 432, 432,
- 480, 480, 432, 118, 437, 438, 432, 432,
- 432, 444, 432, 461, 432, 461, 432, 432,
- 432, 480, 505, 432, 118, 437, 438, 432,
- 432, 432, 444, 432, 461, 432, 461, 432,
- 504, 432, 480, 480, 432, 118, 437, 438,
- 432, 432, 432, 444, 432, 461, 432, 461,
- 120, 432, 432, 136, 462, 432, 118, 437,
- 438, 432, 432, 432, 444, 432, 461, 432,
- 454, 455, 460, 460, 123, 118, 437, 438,
- 432, 432, 432, 458, 432, 432, 440, 432,
- 454, 455, 456, 460, 123, 118, 437, 438,
- 432, 432, 151, 458, 432, 432, 440, 432,
- 452, 432, 506, 432, 489, 489, 123, 118,
- 437, 438, 432, 432, 432, 444, 432, 452,
- 432, 452, 432, 432, 432, 480, 480, 432,
- 118, 437, 438, 432, 432, 432, 444, 432,
- 452, 432, 452, 432, 432, 432, 480, 507,
- 432, 118, 437, 438, 432, 432, 432, 444,
- 432, 452, 432, 452, 432, 506, 432, 480,
- 480, 432, 118, 437, 438, 432, 432, 432,
- 444, 432, 452, 432, 452, 120, 432, 432,
- 136, 453, 432, 118, 437, 438, 432, 432,
- 432, 444, 432, 452, 432, 445, 446, 451,
- 451, 123, 118, 437, 438, 432, 432, 432,
- 449, 432, 432, 440, 432, 445, 446, 447,
- 451, 123, 118, 437, 438, 432, 432, 153,
- 449, 432, 432, 440, 432, 442, 432, 508,
- 432, 489, 489, 123, 118, 437, 438, 432,
- 432, 432, 444, 432, 442, 432, 442, 432,
- 432, 432, 480, 480, 432, 118, 437, 438,
- 432, 432, 432, 444, 432, 442, 432, 442,
- 432, 432, 432, 480, 509, 432, 118, 437,
- 438, 432, 432, 432, 444, 432, 442, 432,
- 442, 432, 508, 432, 480, 480, 432, 118,
- 437, 438, 432, 432, 432, 444, 432, 442,
- 432, 442, 120, 432, 432, 136, 443, 432,
- 118, 437, 438, 432, 432, 432, 444, 432,
- 442, 432, 433, 434, 436, 436, 123, 118,
- 437, 438, 432, 432, 432, 439, 432, 432,
- 440, 432, 188, 189, 190, 191, 510, 362,
- 84, 79, 194, 195, 196, 196, 156, 197,
- 360, 188, 200, 360, 203, 511, 205, 206,
- 6, 1, 207, 208, 202, 202, 38, 209,
- 202, 202, 210, 202, 213, 189, 190, 191,
- 512, 513, 84, 157, 514, 515, 202, 196,
- 156, 516, 202, 213, 200, 202, 116, 517,
- 517, 84, 157, 207, 208, 202, 202, 156,
- 518, 202, 519, 202, 202, 520, 514, 515,
- 202, 514, 515, 202, 254, 202, 514, 521,
- 202, 514, 522, 202, 514, 202, 519, 202,
- 202, 202, 514, 515, 202, 523, 3, 360,
- 360, 401, 430, 360, 79, 194, 195, 360,
- 360, 360, 365, 360, 523, 360, 524, 367,
- 525, 526, 84, 157, 514, 515, 202, 202,
- 158, 370, 202, 202, 200, 202, 527, 367,
- 528, 528, 84, 157, 514, 515, 202, 202,
- 202, 370, 202, 202, 200, 202, 367, 528,
- 528, 84, 157, 514, 515, 202, 202, 202,
- 370, 202, 202, 200, 202, 524, 367, 528,
- 528, 84, 157, 514, 515, 202, 202, 202,
- 370, 202, 202, 200, 202, 524, 367, 525,
- 528, 84, 157, 514, 515, 202, 202, 158,
- 370, 202, 202, 200, 202, 213, 202, 279,
- 116, 529, 529, 160, 157, 207, 208, 202,
- 202, 202, 518, 202, 213, 202, 530, 184,
- 531, 532, 162, 157, 514, 515, 202, 202,
- 202, 533, 202, 184, 531, 532, 162, 157,
- 514, 515, 202, 202, 202, 533, 202, 531,
- 531, 162, 157, 514, 515, 202, 202, 202,
- 533, 202, 534, 181, 535, 536, 165, 157,
- 514, 515, 202, 202, 202, 533, 202, 181,
- 535, 536, 165, 157, 514, 515, 202, 202,
- 202, 533, 202, 535, 535, 165, 157, 514,
- 515, 202, 202, 202, 533, 202, 537, 178,
- 538, 539, 168, 157, 514, 515, 202, 202,
- 202, 533, 202, 178, 538, 539, 168, 157,
- 514, 515, 202, 202, 202, 533, 202, 538,
- 538, 168, 157, 514, 515, 202, 202, 202,
- 533, 202, 540, 175, 541, 542, 202, 157,
- 514, 515, 202, 202, 202, 533, 202, 175,
- 541, 542, 202, 157, 514, 515, 202, 202,
- 202, 533, 202, 541, 541, 202, 157, 514,
- 515, 202, 202, 202, 533, 202, 543, 202,
- 544, 545, 202, 157, 514, 515, 202, 202,
- 172, 202, 171, 202, 541, 541, 202, 157,
- 514, 515, 202, 541, 541, 202, 157, 514,
- 515, 202, 543, 202, 541, 541, 202, 157,
- 514, 515, 202, 543, 202, 544, 541, 202,
- 157, 514, 515, 202, 202, 172, 202, 523,
- 171, 360, 360, 98, 364, 360, 79, 194,
- 195, 360, 360, 360, 365, 360, 523, 360,
- 547, 546, 548, 548, 546, 186, 549, 550,
- 546, 548, 548, 546, 186, 549, 550, 546,
- 551, 546, 546, 552, 549, 550, 546, 549,
- 550, 546, 553, 546, 549, 554, 546, 549,
- 555, 546, 549, 546, 551, 546, 546, 546,
- 549, 550, 546, 0
+ 197, 198, 199, 200, 201, 202, 187, 204,
+ 205, 206, 207, 6, 1, 208, 209, 203,
+ 203, 38, 210, 203, 203, 211, 203, 212,
+ 205, 213, 213, 6, 1, 208, 209, 203,
+ 203, 203, 210, 203, 203, 211, 203, 205,
+ 213, 213, 6, 1, 208, 209, 203, 203,
+ 203, 210, 203, 203, 211, 203, 214, 203,
+ 203, 203, 19, 215, 203, 1, 208, 209,
+ 203, 203, 203, 216, 203, 214, 203, 217,
+ 218, 219, 220, 6, 1, 208, 209, 203,
+ 203, 36, 221, 203, 203, 211, 203, 222,
+ 218, 223, 223, 6, 1, 208, 209, 203,
+ 203, 203, 221, 203, 203, 211, 203, 218,
+ 223, 223, 6, 1, 208, 209, 203, 203,
+ 203, 221, 203, 203, 211, 203, 224, 203,
+ 203, 203, 19, 225, 203, 1, 208, 209,
+ 203, 203, 203, 216, 203, 224, 203, 226,
+ 227, 228, 229, 6, 1, 208, 209, 203,
+ 203, 34, 230, 203, 203, 211, 203, 231,
+ 227, 232, 232, 6, 1, 208, 209, 203,
+ 203, 203, 230, 203, 203, 211, 203, 227,
+ 232, 232, 6, 1, 208, 209, 203, 203,
+ 203, 230, 203, 203, 211, 203, 233, 203,
+ 203, 203, 19, 234, 203, 1, 208, 209,
+ 203, 203, 203, 216, 203, 233, 203, 235,
+ 236, 237, 238, 6, 1, 208, 209, 203,
+ 203, 32, 239, 203, 203, 211, 203, 240,
+ 236, 241, 241, 6, 1, 208, 209, 203,
+ 203, 203, 239, 203, 203, 211, 203, 236,
+ 241, 241, 6, 1, 208, 209, 203, 203,
+ 203, 239, 203, 203, 211, 203, 242, 203,
+ 203, 203, 19, 243, 203, 1, 208, 209,
+ 203, 203, 203, 216, 203, 242, 203, 244,
+ 245, 246, 247, 6, 1, 208, 209, 203,
+ 203, 30, 248, 203, 203, 211, 203, 249,
+ 245, 250, 250, 6, 1, 208, 209, 203,
+ 203, 203, 248, 203, 203, 211, 203, 245,
+ 250, 250, 6, 1, 208, 209, 203, 203,
+ 203, 248, 203, 203, 211, 203, 19, 251,
+ 203, 1, 208, 209, 203, 203, 203, 216,
+ 203, 252, 252, 203, 1, 208, 209, 203,
+ 203, 203, 216, 203, 253, 203, 203, 254,
+ 208, 209, 203, 208, 209, 203, 255, 203,
+ 208, 256, 203, 208, 257, 203, 208, 203,
+ 253, 203, 203, 203, 208, 209, 203, 258,
+ 203, 259, 260, 203, 1, 208, 209, 203,
+ 203, 4, 203, 3, 203, 252, 252, 203,
+ 1, 208, 209, 203, 252, 252, 203, 1,
+ 208, 209, 203, 258, 203, 252, 252, 203,
+ 1, 208, 209, 203, 258, 203, 259, 252,
+ 203, 1, 208, 209, 203, 203, 4, 203,
+ 19, 203, 261, 261, 6, 1, 208, 209,
+ 203, 203, 203, 216, 203, 262, 28, 263,
+ 264, 9, 1, 208, 209, 203, 203, 203,
+ 216, 203, 28, 263, 264, 9, 1, 208,
+ 209, 203, 203, 203, 216, 203, 263, 263,
+ 9, 1, 208, 209, 203, 203, 203, 216,
+ 203, 265, 25, 266, 267, 12, 1, 208,
+ 209, 203, 203, 203, 216, 203, 25, 266,
+ 267, 12, 1, 208, 209, 203, 203, 203,
+ 216, 203, 266, 266, 12, 1, 208, 209,
+ 203, 203, 203, 216, 203, 268, 22, 269,
+ 270, 15, 1, 208, 209, 203, 203, 203,
+ 216, 203, 22, 269, 270, 15, 1, 208,
+ 209, 203, 203, 203, 216, 203, 269, 269,
+ 15, 1, 208, 209, 203, 203, 203, 216,
+ 203, 271, 19, 252, 272, 203, 1, 208,
+ 209, 203, 203, 203, 216, 203, 19, 252,
+ 272, 203, 1, 208, 209, 203, 203, 203,
+ 216, 203, 252, 273, 203, 1, 208, 209,
+ 203, 203, 203, 216, 203, 19, 203, 252,
+ 252, 203, 1, 208, 209, 203, 203, 203,
+ 216, 203, 2, 3, 203, 203, 19, 251,
+ 203, 1, 208, 209, 203, 203, 203, 216,
+ 203, 2, 203, 245, 250, 250, 6, 1,
+ 208, 209, 203, 203, 203, 248, 203, 244,
+ 245, 250, 250, 6, 1, 208, 209, 203,
+ 203, 203, 248, 203, 203, 211, 203, 244,
+ 245, 246, 250, 6, 1, 208, 209, 203,
+ 203, 30, 248, 203, 203, 211, 203, 242,
+ 203, 274, 203, 261, 261, 6, 1, 208,
+ 209, 203, 203, 203, 216, 203, 242, 203,
+ 242, 203, 203, 203, 252, 252, 203, 1,
+ 208, 209, 203, 203, 203, 216, 203, 242,
+ 203, 242, 203, 203, 203, 252, 275, 203,
+ 1, 208, 209, 203, 203, 203, 216, 203,
+ 242, 203, 242, 203, 274, 203, 252, 252,
+ 203, 1, 208, 209, 203, 203, 203, 216,
+ 203, 242, 203, 242, 3, 203, 203, 19,
+ 243, 203, 1, 208, 209, 203, 203, 203,
+ 216, 203, 242, 203, 235, 236, 241, 241,
+ 6, 1, 208, 209, 203, 203, 203, 239,
+ 203, 203, 211, 203, 235, 236, 237, 241,
+ 6, 1, 208, 209, 203, 203, 32, 239,
+ 203, 203, 211, 203, 233, 203, 276, 203,
+ 261, 261, 6, 1, 208, 209, 203, 203,
+ 203, 216, 203, 233, 203, 233, 203, 203,
+ 203, 252, 252, 203, 1, 208, 209, 203,
+ 203, 203, 216, 203, 233, 203, 233, 203,
+ 203, 203, 252, 277, 203, 1, 208, 209,
+ 203, 203, 203, 216, 203, 233, 203, 233,
+ 203, 276, 203, 252, 252, 203, 1, 208,
+ 209, 203, 203, 203, 216, 203, 233, 203,
+ 233, 3, 203, 203, 19, 234, 203, 1,
+ 208, 209, 203, 203, 203, 216, 203, 233,
+ 203, 226, 227, 232, 232, 6, 1, 208,
+ 209, 203, 203, 203, 230, 203, 203, 211,
+ 203, 226, 227, 228, 232, 6, 1, 208,
+ 209, 203, 203, 34, 230, 203, 203, 211,
+ 203, 224, 203, 278, 203, 261, 261, 6,
+ 1, 208, 209, 203, 203, 203, 216, 203,
+ 224, 203, 224, 203, 203, 203, 252, 252,
+ 203, 1, 208, 209, 203, 203, 203, 216,
+ 203, 224, 203, 224, 203, 203, 203, 252,
+ 279, 203, 1, 208, 209, 203, 203, 203,
+ 216, 203, 224, 203, 224, 203, 278, 203,
+ 252, 252, 203, 1, 208, 209, 203, 203,
+ 203, 216, 203, 224, 203, 224, 3, 203,
+ 203, 19, 225, 203, 1, 208, 209, 203,
+ 203, 203, 216, 203, 224, 203, 217, 218,
+ 223, 223, 6, 1, 208, 209, 203, 203,
+ 203, 221, 203, 203, 211, 203, 217, 218,
+ 219, 223, 6, 1, 208, 209, 203, 203,
+ 36, 221, 203, 203, 211, 203, 214, 203,
+ 280, 203, 261, 261, 6, 1, 208, 209,
+ 203, 203, 203, 216, 203, 214, 203, 214,
+ 203, 203, 203, 252, 252, 203, 1, 208,
+ 209, 203, 203, 203, 216, 203, 214, 203,
+ 214, 203, 203, 203, 252, 281, 203, 1,
+ 208, 209, 203, 203, 203, 216, 203, 214,
+ 203, 214, 203, 280, 203, 252, 252, 203,
+ 1, 208, 209, 203, 203, 203, 216, 203,
+ 214, 203, 214, 3, 203, 203, 19, 215,
+ 203, 1, 208, 209, 203, 203, 203, 216,
+ 203, 214, 203, 204, 205, 213, 213, 6,
+ 1, 208, 209, 203, 203, 203, 210, 203,
+ 203, 211, 203, 204, 205, 206, 213, 6,
+ 1, 208, 209, 203, 203, 38, 210, 203,
+ 203, 211, 203, 283, 284, 285, 286, 45,
+ 40, 287, 288, 282, 282, 77, 289, 282,
+ 282, 290, 282, 291, 284, 292, 286, 45,
+ 40, 287, 288, 282, 282, 282, 289, 282,
+ 282, 290, 282, 284, 292, 286, 45, 40,
+ 287, 288, 282, 282, 282, 289, 282, 282,
+ 290, 282, 293, 282, 282, 282, 58, 294,
+ 282, 40, 287, 288, 282, 282, 282, 295,
+ 282, 293, 282, 296, 297, 298, 299, 45,
+ 40, 287, 288, 282, 282, 75, 300, 282,
+ 282, 290, 282, 301, 297, 302, 302, 45,
+ 40, 287, 288, 282, 282, 282, 300, 282,
+ 282, 290, 282, 297, 302, 302, 45, 40,
+ 287, 288, 282, 282, 282, 300, 282, 282,
+ 290, 282, 303, 282, 282, 282, 58, 304,
+ 282, 40, 287, 288, 282, 282, 282, 295,
+ 282, 303, 282, 305, 306, 307, 308, 45,
+ 40, 287, 288, 282, 282, 73, 309, 282,
+ 282, 290, 282, 310, 306, 311, 311, 45,
+ 40, 287, 288, 282, 282, 282, 309, 282,
+ 282, 290, 282, 306, 311, 311, 45, 40,
+ 287, 288, 282, 282, 282, 309, 282, 282,
+ 290, 282, 312, 282, 282, 282, 58, 313,
+ 282, 40, 287, 288, 282, 282, 282, 295,
+ 282, 312, 282, 314, 315, 316, 317, 45,
+ 40, 287, 288, 282, 282, 71, 318, 282,
+ 282, 290, 282, 319, 315, 320, 320, 45,
+ 40, 287, 288, 282, 282, 282, 318, 282,
+ 282, 290, 282, 315, 320, 320, 45, 40,
+ 287, 288, 282, 282, 282, 318, 282, 282,
+ 290, 282, 321, 282, 282, 282, 58, 322,
+ 282, 40, 287, 288, 282, 282, 282, 295,
+ 282, 321, 282, 323, 324, 325, 326, 45,
+ 40, 287, 288, 282, 282, 69, 327, 282,
+ 282, 290, 282, 328, 324, 329, 329, 45,
+ 40, 287, 288, 282, 282, 282, 327, 282,
+ 282, 290, 282, 324, 329, 329, 45, 40,
+ 287, 288, 282, 282, 282, 327, 282, 282,
+ 290, 282, 58, 330, 282, 40, 287, 288,
+ 282, 282, 282, 295, 282, 331, 331, 282,
+ 40, 287, 288, 282, 282, 282, 295, 282,
+ 332, 282, 282, 333, 287, 288, 282, 287,
+ 288, 282, 334, 282, 287, 335, 282, 287,
+ 336, 282, 287, 282, 332, 282, 282, 282,
+ 287, 288, 282, 337, 282, 338, 339, 282,
+ 40, 287, 288, 282, 282, 43, 282, 42,
+ 282, 331, 331, 282, 40, 287, 288, 282,
+ 331, 331, 282, 40, 287, 288, 282, 337,
+ 282, 331, 331, 282, 40, 287, 288, 282,
+ 337, 282, 338, 331, 282, 40, 287, 288,
+ 282, 282, 43, 282, 58, 282, 340, 340,
+ 45, 40, 287, 288, 282, 282, 282, 295,
+ 282, 341, 67, 342, 343, 48, 40, 287,
+ 288, 282, 282, 282, 295, 282, 67, 342,
+ 343, 48, 40, 287, 288, 282, 282, 282,
+ 295, 282, 342, 342, 48, 40, 287, 288,
+ 282, 282, 282, 295, 282, 344, 64, 345,
+ 346, 51, 40, 287, 288, 282, 282, 282,
+ 295, 282, 64, 345, 346, 51, 40, 287,
+ 288, 282, 282, 282, 295, 282, 345, 345,
+ 51, 40, 287, 288, 282, 282, 282, 295,
+ 282, 347, 61, 348, 349, 54, 40, 287,
+ 288, 282, 282, 282, 295, 282, 61, 348,
+ 349, 54, 40, 287, 288, 282, 282, 282,
+ 295, 282, 348, 348, 54, 40, 287, 288,
+ 282, 282, 282, 295, 282, 350, 58, 331,
+ 351, 282, 40, 287, 288, 282, 282, 282,
+ 295, 282, 58, 331, 351, 282, 40, 287,
+ 288, 282, 282, 282, 295, 282, 331, 352,
+ 282, 40, 287, 288, 282, 282, 282, 295,
+ 282, 58, 282, 331, 331, 282, 40, 287,
+ 288, 282, 282, 282, 295, 282, 41, 42,
+ 282, 282, 58, 330, 282, 40, 287, 288,
+ 282, 282, 282, 295, 282, 41, 282, 324,
+ 329, 329, 45, 40, 287, 288, 282, 282,
+ 282, 327, 282, 323, 324, 329, 329, 45,
+ 40, 287, 288, 282, 282, 282, 327, 282,
+ 282, 290, 282, 323, 324, 325, 329, 45,
+ 40, 287, 288, 282, 282, 69, 327, 282,
+ 282, 290, 282, 321, 282, 353, 282, 340,
+ 340, 45, 40, 287, 288, 282, 282, 282,
+ 295, 282, 321, 282, 321, 282, 282, 282,
+ 331, 331, 282, 40, 287, 288, 282, 282,
+ 282, 295, 282, 321, 282, 321, 282, 282,
+ 282, 331, 354, 282, 40, 287, 288, 282,
+ 282, 282, 295, 282, 321, 282, 321, 282,
+ 353, 282, 331, 331, 282, 40, 287, 288,
+ 282, 282, 282, 295, 282, 321, 282, 321,
+ 42, 282, 282, 58, 322, 282, 40, 287,
+ 288, 282, 282, 282, 295, 282, 321, 282,
+ 314, 315, 320, 320, 45, 40, 287, 288,
+ 282, 282, 282, 318, 282, 282, 290, 282,
+ 314, 315, 316, 320, 45, 40, 287, 288,
+ 282, 282, 71, 318, 282, 282, 290, 282,
+ 312, 282, 355, 282, 340, 340, 45, 40,
+ 287, 288, 282, 282, 282, 295, 282, 312,
+ 282, 312, 282, 282, 282, 331, 331, 282,
+ 40, 287, 288, 282, 282, 282, 295, 282,
+ 312, 282, 312, 282, 282, 282, 331, 356,
+ 282, 40, 287, 288, 282, 282, 282, 295,
+ 282, 312, 282, 312, 282, 355, 282, 331,
+ 331, 282, 40, 287, 288, 282, 282, 282,
+ 295, 282, 312, 282, 312, 42, 282, 282,
+ 58, 313, 282, 40, 287, 288, 282, 282,
+ 282, 295, 282, 312, 282, 305, 306, 311,
+ 311, 45, 40, 287, 288, 282, 282, 282,
+ 309, 282, 282, 290, 282, 305, 306, 307,
+ 311, 45, 40, 287, 288, 282, 282, 73,
+ 309, 282, 282, 290, 282, 303, 282, 357,
+ 282, 340, 340, 45, 40, 287, 288, 282,
+ 282, 282, 295, 282, 303, 282, 303, 282,
+ 282, 282, 331, 331, 282, 40, 287, 288,
+ 282, 282, 282, 295, 282, 303, 282, 303,
+ 282, 282, 282, 331, 358, 282, 40, 287,
+ 288, 282, 282, 282, 295, 282, 303, 282,
+ 303, 282, 357, 282, 331, 331, 282, 40,
+ 287, 288, 282, 282, 282, 295, 282, 303,
+ 282, 303, 42, 282, 282, 58, 304, 282,
+ 40, 287, 288, 282, 282, 282, 295, 282,
+ 303, 282, 296, 297, 302, 302, 45, 40,
+ 287, 288, 282, 282, 282, 300, 282, 282,
+ 290, 282, 296, 297, 298, 302, 45, 40,
+ 287, 288, 282, 282, 75, 300, 282, 282,
+ 290, 282, 293, 282, 359, 282, 340, 340,
+ 45, 40, 287, 288, 282, 282, 282, 295,
+ 282, 293, 282, 293, 282, 282, 282, 331,
+ 331, 282, 40, 287, 288, 282, 282, 282,
+ 295, 282, 293, 282, 293, 282, 282, 282,
+ 331, 360, 282, 40, 287, 288, 282, 282,
+ 282, 295, 282, 293, 282, 293, 282, 359,
+ 282, 331, 331, 282, 40, 287, 288, 282,
+ 282, 282, 295, 282, 293, 282, 76, 44,
+ 44, 45, 40, 282, 282, 282, 282, 282,
+ 76, 282, 293, 42, 282, 282, 58, 294,
+ 282, 40, 287, 288, 282, 282, 282, 295,
+ 282, 293, 282, 283, 284, 292, 286, 45,
+ 40, 287, 288, 282, 282, 282, 289, 282,
+ 282, 290, 282, 362, 191, 363, 363, 84,
+ 79, 194, 195, 361, 361, 361, 197, 361,
+ 361, 200, 361, 191, 363, 363, 84, 79,
+ 194, 195, 361, 361, 361, 197, 361, 361,
+ 200, 361, 364, 361, 361, 361, 98, 365,
+ 361, 79, 194, 195, 361, 361, 361, 366,
+ 361, 364, 361, 367, 368, 369, 370, 84,
+ 79, 194, 195, 361, 361, 115, 371, 361,
+ 361, 200, 361, 372, 368, 373, 373, 84,
+ 79, 194, 195, 361, 361, 361, 371, 361,
+ 361, 200, 361, 368, 373, 373, 84, 79,
+ 194, 195, 361, 361, 361, 371, 361, 361,
+ 200, 361, 374, 361, 361, 361, 98, 375,
+ 361, 79, 194, 195, 361, 361, 361, 366,
+ 361, 374, 361, 376, 377, 378, 379, 84,
+ 79, 194, 195, 361, 361, 113, 380, 361,
+ 361, 200, 361, 381, 377, 382, 382, 84,
+ 79, 194, 195, 361, 361, 361, 380, 361,
+ 361, 200, 361, 377, 382, 382, 84, 79,
+ 194, 195, 361, 361, 361, 380, 361, 361,
+ 200, 361, 383, 361, 361, 361, 98, 384,
+ 361, 79, 194, 195, 361, 361, 361, 366,
+ 361, 383, 361, 385, 386, 387, 388, 84,
+ 79, 194, 195, 361, 361, 111, 389, 361,
+ 361, 200, 361, 390, 386, 391, 391, 84,
+ 79, 194, 195, 361, 361, 361, 389, 361,
+ 361, 200, 361, 386, 391, 391, 84, 79,
+ 194, 195, 361, 361, 361, 389, 361, 361,
+ 200, 361, 392, 361, 361, 361, 98, 393,
+ 361, 79, 194, 195, 361, 361, 361, 366,
+ 361, 392, 361, 394, 395, 396, 397, 84,
+ 79, 194, 195, 361, 361, 109, 398, 361,
+ 361, 200, 361, 399, 395, 400, 400, 84,
+ 79, 194, 195, 361, 361, 361, 398, 361,
+ 361, 200, 361, 395, 400, 400, 84, 79,
+ 194, 195, 361, 361, 361, 398, 361, 361,
+ 200, 361, 98, 401, 361, 79, 194, 195,
+ 361, 361, 361, 366, 361, 402, 402, 361,
+ 79, 194, 195, 361, 361, 361, 366, 361,
+ 403, 361, 361, 404, 194, 195, 361, 194,
+ 195, 361, 405, 361, 194, 406, 361, 194,
+ 407, 361, 194, 361, 403, 361, 361, 361,
+ 194, 195, 361, 408, 361, 409, 410, 361,
+ 79, 194, 195, 361, 361, 82, 361, 81,
+ 361, 402, 402, 361, 79, 194, 195, 361,
+ 402, 402, 361, 79, 194, 195, 361, 408,
+ 361, 402, 402, 361, 79, 194, 195, 361,
+ 408, 361, 409, 402, 361, 79, 194, 195,
+ 361, 361, 82, 361, 98, 361, 411, 411,
+ 84, 79, 194, 195, 361, 361, 361, 366,
+ 361, 412, 107, 413, 414, 88, 79, 194,
+ 195, 361, 361, 361, 366, 361, 107, 413,
+ 414, 88, 79, 194, 195, 361, 361, 361,
+ 366, 361, 413, 413, 88, 79, 194, 195,
+ 361, 361, 361, 366, 361, 415, 104, 416,
+ 417, 91, 79, 194, 195, 361, 361, 361,
+ 366, 361, 104, 416, 417, 91, 79, 194,
+ 195, 361, 361, 361, 366, 361, 416, 416,
+ 91, 79, 194, 195, 361, 361, 361, 366,
+ 361, 418, 101, 419, 420, 94, 79, 194,
+ 195, 361, 361, 361, 366, 361, 101, 419,
+ 420, 94, 79, 194, 195, 361, 361, 361,
+ 366, 361, 419, 419, 94, 79, 194, 195,
+ 361, 361, 361, 366, 361, 421, 98, 402,
+ 422, 361, 79, 194, 195, 361, 361, 361,
+ 366, 361, 98, 402, 422, 361, 79, 194,
+ 195, 361, 361, 361, 366, 361, 402, 423,
+ 361, 79, 194, 195, 361, 361, 361, 366,
+ 361, 98, 361, 402, 402, 361, 79, 194,
+ 195, 361, 361, 361, 366, 361, 80, 81,
+ 361, 361, 98, 401, 361, 79, 194, 195,
+ 361, 361, 361, 366, 361, 80, 361, 395,
+ 400, 400, 84, 79, 194, 195, 361, 361,
+ 361, 398, 361, 394, 395, 400, 400, 84,
+ 79, 194, 195, 361, 361, 361, 398, 361,
+ 361, 200, 361, 394, 395, 396, 400, 84,
+ 79, 194, 195, 361, 361, 109, 398, 361,
+ 361, 200, 361, 392, 361, 424, 361, 411,
+ 411, 84, 79, 194, 195, 361, 361, 361,
+ 366, 361, 392, 361, 392, 361, 361, 361,
+ 402, 402, 361, 79, 194, 195, 361, 361,
+ 361, 366, 361, 392, 361, 392, 361, 361,
+ 361, 402, 425, 361, 79, 194, 195, 361,
+ 361, 361, 366, 361, 392, 361, 392, 361,
+ 424, 361, 402, 402, 361, 79, 194, 195,
+ 361, 361, 361, 366, 361, 392, 361, 392,
+ 81, 361, 361, 98, 393, 361, 79, 194,
+ 195, 361, 361, 361, 366, 361, 392, 361,
+ 385, 386, 391, 391, 84, 79, 194, 195,
+ 361, 361, 361, 389, 361, 361, 200, 361,
+ 385, 386, 387, 391, 84, 79, 194, 195,
+ 361, 361, 111, 389, 361, 361, 200, 361,
+ 383, 361, 426, 361, 411, 411, 84, 79,
+ 194, 195, 361, 361, 361, 366, 361, 383,
+ 361, 383, 361, 361, 361, 402, 402, 361,
+ 79, 194, 195, 361, 361, 361, 366, 361,
+ 383, 361, 383, 361, 361, 361, 402, 427,
+ 361, 79, 194, 195, 361, 361, 361, 366,
+ 361, 383, 361, 383, 361, 426, 361, 402,
+ 402, 361, 79, 194, 195, 361, 361, 361,
+ 366, 361, 383, 361, 383, 81, 361, 361,
+ 98, 384, 361, 79, 194, 195, 361, 361,
+ 361, 366, 361, 383, 361, 376, 377, 382,
+ 382, 84, 79, 194, 195, 361, 361, 361,
+ 380, 361, 361, 200, 361, 376, 377, 378,
+ 382, 84, 79, 194, 195, 361, 361, 113,
+ 380, 361, 361, 200, 361, 374, 361, 428,
+ 361, 411, 411, 84, 79, 194, 195, 361,
+ 361, 361, 366, 361, 374, 361, 374, 361,
+ 361, 361, 402, 402, 361, 79, 194, 195,
+ 361, 361, 361, 366, 361, 374, 361, 374,
+ 361, 361, 361, 402, 429, 361, 79, 194,
+ 195, 361, 361, 361, 366, 361, 374, 361,
+ 374, 361, 428, 361, 402, 402, 361, 79,
+ 194, 195, 361, 361, 361, 366, 361, 374,
+ 361, 374, 81, 361, 361, 98, 375, 361,
+ 79, 194, 195, 361, 361, 361, 366, 361,
+ 374, 361, 367, 368, 373, 373, 84, 79,
+ 194, 195, 361, 361, 361, 371, 361, 361,
+ 200, 361, 367, 368, 369, 373, 84, 79,
+ 194, 195, 361, 361, 115, 371, 361, 361,
+ 200, 361, 364, 361, 430, 361, 411, 411,
+ 84, 79, 194, 195, 361, 361, 361, 366,
+ 361, 364, 361, 364, 361, 361, 361, 402,
+ 402, 361, 79, 194, 195, 361, 361, 361,
+ 366, 361, 364, 361, 364, 361, 361, 361,
+ 402, 431, 361, 79, 194, 195, 361, 361,
+ 361, 366, 361, 364, 361, 364, 361, 430,
+ 361, 402, 402, 361, 79, 194, 195, 361,
+ 361, 361, 366, 361, 364, 361, 364, 81,
+ 361, 361, 98, 365, 361, 79, 194, 195,
+ 361, 361, 361, 366, 361, 364, 361, 116,
+ 83, 83, 84, 79, 432, 432, 432, 432,
+ 156, 116, 432, 190, 191, 363, 363, 84,
+ 79, 194, 195, 361, 361, 361, 197, 361,
+ 361, 200, 361, 116, 83, 83, 84, 79,
+ 432, 432, 432, 432, 432, 116, 432, 434,
+ 435, 436, 437, 123, 118, 438, 439, 433,
+ 433, 155, 440, 433, 433, 441, 433, 442,
+ 435, 437, 437, 123, 118, 438, 439, 433,
+ 433, 433, 440, 433, 433, 441, 433, 435,
+ 437, 437, 123, 118, 438, 439, 433, 433,
+ 433, 440, 433, 433, 441, 433, 443, 433,
+ 433, 433, 136, 444, 433, 118, 438, 439,
+ 433, 433, 433, 445, 433, 443, 433, 446,
+ 447, 448, 449, 123, 118, 438, 439, 433,
+ 433, 153, 450, 433, 433, 441, 433, 451,
+ 447, 452, 452, 123, 118, 438, 439, 433,
+ 433, 433, 450, 433, 433, 441, 433, 447,
+ 452, 452, 123, 118, 438, 439, 433, 433,
+ 433, 450, 433, 433, 441, 433, 453, 433,
+ 433, 433, 136, 454, 433, 118, 438, 439,
+ 433, 433, 433, 445, 433, 453, 433, 455,
+ 456, 457, 458, 123, 118, 438, 439, 433,
+ 433, 151, 459, 433, 433, 441, 433, 460,
+ 456, 461, 461, 123, 118, 438, 439, 433,
+ 433, 433, 459, 433, 433, 441, 433, 456,
+ 461, 461, 123, 118, 438, 439, 433, 433,
+ 433, 459, 433, 433, 441, 433, 462, 433,
+ 433, 433, 136, 463, 433, 118, 438, 439,
+ 433, 433, 433, 445, 433, 462, 433, 464,
+ 465, 466, 467, 123, 118, 438, 439, 433,
+ 433, 149, 468, 433, 433, 441, 433, 469,
+ 465, 470, 470, 123, 118, 438, 439, 433,
+ 433, 433, 468, 433, 433, 441, 433, 465,
+ 470, 470, 123, 118, 438, 439, 433, 433,
+ 433, 468, 433, 433, 441, 433, 471, 433,
+ 433, 433, 136, 472, 433, 118, 438, 439,
+ 433, 433, 433, 445, 433, 471, 433, 473,
+ 474, 475, 476, 123, 118, 438, 439, 433,
+ 433, 147, 477, 433, 433, 441, 433, 478,
+ 474, 479, 479, 123, 118, 438, 439, 433,
+ 433, 433, 477, 433, 433, 441, 433, 474,
+ 479, 479, 123, 118, 438, 439, 433, 433,
+ 433, 477, 433, 433, 441, 433, 136, 480,
+ 433, 118, 438, 439, 433, 433, 433, 445,
+ 433, 481, 481, 433, 118, 438, 439, 433,
+ 433, 433, 445, 433, 482, 433, 433, 483,
+ 438, 439, 433, 438, 439, 433, 484, 433,
+ 438, 485, 433, 438, 486, 433, 438, 433,
+ 482, 433, 433, 433, 438, 439, 433, 487,
+ 433, 488, 489, 433, 118, 438, 439, 433,
+ 433, 121, 433, 120, 433, 481, 481, 433,
+ 118, 438, 439, 433, 481, 481, 433, 118,
+ 438, 439, 433, 487, 433, 481, 481, 433,
+ 118, 438, 439, 433, 487, 433, 488, 481,
+ 433, 118, 438, 439, 433, 433, 121, 433,
+ 136, 433, 490, 490, 123, 118, 438, 439,
+ 433, 433, 433, 445, 433, 491, 145, 492,
+ 493, 126, 118, 438, 439, 433, 433, 433,
+ 445, 433, 145, 492, 493, 126, 118, 438,
+ 439, 433, 433, 433, 445, 433, 492, 492,
+ 126, 118, 438, 439, 433, 433, 433, 445,
+ 433, 494, 142, 495, 496, 129, 118, 438,
+ 439, 433, 433, 433, 445, 433, 142, 495,
+ 496, 129, 118, 438, 439, 433, 433, 433,
+ 445, 433, 495, 495, 129, 118, 438, 439,
+ 433, 433, 433, 445, 433, 497, 139, 498,
+ 499, 132, 118, 438, 439, 433, 433, 433,
+ 445, 433, 139, 498, 499, 132, 118, 438,
+ 439, 433, 433, 433, 445, 433, 498, 498,
+ 132, 118, 438, 439, 433, 433, 433, 445,
+ 433, 500, 136, 481, 501, 433, 118, 438,
+ 439, 433, 433, 433, 445, 433, 136, 481,
+ 501, 433, 118, 438, 439, 433, 433, 433,
+ 445, 433, 481, 502, 433, 118, 438, 439,
+ 433, 433, 433, 445, 433, 136, 433, 481,
+ 481, 433, 118, 438, 439, 433, 433, 433,
+ 445, 433, 119, 120, 433, 433, 136, 480,
+ 433, 118, 438, 439, 433, 433, 433, 445,
+ 433, 119, 433, 474, 479, 479, 123, 118,
+ 438, 439, 433, 433, 433, 477, 433, 473,
+ 474, 479, 479, 123, 118, 438, 439, 433,
+ 433, 433, 477, 433, 433, 441, 433, 473,
+ 474, 475, 479, 123, 118, 438, 439, 433,
+ 433, 147, 477, 433, 433, 441, 433, 471,
+ 433, 503, 433, 490, 490, 123, 118, 438,
+ 439, 433, 433, 433, 445, 433, 471, 433,
+ 471, 433, 433, 433, 481, 481, 433, 118,
+ 438, 439, 433, 433, 433, 445, 433, 471,
+ 433, 471, 433, 433, 433, 481, 504, 433,
+ 118, 438, 439, 433, 433, 433, 445, 433,
+ 471, 433, 471, 433, 503, 433, 481, 481,
+ 433, 118, 438, 439, 433, 433, 433, 445,
+ 433, 471, 433, 471, 120, 433, 433, 136,
+ 472, 433, 118, 438, 439, 433, 433, 433,
+ 445, 433, 471, 433, 464, 465, 470, 470,
+ 123, 118, 438, 439, 433, 433, 433, 468,
+ 433, 433, 441, 433, 464, 465, 466, 470,
+ 123, 118, 438, 439, 433, 433, 149, 468,
+ 433, 433, 441, 433, 462, 433, 505, 433,
+ 490, 490, 123, 118, 438, 439, 433, 433,
+ 433, 445, 433, 462, 433, 462, 433, 433,
+ 433, 481, 481, 433, 118, 438, 439, 433,
+ 433, 433, 445, 433, 462, 433, 462, 433,
+ 433, 433, 481, 506, 433, 118, 438, 439,
+ 433, 433, 433, 445, 433, 462, 433, 462,
+ 433, 505, 433, 481, 481, 433, 118, 438,
+ 439, 433, 433, 433, 445, 433, 462, 433,
+ 462, 120, 433, 433, 136, 463, 433, 118,
+ 438, 439, 433, 433, 433, 445, 433, 462,
+ 433, 455, 456, 461, 461, 123, 118, 438,
+ 439, 433, 433, 433, 459, 433, 433, 441,
+ 433, 455, 456, 457, 461, 123, 118, 438,
+ 439, 433, 433, 151, 459, 433, 433, 441,
+ 433, 453, 433, 507, 433, 490, 490, 123,
+ 118, 438, 439, 433, 433, 433, 445, 433,
+ 453, 433, 453, 433, 433, 433, 481, 481,
+ 433, 118, 438, 439, 433, 433, 433, 445,
+ 433, 453, 433, 453, 433, 433, 433, 481,
+ 508, 433, 118, 438, 439, 433, 433, 433,
+ 445, 433, 453, 433, 453, 433, 507, 433,
+ 481, 481, 433, 118, 438, 439, 433, 433,
+ 433, 445, 433, 453, 433, 453, 120, 433,
+ 433, 136, 454, 433, 118, 438, 439, 433,
+ 433, 433, 445, 433, 453, 433, 446, 447,
+ 452, 452, 123, 118, 438, 439, 433, 433,
+ 433, 450, 433, 433, 441, 433, 446, 447,
+ 448, 452, 123, 118, 438, 439, 433, 433,
+ 153, 450, 433, 433, 441, 433, 443, 433,
+ 509, 433, 490, 490, 123, 118, 438, 439,
+ 433, 433, 433, 445, 433, 443, 433, 443,
+ 433, 433, 433, 481, 481, 433, 118, 438,
+ 439, 433, 433, 433, 445, 433, 443, 433,
+ 443, 433, 433, 433, 481, 510, 433, 118,
+ 438, 439, 433, 433, 433, 445, 433, 443,
+ 433, 443, 433, 509, 433, 481, 481, 433,
+ 118, 438, 439, 433, 433, 433, 445, 433,
+ 443, 433, 443, 120, 433, 433, 136, 444,
+ 433, 118, 438, 439, 433, 433, 433, 445,
+ 433, 443, 433, 434, 435, 437, 437, 123,
+ 118, 438, 439, 433, 433, 433, 440, 433,
+ 433, 441, 433, 188, 189, 190, 191, 511,
+ 363, 84, 79, 194, 195, 196, 196, 156,
+ 197, 361, 188, 200, 361, 204, 512, 206,
+ 207, 6, 1, 208, 209, 203, 203, 38,
+ 210, 203, 203, 211, 203, 214, 189, 190,
+ 191, 513, 514, 84, 157, 515, 516, 203,
+ 196, 156, 517, 203, 214, 200, 203, 116,
+ 518, 518, 84, 157, 208, 209, 203, 203,
+ 156, 519, 203, 520, 203, 203, 521, 515,
+ 516, 203, 515, 516, 203, 255, 203, 515,
+ 522, 203, 515, 523, 203, 515, 203, 520,
+ 203, 203, 203, 515, 516, 203, 524, 3,
+ 361, 361, 402, 431, 361, 79, 194, 195,
+ 361, 361, 361, 366, 361, 524, 361, 525,
+ 368, 526, 527, 84, 157, 515, 516, 203,
+ 203, 158, 371, 203, 203, 200, 203, 528,
+ 368, 529, 529, 84, 157, 515, 516, 203,
+ 203, 203, 371, 203, 203, 200, 203, 368,
+ 529, 529, 84, 157, 515, 516, 203, 203,
+ 203, 371, 203, 203, 200, 203, 525, 368,
+ 529, 529, 84, 157, 515, 516, 203, 203,
+ 203, 371, 203, 203, 200, 203, 525, 368,
+ 526, 529, 84, 157, 515, 516, 203, 203,
+ 158, 371, 203, 203, 200, 203, 214, 203,
+ 280, 116, 530, 530, 160, 157, 208, 209,
+ 203, 203, 203, 519, 203, 214, 203, 531,
+ 184, 532, 533, 162, 157, 515, 516, 203,
+ 203, 203, 534, 203, 184, 532, 533, 162,
+ 157, 515, 516, 203, 203, 203, 534, 203,
+ 532, 532, 162, 157, 515, 516, 203, 203,
+ 203, 534, 203, 535, 181, 536, 537, 165,
+ 157, 515, 516, 203, 203, 203, 534, 203,
+ 181, 536, 537, 165, 157, 515, 516, 203,
+ 203, 203, 534, 203, 536, 536, 165, 157,
+ 515, 516, 203, 203, 203, 534, 203, 538,
+ 178, 539, 540, 168, 157, 515, 516, 203,
+ 203, 203, 534, 203, 178, 539, 540, 168,
+ 157, 515, 516, 203, 203, 203, 534, 203,
+ 539, 539, 168, 157, 515, 516, 203, 203,
+ 203, 534, 203, 541, 175, 542, 543, 203,
+ 157, 515, 516, 203, 203, 203, 534, 203,
+ 175, 542, 543, 203, 157, 515, 516, 203,
+ 203, 203, 534, 203, 542, 542, 203, 157,
+ 515, 516, 203, 203, 203, 534, 203, 544,
+ 203, 545, 546, 203, 157, 515, 516, 203,
+ 203, 172, 203, 171, 203, 542, 542, 203,
+ 157, 515, 516, 203, 542, 542, 203, 157,
+ 515, 516, 203, 544, 203, 542, 542, 203,
+ 157, 515, 516, 203, 544, 203, 545, 542,
+ 203, 157, 515, 516, 203, 203, 172, 203,
+ 524, 171, 361, 361, 98, 365, 361, 79,
+ 194, 195, 361, 361, 361, 366, 361, 524,
+ 361, 548, 547, 549, 549, 547, 186, 550,
+ 551, 547, 549, 549, 547, 186, 550, 551,
+ 547, 552, 547, 547, 553, 550, 551, 547,
+ 550, 551, 547, 554, 547, 550, 555, 547,
+ 550, 556, 547, 550, 547, 552, 547, 547,
+ 547, 550, 551, 547, 188, 432, 432, 432,
+ 432, 432, 432, 432, 432, 432, 196, 432,
+ 432, 432, 432, 188, 432, 0
};
static const short _indic_syllable_machine_trans_targs[] = {
@@ -1014,51 +1016,51 @@ static const short _indic_syllable_machine_trans_targs[] = {
169, 170, 520, 172, 173, 517, 175, 176,
514, 178, 532, 178, 179, 258, 337, 339,
413, 415, 359, 360, 416, 412, 494, 495,
- 384, 530, 178, 180, 182, 36, 257, 202,
- 203, 255, 227, 181, 35, 183, 251, 1,
- 184, 186, 34, 250, 248, 185, 33, 187,
- 244, 188, 190, 32, 243, 241, 189, 31,
- 191, 237, 192, 194, 30, 236, 234, 193,
- 29, 195, 230, 196, 198, 28, 229, 226,
- 197, 27, 212, 0, 201, 206, 178, 204,
- 205, 208, 2, 211, 3, 214, 6, 24,
- 217, 9, 21, 220, 12, 18, 223, 15,
- 225, 231, 233, 238, 240, 245, 247, 252,
- 254, 178, 259, 261, 73, 334, 281, 282,
- 335, 306, 260, 72, 262, 330, 38, 263,
- 265, 71, 329, 327, 264, 70, 266, 323,
- 267, 269, 69, 322, 320, 268, 68, 270,
- 316, 271, 273, 67, 315, 313, 272, 66,
- 274, 309, 275, 277, 65, 308, 305, 276,
- 64, 291, 37, 280, 285, 178, 283, 284,
- 287, 39, 290, 40, 293, 43, 61, 296,
- 46, 58, 299, 49, 55, 302, 52, 304,
- 310, 312, 317, 319, 324, 326, 331, 333,
- 178, 338, 109, 340, 408, 75, 341, 343,
- 108, 407, 405, 342, 107, 344, 401, 345,
- 347, 106, 400, 398, 346, 105, 348, 394,
- 349, 351, 104, 393, 391, 350, 103, 352,
- 387, 353, 355, 102, 386, 383, 354, 101,
- 369, 74, 358, 363, 178, 361, 362, 365,
- 76, 368, 77, 371, 80, 98, 374, 83,
- 95, 377, 86, 92, 380, 89, 382, 388,
- 390, 395, 397, 402, 404, 409, 411, 178,
- 178, 417, 419, 146, 145, 439, 440, 492,
- 464, 418, 420, 488, 111, 421, 423, 144,
- 487, 485, 422, 143, 424, 481, 425, 427,
- 142, 480, 478, 426, 141, 428, 474, 429,
- 431, 140, 473, 471, 430, 139, 432, 467,
- 433, 435, 138, 466, 463, 434, 137, 449,
- 110, 438, 443, 178, 441, 442, 445, 112,
- 448, 113, 451, 116, 134, 454, 119, 131,
- 457, 122, 128, 460, 125, 462, 468, 470,
- 475, 477, 482, 484, 489, 491, 147, 496,
- 497, 511, 500, 501, 529, 148, 505, 499,
- 504, 502, 503, 506, 507, 150, 510, 508,
- 149, 151, 513, 153, 174, 163, 516, 156,
- 171, 519, 159, 168, 522, 162, 165, 525,
- 164, 528, 178, 531, 177, 534, 535, 533,
- 538, 178, 536, 537
+ 384, 530, 539, 178, 180, 182, 36, 257,
+ 202, 203, 255, 227, 181, 35, 183, 251,
+ 1, 184, 186, 34, 250, 248, 185, 33,
+ 187, 244, 188, 190, 32, 243, 241, 189,
+ 31, 191, 237, 192, 194, 30, 236, 234,
+ 193, 29, 195, 230, 196, 198, 28, 229,
+ 226, 197, 27, 212, 0, 201, 206, 178,
+ 204, 205, 208, 2, 211, 3, 214, 6,
+ 24, 217, 9, 21, 220, 12, 18, 223,
+ 15, 225, 231, 233, 238, 240, 245, 247,
+ 252, 254, 178, 259, 261, 73, 334, 281,
+ 282, 335, 306, 260, 72, 262, 330, 38,
+ 263, 265, 71, 329, 327, 264, 70, 266,
+ 323, 267, 269, 69, 322, 320, 268, 68,
+ 270, 316, 271, 273, 67, 315, 313, 272,
+ 66, 274, 309, 275, 277, 65, 308, 305,
+ 276, 64, 291, 37, 280, 285, 178, 283,
+ 284, 287, 39, 290, 40, 293, 43, 61,
+ 296, 46, 58, 299, 49, 55, 302, 52,
+ 304, 310, 312, 317, 319, 324, 326, 331,
+ 333, 178, 338, 109, 340, 408, 75, 341,
+ 343, 108, 407, 405, 342, 107, 344, 401,
+ 345, 347, 106, 400, 398, 346, 105, 348,
+ 394, 349, 351, 104, 393, 391, 350, 103,
+ 352, 387, 353, 355, 102, 386, 383, 354,
+ 101, 369, 74, 358, 363, 178, 361, 362,
+ 365, 76, 368, 77, 371, 80, 98, 374,
+ 83, 95, 377, 86, 92, 380, 89, 382,
+ 388, 390, 395, 397, 402, 404, 409, 411,
+ 178, 178, 417, 419, 146, 145, 439, 440,
+ 492, 464, 418, 420, 488, 111, 421, 423,
+ 144, 487, 485, 422, 143, 424, 481, 425,
+ 427, 142, 480, 478, 426, 141, 428, 474,
+ 429, 431, 140, 473, 471, 430, 139, 432,
+ 467, 433, 435, 138, 466, 463, 434, 137,
+ 449, 110, 438, 443, 178, 441, 442, 445,
+ 112, 448, 113, 451, 116, 134, 454, 119,
+ 131, 457, 122, 128, 460, 125, 462, 468,
+ 470, 475, 477, 482, 484, 489, 491, 147,
+ 496, 497, 511, 500, 501, 529, 148, 505,
+ 499, 504, 502, 503, 506, 507, 150, 510,
+ 508, 149, 151, 513, 153, 174, 163, 516,
+ 156, 171, 519, 159, 168, 522, 162, 165,
+ 525, 164, 528, 178, 531, 177, 534, 535,
+ 533, 538, 178, 536, 537
};
static const char _indic_syllable_machine_trans_actions[] = {
@@ -1087,51 +1089,51 @@ static const char _indic_syllable_machine_trans_actions[] = {
0, 0, 2, 0, 0, 2, 0, 0,
2, 9, 0, 12, 2, 2, 6, 2,
13, 13, 0, 0, 2, 2, 6, 2,
- 6, 2, 14, 2, 2, 0, 2, 0,
+ 6, 2, 0, 14, 2, 2, 0, 2,
+ 0, 0, 2, 2, 2, 0, 2, 2,
+ 0, 2, 2, 0, 2, 2, 2, 0,
+ 2, 2, 2, 2, 0, 2, 2, 2,
+ 0, 2, 2, 2, 2, 0, 2, 2,
+ 2, 0, 2, 2, 2, 2, 0, 2,
+ 2, 2, 0, 2, 0, 0, 0, 15,
+ 0, 0, 2, 0, 2, 0, 2, 0,
+ 0, 2, 0, 0, 2, 0, 0, 2,
+ 0, 2, 2, 2, 2, 2, 2, 2,
+ 2, 2, 16, 2, 2, 0, 2, 0,
0, 2, 2, 2, 0, 2, 2, 0,
2, 2, 0, 2, 2, 2, 0, 2,
2, 2, 2, 0, 2, 2, 2, 0,
2, 2, 2, 2, 0, 2, 2, 2,
0, 2, 2, 2, 2, 0, 2, 2,
- 2, 0, 2, 0, 0, 0, 15, 0,
+ 2, 0, 2, 0, 0, 0, 17, 0,
0, 2, 0, 2, 0, 2, 0, 0,
2, 0, 0, 2, 0, 0, 2, 0,
2, 2, 2, 2, 2, 2, 2, 2,
- 2, 16, 2, 2, 0, 2, 0, 0,
- 2, 2, 2, 0, 2, 2, 0, 2,
- 2, 0, 2, 2, 2, 0, 2, 2,
- 2, 2, 0, 2, 2, 2, 0, 2,
- 2, 2, 2, 0, 2, 2, 2, 0,
- 2, 2, 2, 2, 0, 2, 2, 2,
- 0, 2, 0, 0, 0, 17, 0, 0,
- 2, 0, 2, 0, 2, 0, 0, 2,
- 0, 0, 2, 0, 0, 2, 0, 2,
- 2, 2, 2, 2, 2, 2, 2, 2,
- 18, 6, 0, 6, 6, 0, 6, 2,
- 0, 6, 2, 6, 0, 6, 6, 6,
+ 2, 18, 6, 0, 6, 6, 0, 6,
2, 0, 6, 2, 6, 0, 6, 6,
6, 2, 0, 6, 2, 6, 0, 6,
6, 6, 2, 0, 6, 2, 6, 0,
- 6, 0, 0, 0, 19, 0, 0, 2,
- 0, 2, 0, 2, 0, 0, 2, 0,
- 0, 2, 0, 0, 2, 0, 2, 2,
- 2, 2, 2, 2, 2, 2, 2, 20,
- 21, 2, 2, 0, 0, 0, 0, 2,
- 2, 2, 2, 2, 0, 2, 2, 0,
- 2, 2, 2, 0, 2, 2, 2, 2,
+ 6, 6, 6, 2, 0, 6, 2, 6,
+ 0, 6, 0, 0, 0, 19, 0, 0,
+ 2, 0, 2, 0, 2, 0, 0, 2,
+ 0, 0, 2, 0, 0, 2, 0, 2,
+ 2, 2, 2, 2, 2, 2, 2, 2,
+ 20, 21, 2, 2, 0, 0, 0, 0,
+ 2, 2, 2, 2, 2, 0, 2, 2,
0, 2, 2, 2, 0, 2, 2, 2,
2, 0, 2, 2, 2, 0, 2, 2,
2, 2, 0, 2, 2, 2, 0, 2,
- 0, 0, 0, 22, 0, 0, 2, 0,
- 2, 0, 2, 0, 0, 2, 0, 0,
- 2, 0, 0, 2, 0, 2, 2, 2,
- 2, 2, 2, 2, 2, 2, 0, 0,
- 8, 2, 0, 0, 2, 0, 2, 0,
- 0, 0, 0, 8, 8, 0, 8, 8,
- 0, 0, 2, 0, 0, 0, 2, 0,
- 0, 2, 0, 0, 2, 0, 0, 2,
- 0, 2, 23, 2, 0, 0, 0, 0,
- 0, 24, 0, 0
+ 2, 2, 2, 0, 2, 2, 2, 0,
+ 2, 0, 0, 0, 22, 0, 0, 2,
+ 0, 2, 0, 2, 0, 0, 2, 0,
+ 0, 2, 0, 0, 2, 0, 2, 2,
+ 2, 2, 2, 2, 2, 2, 2, 0,
+ 0, 8, 2, 0, 0, 2, 0, 2,
+ 0, 0, 0, 0, 8, 8, 0, 8,
+ 8, 0, 0, 2, 0, 0, 0, 2,
+ 0, 0, 2, 0, 0, 2, 0, 0,
+ 2, 0, 2, 23, 2, 0, 0, 0,
+ 0, 0, 24, 0, 0
};
static const char _indic_syllable_machine_to_state_actions[] = {
@@ -1202,7 +1204,7 @@ static const char _indic_syllable_machine_to_state_actions[] = {
0, 0, 0, 0, 0, 0, 0, 0,
0, 0, 0, 0, 0, 0, 0, 0,
0, 0, 0, 0, 0, 0, 0, 0,
- 0, 0, 0
+ 0, 0, 0, 0
};
static const char _indic_syllable_machine_from_state_actions[] = {
@@ -1273,7 +1275,7 @@ static const char _indic_syllable_machine_from_state_actions[] = {
0, 0, 0, 0, 0, 0, 0, 0,
0, 0, 0, 0, 0, 0, 0, 0,
0, 0, 0, 0, 0, 0, 0, 0,
- 0, 0, 0
+ 0, 0, 0, 0
};
static const short _indic_syllable_machine_eof_trans[] = {
@@ -1299,52 +1301,52 @@ static const short _indic_syllable_machine_eof_trans[] = {
1, 1, 1, 1, 1, 1, 1, 1,
1, 1, 1, 1, 1, 1, 1, 1,
1, 1, 1, 1, 1, 1, 1, 1,
- 1, 186, 0, 203, 203, 203, 203, 203,
- 203, 203, 203, 203, 203, 203, 203, 203,
- 203, 203, 203, 203, 203, 203, 203, 203,
- 203, 203, 203, 203, 203, 203, 203, 203,
- 203, 203, 203, 203, 203, 203, 203, 203,
- 203, 203, 203, 203, 203, 203, 203, 203,
- 203, 203, 203, 203, 203, 203, 203, 203,
- 203, 203, 203, 203, 203, 203, 203, 203,
- 203, 203, 203, 203, 203, 203, 203, 203,
- 203, 203, 203, 203, 203, 203, 203, 203,
- 203, 203, 282, 282, 282, 282, 282, 282,
- 282, 282, 282, 282, 282, 282, 282, 282,
- 282, 282, 282, 282, 282, 282, 282, 282,
- 282, 282, 282, 282, 282, 282, 282, 282,
- 282, 282, 282, 282, 282, 282, 282, 282,
- 282, 282, 282, 282, 282, 282, 282, 282,
- 282, 282, 282, 282, 282, 282, 282, 282,
- 282, 282, 282, 282, 282, 282, 282, 282,
- 282, 282, 282, 282, 282, 282, 282, 282,
- 282, 282, 282, 282, 282, 282, 282, 282,
- 282, 361, 361, 361, 361, 361, 361, 361,
- 361, 361, 361, 361, 361, 361, 361, 361,
- 361, 361, 361, 361, 361, 361, 361, 361,
- 361, 361, 361, 361, 361, 361, 361, 361,
- 361, 361, 361, 361, 361, 361, 361, 361,
- 361, 361, 361, 361, 361, 361, 361, 361,
- 361, 361, 361, 361, 361, 361, 361, 361,
- 361, 361, 361, 361, 361, 361, 361, 361,
- 361, 361, 361, 361, 361, 361, 361, 361,
- 361, 361, 361, 361, 361, 432, 361, 432,
- 433, 433, 433, 433, 433, 433, 433, 433,
- 433, 433, 433, 433, 433, 433, 433, 433,
- 433, 433, 433, 433, 433, 433, 433, 433,
- 433, 433, 433, 433, 433, 433, 433, 433,
- 433, 433, 433, 433, 433, 433, 433, 433,
- 433, 433, 433, 433, 433, 433, 433, 433,
- 433, 433, 433, 433, 433, 433, 433, 433,
- 433, 433, 433, 433, 433, 433, 433, 433,
- 433, 433, 433, 433, 433, 433, 433, 433,
- 433, 433, 433, 433, 433, 433, 361, 203,
- 203, 203, 203, 203, 203, 203, 203, 203,
- 203, 361, 203, 203, 203, 203, 203, 203,
- 203, 203, 203, 203, 203, 203, 203, 203,
- 203, 203, 203, 203, 203, 203, 203, 203,
- 203, 361, 547, 547, 547, 547, 547, 547,
- 547, 547, 547
+ 1, 186, 0, 204, 204, 204, 204, 204,
+ 204, 204, 204, 204, 204, 204, 204, 204,
+ 204, 204, 204, 204, 204, 204, 204, 204,
+ 204, 204, 204, 204, 204, 204, 204, 204,
+ 204, 204, 204, 204, 204, 204, 204, 204,
+ 204, 204, 204, 204, 204, 204, 204, 204,
+ 204, 204, 204, 204, 204, 204, 204, 204,
+ 204, 204, 204, 204, 204, 204, 204, 204,
+ 204, 204, 204, 204, 204, 204, 204, 204,
+ 204, 204, 204, 204, 204, 204, 204, 204,
+ 204, 204, 283, 283, 283, 283, 283, 283,
+ 283, 283, 283, 283, 283, 283, 283, 283,
+ 283, 283, 283, 283, 283, 283, 283, 283,
+ 283, 283, 283, 283, 283, 283, 283, 283,
+ 283, 283, 283, 283, 283, 283, 283, 283,
+ 283, 283, 283, 283, 283, 283, 283, 283,
+ 283, 283, 283, 283, 283, 283, 283, 283,
+ 283, 283, 283, 283, 283, 283, 283, 283,
+ 283, 283, 283, 283, 283, 283, 283, 283,
+ 283, 283, 283, 283, 283, 283, 283, 283,
+ 283, 362, 362, 362, 362, 362, 362, 362,
+ 362, 362, 362, 362, 362, 362, 362, 362,
+ 362, 362, 362, 362, 362, 362, 362, 362,
+ 362, 362, 362, 362, 362, 362, 362, 362,
+ 362, 362, 362, 362, 362, 362, 362, 362,
+ 362, 362, 362, 362, 362, 362, 362, 362,
+ 362, 362, 362, 362, 362, 362, 362, 362,
+ 362, 362, 362, 362, 362, 362, 362, 362,
+ 362, 362, 362, 362, 362, 362, 362, 362,
+ 362, 362, 362, 362, 362, 433, 362, 433,
+ 434, 434, 434, 434, 434, 434, 434, 434,
+ 434, 434, 434, 434, 434, 434, 434, 434,
+ 434, 434, 434, 434, 434, 434, 434, 434,
+ 434, 434, 434, 434, 434, 434, 434, 434,
+ 434, 434, 434, 434, 434, 434, 434, 434,
+ 434, 434, 434, 434, 434, 434, 434, 434,
+ 434, 434, 434, 434, 434, 434, 434, 434,
+ 434, 434, 434, 434, 434, 434, 434, 434,
+ 434, 434, 434, 434, 434, 434, 434, 434,
+ 434, 434, 434, 434, 434, 434, 362, 204,
+ 204, 204, 204, 204, 204, 204, 204, 204,
+ 204, 362, 204, 204, 204, 204, 204, 204,
+ 204, 204, 204, 204, 204, 204, 204, 204,
+ 204, 204, 204, 204, 204, 204, 204, 204,
+ 204, 362, 548, 548, 548, 548, 548, 548,
+ 548, 548, 548, 433
};
static const int indic_syllable_machine_start = 178;
@@ -1358,7 +1360,7 @@ static const int indic_syllable_machine_en_main = 178;
-#line 96 "hb-ot-shape-complex-indic-machine.rl"
+#line 97 "hb-ot-shape-complex-indic-machine.rl"
#define found_syllable(syllable_type) \
@@ -1378,7 +1380,7 @@ find_syllables (hb_buffer_t *buffer)
int cs;
hb_glyph_info_t *info = buffer->info;
-#line 1382 "hb-ot-shape-complex-indic-machine.hh"
+#line 1384 "hb-ot-shape-complex-indic-machine.hh"
{
cs = indic_syllable_machine_start;
ts = 0;
@@ -1386,7 +1388,7 @@ find_syllables (hb_buffer_t *buffer)
act = 0;
}
-#line 117 "hb-ot-shape-complex-indic-machine.rl"
+#line 118 "hb-ot-shape-complex-indic-machine.rl"
p = 0;
@@ -1395,7 +1397,7 @@ find_syllables (hb_buffer_t *buffer)
unsigned int last = 0;
unsigned int syllable_serial = 1;
-#line 1399 "hb-ot-shape-complex-indic-machine.hh"
+#line 1401 "hb-ot-shape-complex-indic-machine.hh"
{
int _slen;
int _trans;
@@ -1409,7 +1411,7 @@ _resume:
#line 1 "NONE"
{ts = p;}
break;
-#line 1413 "hb-ot-shape-complex-indic-machine.hh"
+#line 1415 "hb-ot-shape-complex-indic-machine.hh"
}
_keys = _indic_syllable_machine_trans_keys + (cs<<1);
@@ -1432,71 +1434,71 @@ _eof_trans:
{te = p+1;}
break;
case 15:
-#line 87 "hb-ot-shape-complex-indic-machine.rl"
+#line 88 "hb-ot-shape-complex-indic-machine.rl"
{te = p+1;{ found_syllable (consonant_syllable); }}
break;
case 17:
-#line 88 "hb-ot-shape-complex-indic-machine.rl"
+#line 89 "hb-ot-shape-complex-indic-machine.rl"
{te = p+1;{ found_syllable (vowel_syllable); }}
break;
case 22:
-#line 89 "hb-ot-shape-complex-indic-machine.rl"
+#line 90 "hb-ot-shape-complex-indic-machine.rl"
{te = p+1;{ found_syllable (standalone_cluster); }}
break;
case 24:
-#line 90 "hb-ot-shape-complex-indic-machine.rl"
+#line 91 "hb-ot-shape-complex-indic-machine.rl"
{te = p+1;{ found_syllable (symbol_cluster); }}
break;
case 19:
-#line 91 "hb-ot-shape-complex-indic-machine.rl"
+#line 92 "hb-ot-shape-complex-indic-machine.rl"
{te = p+1;{ found_syllable (broken_cluster); }}
break;
case 12:
-#line 92 "hb-ot-shape-complex-indic-machine.rl"
+#line 93 "hb-ot-shape-complex-indic-machine.rl"
{te = p+1;{ found_syllable (non_indic_cluster); }}
break;
case 14:
-#line 87 "hb-ot-shape-complex-indic-machine.rl"
+#line 88 "hb-ot-shape-complex-indic-machine.rl"
{te = p;p--;{ found_syllable (consonant_syllable); }}
break;
case 16:
-#line 88 "hb-ot-shape-complex-indic-machine.rl"
+#line 89 "hb-ot-shape-complex-indic-machine.rl"
{te = p;p--;{ found_syllable (vowel_syllable); }}
break;
case 21:
-#line 89 "hb-ot-shape-complex-indic-machine.rl"
+#line 90 "hb-ot-shape-complex-indic-machine.rl"
{te = p;p--;{ found_syllable (standalone_cluster); }}
break;
case 23:
-#line 90 "hb-ot-shape-complex-indic-machine.rl"
+#line 91 "hb-ot-shape-complex-indic-machine.rl"
{te = p;p--;{ found_syllable (symbol_cluster); }}
break;
case 18:
-#line 91 "hb-ot-shape-complex-indic-machine.rl"
+#line 92 "hb-ot-shape-complex-indic-machine.rl"
{te = p;p--;{ found_syllable (broken_cluster); }}
break;
case 20:
-#line 92 "hb-ot-shape-complex-indic-machine.rl"
+#line 93 "hb-ot-shape-complex-indic-machine.rl"
{te = p;p--;{ found_syllable (non_indic_cluster); }}
break;
case 1:
-#line 87 "hb-ot-shape-complex-indic-machine.rl"
+#line 88 "hb-ot-shape-complex-indic-machine.rl"
{{p = ((te))-1;}{ found_syllable (consonant_syllable); }}
break;
case 3:
-#line 88 "hb-ot-shape-complex-indic-machine.rl"
+#line 89 "hb-ot-shape-complex-indic-machine.rl"
{{p = ((te))-1;}{ found_syllable (vowel_syllable); }}
break;
case 7:
-#line 89 "hb-ot-shape-complex-indic-machine.rl"
+#line 90 "hb-ot-shape-complex-indic-machine.rl"
{{p = ((te))-1;}{ found_syllable (standalone_cluster); }}
break;
case 9:
-#line 90 "hb-ot-shape-complex-indic-machine.rl"
+#line 91 "hb-ot-shape-complex-indic-machine.rl"
{{p = ((te))-1;}{ found_syllable (symbol_cluster); }}
break;
case 4:
-#line 91 "hb-ot-shape-complex-indic-machine.rl"
+#line 92 "hb-ot-shape-complex-indic-machine.rl"
{{p = ((te))-1;}{ found_syllable (broken_cluster); }}
break;
case 5:
@@ -1517,22 +1519,22 @@ _eof_trans:
case 8:
#line 1 "NONE"
{te = p+1;}
-#line 87 "hb-ot-shape-complex-indic-machine.rl"
+#line 88 "hb-ot-shape-complex-indic-machine.rl"
{act = 1;}
break;
case 6:
#line 1 "NONE"
{te = p+1;}
-#line 91 "hb-ot-shape-complex-indic-machine.rl"
+#line 92 "hb-ot-shape-complex-indic-machine.rl"
{act = 5;}
break;
case 13:
#line 1 "NONE"
{te = p+1;}
-#line 92 "hb-ot-shape-complex-indic-machine.rl"
+#line 93 "hb-ot-shape-complex-indic-machine.rl"
{act = 6;}
break;
-#line 1536 "hb-ot-shape-complex-indic-machine.hh"
+#line 1538 "hb-ot-shape-complex-indic-machine.hh"
}
_again:
@@ -1541,7 +1543,7 @@ _again:
#line 1 "NONE"
{ts = 0;}
break;
-#line 1545 "hb-ot-shape-complex-indic-machine.hh"
+#line 1547 "hb-ot-shape-complex-indic-machine.hh"
}
if ( ++p != pe )
@@ -1557,7 +1559,7 @@ _again:
}
-#line 126 "hb-ot-shape-complex-indic-machine.rl"
+#line 127 "hb-ot-shape-complex-indic-machine.rl"
}
diff --git a/src/3rdparty/harfbuzz-ng/src/hb-ot-shape-complex-indic-private.hh b/src/3rdparty/harfbuzz-ng/src/hb-ot-shape-complex-indic-private.hh
index 5879c3e491..a1e0d5266b 100644
--- a/src/3rdparty/harfbuzz-ng/src/hb-ot-shape-complex-indic-private.hh
+++ b/src/3rdparty/harfbuzz-ng/src/hb-ot-shape-complex-indic-private.hh
@@ -60,7 +60,8 @@ enum indic_category_t {
OT_Repha = 15, /* Atomically-encoded logical or visual repha. */
OT_Ra = 16,
OT_CM = 17, /* Consonant-Medial. */
- OT_Symbol = 18 /* Avagraha, etc that take marks (SM,A,VD). */
+ OT_Symbol = 18, /* Avagraha, etc that take marks (SM,A,VD). */
+ OT_CS = 19
};
#define MEDIAL_FLAGS (FLAG (OT_CM))
@@ -70,7 +71,7 @@ enum indic_category_t {
* We treat Vowels and placeholders as if they were consonants. This is safe because Vowels
* cannot happen in a consonant syllable. The plus side however is, we can call the
* consonant syllable logic from the vowel syllable function and get it all right! */
-#define CONSONANT_FLAGS (FLAG (OT_C) | FLAG (OT_Ra) | MEDIAL_FLAGS | FLAG (OT_V) | FLAG (OT_PLACEHOLDER) | FLAG (OT_DOTTEDCIRCLE))
+#define CONSONANT_FLAGS (FLAG (OT_C) | FLAG (OT_CS) | FLAG (OT_Ra) | MEDIAL_FLAGS | FLAG (OT_V) | FLAG (OT_PLACEHOLDER) | FLAG (OT_DOTTEDCIRCLE))
#define JOINER_FLAGS (FLAG (OT_ZWJ) | FLAG (OT_ZWNJ))
#define HALANT_OR_COENG_FLAGS (FLAG (OT_H) | FLAG (OT_Coeng))
@@ -121,8 +122,8 @@ enum indic_syllabic_category_t {
INDIC_SYLLABIC_CATEGORY_CONSONANT_PREFIXED = OT_X, /* Don't care. */
INDIC_SYLLABIC_CATEGORY_CONSONANT_SUBJOINED = OT_CM,
INDIC_SYLLABIC_CATEGORY_CONSONANT_SUCCEEDING_REPHA = OT_N,
- INDIC_SYLLABIC_CATEGORY_CONSONANT_WITH_STACKER = OT_Repha, /* TODO */
- INDIC_SYLLABIC_CATEGORY_GEMINATION_MARK = OT_SM,
+ INDIC_SYLLABIC_CATEGORY_CONSONANT_WITH_STACKER = OT_CS,
+ INDIC_SYLLABIC_CATEGORY_GEMINATION_MARK = OT_SM, /* https://github.com/harfbuzz/harfbuzz/issues/552 */
INDIC_SYLLABIC_CATEGORY_INVISIBLE_STACKER = OT_Coeng,
INDIC_SYLLABIC_CATEGORY_JOINER = OT_ZWJ,
INDIC_SYLLABIC_CATEGORY_MODIFYING_LETTER = OT_X,
@@ -132,7 +133,7 @@ enum indic_syllabic_category_t {
INDIC_SYLLABIC_CATEGORY_NUMBER_JOINER = OT_PLACEHOLDER, /* Don't care. */
INDIC_SYLLABIC_CATEGORY_PURE_KILLER = OT_M, /* Is like a vowel matra. */
INDIC_SYLLABIC_CATEGORY_REGISTER_SHIFTER = OT_RS,
- INDIC_SYLLABIC_CATEGORY_SYLLABLE_MODIFIER = OT_M, /* Misc Khmer signs. */
+ INDIC_SYLLABIC_CATEGORY_SYLLABLE_MODIFIER = OT_SM,
INDIC_SYLLABIC_CATEGORY_TONE_LETTER = OT_X,
INDIC_SYLLABIC_CATEGORY_TONE_MARK = OT_N,
INDIC_SYLLABIC_CATEGORY_VIRAMA = OT_H,
diff --git a/src/3rdparty/harfbuzz-ng/src/hb-ot-shape-complex-indic-table.cc b/src/3rdparty/harfbuzz-ng/src/hb-ot-shape-complex-indic-table.cc
index 80a6b25e3b..bfd1c6d342 100644
--- a/src/3rdparty/harfbuzz-ng/src/hb-ot-shape-complex-indic-table.cc
+++ b/src/3rdparty/harfbuzz-ng/src/hb-ot-shape-complex-indic-table.cc
@@ -6,61 +6,62 @@
*
* on files with these headers:
*
- * # IndicSyllabicCategory-9.0.0.txt
- * # Date: 2016-05-21, 02:46:00 GMT [RP]
- * # IndicPositionalCategory-9.0.0.txt
- * # Date: 2016-02-25, 00:48:00 GMT [RP]
- * # Blocks-9.0.0.txt
- * # Date: 2016-02-05, 23:48:00 GMT [KW]
+ * # IndicSyllabicCategory-10.0.0.txt
+ * # Date: 2017-05-31, 01:07:00 GMT [KW, RP]
+ * # IndicPositionalCategory-10.0.0.txt
+ * # Date: 2017-05-31, 01:07:00 GMT [RP]
+ * # Blocks-10.0.0.txt
+ * # Date: 2017-04-12, 17:30:00 GMT [KW]
*/
#include "hb-ot-shape-complex-indic-private.hh"
#define ISC_A INDIC_SYLLABIC_CATEGORY_AVAGRAHA /* 15 chars; Avagraha */
-#define ISC_Bi INDIC_SYLLABIC_CATEGORY_BINDU /* 67 chars; Bindu */
+#define ISC_Bi INDIC_SYLLABIC_CATEGORY_BINDU /* 80 chars; Bindu */
#define ISC_BJN INDIC_SYLLABIC_CATEGORY_BRAHMI_JOINING_NUMBER /* 20 chars; Brahmi_Joining_Number */
-#define ISC_Ca INDIC_SYLLABIC_CATEGORY_CANTILLATION_MARK /* 53 chars; Cantillation_Mark */
-#define ISC_C INDIC_SYLLABIC_CATEGORY_CONSONANT /* 1907 chars; Consonant */
+#define ISC_Ca INDIC_SYLLABIC_CATEGORY_CANTILLATION_MARK /* 57 chars; Cantillation_Mark */
+#define ISC_C INDIC_SYLLABIC_CATEGORY_CONSONANT /* 2024 chars; Consonant */
#define ISC_CD INDIC_SYLLABIC_CATEGORY_CONSONANT_DEAD /* 10 chars; Consonant_Dead */
-#define ISC_CF INDIC_SYLLABIC_CATEGORY_CONSONANT_FINAL /* 62 chars; Consonant_Final */
+#define ISC_CF INDIC_SYLLABIC_CATEGORY_CONSONANT_FINAL /* 68 chars; Consonant_Final */
#define ISC_CHL INDIC_SYLLABIC_CATEGORY_CONSONANT_HEAD_LETTER /* 5 chars; Consonant_Head_Letter */
#define ISC_CK INDIC_SYLLABIC_CATEGORY_CONSONANT_KILLER /* 2 chars; Consonant_Killer */
-#define ISC_CM INDIC_SYLLABIC_CATEGORY_CONSONANT_MEDIAL /* 22 chars; Consonant_Medial */
-#define ISC_CP INDIC_SYLLABIC_CATEGORY_CONSONANT_PLACEHOLDER /* 16 chars; Consonant_Placeholder */
-#define ISC_CPR INDIC_SYLLABIC_CATEGORY_CONSONANT_PRECEDING_REPHA /* 1 chars; Consonant_Preceding_Repha */
-#define ISC_CPrf INDIC_SYLLABIC_CATEGORY_CONSONANT_PREFIXED /* 2 chars; Consonant_Prefixed */
-#define ISC_CS INDIC_SYLLABIC_CATEGORY_CONSONANT_SUBJOINED /* 90 chars; Consonant_Subjoined */
-#define ISC_CSR INDIC_SYLLABIC_CATEGORY_CONSONANT_SUCCEEDING_REPHA /* 4 chars; Consonant_Succeeding_Repha */
+#define ISC_CM INDIC_SYLLABIC_CATEGORY_CONSONANT_MEDIAL /* 27 chars; Consonant_Medial */
+#define ISC_CP INDIC_SYLLABIC_CATEGORY_CONSONANT_PLACEHOLDER /* 18 chars; Consonant_Placeholder */
+#define ISC_CPR INDIC_SYLLABIC_CATEGORY_CONSONANT_PRECEDING_REPHA /* 2 chars; Consonant_Preceding_Repha */
+#define ISC_CPrf INDIC_SYLLABIC_CATEGORY_CONSONANT_PREFIXED /* 7 chars; Consonant_Prefixed */
+#define ISC_CS INDIC_SYLLABIC_CATEGORY_CONSONANT_SUBJOINED /* 95 chars; Consonant_Subjoined */
+#define ISC_CSR INDIC_SYLLABIC_CATEGORY_CONSONANT_SUCCEEDING_REPHA /* 5 chars; Consonant_Succeeding_Repha */
#define ISC_CWS INDIC_SYLLABIC_CATEGORY_CONSONANT_WITH_STACKER /* 4 chars; Consonant_With_Stacker */
-#define ISC_GM INDIC_SYLLABIC_CATEGORY_GEMINATION_MARK /* 2 chars; Gemination_Mark */
-#define ISC_IS INDIC_SYLLABIC_CATEGORY_INVISIBLE_STACKER /* 7 chars; Invisible_Stacker */
+#define ISC_GM INDIC_SYLLABIC_CATEGORY_GEMINATION_MARK /* 3 chars; Gemination_Mark */
+#define ISC_IS INDIC_SYLLABIC_CATEGORY_INVISIBLE_STACKER /* 10 chars; Invisible_Stacker */
#define ISC_ZWJ INDIC_SYLLABIC_CATEGORY_JOINER /* 1 chars; Joiner */
#define ISC_ML INDIC_SYLLABIC_CATEGORY_MODIFYING_LETTER /* 1 chars; Modifying_Letter */
#define ISC_ZWNJ INDIC_SYLLABIC_CATEGORY_NON_JOINER /* 1 chars; Non_Joiner */
-#define ISC_N INDIC_SYLLABIC_CATEGORY_NUKTA /* 24 chars; Nukta */
-#define ISC_Nd INDIC_SYLLABIC_CATEGORY_NUMBER /* 459 chars; Number */
+#define ISC_N INDIC_SYLLABIC_CATEGORY_NUKTA /* 28 chars; Nukta */
+#define ISC_Nd INDIC_SYLLABIC_CATEGORY_NUMBER /* 469 chars; Number */
#define ISC_NJ INDIC_SYLLABIC_CATEGORY_NUMBER_JOINER /* 1 chars; Number_Joiner */
#define ISC_x INDIC_SYLLABIC_CATEGORY_OTHER /* 1 chars; Other */
-#define ISC_PK INDIC_SYLLABIC_CATEGORY_PURE_KILLER /* 16 chars; Pure_Killer */
+#define ISC_PK INDIC_SYLLABIC_CATEGORY_PURE_KILLER /* 21 chars; Pure_Killer */
#define ISC_RS INDIC_SYLLABIC_CATEGORY_REGISTER_SHIFTER /* 2 chars; Register_Shifter */
#define ISC_SM INDIC_SYLLABIC_CATEGORY_SYLLABLE_MODIFIER /* 22 chars; Syllable_Modifier */
#define ISC_TL INDIC_SYLLABIC_CATEGORY_TONE_LETTER /* 7 chars; Tone_Letter */
#define ISC_TM INDIC_SYLLABIC_CATEGORY_TONE_MARK /* 42 chars; Tone_Mark */
#define ISC_V INDIC_SYLLABIC_CATEGORY_VIRAMA /* 24 chars; Virama */
-#define ISC_Vs INDIC_SYLLABIC_CATEGORY_VISARGA /* 31 chars; Visarga */
+#define ISC_Vs INDIC_SYLLABIC_CATEGORY_VISARGA /* 34 chars; Visarga */
#define ISC_Vo INDIC_SYLLABIC_CATEGORY_VOWEL /* 30 chars; Vowel */
-#define ISC_M INDIC_SYLLABIC_CATEGORY_VOWEL_DEPENDENT /* 602 chars; Vowel_Dependent */
-#define ISC_VI INDIC_SYLLABIC_CATEGORY_VOWEL_INDEPENDENT /* 431 chars; Vowel_Independent */
+#define ISC_M INDIC_SYLLABIC_CATEGORY_VOWEL_DEPENDENT /* 633 chars; Vowel_Dependent */
+#define ISC_VI INDIC_SYLLABIC_CATEGORY_VOWEL_INDEPENDENT /* 443 chars; Vowel_Independent */
-#define IMC_B INDIC_MATRA_CATEGORY_BOTTOM /* 300 chars; Bottom */
+#define IMC_B INDIC_MATRA_CATEGORY_BOTTOM /* 330 chars; Bottom */
+#define IMC_BL INDIC_MATRA_CATEGORY_BOTTOM_AND_LEFT /* 1 chars; Bottom_And_Left */
#define IMC_BR INDIC_MATRA_CATEGORY_BOTTOM_AND_RIGHT /* 2 chars; Bottom_And_Right */
#define IMC_L INDIC_MATRA_CATEGORY_LEFT /* 57 chars; Left */
#define IMC_LR INDIC_MATRA_CATEGORY_LEFT_AND_RIGHT /* 21 chars; Left_And_Right */
#define IMC_x INDIC_MATRA_CATEGORY_NOT_APPLICABLE /* 1 chars; Not_Applicable */
#define IMC_O INDIC_MATRA_CATEGORY_OVERSTRUCK /* 10 chars; Overstruck */
-#define IMC_R INDIC_MATRA_CATEGORY_RIGHT /* 258 chars; Right */
-#define IMC_T INDIC_MATRA_CATEGORY_TOP /* 342 chars; Top */
+#define IMC_R INDIC_MATRA_CATEGORY_RIGHT /* 262 chars; Right */
+#define IMC_T INDIC_MATRA_CATEGORY_TOP /* 380 chars; Top */
#define IMC_TB INDIC_MATRA_CATEGORY_TOP_AND_BOTTOM /* 10 chars; Top_And_Bottom */
#define IMC_TBR INDIC_MATRA_CATEGORY_TOP_AND_BOTTOM_AND_RIGHT /* 1 chars; Top_And_Bottom_And_Right */
#define IMC_TL INDIC_MATRA_CATEGORY_TOP_AND_LEFT /* 6 chars; Top_And_Left */
@@ -133,7 +134,7 @@ static const INDIC_TABLE_ELEMENT_TYPE indic_table[] = {
/* 09E0 */ _(VI,x), _(VI,x), _(M,B), _(M,B), _(x,x), _(x,x), _(Nd,x), _(Nd,x),
/* 09E8 */ _(Nd,x), _(Nd,x), _(Nd,x), _(Nd,x), _(Nd,x), _(Nd,x), _(Nd,x), _(Nd,x),
/* 09F0 */ _(C,x), _(C,x), _(x,x), _(x,x), _(x,x), _(x,x), _(x,x), _(x,x),
- /* 09F8 */ _(x,x), _(x,x), _(x,x), _(x,x), _(x,x), _(x,x), _(x,x), _(x,x),
+ /* 09F8 */ _(x,x), _(x,x), _(x,x), _(x,x), _(Bi,x), _(x,x), _(x,x), _(x,x),
/* Gurmukhi */
@@ -171,7 +172,7 @@ static const INDIC_TABLE_ELEMENT_TYPE indic_table[] = {
/* 0AE0 */ _(VI,x), _(VI,x), _(M,B), _(M,B), _(x,x), _(x,x), _(Nd,x), _(Nd,x),
/* 0AE8 */ _(Nd,x), _(Nd,x), _(Nd,x), _(Nd,x), _(Nd,x), _(Nd,x), _(Nd,x), _(Nd,x),
/* 0AF0 */ _(x,x), _(x,x), _(x,x), _(x,x), _(x,x), _(x,x), _(x,x), _(x,x),
- /* 0AF8 */ _(x,x), _(C,x), _(x,x), _(x,x), _(x,x), _(x,x), _(x,x), _(x,x),
+ /* 0AF8 */ _(x,x), _(C,x), _(Ca,T), _(Ca,T), _(Ca,T), _(N,T), _(N,T), _(N,T),
/* Oriya */
@@ -251,14 +252,14 @@ static const INDIC_TABLE_ELEMENT_TYPE indic_table[] = {
/* Malayalam */
- /* 0D00 */ _(x,x), _(Bi,T), _(Bi,R), _(Vs,R), _(x,x), _(VI,x), _(VI,x), _(VI,x),
+ /* 0D00 */ _(Bi,T), _(Bi,T), _(Bi,R), _(Vs,R), _(x,x), _(VI,x), _(VI,x), _(VI,x),
/* 0D08 */ _(VI,x), _(VI,x), _(VI,x), _(VI,x), _(VI,x), _(x,x), _(VI,x), _(VI,x),
/* 0D10 */ _(VI,x), _(x,x), _(VI,x), _(VI,x), _(VI,x), _(C,x), _(C,x), _(C,x),
/* 0D18 */ _(C,x), _(C,x), _(C,x), _(C,x), _(C,x), _(C,x), _(C,x), _(C,x),
/* 0D20 */ _(C,x), _(C,x), _(C,x), _(C,x), _(C,x), _(C,x), _(C,x), _(C,x),
/* 0D28 */ _(C,x), _(C,x), _(C,x), _(C,x), _(C,x), _(C,x), _(C,x), _(C,x),
/* 0D30 */ _(C,x), _(C,x), _(C,x), _(C,x), _(C,x), _(C,x), _(C,x), _(C,x),
- /* 0D38 */ _(C,x), _(C,x), _(C,x), _(x,x), _(x,x), _(A,x), _(M,R), _(M,R),
+ /* 0D38 */ _(C,x), _(C,x), _(C,x), _(PK,T), _(PK,T), _(A,x), _(M,R), _(M,R),
/* 0D40 */ _(M,R), _(M,R), _(M,R), _(M,B), _(M,B), _(x,x), _(M,L), _(M,L),
/* 0D48 */ _(M,L), _(x,x), _(M,LR), _(M,LR), _(M,LR), _(V,T),_(CPR,x), _(x,x),
/* 0D50 */ _(x,x), _(x,x), _(x,x), _(x,x), _(CD,x), _(CD,x), _(CD,x), _(M,R),
@@ -341,7 +342,7 @@ static const INDIC_TABLE_ELEMENT_TYPE indic_table[] = {
/* 1CD8 */ _(Ca,B), _(Ca,B), _(Ca,T), _(Ca,T), _(Ca,B), _(Ca,B), _(Ca,B), _(Ca,B),
/* 1CE0 */ _(Ca,T), _(Ca,R), _(x,O), _(x,O), _(x,O), _(x,O), _(x,O), _(x,O),
/* 1CE8 */ _(x,O), _(x,x), _(x,x), _(x,x), _(x,x), _(x,B), _(x,x), _(x,x),
- /* 1CF0 */ _(x,x), _(x,x), _(Vs,x), _(Vs,x), _(Ca,T), _(x,x), _(x,x), _(x,x),
+ /* 1CF0 */ _(x,x), _(x,x), _(Vs,x), _(Vs,x), _(Ca,T), _(x,x), _(x,x), _(Ca,R),
/* 1CF8 */ _(Ca,x), _(Ca,x), _(x,x), _(x,x), _(x,x), _(x,x), _(x,x), _(x,x),
#define indic_offset_0x2008u 1656
@@ -368,7 +369,7 @@ static const INDIC_TABLE_ELEMENT_TYPE indic_table[] = {
/* A8E0 */ _(Ca,T), _(Ca,T), _(Ca,T), _(Ca,T), _(Ca,T), _(Ca,T), _(Ca,T), _(Ca,T),
/* A8E8 */ _(Ca,T), _(Ca,T), _(Ca,T), _(Ca,T), _(Ca,T), _(Ca,T), _(Ca,T), _(Ca,T),
- /* A8F0 */ _(Ca,T), _(Ca,T), _(x,x), _(x,x), _(x,x), _(x,x), _(x,x), _(x,x),
+ /* A8F0 */ _(Ca,T), _(Ca,T), _(Bi,x), _(Bi,x), _(x,x), _(x,x), _(x,x), _(x,x),
#define indic_offset_0xa9e0u 1720
@@ -390,7 +391,7 @@ static const INDIC_TABLE_ELEMENT_TYPE indic_table[] = {
/* AA70 */ _(x,x), _(C,x), _(C,x), _(C,x), _(CP,x), _(CP,x), _(CP,x), _(x,x),
/* AA78 */ _(x,x), _(x,x), _(C,x), _(TM,R), _(TM,T), _(TM,R), _(C,x), _(C,x),
-}; /* Table items: 1784; occupancy: 69% */
+}; /* Table items: 1784; occupancy: 70% */
INDIC_TABLE_ELEMENT_TYPE
hb_indic_get_categories (hb_codepoint_t u)
@@ -398,28 +399,28 @@ hb_indic_get_categories (hb_codepoint_t u)
switch (u >> 12)
{
case 0x0u:
- if (hb_in_range (u, 0x0028u, 0x003Fu)) return indic_table[u - 0x0028u + indic_offset_0x0028u];
- if (hb_in_range (u, 0x00B0u, 0x00D7u)) return indic_table[u - 0x00B0u + indic_offset_0x00b0u];
- if (hb_in_range (u, 0x0900u, 0x0DF7u)) return indic_table[u - 0x0900u + indic_offset_0x0900u];
+ if (hb_in_range<hb_codepoint_t> (u, 0x0028u, 0x003Fu)) return indic_table[u - 0x0028u + indic_offset_0x0028u];
+ if (hb_in_range<hb_codepoint_t> (u, 0x00B0u, 0x00D7u)) return indic_table[u - 0x00B0u + indic_offset_0x00b0u];
+ if (hb_in_range<hb_codepoint_t> (u, 0x0900u, 0x0DF7u)) return indic_table[u - 0x0900u + indic_offset_0x0900u];
if (unlikely (u == 0x00A0u)) return _(CP,x);
break;
case 0x1u:
- if (hb_in_range (u, 0x1000u, 0x109Fu)) return indic_table[u - 0x1000u + indic_offset_0x1000u];
- if (hb_in_range (u, 0x1780u, 0x17EFu)) return indic_table[u - 0x1780u + indic_offset_0x1780u];
- if (hb_in_range (u, 0x1CD0u, 0x1CFFu)) return indic_table[u - 0x1CD0u + indic_offset_0x1cd0u];
+ if (hb_in_range<hb_codepoint_t> (u, 0x1000u, 0x109Fu)) return indic_table[u - 0x1000u + indic_offset_0x1000u];
+ if (hb_in_range<hb_codepoint_t> (u, 0x1780u, 0x17EFu)) return indic_table[u - 0x1780u + indic_offset_0x1780u];
+ if (hb_in_range<hb_codepoint_t> (u, 0x1CD0u, 0x1CFFu)) return indic_table[u - 0x1CD0u + indic_offset_0x1cd0u];
break;
case 0x2u:
- if (hb_in_range (u, 0x2008u, 0x2017u)) return indic_table[u - 0x2008u + indic_offset_0x2008u];
- if (hb_in_range (u, 0x2070u, 0x2087u)) return indic_table[u - 0x2070u + indic_offset_0x2070u];
+ if (hb_in_range<hb_codepoint_t> (u, 0x2008u, 0x2017u)) return indic_table[u - 0x2008u + indic_offset_0x2008u];
+ if (hb_in_range<hb_codepoint_t> (u, 0x2070u, 0x2087u)) return indic_table[u - 0x2070u + indic_offset_0x2070u];
if (unlikely (u == 0x25CCu)) return _(CP,x);
break;
case 0xAu:
- if (hb_in_range (u, 0xA8E0u, 0xA8F7u)) return indic_table[u - 0xA8E0u + indic_offset_0xa8e0u];
- if (hb_in_range (u, 0xA9E0u, 0xA9FFu)) return indic_table[u - 0xA9E0u + indic_offset_0xa9e0u];
- if (hb_in_range (u, 0xAA60u, 0xAA7Fu)) return indic_table[u - 0xAA60u + indic_offset_0xaa60u];
+ if (hb_in_range<hb_codepoint_t> (u, 0xA8E0u, 0xA8F7u)) return indic_table[u - 0xA8E0u + indic_offset_0xa8e0u];
+ if (hb_in_range<hb_codepoint_t> (u, 0xA9E0u, 0xA9FFu)) return indic_table[u - 0xA9E0u + indic_offset_0xa9e0u];
+ if (hb_in_range<hb_codepoint_t> (u, 0xAA60u, 0xAA7Fu)) return indic_table[u - 0xAA60u + indic_offset_0xaa60u];
break;
default:
@@ -467,6 +468,7 @@ hb_indic_get_categories (hb_codepoint_t u)
#undef ISC_VI
#undef IMC_B
+#undef IMC_BL
#undef IMC_BR
#undef IMC_L
#undef IMC_LR
diff --git a/src/3rdparty/harfbuzz-ng/src/hb-ot-shape-complex-indic.cc b/src/3rdparty/harfbuzz-ng/src/hb-ot-shape-complex-indic.cc
index b48fb561c3..97d6d38287 100644
--- a/src/3rdparty/harfbuzz-ng/src/hb-ot-shape-complex-indic.cc
+++ b/src/3rdparty/harfbuzz-ng/src/hb-ot-shape-complex-indic.cc
@@ -142,7 +142,7 @@ is_one_of (const hb_glyph_info_t &info, unsigned int flags)
{
/* If it ligated, all bets are off. */
if (_hb_glyph_info_ligated (&info)) return false;
- return !!(FLAG_SAFE (info.indic_category()) & flags);
+ return !!(FLAG_UNSAFE (info.indic_category()) & flags);
}
static inline bool
@@ -177,15 +177,15 @@ set_indic_properties (hb_glyph_info_t &info)
*/
/* The following act more like the Bindus. */
- if (unlikely (hb_in_range (u, 0x0953u, 0x0954u)))
+ if (unlikely (hb_in_range<hb_codepoint_t> (u, 0x0953u, 0x0954u)))
cat = OT_SM;
/* The following act like consonants. */
- else if (unlikely (hb_in_ranges (u, 0x0A72u, 0x0A73u,
+ else if (unlikely (hb_in_ranges<hb_codepoint_t> (u, 0x0A72u, 0x0A73u,
0x1CF5u, 0x1CF6u)))
cat = OT_C;
/* TODO: The following should only be allowed after a Visarga.
* For now, just treat them like regular tone marks. */
- else if (unlikely (hb_in_range (u, 0x1CE2u, 0x1CE8u)))
+ else if (unlikely (hb_in_range<hb_codepoint_t> (u, 0x1CE2u, 0x1CE8u)))
cat = OT_A;
/* TODO: The following should only be allowed after some of
* the nasalization marks, maybe only for U+1CE9..U+1CF1.
@@ -193,15 +193,39 @@ set_indic_properties (hb_glyph_info_t &info)
else if (unlikely (u == 0x1CEDu))
cat = OT_A;
/* The following take marks in standalone clusters, similar to Avagraha. */
- else if (unlikely (hb_in_ranges (u, 0xA8F2u, 0xA8F7u,
+ else if (unlikely (hb_in_ranges<hb_codepoint_t> (u, 0xA8F2u, 0xA8F7u,
0x1CE9u, 0x1CECu,
0x1CEEu, 0x1CF1u)))
{
cat = OT_Symbol;
- ASSERT_STATIC ((int) INDIC_SYLLABIC_CATEGORY_AVAGRAHA == OT_Symbol);
+ static_assert (((int) INDIC_SYLLABIC_CATEGORY_AVAGRAHA == OT_Symbol), "");
}
+ else if (unlikely (hb_in_range<hb_codepoint_t> (u, 0x17CDu, 0x17D1u) ||
+ u == 0x17CBu || u == 0x17D3u || u == 0x17DDu)) /* Khmer Various signs */
+ {
+ /* These can occur mid-syllable (eg. before matras), even though Unicode marks them as Syllable_Modifier.
+ * https://github.com/roozbehp/unicode-data/issues/5 */
+ cat = OT_M;
+ pos = POS_ABOVE_C;
+ }
+ else if (unlikely (u == 0x0A51u))
+ {
+ /* https://github.com/harfbuzz/harfbuzz/issues/524 */
+ cat = OT_M;
+ pos = POS_BELOW_C;
+ }
+
+ /* According to ScriptExtensions.txt, these Grantha marks may also be used in Tamil,
+ * so the Indic shaper needs to know their categories. */
+ else if (unlikely (u == 0x11301u || u == 0x11303u)) cat = OT_SM;
+ else if (unlikely (u == 0x1133cu)) cat = OT_N;
+
+ else if (unlikely (u == 0x0AFBu)) cat = OT_N; /* https://github.com/harfbuzz/harfbuzz/issues/552 */
+
+ else if (unlikely (u == 0x0980u)) cat = OT_PLACEHOLDER; /* https://github.com/harfbuzz/harfbuzz/issues/538 */
+ else if (unlikely (u == 0x0C80u)) cat = OT_PLACEHOLDER; /* https://github.com/harfbuzz/harfbuzz/pull/623 */
else if (unlikely (u == 0x17C6u)) cat = OT_N; /* Khmer Bindu doesn't like to be repositioned. */
- else if (unlikely (hb_in_range (u, 0x2010u, 0x2011u)))
+ else if (unlikely (hb_in_range<hb_codepoint_t> (u, 0x2010u, 0x2011u)))
cat = OT_PLACEHOLDER;
else if (unlikely (u == 0x25CCu)) cat = OT_DOTTEDCIRCLE;
@@ -210,7 +234,7 @@ set_indic_properties (hb_glyph_info_t &info)
* Re-assign position.
*/
- if ((FLAG_SAFE (cat) & CONSONANT_FLAGS))
+ if ((FLAG_UNSAFE (cat) & CONSONANT_FLAGS))
{
pos = POS_BASE_C;
if (is_ra (u))
@@ -220,7 +244,7 @@ set_indic_properties (hb_glyph_info_t &info)
{
pos = matra_position (u, pos);
}
- else if ((FLAG_SAFE (cat) & (FLAG (OT_SM) | FLAG (OT_VD) | FLAG (OT_A) | FLAG (OT_Symbol))))
+ else if ((FLAG_UNSAFE (cat) & (FLAG (OT_SM) | FLAG (OT_VD) | FLAG (OT_A) | FLAG (OT_Symbol))))
{
pos = POS_SMVD;
}
@@ -411,12 +435,12 @@ collect_features_indic (hb_ot_shape_planner_t *plan)
unsigned int i = 0;
map->add_gsub_pause (initial_reordering);
for (; i < INDIC_BASIC_FEATURES; i++) {
- map->add_feature (indic_features[i].tag, 1, indic_features[i].flags | F_MANUAL_ZWJ);
- map->add_gsub_pause (NULL);
+ map->add_feature (indic_features[i].tag, 1, indic_features[i].flags | F_MANUAL_ZWJ | F_MANUAL_ZWNJ);
+ map->add_gsub_pause (nullptr);
}
map->add_gsub_pause (final_reordering);
for (; i < INDIC_NUM_FEATURES; i++) {
- map->add_feature (indic_features[i].tag, 1, indic_features[i].flags | F_MANUAL_ZWJ);
+ map->add_feature (indic_features[i].tag, 1, indic_features[i].flags | F_MANUAL_ZWJ | F_MANUAL_ZWNJ);
}
map->add_global_bool_feature (HB_TAG('c','a','l','t'));
@@ -485,7 +509,7 @@ struct indic_shape_plan_t
/* Our get_nominal_glyph() function needs a font, so we can't get the virama glyph
* during shape planning... Instead, overwrite it here. It's safe. Don't worry! */
- (const_cast<indic_shape_plan_t *> (this))->virama_glyph = glyph;
+ virama_glyph = glyph;
}
*pglyph = glyph;
@@ -495,7 +519,7 @@ struct indic_shape_plan_t
const indic_config_t *config;
bool is_old_spec;
- hb_codepoint_t virama_glyph;
+ mutable hb_codepoint_t virama_glyph;
would_substitute_feature_t rphf;
would_substitute_feature_t pref;
@@ -510,7 +534,7 @@ data_create_indic (const hb_ot_shape_plan_t *plan)
{
indic_shape_plan_t *indic_plan = (indic_shape_plan_t *) calloc (1, sizeof (indic_shape_plan_t));
if (unlikely (!indic_plan))
- return NULL;
+ return nullptr;
indic_plan->config = &indic_configs[0];
for (unsigned int i = 1; i < ARRAY_LENGTH (indic_configs); i++)
@@ -615,6 +639,8 @@ setup_syllables (const hb_ot_shape_plan_t *plan HB_UNUSED,
hb_buffer_t *buffer)
{
find_syllables (buffer);
+ foreach_syllable (buffer, start, end)
+ buffer->unsafe_to_break (start, end);
}
static int
@@ -666,6 +692,21 @@ initial_reordering_consonant_syllable (const hb_ot_shape_plan_t *plan,
const indic_shape_plan_t *indic_plan = (const indic_shape_plan_t *) plan->data;
hb_glyph_info_t *info = buffer->info;
+ /* https://github.com/harfbuzz/harfbuzz/issues/435#issuecomment-335560167
+ * // For compatibility with legacy usage in Kannada,
+ * // Ra+h+ZWJ must behave like Ra+ZWJ+h...
+ */
+ if (buffer->props.script == HB_SCRIPT_KANNADA &&
+ start + 3 <= end &&
+ is_one_of (info[start ], FLAG (OT_Ra)) &&
+ is_one_of (info[start+1], FLAG (OT_H)) &&
+ is_one_of (info[start+2], FLAG (OT_ZWJ)))
+ {
+ buffer->merge_clusters (start+1, start+3);
+ hb_glyph_info_t tmp = info[start+1];
+ info[start+1] = info[start+2];
+ info[start+2] = tmp;
+ }
/* 1. Find base consonant:
*
@@ -673,7 +714,7 @@ initial_reordering_consonant_syllable (const hb_ot_shape_plan_t *plan,
* following algorithm: starting from the end of the syllable, move backwards
* until a consonant is found that does not have a below-base or post-base
* form (post-base forms have to follow below-base forms), or that is not a
- * pre-base reordering Ra, or arrive at the first consonant. The consonant
+ * pre-base-reordering Ra, or arrive at the first consonant. The consonant
* stopped at will be the base.
*
* o If the syllable starts with Ra + Halant (in a script that has Reph)
@@ -744,11 +785,11 @@ initial_reordering_consonant_syllable (const hb_ot_shape_plan_t *plan,
if (info[i].indic_position() == POS_BELOW_C)
seen_below = true;
- /* -> or that is not a pre-base reordering Ra,
+ /* -> or that is not a pre-base-reordering Ra,
*
* IMPLEMENTATION NOTES:
*
- * Our pre-base reordering Ra's are marked POS_POST_C, so will be skipped
+ * Our pre-base-reordering Ra's are marked POS_POST_C, so will be skipped
* by the logic above already.
*/
@@ -831,8 +872,8 @@ initial_reordering_consonant_syllable (const hb_ot_shape_plan_t *plan,
/* 2. Decompose and reorder Matras:
*
- * Each matra and any syllable modifier sign in the cluster are moved to the
- * appropriate position relative to the consonant(s) in the cluster. The
+ * Each matra and any syllable modifier sign in the syllable are moved to the
+ * appropriate position relative to the consonant(s) in the syllable. The
* shaping engine decomposes two- or three-part matras into their constituent
* parts before any repositioning. Matra characters are classified by which
* consonant in a conjunct they have affinity for and are reordered to the
@@ -928,7 +969,7 @@ initial_reordering_consonant_syllable (const hb_ot_shape_plan_t *plan,
indic_position_t last_pos = POS_START;
for (unsigned int i = start; i < end; i++)
{
- if ((FLAG_SAFE (info[i].indic_category()) & (JOINER_FLAGS | FLAG (OT_N) | FLAG (OT_RS) | MEDIAL_FLAGS | HALANT_OR_COENG_FLAGS)))
+ if ((FLAG_UNSAFE (info[i].indic_category()) & (JOINER_FLAGS | FLAG (OT_N) | FLAG (OT_RS) | MEDIAL_FLAGS | HALANT_OR_COENG_FLAGS)))
{
info[i].indic_position() = last_pos;
if (unlikely (info[i].indic_category() == OT_H &&
@@ -1083,7 +1124,7 @@ initial_reordering_consonant_syllable (const hb_ot_shape_plan_t *plan,
unsigned int pref_len = 2;
if (indic_plan->mask_array[PREF] && base + pref_len < end)
{
- /* Find a Halant,Ra sequence and mark it for pre-base reordering processing. */
+ /* Find a Halant,Ra sequence and mark it for pre-base-reordering processing. */
for (unsigned int i = base + 1; i + pref_len - 1 < end; i++) {
hb_codepoint_t glyphs[2];
for (unsigned int j = 0; j < pref_len; j++)
@@ -1258,7 +1299,7 @@ final_reordering_syllable (const hb_ot_shape_plan_t *plan,
/* This function relies heavily on halant glyphs. Lots of ligation
- * and possibly multiplication substitutions happened prior to this
+ * and possibly multiple substitutions happened prior to this
* phase, and that might have messed up our properties. Recover
* from a particular case of that where we're fairly sure that a
* class of OT_H is desired but has been lost. */
@@ -1282,7 +1323,7 @@ final_reordering_syllable (const hb_ot_shape_plan_t *plan,
* After the localized forms and basic shaping forms GSUB features have been
* applied (see below), the shaping engine performs some final glyph
* reordering before applying all the remaining font features to the entire
- * cluster.
+ * syllable.
*/
bool try_pref = !!indic_plan->mask_array[PREF];
@@ -1477,7 +1518,7 @@ final_reordering_syllable (const hb_ot_shape_plan_t *plan,
/* 3. If reph should be repositioned after the main consonant: find the
* first consonant not ligated with main, or find the first
- * consonant that is not a potential pre-base reordering Ra.
+ * consonant that is not a potential pre-base-reordering Ra.
*/
if (reph_pos == REPH_POS_AFTER_MAIN)
{
@@ -1497,8 +1538,8 @@ final_reordering_syllable (const hb_ot_shape_plan_t *plan,
if (reph_pos == REPH_POS_AFTER_SUB)
{
new_reph_pos = base;
- while (new_reph_pos < end &&
- !( FLAG_SAFE (info[new_reph_pos + 1].indic_position()) & (FLAG (POS_POST_C) | FLAG (POS_AFTER_POST) | FLAG (POS_SMVD))))
+ while (new_reph_pos + 1 < end &&
+ !( FLAG_UNSAFE (info[new_reph_pos + 1].indic_position()) & (FLAG (POS_POST_C) | FLAG (POS_AFTER_POST) | FLAG (POS_SMVD))))
new_reph_pos++;
if (new_reph_pos < end)
goto reph_move;
@@ -1566,13 +1607,13 @@ final_reordering_syllable (const hb_ot_shape_plan_t *plan,
}
- /* o Reorder pre-base reordering consonants:
+ /* o Reorder pre-base-reordering consonants:
*
- * If a pre-base reordering consonant is found, reorder it according to
+ * If a pre-base-reordering consonant is found, reorder it according to
* the following rules:
*/
- if (try_pref && base + 1 < end) /* Otherwise there can't be any pre-base reordering Ra. */
+ if (try_pref && base + 1 < end) /* Otherwise there can't be any pre-base-reordering Ra. */
{
for (unsigned int i = base + 1; i < end; i++)
if ((info[i].mask & indic_plan->mask_array[PREF]) != 0)
@@ -1646,11 +1687,15 @@ final_reordering_syllable (const hb_ot_shape_plan_t *plan,
/* Apply 'init' to the Left Matra if it's a word start. */
- if (info[start].indic_position () == POS_PRE_M &&
- (!start ||
- !(FLAG_SAFE (_hb_glyph_info_get_general_category (&info[start - 1])) &
- FLAG_RANGE (HB_UNICODE_GENERAL_CATEGORY_FORMAT, HB_UNICODE_GENERAL_CATEGORY_NON_SPACING_MARK))))
- info[start].mask |= indic_plan->mask_array[INIT];
+ if (info[start].indic_position () == POS_PRE_M)
+ {
+ if (!start ||
+ !(FLAG_UNSAFE (_hb_glyph_info_get_general_category (&info[start - 1])) &
+ FLAG_RANGE (HB_UNICODE_GENERAL_CATEGORY_FORMAT, HB_UNICODE_GENERAL_CATEGORY_NON_SPACING_MARK)))
+ info[start].mask |= indic_plan->mask_array[INIT];
+ else
+ buffer->unsafe_to_break (start - 1, start + 1);
+ }
/*
@@ -1665,8 +1710,8 @@ final_reordering_syllable (const hb_ot_shape_plan_t *plan,
break;
default:
- /* Uniscribe merges the entire cluster... Except for Tamil & Sinhala.
- * This means, half forms are submerged into the main consonants cluster.
+ /* Uniscribe merges the entire syllable into a single cluster... Except for Tamil & Sinhala.
+ * This means, half forms are submerged into the main consonant's cluster.
* This is unnecessary, and makes cursor positioning harder, but that's what
* Uniscribe does. */
buffer->merge_clusters (start, end);
@@ -1738,7 +1783,7 @@ decompose_indic (const hb_ot_shape_normalize_context_t *c,
#endif
}
- if ((ab == 0x0DDAu || hb_in_range (ab, 0x0DDCu, 0x0DDEu)))
+ if ((ab == 0x0DDAu || hb_in_range<hb_codepoint_t> (ab, 0x0DDCu, 0x0DDEu)))
{
/*
* Sinhala split matras... Let the fun begin.
@@ -1803,18 +1848,18 @@ compose_indic (const hb_ot_shape_normalize_context_t *c,
const hb_ot_complex_shaper_t _hb_ot_complex_shaper_indic =
{
- "indic",
collect_features_indic,
override_features_indic,
data_create_indic,
data_destroy_indic,
- NULL, /* preprocess_text */
- NULL, /* postprocess_glyphs */
+ nullptr, /* preprocess_text */
+ nullptr, /* postprocess_glyphs */
HB_OT_SHAPE_NORMALIZATION_MODE_COMPOSED_DIACRITICS_NO_SHORT_CIRCUIT,
decompose_indic,
compose_indic,
setup_masks_indic,
- NULL, /* disable_otl */
+ nullptr, /* disable_otl */
+ nullptr, /* reorder_marks */
HB_OT_SHAPE_ZERO_WIDTH_MARKS_NONE,
false, /* fallback_position */
};
diff --git a/src/3rdparty/harfbuzz-ng/src/hb-ot-shape-complex-myanmar-machine.hh b/src/3rdparty/harfbuzz-ng/src/hb-ot-shape-complex-myanmar-machine.hh
index 29fdf9a1ae..ed87404305 100644
--- a/src/3rdparty/harfbuzz-ng/src/hb-ot-shape-complex-myanmar-machine.hh
+++ b/src/3rdparty/harfbuzz-ng/src/hb-ot-shape-complex-myanmar-machine.hh
@@ -34,197 +34,201 @@
#line 36 "hb-ot-shape-complex-myanmar-machine.hh"
static const unsigned char _myanmar_syllable_machine_trans_keys[] = {
- 1u, 31u, 3u, 30u, 5u, 29u, 5u, 8u, 5u, 29u, 3u, 25u, 5u, 25u, 5u, 25u,
+ 1u, 32u, 3u, 30u, 5u, 29u, 5u, 8u, 5u, 29u, 3u, 25u, 5u, 25u, 5u, 25u,
3u, 29u, 3u, 29u, 3u, 29u, 3u, 29u, 1u, 16u, 3u, 29u, 3u, 29u, 3u, 29u,
3u, 29u, 3u, 29u, 3u, 29u, 3u, 29u, 3u, 29u, 3u, 29u, 5u, 29u, 5u, 8u,
5u, 29u, 3u, 25u, 5u, 25u, 5u, 25u, 3u, 29u, 3u, 29u, 3u, 29u, 3u, 29u,
- 3u, 30u, 3u, 29u, 1u, 30u, 3u, 29u, 3u, 29u, 3u, 29u, 3u, 29u, 3u, 29u,
- 3u, 29u, 3u, 29u, 3u, 29u, 3u, 29u, 8u, 8u, 0
+ 3u, 30u, 3u, 29u, 1u, 32u, 3u, 29u, 3u, 29u, 3u, 29u, 3u, 29u, 3u, 29u,
+ 3u, 29u, 3u, 29u, 3u, 29u, 3u, 29u, 1u, 32u, 8u, 8u, 0
};
static const char _myanmar_syllable_machine_key_spans[] = {
- 31, 28, 25, 4, 25, 23, 21, 21,
+ 32, 28, 25, 4, 25, 23, 21, 21,
27, 27, 27, 27, 16, 27, 27, 27,
27, 27, 27, 27, 27, 27, 25, 4,
25, 23, 21, 21, 27, 27, 27, 27,
- 28, 27, 30, 27, 27, 27, 27, 27,
- 27, 27, 27, 27, 1
+ 28, 27, 32, 27, 27, 27, 27, 27,
+ 27, 27, 27, 27, 32, 1
};
static const short _myanmar_syllable_machine_index_offsets[] = {
- 0, 32, 61, 87, 92, 118, 142, 164,
- 186, 214, 242, 270, 298, 315, 343, 371,
- 399, 427, 455, 483, 511, 539, 567, 593,
- 598, 624, 648, 670, 692, 720, 748, 776,
- 804, 833, 861, 892, 920, 948, 976, 1004,
- 1032, 1060, 1088, 1116, 1144
+ 0, 33, 62, 88, 93, 119, 143, 165,
+ 187, 215, 243, 271, 299, 316, 344, 372,
+ 400, 428, 456, 484, 512, 540, 568, 594,
+ 599, 625, 649, 671, 693, 721, 749, 777,
+ 805, 834, 862, 895, 923, 951, 979, 1007,
+ 1035, 1063, 1091, 1119, 1147, 1180
};
static const char _myanmar_syllable_machine_indicies[] = {
1, 1, 2, 3, 4, 4, 0, 5,
0, 6, 1, 0, 0, 0, 0, 7,
- 0, 8, 1, 0, 9, 10, 11, 12,
- 13, 14, 15, 16, 17, 18, 19, 0,
- 21, 22, 23, 23, 20, 24, 20, 25,
- 20, 20, 20, 20, 20, 20, 20, 26,
- 20, 20, 27, 28, 29, 30, 31, 32,
- 33, 34, 35, 36, 20, 23, 23, 20,
- 24, 20, 20, 20, 20, 20, 20, 20,
- 20, 20, 37, 20, 20, 20, 20, 20,
- 20, 31, 20, 20, 20, 35, 20, 23,
- 23, 20, 24, 20, 23, 23, 20, 24,
- 20, 20, 20, 20, 20, 20, 20, 20,
- 20, 20, 20, 20, 20, 20, 20, 20,
- 31, 20, 20, 20, 35, 20, 38, 20,
- 23, 23, 20, 24, 20, 31, 20, 20,
- 20, 20, 20, 20, 20, 39, 20, 20,
- 20, 20, 20, 20, 31, 20, 23, 23,
- 20, 24, 20, 20, 20, 20, 20, 20,
- 20, 20, 20, 39, 20, 20, 20, 20,
- 20, 20, 31, 20, 23, 23, 20, 24,
- 20, 20, 20, 20, 20, 20, 20, 20,
- 20, 20, 20, 20, 20, 20, 20, 20,
- 31, 20, 21, 20, 23, 23, 20, 24,
- 20, 25, 20, 20, 20, 20, 20, 20,
- 20, 40, 20, 20, 40, 20, 20, 20,
- 31, 41, 20, 20, 35, 20, 21, 20,
- 23, 23, 20, 24, 20, 25, 20, 20,
- 20, 20, 20, 20, 20, 20, 20, 20,
- 20, 20, 20, 20, 31, 20, 20, 20,
- 35, 20, 21, 20, 23, 23, 20, 24,
- 20, 25, 20, 20, 20, 20, 20, 20,
- 20, 40, 20, 20, 20, 20, 20, 20,
- 31, 41, 20, 20, 35, 20, 21, 20,
- 23, 23, 20, 24, 20, 25, 20, 20,
- 20, 20, 20, 20, 20, 20, 20, 20,
- 20, 20, 20, 20, 31, 41, 20, 20,
- 35, 20, 1, 1, 20, 20, 20, 20,
- 20, 20, 20, 20, 20, 20, 20, 20,
- 20, 1, 20, 21, 20, 23, 23, 20,
- 24, 20, 25, 20, 20, 20, 20, 20,
- 20, 20, 26, 20, 20, 27, 28, 29,
- 30, 31, 32, 33, 34, 35, 20, 21,
- 20, 23, 23, 20, 24, 20, 25, 20,
- 20, 20, 20, 20, 20, 20, 34, 20,
- 20, 20, 20, 20, 20, 31, 32, 33,
- 34, 35, 20, 21, 20, 23, 23, 20,
- 24, 20, 25, 20, 20, 20, 20, 20,
- 20, 20, 20, 20, 20, 20, 20, 20,
- 20, 31, 32, 33, 34, 35, 20, 21,
- 20, 23, 23, 20, 24, 20, 25, 20,
- 20, 20, 20, 20, 20, 20, 20, 20,
- 20, 20, 20, 20, 20, 31, 32, 33,
- 20, 35, 20, 21, 20, 23, 23, 20,
- 24, 20, 25, 20, 20, 20, 20, 20,
- 20, 20, 20, 20, 20, 20, 20, 20,
- 20, 31, 20, 33, 20, 35, 20, 21,
- 20, 23, 23, 20, 24, 20, 25, 20,
- 20, 20, 20, 20, 20, 20, 34, 20,
- 20, 27, 20, 29, 20, 31, 32, 33,
- 34, 35, 20, 21, 20, 23, 23, 20,
- 24, 20, 25, 20, 20, 20, 20, 20,
- 20, 20, 34, 20, 20, 27, 20, 20,
- 20, 31, 32, 33, 34, 35, 20, 21,
- 20, 23, 23, 20, 24, 20, 25, 20,
- 20, 20, 20, 20, 20, 20, 34, 20,
- 20, 27, 28, 29, 20, 31, 32, 33,
- 34, 35, 20, 21, 22, 23, 23, 20,
- 24, 20, 25, 20, 20, 20, 20, 20,
- 20, 20, 26, 20, 20, 27, 28, 29,
- 30, 31, 32, 33, 34, 35, 20, 3,
- 3, 42, 5, 42, 42, 42, 42, 42,
- 42, 42, 42, 42, 43, 42, 42, 42,
- 42, 42, 42, 13, 42, 42, 42, 17,
- 42, 3, 3, 42, 5, 42, 3, 3,
- 42, 5, 42, 42, 42, 42, 42, 42,
- 42, 42, 42, 42, 42, 42, 42, 42,
- 42, 42, 13, 42, 42, 42, 17, 42,
- 44, 42, 3, 3, 42, 5, 42, 13,
- 42, 42, 42, 42, 42, 42, 42, 45,
- 42, 42, 42, 42, 42, 42, 13, 42,
- 3, 3, 42, 5, 42, 42, 42, 42,
- 42, 42, 42, 42, 42, 45, 42, 42,
- 42, 42, 42, 42, 13, 42, 3, 3,
- 42, 5, 42, 42, 42, 42, 42, 42,
- 42, 42, 42, 42, 42, 42, 42, 42,
- 42, 42, 13, 42, 2, 42, 3, 3,
- 42, 5, 42, 6, 42, 42, 42, 42,
- 42, 42, 42, 46, 42, 42, 46, 42,
- 42, 42, 13, 47, 42, 42, 17, 42,
- 2, 42, 3, 3, 42, 5, 42, 6,
- 42, 42, 42, 42, 42, 42, 42, 42,
- 42, 42, 42, 42, 42, 42, 13, 42,
- 42, 42, 17, 42, 2, 42, 3, 3,
- 42, 5, 42, 6, 42, 42, 42, 42,
- 42, 42, 42, 46, 42, 42, 42, 42,
- 42, 42, 13, 47, 42, 42, 17, 42,
- 2, 42, 3, 3, 42, 5, 42, 6,
- 42, 42, 42, 42, 42, 42, 42, 42,
- 42, 42, 42, 42, 42, 42, 13, 47,
- 42, 42, 17, 42, 21, 22, 23, 23,
- 20, 24, 20, 25, 20, 20, 20, 20,
- 20, 20, 20, 48, 20, 20, 27, 28,
+ 0, 8, 9, 0, 10, 11, 12, 13,
+ 14, 15, 16, 17, 18, 19, 20, 1,
+ 0, 22, 23, 24, 24, 21, 25, 21,
+ 26, 21, 21, 21, 21, 21, 21, 21,
+ 27, 21, 21, 28, 29, 30, 31, 32,
+ 33, 34, 35, 36, 37, 21, 24, 24,
+ 21, 25, 21, 21, 21, 21, 21, 21,
+ 21, 21, 21, 38, 21, 21, 21, 21,
+ 21, 21, 32, 21, 21, 21, 36, 21,
+ 24, 24, 21, 25, 21, 24, 24, 21,
+ 25, 21, 21, 21, 21, 21, 21, 21,
+ 21, 21, 21, 21, 21, 21, 21, 21,
+ 21, 32, 21, 21, 21, 36, 21, 39,
+ 21, 24, 24, 21, 25, 21, 32, 21,
+ 21, 21, 21, 21, 21, 21, 40, 21,
+ 21, 21, 21, 21, 21, 32, 21, 24,
+ 24, 21, 25, 21, 21, 21, 21, 21,
+ 21, 21, 21, 21, 40, 21, 21, 21,
+ 21, 21, 21, 32, 21, 24, 24, 21,
+ 25, 21, 21, 21, 21, 21, 21, 21,
+ 21, 21, 21, 21, 21, 21, 21, 21,
+ 21, 32, 21, 22, 21, 24, 24, 21,
+ 25, 21, 26, 21, 21, 21, 21, 21,
+ 21, 21, 41, 21, 21, 41, 21, 21,
+ 21, 32, 42, 21, 21, 36, 21, 22,
+ 21, 24, 24, 21, 25, 21, 26, 21,
+ 21, 21, 21, 21, 21, 21, 21, 21,
+ 21, 21, 21, 21, 21, 32, 21, 21,
+ 21, 36, 21, 22, 21, 24, 24, 21,
+ 25, 21, 26, 21, 21, 21, 21, 21,
+ 21, 21, 41, 21, 21, 21, 21, 21,
+ 21, 32, 42, 21, 21, 36, 21, 22,
+ 21, 24, 24, 21, 25, 21, 26, 21,
+ 21, 21, 21, 21, 21, 21, 21, 21,
+ 21, 21, 21, 21, 21, 32, 42, 21,
+ 21, 36, 21, 1, 1, 21, 21, 21,
+ 21, 21, 21, 21, 21, 21, 21, 21,
+ 21, 21, 1, 21, 22, 21, 24, 24,
+ 21, 25, 21, 26, 21, 21, 21, 21,
+ 21, 21, 21, 27, 21, 21, 28, 29,
+ 30, 31, 32, 33, 34, 35, 36, 21,
+ 22, 21, 24, 24, 21, 25, 21, 26,
+ 21, 21, 21, 21, 21, 21, 21, 35,
+ 21, 21, 21, 21, 21, 21, 32, 33,
+ 34, 35, 36, 21, 22, 21, 24, 24,
+ 21, 25, 21, 26, 21, 21, 21, 21,
+ 21, 21, 21, 21, 21, 21, 21, 21,
+ 21, 21, 32, 33, 34, 35, 36, 21,
+ 22, 21, 24, 24, 21, 25, 21, 26,
+ 21, 21, 21, 21, 21, 21, 21, 21,
+ 21, 21, 21, 21, 21, 21, 32, 33,
+ 34, 21, 36, 21, 22, 21, 24, 24,
+ 21, 25, 21, 26, 21, 21, 21, 21,
+ 21, 21, 21, 21, 21, 21, 21, 21,
+ 21, 21, 32, 21, 34, 21, 36, 21,
+ 22, 21, 24, 24, 21, 25, 21, 26,
+ 21, 21, 21, 21, 21, 21, 21, 35,
+ 21, 21, 28, 21, 30, 21, 32, 33,
+ 34, 35, 36, 21, 22, 21, 24, 24,
+ 21, 25, 21, 26, 21, 21, 21, 21,
+ 21, 21, 21, 35, 21, 21, 28, 21,
+ 21, 21, 32, 33, 34, 35, 36, 21,
+ 22, 21, 24, 24, 21, 25, 21, 26,
+ 21, 21, 21, 21, 21, 21, 21, 35,
+ 21, 21, 28, 29, 30, 21, 32, 33,
+ 34, 35, 36, 21, 22, 23, 24, 24,
+ 21, 25, 21, 26, 21, 21, 21, 21,
+ 21, 21, 21, 27, 21, 21, 28, 29,
+ 30, 31, 32, 33, 34, 35, 36, 21,
+ 3, 3, 43, 5, 43, 43, 43, 43,
+ 43, 43, 43, 43, 43, 44, 43, 43,
+ 43, 43, 43, 43, 14, 43, 43, 43,
+ 18, 43, 3, 3, 43, 5, 43, 3,
+ 3, 43, 5, 43, 43, 43, 43, 43,
+ 43, 43, 43, 43, 43, 43, 43, 43,
+ 43, 43, 43, 14, 43, 43, 43, 18,
+ 43, 45, 43, 3, 3, 43, 5, 43,
+ 14, 43, 43, 43, 43, 43, 43, 43,
+ 46, 43, 43, 43, 43, 43, 43, 14,
+ 43, 3, 3, 43, 5, 43, 43, 43,
+ 43, 43, 43, 43, 43, 43, 46, 43,
+ 43, 43, 43, 43, 43, 14, 43, 3,
+ 3, 43, 5, 43, 43, 43, 43, 43,
+ 43, 43, 43, 43, 43, 43, 43, 43,
+ 43, 43, 43, 14, 43, 2, 43, 3,
+ 3, 43, 5, 43, 6, 43, 43, 43,
+ 43, 43, 43, 43, 47, 43, 43, 47,
+ 43, 43, 43, 14, 48, 43, 43, 18,
+ 43, 2, 43, 3, 3, 43, 5, 43,
+ 6, 43, 43, 43, 43, 43, 43, 43,
+ 43, 43, 43, 43, 43, 43, 43, 14,
+ 43, 43, 43, 18, 43, 2, 43, 3,
+ 3, 43, 5, 43, 6, 43, 43, 43,
+ 43, 43, 43, 43, 47, 43, 43, 43,
+ 43, 43, 43, 14, 48, 43, 43, 18,
+ 43, 2, 43, 3, 3, 43, 5, 43,
+ 6, 43, 43, 43, 43, 43, 43, 43,
+ 43, 43, 43, 43, 43, 43, 43, 14,
+ 48, 43, 43, 18, 43, 22, 23, 24,
+ 24, 21, 25, 21, 26, 21, 21, 21,
+ 21, 21, 21, 21, 49, 21, 21, 28,
29, 30, 31, 32, 33, 34, 35, 36,
- 20, 21, 49, 23, 23, 20, 24, 20,
- 25, 20, 20, 20, 20, 20, 20, 20,
- 26, 20, 20, 27, 28, 29, 30, 31,
- 32, 33, 34, 35, 20, 1, 1, 2,
- 3, 3, 3, 42, 5, 42, 6, 1,
- 42, 42, 42, 42, 1, 42, 8, 1,
- 42, 9, 10, 11, 12, 13, 14, 15,
- 16, 17, 18, 42, 2, 42, 3, 3,
- 42, 5, 42, 6, 42, 42, 42, 42,
- 42, 42, 42, 8, 42, 42, 9, 10,
- 11, 12, 13, 14, 15, 16, 17, 42,
- 2, 42, 3, 3, 42, 5, 42, 6,
- 42, 42, 42, 42, 42, 42, 42, 16,
- 42, 42, 42, 42, 42, 42, 13, 14,
- 15, 16, 17, 42, 2, 42, 3, 3,
- 42, 5, 42, 6, 42, 42, 42, 42,
- 42, 42, 42, 42, 42, 42, 42, 42,
- 42, 42, 13, 14, 15, 16, 17, 42,
- 2, 42, 3, 3, 42, 5, 42, 6,
- 42, 42, 42, 42, 42, 42, 42, 42,
- 42, 42, 42, 42, 42, 42, 13, 14,
- 15, 42, 17, 42, 2, 42, 3, 3,
- 42, 5, 42, 6, 42, 42, 42, 42,
- 42, 42, 42, 42, 42, 42, 42, 42,
- 42, 42, 13, 42, 15, 42, 17, 42,
- 2, 42, 3, 3, 42, 5, 42, 6,
- 42, 42, 42, 42, 42, 42, 42, 16,
- 42, 42, 9, 42, 11, 42, 13, 14,
- 15, 16, 17, 42, 2, 42, 3, 3,
- 42, 5, 42, 6, 42, 42, 42, 42,
- 42, 42, 42, 16, 42, 42, 9, 42,
- 42, 42, 13, 14, 15, 16, 17, 42,
- 2, 42, 3, 3, 42, 5, 42, 6,
- 42, 42, 42, 42, 42, 42, 42, 16,
- 42, 42, 9, 10, 11, 42, 13, 14,
- 15, 16, 17, 42, 2, 3, 3, 3,
- 42, 5, 42, 6, 42, 42, 42, 42,
- 42, 42, 42, 8, 42, 42, 9, 10,
- 11, 12, 13, 14, 15, 16, 17, 42,
- 51, 50, 0
+ 37, 21, 22, 50, 24, 24, 21, 25,
+ 21, 26, 21, 21, 21, 21, 21, 21,
+ 21, 27, 21, 21, 28, 29, 30, 31,
+ 32, 33, 34, 35, 36, 21, 1, 1,
+ 2, 3, 3, 3, 43, 5, 43, 6,
+ 1, 43, 43, 43, 43, 1, 43, 8,
+ 43, 43, 10, 11, 12, 13, 14, 15,
+ 16, 17, 18, 19, 43, 1, 43, 2,
+ 43, 3, 3, 43, 5, 43, 6, 43,
+ 43, 43, 43, 43, 43, 43, 8, 43,
+ 43, 10, 11, 12, 13, 14, 15, 16,
+ 17, 18, 43, 2, 43, 3, 3, 43,
+ 5, 43, 6, 43, 43, 43, 43, 43,
+ 43, 43, 17, 43, 43, 43, 43, 43,
+ 43, 14, 15, 16, 17, 18, 43, 2,
+ 43, 3, 3, 43, 5, 43, 6, 43,
+ 43, 43, 43, 43, 43, 43, 43, 43,
+ 43, 43, 43, 43, 43, 14, 15, 16,
+ 17, 18, 43, 2, 43, 3, 3, 43,
+ 5, 43, 6, 43, 43, 43, 43, 43,
+ 43, 43, 43, 43, 43, 43, 43, 43,
+ 43, 14, 15, 16, 43, 18, 43, 2,
+ 43, 3, 3, 43, 5, 43, 6, 43,
+ 43, 43, 43, 43, 43, 43, 43, 43,
+ 43, 43, 43, 43, 43, 14, 43, 16,
+ 43, 18, 43, 2, 43, 3, 3, 43,
+ 5, 43, 6, 43, 43, 43, 43, 43,
+ 43, 43, 17, 43, 43, 10, 43, 12,
+ 43, 14, 15, 16, 17, 18, 43, 2,
+ 43, 3, 3, 43, 5, 43, 6, 43,
+ 43, 43, 43, 43, 43, 43, 17, 43,
+ 43, 10, 43, 43, 43, 14, 15, 16,
+ 17, 18, 43, 2, 43, 3, 3, 43,
+ 5, 43, 6, 43, 43, 43, 43, 43,
+ 43, 43, 17, 43, 43, 10, 11, 12,
+ 43, 14, 15, 16, 17, 18, 43, 2,
+ 3, 3, 3, 43, 5, 43, 6, 43,
+ 43, 43, 43, 43, 43, 43, 8, 43,
+ 43, 10, 11, 12, 13, 14, 15, 16,
+ 17, 18, 43, 1, 1, 51, 51, 51,
+ 51, 51, 51, 51, 51, 1, 51, 51,
+ 51, 51, 1, 51, 51, 51, 51, 51,
+ 51, 51, 51, 51, 51, 51, 51, 51,
+ 51, 51, 1, 51, 52, 51, 0
};
static const char _myanmar_syllable_machine_trans_targs[] = {
0, 1, 22, 0, 0, 23, 29, 32,
- 35, 36, 40, 41, 42, 25, 38, 39,
- 37, 28, 43, 44, 0, 2, 12, 0,
- 3, 9, 13, 14, 18, 19, 20, 5,
- 16, 17, 15, 8, 21, 4, 6, 7,
- 10, 11, 0, 24, 26, 27, 30, 31,
- 33, 34, 0, 0
+ 35, 44, 36, 40, 41, 42, 25, 38,
+ 39, 37, 28, 43, 45, 0, 2, 12,
+ 0, 3, 9, 13, 14, 18, 19, 20,
+ 5, 16, 17, 15, 8, 21, 4, 6,
+ 7, 10, 11, 0, 24, 26, 27, 30,
+ 31, 33, 34, 0, 0
};
static const char _myanmar_syllable_machine_trans_actions[] = {
3, 0, 0, 4, 5, 0, 0, 0,
0, 0, 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 6, 0, 0, 7,
- 0, 0, 0, 0, 0, 0, 0, 0,
+ 0, 0, 0, 0, 0, 6, 0, 0,
+ 7, 0, 0, 0, 0, 0, 0, 0,
0, 0, 0, 0, 0, 0, 0, 0,
- 0, 0, 8, 0, 0, 0, 0, 0,
- 0, 0, 9, 10
+ 0, 0, 0, 8, 0, 0, 0, 0,
+ 0, 0, 0, 9, 10
};
static const char _myanmar_syllable_machine_to_state_actions[] = {
@@ -233,7 +237,7 @@ static const char _myanmar_syllable_machine_to_state_actions[] = {
0, 0, 0, 0, 0, 0, 0, 0,
0, 0, 0, 0, 0, 0, 0, 0,
0, 0, 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0
+ 0, 0, 0, 0, 0, 0
};
static const char _myanmar_syllable_machine_from_state_actions[] = {
@@ -242,16 +246,16 @@ static const char _myanmar_syllable_machine_from_state_actions[] = {
0, 0, 0, 0, 0, 0, 0, 0,
0, 0, 0, 0, 0, 0, 0, 0,
0, 0, 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0
+ 0, 0, 0, 0, 0, 0
};
static const short _myanmar_syllable_machine_eof_trans[] = {
- 0, 21, 21, 21, 21, 21, 21, 21,
- 21, 21, 21, 21, 21, 21, 21, 21,
- 21, 21, 21, 21, 21, 21, 43, 43,
- 43, 43, 43, 43, 43, 43, 43, 43,
- 21, 21, 43, 43, 43, 43, 43, 43,
- 43, 43, 43, 43, 51
+ 0, 22, 22, 22, 22, 22, 22, 22,
+ 22, 22, 22, 22, 22, 22, 22, 22,
+ 22, 22, 22, 22, 22, 22, 44, 44,
+ 44, 44, 44, 44, 44, 44, 44, 44,
+ 22, 22, 44, 44, 44, 44, 44, 44,
+ 44, 44, 44, 44, 52, 52
};
static const int myanmar_syllable_machine_start = 0;
@@ -265,7 +269,7 @@ static const int myanmar_syllable_machine_en_main = 0;
-#line 93 "hb-ot-shape-complex-myanmar-machine.rl"
+#line 94 "hb-ot-shape-complex-myanmar-machine.rl"
#define found_syllable(syllable_type) \
@@ -285,7 +289,7 @@ find_syllables (hb_buffer_t *buffer)
int cs;
hb_glyph_info_t *info = buffer->info;
-#line 289 "hb-ot-shape-complex-myanmar-machine.hh"
+#line 293 "hb-ot-shape-complex-myanmar-machine.hh"
{
cs = myanmar_syllable_machine_start;
ts = 0;
@@ -293,7 +297,7 @@ find_syllables (hb_buffer_t *buffer)
act = 0;
}
-#line 114 "hb-ot-shape-complex-myanmar-machine.rl"
+#line 115 "hb-ot-shape-complex-myanmar-machine.rl"
p = 0;
@@ -302,7 +306,7 @@ find_syllables (hb_buffer_t *buffer)
unsigned int last = 0;
unsigned int syllable_serial = 1;
-#line 306 "hb-ot-shape-complex-myanmar-machine.hh"
+#line 310 "hb-ot-shape-complex-myanmar-machine.hh"
{
int _slen;
int _trans;
@@ -316,7 +320,7 @@ _resume:
#line 1 "NONE"
{ts = p;}
break;
-#line 320 "hb-ot-shape-complex-myanmar-machine.hh"
+#line 324 "hb-ot-shape-complex-myanmar-machine.hh"
}
_keys = _myanmar_syllable_machine_trans_keys + (cs<<1);
@@ -335,38 +339,38 @@ _eof_trans:
switch ( _myanmar_syllable_machine_trans_actions[_trans] ) {
case 7:
-#line 85 "hb-ot-shape-complex-myanmar-machine.rl"
+#line 86 "hb-ot-shape-complex-myanmar-machine.rl"
{te = p+1;{ found_syllable (consonant_syllable); }}
break;
case 5:
-#line 86 "hb-ot-shape-complex-myanmar-machine.rl"
+#line 87 "hb-ot-shape-complex-myanmar-machine.rl"
{te = p+1;{ found_syllable (non_myanmar_cluster); }}
break;
case 10:
-#line 87 "hb-ot-shape-complex-myanmar-machine.rl"
+#line 88 "hb-ot-shape-complex-myanmar-machine.rl"
{te = p+1;{ found_syllable (punctuation_cluster); }}
break;
case 4:
-#line 88 "hb-ot-shape-complex-myanmar-machine.rl"
+#line 89 "hb-ot-shape-complex-myanmar-machine.rl"
{te = p+1;{ found_syllable (broken_cluster); }}
break;
case 3:
-#line 89 "hb-ot-shape-complex-myanmar-machine.rl"
+#line 90 "hb-ot-shape-complex-myanmar-machine.rl"
{te = p+1;{ found_syllable (non_myanmar_cluster); }}
break;
case 6:
-#line 85 "hb-ot-shape-complex-myanmar-machine.rl"
+#line 86 "hb-ot-shape-complex-myanmar-machine.rl"
{te = p;p--;{ found_syllable (consonant_syllable); }}
break;
case 8:
-#line 88 "hb-ot-shape-complex-myanmar-machine.rl"
+#line 89 "hb-ot-shape-complex-myanmar-machine.rl"
{te = p;p--;{ found_syllable (broken_cluster); }}
break;
case 9:
-#line 89 "hb-ot-shape-complex-myanmar-machine.rl"
+#line 90 "hb-ot-shape-complex-myanmar-machine.rl"
{te = p;p--;{ found_syllable (non_myanmar_cluster); }}
break;
-#line 370 "hb-ot-shape-complex-myanmar-machine.hh"
+#line 374 "hb-ot-shape-complex-myanmar-machine.hh"
}
_again:
@@ -375,7 +379,7 @@ _again:
#line 1 "NONE"
{ts = 0;}
break;
-#line 379 "hb-ot-shape-complex-myanmar-machine.hh"
+#line 383 "hb-ot-shape-complex-myanmar-machine.hh"
}
if ( ++p != pe )
@@ -391,7 +395,7 @@ _again:
}
-#line 123 "hb-ot-shape-complex-myanmar-machine.rl"
+#line 124 "hb-ot-shape-complex-myanmar-machine.rl"
}
diff --git a/src/3rdparty/harfbuzz-ng/src/hb-ot-shape-complex-myanmar.cc b/src/3rdparty/harfbuzz-ng/src/hb-ot-shape-complex-myanmar.cc
index bb68622e2a..5ea1dbff27 100644
--- a/src/3rdparty/harfbuzz-ng/src/hb-ot-shape-complex-myanmar.cc
+++ b/src/3rdparty/harfbuzz-ng/src/hb-ot-shape-complex-myanmar.cc
@@ -103,7 +103,7 @@ collect_features_myanmar (hb_ot_shape_planner_t *plan)
for (unsigned int i = 0; i < ARRAY_LENGTH (basic_features); i++)
{
map->add_feature (basic_features[i], 1, F_GLOBAL | F_MANUAL_ZWJ);
- map->add_gsub_pause (NULL);
+ map->add_gsub_pause (nullptr);
}
map->add_gsub_pause (final_reordering);
for (unsigned int i = 0; i < ARRAY_LENGTH (other_features); i++)
@@ -130,8 +130,7 @@ enum syllable_type_t {
/* Note: This enum is duplicated in the -machine.rl source file.
* Not sure how to avoid duplication. */
enum myanmar_category_t {
- OT_As = 18, /* Asat */
- OT_D = 19, /* Digits except zero */
+ OT_As = 18, /* Asat */
OT_D0 = 20, /* Digit zero */
OT_DB = OT_N, /* Dot below */
OT_GB = OT_PLACEHOLDER,
@@ -145,7 +144,8 @@ enum myanmar_category_t {
OT_VPre = 28,
OT_VPst = 29,
OT_VS = 30, /* Variation selectors */
- OT_P = 31 /* Punctuation */
+ OT_P = 31, /* Punctuation */
+ OT_D = 32, /* Digits except zero */
};
@@ -154,7 +154,7 @@ is_one_of (const hb_glyph_info_t &info, unsigned int flags)
{
/* If it ligated, all bets are off. */
if (_hb_glyph_info_ligated (&info)) return false;
- return !!(FLAG_SAFE (info.myanmar_category()) & flags);
+ return !!(FLAG_UNSAFE (info.myanmar_category()) & flags);
}
static inline bool
@@ -175,7 +175,7 @@ set_myanmar_properties (hb_glyph_info_t &info)
/* Myanmar
* http://www.microsoft.com/typography/OpenTypeDev/myanmar/intro.htm#analyze
*/
- if (unlikely (hb_in_range (u, 0xFE00u, 0xFE0Fu)))
+ if (unlikely (hb_in_range<hb_codepoint_t> (u, 0xFE00u, 0xFE0Fu)))
cat = (indic_category_t) OT_VS;
switch (u)
@@ -297,6 +297,8 @@ setup_syllables (const hb_ot_shape_plan_t *plan HB_UNUSED,
hb_buffer_t *buffer)
{
find_syllables (buffer);
+ foreach_syllable (buffer, start, end)
+ buffer->unsafe_to_break (start, end);
}
static int
@@ -510,36 +512,36 @@ final_reordering (const hb_ot_shape_plan_t *plan,
* generic shaper, except that it zeros mark advances GDEF_LATE. */
const hb_ot_complex_shaper_t _hb_ot_complex_shaper_myanmar_old =
{
- "default",
- NULL, /* collect_features */
- NULL, /* override_features */
- NULL, /* data_create */
- NULL, /* data_destroy */
- NULL, /* preprocess_text */
- NULL, /* postprocess_glyphs */
+ nullptr, /* collect_features */
+ nullptr, /* override_features */
+ nullptr, /* data_create */
+ nullptr, /* data_destroy */
+ nullptr, /* preprocess_text */
+ nullptr, /* postprocess_glyphs */
HB_OT_SHAPE_NORMALIZATION_MODE_DEFAULT,
- NULL, /* decompose */
- NULL, /* compose */
- NULL, /* setup_masks */
- NULL, /* disable_otl */
+ nullptr, /* decompose */
+ nullptr, /* compose */
+ nullptr, /* setup_masks */
+ nullptr, /* disable_otl */
+ nullptr, /* reorder_marks */
HB_OT_SHAPE_ZERO_WIDTH_MARKS_BY_GDEF_LATE,
true, /* fallback_position */
};
const hb_ot_complex_shaper_t _hb_ot_complex_shaper_myanmar =
{
- "myanmar",
collect_features_myanmar,
override_features_myanmar,
- NULL, /* data_create */
- NULL, /* data_destroy */
- NULL, /* preprocess_text */
- NULL, /* postprocess_glyphs */
+ nullptr, /* data_create */
+ nullptr, /* data_destroy */
+ nullptr, /* preprocess_text */
+ nullptr, /* postprocess_glyphs */
HB_OT_SHAPE_NORMALIZATION_MODE_COMPOSED_DIACRITICS_NO_SHORT_CIRCUIT,
- NULL, /* decompose */
- NULL, /* compose */
+ nullptr, /* decompose */
+ nullptr, /* compose */
setup_masks_myanmar,
- NULL, /* disable_otl */
+ nullptr, /* disable_otl */
+ nullptr, /* reorder_marks */
HB_OT_SHAPE_ZERO_WIDTH_MARKS_BY_GDEF_EARLY,
false, /* fallback_position */
};
diff --git a/src/3rdparty/harfbuzz-ng/src/hb-ot-shape-complex-private.hh b/src/3rdparty/harfbuzz-ng/src/hb-ot-shape-complex-private.hh
index 39572dfe00..fb2f61157a 100644
--- a/src/3rdparty/harfbuzz-ng/src/hb-ot-shape-complex-private.hh
+++ b/src/3rdparty/harfbuzz-ng/src/hb-ot-shape-complex-private.hh
@@ -39,6 +39,8 @@
#define complex_var_u8_1() var2.u8[3]
+#define HB_OT_SHAPE_COMPLEX_MAX_COMBINING_MARKS 32
+
enum hb_ot_shape_zero_width_marks_type_t {
HB_OT_SHAPE_ZERO_WIDTH_MARKS_NONE,
HB_OT_SHAPE_ZERO_WIDTH_MARKS_BY_GDEF_EARLY,
@@ -63,12 +65,10 @@ enum hb_ot_shape_zero_width_marks_type_t {
struct hb_ot_complex_shaper_t
{
- char name[8];
-
/* collect_features()
* Called during shape_plan().
* Shapers should use plan->map to add their features and callbacks.
- * May be NULL.
+ * May be nullptr.
*/
void (*collect_features) (hb_ot_shape_planner_t *plan);
@@ -76,7 +76,7 @@ struct hb_ot_complex_shaper_t
* Called during shape_plan().
* Shapers should use plan->map to override features and add callbacks after
* common features are added.
- * May be NULL.
+ * May be nullptr.
*/
void (*override_features) (hb_ot_shape_planner_t *plan);
@@ -84,15 +84,15 @@ struct hb_ot_complex_shaper_t
/* data_create()
* Called at the end of shape_plan().
* Whatever shapers return will be accessible through plan->data later.
- * If NULL is returned, means a plan failure.
+ * If nullptr is returned, means a plan failure.
*/
void *(*data_create) (const hb_ot_shape_plan_t *plan);
/* data_destroy()
* Called when the shape_plan is being destroyed.
* plan->data is passed here for destruction.
- * If NULL is returned, means a plan failure.
- * May be NULL.
+ * If nullptr is returned, means a plan failure.
+ * May be nullptr.
*/
void (*data_destroy) (void *data);
@@ -100,7 +100,7 @@ struct hb_ot_complex_shaper_t
/* preprocess_text()
* Called during shape().
* Shapers can use to modify text before shaping starts.
- * May be NULL.
+ * May be nullptr.
*/
void (*preprocess_text) (const hb_ot_shape_plan_t *plan,
hb_buffer_t *buffer,
@@ -109,7 +109,7 @@ struct hb_ot_complex_shaper_t
/* postprocess_glyphs()
* Called during shape().
* Shapers can use to modify glyphs after shaping ends.
- * May be NULL.
+ * May be nullptr.
*/
void (*postprocess_glyphs) (const hb_ot_shape_plan_t *plan,
hb_buffer_t *buffer,
@@ -120,7 +120,7 @@ struct hb_ot_complex_shaper_t
/* decompose()
* Called during shape()'s normalization.
- * May be NULL.
+ * May be nullptr.
*/
bool (*decompose) (const hb_ot_shape_normalize_context_t *c,
hb_codepoint_t ab,
@@ -129,7 +129,7 @@ struct hb_ot_complex_shaper_t
/* compose()
* Called during shape()'s normalization.
- * May be NULL.
+ * May be nullptr.
*/
bool (*compose) (const hb_ot_shape_normalize_context_t *c,
hb_codepoint_t a,
@@ -140,7 +140,7 @@ struct hb_ot_complex_shaper_t
* Called during shape().
* Shapers should use map to get feature masks and set on buffer.
* Shapers may NOT modify characters.
- * May be NULL.
+ * May be nullptr.
*/
void (*setup_masks) (const hb_ot_shape_plan_t *plan,
hb_buffer_t *buffer,
@@ -150,10 +150,20 @@ struct hb_ot_complex_shaper_t
* Called during shape().
* If set and returns true, GDEF/GSUB/GPOS of the font are ignored
* and fallback operations used.
- * May be NULL.
+ * May be nullptr.
*/
bool (*disable_otl) (const hb_ot_shape_plan_t *plan);
+ /* reorder_marks()
+ * Called during shape().
+ * Shapers can use to modify ordering of combining marks.
+ * May be nullptr.
+ */
+ void (*reorder_marks) (const hb_ot_shape_plan_t *plan,
+ hb_buffer_t *buffer,
+ unsigned int start,
+ unsigned int end);
+
hb_ot_shape_zero_width_marks_type_t zero_width_marks;
bool fallback_position;
@@ -191,6 +201,9 @@ hb_ot_shape_complex_categorize (const hb_ot_shape_planner_t *planner)
case HB_SCRIPT_MANICHAEAN:
case HB_SCRIPT_PSALTER_PAHLAVI:
+ /* Unicode-9.0 additions */
+ case HB_SCRIPT_ADLAM:
+
/* For Arabic script, use the Arabic shaper even if no OT script tag was found.
* This is because we do fallback shaping for Arabic script (and not others).
* But note that Arabic shaping is applicable only to horizontal layout; for
@@ -250,10 +263,12 @@ hb_ot_shape_complex_categorize (const hb_ot_shape_planner_t *planner)
case HB_SCRIPT_SINHALA:
/* If the designer designed the font for the 'DFLT' script,
- * use the default shaper. Otherwise, use the specific shaper.
+ * (or we ended up arbitrarily pick 'latn'), use the default shaper.
+ * Otherwise, use the specific shaper.
* Note that for some simple scripts, there may not be *any*
* GSUB/GPOS needed, so there may be no scripts found! */
- if (planner->map.chosen_script[0] == HB_TAG ('D','F','L','T'))
+ if (planner->map.chosen_script[0] == HB_TAG ('D','F','L','T') ||
+ planner->map.chosen_script[0] == HB_TAG ('l','a','t','n'))
return &_hb_ot_complex_shaper_default;
else
return &_hb_ot_complex_shaper_indic;
@@ -269,7 +284,7 @@ hb_ot_shape_complex_categorize (const hb_ot_shape_planner_t *planner)
planner->map.script_index[0],
planner->map.language_index[0],
HB_TAG ('p','r','e','f'),
- NULL))
+ nullptr))
return &_hb_ot_complex_shaper_indic;
else
return &_hb_ot_complex_shaper_default;
@@ -359,11 +374,18 @@ hb_ot_shape_complex_categorize (const hb_ot_shape_planner_t *planner)
case HB_SCRIPT_MARCHEN:
case HB_SCRIPT_NEWA:
+ /* Unicode-10.0 additions */
+ case HB_SCRIPT_MASARAM_GONDI:
+ case HB_SCRIPT_SOYOMBO:
+ case HB_SCRIPT_ZANABAZAR_SQUARE:
+
/* If the designer designed the font for the 'DFLT' script,
- * use the default shaper. Otherwise, use the specific shaper.
+ * (or we ended up arbitrarily pick 'latn'), use the default shaper.
+ * Otherwise, use the specific shaper.
* Note that for some simple scripts, there may not be *any*
* GSUB/GPOS needed, so there may be no scripts found! */
- if (planner->map.chosen_script[0] == HB_TAG ('D','F','L','T'))
+ if (planner->map.chosen_script[0] == HB_TAG ('D','F','L','T') ||
+ planner->map.chosen_script[0] == HB_TAG ('l','a','t','n'))
return &_hb_ot_complex_shaper_default;
else
return &_hb_ot_complex_shaper_use;
diff --git a/src/3rdparty/harfbuzz-ng/src/hb-ot-shape-complex-thai.cc b/src/3rdparty/harfbuzz-ng/src/hb-ot-shape-complex-thai.cc
index e6f80f59e7..6ba925c675 100644
--- a/src/3rdparty/harfbuzz-ng/src/hb-ot-shape-complex-thai.cc
+++ b/src/3rdparty/harfbuzz-ng/src/hb-ot-shape-complex-thai.cc
@@ -52,7 +52,7 @@ get_consonant_type (hb_codepoint_t u)
return RC;
if (u == 0x0E0Eu || u == 0x0E0Fu)
return DC;
- if (hb_in_range (u, 0x0E01u, 0x0E2Eu))
+ if (hb_in_range<hb_codepoint_t> (u, 0x0E01u, 0x0E2Eu))
return NC;
return NOT_CONSONANT;
}
@@ -70,12 +70,12 @@ enum thai_mark_type_t
static thai_mark_type_t
get_mark_type (hb_codepoint_t u)
{
- if (u == 0x0E31u || hb_in_range (u, 0x0E34u, 0x0E37u) ||
- u == 0x0E47u || hb_in_range (u, 0x0E4Du, 0x0E4Eu))
+ if (u == 0x0E31u || hb_in_range<hb_codepoint_t> (u, 0x0E34u, 0x0E37u) ||
+ u == 0x0E47u || hb_in_range<hb_codepoint_t> (u, 0x0E4Du, 0x0E4Eu))
return AV;
- if (hb_in_range (u, 0x0E38u, 0x0E3Au))
+ if (hb_in_range<hb_codepoint_t> (u, 0x0E38u, 0x0E3Au))
return BV;
- if (hb_in_range (u, 0x0E48u, 0x0E4Cu))
+ if (hb_in_range<hb_codepoint_t> (u, 0x0E48u, 0x0E4Cu))
return T;
return NOT_MARK;
}
@@ -97,7 +97,7 @@ thai_pua_shape (hb_codepoint_t u, thai_action_t action, hb_font_t *font)
hb_codepoint_t u;
hb_codepoint_t win_pua;
hb_codepoint_t mac_pua;
- } const *pua_mappings = NULL;
+ } const *pua_mappings = nullptr;
static const thai_pua_mapping_t SD_mappings[] = {
{0x0E48u, 0xF70Au, 0xF88Bu}, /* MAI EK */
{0x0E49u, 0xF70Bu, 0xF88Eu}, /* MAI THO */
@@ -244,6 +244,7 @@ do_thai_pua_shaping (const hb_ot_shape_plan_t *plan HB_UNUSED,
/* At least one of the above/below actions is NOP. */
thai_action_t action = above_edge.action != NOP ? above_edge.action : below_edge.action;
+ buffer->unsafe_to_break (base, i);
if (action == RD)
info[base].codepoint = thai_pua_shape (info[base].codepoint, action, font);
else
@@ -310,7 +311,7 @@ preprocess_text_thai (const hb_ot_shape_plan_t *plan,
#define IS_SARA_AM(x) (((x) & ~0x0080u) == 0x0E33u)
#define NIKHAHIT_FROM_SARA_AM(x) ((x) - 0x0E33u + 0x0E4Du)
#define SARA_AA_FROM_SARA_AM(x) ((x) - 1)
-#define IS_TONE_MARK(x) (hb_in_ranges ((x) & ~0x0080u, 0x0E34u, 0x0E37u, 0x0E47u, 0x0E4Eu, 0x0E31u, 0x0E31u))
+#define IS_TONE_MARK(x) (hb_in_ranges<hb_codepoint_t> ((x) & ~0x0080u, 0x0E34u, 0x0E37u, 0x0E47u, 0x0E4Eu, 0x0E31u, 0x0E31u))
buffer->clear_output ();
unsigned int count = buffer->len;
@@ -365,18 +366,18 @@ preprocess_text_thai (const hb_ot_shape_plan_t *plan,
const hb_ot_complex_shaper_t _hb_ot_complex_shaper_thai =
{
- "thai",
- NULL, /* collect_features */
- NULL, /* override_features */
- NULL, /* data_create */
- NULL, /* data_destroy */
+ nullptr, /* collect_features */
+ nullptr, /* override_features */
+ nullptr, /* data_create */
+ nullptr, /* data_destroy */
preprocess_text_thai,
- NULL, /* postprocess_glyphs */
+ nullptr, /* postprocess_glyphs */
HB_OT_SHAPE_NORMALIZATION_MODE_DEFAULT,
- NULL, /* decompose */
- NULL, /* compose */
- NULL, /* setup_masks */
- NULL, /* disable_otl */
+ nullptr, /* decompose */
+ nullptr, /* compose */
+ nullptr, /* setup_masks */
+ nullptr, /* disable_otl */
+ nullptr, /* reorder_marks */
HB_OT_SHAPE_ZERO_WIDTH_MARKS_BY_GDEF_LATE,
false,/* fallback_position */
};
diff --git a/src/3rdparty/harfbuzz-ng/src/hb-ot-shape-complex-tibetan.cc b/src/3rdparty/harfbuzz-ng/src/hb-ot-shape-complex-tibetan.cc
index aadf59f5ad..eaac0bf689 100644
--- a/src/3rdparty/harfbuzz-ng/src/hb-ot-shape-complex-tibetan.cc
+++ b/src/3rdparty/harfbuzz-ng/src/hb-ot-shape-complex-tibetan.cc
@@ -46,18 +46,18 @@ collect_features_tibetan (hb_ot_shape_planner_t *plan)
const hb_ot_complex_shaper_t _hb_ot_complex_shaper_tibetan =
{
- "default",
collect_features_tibetan,
- NULL, /* override_features */
- NULL, /* data_create */
- NULL, /* data_destroy */
- NULL, /* preprocess_text */
- NULL, /* postprocess_glyphs */
+ nullptr, /* override_features */
+ nullptr, /* data_create */
+ nullptr, /* data_destroy */
+ nullptr, /* preprocess_text */
+ nullptr, /* postprocess_glyphs */
HB_OT_SHAPE_NORMALIZATION_MODE_DEFAULT,
- NULL, /* decompose */
- NULL, /* compose */
- NULL, /* setup_masks */
- NULL, /* disable_otl */
+ nullptr, /* decompose */
+ nullptr, /* compose */
+ nullptr, /* setup_masks */
+ nullptr, /* disable_otl */
+ nullptr, /* reorder_marks */
HB_OT_SHAPE_ZERO_WIDTH_MARKS_BY_GDEF_LATE,
true, /* fallback_position */
};
diff --git a/src/3rdparty/harfbuzz-ng/src/hb-ot-shape-complex-use-machine.hh b/src/3rdparty/harfbuzz-ng/src/hb-ot-shape-complex-use-machine.hh
index 44e5d0d56b..4f6727186d 100644
--- a/src/3rdparty/harfbuzz-ng/src/hb-ot-shape-complex-use-machine.hh
+++ b/src/3rdparty/harfbuzz-ng/src/hb-ot-shape-complex-use-machine.hh
@@ -36,33 +36,33 @@
#line 38 "hb-ot-shape-complex-use-machine.hh"
static const unsigned char _use_syllable_machine_trans_keys[] = {
- 1u, 1u, 0u, 39u, 21u, 21u, 8u, 39u, 8u, 39u, 1u, 1u, 8u, 39u, 8u, 39u,
+ 1u, 1u, 0u, 43u, 21u, 21u, 8u, 39u, 8u, 39u, 1u, 1u, 8u, 39u, 8u, 39u,
8u, 39u, 8u, 26u, 8u, 26u, 8u, 26u, 8u, 39u, 8u, 39u, 8u, 39u, 8u, 39u,
- 8u, 39u, 8u, 39u, 8u, 39u, 8u, 39u, 8u, 39u, 8u, 39u, 8u, 39u, 13u, 21u,
- 4u, 4u, 13u, 13u, 8u, 39u, 8u, 39u, 8u, 39u, 8u, 39u, 8u, 26u, 8u, 26u,
- 8u, 26u, 8u, 39u, 8u, 39u, 8u, 39u, 8u, 39u, 8u, 39u, 8u, 39u, 8u, 39u,
- 8u, 39u, 8u, 39u, 8u, 39u, 1u, 1u, 1u, 39u, 8u, 39u, 21u, 42u, 41u, 42u,
- 42u, 42u, 0
+ 8u, 39u, 8u, 39u, 8u, 39u, 8u, 39u, 8u, 39u, 8u, 39u, 8u, 39u, 8u, 39u,
+ 13u, 21u, 4u, 4u, 13u, 13u, 8u, 39u, 8u, 39u, 8u, 39u, 8u, 39u, 8u, 26u,
+ 8u, 26u, 8u, 26u, 8u, 39u, 8u, 39u, 8u, 39u, 8u, 39u, 8u, 39u, 8u, 39u,
+ 8u, 39u, 8u, 39u, 8u, 39u, 8u, 39u, 8u, 39u, 1u, 1u, 1u, 39u, 8u, 39u,
+ 21u, 42u, 41u, 42u, 42u, 42u, 1u, 5u, 0
};
static const char _use_syllable_machine_key_spans[] = {
- 1, 40, 1, 32, 32, 1, 32, 32,
+ 1, 44, 1, 32, 32, 1, 32, 32,
32, 19, 19, 19, 32, 32, 32, 32,
- 32, 32, 32, 32, 32, 32, 32, 9,
- 1, 1, 32, 32, 32, 32, 19, 19,
- 19, 32, 32, 32, 32, 32, 32, 32,
- 32, 32, 32, 1, 39, 32, 22, 2,
- 1
+ 32, 32, 32, 32, 32, 32, 32, 32,
+ 9, 1, 1, 32, 32, 32, 32, 19,
+ 19, 19, 32, 32, 32, 32, 32, 32,
+ 32, 32, 32, 32, 32, 1, 39, 32,
+ 22, 2, 1, 5
};
static const short _use_syllable_machine_index_offsets[] = {
- 0, 2, 43, 45, 78, 111, 113, 146,
- 179, 212, 232, 252, 272, 305, 338, 371,
- 404, 437, 470, 503, 536, 569, 602, 635,
- 645, 647, 649, 682, 715, 748, 781, 801,
- 821, 841, 874, 907, 940, 973, 1006, 1039,
- 1072, 1105, 1138, 1171, 1173, 1213, 1246, 1269,
- 1272
+ 0, 2, 47, 49, 82, 115, 117, 150,
+ 183, 216, 236, 256, 276, 309, 342, 375,
+ 408, 441, 474, 507, 540, 573, 606, 639,
+ 672, 682, 684, 686, 719, 752, 785, 818,
+ 838, 858, 878, 911, 944, 977, 1010, 1043,
+ 1076, 1109, 1142, 1175, 1208, 1241, 1243, 1283,
+ 1316, 1339, 1342, 1344
};
static const char _use_syllable_machine_indicies[] = {
@@ -71,183 +71,192 @@ static const char _use_syllable_machine_indicies[] = {
4, 4, 2, 2, 8, 9, 4, 4,
10, 11, 12, 13, 14, 15, 16, 10,
17, 18, 19, 20, 21, 22, 4, 23,
- 24, 25, 4, 27, 26, 29, 28, 28,
- 30, 31, 28, 28, 28, 28, 28, 28,
- 28, 28, 32, 33, 34, 35, 36, 37,
- 38, 39, 33, 40, 32, 41, 42, 43,
- 44, 28, 45, 46, 47, 28, 29, 28,
- 28, 30, 31, 28, 28, 28, 28, 28,
- 28, 28, 28, 48, 33, 34, 35, 36,
- 37, 38, 39, 33, 40, 41, 41, 42,
- 43, 44, 28, 45, 46, 47, 28, 30,
- 49, 29, 28, 28, 30, 31, 28, 28,
- 28, 28, 28, 28, 28, 28, 28, 33,
- 34, 35, 36, 37, 38, 39, 33, 40,
- 41, 41, 42, 43, 44, 28, 45, 46,
- 47, 28, 29, 28, 28, 28, 28, 28,
- 28, 28, 28, 28, 28, 28, 28, 28,
- 33, 34, 35, 36, 37, 28, 28, 28,
- 28, 28, 28, 42, 43, 44, 28, 45,
- 46, 47, 28, 29, 28, 28, 28, 28,
- 28, 28, 28, 28, 28, 28, 28, 28,
- 28, 28, 34, 35, 36, 37, 28, 28,
- 28, 28, 28, 28, 28, 28, 28, 28,
- 45, 46, 47, 28, 29, 28, 28, 28,
- 28, 28, 28, 28, 28, 28, 28, 28,
- 28, 28, 28, 28, 35, 36, 37, 28,
- 29, 28, 28, 28, 28, 28, 28, 28,
- 28, 28, 28, 28, 28, 28, 28, 28,
- 28, 36, 37, 28, 29, 28, 28, 28,
- 28, 28, 28, 28, 28, 28, 28, 28,
- 28, 28, 28, 28, 28, 28, 37, 28,
- 29, 28, 28, 28, 28, 28, 28, 28,
- 28, 28, 28, 28, 28, 28, 28, 28,
- 35, 36, 37, 28, 28, 28, 28, 28,
- 28, 28, 28, 28, 28, 45, 46, 47,
- 28, 29, 28, 28, 28, 28, 28, 28,
- 28, 28, 28, 28, 28, 28, 28, 28,
- 28, 35, 36, 37, 28, 28, 28, 28,
- 28, 28, 28, 28, 28, 28, 28, 46,
- 47, 28, 29, 28, 28, 28, 28, 28,
- 28, 28, 28, 28, 28, 28, 28, 28,
- 28, 28, 35, 36, 37, 28, 28, 28,
- 28, 28, 28, 28, 28, 28, 28, 28,
- 28, 47, 28, 29, 28, 28, 28, 28,
- 28, 28, 28, 28, 28, 28, 28, 28,
- 28, 28, 34, 35, 36, 37, 28, 28,
- 28, 28, 28, 28, 42, 43, 44, 28,
- 45, 46, 47, 28, 29, 28, 28, 28,
- 28, 28, 28, 28, 28, 28, 28, 28,
- 28, 28, 28, 34, 35, 36, 37, 28,
- 28, 28, 28, 28, 28, 28, 43, 44,
- 28, 45, 46, 47, 28, 29, 28, 28,
- 28, 28, 28, 28, 28, 28, 28, 28,
- 28, 28, 28, 28, 34, 35, 36, 37,
- 28, 28, 28, 28, 28, 28, 28, 28,
- 44, 28, 45, 46, 47, 28, 29, 28,
- 28, 28, 28, 28, 28, 28, 28, 28,
- 28, 28, 28, 28, 33, 34, 35, 36,
- 37, 28, 39, 33, 28, 28, 28, 42,
- 43, 44, 28, 45, 46, 47, 28, 29,
- 28, 28, 28, 28, 28, 28, 28, 28,
- 28, 28, 28, 28, 28, 33, 34, 35,
- 36, 37, 28, 28, 33, 28, 28, 28,
- 42, 43, 44, 28, 45, 46, 47, 28,
- 29, 28, 28, 28, 28, 28, 28, 28,
- 28, 28, 28, 28, 28, 28, 33, 34,
- 35, 36, 37, 38, 39, 33, 28, 28,
- 28, 42, 43, 44, 28, 45, 46, 47,
- 28, 29, 28, 28, 30, 31, 28, 28,
- 28, 28, 28, 28, 28, 28, 28, 33,
- 34, 35, 36, 37, 38, 39, 33, 40,
- 28, 41, 42, 43, 44, 28, 45, 46,
- 47, 28, 29, 28, 28, 30, 31, 28,
- 28, 28, 28, 28, 28, 28, 28, 28,
- 33, 34, 35, 36, 37, 38, 39, 33,
- 40, 32, 41, 42, 43, 44, 28, 45,
- 46, 47, 28, 51, 50, 50, 50, 50,
- 50, 50, 50, 52, 50, 5, 53, 51,
- 50, 6, 54, 54, 1, 55, 54, 54,
- 54, 54, 54, 54, 54, 54, 56, 10,
- 11, 12, 13, 14, 15, 16, 10, 17,
- 19, 19, 20, 21, 22, 54, 23, 24,
- 25, 54, 6, 54, 54, 1, 55, 54,
- 54, 54, 54, 54, 54, 54, 54, 54,
- 10, 11, 12, 13, 14, 15, 16, 10,
- 17, 19, 19, 20, 21, 22, 54, 23,
- 24, 25, 54, 6, 54, 54, 54, 54,
- 54, 54, 54, 54, 54, 54, 54, 54,
- 54, 10, 11, 12, 13, 14, 54, 54,
- 54, 54, 54, 54, 20, 21, 22, 54,
- 23, 24, 25, 54, 6, 54, 54, 54,
- 54, 54, 54, 54, 54, 54, 54, 54,
- 54, 54, 54, 11, 12, 13, 14, 54,
- 54, 54, 54, 54, 54, 54, 54, 54,
- 54, 23, 24, 25, 54, 6, 54, 54,
- 54, 54, 54, 54, 54, 54, 54, 54,
- 54, 54, 54, 54, 54, 12, 13, 14,
- 54, 6, 54, 54, 54, 54, 54, 54,
- 54, 54, 54, 54, 54, 54, 54, 54,
- 54, 54, 13, 14, 54, 6, 54, 54,
- 54, 54, 54, 54, 54, 54, 54, 54,
- 54, 54, 54, 54, 54, 54, 54, 14,
- 54, 6, 54, 54, 54, 54, 54, 54,
- 54, 54, 54, 54, 54, 54, 54, 54,
- 54, 12, 13, 14, 54, 54, 54, 54,
- 54, 54, 54, 54, 54, 54, 23, 24,
- 25, 54, 6, 54, 54, 54, 54, 54,
- 54, 54, 54, 54, 54, 54, 54, 54,
- 54, 54, 12, 13, 14, 54, 54, 54,
- 54, 54, 54, 54, 54, 54, 54, 54,
- 24, 25, 54, 6, 54, 54, 54, 54,
- 54, 54, 54, 54, 54, 54, 54, 54,
- 54, 54, 54, 12, 13, 14, 54, 54,
- 54, 54, 54, 54, 54, 54, 54, 54,
- 54, 54, 25, 54, 6, 54, 54, 54,
- 54, 54, 54, 54, 54, 54, 54, 54,
- 54, 54, 54, 11, 12, 13, 14, 54,
- 54, 54, 54, 54, 54, 20, 21, 22,
- 54, 23, 24, 25, 54, 6, 54, 54,
- 54, 54, 54, 54, 54, 54, 54, 54,
- 54, 54, 54, 54, 11, 12, 13, 14,
- 54, 54, 54, 54, 54, 54, 54, 21,
- 22, 54, 23, 24, 25, 54, 6, 54,
- 54, 54, 54, 54, 54, 54, 54, 54,
- 54, 54, 54, 54, 54, 11, 12, 13,
- 14, 54, 54, 54, 54, 54, 54, 54,
- 54, 22, 54, 23, 24, 25, 54, 6,
- 54, 54, 54, 54, 54, 54, 54, 54,
- 54, 54, 54, 54, 54, 10, 11, 12,
- 13, 14, 54, 16, 10, 54, 54, 54,
- 20, 21, 22, 54, 23, 24, 25, 54,
- 6, 54, 54, 54, 54, 54, 54, 54,
- 54, 54, 54, 54, 54, 54, 10, 11,
- 12, 13, 14, 54, 54, 10, 54, 54,
- 54, 20, 21, 22, 54, 23, 24, 25,
- 54, 6, 54, 54, 54, 54, 54, 54,
- 54, 54, 54, 54, 54, 54, 54, 10,
- 11, 12, 13, 14, 15, 16, 10, 54,
- 54, 54, 20, 21, 22, 54, 23, 24,
- 25, 54, 6, 54, 54, 1, 55, 54,
- 54, 54, 54, 54, 54, 54, 54, 54,
+ 24, 25, 4, 4, 4, 26, 4, 28,
+ 27, 30, 29, 29, 31, 32, 29, 29,
+ 29, 29, 29, 29, 29, 29, 33, 34,
+ 35, 36, 37, 38, 39, 40, 34, 41,
+ 33, 42, 43, 44, 45, 29, 46, 47,
+ 48, 29, 30, 29, 29, 31, 32, 29,
+ 29, 29, 29, 29, 29, 29, 29, 49,
+ 34, 35, 36, 37, 38, 39, 40, 34,
+ 41, 42, 42, 43, 44, 45, 29, 46,
+ 47, 48, 29, 31, 50, 30, 29, 29,
+ 31, 32, 29, 29, 29, 29, 29, 29,
+ 29, 29, 29, 34, 35, 36, 37, 38,
+ 39, 40, 34, 41, 42, 42, 43, 44,
+ 45, 29, 46, 47, 48, 29, 30, 29,
+ 29, 29, 29, 29, 29, 29, 29, 29,
+ 29, 29, 29, 29, 34, 35, 36, 37,
+ 38, 29, 29, 29, 29, 29, 29, 43,
+ 44, 45, 29, 46, 47, 48, 29, 30,
+ 29, 29, 29, 29, 29, 29, 29, 29,
+ 29, 29, 29, 29, 29, 29, 35, 36,
+ 37, 38, 29, 29, 29, 29, 29, 29,
+ 29, 29, 29, 29, 46, 47, 48, 29,
+ 30, 29, 29, 29, 29, 29, 29, 29,
+ 29, 29, 29, 29, 29, 29, 29, 29,
+ 36, 37, 38, 29, 30, 29, 29, 29,
+ 29, 29, 29, 29, 29, 29, 29, 29,
+ 29, 29, 29, 29, 29, 37, 38, 29,
+ 30, 29, 29, 29, 29, 29, 29, 29,
+ 29, 29, 29, 29, 29, 29, 29, 29,
+ 29, 29, 38, 29, 30, 29, 29, 29,
+ 29, 29, 29, 29, 29, 29, 29, 29,
+ 29, 29, 29, 29, 36, 37, 38, 29,
+ 29, 29, 29, 29, 29, 29, 29, 29,
+ 29, 46, 47, 48, 29, 30, 29, 29,
+ 29, 29, 29, 29, 29, 29, 29, 29,
+ 29, 29, 29, 29, 29, 36, 37, 38,
+ 29, 29, 29, 29, 29, 29, 29, 29,
+ 29, 29, 29, 47, 48, 29, 30, 29,
+ 29, 29, 29, 29, 29, 29, 29, 29,
+ 29, 29, 29, 29, 29, 29, 36, 37,
+ 38, 29, 29, 29, 29, 29, 29, 29,
+ 29, 29, 29, 29, 29, 48, 29, 30,
+ 29, 29, 29, 29, 29, 29, 29, 29,
+ 29, 29, 29, 29, 29, 29, 35, 36,
+ 37, 38, 29, 29, 29, 29, 29, 29,
+ 43, 44, 45, 29, 46, 47, 48, 29,
+ 30, 29, 29, 29, 29, 29, 29, 29,
+ 29, 29, 29, 29, 29, 29, 29, 35,
+ 36, 37, 38, 29, 29, 29, 29, 29,
+ 29, 29, 44, 45, 29, 46, 47, 48,
+ 29, 30, 29, 29, 29, 29, 29, 29,
+ 29, 29, 29, 29, 29, 29, 29, 29,
+ 35, 36, 37, 38, 29, 29, 29, 29,
+ 29, 29, 29, 29, 45, 29, 46, 47,
+ 48, 29, 30, 29, 29, 29, 29, 29,
+ 29, 29, 29, 29, 29, 29, 29, 29,
+ 34, 35, 36, 37, 38, 29, 40, 34,
+ 29, 29, 29, 43, 44, 45, 29, 46,
+ 47, 48, 29, 30, 29, 29, 29, 29,
+ 29, 29, 29, 29, 29, 29, 29, 29,
+ 29, 34, 35, 36, 37, 38, 29, 51,
+ 34, 29, 29, 29, 43, 44, 45, 29,
+ 46, 47, 48, 29, 30, 29, 29, 29,
+ 29, 29, 29, 29, 29, 29, 29, 29,
+ 29, 29, 34, 35, 36, 37, 38, 29,
+ 29, 34, 29, 29, 29, 43, 44, 45,
+ 29, 46, 47, 48, 29, 30, 29, 29,
+ 29, 29, 29, 29, 29, 29, 29, 29,
+ 29, 29, 29, 34, 35, 36, 37, 38,
+ 39, 40, 34, 29, 29, 29, 43, 44,
+ 45, 29, 46, 47, 48, 29, 30, 29,
+ 29, 31, 32, 29, 29, 29, 29, 29,
+ 29, 29, 29, 29, 34, 35, 36, 37,
+ 38, 39, 40, 34, 41, 29, 42, 43,
+ 44, 45, 29, 46, 47, 48, 29, 30,
+ 29, 29, 31, 32, 29, 29, 29, 29,
+ 29, 29, 29, 29, 29, 34, 35, 36,
+ 37, 38, 39, 40, 34, 41, 33, 42,
+ 43, 44, 45, 29, 46, 47, 48, 29,
+ 53, 52, 52, 52, 52, 52, 52, 52,
+ 54, 52, 5, 55, 53, 52, 6, 56,
+ 56, 1, 57, 56, 56, 56, 56, 56,
+ 56, 56, 56, 58, 10, 11, 12, 13,
+ 14, 15, 16, 10, 17, 19, 19, 20,
+ 21, 22, 56, 23, 24, 25, 56, 6,
+ 56, 56, 1, 57, 56, 56, 56, 56,
+ 56, 56, 56, 56, 56, 10, 11, 12,
+ 13, 14, 15, 16, 10, 17, 19, 19,
+ 20, 21, 22, 56, 23, 24, 25, 56,
+ 6, 56, 56, 56, 56, 56, 56, 56,
+ 56, 56, 56, 56, 56, 56, 10, 11,
+ 12, 13, 14, 56, 56, 56, 56, 56,
+ 56, 20, 21, 22, 56, 23, 24, 25,
+ 56, 6, 56, 56, 56, 56, 56, 56,
+ 56, 56, 56, 56, 56, 56, 56, 56,
+ 11, 12, 13, 14, 56, 56, 56, 56,
+ 56, 56, 56, 56, 56, 56, 23, 24,
+ 25, 56, 6, 56, 56, 56, 56, 56,
+ 56, 56, 56, 56, 56, 56, 56, 56,
+ 56, 56, 12, 13, 14, 56, 6, 56,
+ 56, 56, 56, 56, 56, 56, 56, 56,
+ 56, 56, 56, 56, 56, 56, 56, 13,
+ 14, 56, 6, 56, 56, 56, 56, 56,
+ 56, 56, 56, 56, 56, 56, 56, 56,
+ 56, 56, 56, 56, 14, 56, 6, 56,
+ 56, 56, 56, 56, 56, 56, 56, 56,
+ 56, 56, 56, 56, 56, 56, 12, 13,
+ 14, 56, 56, 56, 56, 56, 56, 56,
+ 56, 56, 56, 23, 24, 25, 56, 6,
+ 56, 56, 56, 56, 56, 56, 56, 56,
+ 56, 56, 56, 56, 56, 56, 56, 12,
+ 13, 14, 56, 56, 56, 56, 56, 56,
+ 56, 56, 56, 56, 56, 24, 25, 56,
+ 6, 56, 56, 56, 56, 56, 56, 56,
+ 56, 56, 56, 56, 56, 56, 56, 56,
+ 12, 13, 14, 56, 56, 56, 56, 56,
+ 56, 56, 56, 56, 56, 56, 56, 25,
+ 56, 6, 56, 56, 56, 56, 56, 56,
+ 56, 56, 56, 56, 56, 56, 56, 56,
+ 11, 12, 13, 14, 56, 56, 56, 56,
+ 56, 56, 20, 21, 22, 56, 23, 24,
+ 25, 56, 6, 56, 56, 56, 56, 56,
+ 56, 56, 56, 56, 56, 56, 56, 56,
+ 56, 11, 12, 13, 14, 56, 56, 56,
+ 56, 56, 56, 56, 21, 22, 56, 23,
+ 24, 25, 56, 6, 56, 56, 56, 56,
+ 56, 56, 56, 56, 56, 56, 56, 56,
+ 56, 56, 11, 12, 13, 14, 56, 56,
+ 56, 56, 56, 56, 56, 56, 22, 56,
+ 23, 24, 25, 56, 6, 56, 56, 56,
+ 56, 56, 56, 56, 56, 56, 56, 56,
+ 56, 56, 10, 11, 12, 13, 14, 56,
+ 16, 10, 56, 56, 56, 20, 21, 22,
+ 56, 23, 24, 25, 56, 6, 56, 56,
+ 56, 56, 56, 56, 56, 56, 56, 56,
+ 56, 56, 56, 10, 11, 12, 13, 14,
+ 56, 59, 10, 56, 56, 56, 20, 21,
+ 22, 56, 23, 24, 25, 56, 6, 56,
+ 56, 56, 56, 56, 56, 56, 56, 56,
+ 56, 56, 56, 56, 10, 11, 12, 13,
+ 14, 56, 56, 10, 56, 56, 56, 20,
+ 21, 22, 56, 23, 24, 25, 56, 6,
+ 56, 56, 56, 56, 56, 56, 56, 56,
+ 56, 56, 56, 56, 56, 10, 11, 12,
+ 13, 14, 15, 16, 10, 56, 56, 56,
+ 20, 21, 22, 56, 23, 24, 25, 56,
+ 6, 56, 56, 1, 57, 56, 56, 56,
+ 56, 56, 56, 56, 56, 56, 10, 11,
+ 12, 13, 14, 15, 16, 10, 17, 56,
+ 19, 20, 21, 22, 56, 23, 24, 25,
+ 56, 1, 60, 3, 56, 56, 56, 3,
+ 56, 56, 6, 56, 56, 1, 57, 56,
+ 56, 56, 56, 56, 56, 56, 56, 56,
10, 11, 12, 13, 14, 15, 16, 10,
- 17, 54, 19, 20, 21, 22, 54, 23,
- 24, 25, 54, 1, 57, 3, 54, 54,
- 54, 3, 54, 54, 6, 54, 54, 1,
- 55, 54, 54, 54, 54, 54, 54, 54,
- 54, 54, 10, 11, 12, 13, 14, 15,
- 16, 10, 17, 18, 19, 20, 21, 22,
- 54, 23, 24, 25, 54, 6, 54, 54,
- 1, 55, 54, 54, 54, 54, 54, 54,
- 54, 54, 54, 10, 11, 12, 13, 14,
- 15, 16, 10, 17, 18, 19, 20, 21,
- 22, 54, 23, 24, 25, 54, 59, 58,
- 58, 58, 58, 58, 58, 58, 58, 58,
- 58, 58, 58, 58, 58, 58, 58, 58,
- 58, 58, 59, 60, 58, 59, 60, 58,
- 60, 58, 0
+ 17, 18, 19, 20, 21, 22, 56, 23,
+ 24, 25, 56, 6, 56, 56, 1, 57,
+ 56, 56, 56, 56, 56, 56, 56, 56,
+ 56, 10, 11, 12, 13, 14, 15, 16,
+ 10, 17, 18, 19, 20, 21, 22, 56,
+ 23, 24, 25, 56, 62, 61, 61, 61,
+ 61, 61, 61, 61, 61, 61, 61, 61,
+ 61, 61, 61, 61, 61, 61, 61, 61,
+ 62, 63, 61, 62, 63, 61, 63, 61,
+ 3, 60, 60, 60, 3, 60, 0
};
static const char _use_syllable_machine_trans_targs[] = {
- 1, 26, 2, 3, 1, 23, 1, 43,
- 44, 46, 28, 29, 30, 31, 32, 39,
- 40, 41, 45, 42, 36, 37, 38, 33,
- 34, 35, 1, 1, 1, 1, 4, 5,
- 22, 7, 8, 9, 10, 11, 18, 19,
- 20, 21, 15, 16, 17, 12, 13, 14,
- 6, 1, 1, 24, 25, 1, 1, 0,
- 27, 1, 1, 47, 48
+ 1, 27, 2, 3, 1, 24, 1, 45,
+ 46, 48, 29, 30, 31, 32, 33, 40,
+ 41, 43, 47, 44, 37, 38, 39, 34,
+ 35, 36, 51, 1, 1, 1, 1, 4,
+ 5, 23, 7, 8, 9, 10, 11, 18,
+ 19, 21, 22, 15, 16, 17, 12, 13,
+ 14, 6, 1, 20, 1, 25, 26, 1,
+ 1, 0, 28, 42, 1, 1, 49, 50
};
static const char _use_syllable_machine_trans_actions[] = {
1, 2, 0, 0, 5, 0, 6, 0,
2, 0, 0, 0, 0, 0, 0, 0,
0, 0, 2, 2, 0, 0, 0, 0,
- 0, 0, 7, 8, 9, 10, 0, 0,
+ 0, 0, 0, 7, 8, 9, 10, 0,
0, 0, 0, 0, 0, 0, 0, 0,
0, 0, 0, 0, 0, 0, 0, 0,
- 0, 11, 12, 0, 0, 13, 14, 0,
- 2, 15, 16, 0, 0
+ 0, 0, 11, 0, 12, 0, 0, 13,
+ 14, 0, 2, 0, 15, 16, 0, 0
};
static const char _use_syllable_machine_to_state_actions[] = {
@@ -257,7 +266,7 @@ static const char _use_syllable_machine_to_state_actions[] = {
0, 0, 0, 0, 0, 0, 0, 0,
0, 0, 0, 0, 0, 0, 0, 0,
0, 0, 0, 0, 0, 0, 0, 0,
- 0
+ 0, 0, 0, 0
};
static const char _use_syllable_machine_from_state_actions[] = {
@@ -267,17 +276,17 @@ static const char _use_syllable_machine_from_state_actions[] = {
0, 0, 0, 0, 0, 0, 0, 0,
0, 0, 0, 0, 0, 0, 0, 0,
0, 0, 0, 0, 0, 0, 0, 0,
- 0
+ 0, 0, 0, 0
};
static const short _use_syllable_machine_eof_trans[] = {
- 1, 0, 27, 29, 29, 50, 29, 29,
- 29, 29, 29, 29, 29, 29, 29, 29,
- 29, 29, 29, 29, 29, 29, 29, 51,
- 54, 51, 55, 55, 55, 55, 55, 55,
- 55, 55, 55, 55, 55, 55, 55, 55,
- 55, 55, 55, 58, 55, 55, 59, 59,
- 59
+ 1, 0, 28, 30, 30, 51, 30, 30,
+ 30, 30, 30, 30, 30, 30, 30, 30,
+ 30, 30, 30, 30, 30, 30, 30, 30,
+ 53, 56, 53, 57, 57, 57, 57, 57,
+ 57, 57, 57, 57, 57, 57, 57, 57,
+ 57, 57, 57, 57, 57, 61, 57, 57,
+ 62, 62, 62, 61
};
static const int use_syllable_machine_start = 1;
@@ -291,7 +300,7 @@ static const int use_syllable_machine_en_main = 1;
-#line 138 "hb-ot-shape-complex-use-machine.rl"
+#line 140 "hb-ot-shape-complex-use-machine.rl"
#define found_syllable(syllable_type) \
@@ -311,7 +320,7 @@ find_syllables (hb_buffer_t *buffer)
int cs;
hb_glyph_info_t *info = buffer->info;
-#line 315 "hb-ot-shape-complex-use-machine.hh"
+#line 324 "hb-ot-shape-complex-use-machine.hh"
{
cs = use_syllable_machine_start;
ts = 0;
@@ -319,7 +328,7 @@ find_syllables (hb_buffer_t *buffer)
act = 0;
}
-#line 159 "hb-ot-shape-complex-use-machine.rl"
+#line 161 "hb-ot-shape-complex-use-machine.rl"
p = 0;
@@ -328,7 +337,7 @@ find_syllables (hb_buffer_t *buffer)
unsigned int last = 0;
unsigned int syllable_serial = 1;
-#line 332 "hb-ot-shape-complex-use-machine.hh"
+#line 341 "hb-ot-shape-complex-use-machine.hh"
{
int _slen;
int _trans;
@@ -342,7 +351,7 @@ _resume:
#line 1 "NONE"
{ts = p;}
break;
-#line 346 "hb-ot-shape-complex-use-machine.hh"
+#line 355 "hb-ot-shape-complex-use-machine.hh"
}
_keys = _use_syllable_machine_trans_keys + (cs<<1);
@@ -365,58 +374,58 @@ _eof_trans:
{te = p+1;}
break;
case 8:
-#line 127 "hb-ot-shape-complex-use-machine.rl"
+#line 129 "hb-ot-shape-complex-use-machine.rl"
{te = p+1;{ found_syllable (independent_cluster); }}
break;
case 10:
-#line 129 "hb-ot-shape-complex-use-machine.rl"
+#line 131 "hb-ot-shape-complex-use-machine.rl"
{te = p+1;{ found_syllable (standard_cluster); }}
break;
case 6:
-#line 133 "hb-ot-shape-complex-use-machine.rl"
+#line 135 "hb-ot-shape-complex-use-machine.rl"
{te = p+1;{ found_syllable (broken_cluster); }}
break;
case 5:
-#line 134 "hb-ot-shape-complex-use-machine.rl"
+#line 136 "hb-ot-shape-complex-use-machine.rl"
{te = p+1;{ found_syllable (non_cluster); }}
break;
case 7:
-#line 127 "hb-ot-shape-complex-use-machine.rl"
+#line 129 "hb-ot-shape-complex-use-machine.rl"
{te = p;p--;{ found_syllable (independent_cluster); }}
break;
case 11:
-#line 128 "hb-ot-shape-complex-use-machine.rl"
+#line 130 "hb-ot-shape-complex-use-machine.rl"
{te = p;p--;{ found_syllable (virama_terminated_cluster); }}
break;
case 9:
-#line 129 "hb-ot-shape-complex-use-machine.rl"
+#line 131 "hb-ot-shape-complex-use-machine.rl"
{te = p;p--;{ found_syllable (standard_cluster); }}
break;
case 13:
-#line 130 "hb-ot-shape-complex-use-machine.rl"
+#line 132 "hb-ot-shape-complex-use-machine.rl"
{te = p;p--;{ found_syllable (number_joiner_terminated_cluster); }}
break;
case 12:
-#line 131 "hb-ot-shape-complex-use-machine.rl"
+#line 133 "hb-ot-shape-complex-use-machine.rl"
{te = p;p--;{ found_syllable (numeral_cluster); }}
break;
case 16:
-#line 132 "hb-ot-shape-complex-use-machine.rl"
+#line 134 "hb-ot-shape-complex-use-machine.rl"
{te = p;p--;{ found_syllable (symbol_cluster); }}
break;
case 14:
-#line 133 "hb-ot-shape-complex-use-machine.rl"
+#line 135 "hb-ot-shape-complex-use-machine.rl"
{te = p;p--;{ found_syllable (broken_cluster); }}
break;
case 15:
-#line 134 "hb-ot-shape-complex-use-machine.rl"
+#line 136 "hb-ot-shape-complex-use-machine.rl"
{te = p;p--;{ found_syllable (non_cluster); }}
break;
case 1:
-#line 133 "hb-ot-shape-complex-use-machine.rl"
+#line 135 "hb-ot-shape-complex-use-machine.rl"
{{p = ((te))-1;}{ found_syllable (broken_cluster); }}
break;
-#line 420 "hb-ot-shape-complex-use-machine.hh"
+#line 429 "hb-ot-shape-complex-use-machine.hh"
}
_again:
@@ -425,7 +434,7 @@ _again:
#line 1 "NONE"
{ts = 0;}
break;
-#line 429 "hb-ot-shape-complex-use-machine.hh"
+#line 438 "hb-ot-shape-complex-use-machine.hh"
}
if ( ++p != pe )
@@ -441,7 +450,7 @@ _again:
}
-#line 168 "hb-ot-shape-complex-use-machine.rl"
+#line 170 "hb-ot-shape-complex-use-machine.rl"
}
diff --git a/src/3rdparty/harfbuzz-ng/src/hb-ot-shape-complex-use-private.hh b/src/3rdparty/harfbuzz-ng/src/hb-ot-shape-complex-use-private.hh
index ae428cb5eb..3e763ae393 100644
--- a/src/3rdparty/harfbuzz-ng/src/hb-ot-shape-complex-use-private.hh
+++ b/src/3rdparty/harfbuzz-ng/src/hb-ot-shape-complex-use-private.hh
@@ -87,7 +87,8 @@ enum use_category_t {
USE_VMPst = 39, /* VOWEL_MOD_POST */
USE_VMPre = 23, /* VOWEL_MOD_PRE */
USE_SMAbv = 41, /* SYM_MOD_ABOVE */
- USE_SMBlw = 42 /* SYM_MOD_BELOW */
+ USE_SMBlw = 42, /* SYM_MOD_BELOW */
+ USE_CS = 43 /* CONS_WITH_STACKER */
};
HB_INTERNAL USE_TABLE_ELEMENT_TYPE
diff --git a/src/3rdparty/harfbuzz-ng/src/hb-ot-shape-complex-use-table.cc b/src/3rdparty/harfbuzz-ng/src/hb-ot-shape-complex-use-table.cc
index 38c46d002d..fd6978f281 100644
--- a/src/3rdparty/harfbuzz-ng/src/hb-ot-shape-complex-use-table.cc
+++ b/src/3rdparty/harfbuzz-ng/src/hb-ot-shape-complex-use-table.cc
@@ -6,12 +6,12 @@
*
* on files with these headers:
*
- * # IndicSyllabicCategory-9.0.0.txt
- * # Date: 2016-05-21, 02:46:00 GMT [RP]
- * # IndicPositionalCategory-9.0.0.txt
- * # Date: 2016-02-25, 00:48:00 GMT [RP]
- * # Blocks-9.0.0.txt
- * # Date: 2016-02-05, 23:48:00 GMT [KW]
+ * # IndicSyllabicCategory-10.0.0.txt
+ * # Date: 2017-05-31, 01:07:00 GMT [KW, RP]
+ * # IndicPositionalCategory-10.0.0.txt
+ * # Date: 2017-05-31, 01:07:00 GMT [RP]
+ * # Blocks-10.0.0.txt
+ * # Date: 2017-04-12, 17:30:00 GMT [KW]
* UnicodeData.txt does not have a header.
*/
@@ -19,6 +19,7 @@
#define B USE_B /* BASE */
#define CGJ USE_CGJ /* CGJ */
+#define CS USE_CS /* CONS_WITH_STACKER */
#define FM USE_FM /* CONS_FINAL_MOD */
#define GB USE_GB /* BASE_OTHER */
#define H USE_H /* HALANT */
@@ -97,7 +98,7 @@ static const USE_TABLE_ELEMENT_TYPE use_table[] = {
/* 09C0 */ VPst, VBlw, VBlw, VBlw, VBlw, O, O, VPre, VPre, O, O, VPre, VPre, H, IND, O,
/* 09D0 */ O, O, O, O, O, O, O, VPst, O, O, O, O, B, B, O, B,
/* 09E0 */ B, B, VBlw, VBlw, O, O, B, B, B, B, B, B, B, B, B, B,
- /* 09F0 */ B, B, O, O, O, O, O, O, O, O, O, O, O, O, O, O,
+ /* 09F0 */ B, B, O, O, O, O, O, O, O, O, O, O, B, O, O, O,
/* Gurmukhi */
@@ -119,7 +120,7 @@ static const USE_TABLE_ELEMENT_TYPE use_table[] = {
/* 0AC0 */ VPst, VBlw, VBlw, VBlw, VBlw, VAbv, O, VAbv, VAbv, VAbv, O, VPst, VPst, H, O, O,
/* 0AD0 */ O, O, O, O, O, O, O, O, O, O, O, O, O, O, O, O,
/* 0AE0 */ B, B, VBlw, VBlw, O, O, B, B, B, B, B, B, B, B, B, B,
- /* 0AF0 */ O, O, O, O, O, O, O, O, O, B, O, O, O, O, O, O,
+ /* 0AF0 */ O, O, O, O, O, O, O, O, O, B, VMAbv, VMAbv, VMAbv, CMAbv, CMAbv, CMAbv,
/* Oriya */
@@ -163,14 +164,14 @@ static const USE_TABLE_ELEMENT_TYPE use_table[] = {
/* 0CC0 */ VAbv, VPst, VPst, VPst, VPst, O, VAbv, VAbv, VAbv, O, VAbv, VAbv, VAbv, H, O, O,
/* 0CD0 */ O, O, O, O, O, VPst, VPst, O, O, O, O, O, O, O, B, O,
/* 0CE0 */ B, B, VBlw, VBlw, O, O, B, B, B, B, B, B, B, B, B, B,
- /* 0CF0 */ O, R, R, O, O, O, O, O, O, O, O, O, O, O, O, O,
+ /* 0CF0 */ O, CS, CS, O, O, O, O, O, O, O, O, O, O, O, O, O,
/* Malayalam */
- /* 0D00 */ O, VMAbv, VMPst, VMPst, O, B, B, B, B, B, B, B, B, O, B, B,
+ /* 0D00 */ VMAbv, VMAbv, VMPst, VMPst, O, B, B, B, B, B, B, B, B, O, B, B,
/* 0D10 */ B, O, B, B, B, B, B, B, B, B, B, B, B, B, B, B,
/* 0D20 */ B, B, B, B, B, B, B, B, B, B, B, B, B, B, B, B,
- /* 0D30 */ B, B, B, B, B, B, B, B, B, B, B, O, O, B, VPst, VPst,
+ /* 0D30 */ B, B, B, B, B, B, B, B, B, B, B, VAbv, VAbv, B, VPst, VPst,
/* 0D40 */ VPst, VPst, VPst, VBlw, VBlw, O, VPre, VPre, VPre, O, VPre, VPre, VPre, H, R, O,
/* 0D50 */ O, O, O, O, IND, IND, IND, VPst, O, O, O, O, O, O, O, B,
/* 0D60 */ B, B, VBlw, VBlw, O, O, B, B, B, B, B, B, B, B, B, B,
@@ -274,9 +275,9 @@ static const USE_TABLE_ELEMENT_TYPE use_table[] = {
/* 1A20 */ B, B, B, B, B, B, B, B, B, B, B, B, B, B, B, B,
/* 1A30 */ B, B, B, B, B, B, B, B, B, B, B, B, B, B, B, B,
/* 1A40 */ B, B, B, B, B, B, B, B, B, B, B, B, B, B, B, B,
- /* 1A50 */ B, B, B, B, B, MPre, MBlw, FPst, FAbv, FAbv, FAbv, FBlw, FBlw, FBlw, FBlw, O,
+ /* 1A50 */ B, B, B, B, B, MPre, MBlw, SUB, FAbv, FAbv, FAbv, SUB, SUB, SUB, SUB, O,
/* 1A60 */ H, VPst, VAbv, VPst, VPst, VAbv, VAbv, VAbv, VAbv, VBlw, VBlw, VAbv, VBlw, VPst, VPre, VPre,
- /* 1A70 */ VPre, VPre, VPre, VAbv, VAbv, VMAbv, VMAbv, VMAbv, VMAbv, VMAbv, FM, FM, FM, O, O, FM,
+ /* 1A70 */ VPre, VPre, VPre, VAbv, VMAbv, VMAbv, VMAbv, VMAbv, VMAbv, VMAbv, VAbv, FM, FM, O, O, FBlw,
/* 1A80 */ B, B, B, B, B, B, B, B, B, B, O, O, O, O, O, O,
/* 1A90 */ B, B, B, B, B, B, B, B, B, B, O, O, O, O, O, O,
@@ -323,7 +324,7 @@ static const USE_TABLE_ELEMENT_TYPE use_table[] = {
/* 1CD0 */ VMAbv, VMAbv, VMAbv, O, VMBlw, VMBlw, VMBlw, VMBlw, VMBlw, VMBlw, VMAbv, VMAbv, VMBlw, VMBlw, VMBlw, VMBlw,
/* 1CE0 */ VMAbv, VMPst, VMBlw, VMBlw, VMBlw, VMBlw, VMBlw, VMBlw, VMBlw, O, O, O, O, VMBlw, O, O,
- /* 1CF0 */ O, O, VMPst, VMPst, VMAbv, O, O, O, VMAbv, VMAbv, O, O, O, O, O, O,
+ /* 1CF0 */ O, O, VMPst, VMPst, VMAbv, O, O, VMPst, VMAbv, VMAbv, O, O, O, O, O, O,
#define use_offset_0x1df8u 2552
@@ -347,7 +348,14 @@ static const USE_TABLE_ELEMENT_TYPE use_table[] = {
/* 2070 */ O, O, O, O, FM, O, O, O, O, O, O, O, O, O, O, O,
/* 2080 */ O, O, FM, FM, FM, O, O, O,
-#define use_offset_0xa800u 2616
+#define use_offset_0x20f0u 2616
+
+
+ /* Combining Diacritical Marks for Symbols */
+
+ /* 20F0 */ VMAbv, O, O, O, O, O, O, O,
+
+#define use_offset_0xa800u 2624
/* Syloti Nagri */
@@ -369,14 +377,14 @@ static const USE_TABLE_ELEMENT_TYPE use_table[] = {
/* A880 */ VMPst, VMPst, B, B, B, B, B, B, B, B, B, B, B, B, B, B,
/* A890 */ B, B, B, B, B, B, B, B, B, B, B, B, B, B, B, B,
/* A8A0 */ B, B, B, B, B, B, B, B, B, B, B, B, B, B, B, B,
- /* A8B0 */ B, B, B, B, FPst, VPst, VPst, VPst, VPst, VPst, VPst, VPst, VPst, VPst, VPst, VPst,
+ /* A8B0 */ B, B, B, B, MPst, VPst, VPst, VPst, VPst, VPst, VPst, VPst, VPst, VPst, VPst, VPst,
/* A8C0 */ VPst, VPst, VPst, VPst, H, VMAbv, O, O, O, O, O, O, O, O, O, O,
/* A8D0 */ B, B, B, B, B, B, B, B, B, B, O, O, O, O, O, O,
/* Devanagari Extended */
/* A8E0 */ VMAbv, VMAbv, VMAbv, VMAbv, VMAbv, VMAbv, VMAbv, VMAbv, VMAbv, VMAbv, VMAbv, VMAbv, VMAbv, VMAbv, VMAbv, VMAbv,
- /* A8F0 */ VMAbv, VMAbv, O, O, O, O, O, O, O, O, O, O, O, O, O, O,
+ /* A8F0 */ VMAbv, VMAbv, B, B, O, O, O, O, O, O, O, O, O, O, O, O,
/* Kayah Li */
@@ -397,7 +405,7 @@ static const USE_TABLE_ELEMENT_TYPE use_table[] = {
/* A980 */ VMAbv, VMAbv, FAbv, VMPst, B, B, B, B, B, B, B, B, B, B, B, B,
/* A990 */ B, B, B, B, B, B, B, B, B, B, B, B, B, B, B, B,
/* A9A0 */ B, B, B, B, B, B, B, B, B, B, B, B, B, B, B, B,
- /* A9B0 */ B, B, B, CMAbv, VPst, VPst, VAbv, VAbv, VBlw, VBlw, VPre, VPre, VAbv, SUB, MPst, MPst,
+ /* A9B0 */ B, B, B, CMAbv, VPst, VPst, VAbv, VAbv, VBlw, VBlw, VPre, VPre, VAbv, SUB, MPst, MBlw,
/* A9C0 */ H, O, O, O, O, O, O, O, O, O, O, O, O, O, O, O,
/* A9D0 */ B, B, B, B, B, B, B, B, B, B, O, O, O, O, O, O,
@@ -410,7 +418,7 @@ static const USE_TABLE_ELEMENT_TYPE use_table[] = {
/* AA00 */ B, B, B, B, B, B, B, B, B, B, B, B, B, B, B, B,
/* AA10 */ B, B, B, B, B, B, B, B, B, B, B, B, B, B, B, B,
- /* AA20 */ B, B, B, B, B, B, B, B, B, VAbv, VAbv, VAbv, VAbv, VBlw, VAbv, VPre,
+ /* AA20 */ B, B, B, B, B, B, B, B, B, VMAbv, VAbv, VAbv, VAbv, VBlw, VAbv, VPre,
/* AA30 */ VPre, VAbv, VBlw, MPst, MPre, MBlw, MBlw, O, O, O, O, O, O, O, O, O,
/* AA40 */ B, B, B, FAbv, B, B, B, B, B, B, B, B, FAbv, FPst, O, O,
/* AA50 */ B, B, B, B, B, B, B, B, B, B, O, O, O, O, O, O,
@@ -434,7 +442,7 @@ static const USE_TABLE_ELEMENT_TYPE use_table[] = {
/* AAE0 */ B, B, B, B, B, B, B, B, B, B, B, VPre, VBlw, VAbv, VPre, VPst,
/* AAF0 */ O, O, O, O, O, VMPst, H, O,
-#define use_offset_0xabc0u 3376
+#define use_offset_0xabc0u 3384
/* Meetei Mayek */
@@ -444,14 +452,14 @@ static const USE_TABLE_ELEMENT_TYPE use_table[] = {
/* ABE0 */ B, B, B, VPst, VPst, VAbv, VPst, VPst, VBlw, VPst, VPst, O, VMPst, VBlw, O, O,
/* ABF0 */ B, B, B, B, B, B, B, B, B, B, O, O, O, O, O, O,
-#define use_offset_0xfe00u 3440
+#define use_offset_0xfe00u 3448
/* Variation Selectors */
/* FE00 */ VS, VS, VS, VS, VS, VS, VS, VS, VS, VS, VS, VS, VS, VS, VS, VS,
-#define use_offset_0x10a00u 3456
+#define use_offset_0x10a00u 3464
/* Kharoshthi */
@@ -462,12 +470,12 @@ static const USE_TABLE_ELEMENT_TYPE use_table[] = {
/* 10A30 */ B, B, B, B, O, O, O, O, CMAbv, CMBlw, CMBlw, O, O, O, O, H,
/* 10A40 */ B, B, B, B, B, B, B, B,
-#define use_offset_0x11000u 3528
+#define use_offset_0x11000u 3536
/* Brahmi */
- /* 11000 */ VMPst, VMAbv, VMPst, R, R, B, B, B, B, B, B, B, B, B, B, B,
+ /* 11000 */ VMPst, VMAbv, VMPst, CS, CS, B, B, B, B, B, B, B, B, B, B, B,
/* 11010 */ B, B, B, B, B, B, B, B, B, B, B, B, B, B, B, B,
/* 11020 */ B, B, B, B, B, B, B, B, B, B, B, B, B, B, B, B,
/* 11030 */ B, B, B, B, B, B, B, B, VAbv, VAbv, VAbv, VAbv, VBlw, VBlw, VBlw, VBlw,
@@ -483,7 +491,7 @@ static const USE_TABLE_ELEMENT_TYPE use_table[] = {
/* 110A0 */ B, B, B, B, B, B, B, B, B, B, B, B, B, B, B, B,
/* 110B0 */ VPst, VPre, VPst, VBlw, VBlw, VAbv, VAbv, VPst, VPst, H, CMBlw, O, O, O, O, O,
-#define use_offset_0x11100u 3720
+#define use_offset_0x11100u 3728
/* Chakma */
@@ -521,7 +529,7 @@ static const USE_TABLE_ELEMENT_TYPE use_table[] = {
/* 11220 */ B, B, B, B, B, B, B, B, B, B, B, B, VPst, VPst, VPst, VBlw,
/* 11230 */ VAbv, VAbv, VAbv, VAbv, VMAbv, H, CMAbv, CMAbv, O, O, O, O, O, O, VMAbv, O,
-#define use_offset_0x11280u 4040
+#define use_offset_0x11280u 4048
/* Multani */
@@ -545,11 +553,11 @@ static const USE_TABLE_ELEMENT_TYPE use_table[] = {
/* 11320 */ B, B, B, B, B, B, B, B, B, O, B, B, B, B, B, B,
/* 11330 */ B, O, B, B, O, B, B, B, B, B, O, O, CMBlw, B, VPst, VPst,
/* 11340 */ VAbv, VPst, VPst, VPst, VPst, O, O, VPre, VPre, O, O, VPre, VPre, H, O, O,
- /* 11350 */ O, O, O, O, O, O, O, VPst, O, O, O, O, O, O, O, O,
+ /* 11350 */ O, O, O, O, O, O, O, VPst, O, O, O, O, O, O, B, B,
/* 11360 */ B, B, VPst, VPst, O, O, VMAbv, VMAbv, VMAbv, VMAbv, VMAbv, VMAbv, VMAbv, O, O, O,
/* 11370 */ VMAbv, VMAbv, VMAbv, VMAbv, VMAbv, O, O, O,
-#define use_offset_0x11400u 4288
+#define use_offset_0x11400u 4296
/* Newa */
@@ -572,7 +580,7 @@ static const USE_TABLE_ELEMENT_TYPE use_table[] = {
/* 114C0 */ VMAbv, VMPst, H, CMBlw, B, O, O, O, O, O, O, O, O, O, O, O,
/* 114D0 */ B, B, B, B, B, B, B, B, B, B, O, O, O, O, O, O,
-#define use_offset_0x11580u 4512
+#define use_offset_0x11580u 4520
/* Siddham */
@@ -615,7 +623,26 @@ static const USE_TABLE_ELEMENT_TYPE use_table[] = {
/* 11720 */ VPst, VPst, VAbv, VAbv, VBlw, VBlw, VPre, VAbv, VBlw, VAbv, VAbv, VAbv, O, O, O, O,
/* 11730 */ B, B, B, B, B, B, B, B, B, B, B, B, O, O, O, O,
-#define use_offset_0x11c00u 4960
+#define use_offset_0x11a00u 4968
+
+
+ /* Zanabazar Square */
+
+ /* 11A00 */ B, VAbv, VBlw, VBlw, VAbv, VAbv, VAbv, VAbv, VAbv, VAbv, VBlw, B, B, B, B, B,
+ /* 11A10 */ B, B, B, B, B, B, B, B, B, B, B, B, B, B, B, B,
+ /* 11A20 */ B, B, B, B, B, B, B, B, B, B, B, B, B, B, B, B,
+ /* 11A30 */ B, B, B, FM, VBlw, VMAbv, VMAbv, VMAbv, VMAbv, VMPst, R, MBlw, MBlw, MBlw, MBlw, GB,
+ /* 11A40 */ O, O, O, O, O, GB, O, H, O, O, O, O, O, O, O, O,
+
+ /* Soyombo */
+
+ /* 11A50 */ B, VAbv, VBlw, VBlw, VAbv, VAbv, VAbv, VPst, VPst, VBlw, VBlw, VBlw, B, B, B, B,
+ /* 11A60 */ B, B, B, B, B, B, B, B, B, B, B, B, B, B, B, B,
+ /* 11A70 */ B, B, B, B, B, B, B, B, B, B, B, B, B, B, B, B,
+ /* 11A80 */ B, B, B, B, O, O, R, R, R, R, FBlw, FBlw, FBlw, FBlw, FBlw, FBlw,
+ /* 11A90 */ FBlw, FBlw, FBlw, FBlw, FBlw, FBlw, VMAbv, VMPst, CMAbv, H, O, O, O, O, O, O,
+
+#define use_offset_0x11c00u 5128
/* Bhaiksuki */
@@ -636,7 +663,19 @@ static const USE_TABLE_ELEMENT_TYPE use_table[] = {
/* 11CA0 */ SUB, SUB, SUB, SUB, SUB, SUB, SUB, SUB, O, SUB, SUB, SUB, SUB, SUB, SUB, SUB,
/* 11CB0 */ VBlw, VPre, VBlw, VAbv, VPst, VMAbv, VMAbv, O,
-}; /* Table items: 5144; occupancy: 72% */
+#define use_offset_0x11d00u 5312
+
+
+ /* Masaram Gondi */
+
+ /* 11D00 */ B, B, B, B, B, B, B, O, B, B, O, B, B, B, B, B,
+ /* 11D10 */ B, B, B, B, B, B, B, B, B, B, B, B, B, B, B, B,
+ /* 11D20 */ B, B, B, B, B, B, B, B, B, B, B, B, B, B, B, B,
+ /* 11D30 */ B, VAbv, VAbv, VAbv, VAbv, VAbv, VBlw, O, O, O, VAbv, O, VAbv, VAbv, O, VAbv,
+ /* 11D40 */ VMAbv, VMAbv, CMBlw, VAbv, VBlw, H, R, MBlw, O, O, O, O, O, O, O, O,
+ /* 11D50 */ B, B, B, B, B, B, B, B, B, B, O, O, O, O, O, O,
+
+}; /* Table items: 5408; occupancy: 73% */
USE_TABLE_ELEMENT_TYPE
hb_use_get_categories (hb_codepoint_t u)
@@ -644,47 +683,50 @@ hb_use_get_categories (hb_codepoint_t u)
switch (u >> 12)
{
case 0x0u:
- if (hb_in_range (u, 0x0028u, 0x003Fu)) return use_table[u - 0x0028u + use_offset_0x0028u];
- if (hb_in_range (u, 0x00A0u, 0x00D7u)) return use_table[u - 0x00A0u + use_offset_0x00a0u];
- if (hb_in_range (u, 0x0900u, 0x0DF7u)) return use_table[u - 0x0900u + use_offset_0x0900u];
+ if (hb_in_range<hb_codepoint_t> (u, 0x0028u, 0x003Fu)) return use_table[u - 0x0028u + use_offset_0x0028u];
+ if (hb_in_range<hb_codepoint_t> (u, 0x00A0u, 0x00D7u)) return use_table[u - 0x00A0u + use_offset_0x00a0u];
+ if (hb_in_range<hb_codepoint_t> (u, 0x0900u, 0x0DF7u)) return use_table[u - 0x0900u + use_offset_0x0900u];
if (unlikely (u == 0x034Fu)) return CGJ;
break;
case 0x1u:
- if (hb_in_range (u, 0x1000u, 0x109Fu)) return use_table[u - 0x1000u + use_offset_0x1000u];
- if (hb_in_range (u, 0x1700u, 0x17EFu)) return use_table[u - 0x1700u + use_offset_0x1700u];
- if (hb_in_range (u, 0x1900u, 0x1A9Fu)) return use_table[u - 0x1900u + use_offset_0x1900u];
- if (hb_in_range (u, 0x1B00u, 0x1C4Fu)) return use_table[u - 0x1B00u + use_offset_0x1b00u];
- if (hb_in_range (u, 0x1CD0u, 0x1CFFu)) return use_table[u - 0x1CD0u + use_offset_0x1cd0u];
- if (hb_in_range (u, 0x1DF8u, 0x1DFFu)) return use_table[u - 0x1DF8u + use_offset_0x1df8u];
+ if (hb_in_range<hb_codepoint_t> (u, 0x1000u, 0x109Fu)) return use_table[u - 0x1000u + use_offset_0x1000u];
+ if (hb_in_range<hb_codepoint_t> (u, 0x1700u, 0x17EFu)) return use_table[u - 0x1700u + use_offset_0x1700u];
+ if (hb_in_range<hb_codepoint_t> (u, 0x1900u, 0x1A9Fu)) return use_table[u - 0x1900u + use_offset_0x1900u];
+ if (hb_in_range<hb_codepoint_t> (u, 0x1B00u, 0x1C4Fu)) return use_table[u - 0x1B00u + use_offset_0x1b00u];
+ if (hb_in_range<hb_codepoint_t> (u, 0x1CD0u, 0x1CFFu)) return use_table[u - 0x1CD0u + use_offset_0x1cd0u];
+ if (hb_in_range<hb_codepoint_t> (u, 0x1DF8u, 0x1DFFu)) return use_table[u - 0x1DF8u + use_offset_0x1df8u];
break;
case 0x2u:
- if (hb_in_range (u, 0x2008u, 0x2017u)) return use_table[u - 0x2008u + use_offset_0x2008u];
- if (hb_in_range (u, 0x2060u, 0x2087u)) return use_table[u - 0x2060u + use_offset_0x2060u];
+ if (hb_in_range<hb_codepoint_t> (u, 0x2008u, 0x2017u)) return use_table[u - 0x2008u + use_offset_0x2008u];
+ if (hb_in_range<hb_codepoint_t> (u, 0x2060u, 0x2087u)) return use_table[u - 0x2060u + use_offset_0x2060u];
+ if (hb_in_range<hb_codepoint_t> (u, 0x20F0u, 0x20F7u)) return use_table[u - 0x20F0u + use_offset_0x20f0u];
if (unlikely (u == 0x25CCu)) return GB;
break;
case 0xAu:
- if (hb_in_range (u, 0xA800u, 0xAAF7u)) return use_table[u - 0xA800u + use_offset_0xa800u];
- if (hb_in_range (u, 0xABC0u, 0xABFFu)) return use_table[u - 0xABC0u + use_offset_0xabc0u];
+ if (hb_in_range<hb_codepoint_t> (u, 0xA800u, 0xAAF7u)) return use_table[u - 0xA800u + use_offset_0xa800u];
+ if (hb_in_range<hb_codepoint_t> (u, 0xABC0u, 0xABFFu)) return use_table[u - 0xABC0u + use_offset_0xabc0u];
break;
case 0xFu:
- if (hb_in_range (u, 0xFE00u, 0xFE0Fu)) return use_table[u - 0xFE00u + use_offset_0xfe00u];
+ if (hb_in_range<hb_codepoint_t> (u, 0xFE00u, 0xFE0Fu)) return use_table[u - 0xFE00u + use_offset_0xfe00u];
break;
case 0x10u:
- if (hb_in_range (u, 0x10A00u, 0x10A47u)) return use_table[u - 0x10A00u + use_offset_0x10a00u];
+ if (hb_in_range<hb_codepoint_t> (u, 0x10A00u, 0x10A47u)) return use_table[u - 0x10A00u + use_offset_0x10a00u];
break;
case 0x11u:
- if (hb_in_range (u, 0x11000u, 0x110BFu)) return use_table[u - 0x11000u + use_offset_0x11000u];
- if (hb_in_range (u, 0x11100u, 0x1123Fu)) return use_table[u - 0x11100u + use_offset_0x11100u];
- if (hb_in_range (u, 0x11280u, 0x11377u)) return use_table[u - 0x11280u + use_offset_0x11280u];
- if (hb_in_range (u, 0x11400u, 0x114DFu)) return use_table[u - 0x11400u + use_offset_0x11400u];
- if (hb_in_range (u, 0x11580u, 0x1173Fu)) return use_table[u - 0x11580u + use_offset_0x11580u];
- if (hb_in_range (u, 0x11C00u, 0x11CB7u)) return use_table[u - 0x11C00u + use_offset_0x11c00u];
+ if (hb_in_range<hb_codepoint_t> (u, 0x11000u, 0x110BFu)) return use_table[u - 0x11000u + use_offset_0x11000u];
+ if (hb_in_range<hb_codepoint_t> (u, 0x11100u, 0x1123Fu)) return use_table[u - 0x11100u + use_offset_0x11100u];
+ if (hb_in_range<hb_codepoint_t> (u, 0x11280u, 0x11377u)) return use_table[u - 0x11280u + use_offset_0x11280u];
+ if (hb_in_range<hb_codepoint_t> (u, 0x11400u, 0x114DFu)) return use_table[u - 0x11400u + use_offset_0x11400u];
+ if (hb_in_range<hb_codepoint_t> (u, 0x11580u, 0x1173Fu)) return use_table[u - 0x11580u + use_offset_0x11580u];
+ if (hb_in_range<hb_codepoint_t> (u, 0x11A00u, 0x11A9Fu)) return use_table[u - 0x11A00u + use_offset_0x11a00u];
+ if (hb_in_range<hb_codepoint_t> (u, 0x11C00u, 0x11CB7u)) return use_table[u - 0x11C00u + use_offset_0x11c00u];
+ if (hb_in_range<hb_codepoint_t> (u, 0x11D00u, 0x11D5Fu)) return use_table[u - 0x11D00u + use_offset_0x11d00u];
if (unlikely (u == 0x1107Fu)) return HN;
break;
@@ -696,6 +738,7 @@ hb_use_get_categories (hb_codepoint_t u)
#undef B
#undef CGJ
+#undef CS
#undef FM
#undef GB
#undef H
diff --git a/src/3rdparty/harfbuzz-ng/src/hb-ot-shape-complex-use.cc b/src/3rdparty/harfbuzz-ng/src/hb-ot-shape-complex-use.cc
index 5b19d5d74a..62acd697bd 100644
--- a/src/3rdparty/harfbuzz-ng/src/hb-ot-shape-complex-use.cc
+++ b/src/3rdparty/harfbuzz-ng/src/hb-ot-shape-complex-use.cc
@@ -144,7 +144,7 @@ collect_features_use (hb_ot_shape_planner_t *plan)
/* "Topographical features" */
for (unsigned int i = 0; i < ARRAY_LENGTH (arabic_features); i++)
map->add_feature (arabic_features[i], 1, F_NONE);
- map->add_gsub_pause (NULL);
+ map->add_gsub_pause (nullptr);
/* "Standard typographic presentation" and "Positional feature application" */
for (unsigned int i = 0; i < ARRAY_LENGTH (other_features); i++)
@@ -199,7 +199,7 @@ data_create_use (const hb_ot_shape_plan_t *plan)
{
use_shape_plan_t *use_plan = (use_shape_plan_t *) calloc (1, sizeof (use_shape_plan_t));
if (unlikely (!use_plan))
- return NULL;
+ return nullptr;
use_plan->rphf_mask = plan->map.get_1_mask (HB_TAG('r','p','h','f'));
@@ -209,7 +209,7 @@ data_create_use (const hb_ot_shape_plan_t *plan)
if (unlikely (!use_plan->arabic_plan))
{
free (use_plan);
- return NULL;
+ return nullptr;
}
}
@@ -292,7 +292,7 @@ setup_topographical_masks (const hb_ot_shape_plan_t *plan,
if (use_plan->arabic_plan)
return;
- ASSERT_STATIC (INIT < 4 && ISOL < 4 && MEDI < 4 && FINA < 4);
+ static_assert ((INIT < 4 && ISOL < 4 && MEDI < 4 && FINA < 4), "");
hb_mask_t masks[4], all_masks = 0;
for (unsigned int i = 0; i < 4; i++)
{
@@ -354,6 +354,8 @@ setup_syllables (const hb_ot_shape_plan_t *plan,
hb_buffer_t *buffer)
{
find_syllables (buffer);
+ foreach_syllable (buffer, start, end)
+ buffer->unsafe_to_break (start, end);
setup_rphf_mask (plan, buffer);
setup_topographical_masks (plan, buffer);
}
@@ -422,7 +424,7 @@ reorder_syllable (hb_buffer_t *buffer, unsigned int start, unsigned int end)
{
syllable_type_t syllable_type = (syllable_type_t) (buffer->info[start].syllable() & 0x0F);
/* Only a few syllable types need reordering. */
- if (unlikely (!(FLAG_SAFE (syllable_type) &
+ if (unlikely (!(FLAG_UNSAFE (syllable_type) &
(FLAG (virama_terminated_cluster) |
FLAG (standard_cluster) |
FLAG (broken_cluster) |
@@ -572,28 +574,6 @@ decompose_use (const hb_ot_shape_normalize_context_t *c,
*/
case 0x1112Eu : *a = 0x11127u; *b= 0x11131u; return true;
case 0x1112Fu : *a = 0x11127u; *b= 0x11132u; return true;
-
- /*
- * Decompose split matras that don't have Unicode decompositions.
- */
-
- /* Limbu */
- case 0x1925u : *a = 0x1920u; *b= 0x1923u; return true;
- case 0x1926u : *a = 0x1920u; *b= 0x1924u; return true;
-
- /* Balinese */
- case 0x1B3Cu : *a = 0x1B42u; *b= 0x1B3Cu; return true;
-
-#if 0
- /* Lepcha */
- case 0x1C29u : *a = no decomp, -> LEFT; return true;
-
- /* Javanese */
- case 0xA9C0u : *a = no decomp, -> RIGHT; return true;
-
- /* Sharada */
- case 0x111BFu : *a = no decomp, -> ABOVE; return true;
-#endif
}
return (bool) c->unicode->decompose (ab, a, b);
@@ -615,18 +595,18 @@ compose_use (const hb_ot_shape_normalize_context_t *c,
const hb_ot_complex_shaper_t _hb_ot_complex_shaper_use =
{
- "use",
collect_features_use,
- NULL, /* override_features */
+ nullptr, /* override_features */
data_create_use,
data_destroy_use,
- NULL, /* preprocess_text */
- NULL, /* postprocess_glyphs */
+ nullptr, /* preprocess_text */
+ nullptr, /* postprocess_glyphs */
HB_OT_SHAPE_NORMALIZATION_MODE_COMPOSED_DIACRITICS_NO_SHORT_CIRCUIT,
decompose_use,
compose_use,
setup_masks_use,
- NULL, /* disable_otl */
+ nullptr, /* disable_otl */
+ nullptr, /* reorder_marks */
HB_OT_SHAPE_ZERO_WIDTH_MARKS_BY_GDEF_EARLY,
false, /* fallback_position */
};
diff --git a/src/3rdparty/harfbuzz-ng/src/hb-ot-shape-fallback.cc b/src/3rdparty/harfbuzz-ng/src/hb-ot-shape-fallback.cc
index ea8312b223..458c8eaa04 100644
--- a/src/3rdparty/harfbuzz-ng/src/hb-ot-shape-fallback.cc
+++ b/src/3rdparty/harfbuzz-ng/src/hb-ot-shape-fallback.cc
@@ -210,7 +210,7 @@ position_mark (const hb_ot_shape_plan_t *plan,
pos.x_offset = pos.y_offset = 0;
- /* We dont position LEFT and RIGHT marks. */
+ /* We don't position LEFT and RIGHT marks. */
/* X positioning */
switch (combining_class)
@@ -218,10 +218,10 @@ position_mark (const hb_ot_shape_plan_t *plan,
case HB_UNICODE_COMBINING_CLASS_DOUBLE_BELOW:
case HB_UNICODE_COMBINING_CLASS_DOUBLE_ABOVE:
if (buffer->props.direction == HB_DIRECTION_LTR) {
- pos.x_offset += base_extents.x_bearing - mark_extents.width / 2 - mark_extents.x_bearing;
+ pos.x_offset += base_extents.x_bearing + base_extents.width - mark_extents.width / 2 - mark_extents.x_bearing;
break;
} else if (buffer->props.direction == HB_DIRECTION_RTL) {
- pos.x_offset += base_extents.x_bearing + base_extents.width - mark_extents.width / 2 - mark_extents.x_bearing;
+ pos.x_offset += base_extents.x_bearing - mark_extents.width / 2 - mark_extents.x_bearing;
break;
}
HB_FALLTHROUGH;
@@ -307,6 +307,9 @@ position_around_base (const hb_ot_shape_plan_t *plan,
unsigned int end)
{
hb_direction_t horiz_dir = HB_DIRECTION_INVALID;
+
+ buffer->unsafe_to_break (base, end);
+
hb_glyph_extents_t base_extents;
if (!font->get_glyph_extents (buffer->info[base].codepoint,
&base_extents))
diff --git a/src/3rdparty/harfbuzz-ng/src/hb-ot-shape-normalize.cc b/src/3rdparty/harfbuzz-ng/src/hb-ot-shape-normalize.cc
index 107617e81c..fd9e7c2a8d 100644
--- a/src/3rdparty/harfbuzz-ng/src/hb-ot-shape-normalize.cc
+++ b/src/3rdparty/harfbuzz-ng/src/hb-ot-shape-normalize.cc
@@ -91,7 +91,7 @@ compose_unicode (const hb_ot_shape_normalize_context_t *c,
static inline void
set_glyph (hb_glyph_info_t &info, hb_font_t *font)
{
- font->get_nominal_glyph (info.codepoint, &info.glyph_index());
+ (void) font->get_nominal_glyph (info.codepoint, &info.glyph_index());
}
static inline void
@@ -345,14 +345,18 @@ _hb_ot_shape_normalize (const hb_ot_shape_plan_t *plan,
if (_hb_glyph_info_get_modified_combining_class (&buffer->info[end]) == 0)
break;
- /* We are going to do a O(n^2). Only do this if the sequence is short. */
- if (end - i > 10) {
+ /* We are going to do a O(n^2). Only do this if the sequence is short,
+ * but not too short ;). */
+ if (end - i < 2 || end - i > HB_OT_SHAPE_COMPLEX_MAX_COMBINING_MARKS) {
i = end;
continue;
}
buffer->sort (i, end, compare_combining_class);
+ if (plan->shaper->reorder_marks)
+ plan->shaper->reorder_marks (plan, buffer, i, end);
+
i = end;
}
@@ -369,46 +373,58 @@ _hb_ot_shape_normalize (const hb_ot_shape_plan_t *plan,
buffer->clear_output ();
count = buffer->len;
unsigned int starter = 0;
+ bool combine = true;
buffer->next_glyph ();
while (buffer->idx < count && !buffer->in_error)
{
hb_codepoint_t composed, glyph;
- if (/* We don't try to compose a non-mark character with it's preceding starter.
+ if (combine &&
+ /* We don't try to compose a non-mark character with it's preceding starter.
* This is both an optimization to avoid trying to compose every two neighboring
* glyphs in most scripts AND a desired feature for Hangul. Apparently Hangul
* fonts are not designed to mix-and-match pre-composed syllables and Jamo. */
- HB_UNICODE_GENERAL_CATEGORY_IS_MARK (_hb_glyph_info_get_general_category (&buffer->cur())) &&
- /* If there's anything between the starter and this char, they should have CCC
- * smaller than this character's. */
- (starter == buffer->out_len - 1 ||
- _hb_glyph_info_get_modified_combining_class (&buffer->prev()) < _hb_glyph_info_get_modified_combining_class (&buffer->cur())) &&
- /* And compose. */
- c.compose (&c,
- buffer->out_info[starter].codepoint,
- buffer->cur().codepoint,
- &composed) &&
- /* And the font has glyph for the composite. */
- font->get_nominal_glyph (composed, &glyph))
+ HB_UNICODE_GENERAL_CATEGORY_IS_MARK (_hb_glyph_info_get_general_category (&buffer->cur())))
{
- /* Composes. */
- buffer->next_glyph (); /* Copy to out-buffer. */
- if (unlikely (buffer->in_error))
- return;
- buffer->merge_out_clusters (starter, buffer->out_len);
- buffer->out_len--; /* Remove the second composable. */
- /* Modify starter and carry on. */
- buffer->out_info[starter].codepoint = composed;
- buffer->out_info[starter].glyph_index() = glyph;
- _hb_glyph_info_set_unicode_props (&buffer->out_info[starter], buffer);
-
- continue;
+ if (/* If there's anything between the starter and this char, they should have CCC
+ * smaller than this character's. */
+ (starter == buffer->out_len - 1 ||
+ info_cc (buffer->prev()) < info_cc (buffer->cur())) &&
+ /* And compose. */
+ c.compose (&c,
+ buffer->out_info[starter].codepoint,
+ buffer->cur().codepoint,
+ &composed) &&
+ /* And the font has glyph for the composite. */
+ font->get_nominal_glyph (composed, &glyph))
+ {
+ /* Composes. */
+ buffer->next_glyph (); /* Copy to out-buffer. */
+ if (unlikely (buffer->in_error))
+ return;
+ buffer->merge_out_clusters (starter, buffer->out_len);
+ buffer->out_len--; /* Remove the second composable. */
+ /* Modify starter and carry on. */
+ buffer->out_info[starter].codepoint = composed;
+ buffer->out_info[starter].glyph_index() = glyph;
+ _hb_glyph_info_set_unicode_props (&buffer->out_info[starter], buffer);
+
+ continue;
+ }
+ else if (/* We sometimes custom-tailor the sorted order of marks. In that case, stop
+ * trying to combine as soon as combining-class drops. */
+ starter < buffer->out_len - 1 &&
+ info_cc (buffer->prev()) > info_cc (buffer->cur()))
+ combine = false;
}
/* Blocked, or doesn't compose. */
buffer->next_glyph ();
- if (_hb_glyph_info_get_modified_combining_class (&buffer->prev()) == 0)
+ if (info_cc (buffer->prev()) == 0)
+ {
starter = buffer->out_len - 1;
+ combine = true;
+ }
}
buffer->swap_buffers ();
diff --git a/src/3rdparty/harfbuzz-ng/src/hb-ot-shape-private.hh b/src/3rdparty/harfbuzz-ng/src/hb-ot-shape-private.hh
index 594e54c026..fe5d2b7f33 100644
--- a/src/3rdparty/harfbuzz-ng/src/hb-ot-shape-private.hh
+++ b/src/3rdparty/harfbuzz-ng/src/hb-ot-shape-private.hh
@@ -73,7 +73,7 @@ struct hb_ot_shape_planner_t
hb_ot_shape_planner_t (const hb_shape_plan_t *master_plan) :
face (master_plan->face_unsafe),
props (master_plan->props),
- shaper (NULL),
+ shaper (nullptr),
map (face, &props) {}
~hb_ot_shape_planner_t (void) { map.finish (); }
@@ -99,7 +99,9 @@ struct hb_ot_shape_planner_t
}
private:
- NO_COPY (hb_ot_shape_planner_t);
+ /* No copy. */
+ hb_ot_shape_planner_t (const hb_ot_shape_planner_t &);
+ hb_ot_shape_planner_t &operator = (const hb_ot_shape_planner_t &);
};
diff --git a/src/3rdparty/harfbuzz-ng/src/hb-ot-shape.cc b/src/3rdparty/harfbuzz-ng/src/hb-ot-shape.cc
index ddd6662e84..2f28b5620d 100644
--- a/src/3rdparty/harfbuzz-ng/src/hb-ot-shape.cc
+++ b/src/3rdparty/harfbuzz-ng/src/hb-ot-shape.cc
@@ -70,7 +70,7 @@ hb_ot_shape_collect_features (hb_ot_shape_planner_t *planner,
hb_ot_map_builder_t *map = &planner->map;
map->add_global_bool_feature (HB_TAG('r','v','r','n'));
- map->add_gsub_pause (NULL);
+ map->add_gsub_pause (nullptr);
switch (props->direction) {
case HB_DIRECTION_LTR:
@@ -108,7 +108,7 @@ hb_ot_shape_collect_features (hb_ot_shape_planner_t *planner,
/* We really want to find a 'vert' feature if there's any in the font, no
* matter which script/langsys it is listed (or not) under.
* See various bugs referenced from:
- * https://github.com/behdad/harfbuzz/issues/63 */
+ * https://github.com/harfbuzz/harfbuzz/issues/63 */
map->add_feature (HB_TAG ('v','e','r','t'), 1, F_GLOBAL | F_GLOBAL_SEARCH);
}
@@ -128,6 +128,8 @@ hb_ot_shape_collect_features (hb_ot_shape_planner_t *planner,
* shaper face data
*/
+HB_SHAPER_DATA_ENSURE_DEFINE(ot, face)
+
hb_ot_shaper_face_data_t *
_hb_ot_shaper_face_data_create (hb_face_t *face)
{
@@ -145,6 +147,8 @@ _hb_ot_shaper_face_data_destroy (hb_ot_shaper_face_data_t *data)
* shaper font data
*/
+HB_SHAPER_DATA_ENSURE_DEFINE(ot, font)
+
struct hb_ot_shaper_font_data_t {};
hb_ot_shaper_font_data_t *
@@ -172,7 +176,7 @@ _hb_ot_shaper_shape_plan_data_create (hb_shape_plan_t *shape_plan,
{
hb_ot_shape_plan_t *plan = (hb_ot_shape_plan_t *) calloc (1, sizeof (hb_ot_shape_plan_t));
if (unlikely (!plan))
- return NULL;
+ return nullptr;
hb_ot_shape_planner_t planner (shape_plan);
@@ -186,7 +190,7 @@ _hb_ot_shaper_shape_plan_data_create (hb_shape_plan_t *shape_plan,
if (plan->shaper->data_create) {
plan->data = plan->shaper->data_create (plan);
if (unlikely (!plan->data))
- return NULL;
+ return nullptr;
}
return plan;
@@ -271,8 +275,7 @@ hb_insert_dotted_circle (hb_buffer_t *buffer, hb_font_t *font)
static void
hb_form_clusters (hb_buffer_t *buffer)
{
- if (!(buffer->scratch_flags & HB_BUFFER_SCRATCH_FLAG_HAS_NON_ASCII) ||
- buffer->cluster_level != HB_BUFFER_CLUSTER_LEVEL_MONOTONE_GRAPHEMES)
+ if (!(buffer->scratch_flags & HB_BUFFER_SCRATCH_FLAG_HAS_NON_ASCII))
return;
/* Loop duplicated in hb_ensure_native_direction(), and in _hb-coretext.cc */
@@ -284,11 +287,17 @@ hb_form_clusters (hb_buffer_t *buffer)
if (likely (!HB_UNICODE_GENERAL_CATEGORY_IS_MARK (_hb_glyph_info_get_general_category (&info[i])) &&
!_hb_glyph_info_is_joiner (&info[i])))
{
- buffer->merge_clusters (base, i);
+ if (buffer->cluster_level == HB_BUFFER_CLUSTER_LEVEL_MONOTONE_GRAPHEMES)
+ buffer->merge_clusters (base, i);
+ else
+ buffer->unsafe_to_break (base, i);
base = i;
}
}
- buffer->merge_clusters (base, count);
+ if (buffer->cluster_level == HB_BUFFER_CLUSTER_LEVEL_MONOTONE_GRAPHEMES)
+ buffer->merge_clusters (base, count);
+ else
+ buffer->unsafe_to_break (base, count);
}
static void
@@ -362,7 +371,18 @@ hb_ot_shape_setup_masks_fraction (hb_ot_shape_context_t *c)
hb_buffer_t *buffer = c->buffer;
- /* TODO look in pre/post context text also. */
+ hb_mask_t pre_mask, post_mask;
+ if (HB_DIRECTION_IS_FORWARD (buffer->props.direction))
+ {
+ pre_mask = c->plan->numr_mask | c->plan->frac_mask;
+ post_mask = c->plan->frac_mask | c->plan->dnom_mask;
+ }
+ else
+ {
+ pre_mask = c->plan->frac_mask | c->plan->dnom_mask;
+ post_mask = c->plan->numr_mask | c->plan->frac_mask;
+ }
+
unsigned int count = buffer->len;
hb_glyph_info_t *info = buffer->info;
for (unsigned int i = 0; i < count; i++)
@@ -379,11 +399,13 @@ hb_ot_shape_setup_masks_fraction (hb_ot_shape_context_t *c)
HB_UNICODE_GENERAL_CATEGORY_DECIMAL_NUMBER)
end++;
+ buffer->unsafe_to_break (start, end);
+
for (unsigned int j = start; j < i; j++)
- info[j].mask |= c->plan->numr_mask | c->plan->frac_mask;
+ info[j].mask |= pre_mask;
info[i].mask |= c->plan->frac_mask;
for (unsigned int j = i + 1; j < end; j++)
- info[j].mask |= c->plan->frac_mask | c->plan->dnom_mask;
+ info[j].mask |= post_mask;
i = end - 1;
}
@@ -494,9 +516,10 @@ hb_ot_hide_default_ignorables (hb_ot_shape_context_t *c)
/* Merge cluster backward. */
if (cluster < info[j - 1].cluster)
{
+ unsigned int mask = info[i].mask;
unsigned int old_cluster = info[j - 1].cluster;
for (unsigned k = j; k && info[k - 1].cluster == old_cluster; k--)
- info[k - 1].cluster = cluster;
+ buffer->set_cluster (info[k - 1], cluster, mask);
}
continue;
}
@@ -562,8 +585,6 @@ hb_ot_substitute_default (hb_ot_shape_context_t *c)
{
hb_buffer_t *buffer = c->buffer;
- hb_ot_shape_initialize_masks (c);
-
hb_ot_mirror_chars (c);
HB_BUFFER_ALLOCATE_VAR (buffer, glyph_index);
@@ -672,9 +693,9 @@ hb_ot_position_default (hb_ot_shape_context_t *c)
static inline void
hb_ot_position_complex (hb_ot_shape_context_t *c)
{
- hb_ot_layout_position_start (c->font, c->buffer);
-
unsigned int count = c->buffer->len;
+ hb_glyph_info_t *info = c->buffer->info;
+ hb_glyph_position_t *pos = c->buffer->pos;
/* If the font has no GPOS, AND, no fallback positioning will
* happen, AND, direction is forward, then when zeroing mark
@@ -689,6 +710,17 @@ hb_ot_position_complex (hb_ot_shape_context_t *c)
!c->plan->shaper->fallback_position &&
HB_DIRECTION_IS_FORWARD (c->buffer->props.direction);
+ /* We change glyph origin to what GPOS expects (horizontal), apply GPOS, change it back. */
+
+ /* The nil glyph_h_origin() func returns 0, so no need to apply it. */
+ if (c->font->has_glyph_h_origin_func ())
+ for (unsigned int i = 0; i < count; i++)
+ c->font->add_glyph_h_origin (info[i].codepoint,
+ &pos[i].x_offset,
+ &pos[i].y_offset);
+
+ hb_ot_layout_position_start (c->font, c->buffer);
+
switch (c->plan->shaper->zero_width_marks)
{
case HB_OT_SHAPE_ZERO_WIDTH_MARKS_BY_GDEF_EARLY:
@@ -702,30 +734,8 @@ hb_ot_position_complex (hb_ot_shape_context_t *c)
}
if (likely (!c->fallback_positioning))
- {
- hb_glyph_info_t *info = c->buffer->info;
- hb_glyph_position_t *pos = c->buffer->pos;
-
- /* Change glyph origin to what GPOS expects (horizontal), apply GPOS, change it back. */
-
- /* The nil glyph_h_origin() func returns 0, so no need to apply it. */
- if (c->font->has_glyph_h_origin_func ())
- for (unsigned int i = 0; i < count; i++)
- c->font->add_glyph_h_origin (info[i].codepoint,
- &pos[i].x_offset,
- &pos[i].y_offset);
-
c->plan->position (c->font, c->buffer);
- /* The nil glyph_h_origin() func returns 0, so no need to apply it. */
- if (c->font->has_glyph_h_origin_func ())
- for (unsigned int i = 0; i < count; i++)
- c->font->subtract_glyph_h_origin (info[i].codepoint,
- &pos[i].x_offset,
- &pos[i].y_offset);
-
- }
-
switch (c->plan->shaper->zero_width_marks)
{
case HB_OT_SHAPE_ZERO_WIDTH_MARKS_BY_GDEF_LATE:
@@ -742,6 +752,13 @@ hb_ot_position_complex (hb_ot_shape_context_t *c)
hb_ot_layout_position_finish_advances (c->font, c->buffer);
hb_ot_zero_width_default_ignorables (c);
hb_ot_layout_position_finish_offsets (c->font, c->buffer);
+
+ /* The nil glyph_h_origin() func returns 0, so no need to apply it. */
+ if (c->font->has_glyph_h_origin_func ())
+ for (unsigned int i = 0; i < count; i++)
+ c->font->subtract_glyph_h_origin (info[i].codepoint,
+ &pos[i].x_offset,
+ &pos[i].y_offset);
}
static inline void
@@ -767,6 +784,31 @@ hb_ot_position (hb_ot_shape_context_t *c)
_hb_buffer_deallocate_gsubgpos_vars (c->buffer);
}
+static inline void
+hb_propagate_flags (hb_buffer_t *buffer)
+{
+ /* Propagate cluster-level glyph flags to be the same on all cluster glyphs.
+ * Simplifies using them. */
+
+ if (!(buffer->scratch_flags & HB_BUFFER_SCRATCH_FLAG_HAS_UNSAFE_TO_BREAK))
+ return;
+
+ hb_glyph_info_t *info = buffer->info;
+
+ foreach_cluster (buffer, start, end)
+ {
+ unsigned int mask = 0;
+ for (unsigned int i = start; i < end; i++)
+ if (info[i].mask & HB_GLYPH_FLAG_UNSAFE_TO_BREAK)
+ {
+ mask = HB_GLYPH_FLAG_UNSAFE_TO_BREAK;
+ break;
+ }
+ if (mask)
+ for (unsigned int i = start; i < end; i++)
+ info[i].mask |= mask;
+ }
+}
/* Pull it all together! */
@@ -775,11 +817,16 @@ hb_ot_shape_internal (hb_ot_shape_context_t *c)
{
c->buffer->deallocate_var_all ();
c->buffer->scratch_flags = HB_BUFFER_SCRATCH_FLAG_DEFAULT;
- if (likely (!_hb_unsigned_int_mul_overflows (c->buffer->len, HB_BUFFER_MAX_EXPANSION_FACTOR)))
+ if (likely (!_hb_unsigned_int_mul_overflows (c->buffer->len, HB_BUFFER_MAX_LEN_FACTOR)))
{
- c->buffer->max_len = MAX (c->buffer->len * HB_BUFFER_MAX_EXPANSION_FACTOR,
+ c->buffer->max_len = MAX (c->buffer->len * HB_BUFFER_MAX_LEN_FACTOR,
(unsigned) HB_BUFFER_MAX_LEN_MIN);
}
+ if (likely (!_hb_unsigned_int_mul_overflows (c->buffer->len, HB_BUFFER_MAX_OPS_FACTOR)))
+ {
+ c->buffer->max_ops = MAX (c->buffer->len * HB_BUFFER_MAX_OPS_FACTOR,
+ (unsigned) HB_BUFFER_MAX_OPS_MIN);
+ }
bool disable_otl = c->plan->shaper->disable_otl && c->plan->shaper->disable_otl (c->plan);
//c->fallback_substitute = disable_otl || !hb_ot_layout_has_substitution (c->face);
@@ -793,8 +840,10 @@ hb_ot_shape_internal (hb_ot_shape_context_t *c)
c->buffer->clear_output ();
+ hb_ot_shape_initialize_masks (c);
hb_set_unicode_props (c->buffer);
hb_insert_dotted_circle (c->buffer, c->font);
+
hb_form_clusters (c->buffer);
hb_ensure_native_direction (c->buffer);
@@ -810,11 +859,14 @@ hb_ot_shape_internal (hb_ot_shape_context_t *c)
if (c->plan->shaper->postprocess_glyphs)
c->plan->shaper->postprocess_glyphs (c->plan, c->buffer, c->font);
+ hb_propagate_flags (c->buffer);
+
_hb_buffer_deallocate_unicode_vars (c->buffer);
c->buffer->props.direction = c->target_direction;
c->buffer->max_len = HB_BUFFER_MAX_LEN_DEFAULT;
+ c->buffer->max_ops = HB_BUFFER_MAX_OPS_DEFAULT;
c->buffer->deallocate_var_all ();
}
@@ -882,7 +934,7 @@ hb_ot_shape_glyphs_closure (hb_font_t *font,
{
hb_ot_shape_plan_t plan;
- const char *shapers[] = {"ot", NULL};
+ const char *shapers[] = {"ot", nullptr};
hb_shape_plan_t *shape_plan = hb_shape_plan_create_cached (font->face, &buffer->props,
features, num_features, shapers);
@@ -893,18 +945,19 @@ hb_ot_shape_glyphs_closure (hb_font_t *font,
for (unsigned int i = 0; i < count; i++)
add_char (font, buffer->unicode, mirror, info[i].codepoint, glyphs);
- hb_set_t lookups;
- lookups.init ();
- hb_ot_shape_plan_collect_lookups (shape_plan, HB_OT_TAG_GSUB, &lookups);
+ hb_set_t *lookups = hb_set_create ();
+ hb_ot_shape_plan_collect_lookups (shape_plan, HB_OT_TAG_GSUB, lookups);
/* And find transitive closure. */
- hb_set_t copy;
- copy.init ();
+ hb_set_t *copy = hb_set_create ();
do {
- copy.set (glyphs);
- for (hb_codepoint_t lookup_index = -1; hb_set_next (&lookups, &lookup_index);)
+ copy->set (glyphs);
+ for (hb_codepoint_t lookup_index = -1; hb_set_next (lookups, &lookup_index);)
hb_ot_layout_lookup_substitute_closure (font->face, lookup_index, glyphs);
- } while (!copy.is_equal (glyphs));
+ } while (!copy->is_equal (glyphs));
+ hb_set_destroy (copy);
+
+ hb_set_destroy (lookups);
hb_shape_plan_destroy (shape_plan);
}
diff --git a/src/3rdparty/harfbuzz-ng/src/hb-ot-tag.cc b/src/3rdparty/harfbuzz-ng/src/hb-ot-tag.cc
index 5f21ac0967..1338c31732 100644
--- a/src/3rdparty/harfbuzz-ng/src/hb-ot-tag.cc
+++ b/src/3rdparty/harfbuzz-ng/src/hb-ot-tag.cc
@@ -28,9 +28,6 @@
#include "hb-private.hh"
-#include <string.h>
-
-
/* hb_script_t */
@@ -201,6 +198,7 @@ static const LangTag ot_languages[] = {
{"alt", HB_TAG('A','L','T',' ')}, /* [Southern] Altai */
{"am", HB_TAG('A','M','H',' ')}, /* Amharic */
{"amf", HB_TAG('H','B','N',' ')}, /* Hammer-Banna */
+ {"amw", HB_TAG('S','Y','R',' ')}, /* Western Neo-Aramaic */
{"an", HB_TAG('A','R','G',' ')}, /* Aragonese */
{"ang", HB_TAG('A','N','G',' ')}, /* Old English (ca. 450-1100) */
{"ar", HB_TAG('A','R','A',' ')}, /* Arabic [macrolanguage] */
@@ -239,6 +237,7 @@ static const LangTag ot_languages[] = {
{"bg", HB_TAG('B','G','R',' ')}, /* Bulgarian */
{"bgc", HB_TAG('B','G','C',' ')}, /* Haryanvi */
{"bgq", HB_TAG('B','G','Q',' ')}, /* Bagri */
+ {"bgr", HB_TAG('Q','I','N',' ')}, /* Bawm Chin */
{"bhb", HB_TAG('B','H','I',' ')}, /* Bhili */
{"bhk", HB_TAG('B','I','K',' ')}, /* Albay Bicolano (retired code) */
{"bho", HB_TAG('B','H','O',' ')}, /* Bhojpuri */
@@ -270,18 +269,37 @@ static const LangTag ot_languages[] = {
{"ca", HB_TAG('C','A','T',' ')}, /* Catalan */
{"cak", HB_TAG('C','A','K',' ')}, /* Kaqchikel */
{"cbk", HB_TAG('C','B','K',' ')}, /* Chavacano */
+ {"cbl", HB_TAG('Q','I','N',' ')}, /* Bualkhaw Chin */
+ {"cco", HB_TAG('C','C','H','N')}, /* Chinantec */
{"ce", HB_TAG('C','H','E',' ')}, /* Chechen */
{"ceb", HB_TAG('C','E','B',' ')}, /* Cebuano */
+ {"cfm", HB_TAG('H','A','L',' ')}, /* Halam/Falam Chin */
{"cgg", HB_TAG('C','G','G',' ')}, /* Chiga */
{"ch", HB_TAG('C','H','A',' ')}, /* Chamorro */
+ {"chj", HB_TAG('C','C','H','N')}, /* Chinantec */
{"chk", HB_TAG('C','H','K','0')}, /* Chuukese */
{"cho", HB_TAG('C','H','O',' ')}, /* Choctaw */
{"chp", HB_TAG('C','H','P',' ')}, /* Chipewyan */
+ {"chq", HB_TAG('C','C','H','N')}, /* Chinantec */
{"chr", HB_TAG('C','H','R',' ')}, /* Cherokee */
{"chy", HB_TAG('C','H','Y',' ')}, /* Cheyenne */
+ {"chz", HB_TAG('C','C','H','N')}, /* Chinantec */
+ {"cja", HB_TAG('C','J','A',' ')}, /* Western Cham */
+ {"cjm", HB_TAG('C','J','M',' ')}, /* Eastern Cham */
+ {"cka", HB_TAG('Q','I','N',' ')}, /* Khumi Awa Chin */
{"ckb", HB_TAG('K','U','R',' ')}, /* Central Kurdish (Sorani) */
{"ckt", HB_TAG('C','H','K',' ')}, /* Chukchi */
+ {"cld", HB_TAG('S','Y','R',' ')}, /* Chaldean Neo-Aramaic */
+ {"cle", HB_TAG('C','C','H','N')}, /* Chinantec */
+ {"cmr", HB_TAG('Q','I','N',' ')}, /* Mro-Khimi Chin */
+ {"cnb", HB_TAG('Q','I','N',' ')}, /* Chinbon Chin */
+ {"cnh", HB_TAG('Q','I','N',' ')}, /* Hakha Chin */
+ {"cnk", HB_TAG('Q','I','N',' ')}, /* Khumi Chin */
+ {"cnl", HB_TAG('C','C','H','N')}, /* Chinantec */
+ {"cnt", HB_TAG('C','C','H','N')}, /* Chinantec */
+ {"cnw", HB_TAG('Q','I','N',' ')}, /* Ngawn Chin */
{"cop", HB_TAG('C','O','P',' ')}, /* Coptic */
+ {"cpa", HB_TAG('C','C','H','N')}, /* Chinantec */
{"cpp", HB_TAG('C','P','P',' ')}, /* Creoles */
{"cr", HB_TAG('C','R','E',' ')}, /* Cree */
{"cre", HB_TAG('Y','C','R',' ')}, /* Y-Cree */
@@ -292,15 +310,26 @@ static const LangTag ot_languages[] = {
{"crm", HB_TAG('M','C','R',' ')}, /* Moose Cree */
{"crx", HB_TAG('C','R','R',' ')}, /* Carrier */
{"cs", HB_TAG('C','S','Y',' ')}, /* Czech */
+ {"csa", HB_TAG('C','C','H','N')}, /* Chinantec */
{"csb", HB_TAG('C','S','B',' ')}, /* Kashubian */
+ {"csh", HB_TAG('Q','I','N',' ')}, /* Asho Chin */
+ {"cso", HB_TAG('C','C','H','N')}, /* Chinantec */
+ {"csy", HB_TAG('Q','I','N',' ')}, /* Siyin Chin */
+ {"ctd", HB_TAG('Q','I','N',' ')}, /* Tedim Chin */
+ {"cte", HB_TAG('C','C','H','N')}, /* Chinantec */
{"ctg", HB_TAG('C','T','G',' ')}, /* Chittagonian */
+ {"ctl", HB_TAG('C','C','H','N')}, /* Chinantec */
{"cts", HB_TAG('B','I','K',' ')}, /* Northern Catanduanes Bikol */
{"cu", HB_TAG('C','S','L',' ')}, /* Church Slavic */
+ {"cuc", HB_TAG('C','C','H','N')}, /* Chinantec */
{"cuk", HB_TAG('C','U','K',' ')}, /* San Blas Kuna */
{"cv", HB_TAG('C','H','U',' ')}, /* Chuvash */
+ {"cvn", HB_TAG('C','C','H','N')}, /* Chinantec */
{"cwd", HB_TAG('D','C','R',' ')}, /* Woods Cree */
{"cy", HB_TAG('W','E','L',' ')}, /* Welsh */
+ {"czt", HB_TAG('Q','I','N',' ')}, /* Zotung Chin */
{"da", HB_TAG('D','A','N',' ')}, /* Danish */
+ {"dao", HB_TAG('Q','I','N',' ')}, /* Daai Chin */
{"dap", HB_TAG('N','I','S',' ')}, /* Nisi (India) */
{"dar", HB_TAG('D','A','R',' ')}, /* Dargwa */
{"dax", HB_TAG('D','A','X',' ')}, /* Dayi */
@@ -343,7 +372,7 @@ static const LangTag ot_languages[] = {
{"fi", HB_TAG('F','I','N',' ')}, /* Finnish */
{"fil", HB_TAG('P','I','L',' ')}, /* Filipino */
{"fj", HB_TAG('F','J','I',' ')}, /* Fijian */
- {"flm", HB_TAG('H','A','L',' ')}, /* Halam */
+ {"flm", HB_TAG('H','A','L',' ')}, /* Halam/Falam Chin [retired ISO639 code] */
{"fo", HB_TAG('F','O','S',' ')}, /* Faroese */
{"fon", HB_TAG('F','O','N',' ')}, /* Fon */
{"fr", HB_TAG('F','R','A',' ')}, /* French */
@@ -365,7 +394,6 @@ static const LangTag ot_languages[] = {
{"gkp", HB_TAG('G','K','P',' ')}, /* Kpelle (Guinea) */
{"gl", HB_TAG('G','A','L',' ')}, /* Galician */
{"gld", HB_TAG('N','A','N',' ')}, /* Nanai */
- {"gle", HB_TAG('I','R','T',' ')}, /* Irish Traditional */
{"glk", HB_TAG('G','L','K',' ')}, /* Gilaki */
{"gn", HB_TAG('G','U','A',' ')}, /* Guarani [macrolanguage] */
{"gnn", HB_TAG('G','N','N',' ')}, /* Gumatj */
@@ -390,6 +418,7 @@ static const LangTag ot_languages[] = {
{"he", HB_TAG('I','W','R',' ')}, /* Hebrew */
{"hi", HB_TAG('H','I','N',' ')}, /* Hindi */
{"hil", HB_TAG('H','I','L',' ')}, /* Hiligaynon */
+ {"hlt", HB_TAG('Q','I','N',' ')}, /* Matu Chin */
{"hmn", HB_TAG('H','M','N',' ')}, /* Hmong */
{"hnd", HB_TAG('H','N','D',' ')}, /* [Southern] Hindko */
{"hne", HB_TAG('C','H','H',' ')}, /* Chattisgarhi */
@@ -522,7 +551,6 @@ static const LangTag ot_languages[] = {
{"mag", HB_TAG('M','A','G',' ')}, /* Magahi */
{"mai", HB_TAG('M','T','H',' ')}, /* Maithili */
{"mak", HB_TAG('M','K','R',' ')}, /* Makasar */
- {"mal", HB_TAG('M','A','L',' ')}, /* Malayalam */
{"mam", HB_TAG('M','A','M',' ')}, /* Mam */
{"man", HB_TAG('M','N','K',' ')}, /* Manding/Mandingo [macrolanguage] */
{"mdc", HB_TAG('M','L','E',' ')}, /* Male (Papua New Guinea) */
@@ -553,6 +581,7 @@ static const LangTag ot_languages[] = {
{"mos", HB_TAG('M','O','S',' ')}, /* Mossi */
{"mpe", HB_TAG('M','A','J',' ')}, /* Majang */
{"mr", HB_TAG('M','A','R',' ')}, /* Marathi */
+ {"mrh", HB_TAG('Q','I','N',' ')}, /* Mara Chin */
{"mrj", HB_TAG('H','M','A',' ')}, /* High Mari */
{"ms", HB_TAG('M','L','Y',' ')}, /* Malay [macrolanguage] */
{"msc", HB_TAG('M','N','K',' ')}, /* Sankaran Maninka */
@@ -617,6 +646,7 @@ static const LangTag ot_languages[] = {
{"pcc", HB_TAG('P','C','C',' ')}, /* Bouyei */
{"pcd", HB_TAG('P','C','D',' ')}, /* Picard */
{"pce", HB_TAG('P','L','G',' ')}, /* [Ruching] Palaung */
+ {"pck", HB_TAG('Q','I','N',' ')}, /* Paite Chin */
{"pdc", HB_TAG('P','D','C',' ')}, /* Pennsylvania German */
{"pes", HB_TAG('F','A','R',' ')}, /* Iranian Persian */
{"phk", HB_TAG('P','H','K',' ')}, /* Phake */
@@ -674,6 +704,7 @@ static const LangTag ot_languages[] = {
{"se", HB_TAG('N','S','M',' ')}, /* Northern Sami */
{"seh", HB_TAG('S','N','A',' ')}, /* Sena */
{"sel", HB_TAG('S','E','L',' ')}, /* Selkup */
+ {"sez", HB_TAG('Q','I','N',' ')}, /* Senthang Chin */
{"sg", HB_TAG('S','G','O',' ')}, /* Sango */
{"sga", HB_TAG('S','G','A',' ')}, /* Old Irish (to 900) */
{"sgs", HB_TAG('S','G','S',' ')}, /* Samogitian */
@@ -713,12 +744,15 @@ static const LangTag ot_languages[] = {
{"swh", HB_TAG('S','W','K',' ')}, /* Kiswahili/Swahili */
{"swv", HB_TAG('M','A','W',' ')}, /* Shekhawati */
{"sxu", HB_TAG('S','X','U',' ')}, /* Upper Saxon */
+ {"syc", HB_TAG('S','Y','R',' ')}, /* Classical Syriac */
{"syl", HB_TAG('S','Y','L',' ')}, /* Sylheti */
{"syr", HB_TAG('S','Y','R',' ')}, /* Syriac [macrolanguage] */
{"szl", HB_TAG('S','Z','L',' ')}, /* Silesian */
{"ta", HB_TAG('T','A','M',' ')}, /* Tamil */
{"tab", HB_TAG('T','A','B',' ')}, /* Tabasaran */
+ {"tcp", HB_TAG('Q','I','N',' ')}, /* Tawr Chin */
{"tcy", HB_TAG('T','U','L',' ')}, /* Tulu */
+ {"tcz", HB_TAG('Q','I','N',' ')}, /* Thado Chin */
{"tdd", HB_TAG('T','D','D',' ')}, /* Tai Nüa */
{"te", HB_TAG('T','E','L',' ')}, /* Telugu */
{"tem", HB_TAG('T','M','N',' ')}, /* Temne */
@@ -786,11 +820,13 @@ static const LangTag ot_languages[] = {
{"yap", HB_TAG('Y','A','P',' ')}, /* Yapese */
{"yi", HB_TAG('J','I','I',' ')}, /* Yiddish [macrolanguage] */
{"yo", HB_TAG('Y','B','A',' ')}, /* Yoruba */
+ {"yos", HB_TAG('Q','I','N',' ')}, /* Yos, deprecated by IANA in favor of Zou [zom] */
{"yso", HB_TAG('N','I','S',' ')}, /* Nisi (China) */
{"za", HB_TAG('Z','H','A',' ')}, /* Chuang/Zhuang [macrolanguage] */
{"zea", HB_TAG('Z','E','A',' ')}, /* Zeeuws */
{"zgh", HB_TAG('Z','G','H',' ')}, /* Standard Morrocan Tamazigh */
{"zne", HB_TAG('Z','N','D',' ')}, /* Zande */
+ {"zom", HB_TAG('Q','I','N',' ')}, /* Zou */
{"zu", HB_TAG('Z','U','L',' ')}, /* Zulu */
{"zum", HB_TAG('L','R','C',' ')}, /* Kumzari */
{"zza", HB_TAG('Z','Z','A',' ')}, /* Zazaki */
@@ -843,9 +879,11 @@ static const LangTagLong ot_languages_zh[] = {
};
static int
-lang_compare_first_component (const char *a,
- const char *b)
+lang_compare_first_component (const void *pa,
+ const void *pb)
{
+ const char *a = (const char *) pa;
+ const char *b = (const char *) pb;
unsigned int da, db;
const char *p;
@@ -882,12 +920,12 @@ hb_ot_tag_from_language (hb_language_t language)
char tag[4];
int i;
s += 6;
- for (i = 0; i < 4 && ISALPHA (s[i]); i++)
+ for (i = 0; i < 4 && ISALNUM (s[i]); i++)
tag[i] = TOUPPER (s[i]);
if (i) {
for (; i < 4; i++)
tag[i] = ' ';
- return HB_TAG_CHAR4 (tag);
+ return HB_TAG (tag[0], tag[1], tag[2], tag[3]);
}
}
@@ -907,12 +945,36 @@ hb_ot_tag_from_language (hb_language_t language)
return HB_TAG('A','P','P','H'); /* Phonetic transcription—Americanist conventions */
}
+ /*
+ * "Syre" is a BCP-47 script tag, meaning the Estrangela variant of the Syriac script.
+ * It can be applied to any language.
+ */
+ if (strstr (lang_str, "-syre")) {
+ return HB_TAG('S','Y','R','E'); /* Estrangela Syriac */
+ }
+
+ /*
+ * "Syrj" is a BCP-47 script tag, meaning the Western variant of the Syriac script.
+ * It can be applied to any language.
+ */
+ if (strstr (lang_str, "-syrj")) {
+ return HB_TAG('S','Y','R','J'); /* Western Syriac */
+ }
+
+ /*
+ * "Syrn" is a BCP-47 script tag, meaning the Eastern variant of the Syriac script.
+ * It can be applied to any language.
+ */
+ if (strstr (lang_str, "-syrn")) {
+ return HB_TAG('S','Y','R','N'); /* Eastern Syriac */
+ }
+
/* Find a language matching in the first component */
{
const LangTag *lang_tag;
lang_tag = (LangTag *) bsearch (lang_str, ot_languages,
ARRAY_LENGTH (ot_languages), sizeof (LangTag),
- (hb_compare_func_t) lang_compare_first_component);
+ lang_compare_first_component);
if (lang_tag)
return lang_tag->tag;
}
@@ -960,7 +1022,23 @@ hb_ot_tag_to_language (hb_tag_t tag)
unsigned int i;
if (tag == HB_OT_TAG_DEFAULT_LANGUAGE)
- return NULL;
+ return nullptr;
+
+ /* struct LangTag has only room for 3-letter language tags. */
+ switch (tag) {
+ case HB_TAG('A','P','P','H'): /* Phonetic transcription—Americanist conventions */
+ return hb_language_from_string ("und-fonnapa", -1);
+ case HB_TAG('I','P','P','H'): /* Phonetic transcription—IPA conventions */
+ return hb_language_from_string ("und-fonipa", -1);
+ case HB_TAG('S','Y','R',' '): /* Syriac [macrolanguage] */
+ return hb_language_from_string ("syr", -1);
+ case HB_TAG('S','Y','R','E'): /* Estrangela Syriac */
+ return hb_language_from_string ("und-Syre", -1);
+ case HB_TAG('S','Y','R','J'): /* Western Syriac */
+ return hb_language_from_string ("und-Syrj", -1);
+ case HB_TAG('S','Y','R','N'): /* Eastern Syriac */
+ return hb_language_from_string ("und-Syrn", -1);
+ }
for (i = 0; i < ARRAY_LENGTH (ot_languages); i++)
if (ot_languages[i].tag == tag)
@@ -976,14 +1054,6 @@ hb_ot_tag_to_language (hb_tag_t tag)
}
}
- /* struct LangTag has only room for 3-letter language tags. */
- switch (tag) {
- case HB_TAG('A','P','P','H'): /* Phonetic transcription—Americanist conventions */
- return hb_language_from_string ("und-fonnapa", -1);
- case HB_TAG('I','P','P','H'): /* Phonetic transcription—IPA conventions */
- return hb_language_from_string ("und-fonipa", -1);
- }
-
/* Else return a custom language in the form of "x-hbotABCD" */
{
unsigned char buf[11] = "x-hbot";
diff --git a/src/3rdparty/harfbuzz-ng/src/hb-ot-var-avar-table.hh b/src/3rdparty/harfbuzz-ng/src/hb-ot-var-avar-table.hh
new file mode 100644
index 0000000000..4b88a40304
--- /dev/null
+++ b/src/3rdparty/harfbuzz-ng/src/hb-ot-var-avar-table.hh
@@ -0,0 +1,149 @@
+/*
+ * Copyright © 2017 Google, Inc.
+ *
+ * This is part of HarfBuzz, a text shaping library.
+ *
+ * Permission is hereby granted, without written agreement and without
+ * license or royalty fees, to use, copy, modify, and distribute this
+ * software and its documentation for any purpose, provided that the
+ * above copyright notice and the following two paragraphs appear in
+ * all copies of this software.
+ *
+ * IN NO EVENT SHALL THE COPYRIGHT HOLDER BE LIABLE TO ANY PARTY FOR
+ * DIRECT, INDIRECT, SPECIAL, INCIDENTAL, OR CONSEQUENTIAL DAMAGES
+ * ARISING OUT OF THE USE OF THIS SOFTWARE AND ITS DOCUMENTATION, EVEN
+ * IF THE COPYRIGHT HOLDER HAS BEEN ADVISED OF THE POSSIBILITY OF SUCH
+ * DAMAGE.
+ *
+ * THE COPYRIGHT HOLDER SPECIFICALLY DISCLAIMS ANY WARRANTIES, INCLUDING,
+ * BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND
+ * FITNESS FOR A PARTICULAR PURPOSE. THE SOFTWARE PROVIDED HEREUNDER IS
+ * ON AN "AS IS" BASIS, AND THE COPYRIGHT HOLDER HAS NO OBLIGATION TO
+ * PROVIDE MAINTENANCE, SUPPORT, UPDATES, ENHANCEMENTS, OR MODIFICATIONS.
+ *
+ * Google Author(s): Behdad Esfahbod
+ */
+
+#ifndef HB_OT_VAR_AVAR_TABLE_HH
+#define HB_OT_VAR_AVAR_TABLE_HH
+
+#include "hb-open-type-private.hh"
+
+namespace OT {
+
+
+struct AxisValueMap
+{
+ inline bool sanitize (hb_sanitize_context_t *c) const
+ {
+ TRACE_SANITIZE (this);
+ return_trace (c->check_struct (this));
+ }
+
+ public:
+ F2DOT14 fromCoord; /* A normalized coordinate value obtained using
+ * default normalization. */
+ F2DOT14 toCoord; /* The modified, normalized coordinate value. */
+
+ public:
+ DEFINE_SIZE_STATIC (4);
+};
+
+struct SegmentMaps : ArrayOf<AxisValueMap>
+{
+ inline int map (int value) const
+ {
+ /* The following special-cases are not part of OpenType, which requires
+ * that at least -1, 0, and +1 must be mapped. But we include these as
+ * part of a better error recovery scheme. */
+
+ if (len < 2)
+ {
+ if (!len)
+ return value;
+ else /* len == 1*/
+ return value - array[0].fromCoord + array[0].toCoord;
+ }
+
+ if (value <= array[0].fromCoord)
+ return value - array[0].fromCoord + array[0].toCoord;
+
+ unsigned int i;
+ unsigned int count = len;
+ for (i = 1; i < count && value > array[i].fromCoord; i++)
+ ;
+
+ if (value >= array[i].fromCoord)
+ return value - array[i].fromCoord + array[i].toCoord;
+
+ if (unlikely (array[i-1].fromCoord == array[i].fromCoord))
+ return array[i-1].toCoord;
+
+ int denom = array[i].fromCoord - array[i-1].fromCoord;
+ return array[i-1].toCoord +
+ ((array[i].toCoord - array[i-1].toCoord) *
+ (value - array[i-1].fromCoord) + denom/2) / denom;
+ }
+
+ DEFINE_SIZE_ARRAY (2, array);
+};
+
+/*
+ * avar — Axis Variations Table
+ */
+
+#define HB_OT_TAG_avar HB_TAG('a','v','a','r')
+
+struct avar
+{
+ static const hb_tag_t tableTag = HB_OT_TAG_avar;
+
+ inline bool sanitize (hb_sanitize_context_t *c) const
+ {
+ TRACE_SANITIZE (this);
+ if (unlikely (!(version.sanitize (c) &&
+ version.major == 1 &&
+ c->check_struct (this))))
+ return_trace (false);
+
+ const SegmentMaps *map = &axisSegmentMapsZ;
+ unsigned int count = axisCount;
+ for (unsigned int i = 0; i < count; i++)
+ {
+ if (unlikely (!map->sanitize (c)))
+ return_trace (false);
+ map = &StructAfter<SegmentMaps> (*map);
+ }
+
+ return_trace (true);
+ }
+
+ inline void map_coords (int *coords, unsigned int coords_length) const
+ {
+ unsigned int count = MIN<unsigned int> (coords_length, axisCount);
+
+ const SegmentMaps *map = &axisSegmentMapsZ;
+ for (unsigned int i = 0; i < count; i++)
+ {
+ coords[i] = map->map (coords[i]);
+ map = &StructAfter<SegmentMaps> (*map);
+ }
+ }
+
+ protected:
+ FixedVersion<>version; /* Version of the avar table
+ * initially set to 0x00010000u */
+ UINT16 reserved; /* This field is permanently reserved. Set to 0. */
+ UINT16 axisCount; /* The number of variation axes in the font. This
+ * must be the same number as axisCount in the
+ * 'fvar' table. */
+ SegmentMaps axisSegmentMapsZ;
+
+ public:
+ DEFINE_SIZE_MIN (8);
+};
+
+} /* namespace OT */
+
+
+#endif /* HB_OT_VAR_AVAR_TABLE_HH */
diff --git a/src/3rdparty/harfbuzz-ng/src/hb-ot-var-fvar-table.hh b/src/3rdparty/harfbuzz-ng/src/hb-ot-var-fvar-table.hh
new file mode 100644
index 0000000000..2a9357a5e2
--- /dev/null
+++ b/src/3rdparty/harfbuzz-ng/src/hb-ot-var-fvar-table.hh
@@ -0,0 +1,209 @@
+/*
+ * Copyright © 2017 Google, Inc.
+ *
+ * This is part of HarfBuzz, a text shaping library.
+ *
+ * Permission is hereby granted, without written agreement and without
+ * license or royalty fees, to use, copy, modify, and distribute this
+ * software and its documentation for any purpose, provided that the
+ * above copyright notice and the following two paragraphs appear in
+ * all copies of this software.
+ *
+ * IN NO EVENT SHALL THE COPYRIGHT HOLDER BE LIABLE TO ANY PARTY FOR
+ * DIRECT, INDIRECT, SPECIAL, INCIDENTAL, OR CONSEQUENTIAL DAMAGES
+ * ARISING OUT OF THE USE OF THIS SOFTWARE AND ITS DOCUMENTATION, EVEN
+ * IF THE COPYRIGHT HOLDER HAS BEEN ADVISED OF THE POSSIBILITY OF SUCH
+ * DAMAGE.
+ *
+ * THE COPYRIGHT HOLDER SPECIFICALLY DISCLAIMS ANY WARRANTIES, INCLUDING,
+ * BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND
+ * FITNESS FOR A PARTICULAR PURPOSE. THE SOFTWARE PROVIDED HEREUNDER IS
+ * ON AN "AS IS" BASIS, AND THE COPYRIGHT HOLDER HAS NO OBLIGATION TO
+ * PROVIDE MAINTENANCE, SUPPORT, UPDATES, ENHANCEMENTS, OR MODIFICATIONS.
+ *
+ * Google Author(s): Behdad Esfahbod
+ */
+
+#ifndef HB_OT_VAR_FVAR_TABLE_HH
+#define HB_OT_VAR_FVAR_TABLE_HH
+
+#include "hb-open-type-private.hh"
+
+namespace OT {
+
+
+struct InstanceRecord
+{
+ inline bool sanitize (hb_sanitize_context_t *c, unsigned int axis_count) const
+ {
+ TRACE_SANITIZE (this);
+ return_trace (c->check_struct (this) &&
+ c->check_array (coordinates, coordinates[0].static_size, axis_count));
+ }
+
+ protected:
+ UINT16 subfamilyNameID;/* The name ID for entries in the 'name' table
+ * that provide subfamily names for this instance. */
+ UINT16 reserved; /* Reserved for future use — set to 0. */
+ Fixed coordinates[VAR];/* The coordinates array for this instance. */
+ //UINT16 postScriptNameIDX;/*Optional. The name ID for entries in the 'name'
+ // * table that provide PostScript names for this
+ // * instance. */
+
+ public:
+ DEFINE_SIZE_ARRAY (4, coordinates);
+};
+
+struct AxisRecord
+{
+ inline bool sanitize (hb_sanitize_context_t *c) const
+ {
+ TRACE_SANITIZE (this);
+ return_trace (c->check_struct (this));
+ }
+
+ public:
+ Tag axisTag; /* Tag identifying the design variation for the axis. */
+ Fixed minValue; /* The minimum coordinate value for the axis. */
+ Fixed defaultValue; /* The default coordinate value for the axis. */
+ Fixed maxValue; /* The maximum coordinate value for the axis. */
+ UINT16 reserved; /* Reserved for future use — set to 0. */
+ UINT16 axisNameID; /* The name ID for entries in the 'name' table that
+ * provide a display name for this axis. */
+
+ public:
+ DEFINE_SIZE_STATIC (20);
+};
+
+
+/*
+ * fvar — Font Variations Table
+ */
+
+#define HB_OT_TAG_fvar HB_TAG('f','v','a','r')
+
+struct fvar
+{
+ static const hb_tag_t tableTag = HB_OT_TAG_fvar;
+
+ inline bool sanitize (hb_sanitize_context_t *c) const
+ {
+ TRACE_SANITIZE (this);
+ return_trace (version.sanitize (c) &&
+ likely (version.major == 1) &&
+ c->check_struct (this) &&
+ instanceSize >= axisCount * 4 + 4 &&
+ axisSize <= 1024 && /* Arbitrary, just to simplify overflow checks. */
+ instanceSize <= 1024 && /* Arbitrary, just to simplify overflow checks. */
+ c->check_range (this, things) &&
+ c->check_range (&StructAtOffset<char> (this, things),
+ axisCount * axisSize + instanceCount * instanceSize));
+ }
+
+ inline unsigned int get_axis_count (void) const
+ { return axisCount; }
+
+ inline bool get_axis (unsigned int index, hb_ot_var_axis_t *info) const
+ {
+ if (unlikely (index >= axisCount))
+ return false;
+
+ if (info)
+ {
+ const AxisRecord &axis = get_axes ()[index];
+ info->tag = axis.axisTag;
+ info->name_id = axis.axisNameID;
+ info->default_value = axis.defaultValue / 65536.;
+ /* Ensure order, to simplify client math. */
+ info->min_value = MIN<float> (info->default_value, axis.minValue / 65536.);
+ info->max_value = MAX<float> (info->default_value, axis.maxValue / 65536.);
+ }
+
+ return true;
+ }
+
+ inline unsigned int get_axis_infos (unsigned int start_offset,
+ unsigned int *axes_count /* IN/OUT */,
+ hb_ot_var_axis_t *axes_array /* OUT */) const
+ {
+ if (axes_count)
+ {
+ unsigned int count = axisCount;
+ start_offset = MIN (start_offset, count);
+
+ count -= start_offset;
+ axes_array += start_offset;
+
+ count = MIN (count, *axes_count);
+ *axes_count = count;
+
+ for (unsigned int i = 0; i < count; i++)
+ get_axis (start_offset + i, axes_array + i);
+ }
+ return axisCount;
+ }
+
+ inline bool find_axis (hb_tag_t tag, unsigned int *index, hb_ot_var_axis_t *info) const
+ {
+ const AxisRecord *axes = get_axes ();
+ unsigned int count = get_axis_count ();
+ for (unsigned int i = 0; i < count; i++)
+ if (axes[i].axisTag == tag)
+ {
+ if (index)
+ *index = i;
+ return get_axis (i, info);
+ }
+ if (index)
+ *index = HB_OT_VAR_NO_AXIS_INDEX;
+ return false;
+ }
+
+ inline int normalize_axis_value (unsigned int axis_index, float v) const
+ {
+ hb_ot_var_axis_t axis;
+ if (!get_axis (axis_index, &axis))
+ return 0;
+
+ v = MAX (MIN (v, axis.max_value), axis.min_value); /* Clamp. */
+
+ if (v == axis.default_value)
+ return 0;
+ else if (v < axis.default_value)
+ v = (v - axis.default_value) / (axis.default_value - axis.min_value);
+ else
+ v = (v - axis.default_value) / (axis.max_value - axis.default_value);
+ return (int) (v * 16384. + (v >= 0. ? .5 : -.5));
+ }
+
+ protected:
+ inline const AxisRecord * get_axes (void) const
+ { return &StructAtOffset<AxisRecord> (this, things); }
+
+ inline const InstanceRecord * get_instances (void) const
+ { return &StructAtOffset<InstanceRecord> (get_axes () + axisCount, 0); }
+
+ protected:
+ FixedVersion<>version; /* Version of the fvar table
+ * initially set to 0x00010000u */
+ Offset16 things; /* Offset in bytes from the beginning of the table
+ * to the start of the AxisRecord array. */
+ UINT16 reserved; /* This field is permanently reserved. Set to 2. */
+ UINT16 axisCount; /* The number of variation axes in the font (the
+ * number of records in the axes array). */
+ UINT16 axisSize; /* The size in bytes of each VariationAxisRecord —
+ * set to 20 (0x0014) for this version. */
+ UINT16 instanceCount; /* The number of named instances defined in the font
+ * (the number of records in the instances array). */
+ UINT16 instanceSize; /* The size in bytes of each InstanceRecord — set
+ * to either axisCount * sizeof(Fixed) + 4, or to
+ * axisCount * sizeof(Fixed) + 6. */
+
+ public:
+ DEFINE_SIZE_STATIC (16);
+};
+
+} /* namespace OT */
+
+
+#endif /* HB_OT_VAR_FVAR_TABLE_HH */
diff --git a/src/3rdparty/harfbuzz-ng/src/hb-ot-var-hvar-table.hh b/src/3rdparty/harfbuzz-ng/src/hb-ot-var-hvar-table.hh
new file mode 100644
index 0000000000..fac843a719
--- /dev/null
+++ b/src/3rdparty/harfbuzz-ng/src/hb-ot-var-hvar-table.hh
@@ -0,0 +1,165 @@
+/*
+ * Copyright © 2017 Google, Inc.
+ *
+ * This is part of HarfBuzz, a text shaping library.
+ *
+ * Permission is hereby granted, without written agreement and without
+ * license or royalty fees, to use, copy, modify, and distribute this
+ * software and its documentation for any purpose, provided that the
+ * above copyright notice and the following two paragraphs appear in
+ * all copies of this software.
+ *
+ * IN NO EVENT SHALL THE COPYRIGHT HOLDER BE LIABLE TO ANY PARTY FOR
+ * DIRECT, INDIRECT, SPECIAL, INCIDENTAL, OR CONSEQUENTIAL DAMAGES
+ * ARISING OUT OF THE USE OF THIS SOFTWARE AND ITS DOCUMENTATION, EVEN
+ * IF THE COPYRIGHT HOLDER HAS BEEN ADVISED OF THE POSSIBILITY OF SUCH
+ * DAMAGE.
+ *
+ * THE COPYRIGHT HOLDER SPECIFICALLY DISCLAIMS ANY WARRANTIES, INCLUDING,
+ * BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND
+ * FITNESS FOR A PARTICULAR PURPOSE. THE SOFTWARE PROVIDED HEREUNDER IS
+ * ON AN "AS IS" BASIS, AND THE COPYRIGHT HOLDER HAS NO OBLIGATION TO
+ * PROVIDE MAINTENANCE, SUPPORT, UPDATES, ENHANCEMENTS, OR MODIFICATIONS.
+ *
+ * Google Author(s): Behdad Esfahbod
+ */
+
+#ifndef HB_OT_VAR_HVAR_TABLE_HH
+#define HB_OT_VAR_HVAR_TABLE_HH
+
+#include "hb-ot-layout-common-private.hh"
+
+
+namespace OT {
+
+
+struct DeltaSetIndexMap
+{
+ inline bool sanitize (hb_sanitize_context_t *c) const
+ {
+ TRACE_SANITIZE (this);
+ return_trace (c->check_struct (this) &&
+ c->check_array (mapData, get_width (), mapCount));
+ }
+
+ unsigned int map (unsigned int v) const /* Returns 16.16 outer.inner. */
+ {
+ /* If count is zero, pass value unchanged. This takes
+ * care of direct mapping for advance map. */
+ if (!mapCount)
+ return v;
+
+ if (v >= mapCount)
+ v = mapCount - 1;
+
+ unsigned int u = 0;
+ { /* Fetch it. */
+ unsigned int w = get_width ();
+ const UINT8 *p = mapData + w * v;
+ for (; w; w--)
+ u = (u << 8) + *p++;
+ }
+
+ { /* Repack it. */
+ unsigned int n = get_inner_bitcount ();
+ unsigned int outer = u >> n;
+ unsigned int inner = u & ((1 << n) - 1);
+ u = (outer<<16) | inner;
+ }
+
+ return u;
+ }
+
+ protected:
+ inline unsigned int get_width (void) const
+ { return ((format >> 4) & 3) + 1; }
+
+ inline unsigned int get_inner_bitcount (void) const
+ { return (format & 0xF) + 1; }
+
+ protected:
+ UINT16 format; /* A packed field that describes the compressed
+ * representation of delta-set indices. */
+ UINT16 mapCount; /* The number of mapping entries. */
+ UINT8 mapData[VAR]; /* The delta-set index mapping data. */
+
+ public:
+ DEFINE_SIZE_ARRAY (4, mapData);
+};
+
+
+/*
+ * HVAR -- The Horizontal Metrics Variations Table
+ * VVAR -- The Vertical Metrics Variations Table
+ */
+
+#define HB_OT_TAG_HVAR HB_TAG('H','V','A','R')
+#define HB_OT_TAG_VVAR HB_TAG('V','V','A','R')
+
+struct HVARVVAR
+{
+ static const hb_tag_t HVARTag = HB_OT_TAG_HVAR;
+ static const hb_tag_t VVARTag = HB_OT_TAG_VVAR;
+
+ inline bool sanitize (hb_sanitize_context_t *c) const
+ {
+ TRACE_SANITIZE (this);
+ return_trace (version.sanitize (c) &&
+ likely (version.major == 1) &&
+ varStore.sanitize (c, this) &&
+ advMap.sanitize (c, this) &&
+ lsbMap.sanitize (c, this) &&
+ rsbMap.sanitize (c, this));
+ }
+
+ inline float get_advance_var (hb_codepoint_t glyph,
+ int *coords, unsigned int coord_count) const
+ {
+ unsigned int varidx = (this+advMap).map (glyph);
+ return (this+varStore).get_delta (varidx, coords, coord_count);
+ }
+
+ inline bool has_sidebearing_deltas (void) const
+ { return lsbMap && rsbMap; }
+
+ protected:
+ FixedVersion<>version; /* Version of the metrics variation table
+ * initially set to 0x00010000u */
+ LOffsetTo<VariationStore>
+ varStore; /* Offset to item variation store table. */
+ LOffsetTo<DeltaSetIndexMap>
+ advMap; /* Offset to advance var-idx mapping. */
+ LOffsetTo<DeltaSetIndexMap>
+ lsbMap; /* Offset to lsb/tsb var-idx mapping. */
+ LOffsetTo<DeltaSetIndexMap>
+ rsbMap; /* Offset to rsb/bsb var-idx mapping. */
+
+ public:
+ DEFINE_SIZE_STATIC (20);
+};
+
+struct HVAR : HVARVVAR {
+ static const hb_tag_t tableTag = HB_OT_TAG_HVAR;
+};
+struct VVAR : HVARVVAR {
+ static const hb_tag_t tableTag = HB_OT_TAG_VVAR;
+
+ inline bool sanitize (hb_sanitize_context_t *c) const
+ {
+ TRACE_SANITIZE (this);
+ return_trace (static_cast<const HVARVVAR *> (this)->sanitize (c) &&
+ vorgMap.sanitize (c, this));
+ }
+
+ protected:
+ LOffsetTo<DeltaSetIndexMap>
+ vorgMap; /* Offset to vertical-origin var-idx mapping. */
+
+ public:
+ DEFINE_SIZE_STATIC (24);
+};
+
+} /* namespace OT */
+
+
+#endif /* HB_OT_VAR_HVAR_TABLE_HH */
diff --git a/src/3rdparty/harfbuzz-ng/src/hb-ot-var-mvar-table.hh b/src/3rdparty/harfbuzz-ng/src/hb-ot-var-mvar-table.hh
new file mode 100644
index 0000000000..e17ff5160a
--- /dev/null
+++ b/src/3rdparty/harfbuzz-ng/src/hb-ot-var-mvar-table.hh
@@ -0,0 +1,114 @@
+/*
+ * Copyright © 2017 Google, Inc.
+ *
+ * This is part of HarfBuzz, a text shaping library.
+ *
+ * Permission is hereby granted, without written agreement and without
+ * license or royalty fees, to use, copy, modify, and distribute this
+ * software and its documentation for any purpose, provided that the
+ * above copyright notice and the following two paragraphs appear in
+ * all copies of this software.
+ *
+ * IN NO EVENT SHALL THE COPYRIGHT HOLDER BE LIABLE TO ANY PARTY FOR
+ * DIRECT, INDIRECT, SPECIAL, INCIDENTAL, OR CONSEQUENTIAL DAMAGES
+ * ARISING OUT OF THE USE OF THIS SOFTWARE AND ITS DOCUMENTATION, EVEN
+ * IF THE COPYRIGHT HOLDER HAS BEEN ADVISED OF THE POSSIBILITY OF SUCH
+ * DAMAGE.
+ *
+ * THE COPYRIGHT HOLDER SPECIFICALLY DISCLAIMS ANY WARRANTIES, INCLUDING,
+ * BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND
+ * FITNESS FOR A PARTICULAR PURPOSE. THE SOFTWARE PROVIDED HEREUNDER IS
+ * ON AN "AS IS" BASIS, AND THE COPYRIGHT HOLDER HAS NO OBLIGATION TO
+ * PROVIDE MAINTENANCE, SUPPORT, UPDATES, ENHANCEMENTS, OR MODIFICATIONS.
+ *
+ * Google Author(s): Behdad Esfahbod
+ */
+
+#ifndef HB_OT_VAR_MVAR_TABLE_HH
+#define HB_OT_VAR_MVAR_TABLE_HH
+
+#include "hb-ot-layout-common-private.hh"
+
+
+namespace OT {
+
+
+struct VariationValueRecord
+{
+ inline bool sanitize (hb_sanitize_context_t *c) const
+ {
+ TRACE_SANITIZE (this);
+ return_trace (c->check_struct (this));
+ }
+
+ public:
+ Tag valueTag; /* Four-byte tag identifying a font-wide measure. */
+ UINT32 varIdx; /* Outer/inner index into VariationStore item. */
+
+ public:
+ DEFINE_SIZE_STATIC (8);
+};
+
+
+/*
+ * MVAR -- Metrics Variations Table
+ */
+
+#define HB_OT_TAG_MVAR HB_TAG('M','V','A','R')
+
+struct MVAR
+{
+ static const hb_tag_t tableTag = HB_OT_TAG_MVAR;
+
+ inline bool sanitize (hb_sanitize_context_t *c) const
+ {
+ TRACE_SANITIZE (this);
+ return_trace (version.sanitize (c) &&
+ likely (version.major == 1) &&
+ c->check_struct (this) &&
+ valueRecordSize >= VariationValueRecord::static_size &&
+ varStore.sanitize (c, this) &&
+ c->check_array (values, valueRecordSize, valueRecordCount));
+ }
+
+ inline float get_var (hb_tag_t tag,
+ int *coords, unsigned int coord_count) const
+ {
+ const VariationValueRecord *record;
+ record = (VariationValueRecord *) bsearch (&tag, values,
+ valueRecordCount, valueRecordSize,
+ tag_compare);
+ if (!record)
+ return 0.;
+
+ return (this+varStore).get_delta (record->varIdx, coords, coord_count);
+ }
+
+protected:
+ static inline int tag_compare (const void *pa, const void *pb)
+ {
+ const hb_tag_t *a = (const hb_tag_t *) pa;
+ const Tag *b = (const Tag *) pb;
+ return b->cmp (*a);
+ }
+
+ protected:
+ FixedVersion<>version; /* Version of the metrics variation table
+ * initially set to 0x00010000u */
+ UINT16 reserved; /* Not used; set to 0. */
+ UINT16 valueRecordSize;/* The size in bytes of each value record —
+ * must be greater than zero. */
+ UINT16 valueRecordCount;/* The number of value records — may be zero. */
+ OffsetTo<VariationStore>
+ varStore; /* Offset to item variation store table. */
+ UINT8 values[VAR]; /* Array of value records. The records must be
+ * in binary order of their valueTag field. */
+
+ public:
+ DEFINE_SIZE_ARRAY (12, values);
+};
+
+} /* namespace OT */
+
+
+#endif /* HB_OT_VAR_MVAR_TABLE_HH */
diff --git a/src/3rdparty/harfbuzz-ng/src/hb-ot-var.cc b/src/3rdparty/harfbuzz-ng/src/hb-ot-var.cc
new file mode 100644
index 0000000000..90ba0bd02c
--- /dev/null
+++ b/src/3rdparty/harfbuzz-ng/src/hb-ot-var.cc
@@ -0,0 +1,159 @@
+/*
+ * Copyright © 2017 Google, Inc.
+ *
+ * This is part of HarfBuzz, a text shaping library.
+ *
+ * Permission is hereby granted, without written agreement and without
+ * license or royalty fees, to use, copy, modify, and distribute this
+ * software and its documentation for any purpose, provided that the
+ * above copyright notice and the following two paragraphs appear in
+ * all copies of this software.
+ *
+ * IN NO EVENT SHALL THE COPYRIGHT HOLDER BE LIABLE TO ANY PARTY FOR
+ * DIRECT, INDIRECT, SPECIAL, INCIDENTAL, OR CONSEQUENTIAL DAMAGES
+ * ARISING OUT OF THE USE OF THIS SOFTWARE AND ITS DOCUMENTATION, EVEN
+ * IF THE COPYRIGHT HOLDER HAS BEEN ADVISED OF THE POSSIBILITY OF SUCH
+ * DAMAGE.
+ *
+ * THE COPYRIGHT HOLDER SPECIFICALLY DISCLAIMS ANY WARRANTIES, INCLUDING,
+ * BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND
+ * FITNESS FOR A PARTICULAR PURPOSE. THE SOFTWARE PROVIDED HEREUNDER IS
+ * ON AN "AS IS" BASIS, AND THE COPYRIGHT HOLDER HAS NO OBLIGATION TO
+ * PROVIDE MAINTENANCE, SUPPORT, UPDATES, ENHANCEMENTS, OR MODIFICATIONS.
+ *
+ * Google Author(s): Behdad Esfahbod
+ */
+
+#include "hb-open-type-private.hh"
+
+#include "hb-ot-layout-private.hh"
+#include "hb-ot-var-avar-table.hh"
+#include "hb-ot-var-fvar-table.hh"
+#include "hb-ot-var-mvar-table.hh"
+#include "hb-ot-var.h"
+
+/*
+ * fvar/avar
+ */
+
+static inline const OT::fvar&
+_get_fvar (hb_face_t *face)
+{
+ if (unlikely (!hb_ot_shaper_face_data_ensure (face))) return OT::Null(OT::fvar);
+ hb_ot_layout_t * layout = hb_ot_layout_from_face (face);
+ return *(layout->fvar.get ());
+}
+static inline const OT::avar&
+_get_avar (hb_face_t *face)
+{
+ if (unlikely (!hb_ot_shaper_face_data_ensure (face))) return OT::Null(OT::avar);
+ hb_ot_layout_t * layout = hb_ot_layout_from_face (face);
+ return *(layout->avar.get ());
+}
+
+/**
+ * hb_ot_var_has_data:
+ * @face: #hb_face_t to test
+ *
+ * This function allows to verify the presence of OpenType variation data on the face.
+ * Alternatively, use hb_ot_var_get_axis_count().
+ *
+ * Return value: true if face has a `fvar' table and false otherwise
+ *
+ * Since: 1.4.2
+ **/
+hb_bool_t
+hb_ot_var_has_data (hb_face_t *face)
+{
+ return &_get_fvar (face) != &OT::Null(OT::fvar);
+}
+
+/**
+ * hb_ot_var_get_axis_count:
+ *
+ * Since: 1.4.2
+ **/
+unsigned int
+hb_ot_var_get_axis_count (hb_face_t *face)
+{
+ const OT::fvar &fvar = _get_fvar (face);
+ return fvar.get_axis_count ();
+}
+
+/**
+ * hb_ot_var_get_axes:
+ *
+ * Since: 1.4.2
+ **/
+unsigned int
+hb_ot_var_get_axes (hb_face_t *face,
+ unsigned int start_offset,
+ unsigned int *axes_count /* IN/OUT */,
+ hb_ot_var_axis_t *axes_array /* OUT */)
+{
+ const OT::fvar &fvar = _get_fvar (face);
+ return fvar.get_axis_infos (start_offset, axes_count, axes_array);
+}
+
+/**
+ * hb_ot_var_find_axis:
+ *
+ * Since: 1.4.2
+ **/
+hb_bool_t
+hb_ot_var_find_axis (hb_face_t *face,
+ hb_tag_t axis_tag,
+ unsigned int *axis_index,
+ hb_ot_var_axis_t *axis_info)
+{
+ const OT::fvar &fvar = _get_fvar (face);
+ return fvar.find_axis (axis_tag, axis_index, axis_info);
+}
+
+
+/**
+ * hb_ot_var_normalize_variations:
+ *
+ * Since: 1.4.2
+ **/
+void
+hb_ot_var_normalize_variations (hb_face_t *face,
+ const hb_variation_t *variations, /* IN */
+ unsigned int variations_length,
+ int *coords, /* OUT */
+ unsigned int coords_length)
+{
+ for (unsigned int i = 0; i < coords_length; i++)
+ coords[i] = 0;
+
+ const OT::fvar &fvar = _get_fvar (face);
+ for (unsigned int i = 0; i < variations_length; i++)
+ {
+ unsigned int axis_index;
+ if (hb_ot_var_find_axis (face, variations[i].tag, &axis_index, nullptr) &&
+ axis_index < coords_length)
+ coords[axis_index] = fvar.normalize_axis_value (axis_index, variations[i].value);
+ }
+
+ const OT::avar &avar = _get_avar (face);
+ avar.map_coords (coords, coords_length);
+}
+
+/**
+ * hb_ot_var_normalize_coords:
+ *
+ * Since: 1.4.2
+ **/
+void
+hb_ot_var_normalize_coords (hb_face_t *face,
+ unsigned int coords_length,
+ const float *design_coords, /* IN */
+ int *normalized_coords /* OUT */)
+{
+ const OT::fvar &fvar = _get_fvar (face);
+ for (unsigned int i = 0; i < coords_length; i++)
+ normalized_coords[i] = fvar.normalize_axis_value (i, design_coords[i]);
+
+ const OT::avar &avar = _get_avar (face);
+ avar.map_coords (normalized_coords, coords_length);
+}
diff --git a/src/3rdparty/harfbuzz-ng/src/hb-ot-var.h b/src/3rdparty/harfbuzz-ng/src/hb-ot-var.h
new file mode 100644
index 0000000000..a2c0c5f2b0
--- /dev/null
+++ b/src/3rdparty/harfbuzz-ng/src/hb-ot-var.h
@@ -0,0 +1,105 @@
+/*
+ * Copyright © 2017 Google, Inc.
+ *
+ * This is part of HarfBuzz, a text shaping library.
+ *
+ * Permission is hereby granted, without written agreement and without
+ * license or royalty fees, to use, copy, modify, and distribute this
+ * software and its documentation for any purpose, provided that the
+ * above copyright notice and the following two paragraphs appear in
+ * all copies of this software.
+ *
+ * IN NO EVENT SHALL THE COPYRIGHT HOLDER BE LIABLE TO ANY PARTY FOR
+ * DIRECT, INDIRECT, SPECIAL, INCIDENTAL, OR CONSEQUENTIAL DAMAGES
+ * ARISING OUT OF THE USE OF THIS SOFTWARE AND ITS DOCUMENTATION, EVEN
+ * IF THE COPYRIGHT HOLDER HAS BEEN ADVISED OF THE POSSIBILITY OF SUCH
+ * DAMAGE.
+ *
+ * THE COPYRIGHT HOLDER SPECIFICALLY DISCLAIMS ANY WARRANTIES, INCLUDING,
+ * BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND
+ * FITNESS FOR A PARTICULAR PURPOSE. THE SOFTWARE PROVIDED HEREUNDER IS
+ * ON AN "AS IS" BASIS, AND THE COPYRIGHT HOLDER HAS NO OBLIGATION TO
+ * PROVIDE MAINTENANCE, SUPPORT, UPDATES, ENHANCEMENTS, OR MODIFICATIONS.
+ *
+ * Red Hat Author(s): Behdad Esfahbod
+ */
+
+#ifndef HB_OT_H_IN
+#error "Include <hb-ot.h> instead."
+#endif
+
+#ifndef HB_OT_VAR_H
+#define HB_OT_VAR_H
+
+#include "hb.h"
+
+HB_BEGIN_DECLS
+
+
+#define HB_OT_TAG_VAR_AXIS_ITALIC HB_TAG('i','t','a','l')
+#define HB_OT_TAG_VAR_AXIS_OPTICAL_SIZE HB_TAG('o','p','s','z')
+#define HB_OT_TAG_VAR_AXIS_SLANT HB_TAG('s','l','n','t')
+#define HB_OT_TAG_VAR_AXIS_WIDTH HB_TAG('w','d','t','h')
+#define HB_OT_TAG_VAR_AXIS_WEIGHT HB_TAG('w','g','h','t')
+
+
+/*
+ * fvar / avar
+ */
+
+/**
+ * hb_ot_var_axis_t:
+ *
+ * Since: 1.4.2
+ */
+typedef struct hb_ot_var_axis_t {
+ hb_tag_t tag;
+ unsigned int name_id;
+ float min_value;
+ float default_value;
+ float max_value;
+} hb_ot_var_axis_t;
+
+HB_EXTERN hb_bool_t
+hb_ot_var_has_data (hb_face_t *face);
+
+/**
+ * HB_OT_VAR_NO_AXIS_INDEX:
+ *
+ * Since: 1.4.2
+ */
+#define HB_OT_VAR_NO_AXIS_INDEX 0xFFFFFFFFu
+
+HB_EXTERN unsigned int
+hb_ot_var_get_axis_count (hb_face_t *face);
+
+HB_EXTERN unsigned int
+hb_ot_var_get_axes (hb_face_t *face,
+ unsigned int start_offset,
+ unsigned int *axes_count /* IN/OUT */,
+ hb_ot_var_axis_t *axes_array /* OUT */);
+
+HB_EXTERN hb_bool_t
+hb_ot_var_find_axis (hb_face_t *face,
+ hb_tag_t axis_tag,
+ unsigned int *axis_index,
+ hb_ot_var_axis_t *axis_info);
+
+
+HB_EXTERN void
+hb_ot_var_normalize_variations (hb_face_t *face,
+ const hb_variation_t *variations, /* IN */
+ unsigned int variations_length,
+ int *coords, /* OUT */
+ unsigned int coords_length);
+
+HB_EXTERN void
+hb_ot_var_normalize_coords (hb_face_t *face,
+ unsigned int coords_length,
+ const float *design_coords, /* IN */
+ int *normalized_coords /* OUT */);
+
+
+HB_END_DECLS
+
+#endif /* HB_OT_VAR_H */
diff --git a/src/3rdparty/harfbuzz-ng/src/hb-ot.h b/src/3rdparty/harfbuzz-ng/src/hb-ot.h
index 113e37b08a..2120a3efa3 100644
--- a/src/3rdparty/harfbuzz-ng/src/hb-ot.h
+++ b/src/3rdparty/harfbuzz-ng/src/hb-ot.h
@@ -35,6 +35,7 @@
#include "hb-ot-math.h"
#include "hb-ot-tag.h"
#include "hb-ot-shape.h"
+#include "hb-ot-var.h"
HB_BEGIN_DECLS
diff --git a/src/3rdparty/harfbuzz-ng/src/hb-private.hh b/src/3rdparty/harfbuzz-ng/src/hb-private.hh
index 666af6260b..acddd89381 100644
--- a/src/3rdparty/harfbuzz-ng/src/hb-private.hh
+++ b/src/3rdparty/harfbuzz-ng/src/hb-private.hh
@@ -44,16 +44,14 @@
#include <stddef.h>
#include <string.h>
#include <assert.h>
-
-/* We only use these two for debug output. However, the debug code is
- * always seen by the compiler (and optimized out in non-debug builds.
- * If including these becomes a problem, we can start thinking about
- * someway around that. */
-#include <stdio.h>
#include <errno.h>
+#include <stdio.h>
#include <stdarg.h>
+#define HB_PASTE1(a,b) a##b
+#define HB_PASTE(a,b) HB_PASTE1(a,b)
+
/* Compile-time custom allocator support. */
#if defined(hb_malloc_impl) \
@@ -74,10 +72,25 @@ extern "C" void hb_free_impl(void *ptr);
/* Compiler attributes */
-#if defined(__GNUC__) && (__GNUC__ > 2) && defined(__OPTIMIZE__)
-#define _HB_BOOLEAN_EXPR(expr) ((expr) ? 1 : 0)
-#define likely(expr) (__builtin_expect (_HB_BOOLEAN_EXPR(expr), 1))
-#define unlikely(expr) (__builtin_expect (_HB_BOOLEAN_EXPR(expr), 0))
+#if __cplusplus < 201103L
+
+#ifndef nullptr
+#define nullptr NULL
+#endif
+
+// Static assertions
+#ifndef static_assert
+#define static_assert(e, msg) \
+ HB_UNUSED typedef int HB_PASTE(static_assertion_failed_at_line_, __LINE__) [(e) ? 1 : -1]
+#endif // static_assert
+
+#endif // __cplusplus < 201103L
+
+#define _GNU_SOURCE 1
+
+#if (defined(__GNUC__) || defined(__clang__)) && defined(__OPTIMIZE__)
+#define likely(expr) (__builtin_expect (!!(expr), 1))
+#define unlikely(expr) (__builtin_expect (!!(expr), 0))
#else
#define likely(expr) (expr)
#define unlikely(expr) (expr)
@@ -99,6 +112,8 @@ extern "C" void hb_free_impl(void *ptr);
#endif
#if __GNUC__ >= 4
#define HB_UNUSED __attribute__((unused))
+#elif defined(_MSC_VER) /* https://github.com/harfbuzz/harfbuzz/issues/635 */
+#define HB_UNUSED __pragma(warning(suppress: 4100 4101))
#else
#define HB_UNUSED
#endif
@@ -168,21 +183,17 @@ extern "C" void hb_free_impl(void *ptr);
# if defined(_WIN32_WCE)
/* Some things not defined on Windows CE. */
-# define strdup _strdup
# define vsnprintf _vsnprintf
-# define getenv(Name) NULL
+# define getenv(Name) nullptr
# if _WIN32_WCE < 0x800
# define setlocale(Category, Locale) "C"
static int errno = 0; /* Use something better? */
# endif
# elif defined(WINAPI_FAMILY) && (WINAPI_FAMILY==WINAPI_FAMILY_PC_APP || WINAPI_FAMILY==WINAPI_FAMILY_PHONE_APP)
-# define getenv(Name) NULL
+# define getenv(Name) nullptr
# endif
# if defined(_MSC_VER) && _MSC_VER < 1900
# define snprintf _snprintf
-# elif defined(_MSC_VER) && _MSC_VER >= 1900
-# /* Covers VC++ Error for strdup being a deprecated POSIX name and to instead use _strdup instead */
-# define strdup _strdup
# endif
#endif
@@ -214,11 +225,6 @@ static int errno = 0; /* Use something better? */
/* Basics */
-
-#ifndef NULL
-# define NULL ((void *) 0)
-#endif
-
#undef MIN
template <typename Type>
static inline Type MIN (const Type &a, const Type &b) { return a < b ? a : b; }
@@ -240,32 +246,26 @@ static inline unsigned int ARRAY_LENGTH (const Type (&)[n]) { return n; }
#define HB_STMT_START do
#define HB_STMT_END while (0)
-#define _ASSERT_STATIC1(_line, _cond) HB_UNUSED typedef int _static_assert_on_line_##_line##_failed[(_cond)?1:-1]
-#define _ASSERT_STATIC0(_line, _cond) _ASSERT_STATIC1 (_line, (_cond))
-#define ASSERT_STATIC(_cond) _ASSERT_STATIC0 (__LINE__, (_cond))
-
-template <unsigned int cond> class hb_assert_constant_t {};
+template <unsigned int cond> class hb_assert_constant_t;
+template <> class hb_assert_constant_t<1> {};
#define ASSERT_STATIC_EXPR_ZERO(_cond) (0 * (unsigned int) sizeof (hb_assert_constant_t<_cond>))
-#define _PASTE1(a,b) a##b
-#define PASTE(a,b) _PASTE1(a,b)
-
/* Lets assert int types. Saves trouble down the road. */
-ASSERT_STATIC (sizeof (int8_t) == 1);
-ASSERT_STATIC (sizeof (uint8_t) == 1);
-ASSERT_STATIC (sizeof (int16_t) == 2);
-ASSERT_STATIC (sizeof (uint16_t) == 2);
-ASSERT_STATIC (sizeof (int32_t) == 4);
-ASSERT_STATIC (sizeof (uint32_t) == 4);
-ASSERT_STATIC (sizeof (int64_t) == 8);
-ASSERT_STATIC (sizeof (uint64_t) == 8);
+static_assert ((sizeof (int8_t) == 1), "");
+static_assert ((sizeof (uint8_t) == 1), "");
+static_assert ((sizeof (int16_t) == 2), "");
+static_assert ((sizeof (uint16_t) == 2), "");
+static_assert ((sizeof (int32_t) == 4), "");
+static_assert ((sizeof (uint32_t) == 4), "");
+static_assert ((sizeof (int64_t) == 8), "");
+static_assert ((sizeof (uint64_t) == 8), "");
-ASSERT_STATIC (sizeof (hb_codepoint_t) == 4);
-ASSERT_STATIC (sizeof (hb_position_t) == 4);
-ASSERT_STATIC (sizeof (hb_mask_t) == 4);
-ASSERT_STATIC (sizeof (hb_var_int_t) == 4);
+static_assert ((sizeof (hb_codepoint_t) == 4), "");
+static_assert ((sizeof (hb_position_t) == 4), "");
+static_assert ((sizeof (hb_mask_t) == 4), "");
+static_assert ((sizeof (hb_var_int_t) == 4), "");
/* We like our types POD */
@@ -300,7 +300,7 @@ ASSERT_STATIC (sizeof (hb_var_int_t) == 4);
/* Void! */
struct _hb_void_t {};
typedef const _hb_void_t *hb_void_t;
-#define HB_VOID ((const _hb_void_t *) NULL)
+#define HB_VOID ((const _hb_void_t *) nullptr)
/* Return the number of 1 bits in mask. */
static inline HB_CONST_FUNC unsigned int
@@ -316,6 +316,18 @@ _hb_popcount32 (uint32_t mask)
return (((y + (y >> 3)) & 030707070707) % 077);
#endif
}
+static inline HB_CONST_FUNC unsigned int
+_hb_popcount64 (uint64_t mask)
+{
+#if __GNUC__ > 3 || (__GNUC__ == 3 && __GNUC_MINOR__ >= 4)
+ if (sizeof (long) >= sizeof (mask))
+ return __builtin_popcountl (mask);
+#endif
+ return _hb_popcount32 (mask & 0xFFFFFFFF) + _hb_popcount32 (mask >> 32);
+}
+template <typename T> static inline unsigned int _hb_popcount (T mask);
+template <> inline unsigned int _hb_popcount<uint32_t> (uint32_t mask) { return _hb_popcount32 (mask); }
+template <> inline unsigned int _hb_popcount<uint64_t> (uint64_t mask) { return _hb_popcount64 (mask); }
/* Returns the number of bits needed to store number */
static inline HB_CONST_FUNC unsigned int
@@ -357,16 +369,11 @@ _hb_unsigned_int_mul_overflows (unsigned int count, unsigned int size)
}
-/* Type of bsearch() / qsort() compare function */
-typedef int (*hb_compare_func_t) (const void *, const void *);
-
-
-
/* arrays and maps */
-#define HB_PREALLOCED_ARRAY_INIT {0, 0, NULL}
+#define HB_PREALLOCED_ARRAY_INIT {0, 0, nullptr}
template <typename Type, unsigned int StaticSize=16>
struct hb_prealloced_array_t
{
@@ -375,41 +382,56 @@ struct hb_prealloced_array_t
Type *array;
Type static_array[StaticSize];
- void init (void) { memset (this, 0, sizeof (*this)); }
+ void init (void)
+ {
+ len = 0;
+ allocated = ARRAY_LENGTH (static_array);
+ array = static_array;
+ }
inline Type& operator [] (unsigned int i) { return array[i]; }
inline const Type& operator [] (unsigned int i) const { return array[i]; }
inline Type *push (void)
{
- if (!array) {
- array = static_array;
- allocated = ARRAY_LENGTH (static_array);
- }
- if (likely (len < allocated))
- return &array[len++];
+ if (unlikely (!resize (len + 1)))
+ return nullptr;
- /* Need to reallocate */
- unsigned int new_allocated = allocated + (allocated >> 1) + 8;
- Type *new_array = NULL;
+ return &array[len - 1];
+ }
- if (array == static_array) {
- new_array = (Type *) calloc (new_allocated, sizeof (Type));
- if (new_array)
- memcpy (new_array, array, len * sizeof (Type));
- } else {
- bool overflows = (new_allocated < allocated) || _hb_unsigned_int_mul_overflows (new_allocated, sizeof (Type));
- if (likely (!overflows)) {
- new_array = (Type *) realloc (array, new_allocated * sizeof (Type));
+ inline bool resize (unsigned int size)
+ {
+ if (unlikely (size > allocated))
+ {
+ /* Need to reallocate */
+
+ unsigned int new_allocated = allocated;
+ while (size >= new_allocated)
+ new_allocated += (new_allocated >> 1) + 8;
+
+ Type *new_array = nullptr;
+
+ if (array == static_array) {
+ new_array = (Type *) calloc (new_allocated, sizeof (Type));
+ if (new_array)
+ memcpy (new_array, array, len * sizeof (Type));
+ } else {
+ bool overflows = (new_allocated < allocated) || _hb_unsigned_int_mul_overflows (new_allocated, sizeof (Type));
+ if (likely (!overflows)) {
+ new_array = (Type *) realloc (array, new_allocated * sizeof (Type));
+ }
}
- }
- if (unlikely (!new_array))
- return NULL;
+ if (unlikely (!new_array))
+ return false;
+
+ array = new_array;
+ allocated = new_allocated;
+ }
- array = new_array;
- allocated = new_allocated;
- return &array[len++];
+ len = size;
+ return true;
}
inline void pop (void)
@@ -438,42 +460,67 @@ struct hb_prealloced_array_t
for (unsigned int i = 0; i < len; i++)
if (array[i] == v)
return &array[i];
- return NULL;
+ return nullptr;
}
template <typename T>
inline const Type *find (T v) const {
for (unsigned int i = 0; i < len; i++)
if (array[i] == v)
return &array[i];
- return NULL;
+ return nullptr;
}
inline void qsort (void)
{
- ::qsort (array, len, sizeof (Type), (hb_compare_func_t) Type::cmp);
+ ::qsort (array, len, sizeof (Type), Type::cmp);
}
inline void qsort (unsigned int start, unsigned int end)
{
- ::qsort (array + start, end - start, sizeof (Type), (hb_compare_func_t) Type::cmp);
+ ::qsort (array + start, end - start, sizeof (Type), Type::cmp);
}
template <typename T>
- inline Type *bsearch (T *key)
+ inline Type *bsearch (T *x)
{
- return (Type *) ::bsearch (key, array, len, sizeof (Type), (hb_compare_func_t) Type::cmp);
+ unsigned int i;
+ return bfind (x, &i) ? &array[i] : nullptr;
}
template <typename T>
- inline const Type *bsearch (T *key) const
+ inline const Type *bsearch (T *x) const
{
- return (const Type *) ::bsearch (key, array, len, sizeof (Type), (hb_compare_func_t) Type::cmp);
+ unsigned int i;
+ return bfind (x, &i) ? &array[i] : nullptr;
+ }
+ template <typename T>
+ inline bool bfind (T *x, unsigned int *i) const
+ {
+ int min = 0, max = (int) this->len - 1;
+ while (min <= max)
+ {
+ int mid = (min + max) / 2;
+ int c = this->array[mid].cmp (x);
+ if (c < 0)
+ max = mid - 1;
+ else if (c > 0)
+ min = mid + 1;
+ else
+ {
+ *i = mid;
+ return true;
+ }
+ }
+ if (max < 0 || (max < (int) this->len && this->array[max].cmp (x) > 0))
+ max++;
+ *i = max;
+ return false;
}
inline void finish (void)
{
if (array != static_array)
free (array);
- array = NULL;
+ array = nullptr;
allocated = len = 0;
}
};
@@ -490,7 +537,7 @@ struct hb_auto_array_t : hb_prealloced_array_t <Type>
template <typename item_t, typename lock_t>
struct hb_lockable_set_t
{
- hb_prealloced_array_t <item_t, 2> items;
+ hb_prealloced_array_t <item_t, 1> items;
inline void init (void) { items.init (); }
@@ -507,7 +554,7 @@ struct hb_lockable_set_t
old.finish ();
}
else {
- item = NULL;
+ item = nullptr;
l.unlock ();
}
} else {
@@ -595,22 +642,6 @@ static inline unsigned char TOUPPER (unsigned char c)
static inline unsigned char TOLOWER (unsigned char c)
{ return (c >= 'A' && c <= 'Z') ? c - 'A' + 'a' : c; }
-#define HB_TAG_CHAR4(s) (HB_TAG(((const char *) s)[0], \
- ((const char *) s)[1], \
- ((const char *) s)[2], \
- ((const char *) s)[3]))
-
-
-/* C++ helpers */
-
-/* Makes class uncopyable. Use in private: section. */
-#define NO_COPY(T) \
- T (const T &o); \
- T &operator = (const T &o)
-
-
-/* Debug */
-
/* HB_NDEBUG disables some sanity checks that are very safe to disable and
* should be disabled in production systems. If NDEBUG is defined, enable
@@ -621,255 +652,6 @@ static inline unsigned char TOLOWER (unsigned char c)
#define HB_NDEBUG
#endif
-#ifndef HB_DEBUG
-#define HB_DEBUG 0
-#endif
-
-static inline bool
-_hb_debug (unsigned int level,
- unsigned int max_level)
-{
- return level < max_level;
-}
-
-#define DEBUG_LEVEL_ENABLED(WHAT, LEVEL) (_hb_debug ((LEVEL), HB_DEBUG_##WHAT))
-#define DEBUG_ENABLED(WHAT) (DEBUG_LEVEL_ENABLED (WHAT, 0))
-
-static inline void
-_hb_print_func (const char *func)
-{
- if (func)
- {
- unsigned int func_len = strlen (func);
- /* Skip "static" */
- if (0 == strncmp (func, "static ", 7))
- func += 7;
- /* Skip "typename" */
- if (0 == strncmp (func, "typename ", 9))
- func += 9;
- /* Skip return type */
- const char *space = strchr (func, ' ');
- if (space)
- func = space + 1;
- /* Skip parameter list */
- const char *paren = strchr (func, '(');
- if (paren)
- func_len = paren - func;
- fprintf (stderr, "%.*s", func_len, func);
- }
-}
-
-template <int max_level> static inline void
-_hb_debug_msg_va (const char *what,
- const void *obj,
- const char *func,
- bool indented,
- unsigned int level,
- int level_dir,
- const char *message,
- va_list ap) HB_PRINTF_FUNC(7, 0);
-template <int max_level> static inline void
-_hb_debug_msg_va (const char *what,
- const void *obj,
- const char *func,
- bool indented,
- unsigned int level,
- int level_dir,
- const char *message,
- va_list ap)
-{
- if (!_hb_debug (level, max_level))
- return;
-
- fprintf (stderr, "%-10s", what ? what : "");
-
- if (obj)
- fprintf (stderr, "(%0*lx) ", (unsigned int) (2 * sizeof (void *)), (unsigned long) obj);
- else
- fprintf (stderr, " %*s ", (unsigned int) (2 * sizeof (void *)), "");
-
- if (indented) {
-#define VBAR "\342\224\202" /* U+2502 BOX DRAWINGS LIGHT VERTICAL */
-#define VRBAR "\342\224\234" /* U+251C BOX DRAWINGS LIGHT VERTICAL AND RIGHT */
-#define DLBAR "\342\225\256" /* U+256E BOX DRAWINGS LIGHT ARC DOWN AND LEFT */
-#define ULBAR "\342\225\257" /* U+256F BOX DRAWINGS LIGHT ARC UP AND LEFT */
-#define LBAR "\342\225\264" /* U+2574 BOX DRAWINGS LIGHT LEFT */
- static const char bars[] =
- VBAR VBAR VBAR VBAR VBAR VBAR VBAR VBAR VBAR VBAR
- VBAR VBAR VBAR VBAR VBAR VBAR VBAR VBAR VBAR VBAR
- VBAR VBAR VBAR VBAR VBAR VBAR VBAR VBAR VBAR VBAR
- VBAR VBAR VBAR VBAR VBAR VBAR VBAR VBAR VBAR VBAR
- VBAR VBAR VBAR VBAR VBAR VBAR VBAR VBAR VBAR VBAR;
- fprintf (stderr, "%2u %s" VRBAR "%s",
- level,
- bars + sizeof (bars) - 1 - MIN ((unsigned int) sizeof (bars) - 1, (unsigned int) (sizeof (VBAR) - 1) * level),
- level_dir ? (level_dir > 0 ? DLBAR : ULBAR) : LBAR);
- } else
- fprintf (stderr, " " VRBAR LBAR);
-
- _hb_print_func (func);
-
- if (message)
- {
- fprintf (stderr, ": ");
- vfprintf (stderr, message, ap);
- }
-
- fprintf (stderr, "\n");
-}
-template <> inline void
-_hb_debug_msg_va<0> (const char *what HB_UNUSED,
- const void *obj HB_UNUSED,
- const char *func HB_UNUSED,
- bool indented HB_UNUSED,
- unsigned int level HB_UNUSED,
- int level_dir HB_UNUSED,
- const char *message HB_UNUSED,
- va_list ap HB_UNUSED) {}
-
-template <int max_level> static inline void
-_hb_debug_msg (const char *what,
- const void *obj,
- const char *func,
- bool indented,
- unsigned int level,
- int level_dir,
- const char *message,
- ...) HB_PRINTF_FUNC(7, 8);
-template <int max_level> static inline void
-_hb_debug_msg (const char *what,
- const void *obj,
- const char *func,
- bool indented,
- unsigned int level,
- int level_dir,
- const char *message,
- ...)
-{
- va_list ap;
- va_start (ap, message);
- _hb_debug_msg_va<max_level> (what, obj, func, indented, level, level_dir, message, ap);
- va_end (ap);
-}
-template <> inline void
-_hb_debug_msg<0> (const char *what HB_UNUSED,
- const void *obj HB_UNUSED,
- const char *func HB_UNUSED,
- bool indented HB_UNUSED,
- unsigned int level HB_UNUSED,
- int level_dir HB_UNUSED,
- const char *message HB_UNUSED,
- ...) HB_PRINTF_FUNC(7, 8);
-template <> inline void
-_hb_debug_msg<0> (const char *what HB_UNUSED,
- const void *obj HB_UNUSED,
- const char *func HB_UNUSED,
- bool indented HB_UNUSED,
- unsigned int level HB_UNUSED,
- int level_dir HB_UNUSED,
- const char *message HB_UNUSED,
- ...) {}
-
-#define DEBUG_MSG_LEVEL(WHAT, OBJ, LEVEL, LEVEL_DIR, ...) _hb_debug_msg<HB_DEBUG_##WHAT> (#WHAT, (OBJ), NULL, true, (LEVEL), (LEVEL_DIR), __VA_ARGS__)
-#define DEBUG_MSG(WHAT, OBJ, ...) _hb_debug_msg<HB_DEBUG_##WHAT> (#WHAT, (OBJ), NULL, false, 0, 0, __VA_ARGS__)
-#define DEBUG_MSG_FUNC(WHAT, OBJ, ...) _hb_debug_msg<HB_DEBUG_##WHAT> (#WHAT, (OBJ), HB_FUNC, false, 0, 0, __VA_ARGS__)
-
-
-/*
- * Printer
- */
-
-template <typename T>
-struct hb_printer_t {
- const char *print (const T&) { return "something"; }
-};
-
-template <>
-struct hb_printer_t<bool> {
- const char *print (bool v) { return v ? "true" : "false"; }
-};
-
-template <>
-struct hb_printer_t<hb_void_t> {
- const char *print (hb_void_t) { return ""; }
-};
-
-
-/*
- * Trace
- */
-
-template <typename T>
-static inline void _hb_warn_no_return (bool returned)
-{
- if (unlikely (!returned)) {
- fprintf (stderr, "OUCH, returned with no call to return_trace(). This is a bug, please report.\n");
- }
-}
-template <>
-/*static*/ inline void _hb_warn_no_return<hb_void_t> (bool returned HB_UNUSED)
-{}
-
-template <int max_level, typename ret_t>
-struct hb_auto_trace_t {
- explicit inline hb_auto_trace_t (unsigned int *plevel_,
- const char *what_,
- const void *obj_,
- const char *func,
- const char *message,
- ...) : plevel (plevel_), what (what_), obj (obj_), returned (false)
- {
- if (plevel) ++*plevel;
-
- va_list ap;
- va_start (ap, message);
- _hb_debug_msg_va<max_level> (what, obj, func, true, plevel ? *plevel : 0, +1, message, ap);
- va_end (ap);
- }
- inline ~hb_auto_trace_t (void)
- {
- _hb_warn_no_return<ret_t> (returned);
- if (!returned) {
- _hb_debug_msg<max_level> (what, obj, NULL, true, plevel ? *plevel : 1, -1, " ");
- }
- if (plevel) --*plevel;
- }
-
- inline ret_t ret (ret_t v, unsigned int line = 0)
- {
- if (unlikely (returned)) {
- fprintf (stderr, "OUCH, double calls to return_trace(). This is a bug, please report.\n");
- return v;
- }
-
- _hb_debug_msg<max_level> (what, obj, NULL, true, plevel ? *plevel : 1, -1,
- "return %s (line %d)",
- hb_printer_t<ret_t>().print (v), line);
- if (plevel) --*plevel;
- plevel = NULL;
- returned = true;
- return v;
- }
-
- private:
- unsigned int *plevel;
- const char *what;
- const void *obj;
- bool returned;
-};
-template <typename ret_t> /* Optimize when tracing is disabled */
-struct hb_auto_trace_t<0, ret_t> {
- explicit inline hb_auto_trace_t (unsigned int *plevel_ HB_UNUSED,
- const char *what HB_UNUSED,
- const void *obj HB_UNUSED,
- const char *func HB_UNUSED,
- const char *message HB_UNUSED,
- ...) {}
-
- inline ret_t ret (ret_t v, unsigned int line HB_UNUSED = 0) { return v; }
-};
-
-#define return_trace(RET) return trace.ret (RET, __LINE__)
/* Misc */
@@ -887,7 +669,7 @@ hb_in_range (T u, T lo, T hi)
* one right now. Declaring a variable won't work as HB_UNUSED
* is unusable on some platforms and unused types are less likely
* to generate a warning than unused variables. */
- ASSERT_STATIC (sizeof (hb_assert_unsigned_t<T>) >= 0);
+ static_assert ((sizeof (hb_assert_unsigned_t<T>) >= 0), "");
/* The casts below are important as if T is smaller than int,
* the subtract results will become a signed int! */
@@ -912,7 +694,7 @@ hb_in_ranges (T u, T lo1, T hi1, T lo2, T hi2, T lo3, T hi3)
* one enum to another... So this doesn't provide the type-checking that I
* originally had in mind... :(.
*
- * For MSVC warnings, see: https://github.com/behdad/harfbuzz/pull/163
+ * For MSVC warnings, see: https://github.com/harfbuzz/harfbuzz/pull/163
*/
#ifdef _MSC_VER
# pragma warning(disable:4200)
@@ -932,11 +714,10 @@ hb_in_ranges (T u, T lo1, T hi1, T lo2, T hi2, T lo3, T hi3)
/* Useful for set-operations on small enums.
* For example, for testing "x ∈ {x1, x2, x3}" use:
- * (FLAG_SAFE(x) & (FLAG(x1) | FLAG(x2) | FLAG(x3)))
+ * (FLAG_UNSAFE(x) & (FLAG(x1) | FLAG(x2) | FLAG(x3)))
*/
-#define FLAG(x) (ASSERT_STATIC_EXPR_ZERO ((x) < 32) + (1U << (x)))
-#define FLAG_SAFE(x) (1U << (x))
-#define FLAG_UNSAFE(x) ((x) < 32 ? FLAG_SAFE(x) : 0)
+#define FLAG(x) (ASSERT_STATIC_EXPR_ZERO ((unsigned int)(x) < 32) + (1U << (unsigned int)(x)))
+#define FLAG_UNSAFE(x) ((unsigned int)(x) < 32 ? (1U << (unsigned int)(x)) : 0)
#define FLAG_RANGE(x,y) (ASSERT_STATIC_EXPR_ZERO ((x) < (y)) + FLAG(y+1) - FLAG(x))
@@ -968,7 +749,7 @@ hb_stable_sort (T *array, unsigned int len, int(*compar)(const T *, const T *),
template <typename T> static inline void
hb_stable_sort (T *array, unsigned int len, int(*compar)(const T *, const T *))
{
- hb_stable_sort (array, len, compar, (int *) NULL);
+ hb_stable_sort (array, len, compar, (int *) nullptr);
}
static inline hb_bool_t
@@ -990,6 +771,73 @@ hb_codepoint_parse (const char *s, unsigned int len, int base, hb_codepoint_t *o
}
+/* Vectorization */
+
+struct HbOpOr
+{
+ static const bool passthru_left = true;
+ static const bool passthru_right = true;
+ template <typename T> static void process (T &o, const T &a, const T &b) { o = a | b; }
+};
+struct HbOpAnd
+{
+ static const bool passthru_left = false;
+ static const bool passthru_right = false;
+ template <typename T> static void process (T &o, const T &a, const T &b) { o = a & b; }
+};
+struct HbOpMinus
+{
+ static const bool passthru_left = true;
+ static const bool passthru_right = false;
+ template <typename T> static void process (T &o, const T &a, const T &b) { o = a & ~b; }
+};
+struct HbOpXor
+{
+ static const bool passthru_left = true;
+ static const bool passthru_right = true;
+ template <typename T> static void process (T &o, const T &a, const T &b) { o = a ^ b; }
+};
+
+/* Type behaving similar to vectorized vars defined using __attribute__((vector_size(...))). */
+template <typename elt_t, unsigned int byte_size>
+struct hb_vector_size_t
+{
+ elt_t& operator [] (unsigned int i) { return v[i]; }
+ const elt_t& operator [] (unsigned int i) const { return v[i]; }
+
+ template <class Op>
+ inline hb_vector_size_t process (const hb_vector_size_t &o) const
+ {
+ hb_vector_size_t r;
+ for (unsigned int i = 0; i < ARRAY_LENGTH (v); i++)
+ Op::process (r.v[i], v[i], o.v[i]);
+ return r;
+ }
+ inline hb_vector_size_t operator | (const hb_vector_size_t &o) const
+ { return process<HbOpOr> (o); }
+ inline hb_vector_size_t operator & (const hb_vector_size_t &o) const
+ { return process<HbOpAnd> (o); }
+ inline hb_vector_size_t operator ^ (const hb_vector_size_t &o) const
+ { return process<HbOpXor> (o); }
+ inline hb_vector_size_t operator ~ () const
+ {
+ hb_vector_size_t r;
+ for (unsigned int i = 0; i < ARRAY_LENGTH (v); i++)
+ r.v[i] = ~v[i];
+ return r;
+ }
+
+ private:
+ static_assert (byte_size / sizeof (elt_t) * sizeof (elt_t) == byte_size, "");
+ elt_t v[byte_size / sizeof (elt_t)];
+};
+
+/* The `vector_size' attribute was introduced in gcc 3.1. */
+#if defined( __GNUC__ ) && ( __GNUC__ >= 4 )
+#define HAVE_VECTOR_SIZE 1
+#endif
+
+
/* Global runtime options. */
struct hb_options_t
@@ -1002,7 +850,7 @@ union hb_options_union_t {
unsigned int i;
hb_options_t opts;
};
-ASSERT_STATIC (sizeof (int) == sizeof (hb_options_union_t));
+static_assert ((sizeof (int) == sizeof (hb_options_union_t)), "");
HB_INTERNAL void
_hb_options_init (void);
@@ -1021,4 +869,31 @@ hb_options (void)
/* Size signifying variable-sized array */
#define VAR 1
+
+/* String type. */
+
+struct hb_string_t
+{
+ inline hb_string_t (void) : bytes (nullptr), len (0) {}
+ inline hb_string_t (const char *bytes_, unsigned int len_) : bytes (bytes_), len (len_) {}
+
+ inline int cmp (const hb_string_t &a) const
+ {
+ if (len != a.len)
+ return (int) a.len - (int) len;
+
+ return memcmp (a.bytes, bytes, len);
+ }
+ static inline int cmp (const void *pa, const void *pb)
+ {
+ hb_string_t *a = (hb_string_t *) pa;
+ hb_string_t *b = (hb_string_t *) pb;
+ return b->cmp (*a);
+ }
+
+ const char *bytes;
+ unsigned int len;
+};
+
+
#endif /* HB_PRIVATE_HH */
diff --git a/src/3rdparty/harfbuzz-ng/src/hb-set-digest-private.hh b/src/3rdparty/harfbuzz-ng/src/hb-set-digest-private.hh
new file mode 100644
index 0000000000..e099a82641
--- /dev/null
+++ b/src/3rdparty/harfbuzz-ng/src/hb-set-digest-private.hh
@@ -0,0 +1,179 @@
+/*
+ * Copyright © 2012 Google, Inc.
+ *
+ * This is part of HarfBuzz, a text shaping library.
+ *
+ * Permission is hereby granted, without written agreement and without
+ * license or royalty fees, to use, copy, modify, and distribute this
+ * software and its documentation for any purpose, provided that the
+ * above copyright notice and the following two paragraphs appear in
+ * all copies of this software.
+ *
+ * IN NO EVENT SHALL THE COPYRIGHT HOLDER BE LIABLE TO ANY PARTY FOR
+ * DIRECT, INDIRECT, SPECIAL, INCIDENTAL, OR CONSEQUENTIAL DAMAGES
+ * ARISING OUT OF THE USE OF THIS SOFTWARE AND ITS DOCUMENTATION, EVEN
+ * IF THE COPYRIGHT HOLDER HAS BEEN ADVISED OF THE POSSIBILITY OF SUCH
+ * DAMAGE.
+ *
+ * THE COPYRIGHT HOLDER SPECIFICALLY DISCLAIMS ANY WARRANTIES, INCLUDING,
+ * BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND
+ * FITNESS FOR A PARTICULAR PURPOSE. THE SOFTWARE PROVIDED HEREUNDER IS
+ * ON AN "AS IS" BASIS, AND THE COPYRIGHT HOLDER HAS NO OBLIGATION TO
+ * PROVIDE MAINTENANCE, SUPPORT, UPDATES, ENHANCEMENTS, OR MODIFICATIONS.
+ *
+ * Google Author(s): Behdad Esfahbod
+ */
+
+#ifndef HB_SET_DIGEST_PRIVATE_HH
+#define HB_SET_DIGEST_PRIVATE_HH
+
+#include "hb-private.hh"
+
+/*
+ * The set digests here implement various "filters" that support
+ * "approximate member query". Conceptually these are like Bloom
+ * Filter and Quotient Filter, however, much smaller, faster, and
+ * designed to fit the requirements of our uses for glyph coverage
+ * queries.
+ *
+ * Our filters are highly accurate if the lookup covers fairly local
+ * set of glyphs, but fully flooded and ineffective if coverage is
+ * all over the place.
+ *
+ * The frozen-set can be used instead of a digest, to trade more
+ * memory for 100% accuracy, but in practice, that doesn't look like
+ * an attractive trade-off.
+ */
+
+template <typename mask_t, unsigned int shift>
+struct hb_set_digest_lowest_bits_t
+{
+ ASSERT_POD ();
+
+ static const unsigned int mask_bytes = sizeof (mask_t);
+ static const unsigned int mask_bits = sizeof (mask_t) * 8;
+ static const unsigned int num_bits = 0
+ + (mask_bytes >= 1 ? 3 : 0)
+ + (mask_bytes >= 2 ? 1 : 0)
+ + (mask_bytes >= 4 ? 1 : 0)
+ + (mask_bytes >= 8 ? 1 : 0)
+ + (mask_bytes >= 16? 1 : 0)
+ + 0;
+
+ static_assert ((shift < sizeof (hb_codepoint_t) * 8), "");
+ static_assert ((shift + num_bits <= sizeof (hb_codepoint_t) * 8), "");
+
+ inline void init (void) {
+ mask = 0;
+ }
+
+ inline void add (hb_codepoint_t g) {
+ mask |= mask_for (g);
+ }
+
+ inline bool add_range (hb_codepoint_t a, hb_codepoint_t b) {
+ if ((b >> shift) - (a >> shift) >= mask_bits - 1)
+ mask = (mask_t) -1;
+ else {
+ mask_t ma = mask_for (a);
+ mask_t mb = mask_for (b);
+ mask |= mb + (mb - ma) - (mb < ma);
+ }
+ return true;
+ }
+
+ template <typename T>
+ inline void add_array (const T *array, unsigned int count, unsigned int stride=sizeof(T))
+ {
+ for (unsigned int i = 0; i < count; i++)
+ {
+ add (*array);
+ array = (const T *) (stride + (const char *) array);
+ }
+ }
+ template <typename T>
+ inline bool add_sorted_array (const T *array, unsigned int count, unsigned int stride=sizeof(T))
+ {
+ for (unsigned int i = 0; i < count; i++)
+ {
+ add (*array);
+ array = (const T *) (stride + (const char *) array);
+ }
+ return true;
+ }
+
+ inline bool may_have (hb_codepoint_t g) const {
+ return !!(mask & mask_for (g));
+ }
+
+ private:
+
+ static inline mask_t mask_for (hb_codepoint_t g) {
+ return ((mask_t) 1) << ((g >> shift) & (mask_bits - 1));
+ }
+ mask_t mask;
+};
+
+template <typename head_t, typename tail_t>
+struct hb_set_digest_combiner_t
+{
+ ASSERT_POD ();
+
+ inline void init (void) {
+ head.init ();
+ tail.init ();
+ }
+
+ inline void add (hb_codepoint_t g) {
+ head.add (g);
+ tail.add (g);
+ }
+
+ inline bool add_range (hb_codepoint_t a, hb_codepoint_t b) {
+ head.add_range (a, b);
+ tail.add_range (a, b);
+ return true;
+ }
+ template <typename T>
+ inline void add_array (const T *array, unsigned int count, unsigned int stride=sizeof(T))
+ {
+ head.add_array (array, count, stride);
+ tail.add_array (array, count, stride);
+ }
+ template <typename T>
+ inline bool add_sorted_array (const T *array, unsigned int count, unsigned int stride=sizeof(T))
+ {
+ head.add_sorted_array (array, count, stride);
+ tail.add_sorted_array (array, count, stride);
+ return true;
+ }
+
+ inline bool may_have (hb_codepoint_t g) const {
+ return head.may_have (g) && tail.may_have (g);
+ }
+
+ private:
+ head_t head;
+ tail_t tail;
+};
+
+
+/*
+ * hb_set_digest_t
+ *
+ * This is a combination of digests that performs "best".
+ * There is not much science to this: it's a result of intuition
+ * and testing.
+ */
+typedef hb_set_digest_combiner_t
+<
+ hb_set_digest_lowest_bits_t<unsigned long, 4>,
+ hb_set_digest_combiner_t
+ <
+ hb_set_digest_lowest_bits_t<unsigned long, 0>,
+ hb_set_digest_lowest_bits_t<unsigned long, 9>
+ >
+> hb_set_digest_t;
+
+
+#endif /* HB_SET_DIGEST_PRIVATE_HH */
diff --git a/src/3rdparty/harfbuzz-ng/src/hb-set-private.hh b/src/3rdparty/harfbuzz-ng/src/hb-set-private.hh
index e2010d7626..9c6f3ee37a 100644
--- a/src/3rdparty/harfbuzz-ng/src/hb-set-private.hh
+++ b/src/3rdparty/harfbuzz-ng/src/hb-set-private.hh
@@ -1,5 +1,5 @@
/*
- * Copyright © 2012 Google, Inc.
+ * Copyright © 2012,2017 Google, Inc.
*
* This is part of HarfBuzz, a text shaping library.
*
@@ -32,254 +32,462 @@
/*
- * The set digests here implement various "filters" that support
- * "approximate member query". Conceptually these are like Bloom
- * Filter and Quotient Filter, however, much smaller, faster, and
- * designed to fit the requirements of our uses for glyph coverage
- * queries.
- *
- * Our filters are highly accurate if the lookup covers fairly local
- * set of glyphs, but fully flooded and ineffective if coverage is
- * all over the place.
- *
- * The frozen-set can be used instead of a digest, to trade more
- * memory for 100% accuracy, but in practice, that doesn't look like
- * an attractive trade-off.
+ * hb_set_t
*/
-template <typename mask_t, unsigned int shift>
-struct hb_set_digest_lowest_bits_t
-{
- ASSERT_POD ();
-
- static const unsigned int mask_bytes = sizeof (mask_t);
- static const unsigned int mask_bits = sizeof (mask_t) * 8;
- static const unsigned int num_bits = 0
- + (mask_bytes >= 1 ? 3 : 0)
- + (mask_bytes >= 2 ? 1 : 0)
- + (mask_bytes >= 4 ? 1 : 0)
- + (mask_bytes >= 8 ? 1 : 0)
- + (mask_bytes >= 16? 1 : 0)
- + 0;
-
- ASSERT_STATIC (shift < sizeof (hb_codepoint_t) * 8);
- ASSERT_STATIC (shift + num_bits <= sizeof (hb_codepoint_t) * 8);
-
- inline void init (void) {
- mask = 0;
- }
+/* TODO Keep a free-list so we can free pages that are completely zeroed. At that
+ * point maybe also use a sentinel value for "all-1" pages? */
- inline void add (hb_codepoint_t g) {
- mask |= mask_for (g);
- }
-
- inline void add_range (hb_codepoint_t a, hb_codepoint_t b) {
- if ((b >> shift) - (a >> shift) >= mask_bits - 1)
- mask = (mask_t) -1;
- else {
- mask_t ma = mask_for (a);
- mask_t mb = mask_for (b);
- mask |= mb + (mb - ma) - (mb < ma);
- }
- }
+struct hb_set_t
+{
+ struct page_map_t
+ {
+ inline int cmp (const page_map_t *o) const { return (int) o->major - (int) major; }
- inline bool may_have (hb_codepoint_t g) const {
- return !!(mask & mask_for (g));
- }
+ uint32_t major;
+ uint32_t index;
+ };
- private:
+ struct page_t
+ {
+ inline void init0 (void) { memset (&v, 0, sizeof (v)); }
+ inline void init1 (void) { memset (&v, 0xff, sizeof (v)); }
- static inline mask_t mask_for (hb_codepoint_t g) {
- return ((mask_t) 1) << ((g >> shift) & (mask_bits - 1));
- }
- mask_t mask;
-};
+ inline unsigned int len (void) const
+ { return ARRAY_LENGTH_CONST (v); }
-template <typename head_t, typename tail_t>
-struct hb_set_digest_combiner_t
-{
- ASSERT_POD ();
-
- inline void init (void) {
- head.init ();
- tail.init ();
- }
+ inline bool is_empty (void) const
+ {
+ for (unsigned int i = 0; i < len (); i++)
+ if (v[i])
+ return false;
+ return true;
+ }
- inline void add (hb_codepoint_t g) {
- head.add (g);
- tail.add (g);
- }
+ inline void add (hb_codepoint_t g) { elt (g) |= mask (g); }
+ inline void del (hb_codepoint_t g) { elt (g) &= ~mask (g); }
+ inline bool has (hb_codepoint_t g) const { return !!(elt (g) & mask (g)); }
- inline void add_range (hb_codepoint_t a, hb_codepoint_t b) {
- head.add_range (a, b);
- tail.add_range (a, b);
- }
+ inline void add_range (hb_codepoint_t a, hb_codepoint_t b)
+ {
+ elt_t *la = &elt (a);
+ elt_t *lb = &elt (b);
+ if (la == lb)
+ *la |= (mask (b) << 1) - mask(a);
+ else
+ {
+ *la |= ~(mask (a) - 1);
+ la++;
+
+ memset (la, 0xff, (char *) lb - (char *) la);
+
+ *lb |= ((mask (b) << 1) - 1);
+ }
+ }
- inline bool may_have (hb_codepoint_t g) const {
- return head.may_have (g) && tail.may_have (g);
- }
+ inline bool is_equal (const page_t *other) const
+ {
+ return 0 == memcmp (&v, &other->v, sizeof (v));
+ }
- private:
- head_t head;
- tail_t tail;
-};
+ inline unsigned int get_population (void) const
+ {
+ unsigned int pop = 0;
+ for (unsigned int i = 0; i < len (); i++)
+ pop += _hb_popcount (v[i]);
+ return pop;
+ }
+ inline bool next (hb_codepoint_t *codepoint) const
+ {
+ unsigned int m = (*codepoint + 1) & MASK;
+ if (!m)
+ {
+ *codepoint = INVALID;
+ return false;
+ }
+ unsigned int i = m / ELT_BITS;
+ unsigned int j = m & ELT_MASK;
+
+ for (; j < ELT_BITS; j++)
+ if (v[i] & (elt_t (1) << j))
+ goto found;
+ for (i++; i < len (); i++)
+ if (v[i])
+ for (j = 0; j < ELT_BITS; j++)
+ if (v[i] & (elt_t (1) << j))
+ goto found;
+
+ *codepoint = INVALID;
+ return false;
-/*
- * hb_set_digest_t
- *
- * This is a combination of digests that performs "best".
- * There is not much science to this: it's a result of intuition
- * and testing.
- */
-typedef hb_set_digest_combiner_t
-<
- hb_set_digest_lowest_bits_t<unsigned long, 4>,
- hb_set_digest_combiner_t
- <
- hb_set_digest_lowest_bits_t<unsigned long, 0>,
- hb_set_digest_lowest_bits_t<unsigned long, 9>
- >
-> hb_set_digest_t;
+ found:
+ *codepoint = i * ELT_BITS + j;
+ return true;
+ }
+ inline hb_codepoint_t get_min (void) const
+ {
+ for (unsigned int i = 0; i < len (); i++)
+ if (v[i])
+ {
+ elt_t e = v[i];
+ for (unsigned int j = 0; j < ELT_BITS; j++)
+ if (e & (elt_t (1) << j))
+ return i * ELT_BITS + j;
+ }
+ return INVALID;
+ }
+ inline hb_codepoint_t get_max (void) const
+ {
+ for (int i = len () - 1; i >= 0; i--)
+ if (v[i])
+ {
+ elt_t e = v[i];
+ for (int j = ELT_BITS - 1; j >= 0; j--)
+ if (e & (elt_t (1) << j))
+ return i * ELT_BITS + j;
+ }
+ return 0;
+ }
+ static const unsigned int PAGE_BITS = 8192; /* Use to tune. */
+ static_assert ((PAGE_BITS & ((PAGE_BITS) - 1)) == 0, "");
+ typedef uint64_t elt_t;
-/*
- * hb_set_t
- */
+#if 0 && HAVE_VECTOR_SIZE
+ /* The vectorized version does not work with clang as non-const
+ * elt() errs "non-const reference cannot bind to vector element". */
+ typedef elt_t vector_t __attribute__((vector_size (PAGE_BITS / 8)));
+#else
+ typedef hb_vector_size_t<elt_t, PAGE_BITS / 8> vector_t;
+#endif
+ vector_t v;
-/* TODO Make this faster and memmory efficient. */
+ static const unsigned int ELT_BITS = sizeof (elt_t) * 8;
+ static const unsigned int ELT_MASK = ELT_BITS - 1;
+ static const unsigned int BITS = sizeof (vector_t) * 8;
+ static const unsigned int MASK = BITS - 1;
+ static_assert (PAGE_BITS == BITS, "");
-struct hb_set_t
-{
- friend struct hb_frozen_set_t;
+ elt_t &elt (hb_codepoint_t g) { return v[(g & MASK) / ELT_BITS]; }
+ elt_t const &elt (hb_codepoint_t g) const { return v[(g & MASK) / ELT_BITS]; }
+ elt_t mask (hb_codepoint_t g) const { return elt_t (1) << (g & ELT_MASK); }
+ };
+ static_assert (page_t::PAGE_BITS == sizeof (page_t) * 8, "");
hb_object_header_t header;
ASSERT_POD ();
bool in_error;
+ hb_prealloced_array_t<page_map_t, 8> page_map;
+ hb_prealloced_array_t<page_t, 1> pages;
- inline void init (void) {
- hb_object_init (this);
- clear ();
+ inline void init (void)
+ {
+ page_map.init ();
+ pages.init ();
}
- inline void fini (void) {
+ inline void finish (void)
+ {
+ page_map.finish ();
+ pages.finish ();
+ }
+
+ inline bool resize (unsigned int count)
+ {
+ if (unlikely (in_error)) return false;
+ if (!pages.resize (count) || !page_map.resize (count))
+ {
+ pages.resize (page_map.len);
+ in_error = true;
+ return false;
+ }
+ return true;
}
+
inline void clear (void) {
if (unlikely (hb_object_is_inert (this)))
return;
in_error = false;
- memset (elts, 0, sizeof elts);
+ page_map.resize (0);
+ pages.resize (0);
}
inline bool is_empty (void) const {
- for (unsigned int i = 0; i < ARRAY_LENGTH (elts); i++)
- if (elts[i])
+ unsigned int count = pages.len;
+ for (unsigned int i = 0; i < count; i++)
+ if (!pages[i].is_empty ())
return false;
return true;
}
+
inline void add (hb_codepoint_t g)
{
if (unlikely (in_error)) return;
if (unlikely (g == INVALID)) return;
- if (unlikely (g > MAX_G)) return;
- elt (g) |= mask (g);
+ page_t *page = page_for_insert (g); if (unlikely (!page)) return;
+ page->add (g);
}
- inline void add_range (hb_codepoint_t a, hb_codepoint_t b)
+ inline bool add_range (hb_codepoint_t a, hb_codepoint_t b)
+ {
+ if (unlikely (in_error)) return true; /* https://github.com/harfbuzz/harfbuzz/issues/657 */
+ if (unlikely (a > b || a == INVALID || b == INVALID)) return false;
+ unsigned int ma = get_major (a);
+ unsigned int mb = get_major (b);
+ if (ma == mb)
+ {
+ page_t *page = page_for_insert (a); if (unlikely (!page)) return false;
+ page->add_range (a, b);
+ }
+ else
+ {
+ page_t *page = page_for_insert (a); if (unlikely (!page)) return false;
+ page->add_range (a, major_start (ma + 1) - 1);
+
+ for (unsigned int m = ma + 1; m < mb; m++)
+ {
+ page = page_for_insert (major_start (m)); if (unlikely (!page)) return false;
+ page->init1 ();
+ }
+
+ page = page_for_insert (b); if (unlikely (!page)) return false;
+ page->add_range (major_start (mb), b);
+ }
+ return true;
+ }
+
+ template <typename T>
+ inline void add_array (const T *array, unsigned int count, unsigned int stride=sizeof(T))
{
if (unlikely (in_error)) return;
- /* TODO Speedup */
- for (unsigned int i = a; i < b + 1; i++)
- add (i);
+ if (!count) return;
+ hb_codepoint_t g = *array;
+ while (count)
+ {
+ unsigned int m = get_major (g);
+ page_t *page = page_for_insert (g); if (unlikely (!page)) return;
+ unsigned int start = major_start (m);
+ unsigned int end = major_start (m + 1);
+ do
+ {
+ page->add (g);
+
+ array++;
+ count--;
+ }
+ while (count && (g = *array, start <= g && g < end));
+ }
+ }
+
+ /* Might return false if array looks unsorted.
+ * Used for faster rejection of corrupt data. */
+ template <typename T>
+ inline bool add_sorted_array (const T *array, unsigned int count, unsigned int stride=sizeof(T))
+ {
+ if (unlikely (in_error)) return true; /* https://github.com/harfbuzz/harfbuzz/issues/657 */
+ if (!count) return true;
+ hb_codepoint_t g = *array;
+ hb_codepoint_t last_g = g;
+ while (count)
+ {
+ unsigned int m = get_major (g);
+ page_t *page = page_for_insert (g); if (unlikely (!page)) return false;
+ unsigned int end = major_start (m + 1);
+ do
+ {
+ /* If we try harder we can change the following comparison to <=;
+ * Not sure if it's worth it. */
+ if (g < last_g) return false;
+ last_g = g;
+ page->add (g);
+
+ array++;
+ count--;
+ }
+ while (count && (g = *array, g < end));
+ }
+ return true;
}
+
inline void del (hb_codepoint_t g)
{
if (unlikely (in_error)) return;
- if (unlikely (g > MAX_G)) return;
- elt (g) &= ~mask (g);
+ page_t *p = page_for (g);
+ if (!p)
+ return;
+ p->del (g);
}
inline void del_range (hb_codepoint_t a, hb_codepoint_t b)
{
+ /* TODO Optimize, like add_range(). */
if (unlikely (in_error)) return;
- /* TODO Speedup */
for (unsigned int i = a; i < b + 1; i++)
del (i);
}
inline bool has (hb_codepoint_t g) const
{
- if (unlikely (g > MAX_G)) return false;
- return !!(elt (g) & mask (g));
+ const page_t *p = page_for (g);
+ if (!p)
+ return false;
+ return p->has (g);
}
inline bool intersects (hb_codepoint_t first,
hb_codepoint_t last) const
{
- if (unlikely (first > MAX_G)) return false;
- if (unlikely (last > MAX_G)) last = MAX_G;
- unsigned int end = last + 1;
- for (hb_codepoint_t i = first; i < end; i++)
- if (has (i))
- return true;
- return false;
+ hb_codepoint_t c = first - 1;
+ return next (&c) && c <= last;
+ }
+ inline void set (const hb_set_t *other)
+ {
+ if (unlikely (in_error)) return;
+ unsigned int count = other->pages.len;
+ if (!resize (count))
+ return;
+
+ memcpy (pages.array, other->pages.array, count * sizeof (pages.array[0]));
+ memcpy (page_map.array, other->page_map.array, count * sizeof (page_map.array[0]));
}
+
inline bool is_equal (const hb_set_t *other) const
{
- for (unsigned int i = 0; i < ELTS; i++)
- if (elts[i] != other->elts[i])
+ unsigned int na = pages.len;
+ unsigned int nb = other->pages.len;
+
+ unsigned int a = 0, b = 0;
+ for (; a < na && b < nb; )
+ {
+ if (page_at (a).is_empty ()) { a++; continue; }
+ if (other->page_at (b).is_empty ()) { b++; continue; }
+ if (page_map[a].major != other->page_map[b].major ||
+ !page_at (a).is_equal (&other->page_at (b)))
return false;
+ a++;
+ b++;
+ }
+ for (; a < na; a++)
+ if (!page_at (a).is_empty ()) { return false; }
+ for (; b < nb; b++)
+ if (!other->page_at (b).is_empty ()) { return false; }
+
return true;
}
- inline void set (const hb_set_t *other)
+
+ template <class Op>
+ inline void process (const hb_set_t *other)
{
if (unlikely (in_error)) return;
- for (unsigned int i = 0; i < ELTS; i++)
- elts[i] = other->elts[i];
+
+ unsigned int na = pages.len;
+ unsigned int nb = other->pages.len;
+
+ unsigned int count = 0;
+ unsigned int a = 0, b = 0;
+ for (; a < na && b < nb; )
+ {
+ if (page_map[a].major == other->page_map[b].major)
+ {
+ count++;
+ a++;
+ b++;
+ }
+ else if (page_map[a].major < other->page_map[b].major)
+ {
+ if (Op::passthru_left)
+ count++;
+ a++;
+ }
+ else
+ {
+ if (Op::passthru_right)
+ count++;
+ b++;
+ }
+ }
+ if (Op::passthru_left)
+ count += na - a;
+ if (Op::passthru_right)
+ count += nb - b;
+
+ if (!resize (count))
+ return;
+
+ /* Process in-place backward. */
+ a = na;
+ b = nb;
+ for (; a && b; )
+ {
+ if (page_map[a - 1].major == other->page_map[b - 1].major)
+ {
+ a--;
+ b--;
+ Op::process (page_at (--count).v, page_at (a).v, other->page_at (b).v);
+ }
+ else if (page_map[a - 1].major > other->page_map[b - 1].major)
+ {
+ a--;
+ if (Op::passthru_left)
+ page_at (--count).v = page_at (a).v;
+ }
+ else
+ {
+ b--;
+ if (Op::passthru_right)
+ page_at (--count).v = other->page_at (b).v;
+ }
+ }
+ if (Op::passthru_left)
+ while (a)
+ page_at (--count).v = page_at (--a).v;
+ if (Op::passthru_right)
+ while (b)
+ page_at (--count).v = other->page_at (--b).v;
+ assert (!count);
}
+
inline void union_ (const hb_set_t *other)
{
- if (unlikely (in_error)) return;
- for (unsigned int i = 0; i < ELTS; i++)
- elts[i] |= other->elts[i];
+ process<HbOpOr> (other);
}
inline void intersect (const hb_set_t *other)
{
- if (unlikely (in_error)) return;
- for (unsigned int i = 0; i < ELTS; i++)
- elts[i] &= other->elts[i];
+ process<HbOpAnd> (other);
}
inline void subtract (const hb_set_t *other)
{
- if (unlikely (in_error)) return;
- for (unsigned int i = 0; i < ELTS; i++)
- elts[i] &= ~other->elts[i];
+ process<HbOpMinus> (other);
}
inline void symmetric_difference (const hb_set_t *other)
{
- if (unlikely (in_error)) return;
- for (unsigned int i = 0; i < ELTS; i++)
- elts[i] ^= other->elts[i];
- }
- inline void invert (void)
- {
- if (unlikely (in_error)) return;
- for (unsigned int i = 0; i < ELTS; i++)
- elts[i] = ~elts[i];
+ process<HbOpXor> (other);
}
inline bool next (hb_codepoint_t *codepoint) const
{
if (unlikely (*codepoint == INVALID)) {
- hb_codepoint_t i = get_min ();
- if (i != INVALID) {
- *codepoint = i;
- return true;
- } else {
- *codepoint = INVALID;
- return false;
+ *codepoint = get_min ();
+ return *codepoint != INVALID;
+ }
+
+ page_map_t map = {get_major (*codepoint), 0};
+ unsigned int i;
+ page_map.bfind (&map, &i);
+ if (i < page_map.len)
+ {
+ if (pages[page_map[i].index].next (codepoint))
+ {
+ *codepoint += page_map[i].major * page_t::PAGE_BITS;
+ return true;
}
+ i++;
}
- for (hb_codepoint_t i = *codepoint + 1; i < MAX_G + 1; i++)
- if (has (i)) {
- *codepoint = i;
+ for (; i < page_map.len; i++)
+ {
+ hb_codepoint_t m = pages[page_map[i].index].get_min ();
+ if (m != INVALID)
+ {
+ *codepoint = page_map[i].major * page_t::PAGE_BITS + m;
return true;
}
+ }
*codepoint = INVALID;
return false;
}
@@ -303,99 +511,66 @@ struct hb_set_t
inline unsigned int get_population (void) const
{
- unsigned int count = 0;
- for (unsigned int i = 0; i < ELTS; i++)
- count += _hb_popcount32 (elts[i]);
- return count;
+ unsigned int pop = 0;
+ unsigned int count = pages.len;
+ for (unsigned int i = 0; i < count; i++)
+ pop += pages[i].get_population ();
+ return pop;
}
inline hb_codepoint_t get_min (void) const
{
- for (unsigned int i = 0; i < ELTS; i++)
- if (elts[i])
- for (unsigned int j = 0; j < BITS; j++)
- if (elts[i] & (1u << j))
- return i * BITS + j;
+ unsigned int count = pages.len;
+ for (unsigned int i = 0; i < count; i++)
+ if (!page_at (i).is_empty ())
+ return page_map[i].major * page_t::PAGE_BITS + page_at (i).get_min ();
return INVALID;
}
inline hb_codepoint_t get_max (void) const
{
- for (unsigned int i = ELTS; i; i--)
- if (elts[i - 1])
- for (unsigned int j = BITS; j; j--)
- if (elts[i - 1] & (1u << (j - 1)))
- return (i - 1) * BITS + (j - 1);
+ unsigned int count = pages.len;
+ for (int i = count - 1; i >= 0; i++)
+ if (!page_at (i).is_empty ())
+ return page_map[i].major * page_t::PAGE_BITS + page_at (i).get_max ();
return INVALID;
}
- typedef uint32_t elt_t;
- static const unsigned int MAX_G = 65536 - 1; /* XXX Fix this... */
- static const unsigned int SHIFT = 5;
- static const unsigned int BITS = (1 << SHIFT);
- static const unsigned int MASK = BITS - 1;
- static const unsigned int ELTS = (MAX_G + 1 + (BITS - 1)) / BITS;
static const hb_codepoint_t INVALID = HB_SET_VALUE_INVALID;
- elt_t &elt (hb_codepoint_t g) { return elts[g >> SHIFT]; }
- elt_t const &elt (hb_codepoint_t g) const { return elts[g >> SHIFT]; }
- elt_t mask (hb_codepoint_t g) const { return elt_t (1) << (g & MASK); }
-
- elt_t elts[ELTS]; /* XXX 8kb */
-
- ASSERT_STATIC (sizeof (elt_t) * 8 == BITS);
- ASSERT_STATIC (sizeof (elt_t) * 8 * ELTS > MAX_G);
-};
-
-struct hb_frozen_set_t
-{
- static const unsigned int SHIFT = hb_set_t::SHIFT;
- static const unsigned int BITS = hb_set_t::BITS;
- static const unsigned int MASK = hb_set_t::MASK;
- typedef hb_set_t::elt_t elt_t;
-
- inline void init (const hb_set_t &set)
+ inline page_t *page_for_insert (hb_codepoint_t g)
{
- start = count = 0;
- elts = NULL;
-
- unsigned int max = set.get_max ();
- if (max == set.INVALID)
- return;
- unsigned int min = set.get_min ();
- const elt_t &min_elt = set.elt (min);
-
- start = min & ~MASK;
- count = max - start + 1;
- unsigned int num_elts = (count + BITS - 1) / BITS;
- unsigned int elts_size = num_elts * sizeof (elt_t);
- elts = (elt_t *) malloc (elts_size);
- if (unlikely (!elts))
+ page_map_t map = {get_major (g), pages.len};
+ unsigned int i;
+ if (!page_map.bfind (&map, &i))
{
- start = count = 0;
- return;
+ if (!resize (pages.len + 1))
+ return nullptr;
+
+ pages[map.index].init0 ();
+ memmove (&page_map[i + 1], &page_map[i], (page_map.len - 1 - i) * sizeof (page_map[0]));
+ page_map[i] = map;
}
- memcpy (elts, &min_elt, elts_size);
+ return &pages[page_map[i].index];
}
-
- inline void fini (void)
+ inline page_t *page_for (hb_codepoint_t g)
{
- if (elts)
- free (elts);
+ page_map_t key = {get_major (g)};
+ const page_map_t *found = page_map.bsearch (&key);
+ if (found)
+ return &pages[found->index];
+ return nullptr;
}
-
- inline bool has (hb_codepoint_t g) const
+ inline const page_t *page_for (hb_codepoint_t g) const
{
- /* hb_codepoint_t is unsigned. */
- g -= start;
- if (unlikely (g > count)) return false;
- return !!(elt (g) & mask (g));
- }
-
- elt_t const &elt (hb_codepoint_t g) const { return elts[g >> SHIFT]; }
- elt_t mask (hb_codepoint_t g) const { return elt_t (1) << (g & MASK); }
-
- private:
- hb_codepoint_t start, count;
- elt_t *elts;
+ page_map_t key = {get_major (g)};
+ const page_map_t *found = page_map.bsearch (&key);
+ if (found)
+ return &pages[found->index];
+ return nullptr;
+ }
+ inline page_t &page_at (unsigned int i) { return pages[page_map[i].index]; }
+ inline const page_t &page_at (unsigned int i) const { return pages[page_map[i].index]; }
+ inline unsigned int get_major (hb_codepoint_t g) const { return g / page_t::PAGE_BITS; }
+ inline hb_codepoint_t major_start (unsigned int major) const { return major * page_t::PAGE_BITS; }
};
diff --git a/src/3rdparty/harfbuzz-ng/src/hb-set.cc b/src/3rdparty/harfbuzz-ng/src/hb-set.cc
index cb7fcdbf64..0b4f871e85 100644
--- a/src/3rdparty/harfbuzz-ng/src/hb-set.cc
+++ b/src/3rdparty/harfbuzz-ng/src/hb-set.cc
@@ -45,7 +45,7 @@ hb_set_create (void)
if (!(set = hb_object_create<hb_set_t> ()))
return hb_set_get_empty ();
- set->clear ();
+ set->init ();
return set;
}
@@ -95,7 +95,7 @@ hb_set_destroy (hb_set_t *set)
{
if (!hb_object_destroy (set)) return;
- set->fini ();
+ set->finish ();
free (set);
}
@@ -105,7 +105,7 @@ hb_set_destroy (hb_set_t *set)
* @set: a set.
* @key:
* @data:
- * @destroy (closure data):
+ * @destroy:
* @replace:
*
* Return value:
@@ -376,11 +376,12 @@ hb_set_symmetric_difference (hb_set_t *set,
*
*
* Since: 0.9.10
+ *
+ * Deprecated: 1.6.1
**/
void
hb_set_invert (hb_set_t *set)
{
- set->invert ();
}
/**
diff --git a/src/3rdparty/harfbuzz-ng/src/hb-set.h b/src/3rdparty/harfbuzz-ng/src/hb-set.h
index 2164c1a654..2ce406073c 100644
--- a/src/3rdparty/harfbuzz-ng/src/hb-set.h
+++ b/src/3rdparty/harfbuzz-ng/src/hb-set.h
@@ -126,9 +126,6 @@ HB_EXTERN void
hb_set_symmetric_difference (hb_set_t *set,
const hb_set_t *other);
-HB_EXTERN void
-hb_set_invert (hb_set_t *set);
-
HB_EXTERN unsigned int
hb_set_get_population (const hb_set_t *set);
diff --git a/src/3rdparty/harfbuzz-ng/src/hb-shape-plan.cc b/src/3rdparty/harfbuzz-ng/src/hb-shape-plan.cc
index 600faaeb18..6eeba2b3d1 100644
--- a/src/3rdparty/harfbuzz-ng/src/hb-shape-plan.cc
+++ b/src/3rdparty/harfbuzz-ng/src/hb-shape-plan.cc
@@ -24,24 +24,14 @@
* Google Author(s): Behdad Esfahbod
*/
+#include "hb-private.hh"
+#include "hb-debug.hh"
#include "hb-shape-plan-private.hh"
#include "hb-shaper-private.hh"
#include "hb-font-private.hh"
#include "hb-buffer-private.hh"
-#ifndef HB_DEBUG_SHAPE_PLAN
-#define HB_DEBUG_SHAPE_PLAN (HB_DEBUG+0)
-#endif
-
-
-#define HB_SHAPER_IMPLEMENT(shaper) \
- HB_SHAPER_DATA_ENSURE_DECLARE(shaper, face) \
- HB_SHAPER_DATA_ENSURE_DECLARE(shaper, font)
-#include "hb-shaper-list.hh"
-#undef HB_SHAPER_IMPLEMENT
-
-
static void
hb_shape_plan_plan (hb_shape_plan_t *shape_plan,
const hb_feature_t *user_features,
@@ -122,7 +112,7 @@ hb_shape_plan_create (hb_face_t *face,
{
return hb_shape_plan_create2 (face, props,
user_features, num_user_features,
- NULL, 0,
+ nullptr, 0,
shaper_list);
}
@@ -135,7 +125,7 @@ hb_shape_plan_create2 (hb_face_t *face,
unsigned int num_coords,
const char * const *shaper_list)
{
- DEBUG_MSG_FUNC (SHAPE_PLAN, NULL,
+ DEBUG_MSG_FUNC (SHAPE_PLAN, nullptr,
"face=%p num_features=%d num_coords=%d shaper_list=%p",
face,
num_user_features,
@@ -143,8 +133,8 @@ hb_shape_plan_create2 (hb_face_t *face,
shaper_list);
hb_shape_plan_t *shape_plan;
- hb_feature_t *features = NULL;
- int *coords = NULL;
+ hb_feature_t *features = nullptr;
+ int *coords = nullptr;
if (unlikely (!face))
face = hb_face_get_empty ();
@@ -167,7 +157,7 @@ hb_shape_plan_create2 (hb_face_t *face,
assert (props->direction != HB_DIRECTION_INVALID);
hb_face_make_immutable (face);
- shape_plan->default_shaper_list = shaper_list == NULL;
+ shape_plan->default_shaper_list = !shaper_list;
shape_plan->face_unsafe = face;
shape_plan->props = *props;
shape_plan->num_user_features = num_user_features;
@@ -203,16 +193,16 @@ hb_shape_plan_get_empty (void)
HB_OBJECT_HEADER_STATIC,
true, /* default_shaper_list */
- NULL, /* face */
+ nullptr, /* face */
HB_SEGMENT_PROPERTIES_DEFAULT, /* props */
- NULL, /* shaper_func */
- NULL, /* shaper_name */
+ nullptr, /* shaper_func */
+ nullptr, /* shaper_name */
- NULL, /* user_features */
+ nullptr, /* user_features */
0, /* num_user_featurs */
- NULL, /* coords */
+ nullptr, /* coords */
0, /* num_coords */
{
@@ -430,7 +420,7 @@ hb_shape_plan_matches (const hb_shape_plan_t *shape_plan,
return hb_segment_properties_equal (&shape_plan->props, &proposal->props) &&
hb_shape_plan_user_features_match (shape_plan, proposal) &&
hb_shape_plan_coords_match (shape_plan, proposal) &&
- ((shape_plan->default_shaper_list && proposal->shaper_list == NULL) ||
+ ((shape_plan->default_shaper_list && !proposal->shaper_list) ||
(shape_plan->shaper_func == proposal->shaper_func));
}
@@ -438,11 +428,12 @@ static inline hb_bool_t
hb_non_global_user_features_present (const hb_feature_t *user_features,
unsigned int num_user_features)
{
- while (num_user_features)
+ while (num_user_features) {
if (user_features->start != 0 || user_features->end != (unsigned int) -1)
return true;
- else
- num_user_features--, user_features++;
+ num_user_features--;
+ user_features++;
+ }
return false;
}
@@ -476,7 +467,7 @@ hb_shape_plan_create_cached (hb_face_t *face,
{
return hb_shape_plan_create_cached2 (face, props,
user_features, num_user_features,
- NULL, 0,
+ nullptr, 0,
shaper_list);
}
@@ -489,7 +480,7 @@ hb_shape_plan_create_cached2 (hb_face_t *face,
unsigned int num_coords,
const char * const *shaper_list)
{
- DEBUG_MSG_FUNC (SHAPE_PLAN, NULL,
+ DEBUG_MSG_FUNC (SHAPE_PLAN, nullptr,
"face=%p num_features=%d shaper_list=%p",
face,
num_user_features,
@@ -500,7 +491,7 @@ hb_shape_plan_create_cached2 (hb_face_t *face,
shaper_list,
user_features,
num_user_features,
- NULL
+ nullptr
};
if (shaper_list) {
@@ -526,15 +517,17 @@ hb_shape_plan_create_cached2 (hb_face_t *face,
retry:
hb_face_t::plan_node_t *cached_plan_nodes = (hb_face_t::plan_node_t *) hb_atomic_ptr_get (&face->shape_plans);
- for (hb_face_t::plan_node_t *node = cached_plan_nodes; node; node = node->next)
- if (hb_shape_plan_matches (node->shape_plan, &proposal))
- {
- DEBUG_MSG_FUNC (SHAPE_PLAN, node->shape_plan, "fulfilled from cache");
- return hb_shape_plan_reference (node->shape_plan);
- }
- /* Not found. */
+ /* Don't look for plan in the cache if there were variation coordinates XXX Fix me. */
+ if (!hb_coords_present (coords, num_coords))
+ for (hb_face_t::plan_node_t *node = cached_plan_nodes; node; node = node->next)
+ if (hb_shape_plan_matches (node->shape_plan, &proposal))
+ {
+ DEBUG_MSG_FUNC (SHAPE_PLAN, node->shape_plan, "fulfilled from cache");
+ return hb_shape_plan_reference (node->shape_plan);
+ }
+ /* Not found. */
hb_shape_plan_t *shape_plan = hb_shape_plan_create2 (face, props,
user_features, num_user_features,
coords, num_coords,
diff --git a/src/3rdparty/harfbuzz-ng/src/hb-shape.cc b/src/3rdparty/harfbuzz-ng/src/hb-shape.cc
index 706f14420d..39355b337d 100644
--- a/src/3rdparty/harfbuzz-ng/src/hb-shape.cc
+++ b/src/3rdparty/harfbuzz-ng/src/hb-shape.cc
@@ -45,254 +45,6 @@
* contains the output glyphs and their positions.
**/
-static bool
-parse_space (const char **pp, const char *end)
-{
- while (*pp < end && ISSPACE (**pp))
- (*pp)++;
- return true;
-}
-
-static bool
-parse_char (const char **pp, const char *end, char c)
-{
- parse_space (pp, end);
-
- if (*pp == end || **pp != c)
- return false;
-
- (*pp)++;
- return true;
-}
-
-static bool
-parse_uint (const char **pp, const char *end, unsigned int *pv)
-{
- char buf[32];
- unsigned int len = MIN (ARRAY_LENGTH (buf) - 1, (unsigned int) (end - *pp));
- strncpy (buf, *pp, len);
- buf[len] = '\0';
-
- char *p = buf;
- char *pend = p;
- unsigned int v;
-
- /* Intentionally use strtol instead of strtoul, such that
- * -1 turns into "big number"... */
- errno = 0;
- v = strtol (p, &pend, 0);
- if (errno || p == pend)
- return false;
-
- *pv = v;
- *pp += pend - p;
- return true;
-}
-
-static bool
-parse_bool (const char **pp, const char *end, unsigned int *pv)
-{
- parse_space (pp, end);
-
- const char *p = *pp;
- while (*pp < end && ISALPHA(**pp))
- (*pp)++;
-
- /* CSS allows on/off as aliases 1/0. */
- if (*pp - p == 2 || 0 == strncmp (p, "on", 2))
- *pv = 1;
- else if (*pp - p == 3 || 0 == strncmp (p, "off", 2))
- *pv = 0;
- else
- return false;
-
- return true;
-}
-
-static bool
-parse_feature_value_prefix (const char **pp, const char *end, hb_feature_t *feature)
-{
- if (parse_char (pp, end, '-'))
- feature->value = 0;
- else {
- parse_char (pp, end, '+');
- feature->value = 1;
- }
-
- return true;
-}
-
-static bool
-parse_feature_tag (const char **pp, const char *end, hb_feature_t *feature)
-{
- parse_space (pp, end);
-
- char quote = 0;
-
- if (*pp < end && (**pp == '\'' || **pp == '"'))
- {
- quote = **pp;
- (*pp)++;
- }
-
- const char *p = *pp;
- while (*pp < end && ISALNUM(**pp))
- (*pp)++;
-
- if (p == *pp || *pp - p > 4)
- return false;
-
- feature->tag = hb_tag_from_string (p, *pp - p);
-
- if (quote)
- {
- /* CSS expects exactly four bytes. And we only allow quotations for
- * CSS compatibility. So, enforce the length. */
- if (*pp - p != 4)
- return false;
- if (*pp == end || **pp != quote)
- return false;
- (*pp)++;
- }
-
- return true;
-}
-
-static bool
-parse_feature_indices (const char **pp, const char *end, hb_feature_t *feature)
-{
- parse_space (pp, end);
-
- bool has_start;
-
- feature->start = 0;
- feature->end = (unsigned int) -1;
-
- if (!parse_char (pp, end, '['))
- return true;
-
- has_start = parse_uint (pp, end, &feature->start);
-
- if (parse_char (pp, end, ':')) {
- parse_uint (pp, end, &feature->end);
- } else {
- if (has_start)
- feature->end = feature->start + 1;
- }
-
- return parse_char (pp, end, ']');
-}
-
-static bool
-parse_feature_value_postfix (const char **pp, const char *end, hb_feature_t *feature)
-{
- bool had_equal = parse_char (pp, end, '=');
- bool had_value = parse_uint (pp, end, &feature->value) ||
- parse_bool (pp, end, &feature->value);
- /* CSS doesn't use equal-sign between tag and value.
- * If there was an equal-sign, then there *must* be a value.
- * A value without an eqaul-sign is ok, but not required. */
- return !had_equal || had_value;
-}
-
-
-static bool
-parse_one_feature (const char **pp, const char *end, hb_feature_t *feature)
-{
- return parse_feature_value_prefix (pp, end, feature) &&
- parse_feature_tag (pp, end, feature) &&
- parse_feature_indices (pp, end, feature) &&
- parse_feature_value_postfix (pp, end, feature) &&
- parse_space (pp, end) &&
- *pp == end;
-}
-
-/**
- * hb_feature_from_string:
- * @str: (array length=len) (element-type uint8_t): a string to parse
- * @len: length of @str, or -1 if string is %NULL terminated
- * @feature: (out): the #hb_feature_t to initialize with the parsed values
- *
- * Parses a string into a #hb_feature_t.
- *
- * TODO: document the syntax here.
- *
- * Return value:
- * %true if @str is successfully parsed, %false otherwise.
- *
- * Since: 0.9.5
- **/
-hb_bool_t
-hb_feature_from_string (const char *str, int len,
- hb_feature_t *feature)
-{
- hb_feature_t feat;
-
- if (len < 0)
- len = strlen (str);
-
- if (likely (parse_one_feature (&str, str + len, &feat)))
- {
- if (feature)
- *feature = feat;
- return true;
- }
-
- if (feature)
- memset (feature, 0, sizeof (*feature));
- return false;
-}
-
-/**
- * hb_feature_to_string:
- * @feature: an #hb_feature_t to convert
- * @buf: (array length=size) (out): output string
- * @size: the allocated size of @buf
- *
- * Converts a #hb_feature_t into a %NULL-terminated string in the format
- * understood by hb_feature_from_string(). The client in responsible for
- * allocating big enough size for @buf, 128 bytes is more than enough.
- *
- * Since: 0.9.5
- **/
-void
-hb_feature_to_string (hb_feature_t *feature,
- char *buf, unsigned int size)
-{
- if (unlikely (!size)) return;
-
- char s[128];
- unsigned int len = 0;
- if (feature->value == 0)
- s[len++] = '-';
- hb_tag_to_string (feature->tag, s + len);
- len += 4;
- while (len && s[len - 1] == ' ')
- len--;
- if (feature->start != 0 || feature->end != (unsigned int) -1)
- {
- s[len++] = '[';
- if (feature->start)
- len += MAX (0, snprintf (s + len, ARRAY_LENGTH (s) - len, "%u", feature->start));
- if (feature->end != feature->start + 1) {
- s[len++] = ':';
- if (feature->end != (unsigned int) -1)
- len += MAX (0, snprintf (s + len, ARRAY_LENGTH (s) - len, "%u", feature->end));
- }
- s[len++] = ']';
- }
- if (feature->value > 1)
- {
- s[len++] = '=';
- len += MAX (0, snprintf (s + len, ARRAY_LENGTH (s) - len, "%u", feature->value));
- }
- assert (len < ARRAY_LENGTH (s));
- len = MIN (len, size - 1);
- memcpy (buf, s, len);
- buf[len] = '\0';
-}
-
-
static const char **static_shaper_list;
#ifdef HB_USE_ATEXIT
@@ -324,7 +76,7 @@ retry:
/* Not found; allocate one. */
shaper_list = (const char **) calloc (1 + HB_SHAPERS_COUNT, sizeof (const char *));
if (unlikely (!shaper_list)) {
- static const char *nil_shaper_list[] = {NULL};
+ static const char *nil_shaper_list[] = {nullptr};
return nil_shaper_list;
}
@@ -332,9 +84,9 @@ retry:
unsigned int i;
for (i = 0; i < HB_SHAPERS_COUNT; i++)
shaper_list[i] = shapers[i].name;
- shaper_list[i] = NULL;
+ shaper_list[i] = nullptr;
- if (!hb_atomic_ptr_cmpexch (&static_shaper_list, NULL, shaper_list)) {
+ if (!hb_atomic_ptr_cmpexch (&static_shaper_list, nullptr, shaper_list)) {
free (shaper_list);
goto retry;
}
@@ -362,7 +114,7 @@ retry:
* shapers will be used in the given order, otherwise the default shapers list
* will be used.
*
- * Return value: %FALSE if all shapers failed, %TRUE otherwise
+ * Return value: false if all shapers failed, true otherwise
*
* Since: 0.9.2
**/
@@ -405,5 +157,5 @@ hb_shape (hb_font_t *font,
const hb_feature_t *features,
unsigned int num_features)
{
- hb_shape_full (font, buffer, features, num_features, NULL);
+ hb_shape_full (font, buffer, features, num_features, nullptr);
}
diff --git a/src/3rdparty/harfbuzz-ng/src/hb-shape.h b/src/3rdparty/harfbuzz-ng/src/hb-shape.h
index 53bb845bf4..39507ff744 100644
--- a/src/3rdparty/harfbuzz-ng/src/hb-shape.h
+++ b/src/3rdparty/harfbuzz-ng/src/hb-shape.h
@@ -40,22 +40,6 @@
HB_BEGIN_DECLS
-typedef struct hb_feature_t {
- hb_tag_t tag;
- uint32_t value;
- unsigned int start;
- unsigned int end;
-} hb_feature_t;
-
-HB_EXTERN hb_bool_t
-hb_feature_from_string (const char *str, int len,
- hb_feature_t *feature);
-
-HB_EXTERN void
-hb_feature_to_string (hb_feature_t *feature,
- char *buf, unsigned int size);
-
-
HB_EXTERN void
hb_shape (hb_font_t *font,
hb_buffer_t *buffer,
diff --git a/src/3rdparty/harfbuzz-ng/src/hb-shaper-private.hh b/src/3rdparty/harfbuzz-ng/src/hb-shaper-private.hh
index d1d1146dad..ce2d9f2839 100644
--- a/src/3rdparty/harfbuzz-ng/src/hb-shaper-private.hh
+++ b/src/3rdparty/harfbuzz-ng/src/hb-shaper-private.hh
@@ -65,35 +65,51 @@ struct hb_shaper_data_t {
#define HB_SHAPER_DATA_INVALID ((void *) -1)
#define HB_SHAPER_DATA_IS_INVALID(data) ((void *) (data) == HB_SHAPER_DATA_INVALID)
-#define HB_SHAPER_DATA_TYPE(shaper, object) struct hb_##shaper##_shaper_##object##_data_t
+#define HB_SHAPER_DATA_TYPE_NAME(shaper, object) hb_##shaper##_shaper_##object##_data_t
+#define HB_SHAPER_DATA_TYPE(shaper, object) struct HB_SHAPER_DATA_TYPE_NAME(shaper, object)
#define HB_SHAPER_DATA_INSTANCE(shaper, object, instance) (* (HB_SHAPER_DATA_TYPE(shaper, object) **) &(instance)->shaper_data.shaper)
-#define HB_SHAPER_DATA(shaper, object) HB_SHAPER_DATA_INSTANCE (shaper, object, object)
+#define HB_SHAPER_DATA(shaper, object) HB_SHAPER_DATA_INSTANCE(shaper, object, object)
#define HB_SHAPER_DATA_CREATE_FUNC(shaper, object) _hb_##shaper##_shaper_##object##_data_create
#define HB_SHAPER_DATA_DESTROY_FUNC(shaper, object) _hb_##shaper##_shaper_##object##_data_destroy
+#define HB_SHAPER_DATA_ENSURE_FUNC(shaper, object) hb_##shaper##_shaper_##object##_data_ensure
#define HB_SHAPER_DATA_PROTOTYPE(shaper, object) \
HB_SHAPER_DATA_TYPE (shaper, object); /* Type forward declaration. */ \
extern "C" HB_INTERNAL HB_SHAPER_DATA_TYPE (shaper, object) * \
HB_SHAPER_DATA_CREATE_FUNC (shaper, object) (hb_##object##_t *object HB_SHAPER_DATA_CREATE_FUNC_EXTRA_ARGS); \
extern "C" HB_INTERNAL void \
- HB_SHAPER_DATA_DESTROY_FUNC (shaper, object) (HB_SHAPER_DATA_TYPE (shaper, object) *data)
+ HB_SHAPER_DATA_DESTROY_FUNC (shaper, object) (HB_SHAPER_DATA_TYPE (shaper, object) *data); \
+ extern "C" HB_INTERNAL bool \
+ HB_SHAPER_DATA_ENSURE_FUNC (shaper, object) (hb_##object##_t *object)
#define HB_SHAPER_DATA_DESTROY(shaper, object) \
if (HB_SHAPER_DATA_TYPE (shaper, object) *data = HB_SHAPER_DATA (shaper, object)) \
if (data != HB_SHAPER_DATA_INVALID && data != HB_SHAPER_DATA_SUCCEEDED) \
HB_SHAPER_DATA_DESTROY_FUNC (shaper, object) (data);
-#define HB_SHAPER_DATA_ENSURE_DECLARE(shaper, object) \
-static inline bool \
-hb_##shaper##_shaper_##object##_data_ensure (hb_##object##_t *object) \
+#define HB_SHAPER_DATA_ENSURE_DEFINE(shaper, object) \
+ HB_SHAPER_DATA_ENSURE_DEFINE_WITH_CONDITION(shaper, object, true)
+
+#define HB_SHAPER_DATA_ENSURE_DEFINE_WITH_CONDITION(shaper, object, condition) \
+bool \
+HB_SHAPER_DATA_ENSURE_FUNC(shaper, object) (hb_##object##_t *object) \
{\
retry: \
HB_SHAPER_DATA_TYPE (shaper, object) *data = (HB_SHAPER_DATA_TYPE (shaper, object) *) hb_atomic_ptr_get (&HB_SHAPER_DATA (shaper, object)); \
+ if (likely (data) && !(condition)) { \
+ /* Drop and recreate. */ \
+ /* If someone dropped it in the mean time, throw it away and don't touch it. \
+ * Otherwise, destruct it. */ \
+ if (hb_atomic_ptr_cmpexch (&HB_SHAPER_DATA (shaper, object), data, nullptr)) { \
+ HB_SHAPER_DATA_DESTROY_FUNC (shaper, object) (data); \
+ } \
+ goto retry; \
+ } \
if (unlikely (!data)) { \
data = HB_SHAPER_DATA_CREATE_FUNC (shaper, object) (object); \
if (unlikely (!data)) \
data = (HB_SHAPER_DATA_TYPE (shaper, object) *) HB_SHAPER_DATA_INVALID; \
- if (!hb_atomic_ptr_cmpexch (&HB_SHAPER_DATA (shaper, object), NULL, data)) { \
+ if (!hb_atomic_ptr_cmpexch (&HB_SHAPER_DATA (shaper, object), nullptr, data)) { \
if (data && \
data != HB_SHAPER_DATA_INVALID && \
data != HB_SHAPER_DATA_SUCCEEDED) \
@@ -101,7 +117,7 @@ hb_##shaper##_shaper_##object##_data_ensure (hb_##object##_t *object) \
goto retry; \
} \
} \
- return data != NULL && !HB_SHAPER_DATA_IS_INVALID (data); \
+ return data != nullptr && !HB_SHAPER_DATA_IS_INVALID (data); \
}
diff --git a/src/3rdparty/harfbuzz-ng/src/hb-shaper.cc b/src/3rdparty/harfbuzz-ng/src/hb-shaper.cc
index b25566d8a7..2c44cf2653 100644
--- a/src/3rdparty/harfbuzz-ng/src/hb-shaper.cc
+++ b/src/3rdparty/harfbuzz-ng/src/hb-shaper.cc
@@ -59,14 +59,14 @@ retry:
{
char *env = getenv ("HB_SHAPER_LIST");
if (!env || !*env) {
- (void) hb_atomic_ptr_cmpexch (&static_shapers, NULL, &all_shapers[0]);
+ (void) hb_atomic_ptr_cmpexch (&static_shapers, nullptr, &all_shapers[0]);
return (const hb_shaper_pair_t *) all_shapers;
}
/* Not found; allocate one. */
shapers = (hb_shaper_pair_t *) calloc (1, sizeof (all_shapers));
if (unlikely (!shapers)) {
- (void) hb_atomic_ptr_cmpexch (&static_shapers, NULL, &all_shapers[0]);
+ (void) hb_atomic_ptr_cmpexch (&static_shapers, nullptr, &all_shapers[0]);
return (const hb_shaper_pair_t *) all_shapers;
}
@@ -97,7 +97,7 @@ retry:
p = end + 1;
}
- if (!hb_atomic_ptr_cmpexch (&static_shapers, NULL, shapers)) {
+ if (!hb_atomic_ptr_cmpexch (&static_shapers, nullptr, shapers)) {
free (shapers);
goto retry;
}
diff --git a/src/3rdparty/harfbuzz-ng/src/hb-string-array.hh b/src/3rdparty/harfbuzz-ng/src/hb-string-array.hh
new file mode 100644
index 0000000000..ba829b0cf0
--- /dev/null
+++ b/src/3rdparty/harfbuzz-ng/src/hb-string-array.hh
@@ -0,0 +1,81 @@
+/*
+ * Copyright © 2017 Google, Inc.
+ *
+ * This is part of HarfBuzz, a text shaping library.
+ *
+ * Permission is hereby granted, without written agreement and without
+ * license or royalty fees, to use, copy, modify, and distribute this
+ * software and its documentation for any purpose, provided that the
+ * above copyright notice and the following two paragraphs appear in
+ * all copies of this software.
+ *
+ * IN NO EVENT SHALL THE COPYRIGHT HOLDER BE LIABLE TO ANY PARTY FOR
+ * DIRECT, INDIRECT, SPECIAL, INCIDENTAL, OR CONSEQUENTIAL DAMAGES
+ * ARISING OUT OF THE USE OF THIS SOFTWARE AND ITS DOCUMENTATION, EVEN
+ * IF THE COPYRIGHT HOLDER HAS BEEN ADVISED OF THE POSSIBILITY OF SUCH
+ * DAMAGE.
+ *
+ * THE COPYRIGHT HOLDER SPECIFICALLY DISCLAIMS ANY WARRANTIES, INCLUDING,
+ * BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND
+ * FITNESS FOR A PARTICULAR PURPOSE. THE SOFTWARE PROVIDED HEREUNDER IS
+ * ON AN "AS IS" BASIS, AND THE COPYRIGHT HOLDER HAS NO OBLIGATION TO
+ * PROVIDE MAINTENANCE, SUPPORT, UPDATES, ENHANCEMENTS, OR MODIFICATIONS.
+ *
+ * Google Author(s): Behdad Esfahbod
+ */
+
+#ifndef HB_STRING_ARRAY_HH
+#if 0 /* Make checks happy. */
+#define HB_STRING_ARRAY_HH
+#endif
+
+#include "hb-private.hh"
+
+/* Based on Bruno Haible's code in Appendix B of Ulrich Drepper's dsohowto.pdf:
+ * https://software.intel.com/sites/default/files/m/a/1/e/dsohowto.pdf */
+
+#define HB_STRING_ARRAY_TYPE_NAME HB_PASTE(HB_STRING_ARRAY_NAME, _msgstr_t)
+#define HB_STRING_ARRAY_POOL_NAME HB_PASTE(HB_STRING_ARRAY_NAME, _msgstr)
+#define HB_STRING_ARRAY_OFFS_NAME HB_PASTE(HB_STRING_ARRAY_NAME, _msgidx)
+
+static const union HB_STRING_ARRAY_TYPE_NAME {
+ struct {
+/* I like to avoid storing the nul-termination byte since we don't need it,
+ * but C++ does not allow that.
+ * https://stackoverflow.com/questions/28433862/why-initializer-string-for-array-of-chars-is-too-long-compiles-fine-in-c-not
+ */
+#define _S(s) char HB_PASTE (str, __LINE__)[sizeof (s)];
+#include HB_STRING_ARRAY_LIST
+#undef _S
+ } st;
+ char str[VAR];
+}
+HB_STRING_ARRAY_POOL_NAME =
+{
+ {
+#define _S(s) s,
+#include HB_STRING_ARRAY_LIST
+#undef _S
+ }
+};
+static const unsigned int HB_STRING_ARRAY_OFFS_NAME[] =
+{
+#define _S(s) offsetof (union HB_STRING_ARRAY_TYPE_NAME, st.HB_PASTE(str, __LINE__)),
+#include HB_STRING_ARRAY_LIST
+#undef _S
+ sizeof (HB_STRING_ARRAY_TYPE_NAME)
+};
+
+static inline hb_string_t
+HB_STRING_ARRAY_NAME (unsigned int i)
+{
+ assert (i < ARRAY_LENGTH (HB_STRING_ARRAY_OFFS_NAME) - 1);
+ return hb_string_t (HB_STRING_ARRAY_POOL_NAME.str + HB_STRING_ARRAY_OFFS_NAME[i],
+ HB_STRING_ARRAY_OFFS_NAME[i + 1] - HB_STRING_ARRAY_OFFS_NAME[i] - 1);
+}
+
+#undef HB_STRING_ARRAY_TYPE_NAME
+#undef HB_STRING_ARRAY_POOL_NAME
+#undef HB_STRING_ARRAY_OFFS_NAME
+
+#endif /* HB_STRING_ARRAY_HH */
diff --git a/src/3rdparty/harfbuzz-ng/src/hb-unicode-private.hh b/src/3rdparty/harfbuzz-ng/src/hb-unicode-private.hh
index a4d118b6dc..82bb9a4ddc 100644
--- a/src/3rdparty/harfbuzz-ng/src/hb-unicode-private.hh
+++ b/src/3rdparty/harfbuzz-ng/src/hb-unicode-private.hh
@@ -108,7 +108,7 @@ HB_UNICODE_FUNCS_IMPLEMENT_CALLBACKS_SIMPLE
/* XXX This hack belongs to the Myanmar shaper. */
if (unlikely (unicode == 0x1037u)) unicode = 0x103Au;
- /* XXX This hack belongs to the SEA shaper (for Tai Tham):
+ /* XXX This hack belongs to the USE shaper (for Tai Tham):
* Reorder SAKOT to ensure it comes after any tone marks. */
if (unlikely (unicode == 0x1A60u)) return 254;
@@ -126,7 +126,7 @@ HB_UNICODE_FUNCS_IMPLEMENT_CALLBACKS_SIMPLE
{
/* U+180B..180D MONGOLIAN FREE VARIATION SELECTORs are handled in the
* Arabic shaper. No need to match them here. */
- return unlikely (hb_in_ranges (unicode,
+ return unlikely (hb_in_ranges<hb_codepoint_t> (unicode,
0xFE00u, 0xFE0Fu, /* VARIATION SELECTOR-1..16 */
0xE0100u, 0xE01EFu)); /* VARIATION SELECTOR-17..256 */
}
@@ -137,6 +137,7 @@ HB_UNICODE_FUNCS_IMPLEMENT_CALLBACKS_SIMPLE
* we do NOT want to hide them, as the way Uniscribe has implemented them
* is with regular spacing glyphs, and that's the way fonts are made to work.
* As such, we make exceptions for those four.
+ * Also ignoring U+1BCA0..1BCA3. https://github.com/harfbuzz/harfbuzz/issues/503
*
* Unicode 7.0:
* $ grep '; Default_Ignorable_Code_Point ' DerivedCoreProperties.txt | sed 's/;.*#/#/'
@@ -179,13 +180,13 @@ HB_UNICODE_FUNCS_IMPLEMENT_CALLBACKS_SIMPLE
case 0x00: return unlikely (ch == 0x00ADu);
case 0x03: return unlikely (ch == 0x034Fu);
case 0x06: return unlikely (ch == 0x061Cu);
- case 0x17: return hb_in_range (ch, 0x17B4u, 0x17B5u);
- case 0x18: return hb_in_range (ch, 0x180Bu, 0x180Eu);
- case 0x20: return hb_in_ranges (ch, 0x200Bu, 0x200Fu,
+ case 0x17: return hb_in_range<hb_codepoint_t> (ch, 0x17B4u, 0x17B5u);
+ case 0x18: return hb_in_range<hb_codepoint_t> (ch, 0x180Bu, 0x180Eu);
+ case 0x20: return hb_in_ranges<hb_codepoint_t> (ch, 0x200Bu, 0x200Fu,
0x202Au, 0x202Eu,
0x2060u, 0x206Fu);
- case 0xFE: return hb_in_range (ch, 0xFE00u, 0xFE0Fu) || ch == 0xFEFFu;
- case 0xFF: return hb_in_range (ch, 0xFFF0u, 0xFFF8u);
+ case 0xFE: return hb_in_range<hb_codepoint_t> (ch, 0xFE00u, 0xFE0Fu) || ch == 0xFEFFu;
+ case 0xFF: return hb_in_range<hb_codepoint_t> (ch, 0xFFF0u, 0xFFF8u);
default: return false;
}
}
@@ -193,9 +194,8 @@ HB_UNICODE_FUNCS_IMPLEMENT_CALLBACKS_SIMPLE
{
/* Other planes */
switch (plane) {
- case 0x01: return hb_in_ranges (ch, 0x1BCA0u, 0x1BCA3u,
- 0x1D173u, 0x1D17Au);
- case 0x0E: return hb_in_range (ch, 0xE0000u, 0xE0FFFu);
+ case 0x01: return hb_in_range<hb_codepoint_t> (ch, 0x1D173u, 0x1D17Au);
+ case 0x0E: return hb_in_range<hb_codepoint_t> (ch, 0xE0000u, 0xE0FFFu);
default: return false;
}
}
@@ -346,23 +346,24 @@ extern HB_INTERNAL const hb_unicode_funcs_t _hb_unicode_funcs_nil;
#define HB_MODIFIED_COMBINING_CLASS_CCC122 122 /* mai * */
/* Tibetan
- * Modify U+0F74 (ccc=132) to reorder before ccc=130 marks.
+ *
+ * In case of multiple vowel-signs, use u first (but after achung)
+ * this allows Dzongkha multi-vowel shortcuts to render correctly
*/
#define HB_MODIFIED_COMBINING_CLASS_CCC129 129 /* sign aa */
-#define HB_MODIFIED_COMBINING_CLASS_CCC130 130 /* sign i */
-#define HB_MODIFIED_COMBINING_CLASS_CCC132 128 /* sign u */
-
+#define HB_MODIFIED_COMBINING_CLASS_CCC130 132 /* sign i */
+#define HB_MODIFIED_COMBINING_CLASS_CCC132 131 /* sign u */
/* Misc */
#define HB_UNICODE_GENERAL_CATEGORY_IS_MARK(gen_cat) \
- (FLAG_SAFE (gen_cat) & \
+ (FLAG_UNSAFE (gen_cat) & \
(FLAG (HB_UNICODE_GENERAL_CATEGORY_SPACING_MARK) | \
FLAG (HB_UNICODE_GENERAL_CATEGORY_ENCLOSING_MARK) | \
FLAG (HB_UNICODE_GENERAL_CATEGORY_NON_SPACING_MARK)))
#define HB_UNICODE_GENERAL_CATEGORY_IS_NON_ENCLOSING_MARK_OR_MODIFIER_SYMBOL(gen_cat) \
- (FLAG_SAFE (gen_cat) & \
+ (FLAG_UNSAFE (gen_cat) & \
(FLAG (HB_UNICODE_GENERAL_CATEGORY_SPACING_MARK) | \
FLAG (HB_UNICODE_GENERAL_CATEGORY_NON_SPACING_MARK) | \
FLAG (HB_UNICODE_GENERAL_CATEGORY_MODIFIER_SYMBOL)))
diff --git a/src/3rdparty/harfbuzz-ng/src/hb-unicode.cc b/src/3rdparty/harfbuzz-ng/src/hb-unicode.cc
index d553a7172f..726baeb0f1 100644
--- a/src/3rdparty/harfbuzz-ng/src/hb-unicode.cc
+++ b/src/3rdparty/harfbuzz-ng/src/hb-unicode.cc
@@ -188,7 +188,7 @@ hb_unicode_funcs_create (hb_unicode_funcs_t *parent)
const hb_unicode_funcs_t _hb_unicode_funcs_nil = {
HB_OBJECT_HEADER_STATIC,
- NULL, /* parent */
+ nullptr, /* parent */
true, /* immutable */
{
#define HB_UNICODE_FUNC_IMPLEMENT(name) hb_unicode_##name##_nil,
@@ -365,7 +365,7 @@ hb_unicode_funcs_set_##name##_func (hb_unicode_funcs_t *ufuncs, \
} else { \
ufuncs->func.name = ufuncs->parent->func.name; \
ufuncs->user_data.name = ufuncs->parent->user_data.name; \
- ufuncs->destroy.name = NULL; \
+ ufuncs->destroy.name = nullptr; \
} \
}
diff --git a/src/3rdparty/harfbuzz-ng/src/hb-utf-private.hh b/src/3rdparty/harfbuzz-ng/src/hb-utf-private.hh
index 74cf5d66a2..211eb4dc02 100644
--- a/src/3rdparty/harfbuzz-ng/src/hb-utf-private.hh
+++ b/src/3rdparty/harfbuzz-ng/src/hb-utf-private.hh
@@ -48,7 +48,7 @@ struct hb_utf8_t
if (c > 0x7Fu)
{
- if (hb_in_range (c, 0xC2u, 0xDFu)) /* Two-byte */
+ if (hb_in_range<hb_codepoint_t> (c, 0xC2u, 0xDFu)) /* Two-byte */
{
unsigned int t1;
if (likely (text < end &&
@@ -60,7 +60,7 @@ struct hb_utf8_t
else
goto error;
}
- else if (hb_in_range (c, 0xE0u, 0xEFu)) /* Three-byte */
+ else if (hb_in_range<hb_codepoint_t> (c, 0xE0u, 0xEFu)) /* Three-byte */
{
unsigned int t1, t2;
if (likely (1 < end - text &&
@@ -68,14 +68,14 @@ struct hb_utf8_t
(t2 = text[1] - 0x80u) <= 0x3Fu))
{
c = ((c&0xFu)<<12) | (t1<<6) | t2;
- if (unlikely (c < 0x0800u || hb_in_range (c, 0xD800u, 0xDFFFu)))
+ if (unlikely (c < 0x0800u || hb_in_range<hb_codepoint_t> (c, 0xD800u, 0xDFFFu)))
goto error;
text += 2;
}
else
goto error;
}
- else if (hb_in_range (c, 0xF0u, 0xF4u)) /* Four-byte */
+ else if (hb_in_range<hb_codepoint_t> (c, 0xF0u, 0xF4u)) /* Four-byte */
{
unsigned int t1, t2, t3;
if (likely (2 < end - text &&
@@ -84,7 +84,7 @@ struct hb_utf8_t
(t3 = text[2] - 0x80u) <= 0x3Fu))
{
c = ((c&0x7u)<<18) | (t1<<12) | (t2<<6) | t3;
- if (unlikely (!hb_in_range (c, 0x10000u, 0x10FFFFu)))
+ if (unlikely (!hb_in_range<hb_codepoint_t> (c, 0x10000u, 0x10FFFFu)))
goto error;
text += 3;
}
@@ -140,7 +140,7 @@ struct hb_utf16_t
{
hb_codepoint_t c = *text++;
- if (likely (!hb_in_range (c, 0xD800u, 0xDFFFu)))
+ if (likely (!hb_in_range<hb_codepoint_t> (c, 0xD800u, 0xDFFFu)))
{
*unicode = c;
return text;
@@ -150,7 +150,7 @@ struct hb_utf16_t
{
/* High-surrogate in c */
hb_codepoint_t l = *text;
- if (likely (hb_in_range (l, 0xDC00u, 0xDFFFu)))
+ if (likely (hb_in_range<hb_codepoint_t> (l, 0xDC00u, 0xDFFFu)))
{
/* Low-surrogate in l */
*unicode = (c << 10) + l - ((0xD800u << 10) - 0x10000u + 0xDC00u);
@@ -172,7 +172,7 @@ struct hb_utf16_t
{
hb_codepoint_t c = *--text;
- if (likely (!hb_in_range (c, 0xD800u, 0xDFFFu)))
+ if (likely (!hb_in_range<hb_codepoint_t> (c, 0xD800u, 0xDFFFu)))
{
*unicode = c;
return text;
@@ -182,7 +182,7 @@ struct hb_utf16_t
{
/* Low-surrogate in c */
hb_codepoint_t h = text[-1];
- if (likely (hb_in_range (h, 0xD800u, 0xDBFFu)))
+ if (likely (hb_in_range<hb_codepoint_t> (h, 0xD800u, 0xDBFFu)))
{
/* High-surrogate in h */
*unicode = (h << 10) + c - ((0xD800u << 10) - 0x10000u + 0xDC00u);
diff --git a/src/3rdparty/harfbuzz-ng/src/hb-version.h b/src/3rdparty/harfbuzz-ng/src/hb-version.h
index 0cbe947062..fc81b66b40 100644
--- a/src/3rdparty/harfbuzz-ng/src/hb-version.h
+++ b/src/3rdparty/harfbuzz-ng/src/hb-version.h
@@ -37,10 +37,10 @@ HB_BEGIN_DECLS
#define HB_VERSION_MAJOR 1
-#define HB_VERSION_MINOR 4
-#define HB_VERSION_MICRO 1
+#define HB_VERSION_MINOR 7
+#define HB_VERSION_MICRO 4
-#define HB_VERSION_STRING "1.4.1"
+#define HB_VERSION_STRING "1.7.4"
#define HB_VERSION_ATLEAST(major,minor,micro) \
((major)*10000+(minor)*100+(micro) <= \
diff --git a/src/android/jar/bundledjar.pro b/src/android/jar/bundledjar.pro
deleted file mode 100644
index e82c01c51b..0000000000
--- a/src/android/jar/bundledjar.pro
+++ /dev/null
@@ -1,3 +0,0 @@
-TARGET = QtAndroid-bundled
-CONFIG += bundled_jar_file
-include(jar.pri)
diff --git a/src/android/jar/distributedjar.pro b/src/android/jar/distributedjar.pro
deleted file mode 100644
index 15f362f629..0000000000
--- a/src/android/jar/distributedjar.pro
+++ /dev/null
@@ -1,2 +0,0 @@
-TARGET = QtAndroid
-include(jar.pri)
diff --git a/src/android/jar/jar.pri b/src/android/jar/jar.pri
deleted file mode 100644
index 4535880536..0000000000
--- a/src/android/jar/jar.pri
+++ /dev/null
@@ -1,26 +0,0 @@
-CONFIG += java
-DESTDIR = $$[QT_INSTALL_PREFIX/get]/jar
-API_VERSION = android-16
-
-PATHPREFIX = $$PWD/src/org/qtproject/qt5/android/
-
-JAVACLASSPATH += $$PWD/src/
-JAVASOURCES += \
- $$PATHPREFIX/accessibility/QtAccessibilityDelegate.java \
- $$PATHPREFIX/accessibility/QtNativeAccessibility.java \
- $$PATHPREFIX/QtActivityDelegate.java \
- $$PATHPREFIX/QtEditText.java \
- $$PATHPREFIX/QtInputConnection.java \
- $$PATHPREFIX/QtLayout.java \
- $$PATHPREFIX/QtMessageDialogHelper.java \
- $$PATHPREFIX/QtNative.java \
- $$PATHPREFIX/QtNativeLibrariesDir.java \
- $$PATHPREFIX/QtSurface.java \
- $$PATHPREFIX/ExtractStyle.java \
- $$PATHPREFIX/EditMenu.java \
- $$PATHPREFIX/EditPopupMenu.java \
- $$PATHPREFIX/CursorHandle.java
-
-# install
-target.path = $$[QT_INSTALL_PREFIX]/jar
-INSTALLS += target
diff --git a/src/android/jar/jar.pro b/src/android/jar/jar.pro
index 8d19c1b7d6..603e28aeee 100644
--- a/src/android/jar/jar.pro
+++ b/src/android/jar/jar.pro
@@ -1,2 +1,28 @@
-TEMPLATE = subdirs
-SUBDIRS += bundledjar.pro distributedjar.pro
+TARGET = QtAndroid
+
+CONFIG += java
+DESTDIR = $$[QT_INSTALL_PREFIX/get]/jar
+API_VERSION = android-16
+
+PATHPREFIX = $$PWD/src/org/qtproject/qt5/android/
+
+JAVACLASSPATH += $$PWD/src/
+JAVASOURCES += \
+ $$PATHPREFIX/accessibility/QtAccessibilityDelegate.java \
+ $$PATHPREFIX/accessibility/QtNativeAccessibility.java \
+ $$PATHPREFIX/QtActivityDelegate.java \
+ $$PATHPREFIX/QtEditText.java \
+ $$PATHPREFIX/QtInputConnection.java \
+ $$PATHPREFIX/QtLayout.java \
+ $$PATHPREFIX/QtMessageDialogHelper.java \
+ $$PATHPREFIX/QtNative.java \
+ $$PATHPREFIX/QtNativeLibrariesDir.java \
+ $$PATHPREFIX/QtSurface.java \
+ $$PATHPREFIX/ExtractStyle.java \
+ $$PATHPREFIX/EditMenu.java \
+ $$PATHPREFIX/EditPopupMenu.java \
+ $$PATHPREFIX/CursorHandle.java
+
+# install
+target.path = $$[QT_INSTALL_PREFIX]/jar
+INSTALLS += target
diff --git a/src/concurrent/doc/snippets/code/src_concurrent_qtconcurrentfilter.cpp b/src/concurrent/doc/snippets/code/src_concurrent_qtconcurrentfilter.cpp
index 9b15eeaa99..3cc1fe836c 100644
--- a/src/concurrent/doc/snippets/code/src_concurrent_qtconcurrentfilter.cpp
+++ b/src/concurrent/doc/snippets/code/src_concurrent_qtconcurrentfilter.cpp
@@ -169,5 +169,17 @@ struct StartsWith
};
QList<QString> strings = ...;
-QFuture<QString> fooString = QtConcurrent::filtered(images, StartsWith(QLatin1String("Foo")));
+QFuture<QString> fooString = QtConcurrent::filtered(strings, StartsWith(QLatin1String("Foo")));
//! [13]
+
+//! [14]
+struct StringTransform
+{
+ void operator()(QString &result, const QString &value);
+};
+
+QFuture<QString> fooString =
+ QtConcurrent::filteredReduced<QString>(strings,
+ StartsWith(QLatin1String("Foo")),
+ StringTransform());
+//! [14]
diff --git a/src/concurrent/doc/snippets/code/src_concurrent_qtconcurrentmap.cpp b/src/concurrent/doc/snippets/code/src_concurrent_qtconcurrentmap.cpp
index 183b82bb9a..9cf82c786a 100644
--- a/src/concurrent/doc/snippets/code/src_concurrent_qtconcurrentmap.cpp
+++ b/src/concurrent/doc/snippets/code/src_concurrent_qtconcurrentmap.cpp
@@ -157,6 +157,18 @@ QFuture<QSet<int> > totalColorDistribution = QtConcurrent::mappedReduced(images,
QImage QImage::scaledToWidth(int width, Qt::TransformationMode) const;
//! [10]
+//! [11]
+struct ImageTransform
+{
+ void operator()(QImage &result, const QImage &value);
+};
+
+QFuture<QImage> thumbNails =
+ QtConcurrent::mappedReduced<QImage>(images,
+ Scaled(100),
+ ImageTransform(),
+ QtConcurrent::SequentialReduce);
+//! [11]
//! [13]
QList<QImage> images = ...;
diff --git a/src/concurrent/qtconcurrentexception.h b/src/concurrent/qtconcurrentexception.h
index 03dd7ec498..9da53fd9e2 100644
--- a/src/concurrent/qtconcurrentexception.h
+++ b/src/concurrent/qtconcurrentexception.h
@@ -41,18 +41,17 @@
#define QTCONCURRENT_EXCEPTION_H
#include <QtConcurrent/qtconcurrent_global.h>
-
-#ifndef QT_NO_QFUTURE
-
#include <QtCore/qexception.h>
+QT_REQUIRE_CONFIG(concurrent);
+
QT_BEGIN_NAMESPACE
namespace QtConcurrent
{
-#ifndef QT_NO_EXCEPTIONS
+#if !defined(QT_NO_EXCEPTIONS) || defined(Q_CLANG_QDOC)
typedef Q_DECL_DEPRECATED QException Exception;
typedef Q_DECL_DEPRECATED QUnhandledException UnhandledException;
@@ -63,6 +62,4 @@ typedef Q_DECL_DEPRECATED QUnhandledException UnhandledException;
QT_END_NAMESPACE
-#endif // QT_NO_QFUTURE
-
#endif
diff --git a/src/concurrent/qtconcurrentfilter.cpp b/src/concurrent/qtconcurrentfilter.cpp
index 3e3ed7cf68..c0cbbd3f3d 100644
--- a/src/concurrent/qtconcurrentfilter.cpp
+++ b/src/concurrent/qtconcurrentfilter.cpp
@@ -142,12 +142,19 @@
\section2 Using Function Objects
QtConcurrent::filter(), QtConcurrent::filtered(), and
- QtConcurrent::filteredReduced() accept function objects, which can be used to
+ QtConcurrent::filteredReduced() accept function objects
+ for the filter function. These function objects can be used to
add state to a function call. The result_type typedef must define the
result type of the function call operator:
\snippet code/src_concurrent_qtconcurrentfilter.cpp 13
+ For the reduce function, function objects are not directly
+ supported. Function objects can, however, be used
+ when the type of the reduction result is explicitly specified:
+
+ \snippet code/src_concurrent_qtconcurrentfilter.cpp 14
+
\section2 Wrapping Functions that Take Multiple Arguments
If you want to use a filter function takes more than one argument, you can
@@ -168,7 +175,49 @@
*/
/*!
- \fn QFuture<void> QtConcurrent::filter(Sequence &sequence, FilterFunction filterFunction)
+ \class QtConcurrent::qValueType
+ \inmodule QtConcurrent
+ \internal
+*/
+
+/*!
+ \class QtConcurrent::qValueType<const T*>
+ \inmodule QtConcurrent
+ \internal
+*/
+
+
+/*!
+ \class QtConcurrent::qValueType<T*>
+ \inmodule QtConcurrent
+ \internal
+*/
+
+/*!
+ \class QtConcurrent::FilterKernel
+ \inmodule QtConcurrent
+ \internal
+*/
+
+/*!
+ \class QtConcurrent::FilteredReducedKernel
+ \inmodule QtConcurrent
+ \internal
+*/
+
+/*!
+ \class QtConcurrent::FilteredEachKernel
+ \inmodule QtConcurrent
+ \internal
+*/
+
+/*!
+ \fn [QtConcurrent-1] template <typename Sequence, typename KeepFunctor, typename ReduceFunctor> ThreadEngineStarter<void> QtConcurrent::filterInternal(Sequence &sequence, KeepFunctor keep, ReduceFunctor reduce)
+ \internal
+*/
+
+/*!
+ \fn template <typename Sequence, typename KeepFunctor> QFuture<void> QtConcurrent::filter(Sequence &sequence, KeepFunctor filterFunction)
Calls \a filterFunction once for each item in \a sequence. If
\a filterFunction returns \c true, the item is kept in \a sequence;
@@ -178,7 +227,7 @@
*/
/*!
- \fn QFuture<T> QtConcurrent::filtered(const Sequence &sequence, FilterFunction filterFunction)
+ \fn template <typename Sequence, typename KeepFunctor> QFuture<Sequence::value_type> QtConcurrent::filtered(const Sequence &sequence, KeepFunctor filterFunction)
Calls \a filterFunction once for each item in \a sequence and returns a
new Sequence of kept items. If \a filterFunction returns \c true, a copy of
@@ -189,7 +238,7 @@
*/
/*!
- \fn QFuture<T> QtConcurrent::filtered(ConstIterator begin, ConstIterator end, FilterFunction filterFunction)
+ \fn template <typename Iterator, typename KeepFunctor> QFuture<typename QtConcurrent::qValueType<Iterator>::value_type> QtConcurrent::filtered(Iterator begin, Iterator end, KeepFunctor filterFunction)
Calls \a filterFunction once for each item from \a begin to \a end and
returns a new Sequence of kept items. If \a filterFunction returns \c true, a
@@ -200,7 +249,7 @@
*/
/*!
- \fn QFuture<T> QtConcurrent::filteredReduced(const Sequence &sequence, FilterFunction filterFunction, ReduceFunction reduceFunction, QtConcurrent::ReduceOptions reduceOptions)
+ \fn template <typename ResultType, typename Sequence, typename KeepFunctor, typename ReduceFunctor> QFuture<ResultType> QtConcurrent::filteredReduced(const Sequence &sequence, KeepFunctor filterFunction, ReduceFunctor reduceFunction, QtConcurrent::ReduceOptions reduceOptions)
Calls \a filterFunction once for each item in \a sequence. If
\a filterFunction returns \c true for an item, that item is then passed to
@@ -218,7 +267,7 @@
*/
/*!
- \fn QFuture<T> QtConcurrent::filteredReduced(ConstIterator begin, ConstIterator end, FilterFunction filterFunction, ReduceFunction reduceFunction, QtConcurrent::ReduceOptions reduceOptions)
+ \fn template <typename ResultType, typename Iterator, typename KeepFunctor, typename ReduceFunctor> QFuture<ResultType> QtConcurrent::filteredReduced(Iterator begin, Iterator end, KeepFunctor filterFunction, ReduceFunctor reduceFunction, QtConcurrent::ReduceOptions reduceOptions)
Calls \a filterFunction once for each item from \a begin to \a end. If
\a filterFunction returns \c true for an item, that item is then passed to
@@ -236,7 +285,7 @@
*/
/*!
- \fn void QtConcurrent::blockingFilter(Sequence &sequence, FilterFunction filterFunction)
+ \fn template <typename Sequence, typename KeepFunctor> void QtConcurrent::blockingFilter(Sequence &sequence, KeepFunctor filterFunction)
Calls \a filterFunction once for each item in \a sequence. If
\a filterFunction returns \c true, the item is kept in \a sequence;
@@ -248,7 +297,7 @@
*/
/*!
- \fn Sequence QtConcurrent::blockingFiltered(const Sequence &sequence, FilterFunction filterFunction)
+ \fn template <typename Sequence, typename KeepFunctor> Sequence QtConcurrent::blockingFiltered(const Sequence &sequence, KeepFunctor filterFunction)
Calls \a filterFunction once for each item in \a sequence and returns a
new Sequence of kept items. If \a filterFunction returns \c true, a copy of
@@ -261,7 +310,7 @@
*/
/*!
- \fn Sequence QtConcurrent::blockingFiltered(ConstIterator begin, ConstIterator end, FilterFunction filterFunction)
+ \fn template <typename OutputSequence, typename Iterator, typename KeepFunctor> OutputSequence QtConcurrent::blockingFiltered(Iterator begin, Iterator end, KeepFunctor filterFunction)
Calls \a filterFunction once for each item from \a begin to \a end and
returns a new Sequence of kept items. If \a filterFunction returns \c true, a
@@ -275,7 +324,7 @@
*/
/*!
- \fn T QtConcurrent::blockingFilteredReduced(const Sequence &sequence, FilterFunction filterFunction, ReduceFunction reduceFunction, QtConcurrent::ReduceOptions reduceOptions)
+ \fn template <typename ResultType, typename Sequence, typename KeepFunctor, typename ReduceFunctor> ResultType QtConcurrent::blockingFilteredReduced(const Sequence &sequence, KeepFunctor filterFunction, ReduceFunctor reduceFunction, QtConcurrent::ReduceOptions reduceOptions)
Calls \a filterFunction once for each item in \a sequence. If
\a filterFunction returns \c true for an item, that item is then passed to
@@ -295,7 +344,7 @@
*/
/*!
- \fn T QtConcurrent::blockingFilteredReduced(ConstIterator begin, ConstIterator end, FilterFunction filterFunction, ReduceFunction reduceFunction, QtConcurrent::ReduceOptions reduceOptions)
+ \fn template <typename ResultType, typename Iterator, typename KeepFunctor, typename ReduceFunctor> ResultType QtConcurrent::blockingFilteredReduced(Iterator begin, Iterator end, KeepFunctor filterFunction, ReduceFunctor reduceFunction, QtConcurrent::ReduceOptions reduceOptions)
Calls \a filterFunction once for each item from \a begin to \a end. If
\a filterFunction returns \c true for an item, that item is then passed to
@@ -314,3 +363,24 @@
\sa filteredReduced(), {Concurrent Filter and Filter-Reduce}
*/
+
+/*!
+ \fn [QtConcurrent-2] ThreadEngineStarter<typename qValueType<Iterator>::value_type> QtConcurrent::startFiltered(Iterator begin, Iterator end, KeepFunctor functor)
+ \internal
+*/
+
+/*!
+ \fn [QtConcurrent-3] ThreadEngineStarter<typename Sequence::value_type> QtConcurrent::startFiltered(const Sequence &sequence, KeepFunctor functor)
+ \internal
+*/
+
+/*!
+ \fn [QtConcurrent-4] ThreadEngineStarter<ResultType> QtConcurrent::startFilteredReduced(const Sequence & sequence, MapFunctor mapFunctor, ReduceFunctor reduceFunctor, ReduceOptions options)
+ \internal
+*/
+
+/*!
+ \fn [QtConcurrent-5] ThreadEngineStarter<ResultType> QtConcurrent::startFilteredReduced(Iterator begin, Iterator end, MapFunctor mapFunctor, ReduceFunctor reduceFunctor, ReduceOptions options)
+ \internal
+*/
+
diff --git a/src/concurrent/qtconcurrentfilter.h b/src/concurrent/qtconcurrentfilter.h
index e09f3b4abc..acc794fad8 100644
--- a/src/concurrent/qtconcurrentfilter.h
+++ b/src/concurrent/qtconcurrentfilter.h
@@ -42,62 +42,16 @@
#include <QtConcurrent/qtconcurrent_global.h>
-#ifndef QT_NO_CONCURRENT
+#if !defined(QT_NO_CONCURRENT) || defined(Q_CLANG_QDOC)
#include <QtConcurrent/qtconcurrentfilterkernel.h>
#include <QtConcurrent/qtconcurrentfunctionwrappers.h>
QT_BEGIN_NAMESPACE
-
-#ifdef Q_QDOC
-
-namespace QtConcurrent {
-
- QFuture<void> filter(Sequence &sequence, FilterFunction filterFunction);
-
- template <typename T>
- QFuture<T> filtered(const Sequence &sequence, FilterFunction filterFunction);
- template <typename T>
- QFuture<T> filtered(ConstIterator begin, ConstIterator end, FilterFunction filterFunction);
-
- template <typename T>
- QFuture<T> filteredReduced(const Sequence &sequence,
- FilterFunction filterFunction,
- ReduceFunction reduceFunction,
- QtConcurrent::ReduceOptions reduceOptions = UnorderedReduce | SequentialReduce);
- template <typename T>
- QFuture<T> filteredReduced(ConstIterator begin,
- ConstIterator end,
- FilterFunction filterFunction,
- ReduceFunction reduceFunction,
- QtConcurrent::ReduceOptions reduceOptions = UnorderedReduce | SequentialReduce);
-
- void blockingFilter(Sequence &sequence, FilterFunction filterFunction);
-
- template <typename Sequence>
- Sequence blockingFiltered(const Sequence &sequence, FilterFunction filterFunction);
- template <typename Sequence>
- Sequence blockingFiltered(ConstIterator begin, ConstIterator end, FilterFunction filterFunction);
-
- template <typename T>
- T blockingFilteredReduced(const Sequence &sequence,
- FilterFunction filterFunction,
- ReduceFunction reduceFunction,
- QtConcurrent::ReduceOptions reduceOptions = UnorderedReduce | SequentialReduce);
- template <typename T>
- T blockingFilteredReduced(ConstIterator begin,
- ConstIterator end,
- FilterFunction filterFunction,
- ReduceFunction reduceFunction,
- QtConcurrent::ReduceOptions reduceOptions = UnorderedReduce | SequentialReduce);
-
-} // namespace QtConcurrent
-
-#else
-
namespace QtConcurrent {
+//! [QtConcurrent-1]
template <typename Sequence, typename KeepFunctor, typename ReduceFunctor>
ThreadEngineStarter<void> filterInternal(Sequence &sequence, KeepFunctor keep, ReduceFunctor reduce)
{
@@ -122,6 +76,7 @@ QFuture<ResultType> filteredReduced(const Sequence &sequence,
return startFilteredReduced<ResultType>(sequence, QtPrivate::createFunctionWrapper(keep), QtPrivate::createFunctionWrapper(reduce), options);
}
+#ifndef Q_CLANG_QDOC
template <typename Sequence, typename KeepFunctor, typename ReduceFunctor>
QFuture<typename QtPrivate::ReduceResultType<ReduceFunctor>::ResultType> filteredReduced(const Sequence &sequence,
KeepFunctor keep,
@@ -134,6 +89,7 @@ QFuture<typename QtPrivate::ReduceResultType<ReduceFunctor>::ResultType> filtere
QtPrivate::createFunctionWrapper(reduce),
options);
}
+#endif
// filteredReduced() on iterators
template <typename ResultType, typename Iterator, typename KeepFunctor, typename ReduceFunctor>
@@ -146,6 +102,7 @@ QFuture<ResultType> filteredReduced(Iterator begin,
return startFilteredReduced<ResultType>(begin, end, QtPrivate::createFunctionWrapper(keep), QtPrivate::createFunctionWrapper(reduce), options);
}
+#ifndef Q_CLANG_QDOC
template <typename Iterator, typename KeepFunctor, typename ReduceFunctor>
QFuture<typename QtPrivate::ReduceResultType<ReduceFunctor>::ResultType> filteredReduced(Iterator begin,
Iterator end,
@@ -159,6 +116,7 @@ QFuture<typename QtPrivate::ReduceResultType<ReduceFunctor>::ResultType> filtere
QtPrivate::createFunctionWrapper(reduce),
options);
}
+#endif
// filtered() on sequences
template <typename Sequence, typename KeepFunctor>
@@ -192,6 +150,7 @@ ResultType blockingFilteredReduced(const Sequence &sequence,
.startBlocking();
}
+#ifndef Q_CLANG_QDOC
template <typename Sequence, typename KeepFunctor, typename ReduceFunctor>
typename QtPrivate::ReduceResultType<ReduceFunctor>::ResultType blockingFilteredReduced(const Sequence &sequence,
KeepFunctor keep,
@@ -204,6 +163,7 @@ typename QtPrivate::ReduceResultType<ReduceFunctor>::ResultType blockingFiltered
QtPrivate::createFunctionWrapper(reduce),
options);
}
+#endif
// blocking filteredReduced() on iterators
template <typename ResultType, typename Iterator, typename KeepFunctor, typename ReduceFunctor>
@@ -221,6 +181,7 @@ ResultType blockingFilteredReduced(Iterator begin,
.startBlocking();
}
+#ifndef Q_CLANG_QDOC
template <typename Iterator, typename KeepFunctor, typename ReduceFunctor>
typename QtPrivate::ReduceResultType<ReduceFunctor>::ResultType blockingFilteredReduced(Iterator begin,
Iterator end,
@@ -235,6 +196,7 @@ typename QtPrivate::ReduceResultType<ReduceFunctor>::ResultType blockingFiltered
options)
.startBlocking();
}
+#endif
// blocking filtered() on sequences
template <typename Sequence, typename KeepFunctor>
@@ -255,8 +217,6 @@ OutputSequence blockingFiltered(Iterator begin, Iterator end, KeepFunctor keep)
} // namespace QtConcurrent
-#endif // Q_QDOC
-
QT_END_NAMESPACE
#endif // QT_NO_CONCURRENT
diff --git a/src/concurrent/qtconcurrentfilterkernel.h b/src/concurrent/qtconcurrentfilterkernel.h
index bd474fc0c9..4ef5ac0cee 100644
--- a/src/concurrent/qtconcurrentfilterkernel.h
+++ b/src/concurrent/qtconcurrentfilterkernel.h
@@ -42,7 +42,7 @@
#include <QtConcurrent/qtconcurrent_global.h>
-#ifndef QT_NO_CONCURRENT
+#if !defined(QT_NO_CONCURRENT) || defined (Q_CLANG_QDOC)
#include <QtConcurrent/qtconcurrentiteratekernel.h>
#include <QtConcurrent/qtconcurrentmapkernel.h>
@@ -51,7 +51,6 @@
QT_BEGIN_NAMESPACE
-#ifndef Q_QDOC
namespace QtConcurrent {
@@ -292,6 +291,7 @@ public:
}
};
+//! [QtConcurrent-2]
template <typename Iterator, typename KeepFunctor>
inline
ThreadEngineStarter<typename qValueType<Iterator>::value_type>
@@ -300,6 +300,7 @@ startFiltered(Iterator begin, Iterator end, KeepFunctor functor)
return startThreadEngine(new FilteredEachKernel<Iterator, KeepFunctor>(begin, end, functor));
}
+//! [QtConcurrent-3]
template <typename Sequence, typename KeepFunctor>
inline ThreadEngineStarter<typename Sequence::value_type>
startFiltered(const Sequence &sequence, KeepFunctor functor)
@@ -311,6 +312,7 @@ startFiltered(const Sequence &sequence, KeepFunctor functor)
return startThreadEngine(new SequenceHolderType(sequence, functor));
}
+//! [QtConcurrent-4]
template <typename ResultType, typename Sequence, typename MapFunctor, typename ReduceFunctor>
inline ThreadEngineStarter<ResultType> startFilteredReduced(const Sequence & sequence,
MapFunctor mapFunctor, ReduceFunctor reduceFunctor,
@@ -324,6 +326,7 @@ inline ThreadEngineStarter<ResultType> startFilteredReduced(const Sequence & seq
}
+//! [QtConcurrent-5]
template <typename ResultType, typename Iterator, typename MapFunctor, typename ReduceFunctor>
inline ThreadEngineStarter<ResultType> startFilteredReduced(Iterator begin, Iterator end,
MapFunctor mapFunctor, ReduceFunctor reduceFunctor,
@@ -337,7 +340,6 @@ inline ThreadEngineStarter<ResultType> startFilteredReduced(Iterator begin, Iter
} // namespace QtConcurrent
-#endif // Q_QDOC
QT_END_NAMESPACE
diff --git a/src/concurrent/qtconcurrentfunctionwrappers.h b/src/concurrent/qtconcurrentfunctionwrappers.h
index 111933410b..0f9eb46999 100644
--- a/src/concurrent/qtconcurrentfunctionwrappers.h
+++ b/src/concurrent/qtconcurrentfunctionwrappers.h
@@ -43,13 +43,10 @@
#include <QtConcurrent/qtconcurrentcompilertest.h>
#include <QtCore/QStringList>
-#ifndef QT_NO_CONCURRENT
+#if !defined(QT_NO_CONCURRENT) || defined(Q_CLANG_QDOC)
QT_BEGIN_NAMESPACE
-
-#ifndef Q_QDOC
-
namespace QtConcurrent {
template <typename T>
@@ -375,7 +372,6 @@ struct MapResultType<QStringList, U(C::*)() const noexcept>
} // namespace QtPrivate.
-#endif //Q_QDOC
QT_END_NAMESPACE
diff --git a/src/concurrent/qtconcurrentiteratekernel.cpp b/src/concurrent/qtconcurrentiteratekernel.cpp
index 52218f794b..11bdb7e8cd 100644
--- a/src/concurrent/qtconcurrentiteratekernel.cpp
+++ b/src/concurrent/qtconcurrentiteratekernel.cpp
@@ -43,7 +43,7 @@
#include "private/qfunctions_p.h"
-#ifndef QT_NO_CONCURRENT
+#if !defined(QT_NO_CONCURRENT) || defined(Q_CLANG_QDOC)
QT_BEGIN_NAMESPACE
@@ -64,6 +64,54 @@ static double elapsed(qint64 after, qint64 before)
namespace QtConcurrent {
+/*!
+ \class QtConcurrent::Median
+ \inmodule QtConcurrent
+ \internal
+ */
+
+/*!
+ \class QtConcurrent::MedianDouble
+ \inmodule QtConcurrent
+ \internal
+ */
+
+/*!
+ \class QtConcurrent::BlockSizeManager
+ \inmodule QtConcurrent
+ \internal
+ */
+
+/*!
+ \class QtConcurrent::BlockSizeManagerV2
+ \inmodule QtConcurrent
+ \internal
+ */
+
+/*!
+ \class QtConcurrent::ResultReporter
+ \inmodule QtConcurrent
+ \internal
+ */
+
+/*! \fn bool QtConcurrent::selectIteration(std::bidirectional_iterator_tag)
+ \internal
+ */
+
+/*! \fn bool QtConcurrent::selectIteration(std::forward_iterator_tag)
+ \internal
+ */
+
+/*! \fn bool QtConcurrent::selectIteration(std::random_access_iterator_tag)
+ \internal
+ */
+
+/*!
+ \class QtConcurrent::IterateKernel
+ \inmodule QtConcurrent
+ \internal
+ */
+
/*! \internal
*/
diff --git a/src/concurrent/qtconcurrentiteratekernel.h b/src/concurrent/qtconcurrentiteratekernel.h
index dbd000e8ba..b543833776 100644
--- a/src/concurrent/qtconcurrentiteratekernel.h
+++ b/src/concurrent/qtconcurrentiteratekernel.h
@@ -42,7 +42,7 @@
#include <QtConcurrent/qtconcurrent_global.h>
-#ifndef QT_NO_CONCURRENT
+#if !defined(QT_NO_CONCURRENT) || defined(Q_CLANG_QDOC)
#include <QtCore/qatomic.h>
#include <QtConcurrent/qtconcurrentmedian.h>
@@ -53,7 +53,6 @@
QT_BEGIN_NAMESPACE
-#ifndef Q_QDOC
namespace QtConcurrent {
@@ -159,7 +158,7 @@ public:
inline ResultReporter(ThreadEngine<void> *) { }
inline void reserveSpace(int) { }
inline void reportResults(int) { }
- inline void * getPointer() { return Q_NULLPTR; }
+ inline void * getPointer() { return nullptr; }
};
inline bool selectIteration(std::bidirectional_iterator_tag)
@@ -323,7 +322,6 @@ public:
} // namespace QtConcurrent
-#endif //Q_QDOC
QT_END_NAMESPACE
diff --git a/src/concurrent/qtconcurrentmap.cpp b/src/concurrent/qtconcurrentmap.cpp
index 884bf4b4f9..a8f1d6496e 100644
--- a/src/concurrent/qtconcurrentmap.cpp
+++ b/src/concurrent/qtconcurrentmap.cpp
@@ -53,6 +53,72 @@
*/
/*!
+ \enum QtConcurrent::ReduceQueueLimits
+ \internal
+ */
+
+/*!
+ \class QtConcurrent::ReduceKernel
+ \inmodule QtConcurrent
+ \internal
+*/
+
+/*!
+ \class QtConcurrent::SequenceHolder2
+ \inmodule QtConcurrent
+ \internal
+*/
+
+/*!
+ \class QtConcurrent::MapKernel
+ \inmodule QtConcurrent
+ \internal
+*/
+
+/*!
+ \class QtConcurrent::MappedReducedKernel
+ \inmodule QtConcurrent
+ \internal
+*/
+
+/*!
+ \class QtConcurrent::MappedEachKernel
+ \inmodule QtConcurrent
+ \internal
+*/
+
+/*!
+ \class QtConcurrent::SequenceHolder1
+ \inmodule QtConcurrent
+ \internal
+*/
+
+/*!
+ \fn [qtconcurrentmapkernel-1] ThreadEngineStarter<void> QtConcurrent::startMap(Iterator begin, Iterator end, Functor functor)
+ \internal
+*/
+
+/*!
+ \fn [qtconcurrentmapkernel-2] ThreadEngineStarter<T> QtConcurrent::startMapped(Iterator begin, Iterator end, Functor functor)
+ \internal
+*/
+
+/*!
+ \fn [qtconcurrentmapkernel-3] ThreadEngineStarter<T> QtConcurrent::startMapped(const Sequence &sequence, Functor functor)
+ \internal
+*/
+
+/*!
+ \fn [qtconcurrentmapkernel-4] ThreadEngineStarter<ResultType> QtConcurrent::startMappedReduced(const Sequence & sequence, MapFunctor mapFunctor, ReduceFunctor reduceFunctor, ReduceOptions options)
+ \internal
+*/
+
+/*!
+ \fn [qtconcurrentmapkernel-5] ThreadEngineStarter<ResultType> QtConcurrent::startMappedReduced(Iterator begin, Iterator end, MapFunctor mapFunctor, ReduceFunctor reduceFunctor, ReduceOptions options)
+ \internal
+*/
+
+/*!
\enum QtConcurrent::ReduceOption
This enum specifies the order of which results from the map or filter
function are passed to the reduce function.
@@ -192,12 +258,19 @@
\section2 Using Function Objects
QtConcurrent::map(), QtConcurrent::mapped(), and
- QtConcurrent::mappedReduced() accept function objects, which can be used to
+ QtConcurrent::mappedReduced() accept function objects
+ for the map function. These function objects can be used to
add state to a function call. The result_type typedef must define the
result type of the function call operator:
\snippet code/src_concurrent_qtconcurrentmap.cpp 14
+ For the reduce function, function objects are not directly
+ supported. Function objects can, however, be used
+ when the type of the reduction result is explicitly specified:
+
+ \snippet code/src_concurrent_qtconcurrentmap.cpp 11
+
\section2 Wrapping Functions that Take Multiple Arguments
If you want to use a map function that takes more than one argument you can
@@ -218,7 +291,7 @@
*/
/*!
- \fn QFuture<void> QtConcurrent::map(Sequence &sequence, MapFunction function)
+ \fn template <typename Sequence, typename MapFunctor> QFuture<void> QtConcurrent::map(Sequence &sequence, MapFunctor function)
Calls \a function once for each item in \a sequence. The \a function is
passed a reference to the item, so that any modifications done to the item
@@ -228,7 +301,7 @@
*/
/*!
- \fn QFuture<void> QtConcurrent::map(Iterator begin, Iterator end, MapFunction function)
+ \fn template <typename Iterator, typename MapFunctor> QFuture<void> QtConcurrent::map(Iterator begin, Iterator end, MapFunctor function)
Calls \a function once for each item from \a begin to \a end. The
\a function is passed a reference to the item, so that any modifications
@@ -238,7 +311,7 @@
*/
/*!
- \fn QFuture<T> QtConcurrent::mapped(const Sequence &sequence, MapFunction function)
+ \fn template <typename Sequence, typename MapFunctor> QFuture<typename QtPrivate::MapResultType<void, MapFunctor>::ResultType> QtConcurrent::mapped(const Sequence &sequence, MapFunctor function)
Calls \a function once for each item in \a sequence and returns a future
with each mapped item as a result. You can use QFuture::const_iterator or
@@ -248,7 +321,7 @@
*/
/*!
- \fn QFuture<T> QtConcurrent::mapped(ConstIterator begin, ConstIterator end, MapFunction function)
+ \fn template <typename Iterator, typename MapFunctor> QFuture<typename QtPrivate::MapResultType<void, MapFunctor>::ResultType> QtConcurrent::mapped(Iterator begin, Iterator end, MapFunctor function)
Calls \a function once for each item from \a begin to \a end and returns a
future with each mapped item as a result. You can use
@@ -258,9 +331,7 @@
*/
/*!
- \fn QFuture<T> QtConcurrent::mappedReduced(const Sequence &sequence,
- MapFunction mapFunction, ReduceFunction reduceFunction,
- QtConcurrent::ReduceOptions reduceOptions)
+ \fn template <typename ResultType, typename Sequence, typename MapFunctor, typename ReduceFunctor> QFuture<ResultType> QtConcurrent::mappedReduced(const Sequence &sequence, MapFunctor mapFunction, ReduceFunctor reduceFunction, QtConcurrent::ReduceOptions reduceOptions)
Calls \a mapFunction once for each item in \a sequence. The return value of
each \a mapFunction is passed to \a reduceFunction.
@@ -273,9 +344,7 @@
*/
/*!
- \fn QFuture<T> QtConcurrent::mappedReduced(ConstIterator begin,
- ConstIterator end, MapFunction mapFunction, ReduceFunction reduceFunction,
- QtConcurrent::ReduceOptions reduceOptions)
+ \fn template <typename ResultType, typename Iterator, typename MapFunctor, typename ReduceFunctor> QFuture<ResultType> QtConcurrent::mappedReduced(Iterator begin, Iterator end, MapFunctor mapFunction, ReduceFunctor reduceFunction, QtConcurrent::ReduceOptions reduceOptions)
Calls \a mapFunction once for each item from \a begin to \a end. The return
value of each \a mapFunction is passed to \a reduceFunction.
@@ -290,7 +359,7 @@
*/
/*!
- \fn void QtConcurrent::blockingMap(Sequence &sequence, MapFunction function)
+ \fn template <typename Sequence, typename MapFunctor> void QtConcurrent::blockingMap(Sequence &sequence, MapFunctor function)
Calls \a function once for each item in \a sequence. The \a function is
passed a reference to the item, so that any modifications done to the item
@@ -302,7 +371,7 @@
*/
/*!
- \fn void QtConcurrent::blockingMap(Iterator begin, Iterator end, MapFunction function)
+ \fn template <typename Iterator, typename MapFunctor> void QtConcurrent::blockingMap(Iterator begin, Iterator end, MapFunctor function)
Calls \a function once for each item from \a begin to \a end. The
\a function is passed a reference to the item, so that any modifications
@@ -315,10 +384,10 @@
*/
/*!
- \fn T QtConcurrent::blockingMapped(const Sequence &sequence, MapFunction function)
+ \fn template <typename OutputSequence, typename InputSequence, typename MapFunctor> OutputSequence QtConcurrent::blockingMapped(const InputSequence &sequence, MapFunctor function)
- Calls \a function once for each item in \a sequence and returns a Sequence containing
- the results. The type of the results will match the type returned my the MapFunction.
+ Calls \a function once for each item in \a sequence and returns an OutputSequence containing
+ the results. The type of the results will match the type returned my the MapFunctor.
\note This function will block until all items in the sequence have been processed.
@@ -326,7 +395,7 @@
*/
/*!
- \fn T QtConcurrent::blockingMapped(ConstIterator begin, ConstIterator end, MapFunction function)
+ \fn template <typename Sequence, typename Iterator, typename MapFunctor> Sequence QtConcurrent::blockingMapped(Iterator begin, Iterator end, MapFunctor function)
Calls \a function once for each item from \a begin to \a end and returns a
container with the results. Specify the type of container as the a template
@@ -343,7 +412,7 @@
*/
/*!
- \fn T QtConcurrent::blockingMappedReduced(const Sequence &sequence, MapFunction mapFunction, ReduceFunction reduceFunction, QtConcurrent::ReduceOptions reduceOptions)
+ \fn template <typename ResultType, typename Sequence, typename MapFunctor, typename ReduceFunctor> ResultType QtConcurrent::blockingMappedReduced(const Sequence &sequence, MapFunctor mapFunction, ReduceFunctor reduceFunction, QtConcurrent::ReduceOptions reduceOptions)
Calls \a mapFunction once for each item in \a sequence. The return value of
each \a mapFunction is passed to \a reduceFunction.
@@ -358,7 +427,7 @@
*/
/*!
- \fn T QtConcurrent::blockingMappedReduced(ConstIterator begin, ConstIterator end, MapFunction mapFunction, ReduceFunction reduceFunction, QtConcurrent::ReduceOptions reduceOptions)
+ \fn template <typename ResultType, typename Iterator, typename MapFunctor, typename ReduceFunctor> ResultType QtConcurrent::blockingMappedReduced(Iterator begin, Iterator end, MapFunctor mapFunction, ReduceFunctor reduceFunction, QtConcurrent::ReduceOptions reduceOptions)
Calls \a mapFunction once for each item from \a begin to \a end. The return
value of each \a mapFunction is passed to \a reduceFunction.
@@ -372,3 +441,39 @@
\sa blockingMappedReduced(), {Concurrent Map and Map-Reduce}
*/
+
+/*!
+ \class QtConcurrent::FunctionWrapper0
+ \inmodule QtConcurrent
+ \internal
+*/
+
+/*!
+ \class QtConcurrent::FunctionWrapper1
+ \inmodule QtConcurrent
+ \internal
+*/
+
+/*!
+ \class QtConcurrent::FunctionWrapper2
+ \inmodule QtConcurrent
+ \internal
+*/
+
+/*!
+ \class QtConcurrent::MemberFunctionWrapper
+ \inmodule QtConcurrent
+ \internal
+*/
+
+/*!
+ \class QtConcurrent::MemberFunctionWrapper1
+ \inmodule QtConcurrent
+ \internal
+*/
+
+/*!
+ \class QtConcurrent::ConstMemberFunctionWrapper
+ \inmodule QtConcurrent
+ \internal
+*/
diff --git a/src/concurrent/qtconcurrentmap.h b/src/concurrent/qtconcurrentmap.h
index f8acf31f1d..ed1f7cedd1 100644
--- a/src/concurrent/qtconcurrentmap.h
+++ b/src/concurrent/qtconcurrentmap.h
@@ -42,7 +42,7 @@
#include <QtConcurrent/qtconcurrent_global.h>
-#ifndef QT_NO_CONCURRENT
+#if !defined(QT_NO_CONCURRENT) || defined(Q_CLANG_QDOC)
#include <QtConcurrent/qtconcurrentmapkernel.h>
#include <QtConcurrent/qtconcurrentreducekernel.h>
@@ -52,53 +52,6 @@
QT_BEGIN_NAMESPACE
-#ifdef Q_QDOC
-
-namespace QtConcurrent {
-
- QFuture<void> map(Sequence &sequence, MapFunction function);
- QFuture<void> map(Iterator begin, Iterator end, MapFunction function);
-
- template <typename T>
- QFuture<T> mapped(const Sequence &sequence, MapFunction function);
- template <typename T>
- QFuture<T> mapped(ConstIterator begin, ConstIterator end, MapFunction function);
-
- template <typename T>
- QFuture<T> mappedReduced(const Sequence &sequence,
- MapFunction function,
- ReduceFunction function,
- QtConcurrent::ReduceOptions options = UnorderedReduce | SequentialReduce);
- template <typename T>
- QFuture<T> mappedReduced(ConstIterator begin,
- ConstIterator end,
- MapFunction function,
- ReduceFunction function,
- QtConcurrent::ReduceOptions options = UnorderedReduce | SequentialReduce);
-
- void blockingMap(Sequence &sequence, MapFunction function);
- void blockingMap(Iterator begin, Iterator end, MapFunction function);
-
- template <typename T>
- T blockingMapped(const Sequence &sequence, MapFunction function);
- template <typename T>
- T blockingMapped(ConstIterator begin, ConstIterator end, MapFunction function);
-
- template <typename T>
- T blockingMappedReduced(const Sequence &sequence,
- MapFunction function,
- ReduceFunction function,
- QtConcurrent::ReduceOptions options = UnorderedReduce | SequentialReduce);
- template <typename T>
- T blockingMappedReduced(ConstIterator begin,
- ConstIterator end,
- MapFunction function,
- ReduceFunction function,
- QtConcurrent::ReduceOptions options = UnorderedReduce | SequentialReduce);
-
-} // namespace QtConcurrent
-
-#else
namespace QtConcurrent {
@@ -306,7 +259,6 @@ typename QtPrivate::MapResultType<Iterator, MapFunctor>::ResultType blockingMapp
} // namespace QtConcurrent
-#endif // Q_QDOC
QT_END_NAMESPACE
diff --git a/src/concurrent/qtconcurrentmapkernel.h b/src/concurrent/qtconcurrentmapkernel.h
index fa162f7c34..e8df668791 100644
--- a/src/concurrent/qtconcurrentmapkernel.h
+++ b/src/concurrent/qtconcurrentmapkernel.h
@@ -42,7 +42,7 @@
#include <QtConcurrent/qtconcurrent_global.h>
-#ifndef QT_NO_CONCURRENT
+#if !defined(QT_NO_CONCURRENT) || defined (Q_CLANG_QDOC)
#include <QtConcurrent/qtconcurrentiteratekernel.h>
#include <QtConcurrent/qtconcurrentreducekernel.h>
@@ -50,7 +50,6 @@
QT_BEGIN_NAMESPACE
-#ifndef Q_QDOC
namespace QtConcurrent {
// map kernel, works with both parallel-for and parallel-while
@@ -191,12 +190,14 @@ public:
}
};
+//! [qtconcurrentmapkernel-1]
template <typename Iterator, typename Functor>
inline ThreadEngineStarter<void> startMap(Iterator begin, Iterator end, Functor functor)
{
return startThreadEngine(new MapKernel<Iterator, Functor>(begin, end, functor));
}
+//! [qtconcurrentmapkernel-2]
template <typename T, typename Iterator, typename Functor>
inline ThreadEngineStarter<T> startMapped(Iterator begin, Iterator end, Functor functor)
{
@@ -225,6 +226,7 @@ struct SequenceHolder1 : public Base
}
};
+//! [qtconcurrentmapkernel-3]
template <typename T, typename Sequence, typename Functor>
inline ThreadEngineStarter<T> startMapped(const Sequence &sequence, Functor functor)
{
@@ -235,6 +237,7 @@ inline ThreadEngineStarter<T> startMapped(const Sequence &sequence, Functor func
return startThreadEngine(new SequenceHolderType(sequence, functor));
}
+//! [qtconcurrentmapkernel-4]
template <typename IntermediateType, typename ResultType, typename Sequence, typename MapFunctor, typename ReduceFunctor>
inline ThreadEngineStarter<ResultType> startMappedReduced(const Sequence & sequence,
MapFunctor mapFunctor, ReduceFunctor reduceFunctor,
@@ -247,6 +250,7 @@ inline ThreadEngineStarter<ResultType> startMappedReduced(const Sequence & seque
return startThreadEngine(new SequenceHolderType(sequence, mapFunctor, reduceFunctor, options));
}
+//! [qtconcurrentmapkernel-5]
template <typename IntermediateType, typename ResultType, typename Iterator, typename MapFunctor, typename ReduceFunctor>
inline ThreadEngineStarter<ResultType> startMappedReduced(Iterator begin, Iterator end,
MapFunctor mapFunctor, ReduceFunctor reduceFunctor,
@@ -259,7 +263,6 @@ inline ThreadEngineStarter<ResultType> startMappedReduced(Iterator begin, Iterat
} // namespace QtConcurrent
-#endif //Q_QDOC
QT_END_NAMESPACE
diff --git a/src/concurrent/qtconcurrentmedian.h b/src/concurrent/qtconcurrentmedian.h
index d0f832812c..87e6b2935d 100644
--- a/src/concurrent/qtconcurrentmedian.h
+++ b/src/concurrent/qtconcurrentmedian.h
@@ -42,7 +42,7 @@
#include <QtConcurrent/qtconcurrent_global.h>
-#ifndef QT_NO_CONCURRENT
+#if !defined(QT_NO_CONCURRENT) ||defined(Q_CLANG_QDOC)
#include <QtCore/qvector.h>
@@ -51,7 +51,6 @@
QT_BEGIN_NAMESPACE
-#ifndef Q_QDOC
namespace QtConcurrent {
@@ -195,7 +194,6 @@ private:
} // namespace QtConcurrent
-#endif //Q_QDOC
QT_END_NAMESPACE
diff --git a/src/concurrent/qtconcurrentreducekernel.h b/src/concurrent/qtconcurrentreducekernel.h
index c5003a2a0e..d1a283eb53 100644
--- a/src/concurrent/qtconcurrentreducekernel.h
+++ b/src/concurrent/qtconcurrentreducekernel.h
@@ -42,7 +42,7 @@
#include <QtConcurrent/qtconcurrent_global.h>
-#ifndef QT_NO_CONCURRENT
+#if !defined(QT_NO_CONCURRENT) || defined(Q_CLANG_QDOC)
#include <QtCore/qatomic.h>
#include <QtCore/qlist.h>
@@ -57,8 +57,6 @@ QT_BEGIN_NAMESPACE
namespace QtConcurrent {
-#ifndef Q_QDOC
-
/*
The ReduceQueueStartLimit and ReduceQueueThrottleLimit constants
limit the reduce queue size for MapReduce. When the number of
@@ -66,10 +64,17 @@ namespace QtConcurrent {
MapReduce won't start any new threads, and when it exceeds
ReduceQueueThrottleLimit running threads will be stopped.
*/
+#ifdef Q_CLANG_QDOC
+enum ReduceQueueLimits {
+ ReduceQueueStartLimit = 20,
+ ReduceQueueThrottleLimit = 30
+};
+#else
enum {
ReduceQueueStartLimit = 20,
ReduceQueueThrottleLimit = 30
};
+#endif
// IntermediateResults holds a block of intermediate results from a
// map or filter functor. The begin/end offsets indicates the origin
@@ -82,8 +87,6 @@ public:
QVector<T> vector;
};
-#endif // Q_QDOC
-
enum ReduceOption {
UnorderedReduce = 0x1,
OrderedReduce = 0x2,
@@ -91,10 +94,9 @@ enum ReduceOption {
// ParallelReduce = 0x8
};
Q_DECLARE_FLAGS(ReduceOptions, ReduceOption)
+#ifndef Q_CLANG_QDOC
Q_DECLARE_OPERATORS_FOR_FLAGS(ReduceOptions)
-
-#ifndef Q_QDOC
-
+#endif
// supports both ordered and out-of-order reduction
template <typename ReduceFunctor, typename ReduceResultType, typename T>
class ReduceKernel
@@ -239,8 +241,6 @@ struct SequenceHolder2 : public Base
}
};
-#endif //Q_QDOC
-
} // namespace QtConcurrent
QT_END_NAMESPACE
diff --git a/src/concurrent/qtconcurrentrun.cpp b/src/concurrent/qtconcurrentrun.cpp
index 1d8f7afe85..e2e3b3f3af 100644
--- a/src/concurrent/qtconcurrentrun.cpp
+++ b/src/concurrent/qtconcurrentrun.cpp
@@ -115,6 +115,15 @@
*/
/*!
+ \typedef Function
+ \internal
+
+ This typedef is a dummy required to make the \c Function
+ type name known so that clang doesn't reject functions
+ that use it.
+*/
+
+/*!
\fn QFuture<T> QtConcurrent::run(Function function, ...);
Equivalent to
diff --git a/src/concurrent/qtconcurrentrun.h b/src/concurrent/qtconcurrentrun.h
index c0c0e66913..7963294ebf 100644
--- a/src/concurrent/qtconcurrentrun.h
+++ b/src/concurrent/qtconcurrentrun.h
@@ -43,15 +43,16 @@
#include <QtConcurrent/qtconcurrentcompilertest.h>
-#ifndef QT_NO_CONCURRENT
+#if !defined(QT_NO_CONCURRENT) || defined(Q_CLANG_QDOC)
#include <QtConcurrent/qtconcurrentrunbase.h>
#include <QtConcurrent/qtconcurrentstoredfunctioncall.h>
QT_BEGIN_NAMESPACE
+#ifdef Q_CLANG_QDOC
-#ifdef Q_QDOC
+typedef int Function;
namespace QtConcurrent {
@@ -919,7 +920,7 @@ QFuture<T> run(QThreadPool *pool, const Class *object, T (Class::*fn)(Param1, Pa
} //namespace QtConcurrent
-#endif // Q_QDOC
+#endif // Q_CLANG_QDOC
QT_END_NAMESPACE
diff --git a/src/concurrent/qtconcurrentthreadengine.cpp b/src/concurrent/qtconcurrentthreadengine.cpp
index c7791f8571..8d6bd0efb2 100644
--- a/src/concurrent/qtconcurrentthreadengine.cpp
+++ b/src/concurrent/qtconcurrentthreadengine.cpp
@@ -39,12 +39,52 @@
#include "qtconcurrentthreadengine.h"
-#ifndef QT_NO_CONCURRENT
+#if !defined(QT_NO_CONCURRENT) || defined(Q_CLANG_QDOC)
QT_BEGIN_NAMESPACE
namespace QtConcurrent {
+/*!
+ \class QtConcurrent::ThreadEngineBarrier
+ \inmodule QtConcurrent
+ \internal
+*/
+
+/*!
+ \enum QtConcurrent::ThreadFunctionResult
+ \internal
+*/
+
+/*!
+ \class QtConcurrent::ThreadEngineBase
+ \inmodule QtConcurrent
+ \internal
+*/
+
+/*!
+ \class QtConcurrent::ThreadEngine
+ \inmodule QtConcurrent
+ \internal
+*/
+
+/*!
+ \class QtConcurrent::ThreadEngineStarterBase
+ \inmodule QtConcurrent
+ \internal
+*/
+
+/*!
+ \class QtConcurrent::ThreadEngineStarter
+ \inmodule QtConcurrent
+ \internal
+*/
+
+/*!
+ \fn [qtconcurrentthreadengine-1] template <typename ThreadEngine> ThreadEngineStarter<typename ThreadEngine::ResultType> QtConcurrent::startThreadEngine(ThreadEngine *threadEngine)
+ \internal
+*/
+
ThreadEngineBarrier::ThreadEngineBarrier()
:count(0) { }
diff --git a/src/concurrent/qtconcurrentthreadengine.h b/src/concurrent/qtconcurrentthreadengine.h
index f915e9adfd..69e42018e6 100644
--- a/src/concurrent/qtconcurrentthreadengine.h
+++ b/src/concurrent/qtconcurrentthreadengine.h
@@ -42,7 +42,7 @@
#include <QtConcurrent/qtconcurrent_global.h>
-#ifndef QT_NO_CONCURRENT
+#if !defined(QT_NO_CONCURRENT) ||defined(Q_CLANG_QDOC)
#include <QtCore/qthreadpool.h>
#include <QtCore/qfuture.h>
@@ -55,8 +55,6 @@
QT_BEGIN_NAMESPACE
-#ifndef Q_QDOC
-
namespace QtConcurrent {
// The ThreadEngineBarrier counts worker threads, and allows one
@@ -113,7 +111,7 @@ private:
void startThreads();
void threadExit();
bool threadThrottleExit();
- void run() Q_DECL_OVERRIDE;
+ void run() override;
virtual void asynchronousFinish() = 0;
#ifndef QT_NO_EXCEPTIONS
void handleException(const QException &exception);
@@ -132,7 +130,7 @@ class ThreadEngine : public virtual ThreadEngineBase
public:
typedef T ResultType;
- virtual T *result() { return Q_NULLPTR; }
+ virtual T *result() { return nullptr; }
QFutureInterface<T> *futureInterfaceTyped()
{
@@ -173,7 +171,7 @@ public:
return future;
}
- void asynchronousFinish() Q_DECL_OVERRIDE
+ void asynchronousFinish() override
{
finish();
futureInterfaceTyped()->reportFinished(result());
@@ -259,6 +257,7 @@ public:
}
};
+//! [qtconcurrentthreadengine-1]
template <typename ThreadEngine>
inline ThreadEngineStarter<typename ThreadEngine::ResultType> startThreadEngine(ThreadEngine *threadEngine)
{
@@ -267,7 +266,6 @@ inline ThreadEngineStarter<typename ThreadEngine::ResultType> startThreadEngine(
} // namespace QtConcurrent
-#endif //Q_QDOC
QT_END_NAMESPACE
diff --git a/src/corelib/animation/qabstractanimation.h b/src/corelib/animation/qabstractanimation.h
index 727b4e7777..0ff6bc5176 100644
--- a/src/corelib/animation/qabstractanimation.h
+++ b/src/corelib/animation/qabstractanimation.h
@@ -82,7 +82,7 @@ public:
DeleteWhenStopped
};
- QAbstractAnimation(QObject *parent = Q_NULLPTR);
+ QAbstractAnimation(QObject *parent = nullptr);
virtual ~QAbstractAnimation();
State state() const;
@@ -117,8 +117,8 @@ public Q_SLOTS:
void setCurrentTime(int msecs);
protected:
- QAbstractAnimation(QAbstractAnimationPrivate &dd, QObject *parent = Q_NULLPTR);
- bool event(QEvent *event) Q_DECL_OVERRIDE;
+ QAbstractAnimation(QAbstractAnimationPrivate &dd, QObject *parent = nullptr);
+ bool event(QEvent *event) override;
virtual void updateCurrentTime(int currentTime) = 0;
virtual void updateState(QAbstractAnimation::State newState, QAbstractAnimation::State oldState);
@@ -136,7 +136,7 @@ class Q_CORE_EXPORT QAnimationDriver : public QObject
Q_DECLARE_PRIVATE(QAnimationDriver)
public:
- QAnimationDriver(QObject *parent = Q_NULLPTR);
+ QAnimationDriver(QObject *parent = nullptr);
~QAnimationDriver();
virtual void advance();
@@ -162,7 +162,7 @@ protected:
virtual void start();
virtual void stop();
- QAnimationDriver(QAnimationDriverPrivate &dd, QObject *parent = Q_NULLPTR);
+ QAnimationDriver(QAnimationDriverPrivate &dd, QObject *parent = nullptr);
private:
friend class QUnifiedTimer;
diff --git a/src/corelib/animation/qabstractanimation_p.h b/src/corelib/animation/qabstractanimation_p.h
index 3b901c4426..5593046e48 100644
--- a/src/corelib/animation/qabstractanimation_p.h
+++ b/src/corelib/animation/qabstractanimation_p.h
@@ -116,7 +116,7 @@ class QDefaultAnimationDriver : public QAnimationDriver
Q_OBJECT
public:
QDefaultAnimationDriver(QUnifiedTimer *timer);
- void timerEvent(QTimerEvent *e) Q_DECL_OVERRIDE;
+ void timerEvent(QTimerEvent *e) override;
private Q_SLOTS:
void startTimer();
@@ -196,7 +196,7 @@ public:
qint64 elapsed() const;
protected:
- void timerEvent(QTimerEvent *) Q_DECL_OVERRIDE;
+ void timerEvent(QTimerEvent *) override;
private Q_SLOTS:
void startTimers();
@@ -265,11 +265,11 @@ public:
*/
static void updateAnimationTimer();
- void restartAnimationTimer() Q_DECL_OVERRIDE;
- void updateAnimationsTime(qint64 delta) Q_DECL_OVERRIDE;
+ void restartAnimationTimer() override;
+ void updateAnimationsTime(qint64 delta) override;
//useful for profiling/debugging
- int runningAnimationCount() Q_DECL_OVERRIDE { return animations.count(); }
+ int runningAnimationCount() override { return animations.count(); }
private Q_SLOTS:
void startAnimations();
diff --git a/src/corelib/animation/qanimationgroup.h b/src/corelib/animation/qanimationgroup.h
index 20be0c0dd4..136ad3ca9f 100644
--- a/src/corelib/animation/qanimationgroup.h
+++ b/src/corelib/animation/qanimationgroup.h
@@ -53,7 +53,7 @@ class Q_CORE_EXPORT QAnimationGroup : public QAbstractAnimation
Q_OBJECT
public:
- QAnimationGroup(QObject *parent = Q_NULLPTR);
+ QAnimationGroup(QObject *parent = nullptr);
~QAnimationGroup();
QAbstractAnimation *animationAt(int index) const;
@@ -67,7 +67,7 @@ public:
protected:
QAnimationGroup(QAnimationGroupPrivate &dd, QObject *parent);
- bool event(QEvent *event) Q_DECL_OVERRIDE;
+ bool event(QEvent *event) override;
private:
Q_DISABLE_COPY(QAnimationGroup)
diff --git a/src/corelib/animation/qparallelanimationgroup.h b/src/corelib/animation/qparallelanimationgroup.h
index 3a00e9fd12..09a439ef24 100644
--- a/src/corelib/animation/qparallelanimationgroup.h
+++ b/src/corelib/animation/qparallelanimationgroup.h
@@ -53,18 +53,18 @@ class Q_CORE_EXPORT QParallelAnimationGroup : public QAnimationGroup
Q_OBJECT
public:
- QParallelAnimationGroup(QObject *parent = Q_NULLPTR);
+ QParallelAnimationGroup(QObject *parent = nullptr);
~QParallelAnimationGroup();
- int duration() const Q_DECL_OVERRIDE;
+ int duration() const override;
protected:
QParallelAnimationGroup(QParallelAnimationGroupPrivate &dd, QObject *parent);
- bool event(QEvent *event) Q_DECL_OVERRIDE;
+ bool event(QEvent *event) override;
- void updateCurrentTime(int currentTime) Q_DECL_OVERRIDE;
- void updateState(QAbstractAnimation::State newState, QAbstractAnimation::State oldState) Q_DECL_OVERRIDE;
- void updateDirection(QAbstractAnimation::Direction direction) Q_DECL_OVERRIDE;
+ void updateCurrentTime(int currentTime) override;
+ void updateState(QAbstractAnimation::State newState, QAbstractAnimation::State oldState) override;
+ void updateDirection(QAbstractAnimation::Direction direction) override;
private:
Q_DISABLE_COPY(QParallelAnimationGroup)
diff --git a/src/corelib/animation/qparallelanimationgroup_p.h b/src/corelib/animation/qparallelanimationgroup_p.h
index 069ba8e51a..1c9c3072f7 100644
--- a/src/corelib/animation/qparallelanimationgroup_p.h
+++ b/src/corelib/animation/qparallelanimationgroup_p.h
@@ -78,7 +78,7 @@ public:
void connectUncontrolledAnimations();
void disconnectUncontrolledAnimations();
- void animationRemoved(int index, QAbstractAnimation *) Q_DECL_OVERRIDE;
+ void animationRemoved(int index, QAbstractAnimation *) override;
// private slot
void _q_uncontrolledAnimationFinished();
diff --git a/src/corelib/animation/qpauseanimation.h b/src/corelib/animation/qpauseanimation.h
index c077164beb..e2095a39d6 100644
--- a/src/corelib/animation/qpauseanimation.h
+++ b/src/corelib/animation/qpauseanimation.h
@@ -54,16 +54,16 @@ class Q_CORE_EXPORT QPauseAnimation : public QAbstractAnimation
Q_OBJECT
Q_PROPERTY(int duration READ duration WRITE setDuration)
public:
- QPauseAnimation(QObject *parent = Q_NULLPTR);
- QPauseAnimation(int msecs, QObject *parent = Q_NULLPTR);
+ QPauseAnimation(QObject *parent = nullptr);
+ QPauseAnimation(int msecs, QObject *parent = nullptr);
~QPauseAnimation();
- int duration() const Q_DECL_OVERRIDE;
+ int duration() const override;
void setDuration(int msecs);
protected:
- bool event(QEvent *e) Q_DECL_OVERRIDE;
- void updateCurrentTime(int) Q_DECL_OVERRIDE;
+ bool event(QEvent *e) override;
+ void updateCurrentTime(int) override;
private:
Q_DISABLE_COPY(QPauseAnimation)
diff --git a/src/corelib/animation/qpropertyanimation.h b/src/corelib/animation/qpropertyanimation.h
index ecc7524884..3270591d1d 100644
--- a/src/corelib/animation/qpropertyanimation.h
+++ b/src/corelib/animation/qpropertyanimation.h
@@ -55,8 +55,8 @@ class Q_CORE_EXPORT QPropertyAnimation : public QVariantAnimation
Q_PROPERTY(QObject* targetObject READ targetObject WRITE setTargetObject)
public:
- QPropertyAnimation(QObject *parent = Q_NULLPTR);
- QPropertyAnimation(QObject *target, const QByteArray &propertyName, QObject *parent = Q_NULLPTR);
+ QPropertyAnimation(QObject *parent = nullptr);
+ QPropertyAnimation(QObject *target, const QByteArray &propertyName, QObject *parent = nullptr);
~QPropertyAnimation();
QObject *targetObject() const;
@@ -66,9 +66,9 @@ public:
void setPropertyName(const QByteArray &propertyName);
protected:
- bool event(QEvent *event) Q_DECL_OVERRIDE;
- void updateCurrentValue(const QVariant &value) Q_DECL_OVERRIDE;
- void updateState(QAbstractAnimation::State newState, QAbstractAnimation::State oldState) Q_DECL_OVERRIDE;
+ bool event(QEvent *event) override;
+ void updateCurrentValue(const QVariant &value) override;
+ void updateState(QAbstractAnimation::State newState, QAbstractAnimation::State oldState) override;
private:
Q_DISABLE_COPY(QPropertyAnimation)
diff --git a/src/corelib/animation/qsequentialanimationgroup.h b/src/corelib/animation/qsequentialanimationgroup.h
index 3caf93b054..1c8e67d256 100644
--- a/src/corelib/animation/qsequentialanimationgroup.h
+++ b/src/corelib/animation/qsequentialanimationgroup.h
@@ -56,25 +56,25 @@ class Q_CORE_EXPORT QSequentialAnimationGroup : public QAnimationGroup
Q_PROPERTY(QAbstractAnimation* currentAnimation READ currentAnimation NOTIFY currentAnimationChanged)
public:
- QSequentialAnimationGroup(QObject *parent = Q_NULLPTR);
+ QSequentialAnimationGroup(QObject *parent = nullptr);
~QSequentialAnimationGroup();
QPauseAnimation *addPause(int msecs);
QPauseAnimation *insertPause(int index, int msecs);
QAbstractAnimation *currentAnimation() const;
- int duration() const Q_DECL_OVERRIDE;
+ int duration() const override;
Q_SIGNALS:
void currentAnimationChanged(QAbstractAnimation *current);
protected:
QSequentialAnimationGroup(QSequentialAnimationGroupPrivate &dd, QObject *parent);
- bool event(QEvent *event) Q_DECL_OVERRIDE;
+ bool event(QEvent *event) override;
- void updateCurrentTime(int) Q_DECL_OVERRIDE;
- void updateState(QAbstractAnimation::State newState, QAbstractAnimation::State oldState) Q_DECL_OVERRIDE;
- void updateDirection(QAbstractAnimation::Direction direction) Q_DECL_OVERRIDE;
+ void updateCurrentTime(int) override;
+ void updateState(QAbstractAnimation::State newState, QAbstractAnimation::State oldState) override;
+ void updateDirection(QAbstractAnimation::Direction direction) override;
private:
Q_DISABLE_COPY(QSequentialAnimationGroup)
diff --git a/src/corelib/animation/qsequentialanimationgroup_p.h b/src/corelib/animation/qsequentialanimationgroup_p.h
index 1b07e1330a..e4f3d9c96a 100644
--- a/src/corelib/animation/qsequentialanimationgroup_p.h
+++ b/src/corelib/animation/qsequentialanimationgroup_p.h
@@ -82,8 +82,8 @@ public:
void setCurrentAnimation(int index, bool intermediate = false);
void activateCurrentAnimation(bool intermediate = false);
- void animationInsertedAt(int index) Q_DECL_OVERRIDE;
- void animationRemoved(int index, QAbstractAnimation *anim) Q_DECL_OVERRIDE;
+ void animationInsertedAt(int index) override;
+ void animationRemoved(int index, QAbstractAnimation *anim) override;
bool atEnd() const;
diff --git a/src/corelib/animation/qvariantanimation.h b/src/corelib/animation/qvariantanimation.h
index f21832b256..ed38979ad0 100644
--- a/src/corelib/animation/qvariantanimation.h
+++ b/src/corelib/animation/qvariantanimation.h
@@ -65,7 +65,7 @@ public:
typedef QPair<qreal, QVariant> KeyValue;
typedef QVector<KeyValue> KeyValues;
- QVariantAnimation(QObject *parent = Q_NULLPTR);
+ QVariantAnimation(QObject *parent = nullptr);
~QVariantAnimation();
QVariant startValue() const;
@@ -82,7 +82,7 @@ public:
QVariant currentValue() const;
- int duration() const Q_DECL_OVERRIDE;
+ int duration() const override;
void setDuration(int msecs);
QEasingCurve easingCurve() const;
@@ -94,11 +94,11 @@ Q_SIGNALS:
void valueChanged(const QVariant &value);
protected:
- QVariantAnimation(QVariantAnimationPrivate &dd, QObject *parent = Q_NULLPTR);
- bool event(QEvent *event) Q_DECL_OVERRIDE;
+ QVariantAnimation(QVariantAnimationPrivate &dd, QObject *parent = nullptr);
+ bool event(QEvent *event) override;
- void updateCurrentTime(int) Q_DECL_OVERRIDE;
- void updateState(QAbstractAnimation::State newState, QAbstractAnimation::State oldState) Q_DECL_OVERRIDE;
+ void updateCurrentTime(int) override;
+ void updateState(QAbstractAnimation::State newState, QAbstractAnimation::State oldState) override;
virtual void updateCurrentValue(const QVariant &value);
virtual QVariant interpolated(const QVariant &from, const QVariant &to, qreal progress) const;
diff --git a/src/corelib/arch/qatomic_cxx11.h b/src/corelib/arch/qatomic_cxx11.h
index 1404849382..2fc0bf5419 100644
--- a/src/corelib/arch/qatomic_cxx11.h
+++ b/src/corelib/arch/qatomic_cxx11.h
@@ -276,7 +276,7 @@ template <typename X> struct QAtomicOps
static inline Q_DECL_CONSTEXPR bool isTestAndSetWaitFree() Q_DECL_NOTHROW { return false; }
template <typename T>
- static bool testAndSetRelaxed(std::atomic<T> &_q_value, T expectedValue, T newValue, T *currentValue = Q_NULLPTR) Q_DECL_NOTHROW
+ static bool testAndSetRelaxed(std::atomic<T> &_q_value, T expectedValue, T newValue, T *currentValue = nullptr) Q_DECL_NOTHROW
{
bool tmp = _q_value.compare_exchange_strong(expectedValue, newValue, std::memory_order_relaxed, std::memory_order_relaxed);
if (currentValue)
@@ -285,7 +285,7 @@ template <typename X> struct QAtomicOps
}
template <typename T>
- static bool testAndSetAcquire(std::atomic<T> &_q_value, T expectedValue, T newValue, T *currentValue = Q_NULLPTR) Q_DECL_NOTHROW
+ static bool testAndSetAcquire(std::atomic<T> &_q_value, T expectedValue, T newValue, T *currentValue = nullptr) Q_DECL_NOTHROW
{
bool tmp = _q_value.compare_exchange_strong(expectedValue, newValue, std::memory_order_acquire, std::memory_order_acquire);
if (currentValue)
@@ -294,7 +294,7 @@ template <typename X> struct QAtomicOps
}
template <typename T>
- static bool testAndSetRelease(std::atomic<T> &_q_value, T expectedValue, T newValue, T *currentValue = Q_NULLPTR) Q_DECL_NOTHROW
+ static bool testAndSetRelease(std::atomic<T> &_q_value, T expectedValue, T newValue, T *currentValue = nullptr) Q_DECL_NOTHROW
{
bool tmp = _q_value.compare_exchange_strong(expectedValue, newValue, std::memory_order_release, std::memory_order_relaxed);
if (currentValue)
@@ -303,7 +303,7 @@ template <typename X> struct QAtomicOps
}
template <typename T>
- static bool testAndSetOrdered(std::atomic<T> &_q_value, T expectedValue, T newValue, T *currentValue = Q_NULLPTR) Q_DECL_NOTHROW
+ static bool testAndSetOrdered(std::atomic<T> &_q_value, T expectedValue, T newValue, T *currentValue = nullptr) Q_DECL_NOTHROW
{
bool tmp = _q_value.compare_exchange_strong(expectedValue, newValue, std::memory_order_acq_rel, std::memory_order_acquire);
if (currentValue)
diff --git a/src/corelib/codecs/qiconvcodec.cpp b/src/corelib/codecs/qiconvcodec.cpp
index d6362b6fbc..330eb7c038 100644
--- a/src/corelib/codecs/qiconvcodec.cpp
+++ b/src/corelib/codecs/qiconvcodec.cpp
@@ -53,7 +53,7 @@ QT_REQUIRE_CONFIG(iconv);
// unistd.h is needed for the _XOPEN_UNIX macro
#include <unistd.h>
-#if defined(_XOPEN_UNIX) && !defined(Q_OS_QNX) && !defined(Q_OS_OSF)
+#if defined(_XOPEN_UNIX) && !defined(Q_OS_QNX)
# include <langinfo.h>
#endif
@@ -447,7 +447,7 @@ iconv_t QIconvCodec::createIconv_t(const char *to, const char *from) const
char *codeset = 0;
#endif
-#if defined(_XOPEN_UNIX) && !defined(Q_OS_QNX) && !defined(Q_OS_OSF)
+#if defined(_XOPEN_UNIX) && !defined(Q_OS_QNX)
if (cd == (iconv_t) -1) {
codeset = nl_langinfo(CODESET);
if (codeset)
diff --git a/src/corelib/codecs/qicucodec_p.h b/src/corelib/codecs/qicucodec_p.h
index 3a373ce5b3..0c2dbe17d6 100644
--- a/src/corelib/codecs/qicucodec_p.h
+++ b/src/corelib/codecs/qicucodec_p.h
@@ -74,12 +74,12 @@ public:
static QTextCodec *codecForNameUnlocked(const char *name);
static QTextCodec *codecForMibUnlocked(int mib);
- QString convertToUnicode(const char *, int, ConverterState *) const Q_DECL_OVERRIDE;
- QByteArray convertFromUnicode(const QChar *, int, ConverterState *) const Q_DECL_OVERRIDE;
+ QString convertToUnicode(const char *, int, ConverterState *) const override;
+ QByteArray convertFromUnicode(const QChar *, int, ConverterState *) const override;
- QByteArray name() const Q_DECL_OVERRIDE;
- QList<QByteArray> aliases() const Q_DECL_OVERRIDE;
- int mibEnum() const Q_DECL_OVERRIDE;
+ QByteArray name() const override;
+ QList<QByteArray> aliases() const override;
+ int mibEnum() const override;
private:
QIcuCodec(const char *name);
diff --git a/src/corelib/codecs/qisciicodec_p.h b/src/corelib/codecs/qisciicodec_p.h
index f92c0091ce..f818e7d83e 100644
--- a/src/corelib/codecs/qisciicodec_p.h
+++ b/src/corelib/codecs/qisciicodec_p.h
@@ -65,11 +65,11 @@ public:
static QTextCodec *create(const char *name);
- QByteArray name() const Q_DECL_OVERRIDE;
- int mibEnum() const Q_DECL_OVERRIDE;
+ QByteArray name() const override;
+ int mibEnum() const override;
- QString convertToUnicode(const char *, int, ConverterState *) const Q_DECL_OVERRIDE;
- QByteArray convertFromUnicode(const QChar *, int, ConverterState *) const Q_DECL_OVERRIDE;
+ QString convertToUnicode(const char *, int, ConverterState *) const override;
+ QByteArray convertFromUnicode(const QChar *, int, ConverterState *) const override;
private:
int idx;
diff --git a/src/corelib/codecs/qlatincodec_p.h b/src/corelib/codecs/qlatincodec_p.h
index 1042c3b80d..3e258e5ae1 100644
--- a/src/corelib/codecs/qlatincodec_p.h
+++ b/src/corelib/codecs/qlatincodec_p.h
@@ -63,12 +63,12 @@ class QLatin1Codec : public QTextCodec
public:
~QLatin1Codec();
- QString convertToUnicode(const char *, int, ConverterState *) const Q_DECL_OVERRIDE;
- QByteArray convertFromUnicode(const QChar *, int, ConverterState *) const Q_DECL_OVERRIDE;
+ QString convertToUnicode(const char *, int, ConverterState *) const override;
+ QByteArray convertFromUnicode(const QChar *, int, ConverterState *) const override;
- QByteArray name() const Q_DECL_OVERRIDE;
- QList<QByteArray> aliases() const Q_DECL_OVERRIDE;
- int mibEnum() const Q_DECL_OVERRIDE;
+ QByteArray name() const override;
+ QList<QByteArray> aliases() const override;
+ int mibEnum() const override;
};
@@ -78,12 +78,12 @@ class QLatin15Codec: public QTextCodec
public:
~QLatin15Codec();
- QString convertToUnicode(const char *, int, ConverterState *) const Q_DECL_OVERRIDE;
- QByteArray convertFromUnicode(const QChar *, int, ConverterState *) const Q_DECL_OVERRIDE;
+ QString convertToUnicode(const char *, int, ConverterState *) const override;
+ QByteArray convertFromUnicode(const QChar *, int, ConverterState *) const override;
- QByteArray name() const Q_DECL_OVERRIDE;
- QList<QByteArray> aliases() const Q_DECL_OVERRIDE;
- int mibEnum() const Q_DECL_OVERRIDE;
+ QByteArray name() const override;
+ QList<QByteArray> aliases() const override;
+ int mibEnum() const override;
};
#endif // QT_NO_TEXTCODEC
diff --git a/src/corelib/codecs/qtextcodec.cpp b/src/corelib/codecs/qtextcodec.cpp
index 4f0cd914ca..1541c498e6 100644
--- a/src/corelib/codecs/qtextcodec.cpp
+++ b/src/corelib/codecs/qtextcodec.cpp
@@ -88,7 +88,7 @@
#include <stdlib.h>
#include <ctype.h>
#include <locale.h>
-#if defined (_XOPEN_UNIX) && !defined(Q_OS_QNX) && !defined(Q_OS_OSF) && !defined(Q_OS_ANDROID)
+#if defined (_XOPEN_UNIX) && !defined(Q_OS_QNX) && !defined(Q_OS_ANDROID)
# include <langinfo.h>
#endif
@@ -180,7 +180,7 @@ static QTextCodec *setupLocaleMapper()
// This is because the builtin utf8 codec is around 5 times faster
// then the using QIconvCodec
-#if defined (_XOPEN_UNIX) && !defined(Q_OS_OSF)
+#if defined (_XOPEN_UNIX)
char *charset = nl_langinfo(CODESET);
if (charset)
locale = QTextCodec::codecForName(charset);
diff --git a/src/corelib/codecs/qtextcodec.h b/src/corelib/codecs/qtextcodec.h
index 5163d37238..8153bebac8 100644
--- a/src/corelib/codecs/qtextcodec.h
+++ b/src/corelib/codecs/qtextcodec.h
@@ -100,7 +100,7 @@ public:
struct Q_CORE_EXPORT ConverterState {
ConverterState(ConversionFlags f = DefaultConversion)
- : flags(f), remainingChars(0), invalidChars(0), d(Q_NULLPTR) { state_data[0] = state_data[1] = state_data[2] = 0; }
+ : flags(f), remainingChars(0), invalidChars(0), d(nullptr) { state_data[0] = state_data[1] = state_data[2] = 0; }
~ConverterState();
ConversionFlags flags;
int remainingChars;
@@ -111,9 +111,9 @@ public:
Q_DISABLE_COPY(ConverterState)
};
- QString toUnicode(const char *in, int length, ConverterState *state = Q_NULLPTR) const
+ QString toUnicode(const char *in, int length, ConverterState *state = nullptr) const
{ return convertToUnicode(in, length, state); }
- QByteArray fromUnicode(const QChar *in, int length, ConverterState *state = Q_NULLPTR) const
+ QByteArray fromUnicode(const QChar *in, int length, ConverterState *state = nullptr) const
{ return convertFromUnicode(in, length, state); }
QTextDecoder* makeDecoder(ConversionFlags flags = DefaultConversion) const;
diff --git a/src/corelib/codecs/qtsciicodec_p.h b/src/corelib/codecs/qtsciicodec_p.h
index 68ab01f7b5..78f9350a19 100644
--- a/src/corelib/codecs/qtsciicodec_p.h
+++ b/src/corelib/codecs/qtsciicodec_p.h
@@ -91,11 +91,11 @@ class QTsciiCodec : public QTextCodec {
public:
~QTsciiCodec();
- QByteArray name() const Q_DECL_OVERRIDE;
- int mibEnum() const Q_DECL_OVERRIDE;
+ QByteArray name() const override;
+ int mibEnum() const override;
- QString convertToUnicode(const char *, int, ConverterState *) const Q_DECL_OVERRIDE;
- QByteArray convertFromUnicode(const QChar *, int, ConverterState *) const Q_DECL_OVERRIDE;
+ QString convertToUnicode(const char *, int, ConverterState *) const override;
+ QByteArray convertFromUnicode(const QChar *, int, ConverterState *) const override;
};
#endif // QT_NO_CODECS
diff --git a/src/corelib/codecs/qutfcodec_p.h b/src/corelib/codecs/qutfcodec_p.h
index 152fe174c4..36752cc909 100644
--- a/src/corelib/codecs/qutfcodec_p.h
+++ b/src/corelib/codecs/qutfcodec_p.h
@@ -310,11 +310,11 @@ class QUtf8Codec : public QTextCodec {
public:
~QUtf8Codec();
- QByteArray name() const Q_DECL_OVERRIDE;
- int mibEnum() const Q_DECL_OVERRIDE;
+ QByteArray name() const override;
+ int mibEnum() const override;
- QString convertToUnicode(const char *, int, ConverterState *) const Q_DECL_OVERRIDE;
- QByteArray convertFromUnicode(const QChar *, int, ConverterState *) const Q_DECL_OVERRIDE;
+ QString convertToUnicode(const char *, int, ConverterState *) const override;
+ QByteArray convertFromUnicode(const QChar *, int, ConverterState *) const override;
void convertToUnicode(QString *target, const char *, int, ConverterState *) const;
};
@@ -324,12 +324,12 @@ public:
QUtf16Codec() { e = DetectEndianness; }
~QUtf16Codec();
- QByteArray name() const Q_DECL_OVERRIDE;
- QList<QByteArray> aliases() const Q_DECL_OVERRIDE;
- int mibEnum() const Q_DECL_OVERRIDE;
+ QByteArray name() const override;
+ QList<QByteArray> aliases() const override;
+ int mibEnum() const override;
- QString convertToUnicode(const char *, int, ConverterState *) const Q_DECL_OVERRIDE;
- QByteArray convertFromUnicode(const QChar *, int, ConverterState *) const Q_DECL_OVERRIDE;
+ QString convertToUnicode(const char *, int, ConverterState *) const override;
+ QByteArray convertFromUnicode(const QChar *, int, ConverterState *) const override;
protected:
DataEndianness e;
@@ -338,17 +338,17 @@ protected:
class QUtf16BECodec : public QUtf16Codec {
public:
QUtf16BECodec() : QUtf16Codec() { e = BigEndianness; }
- QByteArray name() const Q_DECL_OVERRIDE;
- QList<QByteArray> aliases() const Q_DECL_OVERRIDE;
- int mibEnum() const Q_DECL_OVERRIDE;
+ QByteArray name() const override;
+ QList<QByteArray> aliases() const override;
+ int mibEnum() const override;
};
class QUtf16LECodec : public QUtf16Codec {
public:
QUtf16LECodec() : QUtf16Codec() { e = LittleEndianness; }
- QByteArray name() const Q_DECL_OVERRIDE;
- QList<QByteArray> aliases() const Q_DECL_OVERRIDE;
- int mibEnum() const Q_DECL_OVERRIDE;
+ QByteArray name() const override;
+ QList<QByteArray> aliases() const override;
+ int mibEnum() const override;
};
class QUtf32Codec : public QTextCodec {
@@ -356,12 +356,12 @@ public:
QUtf32Codec() { e = DetectEndianness; }
~QUtf32Codec();
- QByteArray name() const Q_DECL_OVERRIDE;
- QList<QByteArray> aliases() const Q_DECL_OVERRIDE;
- int mibEnum() const Q_DECL_OVERRIDE;
+ QByteArray name() const override;
+ QList<QByteArray> aliases() const override;
+ int mibEnum() const override;
- QString convertToUnicode(const char *, int, ConverterState *) const Q_DECL_OVERRIDE;
- QByteArray convertFromUnicode(const QChar *, int, ConverterState *) const Q_DECL_OVERRIDE;
+ QString convertToUnicode(const char *, int, ConverterState *) const override;
+ QByteArray convertFromUnicode(const QChar *, int, ConverterState *) const override;
protected:
DataEndianness e;
@@ -370,17 +370,17 @@ protected:
class QUtf32BECodec : public QUtf32Codec {
public:
QUtf32BECodec() : QUtf32Codec() { e = BigEndianness; }
- QByteArray name() const Q_DECL_OVERRIDE;
- QList<QByteArray> aliases() const Q_DECL_OVERRIDE;
- int mibEnum() const Q_DECL_OVERRIDE;
+ QByteArray name() const override;
+ QList<QByteArray> aliases() const override;
+ int mibEnum() const override;
};
class QUtf32LECodec : public QUtf32Codec {
public:
QUtf32LECodec() : QUtf32Codec() { e = LittleEndianness; }
- QByteArray name() const Q_DECL_OVERRIDE;
- QList<QByteArray> aliases() const Q_DECL_OVERRIDE;
- int mibEnum() const Q_DECL_OVERRIDE;
+ QByteArray name() const override;
+ QList<QByteArray> aliases() const override;
+ int mibEnum() const override;
};
diff --git a/src/corelib/corelib.pro b/src/corelib/corelib.pro
index 6dc11e1a4d..a0d41396dd 100644
--- a/src/corelib/corelib.pro
+++ b/src/corelib/corelib.pro
@@ -10,18 +10,15 @@ CONFIG += $$MODULE_CONFIG
DEFINES += $$MODULE_DEFINES
DEFINES += QT_NO_USING_NAMESPACE QT_NO_FOREACH
win32-msvc*|win32-icc:QMAKE_LFLAGS += /BASE:0x67000000
-irix-cc*:QMAKE_CXXFLAGS += -no_prelink -ptused
-CONFIG += optimize_full
+CONFIG += simd optimize_full
QMAKE_DOCS = $$PWD/doc/qtcore.qdocconf
-ANDROID_JAR_DEPENDENCIES = \
- jar/QtAndroid.jar
ANDROID_LIB_DEPENDENCIES = \
plugins/platforms/android/libqtforandroid.so
ANDROID_BUNDLED_JAR_DEPENDENCIES = \
- jar/QtAndroid-bundled.jar
+ jar/QtAndroid.jar
ANDROID_PERMISSIONS = \
android.permission.INTERNET \
android.permission.WRITE_EXTERNAL_STORAGE
diff --git a/src/corelib/global/global.pri b/src/corelib/global/global.pri
index 0f8935d4b5..2b4fd6d661 100644
--- a/src/corelib/global/global.pri
+++ b/src/corelib/global/global.pri
@@ -39,6 +39,27 @@ SOURCES += \
global/qrandom.cpp \
global/qhooks.cpp
+# Only add global/qfloat16_f16c.c if qfloat16.cpp can't #include it.
+# Any compiler: if it is already generating F16C code, let qfloat16.cpp do it
+# Clang: ICE if not generating F16C code, so use qfloat16_f16c.c
+# ICC: miscompiles if not generating F16C code, so use qfloat16_f16c.c
+# GCC: if it can use F16C intrinsics, let qfloat16.cpp do it
+# MSVC: if it is already generating AVX code, let qfloat16.cpp do it
+# MSVC: otherwise, it generates poorly-performing code, so use qfloat16_f16c.c
+contains(QT_CPU_FEATURES.$$QT_ARCH, f16c): \
+ f16c_cxx = true
+else: clang|intel_icl|intel_icc: \
+ f16c_cxx = false
+else: gcc:f16c:x86SimdAlways: \
+ f16c_cxx = true
+else: msvc:contains(QT_CPU_FEATURES.$$QT_ARCH, avx): \
+ f16c_cxx = true
+else: \
+ f16c_cxx = false
+$$f16c_cxx: DEFINES += QFLOAT16_INCLUDE_FAST
+else: F16C_SOURCES += global/qfloat16_f16c.c
+unset(f16c_cxx)
+
VERSIONTAGGING_SOURCES = global/qversiontagging.cpp
darwin: SOURCES += global/qoperatingsystemversion_darwin.mm
diff --git a/src/corelib/global/qcompilerdetection.h b/src/corelib/global/qcompilerdetection.h
index 231ac2c9b0..885cb96c1a 100644
--- a/src/corelib/global/qcompilerdetection.h
+++ b/src/corelib/global/qcompilerdetection.h
@@ -243,6 +243,7 @@
# define Q_REQUIRED_RESULT __attribute__ ((__warn_unused_result__))
# define Q_DECL_PURE_FUNCTION __attribute__((pure))
# define Q_DECL_CONST_FUNCTION __attribute__((const))
+# define Q_DECL_COLD_FUNCTION __attribute__((cold))
# if !defined(QT_MOC_CPP)
# define Q_PACKED __attribute__ ((__packed__))
# ifndef __ARM_EABI__
@@ -651,6 +652,12 @@
# undef Q_COMPILER_CONSTEXPR
# endif
# endif
+# elif defined(__STDC_VERSION__) && __STDC_VERSION__ > 199901L s
+// C11 features supported. Only tested with ICC 17 and up.
+# define Q_COMPILER_STATIC_ASSERT
+# if __has_include(<threads.h>)
+# define Q_COMPILER_THREAD_LOCAL
+# endif
# endif
#endif
@@ -803,6 +810,17 @@
# endif
# endif
+# if defined(__STDC_VERSION__)
+# if __has_feature(c_static_assert)
+# define Q_COMPILER_STATIC_ASSERT
+# endif
+# if __has_feature(c_thread_local) && __has_include(<threads.h>)
+# if !defined(__FreeBSD__) /* FreeBSD clang fails on __cxa_thread_atexit */
+# define Q_COMPILER_THREAD_LOCAL
+# endif
+# endif
+# endif
+
# if defined(__has_warning)
# if __has_warning("-Wunused-private-field")
# define Q_DECL_UNUSED_MEMBER Q_DECL_UNUSED
@@ -898,6 +916,18 @@
# define Q_COMPILER_RETURN_TYPE_DEDUCTION
# endif
# endif
+# if defined(__STDC_VERSION__) && __STDC_VERSION__ > 199901L
+# if Q_CC_GNU >= 407
+ /* C11 features supported in GCC 4.7: */
+# define Q_COMPILER_STATIC_ASSERT
+# endif
+# if Q_CC_GNU >= 409
+ /* C11 features supported in GCC 4.9: */
+# if __has_include(<threads.h>)
+# define Q_COMPILER_THREAD_LOCAL
+# endif
+# endif
+# endif
#endif
#if defined(Q_CC_MSVC)
@@ -1246,6 +1276,9 @@
#ifndef Q_DECL_CONST_FUNCTION
# define Q_DECL_CONST_FUNCTION Q_DECL_PURE_FUNCTION
#endif
+#ifndef Q_DECL_COLD_FUNCTION
+# define Q_DECL_COLD_FUNCTION
+#endif
#ifndef QT_MAKE_UNCHECKED_ARRAY_ITERATOR
# define QT_MAKE_UNCHECKED_ARRAY_ITERATOR(x) (x)
#endif
diff --git a/src/corelib/global/qconfig-bootstrapped.h b/src/corelib/global/qconfig-bootstrapped.h
index dabb715607..0df593941d 100644
--- a/src/corelib/global/qconfig-bootstrapped.h
+++ b/src/corelib/global/qconfig-bootstrapped.h
@@ -94,6 +94,7 @@
#endif
#define QT_NO_QOBJECT
#define QT_FEATURE_process -1
+#define QT_FEATURE_regularexpression -1
#define QT_FEATURE_renameat2 -1
#define QT_FEATURE_sharedmemory -1
#define QT_FEATURE_slog2 -1
diff --git a/src/corelib/global/qendian.h b/src/corelib/global/qendian.h
index 3337829de0..a14fce23f8 100644
--- a/src/corelib/global/qendian.h
+++ b/src/corelib/global/qendian.h
@@ -272,7 +272,8 @@ public:
static Q_DECL_CONSTEXPR T fromSpecial(T source) { return qFromBigEndian(source); }
};
-#ifdef Q_QDOC
+#ifdef Q_CLANG_QDOC
+template<typename T>
class QLEInteger {
public:
explicit Q_DECL_CONSTEXPR QLEInteger(T i);
@@ -292,6 +293,7 @@ public:
QLEInteger &operator ^=(T i);
};
+template<typename T>
class QBEInteger {
public:
explicit Q_DECL_CONSTEXPR QBEInteger(T i);
diff --git a/src/corelib/global/qendian.qdoc b/src/corelib/global/qendian.qdoc
index 2ccdea5979..65df25a205 100644
--- a/src/corelib/global/qendian.qdoc
+++ b/src/corelib/global/qendian.qdoc
@@ -34,8 +34,8 @@
*/
/*!
+ \fn template <typename T> T qFromUnaligned(const void *ptr)
\internal
- \fn T qFromUnaligned(const void *ptr)
\since 5.5
Loads a \c{T} from address \a ptr, which may be misaligned.
@@ -45,8 +45,8 @@
*/
/*!
+ \fn template <typename T> void qToUnaligned(const T t, void *ptr)
\internal
- \fn void qToUnaligned(T t, void *ptr)
\since 4.5
Stores \a t to address \a ptr, which may be misaligned.
@@ -57,7 +57,7 @@
/*!
- \fn T qFromBigEndian(const void *src)
+ \fn template <typename T> T qFromBigEndian(const void *src)
\since 4.3
\relates <QtEndian>
@@ -78,7 +78,7 @@
\sa qToLittleEndian()
*/
/*!
- \fn T qFromBigEndian(T src)
+ \fn template <typename T> T qFromBigEndian(T src)
\since 4.3
\relates <QtEndian>
\overload
@@ -90,7 +90,7 @@
unmodified.
*/
/*!
- \fn T qFromLittleEndian(const void *src)
+ \fn template <typename T> T qFromLittleEndian(const void *src)
\since 4.3
\relates <QtEndian>
@@ -111,7 +111,7 @@
\sa qToLittleEndian()
*/
/*!
- \fn T qFromLittleEndian(T src)
+ \fn template <typename T> T qFromLittleEndian(T src)
\since 4.3
\relates <QtEndian>
\overload
@@ -123,7 +123,7 @@
unmodified.
*/
/*!
- \fn void qToBigEndian(T src, void *dest)
+ \fn template <typename T> void qToBigEndian(T src, void *dest)
\since 4.3
\relates <QtEndian>
@@ -141,7 +141,7 @@
\sa qToLittleEndian()
*/
/*!
- \fn T qToBigEndian(T src)
+ \fn template <typename T> T qToBigEndian(T src)
\since 4.3
\relates <QtEndian>
\overload
@@ -153,7 +153,7 @@
unmodified.
*/
/*!
- \fn void qToLittleEndian(T src, void *dest)
+ \fn template <typename T> void qToLittleEndian(T src, void *dest)
\since 4.3
\relates <QtEndian>
@@ -171,7 +171,7 @@
\sa qToBigEndian()
*/
/*!
- \fn T qToLittleEndian(T src)
+ \fn template <typename T> T qToLittleEndian(T src)
\since 4.3
\relates <QtEndian>
\overload
@@ -203,100 +203,100 @@
an exact endian is needed.
*/
-/*! \fn QLEInteger::QLEInteger(T value)
+/*! \fn template <typename T> QLEInteger<T>::QLEInteger(T value)
Constructs a QLEInteger with the given \a value.
*/
-/*! \fn QLEInteger &QLEInteger::operator=(T value)
+/*! \fn template <typename T> QLEInteger &QLEInteger<T>::operator=(T i)
- Assigns \a value to this QLEInteger and returns a reference to
+ Assigns \a i to this QLEInteger and returns a reference to
this QLEInteger.
*/
/*!
- \fn QLEInteger::operator T() const
+ \fn template <typename T> QLEInteger<T>::operator T() const
Returns the value of this QLEInteger as a native integer.
*/
/*!
- \fn bool QLEInteger::operator==(QLEInteger other) const
+ \fn template <typename T> bool QLEInteger<T>::operator==(QLEInteger other) const
Returns \c true if the value of this QLEInteger is equal to the value of \a other.
*/
/*!
- \fn bool QLEInteger::operator!=(QLEInteger other) const
+ \fn template <typename T> bool QLEInteger<T>::operator!=(QLEInteger other) const
Returns \c true if the value of this QLEInteger is not equal to the value of \a other.
*/
/*!
- \fn QLEInteger &QLEInteger::operator+=(T i)
+ \fn template <typename T> QLEInteger &QLEInteger<T>::operator+=(T i)
Adds \a i to this QLEInteger and returns a reference to
this object.
*/
/*!
- \fn QLEInteger &QLEInteger::operator-=(T i)
+ \fn template <typename T> QLEInteger &QLEInteger<T>::operator-=(T i)
Subtracts \a i from this QLEInteger and returns a reference to
this object.
*/
/*!
- \fn QLEInteger &QLEInteger::operator*=(T i)
+ \fn template <typename T> QLEInteger &QLEInteger<T>::operator*=(T i)
Multiplies \a i with this QLEInteger and returns a reference to
this object.
*/
/*!
- \fn QLEInteger &QLEInteger::operator/=(T i)
+ \fn template <typename T> QLEInteger &QLEInteger<T>::operator/=(T i)
Divides this QLEInteger with \a i and returns a reference to
this object.
*/
/*!
- \fn QLEInteger &QLEInteger::operator%=(T i)
+ \fn template <typename T> QLEInteger &QLEInteger<T>::operator%=(T i)
Sets this QLEInteger to the remainder of a division by \a i and
returns a reference to this object.
*/
/*!
- \fn QLEInteger &QLEInteger::operator>>=(T i)
+ \fn template <typename T> QLEInteger &QLEInteger<T>::operator>>=(T i)
Performs a left-shift by \a i on this QLEInteger and returns a
reference to this object.
*/
/*!
- \fn QLEInteger &QLEInteger::operator<<=(T i)
+ \fn template <typename T> QLEInteger &QLEInteger<T>::operator<<=(T i)
Performs a right-shift by \a i on this QLEInteger and returns a
reference to this object.
*/
/*!
- \fn QLEInteger &QLEInteger::operator|=(T i)
+ \fn template <typename T> QLEInteger &QLEInteger<T>::operator|=(T i)
Performs a bitwise OR with \a i onto this QLEInteger and returns a reference to
this object.
*/
/*!
- \fn QLEInteger &QLEInteger::operator&=(T i)
+ \fn template <typename T> QLEInteger &QLEInteger<T>::operator&=(T i)
Performs a bitwise AND with \a i onto this QLEInteger and returns a reference to
this object.
*/
/*!
- \fn QLEInteger &QLEInteger::operator^=(T i)
+ \fn template <typename T> QLEInteger &QLEInteger<T>::operator^=(T i)
Performs a bitwise XOR with \a i onto this QLEInteger and returns a reference to
this object.
@@ -322,100 +322,100 @@
an exact endian is needed.
*/
-/*! \fn QBEInteger::QBEInteger(T value)
+/*! \fn template <typename T> QBEInteger<T>::QBEInteger(T value)
Constructs a QBEInteger with the given \a value.
*/
-/*! \fn QBEInteger &QBEInteger::operator=(T value)
+/*! \fn template <typename T> QBEInteger &QBEInteger<T>::operator=(T i)
- Assigns \a value to this QBEInteger and returns a reference to
+ Assigns \a i to this QBEInteger and returns a reference to
this QBEInteger.
*/
/*!
- \fn QBEInteger::operator T() const
+ \fn template <typename T> QBEInteger<T>::operator T() const
Returns the value of this QBEInteger as a native integer.
*/
/*!
- \fn bool QBEInteger::operator==(QBEInteger other) const
+ \fn template <typename T> bool QBEInteger<T>::operator==(QBEInteger other) const
Returns \c true if the value of this QBEInteger is equal to the value of \a other.
*/
/*!
- \fn bool QBEInteger::operator!=(QBEInteger other) const
+ \fn template <typename T> bool QBEInteger<T>::operator!=(QBEInteger other) const
Returns \c true if the value of this QBEInteger is not equal to the value of \a other.
*/
/*!
- \fn QBEInteger &QBEInteger::operator+=(T i)
+ \fn template <typename T> QBEInteger &QBEInteger<T>::operator+=(T i)
Adds \a i to this QBEInteger and returns a reference to
this object.
*/
/*!
- \fn QBEInteger &QBEInteger::operator-=(T i)
+ \fn template <typename T> QBEInteger &QBEInteger<T>::operator-=(T i)
Subtracts \a i from this QBEInteger and returns a reference to
this object.
*/
/*!
- \fn QBEInteger &QBEInteger::operator*=(T i)
+ \fn template <typename T> QBEInteger &QBEInteger<T>::operator*=(T i)
Multiplies \a i with this QBEInteger and returns a reference to
this object.
*/
/*!
- \fn QBEInteger &QBEInteger::operator/=(T i)
+ \fn template <typename T> QBEInteger &QBEInteger<T>::operator/=(T i)
Divides this QBEInteger with \a i and returns a reference to
this object.
*/
/*!
- \fn QBEInteger &QBEInteger::operator%=(T i)
+ \fn template <typename T> QBEInteger &QBEInteger<T>::operator%=(T i)
Sets this QBEInteger to the remainder of a division by \a i and
returns a reference to this object.
*/
/*!
- \fn QBEInteger &QBEInteger::operator>>=(T i)
+ \fn template <typename T> QBEInteger &QBEInteger<T>::operator>>=(T i)
Performs a left-shift by \a i on this QBEInteger and returns a
reference to this object.
*/
/*!
- \fn QBEInteger &QBEInteger::operator<<=(T i)
+ \fn template <typename T> QBEInteger &QBEInteger<T>::operator<<=(T i)
Performs a right-shift by \a i on this QBEInteger and returns a
reference to this object.
*/
/*!
- \fn QBEInteger &QBEInteger::operator|=(T i)
+ \fn template <typename T> QBEInteger &QBEInteger<T>::operator|=(T i)
Performs a bitwise OR with \a i onto this QBEInteger and returns a reference to
this object.
*/
/*!
- \fn QBEInteger &QBEInteger::operator&=(T i)
+ \fn template <typename T> QBEInteger &QBEInteger<T>::operator&=(T i)
Performs a bitwise AND with \a i onto this QBEInteger and returns a reference to
this object.
*/
/*!
- \fn QBEInteger &QBEInteger::operator^=(T i)
+ \fn template <typename T> QBEInteger &QBEInteger<T>::operator^=(T i)
Performs a bitwise XOR with \a i onto this QBEInteger and returns a reference to
this object.
diff --git a/src/corelib/global/qflags.h b/src/corelib/global/qflags.h
index 72b0a689ff..e9fee5f23e 100644
--- a/src/corelib/global/qflags.h
+++ b/src/corelib/global/qflags.h
@@ -54,20 +54,20 @@ class QFlag
{
int i;
public:
- Q_DECL_CONSTEXPR inline QFlag(int ai) Q_DECL_NOTHROW : i(ai) {}
+ Q_DECL_CONSTEXPR inline QFlag(int value) Q_DECL_NOTHROW : i(value) {}
Q_DECL_CONSTEXPR inline operator int() const Q_DECL_NOTHROW { return i; }
#if !defined(Q_CC_MSVC)
// Microsoft Visual Studio has buggy behavior when it comes to
// unsigned enums: even if the enum is unsigned, the enum tags are
// always signed
-# if !defined(__LP64__) && !defined(Q_QDOC)
- Q_DECL_CONSTEXPR inline QFlag(long ai) Q_DECL_NOTHROW : i(int(ai)) {}
- Q_DECL_CONSTEXPR inline QFlag(ulong ai) Q_DECL_NOTHROW : i(int(long(ai))) {}
+# if !defined(__LP64__) && !defined(Q_CLANG_QDOC)
+ Q_DECL_CONSTEXPR inline QFlag(long value) Q_DECL_NOTHROW : i(int(value)) {}
+ Q_DECL_CONSTEXPR inline QFlag(ulong value) Q_DECL_NOTHROW : i(int(long(value))) {}
# endif
- Q_DECL_CONSTEXPR inline QFlag(uint ai) Q_DECL_NOTHROW : i(int(ai)) {}
- Q_DECL_CONSTEXPR inline QFlag(short ai) Q_DECL_NOTHROW : i(int(ai)) {}
- Q_DECL_CONSTEXPR inline QFlag(ushort ai) Q_DECL_NOTHROW : i(int(uint(ai))) {}
+ Q_DECL_CONSTEXPR inline QFlag(uint value) Q_DECL_NOTHROW : i(int(value)) {}
+ Q_DECL_CONSTEXPR inline QFlag(short value) Q_DECL_NOTHROW : i(int(value)) {}
+ Q_DECL_CONSTEXPR inline QFlag(ushort value) Q_DECL_NOTHROW : i(int(uint(value))) {}
Q_DECL_CONSTEXPR inline operator uint() const Q_DECL_NOTHROW { return uint(i); }
#endif
};
@@ -82,7 +82,7 @@ public:
};
Q_DECLARE_TYPEINFO(QIncompatibleFlag, Q_PRIMITIVE_TYPE);
-Q_DECL_CONSTEXPR inline QIncompatibleFlag::QIncompatibleFlag(int ai) Q_DECL_NOTHROW : i(ai) {}
+Q_DECL_CONSTEXPR inline QIncompatibleFlag::QIncompatibleFlag(int value) Q_DECL_NOTHROW : i(value) {}
#ifndef Q_NO_TYPESAFE_FLAGS
@@ -100,7 +100,7 @@ class QFlags
template <typename E> friend QDataStream &operator>>(QDataStream &, QFlags<E> &);
template <typename E> friend QDataStream &operator<<(QDataStream &, QFlags<E>);
public:
-#if defined(Q_CC_MSVC) || defined(Q_QDOC)
+#if defined(Q_CC_MSVC) || defined(Q_CLANG_QDOC)
// see above for MSVC
// the definition below is too complex for qdoc
typedef int Int;
@@ -113,13 +113,13 @@ public:
#endif
typedef Enum enum_type;
// compiler-generated copy/move ctor/assignment operators are fine!
-#ifdef Q_QDOC
+#ifdef Q_CLANG_QDOC
Q_DECL_CONSTEXPR inline QFlags(const QFlags &other);
Q_DECL_CONSTEXPR inline QFlags &operator=(const QFlags &other);
#endif
- Q_DECL_CONSTEXPR inline QFlags(Enum f) Q_DECL_NOTHROW : i(Int(f)) {}
+ Q_DECL_CONSTEXPR inline QFlags(Enum flags) Q_DECL_NOTHROW : i(Int(flags)) {}
Q_DECL_CONSTEXPR inline QFlags(Zero = Q_NULLPTR) Q_DECL_NOTHROW : i(0) {}
- Q_DECL_CONSTEXPR inline QFlags(QFlag f) Q_DECL_NOTHROW : i(f) {}
+ Q_DECL_CONSTEXPR inline QFlags(QFlag flag) Q_DECL_NOTHROW : i(flag) {}
#ifdef Q_COMPILER_INITIALIZER_LISTS
Q_DECL_CONSTEXPR inline QFlags(std::initializer_list<Enum> flags) Q_DECL_NOTHROW
@@ -129,28 +129,28 @@ public:
Q_DECL_RELAXED_CONSTEXPR inline QFlags &operator&=(int mask) Q_DECL_NOTHROW { i &= mask; return *this; }
Q_DECL_RELAXED_CONSTEXPR inline QFlags &operator&=(uint mask) Q_DECL_NOTHROW { i &= mask; return *this; }
Q_DECL_RELAXED_CONSTEXPR inline QFlags &operator&=(Enum mask) Q_DECL_NOTHROW { i &= Int(mask); return *this; }
- Q_DECL_RELAXED_CONSTEXPR inline QFlags &operator|=(QFlags f) Q_DECL_NOTHROW { i |= f.i; return *this; }
- Q_DECL_RELAXED_CONSTEXPR inline QFlags &operator|=(Enum f) Q_DECL_NOTHROW { i |= Int(f); return *this; }
- Q_DECL_RELAXED_CONSTEXPR inline QFlags &operator^=(QFlags f) Q_DECL_NOTHROW { i ^= f.i; return *this; }
- Q_DECL_RELAXED_CONSTEXPR inline QFlags &operator^=(Enum f) Q_DECL_NOTHROW { i ^= Int(f); return *this; }
+ Q_DECL_RELAXED_CONSTEXPR inline QFlags &operator|=(QFlags other) Q_DECL_NOTHROW { i |= other.i; return *this; }
+ Q_DECL_RELAXED_CONSTEXPR inline QFlags &operator|=(Enum other) Q_DECL_NOTHROW { i |= Int(other); return *this; }
+ Q_DECL_RELAXED_CONSTEXPR inline QFlags &operator^=(QFlags other) Q_DECL_NOTHROW { i ^= other.i; return *this; }
+ Q_DECL_RELAXED_CONSTEXPR inline QFlags &operator^=(Enum other) Q_DECL_NOTHROW { i ^= Int(other); return *this; }
Q_DECL_CONSTEXPR inline operator Int() const Q_DECL_NOTHROW { return i; }
- Q_DECL_CONSTEXPR inline QFlags operator|(QFlags f) const Q_DECL_NOTHROW { return QFlags(QFlag(i | f.i)); }
- Q_DECL_CONSTEXPR inline QFlags operator|(Enum f) const Q_DECL_NOTHROW { return QFlags(QFlag(i | Int(f))); }
- Q_DECL_CONSTEXPR inline QFlags operator^(QFlags f) const Q_DECL_NOTHROW { return QFlags(QFlag(i ^ f.i)); }
- Q_DECL_CONSTEXPR inline QFlags operator^(Enum f) const Q_DECL_NOTHROW { return QFlags(QFlag(i ^ Int(f))); }
+ Q_DECL_CONSTEXPR inline QFlags operator|(QFlags other) const Q_DECL_NOTHROW { return QFlags(QFlag(i | other.i)); }
+ Q_DECL_CONSTEXPR inline QFlags operator|(Enum other) const Q_DECL_NOTHROW { return QFlags(QFlag(i | Int(other))); }
+ Q_DECL_CONSTEXPR inline QFlags operator^(QFlags other) const Q_DECL_NOTHROW { return QFlags(QFlag(i ^ other.i)); }
+ Q_DECL_CONSTEXPR inline QFlags operator^(Enum other) const Q_DECL_NOTHROW { return QFlags(QFlag(i ^ Int(other))); }
Q_DECL_CONSTEXPR inline QFlags operator&(int mask) const Q_DECL_NOTHROW { return QFlags(QFlag(i & mask)); }
Q_DECL_CONSTEXPR inline QFlags operator&(uint mask) const Q_DECL_NOTHROW { return QFlags(QFlag(i & mask)); }
- Q_DECL_CONSTEXPR inline QFlags operator&(Enum f) const Q_DECL_NOTHROW { return QFlags(QFlag(i & Int(f))); }
+ Q_DECL_CONSTEXPR inline QFlags operator&(Enum other) const Q_DECL_NOTHROW { return QFlags(QFlag(i & Int(other))); }
Q_DECL_CONSTEXPR inline QFlags operator~() const Q_DECL_NOTHROW { return QFlags(QFlag(~i)); }
Q_DECL_CONSTEXPR inline bool operator!() const Q_DECL_NOTHROW { return !i; }
- Q_DECL_CONSTEXPR inline bool testFlag(Enum f) const Q_DECL_NOTHROW { return (i & Int(f)) == Int(f) && (Int(f) != 0 || i == Int(f) ); }
- Q_DECL_RELAXED_CONSTEXPR inline QFlags &setFlag(Enum f, bool on = true) Q_DECL_NOTHROW
+ Q_DECL_CONSTEXPR inline bool testFlag(Enum flag) const Q_DECL_NOTHROW { return (i & Int(flag)) == Int(flag) && (Int(flag) != 0 || i == Int(flag) ); }
+ Q_DECL_RELAXED_CONSTEXPR inline QFlags &setFlag(Enum flag, bool on = true) Q_DECL_NOTHROW
{
- return on ? (*this |= f) : (*this &= ~Int(f));
+ return on ? (*this |= flag) : (*this &= ~Int(flag));
}
private:
diff --git a/src/corelib/global/qfloat16.cpp b/src/corelib/global/qfloat16.cpp
index 89edfc8787..3046a47292 100644
--- a/src/corelib/global/qfloat16.cpp
+++ b/src/corelib/global/qfloat16.cpp
@@ -38,6 +38,7 @@
****************************************************************************/
#include "qfloat16_p.h"
+#include "private/qsimd_p.h"
QT_BEGIN_NAMESPACE
@@ -113,4 +114,100 @@ Q_REQUIRED_RESULT bool qIsFinite(qfloat16 f) Q_DECL_NOTHROW { return qt_is_finit
exactness is stronger the smaller the numbers are.
*/
+#if QT_COMPILER_SUPPORTS(F16C)
+static inline bool hasFastF16()
+{
+ // All processors with F16C also support AVX, but YMM registers
+ // might not be supported by the OS, or they might be disabled.
+ return qCpuHasFeature(F16C) && qCpuHasFeature(AVX);
+}
+
+extern "C" {
+#ifdef QFLOAT16_INCLUDE_FAST
+# define f16cextern static
+#else
+# define f16cextern extern
+#endif
+
+f16cextern void qFloatToFloat16_fast(quint16 *out, const float *in, qsizetype len) Q_DECL_NOTHROW;
+f16cextern void qFloatFromFloat16_fast(float *out, const quint16 *in, qsizetype len) Q_DECL_NOTHROW;
+
+#undef f16cextern
+}
+
+#elif defined(__ARM_FP16_FORMAT_IEEE) && defined(__ARM_NEON__)
+static inline bool hasFastF16()
+{
+ return true;
+}
+
+static void qFloatToFloat16_fast(quint16 *out, const float *in, qsizetype len) Q_DECL_NOTHROW
+{
+ __fp16 *out_f16 = reinterpret_cast<__fp16 *>(out);
+ qsizetype i = 0;
+ for (; i < len - 3; i += 4)
+ vst1_f16(out_f16 + i, vcvt_f16_f32(vld1q_f32(in + i)));
+ SIMD_EPILOGUE(i, len, 3)
+ out_f16[i] = __fp16(in[i]);
+}
+
+static void qFloatFromFloat16_fast(float *out, const quint16 *in, qsizetype len) Q_DECL_NOTHROW
+{
+ const __fp16 *in_f16 = reinterpret_cast<const __fp16 *>(in);
+ qsizetype i = 0;
+ for (; i < len - 3; i += 4)
+ vst1q_f32(out + i, vcvt_f32_f16(vld1_f16(in_f16 + i)));
+ SIMD_EPILOGUE(i, len, 3)
+ out[i] = float(in_f16[i]);
+}
+#else
+static inline bool hasFastF16()
+{
+ return false;
+}
+
+static void qFloatToFloat16_fast(quint16 *, const float *, qsizetype) Q_DECL_NOTHROW
+{
+ Q_UNREACHABLE();
+}
+
+static void qFloatFromFloat16_fast(float *, const quint16 *, qsizetype) Q_DECL_NOTHROW
+{
+ Q_UNREACHABLE();
+}
+#endif
+/*!
+ \since 5.11
+
+ Converts \a len floats from \a in to qfloat16 and stores them in \a out.
+ Both \a in and \a out must have \a len allocated entries.
+*/
+Q_CORE_EXPORT void qFloatToFloat16(qfloat16 *out, const float *in, qsizetype len) Q_DECL_NOTHROW
+{
+ if (hasFastF16())
+ return qFloatToFloat16_fast(reinterpret_cast<quint16 *>(out), in, len);
+
+ for (qsizetype i = 0; i < len; ++i)
+ out[i] = qfloat16(in[i]);
+}
+
+/*!
+ \since 5.11
+
+ Converts \a len qfloat16 from \a in to floats and stores them in \a out.
+ Both \a in and \a out must have \a len allocated entries.
+*/
+Q_CORE_EXPORT void qFloatFromFloat16(float *out, const qfloat16 *in, qsizetype len) Q_DECL_NOTHROW
+{
+ if (hasFastF16())
+ return qFloatFromFloat16_fast(out, reinterpret_cast<const quint16 *>(in), len);
+
+ for (qsizetype i = 0; i < len; ++i)
+ out[i] = float(in[i]);
+}
+
QT_END_NAMESPACE
+
+#ifdef QFLOAT16_INCLUDE_FAST
+# include "qfloat16_f16c.c"
+#endif
diff --git a/src/corelib/global/qfloat16.h b/src/corelib/global/qfloat16.h
index 72e28edf63..a8befd7adb 100644
--- a/src/corelib/global/qfloat16.h
+++ b/src/corelib/global/qfloat16.h
@@ -88,6 +88,9 @@ private:
Q_DECLARE_TYPEINFO(qfloat16, Q_PRIMITIVE_TYPE);
+Q_CORE_EXPORT void qFloatToFloat16(qfloat16 *, const float *, qsizetype length) Q_DECL_NOTHROW;
+Q_CORE_EXPORT void qFloatFromFloat16(float *, const qfloat16 *, qsizetype length) Q_DECL_NOTHROW;
+
Q_REQUIRED_RESULT Q_CORE_EXPORT bool qIsInf(qfloat16 f) Q_DECL_NOTHROW; // complements qnumeric.h
Q_REQUIRED_RESULT Q_CORE_EXPORT bool qIsNaN(qfloat16 f) Q_DECL_NOTHROW; // complements qnumeric.h
Q_REQUIRED_RESULT Q_CORE_EXPORT bool qIsFinite(qfloat16 f) Q_DECL_NOTHROW; // complements qnumeric.h
diff --git a/src/corelib/global/qfloat16_f16c.c b/src/corelib/global/qfloat16_f16c.c
new file mode 100644
index 0000000000..31dff0b154
--- /dev/null
+++ b/src/corelib/global/qfloat16_f16c.c
@@ -0,0 +1,89 @@
+/****************************************************************************
+**
+** Copyright (C) 2017 The Qt Company Ltd.
+** Contact: https://www.qt.io/licensing/
+**
+** This file is part of the QtCore module of the Qt Toolkit.
+**
+** $QT_BEGIN_LICENSE:LGPL$
+** Commercial License Usage
+** Licensees holding valid commercial Qt licenses may use this file in
+** accordance with the commercial license agreement provided with the
+** Software or, alternatively, in accordance with the terms contained in
+** a written agreement between you and The Qt Company. For licensing terms
+** and conditions see https://www.qt.io/terms-conditions. For further
+** information use the contact form at https://www.qt.io/contact-us.
+**
+** GNU Lesser General Public License Usage
+** Alternatively, this file may be used under the terms of the GNU Lesser
+** General Public License version 3 as published by the Free Software
+** Foundation and appearing in the file LICENSE.LGPL3 included in the
+** packaging of this file. Please review the following information to
+** ensure the GNU Lesser General Public License version 3 requirements
+** will be met: https://www.gnu.org/licenses/lgpl-3.0.html.
+**
+** GNU General Public License Usage
+** Alternatively, this file may be used under the terms of the GNU
+** General Public License version 2.0 or (at your option) the GNU General
+** Public license version 3 or any later version approved by the KDE Free
+** Qt Foundation. The licenses are as published by the Free Software
+** Foundation and appearing in the file LICENSE.GPL2 and LICENSE.GPL3
+** included in the packaging of this file. Please review the following
+** information to ensure the GNU General Public License requirements will
+** be met: https://www.gnu.org/licenses/gpl-2.0.html and
+** https://www.gnu.org/licenses/gpl-3.0.html.
+**
+** $QT_END_LICENSE$
+**
+****************************************************************************/
+
+#include "private/qsimd_p.h"
+
+// The x86 F16C instructions operate on AVX registers, so AVX support is
+// required. We don't need to check for __F16C__ because we this file wouldn't
+// have been compiled if the support was missing in the first place, and not
+// all compilers define it. Technically, we didn't need to check for __AVX__
+// either.
+#if !QT_COMPILER_SUPPORTS_HERE(AVX)
+# error "AVX support required"
+#endif
+
+#ifdef __cplusplus
+QT_BEGIN_NAMESPACE
+extern "C" {
+#endif
+
+QT_FUNCTION_TARGET(F16C)
+void qFloatToFloat16_fast(quint16 *out, const float *in, qsizetype len) Q_DECL_NOTHROW
+{
+ qsizetype i = 0;
+ for (; i < len - 7; i += 8)
+ _mm_storeu_si128((__m128i *)(out + i), _mm256_cvtps_ph(_mm256_loadu_ps(in + i), 0));
+ if (i < len - 3) {
+ _mm_storel_epi64((__m128i *)(out + i), _mm_cvtps_ph(_mm_loadu_ps(in + i), 0));
+ i += 4;
+ }
+ // Inlining "qfloat16::qfloat16(float f)":
+ SIMD_EPILOGUE(i, len, 3)
+ out[i] = _mm_extract_epi16(_mm_cvtps_ph(_mm_set_ss(in[i]), 0), 0);
+}
+
+QT_FUNCTION_TARGET(F16C)
+void qFloatFromFloat16_fast(float *out, const quint16 *in, qsizetype len) Q_DECL_NOTHROW
+{
+ qsizetype i = 0;
+ for (; i < len - 7; i += 8)
+ _mm256_storeu_ps(out + i, _mm256_cvtph_ps(_mm_loadu_si128((const __m128i *)(in + i))));
+ if (i < len - 3) {
+ _mm_storeu_ps(out + i, _mm_cvtph_ps(_mm_loadl_epi64((const __m128i *)(in + i))));
+ i += 4;
+ }
+ // Inlining "qfloat16::operator float()":
+ SIMD_EPILOGUE(i, len, 3)
+ out[i] = _mm_cvtss_f32(_mm_cvtph_ps(_mm_cvtsi32_si128(in[i])));
+}
+
+#ifdef __cplusplus
+} // extern "C"
+QT_END_NAMESPACE
+#endif
diff --git a/src/corelib/global/qglobal.cpp b/src/corelib/global/qglobal.cpp
index 0444926df5..a8fa7654ba 100644
--- a/src/corelib/global/qglobal.cpp
+++ b/src/corelib/global/qglobal.cpp
@@ -1,7 +1,7 @@
/****************************************************************************
**
** Copyright (C) 2016 The Qt Company Ltd.
-** Copyright (C) 2016 Intel Corporation.
+** Copyright (C) 2017 Intel Corporation.
** Contact: https://www.qt.io/licensing/
**
** This file is part of the QtCore module of the Qt Toolkit.
@@ -76,6 +76,10 @@
#include <Ws2tcpip.h>
#endif // Q_OS_WINRT
+#ifdef Q_OS_WIN
+# include <qt_windows.h>
+#endif
+
#if defined(Q_OS_VXWORKS) && defined(_WRS_KERNEL)
# include <envLib.h>
#endif
@@ -181,28 +185,28 @@ Q_STATIC_ASSERT((std::is_same<qsizetype, qptrdiff>::value));
/*!
\fn QFlag::QFlag(int value)
- Constructs a QFlag object that stores the given \a value.
+ Constructs a QFlag object that stores the \a value.
*/
/*!
\fn QFlag::QFlag(uint value)
\since 5.3
- Constructs a QFlag object that stores the given \a value.
+ Constructs a QFlag object that stores the \a value.
*/
/*!
\fn QFlag::QFlag(short value)
\since 5.3
- Constructs a QFlag object that stores the given \a value.
+ Constructs a QFlag object that stores the \a value.
*/
/*!
\fn QFlag::QFlag(ushort value)
\since 5.3
- Constructs a QFlag object that stores the given \a value.
+ Constructs a QFlag object that stores the \a value.
*/
/*!
@@ -297,29 +301,28 @@ Q_STATIC_ASSERT((std::is_same<qsizetype, qptrdiff>::value));
*/
/*!
- \fn QFlags::QFlags(const QFlags &other)
+ \fn template<typename Enum> QFlags<Enum>::QFlags(const QFlags &other)
Constructs a copy of \a other.
*/
/*!
- \fn QFlags::QFlags(Enum flag)
+ \fn template <typename Enum> QFlags<Enum>::QFlags(Enum flags)
- Constructs a QFlags object storing the given \a flag.
+ Constructs a QFlags object storing the \a flags.
*/
/*!
- \fn QFlags::QFlags(Zero zero)
+ \fn template <typename Enum> QFlags<Enum>::QFlags(Zero)
- Constructs a QFlags object with no flags set. \a zero must be a
+ Constructs a QFlags object with no flags set. The parameter must be a
literal 0 value.
*/
/*!
- \fn QFlags::QFlags(QFlag value)
+ \fn template <typename Enum> QFlags<Enum>::QFlags(QFlag flag)
- Constructs a QFlags object initialized with the given integer \a
- value.
+ Constructs a QFlags object initialized with the integer \a flag.
The QFlag type is a helper type. By using it here instead of \c
int, we effectively ensure that arbitrary enum values cannot be
@@ -328,7 +331,7 @@ Q_STATIC_ASSERT((std::is_same<qsizetype, qptrdiff>::value));
*/
/*!
- \fn QFlags::QFlags(std::initializer_list<Enum> flags)
+ \fn template <typename Enum> QFlags<Enum>::QFlags(std::initializer_list<Enum> flags)
\since 5.4
Constructs a QFlags object initialized with all \a flags
@@ -338,14 +341,14 @@ Q_STATIC_ASSERT((std::is_same<qsizetype, qptrdiff>::value));
*/
/*!
- \fn QFlags &QFlags::operator=(const QFlags &other)
+ \fn template <typename Enum> QFlags &QFlags<Enum>::operator=(const QFlags &other)
Assigns \a other to this object and returns a reference to this
object.
*/
/*!
- \fn QFlags &QFlags::operator&=(int mask)
+ \fn template <typename Enum> QFlags &QFlags<Enum>::operator&=(int mask)
Performs a bitwise AND operation with \a mask and stores the
result in this QFlags object. Returns a reference to this object.
@@ -354,19 +357,19 @@ Q_STATIC_ASSERT((std::is_same<qsizetype, qptrdiff>::value));
*/
/*!
- \fn QFlags &QFlags::operator&=(uint mask)
+ \fn template <typename Enum> QFlags &QFlags<Enum>::operator&=(uint mask)
\overload
*/
/*!
- \fn QFlags &QFlags::operator&=(Enum mask)
+ \fn template <typename Enum> QFlags &QFlags<Enum>::operator&=(Enum mask)
\overload
*/
/*!
- \fn QFlags &QFlags::operator|=(QFlags other)
+ \fn template <typename Enum> QFlags &QFlags<Enum>::operator|=(QFlags other)
Performs a bitwise OR operation with \a other and stores the
result in this QFlags object. Returns a reference to this object.
@@ -375,13 +378,13 @@ Q_STATIC_ASSERT((std::is_same<qsizetype, qptrdiff>::value));
*/
/*!
- \fn QFlags &QFlags::operator|=(Enum other)
+ \fn template <typename Enum> QFlags &QFlags<Enum>::operator|=(Enum other)
\overload
*/
/*!
- \fn QFlags &QFlags::operator^=(QFlags other)
+ \fn template <typename Enum> QFlags &QFlags<Enum>::operator^=(QFlags other)
Performs a bitwise XOR operation with \a other and stores the
result in this QFlags object. Returns a reference to this object.
@@ -390,13 +393,13 @@ Q_STATIC_ASSERT((std::is_same<qsizetype, qptrdiff>::value));
*/
/*!
- \fn QFlags &QFlags::operator^=(Enum other)
+ \fn template <typename Enum> QFlags &QFlags<Enum>::operator^=(Enum other)
\overload
*/
/*!
- \fn QFlags::operator Int() const
+ \fn template <typename Enum> QFlags<Enum>::operator Int() const
Returns the value stored in the QFlags object as an integer.
@@ -404,7 +407,7 @@ Q_STATIC_ASSERT((std::is_same<qsizetype, qptrdiff>::value));
*/
/*!
- \fn QFlags QFlags::operator|(QFlags other) const
+ \fn template <typename Enum> QFlags QFlags<Enum>::operator|(QFlags other) const
Returns a QFlags object containing the result of the bitwise OR
operation on this object and \a other.
@@ -413,13 +416,13 @@ Q_STATIC_ASSERT((std::is_same<qsizetype, qptrdiff>::value));
*/
/*!
- \fn QFlags QFlags::operator|(Enum other) const
+ \fn template <typename Enum> QFlags QFlags<Enum>::operator|(Enum other) const
\overload
*/
/*!
- \fn QFlags QFlags::operator^(QFlags other) const
+ \fn template <typename Enum> QFlags QFlags<Enum>::operator^(QFlags other) const
Returns a QFlags object containing the result of the bitwise XOR
operation on this object and \a other.
@@ -428,13 +431,13 @@ Q_STATIC_ASSERT((std::is_same<qsizetype, qptrdiff>::value));
*/
/*!
- \fn QFlags QFlags::operator^(Enum other) const
+ \fn template <typename Enum> QFlags QFlags<Enum>::operator^(Enum other) const
\overload
*/
/*!
- \fn QFlags QFlags::operator&(int mask) const
+ \fn template <typename Enum> QFlags QFlags<Enum>::operator&(int mask) const
Returns a QFlags object containing the result of the bitwise AND
operation on this object and \a mask.
@@ -443,19 +446,19 @@ Q_STATIC_ASSERT((std::is_same<qsizetype, qptrdiff>::value));
*/
/*!
- \fn QFlags QFlags::operator&(uint mask) const
+ \fn template <typename Enum> QFlags QFlags<Enum>::operator&(uint mask) const
\overload
*/
/*!
- \fn QFlags QFlags::operator&(Enum mask) const
+ \fn template <typename Enum> QFlags QFlags<Enum>::operator&(Enum mask) const
\overload
*/
/*!
- \fn QFlags QFlags::operator~() const
+ \fn template <typename Enum> QFlags QFlags<Enum>::operator~() const
Returns a QFlags object that contains the bitwise negation of
this object.
@@ -464,24 +467,24 @@ Q_STATIC_ASSERT((std::is_same<qsizetype, qptrdiff>::value));
*/
/*!
- \fn bool QFlags::operator!() const
+ \fn template <typename Enum> bool QFlags<Enum>::operator!() const
Returns \c true if no flag is set (i.e., if the value stored by the
QFlags object is 0); otherwise returns \c false.
*/
/*!
- \fn bool QFlags::testFlag(Enum flag) const
+ \fn template <typename Enum> bool QFlags<Enum>::testFlag(Enum flag) const
\since 4.2
- Returns \c true if the \a flag is set, otherwise \c false.
+ Returns \c true if the flag \a flag is set, otherwise \c false.
*/
/*!
- \fn QFlags QFlags::setFlag(Enum flag, bool on)
+ \fn template <typename Enum> QFlags QFlags<Enum>::setFlag(Enum flag, bool on)
\since 5.7
- Sets the indicated \a flag if \a on is \c true or unsets it if
+ Sets the flag \a flag if \a on is \c true or unsets it if
\a on is \c false. Returns a reference to this object.
*/
@@ -919,11 +922,11 @@ Q_STATIC_ASSERT((std::is_same<qsizetype, qptrdiff>::value));
\sa quint64, qlonglong
*/
-/*! \fn T qAbs(const T &value)
+/*! \fn template <typename T> T qAbs(const T &t)
\relates <QtGlobal>
- Compares \a value to the 0 of type T and returns the absolute
- value. Thus if T is \e {double}, then \a value is compared to
+ Compares \a t to the 0 of type T and returns the absolute
+ value. Thus if T is \e {double}, then \a t is compared to
\e{(double) 0}.
Example:
@@ -931,50 +934,50 @@ Q_STATIC_ASSERT((std::is_same<qsizetype, qptrdiff>::value));
\snippet code/src_corelib_global_qglobal.cpp 10
*/
-/*! \fn int qRound(double value)
+/*! \fn int qRound(double d)
\relates <QtGlobal>
- Rounds \a value to the nearest integer.
+ Rounds \a d to the nearest integer.
Example:
\snippet code/src_corelib_global_qglobal.cpp 11A
*/
-/*! \fn int qRound(float value)
+/*! \fn int qRound(float d)
\relates <QtGlobal>
- Rounds \a value to the nearest integer.
+ Rounds \a d to the nearest integer.
Example:
\snippet code/src_corelib_global_qglobal.cpp 11B
*/
-/*! \fn qint64 qRound64(double value)
+/*! \fn qint64 qRound64(double d)
\relates <QtGlobal>
- Rounds \a value to the nearest 64-bit integer.
+ Rounds \a d to the nearest 64-bit integer.
Example:
\snippet code/src_corelib_global_qglobal.cpp 12A
*/
-/*! \fn qint64 qRound64(float value)
+/*! \fn qint64 qRound64(float d)
\relates <QtGlobal>
- Rounds \a value to the nearest 64-bit integer.
+ Rounds \a d to the nearest 64-bit integer.
Example:
\snippet code/src_corelib_global_qglobal.cpp 12B
*/
-/*! \fn const T &qMin(const T &value1, const T &value2)
+/*! \fn template <typename T> const T &qMin(const T &a, const T &b)
\relates <QtGlobal>
- Returns the minimum of \a value1 and \a value2.
+ Returns the minimum of \a a and \a b.
Example:
@@ -983,10 +986,10 @@ Q_STATIC_ASSERT((std::is_same<qsizetype, qptrdiff>::value));
\sa qMax(), qBound()
*/
-/*! \fn const T &qMax(const T &value1, const T &value2)
+/*! \fn template <typename T> const T &qMax(const T &a, const T &b)
\relates <QtGlobal>
- Returns the maximum of \a value1 and \a value2.
+ Returns the maximum of \a a and \a b.
Example:
@@ -995,11 +998,11 @@ Q_STATIC_ASSERT((std::is_same<qsizetype, qptrdiff>::value));
\sa qMin(), qBound()
*/
-/*! \fn const T &qBound(const T &min, const T &value, const T &max)
+/*! \fn template <typename T> const T &qBound(const T &min, const T &val, const T &max)
\relates <QtGlobal>
- Returns \a value bounded by \a min and \a max. This is equivalent
- to qMax(\a min, qMin(\a value, \a max)).
+ Returns \a val bounded by \a min and \a max. This is equivalent
+ to qMax(\a min, qMin(\a val, \a max)).
Example:
@@ -1008,7 +1011,7 @@ Q_STATIC_ASSERT((std::is_same<qsizetype, qptrdiff>::value));
\sa qMin(), qMax()
*/
-/*! \fn auto qOverload(T functionPointer)
+/*! \fn template <typename T> auto qOverload(T functionPointer)
\relates <QtGlobal>
\since 5.7
@@ -1030,7 +1033,7 @@ Q_STATIC_ASSERT((std::is_same<qsizetype, qptrdiff>::value));
and Functor-Based Connections}
*/
-/*! \fn auto qConstOverload(T memberFunctionPointer)
+/*! \fn template <typename T> auto qConstOverload(T memberFunctionPointer)
\relates <QtGlobal>
\since 5.7
@@ -1042,7 +1045,7 @@ Q_STATIC_ASSERT((std::is_same<qsizetype, qptrdiff>::value));
and Functor-Based Connections}
*/
-/*! \fn auto qNonConstOverload(T memberFunctionPointer)
+/*! \fn template <typename T> auto qNonConstOverload(T memberFunctionPointer)
\relates <QtGlobal>
\since 5.7
@@ -1431,13 +1434,6 @@ bool qSharedBuild() Q_DECL_NOTHROW
*/
/*!
- \macro Q_OS_ULTRIX
- \relates <QtGlobal>
-
- Defined on DEC Ultrix.
-*/
-
-/*!
\macro Q_OS_LINUX
\relates <QtGlobal>
@@ -1473,41 +1469,6 @@ bool qSharedBuild() Q_DECL_NOTHROW
*/
/*!
- \macro Q_OS_BSDI
- \relates <QtGlobal>
-
- Defined on BSD/OS.
-*/
-
-/*!
- \macro Q_OS_IRIX
- \relates <QtGlobal>
-
- Defined on SGI Irix.
-*/
-
-/*!
- \macro Q_OS_OSF
- \relates <QtGlobal>
-
- Defined on HP Tru64 UNIX.
-*/
-
-/*!
- \macro Q_OS_SCO
- \relates <QtGlobal>
-
- Defined on SCO OpenServer 5.
-*/
-
-/*!
- \macro Q_OS_UNIXWARE
- \relates <QtGlobal>
-
- Defined on UnixWare 7, Open UNIX 8.
-*/
-
-/*!
\macro Q_OS_AIX
\relates <QtGlobal>
@@ -1522,27 +1483,6 @@ bool qSharedBuild() Q_DECL_NOTHROW
*/
/*!
- \macro Q_OS_DGUX
- \relates <QtGlobal>
-
- Defined on DG/UX.
-*/
-
-/*!
- \macro Q_OS_RELIANT
- \relates <QtGlobal>
-
- Defined on Reliant UNIX.
-*/
-
-/*!
- \macro Q_OS_DYNIX
- \relates <QtGlobal>
-
- Defined on DYNIX/ptx.
-*/
-
-/*!
\macro Q_OS_QNX
\relates <QtGlobal>
@@ -2884,10 +2824,11 @@ QString QSysInfo::prettyProductName()
This function returns the same as QHostInfo::localHostName().
- \sa QHostInfo::localDomainName
+ \sa QHostInfo::localDomainName, machineUniqueId()
*/
QString QSysInfo::machineHostName()
{
+ // the hostname can change, so we can't cache it
#if defined(Q_OS_LINUX)
// gethostname(3) on Linux just calls uname(2), so do it ourselves
// and avoid a memcpy
@@ -2910,6 +2851,119 @@ QString QSysInfo::machineHostName()
}
#endif // QT_BOOTSTRAPPED
+enum {
+ UuidStringLen = sizeof("00000000-0000-0000-0000-000000000000") - 1
+};
+
+/*!
+ \since 5.10
+
+ Returns a unique ID for this machine, if one can be determined. If no
+ unique ID could be determined, this function returns an empty byte array.
+ Unlike machineHostName(), the value returned by this function is likely
+ globally unique.
+
+ A unique ID is useful in network operations to identify this machine for an
+ extended period of time, when the IP address could change or if this
+ machine could have more than one IP address. For example, the ID could be
+ used when communicating with a server or when storing device-specific data
+ in shared network storage.
+
+ Note that on some systems, this value will persist across reboots and on
+ some it will not. Applications should not blindly depend on this fact
+ without verifying the OS capabilities. In particular, on Linux systems,
+ this ID is usually permanent and it matches the D-Bus machine ID, except
+ for nodes without their own storage (replicated nodes).
+
+ \sa machineHostName(), bootUniqueId()
+*/
+QByteArray QSysInfo::machineUniqueId()
+{
+#ifdef Q_OS_BSD4
+ char uuid[UuidStringLen];
+ size_t uuidlen = sizeof(uuid);
+# ifdef KERN_HOSTUUID
+ int name[] = { CTL_KERN, KERN_HOSTUUID };
+ if (sysctl(name, sizeof name / sizeof name[0], &uuid, &uuidlen, nullptr, 0) == 0
+ && uuidlen == sizeof(uuid))
+ return QByteArray(uuid, uuidlen);
+
+# else
+ // Darwin: no fixed value, we need to search by name
+ if (sysctlbyname("kern.uuid", uuid, &uuidlen, nullptr, 0) == 0 && uuidlen == sizeof(uuid))
+ return QByteArray(uuid, uuidlen);
+# endif
+#elif defined(Q_OS_UNIX)
+ // The modern name on Linux is /etc/machine-id, but that path is
+ // unlikely to exist on non-Linux (non-systemd) systems. The old
+ // path is more than enough.
+ static const char fullfilename[] = "/usr/local/var/lib/dbus/machine-id";
+ const char *firstfilename = fullfilename + sizeof("/usr/local") - 1;
+ int fd = qt_safe_open(firstfilename, O_RDONLY);
+ if (fd == -1 && errno == ENOENT)
+ fd = qt_safe_open(fullfilename, O_RDONLY);
+
+ if (fd != -1) {
+ char buffer[32]; // 128 bits, hex-encoded
+ qint64 len = qt_safe_read(fd, buffer, sizeof(buffer));
+ qt_safe_close(fd);
+
+ if (len != -1)
+ return QByteArray(buffer, len);
+ }
+#elif defined(Q_OS_WIN) && !defined(Q_OS_WINRT)
+ // Let's poke at the registry
+ HKEY key = NULL;
+ if (RegOpenKeyEx(HKEY_LOCAL_MACHINE, L"SOFTWARE\\Microsoft\\Cryptography", 0, KEY_READ, &key)
+ == ERROR_SUCCESS) {
+ wchar_t buffer[UuidStringLen + 1];
+ DWORD size = sizeof(buffer);
+ bool ok = (RegQueryValueEx(key, L"MachineGuid", NULL, NULL, (LPBYTE)buffer, &size) ==
+ ERROR_SUCCESS);
+ RegCloseKey(key);
+ if (ok)
+ return QStringView(buffer, (size - 1) / 2).toLatin1();
+ }
+#endif
+ return QByteArray();
+}
+
+/*!
+ \since 5.10
+
+ Returns a unique ID for this machine's boot, if one can be determined. If
+ no unique ID could be determined, this function returns an empty byte
+ array. This value is expected to change after every boot and can be
+ considered globally unique.
+
+ This function is currently only implemented for Linux and Apple operating
+ systems.
+
+ \sa machineUniqueId()
+*/
+QByteArray QSysInfo::bootUniqueId()
+{
+#ifdef Q_OS_LINUX
+ // use low-level API here for simplicity
+ int fd = qt_safe_open("/proc/sys/kernel/random/boot_id", O_RDONLY);
+ if (fd != -1) {
+ char uuid[UuidStringLen];
+ qint64 len = qt_safe_read(fd, uuid, sizeof(uuid));
+ qt_safe_close(fd);
+ if (len == UuidStringLen)
+ return QByteArray(uuid, UuidStringLen);
+ }
+#elif defined(Q_OS_DARWIN)
+ // "kern.bootsessionuuid" is only available by name
+ char uuid[UuidStringLen];
+ size_t uuidlen = sizeof(uuid);
+ if (sysctlbyname("kern.bootsessionuuid", uuid, &uuidlen, nullptr, 0) == 0
+ && uuidlen == sizeof(uuid))
+ return QByteArray(uuid, uuidlen);
+#endif
+ return QByteArray();
+};
+
/*!
\macro void Q_ASSERT(bool test)
\relates <QtGlobal>
@@ -3053,10 +3107,10 @@ QString QSysInfo::machineHostName()
*/
/*!
- \fn T *q_check_ptr(T *pointer)
+ \fn template <typename T> T *q_check_ptr(T *p)
\relates <QtGlobal>
- Uses Q_CHECK_PTR on \a pointer, then returns \a pointer.
+ Uses Q_CHECK_PTR on \a p, then returns \a p.
This can be used as an inline version of Q_CHECK_PTR.
*/
@@ -3551,7 +3605,7 @@ bool qunsetenv(const char *varName)
*/
/*!
- \fn qAsConst(T &t)
+ \fn template <typename T> qAsConst(T &t)
\relates <QtGlobal>
\since 5.7
@@ -3603,7 +3657,7 @@ bool qunsetenv(const char *varName)
*/
/*!
- \fn qAsConst(const T &&t)
+ \fn template <typename T> qAsConst(const T &&t)
\relates <QtGlobal>
\since 5.7
\overload
@@ -4015,43 +4069,6 @@ bool QInternal::activateCallbacks(Callback cb, void **parameters)
*/
/*!
- \macro Q_GLOBAL_STATIC(type, name)
- \internal
-
- Declares a global static variable with the given \a type and \a name.
-
- Use this macro to instantiate an object in a thread-safe way, creating
- a global pointer that can be used to refer to it.
-
- \warning This macro is subject to a race condition that can cause the object
- to be constructed twice. However, if this occurs, the second instance will
- be immediately deleted.
-
- See also
- \l{http://www.aristeia.com/publications.html}{"C++ and the perils of Double-Checked Locking"}
- by Scott Meyers and Andrei Alexandrescu.
-*/
-
-/*!
- \macro Q_GLOBAL_STATIC_WITH_ARGS(type, name, arguments)
- \internal
-
- Declares a global static variable with the specified \a type and \a name.
-
- Use this macro to instantiate an object using the \a arguments specified
- in a thread-safe way, creating a global pointer that can be used to refer
- to it.
-
- \warning This macro is subject to a race condition that can cause the object
- to be constructed twice. However, if this occurs, the second instance will
- be immediately deleted.
-
- See also
- \l{http://www.aristeia.com/publications.html}{"C++ and the perils of Double-Checked Locking"}
- by Scott Meyers and Andrei Alexandrescu.
-*/
-
-/*!
\macro QT_NAMESPACE
\internal
diff --git a/src/corelib/global/qglobal.h b/src/corelib/global/qglobal.h
index 4e7c1b59be..7873ab2b43 100644
--- a/src/corelib/global/qglobal.h
+++ b/src/corelib/global/qglobal.h
@@ -47,6 +47,7 @@
# include <utility>
#endif
#ifndef __ASSEMBLER__
+# include <assert.h>
# include <stddef.h>
#endif
@@ -105,6 +106,32 @@
# define Q_OF_MACH_O
#endif
+/*
+ Avoid "unused parameter" warnings
+*/
+#define Q_UNUSED(x) (void)x;
+
+#if defined(__cplusplus) && defined(Q_COMPILER_STATIC_ASSERT)
+# define Q_STATIC_ASSERT(Condition) static_assert(bool(Condition), #Condition)
+# define Q_STATIC_ASSERT_X(Condition, Message) static_assert(bool(Condition), Message)
+#elif defined(Q_COMPILER_STATIC_ASSERT)
+// C11 mode - using the _S version in case <assert.h> doesn't do the right thing
+# define Q_STATIC_ASSERT(Condition) _Static_assert(!!(Condition), #Condition)
+# define Q_STATIC_ASSERT_X(Condition, Message) _Static_assert(!!(Condition), Message)
+#else
+// C89 & C99 version
+# define Q_STATIC_ASSERT_PRIVATE_JOIN(A, B) Q_STATIC_ASSERT_PRIVATE_JOIN_IMPL(A, B)
+# define Q_STATIC_ASSERT_PRIVATE_JOIN_IMPL(A, B) A ## B
+# ifdef __COUNTER__
+# define Q_STATIC_ASSERT(Condition) \
+ typedef char Q_STATIC_ASSERT_PRIVATE_JOIN(q_static_assert_result, __COUNTER__) [(Condition) ? 1 : -1];
+# else
+# define Q_STATIC_ASSERT(Condition) \
+ typedef char Q_STATIC_ASSERT_PRIVATE_JOIN(q_static_assert_result, __LINE__) [(Condition) ? 1 : -1];
+# endif /* __COUNTER__ */
+# define Q_STATIC_ASSERT_X(Condition, Message) Q_STATIC_ASSERT(Condition)
+#endif
+
#ifdef __cplusplus
#include <algorithm>
@@ -219,6 +246,15 @@ typedef unsigned long long quint64; /* 64 bit unsigned */
typedef qint64 qlonglong;
typedef quint64 qulonglong;
+#ifndef __cplusplus
+// In C++ mode, we define below using QIntegerForSize template
+Q_STATIC_ASSERT_X(sizeof(ptrdiff_t) == sizeof(size_t), "Weird ptrdiff_t and size_t definitions");
+typedef ptrdiff_t qptrdiff;
+typedef ptrdiff_t qsizetype;
+typedef ptrdiff_t qintptr;
+typedef size_t quintptr;
+#endif
+
/*
Useful type definitions for Qt
*/
@@ -670,7 +706,7 @@ inline void qt_noop(void) {}
# define QT_CATCH(A) catch (A)
# define QT_THROW(A) throw A
# define QT_RETHROW throw
-Q_NORETURN Q_CORE_EXPORT void qTerminate() Q_DECL_NOTHROW;
+Q_NORETURN Q_DECL_COLD_FUNCTION Q_CORE_EXPORT void qTerminate() Q_DECL_NOTHROW;
# ifdef Q_COMPILER_NOEXCEPT
# define QT_TERMINATE_ON_EXCEPTION(expr) do { expr; } while (false)
# else
@@ -688,11 +724,6 @@ Q_CORE_EXPORT Q_DECL_CONST_FUNCTION bool qSharedBuild() Q_DECL_NOTHROW;
#endif
/*
- Avoid "unused parameter" warnings
-*/
-#define Q_UNUSED(x) (void)x;
-
-/*
Debugging and error handling
*/
@@ -718,11 +749,13 @@ Q_CORE_EXPORT Q_DECL_CONST_FUNCTION bool qSharedBuild() Q_DECL_NOTHROW;
#endif
class QString;
+Q_DECL_COLD_FUNCTION
Q_CORE_EXPORT QString qt_error_string(int errorCode = -1);
#ifndef Q_CC_MSVC
Q_NORETURN
#endif
+Q_DECL_COLD_FUNCTION
Q_CORE_EXPORT void qt_assert(const char *assertion, const char *file, int line) Q_DECL_NOTHROW;
#if !defined(Q_ASSERT)
@@ -740,6 +773,7 @@ Q_CORE_EXPORT void qt_assert(const char *assertion, const char *file, int line)
#ifndef Q_CC_MSVC
Q_NORETURN
#endif
+Q_DECL_COLD_FUNCTION
Q_CORE_EXPORT void qt_assert_x(const char *where, const char *what, const char *file, int line) Q_DECL_NOTHROW;
#if !defined(Q_ASSERT_X)
@@ -750,28 +784,8 @@ Q_CORE_EXPORT void qt_assert_x(const char *where, const char *what, const char *
# endif
#endif
-
-#ifdef Q_COMPILER_STATIC_ASSERT
-#define Q_STATIC_ASSERT(Condition) static_assert(bool(Condition), #Condition)
-#define Q_STATIC_ASSERT_X(Condition, Message) static_assert(bool(Condition), Message)
-#else
-// Intentionally undefined
-template <bool Test> class QStaticAssertFailure;
-template <> class QStaticAssertFailure<true> {};
-
-#define Q_STATIC_ASSERT_PRIVATE_JOIN(A, B) Q_STATIC_ASSERT_PRIVATE_JOIN_IMPL(A, B)
-#define Q_STATIC_ASSERT_PRIVATE_JOIN_IMPL(A, B) A ## B
-#ifdef __COUNTER__
-#define Q_STATIC_ASSERT(Condition) \
- enum {Q_STATIC_ASSERT_PRIVATE_JOIN(q_static_assert_result, __COUNTER__) = sizeof(QStaticAssertFailure<!!(Condition)>)}
-#else
-#define Q_STATIC_ASSERT(Condition) \
- enum {Q_STATIC_ASSERT_PRIVATE_JOIN(q_static_assert_result, __LINE__) = sizeof(QStaticAssertFailure<!!(Condition)>)}
-#endif /* __COUNTER__ */
-#define Q_STATIC_ASSERT_X(Condition, Message) Q_STATIC_ASSERT(Condition)
-#endif
-
Q_NORETURN Q_CORE_EXPORT void qt_check_pointer(const char *, int) Q_DECL_NOTHROW;
+Q_DECL_COLD_FUNCTION
Q_CORE_EXPORT void qBadAlloc();
#ifdef QT_NO_EXCEPTIONS
@@ -1138,7 +1152,7 @@ Q_CORE_EXPORT bool qunsetenv(const char *varName);
Q_CORE_EXPORT bool qEnvironmentVariableIsEmpty(const char *varName) Q_DECL_NOEXCEPT;
Q_CORE_EXPORT bool qEnvironmentVariableIsSet(const char *varName) Q_DECL_NOEXCEPT;
-Q_CORE_EXPORT int qEnvironmentVariableIntValue(const char *varName, bool *ok=Q_NULLPTR) Q_DECL_NOEXCEPT;
+Q_CORE_EXPORT int qEnvironmentVariableIntValue(const char *varName, bool *ok=nullptr) Q_DECL_NOEXCEPT;
inline int qIntCast(double f) { return int(f); }
inline int qIntCast(float f) { return int(f); }
diff --git a/src/corelib/global/qglobalstatic.qdoc b/src/corelib/global/qglobalstatic.qdoc
index 8c34739d38..63cc968d1c 100644
--- a/src/corelib/global/qglobalstatic.qdoc
+++ b/src/corelib/global/qglobalstatic.qdoc
@@ -368,7 +368,7 @@
*/
/*!
- \fn bool QGlobalStatic::isDestroyed() const
+ \fn template <typename T, T *(&innerFunction)(), QBasicAtomicInt &guard> bool QGlobalStatic<T, innerFunction, guard>::isDestroyed() const
This function returns \c true if the global static object has already
completed destruction (that is, if the destructor for the type has already
@@ -398,7 +398,7 @@
*/
/*!
- \fn bool QGlobalStatic::exists() const
+ \fn template <typename T, T *(&innerFunction)(), QBasicAtomicInt &guard> bool QGlobalStatic<T, innerFunction, guard>::exists() const
This function returns \c true if the global static object has already
completed initialization (that is, if the constructor for the type has
@@ -447,7 +447,7 @@
*/
/*!
- \fn QGlobalStatic::operator Type*()
+ \fn template <typename T, T *(&innerFunction)(), QBasicAtomicInt &guard> QGlobalStatic<T, innerFunction, guard>::operator Type*()
This function returns the address of the contents of this global static. If
the contents have not yet been created, they will be created thread-safely
@@ -480,7 +480,7 @@
*/
/*!
- \fn Type *QGlobalStatic::operator()()
+ \fn template <typename T, T *(&innerFunction)(), QBasicAtomicInt &guard> Type *QGlobalStatic<T, innerFunction, guard>::operator()()
\deprecated
This function returns the address of the contents of this global static. If
@@ -495,7 +495,7 @@
*/
/*!
- \fn Type *QGlobalStatic::operator->()
+ \fn template <typename T, T *(&innerFunction)(), QBasicAtomicInt &guard> Type *QGlobalStatic<T, innerFunction, guard>::operator->()
This function returns the address of the contents of this global static. If
the contents have not yet been created, they will be created thread-safely
@@ -508,7 +508,7 @@
*/
/*!
- \fn Type &QGlobalStatic::operator*()
+ \fn template <typename T, T *(&innerFunction)(), QBasicAtomicInt &guard> Type &QGlobalStatic<T, innerFunction, guard>::operator*()
This function returns a reference to the contents of this global static. If
the contents have not yet been created, they will be created thread-safely
diff --git a/src/corelib/global/qlogging.h b/src/corelib/global/qlogging.h
index ec21198784..16e01183bd 100644
--- a/src/corelib/global/qlogging.h
+++ b/src/corelib/global/qlogging.h
@@ -64,7 +64,7 @@ class QMessageLogContext
Q_DISABLE_COPY(QMessageLogContext)
public:
Q_DECL_CONSTEXPR QMessageLogContext()
- : version(2), line(0), file(Q_NULLPTR), function(Q_NULLPTR), category(Q_NULLPTR) {}
+ : version(2), line(0), file(nullptr), function(nullptr), category(nullptr) {}
Q_DECL_CONSTEXPR QMessageLogContext(const char *fileName, int lineNumber, const char *functionName, const char *categoryName)
: version(2), line(lineNumber), file(fileName), function(functionName), category(categoryName) {}
@@ -97,7 +97,9 @@ public:
void noDebug(const char *, ...) const Q_ATTRIBUTE_FORMAT_PRINTF(2, 3)
{}
void info(const char *msg, ...) const Q_ATTRIBUTE_FORMAT_PRINTF(2, 3);
+ Q_DECL_COLD_FUNCTION
void warning(const char *msg, ...) const Q_ATTRIBUTE_FORMAT_PRINTF(2, 3);
+ Q_DECL_COLD_FUNCTION
void critical(const char *msg, ...) const Q_ATTRIBUTE_FORMAT_PRINTF(2, 3);
typedef const QLoggingCategory &(*CategoryFunction)();
@@ -106,14 +108,19 @@ public:
void debug(CategoryFunction catFunc, const char *msg, ...) const Q_ATTRIBUTE_FORMAT_PRINTF(3, 4);
void info(const QLoggingCategory &cat, const char *msg, ...) const Q_ATTRIBUTE_FORMAT_PRINTF(3, 4);
void info(CategoryFunction catFunc, const char *msg, ...) const Q_ATTRIBUTE_FORMAT_PRINTF(3, 4);
+ Q_DECL_COLD_FUNCTION
void warning(const QLoggingCategory &cat, const char *msg, ...) const Q_ATTRIBUTE_FORMAT_PRINTF(3, 4);
+ Q_DECL_COLD_FUNCTION
void warning(CategoryFunction catFunc, const char *msg, ...) const Q_ATTRIBUTE_FORMAT_PRINTF(3, 4);
+ Q_DECL_COLD_FUNCTION
void critical(const QLoggingCategory &cat, const char *msg, ...) const Q_ATTRIBUTE_FORMAT_PRINTF(3, 4);
+ Q_DECL_COLD_FUNCTION
void critical(CategoryFunction catFunc, const char *msg, ...) const Q_ATTRIBUTE_FORMAT_PRINTF(3, 4);
#ifndef Q_CC_MSVC
Q_NORETURN
#endif
+ Q_DECL_COLD_FUNCTION
void fatal(const char *msg, ...) const Q_DECL_NOTHROW Q_ATTRIBUTE_FORMAT_PRINTF(2, 3);
#ifndef QT_NO_DEBUG_STREAM
@@ -150,9 +157,9 @@ private:
#define QT_MESSAGELOG_LINE __LINE__
#define QT_MESSAGELOG_FUNC Q_FUNC_INFO
#else
- #define QT_MESSAGELOG_FILE Q_NULLPTR
+ #define QT_MESSAGELOG_FILE nullptr
#define QT_MESSAGELOG_LINE 0
- #define QT_MESSAGELOG_FUNC Q_NULLPTR
+ #define QT_MESSAGELOG_FUNC nullptr
#endif
#define qDebug QMessageLogger(QT_MESSAGELOG_FILE, QT_MESSAGELOG_LINE, QT_MESSAGELOG_FUNC).debug
@@ -179,8 +186,8 @@ private:
Q_CORE_EXPORT void qt_message_output(QtMsgType, const QMessageLogContext &context,
const QString &message);
-Q_CORE_EXPORT void qErrnoWarning(int code, const char *msg, ...);
-Q_CORE_EXPORT void qErrnoWarning(const char *msg, ...);
+Q_CORE_EXPORT Q_DECL_COLD_FUNCTION void qErrnoWarning(int code, const char *msg, ...);
+Q_CORE_EXPORT Q_DECL_COLD_FUNCTION void qErrnoWarning(const char *msg, ...);
#if QT_DEPRECATED_SINCE(5, 0)// deprecated. Use qInstallMessageHandler instead!
typedef void (*QtMsgHandler)(QtMsgType, const char *);
diff --git a/src/corelib/global/qnamespace.h b/src/corelib/global/qnamespace.h
index 2a8345195d..2773992b47 100644
--- a/src/corelib/global/qnamespace.h
+++ b/src/corelib/global/qnamespace.h
@@ -243,7 +243,7 @@ public:
// size of a multi-variant string.
TextLongestVariant = 0x80000
-#if QT_VERSION < QT_VERSION_CHECK(6, 0, 0)
+#if QT_DEPRECATED_SINCE(5, 11) && QT_VERSION < QT_VERSION_CHECK(6, 0, 0)
, TextBypassShaping = 0x100000
#endif
};
diff --git a/src/corelib/global/qnamespace.qdoc b/src/corelib/global/qnamespace.qdoc
index e64fb221d3..c53db50e71 100644
--- a/src/corelib/global/qnamespace.qdoc
+++ b/src/corelib/global/qnamespace.qdoc
@@ -3077,9 +3077,8 @@
it is displayed regardless of device type.
The keypad is used to implement a virtual cursor, unless
the device has an analog mouse type of input device (e.g. touchpad)
-
- \note In 4.6, cursor navigation is only implemented for Symbian OS.
- On other platforms, it behaves as NavigationModeNone.
+ \note Cursor navigation is not currently implemented on any platform
+ and behaves as NavigationModeNone.
\sa QApplication::setNavigationMode()
\sa QApplication::navigationMode()
*/
diff --git a/src/corelib/global/qnumeric_p.h b/src/corelib/global/qnumeric_p.h
index 37eddfa9b5..dd249f8cc8 100644
--- a/src/corelib/global/qnumeric_p.h
+++ b/src/corelib/global/qnumeric_p.h
@@ -163,6 +163,7 @@ Q_DECL_CONST_FUNCTION static inline bool qt_is_finite(float f)
return qnumeric_std_wrapper::isfinite(f);
}
+#ifndef Q_CLANG_QDOC
//
// Unsigned overflow math
//
@@ -355,7 +356,7 @@ inline bool mul_overflow(int v1, int v2, int *r)
return t > std::numeric_limits<int>::max() || t < std::numeric_limits<int>::min();
}
#endif
-
+#endif // Q_CLANG_QDOC
}
QT_END_NAMESPACE
diff --git a/src/corelib/global/qrandom.cpp b/src/corelib/global/qrandom.cpp
index 0ee6ac9f38..f5c01aeaa6 100644
--- a/src/corelib/global/qrandom.cpp
+++ b/src/corelib/global/qrandom.cpp
@@ -1285,20 +1285,56 @@ void QRandomGenerator::_fillRange(void *buffer, void *bufferEnd)
std::generate(begin, end, [this]() { return storage.engine()(); });
}
-#if defined(Q_OS_ANDROID) && (__ANDROID_API__ < 21)
-typedef QThreadStorage<QJNIObjectPrivate> AndroidRandomStorage;
-Q_GLOBAL_STATIC(AndroidRandomStorage, randomTLS)
+namespace {
+struct QRandEngine
+{
+ std::minstd_rand engine;
+ QRandEngine() : engine(1) {}
+
+ int generate()
+ {
+ std::minstd_rand::result_type v = engine();
+ if (std::numeric_limits<int>::max() != RAND_MAX)
+ v %= uint(RAND_MAX) + 1;
+
+ return int(v);
+ }
-#elif defined(Q_OS_UNIX) && !defined(QT_NO_THREAD) && defined(_POSIX_THREAD_SAFE_FUNCTIONS) && (_POSIX_THREAD_SAFE_FUNCTIONS - 0 > 0)
-using SeedStorageType = QtPrivate::FunctionPointer<decltype(&srand)>::Arguments::Car;
+ void seed(std::minstd_rand::result_type q)
+ {
+ engine.seed(q);
+ }
+};
+}
-typedef QThreadStorage<SeedStorageType *> SeedStorage;
-Q_GLOBAL_STATIC(SeedStorage, randTLS) // Thread Local Storage for seed value
+#if defined(QT_NO_THREAD) || defined(Q_OS_WIN)
+// On Windows srand() and rand() already use Thread-Local-Storage
+// to store the seed between calls
+static inline QRandEngine *randTLS()
+{
+ return nullptr;
+}
+#elif defined(Q_COMPILER_THREAD_LOCAL)
+static inline QRandEngine *randTLS()
+{
+ thread_local QRandEngine r;
+ return &r;
+}
+#else
+Q_GLOBAL_STATIC(QThreadStorage<QRandEngine>, g_randTLS)
+static inline QRandEngine *randTLS()
+{
+ auto tls = g_randTLS();
+ if (!tls)
+ return nullptr;
+ return &tls->localData();
+}
#endif
/*!
\relates <QtGlobal>
+ \deprecated
\since 4.2
Thread-safe version of the standard C++ \c srand() function.
@@ -1310,49 +1346,23 @@ Q_GLOBAL_STATIC(SeedStorage, randTLS) // Thread Local Storage for seed value
if two threads call qsrand(1) and subsequently call qrand(), the threads will get
the same random number sequence.
+ \note This function is deprecated. In new applications, use
+ QRandomGenerator instead.
+
\sa qrand(), QRandomGenerator
*/
void qsrand(uint seed)
{
-#if defined(Q_OS_ANDROID) && (__ANDROID_API__ < 21)
- if (randomTLS->hasLocalData()) {
- randomTLS->localData().callMethod<void>("setSeed", "(J)V", jlong(seed));
- return;
- }
-
- QJNIObjectPrivate random("java/util/Random",
- "(J)V",
- jlong(seed));
- if (!random.isValid()) {
+ auto prng = randTLS();
+ if (prng)
+ prng->seed(seed);
+ else
srand(seed);
- return;
- }
-
- randomTLS->setLocalData(random);
-#elif defined(Q_OS_UNIX) && !defined(QT_NO_THREAD) && defined(_POSIX_THREAD_SAFE_FUNCTIONS) && (_POSIX_THREAD_SAFE_FUNCTIONS - 0 > 0)
- SeedStorage *seedStorage = randTLS();
- if (seedStorage) {
- SeedStorageType *pseed = seedStorage->localData();
- if (!pseed)
- seedStorage->setLocalData(pseed = new SeedStorageType);
- *pseed = seed;
- } else {
- //global static seed storage should always exist,
- //except after being deleted by QGlobalStaticDeleter.
- //But since it still can be called from destructor of another
- //global static object, fallback to srand(seed)
- srand(seed);
- }
-#else
- // On Windows srand() and rand() already use Thread-Local-Storage
- // to store the seed between calls
- // this is also valid for QT_NO_THREAD
- srand(seed);
-#endif
}
/*!
\relates <QtGlobal>
+ \deprecated
\since 4.2
Thread-safe version of the standard C++ \c rand() function.
@@ -1366,52 +1376,18 @@ void qsrand(uint seed)
step is skipped, then the sequence will be pre-seeded with a constant
value.
- \sa qsrand(), QRandomGenerator
+ \note This function is deprecated. In new applications, use
+ QRandomGenerator instead.
+
+ \sa qrand(), QRandomGenerator
*/
int qrand()
{
-#if defined(Q_OS_ANDROID) && (__ANDROID_API__ < 21)
- AndroidRandomStorage *randomStorage = randomTLS();
- if (!randomStorage)
- return rand();
-
- if (randomStorage->hasLocalData()) {
- return randomStorage->localData().callMethod<jint>("nextInt",
- "(I)I",
- RAND_MAX);
- }
-
- QJNIObjectPrivate random("java/util/Random",
- "(J)V",
- jlong(1));
-
- if (!random.isValid())
- return rand();
-
- randomStorage->setLocalData(random);
- return random.callMethod<jint>("nextInt", "(I)I", RAND_MAX);
-#elif defined(Q_OS_UNIX) && !defined(QT_NO_THREAD) && defined(_POSIX_THREAD_SAFE_FUNCTIONS) && (_POSIX_THREAD_SAFE_FUNCTIONS - 0 > 0)
- SeedStorage *seedStorage = randTLS();
- if (seedStorage) {
- SeedStorageType *pseed = seedStorage->localData();
- if (!pseed) {
- seedStorage->setLocalData(pseed = new SeedStorageType);
- *pseed = 1;
- }
- return rand_r(pseed);
- } else {
- //global static seed storage should always exist,
- //except after being deleted by QGlobalStaticDeleter.
- //But since it still can be called from destructor of another
- //global static object, fallback to rand()
+ auto prng = randTLS();
+ if (prng)
+ return prng->generate();
+ else
return rand();
- }
-#else
- // On Windows srand() and rand() already use Thread-Local-Storage
- // to store the seed between calls
- // this is also valid for QT_NO_THREAD
- return rand();
-#endif
}
QT_END_NAMESPACE
diff --git a/src/corelib/global/qsysinfo.h b/src/corelib/global/qsysinfo.h
index 6b73a17dc5..a3fa0fcb27 100644
--- a/src/corelib/global/qsysinfo.h
+++ b/src/corelib/global/qsysinfo.h
@@ -240,6 +240,8 @@ QT_WARNING_POP
static QString prettyProductName();
static QString machineHostName();
+ static QByteArray machineUniqueId();
+ static QByteArray bootUniqueId();
};
#undef QT_SYSINFO_DEPRECATED_X
diff --git a/src/corelib/global/qsystemdetection.h b/src/corelib/global/qsystemdetection.h
index 4a2c3f79bb..ff0e03108b 100644
--- a/src/corelib/global/qsystemdetection.h
+++ b/src/corelib/global/qsystemdetection.h
@@ -52,30 +52,18 @@
IOS - iOS
WATCHOS - watchOS
TVOS - tvOS
- MSDOS - MS-DOS and Windows
- OS2 - OS/2
- OS2EMX - XFree86 on OS/2 (not PM)
WIN32 - Win32 (Windows 2000/XP/Vista/7 and Windows Server 2003/2008)
- WINRT - WinRT (Windows 8 Runtime)
+ WINRT - WinRT (Windows Runtime)
CYGWIN - Cygwin
SOLARIS - Sun Solaris
HPUX - HP-UX
- ULTRIX - DEC Ultrix
LINUX - Linux [has variants]
FREEBSD - FreeBSD [has variants]
NETBSD - NetBSD
OPENBSD - OpenBSD
- BSDI - BSD/OS
INTERIX - Interix
- IRIX - SGI Irix
- OSF - HP Tru64 UNIX
- SCO - SCO OpenServer 5
- UNIXWARE - UnixWare 7, Open UNIX 8
AIX - AIX
HURD - GNU Hurd
- DGUX - DG/UX
- RELIANT - Reliant UNIX
- DYNIX - DYNIX/ptx
QNX - QNX [has variants]
QNX6 - QNX RTP 6.1
LYNX - LynxOS
@@ -147,10 +135,6 @@
# define Q_OS_SOLARIS
#elif defined(hpux) || defined(__hpux)
# define Q_OS_HPUX
-#elif defined(__ultrix) || defined(ultrix)
-# define Q_OS_ULTRIX
-#elif defined(sinix)
-# define Q_OS_RELIANT
#elif defined(__native_client__)
# define Q_OS_NACL
#elif defined(__linux__) || defined(__linux)
@@ -167,34 +151,17 @@
#elif defined(__OpenBSD__)
# define Q_OS_OPENBSD
# define Q_OS_BSD4
-#elif defined(__bsdi__)
-# define Q_OS_BSDI
-# define Q_OS_BSD4
#elif defined(__INTERIX)
# define Q_OS_INTERIX
# define Q_OS_BSD4
-#elif defined(__sgi)
-# define Q_OS_IRIX
-#elif defined(__osf__)
-# define Q_OS_OSF
#elif defined(_AIX)
# define Q_OS_AIX
#elif defined(__Lynx__)
# define Q_OS_LYNX
#elif defined(__GNU__)
# define Q_OS_HURD
-#elif defined(__DGUX__)
-# define Q_OS_DGUX
#elif defined(__QNXNTO__)
# define Q_OS_QNX
-#elif defined(_SEQUENT_)
-# define Q_OS_DYNIX
-#elif defined(_SCO_DS) /* SCO OpenServer 5 + GCC */
-# define Q_OS_SCO
-#elif defined(__USLC__) /* all SCO platforms + UDK or OUDK */
-# define Q_OS_UNIXWARE
-#elif defined(__svr4__) && defined(i386) /* Open UNIX 8 + GCC */
-# define Q_OS_UNIXWARE
#elif defined(__INTEGRITY)
# define Q_OS_INTEGRITY
#elif defined(VXWORKS) /* there is no "real" VxWorks define - this has to be set in the mkspec! */
diff --git a/src/corelib/global/qversiontagging.cpp b/src/corelib/global/qversiontagging.cpp
index e3d4037a16..cbfd93f135 100644
--- a/src/corelib/global/qversiontagging.cpp
+++ b/src/corelib/global/qversiontagging.cpp
@@ -84,6 +84,16 @@ make_versioned_symbol(SYM, QT_VERSION_MAJOR, 8, "@");
make_versioned_symbol(SYM, QT_VERSION_MAJOR, 9, "@");
#endif
#if QT_VERSION_MINOR > 10
+make_versioned_symbol(SYM, QT_VERSION_MAJOR, 10, "@");
+#endif
+#if QT_VERSION_MINOR > 11
+make_versioned_symbol(SYM, QT_VERSION_MAJOR, 11, "@");
+#endif
+#if QT_VERSION_MINOR > 12
+make_versioned_symbol(SYM, QT_VERSION_MAJOR, 12, "@");
+#endif
+#if QT_VERSION_MINOR > 13
+// We don't expect there will be a Qt 5.13
# error "Please update this file with more Qt versions."
#endif
diff --git a/src/corelib/io/qbuffer.cpp b/src/corelib/io/qbuffer.cpp
index 86dd737809..e0b9c41323 100644
--- a/src/corelib/io/qbuffer.cpp
+++ b/src/corelib/io/qbuffer.cpp
@@ -60,8 +60,8 @@ public:
QByteArray *buf;
QByteArray defaultBuf;
- virtual qint64 peek(char *data, qint64 maxSize) Q_DECL_OVERRIDE;
- virtual QByteArray peek(qint64 maxSize) Q_DECL_OVERRIDE;
+ virtual qint64 peek(char *data, qint64 maxSize) override;
+ virtual QByteArray peek(qint64 maxSize) override;
#ifndef QT_NO_QOBJECT
// private slots
diff --git a/src/corelib/io/qbuffer.h b/src/corelib/io/qbuffer.h
index fd05dff311..39e1e7b39d 100644
--- a/src/corelib/io/qbuffer.h
+++ b/src/corelib/io/qbuffer.h
@@ -57,8 +57,8 @@ class Q_CORE_EXPORT QBuffer : public QIODevice
public:
#ifndef QT_NO_QOBJECT
- explicit QBuffer(QObject *parent = Q_NULLPTR);
- QBuffer(QByteArray *buf, QObject *parent = Q_NULLPTR);
+ explicit QBuffer(QObject *parent = nullptr);
+ QBuffer(QByteArray *buf, QObject *parent = nullptr);
#else
QBuffer();
explicit QBuffer(QByteArray *buf);
@@ -73,22 +73,22 @@ public:
inline void setData(const char *data, int len);
const QByteArray &data() const;
- bool open(OpenMode openMode) Q_DECL_OVERRIDE;
+ bool open(OpenMode openMode) override;
- void close() Q_DECL_OVERRIDE;
- qint64 size() const Q_DECL_OVERRIDE;
- qint64 pos() const Q_DECL_OVERRIDE;
- bool seek(qint64 off) Q_DECL_OVERRIDE;
- bool atEnd() const Q_DECL_OVERRIDE;
- bool canReadLine() const Q_DECL_OVERRIDE;
+ void close() override;
+ qint64 size() const override;
+ qint64 pos() const override;
+ bool seek(qint64 off) override;
+ bool atEnd() const override;
+ bool canReadLine() const override;
protected:
#ifndef QT_NO_QOBJECT
- void connectNotify(const QMetaMethod &) Q_DECL_OVERRIDE;
- void disconnectNotify(const QMetaMethod &) Q_DECL_OVERRIDE;
+ void connectNotify(const QMetaMethod &) override;
+ void disconnectNotify(const QMetaMethod &) override;
#endif
- qint64 readData(char *data, qint64 maxlen) Q_DECL_OVERRIDE;
- qint64 writeData(const char *data, qint64 len) Q_DECL_OVERRIDE;
+ qint64 readData(char *data, qint64 maxlen) override;
+ qint64 writeData(const char *data, qint64 len) override;
private:
Q_DECLARE_PRIVATE(QBuffer)
diff --git a/src/corelib/io/qdatastream.cpp b/src/corelib/io/qdatastream.cpp
index 1486d3630c..8f419a4a46 100644
--- a/src/corelib/io/qdatastream.cpp
+++ b/src/corelib/io/qdatastream.cpp
@@ -563,6 +563,7 @@ void QDataStream::setByteOrder(ByteOrder bo)
\value Qt_5_8 Same as Qt_5_6
\value Qt_5_9 Same as Qt_5_6
\value Qt_5_10 Same as Qt_5_6
+ \value Qt_5_11 Same as Qt_5_6
\omitvalue Qt_DefaultCompiledVersion
\sa setVersion(), version()
@@ -772,7 +773,7 @@ int QDataStream::readBlock(char *data, int len)
}
/*!
- \fn QDataStream &QDataStream::operator>>(std::nullptr &ptr)
+ \fn QDataStream &QDataStream::operator>>(std::nullptr_t &ptr)
\since 5.9
\overload
@@ -1097,7 +1098,7 @@ int QDataStream::readRawData(char *s, int len)
*****************************************************************************/
/*!
- \fn QDataStream &QDataStream::operator<<(std::nullptr ptr)
+ \fn QDataStream &QDataStream::operator<<(std::nullptr_t ptr)
\since 5.9
\overload
diff --git a/src/corelib/io/qdatastream.h b/src/corelib/io/qdatastream.h
index 0a429d091a..1f1b13686c 100644
--- a/src/corelib/io/qdatastream.h
+++ b/src/corelib/io/qdatastream.h
@@ -97,10 +97,11 @@ public:
Qt_5_8 = Qt_5_7,
Qt_5_9 = Qt_5_8,
Qt_5_10 = Qt_5_9,
-#if QT_VERSION >= 0x050b00
+ Qt_5_11 = Qt_5_10,
+#if QT_VERSION >= 0x050c00
#error Add the datastream version for this Qt version and update Qt_DefaultCompiledVersion
#endif
- Qt_DefaultCompiledVersion = Qt_5_10
+ Qt_DefaultCompiledVersion = Qt_5_11
};
enum ByteOrder {
diff --git a/src/corelib/io/qdebug.cpp b/src/corelib/io/qdebug.cpp
index 341400fd93..0d9a6c8749 100644
--- a/src/corelib/io/qdebug.cpp
+++ b/src/corelib/io/qdebug.cpp
@@ -121,15 +121,15 @@ using QtMiscUtils::fromHex;
*/
/*!
- \fn QDebug::QDebug(QtMsgType type)
+ \fn QDebug::QDebug(QtMsgType t)
- Constructs a debug stream that writes to the handler for the message type specified by \a type.
+ Constructs a debug stream that writes to the handler for the message type \a t.
*/
/*!
- \fn QDebug::QDebug(const QDebug &other)
+ \fn QDebug::QDebug(const QDebug &o)
- Constructs a copy of the \a other debug stream.
+ Constructs a copy of the other debug stream \a o.
*/
/*!
@@ -501,79 +501,79 @@ QDebug &QDebug::resetFormat()
*/
/*!
- \fn QDebug &QDebug::operator<<(signed short i)
+ \fn QDebug &QDebug::operator<<(signed short t)
- Writes the signed short integer, \a i, to the stream and returns a reference
+ Writes the signed short integer, \a t, to the stream and returns a reference
to the stream.
*/
/*!
- \fn QDebug &QDebug::operator<<(unsigned short i)
+ \fn QDebug &QDebug::operator<<(unsigned short t)
- Writes then unsigned short integer, \a i, to the stream and returns a
+ Writes then unsigned short integer, \a t, to the stream and returns a
reference to the stream.
*/
/*!
- \fn QDebug &QDebug::operator<<(signed int i)
+ \fn QDebug &QDebug::operator<<(signed int t)
- Writes the signed integer, \a i, to the stream and returns a reference
+ Writes the signed integer, \a t, to the stream and returns a reference
to the stream.
*/
/*!
- \fn QDebug &QDebug::operator<<(unsigned int i)
+ \fn QDebug &QDebug::operator<<(unsigned int t)
- Writes then unsigned integer, \a i, to the stream and returns a reference to
+ Writes then unsigned integer, \a t, to the stream and returns a reference to
the stream.
*/
/*!
- \fn QDebug &QDebug::operator<<(signed long l)
+ \fn QDebug &QDebug::operator<<(signed long t)
- Writes the signed long integer, \a l, to the stream and returns a reference
+ Writes the signed long integer, \a t, to the stream and returns a reference
to the stream.
*/
/*!
- \fn QDebug &QDebug::operator<<(unsigned long l)
+ \fn QDebug &QDebug::operator<<(unsigned long t)
- Writes then unsigned long integer, \a l, to the stream and returns a reference
+ Writes then unsigned long integer, \a t, to the stream and returns a reference
to the stream.
*/
/*!
- \fn QDebug &QDebug::operator<<(qint64 i)
+ \fn QDebug &QDebug::operator<<(qint64 t)
- Writes the signed 64-bit integer, \a i, to the stream and returns a reference
+ Writes the signed 64-bit integer, \a t, to the stream and returns a reference
to the stream.
*/
/*!
- \fn QDebug &QDebug::operator<<(quint64 i)
+ \fn QDebug &QDebug::operator<<(quint64 t)
- Writes then unsigned 64-bit integer, \a i, to the stream and returns a
+ Writes then unsigned 64-bit integer, \a t, to the stream and returns a
reference to the stream.
*/
/*!
- \fn QDebug &QDebug::operator<<(float f)
+ \fn QDebug &QDebug::operator<<(float t)
- Writes the 32-bit floating point number, \a f, to the stream and returns a
+ Writes the 32-bit floating point number, \a t, to the stream and returns a
reference to the stream.
*/
/*!
- \fn QDebug &QDebug::operator<<(double f)
+ \fn QDebug &QDebug::operator<<(double t)
- Writes the 64-bit floating point number, \a f, to the stream and returns a
+ Writes the 64-bit floating point number, \a t, to the stream and returns a
reference to the stream.
*/
/*!
- \fn QDebug &QDebug::operator<<(const char *s)
+ \fn QDebug &QDebug::operator<<(const char *t)
- Writes the '\\0'-terminated string, \a s, to the stream and returns a
+ Writes the '\\0'-terminated string, \a t, to the stream and returns a
reference to the stream. The string is never quoted nor transformed to the
output, but note that some QDebug backends might not be 8-bit clean.
*/
@@ -595,9 +595,9 @@ QDebug &QDebug::resetFormat()
*/
/*!
- \fn QDebug &QDebug::operator<<(const QString &s)
+ \fn QDebug &QDebug::operator<<(const QString &t)
- Writes the string, \a s, to the stream and returns a reference to the
+ Writes the string, \a t, to the stream and returns a reference to the
stream. Normally, QDebug prints the string inside quotes and transforms
non-printable characters to their Unicode values (\\u1234).
@@ -634,9 +634,9 @@ QDebug &QDebug::resetFormat()
*/
/*!
- \fn QDebug &QDebug::operator<<(const QStringRef &s)
+ \fn QDebug &QDebug::operator<<(const QStringRef &t)
- Writes the string, \a s, to the stream and returns a reference to the
+ Writes the string, \a t, to the stream and returns a reference to the
stream. Normally, QDebug prints the string inside quotes and transforms
non-printable characters to their Unicode values (\\u1234).
@@ -663,9 +663,9 @@ QDebug &QDebug::resetFormat()
*/
/*!
- \fn QDebug &QDebug::operator<<(QLatin1String s)
+ \fn QDebug &QDebug::operator<<(QLatin1String t)
- Writes the string, \a s, to the stream and returns a reference to the
+ Writes the string, \a t, to the stream and returns a reference to the
stream. Normally, QDebug prints the string inside quotes and transforms
non-printable characters to their Unicode values (\\u1234).
@@ -677,9 +677,9 @@ QDebug &QDebug::resetFormat()
*/
/*!
- \fn QDebug &QDebug::operator<<(const QByteArray &b)
+ \fn QDebug &QDebug::operator<<(const QByteArray &t)
- Writes the byte array, \a b, to the stream and returns a reference to the
+ Writes the byte array, \a t, to the stream and returns a reference to the
stream. Normally, QDebug prints the array inside quotes and transforms
control or non-US-ASCII characters to their C escape sequences (\\xAB). This
way, the output is always 7-bit clean and the string can be copied from the
@@ -716,9 +716,9 @@ QDebug &QDebug::resetFormat()
*/
/*!
- \fn QDebug &QDebug::operator<<(const void *p)
+ \fn QDebug &QDebug::operator<<(const void *t)
- Writes a pointer, \a p, to the stream and returns a reference to the stream.
+ Writes a pointer, \a t, to the stream and returns a reference to the stream.
*/
/*!
@@ -732,99 +732,99 @@ QDebug &QDebug::resetFormat()
*/
/*!
- \fn QDebug operator<<(QDebug stream, const QList<T> &list)
+ \fn template <class T> QDebug operator<<(QDebug debug, const QList<T> &list)
\relates QDebug
- Writes the contents of \a list to \a stream. \c T needs to
+ Writes the contents of \a list to \a debug. \c T needs to
support streaming into QDebug.
*/
/*!
- \fn QDebug operator<<(QDebug stream, const std::list<T, Alloc> &list)
+ \fn template <typename T, typename Alloc> QDebug operator<<(QDebug debug, const std::list<T, Alloc> &vec)
\relates QDebug
\since 5.7
- Writes the contents of \a list to \a stream. \c T needs to
+ Writes the contents of list \a vec to \a debug. \c T needs to
support streaming into QDebug.
*/
/*!
- \fn QDebug operator<<(QDebug stream, const QVector<T> &vector)
+ \fn template <typename T> QDebug operator<<(QDebug debug, const QVector<T> &vec)
\relates QDebug
- Writes the contents of \a vector to \a stream. \c T needs to
+ Writes the contents of vector \a vec to \a debug. \c T needs to
support streaming into QDebug.
*/
/*!
- \fn QDebug operator<<(QDebug stream, const std::vector<T, Alloc> &vector)
+ \fn template <typename T, typename Alloc> QDebug operator<<(QDebug debug, const std::vector<T, Alloc> &vec)
\relates QDebug
\since 5.7
- Writes the contents of \a vector to \a stream. \c T needs to
+ Writes the contents of vector \a vec to \a debug. \c T needs to
support streaming into QDebug.
*/
/*!
- \fn QDebug operator<<(QDebug stream, const QSet<T> &set)
+ \fn template <typename T> QDebug operator<<(QDebug debug, const QSet<T> &set)
\relates QDebug
- Writes the contents of \a set to \a stream. \c T needs to
+ Writes the contents of \a set to \a debug. \c T needs to
support streaming into QDebug.
*/
/*!
- \fn QDebug operator<<(QDebug stream, const QMap<Key, T> &map)
+ \fn template <class Key, class T> QDebug operator<<(QDebug debug, const QMap<Key, T> &map)
\relates QDebug
- Writes the contents of \a map to \a stream. Both \c Key and
+ Writes the contents of \a map to \a debug. Both \c Key and
\c T need to support streaming into QDebug.
*/
/*!
- \fn QDebug operator<<(QDebug stream, const std::map<Key, T, Compare, Alloc> &map)
+ \fn template <typename Key, typename T, typename Compare, typename Alloc> QDebug operator<<(QDebug debug, const std::map<Key, T, Compare, Alloc> &map)
\relates QDebug
\since 5.7
- Writes the contents of \a map to \a stream. Both \c Key and
+ Writes the contents of \a map to \a debug. Both \c Key and
\c T need to support streaming into QDebug.
*/
/*!
- \fn QDebug operator<<(QDebug stream, const std::multimap<Key, T, Compare, Alloc> &map)
+ \fn template <typename Key, typename T, typename Compare, typename Alloc> QDebug operator<<(QDebug debug, const std::multimap<Key, T, Compare, Alloc> &map)
\relates QDebug
\since 5.7
- Writes the contents of \a map to \a stream. Both \c Key and
+ Writes the contents of \a map to \a debug. Both \c Key and
\c T need to support streaming into QDebug.
*/
/*!
- \fn QDebug operator<<(QDebug stream, const QHash<Key, T> &hash)
+ \fn template <class Key, class T> QDebug operator<<(QDebug debug, const QHash<Key, T> &hash)
\relates QDebug
- Writes the contents of \a hash to \a stream. Both \c Key and
+ Writes the contents of \a hash to \a debug. Both \c Key and
\c T need to support streaming into QDebug.
*/
/*!
- \fn QDebug operator<<(QDebug stream, const QPair<T1, T2> &pair)
+ \fn template <class T1, class T2> QDebug operator<<(QDebug debug, const QPair<T1, T2> &pair)
\relates QDebug
- Writes the contents of \a pair to \a stream. Both \c T1 and
+ Writes the contents of \a pair to \a debug. Both \c T1 and
\c T2 need to support streaming into QDebug.
*/
/*!
- \fn QDebug operator<<(QDebug stream, const QFlags<T> &flag)
+ \fn template<typename T> QDebug operator<<(QDebug debug, const QFlags<T> &flags)
\relates QDebug
\since 4.7
- Writes \a flag to \a stream.
+ Writes \a flags to \a debug.
*/
/*!
- \fn QDebug operator<<(QDebug debug, const QSharedPointer<T> &ptr)
+ \fn template<typename T> QDebug operator<<(QDebug debug, const QSharedPointer<T> &ptr)
\relates QSharedPointer
\since 5.7
@@ -835,6 +835,11 @@ QDebug &QDebug::resetFormat()
*/
/*!
+ \fn QDebug &QDebug::operator<<(std::nullptr_t)
+ \internal
+ */
+
+/*!
\class QDebugStateSaver
\inmodule QtCore
\brief Convenience class for custom QDebug operators
diff --git a/src/corelib/io/qdir.cpp b/src/corelib/io/qdir.cpp
index 6d144cb65d..520f98b18f 100644
--- a/src/corelib/io/qdir.cpp
+++ b/src/corelib/io/qdir.cpp
@@ -2087,6 +2087,7 @@ bool QDir::match(const QString &filter, const QString &fileName)
#endif // QT_NO_REGEXP
/*!
+ \internal
Returns \a path with redundant directory separators removed,
and "."s and ".."s resolved (as far as possible).
diff --git a/src/corelib/io/qfile.h b/src/corelib/io/qfile.h
index c5819e8076..e6f3d942fe 100644
--- a/src/corelib/io/qfile.h
+++ b/src/corelib/io/qfile.h
@@ -70,7 +70,7 @@ public:
#endif
~QFile();
- QString fileName() const Q_DECL_OVERRIDE;
+ QString fileName() const override;
void setFileName(const QString &name);
#if defined(Q_OS_DARWIN)
@@ -124,25 +124,25 @@ public:
bool copy(const QString &newName);
static bool copy(const QString &fileName, const QString &newName);
- bool open(OpenMode flags) Q_DECL_OVERRIDE;
+ bool open(OpenMode flags) override;
bool open(FILE *f, OpenMode ioFlags, FileHandleFlags handleFlags=DontCloseHandle);
bool open(int fd, OpenMode ioFlags, FileHandleFlags handleFlags=DontCloseHandle);
- qint64 size() const Q_DECL_OVERRIDE;
+ qint64 size() const override;
- bool resize(qint64 sz) Q_DECL_OVERRIDE;
+ bool resize(qint64 sz) override;
static bool resize(const QString &filename, qint64 sz);
- Permissions permissions() const Q_DECL_OVERRIDE;
+ Permissions permissions() const override;
static Permissions permissions(const QString &filename);
- bool setPermissions(Permissions permissionSpec) Q_DECL_OVERRIDE;
+ bool setPermissions(Permissions permissionSpec) override;
static bool setPermissions(const QString &filename, Permissions permissionSpec);
protected:
#ifdef QT_NO_QOBJECT
QFile(QFilePrivate &dd);
#else
- QFile(QFilePrivate &dd, QObject *parent = Q_NULLPTR);
+ QFile(QFilePrivate &dd, QObject *parent = nullptr);
#endif
private:
diff --git a/src/corelib/io/qfiledevice.h b/src/corelib/io/qfiledevice.h
index e941781c25..af41bec2f6 100644
--- a/src/corelib/io/qfiledevice.h
+++ b/src/corelib/io/qfiledevice.h
@@ -100,19 +100,19 @@ public:
FileError error() const;
void unsetError();
- virtual void close() Q_DECL_OVERRIDE;
+ virtual void close() override;
- bool isSequential() const Q_DECL_OVERRIDE;
+ bool isSequential() const override;
int handle() const;
virtual QString fileName() const;
- qint64 pos() const Q_DECL_OVERRIDE;
- bool seek(qint64 offset) Q_DECL_OVERRIDE;
- bool atEnd() const Q_DECL_OVERRIDE;
+ qint64 pos() const override;
+ bool seek(qint64 offset) override;
+ bool atEnd() const override;
bool flush();
- qint64 size() const Q_DECL_OVERRIDE;
+ qint64 size() const override;
virtual bool resize(qint64 sz);
virtual Permissions permissions() const;
@@ -136,12 +136,12 @@ protected:
QFileDevice(QFileDevicePrivate &dd);
#else
explicit QFileDevice(QObject *parent);
- QFileDevice(QFileDevicePrivate &dd, QObject *parent = Q_NULLPTR);
+ QFileDevice(QFileDevicePrivate &dd, QObject *parent = nullptr);
#endif
- qint64 readData(char *data, qint64 maxlen) Q_DECL_OVERRIDE;
- qint64 writeData(const char *data, qint64 len) Q_DECL_OVERRIDE;
- qint64 readLineData(char *data, qint64 maxlen) Q_DECL_OVERRIDE;
+ qint64 readData(char *data, qint64 maxlen) override;
+ qint64 writeData(const char *data, qint64 len) override;
+ qint64 readLineData(char *data, qint64 maxlen) override;
private:
Q_DISABLE_COPY(QFileDevice)
diff --git a/src/corelib/io/qfiledevice_p.h b/src/corelib/io/qfiledevice_p.h
index 60c51afb7e..47053d01b7 100644
--- a/src/corelib/io/qfiledevice_p.h
+++ b/src/corelib/io/qfiledevice_p.h
@@ -69,7 +69,7 @@ protected:
inline bool ensureFlushed() const;
- bool putCharHelper(char c) Q_DECL_OVERRIDE;
+ bool putCharHelper(char c) override;
void setError(QFileDevice::FileError err);
void setError(QFileDevice::FileError err, const QString &errorString);
diff --git a/src/corelib/io/qfileselector.h b/src/corelib/io/qfileselector.h
index fafb7f7609..c9c2f564f6 100644
--- a/src/corelib/io/qfileselector.h
+++ b/src/corelib/io/qfileselector.h
@@ -50,7 +50,7 @@ class Q_CORE_EXPORT QFileSelector : public QObject
{
Q_OBJECT
public:
- explicit QFileSelector(QObject *parent = Q_NULLPTR);
+ explicit QFileSelector(QObject *parent = nullptr);
~QFileSelector();
QString select(const QString &filePath) const;
diff --git a/src/corelib/io/qfilesystemiterator_unix.cpp b/src/corelib/io/qfilesystemiterator_unix.cpp
index 0d1438f137..a9acf542d4 100644
--- a/src/corelib/io/qfilesystemiterator_unix.cpp
+++ b/src/corelib/io/qfilesystemiterator_unix.cpp
@@ -77,12 +77,19 @@ bool QFileSystemIterator::advance(QFileSystemEntry &fileEntry, QFileSystemMetaDa
if (!dir)
return false;
- dirEntry = QT_READDIR(dir);
+ for (;;) {
+ dirEntry = QT_READDIR(dir);
- if (dirEntry) {
- fileEntry = QFileSystemEntry(nativePath + QByteArray(dirEntry->d_name), QFileSystemEntry::FromNativePath());
- metaData.fillFromDirEnt(*dirEntry);
- return true;
+ if (dirEntry) {
+ // process entries with correct UTF-8 names only
+ if (QFile::encodeName(QFile::decodeName(dirEntry->d_name)) == dirEntry->d_name) {
+ fileEntry = QFileSystemEntry(nativePath + QByteArray(dirEntry->d_name), QFileSystemEntry::FromNativePath());
+ metaData.fillFromDirEnt(*dirEntry);
+ return true;
+ }
+ } else {
+ break;
+ }
}
lastError = errno;
diff --git a/src/corelib/io/qfilesystemwatcher.h b/src/corelib/io/qfilesystemwatcher.h
index 09d4e8e65e..057a20672c 100644
--- a/src/corelib/io/qfilesystemwatcher.h
+++ b/src/corelib/io/qfilesystemwatcher.h
@@ -55,8 +55,8 @@ class Q_CORE_EXPORT QFileSystemWatcher : public QObject
Q_DECLARE_PRIVATE(QFileSystemWatcher)
public:
- QFileSystemWatcher(QObject *parent = Q_NULLPTR);
- QFileSystemWatcher(const QStringList &paths, QObject *parent = Q_NULLPTR);
+ QFileSystemWatcher(QObject *parent = nullptr);
+ QFileSystemWatcher(const QStringList &paths, QObject *parent = nullptr);
~QFileSystemWatcher();
bool addPath(const QString &file);
diff --git a/src/corelib/io/qfilesystemwatcher_fsevents.mm b/src/corelib/io/qfilesystemwatcher_fsevents.mm
index b4517cbac7..792ea387ac 100644
--- a/src/corelib/io/qfilesystemwatcher_fsevents.mm
+++ b/src/corelib/io/qfilesystemwatcher_fsevents.mm
@@ -336,7 +336,7 @@ QStringList QFseventsFileSystemWatcherEngine::addPaths(const QStringList &paths,
QMutexLocker locker(&lock);
- bool wasRunning = stream != Q_NULLPTR;
+ bool wasRunning = stream != nullptr;
bool needsRestart = false;
WatchingState oldState = watchingState;
diff --git a/src/corelib/io/qfilesystemwatcher_inotify_p.h b/src/corelib/io/qfilesystemwatcher_inotify_p.h
index 777d62dc8a..0c873466c8 100644
--- a/src/corelib/io/qfilesystemwatcher_inotify_p.h
+++ b/src/corelib/io/qfilesystemwatcher_inotify_p.h
@@ -70,8 +70,8 @@ public:
static QInotifyFileSystemWatcherEngine *create(QObject *parent);
- QStringList addPaths(const QStringList &paths, QStringList *files, QStringList *directories) Q_DECL_OVERRIDE;
- QStringList removePaths(const QStringList &paths, QStringList *files, QStringList *directories) Q_DECL_OVERRIDE;
+ QStringList addPaths(const QStringList &paths, QStringList *files, QStringList *directories) override;
+ QStringList removePaths(const QStringList &paths, QStringList *files, QStringList *directories) override;
private Q_SLOTS:
void readFromInotify();
diff --git a/src/corelib/io/qfilesystemwatcher_polling_p.h b/src/corelib/io/qfilesystemwatcher_polling_p.h
index 6dff08ac05..4c46633fdf 100644
--- a/src/corelib/io/qfilesystemwatcher_polling_p.h
+++ b/src/corelib/io/qfilesystemwatcher_polling_p.h
@@ -110,8 +110,8 @@ class QPollingFileSystemWatcherEngine : public QFileSystemWatcherEngine
public:
QPollingFileSystemWatcherEngine(QObject *parent);
- QStringList addPaths(const QStringList &paths, QStringList *files, QStringList *directories) Q_DECL_OVERRIDE;
- QStringList removePaths(const QStringList &paths, QStringList *files, QStringList *directories) Q_DECL_OVERRIDE;
+ QStringList addPaths(const QStringList &paths, QStringList *files, QStringList *directories) override;
+ QStringList removePaths(const QStringList &paths, QStringList *files, QStringList *directories) override;
private Q_SLOTS:
void timeout();
diff --git a/src/corelib/io/qfsfileengine.cpp b/src/corelib/io/qfsfileengine.cpp
index b7a5440224..dc41197bd7 100644
--- a/src/corelib/io/qfsfileengine.cpp
+++ b/src/corelib/io/qfsfileengine.cpp
@@ -915,11 +915,15 @@ bool QFSFileEngine::supportsExtension(Extension extension) const
For Unix, the list contains just the root path "/".
*/
-/*! \fn QString QFSFileEngine::fileName(FileName file) const
+/*! \fn QString QFSFileEngine::fileName(QAbstractFileEngine::FileName file) const
\reimp
*/
-/*! \fn bool QFSFileEngine::setFileTime(const QDateTime &newDate, FileTime time)
+/*! \fn bool QFSFileEngine::setFileTime(const QDateTime &newDate, QAbstractFileEngine::FileTime time)
+ \reimp
+*/
+
+/*! \fn QDateTime QFSFileEngine::fileTime(QAbstractFileEngine::FileTime time) const
\reimp
*/
@@ -945,7 +949,7 @@ bool QFSFileEngine::supportsExtension(Extension extension) const
\reimp
*/
-/*! \fn uint QFSFileEngine::ownerId(FileOwner own) const
+/*! \fn uint QFSFileEngine::ownerId(QAbstractFileEngine::FileOwner own) const
In Unix, if stat() is successful, the \c uid is returned if
\a own is the owner. Otherwise the \c gid is returned. If stat()
is unsuccessful, -2 is reuturned.
@@ -953,7 +957,7 @@ bool QFSFileEngine::supportsExtension(Extension extension) const
For Windows, -2 is always returned.
*/
-/*! \fn QString QFSFileEngine::owner(FileOwner own) const
+/*! \fn QString QFSFileEngine::owner(QAbstractFileEngine::FileOwner own) const
\reimp
*/
diff --git a/src/corelib/io/qfsfileengine_iterator_p.h b/src/corelib/io/qfsfileengine_iterator_p.h
index 7f094ba9d7..bde00bf578 100644
--- a/src/corelib/io/qfsfileengine_iterator_p.h
+++ b/src/corelib/io/qfsfileengine_iterator_p.h
@@ -68,11 +68,11 @@ public:
QFSFileEngineIterator(QDir::Filters filters, const QStringList &filterNames);
~QFSFileEngineIterator();
- QString next() Q_DECL_OVERRIDE;
- bool hasNext() const Q_DECL_OVERRIDE;
+ QString next() override;
+ bool hasNext() const override;
- QString currentFileName() const Q_DECL_OVERRIDE;
- QFileInfo currentFileInfo() const Q_DECL_OVERRIDE;
+ QString currentFileName() const override;
+ QFileInfo currentFileInfo() const override;
private:
void advance() const;
diff --git a/src/corelib/io/qfsfileengine_p.h b/src/corelib/io/qfsfileengine_p.h
index faef84cbe2..16ba161b75 100644
--- a/src/corelib/io/qfsfileengine_p.h
+++ b/src/corelib/io/qfsfileengine_p.h
@@ -71,52 +71,52 @@ public:
explicit QFSFileEngine(const QString &file);
~QFSFileEngine();
- bool open(QIODevice::OpenMode openMode) Q_DECL_OVERRIDE;
+ bool open(QIODevice::OpenMode openMode) override;
bool open(QIODevice::OpenMode flags, FILE *fh);
- bool close() Q_DECL_OVERRIDE;
- bool flush() Q_DECL_OVERRIDE;
- bool syncToDisk() Q_DECL_OVERRIDE;
- qint64 size() const Q_DECL_OVERRIDE;
- qint64 pos() const Q_DECL_OVERRIDE;
- bool seek(qint64) Q_DECL_OVERRIDE;
- bool isSequential() const Q_DECL_OVERRIDE;
- bool remove() Q_DECL_OVERRIDE;
- bool copy(const QString &newName) Q_DECL_OVERRIDE;
- bool rename(const QString &newName) Q_DECL_OVERRIDE;
- bool renameOverwrite(const QString &newName) Q_DECL_OVERRIDE;
- bool link(const QString &newName) Q_DECL_OVERRIDE;
- bool mkdir(const QString &dirName, bool createParentDirectories) const Q_DECL_OVERRIDE;
- bool rmdir(const QString &dirName, bool recurseParentDirectories) const Q_DECL_OVERRIDE;
- bool setSize(qint64 size) Q_DECL_OVERRIDE;
- bool caseSensitive() const Q_DECL_OVERRIDE;
- bool isRelativePath() const Q_DECL_OVERRIDE;
- QStringList entryList(QDir::Filters filters, const QStringList &filterNames) const Q_DECL_OVERRIDE;
- FileFlags fileFlags(FileFlags type) const Q_DECL_OVERRIDE;
- bool setPermissions(uint perms) Q_DECL_OVERRIDE;
+ bool close() override;
+ bool flush() override;
+ bool syncToDisk() override;
+ qint64 size() const override;
+ qint64 pos() const override;
+ bool seek(qint64) override;
+ bool isSequential() const override;
+ bool remove() override;
+ bool copy(const QString &newName) override;
+ bool rename(const QString &newName) override;
+ bool renameOverwrite(const QString &newName) override;
+ bool link(const QString &newName) override;
+ bool mkdir(const QString &dirName, bool createParentDirectories) const override;
+ bool rmdir(const QString &dirName, bool recurseParentDirectories) const override;
+ bool setSize(qint64 size) override;
+ bool caseSensitive() const override;
+ bool isRelativePath() const override;
+ QStringList entryList(QDir::Filters filters, const QStringList &filterNames) const override;
+ FileFlags fileFlags(FileFlags type) const override;
+ bool setPermissions(uint perms) override;
QByteArray id() const override;
- QString fileName(FileName file) const Q_DECL_OVERRIDE;
- uint ownerId(FileOwner) const Q_DECL_OVERRIDE;
- QString owner(FileOwner) const Q_DECL_OVERRIDE;
- bool setFileTime(const QDateTime &newDate, FileTime time) Q_DECL_OVERRIDE;
- QDateTime fileTime(FileTime time) const Q_DECL_OVERRIDE;
- void setFileName(const QString &file) Q_DECL_OVERRIDE;
- int handle() const Q_DECL_OVERRIDE;
+ QString fileName(FileName file) const override;
+ uint ownerId(FileOwner) const override;
+ QString owner(FileOwner) const override;
+ bool setFileTime(const QDateTime &newDate, FileTime time) override;
+ QDateTime fileTime(FileTime time) const override;
+ void setFileName(const QString &file) override;
+ int handle() const override;
#ifndef QT_NO_FILESYSTEMITERATOR
- Iterator *beginEntryList(QDir::Filters filters, const QStringList &filterNames) Q_DECL_OVERRIDE;
- Iterator *endEntryList() Q_DECL_OVERRIDE;
+ Iterator *beginEntryList(QDir::Filters filters, const QStringList &filterNames) override;
+ Iterator *endEntryList() override;
#endif
- qint64 read(char *data, qint64 maxlen) Q_DECL_OVERRIDE;
- qint64 readLine(char *data, qint64 maxlen) Q_DECL_OVERRIDE;
- qint64 write(const char *data, qint64 len) Q_DECL_OVERRIDE;
+ qint64 read(char *data, qint64 maxlen) override;
+ qint64 readLine(char *data, qint64 maxlen) override;
+ qint64 write(const char *data, qint64 len) override;
bool cloneTo(QAbstractFileEngine *target) override;
virtual bool isUnnamedFile() const
{ return false; }
- bool extension(Extension extension, const ExtensionOption *option = 0, ExtensionReturn *output = 0) Q_DECL_OVERRIDE;
- bool supportsExtension(Extension extension) const Q_DECL_OVERRIDE;
+ bool extension(Extension extension, const ExtensionOption *option = 0, ExtensionReturn *output = 0) override;
+ bool supportsExtension(Extension extension) const override;
//FS only!!
bool open(QIODevice::OpenMode flags, int fd);
diff --git a/src/corelib/io/qiodevice.h b/src/corelib/io/qiodevice.h
index e64a4d0bb1..af37b3fd53 100644
--- a/src/corelib/io/qiodevice.h
+++ b/src/corelib/io/qiodevice.h
@@ -161,7 +161,7 @@ protected:
#ifdef QT_NO_QOBJECT
QIODevice(QIODevicePrivate &dd);
#else
- QIODevice(QIODevicePrivate &dd, QObject *parent = Q_NULLPTR);
+ QIODevice(QIODevicePrivate &dd, QObject *parent = nullptr);
#endif
virtual qint64 readData(char *data, qint64 maxlen) = 0;
virtual qint64 readLineData(char *data, qint64 maxlen);
diff --git a/src/corelib/io/qiodevice_p.h b/src/corelib/io/qiodevice_p.h
index de2aa1597e..15a53a67dc 100644
--- a/src/corelib/io/qiodevice_p.h
+++ b/src/corelib/io/qiodevice_p.h
@@ -88,14 +88,14 @@ public:
class QRingBufferRef {
QRingBuffer *m_buf;
- inline QRingBufferRef() : m_buf(Q_NULLPTR) { }
+ inline QRingBufferRef() : m_buf(nullptr) { }
friend class QIODevicePrivate;
public:
// wrap functions from QRingBuffer
inline void setChunkSize(int size) { Q_ASSERT(m_buf); m_buf->setChunkSize(size); }
inline int chunkSize() const { Q_ASSERT(m_buf); return m_buf->chunkSize(); }
inline qint64 nextDataBlockSize() const { return (m_buf ? m_buf->nextDataBlockSize() : Q_INT64_C(0)); }
- inline const char *readPointer() const { return (m_buf ? m_buf->readPointer() : Q_NULLPTR); }
+ inline const char *readPointer() const { return (m_buf ? m_buf->readPointer() : nullptr); }
inline const char *readPointerAtPosition(qint64 pos, qint64 &length) const { Q_ASSERT(m_buf); return m_buf->readPointerAtPosition(pos, length); }
inline void free(qint64 bytes) { Q_ASSERT(m_buf); m_buf->free(bytes); }
inline char *reserve(qint64 bytes) { Q_ASSERT(m_buf); return m_buf->reserve(bytes); }
diff --git a/src/corelib/io/qlockfile.cpp b/src/corelib/io/qlockfile.cpp
index 129cf01b63..aa84ce6bc1 100644
--- a/src/corelib/io/qlockfile.cpp
+++ b/src/corelib/io/qlockfile.cpp
@@ -56,6 +56,8 @@ struct LockFileInfo
qint64 pid;
QString appname;
QString hostname;
+ QByteArray hostid;
+ QByteArray bootid;
};
}
@@ -331,13 +333,15 @@ QByteArray QLockFilePrivate::lockFileContents() const
// Use operator% from the fast builder to avoid multiple memory allocations.
return QByteArray::number(QCoreApplication::applicationPid()) % '\n'
% processNameByPid(QCoreApplication::applicationPid()).toUtf8() % '\n'
- % machineName().toUtf8() % '\n';
+ % machineName().toUtf8() % '\n'
+ % QSysInfo::machineUniqueId() % '\n'
+ % QSysInfo::bootUniqueId() % '\n';
}
static bool getLockInfo_helper(const QString &fileName, LockFileInfo *info)
{
QFile reader(fileName);
- if (!reader.open(QIODevice::ReadOnly))
+ if (!reader.open(QIODevice::ReadOnly | QIODevice::Text))
return false;
QByteArray pidLine = reader.readLine();
@@ -349,9 +353,17 @@ static bool getLockInfo_helper(const QString &fileName, LockFileInfo *info)
QByteArray hostNameLine = reader.readLine();
hostNameLine.chop(1);
+ // prior to Qt 5.10, only the lines above were recorded
+ QByteArray hostId = reader.readLine();
+ hostId.chop(1);
+ QByteArray bootId = reader.readLine();
+ bootId.chop(1);
+
bool ok;
info->appname = QString::fromUtf8(appNameLine);
info->hostname = QString::fromUtf8(hostNameLine);
+ info->hostid = hostId;
+ info->bootid = bootId;
info->pid = pidLine.toLongLong(&ok);
return ok && info->pid > 0;
}
@@ -360,7 +372,20 @@ bool QLockFilePrivate::isApparentlyStale() const
{
LockFileInfo info;
if (getLockInfo_helper(fileName, &info)) {
- if (info.hostname.isEmpty() || info.hostname == machineName()) {
+ bool sameHost = info.hostname.isEmpty() || info.hostname == machineName();
+ if (!info.hostid.isEmpty()) {
+ // Override with the host ID, if we know it.
+ QByteArray ourHostId = QSysInfo::machineUniqueId();
+ if (!ourHostId.isEmpty())
+ sameHost = (ourHostId == info.hostid);
+ }
+
+ if (sameHost) {
+ if (!info.bootid.isEmpty()) {
+ // If we've rebooted, then the lock is definitely stale.
+ if (info.bootid != QSysInfo::bootUniqueId())
+ return true;
+ }
if (!isProcessRunning(info.pid, info.appname))
return true;
}
diff --git a/src/corelib/io/qlockfile_p.h b/src/corelib/io/qlockfile_p.h
index b41dfb38ad..5b69347206 100644
--- a/src/corelib/io/qlockfile_p.h
+++ b/src/corelib/io/qlockfile_p.h
@@ -55,7 +55,10 @@
#include <QtCore/qlockfile.h>
#include <QtCore/qfile.h>
+#include <qplatformdefs.h>
+
#ifdef Q_OS_WIN
+#include <io.h>
#include <qt_windows.h>
#endif
@@ -96,6 +99,19 @@ public:
int staleLockTime; // "int milliseconds" is big enough for 24 days
QLockFile::LockError lockError;
bool isLocked;
+
+ static int getLockFileHandle(QLockFile *f)
+ {
+ int fd;
+#ifdef Q_OS_WIN
+ // Use of this function on Windows WILL leak a file descriptor.
+ fd = _open_osfhandle(intptr_t(f->d_func()->fileHandle), 0);
+#else
+ fd = f->d_func()->fileHandle;
+#endif
+ QT_LSEEK(fd, 0, SEEK_SET);
+ return fd;
+ }
};
QT_END_NAMESPACE
diff --git a/src/corelib/io/qlockfile_unix.cpp b/src/corelib/io/qlockfile_unix.cpp
index fc01f83e80..418b7d22ba 100644
--- a/src/corelib/io/qlockfile_unix.cpp
+++ b/src/corelib/io/qlockfile_unix.cpp
@@ -147,7 +147,7 @@ static bool setNativeLocks(int fd)
QLockFile::LockError QLockFilePrivate::tryLock_sys()
{
const QByteArray lockFileName = QFile::encodeName(fileName);
- const int fd = qt_safe_open(lockFileName.constData(), O_WRONLY | O_CREAT | O_EXCL, 0666);
+ const int fd = qt_safe_open(lockFileName.constData(), O_RDWR | O_CREAT | O_EXCL, 0666);
if (fd < 0) {
switch (errno) {
case EEXIST:
diff --git a/src/corelib/io/qlockfile_win.cpp b/src/corelib/io/qlockfile_win.cpp
index de64ec0432..6b8028460c 100644
--- a/src/corelib/io/qlockfile_win.cpp
+++ b/src/corelib/io/qlockfile_win.cpp
@@ -68,7 +68,7 @@ QLockFile::LockError QLockFilePrivate::tryLock_sys()
#ifndef Q_OS_WINRT
SECURITY_ATTRIBUTES securityAtts = { sizeof(SECURITY_ATTRIBUTES), NULL, FALSE };
HANDLE fh = CreateFile((const wchar_t*)fileEntry.nativeFilePath().utf16(),
- GENERIC_WRITE,
+ GENERIC_READ | GENERIC_WRITE,
dwShareMode,
&securityAtts,
CREATE_NEW, // error if already exists
@@ -76,7 +76,7 @@ QLockFile::LockError QLockFilePrivate::tryLock_sys()
NULL);
#else // !Q_OS_WINRT
HANDLE fh = CreateFile2((const wchar_t*)fileEntry.nativeFilePath().utf16(),
- GENERIC_WRITE,
+ GENERIC_READ | GENERIC_WRITE,
dwShareMode,
CREATE_NEW, // error if already exists
NULL);
diff --git a/src/corelib/io/qnoncontiguousbytedevice_p.h b/src/corelib/io/qnoncontiguousbytedevice_p.h
index bb0b533831..ebed1120db 100644
--- a/src/corelib/io/qnoncontiguousbytedevice_p.h
+++ b/src/corelib/io/qnoncontiguousbytedevice_p.h
@@ -105,12 +105,12 @@ class QNonContiguousByteDeviceByteArrayImpl : public QNonContiguousByteDevice
public:
QNonContiguousByteDeviceByteArrayImpl(QByteArray *ba);
~QNonContiguousByteDeviceByteArrayImpl();
- const char* readPointer(qint64 maximumLength, qint64 &len) Q_DECL_OVERRIDE;
- bool advanceReadPointer(qint64 amount) Q_DECL_OVERRIDE;
- bool atEnd() const Q_DECL_OVERRIDE;
- bool reset() Q_DECL_OVERRIDE;
- qint64 size() const Q_DECL_OVERRIDE;
- qint64 pos() const Q_DECL_OVERRIDE;
+ const char* readPointer(qint64 maximumLength, qint64 &len) override;
+ bool advanceReadPointer(qint64 amount) override;
+ bool atEnd() const override;
+ bool reset() override;
+ qint64 size() const override;
+ qint64 pos() const override;
protected:
QByteArray* byteArray;
qint64 currentPosition;
@@ -121,12 +121,12 @@ class QNonContiguousByteDeviceRingBufferImpl : public QNonContiguousByteDevice
public:
QNonContiguousByteDeviceRingBufferImpl(QSharedPointer<QRingBuffer> rb);
~QNonContiguousByteDeviceRingBufferImpl();
- const char* readPointer(qint64 maximumLength, qint64 &len) Q_DECL_OVERRIDE;
- bool advanceReadPointer(qint64 amount) Q_DECL_OVERRIDE;
- bool atEnd() const Q_DECL_OVERRIDE;
- bool reset() Q_DECL_OVERRIDE;
- qint64 size() const Q_DECL_OVERRIDE;
- qint64 pos() const Q_DECL_OVERRIDE;
+ const char* readPointer(qint64 maximumLength, qint64 &len) override;
+ bool advanceReadPointer(qint64 amount) override;
+ bool atEnd() const override;
+ bool reset() override;
+ qint64 size() const override;
+ qint64 pos() const override;
protected:
QSharedPointer<QRingBuffer> ringBuffer;
qint64 currentPosition;
@@ -139,12 +139,12 @@ class QNonContiguousByteDeviceIoDeviceImpl : public QNonContiguousByteDevice
public:
QNonContiguousByteDeviceIoDeviceImpl(QIODevice *d);
~QNonContiguousByteDeviceIoDeviceImpl();
- const char* readPointer(qint64 maximumLength, qint64 &len) Q_DECL_OVERRIDE;
- bool advanceReadPointer(qint64 amount) Q_DECL_OVERRIDE;
- bool atEnd() const Q_DECL_OVERRIDE;
- bool reset() Q_DECL_OVERRIDE;
- qint64 size() const Q_DECL_OVERRIDE;
- qint64 pos() const Q_DECL_OVERRIDE;
+ const char* readPointer(qint64 maximumLength, qint64 &len) override;
+ bool advanceReadPointer(qint64 amount) override;
+ bool atEnd() const override;
+ bool reset() override;
+ qint64 size() const override;
+ qint64 pos() const override;
protected:
QIODevice* device;
QByteArray* currentReadBuffer;
@@ -162,11 +162,11 @@ class QNonContiguousByteDeviceBufferImpl : public QNonContiguousByteDevice
public:
QNonContiguousByteDeviceBufferImpl(QBuffer *b);
~QNonContiguousByteDeviceBufferImpl();
- const char* readPointer(qint64 maximumLength, qint64 &len) Q_DECL_OVERRIDE;
- bool advanceReadPointer(qint64 amount) Q_DECL_OVERRIDE;
- bool atEnd() const Q_DECL_OVERRIDE;
- bool reset() Q_DECL_OVERRIDE;
- qint64 size() const Q_DECL_OVERRIDE;
+ const char* readPointer(qint64 maximumLength, qint64 &len) override;
+ bool advanceReadPointer(qint64 amount) override;
+ bool atEnd() const override;
+ bool reset() override;
+ qint64 size() const override;
protected:
QBuffer* buffer;
QByteArray byteArray;
@@ -179,13 +179,13 @@ class QByteDeviceWrappingIoDevice : public QIODevice
public:
QByteDeviceWrappingIoDevice (QNonContiguousByteDevice *bd);
~QByteDeviceWrappingIoDevice ();
- virtual bool isSequential () const Q_DECL_OVERRIDE;
- virtual bool atEnd () const Q_DECL_OVERRIDE;
- virtual bool reset () Q_DECL_OVERRIDE;
- virtual qint64 size () const Q_DECL_OVERRIDE;
+ virtual bool isSequential () const override;
+ virtual bool atEnd () const override;
+ virtual bool reset () override;
+ virtual qint64 size () const override;
protected:
- virtual qint64 readData ( char * data, qint64 maxSize ) Q_DECL_OVERRIDE;
- virtual qint64 writeData ( const char * data, qint64 maxSize ) Q_DECL_OVERRIDE;
+ virtual qint64 readData ( char * data, qint64 maxSize ) override;
+ virtual qint64 writeData ( const char * data, qint64 maxSize ) override;
QNonContiguousByteDevice *byteDevice;
};
diff --git a/src/corelib/io/qprocess.cpp b/src/corelib/io/qprocess.cpp
index 64a59bc2c3..2ee680a7c6 100644
--- a/src/corelib/io/qprocess.cpp
+++ b/src/corelib/io/qprocess.cpp
@@ -1094,10 +1094,9 @@ bool QProcessPrivate::_q_canReadStandardError()
*/
bool QProcessPrivate::_q_canWrite()
{
- if (stdinChannel.notifier)
- stdinChannel.notifier->setEnabled(false);
-
if (writeBuffer.isEmpty()) {
+ if (stdinChannel.notifier)
+ stdinChannel.notifier->setEnabled(false);
#if defined QPROCESS_DEBUG
qDebug("QProcessPrivate::canWrite(), not writing anything (empty write buffer).");
#endif
@@ -1106,10 +1105,10 @@ bool QProcessPrivate::_q_canWrite()
const bool writeSucceeded = writeToStdin();
- if (stdinChannel.notifier && !writeBuffer.isEmpty())
- stdinChannel.notifier->setEnabled(true);
if (writeBuffer.isEmpty() && stdinChannel.closed)
closeWriteChannel();
+ else if (stdinChannel.notifier)
+ stdinChannel.notifier->setEnabled(!writeBuffer.isEmpty());
return writeSucceeded;
}
diff --git a/src/corelib/io/qprocess.h b/src/corelib/io/qprocess.h
index c8aef2f0b1..474fc87de8 100644
--- a/src/corelib/io/qprocess.h
+++ b/src/corelib/io/qprocess.h
@@ -155,7 +155,7 @@ public:
};
Q_ENUM(ExitStatus)
- explicit QProcess(QObject *parent = Q_NULLPTR);
+ explicit QProcess(QObject *parent = nullptr);
virtual ~QProcess();
void start(const QString &program, const QStringList &arguments, OpenMode mode = ReadWrite);
@@ -164,7 +164,7 @@ public:
#endif
void start(OpenMode mode = ReadWrite);
bool startDetached(qint64 *pid = nullptr);
- bool open(OpenMode mode = ReadWrite) Q_DECL_OVERRIDE;
+ bool open(OpenMode mode = ReadWrite) override;
QString program() const;
void setProgram(const QString &program);
@@ -227,8 +227,8 @@ public:
qint64 processId() const;
bool waitForStarted(int msecs = 30000);
- bool waitForReadyRead(int msecs = 30000) Q_DECL_OVERRIDE;
- bool waitForBytesWritten(int msecs = 30000) Q_DECL_OVERRIDE;
+ bool waitForReadyRead(int msecs = 30000) override;
+ bool waitForBytesWritten(int msecs = 30000) override;
bool waitForFinished(int msecs = 30000);
QByteArray readAllStandardOutput();
@@ -238,12 +238,12 @@ public:
QProcess::ExitStatus exitStatus() const;
// QIODevice
- qint64 bytesAvailable() const Q_DECL_OVERRIDE; // ### Qt6: remove trivial override
- qint64 bytesToWrite() const Q_DECL_OVERRIDE;
- bool isSequential() const Q_DECL_OVERRIDE;
- bool canReadLine() const Q_DECL_OVERRIDE; // ### Qt6: remove trivial override
- void close() Q_DECL_OVERRIDE;
- bool atEnd() const Q_DECL_OVERRIDE; // ### Qt6: remove trivial override
+ qint64 bytesAvailable() const override; // ### Qt6: remove trivial override
+ qint64 bytesToWrite() const override;
+ bool isSequential() const override;
+ bool canReadLine() const override; // ### Qt6: remove trivial override
+ void close() override;
+ bool atEnd() const override; // ### Qt6: remove trivial override
static int execute(const QString &program, const QStringList &arguments);
static int execute(const QString &command);
@@ -253,7 +253,7 @@ public:
#if defined(Q_QDOC)
= QString()
#endif
- , qint64 *pid = Q_NULLPTR);
+ , qint64 *pid = nullptr);
#if !defined(Q_QDOC)
static bool startDetached(const QString &program, const QStringList &arguments); // ### Qt6: merge overloads
#endif
@@ -286,8 +286,8 @@ protected:
virtual void setupChildProcess();
// QIODevice
- qint64 readData(char *data, qint64 maxlen) Q_DECL_OVERRIDE;
- qint64 writeData(const char *data, qint64 len) Q_DECL_OVERRIDE;
+ qint64 readData(char *data, qint64 maxlen) override;
+ qint64 writeData(const char *data, qint64 len) override;
private:
Q_DECLARE_PRIVATE(QProcess)
diff --git a/src/corelib/io/qprocess_p.h b/src/corelib/io/qprocess_p.h
index deb29dca0a..aa7ecbe91d 100644
--- a/src/corelib/io/qprocess_p.h
+++ b/src/corelib/io/qprocess_p.h
@@ -352,7 +352,7 @@ public:
#if defined(Q_OS_UNIX)
void execChild(const char *workingDirectory, char **argv, char **envp);
#endif
- bool processStarted(QString *errorMessage = Q_NULLPTR);
+ bool processStarted(QString *errorMessage = nullptr);
void terminateProcess();
void killProcess();
void findExitCode();
diff --git a/src/corelib/io/qprocess_unix.cpp b/src/corelib/io/qprocess_unix.cpp
index 15752f84b2..68b7a8bf9b 100644
--- a/src/corelib/io/qprocess_unix.cpp
+++ b/src/corelib/io/qprocess_unix.cpp
@@ -885,7 +885,7 @@ bool QProcessPrivate::waitForDeadChild()
// read the process information from our fd
forkfd_info info;
int ret;
- EINTR_LOOP(ret, forkfd_wait(forkfd, &info, Q_NULLPTR));
+ EINTR_LOOP(ret, forkfd_wait(forkfd, &info, nullptr));
exitCode = info.status;
crashed = info.code != CLD_EXITED;
diff --git a/src/corelib/io/qprocess_win.cpp b/src/corelib/io/qprocess_win.cpp
index 8da6d6b16e..6ab806d9fe 100644
--- a/src/corelib/io/qprocess_win.cpp
+++ b/src/corelib/io/qprocess_win.cpp
@@ -114,9 +114,7 @@ static void qt_create_pipe(Q_PIPE *pipe, bool isInputPipe)
dwOpenMode |= PIPE_ACCESS_INBOUND;
dwInputBufferSize = dwPipeBufferSize;
}
- DWORD dwPipeFlags = PIPE_TYPE_BYTE | PIPE_WAIT;
- if (QSysInfo::windowsVersion() >= QSysInfo::WV_VISTA)
- dwPipeFlags |= PIPE_REJECT_REMOTE_CLIENTS;
+ DWORD dwPipeFlags = PIPE_TYPE_BYTE | PIPE_WAIT | PIPE_REJECT_REMOTE_CLIENTS;
hServer = CreateNamedPipe(pipeName,
dwOpenMode,
dwPipeFlags,
diff --git a/src/corelib/io/qresource.cpp b/src/corelib/io/qresource.cpp
index 31f02e977d..35a0de4fb7 100644
--- a/src/corelib/io/qresource.cpp
+++ b/src/corelib/io/qresource.cpp
@@ -911,8 +911,8 @@ public:
inline QDynamicBufferResourceRoot(const QString &_root) : root(_root), buffer(0) { }
inline ~QDynamicBufferResourceRoot() { }
inline const uchar *mappingBuffer() const { return buffer; }
- virtual QString mappingRoot() const Q_DECL_OVERRIDE { return root; }
- virtual ResourceRootType type() const Q_DECL_OVERRIDE { return Resource_Buffer; }
+ virtual QString mappingRoot() const override { return root; }
+ virtual ResourceRootType type() const override { return Resource_Buffer; }
// size == -1 means "unknown"
bool registerSelf(const uchar *b, int size)
@@ -994,7 +994,7 @@ public:
}
}
QString mappingFile() const { return fileName; }
- virtual ResourceRootType type() const Q_DECL_OVERRIDE { return Resource_File; }
+ virtual ResourceRootType type() const override { return Resource_File; }
bool registerSelf(const QString &f) {
bool fromMM = false;
diff --git a/src/corelib/io/qresource_iterator_p.h b/src/corelib/io/qresource_iterator_p.h
index 6a4e215864..207a88b0ba 100644
--- a/src/corelib/io/qresource_iterator_p.h
+++ b/src/corelib/io/qresource_iterator_p.h
@@ -63,10 +63,10 @@ public:
QResourceFileEngineIterator(QDir::Filters filters, const QStringList &filterNames);
~QResourceFileEngineIterator();
- QString next() Q_DECL_OVERRIDE;
- bool hasNext() const Q_DECL_OVERRIDE;
+ QString next() override;
+ bool hasNext() const override;
- QString currentFileName() const Q_DECL_OVERRIDE;
+ QString currentFileName() const override;
private:
mutable QStringList entries;
diff --git a/src/corelib/io/qresource_p.h b/src/corelib/io/qresource_p.h
index e08ba64d2b..dcfe46704c 100644
--- a/src/corelib/io/qresource_p.h
+++ b/src/corelib/io/qresource_p.h
@@ -64,52 +64,52 @@ public:
explicit QResourceFileEngine(const QString &path);
~QResourceFileEngine();
- virtual void setFileName(const QString &file) Q_DECL_OVERRIDE;
+ virtual void setFileName(const QString &file) override;
- virtual bool open(QIODevice::OpenMode flags) Q_DECL_OVERRIDE ;
- virtual bool close() Q_DECL_OVERRIDE;
- virtual bool flush() Q_DECL_OVERRIDE;
- virtual qint64 size() const Q_DECL_OVERRIDE;
- virtual qint64 pos() const Q_DECL_OVERRIDE;
+ virtual bool open(QIODevice::OpenMode flags) override ;
+ virtual bool close() override;
+ virtual bool flush() override;
+ virtual qint64 size() const override;
+ virtual qint64 pos() const override;
virtual bool atEnd() const;
- virtual bool seek(qint64) Q_DECL_OVERRIDE;
- virtual qint64 read(char *data, qint64 maxlen) Q_DECL_OVERRIDE;
- virtual qint64 write(const char *data, qint64 len) Q_DECL_OVERRIDE;
+ virtual bool seek(qint64) override;
+ virtual qint64 read(char *data, qint64 maxlen) override;
+ virtual qint64 write(const char *data, qint64 len) override;
- virtual bool remove() Q_DECL_OVERRIDE;
- virtual bool copy(const QString &newName) Q_DECL_OVERRIDE;
- virtual bool rename(const QString &newName) Q_DECL_OVERRIDE;
- virtual bool link(const QString &newName) Q_DECL_OVERRIDE;
+ virtual bool remove() override;
+ virtual bool copy(const QString &newName) override;
+ virtual bool rename(const QString &newName) override;
+ virtual bool link(const QString &newName) override;
- virtual bool isSequential() const Q_DECL_OVERRIDE;
+ virtual bool isSequential() const override;
- virtual bool isRelativePath() const Q_DECL_OVERRIDE;
+ virtual bool isRelativePath() const override;
- virtual bool mkdir(const QString &dirName, bool createParentDirectories) const Q_DECL_OVERRIDE;
- virtual bool rmdir(const QString &dirName, bool recurseParentDirectories) const Q_DECL_OVERRIDE;
+ virtual bool mkdir(const QString &dirName, bool createParentDirectories) const override;
+ virtual bool rmdir(const QString &dirName, bool recurseParentDirectories) const override;
- virtual bool setSize(qint64 size) Q_DECL_OVERRIDE;
+ virtual bool setSize(qint64 size) override;
- virtual QStringList entryList(QDir::Filters filters, const QStringList &filterNames) const Q_DECL_OVERRIDE;
+ virtual QStringList entryList(QDir::Filters filters, const QStringList &filterNames) const override;
- virtual bool caseSensitive() const Q_DECL_OVERRIDE;
+ virtual bool caseSensitive() const override;
- virtual FileFlags fileFlags(FileFlags type) const Q_DECL_OVERRIDE;
+ virtual FileFlags fileFlags(FileFlags type) const override;
- virtual bool setPermissions(uint perms) Q_DECL_OVERRIDE;
+ virtual bool setPermissions(uint perms) override;
- virtual QString fileName(QAbstractFileEngine::FileName file) const Q_DECL_OVERRIDE;
+ virtual QString fileName(QAbstractFileEngine::FileName file) const override;
- virtual uint ownerId(FileOwner) const Q_DECL_OVERRIDE;
- virtual QString owner(FileOwner) const Q_DECL_OVERRIDE;
+ virtual uint ownerId(FileOwner) const override;
+ virtual QString owner(FileOwner) const override;
- virtual QDateTime fileTime(FileTime time) const Q_DECL_OVERRIDE;
+ virtual QDateTime fileTime(FileTime time) const override;
- virtual Iterator *beginEntryList(QDir::Filters filters, const QStringList &filterNames) Q_DECL_OVERRIDE;
- virtual Iterator *endEntryList() Q_DECL_OVERRIDE;
+ virtual Iterator *beginEntryList(QDir::Filters filters, const QStringList &filterNames) override;
+ virtual Iterator *endEntryList() override;
- bool extension(Extension extension, const ExtensionOption *option = 0, ExtensionReturn *output = 0) Q_DECL_OVERRIDE;
- bool supportsExtension(Extension extension) const Q_DECL_OVERRIDE;
+ bool extension(Extension extension, const ExtensionOption *option = 0, ExtensionReturn *output = 0) override;
+ bool supportsExtension(Extension extension) const override;
};
QT_END_NAMESPACE
diff --git a/src/corelib/io/qsavefile.h b/src/corelib/io/qsavefile.h
index 09d6e29272..200068d30d 100644
--- a/src/corelib/io/qsavefile.h
+++ b/src/corelib/io/qsavefile.h
@@ -67,15 +67,15 @@ public:
explicit QSaveFile(const QString &name);
#ifndef QT_NO_QOBJECT
- explicit QSaveFile(QObject *parent = Q_NULLPTR);
+ explicit QSaveFile(QObject *parent = nullptr);
explicit QSaveFile(const QString &name, QObject *parent);
#endif
~QSaveFile();
- QString fileName() const Q_DECL_OVERRIDE;
+ QString fileName() const override;
void setFileName(const QString &name);
- bool open(OpenMode flags) Q_DECL_OVERRIDE;
+ bool open(OpenMode flags) override;
bool commit();
void cancelWriting();
@@ -84,10 +84,10 @@ public:
bool directWriteFallback() const;
protected:
- qint64 writeData(const char *data, qint64 len) Q_DECL_OVERRIDE;
+ qint64 writeData(const char *data, qint64 len) override;
private:
- void close() Q_DECL_OVERRIDE;
+ void close() override;
#if !QT_CONFIG(translation)
static QString tr(const char *string) { return QString::fromLatin1(string); }
#endif
diff --git a/src/corelib/io/qsettings.h b/src/corelib/io/qsettings.h
index da5502e5ca..f34e6bea1b 100644
--- a/src/corelib/io/qsettings.h
+++ b/src/corelib/io/qsettings.h
@@ -125,13 +125,13 @@ public:
#ifndef QT_NO_QOBJECT
explicit QSettings(const QString &organization,
- const QString &application = QString(), QObject *parent = Q_NULLPTR);
+ const QString &application = QString(), QObject *parent = nullptr);
QSettings(Scope scope, const QString &organization,
- const QString &application = QString(), QObject *parent = Q_NULLPTR);
+ const QString &application = QString(), QObject *parent = nullptr);
QSettings(Format format, Scope scope, const QString &organization,
- const QString &application = QString(), QObject *parent = Q_NULLPTR);
- QSettings(const QString &fileName, Format format, QObject *parent = Q_NULLPTR);
- explicit QSettings(QObject *parent = Q_NULLPTR);
+ const QString &application = QString(), QObject *parent = nullptr);
+ QSettings(const QString &fileName, Format format, QObject *parent = nullptr);
+ explicit QSettings(QObject *parent = nullptr);
#else
explicit QSettings(const QString &organization,
const QString &application = QString());
@@ -199,7 +199,7 @@ public:
protected:
#ifndef QT_NO_QOBJECT
- bool event(QEvent *event) Q_DECL_OVERRIDE;
+ bool event(QEvent *event) override;
#endif
private:
diff --git a/src/corelib/io/qsettings_mac.cpp b/src/corelib/io/qsettings_mac.cpp
index 2a08ee2e64..aa14d8435a 100644
--- a/src/corelib/io/qsettings_mac.cpp
+++ b/src/corelib/io/qsettings_mac.cpp
@@ -616,7 +616,7 @@ bool QConfFileSettingsPrivate::readPlistFile(const QByteArray &data, ParsedSetti
{
QCFType<CFDataRef> cfData = data.toRawCFData();
QCFType<CFPropertyListRef> propertyList =
- CFPropertyListCreateWithData(kCFAllocatorDefault, cfData, kCFPropertyListImmutable, Q_NULLPTR, Q_NULLPTR);
+ CFPropertyListCreateWithData(kCFAllocatorDefault, cfData, kCFPropertyListImmutable, nullptr, nullptr);
if (!propertyList)
return true;
diff --git a/src/corelib/io/qsettings_p.h b/src/corelib/io/qsettings_p.h
index 7923c24770..d18c96a06c 100644
--- a/src/corelib/io/qsettings_p.h
+++ b/src/corelib/io/qsettings_p.h
@@ -261,17 +261,17 @@ public:
QConfFileSettingsPrivate(const QString &fileName, QSettings::Format format);
~QConfFileSettingsPrivate();
- void remove(const QString &key) Q_DECL_OVERRIDE;
- void set(const QString &key, const QVariant &value) Q_DECL_OVERRIDE;
- bool get(const QString &key, QVariant *value) const Q_DECL_OVERRIDE;
+ void remove(const QString &key) override;
+ void set(const QString &key, const QVariant &value) override;
+ bool get(const QString &key, QVariant *value) const override;
- QStringList children(const QString &prefix, ChildSpec spec) const Q_DECL_OVERRIDE;
+ QStringList children(const QString &prefix, ChildSpec spec) const override;
- void clear() Q_DECL_OVERRIDE;
- void sync() Q_DECL_OVERRIDE;
- void flush() Q_DECL_OVERRIDE;
- bool isWritable() const Q_DECL_OVERRIDE;
- QString fileName() const Q_DECL_OVERRIDE;
+ void clear() override;
+ void sync() override;
+ void flush() override;
+ bool isWritable() const override;
+ QString fileName() const override;
bool readIniFile(const QByteArray &data, UnparsedSettingsMap *unparsedIniSections);
static bool readIniSection(const QSettingsKey &section, const QByteArray &data,
diff --git a/src/corelib/io/qstandardpaths_mac.mm b/src/corelib/io/qstandardpaths_mac.mm
index e25339a7d1..3bb7a7877a 100644
--- a/src/corelib/io/qstandardpaths_mac.mm
+++ b/src/corelib/io/qstandardpaths_mac.mm
@@ -203,28 +203,17 @@ QStringList QStandardPaths::standardLocations(StandardLocation type)
if (type == AppDataLocation || type == AppLocalDataLocation) {
CFBundleRef mainBundle = CFBundleGetMainBundle();
if (mainBundle) {
- CFURLRef bundleUrl = CFBundleCopyBundleURL(mainBundle);
- CFStringRef cfBundlePath = CFURLCopyFileSystemPath(bundleUrl, kCFURLPOSIXPathStyle);
- QString bundlePath = QString::fromCFString(cfBundlePath);
- CFRelease(cfBundlePath);
- CFRelease(bundleUrl);
-
- CFURLRef resourcesUrl = CFBundleCopyResourcesDirectoryURL(mainBundle);
- CFStringRef cfResourcesPath = CFURLCopyFileSystemPath(resourcesUrl,
- kCFURLPOSIXPathStyle);
- QString resourcesPath = QString::fromCFString(cfResourcesPath);
- CFRelease(cfResourcesPath);
- CFRelease(resourcesUrl);
-
- // Handle bundled vs unbundled executables. CFBundleGetMainBundle() returns
- // a valid bundle in both cases. CFBundleCopyResourcesDirectoryURL() returns
- // an absolute path for unbundled executables.
- if (resourcesPath.startsWith(QLatin1Char('/')))
- dirs.append(resourcesPath);
- else
- dirs.append(bundlePath + resourcesPath);
+ if (QCFType<CFURLRef> resourcesURL = CFBundleCopyResourcesDirectoryURL(mainBundle)) {
+ if (QCFType<CFURLRef> absoluteResouresURL = CFURLCopyAbsoluteURL(resourcesURL)) {
+ if (QCFType<CFStringRef> path = CFURLCopyFileSystemPath(absoluteResouresURL,
+ kCFURLPOSIXPathStyle)) {
+ dirs.append(QString::fromCFString(path));
+ }
+ }
+ }
}
}
+
const QString localDir = writableLocation(type);
if (!localDir.isEmpty())
dirs.prepend(localDir);
diff --git a/src/corelib/io/qstandardpaths_unix.cpp b/src/corelib/io/qstandardpaths_unix.cpp
index d06778e2a1..e49edd9a40 100644
--- a/src/corelib/io/qstandardpaths_unix.cpp
+++ b/src/corelib/io/qstandardpaths_unix.cpp
@@ -170,7 +170,7 @@ QString QStandardPaths::writableLocation(StandardLocation type)
break;
}
-#ifndef QT_BOOTSTRAPPED
+#if QT_CONFIG(regularexpression)
// http://www.freedesktop.org/wiki/Software/xdg-user-dirs
QString xdgConfigHome = QFile::decodeName(qgetenv("XDG_CONFIG_HOME"));
if (xdgConfigHome.isEmpty())
@@ -232,7 +232,7 @@ QString QStandardPaths::writableLocation(StandardLocation type)
}
}
}
-#endif
+#endif // QT_CONFIG(regularexpression)
QString path;
switch (type) {
diff --git a/src/corelib/io/qstorageinfo_mac.cpp b/src/corelib/io/qstorageinfo_mac.cpp
index 0f271f2bc6..8b06543d71 100644
--- a/src/corelib/io/qstorageinfo_mac.cpp
+++ b/src/corelib/io/qstorageinfo_mac.cpp
@@ -112,7 +112,7 @@ void QStorageInfoPrivate::retrieveUrlProperties(bool initRootPath)
QCFType<CFArrayRef> keys = CFArrayCreate(kCFAllocatorDefault,
initRootPath ? rootPathKeys : propertyKeys,
size,
- Q_NULLPTR);
+ nullptr);
if (!keys)
return;
@@ -178,9 +178,9 @@ QList<QStorageInfo> QStorageInfoPrivate::mountedVolumes()
QList<QStorageInfo> volumes;
QCFType<CFURLEnumeratorRef> enumerator;
- enumerator = CFURLEnumeratorCreateForMountedVolumes(Q_NULLPTR,
+ enumerator = CFURLEnumeratorCreateForMountedVolumes(nullptr,
kCFURLEnumeratorSkipInvisibles,
- Q_NULLPTR);
+ nullptr);
CFURLEnumeratorResult result = kCFURLEnumeratorSuccess;
do {
diff --git a/src/corelib/io/qstorageinfo_unix.cpp b/src/corelib/io/qstorageinfo_unix.cpp
index c2d31e7677..7664b77d81 100644
--- a/src/corelib/io/qstorageinfo_unix.cpp
+++ b/src/corelib/io/qstorageinfo_unix.cpp
@@ -45,6 +45,7 @@
#include <QtCore/qtextstream.h>
#include <QtCore/private/qcore_unix_p.h>
+#include <QtCore/private/qlocale_tools_p.h>
#include <errno.h>
#include <sys/stat.h>
@@ -128,6 +129,7 @@ public:
inline QByteArray fileSystemType() const;
inline QByteArray device() const;
inline QByteArray options() const;
+ inline QByteArray subvolume() const;
private:
#if defined(Q_OS_BSD4)
QT_STATFSBUF *stat_buf;
@@ -143,9 +145,36 @@ private:
QByteArray m_device;
QByteArray m_options;
#elif defined(Q_OS_LINUX) || defined(Q_OS_HURD)
+ struct mountinfoent : public mntent {
+ // Details from proc(5) section from /proc/<pid>/mountinfo:
+ //(1) mount ID: a unique ID for the mount (may be reused after umount(2)).
+ int mount_id;
+ //(2) parent ID: the ID of the parent mount (or of self for the top of the mount tree).
+// int parent_id;
+ //(3) major:minor: the value of st_dev for files on this filesystem (see stat(2)).
+// dev_t rdev;
+ //(4) root: the pathname of the directory in the filesystem which forms the root of this mount.
+ char *subvolume;
+ //(5) mount point: the pathname of the mount point relative to the process's root directory.
+// char *mnt_dir; // in mntent
+ //(6) mount options: per-mount options.
+// char *mnt_opts; // in mntent
+ //(7) optional fields: zero or more fields of the form "tag[:value]"; see below.
+// int flags;
+ //(8) separator: the end of the optional fields is marked by a single hyphen.
+
+ //(9) filesystem type: the filesystem type in the form "type[.subtype]".
+// char *mnt_type; // in mntent
+ //(10) mount source: filesystem-specific information or "none".
+// char *mnt_fsname; // in mntent
+ //(11) super options: per-superblock options.
+ char *superopts;
+ };
+
FILE *fp;
- mntent mnt;
QByteArray buffer;
+ mountinfoent mnt;
+ bool usingMountinfo;
#elif defined(Q_OS_HAIKU)
BVolumeRoster m_volumeRoster;
@@ -246,6 +275,10 @@ inline QByteArray QStorageIterator::options() const
return QByteArray();
}
+inline QByteArray QStorageIterator::subvolume() const
+{
+ return QByteArray();
+}
#elif defined(Q_OS_SOLARIS)
inline QStorageIterator::QStorageIterator()
@@ -262,7 +295,7 @@ inline QStorageIterator::~QStorageIterator()
inline bool QStorageIterator::isValid() const
{
- return fp != Q_NULLPTR;
+ return fp != nullptr;
}
inline bool QStorageIterator::next()
@@ -285,6 +318,10 @@ inline QByteArray QStorageIterator::device() const
return QByteArray(mnt.mnt_mntopts);
}
+inline QByteArray QStorageIterator::subvolume() const
+{
+ return QByteArray();
+}
#elif defined(Q_OS_ANDROID)
inline QStorageIterator::QStorageIterator()
@@ -340,6 +377,10 @@ inline QByteArray QStorageIterator::options() const
return m_options;
}
+inline QByteArray QStorageIterator::subvolume() const
+{
+ return QByteArray();
+}
#elif defined(Q_OS_LINUX) || defined(Q_OS_HURD)
static const int bufferSize = 1024; // 2 paths (mount point+device) and metainfo;
@@ -348,23 +389,158 @@ static const int bufferSize = 1024; // 2 paths (mount point+device) and metainfo
inline QStorageIterator::QStorageIterator() :
buffer(QByteArray(bufferSize, 0))
{
- fp = ::setmntent(_PATH_MOUNTED, "r");
+ fp = nullptr;
+
+#ifdef Q_OS_LINUX
+ // first, try to open /proc/self/mountinfo, which has more details
+ fp = ::fopen("/proc/self/mountinfo", "re");
+#endif
+ if (fp) {
+ usingMountinfo = true;
+ } else {
+ usingMountinfo = false;
+ fp = ::setmntent(_PATH_MOUNTED, "r");
+ }
}
inline QStorageIterator::~QStorageIterator()
{
- if (fp)
- ::endmntent(fp);
+ if (fp) {
+ if (usingMountinfo)
+ ::fclose(fp);
+ else
+ ::endmntent(fp);
+ }
}
inline bool QStorageIterator::isValid() const
{
- return fp != Q_NULLPTR;
+ return fp != nullptr;
}
inline bool QStorageIterator::next()
{
- return ::getmntent_r(fp, &mnt, buffer.data(), buffer.size()) != Q_NULLPTR;
+ mnt.subvolume = nullptr;
+ mnt.superopts = nullptr;
+ if (!usingMountinfo)
+ return ::getmntent_r(fp, &mnt, buffer.data(), buffer.size()) != nullptr;
+
+ // Helper function to parse paths that the kernel inserts escape sequences
+ // for. The unescaped string is left at \a src and is properly
+ // NUL-terminated. Returns a pointer to the delimiter that terminated the
+ // path, or nullptr if it failed.
+ auto parseMangledPath = [](char *src) {
+ // The kernel escapes with octal the following characters:
+ // space ' ', tab '\t', backslask '\\', and newline '\n'
+ char *dst = src;
+ while (*src) {
+ switch (*src) {
+ case ' ':
+ // Unescaped space: end of the field.
+ *dst = '\0';
+ return src;
+
+ default:
+ *dst++ = *src++;
+ break;
+
+ case '\\':
+ // It always uses exactly three octal characters.
+ ++src;
+ char c = (*src++ - '0') << 6;
+ c |= (*src++ - '0') << 3;
+ c |= (*src++ - '0');
+ *dst++ = c;
+ break;
+ }
+ }
+
+ // Found a NUL before the end of the field.
+ src = nullptr;
+ return src;
+ };
+
+ char *ptr = buffer.data();
+ if (fgets(ptr, buffer.size(), fp) == nullptr)
+ return false;
+
+ size_t len = strlen(buffer.data());
+ if (len == 0)
+ return false;
+ if (ptr[len - 1] == '\n')
+ ptr[len - 1] = '\0';
+
+ // parse the line
+ bool ok;
+ mnt.mnt_freq = 0;
+ mnt.mnt_passno = 0;
+
+ mnt.mount_id = qstrtoll(ptr, const_cast<const char **>(&ptr), 10, &ok);
+ if (!ptr || !ok)
+ return false;
+
+ int parent_id = qstrtoll(ptr, const_cast<const char **>(&ptr), 10, &ok);
+ Q_UNUSED(parent_id);
+ if (!ptr || !ok)
+ return false;
+
+ int rdevmajor = qstrtoll(ptr, const_cast<const char **>(&ptr), 10, &ok);
+ if (!ptr || !ok)
+ return false;
+ if (*ptr != ':')
+ return false;
+ int rdevminor = qstrtoll(ptr + 1, const_cast<const char **>(&ptr), 10, &ok);
+ if (!ptr || !ok)
+ return false;
+ Q_UNUSED(rdevmajor);
+ Q_UNUSED(rdevminor);
+
+ if (*ptr != ' ')
+ return false;
+
+ mnt.subvolume = ++ptr;
+ ptr = parseMangledPath(ptr);
+ if (!ptr)
+ return false;
+
+ // unset a subvolume of "/" -- it's not a *sub* volume
+ if (mnt.subvolume + 1 == ptr)
+ *mnt.subvolume = '\0';
+
+ mnt.mnt_dir = ++ptr;
+ ptr = parseMangledPath(ptr);
+ if (!ptr)
+ return false;
+
+ mnt.mnt_opts = ++ptr;
+ ptr = strchr(ptr, ' ');
+ if (!ptr)
+ return false;
+
+ // we don't parse the flags, so just find the separator
+ if (char *const dashed = strstr(ptr, " - ")) {
+ *ptr = '\0';
+ ptr = dashed + strlen(" - ") - 1;
+ } else {
+ return false;
+ }
+
+ mnt.mnt_type = ++ptr;
+ ptr = strchr(ptr, ' ');
+ if (!ptr)
+ return false;
+ *ptr = '\0';
+
+ mnt.mnt_fsname = ++ptr;
+ ptr = parseMangledPath(ptr);
+ if (!ptr)
+ return false;
+
+ mnt.superopts = ++ptr;
+ ptr += strcspn(ptr, " \n");
+ *ptr = '\0';
+
+ return true;
}
inline QString QStorageIterator::rootPath() const
@@ -384,9 +560,28 @@ inline QByteArray QStorageIterator::device() const
inline QByteArray QStorageIterator::options() const
{
+ // Merge the two options, starting with the superblock options and letting
+ // the per-mount options override.
+ const char *superopts = mnt.superopts;
+
+ // Both mnt_opts and superopts start with "ro" or "rw", so we can skip the
+ // superblock's field (see show_mountinfo() in fs/proc_namespace.c).
+ if (superopts && superopts[0] == 'r') {
+ if (superopts[2] == '\0') // no other superopts besides "ro" / "rw"?
+ superopts = nullptr;
+ else if (superopts[2] == ',')
+ superopts += 3;
+ }
+
+ if (superopts)
+ return QByteArray(superopts) + ',' + mnt.mnt_opts;
return QByteArray(mnt.mnt_opts);
}
+inline QByteArray QStorageIterator::subvolume() const
+{
+ return QByteArray(mnt.subvolume);
+}
#elif defined(Q_OS_HAIKU)
inline QStorageIterator::QStorageIterator()
{
@@ -449,6 +644,10 @@ inline QByteArray QStorageIterator::options() const
return QByteArray();
}
+inline QByteArray QStorageIterator::subvolume() const
+{
+ return QByteArray();
+}
#else
inline QStorageIterator::QStorageIterator()
@@ -489,31 +688,11 @@ inline QByteArray QStorageIterator::options() const
return QByteArray();
}
-#endif
-
-static QByteArray extractSubvolume(const QStorageIterator &it)
+inline QByteArray QStorageIterator::subvolume() const
{
-#ifdef Q_OS_LINUX
- if (it.fileSystemType() == "btrfs") {
- const QByteArrayList opts = it.options().split(',');
- QByteArray id;
- for (const QByteArray &opt : opts) {
- static const char subvol[] = "subvol=";
- static const char subvolid[] = "subvolid=";
- if (opt.startsWith(subvol))
- return std::move(opt).mid(strlen(subvol));
- if (opt.startsWith(subvolid))
- id = std::move(opt).mid(strlen(subvolid));
- }
-
- // if we didn't find the subvolume name, return the subvolume ID
- return id;
- }
-#else
- Q_UNUSED(it);
-#endif
return QByteArray();
}
+#endif
void QStorageInfoPrivate::initRootPath()
{
@@ -541,7 +720,7 @@ void QStorageInfoPrivate::initRootPath()
rootPath = mountDir;
device = it.device();
fileSystemType = fsName;
- subvolume = extractSubvolume(it);
+ subvolume = it.subvolume();
}
}
}
diff --git a/src/corelib/io/qstorageinfo_win.cpp b/src/corelib/io/qstorageinfo_win.cpp
index 3830c5480c..8a3db90f87 100644
--- a/src/corelib/io/qstorageinfo_win.cpp
+++ b/src/corelib/io/qstorageinfo_win.cpp
@@ -147,8 +147,8 @@ void QStorageInfoPrivate::retrieveVolumeInfo()
const bool result = ::GetVolumeInformation(reinterpret_cast<const wchar_t *>(path.utf16()),
nameBuffer,
defaultBufferSize,
- Q_NULLPTR,
- Q_NULLPTR,
+ nullptr,
+ nullptr,
&fileSystemFlags,
fileSystemTypeBuffer,
defaultBufferSize);
diff --git a/src/corelib/io/qtemporarydir.cpp b/src/corelib/io/qtemporarydir.cpp
index 2779246c5b..ed52472ab3 100644
--- a/src/corelib/io/qtemporarydir.cpp
+++ b/src/corelib/io/qtemporarydir.cpp
@@ -42,12 +42,12 @@
#ifndef QT_NO_TEMPORARYFILE
+#include "qdebug.h"
#include "qdiriterator.h"
+#include "qpair.h"
#include "qplatformdefs.h"
+#include "qrandom.h"
#include "private/qtemporaryfile_p.h"
-#include <QDebug>
-#include <QPair>
-#include <QRandomGenerator>
#if defined(QT_BUILD_CORE_LIB)
#include "qcoreapplication.h"
diff --git a/src/corelib/io/qtemporarydir.h b/src/corelib/io/qtemporarydir.h
index 3f6b70a2eb..5864ce5cfc 100644
--- a/src/corelib/io/qtemporarydir.h
+++ b/src/corelib/io/qtemporarydir.h
@@ -41,7 +41,7 @@
#define QTEMPORARYDIR_H
#include <QtCore/qdir.h>
-#include <QtCore/QScopedPointer>
+#include <QtCore/qscopedpointer.h>
QT_BEGIN_NAMESPACE
diff --git a/src/corelib/io/qtemporaryfile.h b/src/corelib/io/qtemporaryfile.h
index 7fc5a299fc..90a6a613e6 100644
--- a/src/corelib/io/qtemporaryfile.h
+++ b/src/corelib/io/qtemporaryfile.h
@@ -77,7 +77,7 @@ public:
// ### Hides open(flags)
bool open() { return open(QIODevice::ReadWrite); }
- QString fileName() const Q_DECL_OVERRIDE;
+ QString fileName() const override;
QString fileTemplate() const;
void setFileTemplate(const QString &name);
@@ -95,7 +95,7 @@ public:
static QTemporaryFile *createNativeFile(QFile &file);
protected:
- bool open(OpenMode flags) Q_DECL_OVERRIDE;
+ bool open(OpenMode flags) override;
private:
friend class QFile;
diff --git a/src/corelib/io/qtextstream.h b/src/corelib/io/qtextstream.h
index e72b7942fd..ee0b09419d 100644
--- a/src/corelib/io/qtextstream.h
+++ b/src/corelib/io/qtextstream.h
@@ -212,8 +212,8 @@ typedef void (QTextStream::*QTSMFC)(QChar); // manipulator w/QChar argument
class Q_CORE_EXPORT QTextStreamManipulator
{
public:
- Q_DECL_CONSTEXPR QTextStreamManipulator(QTSMFI m, int a) Q_DECL_NOTHROW : mf(m), mc(Q_NULLPTR), arg(a), ch() {}
- Q_DECL_CONSTEXPR QTextStreamManipulator(QTSMFC m, QChar c) Q_DECL_NOTHROW : mf(Q_NULLPTR), mc(m), arg(-1), ch(c) {}
+ Q_DECL_CONSTEXPR QTextStreamManipulator(QTSMFI m, int a) Q_DECL_NOTHROW : mf(m), mc(nullptr), arg(a), ch() {}
+ Q_DECL_CONSTEXPR QTextStreamManipulator(QTSMFC m, QChar c) Q_DECL_NOTHROW : mf(nullptr), mc(m), arg(-1), ch(c) {}
void exec(QTextStream &s) { if (mf) { (s.*mf)(arg); } else { (s.*mc)(ch); } }
private:
diff --git a/src/corelib/io/qurl.h b/src/corelib/io/qurl.h
index 0bb8707ff9..5062ef7905 100644
--- a/src/corelib/io/qurl.h
+++ b/src/corelib/io/qurl.h
@@ -184,7 +184,7 @@ public:
#endif
#ifdef Q_COMPILER_RVALUE_REFS
QUrl(QUrl &&other) Q_DECL_NOTHROW : d(other.d)
- { other.d = Q_NULLPTR; }
+ { other.d = nullptr; }
inline QUrl &operator=(QUrl &&other) Q_DECL_NOTHROW
{ qSwap(d, other.d); return *this; }
#endif
diff --git a/src/corelib/itemmodels/qabstractitemmodel.cpp b/src/corelib/itemmodels/qabstractitemmodel.cpp
index f893cf06e3..7e1ab851d7 100644
--- a/src/corelib/itemmodels/qabstractitemmodel.cpp
+++ b/src/corelib/itemmodels/qabstractitemmodel.cpp
@@ -482,12 +482,12 @@ class QEmptyItemModel : public QAbstractItemModel
{
public:
explicit QEmptyItemModel(QObject *parent = 0) : QAbstractItemModel(parent) {}
- QModelIndex index(int, int, const QModelIndex &) const Q_DECL_OVERRIDE { return QModelIndex(); }
- QModelIndex parent(const QModelIndex &) const Q_DECL_OVERRIDE { return QModelIndex(); }
- int rowCount(const QModelIndex &) const Q_DECL_OVERRIDE { return 0; }
- int columnCount(const QModelIndex &) const Q_DECL_OVERRIDE { return 0; }
- bool hasChildren(const QModelIndex &) const Q_DECL_OVERRIDE { return false; }
- QVariant data(const QModelIndex &, int) const Q_DECL_OVERRIDE { return QVariant(); }
+ QModelIndex index(int, int, const QModelIndex &) const override { return QModelIndex(); }
+ QModelIndex parent(const QModelIndex &) const override { return QModelIndex(); }
+ int rowCount(const QModelIndex &) const override { return 0; }
+ int columnCount(const QModelIndex &) const override { return 0; }
+ bool hasChildren(const QModelIndex &) const override { return false; }
+ QVariant data(const QModelIndex &, int) const override { return QVariant(); }
};
Q_GLOBAL_STATIC(QEmptyItemModel, qEmptyModel)
@@ -2686,6 +2686,7 @@ bool QAbstractItemModel::decodeData(int row, int column, const QModelIndex &pare
void QAbstractItemModel::beginInsertRows(const QModelIndex &parent, int first, int last)
{
Q_ASSERT(first >= 0);
+ Q_ASSERT(first <= rowCount(parent)); // == is allowed, to insert at the end
Q_ASSERT(last >= first);
Q_D(QAbstractItemModel);
d->changes.push(QAbstractItemModelPrivate::Change(parent, first, last));
@@ -2741,6 +2742,7 @@ void QAbstractItemModel::beginRemoveRows(const QModelIndex &parent, int first, i
{
Q_ASSERT(first >= 0);
Q_ASSERT(last >= first);
+ Q_ASSERT(last < rowCount(parent));
Q_D(QAbstractItemModel);
d->changes.push(QAbstractItemModelPrivate::Change(parent, first, last));
emit rowsAboutToBeRemoved(parent, first, last, QPrivateSignal());
@@ -2987,6 +2989,7 @@ void QAbstractItemModel::endMoveRows()
void QAbstractItemModel::beginInsertColumns(const QModelIndex &parent, int first, int last)
{
Q_ASSERT(first >= 0);
+ Q_ASSERT(first <= columnCount(parent)); // == is allowed, to insert at the end
Q_ASSERT(last >= first);
Q_D(QAbstractItemModel);
d->changes.push(QAbstractItemModelPrivate::Change(parent, first, last));
@@ -3043,6 +3046,7 @@ void QAbstractItemModel::beginRemoveColumns(const QModelIndex &parent, int first
{
Q_ASSERT(first >= 0);
Q_ASSERT(last >= first);
+ Q_ASSERT(last < columnCount(parent));
Q_D(QAbstractItemModel);
d->changes.push(QAbstractItemModelPrivate::Change(parent, first, last));
emit columnsAboutToBeRemoved(parent, first, last, QPrivateSignal());
diff --git a/src/corelib/itemmodels/qabstractitemmodel.h b/src/corelib/itemmodels/qabstractitemmodel.h
index a211d8e8ca..cd294ef8fa 100644
--- a/src/corelib/itemmodels/qabstractitemmodel.h
+++ b/src/corelib/itemmodels/qabstractitemmodel.h
@@ -55,7 +55,7 @@ class Q_CORE_EXPORT QModelIndex
{
friend class QAbstractItemModel;
public:
- Q_DECL_CONSTEXPR inline QModelIndex() Q_DECL_NOTHROW : r(-1), c(-1), i(0), m(Q_NULLPTR) {}
+ Q_DECL_CONSTEXPR inline QModelIndex() Q_DECL_NOTHROW : r(-1), c(-1), i(0), m(nullptr) {}
// compiler-generated copy/move ctors/assignment operators are fine!
Q_DECL_CONSTEXPR inline int row() const Q_DECL_NOTHROW { return r; }
Q_DECL_CONSTEXPR inline int column() const Q_DECL_NOTHROW { return c; }
@@ -69,7 +69,7 @@ public:
inline QVariant data(int role = Qt::DisplayRole) const;
inline Qt::ItemFlags flags() const;
Q_DECL_CONSTEXPR inline const QAbstractItemModel *model() const Q_DECL_NOTHROW { return m; }
- Q_DECL_CONSTEXPR inline bool isValid() const Q_DECL_NOTHROW { return (r >= 0) && (c >= 0) && (m != Q_NULLPTR); }
+ Q_DECL_CONSTEXPR inline bool isValid() const Q_DECL_NOTHROW { return (r >= 0) && (c >= 0) && (m != nullptr); }
Q_DECL_CONSTEXPR inline bool operator==(const QModelIndex &other) const Q_DECL_NOTHROW
{ return (other.r == r) && (other.i == i) && (other.c == c) && (other.m == m); }
Q_DECL_CONSTEXPR inline bool operator!=(const QModelIndex &other) const Q_DECL_NOTHROW
@@ -115,7 +115,7 @@ public:
QPersistentModelIndex &operator=(const QPersistentModelIndex &other);
#ifdef Q_COMPILER_RVALUE_REFS
inline QPersistentModelIndex(QPersistentModelIndex &&other) Q_DECL_NOTHROW
- : d(other.d) { other.d = Q_NULLPTR; }
+ : d(other.d) { other.d = nullptr; }
inline QPersistentModelIndex &operator=(QPersistentModelIndex &&other) Q_DECL_NOTHROW
{ qSwap(d, other.d); return *this; }
#endif
@@ -171,7 +171,7 @@ class Q_CORE_EXPORT QAbstractItemModel : public QObject
friend class QIdentityProxyModel;
public:
- explicit QAbstractItemModel(QObject *parent = Q_NULLPTR);
+ explicit QAbstractItemModel(QObject *parent = nullptr);
virtual ~QAbstractItemModel();
Q_INVOKABLE bool hasIndex(int row, int column, const QModelIndex &parent = QModelIndex()) const;
@@ -286,9 +286,9 @@ protected Q_SLOTS:
void resetInternalData();
protected:
- QAbstractItemModel(QAbstractItemModelPrivate &dd, QObject *parent = Q_NULLPTR);
+ QAbstractItemModel(QAbstractItemModelPrivate &dd, QObject *parent = nullptr);
- inline QModelIndex createIndex(int row, int column, void *data = Q_NULLPTR) const;
+ inline QModelIndex createIndex(int row, int column, void *data = nullptr) const;
inline QModelIndex createIndex(int row, int column, quintptr id) const;
void encodeData(const QModelIndexList &indexes, QDataStream &stream) const;
@@ -367,15 +367,15 @@ class Q_CORE_EXPORT QAbstractTableModel : public QAbstractItemModel
Q_OBJECT
public:
- explicit QAbstractTableModel(QObject *parent = Q_NULLPTR);
+ explicit QAbstractTableModel(QObject *parent = nullptr);
~QAbstractTableModel();
- QModelIndex index(int row, int column, const QModelIndex &parent = QModelIndex()) const Q_DECL_OVERRIDE;
- QModelIndex sibling(int row, int column, const QModelIndex &idx) const Q_DECL_OVERRIDE;
+ QModelIndex index(int row, int column, const QModelIndex &parent = QModelIndex()) const override;
+ QModelIndex sibling(int row, int column, const QModelIndex &idx) const override;
bool dropMimeData(const QMimeData *data, Qt::DropAction action,
- int row, int column, const QModelIndex &parent) Q_DECL_OVERRIDE;
+ int row, int column, const QModelIndex &parent) override;
- Qt::ItemFlags flags(const QModelIndex &index) const Q_DECL_OVERRIDE;
+ Qt::ItemFlags flags(const QModelIndex &index) const override;
using QObject::parent;
@@ -384,8 +384,8 @@ protected:
private:
Q_DISABLE_COPY(QAbstractTableModel)
- QModelIndex parent(const QModelIndex &child) const Q_DECL_OVERRIDE;
- bool hasChildren(const QModelIndex &parent) const Q_DECL_OVERRIDE;
+ QModelIndex parent(const QModelIndex &child) const override;
+ bool hasChildren(const QModelIndex &parent) const override;
};
class Q_CORE_EXPORT QAbstractListModel : public QAbstractItemModel
@@ -393,15 +393,15 @@ class Q_CORE_EXPORT QAbstractListModel : public QAbstractItemModel
Q_OBJECT
public:
- explicit QAbstractListModel(QObject *parent = Q_NULLPTR);
+ explicit QAbstractListModel(QObject *parent = nullptr);
~QAbstractListModel();
- QModelIndex index(int row, int column = 0, const QModelIndex &parent = QModelIndex()) const Q_DECL_OVERRIDE;
- QModelIndex sibling(int row, int column, const QModelIndex &idx) const Q_DECL_OVERRIDE;
+ QModelIndex index(int row, int column = 0, const QModelIndex &parent = QModelIndex()) const override;
+ QModelIndex sibling(int row, int column, const QModelIndex &idx) const override;
bool dropMimeData(const QMimeData *data, Qt::DropAction action,
- int row, int column, const QModelIndex &parent) Q_DECL_OVERRIDE;
+ int row, int column, const QModelIndex &parent) override;
- Qt::ItemFlags flags(const QModelIndex &index) const Q_DECL_OVERRIDE;
+ Qt::ItemFlags flags(const QModelIndex &index) const override;
using QObject::parent;
@@ -410,9 +410,9 @@ protected:
private:
Q_DISABLE_COPY(QAbstractListModel)
- QModelIndex parent(const QModelIndex &child) const Q_DECL_OVERRIDE;
- int columnCount(const QModelIndex &parent) const Q_DECL_OVERRIDE;
- bool hasChildren(const QModelIndex &parent) const Q_DECL_OVERRIDE;
+ QModelIndex parent(const QModelIndex &child) const override;
+ int columnCount(const QModelIndex &parent) const override;
+ bool hasChildren(const QModelIndex &parent) const override;
};
// inline implementations
diff --git a/src/corelib/itemmodels/qabstractproxymodel.h b/src/corelib/itemmodels/qabstractproxymodel.h
index c9eafa09ee..6aa82b21ee 100644
--- a/src/corelib/itemmodels/qabstractproxymodel.h
+++ b/src/corelib/itemmodels/qabstractproxymodel.h
@@ -56,7 +56,7 @@ class Q_CORE_EXPORT QAbstractProxyModel : public QAbstractItemModel
Q_PROPERTY(QAbstractItemModel* sourceModel READ sourceModel WRITE setSourceModel NOTIFY sourceModelChanged)
public:
- explicit QAbstractProxyModel(QObject *parent = Q_NULLPTR);
+ explicit QAbstractProxyModel(QObject *parent = nullptr);
~QAbstractProxyModel();
virtual void setSourceModel(QAbstractItemModel *sourceModel);
@@ -68,34 +68,34 @@ public:
Q_INVOKABLE virtual QItemSelection mapSelectionToSource(const QItemSelection &selection) const;
Q_INVOKABLE virtual QItemSelection mapSelectionFromSource(const QItemSelection &selection) const;
- bool submit() Q_DECL_OVERRIDE;
- void revert() Q_DECL_OVERRIDE;
+ bool submit() override;
+ void revert() override;
- QVariant data(const QModelIndex &proxyIndex, int role = Qt::DisplayRole) const Q_DECL_OVERRIDE;
- QVariant headerData(int section, Qt::Orientation orientation, int role = Qt::DisplayRole) const Q_DECL_OVERRIDE;
- QMap<int, QVariant> itemData(const QModelIndex &index) const Q_DECL_OVERRIDE;
- Qt::ItemFlags flags(const QModelIndex &index) const Q_DECL_OVERRIDE;
+ QVariant data(const QModelIndex &proxyIndex, int role = Qt::DisplayRole) const override;
+ QVariant headerData(int section, Qt::Orientation orientation, int role = Qt::DisplayRole) const override;
+ QMap<int, QVariant> itemData(const QModelIndex &index) const override;
+ Qt::ItemFlags flags(const QModelIndex &index) const override;
- bool setData(const QModelIndex &index, const QVariant &value, int role = Qt::EditRole) Q_DECL_OVERRIDE;
- bool setItemData(const QModelIndex& index, const QMap<int, QVariant> &roles) Q_DECL_OVERRIDE;
- bool setHeaderData(int section, Qt::Orientation orientation, const QVariant &value, int role = Qt::EditRole) Q_DECL_OVERRIDE;
+ bool setData(const QModelIndex &index, const QVariant &value, int role = Qt::EditRole) override;
+ bool setItemData(const QModelIndex& index, const QMap<int, QVariant> &roles) override;
+ bool setHeaderData(int section, Qt::Orientation orientation, const QVariant &value, int role = Qt::EditRole) override;
- QModelIndex buddy(const QModelIndex &index) const Q_DECL_OVERRIDE;
- bool canFetchMore(const QModelIndex &parent) const Q_DECL_OVERRIDE;
- void fetchMore(const QModelIndex &parent) Q_DECL_OVERRIDE;
- void sort(int column, Qt::SortOrder order = Qt::AscendingOrder) Q_DECL_OVERRIDE;
- QSize span(const QModelIndex &index) const Q_DECL_OVERRIDE;
- bool hasChildren(const QModelIndex &parent = QModelIndex()) const Q_DECL_OVERRIDE;
- QModelIndex sibling(int row, int column, const QModelIndex &idx) const Q_DECL_OVERRIDE;
+ QModelIndex buddy(const QModelIndex &index) const override;
+ bool canFetchMore(const QModelIndex &parent) const override;
+ void fetchMore(const QModelIndex &parent) override;
+ void sort(int column, Qt::SortOrder order = Qt::AscendingOrder) override;
+ QSize span(const QModelIndex &index) const override;
+ bool hasChildren(const QModelIndex &parent = QModelIndex()) const override;
+ QModelIndex sibling(int row, int column, const QModelIndex &idx) const override;
- QMimeData* mimeData(const QModelIndexList &indexes) const Q_DECL_OVERRIDE;
+ QMimeData* mimeData(const QModelIndexList &indexes) const override;
bool canDropMimeData(const QMimeData *data, Qt::DropAction action,
- int row, int column, const QModelIndex &parent) const Q_DECL_OVERRIDE;
+ int row, int column, const QModelIndex &parent) const override;
bool dropMimeData(const QMimeData *data, Qt::DropAction action,
- int row, int column, const QModelIndex &parent) Q_DECL_OVERRIDE;
- QStringList mimeTypes() const Q_DECL_OVERRIDE;
- Qt::DropActions supportedDragActions() const Q_DECL_OVERRIDE;
- Qt::DropActions supportedDropActions() const Q_DECL_OVERRIDE;
+ int row, int column, const QModelIndex &parent) override;
+ QStringList mimeTypes() const override;
+ Qt::DropActions supportedDragActions() const override;
+ Qt::DropActions supportedDropActions() const override;
Q_SIGNALS:
void sourceModelChanged(QPrivateSignal);
diff --git a/src/corelib/itemmodels/qidentityproxymodel.h b/src/corelib/itemmodels/qidentityproxymodel.h
index e93740c1a2..d2b1ed9498 100644
--- a/src/corelib/itemmodels/qidentityproxymodel.h
+++ b/src/corelib/itemmodels/qidentityproxymodel.h
@@ -54,29 +54,29 @@ class Q_CORE_EXPORT QIdentityProxyModel : public QAbstractProxyModel
{
Q_OBJECT
public:
- explicit QIdentityProxyModel(QObject* parent = Q_NULLPTR);
+ explicit QIdentityProxyModel(QObject* parent = nullptr);
~QIdentityProxyModel();
- int columnCount(const QModelIndex& parent = QModelIndex()) const Q_DECL_OVERRIDE;
- QModelIndex index(int row, int column, const QModelIndex& parent = QModelIndex()) const Q_DECL_OVERRIDE;
- QModelIndex mapFromSource(const QModelIndex& sourceIndex) const Q_DECL_OVERRIDE;
- QModelIndex mapToSource(const QModelIndex& proxyIndex) const Q_DECL_OVERRIDE;
- QModelIndex parent(const QModelIndex& child) const Q_DECL_OVERRIDE;
+ int columnCount(const QModelIndex& parent = QModelIndex()) const override;
+ QModelIndex index(int row, int column, const QModelIndex& parent = QModelIndex()) const override;
+ QModelIndex mapFromSource(const QModelIndex& sourceIndex) const override;
+ QModelIndex mapToSource(const QModelIndex& proxyIndex) const override;
+ QModelIndex parent(const QModelIndex& child) const override;
using QObject::parent;
- int rowCount(const QModelIndex& parent = QModelIndex()) const Q_DECL_OVERRIDE;
- QVariant headerData(int section, Qt::Orientation orientation, int role = Qt::DisplayRole) const Q_DECL_OVERRIDE;
- bool dropMimeData(const QMimeData* data, Qt::DropAction action, int row, int column, const QModelIndex& parent) Q_DECL_OVERRIDE;
- QModelIndex sibling(int row, int column, const QModelIndex &idx) const Q_DECL_OVERRIDE;
-
- QItemSelection mapSelectionFromSource(const QItemSelection& selection) const Q_DECL_OVERRIDE;
- QItemSelection mapSelectionToSource(const QItemSelection& selection) const Q_DECL_OVERRIDE;
- QModelIndexList match(const QModelIndex& start, int role, const QVariant& value, int hits = 1, Qt::MatchFlags flags = Qt::MatchFlags(Qt::MatchStartsWith|Qt::MatchWrap)) const Q_DECL_OVERRIDE;
- void setSourceModel(QAbstractItemModel* sourceModel) Q_DECL_OVERRIDE;
-
- bool insertColumns(int column, int count, const QModelIndex& parent = QModelIndex()) Q_DECL_OVERRIDE;
- bool insertRows(int row, int count, const QModelIndex& parent = QModelIndex()) Q_DECL_OVERRIDE;
- bool removeColumns(int column, int count, const QModelIndex& parent = QModelIndex()) Q_DECL_OVERRIDE;
- bool removeRows(int row, int count, const QModelIndex& parent = QModelIndex()) Q_DECL_OVERRIDE;
+ int rowCount(const QModelIndex& parent = QModelIndex()) const override;
+ QVariant headerData(int section, Qt::Orientation orientation, int role = Qt::DisplayRole) const override;
+ bool dropMimeData(const QMimeData* data, Qt::DropAction action, int row, int column, const QModelIndex& parent) override;
+ QModelIndex sibling(int row, int column, const QModelIndex &idx) const override;
+
+ QItemSelection mapSelectionFromSource(const QItemSelection& selection) const override;
+ QItemSelection mapSelectionToSource(const QItemSelection& selection) const override;
+ QModelIndexList match(const QModelIndex& start, int role, const QVariant& value, int hits = 1, Qt::MatchFlags flags = Qt::MatchFlags(Qt::MatchStartsWith|Qt::MatchWrap)) const override;
+ void setSourceModel(QAbstractItemModel* sourceModel) override;
+
+ bool insertColumns(int column, int count, const QModelIndex& parent = QModelIndex()) override;
+ bool insertRows(int row, int count, const QModelIndex& parent = QModelIndex()) override;
+ bool removeColumns(int column, int count, const QModelIndex& parent = QModelIndex()) override;
+ bool removeRows(int row, int count, const QModelIndex& parent = QModelIndex()) override;
protected:
QIdentityProxyModel(QIdentityProxyModelPrivate &dd, QObject* parent);
diff --git a/src/corelib/itemmodels/qitemselectionmodel.cpp b/src/corelib/itemmodels/qitemselectionmodel.cpp
index 59a10e9057..9af4fd9133 100644
--- a/src/corelib/itemmodels/qitemselectionmodel.cpp
+++ b/src/corelib/itemmodels/qitemselectionmodel.cpp
@@ -218,13 +218,15 @@ QT_BEGIN_NAMESPACE
*/
bool QItemSelectionRange::intersects(const QItemSelectionRange &other) const
{
- return (isValid() && other.isValid()
- && parent() == other.parent()
- && model() == other.model()
+ // isValid() and parent() last since they are more expensive
+ return (model() == other.model()
&& ((top() <= other.top() && bottom() >= other.top())
|| (top() >= other.top() && top() <= other.bottom()))
&& ((left() <= other.left() && right() >= other.left())
- || (left() >= other.left() && left() <= other.right())));
+ || (left() >= other.left() && left() <= other.right()))
+ && parent() == other.parent()
+ && isValid() && other.isValid()
+ );
}
/*!
diff --git a/src/corelib/itemmodels/qitemselectionmodel.h b/src/corelib/itemmodels/qitemselectionmodel.h
index 9d33303ddc..091c5a21a5 100644
--- a/src/corelib/itemmodels/qitemselectionmodel.h
+++ b/src/corelib/itemmodels/qitemselectionmodel.h
@@ -164,7 +164,7 @@ public:
Q_DECLARE_FLAGS(SelectionFlags, SelectionFlag)
Q_FLAG(SelectionFlags)
- explicit QItemSelectionModel(QAbstractItemModel *model = Q_NULLPTR);
+ explicit QItemSelectionModel(QAbstractItemModel *model = nullptr);
explicit QItemSelectionModel(QAbstractItemModel *model, QObject *parent);
virtual ~QItemSelectionModel();
diff --git a/src/corelib/itemmodels/qsortfilterproxymodel.cpp b/src/corelib/itemmodels/qsortfilterproxymodel.cpp
index 7dad892606..c70fbaf63b 100644
--- a/src/corelib/itemmodels/qsortfilterproxymodel.cpp
+++ b/src/corelib/itemmodels/qsortfilterproxymodel.cpp
@@ -300,7 +300,7 @@ public:
void updateChildrenMapping(const QModelIndex &source_parent, Mapping *parent_mapping,
Qt::Orientation orient, int start, int end, int delta_item_count, bool remove);
- virtual void _q_sourceModelDestroyed() Q_DECL_OVERRIDE;
+ virtual void _q_sourceModelDestroyed() override;
bool needsReorder(const QVector<int> &source_rows, const QModelIndex &source_parent) const;
@@ -1857,6 +1857,9 @@ void QSortFilterProxyModel::setSourceModel(QAbstractItemModel *sourceModel)
{
Q_D(QSortFilterProxyModel);
+ if (sourceModel == d->model)
+ return;
+
beginResetModel();
disconnect(d->model, SIGNAL(dataChanged(QModelIndex,QModelIndex,QVector<int>)),
@@ -1910,6 +1913,7 @@ void QSortFilterProxyModel::setSourceModel(QAbstractItemModel *sourceModel)
disconnect(d->model, SIGNAL(modelAboutToBeReset()), this, SLOT(_q_sourceAboutToBeReset()));
disconnect(d->model, SIGNAL(modelReset()), this, SLOT(_q_sourceReset()));
+ d->_q_sourceModelDestroyed();
QAbstractProxyModel::setSourceModel(sourceModel);
connect(d->model, SIGNAL(dataChanged(QModelIndex,QModelIndex,QVector<int>)),
@@ -1963,7 +1967,6 @@ void QSortFilterProxyModel::setSourceModel(QAbstractItemModel *sourceModel)
connect(d->model, SIGNAL(modelAboutToBeReset()), this, SLOT(_q_sourceAboutToBeReset()));
connect(d->model, SIGNAL(modelReset()), this, SLOT(_q_sourceReset()));
- d->_q_clearMapping();
endResetModel();
if (d->update_source_sort_column() && d->dynamic_sortfilter)
d->sort();
diff --git a/src/corelib/itemmodels/qsortfilterproxymodel.h b/src/corelib/itemmodels/qsortfilterproxymodel.h
index 9f9b59733d..6c620f4812 100644
--- a/src/corelib/itemmodels/qsortfilterproxymodel.h
+++ b/src/corelib/itemmodels/qsortfilterproxymodel.h
@@ -70,16 +70,16 @@ class Q_CORE_EXPORT QSortFilterProxyModel : public QAbstractProxyModel
Q_PROPERTY(bool recursiveFilteringEnabled READ isRecursiveFilteringEnabled WRITE setRecursiveFilteringEnabled)
public:
- explicit QSortFilterProxyModel(QObject *parent = Q_NULLPTR);
+ explicit QSortFilterProxyModel(QObject *parent = nullptr);
~QSortFilterProxyModel();
- void setSourceModel(QAbstractItemModel *sourceModel) Q_DECL_OVERRIDE;
+ void setSourceModel(QAbstractItemModel *sourceModel) override;
- QModelIndex mapToSource(const QModelIndex &proxyIndex) const Q_DECL_OVERRIDE;
- QModelIndex mapFromSource(const QModelIndex &sourceIndex) const Q_DECL_OVERRIDE;
+ QModelIndex mapToSource(const QModelIndex &proxyIndex) const override;
+ QModelIndex mapFromSource(const QModelIndex &sourceIndex) const override;
- QItemSelection mapSelectionToSource(const QItemSelection &proxySelection) const Q_DECL_OVERRIDE;
- QItemSelection mapSelectionFromSource(const QItemSelection &sourceSelection) const Q_DECL_OVERRIDE;
+ QItemSelection mapSelectionToSource(const QItemSelection &proxySelection) const override;
+ QItemSelection mapSelectionFromSource(const QItemSelection &sourceSelection) const override;
QRegExp filterRegExp() const;
void setFilterRegExp(const QRegExp &regExp);
@@ -129,44 +129,44 @@ protected:
public:
using QObject::parent;
- QModelIndex index(int row, int column, const QModelIndex &parent = QModelIndex()) const Q_DECL_OVERRIDE;
- QModelIndex parent(const QModelIndex &child) const Q_DECL_OVERRIDE;
- QModelIndex sibling(int row, int column, const QModelIndex &idx) const Q_DECL_OVERRIDE;
+ QModelIndex index(int row, int column, const QModelIndex &parent = QModelIndex()) const override;
+ QModelIndex parent(const QModelIndex &child) const override;
+ QModelIndex sibling(int row, int column, const QModelIndex &idx) const override;
- int rowCount(const QModelIndex &parent = QModelIndex()) const Q_DECL_OVERRIDE;
- int columnCount(const QModelIndex &parent = QModelIndex()) const Q_DECL_OVERRIDE;
- bool hasChildren(const QModelIndex &parent = QModelIndex()) const Q_DECL_OVERRIDE;
+ int rowCount(const QModelIndex &parent = QModelIndex()) const override;
+ int columnCount(const QModelIndex &parent = QModelIndex()) const override;
+ bool hasChildren(const QModelIndex &parent = QModelIndex()) const override;
- QVariant data(const QModelIndex &index, int role = Qt::DisplayRole) const Q_DECL_OVERRIDE;
- bool setData(const QModelIndex &index, const QVariant &value, int role = Qt::EditRole) Q_DECL_OVERRIDE;
+ QVariant data(const QModelIndex &index, int role = Qt::DisplayRole) const override;
+ bool setData(const QModelIndex &index, const QVariant &value, int role = Qt::EditRole) override;
- QVariant headerData(int section, Qt::Orientation orientation, int role = Qt::DisplayRole) const Q_DECL_OVERRIDE;
+ QVariant headerData(int section, Qt::Orientation orientation, int role = Qt::DisplayRole) const override;
bool setHeaderData(int section, Qt::Orientation orientation,
- const QVariant &value, int role = Qt::EditRole) Q_DECL_OVERRIDE;
+ const QVariant &value, int role = Qt::EditRole) override;
- QMimeData *mimeData(const QModelIndexList &indexes) const Q_DECL_OVERRIDE;
+ QMimeData *mimeData(const QModelIndexList &indexes) const override;
bool dropMimeData(const QMimeData *data, Qt::DropAction action,
- int row, int column, const QModelIndex &parent) Q_DECL_OVERRIDE;
+ int row, int column, const QModelIndex &parent) override;
- bool insertRows(int row, int count, const QModelIndex &parent = QModelIndex()) Q_DECL_OVERRIDE;
- bool insertColumns(int column, int count, const QModelIndex &parent = QModelIndex()) Q_DECL_OVERRIDE;
- bool removeRows(int row, int count, const QModelIndex &parent = QModelIndex()) Q_DECL_OVERRIDE;
- bool removeColumns(int column, int count, const QModelIndex &parent = QModelIndex()) Q_DECL_OVERRIDE;
+ bool insertRows(int row, int count, const QModelIndex &parent = QModelIndex()) override;
+ bool insertColumns(int column, int count, const QModelIndex &parent = QModelIndex()) override;
+ bool removeRows(int row, int count, const QModelIndex &parent = QModelIndex()) override;
+ bool removeColumns(int column, int count, const QModelIndex &parent = QModelIndex()) override;
- void fetchMore(const QModelIndex &parent) Q_DECL_OVERRIDE;
- bool canFetchMore(const QModelIndex &parent) const Q_DECL_OVERRIDE;
- Qt::ItemFlags flags(const QModelIndex &index) const Q_DECL_OVERRIDE;
+ void fetchMore(const QModelIndex &parent) override;
+ bool canFetchMore(const QModelIndex &parent) const override;
+ Qt::ItemFlags flags(const QModelIndex &index) const override;
- QModelIndex buddy(const QModelIndex &index) const Q_DECL_OVERRIDE;
+ QModelIndex buddy(const QModelIndex &index) const override;
QModelIndexList match(const QModelIndex &start, int role,
const QVariant &value, int hits = 1,
Qt::MatchFlags flags =
- Qt::MatchFlags(Qt::MatchStartsWith|Qt::MatchWrap)) const Q_DECL_OVERRIDE;
- QSize span(const QModelIndex &index) const Q_DECL_OVERRIDE;
- void sort(int column, Qt::SortOrder order = Qt::AscendingOrder) Q_DECL_OVERRIDE;
+ Qt::MatchFlags(Qt::MatchStartsWith|Qt::MatchWrap)) const override;
+ QSize span(const QModelIndex &index) const override;
+ void sort(int column, Qt::SortOrder order = Qt::AscendingOrder) override;
- QStringList mimeTypes() const Q_DECL_OVERRIDE;
- Qt::DropActions supportedDropActions() const Q_DECL_OVERRIDE;
+ QStringList mimeTypes() const override;
+ Qt::DropActions supportedDropActions() const override;
private:
Q_DECLARE_PRIVATE(QSortFilterProxyModel)
Q_DISABLE_COPY(QSortFilterProxyModel)
diff --git a/src/corelib/itemmodels/qstringlistmodel.h b/src/corelib/itemmodels/qstringlistmodel.h
index 3bda848f48..38da1022ea 100644
--- a/src/corelib/itemmodels/qstringlistmodel.h
+++ b/src/corelib/itemmodels/qstringlistmodel.h
@@ -52,26 +52,26 @@ class Q_CORE_EXPORT QStringListModel : public QAbstractListModel
{
Q_OBJECT
public:
- explicit QStringListModel(QObject *parent = Q_NULLPTR);
- explicit QStringListModel(const QStringList &strings, QObject *parent = Q_NULLPTR);
+ explicit QStringListModel(QObject *parent = nullptr);
+ explicit QStringListModel(const QStringList &strings, QObject *parent = nullptr);
- int rowCount(const QModelIndex &parent = QModelIndex()) const Q_DECL_OVERRIDE;
- QModelIndex sibling(int row, int column, const QModelIndex &idx) const Q_DECL_OVERRIDE;
+ int rowCount(const QModelIndex &parent = QModelIndex()) const override;
+ QModelIndex sibling(int row, int column, const QModelIndex &idx) const override;
- QVariant data(const QModelIndex &index, int role = Qt::DisplayRole) const Q_DECL_OVERRIDE;
- bool setData(const QModelIndex &index, const QVariant &value, int role = Qt::EditRole) Q_DECL_OVERRIDE;
+ QVariant data(const QModelIndex &index, int role = Qt::DisplayRole) const override;
+ bool setData(const QModelIndex &index, const QVariant &value, int role = Qt::EditRole) override;
- Qt::ItemFlags flags(const QModelIndex &index) const Q_DECL_OVERRIDE;
+ Qt::ItemFlags flags(const QModelIndex &index) const override;
- bool insertRows(int row, int count, const QModelIndex &parent = QModelIndex()) Q_DECL_OVERRIDE;
- bool removeRows(int row, int count, const QModelIndex &parent = QModelIndex()) Q_DECL_OVERRIDE;
+ bool insertRows(int row, int count, const QModelIndex &parent = QModelIndex()) override;
+ bool removeRows(int row, int count, const QModelIndex &parent = QModelIndex()) override;
- void sort(int column, Qt::SortOrder order = Qt::AscendingOrder) Q_DECL_OVERRIDE;
+ void sort(int column, Qt::SortOrder order = Qt::AscendingOrder) override;
QStringList stringList() const;
void setStringList(const QStringList &strings);
- Qt::DropActions supportedDropActions() const Q_DECL_OVERRIDE;
+ Qt::DropActions supportedDropActions() const override;
private:
Q_DISABLE_COPY(QStringListModel)
diff --git a/src/corelib/json/qjsonarray.h b/src/corelib/json/qjsonarray.h
index ddba2ca78e..8d41138c97 100644
--- a/src/corelib/json/qjsonarray.h
+++ b/src/corelib/json/qjsonarray.h
@@ -133,7 +133,7 @@ public:
typedef QJsonValueRef reference;
typedef QJsonValueRefPtr pointer;
- inline iterator() : a(Q_NULLPTR), i(0) { }
+ inline iterator() : a(nullptr), i(0) { }
explicit inline iterator(QJsonArray *array, int index) : a(array), i(index) { }
inline QJsonValueRef operator*() const { return QJsonValueRef(a, i); }
@@ -178,7 +178,7 @@ public:
typedef QJsonValue reference;
typedef QJsonValuePtr pointer;
- inline const_iterator() : a(Q_NULLPTR), i(0) { }
+ inline const_iterator() : a(nullptr), i(0) { }
explicit inline const_iterator(const QJsonArray *array, int index) : a(array), i(index) { }
#if QT_VERSION < QT_VERSION_CHECK(6, 0, 0)
inline const_iterator(const const_iterator &o) : a(o.a), i(o.i) {} // ### Qt 6: Removed so class can be trivially-copyable
diff --git a/src/corelib/json/qjsondocument.cpp b/src/corelib/json/qjsondocument.cpp
index 6469412054..9794bca60d 100644
--- a/src/corelib/json/qjsondocument.cpp
+++ b/src/corelib/json/qjsondocument.cpp
@@ -332,7 +332,7 @@ QVariant QJsonDocument::toVariant() const
\sa fromJson()
*/
-#ifndef QT_JSON_READONLY
+#if !defined(QT_JSON_READONLY) || defined(Q_CLANG_QDOC)
QByteArray QJsonDocument::toJson() const
{
return toJson(Indented);
@@ -369,7 +369,7 @@ QByteArray QJsonDocument::toJson() const
\sa fromJson(), JsonFormat
*/
-#ifndef QT_JSON_READONLY
+#if !defined(QT_JSON_READONLY) || defined(Q_CLANG_QDOC)
QByteArray QJsonDocument::toJson(JsonFormat format) const
{
QByteArray json;
diff --git a/src/corelib/json/qjsondocument.h b/src/corelib/json/qjsondocument.h
index 4e76af21e2..b784890c54 100644
--- a/src/corelib/json/qjsondocument.h
+++ b/src/corelib/json/qjsondocument.h
@@ -129,11 +129,9 @@ public:
Compact
};
- static QJsonDocument fromJson(const QByteArray &json, QJsonParseError *error = Q_NULLPTR);
+ static QJsonDocument fromJson(const QByteArray &json, QJsonParseError *error = nullptr);
-#ifdef Q_QDOC
- QByteArray toJson(JsonFormat format = Indented) const;
-#elif !defined(QT_JSON_READONLY)
+#if !defined(QT_JSON_READONLY) || defined(Q_CLANG_QDOC)
QByteArray toJson() const; //### Merge in Qt6
QByteArray toJson(JsonFormat format) const;
#endif
diff --git a/src/corelib/json/qjsonobject.h b/src/corelib/json/qjsonobject.h
index c77e2164a8..610bce694c 100644
--- a/src/corelib/json/qjsonobject.h
+++ b/src/corelib/json/qjsonobject.h
@@ -135,7 +135,7 @@ public:
typedef QJsonValueRef reference;
typedef QJsonValuePtr pointer;
- Q_DECL_CONSTEXPR inline iterator() : o(Q_NULLPTR), i(0) {}
+ Q_DECL_CONSTEXPR inline iterator() : o(nullptr), i(0) {}
Q_DECL_CONSTEXPR inline iterator(QJsonObject *obj, int index) : o(obj), i(index) {}
inline QString key() const { return o->keyAt(i); }
@@ -178,7 +178,7 @@ public:
typedef QJsonValue reference;
typedef QJsonValuePtr pointer;
- Q_DECL_CONSTEXPR inline const_iterator() : o(Q_NULLPTR), i(0) {}
+ Q_DECL_CONSTEXPR inline const_iterator() : o(nullptr), i(0) {}
Q_DECL_CONSTEXPR inline const_iterator(const QJsonObject *obj, int index)
: o(obj), i(index) {}
inline const_iterator(const iterator &other)
diff --git a/src/corelib/json/qjsonvalue.h b/src/corelib/json/qjsonvalue.h
index 5d5ec72605..96538ebbf9 100644
--- a/src/corelib/json/qjsonvalue.h
+++ b/src/corelib/json/qjsonvalue.h
@@ -82,7 +82,7 @@ public:
QJsonValue(QLatin1String s);
#ifndef QT_NO_CAST_FROM_ASCII
inline QT_ASCII_CAST_WARN QJsonValue(const char *s)
- : d(Q_NULLPTR), t(String) { stringDataFromQStringHelper(QString::fromUtf8(s)); }
+ : d(nullptr), t(String) { stringDataFromQStringHelper(QString::fromUtf8(s)); }
#endif
QJsonValue(const QJsonArray &a);
QJsonValue(const QJsonObject &o);
diff --git a/src/corelib/kernel/qabstracteventdispatcher.cpp b/src/corelib/kernel/qabstracteventdispatcher.cpp
index d1e436c371..67c15d2f2c 100644
--- a/src/corelib/kernel/qabstracteventdispatcher.cpp
+++ b/src/corelib/kernel/qabstracteventdispatcher.cpp
@@ -479,7 +479,7 @@ bool QAbstractEventDispatcher::filterNativeEvent(const QByteArray &eventType, vo
the processing of the event should continue.
*/
-/*! \fn bool QAbstractEventDispatcher::registerEventNotifier(QWinEventNotifier *notifier);
+/*! \fn bool QAbstractEventDispatcher::registerEventNotifier(QWinEventNotifier *notifier)
This pure virtual method exists on windows only and has to be reimplemented by a Windows specific
event dispatcher implementation. \a notifier is the QWinEventNotifier instance to be registered.
@@ -492,7 +492,7 @@ bool QAbstractEventDispatcher::filterNativeEvent(const QByteArray &eventType, vo
\sa QWinEventNotifier, unregisterEventNotifier()
*/
-/*! \fn bool QAbstractEventDispatcher::unregisterEventNotifier(QWinEventNotifier *notifier);
+/*! \fn bool QAbstractEventDispatcher::unregisterEventNotifier(QWinEventNotifier *notifier)
This pure virtual method exists on windows only and has to be reimplemented by a Windows specific
event dispatcher implementation. \a notifier is the QWinEventNotifier instance to be unregistered.
diff --git a/src/corelib/kernel/qabstracteventdispatcher.h b/src/corelib/kernel/qabstracteventdispatcher.h
index 3a530cf1de..4775d3d47a 100644
--- a/src/corelib/kernel/qabstracteventdispatcher.h
+++ b/src/corelib/kernel/qabstracteventdispatcher.h
@@ -49,7 +49,7 @@ class QAbstractNativeEventFilter;
class QAbstractEventDispatcherPrivate;
class QSocketNotifier;
-#ifdef Q_OS_WIN
+#if defined(Q_OS_WIN) || defined(Q_CLANG_QDOC)
class QWinEventNotifier;
#endif
@@ -70,10 +70,10 @@ public:
{ }
};
- explicit QAbstractEventDispatcher(QObject *parent = Q_NULLPTR);
+ explicit QAbstractEventDispatcher(QObject *parent = nullptr);
~QAbstractEventDispatcher();
- static QAbstractEventDispatcher *instance(QThread *thread = Q_NULLPTR);
+ static QAbstractEventDispatcher *instance(QThread *thread = nullptr);
virtual bool processEvents(QEventLoop::ProcessEventsFlags flags) = 0;
virtual bool hasPendingEvents() = 0; // ### Qt6: remove, mark final or make protected
@@ -95,7 +95,7 @@ public:
virtual int remainingTime(int timerId) = 0;
-#if defined(Q_OS_WIN) || defined(Q_QDOC)
+#if defined(Q_OS_WIN) || defined(Q_CLANG_QDOC)
virtual bool registerEventNotifier(QWinEventNotifier *notifier) = 0;
virtual void unregisterEventNotifier(QWinEventNotifier *notifier) = 0;
#endif
@@ -112,7 +112,7 @@ public:
bool filterNativeEvent(const QByteArray &eventType, void *message, long *result);
#if QT_DEPRECATED_SINCE(5, 0)
QT_DEPRECATED bool filterEvent(void *message)
- { return filterNativeEvent("", message, Q_NULLPTR); }
+ { return filterNativeEvent("", message, nullptr); }
#endif
Q_SIGNALS:
diff --git a/src/corelib/kernel/qcore_unix.cpp b/src/corelib/kernel/qcore_unix.cpp
index 3b0da136ca..eb98cbef8f 100644
--- a/src/corelib/kernel/qcore_unix.cpp
+++ b/src/corelib/kernel/qcore_unix.cpp
@@ -130,7 +130,7 @@ int qt_safe_poll(struct pollfd *fds, nfds_t nfds, const struct timespec *timeout
if (!timeout_ts) {
// no timeout -> block forever
int ret;
- EINTR_LOOP(ret, qt_ppoll(fds, nfds, Q_NULLPTR));
+ EINTR_LOOP(ret, qt_ppoll(fds, nfds, nullptr));
return ret;
}
diff --git a/src/corelib/kernel/qcore_unix_p.h b/src/corelib/kernel/qcore_unix_p.h
index f78d2b9f24..e538a7e22b 100644
--- a/src/corelib/kernel/qcore_unix_p.h
+++ b/src/corelib/kernel/qcore_unix_p.h
@@ -362,7 +362,7 @@ Q_CORE_EXPORT int qt_safe_poll(struct pollfd *fds, nfds_t nfds, const struct tim
static inline int qt_poll_msecs(struct pollfd *fds, nfds_t nfds, int timeout)
{
- timespec ts, *pts = Q_NULLPTR;
+ timespec ts, *pts = nullptr;
if (timeout >= 0) {
ts.tv_sec = timeout / 1000;
diff --git a/src/corelib/kernel/qcoreapplication.cpp b/src/corelib/kernel/qcoreapplication.cpp
index 34a3d7ef7e..38bcba275f 100644
--- a/src/corelib/kernel/qcoreapplication.cpp
+++ b/src/corelib/kernel/qcoreapplication.cpp
@@ -449,7 +449,7 @@ QCoreApplicationPrivate::QCoreApplicationPrivate(int &aargc, char **aargv, uint
, argv(aargv)
#if defined(Q_OS_WIN) && !defined(Q_OS_WINRT)
, origArgc(0)
- , origArgv(Q_NULLPTR)
+ , origArgv(nullptr)
#endif
, application_type(QCoreApplicationPrivate::Tty)
#ifndef QT_NO_QOBJECT
@@ -781,6 +781,12 @@ QCoreApplication::QCoreApplication(int &argc, char **argv
#endif
}
+/*!
+ \enum QCoreApplication::anonymous
+ \internal
+
+ \value ApplicationFlags QT_VERSION
+*/
void QCoreApplicationPrivate::init()
{
diff --git a/src/corelib/kernel/qcoreapplication.h b/src/corelib/kernel/qcoreapplication.h
index 6555733c4e..a886c9d1d2 100644
--- a/src/corelib/kernel/qcoreapplication.h
+++ b/src/corelib/kernel/qcoreapplication.h
@@ -123,7 +123,7 @@ public:
static bool sendEvent(QObject *receiver, QEvent *event);
static void postEvent(QObject *receiver, QEvent *event, int priority = Qt::NormalEventPriority);
- static void sendPostedEvents(QObject *receiver = Q_NULLPTR, int event_type = 0);
+ static void sendPostedEvents(QObject *receiver = nullptr, int event_type = 0);
static void removePostedEvents(QObject *receiver, int eventType = 0);
#if QT_DEPRECATED_SINCE(5, 3)
QT_DEPRECATED static bool hasPendingEvents();
@@ -155,7 +155,7 @@ public:
static QString translate(const char * context,
const char * key,
- const char * disambiguation = Q_NULLPTR,
+ const char * disambiguation = nullptr,
int n = -1);
#if QT_DEPRECATED_SINCE(5, 0)
enum Encoding { UnicodeUTF8, Latin1, DefaultCodec = UnicodeUTF8, CodecForTr = UnicodeUTF8 };
@@ -187,7 +187,7 @@ Q_SIGNALS:
void applicationVersionChanged();
protected:
- bool event(QEvent *) Q_DECL_OVERRIDE;
+ bool event(QEvent *) override;
virtual bool compressEvent(QEvent *, QObject *receiver, QPostEventList *);
#endif // QT_NO_QOBJECT
@@ -241,13 +241,13 @@ inline bool QCoreApplication::sendSpontaneousEvent(QObject *receiver, QEvent *ev
# define QT_DECLARE_DEPRECATED_TR_FUNCTIONS(context)
#else
# define QT_DECLARE_DEPRECATED_TR_FUNCTIONS(context) \
- QT_DEPRECATED static inline QString trUtf8(const char *sourceText, const char *disambiguation = Q_NULLPTR, int n = -1) \
+ QT_DEPRECATED static inline QString trUtf8(const char *sourceText, const char *disambiguation = nullptr, int n = -1) \
{ return QCoreApplication::translate(#context, sourceText, disambiguation, n); }
#endif
#define Q_DECLARE_TR_FUNCTIONS(context) \
public: \
- static inline QString tr(const char *sourceText, const char *disambiguation = Q_NULLPTR, int n = -1) \
+ static inline QString tr(const char *sourceText, const char *disambiguation = nullptr, int n = -1) \
{ return QCoreApplication::translate(#context, sourceText, disambiguation, n); } \
QT_DECLARE_DEPRECATED_TR_FUNCTIONS(context) \
private:
diff --git a/src/corelib/kernel/qeventdispatcher_glib_p.h b/src/corelib/kernel/qeventdispatcher_glib_p.h
index 8e9925d7a5..799f23b14a 100644
--- a/src/corelib/kernel/qeventdispatcher_glib_p.h
+++ b/src/corelib/kernel/qeventdispatcher_glib_p.h
@@ -70,22 +70,22 @@ public:
explicit QEventDispatcherGlib(GMainContext *context, QObject *parent = 0);
~QEventDispatcherGlib();
- bool processEvents(QEventLoop::ProcessEventsFlags flags) Q_DECL_OVERRIDE;
- bool hasPendingEvents() Q_DECL_OVERRIDE;
+ bool processEvents(QEventLoop::ProcessEventsFlags flags) override;
+ bool hasPendingEvents() override;
- void registerSocketNotifier(QSocketNotifier *socketNotifier) Q_DECL_FINAL;
- void unregisterSocketNotifier(QSocketNotifier *socketNotifier) Q_DECL_FINAL;
+ void registerSocketNotifier(QSocketNotifier *socketNotifier) final;
+ void unregisterSocketNotifier(QSocketNotifier *socketNotifier) final;
- void registerTimer(int timerId, int interval, Qt::TimerType timerType, QObject *object) Q_DECL_FINAL;
- bool unregisterTimer(int timerId) Q_DECL_FINAL;
- bool unregisterTimers(QObject *object) Q_DECL_FINAL;
- QList<TimerInfo> registeredTimers(QObject *object) const Q_DECL_FINAL;
+ void registerTimer(int timerId, int interval, Qt::TimerType timerType, QObject *object) final;
+ bool unregisterTimer(int timerId) final;
+ bool unregisterTimers(QObject *object) final;
+ QList<TimerInfo> registeredTimers(QObject *object) const final;
- int remainingTime(int timerId) Q_DECL_FINAL;
+ int remainingTime(int timerId) final;
- void wakeUp() Q_DECL_FINAL;
- void interrupt() Q_DECL_FINAL;
- void flush() Q_DECL_FINAL;
+ void wakeUp() final;
+ void interrupt() final;
+ void flush() final;
static bool versionSupported();
diff --git a/src/corelib/kernel/qeventdispatcher_unix_p.h b/src/corelib/kernel/qeventdispatcher_unix_p.h
index bcf5b10baa..0fd068b074 100644
--- a/src/corelib/kernel/qeventdispatcher_unix_p.h
+++ b/src/corelib/kernel/qeventdispatcher_unix_p.h
@@ -62,7 +62,7 @@ QT_BEGIN_NAMESPACE
class QEventDispatcherUNIXPrivate;
-struct Q_CORE_EXPORT QSocketNotifierSetUNIX Q_DECL_FINAL
+struct Q_CORE_EXPORT QSocketNotifierSetUNIX final
{
inline QSocketNotifierSetUNIX() Q_DECL_NOTHROW;
@@ -105,22 +105,22 @@ public:
explicit QEventDispatcherUNIX(QObject *parent = 0);
~QEventDispatcherUNIX();
- bool processEvents(QEventLoop::ProcessEventsFlags flags) Q_DECL_OVERRIDE;
- bool hasPendingEvents() Q_DECL_OVERRIDE;
+ bool processEvents(QEventLoop::ProcessEventsFlags flags) override;
+ bool hasPendingEvents() override;
- void registerSocketNotifier(QSocketNotifier *notifier) Q_DECL_FINAL;
- void unregisterSocketNotifier(QSocketNotifier *notifier) Q_DECL_FINAL;
+ void registerSocketNotifier(QSocketNotifier *notifier) final;
+ void unregisterSocketNotifier(QSocketNotifier *notifier) final;
- void registerTimer(int timerId, int interval, Qt::TimerType timerType, QObject *object) Q_DECL_FINAL;
- bool unregisterTimer(int timerId) Q_DECL_FINAL;
- bool unregisterTimers(QObject *object) Q_DECL_FINAL;
- QList<TimerInfo> registeredTimers(QObject *object) const Q_DECL_FINAL;
+ void registerTimer(int timerId, int interval, Qt::TimerType timerType, QObject *object) final;
+ bool unregisterTimer(int timerId) final;
+ bool unregisterTimers(QObject *object) final;
+ QList<TimerInfo> registeredTimers(QObject *object) const final;
- int remainingTime(int timerId) Q_DECL_FINAL;
+ int remainingTime(int timerId) final;
- void wakeUp() Q_DECL_FINAL;
- void interrupt() Q_DECL_FINAL;
- void flush() Q_DECL_OVERRIDE;
+ void wakeUp() final;
+ void interrupt() final;
+ void flush() override;
protected:
QEventDispatcherUNIX(QEventDispatcherUNIXPrivate &dd, QObject *parent = 0);
diff --git a/src/corelib/kernel/qeventloop.h b/src/corelib/kernel/qeventloop.h
index e62b1d8419..eb1348220b 100644
--- a/src/corelib/kernel/qeventloop.h
+++ b/src/corelib/kernel/qeventloop.h
@@ -53,7 +53,7 @@ class Q_CORE_EXPORT QEventLoop : public QObject
Q_DECLARE_PRIVATE(QEventLoop)
public:
- explicit QEventLoop(QObject *parent = Q_NULLPTR);
+ explicit QEventLoop(QObject *parent = nullptr);
~QEventLoop();
enum ProcessEventsFlag {
@@ -76,7 +76,7 @@ public:
void wakeUp();
- bool event(QEvent *event) Q_DECL_OVERRIDE;
+ bool event(QEvent *event) override;
public Q_SLOTS:
void quit();
diff --git a/src/corelib/kernel/qfunctions_vxworks.h b/src/corelib/kernel/qfunctions_vxworks.h
index 34630a735b..86f243959f 100644
--- a/src/corelib/kernel/qfunctions_vxworks.h
+++ b/src/corelib/kernel/qfunctions_vxworks.h
@@ -62,9 +62,6 @@
#include <sys/stat.h>
#include <sys/wait.h>
#include <netinet/in.h>
-#ifndef QT_NO_IPV6IFNAME
-#include <net/if.h>
-#endif
// VxWorks has public header mbuf.h which defines following variables for DKM.
// Let's undef those to because they overlap with Qt variable names-
diff --git a/src/corelib/kernel/qjni.cpp b/src/corelib/kernel/qjni.cpp
index 60154328c2..75a2436d9d 100644
--- a/src/corelib/kernel/qjni.cpp
+++ b/src/corelib/kernel/qjni.cpp
@@ -260,7 +260,7 @@ QJNIEnvironmentPrivate::QJNIEnvironmentPrivate()
return;
if (ret == JNI_EDETACHED) { // We need to (re-)attach
- JavaVMAttachArgs args = { JNI_VERSION_1_6, qJniThreadName, Q_NULLPTR };
+ JavaVMAttachArgs args = { JNI_VERSION_1_6, qJniThreadName, nullptr };
if (vm->AttachCurrentThread(&jniEnv, &args) != JNI_OK)
return;
diff --git a/src/corelib/kernel/qjnihelpers.cpp b/src/corelib/kernel/qjnihelpers.cpp
index 0d7c143999..04c9a9bcba 100644
--- a/src/corelib/kernel/qjnihelpers.cpp
+++ b/src/corelib/kernel/qjnihelpers.cpp
@@ -64,14 +64,14 @@ namespace QtAndroidPrivate {
KeyEventListener::~KeyEventListener() {}
}
-static JavaVM *g_javaVM = Q_NULLPTR;
-static jobject g_jActivity = Q_NULLPTR;
-static jobject g_jService = Q_NULLPTR;
-static jobject g_jClassLoader = Q_NULLPTR;
+static JavaVM *g_javaVM = nullptr;
+static jobject g_jActivity = nullptr;
+static jobject g_jService = nullptr;
+static jobject g_jClassLoader = nullptr;
static jint g_androidSdkVersion = 0;
-static jclass g_jNativeClass = Q_NULLPTR;
-static jmethodID g_runPendingCppRunnablesMethodID = Q_NULLPTR;
-static jmethodID g_hideSplashScreenMethodID = Q_NULLPTR;
+static jclass g_jNativeClass = nullptr;
+static jmethodID g_runPendingCppRunnablesMethodID = nullptr;
+static jmethodID g_hideSplashScreenMethodID = nullptr;
Q_GLOBAL_STATIC(std::deque<QtAndroidPrivate::Runnable>, g_pendingRunnables);
static QBasicMutex g_pendingRunnablesMutex;
diff --git a/src/corelib/kernel/qjnionload.cpp b/src/corelib/kernel/qjnionload.cpp
index 8f60800dba..0550b86553 100644
--- a/src/corelib/kernel/qjnionload.cpp
+++ b/src/corelib/kernel/qjnionload.cpp
@@ -61,7 +61,7 @@ Q_CORE_EXPORT jint JNICALL JNI_OnLoad(JavaVM *vm, void *reserved)
__android_log_print(ANDROID_LOG_INFO, logTag, "Start");
_JNIEnv uenv;
- uenv.venv = Q_NULLPTR;
+ uenv.venv = nullptr;
if (vm->GetEnv(&uenv.venv, JNI_VERSION_1_6) != JNI_OK)
{
diff --git a/src/corelib/kernel/qmetaobject.cpp b/src/corelib/kernel/qmetaobject.cpp
index f07b463482..3560ea1b32 100644
--- a/src/corelib/kernel/qmetaobject.cpp
+++ b/src/corelib/kernel/qmetaobject.cpp
@@ -1341,7 +1341,7 @@ QByteArray QMetaObject::normalizedSignature(const char *method)
enum { MaximumParamCount = 11 }; // up to 10 arguments + 1 return value
-/*!
+/*
Returns the signatures of all methods whose name matches \a nonExistentMember,
or an empty QByteArray if there are no matches.
*/
@@ -1589,53 +1589,29 @@ bool QMetaObject::invokeMethodImpl(QObject *object, QtPrivate::QSlotObjectBase *
*/
/*!
- \fn bool QMetaObject::invokeMethod(QObject *receiver, PointerToMemberFunction function, Qt::ConnectionType type = Qt::AutoConnection, MemberFunctionReturnType *ret = Q_NULLPTR)
-
- \since 5.10
-
- \overload
-*/
-
-/*!
- \fn bool QMetaObject::invokeMethod(QObject *receiver, PointerToMemberFunction function, MemberFunctionReturnType *ret)
-
- \since 5.10
-
- \overload
-
- This overload invokes the member function using the connection type Qt::AutoConnection.
-*/
-
-/*!
- \fn bool QMetaObject::invokeMethod(QObject *context, Functor function, Qt::ConnectionType type = Qt::AutoConnection, FunctorReturnType *ret = Q_NULLPTR)
+ \fn bool QMetaObject::invokeMethod(QObject *context, Functor function, Qt::ConnectionType type, FunctorReturnType *ret)
\since 5.10
\overload
- Call the functor in the event loop of \a context.
+ Invokes the \a function in the event loop of \a context. \a function can be a functor
+ or a pointer to a member function. Returns \c true if the function could be invoked.
+ Returns \c false if there is no such function or the parameters did not match.
+ The return value of the function call is placed in \a ret.
*/
/*!
- \fn bool QMetaObject::invokeMethod(QObject *context, Functor function, FunctorReturnType *ret = Q_NULLPTR)
+ \fn bool QMetaObject::invokeMethod(QObject *context, Functor function, FunctorReturnType *ret)
\since 5.10
\overload
- Call the functor in the event loop of \a context using the connection type Qt::AutoConnection.
-*/
-
-/*!
- \fn QMetaObject::Connection::Connection(const Connection &other)
-
- Constructs a copy of \a other.
-*/
-
-/*!
- \fn QMetaObject::Connection::Connection &operator=(const Connection &other)
-
- Assigns \a other to this connection and returns a reference to this connection.
+ Invokes the \a function in the event loop of \a context using the connection type Qt::AutoConnection.
+ \a function can be a functor or a pointer to a member function. Returns \c true if the function could
+ be invoked. Returns \c false if there is no such member or the parameters did not match.
+ The return value of the function call is placed in \a ret.
*/
/*!
diff --git a/src/corelib/kernel/qmetaobject.h b/src/corelib/kernel/qmetaobject.h
index 40b2aa6402..51df8faad3 100644
--- a/src/corelib/kernel/qmetaobject.h
+++ b/src/corelib/kernel/qmetaobject.h
@@ -54,7 +54,7 @@ template <typename T> class QList;
class Q_CORE_EXPORT QMetaMethod
{
public:
- Q_DECL_CONSTEXPR inline QMetaMethod() : mobj(Q_NULLPTR), handle(0) {}
+ Q_DECL_CONSTEXPR inline QMetaMethod() : mobj(nullptr), handle(0) {}
QByteArray methodSignature() const;
QByteArray name() const;
@@ -80,7 +80,7 @@ public:
bool invoke(QObject *object,
Qt::ConnectionType connectionType,
QGenericReturnArgument returnValue,
- QGenericArgument val0 = QGenericArgument(Q_NULLPTR),
+ QGenericArgument val0 = QGenericArgument(nullptr),
QGenericArgument val1 = QGenericArgument(),
QGenericArgument val2 = QGenericArgument(),
QGenericArgument val3 = QGenericArgument(),
@@ -92,7 +92,7 @@ public:
QGenericArgument val9 = QGenericArgument()) const;
inline bool invoke(QObject *object,
QGenericReturnArgument returnValue,
- QGenericArgument val0 = QGenericArgument(Q_NULLPTR),
+ QGenericArgument val0 = QGenericArgument(nullptr),
QGenericArgument val1 = QGenericArgument(),
QGenericArgument val2 = QGenericArgument(),
QGenericArgument val3 = QGenericArgument(),
@@ -108,7 +108,7 @@ public:
}
inline bool invoke(QObject *object,
Qt::ConnectionType connectionType,
- QGenericArgument val0 = QGenericArgument(Q_NULLPTR),
+ QGenericArgument val0 = QGenericArgument(nullptr),
QGenericArgument val1 = QGenericArgument(),
QGenericArgument val2 = QGenericArgument(),
QGenericArgument val3 = QGenericArgument(),
@@ -123,7 +123,7 @@ public:
val0, val1, val2, val3, val4, val5, val6, val7, val8, val9);
}
inline bool invoke(QObject *object,
- QGenericArgument val0 = QGenericArgument(Q_NULLPTR),
+ QGenericArgument val0 = QGenericArgument(nullptr),
QGenericArgument val1 = QGenericArgument(),
QGenericArgument val2 = QGenericArgument(),
QGenericArgument val3 = QGenericArgument(),
@@ -140,7 +140,7 @@ public:
bool invokeOnGadget(void *gadget,
QGenericReturnArgument returnValue,
- QGenericArgument val0 = QGenericArgument(Q_NULLPTR),
+ QGenericArgument val0 = QGenericArgument(nullptr),
QGenericArgument val1 = QGenericArgument(),
QGenericArgument val2 = QGenericArgument(),
QGenericArgument val3 = QGenericArgument(),
@@ -151,7 +151,7 @@ public:
QGenericArgument val8 = QGenericArgument(),
QGenericArgument val9 = QGenericArgument()) const;
inline bool invokeOnGadget(void *gadget,
- QGenericArgument val0 = QGenericArgument(Q_NULLPTR),
+ QGenericArgument val0 = QGenericArgument(nullptr),
QGenericArgument val1 = QGenericArgument(),
QGenericArgument val2 = QGenericArgument(),
QGenericArgument val3 = QGenericArgument(),
@@ -166,7 +166,7 @@ public:
val0, val1, val2, val3, val4, val5, val6, val7, val8, val9);
}
- inline bool isValid() const { return mobj != Q_NULLPTR; }
+ inline bool isValid() const { return mobj != nullptr; }
template <typename PointerToMemberFunction>
static inline QMetaMethod fromSignal(PointerToMemberFunction signal)
@@ -183,7 +183,7 @@ private:
// signature() has been renamed to methodSignature() in Qt 5.
// Warning, that function returns a QByteArray; check the life time if
// you convert to char*.
- char *signature(struct renamedInQt5_warning_checkTheLifeTime * = Q_NULLPTR) Q_DECL_EQ_DELETE;
+ char *signature(struct renamedInQt5_warning_checkTheLifeTime * = nullptr) Q_DECL_EQ_DELETE;
#endif
static QMetaMethod fromSignalImpl(const QMetaObject *, void **);
@@ -206,7 +206,7 @@ inline bool operator!=(const QMetaMethod &m1, const QMetaMethod &m2)
class Q_CORE_EXPORT QMetaEnum
{
public:
- Q_DECL_CONSTEXPR inline QMetaEnum() : mobj(Q_NULLPTR), handle(0) {}
+ Q_DECL_CONSTEXPR inline QMetaEnum() : mobj(nullptr), handle(0) {}
const char *name() const;
bool isFlag() const;
@@ -218,14 +218,14 @@ public:
const char *scope() const;
- int keyToValue(const char *key, bool *ok = Q_NULLPTR) const;
+ int keyToValue(const char *key, bool *ok = nullptr) const;
const char* valueToKey(int value) const;
- int keysToValue(const char * keys, bool *ok = Q_NULLPTR) const;
+ int keysToValue(const char * keys, bool *ok = nullptr) const;
QByteArray valueToKeys(int value) const;
inline const QMetaObject *enclosingMetaObject() const { return mobj; }
- inline bool isValid() const { return name() != Q_NULLPTR; }
+ inline bool isValid() const { return name() != nullptr; }
template<typename T> static QMetaEnum fromType() {
Q_STATIC_ASSERT_X(QtPrivate::IsQEnumHelper<T>::Value,
@@ -256,11 +256,11 @@ public:
bool isReadable() const;
bool isWritable() const;
bool isResettable() const;
- bool isDesignable(const QObject *obj = Q_NULLPTR) const;
- bool isScriptable(const QObject *obj = Q_NULLPTR) const;
- bool isStored(const QObject *obj = Q_NULLPTR) const;
- bool isEditable(const QObject *obj = Q_NULLPTR) const;
- bool isUser(const QObject *obj = Q_NULLPTR) const;
+ bool isDesignable(const QObject *obj = nullptr) const;
+ bool isScriptable(const QObject *obj = nullptr) const;
+ bool isStored(const QObject *obj = nullptr) const;
+ bool isEditable(const QObject *obj = nullptr) const;
+ bool isUser(const QObject *obj = nullptr) const;
bool isConstant() const;
bool isFinal() const;
@@ -300,7 +300,7 @@ private:
class Q_CORE_EXPORT QMetaClassInfo
{
public:
- Q_DECL_CONSTEXPR inline QMetaClassInfo() : mobj(Q_NULLPTR), handle(0) {}
+ Q_DECL_CONSTEXPR inline QMetaClassInfo() : mobj(nullptr), handle(0) {}
const char *name() const;
const char *value() const;
inline const QMetaObject *enclosingMetaObject() const { return mobj; }
diff --git a/src/corelib/kernel/qmetatype.h b/src/corelib/kernel/qmetatype.h
index f704c5b21a..47c3a1c6f6 100644
--- a/src/corelib/kernel/qmetatype.h
+++ b/src/corelib/kernel/qmetatype.h
@@ -234,7 +234,7 @@ struct AbstractDebugStreamFunction
{
typedef void (*Stream)(const AbstractDebugStreamFunction *, QDebug&, const void *);
typedef void (*Destroy)(AbstractDebugStreamFunction *);
- explicit AbstractDebugStreamFunction(Stream s = Q_NULLPTR, Destroy d = Q_NULLPTR)
+ explicit AbstractDebugStreamFunction(Stream s = nullptr, Destroy d = nullptr)
: stream(s), destroy(d) {}
Q_DISABLE_COPY(AbstractDebugStreamFunction)
Stream stream;
@@ -264,7 +264,7 @@ struct AbstractComparatorFunction
typedef bool (*LessThan)(const AbstractComparatorFunction *, const void *, const void *);
typedef bool (*Equals)(const AbstractComparatorFunction *, const void *, const void *);
typedef void (*Destroy)(AbstractComparatorFunction *);
- explicit AbstractComparatorFunction(LessThan lt = Q_NULLPTR, Equals e = Q_NULLPTR, Destroy d = Q_NULLPTR)
+ explicit AbstractComparatorFunction(LessThan lt = nullptr, Equals e = nullptr, Destroy d = nullptr)
: lessThan(lt), equals(e), destroy(d) {}
Q_DISABLE_COPY(AbstractComparatorFunction)
LessThan lessThan;
@@ -301,7 +301,7 @@ template<typename T>
struct BuiltInEqualsComparatorFunction : public AbstractComparatorFunction
{
BuiltInEqualsComparatorFunction()
- : AbstractComparatorFunction(Q_NULLPTR, equals, destroy) {}
+ : AbstractComparatorFunction(nullptr, equals, destroy) {}
static bool equals(const AbstractComparatorFunction *, const void *l, const void *r)
{
const T *lhs = static_cast<const T *>(l);
@@ -318,7 +318,7 @@ struct BuiltInEqualsComparatorFunction : public AbstractComparatorFunction
struct AbstractConverterFunction
{
typedef bool (*Converter)(const AbstractConverterFunction *, const void *, void*);
- explicit AbstractConverterFunction(Converter c = Q_NULLPTR)
+ explicit AbstractConverterFunction(Converter c = nullptr)
: convert(c) {}
Q_DISABLE_COPY(AbstractConverterFunction)
Converter convert;
@@ -513,9 +513,9 @@ public:
static TypeFlags typeFlags(int type);
static const QMetaObject *metaObjectForType(int type);
static bool isRegistered(int type);
- static void *create(int type, const void *copy = Q_NULLPTR);
+ static void *create(int type, const void *copy = nullptr);
#if QT_DEPRECATED_SINCE(5, 0)
- QT_DEPRECATED static void *construct(int type, const void *copy = Q_NULLPTR)
+ QT_DEPRECATED static void *construct(int type, const void *copy = nullptr)
{ return create(type, copy); }
#endif
static void destroy(int type, void *data);
@@ -536,9 +536,9 @@ public:
inline TypeFlags flags() const;
inline const QMetaObject *metaObject() const;
- inline void *create(const void *copy = Q_NULLPTR) const;
+ inline void *create(const void *copy = nullptr) const;
inline void destroy(void *data) const;
- inline void *construct(void *where, const void *copy = Q_NULLPTR) const;
+ inline void *construct(void *where, const void *copy = nullptr) const;
inline void destruct(void *data) const;
public:
@@ -617,7 +617,7 @@ public:
return registerConverterFunction(&f, fromTypeId, toTypeId);
}
- // member function as in "double QString::toDouble(bool *ok = Q_NULLPTR) const"
+ // member function as in "double QString::toDouble(bool *ok = nullptr) const"
template<typename From, typename To>
static bool registerConverter(To(From::*function)(bool*) const)
{
@@ -680,9 +680,9 @@ private:
uint sizeExtended() const;
QMetaType::TypeFlags flagsExtended() const;
const QMetaObject *metaObjectExtended() const;
- void *createExtended(const void *copy = Q_NULLPTR) const;
+ void *createExtended(const void *copy = nullptr) const;
void destroyExtended(void *data) const;
- void *constructExtended(void *where, const void *copy = Q_NULLPTR) const;
+ void *constructExtended(void *where, const void *copy = nullptr) const;
void destructExtended(void *data) const;
static bool registerComparatorFunction(const QtPrivate::AbstractComparatorFunction *f, int type);
@@ -782,7 +782,7 @@ struct QMetaTypeFunctionHelper {
template <typename T>
struct QMetaTypeFunctionHelper<T, /* Accepted */ false> {
static void Destruct(void *) {}
- static void *Construct(void *, const void *) { return Q_NULLPTR; }
+ static void *Construct(void *, const void *) { return nullptr; }
#ifndef QT_NO_DATASTREAM
static void Save(QDataStream &, const void *) {}
static void Load(QDataStream &, void *) {}
@@ -1020,7 +1020,7 @@ public:
public:
template<class T> QSequentialIterableImpl(const T*p)
: _iterable(p)
- , _iterator(Q_NULLPTR)
+ , _iterator(nullptr)
, _metaType_id(qMetaTypeId<typename T::value_type>())
, _metaType_flags(QTypeInfo<typename T::value_type>::isPointer)
, _iteratorCapabilities(ContainerAPI<T>::IteratorCapabilities)
@@ -1037,20 +1037,20 @@ public:
}
QSequentialIterableImpl()
- : _iterable(Q_NULLPTR)
- , _iterator(Q_NULLPTR)
+ : _iterable(nullptr)
+ , _iterator(nullptr)
, _metaType_id(QMetaType::UnknownType)
, _metaType_flags(0)
, _iteratorCapabilities(0)
- , _size(Q_NULLPTR)
- , _at(Q_NULLPTR)
- , _moveToBegin(Q_NULLPTR)
- , _moveToEnd(Q_NULLPTR)
- , _advance(Q_NULLPTR)
- , _get(Q_NULLPTR)
- , _destroyIter(Q_NULLPTR)
- , _equalIter(Q_NULLPTR)
- , _copyIter(Q_NULLPTR)
+ , _size(nullptr)
+ , _at(nullptr)
+ , _moveToBegin(nullptr)
+ , _moveToEnd(nullptr)
+ , _advance(nullptr)
+ , _get(nullptr)
+ , _destroyIter(nullptr)
+ , _equalIter(nullptr)
+ , _copyIter(nullptr)
{
}
@@ -1189,7 +1189,7 @@ public:
public:
template<class T> QAssociativeIterableImpl(const T*p)
: _iterable(p)
- , _iterator(Q_NULLPTR)
+ , _iterator(nullptr)
, _metaType_id_key(qMetaTypeId<typename T::key_type>())
, _metaType_flags_key(QTypeInfo<typename T::key_type>::isPointer)
, _metaType_id_value(qMetaTypeId<typename T::mapped_type>())
@@ -1208,22 +1208,22 @@ public:
}
QAssociativeIterableImpl()
- : _iterable(Q_NULLPTR)
- , _iterator(Q_NULLPTR)
+ : _iterable(nullptr)
+ , _iterator(nullptr)
, _metaType_id_key(QMetaType::UnknownType)
, _metaType_flags_key(0)
, _metaType_id_value(QMetaType::UnknownType)
, _metaType_flags_value(0)
- , _size(Q_NULLPTR)
- , _find(Q_NULLPTR)
- , _begin(Q_NULLPTR)
- , _end(Q_NULLPTR)
- , _advance(Q_NULLPTR)
- , _getKey(Q_NULLPTR)
- , _getValue(Q_NULLPTR)
- , _destroyIter(Q_NULLPTR)
- , _equalIter(Q_NULLPTR)
- , _copyIter(Q_NULLPTR)
+ , _size(nullptr)
+ , _find(nullptr)
+ , _begin(nullptr)
+ , _end(nullptr)
+ , _advance(nullptr)
+ , _getKey(nullptr)
+ , _getValue(nullptr)
+ , _destroyIter(nullptr)
+ , _equalIter(nullptr)
+ , _copyIter(nullptr)
{
}
@@ -1292,13 +1292,13 @@ public:
}
QPairVariantInterfaceImpl()
- : _pair(Q_NULLPTR)
+ : _pair(nullptr)
, _metaType_id_first(QMetaType::UnknownType)
, _metaType_flags_first(0)
, _metaType_id_second(QMetaType::UnknownType)
, _metaType_flags_second(0)
- , _getFirst(Q_NULLPTR)
- , _getSecond(Q_NULLPTR)
+ , _getFirst(nullptr)
+ , _getSecond(nullptr)
{
}
@@ -1374,7 +1374,7 @@ namespace QtPrivate
#endif
static no_type checkType(...);
Q_STATIC_ASSERT_X(sizeof(T), "Type argument of Q_DECLARE_METATYPE(T*) must be fully defined");
- enum { Value = sizeof(checkType(static_cast<T*>(Q_NULLPTR))) == sizeof(yes_type) };
+ enum { Value = sizeof(checkType(static_cast<T*>(nullptr))) == sizeof(yes_type) };
};
template<typename T, typename Enable = void>
@@ -1419,12 +1419,12 @@ namespace QtPrivate
template<typename T, typename Enable = void>
struct MetaObjectForType
{
- static inline const QMetaObject *value() { return Q_NULLPTR; }
+ static inline const QMetaObject *value() { return nullptr; }
};
template<>
struct MetaObjectForType<void>
{
- static inline const QMetaObject *value() { return Q_NULLPTR; }
+ static inline const QMetaObject *value() { return nullptr; }
};
template<typename T>
struct MetaObjectForType<T*, typename std::enable_if<IsPointerToTypeDerivedFromQObject<T*>::Value>::type>
@@ -1720,7 +1720,7 @@ int qRegisterNormalizedMetaType(const QT_PREPEND_NAMESPACE(QByteArray) &normaliz
template <typename T>
int qRegisterMetaType(const char *typeName
#ifndef Q_QDOC
- , T * dummy = Q_NULLPTR
+ , T * dummy = nullptr
, typename QtPrivate::MetaTypeDefinedHelper<T, QMetaTypeId2<T>::Defined && !QMetaTypeId2<T>::IsBuiltIn>::DefinedType defined = QtPrivate::MetaTypeDefinedHelper<T, QMetaTypeId2<T>::Defined && !QMetaTypeId2<T>::IsBuiltIn>::Defined
#endif
)
@@ -1737,7 +1737,7 @@ int qRegisterMetaType(const char *typeName
template <typename T>
void qRegisterMetaTypeStreamOperators(const char *typeName
#ifndef Q_QDOC
- , T * /* dummy */ = Q_NULLPTR
+ , T * /* dummy */ = nullptr
#endif
)
{
@@ -2150,7 +2150,7 @@ inline QMetaType::QMetaType(const ExtensionFlag extensionFlags, const QMetaTypeI
, m_loadOp(loadOp)
, m_constructor(constructor)
, m_destructor(destructor)
- , m_extension(Q_NULLPTR)
+ , m_extension(nullptr)
, m_size(size)
, m_typeFlags(theTypeFlags)
, m_extensionFlags(extensionFlags)
diff --git a/src/corelib/kernel/qobject.cpp b/src/corelib/kernel/qobject.cpp
index bc1af5d66f..30cae20359 100644
--- a/src/corelib/kernel/qobject.cpp
+++ b/src/corelib/kernel/qobject.cpp
@@ -998,7 +998,7 @@ QObject::~QObject()
if (senderLists)
senderLists->dirty = true;
- QtPrivate::QSlotObjectBase *slotObj = Q_NULLPTR;
+ QtPrivate::QSlotObjectBase *slotObj = nullptr;
if (node->isSlotObject) {
slotObj = node->slotObj;
node->isSlotObject = false;
@@ -1468,14 +1468,14 @@ void QObject::moveToThread(QThread *targetThread)
}
QThreadData *currentData = QThreadData::current();
- QThreadData *targetData = targetThread ? QThreadData::get2(targetThread) : Q_NULLPTR;
+ QThreadData *targetData = targetThread ? QThreadData::get2(targetThread) : nullptr;
if (d->threadData->thread == 0 && currentData == targetData) {
// one exception to the rule: we allow moving objects with no thread affinity to the current thread
currentData = d->threadData;
} else if (d->threadData != currentData) {
qWarning("QObject::moveToThread: Current thread (%p) is not the object's thread (%p).\n"
"Cannot move to target thread (%p)\n",
- currentData->thread.load(), d->threadData->thread.load(), targetData ? targetData->thread.load() : Q_NULLPTR);
+ currentData->thread.load(), d->threadData->thread.load(), targetData ? targetData->thread.load() : nullptr);
#ifdef Q_OS_MAC
qWarning("You might be loading two sets of Qt binaries into the same process. "
@@ -5024,7 +5024,7 @@ bool QObjectPrivate::disconnect(const QObject *sender, int signal_index, void **
*/
/*!
- Create a copy of the handle to the connection
+ Create a copy of the handle to the \a other connection
*/
QMetaObject::Connection::Connection(const QMetaObject::Connection &other) : d_ptr(other.d_ptr)
{
@@ -5032,6 +5032,9 @@ QMetaObject::Connection::Connection(const QMetaObject::Connection &other) : d_pt
static_cast<QObjectPrivate::Connection *>(d_ptr)->ref();
}
+/*!
+ Assigns \a other to this connection and returns a reference to this connection.
+*/
QMetaObject::Connection& QMetaObject::Connection::operator=(const QMetaObject::Connection& other)
{
if (other.d_ptr != d_ptr) {
diff --git a/src/corelib/kernel/qobject.h b/src/corelib/kernel/qobject.h
index 2e66daa914..d297109acb 100644
--- a/src/corelib/kernel/qobject.h
+++ b/src/corelib/kernel/qobject.h
@@ -120,23 +120,23 @@ class Q_CORE_EXPORT QObject
Q_DECLARE_PRIVATE(QObject)
public:
- Q_INVOKABLE explicit QObject(QObject *parent=Q_NULLPTR);
+ Q_INVOKABLE explicit QObject(QObject *parent=nullptr);
virtual ~QObject();
virtual bool event(QEvent *event);
virtual bool eventFilter(QObject *watched, QEvent *event);
#ifdef Q_QDOC
- static QString tr(const char *sourceText, const char *comment = Q_NULLPTR, int n = -1);
- static QString trUtf8(const char *sourceText, const char *comment = Q_NULLPTR, int n = -1);
+ static QString tr(const char *sourceText, const char *comment = nullptr, int n = -1);
+ static QString trUtf8(const char *sourceText, const char *comment = nullptr, int n = -1);
virtual const QMetaObject *metaObject() const;
static const QMetaObject staticMetaObject;
#endif
#ifdef QT_NO_TRANSLATION
- static QString tr(const char *sourceText, const char * = Q_NULLPTR, int = -1)
+ static QString tr(const char *sourceText, const char * = nullptr, int = -1)
{ return QString::fromUtf8(sourceText); }
#if QT_DEPRECATED_SINCE(5, 0)
- QT_DEPRECATED static QString trUtf8(const char *sourceText, const char * = Q_NULLPTR, int = -1)
+ QT_DEPRECATED static QString trUtf8(const char *sourceText, const char * = nullptr, int = -1)
{ return QString::fromUtf8(sourceText); }
#endif
#endif //QT_NO_TRANSLATION
@@ -248,7 +248,7 @@ public:
Q_STATIC_ASSERT_X((QtPrivate::AreArgumentsCompatible<typename SlotType::ReturnType, typename SignalType::ReturnType>::value),
"Return type of the slot is not compatible with the return type of the signal.");
- const int *types = Q_NULLPTR;
+ const int *types = nullptr;
if (type == Qt::QueuedConnection || type == Qt::BlockingQueuedConnection)
types = QtPrivate::ConnectionTypes<typename SignalType::Arguments>::types();
@@ -288,11 +288,11 @@ public:
Q_STATIC_ASSERT_X((QtPrivate::AreArgumentsCompatible<typename SlotType::ReturnType, typename SignalType::ReturnType>::value),
"Return type of the slot is not compatible with the return type of the signal.");
- const int *types = Q_NULLPTR;
+ const int *types = nullptr;
if (type == Qt::QueuedConnection || type == Qt::BlockingQueuedConnection)
types = QtPrivate::ConnectionTypes<typename SignalType::Arguments>::types();
- return connectImpl(sender, reinterpret_cast<void **>(&signal), context, Q_NULLPTR,
+ return connectImpl(sender, reinterpret_cast<void **>(&signal), context, nullptr,
new QtPrivate::QStaticSlotObject<Func2,
typename QtPrivate::List_Left<typename SignalType::Arguments, SlotType::ArgumentCount>::Value,
typename SignalType::ReturnType>(slot),
@@ -327,11 +327,11 @@ public:
Q_STATIC_ASSERT_X(QtPrivate::HasQ_OBJECT_Macro<typename SignalType::Object>::Value,
"No Q_OBJECT in the class with the signal");
- const int *types = Q_NULLPTR;
+ const int *types = nullptr;
if (type == Qt::QueuedConnection || type == Qt::BlockingQueuedConnection)
types = QtPrivate::ConnectionTypes<typename SignalType::Arguments>::types();
- return connectImpl(sender, reinterpret_cast<void **>(&signal), context, Q_NULLPTR,
+ return connectImpl(sender, reinterpret_cast<void **>(&signal), context, nullptr,
new QtPrivate::QFunctorSlotObject<Func2, SlotArgumentCount,
typename QtPrivate::List_Left<typename SignalType::Arguments, SlotArgumentCount>::Value,
typename SignalType::ReturnType>(std::move(slot)),
@@ -343,11 +343,11 @@ public:
const QObject *receiver, const char *member);
static bool disconnect(const QObject *sender, const QMetaMethod &signal,
const QObject *receiver, const QMetaMethod &member);
- inline bool disconnect(const char *signal = Q_NULLPTR,
- const QObject *receiver = Q_NULLPTR, const char *member = Q_NULLPTR) const
+ inline bool disconnect(const char *signal = nullptr,
+ const QObject *receiver = nullptr, const char *member = nullptr) const
{ return disconnect(this, signal, receiver, member); }
- inline bool disconnect(const QObject *receiver, const char *member = Q_NULLPTR) const
- { return disconnect(this, Q_NULLPTR, receiver, member); }
+ inline bool disconnect(const QObject *receiver, const char *member = nullptr) const
+ { return disconnect(this, nullptr, receiver, member); }
static bool disconnect(const QMetaObject::Connection &);
#ifdef Q_QDOC
@@ -375,7 +375,7 @@ public:
static inline bool disconnect(const typename QtPrivate::FunctionPointer<Func1>::Object *sender, Func1 signal,
const QObject *receiver, void **zero)
{
- // This is the overload for when one wish to disconnect a signal from any slot. (slot=Q_NULLPTR)
+ // This is the overload for when one wish to disconnect a signal from any slot. (slot=nullptr)
// Since the function template parameter cannot be deduced from '0', we use a
// dummy void ** parameter that must be equal to 0
Q_ASSERT(!zero);
@@ -406,14 +406,14 @@ public:
#endif // QT_NO_USERDATA
Q_SIGNALS:
- void destroyed(QObject * = Q_NULLPTR);
+ void destroyed(QObject * = nullptr);
void objectNameChanged(const QString &objectName, QPrivateSignal);
public:
inline QObject *parent() const { return d_ptr->parent; }
inline bool inherits(const char *classname) const
- { return const_cast<QObject *>(this)->qt_metacast(classname) != Q_NULLPTR; }
+ { return const_cast<QObject *>(this)->qt_metacast(classname) != nullptr; }
public Q_SLOTS:
void deleteLater();
@@ -432,7 +432,7 @@ protected:
virtual void disconnectNotify(const QMetaMethod &signal);
protected:
- QObject(QObjectPrivate &dd, QObject *parent = Q_NULLPTR);
+ QObject(QObjectPrivate &dd, QObject *parent = nullptr);
protected:
QScopedPointer<QObjectData> d_ptr;
@@ -525,16 +525,16 @@ inline T qobject_cast(const QObject *object)
template <class T> inline const char * qobject_interface_iid()
-{ return Q_NULLPTR; }
+{ return nullptr; }
#ifndef Q_MOC_RUN
# define Q_DECLARE_INTERFACE(IFace, IId) \
template <> inline const char *qobject_interface_iid<IFace *>() \
{ return IId; } \
template <> inline IFace *qobject_cast<IFace *>(QObject *object) \
- { return reinterpret_cast<IFace *>((object ? object->qt_metacast(IId) : Q_NULLPTR)); } \
+ { return reinterpret_cast<IFace *>((object ? object->qt_metacast(IId) : nullptr)); } \
template <> inline IFace *qobject_cast<IFace *>(const QObject *object) \
- { return reinterpret_cast<IFace *>((object ? const_cast<QObject *>(object)->qt_metacast(IId) : Q_NULLPTR)); }
+ { return reinterpret_cast<IFace *>((object ? const_cast<QObject *>(object)->qt_metacast(IId) : nullptr)); }
#endif // Q_MOC_RUN
#ifndef QT_NO_DEBUG_STREAM
@@ -580,7 +580,7 @@ QSignalBlocker::QSignalBlocker(QSignalBlocker &&other) Q_DECL_NOTHROW
m_blocked(other.m_blocked),
m_inhibited(other.m_inhibited)
{
- other.m_o = Q_NULLPTR;
+ other.m_o = nullptr;
}
QSignalBlocker &QSignalBlocker::operator=(QSignalBlocker &&other) Q_DECL_NOTHROW
@@ -594,7 +594,7 @@ QSignalBlocker &QSignalBlocker::operator=(QSignalBlocker &&other) Q_DECL_NOTHROW
m_blocked = other.m_blocked;
m_inhibited = other.m_inhibited;
// disable other:
- other.m_o = Q_NULLPTR;
+ other.m_o = nullptr;
}
return *this;
}
diff --git a/src/corelib/kernel/qobject_impl.h b/src/corelib/kernel/qobject_impl.h
index c775d807b1..1a14b93dcd 100644
--- a/src/corelib/kernel/qobject_impl.h
+++ b/src/corelib/kernel/qobject_impl.h
@@ -68,9 +68,9 @@ namespace QtPrivate {
{ enum { Value = QMetaTypeId2<Arg>::Defined && TypesAreDeclaredMetaType<List<Tail...>>::Value }; };
template <typename ArgList, bool Declared = TypesAreDeclaredMetaType<ArgList>::Value > struct ConnectionTypes
- { static const int *types() { return Q_NULLPTR; } };
+ { static const int *types() { return nullptr; } };
template <> struct ConnectionTypes<List<>, true>
- { static const int *types() { return Q_NULLPTR; } };
+ { static const int *types() { return nullptr; } };
template <typename... Args> struct ConnectionTypes<List<Args...>, true>
{ static const int *types() { static const int t[sizeof...(Args) + 1] = { (QtPrivate::QMetaTypeIdHelper<Args>::qt_metatype_id())..., 0 }; return t; } };
diff --git a/src/corelib/kernel/qobject_p.h b/src/corelib/kernel/qobject_p.h
index ad88bcf274..6aea40cf4a 100644
--- a/src/corelib/kernel/qobject_p.h
+++ b/src/corelib/kernel/qobject_p.h
@@ -1,6 +1,6 @@
/****************************************************************************
**
-** Copyright (C) 2016 The Qt Company Ltd.
+** Copyright (C) 2017 The Qt Company Ltd.
** Copyright (C) 2013 Olivier Goffart <ogoffart@woboq.com>
** Contact: https://www.qt.io/licensing/
**
@@ -145,7 +145,7 @@ public:
ushort connectionType : 3; // 0 == auto, 1 == direct, 2 == queued, 4 == blocking
ushort isSlotObject : 1;
ushort ownArgumentTypes : 1;
- Connection() : nextConnectionList(0), ref_(2), ownArgumentTypes(true) {
+ Connection() : nextConnectionList(nullptr), ref_(2), ownArgumentTypes(true) {
//ref_ is 2 for the use in the internal lists, and for the use in QMetaObject::Connection
}
~Connection();
@@ -160,7 +160,7 @@ public:
};
// ConnectionList is a singly-linked list
struct ConnectionList {
- ConnectionList() : first(0), last(0) {}
+ ConnectionList() : first(nullptr), last(nullptr) {}
Connection *first;
Connection *last;
};
@@ -200,7 +200,7 @@ public:
}
static const QObjectPrivate *get(const QObject *o) { return o->d_func(); }
- int signalIndex(const char *signalName, const QMetaObject **meta = 0) const;
+ int signalIndex(const char *signalName, const QMetaObject **meta = nullptr) const;
inline bool isSignalConnected(uint signalIdx, bool checkDeclarative = true) const;
inline bool isDeclarativeSignalConnected(uint signalIdx) const;
@@ -376,12 +376,12 @@ class Q_CORE_EXPORT QMetaCallEvent : public QEvent
{
public:
QMetaCallEvent(ushort method_offset, ushort method_relative, QObjectPrivate::StaticMetaCallFunction callFunction , const QObject *sender, int signalId,
- int nargs = 0, int *types = 0, void **args = 0, QSemaphore *semaphore = 0);
+ int nargs = 0, int *types = nullptr, void **args = nullptr, QSemaphore *semaphore = nullptr);
/*! \internal
\a signalId is in the signal index range (see QObjectPrivate::signalIndex()).
*/
QMetaCallEvent(QtPrivate::QSlotObjectBase *slotObj, const QObject *sender, int signalId,
- int nargs = 0, int *types = 0, void **args = 0, QSemaphore *semaphore = 0);
+ int nargs = 0, int *types = nullptr, void **args = nullptr, QSemaphore *semaphore = nullptr);
~QMetaCallEvent();
@@ -432,9 +432,9 @@ struct Q_CORE_EXPORT QAbstractDynamicMetaObject : public QDynamicMetaObjectData,
{
~QAbstractDynamicMetaObject();
- virtual QAbstractDynamicMetaObject *toDynamicMetaObject(QObject *) Q_DECL_OVERRIDE { return this; }
+ virtual QAbstractDynamicMetaObject *toDynamicMetaObject(QObject *) override { return this; }
virtual int createProperty(const char *, const char *) { return -1; }
- virtual int metaCall(QObject *, QMetaObject::Call c, int _id, void **a) Q_DECL_OVERRIDE
+ virtual int metaCall(QObject *, QMetaObject::Call c, int _id, void **a) override
{ return metaCall(c, _id, a); }
virtual int metaCall(QMetaObject::Call, int _id, void **) { return _id; } // Compat overload
};
diff --git a/src/corelib/kernel/qobjectdefs.h b/src/corelib/kernel/qobjectdefs.h
index 5fc8937f23..7d2cc4dcbc 100644
--- a/src/corelib/kernel/qobjectdefs.h
+++ b/src/corelib/kernel/qobjectdefs.h
@@ -137,9 +137,9 @@ class QString;
#ifndef QT_NO_TRANSLATION
// full set of tr functions
# define QT_TR_FUNCTIONS \
- static inline QString tr(const char *s, const char *c = Q_NULLPTR, int n = -1) \
+ static inline QString tr(const char *s, const char *c = nullptr, int n = -1) \
{ return staticMetaObject.tr(s, c, n); } \
- QT_DEPRECATED static inline QString trUtf8(const char *s, const char *c = Q_NULLPTR, int n = -1) \
+ QT_DEPRECATED static inline QString trUtf8(const char *s, const char *c = nullptr, int n = -1) \
{ return staticMetaObject.tr(s, c, n); }
#else
// inherit the ones from QObject
@@ -294,7 +294,7 @@ class QMetaClassInfo;
class Q_CORE_EXPORT QGenericArgument
{
public:
- inline QGenericArgument(const char *aName = Q_NULLPTR, const void *aData = Q_NULLPTR)
+ inline QGenericArgument(const char *aName = nullptr, const void *aData = nullptr)
: _data(aData), _name(aName) {}
inline void *data() const { return const_cast<void *>(_data); }
inline const char *name() const { return _name; }
@@ -307,7 +307,7 @@ private:
class Q_CORE_EXPORT QGenericReturnArgument: public QGenericArgument
{
public:
- inline QGenericReturnArgument(const char *aName = Q_NULLPTR, void *aData = Q_NULLPTR)
+ inline QGenericReturnArgument(const char *aName = nullptr, void *aData = nullptr)
: QGenericArgument(aName, aData)
{}
};
@@ -388,7 +388,7 @@ struct Q_CORE_EXPORT QMetaObject
// internal index-based connect
static Connection connect(const QObject *sender, int signal_index,
const QObject *receiver, int method_index,
- int type = 0, int *types = Q_NULLPTR);
+ int type = 0, int *types = nullptr);
// internal index-based disconnect
static bool disconnect(const QObject *sender, int signal_index,
const QObject *receiver, int method_index);
@@ -405,7 +405,7 @@ struct Q_CORE_EXPORT QMetaObject
static bool invokeMethod(QObject *obj, const char *member,
Qt::ConnectionType,
QGenericReturnArgument ret,
- QGenericArgument val0 = QGenericArgument(Q_NULLPTR),
+ QGenericArgument val0 = QGenericArgument(nullptr),
QGenericArgument val1 = QGenericArgument(),
QGenericArgument val2 = QGenericArgument(),
QGenericArgument val3 = QGenericArgument(),
@@ -418,7 +418,7 @@ struct Q_CORE_EXPORT QMetaObject
static inline bool invokeMethod(QObject *obj, const char *member,
QGenericReturnArgument ret,
- QGenericArgument val0 = QGenericArgument(Q_NULLPTR),
+ QGenericArgument val0 = QGenericArgument(nullptr),
QGenericArgument val1 = QGenericArgument(),
QGenericArgument val2 = QGenericArgument(),
QGenericArgument val3 = QGenericArgument(),
@@ -435,7 +435,7 @@ struct Q_CORE_EXPORT QMetaObject
static inline bool invokeMethod(QObject *obj, const char *member,
Qt::ConnectionType type,
- QGenericArgument val0 = QGenericArgument(Q_NULLPTR),
+ QGenericArgument val0 = QGenericArgument(nullptr),
QGenericArgument val1 = QGenericArgument(),
QGenericArgument val2 = QGenericArgument(),
QGenericArgument val3 = QGenericArgument(),
@@ -451,7 +451,7 @@ struct Q_CORE_EXPORT QMetaObject
}
static inline bool invokeMethod(QObject *obj, const char *member,
- QGenericArgument val0 = QGenericArgument(Q_NULLPTR),
+ QGenericArgument val0 = QGenericArgument(nullptr),
QGenericArgument val1 = QGenericArgument(),
QGenericArgument val2 = QGenericArgument(),
QGenericArgument val3 = QGenericArgument(),
@@ -466,11 +466,7 @@ struct Q_CORE_EXPORT QMetaObject
val1, val2, val3, val4, val5, val6, val7, val8, val9);
}
-#ifdef Q_QDOC
- template<typename PointerToMemberFunction, typename MemberFunctionReturnType>
- static bool invokeMethod(QObject *receiver, PointerToMemberFunction function, Qt::ConnectionType type = Qt::AutoConnection, MemberFunctionReturnType *ret = nullptr);
- template<typename PointerToMemberFunction, typename MemberFunctionReturnType>
- static bool invokeMethod(QObject *receiver, PointerToMemberFunction function, MemberFunctionReturnType *ret);
+#ifdef Q_CLANG_QDOC
template<typename Functor, typename FunctorReturnType>
static bool invokeMethod(QObject *context, Functor function, Qt::ConnectionType type = Qt::AutoConnection, FunctorReturnType *ret = nullptr);
template<typename Functor, typename FunctorReturnType>
@@ -551,7 +547,7 @@ struct Q_CORE_EXPORT QMetaObject
#endif
- QObject *newInstance(QGenericArgument val0 = QGenericArgument(Q_NULLPTR),
+ QObject *newInstance(QGenericArgument val0 = QGenericArgument(nullptr),
QGenericArgument val1 = QGenericArgument(),
QGenericArgument val2 = QGenericArgument(),
QGenericArgument val3 = QGenericArgument(),
@@ -611,14 +607,12 @@ public:
operator bool() const;
#else
typedef void *Connection::*RestrictedBool;
- operator RestrictedBool() const { return d_ptr && isConnected_helper() ? &Connection::d_ptr : Q_NULLPTR; }
+ operator RestrictedBool() const { return d_ptr && isConnected_helper() ? &Connection::d_ptr : nullptr; }
#endif
-#ifdef Q_COMPILER_RVALUE_REFS
- inline Connection(Connection &&o) : d_ptr(o.d_ptr) { o.d_ptr = Q_NULLPTR; }
- inline Connection &operator=(Connection &&other)
+ Connection(Connection &&o) Q_DECL_NOTHROW : d_ptr(o.d_ptr) { o.d_ptr = nullptr; }
+ Connection &operator=(Connection &&other) Q_DECL_NOTHROW
{ qSwap(d_ptr, other.d_ptr); return *this; }
-#endif
};
inline const QMetaObject *QMetaObject::superClass() const
diff --git a/src/corelib/kernel/qobjectdefs_impl.h b/src/corelib/kernel/qobjectdefs_impl.h
index b9f2e47e32..17872d830e 100644
--- a/src/corelib/kernel/qobjectdefs_impl.h
+++ b/src/corelib/kernel/qobjectdefs_impl.h
@@ -372,10 +372,10 @@ namespace QtPrivate {
inline int ref() Q_DECL_NOTHROW { return m_ref.ref(); }
inline void destroyIfLastRef() Q_DECL_NOTHROW
- { if (!m_ref.deref()) m_impl(Destroy, this, Q_NULLPTR, Q_NULLPTR, Q_NULLPTR); }
+ { if (!m_ref.deref()) m_impl(Destroy, this, nullptr, nullptr, nullptr); }
- inline bool compare(void **a) { bool ret = false; m_impl(Compare, this, Q_NULLPTR, a, &ret); return ret; }
- inline void call(QObject *r, void **a) { m_impl(Call, this, r, a, Q_NULLPTR); }
+ inline bool compare(void **a) { bool ret = false; m_impl(Compare, this, nullptr, a, &ret); return ret; }
+ inline void call(QObject *r, void **a) { m_impl(Call, this, r, a, nullptr); }
protected:
~QSlotObjectBase() {}
private:
diff --git a/src/corelib/kernel/qpointer.cpp b/src/corelib/kernel/qpointer.cpp
index 66495ce005..c3dee7989e 100644
--- a/src/corelib/kernel/qpointer.cpp
+++ b/src/corelib/kernel/qpointer.cpp
@@ -111,7 +111,7 @@
*/
/*!
- \fn QPointer::QPointer()
+ \fn template <class T> QPointer<T>::QPointer()
Constructs a 0 guarded pointer.
@@ -119,14 +119,14 @@
*/
/*!
- \fn QPointer::QPointer(T* p)
+ \fn template <class T> QPointer<T>::QPointer(T* p)
Constructs a guarded pointer that points to the same object that \a p
points to.
*/
/*!
- \fn QPointer::~QPointer()
+ \fn template <class T> QPointer<T>::~QPointer()
Destroys the guarded pointer. Just like a normal pointer,
destroying a guarded pointer does \e not destroy the object being
@@ -134,7 +134,7 @@
*/
/*!
- \fn void QPointer::swap(QPointer &other)
+ \fn template <class T> void QPointer<T>::swap(QPointer &other)
\since 5.6
Swaps the contents of this QPointer with the contents of \a other.
@@ -142,28 +142,28 @@
*/
/*!
- \fn QPointer<T> & QPointer::operator=(T* p)
+ \fn template <class T> QPointer<T> & QPointer<T>::operator=(T* p)
Assignment operator. This guarded pointer will now point to the
same object that \a p points to.
*/
/*!
- \fn T* QPointer::data() const
+ \fn template <class T> T* QPointer<T>::data() const
\since 4.4
Returns the pointer to the object being guarded.
*/
/*!
- \fn bool QPointer::isNull() const
+ \fn template <class T> bool QPointer<T>::isNull() const
Returns \c true if the referenced object has been destroyed or if
there is no referenced object; otherwise returns \c false.
*/
/*!
- \fn void QPointer::clear()
+ \fn template <class T> void QPointer<T>::clear()
\since 5.0
Clears this QPointer object.
@@ -172,21 +172,21 @@
*/
/*!
- \fn T* QPointer::operator->() const
+ \fn template <class T> T* QPointer<T>::operator->() const
Overloaded arrow operator; implements pointer semantics. Just use
this operator as you would with a normal C++ pointer.
*/
/*!
- \fn T& QPointer::operator*() const
+ \fn template <class T> T& QPointer<T>::operator*() const
Dereference operator; implements pointer semantics. Just use this
operator as you would with a normal C++ pointer.
*/
/*!
- \fn QPointer::operator T*() const
+ \fn template <class T> QPointer<T>::operator T*() const
Cast operator; implements pointer semantics. Because of this
function you can pass a QPointer\<T\> to a function where a T*
@@ -194,7 +194,7 @@
*/
/*!
- \fn bool operator==(const T *o, const QPointer<T> &p)
+ \fn template <class T> bool operator==(const T *o, const QPointer<T> &p)
\relates QPointer
Equality operator. Returns \c true if \a o and the guarded
@@ -203,7 +203,7 @@
*/
/*!
- \fn bool operator==(const QPointer<T> &p, const T *o)
+ \fn template <class T> bool operator==(const QPointer<T> &p, const T *o)
\relates QPointer
Equality operator. Returns \c true if \a o and the guarded
@@ -212,7 +212,7 @@
*/
/*!
- \fn bool operator==(T *o, const QPointer<T> &p)
+ \fn template <class T> bool operator==(T *o, const QPointer<T> &p)
\relates QPointer
Equality operator. Returns \c true if \a o and the guarded
@@ -221,7 +221,7 @@
*/
/*!
- \fn bool operator==(const QPointer<T> &p, T *o)
+ \fn template <class T> bool operator==(const QPointer<T> &p, T *o)
\relates QPointer
Equality operator. Returns \c true if \a o and the guarded
@@ -230,7 +230,7 @@
*/
/*!
- \fn bool operator==(const QPointer<T> &p1, const QPointer<T> &p2)
+ \fn template <class T> bool operator==(const QPointer<T> &p1, const QPointer<T> &p2)
\relates QPointer
Equality operator. Returns \c true if the guarded pointers \a p1 and \a p2
@@ -241,7 +241,7 @@
/*!
- \fn bool operator!=(const T *o, const QPointer<T> &p)
+ \fn template <class T> bool operator!=(const T *o, const QPointer<T> &p)
\relates QPointer
Inequality operator. Returns \c true if \a o and the guarded
@@ -249,7 +249,7 @@
returns \c false.
*/
/*!
- \fn bool operator!=(const QPointer<T> &p, const T *o)
+ \fn template <class T> bool operator!=(const QPointer<T> &p, const T *o)
\relates QPointer
Inequality operator. Returns \c true if \a o and the guarded
@@ -257,7 +257,7 @@
returns \c false.
*/
/*!
- \fn bool operator!=(T *o, const QPointer<T> &p)
+ \fn template <class T> bool operator!=(T *o, const QPointer<T> &p)
\relates QPointer
Inequality operator. Returns \c true if \a o and the guarded
@@ -265,7 +265,7 @@
returns \c false.
*/
/*!
- \fn bool operator!=(const QPointer<T> &p, T *o)
+ \fn template <class T> bool operator!=(const QPointer<T> &p, T *o)
\relates QPointer
Inequality operator. Returns \c true if \a o and the guarded
@@ -273,7 +273,7 @@
returns \c false.
*/
/*!
- \fn bool operator!=(const QPointer<T> &p1, const QPointer<T> &p2)
+ \fn template <class T> bool operator!=(const QPointer<T> &p1, const QPointer<T> &p2)
\relates QPointer
Inequality operator. Returns \c true if the guarded pointers \a p1 and
@@ -281,7 +281,7 @@
returns \c false.
*/
/*!
- \fn QPointer<T> qPointerFromVariant(const QVariant &variant)
+ \fn template <typename T> QPointer<T> qPointerFromVariant(const QVariant &variant)
\internal
diff --git a/src/corelib/kernel/qsharedmemory.cpp b/src/corelib/kernel/qsharedmemory.cpp
index c8ba13c90c..c952655cb8 100644
--- a/src/corelib/kernel/qsharedmemory.cpp
+++ b/src/corelib/kernel/qsharedmemory.cpp
@@ -67,9 +67,11 @@ QSharedMemoryPrivate::makePlatformSafeKey(const QString &key,
QString result = prefix;
- QString part1 = key;
- part1.replace(QRegExp(QLatin1String("[^A-Za-z]")), QString());
- result.append(part1);
+ for (QChar ch : key) {
+ if ((ch >= QLatin1Char('a') && ch <= QLatin1Char('z')) ||
+ (ch >= QLatin1Char('A') && ch <= QLatin1Char('Z')))
+ result += ch;
+ }
QByteArray hex = QCryptographicHash::hash(key.toUtf8(), QCryptographicHash::Sha1).toHex();
result.append(QLatin1String(hex));
diff --git a/src/corelib/kernel/qsharedmemory.h b/src/corelib/kernel/qsharedmemory.h
index 0d4edef23d..67cf52ac17 100644
--- a/src/corelib/kernel/qsharedmemory.h
+++ b/src/corelib/kernel/qsharedmemory.h
@@ -74,8 +74,8 @@ public:
UnknownError
};
- QSharedMemory(QObject *parent = Q_NULLPTR);
- QSharedMemory(const QString &key, QObject *parent = Q_NULLPTR);
+ QSharedMemory(QObject *parent = nullptr);
+ QSharedMemory(const QString &key, QObject *parent = nullptr);
~QSharedMemory();
void setKey(const QString &key);
diff --git a/src/corelib/kernel/qsocketnotifier.h b/src/corelib/kernel/qsocketnotifier.h
index 92cdf5be95..38e5f27247 100644
--- a/src/corelib/kernel/qsocketnotifier.h
+++ b/src/corelib/kernel/qsocketnotifier.h
@@ -53,7 +53,7 @@ class Q_CORE_EXPORT QSocketNotifier : public QObject
public:
enum Type { Read, Write, Exception };
- QSocketNotifier(qintptr socket, Type, QObject *parent = Q_NULLPTR);
+ QSocketNotifier(qintptr socket, Type, QObject *parent = nullptr);
~QSocketNotifier();
qintptr socket() const;
@@ -68,7 +68,7 @@ Q_SIGNALS:
void activated(int socket, QPrivateSignal);
protected:
- bool event(QEvent *) Q_DECL_OVERRIDE;
+ bool event(QEvent *) override;
private:
Q_DISABLE_COPY(QSocketNotifier)
diff --git a/src/corelib/kernel/qsystemerror_p.h b/src/corelib/kernel/qsystemerror_p.h
index 1d8c253f53..abc2f1efc1 100644
--- a/src/corelib/kernel/qsystemerror_p.h
+++ b/src/corelib/kernel/qsystemerror_p.h
@@ -56,7 +56,7 @@
QT_BEGIN_NAMESPACE
-class Q_CORE_EXPORT QSystemError
+class QSystemError
{
public:
enum ErrorScope
@@ -66,51 +66,27 @@ public:
NativeError
};
- inline QSystemError(int error, ErrorScope scope);
- inline QSystemError();
+ Q_DECL_CONSTEXPR explicit QSystemError(int error, ErrorScope scope)
+ : errorCode(error), errorScope(scope)
+ {
+ }
+ Q_DECL_CONSTEXPR QSystemError() = default;
- inline QString toString() const;
- inline ErrorScope scope() const;
- inline int error() const;
+ QString toString() const { return string(errorScope, errorCode); }
+ Q_DECL_CONSTEXPR ErrorScope scope() const { return errorScope; }
+ Q_DECL_CONSTEXPR int error() const { return errorCode; }
- static QString string(ErrorScope errorScope, int errorCode);
- static QString stdString(int errorCode = -1);
+ static Q_CORE_EXPORT QString string(ErrorScope errorScope, int errorCode);
+ static Q_CORE_EXPORT QString stdString(int errorCode = -1);
#ifdef Q_OS_WIN
- static QString windowsString(int errorCode = -1);
+ static Q_CORE_EXPORT QString windowsString(int errorCode = -1);
#endif
//data members
- int errorCode;
- ErrorScope errorScope;
+ int errorCode = 0;
+ ErrorScope errorScope = NoError;
};
-QSystemError::QSystemError(int error, QSystemError::ErrorScope scope)
-: errorCode(error), errorScope(scope)
-{
-
-}
-
-QSystemError::QSystemError()
-: errorCode(0), errorScope(NoError)
-{
-
-}
-
-QString QSystemError::toString() const
-{
- return string(errorScope, errorCode);
-}
-
-QSystemError::ErrorScope QSystemError::scope() const
-{
- return errorScope;
-}
-
-int QSystemError::error() const
-{
- return errorCode;
-}
-
QT_END_NAMESPACE
#endif // QSYSTEMERROR_P_H
diff --git a/src/corelib/kernel/qtimer.cpp b/src/corelib/kernel/qtimer.cpp
index 55f75ab17e..85e95d7f7e 100644
--- a/src/corelib/kernel/qtimer.cpp
+++ b/src/corelib/kernel/qtimer.cpp
@@ -271,7 +271,7 @@ public:
Q_SIGNALS:
void timeout();
protected:
- void timerEvent(QTimerEvent *) Q_DECL_OVERRIDE;
+ void timerEvent(QTimerEvent *) override;
};
QSingleShotTimer::QSingleShotTimer(int msec, Qt::TimerType timerType, const QObject *r, const char *member)
diff --git a/src/corelib/kernel/qtimer.h b/src/corelib/kernel/qtimer.h
index 44ae04f38d..d41573264f 100644
--- a/src/corelib/kernel/qtimer.h
+++ b/src/corelib/kernel/qtimer.h
@@ -63,7 +63,7 @@ class Q_CORE_EXPORT QTimer : public QObject
Q_PROPERTY(Qt::TimerType timerType READ timerType WRITE setTimerType)
Q_PROPERTY(bool active READ isActive)
public:
- explicit QTimer(QObject *parent = Q_NULLPTR);
+ explicit QTimer(QObject *parent = nullptr);
~QTimer();
inline bool isActive() const { return id >= 0; }
@@ -197,7 +197,7 @@ public:
#endif
protected:
- void timerEvent(QTimerEvent *) Q_DECL_OVERRIDE;
+ void timerEvent(QTimerEvent *) override;
private:
Q_DISABLE_COPY(QTimer)
diff --git a/src/corelib/kernel/qtranslator.cpp b/src/corelib/kernel/qtranslator.cpp
index 2232e24a25..c868f6d266 100644
--- a/src/corelib/kernel/qtranslator.cpp
+++ b/src/corelib/kernel/qtranslator.cpp
@@ -1064,7 +1064,7 @@ searchDependencies:
return QString();
}
-/*!
+/*
Empties this translator of all contents.
This function works with stripped translator files.
diff --git a/src/corelib/kernel/qtranslator.h b/src/corelib/kernel/qtranslator.h
index 97be16bc90..e7c39191e7 100644
--- a/src/corelib/kernel/qtranslator.h
+++ b/src/corelib/kernel/qtranslator.h
@@ -55,11 +55,11 @@ class Q_CORE_EXPORT QTranslator : public QObject
{
Q_OBJECT
public:
- explicit QTranslator(QObject *parent = Q_NULLPTR);
+ explicit QTranslator(QObject *parent = nullptr);
~QTranslator();
virtual QString translate(const char *context, const char *sourceText,
- const char *disambiguation = Q_NULLPTR, int n = -1) const;
+ const char *disambiguation = nullptr, int n = -1) const;
virtual bool isEmpty() const;
diff --git a/src/corelib/kernel/qvariant.h b/src/corelib/kernel/qvariant.h
index a2c5711993..6d4c163e76 100644
--- a/src/corelib/kernel/qvariant.h
+++ b/src/corelib/kernel/qvariant.h
@@ -284,14 +284,14 @@ class Q_CORE_EXPORT QVariant
void detach();
inline bool isDetached() const;
- int toInt(bool *ok = Q_NULLPTR) const;
- uint toUInt(bool *ok = Q_NULLPTR) const;
- qlonglong toLongLong(bool *ok = Q_NULLPTR) const;
- qulonglong toULongLong(bool *ok = Q_NULLPTR) const;
+ int toInt(bool *ok = nullptr) const;
+ uint toUInt(bool *ok = nullptr) const;
+ qlonglong toLongLong(bool *ok = nullptr) const;
+ qulonglong toULongLong(bool *ok = nullptr) const;
bool toBool() const;
- double toDouble(bool *ok = Q_NULLPTR) const;
- float toFloat(bool *ok = Q_NULLPTR) const;
- qreal toReal(bool *ok = Q_NULLPTR) const;
+ double toDouble(bool *ok = nullptr) const;
+ float toFloat(bool *ok = nullptr) const;
+ qreal toReal(bool *ok = nullptr) const;
QByteArray toByteArray() const;
QBitArray toBitArray() const;
QString toString() const;
@@ -370,7 +370,7 @@ class Q_CORE_EXPORT QVariant
struct Private
{
inline Private() Q_DECL_NOTHROW : type(Invalid), is_shared(false), is_null(true)
- { data.ptr = Q_NULLPTR; }
+ { data.ptr = nullptr; }
// Internal constructor for initialized variants.
explicit inline Private(uint variantType) Q_DECL_NOTHROW
diff --git a/src/corelib/kernel/qvariant_p.h b/src/corelib/kernel/qvariant_p.h
index 75c269d710..b22b7c231e 100644
--- a/src/corelib/kernel/qvariant_p.h
+++ b/src/corelib/kernel/qvariant_p.h
@@ -278,11 +278,11 @@ class QVariantIsNull
Q_STATIC_ASSERT(!HasIsNullMethod<SelfTest2>::Value);
struct SelfTest3 : public SelfTest1 {};
Q_STATIC_ASSERT(HasIsNullMethod<SelfTest3>::Value);
- struct SelfTestFinal1 Q_DECL_FINAL { bool isNull() const; };
+ struct SelfTestFinal1 final { bool isNull() const; };
Q_STATIC_ASSERT(HasIsNullMethod<SelfTestFinal1>::Value);
- struct SelfTestFinal2 Q_DECL_FINAL {};
+ struct SelfTestFinal2 final {};
Q_STATIC_ASSERT(!HasIsNullMethod<SelfTestFinal2>::Value);
- struct SelfTestFinal3 Q_DECL_FINAL : public SelfTest1 {};
+ struct SelfTestFinal3 final : public SelfTest1 {};
Q_STATIC_ASSERT(HasIsNullMethod<SelfTestFinal3>::Value);
template<typename T, bool HasIsNull = HasIsNullMethod<T>::Value>
diff --git a/src/corelib/kernel/qwineventnotifier.h b/src/corelib/kernel/qwineventnotifier.h
index f29f325d13..624e77e638 100644
--- a/src/corelib/kernel/qwineventnotifier.h
+++ b/src/corelib/kernel/qwineventnotifier.h
@@ -54,8 +54,8 @@ class Q_CORE_EXPORT QWinEventNotifier : public QObject
typedef Qt::HANDLE HANDLE;
public:
- explicit QWinEventNotifier(QObject *parent = Q_NULLPTR);
- explicit QWinEventNotifier(HANDLE hEvent, QObject *parent = Q_NULLPTR);
+ explicit QWinEventNotifier(QObject *parent = nullptr);
+ explicit QWinEventNotifier(HANDLE hEvent, QObject *parent = nullptr);
~QWinEventNotifier();
void setHandle(HANDLE hEvent);
diff --git a/src/corelib/mimetypes/mimetypes.qrc b/src/corelib/mimetypes/mimetypes.qrc
index f0cf47cd49..19bc1d3e2a 100644
--- a/src/corelib/mimetypes/mimetypes.qrc
+++ b/src/corelib/mimetypes/mimetypes.qrc
@@ -1,5 +1,5 @@
<RCC>
- <qresource prefix="/qt-project.org/qmime">
+ <qresource prefix="/qt-project.org/qmime/packages">
<file alias="freedesktop.org.xml">mime/packages/freedesktop.org.xml</file>
</qresource>
</RCC>
diff --git a/src/corelib/mimetypes/qmimedatabase.cpp b/src/corelib/mimetypes/qmimedatabase.cpp
index 687f0b3e03..f90fd12e3b 100644
--- a/src/corelib/mimetypes/qmimedatabase.cpp
+++ b/src/corelib/mimetypes/qmimedatabase.cpp
@@ -51,6 +51,7 @@
#include <QtCore/QFile>
#include <QtCore/QFileInfo>
#include <QtCore/QSet>
+#include <QtCore/QStandardPaths>
#include <QtCore/QBuffer>
#include <QtCore/QUrl>
#include <QtCore/QDebug>
@@ -69,34 +70,102 @@ QMimeDatabasePrivate *QMimeDatabasePrivate::instance()
}
QMimeDatabasePrivate::QMimeDatabasePrivate()
- : m_provider(0), m_defaultMimeType(QLatin1String("application/octet-stream"))
+ : m_defaultMimeType(QLatin1String("application/octet-stream"))
{
}
QMimeDatabasePrivate::~QMimeDatabasePrivate()
{
- delete m_provider;
- m_provider = 0;
+ qDeleteAll(m_providers);
}
-QMimeProviderBase *QMimeDatabasePrivate::provider()
+Q_CORE_EXPORT int qmime_secondsBetweenChecks = 5; // exported for the unit test
+
+bool QMimeDatabasePrivate::shouldCheck()
+{
+ if (m_lastCheck.isValid() && m_lastCheck.elapsed() < qmime_secondsBetweenChecks * 1000)
+ return false;
+ m_lastCheck.start();
+ return true;
+}
+
+#if defined(Q_OS_UNIX) && !defined(Q_OS_INTEGRITY)
+#define QT_USE_MMAP
+#endif
+
+void QMimeDatabasePrivate::loadProviders()
{
- if (!m_provider) {
- QMimeProviderBase *binaryProvider = new QMimeBinaryProvider(this);
- if (binaryProvider->isValid()) {
- m_provider = binaryProvider;
+ // We use QStandardPaths every time to check if new files appeared
+ QStringList mimeDirs = QStandardPaths::locateAll(QStandardPaths::GenericDataLocation, QLatin1String("mime"), QStandardPaths::LocateDirectory);
+ const auto fdoIterator = std::find_if(mimeDirs.constBegin(), mimeDirs.constEnd(), [](const QString &mimeDir) -> bool {
+ return QFileInfo::exists(mimeDir + QStringLiteral("/packages/freedesktop.org.xml")); }
+ );
+ if (fdoIterator == mimeDirs.constEnd())
+ mimeDirs.prepend(QLatin1String(":/qt-project.org/qmime"));
+ //qDebug() << "mime dirs:" << mimeDirs;
+
+ QVector<QMimeProviderBase *> currentProviders = m_providers;
+ m_providers.clear();
+ m_providers.reserve(mimeDirs.size());
+ for (const QString &mimeDir : qAsConst(mimeDirs)) {
+ const QString cacheFile = mimeDir + QStringLiteral("/mime.cache");
+ QFileInfo fileInfo(cacheFile);
+ // Check if we already have a provider for this dir
+ const auto it = std::find_if(currentProviders.begin(), currentProviders.end(), [mimeDir](QMimeProviderBase *prov) { return prov->directory() == mimeDir; });
+ if (it == currentProviders.end()) {
+ QMimeProviderBase *provider = nullptr;
+#if defined(QT_USE_MMAP)
+ if (qEnvironmentVariableIsEmpty("QT_NO_MIME_CACHE") && fileInfo.exists()) {
+ provider = new QMimeBinaryProvider(this, mimeDir);
+ //qDebug() << "Created binary provider for" << mimeDir;
+ if (!provider->isValid()) {
+ delete provider;
+ provider = nullptr;
+ }
+ }
+#endif
+ if (!provider) {
+ provider = new QMimeXMLProvider(this, mimeDir);
+ //qDebug() << "Created XML provider for" << mimeDir;
+ }
+ m_providers.append(provider);
} else {
- delete binaryProvider;
- m_provider = new QMimeXMLProvider(this);
+ QMimeProviderBase *provider = *it;
+ currentProviders.erase(it);
+ provider->ensureLoaded();
+ if (!provider->isValid()) {
+ delete provider;
+ provider = new QMimeXMLProvider(this, mimeDir);
+ //qDebug() << "Created XML provider to replace binary provider for" << mimeDir;
+ }
+ m_providers.append(provider);
}
}
- return m_provider;
+ qDeleteAll(currentProviders);
}
-void QMimeDatabasePrivate::setProvider(QMimeProviderBase *theProvider)
+QVector<QMimeProviderBase *> QMimeDatabasePrivate::providers()
{
- delete m_provider;
- m_provider = theProvider;
+ Q_ASSERT(!mutex.tryLock()); // caller should have locked mutex
+ if (m_providers.isEmpty()) {
+ loadProviders();
+ m_lastCheck.start();
+ } else {
+ if (shouldCheck())
+ loadProviders();
+ }
+ return m_providers;
+}
+
+QString QMimeDatabasePrivate::resolveAlias(const QString &nameOrAlias)
+{
+ const auto allProviders = providers();
+ for (QMimeProviderBase *provider : allProviders) {
+ const QString ret = provider->resolveAlias(nameOrAlias);
+ if (!ret.isEmpty())
+ return ret;
+ }
+ return nameOrAlias;
}
/*!
@@ -105,7 +174,14 @@ void QMimeDatabasePrivate::setProvider(QMimeProviderBase *theProvider)
*/
QMimeType QMimeDatabasePrivate::mimeTypeForName(const QString &nameOrAlias)
{
- return provider()->mimeTypeForName(provider()->resolveAlias(nameOrAlias));
+ const auto allProviders = providers();
+ const QString mimeName = resolveAlias(nameOrAlias);
+ for (QMimeProviderBase *provider : allProviders) {
+ const QMimeType mime = provider->mimeTypeForName(mimeName);
+ if (mime.isValid())
+ return mime;
+ }
+ return {};
}
QStringList QMimeDatabasePrivate::mimeTypeForFileName(const QString &fileName)
@@ -113,11 +189,113 @@ QStringList QMimeDatabasePrivate::mimeTypeForFileName(const QString &fileName)
if (fileName.endsWith(QLatin1Char('/')))
return QStringList() << QLatin1String("inode/directory");
- QStringList matchingMimeTypes = provider()->findByFileName(QFileInfo(fileName).fileName()).m_matchingMimeTypes;
+ const QString shortName = QFileInfo(fileName).fileName();
+ const QMimeGlobMatchResult result = findByFileName(shortName);
+ QStringList matchingMimeTypes = result.m_matchingMimeTypes;
matchingMimeTypes.sort(); // make it deterministic
return matchingMimeTypes;
}
+QMimeGlobMatchResult QMimeDatabasePrivate::findByFileName(const QString &fileName)
+{
+ QMimeGlobMatchResult result;
+ // TODO this parses in the order (local, global). Check that it handles "NOGLOBS" correctly.
+ const auto allProviders = providers();
+ for (QMimeProviderBase *provider : allProviders)
+ provider->addFileNameMatches(fileName, result);
+ return result;
+}
+
+void QMimeDatabasePrivate::loadMimeTypePrivate(QMimeTypePrivate &mimePrivate)
+{
+ QMutexLocker locker(&mutex);
+ if (!mimePrivate.loaded) { // XML provider sets loaded=true, binary provider does this on demand
+ Q_ASSERT(mimePrivate.fromCache);
+ QMimeBinaryProvider::loadMimeTypePrivate(mimePrivate);
+ }
+}
+
+void QMimeDatabasePrivate::loadGenericIcon(QMimeTypePrivate &mimePrivate)
+{
+ QMutexLocker locker(&mutex);
+ if (mimePrivate.fromCache) {
+ mimePrivate.genericIconName.clear();
+ const auto allProviders = providers();
+ for (QMimeProviderBase *provider : allProviders) {
+ provider->loadGenericIcon(mimePrivate);
+ if (!mimePrivate.genericIconName.isEmpty())
+ break;
+ }
+ }
+}
+
+void QMimeDatabasePrivate::loadIcon(QMimeTypePrivate &mimePrivate)
+{
+ QMutexLocker locker(&mutex);
+ if (mimePrivate.fromCache) {
+ mimePrivate.iconName.clear();
+ const auto allProviders = providers();
+ for (QMimeProviderBase *provider : allProviders) {
+ provider->loadIcon(mimePrivate);
+ if (!mimePrivate.iconName.isEmpty())
+ break;
+ }
+ }
+}
+
+static QString fallbackParent(const QString &mimeTypeName)
+{
+ const QStringRef myGroup = mimeTypeName.leftRef(mimeTypeName.indexOf(QLatin1Char('/')));
+ // All text/* types are subclasses of text/plain.
+ if (myGroup == QLatin1String("text") && mimeTypeName != QLatin1String("text/plain"))
+ return QLatin1String("text/plain");
+ // All real-file mimetypes implicitly derive from application/octet-stream
+ if (myGroup != QLatin1String("inode") &&
+ // ignore non-file extensions
+ myGroup != QLatin1String("all") && myGroup != QLatin1String("fonts") && myGroup != QLatin1String("print") && myGroup != QLatin1String("uri")
+ && mimeTypeName != QLatin1String("application/octet-stream")) {
+ return QLatin1String("application/octet-stream");
+ }
+ return QString();
+}
+
+QStringList QMimeDatabasePrivate::mimeParents(const QString &mimeName)
+{
+ QMutexLocker locker(&mutex);
+ return parents(mimeName);
+}
+
+QStringList QMimeDatabasePrivate::parents(const QString &mimeName)
+{
+ Q_ASSERT(!mutex.tryLock());
+ QStringList result;
+ const auto allProviders = providers();
+ for (QMimeProviderBase *provider : allProviders)
+ provider->addParents(mimeName, result);
+ if (result.isEmpty()) {
+ const QString parent = fallbackParent(mimeName);
+ if (!parent.isEmpty())
+ result.append(parent);
+ }
+ return result;
+}
+
+QStringList QMimeDatabasePrivate::listAliases(const QString &mimeName)
+{
+ QMutexLocker locker(&mutex);
+ QStringList result;
+ const auto allProviders = providers();
+ for (QMimeProviderBase *provider : allProviders)
+ provider->addAliases(mimeName, result);
+ return result;
+}
+
+bool QMimeDatabasePrivate::mimeInherits(const QString &mime, const QString &parent)
+{
+ QMutexLocker locker(&mutex);
+ return inherits(mime, parent);
+}
+
static inline bool isTextFile(const QByteArray &data)
{
// UTF16 byte order marks
@@ -145,7 +323,10 @@ QMimeType QMimeDatabasePrivate::findByData(const QByteArray &data, int *accuracy
}
*accuracyPtr = 0;
- QMimeType candidate = provider()->findByMagic(data, accuracyPtr);
+ QMimeType candidate;
+ const auto allProviders = providers();
+ for (QMimeProviderBase *provider : allProviders)
+ provider->findByMagic(data, accuracyPtr, candidate);
if (candidate.isValid())
return candidate;
@@ -172,7 +353,7 @@ QMimeType QMimeDatabasePrivate::mimeTypeForFileNameAndData(const QString &fileNa
if (fileName.endsWith(QLatin1Char('/')))
candidatesByName.addMatch(QLatin1String("inode/directory"), 100, QString());
else
- candidatesByName = provider()->findByFileName(QFileInfo(fileName).fileName());
+ candidatesByName = findByFileName(QFileInfo(fileName).fileName());
if (candidatesByName.m_allMatchingMimeTypes.count() == 1) {
*accuracyPtr = 100;
const QMimeType mime = mimeTypeForName(candidatesByName.m_matchingMimeTypes.at(0));
@@ -222,21 +403,25 @@ QMimeType QMimeDatabasePrivate::mimeTypeForFileNameAndData(const QString &fileNa
QList<QMimeType> QMimeDatabasePrivate::allMimeTypes()
{
- return provider()->allMimeTypes();
+ QList<QMimeType> result;
+ const auto allProviders = providers();
+ for (QMimeProviderBase *provider : allProviders)
+ provider->addAllMimeTypes(result);
+ return result;
}
bool QMimeDatabasePrivate::inherits(const QString &mime, const QString &parent)
{
- const QString resolvedParent = provider()->resolveAlias(parent);
- //Q_ASSERT(provider()->resolveAlias(mime) == mime);
+ const QString resolvedParent = resolveAlias(parent);
std::stack<QString, QStringList> toCheck;
toCheck.push(mime);
while (!toCheck.empty()) {
if (toCheck.top() == resolvedParent)
return true;
- const auto parents = provider()->parents(toCheck.top());
+ const QString mimeName = toCheck.top();
toCheck.pop();
- for (const QString &par : parents)
+ const auto parentList = parents(mimeName);
+ for (const QString &par : parentList)
toCheck.push(par);
}
return false;
@@ -460,7 +645,7 @@ QList<QMimeType> QMimeDatabase::mimeTypesForFileName(const QString &fileName) co
QString QMimeDatabase::suffixForFileName(const QString &fileName) const
{
QMutexLocker locker(&d->mutex);
- return d->provider()->findByFileName(QFileInfo(fileName).fileName()).m_foundSuffix;
+ return d->findByFileName(QFileInfo(fileName).fileName()).m_foundSuffix;
}
/*!
@@ -550,6 +735,7 @@ QMimeType QMimeDatabase::mimeTypeForUrl(const QUrl &url) const
*/
QMimeType QMimeDatabase::mimeTypeForFileNameAndData(const QString &fileName, QIODevice *device) const
{
+ QMutexLocker locker(&d->mutex);
int accuracy = 0;
const bool openedByUs = !device->isOpen() && device->open(QIODevice::ReadOnly);
const QMimeType result = d->mimeTypeForFileNameAndData(fileName, device, &accuracy);
@@ -576,6 +762,7 @@ QMimeType QMimeDatabase::mimeTypeForFileNameAndData(const QString &fileName, QIO
*/
QMimeType QMimeDatabase::mimeTypeForFileNameAndData(const QString &fileName, const QByteArray &data) const
{
+ QMutexLocker locker(&d->mutex);
QBuffer buffer(const_cast<QByteArray *>(&data));
buffer.open(QIODevice::ReadOnly);
int accuracy = 0;
diff --git a/src/corelib/mimetypes/qmimedatabase_p.h b/src/corelib/mimetypes/qmimedatabase_p.h
index 3f63f5f103..1c38f46115 100644
--- a/src/corelib/mimetypes/qmimedatabase_p.h
+++ b/src/corelib/mimetypes/qmimedatabase_p.h
@@ -59,7 +59,9 @@
#include "qmimetype_p.h"
#include "qmimeglobpattern_p.h"
+#include <QtCore/qelapsedtimer.h>
#include <QtCore/qmutex.h>
+#include <QtCore/qvector.h>
QT_BEGIN_NAMESPACE
@@ -77,22 +79,37 @@ public:
static QMimeDatabasePrivate *instance();
- QMimeProviderBase *provider();
- void setProvider(QMimeProviderBase *theProvider);
-
inline QString defaultMimeType() const { return m_defaultMimeType; }
bool inherits(const QString &mime, const QString &parent);
QList<QMimeType> allMimeTypes();
-
+ QString resolveAlias(const QString &nameOrAlias);
+ QStringList parents(const QString &mimeName);
QMimeType mimeTypeForName(const QString &nameOrAlias);
QMimeType mimeTypeForFileNameAndData(const QString &fileName, QIODevice *device, int *priorityPtr);
QMimeType findByData(const QByteArray &data, int *priorityPtr);
QStringList mimeTypeForFileName(const QString &fileName);
+ QMimeGlobMatchResult findByFileName(const QString &fileName);
+
+ // API for QMimeType. Takes care of locking the mutex.
+ void loadMimeTypePrivate(QMimeTypePrivate &mimePrivate);
+ void loadGenericIcon(QMimeTypePrivate &mimePrivate);
+ void loadIcon(QMimeTypePrivate &mimePrivate);
+ QStringList mimeParents(const QString &mimeName);
+ QStringList listAliases(const QString &mimeName);
+ bool mimeInherits(const QString &mime, const QString &parent);
- mutable QMimeProviderBase *m_provider;
+private:
+ QVector<QMimeProviderBase *> providers();
+ bool shouldCheck();
+ void loadProviders();
+
+ mutable QVector<QMimeProviderBase *> m_providers;
+ QElapsedTimer m_lastCheck;
+
+public:
const QString m_defaultMimeType;
QMutex mutex;
};
diff --git a/src/corelib/mimetypes/qmimeglobpattern.cpp b/src/corelib/mimetypes/qmimeglobpattern.cpp
index a4d2b046fa..e7b2b879a1 100644
--- a/src/corelib/mimetypes/qmimeglobpattern.cpp
+++ b/src/corelib/mimetypes/qmimeglobpattern.cpp
@@ -206,10 +206,9 @@ void QMimeGlobPatternList::match(QMimeGlobMatchResult &result,
}
}
-QMimeGlobMatchResult QMimeAllGlobPatterns::matchingGlobs(const QString &fileName) const
+void QMimeAllGlobPatterns::matchingGlobs(const QString &fileName, QMimeGlobMatchResult &result) const
{
// First try the high weight matches (>50), if any.
- QMimeGlobMatchResult result;
m_highWeightGlobs.match(result, fileName);
// Now use the "fast patterns" dict, for simple *.foo patterns with weight 50
@@ -230,8 +229,6 @@ QMimeGlobMatchResult QMimeAllGlobPatterns::matchingGlobs(const QString &fileName
// Finally, try the low weight matches (<=50)
m_lowWeightGlobs.match(result, fileName);
-
- return result;
}
void QMimeAllGlobPatterns::clear()
diff --git a/src/corelib/mimetypes/qmimeglobpattern_p.h b/src/corelib/mimetypes/qmimeglobpattern_p.h
index 21332e71bc..103729c4ff 100644
--- a/src/corelib/mimetypes/qmimeglobpattern_p.h
+++ b/src/corelib/mimetypes/qmimeglobpattern_p.h
@@ -152,7 +152,7 @@ public:
void addGlob(const QMimeGlobPattern &glob);
void removeMimeType(const QString &mimeType);
- QMimeGlobMatchResult matchingGlobs(const QString &fileName) const;
+ void matchingGlobs(const QString &fileName, QMimeGlobMatchResult &result) const;
void clear();
PatternsMap m_fastPatterns; // example: "doc" -> "application/msword", "text/plain"
diff --git a/src/corelib/mimetypes/qmimemagicrule.cpp b/src/corelib/mimetypes/qmimemagicrule.cpp
index 5bbf1bba9d..6356a3581b 100644
--- a/src/corelib/mimetypes/qmimemagicrule.cpp
+++ b/src/corelib/mimetypes/qmimemagicrule.cpp
@@ -65,7 +65,7 @@ static const char magicRuleTypes_string[] =
"\0";
static const int magicRuleTypes_indices[] = {
- 0, 8, 15, 22, 29, 35, 41, 50, 59, 65, 0
+ 0, 8, 15, 22, 29, 35, 41, 50, 59, 64, 0
};
QMimeMagicRule::Type QMimeMagicRule::type(const QByteArray &theTypeName)
diff --git a/src/corelib/mimetypes/qmimemagicrule_p.h b/src/corelib/mimetypes/qmimemagicrule_p.h
index 0c6c1dbcd7..9b27ef2657 100644
--- a/src/corelib/mimetypes/qmimemagicrule_p.h
+++ b/src/corelib/mimetypes/qmimemagicrule_p.h
@@ -90,7 +90,7 @@ public:
int endPos() const { return m_endPos; }
QByteArray mask() const;
- bool isValid() const { return m_matchFunction != Q_NULLPTR; }
+ bool isValid() const { return m_matchFunction != nullptr; }
bool matches(const QByteArray &data) const;
diff --git a/src/corelib/mimetypes/qmimeprovider.cpp b/src/corelib/mimetypes/qmimeprovider.cpp
index ed7ebb2ef5..ec0a6bf0ef 100644
--- a/src/corelib/mimetypes/qmimeprovider.cpp
+++ b/src/corelib/mimetypes/qmimeprovider.cpp
@@ -61,46 +61,18 @@ static void initResources()
QT_BEGIN_NAMESPACE
-static QString fallbackParent(const QString &mimeTypeName)
-{
- const QStringRef myGroup = mimeTypeName.leftRef(mimeTypeName.indexOf(QLatin1Char('/')));
- // All text/* types are subclasses of text/plain.
- if (myGroup == QLatin1String("text") && mimeTypeName != QLatin1String("text/plain"))
- return QLatin1String("text/plain");
- // All real-file mimetypes implicitly derive from application/octet-stream
- if (myGroup != QLatin1String("inode") &&
- // ignore non-file extensions
- myGroup != QLatin1String("all") && myGroup != QLatin1String("fonts") && myGroup != QLatin1String("print") && myGroup != QLatin1String("uri")
- && mimeTypeName != QLatin1String("application/octet-stream")) {
- return QLatin1String("application/octet-stream");
- }
- return QString();
-}
-
-QMimeProviderBase::QMimeProviderBase(QMimeDatabasePrivate *db)
- : m_db(db)
+QMimeProviderBase::QMimeProviderBase(QMimeDatabasePrivate *db, const QString &directory)
+ : m_db(db), m_directory(directory)
{
}
-Q_CORE_EXPORT int qmime_secondsBetweenChecks = 5; // exported for the unit test
-bool QMimeProviderBase::shouldCheck()
-{
- if (m_lastCheck.isValid() && m_lastCheck.elapsed() < qmime_secondsBetweenChecks * 1000)
- return false;
- m_lastCheck.start();
- return true;
-}
-
-QMimeBinaryProvider::QMimeBinaryProvider(QMimeDatabasePrivate *db)
- : QMimeProviderBase(db), m_mimetypeListLoaded(false)
+QMimeBinaryProvider::QMimeBinaryProvider(QMimeDatabasePrivate *db, const QString &directory)
+ : QMimeProviderBase(db, directory), m_mimetypeListLoaded(false)
{
+ ensureLoaded();
}
-#if defined(Q_OS_UNIX) && !defined(Q_OS_INTEGRITY)
-#define QT_USE_MMAP
-#endif
-
struct QMimeBinaryProvider::CacheFile
{
CacheFile(const QString &fileName);
@@ -154,7 +126,6 @@ bool QMimeBinaryProvider::CacheFile::load()
bool QMimeBinaryProvider::CacheFile::reload()
{
- //qDebug() << "reload!" << file->fileName();
m_valid = false;
if (file.isOpen()) {
file.close();
@@ -163,18 +134,14 @@ bool QMimeBinaryProvider::CacheFile::reload()
return load();
}
-QMimeBinaryProvider::CacheFile *QMimeBinaryProvider::CacheFileList::findCacheFile(const QString &fileName) const
+QMimeBinaryProvider::~QMimeBinaryProvider()
{
- for (const_iterator it = begin(); it != end(); ++it) {
- if ((*it)->file.fileName() == fileName)
- return *it;
- }
- return 0;
+ delete m_cacheFile;
}
-QMimeBinaryProvider::~QMimeBinaryProvider()
+bool QMimeBinaryProvider::isValid()
{
- qDeleteAll(m_cacheFiles);
+ return m_cacheFile != nullptr;
}
// Position of the "list offsets" values, at the beginning of the mime.cache file
@@ -190,79 +157,33 @@ enum {
PosGenericIconsListOffset = 36
};
-bool QMimeBinaryProvider::isValid()
+bool QMimeBinaryProvider::checkCacheChanged()
{
-#if defined(QT_USE_MMAP)
- if (!qEnvironmentVariableIsEmpty("QT_NO_MIME_CACHE"))
- return false;
-
- Q_ASSERT(m_cacheFiles.isEmpty()); // this method is only ever called once
- checkCache();
-
- if (m_cacheFiles.count() > 1)
+ QFileInfo fileInfo(m_cacheFile->file);
+ if (fileInfo.lastModified() > m_cacheFile->m_mtime) {
+ // Deletion can't happen by just running update-mime-database.
+ // But the user could use rm -rf :-)
+ m_cacheFile->reload(); // will mark itself as invalid on failure
return true;
- if (m_cacheFiles.isEmpty())
- return false;
-
- // We found exactly one file; is it the user-modified mimes, or a system file?
- const QString foundFile = m_cacheFiles.constFirst()->file.fileName();
- const QString localCacheFile = QStandardPaths::writableLocation(QStandardPaths::GenericDataLocation) + QLatin1String("/mime/mime.cache");
-
- return foundFile != localCacheFile;
-#else
- return false;
-#endif
-}
-
-bool QMimeBinaryProvider::CacheFileList::checkCacheChanged()
-{
- bool somethingChanged = false;
- for (CacheFile *cacheFile : qAsConst(*this)) {
- QFileInfo fileInfo(cacheFile->file);
- if (!fileInfo.exists() || fileInfo.lastModified() > cacheFile->m_mtime) {
- // Deletion can't happen by just running update-mime-database.
- // But the user could use rm -rf :-)
- cacheFile->reload(); // will mark itself as invalid on failure
- somethingChanged = true;
- }
- }
- if (somethingChanged) {
- auto deleteIfNoLongerValid = [](CacheFile *cacheFile) -> bool {
- const bool invalid = !cacheFile->isValid();
- if (invalid)
- delete cacheFile;
- return invalid;
- };
- erase(std::remove_if(begin(), end(), deleteIfNoLongerValid), end());
}
- return somethingChanged;
+ return false;
}
-void QMimeBinaryProvider::checkCache()
+void QMimeBinaryProvider::ensureLoaded()
{
- if (!shouldCheck())
- return;
-
- // First iterate over existing known cache files and check for uptodate
- if (m_cacheFiles.checkCacheChanged())
- m_mimetypeListLoaded = false;
-
- // Then check if new cache files appeared
- const QStringList cacheFileNames = QStandardPaths::locateAll(QStandardPaths::GenericDataLocation, QLatin1String("mime/mime.cache"));
- if (cacheFileNames != m_cacheFileNames) {
- for (const QString &cacheFileName : cacheFileNames) {
- CacheFile *cacheFile = m_cacheFiles.findCacheFile(cacheFileName);
- if (!cacheFile) {
- //qDebug() << "new file:" << cacheFileName;
- cacheFile = new CacheFile(cacheFileName);
- if (cacheFile->isValid()) // verify version
- m_cacheFiles.append(cacheFile);
- else
- delete cacheFile;
- }
- }
- m_cacheFileNames = cacheFileNames;
+ if (!m_cacheFile) {
+ const QString cacheFileName = m_directory + QLatin1String("/mime.cache");
+ m_cacheFile = new CacheFile(cacheFileName);
m_mimetypeListLoaded = false;
+ } else {
+ if (checkCacheChanged())
+ m_mimetypeListLoaded = false;
+ else
+ return; // nothing to do
+ }
+ if (!m_cacheFile->isValid()) { // verify existence and version
+ delete m_cacheFile;
+ m_cacheFile = nullptr;
}
}
@@ -270,6 +191,7 @@ static QMimeType mimeTypeForNameUnchecked(const QString &name)
{
QMimeTypePrivate data;
data.name = name;
+ data.fromCache = true;
// The rest is retrieved on demand.
// comment and globPatterns: in loadMimeTypePrivate
// iconName: in loadIcon
@@ -279,7 +201,6 @@ static QMimeType mimeTypeForNameUnchecked(const QString &name)
QMimeType QMimeBinaryProvider::mimeTypeForName(const QString &name)
{
- checkCache();
if (!m_mimetypeListLoaded)
loadMimeTypeList();
if (!m_mimetypeNames.contains(name))
@@ -287,28 +208,23 @@ QMimeType QMimeBinaryProvider::mimeTypeForName(const QString &name)
return mimeTypeForNameUnchecked(name);
}
-QMimeGlobMatchResult QMimeBinaryProvider::findByFileName(const QString &fileName)
+void QMimeBinaryProvider::addFileNameMatches(const QString &fileName, QMimeGlobMatchResult &result)
{
- checkCache();
- QMimeGlobMatchResult result;
if (fileName.isEmpty())
- return result;
+ return;
+ Q_ASSERT(m_cacheFile);
const QString lowerFileName = fileName.toLower();
- // TODO this parses in the order (local, global). Check that it handles "NOGLOBS" correctly.
- for (CacheFile *cacheFile : qAsConst(m_cacheFiles)) {
- // Check literals (e.g. "Makefile")
- matchGlobList(result, cacheFile, cacheFile->getUint32(PosLiteralListOffset), fileName);
- // Check complex globs (e.g. "callgrind.out[0-9]*")
- matchGlobList(result, cacheFile, cacheFile->getUint32(PosGlobListOffset), fileName);
- // Check the very common *.txt cases with the suffix tree
- const int reverseSuffixTreeOffset = cacheFile->getUint32(PosReverseSuffixTreeOffset);
- const int numRoots = cacheFile->getUint32(reverseSuffixTreeOffset);
- const int firstRootOffset = cacheFile->getUint32(reverseSuffixTreeOffset + 4);
- matchSuffixTree(result, cacheFile, numRoots, firstRootOffset, lowerFileName, lowerFileName.length() - 1, false);
- if (result.m_matchingMimeTypes.isEmpty())
- matchSuffixTree(result, cacheFile, numRoots, firstRootOffset, fileName, fileName.length() - 1, true);
- }
- return result;
+ // Check literals (e.g. "Makefile")
+ matchGlobList(result, m_cacheFile, m_cacheFile->getUint32(PosLiteralListOffset), fileName);
+ // Check complex globs (e.g. "callgrind.out[0-9]*")
+ matchGlobList(result, m_cacheFile, m_cacheFile->getUint32(PosGlobListOffset), fileName);
+ // Check the very common *.txt cases with the suffix tree
+ const int reverseSuffixTreeOffset = m_cacheFile->getUint32(PosReverseSuffixTreeOffset);
+ const int numRoots = m_cacheFile->getUint32(reverseSuffixTreeOffset);
+ const int firstRootOffset = m_cacheFile->getUint32(reverseSuffixTreeOffset + 4);
+ matchSuffixTree(result, m_cacheFile, numRoots, firstRootOffset, lowerFileName, lowerFileName.length() - 1, false);
+ if (result.m_matchingMimeTypes.isEmpty())
+ matchSuffixTree(result, m_cacheFile, numRoots, firstRootOffset, fileName, fileName.length() - 1, true);
}
void QMimeBinaryProvider::matchGlobList(QMimeGlobMatchResult &result, CacheFile *cacheFile, int off, const QString &fileName)
@@ -406,124 +322,106 @@ bool QMimeBinaryProvider::matchMagicRule(QMimeBinaryProvider::CacheFile *cacheFi
return false;
}
-QMimeType QMimeBinaryProvider::findByMagic(const QByteArray &data, int *accuracyPtr)
-{
- checkCache();
- for (CacheFile *cacheFile : qAsConst(m_cacheFiles)) {
- const int magicListOffset = cacheFile->getUint32(PosMagicListOffset);
- const int numMatches = cacheFile->getUint32(magicListOffset);
- //const int maxExtent = cacheFile->getUint32(magicListOffset + 4);
- const int firstMatchOffset = cacheFile->getUint32(magicListOffset + 8);
-
- for (int i = 0; i < numMatches; ++i) {
- const int off = firstMatchOffset + i * 16;
- const int numMatchlets = cacheFile->getUint32(off + 8);
- const int firstMatchletOffset = cacheFile->getUint32(off + 12);
- if (matchMagicRule(cacheFile, numMatchlets, firstMatchletOffset, data)) {
- const int mimeTypeOffset = cacheFile->getUint32(off + 4);
- const char *mimeType = cacheFile->getCharStar(mimeTypeOffset);
- *accuracyPtr = cacheFile->getUint32(off);
- // Return the first match. We have no rules for conflicting magic data...
- // (mime.cache itself is sorted, but what about local overrides with a lower prio?)
- return mimeTypeForNameUnchecked(QLatin1String(mimeType));
- }
+void QMimeBinaryProvider::findByMagic(const QByteArray &data, int *accuracyPtr, QMimeType &candidate)
+{
+ const int magicListOffset = m_cacheFile->getUint32(PosMagicListOffset);
+ const int numMatches = m_cacheFile->getUint32(magicListOffset);
+ //const int maxExtent = cacheFile->getUint32(magicListOffset + 4);
+ const int firstMatchOffset = m_cacheFile->getUint32(magicListOffset + 8);
+
+ for (int i = 0; i < numMatches; ++i) {
+ const int off = firstMatchOffset + i * 16;
+ const int numMatchlets = m_cacheFile->getUint32(off + 8);
+ const int firstMatchletOffset = m_cacheFile->getUint32(off + 12);
+ if (matchMagicRule(m_cacheFile, numMatchlets, firstMatchletOffset, data)) {
+ const int mimeTypeOffset = m_cacheFile->getUint32(off + 4);
+ const char *mimeType = m_cacheFile->getCharStar(mimeTypeOffset);
+ *accuracyPtr = m_cacheFile->getUint32(off);
+ // Return the first match. We have no rules for conflicting magic data...
+ // (mime.cache itself is sorted, but what about local overrides with a lower prio?)
+ candidate = mimeTypeForNameUnchecked(QLatin1String(mimeType));
+ return;
}
}
- return QMimeType();
}
-QStringList QMimeBinaryProvider::parents(const QString &mime)
+void QMimeBinaryProvider::addParents(const QString &mime, QStringList &result)
{
- checkCache();
const QByteArray mimeStr = mime.toLatin1();
- QStringList result;
- for (CacheFile *cacheFile : qAsConst(m_cacheFiles)) {
- const int parentListOffset = cacheFile->getUint32(PosParentListOffset);
- const int numEntries = cacheFile->getUint32(parentListOffset);
-
- int begin = 0;
- int end = numEntries - 1;
- while (begin <= end) {
- const int medium = (begin + end) / 2;
- const int off = parentListOffset + 4 + 8 * medium;
- const int mimeOffset = cacheFile->getUint32(off);
- const char *aMime = cacheFile->getCharStar(mimeOffset);
- const int cmp = qstrcmp(aMime, mimeStr);
- if (cmp < 0) {
- begin = medium + 1;
- } else if (cmp > 0) {
- end = medium - 1;
- } else {
- const int parentsOffset = cacheFile->getUint32(off + 4);
- const int numParents = cacheFile->getUint32(parentsOffset);
- for (int i = 0; i < numParents; ++i) {
- const int parentOffset = cacheFile->getUint32(parentsOffset + 4 + 4 * i);
- const char *aParent = cacheFile->getCharStar(parentOffset);
- result.append(QString::fromLatin1(aParent));
- }
- break;
+ const int parentListOffset = m_cacheFile->getUint32(PosParentListOffset);
+ const int numEntries = m_cacheFile->getUint32(parentListOffset);
+
+ int begin = 0;
+ int end = numEntries - 1;
+ while (begin <= end) {
+ const int medium = (begin + end) / 2;
+ const int off = parentListOffset + 4 + 8 * medium;
+ const int mimeOffset = m_cacheFile->getUint32(off);
+ const char *aMime = m_cacheFile->getCharStar(mimeOffset);
+ const int cmp = qstrcmp(aMime, mimeStr);
+ if (cmp < 0) {
+ begin = medium + 1;
+ } else if (cmp > 0) {
+ end = medium - 1;
+ } else {
+ const int parentsOffset = m_cacheFile->getUint32(off + 4);
+ const int numParents = m_cacheFile->getUint32(parentsOffset);
+ for (int i = 0; i < numParents; ++i) {
+ const int parentOffset = m_cacheFile->getUint32(parentsOffset + 4 + 4 * i);
+ const char *aParent = m_cacheFile->getCharStar(parentOffset);
+ const QString strParent = QString::fromLatin1(aParent);
+ if (!result.contains(strParent))
+ result.append(strParent);
}
+ break;
}
}
- if (result.isEmpty()) {
- const QString parent = fallbackParent(mime);
- if (!parent.isEmpty())
- result.append(parent);
- }
- return result;
}
QString QMimeBinaryProvider::resolveAlias(const QString &name)
{
- checkCache();
const QByteArray input = name.toLatin1();
- for (CacheFile *cacheFile : qAsConst(m_cacheFiles)) {
- const int aliasListOffset = cacheFile->getUint32(PosAliasListOffset);
- const int numEntries = cacheFile->getUint32(aliasListOffset);
- int begin = 0;
- int end = numEntries - 1;
- while (begin <= end) {
- const int medium = (begin + end) / 2;
- const int off = aliasListOffset + 4 + 8 * medium;
- const int aliasOffset = cacheFile->getUint32(off);
- const char *alias = cacheFile->getCharStar(aliasOffset);
- const int cmp = qstrcmp(alias, input);
- if (cmp < 0) {
- begin = medium + 1;
- } else if (cmp > 0) {
- end = medium - 1;
- } else {
- const int mimeOffset = cacheFile->getUint32(off + 4);
- const char *mimeType = cacheFile->getCharStar(mimeOffset);
- return QLatin1String(mimeType);
- }
+ const int aliasListOffset = m_cacheFile->getUint32(PosAliasListOffset);
+ const int numEntries = m_cacheFile->getUint32(aliasListOffset);
+ int begin = 0;
+ int end = numEntries - 1;
+ while (begin <= end) {
+ const int medium = (begin + end) / 2;
+ const int off = aliasListOffset + 4 + 8 * medium;
+ const int aliasOffset = m_cacheFile->getUint32(off);
+ const char *alias = m_cacheFile->getCharStar(aliasOffset);
+ const int cmp = qstrcmp(alias, input);
+ if (cmp < 0) {
+ begin = medium + 1;
+ } else if (cmp > 0) {
+ end = medium - 1;
+ } else {
+ const int mimeOffset = m_cacheFile->getUint32(off + 4);
+ const char *mimeType = m_cacheFile->getCharStar(mimeOffset);
+ return QLatin1String(mimeType);
}
}
-
return name;
}
-QStringList QMimeBinaryProvider::listAliases(const QString &name)
+void QMimeBinaryProvider::addAliases(const QString &name, QStringList &result)
{
- checkCache();
- QStringList result;
const QByteArray input = name.toLatin1();
- for (CacheFile *cacheFile : qAsConst(m_cacheFiles)) {
- const int aliasListOffset = cacheFile->getUint32(PosAliasListOffset);
- const int numEntries = cacheFile->getUint32(aliasListOffset);
- for (int pos = 0; pos < numEntries; ++pos) {
- const int off = aliasListOffset + 4 + 8 * pos;
- const int mimeOffset = cacheFile->getUint32(off + 4);
- const char *mimeType = cacheFile->getCharStar(mimeOffset);
-
- if (input == mimeType) {
- const int aliasOffset = cacheFile->getUint32(off);
- const char *alias = cacheFile->getCharStar(aliasOffset);
- result.append(QString::fromLatin1(alias));
- }
+ const int aliasListOffset = m_cacheFile->getUint32(PosAliasListOffset);
+ const int numEntries = m_cacheFile->getUint32(aliasListOffset);
+ for (int pos = 0; pos < numEntries; ++pos) {
+ const int off = aliasListOffset + 4 + 8 * pos;
+ const int mimeOffset = m_cacheFile->getUint32(off + 4);
+ const char *mimeType = m_cacheFile->getCharStar(mimeOffset);
+
+ if (input == mimeType) {
+ const int aliasOffset = m_cacheFile->getUint32(off);
+ const char *alias = m_cacheFile->getCharStar(aliasOffset);
+ const QString strAlias = QString::fromLatin1(alias);
+ if (!result.contains(strAlias))
+ result.append(strAlias);
}
}
- return result;
}
void QMimeBinaryProvider::loadMimeTypeList()
@@ -533,31 +431,30 @@ void QMimeBinaryProvider::loadMimeTypeList()
m_mimetypeNames.clear();
// Unfortunately mime.cache doesn't have a full list of all mimetypes.
// So we have to parse the plain-text files called "types".
- const QStringList typesFilenames = QStandardPaths::locateAll(QStandardPaths::GenericDataLocation, QLatin1String("mime/types"));
- for (const QString &typeFilename : typesFilenames) {
- QFile file(typeFilename);
- if (file.open(QIODevice::ReadOnly)) {
- QTextStream stream(&file);
- stream.setCodec("ISO 8859-1");
- QString line;
- while (stream.readLineInto(&line))
- m_mimetypeNames.insert(line);
- }
+ QFile file(m_directory + QStringLiteral("/types"));
+ if (file.open(QIODevice::ReadOnly)) {
+ QTextStream stream(&file);
+ stream.setCodec("ISO 8859-1");
+ QString line;
+ while (stream.readLineInto(&line))
+ m_mimetypeNames.insert(line);
}
}
}
-QList<QMimeType> QMimeBinaryProvider::allMimeTypes()
+void QMimeBinaryProvider::addAllMimeTypes(QList<QMimeType> &result)
{
- QList<QMimeType> result;
loadMimeTypeList();
- result.reserve(m_mimetypeNames.count());
-
- for (QSet<QString>::const_iterator it = m_mimetypeNames.constBegin();
- it != m_mimetypeNames.constEnd(); ++it)
- result.append(mimeTypeForNameUnchecked(*it));
-
- return result;
+ if (result.isEmpty()) {
+ result.reserve(m_mimetypeNames.count());
+ for (const QString &name : m_mimetypeNames)
+ result.append(mimeTypeForNameUnchecked(name));
+ } else {
+ for (const QString &name : m_mimetypeNames)
+ if (std::find_if(result.constBegin(), result.constEnd(), [name](const QMimeType &mime) -> bool { return mime.name() == name; })
+ == result.constEnd())
+ result.append(mimeTypeForNameUnchecked(name));
+ }
}
void QMimeBinaryProvider::loadMimeTypePrivate(QMimeTypePrivate &data)
@@ -681,36 +578,29 @@ QLatin1String QMimeBinaryProvider::iconForMime(CacheFile *cacheFile, int posList
void QMimeBinaryProvider::loadIcon(QMimeTypePrivate &data)
{
- checkCache();
const QByteArray inputMime = data.name.toLatin1();
- for (CacheFile *cacheFile : qAsConst(m_cacheFiles)) {
- const QLatin1String icon = iconForMime(cacheFile, PosIconsListOffset, inputMime);
- if (!icon.isEmpty()) {
- data.iconName = icon;
- return;
- }
+ const QLatin1String icon = iconForMime(m_cacheFile, PosIconsListOffset, inputMime);
+ if (!icon.isEmpty()) {
+ data.iconName = icon;
}
}
void QMimeBinaryProvider::loadGenericIcon(QMimeTypePrivate &data)
{
- checkCache();
const QByteArray inputMime = data.name.toLatin1();
- for (CacheFile *cacheFile : qAsConst(m_cacheFiles)) {
- const QLatin1String icon = iconForMime(cacheFile, PosGenericIconsListOffset, inputMime);
- if (!icon.isEmpty()) {
- data.genericIconName = icon;
- return;
- }
+ const QLatin1String icon = iconForMime(m_cacheFile, PosGenericIconsListOffset, inputMime);
+ if (!icon.isEmpty()) {
+ data.genericIconName = icon;
}
}
////
-QMimeXMLProvider::QMimeXMLProvider(QMimeDatabasePrivate *db)
- : QMimeProviderBase(db), m_loaded(false)
+QMimeXMLProvider::QMimeXMLProvider(QMimeDatabasePrivate *db, const QString &directory)
+ : QMimeProviderBase(db, directory)
{
initResources();
+ ensureLoaded();
}
QMimeXMLProvider::~QMimeXMLProvider()
@@ -719,81 +609,63 @@ QMimeXMLProvider::~QMimeXMLProvider()
bool QMimeXMLProvider::isValid()
{
+ // If you change this method, adjust the logic in QMimeDatabasePrivate::loadProviders,
+ // which assumes isValid==false is only possible in QMimeBinaryProvider.
return true;
}
QMimeType QMimeXMLProvider::mimeTypeForName(const QString &name)
{
- ensureLoaded();
-
return m_nameMimeTypeMap.value(name);
}
-QMimeGlobMatchResult QMimeXMLProvider::findByFileName(const QString &fileName)
+void QMimeXMLProvider::addFileNameMatches(const QString &fileName, QMimeGlobMatchResult &result)
{
- ensureLoaded();
-
- return m_mimeTypeGlobs.matchingGlobs(fileName);
+ m_mimeTypeGlobs.matchingGlobs(fileName, result);
}
-QMimeType QMimeXMLProvider::findByMagic(const QByteArray &data, int *accuracyPtr)
+void QMimeXMLProvider::findByMagic(const QByteArray &data, int *accuracyPtr, QMimeType &candidate)
{
- ensureLoaded();
-
- QString candidate;
-
+ QString candidateName;
+ bool foundOne = false;
for (const QMimeMagicRuleMatcher &matcher : qAsConst(m_magicMatchers)) {
if (matcher.matches(data)) {
const int priority = matcher.priority();
if (priority > *accuracyPtr) {
*accuracyPtr = priority;
- candidate = matcher.mimetype();
+ candidateName = matcher.mimetype();
+ foundOne = true;
}
}
}
- return mimeTypeForName(candidate);
+ if (foundOne)
+ candidate = mimeTypeForName(candidateName);
}
void QMimeXMLProvider::ensureLoaded()
{
- if (!m_loaded || shouldCheck()) {
- bool fdoXmlFound = false;
- QStringList allFiles;
-
- const QStringList packageDirs = QStandardPaths::locateAll(QStandardPaths::GenericDataLocation, QLatin1String("mime/packages"), QStandardPaths::LocateDirectory);
- //qDebug() << "packageDirs=" << packageDirs;
- for (const QString &packageDir : packageDirs) {
- QDir dir(packageDir);
- const QStringList files = dir.entryList(QDir::Files | QDir::NoDotAndDotDot);
- //qDebug() << static_cast<const void *>(this) << packageDir << files;
- if (!fdoXmlFound)
- fdoXmlFound = files.contains(QLatin1String("freedesktop.org.xml"));
- QStringList::const_iterator endIt(files.constEnd());
- for (QStringList::const_iterator it(files.constBegin()); it != endIt; ++it) {
- allFiles.append(packageDir + QLatin1Char('/') + *it);
- }
- }
-
- if (!fdoXmlFound) {
- // We could instead install the file as part of installing Qt?
- allFiles.prepend(QLatin1String(":/qt-project.org/qmime/freedesktop.org.xml"));
- }
+ QStringList allFiles;
+ const QString packageDir = m_directory + QStringLiteral("/packages");
+ QDir dir(packageDir);
+ const QStringList files = dir.entryList(QDir::Files | QDir::NoDotAndDotDot);
+ allFiles.reserve(files.count());
+ for (const QString &xmlFile : files)
+ allFiles.append(packageDir + QLatin1Char('/') + xmlFile);
- if (m_allFiles == allFiles)
- return;
- m_allFiles = allFiles;
+ if (m_allFiles == allFiles)
+ return;
+ m_allFiles = allFiles;
- m_nameMimeTypeMap.clear();
- m_aliases.clear();
- m_parents.clear();
- m_mimeTypeGlobs.clear();
- m_magicMatchers.clear();
+ m_nameMimeTypeMap.clear();
+ m_aliases.clear();
+ m_parents.clear();
+ m_mimeTypeGlobs.clear();
+ m_magicMatchers.clear();
- //qDebug() << "Loading" << m_allFiles;
+ //qDebug() << "Loading" << m_allFiles;
- for (const QString &file : qAsConst(allFiles))
- load(file);
- }
+ for (const QString &file : qAsConst(allFiles))
+ load(file);
}
void QMimeXMLProvider::load(const QString &fileName)
@@ -805,8 +677,6 @@ void QMimeXMLProvider::load(const QString &fileName)
bool QMimeXMLProvider::load(const QString &fileName, QString *errorMessage)
{
- m_loaded = true;
-
QFile file(fileName);
if (!file.open(QIODevice::ReadOnly | QIODevice::Text)) {
if (errorMessage)
@@ -828,19 +698,16 @@ void QMimeXMLProvider::addGlobPattern(const QMimeGlobPattern &glob)
void QMimeXMLProvider::addMimeType(const QMimeType &mt)
{
+ Q_ASSERT(!mt.d.data()->fromCache);
m_nameMimeTypeMap.insert(mt.name(), mt);
}
-QStringList QMimeXMLProvider::parents(const QString &mime)
+void QMimeXMLProvider::addParents(const QString &mime, QStringList &result)
{
- ensureLoaded();
- QStringList result = m_parents.value(mime);
- if (result.isEmpty()) {
- const QString parent = fallbackParent(mime);
- if (!parent.isEmpty())
+ for (const QString &parent : m_parents.value(mime)) {
+ if (!result.contains(parent))
result.append(parent);
}
- return result;
}
void QMimeXMLProvider::addParent(const QString &child, const QString &parent)
@@ -848,16 +715,20 @@ void QMimeXMLProvider::addParent(const QString &child, const QString &parent)
m_parents[child].append(parent);
}
-QStringList QMimeXMLProvider::listAliases(const QString &name)
+void QMimeXMLProvider::addAliases(const QString &name, QStringList &result)
{
- ensureLoaded();
// Iterate through the whole hash. This method is rarely used.
- return m_aliases.keys(name);
+ for (auto it = m_aliases.constBegin(), end = m_aliases.constEnd() ; it != end ; ++it) {
+ if (it.value() == name) {
+ if (!result.contains(it.key()))
+ result.append(it.key());
+ }
+ }
+
}
QString QMimeXMLProvider::resolveAlias(const QString &name)
{
- ensureLoaded();
return m_aliases.value(name, name);
}
@@ -866,10 +737,18 @@ void QMimeXMLProvider::addAlias(const QString &alias, const QString &name)
m_aliases.insert(alias, name);
}
-QList<QMimeType> QMimeXMLProvider::allMimeTypes()
+void QMimeXMLProvider::addAllMimeTypes(QList<QMimeType> &result)
{
- ensureLoaded();
- return m_nameMimeTypeMap.values();
+ if (result.isEmpty()) { // fast path
+ result = m_nameMimeTypeMap.values();
+ } else {
+ for (auto it = m_nameMimeTypeMap.constBegin(), end = m_nameMimeTypeMap.constEnd() ; it != end ; ++it) {
+ const QString newMime = it.key();
+ if (std::find_if(result.constBegin(), result.constEnd(), [newMime](const QMimeType &mime) -> bool { return mime.name() == newMime; })
+ == result.constEnd())
+ result.append(it.value());
+ }
+ }
}
void QMimeXMLProvider::addMagicMatcher(const QMimeMagicRuleMatcher &matcher)
diff --git a/src/corelib/mimetypes/qmimeprovider_p.h b/src/corelib/mimetypes/qmimeprovider_p.h
index 0be01d2fd0..b2be545cf8 100644
--- a/src/corelib/mimetypes/qmimeprovider_p.h
+++ b/src/corelib/mimetypes/qmimeprovider_p.h
@@ -59,7 +59,6 @@
#include "qmimeglobpattern_p.h"
#include <QtCore/qdatetime.h>
#include <QtCore/qset.h>
-#include <QtCore/qelapsedtimer.h>
QT_BEGIN_NAMESPACE
@@ -68,25 +67,25 @@ class QMimeMagicRuleMatcher;
class QMimeProviderBase
{
public:
- QMimeProviderBase(QMimeDatabasePrivate *db);
+ QMimeProviderBase(QMimeDatabasePrivate *db, const QString &directory);
virtual ~QMimeProviderBase() {}
virtual bool isValid() = 0;
virtual QMimeType mimeTypeForName(const QString &name) = 0;
- virtual QMimeGlobMatchResult findByFileName(const QString &fileName) = 0;
- virtual QStringList parents(const QString &mime) = 0;
+ virtual void addFileNameMatches(const QString &fileName, QMimeGlobMatchResult &result) = 0;
+ virtual void addParents(const QString &mime, QStringList &result) = 0;
virtual QString resolveAlias(const QString &name) = 0;
- virtual QStringList listAliases(const QString &name) = 0;
- virtual QMimeType findByMagic(const QByteArray &data, int *accuracyPtr) = 0;
- virtual QList<QMimeType> allMimeTypes() = 0;
- virtual void loadMimeTypePrivate(QMimeTypePrivate &) {}
+ virtual void addAliases(const QString &name, QStringList &result) = 0;
+ virtual void findByMagic(const QByteArray &data, int *accuracyPtr, QMimeType &candidate) = 0;
+ virtual void addAllMimeTypes(QList<QMimeType> &result) = 0;
virtual void loadIcon(QMimeTypePrivate &) {}
virtual void loadGenericIcon(QMimeTypePrivate &) {}
+ virtual void ensureLoaded() {}
+
+ QString directory() const { return m_directory; }
QMimeDatabasePrivate *m_db;
-protected:
- bool shouldCheck();
- QElapsedTimer m_lastCheck;
+ QString m_directory;
};
/*
@@ -95,20 +94,21 @@ protected:
class QMimeBinaryProvider : public QMimeProviderBase
{
public:
- QMimeBinaryProvider(QMimeDatabasePrivate *db);
+ QMimeBinaryProvider(QMimeDatabasePrivate *db, const QString &directory);
virtual ~QMimeBinaryProvider();
- virtual bool isValid() Q_DECL_OVERRIDE;
- virtual QMimeType mimeTypeForName(const QString &name) Q_DECL_OVERRIDE;
- virtual QMimeGlobMatchResult findByFileName(const QString &fileName) Q_DECL_OVERRIDE;
- virtual QStringList parents(const QString &mime) Q_DECL_OVERRIDE;
- virtual QString resolveAlias(const QString &name) Q_DECL_OVERRIDE;
- virtual QStringList listAliases(const QString &name) Q_DECL_OVERRIDE;
- virtual QMimeType findByMagic(const QByteArray &data, int *accuracyPtr) Q_DECL_OVERRIDE;
- virtual QList<QMimeType> allMimeTypes() Q_DECL_OVERRIDE;
- virtual void loadMimeTypePrivate(QMimeTypePrivate &) Q_DECL_OVERRIDE;
- virtual void loadIcon(QMimeTypePrivate &) Q_DECL_OVERRIDE;
- virtual void loadGenericIcon(QMimeTypePrivate &) Q_DECL_OVERRIDE;
+ virtual bool isValid() override;
+ virtual QMimeType mimeTypeForName(const QString &name) override;
+ void addFileNameMatches(const QString &fileName, QMimeGlobMatchResult &result) override;
+ void addParents(const QString &mime, QStringList &result) override;
+ virtual QString resolveAlias(const QString &name) override;
+ void addAliases(const QString &name, QStringList &result) override;
+ void findByMagic(const QByteArray &data, int *accuracyPtr, QMimeType &candidate) override;
+ void addAllMimeTypes(QList<QMimeType> &result) override;
+ static void loadMimeTypePrivate(QMimeTypePrivate &);
+ virtual void loadIcon(QMimeTypePrivate &) override;
+ virtual void loadGenericIcon(QMimeTypePrivate &) override;
+ void ensureLoaded() override;
private:
struct CacheFile;
@@ -118,15 +118,9 @@ private:
bool matchMagicRule(CacheFile *cacheFile, int numMatchlets, int firstOffset, const QByteArray &data);
QLatin1String iconForMime(CacheFile *cacheFile, int posListOffset, const QByteArray &inputMime);
void loadMimeTypeList();
- void checkCache();
-
- class CacheFileList : public QList<CacheFile *>
- {
- public:
- CacheFile *findCacheFile(const QString &fileName) const;
- bool checkCacheChanged();
- };
- CacheFileList m_cacheFiles;
+ bool checkCacheChanged();
+
+ CacheFile *m_cacheFile = nullptr;
QStringList m_cacheFileNames;
QSet<QString> m_mimetypeNames;
bool m_mimetypeListLoaded;
@@ -138,17 +132,18 @@ private:
class QMimeXMLProvider : public QMimeProviderBase
{
public:
- QMimeXMLProvider(QMimeDatabasePrivate *db);
+ QMimeXMLProvider(QMimeDatabasePrivate *db, const QString &directory);
~QMimeXMLProvider();
- virtual bool isValid() Q_DECL_OVERRIDE;
- virtual QMimeType mimeTypeForName(const QString &name) Q_DECL_OVERRIDE;
- virtual QMimeGlobMatchResult findByFileName(const QString &fileName) Q_DECL_OVERRIDE;
- virtual QStringList parents(const QString &mime) Q_DECL_OVERRIDE;
- virtual QString resolveAlias(const QString &name) Q_DECL_OVERRIDE;
- virtual QStringList listAliases(const QString &name) Q_DECL_OVERRIDE;
- virtual QMimeType findByMagic(const QByteArray &data, int *accuracyPtr) Q_DECL_OVERRIDE;
- virtual QList<QMimeType> allMimeTypes() Q_DECL_OVERRIDE;
+ virtual bool isValid() override;
+ virtual QMimeType mimeTypeForName(const QString &name) override;
+ void addFileNameMatches(const QString &fileName, QMimeGlobMatchResult &result) override;
+ void addParents(const QString &mime, QStringList &result) override;
+ virtual QString resolveAlias(const QString &name) override;
+ void addAliases(const QString &name, QStringList &result) override;
+ void findByMagic(const QByteArray &data, int *accuracyPtr, QMimeType &candidate) override;
+ void addAllMimeTypes(QList<QMimeType> &result) override;
+ void ensureLoaded() override;
bool load(const QString &fileName, QString *errorMessage);
@@ -160,11 +155,8 @@ public:
void addMagicMatcher(const QMimeMagicRuleMatcher &matcher);
private:
- void ensureLoaded();
void load(const QString &fileName);
- bool m_loaded;
-
typedef QHash<QString, QMimeType> NameMimeTypeMap;
NameMimeTypeMap m_nameMimeTypeMap;
diff --git a/src/corelib/mimetypes/qmimetype.cpp b/src/corelib/mimetypes/qmimetype.cpp
index 28113babfe..8f6237c1cb 100644
--- a/src/corelib/mimetypes/qmimetype.cpp
+++ b/src/corelib/mimetypes/qmimetype.cpp
@@ -57,7 +57,7 @@
QT_BEGIN_NAMESPACE
QMimeTypePrivate::QMimeTypePrivate()
- : loaded(false)
+ : loaded(false), fromCache(false)
{}
QMimeTypePrivate::QMimeTypePrivate(const QMimeType &other)
@@ -76,7 +76,6 @@ void QMimeTypePrivate::clear()
genericIconName.clear();
iconName.clear();
globPatterns.clear();
- loaded = false;
}
void QMimeTypePrivate::addGlobPattern(const QString &pattern)
@@ -256,7 +255,7 @@ QString QMimeType::name() const
*/
QString QMimeType::comment() const
{
- QMimeDatabasePrivate::instance()->provider()->loadMimeTypePrivate(*d);
+ QMimeDatabasePrivate::instance()->loadMimeTypePrivate(*d);
QStringList languageList;
languageList << QLocale().name();
@@ -296,7 +295,7 @@ QString QMimeType::comment() const
*/
QString QMimeType::genericIconName() const
{
- QMimeDatabasePrivate::instance()->provider()->loadGenericIcon(*d);
+ QMimeDatabasePrivate::instance()->loadGenericIcon(*d);
if (d->genericIconName.isEmpty()) {
// From the spec:
// If the generic icon name is empty (not specified by the mimetype definition)
@@ -324,7 +323,7 @@ QString QMimeType::genericIconName() const
*/
QString QMimeType::iconName() const
{
- QMimeDatabasePrivate::instance()->provider()->loadIcon(*d);
+ QMimeDatabasePrivate::instance()->loadIcon(*d);
if (d->iconName.isEmpty()) {
// Make default icon name from the mimetype name
d->iconName = name();
@@ -344,7 +343,7 @@ QString QMimeType::iconName() const
*/
QStringList QMimeType::globPatterns() const
{
- QMimeDatabasePrivate::instance()->provider()->loadMimeTypePrivate(*d);
+ QMimeDatabasePrivate::instance()->loadMimeTypePrivate(*d);
return d->globPatterns;
}
@@ -368,12 +367,12 @@ QStringList QMimeType::globPatterns() const
*/
QStringList QMimeType::parentMimeTypes() const
{
- return QMimeDatabasePrivate::instance()->provider()->parents(d->name);
+ return QMimeDatabasePrivate::instance()->mimeParents(d->name);
}
static void collectParentMimeTypes(const QString &mime, QStringList &allParents)
{
- const QStringList parents = QMimeDatabasePrivate::instance()->provider()->parents(mime);
+ const QStringList parents = QMimeDatabasePrivate::instance()->mimeParents(mime);
for (const QString &parent : parents) {
// I would use QSet, but since order matters I better not
if (!allParents.contains(parent))
@@ -425,7 +424,7 @@ QStringList QMimeType::allAncestors() const
*/
QStringList QMimeType::aliases() const
{
- return QMimeDatabasePrivate::instance()->provider()->listAliases(d->name);
+ return QMimeDatabasePrivate::instance()->listAliases(d->name);
}
/*!
@@ -439,7 +438,7 @@ QStringList QMimeType::aliases() const
*/
QStringList QMimeType::suffixes() const
{
- QMimeDatabasePrivate::instance()->provider()->loadMimeTypePrivate(*d);
+ QMimeDatabasePrivate::instance()->loadMimeTypePrivate(*d);
QStringList result;
for (const QString &pattern : qAsConst(d->globPatterns)) {
@@ -480,7 +479,7 @@ QString QMimeType::preferredSuffix() const
*/
QString QMimeType::filterString() const
{
- QMimeDatabasePrivate::instance()->provider()->loadMimeTypePrivate(*d);
+ QMimeDatabasePrivate::instance()->loadMimeTypePrivate(*d);
QString filter;
if (!d->globPatterns.empty()) {
@@ -508,7 +507,7 @@ bool QMimeType::inherits(const QString &mimeTypeName) const
{
if (d->name == mimeTypeName)
return true;
- return QMimeDatabasePrivate::instance()->inherits(d->name, mimeTypeName);
+ return QMimeDatabasePrivate::instance()->mimeInherits(d->name, mimeTypeName);
}
#ifndef QT_NO_DEBUG_STREAM
diff --git a/src/corelib/mimetypes/qmimetype_p.h b/src/corelib/mimetypes/qmimetype_p.h
index b0bfad2f65..aa38a1adf5 100644
--- a/src/corelib/mimetypes/qmimetype_p.h
+++ b/src/corelib/mimetypes/qmimetype_p.h
@@ -74,6 +74,7 @@ public:
void addGlobPattern(const QString &pattern);
bool loaded; // QSharedData leaves a 4 byte gap, so don't put 8 byte members first
+ bool fromCache; // true if this comes from the binary provider
QString name;
LocaleHash localeComments;
QString genericIconName;
@@ -94,6 +95,7 @@ QT_END_NAMESPACE
{ \
QMimeTypePrivate qMimeTypeData; \
qMimeTypeData.name = name; \
+ qMimeTypeData.loaded = true; \
qMimeTypeData.genericIconName = genericIconName; \
qMimeTypeData.iconName = iconName; \
qMimeTypeData.globPatterns = globPatterns; \
@@ -112,6 +114,7 @@ QT_END_NAMESPACE
) \
{ \
QMimeTypePrivate qMimeTypeData; \
+ qMimeTypeData.loaded = true; \
qMimeTypeData.name = std::move(name); \
qMimeTypeData.genericIconName = std::move(genericIconName); \
qMimeTypeData.iconName = std::move(iconName); \
diff --git a/src/corelib/mimetypes/qmimetypeparser.cpp b/src/corelib/mimetypes/qmimetypeparser.cpp
index 5ecd339908..0a55560ab0 100644
--- a/src/corelib/mimetypes/qmimetypeparser.cpp
+++ b/src/corelib/mimetypes/qmimetypeparser.cpp
@@ -201,6 +201,7 @@ bool QMimeTypeParserBase::parse(QIODevice *dev, const QString &fileName, QString
return false;
#else
QMimeTypePrivate data;
+ data.loaded = true;
int priority = 50;
QStack<QMimeMagicRule *> currentRules; // stack for the nesting of rules
QList<QMimeMagicRule> rules; // toplevel rules
diff --git a/src/corelib/plugin/qlibrary.h b/src/corelib/plugin/qlibrary.h
index 89be52aac3..0b37b8b134 100644
--- a/src/corelib/plugin/qlibrary.h
+++ b/src/corelib/plugin/qlibrary.h
@@ -65,10 +65,10 @@ public:
Q_FLAG(LoadHint)
Q_FLAG(LoadHints)
- explicit QLibrary(QObject *parent = Q_NULLPTR);
- explicit QLibrary(const QString& fileName, QObject *parent = Q_NULLPTR);
- explicit QLibrary(const QString& fileName, int verNum, QObject *parent = Q_NULLPTR);
- explicit QLibrary(const QString& fileName, const QString &version, QObject *parent = Q_NULLPTR);
+ explicit QLibrary(QObject *parent = nullptr);
+ explicit QLibrary(const QString& fileName, QObject *parent = nullptr);
+ explicit QLibrary(const QString& fileName, int verNum, QObject *parent = nullptr);
+ explicit QLibrary(const QString& fileName, const QString &version, QObject *parent = nullptr);
~QLibrary();
QFunctionPointer resolve(const char *symbol);
diff --git a/src/corelib/plugin/qpluginloader.h b/src/corelib/plugin/qpluginloader.h
index 80b10f76bf..5e417249a4 100644
--- a/src/corelib/plugin/qpluginloader.h
+++ b/src/corelib/plugin/qpluginloader.h
@@ -59,8 +59,8 @@ class Q_CORE_EXPORT QPluginLoader : public QObject
Q_PROPERTY(QString fileName READ fileName WRITE setFileName)
Q_PROPERTY(QLibrary::LoadHints loadHints READ loadHints WRITE setLoadHints)
public:
- explicit QPluginLoader(QObject *parent = Q_NULLPTR);
- explicit QPluginLoader(const QString &fileName, QObject *parent = Q_NULLPTR);
+ explicit QPluginLoader(QObject *parent = nullptr);
+ explicit QPluginLoader(const QString &fileName, QObject *parent = nullptr);
~QPluginLoader();
QObject *instance();
diff --git a/src/corelib/plugin/quuid.h b/src/corelib/plugin/quuid.h
index 9e1a35f492..ee0a9f9dac 100644
--- a/src/corelib/plugin/quuid.h
+++ b/src/corelib/plugin/quuid.h
@@ -42,7 +42,7 @@
#include <QtCore/qstring.h>
-#if defined(Q_OS_WIN)
+#if defined(Q_OS_WIN) || defined(Q_CLANG_QDOC)
#ifndef GUID_DEFINED
#define GUID_DEFINED
typedef struct _GUID
@@ -55,7 +55,7 @@ typedef struct _GUID
#endif
#endif
-#if defined(Q_OS_DARWIN) || defined(Q_QDOC)
+#if defined(Q_OS_DARWIN) || defined(Q_CLANG_QDOC)
Q_FORWARD_DECLARE_CF_TYPE(CFUUID);
Q_FORWARD_DECLARE_OBJC_CLASS(NSUUID);
#endif
@@ -85,7 +85,7 @@ public:
Sha1 = 5 // 0 1 0 1
};
-#if defined(Q_COMPILER_UNIFORM_INIT) && !defined(Q_QDOC)
+#if defined(Q_COMPILER_UNIFORM_INIT) && !defined(Q_CLANG_QDOC)
Q_DECL_CONSTEXPR QUuid() Q_DECL_NOTHROW : data1(0), data2(0), data3(0), data4{0,0,0,0,0,0,0,0} {}
Q_DECL_CONSTEXPR QUuid(uint l, ushort w1, ushort w2, uchar b1, uchar b2, uchar b3,
@@ -148,10 +148,10 @@ public:
bool operator<(const QUuid &other) const Q_DECL_NOTHROW;
bool operator>(const QUuid &other) const Q_DECL_NOTHROW;
-#if defined(Q_OS_WIN)
+#if defined(Q_OS_WIN) || defined(Q_CLANG_QDOC)
// On Windows we have a type GUID that is used by the platform API, so we
// provide convenience operators to cast from and to this type.
-#if defined(Q_COMPILER_UNIFORM_INIT) && !defined(Q_QDOC)
+#if defined(Q_COMPILER_UNIFORM_INIT) && !defined(Q_CLANG_QDOC)
Q_DECL_CONSTEXPR QUuid(const GUID &guid) Q_DECL_NOTHROW
: data1(guid.Data1), data2(guid.Data2), data3(guid.Data3),
data4{guid.Data4[0], guid.Data4[1], guid.Data4[2], guid.Data4[3],
@@ -208,7 +208,7 @@ public:
QUuid::Variant variant() const Q_DECL_NOTHROW;
QUuid::Version version() const Q_DECL_NOTHROW;
-#if defined(Q_OS_DARWIN) || defined(Q_QDOC)
+#if defined(Q_OS_DARWIN) || defined(Q_CLANG_QDOC)
static QUuid fromCFUUID(CFUUIDRef uuid);
CFUUIDRef toCFUUID() const Q_DECL_CF_RETURNS_RETAINED;
static QUuid fromNSUUID(const NSUUID *uuid);
diff --git a/src/corelib/statemachine/qabstractstate.h b/src/corelib/statemachine/qabstractstate.h
index 02c7d9e830..ffc2eaae13 100644
--- a/src/corelib/statemachine/qabstractstate.h
+++ b/src/corelib/statemachine/qabstractstate.h
@@ -68,12 +68,12 @@ Q_SIGNALS:
void activeChanged(bool active);
protected:
- QAbstractState(QState *parent = Q_NULLPTR);
+ QAbstractState(QState *parent = nullptr);
virtual void onEntry(QEvent *event) = 0;
virtual void onExit(QEvent *event) = 0;
- bool event(QEvent *e) Q_DECL_OVERRIDE;
+ bool event(QEvent *e) override;
protected:
QAbstractState(QAbstractStatePrivate &dd, QState *parent);
diff --git a/src/corelib/statemachine/qabstracttransition.cpp b/src/corelib/statemachine/qabstracttransition.cpp
index 53c713d6a8..272e681fb4 100644
--- a/src/corelib/statemachine/qabstracttransition.cpp
+++ b/src/corelib/statemachine/qabstracttransition.cpp
@@ -258,7 +258,7 @@ void QAbstractTransition::setTargetStates(const QList<QAbstractState*> &targets)
// Verify if any of the new target states is a null-pointer:
for (int i = 0; i < targets.size(); ++i) {
- if (targets.at(i) == Q_NULLPTR) {
+ if (targets.at(i) == nullptr) {
qWarning("QAbstractTransition::setTargetStates: target state(s) cannot be null");
return;
}
diff --git a/src/corelib/statemachine/qabstracttransition.h b/src/corelib/statemachine/qabstracttransition.h
index b86d26e969..9b35e0cdb6 100644
--- a/src/corelib/statemachine/qabstracttransition.h
+++ b/src/corelib/statemachine/qabstracttransition.h
@@ -72,7 +72,7 @@ public:
};
Q_ENUM(TransitionType)
- QAbstractTransition(QState *sourceState = Q_NULLPTR);
+ QAbstractTransition(QState *sourceState = nullptr);
virtual ~QAbstractTransition();
QState *sourceState() const;
@@ -102,7 +102,7 @@ protected:
virtual void onTransition(QEvent *event) = 0;
- bool event(QEvent *e) Q_DECL_OVERRIDE;
+ bool event(QEvent *e) override;
protected:
QAbstractTransition(QAbstractTransitionPrivate &dd, QState *parent);
diff --git a/src/corelib/statemachine/qeventtransition.h b/src/corelib/statemachine/qeventtransition.h
index 3c66e72658..ff4a991162 100644
--- a/src/corelib/statemachine/qeventtransition.h
+++ b/src/corelib/statemachine/qeventtransition.h
@@ -54,8 +54,8 @@ class Q_CORE_EXPORT QEventTransition : public QAbstractTransition
Q_PROPERTY(QObject* eventSource READ eventSource WRITE setEventSource)
Q_PROPERTY(QEvent::Type eventType READ eventType WRITE setEventType)
public:
- QEventTransition(QState *sourceState = Q_NULLPTR);
- QEventTransition(QObject *object, QEvent::Type type, QState *sourceState = Q_NULLPTR);
+ QEventTransition(QState *sourceState = nullptr);
+ QEventTransition(QObject *object, QEvent::Type type, QState *sourceState = nullptr);
~QEventTransition();
QObject *eventSource() const;
@@ -65,10 +65,10 @@ public:
void setEventType(QEvent::Type type);
protected:
- bool eventTest(QEvent *event) Q_DECL_OVERRIDE;
- void onTransition(QEvent *event) Q_DECL_OVERRIDE;
+ bool eventTest(QEvent *event) override;
+ void onTransition(QEvent *event) override;
- bool event(QEvent *e) Q_DECL_OVERRIDE;
+ bool event(QEvent *e) override;
protected:
QEventTransition(QEventTransitionPrivate &dd, QState *parent);
diff --git a/src/corelib/statemachine/qfinalstate.h b/src/corelib/statemachine/qfinalstate.h
index 1563bef397..1e52a0411d 100644
--- a/src/corelib/statemachine/qfinalstate.h
+++ b/src/corelib/statemachine/qfinalstate.h
@@ -51,14 +51,14 @@ class Q_CORE_EXPORT QFinalState : public QAbstractState
{
Q_OBJECT
public:
- QFinalState(QState *parent = Q_NULLPTR);
+ QFinalState(QState *parent = nullptr);
~QFinalState();
protected:
- void onEntry(QEvent *event) Q_DECL_OVERRIDE;
- void onExit(QEvent *event) Q_DECL_OVERRIDE;
+ void onEntry(QEvent *event) override;
+ void onExit(QEvent *event) override;
- bool event(QEvent *e) Q_DECL_OVERRIDE;
+ bool event(QEvent *e) override;
protected:
explicit QFinalState(QFinalStatePrivate &dd, QState *parent);
diff --git a/src/corelib/statemachine/qhistorystate.cpp b/src/corelib/statemachine/qhistorystate.cpp
index a179d7c75b..d4fb214a31 100644
--- a/src/corelib/statemachine/qhistorystate.cpp
+++ b/src/corelib/statemachine/qhistorystate.cpp
@@ -203,7 +203,7 @@ void QHistoryState::setDefaultTransition(QAbstractTransition *transition)
QAbstractState *QHistoryState::defaultState() const
{
Q_D(const QHistoryState);
- return d->defaultTransition ? d->defaultTransition->targetState() : Q_NULLPTR;
+ return d->defaultTransition ? d->defaultTransition->targetState() : nullptr;
}
static inline bool isSoleEntry(const QList<QAbstractState*> &states, const QAbstractState * state)
diff --git a/src/corelib/statemachine/qhistorystate.h b/src/corelib/statemachine/qhistorystate.h
index c20053abf6..44f4c5d6d4 100644
--- a/src/corelib/statemachine/qhistorystate.h
+++ b/src/corelib/statemachine/qhistorystate.h
@@ -61,8 +61,8 @@ public:
};
Q_ENUM(HistoryType)
- QHistoryState(QState *parent = Q_NULLPTR);
- QHistoryState(HistoryType type, QState *parent = Q_NULLPTR);
+ QHistoryState(QState *parent = nullptr);
+ QHistoryState(HistoryType type, QState *parent = nullptr);
~QHistoryState();
QAbstractTransition *defaultTransition() const;
@@ -80,10 +80,10 @@ Q_SIGNALS:
void historyTypeChanged(QPrivateSignal);
protected:
- void onEntry(QEvent *event) Q_DECL_OVERRIDE;
- void onExit(QEvent *event) Q_DECL_OVERRIDE;
+ void onEntry(QEvent *event) override;
+ void onExit(QEvent *event) override;
- bool event(QEvent *e) Q_DECL_OVERRIDE;
+ bool event(QEvent *e) override;
private:
Q_DISABLE_COPY(QHistoryState)
diff --git a/src/corelib/statemachine/qsignaltransition.h b/src/corelib/statemachine/qsignaltransition.h
index 97c2916d9a..e785a18c73 100644
--- a/src/corelib/statemachine/qsignaltransition.h
+++ b/src/corelib/statemachine/qsignaltransition.h
@@ -55,17 +55,17 @@ class Q_CORE_EXPORT QSignalTransition : public QAbstractTransition
Q_PROPERTY(QByteArray signal READ signal WRITE setSignal NOTIFY signalChanged)
public:
- QSignalTransition(QState *sourceState = Q_NULLPTR);
+ QSignalTransition(QState *sourceState = nullptr);
QSignalTransition(const QObject *sender, const char *signal,
- QState *sourceState = Q_NULLPTR);
+ QState *sourceState = nullptr);
#ifdef Q_QDOC
template<typename PointerToMemberFunction>
QSignalTransition(const QObject *object, PointerToMemberFunction signal,
- QState *sourceState = Q_NULLPTR);
+ QState *sourceState = nullptr);
#elif defined(Q_COMPILER_DELEGATING_CONSTRUCTORS)
template <typename Func>
QSignalTransition(const typename QtPrivate::FunctionPointer<Func>::Object *obj,
- Func sig, QState *srcState = Q_NULLPTR)
+ Func sig, QState *srcState = nullptr)
: QSignalTransition(obj, QMetaMethod::fromSignal(sig).methodSignature().constData(), srcState)
{
}
@@ -80,10 +80,10 @@ public:
void setSignal(const QByteArray &signal);
protected:
- bool eventTest(QEvent *event) Q_DECL_OVERRIDE;
- void onTransition(QEvent *event) Q_DECL_OVERRIDE;
+ bool eventTest(QEvent *event) override;
+ void onTransition(QEvent *event) override;
- bool event(QEvent *e) Q_DECL_OVERRIDE;
+ bool event(QEvent *e) override;
Q_SIGNALS:
void senderObjectChanged(QPrivateSignal);
diff --git a/src/corelib/statemachine/qsignaltransition_p.h b/src/corelib/statemachine/qsignaltransition_p.h
index f270a5be4a..0666e600a4 100644
--- a/src/corelib/statemachine/qsignaltransition_p.h
+++ b/src/corelib/statemachine/qsignaltransition_p.h
@@ -70,7 +70,7 @@ public:
void unregister();
void maybeRegister();
- virtual void callOnTransition(QEvent *e) Q_DECL_OVERRIDE;
+ virtual void callOnTransition(QEvent *e) override;
const QObject *sender;
QByteArray signal;
diff --git a/src/corelib/statemachine/qstate.cpp b/src/corelib/statemachine/qstate.cpp
index 76dcbf784b..6efa4897d6 100644
--- a/src/corelib/statemachine/qstate.cpp
+++ b/src/corelib/statemachine/qstate.cpp
@@ -396,8 +396,8 @@ public:
: QAbstractTransition()
{ setTargetState(target); }
protected:
- void onTransition(QEvent *) Q_DECL_OVERRIDE {}
- bool eventTest(QEvent *) Q_DECL_OVERRIDE { return true; }
+ void onTransition(QEvent *) override {}
+ bool eventTest(QEvent *) override { return true; }
};
} // namespace
@@ -524,7 +524,7 @@ void QState::setChildMode(ChildMode mode)
if (mode == QState::ParallelStates && d->initialState) {
qWarning("QState::setChildMode: setting the child-mode of state %p to "
"parallel removes the initial state", this);
- d->initialState = Q_NULLPTR;
+ d->initialState = nullptr;
emit initialStateChanged(QState::QPrivateSignal());
}
diff --git a/src/corelib/statemachine/qstate.h b/src/corelib/statemachine/qstate.h
index 33f84c2de0..9f1f07dfcc 100644
--- a/src/corelib/statemachine/qstate.h
+++ b/src/corelib/statemachine/qstate.h
@@ -71,8 +71,8 @@ public:
};
Q_ENUM(RestorePolicy)
- QState(QState *parent = Q_NULLPTR);
- QState(ChildMode childMode, QState *parent = Q_NULLPTR);
+ QState(QState *parent = nullptr);
+ QState(ChildMode childMode, QState *parent = nullptr);
~QState();
QAbstractState *errorState() const;
@@ -116,10 +116,10 @@ Q_SIGNALS:
void errorStateChanged(QPrivateSignal);
protected:
- void onEntry(QEvent *event) Q_DECL_OVERRIDE;
- void onExit(QEvent *event) Q_DECL_OVERRIDE;
+ void onEntry(QEvent *event) override;
+ void onExit(QEvent *event) override;
- bool event(QEvent *e) Q_DECL_OVERRIDE;
+ bool event(QEvent *e) override;
protected:
QState(QStatePrivate &dd, QState *parent);
diff --git a/src/corelib/statemachine/qstatemachine.cpp b/src/corelib/statemachine/qstatemachine.cpp
index c2b5afd241..24734f99ac 100644
--- a/src/corelib/statemachine/qstatemachine.cpp
+++ b/src/corelib/statemachine/qstatemachine.cpp
@@ -560,7 +560,7 @@ QList<QAbstractTransition*> QStateMachinePrivate::selectTransitions(QEvent *even
QList<QAbstractTransition*> enabledTransitions;
const_cast<QStateMachine*>(q)->beginSelectTransitions(event);
for (QAbstractState *state : qAsConst(configuration_sorted)) {
- QVector<QState*> lst = getProperAncestors(state, Q_NULLPTR);
+ QVector<QState*> lst = getProperAncestors(state, nullptr);
if (QState *grp = toStandardState(state))
lst.prepend(grp);
bool found = false;
@@ -767,7 +767,7 @@ QSet<QAbstractState*> QStateMachinePrivate::computeExitSet_Unordered(QAbstractTr
QList<QAbstractState *> effectiveTargetStates = getEffectiveTargetStates(t, cache);
QAbstractState *domain = getTransitionDomain(t, effectiveTargetStates, cache);
- if (domain == Q_NULLPTR && !t->targetStates().isEmpty()) {
+ if (domain == nullptr && !t->targetStates().isEmpty()) {
// So we didn't find the least common ancestor for the source and target states of the
// transition. If there were not target states, that would be fine: then the transition
// will fire any events or signals, but not exit the state.
@@ -909,7 +909,7 @@ QAbstractState *QStateMachinePrivate::getTransitionDomain(QAbstractTransition *t
if (effectiveTargetStates.isEmpty())
return 0;
- QAbstractState *domain = Q_NULLPTR;
+ QAbstractState *domain = nullptr;
if (cache->transitionDomain(t, &domain))
return domain;
@@ -1721,8 +1721,8 @@ QAbstractTransition *QStateMachinePrivate::createInitialTransition() const
: QAbstractTransition()
{ setTargetStates(targets); }
protected:
- virtual bool eventTest(QEvent *) Q_DECL_OVERRIDE { return true; }
- virtual void onTransition(QEvent *) Q_DECL_OVERRIDE {}
+ virtual bool eventTest(QEvent *) override { return true; }
+ virtual void onTransition(QEvent *) override {}
};
QState *root = rootState();
@@ -2126,8 +2126,8 @@ public:
: QAbstractTransition()
{ setTargetState(target); }
protected:
- void onTransition(QEvent *) Q_DECL_OVERRIDE { deleteLater(); }
- bool eventTest(QEvent *) Q_DECL_OVERRIDE { return true; }
+ void onTransition(QEvent *) override { deleteLater(); }
+ bool eventTest(QEvent *) override { return true; }
};
} // namespace
diff --git a/src/corelib/statemachine/qstatemachine.h b/src/corelib/statemachine/qstatemachine.h
index 4f31252eed..fd90b86fd5 100644
--- a/src/corelib/statemachine/qstatemachine.h
+++ b/src/corelib/statemachine/qstatemachine.h
@@ -109,8 +109,8 @@ public:
NoCommonAncestorForTransitionError
};
- explicit QStateMachine(QObject *parent = Q_NULLPTR);
- explicit QStateMachine(QState::ChildMode childMode, QObject *parent = Q_NULLPTR);
+ explicit QStateMachine(QObject *parent = nullptr);
+ explicit QStateMachine(QState::ChildMode childMode, QObject *parent = nullptr);
~QStateMachine();
void addState(QAbstractState *state);
@@ -141,7 +141,7 @@ public:
QSet<QAbstractState*> configuration() const;
#if QT_CONFIG(qeventtransition)
- bool eventFilter(QObject *watched, QEvent *event) Q_DECL_OVERRIDE;
+ bool eventFilter(QObject *watched, QEvent *event) override;
#endif
public Q_SLOTS:
@@ -156,8 +156,8 @@ Q_SIGNALS:
protected:
- void onEntry(QEvent *event) Q_DECL_OVERRIDE;
- void onExit(QEvent *event) Q_DECL_OVERRIDE;
+ void onEntry(QEvent *event) override;
+ void onExit(QEvent *event) override;
virtual void beginSelectTransitions(QEvent *event);
virtual void endSelectTransitions(QEvent *event);
@@ -165,7 +165,7 @@ protected:
virtual void beginMicrostep(QEvent *event);
virtual void endMicrostep(QEvent *event);
- bool event(QEvent *e) Q_DECL_OVERRIDE;
+ bool event(QEvent *e) override;
protected:
QStateMachine(QStateMachinePrivate &dd, QObject *parent);
diff --git a/src/corelib/thread/qatomic.cpp b/src/corelib/thread/qatomic.cpp
index ccb0ee6923..c161bec537 100644
--- a/src/corelib/thread/qatomic.cpp
+++ b/src/corelib/thread/qatomic.cpp
@@ -239,17 +239,17 @@
Constructs a QAtomicInt with the given \a value.
*/
-/*! \fn QAtomicInteger::QAtomicInteger(T value)
+/*! \fn QAtomicInteger<T>::QAtomicInteger(T value)
Constructs a QAtomicInteger with the given \a value.
*/
-/*! \fn QAtomicInteger::QAtomicInteger(const QAtomicInteger &other)
+/*! \fn template <typename T> QAtomicInteger<T>::QAtomicInteger(const QAtomicInteger &other)
Constructs a copy of \a other.
*/
-/*! \fn QAtomicInteger &QAtomicInteger::operator=(const QAtomicInteger &other)
+/*! \fn template <typename T> QAtomicInteger &QAtomicInteger<T>::operator=(const QAtomicInteger &other)
Assigns \a other to this QAtomicInteger and returns a reference to
this QAtomicInteger.
@@ -257,7 +257,7 @@
/*!
- \fn T QAtomicInteger::load() const
+ \fn template <typename T> T QAtomicInteger<T>::load() const
Atomically loads the value of this QAtomicInteger using relaxed memory
ordering. The value is not modified in any way, but note that there's no
@@ -267,7 +267,7 @@
*/
/*!
- \fn T QAtomicInteger::loadAcquire() const
+ \fn template <typename T> T QAtomicInteger<T>::loadAcquire() const
Atomically loads the value of this QAtomicInteger using the "Acquire" memory
ordering. The value is not modified in any way, but note that there's no
@@ -277,7 +277,7 @@
*/
/*!
- \fn void QAtomicInteger::store(T newValue)
+ \fn template <typename T> void QAtomicInteger<T>::store(T newValue)
Atomically stores the \a newValue value into this atomic type, using
relaxed memory ordering.
@@ -286,7 +286,7 @@
*/
/*!
- \fn void QAtomicInteger::storeRelease(T newValue)
+ \fn template <typename T> void QAtomicInteger<T>::storeRelease(T newValue)
Atomically stores the \a newValue value into this atomic type, using
the "Release" memory ordering.
@@ -295,7 +295,7 @@
*/
/*!
- \fn QAtomicInteger::operator T() const
+ \fn template <typename T> QAtomicInteger<T>::operator T() const
\since 5.3
Atomically loads the value of this QAtomicInteger using a sequentially
@@ -307,29 +307,29 @@
*/
/*!
- \fn QAtomicInteger &QAtomicInteger::operator=(T newValue)
+ \fn template <typename T> QAtomicInteger &QAtomicInteger<T>::operator=(T)
\since 5.3
- Atomically stores the \a newValue value into this atomic type using a
+ Atomically stores the other value into this atomic type using a
sequentially consistent memory ordering if possible; or "Release" ordering
if not. This function returns a reference to this object.
\sa store(), storeRelease()
*/
-/*! \fn bool QAtomicInteger::isReferenceCountingNative()
+/*! \fn template <typename T> bool QAtomicInteger<T>::isReferenceCountingNative()
Returns \c true if reference counting is implemented using atomic
processor instructions, false otherwise.
*/
-/*! \fn bool QAtomicInteger::isReferenceCountingWaitFree()
+/*! \fn template <typename T> bool QAtomicInteger<T>::isReferenceCountingWaitFree()
Returns \c true if atomic reference counting is wait-free, false
otherwise.
*/
-/*! \fn bool QAtomicInteger::ref()
+/*! \fn template <typename T> bool QAtomicInteger<T>::ref()
Atomically increments the value of this QAtomicInteger. Returns \c true
if the new value is non-zero, false otherwise.
@@ -342,7 +342,7 @@
*/
/*!
- \fn T QAtomicInteger::operator++()
+ \fn template <typename T> T QAtomicInteger<T>::operator++()
\since 5.3
Atomically pre-increments the value of this QAtomicInteger. Returns the new
@@ -355,7 +355,7 @@
*/
/*!
- \fn T QAtomicInteger::operator++(int)
+ \fn template <typename T> T QAtomicInteger<T>::operator++(int)
\since 5.3
Atomically post-increments the value of this QAtomicInteger. Returns the old
@@ -367,7 +367,7 @@
\sa ref(), operator++(), operator--(int)
*/
-/*! \fn bool QAtomicInteger::deref()
+/*! \fn template <typename T> bool QAtomicInteger<T>::deref()
Atomically decrements the value of this QAtomicInteger. Returns \c true
if the new value is non-zero, false otherwise.
@@ -380,7 +380,7 @@
*/
/*!
- \fn T QAtomicInteger::operator--()
+ \fn template <typename T> T QAtomicInteger<T>::operator--()
\since 5.3
Atomically pre-decrements the value of this QAtomicInteger. Returns the new
@@ -393,7 +393,7 @@
*/
/*!
- \fn T QAtomicInteger::operator--(int)
+ \fn template <typename T> T QAtomicInteger<T>::operator--(int)
\since 5.3
Atomically post-decrements the value of this QAtomicInteger. Returns the old
@@ -405,18 +405,18 @@
\sa deref(), operator--(), operator++(int)
*/
-/*! \fn bool QAtomicInteger::isTestAndSetNative()
+/*! \fn template <typename T> bool QAtomicInteger<T>::isTestAndSetNative()
Returns \c true if test-and-set is implemented using atomic processor
instructions, false otherwise.
*/
-/*! \fn bool QAtomicInteger::isTestAndSetWaitFree()
+/*! \fn template <typename T> bool QAtomicInteger<T>::isTestAndSetWaitFree()
Returns \c true if atomic test-and-set is wait-free, false otherwise.
*/
-/*! \fn bool QAtomicInteger::testAndSetRelaxed(T expectedValue, T newValue)
+/*! \fn template <typename T> bool QAtomicInteger<T>::testAndSetRelaxed(T expectedValue, T newValue)
Atomic test-and-set.
@@ -430,7 +430,7 @@
processor to freely reorder memory accesses.
*/
-/*! \fn bool QAtomicInteger::testAndSetAcquire(T expectedValue, T newValue)
+/*! \fn template <typename T> bool QAtomicInteger<T>::testAndSetAcquire(T expectedValue, T newValue)
Atomic test-and-set.
@@ -445,7 +445,7 @@
be re-ordered before the atomic operation.
*/
-/*! \fn bool QAtomicInteger::testAndSetRelease(T expectedValue, T newValue)
+/*! \fn template <typename T> bool QAtomicInteger<T>::testAndSetRelease(T expectedValue, T newValue)
Atomic test-and-set.
@@ -460,7 +460,7 @@
re-ordered after the atomic operation.
*/
-/*! \fn bool QAtomicInteger::testAndSetOrdered(T expectedValue, T newValue)
+/*! \fn template <typename T> bool QAtomicInteger<T>::testAndSetOrdered(T expectedValue, T newValue)
Atomic test-and-set.
@@ -475,19 +475,19 @@
may not be re-ordered.
*/
-/*! \fn bool QAtomicInteger::isFetchAndStoreNative()
+/*! \fn template <typename T> bool QAtomicInteger<T>::isFetchAndStoreNative()
Returns \c true if fetch-and-store is implemented using atomic
processor instructions, false otherwise.
*/
-/*! \fn bool QAtomicInteger::isFetchAndStoreWaitFree()
+/*! \fn template <typename T> bool QAtomicInteger<T>::isFetchAndStoreWaitFree()
Returns \c true if atomic fetch-and-store is wait-free, false
otherwise.
*/
-/*! \fn T QAtomicInteger::fetchAndStoreRelaxed(T newValue)
+/*! \fn template <typename T> T QAtomicInteger<T>::fetchAndStoreRelaxed(T newValue)
Atomic fetch-and-store.
@@ -499,7 +499,7 @@
processor to freely reorder memory accesses.
*/
-/*! \fn T QAtomicInteger::fetchAndStoreAcquire(T newValue)
+/*! \fn template <typename T> T QAtomicInteger<T>::fetchAndStoreAcquire(T newValue)
Atomic fetch-and-store.
@@ -512,7 +512,7 @@
be re-ordered before the atomic operation.
*/
-/*! \fn T QAtomicInteger::fetchAndStoreRelease(T newValue)
+/*! \fn template <typename T> T QAtomicInteger<T>::fetchAndStoreRelease(T newValue)
Atomic fetch-and-store.
@@ -525,7 +525,7 @@
re-ordered after the atomic operation.
*/
-/*! \fn T QAtomicInteger::fetchAndStoreOrdered(T newValue)
+/*! \fn template <typename T> T QAtomicInteger<T>::fetchAndStoreOrdered(T newValue)
Atomic fetch-and-store.
@@ -538,19 +538,19 @@
may not be re-ordered.
*/
-/*! \fn bool QAtomicInteger::isFetchAndAddNative()
+/*! \fn template <typename T> bool QAtomicInteger<T>::isFetchAndAddNative()
Returns \c true if fetch-and-add is implemented using atomic
processor instructions, false otherwise.
*/
-/*! \fn bool QAtomicInteger::isFetchAndAddWaitFree()
+/*! \fn template <typename T> bool QAtomicInteger<T>::isFetchAndAddWaitFree()
Returns \c true if atomic fetch-and-add is wait-free, false
otherwise.
*/
-/*! \fn T QAtomicInteger::fetchAndAddRelaxed(T valueToAdd)
+/*! \fn template <typename T> T QAtomicInteger<T>::fetchAndAddRelaxed(T valueToAdd)
Atomic fetch-and-add.
@@ -564,7 +564,7 @@
\sa operator+=(), fetchAndSubRelaxed()
*/
-/*! \fn T QAtomicInteger::fetchAndAddAcquire(T valueToAdd)
+/*! \fn template <typename T> T QAtomicInteger<T>::fetchAndAddAcquire(T valueToAdd)
Atomic fetch-and-add.
@@ -579,7 +579,7 @@
\sa operator+=(), fetchAndSubAcquire()
*/
-/*! \fn T QAtomicInteger::fetchAndAddRelease(T valueToAdd)
+/*! \fn template <typename T> T QAtomicInteger<T>::fetchAndAddRelease(T valueToAdd)
Atomic fetch-and-add.
@@ -594,7 +594,7 @@
\sa operator+=(), fetchAndSubRelease()
*/
-/*! \fn T QAtomicInteger::fetchAndAddOrdered(T valueToAdd)
+/*! \fn template <typename T> T QAtomicInteger<T>::fetchAndAddOrdered(T valueToAdd)
Atomic fetch-and-add.
@@ -609,13 +609,13 @@
\sa operator+=(), fetchAndSubOrdered()
*/
-/*! \fn T QAtomicInteger::operator+=(T valueToAdd)
+/*! \fn template <typename T> T QAtomicInteger<T>::operator+=(T value)
\since 5.3
Atomic add-and-fetch.
Reads the current value of this QAtomicInteger and then adds
- \a valueToAdd to the current value, returning the new value value.
+ \a value to the current value, returning the new value.
This function uses a sequentially consistent memory ordering if possible;
or "Ordered" ordering if not.
@@ -623,7 +623,7 @@
\sa fetchAndAddOrdered(), operator-=()
*/
-/*! \fn T QAtomicInteger::fetchAndSubRelaxed(T valueToSub)
+/*! \fn template <typename T> T QAtomicInteger<T>::fetchAndSubRelaxed(T valueToSub)
\since 5.3
Atomic fetch-and-sub.
@@ -638,7 +638,7 @@
\sa operator-=(), fetchAndAddRelaxed()
*/
-/*! \fn T QAtomicInteger::fetchAndSubAcquire(T valueToSub)
+/*! \fn template <typename T> T QAtomicInteger<T>::fetchAndSubAcquire(T valueToSub)
\since 5.3
Atomic fetch-and-sub.
@@ -654,7 +654,7 @@
\sa operator-=(), fetchAndAddAcquire()
*/
-/*! \fn T QAtomicInteger::fetchAndSubRelease(T valueToSub)
+/*! \fn template <typename T> T QAtomicInteger<T>::fetchAndSubRelease(T valueToSub)
\since 5.3
Atomic fetch-and-sub.
@@ -670,7 +670,7 @@
\sa operator-=(), fetchAndAddRelease()
*/
-/*! \fn T QAtomicInteger::fetchAndSubOrdered(T valueToSub)
+/*! \fn template <typename T> T QAtomicInteger<T>::fetchAndSubOrdered(T valueToSub)
\since 5.3
Atomic fetch-and-sub.
@@ -686,13 +686,13 @@
\sa operator-=(), fetchAndAddOrdered()
*/
-/*! \fn T QAtomicInteger::operator-=(T valueToSub)
+/*! \fn template <typename T> T QAtomicInteger<T>::operator-=(T value)
\since 5.3
Atomic sub-and-fetch.
Reads the current value of this QAtomicInteger and then subtracts
- \a valueToSub to the current value, returning the new value value.
+ \a value to the current value, returning the new value.
This function uses a sequentially consistent memory ordering if possible;
or "Ordered" ordering if not.
@@ -700,7 +700,7 @@
\sa fetchAndSubOrdered(), operator+=()
*/
-/*! \fn T QAtomicInteger::fetchAndOrRelaxed(T valueToOr)
+/*! \fn template <typename T> T QAtomicInteger<T>::fetchAndOrRelaxed(T valueToOr)
\since 5.3
Atomic fetch-and-or.
@@ -715,7 +715,7 @@
\sa operator|=()
*/
-/*! \fn T QAtomicInteger::fetchAndOrAcquire(T valueToOr)
+/*! \fn template <typename T> T QAtomicInteger<T>::fetchAndOrAcquire(T valueToOr)
\since 5.3
Atomic fetch-and-or.
@@ -731,7 +731,7 @@
\sa operator|=()
*/
-/*! \fn T QAtomicInteger::fetchAndOrRelease(T valueToOr)
+/*! \fn template <typename T> T QAtomicInteger<T>::fetchAndOrRelease(T valueToOr)
\since 5.3
Atomic fetch-and-or.
@@ -747,7 +747,7 @@
\sa operator|=()
*/
-/*! \fn T QAtomicInteger::fetchAndOrOrdered(T valueToOr)
+/*! \fn template <typename T> T QAtomicInteger<T>::fetchAndOrOrdered(T valueToOr)
\since 5.3
Atomic fetch-and-or.
@@ -763,13 +763,13 @@
\sa operator|=()
*/
-/*! \fn T QAtomicInteger::operator|=(T valueToOr)
+/*! \fn template <typename T> T QAtomicInteger<T>::operator|=(T value)
\since 5.3
Atomic or-and-fetch.
Reads the current value of this QAtomicInteger and then bitwise-ORs
- \a valueToOr to the current value, returning the new value value.
+ \a value to the current value, returning the new value.
This function uses a sequentially consistent memory ordering if possible;
or "Ordered" ordering if not.
@@ -777,7 +777,7 @@
\sa fetchAndOrOrdered()
*/
-/*! \fn T QAtomicInteger::fetchAndXorRelaxed(T valueToXor)
+/*! \fn template <typename T> T QAtomicInteger<T>::fetchAndXorRelaxed(T valueToXor)
\since 5.3
Atomic fetch-and-xor.
@@ -792,7 +792,7 @@
\sa operator^=()
*/
-/*! \fn T QAtomicInteger::fetchAndXorAcquire(T valueToXor)
+/*! \fn template <typename T> T QAtomicInteger<T>::fetchAndXorAcquire(T valueToXor)
\since 5.3
Atomic fetch-and-xor.
@@ -808,7 +808,7 @@
\sa operator^=()
*/
-/*! \fn T QAtomicInteger::fetchAndXorRelease(T valueToXor)
+/*! \fn template <typename T> T QAtomicInteger<T>::fetchAndXorRelease(T valueToXor)
\since 5.3
Atomic fetch-and-xor.
@@ -824,7 +824,7 @@
\sa operator^=()
*/
-/*! \fn T QAtomicInteger::fetchAndXorOrdered(T valueToXor)
+/*! \fn template <typename T> T QAtomicInteger<T>::fetchAndXorOrdered(T valueToXor)
\since 5.3
Atomic fetch-and-xor.
@@ -840,13 +840,13 @@
\sa operator^=()
*/
-/*! \fn T QAtomicInteger::operator^=(T valueToXor)
+/*! \fn template <typename T> T QAtomicInteger<T>::operator^=(T value)
\since 5.3
Atomic xor-and-fetch.
Reads the current value of this QAtomicInteger and then bitwise-XORs
- \a valueToXor to the current value, returning the new value value.
+ \a value to the current value, returning the new value.
This function uses a sequentially consistent memory ordering if possible;
or "Ordered" ordering if not.
@@ -854,7 +854,7 @@
\sa fetchAndXorOrdered()
*/
-/*! \fn T QAtomicInteger::fetchAndAndRelaxed(T valueToAnd)
+/*! \fn template <typename T> T QAtomicInteger<T>::fetchAndAndRelaxed(T valueToAnd)
\since 5.3
Atomic fetch-and-and.
@@ -869,7 +869,7 @@
\sa operator&=()
*/
-/*! \fn T QAtomicInteger::fetchAndAndAcquire(T valueToAnd)
+/*! \fn template <typename T> T QAtomicInteger<T>::fetchAndAndAcquire(T valueToAnd)
\since 5.3
Atomic fetch-and-and.
@@ -885,7 +885,7 @@
\sa operator&=()
*/
-/*! \fn T QAtomicInteger::fetchAndAndRelease(T valueToAnd)
+/*! \fn template <typename T> T QAtomicInteger<T>::fetchAndAndRelease(T valueToAnd)
\since 5.3
Atomic fetch-and-and.
@@ -901,7 +901,7 @@
\sa operator&=()
*/
-/*! \fn T QAtomicInteger::fetchAndAndOrdered(T valueToAnd)
+/*! \fn template <typename T> T QAtomicInteger<T>::fetchAndAndOrdered(T valueToAnd)
\since 5.3
Atomic fetch-and-and.
@@ -917,13 +917,13 @@
\sa operator&=()
*/
-/*! \fn T QAtomicInteger::operator&=(T valueToAnd)
+/*! \fn template <typename T> T QAtomicInteger<T>::operator&=(T value)
\since 5.3
Atomic add-and-fetch.
Reads the current value of this QAtomicInteger and then bitwise-ANDs
- \a valueToAnd to the current value, returning the new value value.
+ \a value to the current value, returning the new value.
This function uses a sequentially consistent memory ordering if possible;
or "Ordered" ordering if not.
@@ -958,7 +958,7 @@
This macro is defined when only certain generations of the
processor support atomic reference counting. Use the
- QAtomicInteger::isReferenceCountingNative() function to check what
+ QAtomicInteger<T>::isReferenceCountingNative() function to check what
your processor supports.
\e{nn} is the size of the integer, in bits (8, 16, 32 or 64).
@@ -1001,7 +1001,7 @@
This macro is defined when only certain generations of the
processor support atomic test-and-set on integers. Use the
- QAtomicInteger::isTestAndSetNative() function to check what your
+ QAtomicInteger<T>::isTestAndSetNative() function to check what your
processor supports.
\e{nn} is the size of the integer, in bits (8, 16, 32 or 64).
@@ -1044,7 +1044,7 @@
This macro is defined when only certain generations of the
processor support atomic fetch-and-store on integers. Use the
- QAtomicInteger::isFetchAndStoreNative() function to check what your
+ QAtomicInteger<T>::isFetchAndStoreNative() function to check what your
processor supports.
\e{nn} is the size of the integer, in bits (8, 16, 32 or 64).
@@ -1087,7 +1087,7 @@
This macro is defined when only certain generations of the
processor support atomic fetch-and-add on integers. Use the
- QAtomicInteger::isFetchAndAddNative() function to check what your
+ QAtomicInteger<T>::isFetchAndAddNative() function to check what your
processor supports.
\e{nn} is the size of the integer, in bits (8, 16, 32 or 64).
@@ -1260,24 +1260,24 @@
\sa QAtomicInteger
*/
-/*! \fn QAtomicPointer::QAtomicPointer(T *value)
+/*! \fn template <typename T> QAtomicPointer<T>::QAtomicPointer(T *value)
Constructs a QAtomicPointer with the given \a value.
*/
-/*! \fn QAtomicPointer::QAtomicPointer(const QAtomicPointer<T> &other)
+/*! \fn template <typename T> QAtomicPointer<T>::QAtomicPointer(const QAtomicPointer<T> &other)
Constructs a copy of \a other.
*/
-/*! \fn QAtomicPointer<T> &QAtomicPointer::operator=(const QAtomicPointer<T> &other)
+/*! \fn template <typename T> QAtomicPointer &QAtomicPointer<T>::operator=(const QAtomicPointer &other)
Assigns \a other to this QAtomicPointer and returns a reference to
this QAtomicPointer.
*/
/*!
- \fn T *QAtomicPointer::load() const
+ \fn template <typename T> T *QAtomicPointer<T>::load() const
Atomically loads the value of this QAtomicPointer using relaxed memory
ordering. The value is not modified in any way, but note that there's no
@@ -1287,7 +1287,7 @@
*/
/*!
- \fn T *QAtomicPointer::loadAcquire() const
+ \fn template <typename T> T *QAtomicPointer<T>::loadAcquire() const
Atomically loads the value of this QAtomicPointer using the "Acquire" memory
ordering. The value is not modified in any way, but note that there's no
@@ -1297,7 +1297,7 @@
*/
/*!
- \fn void QAtomicPointer::store(T *newValue)
+ \fn template <typename T> void QAtomicPointer<T>::store(T *newValue)
Atomically stores the \a newValue value into this atomic type, using
relaxed memory ordering.
@@ -1306,7 +1306,7 @@
*/
/*!
- \fn void QAtomicPointer::storeRelease(T *newValue)
+ \fn template <typename T> void QAtomicPointer<T>::storeRelease(T *newValue)
Atomically stores the \a newValue value into this atomic type, using
the "Release" memory ordering.
@@ -1314,18 +1314,18 @@
\sa store(), load()
*/
-/*! \fn bool QAtomicPointer::isTestAndSetNative()
+/*! \fn template <typename T> bool QAtomicPointer<T>::isTestAndSetNative()
Returns \c true if test-and-set is implemented using atomic processor
instructions, false otherwise.
*/
-/*! \fn bool QAtomicPointer::isTestAndSetWaitFree()
+/*! \fn template <typename T> bool QAtomicPointer<T>::isTestAndSetWaitFree()
Returns \c true if atomic test-and-set is wait-free, false otherwise.
*/
-/*! \fn bool QAtomicPointer::testAndSetRelaxed(T *expectedValue, T *newValue)
+/*! \fn template <typename T> bool QAtomicPointer<T>::testAndSetRelaxed(T *expectedValue, T *newValue)
Atomic test-and-set.
@@ -1339,7 +1339,7 @@
processor to freely reorder memory accesses.
*/
-/*! \fn bool QAtomicPointer::testAndSetAcquire(T *expectedValue, T *newValue)
+/*! \fn template <typename T> bool QAtomicPointer<T>::testAndSetAcquire(T *expectedValue, T *newValue)
Atomic test-and-set.
@@ -1354,7 +1354,7 @@
be re-ordered before the atomic operation.
*/
-/*! \fn bool QAtomicPointer::testAndSetRelease(T *expectedValue, T *newValue)
+/*! \fn template <typename T> bool QAtomicPointer<T>::testAndSetRelease(T *expectedValue, T *newValue)
Atomic test-and-set.
@@ -1369,7 +1369,7 @@
re-ordered after the atomic operation.
*/
-/*! \fn bool QAtomicPointer::testAndSetOrdered(T *expectedValue, T *newValue)
+/*! \fn template <typename T> bool QAtomicPointer<T>::testAndSetOrdered(T *expectedValue, T *newValue)
Atomic test-and-set.
@@ -1384,19 +1384,19 @@
may not be re-ordered.
*/
-/*! \fn bool QAtomicPointer::isFetchAndStoreNative()
+/*! \fn template <typename T> bool QAtomicPointer<T>::isFetchAndStoreNative()
Returns \c true if fetch-and-store is implemented using atomic
processor instructions, false otherwise.
*/
-/*! \fn bool QAtomicPointer::isFetchAndStoreWaitFree()
+/*! \fn template <typename T> bool QAtomicPointer<T>::isFetchAndStoreWaitFree()
Returns \c true if atomic fetch-and-store is wait-free, false
otherwise.
*/
-/*! \fn T *QAtomicPointer::fetchAndStoreRelaxed(T *newValue)
+/*! \fn template <typename T> T *QAtomicPointer<T>::fetchAndStoreRelaxed(T *newValue)
Atomic fetch-and-store.
@@ -1408,7 +1408,7 @@
processor to freely reorder memory accesses.
*/
-/*! \fn T *QAtomicPointer::fetchAndStoreAcquire(T *newValue)
+/*! \fn template <typename T> T *QAtomicPointer<T>::fetchAndStoreAcquire(T *newValue)
Atomic fetch-and-store.
@@ -1421,7 +1421,7 @@
be re-ordered before the atomic operation.
*/
-/*! \fn T *QAtomicPointer::fetchAndStoreRelease(T *newValue)
+/*! \fn template <typename T> T *QAtomicPointer<T>::fetchAndStoreRelease(T *newValue)
Atomic fetch-and-store.
@@ -1434,7 +1434,7 @@
re-ordered after the atomic operation.
*/
-/*! \fn T *QAtomicPointer::fetchAndStoreOrdered(T *newValue)
+/*! \fn template <typename T> T *QAtomicPointer<T>::fetchAndStoreOrdered(T *newValue)
Atomic fetch-and-store.
@@ -1447,19 +1447,19 @@
may not be re-ordered.
*/
-/*! \fn bool QAtomicPointer::isFetchAndAddNative()
+/*! \fn template <typename T> bool QAtomicPointer<T>::isFetchAndAddNative()
Returns \c true if fetch-and-add is implemented using atomic
processor instructions, false otherwise.
*/
-/*! \fn bool QAtomicPointer::isFetchAndAddWaitFree()
+/*! \fn template <typename T> bool QAtomicPointer<T>::isFetchAndAddWaitFree()
Returns \c true if atomic fetch-and-add is wait-free, false
otherwise.
*/
-/*! \fn T *QAtomicPointer::fetchAndAddRelaxed(qptrdiff valueToAdd)
+/*! \fn template <typename T> T *QAtomicPointer<T>::fetchAndAddRelaxed(qptrdiff valueToAdd)
Atomic fetch-and-add.
@@ -1471,7 +1471,7 @@
processor to freely reorder memory accesses.
*/
-/*! \fn T *QAtomicPointer::fetchAndAddAcquire(qptrdiff valueToAdd)
+/*! \fn template <typename T> T *QAtomicPointer<T>::fetchAndAddAcquire(qptrdiff valueToAdd)
Atomic fetch-and-add.
@@ -1484,7 +1484,7 @@
be re-ordered before the atomic operation.
*/
-/*! \fn T *QAtomicPointer::fetchAndAddRelease(qptrdiff valueToAdd)
+/*! \fn template <typename T> T *QAtomicPointer<T>::fetchAndAddRelease(qptrdiff valueToAdd)
Atomic fetch-and-add.
@@ -1497,7 +1497,7 @@
re-ordered after the atomic operation.
*/
-/*! \fn T *QAtomicPointer::fetchAndAddOrdered(qptrdiff valueToAdd)
+/*! \fn template <typename T> T *QAtomicPointer<T>::fetchAndAddOrdered(qptrdiff valueToAdd)
Atomic fetch-and-add.
diff --git a/src/corelib/thread/qatomic.h b/src/corelib/thread/qatomic.h
index f9eacbf6f0..f842534c38 100644
--- a/src/corelib/thread/qatomic.h
+++ b/src/corelib/thread/qatomic.h
@@ -1,6 +1,6 @@
/****************************************************************************
**
-** Copyright (C) 2016 The Qt Company Ltd.
+** Copyright (C) 2017 The Qt Company Ltd.
** Copyright (C) 2016 Intel Corporation.
** Contact: https://www.qt.io/licensing/
**
@@ -79,7 +79,7 @@ public:
return *this;
}
-#ifdef Q_QDOC
+#ifdef Q_CLANG_QDOC
T load() const;
T loadAcquire() const;
void store(T newValue);
@@ -168,9 +168,9 @@ class QAtomicPointer : public QBasicAtomicPointer<T>
{
public:
#ifdef QT_BASIC_ATOMIC_HAS_CONSTRUCTORS
- constexpr QAtomicPointer(T *value = 0) Q_DECL_NOTHROW : QBasicAtomicPointer<T>(value) {}
+ constexpr QAtomicPointer(T *value = nullptr) Q_DECL_NOTHROW : QBasicAtomicPointer<T>(value) {}
#else
- inline QAtomicPointer(T *value = 0) Q_DECL_NOTHROW
+ inline QAtomicPointer(T *value = nullptr) Q_DECL_NOTHROW
{
this->store(value);
}
diff --git a/src/corelib/thread/qbasicatomic.h b/src/corelib/thread/qbasicatomic.h
index 24218e833a..92db7a6228 100644
--- a/src/corelib/thread/qbasicatomic.h
+++ b/src/corelib/thread/qbasicatomic.h
@@ -90,6 +90,7 @@ template <typename T>
class QBasicAtomicInteger
{
public:
+ typedef T Type;
typedef QAtomicOps<T> Ops;
// static check that this is a valid integer
Q_STATIC_ASSERT_X(QTypeInfo<T>::isIntegral, "template parameter is not an integral type");
diff --git a/src/corelib/thread/qexception.cpp b/src/corelib/thread/qexception.cpp
index 62c2b608d8..a3e30d5a7a 100644
--- a/src/corelib/thread/qexception.cpp
+++ b/src/corelib/thread/qexception.cpp
@@ -40,8 +40,7 @@
#include "qexception.h"
#include "QtCore/qshareddata.h"
-#ifndef QT_NO_QFUTURE
-#ifndef QT_NO_EXCEPTIONS
+#if !defined(QT_NO_EXCEPTIONS) || defined(Q_CLANG_QDOC)
QT_BEGIN_NAMESPACE
@@ -155,7 +154,7 @@ QUnhandledException *QUnhandledException::clone() const
return new QUnhandledException(*this);
}
-#ifndef Q_QDOC
+#if !defined(Q_CLANG_QDOC)
namespace QtPrivate {
@@ -171,7 +170,7 @@ public:
};
ExceptionHolder::ExceptionHolder(QException *exception)
-: base(exception ? new Base(exception) : Q_NULLPTR) {}
+: base(exception ? new Base(exception) : nullptr) {}
ExceptionHolder::ExceptionHolder(const ExceptionHolder &other)
: base(other.base)
@@ -188,7 +187,7 @@ ExceptionHolder::~ExceptionHolder()
QException *ExceptionHolder::exception() const
{
if (!base)
- return Q_NULLPTR;
+ return nullptr;
return base->exception;
}
@@ -220,9 +219,8 @@ bool ExceptionStore::hasThrown() const { return exceptionHolder.base->hasThrown;
} // namespace QtPrivate
-#endif //Q_QDOC
+#endif //Q_CLANG_QDOC
QT_END_NAMESPACE
#endif // QT_NO_EXCEPTIONS
-#endif // QT_NO_QFUTURE
diff --git a/src/corelib/thread/qexception.h b/src/corelib/thread/qexception.h
index b14d386c69..d33904c1f2 100644
--- a/src/corelib/thread/qexception.h
+++ b/src/corelib/thread/qexception.h
@@ -40,10 +40,6 @@
#ifndef QTCORE_QEXCEPTION_H
#define QTCORE_QEXCEPTION_H
-#include <QtCore/qglobal.h>
-
-#ifndef QT_NO_QFUTURE
-
#include <QtCore/qatomic.h>
#include <QtCore/qshareddata.h>
@@ -51,10 +47,12 @@
# include <exception>
#endif
+QT_REQUIRE_CONFIG(future);
+
QT_BEGIN_NAMESPACE
-#ifndef QT_NO_EXCEPTIONS
+#if !defined(QT_NO_EXCEPTIONS) || defined(Q_CLANG_QDOC)
class Q_CORE_EXPORT QException : public std::exception
{
@@ -80,8 +78,8 @@ public:
throw()
#endif
;
- void raise() const Q_DECL_OVERRIDE;
- QUnhandledException *clone() const Q_DECL_OVERRIDE;
+ void raise() const override;
+ QUnhandledException *clone() const override;
};
namespace QtPrivate {
@@ -90,7 +88,7 @@ class Base;
class Q_CORE_EXPORT ExceptionHolder
{
public:
- ExceptionHolder(QException *exception = Q_NULLPTR);
+ ExceptionHolder(QException *exception = nullptr);
ExceptionHolder(const ExceptionHolder &other);
void operator=(const ExceptionHolder &other); // ### Qt6: copy-assign operator shouldn't return void. Remove this method and the copy-ctor, they are unneeded.
~ExceptionHolder();
@@ -128,6 +126,4 @@ public:
QT_END_NAMESPACE
-#endif // QT_NO_QFUTURE
-
#endif
diff --git a/src/corelib/thread/qfutex_p.h b/src/corelib/thread/qfutex_p.h
new file mode 100644
index 0000000000..483664c783
--- /dev/null
+++ b/src/corelib/thread/qfutex_p.h
@@ -0,0 +1,142 @@
+/****************************************************************************
+**
+** Copyright (C) 2017 Intel Corporation.
+** Contact: https://www.qt.io/licensing/
+**
+** This file is part of the QtCore module of the Qt Toolkit.
+**
+** $QT_BEGIN_LICENSE:LGPL$
+** Commercial License Usage
+** Licensees holding valid commercial Qt licenses may use this file in
+** accordance with the commercial license agreement provided with the
+** Software or, alternatively, in accordance with the terms contained in
+** a written agreement between you and The Qt Company. For licensing terms
+** and conditions see https://www.qt.io/terms-conditions. For further
+** information use the contact form at https://www.qt.io/contact-us.
+**
+** GNU Lesser General Public License Usage
+** Alternatively, this file may be used under the terms of the GNU Lesser
+** General Public License version 3 as published by the Free Software
+** Foundation and appearing in the file LICENSE.LGPL3 included in the
+** packaging of this file. Please review the following information to
+** ensure the GNU Lesser General Public License version 3 requirements
+** will be met: https://www.gnu.org/licenses/lgpl-3.0.html.
+**
+** GNU General Public License Usage
+** Alternatively, this file may be used under the terms of the GNU
+** General Public License version 2.0 or (at your option) the GNU General
+** Public license version 3 or any later version approved by the KDE Free
+** Qt Foundation. The licenses are as published by the Free Software
+** Foundation and appearing in the file LICENSE.GPL2 and LICENSE.GPL3
+** included in the packaging of this file. Please review the following
+** information to ensure the GNU General Public License requirements will
+** be met: https://www.gnu.org/licenses/gpl-2.0.html and
+** https://www.gnu.org/licenses/gpl-3.0.html.
+**
+** $QT_END_LICENSE$
+**
+****************************************************************************/
+
+#ifndef QFUTEX_P_H
+#define QFUTEX_P_H
+
+//
+// W A R N I N G
+// -------------
+//
+// This file is not part of the Qt API. It exists purely as an
+// implementation detail. This header file may change from version to
+// version without notice, or even be removed.
+//
+// We mean it.
+//
+
+#include <qglobal.h>
+
+QT_BEGIN_NAMESPACE
+
+namespace QtDummyFutex {
+ Q_DECL_CONSTEXPR inline bool futexAvailable() { return false; }
+ template <typename Atomic>
+ inline bool futexWait(Atomic &, typename Atomic::Type, int = 0)
+ { Q_UNREACHABLE(); return false; }
+ template <typename Atomic> inline void futexWakeOne(Atomic &)
+ { Q_UNREACHABLE(); }
+ template <typename Atomic> inline void futexWakeAll(Atomic &)
+ { Q_UNREACHABLE(); }
+}
+
+QT_END_NAMESPACE
+
+#if defined(Q_OS_LINUX) && !defined(QT_LINUXBASE)
+// use Linux mutexes everywhere except for LSB builds
+# include <sys/syscall.h>
+# include <errno.h>
+# include <limits.h>
+# include <unistd.h>
+# include <asm/unistd.h>
+# include <linux/futex.h>
+# define QT_ALWAYS_USE_FUTEX
+
+// if not defined in linux/futex.h
+# define FUTEX_PRIVATE_FLAG 128 // added in v2.6.22
+
+QT_BEGIN_NAMESPACE
+namespace QtLinuxFutex {
+ constexpr inline bool futexAvailable() { return true; }
+ inline int _q_futex(int *addr, int op, int val, quintptr val2 = 0,
+ int *addr2 = nullptr, int val3 = 0) Q_DECL_NOTHROW
+ {
+ // we use __NR_futex because some libcs (like Android's bionic) don't
+ // provide SYS_futex etc.
+ return syscall(__NR_futex, addr, op | FUTEX_PRIVATE_FLAG, val, val2, addr2, val3);
+ }
+ template <typename T> int *addr(T *ptr)
+ {
+ int *int_addr = reinterpret_cast<int *>(ptr);
+#if Q_BYTE_ORDER == Q_BIG_ENDIAN
+ if (sizeof(T) > sizeof(int))
+ int_addr++; //We want a pointer to the least significant half
+#endif
+ return int_addr;
+ }
+
+ template <typename Atomic>
+ inline void futexWait(Atomic &futex, typename Atomic::Type expectedValue)
+ {
+ _q_futex(addr(&futex), FUTEX_WAIT, qintptr(expectedValue));
+ }
+ template <typename Atomic>
+ inline bool futexWait(Atomic &futex, typename Atomic::Type expectedValue, qint64 nstimeout)
+ {
+ struct timespec ts;
+ ts.tv_sec = nstimeout / 1000 / 1000 / 1000;
+ ts.tv_nsec = nstimeout % (1000 * 1000 * 1000);
+ int r = _q_futex(addr(&futex), FUTEX_WAIT, qintptr(expectedValue), quintptr(&ts));
+ return r == 0 || errno != ETIMEDOUT;
+ }
+ template <typename Atomic> inline void futexWakeOne(Atomic &futex)
+ {
+ _q_futex(addr(&futex), FUTEX_WAKE, 1);
+ }
+ template <typename Atomic> inline void futexWakeAll(Atomic &futex)
+ {
+ _q_futex(addr(&futex), FUTEX_WAKE, INT_MAX);
+ }
+ template <typename Atomic> inline
+ void futexWakeOp(Atomic &futex1, int wake1, int wake2, Atomic &futex2, quint32 op)
+ {
+ _q_futex(addr(&futex1), FUTEX_WAKE_OP, wake1, wake2, addr(&futex2), op);
+ }
+}
+namespace QtFutex = QtLinuxFutex;
+QT_END_NAMESPACE
+
+#else
+
+QT_BEGIN_NAMESPACE
+namespace QtFutex = QtDummyFutex;
+QT_END_NAMESPACE
+#endif
+
+#endif // QFUTEX_P_H
diff --git a/src/corelib/thread/qfuture.h b/src/corelib/thread/qfuture.h
index 1f0c747f40..af599c26db 100644
--- a/src/corelib/thread/qfuture.h
+++ b/src/corelib/thread/qfuture.h
@@ -42,11 +42,11 @@
#include <QtCore/qglobal.h>
-#ifndef QT_NO_QFUTURE
-
#include <QtCore/qfutureinterface.h>
#include <QtCore/qstring.h>
+QT_REQUIRE_CONFIG(future);
+
QT_BEGIN_NAMESPACE
@@ -65,6 +65,11 @@ public:
explicit QFuture(QFutureInterface<T> *p) // internal
: d(*p)
{ }
+#if defined(Q_CLANG_QDOC)
+ ~QFuture() { }
+ QFuture(const QFuture<T> &) { }
+ QFuture<T> & operator=(const QFuture<T> &) { }
+#endif
bool operator==(const QFuture &other) const { return (d == other.d); }
bool operator!=(const QFuture &other) const { return (d != other.d); }
@@ -242,6 +247,4 @@ QFuture<void> qToVoidFuture(const QFuture<T> &future)
QT_END_NAMESPACE
-#endif // QT_NO_QFUTURE
-
#endif // QFUTURE_H
diff --git a/src/corelib/thread/qfuture.qdoc b/src/corelib/thread/qfuture.qdoc
index 25306d5564..8d5b7c776c 100644
--- a/src/corelib/thread/qfuture.qdoc
+++ b/src/corelib/thread/qfuture.qdoc
@@ -93,23 +93,23 @@
\sa QFutureWatcher, {Qt Concurrent}
*/
-/*! \fn QFuture::QFuture()
+/*! \fn template <typename T> QFuture<T>::QFuture()
Constructs an empty, canceled future.
*/
-/*! \fn QFuture::QFuture(const QFuture &other)
+/*! \fn template <typename T> QFuture<T>::QFuture(const QFuture<T> &other)
Constructs a copy of \a other.
\sa operator=()
*/
-/*! \fn QFuture::QFuture(QFutureInterface<T> *resultHolder)
+/*! \fn template <typename T> QFuture<T>::QFuture(QFutureInterface<T> *resultHolder)
\internal
*/
-/*! \fn QFuture::~QFuture()
+/*! \fn template <typename T> QFuture<T>::~QFuture()
Destroys the future.
@@ -118,23 +118,23 @@
computation is completed before the future is destroyed.
*/
-/*! \fn QFuture &QFuture::operator=(const QFuture &other)
+/*! \fn template <typename T> QFuture<T> &QFuture<T>::operator=(const QFuture<T> &other)
Assigns \a other to this future and returns a reference to this future.
*/
-/*! \fn bool QFuture::operator==(const QFuture &other) const
+/*! \fn template <typename T> bool QFuture<T>::operator==(const QFuture &other) const
Returns \c true if \a other is a copy of this future; otherwise returns \c false.
*/
-/*! \fn bool QFuture::operator!=(const QFuture &other) const
+/*! \fn template <typename T> bool QFuture<T>::operator!=(const QFuture &other) const
Returns \c true if \a other is \e not a copy of this future; otherwise returns
false.
*/
-/*! \fn void QFuture::cancel()
+/*! \fn template <typename T> void QFuture<T>::cancel()
Cancels the asynchronous computation represented by this future. Note that
the cancelation is asynchronous. Use waitForFinished() after calling
@@ -150,7 +150,7 @@
but the future returned by QtConcurrent::mappedReduced() can.
*/
-/*! \fn bool QFuture::isCanceled() const
+/*! \fn template <typename T> bool QFuture<T>::isCanceled() const
Returns \c true if the asynchronous computation has been canceled with the
cancel() function; otherwise returns \c false.
@@ -159,7 +159,7 @@
function returns \c true. See cancel() for more details.
*/
-/*! \fn void QFuture::setPaused(bool paused)
+/*! \fn template <typename T> void QFuture<T>::setPaused(bool paused)
If \a paused is true, this function pauses the asynchronous computation
represented by the future. If the computation is already paused, this
@@ -178,7 +178,7 @@
\sa pause(), resume(), togglePaused()
*/
-/*! \fn bool QFuture::isPaused() const
+/*! \fn template <typename T> bool QFuture<T>::isPaused() const
Returns \c true if the asynchronous computation has been paused with the
pause() function; otherwise returns \c false.
@@ -189,7 +189,7 @@
\sa setPaused(), togglePaused()
*/
-/*! \fn void QFuture::pause()
+/*! \fn template <typename T> void QFuture<T>::pause()
Pauses the asynchronous computation represented by this future. This is a
convenience method that simply calls setPaused(true).
@@ -197,7 +197,7 @@
\sa resume()
*/
-/*! \fn void QFuture::resume()
+/*! \fn template <typename T> void QFuture<T>::resume()
Resumes the asynchronous computation represented by this future. This is a
convenience method that simply calls setPaused(false).
@@ -205,7 +205,7 @@
\sa pause()
*/
-/*! \fn void QFuture::togglePaused()
+/*! \fn template <typename T> void QFuture<T>::togglePaused()
Toggles the paused state of the asynchronous computation. In other words,
if the computation is currently paused, calling this function resumes it;
@@ -215,25 +215,25 @@
\sa setPaused(), pause(), resume()
*/
-/*! \fn bool QFuture::isStarted() const
+/*! \fn template <typename T> bool QFuture<T>::isStarted() const
Returns \c true if the asynchronous computation represented by this future
has been started; otherwise returns \c false.
*/
-/*! \fn bool QFuture::isFinished() const
+/*! \fn template <typename T> bool QFuture<T>::isFinished() const
Returns \c true if the asynchronous computation represented by this future
has finished; otherwise returns \c false.
*/
-/*! \fn bool QFuture::isRunning() const
+/*! \fn template <typename T> bool QFuture<T>::isRunning() const
Returns \c true if the asynchronous computation represented by this future is
currently running; otherwise returns \c false.
*/
-/*! \fn int QFuture::resultCount() const
+/*! \fn template <typename T> int QFuture<T>::resultCount() const
Returns the number of continuous results available in this future. The real
number of results stored might be different from this value, due to gaps
@@ -242,7 +242,7 @@
\sa result(), resultAt(), results()
*/
-/*! \fn int QFuture::progressValue() const
+/*! \fn template <typename T> int QFuture<T>::progressValue() const
Returns the current progress value, which is between the progressMinimum()
and progressMaximum().
@@ -250,21 +250,21 @@
\sa progressMinimum(), progressMaximum()
*/
-/*! \fn int QFuture::progressMinimum() const
+/*! \fn template <typename T> int QFuture<T>::progressMinimum() const
Returns the minimum progressValue().
\sa progressValue(), progressMaximum()
*/
-/*! \fn int QFuture::progressMaximum() const
+/*! \fn template <typename T> int QFuture<T>::progressMaximum() const
Returns the maximum progressValue().
\sa progressValue(), progressMinimum()
*/
-/*! \fn QString QFuture::progressText() const
+/*! \fn template <typename T> QString QFuture<T>::progressText() const
Returns the (optional) textual representation of the progress as reported
by the asynchronous computation.
@@ -273,13 +273,13 @@
progress, and as such, this function may return an empty string.
*/
-/*! \fn void QFuture::waitForFinished()
+/*! \fn template <typename T> void QFuture<T>::waitForFinished()
Waits for the asynchronous computation to finish (including cancel()ed
computations).
*/
-/*! \fn T QFuture::result() const
+/*! \fn template <typename T> T QFuture<T>::result() const
Returns the first result in the future. If the result is not immediately
available, this function will block and wait for the result to become
@@ -288,7 +288,7 @@
\sa resultAt(), results()
*/
-/*! \fn T QFuture::resultAt(int index) const
+/*! \fn template <typename T> T QFuture<T>::resultAt(int index) const
Returns the result at \a index in the future. If the result is not
immediately available, this function will block and wait for the result to
@@ -297,7 +297,7 @@
\sa result(), results(), resultCount()
*/
-/*! \fn bool QFuture::isResultReadyAt(int index) const
+/*! \fn template <typename T> bool QFuture<T>::isResultReadyAt(int index) const
Returns \c true if the result at \a index is immediately available; otherwise
returns \c false.
@@ -305,7 +305,7 @@
\sa resultAt(), resultCount()
*/
-/*! \fn QFuture::operator T() const
+/*! \fn template <typename T> QFuture<T>::operator T() const
Returns the first result in the future. If the result is not immediately
available, this function will block and wait for the result to become
@@ -315,7 +315,7 @@
\sa result(), resultAt(), results()
*/
-/*! \fn QList<T> QFuture::results() const
+/*! \fn template <typename T> QList<T> QFuture<T>::results() const
Returns all results from the future. If the results are not immediately
available, this function will block and wait for them to become available.
@@ -323,7 +323,7 @@
\sa result(), resultAt(), resultCount()
*/
-/*! \fn QFuture::const_iterator QFuture::begin() const
+/*! \fn template <typename T> QFuture<T>::const_iterator QFuture<T>::begin() const
Returns a const \l{STL-style iterators}{STL-style iterator} pointing to the first result in the
future.
@@ -331,7 +331,7 @@
\sa constBegin(), end()
*/
-/*! \fn QFuture::const_iterator QFuture::end() const
+/*! \fn template <typename T> QFuture<T>::const_iterator QFuture<T>::end() const
Returns a const \l{STL-style iterators}{STL-style iterator} pointing to the imaginary result
after the last result in the future.
@@ -339,7 +339,7 @@
\sa begin(), constEnd()
*/
-/*! \fn QFuture::const_iterator QFuture::constBegin() const
+/*! \fn template <typename T> QFuture<T>::const_iterator QFuture<T>::constBegin() const
Returns a const \l{STL-style iterators}{STL-style iterator} pointing to the first result in the
future.
@@ -347,7 +347,7 @@
\sa begin(), constEnd()
*/
-/*! \fn QFuture::const_iterator QFuture::constEnd() const
+/*! \fn template <typename T> QFuture<T>::const_iterator QFuture<T>::constEnd() const
Returns a const \l{STL-style iterators}{STL-style iterator} pointing to the imaginary result
after the last result in the future.
@@ -403,7 +403,7 @@
Typedef for const T &. Provided for STL compatibility.
*/
-/*! \fn QFuture::const_iterator::const_iterator()
+/*! \fn template <typename T> QFuture<T>::const_iterator::const_iterator()
Constructs an uninitialized iterator.
@@ -414,31 +414,31 @@
\sa QFuture::constBegin(), QFuture::constEnd()
*/
-/*! \fn QFuture::const_iterator::const_iterator(QFuture const * const future, int index)
+/*! \fn template <typename T> QFuture<T>::const_iterator::const_iterator(QFuture const * const future, int index)
\internal
*/
-/*! \fn QFuture::const_iterator::const_iterator(const const_iterator &other)
+/*! \fn template <typename T> QFuture<T>::const_iterator::const_iterator(const const_iterator &other)
Constructs a copy of \a other.
*/
-/*! \fn QFuture::const_iterator &QFuture::const_iterator::operator=(const const_iterator &other)
+/*! \fn template <typename T> QFuture<T>::const_iterator &QFuture<T>::const_iterator::operator=(const const_iterator &other)
Assigns \a other to this iterator.
*/
-/*! \fn const T &QFuture::const_iterator::operator*() const
+/*! \fn template <typename T> const T &QFuture<T>::const_iterator::operator*() const
Returns the current result.
*/
-/*! \fn const T *QFuture::const_iterator::operator->() const
+/*! \fn template <typename T> const T *QFuture<T>::const_iterator::operator->() const
Returns a pointer to the current result.
*/
-/*! \fn bool QFuture::const_iterator::operator!=(const const_iterator &other) const
+/*! \fn template <typename T> bool QFuture<T>::const_iterator::operator!=(const const_iterator &other) const
Returns \c true if \a other points to a different result than this iterator;
otherwise returns \c false.
@@ -446,7 +446,7 @@
\sa operator==()
*/
-/*! \fn bool QFuture::const_iterator::operator==(const const_iterator &other) const
+/*! \fn template <typename T> bool QFuture<T>::const_iterator::operator==(const const_iterator &other) const
Returns \c true if \a other points to the same result as this iterator;
otherwise returns \c false.
@@ -454,17 +454,17 @@
\sa operator!=()
*/
-/*! \fn QFuture::const_iterator &QFuture::const_iterator::operator++()
+/*! \fn template <typename T> QFuture<T>::const_iterator &QFuture<T>::const_iterator::operator++()
The prefix ++ operator (\c{++it}) advances the iterator to the next result
in the future and returns an iterator to the new current result.
- Calling this function on QFuture::constEnd() leads to undefined results.
+ Calling this function on QFuture<T>::constEnd() leads to undefined results.
\sa operator--()
*/
-/*! \fn QFuture::const_iterator QFuture::const_iterator::operator++(int)
+/*! \fn template <typename T> QFuture<T>::const_iterator QFuture<T>::const_iterator::operator++(int)
\overload
@@ -473,17 +473,17 @@
result.
*/
-/*! \fn QFuture::const_iterator &QFuture::const_iterator::operator--()
+/*! \fn template <typename T> QFuture<T>::const_iterator &QFuture<T>::const_iterator::operator--()
The prefix -- operator (\c{--it}) makes the preceding result current and
returns an iterator to the new current result.
- Calling this function on QFuture::constBegin() leads to undefined results.
+ Calling this function on QFuture<T>::constBegin() leads to undefined results.
\sa operator++()
*/
-/*! \fn QFuture::const_iterator QFuture::const_iterator::operator--(int)
+/*! \fn template <typename T> QFuture<T>::const_iterator QFuture<T>::const_iterator::operator--(int)
\overload
@@ -491,7 +491,7 @@
returns an iterator to the previously current result.
*/
-/*! \fn QFuture::const_iterator &QFuture::const_iterator::operator+=(int j)
+/*! \fn template <typename T> QFuture<T>::const_iterator &QFuture<T>::const_iterator::operator+=(int j)
Advances the iterator by \a j results. (If \a j is negative, the iterator
goes backward.)
@@ -499,7 +499,7 @@
\sa operator-=(), operator+()
*/
-/*! \fn QFuture::const_iterator &QFuture::const_iterator::operator-=(int j)
+/*! \fn template <typename T> QFuture<T>::const_iterator &QFuture<T>::const_iterator::operator-=(int j)
Makes the iterator go back by \a j results. (If \a j is negative, the
iterator goes forward.)
@@ -507,7 +507,7 @@
\sa operator+=(), operator-()
*/
-/*! \fn QFuture::const_iterator QFuture::const_iterator::operator+(int j) const
+/*! \fn template <typename T> QFuture<T>::const_iterator QFuture<T>::const_iterator::operator+(int j) const
Returns an iterator to the results at \a j positions forward from this
iterator. (If \a j is negative, the iterator goes backward.)
@@ -515,7 +515,7 @@
\sa operator-(), operator+=()
*/
-/*! \fn QFuture::const_iterator QFuture::const_iterator::operator-(int j) const
+/*! \fn template <typename T> QFuture<T>::const_iterator QFuture<T>::const_iterator::operator-(int j) const
Returns an iterator to the result at \a j positions backward from this
iterator. (If \a j is negative, the iterator goes forward.)
@@ -582,7 +582,7 @@
*/
/*!
- \fn QFutureIterator::QFutureIterator(const QFuture<T> &future)
+ \fn template <typename T> QFutureIterator<T>::QFutureIterator(const QFuture<T> &future)
Constructs an iterator for traversing \a future. The iterator is set to be
at the front of the result list (before the first result).
@@ -590,7 +590,7 @@
\sa operator=()
*/
-/*! \fn QFutureIterator &QFutureIterator::operator=(const QFuture<T> &future)
+/*! \fn template <typename T> QFutureIterator &QFutureIterator<T>::operator=(const QFuture<T> &future)
Makes the iterator operate on \a future. The iterator is set to be at the
front of the result list (before the first result).
@@ -598,7 +598,7 @@
\sa toFront(), toBack()
*/
-/*! \fn void QFutureIterator::toFront()
+/*! \fn template <typename T> void QFutureIterator<T>::toFront()
Moves the iterator to the front of the result list (before the first
result).
@@ -606,14 +606,14 @@
\sa toBack(), next()
*/
-/*! \fn void QFutureIterator::toBack()
+/*! \fn template <typename T> void QFutureIterator<T>::toBack()
Moves the iterator to the back of the result list (after the last result).
\sa toFront(), previous()
*/
-/*! \fn bool QFutureIterator::hasNext() const
+/*! \fn template <typename T> bool QFutureIterator<T>::hasNext() const
Returns \c true if there is at least one result ahead of the iterator, e.g.,
the iterator is \e not at the back of the result list; otherwise returns
@@ -622,7 +622,7 @@
\sa hasPrevious(), next()
*/
-/*! \fn const T &QFutureIterator::next()
+/*! \fn template <typename T> const T &QFutureIterator<T>::next()
Returns the next result and advances the iterator by one position.
@@ -632,7 +632,7 @@
\sa hasNext(), peekNext(), previous()
*/
-/*! \fn const T &QFutureIterator::peekNext() const
+/*! \fn template <typename T> const T &QFutureIterator<T>::peekNext() const
Returns the next result without moving the iterator.
@@ -642,7 +642,7 @@
\sa hasNext(), next(), peekPrevious()
*/
-/*! \fn bool QFutureIterator::hasPrevious() const
+/*! \fn template <typename T> bool QFutureIterator<T>::hasPrevious() const
Returns \c true if there is at least one result ahead of the iterator, e.g.,
the iterator is \e not at the front of the result list; otherwise returns
@@ -651,7 +651,7 @@
\sa hasNext(), previous()
*/
-/*! \fn const T &QFutureIterator::previous()
+/*! \fn template <typename T> const T &QFutureIterator<T>::previous()
Returns the previous result and moves the iterator back by one position.
@@ -661,7 +661,7 @@
\sa hasPrevious(), peekPrevious(), next()
*/
-/*! \fn const T &QFutureIterator::peekPrevious() const
+/*! \fn template <typename T> const T &QFutureIterator<T>::peekPrevious() const
Returns the previous result without moving the iterator.
@@ -671,7 +671,7 @@
\sa hasPrevious(), previous(), peekNext()
*/
-/*! \fn bool QFutureIterator::findNext(const T &value)
+/*! \fn template <typename T> bool QFutureIterator<T>::findNext(const T &value)
Searches for \a value starting from the current iterator position forward.
Returns \c true if \a value is found; otherwise returns \c false.
@@ -683,7 +683,7 @@
\sa findPrevious()
*/
-/*! \fn bool QFutureIterator::findPrevious(const T &value)
+/*! \fn template <typename T> bool QFutureIterator<T>::findPrevious(const T &value)
Searches for \a value starting from the current iterator position
backward. Returns \c true if \a value is found; otherwise returns \c false.
diff --git a/src/corelib/thread/qfutureinterface.cpp b/src/corelib/thread/qfutureinterface.cpp
index c62b8fd36b..8bf74ca288 100644
--- a/src/corelib/thread/qfutureinterface.cpp
+++ b/src/corelib/thread/qfutureinterface.cpp
@@ -39,9 +39,6 @@
// qfutureinterface.h included from qfuture.h
#include "qfuture.h"
-
-#ifndef QT_NO_QFUTURE
-
#include "qfutureinterface_p.h"
#include <QtCore/qatomic.h>
@@ -604,5 +601,3 @@ void QFutureInterfaceBasePrivate::setState(QFutureInterfaceBase::State newState)
}
QT_END_NAMESPACE
-
-#endif // QT_NO_QFUTURE
diff --git a/src/corelib/thread/qfutureinterface.h b/src/corelib/thread/qfutureinterface.h
index 7b12f51e3e..3dd236752c 100644
--- a/src/corelib/thread/qfutureinterface.h
+++ b/src/corelib/thread/qfutureinterface.h
@@ -41,13 +41,12 @@
#define QFUTUREINTERFACE_H
#include <QtCore/qrunnable.h>
-
-#ifndef QT_NO_QFUTURE
-
#include <QtCore/qmutex.h>
#include <QtCore/qexception.h>
#include <QtCore/qresultstore.h>
+QT_REQUIRE_CONFIG(future);
+
QT_BEGIN_NAMESPACE
@@ -291,10 +290,9 @@ public:
void reportResult(const void *, int) { }
void reportResults(const QVector<void> &, int) { }
- void reportFinished(const void * = Q_NULLPTR) { QFutureInterfaceBase::reportFinished(); }
+ void reportFinished(const void * = nullptr) { QFutureInterfaceBase::reportFinished(); }
};
QT_END_NAMESPACE
-#endif // QT_NO_QFUTURE
#endif // QFUTUREINTERFACE_H
diff --git a/src/corelib/thread/qfutureinterface_p.h b/src/corelib/thread/qfutureinterface_p.h
index cf882dd9b4..63e534464f 100644
--- a/src/corelib/thread/qfutureinterface_p.h
+++ b/src/corelib/thread/qfutureinterface_p.h
@@ -59,6 +59,8 @@
#include <QtCore/qrunnable.h>
#include <QtCore/qthreadpool.h>
+QT_REQUIRE_CONFIG(future);
+
QT_BEGIN_NAMESPACE
class QFutureCallOutEvent : public QEvent
diff --git a/src/corelib/thread/qfuturesynchronizer.h b/src/corelib/thread/qfuturesynchronizer.h
index 6bc2725024..5006ebb9cf 100644
--- a/src/corelib/thread/qfuturesynchronizer.h
+++ b/src/corelib/thread/qfuturesynchronizer.h
@@ -42,7 +42,7 @@
#include <QtCore/qfuture.h>
-#ifndef QT_NO_QFUTURE
+QT_REQUIRE_CONFIG(future);
QT_BEGIN_NAMESPACE
@@ -110,6 +110,5 @@ protected:
};
QT_END_NAMESPACE
-#endif // QT_NO_QFUTURE
#endif // QFUTURESYNCHRONIZER_H
diff --git a/src/corelib/thread/qfuturesynchronizer.qdoc b/src/corelib/thread/qfuturesynchronizer.qdoc
index 580eae6982..c9c402ff87 100644
--- a/src/corelib/thread/qfuturesynchronizer.qdoc
+++ b/src/corelib/thread/qfuturesynchronizer.qdoc
@@ -68,13 +68,13 @@
*/
/*!
- \fn QFutureSynchronizer::QFutureSynchronizer()
+ \fn template <typename T> QFutureSynchronizer<T>::QFutureSynchronizer()
Constructs a QFutureSynchronizer.
*/
/*!
- \fn QFutureSynchronizer::QFutureSynchronizer(const QFuture<T> &future)
+ \fn template <typename T> QFutureSynchronizer<T>::QFutureSynchronizer(const QFuture<T> &future)
Constructs a QFutureSynchronizer and begins watching \a future by calling
addFuture().
@@ -83,7 +83,7 @@
*/
/*!
- \fn QFutureSynchronizer::~QFutureSynchronizer()
+ \fn template <typename T> QFutureSynchronizer<T>::~QFutureSynchronizer()
Calls waitForFinished() function to ensure that all futures have finished
before destroying this QFutureSynchronizer.
@@ -92,7 +92,7 @@
*/
/*!
- \fn void QFutureSynchronizer::setFuture(const QFuture<T> &future)
+ \fn template <typename T> void QFutureSynchronizer<T>::setFuture(const QFuture<T> &future)
Sets \a future to be the only future managed by this QFutureSynchronizer.
This is a convenience function that calls waitForFinished(),
@@ -102,7 +102,7 @@
*/
/*!
- \fn void QFutureSynchronizer::addFuture(const QFuture<T> &future)
+ \fn template <typename T> void QFutureSynchronizer<T>::addFuture(const QFuture<T> &future)
Adds \a future to the list of managed futures.
@@ -110,7 +110,7 @@
*/
/*!
- \fn void QFutureSynchronizer::waitForFinished()
+ \fn template <typename T> void QFutureSynchronizer<T>::waitForFinished()
Waits for all futures to finish. If cancelOnWait() returns \c true, each
future is canceled before waiting for them to finish.
@@ -119,7 +119,7 @@
*/
/*!
- \fn void QFutureSynchronizer::clearFutures()
+ \fn template <typename T> void QFutureSynchronizer<T>::clearFutures()
Removes all managed futures from this QFutureSynchronizer.
@@ -127,7 +127,7 @@
*/
/*!
- \fn QList<QFuture<T> > QFutureSynchronizer::futures() const
+ \fn template <typename T> QList<QFuture<T> > QFutureSynchronizer<T>::futures() const
Returns a list of all managed futures.
@@ -135,7 +135,7 @@
*/
/*!
- \fn void QFutureSynchronizer::setCancelOnWait(bool enabled)
+ \fn template <typename T> void QFutureSynchronizer<T>::setCancelOnWait(bool enabled)
Enables or disables the cancel-on-wait feature based on the \a enabled
argument. If \a enabled is true, the waitForFinished() function will cancel
@@ -145,7 +145,7 @@
*/
/*!
- \fn bool QFutureSynchronizer::cancelOnWait() const
+ \fn template <typename T> bool QFutureSynchronizer<T>::cancelOnWait() const
Returns \c true if the cancel-on-wait feature is enabled; otherwise returns
false. If cancel-on-wait is enabled, the waitForFinished() function will
diff --git a/src/corelib/thread/qfuturewatcher.cpp b/src/corelib/thread/qfuturewatcher.cpp
index d2ec18850f..8c4cb9a5a2 100644
--- a/src/corelib/thread/qfuturewatcher.cpp
+++ b/src/corelib/thread/qfuturewatcher.cpp
@@ -38,9 +38,6 @@
****************************************************************************/
#include "qfuturewatcher.h"
-
-#ifndef QT_NO_QFUTURE
-
#include "qfuturewatcher_p.h"
#include <QtCore/qcoreevent.h>
@@ -99,7 +96,7 @@ QT_BEGIN_NAMESPACE
\sa QFuture, {Qt Concurrent}
*/
-/*! \fn QFutureWatcher::QFutureWatcher(QObject *parent)
+/*! \fn template <typename T> QFutureWatcher<T>::QFutureWatcher(QObject *parent)
Constructs a new QFutureWatcher with the given \a parent.
*/
@@ -107,12 +104,12 @@ QFutureWatcherBase::QFutureWatcherBase(QObject *parent)
:QObject(*new QFutureWatcherBasePrivate, parent)
{ }
-/*! \fn QFutureWatcher::~QFutureWatcher()
+/*! \fn template <typename T> QFutureWatcher<T>::~QFutureWatcher()
Destroys the QFutureWatcher.
*/
-/*! \fn void QFutureWatcher::cancel()
+/*! \fn template <typename T> void QFutureWatcher<T>::cancel()
Cancels the asynchronous computation represented by the future(). Note that
the cancelation is asynchronous. Use waitForFinished() after calling
@@ -134,7 +131,7 @@ void QFutureWatcherBase::cancel()
futureInterface().cancel();
}
-/*! \fn void QFutureWatcher::setPaused(bool paused)
+/*! \fn template <typename T> void QFutureWatcher<T>::setPaused(bool paused)
If \a paused is true, this function pauses the asynchronous computation
represented by the future(). If the computation is already paused, this
@@ -156,7 +153,7 @@ void QFutureWatcherBase::setPaused(bool paused)
futureInterface().setPaused(paused);
}
-/*! \fn void QFutureWatcher::pause()
+/*! \fn template <typename T> void QFutureWatcher<T>::pause()
Pauses the asynchronous computation represented by the future(). This is a
convenience method that simply calls setPaused(true).
@@ -168,7 +165,7 @@ void QFutureWatcherBase::pause()
futureInterface().setPaused(true);
}
-/*! \fn void QFutureWatcher::resume()
+/*! \fn template <typename T> void QFutureWatcher<T>::resume()
Resumes the asynchronous computation represented by the future(). This is
a convenience method that simply calls setPaused(false).
@@ -180,7 +177,7 @@ void QFutureWatcherBase::resume()
futureInterface().setPaused(false);
}
-/*! \fn void QFutureWatcher::togglePaused()
+/*! \fn template <typename T> void QFutureWatcher<T>::togglePaused()
Toggles the paused state of the asynchronous computation. In other words,
if the computation is currently paused, calling this function resumes it;
@@ -194,7 +191,7 @@ void QFutureWatcherBase::togglePaused()
futureInterface().togglePaused();
}
-/*! \fn int QFutureWatcher::progressValue() const
+/*! \fn template <typename T> int QFutureWatcher<T>::progressValue() const
Returns the current progress value, which is between the progressMinimum()
and progressMaximum().
@@ -206,7 +203,7 @@ int QFutureWatcherBase::progressValue() const
return futureInterface().progressValue();
}
-/*! \fn int QFutureWatcher::progressMinimum() const
+/*! \fn template <typename T> int QFutureWatcher<T>::progressMinimum() const
Returns the minimum progressValue().
@@ -217,7 +214,7 @@ int QFutureWatcherBase::progressMinimum() const
return futureInterface().progressMinimum();
}
-/*! \fn int QFutureWatcher::progressMaximum() const
+/*! \fn template <typename T> int QFutureWatcher<T>::progressMaximum() const
Returns the maximum progressValue().
@@ -228,7 +225,7 @@ int QFutureWatcherBase::progressMaximum() const
return futureInterface().progressMaximum();
}
-/*! \fn QString QFutureWatcher::progressText() const
+/*! \fn template <typename T> QString QFutureWatcher<T>::progressText() const
Returns the (optional) textual representation of the progress as reported
by the asynchronous computation.
@@ -241,7 +238,7 @@ QString QFutureWatcherBase::progressText() const
return futureInterface().progressText();
}
-/*! \fn bool QFutureWatcher::isStarted() const
+/*! \fn template <typename T> bool QFutureWatcher<T>::isStarted() const
Returns \c true if the asynchronous computation represented by the future()
has been started; otherwise returns \c false.
@@ -251,7 +248,7 @@ bool QFutureWatcherBase::isStarted() const
return futureInterface().queryState(QFutureInterfaceBase::Started);
}
-/*! \fn bool QFutureWatcher::isFinished() const
+/*! \fn template <typename T> bool QFutureWatcher<T>::isFinished() const
Returns \c true if the asynchronous computation represented by the future()
has finished, or if no future has been set; otherwise returns \c false.
@@ -262,7 +259,7 @@ bool QFutureWatcherBase::isFinished() const
return d->finished;
}
-/*! \fn bool QFutureWatcher::isRunning() const
+/*! \fn template <typename T> bool QFutureWatcher<T>::isRunning() const
Returns \c true if the asynchronous computation represented by the future()
is currently running; otherwise returns \c false.
@@ -272,7 +269,7 @@ bool QFutureWatcherBase::isRunning() const
return futureInterface().queryState(QFutureInterfaceBase::Running);
}
-/*! \fn bool QFutureWatcher::isCanceled() const
+/*! \fn template <typename T> bool QFutureWatcher<T>::isCanceled() const
Returns \c true if the asynchronous computation has been canceled with the
cancel() function; otherwise returns \c false.
@@ -285,7 +282,7 @@ bool QFutureWatcherBase::isCanceled() const
return futureInterface().queryState(QFutureInterfaceBase::Canceled);
}
-/*! \fn bool QFutureWatcher::isPaused() const
+/*! \fn template <typename T> bool QFutureWatcher<T>::isPaused() const
Returns \c true if the asynchronous computation has been paused with the
pause() function; otherwise returns \c false.
@@ -300,7 +297,7 @@ bool QFutureWatcherBase::isPaused() const
return futureInterface().queryState(QFutureInterfaceBase::Paused);
}
-/*! \fn void QFutureWatcher::waitForFinished()
+/*! \fn template <typename T> void QFutureWatcher<T>::waitForFinished()
Waits for the asynchronous computation to finish (including cancel()ed
computations).
@@ -339,7 +336,7 @@ bool QFutureWatcherBase::event(QEvent *event)
return QObject::event(event);
}
-/*! \fn void QFutureWatcher::setPendingResultsLimit(int limit)
+/*! \fn template <typename T> void QFutureWatcher<T>::setPendingResultsLimit(int limit)
The setPendingResultsLimit() provides throttling control. When the number
of pending resultReadyAt() or resultsReadyAt() signals exceeds the
@@ -490,7 +487,7 @@ void QFutureWatcherBasePrivate::sendCallOutEvent(QFutureCallOutEvent *event)
}
-/*! \fn const T &QFutureWatcher::result() const
+/*! \fn template <typename T> const T &QFutureWatcher<T>::result() const
Returns the first result in the future(). If the result is not immediately
available, this function will block and wait for the result to become
@@ -499,7 +496,7 @@ void QFutureWatcherBasePrivate::sendCallOutEvent(QFutureCallOutEvent *event)
\sa resultAt()
*/
-/*! \fn const T &QFutureWatcher::resultAt(int index) const
+/*! \fn template <typename T> const T &QFutureWatcher<T>::resultAt(int index) const
Returns the result at \a index in the future(). If the result is not
immediately available, this function will block and wait for the result to
@@ -508,7 +505,7 @@ void QFutureWatcherBasePrivate::sendCallOutEvent(QFutureCallOutEvent *event)
\sa result()
*/
-/*! \fn void QFutureWatcher::setFuture(const QFuture<T> &future)
+/*! \fn template <typename T> void QFutureWatcher<T>::setFuture(const QFuture<T> &future)
Starts watching the given \a future.
@@ -520,44 +517,44 @@ void QFutureWatcherBasePrivate::sendCallOutEvent(QFutureCallOutEvent *event)
\e after doing the connections.
*/
-/*! \fn QFuture<T> QFutureWatcher::future() const
+/*! \fn template <typename T> QFuture<T> QFutureWatcher<T>::future() const
Returns the watched future.
*/
-/*! \fn void QFutureWatcher::started()
+/*! \fn template <typename T> void QFutureWatcher<T>::started()
This signal is emitted when this QFutureWatcher starts watching the future
set with setFuture().
*/
/*!
- \fn void QFutureWatcher::finished()
+ \fn template <typename T> void QFutureWatcher<T>::finished()
This signal is emitted when the watched future finishes.
*/
/*!
- \fn void QFutureWatcher::canceled()
+ \fn template <typename T> void QFutureWatcher<T>::canceled()
This signal is emitted if the watched future is canceled.
*/
-/*! \fn void QFutureWatcher::paused()
+/*! \fn template <typename T> void QFutureWatcher<T>::paused()
This signal is emitted when the watched future is paused.
*/
-/*! \fn void QFutureWatcher::resumed()
+/*! \fn template <typename T> void QFutureWatcher<T>::resumed()
This signal is emitted when the watched future is resumed.
*/
/*!
- \fn void QFutureWatcher::progressRangeChanged(int minimum, int maximum)
+ \fn template <typename T> void QFutureWatcher<T>::progressRangeChanged(int minimum, int maximum)
The progress range for the watched future has changed to \a minimum and
\a maximum
*/
/*!
- \fn void QFutureWatcher::progressValueChanged(int progressValue)
+ \fn template <typename T> void QFutureWatcher<T>::progressValueChanged(int progressValue)
This signal is emitted when the watched future reports progress,
\a progressValue gives the current progress. In order to avoid overloading
@@ -567,14 +564,14 @@ void QFutureWatcherBasePrivate::sendCallOutEvent(QFutureCallOutEvent *event)
\a progressValue equals the maximum value) will always be delivered.
*/
-/*! \fn void QFutureWatcher::progressTextChanged(const QString &progressText)
+/*! \fn template <typename T> void QFutureWatcher<T>::progressTextChanged(const QString &progressText)
This signal is emitted when the watched future reports textual progress
information, \a progressText.
*/
/*!
- \fn void QFutureWatcher::resultReadyAt(int index)
+ \fn template <typename T> void QFutureWatcher<T>::resultReadyAt(int index)
This signal is emitted when the watched future reports a ready result at
\a index. If the future reports multiple results, the index will indicate
@@ -583,7 +580,7 @@ void QFutureWatcherBasePrivate::sendCallOutEvent(QFutureCallOutEvent *event)
*/
/*!
- \fn void QFutureWatcher::resultsReadyAt(int beginIndex, int endIndex);
+ \fn template <typename T> void QFutureWatcher<T>::resultsReadyAt(int beginIndex, int endIndex);
This signal is emitted when the watched future reports ready results.
The results are indexed from \a beginIndex to \a endIndex.
@@ -593,5 +590,3 @@ void QFutureWatcherBasePrivate::sendCallOutEvent(QFutureCallOutEvent *event)
QT_END_NAMESPACE
#include "moc_qfuturewatcher.cpp"
-
-#endif // QT_NO_QFUTURE
diff --git a/src/corelib/thread/qfuturewatcher.h b/src/corelib/thread/qfuturewatcher.h
index 8a6716a8f7..fb7dd30499 100644
--- a/src/corelib/thread/qfuturewatcher.h
+++ b/src/corelib/thread/qfuturewatcher.h
@@ -41,11 +41,10 @@
#define QFUTUREWATCHER_H
#include <QtCore/qfuture.h>
-
-#ifndef QT_NO_QFUTURE
-
#include <QtCore/qobject.h>
+QT_REQUIRE_CONFIG(future);
+
QT_BEGIN_NAMESPACE
@@ -58,7 +57,7 @@ class Q_CORE_EXPORT QFutureWatcherBase : public QObject
Q_DECLARE_PRIVATE(QFutureWatcherBase)
public:
- explicit QFutureWatcherBase(QObject *parent = Q_NULLPTR);
+ explicit QFutureWatcherBase(QObject *parent = nullptr);
// de-inline dtor
int progressValue() const;
@@ -76,7 +75,7 @@ public:
void setPendingResultsLimit(int limit);
- bool event(QEvent *event) Q_DECL_OVERRIDE;
+ bool event(QEvent *event) override;
Q_SIGNALS:
void started();
@@ -98,8 +97,8 @@ public Q_SLOTS:
void togglePaused();
protected:
- void connectNotify (const QMetaMethod &signal) Q_DECL_OVERRIDE;
- void disconnectNotify (const QMetaMethod &signal) Q_DECL_OVERRIDE;
+ void connectNotify (const QMetaMethod &signal) override;
+ void disconnectNotify (const QMetaMethod &signal) override;
// called from setFuture() implemented in template sub-classes
void connectOutputInterface();
@@ -166,8 +165,8 @@ public Q_SLOTS:
private:
QFuture<T> m_future;
- const QFutureInterfaceBase &futureInterface() const Q_DECL_OVERRIDE { return m_future.d; }
- QFutureInterfaceBase &futureInterface() Q_DECL_OVERRIDE { return m_future.d; }
+ const QFutureInterfaceBase &futureInterface() const override { return m_future.d; }
+ QFutureInterfaceBase &futureInterface() override { return m_future.d; }
};
template <typename T>
@@ -185,7 +184,7 @@ template <>
class QFutureWatcher<void> : public QFutureWatcherBase
{
public:
- explicit QFutureWatcher(QObject *_parent = Q_NULLPTR)
+ explicit QFutureWatcher(QObject *_parent = nullptr)
: QFutureWatcherBase(_parent)
{ }
~QFutureWatcher()
@@ -197,8 +196,8 @@ public:
private:
QFuture<void> m_future;
- const QFutureInterfaceBase &futureInterface() const Q_DECL_OVERRIDE { return m_future.d; }
- QFutureInterfaceBase &futureInterface() Q_DECL_OVERRIDE { return m_future.d; }
+ const QFutureInterfaceBase &futureInterface() const override { return m_future.d; }
+ QFutureInterfaceBase &futureInterface() override { return m_future.d; }
};
Q_INLINE_TEMPLATE void QFutureWatcher<void>::setFuture(const QFuture<void> &_future)
@@ -212,6 +211,5 @@ Q_INLINE_TEMPLATE void QFutureWatcher<void>::setFuture(const QFuture<void> &_fut
}
QT_END_NAMESPACE
-#endif // QT_NO_QFUTURE
#endif // QFUTUREWATCHER_H
diff --git a/src/corelib/thread/qfuturewatcher_p.h b/src/corelib/thread/qfuturewatcher_p.h
index e83bdaf45a..ead247b040 100644
--- a/src/corelib/thread/qfuturewatcher_p.h
+++ b/src/corelib/thread/qfuturewatcher_p.h
@@ -54,10 +54,10 @@
#include "qfutureinterface_p.h"
#include <qlist.h>
-#ifndef QT_NO_QFUTURE
-
#include <private/qobject_p.h>
+QT_REQUIRE_CONFIG(future);
+
QT_BEGIN_NAMESPACE
class QFutureWatcherBase;
@@ -69,8 +69,8 @@ class QFutureWatcherBasePrivate : public QObjectPrivate,
public:
QFutureWatcherBasePrivate();
- void postCallOutEvent(const QFutureCallOutEvent &callOutEvent) Q_DECL_OVERRIDE;
- void callOutInterfaceDisconnected() Q_DECL_OVERRIDE;
+ void postCallOutEvent(const QFutureCallOutEvent &callOutEvent) override;
+ void callOutInterfaceDisconnected() override;
void sendCallOutEvent(QFutureCallOutEvent *event);
@@ -84,5 +84,4 @@ public:
QT_END_NAMESPACE
-#endif // QT_NO_QFUTURE
#endif
diff --git a/src/corelib/thread/qmutex.h b/src/corelib/thread/qmutex.h
index 3d24379fa9..3dff363541 100644
--- a/src/corelib/thread/qmutex.h
+++ b/src/corelib/thread/qmutex.h
@@ -98,16 +98,16 @@ public:
private:
inline bool fastTryLock() Q_DECL_NOTHROW {
- return d_ptr.testAndSetAcquire(Q_NULLPTR, dummyLocked());
+ return d_ptr.testAndSetAcquire(nullptr, dummyLocked());
}
inline bool fastTryUnlock() Q_DECL_NOTHROW {
- return d_ptr.testAndSetRelease(dummyLocked(), Q_NULLPTR);
+ return d_ptr.testAndSetRelease(dummyLocked(), nullptr);
}
inline bool fastTryLock(QMutexData *&current) Q_DECL_NOTHROW {
- return d_ptr.testAndSetAcquire(Q_NULLPTR, dummyLocked(), current);
+ return d_ptr.testAndSetAcquire(nullptr, dummyLocked(), current);
}
inline bool fastTryUnlock(QMutexData *&current) Q_DECL_NOTHROW {
- return d_ptr.testAndSetRelease(dummyLocked(), Q_NULLPTR, current);
+ return d_ptr.testAndSetRelease(dummyLocked(), nullptr, current);
}
void lockInternal() QT_MUTEX_LOCK_NOEXCEPT;
@@ -293,7 +293,7 @@ public:
inline void unlock() Q_DECL_NOTHROW {}
void relock() Q_DECL_NOTHROW {}
- inline QMutex *mutex() const Q_DECL_NOTHROW { return Q_NULLPTR; }
+ inline QMutex *mutex() const Q_DECL_NOTHROW { return nullptr; }
private:
Q_DISABLE_COPY(QMutexLocker)
diff --git a/src/corelib/thread/qmutex_linux.cpp b/src/corelib/thread/qmutex_linux.cpp
index 5f6e74ac6f..d3d97ea108 100644
--- a/src/corelib/thread/qmutex_linux.cpp
+++ b/src/corelib/thread/qmutex_linux.cpp
@@ -44,15 +44,9 @@
#ifndef QT_NO_THREAD
#include "qatomic.h"
#include "qmutex_p.h"
-#include "qelapsedtimer.h"
+#include "qfutex_p.h"
-#include <linux/futex.h>
-#include <sys/syscall.h>
-#include <unistd.h>
-#include <errno.h>
-#include <asm/unistd.h>
-
-#ifndef QT_LINUX_FUTEX
+#ifndef QT_ALWAYS_USE_FUTEX
# error "Qt build is broken: qmutex_linux.cpp is being built but futex support is not wanted"
#endif
@@ -63,6 +57,8 @@
QT_BEGIN_NAMESPACE
+using namespace QtFutex;
+
/*
* QBasicMutex implementation on Linux with futexes
*
@@ -107,20 +103,6 @@ QT_BEGIN_NAMESPACE
* waiting in the past. We then set the mutex to 0x0 and perform a FUTEX_WAKE.
*/
-static inline int _q_futex(void *addr, int op, int val, const struct timespec *timeout) Q_DECL_NOTHROW
-{
- volatile int *int_addr = reinterpret_cast<volatile int *>(addr);
-#if Q_BYTE_ORDER == Q_BIG_ENDIAN && QT_POINTER_SIZE == 8
- int_addr++; //We want a pointer to the 32 least significant bit of QMutex::d
-#endif
- int *addr2 = 0;
- int val2 = 0;
-
- // we use __NR_futex because some libcs (like Android's bionic) don't
- // provide SYS_futex etc.
- return syscall(__NR_futex, int_addr, op | FUTEX_PRIVATE_FLAG, val, timeout, addr2, val2);
-}
-
static inline QMutexData *dummyFutexValue()
{
return reinterpret_cast<QMutexData *>(quintptr(3));
@@ -136,36 +118,38 @@ bool lockInternal_helper(QBasicAtomicPointer<QMutexData> &d_ptr, int timeout = -
if (timeout == 0)
return false;
- struct timespec ts, *pts = 0;
- if (IsTimed && timeout > 0) {
- ts.tv_sec = timeout / 1000;
- ts.tv_nsec = (timeout % 1000) * 1000 * 1000;
- }
-
// the mutex is locked already, set a bit indicating we're waiting
- while (d_ptr.fetchAndStoreAcquire(dummyFutexValue()) != 0) {
- if (IsTimed && pts == &ts) {
- // recalculate the timeout
- qint64 xtimeout = qint64(timeout) * 1000 * 1000;
- xtimeout -= elapsedTimer->nsecsElapsed();
- if (xtimeout <= 0) {
- // timer expired after we returned
- return false;
- }
- ts.tv_sec = xtimeout / Q_INT64_C(1000) / 1000 / 1000;
- ts.tv_nsec = xtimeout % (Q_INT64_C(1000) * 1000 * 1000);
- }
- if (IsTimed && timeout > 0)
- pts = &ts;
+ if (d_ptr.fetchAndStoreAcquire(dummyFutexValue()) == nullptr)
+ return true;
+ qint64 nstimeout = timeout * Q_INT64_C(1000) * 1000;
+ qint64 remainingTime = nstimeout;
+ forever {
// successfully set the waiting bit, now sleep
- int r = _q_futex(&d_ptr, FUTEX_WAIT, quintptr(dummyFutexValue()), pts);
- if (IsTimed && r != 0 && errno == ETIMEDOUT)
- return false;
+ if (IsTimed && nstimeout >= 0) {
+ bool r = futexWait(d_ptr, dummyFutexValue(), remainingTime);
+ if (!r)
+ return false;
+
+ // we got woken up, so try to acquire the mutex
+ // note we must set to dummyFutexValue because there could be other threads
+ // also waiting
+ if (d_ptr.fetchAndStoreAcquire(dummyFutexValue()) == nullptr)
+ return true;
- // we got woken up, so try to acquire the mutex
- // note we must set to dummyFutexValue because there could be other threads
- // also waiting
+ // recalculate the timeout
+ remainingTime = nstimeout - elapsedTimer->nsecsElapsed();
+ if (remainingTime <= 0)
+ return false;
+ } else {
+ futexWait(d_ptr, dummyFutexValue());
+
+ // we got woken up, so try to acquire the mutex
+ // note we must set to dummyFutexValue because there could be other threads
+ // also waiting
+ if (d_ptr.fetchAndStoreAcquire(dummyFutexValue()) == nullptr)
+ return true;
+ }
}
Q_ASSERT(d_ptr.load());
@@ -195,10 +179,9 @@ void QBasicMutex::unlockInternal() Q_DECL_NOTHROW
Q_ASSERT(!isRecursive());
d_ptr.storeRelease(0);
- _q_futex(&d_ptr, FUTEX_WAKE, 1, 0);
+ futexWakeOne(d_ptr);
}
-
QT_END_NAMESPACE
#endif // QT_NO_THREAD
diff --git a/src/corelib/thread/qreadwritelock.h b/src/corelib/thread/qreadwritelock.h
index 777efdb3bf..ecdb98f2f5 100644
--- a/src/corelib/thread/qreadwritelock.h
+++ b/src/corelib/thread/qreadwritelock.h
@@ -205,7 +205,7 @@ public:
static inline void unlock() Q_DECL_NOTHROW { }
static inline void relock() Q_DECL_NOTHROW { }
- static inline QReadWriteLock *readWriteLock() Q_DECL_NOTHROW { return Q_NULLPTR; }
+ static inline QReadWriteLock *readWriteLock() Q_DECL_NOTHROW { return nullptr; }
private:
Q_DISABLE_COPY(QReadLocker)
@@ -219,7 +219,7 @@ public:
static inline void unlock() Q_DECL_NOTHROW { }
static inline void relock() Q_DECL_NOTHROW { }
- static inline QReadWriteLock *readWriteLock() Q_DECL_NOTHROW { return Q_NULLPTR; }
+ static inline QReadWriteLock *readWriteLock() Q_DECL_NOTHROW { return nullptr; }
private:
Q_DISABLE_COPY(QWriteLocker)
diff --git a/src/corelib/thread/qresultstore.cpp b/src/corelib/thread/qresultstore.cpp
index 9a6fcec678..e0ce1b4b78 100644
--- a/src/corelib/thread/qresultstore.cpp
+++ b/src/corelib/thread/qresultstore.cpp
@@ -39,8 +39,6 @@
#include "qresultstore.h"
-#ifndef QT_NO_QFUTURE
-
QT_BEGIN_NAMESPACE
namespace QtPrivate {
@@ -256,5 +254,3 @@ int ResultStoreBase::updateInsertIndex(int index, int _count)
} // namespace QtPrivate
QT_END_NAMESPACE
-
-#endif // QT_NO_QFUTURE
diff --git a/src/corelib/thread/qresultstore.h b/src/corelib/thread/qresultstore.h
index 6c814ef854..39f0a6d1bb 100644
--- a/src/corelib/thread/qresultstore.h
+++ b/src/corelib/thread/qresultstore.h
@@ -40,13 +40,11 @@
#ifndef QTCORE_RESULTSTORE_H
#define QTCORE_RESULTSTORE_H
-#include <QtCore/qglobal.h>
-
-#ifndef QT_NO_QFUTURE
-
#include <QtCore/qmap.h>
#include <QtCore/qdebug.h>
+QT_REQUIRE_CONFIG(future);
+
QT_BEGIN_NAMESPACE
@@ -67,8 +65,8 @@ class ResultItem
public:
ResultItem(const void *_result, int _count) : m_count(_count), result(_result) { } // contruct with vector of results
ResultItem(const void *_result) : m_count(0), result(_result) { } // construct with result
- ResultItem() : m_count(0), result(Q_NULLPTR) { }
- bool isValid() const { return result != Q_NULLPTR; }
+ ResultItem() : m_count(0), result(nullptr) { }
+ bool isValid() const { return result != nullptr; }
bool isVector() const { return m_count != 0; }
int count() const { return (m_count == 0) ? 1 : m_count; }
int m_count; // result is either a pointer to a result or to a vector of results,
@@ -202,6 +200,4 @@ Q_DECLARE_TYPEINFO(QtPrivate::ResultItem, Q_PRIMITIVE_TYPE);
QT_END_NAMESPACE
-#endif // QT_NO_QFUTURE
-
#endif
diff --git a/src/corelib/thread/qsemaphore.cpp b/src/corelib/thread/qsemaphore.cpp
index 37736b3960..012628ef63 100644
--- a/src/corelib/thread/qsemaphore.cpp
+++ b/src/corelib/thread/qsemaphore.cpp
@@ -1,6 +1,7 @@
/****************************************************************************
**
-** Copyright (C) 2016 The Qt Company Ltd.
+** Copyright (C) 2017 The Qt Company Ltd.
+** Copyright (C) 2017 Intel Corporation.
** Contact: https://www.qt.io/licensing/
**
** This file is part of the QtCore module of the Qt Toolkit.
@@ -41,12 +42,15 @@
#ifndef QT_NO_THREAD
#include "qmutex.h"
+#include "qfutex_p.h"
#include "qwaitcondition.h"
#include "qdeadlinetimer.h"
#include "qdatetime.h"
QT_BEGIN_NAMESPACE
+using namespace QtFutex;
+
/*!
\class QSemaphore
\inmodule QtCore
@@ -97,6 +101,117 @@ QT_BEGIN_NAMESPACE
\sa QSemaphoreReleaser, QMutex, QWaitCondition, QThread, {Semaphores Example}
*/
+/*
+ QSemaphore futex operation
+
+ QSemaphore stores a 32-bit integer with the counter of currently available
+ tokens (value between 0 and INT_MAX). When a thread attempts to acquire n
+ tokens and the counter is larger than that, we perform a compare-and-swap
+ with the new count. If that succeeds, the acquisition worked; if not, we
+ loop again because the counter changed. If there were not enough tokens,
+ we'll perform a futex-wait.
+
+ Before we do, we set the high bit in the futex to indicate that semaphore
+ is contended: that is, there's a thread waiting for more tokens. On
+ release() for n tokens, we perform a fetch-and-add of n and then check if
+ that high bit was set. If it was, then we clear that bit and perform a
+ futex-wake on the semaphore to indicate the waiting threads can wake up and
+ acquire tokens. Which ones get woken up is unspecified.
+
+ If the system has the ability to wake up a precise number of threads, has
+ Linux's FUTEX_WAKE_OP functionality, and is 64-bit, we'll use the high word
+ as a copy of the low word, but the sign bit indicating the presence of a
+ thread waiting for multiple tokens. So when releasing n tokens on those
+ systems, we tell the kernel to wake up n single-token threads and all of
+ the multi-token ones, then clear that wait bit. Which threads get woken up
+ is unspecified, but it's likely single-token threads will get woken up
+ first.
+ */
+static const quint32 futexContendedBit = 1U << 31;
+
+static int futexAvailCounter(quintptr v)
+{
+ // the low 31 bits
+ return int(v & (futexContendedBit - 1));
+}
+
+static quintptr futexCounterParcel(int n)
+{
+ // replicate the 31 bits if we're on 64-bit
+ quint64 nn = quint32(n);
+ nn |= (nn << 32);
+ return quintptr(nn);
+}
+
+static QBasicAtomicInteger<quint32> *futexLow32(QBasicAtomicInteger<quintptr> *ptr)
+{
+ auto result = reinterpret_cast<QBasicAtomicInteger<quint32> *>(ptr);
+#if Q_BYTE_ORDER == Q_BIG_ENDIAN && QT_POINTER_SIZE > 4
+ ++result;
+#endif
+ return result;
+}
+
+#ifdef FUTEX_OP
+// quintptr might be 32bit, in which case we want this to be 0, without implicitly casting.
+static const quintptr futexMultiWaiterBit = static_cast<quintptr>(Q_UINT64_C(1) << 63);
+static QBasicAtomicInteger<quint32> *futexHigh32(QBasicAtomicInteger<quintptr> *ptr)
+{
+ auto result = reinterpret_cast<QBasicAtomicInteger<quint32> *>(ptr);
+#if Q_BYTE_ORDER == Q_LITTLE_ENDIAN && QT_POINTER_SIZE > 4
+ ++result;
+#endif
+ return result;
+}
+#endif
+
+template <bool IsTimed> bool futexSemaphoreTryAcquire(QBasicAtomicInteger<quintptr> &u, int n, int timeout)
+{
+ QDeadlineTimer timer(IsTimed ? QDeadlineTimer(timeout) : QDeadlineTimer());
+ quintptr curValue = u.loadAcquire();
+ qint64 remainingTime = timeout * Q_INT64_C(1000) * 1000;
+ forever {
+ int available = futexAvailCounter(curValue);
+ if (available >= n) {
+ // try to acquire
+ quintptr newValue = curValue - futexCounterParcel(n);
+ if (u.testAndSetOrdered(curValue, newValue, curValue))
+ return true; // succeeded!
+ continue;
+ }
+
+ // not enough tokens available, put us to wait
+ if (remainingTime == 0)
+ return false;
+
+ // set the contended and multi-wait bits
+ quintptr bitsToSet = futexContendedBit;
+ auto ptr = futexLow32(&u);
+#ifdef FUTEX_OP
+ if (n > 1 && sizeof(curValue) >= sizeof(int)) {
+ bitsToSet |= futexMultiWaiterBit;
+ ptr = futexHigh32(&u);
+ }
+#endif
+
+ // the value is the same for either branch
+ u.fetchAndOrRelaxed(bitsToSet);
+ curValue |= bitsToSet;
+
+ if (IsTimed && remainingTime > 0) {
+ bool timedout = !futexWait(*ptr, curValue, remainingTime);
+ if (timedout)
+ return false;
+ } else {
+ futexWait(*ptr, curValue);
+ }
+
+ curValue = u.loadAcquire();
+ if (IsTimed)
+ remainingTime = timer.remainingTimeNSecs();
+ }
+}
+
class QSemaphorePrivate {
public:
inline QSemaphorePrivate(int n) : avail(n) { }
@@ -116,7 +231,10 @@ public:
QSemaphore::QSemaphore(int n)
{
Q_ASSERT_X(n >= 0, "QSemaphore", "parameter 'n' must be non-negative");
- d = new QSemaphorePrivate(n);
+ if (futexAvailable())
+ u.store(n);
+ else
+ d = new QSemaphorePrivate(n);
}
/*!
@@ -126,7 +244,10 @@ QSemaphore::QSemaphore(int n)
undefined behavior.
*/
QSemaphore::~QSemaphore()
-{ delete d; }
+{
+ if (!futexAvailable())
+ delete d;
+}
/*!
Tries to acquire \c n resources guarded by the semaphore. If \a n
@@ -138,6 +259,12 @@ QSemaphore::~QSemaphore()
void QSemaphore::acquire(int n)
{
Q_ASSERT_X(n >= 0, "QSemaphore::acquire", "parameter 'n' must be non-negative");
+
+ if (futexAvailable()) {
+ futexSemaphoreTryAcquire<false>(u, n, -1);
+ return;
+ }
+
QMutexLocker locker(&d->mutex);
while (n > d->avail)
d->cond.wait(locker.mutex());
@@ -160,6 +287,69 @@ void QSemaphore::acquire(int n)
void QSemaphore::release(int n)
{
Q_ASSERT_X(n >= 0, "QSemaphore::release", "parameter 'n' must be non-negative");
+
+ if (futexAvailable()) {
+ quintptr prevValue = u.fetchAndAddRelease(futexCounterParcel(n));
+ if (prevValue & futexContendedBit) {
+#ifdef FUTEX_OP
+ if (sizeof(u) == sizeof(int)) {
+ /*
+ On 32-bit systems, all waiters are waiting on the same address,
+ so we'll wake them all and ask the kernel to clear the high bit.
+
+ atomic {
+ int oldval = u;
+ u = oldval & ~(1 << 31);
+ futexWake(u, INT_MAX);
+ if (oldval == 0) // impossible condition
+ futexWake(u, INT_MAX);
+ }
+ */
+ quint32 op = FUTEX_OP_ANDN | FUTEX_OP_OPARG_SHIFT;
+ quint32 oparg = 31;
+ quint32 cmp = FUTEX_OP_CMP_EQ;
+ quint32 cmparg = 0;
+ futexWakeOp(u, INT_MAX, INT_MAX, u, FUTEX_OP(op, oparg, cmp, cmparg));
+ } else {
+ /*
+ On 64-bit systems, the single-token waiters wait on the low half
+ and the multi-token waiters wait on the upper half. So we ask
+ the kernel to wake up n single-token waiters and all multi-token
+ waiters (if any), then clear the multi-token wait bit.
+
+ That means we must clear the contention bit ourselves. See
+ below for handling the race.
+
+ atomic {
+ int oldval = *upper;
+ *upper = oldval & ~(1 << 31);
+ futexWake(lower, n);
+ if (oldval < 0) // sign bit set
+ futexWake(upper, INT_MAX);
+ }
+ */
+ quint32 op = FUTEX_OP_ANDN | FUTEX_OP_OPARG_SHIFT;
+ quint32 oparg = 31;
+ quint32 cmp = FUTEX_OP_CMP_LT;
+ quint32 cmparg = 0;
+ futexLow32(&u)->fetchAndAndRelease(futexContendedBit - 1);
+ futexWakeOp(*futexLow32(&u), n, INT_MAX, *futexHigh32(&u), FUTEX_OP(op, oparg, cmp, cmparg));
+ }
+#else
+ // Unset the bit and wake everyone. There are two possibibilies
+ // under which a thread can set the bit between the AND and the
+ // futexWake:
+ // 1) it did see the new counter value, but it wasn't enough for
+ // its acquisition anyway, so it has to wait;
+ // 2) it did not see the new counter value, in which case its
+ // futexWait will fail.
+ u.fetchAndAndRelease(futexContendedBit - 1);
+ futexWakeAll(u);
+#endif
+ }
+ return;
+ }
+
QMutexLocker locker(&d->mutex);
d->avail += n;
d->cond.wakeAll();
@@ -173,6 +363,9 @@ void QSemaphore::release(int n)
*/
int QSemaphore::available() const
{
+ if (futexAvailable())
+ return futexAvailCounter(u.load());
+
QMutexLocker locker(&d->mutex);
return d->avail;
}
@@ -191,6 +384,10 @@ int QSemaphore::available() const
bool QSemaphore::tryAcquire(int n)
{
Q_ASSERT_X(n >= 0, "QSemaphore::tryAcquire", "parameter 'n' must be non-negative");
+
+ if (futexAvailable())
+ return futexSemaphoreTryAcquire<false>(u, n, 0);
+
QMutexLocker locker(&d->mutex);
if (n > d->avail)
return false;
@@ -222,6 +419,9 @@ bool QSemaphore::tryAcquire(int n, int timeout)
// but QDeadlineTimer only accepts -1.
timeout = qMax(timeout, -1);
+ if (futexAvailable())
+ return futexSemaphoreTryAcquire<true>(u, n, timeout);
+
QDeadlineTimer timer(timeout);
QMutexLocker locker(&d->mutex);
qint64 remainingTime = timer.remainingTime();
diff --git a/src/corelib/thread/qsemaphore.h b/src/corelib/thread/qsemaphore.h
index 9de23173e8..2639085e99 100644
--- a/src/corelib/thread/qsemaphore.h
+++ b/src/corelib/thread/qsemaphore.h
@@ -66,7 +66,10 @@ public:
private:
Q_DISABLE_COPY(QSemaphore)
- QSemaphorePrivate *d;
+ union {
+ QSemaphorePrivate *d;
+ QBasicAtomicInteger<quintptr> u; // ### Qt6: make 64-bit
+ };
};
class QSemaphoreReleaser
diff --git a/src/corelib/thread/qthread.cpp b/src/corelib/thread/qthread.cpp
index cad7a14017..adff853669 100644
--- a/src/corelib/thread/qthread.cpp
+++ b/src/corelib/thread/qthread.cpp
@@ -844,15 +844,17 @@ bool QThread::event(QEvent *event)
void QThread::requestInterruption()
{
- Q_D(QThread);
- QMutexLocker locker(&d->mutex);
- if (!d->running || d->finished || d->isInFinish)
- return;
if (this == QCoreApplicationPrivate::theMainThread) {
qWarning("QThread::requestInterruption has no effect on the main thread");
return;
}
- d->interruptionRequested = true;
+ Q_D(QThread);
+ // ### Qt 6: use std::atomic_flag, and document that
+ // requestInterruption/isInterruptionRequested do not synchronize with each other
+ QMutexLocker locker(&d->mutex);
+ if (!d->running || d->finished || d->isInFinish)
+ return;
+ d->interruptionRequested.store(true, std::memory_order_relaxed);
}
/*!
@@ -881,10 +883,12 @@ void QThread::requestInterruption()
bool QThread::isInterruptionRequested() const
{
Q_D(const QThread);
- QMutexLocker locker(&d->mutex);
- if (!d->running || d->finished || d->isInFinish)
+ // fast path: check that the flag is not set:
+ if (!d->interruptionRequested.load(std::memory_order_relaxed))
return false;
- return d->interruptionRequested;
+ // slow path: if the flag is set, take into account run status:
+ QMutexLocker locker(&d->mutex);
+ return d->running && !d->finished && !d->isInFinish;
}
/*
diff --git a/src/corelib/thread/qthread.h b/src/corelib/thread/qthread.h
index 03b5424bb6..1f98cb59af 100644
--- a/src/corelib/thread/qthread.h
+++ b/src/corelib/thread/qthread.h
@@ -76,7 +76,7 @@ public:
static int idealThreadCount() Q_DECL_NOTHROW;
static void yieldCurrentThread();
- explicit QThread(QObject *parent = Q_NULLPTR);
+ explicit QThread(QObject *parent = nullptr);
~QThread();
enum Priority {
@@ -110,7 +110,7 @@ public:
QAbstractEventDispatcher *eventDispatcher() const;
void setEventDispatcher(QAbstractEventDispatcher *eventDispatcher);
- bool event(QEvent *event) Q_DECL_OVERRIDE;
+ bool event(QEvent *event) override;
int loopLevel() const;
#ifdef Q_QDOC
@@ -154,7 +154,7 @@ protected:
static void setTerminationEnabled(bool enabled = true);
protected:
- QThread(QThreadPrivate &dd, QObject *parent = Q_NULLPTR);
+ QThread(QThreadPrivate &dd, QObject *parent = nullptr);
private:
Q_DECLARE_PRIVATE(QThread)
diff --git a/src/corelib/thread/qthread_p.h b/src/corelib/thread/qthread_p.h
index f3d4750177..baeefd87ff 100644
--- a/src/corelib/thread/qthread_p.h
+++ b/src/corelib/thread/qthread_p.h
@@ -63,6 +63,7 @@
#include "private/qobject_p.h"
#include <algorithm>
+#include <atomic>
#ifdef Q_OS_WINRT
namespace ABI {
@@ -165,7 +166,7 @@ public:
bool running;
bool finished;
bool isInFinish; //when in QThreadPrivate::finish
- bool interruptionRequested;
+ std::atomic<bool> interruptionRequested;
bool exited;
int returnCode;
@@ -317,7 +318,7 @@ public:
void init();
private:
- void run() Q_DECL_OVERRIDE;
+ void run() override;
};
QT_END_NAMESPACE
diff --git a/src/corelib/thread/qthread_unix.cpp b/src/corelib/thread/qthread_unix.cpp
index 6540f02f34..fb5c9fd770 100644
--- a/src/corelib/thread/qthread_unix.cpp
+++ b/src/corelib/thread/qthread_unix.cpp
@@ -109,6 +109,10 @@
#define QT_HAS_THREAD_PRIORITY_SCHEDULING
#endif
+#if defined(Q_OS_QNX)
+#include <sys/neutrino.h>
+#endif
+
QT_BEGIN_NAMESPACE
@@ -487,9 +491,6 @@ int QThread::idealThreadCount() Q_DECL_NOTHROW
if (sysctl(mib, 2, &cores, &len, NULL, 0) != 0) {
perror("sysctl");
}
-#elif defined(Q_OS_IRIX)
- // IRIX
- cores = (int)sysconf(_SC_NPROC_ONLN);
#elif defined(Q_OS_INTEGRITY)
#if (__INTEGRITY_MAJOR_VERSION >= 10)
// Integrity V10+ does support multicore CPUs
@@ -555,6 +556,55 @@ void QThread::usleep(unsigned long usecs)
}
#ifdef QT_HAS_THREAD_PRIORITY_SCHEDULING
+#if defined(Q_OS_QNX)
+static bool calculateUnixPriority(int priority, int *sched_policy, int *sched_priority)
+{
+ // On QNX, NormalPriority is mapped to 10. A QNX system could use a value different
+ // than 10 for the "normal" priority but it's difficult to achieve this so we'll
+ // assume that no one has ever created such a system. This makes the mapping from
+ // Qt priorities to QNX priorities lopsided. There's usually more space available
+ // to map into above the "normal" priority than below it. QNX also has a privileged
+ // priority range (for threads that assist the kernel). We'll assume that no Qt
+ // thread needs to use priorities in that range.
+ int priority_norm = 10;
+ // _sched_info::priority_priv isn't documented. You'd think that it's the start of the
+ // privileged priority range but it's actually the end of the unpriviledged range.
+ struct _sched_info info;
+ if (SchedInfo_r(0, *sched_policy, &info) != EOK)
+ return false;
+
+ if (priority == QThread::IdlePriority) {
+ *sched_priority = info.priority_min;
+ return true;
+ }
+
+ if (priority_norm < info.priority_min)
+ priority_norm = info.priority_min;
+ if (priority_norm > info.priority_priv)
+ priority_norm = info.priority_priv;
+
+ int to_min, to_max;
+ int from_min, from_max;
+ int prio;
+ if (priority < QThread::NormalPriority) {
+ to_min = info.priority_min;
+ to_max = priority_norm;
+ from_min = QThread::LowestPriority;
+ from_max = QThread::NormalPriority;
+ } else {
+ to_min = priority_norm;
+ to_max = info.priority_priv;
+ from_min = QThread::NormalPriority;
+ from_max = QThread::TimeCriticalPriority;
+ }
+
+ prio = ((priority - from_min) * (to_max - to_min)) / (from_max - from_min) + to_min;
+ prio = qBound(to_min, prio, to_max);
+
+ *sched_priority = prio;
+ return true;
+}
+#else
// Does some magic and calculate the Unix scheduler priorities
// sched_policy is IN/OUT: it must be set to a valid policy before calling this function
// sched_priority is OUT only
@@ -598,6 +648,7 @@ static bool calculateUnixPriority(int priority, int *sched_policy, int *sched_pr
return true;
}
#endif
+#endif
void QThread::start(Priority priority)
{
diff --git a/src/corelib/thread/qthreadpool.cpp b/src/corelib/thread/qthreadpool.cpp
index 8eca3b56e4..157cbeaf4d 100644
--- a/src/corelib/thread/qthreadpool.cpp
+++ b/src/corelib/thread/qthreadpool.cpp
@@ -56,7 +56,7 @@ class QThreadPoolThread : public QThread
{
public:
QThreadPoolThread(QThreadPoolPrivate *manager);
- void run() Q_DECL_OVERRIDE;
+ void run() override;
void registerThreadInactive();
QWaitCondition runnableReady;
diff --git a/src/corelib/thread/qthreadpool.h b/src/corelib/thread/qthreadpool.h
index a65eacc996..606e192768 100644
--- a/src/corelib/thread/qthreadpool.h
+++ b/src/corelib/thread/qthreadpool.h
@@ -62,7 +62,7 @@ class Q_CORE_EXPORT QThreadPool : public QObject
friend class QFutureInterfaceBase;
public:
- QThreadPool(QObject *parent = Q_NULLPTR);
+ QThreadPool(QObject *parent = nullptr);
~QThreadPool();
static QThreadPool *globalInstance();
diff --git a/src/corelib/thread/thread.pri b/src/corelib/thread/thread.pri
index 0a989cfcaf..e4972a57b3 100644
--- a/src/corelib/thread/thread.pri
+++ b/src/corelib/thread/thread.pri
@@ -10,30 +10,19 @@ HEADERS += thread/qmutex.h \
thread/qthreadstorage.h \
thread/qwaitcondition.h \
thread/qatomic.h \
- thread/qexception.h \
- thread/qresultstore.h \
- thread/qfuture.h \
- thread/qfutureinterface.h \
- thread/qfuturesynchronizer.h \
- thread/qfuturewatcher.h \
thread/qbasicatomic.h \
thread/qgenericatomic.h
# private headers
HEADERS += thread/qmutex_p.h \
thread/qmutexpool_p.h \
- thread/qfutureinterface_p.h \
- thread/qfuturewatcher_p.h \
+ thread/qfutex_p.h \
thread/qorderedmutexlocker_p.h \
thread/qreadwritelock_p.h \
thread/qthread_p.h \
thread/qthreadpool_p.h
SOURCES += thread/qatomic.cpp \
- thread/qexception.cpp \
- thread/qresultstore.cpp \
- thread/qfutureinterface.cpp \
- thread/qfuturewatcher.cpp \
thread/qmutex.cpp \
thread/qreadwritelock.cpp \
thread/qrunnable.cpp \
@@ -43,6 +32,24 @@ SOURCES += thread/qatomic.cpp \
thread/qthreadpool.cpp \
thread/qthreadstorage.cpp
+qtConfig(future) {
+ HEADERS += \
+ thread/qexception.h \
+ thread/qfuture.h \
+ thread/qfutureinterface.h \
+ thread/qfutureinterface_p.h \
+ thread/qfuturesynchronizer.h \
+ thread/qfuturewatcher.h \
+ thread/qfuturewatcher_p.h \
+ thread/qresultstore.h
+
+ SOURCES += \
+ thread/qexception.cpp \
+ thread/qfutureinterface.cpp \
+ thread/qfuturewatcher.cpp \
+ thread/qresultstore.cpp
+}
+
win32 {
SOURCES += \
thread/qmutex_win.cpp \
diff --git a/src/corelib/tools/qalgorithms.qdoc b/src/corelib/tools/qalgorithms.qdoc
index 096ede2fec..f0ac2701e7 100644
--- a/src/corelib/tools/qalgorithms.qdoc
+++ b/src/corelib/tools/qalgorithms.qdoc
@@ -228,7 +228,7 @@
\sa {container classes}, <QtGlobal>
*/
-/*! \fn OutputIterator qCopy(InputIterator begin1, InputIterator end1, OutputIterator begin2)
+/*! \fn template <typename InputIterator, typename OutputIterator> OutputIterator qCopy(InputIterator begin1, InputIterator end1, OutputIterator begin2)
\relates <QtAlgorithms>
\deprecated
@@ -247,7 +247,7 @@
\sa qCopyBackward(), {input iterators}, {output iterators}
*/
-/*! \fn BiIterator2 qCopyBackward(BiIterator1 begin1, BiIterator1 end1, BiIterator2 end2)
+/*! \fn template <typename BiIterator1, typename BiIterator2> BiIterator2 qCopyBackward(BiIterator1 begin1, BiIterator1 end1, BiIterator2 end2)
\relates <QtAlgorithms>
\deprecated
@@ -266,7 +266,7 @@
\sa qCopy(), {bidirectional iterators}
*/
-/*! \fn bool qEqual(InputIterator1 begin1, InputIterator1 end1, InputIterator2 begin2)
+/*! \fn template <typename InputIterator1, typename InputIterator2> bool qEqual(InputIterator1 begin1, InputIterator1 end1, InputIterator2 begin2)
\relates <QtAlgorithms>
\deprecated
@@ -285,7 +285,7 @@
\sa {input iterators}
*/
-/*! \fn void qFill(ForwardIterator begin, ForwardIterator end, const T &value)
+/*! \fn template <typename ForwardIterator, typename T> void qFill(ForwardIterator begin, ForwardIterator end, const T &value)
\relates <QtAlgorithms>
\deprecated
@@ -299,7 +299,7 @@
\sa qCopy(), {forward iterators}
*/
-/*! \fn void qFill(Container &container, const T &value)
+/*! \fn template <typename Container, typename T> void qFill(Container &container, const T &value)
\relates <QtAlgorithms>
\deprecated
\overload
@@ -309,7 +309,7 @@
This is the same as qFill(\a{container}.begin(), \a{container}.end(), \a value);
*/
-/*! \fn InputIterator qFind(InputIterator begin, InputIterator end, const T &value)
+/*! \fn template <typename InputIterator, typename T> InputIterator qFind(InputIterator begin, InputIterator end, const T &value)
\relates <QtAlgorithms>
\deprecated
@@ -332,7 +332,7 @@
\sa qBinaryFind(), {input iterators}
*/
-/*! \fn void qFind(const Container &container, const T &value)
+/*! \fn template <typename Container, typename T> void qFind(const Container &container, const T &value)
\relates <QtAlgorithms>
\deprecated
\overload
@@ -342,7 +342,7 @@
This is the same as qFind(\a{container}.constBegin(), \a{container}.constEnd(), \a value);
*/
-/*! \fn void qCount(InputIterator begin, InputIterator end, const T &value, Size &n)
+/*! \fn template <typename InputIterator, typename T, typename Size> void qCount(InputIterator begin, InputIterator end, const T &value, Size &n)
\relates <QtAlgorithms>
\deprecated
@@ -362,7 +362,7 @@
\sa {input iterators}
*/
-/*! \fn void qCount(const Container &container, const T &value, Size &n)
+/*! \fn template <typename Container, typename T, typename Size> void qCount(const Container &container, const T &value, Size &n)
\relates <QtAlgorithms>
\deprecated
\overload
@@ -374,7 +374,7 @@
of \a value in the variable passed as a reference in argument \a n.
*/
-/*! \fn void qSwap(T &var1, T &var2)
+/*! \fn template <typename T> void qSwap(T &var1, T &var2)
\relates <QtAlgorithms>
\deprecated
@@ -386,7 +386,7 @@
\snippet code/doc_src_qalgorithms.cpp 10
*/
-/*! \fn void qSort(RandomAccessIterator begin, RandomAccessIterator end)
+/*! \fn template <typename RandomAccessIterator> void qSort(RandomAccessIterator begin, RandomAccessIterator end)
\relates <QtAlgorithms>
\deprecated
@@ -411,7 +411,7 @@
\sa qStableSort(), {random access iterators}
*/
-/*! \fn void qSort(RandomAccessIterator begin, RandomAccessIterator end, LessThan lessThan)
+/*! \fn template <typename RandomAccessIterator, typename LessThan> void qSort(RandomAccessIterator begin, RandomAccessIterator end, LessThan lessThan)
\relates <QtAlgorithms>
\deprecated
\overload
@@ -447,7 +447,7 @@
\sa QMap
*/
-/*! \fn void qSort(Container &container)
+/*! \fn template<typename Container> void qSort(Container &container)
\relates <QtAlgorithms>
\deprecated
\overload
@@ -458,7 +458,7 @@
*/
/*!
- \fn void qStableSort(RandomAccessIterator begin, RandomAccessIterator end)
+ \fn template <typename RandomAccessIterator> void qStableSort(RandomAccessIterator begin, RandomAccessIterator end)
\relates <QtAlgorithms>
\deprecated
@@ -485,7 +485,7 @@
*/
/*!
- \fn void qStableSort(RandomAccessIterator begin, RandomAccessIterator end, LessThan lessThan)
+ \fn template <typename RandomAccessIterator, typename LessThan> void qStableSort(RandomAccessIterator begin, RandomAccessIterator end, LessThan lessThan)
\relates <QtAlgorithms>
\deprecated
\overload
@@ -517,7 +517,7 @@
*/
/*!
- \fn void qStableSort(Container &container)
+ \fn template <typename Container> void qStableSort(Container &container)
\relates <QtAlgorithms>
\deprecated
\overload
@@ -527,7 +527,7 @@
This is the same as qStableSort(\a{container}.begin(), \a{container}.end());
*/
-/*! \fn RandomAccessIterator qLowerBound(RandomAccessIterator begin, RandomAccessIterator end, const T &value)
+/*! \fn template <typename RandomAccessIterator, typename T> RandomAccessIterator qLowerBound(RandomAccessIterator begin, RandomAccessIterator end, const T &value)
\relates <QtAlgorithms>
\deprecated
@@ -556,7 +556,7 @@
*/
/*!
- \fn RandomAccessIterator qLowerBound(RandomAccessIterator begin, RandomAccessIterator end, const T &value, LessThan lessThan)
+ \fn template <typename RandomAccessIterator, typename T, typename LessThan> RandomAccessIterator qLowerBound(RandomAccessIterator begin, RandomAccessIterator end, const T &value, LessThan lessThan)
\relates <QtAlgorithms>
\deprecated
\overload
@@ -571,7 +571,7 @@
*/
/*!
- \fn void qLowerBound(const Container &container, const T &value)
+ \fn template <typename Container, typename T> void qLowerBound(const Container &container, const T &value)
\relates <QtAlgorithms>
\deprecated
\overload
@@ -584,7 +584,7 @@
to insert items.
*/
-/*! \fn RandomAccessIterator qUpperBound(RandomAccessIterator begin, RandomAccessIterator end, const T &value)
+/*! \fn template <typename RandomAccessIterator, typename T> RandomAccessIterator qUpperBound(RandomAccessIterator begin, RandomAccessIterator end, const T &value)
\relates <QtAlgorithms>
\deprecated
@@ -613,7 +613,7 @@
*/
/*!
- \fn RandomAccessIterator qUpperBound(RandomAccessIterator begin, RandomAccessIterator end, const T &value, LessThan lessThan)
+ \fn template <typename RandomAccessIterator, typename T, typename LessThan> RandomAccessIterator qUpperBound(RandomAccessIterator begin, RandomAccessIterator end, const T &value, LessThan lessThan)
\relates <QtAlgorithms>
\deprecated
\overload
@@ -628,7 +628,7 @@
*/
/*!
- \fn void qUpperBound(const Container &container, const T &value)
+ \fn template <typename Container, typename T> void qUpperBound(const Container &container, const T &value)
\relates <QtAlgorithms>
\deprecated
\overload
@@ -639,7 +639,7 @@
*/
-/*! \fn RandomAccessIterator qBinaryFind(RandomAccessIterator begin, RandomAccessIterator end, const T &value)
+/*! \fn template <typename RandomAccessIterator, typename T> RandomAccessIterator qBinaryFind(RandomAccessIterator begin, RandomAccessIterator end, const T &value)
\relates <QtAlgorithms>
\deprecated
@@ -665,7 +665,7 @@
\sa qLowerBound(), qUpperBound(), {random access iterators}
*/
-/*! \fn RandomAccessIterator qBinaryFind(RandomAccessIterator begin, RandomAccessIterator end, const T &value, LessThan lessThan)
+/*! \fn template <typename RandomAccessIterator, typename T, typename LessThan> RandomAccessIterator qBinaryFind(RandomAccessIterator begin, RandomAccessIterator end, const T &value, LessThan lessThan)
\relates <QtAlgorithms>
\deprecated
\overload
@@ -680,7 +680,7 @@
*/
/*!
- \fn void qBinaryFind(const Container &container, const T &value)
+ \fn template <typename Container, typename T> void qBinaryFind(const Container &container, const T &value)
\relates <QtAlgorithms>
\deprecated
\overload
@@ -692,7 +692,7 @@
/*!
- \fn void qDeleteAll(ForwardIterator begin, ForwardIterator end)
+ \fn template <typename ForwardIterator> void qDeleteAll(ForwardIterator begin, ForwardIterator end)
\relates <QtAlgorithms>
Deletes all the items in the range [\a begin, \a end) using the
@@ -715,7 +715,7 @@
*/
/*!
- \fn void qDeleteAll(const Container &c)
+ \fn template <typename Container> void qDeleteAll(const Container &c)
\relates <QtAlgorithms>
\overload
@@ -723,7 +723,7 @@
This is the same as qDeleteAll(\a{c}.begin(), \a{c}.end()).
*/
-/*! \fn LessThan qLess()
+/*! \fn template <typename LessThan> LessThan qLess()
\relates <QtAlgorithms>
\deprecated
@@ -739,7 +739,7 @@
\sa {qGreater()}{qGreater<T>()}
*/
-/*! \fn LessThan qGreater()
+/*! \fn template <typename LessThan> LessThan qGreater()
\relates <QtAlgorithms>
\deprecated
diff --git a/src/corelib/tools/qarraydata.h b/src/corelib/tools/qarraydata.h
index 88f0cfb0ea..f0cc56e899 100644
--- a/src/corelib/tools/qarraydata.h
+++ b/src/corelib/tools/qarraydata.h
@@ -139,7 +139,7 @@ struct QTypedArrayData
typedef T *pointer;
typedef T &reference;
- inline iterator() : i(Q_NULLPTR) {}
+ inline iterator() : i(nullptr) {}
inline iterator(T *n) : i(n) {}
inline iterator(const iterator &o): i(o.i){} // #### Qt 6: remove, the implicit version is fine
inline T &operator*() const { return *i; }
@@ -173,7 +173,7 @@ struct QTypedArrayData
typedef const T *pointer;
typedef const T &reference;
- inline const_iterator() : i(Q_NULLPTR) {}
+ inline const_iterator() : i(nullptr) {}
inline const_iterator(const T *n) : i(n) {}
inline const_iterator(const const_iterator &o): i(o.i) {} // #### Qt 6: remove, the default version is fine
inline explicit const_iterator(const iterator &o): i(o.i) {}
diff --git a/src/corelib/tools/qbytearray.h b/src/corelib/tools/qbytearray.h
index 732d3afc17..300f795469 100644
--- a/src/corelib/tools/qbytearray.h
+++ b/src/corelib/tools/qbytearray.h
@@ -340,16 +340,16 @@ public:
inline QT_ASCII_CAST_WARN bool operator>=(const QString &s2) const;
#endif
- short toShort(bool *ok = Q_NULLPTR, int base = 10) const;
- ushort toUShort(bool *ok = Q_NULLPTR, int base = 10) const;
- int toInt(bool *ok = Q_NULLPTR, int base = 10) const;
- uint toUInt(bool *ok = Q_NULLPTR, int base = 10) const;
- long toLong(bool *ok = Q_NULLPTR, int base = 10) const;
- ulong toULong(bool *ok = Q_NULLPTR, int base = 10) const;
- qlonglong toLongLong(bool *ok = Q_NULLPTR, int base = 10) const;
- qulonglong toULongLong(bool *ok = Q_NULLPTR, int base = 10) const;
- float toFloat(bool *ok = Q_NULLPTR) const;
- double toDouble(bool *ok = Q_NULLPTR) const;
+ short toShort(bool *ok = nullptr, int base = 10) const;
+ ushort toUShort(bool *ok = nullptr, int base = 10) const;
+ int toInt(bool *ok = nullptr, int base = 10) const;
+ uint toUInt(bool *ok = nullptr, int base = 10) const;
+ long toLong(bool *ok = nullptr, int base = 10) const;
+ ulong toULong(bool *ok = nullptr, int base = 10) const;
+ qlonglong toLongLong(bool *ok = nullptr, int base = 10) const;
+ qulonglong toULongLong(bool *ok = nullptr, int base = 10) const;
+ float toFloat(bool *ok = nullptr) const;
+ double toDouble(bool *ok = nullptr) const;
QByteArray toBase64(Base64Options options) const;
QByteArray toBase64() const; // ### Qt6 merge with previous
QByteArray toHex() const;
diff --git a/src/corelib/tools/qbytearraylist.h b/src/corelib/tools/qbytearraylist.h
index 501bb2e0d5..ed014dd157 100644
--- a/src/corelib/tools/qbytearraylist.h
+++ b/src/corelib/tools/qbytearraylist.h
@@ -70,7 +70,7 @@ protected:
#endif
public:
inline QByteArray join() const
- { return QtPrivate::QByteArrayList_join(self(), Q_NULLPTR, 0); }
+ { return QtPrivate::QByteArrayList_join(self(), nullptr, 0); }
inline QByteArray join(const QByteArray &sep) const
{ return QtPrivate::QByteArrayList_join(self(), sep.constData(), sep.size()); }
inline QByteArray join(char sep) const
diff --git a/src/corelib/tools/qbytearraymatcher.cpp b/src/corelib/tools/qbytearraymatcher.cpp
index 76af726ef9..252545c782 100644
--- a/src/corelib/tools/qbytearraymatcher.cpp
+++ b/src/corelib/tools/qbytearraymatcher.cpp
@@ -415,7 +415,7 @@ int QStaticByteArrayMatcherBase::indexOfIn(const char *needle, uint nlen, const
*/
/*!
- \fn qMakeStaticByteArrayMatcher(const char (&pattern)[N])
+ \fn QStaticByteArrayMatcher qMakeStaticByteArrayMatcher(const char (&pattern)[N])
\since 5.9
\relates QStaticByteArrayMatcher
diff --git a/src/corelib/tools/qcache.qdoc b/src/corelib/tools/qcache.qdoc
index 423a911ce0..31dfcb42cf 100644
--- a/src/corelib/tools/qcache.qdoc
+++ b/src/corelib/tools/qcache.qdoc
@@ -80,25 +80,25 @@
\sa QPixmapCache, QHash, QMap
*/
-/*! \fn QCache::QCache(int maxCost = 100)
+/*! \fn template <class Key, class T> QCache<Key, T>::QCache(int maxCost = 100)
Constructs a cache whose contents will never have a total cost
greater than \a maxCost.
*/
-/*! \fn QCache::~QCache()
+/*! \fn template <class Key, class T> QCache<Key, T>::~QCache()
Destroys the cache. Deletes all the objects in the cache.
*/
-/*! \fn int QCache::maxCost() const
+/*! \fn template <class Key, class T> int QCache<Key, T>::maxCost() const
Returns the maximum allowed total cost of the cache.
\sa setMaxCost(), totalCost()
*/
-/*! \fn void QCache::setMaxCost(int cost)
+/*! \fn template <class Key, class T> void QCache<Key, T>::setMaxCost(int cost)
Sets the maximum allowed total cost of the cache to \a cost. If
the current total cost is greater than \a cost, some objects are
@@ -107,7 +107,7 @@
\sa maxCost(), totalCost()
*/
-/*! \fn int QCache::totalCost() const
+/*! \fn template <class Key, class T> int QCache<Key, T>::totalCost() const
Returns the total cost of the objects in the cache.
@@ -120,19 +120,19 @@
\sa setMaxCost()
*/
-/*! \fn int QCache::size() const
+/*! \fn template <class Key, class T> int QCache<Key, T>::size() const
Returns the number of objects in the cache.
\sa isEmpty()
*/
-/*! \fn int QCache::count() const
+/*! \fn template <class Key, class T> int QCache<Key, T>::count() const
Same as size().
*/
-/*! \fn bool QCache::isEmpty() const
+/*! \fn template <class Key, class T> bool QCache<Key, T>::isEmpty() const
Returns \c true if the cache contains no objects; otherwise
returns \c false.
@@ -140,12 +140,12 @@
\sa size()
*/
-/*! \fn QList<Key> QCache::keys() const
+/*! \fn template <class Key, class T> QList<Key> QCache<Key, T>::keys() const
Returns a list of the keys in the cache.
*/
-/*! \fn void QCache::clear();
+/*! \fn template <class Key, class T> void QCache<Key, T>::clear();
Deletes all the objects in the cache.
@@ -153,7 +153,7 @@
*/
-/*! \fn bool QCache::insert(const Key &key, T *object, int cost = 1)
+/*! \fn template <class Key, class T> bool QCache<Key, T>::insert(const Key &key, T *object, int cost = 1)
Inserts \a object into the cache with key \a key and
associated cost \a cost. Any object with the same key already in
@@ -169,7 +169,7 @@
\sa take(), remove()
*/
-/*! \fn T *QCache::object(const Key &key) const
+/*! \fn template <class Key, class T> T *QCache<Key, T>::object(const Key &key) const
Returns the object associated with key \a key, or 0 if the key does
not exist in the cache.
@@ -180,7 +180,7 @@
\sa take(), remove()
*/
-/*! \fn bool QCache::contains(const Key &key) const
+/*! \fn template <class Key, class T> bool QCache<Key, T>::contains(const Key &key) const
Returns \c true if the cache contains an object associated with key \a
key; otherwise returns \c false.
@@ -188,7 +188,7 @@
\sa take(), remove()
*/
-/*! \fn T *QCache::operator[](const Key &key) const
+/*! \fn template <class Key, class T> T *QCache<Key, T>::operator[](const Key &key) const
Returns the object associated with key \a key, or 0 if the key does
not exist in the cache.
@@ -199,7 +199,7 @@
deleted at any time.
*/
-/*! \fn bool QCache::remove(const Key &key)
+/*! \fn template <class Key, class T> bool QCache<Key, T>::remove(const Key &key)
Deletes the object associated with key \a key. Returns \c true if the
object was found in the cache; otherwise returns \c false.
@@ -207,7 +207,7 @@
\sa take(), clear()
*/
-/*! \fn T *QCache::take(const Key &key)
+/*! \fn template <class Key, class T> T *QCache<Key, T>::take(const Key &key)
Takes the object associated with key \a key out of the cache
without deleting it. Returns a pointer to the object taken out, or
diff --git a/src/corelib/tools/qcollator.h b/src/corelib/tools/qcollator.h
index d81c7c85e3..6fa199cb0f 100644
--- a/src/corelib/tools/qcollator.h
+++ b/src/corelib/tools/qcollator.h
@@ -89,7 +89,7 @@ public:
QCollator &operator=(const QCollator &);
#ifdef Q_COMPILER_RVALUE_REFS
QCollator(QCollator &&other) Q_DECL_NOTHROW
- : d(other.d) { other.d = Q_NULLPTR; }
+ : d(other.d) { other.d = nullptr; }
QCollator &operator=(QCollator &&other) Q_DECL_NOTHROW
{ swap(other); return *this; }
#endif
diff --git a/src/corelib/tools/qcollator_win.cpp b/src/corelib/tools/qcollator_win.cpp
index bce896278e..5a838c1b50 100644
--- a/src/corelib/tools/qcollator_win.cpp
+++ b/src/corelib/tools/qcollator_win.cpp
@@ -70,12 +70,8 @@ void QCollatorPrivate::init()
if (caseSensitivity == Qt::CaseInsensitive)
collator |= NORM_IGNORECASE;
- if (numericMode) {
- if (QSysInfo::windowsVersion() >= QSysInfo::WV_WINDOWS7)
- collator |= SORT_DIGITSASNUMBERS;
- else
- qWarning("Numeric sorting unsupported on Windows versions older than Windows 7.");
- }
+ if (numericMode)
+ collator |= SORT_DIGITSASNUMBERS;
if (ignorePunctuation)
collator |= NORM_IGNORESYMBOLS;
diff --git a/src/corelib/tools/qcontiguouscache.cpp b/src/corelib/tools/qcontiguouscache.cpp
index 3393be2dee..2ded61c0be 100644
--- a/src/corelib/tools/qcontiguouscache.cpp
+++ b/src/corelib/tools/qcontiguouscache.cpp
@@ -131,14 +131,14 @@ MyRecord record(int row) const
See the \l{Contiguous Cache Example}{Contiguous Cache} example.
*/
-/*! \fn QContiguousCache::QContiguousCache(int capacity)
+/*! \fn template<typename T> QContiguousCache<T>::QContiguousCache(int capacity)
Constructs a cache with the given \a capacity.
\sa setCapacity()
*/
-/*! \fn QContiguousCache::QContiguousCache(const QContiguousCache<T> &other)
+/*! \fn template<typename T> QContiguousCache<T>::QContiguousCache(const QContiguousCache<T> &other)
Constructs a copy of \a other.
@@ -150,20 +150,20 @@ MyRecord record(int row) const
\sa operator=()
*/
-/*! \fn QContiguousCache::~QContiguousCache()
+/*! \fn template<typename T> QContiguousCache<T>::~QContiguousCache()
Destroys the cache.
*/
-/*! \fn void QContiguousCache::detach()
+/*! \fn template<typename T> void QContiguousCache<T>::detach()
\internal
*/
-/*! \fn bool QContiguousCache::isDetached() const
+/*! \fn template<typename T> bool QContiguousCache<T>::isDetached() const
\internal
*/
-/*! \fn void QContiguousCache::setSharable(bool sharable)
+/*! \fn template<typename T> void QContiguousCache<T>::setSharable(bool sharable)
\internal
*/
@@ -195,27 +195,27 @@ MyRecord record(int row) const
\internal
*/
-/*! \fn QContiguousCache<T> &QContiguousCache::operator=(const QContiguousCache<T> &other)
+/*! \fn template<typename T> QContiguousCache<T> &QContiguousCache<T>::operator=(const QContiguousCache<T> &other)
Assigns \a other to this cache and returns a reference to this cache.
*/
/*!
- \fn QContiguousCache<T> &QContiguousCache::operator=(QContiguousCache<T> &&other)
+ \fn template<typename T> QContiguousCache<T> &QContiguousCache<T>::operator=(QContiguousCache<T> &&other)
Move-assigns \a other to this QContiguousCache instance.
\since 5.2
*/
-/*! \fn void QContiguousCache::swap(QContiguousCache<T> &other)
+/*! \fn template<typename T> void QContiguousCache<T>::swap(QContiguousCache<T> &other)
\since 4.8
Swaps cache \a other with this cache. This operation is very
fast and never fails.
*/
-/*! \fn bool QContiguousCache::operator==(const QContiguousCache<T> &other) const
+/*! \fn template<typename T> bool QContiguousCache<T>::operator==(const QContiguousCache<T> &other) const
Returns \c true if \a other is equal to this cache; otherwise returns \c false.
@@ -225,7 +225,7 @@ MyRecord record(int row) const
\sa operator!=()
*/
-/*! \fn bool QContiguousCache::operator!=(const QContiguousCache<T> &other) const
+/*! \fn template<typename T> bool QContiguousCache<T>::operator!=(const QContiguousCache<T> &other) const
Returns \c true if \a other is not equal to this cache; otherwise
returns \c false.
@@ -236,7 +236,7 @@ MyRecord record(int row) const
\sa operator==()
*/
-/*! \fn int QContiguousCache::capacity() const
+/*! \fn template<typename T> int QContiguousCache<T>::capacity() const
Returns the number of items the cache can store before it is full.
When a cache contains a number of items equal to its capacity, adding new
@@ -245,26 +245,26 @@ MyRecord record(int row) const
\sa setCapacity(), size()
*/
-/*! \fn int QContiguousCache::count() const
+/*! \fn template<typename T> int QContiguousCache<T>::count() const
Same as size().
*/
-/*! \fn int QContiguousCache::size() const
+/*! \fn template<typename T> int QContiguousCache<T>::size() const
Returns the number of items contained within the cache.
\sa capacity()
*/
-/*! \fn bool QContiguousCache::isEmpty() const
+/*! \fn template<typename T> bool QContiguousCache<T>::isEmpty() const
Returns \c true if no items are stored within the cache.
\sa size(), capacity()
*/
-/*! \fn bool QContiguousCache::isFull() const
+/*! \fn template<typename T> bool QContiguousCache<T>::isFull() const
Returns \c true if the number of items stored within the cache is equal
to the capacity of the cache.
@@ -272,19 +272,19 @@ MyRecord record(int row) const
\sa size(), capacity()
*/
-/*! \fn int QContiguousCache::available() const
+/*! \fn template<typename T> int QContiguousCache<T>::available() const
Returns the number of items that can be added to the cache before it becomes full.
\sa size(), capacity(), isFull()
*/
-/*! \fn void QContiguousCache::clear()
+/*! \fn template<typename T> void QContiguousCache<T>::clear()
Removes all items from the cache. The capacity is unchanged.
*/
-/*! \fn void QContiguousCache::setCapacity(int size)
+/*! \fn template<typename T> void QContiguousCache<T>::setCapacity(int size)
Sets the capacity of the cache to the given \a size. A cache can hold a
number of items equal to its capacity. When inserting, appending or prepending
@@ -297,7 +297,7 @@ MyRecord record(int row) const
\sa capacity(), isFull()
*/
-/*! \fn const T &QContiguousCache::at(int i) const
+/*! \fn template<typename T> const T &QContiguousCache<T>::at(int i) const
Returns the item at index position \a i in the cache. \a i must
be a valid index position in the cache (i.e, firstIndex() <= \a i <= lastIndex()).
@@ -311,7 +311,7 @@ MyRecord record(int row) const
\sa firstIndex(), lastIndex(), insert(), operator[]()
*/
-/*! \fn T &QContiguousCache::operator[](int i)
+/*! \fn template<typename T> T &QContiguousCache<T>::operator[](int i)
Returns the item at index position \a i as a modifiable reference. If
the cache does not contain an item at the given index position \a i
@@ -326,14 +326,14 @@ MyRecord record(int row) const
\sa insert(), at()
*/
-/*! \fn const T &QContiguousCache::operator[](int i) const
+/*! \fn template<typename T> const T &QContiguousCache<T>::operator[](int i) const
\overload
Same as at(\a i).
*/
-/*! \fn void QContiguousCache::append(const T &value)
+/*! \fn template<typename T> void QContiguousCache<T>::append(const T &value)
Inserts \a value at the end of the cache. If the cache is already full
the item at the start of the cache will be removed.
@@ -341,7 +341,7 @@ MyRecord record(int row) const
\sa prepend(), insert(), isFull()
*/
-/*! \fn void QContiguousCache::prepend(const T &value)
+/*! \fn template<typename T> void QContiguousCache<T>::prepend(const T &value)
Inserts \a value at the start of the cache. If the cache is already full
the item at the end of the cache will be removed.
@@ -349,7 +349,7 @@ MyRecord record(int row) const
\sa append(), insert(), isFull()
*/
-/*! \fn void QContiguousCache::insert(int i, const T &value)
+/*! \fn template<typename T> void QContiguousCache<T>::insert(int i, const T &value)
Inserts the \a value at the index position \a i. If the cache already contains
an item at \a i then that value is replaced. If \a i is either one more than
@@ -369,14 +369,14 @@ MyRecord record(int row) const
\sa prepend(), append(), isFull(), firstIndex(), lastIndex()
*/
-/*! \fn bool QContiguousCache::containsIndex(int i) const
+/*! \fn template<typename T> bool QContiguousCache<T>::containsIndex(int i) const
Returns \c true if the cache's index range includes the given index \a i.
\sa firstIndex(), lastIndex()
*/
-/*! \fn int QContiguousCache::firstIndex() const
+/*! \fn template<typename T> int QContiguousCache<T>::firstIndex() const
Returns the first valid index in the cache. The index will be invalid if the
cache is empty.
@@ -384,7 +384,7 @@ MyRecord record(int row) const
\sa capacity(), size(), lastIndex()
*/
-/*! \fn int QContiguousCache::lastIndex() const
+/*! \fn template<typename T> int QContiguousCache<T>::lastIndex() const
Returns the last valid index in the cache. The index will be invalid if the cache is empty.
@@ -392,7 +392,7 @@ MyRecord record(int row) const
*/
-/*! \fn T &QContiguousCache::first()
+/*! \fn template<typename T> T &QContiguousCache<T>::first()
Returns a reference to the first item in the cache. This function
assumes that the cache isn't empty.
@@ -400,7 +400,7 @@ MyRecord record(int row) const
\sa last(), isEmpty()
*/
-/*! \fn T &QContiguousCache::last()
+/*! \fn template<typename T> T &QContiguousCache<T>::last()
Returns a reference to the last item in the cache. This function
assumes that the cache isn't empty.
@@ -408,17 +408,17 @@ MyRecord record(int row) const
\sa first(), isEmpty()
*/
-/*! \fn const T& QContiguousCache::first() const
+/*! \fn template<typename T> const T& QContiguousCache<T>::first() const
\overload
*/
-/*! \fn const T& QContiguousCache::last() const
+/*! \fn template<typename T> const T& QContiguousCache<T>::last() const
\overload
*/
-/*! \fn void QContiguousCache::removeFirst()
+/*! \fn template<typename T> void QContiguousCache<T>::removeFirst()
Removes the first item from the cache. This function assumes that
the cache isn't empty.
@@ -426,7 +426,7 @@ MyRecord record(int row) const
\sa removeLast()
*/
-/*! \fn void QContiguousCache::removeLast()
+/*! \fn template<typename T> void QContiguousCache<T>::removeLast()
Removes the last item from the cache. This function assumes that
the cache isn't empty.
@@ -434,7 +434,7 @@ MyRecord record(int row) const
\sa removeFirst()
*/
-/*! \fn T QContiguousCache::takeFirst()
+/*! \fn template<typename T> T QContiguousCache<T>::takeFirst()
Removes the first item in the cache and returns it. This function
assumes that the cache isn't empty.
@@ -444,7 +444,7 @@ MyRecord record(int row) const
\sa takeLast(), removeFirst()
*/
-/*! \fn T QContiguousCache::takeLast()
+/*! \fn template<typename T> T QContiguousCache<T>::takeLast()
Removes the last item in the cache and returns it. This function
assumes that the cache isn't empty.
@@ -454,7 +454,7 @@ MyRecord record(int row) const
\sa takeFirst(), removeLast()
*/
-/*! \fn void QContiguousCache::normalizeIndexes()
+/*! \fn template<typename T> void QContiguousCache<T>::normalizeIndexes()
Moves the first index and last index of the cache
such that they point to valid indexes. The function does not modify
@@ -473,7 +473,7 @@ MyRecord record(int row) const
\sa areIndexesValid(), append(), prepend()
*/
-/*! \fn bool QContiguousCache::areIndexesValid() const
+/*! \fn template<typename T> bool QContiguousCache<T>::areIndexesValid() const
Returns whether the indexes for items stored in the cache are valid.
Indexes can become invalid if items are appended after the index position
diff --git a/src/corelib/tools/qdatetime.h b/src/corelib/tools/qdatetime.h
index 3b741553d5..5a7b75db62 100644
--- a/src/corelib/tools/qdatetime.h
+++ b/src/corelib/tools/qdatetime.h
@@ -79,7 +79,7 @@ public:
int dayOfYear() const;
int daysInMonth() const;
int daysInYear() const;
- int weekNumber(int *yearNum = Q_NULLPTR) const;
+ int weekNumber(int *yearNum = nullptr) const;
#if QT_DEPRECATED_SINCE(5, 10) && !defined QT_NO_TEXTDATE
QT_DEPRECATED_X("Use QLocale::monthName or QLocale::standaloneMonthName")
diff --git a/src/corelib/tools/qdatetimeparser.cpp b/src/corelib/tools/qdatetimeparser.cpp
index 1a56418aaf..551e01e076 100644
--- a/src/corelib/tools/qdatetimeparser.cpp
+++ b/src/corelib/tools/qdatetimeparser.cpp
@@ -802,6 +802,7 @@ QDateTimeParser::parseSection(const QDateTime &currentValue, int sectionIndex,
break;
}
Q_FALLTHROUGH();
+ // All numeric:
case DaySection:
case YearSection:
case YearSection2Digits:
@@ -824,9 +825,9 @@ QDateTimeParser::parseSection(const QDateTime &currentValue, int sectionIndex,
bool ok = true;
int last = -1, used = -1;
- const int max = qMin(sectionmaxsize, sectiontextSize);
- QStringRef digitsStr = sectionTextRef.left(max);
- for (int digits = max; digits >= 1; --digits) {
+ Q_ASSERT(sectiontextSize <= sectionmaxsize);
+ QStringRef digitsStr = sectionTextRef.left(sectiontextSize);
+ for (int digits = sectiontextSize; digits >= 1; --digits) {
digitsStr.truncate(digits);
int tmp = (int)loc.toUInt(digitsStr, &ok);
if (ok && sn.type == Hour12Section) {
@@ -853,20 +854,20 @@ QDateTimeParser::parseSection(const QDateTime &currentValue, int sectionIndex,
QDTPDEBUG << "invalid because" << sectionTextRef << "can't become a uint" << last << ok;
} else {
const FieldInfo fi = fieldInfo(sectionIndex);
- const bool done = (used == sectionmaxsize);
- if (!done && fi & Fraction) { // typing 2 in a zzz field should be .200, not .002
+ const bool unfilled = used < sectionmaxsize;
+ if (unfilled && fi & Fraction) { // typing 2 in a zzz field should be .200, not .002
for (int i = used; i < sectionmaxsize; ++i)
last *= 10;
}
+ // Even those *= 10s can't take last above absMax:
+ Q_ASSERT(last <= absMax);
const int absMin = absoluteMin(sectionIndex);
if (last < absMin) {
- if (!done) // reversed test to dodge QDTPDEBUG ugliness !
+ if (unfilled)
result = ParsedSection(Intermediate, last, used);
else
QDTPDEBUG << "invalid because" << last << "is less than absoluteMin" << absMin;
- } else if (last > absMax) {
- result = ParsedSection(Intermediate, last, used);
- } else if (!done && (fi & (FixedWidth|Numeric)) == (FixedWidth|Numeric)) {
+ } else if (unfilled && (fi & (FixedWidth|Numeric)) == (FixedWidth|Numeric)) {
if (skipToNextSection(sectionIndex, currentValue, digitsStr)) {
const int missingZeroes = sectionmaxsize - digitsStr.size();
result = ParsedSection(Acceptable, last, sectionmaxsize, missingZeroes);
@@ -1159,7 +1160,8 @@ QDateTimeParser::scanString(const QDateTime &defaultValue,
}
state = qMin<State>(state, sect.state);
- if (state == Invalid || (state == Intermediate && context == FromString))
+ // QDateTimeEdit can fix Intermediate and zeroes, but input needing that didn't match format:
+ if (state == Invalid || (context == FromString && (state == Intermediate || sect.zeroes)))
return StateNode();
switch (sn.type) {
@@ -1475,8 +1477,8 @@ QDateTimeParser::parse(QString input, int position, const QDateTime &defaultValu
} else {
if (context == FromString) {
// optimization
- Q_ASSERT(maximum.date().toJulianDay() == 4642999);
- if (scan.value.date().toJulianDay() > 4642999)
+ Q_ASSERT(maximum.date().toJulianDay() == 5373484);
+ if (scan.value.date().toJulianDay() > 5373484)
scan.state = Invalid;
} else {
if (scan.value > maximum)
diff --git a/src/corelib/tools/qdatetimeparser_p.h b/src/corelib/tools/qdatetimeparser_p.h
index c3ae08da71..c9e63fe307 100644
--- a/src/corelib/tools/qdatetimeparser_p.h
+++ b/src/corelib/tools/qdatetimeparser_p.h
@@ -69,7 +69,7 @@ QT_REQUIRE_CONFIG(datetimeparser);
#define QDATETIMEEDIT_TIME_MAX QTime(23, 59, 59, 999)
#define QDATETIMEEDIT_DATE_MIN QDate(100, 1, 1)
#define QDATETIMEEDIT_COMPAT_DATE_MIN QDate(1752, 9, 14)
-#define QDATETIMEEDIT_DATE_MAX QDate(7999, 12, 31)
+#define QDATETIMEEDIT_DATE_MAX QDate(9999, 12, 31)
#define QDATETIMEEDIT_DATETIME_MIN QDateTime(QDATETIMEEDIT_DATE_MIN, QDATETIMEEDIT_TIME_MIN)
#define QDATETIMEEDIT_COMPAT_DATETIME_MIN QDateTime(QDATETIMEEDIT_COMPAT_DATE_MIN, QDATETIMEEDIT_TIME_MIN)
#define QDATETIMEEDIT_DATETIME_MAX QDateTime(QDATETIMEEDIT_DATE_MAX, QDATETIMEEDIT_TIME_MAX)
diff --git a/src/corelib/tools/qeasingcurve.cpp b/src/corelib/tools/qeasingcurve.cpp
index 03bb1a1411..0b8fa4ca74 100644
--- a/src/corelib/tools/qeasingcurve.cpp
+++ b/src/corelib/tools/qeasingcurve.cpp
@@ -496,7 +496,7 @@ struct BezierEase : public QEasingCurveFunction
}
}
- QEasingCurveFunction *copy() const Q_DECL_OVERRIDE
+ QEasingCurveFunction *copy() const override
{
BezierEase *rv = new BezierEase();
rv->_t = _t;
@@ -532,7 +532,7 @@ struct BezierEase : public QEasingCurveFunction
return newT;
}
- qreal value(qreal x) Q_DECL_OVERRIDE
+ qreal value(qreal x) override
{
Q_ASSERT(_bezierCurves.count() % 3 == 0);
@@ -826,7 +826,7 @@ struct TCBEase : public BezierEase
: BezierEase(QEasingCurve::TCBSpline)
{ }
- qreal value(qreal x) Q_DECL_OVERRIDE
+ qreal value(qreal x) override
{
Q_ASSERT(_bezierCurves.count() % 3 == 0);
@@ -846,7 +846,7 @@ struct ElasticEase : public QEasingCurveFunction
: QEasingCurveFunction(type, qreal(0.3), qreal(1.0))
{ }
- QEasingCurveFunction *copy() const Q_DECL_OVERRIDE
+ QEasingCurveFunction *copy() const override
{
ElasticEase *rv = new ElasticEase(_t);
rv->_p = _p;
@@ -856,7 +856,7 @@ struct ElasticEase : public QEasingCurveFunction
return rv;
}
- qreal value(qreal t) Q_DECL_OVERRIDE
+ qreal value(qreal t) override
{
qreal p = (_p < 0) ? qreal(0.3) : _p;
qreal a = (_a < 0) ? qreal(1.0) : _a;
@@ -881,7 +881,7 @@ struct BounceEase : public QEasingCurveFunction
: QEasingCurveFunction(type, qreal(0.3), qreal(1.0))
{ }
- QEasingCurveFunction *copy() const Q_DECL_OVERRIDE
+ QEasingCurveFunction *copy() const override
{
BounceEase *rv = new BounceEase(_t);
rv->_a = _a;
@@ -890,7 +890,7 @@ struct BounceEase : public QEasingCurveFunction
return rv;
}
- qreal value(qreal t) Q_DECL_OVERRIDE
+ qreal value(qreal t) override
{
qreal a = (_a < 0) ? qreal(1.0) : _a;
switch(_t) {
@@ -914,7 +914,7 @@ struct BackEase : public QEasingCurveFunction
: QEasingCurveFunction(type, qreal(0.3), qreal(1.0), qreal(1.70158))
{ }
- QEasingCurveFunction *copy() const Q_DECL_OVERRIDE
+ QEasingCurveFunction *copy() const override
{
BackEase *rv = new BackEase(_t);
rv->_o = _o;
@@ -923,7 +923,7 @@ struct BackEase : public QEasingCurveFunction
return rv;
}
- qreal value(qreal t) Q_DECL_OVERRIDE
+ qreal value(qreal t) override
{
qreal o = (_o < 0) ? qreal(1.70158) : _o;
switch(_t) {
@@ -1488,7 +1488,7 @@ QDataStream &operator>>(QDataStream &stream, QEasingCurve &easing)
bool hasConfig;
stream >> hasConfig;
delete easing.d_ptr->config;
- easing.d_ptr->config = Q_NULLPTR;
+ easing.d_ptr->config = nullptr;
if (hasConfig) {
QEasingCurveFunction *config = curveToFunctionObject(type);
stream >> config->_p;
diff --git a/src/corelib/tools/qeasingcurve.h b/src/corelib/tools/qeasingcurve.h
index ba06de8f9e..74bde5825a 100644
--- a/src/corelib/tools/qeasingcurve.h
+++ b/src/corelib/tools/qeasingcurve.h
@@ -81,7 +81,7 @@ public:
QEasingCurve &operator=(const QEasingCurve &other)
{ if ( this != &other ) { QEasingCurve copy(other); swap(copy); } return *this; }
#ifdef Q_COMPILER_RVALUE_REFS
- QEasingCurve(QEasingCurve &&other) Q_DECL_NOTHROW : d_ptr(other.d_ptr) { other.d_ptr = Q_NULLPTR; }
+ QEasingCurve(QEasingCurve &&other) Q_DECL_NOTHROW : d_ptr(other.d_ptr) { other.d_ptr = nullptr; }
QEasingCurve &operator=(QEasingCurve &&other) Q_DECL_NOTHROW
{ qSwap(d_ptr, other.d_ptr); return *this; }
#endif
diff --git a/src/corelib/tools/qhash.cpp b/src/corelib/tools/qhash.cpp
index 501f0d345f..e72b3e1eb5 100644
--- a/src/corelib/tools/qhash.cpp
+++ b/src/corelib/tools/qhash.cpp
@@ -963,7 +963,7 @@ uint qHash(double key, uint seed) Q_DECL_NOTHROW
return key != 0.0 ? hash(reinterpret_cast<const uchar *>(&key), sizeof(key), seed) : seed ;
}
-#ifndef Q_OS_DARWIN
+#if !defined(Q_OS_DARWIN) || defined(Q_CLANG_QDOC)
/*! \relates QHash
\since 5.3
@@ -1242,7 +1242,7 @@ uint qHash(long double key, uint seed) Q_DECL_NOTHROW
\sa QHashIterator, QMutableHashIterator, QMap, QSet
*/
-/*! \fn QHash::QHash()
+/*! \fn template <class Key, class T> QHash<Key, T>::QHash()
Constructs an empty hash.
@@ -1250,7 +1250,7 @@ uint qHash(long double key, uint seed) Q_DECL_NOTHROW
*/
/*!
- \fn QHash::QHash(QHash &&other)
+ \fn template <class Key, class T> QHash<Key, T>::QHash(QHash &&other)
Move-constructs a QHash instance, making it point at the same
object that \a other was pointing to.
@@ -1258,7 +1258,7 @@ uint qHash(long double key, uint seed) Q_DECL_NOTHROW
\since 5.2
*/
-/*! \fn QHash::QHash(std::initializer_list<std::pair<Key,T> > list)
+/*! \fn template <class Key, class T> QHash<Key, T>::QHash(std::initializer_list<std::pair<Key,T> > list)
\since 5.1
Constructs a hash with a copy of each of the elements in the
@@ -1268,7 +1268,7 @@ uint qHash(long double key, uint seed) Q_DECL_NOTHROW
compiled in C++11 mode.
*/
-/*! \fn QHash::QHash(const QHash &other)
+/*! \fn template <class Key, class T> QHash<Key, T>::QHash(const QHash &other)
Constructs a copy of \a other.
@@ -1280,40 +1280,40 @@ uint qHash(long double key, uint seed) Q_DECL_NOTHROW
\sa operator=()
*/
-/*! \fn QHash::~QHash()
+/*! \fn template <class Key, class T> QHash<Key, T>::~QHash()
Destroys the hash. References to the values in the hash and all
iterators of this hash become invalid.
*/
-/*! \fn QHash &QHash::operator=(const QHash &other)
+/*! \fn template <class Key, class T> QHash &QHash<Key, T>::operator=(const QHash &other)
Assigns \a other to this hash and returns a reference to this hash.
*/
/*!
- \fn QHash &QHash::operator=(QHash &&other)
+ \fn template <class Key, class T> QHash &QHash<Key, T>::operator=(QHash &&other)
Move-assigns \a other to this QHash instance.
\since 5.2
*/
-/*! \fn void QHash::swap(QHash &other)
+/*! \fn template <class Key, class T> void QHash<Key, T>::swap(QHash &other)
\since 4.8
Swaps hash \a other with this hash. This operation is very
fast and never fails.
*/
-/*! \fn void QMultiHash::swap(QMultiHash &other)
+/*! \fn template <class Key, class T> void QMultiHash<Key, T>::swap(QMultiHash &other)
\since 4.8
Swaps hash \a other with this hash. This operation is very
fast and never fails.
*/
-/*! \fn bool QHash::operator==(const QHash &other) const
+/*! \fn template <class Key, class T> bool QHash<Key, T>::operator==(const QHash &other) const
Returns \c true if \a other is equal to this hash; otherwise returns
false.
@@ -1326,7 +1326,7 @@ uint qHash(long double key, uint seed) Q_DECL_NOTHROW
\sa operator!=()
*/
-/*! \fn bool QHash::operator!=(const QHash &other) const
+/*! \fn template <class Key, class T> bool QHash<Key, T>::operator!=(const QHash &other) const
Returns \c true if \a other is not equal to this hash; otherwise
returns \c false.
@@ -1339,14 +1339,14 @@ uint qHash(long double key, uint seed) Q_DECL_NOTHROW
\sa operator==()
*/
-/*! \fn int QHash::size() const
+/*! \fn template <class Key, class T> int QHash<Key, T>::size() const
Returns the number of items in the hash.
\sa isEmpty(), count()
*/
-/*! \fn bool QHash::isEmpty() const
+/*! \fn template <class Key, class T> bool QHash<Key, T>::isEmpty() const
Returns \c true if the hash contains no items; otherwise returns
false.
@@ -1354,7 +1354,7 @@ uint qHash(long double key, uint seed) Q_DECL_NOTHROW
\sa size()
*/
-/*! \fn int QHash::capacity() const
+/*! \fn template <class Key, class T> int QHash<Key, T>::capacity() const
Returns the number of buckets in the QHash's internal hash table.
@@ -1366,7 +1366,7 @@ uint qHash(long double key, uint seed) Q_DECL_NOTHROW
\sa reserve(), squeeze()
*/
-/*! \fn void QHash::reserve(int size)
+/*! \fn template <class Key, class T> void QHash<Key, T>::reserve(int size)
Ensures that the QHash's internal hash table consists of at least
\a size buckets.
@@ -1389,7 +1389,7 @@ uint qHash(long double key, uint seed) Q_DECL_NOTHROW
\sa squeeze(), capacity()
*/
-/*! \fn void QHash::squeeze()
+/*! \fn template <class Key, class T> void QHash<Key, T>::squeeze()
Reduces the size of the QHash's internal hash table to save
memory.
@@ -1401,7 +1401,7 @@ uint qHash(long double key, uint seed) Q_DECL_NOTHROW
\sa reserve(), capacity()
*/
-/*! \fn void QHash::detach()
+/*! \fn template <class Key, class T> void QHash<Key, T>::detach()
\internal
@@ -1411,7 +1411,7 @@ uint qHash(long double key, uint seed) Q_DECL_NOTHROW
\sa isDetached()
*/
-/*! \fn bool QHash::isDetached() const
+/*! \fn template <class Key, class T> bool QHash<Key, T>::isDetached() const
\internal
@@ -1421,24 +1421,24 @@ uint qHash(long double key, uint seed) Q_DECL_NOTHROW
\sa detach()
*/
-/*! \fn void QHash::setSharable(bool sharable)
+/*! \fn template <class Key, class T> void QHash<Key, T>::setSharable(bool sharable)
\internal
*/
-/*! \fn bool QHash::isSharedWith(const QHash &other) const
+/*! \fn template <class Key, class T> bool QHash<Key, T>::isSharedWith(const QHash &other) const
\internal
*/
-/*! \fn void QHash::clear()
+/*! \fn template <class Key, class T> void QHash<Key, T>::clear()
Removes all items from the hash.
\sa remove()
*/
-/*! \fn int QHash::remove(const Key &key)
+/*! \fn template <class Key, class T> int QHash<Key, T>::remove(const Key &key)
Removes all the items that have the \a key from the hash.
Returns the number of items removed which is usually 1 but will
@@ -1448,7 +1448,7 @@ uint qHash(long double key, uint seed) Q_DECL_NOTHROW
\sa clear(), take(), QMultiHash::remove()
*/
-/*! \fn T QHash::take(const Key &key)
+/*! \fn template <class Key, class T> T QHash<Key, T>::take(const Key &key)
Removes the item with the \a key from the hash and returns
the value associated with it.
@@ -1463,7 +1463,7 @@ uint qHash(long double key, uint seed) Q_DECL_NOTHROW
\sa remove()
*/
-/*! \fn bool QHash::contains(const Key &key) const
+/*! \fn template <class Key, class T> bool QHash<Key, T>::contains(const Key &key) const
Returns \c true if the hash contains an item with the \a key;
otherwise returns \c false.
@@ -1471,7 +1471,7 @@ uint qHash(long double key, uint seed) Q_DECL_NOTHROW
\sa count(), QMultiHash::contains()
*/
-/*! \fn const T QHash::value(const Key &key) const
+/*! \fn template <class Key, class T> const T QHash<Key, T>::value(const Key &key) const
Returns the value associated with the \a key.
@@ -1483,14 +1483,14 @@ uint qHash(long double key, uint seed) Q_DECL_NOTHROW
\sa key(), values(), contains(), operator[]()
*/
-/*! \fn const T QHash::value(const Key &key, const T &defaultValue) const
+/*! \fn template <class Key, class T> const T QHash<Key, T>::value(const Key &key, const T &defaultValue) const
\overload
If the hash contains no item with the given \a key, the function returns
\a defaultValue.
*/
-/*! \fn T &QHash::operator[](const Key &key)
+/*! \fn template <class Key, class T> T &QHash<Key, T>::operator[](const Key &key)
Returns the value associated with the \a key as a modifiable
reference.
@@ -1504,14 +1504,14 @@ uint qHash(long double key, uint seed) Q_DECL_NOTHROW
\sa insert(), value()
*/
-/*! \fn const T QHash::operator[](const Key &key) const
+/*! \fn template <class Key, class T> const T QHash<Key, T>::operator[](const Key &key) const
\overload
Same as value().
*/
-/*! \fn QList<Key> QHash::uniqueKeys() const
+/*! \fn template <class Key, class T> QList<Key> QHash<Key, T>::uniqueKeys() const
\since 4.2
Returns a list containing all the keys in the map. Keys that occur multiple
@@ -1521,7 +1521,7 @@ uint qHash(long double key, uint seed) Q_DECL_NOTHROW
\sa keys(), values()
*/
-/*! \fn QList<Key> QHash::keys() const
+/*! \fn template <class Key, class T> QList<Key> QHash<Key, T>::keys() const
Returns a list containing all the keys in the hash, in an
arbitrary order. Keys that occur multiple times in the hash
@@ -1536,7 +1536,7 @@ uint qHash(long double key, uint seed) Q_DECL_NOTHROW
\sa uniqueKeys(), values(), key()
*/
-/*! \fn QList<Key> QHash::keys(const T &value) const
+/*! \fn template <class Key, class T> QList<Key> QHash<Key, T>::keys(const T &value) const
\overload
@@ -1548,7 +1548,7 @@ uint qHash(long double key, uint seed) Q_DECL_NOTHROW
by value.
*/
-/*! \fn QList<T> QHash::values() const
+/*! \fn template <class Key, class T> QList<T> QHash<Key, T>::values() const
Returns a list containing all the values in the hash, in an
arbitrary order. If a key is associated with multiple values, all of
@@ -1560,7 +1560,7 @@ uint qHash(long double key, uint seed) Q_DECL_NOTHROW
\sa keys(), value()
*/
-/*! \fn QList<T> QHash::values(const Key &key) const
+/*! \fn template <class Key, class T> QList<T> QHash<Key, T>::values(const Key &key) const
\overload
@@ -1570,7 +1570,7 @@ uint qHash(long double key, uint seed) Q_DECL_NOTHROW
\sa count(), insertMulti()
*/
-/*! \fn Key QHash::key(const T &value) const
+/*! \fn template <class Key, class T> Key QHash<Key, T>::key(const T &value) const
Returns the first key mapped to \a value.
@@ -1585,7 +1585,7 @@ uint qHash(long double key, uint seed) Q_DECL_NOTHROW
*/
/*!
- \fn Key QHash::key(const T &value, const Key &defaultKey) const
+ \fn template <class Key, class T> Key QHash<Key, T>::key(const T &value, const Key &defaultKey) const
\since 4.3
\overload
@@ -1597,21 +1597,21 @@ uint qHash(long double key, uint seed) Q_DECL_NOTHROW
by value.
*/
-/*! \fn int QHash::count(const Key &key) const
+/*! \fn template <class Key, class T> int QHash<Key, T>::count(const Key &key) const
Returns the number of items associated with the \a key.
\sa contains(), insertMulti()
*/
-/*! \fn int QHash::count() const
+/*! \fn template <class Key, class T> int QHash<Key, T>::count() const
\overload
Same as size().
*/
-/*! \fn QHash::iterator QHash::begin()
+/*! \fn template <class Key, class T> QHash<Key, T>::iterator QHash<Key, T>::begin()
Returns an \l{STL-style iterators}{STL-style iterator} pointing to the first item in
the hash.
@@ -1619,12 +1619,12 @@ uint qHash(long double key, uint seed) Q_DECL_NOTHROW
\sa constBegin(), end()
*/
-/*! \fn QHash::const_iterator QHash::begin() const
+/*! \fn template <class Key, class T> QHash<Key, T>::const_iterator QHash<Key, T>::begin() const
\overload
*/
-/*! \fn QHash::const_iterator QHash::cbegin() const
+/*! \fn template <class Key, class T> QHash<Key, T>::const_iterator QHash<Key, T>::cbegin() const
\since 5.0
Returns a const \l{STL-style iterators}{STL-style iterator} pointing to the first item
@@ -1633,7 +1633,7 @@ uint qHash(long double key, uint seed) Q_DECL_NOTHROW
\sa begin(), cend()
*/
-/*! \fn QHash::const_iterator QHash::constBegin() const
+/*! \fn template <class Key, class T> QHash<Key, T>::const_iterator QHash<Key, T>::constBegin() const
Returns a const \l{STL-style iterators}{STL-style iterator} pointing to the first item
in the hash.
@@ -1641,7 +1641,7 @@ uint qHash(long double key, uint seed) Q_DECL_NOTHROW
\sa begin(), constEnd()
*/
-/*! \fn QHash::key_iterator QHash::keyBegin() const
+/*! \fn template <class Key, class T> QHash<Key, T>::key_iterator QHash<Key, T>::keyBegin() const
\since 5.6
Returns a const \l{STL-style iterators}{STL-style iterator} pointing to the first key
@@ -1650,7 +1650,7 @@ uint qHash(long double key, uint seed) Q_DECL_NOTHROW
\sa keyEnd()
*/
-/*! \fn QHash::iterator QHash::end()
+/*! \fn template <class Key, class T> QHash<Key, T>::iterator QHash<Key, T>::end()
Returns an \l{STL-style iterators}{STL-style iterator} pointing to the imaginary item
after the last item in the hash.
@@ -1658,12 +1658,12 @@ uint qHash(long double key, uint seed) Q_DECL_NOTHROW
\sa begin(), constEnd()
*/
-/*! \fn QHash::const_iterator QHash::end() const
+/*! \fn template <class Key, class T> QHash<Key, T>::const_iterator QHash<Key, T>::end() const
\overload
*/
-/*! \fn QHash::const_iterator QHash::constEnd() const
+/*! \fn template <class Key, class T> QHash<Key, T>::const_iterator QHash<Key, T>::constEnd() const
Returns a const \l{STL-style iterators}{STL-style iterator} pointing to the imaginary
item after the last item in the hash.
@@ -1671,7 +1671,7 @@ uint qHash(long double key, uint seed) Q_DECL_NOTHROW
\sa constBegin(), end()
*/
-/*! \fn QHash::const_iterator QHash::cend() const
+/*! \fn template <class Key, class T> QHash<Key, T>::const_iterator QHash<Key, T>::cend() const
\since 5.0
Returns a const \l{STL-style iterators}{STL-style iterator} pointing to the imaginary
@@ -1680,7 +1680,7 @@ uint qHash(long double key, uint seed) Q_DECL_NOTHROW
\sa cbegin(), end()
*/
-/*! \fn QHash::key_iterator QHash::keyEnd() const
+/*! \fn template <class Key, class T> QHash<Key, T>::key_iterator QHash<Key, T>::keyEnd() const
\since 5.6
Returns a const \l{STL-style iterators}{STL-style iterator} pointing to the imaginary
@@ -1689,7 +1689,7 @@ uint qHash(long double key, uint seed) Q_DECL_NOTHROW
\sa keyBegin()
*/
-/*! \fn QHash::key_value_iterator QHash::keyValueBegin()
+/*! \fn template <class Key, class T> QHash<Key, T>::key_value_iterator QHash<Key, T>::keyValueBegin()
\since 5.10
Returns an \l{STL-style iterators}{STL-style iterator} pointing to the first entry
@@ -1698,7 +1698,7 @@ uint qHash(long double key, uint seed) Q_DECL_NOTHROW
\sa keyValueEnd()
*/
-/*! \fn QHash::key_value_iterator QHash::keyValueEnd()
+/*! \fn template <class Key, class T> QHash<Key, T>::key_value_iterator QHash<Key, T>::keyValueEnd()
\since 5.10
Returns an \l{STL-style iterators}{STL-style iterator} pointing to the imaginary
@@ -1707,7 +1707,7 @@ uint qHash(long double key, uint seed) Q_DECL_NOTHROW
\sa keyValueBegin()
*/
-/*! \fn QHash::const_key_value_iterator QHash::keyValueBegin() const
+/*! \fn template <class Key, class T> QHash<Key, T>::const_key_value_iterator QHash<Key, T>::keyValueBegin() const
\since 5.10
Returns a const \l{STL-style iterators}{STL-style iterator} pointing to the first entry
@@ -1716,7 +1716,7 @@ uint qHash(long double key, uint seed) Q_DECL_NOTHROW
\sa keyValueEnd()
*/
-/*! \fn QHash::const_key_value_iterator QHash::constKeyValueBegin() const
+/*! \fn template <class Key, class T> QHash<Key, T>::const_key_value_iterator QHash<Key, T>::constKeyValueBegin() const
\since 5.10
Returns a const \l{STL-style iterators}{STL-style iterator} pointing to the first entry
@@ -1725,7 +1725,7 @@ uint qHash(long double key, uint seed) Q_DECL_NOTHROW
\sa keyValueBegin()
*/
-/*! \fn QHash::const_key_value_iterator QHash::keyValueEnd() const
+/*! \fn template <class Key, class T> QHash<Key, T>::const_key_value_iterator QHash<Key, T>::keyValueEnd() const
\since 5.10
Returns a const \l{STL-style iterators}{STL-style iterator} pointing to the imaginary
@@ -1734,7 +1734,7 @@ uint qHash(long double key, uint seed) Q_DECL_NOTHROW
\sa keyValueBegin()
*/
-/*! \fn QHash::const_key_value_iterator QHash::constKeyValueEnd() const
+/*! \fn template <class Key, class T> QHash<Key, T>::const_key_value_iterator QHash<Key, T>::constKeyValueEnd() const
\since 5.10
Returns a const \l{STL-style iterators}{STL-style iterator} pointing to the imaginary
@@ -1743,7 +1743,7 @@ uint qHash(long double key, uint seed) Q_DECL_NOTHROW
\sa constKeyValueBegin()
*/
-/*! \fn QHash::iterator QHash::erase(const_iterator pos)
+/*! \fn template <class Key, class T> QHash<Key, T>::iterator QHash<Key, T>::erase(const_iterator pos)
\since 5.7
Removes the (key, value) pair associated with the iterator \a pos
@@ -1760,11 +1760,11 @@ uint qHash(long double key, uint seed) Q_DECL_NOTHROW
\sa remove(), take(), find()
*/
-/*! \fn QHash::iterator QHash::erase(iterator pos)
+/*! \fn template <class Key, class T> QHash<Key, T>::iterator QHash<Key, T>::erase(iterator pos)
\overload
*/
-/*! \fn QHash::iterator QHash::find(const Key &key)
+/*! \fn template <class Key, class T> QHash<Key, T>::iterator QHash<Key, T>::find(const Key &key)
Returns an iterator pointing to the item with the \a key in the
hash.
@@ -1783,12 +1783,12 @@ uint qHash(long double key, uint seed) Q_DECL_NOTHROW
\sa value(), values(), QMultiHash::find()
*/
-/*! \fn QHash::const_iterator QHash::find(const Key &key) const
+/*! \fn template <class Key, class T> QHash<Key, T>::const_iterator QHash<Key, T>::find(const Key &key) const
\overload
*/
-/*! \fn QHash::const_iterator QHash::constFind(const Key &key) const
+/*! \fn template <class Key, class T> QHash<Key, T>::const_iterator QHash<Key, T>::constFind(const Key &key) const
\since 4.1
Returns an iterator pointing to the item with the \a key in the
@@ -1800,7 +1800,7 @@ uint qHash(long double key, uint seed) Q_DECL_NOTHROW
\sa find(), QMultiHash::constFind()
*/
-/*! \fn QHash::iterator QHash::insert(const Key &key, const T &value)
+/*! \fn template <class Key, class T> QHash<Key, T>::iterator QHash<Key, T>::insert(const Key &key, const T &value)
Inserts a new item with the \a key and a value of \a value.
@@ -1813,7 +1813,7 @@ uint qHash(long double key, uint seed) Q_DECL_NOTHROW
\sa insertMulti()
*/
-/*! \fn QHash::iterator QHash::insertMulti(const Key &key, const T &value)
+/*! \fn template <class Key, class T> QHash<Key, T>::iterator QHash<Key, T>::insertMulti(const Key &key, const T &value)
Inserts a new item with the \a key and a value of \a value.
@@ -1825,7 +1825,7 @@ uint qHash(long double key, uint seed) Q_DECL_NOTHROW
\sa insert(), values()
*/
-/*! \fn QHash &QHash::unite(const QHash &other)
+/*! \fn template <class Key, class T> QHash &QHash<Key, T>::unite(const QHash &other)
Inserts all the items in the \a other hash into this hash. If a
key is common to both hashes, the resulting hash will contain the
@@ -1834,14 +1834,14 @@ uint qHash(long double key, uint seed) Q_DECL_NOTHROW
\sa insertMulti()
*/
-/*! \fn bool QHash::empty() const
+/*! \fn template <class Key, class T> bool QHash<Key, T>::empty() const
This function is provided for STL compatibility. It is equivalent
to isEmpty(), returning true if the hash is empty; otherwise
returns \c false.
*/
-/*! \fn QPair<iterator, iterator> QHash::equal_range(const Key &key)
+/*! \fn template <class Key, class T> QPair<iterator, iterator> QHash<Key, T>::equal_range(const Key &key)
\since 5.7
Returns a pair of iterators delimiting the range of values \c{[first, second)}, that
@@ -1849,7 +1849,7 @@ uint qHash(long double key, uint seed) Q_DECL_NOTHROW
*/
/*!
- \fn QPair<const_iterator, const_iterator> QHash::equal_range(const Key &key) const
+ \fn template <class Key, class T> QPair<const_iterator, const_iterator> QHash<Key, T>::equal_range(const Key &key) const
\overload
\since 5.7
*/
@@ -2020,7 +2020,7 @@ uint qHash(long double key, uint seed) Q_DECL_NOTHROW
\sa QHash::const_iterator, QHash::key_iterator, QMutableHashIterator
*/
-/*! \fn QHash::iterator::iterator()
+/*! \fn template <class Key, class T> QHash<Key, T>::iterator::iterator()
Constructs an uninitialized iterator.
@@ -2031,12 +2031,12 @@ uint qHash(long double key, uint seed) Q_DECL_NOTHROW
\sa QHash::begin(), QHash::end()
*/
-/*! \fn QHash::iterator::iterator(void *node)
+/*! \fn template <class Key, class T> QHash<Key, T>::iterator::iterator(void *node)
\internal
*/
-/*! \fn const Key &QHash::iterator::key() const
+/*! \fn template <class Key, class T> const Key &QHash<Key, T>::iterator::key() const
Returns the current item's key as a const reference.
@@ -2047,7 +2047,7 @@ uint qHash(long double key, uint seed) Q_DECL_NOTHROW
\sa value()
*/
-/*! \fn T &QHash::iterator::value() const
+/*! \fn template <class Key, class T> T &QHash<Key, T>::iterator::value() const
Returns a modifiable reference to the current item's value.
@@ -2059,7 +2059,7 @@ uint qHash(long double key, uint seed) Q_DECL_NOTHROW
\sa key(), operator*()
*/
-/*! \fn T &QHash::iterator::operator*() const
+/*! \fn template <class Key, class T> T &QHash<Key, T>::iterator::operator*() const
Returns a modifiable reference to the current item's value.
@@ -2068,7 +2068,7 @@ uint qHash(long double key, uint seed) Q_DECL_NOTHROW
\sa key()
*/
-/*! \fn T *QHash::iterator::operator->() const
+/*! \fn template <class Key, class T> T *QHash<Key, T>::iterator::operator->() const
Returns a pointer to the current item's value.
@@ -2076,8 +2076,8 @@ uint qHash(long double key, uint seed) Q_DECL_NOTHROW
*/
/*!
- \fn bool QHash::iterator::operator==(const iterator &other) const
- \fn bool QHash::iterator::operator==(const const_iterator &other) const
+ \fn template <class Key, class T> bool QHash<Key, T>::iterator::operator==(const iterator &other) const
+ \fn template <class Key, class T> bool QHash<Key, T>::iterator::operator==(const const_iterator &other) const
Returns \c true if \a other points to the same item as this
iterator; otherwise returns \c false.
@@ -2086,8 +2086,8 @@ uint qHash(long double key, uint seed) Q_DECL_NOTHROW
*/
/*!
- \fn bool QHash::iterator::operator!=(const iterator &other) const
- \fn bool QHash::iterator::operator!=(const const_iterator &other) const
+ \fn template <class Key, class T> bool QHash<Key, T>::iterator::operator!=(const iterator &other) const
+ \fn template <class Key, class T> bool QHash<Key, T>::iterator::operator!=(const const_iterator &other) const
Returns \c true if \a other points to a different item than this
iterator; otherwise returns \c false.
@@ -2096,7 +2096,7 @@ uint qHash(long double key, uint seed) Q_DECL_NOTHROW
*/
/*!
- \fn QHash::iterator &QHash::iterator::operator++()
+ \fn template <class Key, class T> QHash<Key, T>::iterator &QHash<Key, T>::iterator::operator++()
The prefix ++ operator (\c{++i}) advances the iterator to the
next item in the hash and returns an iterator to the new current
@@ -2107,7 +2107,7 @@ uint qHash(long double key, uint seed) Q_DECL_NOTHROW
\sa operator--()
*/
-/*! \fn QHash::iterator QHash::iterator::operator++(int)
+/*! \fn template <class Key, class T> QHash<Key, T>::iterator QHash<Key, T>::iterator::operator++(int)
\overload
@@ -2117,7 +2117,7 @@ uint qHash(long double key, uint seed) Q_DECL_NOTHROW
*/
/*!
- \fn QHash::iterator &QHash::iterator::operator--()
+ \fn template <class Key, class T> QHash<Key, T>::iterator &QHash<Key, T>::iterator::operator--()
The prefix -- operator (\c{--i}) makes the preceding item
current and returns an iterator pointing to the new current item.
@@ -2129,7 +2129,7 @@ uint qHash(long double key, uint seed) Q_DECL_NOTHROW
*/
/*!
- \fn QHash::iterator QHash::iterator::operator--(int)
+ \fn template <class Key, class T> QHash<Key, T>::iterator QHash<Key, T>::iterator::operator--(int)
\overload
@@ -2138,7 +2138,7 @@ uint qHash(long double key, uint seed) Q_DECL_NOTHROW
current item.
*/
-/*! \fn QHash::iterator QHash::iterator::operator+(int j) const
+/*! \fn template <class Key, class T> QHash<Key, T>::iterator QHash<Key, T>::iterator::operator+(int j) const
Returns an iterator to the item at \a j positions forward from
this iterator. (If \a j is negative, the iterator goes backward.)
@@ -2149,7 +2149,7 @@ uint qHash(long double key, uint seed) Q_DECL_NOTHROW
*/
-/*! \fn QHash::iterator QHash::iterator::operator-(int j) const
+/*! \fn template <class Key, class T> QHash<Key, T>::iterator QHash<Key, T>::iterator::operator-(int j) const
Returns an iterator to the item at \a j positions backward from
this iterator. (If \a j is negative, the iterator goes forward.)
@@ -2159,7 +2159,7 @@ uint qHash(long double key, uint seed) Q_DECL_NOTHROW
\sa operator+()
*/
-/*! \fn QHash::iterator &QHash::iterator::operator+=(int j)
+/*! \fn template <class Key, class T> QHash<Key, T>::iterator &QHash<Key, T>::iterator::operator+=(int j)
Advances the iterator by \a j items. (If \a j is negative, the
iterator goes backward.)
@@ -2167,7 +2167,7 @@ uint qHash(long double key, uint seed) Q_DECL_NOTHROW
\sa operator-=(), operator+()
*/
-/*! \fn QHash::iterator &QHash::iterator::operator-=(int j)
+/*! \fn template <class Key, class T> QHash<Key, T>::iterator &QHash<Key, T>::iterator::operator-=(int j)
Makes the iterator go back by \a j items. (If \a j is negative,
the iterator goes forward.)
@@ -2222,7 +2222,7 @@ uint qHash(long double key, uint seed) Q_DECL_NOTHROW
\sa QHash::iterator, QHashIterator
*/
-/*! \fn QHash::const_iterator::const_iterator()
+/*! \fn template <class Key, class T> QHash<Key, T>::const_iterator::const_iterator()
Constructs an uninitialized iterator.
@@ -2233,31 +2233,31 @@ uint qHash(long double key, uint seed) Q_DECL_NOTHROW
\sa QHash::constBegin(), QHash::constEnd()
*/
-/*! \fn QHash::const_iterator::const_iterator(void *node)
+/*! \fn template <class Key, class T> QHash<Key, T>::const_iterator::const_iterator(void *node)
\internal
*/
-/*! \fn QHash::const_iterator::const_iterator(const iterator &other)
+/*! \fn template <class Key, class T> QHash<Key, T>::const_iterator::const_iterator(const iterator &other)
Constructs a copy of \a other.
*/
-/*! \fn const Key &QHash::const_iterator::key() const
+/*! \fn template <class Key, class T> const Key &QHash<Key, T>::const_iterator::key() const
Returns the current item's key.
\sa value()
*/
-/*! \fn const T &QHash::const_iterator::value() const
+/*! \fn template <class Key, class T> const T &QHash<Key, T>::const_iterator::value() const
Returns the current item's value.
\sa key(), operator*()
*/
-/*! \fn const T &QHash::const_iterator::operator*() const
+/*! \fn template <class Key, class T> const T &QHash<Key, T>::const_iterator::operator*() const
Returns the current item's value.
@@ -2266,14 +2266,14 @@ uint qHash(long double key, uint seed) Q_DECL_NOTHROW
\sa key()
*/
-/*! \fn const T *QHash::const_iterator::operator->() const
+/*! \fn template <class Key, class T> const T *QHash<Key, T>::const_iterator::operator->() const
Returns a pointer to the current item's value.
\sa value()
*/
-/*! \fn bool QHash::const_iterator::operator==(const const_iterator &other) const
+/*! \fn template <class Key, class T> bool QHash<Key, T>::const_iterator::operator==(const const_iterator &other) const
Returns \c true if \a other points to the same item as this
iterator; otherwise returns \c false.
@@ -2281,7 +2281,7 @@ uint qHash(long double key, uint seed) Q_DECL_NOTHROW
\sa operator!=()
*/
-/*! \fn bool QHash::const_iterator::operator!=(const const_iterator &other) const
+/*! \fn template <class Key, class T> bool QHash<Key, T>::const_iterator::operator!=(const const_iterator &other) const
Returns \c true if \a other points to a different item than this
iterator; otherwise returns \c false.
@@ -2290,7 +2290,7 @@ uint qHash(long double key, uint seed) Q_DECL_NOTHROW
*/
/*!
- \fn QHash::const_iterator &QHash::const_iterator::operator++()
+ \fn template <class Key, class T> QHash<Key, T>::const_iterator &QHash<Key, T>::const_iterator::operator++()
The prefix ++ operator (\c{++i}) advances the iterator to the
next item in the hash and returns an iterator to the new current
@@ -2301,7 +2301,7 @@ uint qHash(long double key, uint seed) Q_DECL_NOTHROW
\sa operator--()
*/
-/*! \fn QHash::const_iterator QHash::const_iterator::operator++(int)
+/*! \fn template <class Key, class T> QHash<Key, T>::const_iterator QHash<Key, T>::const_iterator::operator++(int)
\overload
@@ -2310,7 +2310,7 @@ uint qHash(long double key, uint seed) Q_DECL_NOTHROW
current item.
*/
-/*! \fn QHash::const_iterator &QHash::const_iterator::operator--()
+/*! \fn template <class Key, class T> QHash<Key, T>::const_iterator &QHash<Key, T>::const_iterator::operator--()
The prefix -- operator (\c{--i}) makes the preceding item
current and returns an iterator pointing to the new current item.
@@ -2321,7 +2321,7 @@ uint qHash(long double key, uint seed) Q_DECL_NOTHROW
\sa operator++()
*/
-/*! \fn QHash::const_iterator QHash::const_iterator::operator--(int)
+/*! \fn template <class Key, class T> QHash<Key, T>::const_iterator QHash<Key, T>::const_iterator::operator--(int)
\overload
@@ -2330,7 +2330,7 @@ uint qHash(long double key, uint seed) Q_DECL_NOTHROW
current item.
*/
-/*! \fn QHash::const_iterator QHash::const_iterator::operator+(int j) const
+/*! \fn template <class Key, class T> QHash<Key, T>::const_iterator QHash<Key, T>::const_iterator::operator+(int j) const
Returns an iterator to the item at \a j positions forward from
this iterator. (If \a j is negative, the iterator goes backward.)
@@ -2340,7 +2340,7 @@ uint qHash(long double key, uint seed) Q_DECL_NOTHROW
\sa operator-()
*/
-/*! \fn QHash::const_iterator QHash::const_iterator::operator-(int j) const
+/*! \fn template <class Key, class T> QHash<Key, T>::const_iterator QHash<Key, T>::const_iterator::operator-(int j) const
Returns an iterator to the item at \a j positions backward from
this iterator. (If \a j is negative, the iterator goes forward.)
@@ -2350,7 +2350,7 @@ uint qHash(long double key, uint seed) Q_DECL_NOTHROW
\sa operator+()
*/
-/*! \fn QHash::const_iterator &QHash::const_iterator::operator+=(int j)
+/*! \fn template <class Key, class T> QHash<Key, T>::const_iterator &QHash<Key, T>::const_iterator::operator+=(int j)
Advances the iterator by \a j items. (If \a j is negative, the
iterator goes backward.)
@@ -2360,7 +2360,7 @@ uint qHash(long double key, uint seed) Q_DECL_NOTHROW
\sa operator-=(), operator+()
*/
-/*! \fn QHash::const_iterator &QHash::const_iterator::operator-=(int j)
+/*! \fn template <class Key, class T> QHash<Key, T>::const_iterator &QHash<Key, T>::const_iterator::operator-=(int j)
Makes the iterator go back by \a j items. (If \a j is negative,
the iterator goes forward.)
@@ -2407,17 +2407,17 @@ uint qHash(long double key, uint seed) Q_DECL_NOTHROW
\sa QHash::const_iterator, QHash::iterator
*/
-/*! \fn const T &QHash::key_iterator::operator*() const
+/*! \fn template <class Key, class T> const T &QHash<Key, T>::key_iterator::operator*() const
Returns the current item's key.
*/
-/*! \fn const T *QHash::key_iterator::operator->() const
+/*! \fn template <class Key, class T> const T *QHash<Key, T>::key_iterator::operator->() const
Returns a pointer to the current item's key.
*/
-/*! \fn bool QHash::key_iterator::operator==(key_iterator other) const
+/*! \fn template <class Key, class T> bool QHash<Key, T>::key_iterator::operator==(key_iterator other) const
Returns \c true if \a other points to the same item as this
iterator; otherwise returns \c false.
@@ -2425,7 +2425,7 @@ uint qHash(long double key, uint seed) Q_DECL_NOTHROW
\sa operator!=()
*/
-/*! \fn bool QHash::key_iterator::operator!=(key_iterator other) const
+/*! \fn template <class Key, class T> bool QHash<Key, T>::key_iterator::operator!=(key_iterator other) const
Returns \c true if \a other points to a different item than this
iterator; otherwise returns \c false.
@@ -2434,7 +2434,7 @@ uint qHash(long double key, uint seed) Q_DECL_NOTHROW
*/
/*!
- \fn QHash::key_iterator &QHash::key_iterator::operator++()
+ \fn template <class Key, class T> QHash<Key, T>::key_iterator &QHash<Key, T>::key_iterator::operator++()
The prefix ++ operator (\c{++i}) advances the iterator to the
next item in the hash and returns an iterator to the new current
@@ -2445,7 +2445,7 @@ uint qHash(long double key, uint seed) Q_DECL_NOTHROW
\sa operator--()
*/
-/*! \fn QHash::key_iterator QHash::key_iterator::operator++(int)
+/*! \fn template <class Key, class T> QHash<Key, T>::key_iterator QHash<Key, T>::key_iterator::operator++(int)
\overload
@@ -2454,7 +2454,7 @@ uint qHash(long double key, uint seed) Q_DECL_NOTHROW
item.
*/
-/*! \fn QHash::key_iterator &QHash::key_iterator::operator--()
+/*! \fn template <class Key, class T> QHash<Key, T>::key_iterator &QHash<Key, T>::key_iterator::operator--()
The prefix -- operator (\c{--i}) makes the preceding item
current and returns an iterator pointing to the new current item.
@@ -2465,7 +2465,7 @@ uint qHash(long double key, uint seed) Q_DECL_NOTHROW
\sa operator++()
*/
-/*! \fn QHash::key_iterator QHash::key_iterator::operator--(int)
+/*! \fn template <class Key, class T> QHash<Key, T>::key_iterator QHash<Key, T>::key_iterator::operator--(int)
\overload
@@ -2474,7 +2474,7 @@ uint qHash(long double key, uint seed) Q_DECL_NOTHROW
item.
*/
-/*! \fn const_iterator QHash::key_iterator::base() const
+/*! \fn template <class Key, class T> const_iterator QHash<Key, T>::key_iterator::base() const
Returns the underlying const_iterator this key_iterator is based on.
*/
@@ -2490,7 +2490,7 @@ uint qHash(long double key, uint seed) Q_DECL_NOTHROW
\sa QKeyValueIterator
*/
-/*! \fn QDataStream &operator<<(QDataStream &out, const QHash<Key, T>& hash)
+/*! \fn template <class Key, class T> QDataStream &operator<<(QDataStream &out, const QHash<Key, T>& hash)
\relates QHash
Writes the hash \a hash to stream \a out.
@@ -2501,7 +2501,7 @@ uint qHash(long double key, uint seed) Q_DECL_NOTHROW
\sa {Serializing Qt Data Types}
*/
-/*! \fn QDataStream &operator>>(QDataStream &in, QHash<Key, T> &hash)
+/*! \fn template <class Key, class T> QDataStream &operator>>(QDataStream &in, QHash<Key, T> &hash)
\relates QHash
Reads a hash from stream \a in into \a hash.
@@ -2568,12 +2568,12 @@ uint qHash(long double key, uint seed) Q_DECL_NOTHROW
\sa QHash, QHashIterator, QMutableHashIterator, QMultiMap
*/
-/*! \fn QMultiHash::QMultiHash()
+/*! \fn template <class Key, class T> QMultiHash<Key, T>::QMultiHash()
Constructs an empty hash.
*/
-/*! \fn QMultiHash::QMultiHash(std::initializer_list<std::pair<Key,T> > list)
+/*! \fn template <class Key, class T> QMultiHash<Key, T>::QMultiHash(std::initializer_list<std::pair<Key,T> > list)
\since 5.1
Constructs a multi-hash with a copy of each of the elements in the
@@ -2583,7 +2583,7 @@ uint qHash(long double key, uint seed) Q_DECL_NOTHROW
compiled in C++11 mode.
*/
-/*! \fn QMultiHash::QMultiHash(const QHash<Key, T> &other)
+/*! \fn template <class Key, class T> QMultiHash<Key, T>::QMultiHash(const QHash<Key, T> &other)
Constructs a copy of \a other (which can be a QHash or a
QMultiHash).
@@ -2591,7 +2591,7 @@ uint qHash(long double key, uint seed) Q_DECL_NOTHROW
\sa operator=()
*/
-/*! \fn QMultiHash::iterator QMultiHash::replace(const Key &key, const T &value)
+/*! \fn template <class Key, class T> QMultiHash<Key, T>::iterator QMultiHash<Key, T>::replace(const Key &key, const T &value)
Inserts a new item with the \a key and a value of \a value.
@@ -2604,7 +2604,7 @@ uint qHash(long double key, uint seed) Q_DECL_NOTHROW
\sa insert()
*/
-/*! \fn QMultiHash::iterator QMultiHash::insert(const Key &key, const T &value)
+/*! \fn template <class Key, class T> QMultiHash<Key, T>::iterator QMultiHash<Key, T>::insert(const Key &key, const T &value)
Inserts a new item with the \a key and a value of \a value.
@@ -2616,7 +2616,7 @@ uint qHash(long double key, uint seed) Q_DECL_NOTHROW
\sa replace()
*/
-/*! \fn QMultiHash &QMultiHash::operator+=(const QMultiHash &other)
+/*! \fn template <class Key, class T> QMultiHash &QMultiHash<Key, T>::operator+=(const QMultiHash &other)
Inserts all the items in the \a other hash into this hash
and returns a reference to this hash.
@@ -2624,7 +2624,7 @@ uint qHash(long double key, uint seed) Q_DECL_NOTHROW
\sa insert()
*/
-/*! \fn QMultiHash QMultiHash::operator+(const QMultiHash &other) const
+/*! \fn template <class Key, class T> QMultiHash QMultiHash<Key, T>::operator+(const QMultiHash &other) const
Returns a hash that contains all the items in this hash in
addition to all the items in \a other. If a key is common to both
@@ -2634,7 +2634,7 @@ uint qHash(long double key, uint seed) Q_DECL_NOTHROW
*/
/*!
- \fn bool QMultiHash::contains(const Key &key, const T &value) const
+ \fn template <class Key, class T> bool QMultiHash<Key, T>::contains(const Key &key, const T &value) const
\since 4.3
Returns \c true if the hash contains an item with the \a key and
@@ -2644,7 +2644,7 @@ uint qHash(long double key, uint seed) Q_DECL_NOTHROW
*/
/*!
- \fn int QMultiHash::remove(const Key &key, const T &value)
+ \fn template <class Key, class T> int QMultiHash<Key, T>::remove(const Key &key, const T &value)
\since 4.3
Removes all the items that have the \a key and the value \a
@@ -2654,7 +2654,7 @@ uint qHash(long double key, uint seed) Q_DECL_NOTHROW
*/
/*!
- \fn int QMultiHash::count(const Key &key, const T &value) const
+ \fn template <class Key, class T> int QMultiHash<Key, T>::count(const Key &key, const T &value) const
\since 4.3
Returns the number of items with the \a key and \a value.
@@ -2663,7 +2663,7 @@ uint qHash(long double key, uint seed) Q_DECL_NOTHROW
*/
/*!
- \fn typename QHash<Key, T>::iterator QMultiHash::find(const Key &key, const T &value)
+ \fn template <class Key, class T> typename QHash<Key, T>::iterator QMultiHash<Key, T>::find(const Key &key, const T &value)
\since 4.3
Returns an iterator pointing to the item with the \a key and \a value.
@@ -2676,13 +2676,13 @@ uint qHash(long double key, uint seed) Q_DECL_NOTHROW
*/
/*!
- \fn typename QHash<Key, T>::const_iterator QMultiHash::find(const Key &key, const T &value) const
+ \fn template <class Key, class T> typename QHash<Key, T>::const_iterator QMultiHash<Key, T>::find(const Key &key, const T &value) const
\since 4.3
\overload
*/
/*!
- \fn typename QHash<Key, T>::const_iterator QMultiHash::constFind(const Key &key, const T &value) const
+ \fn template <class Key, class T> typename QHash<Key, T>::const_iterator QMultiHash<Key, T>::constFind(const Key &key, const T &value) const
\since 4.3
Returns an iterator pointing to the item with the \a key and the
@@ -2695,7 +2695,7 @@ uint qHash(long double key, uint seed) Q_DECL_NOTHROW
*/
/*!
- \fn uint qHash(const QHash<Key, T> &key, uint seed = 0)
+ \fn template <class Key, class T> uint qHash(const QHash<Key, T> &key, uint seed = 0)
\since 5.8
\relates QHash
@@ -2705,7 +2705,7 @@ uint qHash(long double key, uint seed) Q_DECL_NOTHROW
*/
/*!
- \fn uint qHash(const QMultiHash<Key, T> &key, uint seed = 0)
+ \fn template <class Key, class T> uint qHash(const QMultiHash<Key, T> &key, uint seed = 0)
\since 5.8
\relates QMultiHash
diff --git a/src/corelib/tools/qhash.h b/src/corelib/tools/qhash.h
index 715acc77ce..e7ce4b658f 100644
--- a/src/corelib/tools/qhash.h
+++ b/src/corelib/tools/qhash.h
@@ -315,7 +315,7 @@ public:
typedef T *pointer;
typedef T &reference;
- inline iterator() : i(Q_NULLPTR) { }
+ inline iterator() : i(nullptr) { }
explicit inline iterator(void *node) : i(reinterpret_cast<QHashData::Node *>(node)) { }
inline const Key &key() const { return concrete(i)->key; }
@@ -373,7 +373,7 @@ public:
typedef const T *pointer;
typedef const T &reference;
- Q_DECL_CONSTEXPR inline const_iterator() : i(Q_NULLPTR) { }
+ Q_DECL_CONSTEXPR inline const_iterator() : i(nullptr) { }
explicit inline const_iterator(void *node)
: i(reinterpret_cast<QHashData::Node *>(node)) { }
#ifdef QT_STRICT_ITERATORS
@@ -502,7 +502,7 @@ public:
private:
void detach_helper();
void freeData(QHashData *d);
- Node **findNode(const Key &key, uint *hp = Q_NULLPTR) const;
+ Node **findNode(const Key &key, uint *hp = nullptr) const;
Node **findNode(const Key &key, uint h) const;
Node *createNode(uint h, const Key &key, const T &value, Node **nextNode);
void deleteNode(Node *node);
@@ -550,7 +550,7 @@ template <class Key, class T>
Q_INLINE_TEMPLATE void QHash<Key, T>::duplicateNode(QHashData::Node *node, void *newNode)
{
Node *concreteNode = concrete(node);
- new (newNode) Node(concreteNode->key, concreteNode->value, concreteNode->h, Q_NULLPTR);
+ new (newNode) Node(concreteNode->key, concreteNode->value, concreteNode->h, nullptr);
}
template <class Key, class T>
diff --git a/src/corelib/tools/qhashfunctions.h b/src/corelib/tools/qhashfunctions.h
index f75b310e4e..e6ae7a0b85 100644
--- a/src/corelib/tools/qhashfunctions.h
+++ b/src/corelib/tools/qhashfunctions.h
@@ -90,7 +90,7 @@ Q_DECL_CONST_FUNCTION Q_DECL_CONSTEXPR inline uint qHash(quint64 key, uint seed
Q_DECL_CONST_FUNCTION Q_DECL_CONSTEXPR inline uint qHash(qint64 key, uint seed = 0) Q_DECL_NOTHROW { return qHash(quint64(key), seed); }
Q_CORE_EXPORT Q_DECL_CONST_FUNCTION uint qHash(float key, uint seed = 0) Q_DECL_NOTHROW;
Q_CORE_EXPORT Q_DECL_CONST_FUNCTION uint qHash(double key, uint seed = 0) Q_DECL_NOTHROW;
-#ifndef Q_OS_DARWIN
+#if !defined(Q_OS_DARWIN) || defined(Q_CLANG_QDOC)
Q_CORE_EXPORT Q_DECL_CONST_FUNCTION uint qHash(long double key, uint seed = 0) Q_DECL_NOTHROW;
#endif
Q_DECL_CONST_FUNCTION Q_DECL_CONSTEXPR inline uint qHash(const QChar key, uint seed = 0) Q_DECL_NOTHROW { return qHash(key.unicode(), seed); }
diff --git a/src/corelib/tools/qiterator.qdoc b/src/corelib/tools/qiterator.qdoc
index 77cc412602..1a70784fab 100644
--- a/src/corelib/tools/qiterator.qdoc
+++ b/src/corelib/tools/qiterator.qdoc
@@ -25,6 +25,128 @@
**
****************************************************************************/
+/*! \class QKeyValueIterator
+ \inmodule QtCore
+ \since 5.10
+
+ \brief Iterator over the key/value pairs of an associative container.
+
+ The QKeyValueIterator class provides an STL-style iterator for returning
+ key/value pairs from associative containers like QHash and QMap. It
+ supports the same API as the STL associative containers, i.e. getting a
+ key/value pair when iterating through the container.
+
+ This will allow for better interoperability between QMap, QHash and friends
+ and STL-style algorithms.
+
+ \warning Iterators on implicitly shared containers do not work
+ exactly like STL-iterators. You should avoid copying a container
+ while iterators are active on that container. For more information,
+ read \l{Implicit sharing iterator problem}.
+*/
+
+/*! \typedef QKeyValueIterator::iterator_category
+ \internal
+*/
+
+/*! \typedef QKeyValueIterator::difference_type
+ \internal
+*/
+
+/*! \typedef QKeyValueIterator::value_type
+ \internal
+*/
+
+/*! \typedef QKeyValueIterator::pointer
+ \internal
+*/
+
+/*! \typedef QKeyValueIterator::reference
+ \internal
+*/
+
+/*! \fn template<typename Key, typename T, class Iterator> QKeyValueIterator<Key, T, Iterator>::QKeyValueIterator()
+
+ Constructs a default QKeyValueIterator.
+*/
+
+/*! \fn template<typename Key, typename T, class Iterator> QKeyValueIterator<Key, T, Iterator>::QKeyValueIterator(Iterator o)
+
+ Constructs a QKeyValueIterator on top of \a o.
+*/
+
+/*! \fn template<typename Key, typename T, class Iterator> const T &QKeyValueIterator<Key, T, Iterator>::operator*() const
+
+ Returns the current entry as a pair.
+*/
+
+/*! \fn template<typename Key, typename T, class Iterator> bool operator==(QKeyValueIterator<Key, T, Iterator> lhs, QKeyValueIterator<Key, T, Iterator> rhs)
+ \relates QKeyValueIterator
+
+ Returns \c true if \a rhs points to the same item as \a lhs otherwise returns
+ \c false.
+
+ \sa operator!=()
+*/
+
+/*! \fn template<typename Key, typename T, class Iterator> bool operator!=(QKeyValueIterator<Key, T, Iterator> lhs, QKeyValueIterator<Key, T, Iterator> rhs) const
+ \relates QKeyValueIterator
+
+ Returns \c true if \a rhs points to a different item than \a lhs otherwise
+ returns \c false.
+
+ \sa operator==()
+*/
+
+/*!
+ \fn template<typename Key, typename T, class Iterator> QKeyValueIterator &QKeyValueIterator<Key, T, Iterator>::operator++()
+
+ The prefix ++ operator (\c{++i}) advances the iterator to the
+ next item in the container and returns the iterator.
+
+ \note Advancing the iterator past its container's end() constitutes
+ undefined behavior.
+
+ \sa operator--()
+*/
+
+/*! \fn template<typename Key, typename T, class Iterator> QKeyValueIterator QKeyValueIterator<Key, T, Iterator>::operator++(int)
+
+ \overload
+
+ The postfix ++ operator (\c{i++}) advances the iterator to the
+ next item in the container and returns the iterator's prior value.
+
+ \note Advancing the iterator past its container's end() constitutes
+ undefined behavior.
+*/
+
+/*! \fn template<typename Key, typename T, class Iterator> QKeyValueIterator &QKeyValueIterator<Key, T, Iterator>::operator--()
+
+ The prefix -- operator (\c{--i}) backs the iterator up to the previous item
+ in the container and returns the iterator.
+
+ \note Backing up an iterator to before its container's begin() constitutes
+ undefined behavior.
+
+ \sa operator++()
+*/
+
+/*! \fn template<typename Key, typename T, class Iterator> QKeyValueIterator QKeyValueIterator<Key, T, Iterator>::operator--(int)
+
+ \overload
+
+ The postfix -- operator (\c{i--}) backs the iterator up to the previous item
+ in the container and returns the iterator's prior value.
+
+ \note Backing up an iterator to before its container's begin() constitutes
+ undefined behavior.
+*/
+
+/*! \fn template<typename Key, typename T, class Iterator> Iterator QKeyValueIterator<Key, T, Iterator>::base() const
+ Returns the underlying iterator this QKeyValueIterator is based on.
+*/
+
/*!
\class QListIterator
\inmodule QtCore
@@ -470,10 +592,10 @@
*/
/*!
- \fn QListIterator::QListIterator(const QList<T> &list)
- \fn QLinkedListIterator::QLinkedListIterator(const QLinkedList<T> &list)
- \fn QMutableListIterator::QMutableListIterator(QList<T> &list)
- \fn QMutableLinkedListIterator::QMutableLinkedListIterator(QLinkedList<T> &list)
+ \fn template <class T> QListIterator<T>::QListIterator(const QList<T> &list)
+ \fn template <class T> QLinkedListIterator<T>::QLinkedListIterator(const QLinkedList<T> &list)
+ \fn template <class T> QMutableListIterator<T>::QMutableListIterator(QList<T> &list)
+ \fn template <class T> QMutableLinkedListIterator<T>::QMutableLinkedListIterator(QLinkedList<T> &list)
Constructs an iterator for traversing \a list. The iterator is
set to be at the front of the list (before the first item).
@@ -482,8 +604,8 @@
*/
/*!
- \fn QVectorIterator::QVectorIterator(const QVector<T> &vector)
- \fn QMutableVectorIterator::QMutableVectorIterator(QVector<T> &vector)
+ \fn template <class T> QVectorIterator<T>::QVectorIterator(const QVector<T> &vector)
+ \fn template <class T> QMutableVectorIterator<T>::QMutableVectorIterator(QVector<T> &vector)
Constructs an iterator for traversing \a vector. The iterator is
set to be at the front of the vector (before the first item).
@@ -492,8 +614,8 @@
*/
/*!
- \fn QSetIterator::QSetIterator(const QSet<T> &set)
- \fn QMutableSetIterator::QMutableSetIterator(QSet<T> &set)
+ \fn template <class T> QSetIterator<T>::QSetIterator(const QSet<T> &set)
+ \fn template <class T> QMutableSetIterator<T>::QMutableSetIterator(QSet<T> &set)
Constructs an iterator for traversing \a set. The iterator is
set to be at the front of the set (before the first item).
@@ -501,10 +623,10 @@
\sa operator=()
*/
-/*! \fn QMutableListIterator &QMutableListIterator::operator=(QList<T> &list)
- \fn QMutableLinkedListIterator &QMutableLinkedListIterator::operator=(QLinkedList<T> &list)
- \fn QListIterator &QListIterator::operator=(const QList<T> &list)
- \fn QLinkedListIterator &QLinkedListIterator::operator=(const QLinkedList<T> &list)
+/*! \fn template <class T> QMutableListIterator &QMutableListIterator<T>::operator=(QList<T> &list)
+ \fn template <class T> QMutableLinkedListIterator &QMutableLinkedListIterator<T>::operator=(QLinkedList<T> &list)
+ \fn template <class T> QListIterator &QListIterator<T>::operator=(const QList<T> &list)
+ \fn template <class T> QLinkedListIterator &QLinkedListIterator<T>::operator=(const QLinkedList<T> &list)
Makes the iterator operate on \a list. The iterator is set to be
at the front of the list (before the first item).
@@ -512,8 +634,8 @@
\sa toFront(), toBack()
*/
-/*! \fn QVectorIterator &QVectorIterator::operator=(const QVector<T> &vector)
- \fn QMutableVectorIterator &QMutableVectorIterator::operator=(QVector<T> &vector)
+/*! \fn template <class T> QVectorIterator &QVectorIterator<T>::operator=(const QVector<T> &vector)
+ \fn template <class T> QMutableVectorIterator &QMutableVectorIterator<T>::operator=(QVector<T> &vector)
Makes the iterator operate on \a vector. The iterator is set to be
at the front of the vector (before the first item).
@@ -521,8 +643,8 @@
\sa toFront(), toBack()
*/
-/*! \fn QSetIterator &QSetIterator::operator=(const QSet<T> &set)
- \fn QMutableSetIterator &QMutableSetIterator::operator=(QSet<T> &set)
+/*! \fn template <class T> QSetIterator &QSetIterator<T>::operator=(const QSet<T> &set)
+ \fn template <class T> QMutableSetIterator &QMutableSetIterator<T>::operator=(QSet<T> &set)
Makes the iterator operate on \a set. The iterator is set to be
at the front of the set (before the first item).
@@ -530,14 +652,14 @@
\sa toFront(), toBack()
*/
-/*! \fn void QListIterator::toFront()
- \fn void QLinkedListIterator::toFront()
- \fn void QVectorIterator::toFront()
- \fn void QSetIterator::toFront()
- \fn void QMutableListIterator::toFront()
- \fn void QMutableLinkedListIterator::toFront()
- \fn void QMutableVectorIterator::toFront()
- \fn void QMutableSetIterator::toFront()
+/*! \fn template <class T> void QListIterator<T>::toFront()
+ \fn template <class T> void QLinkedListIterator<T>::toFront()
+ \fn template <class T> void QVectorIterator<T>::toFront()
+ \fn template <class T> void QSetIterator<T>::toFront()
+ \fn template <class T> void QMutableListIterator<T>::toFront()
+ \fn template <class T> void QMutableLinkedListIterator<T>::toFront()
+ \fn template <class T> void QMutableVectorIterator<T>::toFront()
+ \fn template <class T> void QMutableSetIterator<T>::toFront()
Moves the iterator to the front of the container (before the
first item).
@@ -545,14 +667,14 @@
\sa toBack(), next()
*/
-/*! \fn void QListIterator::toBack()
- \fn void QLinkedListIterator::toBack()
- \fn void QVectorIterator::toBack()
- \fn void QSetIterator::toBack()
- \fn void QMutableListIterator::toBack()
- \fn void QMutableLinkedListIterator::toBack()
- \fn void QMutableVectorIterator::toBack()
- \fn void QMutableSetIterator::toBack()
+/*! \fn template <class T> void QListIterator<T>::toBack()
+ \fn template <class T> void QLinkedListIterator<T>::toBack()
+ \fn template <class T> void QVectorIterator<T>::toBack()
+ \fn template <class T> void QSetIterator<T>::toBack()
+ \fn template <class T> void QMutableListIterator<T>::toBack()
+ \fn template <class T> void QMutableLinkedListIterator<T>::toBack()
+ \fn template <class T> void QMutableVectorIterator<T>::toBack()
+ \fn template <class T> void QMutableSetIterator<T>::toBack()
Moves the iterator to the back of the container (after the last
item).
@@ -560,14 +682,14 @@
\sa toFront(), previous()
*/
-/*! \fn bool QListIterator::hasNext() const
- \fn bool QLinkedListIterator::hasNext() const
- \fn bool QVectorIterator::hasNext() const
- \fn bool QSetIterator::hasNext() const
- \fn bool QMutableListIterator::hasNext() const
- \fn bool QMutableLinkedListIterator::hasNext() const
- \fn bool QMutableVectorIterator::hasNext() const
- \fn bool QMutableSetIterator::hasNext() const
+/*! \fn template <class T> bool QListIterator<T>::hasNext() const
+ \fn template <class T> bool QLinkedListIterator<T>::hasNext() const
+ \fn template <class T> bool QVectorIterator<T>::hasNext() const
+ \fn template <class T> bool QSetIterator<T>::hasNext() const
+ \fn template <class T> bool QMutableListIterator<T>::hasNext() const
+ \fn template <class T> bool QMutableLinkedListIterator<T>::hasNext() const
+ \fn template <class T> bool QMutableVectorIterator<T>::hasNext() const
+ \fn template <class T> bool QMutableSetIterator<T>::hasNext() const
Returns \c true if there is at least one item ahead of the iterator,
i.e. the iterator is \e not at the back of the container;
@@ -576,11 +698,11 @@
\sa hasPrevious(), next()
*/
-/*! \fn const T &QListIterator::next()
- \fn const T &QLinkedListIterator::next()
- \fn const T &QVectorIterator::next()
- \fn const T &QSetIterator::next()
- \fn const T &QMutableSetIterator::next()
+/*! \fn template <class T> const T &QListIterator<T>::next()
+ \fn template <class T> const T &QLinkedListIterator<T>::next()
+ \fn template <class T> const T &QVectorIterator<T>::next()
+ \fn template <class T> const T &QSetIterator<T>::next()
+ \fn template <class T> const T &QMutableSetIterator<T>::next()
Returns the next item and advances the iterator by one position.
@@ -590,9 +712,9 @@
\sa hasNext(), peekNext(), previous()
*/
-/*! \fn T &QMutableListIterator::next()
- \fn T &QMutableLinkedListIterator::next()
- \fn T &QMutableVectorIterator::next()
+/*! \fn template <class T> T &QMutableListIterator<T>::next()
+ \fn template <class T> T &QMutableLinkedListIterator<T>::next()
+ \fn template <class T> T &QMutableVectorIterator<T>::next()
Returns a reference to the next item, and advances the iterator
by one position.
@@ -603,11 +725,11 @@
\sa hasNext(), peekNext(), previous()
*/
-/*! \fn const T &QListIterator::peekNext() const
- \fn const T &QLinkedListIterator::peekNext() const
- \fn const T &QVectorIterator::peekNext() const
- \fn const T &QSetIterator::peekNext() const
- \fn const T &QMutableSetIterator::peekNext() const
+/*! \fn template <class T> const T &QListIterator<T>::peekNext() const
+ \fn template <class T> const T &QLinkedListIterator<T>::peekNext() const
+ \fn template <class T> const T &QVectorIterator<T>::peekNext() const
+ \fn template <class T> const T &QSetIterator<T>::peekNext() const
+ \fn template <class T> const T &QMutableSetIterator<T>::peekNext() const
Returns the next item without moving the iterator.
@@ -617,9 +739,9 @@
\sa hasNext(), next(), peekPrevious()
*/
-/*! \fn T &QMutableListIterator::peekNext() const
- \fn T &QMutableLinkedListIterator::peekNext() const
- \fn T &QMutableVectorIterator::peekNext() const
+/*! \fn template <class T> T &QMutableListIterator<T>::peekNext() const
+ \fn template <class T> T &QMutableLinkedListIterator<T>::peekNext() const
+ \fn template <class T> T &QMutableVectorIterator<T>::peekNext() const
Returns a reference to the next item, without moving the iterator.
@@ -629,14 +751,14 @@
\sa hasNext(), next(), peekPrevious()
*/
-/*! \fn bool QListIterator::hasPrevious() const
- \fn bool QLinkedListIterator::hasPrevious() const
- \fn bool QVectorIterator::hasPrevious() const
- \fn bool QSetIterator::hasPrevious() const
- \fn bool QMutableListIterator::hasPrevious() const
- \fn bool QMutableLinkedListIterator::hasPrevious() const
- \fn bool QMutableVectorIterator::hasPrevious() const
- \fn bool QMutableSetIterator::hasPrevious() const
+/*! \fn template <class T> bool QListIterator<T>::hasPrevious() const
+ \fn template <class T> bool QLinkedListIterator<T>::hasPrevious() const
+ \fn template <class T> bool QVectorIterator<T>::hasPrevious() const
+ \fn template <class T> bool QSetIterator<T>::hasPrevious() const
+ \fn template <class T> bool QMutableListIterator<T>::hasPrevious() const
+ \fn template <class T> bool QMutableLinkedListIterator<T>::hasPrevious() const
+ \fn template <class T> bool QMutableVectorIterator<T>::hasPrevious() const
+ \fn template <class T> bool QMutableSetIterator<T>::hasPrevious() const
Returns \c true if there is at least one item behind the iterator,
i.e. the iterator is \e not at the front of the container;
@@ -645,11 +767,11 @@
\sa hasNext(), previous()
*/
-/*! \fn const T &QListIterator::previous()
- \fn const T &QLinkedListIterator::previous()
- \fn const T &QVectorIterator::previous()
- \fn const T &QSetIterator::previous()
- \fn const T &QMutableSetIterator::previous()
+/*! \fn template <class T> const T &QListIterator<T>::previous()
+ \fn template <class T> const T &QLinkedListIterator<T>::previous()
+ \fn template <class T> const T &QVectorIterator<T>::previous()
+ \fn template <class T> const T &QSetIterator<T>::previous()
+ \fn template <class T> const T &QMutableSetIterator<T>::previous()
Returns the previous item and moves the iterator back by one
position.
@@ -660,9 +782,9 @@
\sa hasPrevious(), peekPrevious(), next()
*/
-/*! \fn T &QMutableListIterator::previous()
- \fn T &QMutableLinkedListIterator::previous()
- \fn T &QMutableVectorIterator::previous()
+/*! \fn template <class T> T &QMutableListIterator<T>::previous()
+ \fn template <class T> T &QMutableLinkedListIterator<T>::previous()
+ \fn template <class T> T &QMutableVectorIterator<T>::previous()
Returns a reference to the previous item and moves the iterator
back by one position.
@@ -673,11 +795,11 @@
\sa hasPrevious(), peekPrevious(), next()
*/
-/*! \fn const T &QListIterator::peekPrevious() const
- \fn const T &QLinkedListIterator::peekPrevious() const
- \fn const T &QVectorIterator::peekPrevious() const
- \fn const T &QSetIterator::peekPrevious() const
- \fn const T &QMutableSetIterator::peekPrevious() const
+/*! \fn template <class T> const T &QListIterator<T>::peekPrevious() const
+ \fn template <class T> const T &QLinkedListIterator<T>::peekPrevious() const
+ \fn template <class T> const T &QVectorIterator<T>::peekPrevious() const
+ \fn template <class T> const T &QSetIterator<T>::peekPrevious() const
+ \fn template <class T> const T &QMutableSetIterator<T>::peekPrevious() const
Returns the previous item without moving the iterator.
@@ -687,9 +809,9 @@
\sa hasPrevious(), previous(), peekNext()
*/
-/*! \fn T &QMutableListIterator::peekPrevious() const
- \fn T &QMutableLinkedListIterator::peekPrevious() const
- \fn T &QMutableVectorIterator::peekPrevious() const
+/*! \fn template <class T> T &QMutableListIterator<T>::peekPrevious() const
+ \fn template <class T> T &QMutableLinkedListIterator<T>::peekPrevious() const
+ \fn template <class T> T &QMutableVectorIterator<T>::peekPrevious() const
Returns a reference to the previous item, without moving the iterator.
@@ -699,14 +821,14 @@
\sa hasPrevious(), previous(), peekNext()
*/
-/*! \fn bool QListIterator::findNext(const T &value)
- \fn bool QLinkedListIterator::findNext(const T &value)
- \fn bool QVectorIterator::findNext(const T &value)
- \fn bool QSetIterator::findNext(const T &value)
- \fn bool QMutableListIterator::findNext(const T &value)
- \fn bool QMutableLinkedListIterator::findNext(const T &value)
- \fn bool QMutableVectorIterator::findNext(const T &value)
- \fn bool QMutableSetIterator::findNext(const T &value)
+/*! \fn template <class T> bool QListIterator<T>::findNext(const T &value)
+ \fn template <class T> bool QLinkedListIterator<T>::findNext(const T &value)
+ \fn template <class T> bool QVectorIterator<T>::findNext(const T &value)
+ \fn template <class T> bool QSetIterator<T>::findNext(const T &value)
+ \fn template <class T> bool QMutableListIterator<T>::findNext(const T &value)
+ \fn template <class T> bool QMutableLinkedListIterator<T>::findNext(const T &value)
+ \fn template <class T> bool QMutableVectorIterator<T>::findNext(const T &value)
+ \fn template <class T> bool QMutableSetIterator<T>::findNext(const T &value)
Searches for \a value starting from the current iterator position
forward. Returns \c true if \a value is found; otherwise returns \c false.
@@ -718,14 +840,14 @@
\sa findPrevious()
*/
-/*! \fn bool QListIterator::findPrevious(const T &value)
- \fn bool QLinkedListIterator::findPrevious(const T &value)
- \fn bool QVectorIterator::findPrevious(const T &value)
- \fn bool QSetIterator::findPrevious(const T &value)
- \fn bool QMutableListIterator::findPrevious(const T &value)
- \fn bool QMutableLinkedListIterator::findPrevious(const T &value)
- \fn bool QMutableVectorIterator::findPrevious(const T &value)
- \fn bool QMutableSetIterator::findPrevious(const T &value)
+/*! \fn template <class T> bool QListIterator<T>::findPrevious(const T &value)
+ \fn template <class T> bool QLinkedListIterator<T>::findPrevious(const T &value)
+ \fn template <class T> bool QVectorIterator<T>::findPrevious(const T &value)
+ \fn template <class T> bool QSetIterator<T>::findPrevious(const T &value)
+ \fn template <class T> bool QMutableListIterator<T>::findPrevious(const T &value)
+ \fn template <class T> bool QMutableLinkedListIterator<T>::findPrevious(const T &value)
+ \fn template <class T> bool QMutableVectorIterator<T>::findPrevious(const T &value)
+ \fn template <class T> bool QMutableSetIterator<T>::findPrevious(const T &value)
Searches for \a value starting from the current iterator position
backward. Returns \c true if \a value is found; otherwise returns
@@ -738,7 +860,7 @@
\sa findNext()
*/
-/*! \fn void QMutableListIterator::remove()
+/*! \fn template <class T> void QMutableListIterator<T>::remove()
Removes the last item that was jumped over using one of the
traversal functions (next(), previous(), findNext(), findPrevious()).
@@ -749,7 +871,7 @@
\sa insert(), setValue()
*/
-/*! \fn void QMutableLinkedListIterator::remove()
+/*! \fn template <class T> void QMutableLinkedListIterator<T>::remove()
Removes the last item that was jumped over using one of the
traversal functions (next(), previous(), findNext(), findPrevious()).
@@ -760,7 +882,7 @@
\sa insert(), setValue()
*/
-/*! \fn void QMutableVectorIterator::remove()
+/*! \fn template <class T> void QMutableVectorIterator<T>::remove()
Removes the last item that was jumped over using one of the
traversal functions (next(), previous(), findNext(), findPrevious()).
@@ -771,7 +893,7 @@
\sa insert(), setValue()
*/
-/*! \fn void QMutableSetIterator::remove()
+/*! \fn template <class T> void QMutableSetIterator<T>::remove()
Removes the last item that was jumped over using one of the
traversal functions (next(), previous(), findNext(), findPrevious()).
@@ -782,7 +904,7 @@
\sa value()
*/
-/*! \fn void QMutableListIterator::setValue(const T &value) const
+/*! \fn template <class T> void QMutableListIterator<T>::setValue(const T &value) const
Replaces the value of the last item that was jumped over using
one of the traversal functions with \a value.
@@ -796,7 +918,7 @@
\sa value(), remove(), insert()
*/
-/*! \fn void QMutableLinkedListIterator::setValue(const T &value) const
+/*! \fn template <class T> void QMutableLinkedListIterator<T>::setValue(const T &value) const
Replaces the value of the last item that was jumped over using
one of the traversal functions with \a value.
@@ -810,7 +932,7 @@
\sa value(), remove(), insert()
*/
-/*! \fn void QMutableVectorIterator::setValue(const T &value) const
+/*! \fn template <class T> void QMutableVectorIterator<T>::setValue(const T &value) const
Replaces the value of the last item that was jumped over using
one of the traversal functions with \a value.
@@ -824,10 +946,10 @@
\sa value(), remove(), insert()
*/
-/*! \fn const T &QMutableListIterator::value() const
- \fn const T &QMutableLinkedListIterator::value() const
- \fn const T &QMutableVectorIterator::value() const
- \fn const T &QMutableSetIterator::value() const
+/*! \fn template <class T> const T &QMutableListIterator<T>::value() const
+ \fn template <class T> const T &QMutableLinkedListIterator<T>::value() const
+ \fn template <class T> const T &QMutableVectorIterator<T>::value() const
+ \fn template <class T> const T &QMutableSetIterator<T>::value() const
Returns the value of the last item that was jumped over using one
of the traversal functions (next(), previous(), findNext(),
@@ -839,18 +961,18 @@
*/
/*!
- \fn T &QMutableListIterator::value()
- \fn T &QMutableLinkedListIterator::value()
- \fn T &QMutableVectorIterator::value()
+ \fn template <class T> T &QMutableListIterator<T>::value()
+ \fn template <class T> T &QMutableLinkedListIterator<T>::value()
+ \fn template <class T> T &QMutableVectorIterator<T>::value()
\overload
Returns a non-const reference to the value of the last item that
was jumped over using one of the traversal functions.
*/
-/*! \fn void QMutableListIterator::insert(const T &value)
- \fn void QMutableLinkedListIterator::insert(const T &value)
- \fn void QMutableVectorIterator::insert(const T &value)
+/*! \fn template <class T> void QMutableListIterator<T>::insert(const T &value)
+ \fn template <class T> void QMutableLinkedListIterator<T>::insert(const T &value)
+ \fn template <class T> void QMutableVectorIterator<T>::insert(const T &value)
Inserts \a value at the current iterator position. After the
call, the iterator is located just after the inserted item.
@@ -1092,8 +1214,8 @@
\sa QHashIterator, QHash::iterator
*/
-/*! \fn QMapIterator::QMapIterator(const QMap<Key, T> &map)
- \fn QMutableMapIterator::QMutableMapIterator(QMap<Key, T> &map)
+/*! \fn template <class Key, class T> QMapIterator<Key, T>::QMapIterator(const QMap<Key, T> &map)
+ \fn template <class Key, class T> QMutableMapIterator<Key, T>::QMutableMapIterator(QMap<Key, T> &map)
Constructs an iterator for traversing \a map. The iterator is set
to be at the front of the map (before the first item).
@@ -1101,8 +1223,8 @@
\sa operator=()
*/
-/*! \fn QHashIterator::QHashIterator(const QHash<Key, T> &hash)
- \fn QMutableHashIterator::QMutableHashIterator(QHash<Key, T> &hash)
+/*! \fn template <class Key, class T> QHashIterator<Key, T>::QHashIterator(const QHash<Key, T> &hash)
+ \fn template <class Key, class T> QMutableHashIterator<Key, T>::QMutableHashIterator(QHash<Key, T> &hash)
Constructs an iterator for traversing \a hash. The iterator is
set to be at the front of the hash (before the first item).
@@ -1110,8 +1232,8 @@
\sa operator=()
*/
-/*! \fn QMapIterator &QMapIterator::operator=(const QMap<Key, T> &map)
- \fn QMutableMapIterator &QMutableMapIterator::operator=(QMap<Key, T> &map)
+/*! \fn template <class Key, class T> QMapIterator &QMapIterator<Key, T>::operator=(const QMap<Key, T> &map)
+ \fn template <class Key, class T> QMutableMapIterator &QMutableMapIterator<Key, T>::operator=(QMap<Key, T> &map)
Makes the iterator operate on \a map. The iterator is set to be
at the front of the map (before the first item).
@@ -1119,8 +1241,8 @@
\sa toFront(), toBack()
*/
-/*! \fn QHashIterator &QHashIterator::operator=(const QHash<Key, T> &hash)
- \fn QMutableHashIterator &QMutableHashIterator::operator=(QHash<Key, T> &hash)
+/*! \fn template <class Key, class T> QHashIterator &QHashIterator<Key, T>::operator=(const QHash<Key, T> &hash)
+ \fn template <class Key, class T> QMutableHashIterator &QMutableHashIterator<Key, T>::operator=(QHash<Key, T> &hash)
Makes the iterator operate on \a hash. The iterator is set to be
at the front of the hash (before the first item).
@@ -1128,10 +1250,10 @@
\sa toFront(), toBack()
*/
-/*! \fn void QMapIterator::toFront()
- \fn void QHashIterator::toFront()
- \fn void QMutableMapIterator::toFront()
- \fn void QMutableHashIterator::toFront()
+/*! \fn template <class Key, class T> void QMapIterator<Key, T>::toFront()
+ \fn template <class Key, class T> void QHashIterator<Key, T>::toFront()
+ \fn template <class Key, class T> void QMutableMapIterator<Key, T>::toFront()
+ \fn template <class Key, class T> void QMutableHashIterator<Key, T>::toFront()
Moves the iterator to the front of the container (before the
first item).
@@ -1139,10 +1261,10 @@
\sa toBack(), next()
*/
-/*! \fn void QMapIterator::toBack()
- \fn void QHashIterator::toBack()
- \fn void QMutableMapIterator::toBack()
- \fn void QMutableHashIterator::toBack()
+/*! \fn template <class Key, class T> void QMapIterator<Key, T>::toBack()
+ \fn template <class Key, class T> void QHashIterator<Key, T>::toBack()
+ \fn template <class Key, class T> void QMutableMapIterator<Key, T>::toBack()
+ \fn template <class Key, class T> void QMutableHashIterator<Key, T>::toBack()
Moves the iterator to the back of the container (after the last
item).
@@ -1150,10 +1272,10 @@
\sa toFront(), previous()
*/
-/*! \fn bool QMapIterator::hasNext() const
- \fn bool QHashIterator::hasNext() const
- \fn bool QMutableMapIterator::hasNext() const
- \fn bool QMutableHashIterator::hasNext() const
+/*! \fn template <class Key, class T> bool QMapIterator<Key, T>::hasNext() const
+ \fn template <class Key, class T> bool QHashIterator<Key, T>::hasNext() const
+ \fn template <class Key, class T> bool QMutableMapIterator<Key, T>::hasNext() const
+ \fn template <class Key, class T> bool QMutableHashIterator<Key, T>::hasNext() const
Returns \c true if there is at least one item ahead of the iterator,
i.e. the iterator is \e not at the back of the container;
@@ -1162,8 +1284,8 @@
\sa hasPrevious(), next()
*/
-/*! \fn QMapIterator::Item QMapIterator::next()
- \fn QHashIterator::Item QHashIterator::next()
+/*! \fn template <class Key, class T> QMapIterator<Key, T>::Item QMapIterator<Key, T>::next()
+ \fn template <class Key, class T> QHashIterator<Key, T>::Item QHashIterator<Key, T>::next()
Returns the next item and advances the iterator by one position.
@@ -1176,8 +1298,8 @@
\sa hasNext(), peekNext(), previous()
*/
-/*! \fn QMutableMapIterator::Item QMutableMapIterator::next()
- \fn QMutableHashIterator::Item QMutableHashIterator::next()
+/*! \fn template <class Key, class T> QMutableMapIterator<Key, T>::Item QMutableMapIterator<Key, T>::next()
+ \fn template <class Key, class T> QMutableHashIterator<Key, T>::Item QMutableHashIterator<Key, T>::next()
Returns the next item and advances the iterator by one position.
@@ -1190,8 +1312,8 @@
\sa hasNext(), peekNext(), previous()
*/
-/*! \fn QMapIterator::Item QMapIterator::peekNext() const
- \fn QHashIterator::Item QHashIterator::peekNext() const
+/*! \fn template <class Key, class T> QMapIterator<Key, T>::Item QMapIterator<Key, T>::peekNext() const
+ \fn template <class Key, class T> QHashIterator<Key, T>::Item QHashIterator<Key, T>::peekNext() const
Returns the next item without moving the iterator.
@@ -1204,8 +1326,8 @@
\sa hasNext(), next(), peekPrevious()
*/
-/*! \fn QMutableMapIterator::Item QMutableMapIterator::peekNext() const
- \fn QMutableHashIterator::Item QMutableHashIterator::peekNext() const
+/*! \fn template <class Key, class T> QMutableMapIterator<Key, T>::Item QMutableMapIterator<Key, T>::peekNext() const
+ \fn template <class Key, class T> QMutableHashIterator<Key, T>::Item QMutableHashIterator<Key, T>::peekNext() const
Returns a reference to the next item without moving the iterator.
@@ -1218,10 +1340,10 @@
\sa hasNext(), next(), peekPrevious()
*/
-/*! \fn bool QMapIterator::hasPrevious() const
- \fn bool QHashIterator::hasPrevious() const
- \fn bool QMutableMapIterator::hasPrevious() const
- \fn bool QMutableHashIterator::hasPrevious() const
+/*! \fn template <class Key, class T> bool QMapIterator<Key, T>::hasPrevious() const
+ \fn template <class Key, class T> bool QHashIterator<Key, T>::hasPrevious() const
+ \fn template <class Key, class T> bool QMutableMapIterator<Key, T>::hasPrevious() const
+ \fn template <class Key, class T> bool QMutableHashIterator<Key, T>::hasPrevious() const
Returns \c true if there is at least one item behind the iterator,
i.e. the iterator is \e not at the front of the container;
@@ -1230,8 +1352,8 @@
\sa hasNext(), previous()
*/
-/*! \fn QMapIterator::Item QMapIterator::previous()
- \fn QHashIterator::Item QHashIterator::previous()
+/*! \fn template <class Key, class T> QMapIterator<Key, T>::Item QMapIterator<Key, T>::previous()
+ \fn template <class Key, class T> QHashIterator<Key, T>::Item QHashIterator<Key, T>::previous()
Returns the previous item and moves the iterator back by one
position.
@@ -1245,8 +1367,8 @@
\sa hasPrevious(), peekPrevious(), next()
*/
-/*! \fn QMutableMapIterator::Item QMutableMapIterator::previous()
- \fn QMutableHashIterator::Item QMutableHashIterator::previous()
+/*! \fn template <class Key, class T> QMutableMapIterator<Key, T>::Item QMutableMapIterator<Key, T>::previous()
+ \fn template <class Key, class T> QMutableHashIterator<Key, T>::Item QMutableHashIterator<Key, T>::previous()
Returns the previous item and moves the iterator back by one
position.
@@ -1260,8 +1382,8 @@
\sa hasPrevious(), peekPrevious(), next()
*/
-/*! \fn QMapIterator::Item QMapIterator::peekPrevious() const
- \fn QHashIterator::Item QHashIterator::peekPrevious() const
+/*! \fn template <class Key, class T> QMapIterator<Key, T>::Item QMapIterator<Key, T>::peekPrevious() const
+ \fn template <class Key, class T> QHashIterator<Key, T>::Item QHashIterator<Key, T>::peekPrevious() const
Returns the previous item without moving the iterator.
@@ -1274,8 +1396,8 @@
\sa hasPrevious(), previous(), peekNext()
*/
-/*! \fn QMutableMapIterator::Item QMutableMapIterator::peekPrevious() const
- \fn QMutableHashIterator::Item QMutableHashIterator::peekPrevious() const
+/*! \fn template <class Key, class T> QMutableMapIterator<Key, T>::Item QMutableMapIterator<Key, T>::peekPrevious() const
+ \fn template <class Key, class T> QMutableHashIterator<Key, T>::Item QMutableHashIterator<Key, T>::peekPrevious() const
Returns the previous item without moving the iterator.
@@ -1288,8 +1410,8 @@
\sa hasPrevious(), previous(), peekNext()
*/
-/*! \fn const T &QMapIterator::value() const
- \fn const T &QHashIterator::value() const
+/*! \fn template <class Key, class T> const T &QMapIterator<Key, T>::value() const
+ \fn template <class Key, class T> const T &QHashIterator<Key, T>::value() const
Returns the value of the last item that was jumped over using one
of the traversal functions (next(), previous(), findNext(),
@@ -1303,8 +1425,8 @@
*/
/*!
- \fn const T &QMutableMapIterator::value() const
- \fn const T &QMutableHashIterator::value() const
+ \fn template <class Key, class T> const T &QMutableMapIterator<Key, T>::value() const
+ \fn template <class Key, class T> const T &QMutableHashIterator<Key, T>::value() const
Returns the value of the last item that was jumped over using one
of the traversal functions (next(), previous(), findNext(),
@@ -1318,8 +1440,8 @@
*/
/*!
- \fn T &QMutableMapIterator::value()
- \fn T &QMutableHashIterator::value()
+ \fn template <class Key, class T> T &QMutableMapIterator<Key, T>::value()
+ \fn template <class Key, class T> T &QMutableHashIterator<Key, T>::value()
\overload
Returns a non-const reference to the value of
@@ -1327,10 +1449,10 @@
of the traversal functions.
*/
-/*! \fn const Key &QMapIterator::key() const
- \fn const Key &QHashIterator::key() const
- \fn const Key &QMutableMapIterator::key() const
- \fn const Key &QMutableHashIterator::key() const
+/*! \fn template <class Key, class T> const Key &QMapIterator<Key, T>::key() const
+ \fn template <class Key, class T> const Key &QHashIterator<Key, T>::key() const
+ \fn template <class Key, class T> const Key &QMutableMapIterator<Key, T>::key() const
+ \fn template <class Key, class T> const Key &QMutableHashIterator<Key, T>::key() const
Returns the key of the last item that was jumped over using one
of the traversal functions (next(), previous(), findNext(),
@@ -1343,10 +1465,10 @@
\sa value()
*/
-/*! \fn bool QMapIterator::findNext(const T &value)
- \fn bool QHashIterator::findNext(const T &value)
- \fn bool QMutableMapIterator::findNext(const T &value)
- \fn bool QMutableHashIterator::findNext(const T &value)
+/*! \fn template <class Key, class T> bool QMapIterator<Key, T>::findNext(const T &value)
+ \fn template <class Key, class T> bool QHashIterator<Key, T>::findNext(const T &value)
+ \fn template <class Key, class T> bool QMutableMapIterator<Key, T>::findNext(const T &value)
+ \fn template <class Key, class T> bool QMutableHashIterator<Key, T>::findNext(const T &value)
Searches for \a value starting from the current iterator position
forward. Returns \c true if a (key, value) pair with value \a value
@@ -1359,10 +1481,10 @@
\sa findPrevious()
*/
-/*! \fn bool QMapIterator::findPrevious(const T &value)
- \fn bool QHashIterator::findPrevious(const T &value)
- \fn bool QMutableMapIterator::findPrevious(const T &value)
- \fn bool QMutableHashIterator::findPrevious(const T &value)
+/*! \fn template <class Key, class T> bool QMapIterator<Key, T>::findPrevious(const T &value)
+ \fn template <class Key, class T> bool QHashIterator<Key, T>::findPrevious(const T &value)
+ \fn template <class Key, class T> bool QMutableMapIterator<Key, T>::findPrevious(const T &value)
+ \fn template <class Key, class T> bool QMutableHashIterator<Key, T>::findPrevious(const T &value)
Searches for \a value starting from the current iterator position
backward. Returns \c true if a (key, value) pair with value \a value
@@ -1375,8 +1497,8 @@
\sa findNext()
*/
-/*! \fn void QMutableMapIterator::remove()
- \fn void QMutableHashIterator::remove()
+/*! \fn template <class Key, class T> void QMutableMapIterator<Key, T>::remove()
+ \fn template <class Key, class T> void QMutableHashIterator<Key, T>::remove()
Removes the last item that was jumped over using one of the
traversal functions (next(), previous(), findNext(), findPrevious()).
@@ -1384,8 +1506,8 @@
\sa setValue()
*/
-/*! \fn void QMutableMapIterator::setValue(const T &value)
- \fn void QMutableHashIterator::setValue(const T &value)
+/*! \fn template <class Key, class T> void QMutableMapIterator<Key, T>::setValue(const T &value)
+ \fn template <class Key, class T> void QMutableHashIterator<Key, T>::setValue(const T &value)
Replaces the value of the last item that was jumped over using
one of the traversal functions with \a value.
diff --git a/src/corelib/tools/qlinkedlist.cpp b/src/corelib/tools/qlinkedlist.cpp
index 642d2a28a0..d9d93862e5 100644
--- a/src/corelib/tools/qlinkedlist.cpp
+++ b/src/corelib/tools/qlinkedlist.cpp
@@ -118,13 +118,13 @@ const QLinkedListData QLinkedListData::shared_null = {
\sa QLinkedListIterator, QMutableLinkedListIterator, QList, QVector
*/
-/*! \fn QLinkedList::QLinkedList()
+/*! \fn template <class T> QLinkedList<T>::QLinkedList()
Constructs an empty list.
*/
/*!
- \fn QLinkedList::QLinkedList(QLinkedList<T> &&other)
+ \fn template <class T> QLinkedList<T>::QLinkedList(QLinkedList<T> &&other)
Move-constructs a QLinkedList instance, making it point at the same
object that \a other was pointing to.
@@ -132,7 +132,7 @@ const QLinkedListData QLinkedListData::shared_null = {
\since 5.2
*/
-/*! \fn QLinkedList::QLinkedList(const QLinkedList<T> &other)
+/*! \fn template <class T> QLinkedList<T>::QLinkedList(const QLinkedList<T> &other)
Constructs a copy of \a other.
@@ -144,7 +144,7 @@ const QLinkedListData QLinkedListData::shared_null = {
\sa operator=()
*/
-/*! \fn QLinkedList::QLinkedList(std::initializer_list<T> list)
+/*! \fn template <class T> QLinkedList<T>::QLinkedList(std::initializer_list<T> list)
\since 5.2
Constructs a list from the std::initializer_list specified by \a list.
@@ -153,26 +153,26 @@ const QLinkedListData QLinkedListData::shared_null = {
initializer lists.
*/
-/*! \fn QLinkedList::~QLinkedList()
+/*! \fn template <class T> QLinkedList<T>::~QLinkedList()
Destroys the list. References to the values in the list, and all
iterators over this list, become invalid.
*/
-/*! \fn QLinkedList<T> &QLinkedList::operator=(const QLinkedList<T> &other)
+/*! \fn template <class T> QLinkedList<T> &QLinkedList<T>::operator=(const QLinkedList<T> &other)
Assigns \a other to this list and returns a reference to this
list.
*/
-/*! \fn void QLinkedList::swap(QLinkedList<T> &other)
+/*! \fn template <class T> void QLinkedList<T>::swap(QLinkedList<T> &other)
\since 4.8
Swaps list \a other with this list. This operation is very
fast and never fails.
*/
-/*! \fn bool QLinkedList::operator==(const QLinkedList<T> &other) const
+/*! \fn template <class T> bool QLinkedList<T>::operator==(const QLinkedList<T> &other) const
Returns \c true if \a other is equal to this list; otherwise returns
false.
@@ -186,7 +186,7 @@ const QLinkedListData QLinkedListData::shared_null = {
\sa operator!=()
*/
-/*! \fn bool QLinkedList::operator!=(const QLinkedList<T> &other) const
+/*! \fn template <class T> bool QLinkedList<T>::operator!=(const QLinkedList<T> &other) const
Returns \c true if \a other is not equal to this list; otherwise
returns \c false.
@@ -200,34 +200,34 @@ const QLinkedListData QLinkedListData::shared_null = {
\sa operator==()
*/
-/*! \fn int QLinkedList::size() const
+/*! \fn template <class T> int QLinkedList<T>::size() const
Returns the number of items in the list.
\sa isEmpty(), count()
*/
-/*! \fn void QLinkedList::detach()
+/*! \fn template <class T> void QLinkedList<T>::detach()
\internal
*/
-/*! \fn bool QLinkedList::isDetached() const
+/*! \fn template <class T> bool QLinkedList<T>::isDetached() const
\internal
*/
-/*! \fn void QLinkedList::setSharable(bool sharable)
+/*! \fn template <class T> void QLinkedList<T>::setSharable(bool sharable)
\internal
*/
-/*! \fn bool QLinkedList::isSharedWith(const QLinkedList<T> &other) const
+/*! \fn template <class T> bool QLinkedList<T>::isSharedWith(const QLinkedList<T> &other) const
\internal
*/
-/*! \fn bool QLinkedList::isEmpty() const
+/*! \fn template <class T> bool QLinkedList<T>::isEmpty() const
Returns \c true if the list contains no items; otherwise returns
false.
@@ -235,14 +235,14 @@ const QLinkedListData QLinkedListData::shared_null = {
\sa size()
*/
-/*! \fn void QLinkedList::clear()
+/*! \fn template <class T> void QLinkedList<T>::clear()
Removes all the items in the list.
\sa removeAll()
*/
-/*! \fn void QLinkedList::append(const T &value)
+/*! \fn template <class T> void QLinkedList<T>::append(const T &value)
Inserts \a value at the end of the list.
@@ -254,7 +254,7 @@ const QLinkedListData QLinkedListData::shared_null = {
\sa operator<<(), prepend(), insert()
*/
-/*! \fn void QLinkedList::prepend(const T &value)
+/*! \fn template <class T> void QLinkedList<T>::prepend(const T &value)
Inserts \a value at the beginning of the list.
@@ -266,7 +266,7 @@ const QLinkedListData QLinkedListData::shared_null = {
\sa append(), insert()
*/
-/*! \fn int QLinkedList::removeAll(const T &value)
+/*! \fn template <class T> int QLinkedList<T>::removeAll(const T &value)
Removes all occurrences of \a value in the list.
@@ -280,7 +280,7 @@ const QLinkedListData QLinkedListData::shared_null = {
*/
/*!
- \fn bool QLinkedList::removeOne(const T &value)
+ \fn template <class T> bool QLinkedList<T>::removeOne(const T &value)
\since 4.4
Removes the first occurrences of \a value in the list. Returns \c true on
@@ -295,7 +295,7 @@ const QLinkedListData QLinkedListData::shared_null = {
\sa insert()
*/
-/*! \fn bool QLinkedList::contains(const T &value) const
+/*! \fn template <class T> bool QLinkedList<T>::contains(const T &value) const
Returns \c true if the list contains an occurrence of \a value;
otherwise returns \c false.
@@ -306,7 +306,7 @@ const QLinkedListData QLinkedListData::shared_null = {
\sa QLinkedListIterator::findNext(), QLinkedListIterator::findPrevious()
*/
-/*! \fn int QLinkedList::count(const T &value) const
+/*! \fn template <class T> int QLinkedList<T>::count(const T &value) const
Returns the number of occurrences of \a value in the list.
@@ -316,7 +316,7 @@ const QLinkedListData QLinkedListData::shared_null = {
\sa contains()
*/
-/*! \fn bool QLinkedList::startsWith(const T &value) const
+/*! \fn template <class T> bool QLinkedList<T>::startsWith(const T &value) const
\since 4.5
Returns \c true if the list is not empty and its first
@@ -325,7 +325,7 @@ const QLinkedListData QLinkedListData::shared_null = {
\sa isEmpty(), first()
*/
-/*! \fn bool QLinkedList::endsWith(const T &value) const
+/*! \fn template <class T> bool QLinkedList<T>::endsWith(const T &value) const
\since 4.5
Returns \c true if the list is not empty and its last
@@ -334,7 +334,7 @@ const QLinkedListData QLinkedListData::shared_null = {
\sa isEmpty(), last()
*/
-/*! \fn QLinkedList::iterator QLinkedList::begin()
+/*! \fn template <class T> QLinkedList<T>::iterator QLinkedList<T>::begin()
Returns an \l{STL-style iterators}{STL-style iterator} pointing to the first item in
the list.
@@ -342,12 +342,12 @@ const QLinkedListData QLinkedListData::shared_null = {
\sa constBegin(), end()
*/
-/*! \fn QLinkedList::const_iterator QLinkedList::begin() const
+/*! \fn template <class T> QLinkedList<T>::const_iterator QLinkedList<T>::begin() const
\overload
*/
-/*! \fn QLinkedList::const_iterator QLinkedList::cbegin() const
+/*! \fn template <class T> QLinkedList<T>::const_iterator QLinkedList<T>::cbegin() const
\since 5.0
Returns a const \l{STL-style iterators}{STL-style iterator} pointing to the first item
@@ -356,7 +356,7 @@ const QLinkedListData QLinkedListData::shared_null = {
\sa begin(), cend()
*/
-/*! \fn QLinkedList::const_iterator QLinkedList::constBegin() const
+/*! \fn template <class T> QLinkedList<T>::const_iterator QLinkedList<T>::constBegin() const
Returns a const \l{STL-style iterators}{STL-style iterator} pointing to the first item
in the list.
@@ -364,7 +364,7 @@ const QLinkedListData QLinkedListData::shared_null = {
\sa begin(), constEnd()
*/
-/*! \fn QLinkedList::iterator QLinkedList::end()
+/*! \fn template <class T> QLinkedList<T>::iterator QLinkedList<T>::end()
Returns an \l{STL-style iterators}{STL-style iterator} pointing to the imaginary item
after the last item in the list.
@@ -372,12 +372,12 @@ const QLinkedListData QLinkedListData::shared_null = {
\sa begin(), constEnd()
*/
-/*! \fn QLinkedList::const_iterator QLinkedList::end() const
+/*! \fn template <class T> QLinkedList<T>::const_iterator QLinkedList<T>::end() const
\overload
*/
-/*! \fn QLinkedList::const_iterator QLinkedList::cend() const
+/*! \fn template <class T> QLinkedList<T>::const_iterator QLinkedList<T>::cend() const
\since 5.0
Returns a const \l{STL-style iterators}{STL-style iterator} pointing to the imaginary
@@ -386,7 +386,7 @@ const QLinkedListData QLinkedListData::shared_null = {
\sa cbegin(), end()
*/
-/*! \fn QLinkedList::const_iterator QLinkedList::constEnd() const
+/*! \fn template <class T> QLinkedList<T>::const_iterator QLinkedList<T>::constEnd() const
Returns a const \l{STL-style iterators}{STL-style iterator} pointing to the imaginary
item after the last item in the list.
@@ -394,7 +394,7 @@ const QLinkedListData QLinkedListData::shared_null = {
\sa constBegin(), end()
*/
-/*! \fn QLinkedList::reverse_iterator QLinkedList::rbegin()
+/*! \fn template <class T> QLinkedList<T>::reverse_iterator QLinkedList<T>::rbegin()
\since 5.6
Returns a \l{STL-style iterators}{STL-style} reverse iterator pointing to the first
@@ -403,12 +403,12 @@ const QLinkedListData QLinkedListData::shared_null = {
\sa begin(), crbegin(), rend()
*/
-/*! \fn QLinkedList::const_reverse_iterator QLinkedList::rbegin() const
+/*! \fn template <class T> QLinkedList<T>::const_reverse_iterator QLinkedList<T>::rbegin() const
\since 5.6
\overload
*/
-/*! \fn QLinkedList::const_reverse_iterator QLinkedList::crbegin() const
+/*! \fn template <class T> QLinkedList<T>::const_reverse_iterator QLinkedList<T>::crbegin() const
\since 5.6
Returns a const \l{STL-style iterators}{STL-style} reverse iterator pointing to the first
@@ -417,7 +417,7 @@ const QLinkedListData QLinkedListData::shared_null = {
\sa begin(), rbegin(), rend()
*/
-/*! \fn QLinkedList::reverse_iterator QLinkedList::rend()
+/*! \fn template <class T> QLinkedList<T>::reverse_iterator QLinkedList<T>::rend()
\since 5.6
Returns a \l{STL-style iterators}{STL-style} reverse iterator pointing to one past
@@ -426,12 +426,12 @@ const QLinkedListData QLinkedListData::shared_null = {
\sa end(), crend(), rbegin()
*/
-/*! \fn QLinkedList::const_reverse_iterator QLinkedList::rend() const
+/*! \fn template <class T> QLinkedList<T>::const_reverse_iterator QLinkedList<T>::rend() const
\since 5.6
\overload
*/
-/*! \fn QLinkedList::const_reverse_iterator QLinkedList::crend() const
+/*! \fn template <class T> QLinkedList<T>::const_reverse_iterator QLinkedList<T>::crend() const
\since 5.6
Returns a const \l{STL-style iterators}{STL-style} reverse iterator pointing to one
@@ -440,7 +440,7 @@ const QLinkedListData QLinkedListData::shared_null = {
\sa end(), rend(), rbegin()
*/
-/*! \fn QLinkedList::iterator QLinkedList::insert(iterator before, const T &value)
+/*! \fn template <class T> QLinkedList<T>::iterator QLinkedList<T>::insert(iterator before, const T &value)
Inserts \a value in front of the item pointed to by the iterator
\a before. Returns an iterator pointing at the inserted item.
@@ -448,7 +448,7 @@ const QLinkedListData QLinkedListData::shared_null = {
\sa erase()
*/
-/*! \fn QLinkedList::iterator QLinkedList::erase(iterator pos)
+/*! \fn template <class T> QLinkedList<T>::iterator QLinkedList<T>::erase(iterator pos)
Removes the item pointed to by the iterator \a pos from the list,
and returns an iterator to the next item in the list (which may be
@@ -457,7 +457,7 @@ const QLinkedListData QLinkedListData::shared_null = {
\sa insert()
*/
-/*! \fn QLinkedList::iterator QLinkedList::erase(iterator begin, iterator end)
+/*! \fn template <class T> QLinkedList<T>::iterator QLinkedList<T>::erase(iterator begin, iterator end)
\overload
@@ -549,12 +549,12 @@ const QLinkedListData QLinkedListData::shared_null = {
Typedef for ptrdiff_t. Provided for STL compatibility.
*/
-/*! \fn int QLinkedList::count() const
+/*! \fn template <class T> int QLinkedList<T>::count() const
Same as size().
*/
-/*! \fn T& QLinkedList::first()
+/*! \fn template <class T> T& QLinkedList<T>::first()
Returns a reference to the first item in the list. This function
assumes that the list isn't empty.
@@ -562,12 +562,12 @@ const QLinkedListData QLinkedListData::shared_null = {
\sa last(), isEmpty()
*/
-/*! \fn const T& QLinkedList::first() const
+/*! \fn template <class T> const T& QLinkedList<T>::first() const
\overload
*/
-/*! \fn T& QLinkedList::last()
+/*! \fn template <class T> T& QLinkedList<T>::last()
Returns a reference to the last item in the list. This function
assumes that the list isn't empty.
@@ -575,12 +575,12 @@ const QLinkedListData QLinkedListData::shared_null = {
\sa first(), isEmpty()
*/
-/*! \fn const T& QLinkedList::last() const
+/*! \fn template <class T> const T& QLinkedList<T>::last() const
\overload
*/
-/*! \fn void QLinkedList::removeFirst()
+/*! \fn template <class T> void QLinkedList<T>::removeFirst()
Removes the first item in the list.
@@ -589,14 +589,14 @@ const QLinkedListData QLinkedListData::shared_null = {
\sa removeLast(), erase()
*/
-/*! \fn void QLinkedList::removeLast()
+/*! \fn template <class T> void QLinkedList<T>::removeLast()
Removes the last item in the list.
\sa removeFirst(), erase()
*/
-/*! \fn T QLinkedList::takeFirst()
+/*! \fn template <class T> T QLinkedList<T>::takeFirst()
Removes the first item in the list and returns it.
@@ -606,7 +606,7 @@ const QLinkedListData QLinkedListData::shared_null = {
\sa takeLast(), removeFirst()
*/
-/*! \fn T QLinkedList::takeLast()
+/*! \fn template <class T> T QLinkedList<T>::takeLast()
Removes the last item in the list and returns it.
@@ -616,59 +616,59 @@ const QLinkedListData QLinkedListData::shared_null = {
\sa takeFirst(), removeLast()
*/
-/*! \fn void QLinkedList::push_back(const T &value)
+/*! \fn template <class T> void QLinkedList<T>::push_back(const T &value)
This function is provided for STL compatibility. It is equivalent
to append(\a value).
*/
-/*! \fn void QLinkedList::push_front(const T &value)
+/*! \fn template <class T> void QLinkedList<T>::push_front(const T &value)
This function is provided for STL compatibility. It is equivalent
to prepend(\a value).
*/
-/*! \fn T& QLinkedList::front()
+/*! \fn template <class T> T& QLinkedList<T>::front()
This function is provided for STL compatibility. It is equivalent
to first().
*/
-/*! \fn const T& QLinkedList::front() const
+/*! \fn template <class T> const T& QLinkedList<T>::front() const
\overload
*/
-/*! \fn T& QLinkedList::back()
+/*! \fn template <class T> T& QLinkedList<T>::back()
This function is provided for STL compatibility. It is equivalent
to last().
*/
-/*! \fn const T& QLinkedList::back() const
+/*! \fn template <class T> const T& QLinkedList<T>::back() const
\overload
*/
-/*! \fn void QLinkedList::pop_front()
+/*! \fn template <class T> void QLinkedList<T>::pop_front()
This function is provided for STL compatibility. It is equivalent
to removeFirst().
*/
-/*! \fn void QLinkedList::pop_back()
+/*! \fn template <class T> void QLinkedList<T>::pop_back()
This function is provided for STL compatibility. It is equivalent
to removeLast().
*/
-/*! \fn bool QLinkedList::empty() const
+/*! \fn template <class T> bool QLinkedList<T>::empty() const
This function is provided for STL compatibility. It is equivalent
to isEmpty() and returns \c true if the list is empty.
*/
-/*! \fn QLinkedList<T> &QLinkedList::operator+=(const QLinkedList<T> &other)
+/*! \fn template <class T> QLinkedList<T> &QLinkedList<T>::operator+=(const QLinkedList<T> &other)
Appends the items of the \a other list to this list and returns a
reference to this list.
@@ -676,14 +676,14 @@ const QLinkedListData QLinkedListData::shared_null = {
\sa operator+(), append()
*/
-/*! \fn void QLinkedList::operator+=(const T &value)
+/*! \fn template <class T> void QLinkedList<T>::operator+=(const T &value)
\overload
Appends \a value to the list.
*/
-/*! \fn QLinkedList<T> QLinkedList::operator+(const QLinkedList<T> &other) const
+/*! \fn template <class T> QLinkedList<T> QLinkedList<T>::operator+(const QLinkedList<T> &other) const
Returns a list that contains all the items in this list followed
by all the items in the \a other list.
@@ -691,7 +691,7 @@ const QLinkedListData QLinkedListData::shared_null = {
\sa operator+=()
*/
-/*! \fn QLinkedList<T> &QLinkedList::operator<<(const QLinkedList<T> &other)
+/*! \fn template <class T> QLinkedList<T> &QLinkedList<T>::operator<<(const QLinkedList<T> &other)
Appends the items of the \a other list to this list and returns a
reference to this list.
@@ -699,7 +699,7 @@ const QLinkedListData QLinkedListData::shared_null = {
\sa operator+=(), append()
*/
-/*! \fn QLinkedList<T> &QLinkedList::operator<<(const T &value)
+/*! \fn template <class T> QLinkedList<T> &QLinkedList<T>::operator<<(const T &value)
\overload
@@ -777,7 +777,7 @@ const QLinkedListData QLinkedListData::shared_null = {
\sa QLinkedList::const_iterator, QMutableLinkedListIterator
*/
-/*! \fn QLinkedList::iterator::iterator()
+/*! \fn template <class T> QLinkedList<T>::iterator::iterator()
Constructs an uninitialized iterator.
@@ -788,7 +788,7 @@ const QLinkedListData QLinkedListData::shared_null = {
\sa QLinkedList::begin(), QLinkedList::end()
*/
-/*! \fn QLinkedList::iterator::iterator(Node *node)
+/*! \fn template <class T> QLinkedList<T>::iterator::iterator(Node *node)
\internal
*/
@@ -818,25 +818,25 @@ const QLinkedListData QLinkedListData::shared_null = {
\internal
*/
-/*! \fn QLinkedList::iterator::iterator(const iterator &other)
+/*! \fn template <class T> QLinkedList<T>::iterator::iterator(const iterator &other)
Constructs a copy of \a other.
*/
-/*! \fn QLinkedList::iterator &QLinkedList::iterator::operator=(const iterator &other)
+/*! \fn template <class T> QLinkedList<T>::iterator &QLinkedList<T>::iterator::operator=(const iterator &other)
Assigns \a other to this iterator.
*/
/*!
- \fn QLinkedList<T> &QLinkedList::operator=(QLinkedList<T> &&other)
+ \fn template <class T> QLinkedList<T> &QLinkedList<T>::operator=(QLinkedList<T> &&other)
Move-assigns \a other to this QLinkedList instance.
\since 5.2
*/
-/*! \fn T &QLinkedList::iterator::operator*() const
+/*! \fn template <class T> T &QLinkedList<T>::iterator::operator*() const
Returns a modifiable reference to the current item.
@@ -848,7 +848,7 @@ const QLinkedListData QLinkedListData::shared_null = {
\sa operator->()
*/
-/*! \fn T *QLinkedList::iterator::operator->() const
+/*! \fn template <class T> T *QLinkedList<T>::iterator::operator->() const
Returns a pointer to the current item.
@@ -856,8 +856,8 @@ const QLinkedListData QLinkedListData::shared_null = {
*/
/*!
- \fn bool QLinkedList::iterator::operator==(const iterator &other) const
- \fn bool QLinkedList::iterator::operator==(const const_iterator &other) const
+ \fn template <class T> bool QLinkedList<T>::iterator::operator==(const iterator &other) const
+ \fn template <class T> bool QLinkedList<T>::iterator::operator==(const const_iterator &other) const
Returns \c true if \a other points to the same item as this
iterator; otherwise returns \c false.
@@ -866,8 +866,8 @@ const QLinkedListData QLinkedListData::shared_null = {
*/
/*!
- \fn bool QLinkedList::iterator::operator!=(const iterator &other) const
- \fn bool QLinkedList::iterator::operator!=(const const_iterator &other) const
+ \fn template <class T> bool QLinkedList<T>::iterator::operator!=(const iterator &other) const
+ \fn template <class T> bool QLinkedList<T>::iterator::operator!=(const const_iterator &other) const
Returns \c true if \a other points to a different item than this
iterator; otherwise returns \c false.
@@ -875,7 +875,7 @@ const QLinkedListData QLinkedListData::shared_null = {
\sa operator==()
*/
-/*! \fn QLinkedList::iterator &QLinkedList::iterator::operator++()
+/*! \fn template <class T> QLinkedList<T>::iterator &QLinkedList<T>::iterator::operator++()
The prefix ++ operator (\c{++it}) advances the iterator to the
next item in the list and returns an iterator to the new current
@@ -887,7 +887,7 @@ const QLinkedListData QLinkedListData::shared_null = {
\sa operator--()
*/
-/*! \fn QLinkedList::iterator QLinkedList::iterator::operator++(int)
+/*! \fn template <class T> QLinkedList<T>::iterator QLinkedList<T>::iterator::operator++(int)
\overload
@@ -896,7 +896,7 @@ const QLinkedListData QLinkedListData::shared_null = {
current item.
*/
-/*! \fn QLinkedList::iterator &QLinkedList::iterator::operator--()
+/*! \fn template <class T> QLinkedList<T>::iterator &QLinkedList<T>::iterator::operator--()
The prefix -- operator (\c{--it}) makes the preceding item
current and returns an iterator to the new current item.
@@ -907,7 +907,7 @@ const QLinkedListData QLinkedListData::shared_null = {
\sa operator++()
*/
-/*! \fn QLinkedList::iterator QLinkedList::iterator::operator--(int)
+/*! \fn template <class T> QLinkedList<T>::iterator QLinkedList<T>::iterator::operator--(int)
\overload
@@ -915,7 +915,7 @@ const QLinkedListData QLinkedListData::shared_null = {
current and returns an iterator to the previously current item.
*/
-/*! \fn QLinkedList::iterator QLinkedList::iterator::operator+(int j) const
+/*! \fn template <class T> QLinkedList<T>::iterator QLinkedList<T>::iterator::operator+(int j) const
Returns an iterator to the item at \a j positions forward from
this iterator. (If \a j is negative, the iterator goes backward.)
@@ -926,7 +926,7 @@ const QLinkedListData QLinkedListData::shared_null = {
*/
-/*! \fn QLinkedList::iterator QLinkedList::iterator::operator-(int j) const
+/*! \fn template <class T> QLinkedList<T>::iterator QLinkedList<T>::iterator::operator-(int j) const
Returns an iterator to the item at \a j positions backward from
this iterator. (If \a j is negative, the iterator goes forward.)
@@ -936,7 +936,7 @@ const QLinkedListData QLinkedListData::shared_null = {
\sa operator+()
*/
-/*! \fn QLinkedList::iterator &QLinkedList::iterator::operator+=(int j)
+/*! \fn template <class T> QLinkedList<T>::iterator &QLinkedList<T>::iterator::operator+=(int j)
Advances the iterator by \a j items. (If \a j is negative, the
iterator goes backward.)
@@ -944,7 +944,7 @@ const QLinkedListData QLinkedListData::shared_null = {
\sa operator-=(), operator+()
*/
-/*! \fn QLinkedList::iterator &QLinkedList::iterator::operator-=(int j)
+/*! \fn template <class T> QLinkedList<T>::iterator &QLinkedList<T>::iterator::operator-=(int j)
Makes the iterator go back by \a j items. (If \a j is negative,
the iterator goes forward.)
@@ -997,7 +997,7 @@ const QLinkedListData QLinkedListData::shared_null = {
\sa QLinkedList::iterator, QLinkedListIterator
*/
-/*! \fn QLinkedList::const_iterator::const_iterator()
+/*! \fn template <class T> QLinkedList<T>::const_iterator::const_iterator()
Constructs an uninitialized iterator.
@@ -1008,7 +1008,7 @@ const QLinkedListData QLinkedListData::shared_null = {
\sa QLinkedList::constBegin(), QLinkedList::constEnd()
*/
-/*! \fn QLinkedList::const_iterator::const_iterator(Node *node)
+/*! \fn template <class T> QLinkedList<T>::const_iterator::const_iterator(Node *node)
\internal
*/
@@ -1038,37 +1038,36 @@ const QLinkedListData QLinkedListData::shared_null = {
\internal
*/
-/*! \fn QLinkedList::const_iterator::const_iterator(const const_iterator &other)
+/*! \fn template <class T> QLinkedList<T>::const_iterator::const_iterator(const const_iterator &other)
Constructs a copy of \a other.
*/
-/*! \fn QLinkedList::const_iterator::const_iterator(iterator other)
+/*! \fn template <class T> QLinkedList<T>::const_iterator::const_iterator(iterator other)
Constructs a copy of \a other.
*/
-/*! \fn QLinkedList::const_iterator &QLinkedList::const_iterator::operator=( \
- const const_iterator &other)
+/*! \fn template <class T> typename QLinkedList<T>::const_iterator &QLinkedList<T>::const_iterator::operator=(const const_iterator &other)
Assigns \a other to this iterator.
*/
-/*! \fn const T &QLinkedList::const_iterator::operator*() const
+/*! \fn template <class T> const T &QLinkedList<T>::const_iterator::operator*() const
Returns a reference to the current item.
\sa operator->()
*/
-/*! \fn const T *QLinkedList::const_iterator::operator->() const
+/*! \fn template <class T> const T *QLinkedList<T>::const_iterator::operator->() const
Returns a pointer to the current item.
\sa operator*()
*/
-/*! \fn bool QLinkedList::const_iterator::operator==(const const_iterator &other) const
+/*! \fn template <class T> bool QLinkedList<T>::const_iterator::operator==(const const_iterator &other) const
Returns \c true if \a other points to the same item as this
iterator; otherwise returns \c false.
@@ -1076,7 +1075,7 @@ const QLinkedListData QLinkedListData::shared_null = {
\sa operator!=()
*/
-/*! \fn bool QLinkedList::const_iterator::operator!=(const const_iterator &other) const
+/*! \fn template <class T> bool QLinkedList<T>::const_iterator::operator!=(const const_iterator &other) const
Returns \c true if \a other points to a different item than this
iterator; otherwise returns \c false.
@@ -1084,19 +1083,19 @@ const QLinkedListData QLinkedListData::shared_null = {
\sa operator==()
*/
-/*! \fn QLinkedList::const_iterator &QLinkedList::const_iterator::operator++()
+/*! \fn template <class T> QLinkedList<T>::const_iterator &QLinkedList<T>::const_iterator::operator++()
The prefix ++ operator (\c{++it}) advances the iterator to the
next item in the list and returns an iterator to the new current
item.
- Calling this function on QLinkedList::constEnd() leads to
+ Calling this function on QLinkedList<T>::constEnd() leads to
undefined results.
\sa operator--()
*/
-/*! \fn QLinkedList::const_iterator QLinkedList::const_iterator::operator++(int)
+/*! \fn template <class T> QLinkedList<T>::const_iterator QLinkedList<T>::const_iterator::operator++(int)
\overload
@@ -1105,7 +1104,7 @@ const QLinkedListData QLinkedListData::shared_null = {
current item.
*/
-/*! \fn QLinkedList::const_iterator &QLinkedList::const_iterator::operator--()
+/*! \fn template <class T> QLinkedList<T>::const_iterator &QLinkedList<T>::const_iterator::operator--()
The prefix -- operator (\c{--it}) makes the preceding item
current and returns an iterator to the new current item.
@@ -1116,7 +1115,7 @@ const QLinkedListData QLinkedListData::shared_null = {
\sa operator++()
*/
-/*! \fn QLinkedList::const_iterator QLinkedList::const_iterator::operator--(int)
+/*! \fn template <class T> QLinkedList<T>::const_iterator QLinkedList<T>::const_iterator::operator--(int)
\overload
@@ -1124,7 +1123,7 @@ const QLinkedListData QLinkedListData::shared_null = {
current and returns an iterator to the previously current item.
*/
-/*! \fn QLinkedList::const_iterator QLinkedList::const_iterator::operator+(int j) const
+/*! \fn template <class T> QLinkedList<T>::const_iterator QLinkedList<T>::const_iterator::operator+(int j) const
Returns an iterator to the item at \a j positions forward from
this iterator. (If \a j is negative, the iterator goes backward.)
@@ -1134,7 +1133,7 @@ const QLinkedListData QLinkedListData::shared_null = {
\sa operator-()
*/
-/*! \fn QLinkedList::const_iterator QLinkedList::const_iterator::operator-(int j) const
+/*! \fn template <class T> QLinkedList<T>::const_iterator QLinkedList<T>::const_iterator::operator-(int j) const
This function returns an iterator to the item at \a j positions backward from
this iterator. (If \a j is negative, the iterator goes forward.)
@@ -1144,7 +1143,7 @@ const QLinkedListData QLinkedListData::shared_null = {
\sa operator+()
*/
-/*! \fn QLinkedList::const_iterator &QLinkedList::const_iterator::operator+=(int j)
+/*! \fn template <class T> QLinkedList<T>::const_iterator &QLinkedList<T>::const_iterator::operator+=(int j)
Advances the iterator by \a j items. (If \a j is negative, the
iterator goes backward.)
@@ -1154,7 +1153,7 @@ const QLinkedListData QLinkedListData::shared_null = {
\sa operator-=(), operator+()
*/
-/*! \fn QLinkedList::const_iterator &QLinkedList::const_iterator::operator-=(int j)
+/*! \fn template <class T> QLinkedList<T>::const_iterator &QLinkedList<T>::const_iterator::operator-=(int j)
Makes the iterator go back by \a j items. (If \a j is negative,
the iterator goes forward.)
@@ -1164,7 +1163,7 @@ const QLinkedListData QLinkedListData::shared_null = {
\sa operator+=(), operator-()
*/
-/*! \fn QDataStream &operator<<(QDataStream &out, const QLinkedList<T> &list)
+/*! \fn template <class T> QDataStream &operator<<(QDataStream &out, const QLinkedList<T> &list)
\relates QLinkedList
Writes the linked list \a list to stream \a out.
@@ -1175,7 +1174,7 @@ const QLinkedListData QLinkedListData::shared_null = {
\sa{Serializing Qt Data Types}{Format of the QDataStream operators}
*/
-/*! \fn QDataStream &operator>>(QDataStream &in, QLinkedList<T> &list)
+/*! \fn template <class T> QDataStream &operator>>(QDataStream &in, QLinkedList<T> &list)
\relates QLinkedList
Reads a linked list from stream \a in into \a list.
@@ -1187,7 +1186,7 @@ const QLinkedListData QLinkedListData::shared_null = {
/*!
\since 4.1
- \fn QLinkedList<T> QLinkedList<T>::fromStdList(const std::list<T> &list)
+ \fn template <class T> QLinkedList<T> QLinkedList<T>::fromStdList(const std::list<T> &list)
Returns a QLinkedList object with the data contained in \a list.
The order of the elements in the QLinkedList is the same as in \a
@@ -1202,7 +1201,7 @@ const QLinkedListData QLinkedListData::shared_null = {
/*!
\since 4.1
- \fn std::list<T> QLinkedList<T>::toStdList() const
+ \fn template <class T> std::list<T> QLinkedList<T>::toStdList() const
Returns a std::list object with the data contained in this
QLinkedList. Example:
diff --git a/src/corelib/tools/qlinkedlist.h b/src/corelib/tools/qlinkedlist.h
index 9f54ba7825..c8f3f4c8c3 100644
--- a/src/corelib/tools/qlinkedlist.h
+++ b/src/corelib/tools/qlinkedlist.h
@@ -134,7 +134,7 @@ public:
typedef T *pointer;
typedef T &reference;
Node *i;
- inline iterator() : i(Q_NULLPTR) {}
+ inline iterator() : i(nullptr) {}
inline iterator(Node *n) : i(n) {}
#if QT_VERSION < QT_VERSION_CHECK(6,0,0)
iterator(const iterator &other) Q_DECL_NOTHROW : i(other.i) {}
@@ -171,7 +171,7 @@ public:
typedef const T *pointer;
typedef const T &reference;
Node *i;
- inline const_iterator() : i(Q_NULLPTR) {}
+ inline const_iterator() : i(nullptr) {}
inline const_iterator(Node *n) : i(n) {}
inline const_iterator(iterator ci) : i(ci.i){}
#if QT_VERSION < QT_VERSION_CHECK(6,0,0)
diff --git a/src/corelib/tools/qlist.cpp b/src/corelib/tools/qlist.cpp
index 5f26e704c4..c01d0c2d61 100644
--- a/src/corelib/tools/qlist.cpp
+++ b/src/corelib/tools/qlist.cpp
@@ -515,7 +515,7 @@ void **QListData::erase(void **xi)
*/
/*!
- \fn QList::QList(QList<T> &&other)
+ \fn template <class T> QList<T>::QList(QList<T> &&other)
Move-constructs a QList instance, making it point at the same
object that \a other was pointing to.
@@ -524,7 +524,7 @@ void **QListData::erase(void **xi)
*/
/*!
- \fn QList<T> QList<T>::mid(int pos, int length) const
+ \fn template <class T> QList<T> QList<T>::mid(int pos, int length) const
Returns a sub-list which includes elements from this list,
starting at position \a pos. If \a length is -1 (the default), all
@@ -533,12 +533,12 @@ void **QListData::erase(void **xi)
are included.
*/
-/*! \fn QList::QList()
+/*! \fn template <class T> QList<T>::QList()
Constructs an empty list.
*/
-/*! \fn QList::QList(const QList<T> &other)
+/*! \fn template <class T> QList<T>::QList(const QList<T> &other)
Constructs a copy of \a other.
@@ -551,7 +551,7 @@ void **QListData::erase(void **xi)
\sa operator=()
*/
-/*! \fn inline QList::QList(std::initializer_list<T> args)
+/*! \fn template <class T> QList<T>::QList(std::initializer_list<T> args)
\since 4.8
Construct a list from the std::initializer_list specified by \a args.
@@ -560,34 +560,34 @@ void **QListData::erase(void **xi)
lists.
*/
-/*! \fn QList::~QList()
+/*! \fn template <class T> QList<T>::~QList()
Destroys the list. References to the values in the list and all
iterators of this list become invalid.
*/
-/*! \fn QList<T> &QList::operator=(const QList<T> &other)
+/*! \fn template <class T> QList<T> &QList<T>::operator=(const QList<T> &other)
Assigns \a other to this list and returns a reference to this
list.
*/
/*!
- \fn QList &QList::operator=(QList<T> &&other)
+ \fn template <class T> QList &QList<T>::operator=(QList<T> &&other)
Move-assigns \a other to this QList instance.
\since 5.2
*/
-/*! \fn void QList::swap(QList<T> &other)
+/*! \fn template <class T> void QList<T>::swap(QList<T> &other)
\since 4.8
Swaps list \a other with this list. This operation is very
fast and never fails.
*/
-/*! \fn bool QList::operator==(const QList<T> &other) const
+/*! \fn template <class T> bool QList<T>::operator==(const QList<T> &other) const
Returns \c true if \a other is equal to this list; otherwise returns
false.
@@ -601,7 +601,7 @@ void **QListData::erase(void **xi)
\sa operator!=()
*/
-/*! \fn bool QList::operator!=(const QList<T> &other) const
+/*! \fn template <class T> bool QList<T>::operator!=(const QList<T> &other) const
Returns \c true if \a other is not equal to this list; otherwise
returns \c false.
@@ -615,7 +615,7 @@ void **QListData::erase(void **xi)
\sa operator==()
*/
-/*! \fn bool operator<(const QList<T> &lhs, const QList<T> &rhs)
+/*! \fn template <class T> bool operator<(const QList<T> &lhs, const QList<T> &rhs)
\since 5.6
\relates QList
@@ -627,7 +627,7 @@ void **QListData::erase(void **xi)
of \c operator<().
*/
-/*! \fn bool operator<=(const QList<T> &lhs, const QList<T> &rhs)
+/*! \fn template <class T> bool operator<=(const QList<T> &lhs, const QList<T> &rhs)
\since 5.6
\relates QList
@@ -639,7 +639,7 @@ void **QListData::erase(void **xi)
of \c operator<().
*/
-/*! \fn bool operator>(const QList<T> &lhs, const QList<T> &rhs)
+/*! \fn template <class T> bool operator>(const QList<T> &lhs, const QList<T> &rhs)
\since 5.6
\relates QList
@@ -651,7 +651,7 @@ void **QListData::erase(void **xi)
of \c operator<().
*/
-/*! \fn bool operator>=(const QList<T> &lhs, const QList<T> &rhs)
+/*! \fn template <class T> bool operator>=(const QList<T> &lhs, const QList<T> &rhs)
\since 5.6
\relates QList
@@ -664,7 +664,7 @@ void **QListData::erase(void **xi)
*/
/*!
- \fn uint qHash(const QList<T> &key, uint seed = 0)
+ \fn template <class T> uint qHash(const QList<T> &key, uint seed = 0)
\since 5.6
\relates QList
@@ -675,19 +675,19 @@ void **QListData::erase(void **xi)
*/
/*!
- \fn int QList::size() const
+ \fn template <class T> int QList<T>::size() const
Returns the number of items in the list.
\sa isEmpty(), count()
*/
-/*! \fn void QList::detach()
+/*! \fn template <class T> void QList<T>::detach()
\internal
*/
-/*! \fn void QList::detachShared()
+/*! \fn template <class T> void QList<T>::detachShared()
\internal
@@ -696,22 +696,22 @@ void **QListData::erase(void **xi)
in case of cleanup work done in destructors on empty lists.
*/
-/*! \fn bool QList::isDetached() const
+/*! \fn template <class T> bool QList<T>::isDetached() const
\internal
*/
-/*! \fn void QList::setSharable(bool sharable)
+/*! \fn template <class T> void QList<T>::setSharable(bool sharable)
\internal
*/
-/*! \fn bool QList::isSharedWith(const QList<T> &other) const
+/*! \fn template <class T> bool QList<T>::isSharedWith(const QList<T> &other) const
\internal
*/
-/*! \fn bool QList::isEmpty() const
+/*! \fn template <class T> bool QList<T>::isEmpty() const
Returns \c true if the list contains no items; otherwise returns
false.
@@ -719,14 +719,14 @@ void **QListData::erase(void **xi)
\sa size()
*/
-/*! \fn void QList::clear()
+/*! \fn template <class T> void QList<T>::clear()
Removes all items from the list.
\sa removeAll()
*/
-/*! \fn const T &QList::at(int i) const
+/*! \fn template <class T> const T &QList<T>::at(int i) const
Returns the item at index position \a i in the list. \a i must be
a valid index position in the list (i.e., 0 <= \a i < size()).
@@ -736,7 +736,7 @@ void **QListData::erase(void **xi)
\sa value(), operator[]()
*/
-/*! \fn T &QList::operator[](int i)
+/*! \fn template <class T> T &QList<T>::operator[](int i)
Returns the item at index position \a i as a modifiable reference.
\a i must be a valid index position in the list (i.e., 0 <= \a i <
@@ -750,14 +750,14 @@ void **QListData::erase(void **xi)
\sa at(), value()
*/
-/*! \fn const T &QList::operator[](int i) const
+/*! \fn template <class T> const T &QList<T>::operator[](int i) const
\overload
Same as at(). This function runs in \l{Algorithmic Complexity}{constant time}.
*/
-/*! \fn QList::reserve(int alloc)
+/*! \fn template <class T> QList<T>::reserve(int alloc)
Reserve space for \a alloc elements.
@@ -770,7 +770,7 @@ void **QListData::erase(void **xi)
\since 4.7
*/
-/*! \fn void QList::append(const T &value)
+/*! \fn template <class T> void QList<T>::append(const T &value)
Inserts \a value at the end of the list.
@@ -787,7 +787,7 @@ void **QListData::erase(void **xi)
\sa operator<<(), prepend(), insert()
*/
-/*! \fn void QList::append(const QList<T> &value)
+/*! \fn template <class T> void QList<T>::append(const QList<T> &value)
\overload
@@ -798,7 +798,7 @@ void **QListData::erase(void **xi)
\sa operator<<(), operator+=()
*/
-/*! \fn void QList::prepend(const T &value)
+/*! \fn template <class T> void QList<T>::prepend(const T &value)
Inserts \a value at the beginning of the list.
@@ -815,7 +815,7 @@ void **QListData::erase(void **xi)
\sa append(), insert()
*/
-/*! \fn void QList::insert(int i, const T &value)
+/*! \fn template <class T> void QList<T>::insert(int i, const T &value)
Inserts \a value at index position \a i in the list. If \a i <= 0,
the value is prepended to the list. If \a i >= size(), the
@@ -827,7 +827,7 @@ void **QListData::erase(void **xi)
\sa append(), prepend(), replace(), removeAt()
*/
-/*! \fn QList::iterator QList::insert(iterator before, const T &value)
+/*! \fn template <class T> QList<T>::iterator QList<T>::insert(iterator before, const T &value)
\overload
@@ -838,7 +838,7 @@ void **QListData::erase(void **xi)
instead.
*/
-/*! \fn void QList::replace(int i, const T &value)
+/*! \fn template <class T> void QList<T>::replace(int i, const T &value)
Replaces the item at index position \a i with \a value. \a i must
be a valid index position in the list (i.e., 0 <= \a i < size()).
@@ -847,7 +847,7 @@ void **QListData::erase(void **xi)
*/
/*!
- \fn int QList::removeAll(const T &value)
+ \fn template <class T> int QList<T>::removeAll(const T &value)
Removes all occurrences of \a value in the list and returns the
number of entries removed.
@@ -862,7 +862,7 @@ void **QListData::erase(void **xi)
*/
/*!
- \fn bool QList::removeOne(const T &value)
+ \fn template <class T> bool QList<T>::removeOne(const T &value)
\since 4.4
Removes the first occurrence of \a value in the list and returns
@@ -877,7 +877,7 @@ void **QListData::erase(void **xi)
\sa removeAll(), removeAt(), takeAt(), replace()
*/
-/*! \fn void QList::removeAt(int i)
+/*! \fn template <class T> void QList<T>::removeAt(int i)
Removes the item at index position \a i. \a i must be a valid
index position in the list (i.e., 0 <= \a i < size()).
@@ -885,7 +885,7 @@ void **QListData::erase(void **xi)
\sa takeAt(), removeFirst(), removeLast(), removeOne()
*/
-/*! \fn T QList::takeAt(int i)
+/*! \fn template <class T> T QList<T>::takeAt(int i)
Removes the item at index position \a i and returns it. \a i must
be a valid index position in the list (i.e., 0 <= \a i < size()).
@@ -895,7 +895,7 @@ void **QListData::erase(void **xi)
\sa removeAt(), takeFirst(), takeLast()
*/
-/*! \fn T QList::takeFirst()
+/*! \fn template <class T> T QList<T>::takeFirst()
Removes the first item in the list and returns it. This is the
same as takeAt(0). This function assumes the list is not empty. To
@@ -910,7 +910,7 @@ void **QListData::erase(void **xi)
\sa takeLast(), takeAt(), removeFirst()
*/
-/*! \fn T QList::takeLast()
+/*! \fn template <class T> T QList<T>::takeLast()
Removes the last item in the list and returns it. This is the
same as takeAt(size() - 1). This function assumes the list is
@@ -926,7 +926,7 @@ void **QListData::erase(void **xi)
\sa takeFirst(), takeAt(), removeLast()
*/
-/*! \fn void QList::move(int from, int to)
+/*! \fn template <class T> void QList<T>::move(int from, int to)
Moves the item at index position \a from to index position \a to.
@@ -941,7 +941,7 @@ void **QListData::erase(void **xi)
\sa swap(), insert(), takeAt()
*/
-/*! \fn void QList::swap(int i, int j)
+/*! \fn template <class T> void QList<T>::swap(int i, int j)
Exchange the item at index position \a i with the item at index
position \a j. This function assumes that both \a i and \a j are
@@ -954,7 +954,7 @@ void **QListData::erase(void **xi)
\sa move()
*/
-/*! \fn int QList::indexOf(const T &value, int from = 0) const
+/*! \fn template <class T> int QList<T>::indexOf(const T &value, int from = 0) const
Returns the index position of the first occurrence of \a value in
the list, searching forward from index position \a from. Returns
@@ -973,7 +973,7 @@ void **QListData::erase(void **xi)
\sa lastIndexOf(), contains()
*/
-/*! \fn int QList::lastIndexOf(const T &value, int from = -1) const
+/*! \fn template <class T> int QList<T>::lastIndexOf(const T &value, int from = -1) const
Returns the index position of the last occurrence of \a value in
the list, searching backward from index position \a from. If \a
@@ -993,7 +993,7 @@ void **QListData::erase(void **xi)
\sa indexOf()
*/
-/*! \fn bool QList::contains(const T &value) const
+/*! \fn template <class T> bool QList<T>::contains(const T &value) const
Returns \c true if the list contains an occurrence of \a value;
otherwise returns \c false.
@@ -1004,7 +1004,7 @@ void **QListData::erase(void **xi)
\sa indexOf(), count()
*/
-/*! \fn int QList::count(const T &value) const
+/*! \fn template <class T> int QList<T>::count(const T &value) const
Returns the number of occurrences of \a value in the list.
@@ -1014,7 +1014,7 @@ void **QListData::erase(void **xi)
\sa contains(), indexOf()
*/
-/*! \fn bool QList::startsWith(const T &value) const
+/*! \fn template <class T> bool QList<T>::startsWith(const T &value) const
\since 4.5
Returns \c true if this list is not empty and its first
@@ -1023,7 +1023,7 @@ void **QListData::erase(void **xi)
\sa isEmpty(), contains()
*/
-/*! \fn bool QList::endsWith(const T &value) const
+/*! \fn template <class T> bool QList<T>::endsWith(const T &value) const
\since 4.5
Returns \c true if this list is not empty and its last
@@ -1032,7 +1032,7 @@ void **QListData::erase(void **xi)
\sa isEmpty(), contains()
*/
-/*! \fn QList::iterator QList::begin()
+/*! \fn template <class T> QList<T>::iterator QList<T>::begin()
Returns an \l{STL-style iterators}{STL-style iterator} pointing to the first item in
the list.
@@ -1040,12 +1040,12 @@ void **QListData::erase(void **xi)
\sa constBegin(), end()
*/
-/*! \fn QList::const_iterator QList::begin() const
+/*! \fn template <class T> QList<T>::const_iterator QList<T>::begin() const
\overload
*/
-/*! \fn QList::const_iterator QList::cbegin() const
+/*! \fn template <class T> QList<T>::const_iterator QList<T>::cbegin() const
\since 5.0
Returns a const \l{STL-style iterators}{STL-style iterator} pointing to the first item
@@ -1054,7 +1054,7 @@ void **QListData::erase(void **xi)
\sa begin(), cend()
*/
-/*! \fn QList::const_iterator QList::constBegin() const
+/*! \fn template <class T> QList<T>::const_iterator QList<T>::constBegin() const
Returns a const \l{STL-style iterators}{STL-style iterator} pointing to the first item
in the list.
@@ -1062,7 +1062,7 @@ void **QListData::erase(void **xi)
\sa begin(), constEnd()
*/
-/*! \fn QList::iterator QList::end()
+/*! \fn template <class T> QList<T>::iterator QList<T>::end()
Returns an \l{STL-style iterators}{STL-style iterator} pointing to the imaginary item
after the last item in the list.
@@ -1070,12 +1070,12 @@ void **QListData::erase(void **xi)
\sa begin(), constEnd()
*/
-/*! \fn const_iterator QList::end() const
+/*! \fn template <class T> const_iterator QList<T>::end() const
\overload
*/
-/*! \fn QList::const_iterator QList::cend() const
+/*! \fn template <class T> QList<T>::const_iterator QList<T>::cend() const
\since 5.0
Returns a const \l{STL-style iterators}{STL-style iterator} pointing to the imaginary
@@ -1084,7 +1084,7 @@ void **QListData::erase(void **xi)
\sa cbegin(), end()
*/
-/*! \fn QList::const_iterator QList::constEnd() const
+/*! \fn template <class T> QList<T>::const_iterator QList<T>::constEnd() const
Returns a const \l{STL-style iterators}{STL-style iterator} pointing to the imaginary
item after the last item in the list.
@@ -1092,7 +1092,7 @@ void **QListData::erase(void **xi)
\sa constBegin(), end()
*/
-/*! \fn QList::reverse_iterator QList::rbegin()
+/*! \fn template <class T> QList<T>::reverse_iterator QList<T>::rbegin()
\since 5.6
Returns a \l{STL-style iterators}{STL-style} reverse iterator pointing to the first
@@ -1101,12 +1101,12 @@ void **QListData::erase(void **xi)
\sa begin(), crbegin(), rend()
*/
-/*! \fn QList::const_reverse_iterator QList::rbegin() const
+/*! \fn template <class T> QList<T>::const_reverse_iterator QList<T>::rbegin() const
\since 5.6
\overload
*/
-/*! \fn QList::const_reverse_iterator QList::crbegin() const
+/*! \fn template <class T> QList<T>::const_reverse_iterator QList<T>::crbegin() const
\since 5.6
Returns a const \l{STL-style iterators}{STL-style} reverse iterator pointing to the first
@@ -1115,7 +1115,7 @@ void **QListData::erase(void **xi)
\sa begin(), rbegin(), rend()
*/
-/*! \fn QList::reverse_iterator QList::rend()
+/*! \fn template <class T> QList<T>::reverse_iterator QList<T>::rend()
\since 5.6
Returns a \l{STL-style iterators}{STL-style} reverse iterator pointing to one past
@@ -1124,12 +1124,12 @@ void **QListData::erase(void **xi)
\sa end(), crend(), rbegin()
*/
-/*! \fn QList::const_reverse_iterator QList::rend() const
+/*! \fn template <class T> QList<T>::const_reverse_iterator QList<T>::rend() const
\since 5.6
\overload
*/
-/*! \fn QList::const_reverse_iterator QList::crend() const
+/*! \fn template <class T> QList<T>::const_reverse_iterator QList<T>::crend() const
\since 5.6
Returns a const \l{STL-style iterators}{STL-style} reverse iterator pointing to one
@@ -1138,7 +1138,7 @@ void **QListData::erase(void **xi)
\sa end(), rend(), rbegin()
*/
-/*! \fn QList::iterator QList::erase(iterator pos)
+/*! \fn template <class T> QList<T>::iterator QList<T>::erase(iterator pos)
Removes the item associated with the iterator \a pos from the
list, and returns an iterator to the next item in the list (which
@@ -1147,7 +1147,7 @@ void **QListData::erase(void **xi)
\sa insert(), removeAt()
*/
-/*! \fn QList::iterator QList::erase(iterator begin, iterator end)
+/*! \fn template <class T> QList<T>::iterator QList<T>::erase(iterator begin, iterator end)
\overload
@@ -1240,13 +1240,13 @@ void **QListData::erase(void **xi)
\sa QList::rbegin(), QList::rend(), QList::reverse_iterator, QList::const_iterator
*/
-/*! \fn int QList::count() const
+/*! \fn template <class T> int QList<T>::count() const
Returns the number of items in the list. This is effectively the
same as size().
*/
-/*! \fn int QList::length() const
+/*! \fn template <class T> int QList<T>::length() const
\since 4.5
This function is identical to count().
@@ -1254,7 +1254,7 @@ void **QListData::erase(void **xi)
\sa count()
*/
-/*! \fn T& QList::first()
+/*! \fn template <class T> T& QList<T>::first()
Returns a reference to the first item in the list. The list must
not be empty. If the list can be empty, call isEmpty() before
@@ -1263,12 +1263,12 @@ void **QListData::erase(void **xi)
\sa constFirst(), last(), isEmpty()
*/
-/*! \fn const T& QList::first() const
+/*! \fn template <class T> const T& QList<T>::first() const
\overload
*/
-/*! \fn const T& QList::constFirst() const
+/*! \fn template <class T> const T& QList<T>::constFirst() const
\since 5.6
Returns a const reference to the first item in the list. The list must
@@ -1278,7 +1278,7 @@ void **QListData::erase(void **xi)
\sa constLast(), isEmpty(), first()
*/
-/*! \fn T& QList::last()
+/*! \fn template <class T> T& QList<T>::last()
Returns a reference to the last item in the list. The list must
not be empty. If the list can be empty, call isEmpty() before
@@ -1287,12 +1287,12 @@ void **QListData::erase(void **xi)
\sa constLast(), first(), isEmpty()
*/
-/*! \fn const T& QList::last() const
+/*! \fn template <class T> const T& QList<T>::last() const
\overload
*/
-/*! \fn const T& QList::constLast() const
+/*! \fn template <class T> const T& QList<T>::constLast() const
\since 5.6
Returns a reference to the last item in the list. The list must
@@ -1302,7 +1302,7 @@ void **QListData::erase(void **xi)
\sa constFirst(), isEmpty(), last()
*/
-/*! \fn void QList::removeFirst()
+/*! \fn template <class T> void QList<T>::removeFirst()
Removes the first item in the list. Calling this function is
equivalent to calling removeAt(0). The list must not be empty. If
@@ -1312,7 +1312,7 @@ void **QListData::erase(void **xi)
\sa removeAt(), takeFirst()
*/
-/*! \fn void QList::removeLast()
+/*! \fn template <class T> void QList<T>::removeLast()
Removes the last item in the list. Calling this function is
equivalent to calling removeAt(size() - 1). The list must not be
@@ -1322,7 +1322,7 @@ void **QListData::erase(void **xi)
\sa removeAt(), takeLast()
*/
-/*! \fn T QList::value(int i) const
+/*! \fn template <class T> T QList<T>::value(int i) const
Returns the value at index position \a i in the list.
@@ -1334,7 +1334,7 @@ void **QListData::erase(void **xi)
\sa at(), operator[]()
*/
-/*! \fn T QList::value(int i, const T &defaultValue) const
+/*! \fn template <class T> T QList<T>::value(int i, const T &defaultValue) const
\overload
@@ -1342,63 +1342,63 @@ void **QListData::erase(void **xi)
\a defaultValue.
*/
-/*! \fn void QList::push_back(const T &value)
+/*! \fn template <class T> void QList<T>::push_back(const T &value)
This function is provided for STL compatibility. It is equivalent
to \l{QList::append()}{append(\a value)}.
*/
-/*! \fn void QList::push_front(const T &value)
+/*! \fn template <class T> void QList<T>::push_front(const T &value)
This function is provided for STL compatibility. It is equivalent
to \l{QList::prepend()}{prepend(\a value)}.
*/
-/*! \fn T& QList::front()
+/*! \fn template <class T> T& QList<T>::front()
This function is provided for STL compatibility. It is equivalent
to first(). The list must not be empty. If the list can be empty,
call isEmpty() before calling this function.
*/
-/*! \fn const T& QList::front() const
+/*! \fn template <class T> const T& QList<T>::front() const
\overload
*/
-/*! \fn T& QList::back()
+/*! \fn template <class T> T& QList<T>::back()
This function is provided for STL compatibility. It is equivalent
to last(). The list must not be empty. If the list can be empty,
call isEmpty() before calling this function.
*/
-/*! \fn const T& QList::back() const
+/*! \fn template <class T> const T& QList<T>::back() const
\overload
*/
-/*! \fn void QList::pop_front()
+/*! \fn template <class T> void QList<T>::pop_front()
This function is provided for STL compatibility. It is equivalent
to removeFirst(). The list must not be empty. If the list can be
empty, call isEmpty() before calling this function.
*/
-/*! \fn void QList::pop_back()
+/*! \fn template <class T> void QList<T>::pop_back()
This function is provided for STL compatibility. It is equivalent
to removeLast(). The list must not be empty. If the list can be
empty, call isEmpty() before calling this function.
*/
-/*! \fn bool QList::empty() const
+/*! \fn template <class T> bool QList<T>::empty() const
This function is provided for STL compatibility. It is equivalent
to isEmpty() and returns \c true if the list is empty.
*/
-/*! \fn QList<T> &QList::operator+=(const QList<T> &other)
+/*! \fn template <class T> QList<T> &QList<T>::operator+=(const QList<T> &other)
Appends the items of the \a other list to this list and returns a
reference to this list.
@@ -1406,7 +1406,7 @@ void **QListData::erase(void **xi)
\sa operator+(), append()
*/
-/*! \fn void QList::operator+=(const T &value)
+/*! \fn template <class T> void QList<T>::operator+=(const T &value)
\overload
@@ -1415,7 +1415,7 @@ void **QListData::erase(void **xi)
\sa append(), operator<<()
*/
-/*! \fn QList<T> QList::operator+(const QList<T> &other) const
+/*! \fn template <class T> QList<T> QList<T>::operator+(const QList<T> &other) const
Returns a list that contains all the items in this list followed
by all the items in the \a other list.
@@ -1423,7 +1423,7 @@ void **QListData::erase(void **xi)
\sa operator+=()
*/
-/*! \fn QList<T> &QList::operator<<(const QList<T> &other)
+/*! \fn template <class T> QList<T> &QList<T>::operator<<(const QList<T> &other)
Appends the items of the \a other list to this list and returns a
reference to this list.
@@ -1431,7 +1431,7 @@ void **QListData::erase(void **xi)
\sa operator+=(), append()
*/
-/*! \fn void QList::operator<<(const T &value)
+/*! \fn template <class T> void QList<T>::operator<<(const T &value)
\overload
@@ -1521,7 +1521,7 @@ void **QListData::erase(void **xi)
\internal
*/
-/*! \fn QList::iterator::iterator()
+/*! \fn template <class T> QList<T>::iterator::iterator()
Constructs an uninitialized iterator.
@@ -1532,17 +1532,17 @@ void **QListData::erase(void **xi)
\sa QList::begin(), QList::end()
*/
-/*! \fn QList::iterator::iterator(Node *node)
+/*! \fn template <class T> QList<T>::iterator::iterator(Node *node)
\internal
*/
-/*! \fn QList::iterator::iterator(const iterator &other)
+/*! \fn template <class T> QList<T>::iterator::iterator(const iterator &other)
Constructs a copy of \a other.
*/
-/*! \fn T &QList::iterator::operator*() const
+/*! \fn template <class T> T &QList<T>::iterator::operator*() const
Returns a modifiable reference to the current item.
@@ -1554,14 +1554,14 @@ void **QListData::erase(void **xi)
\sa operator->()
*/
-/*! \fn T *QList::iterator::operator->() const
+/*! \fn template <class T> T *QList<T>::iterator::operator->() const
Returns a pointer to the current item.
\sa operator*()
*/
-/*! \fn T &QList::iterator::operator[](difference_type j) const
+/*! \fn template <class T> T &QList<T>::iterator::operator[](difference_type j) const
Returns a modifiable reference to the item at position *this +
\a{j}.
@@ -1573,8 +1573,8 @@ void **QListData::erase(void **xi)
*/
/*!
- \fn bool QList::iterator::operator==(const iterator &other) const
- \fn bool QList::iterator::operator==(const const_iterator &other) const
+ \fn template <class T> bool QList<T>::iterator::operator==(const iterator &other) const
+ \fn template <class T> bool QList<T>::iterator::operator==(const const_iterator &other) const
Returns \c true if \a other points to the same item as this
iterator; otherwise returns \c false.
@@ -1583,8 +1583,8 @@ void **QListData::erase(void **xi)
*/
/*!
- \fn bool QList::iterator::operator!=(const iterator &other) const
- \fn bool QList::iterator::operator!=(const const_iterator &other) const
+ \fn template <class T> bool QList<T>::iterator::operator!=(const iterator &other) const
+ \fn template <class T> bool QList<T>::iterator::operator!=(const const_iterator &other) const
Returns \c true if \a other points to a different item than this
iterator; otherwise returns \c false.
@@ -1593,38 +1593,38 @@ void **QListData::erase(void **xi)
*/
/*!
- \fn bool QList::iterator::operator<(const iterator& other) const
- \fn bool QList::iterator::operator<(const const_iterator& other) const
+ \fn template <class T> bool QList<T>::iterator::operator<(const iterator& other) const
+ \fn template <class T> bool QList<T>::iterator::operator<(const const_iterator& other) const
Returns \c true if the item pointed to by this iterator is less than
the item pointed to by the \a other iterator.
*/
/*!
- \fn bool QList::iterator::operator<=(const iterator& other) const
- \fn bool QList::iterator::operator<=(const const_iterator& other) const
+ \fn template <class T> bool QList<T>::iterator::operator<=(const iterator& other) const
+ \fn template <class T> bool QList<T>::iterator::operator<=(const const_iterator& other) const
Returns \c true if the item pointed to by this iterator is less than
or equal to the item pointed to by the \a other iterator.
*/
/*!
- \fn bool QList::iterator::operator>(const iterator& other) const
- \fn bool QList::iterator::operator>(const const_iterator& other) const
+ \fn template <class T> bool QList<T>::iterator::operator>(const iterator& other) const
+ \fn template <class T> bool QList<T>::iterator::operator>(const const_iterator& other) const
Returns \c true if the item pointed to by this iterator is greater
than the item pointed to by the \a other iterator.
*/
/*!
- \fn bool QList::iterator::operator>=(const iterator& other) const
- \fn bool QList::iterator::operator>=(const const_iterator& other) const
+ \fn template <class T> bool QList<T>::iterator::operator>=(const iterator& other) const
+ \fn template <class T> bool QList<T>::iterator::operator>=(const const_iterator& other) const
Returns \c true if the item pointed to by this iterator is greater
than or equal to the item pointed to by the \a other iterator.
*/
-/*! \fn QList::iterator &QList::iterator::operator++()
+/*! \fn template <class T> QList<T>::iterator &QList<T>::iterator::operator++()
The prefix ++ operator (\c{++it}) advances the iterator to the
next item in the list and returns an iterator to the new current
@@ -1635,7 +1635,7 @@ void **QListData::erase(void **xi)
\sa operator--()
*/
-/*! \fn QList::iterator QList::iterator::operator++(int)
+/*! \fn template <class T> QList<T>::iterator QList<T>::iterator::operator++(int)
\overload
@@ -1644,7 +1644,7 @@ void **QListData::erase(void **xi)
current item.
*/
-/*! \fn QList::iterator &QList::iterator::operator--()
+/*! \fn template <class T> QList<T>::iterator &QList<T>::iterator::operator--()
The prefix -- operator (\c{--it}) makes the preceding item
current and returns an iterator to the new current item.
@@ -1654,7 +1654,7 @@ void **QListData::erase(void **xi)
\sa operator++()
*/
-/*! \fn QList::iterator QList::iterator::operator--(int)
+/*! \fn template <class T> QList<T>::iterator QList<T>::iterator::operator--(int)
\overload
@@ -1662,7 +1662,7 @@ void **QListData::erase(void **xi)
current and returns an iterator to the previously current item.
*/
-/*! \fn QList::iterator &QList::iterator::operator+=(difference_type j)
+/*! \fn template <class T> QList<T>::iterator &QList<T>::iterator::operator+=(difference_type j)
Advances the iterator by \a j items. (If \a j is negative, the
iterator goes backward.)
@@ -1670,7 +1670,7 @@ void **QListData::erase(void **xi)
\sa operator-=(), operator+()
*/
-/*! \fn QList::iterator &QList::iterator::operator-=(difference_type j)
+/*! \fn template <class T> QList<T>::iterator &QList<T>::iterator::operator-=(difference_type j)
Makes the iterator go back by \a j items. (If \a j is negative,
the iterator goes forward.)
@@ -1678,7 +1678,7 @@ void **QListData::erase(void **xi)
\sa operator+=(), operator-()
*/
-/*! \fn QList::iterator QList::iterator::operator+(difference_type j) const
+/*! \fn template <class T> QList<T>::iterator QList<T>::iterator::operator+(difference_type j) const
Returns an iterator to the item at \a j positions forward from
this iterator. (If \a j is negative, the iterator goes backward.)
@@ -1686,7 +1686,7 @@ void **QListData::erase(void **xi)
\sa operator-(), operator+=()
*/
-/*! \fn QList::iterator QList::iterator::operator-(difference_type j) const
+/*! \fn template <class T> QList<T>::iterator QList<T>::iterator::operator-(difference_type j) const
Returns an iterator to the item at \a j positions backward from
this iterator. (If \a j is negative, the iterator goes forward.)
@@ -1694,7 +1694,7 @@ void **QListData::erase(void **xi)
\sa operator+(), operator-=()
*/
-/*! \fn int QList::iterator::operator-(iterator other) const
+/*! \fn template <class T> int QList<T>::iterator::operator-(iterator other) const
Returns the number of items between the item pointed to by \a
other and the item pointed to by this iterator.
@@ -1750,7 +1750,7 @@ void **QListData::erase(void **xi)
\sa QList::iterator, QListIterator
*/
-/*! \fn QList::const_iterator::const_iterator()
+/*! \fn template <class T> QList<T>::const_iterator::const_iterator()
Constructs an uninitialized iterator.
@@ -1787,36 +1787,36 @@ void **QListData::erase(void **xi)
\internal
*/
-/*! \fn QList::const_iterator::const_iterator(Node *node)
+/*! \fn template <class T> QList<T>::const_iterator::const_iterator(Node *node)
\internal
*/
-/*! \fn QList::const_iterator::const_iterator(const const_iterator &other)
+/*! \fn template <class T> QList<T>::const_iterator::const_iterator(const const_iterator &other)
Constructs a copy of \a other.
*/
-/*! \fn QList::const_iterator::const_iterator(const iterator &other)
+/*! \fn template <class T> QList<T>::const_iterator::const_iterator(const iterator &other)
Constructs a copy of \a other.
*/
-/*! \fn const T &QList::const_iterator::operator*() const
+/*! \fn template <class T> const T &QList<T>::const_iterator::operator*() const
Returns the current item.
\sa operator->()
*/
-/*! \fn const T *QList::const_iterator::operator->() const
+/*! \fn template <class T> const T *QList<T>::const_iterator::operator->() const
Returns a pointer to the current item.
\sa operator*()
*/
-/*! \fn const T &QList::const_iterator::operator[](difference_type j) const
+/*! \fn template <class T> const T &QList<T>::const_iterator::operator[](difference_type j) const
Returns the item at position *this + \a{j}.
@@ -1826,7 +1826,7 @@ void **QListData::erase(void **xi)
\sa operator+()
*/
-/*! \fn bool QList::const_iterator::operator==(const const_iterator &other) const
+/*! \fn template <class T> bool QList<T>::const_iterator::operator==(const const_iterator &other) const
Returns \c true if \a other points to the same item as this
iterator; otherwise returns \c false.
@@ -1834,7 +1834,7 @@ void **QListData::erase(void **xi)
\sa operator!=()
*/
-/*! \fn bool QList::const_iterator::operator!=(const const_iterator &other) const
+/*! \fn template <class T> bool QList<T>::const_iterator::operator!=(const const_iterator &other) const
Returns \c true if \a other points to a different item than this
iterator; otherwise returns \c false.
@@ -1843,34 +1843,34 @@ void **QListData::erase(void **xi)
*/
/*!
- \fn bool QList::const_iterator::operator<(const const_iterator& other) const
+ \fn template <class T> bool QList<T>::const_iterator::operator<(const const_iterator& other) const
Returns \c true if the item pointed to by this iterator is less than
the item pointed to by the \a other iterator.
*/
/*!
- \fn bool QList::const_iterator::operator<=(const const_iterator& other) const
+ \fn template <class T> bool QList<T>::const_iterator::operator<=(const const_iterator& other) const
Returns \c true if the item pointed to by this iterator is less than
or equal to the item pointed to by the \a other iterator.
*/
/*!
- \fn bool QList::const_iterator::operator>(const const_iterator& other) const
+ \fn template <class T> bool QList<T>::const_iterator::operator>(const const_iterator& other) const
Returns \c true if the item pointed to by this iterator is greater
than the item pointed to by the \a other iterator.
*/
/*!
- \fn bool QList::const_iterator::operator>=(const const_iterator& other) const
+ \fn template <class T> bool QList<T>::const_iterator::operator>=(const const_iterator& other) const
Returns \c true if the item pointed to by this iterator is greater
than or equal to the item pointed to by the \a other iterator.
*/
-/*! \fn QList::const_iterator &QList::const_iterator::operator++()
+/*! \fn template <class T> QList<T>::const_iterator &QList<T>::const_iterator::operator++()
The prefix ++ operator (\c{++it}) advances the iterator to the
next item in the list and returns an iterator to the new current
@@ -1881,7 +1881,7 @@ void **QListData::erase(void **xi)
\sa operator--()
*/
-/*! \fn QList::const_iterator QList::const_iterator::operator++(int)
+/*! \fn template <class T> QList<T>::const_iterator QList<T>::const_iterator::operator++(int)
\overload
@@ -1890,7 +1890,7 @@ void **QListData::erase(void **xi)
current item.
*/
-/*! \fn QList::const_iterator &QList::const_iterator::operator--()
+/*! \fn template <class T> QList<T>::const_iterator &QList<T>::const_iterator::operator--()
The prefix -- operator (\c{--it}) makes the preceding item
current and returns an iterator to the new current item.
@@ -1900,7 +1900,7 @@ void **QListData::erase(void **xi)
\sa operator++()
*/
-/*! \fn QList::const_iterator QList::const_iterator::operator--(int)
+/*! \fn template <class T> QList<T>::const_iterator QList<T>::const_iterator::operator--(int)
\overload
@@ -1908,7 +1908,7 @@ void **QListData::erase(void **xi)
current and returns an iterator to the previously current item.
*/
-/*! \fn QList::const_iterator &QList::const_iterator::operator+=(difference_type j)
+/*! \fn template <class T> QList<T>::const_iterator &QList<T>::const_iterator::operator+=(difference_type j)
Advances the iterator by \a j items. (If \a j is negative, the
iterator goes backward.)
@@ -1916,7 +1916,7 @@ void **QListData::erase(void **xi)
\sa operator-=(), operator+()
*/
-/*! \fn QList::const_iterator &QList::const_iterator::operator-=(difference_type j)
+/*! \fn template <class T> QList<T>::const_iterator &QList<T>::const_iterator::operator-=(difference_type j)
Makes the iterator go back by \a j items. (If \a j is negative,
the iterator goes forward.)
@@ -1924,7 +1924,7 @@ void **QListData::erase(void **xi)
\sa operator+=(), operator-()
*/
-/*! \fn QList::const_iterator QList::const_iterator::operator+(difference_type j) const
+/*! \fn template <class T> QList<T>::const_iterator QList<T>::const_iterator::operator+(difference_type j) const
Returns an iterator to the item at \a j positions forward from
this iterator. (If \a j is negative, the iterator goes backward.)
@@ -1932,7 +1932,7 @@ void **QListData::erase(void **xi)
\sa operator-(), operator+=()
*/
-/*! \fn QList::const_iterator QList::const_iterator::operator-(difference_type j) const
+/*! \fn template <class T> QList<T>::const_iterator QList<T>::const_iterator::operator-(difference_type j) const
Returns an iterator to the item at \a j positions backward from
this iterator. (If \a j is negative, the iterator goes forward.)
@@ -1940,13 +1940,13 @@ void **QListData::erase(void **xi)
\sa operator+(), operator-=()
*/
-/*! \fn int QList::const_iterator::operator-(const_iterator other) const
+/*! \fn template <class T> int QList<T>::const_iterator::operator-(const_iterator other) const
Returns the number of items between the item pointed to by \a
other and the item pointed to by this iterator.
*/
-/*! \fn QDataStream &operator<<(QDataStream &out, const QList<T> &list)
+/*! \fn template <class T> QDataStream &operator<<(QDataStream &out, const QList<T> &list)
\relates QList
Writes the list \a list to stream \a out.
@@ -1957,7 +1957,7 @@ void **QListData::erase(void **xi)
\sa{Serializing Qt Data Types}{Format of the QDataStream operators}
*/
-/*! \fn QDataStream &operator>>(QDataStream &in, QList<T> &list)
+/*! \fn template <class T> QDataStream &operator>>(QDataStream &in, QList<T> &list)
\relates QList
Reads a list from stream \a in into \a list.
@@ -1968,7 +1968,7 @@ void **QListData::erase(void **xi)
\sa{Serializing Qt Data Types}{Format of the QDataStream operators}
*/
-/*! \fn QList<T> QList<T>::fromVector(const QVector<T> &vector)
+/*! \fn template <class T> QList<T> QList<T>::fromVector(const QVector<T> &vector)
Returns a QList object with the data contained in \a vector.
@@ -1979,7 +1979,7 @@ void **QListData::erase(void **xi)
\sa fromSet(), toVector(), QVector::toList()
*/
-/*! \fn QVector<T> QList<T>::toVector() const
+/*! \fn template <class T> QVector<T> QList<T>::toVector() const
Returns a QVector object with the data contained in this QList.
@@ -1990,7 +1990,7 @@ void **QListData::erase(void **xi)
\sa toSet(), fromVector(), QVector::fromList()
*/
-/*! \fn QList<T> QList<T>::fromSet(const QSet<T> &set)
+/*! \fn template <class T> QList<T> QList<T>::fromSet(const QSet<T> &set)
Returns a QList object with the data contained in \a set. The
order of the elements in the QList is undefined.
@@ -2002,7 +2002,7 @@ void **QListData::erase(void **xi)
\sa fromVector(), toSet(), QSet::toList()
*/
-/*! \fn QSet<T> QList<T>::toSet() const
+/*! \fn template <class T> QSet<T> QList<T>::toSet() const
Returns a QSet object with the data contained in this QList.
Since QSet doesn't allow duplicates, the resulting QSet might be
@@ -2015,7 +2015,7 @@ void **QListData::erase(void **xi)
\sa toVector(), fromSet(), QSet::fromList()
*/
-/*! \fn QList<T> QList<T>::fromStdList(const std::list<T> &list)
+/*! \fn template <class T> QList<T> QList<T>::fromStdList(const std::list<T> &list)
Returns a QList object with the data contained in \a list. The
order of the elements in the QList is the same as in \a list.
@@ -2027,7 +2027,7 @@ void **QListData::erase(void **xi)
\sa toStdList(), QVector::fromStdVector()
*/
-/*! \fn std::list<T> QList<T>::toStdList() const
+/*! \fn template <class T> std::list<T> QList<T>::toStdList() const
Returns a std::list object with the data contained in this QList.
Example:
diff --git a/src/corelib/tools/qlist.h b/src/corelib/tools/qlist.h
index 1042c29460..af7659e995 100644
--- a/src/corelib/tools/qlist.h
+++ b/src/corelib/tools/qlist.h
@@ -231,7 +231,7 @@ public:
typedef T *pointer;
typedef T &reference;
- inline iterator() Q_DECL_NOTHROW : i(Q_NULLPTR) {}
+ inline iterator() Q_DECL_NOTHROW : i(nullptr) {}
inline iterator(Node *n) Q_DECL_NOTHROW : i(n) {}
#if QT_VERSION < QT_VERSION_CHECK(6,0,0)
// can't remove it in Qt 5, since doing so would make the type trivial,
@@ -283,7 +283,7 @@ public:
typedef const T *pointer;
typedef const T &reference;
- inline const_iterator() Q_DECL_NOTHROW : i(Q_NULLPTR) {}
+ inline const_iterator() Q_DECL_NOTHROW : i(nullptr) {}
inline const_iterator(Node *n) Q_DECL_NOTHROW : i(n) {}
#if QT_VERSION < QT_VERSION_CHECK(6,0,0)
// can't remove it in Qt 5, since doing so would make the type trivial,
diff --git a/src/corelib/tools/qlocale.cpp b/src/corelib/tools/qlocale.cpp
index a072ea411c..5598dfe237 100644
--- a/src/corelib/tools/qlocale.cpp
+++ b/src/corelib/tools/qlocale.cpp
@@ -64,6 +64,9 @@
#include "qstringbuilder.h"
#include "private/qnumeric_p.h"
#include <cmath>
+#ifndef QT_NO_SYSTEMLOCALE
+# include "qmutex.h"
+#endif
#ifdef Q_OS_WIN
# include <qt_windows.h>
# include <time.h>
@@ -107,31 +110,32 @@ QLocale::Language QLocalePrivate::codeToLanguage(QStringView code) Q_DECL_NOTHRO
return QLocale::Language((c - language_code_list)/3);
}
- // legacy codes
- if (uc1 == 'n' && uc2 == 'o' && uc3 == 0) { // no -> nb
- Q_STATIC_ASSERT(QLocale::Norwegian == QLocale::NorwegianBokmal);
- return QLocale::Norwegian;
- }
- if (uc1 == 't' && uc2 == 'l' && uc3 == 0) { // tl -> fil
- Q_STATIC_ASSERT(QLocale::Tagalog == QLocale::Filipino);
- return QLocale::Tagalog;
- }
- if (uc1 == 's' && uc2 == 'h' && uc3 == 0) { // sh -> sr[_Latn]
- Q_STATIC_ASSERT(QLocale::SerboCroatian == QLocale::Serbian);
- return QLocale::SerboCroatian;
- }
- if (uc1 == 'm' && uc2 == 'o' && uc3 == 0) { // mo -> ro
- Q_STATIC_ASSERT(QLocale::Moldavian == QLocale::Romanian);
- return QLocale::Moldavian;
+ if (uc3 == 0) {
+ // legacy codes
+ if (uc1 == 'n' && uc2 == 'o') { // no -> nb
+ Q_STATIC_ASSERT(QLocale::Norwegian == QLocale::NorwegianBokmal);
+ return QLocale::Norwegian;
+ }
+ if (uc1 == 't' && uc2 == 'l') { // tl -> fil
+ Q_STATIC_ASSERT(QLocale::Tagalog == QLocale::Filipino);
+ return QLocale::Tagalog;
+ }
+ if (uc1 == 's' && uc2 == 'h') { // sh -> sr[_Latn]
+ Q_STATIC_ASSERT(QLocale::SerboCroatian == QLocale::Serbian);
+ return QLocale::SerboCroatian;
+ }
+ if (uc1 == 'm' && uc2 == 'o') { // mo -> ro
+ Q_STATIC_ASSERT(QLocale::Moldavian == QLocale::Romanian);
+ return QLocale::Moldavian;
+ }
+ // Android uses the following deprecated codes
+ if (uc1 == 'i' && uc2 == 'w') // iw -> he
+ return QLocale::Hebrew;
+ if (uc1 == 'i' && uc2 == 'n') // in -> id
+ return QLocale::Indonesian;
+ if (uc1 == 'j' && uc2 == 'i') // ji -> yi
+ return QLocale::Yiddish;
}
- // Android uses the following deprecated codes
- if (uc1 == 'i' && uc2 == 'w' && uc3 == 0) // iw -> he
- return QLocale::Hebrew;
- if (uc1 == 'i' && uc2 == 'n' && uc3 == 0) // in -> id
- return QLocale::Indonesian;
- if (uc1 == 'j' && uc2 == 'i' && uc3 == 0) // ji -> yi
- return QLocale::Yiddish;
-
return QLocale::C;
}
@@ -593,8 +597,6 @@ static QLocalePrivate *c_private()
}
#ifndef QT_NO_SYSTEMLOCALE
-
-
/******************************************************************************
** Default system locale behavior
*/
@@ -683,14 +685,24 @@ void QLocalePrivate::updateSystemPrivate()
if (!res.isNull())
system_data->m_plus = res.toString().at(0).unicode();
}
-#endif
+#endif // !QT_NO_SYSTEMLOCALE
static const QLocaleData *systemData()
{
#ifndef QT_NO_SYSTEMLOCALE
- // copy over the information from the fallback locale and modify
- if (!system_data || system_data->m_language_id == 0)
- QLocalePrivate::updateSystemPrivate();
+ /*
+ Copy over the information from the fallback locale and modify.
+
+ This modifies (cross-thread) global state, so take care to only call it in
+ one thread.
+ */
+ {
+ static QBasicMutex systemDataMutex;
+ systemDataMutex.lock();
+ if (!system_data || system_data->m_language_id == 0)
+ QLocalePrivate::updateSystemPrivate();
+ systemDataMutex.unlock();
+ }
return system_data;
#else
@@ -3151,11 +3163,15 @@ QString QLocaleData::longLongToString(const QChar zero, const QChar group,
negative = false; // neither are negative numbers
}
- QString num_str;
- if (base == 10)
- num_str = qlltoa(l, base, zero);
- else
- num_str = qulltoa(l, base, zero);
+QT_WARNING_PUSH
+ /* "unary minus operator applied to unsigned type, result still unsigned" */
+QT_WARNING_DISABLE_MSVC(4146)
+ /*
+ Negating std::numeric_limits<qlonglong>::min() hits undefined behavior, so
+ taking an absolute value has to cast to unsigned to change sign.
+ */
+ QString num_str = qulltoa(negative ? -qulonglong(l) : qulonglong(l), base, zero);
+QT_WARNING_POP
uint cnt_thousand_sep = 0;
if (flags & ThousandsGroup && base == 10) {
diff --git a/src/corelib/tools/qlocale.h b/src/corelib/tools/qlocale.h
index 54b1a32946..ef7a26ea79 100644
--- a/src/corelib/tools/qlocale.h
+++ b/src/corelib/tools/qlocale.h
@@ -949,23 +949,23 @@ public:
QString nativeCountryName() const;
#if QT_STRINGVIEW_LEVEL < 2
- short toShort(const QString &s, bool *ok = Q_NULLPTR) const;
- ushort toUShort(const QString &s, bool *ok = Q_NULLPTR) const;
- int toInt(const QString &s, bool *ok = Q_NULLPTR) const;
- uint toUInt(const QString &s, bool *ok = Q_NULLPTR) const;
- qlonglong toLongLong(const QString &s, bool *ok = Q_NULLPTR) const;
- qulonglong toULongLong(const QString &s, bool *ok = Q_NULLPTR) const;
- float toFloat(const QString &s, bool *ok = Q_NULLPTR) const;
- double toDouble(const QString &s, bool *ok = Q_NULLPTR) const;
+ short toShort(const QString &s, bool *ok = nullptr) const;
+ ushort toUShort(const QString &s, bool *ok = nullptr) const;
+ int toInt(const QString &s, bool *ok = nullptr) const;
+ uint toUInt(const QString &s, bool *ok = nullptr) const;
+ qlonglong toLongLong(const QString &s, bool *ok = nullptr) const;
+ qulonglong toULongLong(const QString &s, bool *ok = nullptr) const;
+ float toFloat(const QString &s, bool *ok = nullptr) const;
+ double toDouble(const QString &s, bool *ok = nullptr) const;
- short toShort(const QStringRef &s, bool *ok = Q_NULLPTR) const;
- ushort toUShort(const QStringRef &s, bool *ok = Q_NULLPTR) const;
- int toInt(const QStringRef &s, bool *ok = Q_NULLPTR) const;
- uint toUInt(const QStringRef &s, bool *ok = Q_NULLPTR) const;
- qlonglong toLongLong(const QStringRef &s, bool *ok = Q_NULLPTR) const;
- qulonglong toULongLong(const QStringRef &s, bool *ok = Q_NULLPTR) const;
- float toFloat(const QStringRef &s, bool *ok = Q_NULLPTR) const;
- double toDouble(const QStringRef &s, bool *ok = Q_NULLPTR) const;
+ short toShort(const QStringRef &s, bool *ok = nullptr) const;
+ ushort toUShort(const QStringRef &s, bool *ok = nullptr) const;
+ int toInt(const QStringRef &s, bool *ok = nullptr) const;
+ uint toUInt(const QStringRef &s, bool *ok = nullptr) const;
+ qlonglong toLongLong(const QStringRef &s, bool *ok = nullptr) const;
+ qulonglong toULongLong(const QStringRef &s, bool *ok = nullptr) const;
+ float toFloat(const QStringRef &s, bool *ok = nullptr) const;
+ double toDouble(const QStringRef &s, bool *ok = nullptr) const;
#endif
short toShort(QStringView s, bool *ok = nullptr) const;
diff --git a/src/corelib/tools/qlocale_tools.cpp b/src/corelib/tools/qlocale_tools.cpp
index 3e4f37501e..4d969a4723 100644
--- a/src/corelib/tools/qlocale_tools.cpp
+++ b/src/corelib/tools/qlocale_tools.cpp
@@ -456,11 +456,6 @@ QString qulltoa(qulonglong l, int base, const QChar _zero)
return QString(reinterpret_cast<QChar *>(p), 65 - (p - buff));
}
-QString qlltoa(qlonglong l, int base, const QChar zero)
-{
- return qulltoa(l < 0 ? -l : l, base, zero);
-}
-
QString &decimalForm(QChar zero, QChar decimal, QChar group,
QString &digits, int decpt, int precision,
PrecisionMode pm,
diff --git a/src/corelib/tools/qlocale_tools_p.h b/src/corelib/tools/qlocale_tools_p.h
index 6133f67add..742abb4957 100644
--- a/src/corelib/tools/qlocale_tools_p.h
+++ b/src/corelib/tools/qlocale_tools_p.h
@@ -83,7 +83,6 @@ void doubleToAscii(double d, QLocaleData::DoubleForm form, int precision, char *
bool &sign, int &length, int &decpt);
QString qulltoa(qulonglong l, int base, const QChar _zero);
-QString qlltoa(qlonglong l, int base, const QChar zero);
Q_CORE_EXPORT QString qdtoa(qreal d, int *decpt, int *sign);
enum PrecisionMode {
diff --git a/src/corelib/tools/qlocale_win.cpp b/src/corelib/tools/qlocale_win.cpp
index 1d80320d8e..30aefb71c1 100644
--- a/src/corelib/tools/qlocale_win.cpp
+++ b/src/corelib/tools/qlocale_win.cpp
@@ -326,9 +326,7 @@ QVariant QSystemLocalePrivate::timeFormat(QLocale::FormatType type)
{
switch (type) {
case QLocale::ShortFormat:
- if (QSysInfo::windowsVersion() >= QSysInfo::WV_WINDOWS7)
- return winToQtFormat(getLocaleInfo(LOCALE_SSHORTTIME));
- // fall through
+ return winToQtFormat(getLocaleInfo(LOCALE_SSHORTTIME));
case QLocale::LongFormat:
return winToQtFormat(getLocaleInfo(LOCALE_STIMEFORMAT));
case QLocale::NarrowFormat:
@@ -367,7 +365,7 @@ QVariant QSystemLocalePrivate::dayName(int day, QLocale::FormatType type)
if (type == QLocale::LongFormat)
return getLocaleInfo(long_day_map[day]);
- else if (type == QLocale::NarrowFormat && QSysInfo::windowsVersion() >= QSysInfo::WV_VISTA)
+ else if (type == QLocale::NarrowFormat)
return getLocaleInfo(narrow_day_map[day]);
return getLocaleInfo(short_day_map[day]);
}
@@ -425,7 +423,7 @@ QVariant QSystemLocalePrivate::toString(const QTime &time, QLocale::FormatType t
DWORD flags = 0;
// keep the same conditional as timeFormat() above
- if (type == QLocale::ShortFormat && QSysInfo::windowsVersion() >= QSysInfo::WV_WINDOWS7)
+ if (type == QLocale::ShortFormat)
flags = TIME_NOSECONDS;
wchar_t buf[255];
@@ -656,15 +654,11 @@ QVariant QSystemLocalePrivate::uiLanguages()
QVariant QSystemLocalePrivate::nativeLanguageName()
{
- if (QSysInfo::windowsVersion() < QSysInfo::WV_WINDOWS7)
- return getLocaleInfo(LOCALE_SNATIVELANGNAME);
return getLocaleInfo(LOCALE_SNATIVELANGUAGENAME);
}
QVariant QSystemLocalePrivate::nativeCountryName()
{
- if (QSysInfo::windowsVersion() < QSysInfo::WV_WINDOWS7)
- return getLocaleInfo(LOCALE_SNATIVECTRYNAME);
return getLocaleInfo(LOCALE_SNATIVECOUNTRYNAME);
}
diff --git a/src/corelib/tools/qmap.cpp b/src/corelib/tools/qmap.cpp
index afdd30e5c8..5a20c581e9 100644
--- a/src/corelib/tools/qmap.cpp
+++ b/src/corelib/tools/qmap.cpp
@@ -509,7 +509,7 @@ void QMapDataBase::freeData(QMapDataBase *d)
\sa QMapIterator, QMutableMapIterator, QHash, QSet
*/
-/*! \fn QMap::QMap()
+/*! \fn template <class Key, class T> QMap<Key, T>::QMap()
Constructs an empty map.
@@ -517,7 +517,7 @@ void QMapDataBase::freeData(QMapDataBase *d)
*/
/*!
- \fn QMap::QMap(QMap<Key, T> &&other)
+ \fn template <class Key, class T> QMap<Key, T>::QMap(QMap<Key, T> &&other)
Move-constructs a QMap instance, making it point at the same
object that \a other was pointing to.
@@ -525,7 +525,7 @@ void QMapDataBase::freeData(QMapDataBase *d)
\since 5.2
*/
-/*! \fn QMap::QMap(const QMap<Key, T> &other)
+/*! \fn template <class Key, class T> QMap<Key, T>::QMap(const QMap<Key, T> &other)
Constructs a copy of \a other.
@@ -537,14 +537,14 @@ void QMapDataBase::freeData(QMapDataBase *d)
\sa operator=()
*/
-/*! \fn QMap::QMap(const std::map<Key, T> & other)
+/*! \fn template <class Key, class T> QMap<Key, T>::QMap(const std::map<Key, T> & other)
Constructs a copy of \a other.
\sa toStdMap()
*/
-/*! \fn QMap::QMap(std::initializer_list<std::pair<Key,T> > list)
+/*! \fn template <class Key, class T> QMap<Key, T>::QMap(std::initializer_list<std::pair<Key,T> > list)
\since 5.1
Constructs a map with a copy of each of the elements in the
@@ -554,45 +554,45 @@ void QMapDataBase::freeData(QMapDataBase *d)
compiled in C++11 mode.
*/
-/*! \fn std::map<Key, T> QMap::toStdMap() const
+/*! \fn template <class Key, class T> std::map<Key, T> QMap<Key, T>::toStdMap() const
Returns an STL map equivalent to this QMap.
*/
-/*! \fn QMap::~QMap()
+/*! \fn template <class Key, class T> QMap<Key, T>::~QMap()
Destroys the map. References to the values in the map, and all
iterators over this map, become invalid.
*/
-/*! \fn QMap<Key, T> &QMap::operator=(const QMap<Key, T> &other)
+/*! \fn template <class Key, class T> QMap<Key, T> &QMap<Key, T>::operator=(const QMap<Key, T> &other)
Assigns \a other to this map and returns a reference to this map.
*/
/*!
- \fn QMap<Key, T> &QMap::operator=(QMap<Key, T> &&other)
+ \fn template <class Key, class T> QMap<Key, T> &QMap<Key, T>::operator=(QMap<Key, T> &&other)
Move-assigns \a other to this QMap instance.
\since 5.2
*/
-/*! \fn void QMap::swap(QMap<Key, T> &other)
+/*! \fn template <class Key, class T> void QMap<Key, T>::swap(QMap<Key, T> &other)
\since 4.8
Swaps map \a other with this map. This operation is very
fast and never fails.
*/
-/*! \fn void QMultiMap::swap(QMultiMap<Key, T> &other)
+/*! \fn template <class Key, class T> void QMultiMap<Key, T>::swap(QMultiMap<Key, T> &other)
\since 4.8
Swaps map \a other with this map. This operation is very
fast and never fails.
*/
-/*! \fn bool QMap::operator==(const QMap<Key, T> &other) const
+/*! \fn template <class Key, class T> bool QMap<Key, T>::operator==(const QMap<Key, T> &other) const
Returns \c true if \a other is equal to this map; otherwise returns
false.
@@ -606,7 +606,7 @@ void QMapDataBase::freeData(QMapDataBase *d)
\sa operator!=()
*/
-/*! \fn bool QMap::operator!=(const QMap<Key, T> &other) const
+/*! \fn template <class Key, class T> bool QMap<Key, T>::operator!=(const QMap<Key, T> &other) const
Returns \c true if \a other is not equal to this map; otherwise
returns \c false.
@@ -620,7 +620,7 @@ void QMapDataBase::freeData(QMapDataBase *d)
\sa operator==()
*/
-/*! \fn int QMap::size() const
+/*! \fn template <class Key, class T> int QMap<Key, T>::size() const
Returns the number of (key, value) pairs in the map.
@@ -628,7 +628,7 @@ void QMapDataBase::freeData(QMapDataBase *d)
*/
/*!
- \fn bool QMap::isEmpty() const
+ \fn template <class Key, class T> bool QMap<Key, T>::isEmpty() const
Returns \c true if the map contains no items; otherwise returns
false.
@@ -636,7 +636,7 @@ void QMapDataBase::freeData(QMapDataBase *d)
\sa size()
*/
-/*! \fn void QMap::detach()
+/*! \fn template <class Key, class T> void QMap<Key, T>::detach()
\internal
@@ -646,7 +646,7 @@ void QMapDataBase::freeData(QMapDataBase *d)
\sa isDetached()
*/
-/*! \fn bool QMap::isDetached() const
+/*! \fn template <class Key, class T> bool QMap<Key, T>::isDetached() const
\internal
@@ -656,24 +656,24 @@ void QMapDataBase::freeData(QMapDataBase *d)
\sa detach()
*/
-/*! \fn void QMap::setSharable(bool sharable)
+/*! \fn template <class Key, class T> void QMap<Key, T>::setSharable(bool sharable)
\internal
*/
-/*! \fn bool QMap::isSharedWith(const QMap<Key, T> &other) const
+/*! \fn template <class Key, class T> bool QMap<Key, T>::isSharedWith(const QMap<Key, T> &other) const
\internal
*/
-/*! \fn void QMap::clear()
+/*! \fn template <class Key, class T> void QMap<Key, T>::clear()
Removes all items from the map.
\sa remove()
*/
-/*! \fn int QMap::remove(const Key &key)
+/*! \fn template <class Key, class T> int QMap<Key, T>::remove(const Key &key)
Removes all the items that have the key \a key from the map.
Returns the number of items removed which is usually 1 but will be
@@ -683,7 +683,7 @@ void QMapDataBase::freeData(QMapDataBase *d)
\sa clear(), take(), QMultiMap::remove()
*/
-/*! \fn T QMap::take(const Key &key)
+/*! \fn template <class Key, class T> T QMap<Key, T>::take(const Key &key)
Removes the item with the key \a key from the map and returns
the value associated with it.
@@ -698,7 +698,7 @@ void QMapDataBase::freeData(QMapDataBase *d)
\sa remove()
*/
-/*! \fn bool QMap::contains(const Key &key) const
+/*! \fn template <class Key, class T> bool QMap<Key, T>::contains(const Key &key) const
Returns \c true if the map contains an item with key \a key;
otherwise returns \c false.
@@ -706,7 +706,7 @@ void QMapDataBase::freeData(QMapDataBase *d)
\sa count(), QMultiMap::contains()
*/
-/*! \fn const T QMap::value(const Key &key, const T &defaultValue) const
+/*! \fn template <class Key, class T> const T QMap<Key, T>::value(const Key &key, const T &defaultValue) const
Returns the value associated with the key \a key.
@@ -719,7 +719,7 @@ void QMapDataBase::freeData(QMapDataBase *d)
\sa key(), values(), contains(), operator[]()
*/
-/*! \fn T &QMap::operator[](const Key &key)
+/*! \fn template <class Key, class T> T &QMap<Key, T>::operator[](const Key &key)
Returns the value associated with the key \a key as a modifiable
reference.
@@ -733,14 +733,14 @@ void QMapDataBase::freeData(QMapDataBase *d)
\sa insert(), value()
*/
-/*! \fn const T QMap::operator[](const Key &key) const
+/*! \fn template <class Key, class T> const T QMap<Key, T>::operator[](const Key &key) const
\overload
Same as value().
*/
-/*! \fn QList<Key> QMap::uniqueKeys() const
+/*! \fn template <class Key, class T> QList<Key> QMap<Key, T>::uniqueKeys() const
\since 4.2
Returns a list containing all the keys in the map in ascending
@@ -751,7 +751,7 @@ void QMapDataBase::freeData(QMapDataBase *d)
\sa keys(), values()
*/
-/*! \fn QList<Key> QMap::keys() const
+/*! \fn template <class Key, class T> QList<Key> QMap<Key, T>::keys() const
Returns a list containing all the keys in the map in ascending
order. Keys that occur multiple times in the map (because items
@@ -766,7 +766,7 @@ void QMapDataBase::freeData(QMapDataBase *d)
\sa uniqueKeys(), values(), key()
*/
-/*! \fn QList<Key> QMap::keys(const T &value) const
+/*! \fn template <class Key, class T> QList<Key> QMap<Key, T>::keys(const T &value) const
\overload
@@ -779,7 +779,7 @@ void QMapDataBase::freeData(QMapDataBase *d)
*/
/*!
- \fn Key QMap::key(const T &value, const Key &defaultKey) const
+ \fn template <class Key, class T> Key QMap<Key, T>::key(const T &value, const Key &defaultKey) const
\since 4.3
\overload
@@ -795,7 +795,7 @@ void QMapDataBase::freeData(QMapDataBase *d)
\sa value(), keys()
*/
-/*! \fn QList<T> QMap::values() const
+/*! \fn template <class Key, class T> QList<T> QMap<Key, T>::values() const
Returns a list containing all the values in the map, in ascending
order of their keys. If a key is associated with multiple values,
@@ -805,7 +805,7 @@ void QMapDataBase::freeData(QMapDataBase *d)
\sa keys(), value()
*/
-/*! \fn QList<T> QMap::values(const Key &key) const
+/*! \fn template <class Key, class T> QList<T> QMap<Key, T>::values(const Key &key) const
\overload
@@ -816,21 +816,21 @@ void QMapDataBase::freeData(QMapDataBase *d)
\sa count(), insertMulti()
*/
-/*! \fn int QMap::count(const Key &key) const
+/*! \fn template <class Key, class T> int QMap<Key, T>::count(const Key &key) const
Returns the number of items associated with key \a key.
\sa contains(), insertMulti(), QMultiMap::count()
*/
-/*! \fn int QMap::count() const
+/*! \fn template <class Key, class T> int QMap<Key, T>::count() const
\overload
Same as size().
*/
-/*! \fn QMap::iterator QMap::begin()
+/*! \fn template <class Key, class T> QMap<Key, T>::iterator QMap<Key, T>::begin()
Returns an \l{STL-style iterators}{STL-style iterator} pointing to the first item in
the map.
@@ -838,12 +838,12 @@ void QMapDataBase::freeData(QMapDataBase *d)
\sa constBegin(), end()
*/
-/*! \fn QMap::const_iterator QMap::begin() const
+/*! \fn template <class Key, class T> QMap<Key, T>::const_iterator QMap<Key, T>::begin() const
\overload
*/
-/*! \fn QMap::const_iterator QMap::cbegin() const
+/*! \fn template <class Key, class T> QMap<Key, T>::const_iterator QMap<Key, T>::cbegin() const
\since 5.0
Returns a const \l{STL-style iterators}{STL-style iterator} pointing to the first item
@@ -852,7 +852,7 @@ void QMapDataBase::freeData(QMapDataBase *d)
\sa begin(), cend()
*/
-/*! \fn QMap::const_iterator QMap::constBegin() const
+/*! \fn template <class Key, class T> QMap<Key, T>::const_iterator QMap<Key, T>::constBegin() const
Returns a const \l{STL-style iterators}{STL-style iterator} pointing to the first item
in the map.
@@ -860,7 +860,7 @@ void QMapDataBase::freeData(QMapDataBase *d)
\sa begin(), constEnd()
*/
-/*! \fn QMap::key_iterator QMap::keyBegin() const
+/*! \fn template <class Key, class T> QMap<Key, T>::key_iterator QMap<Key, T>::keyBegin() const
\since 5.6
Returns a const \l{STL-style iterators}{STL-style iterator} pointing to the first key
@@ -869,7 +869,7 @@ void QMapDataBase::freeData(QMapDataBase *d)
\sa keyEnd(), firstKey()
*/
-/*! \fn QMap::iterator QMap::end()
+/*! \fn template <class Key, class T> QMap<Key, T>::iterator QMap<Key, T>::end()
Returns an \l{STL-style iterators}{STL-style iterator} pointing to the imaginary item
after the last item in the map.
@@ -877,12 +877,12 @@ void QMapDataBase::freeData(QMapDataBase *d)
\sa begin(), constEnd()
*/
-/*! \fn QMap::const_iterator QMap::end() const
+/*! \fn template <class Key, class T> QMap<Key, T>::const_iterator QMap<Key, T>::end() const
\overload
*/
-/*! \fn QMap::const_iterator QMap::cend() const
+/*! \fn template <class Key, class T> QMap<Key, T>::const_iterator QMap<Key, T>::cend() const
\since 5.0
Returns a const \l{STL-style iterators}{STL-style iterator} pointing to the imaginary
@@ -891,7 +891,7 @@ void QMapDataBase::freeData(QMapDataBase *d)
\sa cbegin(), end()
*/
-/*! \fn QMap::const_iterator QMap::constEnd() const
+/*! \fn template <class Key, class T> QMap<Key, T>::const_iterator QMap<Key, T>::constEnd() const
Returns a const \l{STL-style iterators}{STL-style iterator} pointing to the imaginary
item after the last item in the map.
@@ -899,7 +899,7 @@ void QMapDataBase::freeData(QMapDataBase *d)
\sa constBegin(), end()
*/
-/*! \fn QMap::key_iterator QMap::keyEnd() const
+/*! \fn template <class Key, class T> QMap<Key, T>::key_iterator QMap<Key, T>::keyEnd() const
\since 5.6
Returns a const \l{STL-style iterators}{STL-style iterator} pointing to the imaginary
@@ -909,7 +909,7 @@ void QMapDataBase::freeData(QMapDataBase *d)
*/
-/*! \fn QMap::key_value_iterator QMap::keyValueBegin()
+/*! \fn template <class Key, class T> QMap<Key, T>::key_value_iterator QMap<Key, T>::keyValueBegin()
\since 5.10
Returns an \l{STL-style iterators}{STL-style iterator} pointing to the first entry
@@ -918,7 +918,7 @@ void QMapDataBase::freeData(QMapDataBase *d)
\sa keyValueEnd()
*/
-/*! \fn QMap::key_value_iterator QMap::keyValueEnd()
+/*! \fn template <class Key, class T> QMap<Key, T>::key_value_iterator QMap<Key, T>::keyValueEnd()
\since 5.10
Returns an \l{STL-style iterators}{STL-style iterator} pointing to the imaginary
@@ -927,7 +927,7 @@ void QMapDataBase::freeData(QMapDataBase *d)
\sa keyValueBegin()
*/
-/*! \fn QMap::const_key_value_iterator QMap::keyValueBegin() const
+/*! \fn template <class Key, class T> QMap<Key, T>::const_key_value_iterator QMap<Key, T>::keyValueBegin() const
\since 5.10
Returns a const \l{STL-style iterators}{STL-style iterator} pointing to the first entry
@@ -936,7 +936,7 @@ void QMapDataBase::freeData(QMapDataBase *d)
\sa keyValueEnd()
*/
-/*! \fn QMap::const_key_value_iterator QMap::constKeyValueBegin() const
+/*! \fn template <class Key, class T> QMap<Key, T>::const_key_value_iterator QMap<Key, T>::constKeyValueBegin() const
\since 5.10
Returns a const \l{STL-style iterators}{STL-style iterator} pointing to the first entry
@@ -945,7 +945,7 @@ void QMapDataBase::freeData(QMapDataBase *d)
\sa keyValueBegin()
*/
-/*! \fn QMap::const_key_value_iterator QMap::keyValueEnd() const
+/*! \fn template <class Key, class T> QMap<Key, T>::const_key_value_iterator QMap<Key, T>::keyValueEnd() const
\since 5.10
Returns a const \l{STL-style iterators}{STL-style iterator} pointing to the imaginary
@@ -954,7 +954,7 @@ void QMapDataBase::freeData(QMapDataBase *d)
\sa keyValueBegin()
*/
-/*! \fn QMap::const_key_value_iterator QMap::constKeyValueEnd() const
+/*! \fn template <class Key, class T> QMap<Key, T>::const_key_value_iterator QMap<Key, T>::constKeyValueEnd() const
\since 5.10
Returns a const \l{STL-style iterators}{STL-style iterator} pointing to the imaginary
@@ -963,7 +963,7 @@ void QMapDataBase::freeData(QMapDataBase *d)
\sa constKeyValueBegin()
*/
-/*! \fn const Key &QMap::firstKey() const
+/*! \fn template <class Key, class T> const Key &QMap<Key, T>::firstKey() const
\since 5.2
Returns a reference to the smallest key in the map.
@@ -974,7 +974,7 @@ void QMapDataBase::freeData(QMapDataBase *d)
\sa lastKey(), first(), keyBegin(), isEmpty()
*/
-/*! \fn const Key &QMap::lastKey() const
+/*! \fn template <class Key, class T> const Key &QMap<Key, T>::lastKey() const
\since 5.2
Returns a reference to the largest key in the map.
@@ -985,7 +985,7 @@ void QMapDataBase::freeData(QMapDataBase *d)
\sa firstKey(), last(), keyEnd(), isEmpty()
*/
-/*! \fn T &QMap::first()
+/*! \fn template <class Key, class T> T &QMap<Key, T>::first()
\since 5.2
Returns a reference to the first value in the map, that is the value mapped
@@ -996,13 +996,13 @@ void QMapDataBase::freeData(QMapDataBase *d)
\sa last(), firstKey(), isEmpty()
*/
-/*! \fn const T &QMap::first() const
+/*! \fn template <class Key, class T> const T &QMap<Key, T>::first() const
\since 5.2
\overload
*/
-/*! \fn T &QMap::last()
+/*! \fn template <class Key, class T> T &QMap<Key, T>::last()
\since 5.2
Returns a reference to the last value in the map, that is the value mapped
@@ -1013,13 +1013,13 @@ void QMapDataBase::freeData(QMapDataBase *d)
\sa first(), lastKey(), isEmpty()
*/
-/*! \fn const T &QMap::last() const
+/*! \fn template <class Key, class T> const T &QMap<Key, T>::last() const
\since 5.2
\overload
*/
-/*! \fn QMap::iterator QMap::erase(iterator pos)
+/*! \fn template <class Key, class T> QMap<Key, T>::iterator QMap<Key, T>::erase(iterator pos)
Removes the (key, value) pair pointed to by the iterator \a pos
from the map, and returns an iterator to the next item in the
@@ -1028,7 +1028,7 @@ void QMapDataBase::freeData(QMapDataBase *d)
\sa remove()
*/
-/*! \fn QMap::iterator QMap::find(const Key &key)
+/*! \fn template <class Key, class T> QMap<Key, T>::iterator QMap<Key, T>::find(const Key &key)
Returns an iterator pointing to the item with key \a key in the
map.
@@ -1047,12 +1047,12 @@ void QMapDataBase::freeData(QMapDataBase *d)
\sa constFind(), value(), values(), lowerBound(), upperBound(), QMultiMap::find()
*/
-/*! \fn QMap::const_iterator QMap::find(const Key &key) const
+/*! \fn template <class Key, class T> QMap<Key, T>::const_iterator QMap<Key, T>::find(const Key &key) const
\overload
*/
-/*! \fn QMap::const_iterator QMap::constFind(const Key &key) const
+/*! \fn template <class Key, class T> QMap<Key, T>::const_iterator QMap<Key, T>::constFind(const Key &key) const
\since 4.1
Returns an const iterator pointing to the item with key \a key in the
@@ -1064,7 +1064,7 @@ void QMapDataBase::freeData(QMapDataBase *d)
\sa find(), QMultiMap::constFind()
*/
-/*! \fn QMap::iterator QMap::lowerBound(const Key &key)
+/*! \fn template <class Key, class T> QMap<Key, T>::iterator QMap<Key, T>::lowerBound(const Key &key)
Returns an iterator pointing to the first item with key \a key in
the map. If the map contains no item with key \a key, the
@@ -1085,12 +1085,12 @@ void QMapDataBase::freeData(QMapDataBase *d)
\sa upperBound(), find()
*/
-/*! \fn QMap::const_iterator QMap::lowerBound(const Key &key) const
+/*! \fn template <class Key, class T> QMap<Key, T>::const_iterator QMap<Key, T>::lowerBound(const Key &key) const
\overload
*/
-/*! \fn QMap::iterator QMap::upperBound(const Key &key)
+/*! \fn template <class Key, class T> QMap<Key, T>::iterator QMap<Key, T>::upperBound(const Key &key)
Returns an iterator pointing to the item that immediately follows
the last item with key \a key in the map. If the map contains no
@@ -1103,12 +1103,12 @@ void QMapDataBase::freeData(QMapDataBase *d)
\sa lowerBound(), find()
*/
-/*! \fn QMap::const_iterator QMap::upperBound(const Key &key) const
+/*! \fn template <class Key, class T> QMap<Key, T>::const_iterator QMap<Key, T>::upperBound(const Key &key) const
\overload
*/
-/*! \fn QMap::iterator QMap::insert(const Key &key, const T &value)
+/*! \fn template <class Key, class T> QMap<Key, T>::iterator QMap<Key, T>::insert(const Key &key, const T &value)
Inserts a new item with the key \a key and a value of \a value.
@@ -1121,7 +1121,7 @@ void QMapDataBase::freeData(QMapDataBase *d)
\sa insertMulti()
*/
-/*! \fn QMap::iterator QMap::insert(const_iterator pos, const Key &key, const T &value)
+/*! \fn template <class Key, class T> QMap<Key, T>::iterator QMap<Key, T>::insert(const_iterator pos, const Key &key, const T &value)
\overload
\since 5.1
Inserts a new item with the key \a key and value \a value and with hint \a pos
@@ -1150,7 +1150,7 @@ void QMapDataBase::freeData(QMapDataBase *d)
\sa insertMulti()
*/
-/*! \fn QMap::iterator QMap::insertMulti(const Key &key, const T &value)
+/*! \fn template <class Key, class T> QMap<Key, T>::iterator QMap<Key, T>::insertMulti(const Key &key, const T &value)
Inserts a new item with the key \a key and a value of \a value.
@@ -1162,7 +1162,7 @@ void QMapDataBase::freeData(QMapDataBase *d)
\sa insert(), values()
*/
-/*! \fn QMap::iterator QMap::insertMulti(const_iterator pos, const Key &key, const T &value)
+/*! \fn template <class Key, class T> QMap<Key, T>::iterator QMap<Key, T>::insertMulti(const_iterator pos, const Key &key, const T &value)
\overload
\since 5.1
Inserts a new item with the key \a key and value \a value and with hint \a pos
@@ -1182,7 +1182,7 @@ void QMapDataBase::freeData(QMapDataBase *d)
*/
-/*! \fn QMap<Key, T> &QMap::unite(const QMap<Key, T> &other)
+/*! \fn template <class Key, class T> QMap<Key, T> &QMap<Key, T>::unite(const QMap<Key, T> &other)
Inserts all the items in the \a other map into this map. If a
key is common to both maps, the resulting map will contain the
@@ -1193,12 +1193,12 @@ void QMapDataBase::freeData(QMapDataBase *d)
/*! \typedef QMap::Iterator
- Qt-style synonym for QMap::iterator.
+ Qt-style synonym for QMap<Key, T>::iterator.
*/
/*! \typedef QMap::ConstIterator
- Qt-style synonym for QMap::const_iterator.
+ Qt-style synonym for QMap<Key, T>::const_iterator.
*/
/*! \typedef QMap::difference_type
@@ -1222,7 +1222,7 @@ void QMapDataBase::freeData(QMapDataBase *d)
*/
/*!
- \fn bool QMap::empty() const
+ \fn template <class Key, class T> bool QMap<Key, T>::empty() const
This function is provided for STL compatibility. It is equivalent
to isEmpty(), returning true if the map is empty; otherwise
@@ -1230,14 +1230,14 @@ void QMapDataBase::freeData(QMapDataBase *d)
*/
/*!
- \fn QPair<iterator, iterator> QMap::equal_range(const Key &key)
+ \fn template <class Key, class T> QPair<iterator, iterator> QMap<Key, T>::equal_range(const Key &key)
Returns a pair of iterators delimiting the range of values \c{[first, second)}, that
are stored under \a key.
*/
/*!
- \fn QPair<const_iterator, const_iterator> QMap::equal_range(const Key &key) const
+ \fn template <class Key, class T> QPair<const_iterator, const_iterator> QMap<Key, T>::equal_range(const Key &key) const
\overload
\since 5.6
*/
@@ -1339,7 +1339,7 @@ void QMapDataBase::freeData(QMapDataBase *d)
\internal
*/
-/*! \fn QMap::iterator::iterator()
+/*! \fn template <class Key, class T> QMap<Key, T>::iterator::iterator()
Constructs an uninitialized iterator.
@@ -1350,12 +1350,12 @@ void QMapDataBase::freeData(QMapDataBase *d)
\sa QMap::begin(), QMap::end()
*/
-/*! \fn QMap::iterator::iterator(Node *)
+/*! \fn template <class Key, class T> QMap<Key, T>::iterator::iterator(Node *)
\internal
*/
-/*! \fn const Key &QMap::iterator::key() const
+/*! \fn template <class Key, class T> const Key &QMap<Key, T>::iterator::key() const
Returns the current item's key as a const reference.
@@ -1366,7 +1366,7 @@ void QMapDataBase::freeData(QMapDataBase *d)
\sa value()
*/
-/*! \fn T &QMap::iterator::value() const
+/*! \fn template <class Key, class T> T &QMap<Key, T>::iterator::value() const
Returns a modifiable reference to the current item's value.
@@ -1378,7 +1378,7 @@ void QMapDataBase::freeData(QMapDataBase *d)
\sa key(), operator*()
*/
-/*! \fn T &QMap::iterator::operator*() const
+/*! \fn template <class Key, class T> T &QMap<Key, T>::iterator::operator*() const
Returns a modifiable reference to the current item's value.
@@ -1387,7 +1387,7 @@ void QMapDataBase::freeData(QMapDataBase *d)
\sa key()
*/
-/*! \fn T *QMap::iterator::operator->() const
+/*! \fn template <class Key, class T> T *QMap<Key, T>::iterator::operator->() const
Returns a pointer to the current item's value.
@@ -1395,8 +1395,8 @@ void QMapDataBase::freeData(QMapDataBase *d)
*/
/*!
- \fn bool QMap::iterator::operator==(const iterator &other) const
- \fn bool QMap::iterator::operator==(const const_iterator &other) const
+ \fn template <class Key, class T> bool QMap<Key, T>::iterator::operator==(const iterator &other) const
+ \fn template <class Key, class T> bool QMap<Key, T>::iterator::operator==(const const_iterator &other) const
Returns \c true if \a other points to the same item as this
iterator; otherwise returns \c false.
@@ -1405,8 +1405,8 @@ void QMapDataBase::freeData(QMapDataBase *d)
*/
/*!
- \fn bool QMap::iterator::operator!=(const iterator &other) const
- \fn bool QMap::iterator::operator!=(const const_iterator &other) const
+ \fn template <class Key, class T> bool QMap<Key, T>::iterator::operator!=(const iterator &other) const
+ \fn template <class Key, class T> bool QMap<Key, T>::iterator::operator!=(const const_iterator &other) const
Returns \c true if \a other points to a different item than this
iterator; otherwise returns \c false.
@@ -1414,7 +1414,7 @@ void QMapDataBase::freeData(QMapDataBase *d)
\sa operator==()
*/
-/*! \fn QMap::iterator QMap::iterator::operator++()
+/*! \fn template <class Key, class T> QMap<Key, T>::iterator QMap<Key, T>::iterator::operator++()
The prefix ++ operator (\c{++i}) advances the iterator to the
next item in the map and returns an iterator to the new current
@@ -1425,7 +1425,7 @@ void QMapDataBase::freeData(QMapDataBase *d)
\sa operator--()
*/
-/*! \fn QMap::iterator QMap::iterator::operator++(int)
+/*! \fn template <class Key, class T> QMap<Key, T>::iterator QMap<Key, T>::iterator::operator++(int)
\overload
@@ -1434,7 +1434,7 @@ void QMapDataBase::freeData(QMapDataBase *d)
current item.
*/
-/*! \fn QMap::iterator QMap::iterator::operator--()
+/*! \fn template <class Key, class T> QMap<Key, T>::iterator QMap<Key, T>::iterator::operator--()
The prefix -- operator (\c{--i}) makes the preceding item
current and returns an iterator pointing to the new current item.
@@ -1445,7 +1445,7 @@ void QMapDataBase::freeData(QMapDataBase *d)
\sa operator++()
*/
-/*! \fn QMap::iterator QMap::iterator::operator--(int)
+/*! \fn template <class Key, class T> QMap<Key, T>::iterator QMap<Key, T>::iterator::operator--(int)
\overload
@@ -1454,7 +1454,7 @@ void QMapDataBase::freeData(QMapDataBase *d)
current item.
*/
-/*! \fn QMap::iterator QMap::iterator::operator+(int j) const
+/*! \fn template <class Key, class T> QMap<Key, T>::iterator QMap<Key, T>::iterator::operator+(int j) const
Returns an iterator to the item at \a j positions forward from
this iterator. (If \a j is negative, the iterator goes backward.)
@@ -1465,7 +1465,7 @@ void QMapDataBase::freeData(QMapDataBase *d)
*/
-/*! \fn QMap::iterator QMap::iterator::operator-(int j) const
+/*! \fn template <class Key, class T> QMap<Key, T>::iterator QMap<Key, T>::iterator::operator-(int j) const
Returns an iterator to the item at \a j positions backward from
this iterator. (If \a j is negative, the iterator goes forward.)
@@ -1475,7 +1475,7 @@ void QMapDataBase::freeData(QMapDataBase *d)
\sa operator+()
*/
-/*! \fn QMap::iterator &QMap::iterator::operator+=(int j)
+/*! \fn template <class Key, class T> QMap<Key, T>::iterator &QMap<Key, T>::iterator::operator+=(int j)
Advances the iterator by \a j items. (If \a j is negative, the
iterator goes backward.)
@@ -1483,7 +1483,7 @@ void QMapDataBase::freeData(QMapDataBase *d)
\sa operator-=(), operator+()
*/
-/*! \fn QMap::iterator &QMap::iterator::operator-=(int j)
+/*! \fn template <class Key, class T> QMap<Key, T>::iterator &QMap<Key, T>::iterator::operator-=(int j)
Makes the iterator go back by \a j items. (If \a j is negative,
the iterator goes forward.)
@@ -1562,7 +1562,7 @@ void QMapDataBase::freeData(QMapDataBase *d)
\internal
*/
-/*! \fn QMap::const_iterator::const_iterator()
+/*! \fn template <class Key, class T> QMap<Key, T>::const_iterator::const_iterator()
Constructs an uninitialized iterator.
@@ -1573,31 +1573,31 @@ void QMapDataBase::freeData(QMapDataBase *d)
\sa QMap::constBegin(), QMap::constEnd()
*/
-/*! \fn QMap::const_iterator::const_iterator(const Node *)
+/*! \fn template <class Key, class T> QMap<Key, T>::const_iterator::const_iterator(const Node *)
\internal
*/
-/*! \fn QMap::const_iterator::const_iterator(const iterator &other)
+/*! \fn template <class Key, class T> QMap<Key, T>::const_iterator::const_iterator(const iterator &other)
Constructs a copy of \a other.
*/
-/*! \fn const Key &QMap::const_iterator::key() const
+/*! \fn template <class Key, class T> const Key &QMap<Key, T>::const_iterator::key() const
Returns the current item's key.
\sa value()
*/
-/*! \fn const T &QMap::const_iterator::value() const
+/*! \fn template <class Key, class T> const T &QMap<Key, T>::const_iterator::value() const
Returns the current item's value.
\sa key(), operator*()
*/
-/*! \fn const T &QMap::const_iterator::operator*() const
+/*! \fn template <class Key, class T> const T &QMap<Key, T>::const_iterator::operator*() const
Returns the current item's value.
@@ -1606,14 +1606,14 @@ void QMapDataBase::freeData(QMapDataBase *d)
\sa key()
*/
-/*! \fn const T *QMap::const_iterator::operator->() const
+/*! \fn template <class Key, class T> const T *QMap<Key, T>::const_iterator::operator->() const
Returns a pointer to the current item's value.
\sa value()
*/
-/*! \fn bool QMap::const_iterator::operator==(const const_iterator &other) const
+/*! \fn template <class Key, class T> bool QMap<Key, T>::const_iterator::operator==(const const_iterator &other) const
Returns \c true if \a other points to the same item as this
iterator; otherwise returns \c false.
@@ -1621,7 +1621,7 @@ void QMapDataBase::freeData(QMapDataBase *d)
\sa operator!=()
*/
-/*! \fn bool QMap::const_iterator::operator!=(const const_iterator &other) const
+/*! \fn template <class Key, class T> bool QMap<Key, T>::const_iterator::operator!=(const const_iterator &other) const
Returns \c true if \a other points to a different item than this
iterator; otherwise returns \c false.
@@ -1629,7 +1629,7 @@ void QMapDataBase::freeData(QMapDataBase *d)
\sa operator==()
*/
-/*! \fn QMap::const_iterator QMap::const_iterator::operator++()
+/*! \fn template <class Key, class T> QMap<Key, T>::const_iterator QMap<Key, T>::const_iterator::operator++()
The prefix ++ operator (\c{++i}) advances the iterator to the
next item in the map and returns an iterator to the new current
@@ -1640,7 +1640,7 @@ void QMapDataBase::freeData(QMapDataBase *d)
\sa operator--()
*/
-/*! \fn QMap::const_iterator QMap::const_iterator::operator++(int)
+/*! \fn template <class Key, class T> QMap<Key, T>::const_iterator QMap<Key, T>::const_iterator::operator++(int)
\overload
@@ -1649,7 +1649,7 @@ void QMapDataBase::freeData(QMapDataBase *d)
current item.
*/
-/*! \fn QMap::const_iterator &QMap::const_iterator::operator--()
+/*! \fn template <class Key, class T> QMap<Key, T>::const_iterator &QMap<Key, T>::const_iterator::operator--()
The prefix -- operator (\c{--i}) makes the preceding item
current and returns an iterator pointing to the new current item.
@@ -1660,7 +1660,7 @@ void QMapDataBase::freeData(QMapDataBase *d)
\sa operator++()
*/
-/*! \fn QMap::const_iterator QMap::const_iterator::operator--(int)
+/*! \fn template <class Key, class T> QMap<Key, T>::const_iterator QMap<Key, T>::const_iterator::operator--(int)
\overload
@@ -1669,7 +1669,7 @@ void QMapDataBase::freeData(QMapDataBase *d)
current item.
*/
-/*! \fn QMap::const_iterator QMap::const_iterator::operator+(int j) const
+/*! \fn template <class Key, class T> QMap<Key, T>::const_iterator QMap<Key, T>::const_iterator::operator+(int j) const
Returns an iterator to the item at \a j positions forward from
this iterator. (If \a j is negative, the iterator goes backward.)
@@ -1679,7 +1679,7 @@ void QMapDataBase::freeData(QMapDataBase *d)
\sa operator-()
*/
-/*! \fn QMap::const_iterator QMap::const_iterator::operator-(int j) const
+/*! \fn template <class Key, class T> QMap<Key, T>::const_iterator QMap<Key, T>::const_iterator::operator-(int j) const
Returns an iterator to the item at \a j positions backward from
this iterator. (If \a j is negative, the iterator goes forward.)
@@ -1689,7 +1689,7 @@ void QMapDataBase::freeData(QMapDataBase *d)
\sa operator+()
*/
-/*! \fn QMap::const_iterator &QMap::const_iterator::operator+=(int j)
+/*! \fn template <class Key, class T> QMap<Key, T>::const_iterator &QMap<Key, T>::const_iterator::operator+=(int j)
Advances the iterator by \a j items. (If \a j is negative, the
iterator goes backward.)
@@ -1699,7 +1699,7 @@ void QMapDataBase::freeData(QMapDataBase *d)
\sa operator-=(), operator+()
*/
-/*! \fn QMap::const_iterator &QMap::const_iterator::operator-=(int j)
+/*! \fn template <class Key, class T> QMap<Key, T>::const_iterator &QMap<Key, T>::const_iterator::operator-=(int j)
Makes the iterator go back by \a j items. (If \a j is negative,
the iterator goes forward.)
@@ -1766,17 +1766,17 @@ void QMapDataBase::freeData(QMapDataBase *d)
\internal
*/
-/*! \fn const T &QMap::key_iterator::operator*() const
+/*! \fn template <class Key, class T> const T &QMap<Key, T>::key_iterator::operator*() const
Returns the current item's key.
*/
-/*! \fn const T *QMap::key_iterator::operator->() const
+/*! \fn template <class Key, class T> const T *QMap<Key, T>::key_iterator::operator->() const
Returns a pointer to the current item's key.
*/
-/*! \fn bool QMap::key_iterator::operator==(key_iterator other) const
+/*! \fn template <class Key, class T> bool QMap<Key, T>::key_iterator::operator==(key_iterator other) const
Returns \c true if \a other points to the same item as this
iterator; otherwise returns \c false.
@@ -1784,7 +1784,7 @@ void QMapDataBase::freeData(QMapDataBase *d)
\sa operator!=()
*/
-/*! \fn bool QMap::key_iterator::operator!=(key_iterator other) const
+/*! \fn template <class Key, class T> bool QMap<Key, T>::key_iterator::operator!=(key_iterator other) const
Returns \c true if \a other points to a different item than this
iterator; otherwise returns \c false.
@@ -1793,7 +1793,7 @@ void QMapDataBase::freeData(QMapDataBase *d)
*/
/*!
- \fn QMap::key_iterator &QMap::key_iterator::operator++()
+ \fn template <class Key, class T> QMap<Key, T>::key_iterator &QMap<Key, T>::key_iterator::operator++()
The prefix ++ operator (\c{++i}) advances the iterator to the
next item in the hash and returns an iterator to the new current
@@ -1804,7 +1804,7 @@ void QMapDataBase::freeData(QMapDataBase *d)
\sa operator--()
*/
-/*! \fn QMap::key_iterator QMap::key_iterator::operator++(int)
+/*! \fn template <class Key, class T> QMap<Key, T>::key_iterator QMap<Key, T>::key_iterator::operator++(int)
\overload
@@ -1813,7 +1813,7 @@ void QMapDataBase::freeData(QMapDataBase *d)
item.
*/
-/*! \fn QMap::key_iterator &QMap::key_iterator::operator--()
+/*! \fn template <class Key, class T> QMap<Key, T>::key_iterator &QMap<Key, T>::key_iterator::operator--()
The prefix -- operator (\c{--i}) makes the preceding item
current and returns an iterator pointing to the new current item.
@@ -1824,7 +1824,7 @@ void QMapDataBase::freeData(QMapDataBase *d)
\sa operator++()
*/
-/*! \fn QMap::key_iterator QMap::key_iterator::operator--(int)
+/*! \fn template <class Key, class T> QMap<Key, T>::key_iterator QMap<Key, T>::key_iterator::operator--(int)
\overload
@@ -1833,10 +1833,22 @@ void QMapDataBase::freeData(QMapDataBase *d)
item.
*/
-/*! \fn const_iterator QMap::key_iterator::base() const
+/*! \fn template <class Key, class T> const_iterator QMap<Key, T>::key_iterator::base() const
Returns the underlying const_iterator this key_iterator is based on.
*/
+/*! \typedef QMap::const_key_value_iterator
+ \inmodule QtCore
+ \since 5.10
+ \brief The QMap::const_key_value_iterator typedef provides an STL-style iterator for QMap and QMultiMap.
+
+ QMap::const_key_value_iterator is essentially the same as QMap::const_iterator
+ with the difference that operator*() returns a key/value pair instead of a
+ value.
+
+ \sa QKeyValueIterator
+*/
+
/*! \typedef QMap::key_value_iterator
\inmodule QtCore
\since 5.10
@@ -1849,7 +1861,7 @@ void QMapDataBase::freeData(QMapDataBase *d)
\sa QKeyValueIterator
*/
-/*! \fn QDataStream &operator<<(QDataStream &out, const QMap<Key, T> &map)
+/*! \fn template <class Key, class T> QDataStream &operator<<(QDataStream &out, const QMap<Key, T> &map)
\relates QMap
Writes the map \a map to stream \a out.
@@ -1860,7 +1872,7 @@ void QMapDataBase::freeData(QMapDataBase *d)
\sa{Serializing Qt Data Types}{Format of the QDataStream operators}
*/
-/*! \fn QDataStream &operator>>(QDataStream &in, QMap<Key, T> &map)
+/*! \fn template <class Key, class T> QDataStream &operator>>(QDataStream &in, QMap<Key, T> &map)
\relates QMap
Reads a map from stream \a in into \a map.
@@ -1926,12 +1938,12 @@ void QMapDataBase::freeData(QMapDataBase *d)
\sa QMap, QMapIterator, QMutableMapIterator, QMultiHash
*/
-/*! \fn QMultiMap::QMultiMap()
+/*! \fn template <class Key, class T> QMultiMap<Key, T>::QMultiMap()
Constructs an empty map.
*/
-/*! \fn QMultiMap::QMultiMap(std::initializer_list<std::pair<Key,T> > list)
+/*! \fn template <class Key, class T> QMultiMap<Key, T>::QMultiMap(std::initializer_list<std::pair<Key,T> > list)
\since 5.1
Constructs a multi-map with a copy of each of the elements in the
@@ -1941,7 +1953,7 @@ void QMapDataBase::freeData(QMapDataBase *d)
compiled in C++11 mode.
*/
-/*! \fn QMultiMap::QMultiMap(const QMap<Key, T> &other)
+/*! \fn template <class Key, class T> QMultiMap<Key, T>::QMultiMap(const QMap<Key, T> &other)
Constructs a copy of \a other (which can be a QMap or a
QMultiMap).
@@ -1949,7 +1961,7 @@ void QMapDataBase::freeData(QMapDataBase *d)
\sa operator=()
*/
-/*! \fn QMultiMap::iterator QMultiMap::replace(const Key &key, const T &value)
+/*! \fn template <class Key, class T> QMultiMap<Key, T>::iterator QMultiMap<Key, T>::replace(const Key &key, const T &value)
Inserts a new item with the key \a key and a value of \a value.
@@ -1962,7 +1974,7 @@ void QMapDataBase::freeData(QMapDataBase *d)
\sa insert()
*/
-/*! \fn QMultiMap::iterator QMultiMap::insert(const Key &key, const T &value)
+/*! \fn template <class Key, class T> QMultiMap<Key, T>::iterator QMultiMap<Key, T>::insert(const Key &key, const T &value)
Inserts a new item with the key \a key and a value of \a value.
@@ -1974,7 +1986,7 @@ void QMapDataBase::freeData(QMapDataBase *d)
\sa replace()
*/
-/*! \fn QMultiMap::iterator QMultiMap::insert(QMap<Key, T>::const_iterator pos, const Key &key, const T &value)
+/*! \fn template <class Key, class T> typename QMap<Key, T>::iterator QMultiMap<Key, T>::insert(typename QMap<Key, T>::const_iterator pos, const Key &key, const T &value)
\since 5.1
Inserts a new item with the key \a key and value \a value and with hint \a pos
@@ -1991,7 +2003,7 @@ void QMapDataBase::freeData(QMapDataBase *d)
crash but there is also a risk that it will silently corrupt both the map and the \a pos map.
*/
-/*! \fn QMultiMap &QMultiMap::operator+=(const QMultiMap &other)
+/*! \fn template <class Key, class T> QMultiMap &QMultiMap<Key, T>::operator+=(const QMultiMap &other)
Inserts all the items in the \a other map into this map and
returns a reference to this map.
@@ -1999,7 +2011,7 @@ void QMapDataBase::freeData(QMapDataBase *d)
\sa insert(), operator+()
*/
-/*! \fn QMultiMap QMultiMap::operator+(const QMultiMap &other) const
+/*! \fn template <class Key, class T> QMultiMap QMultiMap<Key, T>::operator+(const QMultiMap &other) const
Returns a map that contains all the items in this map in
addition to all the items in \a other. If a key is common to both
@@ -2009,7 +2021,7 @@ void QMapDataBase::freeData(QMapDataBase *d)
*/
/*!
- \fn bool QMultiMap::contains(const Key &key, const T &value) const
+ \fn template <class Key, class T> bool QMultiMap<Key, T>::contains(const Key &key, const T &value) const
\since 4.3
Returns \c true if the map contains an item with key \a key and
@@ -2019,7 +2031,7 @@ void QMapDataBase::freeData(QMapDataBase *d)
*/
/*!
- \fn int QMultiMap::remove(const Key &key, const T &value)
+ \fn template <class Key, class T> int QMultiMap<Key, T>::remove(const Key &key, const T &value)
\since 4.3
Removes all the items that have the key \a key and the value \a
@@ -2029,7 +2041,7 @@ void QMapDataBase::freeData(QMapDataBase *d)
*/
/*!
- \fn int QMultiMap::count(const Key &key, const T &value) const
+ \fn template <class Key, class T> int QMultiMap<Key, T>::count(const Key &key, const T &value) const
\since 4.3
Returns the number of items with key \a key and value \a value.
@@ -2038,7 +2050,7 @@ void QMapDataBase::freeData(QMapDataBase *d)
*/
/*!
- \fn typename QMap<Key, T>::iterator QMultiMap::find(const Key &key, const T &value)
+ \fn template <class Key, class T> typename QMap<Key, T>::iterator QMultiMap<Key, T>::find(const Key &key, const T &value)
\since 4.3
Returns an iterator pointing to the item with key \a key and
@@ -2054,7 +2066,7 @@ void QMapDataBase::freeData(QMapDataBase *d)
*/
/*!
- \fn typename QMap<Key, T>::const_iterator QMultiMap::find(const Key &key, const T &value) const
+ \fn template <class Key, class T> typename QMap<Key, T>::const_iterator QMultiMap<Key, T>::find(const Key &key, const T &value) const
\since 4.3
\overload
@@ -2071,7 +2083,7 @@ void QMapDataBase::freeData(QMapDataBase *d)
*/
/*!
- \fn typename QMap<Key, T>::const_iterator QMultiMap::constFind(const Key &key, const T &value) const
+ \fn template <class Key, class T> typename QMap<Key, T>::const_iterator QMultiMap<Key, T>::constFind(const Key &key, const T &value) const
\since 4.3
Returns an iterator pointing to the item with key \a key and the
diff --git a/src/corelib/tools/qmap.h b/src/corelib/tools/qmap.h
index b400e69f0c..a5b9096835 100644
--- a/src/corelib/tools/qmap.h
+++ b/src/corelib/tools/qmap.h
@@ -150,7 +150,7 @@ template <class Key, class T>
inline QMapNode<Key, T> *QMapNode<Key, T>::lowerBound(const Key &akey)
{
QMapNode<Key, T> *n = this;
- QMapNode<Key, T> *lastNode = Q_NULLPTR;
+ QMapNode<Key, T> *lastNode = nullptr;
while (n) {
if (!qMapLessThanKey(n->key, akey)) {
lastNode = n;
@@ -166,7 +166,7 @@ template <class Key, class T>
inline QMapNode<Key, T> *QMapNode<Key, T>::upperBound(const Key &akey)
{
QMapNode<Key, T> *n = this;
- QMapNode<Key, T> *lastNode = Q_NULLPTR;
+ QMapNode<Key, T> *lastNode = nullptr;
while (n) {
if (qMapLessThanKey(akey, n->key)) {
lastNode = n;
@@ -220,7 +220,7 @@ struct QMapData : public QMapDataBase
Node *findNode(const Key &akey) const;
void nodeRange(const Key &akey, Node **firstNode, Node **lastNode);
- Node *createNode(const Key &k, const T &v, Node *parent = Q_NULLPTR, bool left = false)
+ Node *createNode(const Key &k, const T &v, Node *parent = nullptr, bool left = false)
{
Node *n = static_cast<Node *>(QMapDataBase::createNode(sizeof(Node), Q_ALIGNOF(Node),
parent, left));
@@ -261,13 +261,13 @@ QMapNode<Key, T> *QMapNode<Key, T>::copy(QMapData<Key, T> *d) const
n->left = leftNode()->copy(d);
n->left->setParent(n);
} else {
- n->left = Q_NULLPTR;
+ n->left = nullptr;
}
if (right) {
n->right = rightNode()->copy(d);
n->right->setParent(n);
} else {
- n->right = Q_NULLPTR;
+ n->right = nullptr;
}
return n;
}
@@ -288,7 +288,7 @@ QMapNode<Key, T> *QMapData<Key, T>::findNode(const Key &akey) const
if (lb && !qMapLessThanKey(akey, lb->key))
return lb;
}
- return Q_NULLPTR;
+ return nullptr;
}
@@ -304,10 +304,10 @@ void QMapData<Key, T>::nodeRange(const Key &akey, QMapNode<Key, T> **firstNode,
} else if (qMapLessThanKey(n->key, akey)) {
n = n->rightNode();
} else {
- *firstNode = n->leftNode() ? n->leftNode()->lowerBound(akey) : Q_NULLPTR;
+ *firstNode = n->leftNode() ? n->leftNode()->lowerBound(akey) : nullptr;
if (!*firstNode)
*firstNode = n;
- *lastNode = n->rightNode() ? n->rightNode()->upperBound(akey) : Q_NULLPTR;
+ *lastNode = n->rightNode() ? n->rightNode()->upperBound(akey) : nullptr;
if (!*lastNode)
*lastNode = l;
return;
@@ -416,7 +416,7 @@ public:
typedef T *pointer;
typedef T &reference;
- inline iterator() : i(Q_NULLPTR) { }
+ inline iterator() : i(nullptr) { }
inline iterator(Node *node) : i(node) { }
inline const Key &key() const { return i->key; }
@@ -473,7 +473,7 @@ public:
typedef const T *pointer;
typedef const T &reference;
- Q_DECL_CONSTEXPR inline const_iterator() : i(Q_NULLPTR) { }
+ Q_DECL_CONSTEXPR inline const_iterator() : i(nullptr) { }
inline const_iterator(const Node *node) : i(node) { }
#ifdef QT_STRICT_ITERATORS
explicit inline const_iterator(const iterator &o)
@@ -695,7 +695,7 @@ Q_INLINE_TEMPLATE int QMap<Key, T>::count(const Key &akey) const
template <class Key, class T>
Q_INLINE_TEMPLATE bool QMap<Key, T>::contains(const Key &akey) const
{
- return d->findNode(akey) != Q_NULLPTR;
+ return d->findNode(akey) != nullptr;
}
template <class Key, class T>
@@ -704,7 +704,7 @@ Q_INLINE_TEMPLATE typename QMap<Key, T>::iterator QMap<Key, T>::insert(const Key
detach();
Node *n = d->root();
Node *y = d->end();
- Node *lastNode = Q_NULLPTR;
+ Node *lastNode = nullptr;
bool left = true;
while (n) {
y = n;
@@ -779,15 +779,15 @@ typename QMap<Key, T>::iterator QMap<Key, T>::insert(const_iterator pos, const K
}
// we need to insert (not overwrite)
- if (prev->right == Q_NULLPTR) {
+ if (prev->right == nullptr) {
Node *z = d->createNode(akey, avalue, prev, false);
return iterator(z);
}
- if (next->left == Q_NULLPTR) {
+ if (next->left == nullptr) {
Node *z = d->createNode(akey, avalue, next, true);
return iterator(z);
}
- Q_ASSERT(false); // We should have prev->right == Q_NULLPTR or next->left == Q_NULLPTR.
+ Q_ASSERT(false); // We should have prev->right == nullptr or next->left == nullptr.
return this->insert(akey, avalue);
}
}
@@ -801,7 +801,7 @@ Q_INLINE_TEMPLATE typename QMap<Key, T>::iterator QMap<Key, T>::insertMulti(cons
Node* y = d->end();
Node* x = static_cast<Node *>(d->root());
bool left = true;
- while (x != Q_NULLPTR) {
+ while (x != nullptr) {
left = !qMapLessThanKey(x->key, akey);
y = x;
x = left ? x->leftNode() : x->rightNode();
@@ -848,15 +848,15 @@ typename QMap<Key, T>::iterator QMap<Key, T>::insertMulti(const_iterator pos, co
return this->insertMulti(akey, avalue); // ignore hint
// Hint is ok - do insert
- if (prev->right == Q_NULLPTR) {
+ if (prev->right == nullptr) {
Node *z = d->createNode(akey, avalue, prev, false);
return iterator(z);
}
- if (next->left == Q_NULLPTR) {
+ if (next->left == nullptr) {
Node *z = d->createNode(akey, avalue, next, true);
return iterator(z);
}
- Q_ASSERT(false); // We should have prev->right == Q_NULLPTR or next->left == Q_NULLPTR.
+ Q_ASSERT(false); // We should have prev->right == nullptr or next->left == nullptr.
return this->insertMulti(akey, avalue);
}
}
@@ -1102,7 +1102,7 @@ Q_OUTOFLINE_TEMPLATE QList<T> QMap<Key, T>::values(const Key &akey) const
template <class Key, class T>
Q_INLINE_TEMPLATE typename QMap<Key, T>::const_iterator QMap<Key, T>::lowerBound(const Key &akey) const
{
- Node *lb = d->root() ? d->root()->lowerBound(akey) : Q_NULLPTR;
+ Node *lb = d->root() ? d->root()->lowerBound(akey) : nullptr;
if (!lb)
lb = d->end();
return const_iterator(lb);
@@ -1112,7 +1112,7 @@ template <class Key, class T>
Q_INLINE_TEMPLATE typename QMap<Key, T>::iterator QMap<Key, T>::lowerBound(const Key &akey)
{
detach();
- Node *lb = d->root() ? d->root()->lowerBound(akey) : Q_NULLPTR;
+ Node *lb = d->root() ? d->root()->lowerBound(akey) : nullptr;
if (!lb)
lb = d->end();
return iterator(lb);
@@ -1122,7 +1122,7 @@ template <class Key, class T>
Q_INLINE_TEMPLATE typename QMap<Key, T>::const_iterator
QMap<Key, T>::upperBound(const Key &akey) const
{
- Node *ub = d->root() ? d->root()->upperBound(akey) : Q_NULLPTR;
+ Node *ub = d->root() ? d->root()->upperBound(akey) : nullptr;
if (!ub)
ub = d->end();
return const_iterator(ub);
@@ -1132,7 +1132,7 @@ template <class Key, class T>
Q_INLINE_TEMPLATE typename QMap<Key, T>::iterator QMap<Key, T>::upperBound(const Key &akey)
{
detach();
- Node *ub = d->root() ? d->root()->upperBound(akey) : Q_NULLPTR;
+ Node *ub = d->root() ? d->root()->upperBound(akey) : nullptr;
if (!ub)
ub = d->end();
return iterator(ub);
diff --git a/src/corelib/tools/qpair.qdoc b/src/corelib/tools/qpair.qdoc
index 9b9b1783ac..59e6931995 100644
--- a/src/corelib/tools/qpair.qdoc
+++ b/src/corelib/tools/qpair.qdoc
@@ -93,14 +93,14 @@
The second element in the pair.
*/
-/*! \fn QPair::QPair()
+/*! \fn template <class T1, class T2> QPair<T1, T2>::QPair()
Constructs an empty pair. The \c first and \c second elements are
initialized with \l{default-constructed value}s.
*/
/*!
- \fn QPair::QPair(const T1 &value1, const T2 &value2)
+ \fn template <class T1, class T2> QPair<T1, T2>::QPair(const T1 &value1, const T2 &value2)
Constructs a pair and initializes the \c first element with \a
value1 and the \c second element with \a value2.
@@ -109,7 +109,7 @@
*/
/*!
-\fn void QPair::swap(QPair &other)
+\fn template <class T1, class T2> void QPair<T1, T2>::swap(QPair &other)
\since 5.5
Swaps this pair with \a other.
@@ -125,7 +125,7 @@
*/
/*!
-\fn void swap(QPair<T1, T2> &lhs, QPair<T1, T2> &rhs)
+\fn template <class T1, class T2> void swap(QPair<T1, T2> &lhs, QPair<T1, T2> &rhs)
\overload
\relates QPair
\since 5.5
@@ -134,7 +134,7 @@
*/
/*!
- \fn QPair::QPair(const QPair<TT1, TT2> &p)
+ \fn template <class T1, class T2> template <typename TT1, typename TT2> QPair<T1, T2>::QPair(const QPair<TT1, TT2> &p)
\since 5.2
Constructs a pair from the other pair \a p, of types TT1 and TT2. This
@@ -145,14 +145,14 @@
*/
/*!
- \fn QPair::QPair(QPair<TT1, TT2> &&p)
+ \fn template <class T1, class T2> template <typename TT1, typename TT2> QPair<T1, T2>::QPair(QPair<TT1, TT2> &&p)
\since 5.2
Move-constructs a QPair instance, making it point to the same object that \a p was pointing to.
*/
/*!
- \fn QPair & QPair::operator=(const QPair<TT1, TT2> &p)
+ \fn template <class T1, class T2> template <typename TT1, typename TT2> QPair & QPair<T1, T2>::operator=(const QPair<TT1, TT2> &p)
\since 5.2
Copies pair \a p into this pair.
@@ -161,13 +161,13 @@
*/
/*!
- \fn QPair & QPair::operator=(QPair<TT1, TT2> &&p)
+ \fn template <class T1, class T2> template <typename TT1, typename TT2> QPair & QPair<T1, T2>::operator=(QPair<TT1, TT2> &&p)
\since 5.2
Move-assigns pair \a p into this pair instance.
*/
-/*! \fn bool operator==(const QPair<T1, T2> &p1, const QPair<T1, T2> &p2)
+/*! \fn template <class T1, class T2> bool operator==(const QPair<T1, T2> &p1, const QPair<T1, T2> &p2)
\relates QPair
@@ -179,7 +179,7 @@
implementation of \c operator==().
*/
-/*! \fn bool operator!=(const QPair<T1, T2> &p1, const QPair<T1, T2> &p2)
+/*! \fn template <class T1, class T2> bool operator!=(const QPair<T1, T2> &p1, const QPair<T1, T2> &p2)
\relates QPair
@@ -192,7 +192,7 @@
implementation of \c operator==().
*/
-/*! \fn bool operator<(const QPair<T1, T2> &p1, const QPair<T1, T2> &p2)
+/*! \fn template <class T1, class T2> bool operator<(const QPair<T1, T2> &p1, const QPair<T1, T2> &p2)
\relates QPair
@@ -205,7 +205,7 @@
implementation of \c operator<().
*/
-/*! \fn bool operator>(const QPair<T1, T2> &p1, const QPair<T1, T2> &p2)
+/*! \fn template <class T1, class T2> bool operator>(const QPair<T1, T2> &p1, const QPair<T1, T2> &p2)
\relates QPair
@@ -218,7 +218,7 @@
implementation of \c operator<().
*/
-/*! \fn bool operator<=(const QPair<T1, T2> &p1, const QPair<T1, T2> &p2)
+/*! \fn template <class T1, class T2> bool operator<=(const QPair<T1, T2> &p1, const QPair<T1, T2> &p2)
\relates QPair
@@ -231,7 +231,7 @@
implementation of \c operator<().
*/
-/*! \fn bool operator>=(const QPair<T1, T2> &p1, const QPair<T1, T2> &p2)
+/*! \fn template <class T1, class T2> bool operator>=(const QPair<T1, T2> &p1, const QPair<T1, T2> &p2)
\relates QPair
@@ -245,7 +245,7 @@
*/
/*!
- \fn QPair<T1, T2> qMakePair(const T1 &value1, const T2 &value2)
+ \fn template <class T1, class T2> QPair<T1, T2> qMakePair(const T1 &value1, const T2 &value2)
\relates QPair
@@ -258,7 +258,7 @@
usually requires less typing.
*/
-/*! \fn QDataStream &operator>>(QDataStream &in, QPair<T1, T2> &pair)
+/*! \fn template <class T1, class T2> QDataStream &operator>>(QDataStream &in, QPair<T1, T2> &pair)
\relates QPair
@@ -269,7 +269,7 @@
\sa {Serializing Qt Data Types}
*/
-/*! \fn QDataStream &operator<<(QDataStream &out, const QPair<T1, T2> &pair)
+/*! \fn template <class T1, class T2> QDataStream &operator<<(QDataStream &out, const QPair<T1, T2> &pair)
\relates QPair
diff --git a/src/corelib/tools/qringbuffer.cpp b/src/corelib/tools/qringbuffer.cpp
index 8fa378e935..c9ef3bc69a 100644
--- a/src/corelib/tools/qringbuffer.cpp
+++ b/src/corelib/tools/qringbuffer.cpp
@@ -44,6 +44,46 @@
QT_BEGIN_NAMESPACE
+void QRingChunk::allocate(int alloc)
+{
+ Q_ASSERT(alloc > 0 && size() == 0);
+
+ if (chunk.size() < alloc || isShared())
+ chunk = QByteArray(alloc, Qt::Uninitialized);
+}
+
+void QRingChunk::detach()
+{
+ Q_ASSERT(isShared());
+
+ const int chunkSize = size();
+ QByteArray x(chunkSize, Qt::Uninitialized);
+ ::memcpy(x.data(), chunk.constData() + headOffset, chunkSize);
+ chunk = qMove(x);
+ headOffset = 0;
+ tailOffset = chunkSize;
+}
+
+QByteArray QRingChunk::toByteArray()
+{
+ if (headOffset != 0 || tailOffset != chunk.size()) {
+ if (isShared())
+ return chunk.mid(headOffset, size());
+
+ if (headOffset != 0) {
+ char *ptr = chunk.data();
+ ::memmove(ptr, ptr + headOffset, size());
+ tailOffset -= headOffset;
+ headOffset = 0;
+ }
+
+ chunk.reserve(0); // avoid that resizing needlessly reallocates
+ chunk.resize(tailOffset);
+ }
+
+ return chunk;
+}
+
/*!
\internal
@@ -54,12 +94,11 @@ QT_BEGIN_NAMESPACE
const char *QRingBuffer::readPointerAtPosition(qint64 pos, qint64 &length) const
{
if (pos >= 0) {
- pos += head;
- for (int i = 0; i < buffers.size(); ++i) {
- length = (i == tailBuffer ? tail : buffers[i].size());
+ for (const QRingChunk &chunk : buffers) {
+ length = chunk.size();
if (length > pos) {
length -= pos;
- return buffers[i].constData() + pos;
+ return chunk.data() + pos;
}
pos -= length;
}
@@ -74,32 +113,31 @@ void QRingBuffer::free(qint64 bytes)
Q_ASSERT(bytes <= bufferSize);
while (bytes > 0) {
- const qint64 blockSize = buffers.constFirst().size() - head;
+ const qint64 chunkSize = buffers.constFirst().size();
- if (tailBuffer == 0 || blockSize > bytes) {
+ if (buffers.size() == 1 || chunkSize > bytes) {
+ QRingChunk &chunk = buffers.first();
// keep a single block around if it does not exceed
// the basic block size, to avoid repeated allocations
// between uses of the buffer
if (bufferSize <= bytes) {
- if (buffers.constFirst().size() <= basicBlockSize) {
+ if (chunk.capacity() <= basicBlockSize && !chunk.isShared()) {
+ chunk.reset();
bufferSize = 0;
- head = tail = 0;
} else {
clear(); // try to minify/squeeze us
}
} else {
Q_ASSERT(bytes < MaxByteArraySize);
- head += int(bytes);
+ chunk.advance(bytes);
bufferSize -= bytes;
}
return;
}
- bufferSize -= blockSize;
- bytes -= blockSize;
+ bufferSize -= chunkSize;
+ bytes -= chunkSize;
buffers.removeFirst();
- --tailBuffer;
- head = 0;
}
}
@@ -108,32 +146,25 @@ char *QRingBuffer::reserve(qint64 bytes)
if (bytes <= 0 || bytes >= MaxByteArraySize)
return 0;
+ const int chunkSize = qMax(basicBlockSize, int(bytes));
+ int tail = 0;
if (bufferSize == 0) {
if (buffers.isEmpty())
- buffers.append(QByteArray(qMax(basicBlockSize, int(bytes)), Qt::Uninitialized));
+ buffers.append(QRingChunk(chunkSize));
else
- buffers.first().resize(qMax(basicBlockSize, int(bytes)));
+ buffers.first().allocate(chunkSize);
} else {
- const qint64 newSize = bytes + tail;
+ const QRingChunk &chunk = buffers.constLast();
// if need a new buffer
- if (basicBlockSize == 0 || (newSize > buffers.constLast().capacity()
- && (tail >= basicBlockSize || newSize >= MaxByteArraySize))) {
- // shrink this buffer to its current size
- buffers.last().resize(tail);
-
- // create a new QByteArray
- buffers.append(QByteArray(qMax(basicBlockSize, int(bytes)), Qt::Uninitialized));
- ++tailBuffer;
- tail = 0;
- } else if (newSize > buffers.constLast().size()) {
- buffers.last().resize(qMax(basicBlockSize, int(newSize)));
- }
+ if (basicBlockSize == 0 || chunk.isShared() || bytes > chunk.available())
+ buffers.append(QRingChunk(chunkSize));
+ else
+ tail = chunk.size();
}
- char *writePtr = buffers.last().data() + tail;
+ buffers.last().grow(bytes);
bufferSize += bytes;
- tail += int(bytes);
- return writePtr;
+ return buffers.last().data() + tail;
}
/*!
@@ -146,29 +177,28 @@ char *QRingBuffer::reserveFront(qint64 bytes)
if (bytes <= 0 || bytes >= MaxByteArraySize)
return 0;
- if (head < bytes || basicBlockSize == 0) {
- if (head > 0) {
- buffers.first().remove(0, head);
- if (tailBuffer == 0)
- tail -= head;
- }
-
- head = qMax(basicBlockSize, int(bytes));
- if (bufferSize == 0) {
- if (buffers.isEmpty())
- buffers.prepend(QByteArray(head, Qt::Uninitialized));
- else
- buffers.first().resize(head);
- tail = head;
+ const int chunkSize = qMax(basicBlockSize, int(bytes));
+ if (bufferSize == 0) {
+ if (buffers.isEmpty())
+ buffers.prepend(QRingChunk(chunkSize));
+ else
+ buffers.first().allocate(chunkSize);
+ buffers.first().grow(chunkSize);
+ buffers.first().advance(chunkSize - bytes);
+ } else {
+ const QRingChunk &chunk = buffers.constFirst();
+ // if need a new buffer
+ if (basicBlockSize == 0 || chunk.isShared() || bytes > chunk.head()) {
+ buffers.prepend(QRingChunk(chunkSize));
+ buffers.first().grow(chunkSize);
+ buffers.first().advance(chunkSize - bytes);
} else {
- buffers.prepend(QByteArray(head, Qt::Uninitialized));
- ++tailBuffer;
+ buffers.first().advance(-bytes);
}
}
- head -= int(bytes);
bufferSize += bytes;
- return buffers.first().data() + head;
+ return buffers.first().data();
}
void QRingBuffer::chop(qint64 bytes)
@@ -176,30 +206,31 @@ void QRingBuffer::chop(qint64 bytes)
Q_ASSERT(bytes <= bufferSize);
while (bytes > 0) {
- if (tailBuffer == 0 || tail > bytes) {
+ const qint64 chunkSize = buffers.constLast().size();
+
+ if (buffers.size() == 1 || chunkSize > bytes) {
+ QRingChunk &chunk = buffers.last();
// keep a single block around if it does not exceed
// the basic block size, to avoid repeated allocations
// between uses of the buffer
- if (bufferSize <= bytes) {
- if (buffers.constFirst().size() <= basicBlockSize) {
+ if (bufferSize == bytes) {
+ if (chunk.capacity() <= basicBlockSize && !chunk.isShared()) {
+ chunk.reset();
bufferSize = 0;
- head = tail = 0;
} else {
clear(); // try to minify/squeeze us
}
} else {
Q_ASSERT(bytes < MaxByteArraySize);
- tail -= int(bytes);
+ chunk.grow(-bytes);
bufferSize -= bytes;
}
return;
}
- bufferSize -= tail;
- bytes -= tail;
+ bufferSize -= chunkSize;
+ bytes -= chunkSize;
buffers.removeLast();
- --tailBuffer;
- tail = buffers.constLast().size();
}
}
@@ -210,9 +241,6 @@ void QRingBuffer::clear()
buffers.erase(buffers.begin() + 1, buffers.end());
buffers.first().clear();
-
- head = tail = 0;
- tailBuffer = 0;
bufferSize = 0;
}
@@ -221,13 +249,12 @@ qint64 QRingBuffer::indexOf(char c, qint64 maxLength, qint64 pos) const
if (maxLength <= 0 || pos < 0)
return -1;
- qint64 index = -(pos + head);
- for (int i = 0; i < buffers.size(); ++i) {
- const qint64 nextBlockIndex = qMin(index + (i == tailBuffer ? tail : buffers[i].size()),
- maxLength);
+ qint64 index = -pos;
+ for (const QRingChunk &chunk : buffers) {
+ const qint64 nextBlockIndex = qMin(index + chunk.size(), maxLength);
if (nextBlockIndex > 0) {
- const char *ptr = buffers[i].constData();
+ const char *ptr = chunk.data();
if (index < 0) {
ptr -= index;
index = 0;
@@ -271,19 +298,8 @@ QByteArray QRingBuffer::read()
if (bufferSize == 0)
return QByteArray();
- QByteArray qba(buffers.takeFirst());
-
- qba.reserve(0); // avoid that resizing needlessly reallocates
- if (tailBuffer == 0) {
- qba.resize(tail);
- tail = 0;
- } else {
- --tailBuffer;
- }
- qba.remove(0, head); // does nothing if head is 0
- head = 0;
- bufferSize -= qba.size();
- return qba;
+ bufferSize -= buffers.constFirst().size();
+ return buffers.takeFirst().toByteArray();
}
/*!
@@ -296,13 +312,12 @@ qint64 QRingBuffer::peek(char *data, qint64 maxLength, qint64 pos) const
qint64 readSoFar = 0;
if (pos >= 0) {
- pos += head;
for (int i = 0; readSoFar < maxLength && i < buffers.size(); ++i) {
- qint64 blockLength = (i == tailBuffer ? tail : buffers[i].size());
+ qint64 blockLength = buffers[i].size();
if (pos < blockLength) {
blockLength = qMin(blockLength - pos, maxLength - readSoFar);
- memcpy(data + readSoFar, buffers[i].constData() + pos, blockLength);
+ memcpy(data + readSoFar, buffers[i].data() + pos, blockLength);
readSoFar += blockLength;
pos = 0;
} else {
@@ -335,18 +350,11 @@ void QRingBuffer::append(const char *data, qint64 size)
*/
void QRingBuffer::append(const QByteArray &qba)
{
- if (tail == 0) {
- if (buffers.isEmpty())
- buffers.append(qba);
- else
- buffers.last() = qba;
- } else {
- buffers.last().resize(tail);
- buffers.append(qba);
- ++tailBuffer;
- }
- tail = qba.size();
- bufferSize += tail;
+ if (bufferSize != 0 || buffers.isEmpty())
+ buffers.append(QRingChunk(qba));
+ else
+ buffers.last().assign(qba);
+ bufferSize += qba.size();
}
qint64 QRingBuffer::readLine(char *data, qint64 maxLength)
diff --git a/src/corelib/tools/qringbuffer_p.h b/src/corelib/tools/qringbuffer_p.h
index 558a456515..c232ae3c72 100644
--- a/src/corelib/tools/qringbuffer_p.h
+++ b/src/corelib/tools/qringbuffer_p.h
@@ -53,7 +53,7 @@
#include <QtCore/private/qglobal_p.h>
#include <QtCore/qbytearray.h>
-#include <QtCore/qlist.h>
+#include <QtCore/qvector.h>
QT_BEGIN_NAMESPACE
@@ -61,11 +61,129 @@ QT_BEGIN_NAMESPACE
#define QRINGBUFFER_CHUNKSIZE 4096
#endif
+class QRingChunk
+{
+public:
+ // initialization and cleanup
+ inline QRingChunk() Q_DECL_NOTHROW :
+ headOffset(0), tailOffset(0)
+ {
+ }
+ inline QRingChunk(const QRingChunk &other) Q_DECL_NOTHROW :
+ chunk(other.chunk), headOffset(other.headOffset), tailOffset(other.tailOffset)
+ {
+ }
+ explicit inline QRingChunk(int alloc) :
+ chunk(alloc, Qt::Uninitialized), headOffset(0), tailOffset(0)
+ {
+ }
+ explicit inline QRingChunk(const QByteArray &qba) Q_DECL_NOTHROW :
+ chunk(qba), headOffset(0), tailOffset(qba.size())
+ {
+ }
+
+ inline QRingChunk &operator=(const QRingChunk &other) Q_DECL_NOTHROW
+ {
+ chunk = other.chunk;
+ headOffset = other.headOffset;
+ tailOffset = other.tailOffset;
+ return *this;
+ }
+ inline QRingChunk(QRingChunk &&other) Q_DECL_NOTHROW :
+ chunk(other.chunk), headOffset(other.headOffset), tailOffset(other.tailOffset)
+ {
+ other.headOffset = other.tailOffset = 0;
+ }
+ inline QRingChunk &operator=(QRingChunk &&other) Q_DECL_NOTHROW
+ {
+ swap(other);
+ return *this;
+ }
+
+ inline void swap(QRingChunk &other) Q_DECL_NOTHROW
+ {
+ chunk.swap(other.chunk);
+ qSwap(headOffset, other.headOffset);
+ qSwap(tailOffset, other.tailOffset);
+ }
+
+ // allocating and sharing
+ void allocate(int alloc);
+ inline bool isShared() const
+ {
+ return !chunk.isDetached();
+ }
+ Q_CORE_EXPORT void detach();
+ QByteArray toByteArray();
+
+ // getters
+ inline int head() const
+ {
+ return headOffset;
+ }
+ inline int size() const
+ {
+ return tailOffset - headOffset;
+ }
+ inline int capacity() const
+ {
+ return chunk.size();
+ }
+ inline int available() const
+ {
+ return chunk.size() - tailOffset;
+ }
+ inline const char *data() const
+ {
+ return chunk.constData() + headOffset;
+ }
+ inline char *data()
+ {
+ if (isShared())
+ detach();
+ return chunk.data() + headOffset;
+ }
+
+ // array management
+ inline void advance(int offset)
+ {
+ Q_ASSERT(headOffset + offset >= 0);
+ Q_ASSERT(size() - offset > 0);
+
+ headOffset += offset;
+ }
+ inline void grow(int offset)
+ {
+ Q_ASSERT(size() + offset > 0);
+ Q_ASSERT(head() + size() + offset <= capacity());
+
+ tailOffset += offset;
+ }
+ inline void assign(const QByteArray &qba)
+ {
+ chunk = qba;
+ headOffset = 0;
+ tailOffset = qba.size();
+ }
+ inline void reset()
+ {
+ headOffset = tailOffset = 0;
+ }
+ inline void clear()
+ {
+ assign(QByteArray());
+ }
+
+private:
+ QByteArray chunk;
+ int headOffset, tailOffset;
+};
+
class QRingBuffer
{
public:
explicit inline QRingBuffer(int growth = QRINGBUFFER_CHUNKSIZE) :
- head(0), tail(0), tailBuffer(0), basicBlockSize(growth), bufferSize(0) { }
+ bufferSize(0), basicBlockSize(growth) { }
inline void setChunkSize(int size) {
basicBlockSize = size;
@@ -76,11 +194,11 @@ public:
}
inline qint64 nextDataBlockSize() const {
- return (tailBuffer == 0 ? tail : buffers.first().size()) - head;
+ return bufferSize == 0 ? Q_INT64_C(0) : buffers.first().size();
}
inline const char *readPointer() const {
- return bufferSize == 0 ? Q_NULLPTR : (buffers.first().constData() + head);
+ return bufferSize == 0 ? nullptr : buffers.first().data();
}
Q_CORE_EXPORT const char *readPointerAtPosition(qint64 pos, qint64 &length) const;
@@ -114,14 +232,8 @@ public:
void ungetChar(char c)
{
- if (head > 0) {
- --head;
- buffers.first()[head] = c;
- ++bufferSize;
- } else {
- char *ptr = reserveFront(1);
- *ptr = c;
- }
+ char *ptr = reserveFront(1);
+ *ptr = c;
}
@@ -152,13 +264,12 @@ public:
}
private:
- QList<QByteArray> buffers;
- int head, tail;
- int tailBuffer; // always buffers.size() - 1
- int basicBlockSize;
+ QVector<QRingChunk> buffers;
qint64 bufferSize;
+ int basicBlockSize;
};
+Q_DECLARE_SHARED(QRingChunk)
Q_DECLARE_TYPEINFO(QRingBuffer, Q_MOVABLE_TYPE);
QT_END_NAMESPACE
diff --git a/src/corelib/tools/qscopedpointer.cpp b/src/corelib/tools/qscopedpointer.cpp
index 8d84b3beca..605758dcc3 100644
--- a/src/corelib/tools/qscopedpointer.cpp
+++ b/src/corelib/tools/qscopedpointer.cpp
@@ -126,27 +126,34 @@ QT_BEGIN_NAMESPACE
*/
/*!
- \fn QScopedPointer::QScopedPointer(T *p = 0)
+ \fn template <typename T, typename Cleanup> QScopedPointer<T, Cleanup>::QScopedPointer(T *p = 0)
Constructs this QScopedPointer instance and sets its pointer to \a p.
*/
/*!
- \fn QScopedPointer::~QScopedPointer()
+ \fn template <typename T, typename Cleanup> QScopedPointer<T, Cleanup>::~QScopedPointer()
Destroys this QScopedPointer object. Delete the object its pointer points
to.
*/
/*!
- \fn T *QScopedPointer::data() const
+ \fn template <typename T, typename Cleanup> T *QScopedPointer<T, Cleanup>::data() const
Returns the value of the pointer referenced by this object. QScopedPointer
still owns the object pointed to.
*/
/*!
- \fn T &QScopedPointer::operator*() const
+ \fn template <typename T, typename Cleanup> T *QScopedPointer::get() const
+ \since 5.11
+
+ Same as data().
+*/
+
+/*!
+ \fn template <typename T, typename Cleanup> T &QScopedPointer<T, Cleanup>::operator*() const
Provides access to the scoped pointer's object.
@@ -155,7 +162,7 @@ QT_BEGIN_NAMESPACE
*/
/*!
- \fn T *QScopedPointer::operator->() const
+ \fn template <typename T, typename Cleanup> T *QScopedPointer<T, Cleanup>::operator->() const
Provides access to the scoped pointer's object.
@@ -165,7 +172,7 @@ QT_BEGIN_NAMESPACE
*/
/*!
- \fn QScopedPointer::operator bool() const
+ \fn template <typename T, typename Cleanup> QScopedPointer<T, Cleanup>::operator bool() const
Returns \c true if this object is not \c null. This function is suitable
for use in \tt if-constructs, like:
@@ -176,7 +183,7 @@ QT_BEGIN_NAMESPACE
*/
/*!
- \fn bool operator==(const QScopedPointer<T, Cleanup> &lhs, const QScopedPointer<T, Cleanup> &rhs)
+ \fn template <typename T, typename Cleanup> bool operator==(const QScopedPointer<T, Cleanup> &lhs, const QScopedPointer<T, Cleanup> &rhs)
Equality operator. Returns \c true if the scoped pointers
\a lhs and \a rhs are pointing to the same object.
@@ -185,7 +192,7 @@ QT_BEGIN_NAMESPACE
/*!
- \fn bool operator!=(const QScopedPointer<T, Cleanup> &lhs, const QScopedPointer<T, Cleanup> &rhs)
+ \fn template <typename T, typename Cleanup> bool operator!=(const QScopedPointer<T, Cleanup> &lhs, const QScopedPointer<T, Cleanup> &rhs)
Inequality operator. Returns \c true if the scoped pointers
\a lhs and \a rhs are \e not pointing to the same object.
@@ -193,7 +200,7 @@ QT_BEGIN_NAMESPACE
*/
/*!
- \fn bool operator==(const QScopedPointer<T, Cleanup> &lhs, std::nullptr_t)
+ \fn template <typename T, typename Cleanup> bool operator==(const QScopedPointer<T, Cleanup> &lhs, std::nullptr_t)
\relates QScopedPointer
\since 5.8
@@ -203,7 +210,7 @@ QT_BEGIN_NAMESPACE
*/
/*!
- \fn bool operator==(std::nullptr_t, const QScopedPointer<T, Cleanup> &rhs)
+ \fn template <typename T, typename Cleanup> bool operator==(std::nullptr_t, const QScopedPointer<T, Cleanup> &rhs)
\relates QScopedPointer
\since 5.8
@@ -213,7 +220,7 @@ QT_BEGIN_NAMESPACE
*/
/*!
- \fn bool operator!=(const QScopedPointer<T, Cleanup> &lhs, std::nullptr_t)
+ \fn template <typename T, typename Cleanup> bool operator!=(const QScopedPointer<T, Cleanup> &lhs, std::nullptr_t)
\relates QScopedPointer
\since 5.8
@@ -224,7 +231,7 @@ QT_BEGIN_NAMESPACE
*/
/*!
- \fn bool operator!=(std::nullptr_t, const QScopedPointer<T, Cleanup> &rhs)
+ \fn template <typename T, typename Cleanup> bool operator!=(std::nullptr_t, const QScopedPointer<T, Cleanup> &rhs)
\relates QScopedPointer
\since 5.8
@@ -235,13 +242,13 @@ QT_BEGIN_NAMESPACE
*/
/*!
- \fn bool QScopedPointer::isNull() const
+ \fn template <typename T, typename Cleanup> bool QScopedPointer<T, Cleanup>::isNull() const
Returns \c true if this object is holding a pointer that is \c null.
*/
/*!
- \fn void QScopedPointer::reset(T *other = 0)
+ \fn template <typename T, typename Cleanup> void QScopedPointer<T, Cleanup>::reset(T *other = 0)
Deletes the existing object it is pointing to if any, and sets its pointer to
\a other. QScopedPointer now owns \a other and will delete it in its
@@ -249,7 +256,7 @@ QT_BEGIN_NAMESPACE
*/
/*!
- \fn T *QScopedPointer::take()
+ \fn template <typename T, typename Cleanup> T *QScopedPointer<T, Cleanup>::take()
Returns the value of the pointer referenced by this object. The pointer of this
QScopedPointer object will be reset to \c null.
@@ -257,7 +264,7 @@ QT_BEGIN_NAMESPACE
Callers of this function take ownership of the pointer.
*/
-/*! \fn bool QScopedPointer::operator!() const
+/*! \fn template <typename T, typename Cleanup> bool QScopedPointer<T, Cleanup>::operator!() const
Returns \c true if the pointer referenced by this object is \c null, otherwise
returns \c false.
@@ -265,7 +272,7 @@ QT_BEGIN_NAMESPACE
\sa isNull()
*/
-/*! \fn void QScopedPointer::swap(QScopedPointer<T, Cleanup> &other)
+/*! \fn template <typename T, typename Cleanup> void QScopedPointer<T, Cleanup>::swap(QScopedPointer<T, Cleanup> &other)
Swap this pointer with \a other.
*/
@@ -297,20 +304,20 @@ QT_BEGIN_NAMESPACE
*/
/*!
- \fn QScopedArrayPointer::QScopedArrayPointer()
+ \fn template <typename T, typename Cleanup> QScopedArrayPointer<T, Cleanup>::QScopedArrayPointer()
Constructs a QScopedArrayPointer instance.
*/
/*!
- \fn QScopedArrayPointer::QScopedArrayPointer(D * p)
+ \fn template <typename T, typename Cleanup> template <typename D> QScopedArrayPointer<T, Cleanup>::QScopedArrayPointer(D * p)
Constructs a QScopedArrayPointer and stores the array of objects
pointed to by \a p.
*/
/*!
- \fn T *QScopedArrayPointer::operator[](int i)
+ \fn template <typename T, typename Cleanup> T *QScopedArrayPointer<T, Cleanup>::operator[](int i)
Provides access to entry \a i of the scoped pointer's array of
objects.
@@ -321,7 +328,7 @@ QT_BEGIN_NAMESPACE
*/
/*!
- \fn T *QScopedArrayPointer::operator[](int i) const
+ \fn template <typename T, typename Cleanup> T *QScopedArrayPointer<T, Cleanup>::operator[](int i) const
Provides access to entry \a i of the scoped pointer's array of
objects.
@@ -331,4 +338,8 @@ QT_BEGIN_NAMESPACE
\sa isNull()
*/
+/*! \fn template <typename T, typename Cleanup> void QScopedArrayPointer<T, Cleanup>::swap(QScopedArrayPointer<T, Cleanup> &other)
+ Swap this pointer with \a other.
+ */
+
QT_END_NAMESPACE
diff --git a/src/corelib/tools/qscopedpointer.h b/src/corelib/tools/qscopedpointer.h
index 141a3f8c70..2a4083466b 100644
--- a/src/corelib/tools/qscopedpointer.h
+++ b/src/corelib/tools/qscopedpointer.h
@@ -97,7 +97,7 @@ class QScopedPointer
{
typedef T *QScopedPointer:: *RestrictedBool;
public:
- explicit QScopedPointer(T *p = Q_NULLPTR) Q_DECL_NOTHROW : d(p)
+ explicit QScopedPointer(T *p = nullptr) Q_DECL_NOTHROW : d(p)
{
}
@@ -126,12 +126,12 @@ public:
#if defined(Q_QDOC)
inline operator bool() const
{
- return isNull() ? Q_NULLPTR : &QScopedPointer::d;
+ return isNull() ? nullptr : &QScopedPointer::d;
}
#else
operator RestrictedBool() const Q_DECL_NOTHROW
{
- return isNull() ? Q_NULLPTR : &QScopedPointer::d;
+ return isNull() ? nullptr : &QScopedPointer::d;
}
#endif
@@ -140,12 +140,17 @@ public:
return d;
}
+ T *get() const Q_DECL_NOTHROW
+ {
+ return d;
+ }
+
bool isNull() const Q_DECL_NOTHROW
{
return !d;
}
- void reset(T *other = Q_NULLPTR) Q_DECL_NOEXCEPT_EXPR(noexcept(Cleanup::cleanup(std::declval<T *>())))
+ void reset(T *other = nullptr) Q_DECL_NOEXCEPT_EXPR(noexcept(Cleanup::cleanup(std::declval<T *>())))
{
if (d == other)
return;
@@ -157,7 +162,7 @@ public:
T *take() Q_DECL_NOTHROW
{
T *oldD = d;
- d = Q_NULLPTR;
+ d = nullptr;
return oldD;
}
@@ -221,7 +226,7 @@ class QScopedArrayPointer : public QScopedPointer<T, Cleanup>
template <typename Ptr>
using if_same_type = typename std::enable_if<std::is_same<typename std::remove_cv<T>::type, Ptr>::value, bool>::type;
public:
- inline QScopedArrayPointer() : QScopedPointer<T, Cleanup>(Q_NULLPTR) {}
+ inline QScopedArrayPointer() : QScopedPointer<T, Cleanup>(nullptr) {}
template <typename D, if_same_type<D> = true>
explicit QScopedArrayPointer(D *p)
diff --git a/src/corelib/tools/qset.qdoc b/src/corelib/tools/qset.qdoc
index 93f157fdc5..48863f2399 100644
--- a/src/corelib/tools/qset.qdoc
+++ b/src/corelib/tools/qset.qdoc
@@ -96,14 +96,14 @@
*/
/*!
- \fn QSet::QSet()
+ \fn template <class T> QSet<T>::QSet()
Constructs an empty set.
\sa clear()
*/
-/*! \fn QSet::QSet(std::initializer_list<T> list)
+/*! \fn template <class T> QSet<T>::QSet(std::initializer_list<T> list)
\since 5.1
Constructs a set with a copy of each of the elements in the
@@ -114,14 +114,14 @@
*/
/*!
- \fn void QSet::swap(QSet<T> &other)
+ \fn template <class T> void QSet<T>::swap(QSet<T> &other)
Swaps set \a other with this set. This operation is very fast and
never fails.
*/
/*!
- \fn bool QSet::operator==(const QSet<T> &other) const
+ \fn template <class T> bool QSet<T>::operator==(const QSet<T> &other) const
Returns \c true if the \a other set is equal to this set; otherwise
returns \c false.
@@ -134,7 +134,7 @@
*/
/*!
- \fn bool QSet::operator!=(const QSet<T> &other) const
+ \fn template <class T> bool QSet<T>::operator!=(const QSet<T> &other) const
Returns \c true if the \a other set is not equal to this set; otherwise
returns \c false.
@@ -147,7 +147,7 @@
*/
/*!
- \fn int QSet::size() const
+ \fn template <class T> int QSet<T>::size() const
Returns the number of items in the set.
@@ -155,7 +155,7 @@
*/
/*!
- \fn bool QSet::isEmpty() const
+ \fn template <class T> bool QSet<T>::isEmpty() const
Returns \c true if the set contains no elements; otherwise returns
false.
@@ -164,7 +164,7 @@
*/
/*!
- \fn int QSet::capacity() const
+ \fn template <class T> int QSet<T>::capacity() const
Returns the number of buckets in the set's internal hash
table.
@@ -177,7 +177,7 @@
\sa reserve(), squeeze()
*/
-/*! \fn void QSet::reserve(int size)
+/*! \fn template <class T> void QSet<T>::reserve(int size)
Ensures that the set's internal hash table consists of at
least \a size buckets.
@@ -201,7 +201,7 @@
*/
/*!
- \fn void QSet::squeeze()
+ \fn template <class T> void QSet<T>::squeeze()
Reduces the size of the set's internal hash table to save
memory.
@@ -214,7 +214,7 @@
*/
/*!
- \fn void QSet::detach()
+ \fn template <class T> void QSet<T>::detach()
\internal
@@ -224,7 +224,7 @@
\sa isDetached()
*/
-/*! \fn bool QSet::isDetached() const
+/*! \fn template <class T> bool QSet<T>::isDetached() const
\internal
@@ -235,12 +235,12 @@
*/
/*!
- \fn void QSet::setSharable(bool sharable)
+ \fn template <class T> void QSet<T>::setSharable(bool sharable)
\internal
*/
/*!
- \fn void QSet::clear()
+ \fn template <class T> void QSet<T>::clear()
Removes all elements from the set.
@@ -248,7 +248,7 @@
*/
/*!
- \fn bool QSet::remove(const T &value)
+ \fn template <class T> bool QSet<T>::remove(const T &value)
Removes any occurrence of item \a value from the set. Returns
true if an item was actually removed; otherwise returns \c false.
@@ -257,7 +257,7 @@
*/
/*!
- \fn QSet::iterator QSet::erase(const_iterator pos)
+ \fn template <class T> QSet<T>::iterator QSet<T>::erase(const_iterator pos)
\since 5.7
Removes the item at the iterator position \a pos from the set, and
@@ -271,12 +271,12 @@
*/
/*!
- \fn QSet::iterator QSet::erase(iterator pos)
+ \fn template <class T> QSet<T>::iterator QSet<T>::erase(iterator pos)
\since 4.2
\overload
*/
-/*! \fn QSet::const_iterator QSet::find(const T &value) const
+/*! \fn template <class T> QSet<T>::const_iterator QSet<T>::find(const T &value) const
\since 4.2
Returns a const iterator positioned at the item \a value in the
@@ -286,7 +286,7 @@
\sa constFind(), contains()
*/
-/*! \fn QSet::iterator QSet::find(const T &value)
+/*! \fn template <class T> QSet<T>::iterator QSet<T>::find(const T &value)
\since 4.2
\overload
@@ -295,7 +295,7 @@
returns end().
*/
-/*! \fn QSet::const_iterator QSet::constFind(const T &value) const
+/*! \fn template <class T> QSet<T>::const_iterator QSet<T>::constFind(const T &value) const
\since 4.2
Returns a const iterator positioned at the item \a value in the
@@ -306,7 +306,7 @@
*/
/*!
- \fn bool QSet::contains(const T &value) const
+ \fn template <class T> bool QSet<T>::contains(const T &value) const
Returns \c true if the set contains item \a value; otherwise returns
false.
@@ -315,7 +315,7 @@
*/
/*!
- \fn bool QSet::contains(const QSet<T> &other) const
+ \fn template <class T> bool QSet<T>::contains(const QSet<T> &other) const
\since 4.6
Returns \c true if the set contains all items from the \a other set;
@@ -324,7 +324,7 @@
\sa insert(), remove(), find()
*/
-/*! \fn QSet::const_iterator QSet::begin() const
+/*! \fn template <class T> QSet<T>::const_iterator QSet<T>::begin() const
Returns a const \l{STL-style iterators}{STL-style iterator} positioned at the first
item in the set.
@@ -332,7 +332,7 @@
\sa constBegin(), end()
*/
-/*! \fn QSet::iterator QSet::begin()
+/*! \fn template <class T> QSet<T>::iterator QSet<T>::begin()
\since 4.2
\overload
@@ -340,7 +340,7 @@
item in the set.
*/
-/*! \fn QSet::const_iterator QSet::cbegin() const
+/*! \fn template <class T> QSet<T>::const_iterator QSet<T>::cbegin() const
\since 5.0
Returns a const \l{STL-style iterators}{STL-style iterator} positioned at the first
@@ -349,7 +349,7 @@
\sa begin(), cend()
*/
-/*! \fn QSet::const_iterator QSet::constBegin() const
+/*! \fn template <class T> QSet<T>::const_iterator QSet<T>::constBegin() const
Returns a const \l{STL-style iterators}{STL-style iterator} positioned at the first
item in the set.
@@ -357,7 +357,7 @@
\sa begin(), constEnd()
*/
-/*! \fn QSet::const_iterator QSet::end() const
+/*! \fn template <class T> QSet<T>::const_iterator QSet<T>::end() const
Returns a const \l{STL-style iterators}{STL-style iterator} positioned at the imaginary
item after the last item in the set.
@@ -365,7 +365,7 @@
\sa constEnd(), begin()
*/
-/*! \fn QSet::iterator QSet::end()
+/*! \fn template <class T> QSet<T>::iterator QSet<T>::end()
\since 4.2
\overload
@@ -373,7 +373,7 @@
imaginary item after the last item in the set.
*/
-/*! \fn QSet::const_iterator QSet::cend() const
+/*! \fn template <class T> QSet<T>::const_iterator QSet<T>::cend() const
\since 5.0
Returns a const \l{STL-style iterators}{STL-style iterator} pointing to the imaginary
@@ -382,7 +382,7 @@
\sa cbegin(), end()
*/
-/*! \fn QSet::const_iterator QSet::constEnd() const
+/*! \fn template <class T> QSet<T>::const_iterator QSet<T>::constEnd() const
Returns a const \l{STL-style iterators}{STL-style iterator} pointing to the imaginary
item after the last item in the set.
@@ -390,7 +390,7 @@
\sa constBegin(), end()
*/
-/*! \fn QSet::reverse_iterator QSet::rbegin()
+/*! \fn template <class T> QSet<T>::reverse_iterator QSet<T>::rbegin()
\since 5.6
Returns a \l{STL-style iterators}{STL-style} reverse iterator pointing to the first
@@ -399,12 +399,12 @@
\sa begin(), crbegin(), rend()
*/
-/*! \fn QSet::const_reverse_iterator QSet::rbegin() const
+/*! \fn template <class T> QSet<T>::const_reverse_iterator QSet<T>::rbegin() const
\since 5.6
\overload
*/
-/*! \fn QSet::const_reverse_iterator QSet::crbegin() const
+/*! \fn template <class T> QSet<T>::const_reverse_iterator QSet<T>::crbegin() const
\since 5.6
Returns a const \l{STL-style iterators}{STL-style} reverse iterator pointing to the first
@@ -413,7 +413,7 @@
\sa begin(), rbegin(), rend()
*/
-/*! \fn QSet::reverse_iterator QSet::rend()
+/*! \fn template <class T> QSet<T>::reverse_iterator QSet<T>::rend()
\since 5.6
Returns a \l{STL-style iterators}{STL-style} reverse iterator pointing to one past
@@ -422,12 +422,12 @@
\sa end(), crend(), rbegin()
*/
-/*! \fn QSet::const_reverse_iterator QSet::rend() const
+/*! \fn template <class T> QSet<T>::const_reverse_iterator QSet<T>::rend() const
\since 5.6
\overload
*/
-/*! \fn QSet::const_reverse_iterator QSet::crend() const
+/*! \fn template <class T> QSet<T>::const_reverse_iterator QSet<T>::crend() const
\since 5.6
Returns a const \l{STL-style iterators}{STL-style} reverse iterator pointing to one
@@ -530,7 +530,7 @@
*/
/*!
- \fn QSet::insert(const T &value)
+ \fn template <class T> QSet<T>::insert(const T &value)
Inserts item \a value into the set, if \a value isn't already
in the set, and returns an iterator pointing at the inserted
@@ -540,7 +540,7 @@
*/
/*!
- \fn QSet<T> &QSet::unite(const QSet<T> &other)
+ \fn template <class T> QSet<T> &QSet<T>::unite(const QSet<T> &other)
Each item in the \a other set that isn't already in this set is
inserted into this set. A reference to this set is returned.
@@ -549,7 +549,7 @@
*/
/*!
- \fn QSet<T> &QSet::intersect(const QSet<T> &other)
+ \fn template <class T> QSet<T> &QSet<T>::intersect(const QSet<T> &other)
Removes all items from this set that are not contained in the
\a other set. A reference to this set is returned.
@@ -558,7 +558,7 @@
*/
/*!
- \fn bool QSet::intersects(const QSet<T> &other) const
+ \fn template <class T> bool QSet<T>::intersects(const QSet<T> &other) const
\since 5.6
Returns \c true if this set has at least one item in common with
@@ -568,7 +568,7 @@
*/
/*!
- \fn QSet<T> &QSet::subtract(const QSet<T> &other)
+ \fn template <class T> QSet<T> &QSet<T>::subtract(const QSet<T> &other)
Removes all items from this set that are contained in the
\a other set. Returns a reference to this set.
@@ -577,22 +577,22 @@
*/
/*!
- \fn bool QSet::empty() const
+ \fn template <class T> bool QSet<T>::empty() const
Returns \c true if the set is empty. This function is provided
for STL compatibility. It is equivalent to isEmpty().
*/
/*!
- \fn bool QSet::count() const
+ \fn template <class T> bool QSet<T>::count() const
Same as size().
*/
/*!
- \fn QSet<T> &QSet::operator<<(const T &value)
- \fn QSet<T> &QSet::operator+=(const T &value)
- \fn QSet<T> &QSet::operator|=(const T &value)
+ \fn template <class T> QSet<T> &QSet<T>::operator<<(const T &value)
+ \fn template <class T> QSet<T> &QSet<T>::operator+=(const T &value)
+ \fn template <class T> QSet<T> &QSet<T>::operator|=(const T &value)
Inserts a new item \a value and returns a reference to the set.
If \a value already exists in the set, the set is left unchanged.
@@ -601,7 +601,7 @@
*/
/*!
- \fn QSet<T> &QSet::operator-=(const T &value)
+ \fn template <class T> QSet<T> &QSet<T>::operator-=(const T &value)
Removes the occurrence of item \a value from the set, if
it is found, and returns a reference to the set. If the
@@ -611,8 +611,8 @@
*/
/*!
- \fn QSet<T> &QSet::operator|=(const QSet<T> &other)
- \fn QSet<T> &QSet::operator+=(const QSet<T> &other)
+ \fn template <class T> QSet<T> &QSet<T>::operator|=(const QSet<T> &other)
+ \fn template <class T> QSet<T> &QSet<T>::operator+=(const QSet<T> &other)
Same as unite(\a other).
@@ -620,7 +620,7 @@
*/
/*!
- \fn QSet<T> &QSet::operator&=(const QSet<T> &other)
+ \fn template <class T> QSet<T> &QSet<T>::operator&=(const QSet<T> &other)
Same as intersect(\a other).
@@ -628,7 +628,7 @@
*/
/*!
- \fn QSet<T> &QSet::operator&=(const T &value)
+ \fn template <class T> QSet<T> &QSet<T>::operator&=(const T &value)
\overload
@@ -638,7 +638,7 @@
/*!
- \fn QSet<T> &QSet::operator-=(const QSet<T> &other)
+ \fn template <class T> QSet<T> &QSet<T>::operator-=(const QSet<T> &other)
Same as subtract(\a{other}).
@@ -646,8 +646,8 @@
*/
/*!
- \fn QSet<T> QSet::operator|(const QSet<T> &other) const
- \fn QSet<T> QSet::operator+(const QSet<T> &other) const
+ \fn template <class T> QSet<T> QSet<T>::operator|(const QSet<T> &other) const
+ \fn template <class T> QSet<T> QSet<T>::operator+(const QSet<T> &other) const
Returns a new QSet that is the union of this set and the
\a other set.
@@ -656,7 +656,7 @@
*/
/*!
- \fn QSet<T> QSet::operator&(const QSet<T> &other) const
+ \fn template <class T> QSet<T> QSet<T>::operator&(const QSet<T> &other) const
Returns a new QSet that is the intersection of this set and the
\a other set.
@@ -665,7 +665,7 @@
*/
/*!
- \fn QSet<T> QSet::operator-(const QSet<T> &other) const
+ \fn template <class T> QSet<T> QSet<T>::operator-(const QSet<T> &other) const
Returns a new QSet that is the set difference of this set and
the \a other set, i.e., this set - \a other set.
@@ -766,8 +766,8 @@
*/
/*!
- \fn QSet::iterator::iterator()
- \fn QSet::const_iterator::const_iterator()
+ \fn template <class T> QSet<T>::iterator::iterator()
+ \fn template <class T> QSet<T>::const_iterator::const_iterator()
Constructs an uninitialized iterator.
@@ -779,8 +779,8 @@
*/
/*!
- \fn QSet::iterator::iterator(typename Hash::iterator i)
- \fn QSet::const_iterator::const_iterator(typename Hash::const_iterator i)
+ \fn template <class T> QSet<T>::iterator::iterator(typename Hash::iterator i)
+ \fn template <class T> QSet<T>::const_iterator::const_iterator(typename Hash::const_iterator i)
\internal
*/
@@ -822,14 +822,14 @@
*/
/*!
- \fn QSet::iterator::iterator(const iterator &other)
- \fn QSet::const_iterator::const_iterator(const const_iterator &other)
+ \fn template <class T> QSet<T>::iterator::iterator(const iterator &other)
+ \fn template <class T> QSet<T>::const_iterator::const_iterator(const const_iterator &other)
Constructs a copy of \a other.
*/
/*!
- \fn QSet::const_iterator::const_iterator(const iterator &other)
+ \fn template <class T> QSet<T>::const_iterator::const_iterator(const iterator &other)
\since 4.2
\overload
@@ -837,15 +837,15 @@
*/
/*!
- \fn QSet::iterator &QSet::iterator::operator=(const iterator &other)
- \fn QSet::const_iterator &QSet::const_iterator::operator=(const const_iterator &other)
+ \fn template <class T> QSet<T>::iterator &QSet<T>::iterator::operator=(const iterator &other)
+ \fn template <class T> QSet<T>::const_iterator &QSet<T>::const_iterator::operator=(const const_iterator &other)
Assigns \a other to this iterator.
*/
/*!
- \fn const T &QSet::iterator::operator*() const
- \fn const T &QSet::const_iterator::operator*() const
+ \fn template <class T> const T &QSet<T>::iterator::operator*() const
+ \fn template <class T> const T &QSet<T>::const_iterator::operator*() const
Returns a reference to the current item.
@@ -853,8 +853,8 @@
*/
/*!
- \fn const T *QSet::iterator::operator->() const
- \fn const T *QSet::const_iterator::operator->() const
+ \fn template <class T> const T *QSet<T>::iterator::operator->() const
+ \fn template <class T> const T *QSet<T>::const_iterator::operator->() const
Returns a pointer to the current item.
@@ -862,8 +862,8 @@
*/
/*!
- \fn bool QSet::iterator::operator==(const iterator &other) const
- \fn bool QSet::const_iterator::operator==(const const_iterator &other) const
+ \fn template <class T> bool QSet<T>::iterator::operator==(const iterator &other) const
+ \fn template <class T> bool QSet<T>::const_iterator::operator==(const const_iterator &other) const
Returns \c true if \a other points to the same item as this
iterator; otherwise returns \c false.
@@ -872,15 +872,15 @@
*/
/*!
- \fn bool QSet::iterator::operator==(const const_iterator &other) const
- \fn bool QSet::iterator::operator!=(const const_iterator &other) const
+ \fn template <class T> bool QSet<T>::iterator::operator==(const const_iterator &other) const
+ \fn template <class T> bool QSet<T>::iterator::operator!=(const const_iterator &other) const
\overload
*/
/*!
- \fn bool QSet::iterator::operator!=(const iterator &other) const
- \fn bool QSet::const_iterator::operator!=(const const_iterator &other) const
+ \fn template <class T> bool QSet<T>::iterator::operator!=(const iterator &other) const
+ \fn template <class T> bool QSet<T>::const_iterator::operator!=(const const_iterator &other) const
Returns \c true if \a other points to a different item than this
iterator; otherwise returns \c false.
@@ -889,22 +889,22 @@
*/
/*!
- \fn QSet::iterator &QSet::iterator::operator++()
- \fn QSet::const_iterator &QSet::const_iterator::operator++()
+ \fn template <class T> QSet<T>::iterator &QSet<T>::iterator::operator++()
+ \fn template <class T> QSet<T>::const_iterator &QSet<T>::const_iterator::operator++()
The prefix ++ operator (\c{++it}) advances the iterator to the
next item in the set and returns an iterator to the new current
item.
- Calling this function on QSet::constEnd() leads to
+ Calling this function on QSet<T>::constEnd() leads to
undefined results.
\sa operator--()
*/
/*!
- \fn QSet::iterator QSet::iterator::operator++(int)
- \fn QSet::const_iterator QSet::const_iterator::operator++(int)
+ \fn template <class T> QSet<T>::iterator QSet<T>::iterator::operator++(int)
+ \fn template <class T> QSet<T>::const_iterator QSet<T>::const_iterator::operator++(int)
\overload
@@ -914,8 +914,8 @@
*/
/*!
- \fn QSet::iterator &QSet::iterator::operator--()
- \fn QSet::const_iterator &QSet::const_iterator::operator--()
+ \fn template <class T> QSet<T>::iterator &QSet<T>::iterator::operator--()
+ \fn template <class T> QSet<T>::const_iterator &QSet<T>::const_iterator::operator--()
The prefix -- operator (\c{--it}) makes the preceding item
current and returns an iterator to the new current item.
@@ -927,8 +927,8 @@
*/
/*!
- \fn QSet::iterator QSet::iterator::operator--(int)
- \fn QSet::const_iterator QSet::const_iterator::operator--(int)
+ \fn template <class T> QSet<T>::iterator QSet<T>::iterator::operator--(int)
+ \fn template <class T> QSet<T>::const_iterator QSet<T>::const_iterator::operator--(int)
\overload
@@ -937,8 +937,8 @@
*/
/*!
- \fn QSet::iterator QSet::iterator::operator+(int j) const
- \fn QSet::const_iterator QSet::const_iterator::operator+(int j) const
+ \fn template <class T> QSet<T>::iterator QSet<T>::iterator::operator+(int j) const
+ \fn template <class T> QSet<T>::const_iterator QSet<T>::const_iterator::operator+(int j) const
Returns an iterator to the item at \a j positions forward from
this iterator. (If \a j is negative, the iterator goes backward.)
@@ -949,8 +949,8 @@
*/
/*!
- \fn QSet::iterator QSet::iterator::operator-(int j) const
- \fn QSet::const_iterator QSet::const_iterator::operator-(int j) const
+ \fn template <class T> QSet<T>::iterator QSet<T>::iterator::operator-(int j) const
+ \fn template <class T> QSet<T>::const_iterator QSet<T>::const_iterator::operator-(int j) const
Returns an iterator to the item at \a j positions backward from
this iterator. (If \a j is negative, the iterator goes forward.)
@@ -961,8 +961,8 @@
*/
/*!
- \fn QSet::iterator &QSet::iterator::operator+=(int j)
- \fn QSet::const_iterator &QSet::const_iterator::operator+=(int j)
+ \fn template <class T> QSet<T>::iterator &QSet<T>::iterator::operator+=(int j)
+ \fn template <class T> QSet<T>::const_iterator &QSet<T>::const_iterator::operator+=(int j)
Advances the iterator by \a j items. (If \a j is negative, the
iterator goes backward.)
@@ -973,8 +973,8 @@
*/
/*!
- \fn QSet::iterator &QSet::iterator::operator-=(int j)
- \fn QSet::const_iterator &QSet::const_iterator::operator-=(int j)
+ \fn template <class T> QSet<T>::iterator &QSet<T>::iterator::operator-=(int j)
+ \fn template <class T> QSet<T>::const_iterator &QSet<T>::const_iterator::operator-=(int j)
Makes the iterator go back by \a j items. (If \a j is negative,
the iterator goes forward.)
@@ -984,7 +984,7 @@
\sa operator+=(), operator-()
*/
-/*! \fn QList<T> QSet<T>::toList() const
+/*! \fn template <class T> QList<T> QSet<T>::toList() const
Returns a new QList containing the elements in the set. The
order of the elements in the QList is undefined.
@@ -996,7 +996,7 @@
\sa fromList(), QList::fromSet()
*/
-/*! \fn QList<T> QSet<T>::values() const
+/*! \fn template <class T> QList<T> QSet<T>::values() const
Returns a new QList containing the elements in the set. The
order of the elements in the QList is undefined.
@@ -1007,7 +1007,7 @@
*/
-/*! \fn QSet<T> QSet<T>::fromList(const QList<T> &list)
+/*! \fn template <class T> QSet<T> QSet<T>::fromList(const QList<T> &list)
Returns a new QSet object containing the data contained in \a
list. Since QSet doesn't allow duplicates, the resulting QSet
@@ -1022,7 +1022,7 @@
*/
/*!
- \fn QDataStream &operator<<(QDataStream &out, const QSet<T> &set)
+ \fn template <class T> QDataStream &operator<<(QDataStream &out, const QSet<T> &set)
\relates QSet
Writes the \a set to stream \a out.
@@ -1033,7 +1033,7 @@
*/
/*!
- \fn QDataStream &operator>>(QDataStream &in, QSet<T> &set)
+ \fn template <class T> QDataStream &operator>>(QDataStream &in, QSet<T> &set)
\relates QSet
Reads a set from stream \a in into \a set.
@@ -1044,7 +1044,7 @@
*/
/*!
- \fn uint qHash(const QSet<T> &key, uint seed = 0)
+ \fn template <class T> uint qHash(const QSet<T> &key, uint seed = 0)
\relates QHash
\since 5.5
diff --git a/src/corelib/tools/qshareddata.cpp b/src/corelib/tools/qshareddata.cpp
index 14bc70734d..f95d75c4a8 100644
--- a/src/corelib/tools/qshareddata.cpp
+++ b/src/corelib/tools/qshareddata.cpp
@@ -59,9 +59,9 @@ QT_BEGIN_NAMESPACE
Constructs a QSharedData object with a reference count of 0.
*/
-/*! \fn QSharedData::QSharedData(const QSharedData& other)
+/*! \fn QSharedData::QSharedData(const QSharedData& )
Constructs a QSharedData object with reference count 0.
- \a other is ignored.
+ The parameter is ignored.
*/
/*!
@@ -248,86 +248,86 @@ QT_BEGIN_NAMESPACE
\internal
*/
-/*! \fn T& QSharedDataPointer::operator*()
+/*! \fn template <class T> T& QSharedDataPointer<T>::operator*()
Provides access to the shared data object's members.
This function calls detach().
*/
-/*! \fn const T& QSharedDataPointer::operator*() const
+/*! \fn template <class T> const T& QSharedDataPointer<T>::operator*() const
Provides const access to the shared data object's members.
This function does \e not call detach().
*/
-/*! \fn T* QSharedDataPointer::operator->()
+/*! \fn template <class T> T* QSharedDataPointer<T>::operator->()
Provides access to the shared data object's members.
This function calls detach().
*/
-/*! \fn const T* QSharedDataPointer::operator->() const
+/*! \fn template <class T> const T* QSharedDataPointer<T>::operator->() const
Provides const access to the shared data object's members.
This function does \e not call detach().
*/
-/*! \fn QSharedDataPointer::operator T*()
+/*! \fn template <class T> QSharedDataPointer<T>::operator T*()
Returns a pointer to the shared data object.
This function calls detach().
\sa data(), constData()
*/
-/*! \fn QSharedDataPointer::operator const T*() const
+/*! \fn template <class T> QSharedDataPointer<T>::operator const T*() const
Returns a pointer to the shared data object.
This function does \e not call detach().
*/
-/*! \fn T* QSharedDataPointer::data()
+/*! \fn template <class T> T* QSharedDataPointer<T>::data()
Returns a pointer to the shared data object.
This function calls detach().
\sa constData()
*/
-/*! \fn const T* QSharedDataPointer::data() const
+/*! \fn template <class T> const T* QSharedDataPointer<T>::data() const
Returns a pointer to the shared data object.
This function does \e not call detach().
*/
-/*! \fn const T* QSharedDataPointer::constData() const
+/*! \fn template <class T> const T* QSharedDataPointer<T>::constData() const
Returns a const pointer to the shared data object.
This function does \e not call detach().
\sa data()
*/
-/*! \fn void QSharedDataPointer::swap(QSharedDataPointer &other)
+/*! \fn template <class T> void QSharedDataPointer<T>::swap(QSharedDataPointer &other)
Swap this instance's shared data pointer with the shared
data pointer in \a other.
*/
/*!
- \fn QSharedDataPointer<T> &QSharedDataPointer::operator=(QSharedDataPointer<T> &&other)
+ \fn template <class T> QSharedDataPointer<T> &QSharedDataPointer<T>::operator=(QSharedDataPointer<T> &&other)
Move-assigns \a other to this QSharedDataPointer instance.
\since 5.2
*/
-/*! \fn bool QSharedDataPointer::operator==(const QSharedDataPointer<T>& other) const
+/*! \fn template <class T> bool QSharedDataPointer<T>::operator==(const QSharedDataPointer<T>& other) const
Returns \c true if \a other and \e this have the same \e{d pointer}.
This function does \e not call detach().
*/
-/*! \fn bool QSharedDataPointer::operator!=(const QSharedDataPointer<T>& other) const
+/*! \fn template <class T> bool QSharedDataPointer<T>::operator!=(const QSharedDataPointer<T>& other) const
Returns \c true if \a other and \e this do \e not have the same
\e{d pointer}. This function does \e not call detach().
*/
-/*! \fn QSharedDataPointer::QSharedDataPointer()
+/*! \fn template <class T> QSharedDataPointer<T>::QSharedDataPointer()
Constructs a QSharedDataPointer initialized with a null \e{d pointer}.
*/
/*!
- \fn QSharedDataPointer::QSharedDataPointer(QSharedDataPointer &&o)
+ \fn template <class T> QSharedDataPointer<T>::QSharedDataPointer(QSharedDataPointer &&o)
Move-constructs a QSharedDataPointer instance, making it point at the same
object that \a o was pointing to.
@@ -335,45 +335,45 @@ QT_BEGIN_NAMESPACE
\since 5.2
*/
-/*! \fn QSharedDataPointer::~QSharedDataPointer()
+/*! \fn template <class T> QSharedDataPointer<T>::~QSharedDataPointer()
Decrements the reference count of the shared data object.
If the reference count becomes 0, the shared data object
is deleted. \e This is then destroyed.
*/
-/*! \fn QSharedDataPointer::QSharedDataPointer(T* sharedData)
+/*! \fn template <class T> QSharedDataPointer<T>::QSharedDataPointer(T* data)
Constructs a QSharedDataPointer with \e{d pointer} set to
- \a sharedData and increments \a{sharedData}'s reference count.
+ \a data and increments \a{data}'s reference count.
*/
-/*! \fn QSharedDataPointer::QSharedDataPointer(const QSharedDataPointer<T>& other)
+/*! \fn template <class T> QSharedDataPointer<T>::QSharedDataPointer(const QSharedDataPointer<T>& o)
Sets the \e{d pointer} of \e this to the \e{d pointer} in
- \a other and increments the reference count of the shared
+ \a o and increments the reference count of the shared
data object.
*/
-/*! \fn QSharedDataPointer<T>& QSharedDataPointer::operator=(const QSharedDataPointer<T>& other)
+/*! \fn template <class T> QSharedDataPointer<T>& QSharedDataPointer<T>::operator=(const QSharedDataPointer<T>& o)
Sets the \e{d pointer} of \e this to the \e{d pointer} of
- \a other and increments the reference count of the shared
+ \a o and increments the reference count of the shared
data object. The reference count of the old shared data
object of \e this is decremented. If the reference count
of the old shared data object becomes 0, the old shared
data object is deleted.
*/
-/*! \fn QSharedDataPointer& QSharedDataPointer::operator=(T* sharedData)
- Sets the \e{d pointer} og \e this to \a sharedData and increments
- \a{sharedData}'s reference count. The reference count of the old
+/*! \fn template <class T> QSharedDataPointer& QSharedDataPointer<T>::operator=(T* o)
+ Sets the \e{d pointer} og \e this to \a o and increments
+ \a{o}'s reference count. The reference count of the old
shared data object of \e this is decremented. If the reference
count of the old shared data object becomes 0, the old shared data
object is deleted.
*/
-/*! \fn bool QSharedDataPointer::operator!() const
+/*! \fn template <class T> bool QSharedDataPointer<T>::operator!() const
Returns \c true if the \e{d pointer} of \e this is null.
*/
-/*! \fn void QSharedDataPointer::detach()
+/*! \fn template <class T> void QSharedDataPointer<T>::detach()
If the shared data object's reference count is greater than 1, this
function creates a deep copy of the shared data object and sets the
\e{d pointer} of \e this to the copy.
@@ -383,7 +383,7 @@ QT_BEGIN_NAMESPACE
required. You don't need to call it yourself.
*/
-/*! \fn T *QSharedDataPointer::clone()
+/*! \fn template <class T> T *QSharedDataPointer<T>::clone()
\since 4.5
Creates and returns a deep copy of the current data. This function
@@ -449,71 +449,71 @@ QT_BEGIN_NAMESPACE
\sa QSharedData, QSharedDataPointer
*/
-/*! \fn T& QExplicitlySharedDataPointer::operator*() const
+/*! \fn template <class T> T& QExplicitlySharedDataPointer<T>::operator*() const
Provides access to the shared data object's members.
*/
-/*! \fn T* QExplicitlySharedDataPointer::operator->()
+/*! \fn template <class T> T* QExplicitlySharedDataPointer<T>::operator->()
Provides access to the shared data object's members.
*/
-/*! \fn const T* QExplicitlySharedDataPointer::operator->() const
+/*! \fn template <class T> const T* QExplicitlySharedDataPointer<T>::operator->() const
Provides const access to the shared data object's members.
*/
-/*! \fn T* QExplicitlySharedDataPointer::data() const
+/*! \fn template <class T> T* QExplicitlySharedDataPointer<T>::data() const
Returns a pointer to the shared data object.
*/
-/*! \fn const T* QExplicitlySharedDataPointer::constData() const
+/*! \fn template <class T> const T* QExplicitlySharedDataPointer<T>::constData() const
Returns a const pointer to the shared data object.
\sa data()
*/
-/*! \fn void QExplicitlySharedDataPointer::swap(QExplicitlySharedDataPointer &other)
+/*! \fn template <class T> void QExplicitlySharedDataPointer<T>::swap(QExplicitlySharedDataPointer &other)
Swap this instance's explicitly shared data pointer with
the explicitly shared data pointer in \a other.
*/
-/*! \fn bool QExplicitlySharedDataPointer::operator==(const QExplicitlySharedDataPointer<T>& other) const
+/*! \fn template <class T> bool QExplicitlySharedDataPointer<T>::operator==(const QExplicitlySharedDataPointer<T>& other) const
Returns \c true if \a other and \e this have the same \e{d pointer}.
*/
/*!
- \fn QExplicitlySharedDataPointer<T> &QExplicitlySharedDataPointer::operator=(QExplicitlySharedDataPointer<T> &&other)
+ \fn template <class T> QExplicitlySharedDataPointer<T> &QExplicitlySharedDataPointer<T>::operator=(QExplicitlySharedDataPointer<T> &&other)
Move-assigns \a other to this QExplicitlySharedDataPointer instance.
\since 5.2
*/
-/*! \fn bool QExplicitlySharedDataPointer::operator==(const T* ptr) const
+/*! \fn template <class T> bool QExplicitlySharedDataPointer<T>::operator==(const T* ptr) const
Returns \c true if the \e{d pointer} of \e this is \a ptr.
*/
-/*! \fn bool QExplicitlySharedDataPointer::operator!=(const QExplicitlySharedDataPointer<T>& other) const
+/*! \fn template <class T> bool QExplicitlySharedDataPointer<T>::operator!=(const QExplicitlySharedDataPointer<T>& other) const
Returns \c true if \a other and \e this do \e not have the same
\e{d pointer}.
*/
-/*! \fn bool QExplicitlySharedDataPointer::operator!=(const T* ptr) const
+/*! \fn template <class T> bool QExplicitlySharedDataPointer<T>::operator!=(const T* ptr) const
Returns \c true if the \e{d pointer} of \e this is \e not \a ptr.
*/
-/*! \fn QExplicitlySharedDataPointer::QExplicitlySharedDataPointer()
+/*! \fn template <class T> QExplicitlySharedDataPointer<T>::QExplicitlySharedDataPointer()
Constructs a QExplicitlySharedDataPointer initialized with a null
\e{d pointer}.
*/
-/*! \fn QExplicitlySharedDataPointer::~QExplicitlySharedDataPointer()
+/*! \fn template <class T> QExplicitlySharedDataPointer<T>::~QExplicitlySharedDataPointer()
Decrements the reference count of the shared data object.
If the reference count becomes 0, the shared data object
is deleted. \e This is then destroyed.
*/
/*!
- \fn QExplicitlySharedDataPointer::QExplicitlySharedDataPointer(QExplicitlySharedDataPointer &&o)
+ \fn template <class T> QExplicitlySharedDataPointer<T>::QExplicitlySharedDataPointer(QExplicitlySharedDataPointer &&o)
Move-constructs a QExplicitlySharedDataPointer instance, making it point at the same
object that \a o was pointing to.
@@ -521,24 +521,24 @@ QT_BEGIN_NAMESPACE
\since 5.2
*/
-/*! \fn QExplicitlySharedDataPointer::QExplicitlySharedDataPointer(T* sharedData)
+/*! \fn template <class T> QExplicitlySharedDataPointer<T>::QExplicitlySharedDataPointer(T* data)
Constructs a QExplicitlySharedDataPointer with \e{d pointer}
- set to \a sharedData and increments \a{sharedData}'s reference
+ set to \a data and increments \a{data}'s reference
count.
*/
-/*! \fn QExplicitlySharedDataPointer::QExplicitlySharedDataPointer(const QExplicitlySharedDataPointer<T>& other)
+/*! \fn template <class T> QExplicitlySharedDataPointer<T>::QExplicitlySharedDataPointer(const QExplicitlySharedDataPointer<T>& o)
This standard copy constructor sets the \e {d pointer} of \e this to
- the \e {d pointer} in \a other and increments the reference count of
+ the \e {d pointer} in \a o and increments the reference count of
the shared data object.
*/
-/*! \fn QExplicitlySharedDataPointer::QExplicitlySharedDataPointer(const QExplicitlySharedDataPointer<X>& other)
- This copy constructor is different in that it allows \a other to be
+/*! \fn template <class T> template <class X> QExplicitlySharedDataPointer<T>::QExplicitlySharedDataPointer(const QExplicitlySharedDataPointer<X>& o)
+ This copy constructor is different in that it allows \a o to be
a different type of explicitly shared data pointer but one that has
a compatible shared data object.
- By default, the \e{d pointer} of \a other (of type \c{X *}) gets
+ By default, the \e{d pointer} of \a o (of type \c{X *}) gets
implicitly converted to the type \c{T *}; the result of this
conversion is set as the \e{d pointer} of \e{this}, and the
reference count of the shared data object is incremented.
@@ -546,7 +546,7 @@ QT_BEGIN_NAMESPACE
However, if the macro
\c{QT_ENABLE_QEXPLICITLYSHAREDDATAPOINTER_STATICCAST} is defined
before including the \c{QExplicitlySharedDataPointer} header, then
- the \e{d pointer} of \a other undergoes a \c{static_cast} to the
+ the \e{d pointer} of \a o undergoes a \c{static_cast} to the
type \c{T *}. The result of the cast is then set as the
\e{d pointer} of \e{this}, and the reference count of the shared data
object is incremented.
@@ -566,39 +566,39 @@ QT_BEGIN_NAMESPACE
compile without modifications.
*/
-/*! \fn QExplicitlySharedDataPointer<T>& QExplicitlySharedDataPointer::operator=(const QExplicitlySharedDataPointer<T>& other)
+/*! \fn template <class T> QExplicitlySharedDataPointer<T>& QExplicitlySharedDataPointer<T>::operator=(const QExplicitlySharedDataPointer<T>& o)
Sets the \e{d pointer} of \e this to the \e{d pointer} of
- \a other and increments the reference count of the shared
+ \a o and increments the reference count of the shared
data object. The reference count of the old shared data
object of \e this is decremented. If the reference count
of the old shared data object becomes 0, the old shared
data object is deleted.
*/
-/*! \fn QExplicitlySharedDataPointer& QExplicitlySharedDataPointer::operator=(T* sharedData)
- Sets the \e{d pointer} of \e this to \a sharedData and
- increments \a{sharedData}'s reference count. The reference
+/*! \fn template <class T> QExplicitlySharedDataPointer& QExplicitlySharedDataPointer<T>::operator=(T* o)
+ Sets the \e{d pointer} of \e this to \a o and
+ increments \a{o}'s reference count. The reference
count of the old shared data object of \e this is decremented.
If the reference count of the old shared data object becomes
0, the old shared data object is deleted.
*/
-/*! \fn void QExplicitlySharedDataPointer::reset()
+/*! \fn template <class T> void QExplicitlySharedDataPointer<T>::reset()
Resets \e this to be null. i.e., this function sets the
\e{d pointer} of \e this to 0, but first it decrements
the reference count of the shared data object and deletes
the shared data object if the reference count became 0.
*/
-/*! \fn QExplicitlySharedDataPointer::operator bool () const
+/*! \fn template <class T> QExplicitlySharedDataPointer<T>::operator bool () const
Returns \c true if the \e{d pointer} of \e this is \e not null.
*/
-/*! \fn bool QExplicitlySharedDataPointer::operator!() const
+/*! \fn template <class T> bool QExplicitlySharedDataPointer<T>::operator!() const
Returns \c true if the \e{d pointer} of \e this is null.
*/
-/*! \fn void QExplicitlySharedDataPointer::detach()
+/*! \fn template <class T> void QExplicitlySharedDataPointer<T>::detach()
If the shared data object's reference count is greater than 1, this
function creates a deep copy of the shared data object and sets the
\e{d pointer} of \e this to the copy.
@@ -610,7 +610,7 @@ QT_BEGIN_NAMESPACE
everywhere in your code, consider using QSharedDataPointer instead.
*/
-/*! \fn T *QExplicitlySharedDataPointer::clone()
+/*! \fn template <class T> T *QExplicitlySharedDataPointer<T>::clone()
\since 4.5
Creates and returns a deep copy of the current data. This function
@@ -618,7 +618,7 @@ QT_BEGIN_NAMESPACE
order to create the new copy. This function uses the \e {operator
new} and calls the copy constructor of the type T.
- See QSharedDataPointer::clone() for an explanation of how to use it.
+ See QSharedDataPointer<T>::clone() for an explanation of how to use it.
*/
/*!
diff --git a/src/corelib/tools/qshareddata.h b/src/corelib/tools/qshareddata.h
index 13b0032605..dbf0907a0f 100644
--- a/src/corelib/tools/qshareddata.h
+++ b/src/corelib/tools/qshareddata.h
@@ -85,7 +85,7 @@ public:
inline bool operator==(const QSharedDataPointer<T> &other) const { return d == other.d; }
inline bool operator!=(const QSharedDataPointer<T> &other) const { return d != other.d; }
- inline QSharedDataPointer() { d = Q_NULLPTR; }
+ inline QSharedDataPointer() { d = nullptr; }
inline ~QSharedDataPointer() { if (d && !d->ref.deref()) delete d; }
explicit QSharedDataPointer(T *data) Q_DECL_NOTHROW;
@@ -113,7 +113,7 @@ public:
return *this;
}
#ifdef Q_COMPILER_RVALUE_REFS
- QSharedDataPointer(QSharedDataPointer &&o) Q_DECL_NOTHROW : d(o.d) { o.d = Q_NULLPTR; }
+ QSharedDataPointer(QSharedDataPointer &&o) Q_DECL_NOTHROW : d(o.d) { o.d = nullptr; }
inline QSharedDataPointer<T> &operator=(QSharedDataPointer<T> &&other) Q_DECL_NOTHROW
{ qSwap(d, other.d); return *this; }
#endif
@@ -151,17 +151,17 @@ public:
if(d && !d->ref.deref())
delete d;
- d = Q_NULLPTR;
+ d = nullptr;
}
- inline operator bool () const { return d != Q_NULLPTR; }
+ inline operator bool () const { return d != nullptr; }
inline bool operator==(const QExplicitlySharedDataPointer<T> &other) const { return d == other.d; }
inline bool operator!=(const QExplicitlySharedDataPointer<T> &other) const { return d != other.d; }
inline bool operator==(const T *ptr) const { return d == ptr; }
inline bool operator!=(const T *ptr) const { return d != ptr; }
- inline QExplicitlySharedDataPointer() { d = Q_NULLPTR; }
+ inline QExplicitlySharedDataPointer() { d = nullptr; }
inline ~QExplicitlySharedDataPointer() { if (d && !d->ref.deref()) delete d; }
explicit QExplicitlySharedDataPointer(T *data) Q_DECL_NOTHROW;
@@ -202,7 +202,7 @@ public:
return *this;
}
#ifdef Q_COMPILER_RVALUE_REFS
- inline QExplicitlySharedDataPointer(QExplicitlySharedDataPointer &&o) Q_DECL_NOTHROW : d(o.d) { o.d = Q_NULLPTR; }
+ inline QExplicitlySharedDataPointer(QExplicitlySharedDataPointer &&o) Q_DECL_NOTHROW : d(o.d) { o.d = nullptr; }
inline QExplicitlySharedDataPointer<T> &operator=(QExplicitlySharedDataPointer<T> &&other) Q_DECL_NOTHROW
{ qSwap(d, other.d); return *this; }
#endif
diff --git a/src/corelib/tools/qsharedpointer.cpp b/src/corelib/tools/qsharedpointer.cpp
index af09ef6f40..756e7bb59b 100644
--- a/src/corelib/tools/qsharedpointer.cpp
+++ b/src/corelib/tools/qsharedpointer.cpp
@@ -429,20 +429,20 @@
*/
/*!
- \fn QSharedPointer::QSharedPointer()
+ \fn template <class T> QSharedPointer<T>::QSharedPointer()
Creates a QSharedPointer that points to null (0).
*/
/*!
- \fn QSharedPointer::~QSharedPointer()
+ \fn template <class T> QSharedPointer<T>::~QSharedPointer()
Destroys this QSharedPointer object. If it is the last reference to
the pointer stored, this will delete the pointer as well.
*/
/*!
- \fn QSharedPointer::QSharedPointer(X *ptr)
+ \fn template <class T> template <typename X> QSharedPointer<T>::QSharedPointer(X *ptr)
Creates a QSharedPointer that points to \a ptr. The pointer \a ptr
becomes managed by this QSharedPointer and must not be passed to
@@ -455,13 +455,13 @@
*/
/*!
- \fn QSharedPointer::QSharedPointer(X *ptr, Deleter deleter)
+ \fn template <class T> template <typename X, typename Deleter> QSharedPointer<T>::QSharedPointer(X *ptr, Deleter d)
Creates a QSharedPointer that points to \a ptr. The pointer \a ptr
becomes managed by this QSharedPointer and must not be passed to
another QSharedPointer object or deleted outside this object.
- The \a deleter parameter specifies the custom deleter for this
+ The deleter parameter \a d specifies the custom deleter for this
object. The custom deleter is called, instead of the operator delete(),
when the strong reference count drops to 0. This is useful,
for instance, for calling \l {QObject::}{deleteLater()} on a QObject instead:
@@ -495,7 +495,7 @@
*/
/*!
- \fn QSharedPointer::QSharedPointer(std::nullptr_t)
+ \fn template <class T> QSharedPointer<T>::QSharedPointer(std::nullptr_t)
\since 5.8
Creates a QSharedPointer that is null. This is equivalent to the
@@ -503,15 +503,19 @@
*/
/*!
- \fn QSharedPointer::QSharedPointer(std::nullptr_t, Deleter)
+ \fn template <class T> template <typename Deleter> QSharedPointer<T>::QSharedPointer(std::nullptr_t, Deleter d)
\since 5.8
Creates a QSharedPointer that is null. This is equivalent to the
QSharedPointer default constructor.
+
+ The deleter parameter \a d specifies the custom deleter for this
+ object. The custom deleter is called, instead of the operator
+ delete(), when the strong reference count drops to 0.
*/
/*!
- \fn QSharedPointer::QSharedPointer(const QSharedPointer<T> &other)
+ \fn template <class T> QSharedPointer<T>::QSharedPointer(const QSharedPointer<T> &other)
Creates a QSharedPointer object that shares \a other's pointer.
@@ -521,7 +525,7 @@
*/
/*!
- \fn QSharedPointer::QSharedPointer(const QWeakPointer<T> &other)
+ \fn template <class T> QSharedPointer<T>::QSharedPointer(const QWeakPointer<T> &other)
Creates a QSharedPointer by promoting the weak reference \a other
to strong reference and sharing its pointer.
@@ -534,7 +538,7 @@
*/
/*!
- \fn QSharedPointer &QSharedPointer::operator=(const QSharedPointer<T> &other)
+ \fn template <class T> QSharedPointer &QSharedPointer<T>::operator=(const QSharedPointer<T> &other)
Makes this object share \a other's pointer. The current pointer
reference is discarded and, if it was the last, the pointer will
@@ -546,7 +550,7 @@
*/
/*!
- \fn QSharedPointer &QSharedPointer::operator=(const QWeakPointer<T> &other)
+ \fn template <class T> QSharedPointer &QSharedPointer<T>::operator=(const QWeakPointer<T> &other)
Promotes \a other to a strong reference and makes this object
share a reference to the pointer referenced by it. The current pointer
@@ -559,7 +563,7 @@
*/
/*!
- \fn void QSharedPointer::swap(QSharedPointer<T> &other);
+ \fn template <class T> void QSharedPointer<T>::swap(QSharedPointer<T> &other);
\since 5.3
Swaps this shared pointer instance with \a other. This function is
@@ -567,7 +571,7 @@
*/
/*!
- \fn T *QSharedPointer::data() const
+ \fn template <class T> T *QSharedPointer<T>::data() const
Returns the value of the pointer referenced by this object.
@@ -577,7 +581,16 @@
*/
/*!
- \fn T &QSharedPointer::operator *() const
+ \fn T *QSharedPointer::get() const
+ \since 5.11
+
+ Same as data().
+
+ This function is provided for API compatibility with \c{std::shared_ptr}.
+*/
+
+/*!
+ \fn template <class T> T &QSharedPointer<T>::operator *() const
Provides access to the shared pointer's members.
@@ -585,7 +598,7 @@
*/
/*!
- \fn T *QSharedPointer::operator ->() const
+ \fn template <class T> T *QSharedPointer<T>::operator ->() const
Provides access to the shared pointer's members.
@@ -593,14 +606,14 @@
*/
/*!
- \fn bool QSharedPointer::isNull() const
+ \fn template <class T> bool QSharedPointer<T>::isNull() const
Returns \c true if this object is holding a reference to a null
pointer.
*/
/*!
- \fn QSharedPointer::operator bool() const
+ \fn template <class T> QSharedPointer<T>::operator bool() const
Returns \c true if this object is not null. This function is suitable
for use in \tt if-constructs, like:
@@ -613,7 +626,7 @@
*/
/*!
- \fn bool QSharedPointer::operator !() const
+ \fn template <class T> bool QSharedPointer<T>::operator !() const
Returns \c true if this object is null. This function is suitable
for use in \tt if-constructs, like:
@@ -626,7 +639,7 @@
*/
/*!
- \fn QSharedPointer<X> QSharedPointer::staticCast() const
+ \fn template <class T> template <class X> QSharedPointer<X> QSharedPointer<T>::staticCast() const
Performs a static cast from this pointer's type to \tt X and returns
a QSharedPointer that shares the reference. This function can be
@@ -641,7 +654,7 @@
*/
/*!
- \fn QSharedPointer<X> QSharedPointer::dynamicCast() const
+ \fn template <class T> template <class X> QSharedPointer<X> QSharedPointer<T>::dynamicCast() const
Performs a dynamic cast from this pointer's type to \tt X and
returns a QSharedPointer that shares the reference. If this
@@ -658,7 +671,7 @@
*/
/*!
- \fn QSharedPointer<X> QSharedPointer::constCast() const
+ \fn template <class T> template <class X> QSharedPointer<X> QSharedPointer<T>::constCast() const
Performs a \tt const_cast from this pointer's type to \tt X and returns
a QSharedPointer that shares the reference. This function can be
@@ -669,7 +682,7 @@
*/
/*!
- \fn QSharedPointer<X> QSharedPointer::objectCast() const
+ \fn template <class T> template <class X> QSharedPointer<X> QSharedPointer<T>::objectCast() const
\since 4.6
Performs a \l qobject_cast() from this pointer's type to \tt X and
@@ -687,7 +700,7 @@
*/
/*!
- \fn QSharedPointer<T> QSharedPointer::create()
+ \fn template <class T> QSharedPointer<T> QSharedPointer<T>::create()
\since 5.1
Creates a QSharedPointer object and allocates a new item of type \tt T. The
@@ -699,7 +712,7 @@
*/
/*!
- \fn QSharedPointer<T> QSharedPointer::create(...)
+ \fn template <class T> QSharedPointer<T> QSharedPointer<T>::create(...)
\overload
\since 5.1
@@ -724,7 +737,7 @@
*/
/*!
- \fn QWeakPointer<T> QSharedPointer::toWeakRef() const
+ \fn template <class T> QWeakPointer<T> QSharedPointer<T>::toWeakRef() const
Returns a weak reference object that shares the pointer referenced
by this object.
@@ -733,7 +746,7 @@
*/
/*!
- \fn void QSharedPointer::clear()
+ \fn template <class T> void QSharedPointer<T>::clear()
Clears this QSharedPointer object, dropping the reference that it
may have had to the pointer. If this was the last reference, then
@@ -741,14 +754,14 @@
*/
/*!
- \fn void QSharedPointer::reset()
+ \fn template <class T> void QSharedPointer<T>::reset()
\since 5.0
Same as clear(). For std::shared_ptr compatibility.
*/
/*!
- \fn void QSharedPointer::reset(T *t)
+ \fn template <class T> void QSharedPointer<T>::reset(T *t)
\since 5.0
Resets this QSharedPointer object to point to \a t
@@ -759,31 +772,31 @@
*/
/*!
- \fn void QSharedPointer::reset(T *t, Deleter deleter)
+ \fn template <class T> template <typename Deleter> void QSharedPointer<T>::reset(T *t, Deleter deleter)
\since 5.0
Resets this QSharedPointer object to point to \a t
- instead, with deleter \a deleter. Equivalent to:
+ instead, with the Deleter \a deleter. Equivalent to:
\code
QSharedPointer<T> other(t, deleter); this->swap(other);
\endcode
*/
/*!
- \fn QWeakPointer::QWeakPointer()
+ \fn template <class T> QWeakPointer<T>::QWeakPointer()
Creates a QWeakPointer that points to nothing.
*/
/*!
- \fn QWeakPointer::~QWeakPointer()
+ \fn template <class T> QWeakPointer<T>::~QWeakPointer()
Destroys this QWeakPointer object. The pointer referenced
by this object will not be deleted.
*/
/*!
- \fn QWeakPointer::QWeakPointer(const QWeakPointer<T> &other)
+ \fn template <class T> QWeakPointer<T>::QWeakPointer(const QWeakPointer<T> &other)
Creates a QWeakPointer that holds a weak reference to the
pointer referenced by \a other.
@@ -794,7 +807,7 @@
*/
/*!
- \fn QWeakPointer::QWeakPointer(const QSharedPointer<T> &other)
+ \fn template <class T> QWeakPointer<T>::QWeakPointer(const QSharedPointer<T> &other)
Creates a QWeakPointer that holds a weak reference to the
pointer referenced by \a other.
@@ -805,12 +818,12 @@
*/
/*!
- \fn QWeakPointer::QWeakPointer(const QObject *obj)
+ \fn template <class T> QWeakPointer<T>::QWeakPointer(const QObject *other)
\since 4.6
\deprecated
Creates a QWeakPointer that holds a weak reference directly to the
- QObject \a obj. This constructor is only available if the template type
+ QObject \a other. This constructor is only available if the template type
\tt T is QObject or derives from it (otherwise a compilation error will
result).
@@ -824,19 +837,19 @@
*/
/*!
- \fn QWeakPointer &QWeakPointer::operator=(const QObject *obj)
+ \fn template <class T> QWeakPointer &QWeakPointer<T>::operator=(const QObject *other)
\since 4.6
\deprecated
Makes this QWeakPointer hold a weak reference directly to the QObject
- \a obj. This function is only available if the template type \tt T is
+ \a other. This function is only available if the template type \tt T is
QObject or derives from it.
\sa QPointer
*/
/*!
- \fn QWeakPointer &QWeakPointer::operator=(const QWeakPointer<T> &other)
+ \fn template <class T> QWeakPointer &QWeakPointer<T>::operator=(const QWeakPointer<T> &other)
Makes this object share \a other's pointer. The current pointer
reference is discarded but is not deleted.
@@ -847,7 +860,7 @@
*/
/*!
- \fn QWeakPointer &QWeakPointer::operator=(const QSharedPointer<T> &other)
+ \fn template <class T> QWeakPointer &QWeakPointer<T>::operator=(const QSharedPointer<T> &other)
Makes this object share \a other's pointer. The current pointer
reference is discarded but is not deleted.
@@ -858,7 +871,7 @@
*/
/*!
- \fn void QWeakPointer::swap(QWeakPointer<T> &other)
+ \fn template <class T> void QWeakPointer<T>::swap(QWeakPointer<T> &other)
\since 5.4
Swaps this weak pointer instance with \a other. This function is
@@ -866,7 +879,7 @@
*/
/*!
- \fn bool QWeakPointer::isNull() const
+ \fn template <class T> bool QWeakPointer<T>::isNull() const
Returns \c true if this object is holding a reference to a null
pointer.
@@ -878,7 +891,7 @@
*/
/*!
- \fn QWeakPointer::operator bool() const
+ \fn template <class T> QWeakPointer<T>::operator bool() const
Returns \c true if this object is not null. This function is suitable
for use in \tt if-constructs, like:
@@ -896,7 +909,7 @@
*/
/*!
- \fn bool QWeakPointer::operator !() const
+ \fn template <class T> bool QWeakPointer<T>::operator !() const
Returns \c true if this object is null. This function is suitable
for use in \tt if-constructs, like:
@@ -914,7 +927,7 @@
*/
/*!
- \fn T *QWeakPointer::data() const
+ \fn template <class T> T *QWeakPointer<T>::data() const
\since 4.6
Returns the value of the pointer being tracked by this QWeakPointer,
@@ -956,7 +969,7 @@
*/
/*!
- \fn QSharedPointer<T> QWeakPointer::toStrongRef() const
+ \fn template <class T> QSharedPointer<T> QWeakPointer<T>::toStrongRef() const
Promotes this weak reference to a strong one and returns a
QSharedPointer object holding that reference. When promoting to
@@ -989,7 +1002,7 @@
*/
/*!
- \fn QSharedPointer<T> QWeakPointer::lock() const
+ \fn template <class T> QSharedPointer<T> QWeakPointer<T>::lock() const
\since 5.4
Same as toStrongRef().
@@ -998,14 +1011,14 @@
*/
/*!
- \fn void QWeakPointer::clear()
+ \fn template <class T> void QWeakPointer<T>::clear()
Clears this QWeakPointer object, dropping the reference that it
may have had to the pointer.
*/
/*!
- \fn QSharedPointer<T> QEnableSharedFromThis::sharedFromThis()
+ \fn template <class T> QSharedPointer<T> QEnableSharedFromThis<T>::sharedFromThis()
\since 5.4
If \c this (that is, the subclass instance invoking this method) is being
@@ -1014,7 +1027,7 @@
*/
/*!
- \fn QSharedPointer<const T> QEnableSharedFromThis::sharedFromThis() const
+ \fn template <class T> QSharedPointer<const T> QEnableSharedFromThis<T>::sharedFromThis() const
\overload
\since 5.4
@@ -1022,7 +1035,7 @@
*/
/*!
- \fn bool operator==(const QSharedPointer<T> &ptr1, const QSharedPointer<X> &ptr2)
+ \fn template <class T> template <class X> bool operator==(const QSharedPointer<T> &ptr1, const QSharedPointer<X> &ptr2)
\relates QSharedPointer
Returns \c true if the pointer referenced by \a ptr1 is the
@@ -1036,7 +1049,7 @@
*/
/*!
- \fn bool operator!=(const QSharedPointer<T> &ptr1, const QSharedPointer<X> &ptr2)
+ \fn template <class T> template <class X> bool operator!=(const QSharedPointer<T> &ptr1, const QSharedPointer<X> &ptr2)
\relates QSharedPointer
Returns \c true if the pointer referenced by \a ptr1 is not the
@@ -1050,7 +1063,7 @@
*/
/*!
- \fn bool operator==(const QSharedPointer<T> &ptr1, const X *ptr2)
+ \fn template <class T> template <class X> bool operator==(const QSharedPointer<T> &ptr1, const X *ptr2)
\relates QSharedPointer
Returns \c true if the pointer referenced by \a ptr1 is the
@@ -1064,7 +1077,7 @@
*/
/*!
- \fn bool operator!=(const QSharedPointer<T> &ptr1, const X *ptr2)
+ \fn template <class T> template <class X> bool operator!=(const QSharedPointer<T> &ptr1, const X *ptr2)
\relates QSharedPointer
Returns \c true if the pointer referenced by \a ptr1 is not the
@@ -1078,7 +1091,7 @@
*/
/*!
- \fn bool operator==(const T *ptr1, const QSharedPointer<X> &ptr2)
+ \fn template <class T> template <class X> bool operator==(const T *ptr1, const QSharedPointer<X> &ptr2)
\relates QSharedPointer
Returns \c true if the pointer \a ptr1 is the
@@ -1092,7 +1105,7 @@
*/
/*!
- \fn bool operator!=(const T *ptr1, const QSharedPointer<X> &ptr2)
+ \fn template <class T> template <class X> bool operator!=(const T *ptr1, const QSharedPointer<X> &ptr2)
\relates QSharedPointer
Returns \c true if the pointer \a ptr1 is not the
@@ -1106,7 +1119,7 @@
*/
/*!
- \fn bool operator==(const QSharedPointer<T> &ptr1, const QWeakPointer<X> &ptr2)
+ \fn template <class T> template <class X> bool operator==(const QSharedPointer<T> &ptr1, const QWeakPointer<X> &ptr2)
\relates QWeakPointer
Returns \c true if the pointer referenced by \a ptr1 is the
@@ -1120,7 +1133,7 @@
*/
/*!
- \fn bool operator!=(const QSharedPointer<T> &ptr1, const QWeakPointer<X> &ptr2)
+ \fn template <class T> template <class X> bool operator!=(const QSharedPointer<T> &ptr1, const QWeakPointer<X> &ptr2)
\relates QWeakPointer
Returns \c true if the pointer referenced by \a ptr1 is not the
@@ -1134,7 +1147,7 @@
*/
/*!
- \fn bool operator==(const QWeakPointer<T> &ptr1, const QSharedPointer<X> &ptr2)
+ \fn template <class T> template <class X> bool operator==(const QWeakPointer<T> &ptr1, const QSharedPointer<X> &ptr2)
\relates QWeakPointer
Returns \c true if the pointer referenced by \a ptr1 is the
@@ -1148,7 +1161,7 @@
*/
/*!
- \fn bool operator==(const QSharedPointer<T> &lhs, std::nullptr_t)
+ \fn template <class T> bool operator==(const QSharedPointer<T> &lhs, std::nullptr_t)
\relates QSharedPointer
\since 5.8
@@ -1158,7 +1171,7 @@
*/
/*!
- \fn bool operator==(std::nullptr_t, const QSharedPointer<T> &rhs)
+ \fn template <class T> bool operator==(std::nullptr_t, const QSharedPointer<T> &rhs)
\relates QSharedPointer
\since 5.8
@@ -1168,7 +1181,7 @@
*/
/*!
- \fn bool operator!=(const QSharedPointer<T> &lhs, std::nullptr_t)
+ \fn template <class T> bool operator!=(const QSharedPointer<T> &lhs, std::nullptr_t)
\relates QSharedPointer
\since 5.8
@@ -1179,7 +1192,7 @@
*/
/*!
- \fn bool operator!=(std::nullptr_t, const QSharedPointer<T> &rhs)
+ \fn template <class T> bool operator!=(std::nullptr_t, const QSharedPointer<T> &rhs)
\relates QSharedPointer
\since 5.8
@@ -1190,7 +1203,7 @@
*/
/*!
- \fn bool operator==(const QWeakPointer<T> &lhs, std::nullptr_t)
+ \fn template <class T> bool operator==(const QWeakPointer<T> &lhs, std::nullptr_t)
\relates QWeakPointer
\since 5.8
@@ -1200,7 +1213,7 @@
*/
/*!
- \fn bool operator==(std::nullptr_t, const QWeakPointer<T> &rhs)
+ \fn template <class T> bool operator==(std::nullptr_t, const QWeakPointer<T> &rhs)
\relates QWeakPointer
\since 5.8
@@ -1210,7 +1223,7 @@
*/
/*!
- \fn bool operator!=(const QWeakPointer<T> &lhs, std::nullptr_t)
+ \fn template <class T> bool operator!=(const QWeakPointer<T> &lhs, std::nullptr_t)
\relates QWeakPointer
\since 5.8
@@ -1221,7 +1234,7 @@
*/
/*!
- \fn bool operator!=(std::nullptr_t, const QWeakPointer<T> &rhs)
+ \fn template <class T> bool operator!=(std::nullptr_t, const QWeakPointer<T> &rhs)
\relates QWeakPointer
\since 5.8
@@ -1232,7 +1245,7 @@
*/
/*!
- \fn bool operator!=(const QWeakPointer<T> &ptr1, const QSharedPointer<X> &ptr2)
+ \fn template <class T> template <class X> bool operator!=(const QWeakPointer<T> &ptr1, const QSharedPointer<X> &ptr2)
\relates QWeakPointer
Returns \c true if the pointer referenced by \a ptr1 is not the
@@ -1246,7 +1259,7 @@
*/
/*!
- \fn QSharedPointer<X> qSharedPointerCast(const QSharedPointer<T> &other)
+ \fn template <class X> template <class T> QSharedPointer<X> qSharedPointerCast(const QSharedPointer<T> &other)
\relates QSharedPointer
Returns a shared pointer to the pointer held by \a other, cast to
@@ -1261,7 +1274,7 @@
*/
/*!
- \fn QSharedPointer<X> qSharedPointerCast(const QWeakPointer<T> &other)
+ \fn template <class X> template <class T> QSharedPointer<X> qSharedPointerCast(const QWeakPointer<T> &other)
\relates QSharedPointer
\relates QWeakPointer
@@ -1282,10 +1295,10 @@
*/
/*!
- \fn QSharedPointer<X> qSharedPointerDynamicCast(const QSharedPointer<T> &other)
+ \fn template <class X> template <class T> QSharedPointer<X> qSharedPointerDynamicCast(const QSharedPointer<T> &src)
\relates QSharedPointer
- Returns a shared pointer to the pointer held by \a other, using a
+ Returns a shared pointer to the pointer held by \a src, using a
dynamic cast to type \tt X to obtain an internal pointer of the
appropriate type. If the \tt dynamic_cast fails, the object
returned will be null.
@@ -1298,16 +1311,16 @@
*/
/*!
- \fn QSharedPointer<X> qSharedPointerDynamicCast(const QWeakPointer<T> &other)
+ \fn template <class X> template <class T> QSharedPointer<X> qSharedPointerDynamicCast(const QWeakPointer<T> &src)
\relates QSharedPointer
\relates QWeakPointer
- Returns a shared pointer to the pointer held by \a other, using a
+ Returns a shared pointer to the pointer held by \a src, using a
dynamic cast to type \tt X to obtain an internal pointer of the
appropriate type. If the \tt dynamic_cast fails, the object
returned will be null.
- The \a other object is converted first to a strong reference. If
+ The \a src object is converted first to a strong reference. If
that conversion fails (because the object it's pointing to has
already been deleted), this function also returns a null
QSharedPointer.
@@ -1320,10 +1333,10 @@
*/
/*!
- \fn QSharedPointer<X> qSharedPointerConstCast(const QSharedPointer<T> &other)
+ \fn template <class X> template <class T> QSharedPointer<X> qSharedPointerConstCast(const QSharedPointer<T> &src)
\relates QSharedPointer
- Returns a shared pointer to the pointer held by \a other, cast to
+ Returns a shared pointer to the pointer held by \a src, cast to
type \tt X. The types \tt T and \tt X must belong to one
hierarchy for the \tt const_cast to succeed. The \tt const and \tt
volatile differences between \tt T and \tt X are ignored.
@@ -1332,16 +1345,16 @@
*/
/*!
- \fn QSharedPointer<X> qSharedPointerConstCast(const QWeakPointer<T> &other)
+ \fn template <class X> template <class T> QSharedPointer<X> qSharedPointerConstCast(const QWeakPointer<T> &src)
\relates QSharedPointer
\relates QWeakPointer
- Returns a shared pointer to the pointer held by \a other, cast to
+ Returns a shared pointer to the pointer held by \a src, cast to
type \tt X. The types \tt T and \tt X must belong to one
hierarchy for the \tt const_cast to succeed. The \tt const and
\tt volatile differences between \tt T and \tt X are ignored.
- The \a other object is converted first to a strong reference. If
+ The \a src object is converted first to a strong reference. If
that conversion fails (because the object it's pointing to has
already been deleted), this function returns a null
QSharedPointer.
@@ -1350,13 +1363,13 @@
*/
/*!
- \fn QSharedPointer<X> qSharedPointerObjectCast(const QSharedPointer<T> &other)
+ \fn template <class X> template <class T> QSharedPointer<X> qSharedPointerObjectCast(const QSharedPointer<T> &src)
\relates QSharedPointer
\since 4.6
\brief The qSharedPointerObjectCast function is for casting a shared pointer.
- Returns a shared pointer to the pointer held by \a other, using a
+ Returns a shared pointer to the pointer held by \a src, using a
\l qobject_cast() to type \tt X to obtain an internal pointer of the
appropriate type. If the \tt qobject_cast fails, the object
returned will be null.
@@ -1369,19 +1382,19 @@
*/
/*!
- \fn QSharedPointer<X> qSharedPointerObjectCast(const QWeakPointer<T> &other)
+ \fn template <class X> template <class T> QSharedPointer<X> qSharedPointerObjectCast(const QWeakPointer<T> &src)
\relates QSharedPointer
\relates QWeakPointer
\since 4.6
\brief The qSharedPointerObjectCast function is for casting a shared pointer.
- Returns a shared pointer to the pointer held by \a other, using a
+ Returns a shared pointer to the pointer held by \a src, using a
\l qobject_cast() to type \tt X to obtain an internal pointer of the
appropriate type. If the \tt qobject_cast fails, the object
returned will be null.
- The \a other object is converted first to a strong reference. If
+ The \a src object is converted first to a strong reference. If
that conversion fails (because the object it's pointing to has
already been deleted), this function also returns a null
QSharedPointer.
@@ -1395,10 +1408,10 @@
/*!
- \fn QWeakPointer<X> qWeakPointerCast(const QWeakPointer<T> &other)
+ \fn template <class X> template <class T> QWeakPointer<X> qWeakPointerCast(const QWeakPointer<T> &src)
\relates QWeakPointer
- Returns a weak pointer to the pointer held by \a other, cast to
+ Returns a weak pointer to the pointer held by \a src, cast to
type \tt X. The types \tt T and \tt X must belong to one
hierarchy for the \tt static_cast to succeed.
diff --git a/src/corelib/tools/qsharedpointer.h b/src/corelib/tools/qsharedpointer.h
index 3b86eb238b..98b38b97d3 100644
--- a/src/corelib/tools/qsharedpointer.h
+++ b/src/corelib/tools/qsharedpointer.h
@@ -59,6 +59,7 @@ class QSharedPointer
public:
// basic accessor functions
T *data() const;
+ T *get() const;
bool isNull() const;
operator bool() const;
bool operator!() const;
diff --git a/src/corelib/tools/qsharedpointer_impl.h b/src/corelib/tools/qsharedpointer_impl.h
index ede54c155d..a0e408b94a 100644
--- a/src/corelib/tools/qsharedpointer_impl.h
+++ b/src/corelib/tools/qsharedpointer_impl.h
@@ -303,8 +303,9 @@ public:
typedef qptrdiff difference_type;
T *data() const Q_DECL_NOTHROW { return value; }
+ T *get() const Q_DECL_NOTHROW { return value; }
bool isNull() const Q_DECL_NOTHROW { return !data(); }
- operator RestrictedBool() const Q_DECL_NOTHROW { return isNull() ? Q_NULLPTR : &QSharedPointer::value; }
+ operator RestrictedBool() const Q_DECL_NOTHROW { return isNull() ? nullptr : &QSharedPointer::value; }
bool operator !() const Q_DECL_NOTHROW { return isNull(); }
T &operator*() const { return *data(); }
T *operator->() const Q_DECL_NOTHROW { return data(); }
@@ -337,8 +338,8 @@ public:
QSharedPointer(QSharedPointer &&other) Q_DECL_NOTHROW
: value(other.value), d(other.d)
{
- other.d = Q_NULLPTR;
- other.value = Q_NULLPTR;
+ other.d = nullptr;
+ other.value = nullptr;
}
QSharedPointer &operator=(QSharedPointer &&other) Q_DECL_NOTHROW
{
@@ -351,8 +352,8 @@ public:
QSharedPointer(QSharedPointer<X> &&other) Q_DECL_NOTHROW
: value(other.value), d(other.d)
{
- other.d = Q_NULLPTR;
- other.value = Q_NULLPTR;
+ other.d = nullptr;
+ other.value = nullptr;
}
template <class X>
@@ -378,7 +379,7 @@ public:
}
template <class X>
- inline QSharedPointer(const QWeakPointer<X> &other) : value(Q_NULLPTR), d(Q_NULLPTR)
+ inline QSharedPointer(const QWeakPointer<X> &other) : value(nullptr), d(nullptr)
{ *this = other; }
template <class X>
@@ -476,7 +477,7 @@ private:
inline void internalConstruct(X *ptr, Deleter deleter)
{
if (!ptr) {
- d = Q_NULLPTR;
+ d = nullptr;
return;
}
@@ -527,14 +528,14 @@ public:
o->weakref.ref();
} else {
o->checkQObjectShared(actual);
- o = Q_NULLPTR;
+ o = nullptr;
}
}
qSwap(d, o);
qSwap(this->value, actual);
if (!d || d->strongref.load() == 0)
- this->value = Q_NULLPTR;
+ this->value = nullptr;
// dereference saved data
deref(o);
@@ -559,19 +560,19 @@ public:
typedef const value_type &const_reference;
typedef qptrdiff difference_type;
- bool isNull() const Q_DECL_NOTHROW { return d == Q_NULLPTR || d->strongref.load() == 0 || value == Q_NULLPTR; }
- operator RestrictedBool() const Q_DECL_NOTHROW { return isNull() ? Q_NULLPTR : &QWeakPointer::value; }
+ bool isNull() const Q_DECL_NOTHROW { return d == nullptr || d->strongref.load() == 0 || value == nullptr; }
+ operator RestrictedBool() const Q_DECL_NOTHROW { return isNull() ? nullptr : &QWeakPointer::value; }
bool operator !() const Q_DECL_NOTHROW { return isNull(); }
- T *data() const Q_DECL_NOTHROW { return d == Q_NULLPTR || d->strongref.load() == 0 ? Q_NULLPTR : value; }
+ T *data() const Q_DECL_NOTHROW { return d == nullptr || d->strongref.load() == 0 ? nullptr : value; }
- inline QWeakPointer() Q_DECL_NOTHROW : d(Q_NULLPTR), value(Q_NULLPTR) { }
+ inline QWeakPointer() Q_DECL_NOTHROW : d(nullptr), value(nullptr) { }
inline ~QWeakPointer() { if (d && !d->weakref.deref()) delete d; }
#ifndef QT_NO_QOBJECT
// special constructor that is enabled only if X derives from QObject
#if QT_DEPRECATED_SINCE(5, 0)
template <class X>
- QT_DEPRECATED inline QWeakPointer(X *ptr) : d(ptr ? Data::getAndRef(ptr) : Q_NULLPTR), value(ptr)
+ QT_DEPRECATED inline QWeakPointer(X *ptr) : d(ptr ? Data::getAndRef(ptr) : nullptr), value(ptr)
{ }
#endif
#endif
@@ -588,8 +589,8 @@ public:
QWeakPointer(QWeakPointer &&other) Q_DECL_NOTHROW
: d(other.d), value(other.value)
{
- other.d = Q_NULLPTR;
- other.value = Q_NULLPTR;
+ other.d = nullptr;
+ other.value = nullptr;
}
QWeakPointer &operator=(QWeakPointer &&other) Q_DECL_NOTHROW
{ QWeakPointer moved(std::move(other)); swap(moved); return *this; }
@@ -616,7 +617,7 @@ public:
}
template <class X>
- inline QWeakPointer(const QWeakPointer<X> &o) : d(Q_NULLPTR), value(Q_NULLPTR)
+ inline QWeakPointer(const QWeakPointer<X> &o) : d(nullptr), value(nullptr)
{ *this = o; }
template <class X>
@@ -637,7 +638,7 @@ public:
{ return !(*this == o); }
template <class X>
- inline QWeakPointer(const QSharedPointer<X> &o) : d(Q_NULLPTR), value(Q_NULLPTR)
+ inline QWeakPointer(const QSharedPointer<X> &o) : d(nullptr), value(nullptr)
{ *this = o; }
template <class X>
@@ -681,7 +682,7 @@ public:
#ifndef QT_NO_QOBJECT
template <class X>
- inline QWeakPointer(X *ptr, bool) : d(ptr ? Data::getAndRef(ptr) : Q_NULLPTR), value(ptr)
+ inline QWeakPointer(X *ptr, bool) : d(ptr ? Data::getAndRef(ptr) : nullptr), value(ptr)
{ }
#endif
diff --git a/src/corelib/tools/qsimd_p.h b/src/corelib/tools/qsimd_p.h
index 181da4f7de..fafc3e37b0 100644
--- a/src/corelib/tools/qsimd_p.h
+++ b/src/corelib/tools/qsimd_p.h
@@ -53,7 +53,6 @@
//
#include <QtCore/private/qglobal_p.h>
-#include <qatomic.h>
/*
* qt_module_config.prf defines the QT_COMPILER_SUPPORTS_XXX macros.
@@ -165,11 +164,7 @@
# if !defined(__MIPS_DSPR2__) && defined(__mips_dspr2) && defined(Q_PROCESSOR_MIPS_32)
# define __MIPS_DSPR2__
# endif
-#elif (defined(Q_CC_INTEL) || defined(Q_CC_MSVC) \
- || (defined(Q_CC_GNU) && !defined(Q_CC_CLANG) && Q_CC_GNU >= 409) \
- || (defined(Q_CC_CLANG) && Q_CC_CLANG >= 308)) \
- && !defined(QT_BOOTSTRAPPED)
-# define QT_COMPILER_SUPPORTS_SIMD_ALWAYS
+#elif defined(Q_PROCESSOR_X86) && defined(QT_COMPILER_SUPPORTS_SIMD_ALWAYS)
# define QT_COMPILER_SUPPORTS_HERE(x) ((__ ## x ## __) || QT_COMPILER_SUPPORTS(x))
# if defined(Q_CC_GNU) && !defined(Q_CC_INTEL)
/* GCC requires attributes for a function */
@@ -333,8 +328,10 @@
# include <arm_acle.h>
#endif
-QT_BEGIN_NAMESPACE
+#ifdef __cplusplus
+#include <qatomic.h>
+QT_BEGIN_NAMESPACE
enum CPUFeatures {
#if defined(Q_PROCESSOR_ARM)
@@ -512,9 +509,11 @@ static inline quint64 qCpuFeatures()
#define ALIGNMENT_PROLOGUE_32BYTES(ptr, i, length) \
for (; i < static_cast<int>(qMin(static_cast<quintptr>(length), ((8 - ((reinterpret_cast<quintptr>(ptr) >> 2) & 0x7)) & 0x7))); ++i)
+QT_END_NAMESPACE
+
+#endif // __cplusplus
+
#define SIMD_EPILOGUE(i, length, max) \
for (int _i = 0; _i < max && i < length; ++i, ++_i)
-QT_END_NAMESPACE
-
#endif // QSIMD_P_H
diff --git a/src/corelib/tools/qstring.cpp b/src/corelib/tools/qstring.cpp
index e63f1ce253..8093a26f7d 100644
--- a/src/corelib/tools/qstring.cpp
+++ b/src/corelib/tools/qstring.cpp
@@ -4056,7 +4056,7 @@ int QString::count(const QRegExp& rx) const
*/
int QString::indexOf(const QRegularExpression& re, int from) const
{
- return indexOf(re, from, Q_NULLPTR);
+ return indexOf(re, from, nullptr);
}
/*!
@@ -4107,7 +4107,7 @@ int QString::indexOf(const QRegularExpression &re, int from, QRegularExpressionM
*/
int QString::lastIndexOf(const QRegularExpression &re, int from) const
{
- return lastIndexOf(re, from, Q_NULLPTR);
+ return lastIndexOf(re, from, nullptr);
}
/*!
@@ -4159,7 +4159,7 @@ int QString::lastIndexOf(const QRegularExpression &re, int from, QRegularExpress
*/
bool QString::contains(const QRegularExpression &re) const
{
- return contains(re, Q_NULLPTR);
+ return contains(re, nullptr);
}
/*!
diff --git a/src/corelib/tools/qstring.h b/src/corelib/tools/qstring.h
index fe7e9b050b..af1513442a 100644
--- a/src/corelib/tools/qstring.h
+++ b/src/corelib/tools/qstring.h
@@ -91,7 +91,7 @@ template <typename T> class QVector;
class QLatin1String
{
public:
- Q_DECL_CONSTEXPR inline QLatin1String() Q_DECL_NOTHROW : m_size(0), m_data(Q_NULLPTR) {}
+ Q_DECL_CONSTEXPR inline QLatin1String() Q_DECL_NOTHROW : m_size(0), m_data(nullptr) {}
Q_DECL_CONSTEXPR inline explicit QLatin1String(const char *s) Q_DECL_NOTHROW : m_size(s ? int(strlen(s)) : 0), m_data(s) {}
Q_DECL_CONSTEXPR explicit QLatin1String(const char *f, const char *l)
: QLatin1String(f, int(l - f)) {}
@@ -624,16 +624,16 @@ public:
static int localeAwareCompare(const QString& s1, const QStringRef& s2);
// ### Qt6: make inline except for the long long versions
- short toShort(bool *ok=Q_NULLPTR, int base=10) const;
- ushort toUShort(bool *ok=Q_NULLPTR, int base=10) const;
- int toInt(bool *ok=Q_NULLPTR, int base=10) const;
- uint toUInt(bool *ok=Q_NULLPTR, int base=10) const;
- long toLong(bool *ok=Q_NULLPTR, int base=10) const;
- ulong toULong(bool *ok=Q_NULLPTR, int base=10) const;
- qlonglong toLongLong(bool *ok=Q_NULLPTR, int base=10) const;
- qulonglong toULongLong(bool *ok=Q_NULLPTR, int base=10) const;
- float toFloat(bool *ok=Q_NULLPTR) const;
- double toDouble(bool *ok=Q_NULLPTR) const;
+ short toShort(bool *ok=nullptr, int base=10) const;
+ ushort toUShort(bool *ok=nullptr, int base=10) const;
+ int toInt(bool *ok=nullptr, int base=10) const;
+ uint toUInt(bool *ok=nullptr, int base=10) const;
+ long toLong(bool *ok=nullptr, int base=10) const;
+ ulong toULong(bool *ok=nullptr, int base=10) const;
+ qlonglong toLongLong(bool *ok=nullptr, int base=10) const;
+ qulonglong toULongLong(bool *ok=nullptr, int base=10) const;
+ float toFloat(bool *ok=nullptr) const;
+ double toDouble(bool *ok=nullptr) const;
QString &setNum(short, int base=10);
QString &setNum(ushort, int base=10);
@@ -675,8 +675,12 @@ public:
: d(fromAscii_helper(ch, N - 1))
{}
template <int N>
+ QString(char (&)[N]) = delete;
+ template <int N>
inline QString &operator=(const char (&ch)[N])
{ return (*this = fromUtf8(ch, N - 1)); }
+ template <int N>
+ QString &operator=(char (&)[N]) = delete;
#endif
#if !defined(QT_NO_CAST_FROM_ASCII) && !defined(QT_RESTRICTED_CAST_FROM_ASCII)
inline QT_ASCII_CAST_WARN QString(const char *ch)
@@ -1417,7 +1421,7 @@ public:
typedef QString::const_reference const_reference;
// ### Qt 6: make this constructor constexpr, after the destructor is made trivial
- inline QStringRef() : m_string(Q_NULLPTR), m_position(0), m_size(0) {}
+ inline QStringRef() : m_string(nullptr), m_position(0), m_size(0) {}
inline QStringRef(const QString *string, int position, int size);
inline QStringRef(const QString *string);
@@ -1533,10 +1537,10 @@ public:
Q_REQUIRED_RESULT QByteArray toLocal8Bit() const;
Q_REQUIRED_RESULT QVector<uint> toUcs4() const;
- inline void clear() { m_string = Q_NULLPTR; m_position = m_size = 0; }
+ inline void clear() { m_string = nullptr; m_position = m_size = 0; }
QString toString() const;
inline bool isEmpty() const { return m_size == 0; }
- inline bool isNull() const { return m_string == Q_NULLPTR || m_string->isNull(); }
+ inline bool isNull() const { return m_string == nullptr || m_string->isNull(); }
QStringRef appendTo(QString *string) const;
@@ -1576,16 +1580,16 @@ public:
static int localeAwareCompare(const QStringRef &s1, const QStringRef &s2);
Q_REQUIRED_RESULT QStringRef trimmed() const;
- short toShort(bool *ok = Q_NULLPTR, int base = 10) const;
- ushort toUShort(bool *ok = Q_NULLPTR, int base = 10) const;
- int toInt(bool *ok = Q_NULLPTR, int base = 10) const;
- uint toUInt(bool *ok = Q_NULLPTR, int base = 10) const;
- long toLong(bool *ok = Q_NULLPTR, int base = 10) const;
- ulong toULong(bool *ok = Q_NULLPTR, int base = 10) const;
- qlonglong toLongLong(bool *ok = Q_NULLPTR, int base = 10) const;
- qulonglong toULongLong(bool *ok = Q_NULLPTR, int base = 10) const;
- float toFloat(bool *ok = Q_NULLPTR) const;
- double toDouble(bool *ok = Q_NULLPTR) const;
+ short toShort(bool *ok = nullptr, int base = 10) const;
+ ushort toUShort(bool *ok = nullptr, int base = 10) const;
+ int toInt(bool *ok = nullptr, int base = 10) const;
+ uint toUInt(bool *ok = nullptr, int base = 10) const;
+ long toLong(bool *ok = nullptr, int base = 10) const;
+ ulong toULong(bool *ok = nullptr, int base = 10) const;
+ qlonglong toLongLong(bool *ok = nullptr, int base = 10) const;
+ qulonglong toULongLong(bool *ok = nullptr, int base = 10) const;
+ float toFloat(bool *ok = nullptr) const;
+ double toDouble(bool *ok = nullptr) const;
};
Q_DECLARE_TYPEINFO(QStringRef, Q_PRIMITIVE_TYPE);
diff --git a/src/corelib/tools/qtextboundaryfinder.h b/src/corelib/tools/qtextboundaryfinder.h
index d021df3f2c..b1e5008f54 100644
--- a/src/corelib/tools/qtextboundaryfinder.h
+++ b/src/corelib/tools/qtextboundaryfinder.h
@@ -74,7 +74,7 @@ public:
Q_DECLARE_FLAGS( BoundaryReasons, BoundaryReason )
QTextBoundaryFinder(BoundaryType type, const QString &string);
- QTextBoundaryFinder(BoundaryType type, const QChar *chars, int length, unsigned char *buffer = Q_NULLPTR, int bufferSize = 0);
+ QTextBoundaryFinder(BoundaryType type, const QChar *chars, int length, unsigned char *buffer = nullptr, int bufferSize = 0);
inline bool isValid() const { return d; }
diff --git a/src/corelib/tools/qtimeline.h b/src/corelib/tools/qtimeline.h
index f0e9a32e4d..d9982bdb58 100644
--- a/src/corelib/tools/qtimeline.h
+++ b/src/corelib/tools/qtimeline.h
@@ -76,7 +76,7 @@ public:
CosineCurve
};
- explicit QTimeLine(int duration = 1000, QObject *parent = Q_NULLPTR);
+ explicit QTimeLine(int duration = 1000, QObject *parent = nullptr);
virtual ~QTimeLine();
State state() const;
@@ -127,7 +127,7 @@ Q_SIGNALS:
void finished(QPrivateSignal);
protected:
- void timerEvent(QTimerEvent *event) Q_DECL_OVERRIDE;
+ void timerEvent(QTimerEvent *event) override;
private:
Q_DISABLE_COPY(QTimeLine)
diff --git a/src/corelib/tools/qtimezoneprivate.cpp b/src/corelib/tools/qtimezoneprivate.cpp
index e45dd48de0..1a5135f103 100644
--- a/src/corelib/tools/qtimezoneprivate.cpp
+++ b/src/corelib/tools/qtimezoneprivate.cpp
@@ -329,7 +329,7 @@ QTimeZonePrivate::Data QTimeZonePrivate::dataForLocalTime(qint64 forLocalMSecs,
// Only around the transition times might we need another.
Data tran = previousTransition(forLocalMSecs - sixteenHoursInMSecs);
Q_ASSERT(forLocalMSecs < 0 || // Pre-epoch TZ info may be unavailable
- forLocalMSecs >= tran.atMSecsSinceEpoch + tran.offsetFromUtc * 1000);
+ forLocalMSecs - tran.offsetFromUtc * 1000 >= tran.atMSecsSinceEpoch);
Data nextTran = nextTransition(tran.atMSecsSinceEpoch);
/*
Now walk those forward until they bracket forLocalMSecs with transitions.
@@ -363,7 +363,7 @@ QTimeZonePrivate::Data QTimeZonePrivate::dataForLocalTime(qint64 forLocalMSecs,
fail life's tricky.
*/
Q_ASSERT(forLocalMSecs < 0
- || forLocalMSecs > tran.atMSecsSinceEpoch + tran.offsetFromUtc * 1000);
+ || forLocalMSecs - tran.offsetFromUtc * 1000 > tran.atMSecsSinceEpoch);
const qint64 nextStart = nextTran.atMSecsSinceEpoch;
// Work out the UTC values it might make sense to return:
nextTran.atMSecsSinceEpoch = forLocalMSecs - nextTran.offsetFromUtc * 1000;
diff --git a/src/corelib/tools/qtimezoneprivate_p.h b/src/corelib/tools/qtimezoneprivate_p.h
index 74b79dce16..ca36f9d297 100644
--- a/src/corelib/tools/qtimezoneprivate_p.h
+++ b/src/corelib/tools/qtimezoneprivate_p.h
@@ -171,7 +171,7 @@ Q_DECLARE_TYPEINFO(QTimeZonePrivate::Data, Q_MOVABLE_TYPE);
template<> QTimeZonePrivate *QSharedDataPointer<QTimeZonePrivate>::clone();
-class Q_AUTOTEST_EXPORT QUtcTimeZonePrivate Q_DECL_FINAL : public QTimeZonePrivate
+class Q_AUTOTEST_EXPORT QUtcTimeZonePrivate final : public QTimeZonePrivate
{
public:
// Create default UTC time zone
@@ -189,26 +189,26 @@ public:
QUtcTimeZonePrivate *clone() const override;
- Data data(qint64 forMSecsSinceEpoch) const Q_DECL_OVERRIDE;
+ Data data(qint64 forMSecsSinceEpoch) const override;
- QLocale::Country country() const Q_DECL_OVERRIDE;
- QString comment() const Q_DECL_OVERRIDE;
+ QLocale::Country country() const override;
+ QString comment() const override;
QString displayName(QTimeZone::TimeType timeType,
QTimeZone::NameType nameType,
- const QLocale &locale) const Q_DECL_OVERRIDE;
- QString abbreviation(qint64 atMSecsSinceEpoch) const Q_DECL_OVERRIDE;
+ const QLocale &locale) const override;
+ QString abbreviation(qint64 atMSecsSinceEpoch) const override;
- int standardTimeOffset(qint64 atMSecsSinceEpoch) const Q_DECL_OVERRIDE;
- int daylightTimeOffset(qint64 atMSecsSinceEpoch) const Q_DECL_OVERRIDE;
+ int standardTimeOffset(qint64 atMSecsSinceEpoch) const override;
+ int daylightTimeOffset(qint64 atMSecsSinceEpoch) const override;
- QByteArray systemTimeZoneId() const Q_DECL_OVERRIDE;
+ QByteArray systemTimeZoneId() const override;
- QList<QByteArray> availableTimeZoneIds() const Q_DECL_OVERRIDE;
- QList<QByteArray> availableTimeZoneIds(QLocale::Country country) const Q_DECL_OVERRIDE;
- QList<QByteArray> availableTimeZoneIds(int utcOffset) const Q_DECL_OVERRIDE;
+ QList<QByteArray> availableTimeZoneIds() const override;
+ QList<QByteArray> availableTimeZoneIds(QLocale::Country country) const override;
+ QList<QByteArray> availableTimeZoneIds(int utcOffset) const override;
- void serialize(QDataStream &ds) const Q_DECL_OVERRIDE;
+ void serialize(QDataStream &ds) const override;
private:
void init(const QByteArray &zoneId);
@@ -224,7 +224,7 @@ private:
};
#if QT_CONFIG(icu)
-class Q_AUTOTEST_EXPORT QIcuTimeZonePrivate Q_DECL_FINAL : public QTimeZonePrivate
+class Q_AUTOTEST_EXPORT QIcuTimeZonePrivate final : public QTimeZonePrivate
{
public:
// Create default time zone
@@ -237,27 +237,27 @@ public:
QIcuTimeZonePrivate *clone() const override;
QString displayName(QTimeZone::TimeType timeType, QTimeZone::NameType nameType,
- const QLocale &locale) const Q_DECL_OVERRIDE;
- QString abbreviation(qint64 atMSecsSinceEpoch) const Q_DECL_OVERRIDE;
+ const QLocale &locale) const override;
+ QString abbreviation(qint64 atMSecsSinceEpoch) const override;
- int offsetFromUtc(qint64 atMSecsSinceEpoch) const Q_DECL_OVERRIDE;
- int standardTimeOffset(qint64 atMSecsSinceEpoch) const Q_DECL_OVERRIDE;
- int daylightTimeOffset(qint64 atMSecsSinceEpoch) const Q_DECL_OVERRIDE;
+ int offsetFromUtc(qint64 atMSecsSinceEpoch) const override;
+ int standardTimeOffset(qint64 atMSecsSinceEpoch) const override;
+ int daylightTimeOffset(qint64 atMSecsSinceEpoch) const override;
- bool hasDaylightTime() const Q_DECL_OVERRIDE;
- bool isDaylightTime(qint64 atMSecsSinceEpoch) const Q_DECL_OVERRIDE;
+ bool hasDaylightTime() const override;
+ bool isDaylightTime(qint64 atMSecsSinceEpoch) const override;
- Data data(qint64 forMSecsSinceEpoch) const Q_DECL_OVERRIDE;
+ Data data(qint64 forMSecsSinceEpoch) const override;
- bool hasTransitions() const Q_DECL_OVERRIDE;
- Data nextTransition(qint64 afterMSecsSinceEpoch) const Q_DECL_OVERRIDE;
- Data previousTransition(qint64 beforeMSecsSinceEpoch) const Q_DECL_OVERRIDE;
+ bool hasTransitions() const override;
+ Data nextTransition(qint64 afterMSecsSinceEpoch) const override;
+ Data previousTransition(qint64 beforeMSecsSinceEpoch) const override;
- QByteArray systemTimeZoneId() const Q_DECL_OVERRIDE;
+ QByteArray systemTimeZoneId() const override;
- QList<QByteArray> availableTimeZoneIds() const Q_DECL_OVERRIDE;
- QList<QByteArray> availableTimeZoneIds(QLocale::Country country) const Q_DECL_OVERRIDE;
- QList<QByteArray> availableTimeZoneIds(int offsetFromUtc) const Q_DECL_OVERRIDE;
+ QList<QByteArray> availableTimeZoneIds() const override;
+ QList<QByteArray> availableTimeZoneIds(QLocale::Country country) const override;
+ QList<QByteArray> availableTimeZoneIds(int offsetFromUtc) const override;
private:
void init(const QByteArray &ianaId);
@@ -285,7 +285,7 @@ Q_DECL_CONSTEXPR inline bool operator==(const QTzTransitionRule &lhs, const QTzT
Q_DECL_CONSTEXPR inline bool operator!=(const QTzTransitionRule &lhs, const QTzTransitionRule &rhs) Q_DECL_NOTHROW
{ return !operator==(lhs, rhs); }
-class Q_AUTOTEST_EXPORT QTzTimeZonePrivate Q_DECL_FINAL : public QTimeZonePrivate
+class Q_AUTOTEST_EXPORT QTzTimeZonePrivate final : public QTimeZonePrivate
{
QTzTimeZonePrivate(const QTzTimeZonePrivate &) = default;
public:
@@ -297,34 +297,34 @@ public:
QTzTimeZonePrivate *clone() const override;
- QLocale::Country country() const Q_DECL_OVERRIDE;
- QString comment() const Q_DECL_OVERRIDE;
+ QLocale::Country country() const override;
+ QString comment() const override;
QString displayName(qint64 atMSecsSinceEpoch,
QTimeZone::NameType nameType,
- const QLocale &locale) const Q_DECL_OVERRIDE;
+ const QLocale &locale) const override;
QString displayName(QTimeZone::TimeType timeType,
QTimeZone::NameType nameType,
- const QLocale &locale) const Q_DECL_OVERRIDE;
- QString abbreviation(qint64 atMSecsSinceEpoch) const Q_DECL_OVERRIDE;
+ const QLocale &locale) const override;
+ QString abbreviation(qint64 atMSecsSinceEpoch) const override;
- int offsetFromUtc(qint64 atMSecsSinceEpoch) const Q_DECL_OVERRIDE;
- int standardTimeOffset(qint64 atMSecsSinceEpoch) const Q_DECL_OVERRIDE;
- int daylightTimeOffset(qint64 atMSecsSinceEpoch) const Q_DECL_OVERRIDE;
+ int offsetFromUtc(qint64 atMSecsSinceEpoch) const override;
+ int standardTimeOffset(qint64 atMSecsSinceEpoch) const override;
+ int daylightTimeOffset(qint64 atMSecsSinceEpoch) const override;
- bool hasDaylightTime() const Q_DECL_OVERRIDE;
- bool isDaylightTime(qint64 atMSecsSinceEpoch) const Q_DECL_OVERRIDE;
+ bool hasDaylightTime() const override;
+ bool isDaylightTime(qint64 atMSecsSinceEpoch) const override;
- Data data(qint64 forMSecsSinceEpoch) const Q_DECL_OVERRIDE;
+ Data data(qint64 forMSecsSinceEpoch) const override;
- bool hasTransitions() const Q_DECL_OVERRIDE;
- Data nextTransition(qint64 afterMSecsSinceEpoch) const Q_DECL_OVERRIDE;
- Data previousTransition(qint64 beforeMSecsSinceEpoch) const Q_DECL_OVERRIDE;
+ bool hasTransitions() const override;
+ Data nextTransition(qint64 afterMSecsSinceEpoch) const override;
+ Data previousTransition(qint64 beforeMSecsSinceEpoch) const override;
- QByteArray systemTimeZoneId() const Q_DECL_OVERRIDE;
+ QByteArray systemTimeZoneId() const override;
- QList<QByteArray> availableTimeZoneIds() const Q_DECL_OVERRIDE;
- QList<QByteArray> availableTimeZoneIds(QLocale::Country country) const Q_DECL_OVERRIDE;
+ QList<QByteArray> availableTimeZoneIds() const override;
+ QList<QByteArray> availableTimeZoneIds(QLocale::Country country) const override;
private:
void init(const QByteArray &ianaId);
@@ -341,7 +341,7 @@ private:
#endif // Q_OS_UNIX
#ifdef Q_OS_MAC
-class Q_AUTOTEST_EXPORT QMacTimeZonePrivate Q_DECL_FINAL : public QTimeZonePrivate
+class Q_AUTOTEST_EXPORT QMacTimeZonePrivate final : public QTimeZonePrivate
{
public:
// Create default time zone
@@ -353,28 +353,28 @@ public:
QMacTimeZonePrivate *clone() const override;
- QString comment() const Q_DECL_OVERRIDE;
+ QString comment() const override;
QString displayName(QTimeZone::TimeType timeType, QTimeZone::NameType nameType,
- const QLocale &locale) const Q_DECL_OVERRIDE;
- QString abbreviation(qint64 atMSecsSinceEpoch) const Q_DECL_OVERRIDE;
+ const QLocale &locale) const override;
+ QString abbreviation(qint64 atMSecsSinceEpoch) const override;
- int offsetFromUtc(qint64 atMSecsSinceEpoch) const Q_DECL_OVERRIDE;
- int standardTimeOffset(qint64 atMSecsSinceEpoch) const Q_DECL_OVERRIDE;
- int daylightTimeOffset(qint64 atMSecsSinceEpoch) const Q_DECL_OVERRIDE;
+ int offsetFromUtc(qint64 atMSecsSinceEpoch) const override;
+ int standardTimeOffset(qint64 atMSecsSinceEpoch) const override;
+ int daylightTimeOffset(qint64 atMSecsSinceEpoch) const override;
- bool hasDaylightTime() const Q_DECL_OVERRIDE;
- bool isDaylightTime(qint64 atMSecsSinceEpoch) const Q_DECL_OVERRIDE;
+ bool hasDaylightTime() const override;
+ bool isDaylightTime(qint64 atMSecsSinceEpoch) const override;
- Data data(qint64 forMSecsSinceEpoch) const Q_DECL_OVERRIDE;
+ Data data(qint64 forMSecsSinceEpoch) const override;
- bool hasTransitions() const Q_DECL_OVERRIDE;
- Data nextTransition(qint64 afterMSecsSinceEpoch) const Q_DECL_OVERRIDE;
- Data previousTransition(qint64 beforeMSecsSinceEpoch) const Q_DECL_OVERRIDE;
+ bool hasTransitions() const override;
+ Data nextTransition(qint64 afterMSecsSinceEpoch) const override;
+ Data previousTransition(qint64 beforeMSecsSinceEpoch) const override;
- QByteArray systemTimeZoneId() const Q_DECL_OVERRIDE;
+ QByteArray systemTimeZoneId() const override;
- QList<QByteArray> availableTimeZoneIds() const Q_DECL_OVERRIDE;
+ QList<QByteArray> availableTimeZoneIds() const override;
NSTimeZone *nsTimeZone() const;
@@ -386,7 +386,7 @@ private:
#endif // Q_OS_MAC
#ifdef Q_OS_WIN
-class Q_AUTOTEST_EXPORT QWinTimeZonePrivate Q_DECL_FINAL : public QTimeZonePrivate
+class Q_AUTOTEST_EXPORT QWinTimeZonePrivate final : public QTimeZonePrivate
{
public:
struct QWinTransitionRule {
@@ -406,34 +406,33 @@ public:
QWinTimeZonePrivate *clone() const override;
- QString comment() const Q_DECL_OVERRIDE;
+ QString comment() const override;
QString displayName(QTimeZone::TimeType timeType, QTimeZone::NameType nameType,
- const QLocale &locale) const Q_DECL_OVERRIDE;
- QString abbreviation(qint64 atMSecsSinceEpoch) const Q_DECL_OVERRIDE;
+ const QLocale &locale) const override;
+ QString abbreviation(qint64 atMSecsSinceEpoch) const override;
- int offsetFromUtc(qint64 atMSecsSinceEpoch) const Q_DECL_OVERRIDE;
- int standardTimeOffset(qint64 atMSecsSinceEpoch) const Q_DECL_OVERRIDE;
- int daylightTimeOffset(qint64 atMSecsSinceEpoch) const Q_DECL_OVERRIDE;
+ int offsetFromUtc(qint64 atMSecsSinceEpoch) const override;
+ int standardTimeOffset(qint64 atMSecsSinceEpoch) const override;
+ int daylightTimeOffset(qint64 atMSecsSinceEpoch) const override;
- bool hasDaylightTime() const Q_DECL_OVERRIDE;
- bool isDaylightTime(qint64 atMSecsSinceEpoch) const Q_DECL_OVERRIDE;
+ bool hasDaylightTime() const override;
+ bool isDaylightTime(qint64 atMSecsSinceEpoch) const override;
- Data data(qint64 forMSecsSinceEpoch) const Q_DECL_OVERRIDE;
+ Data data(qint64 forMSecsSinceEpoch) const override;
- bool hasTransitions() const Q_DECL_OVERRIDE;
- Data nextTransition(qint64 afterMSecsSinceEpoch) const Q_DECL_OVERRIDE;
- Data previousTransition(qint64 beforeMSecsSinceEpoch) const Q_DECL_OVERRIDE;
+ bool hasTransitions() const override;
+ Data nextTransition(qint64 afterMSecsSinceEpoch) const override;
+ Data previousTransition(qint64 beforeMSecsSinceEpoch) const override;
- QByteArray systemTimeZoneId() const Q_DECL_OVERRIDE;
+ QByteArray systemTimeZoneId() const override;
- QList<QByteArray> availableTimeZoneIds() const Q_DECL_OVERRIDE;
+ QList<QByteArray> availableTimeZoneIds() const override;
private:
void init(const QByteArray &ianaId);
- QWinTransitionRule ruleForYear(int year) const;
QTimeZonePrivate::Data ruleToData(const QWinTransitionRule &rule, qint64 atMSecsSinceEpoch,
- QTimeZone::TimeType type) const;
+ QTimeZone::TimeType type, bool fakeDst = false) const;
QByteArray m_windowsId;
QString m_displayName;
@@ -444,7 +443,7 @@ private:
#endif // Q_OS_WIN
#ifdef Q_OS_ANDROID
-class QAndroidTimeZonePrivate Q_DECL_FINAL : public QTimeZonePrivate
+class QAndroidTimeZonePrivate final : public QTimeZonePrivate
{
public:
// Create default time zone
@@ -457,25 +456,25 @@ public:
QAndroidTimeZonePrivate *clone() const override;
QString displayName(QTimeZone::TimeType timeType, QTimeZone::NameType nameType,
- const QLocale &locale) const Q_DECL_OVERRIDE;
- QString abbreviation(qint64 atMSecsSinceEpoch) const Q_DECL_OVERRIDE;
+ const QLocale &locale) const override;
+ QString abbreviation(qint64 atMSecsSinceEpoch) const override;
- int offsetFromUtc(qint64 atMSecsSinceEpoch) const Q_DECL_OVERRIDE;
- int standardTimeOffset(qint64 atMSecsSinceEpoch) const Q_DECL_OVERRIDE;
- int daylightTimeOffset(qint64 atMSecsSinceEpoch) const Q_DECL_OVERRIDE;
+ int offsetFromUtc(qint64 atMSecsSinceEpoch) const override;
+ int standardTimeOffset(qint64 atMSecsSinceEpoch) const override;
+ int daylightTimeOffset(qint64 atMSecsSinceEpoch) const override;
- bool hasDaylightTime() const Q_DECL_OVERRIDE;
- bool isDaylightTime(qint64 atMSecsSinceEpoch) const Q_DECL_OVERRIDE;
+ bool hasDaylightTime() const override;
+ bool isDaylightTime(qint64 atMSecsSinceEpoch) const override;
- Data data(qint64 forMSecsSinceEpoch) const Q_DECL_OVERRIDE;
+ Data data(qint64 forMSecsSinceEpoch) const override;
- bool hasTransitions() const Q_DECL_OVERRIDE;
- Data nextTransition(qint64 afterMSecsSinceEpoch) const Q_DECL_OVERRIDE;
- Data previousTransition(qint64 beforeMSecsSinceEpoch) const Q_DECL_OVERRIDE;
+ bool hasTransitions() const override;
+ Data nextTransition(qint64 afterMSecsSinceEpoch) const override;
+ Data previousTransition(qint64 beforeMSecsSinceEpoch) const override;
- QByteArray systemTimeZoneId() const Q_DECL_OVERRIDE;
+ QByteArray systemTimeZoneId() const override;
- QList<QByteArray> availableTimeZoneIds() const Q_DECL_OVERRIDE;
+ QList<QByteArray> availableTimeZoneIds() const override;
private:
void init(const QByteArray &zoneId);
diff --git a/src/corelib/tools/qtimezoneprivate_win.cpp b/src/corelib/tools/qtimezoneprivate_win.cpp
index a50227d3cc..8bde07c710 100644
--- a/src/corelib/tools/qtimezoneprivate_win.cpp
+++ b/src/corelib/tools/qtimezoneprivate_win.cpp
@@ -92,9 +92,11 @@ typedef struct _REG_TZI_FORMAT
SYSTEMTIME DaylightDate;
} REG_TZI_FORMAT;
+namespace {
+
// Fast and reliable conversion from msecs to date for all values
// Adapted from QDateTime msecsToDate
-static QDate msecsToDate(qint64 msecs)
+QDate msecsToDate(qint64 msecs)
{
qint64 jd = JULIAN_DAY_FOR_EPOCH;
@@ -111,7 +113,7 @@ static QDate msecsToDate(qint64 msecs)
return QDate::fromJulianDay(jd);
}
-static bool equalSystemtime(const SYSTEMTIME &t1, const SYSTEMTIME &t2)
+bool equalSystemtime(const SYSTEMTIME &t1, const SYSTEMTIME &t2)
{
return (t1.wYear == t2.wYear
&& t1.wMonth == t2.wMonth
@@ -123,7 +125,7 @@ static bool equalSystemtime(const SYSTEMTIME &t1, const SYSTEMTIME &t2)
&& t1.wMilliseconds == t2.wMilliseconds);
}
-static bool equalTzi(const TIME_ZONE_INFORMATION &tzi1, const TIME_ZONE_INFORMATION &tzi2)
+bool equalTzi(const TIME_ZONE_INFORMATION &tzi1, const TIME_ZONE_INFORMATION &tzi2)
{
return(tzi1.Bias == tzi2.Bias
&& tzi1.StandardBias == tzi2.StandardBias
@@ -135,13 +137,13 @@ static bool equalTzi(const TIME_ZONE_INFORMATION &tzi1, const TIME_ZONE_INFORMAT
}
#ifdef QT_USE_REGISTRY_TIMEZONE
-static bool openRegistryKey(const QString &keyPath, HKEY *key)
+bool openRegistryKey(const QString &keyPath, HKEY *key)
{
return (RegOpenKeyEx(HKEY_LOCAL_MACHINE, (const wchar_t*)keyPath.utf16(), 0, KEY_READ, key)
== ERROR_SUCCESS);
}
-static QString readRegistryString(const HKEY &key, const wchar_t *value)
+QString readRegistryString(const HKEY &key, const wchar_t *value)
{
wchar_t buffer[MAX_PATH] = {0};
DWORD size = sizeof(wchar_t) * MAX_PATH;
@@ -149,7 +151,7 @@ static QString readRegistryString(const HKEY &key, const wchar_t *value)
return QString::fromWCharArray(buffer);
}
-static int readRegistryValue(const HKEY &key, const wchar_t *value)
+int readRegistryValue(const HKEY &key, const wchar_t *value)
{
DWORD buffer;
DWORD size = sizeof(buffer);
@@ -157,8 +159,8 @@ static int readRegistryValue(const HKEY &key, const wchar_t *value)
return buffer;
}
-static QWinTimeZonePrivate::QWinTransitionRule readRegistryRule(const HKEY &key,
- const wchar_t *value, bool *ok)
+QWinTimeZonePrivate::QWinTransitionRule readRegistryRule(const HKEY &key,
+ const wchar_t *value, bool *ok)
{
*ok = false;
QWinTimeZonePrivate::QWinTransitionRule rule;
@@ -176,7 +178,7 @@ static QWinTimeZonePrivate::QWinTransitionRule readRegistryRule(const HKEY &key,
return rule;
}
-static TIME_ZONE_INFORMATION getRegistryTzi(const QByteArray &windowsId, bool *ok)
+TIME_ZONE_INFORMATION getRegistryTzi(const QByteArray &windowsId, bool *ok)
{
*ok = false;
TIME_ZONE_INFORMATION tzi;
@@ -223,7 +225,7 @@ typedef QHash<QByteArray, QWinDynamicTimeZone> QWinRTTimeZoneHash;
Q_GLOBAL_STATIC(QWinRTTimeZoneHash, gTimeZones)
-static void enumerateTimeZones()
+void enumerateTimeZones()
{
DYNAMIC_TIME_ZONE_INFORMATION dtzInfo;
quint32 index = 0;
@@ -244,7 +246,7 @@ static void enumerateTimeZones()
}
}
-static DYNAMIC_TIME_ZONE_INFORMATION dynamicInfoForId(const QByteArray &windowsId)
+DYNAMIC_TIME_ZONE_INFORMATION dynamicInfoForId(const QByteArray &windowsId)
{
DYNAMIC_TIME_ZONE_INFORMATION dtzInfo;
quint32 index = 0;
@@ -259,9 +261,39 @@ static DYNAMIC_TIME_ZONE_INFORMATION dynamicInfoForId(const QByteArray &windowsI
}
return dtzInfo;
}
+
+QWinTimeZonePrivate::QWinTransitionRule
+readDynamicRule(DYNAMIC_TIME_ZONE_INFORMATION &dtzi, int year, bool *ok)
+{
+ TIME_ZONE_INFORMATION tzi;
+ QWinTimeZonePrivate::QWinTransitionRule rule;
+ *ok = GetTimeZoneInformationForYear(year, &dtzi, &tzi);
+ if (*ok) {
+ rule.startYear = 0;
+ rule.standardTimeBias = tzi.Bias + tzi.StandardBias;
+ rule.daylightTimeBias = tzi.Bias + tzi.DaylightBias - rule.standardTimeBias;
+ rule.standardTimeRule = tzi.StandardDate;
+ rule.daylightTimeRule = tzi.DaylightDate;
+ }
+ return rule;
+}
#endif // QT_USE_REGISTRY_TIMEZONE
-static QList<QByteArray> availableWindowsIds()
+bool isSameRule(const QWinTimeZonePrivate::QWinTransitionRule &last,
+ const QWinTimeZonePrivate::QWinTransitionRule &rule)
+{
+ // In particular, when this is true and either wYear is 0, so is the other;
+ // so if one rule is recurrent and they're equal, so is the other. If
+ // either rule *isn't* recurrent, it has non-0 wYear which shall be
+ // different from the other's. Note that we don't compare .startYear, since
+ // that will always be different.
+ return equalSystemtime(last.standardTimeRule, rule.standardTimeRule)
+ && equalSystemtime(last.daylightTimeRule, rule.daylightTimeRule)
+ && last.standardTimeBias == rule.standardTimeBias
+ && last.daylightTimeBias == rule.daylightTimeBias;
+}
+
+QList<QByteArray> availableWindowsIds()
{
#ifdef QT_USE_REGISTRY_TIMEZONE
// TODO Consider caching results in a global static, very unlikely to change.
@@ -288,7 +320,7 @@ static QList<QByteArray> availableWindowsIds()
#endif // QT_USE_REGISTRY_TIMEZONE
}
-static QByteArray windowsSystemZoneId()
+QByteArray windowsSystemZoneId()
{
#ifdef QT_USE_REGISTRY_TIMEZONE
// On Vista and later is held in the value TimeZoneKeyName in key currTzRegPath
@@ -322,66 +354,141 @@ static QByteArray windowsSystemZoneId()
return QTimeZonePrivate::utcQByteArray();
}
-static QDate calculateTransitionLocalDate(const SYSTEMTIME &rule, int year)
+QDate calculateTransitionLocalDate(const SYSTEMTIME &rule, int year)
{
// If month is 0 then there is no date
if (rule.wMonth == 0)
return QDate();
- SYSTEMTIME time = rule;
- // If the year isn't set, then the rule date is relative
- if (time.wYear == 0) {
- if (time.wDayOfWeek == 0)
- time.wDayOfWeek = 7;
- QDate date(year, time.wMonth, 1);
- int startDow = date.dayOfWeek();
- if (startDow <= time.wDayOfWeek)
- date = date.addDays(time.wDayOfWeek - startDow - 7);
- else
- date = date.addDays(time.wDayOfWeek - startDow);
- date = date.addDays(time.wDay * 7);
- while (date.month() != time.wMonth)
- date = date.addDays(-7);
- return date;
+ // Interpret SYSTEMTIME according to the slightly quirky rules in:
+ // https://msdn.microsoft.com/en-us/library/windows/desktop/ms725481(v=vs.85).aspx
+
+ // If the year is set, the rule gives an absolute date:
+ if (rule.wYear)
+ return QDate(rule.wYear, rule.wMonth, rule.wDay);
+
+ // Otherwise, the rule date is annual and relative:
+ const int dayOfWeek = rule.wDayOfWeek == 0 ? 7 : rule.wDayOfWeek;
+ QDate date(year, rule.wMonth, 1);
+ // How many days before was last dayOfWeek before target month ?
+ int adjust = dayOfWeek - date.dayOfWeek(); // -6 <= adjust < 7
+ if (adjust >= 0) // Ensure -7 <= adjust < 0:
+ adjust -= 7;
+ // Normally, wDay is day-within-month; but here it is 1 for the first
+ // of the given dayOfWeek in the month, through 4 for the fourth or ...
+ adjust += (rule.wDay < 1 ? 1 : rule.wDay > 4 ? 5 : rule.wDay) * 7;
+ date = date.addDays(adjust);
+ // ... 5 for the last; so back up by weeks to get within the month:
+ if (date.month() != rule.wMonth) {
+ Q_ASSERT(rule.wDay > 4);
+ // (Note that, with adjust < 0, date <= 28th of our target month
+ // is guaranteed when wDay <= 4, or after our first -7 here.)
+ date = date.addDays(-7);
+ Q_ASSERT(date.month() == rule.wMonth);
}
-
- // If the year is set then is an absolute date
- return QDate(time.wYear, time.wMonth, time.wDay);
+ return date;
}
// Converts a date/time value into msecs
-static inline qint64 timeToMSecs(const QDate &date, const QTime &time)
+inline qint64 timeToMSecs(const QDate &date, const QTime &time)
{
return ((date.toJulianDay() - JULIAN_DAY_FOR_EPOCH) * MSECS_PER_DAY)
+ time.msecsSinceStartOfDay();
}
-static void calculateTransitionsForYear(const QWinTimeZonePrivate::QWinTransitionRule &rule, int year,
- qint64 *stdMSecs, qint64 *dstMSecs)
-{
- // TODO Consider caching the calculated values
- // The local time in Daylight Time when switches to Standard Time
- QDate standardDate = calculateTransitionLocalDate(rule.standardTimeRule, year);
- QTime standardTime = QTime(rule.standardTimeRule.wHour, rule.standardTimeRule.wMinute,
- rule.standardTimeRule.wSecond);
- if (standardDate.isValid() && standardTime.isValid()) {
- *stdMSecs = timeToMSecs(standardDate, standardTime)
- + ((rule.standardTimeBias + rule.daylightTimeBias) * 60000);
- } else {
- *stdMSecs = QTimeZonePrivate::invalidMSecs();
+qint64 calculateTransitionForYear(const SYSTEMTIME &rule, int year, int bias)
+{
+ // TODO Consider caching the calculated values - i.e. replace SYSTEMTIME in
+ // WinTransitionRule; do this in init() once and store the results.
+ const QDate date = calculateTransitionLocalDate(rule, year);
+ const QTime time = QTime(rule.wHour, rule.wMinute, rule.wSecond);
+ if (date.isValid() && time.isValid())
+ return timeToMSecs(date, time) + bias * 60000;
+ return QTimeZonePrivate::invalidMSecs();
+}
+
+struct TransitionTimePair
+{
+ // Transition times after the epoch, in ms:
+ qint64 std, dst;
+ // If either is invalidMSecs(), which shall then be < the other, there is no
+ // DST and the other describes a change in actual standard offset.
+
+ TransitionTimePair(const QWinTimeZonePrivate::QWinTransitionRule &rule,
+ int year, int oldYearOffset)
+ // The local time in Daylight Time of the switch to Standard Time
+ : std(calculateTransitionForYear(rule.standardTimeRule, year,
+ rule.standardTimeBias + rule.daylightTimeBias)),
+ // The local time in Standard Time of the switch to Daylight Time
+ dst(calculateTransitionForYear(rule.daylightTimeRule, year, rule.standardTimeBias))
+ {
+ /*
+ Check for potential "fake DST", used by MS's APIs because the
+ TIME_ZONE_INFORMATION spec either expresses no transitions in the
+ year, or expresses a transition of each kind, even if standard time
+ did change in a year with no DST. We've seen year-start fake-DST
+ (whose offset matches prior standard offset, in which the previous
+ year ended); and conjecture that similar might be used at a year-end.
+ (This might be used for a southern-hemisphere zone, where the start of
+ the year usually is in DST, when applicable.) Note that, here, wDay
+ identifies an instance of a given day-of-week in the month, with 5
+ meaning last.
+
+ Either the alleged standardTimeRule or the alleged daylightTimeRule
+ may be faked; either way, the transition is actually a change to the
+ current standard offset; but the unfaked half of the rule contains the
+ useful bias data, so we have to go along with its lies.
+
+ Example: Russia/Moscow
+ Format: -bias +( -stdBias, stdDate | -dstBias, dstDate ) notes
+ Last year of DST, 2010: 180 +( 0, 0-10-5 3:0 | 60, 0-3-5 2:0 ) normal DST
+ Zone change in 2011: 180 +( 0, 0-1-1 0:0 | 60 0-3-5 2:0 ) fake DST at transition
+ Fixed standard in 2012: 240 +( 0, 0-0-0 0:0 | 60, 0-0-0 0:0 ) standard time years
+ Zone change in 2014: 180 +( 0, 0-10-5 2:0 | 60, 0-1-1 0:0 ) fake DST at year-start
+ The last of these is missing on Win7 VMs (too old to know about it).
+ */
+ if (rule.daylightTimeRule.wMonth == 1 && rule.daylightTimeRule.wDay == 1) {
+ // Fake "DST transition" at start of year producing the same offset as
+ // previous year ended in.
+ if (rule.standardTimeBias + rule.daylightTimeBias == oldYearOffset)
+ dst = QTimeZonePrivate::invalidMSecs();
+ } else if (rule.daylightTimeRule.wMonth == 12 && rule.daylightTimeRule.wDay > 3) {
+ // Similar, conjectured, for end of year, not changing offset.
+ if (rule.daylightTimeBias == 0)
+ dst = QTimeZonePrivate::invalidMSecs();
+ }
+ if (rule.standardTimeRule.wMonth == 1 && rule.standardTimeRule.wDay == 1) {
+ // Fake "transition out of DST" at start of year producing the same
+ // offset as previous year ended in.
+ if (rule.standardTimeBias == oldYearOffset)
+ std = QTimeZonePrivate::invalidMSecs();
+ } else if (rule.standardTimeRule.wMonth == 12 && rule.standardTimeRule.wDay > 3) {
+ // Similar, conjectured, for end of year, not changing offset.
+ if (rule.daylightTimeBias == 0)
+ std = QTimeZonePrivate::invalidMSecs();
+ }
}
- // The local time in Standard Time when switches to Daylight Time
- QDate daylightDate = calculateTransitionLocalDate(rule.daylightTimeRule, year);
- QTime daylightTime = QTime(rule.daylightTimeRule.wHour, rule.daylightTimeRule.wMinute,
- rule.daylightTimeRule.wSecond);
- if (daylightDate.isValid() && daylightTime.isValid())
- *dstMSecs = timeToMSecs(daylightDate, daylightTime) + (rule.standardTimeBias * 60000);
- else
- *dstMSecs = QTimeZonePrivate::invalidMSecs();
+ bool fakesDst() const
+ {
+ return std == QTimeZonePrivate::invalidMSecs()
+ || dst == QTimeZonePrivate::invalidMSecs();
+ }
+};
+
+int yearEndOffset(const QWinTimeZonePrivate::QWinTransitionRule &rule, int year)
+{
+ int offset = rule.standardTimeBias;
+ // Only needed to help another TransitionTimePair work out year + 1's start
+ // offset; and the oldYearOffset we use only affects an alleged transition
+ // at the *start* of this year, so it doesn't matter if we guess wrong here:
+ TransitionTimePair pair(rule, year, offset);
+ if (pair.dst > pair.std)
+ offset += rule.daylightTimeBias;
+ return offset;
}
-static QLocale::Country userCountry()
+QLocale::Country userCountry()
{
const GEOID id = GetUserGeoID(GEOCLASS_NATION);
wchar_t code[3];
@@ -390,6 +497,36 @@ static QLocale::Country userCountry()
: QLocale::AnyCountry;
}
+// Index of last rule in rules with .startYear <= year:
+int ruleIndexForYear(const QList<QWinTimeZonePrivate::QWinTransitionRule> &rules, int year)
+{
+ if (rules.last().startYear <= year)
+ return rules.count() - 1;
+ // We don't have a rule for before the first, but the first is the best we can offer:
+ if (rules.first().startYear > year)
+ return 0;
+
+ // Otherwise, use binary chop:
+ int lo = 0, hi = rules.count();
+ // invariant: rules[i].startYear <= year < rules[hi].startYear
+ // subject to treating rules[rules.count()] as "off the end of time"
+ while (lo + 1 < hi) {
+ const int mid = (lo + hi) / 2;
+ // lo + 2 <= hi, so lo + 1 <= mid <= hi - 1, so lo < mid < hi
+ // In particular, mid < rules.count()
+ const int midYear = rules.at(mid).startYear;
+ if (midYear > year)
+ hi = mid;
+ else if (midYear < year)
+ lo = mid;
+ else // No two rules have the same startYear:
+ return mid;
+ }
+ return lo;
+}
+
+} // anonymous namespace
+
// Create the system default time zone
QWinTimeZonePrivate::QWinTimeZonePrivate()
: QTimeZonePrivate()
@@ -430,6 +567,7 @@ void QWinTimeZonePrivate::init(const QByteArray &ianaId)
m_id = ianaId;
}
+ bool badMonth = false; // Only warn once per zone, if at all.
if (!m_windowsId.isEmpty()) {
#ifdef QT_USE_REGISTRY_TIMEZONE
// Open the base TZI for the time zone
@@ -453,16 +591,28 @@ void QWinTimeZonePrivate::init(const QByteArray &ianaId)
QWinTransitionRule rule = readRegistryRule(dynamicKey,
(LPCWSTR)QString::number(year).utf16(),
&ruleOk);
- rule.startYear = year;
- if (ruleOk)
+ if (ruleOk
+ // Don't repeat a recurrent rule:
+ && (m_tranRules.isEmpty()
+ || !isSameRule(m_tranRules.last(), rule))) {
+ if (!badMonth
+ && (rule.standardTimeRule.wMonth == 0)
+ != (rule.daylightTimeRule.wMonth == 0)) {
+ badMonth = true;
+ qWarning("MS registry TZ API violated its wMonth constraint;"
+ "this may cause mistakes for %s from %d",
+ ianaId.constData(), year);
+ }
+ rule.startYear = m_tranRules.isEmpty() ? MIN_YEAR : year;
m_tranRules.append(rule);
+ }
}
RegCloseKey(dynamicKey);
} else {
// No dynamic data so use the base data
bool ruleOk;
QWinTransitionRule rule = readRegistryRule(baseKey, L"TZI", &ruleOk);
- rule.startYear = 1970;
+ rule.startYear = MIN_YEAR;
if (ruleOk)
m_tranRules.append(rule);
}
@@ -479,20 +629,36 @@ void QWinTimeZonePrivate::init(const QByteArray &ianaId)
DWORD firstYear = 0;
DWORD lastYear = 0;
DYNAMIC_TIME_ZONE_INFORMATION dtzi = dynamicInfoForId(m_windowsId);
- GetDynamicTimeZoneInformationEffectiveYears(&dtzi, &firstYear, &lastYear);
- // If there is no dynamic information, you can still query for
- // year 0, which helps simplifying following part
- for (DWORD year = firstYear; year <= lastYear; ++year) {
- TIME_ZONE_INFORMATION tzi;
- if (!GetTimeZoneInformationForYear(year, &dtzi, &tzi))
- continue;
- QWinTransitionRule rule;
- rule.standardTimeBias = tzi.Bias + tzi.StandardBias;
- rule.daylightTimeBias = tzi.Bias + tzi.DaylightBias - rule.standardTimeBias;
- rule.standardTimeRule = tzi.StandardDate;
- rule.daylightTimeRule = tzi.DaylightDate;
- rule.startYear = year;
- m_tranRules.append(rule);
+ if (GetDynamicTimeZoneInformationEffectiveYears(&dtzi, &firstYear, &lastYear)
+ == ERROR_SUCCESS && firstYear < lastYear) {
+ for (DWORD year = firstYear; year <= lastYear; ++year) {
+ bool ok = false;
+ QWinTransitionRule rule = readDynamicRule(dtzi, year, &ok);
+ if (ok
+ // Don't repeat a recurrent rule
+ && (m_tranRules.isEmpty()
+ || !isSameRule(m_tranRules.last(), rule))) {
+ if (!badMonth
+ && (rule.standardTimeRule.wMonth == 0)
+ != (rule.daylightTimeRule.wMonth == 0)) {
+ badMonth = true;
+ qWarning("MS dynamic TZ API violated its wMonth constraint;"
+ "this may cause mistakes for %s from %d",
+ ianaId.constData(), year);
+ }
+ rule.startYear = m_tranRules.isEmpty() ? MIN_YEAR : year;
+ m_tranRules.append(rule);
+ }
+ }
+ } else {
+ // At least try to get the non-dynamic data:
+ dtzi.DynamicDaylightTimeDisabled = false;
+ bool ok = false;
+ QWinTransitionRule rule = readDynamicRule(dtzi, 1970, &ok);
+ if (ok) {
+ rule.startYear = MIN_YEAR;
+ m_tranRules.append(rule);
+ }
}
}
#endif // QT_USE_REGISTRY_TIMEZONE
@@ -519,7 +685,8 @@ QString QWinTimeZonePrivate::displayName(QTimeZone::TimeType timeType,
Q_UNUSED(locale);
if (nameType == QTimeZone::OffsetName) {
- QWinTransitionRule rule = ruleForYear(QDate::currentDate().year());
+ const QWinTransitionRule &rule =
+ m_tranRules.at(ruleIndexForYear(m_tranRules, QDate::currentDate().year()));
if (timeType == QTimeZone::DaylightTime)
return isoOffsetFormat((rule.standardTimeBias + rule.daylightTimeBias) * -60);
else
@@ -569,38 +736,41 @@ bool QWinTimeZonePrivate::isDaylightTime(qint64 atMSecsSinceEpoch) const
QTimeZonePrivate::Data QWinTimeZonePrivate::data(qint64 forMSecsSinceEpoch) const
{
- // Convert MSecs to year to get transitions for, assumes no transitions around 31 Dec/1 Jan
int year = msecsToDate(forMSecsSinceEpoch).year();
-
- qint64 first;
- qint64 second;
- qint64 next = maxMSecs();
- qint64 stdMSecs;
- qint64 dstMSecs;
- QWinTransitionRule rule;
- do {
- // Convert the transition rules into msecs for the year we want to try
- rule = ruleForYear(year);
- // If no transition rules to calculate then no DST, so just use rule for std
- if (rule.standardTimeRule.wMonth == 0 && rule.daylightTimeRule.wMonth == 0)
- break;
- calculateTransitionsForYear(rule, year, &stdMSecs, &dstMSecs);
- if (stdMSecs < dstMSecs) {
- first = stdMSecs;
- second = dstMSecs;
+ for (int ruleIndex = ruleIndexForYear(m_tranRules, year);
+ ruleIndex >= 0; --ruleIndex) {
+ const QWinTransitionRule &rule = m_tranRules.at(ruleIndex);
+ // Does this rule's period include any transition at all ?
+ if (rule.standardTimeRule.wMonth > 0 || rule.daylightTimeRule.wMonth > 0) {
+ const int endYear = qMax(rule.startYear, year - 1);
+ while (year >= endYear) {
+ const int newYearOffset = (year <= rule.startYear && ruleIndex > 0)
+ ? yearEndOffset(m_tranRules.at(ruleIndex - 1), year - 1)
+ : yearEndOffset(rule, year - 1);
+ const TransitionTimePair pair(rule, year, newYearOffset);
+ bool isDst = false;
+ if (pair.std != invalidMSecs() && pair.std <= forMSecsSinceEpoch) {
+ isDst = pair.std < pair.dst && pair.dst <= forMSecsSinceEpoch;
+ } else if (pair.dst != invalidMSecs() && pair.dst <= forMSecsSinceEpoch) {
+ isDst = true;
+ } else {
+ --year; // Try an earlier year for this rule (once).
+ continue;
+ }
+ return ruleToData(rule, forMSecsSinceEpoch,
+ isDst ? QTimeZone::DaylightTime : QTimeZone::StandardTime,
+ pair.fakesDst());
+ }
+ // Fell off start of rule, try previous rule.
} else {
- first = dstMSecs;
- second = stdMSecs;
+ // No transition, no DST, use the year's standard time.
+ return ruleToData(rule, forMSecsSinceEpoch, QTimeZone::StandardTime);
}
- if (forMSecsSinceEpoch >= second && second != invalidMSecs())
- next = second;
- else if (forMSecsSinceEpoch >= first && first != invalidMSecs())
- next = first;
- // If didn't fall in this year, try the previous
- --year;
- } while (next == maxMSecs() && year >= MIN_YEAR);
-
- return ruleToData(rule, forMSecsSinceEpoch, (next == dstMSecs) ? QTimeZone::DaylightTime : QTimeZone::StandardTime);
+ if (year >= rule.startYear)
+ year = rule.startYear - 1; // Seek last transition in new rule.
+ }
+ // We don't have relevant data :-(
+ return invalidData();
}
bool QWinTimeZonePrivate::hasTransitions() const
@@ -614,105 +784,89 @@ bool QWinTimeZonePrivate::hasTransitions() const
QTimeZonePrivate::Data QWinTimeZonePrivate::nextTransition(qint64 afterMSecsSinceEpoch) const
{
- // Convert MSecs to year to get transitions for, assumes no transitions around 31 Dec/1 Jan
int year = msecsToDate(afterMSecsSinceEpoch).year();
+ for (int ruleIndex = ruleIndexForYear(m_tranRules, year);
+ ruleIndex < m_tranRules.count(); ++ruleIndex) {
+ const QWinTransitionRule &rule = m_tranRules.at(ruleIndex);
+ // Does this rule's period include any transition at all ?
+ if (rule.standardTimeRule.wMonth > 0 || rule.daylightTimeRule.wMonth > 0) {
+ if (year < rule.startYear)
+ year = rule.startYear; // Seek first transition in this rule.
+ const int endYear = ruleIndex + 1 < m_tranRules.count()
+ ? qMin(m_tranRules.at(ruleIndex + 1).startYear, year + 2) : (year + 2);
+ int newYearOffset = (year <= rule.startYear && ruleIndex > 0)
+ ? yearEndOffset(m_tranRules.at(ruleIndex - 1), year - 1)
+ : yearEndOffset(rule, year - 1);
+ while (year < endYear) {
+ const TransitionTimePair pair(rule, year, newYearOffset);
+ bool isDst = false;
+ Q_ASSERT(invalidMSecs() <= afterMSecsSinceEpoch); // invalid is min qint64
+ if (pair.std > afterMSecsSinceEpoch) {
+ isDst = pair.std > pair.dst && pair.dst > afterMSecsSinceEpoch;
+ } else if (pair.dst > afterMSecsSinceEpoch) {
+ isDst = true;
+ } else {
+ newYearOffset = rule.standardTimeBias;
+ if (pair.dst > pair.std)
+ newYearOffset += rule.daylightTimeBias;
+ ++year; // Try a later year for this rule (once).
+ continue;
+ }
- QWinTransitionRule rule;
- // If the required year falls after the last rule start year and the last rule has no
- // valid future transition calculations then there is no next transition
- if (year > m_tranRules.last().startYear) {
- rule = ruleForYear(year);
- // If the rules have either a fixed year, or no month, then no future trans
- if (rule.standardTimeRule.wYear != 0 || rule.daylightTimeRule.wYear != 0
- || rule.standardTimeRule.wMonth == 0 || rule.daylightTimeRule.wMonth == 0) {
- return invalidData();
- }
+ if (isDst)
+ return ruleToData(rule, pair.dst, QTimeZone::DaylightTime, pair.fakesDst());
+ return ruleToData(rule, pair.std, QTimeZone::StandardTime, pair.fakesDst());
+ }
+ // Fell off end of rule, try next rule.
+ } // else: no transition during rule's period
}
-
- // Otherwise we have a valid rule for the required year that can be used
- // to calculate this year or next
- qint64 first;
- qint64 second;
- qint64 next = minMSecs();
- qint64 stdMSecs;
- qint64 dstMSecs;
- do {
- // Convert the transition rules into msecs for the year we want to try
- rule = ruleForYear(year);
- // If no transition rules to calculate then no next transition
- if (rule.standardTimeRule.wMonth == 0 && rule.daylightTimeRule.wMonth == 0)
- return invalidData();
- calculateTransitionsForYear(rule, year, &stdMSecs, &dstMSecs);
- // Find the first and second transition for the year
- if (stdMSecs < dstMSecs) {
- first = stdMSecs;
- second = dstMSecs;
- } else {
- first = dstMSecs;
- second = stdMSecs;
- }
- if (afterMSecsSinceEpoch < first)
- next = first;
- else if (afterMSecsSinceEpoch < second)
- next = second;
- // If didn't fall in this year, try the next
- ++year;
- } while (next == minMSecs() && year <= MAX_YEAR);
-
- if (next == minMSecs() || next == invalidMSecs())
- return invalidData();
-
- return ruleToData(rule, next, (next == dstMSecs) ? QTimeZone::DaylightTime : QTimeZone::StandardTime);
+ // Apparently no transition after the given time:
+ return invalidData();
}
QTimeZonePrivate::Data QWinTimeZonePrivate::previousTransition(qint64 beforeMSecsSinceEpoch) const
{
- // Convert MSecs to year to get transitions for, assumes no transitions around 31 Dec/1 Jan
- int year = msecsToDate(beforeMSecsSinceEpoch).year();
-
- QWinTransitionRule rule;
- // If the required year falls before the first rule start year and the first rule has no
- // valid transition calculations then there is no previous transition
- if (year < m_tranRules.first().startYear) {
- rule = ruleForYear(year);
- // If the rules have either a fixed year, or no month, then no previous trans
- if (rule.standardTimeRule.wYear != 0 || rule.daylightTimeRule.wYear != 0
- || rule.standardTimeRule.wMonth == 0 || rule.daylightTimeRule.wMonth == 0) {
- return invalidData();
- }
- }
-
- qint64 first;
- qint64 second;
- qint64 next = maxMSecs();
- qint64 stdMSecs;
- qint64 dstMSecs;
- do {
- // Convert the transition rules into msecs for the year we want to try
- rule = ruleForYear(year);
- // If no transition rules to calculate then no previous transition
- if (rule.standardTimeRule.wMonth == 0 && rule.daylightTimeRule.wMonth == 0)
- return invalidData();
- calculateTransitionsForYear(rule, year, &stdMSecs, &dstMSecs);
- if (stdMSecs < dstMSecs) {
- first = stdMSecs;
- second = dstMSecs;
- } else {
- first = dstMSecs;
- second = stdMSecs;
- }
- if (beforeMSecsSinceEpoch > second && second != invalidMSecs())
- next = second;
- else if (beforeMSecsSinceEpoch > first && first != invalidMSecs())
- next = first;
- // If didn't fall in this year, try the previous
- --year;
- } while (next == maxMSecs() && year >= MIN_YEAR);
-
- if (next == maxMSecs())
+ const qint64 startOfTime = invalidMSecs() + 1;
+ if (beforeMSecsSinceEpoch <= startOfTime)
return invalidData();
- return ruleToData(rule, next, (next == dstMSecs) ? QTimeZone::DaylightTime : QTimeZone::StandardTime);
+ int year = msecsToDate(beforeMSecsSinceEpoch).year();
+ for (int ruleIndex = ruleIndexForYear(m_tranRules, year);
+ ruleIndex >= 0; --ruleIndex) {
+ const QWinTransitionRule &rule = m_tranRules.at(ruleIndex);
+ // Does this rule's period include any transition at all ?
+ if (rule.standardTimeRule.wMonth > 0 || rule.daylightTimeRule.wMonth > 0) {
+ const int endYear = qMax(rule.startYear, year - 1);
+ while (year >= endYear) {
+ const int newYearOffset = (year <= rule.startYear && ruleIndex > 0)
+ ? yearEndOffset(m_tranRules.at(ruleIndex - 1), year - 1)
+ : yearEndOffset(rule, year - 1);
+ const TransitionTimePair pair(rule, year, newYearOffset);
+ bool isDst = false;
+ if (pair.std != invalidMSecs() && pair.std < beforeMSecsSinceEpoch) {
+ isDst = pair.std < pair.dst && pair.dst < beforeMSecsSinceEpoch;
+ } else if (pair.dst != invalidMSecs() && pair.dst < beforeMSecsSinceEpoch) {
+ isDst = true;
+ } else {
+ --year; // Try an earlier year for this rule (once).
+ continue;
+ }
+ if (isDst)
+ return ruleToData(rule, pair.dst, QTimeZone::DaylightTime, pair.fakesDst());
+ return ruleToData(rule, pair.std, QTimeZone::StandardTime, pair.fakesDst());
+ }
+ // Fell off start of rule, try previous rule.
+ } else if (ruleIndex == 0) {
+ // Treat a no-transition first rule as a transition at the start of
+ // time, so that a scan through all rules *does* see it as the first
+ // rule:
+ return ruleToData(rule, startOfTime, QTimeZone::StandardTime, false);
+ } // else: no transition during rule's period
+ if (year >= rule.startYear)
+ year = rule.startYear - 1; // Seek last transition in new rule
+ }
+ // Apparently no transition before the given time:
+ return invalidData();
}
QByteArray QWinTimeZonePrivate::systemTimeZoneId() const
@@ -744,23 +898,21 @@ QList<QByteArray> QWinTimeZonePrivate::availableTimeZoneIds() const
return result;
}
-QWinTimeZonePrivate::QWinTransitionRule QWinTimeZonePrivate::ruleForYear(int year) const
-{
- for (int i = m_tranRules.size() - 1; i >= 0; --i) {
- if (m_tranRules.at(i).startYear <= year)
- return m_tranRules.at(i);
- }
- return m_tranRules.at(0);
-}
-
QTimeZonePrivate::Data QWinTimeZonePrivate::ruleToData(const QWinTransitionRule &rule,
qint64 atMSecsSinceEpoch,
- QTimeZone::TimeType type) const
+ QTimeZone::TimeType type,
+ bool fakeDst) const
{
- QTimeZonePrivate::Data tran = QTimeZonePrivate::invalidData();
+ Data tran = invalidData();
tran.atMSecsSinceEpoch = atMSecsSinceEpoch;
tran.standardTimeOffset = rule.standardTimeBias * -60;
- if (type == QTimeZone::DaylightTime) {
+ if (fakeDst) {
+ tran.daylightTimeOffset = 0;
+ tran.abbreviation = m_standardName;
+ // Rule may claim we're in DST when it's actually a standard time change:
+ if (type == QTimeZone::DaylightTime)
+ tran.standardTimeOffset += rule.daylightTimeBias * -60;
+ } else if (type == QTimeZone::DaylightTime) {
tran.daylightTimeOffset = rule.daylightTimeBias * -60;
tran.abbreviation = m_daylightName;
} else {
diff --git a/src/corelib/tools/qvarlengtharray.qdoc b/src/corelib/tools/qvarlengtharray.qdoc
index be2bdeda07..7c63871ea9 100644
--- a/src/corelib/tools/qvarlengtharray.qdoc
+++ b/src/corelib/tools/qvarlengtharray.qdoc
@@ -90,7 +90,7 @@
\sa QVector, QList, QLinkedList
*/
-/*! \fn QVarLengthArray::QVarLengthArray(int size)
+/*! \fn template<class T, int Prealloc> QVarLengthArray<T, Prealloc>::QVarLengthArray(int size)
Constructs an array with an initial size of \a size elements.
@@ -101,7 +101,7 @@
*/
-/*! \fn QVarLengthArray::QVarLengthArray(std::initializer_list<T> args)
+/*! \fn template<class T, int Prealloc> QVarLengthArray<T, Prealloc>::QVarLengthArray(std::initializer_list<T> args)
\since 5.5
Constructs an array from the std::initializer_list given by \a args.
@@ -111,26 +111,26 @@
*/
-/*! \fn QVarLengthArray::~QVarLengthArray()
+/*! \fn template<class T, int Prealloc> QVarLengthArray<T, Prealloc>::~QVarLengthArray()
Destroys the array.
*/
-/*! \fn int QVarLengthArray::size() const
+/*! \fn template<class T, int Prealloc> int QVarLengthArray<T, Prealloc>::size() const
Returns the number of elements in the array.
\sa isEmpty(), resize()
*/
-/*! \fn int QVarLengthArray::count() const
+/*! \fn template<class T, int Prealloc> int QVarLengthArray<T, Prealloc>::count() const
Same as size().
\sa isEmpty(), resize()
*/
-/*! \fn int QVarLengthArray::length() const
+/*! \fn template<class T, int Prealloc> int QVarLengthArray<T, Prealloc>::length() const
\since 5.0
Same as size().
@@ -138,7 +138,7 @@
\sa isEmpty(), resize()
*/
-/*! \fn T& QVarLengthArray::first()
+/*! \fn template<class T, int Prealloc> T& QVarLengthArray<T, Prealloc>::first()
Returns a reference to the first item in the array. The array must
not be empty. If the array can be empty, check isEmpty() before
@@ -147,24 +147,24 @@
\sa last(), isEmpty()
*/
-/*! \fn const T& QVarLengthArray::first() const
+/*! \fn template<class T, int Prealloc> const T& QVarLengthArray<T, Prealloc>::first() const
\overload
*/
-/*! \fn T& QVarLengthArray::front()
+/*! \fn template<class T, int Prealloc> T& QVarLengthArray<T, Prealloc>::front()
\since 5.0
Same as first(). Provided for STL-compatibility.
*/
-/*! \fn const T& QVarLengthArray::front() const
+/*! \fn template<class T, int Prealloc> const T& QVarLengthArray<T, Prealloc>::front() const
\since 5.0
\overload
*/
-/*! \fn T& QVarLengthArray::last()
+/*! \fn template<class T, int Prealloc> T& QVarLengthArray<T, Prealloc>::last()
Returns a reference to the last item in the array. The array must
not be empty. If the array can be empty, check isEmpty() before
@@ -173,37 +173,37 @@
\sa first(), isEmpty()
*/
-/*! \fn const T& QVarLengthArray::last() const
+/*! \fn template<class T, int Prealloc> const T& QVarLengthArray<T, Prealloc>::last() const
\overload
*/
-/*! \fn T& QVarLengthArray::back()
+/*! \fn template<class T, int Prealloc> T& QVarLengthArray<T, Prealloc>::back()
\since 5.0
Same as last(). Provided for STL-compatibility.
*/
-/*! \fn const T& QVarLengthArray::back() const
+/*! \fn template<class T, int Prealloc> const T& QVarLengthArray<T, Prealloc>::back() const
\since 5.0
\overload
*/
-/*! \fn void QVarLengthArray::shrink_to_fit()
+/*! \fn template<class T, int Prealloc> void QVarLengthArray<T, Prealloc>::shrink_to_fit()
\since 5.10
Same as squeeze(). Provided for STL-compatibility.
*/
-/*! \fn bool QVarLengthArray::isEmpty() const
+/*! \fn template<class T, int Prealloc> bool QVarLengthArray<T, Prealloc>::isEmpty() const
Returns \c true if the array has size 0; otherwise returns \c false.
\sa size(), resize()
*/
-/*! \fn bool QVarLengthArray::empty() const
+/*! \fn template<class T, int Prealloc> bool QVarLengthArray<T, Prealloc>::empty() const
\since 5.0
Returns \c true if the array has size 0; otherwise returns \c false.
@@ -211,14 +211,14 @@
Same as isEmpty(). Provided for STL-compatibility.
*/
-/*! \fn void QVarLengthArray::clear()
+/*! \fn template<class T, int Prealloc> void QVarLengthArray<T, Prealloc>::clear()
Removes all the elements from the array.
Same as resize(0).
*/
-/*! \fn void QVarLengthArray::resize(int size)
+/*! \fn template<class T, int Prealloc> void QVarLengthArray<T, Prealloc>::resize(int size)
Sets the size of the array to \a size. If \a size is greater than
the current size, elements are added to the end. If \a size is
@@ -232,7 +232,7 @@
\sa size(), squeeze()
*/
-/*! \fn int QVarLengthArray::capacity() const
+/*! \fn template<class T, int Prealloc> int QVarLengthArray<T, Prealloc>::capacity() const
Returns the maximum number of elements that can be stored in the
array without forcing a reallocation.
@@ -245,7 +245,7 @@
\sa reserve(), squeeze()
*/
-/*! \fn void QVarLengthArray::reserve(int size)
+/*! \fn template<class T, int Prealloc> void QVarLengthArray<T, Prealloc>::reserve(int size)
Attempts to allocate memory for at least \a size elements. If you
know in advance how large the array can get, you can call this
@@ -262,7 +262,7 @@
\sa capacity(), squeeze()
*/
-/*! \fn void QVarLengthArray::squeeze()
+/*! \fn template<class T, int Prealloc> void QVarLengthArray<T, Prealloc>::squeeze()
\since 5.1
Releases any memory not required to store the items.
@@ -276,7 +276,7 @@
\sa reserve(), capacity(), resize()
*/
-/*! \fn T &QVarLengthArray::operator[](int i)
+/*! \fn template<class T, int Prealloc> T &QVarLengthArray<T, Prealloc>::operator[](int i)
Returns a reference to the item at index position \a i.
@@ -286,14 +286,14 @@
\sa data(), at()
*/
-/*! \fn const T &QVarLengthArray::operator[](int i) const
+/*! \fn template<class T, int Prealloc> const T &QVarLengthArray<T, Prealloc>::operator[](int i) const
\overload
*/
/*!
- \fn void QVarLengthArray::append(const T &t)
+ \fn template<class T, int Prealloc> void QVarLengthArray<T, Prealloc>::append(const T &t)
Appends item \a t to the array, extending the array if necessary.
@@ -301,7 +301,7 @@
*/
/*!
- \fn void QVarLengthArray::push_back(const T &t)
+ \fn template<class T, int Prealloc> void QVarLengthArray<T, Prealloc>::push_back(const T &t)
\since 5.0
Appends item \a t to the array, extending the array if necessary.
@@ -309,7 +309,7 @@
*/
/*!
- \fn void QVarLengthArray::append(T &&t)
+ \fn template<class T, int Prealloc> void QVarLengthArray<T, Prealloc>::append(T &&t)
\overload append
\since 5.9
@@ -323,7 +323,7 @@
*/
/*!
- \fn void QVarLengthArray::push_back(T &&t)
+ \fn template<class T, int Prealloc> void QVarLengthArray<T, Prealloc>::push_back(T &&t)
\overload push_back
\since 5.9
@@ -337,7 +337,7 @@
*/
/*!
- \fn inline void QVarLengthArray::removeLast()
+ \fn template<class T, int Prealloc> inline void QVarLengthArray<T, Prealloc>::removeLast()
\since 4.5
Decreases the size of the array by one. The allocated size is not changed.
@@ -346,20 +346,20 @@
*/
/*!
- \fn void QVarLengthArray::pop_back()
+ \fn template<class T, int Prealloc> void QVarLengthArray<T, Prealloc>::pop_back()
\since 5.0
Same as removeLast(). Provided for STL-compatibility.
*/
/*!
- \fn void QVarLengthArray::append(const T *buf, int size)
+ \fn template<class T, int Prealloc> void QVarLengthArray<T, Prealloc>::append(const T *buf, int size)
Appends \a size amount of items referenced by \a buf to this array.
*/
-/*! \fn T *QVarLengthArray::data()
+/*! \fn template<class T, int Prealloc> T *QVarLengthArray<T, Prealloc>::data()
Returns a pointer to the data stored in the array. The pointer can
be used to access and modify the items in the array.
@@ -375,12 +375,12 @@
\sa constData(), operator[]()
*/
-/*! \fn const T *QVarLengthArray::data() const
+/*! \fn template<class T, int Prealloc> const T *QVarLengthArray<T, Prealloc>::data() const
\overload
*/
-/*! \fn const T *QVarLengthArray::constData() const
+/*! \fn template<class T, int Prealloc> const T *QVarLengthArray<T, Prealloc>::constData() const
Returns a const pointer to the data stored in the array. The
pointer can be used to access the items in the array. The
@@ -392,11 +392,11 @@
\sa data(), operator[]()
*/
-/*! \fn QVarLengthArray<T, Prealloc> &QVarLengthArray::operator=(const QVarLengthArray<T, Prealloc> &other)
+/*! \fn template<class T, int Prealloc> QVarLengthArray<T, Prealloc> &QVarLengthArray<T, Prealloc>::operator=(const QVarLengthArray<T, Prealloc> &other)
Assigns \a other to this array and returns a reference to this array.
*/
-/*! \fn QVarLengthArray<T, Prealloc> &QVarLengthArray::operator=(std::initializer_list<T> list)
+/*! \fn template<class T, int Prealloc> QVarLengthArray<T, Prealloc> &QVarLengthArray<T, Prealloc>::operator=(std::initializer_list<T> list)
\since 5.5
Assigns the values of \a list to this array, and returns a reference to this array.
@@ -405,11 +405,11 @@
lists.
*/
-/*! \fn QVarLengthArray::QVarLengthArray(const QVarLengthArray<T, Prealloc> &other)
+/*! \fn template<class T, int Prealloc> QVarLengthArray<T, Prealloc>::QVarLengthArray(const QVarLengthArray<T, Prealloc> &other)
Constructs a copy of \a other.
*/
-/*! \fn const T &QVarLengthArray::at(int i) const
+/*! \fn template<class T, int Prealloc> const T &QVarLengthArray<T, Prealloc>::at(int i) const
Returns a reference to the item at index position \a i.
@@ -419,7 +419,7 @@
\sa value(), operator[]()
*/
-/*! \fn T QVarLengthArray::value(int i) const
+/*! \fn template<class T, int Prealloc> T QVarLengthArray<T, Prealloc>::value(int i) const
Returns the value at index position \a i.
@@ -431,7 +431,7 @@
\sa at(), operator[]()
*/
-/*! \fn T QVarLengthArray::value(int i, const T &defaultValue) const
+/*! \fn template<class T, int Prealloc> T QVarLengthArray<T, Prealloc>::value(int i, const T &defaultValue) const
\overload
@@ -516,7 +516,7 @@
Typedef for \c{std::reverse_iterator<T*>}. Provided for STL compatibility.
*/
-/*! \fn void QVarLengthArray::prepend(const T &value)
+/*! \fn template<class T, int Prealloc> void QVarLengthArray<T, Prealloc>::prepend(const T &value)
\since 4.8
Inserts \a value at the beginning of the array.
@@ -533,7 +533,7 @@
\sa append(), insert()
*/
-/*! \fn void QVarLengthArray::replace(int i, const T &value)
+/*! \fn template<class T, int Prealloc> void QVarLengthArray<T, Prealloc>::replace(int i, const T &value)
\since 4.8
Replaces the item at index position \a i with \a value.
@@ -544,7 +544,7 @@
\sa operator[](), remove()
*/
-/*! \fn void QVarLengthArray::remove(int i)
+/*! \fn template<class T, int Prealloc> void QVarLengthArray<T, Prealloc>::remove(int i)
\overload
\since 4.8
@@ -554,7 +554,7 @@
\sa insert(), replace()
*/
-/*! \fn void QVarLengthArray::remove(int i, int count)
+/*! \fn template<class T, int Prealloc> void QVarLengthArray<T, Prealloc>::remove(int i, int count)
\overload
\since 4.8
@@ -565,7 +565,7 @@
\sa insert(), replace()
*/
-/*! \fn QVarLengthArray::iterator QVarLengthArray::begin()
+/*! \fn template<class T, int Prealloc> QVarLengthArray<T, Prealloc>::iterator QVarLengthArray<T, Prealloc>::begin()
\since 4.8
Returns an \l{STL-style iterators}{STL-style iterator} pointing to the first item in
@@ -574,12 +574,12 @@
\sa constBegin(), end()
*/
-/*! \fn QVarLengthArray::const_iterator QVarLengthArray::begin() const
+/*! \fn template<class T, int Prealloc> QVarLengthArray<T, Prealloc>::const_iterator QVarLengthArray<T, Prealloc>::begin() const
\since 4.8
\overload
*/
-/*! \fn QVarLengthArray::const_iterator QVarLengthArray::cbegin() const
+/*! \fn template<class T, int Prealloc> QVarLengthArray<T, Prealloc>::const_iterator QVarLengthArray<T, Prealloc>::cbegin() const
\since 5.0
Returns a const \l{STL-style iterators}{STL-style iterator} pointing to the first item
@@ -588,7 +588,7 @@
\sa begin(), cend()
*/
-/*! \fn QVarLengthArray::const_iterator QVarLengthArray::constBegin() const
+/*! \fn template<class T, int Prealloc> QVarLengthArray<T, Prealloc>::const_iterator QVarLengthArray<T, Prealloc>::constBegin() const
\since 4.8
Returns a const \l{STL-style iterators}{STL-style iterator} pointing to the first item
@@ -597,7 +597,7 @@
\sa begin(), constEnd()
*/
-/*! \fn QVarLengthArray::iterator QVarLengthArray::end()
+/*! \fn template<class T, int Prealloc> QVarLengthArray<T, Prealloc>::iterator QVarLengthArray<T, Prealloc>::end()
\since 4.8
Returns an \l{STL-style iterators}{STL-style iterator} pointing to the imaginary item
@@ -606,13 +606,13 @@
\sa begin(), constEnd()
*/
-/*! \fn QVarLengthArray::const_iterator QVarLengthArray::end() const
+/*! \fn template<class T, int Prealloc> QVarLengthArray<T, Prealloc>::const_iterator QVarLengthArray<T, Prealloc>::end() const
\since 4.8
\overload
*/
-/*! \fn QVarLengthArray::const_iterator QVarLengthArray::cend() const
+/*! \fn template<class T, int Prealloc> QVarLengthArray<T, Prealloc>::const_iterator QVarLengthArray<T, Prealloc>::cend() const
\since 5.0
Returns a const \l{STL-style iterators}{STL-style iterator} pointing to the imaginary
@@ -621,7 +621,7 @@
\sa cbegin(), end()
*/
-/*! \fn QVarLengthArray::const_iterator QVarLengthArray::constEnd() const
+/*! \fn template<class T, int Prealloc> QVarLengthArray<T, Prealloc>::const_iterator QVarLengthArray<T, Prealloc>::constEnd() const
\since 4.8
Returns a const \l{STL-style iterators}{STL-style iterator} pointing to the imaginary
@@ -630,7 +630,7 @@
\sa constBegin(), end()
*/
-/*! \fn QVarLengthArray::reverse_iterator QVarLengthArray::rbegin()
+/*! \fn template<class T, int Prealloc> QVarLengthArray<T, Prealloc>::reverse_iterator QVarLengthArray<T, Prealloc>::rbegin()
\since 5.6
Returns a \l{STL-style iterators}{STL-style} reverse iterator pointing to the first
@@ -639,12 +639,12 @@
\sa begin(), crbegin(), rend()
*/
-/*! \fn QVarLengthArray::const_reverse_iterator QVarLengthArray::rbegin() const
+/*! \fn template<class T, int Prealloc> QVarLengthArray<T, Prealloc>::const_reverse_iterator QVarLengthArray<T, Prealloc>::rbegin() const
\since 5.6
\overload
*/
-/*! \fn QVarLengthArray::const_reverse_iterator QVarLengthArray::crbegin() const
+/*! \fn template<class T, int Prealloc> QVarLengthArray<T, Prealloc>::const_reverse_iterator QVarLengthArray<T, Prealloc>::crbegin() const
\since 5.6
Returns a const \l{STL-style iterators}{STL-style} reverse iterator pointing to the first
@@ -653,7 +653,7 @@
\sa begin(), rbegin(), rend()
*/
-/*! \fn QVarLengthArray::reverse_iterator QVarLengthArray::rend()
+/*! \fn template<class T, int Prealloc> QVarLengthArray<T, Prealloc>::reverse_iterator QVarLengthArray<T, Prealloc>::rend()
\since 5.6
Returns a \l{STL-style iterators}{STL-style} reverse iterator pointing to one past
@@ -662,12 +662,12 @@
\sa end(), crend(), rbegin()
*/
-/*! \fn QVarLengthArray::const_reverse_iterator QVarLengthArray::rend() const
+/*! \fn template<class T, int Prealloc> QVarLengthArray<T, Prealloc>::const_reverse_iterator QVarLengthArray<T, Prealloc>::rend() const
\since 5.6
\overload
*/
-/*! \fn QVarLengthArray::const_reverse_iterator QVarLengthArray::crend() const
+/*! \fn template<class T, int Prealloc> QVarLengthArray<T, Prealloc>::const_reverse_iterator QVarLengthArray<T, Prealloc>::crend() const
\since 5.6
Returns a const \l{STL-style iterators}{STL-style} reverse iterator pointing to one
@@ -676,7 +676,7 @@
\sa end(), rend(), rbegin()
*/
-/*! \fn QVarLengthArray::iterator QVarLengthArray::erase(const_iterator pos)
+/*! \fn template<class T, int Prealloc> QVarLengthArray<T, Prealloc>::iterator QVarLengthArray<T, Prealloc>::erase(const_iterator pos)
\since 4.8
Removes the item pointed to by the iterator \a pos from the
@@ -686,7 +686,7 @@
\sa insert(), remove()
*/
-/*! \fn QVarLengthArray::iterator QVarLengthArray::erase(const_iterator begin, const_iterator end)
+/*! \fn template<class T, int Prealloc> QVarLengthArray<T, Prealloc>::iterator QVarLengthArray<T, Prealloc>::erase(const_iterator begin, const_iterator end)
\overload
\since 4.8
@@ -696,7 +696,7 @@
before the call.
*/
-/*! \fn void QVarLengthArray::insert(int i, const T &value)
+/*! \fn template<class T, int Prealloc> void QVarLengthArray<T, Prealloc>::insert(int i, const T &value)
\since 4.8
Inserts \a value at index position \a i in the array. If \a i is
@@ -712,7 +712,7 @@
\sa remove()
*/
-/*! \fn void QVarLengthArray::insert(int i, int count, const T &value)
+/*! \fn template<class T, int Prealloc> void QVarLengthArray<T, Prealloc>::insert(int i, int count, const T &value)
\overload
\since 4.8
@@ -721,7 +721,7 @@
vector.
*/
-/*! \fn QVarLengthArray::iterator QVarLengthArray::insert(const_iterator before, const T &value)
+/*! \fn template<class T, int Prealloc> QVarLengthArray<T, Prealloc>::iterator QVarLengthArray<T, Prealloc>::insert(const_iterator before, const T &value)
\overload
\since 4.8
@@ -730,7 +730,7 @@
\a before. Returns an iterator pointing at the inserted item.
*/
-/*! \fn QVarLengthArray::iterator QVarLengthArray::insert(const_iterator before, int count, const T &value)
+/*! \fn template<class T, int Prealloc> QVarLengthArray<T, Prealloc>::iterator QVarLengthArray<T, Prealloc>::insert(const_iterator before, int count, const T &value)
\since 4.8
Inserts \a count copies of \a value in front of the item pointed to
@@ -740,7 +740,7 @@
-/*! \fn bool operator==(const QVarLengthArray<T, Prealloc1> &left, const QVarLengthArray<T, Prealloc2> &right)
+/*! \fn template<class T, int Prealloc1, int Prealloc2> bool operator==(const QVarLengthArray<T, Prealloc1> &left, const QVarLengthArray<T, Prealloc2> &right)
\relates QVarLengthArray
\since 4.8
@@ -755,7 +755,7 @@
\sa operator!=()
*/
-/*! \fn bool operator!=(const QVarLengthArray<T, Prealloc1> &left, const QVarLengthArray<T, Prealloc2> &right)
+/*! \fn template<typename T, int Prealloc1, int Prealloc2> bool operator!=(const QVarLengthArray<T, Prealloc1> &left, const QVarLengthArray<T, Prealloc2> &right)
\relates QVarLengthArray
\since 4.8
@@ -770,7 +770,7 @@
\sa operator==()
*/
-/*! \fn bool operator<(const QVarLengthArray<T,Prealloc1> &lhs, const QVarLengthArray<T,Prealloc2> &rhs)
+/*! \fn template<typename T, int Prealloc1, int Prealloc2> bool operator<(const QVarLengthArray<T,Prealloc1> &lhs, const QVarLengthArray<T,Prealloc2> &rhs)
\since 5.6
\relates QVarLengthArray
@@ -782,7 +782,7 @@
of \c operator<().
*/
-/*! \fn bool operator<=(const QVarLengthArray<T,Prealloc1> &lhs, const QVarLengthArray<T,Prealloc2> &rhs)
+/*! \fn template<typename T, int Prealloc1, int Prealloc2> bool operator<=(const QVarLengthArray<T,Prealloc1> &lhs, const QVarLengthArray<T,Prealloc2> &rhs)
\since 5.6
\relates QVarLengthArray
@@ -794,7 +794,7 @@
of \c operator<().
*/
-/*! \fn bool operator>(const QVarLengthArray<T,Prealloc1> &lhs, const QVarLengthArray<T,Prealloc2> &rhs)
+/*! \fn template<typename T, int Prealloc1, int Prealloc2> bool operator>(const QVarLengthArray<T,Prealloc1> &lhs, const QVarLengthArray<T,Prealloc2> &rhs)
\since 5.6
\relates QVarLengthArray
@@ -806,7 +806,7 @@
of \c operator<().
*/
-/*! \fn bool operator>=(const QVarLengthArray<T,Prealloc1> &lhs, const QVarLengthArray<T,Prealloc2> &rhs)
+/*! \fn template<typename T, int Prealloc1, int Prealloc2> bool operator>=(const QVarLengthArray<T,Prealloc1> &lhs, const QVarLengthArray<T,Prealloc2> &rhs)
\since 5.6
\relates QVarLengthArray
@@ -818,7 +818,7 @@
of \c operator<().
*/
-/*! \fn QVarLengthArray &QVarLengthArray::operator<<(const T &value)
+/*! \fn template<class T, int Prealloc> QVarLengthArray &QVarLengthArray<T, Prealloc>::operator<<(const T &value)
\since 4.8
Appends \a value to the array and returns a reference to this
@@ -827,7 +827,7 @@
\sa append(), operator+=()
*/
-/*! \fn QVarLengthArray &QVarLengthArray::operator+=(const T &value)
+/*! \fn template<class T, int Prealloc> QVarLengthArray &QVarLengthArray<T, Prealloc>::operator+=(const T &value)
\since 4.8
Appends \a value to the array and returns a reference to this vector.
@@ -835,7 +835,7 @@
\sa append(), operator<<()
*/
-/*! \fn int QVarLengthArray::indexOf(const T &value, int from = 0) const
+/*! \fn template<class T, int Prealloc> int QVarLengthArray<T, Prealloc>::indexOf(const T &value, int from = 0) const
\since 5.3
Returns the index position of the first occurrence of \a value in
@@ -848,7 +848,7 @@
\sa lastIndexOf(), contains()
*/
-/*! \fn int QVarLengthArray::lastIndexOf(const T &value, int from = -1) const
+/*! \fn template<class T, int Prealloc> int QVarLengthArray<T, Prealloc>::lastIndexOf(const T &value, int from = -1) const
\since 5.3
Returns the index position of the last occurrence of the value \a
@@ -862,7 +862,7 @@
\sa indexOf(), contains()
*/
-/*! \fn bool QVarLengthArray::contains(const T &value) const
+/*! \fn template<class T, int Prealloc> bool QVarLengthArray<T, Prealloc>::contains(const T &value) const
\since 5.3
Returns \c true if the array contains an occurrence of \a value;
diff --git a/src/corelib/tools/qvector.h b/src/corelib/tools/qvector.h
index 3a3d416775..ce6e657be0 100644
--- a/src/corelib/tools/qvector.h
+++ b/src/corelib/tools/qvector.h
@@ -59,8 +59,6 @@
QT_BEGIN_NAMESPACE
-class QRegion;
-
template <typename T>
class QVector
{
@@ -291,8 +289,6 @@ public:
inline std::vector<T> toStdVector() const
{ return std::vector<T>(d->begin(), d->end()); }
private:
- friend class QRegion; // Optimization for QRegion::rects()
-
// ### Qt6: remove const from int parameters
void reallocData(const int size, const int alloc, QArrayData::AllocationOptions options = QArrayData::Default);
void reallocData(const int sz) { reallocData(sz, d->alloc); }
diff --git a/src/corelib/tools/qvector.qdoc b/src/corelib/tools/qvector.qdoc
index 61fb3d494d..1068de76d5 100644
--- a/src/corelib/tools/qvector.qdoc
+++ b/src/corelib/tools/qvector.qdoc
@@ -189,7 +189,7 @@
*/
/*!
- \fn QVector<T> QVector::mid(int pos, int length = -1) const
+ \fn template <typename T> QVector<T> QVector<T>::mid(int pos, int length = -1) const
Returns a sub-vector which contains elements from this vector,
starting at position \a pos. If \a length is -1 (the default), all
@@ -199,7 +199,7 @@
*/
-/*! \fn QVector::QVector()
+/*! \fn template <typename T> QVector<T>::QVector()
Constructs an empty vector.
@@ -207,7 +207,7 @@
*/
/*!
- \fn QVector::QVector(QVector<T> &&other)
+ \fn template <typename T> QVector<T>::QVector(QVector<T> &&other)
Move-constructs a QVector instance, making it point at the same
object that \a other was pointing to.
@@ -215,7 +215,7 @@
\since 5.2
*/
-/*! \fn QVector::QVector(int size)
+/*! \fn template <typename T> QVector<T>::QVector(int size)
Constructs a vector with an initial size of \a size elements.
@@ -225,7 +225,7 @@
\sa resize()
*/
-/*! \fn QVector::QVector(int size, const T &value)
+/*! \fn template <typename T> QVector<T>::QVector(int size, const T &value)
Constructs a vector with an initial size of \a size elements.
Each element is initialized with \a value.
@@ -233,7 +233,7 @@
\sa resize(), fill()
*/
-/*! \fn QVector::QVector(const QVector<T> &other)
+/*! \fn template <typename T> QVector<T>::QVector(const QVector<T> &other)
Constructs a copy of \a other.
@@ -246,7 +246,7 @@
\sa operator=()
*/
-/*! \fn QVector::QVector(std::initializer_list<T> args)
+/*! \fn template <typename T> QVector<T>::QVector(std::initializer_list<T> args)
\since 4.8
Constructs a vector from the std::initializer_list given by \a args.
@@ -256,33 +256,33 @@
*/
-/*! \fn QVector::~QVector()
+/*! \fn template <typename T> QVector<T>::~QVector()
Destroys the vector.
*/
-/*! \fn QVector<T> &QVector::operator=(const QVector<T> &other)
+/*! \fn template <typename T> QVector<T> &QVector<T>::operator=(const QVector<T> &other)
Assigns \a other to this vector and returns a reference to this
vector.
*/
/*!
- \fn QVector<T> &QVector::operator=(QVector<T> &&other)
+ \fn template <typename T> QVector<T> &QVector<T>::operator=(QVector<T> &&other)
Move-assigns \a other to this QVector instance.
\since 5.2
*/
-/*! \fn void QVector::swap(QVector<T> &other)
+/*! \fn template <typename T> void QVector<T>::swap(QVector<T> &other)
\since 4.8
Swaps vector \a other with this vector. This operation is very fast and
never fails.
*/
-/*! \fn bool QVector::operator==(const QVector<T> &other) const
+/*! \fn template <typename T> bool QVector<T>::operator==(const QVector<T> &other) const
Returns \c true if \a other is equal to this vector; otherwise
returns \c false.
@@ -296,7 +296,7 @@
\sa operator!=()
*/
-/*! \fn bool QVector::operator!=(const QVector<T> &other) const
+/*! \fn template <typename T> bool QVector<T>::operator!=(const QVector<T> &other) const
Returns \c true if \a other is not equal to this vector; otherwise
returns \c false.
@@ -310,7 +310,7 @@
\sa operator==()
*/
-/*! \fn bool operator<(const QVector<T> &lhs, const QVector<T> &rhs)
+/*! \fn template <typename T> bool operator<(const QVector<T> &lhs, const QVector<T> &rhs)
\since 5.6
\relates QVector
@@ -322,7 +322,7 @@
of \c operator<().
*/
-/*! \fn bool operator<=(const QVector<T> &lhs, const QVector<T> &rhs)
+/*! \fn template <typename T> bool operator<=(const QVector<T> &lhs, const QVector<T> &rhs)
\since 5.6
\relates QVector
@@ -334,7 +334,7 @@
of \c operator<().
*/
-/*! \fn bool operator>(const QVector<T> &lhs, const QVector<T> &rhs)
+/*! \fn template <typename T> bool operator>(const QVector<T> &lhs, const QVector<T> &rhs)
\since 5.6
\relates QVector
@@ -346,7 +346,7 @@
of \c operator<().
*/
-/*! \fn bool operator>=(const QVector<T> &lhs, const QVector<T> &rhs)
+/*! \fn template <typename T> bool operator>=(const QVector<T> &lhs, const QVector<T> &rhs)
\since 5.6
\relates QVector
@@ -359,7 +359,7 @@
*/
/*!
- \fn uint qHash(const QVector<T> &key, uint seed = 0)
+ \fn template <typename T> uint qHash(const QVector<T> &key, uint seed = 0)
\since 5.6
\relates QVector
@@ -369,21 +369,21 @@
This function requires qHash() to be overloaded for the value type \c T.
*/
-/*! \fn int QVector::size() const
+/*! \fn template <typename T> int QVector<T>::size() const
Returns the number of items in the vector.
\sa isEmpty(), resize()
*/
-/*! \fn bool QVector::isEmpty() const
+/*! \fn template <typename T> bool QVector<T>::isEmpty() const
Returns \c true if the vector has size 0; otherwise returns \c false.
\sa size(), resize()
*/
-/*! \fn void QVector::resize(int size)
+/*! \fn template <typename T> void QVector<T>::resize(int size)
Sets the size of the vector to \a size. If \a size is greater than the
current size, elements are added to the end; the new elements are
@@ -396,7 +396,7 @@
\sa size()
*/
-/*! \fn int QVector::capacity() const
+/*! \fn template <typename T> int QVector<T>::capacity() const
Returns the maximum number of items that can be stored in the
vector without forcing a reallocation.
@@ -409,7 +409,7 @@
\sa reserve(), squeeze()
*/
-/*! \fn void QVector::reserve(int size)
+/*! \fn template <typename T> void QVector<T>::reserve(int size)
Attempts to allocate memory for at least \a size elements. If you
know in advance how large the vector will be, you should call this
@@ -434,7 +434,7 @@
\sa squeeze(), capacity()
*/
-/*! \fn void QVector::squeeze()
+/*! \fn template <typename T> void QVector<T>::squeeze()
Releases any memory not required to store the items.
@@ -445,27 +445,27 @@
\sa reserve(), capacity()
*/
-/*! \fn void QVector::detach()
+/*! \fn template <typename T> void QVector<T>::detach()
\internal
*/
-/*! \fn bool QVector::isDetached() const
+/*! \fn template <typename T> bool QVector<T>::isDetached() const
\internal
*/
-/*! \fn void QVector::setSharable(bool sharable)
+/*! \fn template <typename T> void QVector<T>::setSharable(bool sharable)
\internal
*/
-/*! \fn bool QVector::isSharedWith(const QVector<T> &other) const
+/*! \fn template <typename T> bool QVector<T>::isSharedWith(const QVector<T> &other) const
\internal
*/
-/*! \fn T *QVector::data()
+/*! \fn template <typename T> T *QVector<T>::data()
Returns a pointer to the data stored in the vector. The pointer
can be used to access and modify the items in the vector.
@@ -482,12 +482,12 @@
\sa constData(), operator[]()
*/
-/*! \fn const T *QVector::data() const
+/*! \fn template <typename T> const T *QVector<T>::data() const
\overload
*/
-/*! \fn const T *QVector::constData() const
+/*! \fn template <typename T> const T *QVector<T>::constData() const
Returns a const pointer to the data stored in the vector. The
pointer can be used to access the items in the vector.
@@ -500,7 +500,7 @@
\sa data(), operator[]()
*/
-/*! \fn void QVector::clear()
+/*! \fn template <typename T> void QVector<T>::clear()
Removes all the elements from the vector.
@@ -517,7 +517,7 @@
\sa squeeze()
*/
-/*! \fn const T &QVector::at(int i) const
+/*! \fn template <typename T> const T &QVector<T>::at(int i) const
Returns the item at index position \a i in the vector.
@@ -527,7 +527,7 @@
\sa value(), operator[]()
*/
-/*! \fn T &QVector::operator[](int i)
+/*! \fn template <typename T> T &QVector<T>::operator[](int i)
Returns the item at index position \a i as a modifiable reference.
@@ -540,7 +540,7 @@
\sa at(), value()
*/
-/*! \fn const T &QVector::operator[](int i) const
+/*! \fn template <typename T> const T &QVector<T>::operator[](int i) const
\overload
@@ -548,7 +548,7 @@
*/
/*!
- \fn void QVector::append(const T &value)
+ \fn template <typename T> void QVector<T>::append(const T &value)
Inserts \a value at the end of the vector.
@@ -566,7 +566,7 @@
*/
/*!
- \fn void QVector::append(T &&value)
+ \fn template <typename T> void QVector<T>::append(T &&value)
\since 5.6
\overload
@@ -575,7 +575,7 @@
\snippet code/src_corelib_tools_qvector.cpp move-append
*/
-/*! \fn void QVector::append(const QVector<T> &value)
+/*! \fn template <typename T> void QVector<T>::append(const QVector<T> &value)
\overload
@@ -587,7 +587,7 @@
*/
-/*! \fn void QVector::prepend(const T &value)
+/*! \fn template <typename T> void QVector<T>::prepend(const T &value)
Inserts \a value at the beginning of the vector.
@@ -605,7 +605,7 @@
\sa append(), insert()
*/
-/*! \fn void QVector::insert(int i, const T &value)
+/*! \fn template <typename T> void QVector<T>::insert(int i, const T &value)
Inserts \a value at index position \a i in the vector. If \a i is
0, the value is prepended to the vector. If \a i is size(), the
@@ -623,7 +623,7 @@
\sa append(), prepend(), remove()
*/
-/*! \fn void QVector::insert(int i, int count, const T &value)
+/*! \fn template <typename T> void QVector<T>::insert(int i, int count, const T &value)
\overload
@@ -634,7 +634,7 @@
\snippet code/src_corelib_tools_qvector.cpp 10
*/
-/*! \fn QVector::iterator QVector::insert(iterator before, const T &value)
+/*! \fn template <typename T> QVector<T>::iterator QVector<T>::insert(iterator before, const T &value)
\overload
@@ -642,14 +642,14 @@
\a before. Returns an iterator pointing at the inserted item.
*/
-/*! \fn QVector::iterator QVector::insert(iterator before, int count, const T &value)
+/*! \fn template <typename T> QVector<T>::iterator QVector<T>::insert(iterator before, int count, const T &value)
Inserts \a count copies of \a value in front of the item pointed to
by the iterator \a before. Returns an iterator pointing at the
first of the inserted items.
*/
-/*! \fn void QVector::replace(int i, const T &value)
+/*! \fn template <typename T> void QVector<T>::replace(int i, const T &value)
Replaces the item at index position \a i with \a value.
@@ -659,7 +659,7 @@
\sa operator[](), remove()
*/
-/*! \fn void QVector::remove(int i)
+/*! \fn template <typename T> void QVector<T>::remove(int i)
\overload
@@ -668,7 +668,7 @@
\sa insert(), replace(), fill()
*/
-/*! \fn void QVector::remove(int i, int count)
+/*! \fn template <typename T> void QVector<T>::remove(int i, int count)
\overload
@@ -678,7 +678,7 @@
\sa insert(), replace(), fill()
*/
-/*! \fn void QVector::removeAt(int i)
+/*! \fn template <typename T> void QVector<T>::removeAt(int i)
\since 5.2
Removes the element at index position \a i.
@@ -692,7 +692,7 @@
\sa remove(), QList::removeAt()
*/
-/*! \fn int QVector::removeAll(const T &t)
+/*! \fn template <typename T> int QVector<T>::removeAll(const T &t)
\since 5.4
Removes all elements that compare equal to \a t from the
@@ -703,7 +703,7 @@
\sa removeOne(), QList::removeAll()
*/
-/*! \fn bool QVector::removeOne(const T &t)
+/*! \fn template <typename T> bool QVector<T>::removeOne(const T &t)
\since 5.4
Removes the first element that compares equal to \a t from the
@@ -714,7 +714,7 @@
\sa removeAll(), QList::removeOne()
*/
-/*! \fn int QVector::length() const
+/*! \fn template <typename T> int QVector<T>::length() const
\since 5.2
Same as size() and count().
@@ -724,7 +724,7 @@
\sa size(), count(), QList::length()
*/
-/*! \fn T QVector::takeAt(int i)
+/*! \fn template <typename T> T QVector<T>::takeAt(int i)
\since 5.2
Removes the element at index position \a i and returns it.
@@ -741,7 +741,7 @@
\sa takeFirst(), takeLast(), QList::takeAt()
*/
-/*! \fn void QVector::move(int from, int to)
+/*! \fn template <typename T> void QVector<T>::move(int from, int to)
\since 5.6
Moves the item at index position \a from to index position \a to.
@@ -751,7 +751,7 @@
\sa QList::move()
*/
-/*! \fn void QVector::removeFirst()
+/*! \fn template <typename T> void QVector<T>::removeFirst()
\since 5.1
Removes the first item in the vector. Calling this function is
equivalent to calling remove(0). The vector must not be empty. If
@@ -761,7 +761,7 @@
\sa remove(), takeFirst(), isEmpty()
*/
-/*! \fn void QVector::removeLast()
+/*! \fn template <typename T> void QVector<T>::removeLast()
\since 5.1
Removes the last item in the vector. Calling this function is
equivalent to calling remove(size() - 1). The vector must not be
@@ -771,7 +771,7 @@
\sa remove(), takeLast(), removeFirst(), isEmpty()
*/
-/*! \fn T QVector::takeFirst()
+/*! \fn template <typename T> T QVector<T>::takeFirst()
\since 5.1
Removes the first item in the vector and returns it. This function
@@ -781,7 +781,7 @@
\sa takeLast(), removeFirst()
*/
-/*! \fn T QVector::takeLast()
+/*! \fn template <typename T> T QVector<T>::takeLast()
\since 5.1
Removes the last item in the list and returns it. This function
@@ -795,7 +795,7 @@
*/
-/*! \fn QVector &QVector::fill(const T &value, int size = -1)
+/*! \fn template <typename T> QVector &QVector<T>::fill(const T &value, int size = -1)
Assigns \a value to all items in the vector. If \a size is
different from -1 (the default), the vector is resized to size \a
@@ -807,7 +807,7 @@
\sa resize()
*/
-/*! \fn int QVector::indexOf(const T &value, int from = 0) const
+/*! \fn template <typename T> int QVector<T>::indexOf(const T &value, int from = 0) const
Returns the index position of the first occurrence of \a value in
the vector, searching forward from index position \a from.
@@ -822,7 +822,7 @@
\sa lastIndexOf(), contains()
*/
-/*! \fn int QVector::lastIndexOf(const T &value, int from = -1) const
+/*! \fn template <typename T> int QVector<T>::lastIndexOf(const T &value, int from = -1) const
Returns the index position of the last occurrence of the value \a
value in the vector, searching backward from index position \a
@@ -838,7 +838,7 @@
\sa indexOf()
*/
-/*! \fn bool QVector::contains(const T &value) const
+/*! \fn template <typename T> bool QVector<T>::contains(const T &value) const
Returns \c true if the vector contains an occurrence of \a value;
otherwise returns \c false.
@@ -849,7 +849,7 @@
\sa indexOf(), count()
*/
-/*! \fn bool QVector::startsWith(const T &value) const
+/*! \fn template <typename T> bool QVector<T>::startsWith(const T &value) const
\since 4.5
Returns \c true if this vector is not empty and its first
@@ -858,7 +858,7 @@
\sa isEmpty(), first()
*/
-/*! \fn bool QVector::endsWith(const T &value) const
+/*! \fn template <typename T> bool QVector<T>::endsWith(const T &value) const
\since 4.5
Returns \c true if this vector is not empty and its last
@@ -868,7 +868,7 @@
*/
-/*! \fn int QVector::count(const T &value) const
+/*! \fn template <typename T> int QVector<T>::count(const T &value) const
Returns the number of occurrences of \a value in the vector.
@@ -878,14 +878,14 @@
\sa contains(), indexOf()
*/
-/*! \fn int QVector::count() const
+/*! \fn template <typename T> int QVector<T>::count() const
\overload
Same as size().
*/
-/*! \fn QVector::iterator QVector::begin()
+/*! \fn template <typename T> QVector<T>::iterator QVector<T>::begin()
Returns an \l{STL-style iterators}{STL-style iterator} pointing to the first item in
the vector.
@@ -893,12 +893,12 @@
\sa constBegin(), end()
*/
-/*! \fn QVector::const_iterator QVector::begin() const
+/*! \fn template <typename T> QVector<T>::const_iterator QVector<T>::begin() const
\overload
*/
-/*! \fn QVector::const_iterator QVector::cbegin() const
+/*! \fn template <typename T> QVector<T>::const_iterator QVector<T>::cbegin() const
\since 5.0
Returns a const \l{STL-style iterators}{STL-style iterator} pointing to the first item
@@ -907,7 +907,7 @@
\sa begin(), cend()
*/
-/*! \fn QVector::const_iterator QVector::constBegin() const
+/*! \fn template <typename T> QVector<T>::const_iterator QVector<T>::constBegin() const
Returns a const \l{STL-style iterators}{STL-style iterator} pointing to the first item
in the vector.
@@ -915,7 +915,7 @@
\sa begin(), constEnd()
*/
-/*! \fn QVector::iterator QVector::end()
+/*! \fn template <typename T> QVector<T>::iterator QVector<T>::end()
Returns an \l{STL-style iterators}{STL-style iterator} pointing to the imaginary item
after the last item in the vector.
@@ -923,12 +923,12 @@
\sa begin(), constEnd()
*/
-/*! \fn QVector::const_iterator QVector::end() const
+/*! \fn template <typename T> QVector<T>::const_iterator QVector<T>::end() const
\overload
*/
-/*! \fn QVector::const_iterator QVector::cend() const
+/*! \fn template <typename T> QVector<T>::const_iterator QVector<T>::cend() const
\since 5.0
Returns a const \l{STL-style iterators}{STL-style iterator} pointing to the imaginary
@@ -937,7 +937,7 @@
\sa cbegin(), end()
*/
-/*! \fn QVector::const_iterator QVector::constEnd() const
+/*! \fn template <typename T> QVector<T>::const_iterator QVector<T>::constEnd() const
Returns a const \l{STL-style iterators}{STL-style iterator} pointing to the imaginary
item after the last item in the vector.
@@ -945,7 +945,7 @@
\sa constBegin(), end()
*/
-/*! \fn QVector::reverse_iterator QVector::rbegin()
+/*! \fn template <typename T> QVector<T>::reverse_iterator QVector<T>::rbegin()
\since 5.6
Returns a \l{STL-style iterators}{STL-style} reverse iterator pointing to the first
@@ -954,12 +954,12 @@
\sa begin(), crbegin(), rend()
*/
-/*! \fn QVector::const_reverse_iterator QVector::rbegin() const
+/*! \fn template <typename T> QVector<T>::const_reverse_iterator QVector<T>::rbegin() const
\since 5.6
\overload
*/
-/*! \fn QVector::const_reverse_iterator QVector::crbegin() const
+/*! \fn template <typename T> QVector<T>::const_reverse_iterator QVector<T>::crbegin() const
\since 5.6
Returns a const \l{STL-style iterators}{STL-style} reverse iterator pointing to the first
@@ -968,7 +968,7 @@
\sa begin(), rbegin(), rend()
*/
-/*! \fn QVector::reverse_iterator QVector::rend()
+/*! \fn template <typename T> QVector<T>::reverse_iterator QVector<T>::rend()
\since 5.6
Returns a \l{STL-style iterators}{STL-style} reverse iterator pointing to one past
@@ -977,12 +977,12 @@
\sa end(), crend(), rbegin()
*/
-/*! \fn QVector::const_reverse_iterator QVector::rend() const
+/*! \fn template <typename T> QVector<T>::const_reverse_iterator QVector<T>::rend() const
\since 5.6
\overload
*/
-/*! \fn QVector::const_reverse_iterator QVector::crend() const
+/*! \fn template <typename T> QVector<T>::const_reverse_iterator QVector<T>::crend() const
\since 5.6
Returns a const \l{STL-style iterators}{STL-style} reverse iterator pointing to one
@@ -991,7 +991,7 @@
\sa end(), rend(), rbegin()
*/
-/*! \fn QVector::iterator QVector::erase(iterator pos)
+/*! \fn template <typename T> QVector<T>::iterator QVector<T>::erase(iterator pos)
Removes the item pointed to by the iterator \a pos from the
vector, and returns an iterator to the next item in the vector
@@ -1000,7 +1000,7 @@
\sa insert(), remove()
*/
-/*! \fn QVector::iterator QVector::erase(iterator begin, iterator end)
+/*! \fn template <typename T> QVector<T>::iterator QVector<T>::erase(iterator begin, iterator end)
\overload
@@ -1009,7 +1009,7 @@
before the call.
*/
-/*! \fn T& QVector::first()
+/*! \fn template <typename T> T& QVector<T>::first()
Returns a reference to the first item in the vector. This
function assumes that the vector isn't empty.
@@ -1017,12 +1017,12 @@
\sa last(), isEmpty(), constFirst()
*/
-/*! \fn const T& QVector::first() const
+/*! \fn template <typename T> const T& QVector<T>::first() const
\overload
*/
-/*! \fn const T& QVector::constFirst() const
+/*! \fn template <typename T> const T& QVector<T>::constFirst() const
\since 5.6
Returns a const reference to the first item in the vector. This
@@ -1031,7 +1031,7 @@
\sa constLast(), isEmpty(), first()
*/
-/*! \fn T& QVector::last()
+/*! \fn template <typename T> T& QVector<T>::last()
Returns a reference to the last item in the vector. This function
assumes that the vector isn't empty.
@@ -1039,12 +1039,12 @@
\sa first(), isEmpty(), constLast()
*/
-/*! \fn const T& QVector::last() const
+/*! \fn template <typename T> const T& QVector<T>::last() const
\overload
*/
-/*! \fn const T& QVector::constLast() const
+/*! \fn template <typename T> const T& QVector<T>::constLast() const
\since 5.6
Returns a const reference to the last item in the vector. This function
@@ -1053,7 +1053,7 @@
\sa constFirst(), isEmpty(), last()
*/
-/*! \fn T QVector::value(int i) const
+/*! \fn template <typename T> T QVector<T>::value(int i) const
Returns the value at index position \a i in the vector.
@@ -1065,7 +1065,7 @@
\sa at(), operator[]()
*/
-/*! \fn T QVector::value(int i, const T &defaultValue) const
+/*! \fn template <typename T> T QVector<T>::value(int i, const T &defaultValue) const
\overload
@@ -1073,72 +1073,72 @@
\a defaultValue.
*/
-/*! \fn void QVector::push_back(const T &value)
+/*! \fn template <typename T> void QVector<T>::push_back(const T &value)
This function is provided for STL compatibility. It is equivalent
to append(\a value).
*/
-/*! \fn void QVector::push_back(T &&value)
+/*! \fn template <typename T> void QVector<T>::push_back(T &&value)
\since 5.6
\overload
*/
-/*! \fn void QVector::push_front(const T &value)
+/*! \fn template <typename T> void QVector<T>::push_front(const T &value)
This function is provided for STL compatibility. It is equivalent
to prepend(\a value).
*/
-/*! \fn void QVector::pop_front()
+/*! \fn template <typename T> void QVector<T>::pop_front()
This function is provided for STL compatibility. It is equivalent
to removeFirst().
*/
-/*! \fn void QVector::pop_back()
+/*! \fn template <typename T> void QVector<T>::pop_back()
This function is provided for STL compatibility. It is equivalent
to removeLast().
*/
-/*! \fn T& QVector::front()
+/*! \fn template <typename T> T& QVector<T>::front()
This function is provided for STL compatibility. It is equivalent
to first().
*/
-/*! \fn QVector::const_reference QVector::front() const
+/*! \fn template <typename T> QVector<T>::const_reference QVector<T>::front() const
\overload
*/
-/*! \fn QVector::reference QVector::back()
+/*! \fn template <typename T> QVector<T>::reference QVector<T>::back()
This function is provided for STL compatibility. It is equivalent
to last().
*/
-/*! \fn QVector::const_reference QVector::back() const
+/*! \fn template <typename T> QVector<T>::const_reference QVector<T>::back() const
\overload
*/
-/*! \fn void QVector::shrink_to_fit()
+/*! \fn template <typename T> void QVector<T>::shrink_to_fit()
\since 5.10
This function is provided for STL compatibility. It is equivalent
to squeeze().
*/
-/*! \fn bool QVector::empty() const
+/*! \fn template <typename T> bool QVector<T>::empty() const
This function is provided for STL compatibility. It is equivalent
to isEmpty(), returning \c true if the vector is empty; otherwise
returns \c false.
*/
-/*! \fn QVector<T> &QVector::operator+=(const QVector<T> &other)
+/*! \fn template <typename T> QVector<T> &QVector<T>::operator+=(const QVector<T> &other)
Appends the items of the \a other vector to this vector and
returns a reference to this vector.
@@ -1146,7 +1146,7 @@
\sa operator+(), append()
*/
-/*! \fn void QVector::operator+=(const T &value)
+/*! \fn template <typename T> void QVector<T>::operator+=(const T &value)
\overload
@@ -1155,7 +1155,7 @@
\sa append(), operator<<()
*/
-/*! \fn QVector<T> QVector::operator+(const QVector<T> &other) const
+/*! \fn template <typename T> QVector<T> QVector<T>::operator+(const QVector<T> &other) const
Returns a vector that contains all the items in this vector
followed by all the items in the \a other vector.
@@ -1163,7 +1163,7 @@
\sa operator+=()
*/
-/*! \fn QVector<T> &QVector::operator<<(const T &value)
+/*! \fn template <typename T> QVector<T> &QVector<T>::operator<<(const T &value)
Appends \a value to the vector and returns a reference to this
vector.
@@ -1171,7 +1171,7 @@
\sa append(), operator+=()
*/
-/*! \fn QVector<T> &QVector::operator<<(const QVector<T> &other)
+/*! \fn template <typename T> QVector<T> &QVector<T>::operator<<(const QVector<T> &other)
Appends \a other to the vector and returns a reference to the
vector.
@@ -1288,7 +1288,7 @@
Typedef for T. Provided for STL compatibility.
*/
-/*! \fn QList<T> QVector<T>::toList() const
+/*! \fn template <typename T> QList<T> QVector<T>::toList() const
Returns a QList object with the data contained in this QVector.
@@ -1299,7 +1299,7 @@
\sa fromList(), QList::fromVector()
*/
-/*! \fn QVector<T> QVector<T>::fromList(const QList<T> &list)
+/*! \fn template <typename T> QVector<T> QVector<T>::fromList(const QList<T> &list)
Returns a QVector object with the data contained in \a list.
@@ -1310,7 +1310,7 @@
\sa toList(), QList::toVector()
*/
-/*! \fn QVector<T> QVector<T>::fromStdVector(const std::vector<T> &vector)
+/*! \fn template <typename T> QVector<T> QVector<T>::fromStdVector(const std::vector<T> &vector)
Returns a QVector object with the data contained in \a vector. The
order of the elements in the QVector is the same as in \a vector.
@@ -1322,7 +1322,7 @@
\sa toStdVector(), QList::fromStdList()
*/
-/*! \fn std::vector<T> QVector<T>::toStdVector() const
+/*! \fn template <typename T> std::vector<T> QVector<T>::toStdVector() const
Returns a std::vector object with the data contained in this QVector.
Example:
@@ -1332,7 +1332,7 @@
\sa fromStdVector(), QList::toStdList()
*/
-/*! \fn QDataStream &operator<<(QDataStream &out, const QVector<T> &vector)
+/*! \fn template <typename T> QDataStream &operator<<(QDataStream &out, const QVector<T> &vector)
\relates QVector
Writes the vector \a vector to stream \a out.
@@ -1342,7 +1342,7 @@
\sa{Serializing Qt Data Types}{Format of the QDataStream operators}
*/
-/*! \fn QDataStream &operator>>(QDataStream &in, QVector<T> &vector)
+/*! \fn template <typename T> QDataStream &operator>>(QDataStream &in, QVector<T> &vector)
\relates QVector
Reads a vector from stream \a in into \a vector.
diff --git a/src/corelib/tools/qversionnumber.h b/src/corelib/tools/qversionnumber.h
index 3836bc2119..1bfb4aab39 100644
--- a/src/corelib/tools/qversionnumber.h
+++ b/src/corelib/tools/qversionnumber.h
@@ -281,7 +281,7 @@ public:
Q_REQUIRED_RESULT Q_CORE_EXPORT QString toString() const;
#if QT_STRINGVIEW_LEVEL < 2
- Q_REQUIRED_RESULT Q_CORE_EXPORT static Q_DECL_PURE_FUNCTION QVersionNumber fromString(const QString &string, int *suffixIndex = Q_NULLPTR);
+ Q_REQUIRED_RESULT Q_CORE_EXPORT static Q_DECL_PURE_FUNCTION QVersionNumber fromString(const QString &string, int *suffixIndex = nullptr);
#endif
Q_REQUIRED_RESULT Q_CORE_EXPORT static Q_DECL_PURE_FUNCTION QVersionNumber fromString(QLatin1String string, int *suffixIndex = nullptr);
Q_REQUIRED_RESULT Q_CORE_EXPORT static Q_DECL_PURE_FUNCTION QVersionNumber fromString(QStringView string, int *suffixIndex = nullptr);
diff --git a/src/corelib/tools/tools.pri b/src/corelib/tools/tools.pri
index 2c609098ea..56b30279bd 100644
--- a/src/corelib/tools/tools.pri
+++ b/src/corelib/tools/tools.pri
@@ -223,4 +223,3 @@ TR_EXCLUDE += ../3rdparty/*
# MIPS DSP
MIPS_DSP_ASM += tools/qstring_mips_dsp_asm.S
MIPS_DSP_HEADERS += ../gui/painting/qt_mips_asm_dsp_p.h
-CONFIG += simd
diff --git a/src/corelib/xml/qxmlstream.cpp b/src/corelib/xml/qxmlstream.cpp
index ef5fafbd76..9b5295a17e 100644
--- a/src/corelib/xml/qxmlstream.cpp
+++ b/src/corelib/xml/qxmlstream.cpp
@@ -2980,7 +2980,8 @@ public:
uint inEmptyElement :1;
uint lastWasStartElement :1;
uint wroteSomething :1;
- uint hasError :1;
+ uint hasIoError :1;
+ uint hasEncodingError :1;
uint autoFormatting :1;
uint isCodecASCIICompatible :1;
QByteArray autoFormattingIndent;
@@ -3016,7 +3017,8 @@ QXmlStreamWriterPrivate::QXmlStreamWriterPrivate(QXmlStreamWriter *q)
checkIfASCIICompatibleCodec();
inStartElement = inEmptyElement = false;
wroteSomething = false;
- hasError = false;
+ hasIoError = false;
+ hasEncodingError = false;
lastWasStartElement = false;
lastNamespaceDeclaration = 1;
autoFormatting = false;
@@ -3043,15 +3045,19 @@ void QXmlStreamWriterPrivate::checkIfASCIICompatibleCodec()
void QXmlStreamWriterPrivate::write(const QStringRef &s)
{
if (device) {
- if (hasError)
+ if (hasIoError)
return;
#ifdef QT_NO_TEXTCODEC
QByteArray bytes = s.toLatin1();
#else
QByteArray bytes = encoder->fromUnicode(s.constData(), s.size());
+ if (encoder->hasFailure()) {
+ hasEncodingError = true;
+ return;
+ }
#endif
if (device->write(bytes) != bytes.size())
- hasError = true;
+ hasIoError = true;
}
else if (stringDevice)
s.appendTo(stringDevice);
@@ -3062,15 +3068,19 @@ void QXmlStreamWriterPrivate::write(const QStringRef &s)
void QXmlStreamWriterPrivate::write(const QString &s)
{
if (device) {
- if (hasError)
+ if (hasIoError)
return;
#ifdef QT_NO_TEXTCODEC
QByteArray bytes = s.toLatin1();
#else
QByteArray bytes = encoder->fromUnicode(s);
+ if (encoder->hasFailure()) {
+ hasEncodingError = true;
+ return;
+ }
#endif
if (device->write(bytes) != bytes.size())
- hasError = true;
+ hasIoError = true;
}
else if (stringDevice)
stringDevice->append(s);
@@ -3084,25 +3094,47 @@ void QXmlStreamWriterPrivate::writeEscaped(const QString &s, bool escapeWhitespa
escaped.reserve(s.size());
for ( int i = 0; i < s.size(); ++i ) {
QChar c = s.at(i);
- if (c.unicode() == '<' )
+ switch (c.unicode()) {
+ case '<':
escaped.append(QLatin1String("&lt;"));
- else if (c.unicode() == '>' )
+ break;
+ case '>':
escaped.append(QLatin1String("&gt;"));
- else if (c.unicode() == '&' )
+ break;
+ case '&':
escaped.append(QLatin1String("&amp;"));
- else if (c.unicode() == '\"' )
+ break;
+ case '\"':
escaped.append(QLatin1String("&quot;"));
- else if (escapeWhitespace && c.isSpace()) {
- if (c.unicode() == '\n')
+ break;
+ case '\t':
+ if (escapeWhitespace)
+ escaped.append(QLatin1String("&#9;"));
+ else
+ escaped += c;
+ break;
+ case '\n':
+ if (escapeWhitespace)
escaped.append(QLatin1String("&#10;"));
- else if (c.unicode() == '\r')
+ else
+ escaped += c;
+ break;
+ case '\v':
+ case '\f':
+ hasEncodingError = true;
+ break;
+ case '\r':
+ if (escapeWhitespace)
escaped.append(QLatin1String("&#13;"));
- else if (c.unicode() == '\t')
- escaped.append(QLatin1String("&#9;"));
else
escaped += c;
- } else {
- escaped += QChar(c);
+ break;
+ default:
+ if (c.unicode() > 0x1f && c.unicode() < 0xfffe)
+ escaped += c;
+ else
+ hasEncodingError = true;
+ break;
}
}
write(escaped);
@@ -3112,11 +3144,11 @@ void QXmlStreamWriterPrivate::writeEscaped(const QString &s, bool escapeWhitespa
void QXmlStreamWriterPrivate::write(const char *s, int len)
{
if (device) {
- if (hasError)
+ if (hasIoError)
return;
if (isCodecASCIICompatible) {
if (device->write(s, len) != len)
- hasError = true;
+ hasIoError = true;
return;
}
}
@@ -3400,15 +3432,18 @@ int QXmlStreamWriter::autoFormattingIndent() const
}
/*!
- Returns \c true if the stream failed to write to the underlying device.
+ Returns \c true if writing failed.
+
+ This can happen if the stream failed to write to the underlying
+ device or if the data to be written contained invalid characters.
The error status is never reset. Writes happening after the error
- occurred are ignored, even if the error condition is cleared.
+ occurred may be ignored, even if the error condition is cleared.
*/
bool QXmlStreamWriter::hasError() const
{
Q_D(const QXmlStreamWriter);
- return d->hasError;
+ return d->hasIoError || d->hasEncodingError;
}
/*!
diff --git a/src/corelib/xml/qxmlstream.h b/src/corelib/xml/qxmlstream.h
index bf6ddefcdd..2350d12dd6 100644
--- a/src/corelib/xml/qxmlstream.h
+++ b/src/corelib/xml/qxmlstream.h
@@ -120,7 +120,7 @@ public:
reserved(other.reserved),
m_isDefault(other.m_isDefault)
{
- other.reserved = Q_NULLPTR;
+ other.reserved = nullptr;
}
QXmlStreamAttribute &operator=(QXmlStreamAttribute &&other) Q_DECL_NOTHROW // = default;
{
diff --git a/src/dbus/qdbusabstractinterface.cpp b/src/dbus/qdbusabstractinterface.cpp
index 9f2e688ebb..50a0483231 100644
--- a/src/dbus/qdbusabstractinterface.cpp
+++ b/src/dbus/qdbusabstractinterface.cpp
@@ -70,10 +70,10 @@ class DisconnectRelayEvent : public QMetaCallEvent
{
public:
DisconnectRelayEvent(QObject *sender, const QMetaMethod &m)
- : QMetaCallEvent(0, 0, Q_NULLPTR, sender, m.methodIndex())
+ : QMetaCallEvent(0, 0, nullptr, sender, m.methodIndex())
{}
- void placeMetaCall(QObject *object) Q_DECL_OVERRIDE
+ void placeMetaCall(QObject *object) override
{
QDBusAbstractInterface *iface = static_cast<QDBusAbstractInterface *>(object);
QDBusAbstractInterfacePrivate::finishDisconnectNotify(iface, signalId());
diff --git a/src/dbus/qdbusabstractinterface.h b/src/dbus/qdbusabstractinterface.h
index f859c5ee7d..d6b0870787 100644
--- a/src/dbus/qdbusabstractinterface.h
+++ b/src/dbus/qdbusabstractinterface.h
@@ -67,7 +67,7 @@ class QDBusAbstractInterfacePrivate;
class Q_DBUS_EXPORT QDBusAbstractInterfaceBase: public QObject
{
public:
- int qt_metacall(QMetaObject::Call, int, void**) Q_DECL_OVERRIDE;
+ int qt_metacall(QMetaObject::Call, int, void**) override;
protected:
QDBusAbstractInterfaceBase(QDBusAbstractInterfacePrivate &dd, QObject *parent);
private:
@@ -147,8 +147,8 @@ protected:
const QDBusConnection &connection, QObject *parent);
QDBusAbstractInterface(QDBusAbstractInterfacePrivate &, QObject *parent);
- void connectNotify(const QMetaMethod &signal) Q_DECL_OVERRIDE;
- void disconnectNotify(const QMetaMethod &signal) Q_DECL_OVERRIDE;
+ void connectNotify(const QMetaMethod &signal) override;
+ void disconnectNotify(const QMetaMethod &signal) override;
QVariant internalPropGet(const char *propname) const;
void internalPropSet(const char *propname, const QVariant &value);
QDBusMessage internalConstCall(QDBus::CallMode mode,
diff --git a/src/dbus/qdbusargument.cpp b/src/dbus/qdbusargument.cpp
index df2817ca77..d7f9dcc718 100644
--- a/src/dbus/qdbusargument.cpp
+++ b/src/dbus/qdbusargument.cpp
@@ -1374,6 +1374,12 @@ QDBusArgument &operator<<(QDBusArgument &a, const QLineF &line)
}
#endif
+/*!
+ \fn void QDBusArgument::swap(QDBusArgument &other)
+
+ Swaps this QDBusArgument instance with \a other.
+*/
+
QT_END_NAMESPACE
#endif // QT_NO_DBUS
diff --git a/src/dbus/qdbusargument.h b/src/dbus/qdbusargument.h
index 5342a79227..a6d4e9cd25 100644
--- a/src/dbus/qdbusargument.h
+++ b/src/dbus/qdbusargument.h
@@ -77,7 +77,7 @@ public:
QDBusArgument();
QDBusArgument(const QDBusArgument &other);
#ifdef Q_COMPILER_RVALUE_REFS
- QDBusArgument(QDBusArgument &&other) Q_DECL_NOTHROW : d(other.d) { other.d = Q_NULLPTR; }
+ QDBusArgument(QDBusArgument &&other) Q_DECL_NOTHROW : d(other.d) { other.d = nullptr; }
QDBusArgument &operator=(QDBusArgument &&other) Q_DECL_NOTHROW { swap(other); return *this; }
#endif
QDBusArgument &operator=(const QDBusArgument &other);
@@ -160,7 +160,7 @@ QT_BEGIN_NAMESPACE
template<typename T> inline T qdbus_cast(const QDBusArgument &arg
#ifndef Q_QDOC
-, T * = Q_NULLPTR
+, T * = nullptr
#endif
)
{
@@ -171,7 +171,7 @@ template<typename T> inline T qdbus_cast(const QDBusArgument &arg
template<typename T> inline T qdbus_cast(const QVariant &v
#ifndef Q_QDOC
-, T * = Q_NULLPTR
+, T * = nullptr
#endif
)
{
diff --git a/src/dbus/qdbusconnection.cpp b/src/dbus/qdbusconnection.cpp
index 75c1e92f96..2c2dfc1ff6 100644
--- a/src/dbus/qdbusconnection.cpp
+++ b/src/dbus/qdbusconnection.cpp
@@ -147,7 +147,7 @@ QDBusConnectionManager::QDBusConnectionManager()
// prevent the library from being unloaded on Windows. See comments in the function.
preventDllUnload();
#endif
- defaultBuses[0] = defaultBuses[1] = Q_NULLPTR;
+ defaultBuses[0] = defaultBuses[1] = nullptr;
start();
}
@@ -186,13 +186,13 @@ void QDBusConnectionManager::run()
delete d;
} else {
d->closeConnection();
- d->moveToThread(Q_NULLPTR); // allow it to be deleted in another thread
+ d->moveToThread(nullptr); // allow it to be deleted in another thread
}
}
connectionHash.clear();
// allow deletion from any thread without warning
- moveToThread(Q_NULLPTR);
+ moveToThread(nullptr);
}
QDBusConnectionPrivate *QDBusConnectionManager::connectToBus(QDBusConnection::BusType type, const QString &name,
@@ -1175,7 +1175,7 @@ bool QDBusConnection::unregisterService(const QString &serviceName)
QDBusConnection QDBusConnection::sessionBus()
{
if (_q_manager.isDestroyed())
- return QDBusConnection(Q_NULLPTR);
+ return QDBusConnection(nullptr);
return QDBusConnection(_q_manager()->busConnection(SessionBus));
}
@@ -1189,7 +1189,7 @@ QDBusConnection QDBusConnection::sessionBus()
QDBusConnection QDBusConnection::systemBus()
{
if (_q_manager.isDestroyed())
- return QDBusConnection(Q_NULLPTR);
+ return QDBusConnection(nullptr);
return QDBusConnection(_q_manager()->busConnection(SystemBus));
}
@@ -1272,6 +1272,12 @@ QByteArray QDBusConnection::localMachineId()
When using BlockWithGui, applications must be prepared for reentrancy in any function.
*/
+/*!
+ \fn void QDBusConnection::swap(QDBusConnection &other)
+
+ Swaps this QDBusConnection instance with \a other.
+*/
+
QT_END_NAMESPACE
#ifdef Q_OS_WIN
diff --git a/src/dbus/qdbusconnection.h b/src/dbus/qdbusconnection.h
index ba28938b60..0352978989 100644
--- a/src/dbus/qdbusconnection.h
+++ b/src/dbus/qdbusconnection.h
@@ -130,7 +130,7 @@ public:
explicit QDBusConnection(const QString &name);
QDBusConnection(const QDBusConnection &other);
#ifdef Q_COMPILER_RVALUE_REFS
- QDBusConnection(QDBusConnection &&other) Q_DECL_NOTHROW : d(other.d) { other.d = Q_NULLPTR; }
+ QDBusConnection(QDBusConnection &&other) Q_DECL_NOTHROW : d(other.d) { other.d = nullptr; }
QDBusConnection &operator=(QDBusConnection &&other) Q_DECL_NOTHROW { swap(other); return *this; }
#endif
QDBusConnection &operator=(const QDBusConnection &other);
diff --git a/src/dbus/qdbusconnection_p.h b/src/dbus/qdbusconnection_p.h
index d323088779..3043d7378c 100644
--- a/src/dbus/qdbusconnection_p.h
+++ b/src/dbus/qdbusconnection_p.h
@@ -59,7 +59,6 @@
#include <QtCore/qatomic.h>
#include <QtCore/qhash.h>
-#include <QtCore/qmutex.h>
#include <QtCore/qobject.h>
#include <QtCore/qpointer.h>
#include <QtCore/qreadwritelock.h>
@@ -198,7 +197,6 @@ public:
~QDBusConnectionPrivate();
void createBusService();
- void setDispatchEnabled(bool enable);
void setPeer(DBusConnection *connection, const QDBusErrorInternal &error);
void setConnection(DBusConnection *connection, const QDBusErrorInternal &error);
void setServer(QDBusServer *object, DBusServer *server, const QDBusErrorInternal &error);
@@ -271,10 +269,11 @@ private:
void _q_newConnection(QDBusConnectionPrivate *newConnection);
protected:
- void timerEvent(QTimerEvent *e) Q_DECL_OVERRIDE;
+ void timerEvent(QTimerEvent *e) override;
public slots:
// public slots
+ void setDispatchEnabled(bool enable);
void doDispatch();
void socketRead(int);
void socketWrite(int);
@@ -312,9 +311,6 @@ public:
QDBusServer *serverObject;
};
- // the dispatch lock protects everything related to the DBusConnection or DBusServer
- // including the timeouts and watches
- QMutex dispatchLock;
union {
DBusConnection *connection;
DBusServer *server;
@@ -390,7 +386,9 @@ public:
public slots:
void execute()
{
- con->setDispatchEnabled(true);
+ // This call cannot race with something disabling dispatch only because dispatch is
+ // never re-disabled from Qt code on an in-use connection once it has been enabled.
+ QMetaObject::invokeMethod(con, "setDispatchEnabled", Qt::QueuedConnection, Q_ARG(bool, true));
if (!con->ref.deref())
con->deleteLater();
deleteLater();
diff --git a/src/dbus/qdbusconnectioninterface.h b/src/dbus/qdbusconnectioninterface.h
index 37f35dbe81..c7b1573722 100644
--- a/src/dbus/qdbusconnectioninterface.h
+++ b/src/dbus/qdbusconnectioninterface.h
@@ -115,8 +115,8 @@ Q_SIGNALS:
void NameLost(const QString &);
void NameOwnerChanged(const QString &, const QString &, const QString &);
protected:
- void connectNotify(const QMetaMethod &) Q_DECL_OVERRIDE;
- void disconnectNotify(const QMetaMethod &) Q_DECL_OVERRIDE;
+ void connectNotify(const QMetaMethod &) override;
+ void disconnectNotify(const QMetaMethod &) override;
#endif
};
diff --git a/src/dbus/qdbusconnectionmanager_p.h b/src/dbus/qdbusconnectionmanager_p.h
index 1c7dea811d..ac49683cee 100644
--- a/src/dbus/qdbusconnectionmanager_p.h
+++ b/src/dbus/qdbusconnectionmanager_p.h
@@ -85,7 +85,7 @@ signals:
void serverRequested(const QString &address, void *server);
protected:
- void run() Q_DECL_OVERRIDE;
+ void run() override;
private:
void executeConnectionRequest(ConnectionRequestData *data);
diff --git a/src/dbus/qdbuserror.cpp b/src/dbus/qdbuserror.cpp
index c599df6a32..e966f9dcde 100644
--- a/src/dbus/qdbuserror.cpp
+++ b/src/dbus/qdbuserror.cpp
@@ -409,6 +409,12 @@ QDebug operator<<(QDebug dbg, const QDBusError &msg)
}
#endif
+/*!
+ \fn void QDBusError::swap(QDBusError &other)
+
+ Swaps this QDBusError instance with \a other.
+*/
+
QT_END_NAMESPACE
#endif // QT_NO_DBUS
diff --git a/src/dbus/qdbusextratypes.cpp b/src/dbus/qdbusextratypes.cpp
index 964daac6d9..a0b121a1a3 100644
--- a/src/dbus/qdbusextratypes.cpp
+++ b/src/dbus/qdbusextratypes.cpp
@@ -218,6 +218,24 @@ void QDBusSignature::doCheck()
\sa signature()
*/
+/*!
+ \fn void QDBusObjectPath::swap(QDBusObjectPath &other)
+
+ Swaps this QDBusObjectPath instance with \a other.
+*/
+
+/*!
+ \fn void QDBusSignature::swap(QDBusSignature &other)
+
+ Swaps this QDBusSignature instance with \a other.
+*/
+
+/*!
+ \fn void QDBusVariant::swap(QDBusVariant &other)
+
+ Swaps this QDBusVariant instance with \a other.
+*/
+
QT_END_NAMESPACE
#endif // QT_NO_DBUS
diff --git a/src/dbus/qdbusintegrator.cpp b/src/dbus/qdbusintegrator.cpp
index 16cd021d0d..03de5b0091 100644
--- a/src/dbus/qdbusintegrator.cpp
+++ b/src/dbus/qdbusintegrator.cpp
@@ -150,7 +150,6 @@ static dbus_bool_t qDBusAddTimeout(DBusTimeout *timeout, void *data)
if (Q_UNLIKELY(!q_dbus_timeout_get_enabled(timeout)))
return false;
- QDBusDispatchLocker locker(AddTimeoutAction, d);
Q_ASSERT(d->timeouts.key(timeout, 0) == 0);
int timerId = d->startTimer(q_dbus_timeout_get_interval(timeout));
@@ -172,8 +171,6 @@ static void qDBusRemoveTimeout(DBusTimeout *timeout, void *data)
QDBusConnectionPrivate *d = static_cast<QDBusConnectionPrivate *>(data);
Q_ASSERT(QThread::currentThread() == d->thread());
- QDBusDispatchLocker locker(RemoveTimeoutAction, d);
-
QDBusConnectionPrivate::TimeoutHash::iterator it = d->timeouts.begin();
while (it != d->timeouts.end()) {
if (it.value() == timeout) {
@@ -210,7 +207,6 @@ static dbus_bool_t qDBusAddWatch(DBusWatch *watch, void *data)
QDBusConnectionPrivate::Watcher watcher;
- QDBusDispatchLocker locker(AddWatchAction, d);
if (flags & DBUS_WATCH_READABLE) {
//qDebug("addReadWatch %d", fd);
watcher.watch = watch;
@@ -241,7 +237,6 @@ static void qDBusRemoveWatch(DBusWatch *watch, void *data)
Q_ASSERT(QThread::currentThread() == d->thread());
int fd = q_dbus_watch_get_unix_fd(watch);
- QDBusDispatchLocker locker(RemoveWatchAction, d);
QDBusConnectionPrivate::WatcherHash::iterator i = d->watchers.find(fd);
while (i != d->watchers.end() && i.key() == fd) {
if (i.value().watch == watch) {
@@ -263,8 +258,6 @@ static void qDBusToggleWatch(DBusWatch *watch, void *data)
Q_ASSERT(QThread::currentThread() == d->thread());
int fd = q_dbus_watch_get_unix_fd(watch);
- QDBusDispatchLocker locker(ToggleWatchAction, d);
-
QDBusConnectionPrivate::WatcherHash::iterator i = d->watchers.find(fd);
while (i != d->watchers.end() && i.key() == fd) {
if (i.value().watch == watch) {
@@ -766,7 +759,7 @@ static int findSlot(const QMetaObject *mo, const QByteArray &name, int flags,
*/
void QDBusConnectionPrivate::setDispatchEnabled(bool enable)
{
- QDBusDispatchLocker locker(SetDispatchEnabledAction, this);
+ checkThread();
dispatchEnabled = enable;
if (enable)
emit dispatchStatusChanged();
@@ -1024,7 +1017,7 @@ extern bool qDBusInitThreads();
QDBusConnectionPrivate::QDBusConnectionPrivate(QObject *p)
: QObject(p), ref(1), capabilities(0), mode(InvalidMode), busService(0),
- dispatchLock(QMutex::Recursive), connection(0),
+ connection(0),
rootNode(QString(QLatin1Char('/'))),
anonymousAuthenticationAllowed(false),
dispatchEnabled(true)
@@ -1078,7 +1071,7 @@ QDBusConnectionPrivate::~QDBusConnectionPrivate()
Q_ASSERT(ref.load() == 0);
QObject *obj = (QObject *)busService;
if (obj) {
- disconnect(obj, Q_NULLPTR, this, Q_NULLPTR);
+ disconnect(obj, nullptr, this, nullptr);
delete obj;
}
if (connection)
@@ -1176,7 +1169,6 @@ bool QDBusConnectionPrivate::handleError(const QDBusErrorInternal &error)
void QDBusConnectionPrivate::timerEvent(QTimerEvent *e)
{
{
- QDBusDispatchLocker locker(TimerEventAction, this);
DBusTimeout *timeout = timeouts.value(e->timerId(), 0);
if (timeout)
q_dbus_timeout_handle(timeout);
@@ -1187,7 +1179,6 @@ void QDBusConnectionPrivate::timerEvent(QTimerEvent *e)
void QDBusConnectionPrivate::doDispatch()
{
- QDBusDispatchLocker locker(DoDispatchAction, this);
if (mode == ClientMode || mode == PeerMode) {
while (q_dbus_connection_dispatch(connection) == DBUS_DISPATCH_DATA_REMAINS) ;
if (dispatchEnabled && !pendingMessages.isEmpty()) {
@@ -1205,7 +1196,6 @@ void QDBusConnectionPrivate::doDispatch()
void QDBusConnectionPrivate::socketRead(int fd)
{
- QDBusDispatchLocker locker(SocketReadAction, this);
WatcherHash::ConstIterator it = watchers.constFind(fd);
while (it != watchers.constEnd() && it.key() == fd) {
if (it->watch && it->read && it->read->isEnabled()) {
@@ -1220,7 +1210,6 @@ void QDBusConnectionPrivate::socketRead(int fd)
void QDBusConnectionPrivate::socketWrite(int fd)
{
- QDBusDispatchLocker locker(SocketWriteAction, this);
WatcherHash::ConstIterator it = watchers.constFind(fd);
while (it != watchers.constEnd() && it.key() == fd) {
if (it->watch && it->write && it->write->isEnabled()) {
@@ -1283,10 +1272,7 @@ void QDBusConnectionPrivate::relaySignal(QObject *obj, const QMetaObject *mo, in
//qDBusDebug() << "Emitting signal" << message;
//qDBusDebug() << "for paths:";
q_dbus_message_set_no_reply(msg, true); // the reply would not be delivered to anything
- {
- QDBusDispatchLocker locker(HuntAndEmitAction, this);
- huntAndEmit(connection, msg, obj, rootNode, isScriptable, isAdaptor);
- }
+ huntAndEmit(connection, msg, obj, rootNode, isScriptable, isAdaptor);
q_dbus_message_unref(msg);
}
@@ -1950,7 +1936,7 @@ bool QDBusConnectionPrivate::send(const QDBusMessage& message)
q_dbus_message_set_no_reply(msg, true); // the reply would not be delivered to anything
qDBusDebug() << this << "sending message (no reply):" << message;
- emit messageNeedsSending(Q_NULLPTR, msg);
+ emit messageNeedsSending(nullptr, msg);
return true;
}
@@ -2164,9 +2150,8 @@ void QDBusConnectionPrivate::sendInternal(QDBusPendingCallPrivate *pcall, void *
Q_ASSERT(isNoReply == !!q_dbus_message_get_no_reply(msg));
checkThread();
- QDBusDispatchLocker locker(SendMessageAction, this);
- if (isNoReply && q_dbus_connection_send(connection, msg, Q_NULLPTR)) {
+ if (isNoReply && q_dbus_connection_send(connection, msg, nullptr)) {
// success
} else if (!isNoReply && q_dbus_connection_send_with_reply(connection, msg, &pending, timeout)) {
if (pending) {
@@ -2509,7 +2494,7 @@ QString QDBusConnectionPrivate::getNameOwnerNoCache(const QString &serviceName)
QDBusMessagePrivate::setParametersValidated(msg, true);
msg << serviceName;
- QDBusPendingCallPrivate *pcall = sendWithReplyAsync(msg, Q_NULLPTR, Q_NULLPTR, Q_NULLPTR);
+ QDBusPendingCallPrivate *pcall = sendWithReplyAsync(msg, nullptr, nullptr, nullptr);
if (thread() == QThread::currentThread()) {
// this function may be called in our own thread and
// QDBusPendingCallPrivate::waitForFinished() would deadlock there
diff --git a/src/dbus/qdbusintegrator_p.h b/src/dbus/qdbusintegrator_p.h
index 85a067da1e..3cd029a933 100644
--- a/src/dbus/qdbusintegrator_p.h
+++ b/src/dbus/qdbusintegrator_p.h
@@ -109,7 +109,7 @@ public:
: QMetaCallEvent(0, id, 0, sender, -1), connection(c), message(msg), metaTypes(types), flags(f)
{ }
- void placeMetaCall(QObject *object) Q_DECL_OVERRIDE
+ void placeMetaCall(QObject *object) override
{
QDBusConnectionPrivate::d(connection)->deliverCall(object, flags, message, metaTypes, id());
}
@@ -132,7 +132,7 @@ public:
{ }
~QDBusActivateObjectEvent();
- void placeMetaCall(QObject *) Q_DECL_OVERRIDE;
+ void placeMetaCall(QObject *) override;
private:
QDBusConnection connection; // just for refcounting
@@ -148,10 +148,10 @@ public:
typedef void (*Hook)(const QDBusMessage&);
QDBusSpyCallEvent(QDBusConnectionPrivate *cp, const QDBusConnection &c, const QDBusMessage &msg,
const Hook *hooks, int count)
- : QMetaCallEvent(0, 0, Q_NULLPTR, cp, 0), conn(c), msg(msg), hooks(hooks), hookCount(count)
+ : QMetaCallEvent(0, 0, nullptr, cp, 0), conn(c), msg(msg), hooks(hooks), hookCount(count)
{}
~QDBusSpyCallEvent();
- void placeMetaCall(QObject *) Q_DECL_OVERRIDE;
+ void placeMetaCall(QObject *) override;
static inline void invokeSpyHooks(const QDBusMessage &msg, const Hook *hooks, int hookCount);
QDBusConnection conn; // keeps the refcount in QDBusConnectionPrivate up
diff --git a/src/dbus/qdbusinterface.h b/src/dbus/qdbusinterface.h
index b6c2693400..c147d07d50 100644
--- a/src/dbus/qdbusinterface.h
+++ b/src/dbus/qdbusinterface.h
@@ -59,12 +59,12 @@ private:
public:
QDBusInterface(const QString &service, const QString &path, const QString &interface = QString(),
const QDBusConnection &connection = QDBusConnection::sessionBus(),
- QObject *parent = Q_NULLPTR);
+ QObject *parent = nullptr);
~QDBusInterface();
- virtual const QMetaObject *metaObject() const Q_DECL_OVERRIDE;
- virtual void *qt_metacast(const char *) Q_DECL_OVERRIDE;
- virtual int qt_metacall(QMetaObject::Call, int, void **) Q_DECL_OVERRIDE;
+ virtual const QMetaObject *metaObject() const override;
+ virtual void *qt_metacast(const char *) override;
+ virtual int qt_metacall(QMetaObject::Call, int, void **) override;
private:
Q_DECLARE_PRIVATE(QDBusInterface)
diff --git a/src/dbus/qdbusmessage.cpp b/src/dbus/qdbusmessage.cpp
index 28d832c7c2..ef827e82b0 100644
--- a/src/dbus/qdbusmessage.cpp
+++ b/src/dbus/qdbusmessage.cpp
@@ -777,16 +777,6 @@ QDBusMessage::MessageType QDBusMessage::type() const
return InvalidMessage;
}
-/*!
- Sends the message without waiting for a reply. This is suitable
- for errors, signals, and return values as well as calls whose
- return values are not necessary.
-
- Returns \c true if the message was queued successfully;
- otherwise returns \c false.
-
- \sa QDBusConnection::send()
-*/
#ifndef QT_NO_DEBUG_STREAM
static QDebug operator<<(QDebug dbg, QDBusMessage::MessageType t)
{
@@ -839,6 +829,12 @@ QDebug operator<<(QDebug dbg, const QDBusMessage &msg)
}
#endif
+/*!
+ \fn void QDBusMessage::swap(QDBusMessage &other)
+
+ Swaps this QDBusMessage instance with \a other.
+*/
+
QT_END_NAMESPACE
#endif // QT_NO_DBUS
diff --git a/src/dbus/qdbusmetatype.cpp b/src/dbus/qdbusmetatype.cpp
index 6ed6c43e9d..0729a3cbbb 100644
--- a/src/dbus/qdbusmetatype.cpp
+++ b/src/dbus/qdbusmetatype.cpp
@@ -131,6 +131,18 @@ void QDBusMetaTypeId::init()
qDBusRegisterMetaType<QList<QDBusObjectPath> >();
qDBusRegisterMetaType<QList<QDBusSignature> >();
qDBusRegisterMetaType<QList<QDBusUnixFileDescriptor> >();
+
+ qDBusRegisterMetaType<QVector<bool> >();
+ qDBusRegisterMetaType<QVector<short> >();
+ qDBusRegisterMetaType<QVector<ushort> >();
+ qDBusRegisterMetaType<QVector<int> >();
+ qDBusRegisterMetaType<QVector<uint> >();
+ qDBusRegisterMetaType<QVector<qlonglong> >();
+ qDBusRegisterMetaType<QVector<qulonglong> >();
+ qDBusRegisterMetaType<QVector<double> >();
+ qDBusRegisterMetaType<QVector<QDBusObjectPath> >();
+ qDBusRegisterMetaType<QVector<QDBusSignature> >();
+ qDBusRegisterMetaType<QVector<QDBusUnixFileDescriptor> >();
#endif
initialized.store(true);
diff --git a/src/dbus/qdbuspendingcall.cpp b/src/dbus/qdbuspendingcall.cpp
index 6cc76946ac..bd6eb9eca3 100644
--- a/src/dbus/qdbuspendingcall.cpp
+++ b/src/dbus/qdbuspendingcall.cpp
@@ -414,7 +414,7 @@ QDBusMessage QDBusPendingCall::reply() const
}
#if 0
-/*!
+/*
Sets the slot \a member in object \a target to be called when the
reply arrives. The slot's parameter list must match the reply
message's arguments for it to be called.
diff --git a/src/dbus/qdbuspendingcall.h b/src/dbus/qdbuspendingcall.h
index 1e4c6ebfd2..ec8ba6c541 100644
--- a/src/dbus/qdbuspendingcall.h
+++ b/src/dbus/qdbuspendingcall.h
@@ -100,7 +100,7 @@ class Q_DBUS_EXPORT QDBusPendingCallWatcher: public QObject, public QDBusPending
{
Q_OBJECT
public:
- explicit QDBusPendingCallWatcher(const QDBusPendingCall &call, QObject *parent = Q_NULLPTR);
+ explicit QDBusPendingCallWatcher(const QDBusPendingCall &call, QObject *parent = nullptr);
~QDBusPendingCallWatcher();
#ifdef Q_QDOC
@@ -110,7 +110,7 @@ public:
void waitForFinished(); // non-virtual override
Q_SIGNALS:
- void finished(QDBusPendingCallWatcher *self = Q_NULLPTR);
+ void finished(QDBusPendingCallWatcher *self = nullptr);
private:
Q_DECLARE_PRIVATE(QDBusPendingCallWatcher)
diff --git a/src/dbus/qdbuspendingreply.cpp b/src/dbus/qdbuspendingreply.cpp
index f1489ed720..ac121038ab 100644
--- a/src/dbus/qdbuspendingreply.cpp
+++ b/src/dbus/qdbuspendingreply.cpp
@@ -165,6 +165,12 @@
*/
/*!
+ \enum QDBusPendingReply::anonymous
+
+ \value Count The number of arguments the reply is expected to have
+ */
+
+/*!
\fn int QDBusPendingReply::count() const
Return the number of arguments the reply is supposed to have. This
diff --git a/src/dbus/qdbuspendingreply.h b/src/dbus/qdbuspendingreply.h
index da29894d15..4bf574e140 100644
--- a/src/dbus/qdbuspendingreply.h
+++ b/src/dbus/qdbuspendingreply.h
@@ -111,7 +111,7 @@ namespace QDBusPendingReplyTypes {
template<typename T1 = void, typename T2 = void, typename T3 = void, typename T4 = void,
typename T5 = void, typename T6 = void, typename T7 = void, typename T8 = void>
class QDBusPendingReply:
-#ifdef Q_QDOC
+#ifdef Q_CLANG_QDOC
public QDBusPendingCall
#else
public QDBusPendingReplyData
@@ -144,13 +144,21 @@ public:
inline int count() const { return Count; }
-#if defined(Q_QDOC)
+#if defined(Q_CLANG_QDOC)
QVariant argumentAt(int index) const;
#else
using QDBusPendingReplyData::argumentAt;
#endif
-#if defined(Q_QDOC)
+ template<int Index> inline
+ const typename Select<Index>::Type argumentAt() const
+ {
+ Q_STATIC_ASSERT_X(Index >= 0 && Index < Count, "Index out of bounds");
+ typedef typename Select<Index>::Type ResultType;
+ return qdbus_cast<ResultType>(argumentAt(Index), 0);
+ }
+
+#if defined(Q_CLANG_QDOC)
bool isFinished() const;
void waitForFinished();
@@ -159,18 +167,9 @@ public:
QDBusError error() const;
QDBusMessage reply() const;
- template<int Index> inline Type argumentAt() const;
inline T1 value() const;
inline operator T1() const;
#else
- template<int Index> inline
- const typename Select<Index>::Type argumentAt() const
- {
- Q_STATIC_ASSERT_X(Index >= 0 && Index < Count, "Index out of bounds");
- typedef typename Select<Index>::Type ResultType;
- return qdbus_cast<ResultType>(argumentAt(Index), 0);
- }
-
inline typename Select<0>::Type value() const
{
return argumentAt<0>();
diff --git a/src/dbus/qdbusreply.h b/src/dbus/qdbusreply.h
index 227615024a..869687ac85 100644
--- a/src/dbus/qdbusreply.h
+++ b/src/dbus/qdbusreply.h
@@ -130,7 +130,7 @@ private:
template<> inline QDBusReply<QVariant>&
QDBusReply<QVariant>::operator=(const QDBusMessage &reply)
{
- void *null = Q_NULLPTR;
+ void *null = nullptr;
QVariant data(qMetaTypeId<QDBusVariant>(), null);
qDBusReplyFill(reply, m_error, data);
m_data = qvariant_cast<QDBusVariant>(data).variant();
diff --git a/src/dbus/qdbusserver.cpp b/src/dbus/qdbusserver.cpp
index ce55297abb..a2dfb86164 100644
--- a/src/dbus/qdbusserver.cpp
+++ b/src/dbus/qdbusserver.cpp
@@ -116,7 +116,7 @@ QDBusServer::~QDBusServer()
QDBusConnectionManager::instance()->removeConnection(name);
d->serverConnectionNames.clear();
}
- d->serverObject = Q_NULLPTR;
+ d->serverObject = nullptr;
d->ref.store(0);
d->deleteLater();
}
diff --git a/src/dbus/qdbusserver.h b/src/dbus/qdbusserver.h
index ac4dfcb67f..668b8705b1 100644
--- a/src/dbus/qdbusserver.h
+++ b/src/dbus/qdbusserver.h
@@ -57,8 +57,8 @@ class Q_DBUS_EXPORT QDBusServer: public QObject
{
Q_OBJECT
public:
- explicit QDBusServer(const QString &address, QObject *parent = Q_NULLPTR);
- explicit QDBusServer(QObject *parent = Q_NULLPTR);
+ explicit QDBusServer(const QString &address, QObject *parent = nullptr);
+ explicit QDBusServer(QObject *parent = nullptr);
virtual ~QDBusServer();
bool isConnected() const;
diff --git a/src/dbus/qdbusservicewatcher.h b/src/dbus/qdbusservicewatcher.h
index 77573beb5d..2c45c85cb9 100644
--- a/src/dbus/qdbusservicewatcher.h
+++ b/src/dbus/qdbusservicewatcher.h
@@ -64,9 +64,9 @@ public:
Q_DECLARE_FLAGS(WatchMode, WatchModeFlag)
Q_FLAG(WatchMode)
- explicit QDBusServiceWatcher(QObject *parent = Q_NULLPTR);
+ explicit QDBusServiceWatcher(QObject *parent = nullptr);
QDBusServiceWatcher(const QString &service, const QDBusConnection &connection,
- WatchMode watchMode = WatchForOwnerChange, QObject *parent = Q_NULLPTR);
+ WatchMode watchMode = WatchForOwnerChange, QObject *parent = nullptr);
~QDBusServiceWatcher();
QStringList watchedServices() const;
diff --git a/src/dbus/qdbusthreaddebug_p.h b/src/dbus/qdbusthreaddebug_p.h
index 96f389fa49..ad0984e26c 100644
--- a/src/dbus/qdbusthreaddebug_p.h
+++ b/src/dbus/qdbusthreaddebug_p.h
@@ -95,17 +95,6 @@ enum ThreadAction {
PendingCallBlockAction = 28,
SendMessageAction = 29,
HuntAndEmitAction = 30,
-
- AddTimeoutAction = 50,
- RealAddTimeoutAction = 51,
- RemoveTimeoutAction = 52,
- KillTimerAction = 58,
- TimerEventAction = 59,
- AddWatchAction = 60,
- RemoveWatchAction = 61,
- ToggleWatchAction = 62,
- SocketReadAction = 63,
- SocketWriteAction = 64
};
struct QDBusLockerBase
@@ -176,35 +165,6 @@ struct QDBusWriteLocker: QDBusLockerBase
}
};
-struct QDBusMutexLocker: QDBusLockerBase
-{
- QDBusConnectionPrivate *self;
- QMutex *mutex;
- ThreadAction action;
- inline QDBusMutexLocker(ThreadAction a, QDBusConnectionPrivate *s,
- QMutex *m)
- : self(s), mutex(m), action(a)
- {
- reportThreadAction(action, BeforeLock, self);
- mutex->lock();
- reportThreadAction(action, AfterLock, self);
- }
-
- inline ~QDBusMutexLocker()
- {
- reportThreadAction(action, BeforeUnlock, self);
- mutex->unlock();
- reportThreadAction(action, AfterUnlock, self);
- }
-};
-
-struct QDBusDispatchLocker: QDBusMutexLocker
-{
- inline QDBusDispatchLocker(ThreadAction a, QDBusConnectionPrivate *s)
- : QDBusMutexLocker(a, s, &s->dispatchLock)
- { }
-};
-
#if QDBUS_THREAD_DEBUG
# define SEM_ACQUIRE(action, sem) \
do { \
diff --git a/src/dbus/qdbusvirtualobject.h b/src/dbus/qdbusvirtualobject.h
index 1a96d900b4..b69e21b378 100644
--- a/src/dbus/qdbusvirtualobject.h
+++ b/src/dbus/qdbusvirtualobject.h
@@ -56,7 +56,7 @@ class Q_DBUS_EXPORT QDBusVirtualObject : public QObject
{
Q_OBJECT
public:
- explicit QDBusVirtualObject(QObject *parent = Q_NULLPTR);
+ explicit QDBusVirtualObject(QObject *parent = nullptr);
virtual ~QDBusVirtualObject();
virtual QString introspect(const QString &path) const = 0;
diff --git a/src/gui/accessible/qaccessible.cpp b/src/gui/accessible/qaccessible.cpp
index 2db4d46874..3004110e67 100644
--- a/src/gui/accessible/qaccessible.cpp
+++ b/src/gui/accessible/qaccessible.cpp
@@ -1761,7 +1761,6 @@ QAccessibleTextSelectionEvent::~QAccessibleTextSelectionEvent()
/*!
Returns the QAccessibleInterface associated with the event.
- The caller of this function takes ownership of the returned interface.
*/
QAccessibleInterface *QAccessibleEvent::accessibleInterface() const
{
diff --git a/src/gui/accessible/qaccessible.h b/src/gui/accessible/qaccessible.h
index 27756d764d..1309f17efd 100644
--- a/src/gui/accessible/qaccessible.h
+++ b/src/gui/accessible/qaccessible.h
@@ -511,7 +511,7 @@ public:
virtual void virtual_hook(int id, void *data);
virtual void *interface_cast(QAccessible::InterfaceType)
- { return Q_NULLPTR; }
+ { return nullptr; }
protected:
friend class QAccessibleCache;
@@ -682,7 +682,7 @@ public:
}
inline QAccessibleEvent(QAccessibleInterface *iface, QAccessible::Event typ)
- : m_type(typ), m_object(Q_NULLPTR)
+ : m_type(typ), m_object(nullptr)
{
Q_ASSERT(iface);
Q_ASSERT(m_type != QAccessible::ValueChanged);
diff --git a/src/gui/accessible/qaccessiblebridge.h b/src/gui/accessible/qaccessiblebridge.h
index 7429716e65..168889135b 100644
--- a/src/gui/accessible/qaccessiblebridge.h
+++ b/src/gui/accessible/qaccessiblebridge.h
@@ -66,7 +66,7 @@ class Q_GUI_EXPORT QAccessibleBridgePlugin : public QObject
{
Q_OBJECT
public:
- explicit QAccessibleBridgePlugin(QObject *parent = Q_NULLPTR);
+ explicit QAccessibleBridgePlugin(QObject *parent = nullptr);
~QAccessibleBridgePlugin();
virtual QAccessibleBridge *create(const QString &key) = 0;
diff --git a/src/gui/accessible/qaccessiblecache.cpp b/src/gui/accessible/qaccessiblecache.cpp
index 097634c0a3..f4242036ce 100644
--- a/src/gui/accessible/qaccessiblecache.cpp
+++ b/src/gui/accessible/qaccessiblecache.cpp
@@ -54,7 +54,7 @@ static QAccessibleCache *accessibleCache = nullptr;
static void cleanupAccessibleCache()
{
delete accessibleCache;
- accessibleCache = Q_NULLPTR;
+ accessibleCache = nullptr;
}
QAccessibleCache *QAccessibleCache::instance()
diff --git a/src/gui/accessible/qaccessibleobject.h b/src/gui/accessible/qaccessibleobject.h
index dd69dcb081..81479c32ab 100644
--- a/src/gui/accessible/qaccessibleobject.h
+++ b/src/gui/accessible/qaccessibleobject.h
@@ -56,13 +56,13 @@ class Q_GUI_EXPORT QAccessibleObject : public QAccessibleInterface
public:
explicit QAccessibleObject(QObject *object);
- bool isValid() const Q_DECL_OVERRIDE;
- QObject *object() const Q_DECL_OVERRIDE;
+ bool isValid() const override;
+ QObject *object() const override;
// properties
- QRect rect() const Q_DECL_OVERRIDE;
- void setText(QAccessible::Text t, const QString &text) Q_DECL_OVERRIDE;
- QAccessibleInterface *childAt(int x, int y) const Q_DECL_OVERRIDE;
+ QRect rect() const override;
+ void setText(QAccessible::Text t, const QString &text) override;
+ QAccessibleInterface *childAt(int x, int y) const override;
protected:
virtual ~QAccessibleObject();
@@ -77,20 +77,20 @@ class Q_GUI_EXPORT QAccessibleApplication : public QAccessibleObject
public:
QAccessibleApplication();
- QWindow *window() const Q_DECL_OVERRIDE;
+ QWindow *window() const override;
// relations
- int childCount() const Q_DECL_OVERRIDE;
- int indexOfChild(const QAccessibleInterface*) const Q_DECL_OVERRIDE;
- QAccessibleInterface *focusChild() const Q_DECL_OVERRIDE;
+ int childCount() const override;
+ int indexOfChild(const QAccessibleInterface*) const override;
+ QAccessibleInterface *focusChild() const override;
// navigation
- QAccessibleInterface *parent() const Q_DECL_OVERRIDE;
- QAccessibleInterface *child(int index) const Q_DECL_OVERRIDE;
+ QAccessibleInterface *parent() const override;
+ QAccessibleInterface *child(int index) const override;
// properties and state
- QString text(QAccessible::Text t) const Q_DECL_OVERRIDE;
- QAccessible::Role role() const Q_DECL_OVERRIDE;
- QAccessible::State state() const Q_DECL_OVERRIDE;
+ QString text(QAccessible::Text t) const override;
+ QAccessible::Role role() const override;
+ QAccessible::State state() const override;
};
#endif // QT_NO_ACCESSIBILITY
diff --git a/src/gui/accessible/qaccessibleplugin.h b/src/gui/accessible/qaccessibleplugin.h
index 09d4c542d3..68e6a839d8 100644
--- a/src/gui/accessible/qaccessibleplugin.h
+++ b/src/gui/accessible/qaccessibleplugin.h
@@ -60,7 +60,7 @@ class Q_GUI_EXPORT QAccessiblePlugin : public QObject
{
Q_OBJECT
public:
- explicit QAccessiblePlugin(QObject *parent = Q_NULLPTR);
+ explicit QAccessiblePlugin(QObject *parent = nullptr);
~QAccessiblePlugin();
virtual QAccessibleInterface *create(const QString &key, QObject *object) = 0;
diff --git a/src/gui/configure.json b/src/gui/configure.json
index a7f08f2cc0..0f71f7a98f 100644
--- a/src/gui/configure.json
+++ b/src/gui/configure.json
@@ -1,7 +1,8 @@
{
"module": "gui",
"depends": [
- "core"
+ "core",
+ "network"
],
"testDir": "../../config.tests",
@@ -206,7 +207,7 @@
"test": {
"include": "harfbuzz/hb.h",
"tail": [
- "#if !HB_VERSION_ATLEAST(0, 9, 42)",
+ "#if !HB_VERSION_ATLEAST(1, 6, 0)",
"# error This version of harfbuzz is too old.",
"#endif"
],
@@ -955,7 +956,8 @@
},
"fontconfig": {
"label": "Fontconfig",
- "condition": "!config.win32 && !config.darwin && features.system-freetype && libs.fontconfig",
+ "autoDetect": "!config.darwin",
+ "condition": "!config.win32 && features.system-freetype && libs.fontconfig",
"output": [ "privateFeature", "feature" ]
},
"gbm": {
@@ -1022,7 +1024,10 @@
"vnc": {
"label": "VNC",
"section": "Platform plugins",
- "condition": "config.unix && !config.android && !config.darwin && features.regularexpression",
+ "condition": [
+ "config.unix && !config.android && !config.darwin",
+ "features.regularexpression && features.network"
+ ],
"output": [ "privateFeature" ]
},
"mirclient": {
@@ -1226,6 +1231,12 @@
"condition": "libs.tslib",
"output": [ "privateFeature" ]
},
+ "tuiotouch": {
+ "label": "TuioTouch",
+ "purpose": "Provides the TuioTouch input plugin.",
+ "condition": "features.network && features.udpsocket",
+ "output": [ "privateFeature" ]
+ },
"xcb": {
"label": "XCB",
"section": "Platform plugins",
@@ -1316,6 +1327,7 @@
},
"xlib": {
"label": "XLib",
+ "autoDetect": "!config.darwin || features.xcb",
"condition": "tests.xlib",
"output": [ "privateFeature" ]
},
@@ -1539,6 +1551,13 @@ XKB configuration data. This is required for keyboard input support."
},
{
"type": "note",
+ "condition": "features.xcb && config.darwin",
+ "message": "XCB support on macOS is minimal and untested. Some features will
+not work properly or at all (e.g. OpenGL, desktop services or accessibility),
+or may depend on your system and XQuartz setup."
+ },
+ {
+ "type": "note",
"condition": "features.accessibility && features.xcb && !features.accessibility-atspi-bridge",
"message": "Disabling X11 Accessibility Bridge: D-Bus or AT-SPI is missing."
},
diff --git a/src/gui/doc/snippets/code/src_gui_text_qfont.cpp b/src/gui/doc/snippets/code/src_gui_text_qfont.cpp
index 82d8525ded..1901ca9b10 100644
--- a/src/gui/doc/snippets/code/src_gui_text_qfont.cpp
+++ b/src/gui/doc/snippets/code/src_gui_text_qfont.cpp
@@ -72,6 +72,6 @@ QString family = info.family();
//! [4]
QFontMetrics fm(f1);
-int textWidthInPixels = fm.width("How many pixels wide is this text?");
+int textWidthInPixels = fm.horizontalAdvance("How many pixels wide is this text?");
int textHeightInPixels = fm.height();
//! [4]
diff --git a/src/gui/doc/snippets/code/src_gui_text_qfontmetrics.cpp b/src/gui/doc/snippets/code/src_gui_text_qfontmetrics.cpp
index 6cffa4f611..6b478d3297 100644
--- a/src/gui/doc/snippets/code/src_gui_text_qfontmetrics.cpp
+++ b/src/gui/doc/snippets/code/src_gui_text_qfontmetrics.cpp
@@ -51,7 +51,7 @@
//! [0]
QFont font("times", 24);
QFontMetrics fm(font);
-int pixelsWide = fm.width("What's the width of this text?");
+int pixelsWide = fm.horizontalAdvance("What's the width of this text?");
int pixelsHigh = fm.height();
//! [0]
@@ -59,6 +59,6 @@ int pixelsHigh = fm.height();
//! [1]
QFont font("times", 24);
QFontMetricsF fm(font);
-qreal pixelsWide = fm.width("What's the width of this text?");
+qreal pixelsWide = fm.horizontalAdvance("What's the width of this text?");
qreal pixelsHigh = fm.height();
//! [1]
diff --git a/src/gui/image/qbitmap.h b/src/gui/image/qbitmap.h
index def59b3f89..6a8c8b3457 100644
--- a/src/gui/image/qbitmap.h
+++ b/src/gui/image/qbitmap.h
@@ -55,7 +55,7 @@ public:
QBitmap(const QPixmap &);
QBitmap(int w, int h);
explicit QBitmap(const QSize &);
- explicit QBitmap(const QString &fileName, const char *format = Q_NULLPTR);
+ explicit QBitmap(const QString &fileName, const char *format = nullptr);
// ### Qt 6: don't inherit QPixmap
#if QT_VERSION < QT_VERSION_CHECK(6, 0, 0)
QBitmap(const QBitmap &other) : QPixmap(other) {}
diff --git a/src/gui/image/qicon.h b/src/gui/image/qicon.h
index 40d3e92af9..4832455c9f 100644
--- a/src/gui/image/qicon.h
+++ b/src/gui/image/qicon.h
@@ -63,7 +63,7 @@ public:
#ifdef Q_COMPILER_RVALUE_REFS
QIcon(QIcon &&other) Q_DECL_NOEXCEPT
: d(other.d)
- { other.d = Q_NULLPTR; }
+ { other.d = nullptr; }
#endif
explicit QIcon(const QString &fileName); // file or resource name
explicit QIcon(QIconEngine *engine);
@@ -147,7 +147,7 @@ Q_GUI_EXPORT QDebug operator<<(QDebug dbg, const QIcon &);
#endif
Q_GUI_EXPORT QString qt_findAtNxFile(const QString &baseFileName, qreal targetDevicePixelRatio,
- qreal *sourceDevicePixelRatio = Q_NULLPTR);
+ qreal *sourceDevicePixelRatio = nullptr);
QT_END_NAMESPACE
diff --git a/src/gui/image/qicon_p.h b/src/gui/image/qicon_p.h
index aa358e88af..e384ff9e49 100644
--- a/src/gui/image/qicon_p.h
+++ b/src/gui/image/qicon_p.h
@@ -112,18 +112,18 @@ public:
QPixmapIconEngine();
QPixmapIconEngine(const QPixmapIconEngine &);
~QPixmapIconEngine();
- void paint(QPainter *painter, const QRect &rect, QIcon::Mode mode, QIcon::State state) Q_DECL_OVERRIDE;
- QPixmap pixmap(const QSize &size, QIcon::Mode mode, QIcon::State state) Q_DECL_OVERRIDE;
+ void paint(QPainter *painter, const QRect &rect, QIcon::Mode mode, QIcon::State state) override;
+ QPixmap pixmap(const QSize &size, QIcon::Mode mode, QIcon::State state) override;
QPixmapIconEngineEntry *bestMatch(const QSize &size, QIcon::Mode mode, QIcon::State state, bool sizeOnly);
- QSize actualSize(const QSize &size, QIcon::Mode mode, QIcon::State state) Q_DECL_OVERRIDE;
- void addPixmap(const QPixmap &pixmap, QIcon::Mode mode, QIcon::State state) Q_DECL_OVERRIDE;
- void addFile(const QString &fileName, const QSize &size, QIcon::Mode mode, QIcon::State state) Q_DECL_OVERRIDE;
-
- QString key() const Q_DECL_OVERRIDE;
- QIconEngine *clone() const Q_DECL_OVERRIDE;
- bool read(QDataStream &in) Q_DECL_OVERRIDE;
- bool write(QDataStream &out) const Q_DECL_OVERRIDE;
- void virtual_hook(int id, void *data) Q_DECL_OVERRIDE;
+ QSize actualSize(const QSize &size, QIcon::Mode mode, QIcon::State state) override;
+ void addPixmap(const QPixmap &pixmap, QIcon::Mode mode, QIcon::State state) override;
+ void addFile(const QString &fileName, const QSize &size, QIcon::Mode mode, QIcon::State state) override;
+
+ QString key() const override;
+ QIconEngine *clone() const override;
+ bool read(QDataStream &in) override;
+ bool write(QDataStream &out) const override;
+ void virtual_hook(int id, void *data) override;
private:
QPixmapIconEngineEntry *tryMatch(const QSize &size, QIcon::Mode mode, QIcon::State state);
diff --git a/src/gui/image/qiconengineplugin.h b/src/gui/image/qiconengineplugin.h
index 7a01d3731c..f2a1c0107a 100644
--- a/src/gui/image/qiconengineplugin.h
+++ b/src/gui/image/qiconengineplugin.h
@@ -55,7 +55,7 @@ class Q_GUI_EXPORT QIconEnginePlugin : public QObject
{
Q_OBJECT
public:
- QIconEnginePlugin(QObject *parent = Q_NULLPTR);
+ QIconEnginePlugin(QObject *parent = nullptr);
~QIconEnginePlugin();
virtual QIconEngine *create(const QString &filename = QString()) = 0;
diff --git a/src/gui/image/qiconloader_p.h b/src/gui/image/qiconloader_p.h
index 9398bca585..0007437ee9 100644
--- a/src/gui/image/qiconloader_p.h
+++ b/src/gui/image/qiconloader_p.h
@@ -101,13 +101,13 @@ public:
struct ScalableEntry : public QIconLoaderEngineEntry
{
- QPixmap pixmap(const QSize &size, QIcon::Mode mode, QIcon::State state) Q_DECL_OVERRIDE;
+ QPixmap pixmap(const QSize &size, QIcon::Mode mode, QIcon::State state) override;
QIcon svgIcon;
};
struct PixmapEntry : public QIconLoaderEngineEntry
{
- QPixmap pixmap(const QSize &size, QIcon::Mode mode, QIcon::State state) Q_DECL_OVERRIDE;
+ QPixmap pixmap(const QSize &size, QIcon::Mode mode, QIcon::State state) override;
QPixmap basePixmap;
};
@@ -125,20 +125,20 @@ public:
QIconLoaderEngine(const QString& iconName = QString());
~QIconLoaderEngine();
- void paint(QPainter *painter, const QRect &rect, QIcon::Mode mode, QIcon::State state) Q_DECL_OVERRIDE;
- QPixmap pixmap(const QSize &size, QIcon::Mode mode, QIcon::State state) Q_DECL_OVERRIDE;
- QSize actualSize(const QSize &size, QIcon::Mode mode, QIcon::State state) Q_DECL_OVERRIDE;
- QIconEngine *clone() const Q_DECL_OVERRIDE;
- bool read(QDataStream &in) Q_DECL_OVERRIDE;
- bool write(QDataStream &out) const Q_DECL_OVERRIDE;
+ void paint(QPainter *painter, const QRect &rect, QIcon::Mode mode, QIcon::State state) override;
+ QPixmap pixmap(const QSize &size, QIcon::Mode mode, QIcon::State state) override;
+ QSize actualSize(const QSize &size, QIcon::Mode mode, QIcon::State state) override;
+ QIconEngine *clone() const override;
+ bool read(QDataStream &in) override;
+ bool write(QDataStream &out) const override;
Q_GUI_EXPORT static QIconLoaderEngineEntry *entryForSize(const QThemeIconInfo &info, const QSize &size, int scale = 1);
private:
- QString key() const Q_DECL_OVERRIDE;
+ QString key() const override;
bool hasIcon() const;
void ensureLoaded();
- void virtual_hook(int id, void *data) Q_DECL_OVERRIDE;
+ void virtual_hook(int id, void *data) override;
QIconLoaderEngine(const QIconLoaderEngine &other);
QThemeIconInfo m_info;
diff --git a/src/gui/image/qimage.cpp b/src/gui/image/qimage.cpp
index 99c2271581..a5a5f7c1a4 100644
--- a/src/gui/image/qimage.cpp
+++ b/src/gui/image/qimage.cpp
@@ -1975,7 +1975,8 @@ QImage::Format QImage::format() const
}
/*!
- \fn QImage QImage::convertToFormat(Format format, Qt::ImageConversionFlags flags) const
+ \fn QImage QImage::convertToFormat(Format format, Qt::ImageConversionFlags flags) const &
+ \fn QImage QImage::convertToFormat(Format format, Qt::ImageConversionFlags flags) &&
Returns a copy of the image in the given \a format.
@@ -2133,8 +2134,8 @@ QImage QImage::convertToFormat(Format format, const QVector<QRgb> &colorTable, Q
/*!
\since 5.9
- Changes the \a format of the image without changing the data. Only
- works between formats of the same depth.
+ Changes the format of the image to \a format without changing the
+ data. Only works between formats of the same depth.
Returns \c true if successful.
@@ -2987,7 +2988,9 @@ QImage QImage::createMaskFromColor(QRgb color, Qt::MaskMode mode) const
}
/*!
- \fn QImage QImage::mirrored(bool horizontal = false, bool vertical = true) const
+ \fn QImage QImage::mirrored(bool horizontal = false, bool vertical = true) const &
+ \fn QImage QImage::mirrored(bool horizontal = false, bool vertical = true) &&
+
Returns a mirror of the image, mirrored in the horizontal and/or
the vertical direction depending on whether \a horizontal and \a
vertical are set to true or false.
@@ -3192,7 +3195,9 @@ void QImage::mirrored_inplace(bool horizontal, bool vertical)
}
/*!
- \fn QImage QImage::rgbSwapped() const
+ \fn QImage QImage::rgbSwapped() const &
+ \fn QImage QImage::rgbSwapped() &&
+
Returns a QImage in which the values of the red and blue
components of all pixels have been swapped, effectively converting
an RGB image to an BGR image.
@@ -3261,14 +3266,31 @@ QImage QImage::rgbSwapped_helper() const
res.d->colortable[i] = QRgb(((c << 16) & 0xff0000) | ((c >> 16) & 0xff) | (c & 0xff00ff00));
}
break;
- case Format_RGB32:
- case Format_ARGB32:
- case Format_ARGB32_Premultiplied:
-#if Q_BYTE_ORDER == Q_LITTLE_ENDIAN
case Format_RGBX8888:
case Format_RGBA8888:
case Format_RGBA8888_Premultiplied:
+#if Q_BYTE_ORDER == Q_BIG_ENDIAN
+ res = QImage(d->width, d->height, d->format);
+ QIMAGE_SANITYCHECK_MEMORY(res);
+ for (int i = 0; i < d->height; i++) {
+ uint *q = (uint*)res.scanLine(i);
+ const uint *p = (const uint*)constScanLine(i);
+ const uint *end = p + d->width;
+ while (p < end) {
+ uint c = *p;
+ *q = ((c << 16) & 0xff000000) | ((c >> 16) & 0xff00) | (c & 0x00ff00ff);
+ p++;
+ q++;
+ }
+ }
+ break;
+#else
+ // On little-endian rgba8888 is abgr32 and can use same rgb-swap as argb32
+ Q_FALLTHROUGH();
#endif
+ case Format_RGB32:
+ case Format_ARGB32:
+ case Format_ARGB32_Premultiplied:
res = QImage(d->width, d->height, d->format);
QIMAGE_SANITYCHECK_MEMORY(res);
for (int i = 0; i < d->height; i++) {
@@ -3352,14 +3374,27 @@ void QImage::rgbSwapped_inplace()
d->colortable[i] = QRgb(((c << 16) & 0xff0000) | ((c >> 16) & 0xff) | (c & 0xff00ff00));
}
break;
- case Format_RGB32:
- case Format_ARGB32:
- case Format_ARGB32_Premultiplied:
-#if Q_BYTE_ORDER == Q_LITTLE_ENDIAN
case Format_RGBX8888:
case Format_RGBA8888:
case Format_RGBA8888_Premultiplied:
+#if Q_BYTE_ORDER == Q_BIG_ENDIAN
+ for (int i = 0; i < d->height; i++) {
+ uint *p = (uint*)scanLine(i);
+ uint *end = p + d->width;
+ while (p < end) {
+ uint c = *p;
+ *p = ((c << 16) & 0xff000000) | ((c >> 16) & 0xff00) | (c & 0x00ff00ff);
+ p++;
+ }
+ }
+ break;
+#else
+ // On little-endian rgba8888 is abgr32 and can use same rgb-swap as argb32
+ Q_FALLTHROUGH();
#endif
+ case Format_RGB32:
+ case Format_ARGB32:
+ case Format_ARGB32_Premultiplied:
for (int i = 0; i < d->height; i++) {
uint *p = (uint*)scanLine(i);
uint *end = p + d->width;
@@ -4781,8 +4816,8 @@ bool QImageData::convertInPlace(QImage::Format newFormat, Qt::ImageConversionFla
QDebug operator<<(QDebug dbg, const QImage &i)
{
QDebugStateSaver saver(dbg);
- dbg.resetFormat();
dbg.nospace();
+ dbg.noquote();
dbg << "QImage(";
if (i.isNull()) {
dbg << "null";
@@ -4790,8 +4825,15 @@ QDebug operator<<(QDebug dbg, const QImage &i)
dbg << i.size() << ",format=" << i.format() << ",depth=" << i.depth();
if (i.colorCount())
dbg << ",colorCount=" << i.colorCount();
+ const int bytesPerLine = i.bytesPerLine();
dbg << ",devicePixelRatio=" << i.devicePixelRatio()
- << ",bytesPerLine=" << i.bytesPerLine() << ",sizeInBytes=" << i.sizeInBytes();
+ << ",bytesPerLine=" << bytesPerLine << ",sizeInBytes=" << i.sizeInBytes();
+ if (dbg.verbosity() > 2 && i.height() > 0) {
+ const int outputLength = qMin(bytesPerLine, 24);
+ dbg << ",line0="
+ << QByteArray(reinterpret_cast<const char *>(i.scanLine(0)), outputLength).toHex()
+ << "...";
+ }
}
dbg << ')';
return dbg;
diff --git a/src/gui/image/qimage.h b/src/gui/image/qimage.h
index 8112b8e8fd..9b76b62f24 100644
--- a/src/gui/image/qimage.h
+++ b/src/gui/image/qimage.h
@@ -136,20 +136,20 @@ public:
QImage() Q_DECL_NOEXCEPT;
QImage(const QSize &size, Format format);
QImage(int width, int height, Format format);
- QImage(uchar *data, int width, int height, Format format, QImageCleanupFunction cleanupFunction = Q_NULLPTR, void *cleanupInfo = Q_NULLPTR);
- QImage(const uchar *data, int width, int height, Format format, QImageCleanupFunction cleanupFunction = Q_NULLPTR, void *cleanupInfo = Q_NULLPTR);
- QImage(uchar *data, int width, int height, int bytesPerLine, Format format, QImageCleanupFunction cleanupFunction = Q_NULLPTR, void *cleanupInfo = Q_NULLPTR);
- QImage(const uchar *data, int width, int height, int bytesPerLine, Format format, QImageCleanupFunction cleanupFunction = Q_NULLPTR, void *cleanupInfo = Q_NULLPTR);
+ QImage(uchar *data, int width, int height, Format format, QImageCleanupFunction cleanupFunction = nullptr, void *cleanupInfo = nullptr);
+ QImage(const uchar *data, int width, int height, Format format, QImageCleanupFunction cleanupFunction = nullptr, void *cleanupInfo = nullptr);
+ QImage(uchar *data, int width, int height, int bytesPerLine, Format format, QImageCleanupFunction cleanupFunction = nullptr, void *cleanupInfo = nullptr);
+ QImage(const uchar *data, int width, int height, int bytesPerLine, Format format, QImageCleanupFunction cleanupFunction = nullptr, void *cleanupInfo = nullptr);
#ifndef QT_NO_IMAGEFORMAT_XPM
explicit QImage(const char * const xpm[]);
#endif
- explicit QImage(const QString &fileName, const char *format = Q_NULLPTR);
+ explicit QImage(const QString &fileName, const char *format = nullptr);
QImage(const QImage &);
#ifdef Q_COMPILER_RVALUE_REFS
inline QImage(QImage &&other) Q_DECL_NOEXCEPT
- : QPaintDevice(), d(Q_NULLPTR)
+ : QPaintDevice(), d(nullptr)
{ qSwap(d, other.d); }
#endif
~QImage();
@@ -164,7 +164,7 @@ public:
bool isNull() const;
- int devType() const Q_DECL_OVERRIDE;
+ int devType() const override;
bool operator==(const QImage &) const;
bool operator!=(const QImage &) const;
@@ -294,16 +294,16 @@ public:
bool load(QIODevice *device, const char* format);
- bool load(const QString &fileName, const char *format = Q_NULLPTR);
- bool loadFromData(const uchar *buf, int len, const char *format = Q_NULLPTR);
- inline bool loadFromData(const QByteArray &data, const char *aformat = Q_NULLPTR)
+ bool load(const QString &fileName, const char *format = nullptr);
+ bool loadFromData(const uchar *buf, int len, const char *format = nullptr);
+ inline bool loadFromData(const QByteArray &data, const char *aformat = nullptr)
{ return loadFromData(reinterpret_cast<const uchar *>(data.constData()), data.size(), aformat); }
- bool save(const QString &fileName, const char *format = Q_NULLPTR, int quality = -1) const;
- bool save(QIODevice *device, const char *format = Q_NULLPTR, int quality = -1) const;
+ bool save(const QString &fileName, const char *format = nullptr, int quality = -1) const;
+ bool save(QIODevice *device, const char *format = nullptr, int quality = -1) const;
- static QImage fromData(const uchar *data, int size, const char *format = Q_NULLPTR);
- inline static QImage fromData(const QByteArray &data, const char *format = Q_NULLPTR)
+ static QImage fromData(const uchar *data, int size, const char *format = nullptr);
+ inline static QImage fromData(const QByteArray &data, const char *format = nullptr)
{ return fromData(reinterpret_cast<const uchar *>(data.constData()), data.size(), format); }
#if QT_DEPRECATED_SINCE(5, 0)
@@ -311,7 +311,7 @@ public:
#endif
qint64 cacheKey() const;
- QPaintEngine *paintEngine() const Q_DECL_OVERRIDE;
+ QPaintEngine *paintEngine() const override;
// Auxiliary data
int dotsPerMeterX() const;
@@ -335,7 +335,7 @@ public:
#endif
#if QT_DEPRECATED_SINCE(5, 0)
- QT_DEPRECATED inline QString text(const char *key, const char *lang = Q_NULLPTR) const;
+ QT_DEPRECATED inline QString text(const char *key, const char *lang = nullptr) const;
QT_DEPRECATED inline QList<QImageTextKeyLang> textList() const;
QT_DEPRECATED inline QStringList textLanguages() const;
QT_DEPRECATED inline QString text(const QImageTextKeyLang&) const;
@@ -349,7 +349,7 @@ public:
#endif
protected:
- virtual int metric(PaintDeviceMetric metric) const Q_DECL_OVERRIDE;
+ virtual int metric(PaintDeviceMetric metric) const override;
QImage mirrored_helper(bool horizontal, bool vertical) const;
QImage rgbSwapped_helper() const;
void mirrored_inplace(bool horizontal, bool vertical);
diff --git a/src/gui/image/qimageiohandler.h b/src/gui/image/qimageiohandler.h
index baf9853259..35984dd6a5 100644
--- a/src/gui/image/qimageiohandler.h
+++ b/src/gui/image/qimageiohandler.h
@@ -140,7 +140,7 @@ class Q_GUI_EXPORT QImageIOPlugin : public QObject
{
Q_OBJECT
public:
- explicit QImageIOPlugin(QObject *parent = Q_NULLPTR);
+ explicit QImageIOPlugin(QObject *parent = nullptr);
virtual ~QImageIOPlugin();
enum Capability {
diff --git a/src/gui/image/qmovie.h b/src/gui/image/qmovie.h
index ca559d491b..e13c528894 100644
--- a/src/gui/image/qmovie.h
+++ b/src/gui/image/qmovie.h
@@ -79,9 +79,9 @@ public:
};
Q_ENUM(CacheMode)
- explicit QMovie(QObject *parent = Q_NULLPTR);
- explicit QMovie(QIODevice *device, const QByteArray &format = QByteArray(), QObject *parent = Q_NULLPTR);
- explicit QMovie(const QString &fileName, const QByteArray &format = QByteArray(), QObject *parent = Q_NULLPTR);
+ explicit QMovie(QObject *parent = nullptr);
+ explicit QMovie(QIODevice *device, const QByteArray &format = QByteArray(), QObject *parent = nullptr);
+ explicit QMovie(const QString &fileName, const QByteArray &format = QByteArray(), QObject *parent = nullptr);
~QMovie();
static QList<QByteArray> supportedFormats();
diff --git a/src/gui/image/qpaintengine_pic_p.h b/src/gui/image/qpaintengine_pic_p.h
index 7c690c1498..c3044796ad 100644
--- a/src/gui/image/qpaintengine_pic_p.h
+++ b/src/gui/image/qpaintengine_pic_p.h
@@ -68,10 +68,10 @@ public:
QPicturePaintEngine();
~QPicturePaintEngine();
- bool begin(QPaintDevice *pdev) Q_DECL_OVERRIDE;
- bool end() Q_DECL_OVERRIDE;
+ bool begin(QPaintDevice *pdev) override;
+ bool end() override;
- void updateState(const QPaintEngineState &state) Q_DECL_OVERRIDE;
+ void updateState(const QPaintEngineState &state) override;
void updatePen(const QPen &pen);
void updateBrush(const QBrush &brush);
@@ -86,18 +86,18 @@ public:
void updateClipEnabled(bool enabled);
void updateOpacity(qreal opacity);
- void drawEllipse(const QRectF &rect) Q_DECL_OVERRIDE;
- void drawPath(const QPainterPath &path) Q_DECL_OVERRIDE;
- void drawPolygon(const QPointF *points, int numPoints, PolygonDrawMode mode) Q_DECL_OVERRIDE;
+ void drawEllipse(const QRectF &rect) override;
+ void drawPath(const QPainterPath &path) override;
+ void drawPolygon(const QPointF *points, int numPoints, PolygonDrawMode mode) override;
using QPaintEngine::drawPolygon;
- void drawPixmap(const QRectF &r, const QPixmap &pm, const QRectF &sr) Q_DECL_OVERRIDE;
- void drawTiledPixmap(const QRectF &r, const QPixmap &pixmap, const QPointF &s) Q_DECL_OVERRIDE;
+ void drawPixmap(const QRectF &r, const QPixmap &pm, const QRectF &sr) override;
+ void drawTiledPixmap(const QRectF &r, const QPixmap &pixmap, const QPointF &s) override;
void drawImage(const QRectF &r, const QImage &image, const QRectF &sr,
- Qt::ImageConversionFlags flags = Qt::AutoColor) Q_DECL_OVERRIDE;
- void drawTextItem(const QPointF &p, const QTextItem &ti) Q_DECL_OVERRIDE;
+ Qt::ImageConversionFlags flags = Qt::AutoColor) override;
+ void drawTextItem(const QPointF &p, const QTextItem &ti) override;
- Type type() const Q_DECL_OVERRIDE { return Picture; }
+ Type type() const override { return Picture; }
protected:
QPicturePaintEngine(QPaintEnginePrivate &dptr);
diff --git a/src/gui/image/qpicture.cpp b/src/gui/image/qpicture.cpp
index bf628e7571..7aa221948e 100644
--- a/src/gui/image/qpicture.cpp
+++ b/src/gui/image/qpicture.cpp
@@ -456,8 +456,8 @@ public:
QFakeDevice() { dpi_x = qt_defaultDpiX(); dpi_y = qt_defaultDpiY(); }
void setDpiX(int dpi) { dpi_x = dpi; }
void setDpiY(int dpi) { dpi_y = dpi; }
- QPaintEngine *paintEngine() const Q_DECL_OVERRIDE { return 0; }
- int metric(PaintDeviceMetric m) const Q_DECL_OVERRIDE
+ QPaintEngine *paintEngine() const override { return 0; }
+ int metric(PaintDeviceMetric m) const override
{
switch(m) {
case PdmPhysicalDpiX:
diff --git a/src/gui/image/qpicture.h b/src/gui/image/qpicture.h
index db2b767efe..ec7b4bd7e3 100644
--- a/src/gui/image/qpicture.h
+++ b/src/gui/image/qpicture.h
@@ -62,17 +62,17 @@ public:
bool isNull() const;
- int devType() const Q_DECL_OVERRIDE;
+ int devType() const override;
uint size() const;
const char* data() const;
virtual void setData(const char* data, uint size);
bool play(QPainter *p);
- bool load(QIODevice *dev, const char *format = Q_NULLPTR);
- bool load(const QString &fileName, const char *format = Q_NULLPTR);
- bool save(QIODevice *dev, const char *format = Q_NULLPTR);
- bool save(const QString &fileName, const char *format = Q_NULLPTR);
+ bool load(QIODevice *dev, const char *format = nullptr);
+ bool load(const QString &fileName, const char *format = nullptr);
+ bool save(QIODevice *dev, const char *format = nullptr);
+ bool save(const QString &fileName, const char *format = nullptr);
QRect boundingRect() const;
void setBoundingRect(const QRect &r);
@@ -98,12 +98,12 @@ public:
static QT_DEPRECATED QStringList outputFormatList();
#endif // QT_DEPRECATED_SINCE(5, 10)
- QPaintEngine *paintEngine() const Q_DECL_OVERRIDE;
+ QPaintEngine *paintEngine() const override;
protected:
QPicture(QPicturePrivate &data);
- int metric(PaintDeviceMetric m) const Q_DECL_OVERRIDE;
+ int metric(PaintDeviceMetric m) const override;
private:
bool exec(QPainter *p, QDataStream &ds, int i);
diff --git a/src/gui/image/qpictureformatplugin.h b/src/gui/image/qpictureformatplugin.h
index 32195687c7..3f59c04d79 100644
--- a/src/gui/image/qpictureformatplugin.h
+++ b/src/gui/image/qpictureformatplugin.h
@@ -60,7 +60,7 @@ class Q_GUI_EXPORT QPictureFormatPlugin : public QObject
{
Q_OBJECT
public:
- explicit QPictureFormatPlugin(QObject *parent = Q_NULLPTR);
+ explicit QPictureFormatPlugin(QObject *parent = nullptr);
~QPictureFormatPlugin();
virtual bool loadPicture(const QString &format, const QString &filename, QPicture *pic);
diff --git a/src/gui/image/qpixmap.h b/src/gui/image/qpixmap.h
index d651b57fd5..55cca7a766 100644
--- a/src/gui/image/qpixmap.h
+++ b/src/gui/image/qpixmap.h
@@ -65,7 +65,7 @@ public:
explicit QPixmap(QPlatformPixmap *data);
QPixmap(int w, int h);
explicit QPixmap(const QSize &);
- QPixmap(const QString& fileName, const char *format = Q_NULLPTR, Qt::ImageConversionFlags flags = Qt::AutoColor);
+ QPixmap(const QString& fileName, const char *format = nullptr, Qt::ImageConversionFlags flags = Qt::AutoColor);
#ifndef QT_NO_IMAGEFORMAT_XPM
explicit QPixmap(const char * const xpm[]);
#endif
@@ -83,7 +83,7 @@ public:
operator QVariant() const;
bool isNull() const;
- int devType() const Q_DECL_OVERRIDE;
+ int devType() const override;
int width() const;
int height() const;
@@ -138,19 +138,19 @@ public:
}
#endif
- bool load(const QString& fileName, const char *format = Q_NULLPTR, Qt::ImageConversionFlags flags = Qt::AutoColor);
- bool loadFromData(const uchar *buf, uint len, const char* format = Q_NULLPTR, Qt::ImageConversionFlags flags = Qt::AutoColor);
- inline bool loadFromData(const QByteArray &data, const char* format = Q_NULLPTR, Qt::ImageConversionFlags flags = Qt::AutoColor);
- bool save(const QString& fileName, const char* format = Q_NULLPTR, int quality = -1) const;
- bool save(QIODevice* device, const char* format = Q_NULLPTR, int quality = -1) const;
+ bool load(const QString& fileName, const char *format = nullptr, Qt::ImageConversionFlags flags = Qt::AutoColor);
+ bool loadFromData(const uchar *buf, uint len, const char* format = nullptr, Qt::ImageConversionFlags flags = Qt::AutoColor);
+ inline bool loadFromData(const QByteArray &data, const char* format = nullptr, Qt::ImageConversionFlags flags = Qt::AutoColor);
+ bool save(const QString& fileName, const char* format = nullptr, int quality = -1) const;
+ bool save(QIODevice* device, const char* format = nullptr, int quality = -1) const;
bool convertFromImage(const QImage &img, Qt::ImageConversionFlags flags = Qt::AutoColor);
inline QPixmap copy(int x, int y, int width, int height) const;
QPixmap copy(const QRect &rect = QRect()) const;
- inline void scroll(int dx, int dy, int x, int y, int width, int height, QRegion *exposed = Q_NULLPTR);
- void scroll(int dx, int dy, const QRect &rect, QRegion *exposed = Q_NULLPTR);
+ inline void scroll(int dx, int dy, int x, int y, int width, int height, QRegion *exposed = nullptr);
+ void scroll(int dx, int dy, const QRect &rect, QRegion *exposed = nullptr);
#if QT_DEPRECATED_SINCE(5, 0)
QT_DEPRECATED inline int serialNumber() const { return cacheKey() >> 32; }
@@ -162,7 +162,7 @@ public:
bool isQBitmap() const;
- QPaintEngine *paintEngine() const Q_DECL_OVERRIDE;
+ QPaintEngine *paintEngine() const override;
inline bool operator!() const { return isNull(); }
@@ -172,7 +172,7 @@ public:
#endif
protected:
- int metric(PaintDeviceMetric) const Q_DECL_OVERRIDE;
+ int metric(PaintDeviceMetric) const override;
static QPixmap fromImageInPlace(QImage &image, Qt::ImageConversionFlags flags = Qt::AutoColor);
private:
diff --git a/src/gui/image/qpixmap_blitter_p.h b/src/gui/image/qpixmap_blitter_p.h
index 9889cfb8ec..d70cbcdcc3 100644
--- a/src/gui/image/qpixmap_blitter_p.h
+++ b/src/gui/image/qpixmap_blitter_p.h
@@ -69,17 +69,17 @@ public:
QBlittable *blittable() const;
void setBlittable(QBlittable *blittable);
- void resize(int width, int height) Q_DECL_OVERRIDE;
- int metric(QPaintDevice::PaintDeviceMetric metric) const Q_DECL_OVERRIDE;
- void fill(const QColor &color) Q_DECL_OVERRIDE;
- QImage *buffer() Q_DECL_OVERRIDE;
- QImage toImage() const Q_DECL_OVERRIDE;
- bool hasAlphaChannel() const Q_DECL_OVERRIDE;
- void fromImage(const QImage &image, Qt::ImageConversionFlags flags) Q_DECL_OVERRIDE;
- qreal devicePixelRatio() const Q_DECL_OVERRIDE;
- void setDevicePixelRatio(qreal scaleFactor) Q_DECL_OVERRIDE;
-
- QPaintEngine *paintEngine() const Q_DECL_OVERRIDE;
+ void resize(int width, int height) override;
+ int metric(QPaintDevice::PaintDeviceMetric metric) const override;
+ void fill(const QColor &color) override;
+ QImage *buffer() override;
+ QImage toImage() const override;
+ bool hasAlphaChannel() const override;
+ void fromImage(const QImage &image, Qt::ImageConversionFlags flags) override;
+ qreal devicePixelRatio() const override;
+ void setDevicePixelRatio(qreal scaleFactor) override;
+
+ QPaintEngine *paintEngine() const override;
void markRasterOverlay(const QRectF &);
void markRasterOverlay(const QPointF &, const QTextItem &);
diff --git a/src/gui/image/qpixmap_raster_p.h b/src/gui/image/qpixmap_raster_p.h
index 6ea965a324..cff962181a 100644
--- a/src/gui/image/qpixmap_raster_p.h
+++ b/src/gui/image/qpixmap_raster_p.h
@@ -63,28 +63,28 @@ public:
QRasterPlatformPixmap(PixelType type);
~QRasterPlatformPixmap();
- QPlatformPixmap *createCompatiblePlatformPixmap() const Q_DECL_OVERRIDE;
-
- void resize(int width, int height) Q_DECL_OVERRIDE;
- bool fromData(const uchar *buffer, uint len, const char *format, Qt::ImageConversionFlags flags) Q_DECL_OVERRIDE;
- void fromImage(const QImage &image, Qt::ImageConversionFlags flags) Q_DECL_OVERRIDE;
- void fromImageInPlace(QImage &image, Qt::ImageConversionFlags flags) Q_DECL_OVERRIDE;
- void fromImageReader(QImageReader *imageReader, Qt::ImageConversionFlags flags) Q_DECL_OVERRIDE;
-
- void copy(const QPlatformPixmap *data, const QRect &rect) Q_DECL_OVERRIDE;
- bool scroll(int dx, int dy, const QRect &rect) Q_DECL_OVERRIDE;
- void fill(const QColor &color) Q_DECL_OVERRIDE;
- bool hasAlphaChannel() const Q_DECL_OVERRIDE;
- QImage toImage() const Q_DECL_OVERRIDE;
- QImage toImage(const QRect &rect) const Q_DECL_OVERRIDE;
- QPaintEngine* paintEngine() const Q_DECL_OVERRIDE;
- QImage* buffer() Q_DECL_OVERRIDE;
- qreal devicePixelRatio() const Q_DECL_OVERRIDE;
- void setDevicePixelRatio(qreal scaleFactor) Q_DECL_OVERRIDE;
+ QPlatformPixmap *createCompatiblePlatformPixmap() const override;
+
+ void resize(int width, int height) override;
+ bool fromData(const uchar *buffer, uint len, const char *format, Qt::ImageConversionFlags flags) override;
+ void fromImage(const QImage &image, Qt::ImageConversionFlags flags) override;
+ void fromImageInPlace(QImage &image, Qt::ImageConversionFlags flags) override;
+ void fromImageReader(QImageReader *imageReader, Qt::ImageConversionFlags flags) override;
+
+ void copy(const QPlatformPixmap *data, const QRect &rect) override;
+ bool scroll(int dx, int dy, const QRect &rect) override;
+ void fill(const QColor &color) override;
+ bool hasAlphaChannel() const override;
+ QImage toImage() const override;
+ QImage toImage(const QRect &rect) const override;
+ QPaintEngine* paintEngine() const override;
+ QImage* buffer() override;
+ qreal devicePixelRatio() const override;
+ void setDevicePixelRatio(qreal scaleFactor) override;
protected:
- int metric(QPaintDevice::PaintDeviceMetric metric) const Q_DECL_OVERRIDE;
+ int metric(QPaintDevice::PaintDeviceMetric metric) const override;
void createPixmapForImage(QImage sourceImage, Qt::ImageConversionFlags flags);
void setImage(const QImage &image);
QImage image;
diff --git a/src/gui/image/qpixmapcache.cpp b/src/gui/image/qpixmapcache.cpp
index 742aa31ba9..4b8b1203d6 100644
--- a/src/gui/image/qpixmapcache.cpp
+++ b/src/gui/image/qpixmapcache.cpp
@@ -193,7 +193,7 @@ public:
QPMCache();
~QPMCache();
- void timerEvent(QTimerEvent *) Q_DECL_OVERRIDE;
+ void timerEvent(QTimerEvent *) override;
bool insert(const QString& key, const QPixmap &pixmap, int cost);
QPixmapCache::Key insert(const QPixmap &pixmap, int cost);
bool replace(const QPixmapCache::Key &key, const QPixmap &pixmap, int cost);
diff --git a/src/gui/image/qpixmapcache.h b/src/gui/image/qpixmapcache.h
index 856b82f559..ea10ab1b76 100644
--- a/src/gui/image/qpixmapcache.h
+++ b/src/gui/image/qpixmapcache.h
@@ -56,7 +56,7 @@ public:
Key();
Key(const Key &other);
#ifdef Q_COMPILER_RVALUE_REFS
- Key(Key &&other) Q_DECL_NOTHROW : d(other.d) { other.d = Q_NULLPTR; }
+ Key(Key &&other) Q_DECL_NOTHROW : d(other.d) { other.d = nullptr; }
Key &operator =(Key &&other) Q_DECL_NOTHROW { swap(other); return *this; }
#endif
~Key();
diff --git a/src/gui/itemmodels/qstandarditemmodel.cpp b/src/gui/itemmodels/qstandarditemmodel.cpp
index 07e372b1ae..519995e82a 100644
--- a/src/gui/itemmodels/qstandarditemmodel.cpp
+++ b/src/gui/itemmodels/qstandarditemmodel.cpp
@@ -185,6 +185,72 @@ void QStandardItemPrivate::childDeleted(QStandardItem *child)
emit model->dataChanged(modelIndex, modelIndex);
}
+namespace {
+
+ struct ByNormalizedRole
+ {
+ static int normalizedRole(int role)
+ {
+ return role == Qt::EditRole ? Qt::DisplayRole : role;
+ }
+
+ bool operator()(const QStandardItemData& standardItemData, const std::pair<const int &, const QVariant&>& roleMapIt) const
+ {
+ return standardItemData.role < normalizedRole(roleMapIt.first);
+ }
+ bool operator()(const std::pair<const int&, const QVariant &>& roleMapIt, const QStandardItemData& standardItemData) const
+ {
+ return normalizedRole(roleMapIt.first) < standardItemData.role;
+ }
+
+ };
+
+ /*
+ Based on std::transform with a twist. The inputs are iterators of <int, QVariant> pair.
+ The variant is checked for validity and if not valid, that element is not taken into account
+ which means that the resulting output might be shorter than the input.
+ */
+ template<class Input, class OutputIt>
+ OutputIt roleMapStandardItemDataTransform(Input first1, Input last1, OutputIt d_first)
+ {
+ while (first1 != last1) {
+ if ((*first1).second.isValid())
+ *d_first++ = QStandardItemData(*first1);
+ ++first1;
+ }
+ return d_first;
+ }
+
+
+ /*
+ Based on std::set_union with a twist. The idea is to create a union of both inputs
+ with an additional constraint: if an input contains an invalid variant, it means
+ that this one should not be taken into account for generating the output.
+ */
+ template<class Input1, class Input2,
+ class OutputIt, class Compare>
+ OutputIt roleMapStandardItemDataUnion(Input1 first1, Input1 last1,
+ Input2 first2, Input2 last2,
+ OutputIt d_first, Compare comp)
+ {
+ for (; first1 != last1; ++d_first) {
+ if (first2 == last2) {
+ return roleMapStandardItemDataTransform(first1, last1, d_first);
+ }
+ if (comp(*first2, *first1)) {
+ *d_first = *first2++;
+ } else {
+ if ((*first1).second.isValid())
+ *d_first = QStandardItemData(*first1);
+ if (!comp(*first1, *first2))
+ ++first2;
+ ++first1;
+ }
+ }
+ return std::copy(first2, last2, d_first);
+ }
+}
+
/*!
\internal
*/
@@ -192,18 +258,25 @@ void QStandardItemPrivate::setItemData(const QMap<int, QVariant> &roles)
{
Q_Q(QStandardItem);
- //let's build the vector of new values
+ auto byRole = [](const QStandardItemData& item1, const QStandardItemData& item2) {
+ return item1.role < item2.role;
+ };
+
+ std::sort(values.begin(), values.end(), byRole);
+
+ /*
+ Create a vector of QStandardItemData that will contain the original values
+ if the matching role is not contained in roles, the new value if it is and
+ if the new value is an invalid QVariant, it will be removed.
+ */
QVector<QStandardItemData> newValues;
- for (auto it = roles.begin(), end = roles.end(); it != end; ++it) {
- const QVariant &value = it.value();
- if (value.isValid()) {
- int role = it.key();
- role = (role == Qt::EditRole) ? Qt::DisplayRole : role;
- newValues.append(QStandardItemData(role, value));
- }
- }
+ newValues.reserve(values.size());
+ roleMapStandardItemDataUnion(roles.keyValueBegin(),
+ roles.keyValueEnd(),
+ values.cbegin(), values.cend(),
+ std::back_inserter(newValues), ByNormalizedRole());
- if (values!=newValues) {
+ if (newValues != values) {
values.swap(newValues);
if (model)
model->d_func()->itemChanged(q);
diff --git a/src/gui/itemmodels/qstandarditemmodel.h b/src/gui/itemmodels/qstandarditemmodel.h
index 73107b827c..c54e7b27d9 100644
--- a/src/gui/itemmodels/qstandarditemmodel.h
+++ b/src/gui/itemmodels/qstandarditemmodel.h
@@ -327,45 +327,45 @@ class Q_GUI_EXPORT QStandardItemModel : public QAbstractItemModel
Q_PROPERTY(int sortRole READ sortRole WRITE setSortRole)
public:
- explicit QStandardItemModel(QObject *parent = Q_NULLPTR);
- QStandardItemModel(int rows, int columns, QObject *parent = Q_NULLPTR);
+ explicit QStandardItemModel(QObject *parent = nullptr);
+ QStandardItemModel(int rows, int columns, QObject *parent = nullptr);
~QStandardItemModel();
void setItemRoleNames(const QHash<int,QByteArray> &roleNames);
- QModelIndex index(int row, int column, const QModelIndex &parent = QModelIndex()) const Q_DECL_OVERRIDE;
- QModelIndex parent(const QModelIndex &child) const Q_DECL_OVERRIDE;
+ QModelIndex index(int row, int column, const QModelIndex &parent = QModelIndex()) const override;
+ QModelIndex parent(const QModelIndex &child) const override;
- int rowCount(const QModelIndex &parent = QModelIndex()) const Q_DECL_OVERRIDE;
- int columnCount(const QModelIndex &parent = QModelIndex()) const Q_DECL_OVERRIDE;
- bool hasChildren(const QModelIndex &parent = QModelIndex()) const Q_DECL_OVERRIDE;
+ int rowCount(const QModelIndex &parent = QModelIndex()) const override;
+ int columnCount(const QModelIndex &parent = QModelIndex()) const override;
+ bool hasChildren(const QModelIndex &parent = QModelIndex()) const override;
// Qt 6: Remove
- QModelIndex sibling(int row, int column, const QModelIndex &idx) const Q_DECL_OVERRIDE;
+ QModelIndex sibling(int row, int column, const QModelIndex &idx) const override;
- QVariant data(const QModelIndex &index, int role = Qt::DisplayRole) const Q_DECL_OVERRIDE;
- bool setData(const QModelIndex &index, const QVariant &value, int role = Qt::EditRole) Q_DECL_OVERRIDE;
+ QVariant data(const QModelIndex &index, int role = Qt::DisplayRole) const override;
+ bool setData(const QModelIndex &index, const QVariant &value, int role = Qt::EditRole) override;
QVariant headerData(int section, Qt::Orientation orientation,
- int role = Qt::DisplayRole) const Q_DECL_OVERRIDE;
+ int role = Qt::DisplayRole) const override;
bool setHeaderData(int section, Qt::Orientation orientation, const QVariant &value,
- int role = Qt::EditRole) Q_DECL_OVERRIDE;
+ int role = Qt::EditRole) override;
- bool insertRows(int row, int count, const QModelIndex &parent = QModelIndex()) Q_DECL_OVERRIDE;
- bool insertColumns(int column, int count, const QModelIndex &parent = QModelIndex()) Q_DECL_OVERRIDE;
- bool removeRows(int row, int count, const QModelIndex &parent = QModelIndex()) Q_DECL_OVERRIDE;
- bool removeColumns(int column, int count, const QModelIndex &parent = QModelIndex()) Q_DECL_OVERRIDE;
+ bool insertRows(int row, int count, const QModelIndex &parent = QModelIndex()) override;
+ bool insertColumns(int column, int count, const QModelIndex &parent = QModelIndex()) override;
+ bool removeRows(int row, int count, const QModelIndex &parent = QModelIndex()) override;
+ bool removeColumns(int column, int count, const QModelIndex &parent = QModelIndex()) override;
- Qt::ItemFlags flags(const QModelIndex &index) const Q_DECL_OVERRIDE;
- Qt::DropActions supportedDropActions() const Q_DECL_OVERRIDE;
+ Qt::ItemFlags flags(const QModelIndex &index) const override;
+ Qt::DropActions supportedDropActions() const override;
- QMap<int, QVariant> itemData(const QModelIndex &index) const Q_DECL_OVERRIDE;
- bool setItemData(const QModelIndex &index, const QMap<int, QVariant> &roles) Q_DECL_OVERRIDE;
+ QMap<int, QVariant> itemData(const QModelIndex &index) const override;
+ bool setItemData(const QModelIndex &index, const QMap<int, QVariant> &roles) override;
void clear();
using QObject::parent;
- void sort(int column, Qt::SortOrder order = Qt::AscendingOrder) Q_DECL_OVERRIDE;
+ void sort(int column, Qt::SortOrder order = Qt::AscendingOrder) override;
QStandardItem *itemFromIndex(const QModelIndex &index) const;
QModelIndex indexFromItem(const QStandardItem *item) const;
@@ -414,15 +414,15 @@ public:
int sortRole() const;
void setSortRole(int role);
- QStringList mimeTypes() const Q_DECL_OVERRIDE;
- QMimeData *mimeData(const QModelIndexList &indexes) const Q_DECL_OVERRIDE;
- bool dropMimeData (const QMimeData *data, Qt::DropAction action, int row, int column, const QModelIndex &parent) Q_DECL_OVERRIDE;
+ QStringList mimeTypes() const override;
+ QMimeData *mimeData(const QModelIndexList &indexes) const override;
+ bool dropMimeData (const QMimeData *data, Qt::DropAction action, int row, int column, const QModelIndex &parent) override;
Q_SIGNALS:
void itemChanged(QStandardItem *item);
protected:
- QStandardItemModel(QStandardItemModelPrivate &dd, QObject *parent = Q_NULLPTR);
+ QStandardItemModel(QStandardItemModelPrivate &dd, QObject *parent = nullptr);
private:
friend class QStandardItemPrivate;
diff --git a/src/gui/itemmodels/qstandarditemmodel_p.h b/src/gui/itemmodels/qstandarditemmodel_p.h
index 516cce8613..caee3ea34c 100644
--- a/src/gui/itemmodels/qstandarditemmodel_p.h
+++ b/src/gui/itemmodels/qstandarditemmodel_p.h
@@ -61,6 +61,7 @@
#include <QtCore/qstack.h>
#include <QtCore/qvariant.h>
#include <QtCore/qvector.h>
+#include <QtCore/qdebug.h>
QT_BEGIN_NAMESPACE
@@ -69,6 +70,7 @@ class QStandardItemData
public:
inline QStandardItemData() : role(-1) {}
inline QStandardItemData(int r, const QVariant &v) : role(r), value(v) {}
+ inline QStandardItemData(const std::pair<const int&, const QVariant&> &p) : role(p.first), value(p.second) {}
int role;
QVariant value;
inline bool operator==(const QStandardItemData &other) const { return role == other.role && value == other.value; }
@@ -91,6 +93,15 @@ inline QDataStream &operator<<(QDataStream &out, const QStandardItemData &data)
return out;
}
+inline QDebug &operator<<(QDebug &debug, const QStandardItemData &data)
+{
+ QDebugStateSaver saver(debug);
+ debug.nospace() << data.role
+ << " "
+ << data.value;
+ return debug.space();
+}
+
#endif // QT_NO_DATASTREAM
class QStandardItemPrivate
diff --git a/src/gui/kernel/qcursor.h b/src/gui/kernel/qcursor.h
index ccce3d84ef..d62ee7a053 100644
--- a/src/gui/kernel/qcursor.h
+++ b/src/gui/kernel/qcursor.h
@@ -87,7 +87,7 @@ public:
~QCursor();
QCursor &operator=(const QCursor &cursor);
#ifdef Q_COMPILER_RVALUE_REFS
- QCursor(QCursor &&other) Q_DECL_NOTHROW : d(other.d) { other.d = Q_NULLPTR; }
+ QCursor(QCursor &&other) Q_DECL_NOTHROW : d(other.d) { other.d = nullptr; }
inline QCursor &operator=(QCursor &&other) Q_DECL_NOTHROW
{ swap(other); return *this; }
#endif
diff --git a/src/gui/kernel/qdnd_p.h b/src/gui/kernel/qdnd_p.h
index eaf6c74fd4..e7d83cbbaf 100644
--- a/src/gui/kernel/qdnd_p.h
+++ b/src/gui/kernel/qdnd_p.h
@@ -77,8 +77,8 @@ public:
QInternalMimeData();
~QInternalMimeData();
- bool hasFormat(const QString &mimeType) const Q_DECL_OVERRIDE;
- QStringList formats() const Q_DECL_OVERRIDE;
+ bool hasFormat(const QString &mimeType) const override;
+ QStringList formats() const override;
static bool canReadData(const QString &mimeType);
@@ -87,7 +87,7 @@ public:
static QByteArray renderDataHelper(const QString &mimeType, const QMimeData *data);
protected:
- QVariant retrieveData(const QString &mimeType, QVariant::Type type) const Q_DECL_OVERRIDE;
+ QVariant retrieveData(const QString &mimeType, QVariant::Type type) const override;
virtual bool hasFormat_sys(const QString &mimeType) const = 0;
virtual QStringList formats_sys() const = 0;
diff --git a/src/gui/kernel/qdrag.cpp b/src/gui/kernel/qdrag.cpp
index 0aadac2c62..982c9e7659 100644
--- a/src/gui/kernel/qdrag.cpp
+++ b/src/gui/kernel/qdrag.cpp
@@ -319,14 +319,13 @@ Qt::DropAction QDrag::start(Qt::DropActions request)
to override the default native cursors. To revert to using the
native cursor for \a action pass in a null QPixmap as \a cursor.
- The \a action can only be CopyAction, MoveAction or LinkAction.
- All other values of DropAction are ignored.
+ Note: setting the drag cursor for IgnoreAction may not work on
+ all platforms. X11 and macOS has been tested to work. Windows
+ does not support it.
*/
void QDrag::setDragCursor(const QPixmap &cursor, Qt::DropAction action)
{
Q_D(QDrag);
- if (action != Qt::CopyAction && action != Qt::MoveAction && action != Qt::LinkAction)
- return;
if (cursor.isNull())
d->customCursors.remove(action);
else
diff --git a/src/gui/kernel/qevent.cpp b/src/gui/kernel/qevent.cpp
index 916b13df44..158b83e087 100644
--- a/src/gui/kernel/qevent.cpp
+++ b/src/gui/kernel/qevent.cpp
@@ -694,6 +694,13 @@ QHoverEvent::~QHoverEvent()
*/
/*!
+ \enum QWheelEvent::anonymous
+ \internal
+
+ \value DefaultDeltasPerStep Defaqult deltas per step
+*/
+
+/*!
\fn Qt::MouseButtons QWheelEvent::buttons() const
Returns the mouse state when the event occurred.
@@ -2399,8 +2406,9 @@ QVariant QInputMethodQueryEvent::value(Qt::InputMethodQuery query) const
The \a tangentialPressure parameter contins the tangential pressure of an air
brush. If the device does not support tangential pressure, pass 0 here.
- \a rotation contains the device's rotation in degrees. 4D mice and the Wacom
- Art Pen support rotation. If the device does not support rotation, pass 0 here.
+ \a rotation contains the device's rotation in degrees.
+ 4D mice, the Wacom Art Pen, and the Apple Pencil support rotation.
+ If the device does not support rotation, pass 0 here.
The \a button that caused the event is given as a value from the
\l Qt::MouseButton enum. If the event \a type is not \l TabletPress or
@@ -2541,10 +2549,12 @@ Qt::MouseButtons QTabletEvent::buttons() const
/*!
\fn qreal QTabletEvent::rotation() const
- Returns the rotation of the current device in degress. This is usually
- given by a 4D Mouse. If the device does not support rotation this value is
- always 0.0.
-
+ Returns the rotation of the current tool in degrees, where zero means the
+ tip of the stylus is pointing towards the top of the tablet, a positive
+ value means it's turned to the right, and a negative value means it's
+ turned to the left. This can be given by a 4D Mouse or a rotation-capable
+ stylus (such as the Wacom Art Pen or the Apple Pencil). If the device does
+ not support rotation, this value is always 0.0.
*/
/*!
diff --git a/src/gui/kernel/qevent.h b/src/gui/kernel/qevent.h
index 372b5f0896..d95da40368 100644
--- a/src/gui/kernel/qevent.h
+++ b/src/gui/kernel/qevent.h
@@ -724,7 +724,7 @@ class Q_GUI_EXPORT QActionEvent : public QEvent
{
QAction *act, *bef;
public:
- QActionEvent(int type, QAction *action, QAction *before = Q_NULLPTR);
+ QActionEvent(int type, QAction *action, QAction *before = nullptr);
~QActionEvent();
inline QAction *action() const { return act; }
@@ -852,7 +852,7 @@ public:
TouchPoint(const TouchPoint &other);
#ifdef Q_COMPILER_RVALUE_REFS
TouchPoint(TouchPoint &&other) Q_DECL_NOEXCEPT
- : d(Q_NULLPTR)
+ : d(nullptr)
{ qSwap(d, other.d); }
TouchPoint &operator=(TouchPoint &&other) Q_DECL_NOEXCEPT
{ qSwap(d, other.d); return *this; }
@@ -940,7 +940,7 @@ public:
#endif
explicit QTouchEvent(QEvent::Type eventType,
- QTouchDevice *device = Q_NULLPTR,
+ QTouchDevice *device = nullptr,
Qt::KeyboardModifiers modifiers = Qt::NoModifier,
Qt::TouchPointStates touchPointStates = Qt::TouchPointStates(),
const QList<QTouchEvent::TouchPoint> &touchPoints = QList<QTouchEvent::TouchPoint>());
diff --git a/src/gui/kernel/qgenericplugin.h b/src/gui/kernel/qgenericplugin.h
index e8aa2e6f32..69b4f29854 100644
--- a/src/gui/kernel/qgenericplugin.h
+++ b/src/gui/kernel/qgenericplugin.h
@@ -52,7 +52,7 @@ class Q_GUI_EXPORT QGenericPlugin : public QObject
{
Q_OBJECT
public:
- explicit QGenericPlugin(QObject *parent = Q_NULLPTR);
+ explicit QGenericPlugin(QObject *parent = nullptr);
~QGenericPlugin();
virtual QObject* create(const QString& name, const QString &spec) = 0;
diff --git a/src/gui/kernel/qguiapplication.cpp b/src/gui/kernel/qguiapplication.cpp
index 5baadd425f..b7c61779e6 100644
--- a/src/gui/kernel/qguiapplication.cpp
+++ b/src/gui/kernel/qguiapplication.cpp
@@ -53,6 +53,7 @@
#include <qpa/qplatformdrag.h>
#include <QtCore/QAbstractEventDispatcher>
+#include <QtCore/QStandardPaths>
#include <QtCore/QVariant>
#include <QtCore/private/qcoreapplication_p.h>
#include <QtCore/private/qabstracteventdispatcher_p.h>
@@ -190,7 +191,7 @@ QWindow *QGuiApplicationPrivate::focus_window = 0;
static QBasicMutex applicationFontMutex;
QFont *QGuiApplicationPrivate::app_font = 0;
-QStyleHints *QGuiApplicationPrivate::styleHints = Q_NULLPTR;
+QStyleHints *QGuiApplicationPrivate::styleHints = nullptr;
bool QGuiApplicationPrivate::obey_desktop_settings = true;
QInputDeviceManager *QGuiApplicationPrivate::m_inputDeviceManager = 0;
@@ -244,6 +245,15 @@ static inline void clearFontUnlocked()
QGuiApplicationPrivate::app_font = 0;
}
+static bool checkRunningUnderFlatpak()
+{
+#if QT_CONFIG(dbus)
+ return !QStandardPaths::locate(QStandardPaths::RuntimeLocation, QLatin1String("flatpak-info")).isEmpty();
+#else
+ return false;
+#endif // QT_CONFIG(dbus)
+}
+
// Using aggregate initialization instead of ctor so we can have a POD global static
#define Q_WINDOW_GEOMETRY_SPECIFICATION_INITIALIZER { Qt::TopLeftCorner, -1, -1, -1, -1 }
@@ -748,7 +758,7 @@ QString QGuiApplication::desktopFileName()
*/
QWindow *QGuiApplication::modalWindow()
{
- CHECK_QAPP_INSTANCE(Q_NULLPTR)
+ CHECK_QAPP_INSTANCE(nullptr)
if (QGuiApplicationPrivate::self->modalWindowList.isEmpty())
return 0;
return QGuiApplicationPrivate::self->modalWindowList.first();
@@ -1140,8 +1150,14 @@ static void init_platform(const QString &pluginArgument, const QString &platform
if (Q_UNLIKELY(!QGuiApplicationPrivate::platform_integration)) {
QStringList keys = QPlatformIntegrationFactory::keys(platformPluginPath);
- QString fatalMessage
- = QStringLiteral("This application failed to start because it could not find or load the Qt platform plugin \"%1\"\nin \"%2\".\n\n").arg(name, QDir::toNativeSeparators(platformPluginPath));
+ QString fatalMessage;
+ if (keys.contains(name)) {
+ fatalMessage = QStringLiteral("This application failed to start because it could not load the Qt platform plugin \"%2\"\nin \"%3\", even though it was found. ").arg(name, QDir::toNativeSeparators(platformPluginPath));
+ fatalMessage += QStringLiteral("This is usually due to missing dependencies, which you can verify by setting the env variable QT_DEBUG_PLUGINS to 1.\n\n");
+ } else {
+ fatalMessage = QStringLiteral("This application failed to start because it could not find the Qt platform plugin \"%2\"\nin \"%3\".\n\n").arg(name, QDir::toNativeSeparators(platformPluginPath));
+ }
+
if (!keys.isEmpty()) {
fatalMessage += QStringLiteral("Available platform plugins are: %1.\n\n").arg(
keys.join(QLatin1String(", ")));
@@ -1173,16 +1189,21 @@ static void init_platform(const QString &pluginArgument, const QString &platform
if (!platformThemeName.isEmpty())
themeNames.append(platformThemeName);
- // 2) Ask the platform integration for a list of theme names
+ // 2) Special case - check whether we are in sandbox to use flatpak platform theme for portals support
+ if (checkRunningUnderFlatpak()) {
+ themeNames.append(QStringLiteral("flatpak"));
+ }
+
+ // 3) Ask the platform integration for a list of theme names
themeNames += QGuiApplicationPrivate::platform_integration->themeNames();
- // 3) Look for a theme plugin.
+ // 4) Look for a theme plugin.
for (const QString &themeName : qAsConst(themeNames)) {
QGuiApplicationPrivate::platform_theme = QPlatformThemeFactory::create(themeName, platformPluginPath);
if (QGuiApplicationPrivate::platform_theme)
break;
}
- // 4) If no theme plugin was found ask the platform integration to
+ // 5) If no theme plugin was found ask the platform integration to
// create a theme
if (!QGuiApplicationPrivate::platform_theme) {
for (const QString &themeName : qAsConst(themeNames)) {
@@ -1193,7 +1214,7 @@ static void init_platform(const QString &pluginArgument, const QString &platform
// No error message; not having a theme plugin is allowed.
}
- // 5) Fall back on the built-in "null" platform theme.
+ // 6) Fall back on the built-in "null" platform theme.
if (!QGuiApplicationPrivate::platform_theme)
QGuiApplicationPrivate::platform_theme = new QPlatformTheme;
@@ -1527,7 +1548,7 @@ QGuiApplicationPrivate::~QGuiApplicationPrivate()
cleanupThreadData();
delete QGuiApplicationPrivate::styleHints;
- QGuiApplicationPrivate::styleHints = Q_NULLPTR;
+ QGuiApplicationPrivate::styleHints = nullptr;
delete inputMethod;
qt_cleanupFontDatabase();
@@ -1650,10 +1671,10 @@ QFunctionPointer QGuiApplication::platformFunction(const QByteArray &function)
QPlatformIntegration *pi = QGuiApplicationPrivate::platformIntegration();
if (!pi) {
qWarning("QGuiApplication::platformFunction(): Must construct a QGuiApplication before accessing a platform function");
- return Q_NULLPTR;
+ return nullptr;
}
- return pi->nativeInterface() ? pi->nativeInterface()->platformFunction(function) : Q_NULLPTR;
+ return pi->nativeInterface() ? pi->nativeInterface()->platformFunction(function) : nullptr;
}
/*!
@@ -1736,7 +1757,6 @@ bool QGuiApplicationPrivate::processNativeEvent(QWindow *window, const QByteArra
void QGuiApplicationPrivate::processWindowSystemEvent(QWindowSystemInterfacePrivate::WindowSystemEvent *e)
{
switch(e->type) {
- case QWindowSystemInterfacePrivate::FrameStrutMouse:
case QWindowSystemInterfacePrivate::Mouse:
QGuiApplicationPrivate::processMouseEvent(static_cast<QWindowSystemInterfacePrivate::MouseEvent *>(e));
break;
@@ -1846,29 +1866,111 @@ void QGuiApplicationPrivate::processWindowSystemEvent(QWindowSystemInterfacePriv
}
}
+/*! \internal
+
+ History is silent on why Qt splits mouse events that change position and
+ button state at the same time. We believe that this was done to emulate mouse
+ behavior on touch screens. If mouse tracking is enabled, we will get move
+ events before the button is pressed. A touch panel does not generally give
+ move events when not pressed, so without event splitting code path we would
+ only see a press in a new location without any intervening moves. This could
+ confuse code that is written for a real mouse. The same is true for mouse
+ release events that change position, see tst_QWidget::touchEventSynthesizedMouseEvent()
+ and tst_QWindow::generatedMouseMove() auto tests.
+*/
void QGuiApplicationPrivate::processMouseEvent(QWindowSystemInterfacePrivate::MouseEvent *e)
{
- QEvent::Type type;
- Qt::MouseButtons stateChange = e->buttons ^ mouse_buttons;
- if (e->globalPos != QGuiApplicationPrivate::lastCursorPosition && (stateChange != Qt::NoButton)) {
- // A mouse event should not change both position and buttons at the same time. Instead we
- // should first send a move event followed by a button changed event. Since this is not the case
- // with the current event, we split it in two.
- QWindowSystemInterfacePrivate::MouseEvent mouseButtonEvent(
- e->window.data(), e->timestamp, e->type, e->localPos, e->globalPos, e->buttons, e->modifiers, e->source);
- if (e->flags & QWindowSystemInterfacePrivate::WindowSystemEvent::Synthetic)
- mouseButtonEvent.flags |= QWindowSystemInterfacePrivate::WindowSystemEvent::Synthetic;
- e->buttons = mouse_buttons;
- processMouseEvent(e);
- processMouseEvent(&mouseButtonEvent);
- return;
+ QEvent::Type type = QEvent::None;
+ Qt::MouseButton button = Qt::NoButton;
+ QWindow *window = e->window.data();
+ bool positionChanged = QGuiApplicationPrivate::lastCursorPosition != e->globalPos;
+ bool mouseMove = false;
+ bool mousePress = false;
+
+ if (e->enhancedMouseEvent()) {
+ type = e->buttonType;
+ button = e->button;
+
+ if (type == QEvent::NonClientAreaMouseMove || type == QEvent::MouseMove)
+ mouseMove = true;
+ else if (type == QEvent::NonClientAreaMouseButtonPress || type == QEvent::MouseButtonPress)
+ mousePress = true;
+
+ if (!mouseMove && positionChanged) {
+ QWindowSystemInterfacePrivate::MouseEvent moveEvent(window, e->timestamp,
+ e->localPos, e->globalPos, e->buttons ^ button, e->modifiers, Qt::NoButton,
+ e->nonClientArea ? QEvent::NonClientAreaMouseMove : QEvent::MouseMove,
+ e->source, e->nonClientArea);
+ if (e->synthetic())
+ moveEvent.flags |= QWindowSystemInterfacePrivate::WindowSystemEvent::Synthetic;
+ processMouseEvent(&moveEvent); // mouse move excluding state change
+ processMouseEvent(e); // the original mouse event
+ return;
+ }
+ } else {
+ Qt::MouseButtons stateChange = e->buttons ^ mouse_buttons;
+ if (positionChanged && (stateChange != Qt::NoButton)) {
+ QWindowSystemInterfacePrivate::MouseEvent moveEvent(window, e->timestamp, e->localPos,
+ e->globalPos, mouse_buttons, e->modifiers, Qt::NoButton, QEvent::None, e->source,
+ e->nonClientArea);
+ if (e->synthetic())
+ moveEvent.flags |= QWindowSystemInterfacePrivate::WindowSystemEvent::Synthetic;
+ processMouseEvent(&moveEvent); // mouse move excluding state change
+ processMouseEvent(e); // the original mouse event
+ return;
+ }
+
+ // In the compatibility path we deduce event type and button that caused the event
+ if (positionChanged) {
+ mouseMove = true;
+ type = e->nonClientArea ? QEvent::NonClientAreaMouseMove : QEvent::MouseMove;
+ } else {
+ // Check to see if a new button has been pressed/released.
+ for (uint mask = Qt::LeftButton; mask <= Qt::MaxMouseButton; mask <<= 1) {
+ if (stateChange & mask) {
+ button = Qt::MouseButton(mask);
+ break;
+ }
+ }
+ if (button == Qt::NoButton) {
+ // Ignore mouse events that don't change the current state. This shouldn't
+ // really happen, getting here can only mean that the stored button state
+ // is out of sync with the actual physical button state.
+ return;
+ }
+ if (button & e->buttons) {
+ mousePress = true;
+ type = e->nonClientArea ? QEvent::NonClientAreaMouseButtonPress
+ : QEvent::MouseButtonPress;
+ } else {
+ type = e->nonClientArea ? QEvent::NonClientAreaMouseButtonRelease
+ : QEvent::MouseButtonRelease;
+ }
+ }
}
- QWindow *window = e->window.data();
modifier_buttons = e->modifiers;
-
QPointF localPoint = e->localPos;
QPointF globalPoint = e->globalPos;
+ bool doubleClick = false;
+
+ if (mouseMove) {
+ QGuiApplicationPrivate::lastCursorPosition = globalPoint;
+ if (qAbs(globalPoint.x() - mousePressX) > mouse_double_click_distance||
+ qAbs(globalPoint.y() - mousePressY) > mouse_double_click_distance)
+ mousePressButton = Qt::NoButton;
+ } else {
+ mouse_buttons = e->buttons;
+ if (mousePress) {
+ ulong doubleClickInterval = static_cast<ulong>(QGuiApplication::styleHints()->mouseDoubleClickInterval());
+ doubleClick = e->timestamp - mousePressTime < doubleClickInterval && button == mousePressButton;
+ mousePressTime = e->timestamp;
+ mousePressButton = button;
+ const QPoint point = QGuiApplicationPrivate::lastCursorPosition.toPoint();
+ mousePressX = point.x();
+ mousePressY = point.y();
+ }
+ }
if (e->nullWindow()) {
window = QGuiApplication::topLevelAt(globalPoint.toPoint());
@@ -1889,44 +1991,6 @@ void QGuiApplicationPrivate::processMouseEvent(QWindowSystemInterfacePrivate::Mo
}
}
- Qt::MouseButton button = Qt::NoButton;
- bool doubleClick = false;
- const bool frameStrut = e->type == QWindowSystemInterfacePrivate::FrameStrutMouse;
-
- if (QGuiApplicationPrivate::lastCursorPosition != globalPoint) {
- type = frameStrut ? QEvent::NonClientAreaMouseMove : QEvent::MouseMove;
- QGuiApplicationPrivate::lastCursorPosition = globalPoint;
- if (qAbs(globalPoint.x() - mousePressX) > mouse_double_click_distance||
- qAbs(globalPoint.y() - mousePressY) > mouse_double_click_distance)
- mousePressButton = Qt::NoButton;
- } else { // Check to see if a new button has been pressed/released.
- for (int check = Qt::LeftButton;
- check <= int(Qt::MaxMouseButton);
- check = check << 1) {
- if (check & stateChange) {
- button = Qt::MouseButton(check);
- break;
- }
- }
- if (button == Qt::NoButton) {
- // Ignore mouse events that don't change the current state.
- return;
- }
- mouse_buttons = e->buttons;
- if (button & e->buttons) {
- ulong doubleClickInterval = static_cast<ulong>(QGuiApplication::styleHints()->mouseDoubleClickInterval());
- doubleClick = e->timestamp - mousePressTime < doubleClickInterval && button == mousePressButton;
- type = frameStrut ? QEvent::NonClientAreaMouseButtonPress : QEvent::MouseButtonPress;
- mousePressTime = e->timestamp;
- mousePressButton = button;
- const QPoint point = QGuiApplicationPrivate::lastCursorPosition.toPoint();
- mousePressX = point.x();
- mousePressY = point.y();
- } else {
- type = frameStrut ? QEvent::NonClientAreaMouseButtonRelease : QEvent::MouseButtonRelease;
- }
- }
-
if (!window)
return;
@@ -1937,14 +2001,14 @@ void QGuiApplicationPrivate::processMouseEvent(QWindowSystemInterfacePrivate::Mo
const QPointF nativeLocalPoint = QHighDpi::toNativePixels(localPoint, screen);
const QPointF nativeGlobalPoint = QHighDpi::toNativePixels(globalPoint, screen);
QMouseEvent ev(type, nativeLocalPoint, nativeLocalPoint, nativeGlobalPoint,
- button, mouse_buttons, e->modifiers, e->source);
+ button, e->buttons, e->modifiers, e->source);
ev.setTimestamp(e->timestamp);
cursor->pointerEvent(ev);
}
}
#endif
- QMouseEvent ev(type, localPoint, localPoint, globalPoint, button, mouse_buttons, e->modifiers, e->source);
+ QMouseEvent ev(type, localPoint, localPoint, globalPoint, button, e->buttons, e->modifiers, e->source);
ev.setTimestamp(e->timestamp);
if (window->d_func()->blockedByModalWindow && !qApp->d_func()->popupActive()) {
@@ -1960,7 +2024,7 @@ void QGuiApplicationPrivate::processMouseEvent(QWindowSystemInterfacePrivate::Mo
QGuiApplication::sendSpontaneousEvent(window, &ev);
e->eventAccepted = ev.isAccepted();
if (!e->synthetic() && !ev.isAccepted()
- && !frameStrut
+ && !e->nonClientArea
&& qApp->testAttribute(Qt::AA_SynthesizeTouchForUnhandledMouseEvents)) {
if (!m_fakeTouchDevice) {
m_fakeTouchDevice = new QTouchDevice;
@@ -1978,7 +2042,7 @@ void QGuiApplicationPrivate::processMouseEvent(QWindowSystemInterfacePrivate::Mo
point.state = Qt::TouchPointPressed;
} else if (type == QEvent::MouseButtonRelease && button == Qt::LeftButton) {
point.state = Qt::TouchPointReleased;
- } else if (type == QEvent::MouseMove && (mouse_buttons & Qt::LeftButton)) {
+ } else if (type == QEvent::MouseMove && (e->buttons & Qt::LeftButton)) {
point.state = Qt::TouchPointMoved;
} else {
return;
@@ -1997,9 +2061,9 @@ void QGuiApplicationPrivate::processMouseEvent(QWindowSystemInterfacePrivate::Mo
if (doubleClick) {
mousePressButton = Qt::NoButton;
if (!e->window.isNull() || e->nullWindow()) { // QTBUG-36364, check if window closed in response to press
- const QEvent::Type doubleClickType = frameStrut ? QEvent::NonClientAreaMouseButtonDblClick : QEvent::MouseButtonDblClick;
+ const QEvent::Type doubleClickType = e->nonClientArea ? QEvent::NonClientAreaMouseButtonDblClick : QEvent::MouseButtonDblClick;
QMouseEvent dblClickEvent(doubleClickType, localPoint, localPoint, globalPoint,
- button, mouse_buttons, e->modifiers, e->source);
+ button, e->buttons, e->modifiers, e->source);
dblClickEvent.setTimestamp(e->timestamp);
QGuiApplication::sendSpontaneousEvent(window, &dblClickEvent);
}
@@ -2363,7 +2427,7 @@ void QGuiApplicationPrivate::processTabletEvent(QWindowSystemInterfacePrivate::T
localValid = false;
}
if (type == QEvent::TabletRelease)
- pointData.target = Q_NULLPTR;
+ pointData.target = nullptr;
if (!window)
return;
}
@@ -2380,20 +2444,30 @@ void QGuiApplicationPrivate::processTabletEvent(QWindowSystemInterfacePrivate::T
break;
}
}
- QTabletEvent ev(type, local, e->global,
- e->device, e->pointerType, e->pressure, e->xTilt, e->yTilt,
- e->tangentialPressure, e->rotation, e->z,
- e->modifiers, e->uid, button, e->buttons);
- ev.setAccepted(false);
- ev.setTimestamp(e->timestamp);
- QGuiApplication::sendSpontaneousEvent(window, &ev);
+ QTabletEvent tabletEvent(type, local, e->global,
+ e->device, e->pointerType, e->pressure, e->xTilt, e->yTilt,
+ e->tangentialPressure, e->rotation, e->z,
+ e->modifiers, e->uid, button, e->buttons);
+ tabletEvent.setAccepted(false);
+ tabletEvent.setTimestamp(e->timestamp);
+ QGuiApplication::sendSpontaneousEvent(window, &tabletEvent);
pointData.state = e->buttons;
- if (!ev.isAccepted() && !QWindowSystemInterfacePrivate::TabletEvent::platformSynthesizesMouse
- && qApp->testAttribute(Qt::AA_SynthesizeMouseForUnhandledTabletEvents)) {
- QWindowSystemInterfacePrivate::MouseEvent fake(window, e->timestamp, e->local, e->global,
- e->buttons, e->modifiers, Qt::MouseEventSynthesizedByQt);
- fake.flags |= QWindowSystemInterfacePrivate::WindowSystemEvent::Synthetic;
- processMouseEvent(&fake);
+ if (!tabletEvent.isAccepted()
+ && !QWindowSystemInterfacePrivate::TabletEvent::platformSynthesizesMouse
+ && qApp->testAttribute(Qt::AA_SynthesizeMouseForUnhandledTabletEvents)) {
+
+ const QEvent::Type mouseType = [&]() {
+ switch (type) {
+ case QEvent::TabletPress: return QEvent::MouseButtonPress;
+ case QEvent::TabletMove: return QEvent::MouseMove;
+ case QEvent::TabletRelease: return QEvent::MouseButtonRelease;
+ default: Q_UNREACHABLE();
+ }
+ }();
+ QWindowSystemInterfacePrivate::MouseEvent mouseEvent(window, e->timestamp, e->local,
+ e->global, e->buttons, e->modifiers, button, mouseType, Qt::MouseEventSynthesizedByQt);
+ mouseEvent.flags |= QWindowSystemInterfacePrivate::WindowSystemEvent::Synthetic;
+ processMouseEvent(&mouseEvent);
}
#else
Q_UNUSED(e)
@@ -2499,7 +2573,7 @@ void QGuiApplicationPrivate::processTouchEvent(QWindowSystemInterfacePrivate::To
++it;
}
for (QSet<QWindow *>::const_iterator winIt = windowsNeedingCancel.constBegin(),
- winItEnd = windowsNeedingCancel.constEnd(); winIt != winItEnd; ++winIt) {
+ winItEnd = windowsNeedingCancel.constEnd(); winIt != winItEnd; ++winIt) {
touchEvent.setWindow(*winIt);
QGuiApplication::sendSpontaneousEvent(*winIt, &touchEvent);
}
@@ -2512,8 +2586,10 @@ void QGuiApplicationPrivate::processTouchEvent(QWindowSystemInterfacePrivate::To
e->timestamp,
synthIt->pos,
synthIt->screenPos,
- mouse_buttons & ~Qt::LeftButton,
+ Qt::NoButton,
e->modifiers,
+ Qt::LeftButton,
+ QEvent::MouseButtonRelease,
Qt::MouseEventSynthesizedByQt);
fake.flags |= QWindowSystemInterfacePrivate::WindowSystemEvent::Synthetic;
processMouseEvent(&fake);
@@ -2710,25 +2786,41 @@ void QGuiApplicationPrivate::processTouchEvent(QWindowSystemInterfacePrivate::To
if (!e->synthetic() && !touchEvent.isAccepted() && qApp->testAttribute(Qt::AA_SynthesizeMouseForUnhandledTouchEvents)) {
// exclude devices which generate their own mouse events
if (!(touchEvent.device()->capabilities() & QTouchDevice::MouseEmulation)) {
- Qt::MouseButtons b = eventType == QEvent::TouchEnd ? Qt::NoButton : Qt::LeftButton;
- if (b == Qt::NoButton)
+
+ if (eventType == QEvent::TouchEnd)
self->synthesizedMousePoints.clear();
const QList<QTouchEvent::TouchPoint> &touchPoints = touchEvent.touchPoints();
if (eventType == QEvent::TouchBegin)
m_fakeMouseSourcePointId = touchPoints.first().id();
+ const QEvent::Type mouseType = [&]() {
+ switch (eventType) {
+ case QEvent::TouchBegin: return QEvent::MouseButtonPress;
+ case QEvent::TouchUpdate: return QEvent::MouseMove;
+ case QEvent::TouchEnd: return QEvent::MouseButtonRelease;
+ default: Q_UNREACHABLE();
+ }
+ }();
+
+ Qt::MouseButton button = mouseType == QEvent::MouseMove ? Qt::NoButton : Qt::LeftButton;
+ Qt::MouseButtons buttons = mouseType == QEvent::MouseButtonRelease ? Qt::NoButton : Qt::LeftButton;
+
for (int i = 0; i < touchPoints.count(); ++i) {
const QTouchEvent::TouchPoint &touchPoint = touchPoints.at(i);
if (touchPoint.id() == m_fakeMouseSourcePointId) {
- if (b != Qt::NoButton)
+ if (eventType != QEvent::TouchEnd)
self->synthesizedMousePoints.insert(w, SynthesizedMouseData(
touchPoint.pos(), touchPoint.screenPos(), w));
+ // All touch events that are not accepted by the application will be translated to
+ // left mouse button events instead (see AA_SynthesizeMouseForUnhandledTouchEvents docs).
QWindowSystemInterfacePrivate::MouseEvent fake(w, e->timestamp,
touchPoint.pos(),
touchPoint.screenPos(),
- b | (mouse_buttons & ~Qt::LeftButton),
+ buttons,
e->modifiers,
+ button,
+ mouseType,
Qt::MouseEventSynthesizedByQt);
fake.flags |= QWindowSystemInterfacePrivate::WindowSystemEvent::Synthetic;
processMouseEvent(&fake);
@@ -3520,7 +3612,7 @@ Qt::LayoutDirection QGuiApplication::layoutDirection()
#ifndef QT_NO_CURSOR
QCursor *QGuiApplication::overrideCursor()
{
- CHECK_QAPP_INSTANCE(Q_NULLPTR)
+ CHECK_QAPP_INSTANCE(nullptr)
return qGuiApp->d_func()->cursor_list.isEmpty() ? 0 : &qGuiApp->d_func()->cursor_list.first();
}
@@ -3720,7 +3812,7 @@ bool QGuiApplication::desktopSettingsAware()
*/
QInputMethod *QGuiApplication::inputMethod()
{
- CHECK_QAPP_INSTANCE(Q_NULLPTR)
+ CHECK_QAPP_INSTANCE(nullptr)
if (!qGuiApp->d_func()->inputMethod)
qGuiApp->d_func()->inputMethod = new QInputMethod();
return qGuiApp->d_func()->inputMethod;
diff --git a/src/gui/kernel/qguiapplication.h b/src/gui/kernel/qguiapplication.h
index e130553b9d..8560fcf18a 100644
--- a/src/gui/kernel/qguiapplication.h
+++ b/src/gui/kernel/qguiapplication.h
@@ -157,7 +157,7 @@ public:
static Qt::ApplicationState applicationState();
static int exec();
- bool notify(QObject *, QEvent *) Q_DECL_OVERRIDE;
+ bool notify(QObject *, QEvent *) override;
#ifndef QT_NO_SESSIONMANAGER
// session management
@@ -189,8 +189,8 @@ Q_SIGNALS:
void applicationDisplayNameChanged();
protected:
- bool event(QEvent *) Q_DECL_OVERRIDE;
- bool compressEvent(QEvent *, QObject *receiver, QPostEventList *) Q_DECL_OVERRIDE;
+ bool event(QEvent *) override;
+ bool compressEvent(QEvent *, QObject *receiver, QPostEventList *) override;
QGuiApplication(QGuiApplicationPrivate &p);
diff --git a/src/gui/kernel/qguiapplication_p.h b/src/gui/kernel/qguiapplication_p.h
index becaa7ceb3..75cbc7abde 100644
--- a/src/gui/kernel/qguiapplication_p.h
+++ b/src/gui/kernel/qguiapplication_p.h
@@ -85,13 +85,13 @@ public:
void init();
void createPlatformIntegration();
- void createEventDispatcher() Q_DECL_OVERRIDE;
- void eventDispatcherReady() Q_DECL_OVERRIDE;
+ void createEventDispatcher() override;
+ void eventDispatcherReady() override;
virtual void notifyLayoutDirectionChange();
virtual void notifyActiveWindowChange(QWindow *previous);
- virtual bool shouldQuit() Q_DECL_OVERRIDE;
+ virtual bool shouldQuit() override;
bool shouldQuitInternal(const QWindowList &processedWindows);
virtual bool tryCloseAllWindows();
@@ -215,7 +215,7 @@ public:
static bool highDpiScalingUpdated;
struct TabletPointData {
- TabletPointData(qint64 devId = 0) : deviceId(devId), state(Qt::NoButton), target(Q_NULLPTR) {}
+ TabletPointData(qint64 devId = 0) : deviceId(devId), state(Qt::NoButton), target(nullptr) {}
qint64 deviceId;
Qt::MouseButtons state;
QWindow *target;
diff --git a/src/gui/kernel/qhighdpiscaling.cpp b/src/gui/kernel/qhighdpiscaling.cpp
index 078f185d08..8689f9f3b1 100644
--- a/src/gui/kernel/qhighdpiscaling.cpp
+++ b/src/gui/kernel/qhighdpiscaling.cpp
@@ -129,7 +129,7 @@ static inline qreal initialGlobalScaleFactor()
Note that the functions in this file do not work with the OS scale factor
directly and are limited to converting between device independent and native
- pixels. The OS scale factor is accunted for by QWindow::devicePixelRatio()
+ pixels. The OS scale factor is accounted for by QWindow::devicePixelRatio()
and similar functions.
Configuration Examples:
@@ -168,7 +168,7 @@ static inline qreal initialGlobalScaleFactor()
1) A global scale factor
The QT_SCALE_FACTOR environment variable can be used to set
- a global scale factor for all windows in the processs. This
+ a global scale factor for all windows in the process. This
is useful for testing and debugging (you can simulate any
devicePixelRatio without needing access to special hardware),
and perhaps also for targeting a specific application to
@@ -204,7 +204,7 @@ static inline qreal initialGlobalScaleFactor()
T fromNativePixels(T, QWindow*)
The following classes in QtGui use native pixels, for the convenience of the
- plataform plugins:
+ platform plugins:
QPlatformWindow
QPlatformScreen
QWindowSystemInterface (API only - Events are in device independent pixels)
diff --git a/src/gui/kernel/qkeysequence.h b/src/gui/kernel/qkeysequence.h
index 6bdfd84ca3..82b88e5d99 100644
--- a/src/gui/kernel/qkeysequence.h
+++ b/src/gui/kernel/qkeysequence.h
@@ -59,7 +59,7 @@ Q_GUI_EXPORT QDataStream &operator<<(QDataStream &in, const QKeySequence &ks);
Q_GUI_EXPORT QDataStream &operator>>(QDataStream &out, QKeySequence &ks);
#endif
-#ifdef Q_QDOC
+#ifdef Q_CLANG_QDOC
void qt_set_sequence_auto_mnemonic(bool b);
#endif
diff --git a/src/gui/kernel/qoffscreensurface.h b/src/gui/kernel/qoffscreensurface.h
index 3295ae0d40..9d4839cb25 100644
--- a/src/gui/kernel/qoffscreensurface.h
+++ b/src/gui/kernel/qoffscreensurface.h
@@ -59,10 +59,10 @@ class Q_GUI_EXPORT QOffscreenSurface : public QObject, public QSurface
public:
// ### Qt 6: merge overloads
explicit QOffscreenSurface(QScreen *screen, QObject *parent);
- explicit QOffscreenSurface(QScreen *screen = Q_NULLPTR);
+ explicit QOffscreenSurface(QScreen *screen = nullptr);
virtual ~QOffscreenSurface();
- SurfaceType surfaceType() const Q_DECL_OVERRIDE;
+ SurfaceType surfaceType() const override;
void create();
void destroy();
@@ -70,10 +70,10 @@ public:
bool isValid() const;
void setFormat(const QSurfaceFormat &format);
- QSurfaceFormat format() const Q_DECL_OVERRIDE;
+ QSurfaceFormat format() const override;
QSurfaceFormat requestedFormat() const;
- QSize size() const Q_DECL_OVERRIDE;
+ QSize size() const override;
QScreen *screen() const;
void setScreen(QScreen *screen);
@@ -91,7 +91,7 @@ private Q_SLOTS:
private:
- QPlatformSurface *surfaceHandle() const Q_DECL_OVERRIDE;
+ QPlatformSurface *surfaceHandle() const override;
Q_DISABLE_COPY(QOffscreenSurface)
};
diff --git a/src/gui/kernel/qopenglcontext.h b/src/gui/kernel/qopenglcontext.h
index 07153db84e..9cfaa52f17 100644
--- a/src/gui/kernel/qopenglcontext.h
+++ b/src/gui/kernel/qopenglcontext.h
@@ -151,7 +151,7 @@ class Q_GUI_EXPORT QOpenGLContext : public QObject
Q_OBJECT
Q_DECLARE_PRIVATE(QOpenGLContext)
public:
- explicit QOpenGLContext(QObject *parent = Q_NULLPTR);
+ explicit QOpenGLContext(QObject *parent = nullptr);
~QOpenGLContext();
void setFormat(const QSurfaceFormat &format);
diff --git a/src/gui/kernel/qopenglcontext_p.h b/src/gui/kernel/qopenglcontext_p.h
index 9f9b4352fc..4f2f951d61 100644
--- a/src/gui/kernel/qopenglcontext_p.h
+++ b/src/gui/kernel/qopenglcontext_p.h
@@ -114,12 +114,12 @@ public:
GLuint id() const { return m_id; }
protected:
- void invalidateResource() Q_DECL_OVERRIDE
+ void invalidateResource() override
{
m_id = 0;
}
- void freeResource(QOpenGLContext *context) Q_DECL_OVERRIDE;
+ void freeResource(QOpenGLContext *context) override;
private:
GLuint m_id;
@@ -213,7 +213,7 @@ public:
, workaround_missingPrecisionQualifiers(false)
, active_engine(0)
, qgl_current_fbo_invalid(false)
- , qgl_current_fbo(Q_NULLPTR)
+ , qgl_current_fbo(nullptr)
, defaultFboRedirect(0)
{
requestedFormat = QSurfaceFormat::defaultFormat();
@@ -266,7 +266,7 @@ public:
static QOpenGLContextPrivate *get(QOpenGLContext *context)
{
- return context ? context->d_func() : Q_NULLPTR;
+ return context ? context->d_func() : nullptr;
}
#if !defined(QT_NO_DEBUG)
diff --git a/src/gui/kernel/qopenglwindow.cpp b/src/gui/kernel/qopenglwindow.cpp
index 5170c7ab63..cf3d712421 100644
--- a/src/gui/kernel/qopenglwindow.cpp
+++ b/src/gui/kernel/qopenglwindow.cpp
@@ -163,7 +163,7 @@ class QOpenGLWindowPaintDevice : public QOpenGLPaintDevice
{
public:
QOpenGLWindowPaintDevice(QOpenGLWindow *window) : m_window(window) { }
- void ensureActiveTarget() Q_DECL_OVERRIDE;
+ void ensureActiveTarget() override;
QOpenGLWindow *m_window;
};
@@ -188,9 +188,9 @@ public:
void bindFBO();
void initialize();
- void beginPaint(const QRegion &region) Q_DECL_OVERRIDE;
- void endPaint() Q_DECL_OVERRIDE;
- void flush(const QRegion &region) Q_DECL_OVERRIDE;
+ void beginPaint(const QRegion &region) override;
+ void endPaint() override;
+ void flush(const QRegion &region) override;
QOpenGLWindow::UpdateBehavior updateBehavior;
bool hasFboBlit;
@@ -344,7 +344,7 @@ void QOpenGLWindowPaintDevice::ensureActiveTarget()
\sa QOpenGLWindow::UpdateBehavior
*/
QOpenGLWindow::QOpenGLWindow(QOpenGLWindow::UpdateBehavior updateBehavior, QWindow *parent)
- : QPaintDeviceWindow(*(new QOpenGLWindowPrivate(Q_NULLPTR, updateBehavior)), parent)
+ : QPaintDeviceWindow(*(new QOpenGLWindowPrivate(nullptr, updateBehavior)), parent)
{
setSurfaceType(QSurface::OpenGLSurface);
}
diff --git a/src/gui/kernel/qopenglwindow.h b/src/gui/kernel/qopenglwindow.h
index fe236f9538..7b3bf004a3 100644
--- a/src/gui/kernel/qopenglwindow.h
+++ b/src/gui/kernel/qopenglwindow.h
@@ -64,8 +64,8 @@ public:
PartialUpdateBlend
};
- explicit QOpenGLWindow(UpdateBehavior updateBehavior = NoPartialUpdate, QWindow *parent = Q_NULLPTR);
- explicit QOpenGLWindow(QOpenGLContext *shareContext, UpdateBehavior updateBehavior = NoPartialUpdate, QWindow *parent = Q_NULLPTR);
+ explicit QOpenGLWindow(UpdateBehavior updateBehavior = NoPartialUpdate, QWindow *parent = nullptr);
+ explicit QOpenGLWindow(QOpenGLContext *shareContext, UpdateBehavior updateBehavior = NoPartialUpdate, QWindow *parent = nullptr);
~QOpenGLWindow();
UpdateBehavior updateBehavior() const;
@@ -91,10 +91,10 @@ protected:
virtual void paintUnderGL();
virtual void paintOverGL();
- void paintEvent(QPaintEvent *event) Q_DECL_OVERRIDE;
- void resizeEvent(QResizeEvent *event) Q_DECL_OVERRIDE;
- int metric(PaintDeviceMetric metric) const Q_DECL_OVERRIDE;
- QPaintDevice *redirected(QPoint *) const Q_DECL_OVERRIDE;
+ void paintEvent(QPaintEvent *event) override;
+ void resizeEvent(QResizeEvent *event) override;
+ int metric(PaintDeviceMetric metric) const override;
+ QPaintDevice *redirected(QPoint *) const override;
private:
Q_DISABLE_COPY(QOpenGLWindow)
diff --git a/src/gui/kernel/qpaintdevicewindow.h b/src/gui/kernel/qpaintdevicewindow.h
index 81b41dcdd5..3be078132f 100644
--- a/src/gui/kernel/qpaintdevicewindow.h
+++ b/src/gui/kernel/qpaintdevicewindow.h
@@ -68,14 +68,14 @@ public Q_SLOTS:
protected:
virtual void paintEvent(QPaintEvent *event);
- int metric(PaintDeviceMetric metric) const Q_DECL_OVERRIDE;
- void exposeEvent(QExposeEvent *) Q_DECL_OVERRIDE;
- bool event(QEvent *event) Q_DECL_OVERRIDE;
+ int metric(PaintDeviceMetric metric) const override;
+ void exposeEvent(QExposeEvent *) override;
+ bool event(QEvent *event) override;
QPaintDeviceWindow(QPaintDeviceWindowPrivate &dd, QWindow *parent);
private:
- QPaintEngine *paintEngine() const Q_DECL_OVERRIDE;
+ QPaintEngine *paintEngine() const override;
Q_DISABLE_COPY(QPaintDeviceWindow)
};
diff --git a/src/gui/kernel/qpalette.h b/src/gui/kernel/qpalette.h
index d04fb1f0c5..71f3d0c3b8 100644
--- a/src/gui/kernel/qpalette.h
+++ b/src/gui/kernel/qpalette.h
@@ -70,7 +70,7 @@ public:
#ifdef Q_COMPILER_RVALUE_REFS
QPalette(QPalette &&other) Q_DECL_NOTHROW
: d(other.d), data(other.data)
- { other.d = Q_NULLPTR; }
+ { other.d = nullptr; }
inline QPalette &operator=(QPalette &&other) Q_DECL_NOEXCEPT
{
for_faster_swapping_dont_use = other.for_faster_swapping_dont_use;
diff --git a/src/gui/kernel/qplatformcursor.cpp b/src/gui/kernel/qplatformcursor.cpp
index e6cf6a8216..df78e7d896 100644
--- a/src/gui/kernel/qplatformcursor.cpp
+++ b/src/gui/kernel/qplatformcursor.cpp
@@ -128,7 +128,7 @@ void QPlatformCursor::setPos(const QPoint &pos)
qWarning("This plugin does not support QCursor::setPos()"
"; emulating movement within the application.");
}
- QWindowSystemInterface::handleMouseEvent(0, pos, pos, Qt::NoButton);
+ QWindowSystemInterface::handleMouseEvent(0, pos, pos, Qt::NoButton, Qt::NoButton, QEvent::MouseMove);
}
// End of display and pointer event handling code
diff --git a/src/gui/kernel/qplatformdialoghelper.cpp b/src/gui/kernel/qplatformdialoghelper.cpp
index ad134ebe7f..fbadb48f70 100644
--- a/src/gui/kernel/qplatformdialoghelper.cpp
+++ b/src/gui/kernel/qplatformdialoghelper.cpp
@@ -297,6 +297,7 @@ void QColorDialogStaticData::writeSettings() const
{
#ifndef QT_NO_SETTINGS
if (customSet) {
+ const_cast<QColorDialogStaticData*>(this)->customSet = false;
QSettings settings(QSettings::UserScope, QStringLiteral("QtProject"));
for (int i = 0; i < int(CustomColorCount); ++i)
settings.setValue(QLatin1String("Qt/customColors/") + QString::number(i), customRgb[i]);
diff --git a/src/gui/kernel/qplatformgraphicsbuffer.cpp b/src/gui/kernel/qplatformgraphicsbuffer.cpp
index d42231e958..cc01efd6db 100644
--- a/src/gui/kernel/qplatformgraphicsbuffer.cpp
+++ b/src/gui/kernel/qplatformgraphicsbuffer.cpp
@@ -217,7 +217,7 @@ void QPlatformGraphicsBuffer::unlock()
the memory returned when not having a SWWriteAccess.
*/
const uchar *QPlatformGraphicsBuffer::data() const
-{ return Q_NULLPTR; }
+{ return nullptr; }
/*!
Accessor for the bytes of the buffer. This function needs to be called on a
@@ -226,7 +226,7 @@ const uchar *QPlatformGraphicsBuffer::data() const
*/
uchar *QPlatformGraphicsBuffer::data()
{
- return Q_NULLPTR;
+ return nullptr;
}
/*!
diff --git a/src/gui/kernel/qplatformgraphicsbufferhelper.h b/src/gui/kernel/qplatformgraphicsbufferhelper.h
index 5b7daff65a..6307f54a3e 100644
--- a/src/gui/kernel/qplatformgraphicsbufferhelper.h
+++ b/src/gui/kernel/qplatformgraphicsbufferhelper.h
@@ -47,7 +47,7 @@ QT_BEGIN_NAMESPACE
namespace QPlatformGraphicsBufferHelper {
bool lockAndBindToTexture(QPlatformGraphicsBuffer *graphicsBuffer, bool *swizzleRandB, bool *premultipliedB, const QRect &rect = QRect());
- bool bindSWToTexture(const QPlatformGraphicsBuffer *graphicsBuffer, bool *swizzleRandB = Q_NULLPTR, bool *premultipliedB = Q_NULLPTR, const QRect &rect = QRect());
+ bool bindSWToTexture(const QPlatformGraphicsBuffer *graphicsBuffer, bool *swizzleRandB = nullptr, bool *premultipliedB = nullptr, const QRect &rect = QRect());
}
QT_END_NAMESPACE
diff --git a/src/gui/kernel/qplatformnativeinterface.cpp b/src/gui/kernel/qplatformnativeinterface.cpp
index 6614d45b12..b24541d3ec 100644
--- a/src/gui/kernel/qplatformnativeinterface.cpp
+++ b/src/gui/kernel/qplatformnativeinterface.cpp
@@ -92,7 +92,7 @@ void *QPlatformNativeInterface::nativeResourceForCursor(const QByteArray &resour
{
Q_UNUSED(resource);
Q_UNUSED(cursor);
- return Q_NULLPTR;
+ return nullptr;
}
#endif // !QT_NO_CURSOR
@@ -129,7 +129,7 @@ QPlatformNativeInterface::NativeResourceForBackingStoreFunction QPlatformNativeI
QFunctionPointer QPlatformNativeInterface::platformFunction(const QByteArray &function) const
{
Q_UNUSED(function);
- return Q_NULLPTR;
+ return nullptr;
}
/*!
diff --git a/src/gui/kernel/qplatformoffscreensurface.cpp b/src/gui/kernel/qplatformoffscreensurface.cpp
index 9d35b37c6a..c2952e166c 100644
--- a/src/gui/kernel/qplatformoffscreensurface.cpp
+++ b/src/gui/kernel/qplatformoffscreensurface.cpp
@@ -1,6 +1,6 @@
/****************************************************************************
**
-** Copyright (C) 2016 The Qt Company Ltd.
+** Copyright (C) 2017 The Qt Company Ltd.
** Contact: https://www.qt.io/licensing/
**
** This file is part of the QtGui module of the Qt Toolkit.
diff --git a/src/gui/kernel/qplatformoffscreensurface.h b/src/gui/kernel/qplatformoffscreensurface.h
index be15a98e28..cef0fab7e1 100644
--- a/src/gui/kernel/qplatformoffscreensurface.h
+++ b/src/gui/kernel/qplatformoffscreensurface.h
@@ -1,6 +1,6 @@
/****************************************************************************
**
-** Copyright (C) 2016 The Qt Company Ltd.
+** Copyright (C) 2017 The Qt Company Ltd.
** Contact: https://www.qt.io/licensing/
**
** This file is part of the QtGui module of the Qt Toolkit.
@@ -68,7 +68,7 @@ public:
QOffscreenSurface *offscreenSurface() const;
- QPlatformScreen *screen() const;
+ QPlatformScreen *screen() const override;
virtual QSurfaceFormat format() const override;
virtual bool isValid() const;
diff --git a/src/gui/kernel/qplatformsurface.h b/src/gui/kernel/qplatformsurface.h
index 5a1e4fe82d..76e8767a05 100644
--- a/src/gui/kernel/qplatformsurface.h
+++ b/src/gui/kernel/qplatformsurface.h
@@ -1,6 +1,6 @@
/****************************************************************************
**
-** Copyright (C) 2016 The Qt Company Ltd.
+** Copyright (C) 2017 The Qt Company Ltd.
** Contact: https://www.qt.io/licensing/
**
** This file is part of the QtGui module of the Qt Toolkit.
@@ -56,6 +56,7 @@
QT_BEGIN_NAMESPACE
+class QPlatformScreen;
class Q_GUI_EXPORT QPlatformSurface
{
@@ -64,6 +65,7 @@ public:
virtual QSurfaceFormat format() const = 0;
QSurface *surface() const;
+ virtual QPlatformScreen *screen() const = 0;
private:
explicit QPlatformSurface(QSurface *surface);
diff --git a/src/gui/kernel/qplatformtheme.cpp b/src/gui/kernel/qplatformtheme.cpp
index cd3966fb47..c8ba86bc9a 100644
--- a/src/gui/kernel/qplatformtheme.cpp
+++ b/src/gui/kernel/qplatformtheme.cpp
@@ -747,8 +747,7 @@ QString QPlatformTheme::removeMnemonics(const QString &original)
int currPos = 0;
int l = original.length();
while (l) {
- if (original.at(currPos) == QLatin1Char('&')
- && (l == 1 || original.at(currPos + 1) != QLatin1Char('&'))) {
+ if (original.at(currPos) == QLatin1Char('&')) {
++currPos;
--l;
if (l == 0)
diff --git a/src/gui/kernel/qplatformwindow.cpp b/src/gui/kernel/qplatformwindow.cpp
index 7a4be7b8a8..4bf96e277f 100644
--- a/src/gui/kernel/qplatformwindow.cpp
+++ b/src/gui/kernel/qplatformwindow.cpp
@@ -104,7 +104,7 @@ QPlatformWindow *QPlatformWindow::parent() const
QPlatformScreen *QPlatformWindow::screen() const
{
QScreen *scr = window()->screen();
- return scr ? scr->handle() : Q_NULLPTR;
+ return scr ? scr->handle() : nullptr;
}
/*!
diff --git a/src/gui/kernel/qplatformwindow.h b/src/gui/kernel/qplatformwindow.h
index cf5f38d249..61f1cb624c 100644
--- a/src/gui/kernel/qplatformwindow.h
+++ b/src/gui/kernel/qplatformwindow.h
@@ -1,6 +1,6 @@
/****************************************************************************
**
-** Copyright (C) 2016 The Qt Company Ltd.
+** Copyright (C) 2017 The Qt Company Ltd.
** Contact: https://www.qt.io/licensing/
**
** This file is part of the QtGui module of the Qt Toolkit.
@@ -79,7 +79,7 @@ public:
QWindow *window() const;
QPlatformWindow *parent() const;
- QPlatformScreen *screen() const;
+ QPlatformScreen *screen() const override;
virtual QSurfaceFormat format() const override;
diff --git a/src/gui/kernel/qrasterwindow.cpp b/src/gui/kernel/qrasterwindow.cpp
index 73871e0f39..d06fee62cf 100644
--- a/src/gui/kernel/qrasterwindow.cpp
+++ b/src/gui/kernel/qrasterwindow.cpp
@@ -70,7 +70,7 @@ class QRasterWindowPrivate : public QPaintDeviceWindowPrivate
{
Q_DECLARE_PUBLIC(QRasterWindow)
public:
- void beginPaint(const QRegion &region) Q_DECL_OVERRIDE
+ void beginPaint(const QRegion &region) override
{
Q_Q(QRasterWindow);
const QSize size = q->size();
@@ -81,12 +81,12 @@ public:
backingstore->beginPaint(region);
}
- void endPaint() Q_DECL_OVERRIDE
+ void endPaint() override
{
backingstore->endPaint();
}
- void flush(const QRegion &region) Q_DECL_OVERRIDE
+ void flush(const QRegion &region) override
{
Q_Q(QRasterWindow);
backingstore->flush(region, q);
diff --git a/src/gui/kernel/qrasterwindow.h b/src/gui/kernel/qrasterwindow.h
index 9b29183ad6..9fe01c076b 100644
--- a/src/gui/kernel/qrasterwindow.h
+++ b/src/gui/kernel/qrasterwindow.h
@@ -53,12 +53,12 @@ class Q_GUI_EXPORT QRasterWindow : public QPaintDeviceWindow
Q_DECLARE_PRIVATE(QRasterWindow)
public:
- explicit QRasterWindow(QWindow *parent = Q_NULLPTR);
+ explicit QRasterWindow(QWindow *parent = nullptr);
~QRasterWindow();
protected:
- int metric(PaintDeviceMetric metric) const Q_DECL_OVERRIDE;
- QPaintDevice *redirected(QPoint *) const Q_DECL_OVERRIDE;
+ int metric(PaintDeviceMetric metric) const override;
+ QPaintDevice *redirected(QPoint *) const override;
private:
Q_DISABLE_COPY(QRasterWindow)
diff --git a/src/gui/kernel/qshapedpixmapdndwindow_p.h b/src/gui/kernel/qshapedpixmapdndwindow_p.h
index 2c25ca7c76..477938867c 100644
--- a/src/gui/kernel/qshapedpixmapdndwindow_p.h
+++ b/src/gui/kernel/qshapedpixmapdndwindow_p.h
@@ -71,7 +71,7 @@ public:
void updateGeometry(const QPoint &pos);
protected:
- void paintEvent(QPaintEvent *) Q_DECL_OVERRIDE;
+ void paintEvent(QPaintEvent *) override;
private:
QPixmap m_pixmap;
diff --git a/src/gui/kernel/qsimpledrag.cpp b/src/gui/kernel/qsimpledrag.cpp
index 99aaed0444..1b56c7d9f2 100644
--- a/src/gui/kernel/qsimpledrag.cpp
+++ b/src/gui/kernel/qsimpledrag.cpp
@@ -97,7 +97,7 @@ QBasicDrag::QBasicDrag() :
m_restoreCursor(false), m_eventLoop(0),
m_executed_drop_action(Qt::IgnoreAction), m_can_drop(false),
m_drag(0), m_drag_icon_window(0), m_useCompositing(true),
- m_screen(Q_NULLPTR)
+ m_screen(nullptr)
{
}
diff --git a/src/gui/kernel/qsimpledrag_p.h b/src/gui/kernel/qsimpledrag_p.h
index 45c13e43b2..4db8eb4505 100644
--- a/src/gui/kernel/qsimpledrag_p.h
+++ b/src/gui/kernel/qsimpledrag_p.h
@@ -72,10 +72,10 @@ class Q_GUI_EXPORT QBasicDrag : public QPlatformDrag, public QObject
public:
virtual ~QBasicDrag();
- virtual Qt::DropAction drag(QDrag *drag) Q_DECL_OVERRIDE;
- void cancelDrag() Q_DECL_OVERRIDE;
+ virtual Qt::DropAction drag(QDrag *drag) override;
+ void cancelDrag() override;
- virtual bool eventFilter(QObject *o, QEvent *e) Q_DECL_OVERRIDE;
+ virtual bool eventFilter(QObject *o, QEvent *e) override;
protected:
QBasicDrag();
@@ -127,10 +127,10 @@ public:
QSimpleDrag();
protected:
- virtual void startDrag() Q_DECL_OVERRIDE;
- virtual void cancel() Q_DECL_OVERRIDE;
- virtual void move(const QPoint &globalPos) Q_DECL_OVERRIDE;
- virtual void drop(const QPoint &globalPos) Q_DECL_OVERRIDE;
+ virtual void startDrag() override;
+ virtual void cancel() override;
+ virtual void move(const QPoint &globalPos) override;
+ virtual void drop(const QPoint &globalPos) override;
private:
QWindow *m_current_window;
diff --git a/src/gui/kernel/qwindow.h b/src/gui/kernel/qwindow.h
index 44ff054fa3..ac5543f884 100644
--- a/src/gui/kernel/qwindow.h
+++ b/src/gui/kernel/qwindow.h
@@ -141,12 +141,12 @@ public:
};
Q_ENUM(AncestorMode)
- explicit QWindow(QScreen *screen = Q_NULLPTR);
+ explicit QWindow(QScreen *screen = nullptr);
explicit QWindow(QWindow *parent);
virtual ~QWindow();
void setSurfaceType(SurfaceType surfaceType);
- SurfaceType surfaceType() const Q_DECL_OVERRIDE;
+ SurfaceType surfaceType() const override;
bool isVisible() const;
@@ -168,7 +168,7 @@ public:
void setModality(Qt::WindowModality modality);
void setFormat(const QSurfaceFormat &format);
- QSurfaceFormat format() const Q_DECL_OVERRIDE;
+ QSurfaceFormat format() const override;
QSurfaceFormat requestedFormat() const;
void setFlags(Qt::WindowFlags flags);
@@ -231,7 +231,7 @@ public:
inline int x() const { return geometry().x(); }
inline int y() const { return geometry().y(); }
- QSize size() const Q_DECL_OVERRIDE { return geometry().size(); }
+ QSize size() const override { return geometry().size(); }
inline QPoint position() const { return geometry().topLeft(); }
void setPosition(const QPoint &pt);
@@ -347,7 +347,7 @@ protected:
virtual void hideEvent(QHideEvent *);
// TODO Qt 6 - add closeEvent virtual handler
- virtual bool event(QEvent *) Q_DECL_OVERRIDE;
+ virtual bool event(QEvent *) override;
virtual void keyPressEvent(QKeyEvent *);
virtual void keyReleaseEvent(QKeyEvent *);
virtual void mousePressEvent(QMouseEvent *);
@@ -367,7 +367,7 @@ protected:
private:
Q_PRIVATE_SLOT(d_func(), void _q_clearAlert())
- QPlatformSurface *surfaceHandle() const Q_DECL_OVERRIDE;
+ QPlatformSurface *surfaceHandle() const override;
Q_DISABLE_COPY(QWindow)
@@ -380,12 +380,12 @@ private:
#ifndef Q_QDOC
template <> inline QWindow *qobject_cast<QWindow*>(QObject *o)
{
- if (!o || !o->isWindowType()) return Q_NULLPTR;
+ if (!o || !o->isWindowType()) return nullptr;
return static_cast<QWindow*>(o);
}
template <> inline const QWindow *qobject_cast<const QWindow*>(const QObject *o)
{
- if (!o || !o->isWindowType()) return Q_NULLPTR;
+ if (!o || !o->isWindowType()) return nullptr;
return static_cast<const QWindow*>(o);
}
#endif // !Q_QDOC
diff --git a/src/gui/kernel/qwindowsysteminterface.cpp b/src/gui/kernel/qwindowsysteminterface.cpp
index c47d940e4a..35a9ede227 100644
--- a/src/gui/kernel/qwindowsysteminterface.cpp
+++ b/src/gui/kernel/qwindowsysteminterface.cpp
@@ -348,35 +348,79 @@ void QWindowSystemInterface::handleCloseEvent(QWindow *window, bool *accepted)
\a w == 0 means that the event is in global coords only, \a local will be ignored in this case
*/
+#if QT_DEPRECATED_SINCE(5, 11)
QT_DEFINE_QPA_EVENT_HANDLER(void, handleMouseEvent, QWindow *window, const QPointF &local, const QPointF &global, Qt::MouseButtons b,
Qt::KeyboardModifiers mods, Qt::MouseEventSource source)
{
- unsigned long time = QWindowSystemInterfacePrivate::eventTime.elapsed();
- handleMouseEvent<Delivery>(window, time, local, global, b, mods, source);
+ handleMouseEvent<Delivery>(window, local, global, b, Qt::NoButton, QEvent::None, mods, source);
}
QT_DEFINE_QPA_EVENT_HANDLER(void, handleMouseEvent, QWindow *window, ulong timestamp, const QPointF &local, const QPointF &global, Qt::MouseButtons b,
Qt::KeyboardModifiers mods, Qt::MouseEventSource source)
{
- QWindowSystemInterfacePrivate::MouseEvent * e =
- new QWindowSystemInterfacePrivate::MouseEvent(window, timestamp, QHighDpi::fromNativeLocalPosition(local, window), QHighDpi::fromNativePixels(global, window), b, mods, source);
- QWindowSystemInterfacePrivate::handleWindowSystemEvent<Delivery>(e);
+ handleMouseEvent<Delivery>(window, timestamp, local, global, b, Qt::NoButton, QEvent::None, mods, source);
}
void QWindowSystemInterface::handleFrameStrutMouseEvent(QWindow *window, const QPointF &local, const QPointF &global, Qt::MouseButtons b,
Qt::KeyboardModifiers mods, Qt::MouseEventSource source)
{
- const unsigned long time = QWindowSystemInterfacePrivate::eventTime.elapsed();
- handleFrameStrutMouseEvent(window, time, local, global, b, mods, source);
+ handleFrameStrutMouseEvent(window, local, global, b, Qt::NoButton, QEvent::None, mods, source);
}
void QWindowSystemInterface::handleFrameStrutMouseEvent(QWindow *window, ulong timestamp, const QPointF &local, const QPointF &global, Qt::MouseButtons b,
Qt::KeyboardModifiers mods, Qt::MouseEventSource source)
{
- QWindowSystemInterfacePrivate::MouseEvent * e =
- new QWindowSystemInterfacePrivate::MouseEvent(window, timestamp,
- QWindowSystemInterfacePrivate::FrameStrutMouse,
- QHighDpi::fromNativeLocalPosition(local, window), QHighDpi::fromNativePixels(global, window), b, mods, source);
+ handleFrameStrutMouseEvent(window, timestamp, local, global, b, Qt::NoButton, QEvent::None, mods, source);
+}
+#endif // QT_DEPRECATED_SINCE(5, 11)
+
+QT_DEFINE_QPA_EVENT_HANDLER(void, handleMouseEvent, QWindow *window,
+ const QPointF &local, const QPointF &global, Qt::MouseButtons state,
+ Qt::MouseButton button, QEvent::Type type, Qt::KeyboardModifiers mods,
+ Qt::MouseEventSource source)
+{
+ unsigned long time = QWindowSystemInterfacePrivate::eventTime.elapsed();
+ handleMouseEvent<Delivery>(window, time, local, global, state, button, type, mods, source);
+}
+
+QT_DEFINE_QPA_EVENT_HANDLER(void, handleMouseEvent, QWindow *window, ulong timestamp,
+ const QPointF &local, const QPointF &global, Qt::MouseButtons state,
+ Qt::MouseButton button, QEvent::Type type, Qt::KeyboardModifiers mods,
+ Qt::MouseEventSource source)
+{
+ auto localPos = QHighDpi::fromNativeLocalPosition(local, window);
+ auto globalPos = QHighDpi::fromNativePixels(global, window);
+
+ QWindowSystemInterfacePrivate::MouseEvent *e =
+ new QWindowSystemInterfacePrivate::MouseEvent(window, timestamp, localPos, globalPos,
+ state, mods, button, type, source);
+ QWindowSystemInterfacePrivate::handleWindowSystemEvent<Delivery>(e);
+}
+
+void QWindowSystemInterface::handleFrameStrutMouseEvent(QWindow *window,
+ const QPointF &local, const QPointF &global,
+ Qt::MouseButtons state,
+ Qt::MouseButton button, QEvent::Type type,
+ Qt::KeyboardModifiers mods,
+ Qt::MouseEventSource source)
+{
+ const unsigned long time = QWindowSystemInterfacePrivate::eventTime.elapsed();
+ handleFrameStrutMouseEvent(window, time, local, global, state, button, type, mods, source);
+}
+
+void QWindowSystemInterface::handleFrameStrutMouseEvent(QWindow *window, ulong timestamp,
+ const QPointF &local, const QPointF &global,
+ Qt::MouseButtons state,
+ Qt::MouseButton button, QEvent::Type type,
+ Qt::KeyboardModifiers mods,
+ Qt::MouseEventSource source)
+{
+ auto localPos = QHighDpi::fromNativeLocalPosition(local, window);
+ auto globalPos = QHighDpi::fromNativePixels(global, window);
+
+ QWindowSystemInterfacePrivate::MouseEvent *e =
+ new QWindowSystemInterfacePrivate::MouseEvent(window, timestamp, localPos, globalPos,
+ state, mods, button, type, source, true);
QWindowSystemInterfacePrivate::handleWindowSystemEvent(e);
}
@@ -1014,11 +1058,26 @@ bool QWindowSystemInterface::nonUserInputEventsQueued()
// The following functions are used by testlib, and need to be synchronous to avoid
// race conditions with plugins delivering native events from secondary threads.
+// FIXME: It seems unnecessary to export these wrapper functions, when qtestlib could access
+// QWindowSystemInterface directly (by adding dependency to gui-private), see QTBUG-63146.
+
+Q_GUI_EXPORT void qt_handleMouseEvent(QWindow *window, const QPointF &local, const QPointF &global,
+ Qt::MouseButtons state, Qt::MouseButton button,
+ QEvent::Type type, Qt::KeyboardModifiers mods, int timestamp)
+{
+ const qreal factor = QHighDpiScaling::factor(window);
+ QWindowSystemInterface::handleMouseEvent<QWindowSystemInterface::SynchronousDelivery>(window,
+ timestamp, local * factor, global * factor, state, button, type, mods);
+}
-Q_GUI_EXPORT void qt_handleMouseEvent(QWindow *window, const QPointF &local, const QPointF &global, Qt::MouseButtons b, Qt::KeyboardModifiers mods, int timestamp)
+// Wrapper for compatibility with Qt < 5.11
+// ### Qt6: Remove
+Q_GUI_EXPORT void qt_handleMouseEvent(QWindow *window, const QPointF &local, const QPointF &global,
+ Qt::MouseButtons b, Qt::KeyboardModifiers mods, int timestamp)
{
const qreal factor = QHighDpiScaling::factor(window);
- QWindowSystemInterface::handleMouseEvent<QWindowSystemInterface::SynchronousDelivery>(window, timestamp, local * factor, global * factor, b, mods);
+ QWindowSystemInterface::handleMouseEvent<QWindowSystemInterface::SynchronousDelivery>(window,
+ timestamp, local * factor, global * factor, b, Qt::NoButton, QEvent::None, mods);
}
// Wrapper for compatibility with Qt < 5.6
diff --git a/src/gui/kernel/qwindowsysteminterface.h b/src/gui/kernel/qwindowsysteminterface.h
index bd6416cc95..b22495f9d0 100644
--- a/src/gui/kernel/qwindowsysteminterface.h
+++ b/src/gui/kernel/qwindowsysteminterface.h
@@ -76,20 +76,47 @@ public:
struct AsynchronousDelivery {};
struct DefaultDelivery {};
+#if QT_DEPRECATED_SINCE(5, 11)
template<typename Delivery = QWindowSystemInterface::DefaultDelivery>
- static void handleMouseEvent(QWindow *window, const QPointF &local, const QPointF &global, Qt::MouseButtons b,
+ QT_DEPRECATED static void handleMouseEvent(QWindow *window, const QPointF &local, const QPointF &global, Qt::MouseButtons b,
Qt::KeyboardModifiers mods = Qt::NoModifier,
Qt::MouseEventSource source = Qt::MouseEventNotSynthesized);
template<typename Delivery = QWindowSystemInterface::DefaultDelivery>
- static void handleMouseEvent(QWindow *window, ulong timestamp, const QPointF &local, const QPointF &global, Qt::MouseButtons b,
+ QT_DEPRECATED static void handleMouseEvent(QWindow *window, ulong timestamp, const QPointF &local, const QPointF &global, Qt::MouseButtons b,
Qt::KeyboardModifiers mods = Qt::NoModifier,
Qt::MouseEventSource source = Qt::MouseEventNotSynthesized);
- static void handleFrameStrutMouseEvent(QWindow *window, const QPointF &local, const QPointF &global, Qt::MouseButtons b,
+
+ QT_DEPRECATED static void handleFrameStrutMouseEvent(QWindow *window, const QPointF &local, const QPointF &global, Qt::MouseButtons b,
Qt::KeyboardModifiers mods = Qt::NoModifier,
Qt::MouseEventSource source = Qt::MouseEventNotSynthesized);
- static void handleFrameStrutMouseEvent(QWindow *window, ulong timestamp, const QPointF &local, const QPointF &global, Qt::MouseButtons b,
+ QT_DEPRECATED static void handleFrameStrutMouseEvent(QWindow *window, ulong timestamp, const QPointF &local, const QPointF &global, Qt::MouseButtons b,
Qt::KeyboardModifiers mods = Qt::NoModifier,
Qt::MouseEventSource source = Qt::MouseEventNotSynthesized);
+#endif
+ template<typename Delivery = QWindowSystemInterface::DefaultDelivery>
+ static void handleMouseEvent(QWindow *window, const QPointF &local, const QPointF &global,
+ Qt::MouseButtons state, Qt::MouseButton button, QEvent::Type type,
+ Qt::KeyboardModifiers mods = Qt::NoModifier,
+ Qt::MouseEventSource source = Qt::MouseEventNotSynthesized);
+ template<typename Delivery = QWindowSystemInterface::DefaultDelivery>
+ static void handleMouseEvent(QWindow *window, ulong timestamp, const QPointF &local,
+ const QPointF &global, Qt::MouseButtons state,
+ Qt::MouseButton button, QEvent::Type type,
+ Qt::KeyboardModifiers mods = Qt::NoModifier,
+ Qt::MouseEventSource source = Qt::MouseEventNotSynthesized);
+
+ static void handleFrameStrutMouseEvent(QWindow *window, const QPointF &local,
+ const QPointF &global, Qt::MouseButtons state,
+ Qt::MouseButton button, QEvent::Type type,
+ Qt::KeyboardModifiers mods = Qt::NoModifier,
+ Qt::MouseEventSource source =
+ Qt::MouseEventNotSynthesized);
+ static void handleFrameStrutMouseEvent(QWindow *window, ulong timestamp, const QPointF &local,
+ const QPointF &global, Qt::MouseButtons state,
+ Qt::MouseButton button, QEvent::Type type,
+ Qt::KeyboardModifiers mods = Qt::NoModifier,
+ Qt::MouseEventSource source =
+ Qt::MouseEventNotSynthesized);
static bool handleShortcutEvent(QWindow *window, ulong timestamp, int k, Qt::KeyboardModifiers mods, quint32 nativeScanCode,
quint32 nativeVirtualKey, quint32 nativeModifiers, const QString & text = QString(), bool autorep = false, ushort count = 1);
@@ -166,7 +193,7 @@ public:
template<typename Delivery = QWindowSystemInterface::DefaultDelivery>
static void handleExposeEvent(QWindow *window, const QRegion &region);
- static void handleCloseEvent(QWindow *window, bool *accepted = Q_NULLPTR);
+ static void handleCloseEvent(QWindow *window, bool *accepted = nullptr);
template<typename Delivery = QWindowSystemInterface::DefaultDelivery>
static void handleEnterEvent(QWindow *window, const QPointF &local = QPointF(), const QPointF& global = QPointF());
diff --git a/src/gui/kernel/qwindowsysteminterface_p.h b/src/gui/kernel/qwindowsysteminterface_p.h
index f781d6e3b8..c3fb19d21a 100644
--- a/src/gui/kernel/qwindowsysteminterface_p.h
+++ b/src/gui/kernel/qwindowsysteminterface_p.h
@@ -75,7 +75,7 @@ public:
ActivatedWindow = 0x05,
WindowStateChanged = 0x06,
Mouse = UserInputEvent | 0x07,
- FrameStrutMouse = UserInputEvent | 0x08,
+ FrameStrutMouse = UserInputEvent | 0x08, // ### Qt6 remove
Wheel = UserInputEvent | 0x09,
Key = UserInputEvent | 0x0a,
Touch = UserInputEvent | 0x0b,
@@ -235,18 +235,27 @@ public:
class MouseEvent : public InputEvent {
public:
- MouseEvent(QWindow * w, ulong time, const QPointF &local, const QPointF &global,
- Qt::MouseButtons b, Qt::KeyboardModifiers mods,
- Qt::MouseEventSource src = Qt::MouseEventNotSynthesized)
- : InputEvent(w, time, Mouse, mods), localPos(local), globalPos(global), buttons(b), source(src) { }
- MouseEvent(QWindow * w, ulong time, EventType t, const QPointF &local, const QPointF &global,
- Qt::MouseButtons b, Qt::KeyboardModifiers mods,
- Qt::MouseEventSource src = Qt::MouseEventNotSynthesized)
- : InputEvent(w, time, t, mods), localPos(local), globalPos(global), buttons(b), source(src) { }
+ MouseEvent(QWindow *w, ulong time, const QPointF &local, const QPointF &global,
+ Qt::MouseButtons state, Qt::KeyboardModifiers mods,
+ Qt::MouseButton b, QEvent::Type type,
+ Qt::MouseEventSource src = Qt::MouseEventNotSynthesized, bool frame = false)
+ : InputEvent(w, time, Mouse, mods), localPos(local), globalPos(global), buttons(state),
+ source(src), nonClientArea(frame), button(b), buttonType(type) { }
+
+ // ### In Qt6 this method can be removed as there won't be need for compatibility code path
+ bool enhancedMouseEvent() const
+ {
+ static const bool disableEnhanced = qEnvironmentVariableIsSet("QT_QPA_DISABLE_ENHANCED_MOUSE");
+ return !disableEnhanced && buttonType != QEvent::None;
+ }
+
QPointF localPos;
QPointF globalPos;
Qt::MouseButtons buttons;
Qt::MouseEventSource source;
+ bool nonClientArea;
+ Qt::MouseButton button;
+ QEvent::Type buttonType;
};
class WheelEvent : public InputEvent {
@@ -523,7 +532,7 @@ public:
static QList<QTouchEvent::TouchPoint>
fromNativeTouchPoints(const QList<QWindowSystemInterface::TouchPoint> &points,
- const QWindow *window, quint8 deviceId, QEvent::Type *type = Q_NULLPTR);
+ const QWindow *window, quint8 deviceId, QEvent::Type *type = nullptr);
static QList<QWindowSystemInterface::TouchPoint>
toNativeTouchPoints(const QList<QTouchEvent::TouchPoint>& pointList,
const QWindow *window);
diff --git a/src/gui/math3d/qgenericmatrix.cpp b/src/gui/math3d/qgenericmatrix.cpp
index 95312bcbe4..b144d132d0 100644
--- a/src/gui/math3d/qgenericmatrix.cpp
+++ b/src/gui/math3d/qgenericmatrix.cpp
@@ -61,13 +61,13 @@ QT_BEGIN_NAMESPACE
*/
/*!
- \fn QGenericMatrix::QGenericMatrix()
+ \fn template <int N, int M, typename T> QGenericMatrix<N, M, T>::QGenericMatrix()
Constructs a NxM identity matrix.
*/
/*!
- \fn QGenericMatrix::QGenericMatrix(Qt::Initialization)
+ \fn template <int N, int M, typename T> QGenericMatrix<N, M, T>::QGenericMatrix(Qt::Initialization)
\since 5.5
\internal
@@ -75,7 +75,7 @@ QT_BEGIN_NAMESPACE
*/
/*!
- \fn QGenericMatrix::QGenericMatrix(const T *values)
+ \fn template <int N, int M, typename T> QGenericMatrix<N, M, T>::QGenericMatrix(const T *values)
Constructs a matrix from the given N * M floating-point \a values.
The contents of the array \a values is assumed to be in
@@ -85,21 +85,21 @@ QT_BEGIN_NAMESPACE
*/
/*!
- \fn const T& QGenericMatrix::operator()(int row, int column) const
+ \fn template <int N, int M, typename T> const T& QGenericMatrix<N, M, T>::operator()(int row, int column) const
Returns a constant reference to the element at position
(\a row, \a column) in this matrix.
*/
/*!
- \fn T& QGenericMatrix::operator()(int row, int column)
+ \fn template <int N, int M, typename T> T& QGenericMatrix<N, M, T>::operator()(int row, int column)
Returns a reference to the element at position (\a row, \a column)
in this matrix so that the element can be assigned to.
*/
/*!
- \fn bool QGenericMatrix::isIdentity() const
+ \fn template <int N, int M, typename T> bool QGenericMatrix<N, M, T>::isIdentity() const
Returns \c true if this matrix is the identity; false otherwise.
@@ -107,7 +107,7 @@ QT_BEGIN_NAMESPACE
*/
/*!
- \fn void QGenericMatrix::setToIdentity()
+ \fn template <int N, int M, typename T> void QGenericMatrix<N, M, T>::setToIdentity()
Sets this matrix to the identity.
@@ -115,77 +115,77 @@ QT_BEGIN_NAMESPACE
*/
/*!
- \fn void QGenericMatrix::fill(T value)
+ \fn template <int N, int M, typename T> void QGenericMatrix<N, M, T>::fill(T value)
Fills all elements of this matrix with \a value.
*/
/*!
- \fn QGenericMatrix<M, N> QGenericMatrix::transposed() const
+ \fn template <int N, int M, typename T> QGenericMatrix<M, N> QGenericMatrix<N, M, T>::transposed() const
Returns this matrix, transposed about its diagonal.
*/
/*!
- \fn QGenericMatrix<N, M, T>& QGenericMatrix::operator+=(const QGenericMatrix<N, M, T>& other)
+ \fn template <int N, int M, typename T> QGenericMatrix<N, M, T>& QGenericMatrix<N, M, T>::operator+=(const QGenericMatrix<N, M, T>& other)
Adds the contents of \a other to this matrix.
*/
/*!
- \fn QGenericMatrix<N, M, T>& QGenericMatrix::operator-=(const QGenericMatrix<N, M, T>& other)
+ \fn template <int N, int M, typename T> QGenericMatrix<N, M, T>& QGenericMatrix<N, M, T>::operator-=(const QGenericMatrix<N, M, T>& other)
Subtracts the contents of \a other from this matrix.
*/
/*!
- \fn QGenericMatrix<N, M, T>& QGenericMatrix::operator*=(T factor)
+ \fn template <int N, int M, typename T> QGenericMatrix<N, M, T>& QGenericMatrix<N, M, T>::operator*=(T factor)
Multiplies all elements of this matrix by \a factor.
*/
/*!
- \fn QGenericMatrix<N, M, T>& QGenericMatrix::operator/=(T divisor)
+ \fn template <int N, int M, typename T> QGenericMatrix<N, M, T>& QGenericMatrix<N, M, T>::operator/=(T divisor)
Divides all elements of this matrix by \a divisor.
*/
/*!
- \fn bool QGenericMatrix::operator==(const QGenericMatrix<N, M, T>& other) const
+ \fn template <int N, int M, typename T> bool QGenericMatrix<N, M, T>::operator==(const QGenericMatrix<N, M, T>& other) const
Returns \c true if this matrix is identical to \a other; false otherwise.
*/
/*!
- \fn bool QGenericMatrix::operator!=(const QGenericMatrix<N, M, T>& other) const
+ \fn template <int N, int M, typename T> bool QGenericMatrix<N, M, T>::operator!=(const QGenericMatrix<N, M, T>& other) const
Returns \c true if this matrix is not identical to \a other; false otherwise.
*/
/*!
- \fn QGenericMatrix<N, M, T> operator+(const QGenericMatrix<N, M, T>& m1, const QGenericMatrix<N, M, T>& m2)
+ \fn template <int N, int M, typename T> QGenericMatrix<N, M, T> operator+(const QGenericMatrix<N, M, T>& m1, const QGenericMatrix<N, M, T>& m2)
\relates QGenericMatrix
Returns the sum of \a m1 and \a m2.
*/
/*!
- \fn QGenericMatrix<N, M, T> operator-(const QGenericMatrix<N, M, T>& m1, const QGenericMatrix<N, M, T>& m2)
+ \fn template <int N, int M, typename T> QGenericMatrix<N, M, T> operator-(const QGenericMatrix<N, M, T>& m1, const QGenericMatrix<N, M, T>& m2)
\relates QGenericMatrix
Returns the difference of \a m1 and \a m2.
*/
/*!
- \fn QGenericMatrix<M1, M2, T> operator*(const QGenericMatrix<N, M2, T>& m1, const QGenericMatrix<M1, N, T>& m2)
+ \fn template<int NN, int M1, int M2, typename TT> QGenericMatrix<M1, M2, TT> operator*(const QGenericMatrix<NN, M2, TT>& m1, const QGenericMatrix<M1, NN, TT>& m2)
\relates QGenericMatrix
- Returns the product of the NxM2 matrix \a m1 and the M1xN matrix \a m2
+ Returns the product of the NNxM2 matrix \a m1 and the M1xNN matrix \a m2
to produce a M1xM2 matrix result.
*/
/*!
- \fn QGenericMatrix<N, M, T> operator-(const QGenericMatrix<N, M, T>& matrix)
+ \fn template <int N, int M, typename T> QGenericMatrix<N, M, T> operator-(const QGenericMatrix<N, M, T>& matrix)
\overload
\relates QGenericMatrix
@@ -193,35 +193,35 @@ QT_BEGIN_NAMESPACE
*/
/*!
- \fn QGenericMatrix<N, M, T> operator*(T factor, const QGenericMatrix<N, M, T>& matrix)
+ \fn template <int N, int M, typename T> QGenericMatrix<N, M, T> operator*(T factor, const QGenericMatrix<N, M, T>& matrix)
\relates QGenericMatrix
Returns the result of multiplying all elements of \a matrix by \a factor.
*/
/*!
- \fn QGenericMatrix<N, M, T> operator*(const QGenericMatrix<N, M, T>& matrix, T factor)
+ \fn template <int N, int M, typename T> QGenericMatrix<N, M, T> operator*(const QGenericMatrix<N, M, T>& matrix, T factor)
\relates QGenericMatrix
Returns the result of multiplying all elements of \a matrix by \a factor.
*/
/*!
- \fn QGenericMatrix<N, M, T> operator/(const QGenericMatrix<N, M, T>& matrix, T divisor)
+ \fn template <int N, int M, typename T> QGenericMatrix<N, M, T> operator/(const QGenericMatrix<N, M, T>& matrix, T divisor)
\relates QGenericMatrix
Returns the result of dividing all elements of \a matrix by \a divisor.
*/
/*!
- \fn void QGenericMatrix::copyDataTo(T *values) const
+ \fn template <int N, int M, typename T> void QGenericMatrix<N, M, T>::copyDataTo(T *values) const
Retrieves the N * M items in this matrix and copies them to \a values
in row-major order.
*/
/*!
- \fn T *QGenericMatrix::data()
+ \fn template <int N, int M, typename T> T *QGenericMatrix<N, M, T>::data()
Returns a pointer to the raw data of this matrix.
@@ -229,7 +229,7 @@ QT_BEGIN_NAMESPACE
*/
/*!
- \fn const T *QGenericMatrix::data() const
+ \fn template <int N, int M, typename T> const T *QGenericMatrix<N, M, T>::data() const
Returns a constant pointer to the raw data of this matrix.
@@ -237,7 +237,7 @@ QT_BEGIN_NAMESPACE
*/
/*!
- \fn const T *QGenericMatrix::constData() const
+ \fn template <int N, int M, typename T> const T *QGenericMatrix<N, M, T>::constData() const
Returns a constant pointer to the raw data of this matrix.
@@ -247,7 +247,7 @@ QT_BEGIN_NAMESPACE
#ifndef QT_NO_DATASTREAM
/*!
- \fn QDataStream &operator<<(QDataStream &stream, const QGenericMatrix<N, M, T> &matrix)
+ \fn template <int N, int M, typename T> QDataStream &operator<<(QDataStream &stream, const QGenericMatrix<N, M, T> &matrix)
\relates QGenericMatrix
Writes the given \a matrix to the given \a stream and returns a
@@ -257,7 +257,7 @@ QT_BEGIN_NAMESPACE
*/
/*!
- \fn QDataStream &operator>>(QDataStream &stream, QGenericMatrix<N, M, T> &matrix)
+ \fn template <int N, int M, typename T> QDataStream &operator>>(QDataStream &stream, QGenericMatrix<N, M, T> &matrix)
\relates QGenericMatrix
Reads a NxM matrix from the given \a stream into the given \a matrix
diff --git a/src/gui/math3d/qmatrix4x4.h b/src/gui/math3d/qmatrix4x4.h
index 97df11a8bd..69c3510659 100644
--- a/src/gui/math3d/qmatrix4x4.h
+++ b/src/gui/math3d/qmatrix4x4.h
@@ -93,7 +93,7 @@ public:
inline void fill(float value);
double determinant() const;
- QMatrix4x4 inverted(bool *invertible = Q_NULLPTR) const;
+ QMatrix4x4 inverted(bool *invertible = nullptr) const;
QMatrix4x4 transposed() const;
QMatrix3x3 normalMatrix() const;
diff --git a/src/gui/opengl/qopengl.cpp b/src/gui/opengl/qopengl.cpp
index 7e663d48bb..3a476978e7 100644
--- a/src/gui/opengl/qopengl.cpp
+++ b/src/gui/opengl/qopengl.cpp
@@ -143,7 +143,7 @@ typedef QJsonArray::ConstIterator JsonArrayConstIt;
static inline bool contains(const QJsonArray &haystack, unsigned needle)
{
for (JsonArrayConstIt it = haystack.constBegin(), cend = haystack.constEnd(); it != cend; ++it) {
- if (needle == it->toString().toUInt(Q_NULLPTR, /* base */ 0))
+ if (needle == it->toString().toUInt(nullptr, /* base */ 0))
return true;
}
return false;
@@ -331,7 +331,7 @@ static bool matches(const QJsonObject &object,
const QJsonValue vendorV = object.value(QLatin1String("vendor_id"));
if (vendorV.isString()) {
- if (gpu.vendorId != vendorV.toString().toUInt(Q_NULLPTR, /* base */ 0))
+ if (gpu.vendorId != vendorV.toString().toUInt(nullptr, /* base */ 0))
return false;
} else {
if (object.contains(QLatin1String("gl_vendor"))) {
diff --git a/src/gui/opengl/qopengl.h b/src/gui/opengl/qopengl.h
index f6c350ba0b..b4657fa118 100644
--- a/src/gui/opengl/qopengl.h
+++ b/src/gui/opengl/qopengl.h
@@ -235,10 +235,6 @@ typedef long long int int64_t;
typedef unsigned long long int uint64_t;
#endif /* __arch64__ */
#endif /* __STDC__ */
-#elif defined( __VMS ) || defined(__sgi)
-#include <inttypes.h>
-#elif defined(__SCO__) || defined(__USLC__)
-#include <stdint.h>
#elif defined(__UNIXOS2__) || defined(__SOL64__)
typedef long int int32_t;
typedef long long int int64_t;
diff --git a/src/gui/opengl/qopenglbuffer.h b/src/gui/opengl/qopenglbuffer.h
index f2dfec3bb4..a810783731 100644
--- a/src/gui/opengl/qopenglbuffer.h
+++ b/src/gui/opengl/qopenglbuffer.h
@@ -124,7 +124,7 @@ public:
void write(int offset, const void *data, int count);
void allocate(const void *data, int count);
- inline void allocate(int count) { allocate(Q_NULLPTR, count); }
+ inline void allocate(int count) { allocate(nullptr, count); }
void *map(QOpenGLBuffer::Access access);
void *mapRange(int offset, int count, QOpenGLBuffer::RangeAccessFlags access);
diff --git a/src/gui/opengl/qopengldebug.h b/src/gui/opengl/qopengldebug.h
index 6b10c36291..556ec175e1 100644
--- a/src/gui/opengl/qopengldebug.h
+++ b/src/gui/opengl/qopengldebug.h
@@ -167,7 +167,7 @@ public:
};
Q_ENUM(LoggingMode)
- explicit QOpenGLDebugLogger(QObject *parent = Q_NULLPTR);
+ explicit QOpenGLDebugLogger(QObject *parent = nullptr);
~QOpenGLDebugLogger();
bool initialize();
diff --git a/src/gui/opengl/qopenglengineshadermanager.cpp b/src/gui/opengl/qopenglengineshadermanager.cpp
index 3a94fa8805..2f7afa4a66 100644
--- a/src/gui/opengl/qopenglengineshadermanager.cpp
+++ b/src/gui/opengl/qopenglengineshadermanager.cpp
@@ -69,13 +69,13 @@ public:
delete m_shaders;
}
- void invalidateResource() Q_DECL_OVERRIDE
+ void invalidateResource() override
{
delete m_shaders;
m_shaders = 0;
}
- void freeResource(QOpenGLContext *) Q_DECL_OVERRIDE
+ void freeResource(QOpenGLContext *) override
{
}
diff --git a/src/gui/opengl/qopenglext.h b/src/gui/opengl/qopenglext.h
index b8b0c31f31..856adb679e 100644
--- a/src/gui/opengl/qopenglext.h
+++ b/src/gui/opengl/qopenglext.h
@@ -1405,10 +1405,6 @@ typedef long long int int64_t;
typedef unsigned long long int uint64_t;
#endif /* __arch64__ */
#endif /* __STDC__ */
-#elif defined( __VMS ) || defined(__sgi)
-#include <inttypes.h>
-#elif defined(__SCO__) || defined(__USLC__)
-#include <stdint.h>
#elif defined(__UNIXOS2__) || defined(__SOL64__)
typedef long int int32_t;
typedef long long int int64_t;
diff --git a/src/gui/opengl/qopenglextrafunctions.h b/src/gui/opengl/qopenglextrafunctions.h
index 81716fb8d3..a68e269065 100644
--- a/src/gui/opengl/qopenglextrafunctions.h
+++ b/src/gui/opengl/qopenglextrafunctions.h
@@ -511,7 +511,7 @@ public:
void glTexStorage3DMultisample(GLenum target, GLsizei samples, GLenum internalformat, GLsizei width, GLsizei height, GLsizei depth, GLboolean fixedsamplelocations);
private:
- static bool isInitialized(const QOpenGLExtraFunctionsPrivate *d) { return d != Q_NULLPTR; }
+ static bool isInitialized(const QOpenGLExtraFunctionsPrivate *d) { return d != nullptr; }
};
diff --git a/src/gui/opengl/qopenglframebufferobject.cpp b/src/gui/opengl/qopenglframebufferobject.cpp
index b56bcd0866..469f019a1c 100644
--- a/src/gui/opengl/qopenglframebufferobject.cpp
+++ b/src/gui/opengl/qopenglframebufferobject.cpp
@@ -816,7 +816,7 @@ static inline GLenum effectiveInternalFormat(GLenum internalFormat)
return internalFormat;
}
-/*! \fn QOpenGLFramebufferObject::QOpenGLFramebufferObject(const QSize &size, GLenum target)
+/*!
Constructs an OpenGL framebuffer object and binds a 2D OpenGL texture
to the buffer of the size \a size. The texture is bound to the
@@ -847,7 +847,7 @@ QOpenGLFramebufferObject::QOpenGLFramebufferObject(const QSize &size, GLenum tar
d->init(this, size, NoAttachment, target, effectiveInternalFormat(0));
}
-/*! \overload
+/*!
Constructs an OpenGL framebuffer object and binds a 2D OpenGL texture
to the buffer of the given \a width and \a height.
@@ -859,7 +859,7 @@ QOpenGLFramebufferObject::QOpenGLFramebufferObject(int width, int height, GLenum
{
}
-/*! \overload
+/*!
Constructs an OpenGL framebuffer object of the given \a size based on the
supplied \a format.
@@ -873,7 +873,7 @@ QOpenGLFramebufferObject::QOpenGLFramebufferObject(const QSize &size, const QOpe
format.samples(), format.mipmap());
}
-/*! \overload
+/*!
Constructs an OpenGL framebuffer object of the given \a width and \a height
based on the supplied \a format.
@@ -884,7 +884,7 @@ QOpenGLFramebufferObject::QOpenGLFramebufferObject(int width, int height, const
{
}
-/*! \overload
+/*!
Constructs an OpenGL framebuffer object and binds a texture to the
buffer of the given \a width and \a height.
@@ -905,7 +905,7 @@ QOpenGLFramebufferObject::QOpenGLFramebufferObject(int width, int height, Attach
d->init(this, QSize(width, height), attachment, target, effectiveInternalFormat(internalFormat));
}
-/*! \overload
+/*!
Constructs an OpenGL framebuffer object and binds a texture to the
buffer of the given \a size.
@@ -927,7 +927,6 @@ QOpenGLFramebufferObject::QOpenGLFramebufferObject(const QSize &size, Attachment
}
/*!
- \fn QOpenGLFramebufferObject::~QOpenGLFramebufferObject()
Destroys the framebuffer object and frees any allocated resources.
*/
@@ -953,7 +952,7 @@ QOpenGLFramebufferObject::~QOpenGLFramebufferObject()
QOpenGLContextPrivate *contextPrv = QOpenGLContextPrivate::get(QOpenGLContext::currentContext());
if (contextPrv && contextPrv->qgl_current_fbo == this) {
contextPrv->qgl_current_fbo_invalid = true;
- contextPrv->qgl_current_fbo = Q_NULLPTR;
+ contextPrv->qgl_current_fbo = nullptr;
}
}
@@ -1116,7 +1115,7 @@ bool QOpenGLFramebufferObject::release()
QOpenGLContextPrivate *contextPrv = QOpenGLContextPrivate::get(current);
contextPrv->qgl_current_fbo_invalid = true;
- contextPrv->qgl_current_fbo = Q_NULLPTR;
+ contextPrv->qgl_current_fbo = nullptr;
}
return true;
@@ -1472,7 +1471,7 @@ bool QOpenGLFramebufferObject::bindDefault()
if (ctx) {
ctx->functions()->glBindFramebuffer(GL_FRAMEBUFFER, ctx->defaultFramebufferObject());
QOpenGLContextPrivate::get(ctx)->qgl_current_fbo_invalid = true;
- QOpenGLContextPrivate::get(ctx)->qgl_current_fbo = Q_NULLPTR;
+ QOpenGLContextPrivate::get(ctx)->qgl_current_fbo = nullptr;
}
#ifdef QT_DEBUG
else
diff --git a/src/gui/opengl/qopenglframebufferobject.h b/src/gui/opengl/qopenglframebufferobject.h
index b9e61e9ee4..161054d1bf 100644
--- a/src/gui/opengl/qopenglframebufferobject.h
+++ b/src/gui/opengl/qopenglframebufferobject.h
@@ -49,8 +49,18 @@
#include <QtCore/qscopedpointer.h>
-QT_BEGIN_NAMESPACE
+#if defined(Q_CLANG_QDOC)
+#undef GLuint
+typedef unsigned int GLuint;
+#undef GLenum
+typedef unsigned int GLenum;
+#undef GL_TEXTURE_2D
+#define GL_TEXTURE_2D 0x0DE1
+#undef GLbitfield
+typedef unsigned int GLbitfield;
+#endif
+QT_BEGIN_NAMESPACE
class QOpenGLFramebufferObjectPrivate;
class QOpenGLFramebufferObjectFormat;
diff --git a/src/gui/opengl/qopenglfunctions.cpp b/src/gui/opengl/qopenglfunctions.cpp
index 5e3537e47b..23342f7935 100644
--- a/src/gui/opengl/qopenglfunctions.cpp
+++ b/src/gui/opengl/qopenglfunctions.cpp
@@ -216,13 +216,13 @@ struct QOpenGLFunctionsPrivateEx : public QOpenGLExtensionsPrivate, public QOpen
, m_extensions(-1)
{}
- void invalidateResource() Q_DECL_OVERRIDE
+ void invalidateResource() override
{
m_features = -1;
m_extensions = -1;
}
- void freeResource(QOpenGLContext *) Q_DECL_OVERRIDE
+ void freeResource(QOpenGLContext *) override
{
// no gl resources to free
}
@@ -2584,7 +2584,7 @@ QT_OPENGL_IMPLEMENT(QOpenGLFunctionsPrivate, QT_OPENGL_FUNCTIONS)
*/
/*!
- \fn void QOpenGLExtraFunctions::glEndTransformFeedback(void)
+ \fn void QOpenGLExtraFunctions::glEndTransformFeedback()
Convenience function that calls glEndTransformFeedback().
@@ -3091,7 +3091,7 @@ QT_OPENGL_IMPLEMENT(QOpenGLFunctionsPrivate, QT_OPENGL_FUNCTIONS)
*/
/*!
- \fn void QOpenGLExtraFunctions::glPauseTransformFeedback(void)
+ \fn void QOpenGLExtraFunctions::glPauseTransformFeedback()
Convenience function that calls glPauseTransformFeedback().
@@ -3156,7 +3156,7 @@ QT_OPENGL_IMPLEMENT(QOpenGLFunctionsPrivate, QT_OPENGL_FUNCTIONS)
*/
/*!
- \fn void QOpenGLExtraFunctions::glResumeTransformFeedback(void)
+ \fn void QOpenGLExtraFunctions::glResumeTransformFeedback()
Convenience function that calls glResumeTransformFeedback().
diff --git a/src/gui/opengl/qopenglfunctions.h b/src/gui/opengl/qopenglfunctions.h
index 0a5de2c9af..72af128219 100644
--- a/src/gui/opengl/qopenglfunctions.h
+++ b/src/gui/opengl/qopenglfunctions.h
@@ -227,6 +227,29 @@ struct QOpenGLFunctionsPrivate;
#undef glTexLevelParameteriv
+#if defined(Q_CLANG_QDOC)
+#undef GLint
+typedef int GLint;
+#undef GLsizei
+typedef int GLsizei;
+#undef GLuint
+typedef unsigned int GLuint;
+#undef GLenum
+typedef unsigned int GLenum;
+#undef GLbitfield
+typedef unsigned int GLbitfield;
+#undef GLfloat
+typedef float GLfloat;
+#undef GLclampf
+typedef float GLclampf;
+#undef GLboolean
+typedef bool GLboolean;
+#undef GLvoid
+typedef void GLvoid;
+#undef GLchar
+typedef char GLchar;
+#endif
+
class Q_GUI_EXPORT QOpenGLFunctions
{
public:
@@ -413,7 +436,7 @@ public:
protected:
QOpenGLFunctionsPrivate *d_ptr;
- static bool isInitialized(const QOpenGLFunctionsPrivate *d) { return d != Q_NULLPTR; }
+ static bool isInitialized(const QOpenGLFunctionsPrivate *d) { return d != nullptr; }
};
Q_DECLARE_OPERATORS_FOR_FLAGS(QOpenGLFunctions::OpenGLFeatures)
diff --git a/src/gui/opengl/qopenglfunctions_1_0.h b/src/gui/opengl/qopenglfunctions_1_0.h
index 8284604086..cddb7251ed 100644
--- a/src/gui/opengl/qopenglfunctions_1_0.h
+++ b/src/gui/opengl/qopenglfunctions_1_0.h
@@ -65,7 +65,7 @@ public:
QOpenGLFunctions_1_0();
~QOpenGLFunctions_1_0();
- bool initializeOpenGLFunctions() Q_DECL_OVERRIDE;
+ bool initializeOpenGLFunctions() override;
// OpenGL 1.0 core functions
void glViewport(GLint x, GLint y, GLsizei width, GLsizei height);
diff --git a/src/gui/opengl/qopenglfunctions_1_1.h b/src/gui/opengl/qopenglfunctions_1_1.h
index 052d3e93bd..8a9f16ec4c 100644
--- a/src/gui/opengl/qopenglfunctions_1_1.h
+++ b/src/gui/opengl/qopenglfunctions_1_1.h
@@ -65,7 +65,7 @@ public:
QOpenGLFunctions_1_1();
~QOpenGLFunctions_1_1();
- bool initializeOpenGLFunctions() Q_DECL_OVERRIDE;
+ bool initializeOpenGLFunctions() override;
// OpenGL 1.0 core functions
void glViewport(GLint x, GLint y, GLsizei width, GLsizei height);
diff --git a/src/gui/opengl/qopenglfunctions_1_2.h b/src/gui/opengl/qopenglfunctions_1_2.h
index 6b36500a79..7daca0923d 100644
--- a/src/gui/opengl/qopenglfunctions_1_2.h
+++ b/src/gui/opengl/qopenglfunctions_1_2.h
@@ -65,7 +65,7 @@ public:
QOpenGLFunctions_1_2();
~QOpenGLFunctions_1_2();
- bool initializeOpenGLFunctions() Q_DECL_OVERRIDE;
+ bool initializeOpenGLFunctions() override;
// OpenGL 1.0 core functions
void glViewport(GLint x, GLint y, GLsizei width, GLsizei height);
diff --git a/src/gui/opengl/qopenglfunctions_1_3.h b/src/gui/opengl/qopenglfunctions_1_3.h
index 3ed5851d5d..b527b57946 100644
--- a/src/gui/opengl/qopenglfunctions_1_3.h
+++ b/src/gui/opengl/qopenglfunctions_1_3.h
@@ -65,7 +65,7 @@ public:
QOpenGLFunctions_1_3();
~QOpenGLFunctions_1_3();
- bool initializeOpenGLFunctions() Q_DECL_OVERRIDE;
+ bool initializeOpenGLFunctions() override;
// OpenGL 1.0 core functions
void glViewport(GLint x, GLint y, GLsizei width, GLsizei height);
diff --git a/src/gui/opengl/qopenglfunctions_1_4.h b/src/gui/opengl/qopenglfunctions_1_4.h
index 849fad6744..1f3f5a9c0a 100644
--- a/src/gui/opengl/qopenglfunctions_1_4.h
+++ b/src/gui/opengl/qopenglfunctions_1_4.h
@@ -65,7 +65,7 @@ public:
QOpenGLFunctions_1_4();
~QOpenGLFunctions_1_4();
- bool initializeOpenGLFunctions() Q_DECL_OVERRIDE;
+ bool initializeOpenGLFunctions() override;
// OpenGL 1.0 core functions
void glViewport(GLint x, GLint y, GLsizei width, GLsizei height);
diff --git a/src/gui/opengl/qopenglfunctions_1_5.h b/src/gui/opengl/qopenglfunctions_1_5.h
index 18914a8957..d2f5311211 100644
--- a/src/gui/opengl/qopenglfunctions_1_5.h
+++ b/src/gui/opengl/qopenglfunctions_1_5.h
@@ -65,7 +65,7 @@ public:
QOpenGLFunctions_1_5();
~QOpenGLFunctions_1_5();
- bool initializeOpenGLFunctions() Q_DECL_OVERRIDE;
+ bool initializeOpenGLFunctions() override;
// OpenGL 1.0 core functions
void glViewport(GLint x, GLint y, GLsizei width, GLsizei height);
diff --git a/src/gui/opengl/qopenglfunctions_2_0.cpp b/src/gui/opengl/qopenglfunctions_2_0.cpp
index c175b13c5b..212723aa00 100644
--- a/src/gui/opengl/qopenglfunctions_2_0.cpp
+++ b/src/gui/opengl/qopenglfunctions_2_0.cpp
@@ -79,7 +79,7 @@ QOpenGLFunctions_2_0::QOpenGLFunctions_2_0()
, d_1_2_Deprecated(0)
, d_1_3_Deprecated(0)
, d_1_4_Deprecated(0)
- , m_reserved_2_0_Deprecated(Q_NULLPTR)
+ , m_reserved_2_0_Deprecated(nullptr)
{
}
diff --git a/src/gui/opengl/qopenglfunctions_2_0.h b/src/gui/opengl/qopenglfunctions_2_0.h
index 74a91e0ff0..556597a9b3 100644
--- a/src/gui/opengl/qopenglfunctions_2_0.h
+++ b/src/gui/opengl/qopenglfunctions_2_0.h
@@ -65,7 +65,7 @@ public:
QOpenGLFunctions_2_0();
~QOpenGLFunctions_2_0();
- bool initializeOpenGLFunctions() Q_DECL_OVERRIDE;
+ bool initializeOpenGLFunctions() override;
// OpenGL 1.0 core functions
void glViewport(GLint x, GLint y, GLsizei width, GLsizei height);
diff --git a/src/gui/opengl/qopenglfunctions_2_1.cpp b/src/gui/opengl/qopenglfunctions_2_1.cpp
index 4e77efd121..b8b255014c 100644
--- a/src/gui/opengl/qopenglfunctions_2_1.cpp
+++ b/src/gui/opengl/qopenglfunctions_2_1.cpp
@@ -80,7 +80,7 @@ QOpenGLFunctions_2_1::QOpenGLFunctions_2_1()
, d_1_2_Deprecated(0)
, d_1_3_Deprecated(0)
, d_1_4_Deprecated(0)
- , m_reserved_2_0_Deprecated(Q_NULLPTR)
+ , m_reserved_2_0_Deprecated(nullptr)
{
}
diff --git a/src/gui/opengl/qopenglfunctions_2_1.h b/src/gui/opengl/qopenglfunctions_2_1.h
index e9212640f7..f053222c71 100644
--- a/src/gui/opengl/qopenglfunctions_2_1.h
+++ b/src/gui/opengl/qopenglfunctions_2_1.h
@@ -65,7 +65,7 @@ public:
QOpenGLFunctions_2_1();
~QOpenGLFunctions_2_1();
- bool initializeOpenGLFunctions() Q_DECL_OVERRIDE;
+ bool initializeOpenGLFunctions() override;
// OpenGL 1.0 core functions
void glViewport(GLint x, GLint y, GLsizei width, GLsizei height);
diff --git a/src/gui/opengl/qopenglfunctions_3_0.cpp b/src/gui/opengl/qopenglfunctions_3_0.cpp
index 09e3ad09ef..4972c03b1e 100644
--- a/src/gui/opengl/qopenglfunctions_3_0.cpp
+++ b/src/gui/opengl/qopenglfunctions_3_0.cpp
@@ -81,8 +81,8 @@ QOpenGLFunctions_3_0::QOpenGLFunctions_3_0()
, d_1_2_Deprecated(0)
, d_1_3_Deprecated(0)
, d_1_4_Deprecated(0)
- , m_reserved_2_0_Deprecated(Q_NULLPTR)
- , m_reserved_3_0_Deprecated(Q_NULLPTR)
+ , m_reserved_2_0_Deprecated(nullptr)
+ , m_reserved_3_0_Deprecated(nullptr)
{
}
diff --git a/src/gui/opengl/qopenglfunctions_3_0.h b/src/gui/opengl/qopenglfunctions_3_0.h
index 1082d869d1..c592050c24 100644
--- a/src/gui/opengl/qopenglfunctions_3_0.h
+++ b/src/gui/opengl/qopenglfunctions_3_0.h
@@ -65,7 +65,7 @@ public:
QOpenGLFunctions_3_0();
~QOpenGLFunctions_3_0();
- bool initializeOpenGLFunctions() Q_DECL_OVERRIDE;
+ bool initializeOpenGLFunctions() override;
// OpenGL 1.0 core functions
void glViewport(GLint x, GLint y, GLsizei width, GLsizei height);
diff --git a/src/gui/opengl/qopenglfunctions_3_1.h b/src/gui/opengl/qopenglfunctions_3_1.h
index 2691dd29e7..3a8d3891f3 100644
--- a/src/gui/opengl/qopenglfunctions_3_1.h
+++ b/src/gui/opengl/qopenglfunctions_3_1.h
@@ -65,7 +65,7 @@ public:
QOpenGLFunctions_3_1();
~QOpenGLFunctions_3_1();
- bool initializeOpenGLFunctions() Q_DECL_OVERRIDE;
+ bool initializeOpenGLFunctions() override;
// OpenGL 1.0 core functions
void glViewport(GLint x, GLint y, GLsizei width, GLsizei height);
diff --git a/src/gui/opengl/qopenglfunctions_3_2_compatibility.cpp b/src/gui/opengl/qopenglfunctions_3_2_compatibility.cpp
index b90a123bfe..709f65edf8 100644
--- a/src/gui/opengl/qopenglfunctions_3_2_compatibility.cpp
+++ b/src/gui/opengl/qopenglfunctions_3_2_compatibility.cpp
@@ -83,8 +83,8 @@ QOpenGLFunctions_3_2_Compatibility::QOpenGLFunctions_3_2_Compatibility()
, d_1_2_Deprecated(0)
, d_1_3_Deprecated(0)
, d_1_4_Deprecated(0)
- , m_reserved_2_0_Deprecated(Q_NULLPTR)
- , m_reserved_3_0_Deprecated(Q_NULLPTR)
+ , m_reserved_2_0_Deprecated(nullptr)
+ , m_reserved_3_0_Deprecated(nullptr)
{
}
diff --git a/src/gui/opengl/qopenglfunctions_3_2_compatibility.h b/src/gui/opengl/qopenglfunctions_3_2_compatibility.h
index 9f34190721..391e725953 100644
--- a/src/gui/opengl/qopenglfunctions_3_2_compatibility.h
+++ b/src/gui/opengl/qopenglfunctions_3_2_compatibility.h
@@ -65,7 +65,7 @@ public:
QOpenGLFunctions_3_2_Compatibility();
~QOpenGLFunctions_3_2_Compatibility();
- bool initializeOpenGLFunctions() Q_DECL_OVERRIDE;
+ bool initializeOpenGLFunctions() override;
// OpenGL 1.0 core functions
void glViewport(GLint x, GLint y, GLsizei width, GLsizei height);
diff --git a/src/gui/opengl/qopenglfunctions_3_2_core.h b/src/gui/opengl/qopenglfunctions_3_2_core.h
index 2d5ee14bee..1eafb6f441 100644
--- a/src/gui/opengl/qopenglfunctions_3_2_core.h
+++ b/src/gui/opengl/qopenglfunctions_3_2_core.h
@@ -65,7 +65,7 @@ public:
QOpenGLFunctions_3_2_Core();
~QOpenGLFunctions_3_2_Core();
- bool initializeOpenGLFunctions() Q_DECL_OVERRIDE;
+ bool initializeOpenGLFunctions() override;
// OpenGL 1.0 core functions
void glViewport(GLint x, GLint y, GLsizei width, GLsizei height);
diff --git a/src/gui/opengl/qopenglfunctions_3_3_compatibility.cpp b/src/gui/opengl/qopenglfunctions_3_3_compatibility.cpp
index c585f0fc7c..b034391c86 100644
--- a/src/gui/opengl/qopenglfunctions_3_3_compatibility.cpp
+++ b/src/gui/opengl/qopenglfunctions_3_3_compatibility.cpp
@@ -84,7 +84,7 @@ QOpenGLFunctions_3_3_Compatibility::QOpenGLFunctions_3_3_Compatibility()
, d_1_2_Deprecated(0)
, d_1_3_Deprecated(0)
, d_1_4_Deprecated(0)
- , m_reserved_2_0_Deprecated(Q_NULLPTR)
+ , m_reserved_2_0_Deprecated(nullptr)
, d_3_3_Deprecated(0)
{
}
diff --git a/src/gui/opengl/qopenglfunctions_3_3_compatibility.h b/src/gui/opengl/qopenglfunctions_3_3_compatibility.h
index a5c0cab63c..185dd5aab4 100644
--- a/src/gui/opengl/qopenglfunctions_3_3_compatibility.h
+++ b/src/gui/opengl/qopenglfunctions_3_3_compatibility.h
@@ -65,7 +65,7 @@ public:
QOpenGLFunctions_3_3_Compatibility();
~QOpenGLFunctions_3_3_Compatibility();
- bool initializeOpenGLFunctions() Q_DECL_OVERRIDE;
+ bool initializeOpenGLFunctions() override;
// OpenGL 1.0 core functions
void glViewport(GLint x, GLint y, GLsizei width, GLsizei height);
diff --git a/src/gui/opengl/qopenglfunctions_3_3_core.h b/src/gui/opengl/qopenglfunctions_3_3_core.h
index 4f0132d959..47d54d717e 100644
--- a/src/gui/opengl/qopenglfunctions_3_3_core.h
+++ b/src/gui/opengl/qopenglfunctions_3_3_core.h
@@ -65,7 +65,7 @@ public:
QOpenGLFunctions_3_3_Core();
~QOpenGLFunctions_3_3_Core();
- bool initializeOpenGLFunctions() Q_DECL_OVERRIDE;
+ bool initializeOpenGLFunctions() override;
// OpenGL 1.0 core functions
void glViewport(GLint x, GLint y, GLsizei width, GLsizei height);
diff --git a/src/gui/opengl/qopenglfunctions_4_0_compatibility.cpp b/src/gui/opengl/qopenglfunctions_4_0_compatibility.cpp
index b5c423ef0c..4fe4526efc 100644
--- a/src/gui/opengl/qopenglfunctions_4_0_compatibility.cpp
+++ b/src/gui/opengl/qopenglfunctions_4_0_compatibility.cpp
@@ -85,7 +85,7 @@ QOpenGLFunctions_4_0_Compatibility::QOpenGLFunctions_4_0_Compatibility()
, d_1_2_Deprecated(0)
, d_1_3_Deprecated(0)
, d_1_4_Deprecated(0)
- , m_reserved_2_0_Deprecated(Q_NULLPTR)
+ , m_reserved_2_0_Deprecated(nullptr)
, d_3_3_Deprecated(0)
{
}
diff --git a/src/gui/opengl/qopenglfunctions_4_0_compatibility.h b/src/gui/opengl/qopenglfunctions_4_0_compatibility.h
index 1fa5e8a361..c0e42443d3 100644
--- a/src/gui/opengl/qopenglfunctions_4_0_compatibility.h
+++ b/src/gui/opengl/qopenglfunctions_4_0_compatibility.h
@@ -65,7 +65,7 @@ public:
QOpenGLFunctions_4_0_Compatibility();
~QOpenGLFunctions_4_0_Compatibility();
- bool initializeOpenGLFunctions() Q_DECL_OVERRIDE;
+ bool initializeOpenGLFunctions() override;
// OpenGL 1.0 core functions
void glViewport(GLint x, GLint y, GLsizei width, GLsizei height);
diff --git a/src/gui/opengl/qopenglfunctions_4_0_core.h b/src/gui/opengl/qopenglfunctions_4_0_core.h
index 8fd2af2d04..6cb55e86f7 100644
--- a/src/gui/opengl/qopenglfunctions_4_0_core.h
+++ b/src/gui/opengl/qopenglfunctions_4_0_core.h
@@ -65,7 +65,7 @@ public:
QOpenGLFunctions_4_0_Core();
~QOpenGLFunctions_4_0_Core();
- bool initializeOpenGLFunctions() Q_DECL_OVERRIDE;
+ bool initializeOpenGLFunctions() override;
// OpenGL 1.0 core functions
void glViewport(GLint x, GLint y, GLsizei width, GLsizei height);
diff --git a/src/gui/opengl/qopenglfunctions_4_1_compatibility.cpp b/src/gui/opengl/qopenglfunctions_4_1_compatibility.cpp
index 72c60c74b7..41ecb4672a 100644
--- a/src/gui/opengl/qopenglfunctions_4_1_compatibility.cpp
+++ b/src/gui/opengl/qopenglfunctions_4_1_compatibility.cpp
@@ -86,7 +86,7 @@ QOpenGLFunctions_4_1_Compatibility::QOpenGLFunctions_4_1_Compatibility()
, d_1_2_Deprecated(0)
, d_1_3_Deprecated(0)
, d_1_4_Deprecated(0)
- , m_reserved_2_0_Deprecated(Q_NULLPTR)
+ , m_reserved_2_0_Deprecated(nullptr)
, d_3_3_Deprecated(0)
{
}
diff --git a/src/gui/opengl/qopenglfunctions_4_1_compatibility.h b/src/gui/opengl/qopenglfunctions_4_1_compatibility.h
index a284f8e6d3..bee169b50c 100644
--- a/src/gui/opengl/qopenglfunctions_4_1_compatibility.h
+++ b/src/gui/opengl/qopenglfunctions_4_1_compatibility.h
@@ -65,7 +65,7 @@ public:
QOpenGLFunctions_4_1_Compatibility();
~QOpenGLFunctions_4_1_Compatibility();
- bool initializeOpenGLFunctions() Q_DECL_OVERRIDE;
+ bool initializeOpenGLFunctions() override;
// OpenGL 1.0 core functions
void glViewport(GLint x, GLint y, GLsizei width, GLsizei height);
diff --git a/src/gui/opengl/qopenglfunctions_4_1_core.h b/src/gui/opengl/qopenglfunctions_4_1_core.h
index d35db3c839..3a4fd0743b 100644
--- a/src/gui/opengl/qopenglfunctions_4_1_core.h
+++ b/src/gui/opengl/qopenglfunctions_4_1_core.h
@@ -65,7 +65,7 @@ public:
QOpenGLFunctions_4_1_Core();
~QOpenGLFunctions_4_1_Core();
- bool initializeOpenGLFunctions() Q_DECL_OVERRIDE;
+ bool initializeOpenGLFunctions() override;
// OpenGL 1.0 core functions
void glViewport(GLint x, GLint y, GLsizei width, GLsizei height);
diff --git a/src/gui/opengl/qopenglfunctions_4_2_compatibility.cpp b/src/gui/opengl/qopenglfunctions_4_2_compatibility.cpp
index 8398ef0948..fcc049c67b 100644
--- a/src/gui/opengl/qopenglfunctions_4_2_compatibility.cpp
+++ b/src/gui/opengl/qopenglfunctions_4_2_compatibility.cpp
@@ -87,7 +87,7 @@ QOpenGLFunctions_4_2_Compatibility::QOpenGLFunctions_4_2_Compatibility()
, d_1_2_Deprecated(0)
, d_1_3_Deprecated(0)
, d_1_4_Deprecated(0)
- , m_reserved_2_0_Deprecated(Q_NULLPTR)
+ , m_reserved_2_0_Deprecated(nullptr)
, d_3_3_Deprecated(0)
{
}
diff --git a/src/gui/opengl/qopenglfunctions_4_2_compatibility.h b/src/gui/opengl/qopenglfunctions_4_2_compatibility.h
index 7b45859984..6726d5fc44 100644
--- a/src/gui/opengl/qopenglfunctions_4_2_compatibility.h
+++ b/src/gui/opengl/qopenglfunctions_4_2_compatibility.h
@@ -65,7 +65,7 @@ public:
QOpenGLFunctions_4_2_Compatibility();
~QOpenGLFunctions_4_2_Compatibility();
- bool initializeOpenGLFunctions() Q_DECL_OVERRIDE;
+ bool initializeOpenGLFunctions() override;
// OpenGL 1.0 core functions
void glViewport(GLint x, GLint y, GLsizei width, GLsizei height);
diff --git a/src/gui/opengl/qopenglfunctions_4_2_core.h b/src/gui/opengl/qopenglfunctions_4_2_core.h
index 80bb33e7d8..a921329741 100644
--- a/src/gui/opengl/qopenglfunctions_4_2_core.h
+++ b/src/gui/opengl/qopenglfunctions_4_2_core.h
@@ -65,7 +65,7 @@ public:
QOpenGLFunctions_4_2_Core();
~QOpenGLFunctions_4_2_Core();
- bool initializeOpenGLFunctions() Q_DECL_OVERRIDE;
+ bool initializeOpenGLFunctions() override;
// OpenGL 1.0 core functions
void glViewport(GLint x, GLint y, GLsizei width, GLsizei height);
diff --git a/src/gui/opengl/qopenglfunctions_4_3_compatibility.cpp b/src/gui/opengl/qopenglfunctions_4_3_compatibility.cpp
index 19e67c6331..131ebc810f 100644
--- a/src/gui/opengl/qopenglfunctions_4_3_compatibility.cpp
+++ b/src/gui/opengl/qopenglfunctions_4_3_compatibility.cpp
@@ -88,7 +88,7 @@ QOpenGLFunctions_4_3_Compatibility::QOpenGLFunctions_4_3_Compatibility()
, d_1_2_Deprecated(0)
, d_1_3_Deprecated(0)
, d_1_4_Deprecated(0)
- , m_reserved_2_0_Deprecated(Q_NULLPTR)
+ , m_reserved_2_0_Deprecated(nullptr)
, d_3_3_Deprecated(0)
{
}
diff --git a/src/gui/opengl/qopenglfunctions_4_3_compatibility.h b/src/gui/opengl/qopenglfunctions_4_3_compatibility.h
index 515467a38d..b9d4eb1d6f 100644
--- a/src/gui/opengl/qopenglfunctions_4_3_compatibility.h
+++ b/src/gui/opengl/qopenglfunctions_4_3_compatibility.h
@@ -65,7 +65,7 @@ public:
QOpenGLFunctions_4_3_Compatibility();
~QOpenGLFunctions_4_3_Compatibility();
- bool initializeOpenGLFunctions() Q_DECL_OVERRIDE;
+ bool initializeOpenGLFunctions() override;
// OpenGL 1.0 core functions
void glViewport(GLint x, GLint y, GLsizei width, GLsizei height);
diff --git a/src/gui/opengl/qopenglfunctions_4_3_core.h b/src/gui/opengl/qopenglfunctions_4_3_core.h
index 4a700c36d7..da552d64af 100644
--- a/src/gui/opengl/qopenglfunctions_4_3_core.h
+++ b/src/gui/opengl/qopenglfunctions_4_3_core.h
@@ -65,7 +65,7 @@ public:
QOpenGLFunctions_4_3_Core();
~QOpenGLFunctions_4_3_Core();
- bool initializeOpenGLFunctions() Q_DECL_OVERRIDE;
+ bool initializeOpenGLFunctions() override;
// OpenGL 1.0 core functions
void glViewport(GLint x, GLint y, GLsizei width, GLsizei height);
diff --git a/src/gui/opengl/qopenglfunctions_4_4_compatibility.h b/src/gui/opengl/qopenglfunctions_4_4_compatibility.h
index f2d640cdaf..7a05bd802d 100644
--- a/src/gui/opengl/qopenglfunctions_4_4_compatibility.h
+++ b/src/gui/opengl/qopenglfunctions_4_4_compatibility.h
@@ -65,7 +65,7 @@ public:
QOpenGLFunctions_4_4_Compatibility();
~QOpenGLFunctions_4_4_Compatibility();
- bool initializeOpenGLFunctions() Q_DECL_OVERRIDE;
+ bool initializeOpenGLFunctions() override;
// OpenGL 1.0 core functions
void glViewport(GLint x, GLint y, GLsizei width, GLsizei height);
diff --git a/src/gui/opengl/qopenglfunctions_4_4_core.h b/src/gui/opengl/qopenglfunctions_4_4_core.h
index bcb7383a9e..6b29a9659b 100644
--- a/src/gui/opengl/qopenglfunctions_4_4_core.h
+++ b/src/gui/opengl/qopenglfunctions_4_4_core.h
@@ -65,7 +65,7 @@ public:
QOpenGLFunctions_4_4_Core();
~QOpenGLFunctions_4_4_Core();
- bool initializeOpenGLFunctions() Q_DECL_OVERRIDE;
+ bool initializeOpenGLFunctions() override;
// OpenGL 1.0 core functions
void glViewport(GLint x, GLint y, GLsizei width, GLsizei height);
diff --git a/src/gui/opengl/qopenglfunctions_4_5_compatibility.h b/src/gui/opengl/qopenglfunctions_4_5_compatibility.h
index b164538686..7a97085a85 100644
--- a/src/gui/opengl/qopenglfunctions_4_5_compatibility.h
+++ b/src/gui/opengl/qopenglfunctions_4_5_compatibility.h
@@ -65,7 +65,7 @@ public:
QOpenGLFunctions_4_5_Compatibility();
~QOpenGLFunctions_4_5_Compatibility();
- bool initializeOpenGLFunctions() Q_DECL_OVERRIDE;
+ bool initializeOpenGLFunctions() override;
// OpenGL 1.0 core functions
void glViewport(GLint x, GLint y, GLsizei width, GLsizei height);
diff --git a/src/gui/opengl/qopenglfunctions_4_5_core.h b/src/gui/opengl/qopenglfunctions_4_5_core.h
index 0940d8cf61..bb1b17f7b1 100644
--- a/src/gui/opengl/qopenglfunctions_4_5_core.h
+++ b/src/gui/opengl/qopenglfunctions_4_5_core.h
@@ -65,7 +65,7 @@ public:
QOpenGLFunctions_4_5_Core();
~QOpenGLFunctions_4_5_Core();
- bool initializeOpenGLFunctions() Q_DECL_OVERRIDE;
+ bool initializeOpenGLFunctions() override;
// OpenGL 1.0 core functions
void glViewport(GLint x, GLint y, GLsizei width, GLsizei height);
diff --git a/src/gui/opengl/qopenglfunctions_es2.h b/src/gui/opengl/qopenglfunctions_es2.h
index 3b7d2806ea..851eb5951b 100644
--- a/src/gui/opengl/qopenglfunctions_es2.h
+++ b/src/gui/opengl/qopenglfunctions_es2.h
@@ -57,7 +57,7 @@ public:
QOpenGLFunctions_ES2();
~QOpenGLFunctions_ES2();
- bool initializeOpenGLFunctions() Q_DECL_OVERRIDE;
+ bool initializeOpenGLFunctions() override;
// OpenGL ES2 core functions
void glActiveTexture(GLenum texture);
diff --git a/src/gui/opengl/qopenglgradientcache_p.h b/src/gui/opengl/qopenglgradientcache_p.h
index a2ed85c061..cbdbbb0c54 100644
--- a/src/gui/opengl/qopenglgradientcache_p.h
+++ b/src/gui/opengl/qopenglgradientcache_p.h
@@ -85,8 +85,8 @@ public:
GLuint getBuffer(const QGradient &gradient, qreal opacity);
inline int paletteSize() const { return 1024; }
- void invalidateResource() Q_DECL_OVERRIDE;
- void freeResource(QOpenGLContext *ctx) Q_DECL_OVERRIDE;
+ void invalidateResource() override;
+ void freeResource(QOpenGLContext *ctx) override;
private:
inline int maxCacheSize() const { return 60; }
diff --git a/src/gui/opengl/qopenglpaintengine_p.h b/src/gui/opengl/qopenglpaintengine_p.h
index 679b3c0557..0541ce6168 100644
--- a/src/gui/opengl/qopenglpaintengine_p.h
+++ b/src/gui/opengl/qopenglpaintengine_p.h
@@ -116,37 +116,37 @@ public:
QOpenGL2PaintEngineEx();
~QOpenGL2PaintEngineEx();
- bool begin(QPaintDevice *device) Q_DECL_OVERRIDE;
+ bool begin(QPaintDevice *device) override;
void ensureActive();
- bool end() Q_DECL_OVERRIDE;
-
- virtual void clipEnabledChanged() Q_DECL_OVERRIDE;
- virtual void penChanged() Q_DECL_OVERRIDE;
- virtual void brushChanged() Q_DECL_OVERRIDE;
- virtual void brushOriginChanged() Q_DECL_OVERRIDE;
- virtual void opacityChanged() Q_DECL_OVERRIDE;
- virtual void compositionModeChanged() Q_DECL_OVERRIDE;
- virtual void renderHintsChanged() Q_DECL_OVERRIDE;
- virtual void transformChanged() Q_DECL_OVERRIDE;
-
- virtual void drawPixmap(const QRectF &r, const QPixmap &pm, const QRectF &sr) Q_DECL_OVERRIDE;
+ bool end() override;
+
+ virtual void clipEnabledChanged() override;
+ virtual void penChanged() override;
+ virtual void brushChanged() override;
+ virtual void brushOriginChanged() override;
+ virtual void opacityChanged() override;
+ virtual void compositionModeChanged() override;
+ virtual void renderHintsChanged() override;
+ virtual void transformChanged() override;
+
+ virtual void drawPixmap(const QRectF &r, const QPixmap &pm, const QRectF &sr) override;
virtual void drawPixmapFragments(const QPainter::PixmapFragment *fragments, int fragmentCount, const QPixmap &pixmap,
- QPainter::PixmapFragmentHints hints) Q_DECL_OVERRIDE;
+ QPainter::PixmapFragmentHints hints) override;
virtual void drawImage(const QRectF &r, const QImage &pm, const QRectF &sr,
- Qt::ImageConversionFlags flags = Qt::AutoColor) Q_DECL_OVERRIDE;
- virtual void drawTextItem(const QPointF &p, const QTextItem &textItem) Q_DECL_OVERRIDE;
- virtual void fill(const QVectorPath &path, const QBrush &brush) Q_DECL_OVERRIDE;
- virtual void stroke(const QVectorPath &path, const QPen &pen) Q_DECL_OVERRIDE;
- virtual void clip(const QVectorPath &path, Qt::ClipOperation op) Q_DECL_OVERRIDE;
+ Qt::ImageConversionFlags flags = Qt::AutoColor) override;
+ virtual void drawTextItem(const QPointF &p, const QTextItem &textItem) override;
+ virtual void fill(const QVectorPath &path, const QBrush &brush) override;
+ virtual void stroke(const QVectorPath &path, const QPen &pen) override;
+ virtual void clip(const QVectorPath &path, Qt::ClipOperation op) override;
- virtual void drawStaticTextItem(QStaticTextItem *textItem) Q_DECL_OVERRIDE;
+ virtual void drawStaticTextItem(QStaticTextItem *textItem) override;
bool drawTexture(const QRectF &r, GLuint textureId, const QSize &size, const QRectF &sr);
- Type type() const Q_DECL_OVERRIDE { return OpenGL2; }
+ Type type() const override { return OpenGL2; }
- virtual void setState(QPainterState *s) Q_DECL_OVERRIDE;
- virtual QPainterState *createState(QPainterState *orig) const Q_DECL_OVERRIDE;
+ virtual void setState(QPainterState *s) override;
+ virtual QPainterState *createState(QPainterState *orig) const override;
inline QOpenGL2PaintEngineState *state() {
return static_cast<QOpenGL2PaintEngineState *>(QPaintEngineEx::state());
}
@@ -154,16 +154,16 @@ public:
return static_cast<const QOpenGL2PaintEngineState *>(QPaintEngineEx::state());
}
- void beginNativePainting() Q_DECL_OVERRIDE;
- void endNativePainting() Q_DECL_OVERRIDE;
+ void beginNativePainting() override;
+ void endNativePainting() override;
void invalidateState();
void setRenderTextActive(bool);
bool isNativePaintingActive() const;
- bool requiresPretransformedGlyphPositions(QFontEngine *, const QTransform &) const Q_DECL_OVERRIDE { return false; }
- bool shouldDrawCachedGlyphs(QFontEngine *, const QTransform &) const Q_DECL_OVERRIDE;
+ bool requiresPretransformedGlyphPositions(QFontEngine *, const QTransform &) const override { return false; }
+ bool shouldDrawCachedGlyphs(QFontEngine *, const QTransform &) const override;
private:
Q_DISABLE_COPY(QOpenGL2PaintEngineEx)
@@ -265,7 +265,7 @@ public:
void updateClipScissorTest();
void setScissor(const QRect &rect);
void regenerateClip();
- void systemStateChanged() Q_DECL_OVERRIDE;
+ void systemStateChanged() override;
void setVertexAttribArrayEnabled(int arrayIndex, bool enabled = true);
void syncGlState();
diff --git a/src/gui/opengl/qopenglshaderprogram.h b/src/gui/opengl/qopenglshaderprogram.h
index fd4d82ecf9..84eb8d6956 100644
--- a/src/gui/opengl/qopenglshaderprogram.h
+++ b/src/gui/opengl/qopenglshaderprogram.h
@@ -79,7 +79,7 @@ public:
};
Q_DECLARE_FLAGS(ShaderType, ShaderTypeBit)
- explicit QOpenGLShader(QOpenGLShader::ShaderType type, QObject *parent = Q_NULLPTR);
+ explicit QOpenGLShader(QOpenGLShader::ShaderType type, QObject *parent = nullptr);
virtual ~QOpenGLShader();
QOpenGLShader::ShaderType shaderType() const;
@@ -96,7 +96,7 @@ public:
GLuint shaderId() const;
- static bool hasOpenGLShaders(ShaderType type, QOpenGLContext *context = Q_NULLPTR);
+ static bool hasOpenGLShaders(ShaderType type, QOpenGLContext *context = nullptr);
private:
friend class QOpenGLShaderProgram;
@@ -114,7 +114,7 @@ class Q_GUI_EXPORT QOpenGLShaderProgram : public QObject
{
Q_OBJECT
public:
- explicit QOpenGLShaderProgram(QObject *parent = Q_NULLPTR);
+ explicit QOpenGLShaderProgram(QObject *parent = nullptr);
virtual ~QOpenGLShaderProgram();
bool addShader(QOpenGLShader *shader);
@@ -306,7 +306,7 @@ public:
void setUniformValueArray(const char *name, const QMatrix4x3 *values, int count);
void setUniformValueArray(const char *name, const QMatrix4x4 *values, int count);
- static bool hasOpenGLShaderPrograms(QOpenGLContext *context = Q_NULLPTR);
+ static bool hasOpenGLShaderPrograms(QOpenGLContext *context = nullptr);
private Q_SLOTS:
void shaderDestroyed();
diff --git a/src/gui/opengl/qopengltexture.h b/src/gui/opengl/qopengltexture.h
index 12d9b91603..c0c5283374 100644
--- a/src/gui/opengl/qopengltexture.h
+++ b/src/gui/opengl/qopengltexture.h
@@ -459,60 +459,60 @@ public:
#if QT_DEPRECATED_SINCE(5, 3)
QT_DEPRECATED void setData(int mipLevel, int layer, CubeMapFace cubeFace,
PixelFormat sourceFormat, PixelType sourceType,
- void *data, const QOpenGLPixelTransferOptions * const options = Q_NULLPTR);
+ void *data, const QOpenGLPixelTransferOptions * const options = nullptr);
QT_DEPRECATED void setData(int mipLevel, int layer,
PixelFormat sourceFormat, PixelType sourceType,
- void *data, const QOpenGLPixelTransferOptions * const options = Q_NULLPTR);
+ void *data, const QOpenGLPixelTransferOptions * const options = nullptr);
QT_DEPRECATED void setData(int mipLevel,
PixelFormat sourceFormat, PixelType sourceType,
- void *data, const QOpenGLPixelTransferOptions * const options = Q_NULLPTR);
+ void *data, const QOpenGLPixelTransferOptions * const options = nullptr);
QT_DEPRECATED void setData(PixelFormat sourceFormat, PixelType sourceType,
- void *data, const QOpenGLPixelTransferOptions * const options = Q_NULLPTR);
+ void *data, const QOpenGLPixelTransferOptions * const options = nullptr);
#endif // QT_DEPRECATED_SINCE(5, 3)
void setData(int mipLevel, int layer, CubeMapFace cubeFace,
PixelFormat sourceFormat, PixelType sourceType,
- const void *data, const QOpenGLPixelTransferOptions * const options = Q_NULLPTR);
+ const void *data, const QOpenGLPixelTransferOptions * const options = nullptr);
void setData(int mipLevel, int layer, int layerCount, CubeMapFace cubeFace,
PixelFormat sourceFormat, PixelType sourceType,
- const void *data, const QOpenGLPixelTransferOptions * const options = Q_NULLPTR);
+ const void *data, const QOpenGLPixelTransferOptions * const options = nullptr);
void setData(int mipLevel, int layer,
PixelFormat sourceFormat, PixelType sourceType,
- const void *data, const QOpenGLPixelTransferOptions * const options = Q_NULLPTR);
+ const void *data, const QOpenGLPixelTransferOptions * const options = nullptr);
void setData(int mipLevel,
PixelFormat sourceFormat, PixelType sourceType,
- const void *data, const QOpenGLPixelTransferOptions * const options = Q_NULLPTR);
+ const void *data, const QOpenGLPixelTransferOptions * const options = nullptr);
void setData(PixelFormat sourceFormat, PixelType sourceType,
- const void *data, const QOpenGLPixelTransferOptions * const options = Q_NULLPTR);
+ const void *data, const QOpenGLPixelTransferOptions * const options = nullptr);
// Compressed data upload
// ### Qt 6: remove the non-const void * overloads
#if QT_DEPRECATED_SINCE(5, 3)
QT_DEPRECATED void setCompressedData(int mipLevel, int layer, CubeMapFace cubeFace,
int dataSize, void *data,
- const QOpenGLPixelTransferOptions * const options = Q_NULLPTR);
+ const QOpenGLPixelTransferOptions * const options = nullptr);
QT_DEPRECATED void setCompressedData(int mipLevel, int layer,
int dataSize, void *data,
- const QOpenGLPixelTransferOptions * const options = Q_NULLPTR);
+ const QOpenGLPixelTransferOptions * const options = nullptr);
QT_DEPRECATED void setCompressedData(int mipLevel, int dataSize, void *data,
- const QOpenGLPixelTransferOptions * const options = Q_NULLPTR);
+ const QOpenGLPixelTransferOptions * const options = nullptr);
QT_DEPRECATED void setCompressedData(int dataSize, void *data,
- const QOpenGLPixelTransferOptions * const options = Q_NULLPTR);
+ const QOpenGLPixelTransferOptions * const options = nullptr);
#endif // QT_DEPRECATED_SINCE(5, 3)
void setCompressedData(int mipLevel, int layer, CubeMapFace cubeFace,
int dataSize, const void *data,
- const QOpenGLPixelTransferOptions * const options = Q_NULLPTR);
+ const QOpenGLPixelTransferOptions * const options = nullptr);
void setCompressedData(int mipLevel, int layer, int layerCount, CubeMapFace cubeFace,
int dataSize, const void *data,
- const QOpenGLPixelTransferOptions * const options = Q_NULLPTR);
+ const QOpenGLPixelTransferOptions * const options = nullptr);
void setCompressedData(int mipLevel, int layer,
int dataSize, const void *data,
- const QOpenGLPixelTransferOptions * const options = Q_NULLPTR);
+ const QOpenGLPixelTransferOptions * const options = nullptr);
void setCompressedData(int mipLevel, int dataSize, const void *data,
- const QOpenGLPixelTransferOptions * const options = Q_NULLPTR);
+ const QOpenGLPixelTransferOptions * const options = nullptr);
void setCompressedData(int dataSize, const void *data,
- const QOpenGLPixelTransferOptions * const options = Q_NULLPTR);
+ const QOpenGLPixelTransferOptions * const options = nullptr);
// Helpful overloads for setData
void setData(const QImage& image, MipMapGeneration genMipMaps = GenerateMipMaps);
diff --git a/src/gui/opengl/qopengltexturecache_p.h b/src/gui/opengl/qopengltexturecache_p.h
index 4a438c8d95..b9d7df91e3 100644
--- a/src/gui/opengl/qopengltexturecache_p.h
+++ b/src/gui/opengl/qopengltexturecache_p.h
@@ -82,8 +82,8 @@ public:
void invalidate(qint64 key);
- void invalidateResource() Q_DECL_OVERRIDE;
- void freeResource(QOpenGLContext *ctx) Q_DECL_OVERRIDE;
+ void invalidateResource() override;
+ void freeResource(QOpenGLContext *ctx) override;
private:
GLuint bindTexture(QOpenGLContext *context, qint64 key, const QImage &image, QOpenGLTextureCache::BindOptions options);
diff --git a/src/gui/opengl/qopengltextureglyphcache_p.h b/src/gui/opengl/qopengltextureglyphcache_p.h
index 6a1550dbed..0b7b5f6082 100644
--- a/src/gui/opengl/qopengltextureglyphcache_p.h
+++ b/src/gui/opengl/qopengltextureglyphcache_p.h
@@ -81,7 +81,7 @@ public:
#endif
}
- void freeResource(QOpenGLContext *context) Q_DECL_OVERRIDE
+ void freeResource(QOpenGLContext *context) override
{
QOpenGLContext *ctx = context;
#ifdef QT_GL_TEXTURE_GLYPH_CACHE_DEBUG
@@ -93,7 +93,7 @@ public:
ctx->functions()->glDeleteTextures(1, &m_texture);
}
- void invalidateResource() Q_DECL_OVERRIDE
+ void invalidateResource() override
{
m_texture = 0;
m_fbo = 0;
@@ -113,12 +113,12 @@ public:
QOpenGLTextureGlyphCache(QFontEngine::GlyphFormat glyphFormat, const QTransform &matrix);
~QOpenGLTextureGlyphCache();
- virtual void createTextureData(int width, int height) Q_DECL_OVERRIDE;
- virtual void resizeTextureData(int width, int height) Q_DECL_OVERRIDE;
- virtual void fillTexture(const Coord &c, glyph_t glyph, QFixed subPixelPosition) Q_DECL_OVERRIDE;
- virtual int glyphPadding() const Q_DECL_OVERRIDE;
- virtual int maxTextureWidth() const Q_DECL_OVERRIDE;
- virtual int maxTextureHeight() const Q_DECL_OVERRIDE;
+ virtual void createTextureData(int width, int height) override;
+ virtual void resizeTextureData(int width, int height) override;
+ virtual void fillTexture(const Coord &c, glyph_t glyph, QFixed subPixelPosition) override;
+ virtual int glyphPadding() const override;
+ virtual int maxTextureWidth() const override;
+ virtual int maxTextureHeight() const override;
inline GLuint texture() const {
QOpenGLTextureGlyphCache *that = const_cast<QOpenGLTextureGlyphCache *>(this);
diff --git a/src/gui/opengl/qopengltimerquery.h b/src/gui/opengl/qopengltimerquery.h
index 7b9ab850e2..27da74a3fb 100644
--- a/src/gui/opengl/qopengltimerquery.h
+++ b/src/gui/opengl/qopengltimerquery.h
@@ -56,7 +56,7 @@ class Q_GUI_EXPORT QOpenGLTimerQuery : public QObject
Q_OBJECT
public:
- explicit QOpenGLTimerQuery(QObject *parent = Q_NULLPTR);
+ explicit QOpenGLTimerQuery(QObject *parent = nullptr);
~QOpenGLTimerQuery();
bool create();
@@ -84,7 +84,7 @@ class Q_GUI_EXPORT QOpenGLTimeMonitor : public QObject
Q_OBJECT
public:
- explicit QOpenGLTimeMonitor(QObject *parent = Q_NULLPTR);
+ explicit QOpenGLTimeMonitor(QObject *parent = nullptr);
~QOpenGLTimeMonitor();
void setSampleCount(int sampleCount);
diff --git a/src/gui/opengl/qopenglversionfunctions.h b/src/gui/opengl/qopenglversionfunctions.h
index 63209cf392..3af1ed0466 100644
--- a/src/gui/opengl/qopenglversionfunctions.h
+++ b/src/gui/opengl/qopenglversionfunctions.h
@@ -193,7 +193,7 @@ class QAbstractOpenGLFunctionsPrivate
{
public:
QAbstractOpenGLFunctionsPrivate()
- : owningContext(Q_NULLPTR),
+ : owningContext(nullptr),
initialized(false)
{}
diff --git a/src/gui/opengl/qopenglvertexarrayobject.h b/src/gui/opengl/qopenglvertexarrayobject.h
index a8153ea40b..b81ae6a2a9 100644
--- a/src/gui/opengl/qopenglvertexarrayobject.h
+++ b/src/gui/opengl/qopenglvertexarrayobject.h
@@ -56,7 +56,7 @@ class Q_GUI_EXPORT QOpenGLVertexArrayObject : public QObject
Q_OBJECT
public:
- explicit QOpenGLVertexArrayObject(QObject* parent = Q_NULLPTR);
+ explicit QOpenGLVertexArrayObject(QObject* parent = nullptr);
~QOpenGLVertexArrayObject();
bool create();
diff --git a/src/gui/opengl/qopenglvertexarrayobject_p.h b/src/gui/opengl/qopenglvertexarrayobject_p.h
index 937921765b..fd3a6f0f89 100644
--- a/src/gui/opengl/qopenglvertexarrayobject_p.h
+++ b/src/gui/opengl/qopenglvertexarrayobject_p.h
@@ -70,10 +70,10 @@ class QOpenGLVertexArrayObjectHelper
public:
explicit inline QOpenGLVertexArrayObjectHelper(QOpenGLContext *context)
- : GenVertexArrays(Q_NULLPTR)
- , DeleteVertexArrays(Q_NULLPTR)
- , BindVertexArray(Q_NULLPTR)
- , IsVertexArray(Q_NULLPTR)
+ : GenVertexArrays(nullptr)
+ , DeleteVertexArrays(nullptr)
+ , BindVertexArray(nullptr)
+ , IsVertexArray(nullptr)
{
qtInitializeVertexArrayObjectHelper(this, context);
}
diff --git a/src/gui/painting/qcolor.h b/src/gui/painting/qcolor.h
index 0c5ebcbda9..f7a9e9db59 100644
--- a/src/gui/painting/qcolor.h
+++ b/src/gui/painting/qcolor.h
@@ -129,10 +129,10 @@ public:
void setGreenF(qreal green);
void setBlueF(qreal blue);
- void getRgb(int *r, int *g, int *b, int *a = Q_NULLPTR) const;
+ void getRgb(int *r, int *g, int *b, int *a = nullptr) const;
void setRgb(int r, int g, int b, int a = 255);
- void getRgbF(qreal *r, qreal *g, qreal *b, qreal *a = Q_NULLPTR) const;
+ void getRgbF(qreal *r, qreal *g, qreal *b, qreal *a = nullptr) const;
void setRgbF(qreal r, qreal g, qreal b, qreal a = 1.0);
QRgba64 rgba64() const Q_DECL_NOTHROW;
@@ -156,10 +156,10 @@ public:
qreal hsvSaturationF() const Q_DECL_NOTHROW;
qreal valueF() const Q_DECL_NOTHROW;
- void getHsv(int *h, int *s, int *v, int *a = Q_NULLPTR) const;
+ void getHsv(int *h, int *s, int *v, int *a = nullptr) const;
void setHsv(int h, int s, int v, int a = 255);
- void getHsvF(qreal *h, qreal *s, qreal *v, qreal *a = Q_NULLPTR) const;
+ void getHsvF(qreal *h, qreal *s, qreal *v, qreal *a = nullptr) const;
void setHsvF(qreal h, qreal s, qreal v, qreal a = 1.0);
int cyan() const Q_DECL_NOTHROW;
@@ -172,10 +172,10 @@ public:
qreal yellowF() const Q_DECL_NOTHROW;
qreal blackF() const Q_DECL_NOTHROW;
- void getCmyk(int *c, int *m, int *y, int *k, int *a = Q_NULLPTR);
+ void getCmyk(int *c, int *m, int *y, int *k, int *a = nullptr);
void setCmyk(int c, int m, int y, int k, int a = 255);
- void getCmykF(qreal *c, qreal *m, qreal *y, qreal *k, qreal *a = Q_NULLPTR);
+ void getCmykF(qreal *c, qreal *m, qreal *y, qreal *k, qreal *a = nullptr);
void setCmykF(qreal c, qreal m, qreal y, qreal k, qreal a = 1.0);
int hslHue() const Q_DECL_NOTHROW; // 0 <= hue < 360
@@ -186,10 +186,10 @@ public:
qreal hslSaturationF() const Q_DECL_NOTHROW;
qreal lightnessF() const Q_DECL_NOTHROW;
- void getHsl(int *h, int *s, int *l, int *a = Q_NULLPTR) const;
+ void getHsl(int *h, int *s, int *l, int *a = nullptr) const;
void setHsl(int h, int s, int l, int a = 255);
- void getHslF(qreal *h, qreal *s, qreal *l, qreal *a = Q_NULLPTR) const;
+ void getHslF(qreal *h, qreal *s, qreal *l, qreal *a = nullptr) const;
void setHslF(qreal h, qreal s, qreal l, qreal a = 1.0);
QColor toRgb() const Q_DECL_NOTHROW;
diff --git a/src/gui/painting/qcompositionfunctions.cpp b/src/gui/painting/qcompositionfunctions.cpp
index ee05f810f1..339a9749b8 100644
--- a/src/gui/painting/qcompositionfunctions.cpp
+++ b/src/gui/painting/qcompositionfunctions.cpp
@@ -38,16 +38,11 @@
****************************************************************************/
#include <qglobal.h>
-#include <private/qdrawhelper_p.h>
-#include <private/qrgba64_p.h>
+#include "qdrawhelper_p.h"
+#include "qrgba64_p.h"
QT_BEGIN_NAMESPACE
-# define PRELOAD_INIT(x)
-# define PRELOAD_INIT2(x,y)
-# define PRELOAD_COND(x)
-# define PRELOAD_COND2(x,y)
-
/* The constant alpha factor describes an alpha factor that gets applied
to the result of the composition operation combining it with the destination.
@@ -69,24 +64,6 @@ QT_BEGIN_NAMESPACE
where the source is an array of pixels.
*/
-/*
- result = 0
- d = d * cia
-*/
-#define comp_func_Clear_impl(dest, length, const_alpha)\
-{\
- if (const_alpha == 255) {\
- QT_MEMFILL_UINT(dest, length, 0);\
- } else {\
- int ialpha = 255 - const_alpha;\
- PRELOAD_INIT(dest)\
- for (int i = 0; i < length; ++i) {\
- PRELOAD_COND(dest)\
- dest[i] = BYTE_MUL(dest[i], ialpha);\
- }\
- }\
-}
-
#if defined __SSE2__
# define LOAD(ptr) _mm_loadl_epi64(reinterpret_cast<const __m128i *>(ptr))
#ifdef Q_PROCESSOR_X86_64
@@ -117,38 +94,41 @@ QT_BEGIN_NAMESPACE
# define INVALPHA(c) (65535 - ALPHA(c))
#endif
+
+/*
+ result = 0
+ d = d * cia
+*/
void QT_FASTCALL comp_func_solid_Clear(uint *dest, int length, uint, uint const_alpha)
{
- comp_func_Clear_impl(dest, length, const_alpha);
+ if (const_alpha == 255) {
+ qt_memfill32(dest, 0, length);
+ } else {
+ uint ialpha = 255 - const_alpha;
+ for (int i = 0; i < length; ++i)
+ dest[i] = BYTE_MUL(dest[i], ialpha);
+ }
}
void QT_FASTCALL comp_func_solid_Clear_rgb64(QRgba64 *dest, int length, QRgba64, uint const_alpha)
{
- if (const_alpha == 255)
+ if (const_alpha == 255) {
qt_memfill64((quint64*)dest, 0, length);
- else {
- int ialpha = 255 - const_alpha;
- for (int i = 0; i < length; ++i) {
+ } else {
+ uint ialpha = 255 - const_alpha;
+ for (int i = 0; i < length; ++i)
STORE(&dest[i], multiplyAlpha255(LOAD(&dest[i]), ialpha));
- }
}
}
void QT_FASTCALL comp_func_Clear(uint *dest, const uint *, int length, uint const_alpha)
{
- comp_func_Clear_impl(dest, length, const_alpha);
+ comp_func_solid_Clear(dest, length, 0, const_alpha);
}
void QT_FASTCALL comp_func_Clear_rgb64(QRgba64 *dest, const QRgba64 *, int length, uint const_alpha)
{
- if (const_alpha == 255)
- qt_memfill64((quint64*)dest, 0, length);
- else {
- int ialpha = 255 - const_alpha;
- for (int i = 0; i < length; ++i) {
- STORE(&dest[i], multiplyAlpha255(LOAD(&dest[i]), ialpha));
- }
- }
+ comp_func_solid_Clear_rgb64(dest, length, QRgba64(), const_alpha);
}
/*
@@ -158,13 +138,11 @@ void QT_FASTCALL comp_func_Clear_rgb64(QRgba64 *dest, const QRgba64 *, int lengt
void QT_FASTCALL comp_func_solid_Source(uint *dest, int length, uint color, uint const_alpha)
{
if (const_alpha == 255) {
- QT_MEMFILL_UINT(dest, length, color);
+ qt_memfill32(dest, color, length);
} else {
- int ialpha = 255 - const_alpha;
+ uint ialpha = 255 - const_alpha;
color = BYTE_MUL(color, const_alpha);
- PRELOAD_INIT(dest)
for (int i = 0; i < length; ++i) {
- PRELOAD_COND(dest)
dest[i] = color + BYTE_MUL(dest[i], ialpha);
}
}
@@ -175,7 +153,7 @@ void QT_FASTCALL comp_func_solid_Source_rgb64(QRgba64 *dest, int length, QRgba64
if (const_alpha == 255)
qt_memfill64((quint64*)dest, color, length);
else {
- int ialpha = 255 - const_alpha;
+ uint ialpha = 255 - const_alpha;
auto c = multiplyAlpha255(CONVERT(color), const_alpha);
for (int i = 0; i < length; ++i) {
STORE(&dest[i], ADD(c, multiplyAlpha255(LOAD(&dest[i]), ialpha)));
@@ -186,12 +164,10 @@ void QT_FASTCALL comp_func_solid_Source_rgb64(QRgba64 *dest, int length, QRgba64
void QT_FASTCALL comp_func_Source(uint *Q_DECL_RESTRICT dest, const uint *Q_DECL_RESTRICT src, int length, uint const_alpha)
{
if (const_alpha == 255) {
- ::memcpy(dest, src, length * sizeof(uint));
+ ::memcpy(dest, src, size_t(length) * sizeof(uint));
} else {
- int ialpha = 255 - const_alpha;
- PRELOAD_INIT2(dest, src)
+ uint ialpha = 255 - const_alpha;
for (int i = 0; i < length; ++i) {
- PRELOAD_COND2(dest, src)
dest[i] = INTERPOLATE_PIXEL_255(src[i], const_alpha, dest[i], ialpha);
}
}
@@ -200,9 +176,9 @@ void QT_FASTCALL comp_func_Source(uint *Q_DECL_RESTRICT dest, const uint *Q_DECL
void QT_FASTCALL comp_func_Source_rgb64(QRgba64 *Q_DECL_RESTRICT dest, const QRgba64 *Q_DECL_RESTRICT src, int length, uint const_alpha)
{
if (const_alpha == 255)
- ::memcpy(dest, src, length * sizeof(quint64));
+ ::memcpy(dest, src, size_t(length) * sizeof(quint64));
else {
- int ialpha = 255 - const_alpha;
+ uint ialpha = 255 - const_alpha;
for (int i = 0; i < length; ++i) {
STORE(&dest[i], interpolate255(LOAD(&src[i]), const_alpha, LOAD(&dest[i]), ialpha));
}
@@ -234,13 +210,11 @@ void QT_FASTCALL comp_func_Destination_rgb64(QRgba64 *, const QRgba64 *, int, ui
void QT_FASTCALL comp_func_solid_SourceOver(uint *dest, int length, uint color, uint const_alpha)
{
if ((const_alpha & qAlpha(color)) == 255) {
- QT_MEMFILL_UINT(dest, length, color);
+ qt_memfill32(dest, color, length);
} else {
if (const_alpha != 255)
color = BYTE_MUL(color, const_alpha);
- PRELOAD_INIT(dest)
for (int i = 0; i < length; ++i) {
- PRELOAD_COND(dest)
dest[i] = color + BYTE_MUL(dest[i], qAlpha(~color));
}
}
@@ -263,10 +237,8 @@ void QT_FASTCALL comp_func_solid_SourceOver_rgb64(QRgba64 *dest, int length, QRg
void QT_FASTCALL comp_func_SourceOver(uint *Q_DECL_RESTRICT dest, const uint *Q_DECL_RESTRICT src, int length, uint const_alpha)
{
- PRELOAD_INIT2(dest, src)
if (const_alpha == 255) {
for (int i = 0; i < length; ++i) {
- PRELOAD_COND2(dest, src)
uint s = src[i];
if (s >= 0xff000000)
dest[i] = s;
@@ -275,7 +247,6 @@ void QT_FASTCALL comp_func_SourceOver(uint *Q_DECL_RESTRICT dest, const uint *Q_
}
} else {
for (int i = 0; i < length; ++i) {
- PRELOAD_COND2(dest, src)
uint s = BYTE_MUL(src[i], const_alpha);
dest[i] = s + BYTE_MUL(dest[i], qAlpha(~s));
}
@@ -309,9 +280,7 @@ void QT_FASTCALL comp_func_solid_DestinationOver(uint *dest, int length, uint co
{
if (const_alpha != 255)
color = BYTE_MUL(color, const_alpha);
- PRELOAD_INIT(dest)
for (int i = 0; i < length; ++i) {
- PRELOAD_COND(dest)
uint d = dest[i];
dest[i] = d + BYTE_MUL(color, qAlpha(~d));
}
@@ -330,16 +299,13 @@ void QT_FASTCALL comp_func_solid_DestinationOver_rgb64(QRgba64 *dest, int length
void QT_FASTCALL comp_func_DestinationOver(uint *Q_DECL_RESTRICT dest, const uint *Q_DECL_RESTRICT src, int length, uint const_alpha)
{
- PRELOAD_INIT2(dest, src)
if (const_alpha == 255) {
for (int i = 0; i < length; ++i) {
- PRELOAD_COND2(dest, src)
uint d = dest[i];
dest[i] = d + BYTE_MUL(src[i], qAlpha(~d));
}
} else {
for (int i = 0; i < length; ++i) {
- PRELOAD_COND2(dest, src)
uint d = dest[i];
uint s = BYTE_MUL(src[i], const_alpha);
dest[i] = d + BYTE_MUL(s, qAlpha(~d));
@@ -369,17 +335,14 @@ void QT_FASTCALL comp_func_DestinationOver_rgb64(QRgba64 *Q_DECL_RESTRICT dest,
*/
void QT_FASTCALL comp_func_solid_SourceIn(uint *dest, int length, uint color, uint const_alpha)
{
- PRELOAD_INIT(dest)
if (const_alpha == 255) {
for (int i = 0; i < length; ++i) {
- PRELOAD_COND(dest)
dest[i] = BYTE_MUL(color, qAlpha(dest[i]));
}
} else {
color = BYTE_MUL(color, const_alpha);
uint cia = 255 - const_alpha;
for (int i = 0; i < length; ++i) {
- PRELOAD_COND(dest)
uint d = dest[i];
dest[i] = INTERPOLATE_PIXEL_255(color, qAlpha(d), d, cia);
}
@@ -389,32 +352,30 @@ void QT_FASTCALL comp_func_solid_SourceIn(uint *dest, int length, uint color, ui
void QT_FASTCALL comp_func_solid_SourceIn_rgb64(QRgba64 *dest, int length, QRgba64 color, uint const_alpha)
{
if (const_alpha == 255) {
+ auto c = CONVERT(color);
for (int i = 0; i < length; ++i) {
- dest[i] = multiplyAlpha65535(color, dest[i].alpha());
+ STORE(&dest[i], multiplyAlpha65535(c, dest[i].alpha()));
}
} else {
uint ca = const_alpha * 257;
- uint cia = 65535 - ca;
- color = multiplyAlpha65535(color, ca);
+ auto cia = CONST(65535 - ca);
+ auto c = multiplyAlpha65535(CONVERT(color), ca);
for (int i = 0; i < length; ++i) {
- QRgba64 d = dest[i];
- dest[i] = interpolate65535(color, d.alpha(), d, cia);
+ auto d = LOAD(&dest[i]);
+ STORE(&dest[i], interpolate65535(c, ALPHA(d), d, cia));
}
}
}
void QT_FASTCALL comp_func_SourceIn(uint *Q_DECL_RESTRICT dest, const uint *Q_DECL_RESTRICT src, int length, uint const_alpha)
{
- PRELOAD_INIT2(dest, src)
if (const_alpha == 255) {
for (int i = 0; i < length; ++i) {
- PRELOAD_COND2(dest, src)
dest[i] = BYTE_MUL(src[i], qAlpha(dest[i]));
}
} else {
uint cia = 255 - const_alpha;
for (int i = 0; i < length; ++i) {
- PRELOAD_COND2(dest, src)
uint d = dest[i];
uint s = BYTE_MUL(src[i], const_alpha);
dest[i] = INTERPOLATE_PIXEL_255(s, qAlpha(d), d, cia);
@@ -450,9 +411,7 @@ void QT_FASTCALL comp_func_solid_DestinationIn(uint *dest, int length, uint colo
if (const_alpha != 255) {
a = BYTE_MUL(a, const_alpha) + 255 - const_alpha;
}
- PRELOAD_INIT(dest)
for (int i = 0; i < length; ++i) {
- PRELOAD_COND(dest)
dest[i] = BYTE_MUL(dest[i], a);
}
}
@@ -470,16 +429,13 @@ void QT_FASTCALL comp_func_solid_DestinationIn_rgb64(QRgba64 *dest, int length,
void QT_FASTCALL comp_func_DestinationIn(uint *Q_DECL_RESTRICT dest, const uint *Q_DECL_RESTRICT src, int length, uint const_alpha)
{
- PRELOAD_INIT2(dest, src)
if (const_alpha == 255) {
for (int i = 0; i < length; ++i) {
- PRELOAD_COND2(dest, src)
dest[i] = BYTE_MUL(dest[i], qAlpha(src[i]));
}
} else {
- int cia = 255 - const_alpha;
+ uint cia = 255 - const_alpha;
for (int i = 0; i < length; ++i) {
- PRELOAD_COND2(dest, src)
uint a = BYTE_MUL(qAlpha(src[i]), const_alpha) + cia;
dest[i] = BYTE_MUL(dest[i], a);
}
@@ -490,14 +446,14 @@ void QT_FASTCALL comp_func_DestinationIn_rgb64(QRgba64 *Q_DECL_RESTRICT dest, co
{
if (const_alpha == 255) {
for (int i = 0; i < length; ++i) {
- dest[i] = multiplyAlpha65535(dest[i], src[i].alpha());
+ STORE(&dest[i], multiplyAlpha65535(LOAD(&dest[i]), src[i].alpha()));
}
} else {
uint ca = const_alpha * 257;
uint cia = 65535 - ca;
for (int i = 0; i < length; ++i) {
uint a = qt_div_65535(src[i].alpha() * ca) + cia;
- dest[i] = multiplyAlpha65535(dest[i], a);
+ STORE(&dest[i], multiplyAlpha65535(LOAD(&dest[i]), a));
}
}
}
@@ -509,17 +465,14 @@ void QT_FASTCALL comp_func_DestinationIn_rgb64(QRgba64 *Q_DECL_RESTRICT dest, co
void QT_FASTCALL comp_func_solid_SourceOut(uint *dest, int length, uint color, uint const_alpha)
{
- PRELOAD_INIT(dest)
if (const_alpha == 255) {
for (int i = 0; i < length; ++i) {
- PRELOAD_COND(dest)
dest[i] = BYTE_MUL(color, qAlpha(~dest[i]));
}
} else {
color = BYTE_MUL(color, const_alpha);
- int cia = 255 - const_alpha;
+ uint cia = 255 - const_alpha;
for (int i = 0; i < length; ++i) {
- PRELOAD_COND(dest)
uint d = dest[i];
dest[i] = INTERPOLATE_PIXEL_255(color, qAlpha(~d), d, cia);
}
@@ -545,16 +498,13 @@ void QT_FASTCALL comp_func_solid_SourceOut_rgb64(QRgba64 *dest, int length, QRgb
void QT_FASTCALL comp_func_SourceOut(uint *Q_DECL_RESTRICT dest, const uint *Q_DECL_RESTRICT src, int length, uint const_alpha)
{
- PRELOAD_INIT2(dest, src)
if (const_alpha == 255) {
for (int i = 0; i < length; ++i) {
- PRELOAD_COND2(dest, src)
dest[i] = BYTE_MUL(src[i], qAlpha(~dest[i]));
}
} else {
- int cia = 255 - const_alpha;
+ uint cia = 255 - const_alpha;
for (int i = 0; i < length; ++i) {
- PRELOAD_COND2(dest, src)
uint s = BYTE_MUL(src[i], const_alpha);
uint d = dest[i];
dest[i] = INTERPOLATE_PIXEL_255(s, qAlpha(~d), d, cia);
@@ -589,9 +539,7 @@ void QT_FASTCALL comp_func_solid_DestinationOut(uint *dest, int length, uint col
uint a = qAlpha(~color);
if (const_alpha != 255)
a = BYTE_MUL(a, const_alpha) + 255 - const_alpha;
- PRELOAD_INIT(dest)
for (int i = 0; i < length; ++i) {
- PRELOAD_COND(dest)
dest[i] = BYTE_MUL(dest[i], a);
}
}
@@ -609,16 +557,13 @@ void QT_FASTCALL comp_func_solid_DestinationOut_rgb64(QRgba64 *dest, int length,
void QT_FASTCALL comp_func_DestinationOut(uint *Q_DECL_RESTRICT dest, const uint *Q_DECL_RESTRICT src, int length, uint const_alpha)
{
- PRELOAD_INIT2(dest, src)
if (const_alpha == 255) {
for (int i = 0; i < length; ++i) {
- PRELOAD_COND2(dest, src)
dest[i] = BYTE_MUL(dest[i], qAlpha(~src[i]));
}
} else {
- int cia = 255 - const_alpha;
+ uint cia = 255 - const_alpha;
for (int i = 0; i < length; ++i) {
- PRELOAD_COND2(dest, src)
uint sia = BYTE_MUL(qAlpha(~src[i]), const_alpha) + cia;
dest[i] = BYTE_MUL(dest[i], sia);
}
@@ -653,9 +598,7 @@ void QT_FASTCALL comp_func_solid_SourceAtop(uint *dest, int length, uint color,
color = BYTE_MUL(color, const_alpha);
}
uint sia = qAlpha(~color);
- PRELOAD_INIT(dest)
for (int i = 0; i < length; ++i) {
- PRELOAD_COND(dest)
dest[i] = INTERPOLATE_PIXEL_255(color, qAlpha(dest[i]), dest[i], sia);
}
}
@@ -672,17 +615,14 @@ void QT_FASTCALL comp_func_solid_SourceAtop_rgb64(QRgba64 *dest, int length, QRg
void QT_FASTCALL comp_func_SourceAtop(uint *Q_DECL_RESTRICT dest, const uint *Q_DECL_RESTRICT src, int length, uint const_alpha)
{
- PRELOAD_INIT2(dest, src)
if (const_alpha == 255) {
for (int i = 0; i < length; ++i) {
- PRELOAD_COND2(dest, src)
uint s = src[i];
uint d = dest[i];
dest[i] = INTERPOLATE_PIXEL_255(s, qAlpha(d), d, qAlpha(~s));
}
} else {
for (int i = 0; i < length; ++i) {
- PRELOAD_COND2(dest, src)
uint s = BYTE_MUL(src[i], const_alpha);
uint d = dest[i];
dest[i] = INTERPOLATE_PIXEL_255(s, qAlpha(d), d, qAlpha(~s));
@@ -719,9 +659,7 @@ void QT_FASTCALL comp_func_solid_DestinationAtop(uint *dest, int length, uint co
color = BYTE_MUL(color, const_alpha);
a = qAlpha(color) + 255 - const_alpha;
}
- PRELOAD_INIT(dest)
for (int i = 0; i < length; ++i) {
- PRELOAD_COND(dest)
uint d = dest[i];
dest[i] = INTERPOLATE_PIXEL_255(d, a, color, qAlpha(~d));
}
@@ -742,18 +680,15 @@ void QT_FASTCALL comp_func_solid_DestinationAtop_rgb64(QRgba64 *dest, int length
void QT_FASTCALL comp_func_DestinationAtop(uint *Q_DECL_RESTRICT dest, const uint *Q_DECL_RESTRICT src, int length, uint const_alpha)
{
- PRELOAD_INIT2(dest, src)
if (const_alpha == 255) {
for (int i = 0; i < length; ++i) {
- PRELOAD_COND2(dest, src)
uint s = src[i];
uint d = dest[i];
dest[i] = INTERPOLATE_PIXEL_255(d, qAlpha(s), s, qAlpha(~d));
}
} else {
- int cia = 255 - const_alpha;
+ uint cia = 255 - const_alpha;
for (int i = 0; i < length; ++i) {
- PRELOAD_COND2(dest, src)
uint s = BYTE_MUL(src[i], const_alpha);
uint d = dest[i];
uint a = qAlpha(s) + cia;
@@ -771,8 +706,8 @@ void QT_FASTCALL comp_func_DestinationAtop_rgb64(QRgba64 *Q_DECL_RESTRICT dest,
dest[i] = interpolate65535(d, s.alpha(), s, 65535 - d.alpha());
}
} else {
- int ca = const_alpha * 257;
- int cia = 65535 - ca;
+ uint ca = const_alpha * 257;
+ uint cia = 65535 - ca;
for (int i = 0; i < length; ++i) {
QRgba64 s = multiplyAlpha65535(src[i], ca);
QRgba64 d = dest[i];
@@ -794,9 +729,7 @@ void QT_FASTCALL comp_func_solid_XOR(uint *dest, int length, uint color, uint co
color = BYTE_MUL(color, const_alpha);
uint sia = qAlpha(~color);
- PRELOAD_INIT(dest)
for (int i = 0; i < length; ++i) {
- PRELOAD_COND(dest)
uint d = dest[i];
dest[i] = INTERPOLATE_PIXEL_255(color, qAlpha(~d), d, sia);
}
@@ -806,26 +739,24 @@ void QT_FASTCALL comp_func_solid_XOR_rgb64(QRgba64 *dest, int length, QRgba64 co
{
if (const_alpha != 255)
color = multiplyAlpha255(color, const_alpha);
- uint sia = 65535 - color.alpha();
+ auto s = CONVERT(color);
+ auto sia = CONST(65535 - color.alpha());
for (int i = 0; i < length; ++i) {
- QRgba64 d = dest[i];
- dest[i] = interpolate65535(color, 65535 - d.alpha(), d, sia);
+ auto d = LOAD(&dest[i]);
+ STORE(&dest[i], interpolate65535(s, INVALPHA(d), d, sia));
}
}
void QT_FASTCALL comp_func_XOR(uint *Q_DECL_RESTRICT dest, const uint *Q_DECL_RESTRICT src, int length, uint const_alpha)
{
- PRELOAD_INIT2(dest, src)
if (const_alpha == 255) {
for (int i = 0; i < length; ++i) {
- PRELOAD_COND2(dest, src)
uint d = dest[i];
uint s = src[i];
dest[i] = INTERPOLATE_PIXEL_255(s, qAlpha(~d), d, qAlpha(~s));
}
} else {
for (int i = 0; i < length; ++i) {
- PRELOAD_COND2(dest, src)
uint d = dest[i];
uint s = BYTE_MUL(src[i], const_alpha);
dest[i] = INTERPOLATE_PIXEL_255(s, qAlpha(~d), d, qAlpha(~s));
@@ -837,15 +768,15 @@ void QT_FASTCALL comp_func_XOR_rgb64(QRgba64 *Q_DECL_RESTRICT dest, const QRgba6
{
if (const_alpha == 255) {
for (int i = 0; i < length; ++i) {
- QRgba64 d = dest[i];
- QRgba64 s = src[i];
- dest[i] = interpolate65535(s, 65535 - d.alpha(), d, 65535 - s.alpha());
+ auto d = LOAD(&dest[i]);
+ auto s = LOAD(&src[i]);
+ STORE(&dest[i], interpolate65535(s, INVALPHA(d), d, INVALPHA(s)));
}
} else {
for (int i = 0; i < length; ++i) {
- QRgba64 d = dest[i];
- QRgba64 s = multiplyAlpha255(src[i], const_alpha);
- dest[i] = interpolate65535(s, 65535 - d.alpha(), d, 65535 - s.alpha());
+ auto d = LOAD(&dest[i]);
+ auto s = multiplyAlpha255(LOAD(&src[i]), const_alpha);
+ STORE(&dest[i], interpolate65535(s, INVALPHA(d), d, INVALPHA(s)));
}
}
}
@@ -901,9 +832,7 @@ Q_STATIC_TEMPLATE_FUNCTION inline void comp_func_solid_Plus_impl(uint *dest, int
{
uint s = color;
- PRELOAD_INIT(dest)
for (int i = 0; i < length; ++i) {
- PRELOAD_COND(dest)
uint d = dest[i];
d = comp_func_Plus_one_pixel(d, s);
coverage.store(&dest[i], d);
@@ -940,9 +869,7 @@ void QT_FASTCALL comp_func_solid_Plus_rgb64(QRgba64 *dest, int length, QRgba64 c
template <typename T>
Q_STATIC_TEMPLATE_FUNCTION inline void comp_func_Plus_impl(uint *Q_DECL_RESTRICT dest, const uint *Q_DECL_RESTRICT src, int length, const T &coverage)
{
- PRELOAD_INIT2(dest, src)
for (int i = 0; i < length; ++i) {
- PRELOAD_COND2(dest, src)
uint d = dest[i];
uint s = src[i];
@@ -1001,9 +928,7 @@ Q_STATIC_TEMPLATE_FUNCTION inline void comp_func_solid_Multiply_impl(uint *dest,
int sg = qGreen(color);
int sb = qBlue(color);
- PRELOAD_INIT(dest)
for (int i = 0; i < length; ++i) {
- PRELOAD_COND(dest)
uint d = dest[i];
int da = qAlpha(d);
@@ -1060,9 +985,7 @@ void QT_FASTCALL comp_func_solid_Multiply_rgb64(QRgba64 *dest, int length, QRgba
template <typename T>
Q_STATIC_TEMPLATE_FUNCTION inline void comp_func_Multiply_impl(uint *Q_DECL_RESTRICT dest, const uint *Q_DECL_RESTRICT src, int length, const T &coverage)
{
- PRELOAD_INIT2(dest, src)
for (int i = 0; i < length; ++i) {
- PRELOAD_COND2(dest, src)
uint d = dest[i];
uint s = src[i];
@@ -1129,9 +1052,7 @@ Q_STATIC_TEMPLATE_FUNCTION inline void comp_func_solid_Screen_impl(uint *dest, i
int sg = qGreen(color);
int sb = qBlue(color);
- PRELOAD_INIT(dest)
for (int i = 0; i < length; ++i) {
- PRELOAD_COND(dest)
uint d = dest[i];
int da = qAlpha(d);
@@ -1188,9 +1109,7 @@ void QT_FASTCALL comp_func_solid_Screen_rgb64(QRgba64 *dest, int length, QRgba64
template <typename T>
Q_STATIC_TEMPLATE_FUNCTION inline void comp_func_Screen_impl(uint *Q_DECL_RESTRICT dest, const uint *Q_DECL_RESTRICT src, int length, const T &coverage)
{
- PRELOAD_INIT2(dest, src)
for (int i = 0; i < length; ++i) {
- PRELOAD_COND2(dest, src)
uint d = dest[i];
uint s = src[i];
@@ -1277,9 +1196,7 @@ Q_STATIC_TEMPLATE_FUNCTION inline void comp_func_solid_Overlay_impl(uint *dest,
int sg = qGreen(color);
int sb = qBlue(color);
- PRELOAD_INIT(dest)
for (int i = 0; i < length; ++i) {
- PRELOAD_COND(dest)
uint d = dest[i];
int da = qAlpha(d);
@@ -1336,9 +1253,7 @@ void QT_FASTCALL comp_func_solid_Overlay_rgb64(QRgba64 *dest, int length, QRgba6
template <typename T>
Q_STATIC_TEMPLATE_FUNCTION inline void comp_func_Overlay_impl(uint *Q_DECL_RESTRICT dest, const uint *Q_DECL_RESTRICT src, int length, const T &coverage)
{
- PRELOAD_INIT2(dest, src)
for (int i = 0; i < length; ++i) {
- PRELOAD_COND2(dest, src)
uint d = dest[i];
uint s = src[i];
@@ -1415,9 +1330,7 @@ Q_STATIC_TEMPLATE_FUNCTION inline void comp_func_solid_Darken_impl(uint *dest, i
int sg = qGreen(color);
int sb = qBlue(color);
- PRELOAD_INIT(dest)
for (int i = 0; i < length; ++i) {
- PRELOAD_COND(dest)
uint d = dest[i];
int da = qAlpha(d);
@@ -1474,9 +1387,7 @@ void QT_FASTCALL comp_func_solid_Darken_rgb64(QRgba64 *dest, int length, QRgba64
template <typename T>
Q_STATIC_TEMPLATE_FUNCTION inline void comp_func_Darken_impl(uint *Q_DECL_RESTRICT dest, const uint *Q_DECL_RESTRICT src, int length, const T &coverage)
{
- PRELOAD_INIT2(dest, src)
for (int i = 0; i < length; ++i) {
- PRELOAD_COND2(dest, src)
uint d = dest[i];
uint s = src[i];
@@ -1553,9 +1464,7 @@ Q_STATIC_TEMPLATE_FUNCTION inline void comp_func_solid_Lighten_impl(uint *dest,
int sg = qGreen(color);
int sb = qBlue(color);
- PRELOAD_INIT(dest)
for (int i = 0; i < length; ++i) {
- PRELOAD_COND(dest)
uint d = dest[i];
int da = qAlpha(d);
@@ -1612,9 +1521,7 @@ void QT_FASTCALL comp_func_solid_Lighten_rgb64(QRgba64 *dest, int length, QRgba6
template <typename T>
Q_STATIC_TEMPLATE_FUNCTION inline void comp_func_Lighten_impl(uint *Q_DECL_RESTRICT dest, const uint *Q_DECL_RESTRICT src, int length, const T &coverage)
{
- PRELOAD_INIT2(dest, src)
for (int i = 0; i < length; ++i) {
- PRELOAD_COND2(dest, src)
uint d = dest[i];
uint s = src[i];
@@ -1709,9 +1616,7 @@ Q_STATIC_TEMPLATE_FUNCTION inline void comp_func_solid_ColorDodge_impl(uint *des
int sg = qGreen(color);
int sb = qBlue(color);
- PRELOAD_INIT(dest)
for (int i = 0; i < length; ++i) {
- PRELOAD_COND(dest)
uint d = dest[i];
int da = qAlpha(d);
@@ -1768,9 +1673,7 @@ void QT_FASTCALL comp_func_solid_ColorDodge_rgb64(QRgba64 *dest, int length, QRg
template <typename T>
Q_STATIC_TEMPLATE_FUNCTION inline void comp_func_ColorDodge_impl(uint *Q_DECL_RESTRICT dest, const uint *Q_DECL_RESTRICT src, int length, const T &coverage)
{
- PRELOAD_INIT2(dest, src)
for (int i = 0; i < length; ++i) {
- PRELOAD_COND2(dest, src)
uint d = dest[i];
uint s = src[i];
@@ -1865,9 +1768,7 @@ Q_STATIC_TEMPLATE_FUNCTION inline void comp_func_solid_ColorBurn_impl(uint *dest
int sg = qGreen(color);
int sb = qBlue(color);
- PRELOAD_INIT(dest)
for (int i = 0; i < length; ++i) {
- PRELOAD_COND(dest)
uint d = dest[i];
int da = qAlpha(d);
@@ -1924,9 +1825,7 @@ void QT_FASTCALL comp_func_solid_ColorBurn_rgb64(QRgba64 *dest, int length, QRgb
template <typename T>
Q_STATIC_TEMPLATE_FUNCTION inline void comp_func_ColorBurn_impl(uint *Q_DECL_RESTRICT dest, const uint *Q_DECL_RESTRICT src, int length, const T &coverage)
{
- PRELOAD_INIT2(dest, src)
for (int i = 0; i < length; ++i) {
- PRELOAD_COND2(dest, src)
uint d = dest[i];
uint s = src[i];
@@ -2015,9 +1914,7 @@ Q_STATIC_TEMPLATE_FUNCTION inline void comp_func_solid_HardLight_impl(uint *dest
int sg = qGreen(color);
int sb = qBlue(color);
- PRELOAD_INIT(dest)
for (int i = 0; i < length; ++i) {
- PRELOAD_COND(dest)
uint d = dest[i];
int da = qAlpha(d);
@@ -2074,9 +1971,7 @@ void QT_FASTCALL comp_func_solid_HardLight_rgb64(QRgba64 *dest, int length, QRgb
template <typename T>
Q_STATIC_TEMPLATE_FUNCTION inline void comp_func_HardLight_impl(uint *Q_DECL_RESTRICT dest, const uint *Q_DECL_RESTRICT src, int length, const T &coverage)
{
- PRELOAD_INIT2(dest, src)
for (int i = 0; i < length; ++i) {
- PRELOAD_COND2(dest, src)
uint d = dest[i];
uint s = src[i];
@@ -2178,9 +2073,7 @@ Q_STATIC_TEMPLATE_FUNCTION inline void comp_func_solid_SoftLight_impl(uint *dest
int sg = qGreen(color);
int sb = qBlue(color);
- PRELOAD_INIT(dest)
for (int i = 0; i < length; ++i) {
- PRELOAD_COND(dest)
uint d = dest[i];
int da = qAlpha(d);
@@ -2237,9 +2130,7 @@ void QT_FASTCALL comp_func_solid_SoftLight_rgb64(QRgba64 *dest, int length, QRgb
template <typename T>
Q_STATIC_TEMPLATE_FUNCTION inline void comp_func_SoftLight_impl(uint *Q_DECL_RESTRICT dest, const uint *Q_DECL_RESTRICT src, int length, const T &coverage)
{
- PRELOAD_INIT2(dest, src)
for (int i = 0; i < length; ++i) {
- PRELOAD_COND2(dest, src)
uint d = dest[i];
uint s = src[i];
@@ -2316,9 +2207,7 @@ Q_STATIC_TEMPLATE_FUNCTION inline void comp_func_solid_Difference_impl(uint *des
int sg = qGreen(color);
int sb = qBlue(color);
- PRELOAD_INIT(dest)
for (int i = 0; i < length; ++i) {
- PRELOAD_COND(dest)
uint d = dest[i];
int da = qAlpha(d);
@@ -2375,9 +2264,7 @@ void QT_FASTCALL comp_func_solid_Difference_rgb64(QRgba64 *dest, int length, QRg
template <typename T>
Q_STATIC_TEMPLATE_FUNCTION inline void comp_func_Difference_impl(uint *Q_DECL_RESTRICT dest, const uint *Q_DECL_RESTRICT src, int length, const T &coverage)
{
- PRELOAD_INIT2(dest, src)
for (int i = 0; i < length; ++i) {
- PRELOAD_COND2(dest, src)
uint d = dest[i];
uint s = src[i];
@@ -2443,9 +2330,7 @@ Q_STATIC_TEMPLATE_FUNCTION inline void QT_FASTCALL comp_func_solid_Exclusion_imp
int sg = qGreen(color);
int sb = qBlue(color);
- PRELOAD_INIT(dest)
for (int i = 0; i < length; ++i) {
- PRELOAD_COND(dest)
uint d = dest[i];
int da = qAlpha(d);
@@ -2503,9 +2388,7 @@ void QT_FASTCALL comp_func_solid_Exclusion_rgb64(QRgba64 *dest, int length, QRgb
template <typename T>
Q_STATIC_TEMPLATE_FUNCTION inline void comp_func_Exclusion_impl(uint *Q_DECL_RESTRICT dest, const uint *Q_DECL_RESTRICT src, int length, const T &coverage)
{
- PRELOAD_INIT2(dest, src)
for (int i = 0; i < length; ++i) {
- PRELOAD_COND2(dest, src)
uint d = dest[i];
uint s = src[i];
diff --git a/src/gui/painting/qcoregraphics.mm b/src/gui/painting/qcoregraphics.mm
index e1601d87dc..2249859c43 100644
--- a/src/gui/painting/qcoregraphics.mm
+++ b/src/gui/painting/qcoregraphics.mm
@@ -293,103 +293,6 @@ QBrush qt_mac_toQBrush(const NSColor *color, QPalette::ColorGroup colorGroup)
}
#endif
-// ---------------------- Color Management ----------------------
-
-static CGColorSpaceRef m_genericColorSpace = 0;
-static QHash<uint32_t, CGColorSpaceRef> m_displayColorSpaceHash;
-static bool m_postRoutineRegistered = false;
-
-static void qt_mac_cleanUpMacColorSpaces()
-{
- if (m_genericColorSpace) {
- CFRelease(m_genericColorSpace);
- m_genericColorSpace = 0;
- }
- QHash<uint32_t, CGColorSpaceRef>::const_iterator it = m_displayColorSpaceHash.constBegin();
- while (it != m_displayColorSpaceHash.constEnd()) {
- if (it.value())
- CFRelease(it.value());
- ++it;
- }
- m_displayColorSpaceHash.clear();
-}
-
-static CGColorSpaceRef qt_mac_displayColorSpace(const QWindow *window)
-{
- CGColorSpaceRef colorSpace = 0;
- uint32_t displayID = 0;
-
-#ifdef Q_OS_MACOS
- if (window == 0) {
- displayID = CGMainDisplayID();
- } else {
- displayID = CGMainDisplayID();
- /*
- ### get correct display
- const QRect &qrect = window->geometry();
- CGRect rect = CGRectMake(qrect.x(), qrect.y(), qrect.width(), qrect.height());
- CGDisplayCount throwAway;
- CGDisplayErr dErr = CGGetDisplaysWithRect(rect, 1, &displayID, &throwAway);
- if (dErr != kCGErrorSuccess)
- return macDisplayColorSpace(0); // fall back on main display
- */
- }
- if ((colorSpace = m_displayColorSpaceHash.value(displayID)))
- return colorSpace;
-
- colorSpace = CGDisplayCopyColorSpace(displayID);
-#else
- Q_UNUSED(window);
-#endif
-
- if (colorSpace == 0)
- colorSpace = CGColorSpaceCreateDeviceRGB();
-
- m_displayColorSpaceHash.insert(displayID, colorSpace);
- if (!m_postRoutineRegistered) {
- m_postRoutineRegistered = true;
- qAddPostRoutine(qt_mac_cleanUpMacColorSpaces);
- }
- return colorSpace;
-}
-
-CGColorSpaceRef qt_mac_colorSpaceForDeviceType(const QPaintDevice *paintDevice)
-{
- Q_UNUSED(paintDevice);
-
- // FIXME: Move logic into each paint device once Qt has support for color spaces
- return qt_mac_displayColorSpace(0);
-
- // The following code seems to take care of QWidget, but in reality doesn't, as
- // qt_mac_displayColorSpace ignores the argument and always uses the main display.
-#if 0
- bool isWidget = (paintDevice->devType() == QInternal::Widget);
- return qt_mac_displayColorSpace(isWidget ? static_cast<const QWidget *>(paintDevice)->window() : 0);
-#endif
-}
-
-CGColorSpaceRef qt_mac_genericColorSpace()
-{
-#if 0
- if (!m_genericColorSpace) {
- if (QSysInfo::MacintoshVersion >= QSysInfo::MV_10_4) {
- m_genericColorSpace = CGColorSpaceCreateWithName(kCGColorSpaceGenericRGB);
- } else
- {
- m_genericColorSpace = CGColorSpaceCreateDeviceRGB();
- }
- if (!m_postRoutineRegistered) {
- m_postRoutineRegistered = true;
- qAddPostRoutine(QCoreGraphicsPaintEngine::cleanUpMacColorSpaces);
- }
- }
- return m_genericColorSpace;
-#else
- // Just return the main display colorspace for the moment.
- return qt_mac_displayColorSpace(0);
-#endif
-}
-
// ---------------------- Geometry Helpers ----------------------
void qt_mac_clip_cg(CGContextRef hd, const QRegion &rgn, CGAffineTransform *orig_xform)
@@ -459,12 +362,13 @@ QMacCGContext::QMacCGContext(QPaintDevice *paintDevice) : context(0)
if (!image)
return; // Context type not supported.
- CGColorSpaceRef colorspace = qt_mac_colorSpaceForDeviceType(paintDevice);
+ CGColorSpaceRef colorSpace = CGColorSpaceCreateWithName(kCGColorSpaceSRGB);
uint flags = kCGImageAlphaPremultipliedFirst;
flags |= kCGBitmapByteOrder32Host;
context = CGBitmapContextCreate(image->bits(), image->width(), image->height(),
- 8, image->bytesPerLine(), colorspace, flags);
+ 8, image->bytesPerLine(), colorSpace, flags);
+ CFRelease(colorSpace);
CGContextTranslateCTM(context, 0, image->height());
const qreal devicePixelRatio = paintDevice->devicePixelRatioF();
CGContextScaleCTM(context, devicePixelRatio, devicePixelRatio);
@@ -492,7 +396,7 @@ QMacCGContext::QMacCGContext(QPainter *painter) : context(0)
devType == QInternal::Pixmap ||
devType == QInternal::Image)) {
- CGColorSpaceRef colorspace = qt_mac_colorSpaceForDeviceType(paintEngine->paintDevice());
+ CGColorSpaceRef colorSpace = CGColorSpaceCreateWithName(kCGColorSpaceSRGB);
uint flags = kCGImageAlphaPremultipliedFirst;
#ifdef kCGBitmapByteOrder32Host //only needed because CGImage.h added symbols in the minor version
flags |= kCGBitmapByteOrder32Host;
@@ -500,7 +404,8 @@ QMacCGContext::QMacCGContext(QPainter *painter) : context(0)
const QImage *image = static_cast<const QImage *>(paintEngine->paintDevice());
context = CGBitmapContextCreate((void *)image->bits(), image->width(), image->height(),
- 8, image->bytesPerLine(), colorspace, flags);
+ 8, image->bytesPerLine(), colorSpace, flags);
+ CFRelease(colorSpace);
// Invert y axis
CGContextTranslateCTM(context, 0, image->height());
diff --git a/src/gui/painting/qcoregraphics_p.h b/src/gui/painting/qcoregraphics_p.h
index 6b6a1e800e..de721c94aa 100644
--- a/src/gui/painting/qcoregraphics_p.h
+++ b/src/gui/painting/qcoregraphics_p.h
@@ -75,9 +75,6 @@ Q_GUI_EXPORT QImage qt_mac_toQImage(CGImageRef image);
Q_GUI_EXPORT void qt_mac_drawCGImage(CGContextRef inContext, const CGRect *inBounds, CGImageRef inImage);
-Q_GUI_EXPORT CGColorSpaceRef qt_mac_genericColorSpace();
-Q_GUI_EXPORT CGColorSpaceRef qt_mac_colorSpaceForDeviceType(const QPaintDevice *paintDevice);
-
Q_GUI_EXPORT void qt_mac_clip_cg(CGContextRef hd, const QRegion &rgn, CGAffineTransform *orig_xform);
#ifdef HAVE_APPKIT
diff --git a/src/gui/painting/qdrawhelper.cpp b/src/gui/painting/qdrawhelper.cpp
index 6bfdc940ac..7f8976d972 100644
--- a/src/gui/painting/qdrawhelper.cpp
+++ b/src/gui/painting/qdrawhelper.cpp
@@ -6444,7 +6444,7 @@ static void qInitDrawhelperFunctions()
sourceFetchUntransformed[QImage::Format_RGB888] = qt_fetchUntransformed_888_neon;
-#if defined(Q_PROCESSOR_ARM_64) && Q_BYTE_ORDER == Q_LITTLE_ENDIAN
+#if Q_BYTE_ORDER == Q_LITTLE_ENDIAN
extern const uint *QT_FASTCALL convertARGB32ToARGB32PM_neon(uint *buffer, const uint *src, int count,
const QVector<QRgb> *, QDitherInfo *);
extern const uint *QT_FASTCALL convertRGBA8888ToARGB32PM_neon(uint *buffer, const uint *src, int count,
diff --git a/src/gui/painting/qdrawhelper_neon.cpp b/src/gui/painting/qdrawhelper_neon.cpp
index 4cbac009d8..e126f4b670 100644
--- a/src/gui/painting/qdrawhelper_neon.cpp
+++ b/src/gui/painting/qdrawhelper_neon.cpp
@@ -1080,23 +1080,41 @@ const uint * QT_FASTCALL qt_fetchUntransformed_888_neon(uint *buffer, const Oper
return buffer;
}
-#if defined(Q_PROCESSOR_ARM_64) && Q_BYTE_ORDER == Q_LITTLE_ENDIAN
+#if Q_BYTE_ORDER == Q_LITTLE_ENDIAN
template<bool RGBA>
static inline void convertARGBToARGB32PM_neon(uint *buffer, const uint *src, int count)
{
int i = 0;
+#if defined(Q_PROCESSOR_ARM_64)
const uint8x16_t rgbaMask = { 2, 1, 0, 3, 6, 5, 4, 7, 10, 9, 8, 11, 14, 13, 12, 15};
+#else
+ const uint8x8_t rgbaMask = { 2, 1, 0, 3, 6, 5, 4, 7 };
+#endif
const uint8x8_t shuffleMask = { 3, 3, 3, 3, 7, 7, 7, 7};
const uint32x4_t blendMask = vdupq_n_u32(0xff000000);
for (; i < count - 3; i += 4) {
uint32x4_t srcVector = vld1q_u32(src + i);
uint32x4_t alphaVector = vshrq_n_u32(srcVector, 24);
+#if defined(Q_PROCESSOR_ARM_64)
uint32_t alphaSum = vaddvq_u32(alphaVector);
+#else
+ // no vaddvq_u32
+ uint32x2_t tmp = vpadd_u32(vget_low_u32(alphaVector), vget_high_u32(alphaVector));
+ uint32_t alphaSum = vget_lane_u32(vpadd_u32(tmp, tmp), 0);
+#endif
if (alphaSum) {
if (alphaSum != 255 * 4) {
- if (RGBA)
+ if (RGBA) {
+#if defined(Q_PROCESSOR_ARM_64)
srcVector = vreinterpretq_u32_u8(vqtbl1q_u8(vreinterpretq_u8_u32(srcVector), rgbaMask));
+#else
+ // no vqtbl1q_u8
+ const uint8x8_t low = vtbl1_u8(vreinterpret_u8_u32(vget_low_u32(srcVector)), rgbaMask);
+ const uint8x8_t high = vtbl1_u8(vreinterpret_u8_u32(vget_high_u32(srcVector)), rgbaMask);
+ srcVector = vcombine_u32(vreinterpret_u32_u8(low), vreinterpret_u32_u8(high));
+#endif
+ }
const uint8x8_t s1 = vreinterpret_u8_u32(vget_low_u32(srcVector));
const uint8x8_t s2 = vreinterpret_u8_u32(vget_high_u32(srcVector));
const uint8x8_t alpha1 = vtbl1_u8(s1, shuffleMask);
@@ -1110,10 +1128,19 @@ static inline void convertARGBToARGB32PM_neon(uint *buffer, const uint *src, int
const uint32x4_t d = vbslq_u32(blendMask, srcVector, vreinterpretq_u32_u8(vcombine_u8(d1, d2)));
vst1q_u32(buffer + i, d);
} else {
- if (RGBA)
- vst1q_u32(buffer + i, vreinterpretq_u32_u8(vqtbl1q_u8(vreinterpretq_u8_u32(srcVector), rgbaMask)));
- else if (buffer != src)
+ if (RGBA) {
+#if defined(Q_PROCESSOR_ARM_64)
+ srcVector = vreinterpretq_u32_u8(vqtbl1q_u8(vreinterpretq_u8_u32(srcVector), rgbaMask));
+#else
+ // no vqtbl1q_u8
+ const uint8x8_t low = vtbl1_u8(vreinterpret_u8_u32(vget_low_u32(srcVector)), rgbaMask);
+ const uint8x8_t high = vtbl1_u8(vreinterpret_u8_u32(vget_high_u32(srcVector)), rgbaMask);
+ srcVector = vcombine_u32(vreinterpret_u32_u8(low), vreinterpret_u32_u8(high));
+#endif
+ vst1q_u32(buffer + i, srcVector);
+ } else if (buffer != src) {
vst1q_u32(buffer + i, srcVector);
+ }
}
} else {
vst1q_u32(buffer + i, vdupq_n_u32(0));
@@ -1139,7 +1166,8 @@ const uint *QT_FASTCALL convertRGBA8888ToARGB32PM_neon(uint *buffer, const uint
convertARGBToARGB32PM_neon<true>(buffer, src, count);
return buffer;
}
-#endif
+
+#endif // Q_BYTE_ORDER == Q_LITTLE_ENDIAN
QT_END_NAMESPACE
diff --git a/src/gui/painting/qdrawhelper_p.h b/src/gui/painting/qdrawhelper_p.h
index df9f762314..4c2fe87355 100644
--- a/src/gui/painting/qdrawhelper_p.h
+++ b/src/gui/painting/qdrawhelper_p.h
@@ -1160,23 +1160,23 @@ const uint qt_bayer_matrix[16][16] = {
#if Q_PROCESSOR_WORDSIZE == 8 // 64-bit versions
-#define AMIX(mask) (qMin(((qint64(s)&mask) + (qint64(d)&mask)), qint64(mask)))
-#define MIX(mask) (qMin(((qint64(s)&mask) + (qint64(d)&mask)), qint64(mask)))
+#define AMIX(mask) (qMin(((quint64(s)&mask) + (quint64(d)&mask)), quint64(mask)))
+#define MIX(mask) (qMin(((quint64(s)&mask) + (quint64(d)&mask)), quint64(mask)))
#else // 32 bits
// The mask for alpha can overflow over 32 bits
-#define AMIX(mask) quint32(qMin(((qint64(s)&mask) + (qint64(d)&mask)), qint64(mask)))
+#define AMIX(mask) quint32(qMin(((quint64(s)&mask) + (quint64(d)&mask)), quint64(mask)))
#define MIX(mask) (qMin(((quint32(s)&mask) + (quint32(d)&mask)), quint32(mask)))
#endif
-inline int comp_func_Plus_one_pixel_const_alpha(uint d, const uint s, const uint const_alpha, const uint one_minus_const_alpha)
+inline uint comp_func_Plus_one_pixel_const_alpha(uint d, const uint s, const uint const_alpha, const uint one_minus_const_alpha)
{
- const int result = (AMIX(AMASK) | MIX(RMASK) | MIX(GMASK) | MIX(BMASK));
+ const uint result = uint(AMIX(AMASK) | MIX(RMASK) | MIX(GMASK) | MIX(BMASK));
return INTERPOLATE_PIXEL_255(result, const_alpha, d, one_minus_const_alpha);
}
-inline int comp_func_Plus_one_pixel(uint d, const uint s)
+inline uint comp_func_Plus_one_pixel(uint d, const uint s)
{
- const int result = (AMIX(AMASK) | MIX(RMASK) | MIX(GMASK) | MIX(BMASK));
+ const uint result = uint(AMIX(AMASK) | MIX(RMASK) | MIX(GMASK) | MIX(BMASK));
return result;
}
diff --git a/src/gui/painting/qmatrix.h b/src/gui/painting/qmatrix.h
index 15e0ab5be1..74ecef767e 100644
--- a/src/gui/painting/qmatrix.h
+++ b/src/gui/painting/qmatrix.h
@@ -108,7 +108,7 @@ public:
bool isInvertible() const { return !qFuzzyIsNull(_m11*_m22 - _m12*_m21); }
qreal determinant() const { return _m11*_m22 - _m12*_m21; }
- Q_REQUIRED_RESULT QMatrix inverted(bool *invertible = Q_NULLPTR) const;
+ Q_REQUIRED_RESULT QMatrix inverted(bool *invertible = nullptr) const;
bool operator==(const QMatrix &) const;
bool operator!=(const QMatrix &) const;
diff --git a/src/gui/painting/qpaintengine_blitter_p.h b/src/gui/painting/qpaintengine_blitter_p.h
index 40f5347b26..fb5dfe2318 100644
--- a/src/gui/painting/qpaintengine_blitter_p.h
+++ b/src/gui/painting/qpaintengine_blitter_p.h
@@ -67,48 +67,48 @@ class Q_GUI_EXPORT QBlitterPaintEngine : public QRasterPaintEngine
public:
QBlitterPaintEngine(QBlittablePlatformPixmap *p);
- virtual QPaintEngine::Type type() const Q_DECL_OVERRIDE
+ virtual QPaintEngine::Type type() const override
{ return Blitter; }
- virtual bool begin(QPaintDevice *pdev) Q_DECL_OVERRIDE;
- virtual bool end() Q_DECL_OVERRIDE;
+ virtual bool begin(QPaintDevice *pdev) override;
+ virtual bool end() override;
// Call down into QBlittable
- void fill(const QVectorPath &path, const QBrush &brush) Q_DECL_OVERRIDE;
- void fillRect(const QRectF &rect, const QBrush &brush) Q_DECL_OVERRIDE;
- void fillRect(const QRectF &rect, const QColor &color) Q_DECL_OVERRIDE;
- void drawRects(const QRect *rects, int rectCount) Q_DECL_OVERRIDE;
- void drawRects(const QRectF *rects, int rectCount) Q_DECL_OVERRIDE;
- void drawPixmap(const QPointF &p, const QPixmap &pm) Q_DECL_OVERRIDE;
- void drawPixmap(const QRectF &r, const QPixmap &pm, const QRectF &sr) Q_DECL_OVERRIDE;
+ void fill(const QVectorPath &path, const QBrush &brush) override;
+ void fillRect(const QRectF &rect, const QBrush &brush) override;
+ void fillRect(const QRectF &rect, const QColor &color) override;
+ void drawRects(const QRect *rects, int rectCount) override;
+ void drawRects(const QRectF *rects, int rectCount) override;
+ void drawPixmap(const QPointF &p, const QPixmap &pm) override;
+ void drawPixmap(const QRectF &r, const QPixmap &pm, const QRectF &sr) override;
// State tracking
- void setState(QPainterState *s) Q_DECL_OVERRIDE;
- virtual void clipEnabledChanged() Q_DECL_OVERRIDE;
- virtual void penChanged() Q_DECL_OVERRIDE;
- virtual void brushChanged() Q_DECL_OVERRIDE;
- virtual void opacityChanged() Q_DECL_OVERRIDE;
- virtual void compositionModeChanged() Q_DECL_OVERRIDE;
- virtual void renderHintsChanged() Q_DECL_OVERRIDE;
- virtual void transformChanged() Q_DECL_OVERRIDE;
+ void setState(QPainterState *s) override;
+ virtual void clipEnabledChanged() override;
+ virtual void penChanged() override;
+ virtual void brushChanged() override;
+ virtual void opacityChanged() override;
+ virtual void compositionModeChanged() override;
+ virtual void renderHintsChanged() override;
+ virtual void transformChanged() override;
// Override to lock the QBlittable before using raster
- void drawPolygon(const QPointF *points, int pointCount, PolygonDrawMode mode) Q_DECL_OVERRIDE;
- void drawPolygon(const QPoint *points, int pointCount, PolygonDrawMode mode) Q_DECL_OVERRIDE;
- void fillPath(const QPainterPath &path, QSpanData *fillData) Q_DECL_OVERRIDE;
- void fillPolygon(const QPointF *points, int pointCount, PolygonDrawMode mode) Q_DECL_OVERRIDE;
- void drawEllipse(const QRectF &rect) Q_DECL_OVERRIDE;
- void drawImage(const QPointF &p, const QImage &img) Q_DECL_OVERRIDE;
+ void drawPolygon(const QPointF *points, int pointCount, PolygonDrawMode mode) override;
+ void drawPolygon(const QPoint *points, int pointCount, PolygonDrawMode mode) override;
+ void fillPath(const QPainterPath &path, QSpanData *fillData) override;
+ void fillPolygon(const QPointF *points, int pointCount, PolygonDrawMode mode) override;
+ void drawEllipse(const QRectF &rect) override;
+ void drawImage(const QPointF &p, const QImage &img) override;
void drawImage(const QRectF &r, const QImage &pm, const QRectF &sr,
- Qt::ImageConversionFlags flags = Qt::AutoColor) Q_DECL_OVERRIDE;
- void drawTiledPixmap(const QRectF &r, const QPixmap &pm, const QPointF &sr) Q_DECL_OVERRIDE;
- void drawTextItem(const QPointF &p, const QTextItem &textItem) Q_DECL_OVERRIDE;
- void drawPoints(const QPointF *points, int pointCount) Q_DECL_OVERRIDE;
- void drawPoints(const QPoint *points, int pointCount) Q_DECL_OVERRIDE;
- void stroke(const QVectorPath &path, const QPen &pen) Q_DECL_OVERRIDE;
- void drawStaticTextItem(QStaticTextItem *) Q_DECL_OVERRIDE;
+ Qt::ImageConversionFlags flags = Qt::AutoColor) override;
+ void drawTiledPixmap(const QRectF &r, const QPixmap &pm, const QPointF &sr) override;
+ void drawTextItem(const QPointF &p, const QTextItem &textItem) override;
+ void drawPoints(const QPointF *points, int pointCount) override;
+ void drawPoints(const QPoint *points, int pointCount) override;
+ void stroke(const QVectorPath &path, const QPen &pen) override;
+ void drawStaticTextItem(QStaticTextItem *) override;
bool drawCachedGlyphs(int numGlyphs, const glyph_t *glyphs, const QFixedPoint *positions,
- QFontEngine *fontEngine) Q_DECL_OVERRIDE;
+ QFontEngine *fontEngine) override;
};
QT_END_NAMESPACE
diff --git a/src/gui/painting/qpaintengine_raster.cpp b/src/gui/painting/qpaintengine_raster.cpp
index 1637a933b1..0e3163eefb 100644
--- a/src/gui/painting/qpaintengine_raster.cpp
+++ b/src/gui/painting/qpaintengine_raster.cpp
@@ -3782,8 +3782,8 @@ void QClipData::initialize()
}
} else if (hasRegionClip) {
- const QVector<QRect> rects = clipRegion.rects();
- const int numRects = rects.size();
+ const auto rects = clipRegion.begin();
+ const int numRects = clipRegion.rectCount();
{ // resize
const int maxSpans = (ymax - ymin) * numRects;
@@ -3797,8 +3797,8 @@ void QClipData::initialize()
int firstInBand = 0;
count = 0;
while (firstInBand < numRects) {
- const int currMinY = rects.at(firstInBand).y();
- const int currMaxY = currMinY + rects.at(firstInBand).height();
+ const int currMinY = rects[firstInBand].y();
+ const int currMaxY = currMinY + rects[firstInBand].height();
while (y < currMinY) {
m_clipLines[y].spans = 0;
@@ -3807,7 +3807,7 @@ void QClipData::initialize()
}
int lastInBand = firstInBand;
- while (lastInBand + 1 < numRects && rects.at(lastInBand+1).top() == y)
+ while (lastInBand + 1 < numRects && rects[lastInBand+1].top() == y)
++lastInBand;
while (y < currMaxY) {
@@ -3816,7 +3816,7 @@ void QClipData::initialize()
m_clipLines[y].count = lastInBand - firstInBand + 1;
for (int r = firstInBand; r <= lastInBand; ++r) {
- const QRect &currRect = rects.at(r);
+ const QRect &currRect = rects[r];
QSpan *span = m_spans + count;
span->x = currRect.x();
span->len = currRect.width();
diff --git a/src/gui/painting/qpaintengine_raster_p.h b/src/gui/painting/qpaintengine_raster_p.h
index e2e0f821e3..8c6f668d9d 100644
--- a/src/gui/painting/qpaintengine_raster_p.h
+++ b/src/gui/painting/qpaintengine_raster_p.h
@@ -135,20 +135,20 @@ public:
QRasterPaintEngine(QPaintDevice *device);
~QRasterPaintEngine();
- bool begin(QPaintDevice *device) Q_DECL_OVERRIDE;
- bool end() Q_DECL_OVERRIDE;
-
- void penChanged() Q_DECL_OVERRIDE;
- void brushChanged() Q_DECL_OVERRIDE;
- void brushOriginChanged() Q_DECL_OVERRIDE;
- void opacityChanged() Q_DECL_OVERRIDE;
- void compositionModeChanged() Q_DECL_OVERRIDE;
- void renderHintsChanged() Q_DECL_OVERRIDE;
- void transformChanged() Q_DECL_OVERRIDE;
- void clipEnabledChanged() Q_DECL_OVERRIDE;
-
- void setState(QPainterState *s) Q_DECL_OVERRIDE;
- QPainterState *createState(QPainterState *orig) const Q_DECL_OVERRIDE;
+ bool begin(QPaintDevice *device) override;
+ bool end() override;
+
+ void penChanged() override;
+ void brushChanged() override;
+ void brushOriginChanged() override;
+ void opacityChanged() override;
+ void compositionModeChanged() override;
+ void renderHintsChanged() override;
+ void transformChanged() override;
+ void clipEnabledChanged() override;
+
+ void setState(QPainterState *s) override;
+ QPainterState *createState(QPainterState *orig) const override;
inline QRasterPaintEngineState *state() {
return static_cast<QRasterPaintEngineState *>(QPaintEngineEx::state());
}
@@ -164,40 +164,40 @@ public:
virtual void fillPath(const QPainterPath &path, QSpanData *fillData);
virtual void fillPolygon(const QPointF *points, int pointCount, PolygonDrawMode mode);
- void drawPolygon(const QPointF *points, int pointCount, PolygonDrawMode mode) Q_DECL_OVERRIDE;
- void drawPolygon(const QPoint *points, int pointCount, PolygonDrawMode mode) Q_DECL_OVERRIDE;
+ void drawPolygon(const QPointF *points, int pointCount, PolygonDrawMode mode) override;
+ void drawPolygon(const QPoint *points, int pointCount, PolygonDrawMode mode) override;
- void drawEllipse(const QRectF &rect) Q_DECL_OVERRIDE;
+ void drawEllipse(const QRectF &rect) override;
- void fillRect(const QRectF &rect, const QBrush &brush) Q_DECL_OVERRIDE;
- void fillRect(const QRectF &rect, const QColor &color) Q_DECL_OVERRIDE;
+ void fillRect(const QRectF &rect, const QBrush &brush) override;
+ void fillRect(const QRectF &rect, const QColor &color) override;
- void drawRects(const QRect *rects, int rectCount) Q_DECL_OVERRIDE;
- void drawRects(const QRectF *rects, int rectCount) Q_DECL_OVERRIDE;
+ void drawRects(const QRect *rects, int rectCount) override;
+ void drawRects(const QRectF *rects, int rectCount) override;
- void drawPixmap(const QPointF &p, const QPixmap &pm) Q_DECL_OVERRIDE;
- void drawPixmap(const QRectF &r, const QPixmap &pm, const QRectF &sr) Q_DECL_OVERRIDE;
- void drawImage(const QPointF &p, const QImage &img) Q_DECL_OVERRIDE;
+ void drawPixmap(const QPointF &p, const QPixmap &pm) override;
+ void drawPixmap(const QRectF &r, const QPixmap &pm, const QRectF &sr) override;
+ void drawImage(const QPointF &p, const QImage &img) override;
void drawImage(const QRectF &r, const QImage &pm, const QRectF &sr,
- Qt::ImageConversionFlags flags = Qt::AutoColor) Q_DECL_OVERRIDE;
- void drawTiledPixmap(const QRectF &r, const QPixmap &pm, const QPointF &sr) Q_DECL_OVERRIDE;
- void drawTextItem(const QPointF &p, const QTextItem &textItem) Q_DECL_OVERRIDE;
+ Qt::ImageConversionFlags flags = Qt::AutoColor) override;
+ void drawTiledPixmap(const QRectF &r, const QPixmap &pm, const QPointF &sr) override;
+ void drawTextItem(const QPointF &p, const QTextItem &textItem) override;
- void drawLines(const QLine *line, int lineCount) Q_DECL_OVERRIDE;
- void drawLines(const QLineF *line, int lineCount) Q_DECL_OVERRIDE;
+ void drawLines(const QLine *line, int lineCount) override;
+ void drawLines(const QLineF *line, int lineCount) override;
- void drawPoints(const QPointF *points, int pointCount) Q_DECL_OVERRIDE;
- void drawPoints(const QPoint *points, int pointCount) Q_DECL_OVERRIDE;
+ void drawPoints(const QPointF *points, int pointCount) override;
+ void drawPoints(const QPoint *points, int pointCount) override;
- void stroke(const QVectorPath &path, const QPen &pen) Q_DECL_OVERRIDE;
- void fill(const QVectorPath &path, const QBrush &brush) Q_DECL_OVERRIDE;
+ void stroke(const QVectorPath &path, const QPen &pen) override;
+ void fill(const QVectorPath &path, const QBrush &brush) override;
- void clip(const QVectorPath &path, Qt::ClipOperation op) Q_DECL_OVERRIDE;
- void clip(const QRect &rect, Qt::ClipOperation op) Q_DECL_OVERRIDE;
- void clip(const QRegion &region, Qt::ClipOperation op) Q_DECL_OVERRIDE;
+ void clip(const QVectorPath &path, Qt::ClipOperation op) override;
+ void clip(const QRect &rect, Qt::ClipOperation op) override;
+ void clip(const QRegion &region, Qt::ClipOperation op) override;
inline const QClipData *clipData() const;
- void drawStaticTextItem(QStaticTextItem *textItem) Q_DECL_OVERRIDE;
+ void drawStaticTextItem(QStaticTextItem *textItem) override;
virtual bool drawCachedGlyphs(int numGlyphs, const glyph_t *glyphs, const QFixedPoint *positions,
QFontEngine *fontEngine);
@@ -227,12 +227,12 @@ public:
QRasterBuffer *rasterBuffer();
void alphaPenBlt(const void* src, int bpl, int depth, int rx,int ry,int w,int h, bool useGammaCorrection);
- Type type() const Q_DECL_OVERRIDE { return Raster; }
+ Type type() const override { return Raster; }
- QPoint coordinateOffset() const Q_DECL_OVERRIDE;
+ QPoint coordinateOffset() const override;
- bool requiresPretransformedGlyphPositions(QFontEngine *fontEngine, const QTransform &m) const Q_DECL_OVERRIDE;
- bool shouldDrawCachedGlyphs(QFontEngine *fontEngine, const QTransform &m) const Q_DECL_OVERRIDE;
+ bool requiresPretransformedGlyphPositions(QFontEngine *fontEngine, const QTransform &m) const override;
+ bool shouldDrawCachedGlyphs(QFontEngine *fontEngine, const QTransform &m) const override;
protected:
QRasterPaintEngine(QRasterPaintEnginePrivate &d, QPaintDevice *);
diff --git a/src/gui/painting/qpaintengineex.cpp b/src/gui/painting/qpaintengineex.cpp
index 812cb8c02d..0643a7cbb6 100644
--- a/src/gui/painting/qpaintengineex.cpp
+++ b/src/gui/painting/qpaintengineex.cpp
@@ -619,18 +619,17 @@ void QPaintEngineEx::clip(const QRect &r, Qt::ClipOperation op)
void QPaintEngineEx::clip(const QRegion &region, Qt::ClipOperation op)
{
- if (region.rectCount() == 1)
- clip(region.boundingRect(), op);
-
- QVector<QRect> rects = region.rects();
- if (rects.size() <= 32) {
+ const auto rectsInRegion = region.rectCount();
+ if (rectsInRegion == 1) {
+ clip(*region.begin(), op);
+ } else if (rectsInRegion <= 32) {
qreal pts[2*32*4];
int pos = 0;
- for (QVector<QRect>::const_iterator i = rects.constBegin(); i != rects.constEnd(); ++i) {
- qreal x1 = i->x();
- qreal y1 = i->y();
- qreal x2 = i->x() + i->width();
- qreal y2 = i->y() + i->height();
+ for (QRect r : region) {
+ qreal x1 = r.x();
+ qreal y1 = r.y();
+ qreal x2 = r.x() + r.width();
+ qreal y2 = r.y() + r.height();
pts[pos++] = x1;
pts[pos++] = y1;
@@ -644,19 +643,19 @@ void QPaintEngineEx::clip(const QRegion &region, Qt::ClipOperation op)
pts[pos++] = x1;
pts[pos++] = y2;
}
- QVectorPath vp(pts, rects.size() * 4, qpaintengineex_rect4_types_32);
+ QVectorPath vp(pts, rectsInRegion * 4, qpaintengineex_rect4_types_32);
clip(vp, op);
} else {
- QVarLengthArray<qreal> pts(rects.size() * 2 * 4);
- QVarLengthArray<QPainterPath::ElementType> types(rects.size() * 4);
+ QVarLengthArray<qreal> pts(rectsInRegion * 2 * 4);
+ QVarLengthArray<QPainterPath::ElementType> types(rectsInRegion * 4);
int ppos = 0;
int tpos = 0;
- for (QVector<QRect>::const_iterator i = rects.constBegin(); i != rects.constEnd(); ++i) {
- qreal x1 = i->x();
- qreal y1 = i->y();
- qreal x2 = i->x() + i->width();
- qreal y2 = i->y() + i->height();
+ for (QRect r : region) {
+ qreal x1 = r.x();
+ qreal y1 = r.y();
+ qreal x2 = r.x() + r.width();
+ qreal y2 = r.y() + r.height();
pts[ppos++] = x1;
pts[ppos++] = y1;
@@ -676,7 +675,7 @@ void QPaintEngineEx::clip(const QRegion &region, Qt::ClipOperation op)
types[tpos++] = QPainterPath::LineToElement;
}
- QVectorPath vp(pts.data(), rects.size() * 4, types.data());
+ QVectorPath vp(pts.data(), rectsInRegion * 4, types.data());
clip(vp, op);
}
diff --git a/src/gui/painting/qpaintengineex_p.h b/src/gui/painting/qpaintengineex_p.h
index 7c2c98140f..b2f8b64029 100644
--- a/src/gui/painting/qpaintengineex_p.h
+++ b/src/gui/painting/qpaintengineex_p.h
@@ -103,36 +103,36 @@ public:
virtual void drawRoundedRect(const QRectF &rect, qreal xrad, qreal yrad, Qt::SizeMode mode);
- virtual void drawRects(const QRect *rects, int rectCount) Q_DECL_OVERRIDE;
- virtual void drawRects(const QRectF *rects, int rectCount) Q_DECL_OVERRIDE;
+ virtual void drawRects(const QRect *rects, int rectCount) override;
+ virtual void drawRects(const QRectF *rects, int rectCount) override;
- virtual void drawLines(const QLine *lines, int lineCount) Q_DECL_OVERRIDE;
- virtual void drawLines(const QLineF *lines, int lineCount) Q_DECL_OVERRIDE;
+ virtual void drawLines(const QLine *lines, int lineCount) override;
+ virtual void drawLines(const QLineF *lines, int lineCount) override;
- virtual void drawEllipse(const QRectF &r) Q_DECL_OVERRIDE;
- virtual void drawEllipse(const QRect &r) Q_DECL_OVERRIDE;
+ virtual void drawEllipse(const QRectF &r) override;
+ virtual void drawEllipse(const QRect &r) override;
- virtual void drawPath(const QPainterPath &path) Q_DECL_OVERRIDE;
+ virtual void drawPath(const QPainterPath &path) override;
- virtual void drawPoints(const QPointF *points, int pointCount) Q_DECL_OVERRIDE;
- virtual void drawPoints(const QPoint *points, int pointCount) Q_DECL_OVERRIDE;
+ virtual void drawPoints(const QPointF *points, int pointCount) override;
+ virtual void drawPoints(const QPoint *points, int pointCount) override;
- virtual void drawPolygon(const QPointF *points, int pointCount, PolygonDrawMode mode) Q_DECL_OVERRIDE;
- virtual void drawPolygon(const QPoint *points, int pointCount, PolygonDrawMode mode) Q_DECL_OVERRIDE;
+ virtual void drawPolygon(const QPointF *points, int pointCount, PolygonDrawMode mode) override;
+ virtual void drawPolygon(const QPoint *points, int pointCount, PolygonDrawMode mode) override;
- virtual void drawPixmap(const QRectF &r, const QPixmap &pm, const QRectF &sr) Q_DECL_OVERRIDE = 0;
+ virtual void drawPixmap(const QRectF &r, const QPixmap &pm, const QRectF &sr) override = 0;
virtual void drawPixmap(const QPointF &pos, const QPixmap &pm);
virtual void drawImage(const QRectF &r, const QImage &pm, const QRectF &sr,
- Qt::ImageConversionFlags flags = Qt::AutoColor) Q_DECL_OVERRIDE = 0;
+ Qt::ImageConversionFlags flags = Qt::AutoColor) override = 0;
virtual void drawImage(const QPointF &pos, const QImage &image);
- virtual void drawTiledPixmap(const QRectF &r, const QPixmap &pixmap, const QPointF &s) Q_DECL_OVERRIDE;
+ virtual void drawTiledPixmap(const QRectF &r, const QPixmap &pixmap, const QPointF &s) override;
virtual void drawPixmapFragments(const QPainter::PixmapFragment *fragments, int fragmentCount, const QPixmap &pixmap,
QFlags<QPainter::PixmapFragmentHint> hints);
- virtual void updateState(const QPaintEngineState &state) Q_DECL_OVERRIDE;
+ virtual void updateState(const QPaintEngineState &state) override;
virtual void drawStaticTextItem(QStaticTextItem *);
diff --git a/src/gui/painting/qpainter.cpp b/src/gui/painting/qpainter.cpp
index 6e84a3f384..e98ad8ce8b 100644
--- a/src/gui/painting/qpainter.cpp
+++ b/src/gui/painting/qpainter.cpp
@@ -5850,7 +5850,7 @@ void QPainter::drawText(const QPointF &p, const QString &str, int tf, int justif
if (!d->engine || str.isEmpty() || pen().style() == Qt::NoPen)
return;
-#if QT_VERSION < QT_VERSION_CHECK(6, 0, 0)
+#if QT_DEPRECATED_SINCE(5, 11) && QT_VERSION < QT_VERSION_CHECK(6, 0, 0)
if (tf & Qt::TextBypassShaping) {
// Skip complex shaping, shape using glyph advances only
int len = str.length();
@@ -7478,7 +7478,7 @@ start_lengthVariant:
if (!expandtabs) {
text[offset] = QLatin1Char(' ');
} else if (!tabarraylen && !tabstops) {
- tabstops = qRound(fm.width(QLatin1Char('x'))*8);
+ tabstops = qRound(fm.horizontalAdvance(QLatin1Char('x'))*8);
}
} else if (chr == QChar(ushort(0x9c))) {
// string with multiple length variants
diff --git a/src/gui/painting/qpainter.h b/src/gui/painting/qpainter.h
index 64d15d5296..12a9c720a8 100644
--- a/src/gui/painting/qpainter.h
+++ b/src/gui/painting/qpainter.h
@@ -416,9 +416,9 @@ public:
void drawText(const QPointF &p, const QString &str, int tf, int justificationPadding);
- void drawText(const QRectF &r, int flags, const QString &text, QRectF *br = Q_NULLPTR);
- void drawText(const QRect &r, int flags, const QString &text, QRect *br = Q_NULLPTR);
- inline void drawText(int x, int y, int w, int h, int flags, const QString &text, QRect *br = Q_NULLPTR);
+ void drawText(const QRectF &r, int flags, const QString &text, QRectF *br = nullptr);
+ void drawText(const QRect &r, int flags, const QString &text, QRect *br = nullptr);
+ inline void drawText(int x, int y, int w, int h, int flags, const QString &text, QRect *br = nullptr);
void drawText(const QRectF &r, const QString &text, const QTextOption &o = QTextOption());
@@ -461,7 +461,7 @@ public:
static void setRedirected(const QPaintDevice *device, QPaintDevice *replacement,
const QPoint& offset = QPoint());
- static QPaintDevice *redirected(const QPaintDevice *device, QPoint *offset = Q_NULLPTR);
+ static QPaintDevice *redirected(const QPaintDevice *device, QPoint *offset = nullptr);
static void restoreRedirected(const QPaintDevice *device);
void beginNativePainting();
diff --git a/src/gui/painting/qpdf_p.h b/src/gui/painting/qpdf_p.h
index f5bb4e17a8..5a909f2ede 100644
--- a/src/gui/painting/qpdf_p.h
+++ b/src/gui/painting/qpdf_p.h
@@ -186,28 +186,28 @@ public:
void setPdfVersion(PdfVersion version);
// reimplementations QPaintEngine
- bool begin(QPaintDevice *pdev) Q_DECL_OVERRIDE;
- bool end() Q_DECL_OVERRIDE;
+ bool begin(QPaintDevice *pdev) override;
+ bool end() override;
- void drawPoints(const QPointF *points, int pointCount) Q_DECL_OVERRIDE;
- void drawLines(const QLineF *lines, int lineCount) Q_DECL_OVERRIDE;
- void drawRects(const QRectF *rects, int rectCount) Q_DECL_OVERRIDE;
- void drawPolygon(const QPointF *points, int pointCount, PolygonDrawMode mode) Q_DECL_OVERRIDE;
- void drawPath (const QPainterPath & path) Q_DECL_OVERRIDE;
+ void drawPoints(const QPointF *points, int pointCount) override;
+ void drawLines(const QLineF *lines, int lineCount) override;
+ void drawRects(const QRectF *rects, int rectCount) override;
+ void drawPolygon(const QPointF *points, int pointCount, PolygonDrawMode mode) override;
+ void drawPath (const QPainterPath & path) override;
- void drawTextItem(const QPointF &p, const QTextItem &textItem) Q_DECL_OVERRIDE;
+ void drawTextItem(const QPointF &p, const QTextItem &textItem) override;
- void drawPixmap (const QRectF & rectangle, const QPixmap & pixmap, const QRectF & sr) Q_DECL_OVERRIDE;
+ void drawPixmap (const QRectF & rectangle, const QPixmap & pixmap, const QRectF & sr) override;
void drawImage(const QRectF &r, const QImage &pm, const QRectF &sr,
- Qt::ImageConversionFlags flags = Qt::AutoColor) Q_DECL_OVERRIDE;
- void drawTiledPixmap (const QRectF & rectangle, const QPixmap & pixmap, const QPointF & point) Q_DECL_OVERRIDE;
+ Qt::ImageConversionFlags flags = Qt::AutoColor) override;
+ void drawTiledPixmap (const QRectF & rectangle, const QPixmap & pixmap, const QPointF & point) override;
void drawHyperlink(const QRectF &r, const QUrl &url);
- void updateState(const QPaintEngineState &state) Q_DECL_OVERRIDE;
+ void updateState(const QPaintEngineState &state) override;
int metric(QPaintDevice::PaintDeviceMetric metricType) const;
- Type type() const Q_DECL_OVERRIDE;
+ Type type() const override;
// end reimplementations QPaintEngine
// Printer stuff...
diff --git a/src/gui/painting/qpdfwriter.cpp b/src/gui/painting/qpdfwriter.cpp
index 5af465edeb..2f24c7efcb 100644
--- a/src/gui/painting/qpdfwriter.cpp
+++ b/src/gui/painting/qpdfwriter.cpp
@@ -79,7 +79,7 @@ public:
virtual ~QPdfPagedPaintDevicePrivate()
{}
- bool setPageLayout(const QPageLayout &newPageLayout) Q_DECL_OVERRIDE
+ bool setPageLayout(const QPageLayout &newPageLayout) override
{
// Try to set the paint engine page layout
pd->engine->setPageLayout(newPageLayout);
@@ -88,7 +88,7 @@ public:
return m_pageLayout.isEquivalentTo(newPageLayout);
}
- bool setPageSize(const QPageSize &pageSize) Q_DECL_OVERRIDE
+ bool setPageSize(const QPageSize &pageSize) override
{
// Try to set the paint engine page size
pd->engine->setPageSize(pageSize);
@@ -97,7 +97,7 @@ public:
return m_pageLayout.pageSize().isEquivalentTo(pageSize);
}
- bool setPageOrientation(QPageLayout::Orientation orientation) Q_DECL_OVERRIDE
+ bool setPageOrientation(QPageLayout::Orientation orientation) override
{
// Set the print engine value
pd->engine->setPageOrientation(orientation);
@@ -106,12 +106,12 @@ public:
return m_pageLayout.orientation() == orientation;
}
- bool setPageMargins(const QMarginsF &margins) Q_DECL_OVERRIDE
+ bool setPageMargins(const QMarginsF &margins) override
{
return setPageMargins(margins, pageLayout().units());
}
- bool setPageMargins(const QMarginsF &margins, QPageLayout::Unit units) Q_DECL_OVERRIDE
+ bool setPageMargins(const QMarginsF &margins, QPageLayout::Unit units) override
{
// Try to set engine margins
pd->engine->setPageMargins(margins, units);
@@ -120,7 +120,7 @@ public:
return m_pageLayout.margins() == margins && m_pageLayout.units() == units;
}
- QPageLayout pageLayout() const Q_DECL_OVERRIDE
+ QPageLayout pageLayout() const override
{
return pd->engine->pageLayout();
}
diff --git a/src/gui/painting/qpen.h b/src/gui/painting/qpen.h
index d8d99ba800..03abfb3d7d 100644
--- a/src/gui/painting/qpen.h
+++ b/src/gui/painting/qpen.h
@@ -72,7 +72,7 @@ public:
QPen &operator=(const QPen &pen) Q_DECL_NOTHROW;
#ifdef Q_COMPILER_RVALUE_REFS
QPen(QPen &&other) Q_DECL_NOTHROW
- : d(other.d) { other.d = Q_NULLPTR; }
+ : d(other.d) { other.d = nullptr; }
QPen &operator=(QPen &&other) Q_DECL_NOTHROW
{ qSwap(d, other.d); return *this; }
#endif
diff --git a/src/gui/painting/qplatformbackingstore.cpp b/src/gui/painting/qplatformbackingstore.cpp
index 8ab22beb31..09c23fdfa1 100644
--- a/src/gui/painting/qplatformbackingstore.cpp
+++ b/src/gui/painting/qplatformbackingstore.cpp
@@ -704,7 +704,7 @@ void QPlatformBackingStore::endPaint()
*/
QPlatformGraphicsBuffer *QPlatformBackingStore::graphicsBuffer() const
{
- return Q_NULLPTR;
+ return nullptr;
}
/*!
diff --git a/src/gui/painting/qregion.cpp b/src/gui/painting/qregion.cpp
index 3fb6f925b3..40cffe7cc6 100644
--- a/src/gui/painting/qregion.cpp
+++ b/src/gui/painting/qregion.cpp
@@ -81,8 +81,9 @@ QT_BEGIN_NAMESPACE
contains() a QPoint or QRect. The bounding rectangle can be found
with boundingRect().
- Iteration over the region (with begin(), end()) gives a decomposition of
- the region into rectangles. The same sequence of rectangles is returned by rects().
+ Iteration over the region (with begin(), end(), or C++11
+ ranged-for loops) gives a decomposition of the region into
+ rectangles.
Example of using complex regions:
\snippet code/src_gui_painting_qregion.cpp 0
@@ -447,19 +448,20 @@ QDebug operator<<(QDebug s, const QRegion &r)
} else if (r.isEmpty()) {
s << "empty";
} else {
- const QVector<QRect> rects = r.rects();
- const int count = rects.size();
+ const int count = r.rectCount();
if (count > 1)
s << "size=" << count << ", bounds=(";
QtDebugUtils::formatQRect(s, r.boundingRect());
if (count > 1) {
s << ") - [";
- for (int i = 0; i < count; ++i) {
- if (i)
+ bool first = true;
+ for (const QRect &rect : r) {
+ if (!first)
s << ", ";
s << '(';
- QtDebugUtils::formatQRect(s, rects.at(i));
+ QtDebugUtils::formatQRect(s, rect);
s << ')';
+ first = false;
}
s << ']';
}
@@ -754,7 +756,8 @@ QRegion QRegion::intersect(const QRect &r) const
\fn int QRegion::rectCount() const
\since 4.6
- Returns the number of rectangles that will be returned in rects().
+ Returns the number of rectangles that this region is composed of.
+ Same as \c{end() - begin()}.
*/
/*!
@@ -916,20 +919,28 @@ QRegion QRegion::intersect(const QRect &r) const
gives a rectangle that is QRect::isNull().
*/
+#if QT_DEPRECATED_SINCE(5, 11)
/*!
\fn QVector<QRect> QRegion::rects() const
+ \obsolete
+
+ Use begin() and end() instead.
Returns an array of non-overlapping rectangles that make up the
region.
The union of all the rectangles is equal to the original region.
*/
+#endif
/*!
\typedef QRegion::const_iterator
\since 5.8
- An iterator over the QRects that make up the region.
+ An iterator over the non-overlapping rectangles that make up the
+ region.
+
+ The union of all the rectangles is equal to the original region.
QRegion does not offer mutable iterators.
@@ -940,7 +951,10 @@ QRegion QRegion::intersect(const QRect &r) const
\typedef QRegion::const_reverse_iterator
\since 5.8
- A reverse iterator over the QRects that make up the region.
+ A reverse iterator over the non-overlapping rectangles that make up the
+ region.
+
+ The union of all the rectangles is equal to the original region.
QRegion does not offer mutable iterators.
@@ -952,8 +966,9 @@ QRegion QRegion::intersect(const QRect &r) const
\since 5.8
Returns a const_iterator pointing to the beginning of the range of
- rectangles that make up this range, in the order in which rects()
- returns them.
+ non-overlapping rectangles that make up the region.
+
+ The union of all the rectangles is equal to the original region.
\sa rbegin(), cbegin(), end()
*/
@@ -969,9 +984,10 @@ QRegion QRegion::intersect(const QRect &r) const
\fn QRegion::end() const
\since 5.8
- Returns a const_iterator pointing to one past the end of the range of
- rectangles that make up this range, in the order in which rects()
- returns them.
+ Returns a const_iterator pointing to one past the end of
+ non-overlapping rectangles that make up the region.
+
+ The union of all the rectangles is equal to the original region.
\sa rend(), cend(), begin()
*/
@@ -987,9 +1003,10 @@ QRegion QRegion::intersect(const QRect &r) const
\fn QRegion::rbegin() const
\since 5.8
- Returns a const_reverse_iterator pointing to the beginning of the range of
- rectangles that make up this range, in the reverse order in which rects()
- returns them.
+ Returns a const_reverse_iterator pointing to the beginning of the
+ range of non-overlapping rectangles that make up the region.
+
+ The union of all the rectangles is equal to the original region.
\sa begin(), crbegin(), rend()
*/
@@ -1005,9 +1022,10 @@ QRegion QRegion::intersect(const QRect &r) const
\fn QRegion::rend() const
\since 5.8
- Returns a const_reverse_iterator pointing to one past the end of the range of
- rectangles that make up this range, in the reverse order in which rects()
- returns them.
+ Returns a const_reverse_iterator pointing to one past the end of
+ the range of non-overlapping rectangles that make up the region.
+
+ The union of all the rectangles is equal to the original region.
\sa end(), crend(), rbegin()
*/
@@ -2281,7 +2299,14 @@ static void miRegionOp(QRegionPrivate &dest,
dest.vectorize();
- QVector<QRect> oldRects = dest.rects;
+ /*
+ * The following calls are going to detach dest.rects. Since dest might be
+ * aliasing *reg1 and/or *reg2, and we could have active iterators on
+ * reg1->rects and reg2->rects (if the regions have more than 1 rectangle),
+ * take a copy of dest.rects to keep those iteractors valid.
+ */
+ const QVector<QRect> destRectsCopy = dest.rects;
+ Q_UNUSED(destRectsCopy);
dest.numRects = 0;
@@ -3613,7 +3638,7 @@ static void PtsToRegion(int numFullPtBlocks, int iCurPtBlock,
}
if (rowSize) {
- QPoint *next = i ? &pts[2] : (numFullPtBlocks && iCurPtBlock ? CurPtBlock->next->pts : Q_NULLPTR);
+ QPoint *next = i ? &pts[2] : (numFullPtBlocks && iCurPtBlock ? CurPtBlock->next->pts : nullptr);
if (!next || next->y() != pts[0].y()) {
flushRow(row.data(), pts[0].y(), rowSize, reg, &lastRow, &extendTo, &needsExtend);
@@ -4340,6 +4365,7 @@ bool qt_region_strictContains(const QRegion &region, const QRect &rect)
&& rect.top() >= r1.top() && rect.bottom() <= r1.bottom());
}
+#if QT_DEPRECATED_SINCE(5, 11)
QVector<QRect> QRegion::rects() const
{
if (d->qt_rgn) {
@@ -4351,6 +4377,7 @@ QVector<QRect> QRegion::rects() const
return QVector<QRect>();
}
}
+#endif
QRegion::const_iterator QRegion::begin() const Q_DECL_NOTHROW
{
diff --git a/src/gui/painting/qregion.h b/src/gui/painting/qregion.h
index 8dd7649447..9fe6ed5675 100644
--- a/src/gui/painting/qregion.h
+++ b/src/gui/painting/qregion.h
@@ -122,7 +122,10 @@ public:
bool intersects(const QRect &r) const;
QRect boundingRect() const Q_DECL_NOTHROW;
+#if QT_DEPRECATED_SINCE(5, 11)
+ QT_DEPRECATED_X("Use begin()/end() instead")
QVector<QRect> rects() const;
+#endif
void setRects(const QRect *rect, int num);
int rectCount() const Q_DECL_NOTHROW;
#ifdef Q_COMPILER_MANGLES_RETURN_TYPE
diff --git a/src/gui/painting/qt_mips_asm_dsp_p.h b/src/gui/painting/qt_mips_asm_dsp_p.h
index 1393a35667..172910ea1c 100644
--- a/src/gui/painting/qt_mips_asm_dsp_p.h
+++ b/src/gui/painting/qt_mips_asm_dsp_p.h
@@ -55,6 +55,7 @@
#pragma qt_sync_stop_processing
#endif
+#ifndef Q_CLANG_QDOC
#define zero $0
#define AT $1
#define v0 $2
@@ -88,6 +89,7 @@
#define fp $30
#define s8 $30
#define ra $31
+#endif
/*
* LEAF_MIPS32R2 - declare leaf_mips32r2 routine
diff --git a/src/gui/painting/qtextureglyphcache_p.h b/src/gui/painting/qtextureglyphcache_p.h
index 25253b496a..3da28872b1 100644
--- a/src/gui/painting/qtextureglyphcache_p.h
+++ b/src/gui/painting/qtextureglyphcache_p.h
@@ -169,9 +169,9 @@ public:
: QTextureGlyphCache(format, matrix) { }
~QImageTextureGlyphCache();
- virtual void createTextureData(int width, int height) Q_DECL_OVERRIDE;
- virtual void resizeTextureData(int width, int height) Q_DECL_OVERRIDE;
- virtual void fillTexture(const Coord &c, glyph_t glyph, QFixed subPixelPosition) Q_DECL_OVERRIDE;
+ virtual void createTextureData(int width, int height) override;
+ virtual void resizeTextureData(int width, int height) override;
+ virtual void fillTexture(const Coord &c, glyph_t glyph, QFixed subPixelPosition) override;
inline const QImage &image() const { return m_image; }
diff --git a/src/gui/painting/qtransform.cpp b/src/gui/painting/qtransform.cpp
index 7f06915444..7a53c44bc4 100644
--- a/src/gui/painting/qtransform.cpp
+++ b/src/gui/painting/qtransform.cpp
@@ -265,7 +265,7 @@ QTransform::QTransform()
, m_13(0), m_23(0), m_33(1)
, m_type(TxNone)
, m_dirty(TxNone)
- , d(Q_NULLPTR)
+ , d(nullptr)
{
}
@@ -284,7 +284,7 @@ QTransform::QTransform(qreal h11, qreal h12, qreal h13,
, m_13(h13), m_23(h23), m_33(h33)
, m_type(TxNone)
, m_dirty(TxProject)
- , d(Q_NULLPTR)
+ , d(nullptr)
{
}
@@ -301,7 +301,7 @@ QTransform::QTransform(qreal h11, qreal h12, qreal h21,
, m_13(0), m_23(0), m_33(1)
, m_type(TxNone)
, m_dirty(TxShear)
- , d(Q_NULLPTR)
+ , d(nullptr)
{
}
@@ -317,7 +317,7 @@ QTransform::QTransform(const QMatrix &mtx)
m_13(0), m_23(0), m_33(1)
, m_type(TxNone)
, m_dirty(TxShear)
- , d(Q_NULLPTR)
+ , d(nullptr)
{
}
diff --git a/src/gui/painting/qtransform.h b/src/gui/painting/qtransform.h
index 06ae611861..79835b36e2 100644
--- a/src/gui/painting/qtransform.h
+++ b/src/gui/painting/qtransform.h
@@ -116,7 +116,7 @@ public:
qreal m21, qreal m22, qreal m23,
qreal m31, qreal m32, qreal m33);
- Q_REQUIRED_RESULT QTransform inverted(bool *invertible = Q_NULLPTR) const;
+ Q_REQUIRED_RESULT QTransform inverted(bool *invertible = nullptr) const;
Q_REQUIRED_RESULT QTransform adjoint() const;
Q_REQUIRED_RESULT QTransform transposed() const;
@@ -173,7 +173,7 @@ private:
, m_13(h13), m_23(h23), m_33(h33)
, m_type(TxNone)
, m_dirty(TxProject)
- , d(Q_NULLPTR)
+ , d(nullptr)
{
}
inline QTransform(bool)
@@ -181,7 +181,7 @@ private:
, m_13(0), m_23(0), m_33(1)
, m_type(TxNone)
, m_dirty(TxNone)
- , d(Q_NULLPTR)
+ , d(nullptr)
{
}
inline TransformationType inline_type() const;
diff --git a/src/gui/text/qabstracttextdocumentlayout.h b/src/gui/text/qabstracttextdocumentlayout.h
index 438ad6e70b..8fea27f772 100644
--- a/src/gui/text/qabstracttextdocumentlayout.h
+++ b/src/gui/text/qabstracttextdocumentlayout.h
@@ -100,7 +100,7 @@ public:
QTextDocument *document() const;
void registerHandler(int objectType, QObject *component);
- void unregisterHandler(int objectType, QObject *component = Q_NULLPTR);
+ void unregisterHandler(int objectType, QObject *component = nullptr);
QTextObjectInterface *handlerForObject(int objectType) const;
Q_SIGNALS:
diff --git a/src/gui/text/qfont.cpp b/src/gui/text/qfont.cpp
index 438cd3de3a..220e89a0c4 100644
--- a/src/gui/text/qfont.cpp
+++ b/src/gui/text/qfont.cpp
@@ -2849,7 +2849,7 @@ QFontEngine *QFontCache::findEngine(const Key &key)
end = engineCache.end();
if (it == end) return 0;
- Q_ASSERT(it.value().data != Q_NULLPTR);
+ Q_ASSERT(it.value().data != nullptr);
Q_ASSERT(key.multi == (it.value().data->type() == QFontEngine::Multi));
// found... update the hitcount and timestamp
@@ -2872,7 +2872,7 @@ void QFontCache::updateHitCountAndTimeStamp(Engine &value)
void QFontCache::insertEngine(const Key &key, QFontEngine *engine, bool insertMulti)
{
- Q_ASSERT(engine != Q_NULLPTR);
+ Q_ASSERT(engine != nullptr);
Q_ASSERT(key.multi == (engine->type() == QFontEngine::Multi));
#ifdef QFONTCACHE_DEBUG
diff --git a/src/gui/text/qfont_p.h b/src/gui/text/qfont_p.h
index 9e5d0b4329..350ba7ce3c 100644
--- a/src/gui/text/qfont_p.h
+++ b/src/gui/text/qfont_p.h
@@ -282,7 +282,7 @@ public:
private:
void increaseCost(uint cost);
void decreaseCost(uint cost);
- void timerEvent(QTimerEvent *event) Q_DECL_OVERRIDE;
+ void timerEvent(QTimerEvent *event) override;
void decreaseCache();
static const uint min_cost;
diff --git a/src/gui/text/qfontdatabase.cpp b/src/gui/text/qfontdatabase.cpp
index 2cc071d67b..afbf783c3a 100644
--- a/src/gui/text/qfontdatabase.cpp
+++ b/src/gui/text/qfontdatabase.cpp
@@ -2685,7 +2685,15 @@ QFontEngine *QFontDatabase::findFont(const QFontDef &request, int script)
index = match(multi ? QChar::Script_Common : script, request, family_name, foundry_name, &desc, blackListed);
}
if (index >= 0) {
- engine = loadEngine(script, request, desc.family, desc.foundry, desc.style, desc.size);
+ QFontDef fontDef = request;
+
+ // Don't pass empty family names to the platform font database, since it will then invoke its own matching
+ // and we will be out of sync with the matched font.
+ if (fontDef.family.isEmpty())
+ fontDef.family = desc.family->name;
+
+ engine = loadEngine(script, fontDef, desc.family, desc.foundry, desc.style, desc.size);
+
if (engine)
initFontDef(desc, request, &engine->fontDef, multi);
else
@@ -2775,7 +2783,7 @@ void QFontDatabase::load(const QFontPrivate *d, int script)
if (d->engineData->engines[script])
return;
- QFontEngine *fe = Q_NULLPTR;
+ QFontEngine *fe = nullptr;
req.fallBackFamilies = fallBackFamilies;
if (!req.fallBackFamilies.isEmpty())
diff --git a/src/gui/text/qfontengine.cpp b/src/gui/text/qfontengine.cpp
index e4f9b8b9d4..5be8745b15 100644
--- a/src/gui/text/qfontengine.cpp
+++ b/src/gui/text/qfontengine.cpp
@@ -1080,7 +1080,7 @@ QFontEngineGlyphCache *QFontEngine::glyphCache(const void *context, GlyphFormat
{
const QHash<const void*, GlyphCaches>::const_iterator caches = m_glyphCaches.constFind(context);
if (caches == m_glyphCaches.cend())
- return Q_NULLPTR;
+ return nullptr;
for (GlyphCaches::const_iterator it = caches->begin(), end = caches->end(); it != end; ++it) {
QFontEngineGlyphCache *cache = it->cache.data();
@@ -1088,7 +1088,7 @@ QFontEngineGlyphCache *QFontEngine::glyphCache(const void *context, GlyphFormat
return cache;
}
- return Q_NULLPTR;
+ return nullptr;
}
static inline QFixed kerning(int left, int right, const QFontEngine::KernPair *pairs, int numPairs)
@@ -1234,7 +1234,7 @@ int QFontEngine::glyphCount() const
Qt::HANDLE QFontEngine::handle() const
{
- return Q_NULLPTR;
+ return nullptr;
}
const uchar *QFontEngine::getCMap(const uchar *table, uint tableSize, bool *isSymbolFont, int *cmapSize)
diff --git a/src/gui/text/qfontengine_p.h b/src/gui/text/qfontengine_p.h
index 1ae2e86a93..a411e9ce4c 100644
--- a/src/gui/text/qfontengine_p.h
+++ b/src/gui/text/qfontengine_p.h
@@ -411,27 +411,27 @@ public:
QFontEngineBox(int size);
~QFontEngineBox();
- virtual glyph_t glyphIndex(uint ucs4) const Q_DECL_OVERRIDE;
- virtual bool stringToCMap(const QChar *str, int len, QGlyphLayout *glyphs, int *nglyphs, ShaperFlags flags) const Q_DECL_OVERRIDE;
- virtual void recalcAdvances(QGlyphLayout *, ShaperFlags) const Q_DECL_OVERRIDE;
+ virtual glyph_t glyphIndex(uint ucs4) const override;
+ virtual bool stringToCMap(const QChar *str, int len, QGlyphLayout *glyphs, int *nglyphs, ShaperFlags flags) const override;
+ virtual void recalcAdvances(QGlyphLayout *, ShaperFlags) const override;
void draw(QPaintEngine *p, qreal x, qreal y, const QTextItemInt &si);
- virtual void addOutlineToPath(qreal x, qreal y, const QGlyphLayout &glyphs, QPainterPath *path, QTextItem::RenderFlags flags) Q_DECL_OVERRIDE;
+ virtual void addOutlineToPath(qreal x, qreal y, const QGlyphLayout &glyphs, QPainterPath *path, QTextItem::RenderFlags flags) override;
- virtual glyph_metrics_t boundingBox(const QGlyphLayout &glyphs) Q_DECL_OVERRIDE;
- virtual glyph_metrics_t boundingBox(glyph_t glyph) Q_DECL_OVERRIDE;
- virtual QFontEngine *cloneWithSize(qreal pixelSize) const Q_DECL_OVERRIDE;
+ virtual glyph_metrics_t boundingBox(const QGlyphLayout &glyphs) override;
+ virtual glyph_metrics_t boundingBox(glyph_t glyph) override;
+ virtual QFontEngine *cloneWithSize(qreal pixelSize) const override;
- virtual QFixed ascent() const Q_DECL_OVERRIDE;
- virtual QFixed capHeight() const Q_DECL_OVERRIDE;
- virtual QFixed descent() const Q_DECL_OVERRIDE;
- virtual QFixed leading() const Q_DECL_OVERRIDE;
- virtual qreal maxCharWidth() const Q_DECL_OVERRIDE;
- virtual qreal minLeftBearing() const Q_DECL_OVERRIDE { return 0; }
- virtual qreal minRightBearing() const Q_DECL_OVERRIDE { return 0; }
- virtual QImage alphaMapForGlyph(glyph_t) Q_DECL_OVERRIDE;
+ virtual QFixed ascent() const override;
+ virtual QFixed capHeight() const override;
+ virtual QFixed descent() const override;
+ virtual QFixed leading() const override;
+ virtual qreal maxCharWidth() const override;
+ virtual qreal minLeftBearing() const override { return 0; }
+ virtual qreal minRightBearing() const override { return 0; }
+ virtual QImage alphaMapForGlyph(glyph_t) override;
- virtual bool canRender(const QChar *string, int len) const Q_DECL_OVERRIDE;
+ virtual bool canRender(const QChar *string, int len) const override;
inline int size() const { return _size; }
@@ -449,36 +449,36 @@ public:
explicit QFontEngineMulti(QFontEngine *engine, int script, const QStringList &fallbackFamilies = QStringList());
~QFontEngineMulti();
- virtual glyph_t glyphIndex(uint ucs4) const Q_DECL_OVERRIDE;
- virtual bool stringToCMap(const QChar *str, int len, QGlyphLayout *glyphs, int *nglyphs, ShaperFlags flags) const Q_DECL_OVERRIDE;
-
- virtual glyph_metrics_t boundingBox(const QGlyphLayout &glyphs) Q_DECL_OVERRIDE;
- virtual glyph_metrics_t boundingBox(glyph_t glyph) Q_DECL_OVERRIDE;
-
- virtual void recalcAdvances(QGlyphLayout *, ShaperFlags) const Q_DECL_OVERRIDE;
- virtual void doKerning(QGlyphLayout *, ShaperFlags) const Q_DECL_OVERRIDE;
- virtual void addOutlineToPath(qreal, qreal, const QGlyphLayout &, QPainterPath *, QTextItem::RenderFlags flags) Q_DECL_OVERRIDE;
- virtual void getGlyphBearings(glyph_t glyph, qreal *leftBearing = 0, qreal *rightBearing = 0) Q_DECL_OVERRIDE;
-
- virtual QFixed ascent() const Q_DECL_OVERRIDE;
- virtual QFixed capHeight() const Q_DECL_OVERRIDE;
- virtual QFixed descent() const Q_DECL_OVERRIDE;
- virtual QFixed leading() const Q_DECL_OVERRIDE;
- virtual QFixed xHeight() const Q_DECL_OVERRIDE;
- virtual QFixed averageCharWidth() const Q_DECL_OVERRIDE;
- virtual QImage alphaMapForGlyph(glyph_t) Q_DECL_OVERRIDE;
- virtual QImage alphaMapForGlyph(glyph_t glyph, QFixed subPixelPosition) Q_DECL_OVERRIDE;
- virtual QImage alphaMapForGlyph(glyph_t, const QTransform &t) Q_DECL_OVERRIDE;
- virtual QImage alphaMapForGlyph(glyph_t, QFixed subPixelPosition, const QTransform &t) Q_DECL_OVERRIDE;
- virtual QImage alphaRGBMapForGlyph(glyph_t, QFixed subPixelPosition, const QTransform &t) Q_DECL_OVERRIDE;
-
- virtual QFixed lineThickness() const Q_DECL_OVERRIDE;
- virtual QFixed underlinePosition() const Q_DECL_OVERRIDE;
- virtual qreal maxCharWidth() const Q_DECL_OVERRIDE;
- virtual qreal minLeftBearing() const Q_DECL_OVERRIDE;
- virtual qreal minRightBearing() const Q_DECL_OVERRIDE;
-
- virtual bool canRender(const QChar *string, int len) const Q_DECL_OVERRIDE;
+ virtual glyph_t glyphIndex(uint ucs4) const override;
+ virtual bool stringToCMap(const QChar *str, int len, QGlyphLayout *glyphs, int *nglyphs, ShaperFlags flags) const override;
+
+ virtual glyph_metrics_t boundingBox(const QGlyphLayout &glyphs) override;
+ virtual glyph_metrics_t boundingBox(glyph_t glyph) override;
+
+ virtual void recalcAdvances(QGlyphLayout *, ShaperFlags) const override;
+ virtual void doKerning(QGlyphLayout *, ShaperFlags) const override;
+ virtual void addOutlineToPath(qreal, qreal, const QGlyphLayout &, QPainterPath *, QTextItem::RenderFlags flags) override;
+ virtual void getGlyphBearings(glyph_t glyph, qreal *leftBearing = 0, qreal *rightBearing = 0) override;
+
+ virtual QFixed ascent() const override;
+ virtual QFixed capHeight() const override;
+ virtual QFixed descent() const override;
+ virtual QFixed leading() const override;
+ virtual QFixed xHeight() const override;
+ virtual QFixed averageCharWidth() const override;
+ virtual QImage alphaMapForGlyph(glyph_t) override;
+ virtual QImage alphaMapForGlyph(glyph_t glyph, QFixed subPixelPosition) override;
+ virtual QImage alphaMapForGlyph(glyph_t, const QTransform &t) override;
+ virtual QImage alphaMapForGlyph(glyph_t, QFixed subPixelPosition, const QTransform &t) override;
+ virtual QImage alphaRGBMapForGlyph(glyph_t, QFixed subPixelPosition, const QTransform &t) override;
+
+ virtual QFixed lineThickness() const override;
+ virtual QFixed underlinePosition() const override;
+ virtual qreal maxCharWidth() const override;
+ virtual qreal minLeftBearing() const override;
+ virtual qreal minRightBearing() const override;
+
+ virtual bool canRender(const QChar *string, int len) const override;
inline int fallbackFamilyCount() const { return m_fallbackFamilies.size(); }
inline QString fallbackFamilyAt(int at) const { return m_fallbackFamilies.at(at); }
diff --git a/src/gui/text/qfontengine_qpf2_p.h b/src/gui/text/qfontengine_qpf2_p.h
index e5c38ffbaf..b2dc620ad1 100644
--- a/src/gui/text/qfontengine_qpf2_p.h
+++ b/src/gui/text/qfontengine_qpf2_p.h
@@ -158,30 +158,30 @@ public:
QFontEngineQPF2(const QFontDef &def, const QByteArray &data);
~QFontEngineQPF2();
- FaceId faceId() const Q_DECL_OVERRIDE { return face_id; }
- bool getSfntTableData(uint tag, uchar *buffer, uint *length) const Q_DECL_OVERRIDE;
-
- virtual glyph_t glyphIndex(uint ucs4) const Q_DECL_OVERRIDE;
- bool stringToCMap(const QChar *str, int len, QGlyphLayout *glyphs, int *nglyphs, ShaperFlags flags) const Q_DECL_OVERRIDE;
- void recalcAdvances(QGlyphLayout *, ShaperFlags) const Q_DECL_OVERRIDE;
-
- void addOutlineToPath(qreal x, qreal y, const QGlyphLayout &glyphs, QPainterPath *path, QTextItem::RenderFlags flags) Q_DECL_OVERRIDE;
- QImage alphaMapForGlyph(glyph_t t) Q_DECL_OVERRIDE;
-
- glyph_metrics_t boundingBox(const QGlyphLayout &glyphs) Q_DECL_OVERRIDE;
- glyph_metrics_t boundingBox(glyph_t glyph) Q_DECL_OVERRIDE;
-
- QFixed ascent() const Q_DECL_OVERRIDE;
- QFixed capHeight() const Q_DECL_OVERRIDE;
- QFixed descent() const Q_DECL_OVERRIDE;
- QFixed leading() const Q_DECL_OVERRIDE;
- qreal maxCharWidth() const Q_DECL_OVERRIDE;
- qreal minLeftBearing() const Q_DECL_OVERRIDE;
- qreal minRightBearing() const Q_DECL_OVERRIDE;
- QFixed underlinePosition() const Q_DECL_OVERRIDE;
- QFixed lineThickness() const Q_DECL_OVERRIDE;
-
- virtual int glyphCount() const Q_DECL_OVERRIDE { return glyphMapEntries; }
+ FaceId faceId() const override { return face_id; }
+ bool getSfntTableData(uint tag, uchar *buffer, uint *length) const override;
+
+ virtual glyph_t glyphIndex(uint ucs4) const override;
+ bool stringToCMap(const QChar *str, int len, QGlyphLayout *glyphs, int *nglyphs, ShaperFlags flags) const override;
+ void recalcAdvances(QGlyphLayout *, ShaperFlags) const override;
+
+ void addOutlineToPath(qreal x, qreal y, const QGlyphLayout &glyphs, QPainterPath *path, QTextItem::RenderFlags flags) override;
+ QImage alphaMapForGlyph(glyph_t t) override;
+
+ glyph_metrics_t boundingBox(const QGlyphLayout &glyphs) override;
+ glyph_metrics_t boundingBox(glyph_t glyph) override;
+
+ QFixed ascent() const override;
+ QFixed capHeight() const override;
+ QFixed descent() const override;
+ QFixed leading() const override;
+ qreal maxCharWidth() const override;
+ qreal minLeftBearing() const override;
+ qreal minRightBearing() const override;
+ QFixed underlinePosition() const override;
+ QFixed lineThickness() const override;
+
+ virtual int glyphCount() const override { return glyphMapEntries; }
bool isValid() const;
diff --git a/src/gui/text/qfontmetrics.cpp b/src/gui/text/qfontmetrics.cpp
index 5675d6921d..5ad57b064b 100644
--- a/src/gui/text/qfontmetrics.cpp
+++ b/src/gui/text/qfontmetrics.cpp
@@ -510,6 +510,7 @@ int QFontMetrics::rightBearing(QChar ch) const
return qRound(rb);
}
+#if QT_DEPRECATED_SINCE(5, 11)
/*!
Returns the width in pixels of the first \a len characters of \a
text. If \a len is negative (the default), the entire string is
@@ -520,11 +521,13 @@ int QFontMetrics::rightBearing(QChar ch) const
string will cover whereas width() returns the distance to where
the next string should be drawn.
+ \deprecated in Qt 5.11. Use horizontalAdvance() instead.
+
\sa boundingRect()
*/
int QFontMetrics::width(const QString &text, int len) const
{
- return width(text, len, 0);
+ return horizontalAdvance(text, len);
}
/*!
@@ -532,17 +535,17 @@ int QFontMetrics::width(const QString &text, int len) const
*/
int QFontMetrics::width(const QString &text, int len, int flags) const
{
- int pos = text.indexOf(QLatin1Char('\x9c'));
- if (pos != -1) {
- len = (len < 0) ? pos : qMin(pos, len);
- } else if (len < 0) {
- len = text.length();
- }
- if (len == 0)
- return 0;
-
-#if QT_VERSION < QT_VERSION_CHECK(6, 0, 0)
+#if QT_DEPRECATED_SINCE(5, 11) && QT_VERSION < QT_VERSION_CHECK(6, 0, 0)
if (flags & Qt::TextBypassShaping) {
+ int pos = text.indexOf(QLatin1Char('\x9c'));
+ if (pos != -1) {
+ len = (len < 0) ? pos : qMin(pos, len);
+ } else if (len < 0) {
+ len = text.length();
+ }
+ if (len == 0)
+ return 0;
+
// Skip complex shaping, only use advances
int numGlyphs = len;
QVarLengthGlyphLayoutArray glyphs(numGlyphs);
@@ -555,10 +558,11 @@ int QFontMetrics::width(const QString &text, int len, int flags) const
width += glyphs.advances[i];
return qRound(width);
}
+#else
+ Q_UNUSED(flags)
#endif
- QStackTextEngine layout(text, QFont(d.data()));
- return qRound(layout.width(0, len));
+ return horizontalAdvance(text, len);
}
/*!
@@ -577,6 +581,8 @@ int QFontMetrics::width(const QString &text, int len, int flags) const
in this particular font are both negative, while the bearings of
"o" are both positive.
+ \deprecated in Qt 5.11. Use horizontalAdvance() instead.
+
\warning This function will produce incorrect results for Arabic
characters or non-spacing marks in the middle of a string, as the
glyph shaping and positioning of marks that happens when
@@ -587,6 +593,65 @@ int QFontMetrics::width(const QString &text, int len, int flags) const
*/
int QFontMetrics::width(QChar ch) const
{
+ return horizontalAdvance(ch);
+}
+#endif // QT_DEPRECATED_SINCE(5, 11)
+
+/*!
+ Returns the horizontal advance in pixels of the first \a len characters of \a
+ text. If \a len is negative (the default), the entire string is
+ used.
+
+ This is the distance appropriate for drawing a subsequent character
+ after \a text.
+
+ \since 5.11
+
+ \sa boundingRect()
+*/
+int QFontMetrics::horizontalAdvance(const QString &text, int len) const
+{
+ int pos = text.indexOf(QLatin1Char('\x9c'));
+ if (pos != -1) {
+ len = (len < 0) ? pos : qMin(pos, len);
+ } else if (len < 0) {
+ len = text.length();
+ }
+ if (len == 0)
+ return 0;
+
+ QStackTextEngine layout(text, QFont(d.data()));
+ return qRound(layout.width(0, len));
+}
+
+/*!
+ \overload
+
+ \image bearings.png Bearings
+
+ Returns the horizontal advance of character \a ch in pixels. This is a
+ distance appropriate for drawing a subsequent character after \a
+ ch.
+
+ Some of the metrics are described in the image. The
+ central dark rectangles cover the logical horizontalAdvance() of each
+ character. The outer pale rectangles cover the leftBearing() and
+ rightBearing() of each character. Notice that the bearings of "f"
+ in this particular font are both negative, while the bearings of
+ "o" are both positive.
+
+ \warning This function will produce incorrect results for Arabic
+ characters or non-spacing marks in the middle of a string, as the
+ glyph shaping and positioning of marks that happens when
+ processing strings cannot be taken into account. When implementing
+ an interactive text control, use QTextLayout instead.
+
+ \since 5.11
+
+ \sa boundingRect()
+*/
+int QFontMetrics::horizontalAdvance(QChar ch) const
+{
if (QChar::category(ch.unicode()) == QChar::Mark_NonSpacing)
return 0;
@@ -677,7 +742,7 @@ int QFontMetrics::charWidth(const QString &text, int pos) const
rectangle might be different than what the width() method returns.
If you want to know the advance width of the string (to lay out
- a set of strings next to each other), use width() instead.
+ a set of strings next to each other), use horizontalAdvance() instead.
Newline characters are processed as normal characters, \e not as
linebreaks.
@@ -711,7 +776,7 @@ QRect QFontMetrics::boundingRect(const QString &text) const
base line.
\warning The width of the returned rectangle is not the advance width
- of the character. Use boundingRect(const QString &) or width() instead.
+ of the character. Use boundingRect(const QString &) or horizontalAdvance() instead.
\sa width()
*/
@@ -846,7 +911,7 @@ QSize QFontMetrics::size(int flags, const QString &text, int tabStops, int *tabA
rectangle might be different than what the width() method returns.
If you want to know the advance width of the string (to lay out
- a set of strings next to each other), use width() instead.
+ a set of strings next to each other), use horizontalAdvance() instead.
Newline characters are processed as normal characters, \e not as
linebreaks.
@@ -1396,6 +1461,7 @@ qreal QFontMetricsF::rightBearing(QChar ch) const
}
+#if QT_DEPRECATED_SINCE(5, 11)
/*!
Returns the width in pixels of the characters in the given \a text.
@@ -1404,16 +1470,73 @@ qreal QFontMetricsF::rightBearing(QChar ch) const
describing the pixels this string will cover whereas width()
returns the distance to where the next string should be drawn.
+ \deprecated in Qt 5.11. Use horizontalAdvance() instead.
+
\sa boundingRect()
*/
qreal QFontMetricsF::width(const QString &text) const
{
+ return horizontalAdvance(text);
+}
+
+/*!
+ \overload
+
+ \image bearings.png Bearings
+
+ Returns the logical width of character \a ch in pixels. This is a
+ distance appropriate for drawing a subsequent character after \a
+ ch.
+
+ Some of the metrics are described in the image to the right. The
+ central dark rectangles cover the logical width() of each
+ character. The outer pale rectangles cover the leftBearing() and
+ rightBearing() of each character. Notice that the bearings of "f"
+ in this particular font are both negative, while the bearings of
+ "o" are both positive.
+
+ \deprecated in Qt 5.11. Use horizontalAdvance() instead.
+
+ \warning This function will produce incorrect results for Arabic
+ characters or non-spacing marks in the middle of a string, as the
+ glyph shaping and positioning of marks that happens when
+ processing strings cannot be taken into account. When implementing
+ an interactive text control, use QTextLayout instead.
+
+ \sa boundingRect()
+*/
+qreal QFontMetricsF::width(QChar ch) const
+{
+ return horizontalAdvance(ch);
+}
+#endif
+
+/*!
+ Returns the horizontal advance in pixels of the first \a length characters of \a
+ text. If \a length is negative (the default), the entire string is
+ used.
+
+ The advance is the distance appropriate for drawing a subsequent
+ character after \a text.
+
+ \since 5.11
+
+ \sa boundingRect()
+*/
+qreal QFontMetricsF::horizontalAdvance(const QString &text, int length) const
+{
int pos = text.indexOf(QLatin1Char('\x9c'));
- int len = (pos != -1) ? pos : text.length();
+ if (pos != -1)
+ length = (length < 0) ? pos : qMin(pos, length);
+ else if (length < 0)
+ length = text.length();
+
+ if (length == 0)
+ return 0;
QStackTextEngine layout(text, QFont(d.data()));
layout.itemize();
- return layout.width(0, len).toReal();
+ return layout.width(0, length).toReal();
}
/*!
@@ -1421,7 +1544,7 @@ qreal QFontMetricsF::width(const QString &text) const
\image bearings.png Bearings
- Returns the logical width of character \a ch in pixels. This is a
+ Returns the horizontal advance of character \a ch in pixels. This is a
distance appropriate for drawing a subsequent character after \a
ch.
@@ -1438,9 +1561,11 @@ qreal QFontMetricsF::width(const QString &text) const
processing strings cannot be taken into account. When implementing
an interactive text control, use QTextLayout instead.
+ \since 5.11
+
\sa boundingRect()
*/
-qreal QFontMetricsF::width(QChar ch) const
+qreal QFontMetricsF::horizontalAdvance(QChar ch) const
{
if (ch.category() == QChar::Mark_NonSpacing)
return 0.;
@@ -1467,6 +1592,7 @@ qreal QFontMetricsF::width(QChar ch) const
return advance.toReal();
}
+
/*!
Returns the bounding rectangle of the characters in the string
specified by \a text. The bounding rectangle always covers at least
@@ -1477,7 +1603,7 @@ qreal QFontMetricsF::width(QChar ch) const
rectangle might be different than what the width() method returns.
If you want to know the advance width of the string (to lay out
- a set of strings next to each other), use width() instead.
+ a set of strings next to each other), use horizontalAdvance() instead.
Newline characters are processed as normal characters, \e not as
linebreaks.
@@ -1650,7 +1776,7 @@ QSizeF QFontMetricsF::size(int flags, const QString &text, int tabStops, int *ta
rectangle might be different than what the width() method returns.
If you want to know the advance width of the string (to lay out
- a set of strings next to each other), use width() instead.
+ a set of strings next to each other), use horizontalAdvance() instead.
Newline characters are processed as normal characters, \e not as
linebreaks.
diff --git a/src/gui/text/qfontmetrics.h b/src/gui/text/qfontmetrics.h
index 3eac309092..b6167a1d47 100644
--- a/src/gui/text/qfontmetrics.h
+++ b/src/gui/text/qfontmetrics.h
@@ -90,10 +90,16 @@ public:
int leftBearing(QChar) const;
int rightBearing(QChar) const;
+
+#if QT_DEPRECATED_SINCE(5, 11)
int width(const QString &, int len = -1) const;
int width(const QString &, int len, int flags) const;
-
int width(QChar) const;
+#endif
+
+ int horizontalAdvance(const QString &, int len = -1) const;
+ int horizontalAdvance(QChar) const;
+
#if QT_VERSION < QT_VERSION_CHECK(6,0,0)
QT_DEPRECATED int charWidth(const QString &str, int pos) const;
#endif
@@ -101,11 +107,11 @@ public:
QRect boundingRect(QChar) const;
QRect boundingRect(const QString &text) const;
- QRect boundingRect(const QRect &r, int flags, const QString &text, int tabstops = 0, int *tabarray = Q_NULLPTR) const;
+ QRect boundingRect(const QRect &r, int flags, const QString &text, int tabstops = 0, int *tabarray = nullptr) const;
inline QRect boundingRect(int x, int y, int w, int h, int flags, const QString &text,
- int tabstops = 0, int *tabarray = Q_NULLPTR) const
+ int tabstops = 0, int *tabarray = nullptr) const
{ return boundingRect(QRect(x, y, w, h), flags, text, tabstops, tabarray); }
- QSize size(int flags, const QString& str, int tabstops = 0, int *tabarray = Q_NULLPTR) const;
+ QSize size(int flags, const QString& str, int tabstops = 0, int *tabarray = nullptr) const;
QRect tightBoundingRect(const QString &text) const;
@@ -164,14 +170,19 @@ public:
qreal leftBearing(QChar) const;
qreal rightBearing(QChar) const;
- qreal width(const QString &string) const;
+#if QT_DEPRECATED_SINCE(5, 11)
+ qreal width(const QString &string) const;
qreal width(QChar) const;
+#endif
+
+ qreal horizontalAdvance(const QString &string, int length = -1) const;
+ qreal horizontalAdvance(QChar) const;
QRectF boundingRect(const QString &string) const;
QRectF boundingRect(QChar) const;
- QRectF boundingRect(const QRectF &r, int flags, const QString& string, int tabstops = 0, int *tabarray = Q_NULLPTR) const;
- QSizeF size(int flags, const QString& str, int tabstops = 0, int *tabarray = Q_NULLPTR) const;
+ QRectF boundingRect(const QRectF &r, int flags, const QString& string, int tabstops = 0, int *tabarray = nullptr) const;
+ QSizeF size(int flags, const QString& str, int tabstops = 0, int *tabarray = nullptr) const;
QRectF tightBoundingRect(const QString &text) const;
diff --git a/src/gui/text/qharfbuzzng.cpp b/src/gui/text/qharfbuzzng.cpp
index 6aca660205..3e27ee4fbf 100644
--- a/src/gui/text/qharfbuzzng.cpp
+++ b/src/gui/text/qharfbuzzng.cpp
@@ -422,7 +422,6 @@ hb_unicode_funcs_t *hb_qt_get_unicode_funcs()
// Font routines
-#if HB_VERSION_ATLEAST(1, 1, 3)
static hb_bool_t
_hb_qt_get_font_h_extents(hb_font_t * /*font*/, void *font_data,
hb_font_extents_t *metrics,
@@ -437,9 +436,7 @@ _hb_qt_get_font_h_extents(hb_font_t * /*font*/, void *font_data,
return true;
}
-#endif
-#if HB_VERSION_ATLEAST(1, 2, 3)
static hb_bool_t
_hb_qt_font_get_nominal_glyph(hb_font_t * /*font*/, void *font_data,
hb_codepoint_t unicode,
@@ -453,7 +450,6 @@ _hb_qt_font_get_nominal_glyph(hb_font_t * /*font*/, void *font_data,
return *glyph != 0;
}
-#endif
static hb_bool_t
_hb_qt_font_get_variation_glyph(hb_font_t * /*font*/, void *font_data,
@@ -490,17 +486,6 @@ _hb_qt_font_get_glyph_h_advance(hb_font_t *font, void *font_data,
return advance.value();
}
-#if !HB_VERSION_ATLEAST(1, 1, 2)
-static hb_bool_t
-_hb_qt_font_get_glyph_h_origin(hb_font_t * /*font*/, void * /*font_data*/,
- hb_codepoint_t /*glyph*/,
- hb_position_t * /*x*/, hb_position_t * /*y*/,
- void * /*user_data*/)
-{
- return true; // we always work in the horizontal coordinates
-}
-#endif
-
static hb_position_t
_hb_qt_font_get_glyph_h_kerning(hb_font_t *font, void *font_data,
hb_codepoint_t first_glyph, hb_codepoint_t second_glyph,
@@ -581,19 +566,10 @@ struct _hb_qt_font_funcs_t {
{
funcs = hb_font_funcs_create();
-#if HB_VERSION_ATLEAST(1, 1, 3)
hb_font_funcs_set_font_h_extents_func(funcs, _hb_qt_get_font_h_extents, NULL, NULL);
-#endif
-#if HB_VERSION_ATLEAST(1, 2, 3)
hb_font_funcs_set_nominal_glyph_func(funcs, _hb_qt_font_get_nominal_glyph, NULL, NULL);
hb_font_funcs_set_variation_glyph_func(funcs, _hb_qt_font_get_variation_glyph, NULL, NULL);
-#else
- hb_font_funcs_set_glyph_func(funcs, _hb_qt_font_get_variation_glyph, NULL, NULL);
-#endif
hb_font_funcs_set_glyph_h_advance_func(funcs, _hb_qt_font_get_glyph_h_advance, NULL, NULL);
-#if !HB_VERSION_ATLEAST(1, 1, 2)
- hb_font_funcs_set_glyph_h_origin_func(funcs, _hb_qt_font_get_glyph_h_origin, NULL, NULL);
-#endif
hb_font_funcs_set_glyph_h_kerning_func(funcs, _hb_qt_font_get_glyph_h_kerning, NULL, NULL);
hb_font_funcs_set_glyph_extents_func(funcs, _hb_qt_font_get_glyph_extents, NULL, NULL);
hb_font_funcs_set_glyph_contour_point_func(funcs, _hb_qt_font_get_glyph_contour_point, NULL, NULL);
diff --git a/src/gui/text/qstatictext.cpp b/src/gui/text/qstatictext.cpp
index dbc2e6e558..d6f97547c4 100644
--- a/src/gui/text/qstatictext.cpp
+++ b/src/gui/text/qstatictext.cpp
@@ -439,7 +439,7 @@ namespace {
{
}
- virtual void updateState(const QPaintEngineState &newState) Q_DECL_OVERRIDE
+ virtual void updateState(const QPaintEngineState &newState) override
{
if (newState.state() & QPaintEngine::DirtyPen
&& newState.pen().color() != m_currentColor) {
@@ -448,7 +448,7 @@ namespace {
}
}
- virtual void drawTextItem(const QPointF &position, const QTextItem &textItem) Q_DECL_OVERRIDE
+ virtual void drawTextItem(const QPointF &position, const QTextItem &textItem) override
{
const QTextItemInt &ti = static_cast<const QTextItemInt &>(textItem);
@@ -484,15 +484,15 @@ namespace {
m_items.append(currentItem);
}
- virtual void drawPolygon(const QPointF *, int , PolygonDrawMode ) Q_DECL_OVERRIDE
+ virtual void drawPolygon(const QPointF *, int , PolygonDrawMode ) override
{
/* intentionally empty */
}
- virtual bool begin(QPaintDevice *) Q_DECL_OVERRIDE { return true; }
- virtual bool end() Q_DECL_OVERRIDE { return true; }
- virtual void drawPixmap(const QRectF &, const QPixmap &, const QRectF &) Q_DECL_OVERRIDE {}
- virtual Type type() const Q_DECL_OVERRIDE
+ virtual bool begin(QPaintDevice *) override { return true; }
+ virtual bool end() override { return true; }
+ virtual void drawPixmap(const QRectF &, const QPixmap &, const QRectF &) override {}
+ virtual Type type() const override
{
return User;
}
@@ -537,7 +537,7 @@ namespace {
delete m_paintEngine;
}
- int metric(PaintDeviceMetric m) const Q_DECL_OVERRIDE
+ int metric(PaintDeviceMetric m) const override
{
int val;
switch (m) {
@@ -574,7 +574,7 @@ namespace {
return val;
}
- virtual QPaintEngine *paintEngine() const Q_DECL_OVERRIDE
+ virtual QPaintEngine *paintEngine() const override
{
return m_paintEngine;
}
diff --git a/src/gui/text/qtextdocument.cpp b/src/gui/text/qtextdocument.cpp
index db0650d154..1c7384406d 100644
--- a/src/gui/text/qtextdocument.cpp
+++ b/src/gui/text/qtextdocument.cpp
@@ -74,6 +74,8 @@ QT_BEGIN_NAMESPACE
Q_CORE_EXPORT Q_DECL_CONST_FUNCTION unsigned int qt_int_sqrt(unsigned int n);
/*!
+ \fn bool Qt::mightBeRichText(const QString& text)
+
Returns \c true if the string \a text is likely to be rich text;
otherwise returns \c false.
@@ -144,6 +146,8 @@ bool Qt::mightBeRichText(const QString& text)
/*!
+ \fn QString Qt::convertFromPlainText(const QString &plain, Qt::WhiteSpaceMode mode)
+
Converts the plain text string \a plain to an HTML-formatted
paragraph while preserving most of its look.
@@ -805,7 +809,7 @@ void QTextDocument::adjustSize()
// Pull this private function in from qglobal.cpp
QFont f = defaultFont();
QFontMetrics fm(f);
- int mw = fm.width(QLatin1Char('x')) * 80;
+ int mw = fm.horizontalAdvance(QLatin1Char('x')) * 80;
int w = mw;
setTextWidth(w);
QSizeF size = documentLayout()->documentSize();
@@ -1898,7 +1902,7 @@ static void printPage(int index, QPainter *painter, const QTextDocument *doc, co
painter->setFont(QFont(doc->defaultFont()));
const QString pageString = QString::number(index);
- painter->drawText(qRound(pageNumberPos.x() - painter->fontMetrics().width(pageString)),
+ painter->drawText(qRound(pageNumberPos.x() - painter->fontMetrics().horizontalAdvance(pageString)),
qRound(pageNumberPos.y() + view.top()),
pageString);
}
diff --git a/src/gui/text/qtextdocument.h b/src/gui/text/qtextdocument.h
index c2761a39b9..41c578fc1b 100644
--- a/src/gui/text/qtextdocument.h
+++ b/src/gui/text/qtextdocument.h
@@ -116,11 +116,11 @@ class Q_GUI_EXPORT QTextDocument : public QObject
Q_PROPERTY(QUrl baseUrl READ baseUrl WRITE setBaseUrl NOTIFY baseUrlChanged)
public:
- explicit QTextDocument(QObject *parent = Q_NULLPTR);
- explicit QTextDocument(const QString &text, QObject *parent = Q_NULLPTR);
+ explicit QTextDocument(QObject *parent = nullptr);
+ explicit QTextDocument(const QString &text, QObject *parent = nullptr);
~QTextDocument();
- QTextDocument *clone(QObject *parent = Q_NULLPTR) const;
+ QTextDocument *clone(QObject *parent = nullptr) const;
bool isEmpty() const;
virtual void clear();
diff --git a/src/gui/text/qtextdocumentlayout.cpp b/src/gui/text/qtextdocumentlayout.cpp
index e9194e73ff..9877a23fa6 100644
--- a/src/gui/text/qtextdocumentlayout.cpp
+++ b/src/gui/text/qtextdocumentlayout.cpp
@@ -1427,7 +1427,7 @@ void QTextDocumentLayoutPrivate::drawListItem(const QPointF &offset, QPainter *p
case QTextListFormat::ListLowerRoman:
case QTextListFormat::ListUpperRoman:
itemText = static_cast<QTextList *>(object)->itemText(bl);
- size.setWidth(fontMetrics.width(itemText));
+ size.setWidth(fontMetrics.horizontalAdvance(itemText));
size.setHeight(fontMetrics.height());
break;
@@ -1445,7 +1445,7 @@ void QTextDocumentLayoutPrivate::drawListItem(const QPointF &offset, QPainter *p
QRectF r(pos, size);
- qreal xoff = fontMetrics.width(QLatin1Char(' '));
+ qreal xoff = fontMetrics.horizontalAdvance(QLatin1Char(' '));
if (dir == Qt::LeftToRight)
xoff = -xoff - size.width();
r.translate( xoff, (fontMetrics.height() / 2) - (size.height() / 2));
@@ -2613,7 +2613,7 @@ void QTextDocumentLayoutPrivate::layoutBlock(const QTextBlock &bl, int blockPosi
QFixed extraMargin;
if (docPrivate->defaultTextOption.flags() & QTextOption::AddSpaceForLineAndParagraphSeparators) {
QFontMetricsF fm(bl.charFormat().font());
- extraMargin = QFixed::fromReal(fm.width(QChar(QChar(0x21B5))));
+ extraMargin = QFixed::fromReal(fm.horizontalAdvance(QChar(QChar(0x21B5))));
}
const QFixed indent = this->blockIndent(blockFormat);
diff --git a/src/gui/text/qtextdocumentlayout_p.h b/src/gui/text/qtextdocumentlayout_p.h
index 710c49628e..2054ebaa35 100644
--- a/src/gui/text/qtextdocumentlayout_p.h
+++ b/src/gui/text/qtextdocumentlayout_p.h
@@ -73,11 +73,11 @@ public:
explicit QTextDocumentLayout(QTextDocument *doc);
// from the abstract layout
- void draw(QPainter *painter, const PaintContext &context) Q_DECL_OVERRIDE;
- int hitTest(const QPointF &point, Qt::HitTestAccuracy accuracy) const Q_DECL_OVERRIDE;
+ void draw(QPainter *painter, const PaintContext &context) override;
+ int hitTest(const QPointF &point, Qt::HitTestAccuracy accuracy) const override;
- int pageCount() const Q_DECL_OVERRIDE;
- QSizeF documentSize() const Q_DECL_OVERRIDE;
+ int pageCount() const override;
+ QSizeF documentSize() const override;
void setCursorWidth(int width);
int cursorWidth() const;
@@ -88,8 +88,8 @@ public:
// internal for QTextEdit's NoWrap mode
void setViewport(const QRectF &viewport);
- virtual QRectF frameBoundingRect(QTextFrame *frame) const Q_DECL_OVERRIDE;
- virtual QRectF blockBoundingRect(const QTextBlock &block) const Q_DECL_OVERRIDE;
+ virtual QRectF frameBoundingRect(QTextFrame *frame) const override;
+ virtual QRectF blockBoundingRect(const QTextBlock &block) const override;
QRectF tableBoundingRect(QTextTable *table) const;
QRectF tableCellBoundingRect(QTextTable *table, const QTextTableCell &cell) const;
@@ -104,12 +104,12 @@ public:
bool contentHasAlignment() const;
protected:
- void documentChanged(int from, int oldLength, int length) Q_DECL_OVERRIDE;
- void resizeInlineObject(QTextInlineObject item, int posInDocument, const QTextFormat &format) Q_DECL_OVERRIDE;
- void positionInlineObject(QTextInlineObject item, int posInDocument, const QTextFormat &format) Q_DECL_OVERRIDE;
+ void documentChanged(int from, int oldLength, int length) override;
+ void resizeInlineObject(QTextInlineObject item, int posInDocument, const QTextFormat &format) override;
+ void positionInlineObject(QTextInlineObject item, int posInDocument, const QTextFormat &format) override;
void drawInlineObject(QPainter *p, const QRectF &rect, QTextInlineObject item,
- int posInDocument, const QTextFormat &format) Q_DECL_OVERRIDE;
- virtual void timerEvent(QTimerEvent *e) Q_DECL_OVERRIDE;
+ int posInDocument, const QTextFormat &format) override;
+ virtual void timerEvent(QTimerEvent *e) override;
private:
QRectF doLayout(int from, int oldLength, int length);
void layoutFinished();
diff --git a/src/gui/text/qtextengine.cpp b/src/gui/text/qtextengine.cpp
index faddb3552d..71f02376ac 100644
--- a/src/gui/text/qtextengine.cpp
+++ b/src/gui/text/qtextengine.cpp
@@ -1242,7 +1242,7 @@ int QTextEngine::shapeTextWithHarfbuzzNG(const QScriptItem &si,
{ HB_TAG('h','l','i','g'), !dontLigate, 0, uint(-1) } };
const int num_features = dontLigate ? 5 : 1;
- const char *const *shaper_list = Q_NULLPTR;
+ const char *const *shaper_list = nullptr;
#if defined(Q_OS_DARWIN)
// What's behind QFontEngine::FaceData::user_data isn't compatible between different font engines
// - specifically functions in hb-coretext.cc would run into undefined behavior with data
@@ -1252,7 +1252,7 @@ int QTextEngine::shapeTextWithHarfbuzzNG(const QScriptItem &si,
"graphite2",
"ot",
"fallback",
- Q_NULLPTR
+ nullptr
};
shaper_list = s_shaper_list_without_coretext;
}
diff --git a/src/gui/text/qtextformat.cpp b/src/gui/text/qtextformat.cpp
index 8fe474af2c..da36f87230 100644
--- a/src/gui/text/qtextformat.cpp
+++ b/src/gui/text/qtextformat.cpp
@@ -201,8 +201,10 @@ public:
inline void insertProperty(qint32 key, const QVariant &value)
{
hashDirty = true;
- if (key >= QTextFormat::FirstFontProperty && key <= QTextFormat::LastFontProperty)
+ if ((key >= QTextFormat::FirstFontProperty && key <= QTextFormat::LastFontProperty)
+ || key == QTextFormat::FontLetterSpacingType) {
fontDirty = true;
+ }
for (int i = 0; i < props.count(); ++i)
if (props.at(i).key == key) {
props[i].value = value;
@@ -216,8 +218,10 @@ public:
for (int i = 0; i < props.count(); ++i)
if (props.at(i).key == key) {
hashDirty = true;
- if (key >= QTextFormat::FirstFontProperty && key <= QTextFormat::LastFontProperty)
+ if ((key >= QTextFormat::FirstFontProperty && key <= QTextFormat::LastFontProperty)
+ || key == QTextFormat::FontLetterSpacingType) {
fontDirty = true;
+ }
props.remove(i);
return;
}
diff --git a/src/gui/text/qtexthtmlparser.cpp b/src/gui/text/qtexthtmlparser.cpp
index be10efad8d..9154182df1 100644
--- a/src/gui/text/qtexthtmlparser.cpp
+++ b/src/gui/text/qtexthtmlparser.cpp
@@ -1708,14 +1708,14 @@ public:
inline QTextHtmlStyleSelector(const QTextHtmlParser *parser)
: parser(parser) { nameCaseSensitivity = Qt::CaseInsensitive; }
- virtual QStringList nodeNames(NodePtr node) const Q_DECL_OVERRIDE;
- virtual QString attribute(NodePtr node, const QString &name) const Q_DECL_OVERRIDE;
- virtual bool hasAttributes(NodePtr node) const Q_DECL_OVERRIDE;
- virtual bool isNullNode(NodePtr node) const Q_DECL_OVERRIDE;
- virtual NodePtr parentNode(NodePtr node) const Q_DECL_OVERRIDE;
- virtual NodePtr previousSiblingNode(NodePtr node) const Q_DECL_OVERRIDE;
- virtual NodePtr duplicateNode(NodePtr node) const Q_DECL_OVERRIDE;
- virtual void freeNode(NodePtr node) const Q_DECL_OVERRIDE;
+ virtual QStringList nodeNames(NodePtr node) const override;
+ virtual QString attribute(NodePtr node, const QString &name) const override;
+ virtual bool hasAttributes(NodePtr node) const override;
+ virtual bool isNullNode(NodePtr node) const override;
+ virtual NodePtr parentNode(NodePtr node) const override;
+ virtual NodePtr previousSiblingNode(NodePtr node) const override;
+ virtual NodePtr duplicateNode(NodePtr node) const override;
+ virtual void freeNode(NodePtr node) const override;
private:
const QTextHtmlParser *parser;
diff --git a/src/gui/text/qtextimagehandler_p.h b/src/gui/text/qtextimagehandler_p.h
index a22c91ecbf..339ef0af4f 100644
--- a/src/gui/text/qtextimagehandler_p.h
+++ b/src/gui/text/qtextimagehandler_p.h
@@ -67,8 +67,8 @@ class Q_GUI_EXPORT QTextImageHandler : public QObject,
public:
explicit QTextImageHandler(QObject *parent = 0);
- virtual QSizeF intrinsicSize(QTextDocument *doc, int posInDocument, const QTextFormat &format) Q_DECL_OVERRIDE;
- virtual void drawObject(QPainter *p, const QRectF &rect, QTextDocument *doc, int posInDocument, const QTextFormat &format) Q_DECL_OVERRIDE;
+ virtual QSizeF intrinsicSize(QTextDocument *doc, int posInDocument, const QTextFormat &format) override;
+ virtual void drawObject(QPainter *p, const QRectF &rect, QTextDocument *doc, int posInDocument, const QTextFormat &format) override;
QImage image(QTextDocument *doc, const QTextImageFormat &imageFormat);
};
diff --git a/src/gui/text/qtextlayout.cpp b/src/gui/text/qtextlayout.cpp
index 066f258ea3..bf267a0bbd 100644
--- a/src/gui/text/qtextlayout.cpp
+++ b/src/gui/text/qtextlayout.cpp
@@ -2453,7 +2453,7 @@ void QTextLine::draw(QPainter *p, const QPointF &pos, const QTextLayout::FormatR
const qreal lineHeight = line.height().toReal();
QRectF r(pos.x() + line.x.toReal(), pos.y() + line.y.toReal(),
- lineHeight / 2, QFontMetrics(eng->font()).width(QLatin1Char(' ')));
+ lineHeight / 2, QFontMetrics(eng->font()).horizontalAdvance(QLatin1Char(' ')));
setPenAndDrawBackground(p, QPen(), selection->format, r);
p->setPen(pen);
}
@@ -2540,7 +2540,7 @@ void QTextLine::draw(QPainter *p, const QPointF &pos, const QTextLayout::FormatR
QPainterPrivate::get(p)->drawTextItem(QPointF(iterator.x.toReal(), y.toReal()), gf, eng);
if (eng->option.flags() & QTextOption::ShowTabsAndSpaces) {
QChar visualTab(0x2192);
- int w = QFontMetrics(f).width(visualTab);
+ int w = QFontMetrics(f).horizontalAdvance(visualTab);
qreal x = iterator.itemWidth.toReal() - w; // Right-aligned
if (x < 0)
p->setClipRect(QRectF(iterator.x.toReal(), line.y.toReal(),
diff --git a/src/gui/text/qtextlayout.h b/src/gui/text/qtextlayout.h
index 980a099b05..67bc75a6b8 100644
--- a/src/gui/text/qtextlayout.h
+++ b/src/gui/text/qtextlayout.h
@@ -69,7 +69,7 @@ class Q_GUI_EXPORT QTextInlineObject
{
public:
QTextInlineObject(int i, QTextEngine *e) : itm(i), eng(e) {}
- inline QTextInlineObject() : itm(0), eng(Q_NULLPTR) {}
+ inline QTextInlineObject() : itm(0), eng(nullptr) {}
inline bool isValid() const { return eng; }
QRectF rect() const;
@@ -107,7 +107,7 @@ public:
// does itemization
QTextLayout();
QTextLayout(const QString& text);
- QTextLayout(const QString& text, const QFont &font, QPaintDevice *paintdevice = Q_NULLPTR);
+ QTextLayout(const QString& text, const QFont &font, QPaintDevice *paintdevice = nullptr);
QTextLayout(const QTextBlock &b);
~QTextLayout();
@@ -210,7 +210,7 @@ Q_DECLARE_TYPEINFO(QTextLayout::FormatRange, Q_RELOCATABLE_TYPE);
class Q_GUI_EXPORT QTextLine
{
public:
- inline QTextLine() : index(0), eng(Q_NULLPTR) {}
+ inline QTextLine() : index(0), eng(nullptr) {}
inline bool isValid() const { return eng; }
QRectF rect() const;
@@ -255,7 +255,7 @@ public:
int lineNumber() const { return index; }
- void draw(QPainter *p, const QPointF &point, const QTextLayout::FormatRange *selection = Q_NULLPTR) const;
+ void draw(QPainter *p, const QPointF &point, const QTextLayout::FormatRange *selection = nullptr) const;
#if !defined(QT_NO_RAWFONT)
QList<QGlyphRun> glyphRuns(int from = -1, int length = -1) const;
diff --git a/src/gui/text/qtextobject.h b/src/gui/text/qtextobject.h
index a5030de112..7e4efa28f8 100644
--- a/src/gui/text/qtextobject.h
+++ b/src/gui/text/qtextobject.h
@@ -203,7 +203,7 @@ class Q_GUI_EXPORT QTextBlock
friend class QSyntaxHighlighter;
public:
inline QTextBlock(QTextDocumentPrivate *priv, int b) : p(priv), n(b) {}
- inline QTextBlock() : p(Q_NULLPTR), n(0) {}
+ inline QTextBlock() : p(nullptr), n(0) {}
inline QTextBlock(const QTextBlock &o) : p(o.p), n(o.n) {}
inline QTextBlock &operator=(const QTextBlock &o) { p = o.p; n = o.n; return *this; }
@@ -260,7 +260,7 @@ public:
friend class QTextBlock;
iterator(const QTextDocumentPrivate *priv, int begin, int end, int f) : p(priv), b(begin), e(end), n(f) {}
public:
- iterator() : p(Q_NULLPTR), b(0), e(0), n(0) {}
+ iterator() : p(nullptr), b(0), e(0), n(0) {}
#if QT_VERSION < QT_VERSION_CHECK(6,0,0)
iterator(const iterator &o) : p(o.p), b(o.b), e(o.e), n(o.n) {}
#endif
@@ -304,7 +304,7 @@ class Q_GUI_EXPORT QTextFragment
{
public:
inline QTextFragment(const QTextDocumentPrivate *priv, int f, int fe) : p(priv), n(f), ne(fe) {}
- inline QTextFragment() : p(Q_NULLPTR), n(0), ne(0) {}
+ inline QTextFragment() : p(nullptr), n(0), ne(0) {}
inline QTextFragment(const QTextFragment &o) : p(o.p), n(o.n), ne(o.ne) {}
inline QTextFragment &operator=(const QTextFragment &o) { p = o.p; n = o.n; ne = o.ne; return *this; }
diff --git a/src/gui/text/qtextodfwriter.cpp b/src/gui/text/qtextodfwriter.cpp
index 3dd19a6eda..30f5bc1051 100644
--- a/src/gui/text/qtextodfwriter.cpp
+++ b/src/gui/text/qtextodfwriter.cpp
@@ -94,7 +94,7 @@ public:
if (contentStream)
contentStream->close();
}
- virtual void addFile(const QString &, const QString &, const QByteArray &) Q_DECL_OVERRIDE
+ virtual void addFile(const QString &, const QString &, const QByteArray &) override
{
// we ignore this...
}
@@ -137,7 +137,7 @@ public:
zip.close();
}
- virtual void addFile(const QString &fileName, const QString &mimeType, const QByteArray &bytes) Q_DECL_OVERRIDE
+ virtual void addFile(const QString &fileName, const QString &mimeType, const QByteArray &bytes) override
{
zip.addFile(fileName, bytes);
addFile(fileName, mimeType);
diff --git a/src/gui/text/qtexttable.h b/src/gui/text/qtexttable.h
index ee8e974396..156b091b05 100644
--- a/src/gui/text/qtexttable.h
+++ b/src/gui/text/qtexttable.h
@@ -54,7 +54,7 @@ class QTextTablePrivate;
class Q_GUI_EXPORT QTextTableCell
{
public:
- QTextTableCell() : table(Q_NULLPTR) {}
+ QTextTableCell() : table(nullptr) {}
~QTextTableCell() {}
QTextTableCell(const QTextTableCell &o) : table(o.table), fragment(o.fragment) {}
QTextTableCell &operator=(const QTextTableCell &o)
@@ -69,7 +69,7 @@ public:
int rowSpan() const;
int columnSpan() const;
- inline bool isValid() const { return table != Q_NULLPTR; }
+ inline bool isValid() const { return table != nullptr; }
QTextCursor firstCursorPosition() const;
QTextCursor lastCursorPosition() const;
diff --git a/src/gui/text/qtexttable_p.h b/src/gui/text/qtexttable_p.h
index 848537272d..c969e1d5bc 100644
--- a/src/gui/text/qtexttable_p.h
+++ b/src/gui/text/qtexttable_p.h
@@ -65,8 +65,8 @@ public:
~QTextTablePrivate();
static QTextTable *createTable(QTextDocumentPrivate *, int pos, int rows, int cols, const QTextTableFormat &tableFormat);
- void fragmentAdded(QChar type, uint fragment) Q_DECL_OVERRIDE;
- void fragmentRemoved(QChar type, uint fragment) Q_DECL_OVERRIDE;
+ void fragmentAdded(QChar type, uint fragment) override;
+ void fragmentRemoved(QChar type, uint fragment) override;
void update() const;
diff --git a/src/gui/util/qvalidator.h b/src/gui/util/qvalidator.h
index eba4b54672..ad23092537 100644
--- a/src/gui/util/qvalidator.h
+++ b/src/gui/util/qvalidator.h
@@ -59,7 +59,7 @@ class Q_GUI_EXPORT QValidator : public QObject
{
Q_OBJECT
public:
- explicit QValidator(QObject * parent = Q_NULLPTR);
+ explicit QValidator(QObject * parent = nullptr);
~QValidator();
enum State {
@@ -93,12 +93,12 @@ class Q_GUI_EXPORT QIntValidator : public QValidator
Q_PROPERTY(int top READ top WRITE setTop NOTIFY topChanged)
public:
- explicit QIntValidator(QObject * parent = Q_NULLPTR);
- QIntValidator(int bottom, int top, QObject *parent = Q_NULLPTR);
+ explicit QIntValidator(QObject * parent = nullptr);
+ QIntValidator(int bottom, int top, QObject *parent = nullptr);
~QIntValidator();
- QValidator::State validate(QString &, int &) const Q_DECL_OVERRIDE;
- void fixup(QString &input) const Q_DECL_OVERRIDE;
+ QValidator::State validate(QString &, int &) const override;
+ void fixup(QString &input) const override;
void setBottom(int);
void setTop(int);
@@ -130,8 +130,8 @@ class Q_GUI_EXPORT QDoubleValidator : public QValidator
Q_PROPERTY(Notation notation READ notation WRITE setNotation NOTIFY notationChanged)
public:
- explicit QDoubleValidator(QObject * parent = Q_NULLPTR);
- QDoubleValidator(double bottom, double top, int decimals, QObject *parent = Q_NULLPTR);
+ explicit QDoubleValidator(QObject * parent = nullptr);
+ QDoubleValidator(double bottom, double top, int decimals, QObject *parent = nullptr);
~QDoubleValidator();
enum Notation {
@@ -139,7 +139,7 @@ public:
ScientificNotation
};
Q_ENUM(Notation)
- QValidator::State validate(QString &, int &) const Q_DECL_OVERRIDE;
+ QValidator::State validate(QString &, int &) const override;
virtual void setRange(double bottom, double top, int decimals = 0);
void setBottom(double);
@@ -174,11 +174,11 @@ class Q_GUI_EXPORT QRegExpValidator : public QValidator
Q_PROPERTY(QRegExp regExp READ regExp WRITE setRegExp NOTIFY regExpChanged)
public:
- explicit QRegExpValidator(QObject *parent = Q_NULLPTR);
- explicit QRegExpValidator(const QRegExp& rx, QObject *parent = Q_NULLPTR);
+ explicit QRegExpValidator(QObject *parent = nullptr);
+ explicit QRegExpValidator(const QRegExp& rx, QObject *parent = nullptr);
~QRegExpValidator();
- virtual QValidator::State validate(QString& input, int& pos) const Q_DECL_OVERRIDE;
+ virtual QValidator::State validate(QString& input, int& pos) const override;
void setRegExp(const QRegExp& rx);
const QRegExp& regExp() const { return r; }
@@ -204,11 +204,11 @@ class Q_GUI_EXPORT QRegularExpressionValidator : public QValidator
Q_PROPERTY(QRegularExpression regularExpression READ regularExpression WRITE setRegularExpression NOTIFY regularExpressionChanged)
public:
- explicit QRegularExpressionValidator(QObject *parent = Q_NULLPTR);
- explicit QRegularExpressionValidator(const QRegularExpression &re, QObject *parent = Q_NULLPTR);
+ explicit QRegularExpressionValidator(QObject *parent = nullptr);
+ explicit QRegularExpressionValidator(const QRegularExpression &re, QObject *parent = nullptr);
~QRegularExpressionValidator();
- virtual QValidator::State validate(QString &input, int &pos) const Q_DECL_OVERRIDE;
+ virtual QValidator::State validate(QString &input, int &pos) const override;
QRegularExpression regularExpression() const;
diff --git a/src/network/access/access.pri b/src/network/access/access.pri
index e8669dcec8..1d6a04a424 100644
--- a/src/network/access/access.pri
+++ b/src/network/access/access.pri
@@ -1,14 +1,6 @@
# Qt network access module
HEADERS += \
- access/qhttpnetworkheader_p.h \
- access/qhttpnetworkrequest_p.h \
- access/qhttpnetworkreply_p.h \
- access/qhttpnetworkconnection_p.h \
- access/qhttpnetworkconnectionchannel_p.h \
- access/qabstractprotocolhandler_p.h \
- access/qhttpprotocolhandler_p.h \
- access/qspdyprotocolhandler_p.h \
access/qnetworkaccessauthenticationmanager_p.h \
access/qnetworkaccessmanager.h \
access/qnetworkaccessmanager_p.h \
@@ -27,28 +19,15 @@ HEADERS += \
access/qnetworkreply_p.h \
access/qnetworkreplyimpl_p.h \
access/qnetworkreplydataimpl_p.h \
- access/qnetworkreplyhttpimpl_p.h \
access/qnetworkreplyfileimpl_p.h \
access/qabstractnetworkcache_p.h \
access/qabstractnetworkcache.h \
- access/qhttpthreaddelegate_p.h \
- access/qhttpmultipart.h \
- access/qhttpmultipart_p.h \
access/qnetworkfile_p.h \
- access/qhttp2protocolhandler_p.h \
access/qhsts_p.h \
access/qhstspolicy.h \
access/qhstsstore_p.h
SOURCES += \
- access/qhttpnetworkheader.cpp \
- access/qhttpnetworkrequest.cpp \
- access/qhttpnetworkreply.cpp \
- access/qhttpnetworkconnection.cpp \
- access/qhttpnetworkconnectionchannel.cpp \
- access/qabstractprotocolhandler.cpp \
- access/qhttpprotocolhandler.cpp \
- access/qspdyprotocolhandler.cpp \
access/qnetworkaccessauthenticationmanager.cpp \
access/qnetworkaccessmanager.cpp \
access/qnetworkaccesscache.cpp \
@@ -62,13 +41,9 @@ SOURCES += \
access/qnetworkreply.cpp \
access/qnetworkreplyimpl.cpp \
access/qnetworkreplydataimpl.cpp \
- access/qnetworkreplyhttpimpl.cpp \
access/qnetworkreplyfileimpl.cpp \
access/qabstractnetworkcache.cpp \
- access/qhttpthreaddelegate.cpp \
- access/qhttpmultipart.cpp \
access/qnetworkfile.cpp \
- access/qhttp2protocolhandler.cpp \
access/qhsts.cpp \
access/qhstspolicy.cpp \
access/qhstsstore.cpp
@@ -94,4 +69,36 @@ qtConfig(networkdiskcache) {
mac: LIBS_PRIVATE += -framework Security
include($$PWD/../../3rdparty/zlib_dependency.pri)
-include($$PWD/http2/http2.pri)
+
+qtConfig(http) {
+ include($$PWD/http2/http2.pri)
+
+ SOURCES += \
+ access/qabstractprotocolhandler.cpp \
+ access/qhttp2protocolhandler.cpp \
+ access/qhttpmultipart.cpp \
+ access/qhttpnetworkconnection.cpp \
+ access/qhttpnetworkconnectionchannel.cpp \
+ access/qhttpnetworkheader.cpp \
+ access/qhttpnetworkreply.cpp \
+ access/qhttpnetworkrequest.cpp \
+ access/qhttpprotocolhandler.cpp \
+ access/qhttpthreaddelegate.cpp \
+ access/qnetworkreplyhttpimpl.cpp \
+ access/qspdyprotocolhandler.cpp
+
+ HEADERS += \
+ access/qabstractprotocolhandler_p.h \
+ access/qhttp2protocolhandler_p.h \
+ access/qhttpmultipart.h \
+ access/qhttpmultipart_p.h \
+ access/qhttpnetworkconnection_p.h \
+ access/qhttpnetworkconnectionchannel_p.h \
+ access/qhttpnetworkheader_p.h \
+ access/qhttpnetworkreply_p.h \
+ access/qhttpnetworkrequest_p.h \
+ access/qhttpprotocolhandler_p.h \
+ access/qhttpthreaddelegate_p.h \
+ access/qnetworkreplyhttpimpl_p.h \
+ access/qspdyprotocolhandler_p.h
+}
diff --git a/src/network/access/http2/hpack.cpp b/src/network/access/http2/hpack.cpp
index 95e6f9051b..2d324d5092 100644
--- a/src/network/access/http2/hpack.cpp
+++ b/src/network/access/http2/hpack.cpp
@@ -67,18 +67,6 @@ HeaderSize header_size(const HttpHeader &header)
struct BitPattern
{
- BitPattern()
- : value(),
- bitLength()
- {
- }
-
- BitPattern(uchar v, uchar len)
- : value(v),
- bitLength(len)
- {
- }
-
uchar value;
uchar bitLength;
};
@@ -102,11 +90,11 @@ using StreamError = BitIStream::Error;
// It's always 1 or 0 actually, but the number of bits to extract
// from the input stream - differs.
-const BitPattern Indexed(1, 1);
-const BitPattern LiteralIncrementalIndexing(1, 2);
-const BitPattern LiteralNoIndexing(0, 4);
-const BitPattern LiteralNeverIndexing(1, 4);
-const BitPattern SizeUpdate(1, 3);
+const BitPattern Indexed = {1, 1};
+const BitPattern LiteralIncrementalIndexing = {1, 2};
+const BitPattern LiteralNoIndexing = {0, 4};
+const BitPattern LiteralNeverIndexing = {1, 4};
+const BitPattern SizeUpdate = {1, 3};
bool is_literal_field(const BitPattern &pattern)
{
diff --git a/src/network/access/http2/http2streams_p.h b/src/network/access/http2/http2streams_p.h
index 8465486ae8..0be6b3b253 100644
--- a/src/network/access/http2/http2streams_p.h
+++ b/src/network/access/http2/http2streams_p.h
@@ -62,6 +62,8 @@
#include <vector>
+QT_REQUIRE_CONFIG(http);
+
QT_BEGIN_NAMESPACE
class QNonContiguousByteDevice;
diff --git a/src/network/access/http2/huffman_p.h b/src/network/access/http2/huffman_p.h
index 7195661664..c5324d42b1 100644
--- a/src/network/access/http2/huffman_p.h
+++ b/src/network/access/http2/huffman_p.h
@@ -62,19 +62,6 @@ namespace HPack
struct CodeEntry
{
- CodeEntry() : byteValue(),
- huffmanCode(),
- bitLength()
- {
- }
-
- CodeEntry(quint32 val, quint32 code, quint32 len)
- : byteValue(val),
- huffmanCode(code),
- bitLength(len)
- {
- }
-
quint32 byteValue;
quint32 huffmanCode;
quint32 bitLength;
diff --git a/src/network/access/qabstractnetworkcache.h b/src/network/access/qabstractnetworkcache.h
index 33b0bc4ce3..678bae2d6e 100644
--- a/src/network/access/qabstractnetworkcache.h
+++ b/src/network/access/qabstractnetworkcache.h
@@ -131,7 +131,7 @@ public Q_SLOTS:
virtual void clear() = 0;
protected:
- explicit QAbstractNetworkCache(QObject *parent = Q_NULLPTR);
+ explicit QAbstractNetworkCache(QObject *parent = nullptr);
QAbstractNetworkCache(QAbstractNetworkCachePrivate &dd, QObject *parent);
private:
diff --git a/src/network/access/qabstractprotocolhandler.cpp b/src/network/access/qabstractprotocolhandler.cpp
index d408f3b37a..f15dfe6899 100644
--- a/src/network/access/qabstractprotocolhandler.cpp
+++ b/src/network/access/qabstractprotocolhandler.cpp
@@ -40,8 +40,6 @@
#include <private/qabstractprotocolhandler_p.h>
#include <private/qhttpnetworkconnectionchannel_p.h>
-#ifndef QT_NO_HTTP
-
QT_BEGIN_NAMESPACE
QAbstractProtocolHandler::QAbstractProtocolHandler(QHttpNetworkConnectionChannel *channel)
@@ -62,5 +60,3 @@ void QAbstractProtocolHandler::setReply(QHttpNetworkReply *reply)
}
QT_END_NAMESPACE
-
-#endif // QT_NO_HTTP
diff --git a/src/network/access/qabstractprotocolhandler_p.h b/src/network/access/qabstractprotocolhandler_p.h
index 30814d6737..04a07734dd 100644
--- a/src/network/access/qabstractprotocolhandler_p.h
+++ b/src/network/access/qabstractprotocolhandler_p.h
@@ -53,7 +53,7 @@
#include <QtNetwork/private/qtnetworkglobal_p.h>
-#ifndef QT_NO_HTTP
+QT_REQUIRE_CONFIG(http);
QT_BEGIN_NAMESPACE
@@ -81,6 +81,4 @@ protected:
QT_END_NAMESPACE
-#endif // QT_NO_HTTP
-
#endif // QABSTRACTPROTOCOLHANDLER_H
diff --git a/src/network/access/qhsts.cpp b/src/network/access/qhsts.cpp
index 6a731afc2f..43a8a3663e 100644
--- a/src/network/access/qhsts.cpp
+++ b/src/network/access/qhsts.cpp
@@ -136,7 +136,7 @@ void QHstsCache::updateKnownHost(const QString &host, const QDateTime &expires,
return;
}
- knownHosts.insert(pos, hostName, newPolicy);
+ knownHosts.insert(pos, {hostName, newPolicy});
if (hstsStore)
hstsStore->addToObserved(newPolicy);
return;
@@ -144,8 +144,8 @@ void QHstsCache::updateKnownHost(const QString &host, const QDateTime &expires,
if (newPolicy.isExpired())
knownHosts.erase(pos);
- else if (*pos != newPolicy)
- *pos = std::move(newPolicy);
+ else if (pos->second != newPolicy)
+ pos->second = std::move(newPolicy);
else
return;
@@ -185,13 +185,13 @@ bool QHstsCache::isKnownHost(const QUrl &url) const
while (nameToTest.fragment.size()) {
auto const pos = knownHosts.find(nameToTest);
if (pos != knownHosts.end()) {
- if (pos.value().isExpired()) {
+ if (pos->second.isExpired()) {
knownHosts.erase(pos);
if (hstsStore) {
// Inform our store that this policy has expired.
- hstsStore->addToObserved(pos.value());
+ hstsStore->addToObserved(pos->second);
}
- } else if (!superDomainMatch || pos.value().includesSubDomains()) {
+ } else if (!superDomainMatch || pos->second.includesSubDomains()) {
return true;
}
}
@@ -215,9 +215,9 @@ void QHstsCache::clear()
QVector<QHstsPolicy> QHstsCache::policies() const
{
QVector<QHstsPolicy> values;
- values.reserve(knownHosts.size());
+ values.reserve(int(knownHosts.size()));
for (const auto &host : knownHosts)
- values << host;
+ values << host.second;
return values;
}
diff --git a/src/network/access/qhsts_p.h b/src/network/access/qhsts_p.h
index 2feb73b446..bc8708341d 100644
--- a/src/network/access/qhsts_p.h
+++ b/src/network/access/qhsts_p.h
@@ -61,7 +61,8 @@
#include <QtCore/qglobal.h>
#include <QtCore/qpair.h>
#include <QtCore/qurl.h>
-#include <QtCore/qmap.h>
+
+#include <map>
QT_BEGIN_NAMESPACE
@@ -117,7 +118,7 @@ private:
QStringRef fragment;
};
- mutable QMap<HostName, QHstsPolicy> knownHosts;
+ mutable std::map<HostName, QHstsPolicy> knownHosts;
QHstsStore *hstsStore = nullptr;
};
diff --git a/src/network/access/qhstspolicy.cpp b/src/network/access/qhstspolicy.cpp
index ab4695480b..46c9c22510 100644
--- a/src/network/access/qhstspolicy.cpp
+++ b/src/network/access/qhstspolicy.cpp
@@ -103,9 +103,15 @@ QHstsPolicy::QHstsPolicy() : d(new QHstsPolicyPrivate)
}
/*!
- Constructs QHstsPolicy with \a expiry (in UTC):
- - \a host data is interpreted according to \a mode;
- - \a flags selects options to apply to this policy.
+ \enum QHstsPolicy::PolicyFlag
+
+ \value IncludeSubDomains Indicates whether a policy must include subdomains
+*/
+
+/*!
+ Constructs QHstsPolicy with \a expiry (in UTC); \a flags is a value indicating
+ whether this policy must also include subdomains, \a host data is interpreted
+ according to \a mode.
\sa QUrl::setHost(), QUrl::ParsingMode, QHstsPolicy::PolicyFlag
*/
@@ -213,4 +219,10 @@ bool QHstsPolicy::isExpired() const
return !d->expiry.isValid() || d->expiry <= QDateTime::currentDateTimeUtc();
}
+/*!
+ \fn void QHstsPolicy::swap(QHstsPolicy &other)
+
+ Swaps this policy with the \a other policy.
+*/
+
QT_END_NAMESPACE
diff --git a/src/network/access/qhttp2protocolhandler.cpp b/src/network/access/qhttp2protocolhandler.cpp
index 42f1343c52..0cdcee6b59 100644
--- a/src/network/access/qhttp2protocolhandler.cpp
+++ b/src/network/access/qhttp2protocolhandler.cpp
@@ -40,8 +40,6 @@
#include "qhttpnetworkconnection_p.h"
#include "qhttp2protocolhandler_p.h"
-#if !defined(QT_NO_HTTP)
-
#include "http2/bitstreams_p.h"
#include <private/qnoncontiguousbytedevice_p.h>
@@ -88,7 +86,8 @@ HPack::HttpHeader build_headers(const QHttpNetworkRequest &request, quint32 maxH
if (size.second > maxHeaderListSize)
return HttpHeader(); // Bad, we cannot send this request ...
- for (const auto &field : request.header()) {
+ const auto requestHeader = request.header();
+ for (const auto &field : requestHeader) {
const HeaderSize delta = entry_size(field.first, field.second);
if (!delta.first) // Overflow???
break;
@@ -1511,5 +1510,3 @@ void QHttp2ProtocolHandler::closeSession()
}
QT_END_NAMESPACE
-
-#endif // !defined(QT_NO_HTTP)
diff --git a/src/network/access/qhttp2protocolhandler_p.h b/src/network/access/qhttp2protocolhandler_p.h
index dd209bd0ef..9165808302 100644
--- a/src/network/access/qhttp2protocolhandler_p.h
+++ b/src/network/access/qhttp2protocolhandler_p.h
@@ -55,8 +55,6 @@
#include <private/qabstractprotocolhandler_p.h>
#include <private/qhttpnetworkrequest_p.h>
-#if !defined(QT_NO_HTTP)
-
#include <private/http2protocol_p.h>
#include <private/http2streams_p.h>
#include <private/http2frames_p.h>
@@ -75,6 +73,8 @@
#include <deque>
#include <set>
+QT_REQUIRE_CONFIG(http);
+
QT_BEGIN_NAMESPACE
class QHttp2ProtocolHandler : public QObject, public QAbstractProtocolHandler
@@ -228,6 +228,4 @@ private:
QT_END_NAMESPACE
-#endif // !defined(QT_NO_HTTP)
-
#endif
diff --git a/src/network/access/qhttpmultipart.h b/src/network/access/qhttpmultipart.h
index 6d4531b099..78585a704d 100644
--- a/src/network/access/qhttpmultipart.h
+++ b/src/network/access/qhttpmultipart.h
@@ -46,6 +46,8 @@
#include <QtCore/QIODevice>
#include <QtNetwork/QNetworkRequest>
+QT_REQUIRE_CONFIG(http);
+
QT_BEGIN_NAMESPACE
@@ -98,8 +100,8 @@ public:
AlternativeType
};
- explicit QHttpMultiPart(QObject *parent = Q_NULLPTR);
- explicit QHttpMultiPart(ContentType contentType, QObject *parent = Q_NULLPTR);
+ explicit QHttpMultiPart(QObject *parent = nullptr);
+ explicit QHttpMultiPart(ContentType contentType, QObject *parent = nullptr);
~QHttpMultiPart();
void append(const QHttpPart &httpPart);
diff --git a/src/network/access/qhttpmultipart_p.h b/src/network/access/qhttpmultipart_p.h
index a03df9cb13..363e0b346c 100644
--- a/src/network/access/qhttpmultipart_p.h
+++ b/src/network/access/qhttpmultipart_p.h
@@ -56,6 +56,8 @@
#include "qnetworkrequest_p.h" // for deriving QHttpPartPrivate from QNetworkHeadersPrivate
#include "private/qobject_p.h"
+QT_REQUIRE_CONFIG(http);
+
QT_BEGIN_NAMESPACE
@@ -124,30 +126,30 @@ public:
~QHttpMultiPartIODevice() {
}
- virtual bool atEnd() const Q_DECL_OVERRIDE {
+ virtual bool atEnd() const override {
return readPointer == size();
}
- virtual qint64 bytesAvailable() const Q_DECL_OVERRIDE {
+ virtual qint64 bytesAvailable() const override {
return size() - readPointer;
}
- virtual void close() Q_DECL_OVERRIDE {
+ virtual void close() override {
readPointer = 0;
partOffsets.clear();
deviceSize = -1;
QIODevice::close();
}
- virtual qint64 bytesToWrite() const Q_DECL_OVERRIDE {
+ virtual qint64 bytesToWrite() const override {
return 0;
}
- virtual qint64 size() const Q_DECL_OVERRIDE;
- virtual bool isSequential() const Q_DECL_OVERRIDE;
- virtual bool reset() Q_DECL_OVERRIDE;
- virtual qint64 readData(char *data, qint64 maxSize) Q_DECL_OVERRIDE;
- virtual qint64 writeData(const char *data, qint64 maxSize) Q_DECL_OVERRIDE;
+ virtual qint64 size() const override;
+ virtual bool isSequential() const override;
+ virtual bool reset() override;
+ virtual qint64 readData(char *data, qint64 maxSize) override;
+ virtual qint64 writeData(const char *data, qint64 maxSize) override;
QHttpMultiPartPrivate *multiPart;
qint64 readPointer;
diff --git a/src/network/access/qhttpnetworkconnection.cpp b/src/network/access/qhttpnetworkconnection.cpp
index 8fdcc91efc..d24927b922 100644
--- a/src/network/access/qhttpnetworkconnection.cpp
+++ b/src/network/access/qhttpnetworkconnection.cpp
@@ -53,8 +53,6 @@
#include <qpair.h>
#include <qdebug.h>
-#ifndef QT_NO_HTTP
-
#ifndef QT_NO_SSL
# include <private/qsslsocket_p.h>
# include <QtNetwork/qsslkey.h>
@@ -83,10 +81,11 @@ QHttpNetworkConnectionPrivate::QHttpNetworkConnectionPrivate(const QString &host
networkLayerState(Unknown),
hostName(hostName), port(port), encrypt(encrypt), delayIpv4(true)
, activeChannelCount(type == QHttpNetworkConnection::ConnectionTypeHTTP2
+ || type == QHttpNetworkConnection::ConnectionTypeHTTP2Direct
#ifndef QT_NO_SSL
- || type == QHttpNetworkConnection::ConnectionTypeSPDY
+ || type == QHttpNetworkConnection::ConnectionTypeSPDY
#endif
- ? 1 : defaultHttpChannelCount)
+ ? 1 : defaultHttpChannelCount)
, channelCount(defaultHttpChannelCount)
#ifndef QT_NO_NETWORKPROXY
, networkProxy(QNetworkProxy::NoProxy)
@@ -122,7 +121,7 @@ QHttpNetworkConnectionPrivate::~QHttpNetworkConnectionPrivate()
{
for (int i = 0; i < channelCount; ++i) {
if (channels[i].socket) {
- QObject::disconnect(channels[i].socket, Q_NULLPTR, &channels[i], Q_NULLPTR);
+ QObject::disconnect(channels[i].socket, nullptr, &channels[i], nullptr);
channels[i].socket->close();
delete channels[i].socket;
}
@@ -1065,6 +1064,7 @@ void QHttpNetworkConnectionPrivate::_q_startNextRequest()
}
break;
}
+ case QHttpNetworkConnection::ConnectionTypeHTTP2Direct:
case QHttpNetworkConnection::ConnectionTypeHTTP2:
case QHttpNetworkConnection::ConnectionTypeSPDY: {
if (channels[0].spdyRequestsToSend.isEmpty() && channels[0].switchedToHttp2)
@@ -1554,5 +1554,3 @@ void QHttpNetworkConnectionPrivate::emitProxyAuthenticationRequired(const QHttpN
QT_END_NAMESPACE
#include "moc_qhttpnetworkconnection_p.cpp"
-
-#endif // QT_NO_HTTP
diff --git a/src/network/access/qhttpnetworkconnection_p.h b/src/network/access/qhttpnetworkconnection_p.h
index d3450417aa..91827a6eb1 100644
--- a/src/network/access/qhttpnetworkconnection_p.h
+++ b/src/network/access/qhttpnetworkconnection_p.h
@@ -71,7 +71,7 @@
#include <private/qhttpnetworkconnectionchannel_p.h>
-#ifndef QT_NO_HTTP
+QT_REQUIRE_CONFIG(http);
QT_BEGIN_NAMESPACE
@@ -94,7 +94,8 @@ public:
enum ConnectionType {
ConnectionTypeHTTP,
ConnectionTypeSPDY,
- ConnectionTypeHTTP2
+ ConnectionTypeHTTP2,
+ ConnectionTypeHTTP2Direct
};
#ifndef QT_NO_BEARERMANAGEMENT
@@ -295,6 +296,4 @@ public:
QT_END_NAMESPACE
-#endif // QT_NO_HTTP
-
#endif
diff --git a/src/network/access/qhttpnetworkconnectionchannel.cpp b/src/network/access/qhttpnetworkconnectionchannel.cpp
index 094a48a603..0ac14c78f6 100644
--- a/src/network/access/qhttpnetworkconnectionchannel.cpp
+++ b/src/network/access/qhttpnetworkconnectionchannel.cpp
@@ -45,8 +45,6 @@
#include <qpair.h>
#include <qdebug.h>
-#ifndef QT_NO_HTTP
-
#include <private/qhttp2protocolhandler_p.h>
#include <private/qhttpprotocolhandler_p.h>
#include <private/qspdyprotocolhandler_p.h>
@@ -438,6 +436,10 @@ void QHttpNetworkConnectionChannel::allDone()
return;
}
+ // For clear text HTTP/2 we tried to upgrade from HTTP/1.1 to HTTP/2; for
+ // ConnectionTypeHTTP2Direct we can never be here in case of failure
+ // (after an attempt to read HTTP/1.1 as HTTP/2 frames) or we have a normal
+ // HTTP/2 response and thus can skip this test:
if (connection->connectionType() == QHttpNetworkConnection::ConnectionTypeHTTP2
&& !ssl && !switchedToHttp2) {
if (Http2::is_protocol_upgraded(*reply)) {
@@ -891,6 +893,14 @@ void QHttpNetworkConnectionChannel::_q_connected()
connection->setSslContext(socketSslContext);
}
#endif
+ } else if (connection->connectionType() == QHttpNetworkConnection::ConnectionTypeHTTP2Direct) {
+ state = QHttpNetworkConnectionChannel::IdleState;
+ protocolHandler.reset(new QHttp2ProtocolHandler(this));
+ if (spdyRequestsToSend.count() > 0) {
+ // In case our peer has sent us its settings (window size, max concurrent streams etc.)
+ // let's give _q_receiveReply a chance to read them first ('invokeMethod', QueuedConnection).
+ QMetaObject::invokeMethod(connection, "_q_startNextRequest", Qt::QueuedConnection);
+ }
} else {
state = QHttpNetworkConnectionChannel::IdleState;
const bool tryProtocolUpgrade = connection->connectionType() == QHttpNetworkConnection::ConnectionTypeHTTP2;
@@ -1125,7 +1135,10 @@ void QHttpNetworkConnectionChannel::_q_encrypted()
QSslSocket *sslSocket = qobject_cast<QSslSocket *>(socket);
Q_ASSERT(sslSocket);
- if (!protocolHandler) {
+ if (!protocolHandler && connection->connectionType() != QHttpNetworkConnection::ConnectionTypeHTTP2Direct) {
+ // ConnectionTypeHTTP2Direct does not rely on ALPN/NPN to negotiate HTTP/2,
+ // after establishing a secure connection we immediately start sending
+ // HTTP/2 frames.
switch (sslSocket->sslConfiguration().nextProtocolNegotiationStatus()) {
case QSslConfiguration::NextProtocolNegotiationNegotiated:
case QSslConfiguration::NextProtocolNegotiationUnsupported: {
@@ -1191,7 +1204,8 @@ void QHttpNetworkConnectionChannel::_q_encrypted()
emitFinishedWithError(QNetworkReply::SslHandshakeFailedError,
"detected unknown Next Protocol Negotiation protocol");
}
- } else if (connection->connectionType() == QHttpNetworkConnection::ConnectionTypeHTTP2) {
+ } else if (connection->connectionType() == QHttpNetworkConnection::ConnectionTypeHTTP2
+ || connection->connectionType() == QHttpNetworkConnection::ConnectionTypeHTTP2Direct) {
// We have to reset QHttp2ProtocolHandler's state machine, it's a new
// connection and the handler's state is unique per connection.
protocolHandler.reset(new QHttp2ProtocolHandler(this));
@@ -1203,10 +1217,12 @@ void QHttpNetworkConnectionChannel::_q_encrypted()
pendingEncrypt = false;
if (connection->connectionType() == QHttpNetworkConnection::ConnectionTypeSPDY ||
- connection->connectionType() == QHttpNetworkConnection::ConnectionTypeHTTP2) {
+ connection->connectionType() == QHttpNetworkConnection::ConnectionTypeHTTP2 ||
+ connection->connectionType() == QHttpNetworkConnection::ConnectionTypeHTTP2Direct) {
// we call setSpdyWasUsed(true) on the replies in the SPDY handler when the request is sent
if (spdyRequestsToSend.count() > 0) {
- // wait for data from the server first (e.g. initial window, max concurrent requests)
+ // In case our peer has sent us its settings (window size, max concurrent streams etc.)
+ // let's give _q_receiveReply a chance to read them first ('invokeMethod', QueuedConnection).
QMetaObject::invokeMethod(connection, "_q_startNextRequest", Qt::QueuedConnection);
}
} else { // HTTP
@@ -1303,5 +1319,3 @@ void QHttpNetworkConnectionChannel::setConnection(QHttpNetworkConnection *c)
QT_END_NAMESPACE
#include "moc_qhttpnetworkconnectionchannel_p.cpp"
-
-#endif // QT_NO_HTTP
diff --git a/src/network/access/qhttpnetworkconnectionchannel_p.h b/src/network/access/qhttpnetworkconnectionchannel_p.h
index 844a7d5d15..e9cdae5653 100644
--- a/src/network/access/qhttpnetworkconnectionchannel_p.h
+++ b/src/network/access/qhttpnetworkconnectionchannel_p.h
@@ -68,8 +68,6 @@
#include <private/qhttpnetworkconnection_p.h>
#include <private/qabstractprotocolhandler_p.h>
-#ifndef QT_NO_HTTP
-
#ifndef QT_NO_SSL
# include <QtNetwork/qsslsocket.h>
# include <QtNetwork/qsslerror.h>
@@ -80,6 +78,8 @@
#include <QtCore/qscopedpointer.h>
+QT_REQUIRE_CONFIG(http);
+
QT_BEGIN_NAMESPACE
class QHttpNetworkRequest;
@@ -216,6 +216,4 @@ public:
QT_END_NAMESPACE
-#endif // QT_NO_HTTP
-
#endif
diff --git a/src/network/access/qhttpnetworkheader.cpp b/src/network/access/qhttpnetworkheader.cpp
index 7199abbf17..19a3dfcfe8 100644
--- a/src/network/access/qhttpnetworkheader.cpp
+++ b/src/network/access/qhttpnetworkheader.cpp
@@ -41,8 +41,6 @@
#include <algorithm>
-#ifndef QT_NO_HTTP
-
QT_BEGIN_NAMESPACE
QHttpNetworkHeaderPrivate::QHttpNetworkHeaderPrivate(const QUrl &newUrl)
@@ -121,5 +119,3 @@ bool QHttpNetworkHeaderPrivate::operator==(const QHttpNetworkHeaderPrivate &othe
QT_END_NAMESPACE
-
-#endif
diff --git a/src/network/access/qhttpnetworkheader_p.h b/src/network/access/qhttpnetworkheader_p.h
index 46aec1dd8c..f46c259919 100644
--- a/src/network/access/qhttpnetworkheader_p.h
+++ b/src/network/access/qhttpnetworkheader_p.h
@@ -53,11 +53,11 @@
#include <QtNetwork/private/qtnetworkglobal_p.h>
-#ifndef QT_NO_HTTP
-
#include <qshareddata.h>
#include <qurl.h>
+QT_REQUIRE_CONFIG(http);
+
QT_BEGIN_NAMESPACE
class Q_AUTOTEST_EXPORT QHttpNetworkHeader
@@ -99,10 +99,6 @@ public:
QT_END_NAMESPACE
-
-#endif // QT_NO_HTTP
-
-
#endif // QHTTPNETWORKHEADER_H
diff --git a/src/network/access/qhttpnetworkreply.cpp b/src/network/access/qhttpnetworkreply.cpp
index 778ba821e8..a657346958 100644
--- a/src/network/access/qhttpnetworkreply.cpp
+++ b/src/network/access/qhttpnetworkreply.cpp
@@ -40,8 +40,6 @@
#include "qhttpnetworkreply_p.h"
#include "qhttpnetworkconnection_p.h"
-#ifndef QT_NO_HTTP
-
#ifndef QT_NO_SSL
# include <QtNetwork/qsslkey.h>
# include <QtNetwork/qsslcipher.h>
@@ -1035,5 +1033,3 @@ void QHttpNetworkReply::ignoreSslErrors(const QList<QSslError> &errors)
QT_END_NAMESPACE
-
-#endif // QT_NO_HTTP
diff --git a/src/network/access/qhttpnetworkreply_p.h b/src/network/access/qhttpnetworkreply_p.h
index faab03f056..863e21ea3e 100644
--- a/src/network/access/qhttpnetworkreply_p.h
+++ b/src/network/access/qhttpnetworkreply_p.h
@@ -53,8 +53,6 @@
#include <QtNetwork/private/qtnetworkglobal_p.h>
-#ifndef QT_NO_HTTP
-
#include <qplatformdefs.h>
#ifndef QT_NO_COMPRESS
@@ -77,6 +75,8 @@ struct z_stream_s;
#include <private/qringbuffer_p.h>
#include <private/qbytedata_p.h>
+QT_REQUIRE_CONFIG(http);
+
QT_BEGIN_NAMESPACE
class QHttpNetworkConnection;
@@ -92,18 +92,18 @@ public:
explicit QHttpNetworkReply(const QUrl &url = QUrl(), QObject *parent = 0);
virtual ~QHttpNetworkReply();
- QUrl url() const Q_DECL_OVERRIDE;
- void setUrl(const QUrl &url) Q_DECL_OVERRIDE;
+ QUrl url() const override;
+ void setUrl(const QUrl &url) override;
- int majorVersion() const Q_DECL_OVERRIDE;
- int minorVersion() const Q_DECL_OVERRIDE;
+ int majorVersion() const override;
+ int minorVersion() const override;
- qint64 contentLength() const Q_DECL_OVERRIDE;
- void setContentLength(qint64 length) Q_DECL_OVERRIDE;
+ qint64 contentLength() const override;
+ void setContentLength(qint64 length) override;
- QList<QPair<QByteArray, QByteArray> > header() const Q_DECL_OVERRIDE;
- QByteArray headerField(const QByteArray &name, const QByteArray &defaultValue = QByteArray()) const Q_DECL_OVERRIDE;
- void setHeaderField(const QByteArray &name, const QByteArray &data) Q_DECL_OVERRIDE;
+ QList<QPair<QByteArray, QByteArray> > header() const override;
+ QByteArray headerField(const QByteArray &name, const QByteArray &defaultValue = QByteArray()) const override;
+ void setHeaderField(const QByteArray &name, const QByteArray &data) override;
void parseHeader(const QByteArray &header); // mainly for testing
QHttpNetworkRequest request() const;
@@ -285,7 +285,4 @@ public:
QT_END_NAMESPACE
-#endif // QT_NO_HTTP
-
-
#endif // QHTTPNETWORKREPLY_H
diff --git a/src/network/access/qhttpnetworkrequest.cpp b/src/network/access/qhttpnetworkrequest.cpp
index 60b566299f..3fcf946945 100644
--- a/src/network/access/qhttpnetworkrequest.cpp
+++ b/src/network/access/qhttpnetworkrequest.cpp
@@ -40,15 +40,13 @@
#include "qhttpnetworkrequest_p.h"
#include "private/qnoncontiguousbytedevice_p.h"
-#ifndef QT_NO_HTTP
-
QT_BEGIN_NAMESPACE
QHttpNetworkRequestPrivate::QHttpNetworkRequestPrivate(QHttpNetworkRequest::Operation op,
QHttpNetworkRequest::Priority pri, const QUrl &newUrl)
: QHttpNetworkHeaderPrivate(newUrl), operation(op), priority(pri), uploadByteDevice(0),
autoDecompress(false), pipeliningAllowed(false), spdyAllowed(false), http2Allowed(false),
- withCredentials(true), preConnect(false), redirectCount(0),
+ http2Direct(false), withCredentials(true), preConnect(false), redirectCount(0),
redirectPolicy(QNetworkRequest::ManualRedirectPolicy)
{
}
@@ -63,6 +61,7 @@ QHttpNetworkRequestPrivate::QHttpNetworkRequestPrivate(const QHttpNetworkRequest
pipeliningAllowed(other.pipeliningAllowed),
spdyAllowed(other.spdyAllowed),
http2Allowed(other.http2Allowed),
+ http2Direct(other.http2Direct),
withCredentials(other.withCredentials),
ssl(other.ssl),
preConnect(other.preConnect),
@@ -85,6 +84,7 @@ bool QHttpNetworkRequestPrivate::operator==(const QHttpNetworkRequestPrivate &ot
&& (pipeliningAllowed == other.pipeliningAllowed)
&& (spdyAllowed == other.spdyAllowed)
&& (http2Allowed == other.http2Allowed)
+ && (http2Direct == other.http2Direct)
// we do not clear the customVerb in setOperation
&& (operation != QHttpNetworkRequest::Custom || (customVerb == other.customVerb))
&& (withCredentials == other.withCredentials)
@@ -350,6 +350,16 @@ void QHttpNetworkRequest::setHTTP2Allowed(bool b)
d->http2Allowed = b;
}
+bool QHttpNetworkRequest::isHTTP2Direct() const
+{
+ return d->http2Direct;
+}
+
+void QHttpNetworkRequest::setHTTP2Direct(bool b)
+{
+ d->http2Direct = b;
+}
+
bool QHttpNetworkRequest::withCredentials() const
{
return d->withCredentials;
@@ -383,5 +393,3 @@ int QHttpNetworkRequest::minorVersion() const
QT_END_NAMESPACE
-#endif
-
diff --git a/src/network/access/qhttpnetworkrequest_p.h b/src/network/access/qhttpnetworkrequest_p.h
index ecf8856ded..2cbb8e255e 100644
--- a/src/network/access/qhttpnetworkrequest_p.h
+++ b/src/network/access/qhttpnetworkrequest_p.h
@@ -52,12 +52,12 @@
//
#include <QtNetwork/private/qtnetworkglobal_p.h>
-#ifndef QT_NO_HTTP
-
#include <private/qhttpnetworkheader_p.h>
#include <QtNetwork/qnetworkrequest.h>
#include <qmetatype.h>
+QT_REQUIRE_CONFIG(http);
+
QT_BEGIN_NAMESPACE
class QNonContiguousByteDevice;
@@ -90,18 +90,18 @@ public:
QHttpNetworkRequest &operator=(const QHttpNetworkRequest &other);
bool operator==(const QHttpNetworkRequest &other) const;
- QUrl url() const Q_DECL_OVERRIDE;
- void setUrl(const QUrl &url) Q_DECL_OVERRIDE;
+ QUrl url() const override;
+ void setUrl(const QUrl &url) override;
- int majorVersion() const Q_DECL_OVERRIDE;
- int minorVersion() const Q_DECL_OVERRIDE;
+ int majorVersion() const override;
+ int minorVersion() const override;
- qint64 contentLength() const Q_DECL_OVERRIDE;
- void setContentLength(qint64 length) Q_DECL_OVERRIDE;
+ qint64 contentLength() const override;
+ void setContentLength(qint64 length) override;
- QList<QPair<QByteArray, QByteArray> > header() const Q_DECL_OVERRIDE;
- QByteArray headerField(const QByteArray &name, const QByteArray &defaultValue = QByteArray()) const Q_DECL_OVERRIDE;
- void setHeaderField(const QByteArray &name, const QByteArray &data) Q_DECL_OVERRIDE;
+ QList<QPair<QByteArray, QByteArray> > header() const override;
+ QByteArray headerField(const QByteArray &name, const QByteArray &defaultValue = QByteArray()) const override;
+ void setHeaderField(const QByteArray &name, const QByteArray &data) override;
Operation operation() const;
void setOperation(Operation operation);
@@ -121,6 +121,9 @@ public:
bool isHTTP2Allowed() const;
void setHTTP2Allowed(bool b);
+ bool isHTTP2Direct() const;
+ void setHTTP2Direct(bool b);
+
bool withCredentials() const;
void setWithCredentials(bool b);
@@ -172,6 +175,7 @@ public:
bool pipeliningAllowed;
bool spdyAllowed;
bool http2Allowed;
+ bool http2Direct;
bool withCredentials;
bool ssl;
bool preConnect;
@@ -184,7 +188,4 @@ QT_END_NAMESPACE
Q_DECLARE_METATYPE(QHttpNetworkRequest)
-#endif // QT_NO_HTTP
-
-
#endif // QHTTPNETWORKREQUEST_H
diff --git a/src/network/access/qhttpprotocolhandler.cpp b/src/network/access/qhttpprotocolhandler.cpp
index 37e8b9bed8..edcbdcbe0e 100644
--- a/src/network/access/qhttpprotocolhandler.cpp
+++ b/src/network/access/qhttpprotocolhandler.cpp
@@ -42,8 +42,6 @@
#include <private/qnoncontiguousbytedevice_p.h>
#include <private/qhttpnetworkconnectionchannel_p.h>
-#ifndef QT_NO_HTTP
-
QT_BEGIN_NAMESPACE
QHttpProtocolHandler::QHttpProtocolHandler(QHttpNetworkConnectionChannel *channel)
@@ -437,5 +435,3 @@ bool QHttpProtocolHandler::sendRequest()
}
QT_END_NAMESPACE
-
-#endif // QT_NO_HTTP
diff --git a/src/network/access/qhttpprotocolhandler_p.h b/src/network/access/qhttpprotocolhandler_p.h
index 863b988be3..8e766604bb 100644
--- a/src/network/access/qhttpprotocolhandler_p.h
+++ b/src/network/access/qhttpprotocolhandler_p.h
@@ -55,7 +55,7 @@
#include <QtNetwork/private/qtnetworkglobal_p.h>
#include <private/qabstractprotocolhandler_p.h>
-#ifndef QT_NO_HTTP
+QT_REQUIRE_CONFIG(http);
QT_BEGIN_NAMESPACE
@@ -64,13 +64,11 @@ public:
QHttpProtocolHandler(QHttpNetworkConnectionChannel *channel);
private:
- virtual void _q_receiveReply() Q_DECL_OVERRIDE;
- virtual void _q_readyRead() Q_DECL_OVERRIDE;
- virtual bool sendRequest() Q_DECL_OVERRIDE;
+ virtual void _q_receiveReply() override;
+ virtual void _q_readyRead() override;
+ virtual bool sendRequest() override;
};
QT_END_NAMESPACE
-#endif // QT_NO_HTTP
-
#endif
diff --git a/src/network/access/qhttpthreaddelegate.cpp b/src/network/access/qhttpthreaddelegate.cpp
index 3204f8da33..0e97acdd9d 100644
--- a/src/network/access/qhttpthreaddelegate.cpp
+++ b/src/network/access/qhttpthreaddelegate.cpp
@@ -50,8 +50,6 @@
#include "private/qnetworkaccesscache_p.h"
#include "private/qnoncontiguousbytedevice_p.h"
-#ifndef QT_NO_HTTP
-
QT_BEGIN_NAMESPACE
static QNetworkReply::NetworkError statusCodeFromHttp(int httpStatusCode, const QUrl &url)
@@ -197,7 +195,7 @@ public:
setShareable(true);
}
- virtual void dispose() Q_DECL_OVERRIDE
+ virtual void dispose() override
{
#if 0 // sample code; do this right with the API
Q_ASSERT(!isWorking());
@@ -292,11 +290,17 @@ void QHttpThreadDelegate::startRequest()
QHttpNetworkConnection::ConnectionType connectionType
= httpRequest.isHTTP2Allowed() ? QHttpNetworkConnection::ConnectionTypeHTTP2
: QHttpNetworkConnection::ConnectionTypeHTTP;
+ if (httpRequest.isHTTP2Direct()) {
+ Q_ASSERT(!httpRequest.isHTTP2Allowed());
+ connectionType = QHttpNetworkConnection::ConnectionTypeHTTP2Direct;
+ }
+
#ifndef QT_NO_SSL
if (ssl && !incomingSslConfiguration.data())
incomingSslConfiguration.reset(new QSslConfiguration);
if (httpRequest.isHTTP2Allowed() && ssl) {
+ // With HTTP2Direct we do not try any protocol negotiation.
QList<QByteArray> protocols;
protocols << QSslConfiguration::ALPNProtocolHTTP2
<< QSslConfiguration::NextProtocolHttp1_1;
@@ -762,6 +766,4 @@ void QHttpThreadDelegate::synchronousProxyAuthenticationRequiredSlot(const QNet
#endif
-#endif // QT_NO_HTTP
-
QT_END_NAMESPACE
diff --git a/src/network/access/qhttpthreaddelegate_p.h b/src/network/access/qhttpthreaddelegate_p.h
index da115d6710..019a8b8b74 100644
--- a/src/network/access/qhttpthreaddelegate_p.h
+++ b/src/network/access/qhttpthreaddelegate_p.h
@@ -68,7 +68,7 @@
#include "qnetworkaccessauthenticationmanager_p.h"
#include <QtNetwork/private/http2protocol_p.h>
-#ifndef QT_NO_HTTP
+QT_REQUIRE_CONFIG(http);
QT_BEGIN_NAMESPACE
@@ -218,12 +218,12 @@ public:
{
}
- qint64 pos() const Q_DECL_OVERRIDE
+ qint64 pos() const override
{
return m_pos;
}
- const char* readPointer(qint64 maximumLength, qint64 &len) Q_DECL_OVERRIDE
+ const char* readPointer(qint64 maximumLength, qint64 &len) override
{
if (m_amount > 0) {
len = m_amount;
@@ -243,7 +243,7 @@ public:
return 0;
}
- bool advanceReadPointer(qint64 a) Q_DECL_OVERRIDE
+ bool advanceReadPointer(qint64 a) override
{
if (m_data == 0)
return false;
@@ -258,7 +258,7 @@ public:
return true;
}
- bool atEnd() const Q_DECL_OVERRIDE
+ bool atEnd() const override
{
if (m_amount > 0)
return false;
@@ -266,7 +266,7 @@ public:
return m_atEnd;
}
- bool reset() Q_DECL_OVERRIDE
+ bool reset() override
{
m_amount = 0;
m_data = 0;
@@ -288,7 +288,7 @@ public:
return b;
}
- qint64 size() const Q_DECL_OVERRIDE
+ qint64 size() const override
{
return m_size;
}
@@ -327,6 +327,4 @@ signals:
QT_END_NAMESPACE
-#endif // QT_NO_HTTP
-
#endif // QHTTPTHREADDELEGATE_H
diff --git a/src/network/access/qnetworkaccessauthenticationmanager.cpp b/src/network/access/qnetworkaccessauthenticationmanager.cpp
index 2b07833cda..b661cc45b3 100644
--- a/src/network/access/qnetworkaccessauthenticationmanager.cpp
+++ b/src/network/access/qnetworkaccessauthenticationmanager.cpp
@@ -95,7 +95,7 @@ public:
}
}
- virtual void dispose() Q_DECL_OVERRIDE { delete this; }
+ virtual void dispose() override { delete this; }
};
#ifndef QT_NO_NETWORKPROXY
diff --git a/src/network/access/qnetworkaccesscache_p.h b/src/network/access/qnetworkaccesscache_p.h
index 3732b5cbb4..69ea649a8a 100644
--- a/src/network/access/qnetworkaccesscache_p.h
+++ b/src/network/access/qnetworkaccesscache_p.h
@@ -106,7 +106,7 @@ signals:
void entryReady(QNetworkAccessCache::CacheableObject *);
protected:
- void timerEvent(QTimerEvent *) Q_DECL_OVERRIDE;
+ void timerEvent(QTimerEvent *) override;
private:
// idea copied from qcache.h
diff --git a/src/network/access/qnetworkaccesscachebackend_p.h b/src/network/access/qnetworkaccesscachebackend_p.h
index 8db1a6b1d5..dfb0ce84d9 100644
--- a/src/network/access/qnetworkaccesscachebackend_p.h
+++ b/src/network/access/qnetworkaccesscachebackend_p.h
@@ -65,12 +65,12 @@ public:
QNetworkAccessCacheBackend();
~QNetworkAccessCacheBackend();
- void open() Q_DECL_OVERRIDE;
- void closeDownstreamChannel() Q_DECL_OVERRIDE;
+ void open() override;
+ void closeDownstreamChannel() override;
void closeUpstreamChannel();
void upstreamReadyRead();
- void downstreamReadyWrite() Q_DECL_OVERRIDE;
+ void downstreamReadyWrite() override;
private:
bool sendCacheContents();
diff --git a/src/network/access/qnetworkaccessdebugpipebackend_p.h b/src/network/access/qnetworkaccessdebugpipebackend_p.h
index 1d1af61dbd..d9a7aabdad 100644
--- a/src/network/access/qnetworkaccessdebugpipebackend_p.h
+++ b/src/network/access/qnetworkaccessdebugpipebackend_p.h
@@ -68,10 +68,10 @@ public:
QNetworkAccessDebugPipeBackend();
virtual ~QNetworkAccessDebugPipeBackend();
- virtual void open() Q_DECL_OVERRIDE;
- virtual void closeDownstreamChannel() Q_DECL_OVERRIDE;
+ virtual void open() override;
+ virtual void closeDownstreamChannel() override;
- virtual void downstreamReadyWrite() Q_DECL_OVERRIDE;
+ virtual void downstreamReadyWrite() override;
protected:
void pushFromSocketToDownstream();
@@ -101,9 +101,9 @@ private:
class QNetworkAccessDebugPipeBackendFactory: public QNetworkAccessBackendFactory
{
public:
- virtual QStringList supportedSchemes() const Q_DECL_OVERRIDE;
+ virtual QStringList supportedSchemes() const override;
virtual QNetworkAccessBackend *create(QNetworkAccessManager::Operation op,
- const QNetworkRequest &request) const Q_DECL_OVERRIDE;
+ const QNetworkRequest &request) const override;
};
#endif // QT_BUILD_INTERNAL
diff --git a/src/network/access/qnetworkaccessfilebackend_p.h b/src/network/access/qnetworkaccessfilebackend_p.h
index 081ff2b9e7..2c01fb1121 100644
--- a/src/network/access/qnetworkaccessfilebackend_p.h
+++ b/src/network/access/qnetworkaccessfilebackend_p.h
@@ -66,10 +66,10 @@ public:
QNetworkAccessFileBackend();
virtual ~QNetworkAccessFileBackend();
- virtual void open() Q_DECL_OVERRIDE;
- virtual void closeDownstreamChannel() Q_DECL_OVERRIDE;
+ virtual void open() override;
+ virtual void closeDownstreamChannel() override;
- virtual void downstreamReadyWrite() Q_DECL_OVERRIDE;
+ virtual void downstreamReadyWrite() override;
public slots:
void uploadReadyReadSlot();
@@ -87,9 +87,9 @@ private:
class QNetworkAccessFileBackendFactory: public QNetworkAccessBackendFactory
{
public:
- virtual QStringList supportedSchemes() const Q_DECL_OVERRIDE;
+ virtual QStringList supportedSchemes() const override;
virtual QNetworkAccessBackend *create(QNetworkAccessManager::Operation op,
- const QNetworkRequest &request) const Q_DECL_OVERRIDE;
+ const QNetworkRequest &request) const override;
};
QT_END_NAMESPACE
diff --git a/src/network/access/qnetworkaccessftpbackend.cpp b/src/network/access/qnetworkaccessftpbackend.cpp
index 0df2569e87..c5404e4221 100644
--- a/src/network/access/qnetworkaccessftpbackend.cpp
+++ b/src/network/access/qnetworkaccessftpbackend.cpp
@@ -94,7 +94,7 @@ public:
setShareable(false);
}
- void dispose() Q_DECL_OVERRIDE
+ void dispose() override
{
connect(this, SIGNAL(done(bool)), this, SLOT(deleteLater()));
close();
diff --git a/src/network/access/qnetworkaccessftpbackend_p.h b/src/network/access/qnetworkaccessftpbackend_p.h
index 0f26d05327..4bd082fb67 100644
--- a/src/network/access/qnetworkaccessftpbackend_p.h
+++ b/src/network/access/qnetworkaccessftpbackend_p.h
@@ -84,10 +84,10 @@ public:
QNetworkAccessFtpBackend();
virtual ~QNetworkAccessFtpBackend();
- virtual void open() Q_DECL_OVERRIDE;
- virtual void closeDownstreamChannel() Q_DECL_OVERRIDE;
+ virtual void open() override;
+ virtual void closeDownstreamChannel() override;
- virtual void downstreamReadyWrite() Q_DECL_OVERRIDE;
+ virtual void downstreamReadyWrite() override;
enum CacheCleanupMode {
ReleaseCachedConnection,
@@ -115,9 +115,9 @@ private:
class QNetworkAccessFtpBackendFactory: public QNetworkAccessBackendFactory
{
public:
- virtual QStringList supportedSchemes() const Q_DECL_OVERRIDE;
+ virtual QStringList supportedSchemes() const override;
virtual QNetworkAccessBackend *create(QNetworkAccessManager::Operation op,
- const QNetworkRequest &request) const Q_DECL_OVERRIDE;
+ const QNetworkRequest &request) const override;
};
QT_END_NAMESPACE
diff --git a/src/network/access/qnetworkaccessmanager.cpp b/src/network/access/qnetworkaccessmanager.cpp
index d5a0261f43..07644b869f 100644
--- a/src/network/access/qnetworkaccessmanager.cpp
+++ b/src/network/access/qnetworkaccessmanager.cpp
@@ -66,10 +66,12 @@
#include "QtNetwork/private/qauthenticator_p.h"
#include "QtNetwork/qsslconfiguration.h"
#include "QtNetwork/qnetworkconfigmanager.h"
-#include "QtNetwork/qhttpmultipart.h"
-#include "qhttpmultipart_p.h"
+#if QT_CONFIG(http)
+#include "qhttpmultipart.h"
+#include "qhttpmultipart_p.h"
#include "qnetworkreplyhttpimpl_p.h"
+#endif
#include "qthread.h"
@@ -469,7 +471,7 @@ QNetworkAccessManager::QNetworkAccessManager(QObject *parent)
qRegisterMetaType<QSslPreSharedKeyAuthenticator *>();
#endif
qRegisterMetaType<QList<QPair<QByteArray,QByteArray> > >();
-#ifndef QT_NO_HTTP
+#if QT_CONFIG(http)
qRegisterMetaType<QHttpNetworkRequest>();
#endif
qRegisterMetaType<QNetworkReply::NetworkError>();
@@ -779,7 +781,9 @@ bool QNetworkAccessManager::isStrictTransportSecurityStoreEnabled() const
/*!
\since 5.9
- Adds HTTP Strict Transport Security policies contained in \a knownHosts into HSTS cache.
+ Adds HTTP Strict Transport Security policies into HSTS cache.
+ \a knownHosts contains the known hosts that have QHstsPolicy
+ information.
\note An expired policy will remove a known host from the cache, if previously
present.
@@ -877,6 +881,7 @@ QNetworkReply *QNetworkAccessManager::post(const QNetworkRequest &request, const
return reply;
}
+#if QT_CONFIG(http)
/*!
\since 4.8
@@ -916,6 +921,7 @@ QNetworkReply *QNetworkAccessManager::put(const QNetworkRequest &request, QHttpM
QNetworkReply *reply = put(newRequest, device);
return reply;
}
+#endif // QT_CONFIG(http)
/*!
Uploads the contents of \a data to the destination \a request and
@@ -1283,6 +1289,7 @@ QNetworkReply *QNetworkAccessManager::sendCustomRequest(const QNetworkRequest &r
return reply;
}
+#if QT_CONFIG(http)
/*!
\since 5.8
@@ -1304,6 +1311,7 @@ QNetworkReply *QNetworkAccessManager::sendCustomRequest(const QNetworkRequest &r
QNetworkReply *reply = sendCustomRequest(newRequest, verb, device);
return reply;
}
+#endif // QT_CONFIG(http)
/*!
Returns a new QNetworkReply object to handle the operation \a op
@@ -1416,7 +1424,7 @@ QNetworkReply *QNetworkAccessManager::createRequest(QNetworkAccessManager::Opera
}
}
-#ifndef QT_NO_HTTP
+#if QT_CONFIG(http)
// Since Qt 5 we use the new QNetworkReplyHttpImpl
if (scheme == QLatin1String("http") || scheme == QLatin1String("preconnect-http")
#ifndef QT_NO_SSL
@@ -1448,7 +1456,7 @@ QNetworkReply *QNetworkAccessManager::createRequest(QNetworkAccessManager::Opera
#endif
return reply;
}
-#endif // QT_NO_HTTP
+#endif // QT_CONFIG(http)
// first step: create the reply
QNetworkReplyImpl *reply = new QNetworkReplyImpl(this);
@@ -1524,7 +1532,7 @@ QStringList QNetworkAccessManager::supportedSchemesImplementation() const
QStringList schemes = d->backendSupportedSchemes();
// Those ones don't exist in backends
-#ifndef QT_NO_HTTP
+#if QT_CONFIG(http)
schemes << QStringLiteral("http");
#ifndef QT_NO_SSL
if (QSslSocket::supportsSsl())
@@ -1991,6 +1999,7 @@ void QNetworkAccessManagerPrivate::_q_networkSessionFailed(QNetworkSession::Sess
#endif // QT_NO_BEARERMANAGEMENT
+#if QT_CONFIG(http)
QNetworkRequest QNetworkAccessManagerPrivate::prepareMultipart(const QNetworkRequest &request, QHttpMultiPart *multiPart)
{
// copy the request, we probably need to add some headers
@@ -2038,6 +2047,7 @@ QNetworkRequest QNetworkAccessManagerPrivate::prepareMultipart(const QNetworkReq
return newRequest;
}
+#endif // QT_CONFIG(http)
QT_END_NAMESPACE
diff --git a/src/network/access/qnetworkaccessmanager.h b/src/network/access/qnetworkaccessmanager.h
index 4806ec0475..a0ce3eddcd 100644
--- a/src/network/access/qnetworkaccessmanager.h
+++ b/src/network/access/qnetworkaccessmanager.h
@@ -100,7 +100,7 @@ public:
Q_ENUM(NetworkAccessibility)
#endif
- explicit QNetworkAccessManager(QObject *parent = Q_NULLPTR);
+ explicit QNetworkAccessManager(QObject *parent = nullptr);
~QNetworkAccessManager();
// ### Qt 6: turn into virtual
@@ -134,14 +134,17 @@ public:
QNetworkReply *get(const QNetworkRequest &request);
QNetworkReply *post(const QNetworkRequest &request, QIODevice *data);
QNetworkReply *post(const QNetworkRequest &request, const QByteArray &data);
- QNetworkReply *post(const QNetworkRequest &request, QHttpMultiPart *multiPart);
QNetworkReply *put(const QNetworkRequest &request, QIODevice *data);
QNetworkReply *put(const QNetworkRequest &request, const QByteArray &data);
- QNetworkReply *put(const QNetworkRequest &request, QHttpMultiPart *multiPart);
QNetworkReply *deleteResource(const QNetworkRequest &request);
- QNetworkReply *sendCustomRequest(const QNetworkRequest &request, const QByteArray &verb, QIODevice *data = Q_NULLPTR);
+ QNetworkReply *sendCustomRequest(const QNetworkRequest &request, const QByteArray &verb, QIODevice *data = nullptr);
QNetworkReply *sendCustomRequest(const QNetworkRequest &request, const QByteArray &verb, const QByteArray &data);
+
+#if QT_CONFIG(http)
+ QNetworkReply *post(const QNetworkRequest &request, QHttpMultiPart *multiPart);
+ QNetworkReply *put(const QNetworkRequest &request, QHttpMultiPart *multiPart);
QNetworkReply *sendCustomRequest(const QNetworkRequest &request, const QByteArray &verb, QHttpMultiPart *multiPart);
+#endif
#ifndef QT_NO_BEARERMANAGEMENT
void setConfiguration(const QNetworkConfiguration &config);
@@ -181,7 +184,7 @@ Q_SIGNALS:
protected:
virtual QNetworkReply *createRequest(Operation op, const QNetworkRequest &request,
- QIODevice *outgoingData = Q_NULLPTR);
+ QIODevice *outgoingData = nullptr);
protected Q_SLOTS:
QStringList supportedSchemesImplementation() const;
diff --git a/src/network/access/qnetworkaccessmanager_p.h b/src/network/access/qnetworkaccessmanager_p.h
index e5257251a4..428110e8bc 100644
--- a/src/network/access/qnetworkaccessmanager_p.h
+++ b/src/network/access/qnetworkaccessmanager_p.h
@@ -164,7 +164,9 @@ public:
#endif
+#if QT_CONFIG(http)
QNetworkRequest prepareMultipart(const QNetworkRequest &request, QHttpMultiPart *multiPart);
+#endif
// this is the cache for storing downloaded files
QAbstractNetworkCache *networkCache;
diff --git a/src/network/access/qnetworkcookiejar.h b/src/network/access/qnetworkcookiejar.h
index f9c1549e20..c3b2200443 100644
--- a/src/network/access/qnetworkcookiejar.h
+++ b/src/network/access/qnetworkcookiejar.h
@@ -54,7 +54,7 @@ class Q_NETWORK_EXPORT QNetworkCookieJar: public QObject
{
Q_OBJECT
public:
- explicit QNetworkCookieJar(QObject *parent = Q_NULLPTR);
+ explicit QNetworkCookieJar(QObject *parent = nullptr);
virtual ~QNetworkCookieJar();
virtual QList<QNetworkCookie> cookiesForUrl(const QUrl &url) const;
diff --git a/src/network/access/qnetworkdiskcache.h b/src/network/access/qnetworkdiskcache.h
index 0e9258f6de..ff7d3192e8 100644
--- a/src/network/access/qnetworkdiskcache.h
+++ b/src/network/access/qnetworkdiskcache.h
@@ -53,7 +53,7 @@ class Q_NETWORK_EXPORT QNetworkDiskCache : public QAbstractNetworkCache
Q_OBJECT
public:
- explicit QNetworkDiskCache(QObject *parent = Q_NULLPTR);
+ explicit QNetworkDiskCache(QObject *parent = nullptr);
~QNetworkDiskCache();
QString cacheDirectory() const;
@@ -62,18 +62,18 @@ public:
qint64 maximumCacheSize() const;
void setMaximumCacheSize(qint64 size);
- qint64 cacheSize() const Q_DECL_OVERRIDE;
- QNetworkCacheMetaData metaData(const QUrl &url) Q_DECL_OVERRIDE;
- void updateMetaData(const QNetworkCacheMetaData &metaData) Q_DECL_OVERRIDE;
- QIODevice *data(const QUrl &url) Q_DECL_OVERRIDE;
- bool remove(const QUrl &url) Q_DECL_OVERRIDE;
- QIODevice *prepare(const QNetworkCacheMetaData &metaData) Q_DECL_OVERRIDE;
- void insert(QIODevice *device) Q_DECL_OVERRIDE;
+ qint64 cacheSize() const override;
+ QNetworkCacheMetaData metaData(const QUrl &url) override;
+ void updateMetaData(const QNetworkCacheMetaData &metaData) override;
+ QIODevice *data(const QUrl &url) override;
+ bool remove(const QUrl &url) override;
+ QIODevice *prepare(const QNetworkCacheMetaData &metaData) override;
+ void insert(QIODevice *device) override;
QNetworkCacheMetaData fileMetaData(const QString &fileName) const;
public Q_SLOTS:
- void clear() Q_DECL_OVERRIDE;
+ void clear() override;
protected:
virtual qint64 expire();
diff --git a/src/network/access/qnetworkfile_p.h b/src/network/access/qnetworkfile_p.h
index dd56b24bd8..e788308d82 100644
--- a/src/network/access/qnetworkfile_p.h
+++ b/src/network/access/qnetworkfile_p.h
@@ -67,7 +67,7 @@ public:
public Q_SLOTS:
void open();
- void close() Q_DECL_OVERRIDE;
+ void close() override;
Q_SIGNALS:
void finished(bool ok);
diff --git a/src/network/access/qnetworkreply.h b/src/network/access/qnetworkreply.h
index d858e07d84..63c2752caf 100644
--- a/src/network/access/qnetworkreply.h
+++ b/src/network/access/qnetworkreply.h
@@ -114,8 +114,8 @@ public:
~QNetworkReply();
// reimplemented from QIODevice
- virtual void close() Q_DECL_OVERRIDE;
- virtual bool isSequential() const Q_DECL_OVERRIDE;
+ virtual void close() override;
+ virtual bool isSequential() const override;
// like QAbstractSocket:
qint64 readBufferSize() const;
@@ -169,9 +169,9 @@ Q_SIGNALS:
void downloadProgress(qint64 bytesReceived, qint64 bytesTotal);
protected:
- explicit QNetworkReply(QObject *parent = Q_NULLPTR);
+ explicit QNetworkReply(QObject *parent = nullptr);
QNetworkReply(QNetworkReplyPrivate &dd, QObject *parent);
- virtual qint64 writeData(const char *data, qint64 len) Q_DECL_OVERRIDE;
+ virtual qint64 writeData(const char *data, qint64 len) override;
void setOperation(QNetworkAccessManager::Operation operation);
void setRequest(const QNetworkRequest &request);
diff --git a/src/network/access/qnetworkreplydataimpl_p.h b/src/network/access/qnetworkreplydataimpl_p.h
index c8b44d7539..81d2110d69 100644
--- a/src/network/access/qnetworkreplydataimpl_p.h
+++ b/src/network/access/qnetworkreplydataimpl_p.h
@@ -67,15 +67,15 @@ class QNetworkReplyDataImpl: public QNetworkReply
public:
QNetworkReplyDataImpl(QObject *parent, const QNetworkRequest &req, const QNetworkAccessManager::Operation op);
~QNetworkReplyDataImpl();
- virtual void abort() Q_DECL_OVERRIDE;
+ virtual void abort() override;
// reimplemented from QNetworkReply
- virtual void close() Q_DECL_OVERRIDE;
- virtual qint64 bytesAvailable() const Q_DECL_OVERRIDE;
- virtual bool isSequential () const Q_DECL_OVERRIDE;
- qint64 size() const Q_DECL_OVERRIDE;
+ virtual void close() override;
+ virtual qint64 bytesAvailable() const override;
+ virtual bool isSequential () const override;
+ qint64 size() const override;
- virtual qint64 readData(char *data, qint64 maxlen) Q_DECL_OVERRIDE;
+ virtual qint64 readData(char *data, qint64 maxlen) override;
Q_DECLARE_PRIVATE(QNetworkReplyDataImpl)
};
diff --git a/src/network/access/qnetworkreplyfileimpl_p.h b/src/network/access/qnetworkreplyfileimpl_p.h
index d6af66152e..55aece0bed 100644
--- a/src/network/access/qnetworkreplyfileimpl_p.h
+++ b/src/network/access/qnetworkreplyfileimpl_p.h
@@ -67,15 +67,15 @@ class QNetworkReplyFileImpl: public QNetworkReply
public:
QNetworkReplyFileImpl(QNetworkAccessManager *manager, const QNetworkRequest &req, const QNetworkAccessManager::Operation op);
~QNetworkReplyFileImpl();
- virtual void abort() Q_DECL_OVERRIDE;
+ virtual void abort() override;
// reimplemented from QNetworkReply
- virtual void close() Q_DECL_OVERRIDE;
- virtual qint64 bytesAvailable() const Q_DECL_OVERRIDE;
- virtual bool isSequential () const Q_DECL_OVERRIDE;
- qint64 size() const Q_DECL_OVERRIDE;
+ virtual void close() override;
+ virtual qint64 bytesAvailable() const override;
+ virtual bool isSequential () const override;
+ qint64 size() const override;
- virtual qint64 readData(char *data, qint64 maxlen) Q_DECL_OVERRIDE;
+ virtual qint64 readData(char *data, qint64 maxlen) override;
private Q_SLOTS:
void fileOpenFinished(bool isOpen);
diff --git a/src/network/access/qnetworkreplyhttpimpl.cpp b/src/network/access/qnetworkreplyhttpimpl.cpp
index 382da0db5a..96016453c2 100644
--- a/src/network/access/qnetworkreplyhttpimpl.cpp
+++ b/src/network/access/qnetworkreplyhttpimpl.cpp
@@ -60,8 +60,6 @@
#include "qnetworkcookiejar.h"
-#ifndef QT_NO_HTTP
-
#include <string.h> // for strchr
QT_BEGIN_NAMESPACE
@@ -773,6 +771,12 @@ void QNetworkReplyHttpImplPrivate::postRequest(const QNetworkRequest &newHttpReq
if (request.attribute(QNetworkRequest::HTTP2AllowedAttribute).toBool())
httpRequest.setHTTP2Allowed(true);
+ if (request.attribute(QNetworkRequest::Http2DirectAttribute).toBool()) {
+ // Intentionally mutually exclusive - cannot be both direct and 'allowed'
+ httpRequest.setHTTP2Direct(true);
+ httpRequest.setHTTP2Allowed(false);
+ }
+
if (static_cast<QNetworkRequest::LoadControl>
(newHttpRequest.attribute(QNetworkRequest::AuthenticationReuseAttribute,
QNetworkRequest::Automatic).toInt()) == QNetworkRequest::Manual)
@@ -1288,7 +1292,9 @@ void QNetworkReplyHttpImplPrivate::replyDownloadMetaData(const QList<QPair<QByte
q->setAttribute(QNetworkRequest::HttpPipeliningWasUsedAttribute, pu);
const QVariant http2Allowed = request.attribute(QNetworkRequest::HTTP2AllowedAttribute);
- if (http2Allowed.isValid() && http2Allowed.toBool()) {
+ const QVariant http2Direct = request.attribute(QNetworkRequest::Http2DirectAttribute);
+ if ((http2Allowed.isValid() && http2Allowed.toBool())
+ || (http2Direct.isValid() && http2Direct.toBool())) {
q->setAttribute(QNetworkRequest::HTTP2WasUsedAttribute, spdyWasUsed);
q->setAttribute(QNetworkRequest::SpdyWasUsedAttribute, false);
} else {
@@ -2375,5 +2381,3 @@ void QNetworkReplyHttpImplPrivate::completeCacheSave()
}
QT_END_NAMESPACE
-
-#endif // QT_NO_HTTP
diff --git a/src/network/access/qnetworkreplyhttpimpl_p.h b/src/network/access/qnetworkreplyhttpimpl_p.h
index 9d47f65ce7..f5f01d0811 100644
--- a/src/network/access/qnetworkreplyhttpimpl_p.h
+++ b/src/network/access/qnetworkreplyhttpimpl_p.h
@@ -72,7 +72,7 @@
#include <QtNetwork/QSslConfiguration>
#endif
-#ifndef QT_NO_HTTP
+QT_REQUIRE_CONFIG(http);
QT_BEGIN_NAMESPACE
@@ -86,14 +86,14 @@ public:
QNetworkReplyHttpImpl(QNetworkAccessManager* const, const QNetworkRequest&, QNetworkAccessManager::Operation&, QIODevice* outgoingData);
virtual ~QNetworkReplyHttpImpl();
- void close() Q_DECL_OVERRIDE;
- void abort() Q_DECL_OVERRIDE;
- qint64 bytesAvailable() const Q_DECL_OVERRIDE;
- bool isSequential () const Q_DECL_OVERRIDE;
- qint64 size() const Q_DECL_OVERRIDE;
- qint64 readData(char*, qint64) Q_DECL_OVERRIDE;
- void setReadBufferSize(qint64 size) Q_DECL_OVERRIDE;
- bool canReadLine () const Q_DECL_OVERRIDE;
+ void close() override;
+ void abort() override;
+ qint64 bytesAvailable() const override;
+ bool isSequential () const override;
+ qint64 size() const override;
+ qint64 readData(char*, qint64) override;
+ void setReadBufferSize(qint64 size) override;
+ bool canReadLine () const override;
Q_DECLARE_PRIVATE(QNetworkReplyHttpImpl)
Q_PRIVATE_SLOT(d_func(), void _q_startOperation())
@@ -141,10 +141,10 @@ public:
#ifndef QT_NO_SSL
protected:
- void ignoreSslErrors() Q_DECL_OVERRIDE;
- void ignoreSslErrorsImplementation(const QList<QSslError> &errors) Q_DECL_OVERRIDE;
- void setSslConfigurationImplementation(const QSslConfiguration &configuration) Q_DECL_OVERRIDE;
- void sslConfigurationImplementation(QSslConfiguration &configuration) const Q_DECL_OVERRIDE;
+ void ignoreSslErrors() override;
+ void ignoreSslErrorsImplementation(const QList<QSslError> &errors) override;
+ void setSslConfigurationImplementation(const QSslConfiguration &configuration) override;
+ void sslConfigurationImplementation(QSslConfiguration &configuration) const override;
#endif
signals:
@@ -315,6 +315,4 @@ public:
QT_END_NAMESPACE
-#endif // QT_NO_HTTP
-
#endif
diff --git a/src/network/access/qnetworkreplyimpl_p.h b/src/network/access/qnetworkreplyimpl_p.h
index 7cd99392d3..f4e8284ab6 100644
--- a/src/network/access/qnetworkreplyimpl_p.h
+++ b/src/network/access/qnetworkreplyimpl_p.h
@@ -76,15 +76,15 @@ class QNetworkReplyImpl: public QNetworkReply
public:
QNetworkReplyImpl(QObject *parent = 0);
~QNetworkReplyImpl();
- virtual void abort() Q_DECL_OVERRIDE;
+ virtual void abort() override;
// reimplemented from QNetworkReply / QIODevice
- virtual void close() Q_DECL_OVERRIDE;
- virtual qint64 bytesAvailable() const Q_DECL_OVERRIDE;
- virtual void setReadBufferSize(qint64 size) Q_DECL_OVERRIDE;
+ virtual void close() override;
+ virtual qint64 bytesAvailable() const override;
+ virtual void setReadBufferSize(qint64 size) override;
- virtual qint64 readData(char *data, qint64 maxlen) Q_DECL_OVERRIDE;
- virtual bool event(QEvent *) Q_DECL_OVERRIDE;
+ virtual qint64 readData(char *data, qint64 maxlen) override;
+ virtual bool event(QEvent *) override;
Q_DECLARE_PRIVATE(QNetworkReplyImpl)
Q_PRIVATE_SLOT(d_func(), void _q_startOperation())
@@ -101,10 +101,10 @@ public:
#ifndef QT_NO_SSL
protected:
- void sslConfigurationImplementation(QSslConfiguration &configuration) const Q_DECL_OVERRIDE;
- void setSslConfigurationImplementation(const QSslConfiguration &configuration) Q_DECL_OVERRIDE;
- virtual void ignoreSslErrors() Q_DECL_OVERRIDE;
- virtual void ignoreSslErrorsImplementation(const QList<QSslError> &errors) Q_DECL_OVERRIDE;
+ void sslConfigurationImplementation(QSslConfiguration &configuration) const override;
+ void setSslConfigurationImplementation(const QSslConfiguration &configuration) override;
+ virtual void ignoreSslErrors() override;
+ virtual void ignoreSslErrorsImplementation(const QList<QSslError> &errors) override;
#endif
};
@@ -219,9 +219,9 @@ public:
QNetworkAccessManager::Operation op);
~QDisabledNetworkReply();
- void abort() Q_DECL_OVERRIDE { }
+ void abort() override { }
protected:
- qint64 readData(char *, qint64) Q_DECL_OVERRIDE { return -1; }
+ qint64 readData(char *, qint64) override { return -1; }
};
#endif
diff --git a/src/network/access/qnetworkrequest.cpp b/src/network/access/qnetworkrequest.cpp
index 60701d45be..99f72a7955 100644
--- a/src/network/access/qnetworkrequest.cpp
+++ b/src/network/access/qnetworkrequest.cpp
@@ -298,6 +298,20 @@ QT_BEGIN_NAMESPACE
This attribute obsoletes FollowRedirectsAttribute.
(This value was introduced in 5.9.)
+ \value Http2DirectAttribute
+ Requests only, type: QMetaType::Bool (default: false)
+ If set, this attribute will force QNetworkAccessManager to use
+ HTTP/2 protocol without initial HTTP/2 protocol negotiation.
+ Use of this attribute implies prior knowledge that a particular
+ server supports HTTP/2. The attribute works with SSL or 'cleartext'
+ HTTP/2. If a server turns out to not support HTTP/2, when HTTP/2 direct
+ was specified, QNetworkAccessManager gives up, without attempting to
+ fall back to HTTP/1.1. If both HTTP2AllowedAttribute and
+ Http2DirectAttribute are set, Http2DirectAttribute takes priority.
+ (This value was introduced in 5.10.)
+
+ \omitvalue ResourceTypeAttribute
+
\value User
Special type. Additional information can be passed in
QVariants with types ranging from User to UserMax. The default
diff --git a/src/network/access/qnetworkrequest.h b/src/network/access/qnetworkrequest.h
index 68d4ae6d6b..e104c139d9 100644
--- a/src/network/access/qnetworkrequest.h
+++ b/src/network/access/qnetworkrequest.h
@@ -92,6 +92,8 @@ public:
HTTP2WasUsedAttribute,
OriginalContentLengthAttribute,
RedirectPolicyAttribute,
+ Http2DirectAttribute,
+ ResourceTypeAttribute, // internal
User = 1000,
UserMax = 32767
diff --git a/src/network/access/qspdyprotocolhandler.cpp b/src/network/access/qspdyprotocolhandler.cpp
index 445a2a1c29..403c01e974 100644
--- a/src/network/access/qspdyprotocolhandler.cpp
+++ b/src/network/access/qspdyprotocolhandler.cpp
@@ -43,7 +43,7 @@
#include <private/qhttpnetworkconnectionchannel_p.h>
#include <QtCore/QtEndian>
-#if !defined(QT_NO_HTTP) && !defined(QT_NO_SSL)
+#if !defined(QT_NO_SSL)
QT_BEGIN_NAMESPACE
@@ -1294,4 +1294,4 @@ qint32 QSpdyProtocolHandler::generateNextStreamID()
QT_END_NAMESPACE
-#endif // !defined(QT_NO_HTTP) && !defined(QT_NO_SSL)
+#endif // !defined(QT_NO_SSL)
diff --git a/src/network/access/qspdyprotocolhandler_p.h b/src/network/access/qspdyprotocolhandler_p.h
index 0a18505b23..dd93a9aba2 100644
--- a/src/network/access/qspdyprotocolhandler_p.h
+++ b/src/network/access/qspdyprotocolhandler_p.h
@@ -58,7 +58,9 @@
#include <zlib.h>
-#if !defined(QT_NO_HTTP) && !defined(QT_NO_SSL)
+QT_REQUIRE_CONFIG(http);
+
+#if !defined(QT_NO_SSL)
QT_BEGIN_NAMESPACE
@@ -101,9 +103,9 @@ public:
Q_DECLARE_FLAGS(SETTINGS_ID_Flags, SETTINGS_ID_Flag)
- virtual void _q_receiveReply() Q_DECL_OVERRIDE;
- virtual void _q_readyRead() Q_DECL_OVERRIDE;
- virtual bool sendRequest() Q_DECL_OVERRIDE;
+ virtual void _q_receiveReply() override;
+ virtual void _q_readyRead() override;
+ virtual bool sendRequest() override;
private slots:
void _q_uploadDataReadyRead();
@@ -223,6 +225,6 @@ Q_DECLARE_OPERATORS_FOR_FLAGS(QSpdyProtocolHandler::SETTINGS_ID_Flags)
QT_END_NAMESPACE
-#endif // !defined(QT_NO_HTTP) && !defined(QT_NO_SSL)
+#endif // !defined(QT_NO_SSL)
#endif // QSPDYPROTOCOLHANDLER_H
diff --git a/src/network/bearer/qnetworkconfigmanager.h b/src/network/bearer/qnetworkconfigmanager.h
index da248bc7d0..e8866999c7 100644
--- a/src/network/bearer/qnetworkconfigmanager.h
+++ b/src/network/bearer/qnetworkconfigmanager.h
@@ -66,7 +66,7 @@ public:
Q_DECLARE_FLAGS(Capabilities, Capability)
- explicit QNetworkConfigurationManager(QObject *parent = Q_NULLPTR);
+ explicit QNetworkConfigurationManager(QObject *parent = nullptr);
virtual ~QNetworkConfigurationManager();
QNetworkConfigurationManager::Capabilities capabilities() const;
diff --git a/src/network/bearer/qnetworksession.h b/src/network/bearer/qnetworksession.h
index d96b8915eb..1b5ae9098b 100644
--- a/src/network/bearer/qnetworksession.h
+++ b/src/network/bearer/qnetworksession.h
@@ -87,7 +87,7 @@ public:
Q_DECLARE_FLAGS(UsagePolicies, UsagePolicy)
- explicit QNetworkSession(const QNetworkConfiguration &connConfig, QObject *parent = Q_NULLPTR);
+ explicit QNetworkSession(const QNetworkConfiguration &connConfig, QObject *parent = nullptr);
virtual ~QNetworkSession();
bool isOpen() const;
@@ -131,8 +131,8 @@ Q_SIGNALS:
void usagePoliciesChanged(QNetworkSession::UsagePolicies usagePolicies);
protected:
- virtual void connectNotify(const QMetaMethod &signal) Q_DECL_OVERRIDE;
- virtual void disconnectNotify(const QMetaMethod &signal) Q_DECL_OVERRIDE;
+ virtual void connectNotify(const QMetaMethod &signal) override;
+ virtual void disconnectNotify(const QMetaMethod &signal) override;
private:
Q_DISABLE_COPY(QNetworkSession)
diff --git a/src/network/configure.json b/src/network/configure.json
index 770921f9a6..94a23bbc78 100644
--- a/src/network/configure.json
+++ b/src/network/configure.json
@@ -108,6 +108,24 @@
},
"use": "network"
},
+ "linux-netlink": {
+ "label": "Linux AF_NETLINK sockets",
+ "type": "compile",
+ "test": {
+ "include": [ "asm/types.h", "linux/netlink.h", "linux/rtnetlink.h", "sys/socket.h" ],
+ "main": [
+ "struct rtattr rta = { };",
+ "struct ifinfomsg ifi = {};",
+ "struct ifaddrmsg ifa = {};",
+ "struct ifa_cacheinfo ci;",
+ "ci.ifa_prefered = ci.ifa_valid = 0;",
+ "(void)RTM_NEWLINK; (void)RTM_NEWADDR;",
+ "(void)IFLA_ADDRESS; (void)IFLA_IFNAME;",
+ "(void)IFA_ADDRESS; (void)IFA_LABEL; (void)IFA_CACHEINFO;",
+ "(void)(IFA_F_SECONDARY | IFA_F_DEPRECATED | IFA_F_PERMANENT | IFA_F_MANAGETEMPADDR);"
+ ]
+ }
+ },
"sctp": {
"label": "SCTP support",
"type": "compile",
@@ -153,6 +171,11 @@
"condition": "libs.libproxy",
"output": [ "privateFeature" ]
},
+ "linux-netlink": {
+ "label": "Linux AF_NETLINK",
+ "condition": "config.linux && tests.linux-netlink",
+ "output": [ "privateFeature" ]
+ },
"openssl": {
"label": "OpenSSL",
"enable": "input.openssl == 'yes' || input.openssl == 'linked' || input.openssl == 'runtime'",
@@ -262,6 +285,12 @@
"section": "Networking",
"condition": "features.temporaryfile",
"output": [ "publicFeature", "feature" ]
+ },
+ "dnslookup": {
+ "label": "QDnsLookup",
+ "purpose": "Provides API for DNS lookups.",
+ "section": "Networking",
+ "output": [ "publicFeature" ]
}
},
@@ -302,6 +331,11 @@ For example:
"getifaddrs", "ipv6ifname", "libproxy",
{
"type": "feature",
+ "args": "linux-netlink",
+ "condition": "config.linux"
+ },
+ {
+ "type": "feature",
"args": "securetransport",
"condition": "config.darwin"
},
diff --git a/src/network/kernel/kernel.pri b/src/network/kernel/kernel.pri
index b822a70e88..11b80d59d5 100644
--- a/src/network/kernel/kernel.pri
+++ b/src/network/kernel/kernel.pri
@@ -7,8 +7,6 @@ HEADERS += kernel/qtnetworkglobal.h \
kernel/qtnetworkglobal_p.h \
kernel/qauthenticator.h \
kernel/qauthenticator_p.h \
- kernel/qdnslookup.h \
- kernel/qdnslookup_p.h \
kernel/qhostaddress.h \
kernel/qhostaddress_p.h \
kernel/qhostinfo.h \
@@ -17,10 +15,10 @@ HEADERS += kernel/qtnetworkglobal.h \
kernel/qnetworkdatagram_p.h \
kernel/qnetworkinterface.h \
kernel/qnetworkinterface_p.h \
+ kernel/qnetworkinterface_unix_p.h \
kernel/qnetworkproxy.h
SOURCES += kernel/qauthenticator.cpp \
- kernel/qdnslookup.cpp \
kernel/qhostaddress.cpp \
kernel/qhostinfo.cpp \
kernel/qnetworkdatagram.cpp \
@@ -32,12 +30,22 @@ qtConfig(ftp) {
SOURCES += kernel/qurlinfo.cpp
}
+qtConfig(dnslookup) {
+ HEADERS += kernel/qdnslookup.h \
+ kernel/qdnslookup_p.h
+
+ SOURCES += kernel/qdnslookup.cpp
+}
+
unix {
- !integrity: SOURCES += kernel/qdnslookup_unix.cpp
- SOURCES += kernel/qhostinfo_unix.cpp kernel/qnetworkinterface_unix.cpp
+ !integrity:qtConfig(dnslookup): SOURCES += kernel/qdnslookup_unix.cpp
+ SOURCES += kernel/qhostinfo_unix.cpp
+
+ qtConfig(linux-netlink): SOURCES += kernel/qnetworkinterface_linux.cpp
+ else: SOURCES += kernel/qnetworkinterface_unix.cpp
}
-android {
+android:qtConfig(dnslookup) {
SOURCES -= kernel/qdnslookup_unix.cpp
SOURCES += kernel/qdnslookup_android.cpp
}
@@ -46,12 +54,12 @@ win32: {
SOURCES += kernel/qhostinfo_win.cpp
!winrt {
- SOURCES += kernel/qdnslookup_win.cpp \
- kernel/qnetworkinterface_win.cpp
+ SOURCES += kernel/qnetworkinterface_win.cpp
+ qtConfig(dnslookup): SOURCES += kernel/qdnslookup_win.cpp
LIBS_PRIVATE += -ldnsapi -liphlpapi
} else {
- SOURCES += kernel/qdnslookup_winrt.cpp \
- kernel/qnetworkinterface_winrt.cpp
+ SOURCES += kernel/qnetworkinterface_winrt.cpp
+ qtConfig(dnslookup): SOURCES += kernel/qdnslookup_winrt.cpp
}
}
@@ -60,6 +68,7 @@ mac {
!uikit: LIBS_PRIVATE += -framework CoreServices -framework SystemConfiguration
}
+uikit:HEADERS += kernel/qnetworkinterface_uikit_p.h
osx:SOURCES += kernel/qnetworkproxy_mac.cpp
else:win32:!winrt: SOURCES += kernel/qnetworkproxy_win.cpp
else: qtConfig(libproxy) {
diff --git a/src/network/kernel/qdnslookup.h b/src/network/kernel/qdnslookup.h
index ead5e650f5..eebd0abe66 100644
--- a/src/network/kernel/qdnslookup.h
+++ b/src/network/kernel/qdnslookup.h
@@ -47,6 +47,8 @@
#include <QtCore/qsharedpointer.h>
#include <QtCore/qstring.h>
+QT_REQUIRE_CONFIG(dnslookup);
+
QT_BEGIN_NAMESPACE
class QHostAddress;
@@ -218,9 +220,9 @@ public:
};
Q_ENUM(Type)
- explicit QDnsLookup(QObject *parent = Q_NULLPTR);
- QDnsLookup(Type type, const QString &name, QObject *parent = Q_NULLPTR);
- QDnsLookup(Type type, const QString &name, const QHostAddress &nameserver, QObject *parent = Q_NULLPTR);
+ explicit QDnsLookup(QObject *parent = nullptr);
+ QDnsLookup(Type type, const QString &name, QObject *parent = nullptr);
+ QDnsLookup(Type type, const QString &name, const QHostAddress &nameserver, QObject *parent = nullptr);
~QDnsLookup();
Error error() const;
diff --git a/src/network/kernel/qdnslookup_p.h b/src/network/kernel/qdnslookup_p.h
index d070286383..4584396efe 100644
--- a/src/network/kernel/qdnslookup_p.h
+++ b/src/network/kernel/qdnslookup_p.h
@@ -60,6 +60,8 @@
#include "QtNetwork/qhostaddress.h"
#include "private/qobject_p.h"
+QT_REQUIRE_CONFIG(dnslookup);
+
QT_BEGIN_NAMESPACE
//#define QDNSLOOKUP_DEBUG
@@ -118,7 +120,7 @@ public:
, requestName(name)
, nameserver(nameserver)
{ }
- void run() Q_DECL_OVERRIDE;
+ void run() override;
signals:
void finished(const QDnsLookupReply &reply);
diff --git a/src/network/kernel/qhostaddress.cpp b/src/network/kernel/qhostaddress.cpp
index a1adc61c4c..bf00c6efce 100644
--- a/src/network/kernel/qhostaddress.cpp
+++ b/src/network/kernel/qhostaddress.cpp
@@ -64,32 +64,6 @@
QT_BEGIN_NAMESPACE
-
-class QHostAddressPrivate : public QSharedData
-{
-public:
- QHostAddressPrivate();
-
- void setAddress(quint32 a_ = 0);
- void setAddress(const quint8 *a_);
- void setAddress(const Q_IPV6ADDR &a_);
-
- bool parse(const QString &ipString);
- void clear();
-
- QString scopeId;
-
- union {
- Q_IPV6ADDR a6; // IPv6 address
- struct { quint64 c[2]; } a6_64;
- struct { quint32 c[4]; } a6_32;
- };
- quint32 a; // IPv4 address
- qint8 protocol;
-
- friend class QHostAddress;
-};
-
QHostAddressPrivate::QHostAddressPrivate()
: a(0), protocol(QAbstractSocket::UnknownNetworkLayerProtocol)
{
@@ -205,6 +179,75 @@ void QHostAddressPrivate::clear()
memset(&a6, 0, sizeof(a6));
}
+AddressClassification QHostAddressPrivate::classify() const
+{
+ if (a) {
+ // This is an IPv4 address or an IPv6 v4-mapped address includes all
+ // IPv6 v4-compat addresses, except for ::ffff:0.0.0.0 (because `a' is
+ // zero). See setAddress(quint8*) below, which calls convertToIpv4(),
+ // for details.
+ // Source: RFC 5735
+ if ((a & 0xff000000U) == 0x7f000000U) // 127.0.0.0/8
+ return LoopbackAddress;
+ if ((a & 0xf0000000U) == 0xe0000000U) // 224.0.0.0/4
+ return MulticastAddress;
+ if ((a & 0xffff0000U) == 0xa9fe0000U) // 169.254.0.0/16
+ return LinkLocalAddress;
+ if ((a & 0xff000000U) == 0) // 0.0.0.0/8 except 0.0.0.0 (handled below)
+ return LocalNetAddress;
+ if ((a & 0xf0000000U) == 0xf0000000U) { // 240.0.0.0/4
+ if (a == 0xffffffffU) // 255.255.255.255
+ return BroadcastAddress;
+ return UnknownAddress;
+ }
+
+ // Not testing for PrivateNetworkAddress and TestNetworkAddress
+ // since we don't need them yet.
+ return GlobalAddress;
+ }
+
+ // As `a' is zero, this address is either ::ffff:0.0.0.0 or a non-v4-mapped IPv6 address.
+ // Source: https://www.iana.org/assignments/ipv6-address-space/ipv6-address-space.xhtml
+ if (a6_64.c[0]) {
+ quint32 high16 = qFromBigEndian(a6_32.c[0]) >> 16;
+ switch (high16 >> 8) {
+ case 0xff: // ff00::/8
+ return MulticastAddress;
+ case 0xfe:
+ switch (high16 & 0xffc0) {
+ case 0xfec0: // fec0::/10
+ return SiteLocalAddress;
+
+ case 0xfe80: // fe80::/10
+ return LinkLocalAddress;
+
+ default: // fe00::/9
+ return UnknownAddress;
+ }
+ case 0xfd: // fc00::/7
+ case 0xfc:
+ return UniqueLocalAddress;
+ default:
+ return GlobalAddress;
+ }
+ }
+
+ quint64 low64 = qFromBigEndian(a6_64.c[1]);
+ if (low64 == 1) // ::1
+ return LoopbackAddress;
+ if (low64 >> 32 == 0xffff) { // ::ffff:0.0.0.0/96
+ Q_ASSERT(quint32(low64) == 0);
+ return LocalNetAddress;
+ }
+ if (low64) // not ::
+ return GlobalAddress;
+
+ if (protocol == QAbstractSocket::UnknownNetworkLayerProtocol)
+ return UnknownAddress;
+
+ // only :: and 0.0.0.0 remain now
+ return LocalNetAddress;
+}
bool QNetmask::setAddress(const QHostAddress &address)
{
@@ -685,7 +728,7 @@ void QHostAddress::setAddress(SpecialAddress address)
*/
quint32 QHostAddress::toIPv4Address() const
{
- return toIPv4Address(Q_NULLPTR);
+ return toIPv4Address(nullptr);
}
/*!
@@ -1154,21 +1197,91 @@ QPair<QHostAddress, int> QHostAddress::parseSubnet(const QString &subnet)
*/
bool QHostAddress::isLoopback() const
{
- if ((d->a & 0xFF000000) == 0x7F000000)
- return true; // v4 range (including IPv6 wrapped IPv4 addresses)
- if (d->protocol == QAbstractSocket::IPv6Protocol) {
-#ifdef __SSE2__
- const __m128i loopback = _mm_setr_epi8(0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1);
- __m128i ipv6 = _mm_loadu_si128((const __m128i *)d->a6.c);
- __m128i cmp = _mm_cmpeq_epi8(ipv6, loopback);
- return _mm_movemask_epi8(cmp) == 0xffff;
-#else
- if (d->a6_64.c[0] != 0 || qFromBigEndian(d->a6_64.c[1]) != 1)
- return false;
-#endif
- return true;
- }
- return false;
+ return d->classify() == LoopbackAddress;
+}
+
+/*!
+ \since 5.11
+
+ Returns \c true if the address is an IPv4 or IPv6 global address, \c false
+ otherwise. A global address is an address that is not reserved for
+ special purposes (like loopback or multicast) or future purposes.
+
+ Note that IPv6 unique local unicast addresses are considered global
+ addresses (see isUniqueLocalUnicast()), as are IPv4 addresses reserved for
+ local networks by \l {https://tools.ietf.org/html/rfc1918}{RFC 1918}.
+
+ Also note that IPv6 site-local addresses are deprecated and should be
+ considered as global in new applications. This function returns true for
+ site-local addresses too.
+
+ \sa isLoopback(), isSiteLocal(), isUniqueLocalUnicast()
+*/
+bool QHostAddress::isGlobal() const
+{
+ return d->classify() & GlobalAddress; // GlobalAddress is a bit
+}
+
+/*!
+ \since 5.11
+
+ Returns \c true if the address is an IPv4 or IPv6 link-local address, \c
+ false otherwise.
+
+ An IPv4 link-local address is an address in the network 169.254.0.0/16. An
+ IPv6 link-local address is one in the network fe80::/10. See the
+ \l{https://www.iana.org/assignments/ipv6-address-space/ipv6-address-space.xhtml}{IANA
+ IPv6 Address Space} registry for more information.
+
+ \sa isLoopback(), isGlobal(). isMulticast(), isSiteLocal(), isUniqueLocalUnicast()
+*/
+bool QHostAddress::isLinkLocal() const
+{
+ return d->classify() == LinkLocalAddress;
+}
+
+/*!
+ \since 5.11
+
+ Returns \c true if the address is an IPv6 site-local address, \c
+ false otherwise.
+
+ An IPv6 site-local address is one in the network fec0::/10. See the
+ \l{https://www.iana.org/assignments/ipv6-address-space/ipv6-address-space.xhtml}{IANA
+ IPv6 Address Space} registry for more information.
+
+ IPv6 site-local addresses are deprecated and should not be depended upon in
+ new applications. New applications should not depend on this function and
+ should consider site-local addresses the same as global (which is why
+ isGlobal() also returns true). Site-local addresses were replaced by Unique
+ Local Addresses (ULA).
+
+ \sa isLoopback(), isGlobal(), isMulticast(), isLinkLocal(), isUniqueLocalUnicast()
+*/
+bool QHostAddress::isSiteLocal() const
+{
+ return d->classify() == SiteLocalAddress;
+}
+
+/*!
+ \since 5.11
+
+ Returns \c true if the address is an IPv6 unique local unicast address, \c
+ false otherwise.
+
+ An IPv6 unique local unicast address is one in the network fc00::/7. See the
+ \l{https://www.iana.org/assignments/ipv6-address-space/ipv6-address-space.xhtml}
+ {IANA IPv6 Address Space} registry for more information.
+
+ Note that Unique local unicast addresses count as global addresses too. RFC
+ 4193 says that, in practice, "applications may treat these addresses like
+ global scoped addresses." Only routers need care about the distinction.
+
+ \sa isLoopback(), isGlobal(), isMulticast(), isLinkLocal(), isUniqueLocalUnicast()
+*/
+bool QHostAddress::isUniqueLocalUnicast() const
+{
+ return d->classify() == UniqueLocalAddress;
}
/*!
@@ -1176,14 +1289,29 @@ bool QHostAddress::isLoopback() const
Returns \c true if the address is an IPv4 or IPv6 multicast address, \c
false otherwise.
+
+ \sa isLoopback(), isGlobal(), isLinkLocal(), isSiteLocal(), isUniqueLocalUnicast()
*/
bool QHostAddress::isMulticast() const
{
- if ((d->a & 0xF0000000) == 0xE0000000)
- return true; // 224.0.0.0-239.255.255.255 (including v4-mapped IPv6 addresses)
- if (d->protocol == QAbstractSocket::IPv6Protocol)
- return d->a6.c[0] == 0xff;
- return false;
+ return d->classify() == MulticastAddress;
+}
+
+/*!
+ \since 5.11
+
+ Returns \c true if the address is the IPv4 broadcast address, \c false
+ otherwise. The IPv4 broadcast address is 255.255.255.255.
+
+ Note that this function does not return true for an IPv4 network's local
+ broadcast address. For that, please use \l QNetworkInterface to obtain the
+ broadcast addresses of the local machine.
+
+ \sa isLoopback(), isGlobal(), isMulticast(), isLinkLocal(), isUniqueLocalUnicast()
+*/
+bool QHostAddress::isBroadcast() const
+{
+ return d->classify() == BroadcastAddress;
}
#ifndef QT_NO_DEBUG_STREAM
diff --git a/src/network/kernel/qhostaddress.h b/src/network/kernel/qhostaddress.h
index fdbdbfc72c..00555f3d8e 100644
--- a/src/network/kernel/qhostaddress.h
+++ b/src/network/kernel/qhostaddress.h
@@ -148,12 +148,18 @@ public:
bool isInSubnet(const QPair<QHostAddress, int> &subnet) const;
bool isLoopback() const;
+ bool isGlobal() const;
+ bool isLinkLocal() const;
+ bool isSiteLocal() const;
+ bool isUniqueLocalUnicast() const;
bool isMulticast() const;
+ bool isBroadcast() const;
static QPair<QHostAddress, int> parseSubnet(const QString &subnet);
friend Q_NETWORK_EXPORT uint qHash(const QHostAddress &key, uint seed) Q_DECL_NOTHROW;
protected:
+ friend class QHostAddressPrivate;
QExplicitlySharedDataPointer<QHostAddressPrivate> d;
};
Q_DECLARE_OPERATORS_FOR_FLAGS(QHostAddress::ConversionMode)
diff --git a/src/network/kernel/qhostaddress_p.h b/src/network/kernel/qhostaddress_p.h
index 5106760ed9..4dc2989011 100644
--- a/src/network/kernel/qhostaddress_p.h
+++ b/src/network/kernel/qhostaddress_p.h
@@ -57,6 +57,22 @@
QT_BEGIN_NAMESPACE
+enum AddressClassification {
+ LoopbackAddress = 1,
+ LocalNetAddress, // RFC 1122
+ LinkLocalAddress, // RFC 4291 (v6), RFC 3927 (v4)
+ MulticastAddress, // RFC 4291 (v6), RFC 3171 (v4)
+ BroadcastAddress, // RFC 919, 922
+
+ GlobalAddress = 16,
+ TestNetworkAddress, // RFC 3849 (v6), RFC 5737 (v4),
+ PrivateNetworkAddress, // RFC 1918
+ UniqueLocalAddress, // RFC 4193
+ SiteLocalAddress, // RFC 4291 (deprecated by RFC 3879, should be treated as global)
+
+ UnknownAddress = 0 // unclassified or reserved
+};
+
class QNetmask
{
// stores 0-32 for IPv4, 0-128 for IPv6, or 255 for invalid
@@ -85,6 +101,35 @@ public:
{ return n1.length == n2.length; }
};
+class QHostAddressPrivate : public QSharedData
+{
+public:
+ QHostAddressPrivate();
+
+ void setAddress(quint32 a_ = 0);
+ void setAddress(const quint8 *a_);
+ void setAddress(const Q_IPV6ADDR &a_);
+
+ bool parse(const QString &ipString);
+ void clear();
+
+ QString scopeId;
+
+ union {
+ Q_IPV6ADDR a6; // IPv6 address
+ struct { quint64 c[2]; } a6_64;
+ struct { quint32 c[4]; } a6_32;
+ };
+ quint32 a; // IPv4 address
+ qint8 protocol;
+
+ AddressClassification classify() const;
+ static AddressClassification classify(const QHostAddress &address)
+ { return address.d->classify(); }
+
+ friend class QHostAddress;
+};
+
QT_END_NAMESPACE
#endif
diff --git a/src/network/kernel/qhostinfo_p.h b/src/network/kernel/qhostinfo_p.h
index dd46818a19..d1da814e54 100644
--- a/src/network/kernel/qhostinfo_p.h
+++ b/src/network/kernel/qhostinfo_p.h
@@ -194,7 +194,7 @@ public:
QHostInfoRunnable(const QString &hn, int i);
QHostInfoRunnable(const QString &hn, int i, const QObject *receiver,
QtPrivate::QSlotObjectBase *slotObj);
- void run() Q_DECL_OVERRIDE;
+ void run() override;
QString toBeLookedUp;
int id;
@@ -225,7 +225,7 @@ public:
QHostInfoLookupManager();
~QHostInfoLookupManager();
- void clear() Q_DECL_OVERRIDE;
+ void clear() override;
void work();
// called from QHostInfo
diff --git a/src/network/kernel/qhostinfo_unix.cpp b/src/network/kernel/qhostinfo_unix.cpp
index 8d2cffc304..d22608e22f 100644
--- a/src/network/kernel/qhostinfo_unix.cpp
+++ b/src/network/kernel/qhostinfo_unix.cpp
@@ -79,6 +79,11 @@ QT_BEGIN_NAMESPACE
# define Q_ADDRCONFIG AI_ADDRCONFIG
#endif
+enum LibResolvFeature {
+ NeedResInit,
+ NeedResNInit
+};
+
typedef struct __res_state *res_state_ptr;
typedef int (*res_init_proto)(void);
@@ -89,9 +94,29 @@ typedef void (*res_nclose_proto)(res_state_ptr);
static res_nclose_proto local_res_nclose = 0;
static res_state_ptr local_res = 0;
-static bool resolveLibraryInternal()
-{
#if QT_CONFIG(library) && !defined(Q_OS_QNX)
+namespace {
+struct LibResolv
+{
+ enum {
+#ifdef RES_NORELOAD
+ // If RES_NORELOAD is defined, then the libc is capable of watching
+ // /etc/resolv.conf for changes and reloading as necessary. So accept
+ // whatever is configured.
+ ReinitNecessary = false
+#else
+ ReinitNecessary = true
+#endif
+ };
+
+ QLibrary lib;
+ LibResolv();
+ ~LibResolv() { lib.unload(); }
+};
+}
+
+LibResolv::LibResolv()
+{
QLibrary lib;
#ifdef LIBRESOLV_SO
lib.setFileName(QStringLiteral(LIBRESOLV_SO));
@@ -100,32 +125,45 @@ static bool resolveLibraryInternal()
{
lib.setFileName(QLatin1String("resolv"));
if (!lib.load())
- return false;
+ return;
}
- local_res_init = res_init_proto(lib.resolve("__res_init"));
- if (!local_res_init)
- local_res_init = res_init_proto(lib.resolve("res_init"));
-
+ // res_ninit is required for localDomainName()
local_res_ninit = res_ninit_proto(lib.resolve("__res_ninit"));
if (!local_res_ninit)
local_res_ninit = res_ninit_proto(lib.resolve("res_ninit"));
-
- if (!local_res_ninit) {
- // if we can't get a thread-safe context, we have to use the global _res state
- local_res = res_state_ptr(lib.resolve("_res"));
- } else {
+ if (local_res_ninit) {
+ // we must now find res_nclose
local_res_nclose = res_nclose_proto(lib.resolve("res_nclose"));
if (!local_res_nclose)
local_res_nclose = res_nclose_proto(lib.resolve("__res_nclose"));
if (!local_res_nclose)
- local_res_ninit = 0;
+ local_res_ninit = nullptr;
}
-#endif
- return true;
+ if (ReinitNecessary || !local_res_ninit) {
+ local_res_init = res_init_proto(lib.resolve("__res_init"));
+ if (!local_res_init)
+ local_res_init = res_init_proto(lib.resolve("res_init"));
+
+ if (local_res_init && !local_res_ninit) {
+ // if we can't get a thread-safe context, we have to use the global _res state
+ local_res = res_state_ptr(lib.resolve("_res"));
+ }
+ }
+}
+Q_GLOBAL_STATIC(LibResolv, libResolv)
+
+static void resolveLibrary(LibResolvFeature f)
+{
+ if (LibResolv::ReinitNecessary || f == NeedResNInit)
+ libResolv();
+}
+#else // QT_CONFIG(library) || Q_OS_QNX
+static void resolveLibrary(LibResolvFeature)
+{
}
-Q_GLOBAL_STATIC_WITH_ARGS(bool, resolveLibrary, (resolveLibraryInternal()))
+#endif // QT_CONFIG(library) || Q_OS_QNX
QHostInfo QHostInfoAgent::fromName(const QString &hostName)
{
@@ -137,7 +175,7 @@ QHostInfo QHostInfoAgent::fromName(const QString &hostName)
#endif
// Load res_init on demand.
- resolveLibrary();
+ resolveLibrary(NeedResInit);
// If res_init is available, poll it.
if (local_res_init)
@@ -275,7 +313,7 @@ QHostInfo QHostInfoAgent::fromName(const QString &hostName)
QString QHostInfo::localDomainName()
{
#if !defined(Q_OS_VXWORKS) && !defined(Q_OS_ANDROID)
- resolveLibrary();
+ resolveLibrary(NeedResNInit);
if (local_res_ninit) {
// using thread-safe version
res_state_ptr state = res_state_ptr(malloc(sizeof(*state)));
diff --git a/src/network/kernel/qnetworkdatagram.cpp b/src/network/kernel/qnetworkdatagram.cpp
index d167190684..50421fa7f5 100644
--- a/src/network/kernel/qnetworkdatagram.cpp
+++ b/src/network/kernel/qnetworkdatagram.cpp
@@ -442,10 +442,11 @@ void QNetworkDatagram::setData(const QByteArray &data)
}
/*!
- \fn QNetworkDatagram QNetworkDatagram::makeReply(const QByteArray &data) const
+ \fn QNetworkDatagram QNetworkDatagram::makeReply(const QByteArray &payload) const &
+ \fn QNetworkDatagram QNetworkDatagram::makeReply(const QByteArray &payload) &&
Creates a new QNetworkDatagram representing a reply to this incoming datagram
- and sets the payload data to \a data. This function is a very convenient
+ and sets the payload data to \a payload. This function is a very convenient
way of responding to a datagram back to the original sender.
Example:
@@ -495,6 +496,7 @@ void QNetworkDatagram::setData(const QByteArray &data)
\endcode
*/
+
static bool isNonMulticast(const QHostAddress &addr)
{
// is it a multicast address?
@@ -528,6 +530,11 @@ void QNetworkDatagram::destroy(QNetworkDatagramPrivate *d)
delete d;
}
+/*! \fn void QNetworkDatagram::swap(QNetworkDatagram &other)
+ Swaps this instance with \a other.
+*/
+
+
QT_END_NAMESPACE
#endif // QT_NO_UDPSOCKET
diff --git a/src/network/kernel/qnetworkdatagram.h b/src/network/kernel/qnetworkdatagram.h
index fa994d6170..1acb44a1e0 100644
--- a/src/network/kernel/qnetworkdatagram.h
+++ b/src/network/kernel/qnetworkdatagram.h
@@ -63,7 +63,7 @@ public:
QNetworkDatagram(QNetworkDatagram &&other) Q_DECL_NOTHROW
: d(other.d)
- { other.d = Q_NULLPTR; }
+ { other.d = nullptr; }
QNetworkDatagram &operator=(QNetworkDatagram &&other) Q_DECL_NOTHROW
{ swap(other); return *this; }
@@ -91,7 +91,7 @@ public:
QByteArray data() const;
void setData(const QByteArray &data);
-#ifdef Q_COMPILER_REF_QUALIFIERS
+#if defined(Q_COMPILER_REF_QUALIFIERS) || defined(Q_CLANG_QDOC)
QNetworkDatagram makeReply(const QByteArray &payload) const &
{ return makeReply_helper(payload); }
QNetworkDatagram makeReply(const QByteArray &payload) &&
diff --git a/src/network/kernel/qnetworkinterface.cpp b/src/network/kernel/qnetworkinterface.cpp
index 3857ff87b9..3fb0dc80ee 100644
--- a/src/network/kernel/qnetworkinterface.cpp
+++ b/src/network/kernel/qnetworkinterface.cpp
@@ -1,7 +1,7 @@
/****************************************************************************
**
** Copyright (C) 2016 The Qt Company Ltd.
-** Copyright (C) 2016 Intel Corporation.
+** Copyright (C) 2017 Intel Corporation.
** Contact: https://www.qt.io/licensing/
**
** This file is part of the QtNetwork module of the Qt Toolkit.
@@ -59,19 +59,15 @@ static QList<QNetworkInterfacePrivate *> postProcess(QList<QNetworkInterfacePriv
// The math is:
// broadcast = IP | ~netmask
- QList<QNetworkInterfacePrivate *>::Iterator it = list.begin();
- const QList<QNetworkInterfacePrivate *>::Iterator end = list.end();
- for ( ; it != end; ++it) {
- QList<QNetworkAddressEntry>::Iterator addr_it = (*it)->addressEntries.begin();
- const QList<QNetworkAddressEntry>::Iterator addr_end = (*it)->addressEntries.end();
- for ( ; addr_it != addr_end; ++addr_it) {
- if (addr_it->ip().protocol() != QAbstractSocket::IPv4Protocol)
+ for (QNetworkInterfacePrivate *interface : list) {
+ for (QNetworkAddressEntry &address : interface->addressEntries) {
+ if (address.ip().protocol() != QAbstractSocket::IPv4Protocol)
continue;
- if (!addr_it->netmask().isNull() && addr_it->broadcast().isNull()) {
- QHostAddress bcast = addr_it->ip();
- bcast = QHostAddress(bcast.toIPv4Address() | ~addr_it->netmask().toIPv4Address());
- addr_it->setBroadcast(bcast);
+ if (!address.netmask().isNull() && address.broadcast().isNull()) {
+ QHostAddress bcast = address.ip();
+ bcast = QHostAddress(bcast.toIPv4Address() | ~address.netmask().toIPv4Address());
+ address.setBroadcast(bcast);
}
}
}
@@ -91,17 +87,16 @@ QNetworkInterfaceManager::~QNetworkInterfaceManager()
QSharedDataPointer<QNetworkInterfacePrivate> QNetworkInterfaceManager::interfaceFromName(const QString &name)
{
- QList<QSharedDataPointer<QNetworkInterfacePrivate> > interfaceList = allInterfaces();
- QList<QSharedDataPointer<QNetworkInterfacePrivate> >::ConstIterator it = interfaceList.constBegin();
+ const auto interfaceList = allInterfaces();
bool ok;
uint index = name.toUInt(&ok);
- for ( ; it != interfaceList.constEnd(); ++it) {
- if (ok && (*it)->index == int(index))
- return *it;
- else if ((*it)->name == name)
- return *it;
+ for (const auto &interface : interfaceList) {
+ if (ok && interface->index == int(index))
+ return interface;
+ else if (interface->name == name)
+ return interface;
}
return empty;
@@ -109,11 +104,11 @@ QSharedDataPointer<QNetworkInterfacePrivate> QNetworkInterfaceManager::interface
QSharedDataPointer<QNetworkInterfacePrivate> QNetworkInterfaceManager::interfaceFromIndex(int index)
{
- QList<QSharedDataPointer<QNetworkInterfacePrivate> > interfaceList = allInterfaces();
- QList<QSharedDataPointer<QNetworkInterfacePrivate> >::ConstIterator it = interfaceList.constBegin();
- for ( ; it != interfaceList.constEnd(); ++it)
- if ((*it)->index == index)
- return *it;
+ const auto interfaceList = allInterfaces();
+ for (const auto &interface : interfaceList) {
+ if (interface->index == index)
+ return interface;
+ }
return empty;
}
@@ -124,8 +119,15 @@ QList<QSharedDataPointer<QNetworkInterfacePrivate> > QNetworkInterfaceManager::a
QList<QSharedDataPointer<QNetworkInterfacePrivate> > result;
result.reserve(list.size());
- for (QNetworkInterfacePrivate *ptr : list)
+ for (QNetworkInterfacePrivate *ptr : list) {
+ if ((ptr->flags & QNetworkInterface::IsUp) == 0) {
+ // if the network interface isn't UP, the addresses are ineligible for DNS
+ for (auto &addr : ptr->addressEntries)
+ addr.setDnsEligibility(QNetworkAddressEntry::DnsIneligible);
+ }
+
result << QSharedDataPointer<QNetworkInterfacePrivate>(ptr);
+ }
return result;
}
@@ -164,6 +166,32 @@ QString QNetworkInterfacePrivate::makeHwAddress(int len, uchar *data)
*/
/*!
+ \enum QNetworkAddressEntry::DnsEligilibilityStatus
+ \since 5.11
+
+ This enum indicates whether a given host address is eligible to be
+ published in the Domain Name System (DNS) or other similar name resolution
+ mechanisms. In general, an address is suitable for publication if it is an
+ address this machine will be reached at for an indeterminate amount of
+ time, though it need not be permanent. For example, addresses obtained via
+ DHCP are often eligible, but cryptographically-generated temporary IPv6
+ addresses are not.
+
+ \value DnsEligibilityUnknown Qt and the operating system could not determine
+ whether this address should be published or not.
+ The application may need to apply further
+ heuristics if it cannot find any eligible
+ addresses.
+ \value DnsEligible This address is eligible for publication in DNS.
+ \value DnsIneligible This address should not be published in DNS and
+ should not be transmitted to other parties,
+ except maybe as the source address of an outgoing
+ packet.
+
+ \sa dnsEligibility(), setDnsEligibility()
+*/
+
+/*!
Constructs an empty QNetworkAddressEntry object.
*/
QNetworkAddressEntry::QNetworkAddressEntry()
@@ -218,6 +246,39 @@ bool QNetworkAddressEntry::operator==(const QNetworkAddressEntry &other) const
}
/*!
+ \since 5.11
+
+ Returns whether this address is eligible for publication in the Domain Name
+ System (DNS) or similar name resolution mechanisms.
+
+ In general, an address is suitable for publication if it is an address this
+ machine will be reached at for an indeterminate amount of time, though it
+ need not be permanent. For example, addresses obtained via DHCP are often
+ eligible, but cryptographically-generated temporary IPv6 addresses are not.
+
+ On some systems, QNetworkInterface will need to heuristically determine
+ which addresses are eligible.
+
+ \sa isLifetimeKnown(), isPermanent(), setDnsEligibility()
+*/
+QNetworkAddressEntry::DnsEligibilityStatus QNetworkAddressEntry::dnsEligibility() const
+{
+ return d->dnsEligibility;
+}
+
+/*!
+ \since 5.11
+
+ Sets the DNS eligibility flag for this address to \a status.
+
+ \sa dnsEligibility()
+*/
+void QNetworkAddressEntry::setDnsEligibility(DnsEligibilityStatus status)
+{
+ d->dnsEligibility = status;
+}
+
+/*!
\fn bool QNetworkAddressEntry::operator!=(const QNetworkAddressEntry &other) const
Returns \c true if this network address entry is different from \a
@@ -340,6 +401,122 @@ void QNetworkAddressEntry::setBroadcast(const QHostAddress &newBroadcast)
}
/*!
+ \since 5.11
+
+ Returns \c true if the address lifetime is known, \c false if not. If the
+ lifetime is not known, both preferredLifetime() and validityLifetime() will
+ return QDeadlineTimer::Forever.
+
+ \sa preferredLifetime(), validityLifetime(), setAddressLifetime(), clearAddressLifetime()
+*/
+bool QNetworkAddressEntry::isLifetimeKnown() const
+{
+ return d->lifetimeKnown;
+}
+
+/*!
+ \since 5.11
+
+ Returns the deadline when this address becomes deprecated (no longer
+ preferred), if known. If the address lifetime is not known (see
+ isLifetimeKnown()), this function always returns QDeadlineTimer::Forever.
+
+ While an address is preferred, it may be used by the operating system as
+ the source address for new, outgoing packets. After it becomes deprecated,
+ it will remain valid for incoming packets for a while longer until finally
+ removed (see validityLifetime()).
+
+ \sa validityLifetime(), isLifetimeKnown(), setAddressLifetime(), clearAddressLifetime()
+*/
+QDeadlineTimer QNetworkAddressEntry::preferredLifetime() const
+{
+ return d->preferredLifetime;
+}
+
+/*!
+ \since 5.11
+
+ Returns the deadline when this address becomes invalid and will be removed
+ from the networking stack, if known. If the address lifetime is not known
+ (see isLifetimeKnown()), this function always returns
+ QDeadlineTimer::Forever.
+
+ While an address is valid, it will be accepted by the operating system as a
+ valid destination address for this machine. Whether it is used as a source
+ address for new, outgoing packets is controlled by, among other rules, the
+ preferred lifetime (see preferredLifetime()).
+
+ \sa preferredLifetime(), isLifetimeKnown(), setAddressLifetime(), clearAddressLifetime()
+*/
+QDeadlineTimer QNetworkAddressEntry::validityLifetime() const
+{
+ return d->validityLifetime;
+}
+
+/*!
+ \since 5.11
+
+ Sets both the preferred and valid lifetimes for this address to the \a
+ preferred and \a validity deadlines, respectively. After this call,
+ isLifetimeKnown() will return \c true, even if both parameters are
+ QDeadlineTimer::Forever.
+
+ \sa preferredLifetime(), validityLifetime(), isLifetimeKnown(), clearAddressLifetime()
+*/
+void QNetworkAddressEntry::setAddressLifetime(QDeadlineTimer preferred, QDeadlineTimer validity)
+{
+ d->preferredLifetime = preferred;
+ d->validityLifetime = validity;
+ d->lifetimeKnown = true;
+}
+
+/*!
+ \since 5.11
+
+ Resets both the preferred and valid lifetimes for this address. After this
+ call, isLifetimeKnown() will return \c false.
+
+ \sa preferredLifetime(), validityLifetime(), isLifetimeKnown(), setAddressLifetime()
+*/
+void QNetworkAddressEntry::clearAddressLifetime()
+{
+ d->preferredLifetime = QDeadlineTimer::Forever;
+ d->validityLifetime = QDeadlineTimer::Forever;
+ d->lifetimeKnown = false;
+}
+
+/*!
+ \since 5.11
+
+ Returns \c true if this address is permanent on this interface, \c false if
+ it's temporary. A permenant address is one which has no expiration time and
+ is often static (manually configured).
+
+ If this information could not be determined, this function returns \c true.
+
+ \note Depending on the operating system and the networking configuration
+ tool, it is possible for a temporary address to be interpreted as
+ permanent, if the tool did not inform the details correctly to the
+ operating system.
+
+ \sa isLifetimeKnown(), validityLifetime(), isTemporary()
+*/
+bool QNetworkAddressEntry::isPermanent() const
+{
+ return d->validityLifetime.isForever();
+}
+
+/*!
+ \fn bool QNetworkAddressEntry::isTemporary() const
+ \since 5.11
+
+ Returns \c true if this address is temporary on this interface, \c false if
+ it's permanent.
+
+ \sa isLifetimeKnown(), validityLifetime(), isPermanent()
+*/
+
+/*!
\class QNetworkInterface
\brief The QNetworkInterface class provides a listing of the host's IP
addresses and network interfaces.
@@ -396,6 +573,57 @@ void QNetworkAddressEntry::setBroadcast(const QHostAddress &newBroadcast)
*/
/*!
+ \enum QNetworkInterface::InterfaceType
+
+ Specifies the type of hardware (PHY layer, OSI level 1) this interface is,
+ if it could be determined. Interface types that are not among those listed
+ below will generally be listed as Unknown, though future versions of Qt may
+ add new enumeration values.
+
+ The possible values are:
+
+ \value Unknown The interface type could not be determined or is not
+ one of the other listed types.
+ \value Loopback The virtual loopback interface, which is assigned
+ the loopback IP addresses (127.0.0.1, ::1).
+ \value Virtual A type of interface determined to be virtual, but
+ not any of the other possible types. For example,
+ tunnel interfaces are (currently) detected as
+ virtual ones.
+ \value Ethernet IEEE 802.3 Ethernet interfaces, though on many
+ systems other types of IEEE 802 interfaces may also
+ be detected as Ethernet (especially Wi-Fi).
+ \value WiFi IEEE 802.11 Wi-Fi interfaces. Note that on some
+ systems, QNetworkInterface may be unable to
+ distinguish regular Ethernet from Wi-Fi and will
+ not return this enum value.
+ \value Ieee80211 An alias for WiFi.
+ \value CanBus ISO 11898 Controller Area Network bus interfaces,
+ usually found on automotive systems.
+ \value Fddi ANSI X3T12 Fiber Distributed Data Interface, a local area
+ network over optical fibers.
+ \value Ppp Point-to-Point Protocol interfaces, establishing a
+ direct connection between two nodes over a lower
+ transport layer (often serial over radio or physical
+ line).
+ \value Slip Serial Line Internet Protocol interfaces.
+ \value Phonet Interfaces using the Linux Phonet socket family, for
+ communication with cellular modems. See the
+ \l {https://www.kernel.org/doc/Documentation/networking/phonet.txt}{Linux kernel documentation}
+ for more information.
+ \value Ieee802154 IEEE 802.15.4 Personal Area Network interfaces, other
+ than 6LoWPAN (see below).
+ \value SixLoWPAN 6LoWPAN (IPv6 over Low-power Wireless Personal Area
+ Networks) interfaces, which operate on IEEE 802.15.4
+ PHY, but have specific header compression schemes
+ for IPv6 and UDP. This type of interface is often
+ used for mesh networking.
+ \value Ieee80216 IEEE 802.16 Wireless Metropolitan Area Network, also
+ known under the commercial name "WiMAX".
+ \value Ieee1394 IEEE 1394 interfaces (a.k.a. "FireWire").
+*/
+
+/*!
Constructs an empty network interface object.
*/
QNetworkInterface::QNetworkInterface()
@@ -461,6 +689,29 @@ int QNetworkInterface::index() const
}
/*!
+ \since 5.11
+
+ Returns the maximum transmission unit on this interface, if known, or 0
+ otherwise.
+
+ The maximum transmission unit is the largest packet that may be sent on
+ this interface without incurring link-level fragmentation. Applications may
+ use this value to calculate the size of the payload that will fit an
+ unfragmented UDP datagram. Remember to subtract the sizes of headers used
+ in your communication over the interface, e.g. TCP (20 bytes) or UDP (12),
+ IPv4 (20) or IPv6 (40, absent some form of header compression), when
+ computing how big a payload you can transmit. Also note that the MTU along
+ the full path (the Path MTU) to the destination may be smaller than the
+ interface's MTU.
+
+ \sa QUdpSocket
+*/
+int QNetworkInterface::maxTransmissionUnit() const
+{
+ return d ? d->mtu : 0;
+}
+
+/*!
Returns the name of this network interface. On Unix systems, this
is a string containing the type of the interface and optionally a
sequence number, such as "eth0", "lo" or "pcn0". On Windows, it's
@@ -499,6 +750,19 @@ QNetworkInterface::InterfaceFlags QNetworkInterface::flags() const
}
/*!
+ \since 5.11
+
+ Returns the type of this interface, if it could be determined. If it could
+ not be determined, this function returns QNetworkInterface::Unknown.
+
+ \sa hardwareAddress()
+*/
+QNetworkInterface::InterfaceType QNetworkInterface::type() const
+{
+ return d ? d->type : Unknown;
+}
+
+/*!
Returns the low-level hardware address for this interface. On
Ethernet interfaces, this will be a MAC address in string
representation, separated by colons.
@@ -506,6 +770,8 @@ QNetworkInterface::InterfaceFlags QNetworkInterface::flags() const
Other interface types may have other types of hardware
addresses. Implementations should not depend on this function
returning a valid MAC address.
+
+ \sa type()
*/
QString QNetworkInterface::hardwareAddress() const
{
@@ -691,4 +957,6 @@ QDebug operator<<(QDebug debug, const QNetworkInterface &networkInterface)
QT_END_NAMESPACE
+#include "moc_qnetworkinterface.cpp"
+
#endif // QT_NO_NETWORKINTERFACE
diff --git a/src/network/kernel/qnetworkinterface.h b/src/network/kernel/qnetworkinterface.h
index c31621c3cb..f7ef192dc0 100644
--- a/src/network/kernel/qnetworkinterface.h
+++ b/src/network/kernel/qnetworkinterface.h
@@ -49,13 +49,19 @@
QT_BEGIN_NAMESPACE
-
+class QDeadlineTimer;
template<typename T> class QList;
class QNetworkAddressEntryPrivate;
class Q_NETWORK_EXPORT QNetworkAddressEntry
{
public:
+ enum DnsEligibilityStatus : qint8 {
+ DnsEligibilityUnknown = -1,
+ DnsIneligible = 0,
+ DnsEligible = 1
+ };
+
QNetworkAddressEntry();
QNetworkAddressEntry(const QNetworkAddressEntry &other);
#ifdef Q_COMPILER_RVALUE_REFS
@@ -70,6 +76,9 @@ public:
inline bool operator!=(const QNetworkAddressEntry &other) const
{ return !(*this == other); }
+ DnsEligibilityStatus dnsEligibility() const;
+ void setDnsEligibility(DnsEligibilityStatus status);
+
QHostAddress ip() const;
void setIp(const QHostAddress &newIp);
@@ -81,6 +90,14 @@ public:
QHostAddress broadcast() const;
void setBroadcast(const QHostAddress &newBroadcast);
+ bool isLifetimeKnown() const;
+ QDeadlineTimer preferredLifetime() const;
+ QDeadlineTimer validityLifetime() const;
+ void setAddressLifetime(QDeadlineTimer preferred, QDeadlineTimer validity);
+ void clearAddressLifetime();
+ bool isPermanent() const;
+ bool isTemporary() const { return !isPermanent(); }
+
private:
QScopedPointer<QNetworkAddressEntryPrivate> d;
};
@@ -90,6 +107,7 @@ Q_DECLARE_SHARED(QNetworkAddressEntry)
class QNetworkInterfacePrivate;
class Q_NETWORK_EXPORT QNetworkInterface
{
+ Q_GADGET
public:
enum InterfaceFlag {
IsUp = 0x1,
@@ -100,6 +118,27 @@ public:
CanMulticast = 0x20
};
Q_DECLARE_FLAGS(InterfaceFlags, InterfaceFlag)
+ Q_FLAG(InterfaceFlags)
+
+ enum InterfaceType {
+ Loopback = 1,
+ Virtual,
+ Ethernet,
+ Slip,
+ CanBus,
+ Ppp,
+ Fddi,
+ Wifi,
+ Ieee80211 = Wifi, // alias
+ Phonet,
+ Ieee802154,
+ SixLoWPAN, // 6LoWPAN, but we can't start with a digit
+ Ieee80216,
+ Ieee1394,
+
+ Unknown = 0
+ };
+ Q_ENUM(InterfaceType)
QNetworkInterface();
QNetworkInterface(const QNetworkInterface &other);
@@ -114,9 +153,11 @@ public:
bool isValid() const;
int index() const;
+ int maxTransmissionUnit() const;
QString name() const;
QString humanReadableName() const;
InterfaceFlags flags() const;
+ InterfaceType type() const;
QString hardwareAddress() const;
QList<QNetworkAddressEntry> addressEntries() const;
diff --git a/src/network/kernel/qnetworkinterface_linux.cpp b/src/network/kernel/qnetworkinterface_linux.cpp
new file mode 100644
index 0000000000..01b2811070
--- /dev/null
+++ b/src/network/kernel/qnetworkinterface_linux.cpp
@@ -0,0 +1,443 @@
+/****************************************************************************
+**
+** Copyright (C) 2017 Intel Corporation.
+** Contact: https://www.qt.io/licensing/
+**
+** This file is part of the QtNetwork module of the Qt Toolkit.
+**
+** $QT_BEGIN_LICENSE:LGPL$
+** Commercial License Usage
+** Licensees holding valid commercial Qt licenses may use this file in
+** accordance with the commercial license agreement provided with the
+** Software or, alternatively, in accordance with the terms contained in
+** a written agreement between you and The Qt Company. For licensing terms
+** and conditions see https://www.qt.io/terms-conditions. For further
+** information use the contact form at https://www.qt.io/contact-us.
+**
+** GNU Lesser General Public License Usage
+** Alternatively, this file may be used under the terms of the GNU Lesser
+** General Public License version 3 as published by the Free Software
+** Foundation and appearing in the file LICENSE.LGPL3 included in the
+** packaging of this file. Please review the following information to
+** ensure the GNU Lesser General Public License version 3 requirements
+** will be met: https://www.gnu.org/licenses/lgpl-3.0.html.
+**
+** GNU General Public License Usage
+** Alternatively, this file may be used under the terms of the GNU
+** General Public License version 2.0 or (at your option) the GNU General
+** Public license version 3 or any later version approved by the KDE Free
+** Qt Foundation. The licenses are as published by the Free Software
+** Foundation and appearing in the file LICENSE.GPL2 and LICENSE.GPL3
+** included in the packaging of this file. Please review the following
+** information to ensure the GNU General Public License requirements will
+** be met: https://www.gnu.org/licenses/gpl-2.0.html and
+** https://www.gnu.org/licenses/gpl-3.0.html.
+**
+** $QT_END_LICENSE$
+**
+****************************************************************************/
+
+#include "qnetworkinterface.h"
+#include "qnetworkinterface_p.h"
+#include "qnetworkinterface_unix_p.h"
+
+#include <qendian.h>
+#include <qobjectdefs.h>
+#include <qvarlengtharray.h>
+
+// accordding to rtnetlink(7)
+#include <asm/types.h>
+#include <linux/if.h>
+#include <linux/if_arp.h>
+#include <linux/netlink.h>
+#include <linux/rtnetlink.h>
+#include <linux/wireless.h>
+#include <sys/socket.h>
+
+/* in case these aren't defined in linux/if_arp.h (added since 2.6.28) */
+#define ARPHRD_PHONET 820 /* v2.6.29: PhoNet media type */
+#define ARPHRD_PHONET_PIPE 821 /* v2.6.29: PhoNet pipe header */
+#define ARPHRD_IEEE802154 804 /* v2.6.31 */
+#define ARPHRD_6LOWPAN 825 /* v3.14: IPv6 over LoWPAN */
+
+QT_BEGIN_NAMESPACE
+
+enum {
+ BufferSize = 8192
+};
+
+static QNetworkInterface::InterfaceType probeIfType(int socket, struct ifreq *req, short arptype)
+{
+ switch (ushort(arptype)) {
+ case ARPHRD_LOOPBACK:
+ return QNetworkInterface::Loopback;
+
+ case ARPHRD_ETHER:
+ // check if it's a WiFi interface
+ if (qt_safe_ioctl(socket, SIOCGIWMODE, req) >= 0)
+ return QNetworkInterface::Wifi;
+ return QNetworkInterface::Ethernet;
+
+ case ARPHRD_SLIP:
+ case ARPHRD_CSLIP:
+ case ARPHRD_SLIP6:
+ case ARPHRD_CSLIP6:
+ return QNetworkInterface::Slip;
+
+ case ARPHRD_CAN:
+ return QNetworkInterface::CanBus;
+
+ case ARPHRD_PPP:
+ return QNetworkInterface::Ppp;
+
+ case ARPHRD_FDDI:
+ return QNetworkInterface::Fddi;
+
+ case ARPHRD_IEEE80211:
+ case ARPHRD_IEEE80211_PRISM:
+ case ARPHRD_IEEE80211_RADIOTAP:
+ return QNetworkInterface::Ieee80211;
+
+ case ARPHRD_IEEE802154:
+ return QNetworkInterface::Ieee802154;
+
+ case ARPHRD_PHONET:
+ case ARPHRD_PHONET_PIPE:
+ return QNetworkInterface::Phonet;
+
+ case ARPHRD_6LOWPAN:
+ return QNetworkInterface::SixLoWPAN;
+
+ case ARPHRD_TUNNEL:
+ case ARPHRD_TUNNEL6:
+ case ARPHRD_NONE:
+ case ARPHRD_VOID:
+ return QNetworkInterface::Virtual;
+ }
+ return QNetworkInterface::Unknown;
+}
+
+
+namespace {
+struct NetlinkSocket
+{
+ int sock;
+ NetlinkSocket(int bufferSize)
+ {
+ sock = qt_safe_socket(AF_NETLINK, SOCK_DGRAM, NETLINK_ROUTE);
+ if (Q_UNLIKELY(sock == -1))
+ qErrnoWarning("Could not create AF_NETLINK socket");
+
+ // set buffer length
+ socklen_t len = sizeof(bufferSize);
+ setsockopt(sock, SOL_SOCKET, SO_SNDBUF, &bufferSize, len);
+ }
+
+ ~NetlinkSocket()
+ {
+ if (sock != -1)
+ qt_safe_close(sock);
+ }
+
+ operator int() const { return sock; }
+};
+
+template <typename Lambda> struct ProcessNetlinkRequest
+{
+ using FunctionTraits = QtPrivate::FunctionPointer<decltype(&Lambda::operator())>;
+ using FirstArgument = typename FunctionTraits::Arguments::Car;
+
+ static int expectedTypeForRequest(int rtype)
+ {
+ Q_STATIC_ASSERT(RTM_NEWADDR == RTM_GETADDR - 2);
+ Q_STATIC_ASSERT(RTM_NEWLINK == RTM_GETLINK - 2);
+ Q_ASSERT(rtype == RTM_GETADDR || rtype == RTM_GETLINK);
+ return rtype - 2;
+ }
+
+ void operator()(int sock, nlmsghdr *hdr, char *buf, size_t bufsize, Lambda &&func)
+ {
+ // send the request
+ if (send(sock, hdr, hdr->nlmsg_len, 0) != ssize_t(hdr->nlmsg_len))
+ return;
+
+ // receive and parse the request
+ int expectedType = expectedTypeForRequest(hdr->nlmsg_type);
+ const bool isDump = hdr->nlmsg_flags & NLM_F_DUMP;
+ forever {
+ qsizetype len = recv(sock, buf, bufsize, 0);
+ hdr = reinterpret_cast<struct nlmsghdr *>(buf);
+ if (!NLMSG_OK(hdr, len))
+ return;
+
+ auto arg = reinterpret_cast<FirstArgument>(NLMSG_DATA(hdr));
+ size_t payloadLen = NLMSG_PAYLOAD(hdr, 0);
+
+ // is this a multipart message?
+ Q_ASSERT(isDump == !!(hdr->nlmsg_flags & NLM_F_MULTI));
+ if (!isDump) {
+ // no, single message
+ if (hdr->nlmsg_type == expectedType && payloadLen >= sizeof(FirstArgument))
+ return void(func(arg, payloadLen));
+ } else {
+ // multipart, parse until done
+ do {
+ if (hdr->nlmsg_type == NLMSG_DONE)
+ return;
+ if (hdr->nlmsg_type != expectedType || payloadLen < sizeof(FirstArgument))
+ break;
+ func(arg, payloadLen);
+
+ // NLMSG_NEXT also updates the len variable
+ hdr = NLMSG_NEXT(hdr, len);
+ arg = reinterpret_cast<FirstArgument>(NLMSG_DATA(hdr));
+ payloadLen = NLMSG_PAYLOAD(hdr, 0);
+ } while (NLMSG_OK(hdr, len));
+
+ if (len == 0)
+ continue; // get new datagram
+ }
+
+#ifndef QT_NO_DEBUG
+ if (NLMSG_OK(hdr, len))
+ qWarning("QNetworkInterface/AF_NETLINK: received unknown packet type (%d) or too short (%u)",
+ hdr->nlmsg_type, hdr->nlmsg_len);
+ else
+ qWarning("QNetworkInterface/AF_NETLINK: received invalid packet with size %d", int(len));
+#endif
+ return;
+ }
+ }
+};
+
+template <typename Lambda>
+void processNetlinkRequest(int sock, struct nlmsghdr *hdr, char *buf, size_t bufsize, Lambda &&l)
+{
+ ProcessNetlinkRequest<Lambda>()(sock, hdr, buf, bufsize, std::forward<Lambda>(l));
+}
+}
+
+uint QNetworkInterfaceManager::interfaceIndexFromName(const QString &name)
+{
+ uint index = 0;
+ if (name.length() >= IFNAMSIZ)
+ return index;
+
+ int socket = qt_safe_socket(AF_INET, SOCK_DGRAM, 0);
+ if (socket >= 0) {
+ struct ifreq req;
+ req.ifr_ifindex = 0;
+ strcpy(req.ifr_name, name.toLatin1().constData());
+
+ if (qt_safe_ioctl(socket, SIOCGIFINDEX, &req) >= 0)
+ index = req.ifr_ifindex;
+ qt_safe_close(socket);
+ }
+ return index;
+}
+
+QString QNetworkInterfaceManager::interfaceNameFromIndex(uint index)
+{
+ int socket = qt_safe_socket(AF_INET, SOCK_DGRAM, 0);
+ if (socket >= 0) {
+ struct ifreq req;
+ req.ifr_ifindex = index;
+
+ if (qt_safe_ioctl(socket, SIOCGIFNAME, &req) >= 0) {
+ qt_safe_close(socket);
+ return QString::fromLatin1(req.ifr_name);
+ }
+ qt_safe_close(socket);
+ }
+ return QString();
+}
+
+static QList<QNetworkInterfacePrivate *> getInterfaces(int sock, char *buf)
+{
+ QList<QNetworkInterfacePrivate *> result;
+ struct ifreq req;
+
+ // request all links
+ struct {
+ struct nlmsghdr req;
+ struct ifinfomsg ifi;
+ } ifi_req;
+ memset(&ifi_req, 0, sizeof(ifi_req));
+
+ ifi_req.req.nlmsg_len = sizeof(ifi_req);
+ ifi_req.req.nlmsg_flags = NLM_F_REQUEST | NLM_F_DUMP;
+ ifi_req.req.nlmsg_type = RTM_GETLINK;
+
+ // parse the interfaces
+ processNetlinkRequest(sock, &ifi_req.req, buf, BufferSize, [&](ifinfomsg *ifi, size_t len) {
+ auto iface = new QNetworkInterfacePrivate;
+ iface->index = ifi->ifi_index;
+ iface->flags = convertFlags(ifi->ifi_flags);
+
+ // read attributes
+ auto rta = reinterpret_cast<struct rtattr *>(ifi + 1);
+ len -= sizeof(*ifi);
+ for ( ; RTA_OK(rta, len); rta = RTA_NEXT(rta, len)) {
+ int payloadLen = RTA_PAYLOAD(rta);
+ auto payloadPtr = reinterpret_cast<char *>(RTA_DATA(rta));
+
+ switch (rta->rta_type) {
+ case IFLA_ADDRESS: // link-level address
+ iface->hardwareAddress =
+ iface->makeHwAddress(payloadLen, reinterpret_cast<uchar *>(payloadPtr));
+ break;
+
+ case IFLA_IFNAME: // interface name
+ Q_ASSERT(payloadLen <= int(sizeof(req.ifr_name)));
+ memcpy(req.ifr_name, payloadPtr, payloadLen); // including terminating NUL
+ iface->name = QString::fromLatin1(payloadPtr, payloadLen - 1);
+ break;
+
+ case IFLA_MTU:
+ Q_ASSERT(payloadLen == sizeof(int));
+ iface->mtu = *reinterpret_cast<int *>(payloadPtr);
+ break;
+
+ case IFLA_OPERSTATE: // operational state
+ if (*payloadPtr != IF_OPER_UNKNOWN) {
+ // override the flag
+ iface->flags &= ~QNetworkInterface::IsUp;
+ if (*payloadPtr == IF_OPER_UP)
+ iface->flags |= QNetworkInterface::IsUp;
+ }
+ break;
+ }
+ }
+
+ if (Q_UNLIKELY(iface->name.isEmpty())) {
+ qWarning("QNetworkInterface: found interface %d with no name", iface->index);
+ delete iface;
+ } else {
+ iface->type = probeIfType(sock, &req, ifi->ifi_type);
+ result.append(iface);
+ }
+ });
+ return result;
+}
+
+static void getAddresses(int sock, char *buf, QList<QNetworkInterfacePrivate *> &result)
+{
+ // request all addresses
+ struct {
+ struct nlmsghdr req;
+ struct ifaddrmsg ifa;
+ } ifa_req;
+ memset(&ifa_req, 0, sizeof(ifa_req));
+
+ ifa_req.req.nlmsg_len = sizeof(ifa_req);
+ ifa_req.req.nlmsg_flags = NLM_F_REQUEST | NLM_F_DUMP;
+ ifa_req.req.nlmsg_type = RTM_GETADDR;
+ ifa_req.req.nlmsg_seq = 1;
+
+ // parse the addresses
+ processNetlinkRequest(sock, &ifa_req.req, buf, BufferSize, [&](ifaddrmsg *ifa, size_t len) {
+ if (Q_UNLIKELY(ifa->ifa_family != AF_INET && ifa->ifa_family != AF_INET6)) {
+ // unknown address types
+ return;
+ }
+
+ // find the interface this is relevant to
+ QNetworkInterfacePrivate *iface = nullptr;
+ for (auto candidate : qAsConst(result)) {
+ if (candidate->index != int(ifa->ifa_index))
+ continue;
+ iface = candidate;
+ break;
+ }
+
+ if (Q_UNLIKELY(!iface)) {
+ qWarning("QNetworkInterface/AF_NETLINK: found unknown interface with index %d", ifa->ifa_index);
+ return;
+ }
+
+ QNetworkAddressEntry entry;
+ quint32 flags = ifa->ifa_flags; // may be overwritten by IFA_FLAGS
+
+ auto makeAddress = [=](uchar *ptr, int len) {
+ QHostAddress addr;
+ if (ifa->ifa_family == AF_INET) {
+ Q_ASSERT(len == 4);
+ addr.setAddress(qFromBigEndian<quint32>(ptr));
+ } else {
+ Q_ASSERT(len == 16);
+ addr.setAddress(ptr);
+
+ // do we need a scope ID?
+ if (addr.isLinkLocal())
+ addr.setScopeId(iface->name);
+ }
+ return addr;
+ };
+
+ // read attributes
+ auto rta = reinterpret_cast<struct rtattr *>(ifa + 1);
+ len -= sizeof(*ifa);
+ for ( ; RTA_OK(rta, len); rta = RTA_NEXT(rta, len)) {
+ int payloadLen = RTA_PAYLOAD(rta);
+ auto payloadPtr = reinterpret_cast<uchar *>(RTA_DATA(rta));
+
+ switch (rta->rta_type) {
+ case IFA_ADDRESS: // address
+ entry.setIp(makeAddress(payloadPtr, payloadLen));
+ break;
+
+ case IFA_BROADCAST:
+ Q_ASSERT(ifa->ifa_family == AF_INET);
+ entry.setBroadcast(makeAddress(payloadPtr, payloadLen));
+ break;
+
+ case IFA_CACHEINFO:
+ if (size_t(payloadLen) >= sizeof(ifa_cacheinfo)) {
+ auto cacheinfo = reinterpret_cast<ifa_cacheinfo *>(payloadPtr);
+ auto toDeadline = [](quint32 lifetime) -> QDeadlineTimer {
+ if (lifetime == quint32(-1))
+ return QDeadlineTimer::Forever;
+ return QDeadlineTimer(lifetime * 1000);
+ };
+ entry.setAddressLifetime(toDeadline(cacheinfo->ifa_prefered), toDeadline(cacheinfo->ifa_valid));
+ }
+ break;
+
+ case IFA_FLAGS:
+ Q_ASSERT(payloadLen == 4);
+ flags = qFromUnaligned<quint32>(payloadPtr);
+ break;
+ }
+ }
+
+ // now handle flags
+ QNetworkInterfacePrivate::calculateDnsEligibility(&entry,
+ flags & IFA_F_TEMPORARY,
+ flags & IFA_F_DEPRECATED);
+
+
+ if (!entry.ip().isNull()) {
+ entry.setPrefixLength(ifa->ifa_prefixlen);
+ iface->addressEntries.append(entry);
+ }
+ });
+}
+
+QList<QNetworkInterfacePrivate *> QNetworkInterfaceManager::scan()
+{
+ // open netlink socket
+ QList<QNetworkInterfacePrivate *> result;
+ NetlinkSocket sock(BufferSize);
+ if (Q_UNLIKELY(sock == -1))
+ return result;
+
+ QByteArray buffer(BufferSize, Qt::Uninitialized);
+ char *buf = buffer.data();
+
+ result = getInterfaces(sock, buf);
+ getAddresses(sock, buf, result);
+
+ return result;
+}
+
+QT_END_NAMESPACE
diff --git a/src/network/kernel/qnetworkinterface_p.h b/src/network/kernel/qnetworkinterface_p.h
index 51901eeda8..87a46b75fa 100644
--- a/src/network/kernel/qnetworkinterface_p.h
+++ b/src/network/kernel/qnetworkinterface_p.h
@@ -52,7 +52,9 @@
//
#include <QtNetwork/private/qtnetworkglobal_p.h>
+#include <QtNetwork/qnetworkinterface.h>
#include <QtCore/qatomic.h>
+#include <QtCore/qdeadlinetimer.h>
#include <QtCore/qlist.h>
#include <QtCore/qreadwritelock.h>
#include <QtCore/qstring.h>
@@ -69,7 +71,12 @@ class QNetworkAddressEntryPrivate
public:
QHostAddress address;
QHostAddress broadcast;
+ QDeadlineTimer preferredLifetime = QDeadlineTimer::Forever;
+ QDeadlineTimer validityLifetime = QDeadlineTimer::Forever;
+
QNetmask netmask;
+ bool lifetimeKnown = false;
+ QNetworkAddressEntry::DnsEligibilityStatus dnsEligibility = QNetworkAddressEntry::DnsEligibilityUnknown;
};
class QNetworkInterfacePrivate: public QSharedData
@@ -81,7 +88,9 @@ public:
{ }
int index; // interface index, if know
+ int mtu = 0;
QNetworkInterface::InterfaceFlags flags;
+ QNetworkInterface::InterfaceType type = QNetworkInterface::Unknown;
QString name;
QString friendlyName;
@@ -90,6 +99,20 @@ public:
QList<QNetworkAddressEntry> addressEntries;
static QString makeHwAddress(int len, uchar *data);
+ static void calculateDnsEligibility(QNetworkAddressEntry *entry, bool isTemporary,
+ bool isDeprecated)
+ {
+ // this implements an algorithm that yields the same results as Windows
+ // produces, for the same input (as far as I can test)
+ if (isTemporary || isDeprecated)
+ entry->setDnsEligibility(QNetworkAddressEntry::DnsIneligible);
+
+ AddressClassification cl = QHostAddressPrivate::classify(entry->ip());
+ if (cl == LoopbackAddress || cl == LinkLocalAddress)
+ entry->setDnsEligibility(QNetworkAddressEntry::DnsIneligible);
+ else
+ entry->setDnsEligibility(QNetworkAddressEntry::DnsEligible);
+ }
private:
// disallow copying -- avoid detaching
diff --git a/src/network/kernel/qnetworkinterface_uikit_p.h b/src/network/kernel/qnetworkinterface_uikit_p.h
new file mode 100644
index 0000000000..ea40e74f5c
--- /dev/null
+++ b/src/network/kernel/qnetworkinterface_uikit_p.h
@@ -0,0 +1,262 @@
+/****************************************************************************
+**
+** Copyright (C) 2017 The Qt Company Ltd.
+** Contact: https://www.qt.io/licensing/
+**
+** This file is part of the QtNetwork module of the Qt Toolkit.
+**
+** $QT_BEGIN_LICENSE:LGPL$
+** Commercial License Usage
+** Licensees holding valid commercial Qt licenses may use this file in
+** accordance with the commercial license agreement provided with the
+** Software or, alternatively, in accordance with the terms contained in
+** a written agreement between you and The Qt Company. For licensing terms
+** and conditions see https://www.qt.io/terms-conditions. For further
+** information use the contact form at https://www.qt.io/contact-us.
+**
+** GNU Lesser General Public License Usage
+** Alternatively, this file may be used under the terms of the GNU Lesser
+** General Public License version 3 as published by the Free Software
+** Foundation and appearing in the file LICENSE.LGPL3 included in the
+** packaging of this file. Please review the following information to
+** ensure the GNU Lesser General Public License version 3 requirements
+** will be met: https://www.gnu.org/licenses/lgpl-3.0.html.
+**
+** GNU General Public License Usage
+** Alternatively, this file may be used under the terms of the GNU
+** General Public License version 2.0 or (at your option) the GNU General
+** Public license version 3 or any later version approved by the KDE Free
+** Qt Foundation. The licenses are as published by the Free Software
+** Foundation and appearing in the file LICENSE.GPL2 and LICENSE.GPL3
+** included in the packaging of this file. Please review the following
+** information to ensure the GNU General Public License requirements will
+** be met: https://www.gnu.org/licenses/gpl-2.0.html and
+** https://www.gnu.org/licenses/gpl-3.0.html.
+**
+** $QT_END_LICENSE$
+**
+****************************************************************************/
+
+#ifndef QNETWORKINTERFACE_UIKIT_P_H
+#define QNETWORKINTERFACE_UIKIT_P_H
+
+//
+// W A R N I N G
+// -------------
+//
+// This file is not part of the Qt API. It exists purely as an
+// implementation detail. This header file may change from version to
+// version without notice, or even be removed.
+//
+// We mean it.
+//
+
+// Platform SDK for iOS, tvOS and watchOS is missing those headers:
+// net/if_media.h, netinet/in_var.h, netinet6/in6_var.h This header is
+// a workaround, it provides missing macros and structs.
+
+// <net/if_media.h>:
+
+/*
+ * Ethernet
+ */
+#define IFM_ETHER 0x00000020
+/*
+ * FDDI
+ */
+#define IFM_FDDI 0x00000060
+/*
+ * IEEE 802.11 Wireless
+ */
+#define IFM_IEEE80211 0x00000080
+/*
+ * Masks
+ */
+#define IFM_NMASK 0x000000e0 /* Network type */
+/*
+ * Macros to extract various bits of information from the media word.
+ */
+#define IFM_TYPE(x) ((x) & IFM_NMASK)
+
+// <netinet6/in6_var.h>:
+
+struct in6_addrlifetime {
+ time_t ia6t_expire; /* valid lifetime expiration time */
+ time_t ia6t_preferred; /* preferred lifetime expiration time */
+ u_int32_t ia6t_vltime; /* valid lifetime */
+ u_int32_t ia6t_pltime; /* prefix lifetime */
+};
+
+/*
+ * IPv6 interface statistics, as defined in RFC2465 Ipv6IfStatsEntry (p12).
+ */
+struct in6_ifstat {
+ u_quad_t ifs6_in_receive; /* # of total input datagram */
+ u_quad_t ifs6_in_hdrerr; /* # of datagrams with invalid hdr */
+ u_quad_t ifs6_in_toobig; /* # of datagrams exceeded MTU */
+ u_quad_t ifs6_in_noroute; /* # of datagrams with no route */
+ u_quad_t ifs6_in_addrerr; /* # of datagrams with invalid dst */
+ u_quad_t ifs6_in_protounknown; /* # of datagrams with unknown proto */
+ /* NOTE: increment on final dst if */
+ u_quad_t ifs6_in_truncated; /* # of truncated datagrams */
+ u_quad_t ifs6_in_discard; /* # of discarded datagrams */
+ /* NOTE: fragment timeout is not here */
+ u_quad_t ifs6_in_deliver; /* # of datagrams delivered to ULP */
+ /* NOTE: increment on final dst if */
+ u_quad_t ifs6_out_forward; /* # of datagrams forwarded */
+ /* NOTE: increment on outgoing if */
+ u_quad_t ifs6_out_request; /* # of outgoing datagrams from ULP */
+ /* NOTE: does not include forwrads */
+ u_quad_t ifs6_out_discard; /* # of discarded datagrams */
+ u_quad_t ifs6_out_fragok; /* # of datagrams fragmented */
+ u_quad_t ifs6_out_fragfail; /* # of datagrams failed on fragment */
+ u_quad_t ifs6_out_fragcreat; /* # of fragment datagrams */
+ /* NOTE: this is # after fragment */
+ u_quad_t ifs6_reass_reqd; /* # of incoming fragmented packets */
+ /* NOTE: increment on final dst if */
+ u_quad_t ifs6_reass_ok; /* # of reassembled packets */
+ /* NOTE: this is # after reass */
+ /* NOTE: increment on final dst if */
+ u_quad_t ifs6_atmfrag_rcvd; /* # of atomic fragments received */
+ u_quad_t ifs6_reass_fail; /* # of reass failures */
+ /* NOTE: may not be packet count */
+ /* NOTE: increment on final dst if */
+ u_quad_t ifs6_in_mcast; /* # of inbound multicast datagrams */
+ u_quad_t ifs6_out_mcast; /* # of outbound multicast datagrams */
+
+ u_quad_t ifs6_cantfoward_icmp6; /* # of ICMPv6 packets received for unreachable dest */
+ u_quad_t ifs6_addr_expiry_cnt; /* # of address expiry events (excluding privacy addresses) */
+ u_quad_t ifs6_pfx_expiry_cnt; /* # of prefix expiry events */
+ u_quad_t ifs6_defrtr_expiry_cnt; /* # of default router expiry events */
+};
+
+/*
+ * ICMPv6 interface statistics, as defined in RFC2466 Ipv6IfIcmpEntry.
+ * XXX: I'm not sure if this file is the right place for this structure...
+ */
+struct icmp6_ifstat {
+ /*
+ * Input statistics
+ */
+ /* ipv6IfIcmpInMsgs, total # of input messages */
+ u_quad_t ifs6_in_msg;
+ /* ipv6IfIcmpInErrors, # of input error messages */
+ u_quad_t ifs6_in_error;
+ /* ipv6IfIcmpInDestUnreachs, # of input dest unreach errors */
+ u_quad_t ifs6_in_dstunreach;
+ /* ipv6IfIcmpInAdminProhibs, # of input admin. prohibited errs */
+ u_quad_t ifs6_in_adminprohib;
+ /* ipv6IfIcmpInTimeExcds, # of input time exceeded errors */
+ u_quad_t ifs6_in_timeexceed;
+ /* ipv6IfIcmpInParmProblems, # of input parameter problem errors */
+ u_quad_t ifs6_in_paramprob;
+ /* ipv6IfIcmpInPktTooBigs, # of input packet too big errors */
+ u_quad_t ifs6_in_pkttoobig;
+ /* ipv6IfIcmpInEchos, # of input echo requests */
+ u_quad_t ifs6_in_echo;
+ /* ipv6IfIcmpInEchoReplies, # of input echo replies */
+ u_quad_t ifs6_in_echoreply;
+ /* ipv6IfIcmpInRouterSolicits, # of input router solicitations */
+ u_quad_t ifs6_in_routersolicit;
+ /* ipv6IfIcmpInRouterAdvertisements, # of input router advertisements */
+ u_quad_t ifs6_in_routeradvert;
+ /* ipv6IfIcmpInNeighborSolicits, # of input neighbor solicitations */
+ u_quad_t ifs6_in_neighborsolicit;
+ /* ipv6IfIcmpInNeighborAdvertisements, # of input neighbor advs. */
+ u_quad_t ifs6_in_neighboradvert;
+ /* ipv6IfIcmpInRedirects, # of input redirects */
+ u_quad_t ifs6_in_redirect;
+ /* ipv6IfIcmpInGroupMembQueries, # of input MLD queries */
+ u_quad_t ifs6_in_mldquery;
+ /* ipv6IfIcmpInGroupMembResponses, # of input MLD reports */
+ u_quad_t ifs6_in_mldreport;
+ /* ipv6IfIcmpInGroupMembReductions, # of input MLD done */
+ u_quad_t ifs6_in_mlddone;
+
+ /*
+ * Output statistics. We should solve unresolved routing problem...
+ */
+ /* ipv6IfIcmpOutMsgs, total # of output messages */
+ u_quad_t ifs6_out_msg;
+ /* ipv6IfIcmpOutErrors, # of output error messages */
+ u_quad_t ifs6_out_error;
+ /* ipv6IfIcmpOutDestUnreachs, # of output dest unreach errors */
+ u_quad_t ifs6_out_dstunreach;
+ /* ipv6IfIcmpOutAdminProhibs, # of output admin. prohibited errs */
+ u_quad_t ifs6_out_adminprohib;
+ /* ipv6IfIcmpOutTimeExcds, # of output time exceeded errors */
+ u_quad_t ifs6_out_timeexceed;
+ /* ipv6IfIcmpOutParmProblems, # of output parameter problem errors */
+ u_quad_t ifs6_out_paramprob;
+ /* ipv6IfIcmpOutPktTooBigs, # of output packet too big errors */
+ u_quad_t ifs6_out_pkttoobig;
+ /* ipv6IfIcmpOutEchos, # of output echo requests */
+ u_quad_t ifs6_out_echo;
+ /* ipv6IfIcmpOutEchoReplies, # of output echo replies */
+ u_quad_t ifs6_out_echoreply;
+ /* ipv6IfIcmpOutRouterSolicits, # of output router solicitations */
+ u_quad_t ifs6_out_routersolicit;
+ /* ipv6IfIcmpOutRouterAdvertisements, # of output router advs. */
+ u_quad_t ifs6_out_routeradvert;
+ /* ipv6IfIcmpOutNeighborSolicits, # of output neighbor solicitations */
+ u_quad_t ifs6_out_neighborsolicit;
+ /* ipv6IfIcmpOutNeighborAdvertisements, # of output neighbor advs. */
+ u_quad_t ifs6_out_neighboradvert;
+ /* ipv6IfIcmpOutRedirects, # of output redirects */
+ u_quad_t ifs6_out_redirect;
+ /* ipv6IfIcmpOutGroupMembQueries, # of output MLD queries */
+ u_quad_t ifs6_out_mldquery;
+ /* ipv6IfIcmpOutGroupMembResponses, # of output MLD reports */
+ u_quad_t ifs6_out_mldreport;
+ /* ipv6IfIcmpOutGroupMembReductions, # of output MLD done */
+ u_quad_t ifs6_out_mlddone;
+};
+
+#define SCOPE6_ID_MAX 16
+
+struct in6_ifreq {
+ char ifr_name[IFNAMSIZ];
+ union {
+ struct sockaddr_in6 ifru_addr;
+ struct sockaddr_in6 ifru_dstaddr;
+ int ifru_flags;
+ int ifru_flags6;
+ int ifru_metric;
+ int ifru_intval;
+ caddr_t ifru_data;
+ struct in6_addrlifetime ifru_lifetime;
+ struct in6_ifstat ifru_stat;
+ struct icmp6_ifstat ifru_icmp6stat;
+ u_int32_t ifru_scope_id[SCOPE6_ID_MAX];
+ } ifr_ifru;
+};
+
+#define IN6_IFF_TEMPORARY 0x0080 /* temporary (anonymous) address. */
+#define IN6_IFF_DEPRECATED 0x0010 /* deprecated address */
+
+#define SIOCGIFAFLAG_IN6 _IOWR('i', 73, struct in6_ifreq)
+#define SIOCGIFALIFETIME_IN6 _IOWR('i', 81, struct in6_ifreq)
+
+// The definition below is ONLY a temporary workaround to unblock
+// integrations on CI. MUST be removed ASAP, as soon as SDK is
+// updated. Currently, we have WatchOS SDK 3.2 and it's missing
+// net/if_types.h (unlike SDK 4.0, which has it). Alas, we have to
+// work this around. We only define constants that we use in code.
+
+#if !QT_DARWIN_PLATFORM_SDK_EQUAL_OR_ABOVE(__MAC_NA, __IPHONE_NA, __TVOS_NA, __WATCHOS_4_0)
+
+#define QT_WATCHOS_OUTDATED_SDK_WORKAROUND
+
+#define IFT_PPP 0x17 /* RFC 1331 */
+#define IFT_LOOP 0x18 /* loopback */
+#define IFT_SLIP 0x1c /* IP over generic TTY */
+
+#define IFT_GIF 0x37 /*0xf0*/
+#define IFT_STF 0x39 /*0xf3*/
+
+#define IFT_IEEE1394 0x90 /* IEEE1394 High Performance SerialBus*/
+
+#endif // WatchOS SDK below 4.0
+
+#endif // QNETWORKINTERFACE_UIKIT_P_H
+
diff --git a/src/network/kernel/qnetworkinterface_unix.cpp b/src/network/kernel/qnetworkinterface_unix.cpp
index afa6b4296e..d69fc47667 100644
--- a/src/network/kernel/qnetworkinterface_unix.cpp
+++ b/src/network/kernel/qnetworkinterface_unix.cpp
@@ -41,30 +41,19 @@
#include "qset.h"
#include "qnetworkinterface.h"
#include "qnetworkinterface_p.h"
+#include "qnetworkinterface_unix_p.h"
#include "qalgorithms.h"
-#include "private/qnet_unix_p.h"
#ifndef QT_NO_NETWORKINTERFACE
-#define IP_MULTICAST // make AIX happy and define IFF_MULTICAST
-
-#include <sys/types.h>
-#include <sys/socket.h>
-
-#ifdef Q_OS_SOLARIS
-# include <sys/sockio.h>
+#if defined(QT_NO_CLOCK_MONOTONIC)
+# include "qdatetime.h"
#endif
-#include <net/if.h>
#if defined(QT_LINUXBASE)
# define QT_NO_GETIFADDRS
#endif
-#ifdef Q_OS_HAIKU
-# include <sys/sockio.h>
-# define IFF_RUNNING 0x0001
-#endif
-
#ifndef QT_NO_GETIFADDRS
# include <ifaddrs.h>
#endif
@@ -103,23 +92,6 @@ static QHostAddress addressFromSockaddr(sockaddr *sa, int ifindex = 0, const QSt
}
-static QNetworkInterface::InterfaceFlags convertFlags(uint rawFlags)
-{
- QNetworkInterface::InterfaceFlags flags = 0;
- flags |= (rawFlags & IFF_UP) ? QNetworkInterface::IsUp : QNetworkInterface::InterfaceFlag(0);
- flags |= (rawFlags & IFF_RUNNING) ? QNetworkInterface::IsRunning : QNetworkInterface::InterfaceFlag(0);
- flags |= (rawFlags & IFF_BROADCAST) ? QNetworkInterface::CanBroadcast : QNetworkInterface::InterfaceFlag(0);
- flags |= (rawFlags & IFF_LOOPBACK) ? QNetworkInterface::IsLoopBack : QNetworkInterface::InterfaceFlag(0);
-#ifdef IFF_POINTOPOINT //cygwin doesn't define IFF_POINTOPOINT
- flags |= (rawFlags & IFF_POINTOPOINT) ? QNetworkInterface::IsPointToPoint : QNetworkInterface::InterfaceFlag(0);
-#endif
-
-#ifdef IFF_MULTICAST
- flags |= (rawFlags & IFF_MULTICAST) ? QNetworkInterface::CanMulticast : QNetworkInterface::InterfaceFlag(0);
-#endif
- return flags;
-}
-
uint QNetworkInterfaceManager::interfaceIndexFromName(const QString &name)
{
#ifndef QT_NO_IPV6IFNAME
@@ -167,6 +139,15 @@ QString QNetworkInterfaceManager::interfaceNameFromIndex(uint index)
return QString::number(uint(index));
}
+static int getMtu(int socket, struct ifreq *req)
+{
+#ifdef SIOCGIFMTU
+ if (qt_safe_ioctl(socket, SIOCGIFMTU, req) == 0)
+ return req->ifr_mtu;
+#endif
+ return 0;
+}
+
#ifdef QT_NO_GETIFADDRS
// getifaddrs not available
@@ -306,6 +287,7 @@ static QList<QNetworkInterfacePrivate *> interfaceListing()
if (qt_safe_ioctl(socket, SIOCGIFFLAGS, &req) >= 0) {
iface->flags = convertFlags(req.ifr_flags);
}
+ iface->mtu = getMtu(socket, &req);
#ifdef SIOCGIFHWADDR
// Get the HW address
@@ -359,6 +341,7 @@ QT_END_INCLUDE_NAMESPACE
static QList<QNetworkInterfacePrivate *> createInterfaces(ifaddrs *rawList)
{
+ Q_UNUSED(getMtu)
QList<QNetworkInterfacePrivate *> interfaces;
QSet<QString> seenInterfaces;
QVarLengthArray<int, 16> seenIndexes; // faster than QSet<int>
@@ -413,14 +396,96 @@ static QList<QNetworkInterfacePrivate *> createInterfaces(ifaddrs *rawList)
return interfaces;
}
+static void getAddressExtraInfo(QNetworkAddressEntry *entry, struct sockaddr *sa, const char *ifname)
+{
+ Q_UNUSED(entry);
+ Q_UNUSED(sa);
+ Q_UNUSED(ifname)
+}
+
# elif defined(Q_OS_BSD4)
QT_BEGIN_INCLUDE_NAMESPACE
# include <net/if_dl.h>
+#if defined(QT_PLATFORM_UIKIT)
+# include "qnetworkinterface_uikit_p.h"
+#if !defined(QT_WATCHOS_OUTDATED_SDK_WORKAROUND)
+// TODO: remove it as soon as SDK is updated on CI!!!
+# include <net/if_types.h>
+#endif
+#else
+# include <net/if_media.h>
+# include <net/if_types.h>
+# include <netinet/in_var.h>
+#endif // QT_PLATFORM_UIKIT
QT_END_INCLUDE_NAMESPACE
+static int openSocket(int &socket)
+{
+ if (socket == -1)
+ socket = qt_safe_socket(AF_INET, SOCK_DGRAM, 0);
+ return socket;
+}
+
+static QNetworkInterface::InterfaceType probeIfType(int socket, int iftype, struct ifmediareq *req)
+{
+ // Determine the interface type.
+
+ // On Darwin, these are #defines, but on FreeBSD they're just an
+ // enum, so we can't #ifdef them. Use the authoritative list from
+ // https://www.iana.org/assignments/smi-numbers/smi-numbers.xhtml#smi-numbers-5
+ switch (iftype) {
+ case IFT_PPP:
+ return QNetworkInterface::Ppp;
+
+ case IFT_LOOP:
+ return QNetworkInterface::Loopback;
+
+ case IFT_SLIP:
+ return QNetworkInterface::Slip;
+
+ case 0x47: // IFT_IEEE80211
+ return QNetworkInterface::Ieee80211;
+
+ case IFT_IEEE1394:
+ return QNetworkInterface::Ieee1394;
+
+ case IFT_GIF:
+ case IFT_STF:
+ return QNetworkInterface::Virtual;
+ }
+
+ // For the remainder (including Ethernet), let's try SIOGIFMEDIA
+ req->ifm_count = 0;
+ if (qt_safe_ioctl(socket, SIOCGIFMEDIA, req) == 0) {
+ // see https://man.openbsd.org/ifmedia.4
+
+ switch (IFM_TYPE(req->ifm_current)) {
+ case IFM_ETHER:
+ return QNetworkInterface::Ethernet;
+
+ case IFM_FDDI:
+ return QNetworkInterface::Fddi;
+
+ case IFM_IEEE80211:
+ return QNetworkInterface::Ieee80211;
+ }
+ }
+
+ return QNetworkInterface::Unknown;
+}
+
static QList<QNetworkInterfacePrivate *> createInterfaces(ifaddrs *rawList)
{
QList<QNetworkInterfacePrivate *> interfaces;
+ union {
+ struct ifmediareq mediareq;
+ struct ifreq req;
+ };
+ int socket = -1;
+
+ // ensure both structs start with the name field, of size IFNAMESIZ
+ Q_STATIC_ASSERT(sizeof(mediareq.ifm_name) == sizeof(req.ifr_name));
+ Q_ASSERT(&mediareq.ifm_name == &req.ifr_name);
// on NetBSD we use AF_LINK and sockaddr_dl
// scan the list for that family
@@ -434,15 +499,73 @@ static QList<QNetworkInterfacePrivate *> createInterfaces(ifaddrs *rawList)
iface->name = QString::fromLatin1(ptr->ifa_name);
iface->flags = convertFlags(ptr->ifa_flags);
iface->hardwareAddress = iface->makeHwAddress(sdl->sdl_alen, (uchar*)LLADDR(sdl));
+
+ strlcpy(mediareq.ifm_name, ptr->ifa_name, sizeof(mediareq.ifm_name));
+ iface->type = probeIfType(openSocket(socket), sdl->sdl_type, &mediareq);
+ iface->mtu = getMtu(socket, &req);
}
+ if (socket != -1)
+ qt_safe_close(socket);
return interfaces;
}
+static void getAddressExtraInfo(QNetworkAddressEntry *entry, struct sockaddr *sa, const char *ifname)
+{
+ // get IPv6 address lifetimes
+ if (sa->sa_family != AF_INET6)
+ return;
+
+ struct in6_ifreq ifr;
+
+ int s6 = qt_safe_socket(AF_INET6, SOCK_DGRAM, 0);
+ if (Q_UNLIKELY(s6 < 0)) {
+ qErrnoWarning("QNetworkInterface: could not create IPv6 socket");
+ return;
+ }
+
+ strlcpy(ifr.ifr_name, ifname, sizeof(ifr.ifr_name));
+
+ // get flags
+ ifr.ifr_addr = *reinterpret_cast<struct sockaddr_in6 *>(sa);
+ if (qt_safe_ioctl(s6, SIOCGIFAFLAG_IN6, &ifr) < 0) {
+ qt_safe_close(s6);
+ return;
+ }
+ int flags = ifr.ifr_ifru.ifru_flags6;
+ QNetworkInterfacePrivate::calculateDnsEligibility(entry,
+ flags & IN6_IFF_TEMPORARY,
+ flags & IN6_IFF_DEPRECATED);
+
+ // get lifetimes
+ ifr.ifr_addr = *reinterpret_cast<struct sockaddr_in6 *>(sa);
+ if (qt_safe_ioctl(s6, SIOCGIFALIFETIME_IN6, &ifr) < 0) {
+ qt_safe_close(s6);
+ return;
+ }
+ qt_safe_close(s6);
+
+ auto toDeadline = [](time_t when) {
+ QDeadlineTimer deadline = QDeadlineTimer::Forever;
+ if (when) {
+#if defined(QT_NO_CLOCK_MONOTONIC)
+ // no monotonic clock
+ deadline.setPreciseRemainingTime(when - QDateTime::currentSecsSinceEpoch());
+#else
+ deadline.setPreciseDeadline(when);
+#endif
+ }
+ return deadline;
+ };
+ entry->setAddressLifetime(toDeadline(ifr.ifr_ifru.ifru_lifetime.ia6t_preferred),
+ toDeadline(ifr.ifr_ifru.ifru_lifetime.ia6t_expire));
+}
+
# else // Generic version
static QList<QNetworkInterfacePrivate *> createInterfaces(ifaddrs *rawList)
{
+ Q_UNUSED(getMtu)
QList<QNetworkInterfacePrivate *> interfaces;
// make sure there's one entry for each interface
@@ -470,9 +593,14 @@ static QList<QNetworkInterfacePrivate *> createInterfaces(ifaddrs *rawList)
return interfaces;
}
+static void getAddressExtraInfo(QNetworkAddressEntry *entry, struct sockaddr *sa, const char *ifname)
+{
+ Q_UNUSED(entry);
+ Q_UNUSED(sa);
+ Q_UNUSED(ifname)
+}
# endif
-
static QList<QNetworkInterfacePrivate *> interfaceListing()
{
QList<QNetworkInterfacePrivate *> interfaces;
@@ -521,6 +649,7 @@ static QList<QNetworkInterfacePrivate *> interfaceListing()
entry.setNetmask(addressFromSockaddr(ptr->ifa_netmask, iface->index, iface->name));
if (iface->flags & QNetworkInterface::CanBroadcast)
entry.setBroadcast(addressFromSockaddr(ptr->ifa_broadaddr, iface->index, iface->name));
+ getAddressExtraInfo(&entry, ptr->ifa_addr, name.latin1());
iface->addressEntries << entry;
}
diff --git a/src/network/kernel/qnetworkinterface_unix_p.h b/src/network/kernel/qnetworkinterface_unix_p.h
new file mode 100644
index 0000000000..c085194e3c
--- /dev/null
+++ b/src/network/kernel/qnetworkinterface_unix_p.h
@@ -0,0 +1,102 @@
+/****************************************************************************
+**
+** Copyright (C) 2017 The Qt Company Ltd.
+** Copyright (C) 2017 Intel Corporation.
+** Contact: https://www.qt.io/licensing/
+**
+** This file is part of the QtNetwork module of the Qt Toolkit.
+**
+** $QT_BEGIN_LICENSE:LGPL$
+** Commercial License Usage
+** Licensees holding valid commercial Qt licenses may use this file in
+** accordance with the commercial license agreement provided with the
+** Software or, alternatively, in accordance with the terms contained in
+** a written agreement between you and The Qt Company. For licensing terms
+** and conditions see https://www.qt.io/terms-conditions. For further
+** information use the contact form at https://www.qt.io/contact-us.
+**
+** GNU Lesser General Public License Usage
+** Alternatively, this file may be used under the terms of the GNU Lesser
+** General Public License version 3 as published by the Free Software
+** Foundation and appearing in the file LICENSE.LGPL3 included in the
+** packaging of this file. Please review the following information to
+** ensure the GNU Lesser General Public License version 3 requirements
+** will be met: https://www.gnu.org/licenses/lgpl-3.0.html.
+**
+** GNU General Public License Usage
+** Alternatively, this file may be used under the terms of the GNU
+** General Public License version 2.0 or (at your option) the GNU General
+** Public license version 3 or any later version approved by the KDE Free
+** Qt Foundation. The licenses are as published by the Free Software
+** Foundation and appearing in the file LICENSE.GPL2 and LICENSE.GPL3
+** included in the packaging of this file. Please review the following
+** information to ensure the GNU General Public License requirements will
+** be met: https://www.gnu.org/licenses/gpl-2.0.html and
+** https://www.gnu.org/licenses/gpl-3.0.html.
+**
+** $QT_END_LICENSE$
+**
+****************************************************************************/
+
+#ifndef QNETWORKINTERFACE_UNIX_P_H
+#define QNETWORKINTERFACE_UNIX_P_H
+
+//
+// W A R N I N G
+// -------------
+//
+// This file is not part of the Qt API. It exists purely as an
+// implementation detail. This header file may change from version to
+// version without notice, or even be removed.
+//
+// We mean it.
+//
+
+#include "qnetworkinterface_p.h"
+#include "private/qnet_unix_p.h"
+
+#ifndef QT_NO_NETWORKINTERFACE
+
+#define IP_MULTICAST // make AIX happy and define IFF_MULTICAST
+
+#include <sys/types.h>
+#include <sys/socket.h>
+#ifdef Q_OS_SOLARIS
+# include <sys/sockio.h>
+#endif
+#ifdef Q_OS_HAIKU
+# include <sys/sockio.h>
+# define IFF_RUNNING 0x0001
+#endif
+#if QT_CONFIG(linux_netlink)
+// Same as net/if.h but contains other things we need in
+// qnetworkinterface_linux.cpp.
+# include <linux/if.h>
+#else
+# include <net/if.h>
+#endif
+
+QT_BEGIN_NAMESPACE
+
+static QNetworkInterface::InterfaceFlags convertFlags(uint rawFlags)
+{
+ QNetworkInterface::InterfaceFlags flags = 0;
+ flags |= (rawFlags & IFF_UP) ? QNetworkInterface::IsUp : QNetworkInterface::InterfaceFlag(0);
+ flags |= (rawFlags & IFF_RUNNING) ? QNetworkInterface::IsRunning : QNetworkInterface::InterfaceFlag(0);
+ flags |= (rawFlags & IFF_BROADCAST) ? QNetworkInterface::CanBroadcast : QNetworkInterface::InterfaceFlag(0);
+ flags |= (rawFlags & IFF_LOOPBACK) ? QNetworkInterface::IsLoopBack : QNetworkInterface::InterfaceFlag(0);
+#ifdef IFF_POINTOPOINT //cygwin doesn't define IFF_POINTOPOINT
+ flags |= (rawFlags & IFF_POINTOPOINT) ? QNetworkInterface::IsPointToPoint : QNetworkInterface::InterfaceFlag(0);
+#endif
+
+#ifdef IFF_MULTICAST
+ flags |= (rawFlags & IFF_MULTICAST) ? QNetworkInterface::CanMulticast : QNetworkInterface::InterfaceFlag(0);
+#endif
+ return flags;
+}
+
+QT_END_NAMESPACE
+
+#endif // QT_NO_NETWORKINTERFACE
+
+#endif // QNETWORKINTERFACE_UNIX_P_H
diff --git a/src/network/kernel/qnetworkinterface_win.cpp b/src/network/kernel/qnetworkinterface_win.cpp
index 64c3fa6f83..150553f673 100644
--- a/src/network/kernel/qnetworkinterface_win.cpp
+++ b/src/network/kernel/qnetworkinterface_win.cpp
@@ -62,6 +62,10 @@
#include <qt_windows.h>
+// In case these aren't defined
+#define IF_TYPE_IEEE80216_WMAN 237
+#define IF_TYPE_IEEE802154 259
+
QT_BEGIN_NAMESPACE
static QHostAddress addressFromSockaddr(sockaddr *sa)
@@ -147,6 +151,7 @@ static QList<QNetworkInterfacePrivate *> interfaceListing()
else if (ptr->IfIndex != 0)
iface->index = ptr->IfIndex;
+ iface->mtu = qMin<qint64>(ptr->Mtu, INT_MAX);
iface->flags = QNetworkInterface::CanBroadcast;
if (ptr->OperStatus == IfOperStatusUp)
iface->flags |= QNetworkInterface::IsUp | QNetworkInterface::IsRunning;
@@ -155,6 +160,45 @@ static QList<QNetworkInterfacePrivate *> interfaceListing()
if (ptr->IfType == IF_TYPE_PPP)
iface->flags |= QNetworkInterface::IsPointToPoint;
+ switch (ptr->IfType) {
+ case IF_TYPE_ETHERNET_CSMACD:
+ iface->type = QNetworkInterface::Ethernet;
+ break;
+
+ case IF_TYPE_FDDI:
+ iface->type = QNetworkInterface::Fddi;
+ break;
+
+ case IF_TYPE_PPP:
+ iface->type = QNetworkInterface::Ppp;
+ break;
+
+ case IF_TYPE_SLIP:
+ iface->type = QNetworkInterface::Slip;
+ break;
+
+ case IF_TYPE_SOFTWARE_LOOPBACK:
+ iface->type = QNetworkInterface::Loopback;
+ iface->flags |= QNetworkInterface::IsLoopBack;
+ break;
+
+ case IF_TYPE_IEEE80211:
+ iface->type = QNetworkInterface::Ieee80211;
+ break;
+
+ case IF_TYPE_IEEE1394:
+ iface->type = QNetworkInterface::Ieee1394;
+ break;
+
+ case IF_TYPE_IEEE80216_WMAN:
+ iface->type = QNetworkInterface::Ieee80216;
+ break;
+
+ case IF_TYPE_IEEE802154:
+ iface->type = QNetworkInterface::Ieee802154;
+ break;
+ }
+
// use ConvertInterfaceLuidToNameW because that returns a friendlier name, though not
// as "friendly" as FriendlyName below
WCHAR buf[IF_MAX_STRING_SIZE + 1];
@@ -167,9 +211,6 @@ static QList<QNetworkInterfacePrivate *> interfaceListing()
if (ptr->PhysicalAddressLength)
iface->hardwareAddress = iface->makeHwAddress(ptr->PhysicalAddressLength,
ptr->PhysicalAddress);
- else
- // loopback if it has no address
- iface->flags |= QNetworkInterface::IsLoopBack;
// parse the IP (unicast) addresses
for (PIP_ADAPTER_UNICAST_ADDRESS addr = ptr->FirstUnicastAddress; addr; addr = addr->Next) {
@@ -182,6 +223,17 @@ static QList<QNetworkInterfacePrivate *> interfaceListing()
QNetworkAddressEntry entry;
entry.setIp(addressFromSockaddr(addr->Address.lpSockaddr));
entry.setPrefixLength(addr->OnLinkPrefixLength);
+
+ auto toDeadline = [](ULONG lifetime) -> QDeadlineTimer {
+ if (lifetime == 0xffffffffUL)
+ return QDeadlineTimer::Forever;
+ return QDeadlineTimer(lifetime * 1000);
+ };
+ entry.setAddressLifetime(toDeadline(addr->ValidLifetime), toDeadline(addr->PreferredLifetime));
+ entry.setDnsEligibility(addr->Flags & IP_ADAPTER_ADDRESS_DNS_ELIGIBLE ?
+ QNetworkAddressEntry::DnsEligible :
+ QNetworkAddressEntry::DnsIneligible);
+
iface->addressEntries << entry;
}
}
diff --git a/src/network/kernel/qnetworkproxy.cpp b/src/network/kernel/qnetworkproxy.cpp
index 6b53b4b58e..3646a9526a 100644
--- a/src/network/kernel/qnetworkproxy.cpp
+++ b/src/network/kernel/qnetworkproxy.cpp
@@ -230,7 +230,11 @@
#if QT_CONFIG(socks5)
#include "private/qsocks5socketengine_p.h"
#endif
+
+#if QT_CONFIG(http)
#include "private/qhttpsocketengine_p.h"
+#endif
+
#include "qauthenticator.h"
#include "qdebug.h"
#include "qmutex.h"
@@ -256,7 +260,7 @@ public:
#if QT_CONFIG(socks5)
, socks5SocketEngineHandler(0)
#endif
-#ifndef QT_NO_HTTP
+#if QT_CONFIG(http)
, httpSocketEngineHandler(0)
#endif
#ifdef QT_USE_SYSTEM_PROXIES
@@ -268,7 +272,7 @@ public:
#if QT_CONFIG(socks5)
socks5SocketEngineHandler = new QSocks5SocketEngineHandler();
#endif
-#ifndef QT_NO_HTTP
+#if QT_CONFIG(http)
httpSocketEngineHandler = new QHttpSocketEngineHandler();
#endif
}
@@ -280,7 +284,7 @@ public:
#if QT_CONFIG(socks5)
delete socks5SocketEngineHandler;
#endif
-#ifndef QT_NO_HTTP
+#if QT_CONFIG(http)
delete httpSocketEngineHandler;
#endif
}
@@ -340,7 +344,7 @@ private:
#if QT_CONFIG(socks5)
QSocks5SocketEngineHandler *socks5SocketEngineHandler;
#endif
-#ifndef QT_NO_HTTP
+#if QT_CONFIG(http)
QHttpSocketEngineHandler *httpSocketEngineHandler;
#endif
bool useSystemProxies;
diff --git a/src/network/network.pro b/src/network/network.pro
index 98fbf82275..b8272d91d6 100644
--- a/src/network/network.pro
+++ b/src/network/network.pro
@@ -24,8 +24,6 @@ QMAKE_LIBS += $$QMAKE_LIBS_NETWORK
qtConfig(bearermanagement) {
ANDROID_BUNDLED_JAR_DEPENDENCIES = \
- jar/QtAndroidBearer-bundled.jar
- ANDROID_JAR_DEPENDENCIES = \
jar/QtAndroidBearer.jar
ANDROID_LIB_DEPENDENCIES = \
plugins/bearer/libqandroidbearer.so
diff --git a/src/network/socket/qabstractsocket.cpp b/src/network/socket/qabstractsocket.cpp
index ec88851589..13e10e4102 100644
--- a/src/network/socket/qabstractsocket.cpp
+++ b/src/network/socket/qabstractsocket.cpp
@@ -387,6 +387,11 @@
(see \l{QAbstractSocket::}{setReadBufferSize()}).
This enum value has been introduced in Qt 5.3.
+ \value PathMtuSocketOption Retrieves the Path Maximum Transmission Unit
+ (PMTU) value currently known by the IP stack, if any. Some IP stacks also
+ allow setting the MTU for transmission.
+ This enum value was introduced in Qt 5.11.
+
Possible values for \e{TypeOfServiceOption} are:
\table
@@ -1354,15 +1359,29 @@ void QAbstractSocketPrivate::fetchConnectionParameters()
}
state = QAbstractSocket::ConnectedState;
- emit q->stateChanged(state);
- emit q->connected();
-
#if defined(QABSTRACTSOCKET_DEBUG)
qDebug("QAbstractSocketPrivate::fetchConnectionParameters() connection to %s:%i established",
host.toString().toLatin1().constData(), port);
#endif
+ emit q->stateChanged(state);
+ emit q->connected();
}
+/*! \internal
+*/
+qint64 QAbstractSocketPrivate::skip(qint64 maxSize)
+{
+ // if we're not connected, return -1 indicating EOF
+ if (!socketEngine || !socketEngine->isValid() || state != QAbstractSocket::ConnectedState)
+ return -1;
+
+ // Caller, QIODevice::skip(), has ensured buffer is empty. So, wait
+ // for more data in buffered mode.
+ if (isBuffered)
+ return 0;
+
+ return QIODevicePrivate::skip(maxSize);
+}
void QAbstractSocketPrivate::pauseSocketNotifiers(QAbstractSocket *socket)
{
@@ -2013,6 +2032,10 @@ void QAbstractSocket::setSocketOption(QAbstractSocket::SocketOption option, cons
case ReceiveBufferSizeSocketOption:
d_func()->socketEngine->setOption(QAbstractSocketEngine::ReceiveBufferSocketOption, value.toInt());
break;
+
+ case PathMtuSocketOption:
+ d_func()->socketEngine->setOption(QAbstractSocketEngine::PathMtuInformation, value.toInt());
+ break;
}
}
@@ -2055,6 +2078,10 @@ QVariant QAbstractSocket::socketOption(QAbstractSocket::SocketOption option)
case ReceiveBufferSizeSocketOption:
ret = d_func()->socketEngine->option(QAbstractSocketEngine::ReceiveBufferSocketOption);
break;
+
+ case PathMtuSocketOption:
+ ret = d_func()->socketEngine->option(QAbstractSocketEngine::PathMtuInformation);
+ break;
}
if (ret == -1)
return QVariant();
diff --git a/src/network/socket/qabstractsocket.h b/src/network/socket/qabstractsocket.h
index 875609aa28..6d5e57ac52 100644
--- a/src/network/socket/qabstractsocket.h
+++ b/src/network/socket/qabstractsocket.h
@@ -120,7 +120,8 @@ public:
MulticastLoopbackOption, // IP_MULTICAST_LOOPBACK
TypeOfServiceOption, //IP_TOS
SendBufferSizeSocketOption, //SO_SNDBUF
- ReceiveBufferSizeSocketOption //SO_RCVBUF
+ ReceiveBufferSizeSocketOption, //SO_RCVBUF
+ PathMtuSocketOption // IP_MTU
};
Q_ENUM(SocketOption)
enum BindFlag {
@@ -154,10 +155,10 @@ public:
bool isValid() const;
- qint64 bytesAvailable() const Q_DECL_OVERRIDE;
- qint64 bytesToWrite() const Q_DECL_OVERRIDE;
+ qint64 bytesAvailable() const override;
+ qint64 bytesToWrite() const override;
- bool canReadLine() const Q_DECL_OVERRIDE; // ### Qt6: remove me
+ bool canReadLine() const override; // ### Qt6: remove me
quint16 localPort() const;
QHostAddress localAddress() const;
@@ -182,15 +183,15 @@ public:
SocketError error() const;
// from QIODevice
- void close() Q_DECL_OVERRIDE;
- bool isSequential() const Q_DECL_OVERRIDE;
- bool atEnd() const Q_DECL_OVERRIDE; // ### Qt6: remove me
+ void close() override;
+ bool isSequential() const override;
+ bool atEnd() const override; // ### Qt6: remove me
bool flush();
// for synchronous access
virtual bool waitForConnected(int msecs = 30000);
- bool waitForReadyRead(int msecs = 30000) Q_DECL_OVERRIDE;
- bool waitForBytesWritten(int msecs = 30000) Q_DECL_OVERRIDE;
+ bool waitForReadyRead(int msecs = 30000) override;
+ bool waitForBytesWritten(int msecs = 30000) override;
virtual bool waitForDisconnected(int msecs = 30000);
#ifndef QT_NO_NETWORKPROXY
@@ -209,9 +210,9 @@ Q_SIGNALS:
#endif
protected:
- qint64 readData(char *data, qint64 maxlen) Q_DECL_OVERRIDE;
- qint64 readLineData(char *data, qint64 maxlen) Q_DECL_OVERRIDE;
- qint64 writeData(const char *data, qint64 len) Q_DECL_OVERRIDE;
+ qint64 readData(char *data, qint64 maxlen) override;
+ qint64 readLineData(char *data, qint64 maxlen) override;
+ qint64 writeData(const char *data, qint64 len) override;
void setSocketState(SocketState state);
void setSocketError(SocketError socketError);
@@ -221,7 +222,7 @@ protected:
void setPeerAddress(const QHostAddress &address);
void setPeerName(const QString &name);
- QAbstractSocket(SocketType socketType, QAbstractSocketPrivate &dd, QObject *parent = Q_NULLPTR);
+ QAbstractSocket(SocketType socketType, QAbstractSocketPrivate &dd, QObject *parent = nullptr);
private:
Q_DECLARE_PRIVATE(QAbstractSocket)
diff --git a/src/network/socket/qabstractsocket_p.h b/src/network/socket/qabstractsocket_p.h
index 3873b50864..066a35ff85 100644
--- a/src/network/socket/qabstractsocket_p.h
+++ b/src/network/socket/qabstractsocket_p.h
@@ -71,6 +71,9 @@ public:
QAbstractSocketPrivate();
virtual ~QAbstractSocketPrivate();
+ // from QIODevicePrivate
+ qint64 skip(qint64 maxSize) override;
+
// from QAbstractSocketEngineReceiver
inline void readNotification() override { canReadNotification(); }
inline void writeNotification() override { canWriteNotification(); }
diff --git a/src/network/socket/qabstractsocketengine_p.h b/src/network/socket/qabstractsocketengine_p.h
index 0cb519ce90..b15dd73c96 100644
--- a/src/network/socket/qabstractsocketengine_p.h
+++ b/src/network/socket/qabstractsocketengine_p.h
@@ -105,7 +105,8 @@ public:
TypeOfServiceOption,
ReceivePacketInformation,
ReceiveHopLimit,
- MaxStreamsSocketOption
+ MaxStreamsSocketOption,
+ PathMtuInformation
};
enum PacketHeaderOption {
diff --git a/src/network/socket/qhttpsocketengine.cpp b/src/network/socket/qhttpsocketengine.cpp
index 899c02fba6..b543ea7981 100644
--- a/src/network/socket/qhttpsocketengine.cpp
+++ b/src/network/socket/qhttpsocketengine.cpp
@@ -46,7 +46,7 @@
#include "qelapsedtimer.h"
#include "qnetworkinterface.h"
-#if !defined(QT_NO_NETWORKPROXY) && !defined(QT_NO_HTTP)
+#if !defined(QT_NO_NETWORKPROXY)
#include <qdebug.h>
QT_BEGIN_NAMESPACE
@@ -572,18 +572,13 @@ void QHttpSocketEngine::slotSocketReadNotification()
}
if (d->state == ReadResponseContent) {
- char dummybuffer[4096];
- while (d->pendingResponseData) {
- int read = d->socket->read(dummybuffer, qMin(sizeof(dummybuffer), (size_t)d->pendingResponseData));
- if (read == 0)
- return;
- if (read == -1) {
- d->socket->disconnectFromHost();
- emitWriteNotification();
- return;
- }
- d->pendingResponseData -= read;
+ qint64 skipped = d->socket->skip(d->pendingResponseData);
+ if (skipped == -1) {
+ d->socket->disconnectFromHost();
+ emitWriteNotification();
+ return;
}
+ d->pendingResponseData -= uint(skipped);
if (d->pendingResponseData > 0)
return;
if (d->reply->d_func()->statusCode == 407)
@@ -871,4 +866,4 @@ QAbstractSocketEngine *QHttpSocketEngineHandler::createSocketEngine(qintptr, QOb
QT_END_NAMESPACE
-#endif
+#endif // !QT_NO_NETWORKPROXY
diff --git a/src/network/socket/qhttpsocketengine_p.h b/src/network/socket/qhttpsocketengine_p.h
index 07815a7e51..cb7798694a 100644
--- a/src/network/socket/qhttpsocketengine_p.h
+++ b/src/network/socket/qhttpsocketengine_p.h
@@ -57,9 +57,11 @@
#include "qnetworkproxy.h"
#include "private/qauthenticator_p.h"
+QT_REQUIRE_CONFIG(http);
+
QT_BEGIN_NAMESPACE
-#if !defined(QT_NO_NETWORKPROXY) && !defined(QT_NO_HTTP)
+#if !defined(QT_NO_NETWORKPROXY)
class QTcpSocket;
class QHttpNetworkReply;
@@ -80,62 +82,62 @@ public:
QHttpSocketEngine(QObject *parent = 0);
~QHttpSocketEngine();
- bool initialize(QAbstractSocket::SocketType type, QAbstractSocket::NetworkLayerProtocol protocol = QAbstractSocket::IPv4Protocol) Q_DECL_OVERRIDE;
- bool initialize(qintptr socketDescriptor, QAbstractSocket::SocketState socketState = QAbstractSocket::ConnectedState) Q_DECL_OVERRIDE;
+ bool initialize(QAbstractSocket::SocketType type, QAbstractSocket::NetworkLayerProtocol protocol = QAbstractSocket::IPv4Protocol) override;
+ bool initialize(qintptr socketDescriptor, QAbstractSocket::SocketState socketState = QAbstractSocket::ConnectedState) override;
void setProxy(const QNetworkProxy &networkProxy);
- qintptr socketDescriptor() const Q_DECL_OVERRIDE;
+ qintptr socketDescriptor() const override;
- bool isValid() const Q_DECL_OVERRIDE;
+ bool isValid() const override;
bool connectInternal();
- bool connectToHost(const QHostAddress &address, quint16 port) Q_DECL_OVERRIDE;
- bool connectToHostByName(const QString &name, quint16 port) Q_DECL_OVERRIDE;
- bool bind(const QHostAddress &address, quint16 port) Q_DECL_OVERRIDE;
- bool listen() Q_DECL_OVERRIDE;
- int accept() Q_DECL_OVERRIDE;
- void close() Q_DECL_OVERRIDE;
+ bool connectToHost(const QHostAddress &address, quint16 port) override;
+ bool connectToHostByName(const QString &name, quint16 port) override;
+ bool bind(const QHostAddress &address, quint16 port) override;
+ bool listen() override;
+ int accept() override;
+ void close() override;
- qint64 bytesAvailable() const Q_DECL_OVERRIDE;
+ qint64 bytesAvailable() const override;
- qint64 read(char *data, qint64 maxlen) Q_DECL_OVERRIDE;
- qint64 write(const char *data, qint64 len) Q_DECL_OVERRIDE;
+ qint64 read(char *data, qint64 maxlen) override;
+ qint64 write(const char *data, qint64 len) override;
#ifndef QT_NO_UDPSOCKET
#ifndef QT_NO_NETWORKINTERFACE
bool joinMulticastGroup(const QHostAddress &groupAddress,
- const QNetworkInterface &interface) Q_DECL_OVERRIDE;
+ const QNetworkInterface &interface) override;
bool leaveMulticastGroup(const QHostAddress &groupAddress,
- const QNetworkInterface &interface) Q_DECL_OVERRIDE;
- QNetworkInterface multicastInterface() const Q_DECL_OVERRIDE;
- bool setMulticastInterface(const QNetworkInterface &iface) Q_DECL_OVERRIDE;
+ const QNetworkInterface &interface) override;
+ QNetworkInterface multicastInterface() const override;
+ bool setMulticastInterface(const QNetworkInterface &iface) override;
#endif // QT_NO_NETWORKINTERFACE
- bool hasPendingDatagrams() const Q_DECL_OVERRIDE;
- qint64 pendingDatagramSize() const Q_DECL_OVERRIDE;
+ bool hasPendingDatagrams() const override;
+ qint64 pendingDatagramSize() const override;
#endif // QT_NO_UDPSOCKET
qint64 readDatagram(char *data, qint64 maxlen, QIpPacketHeader *,
- PacketHeaderOptions) Q_DECL_OVERRIDE;
- qint64 writeDatagram(const char *data, qint64 len, const QIpPacketHeader &) Q_DECL_OVERRIDE;
- qint64 bytesToWrite() const Q_DECL_OVERRIDE;
+ PacketHeaderOptions) override;
+ qint64 writeDatagram(const char *data, qint64 len, const QIpPacketHeader &) override;
+ qint64 bytesToWrite() const override;
- int option(SocketOption option) const Q_DECL_OVERRIDE;
- bool setOption(SocketOption option, int value) Q_DECL_OVERRIDE;
+ int option(SocketOption option) const override;
+ bool setOption(SocketOption option, int value) override;
- bool waitForRead(int msecs = 30000, bool *timedOut = 0) Q_DECL_OVERRIDE;
- bool waitForWrite(int msecs = 30000, bool *timedOut = 0) Q_DECL_OVERRIDE;
+ bool waitForRead(int msecs = 30000, bool *timedOut = 0) override;
+ bool waitForWrite(int msecs = 30000, bool *timedOut = 0) override;
bool waitForReadOrWrite(bool *readyToRead, bool *readyToWrite,
bool checkRead, bool checkWrite,
- int msecs = 30000, bool *timedOut = 0) Q_DECL_OVERRIDE;
+ int msecs = 30000, bool *timedOut = 0) override;
- bool isReadNotificationEnabled() const Q_DECL_OVERRIDE;
- void setReadNotificationEnabled(bool enable) Q_DECL_OVERRIDE;
- bool isWriteNotificationEnabled() const Q_DECL_OVERRIDE;
- void setWriteNotificationEnabled(bool enable) Q_DECL_OVERRIDE;
- bool isExceptionNotificationEnabled() const Q_DECL_OVERRIDE;
- void setExceptionNotificationEnabled(bool enable) Q_DECL_OVERRIDE;
+ bool isReadNotificationEnabled() const override;
+ void setReadNotificationEnabled(bool enable) override;
+ bool isWriteNotificationEnabled() const override;
+ void setWriteNotificationEnabled(bool enable) override;
+ bool isExceptionNotificationEnabled() const override;
+ void setExceptionNotificationEnabled(bool enable) override;
public slots:
void slotSocketConnected();
@@ -190,8 +192,8 @@ class Q_AUTOTEST_EXPORT QHttpSocketEngineHandler : public QSocketEngineHandler
{
public:
virtual QAbstractSocketEngine *createSocketEngine(QAbstractSocket::SocketType socketType,
- const QNetworkProxy &, QObject *parent) Q_DECL_OVERRIDE;
- virtual QAbstractSocketEngine *createSocketEngine(qintptr socketDescripter, QObject *parent) Q_DECL_OVERRIDE;
+ const QNetworkProxy &, QObject *parent) override;
+ virtual QAbstractSocketEngine *createSocketEngine(qintptr socketDescripter, QObject *parent) override;
};
#endif
diff --git a/src/network/socket/qlocalserver.h b/src/network/socket/qlocalserver.h
index 454ac30c9b..211aa94d85 100644
--- a/src/network/socket/qlocalserver.h
+++ b/src/network/socket/qlocalserver.h
@@ -71,7 +71,7 @@ public:
Q_DECLARE_FLAGS(SocketOptions, SocketOption)
Q_FLAG(SocketOptions)
- explicit QLocalServer(QObject *parent = Q_NULLPTR);
+ explicit QLocalServer(QObject *parent = nullptr);
~QLocalServer();
void close();
@@ -87,7 +87,7 @@ public:
static bool removeServer(const QString &name);
QAbstractSocket::SocketError serverError() const;
void setMaxPendingConnections(int numConnections);
- bool waitForNewConnection(int msec = 0, bool *timedOut = Q_NULLPTR);
+ bool waitForNewConnection(int msec = 0, bool *timedOut = nullptr);
void setSocketOptions(SocketOptions options);
SocketOptions socketOptions() const;
diff --git a/src/network/socket/qlocalsocket.h b/src/network/socket/qlocalsocket.h
index 9905d3a86c..1876a6ac0d 100644
--- a/src/network/socket/qlocalsocket.h
+++ b/src/network/socket/qlocalsocket.h
@@ -79,7 +79,7 @@ public:
ClosingState = QAbstractSocket::ClosingState
};
- QLocalSocket(QObject *parent = Q_NULLPTR);
+ QLocalSocket(QObject *parent = nullptr);
~QLocalSocket();
void connectToServer(OpenMode openMode = ReadWrite);
@@ -91,12 +91,12 @@ public:
QString fullServerName() const;
void abort();
- virtual bool isSequential() const Q_DECL_OVERRIDE;
- virtual qint64 bytesAvailable() const Q_DECL_OVERRIDE;
- virtual qint64 bytesToWrite() const Q_DECL_OVERRIDE;
- virtual bool canReadLine() const Q_DECL_OVERRIDE;
- virtual bool open(OpenMode openMode = ReadWrite) Q_DECL_OVERRIDE;
- virtual void close() Q_DECL_OVERRIDE;
+ virtual bool isSequential() const override;
+ virtual qint64 bytesAvailable() const override;
+ virtual qint64 bytesToWrite() const override;
+ virtual bool canReadLine() const override;
+ virtual bool open(OpenMode openMode = ReadWrite) override;
+ virtual void close() override;
LocalSocketError error() const;
bool flush();
bool isValid() const;
@@ -109,10 +109,10 @@ public:
qintptr socketDescriptor() const;
LocalSocketState state() const;
- bool waitForBytesWritten(int msecs = 30000) Q_DECL_OVERRIDE;
+ bool waitForBytesWritten(int msecs = 30000) override;
bool waitForConnected(int msecs = 30000);
bool waitForDisconnected(int msecs = 30000);
- bool waitForReadyRead(int msecs = 30000) Q_DECL_OVERRIDE;
+ bool waitForReadyRead(int msecs = 30000) override;
Q_SIGNALS:
void connected();
@@ -121,8 +121,8 @@ Q_SIGNALS:
void stateChanged(QLocalSocket::LocalSocketState socketState);
protected:
- virtual qint64 readData(char*, qint64) Q_DECL_OVERRIDE;
- virtual qint64 writeData(const char*, qint64) Q_DECL_OVERRIDE;
+ virtual qint64 readData(char*, qint64) override;
+ virtual qint64 writeData(const char*, qint64) override;
private:
Q_DISABLE_COPY(QLocalSocket)
diff --git a/src/network/socket/qlocalsocket_p.h b/src/network/socket/qlocalsocket_p.h
index eb59af5577..8b72da397f 100644
--- a/src/network/socket/qlocalsocket_p.h
+++ b/src/network/socket/qlocalsocket_p.h
@@ -120,6 +120,7 @@ public:
void init();
#if defined(QT_LOCALSOCKET_TCP)
+ qint64 skip(qint64 maxSize) override;
QLocalUnixSocket* tcpSocket;
bool ownsTcpSocket;
void setSocket(QLocalUnixSocket*);
@@ -139,6 +140,7 @@ public:
QWindowsPipeReader *pipeReader;
QLocalSocket::LocalSocketError error;
#else
+ qint64 skip(qint64 maxSize) override;
QLocalUnixSocket unixSocket;
QString generateErrorString(QLocalSocket::LocalSocketError, const QString &function) const;
void errorOccurred(QLocalSocket::LocalSocketError, const QString &function);
diff --git a/src/network/socket/qlocalsocket_tcp.cpp b/src/network/socket/qlocalsocket_tcp.cpp
index 379cdd096d..41e5b47627 100644
--- a/src/network/socket/qlocalsocket_tcp.cpp
+++ b/src/network/socket/qlocalsocket_tcp.cpp
@@ -83,6 +83,11 @@ void QLocalSocketPrivate::setSocket(QLocalUnixSocket* socket)
tcpSocket->setParent(q);
}
+qint64 QLocalSocketPrivate::skip(qint64 maxSize)
+{
+ return tcpSocket->skip(maxSize);
+}
+
void QLocalSocketPrivate::_q_error(QAbstractSocket::SocketError socketError)
{
Q_Q(QLocalSocket);
diff --git a/src/network/socket/qlocalsocket_unix.cpp b/src/network/socket/qlocalsocket_unix.cpp
index c1d79e8137..d1df26d9f1 100644
--- a/src/network/socket/qlocalsocket_unix.cpp
+++ b/src/network/socket/qlocalsocket_unix.cpp
@@ -88,6 +88,11 @@ void QLocalSocketPrivate::init()
unixSocket.setParent(q);
}
+qint64 QLocalSocketPrivate::skip(qint64 maxSize)
+{
+ return unixSocket.skip(maxSize);
+}
+
void QLocalSocketPrivate::_q_error(QAbstractSocket::SocketError socketError)
{
Q_Q(QLocalSocket);
diff --git a/src/network/socket/qnativesocketengine_p.h b/src/network/socket/qnativesocketengine_p.h
index d488ce150c..aa61b74823 100644
--- a/src/network/socket/qnativesocketengine_p.h
+++ b/src/network/socket/qnativesocketengine_p.h
@@ -128,43 +128,43 @@ public:
QNativeSocketEngine(QObject *parent = 0);
~QNativeSocketEngine();
- bool initialize(QAbstractSocket::SocketType type, QAbstractSocket::NetworkLayerProtocol protocol = QAbstractSocket::IPv4Protocol) Q_DECL_OVERRIDE;
- bool initialize(qintptr socketDescriptor, QAbstractSocket::SocketState socketState = QAbstractSocket::ConnectedState) Q_DECL_OVERRIDE;
+ bool initialize(QAbstractSocket::SocketType type, QAbstractSocket::NetworkLayerProtocol protocol = QAbstractSocket::IPv4Protocol) override;
+ bool initialize(qintptr socketDescriptor, QAbstractSocket::SocketState socketState = QAbstractSocket::ConnectedState) override;
- qintptr socketDescriptor() const Q_DECL_OVERRIDE;
+ qintptr socketDescriptor() const override;
- bool isValid() const Q_DECL_OVERRIDE;
+ bool isValid() const override;
- bool connectToHost(const QHostAddress &address, quint16 port) Q_DECL_OVERRIDE;
- bool connectToHostByName(const QString &name, quint16 port) Q_DECL_OVERRIDE;
- bool bind(const QHostAddress &address, quint16 port) Q_DECL_OVERRIDE;
- bool listen() Q_DECL_OVERRIDE;
- int accept() Q_DECL_OVERRIDE;
- void close() Q_DECL_OVERRIDE;
+ bool connectToHost(const QHostAddress &address, quint16 port) override;
+ bool connectToHostByName(const QString &name, quint16 port) override;
+ bool bind(const QHostAddress &address, quint16 port) override;
+ bool listen() override;
+ int accept() override;
+ void close() override;
- qint64 bytesAvailable() const Q_DECL_OVERRIDE;
+ qint64 bytesAvailable() const override;
- qint64 read(char *data, qint64 maxlen) Q_DECL_OVERRIDE;
- qint64 write(const char *data, qint64 len) Q_DECL_OVERRIDE;
+ qint64 read(char *data, qint64 maxlen) override;
+ qint64 write(const char *data, qint64 len) override;
#ifndef QT_NO_UDPSOCKET
#ifndef QT_NO_NETWORKINTERFACE
bool joinMulticastGroup(const QHostAddress &groupAddress,
- const QNetworkInterface &iface) Q_DECL_OVERRIDE;
+ const QNetworkInterface &iface) override;
bool leaveMulticastGroup(const QHostAddress &groupAddress,
- const QNetworkInterface &iface) Q_DECL_OVERRIDE;
- QNetworkInterface multicastInterface() const Q_DECL_OVERRIDE;
- bool setMulticastInterface(const QNetworkInterface &iface) Q_DECL_OVERRIDE;
+ const QNetworkInterface &iface) override;
+ QNetworkInterface multicastInterface() const override;
+ bool setMulticastInterface(const QNetworkInterface &iface) override;
#endif
- bool hasPendingDatagrams() const Q_DECL_OVERRIDE;
- qint64 pendingDatagramSize() const Q_DECL_OVERRIDE;
+ bool hasPendingDatagrams() const override;
+ qint64 pendingDatagramSize() const override;
#endif // QT_NO_UDPSOCKET
qint64 readDatagram(char *data, qint64 maxlen, QIpPacketHeader * = 0,
- PacketHeaderOptions = WantNone) Q_DECL_OVERRIDE;
- qint64 writeDatagram(const char *data, qint64 len, const QIpPacketHeader &) Q_DECL_OVERRIDE;
- qint64 bytesToWrite() const Q_DECL_OVERRIDE;
+ PacketHeaderOptions = WantNone) override;
+ qint64 writeDatagram(const char *data, qint64 len, const QIpPacketHeader &) override;
+ qint64 bytesToWrite() const override;
#if 0 // currently unused
qint64 receiveBufferSize() const;
@@ -174,21 +174,21 @@ public:
void setSendBufferSize(qint64 bufferSize);
#endif
- int option(SocketOption option) const Q_DECL_OVERRIDE;
- bool setOption(SocketOption option, int value) Q_DECL_OVERRIDE;
+ int option(SocketOption option) const override;
+ bool setOption(SocketOption option, int value) override;
- bool waitForRead(int msecs = 30000, bool *timedOut = 0) Q_DECL_OVERRIDE;
- bool waitForWrite(int msecs = 30000, bool *timedOut = 0) Q_DECL_OVERRIDE;
+ bool waitForRead(int msecs = 30000, bool *timedOut = 0) override;
+ bool waitForWrite(int msecs = 30000, bool *timedOut = 0) override;
bool waitForReadOrWrite(bool *readyToRead, bool *readyToWrite,
bool checkRead, bool checkWrite,
- int msecs = 30000, bool *timedOut = 0) Q_DECL_OVERRIDE;
-
- bool isReadNotificationEnabled() const Q_DECL_OVERRIDE;
- void setReadNotificationEnabled(bool enable) Q_DECL_OVERRIDE;
- bool isWriteNotificationEnabled() const Q_DECL_OVERRIDE;
- void setWriteNotificationEnabled(bool enable) Q_DECL_OVERRIDE;
- bool isExceptionNotificationEnabled() const Q_DECL_OVERRIDE;
- void setExceptionNotificationEnabled(bool enable) Q_DECL_OVERRIDE;
+ int msecs = 30000, bool *timedOut = 0) override;
+
+ bool isReadNotificationEnabled() const override;
+ void setReadNotificationEnabled(bool enable) override;
+ bool isWriteNotificationEnabled() const override;
+ void setWriteNotificationEnabled(bool enable) override;
+ bool isExceptionNotificationEnabled() const override;
+ void setExceptionNotificationEnabled(bool enable) override;
public Q_SLOTS:
// non-virtual override;
diff --git a/src/network/socket/qnativesocketengine_unix.cpp b/src/network/socket/qnativesocketengine_unix.cpp
index cb0a521360..b380b0f7d6 100644
--- a/src/network/socket/qnativesocketengine_unix.cpp
+++ b/src/network/socket/qnativesocketengine_unix.cpp
@@ -226,6 +226,20 @@ static void convertToLevelAndOption(QNativeSocketEngine::SocketOption opt,
#endif
}
break;
+
+ case QNativeSocketEngine::PathMtuInformation:
+ if (socketProtocol == QAbstractSocket::IPv6Protocol || socketProtocol == QAbstractSocket::AnyIPProtocol) {
+#ifdef IPV6_MTU
+ level = IPPROTO_IPV6;
+ n = IPV6_MTU;
+#endif
+ } else {
+#ifdef IP_MTU
+ level = IPPROTO_IP;
+ n = IP_MTU;
+#endif
+ }
+ break;
}
}
@@ -331,6 +345,20 @@ int QNativeSocketEnginePrivate::option(QNativeSocketEngine::SocketOption opt) co
return -1;
}
+ case QNativeSocketEngine::PathMtuInformation:
+#if defined(IPV6_PATHMTU) && !defined(IPV6_MTU)
+ // Prefer IPV6_MTU (handled by convertToLevelAndOption), if available
+ // (Linux); fall back to IPV6_PATHMTU otherwise (FreeBSD):
+ if (socketProtocol == QAbstractSocket::IPv6Protocol) {
+ ip6_mtuinfo mtuinfo;
+ QT_SOCKOPTLEN_T len = sizeof(mtuinfo);
+ if (::getsockopt(socketDescriptor, IPPROTO_IPV6, IPV6_PATHMTU, &mtuinfo, &len) == 0)
+ return int(mtuinfo.ip6m_mtu);
+ return -1;
+ }
+#endif
+ break;
+
default:
break;
}
@@ -420,6 +448,8 @@ bool QNativeSocketEnginePrivate::setOption(QNativeSocketEngine::SocketOption opt
}
#endif
+ if (n == -1)
+ return false;
return ::setsockopt(socketDescriptor, level, n, (char *) &v, sizeof(v)) == 0;
}
diff --git a/src/network/socket/qnativesocketengine_win.cpp b/src/network/socket/qnativesocketengine_win.cpp
index 6a091209be..c303f01648 100644
--- a/src/network/socket/qnativesocketengine_win.cpp
+++ b/src/network/socket/qnativesocketengine_win.cpp
@@ -209,7 +209,7 @@ static inline void qt_socket_getPortAndAddress(SOCKET socketDescriptor, const qt
static void convertToLevelAndOption(QNativeSocketEngine::SocketOption opt,
QAbstractSocket::NetworkLayerProtocol socketProtocol, int &level, int &n)
{
- n = 0;
+ n = -1;
level = SOL_SOCKET; // default
switch (opt) {
@@ -281,6 +281,9 @@ static void convertToLevelAndOption(QNativeSocketEngine::SocketOption opt,
n = IP_HOPLIMIT;
}
break;
+
+ case QAbstractSocketEngine::PathMtuInformation:
+ break; // not supported on Windows
}
}
@@ -471,9 +474,11 @@ int QNativeSocketEnginePrivate::option(QNativeSocketEngine::SocketOption opt) co
QT_SOCKOPTLEN_T len = sizeof(v);
convertToLevelAndOption(opt, socketProtocol, level, n);
- if (getsockopt(socketDescriptor, level, n, (char *) &v, &len) == 0)
- return v;
- WS_ERROR_DEBUG(WSAGetLastError());
+ if (n != -1) {
+ if (getsockopt(socketDescriptor, level, n, (char *) &v, &len) == 0)
+ return v;
+ WS_ERROR_DEBUG(WSAGetLastError());
+ }
return -1;
}
@@ -491,9 +496,7 @@ bool QNativeSocketEnginePrivate::setOption(QNativeSocketEngine::SocketOption opt
switch (opt) {
case QNativeSocketEngine::SendBufferSocketOption:
// see QTBUG-30478 SO_SNDBUF should not be used on Vista or later
- if (QSysInfo::windowsVersion() >= QSysInfo::WV_VISTA)
- return false;
- break;
+ return false;
case QNativeSocketEngine::NonBlockingSocketOption:
{
unsigned long buf = v;
@@ -516,6 +519,8 @@ bool QNativeSocketEnginePrivate::setOption(QNativeSocketEngine::SocketOption opt
int n, level;
convertToLevelAndOption(opt, socketProtocol, level, n);
+ if (n == -1)
+ return false;
if (::setsockopt(socketDescriptor, level, n, (char*)&v, sizeof(v)) != 0) {
WS_ERROR_DEBUG(WSAGetLastError());
return false;
@@ -571,7 +576,6 @@ bool QNativeSocketEnginePrivate::fetchConnectionParameters()
DWORD ipv6only = 0;
QT_SOCKOPTLEN_T optlen = sizeof(ipv6only);
if (localAddress == QHostAddress::AnyIPv6
- && QSysInfo::windowsVersion() >= QSysInfo::WV_6_0
&& !getsockopt(socketDescriptor, IPPROTO_IPV6, IPV6_V6ONLY, (char*)&ipv6only, &optlen )) {
if (!ipv6only) {
socketProtocol = QAbstractSocket::AnyIPProtocol;
@@ -632,10 +636,8 @@ bool QNativeSocketEnginePrivate::nativeConnect(const QHostAddress &address, quin
if ((socketProtocol == QAbstractSocket::IPv6Protocol || socketProtocol == QAbstractSocket::AnyIPProtocol) && address.toIPv4Address()) {
//IPV6_V6ONLY option must be cleared to connect to a V4 mapped address
- if (QSysInfo::windowsVersion() >= QSysInfo::WV_6_0) {
- DWORD ipv6only = 0;
- ipv6only = ::setsockopt(socketDescriptor, IPPROTO_IPV6, IPV6_V6ONLY, (char*)&ipv6only, sizeof(ipv6only) );
- }
+ DWORD ipv6only = 0;
+ ipv6only = ::setsockopt(socketDescriptor, IPPROTO_IPV6, IPV6_V6ONLY, (char*)&ipv6only, sizeof(ipv6only) );
}
forever {
diff --git a/src/network/socket/qnativesocketengine_winrt.cpp b/src/network/socket/qnativesocketengine_winrt.cpp
index b7d7042923..9df5f0c500 100644
--- a/src/network/socket/qnativesocketengine_winrt.cpp
+++ b/src/network/socket/qnativesocketengine_winrt.cpp
@@ -1340,7 +1340,7 @@ QNativeSocketEnginePrivate::QNativeSocketEnginePrivate()
, closingDown(false)
, socketDescriptor(-1)
, worker(new SocketEngineWorker(this))
- , sslSocket(Q_NULLPTR)
+ , sslSocket(nullptr)
, connectionToken( { -1 } )
{
}
@@ -1514,6 +1514,7 @@ int QNativeSocketEnginePrivate::option(QAbstractSocketEngine::SocketOption opt)
case QAbstractSocketEngine::MulticastLoopbackOption:
case QAbstractSocketEngine::TypeOfServiceOption:
case QAbstractSocketEngine::MaxStreamsSocketOption:
+ case QAbstractSocketEngine::PathMtuInformation:
default:
return -1;
}
@@ -1573,6 +1574,7 @@ bool QNativeSocketEnginePrivate::setOption(QAbstractSocketEngine::SocketOption o
case QAbstractSocketEngine::MulticastLoopbackOption:
case QAbstractSocketEngine::TypeOfServiceOption:
case QAbstractSocketEngine::MaxStreamsSocketOption:
+ case QAbstractSocketEngine::PathMtuInformation:
default:
return false;
}
diff --git a/src/network/socket/qnet_unix_p.h b/src/network/socket/qnet_unix_p.h
index 5359872f96..e038352352 100644
--- a/src/network/socket/qnet_unix_p.h
+++ b/src/network/socket/qnet_unix_p.h
@@ -78,7 +78,6 @@ QT_BEGIN_NAMESPACE
# define QT_SOCKOPTLEN_T QT_SOCKLEN_T
#endif
-// UnixWare 7 redefines socket -> _socket
static inline int qt_safe_socket(int domain, int type, int protocol, int flags = 0)
{
Q_ASSERT((flags & ~O_NONBLOCK) == 0);
@@ -105,7 +104,6 @@ static inline int qt_safe_socket(int domain, int type, int protocol, int flags =
#endif
}
-// Tru64 redefines accept -> _accept with _XOPEN_SOURCE_EXTENDED
static inline int qt_safe_accept(int s, struct sockaddr *addr, QT_SOCKLEN_T *addrlen, int flags = 0)
{
Q_ASSERT((flags & ~O_NONBLOCK) == 0);
@@ -137,7 +135,6 @@ static inline int qt_safe_accept(int s, struct sockaddr *addr, QT_SOCKLEN_T *add
#endif
}
-// UnixWare 7 redefines listen -> _listen
static inline int qt_safe_listen(int s, int backlog)
{
return ::listen(s, backlog);
diff --git a/src/network/socket/qsctpserver.h b/src/network/socket/qsctpserver.h
index 1afdab28a0..b678ba053d 100644
--- a/src/network/socket/qsctpserver.h
+++ b/src/network/socket/qsctpserver.h
@@ -63,7 +63,7 @@ public:
QSctpSocket *nextPendingDatagramConnection();
protected:
- void incomingConnection(qintptr handle) Q_DECL_OVERRIDE;
+ void incomingConnection(qintptr handle) override;
private:
Q_DISABLE_COPY(QSctpServer)
diff --git a/src/network/socket/qsctpserver_p.h b/src/network/socket/qsctpserver_p.h
index 274939fc3d..8816cc150e 100644
--- a/src/network/socket/qsctpserver_p.h
+++ b/src/network/socket/qsctpserver_p.h
@@ -66,7 +66,7 @@ public:
int maximumChannelCount;
- void configureCreatedSocket() Q_DECL_OVERRIDE;
+ void configureCreatedSocket() override;
};
#endif // QT_NO_SCTP
diff --git a/src/network/socket/qsctpsocket.h b/src/network/socket/qsctpsocket.h
index 9bed1890ff..5288da6129 100644
--- a/src/network/socket/qsctpsocket.h
+++ b/src/network/socket/qsctpsocket.h
@@ -56,8 +56,8 @@ public:
explicit QSctpSocket(QObject *parent = nullptr);
virtual ~QSctpSocket();
- void close() Q_DECL_OVERRIDE;
- void disconnectFromHost() Q_DECL_OVERRIDE;
+ void close() override;
+ void disconnectFromHost() override;
void setMaximumChannelCount(int count);
int maximumChannelCount() const;
@@ -67,8 +67,8 @@ public:
bool writeDatagram(const QNetworkDatagram &datagram);
protected:
- qint64 readData(char *data, qint64 maxlen) Q_DECL_OVERRIDE;
- qint64 readLineData(char *data, qint64 maxlen) Q_DECL_OVERRIDE;
+ qint64 readData(char *data, qint64 maxlen) override;
+ qint64 readLineData(char *data, qint64 maxlen) override;
private:
Q_DISABLE_COPY(QSctpSocket)
diff --git a/src/network/socket/qsctpsocket_p.h b/src/network/socket/qsctpsocket_p.h
index 3f765ebed9..8f9413cb47 100644
--- a/src/network/socket/qsctpsocket_p.h
+++ b/src/network/socket/qsctpsocket_p.h
@@ -70,8 +70,8 @@ public:
QSctpSocketPrivate();
virtual ~QSctpSocketPrivate();
- bool canReadNotification() Q_DECL_OVERRIDE;
- bool writeToSocket() Q_DECL_OVERRIDE;
+ bool canReadNotification() override;
+ bool writeToSocket() override;
QByteArray incomingDatagram;
int maximumChannelCount;
@@ -80,7 +80,7 @@ public:
QVector<IpHeaderList> readHeaders;
QVector<IpHeaderList> writeHeaders;
- void configureCreatedSocket() Q_DECL_OVERRIDE;
+ void configureCreatedSocket() override;
};
#endif // QT_NO_SCTP
diff --git a/src/network/socket/qsocks5socketengine.cpp b/src/network/socket/qsocks5socketengine.cpp
index fa5f198bf2..a07ea65046 100644
--- a/src/network/socket/qsocks5socketengine.cpp
+++ b/src/network/socket/qsocks5socketengine.cpp
@@ -320,7 +320,7 @@ public:
QSocks5BindData *retrieve(qintptr socketDescriptor);
protected:
- void timerEvent(QTimerEvent * event) Q_DECL_OVERRIDE;
+ void timerEvent(QTimerEvent * event) override;
QMutex mutex;
int sweepTimerId;
diff --git a/src/network/socket/qsocks5socketengine_p.h b/src/network/socket/qsocks5socketengine_p.h
index b248554ae5..1942eff4ca 100644
--- a/src/network/socket/qsocks5socketengine_p.h
+++ b/src/network/socket/qsocks5socketengine_p.h
@@ -68,62 +68,62 @@ public:
QSocks5SocketEngine(QObject *parent = 0);
~QSocks5SocketEngine();
- bool initialize(QAbstractSocket::SocketType type, QAbstractSocket::NetworkLayerProtocol protocol = QAbstractSocket::IPv4Protocol) Q_DECL_OVERRIDE;
- bool initialize(qintptr socketDescriptor, QAbstractSocket::SocketState socketState = QAbstractSocket::ConnectedState) Q_DECL_OVERRIDE;
+ bool initialize(QAbstractSocket::SocketType type, QAbstractSocket::NetworkLayerProtocol protocol = QAbstractSocket::IPv4Protocol) override;
+ bool initialize(qintptr socketDescriptor, QAbstractSocket::SocketState socketState = QAbstractSocket::ConnectedState) override;
void setProxy(const QNetworkProxy &networkProxy);
- qintptr socketDescriptor() const Q_DECL_OVERRIDE;
+ qintptr socketDescriptor() const override;
- bool isValid() const Q_DECL_OVERRIDE;
+ bool isValid() const override;
bool connectInternal();
- bool connectToHost(const QHostAddress &address, quint16 port) Q_DECL_OVERRIDE;
- bool connectToHostByName(const QString &name, quint16 port) Q_DECL_OVERRIDE;
- bool bind(const QHostAddress &address, quint16 port) Q_DECL_OVERRIDE;
- bool listen() Q_DECL_OVERRIDE;
- int accept() Q_DECL_OVERRIDE;
- void close() Q_DECL_OVERRIDE;
+ bool connectToHost(const QHostAddress &address, quint16 port) override;
+ bool connectToHostByName(const QString &name, quint16 port) override;
+ bool bind(const QHostAddress &address, quint16 port) override;
+ bool listen() override;
+ int accept() override;
+ void close() override;
- qint64 bytesAvailable() const Q_DECL_OVERRIDE;
+ qint64 bytesAvailable() const override;
- qint64 read(char *data, qint64 maxlen) Q_DECL_OVERRIDE;
- qint64 write(const char *data, qint64 len) Q_DECL_OVERRIDE;
+ qint64 read(char *data, qint64 maxlen) override;
+ qint64 write(const char *data, qint64 len) override;
#ifndef QT_NO_UDPSOCKET
#ifndef QT_NO_NETWORKINTERFACE
bool joinMulticastGroup(const QHostAddress &groupAddress,
- const QNetworkInterface &interface) Q_DECL_OVERRIDE;
+ const QNetworkInterface &interface) override;
bool leaveMulticastGroup(const QHostAddress &groupAddress,
- const QNetworkInterface &interface) Q_DECL_OVERRIDE;
- QNetworkInterface multicastInterface() const Q_DECL_OVERRIDE;
- bool setMulticastInterface(const QNetworkInterface &iface) Q_DECL_OVERRIDE;
+ const QNetworkInterface &interface) override;
+ QNetworkInterface multicastInterface() const override;
+ bool setMulticastInterface(const QNetworkInterface &iface) override;
#endif // QT_NO_NETWORKINTERFACE
- bool hasPendingDatagrams() const Q_DECL_OVERRIDE;
- qint64 pendingDatagramSize() const Q_DECL_OVERRIDE;
+ bool hasPendingDatagrams() const override;
+ qint64 pendingDatagramSize() const override;
#endif // QT_NO_UDPSOCKET
qint64 readDatagram(char *data, qint64 maxlen, QIpPacketHeader * = 0,
- PacketHeaderOptions = WantNone) Q_DECL_OVERRIDE;
- qint64 writeDatagram(const char *data, qint64 len, const QIpPacketHeader &) Q_DECL_OVERRIDE;
- qint64 bytesToWrite() const Q_DECL_OVERRIDE;
+ PacketHeaderOptions = WantNone) override;
+ qint64 writeDatagram(const char *data, qint64 len, const QIpPacketHeader &) override;
+ qint64 bytesToWrite() const override;
- int option(SocketOption option) const Q_DECL_OVERRIDE;
- bool setOption(SocketOption option, int value) Q_DECL_OVERRIDE;
+ int option(SocketOption option) const override;
+ bool setOption(SocketOption option, int value) override;
- bool waitForRead(int msecs = 30000, bool *timedOut = 0) Q_DECL_OVERRIDE;
- bool waitForWrite(int msecs = 30000, bool *timedOut = 0) Q_DECL_OVERRIDE;
+ bool waitForRead(int msecs = 30000, bool *timedOut = 0) override;
+ bool waitForWrite(int msecs = 30000, bool *timedOut = 0) override;
bool waitForReadOrWrite(bool *readyToRead, bool *readyToWrite,
bool checkRead, bool checkWrite,
- int msecs = 30000, bool *timedOut = 0) Q_DECL_OVERRIDE;
+ int msecs = 30000, bool *timedOut = 0) override;
- bool isReadNotificationEnabled() const Q_DECL_OVERRIDE;
- void setReadNotificationEnabled(bool enable) Q_DECL_OVERRIDE;
- bool isWriteNotificationEnabled() const Q_DECL_OVERRIDE;
- void setWriteNotificationEnabled(bool enable) Q_DECL_OVERRIDE;
- bool isExceptionNotificationEnabled() const Q_DECL_OVERRIDE;
- void setExceptionNotificationEnabled(bool enable) Q_DECL_OVERRIDE;
+ bool isReadNotificationEnabled() const override;
+ void setReadNotificationEnabled(bool enable) override;
+ bool isWriteNotificationEnabled() const override;
+ void setWriteNotificationEnabled(bool enable) override;
+ bool isExceptionNotificationEnabled() const override;
+ void setExceptionNotificationEnabled(bool enable) override;
private:
Q_DECLARE_PRIVATE(QSocks5SocketEngine)
@@ -166,11 +166,11 @@ class QSocks5PasswordAuthenticator : public QSocks5Authenticator
{
public:
QSocks5PasswordAuthenticator(const QString &userName, const QString &password);
- char methodId() Q_DECL_OVERRIDE;
- bool beginAuthenticate(QTcpSocket *socket, bool *completed) Q_DECL_OVERRIDE;
- bool continueAuthenticate(QTcpSocket *socket, bool *completed) Q_DECL_OVERRIDE;
+ char methodId() override;
+ bool beginAuthenticate(QTcpSocket *socket, bool *completed) override;
+ bool continueAuthenticate(QTcpSocket *socket, bool *completed) override;
- QString errorString() Q_DECL_OVERRIDE;
+ QString errorString() override;
private:
QString userName;
@@ -287,8 +287,8 @@ class Q_AUTOTEST_EXPORT QSocks5SocketEngineHandler : public QSocketEngineHandler
{
public:
virtual QAbstractSocketEngine *createSocketEngine(QAbstractSocket::SocketType socketType,
- const QNetworkProxy &, QObject *parent) Q_DECL_OVERRIDE;
- virtual QAbstractSocketEngine *createSocketEngine(qintptr socketDescriptor, QObject *parent) Q_DECL_OVERRIDE;
+ const QNetworkProxy &, QObject *parent) override;
+ virtual QAbstractSocketEngine *createSocketEngine(qintptr socketDescriptor, QObject *parent) override;
};
QT_END_NAMESPACE
diff --git a/src/network/socket/qtcpserver.h b/src/network/socket/qtcpserver.h
index 192cbce54c..37df12919f 100644
--- a/src/network/socket/qtcpserver.h
+++ b/src/network/socket/qtcpserver.h
@@ -58,7 +58,7 @@ class Q_NETWORK_EXPORT QTcpServer : public QObject
{
Q_OBJECT
public:
- explicit QTcpServer(QObject *parent = Q_NULLPTR);
+ explicit QTcpServer(QObject *parent = nullptr);
virtual ~QTcpServer();
bool listen(const QHostAddress &address = QHostAddress::Any, quint16 port = 0);
@@ -75,7 +75,7 @@ public:
qintptr socketDescriptor() const;
bool setSocketDescriptor(qintptr socketDescriptor);
- bool waitForNewConnection(int msec = 0, bool *timedOut = Q_NULLPTR);
+ bool waitForNewConnection(int msec = 0, bool *timedOut = nullptr);
virtual bool hasPendingConnections() const;
virtual QTcpSocket *nextPendingConnection();
@@ -95,7 +95,7 @@ protected:
void addPendingConnection(QTcpSocket* socket);
QTcpServer(QAbstractSocket::SocketType socketType, QTcpServerPrivate &dd,
- QObject *parent = Q_NULLPTR);
+ QObject *parent = nullptr);
Q_SIGNALS:
void newConnection();
diff --git a/src/network/socket/qtcpserver_p.h b/src/network/socket/qtcpserver_p.h
index b7fae4c105..6ee8c5f0b1 100644
--- a/src/network/socket/qtcpserver_p.h
+++ b/src/network/socket/qtcpserver_p.h
@@ -93,13 +93,13 @@ public:
virtual void configureCreatedSocket();
// from QAbstractSocketEngineReceiver
- void readNotification() Q_DECL_OVERRIDE;
- void closeNotification() Q_DECL_OVERRIDE { readNotification(); }
- void writeNotification() Q_DECL_OVERRIDE {}
- void exceptionNotification() Q_DECL_OVERRIDE {}
- void connectionNotification() Q_DECL_OVERRIDE {}
+ void readNotification() override;
+ void closeNotification() override { readNotification(); }
+ void writeNotification() override {}
+ void exceptionNotification() override {}
+ void connectionNotification() override {}
#ifndef QT_NO_NETWORKPROXY
- void proxyAuthenticationRequired(const QNetworkProxy &, QAuthenticator *) Q_DECL_OVERRIDE {}
+ void proxyAuthenticationRequired(const QNetworkProxy &, QAuthenticator *) override {}
#endif
};
diff --git a/src/network/socket/qtcpsocket.h b/src/network/socket/qtcpsocket.h
index 3c3e3b69fd..b2c8bcc884 100644
--- a/src/network/socket/qtcpsocket.h
+++ b/src/network/socket/qtcpsocket.h
@@ -53,13 +53,13 @@ class Q_NETWORK_EXPORT QTcpSocket : public QAbstractSocket
{
Q_OBJECT
public:
- explicit QTcpSocket(QObject *parent = Q_NULLPTR);
+ explicit QTcpSocket(QObject *parent = nullptr);
virtual ~QTcpSocket();
protected:
- QTcpSocket(QTcpSocketPrivate &dd, QObject *parent = Q_NULLPTR);
+ QTcpSocket(QTcpSocketPrivate &dd, QObject *parent = nullptr);
QTcpSocket(QAbstractSocket::SocketType socketType, QTcpSocketPrivate &dd,
- QObject *parent = Q_NULLPTR);
+ QObject *parent = nullptr);
private:
Q_DISABLE_COPY(QTcpSocket)
diff --git a/src/network/socket/qudpsocket.h b/src/network/socket/qudpsocket.h
index 6ef10e2edb..ce4429d1cd 100644
--- a/src/network/socket/qudpsocket.h
+++ b/src/network/socket/qudpsocket.h
@@ -57,7 +57,7 @@ class Q_NETWORK_EXPORT QUdpSocket : public QAbstractSocket
{
Q_OBJECT
public:
- explicit QUdpSocket(QObject *parent = Q_NULLPTR);
+ explicit QUdpSocket(QObject *parent = nullptr);
virtual ~QUdpSocket();
#ifndef QT_NO_NETWORKINTERFACE
@@ -75,7 +75,7 @@ public:
bool hasPendingDatagrams() const;
qint64 pendingDatagramSize() const;
QNetworkDatagram receiveDatagram(qint64 maxSize = -1);
- qint64 readDatagram(char *data, qint64 maxlen, QHostAddress *host = Q_NULLPTR, quint16 *port = Q_NULLPTR);
+ qint64 readDatagram(char *data, qint64 maxlen, QHostAddress *host = nullptr, quint16 *port = nullptr);
qint64 writeDatagram(const QNetworkDatagram &datagram);
qint64 writeDatagram(const char *data, qint64 len, const QHostAddress &host, quint16 port);
diff --git a/src/network/socket/socket.pri b/src/network/socket/socket.pri
index b2ee1a8054..a8a37492b7 100644
--- a/src/network/socket/socket.pri
+++ b/src/network/socket/socket.pri
@@ -1,7 +1,6 @@
# Qt network socket
HEADERS += socket/qabstractsocketengine_p.h \
- socket/qhttpsocketengine_p.h \
socket/qabstractsocket.h \
socket/qabstractsocket_p.h \
socket/qtcpsocket.h \
@@ -11,7 +10,6 @@ HEADERS += socket/qabstractsocketengine_p.h \
socket/qtcpserver_p.h
SOURCES += socket/qabstractsocketengine.cpp \
- socket/qhttpsocketengine.cpp \
socket/qabstractsocket.cpp \
socket/qtcpsocket.cpp \
socket/qudpsocket.cpp \
@@ -26,6 +24,13 @@ qtConfig(socks5) {
socket/qsocks5socketengine.cpp
}
+qtConfig(http) {
+ HEADERS += \
+ socket/qhttpsocketengine_p.h
+ SOURCES += \
+ socket/qhttpsocketengine.cpp
+}
+
# SCTP support.
qtConfig(sctp) {
diff --git a/src/network/ssl/qsslcertificate.h b/src/network/ssl/qsslcertificate.h
index 8b051a5c88..6cd66fd20f 100644
--- a/src/network/ssl/qsslcertificate.h
+++ b/src/network/ssl/qsslcertificate.h
@@ -154,7 +154,7 @@ public:
static bool importPkcs12(QIODevice *device,
QSslKey *key, QSslCertificate *cert,
- QList<QSslCertificate> *caCertificates = Q_NULLPTR,
+ QList<QSslCertificate> *caCertificates = nullptr,
const QByteArray &passPhrase=QByteArray());
Qt::HANDLE handle() const;
diff --git a/src/network/ssl/qssldiffiehellmanparameters_openssl.cpp b/src/network/ssl/qssldiffiehellmanparameters_openssl.cpp
index 5ebad822f1..00e9be91d8 100644
--- a/src/network/ssl/qssldiffiehellmanparameters_openssl.cpp
+++ b/src/network/ssl/qssldiffiehellmanparameters_openssl.cpp
@@ -161,12 +161,12 @@ void QSslDiffieHellmanParametersPrivate::decodePem(const QByteArray &pem)
return;
}
- DH *dh = Q_NULLPTR;
+ DH *dh = nullptr;
q_PEM_read_bio_DHparams(bio, &dh, 0, 0);
if (dh) {
if (isSafeDH(dh)) {
- char *buf = Q_NULLPTR;
+ char *buf = nullptr;
int len = q_i2d_DHparams(dh, reinterpret_cast<unsigned char **>(&buf));
if (len > 0)
derData = QByteArray(buf, len);
diff --git a/src/network/ssl/qsslkey_qt.cpp b/src/network/ssl/qsslkey_qt.cpp
index fd76d3353a..a85fed21ed 100644
--- a/src/network/ssl/qsslkey_qt.cpp
+++ b/src/network/ssl/qsslkey_qt.cpp
@@ -43,6 +43,7 @@
#include <QtCore/qdatastream.h>
#include <QtCore/qcryptographichash.h>
+#include <QtCore/qrandom.h>
QT_USE_NAMESPACE
@@ -286,10 +287,8 @@ QByteArray QSslKeyPrivate::toPem(const QByteArray &passPhrase) const
if (type == QSsl::PrivateKey && !passPhrase.isEmpty()) {
// ### use a cryptographically secure random number generator
- QByteArray iv;
- iv.resize(8);
- for (int i = 0; i < iv.size(); ++i)
- iv[i] = (qrand() & 0xff);
+ quint64 random = QRandomGenerator::system()->generate64();
+ QByteArray iv = QByteArray::fromRawData(reinterpret_cast<const char *>(&random), sizeof(random));
Cipher cipher = DesEde3Cbc;
const QByteArray key = deriveKey(cipher, passPhrase, iv);
diff --git a/src/network/ssl/qsslsocket.cpp b/src/network/ssl/qsslsocket.cpp
index adff568f5b..145ae1a3c8 100644
--- a/src/network/ssl/qsslsocket.cpp
+++ b/src/network/ssl/qsslsocket.cpp
@@ -2659,6 +2659,20 @@ QByteArray QSslSocketPrivate::peek(qint64 maxSize)
/*!
\internal
*/
+qint64 QSslSocketPrivate::skip(qint64 maxSize)
+{
+ if (mode == QSslSocket::UnencryptedMode && !autoStartHandshake)
+ return plainSocket->skip(maxSize);
+
+ // In encrypted mode, the SSL backend writes decrypted data directly into the
+ // QIODevice's read buffer. As this buffer is always emptied by the caller,
+ // we need to wait for more incoming data.
+ return (state == QAbstractSocket::ConnectedState) ? Q_INT64_C(0) : Q_INT64_C(-1);
+}
+
+/*!
+ \internal
+*/
bool QSslSocketPrivate::flush()
{
#ifdef QSSLSOCKET_DEBUG
diff --git a/src/network/ssl/qsslsocket.h b/src/network/ssl/qsslsocket.h
index 39e70bccda..c66ebdde54 100644
--- a/src/network/ssl/qsslsocket.h
+++ b/src/network/ssl/qsslsocket.h
@@ -79,22 +79,22 @@ public:
AutoVerifyPeer
};
- explicit QSslSocket(QObject *parent = Q_NULLPTR);
+ explicit QSslSocket(QObject *parent = nullptr);
~QSslSocket();
- void resume() Q_DECL_OVERRIDE; // to continue after proxy authentication required, SSL errors etc.
+ void resume() override; // to continue after proxy authentication required, SSL errors etc.
// Autostarting the SSL client handshake.
void connectToHostEncrypted(const QString &hostName, quint16 port, OpenMode mode = ReadWrite, NetworkLayerProtocol protocol = AnyIPProtocol);
void connectToHostEncrypted(const QString &hostName, quint16 port, const QString &sslPeerName, OpenMode mode = ReadWrite, NetworkLayerProtocol protocol = AnyIPProtocol);
bool setSocketDescriptor(qintptr socketDescriptor, SocketState state = ConnectedState,
- OpenMode openMode = ReadWrite) Q_DECL_OVERRIDE;
+ OpenMode openMode = ReadWrite) override;
using QAbstractSocket::connectToHost;
- void connectToHost(const QString &hostName, quint16 port, OpenMode openMode = ReadWrite, NetworkLayerProtocol protocol = AnyIPProtocol) Q_DECL_OVERRIDE;
- void disconnectFromHost() Q_DECL_OVERRIDE;
+ void connectToHost(const QString &hostName, quint16 port, OpenMode openMode = ReadWrite, NetworkLayerProtocol protocol = AnyIPProtocol) override;
+ void disconnectFromHost() override;
- virtual void setSocketOption(QAbstractSocket::SocketOption option, const QVariant &value) Q_DECL_OVERRIDE;
- virtual QVariant socketOption(QAbstractSocket::SocketOption option) Q_DECL_OVERRIDE;
+ virtual void setSocketOption(QAbstractSocket::SocketOption option, const QVariant &value) override;
+ virtual QVariant socketOption(QAbstractSocket::SocketOption option) override;
SslMode mode() const;
bool isEncrypted() const;
@@ -112,16 +112,16 @@ public:
void setPeerVerifyName(const QString &hostName);
// From QIODevice
- qint64 bytesAvailable() const Q_DECL_OVERRIDE;
- qint64 bytesToWrite() const Q_DECL_OVERRIDE;
- bool canReadLine() const Q_DECL_OVERRIDE;
- void close() Q_DECL_OVERRIDE;
- bool atEnd() const Q_DECL_OVERRIDE;
+ qint64 bytesAvailable() const override;
+ qint64 bytesToWrite() const override;
+ bool canReadLine() const override;
+ void close() override;
+ bool atEnd() const override;
bool flush(); // ### Qt6: remove me (implementation moved to private flush())
void abort();
// From QAbstractSocket:
- void setReadBufferSize(qint64 size) Q_DECL_OVERRIDE;
+ void setReadBufferSize(qint64 size) override;
// Similar to QIODevice's:
qint64 encryptedBytesAvailable() const;
@@ -179,11 +179,11 @@ public:
QT_DEPRECATED_X("Use QSslConfiguration::systemCaCertificates()") static QList<QSslCertificate> systemCaCertificates();
#endif // QT_DEPRECATED_SINCE(5, 5)
- bool waitForConnected(int msecs = 30000) Q_DECL_OVERRIDE;
+ bool waitForConnected(int msecs = 30000) override;
bool waitForEncrypted(int msecs = 30000);
- bool waitForReadyRead(int msecs = 30000) Q_DECL_OVERRIDE;
- bool waitForBytesWritten(int msecs = 30000) Q_DECL_OVERRIDE;
- bool waitForDisconnected(int msecs = 30000) Q_DECL_OVERRIDE;
+ bool waitForReadyRead(int msecs = 30000) override;
+ bool waitForBytesWritten(int msecs = 30000) override;
+ bool waitForDisconnected(int msecs = 30000) override;
QList<QSslError> sslErrors() const;
@@ -209,8 +209,8 @@ Q_SIGNALS:
void preSharedKeyAuthenticationRequired(QSslPreSharedKeyAuthenticator *authenticator);
protected:
- qint64 readData(char *data, qint64 maxlen) Q_DECL_OVERRIDE;
- qint64 writeData(const char *data, qint64 len) Q_DECL_OVERRIDE;
+ qint64 readData(char *data, qint64 maxlen) override;
+ qint64 writeData(const char *data, qint64 len) override;
private:
Q_DECLARE_PRIVATE(QSslSocket)
diff --git a/src/network/ssl/qsslsocket_mac.cpp b/src/network/ssl/qsslsocket_mac.cpp
index 5312464964..046b432252 100644
--- a/src/network/ssl/qsslsocket_mac.cpp
+++ b/src/network/ssl/qsslsocket_mac.cpp
@@ -49,6 +49,7 @@
#include <QtCore/qmessageauthenticationcode.h>
#include <QtCore/qoperatingsystemversion.h>
#include <QtCore/qcryptographichash.h>
+#include <QtCore/qsystemdetection.h>
#include <QtCore/qdatastream.h>
#include <QtCore/qsysinfo.h>
#include <QtCore/qvector.h>
@@ -161,14 +162,15 @@ EphemeralSecKeychain::~EphemeralSecKeychain()
}
#endif // Q_OS_MACOS
-}
+
+} // unnamed namespace
static SSLContextRef qt_createSecureTransportContext(QSslSocket::SslMode mode)
{
const bool isServer = mode == QSslSocket::SslServerMode;
const SSLProtocolSide side = isServer ? kSSLServerSide : kSSLClientSide;
// We never use kSSLDatagramType, so it's kSSLStreamType unconditionally.
- SSLContextRef context = SSLCreateContext(Q_NULLPTR, side, kSSLStreamType);
+ SSLContextRef context = SSLCreateContext(nullptr, side, kSSLStreamType);
if (!context)
qCWarning(lcSsl) << "SSLCreateContext failed";
return context;
@@ -357,7 +359,7 @@ void QSslSocketPrivate::resetDefaultEllipticCurves()
}
QSslSocketBackendPrivate::QSslSocketBackendPrivate()
- : context(Q_NULLPTR)
+ : context(nullptr)
{
}
@@ -373,6 +375,43 @@ void QSslSocketBackendPrivate::continueHandshake()
#endif
Q_Q(QSslSocket);
connectionEncrypted = true;
+
+#if QT_DARWIN_PLATFORM_SDK_EQUAL_OR_ABOVE(__MAC_NA, __IPHONE_11_0, __TVOS_11_0, __WATCHOS_4_0)
+ // Unlike OpenSSL, Secure Transport does not allow to negotiate protocols via
+ // a callback during handshake. We can only set our list of preferred protocols
+ // (and send it during handshake) and then receive what our peer has sent to us.
+ // And here we can finally try to find a match (if any).
+ if (__builtin_available(iOS 11.0, tvOS 11.0, watchOS 4.0, *)) {
+ const auto &requestedProtocols = configuration.nextAllowedProtocols;
+ if (const int requestedCount = requestedProtocols.size()) {
+ configuration.nextProtocolNegotiationStatus = QSslConfiguration::NextProtocolNegotiationNone;
+ configuration.nextNegotiatedProtocol.clear();
+
+ QCFType<CFArrayRef> cfArray;
+ const OSStatus result = SSLCopyALPNProtocols(context, &cfArray);
+ if (result == errSecSuccess && cfArray && CFArrayGetCount(cfArray)) {
+ const int size = CFArrayGetCount(cfArray);
+ QVector<QString> peerProtocols(size);
+ for (int i = 0; i < size; ++i)
+ peerProtocols[i] = QString::fromCFString((CFStringRef)CFArrayGetValueAtIndex(cfArray, i));
+
+ for (int i = 0; i < requestedCount; ++i) {
+ const auto requestedName = QString::fromLatin1(requestedProtocols[i]);
+ for (int j = 0; j < size; ++j) {
+ if (requestedName == peerProtocols[j]) {
+ configuration.nextNegotiatedProtocol = requestedName.toLatin1();
+ configuration.nextProtocolNegotiationStatus = QSslConfiguration::NextProtocolNegotiationNegotiated;
+ break;
+ }
+ }
+ if (configuration.nextProtocolNegotiationStatus == QSslConfiguration::NextProtocolNegotiationNegotiated)
+ break;
+ }
+ }
+ }
+ }
+#endif // QT_DARWIN_PLATFORM_SDK_EQUAL_OR_ABOVE
+
emit q->encrypted();
if (autoStartHandshake && pendingClose) {
pendingClose = false;
@@ -839,6 +878,29 @@ bool QSslSocketBackendPrivate::initSslContext()
return false;
}
+#if QT_DARWIN_PLATFORM_SDK_EQUAL_OR_ABOVE(__MAC_NA, __IPHONE_11_0, __TVOS_11_0, __WATCHOS_4_0)
+ if (__builtin_available(iOS 11.0, tvOS 11.0, watchOS 4.0, *)) {
+ const auto protocolNames = configuration.nextAllowedProtocols;
+ QCFType<CFMutableArrayRef> cfNames(CFArrayCreateMutable(nullptr, 0, &kCFTypeArrayCallBacks));
+ if (cfNames) {
+ for (const QByteArray &name : protocolNames) {
+ QCFString cfName(QString::fromLatin1(name).toCFString());
+ CFArrayAppendValue(cfNames, cfName);
+ }
+
+ if (CFArrayGetCount(cfNames)) {
+ // Up to the application layer to check that negotiation
+ // failed, and handle this non-TLS error, we do not handle
+ // the result of this call as an error:
+ if (SSLSetALPNProtocols(context, cfNames) != errSecSuccess)
+ qCWarning(lcSsl) << "SSLSetALPNProtocols failed - too long protocol names?";
+ }
+ } else {
+ qCWarning(lcSsl) << "failed to allocate ALPN names array";
+ }
+ }
+#endif // QT_DARWIN_PLATFORM_SDK_EQUAL_OR_ABOVE
+
if (mode == QSslSocket::SslClientMode) {
// enable Server Name Indication (SNI)
QString tlsHostName(verificationPeerName.isEmpty() ? q->peerName() : verificationPeerName);
@@ -886,7 +948,7 @@ bool QSslSocketBackendPrivate::initSslContext()
void QSslSocketBackendPrivate::destroySslContext()
{
- context.reset(Q_NULLPTR);
+ context.reset(nullptr);
}
static QByteArray _q_makePkcs12(const QList<QSslCertificate> &certs, const QSslKey &key, const QString &passPhrase);
diff --git a/src/network/ssl/qsslsocket_mac_p.h b/src/network/ssl/qsslsocket_mac_p.h
index 9e1d18981e..34e30ebb16 100644
--- a/src/network/ssl/qsslsocket_mac_p.h
+++ b/src/network/ssl/qsslsocket_mac_p.h
@@ -86,14 +86,14 @@ public:
virtual ~QSslSocketBackendPrivate();
// Final-overriders (QSslSocketPrivate):
- void continueHandshake() Q_DECL_OVERRIDE;
- void disconnected() Q_DECL_OVERRIDE;
- void disconnectFromHost() Q_DECL_OVERRIDE;
- QSslCipher sessionCipher() const Q_DECL_OVERRIDE;
- QSsl::SslProtocol sessionProtocol() const Q_DECL_OVERRIDE;
- void startClientEncryption() Q_DECL_OVERRIDE;
- void startServerEncryption() Q_DECL_OVERRIDE;
- void transmit() Q_DECL_OVERRIDE;
+ void continueHandshake() override;
+ void disconnected() override;
+ void disconnectFromHost() override;
+ QSslCipher sessionCipher() const override;
+ QSsl::SslProtocol sessionProtocol() const override;
+ void startClientEncryption() override;
+ void startServerEncryption() override;
+ void transmit() override;
static QList<QSslError> verify(QList<QSslCertificate> certificateChain,
const QString &hostName);
diff --git a/src/network/ssl/qsslsocket_openssl_p.h b/src/network/ssl/qsslsocket_openssl_p.h
index 7f9e884045..2a800cdc34 100644
--- a/src/network/ssl/qsslsocket_openssl_p.h
+++ b/src/network/ssl/qsslsocket_openssl_p.h
@@ -132,22 +132,22 @@ public:
#endif
// Platform specific functions
- void startClientEncryption() Q_DECL_OVERRIDE;
- void startServerEncryption() Q_DECL_OVERRIDE;
- void transmit() Q_DECL_OVERRIDE;
+ void startClientEncryption() override;
+ void startServerEncryption() override;
+ void transmit() override;
bool startHandshake();
- void disconnectFromHost() Q_DECL_OVERRIDE;
- void disconnected() Q_DECL_OVERRIDE;
- QSslCipher sessionCipher() const Q_DECL_OVERRIDE;
- QSsl::SslProtocol sessionProtocol() const Q_DECL_OVERRIDE;
- void continueHandshake() Q_DECL_OVERRIDE;
+ void disconnectFromHost() override;
+ void disconnected() override;
+ QSslCipher sessionCipher() const override;
+ QSsl::SslProtocol sessionProtocol() const override;
+ void continueHandshake() override;
bool checkSslErrors();
void storePeerCertificates();
unsigned int tlsPskClientCallback(const char *hint, char *identity, unsigned int max_identity_len, unsigned char *psk, unsigned int max_psk_len);
unsigned int tlsPskServerCallback(const char *identity, unsigned char *psk, unsigned int max_psk_len);
#ifdef Q_OS_WIN
void fetchCaRootForCert(const QSslCertificate &cert);
- void _q_caRootLoaded(QSslCertificate,QSslCertificate) Q_DECL_OVERRIDE;
+ void _q_caRootLoaded(QSslCertificate,QSslCertificate) override;
#endif
Q_AUTOTEST_EXPORT static long setupOpenSslOptions(QSsl::SslProtocol protocol, QSsl::SslOptions sslOptions);
diff --git a/src/network/ssl/qsslsocket_openssl_symbols.cpp b/src/network/ssl/qsslsocket_openssl_symbols.cpp
index 3a236a1300..1b73135935 100644
--- a/src/network/ssl/qsslsocket_openssl_symbols.cpp
+++ b/src/network/ssl/qsslsocket_openssl_symbols.cpp
@@ -1017,7 +1017,7 @@ bool q_resolveOpenSslSymbols()
RESOLVEFUNC(EC_GROUP_get_degree)
#endif
RESOLVEFUNC(BN_num_bits)
-#if OPENSSL_VERSION_NUMBER >= 0x10100000L
+#if QT_CONFIG(opensslv11)
RESOLVEFUNC(BN_is_word)
#endif
RESOLVEFUNC(BN_mod_word)
diff --git a/src/network/ssl/qsslsocket_openssl_symbols_p.h b/src/network/ssl/qsslsocket_openssl_symbols_p.h
index 796bf2d4f5..4cad0231cd 100644
--- a/src/network/ssl/qsslsocket_openssl_symbols_p.h
+++ b/src/network/ssl/qsslsocket_openssl_symbols_p.h
@@ -232,9 +232,10 @@ BIO *q_BIO_new_mem_buf(void *a, int b);
int q_BIO_read(BIO *a, void *b, int c);
Q_AUTOTEST_EXPORT int q_BIO_write(BIO *a, const void *b, int c);
int q_BN_num_bits(const BIGNUM *a);
-#if OPENSSL_VERSION_NUMBER >= 0x10100000L
+
+#if QT_CONFIG(opensslv11)
int q_BN_is_word(BIGNUM *a, BN_ULONG w);
-#else
+#else // opensslv11
// BN_is_word is implemented purely as a
// macro in OpenSSL < 1.1. It doesn't
// call any functions.
@@ -245,7 +246,8 @@ int q_BN_is_word(BIGNUM *a, BN_ULONG w);
//
// Users are required to include <openssl/bn.h>.
#define q_BN_is_word BN_is_word
-#endif // OPENSSL_VERSION_NUMBER >= 0x10100000L
+#endif // !opensslv11
+
BN_ULONG q_BN_mod_word(const BIGNUM *a, BN_ULONG w);
#ifndef OPENSSL_NO_EC
const EC_GROUP* q_EC_KEY_get0_group(const EC_KEY* k);
diff --git a/src/network/ssl/qsslsocket_opensslpre11.cpp b/src/network/ssl/qsslsocket_opensslpre11.cpp
index e51888c5f2..8ad4d5b521 100644
--- a/src/network/ssl/qsslsocket_opensslpre11.cpp
+++ b/src/network/ssl/qsslsocket_opensslpre11.cpp
@@ -290,8 +290,7 @@ void QSslSocketPrivate::ensureCiphersAndCertsLoaded()
//its own cert bundle rather than the system one.
//Same logic that disables the unix on demand cert loading.
//Unlike unix, we do preload the certificates from the cert store.
- if ((QSysInfo::windowsVersion() & QSysInfo::WV_NT_based) >= QSysInfo::WV_6_0)
- s_loadRootCertsOnDemand = true;
+ s_loadRootCertsOnDemand = true;
#endif
}
diff --git a/src/network/ssl/qsslsocket_p.h b/src/network/ssl/qsslsocket_p.h
index 00fda43b7e..ced861805b 100644
--- a/src/network/ssl/qsslsocket_p.h
+++ b/src/network/ssl/qsslsocket_p.h
@@ -170,7 +170,7 @@ public:
static void checkSettingSslContext(QSslSocket*, QSharedPointer<QSslContext>);
static QSharedPointer<QSslContext> sslContext(QSslSocket *socket);
bool isPaused() const;
- bool bind(const QHostAddress &address, quint16, QAbstractSocket::BindMode) Q_DECL_OVERRIDE;
+ bool bind(const QHostAddress &address, quint16, QAbstractSocket::BindMode) override;
void _q_connectedSlot();
void _q_hostFoundSlot();
void _q_disconnectedSlot();
@@ -190,9 +190,10 @@ public:
static QList<QByteArray> unixRootCertDirectories(); // used also by QSslContext
- virtual qint64 peek(char *data, qint64 maxSize) Q_DECL_OVERRIDE;
- virtual QByteArray peek(qint64 maxSize) Q_DECL_OVERRIDE;
- bool flush() Q_DECL_OVERRIDE;
+ virtual qint64 peek(char *data, qint64 maxSize) override;
+ virtual QByteArray peek(qint64 maxSize) override;
+ qint64 skip(qint64 maxSize) override;
+ bool flush() override;
// Platform specific functions
virtual void startClientEncryption() = 0;
diff --git a/src/network/ssl/qsslsocket_winrt.cpp b/src/network/ssl/qsslsocket_winrt.cpp
index 762b393738..f64ae2e020 100644
--- a/src/network/ssl/qsslsocket_winrt.cpp
+++ b/src/network/ssl/qsslsocket_winrt.cpp
@@ -522,7 +522,7 @@ HRESULT QSslSocketBackendPrivate::onSslUpgrade(IAsyncAction *action, AsyncStatus
QList<QSslCertificate> peerCertificateChain;
if (certificate) {
ComPtr<IAsyncOperation<CertificateChain *>> op;
- hr = certificate->BuildChainAsync(Q_NULLPTR, &op);
+ hr = certificate->BuildChainAsync(nullptr, &op);
Q_ASSERT_SUCCEEDED(hr);
ComPtr<ICertificateChain> certificateChain;
hr = QWinRTFunctions::await(op, certificateChain.GetAddressOf());
diff --git a/src/network/ssl/qsslsocket_winrt_p.h b/src/network/ssl/qsslsocket_winrt_p.h
index 1043aeee11..030db6d4fa 100644
--- a/src/network/ssl/qsslsocket_winrt_p.h
+++ b/src/network/ssl/qsslsocket_winrt_p.h
@@ -80,14 +80,14 @@ public:
~QSslSocketBackendPrivate();
// Platform specific functions
- void startClientEncryption() Q_DECL_OVERRIDE;
- void startServerEncryption() Q_DECL_OVERRIDE;
- void transmit() Q_DECL_OVERRIDE;
- void disconnectFromHost() Q_DECL_OVERRIDE;
- void disconnected() Q_DECL_OVERRIDE;
- QSslCipher sessionCipher() const Q_DECL_OVERRIDE;
- QSsl::SslProtocol sessionProtocol() const Q_DECL_OVERRIDE;
- void continueHandshake() Q_DECL_OVERRIDE;
+ void startClientEncryption() override;
+ void startServerEncryption() override;
+ void transmit() override;
+ void disconnectFromHost() override;
+ void disconnected() override;
+ QSslCipher sessionCipher() const override;
+ QSsl::SslProtocol sessionProtocol() const override;
+ void continueHandshake() override;
static QList<QSslCipher> defaultCiphers();
static QList<QSslError> verify(const QList<QSslCertificate> &certificateChain, const QString &hostName);
diff --git a/src/opengl/gl2paintengineex/qglengineshadermanager.cpp b/src/opengl/gl2paintengineex/qglengineshadermanager.cpp
index ec673e8726..47e8531959 100644
--- a/src/opengl/gl2paintengineex/qglengineshadermanager.cpp
+++ b/src/opengl/gl2paintengineex/qglengineshadermanager.cpp
@@ -68,13 +68,13 @@ public:
delete m_shaders;
}
- void invalidateResource() Q_DECL_OVERRIDE
+ void invalidateResource() override
{
delete m_shaders;
m_shaders = 0;
}
- void freeResource(QOpenGLContext *) Q_DECL_OVERRIDE
+ void freeResource(QOpenGLContext *) override
{
}
diff --git a/src/opengl/gl2paintengineex/qpaintengineex_opengl2_p.h b/src/opengl/gl2paintengineex/qpaintengineex_opengl2_p.h
index 0f96732278..d1ed621790 100644
--- a/src/opengl/gl2paintengineex/qpaintengineex_opengl2_p.h
+++ b/src/opengl/gl2paintengineex/qpaintengineex_opengl2_p.h
@@ -108,37 +108,37 @@ public:
QGL2PaintEngineEx();
~QGL2PaintEngineEx();
- bool begin(QPaintDevice *device) Q_DECL_OVERRIDE;
+ bool begin(QPaintDevice *device) override;
void ensureActive();
- bool end() Q_DECL_OVERRIDE;
-
- virtual void clipEnabledChanged() Q_DECL_OVERRIDE;
- virtual void penChanged() Q_DECL_OVERRIDE;
- virtual void brushChanged() Q_DECL_OVERRIDE;
- virtual void brushOriginChanged() Q_DECL_OVERRIDE;
- virtual void opacityChanged() Q_DECL_OVERRIDE;
- virtual void compositionModeChanged() Q_DECL_OVERRIDE;
- virtual void renderHintsChanged() Q_DECL_OVERRIDE;
- virtual void transformChanged() Q_DECL_OVERRIDE;
-
- virtual void drawPixmap(const QRectF &r, const QPixmap &pm, const QRectF &sr) Q_DECL_OVERRIDE;
+ bool end() override;
+
+ virtual void clipEnabledChanged() override;
+ virtual void penChanged() override;
+ virtual void brushChanged() override;
+ virtual void brushOriginChanged() override;
+ virtual void opacityChanged() override;
+ virtual void compositionModeChanged() override;
+ virtual void renderHintsChanged() override;
+ virtual void transformChanged() override;
+
+ virtual void drawPixmap(const QRectF &r, const QPixmap &pm, const QRectF &sr) override;
virtual void drawPixmapFragments(const QPainter::PixmapFragment *fragments, int fragmentCount, const QPixmap &pixmap,
- QPainter::PixmapFragmentHints hints) Q_DECL_OVERRIDE;
+ QPainter::PixmapFragmentHints hints) override;
virtual void drawImage(const QRectF &r, const QImage &pm, const QRectF &sr,
- Qt::ImageConversionFlags flags = Qt::AutoColor) Q_DECL_OVERRIDE;
- virtual void drawTextItem(const QPointF &p, const QTextItem &textItem) Q_DECL_OVERRIDE;
- virtual void fill(const QVectorPath &path, const QBrush &brush) Q_DECL_OVERRIDE;
- virtual void stroke(const QVectorPath &path, const QPen &pen) Q_DECL_OVERRIDE;
- virtual void clip(const QVectorPath &path, Qt::ClipOperation op) Q_DECL_OVERRIDE;
+ Qt::ImageConversionFlags flags = Qt::AutoColor) override;
+ virtual void drawTextItem(const QPointF &p, const QTextItem &textItem) override;
+ virtual void fill(const QVectorPath &path, const QBrush &brush) override;
+ virtual void stroke(const QVectorPath &path, const QPen &pen) override;
+ virtual void clip(const QVectorPath &path, Qt::ClipOperation op) override;
- virtual void drawStaticTextItem(QStaticTextItem *textItem) Q_DECL_OVERRIDE;
+ virtual void drawStaticTextItem(QStaticTextItem *textItem) override;
bool drawTexture(const QRectF &r, GLuint textureId, const QSize &size, const QRectF &sr);
- Type type() const Q_DECL_OVERRIDE { return OpenGL2; }
+ Type type() const override { return OpenGL2; }
- virtual void setState(QPainterState *s) Q_DECL_OVERRIDE;
- virtual QPainterState *createState(QPainterState *orig) const Q_DECL_OVERRIDE;
+ virtual void setState(QPainterState *s) override;
+ virtual QPainterState *createState(QPainterState *orig) const override;
inline QGL2PaintEngineState *state() {
return static_cast<QGL2PaintEngineState *>(QPaintEngineEx::state());
}
@@ -146,16 +146,16 @@ public:
return static_cast<const QGL2PaintEngineState *>(QPaintEngineEx::state());
}
- void beginNativePainting() Q_DECL_OVERRIDE;
- void endNativePainting() Q_DECL_OVERRIDE;
+ void beginNativePainting() override;
+ void endNativePainting() override;
void invalidateState();
void setRenderTextActive(bool);
bool isNativePaintingActive() const;
- bool requiresPretransformedGlyphPositions(QFontEngine *, const QTransform &) const Q_DECL_OVERRIDE { return false; }
- bool shouldDrawCachedGlyphs(QFontEngine *, const QTransform &) const Q_DECL_OVERRIDE;
+ bool requiresPretransformedGlyphPositions(QFontEngine *, const QTransform &) const override { return false; }
+ bool shouldDrawCachedGlyphs(QFontEngine *, const QTransform &) const override;
void setTranslateZ(GLfloat z);
@@ -244,7 +244,7 @@ public:
void updateClipScissorTest();
void setScissor(const QRect &rect);
void regenerateClip();
- void systemStateChanged() Q_DECL_OVERRIDE;
+ void systemStateChanged() override;
static QGLEngineShaderManager* shaderManagerForEngine(QGL2PaintEngineEx *engine) { return engine->d_func()->shaderManager; }
diff --git a/src/opengl/gl2paintengineex/qtextureglyphcache_gl_p.h b/src/opengl/gl2paintengineex/qtextureglyphcache_gl_p.h
index 95401d10c1..e76216ef5d 100644
--- a/src/opengl/gl2paintengineex/qtextureglyphcache_gl_p.h
+++ b/src/opengl/gl2paintengineex/qtextureglyphcache_gl_p.h
@@ -79,7 +79,7 @@ struct QGLGlyphTexture : public QOpenGLSharedResource
#endif
}
- void freeResource(QOpenGLContext *context) Q_DECL_OVERRIDE
+ void freeResource(QOpenGLContext *context) override
{
const QGLContext *ctx = QGLContext::fromOpenGLContext(context);
#ifdef QT_GL_TEXTURE_GLYPH_CACHE_DEBUG
@@ -93,7 +93,7 @@ struct QGLGlyphTexture : public QOpenGLSharedResource
ctx->contextHandle()->functions()->glDeleteTextures(1, &m_texture);
}
- void invalidateResource() Q_DECL_OVERRIDE
+ void invalidateResource() override
{
m_texture = 0;
m_fbo = 0;
@@ -113,12 +113,12 @@ public:
QGLTextureGlyphCache(QFontEngine::GlyphFormat format, const QTransform &matrix);
~QGLTextureGlyphCache();
- virtual void createTextureData(int width, int height) Q_DECL_OVERRIDE;
- virtual void resizeTextureData(int width, int height) Q_DECL_OVERRIDE;
- virtual void fillTexture(const Coord &c, glyph_t glyph, QFixed subPixelPosition) Q_DECL_OVERRIDE;
- virtual int glyphPadding() const Q_DECL_OVERRIDE;
- virtual int maxTextureWidth() const Q_DECL_OVERRIDE;
- virtual int maxTextureHeight() const Q_DECL_OVERRIDE;
+ virtual void createTextureData(int width, int height) override;
+ virtual void resizeTextureData(int width, int height) override;
+ virtual void fillTexture(const Coord &c, glyph_t glyph, QFixed subPixelPosition) override;
+ virtual int glyphPadding() const override;
+ virtual int maxTextureWidth() const override;
+ virtual int maxTextureHeight() const override;
inline GLuint texture() const {
QGLTextureGlyphCache *that = const_cast<QGLTextureGlyphCache *>(this);
diff --git a/src/opengl/opengl.pro b/src/opengl/opengl.pro
index 016db46405..077b190d3e 100644
--- a/src/opengl/opengl.pro
+++ b/src/opengl/opengl.pro
@@ -5,7 +5,6 @@ DEFINES += QT_NO_USING_NAMESPACE QT_NO_FOREACH
win32-msvc*|win32-icc:QMAKE_LFLAGS += /BASE:0x63000000
solaris-cc*:QMAKE_CXXFLAGS_RELEASE -= -O2
-irix-cc*:QMAKE_CXXFLAGS += -no_prelink -ptused
QMAKE_DOCS = $$PWD/doc/qtopengl.qdocconf
diff --git a/src/opengl/qgl.h b/src/opengl/qgl.h
index ab418c191a..a1ba0485e0 100644
--- a/src/opengl/qgl.h
+++ b/src/opengl/qgl.h
@@ -58,6 +58,12 @@ typedef int GLint;
typedef unsigned int GLuint;
#undef GLenum
typedef unsigned int GLenum;
+#undef GLclampf
+typedef float GLclampf;
+#undef GLsizei
+typedef int GLsizei;
+#undef GLboolean
+typedef bool GLboolean;
#endif
@@ -250,7 +256,7 @@ public:
QGLContext(const QGLFormat& format);
virtual ~QGLContext();
- virtual bool create(const QGLContext* shareContext = Q_NULLPTR);
+ virtual bool create(const QGLContext* shareContext = nullptr);
bool isValid() const;
bool isSharing() const;
void reset();
@@ -318,7 +324,7 @@ public:
QOpenGLContext *contextHandle() const;
protected:
- virtual bool chooseContext(const QGLContext* shareContext = Q_NULLPTR);
+ virtual bool chooseContext(const QGLContext* shareContext = nullptr);
bool deviceIsPixmap() const;
bool windowCreated() const;
@@ -371,12 +377,12 @@ class Q_OPENGL_EXPORT QGLWidget : public QWidget
Q_OBJECT
Q_DECLARE_PRIVATE(QGLWidget)
public:
- explicit QGLWidget(QWidget* parent=Q_NULLPTR,
- const QGLWidget* shareWidget = Q_NULLPTR, Qt::WindowFlags f=Qt::WindowFlags());
- explicit QGLWidget(QGLContext *context, QWidget* parent=Q_NULLPTR,
- const QGLWidget* shareWidget = Q_NULLPTR, Qt::WindowFlags f=Qt::WindowFlags());
- explicit QGLWidget(const QGLFormat& format, QWidget* parent=Q_NULLPTR,
- const QGLWidget* shareWidget = Q_NULLPTR, Qt::WindowFlags f=Qt::WindowFlags());
+ explicit QGLWidget(QWidget* parent=nullptr,
+ const QGLWidget* shareWidget = nullptr, Qt::WindowFlags f=Qt::WindowFlags());
+ explicit QGLWidget(QGLContext *context, QWidget* parent=nullptr,
+ const QGLWidget* shareWidget = nullptr, Qt::WindowFlags f=Qt::WindowFlags());
+ explicit QGLWidget(const QGLFormat& format, QWidget* parent=nullptr,
+ const QGLWidget* shareWidget = nullptr, Qt::WindowFlags f=Qt::WindowFlags());
~QGLWidget();
void qglColor(const QColor& c) const;
@@ -395,7 +401,7 @@ public:
void setFormat(const QGLFormat& format);
QGLContext* context() const;
- void setContext(QGLContext* context, const QGLContext* shareContext = Q_NULLPTR,
+ void setContext(QGLContext* context, const QGLContext* shareContext = nullptr,
bool deleteOldContext = true);
QPixmap renderPixmap(int w = 0, int h = 0, bool useContext = false);
@@ -413,7 +419,7 @@ public:
const QFont & fnt = QFont());
void renderText(double x, double y, double z, const QString & str,
const QFont & fnt = QFont());
- QPaintEngine *paintEngine() const Q_DECL_OVERRIDE;
+ QPaintEngine *paintEngine() const override;
GLuint bindTexture(const QImage &image, GLenum target, GLint format,
QGLContext::BindOptions options);
@@ -437,7 +443,7 @@ public Q_SLOTS:
virtual void updateOverlayGL();
protected:
- bool event(QEvent *) Q_DECL_OVERRIDE;
+ bool event(QEvent *) override;
virtual void initializeGL();
virtual void resizeGL(int w, int h);
virtual void paintGL();
@@ -449,16 +455,16 @@ protected:
void setAutoBufferSwap(bool on);
bool autoBufferSwap() const;
- void paintEvent(QPaintEvent*) Q_DECL_OVERRIDE;
- void resizeEvent(QResizeEvent*) Q_DECL_OVERRIDE;
+ void paintEvent(QPaintEvent*) override;
+ void resizeEvent(QResizeEvent*) override;
virtual void glInit();
virtual void glDraw();
QGLWidget(QGLWidgetPrivate &dd,
const QGLFormat &format = QGLFormat(),
- QWidget *parent = Q_NULLPTR,
- const QGLWidget* shareWidget = Q_NULLPTR,
+ QWidget *parent = nullptr,
+ const QGLWidget* shareWidget = nullptr,
Qt::WindowFlags f = Qt::WindowFlags());
private:
Q_DISABLE_COPY(QGLWidget)
diff --git a/src/opengl/qgl_p.h b/src/opengl/qgl_p.h
index 9ab5cd36a2..6b4d83888f 100644
--- a/src/opengl/qgl_p.h
+++ b/src/opengl/qgl_p.h
@@ -140,7 +140,7 @@ public:
void initContext(QGLContext *context, const QGLWidget* shareWidget);
bool renderCxPm(QPixmap *pixmap);
void cleanupColormaps();
- void aboutToDestroy() Q_DECL_OVERRIDE {
+ void aboutToDestroy() override {
if (glcx && !parent_changing)
glcx->reset();
}
@@ -488,12 +488,12 @@ public:
}
protected:
- void invalidateResource() Q_DECL_OVERRIDE
+ void invalidateResource() override
{
m_id = 0;
}
- void freeResource(QOpenGLContext *context) Q_DECL_OVERRIDE
+ void freeResource(QOpenGLContext *context) override
{
if (m_id) {
freeResource(QGLContext::fromOpenGLContext(context), m_id);
@@ -517,7 +517,7 @@ public:
}
protected:
- void freeResource(QGLContext *ctx, GLuint id) Q_DECL_OVERRIDE
+ void freeResource(QGLContext *ctx, GLuint id) override
{
m_func(ctx, id);
}
diff --git a/src/opengl/qglbuffer.h b/src/opengl/qglbuffer.h
index 454036a938..daf5227c66 100644
--- a/src/opengl/qglbuffer.h
+++ b/src/opengl/qglbuffer.h
@@ -109,7 +109,7 @@ public:
void write(int offset, const void *data, int count);
void allocate(const void *data, int count);
- inline void allocate(int count) { allocate(Q_NULLPTR, count); }
+ inline void allocate(int count) { allocate(nullptr, count); }
void *map(QGLBuffer::Access access);
bool unmap();
diff --git a/src/opengl/qglcolormap.h b/src/opengl/qglcolormap.h
index 199ed82534..772e327e34 100644
--- a/src/opengl/qglcolormap.h
+++ b/src/opengl/qglcolormap.h
@@ -69,7 +69,7 @@ public:
int findNearest(QRgb color) const;
protected:
- Qt::HANDLE handle() { return d ? d->cmapHandle : Q_NULLPTR; }
+ Qt::HANDLE handle() { return d ? d->cmapHandle : nullptr; }
void setHandle(Qt::HANDLE ahandle) { d->cmapHandle = ahandle; }
private:
diff --git a/src/opengl/qglframebufferobject.h b/src/opengl/qglframebufferobject.h
index f4b6d1ddc1..c88063cbb5 100644
--- a/src/opengl/qglframebufferobject.h
+++ b/src/opengl/qglframebufferobject.h
@@ -84,7 +84,7 @@ public:
QImage toImage() const;
Attachment attachment() const;
- QPaintEngine *paintEngine() const Q_DECL_OVERRIDE;
+ QPaintEngine *paintEngine() const override;
GLuint handle() const;
static bool bindDefault();
@@ -101,8 +101,8 @@ public:
GLenum filter = GL_NEAREST);
protected:
- int metric(PaintDeviceMetric metric) const Q_DECL_OVERRIDE;
- int devType() const Q_DECL_OVERRIDE { return QInternal::FramebufferObject; }
+ int metric(PaintDeviceMetric metric) const override;
+ int devType() const override { return QInternal::FramebufferObject; }
private:
Q_DISABLE_COPY(QGLFramebufferObject)
diff --git a/src/opengl/qglframebufferobject_p.h b/src/opengl/qglframebufferobject_p.h
index d3af1fdbaa..bf5e21cf0b 100644
--- a/src/opengl/qglframebufferobject_p.h
+++ b/src/opengl/qglframebufferobject_p.h
@@ -106,11 +106,11 @@ public:
class QGLFBOGLPaintDevice : public QGLPaintDevice
{
public:
- virtual QPaintEngine* paintEngine() const Q_DECL_OVERRIDE {return fbo->paintEngine();}
- virtual QSize size() const Q_DECL_OVERRIDE {return fbo->size();}
- virtual QGLContext* context() const Q_DECL_OVERRIDE;
- virtual QGLFormat format() const Q_DECL_OVERRIDE {return fboFormat;}
- virtual bool alphaRequested() const Q_DECL_OVERRIDE { return reqAlpha; }
+ virtual QPaintEngine* paintEngine() const override {return fbo->paintEngine();}
+ virtual QSize size() const override {return fbo->size();}
+ virtual QGLContext* context() const override;
+ virtual QGLFormat format() const override {return fboFormat;}
+ virtual bool alphaRequested() const override { return reqAlpha; }
void setFBO(QGLFramebufferObject* f,
QGLFramebufferObject::Attachment attachment);
diff --git a/src/opengl/qglfunctions.cpp b/src/opengl/qglfunctions.cpp
index a1ea1b1e56..07e1194342 100644
--- a/src/opengl/qglfunctions.cpp
+++ b/src/opengl/qglfunctions.cpp
@@ -159,12 +159,12 @@ struct QGLFunctionsPrivateEx : public QGLFunctionsPrivate, public QOpenGLSharedR
delete funcs;
}
- void invalidateResource() Q_DECL_OVERRIDE
+ void invalidateResource() override
{
m_features = -1;
}
- void freeResource(QOpenGLContext *) Q_DECL_OVERRIDE
+ void freeResource(QOpenGLContext *) override
{
// no gl resources to free
}
diff --git a/src/opengl/qglfunctions.h b/src/opengl/qglfunctions.h
index 211212125e..d8c5249a1a 100644
--- a/src/opengl/qglfunctions.h
+++ b/src/opengl/qglfunctions.h
@@ -76,7 +76,7 @@ public:
QGLFunctions::OpenGLFeatures openGLFeatures() const;
bool hasOpenGLFeature(QGLFunctions::OpenGLFeature feature) const;
- void initializeGLFunctions(const QGLContext *context = Q_NULLPTR);
+ void initializeGLFunctions(const QGLContext *context = nullptr);
void glActiveTexture(GLenum texture);
void glAttachShader(GLuint program, GLuint shader);
@@ -178,14 +178,14 @@ public:
private:
QGLFunctionsPrivate *d_ptr;
- static bool isInitialized(const QGLFunctionsPrivate *d) { return d != Q_NULLPTR; }
+ static bool isInitialized(const QGLFunctionsPrivate *d) { return d != nullptr; }
};
Q_DECLARE_OPERATORS_FOR_FLAGS(QGLFunctions::OpenGLFeatures)
struct QGLFunctionsPrivate
{
- QGLFunctionsPrivate(const QGLContext *context = Q_NULLPTR);
+ QGLFunctionsPrivate(const QGLContext *context = nullptr);
QOpenGLFunctions *funcs;
};
diff --git a/src/opengl/qglpaintdevice_p.h b/src/opengl/qglpaintdevice_p.h
index 3b34b2d244..bfecdabd53 100644
--- a/src/opengl/qglpaintdevice_p.h
+++ b/src/opengl/qglpaintdevice_p.h
@@ -64,7 +64,7 @@ public:
QGLPaintDevice();
virtual ~QGLPaintDevice();
- int devType() const Q_DECL_OVERRIDE {return QInternal::OpenGL;}
+ int devType() const override {return QInternal::OpenGL;}
virtual void beginPaint();
virtual void ensureActiveTarget();
@@ -80,7 +80,7 @@ public:
static QGLPaintDevice* getDevice(QPaintDevice*);
protected:
- int metric(QPaintDevice::PaintDeviceMetric metric) const Q_DECL_OVERRIDE;
+ int metric(QPaintDevice::PaintDeviceMetric metric) const override;
GLuint m_previousFBO;
GLuint m_thisFBO;
};
@@ -93,13 +93,13 @@ class Q_OPENGL_EXPORT QGLWidgetGLPaintDevice : public QGLPaintDevice
public:
QGLWidgetGLPaintDevice();
- virtual QPaintEngine* paintEngine() const Q_DECL_OVERRIDE;
+ virtual QPaintEngine* paintEngine() const override;
// QGLWidgets need to do swapBufers in endPaint:
- virtual void beginPaint() Q_DECL_OVERRIDE;
- virtual void endPaint() Q_DECL_OVERRIDE;
- virtual QSize size() const Q_DECL_OVERRIDE;
- virtual QGLContext* context() const Q_DECL_OVERRIDE;
+ virtual void beginPaint() override;
+ virtual void endPaint() override;
+ virtual QSize size() const override;
+ virtual QGLContext* context() const override;
void setWidget(QGLWidget*);
diff --git a/src/opengl/qglpixelbuffer.h b/src/opengl/qglpixelbuffer.h
index bd30ca2663..f5d7929c35 100644
--- a/src/opengl/qglpixelbuffer.h
+++ b/src/opengl/qglpixelbuffer.h
@@ -53,9 +53,9 @@ class Q_OPENGL_EXPORT QGLPixelBuffer : public QPaintDevice
Q_DECLARE_PRIVATE(QGLPixelBuffer)
public:
QGLPixelBuffer(const QSize &size, const QGLFormat &format = QGLFormat::defaultFormat(),
- QGLWidget *shareWidget = Q_NULLPTR);
+ QGLWidget *shareWidget = nullptr);
QGLPixelBuffer(int width, int height, const QGLFormat &format = QGLFormat::defaultFormat(),
- QGLWidget *shareWidget = Q_NULLPTR);
+ QGLWidget *shareWidget = nullptr);
virtual ~QGLPixelBuffer();
bool isValid() const;
@@ -81,14 +81,14 @@ public:
Qt::HANDLE handle() const;
QImage toImage() const;
- QPaintEngine *paintEngine() const Q_DECL_OVERRIDE;
+ QPaintEngine *paintEngine() const override;
QGLFormat format() const;
static bool hasOpenGLPbuffers();
protected:
- int metric(PaintDeviceMetric metric) const Q_DECL_OVERRIDE;
- int devType() const Q_DECL_OVERRIDE { return QInternal::Pbuffer; }
+ int metric(PaintDeviceMetric metric) const override;
+ int devType() const override { return QInternal::Pbuffer; }
private:
Q_DISABLE_COPY(QGLPixelBuffer)
diff --git a/src/opengl/qglshaderprogram.h b/src/opengl/qglshaderprogram.h
index f95017d09c..dfdef44b54 100644
--- a/src/opengl/qglshaderprogram.h
+++ b/src/opengl/qglshaderprogram.h
@@ -46,6 +46,17 @@
#include <QtGui/qvector4d.h>
#include <QtGui/qmatrix4x4.h>
+#if defined(Q_CLANG_QDOC)
+#undef GLfloat
+typedef double GLfloat;
+#undef GLint
+typedef int GLint;
+#undef GLuint
+typedef unsigned int GLuint;
+#undef GLenum
+typedef unsigned int GLenum;
+#endif
+
QT_BEGIN_NAMESPACE
@@ -64,8 +75,8 @@ public:
};
Q_DECLARE_FLAGS(ShaderType, ShaderTypeBit)
- explicit QGLShader(QGLShader::ShaderType type, QObject *parent = Q_NULLPTR);
- QGLShader(QGLShader::ShaderType type, const QGLContext *context, QObject *parent = Q_NULLPTR);
+ explicit QGLShader(QGLShader::ShaderType type, QObject *parent = nullptr);
+ QGLShader(QGLShader::ShaderType type, const QGLContext *context, QObject *parent = nullptr);
virtual ~QGLShader();
QGLShader::ShaderType shaderType() const;
@@ -82,7 +93,7 @@ public:
GLuint shaderId() const;
- static bool hasOpenGLShaders(ShaderType type, const QGLContext *context = Q_NULLPTR);
+ static bool hasOpenGLShaders(ShaderType type, const QGLContext *context = nullptr);
private:
friend class QGLShaderProgram;
@@ -100,8 +111,8 @@ class Q_OPENGL_EXPORT QGLShaderProgram : public QObject
{
Q_OBJECT
public:
- explicit QGLShaderProgram(QObject *parent = Q_NULLPTR);
- explicit QGLShaderProgram(const QGLContext *context, QObject *parent = Q_NULLPTR);
+ explicit QGLShaderProgram(QObject *parent = nullptr);
+ explicit QGLShaderProgram(const QGLContext *context, QObject *parent = nullptr);
virtual ~QGLShaderProgram();
bool addShader(QGLShader *shader);
@@ -286,7 +297,7 @@ public:
void setUniformValueArray(const char *name, const QMatrix4x3 *values, int count);
void setUniformValueArray(const char *name, const QMatrix4x4 *values, int count);
- static bool hasOpenGLShaderPrograms(const QGLContext *context = Q_NULLPTR);
+ static bool hasOpenGLShaderPrograms(const QGLContext *context = nullptr);
private Q_SLOTS:
void shaderDestroyed();
diff --git a/src/opengl/qgraphicsshadereffect.cpp b/src/opengl/qgraphicsshadereffect.cpp
index 218f4af866..cf3d307d71 100644
--- a/src/opengl/qgraphicsshadereffect.cpp
+++ b/src/opengl/qgraphicsshadereffect.cpp
@@ -143,7 +143,7 @@ public:
setSource(source);
}
- void setUniforms(QGLShaderProgram *program) Q_DECL_OVERRIDE;
+ void setUniforms(QGLShaderProgram *program) override;
QGraphicsShaderEffect *effect;
};
diff --git a/src/opengl/qgraphicsshadereffect_p.h b/src/opengl/qgraphicsshadereffect_p.h
index d7e0ec51d4..9efcecd25f 100644
--- a/src/opengl/qgraphicsshadereffect_p.h
+++ b/src/opengl/qgraphicsshadereffect_p.h
@@ -74,7 +74,7 @@ public:
void setPixelShaderFragment(const QByteArray& code);
protected:
- void draw(QPainter *painter) Q_DECL_OVERRIDE;
+ void draw(QPainter *painter) override;
void setUniformsDirty();
virtual void setUniforms(QGLShaderProgram *program);
diff --git a/src/openglextensions/qopenglextensions.h b/src/openglextensions/qopenglextensions.h
index 52ebd2fe0f..afbc18f474 100644
--- a/src/openglextensions/qopenglextensions.h
+++ b/src/openglextensions/qopenglextensions.h
@@ -114,7 +114,7 @@ class QOpenGLExtension_3DFX_tbuffer : public QAbstractOpenGLExtension
public:
QOpenGLExtension_3DFX_tbuffer();
- bool initializeOpenGLFunctions() Q_DECL_FINAL;
+ bool initializeOpenGLFunctions() final;
void glTbufferMask3DFX(GLuint mask);
@@ -142,7 +142,7 @@ class QOpenGLExtension_AMD_debug_output : public QAbstractOpenGLExtension
public:
QOpenGLExtension_AMD_debug_output();
- bool initializeOpenGLFunctions() Q_DECL_FINAL;
+ bool initializeOpenGLFunctions() final;
GLuint glGetDebugMessageLogAMD(GLuint count, GLsizei bufsize, GLenum *categories, GLuint *severities, GLuint *ids, GLsizei *lengths, GLchar *message);
void glDebugMessageCallbackAMD(GLDEBUGPROCAMD callback, GLvoid *userParam);
@@ -191,7 +191,7 @@ class QOpenGLExtension_AMD_draw_buffers_blend : public QAbstractOpenGLExtension
public:
QOpenGLExtension_AMD_draw_buffers_blend();
- bool initializeOpenGLFunctions() Q_DECL_FINAL;
+ bool initializeOpenGLFunctions() final;
void glBlendEquationSeparateIndexedAMD(GLuint buf, GLenum modeRGB, GLenum modeAlpha);
void glBlendEquationIndexedAMD(GLuint buf, GLenum mode);
@@ -238,7 +238,7 @@ class QOpenGLExtension_AMD_multi_draw_indirect : public QAbstractOpenGLExtension
public:
QOpenGLExtension_AMD_multi_draw_indirect();
- bool initializeOpenGLFunctions() Q_DECL_FINAL;
+ bool initializeOpenGLFunctions() final;
void glMultiDrawElementsIndirectAMD(GLenum mode, GLenum type, const GLvoid *indirect, GLsizei primcount, GLsizei stride);
void glMultiDrawArraysIndirectAMD(GLenum mode, const GLvoid *indirect, GLsizei primcount, GLsizei stride);
@@ -272,7 +272,7 @@ class QOpenGLExtension_AMD_name_gen_delete : public QAbstractOpenGLExtension
public:
QOpenGLExtension_AMD_name_gen_delete();
- bool initializeOpenGLFunctions() Q_DECL_FINAL;
+ bool initializeOpenGLFunctions() final;
GLboolean glIsNameAMD(GLenum identifier, GLuint name);
void glDeleteNamesAMD(GLenum identifier, GLuint num, const GLuint *names);
@@ -321,7 +321,7 @@ class QOpenGLExtension_AMD_performance_monitor : public QAbstractOpenGLExtension
public:
QOpenGLExtension_AMD_performance_monitor();
- bool initializeOpenGLFunctions() Q_DECL_FINAL;
+ bool initializeOpenGLFunctions() final;
void glGetPerfMonitorCounterDataAMD(GLuint monitor, GLenum pname, GLsizei dataSize, GLuint *data, GLint *bytesWritten);
void glEndPerfMonitorAMD(GLuint monitor);
@@ -416,7 +416,7 @@ class QOpenGLExtension_AMD_sample_positions : public QAbstractOpenGLExtension
public:
QOpenGLExtension_AMD_sample_positions();
- bool initializeOpenGLFunctions() Q_DECL_FINAL;
+ bool initializeOpenGLFunctions() final;
void glSetMultisamplefvAMD(GLenum pname, GLuint index, const GLfloat *val);
@@ -441,7 +441,7 @@ class QOpenGLExtension_AMD_sparse_texture : public QAbstractOpenGLExtension
public:
QOpenGLExtension_AMD_sparse_texture();
- bool initializeOpenGLFunctions() Q_DECL_FINAL;
+ bool initializeOpenGLFunctions() final;
void glTexStorageSparseAMD(GLenum target, GLenum internalFormat, GLsizei width, GLsizei height, GLsizei depth, GLsizei layers, GLbitfield flags);
@@ -466,7 +466,7 @@ class QOpenGLExtension_AMD_stencil_operation_extended : public QAbstractOpenGLEx
public:
QOpenGLExtension_AMD_stencil_operation_extended();
- bool initializeOpenGLFunctions() Q_DECL_FINAL;
+ bool initializeOpenGLFunctions() final;
void glStencilOpValueAMD(GLenum face, GLuint value);
@@ -492,7 +492,7 @@ class QOpenGLExtension_AMD_vertex_shader_tesselator : public QAbstractOpenGLExte
public:
QOpenGLExtension_AMD_vertex_shader_tesselator();
- bool initializeOpenGLFunctions() Q_DECL_FINAL;
+ bool initializeOpenGLFunctions() final;
void glTessellationModeAMD(GLenum mode);
void glTessellationFactorAMD(GLfloat factor);
@@ -528,7 +528,7 @@ class QOpenGLExtension_APPLE_element_array : public QAbstractOpenGLExtension
public:
QOpenGLExtension_APPLE_element_array();
- bool initializeOpenGLFunctions() Q_DECL_FINAL;
+ bool initializeOpenGLFunctions() final;
void glMultiDrawRangeElementArrayAPPLE(GLenum mode, GLuint start, GLuint end, const GLint *first, const GLsizei *count, GLsizei primcount);
void glMultiDrawElementArrayAPPLE(GLenum mode, const GLint *first, const GLsizei *count, GLsizei primcount);
@@ -588,7 +588,7 @@ class QOpenGLExtension_APPLE_fence : public QAbstractOpenGLExtension
public:
QOpenGLExtension_APPLE_fence();
- bool initializeOpenGLFunctions() Q_DECL_FINAL;
+ bool initializeOpenGLFunctions() final;
void glFinishObjectAPPLE(GLenum object, GLint name);
GLboolean glTestObjectAPPLE(GLenum object, GLuint name);
@@ -663,7 +663,7 @@ class QOpenGLExtension_APPLE_flush_buffer_range : public QAbstractOpenGLExtensio
public:
QOpenGLExtension_APPLE_flush_buffer_range();
- bool initializeOpenGLFunctions() Q_DECL_FINAL;
+ bool initializeOpenGLFunctions() final;
void glFlushMappedBufferRangeAPPLE(GLenum target, GLintptr offset, GLsizeiptr size);
void glBufferParameteriAPPLE(GLenum target, GLenum pname, GLint param);
@@ -697,7 +697,7 @@ class QOpenGLExtension_APPLE_object_purgeable : public QAbstractOpenGLExtension
public:
QOpenGLExtension_APPLE_object_purgeable();
- bool initializeOpenGLFunctions() Q_DECL_FINAL;
+ bool initializeOpenGLFunctions() final;
void glGetObjectParameterivAPPLE(GLenum objectType, GLuint name, GLenum pname, GLint *params);
GLenum glObjectUnpurgeableAPPLE(GLenum objectType, GLuint name, GLenum option);
@@ -737,7 +737,7 @@ class QOpenGLExtension_APPLE_texture_range : public QAbstractOpenGLExtension
public:
QOpenGLExtension_APPLE_texture_range();
- bool initializeOpenGLFunctions() Q_DECL_FINAL;
+ bool initializeOpenGLFunctions() final;
void glGetTexParameterPointervAPPLE(GLenum target, GLenum pname, GLvoid* *params);
void glTextureRangeAPPLE(GLenum target, GLsizei length, const GLvoid *pointer);
@@ -772,7 +772,7 @@ class QOpenGLExtension_APPLE_vertex_array_object : public QAbstractOpenGLExtensi
public:
QOpenGLExtension_APPLE_vertex_array_object();
- bool initializeOpenGLFunctions() Q_DECL_FINAL;
+ bool initializeOpenGLFunctions() final;
GLboolean glIsVertexArrayAPPLE(GLuint array);
void glGenVertexArraysAPPLE(GLsizei n, GLuint *arrays);
@@ -820,7 +820,7 @@ class QOpenGLExtension_APPLE_vertex_array_range : public QAbstractOpenGLExtensio
public:
QOpenGLExtension_APPLE_vertex_array_range();
- bool initializeOpenGLFunctions() Q_DECL_FINAL;
+ bool initializeOpenGLFunctions() final;
void glVertexArrayParameteriAPPLE(GLenum pname, GLint param);
void glFlushVertexArrayRangeAPPLE(GLsizei length, GLvoid *pointer);
@@ -865,7 +865,7 @@ class QOpenGLExtension_APPLE_vertex_program_evaluators : public QAbstractOpenGLE
public:
QOpenGLExtension_APPLE_vertex_program_evaluators();
- bool initializeOpenGLFunctions() Q_DECL_FINAL;
+ bool initializeOpenGLFunctions() final;
void glMapVertexAttrib2fAPPLE(GLuint index, GLuint size, GLfloat u1, GLfloat u2, GLint ustride, GLint uorder, GLfloat v1, GLfloat v2, GLint vstride, GLint vorder, const GLfloat *points);
void glMapVertexAttrib2dAPPLE(GLuint index, GLuint size, GLdouble u1, GLdouble u2, GLint ustride, GLint uorder, GLdouble v1, GLdouble v2, GLint vstride, GLint vorder, const GLdouble *points);
@@ -936,7 +936,7 @@ class QOpenGLExtension_ARB_ES2_compatibility : public QAbstractOpenGLExtension
public:
QOpenGLExtension_ARB_ES2_compatibility();
- bool initializeOpenGLFunctions() Q_DECL_FINAL;
+ bool initializeOpenGLFunctions() final;
void glClearDepthf(GLfloat dd);
void glDepthRangef(GLfloat n, GLfloat f);
@@ -991,7 +991,7 @@ class QOpenGLExtension_ARB_base_instance : public QAbstractOpenGLExtension
public:
QOpenGLExtension_ARB_base_instance();
- bool initializeOpenGLFunctions() Q_DECL_FINAL;
+ bool initializeOpenGLFunctions() final;
void glDrawElementsInstancedBaseVertexBaseInstance(GLenum mode, GLsizei count, GLenum type, const void *indices, GLsizei instancecount, GLint basevertex, GLuint baseinstance);
void glDrawElementsInstancedBaseInstance(GLenum mode, GLsizei count, GLenum type, const void *indices, GLsizei instancecount, GLuint baseinstance);
@@ -1031,7 +1031,7 @@ class QOpenGLExtension_ARB_blend_func_extended : public QAbstractOpenGLExtension
public:
QOpenGLExtension_ARB_blend_func_extended();
- bool initializeOpenGLFunctions() Q_DECL_FINAL;
+ bool initializeOpenGLFunctions() final;
GLint glGetFragDataIndex(GLuint program, const GLchar *name);
void glBindFragDataLocationIndexed(GLuint program, GLuint colorNumber, GLuint index, const GLchar *name);
@@ -1063,7 +1063,7 @@ class QOpenGLExtension_ARB_cl_event : public QAbstractOpenGLExtension
public:
QOpenGLExtension_ARB_cl_event();
- bool initializeOpenGLFunctions() Q_DECL_FINAL;
+ bool initializeOpenGLFunctions() final;
GLsync glCreateSyncFromCLeventARB(struct _cl_context * context, struct _cl_event * event, GLbitfield flags);
@@ -1089,7 +1089,7 @@ class QOpenGLExtension_ARB_clear_buffer_object : public QAbstractOpenGLExtension
public:
QOpenGLExtension_ARB_clear_buffer_object();
- bool initializeOpenGLFunctions() Q_DECL_FINAL;
+ bool initializeOpenGLFunctions() final;
void glClearBufferSubData(GLenum target, GLenum internalformat, GLintptr offset, GLsizeiptr size, GLenum format, GLenum type, const void *data);
void glClearBufferData(GLenum target, GLenum internalformat, GLenum format, GLenum type, const void *data);
@@ -1121,7 +1121,7 @@ class QOpenGLExtension_ARB_color_buffer_float : public QAbstractOpenGLExtension
public:
QOpenGLExtension_ARB_color_buffer_float();
- bool initializeOpenGLFunctions() Q_DECL_FINAL;
+ bool initializeOpenGLFunctions() final;
void glClampColorARB(GLenum target, GLenum clamp);
@@ -1147,7 +1147,7 @@ class QOpenGLExtension_ARB_compute_shader : public QAbstractOpenGLExtension
public:
QOpenGLExtension_ARB_compute_shader();
- bool initializeOpenGLFunctions() Q_DECL_FINAL;
+ bool initializeOpenGLFunctions() final;
void glDispatchComputeIndirect(GLintptr indirect);
void glDispatchCompute(GLuint num_groups_x, GLuint num_groups_y, GLuint num_groups_z);
@@ -1179,7 +1179,7 @@ class QOpenGLExtension_ARB_copy_buffer : public QAbstractOpenGLExtension
public:
QOpenGLExtension_ARB_copy_buffer();
- bool initializeOpenGLFunctions() Q_DECL_FINAL;
+ bool initializeOpenGLFunctions() final;
void glCopyBufferSubData(GLenum readTarget, GLenum writeTarget, GLintptr readOffset, GLintptr writeOffset, GLsizeiptr size);
@@ -1204,7 +1204,7 @@ class QOpenGLExtension_ARB_copy_image : public QAbstractOpenGLExtension
public:
QOpenGLExtension_ARB_copy_image();
- bool initializeOpenGLFunctions() Q_DECL_FINAL;
+ bool initializeOpenGLFunctions() final;
void glCopyImageSubData(GLuint srcName, GLenum srcTarget, GLint srcLevel, GLint srcX, GLint srcY, GLint srcZ, GLuint dstName, GLenum dstTarget, GLint dstLevel, GLint dstX, GLint dstY, GLint dstZ, GLsizei srcWidth, GLsizei srcHeight, GLsizei srcDepth);
@@ -1232,7 +1232,7 @@ class QOpenGLExtension_ARB_debug_output : public QAbstractOpenGLExtension
public:
QOpenGLExtension_ARB_debug_output();
- bool initializeOpenGLFunctions() Q_DECL_FINAL;
+ bool initializeOpenGLFunctions() final;
GLuint glGetDebugMessageLogARB(GLuint count, GLsizei bufsize, GLenum *sources, GLenum *types, GLuint *ids, GLenum *severities, GLsizei *lengths, GLchar *messageLog);
void glDebugMessageCallbackARB(GLDEBUGPROCARB callback, const GLvoid *userParam);
@@ -1278,7 +1278,7 @@ class QOpenGLExtension_ARB_draw_buffers : public QAbstractOpenGLExtension
public:
QOpenGLExtension_ARB_draw_buffers();
- bool initializeOpenGLFunctions() Q_DECL_FINAL;
+ bool initializeOpenGLFunctions() final;
void glDrawBuffersARB(GLsizei n, const GLenum *bufs);
@@ -1306,7 +1306,7 @@ class QOpenGLExtension_ARB_draw_buffers_blend : public QAbstractOpenGLExtension
public:
QOpenGLExtension_ARB_draw_buffers_blend();
- bool initializeOpenGLFunctions() Q_DECL_FINAL;
+ bool initializeOpenGLFunctions() final;
void glBlendFuncSeparateiARB(GLuint buf, GLenum srcRGB, GLenum dstRGB, GLenum srcAlpha, GLenum dstAlpha);
void glBlendFunciARB(GLuint buf, GLenum src, GLenum dst);
@@ -1355,7 +1355,7 @@ class QOpenGLExtension_ARB_draw_elements_base_vertex : public QAbstractOpenGLExt
public:
QOpenGLExtension_ARB_draw_elements_base_vertex();
- bool initializeOpenGLFunctions() Q_DECL_FINAL;
+ bool initializeOpenGLFunctions() final;
void glMultiDrawElementsBaseVertex(GLenum mode, const GLsizei *count, GLenum type, const GLvoid* const *indices, GLsizei drawcount, const GLint *basevertex);
void glDrawElementsInstancedBaseVertex(GLenum mode, GLsizei count, GLenum type, const GLvoid *indices, GLsizei instancecount, GLint basevertex);
@@ -1402,7 +1402,7 @@ class QOpenGLExtension_ARB_draw_indirect : public QAbstractOpenGLExtension
public:
QOpenGLExtension_ARB_draw_indirect();
- bool initializeOpenGLFunctions() Q_DECL_FINAL;
+ bool initializeOpenGLFunctions() final;
void glDrawElementsIndirect(GLenum mode, GLenum type, const GLvoid *indirect);
void glDrawArraysIndirect(GLenum mode, const GLvoid *indirect);
@@ -1435,7 +1435,7 @@ class QOpenGLExtension_ARB_draw_instanced : public QAbstractOpenGLExtension
public:
QOpenGLExtension_ARB_draw_instanced();
- bool initializeOpenGLFunctions() Q_DECL_FINAL;
+ bool initializeOpenGLFunctions() final;
void glDrawElementsInstancedARB(GLenum mode, GLsizei count, GLenum type, const GLvoid *indices, GLsizei primcount);
void glDrawArraysInstancedARB(GLenum mode, GLint first, GLsizei count, GLsizei primcount);
@@ -1468,7 +1468,7 @@ class QOpenGLExtension_ARB_framebuffer_no_attachments : public QAbstractOpenGLEx
public:
QOpenGLExtension_ARB_framebuffer_no_attachments();
- bool initializeOpenGLFunctions() Q_DECL_FINAL;
+ bool initializeOpenGLFunctions() final;
void glGetFramebufferParameteriv(GLenum target, GLenum pname, GLint *params);
void glFramebufferParameteri(GLenum target, GLenum pname, GLint param);
@@ -1519,7 +1519,7 @@ class QOpenGLExtension_ARB_framebuffer_object : public QAbstractOpenGLExtension
public:
QOpenGLExtension_ARB_framebuffer_object();
- bool initializeOpenGLFunctions() Q_DECL_FINAL;
+ bool initializeOpenGLFunctions() final;
void glFramebufferTextureLayer(GLenum target, GLenum attachment, GLuint texture, GLint level, GLint layer);
void glRenderbufferStorageMultisample(GLenum target, GLsizei samples, GLenum internalformat, GLsizei width, GLsizei height);
@@ -1680,7 +1680,7 @@ class QOpenGLExtension_ARB_geometry_shader4 : public QAbstractOpenGLExtension
public:
QOpenGLExtension_ARB_geometry_shader4();
- bool initializeOpenGLFunctions() Q_DECL_FINAL;
+ bool initializeOpenGLFunctions() final;
void glFramebufferTextureFaceARB(GLenum target, GLenum attachment, GLuint texture, GLint level, GLenum face);
void glFramebufferTextureLayerARB(GLenum target, GLenum attachment, GLuint texture, GLint level, GLint layer);
@@ -1728,7 +1728,7 @@ class QOpenGLExtension_ARB_get_program_binary : public QAbstractOpenGLExtension
public:
QOpenGLExtension_ARB_get_program_binary();
- bool initializeOpenGLFunctions() Q_DECL_FINAL;
+ bool initializeOpenGLFunctions() final;
void glProgramParameteri(GLuint program, GLenum pname, GLint value);
void glProgramBinary(GLuint program, GLenum binaryFormat, const GLvoid *binary, GLsizei length);
@@ -1784,7 +1784,7 @@ class QOpenGLExtension_ARB_gpu_shader_fp64 : public QAbstractOpenGLExtension
public:
QOpenGLExtension_ARB_gpu_shader_fp64();
- bool initializeOpenGLFunctions() Q_DECL_FINAL;
+ bool initializeOpenGLFunctions() final;
void glGetUniformdv(GLuint program, GLint location, GLdouble *params);
void glUniformMatrix4x3dv(GLint location, GLsizei count, GLboolean transpose, const GLdouble *value);
@@ -1928,7 +1928,7 @@ class QOpenGLExtension_ARB_instanced_arrays : public QAbstractOpenGLExtension
public:
QOpenGLExtension_ARB_instanced_arrays();
- bool initializeOpenGLFunctions() Q_DECL_FINAL;
+ bool initializeOpenGLFunctions() final;
void glVertexAttribDivisorARB(GLuint index, GLuint divisor);
@@ -1953,7 +1953,7 @@ class QOpenGLExtension_ARB_internalformat_query : public QAbstractOpenGLExtensio
public:
QOpenGLExtension_ARB_internalformat_query();
- bool initializeOpenGLFunctions() Q_DECL_FINAL;
+ bool initializeOpenGLFunctions() final;
void glGetInternalformativ(GLenum target, GLenum internalformat, GLenum pname, GLsizei bufSize, GLint *params);
@@ -1978,7 +1978,7 @@ class QOpenGLExtension_ARB_internalformat_query2 : public QAbstractOpenGLExtensi
public:
QOpenGLExtension_ARB_internalformat_query2();
- bool initializeOpenGLFunctions() Q_DECL_FINAL;
+ bool initializeOpenGLFunctions() final;
void glGetInternalformati64v(GLenum target, GLenum internalformat, GLenum pname, GLsizei bufSize, GLint64 *params);
@@ -2008,7 +2008,7 @@ class QOpenGLExtension_ARB_invalidate_subdata : public QAbstractOpenGLExtension
public:
QOpenGLExtension_ARB_invalidate_subdata();
- bool initializeOpenGLFunctions() Q_DECL_FINAL;
+ bool initializeOpenGLFunctions() final;
void glInvalidateSubFramebuffer(GLenum target, GLsizei numAttachments, const GLenum *attachments, GLint x, GLint y, GLsizei width, GLsizei height);
void glInvalidateFramebuffer(GLenum target, GLsizei numAttachments, const GLenum *attachments);
@@ -2069,7 +2069,7 @@ class QOpenGLExtension_ARB_map_buffer_range : public QAbstractOpenGLExtension
public:
QOpenGLExtension_ARB_map_buffer_range();
- bool initializeOpenGLFunctions() Q_DECL_FINAL;
+ bool initializeOpenGLFunctions() final;
void glFlushMappedBufferRange(GLenum target, GLintptr offset, GLsizeiptr length);
GLvoid* glMapBufferRange(GLenum target, GLintptr offset, GLsizeiptr length, GLbitfield access);
@@ -2105,7 +2105,7 @@ class QOpenGLExtension_ARB_matrix_palette : public QAbstractOpenGLExtension
public:
QOpenGLExtension_ARB_matrix_palette();
- bool initializeOpenGLFunctions() Q_DECL_FINAL;
+ bool initializeOpenGLFunctions() final;
void glMatrixIndexPointerARB(GLint size, GLenum type, GLsizei stride, const GLvoid *pointer);
void glMatrixIndexuivARB(GLint size, const GLuint *indices);
@@ -2159,7 +2159,7 @@ class QOpenGLExtension_ARB_multi_draw_indirect : public QAbstractOpenGLExtension
public:
QOpenGLExtension_ARB_multi_draw_indirect();
- bool initializeOpenGLFunctions() Q_DECL_FINAL;
+ bool initializeOpenGLFunctions() final;
void glMultiDrawElementsIndirect(GLenum mode, GLenum type, const void *indirect, GLsizei drawcount, GLsizei stride);
void glMultiDrawArraysIndirect(GLenum mode, const void *indirect, GLsizei drawcount, GLsizei stride);
@@ -2191,7 +2191,7 @@ class QOpenGLExtension_ARB_multisample : public QAbstractOpenGLExtension
public:
QOpenGLExtension_ARB_multisample();
- bool initializeOpenGLFunctions() Q_DECL_FINAL;
+ bool initializeOpenGLFunctions() final;
void glSampleCoverageARB(GLfloat value, GLboolean invert);
@@ -2249,7 +2249,7 @@ class QOpenGLExtension_ARB_multitexture : public QAbstractOpenGLExtension
public:
QOpenGLExtension_ARB_multitexture();
- bool initializeOpenGLFunctions() Q_DECL_FINAL;
+ bool initializeOpenGLFunctions() final;
void glMultiTexCoord4svARB(GLenum target, const GLshort *v);
void glMultiTexCoord4sARB(GLenum target, GLshort s, GLshort t, GLshort r, GLshort q);
@@ -2512,7 +2512,7 @@ class QOpenGLExtension_ARB_occlusion_query : public QAbstractOpenGLExtension
public:
QOpenGLExtension_ARB_occlusion_query();
- bool initializeOpenGLFunctions() Q_DECL_FINAL;
+ bool initializeOpenGLFunctions() final;
void glGetQueryObjectuivARB(GLuint id, GLenum pname, GLuint *params);
void glGetQueryObjectivARB(GLuint id, GLenum pname, GLint *params);
@@ -2587,7 +2587,7 @@ class QOpenGLExtension_ARB_point_parameters : public QAbstractOpenGLExtension
public:
QOpenGLExtension_ARB_point_parameters();
- bool initializeOpenGLFunctions() Q_DECL_FINAL;
+ bool initializeOpenGLFunctions() final;
void glPointParameterfvARB(GLenum pname, const GLfloat *params);
void glPointParameterfARB(GLenum pname, GLfloat param);
@@ -2624,7 +2624,7 @@ class QOpenGLExtension_ARB_program_interface_query : public QAbstractOpenGLExten
public:
QOpenGLExtension_ARB_program_interface_query();
- bool initializeOpenGLFunctions() Q_DECL_FINAL;
+ bool initializeOpenGLFunctions() final;
GLint glGetProgramResourceLocationIndex(GLuint program, GLenum programInterface, const GLchar *name);
GLint glGetProgramResourceLocation(GLuint program, GLenum programInterface, const GLchar *name);
@@ -2684,7 +2684,7 @@ class QOpenGLExtension_ARB_provoking_vertex : public QAbstractOpenGLExtension
public:
QOpenGLExtension_ARB_provoking_vertex();
- bool initializeOpenGLFunctions() Q_DECL_FINAL;
+ bool initializeOpenGLFunctions() final;
void glProvokingVertex(GLenum mode);
@@ -2728,7 +2728,7 @@ class QOpenGLExtension_ARB_robustness : public QAbstractOpenGLExtension
public:
QOpenGLExtension_ARB_robustness();
- bool initializeOpenGLFunctions() Q_DECL_FINAL;
+ bool initializeOpenGLFunctions() final;
void glGetnUniformdvARB(GLuint program, GLint location, GLsizei bufSize, GLdouble *params);
void glGetnUniformuivARB(GLuint program, GLint location, GLsizei bufSize, GLuint *params);
@@ -2886,7 +2886,7 @@ class QOpenGLExtension_ARB_sample_shading : public QAbstractOpenGLExtension
public:
QOpenGLExtension_ARB_sample_shading();
- bool initializeOpenGLFunctions() Q_DECL_FINAL;
+ bool initializeOpenGLFunctions() final;
void glMinSampleShadingARB(GLfloat value);
@@ -2924,7 +2924,7 @@ class QOpenGLExtension_ARB_sampler_objects : public QAbstractOpenGLExtension
public:
QOpenGLExtension_ARB_sampler_objects();
- bool initializeOpenGLFunctions() Q_DECL_FINAL;
+ bool initializeOpenGLFunctions() final;
void glGetSamplerParameterIuiv(GLuint sampler, GLenum pname, GLuint *params);
void glGetSamplerParameterfv(GLuint sampler, GLenum pname, GLfloat *params);
@@ -3099,7 +3099,7 @@ class QOpenGLExtension_ARB_separate_shader_objects : public QAbstractOpenGLExten
public:
QOpenGLExtension_ARB_separate_shader_objects();
- bool initializeOpenGLFunctions() Q_DECL_FINAL;
+ bool initializeOpenGLFunctions() final;
void glGetProgramPipelineInfoLog(GLuint pipeline, GLsizei bufSize, GLsizei *length, GLchar *infoLog);
void glValidateProgramPipeline(GLuint pipeline);
@@ -3537,7 +3537,7 @@ class QOpenGLExtension_ARB_shader_atomic_counters : public QAbstractOpenGLExtens
public:
QOpenGLExtension_ARB_shader_atomic_counters();
- bool initializeOpenGLFunctions() Q_DECL_FINAL;
+ bool initializeOpenGLFunctions() final;
void glGetActiveAtomicCounterBufferiv(GLuint program, GLuint bufferIndex, GLenum pname, GLint *params);
@@ -3563,7 +3563,7 @@ class QOpenGLExtension_ARB_shader_image_load_store : public QAbstractOpenGLExten
public:
QOpenGLExtension_ARB_shader_image_load_store();
- bool initializeOpenGLFunctions() Q_DECL_FINAL;
+ bool initializeOpenGLFunctions() final;
void glMemoryBarrier(GLbitfield barriers);
void glBindImageTexture(GLuint unit, GLuint texture, GLint level, GLboolean layered, GLint layer, GLenum access, GLenum format);
@@ -3633,7 +3633,7 @@ class QOpenGLExtension_ARB_shader_objects : public QAbstractOpenGLExtension
public:
QOpenGLExtension_ARB_shader_objects();
- bool initializeOpenGLFunctions() Q_DECL_FINAL;
+ bool initializeOpenGLFunctions() final;
void glGetShaderSourceARB(GLhandleARB obj, GLsizei maxLength, GLsizei *length, GLcharARB *source);
void glGetUniformivARB(GLhandleARB programObj, GLint location, GLint *params);
@@ -3924,7 +3924,7 @@ class QOpenGLExtension_ARB_shader_storage_buffer_object : public QAbstractOpenGL
public:
QOpenGLExtension_ARB_shader_storage_buffer_object();
- bool initializeOpenGLFunctions() Q_DECL_FINAL;
+ bool initializeOpenGLFunctions() final;
void glShaderStorageBlockBinding(GLuint program, GLuint storageBlockIndex, GLuint storageBlockBinding);
@@ -3956,7 +3956,7 @@ class QOpenGLExtension_ARB_shader_subroutine : public QAbstractOpenGLExtension
public:
QOpenGLExtension_ARB_shader_subroutine();
- bool initializeOpenGLFunctions() Q_DECL_FINAL;
+ bool initializeOpenGLFunctions() final;
void glGetProgramStageiv(GLuint program, GLenum shadertype, GLenum pname, GLint *values);
void glGetUniformSubroutineuiv(GLenum shadertype, GLint location, GLuint *params);
@@ -4035,7 +4035,7 @@ class QOpenGLExtension_ARB_shading_language_include : public QAbstractOpenGLExte
public:
QOpenGLExtension_ARB_shading_language_include();
- bool initializeOpenGLFunctions() Q_DECL_FINAL;
+ bool initializeOpenGLFunctions() final;
void glGetNamedStringivARB(GLint namelen, const GLchar *name, GLenum pname, GLint *params);
void glGetNamedStringARB(GLint namelen, const GLchar *name, GLsizei bufSize, GLint *stringlen, GLchar *string);
@@ -4101,7 +4101,7 @@ class QOpenGLExtension_ARB_sync : public QAbstractOpenGLExtension
public:
QOpenGLExtension_ARB_sync();
- bool initializeOpenGLFunctions() Q_DECL_FINAL;
+ bool initializeOpenGLFunctions() final;
void glGetSynciv(GLsync sync, GLenum pname, GLsizei bufSize, GLsizei *length, GLint *values);
void glGetInteger64v(GLenum pname, GLint64 *params);
@@ -4169,7 +4169,7 @@ class QOpenGLExtension_ARB_tessellation_shader : public QAbstractOpenGLExtension
public:
QOpenGLExtension_ARB_tessellation_shader();
- bool initializeOpenGLFunctions() Q_DECL_FINAL;
+ bool initializeOpenGLFunctions() final;
void glPatchParameterfv(GLenum pname, const GLfloat *values);
void glPatchParameteri(GLenum pname, GLint value);
@@ -4201,7 +4201,7 @@ class QOpenGLExtension_ARB_texture_buffer_object : public QAbstractOpenGLExtensi
public:
QOpenGLExtension_ARB_texture_buffer_object();
- bool initializeOpenGLFunctions() Q_DECL_FINAL;
+ bool initializeOpenGLFunctions() final;
void glTexBufferARB(GLenum target, GLenum internalformat, GLuint buffer);
@@ -4226,7 +4226,7 @@ class QOpenGLExtension_ARB_texture_buffer_range : public QAbstractOpenGLExtensio
public:
QOpenGLExtension_ARB_texture_buffer_range();
- bool initializeOpenGLFunctions() Q_DECL_FINAL;
+ bool initializeOpenGLFunctions() final;
void glTexBufferRange(GLenum target, GLenum internalformat, GLuint buffer, GLintptr offset, GLsizeiptr size);
@@ -4257,7 +4257,7 @@ class QOpenGLExtension_ARB_texture_compression : public QAbstractOpenGLExtension
public:
QOpenGLExtension_ARB_texture_compression();
- bool initializeOpenGLFunctions() Q_DECL_FINAL;
+ bool initializeOpenGLFunctions() final;
void glGetCompressedTexImageARB(GLenum target, GLint level, GLvoid *img);
void glCompressedTexSubImage1DARB(GLenum target, GLint level, GLint xoffset, GLsizei width, GLenum format, GLsizei imageSize, const GLvoid *data);
@@ -4327,7 +4327,7 @@ class QOpenGLExtension_ARB_texture_multisample : public QAbstractOpenGLExtension
public:
QOpenGLExtension_ARB_texture_multisample();
- bool initializeOpenGLFunctions() Q_DECL_FINAL;
+ bool initializeOpenGLFunctions() final;
void glSampleMaski(GLuint index, GLbitfield mask);
void glGetMultisamplefv(GLenum pname, GLuint index, GLfloat *val);
@@ -4375,7 +4375,7 @@ class QOpenGLExtension_ARB_texture_storage : public QAbstractOpenGLExtension
public:
QOpenGLExtension_ARB_texture_storage();
- bool initializeOpenGLFunctions() Q_DECL_FINAL;
+ bool initializeOpenGLFunctions() final;
void glTexStorage3D(GLenum target, GLsizei levels, GLenum internalformat, GLsizei width, GLsizei height, GLsizei depth);
void glTexStorage2D(GLenum target, GLsizei levels, GLenum internalformat, GLsizei width, GLsizei height);
@@ -4415,7 +4415,7 @@ class QOpenGLExtension_ARB_texture_storage_multisample : public QAbstractOpenGLE
public:
QOpenGLExtension_ARB_texture_storage_multisample();
- bool initializeOpenGLFunctions() Q_DECL_FINAL;
+ bool initializeOpenGLFunctions() final;
void glTexStorage3DMultisample(GLenum target, GLsizei samples, GLenum internalformat, GLsizei width, GLsizei height, GLsizei depth, GLboolean fixedsamplelocations);
void glTexStorage2DMultisample(GLenum target, GLsizei samples, GLenum internalformat, GLsizei width, GLsizei height, GLboolean fixedsamplelocations);
@@ -4447,7 +4447,7 @@ class QOpenGLExtension_ARB_texture_view : public QAbstractOpenGLExtension
public:
QOpenGLExtension_ARB_texture_view();
- bool initializeOpenGLFunctions() Q_DECL_FINAL;
+ bool initializeOpenGLFunctions() final;
void glTextureView(GLuint texture, GLenum target, GLuint origtexture, GLenum internalformat, GLuint minlevel, GLuint numlevels, GLuint minlayer, GLuint numlayers);
@@ -4474,7 +4474,7 @@ class QOpenGLExtension_ARB_timer_query : public QAbstractOpenGLExtension
public:
QOpenGLExtension_ARB_timer_query();
- bool initializeOpenGLFunctions() Q_DECL_FINAL;
+ bool initializeOpenGLFunctions() final;
void glGetQueryObjectui64v(GLuint id, GLenum pname, GLuint64 *params);
void glGetQueryObjecti64v(GLuint id, GLenum pname, GLint64 *params);
@@ -4519,7 +4519,7 @@ class QOpenGLExtension_ARB_transform_feedback2 : public QAbstractOpenGLExtension
public:
QOpenGLExtension_ARB_transform_feedback2();
- bool initializeOpenGLFunctions() Q_DECL_FINAL;
+ bool initializeOpenGLFunctions() final;
void glDrawTransformFeedback(GLenum mode, GLuint id);
void glResumeTransformFeedback();
@@ -4589,7 +4589,7 @@ class QOpenGLExtension_ARB_transform_feedback3 : public QAbstractOpenGLExtension
public:
QOpenGLExtension_ARB_transform_feedback3();
- bool initializeOpenGLFunctions() Q_DECL_FINAL;
+ bool initializeOpenGLFunctions() final;
void glGetQueryIndexediv(GLenum target, GLuint index, GLenum pname, GLint *params);
void glEndQueryIndexed(GLenum target, GLuint index);
@@ -4636,7 +4636,7 @@ class QOpenGLExtension_ARB_transform_feedback_instanced : public QAbstractOpenGL
public:
QOpenGLExtension_ARB_transform_feedback_instanced();
- bool initializeOpenGLFunctions() Q_DECL_FINAL;
+ bool initializeOpenGLFunctions() final;
void glDrawTransformFeedbackStreamInstanced(GLenum mode, GLuint id, GLuint stream, GLsizei instancecount);
void glDrawTransformFeedbackInstanced(GLenum mode, GLuint id, GLsizei instancecount);
@@ -4671,7 +4671,7 @@ class QOpenGLExtension_ARB_transpose_matrix : public QAbstractOpenGLExtension
public:
QOpenGLExtension_ARB_transpose_matrix();
- bool initializeOpenGLFunctions() Q_DECL_FINAL;
+ bool initializeOpenGLFunctions() final;
void glMultTransposeMatrixdARB(const GLdouble *m);
void glMultTransposeMatrixfARB(const GLfloat *m);
@@ -4723,7 +4723,7 @@ class QOpenGLExtension_ARB_uniform_buffer_object : public QAbstractOpenGLExtensi
public:
QOpenGLExtension_ARB_uniform_buffer_object();
- bool initializeOpenGLFunctions() Q_DECL_FINAL;
+ bool initializeOpenGLFunctions() final;
void glUniformBlockBinding(GLuint program, GLuint uniformBlockIndex, GLuint uniformBlockBinding);
void glGetActiveUniformBlockName(GLuint program, GLuint uniformBlockIndex, GLsizei bufSize, GLsizei *length, GLchar *uniformBlockName);
@@ -4793,7 +4793,7 @@ class QOpenGLExtension_ARB_vertex_array_object : public QAbstractOpenGLExtension
public:
QOpenGLExtension_ARB_vertex_array_object();
- bool initializeOpenGLFunctions() Q_DECL_FINAL;
+ bool initializeOpenGLFunctions() final;
GLboolean glIsVertexArray(GLuint array);
void glGenVertexArrays(GLsizei n, GLuint *arrays);
@@ -4848,7 +4848,7 @@ class QOpenGLExtension_ARB_vertex_attrib_64bit : public QAbstractOpenGLExtension
public:
QOpenGLExtension_ARB_vertex_attrib_64bit();
- bool initializeOpenGLFunctions() Q_DECL_FINAL;
+ bool initializeOpenGLFunctions() final;
void glGetVertexAttribLdv(GLuint index, GLenum pname, GLdouble *params);
void glVertexAttribLPointer(GLuint index, GLint size, GLenum type, GLsizei stride, const GLvoid *pointer);
@@ -4941,7 +4941,7 @@ class QOpenGLExtension_ARB_vertex_attrib_binding : public QAbstractOpenGLExtensi
public:
QOpenGLExtension_ARB_vertex_attrib_binding();
- bool initializeOpenGLFunctions() Q_DECL_FINAL;
+ bool initializeOpenGLFunctions() final;
void glVertexBindingDivisor(GLuint bindingindex, GLuint divisor);
void glVertexAttribBinding(GLuint attribindex, GLuint bindingindex);
@@ -5010,7 +5010,7 @@ class QOpenGLExtension_ARB_vertex_blend : public QAbstractOpenGLExtension
public:
QOpenGLExtension_ARB_vertex_blend();
- bool initializeOpenGLFunctions() Q_DECL_FINAL;
+ bool initializeOpenGLFunctions() final;
void glVertexBlendARB(GLint count);
void glWeightPointerARB(GLint size, GLenum type, GLsizei stride, const GLvoid *pointer);
@@ -5108,7 +5108,7 @@ class QOpenGLExtension_ARB_vertex_buffer_object : public QAbstractOpenGLExtensio
public:
QOpenGLExtension_ARB_vertex_buffer_object();
- bool initializeOpenGLFunctions() Q_DECL_FINAL;
+ bool initializeOpenGLFunctions() final;
void glGetBufferPointervARB(GLenum target, GLenum pname, GLvoid* *params);
void glGetBufferParameterivARB(GLenum target, GLenum pname, GLint *params);
@@ -5264,7 +5264,7 @@ class QOpenGLExtension_ARB_vertex_program : public QAbstractOpenGLExtension
public:
QOpenGLExtension_ARB_vertex_program();
- bool initializeOpenGLFunctions() Q_DECL_FINAL;
+ bool initializeOpenGLFunctions() final;
GLboolean glIsProgramARB(GLuint program);
void glGetVertexAttribPointervARB(GLuint index, GLenum pname, GLvoid* *pointer);
@@ -5718,7 +5718,7 @@ class QOpenGLExtension_ARB_vertex_shader : public QAbstractOpenGLExtension
public:
QOpenGLExtension_ARB_vertex_shader();
- bool initializeOpenGLFunctions() Q_DECL_FINAL;
+ bool initializeOpenGLFunctions() final;
GLint glGetAttribLocationARB(GLhandleARB programObj, const GLcharARB *name);
void glGetActiveAttribARB(GLhandleARB programObj, GLuint index, GLsizei maxLength, GLsizei *length, GLint *size, GLenum *type, GLcharARB *name);
@@ -5794,7 +5794,7 @@ class QOpenGLExtension_ARB_vertex_type_2_10_10_10_rev : public QAbstractOpenGLEx
public:
QOpenGLExtension_ARB_vertex_type_2_10_10_10_rev();
- bool initializeOpenGLFunctions() Q_DECL_FINAL;
+ bool initializeOpenGLFunctions() final;
void glVertexAttribP4uiv(GLuint index, GLenum type, GLboolean normalized, const GLuint *value);
void glVertexAttribP4ui(GLuint index, GLenum type, GLboolean normalized, GLuint value);
@@ -6087,7 +6087,7 @@ class QOpenGLExtension_ARB_viewport_array : public QAbstractOpenGLExtension
public:
QOpenGLExtension_ARB_viewport_array();
- bool initializeOpenGLFunctions() Q_DECL_FINAL;
+ bool initializeOpenGLFunctions() final;
void glGetDoublei_v(GLenum target, GLuint index, GLdouble *data);
void glGetFloati_v(GLenum target, GLuint index, GLfloat *data);
@@ -6190,7 +6190,7 @@ class QOpenGLExtension_ARB_window_pos : public QAbstractOpenGLExtension
public:
QOpenGLExtension_ARB_window_pos();
- bool initializeOpenGLFunctions() Q_DECL_FINAL;
+ bool initializeOpenGLFunctions() final;
void glWindowPos3svARB(const GLshort *v);
void glWindowPos3sARB(GLshort x, GLshort y, GLshort z);
@@ -6320,7 +6320,7 @@ class QOpenGLExtension_ATI_draw_buffers : public QAbstractOpenGLExtension
public:
QOpenGLExtension_ATI_draw_buffers();
- bool initializeOpenGLFunctions() Q_DECL_FINAL;
+ bool initializeOpenGLFunctions() final;
void glDrawBuffersATI(GLsizei n, const GLenum *bufs);
@@ -6347,7 +6347,7 @@ class QOpenGLExtension_ATI_element_array : public QAbstractOpenGLExtension
public:
QOpenGLExtension_ATI_element_array();
- bool initializeOpenGLFunctions() Q_DECL_FINAL;
+ bool initializeOpenGLFunctions() final;
void glDrawRangeElementArrayATI(GLenum mode, GLuint start, GLuint end, GLsizei count);
void glDrawElementArrayATI(GLenum mode, GLsizei count);
@@ -6389,7 +6389,7 @@ class QOpenGLExtension_ATI_envmap_bumpmap : public QAbstractOpenGLExtension
public:
QOpenGLExtension_ATI_envmap_bumpmap();
- bool initializeOpenGLFunctions() Q_DECL_FINAL;
+ bool initializeOpenGLFunctions() final;
void glGetTexBumpParameterfvATI(GLenum pname, GLfloat *param);
void glGetTexBumpParameterivATI(GLenum pname, GLint *param);
@@ -6448,7 +6448,7 @@ class QOpenGLExtension_ATI_fragment_shader : public QAbstractOpenGLExtension
public:
QOpenGLExtension_ATI_fragment_shader();
- bool initializeOpenGLFunctions() Q_DECL_FINAL;
+ bool initializeOpenGLFunctions() final;
void glSetFragmentShaderConstantATI(GLuint dst, const GLfloat *value);
void glAlphaFragmentOp3ATI(GLenum op, GLuint dst, GLuint dstMod, GLuint arg1, GLuint arg1Rep, GLuint arg1Mod, GLuint arg2, GLuint arg2Rep, GLuint arg2Mod, GLuint arg3, GLuint arg3Rep, GLuint arg3Mod);
@@ -6565,7 +6565,7 @@ class QOpenGLExtension_ATI_map_object_buffer : public QAbstractOpenGLExtension
public:
QOpenGLExtension_ATI_map_object_buffer();
- bool initializeOpenGLFunctions() Q_DECL_FINAL;
+ bool initializeOpenGLFunctions() final;
void glUnmapObjectBufferATI(GLuint buffer);
GLvoid* glMapObjectBufferATI(GLuint buffer);
@@ -6598,7 +6598,7 @@ class QOpenGLExtension_ATI_pn_triangles : public QAbstractOpenGLExtension
public:
QOpenGLExtension_ATI_pn_triangles();
- bool initializeOpenGLFunctions() Q_DECL_FINAL;
+ bool initializeOpenGLFunctions() final;
void glPNTrianglesfATI(GLenum pname, GLfloat param);
void glPNTrianglesiATI(GLenum pname, GLint param);
@@ -6631,7 +6631,7 @@ class QOpenGLExtension_ATI_separate_stencil : public QAbstractOpenGLExtension
public:
QOpenGLExtension_ATI_separate_stencil();
- bool initializeOpenGLFunctions() Q_DECL_FINAL;
+ bool initializeOpenGLFunctions() final;
void glStencilFuncSeparateATI(GLenum frontfunc, GLenum backfunc, GLint ref, GLuint mask);
void glStencilOpSeparateATI(GLenum face, GLenum sfail, GLenum dpfail, GLenum dppass);
@@ -6674,7 +6674,7 @@ class QOpenGLExtension_ATI_vertex_array_object : public QAbstractOpenGLExtension
public:
QOpenGLExtension_ATI_vertex_array_object();
- bool initializeOpenGLFunctions() Q_DECL_FINAL;
+ bool initializeOpenGLFunctions() final;
void glGetVariantArrayObjectivATI(GLuint id, GLenum pname, GLint *params);
void glGetVariantArrayObjectfvATI(GLuint id, GLenum pname, GLfloat *params);
@@ -6778,7 +6778,7 @@ class QOpenGLExtension_ATI_vertex_attrib_array_object : public QAbstractOpenGLEx
public:
QOpenGLExtension_ATI_vertex_attrib_array_object();
- bool initializeOpenGLFunctions() Q_DECL_FINAL;
+ bool initializeOpenGLFunctions() final;
void glGetVertexAttribArrayObjectivATI(GLuint index, GLenum pname, GLint *params);
void glGetVertexAttribArrayObjectfvATI(GLuint index, GLenum pname, GLfloat *params);
@@ -6861,7 +6861,7 @@ class QOpenGLExtension_ATI_vertex_streams : public QAbstractOpenGLExtension
public:
QOpenGLExtension_ATI_vertex_streams();
- bool initializeOpenGLFunctions() Q_DECL_FINAL;
+ bool initializeOpenGLFunctions() final;
void glVertexBlendEnvfATI(GLenum pname, GLfloat param);
void glVertexBlendEnviATI(GLenum pname, GLint param);
@@ -7196,7 +7196,7 @@ class QOpenGLExtension_EXT_bindable_uniform : public QAbstractOpenGLExtension
public:
QOpenGLExtension_EXT_bindable_uniform();
- bool initializeOpenGLFunctions() Q_DECL_FINAL;
+ bool initializeOpenGLFunctions() final;
GLintptr glGetUniformOffsetEXT(GLuint program, GLint location);
GLint glGetUniformBufferSizeEXT(GLuint program, GLint location);
@@ -7235,7 +7235,7 @@ class QOpenGLExtension_EXT_blend_color : public QAbstractOpenGLExtension
public:
QOpenGLExtension_EXT_blend_color();
- bool initializeOpenGLFunctions() Q_DECL_FINAL;
+ bool initializeOpenGLFunctions() final;
void glBlendColorEXT(GLfloat red, GLfloat green, GLfloat blue, GLfloat alpha);
@@ -7260,7 +7260,7 @@ class QOpenGLExtension_EXT_blend_equation_separate : public QAbstractOpenGLExten
public:
QOpenGLExtension_EXT_blend_equation_separate();
- bool initializeOpenGLFunctions() Q_DECL_FINAL;
+ bool initializeOpenGLFunctions() final;
void glBlendEquationSeparateEXT(GLenum modeRGB, GLenum modeAlpha);
@@ -7285,7 +7285,7 @@ class QOpenGLExtension_EXT_blend_func_separate : public QAbstractOpenGLExtension
public:
QOpenGLExtension_EXT_blend_func_separate();
- bool initializeOpenGLFunctions() Q_DECL_FINAL;
+ bool initializeOpenGLFunctions() final;
void glBlendFuncSeparateEXT(GLenum sfactorRGB, GLenum dfactorRGB, GLenum sfactorAlpha, GLenum dfactorAlpha);
@@ -7310,7 +7310,7 @@ class QOpenGLExtension_EXT_blend_minmax : public QAbstractOpenGLExtension
public:
QOpenGLExtension_EXT_blend_minmax();
- bool initializeOpenGLFunctions() Q_DECL_FINAL;
+ bool initializeOpenGLFunctions() final;
void glBlendEquationEXT(GLenum mode);
@@ -7336,7 +7336,7 @@ class QOpenGLExtension_EXT_color_subtable : public QAbstractOpenGLExtension
public:
QOpenGLExtension_EXT_color_subtable();
- bool initializeOpenGLFunctions() Q_DECL_FINAL;
+ bool initializeOpenGLFunctions() final;
void glCopyColorSubTableEXT(GLenum target, GLsizei start, GLint x, GLint y, GLsizei width);
void glColorSubTableEXT(GLenum target, GLsizei start, GLsizei count, GLenum format, GLenum type, const GLvoid *data);
@@ -7369,7 +7369,7 @@ class QOpenGLExtension_EXT_compiled_vertex_array : public QAbstractOpenGLExtensi
public:
QOpenGLExtension_EXT_compiled_vertex_array();
- bool initializeOpenGLFunctions() Q_DECL_FINAL;
+ bool initializeOpenGLFunctions() final;
void glUnlockArraysEXT();
void glLockArraysEXT(GLint first, GLsizei count);
@@ -7413,7 +7413,7 @@ class QOpenGLExtension_EXT_convolution : public QAbstractOpenGLExtension
public:
QOpenGLExtension_EXT_convolution();
- bool initializeOpenGLFunctions() Q_DECL_FINAL;
+ bool initializeOpenGLFunctions() final;
void glSeparableFilter2DEXT(GLenum target, GLenum internalformat, GLsizei width, GLsizei height, GLenum format, GLenum type, const GLvoid *row, const GLvoid *column);
void glGetSeparableFilterEXT(GLenum target, GLenum format, GLenum type, GLvoid *row, GLvoid *column, GLvoid *span);
@@ -7543,7 +7543,7 @@ class QOpenGLExtension_EXT_coordinate_frame : public QAbstractOpenGLExtension
public:
QOpenGLExtension_EXT_coordinate_frame();
- bool initializeOpenGLFunctions() Q_DECL_FINAL;
+ bool initializeOpenGLFunctions() final;
void glBinormalPointerEXT(GLenum type, GLsizei stride, const GLvoid *pointer);
void glTangentPointerEXT(GLenum type, GLsizei stride, const GLvoid *pointer);
@@ -7719,7 +7719,7 @@ class QOpenGLExtension_EXT_copy_texture : public QAbstractOpenGLExtension
public:
QOpenGLExtension_EXT_copy_texture();
- bool initializeOpenGLFunctions() Q_DECL_FINAL;
+ bool initializeOpenGLFunctions() final;
void glCopyTexSubImage3DEXT(GLenum target, GLint level, GLint xoffset, GLint yoffset, GLint zoffset, GLint x, GLint y, GLsizei width, GLsizei height);
void glCopyTexSubImage2DEXT(GLenum target, GLint level, GLint xoffset, GLint yoffset, GLint x, GLint y, GLsizei width, GLsizei height);
@@ -7773,7 +7773,7 @@ class QOpenGLExtension_EXT_cull_vertex : public QAbstractOpenGLExtension
public:
QOpenGLExtension_EXT_cull_vertex();
- bool initializeOpenGLFunctions() Q_DECL_FINAL;
+ bool initializeOpenGLFunctions() final;
void glCullParameterfvEXT(GLenum pname, GLfloat *params);
void glCullParameterdvEXT(GLenum pname, GLdouble *params);
@@ -7805,7 +7805,7 @@ class QOpenGLExtension_EXT_depth_bounds_test : public QAbstractOpenGLExtension
public:
QOpenGLExtension_EXT_depth_bounds_test();
- bool initializeOpenGLFunctions() Q_DECL_FINAL;
+ bool initializeOpenGLFunctions() final;
void glDepthBoundsEXT(GLclampd zmin, GLclampd zmax);
@@ -8051,7 +8051,7 @@ class QOpenGLExtension_EXT_direct_state_access : public QAbstractOpenGLExtension
public:
QOpenGLExtension_EXT_direct_state_access();
- bool initializeOpenGLFunctions() Q_DECL_FINAL;
+ bool initializeOpenGLFunctions() final;
void glProgramUniformMatrix4x3dvEXT(GLuint program, GLint location, GLsizei count, GLboolean transpose, const GLdouble *value);
void glProgramUniformMatrix4x2dvEXT(GLuint program, GLint location, GLsizei count, GLboolean transpose, const GLdouble *value);
@@ -9628,7 +9628,7 @@ class QOpenGLExtension_EXT_draw_buffers2 : public QAbstractOpenGLExtension
public:
QOpenGLExtension_EXT_draw_buffers2();
- bool initializeOpenGLFunctions() Q_DECL_FINAL;
+ bool initializeOpenGLFunctions() final;
GLboolean glIsEnabledIndexedEXT(GLenum target, GLuint index);
void glDisableIndexedEXT(GLenum target, GLuint index);
@@ -9689,7 +9689,7 @@ class QOpenGLExtension_EXT_draw_instanced : public QAbstractOpenGLExtension
public:
QOpenGLExtension_EXT_draw_instanced();
- bool initializeOpenGLFunctions() Q_DECL_FINAL;
+ bool initializeOpenGLFunctions() final;
void glDrawElementsInstancedEXT(GLenum mode, GLsizei count, GLenum type, const GLvoid *indices, GLsizei primcount);
void glDrawArraysInstancedEXT(GLenum mode, GLint start, GLsizei count, GLsizei primcount);
@@ -9721,7 +9721,7 @@ class QOpenGLExtension_EXT_draw_range_elements : public QAbstractOpenGLExtension
public:
QOpenGLExtension_EXT_draw_range_elements();
- bool initializeOpenGLFunctions() Q_DECL_FINAL;
+ bool initializeOpenGLFunctions() final;
void glDrawRangeElementsEXT(GLenum mode, GLuint start, GLuint end, GLsizei count, GLenum type, const GLvoid *indices);
@@ -9750,7 +9750,7 @@ class QOpenGLExtension_EXT_fog_coord : public QAbstractOpenGLExtension
public:
QOpenGLExtension_EXT_fog_coord();
- bool initializeOpenGLFunctions() Q_DECL_FINAL;
+ bool initializeOpenGLFunctions() final;
void glFogCoordPointerEXT(GLenum type, GLsizei stride, const GLvoid *pointer);
void glFogCoorddvEXT(const GLdouble *coord);
@@ -9803,7 +9803,7 @@ class QOpenGLExtension_EXT_framebuffer_blit : public QAbstractOpenGLExtension
public:
QOpenGLExtension_EXT_framebuffer_blit();
- bool initializeOpenGLFunctions() Q_DECL_FINAL;
+ bool initializeOpenGLFunctions() final;
void glBlitFramebufferEXT(GLint srcX0, GLint srcY0, GLint srcX1, GLint srcY1, GLint dstX0, GLint dstY0, GLint dstX1, GLint dstY1, GLbitfield mask, GLenum filter);
@@ -9828,7 +9828,7 @@ class QOpenGLExtension_EXT_framebuffer_multisample : public QAbstractOpenGLExten
public:
QOpenGLExtension_EXT_framebuffer_multisample();
- bool initializeOpenGLFunctions() Q_DECL_FINAL;
+ bool initializeOpenGLFunctions() final;
void glRenderbufferStorageMultisampleEXT(GLenum target, GLsizei samples, GLenum internalformat, GLsizei width, GLsizei height);
@@ -9869,7 +9869,7 @@ class QOpenGLExtension_EXT_framebuffer_object : public QAbstractOpenGLExtension
public:
QOpenGLExtension_EXT_framebuffer_object();
- bool initializeOpenGLFunctions() Q_DECL_FINAL;
+ bool initializeOpenGLFunctions() final;
void glGenerateMipmapEXT(GLenum target);
void glGetFramebufferAttachmentParameterivEXT(GLenum target, GLenum attachment, GLenum pname, GLint *params);
@@ -10006,7 +10006,7 @@ class QOpenGLExtension_EXT_geometry_shader4 : public QAbstractOpenGLExtension
public:
QOpenGLExtension_EXT_geometry_shader4();
- bool initializeOpenGLFunctions() Q_DECL_FINAL;
+ bool initializeOpenGLFunctions() final;
void glProgramParameteriEXT(GLuint program, GLenum pname, GLint value);
@@ -10032,7 +10032,7 @@ class QOpenGLExtension_EXT_gpu_program_parameters : public QAbstractOpenGLExtens
public:
QOpenGLExtension_EXT_gpu_program_parameters();
- bool initializeOpenGLFunctions() Q_DECL_FINAL;
+ bool initializeOpenGLFunctions() final;
void glProgramLocalParameters4fvEXT(GLenum target, GLuint index, GLsizei count, const GLfloat *params);
void glProgramEnvParameters4fvEXT(GLenum target, GLuint index, GLsizei count, const GLfloat *params);
@@ -10074,7 +10074,7 @@ class QOpenGLExtension_EXT_gpu_shader4 : public QAbstractOpenGLExtension
public:
QOpenGLExtension_EXT_gpu_shader4();
- bool initializeOpenGLFunctions() Q_DECL_FINAL;
+ bool initializeOpenGLFunctions() final;
void glUniform4uivEXT(GLint location, GLsizei count, const GLuint *value);
void glUniform3uivEXT(GLint location, GLsizei count, const GLuint *value);
@@ -10178,7 +10178,7 @@ class QOpenGLExtension_EXT_histogram : public QAbstractOpenGLExtension
public:
QOpenGLExtension_EXT_histogram();
- bool initializeOpenGLFunctions() Q_DECL_FINAL;
+ bool initializeOpenGLFunctions() final;
void glResetMinmaxEXT(GLenum target);
void glResetHistogramEXT(GLenum target);
@@ -10266,7 +10266,7 @@ class QOpenGLExtension_EXT_index_func : public QAbstractOpenGLExtension
public:
QOpenGLExtension_EXT_index_func();
- bool initializeOpenGLFunctions() Q_DECL_FINAL;
+ bool initializeOpenGLFunctions() final;
void glIndexFuncEXT(GLenum func, GLclampf ref);
@@ -10291,7 +10291,7 @@ class QOpenGLExtension_EXT_index_material : public QAbstractOpenGLExtension
public:
QOpenGLExtension_EXT_index_material();
- bool initializeOpenGLFunctions() Q_DECL_FINAL;
+ bool initializeOpenGLFunctions() final;
void glIndexMaterialEXT(GLenum face, GLenum mode);
@@ -10318,7 +10318,7 @@ class QOpenGLExtension_EXT_light_texture : public QAbstractOpenGLExtension
public:
QOpenGLExtension_EXT_light_texture();
- bool initializeOpenGLFunctions() Q_DECL_FINAL;
+ bool initializeOpenGLFunctions() final;
void glTextureMaterialEXT(GLenum face, GLenum mode);
void glTextureLightEXT(GLenum pname);
@@ -10358,7 +10358,7 @@ class QOpenGLExtension_EXT_multi_draw_arrays : public QAbstractOpenGLExtension
public:
QOpenGLExtension_EXT_multi_draw_arrays();
- bool initializeOpenGLFunctions() Q_DECL_FINAL;
+ bool initializeOpenGLFunctions() final;
void glMultiDrawElementsEXT(GLenum mode, const GLsizei *count, GLenum type, const GLvoid* *indices, GLsizei primcount);
void glMultiDrawArraysEXT(GLenum mode, const GLint *first, const GLsizei *count, GLsizei primcount);
@@ -10391,7 +10391,7 @@ class QOpenGLExtension_EXT_multisample : public QAbstractOpenGLExtension
public:
QOpenGLExtension_EXT_multisample();
- bool initializeOpenGLFunctions() Q_DECL_FINAL;
+ bool initializeOpenGLFunctions() final;
void glSamplePatternEXT(GLenum pattern);
void glSampleMaskEXT(GLclampf value, GLboolean invert);
@@ -10426,7 +10426,7 @@ class QOpenGLExtension_EXT_paletted_texture : public QAbstractOpenGLExtension
public:
QOpenGLExtension_EXT_paletted_texture();
- bool initializeOpenGLFunctions() Q_DECL_FINAL;
+ bool initializeOpenGLFunctions() final;
void glGetColorTableParameterfvEXT(GLenum target, GLenum pname, GLfloat *params);
void glGetColorTableParameterivEXT(GLenum target, GLenum pname, GLint *params);
@@ -10477,7 +10477,7 @@ class QOpenGLExtension_EXT_pixel_transform : public QAbstractOpenGLExtension
public:
QOpenGLExtension_EXT_pixel_transform();
- bool initializeOpenGLFunctions() Q_DECL_FINAL;
+ bool initializeOpenGLFunctions() final;
void glGetPixelTransformParameterfvEXT(GLenum target, GLenum pname, GLfloat *params);
void glGetPixelTransformParameterivEXT(GLenum target, GLenum pname, GLint *params);
@@ -10538,7 +10538,7 @@ class QOpenGLExtension_EXT_point_parameters : public QAbstractOpenGLExtension
public:
QOpenGLExtension_EXT_point_parameters();
- bool initializeOpenGLFunctions() Q_DECL_FINAL;
+ bool initializeOpenGLFunctions() final;
void glPointParameterfvEXT(GLenum pname, const GLfloat *params);
void glPointParameterfEXT(GLenum pname, GLfloat param);
@@ -10570,7 +10570,7 @@ class QOpenGLExtension_EXT_polygon_offset : public QAbstractOpenGLExtension
public:
QOpenGLExtension_EXT_polygon_offset();
- bool initializeOpenGLFunctions() Q_DECL_FINAL;
+ bool initializeOpenGLFunctions() final;
void glPolygonOffsetEXT(GLfloat factor, GLfloat bias);
@@ -10595,7 +10595,7 @@ class QOpenGLExtension_EXT_provoking_vertex : public QAbstractOpenGLExtension
public:
QOpenGLExtension_EXT_provoking_vertex();
- bool initializeOpenGLFunctions() Q_DECL_FINAL;
+ bool initializeOpenGLFunctions() final;
void glProvokingVertexEXT(GLenum mode);
@@ -10636,7 +10636,7 @@ class QOpenGLExtension_EXT_secondary_color : public QAbstractOpenGLExtension
public:
QOpenGLExtension_EXT_secondary_color();
- bool initializeOpenGLFunctions() Q_DECL_FINAL;
+ bool initializeOpenGLFunctions() final;
void glSecondaryColorPointerEXT(GLint size, GLenum type, GLsizei stride, const GLvoid *pointer);
void glSecondaryColor3usvEXT(const GLushort *v);
@@ -10775,7 +10775,7 @@ class QOpenGLExtension_EXT_separate_shader_objects : public QAbstractOpenGLExten
public:
QOpenGLExtension_EXT_separate_shader_objects();
- bool initializeOpenGLFunctions() Q_DECL_FINAL;
+ bool initializeOpenGLFunctions() final;
GLuint glCreateShaderProgramEXT(GLenum type, const GLchar *string);
void glActiveProgramEXT(GLuint program);
@@ -10815,7 +10815,7 @@ class QOpenGLExtension_EXT_shader_image_load_store : public QAbstractOpenGLExten
public:
QOpenGLExtension_EXT_shader_image_load_store();
- bool initializeOpenGLFunctions() Q_DECL_FINAL;
+ bool initializeOpenGLFunctions() final;
void glMemoryBarrierEXT(GLbitfield barriers);
void glBindImageTextureEXT(GLuint index, GLuint texture, GLint level, GLboolean layered, GLint layer, GLenum access, GLint format);
@@ -10847,7 +10847,7 @@ class QOpenGLExtension_EXT_stencil_clear_tag : public QAbstractOpenGLExtension
public:
QOpenGLExtension_EXT_stencil_clear_tag();
- bool initializeOpenGLFunctions() Q_DECL_FINAL;
+ bool initializeOpenGLFunctions() final;
void glStencilClearTagEXT(GLsizei stencilTagBits, GLuint stencilClearTag);
@@ -10872,7 +10872,7 @@ class QOpenGLExtension_EXT_stencil_two_side : public QAbstractOpenGLExtension
public:
QOpenGLExtension_EXT_stencil_two_side();
- bool initializeOpenGLFunctions() Q_DECL_FINAL;
+ bool initializeOpenGLFunctions() final;
void glActiveStencilFaceEXT(GLenum face);
@@ -10898,7 +10898,7 @@ class QOpenGLExtension_EXT_subtexture : public QAbstractOpenGLExtension
public:
QOpenGLExtension_EXT_subtexture();
- bool initializeOpenGLFunctions() Q_DECL_FINAL;
+ bool initializeOpenGLFunctions() final;
void glTexSubImage2DEXT(GLenum target, GLint level, GLint xoffset, GLint yoffset, GLsizei width, GLsizei height, GLenum format, GLenum type, const GLvoid *pixels);
void glTexSubImage1DEXT(GLenum target, GLint level, GLint xoffset, GLsizei width, GLenum format, GLenum type, const GLvoid *pixels);
@@ -10931,7 +10931,7 @@ class QOpenGLExtension_EXT_texture3D : public QAbstractOpenGLExtension
public:
QOpenGLExtension_EXT_texture3D();
- bool initializeOpenGLFunctions() Q_DECL_FINAL;
+ bool initializeOpenGLFunctions() final;
void glTexSubImage3DEXT(GLenum target, GLint level, GLint xoffset, GLint yoffset, GLint zoffset, GLsizei width, GLsizei height, GLsizei depth, GLenum format, GLenum type, const GLvoid *pixels);
void glTexImage3DEXT(GLenum target, GLint level, GLenum internalformat, GLsizei width, GLsizei height, GLsizei depth, GLint border, GLenum format, GLenum type, const GLvoid *pixels);
@@ -10963,7 +10963,7 @@ class QOpenGLExtension_EXT_texture_buffer_object : public QAbstractOpenGLExtensi
public:
QOpenGLExtension_EXT_texture_buffer_object();
- bool initializeOpenGLFunctions() Q_DECL_FINAL;
+ bool initializeOpenGLFunctions() final;
void glTexBufferEXT(GLenum target, GLenum internalformat, GLuint buffer);
@@ -10993,7 +10993,7 @@ class QOpenGLExtension_EXT_texture_integer : public QAbstractOpenGLExtension
public:
QOpenGLExtension_EXT_texture_integer();
- bool initializeOpenGLFunctions() Q_DECL_FINAL;
+ bool initializeOpenGLFunctions() final;
void glClearColorIuiEXT(GLuint red, GLuint green, GLuint blue, GLuint alpha);
void glClearColorIiEXT(GLint red, GLint green, GLint blue, GLint alpha);
@@ -11058,7 +11058,7 @@ class QOpenGLExtension_EXT_texture_object : public QAbstractOpenGLExtension
public:
QOpenGLExtension_EXT_texture_object();
- bool initializeOpenGLFunctions() Q_DECL_FINAL;
+ bool initializeOpenGLFunctions() final;
void glPrioritizeTexturesEXT(GLsizei n, const GLuint *textures, const GLclampf *priorities);
GLboolean glIsTextureEXT(GLuint texture);
@@ -11118,7 +11118,7 @@ class QOpenGLExtension_EXT_texture_perturb_normal : public QAbstractOpenGLExtens
public:
QOpenGLExtension_EXT_texture_perturb_normal();
- bool initializeOpenGLFunctions() Q_DECL_FINAL;
+ bool initializeOpenGLFunctions() final;
void glTextureNormalEXT(GLenum mode);
@@ -11144,7 +11144,7 @@ class QOpenGLExtension_EXT_timer_query : public QAbstractOpenGLExtension
public:
QOpenGLExtension_EXT_timer_query();
- bool initializeOpenGLFunctions() Q_DECL_FINAL;
+ bool initializeOpenGLFunctions() final;
void glGetQueryObjectui64vEXT(GLuint id, GLenum pname, GLuint64EXT *params);
void glGetQueryObjecti64vEXT(GLuint id, GLenum pname, GLint64EXT *params);
@@ -11182,7 +11182,7 @@ class QOpenGLExtension_EXT_transform_feedback : public QAbstractOpenGLExtension
public:
QOpenGLExtension_EXT_transform_feedback();
- bool initializeOpenGLFunctions() Q_DECL_FINAL;
+ bool initializeOpenGLFunctions() final;
void glGetTransformFeedbackVaryingEXT(GLuint program, GLuint index, GLsizei bufSize, GLsizei *length, GLsizei *size, GLenum *type, GLchar *name);
void glTransformFeedbackVaryingsEXT(GLuint program, GLsizei count, const GLchar* *varyings, GLenum bufferMode);
@@ -11257,7 +11257,7 @@ class QOpenGLExtension_EXT_vertex_array : public QAbstractOpenGLExtension
public:
QOpenGLExtension_EXT_vertex_array();
- bool initializeOpenGLFunctions() Q_DECL_FINAL;
+ bool initializeOpenGLFunctions() final;
void glVertexPointerEXT(GLint size, GLenum type, GLsizei stride, GLsizei count, const GLvoid *pointer);
void glTexCoordPointerEXT(GLint size, GLenum type, GLsizei stride, GLsizei count, const GLvoid *pointer);
@@ -11348,7 +11348,7 @@ class QOpenGLExtension_EXT_vertex_attrib_64bit : public QAbstractOpenGLExtension
public:
QOpenGLExtension_EXT_vertex_attrib_64bit();
- bool initializeOpenGLFunctions() Q_DECL_FINAL;
+ bool initializeOpenGLFunctions() final;
void glVertexArrayVertexAttribLOffsetEXT(GLuint vaobj, GLuint buffer, GLuint index, GLint size, GLenum type, GLsizei stride, GLintptr offset);
void glGetVertexAttribLdvEXT(GLuint index, GLenum pname, GLdouble *params);
@@ -11484,7 +11484,7 @@ class QOpenGLExtension_EXT_vertex_shader : public QAbstractOpenGLExtension
public:
QOpenGLExtension_EXT_vertex_shader();
- bool initializeOpenGLFunctions() Q_DECL_FINAL;
+ bool initializeOpenGLFunctions() final;
void glGetLocalConstantFloatvEXT(GLuint id, GLenum value, GLfloat *data);
void glGetLocalConstantIntegervEXT(GLuint id, GLenum value, GLint *data);
@@ -11798,7 +11798,7 @@ class QOpenGLExtension_EXT_vertex_weighting : public QAbstractOpenGLExtension
public:
QOpenGLExtension_EXT_vertex_weighting();
- bool initializeOpenGLFunctions() Q_DECL_FINAL;
+ bool initializeOpenGLFunctions() final;
void glVertexWeightPointerEXT(GLint size, GLenum type, GLsizei stride, const GLvoid *pointer);
void glVertexWeightfvEXT(const GLfloat *weight);
@@ -11837,7 +11837,7 @@ class QOpenGLExtension_EXT_x11_sync_object : public QAbstractOpenGLExtension
public:
QOpenGLExtension_EXT_x11_sync_object();
- bool initializeOpenGLFunctions() Q_DECL_FINAL;
+ bool initializeOpenGLFunctions() final;
GLsync glImportSyncEXT(GLenum external_sync_type, GLintptr external_sync, GLbitfield flags);
@@ -11862,7 +11862,7 @@ class QOpenGLExtension_GREMEDY_frame_terminator : public QAbstractOpenGLExtensio
public:
QOpenGLExtension_GREMEDY_frame_terminator();
- bool initializeOpenGLFunctions() Q_DECL_FINAL;
+ bool initializeOpenGLFunctions() final;
void glFrameTerminatorGREMEDY();
@@ -11887,7 +11887,7 @@ class QOpenGLExtension_GREMEDY_string_marker : public QAbstractOpenGLExtension
public:
QOpenGLExtension_GREMEDY_string_marker();
- bool initializeOpenGLFunctions() Q_DECL_FINAL;
+ bool initializeOpenGLFunctions() final;
void glStringMarkerGREMEDY(GLsizei len, const GLvoid *string);
@@ -11917,7 +11917,7 @@ class QOpenGLExtension_HP_image_transform : public QAbstractOpenGLExtension
public:
QOpenGLExtension_HP_image_transform();
- bool initializeOpenGLFunctions() Q_DECL_FINAL;
+ bool initializeOpenGLFunctions() final;
void glGetImageTransformParameterfvHP(GLenum target, GLenum pname, GLfloat *params);
void glGetImageTransformParameterivHP(GLenum target, GLenum pname, GLint *params);
@@ -11978,7 +11978,7 @@ class QOpenGLExtension_IBM_multimode_draw_arrays : public QAbstractOpenGLExtensi
public:
QOpenGLExtension_IBM_multimode_draw_arrays();
- bool initializeOpenGLFunctions() Q_DECL_FINAL;
+ bool initializeOpenGLFunctions() final;
void glMultiModeDrawElementsIBM(const GLenum *mode, const GLsizei *count, GLenum type, const GLvoid* const *indices, GLsizei primcount, GLint modestride);
void glMultiModeDrawArraysIBM(const GLenum *mode, const GLint *first, const GLsizei *count, GLsizei primcount, GLint modestride);
@@ -12017,7 +12017,7 @@ class QOpenGLExtension_IBM_vertex_array_lists : public QAbstractOpenGLExtension
public:
QOpenGLExtension_IBM_vertex_array_lists();
- bool initializeOpenGLFunctions() Q_DECL_FINAL;
+ bool initializeOpenGLFunctions() final;
void glVertexPointerListIBM(GLint size, GLenum type, GLint stride, const GLvoid* *pointer, GLint ptrstride);
void glTexCoordPointerListIBM(GLint size, GLenum type, GLint stride, const GLvoid* *pointer, GLint ptrstride);
@@ -12091,7 +12091,7 @@ class QOpenGLExtension_INGR_blend_func_separate : public QAbstractOpenGLExtensio
public:
QOpenGLExtension_INGR_blend_func_separate();
- bool initializeOpenGLFunctions() Q_DECL_FINAL;
+ bool initializeOpenGLFunctions() final;
void glBlendFuncSeparateINGR(GLenum sfactorRGB, GLenum dfactorRGB, GLenum sfactorAlpha, GLenum dfactorAlpha);
@@ -12119,7 +12119,7 @@ class QOpenGLExtension_INTEL_parallel_arrays : public QAbstractOpenGLExtension
public:
QOpenGLExtension_INTEL_parallel_arrays();
- bool initializeOpenGLFunctions() Q_DECL_FINAL;
+ bool initializeOpenGLFunctions() final;
void glTexCoordPointervINTEL(GLint size, GLenum type, const GLvoid* *pointer);
void glColorPointervINTEL(GLint size, GLenum type, const GLvoid* *pointer);
@@ -12174,7 +12174,7 @@ class QOpenGLExtension_KHR_debug : public QAbstractOpenGLExtension
public:
QOpenGLExtension_KHR_debug();
- bool initializeOpenGLFunctions() Q_DECL_FINAL;
+ bool initializeOpenGLFunctions() final;
void glGetObjectPtrLabel(const void *ptr, GLsizei bufSize, GLsizei *length, GLchar *label);
void glObjectPtrLabel(const void *ptr, GLsizei length, const GLchar *label);
@@ -12262,7 +12262,7 @@ class QOpenGLExtension_MESA_resize_buffers : public QAbstractOpenGLExtension
public:
QOpenGLExtension_MESA_resize_buffers();
- bool initializeOpenGLFunctions() Q_DECL_FINAL;
+ bool initializeOpenGLFunctions() final;
void glResizeBuffersMESA();
@@ -12310,7 +12310,7 @@ class QOpenGLExtension_MESA_window_pos : public QAbstractOpenGLExtension
public:
QOpenGLExtension_MESA_window_pos();
- bool initializeOpenGLFunctions() Q_DECL_FINAL;
+ bool initializeOpenGLFunctions() final;
void glWindowPos4svMESA(const GLshort *v);
void glWindowPos4sMESA(GLshort x, GLshort y, GLshort z, GLshort w);
@@ -12508,7 +12508,7 @@ class QOpenGLExtension_NV_bindless_texture : public QAbstractOpenGLExtension
public:
QOpenGLExtension_NV_bindless_texture();
- bool initializeOpenGLFunctions() Q_DECL_FINAL;
+ bool initializeOpenGLFunctions() final;
GLboolean glIsImageHandleResidentNV(GLuint64 handle);
GLboolean glIsTextureHandleResidentNV(GLuint64 handle);
@@ -12618,7 +12618,7 @@ class QOpenGLExtension_NV_conditional_render : public QAbstractOpenGLExtension
public:
QOpenGLExtension_NV_conditional_render();
- bool initializeOpenGLFunctions() Q_DECL_FINAL;
+ bool initializeOpenGLFunctions() final;
void glEndConditionalRenderNV();
void glBeginConditionalRenderNV(GLuint id, GLenum mode);
@@ -12650,7 +12650,7 @@ class QOpenGLExtension_NV_copy_image : public QAbstractOpenGLExtension
public:
QOpenGLExtension_NV_copy_image();
- bool initializeOpenGLFunctions() Q_DECL_FINAL;
+ bool initializeOpenGLFunctions() final;
void glCopyImageSubDataNV(GLuint srcName, GLenum srcTarget, GLint srcLevel, GLint srcX, GLint srcY, GLint srcZ, GLuint dstName, GLenum dstTarget, GLint dstLevel, GLint dstX, GLint dstY, GLint dstZ, GLsizei width, GLsizei height, GLsizei depth);
@@ -12677,7 +12677,7 @@ class QOpenGLExtension_NV_depth_buffer_float : public QAbstractOpenGLExtension
public:
QOpenGLExtension_NV_depth_buffer_float();
- bool initializeOpenGLFunctions() Q_DECL_FINAL;
+ bool initializeOpenGLFunctions() final;
void glDepthBoundsdNV(GLdouble zmin, GLdouble zmax);
void glClearDepthdNV(GLdouble depth);
@@ -12724,7 +12724,7 @@ class QOpenGLExtension_NV_evaluators : public QAbstractOpenGLExtension
public:
QOpenGLExtension_NV_evaluators();
- bool initializeOpenGLFunctions() Q_DECL_FINAL;
+ bool initializeOpenGLFunctions() final;
void glEvalMapsNV(GLenum target, GLenum mode);
void glGetMapAttribParameterfvNV(GLenum target, GLuint index, GLenum pname, GLfloat *params);
@@ -12807,7 +12807,7 @@ class QOpenGLExtension_NV_explicit_multisample : public QAbstractOpenGLExtension
public:
QOpenGLExtension_NV_explicit_multisample();
- bool initializeOpenGLFunctions() Q_DECL_FINAL;
+ bool initializeOpenGLFunctions() final;
void glTexRenderbufferNV(GLenum target, GLuint renderbuffer);
void glSampleMaskIndexedNV(GLuint index, GLbitfield mask);
@@ -12852,7 +12852,7 @@ class QOpenGLExtension_NV_fence : public QAbstractOpenGLExtension
public:
QOpenGLExtension_NV_fence();
- bool initializeOpenGLFunctions() Q_DECL_FINAL;
+ bool initializeOpenGLFunctions() final;
void glSetFenceNV(GLuint fence, GLenum condition);
void glFinishFenceNV(GLuint fence);
@@ -12924,7 +12924,7 @@ class QOpenGLExtension_NV_fragment_program : public QAbstractOpenGLExtension
public:
QOpenGLExtension_NV_fragment_program();
- bool initializeOpenGLFunctions() Q_DECL_FINAL;
+ bool initializeOpenGLFunctions() final;
void glGetProgramNamedParameterdvNV(GLuint id, GLsizei len, const GLubyte *name, GLdouble *params);
void glGetProgramNamedParameterfvNV(GLuint id, GLsizei len, const GLubyte *name, GLfloat *params);
@@ -12984,7 +12984,7 @@ class QOpenGLExtension_NV_framebuffer_multisample_coverage : public QAbstractOpe
public:
QOpenGLExtension_NV_framebuffer_multisample_coverage();
- bool initializeOpenGLFunctions() Q_DECL_FINAL;
+ bool initializeOpenGLFunctions() final;
void glRenderbufferStorageMultisampleCoverageNV(GLenum target, GLsizei coverageSamples, GLsizei colorSamples, GLenum internalformat, GLsizei width, GLsizei height);
@@ -13012,7 +13012,7 @@ class QOpenGLExtension_NV_geometry_program4 : public QAbstractOpenGLExtension
public:
QOpenGLExtension_NV_geometry_program4();
- bool initializeOpenGLFunctions() Q_DECL_FINAL;
+ bool initializeOpenGLFunctions() final;
void glFramebufferTextureFaceEXT(GLenum target, GLenum attachment, GLuint texture, GLint level, GLenum face);
void glFramebufferTextureLayerEXT(GLenum target, GLenum attachment, GLuint texture, GLint level, GLint layer);
@@ -13073,7 +13073,7 @@ class QOpenGLExtension_NV_gpu_program4 : public QAbstractOpenGLExtension
public:
QOpenGLExtension_NV_gpu_program4();
- bool initializeOpenGLFunctions() Q_DECL_FINAL;
+ bool initializeOpenGLFunctions() final;
void glGetProgramEnvParameterIuivNV(GLenum target, GLuint index, GLuint *params);
void glGetProgramEnvParameterIivNV(GLenum target, GLuint index, GLint *params);
@@ -13204,7 +13204,7 @@ class QOpenGLExtension_NV_gpu_program5 : public QAbstractOpenGLExtension
public:
QOpenGLExtension_NV_gpu_program5();
- bool initializeOpenGLFunctions() Q_DECL_FINAL;
+ bool initializeOpenGLFunctions() final;
void glGetProgramSubroutineParameteruivNV(GLenum target, GLuint index, GLuint *param);
void glProgramSubroutineParametersuivNV(GLenum target, GLsizei count, const GLuint *params);
@@ -13268,7 +13268,7 @@ class QOpenGLExtension_NV_gpu_shader5 : public QAbstractOpenGLExtension
public:
QOpenGLExtension_NV_gpu_shader5();
- bool initializeOpenGLFunctions() Q_DECL_FINAL;
+ bool initializeOpenGLFunctions() final;
void glProgramUniform4ui64vNV(GLuint program, GLint location, GLsizei count, const GLuint64EXT *value);
void glProgramUniform3ui64vNV(GLuint program, GLint location, GLsizei count, const GLuint64EXT *value);
@@ -13562,7 +13562,7 @@ class QOpenGLExtension_NV_half_float : public QAbstractOpenGLExtension
public:
QOpenGLExtension_NV_half_float();
- bool initializeOpenGLFunctions() Q_DECL_FINAL;
+ bool initializeOpenGLFunctions() final;
void glVertexAttribs4hvNV(GLuint index, GLsizei n, const GLhalfNV *v);
void glVertexAttribs3hvNV(GLuint index, GLsizei n, const GLhalfNV *v);
@@ -13908,7 +13908,7 @@ class QOpenGLExtension_NV_occlusion_query : public QAbstractOpenGLExtension
public:
QOpenGLExtension_NV_occlusion_query();
- bool initializeOpenGLFunctions() Q_DECL_FINAL;
+ bool initializeOpenGLFunctions() final;
void glGetOcclusionQueryuivNV(GLuint id, GLenum pname, GLuint *params);
void glGetOcclusionQueryivNV(GLuint id, GLenum pname, GLint *params);
@@ -13977,7 +13977,7 @@ class QOpenGLExtension_NV_parameter_buffer_object : public QAbstractOpenGLExtens
public:
QOpenGLExtension_NV_parameter_buffer_object();
- bool initializeOpenGLFunctions() Q_DECL_FINAL;
+ bool initializeOpenGLFunctions() final;
void glProgramBufferParametersIuivNV(GLenum target, GLuint buffer, GLuint index, GLsizei count, const GLuint *params);
void glProgramBufferParametersIivNV(GLenum target, GLuint buffer, GLuint index, GLsizei count, const GLint *params);
@@ -14064,7 +14064,7 @@ class QOpenGLExtension_NV_path_rendering : public QAbstractOpenGLExtension
public:
QOpenGLExtension_NV_path_rendering();
- bool initializeOpenGLFunctions() Q_DECL_FINAL;
+ bool initializeOpenGLFunctions() final;
GLboolean glPointAlongPathNV(GLuint path, GLsizei startSegment, GLsizei numSegments, GLfloat distance, GLfloat *x, GLfloat *y, GLfloat *tangentX, GLfloat *tangentY);
GLfloat glGetPathLengthNV(GLuint path, GLsizei startSegment, GLsizei numSegments);
@@ -14426,7 +14426,7 @@ class QOpenGLExtension_NV_pixel_data_range : public QAbstractOpenGLExtension
public:
QOpenGLExtension_NV_pixel_data_range();
- bool initializeOpenGLFunctions() Q_DECL_FINAL;
+ bool initializeOpenGLFunctions() final;
void glFlushPixelDataRangeNV(GLenum target);
void glPixelDataRangeNV(GLenum target, GLsizei length, const GLvoid *pointer);
@@ -14459,7 +14459,7 @@ class QOpenGLExtension_NV_point_sprite : public QAbstractOpenGLExtension
public:
QOpenGLExtension_NV_point_sprite();
- bool initializeOpenGLFunctions() Q_DECL_FINAL;
+ bool initializeOpenGLFunctions() final;
void glPointParameterivNV(GLenum pname, const GLint *params);
void glPointParameteriNV(GLenum pname, GLint param);
@@ -14496,7 +14496,7 @@ class QOpenGLExtension_NV_present_video : public QAbstractOpenGLExtension
public:
QOpenGLExtension_NV_present_video();
- bool initializeOpenGLFunctions() Q_DECL_FINAL;
+ bool initializeOpenGLFunctions() final;
void glGetVideoui64vNV(GLuint video_slot, GLenum pname, GLuint64EXT *params);
void glGetVideoi64vNV(GLuint video_slot, GLenum pname, GLint64EXT *params);
@@ -14557,7 +14557,7 @@ class QOpenGLExtension_NV_primitive_restart : public QAbstractOpenGLExtension
public:
QOpenGLExtension_NV_primitive_restart();
- bool initializeOpenGLFunctions() Q_DECL_FINAL;
+ bool initializeOpenGLFunctions() final;
void glPrimitiveRestartIndexNV(GLuint index);
void glPrimitiveRestartNV();
@@ -14601,7 +14601,7 @@ class QOpenGLExtension_NV_register_combiners : public QAbstractOpenGLExtension
public:
QOpenGLExtension_NV_register_combiners();
- bool initializeOpenGLFunctions() Q_DECL_FINAL;
+ bool initializeOpenGLFunctions() final;
void glGetFinalCombinerInputParameterivNV(GLenum variable, GLenum pname, GLint *params);
void glGetFinalCombinerInputParameterfvNV(GLenum variable, GLenum pname, GLfloat *params);
@@ -14711,7 +14711,7 @@ class QOpenGLExtension_NV_register_combiners2 : public QAbstractOpenGLExtension
public:
QOpenGLExtension_NV_register_combiners2();
- bool initializeOpenGLFunctions() Q_DECL_FINAL;
+ bool initializeOpenGLFunctions() final;
void glGetCombinerStageParameterfvNV(GLenum stage, GLenum pname, GLfloat *params);
void glCombinerStageParameterfvNV(GLenum stage, GLenum pname, const GLfloat *params);
@@ -14756,7 +14756,7 @@ class QOpenGLExtension_NV_shader_buffer_load : public QAbstractOpenGLExtension
public:
QOpenGLExtension_NV_shader_buffer_load();
- bool initializeOpenGLFunctions() Q_DECL_FINAL;
+ bool initializeOpenGLFunctions() final;
void glProgramUniformui64vNV(GLuint program, GLint location, GLsizei count, const GLuint64EXT *value);
void glProgramUniformui64NV(GLuint program, GLint location, GLuint64EXT value);
@@ -14872,7 +14872,7 @@ class QOpenGLExtension_NV_texture_barrier : public QAbstractOpenGLExtension
public:
QOpenGLExtension_NV_texture_barrier();
- bool initializeOpenGLFunctions() Q_DECL_FINAL;
+ bool initializeOpenGLFunctions() final;
void glTextureBarrierNV();
@@ -14902,7 +14902,7 @@ class QOpenGLExtension_NV_texture_multisample : public QAbstractOpenGLExtension
public:
QOpenGLExtension_NV_texture_multisample();
- bool initializeOpenGLFunctions() Q_DECL_FINAL;
+ bool initializeOpenGLFunctions() final;
void glTextureImage3DMultisampleCoverageNV(GLuint texture, GLenum target, GLsizei coverageSamples, GLsizei colorSamples, GLint internalFormat, GLsizei width, GLsizei height, GLsizei depth, GLboolean fixedSampleLocations);
void glTextureImage2DMultisampleCoverageNV(GLuint texture, GLenum target, GLsizei coverageSamples, GLsizei colorSamples, GLint internalFormat, GLsizei width, GLsizei height, GLboolean fixedSampleLocations);
@@ -14973,7 +14973,7 @@ class QOpenGLExtension_NV_transform_feedback : public QAbstractOpenGLExtension
public:
QOpenGLExtension_NV_transform_feedback();
- bool initializeOpenGLFunctions() Q_DECL_FINAL;
+ bool initializeOpenGLFunctions() final;
void glTransformFeedbackStreamAttribsNV(GLsizei count, const GLint *attribs, GLsizei nbuffers, const GLint *bufstreams, GLenum bufferMode);
void glGetTransformFeedbackVaryingNV(GLuint program, GLuint index, GLint *location);
@@ -15081,7 +15081,7 @@ class QOpenGLExtension_NV_transform_feedback2 : public QAbstractOpenGLExtension
public:
QOpenGLExtension_NV_transform_feedback2();
- bool initializeOpenGLFunctions() Q_DECL_FINAL;
+ bool initializeOpenGLFunctions() final;
void glDrawTransformFeedbackNV(GLenum mode, GLuint id);
void glResumeTransformFeedbackNV();
@@ -15157,7 +15157,7 @@ class QOpenGLExtension_NV_vdpau_interop : public QAbstractOpenGLExtension
public:
QOpenGLExtension_NV_vdpau_interop();
- bool initializeOpenGLFunctions() Q_DECL_FINAL;
+ bool initializeOpenGLFunctions() final;
void glVDPAUUnmapSurfacesNV(GLsizei numSurface, const GLvdpauSurfaceNV *surfaces);
void glVDPAUMapSurfacesNV(GLsizei numSurfaces, const GLvdpauSurfaceNV *surfaces);
@@ -15246,7 +15246,7 @@ class QOpenGLExtension_NV_vertex_array_range : public QAbstractOpenGLExtension
public:
QOpenGLExtension_NV_vertex_array_range();
- bool initializeOpenGLFunctions() Q_DECL_FINAL;
+ bool initializeOpenGLFunctions() final;
void glVertexArrayRangeNV(GLsizei length, const GLvoid *pointer);
void glFlushVertexArrayRangeNV();
@@ -15296,7 +15296,7 @@ class QOpenGLExtension_NV_vertex_attrib_integer_64bit : public QAbstractOpenGLEx
public:
QOpenGLExtension_NV_vertex_attrib_integer_64bit();
- bool initializeOpenGLFunctions() Q_DECL_FINAL;
+ bool initializeOpenGLFunctions() final;
void glVertexAttribLFormatNV(GLuint index, GLint size, GLenum type, GLsizei stride);
void glGetVertexAttribLui64vNV(GLuint index, GLenum pname, GLuint64EXT *params);
@@ -15458,7 +15458,7 @@ class QOpenGLExtension_NV_vertex_buffer_unified_memory : public QAbstractOpenGLE
public:
QOpenGLExtension_NV_vertex_buffer_unified_memory();
- bool initializeOpenGLFunctions() Q_DECL_FINAL;
+ bool initializeOpenGLFunctions() final;
void glGetIntegerui64i_vNV(GLenum value, GLuint index, GLuint64EXT *result);
void glVertexAttribIFormatNV(GLuint index, GLint size, GLenum type, GLsizei stride);
@@ -15623,7 +15623,7 @@ class QOpenGLExtension_NV_vertex_program : public QAbstractOpenGLExtension
public:
QOpenGLExtension_NV_vertex_program();
- bool initializeOpenGLFunctions() Q_DECL_FINAL;
+ bool initializeOpenGLFunctions() final;
void glVertexAttribs4ubvNV(GLuint index, GLsizei count, const GLubyte *v);
void glVertexAttribs4svNV(GLuint index, GLsizei count, const GLshort *v);
@@ -16111,7 +16111,7 @@ class QOpenGLExtension_NV_vertex_program4 : public QAbstractOpenGLExtension
public:
QOpenGLExtension_NV_vertex_program4();
- bool initializeOpenGLFunctions() Q_DECL_FINAL;
+ bool initializeOpenGLFunctions() final;
void glGetVertexAttribIuivEXT(GLuint index, GLenum pname, GLuint *params);
void glGetVertexAttribIivEXT(GLuint index, GLenum pname, GLint *params);
@@ -16301,7 +16301,7 @@ class QOpenGLExtension_NV_video_capture : public QAbstractOpenGLExtension
public:
QOpenGLExtension_NV_video_capture();
- bool initializeOpenGLFunctions() Q_DECL_FINAL;
+ bool initializeOpenGLFunctions() final;
void glVideoCaptureStreamParameterdvNV(GLuint video_capture_slot, GLuint stream, GLenum pname, const GLdouble *params);
void glVideoCaptureStreamParameterfvNV(GLuint video_capture_slot, GLuint stream, GLenum pname, const GLfloat *params);
@@ -16403,7 +16403,7 @@ class QOpenGLExtension_PGI_misc_hints : public QAbstractOpenGLExtension
public:
QOpenGLExtension_PGI_misc_hints();
- bool initializeOpenGLFunctions() Q_DECL_FINAL;
+ bool initializeOpenGLFunctions() final;
void glHintPGI(GLenum target, GLint mode);
@@ -16429,7 +16429,7 @@ class QOpenGLExtension_SGIS_detail_texture : public QAbstractOpenGLExtension
public:
QOpenGLExtension_SGIS_detail_texture();
- bool initializeOpenGLFunctions() Q_DECL_FINAL;
+ bool initializeOpenGLFunctions() final;
void glGetDetailTexFuncSGIS(GLenum target, GLfloat *points);
void glDetailTexFuncSGIS(GLenum target, GLsizei n, const GLfloat *points);
@@ -16462,7 +16462,7 @@ class QOpenGLExtension_SGIS_fog_function : public QAbstractOpenGLExtension
public:
QOpenGLExtension_SGIS_fog_function();
- bool initializeOpenGLFunctions() Q_DECL_FINAL;
+ bool initializeOpenGLFunctions() final;
void glGetFogFuncSGIS(GLfloat *points);
void glFogFuncSGIS(GLsizei n, const GLfloat *points);
@@ -16495,7 +16495,7 @@ class QOpenGLExtension_SGIS_multisample : public QAbstractOpenGLExtension
public:
QOpenGLExtension_SGIS_multisample();
- bool initializeOpenGLFunctions() Q_DECL_FINAL;
+ bool initializeOpenGLFunctions() final;
void glSamplePatternSGIS(GLenum pattern);
void glSampleMaskSGIS(GLclampf value, GLboolean invert);
@@ -16532,7 +16532,7 @@ class QOpenGLExtension_SGIS_pixel_texture : public QAbstractOpenGLExtension
public:
QOpenGLExtension_SGIS_pixel_texture();
- bool initializeOpenGLFunctions() Q_DECL_FINAL;
+ bool initializeOpenGLFunctions() final;
void glGetPixelTexGenParameterfvSGIS(GLenum pname, GLfloat *params);
void glGetPixelTexGenParameterivSGIS(GLenum pname, GLint *params);
@@ -16593,7 +16593,7 @@ class QOpenGLExtension_SGIS_point_parameters : public QAbstractOpenGLExtension
public:
QOpenGLExtension_SGIS_point_parameters();
- bool initializeOpenGLFunctions() Q_DECL_FINAL;
+ bool initializeOpenGLFunctions() final;
void glPointParameterfvSGIS(GLenum pname, const GLfloat *params);
void glPointParameterfSGIS(GLenum pname, GLfloat param);
@@ -16626,7 +16626,7 @@ class QOpenGLExtension_SGIS_sharpen_texture : public QAbstractOpenGLExtension
public:
QOpenGLExtension_SGIS_sharpen_texture();
- bool initializeOpenGLFunctions() Q_DECL_FINAL;
+ bool initializeOpenGLFunctions() final;
void glGetSharpenTexFuncSGIS(GLenum target, GLfloat *points);
void glSharpenTexFuncSGIS(GLenum target, GLsizei n, const GLfloat *points);
@@ -16659,7 +16659,7 @@ class QOpenGLExtension_SGIS_texture4D : public QAbstractOpenGLExtension
public:
QOpenGLExtension_SGIS_texture4D();
- bool initializeOpenGLFunctions() Q_DECL_FINAL;
+ bool initializeOpenGLFunctions() final;
void glTexSubImage4DSGIS(GLenum target, GLint level, GLint xoffset, GLint yoffset, GLint zoffset, GLint woffset, GLsizei width, GLsizei height, GLsizei depth, GLsizei size4d, GLenum format, GLenum type, const GLvoid *pixels);
void glTexImage4DSGIS(GLenum target, GLint level, GLenum internalformat, GLsizei width, GLsizei height, GLsizei depth, GLsizei size4d, GLint border, GLenum format, GLenum type, const GLvoid *pixels);
@@ -16691,7 +16691,7 @@ class QOpenGLExtension_SGIS_texture_color_mask : public QAbstractOpenGLExtension
public:
QOpenGLExtension_SGIS_texture_color_mask();
- bool initializeOpenGLFunctions() Q_DECL_FINAL;
+ bool initializeOpenGLFunctions() final;
void glTextureColorMaskSGIS(GLboolean red, GLboolean green, GLboolean blue, GLboolean alpha);
@@ -16717,7 +16717,7 @@ class QOpenGLExtension_SGIS_texture_filter4 : public QAbstractOpenGLExtension
public:
QOpenGLExtension_SGIS_texture_filter4();
- bool initializeOpenGLFunctions() Q_DECL_FINAL;
+ bool initializeOpenGLFunctions() final;
void glTexFilterFuncSGIS(GLenum target, GLenum filter, GLsizei n, const GLfloat *weights);
void glGetTexFilterFuncSGIS(GLenum target, GLenum filter, GLfloat *weights);
@@ -16754,7 +16754,7 @@ class QOpenGLExtension_SGIX_async : public QAbstractOpenGLExtension
public:
QOpenGLExtension_SGIX_async();
- bool initializeOpenGLFunctions() Q_DECL_FINAL;
+ bool initializeOpenGLFunctions() final;
GLboolean glIsAsyncMarkerSGIX(GLuint marker);
void glDeleteAsyncMarkersSGIX(GLuint marker, GLsizei range);
@@ -16814,7 +16814,7 @@ class QOpenGLExtension_SGIX_flush_raster : public QAbstractOpenGLExtension
public:
QOpenGLExtension_SGIX_flush_raster();
- bool initializeOpenGLFunctions() Q_DECL_FINAL;
+ bool initializeOpenGLFunctions() final;
void glFlushRasterSGIX();
@@ -16856,7 +16856,7 @@ class QOpenGLExtension_SGIX_fragment_lighting : public QAbstractOpenGLExtension
public:
QOpenGLExtension_SGIX_fragment_lighting();
- bool initializeOpenGLFunctions() Q_DECL_FINAL;
+ bool initializeOpenGLFunctions() final;
void glLightEnviSGIX(GLenum pname, GLint param);
void glGetFragmentMaterialivSGIX(GLenum face, GLenum pname, GLint *params);
@@ -17000,7 +17000,7 @@ class QOpenGLExtension_SGIX_framezoom : public QAbstractOpenGLExtension
public:
QOpenGLExtension_SGIX_framezoom();
- bool initializeOpenGLFunctions() Q_DECL_FINAL;
+ bool initializeOpenGLFunctions() final;
void glFrameZoomSGIX(GLint factor);
@@ -17025,7 +17025,7 @@ class QOpenGLExtension_SGIX_igloo_interface : public QAbstractOpenGLExtension
public:
QOpenGLExtension_SGIX_igloo_interface();
- bool initializeOpenGLFunctions() Q_DECL_FINAL;
+ bool initializeOpenGLFunctions() final;
void glIglooInterfaceSGIX(GLenum pname, const GLvoid *params);
@@ -17055,7 +17055,7 @@ class QOpenGLExtension_SGIX_instruments : public QAbstractOpenGLExtension
public:
QOpenGLExtension_SGIX_instruments();
- bool initializeOpenGLFunctions() Q_DECL_FINAL;
+ bool initializeOpenGLFunctions() final;
void glStopInstrumentsSGIX(GLint marker);
void glStartInstrumentsSGIX();
@@ -17120,7 +17120,7 @@ class QOpenGLExtension_SGIX_list_priority : public QAbstractOpenGLExtension
public:
QOpenGLExtension_SGIX_list_priority();
- bool initializeOpenGLFunctions() Q_DECL_FINAL;
+ bool initializeOpenGLFunctions() final;
void glListParameterivSGIX(GLuint list, GLenum pname, const GLint *params);
void glListParameteriSGIX(GLuint list, GLenum pname, GLint param);
@@ -17180,7 +17180,7 @@ class QOpenGLExtension_SGIX_pixel_texture : public QAbstractOpenGLExtension
public:
QOpenGLExtension_SGIX_pixel_texture();
- bool initializeOpenGLFunctions() Q_DECL_FINAL;
+ bool initializeOpenGLFunctions() final;
void glPixelTexGenSGIX(GLenum mode);
@@ -17208,7 +17208,7 @@ class QOpenGLExtension_SGIX_polynomial_ffd : public QAbstractOpenGLExtension
public:
QOpenGLExtension_SGIX_polynomial_ffd();
- bool initializeOpenGLFunctions() Q_DECL_FINAL;
+ bool initializeOpenGLFunctions() final;
void glLoadIdentityDeformationMapSGIX(GLbitfield mask);
void glDeformSGIX(GLbitfield mask);
@@ -17254,7 +17254,7 @@ class QOpenGLExtension_SGIX_reference_plane : public QAbstractOpenGLExtension
public:
QOpenGLExtension_SGIX_reference_plane();
- bool initializeOpenGLFunctions() Q_DECL_FINAL;
+ bool initializeOpenGLFunctions() final;
void glReferencePlaneSGIX(const GLdouble *equation);
@@ -17282,7 +17282,7 @@ class QOpenGLExtension_SGIX_sprite : public QAbstractOpenGLExtension
public:
QOpenGLExtension_SGIX_sprite();
- bool initializeOpenGLFunctions() Q_DECL_FINAL;
+ bool initializeOpenGLFunctions() final;
void glSpriteParameterivSGIX(GLenum pname, const GLint *params);
void glSpriteParameteriSGIX(GLenum pname, GLint param);
@@ -17328,7 +17328,7 @@ class QOpenGLExtension_SGIX_tag_sample_buffer : public QAbstractOpenGLExtension
public:
QOpenGLExtension_SGIX_tag_sample_buffer();
- bool initializeOpenGLFunctions() Q_DECL_FINAL;
+ bool initializeOpenGLFunctions() final;
void glTagSampleBufferSGIX();
@@ -17359,7 +17359,7 @@ class QOpenGLExtension_SGI_color_table : public QAbstractOpenGLExtension
public:
QOpenGLExtension_SGI_color_table();
- bool initializeOpenGLFunctions() Q_DECL_FINAL;
+ bool initializeOpenGLFunctions() final;
void glGetColorTableParameterivSGI(GLenum target, GLenum pname, GLint *params);
void glGetColorTableParameterfvSGI(GLenum target, GLenum pname, GLfloat *params);
@@ -17426,7 +17426,7 @@ class QOpenGLExtension_SUNX_constant_data : public QAbstractOpenGLExtension
public:
QOpenGLExtension_SUNX_constant_data();
- bool initializeOpenGLFunctions() Q_DECL_FINAL;
+ bool initializeOpenGLFunctions() final;
void glFinishTextureSUNX();
@@ -17458,7 +17458,7 @@ class QOpenGLExtension_SUN_global_alpha : public QAbstractOpenGLExtension
public:
QOpenGLExtension_SUN_global_alpha();
- bool initializeOpenGLFunctions() Q_DECL_FINAL;
+ bool initializeOpenGLFunctions() final;
void glGlobalAlphaFactoruiSUN(GLuint factor);
void glGlobalAlphaFactorusSUN(GLushort factor);
@@ -17532,7 +17532,7 @@ class QOpenGLExtension_SUN_mesh_array : public QAbstractOpenGLExtension
public:
QOpenGLExtension_SUN_mesh_array();
- bool initializeOpenGLFunctions() Q_DECL_FINAL;
+ bool initializeOpenGLFunctions() final;
void glDrawMeshArraysSUN(GLenum mode, GLint first, GLsizei count, GLsizei width);
@@ -17563,7 +17563,7 @@ class QOpenGLExtension_SUN_triangle_list : public QAbstractOpenGLExtension
public:
QOpenGLExtension_SUN_triangle_list();
- bool initializeOpenGLFunctions() Q_DECL_FINAL;
+ bool initializeOpenGLFunctions() final;
void glReplacementCodePointerSUN(GLenum type, GLsizei stride, const GLvoid* *pointer);
void glReplacementCodeubvSUN(const GLubyte *code);
@@ -17669,7 +17669,7 @@ class QOpenGLExtension_SUN_vertex : public QAbstractOpenGLExtension
public:
QOpenGLExtension_SUN_vertex();
- bool initializeOpenGLFunctions() Q_DECL_FINAL;
+ bool initializeOpenGLFunctions() final;
void glReplacementCodeuiTexCoord2fColor4fNormal3fVertex3fvSUN(const GLuint *rc, const GLfloat *tc, const GLfloat *c, const GLfloat *n, const GLfloat *v);
void glReplacementCodeuiTexCoord2fColor4fNormal3fVertex3fSUN(GLuint rc, GLfloat s, GLfloat t, GLfloat r, GLfloat g, GLfloat b, GLfloat a, GLfloat nx, GLfloat ny, GLfloat nz, GLfloat x, GLfloat y, GLfloat z);
@@ -17971,7 +17971,7 @@ class QOpenGLExtension_OES_EGL_image : public QAbstractOpenGLExtension
public:
QOpenGLExtension_OES_EGL_image();
- bool initializeOpenGLFunctions() Q_DECL_FINAL;
+ bool initializeOpenGLFunctions() final;
void glEGLImageTargetTexture2DOES(GLenum target, GLeglImageOES image);
void glEGLImageTargetRenderbufferStorageOES(GLenum target, GLeglImageOES image);
@@ -18004,7 +18004,7 @@ class QOpenGLExtension_OES_get_program_binary : public QAbstractOpenGLExtension
public:
QOpenGLExtension_OES_get_program_binary();
- bool initializeOpenGLFunctions() Q_DECL_FINAL;
+ bool initializeOpenGLFunctions() final;
void glGetProgramBinaryOES(GLuint program, GLsizei bufSize, GLsizei *length, GLenum *binaryFormat, GLvoid *binary);
void glProgramBinaryOES(GLuint program, GLenum binaryFormat, const GLvoid *binary, GLint length);
@@ -18038,7 +18038,7 @@ class QOpenGLExtension_OES_mapbuffer : public QAbstractOpenGLExtension
public:
QOpenGLExtension_OES_mapbuffer();
- bool initializeOpenGLFunctions() Q_DECL_FINAL;
+ bool initializeOpenGLFunctions() final;
void* glMapBufferOES(GLenum target, GLenum access);
GLboolean glUnmapBufferOES(GLenum target);
@@ -18082,7 +18082,7 @@ class QOpenGLExtension_OES_texture_3D : public QAbstractOpenGLExtension
public:
QOpenGLExtension_OES_texture_3D();
- bool initializeOpenGLFunctions() Q_DECL_FINAL;
+ bool initializeOpenGLFunctions() final;
void glTexImage3DOES(GLenum target, GLint level, GLenum internalformat, GLsizei width, GLsizei height, GLsizei depth, GLint border, GLenum format, GLenum type, const GLvoid* pixels);
void glTexSubImage3DOES(GLenum target, GLint level, GLint xoffset, GLint yoffset, GLint zoffset, GLsizei width, GLsizei height, GLsizei depth, GLenum format, GLenum type, const GLvoid* pixels);
@@ -18145,7 +18145,7 @@ class QOpenGLExtension_OES_vertex_array_object : public QAbstractOpenGLExtension
public:
QOpenGLExtension_OES_vertex_array_object();
- bool initializeOpenGLFunctions() Q_DECL_FINAL;
+ bool initializeOpenGLFunctions() final;
void glBindVertexArrayOES(GLuint array);
void glDeleteVertexArraysOES(GLsizei n, const GLuint *arrays);
@@ -18201,7 +18201,7 @@ class QOpenGLExtension_AMD_performance_monitor : public QAbstractOpenGLExtension
public:
QOpenGLExtension_AMD_performance_monitor();
- bool initializeOpenGLFunctions() Q_DECL_FINAL;
+ bool initializeOpenGLFunctions() final;
void glGetPerfMonitorGroupsAMD(GLint *numGroups, GLsizei groupsSize, GLuint *groups);
void glGetPerfMonitorCountersAMD(GLuint group, GLint *numCounters, GLint *maxActiveCounters, GLsizei counterSize, GLuint *counters);
@@ -18296,7 +18296,7 @@ class QOpenGLExtension_ANGLE_framebuffer_blit : public QAbstractOpenGLExtension
public:
QOpenGLExtension_ANGLE_framebuffer_blit();
- bool initializeOpenGLFunctions() Q_DECL_FINAL;
+ bool initializeOpenGLFunctions() final;
void glBlitFramebufferANGLE(GLint srcX0, GLint srcY0, GLint srcX1, GLint srcY1, GLint dstX0, GLint dstY0, GLint dstX1, GLint dstY1, GLbitfield mask, GLenum filter);
@@ -18321,7 +18321,7 @@ class QOpenGLExtension_ANGLE_framebuffer_multisample : public QAbstractOpenGLExt
public:
QOpenGLExtension_ANGLE_framebuffer_multisample();
- bool initializeOpenGLFunctions() Q_DECL_FINAL;
+ bool initializeOpenGLFunctions() final;
void glRenderbufferStorageMultisampleANGLE(GLenum target, GLsizei samples, GLenum internalformat, GLsizei width, GLsizei height);
@@ -18348,7 +18348,7 @@ class QOpenGLExtension_ANGLE_instanced_arrays : public QAbstractOpenGLExtension
public:
QOpenGLExtension_ANGLE_instanced_arrays();
- bool initializeOpenGLFunctions() Q_DECL_FINAL;
+ bool initializeOpenGLFunctions() final;
void glDrawArraysInstancedANGLE(GLenum mode, GLint first, GLsizei count, GLsizei primcount);
void glDrawElementsInstancedANGLE(GLenum mode, GLsizei count, GLenum type, const void *indices, GLsizei primcount);
@@ -18387,7 +18387,7 @@ class QOpenGLExtension_ANGLE_translated_shader_source : public QAbstractOpenGLEx
public:
QOpenGLExtension_ANGLE_translated_shader_source();
- bool initializeOpenGLFunctions() Q_DECL_FINAL;
+ bool initializeOpenGLFunctions() final;
void glGetTranslatedShaderSourceANGLE(GLuint shader, GLsizei bufsize, GLsizei *length, GLchar *source);
@@ -18413,7 +18413,7 @@ class QOpenGLExtension_APPLE_framebuffer_multisample : public QAbstractOpenGLExt
public:
QOpenGLExtension_APPLE_framebuffer_multisample();
- bool initializeOpenGLFunctions() Q_DECL_FINAL;
+ bool initializeOpenGLFunctions() final;
void glRenderbufferStorageMultisampleAPPLE(GLenum target, GLsizei samples, GLenum internalformat, GLsizei width, GLsizei height);
void glResolveMultisampleFramebufferAPPLE(void);
@@ -18446,7 +18446,7 @@ class QOpenGLExtension_EXT_debug_label : public QAbstractOpenGLExtension
public:
QOpenGLExtension_EXT_debug_label();
- bool initializeOpenGLFunctions() Q_DECL_FINAL;
+ bool initializeOpenGLFunctions() final;
void glLabelObjectEXT(GLenum type, GLuint object, GLsizei length, const GLchar *label);
void glGetObjectLabelEXT(GLenum type, GLuint object, GLsizei bufSize, GLsizei *length, GLchar *label);
@@ -18480,7 +18480,7 @@ class QOpenGLExtension_EXT_debug_marker : public QAbstractOpenGLExtension
public:
QOpenGLExtension_EXT_debug_marker();
- bool initializeOpenGLFunctions() Q_DECL_FINAL;
+ bool initializeOpenGLFunctions() final;
void glInsertEventMarkerEXT(GLsizei length, const GLchar *marker);
void glPushGroupMarkerEXT(GLsizei length, const GLchar *marker);
@@ -18519,7 +18519,7 @@ class QOpenGLExtension_EXT_discard_framebuffer : public QAbstractOpenGLExtension
public:
QOpenGLExtension_EXT_discard_framebuffer();
- bool initializeOpenGLFunctions() Q_DECL_FINAL;
+ bool initializeOpenGLFunctions() final;
void glDiscardFramebufferEXT(GLenum target, GLsizei numAttachments, const GLenum *attachments);
@@ -18545,7 +18545,7 @@ class QOpenGLExtension_EXT_multisampled_render_to_texture : public QAbstractOpen
public:
QOpenGLExtension_EXT_multisampled_render_to_texture();
- bool initializeOpenGLFunctions() Q_DECL_FINAL;
+ bool initializeOpenGLFunctions() final;
void glRenderbufferStorageMultisampleEXT(GLenum target, GLsizei samples, GLenum internalformat, GLsizei width, GLsizei height);
void glFramebufferTexture2DMultisampleEXT(GLenum target, GLenum attachment, GLenum textarget, GLuint texture, GLint level, GLsizei samples);
@@ -18578,7 +18578,7 @@ class QOpenGLExtension_EXT_multi_draw_arrays : public QAbstractOpenGLExtension
public:
QOpenGLExtension_EXT_multi_draw_arrays();
- bool initializeOpenGLFunctions() Q_DECL_FINAL;
+ bool initializeOpenGLFunctions() final;
void glMultiDrawArraysEXT(GLenum mode, GLint *first, GLsizei *count, GLsizei primcount);
void glMultiDrawElementsEXT(GLenum mode, const GLsizei *count, GLenum type, const GLvoid* *indices, GLsizei primcount);
@@ -18616,7 +18616,7 @@ class QOpenGLExtension_EXT_occlusion_query_boolean : public QAbstractOpenGLExten
public:
QOpenGLExtension_EXT_occlusion_query_boolean();
- bool initializeOpenGLFunctions() Q_DECL_FINAL;
+ bool initializeOpenGLFunctions() final;
void glGenQueriesEXT(GLsizei n, GLuint *ids);
void glDeleteQueriesEXT(GLsizei n, const GLuint *ids);
@@ -18686,7 +18686,7 @@ class QOpenGLExtension_EXT_robustness : public QAbstractOpenGLExtension
public:
QOpenGLExtension_EXT_robustness();
- bool initializeOpenGLFunctions() Q_DECL_FINAL;
+ bool initializeOpenGLFunctions() final;
GLenum glGetGraphicsResetStatusEXT(void);
void glReadnPixelsEXT(GLint x, GLint y, GLsizei width, GLsizei height, GLenum format, GLenum type, GLsizei bufSize, void *data);
@@ -18761,7 +18761,7 @@ class QOpenGLExtension_EXT_separate_shader_objects : public QAbstractOpenGLExten
public:
QOpenGLExtension_EXT_separate_shader_objects();
- bool initializeOpenGLFunctions() Q_DECL_FINAL;
+ bool initializeOpenGLFunctions() final;
void glUseProgramStagesEXT(GLuint pipeline, GLbitfield stages, GLuint program);
void glActiveShaderProgramEXT(GLuint pipeline, GLuint program);
@@ -18994,7 +18994,7 @@ class QOpenGLExtension_EXT_texture_storage : public QAbstractOpenGLExtension
public:
QOpenGLExtension_EXT_texture_storage();
- bool initializeOpenGLFunctions() Q_DECL_FINAL;
+ bool initializeOpenGLFunctions() final;
void glTexStorage1DEXT(GLenum target, GLsizei levels, GLenum internalformat, GLsizei width);
void glTexStorage2DEXT(GLenum target, GLsizei levels, GLenum internalformat, GLsizei width, GLsizei height);
@@ -19055,7 +19055,7 @@ class QOpenGLExtension_IMG_multisampled_render_to_texture : public QAbstractOpen
public:
QOpenGLExtension_IMG_multisampled_render_to_texture();
- bool initializeOpenGLFunctions() Q_DECL_FINAL;
+ bool initializeOpenGLFunctions() final;
void glRenderbufferStorageMultisampleIMG(GLenum target, GLsizei samples, GLenum internalformat, GLsizei width, GLsizei height);
void glFramebufferTexture2DMultisampleIMG(GLenum target, GLenum attachment, GLenum textarget, GLuint texture, GLint level, GLsizei samples);
@@ -19088,7 +19088,7 @@ class QOpenGLExtension_NV_coverage_sample : public QAbstractOpenGLExtension
public:
QOpenGLExtension_NV_coverage_sample();
- bool initializeOpenGLFunctions() Q_DECL_FINAL;
+ bool initializeOpenGLFunctions() final;
void glCoverageMaskNV(GLboolean mask);
void glCoverageOperationNV(GLenum operation);
@@ -19120,7 +19120,7 @@ class QOpenGLExtension_NV_draw_buffers : public QAbstractOpenGLExtension
public:
QOpenGLExtension_NV_draw_buffers();
- bool initializeOpenGLFunctions() Q_DECL_FINAL;
+ bool initializeOpenGLFunctions() final;
void glDrawBuffersNV(GLsizei n, const GLenum *bufs);
@@ -19151,7 +19151,7 @@ class QOpenGLExtension_NV_fence : public QAbstractOpenGLExtension
public:
QOpenGLExtension_NV_fence();
- bool initializeOpenGLFunctions() Q_DECL_FINAL;
+ bool initializeOpenGLFunctions() final;
void glDeleteFencesNV(GLsizei n, const GLuint *fences);
void glGenFencesNV(GLsizei n, GLuint *fences);
@@ -19218,7 +19218,7 @@ class QOpenGLExtension_NV_read_buffer : public QAbstractOpenGLExtension
public:
QOpenGLExtension_NV_read_buffer();
- bool initializeOpenGLFunctions() Q_DECL_FINAL;
+ bool initializeOpenGLFunctions() final;
void glReadBufferNV(GLenum mode);
@@ -19243,7 +19243,7 @@ class QOpenGLExtension_QCOM_alpha_test : public QAbstractOpenGLExtension
public:
QOpenGLExtension_QCOM_alpha_test();
- bool initializeOpenGLFunctions() Q_DECL_FINAL;
+ bool initializeOpenGLFunctions() final;
void glAlphaFuncQCOM(GLenum func, GLclampf ref);
@@ -19271,7 +19271,7 @@ class QOpenGLExtension_QCOM_driver_control : public QAbstractOpenGLExtension
public:
QOpenGLExtension_QCOM_driver_control();
- bool initializeOpenGLFunctions() Q_DECL_FINAL;
+ bool initializeOpenGLFunctions() final;
void glGetDriverControlsQCOM(GLint *num, GLsizei size, GLuint *driverControls);
void glGetDriverControlStringQCOM(GLuint driverControl, GLsizei bufSize, GLsizei *length, GLchar *driverControlString);
@@ -19324,7 +19324,7 @@ class QOpenGLExtension_QCOM_extended_get : public QAbstractOpenGLExtension
public:
QOpenGLExtension_QCOM_extended_get();
- bool initializeOpenGLFunctions() Q_DECL_FINAL;
+ bool initializeOpenGLFunctions() final;
void glExtGetTexturesQCOM(GLuint *textures, GLint maxTextures, GLint *numTextures);
void glExtGetBuffersQCOM(GLuint *buffers, GLint maxBuffers, GLint *numBuffers);
@@ -19401,7 +19401,7 @@ class QOpenGLExtension_QCOM_extended_get2 : public QAbstractOpenGLExtension
public:
QOpenGLExtension_QCOM_extended_get2();
- bool initializeOpenGLFunctions() Q_DECL_FINAL;
+ bool initializeOpenGLFunctions() final;
void glExtGetShadersQCOM(GLuint *shaders, GLint maxShaders, GLint *numShaders);
void glExtGetProgramsQCOM(GLuint *programs, GLint maxPrograms, GLint *numPrograms);
@@ -19448,7 +19448,7 @@ class QOpenGLExtension_QCOM_tiled_rendering : public QAbstractOpenGLExtension
public:
QOpenGLExtension_QCOM_tiled_rendering();
- bool initializeOpenGLFunctions() Q_DECL_FINAL;
+ bool initializeOpenGLFunctions() final;
void glStartTilingQCOM(GLuint x, GLuint y, GLuint width, GLuint height, GLbitfield preserveMask);
void glEndTilingQCOM(GLbitfield preserveMask);
diff --git a/src/platformsupport/devicediscovery/qdevicediscovery_dummy_p.h b/src/platformsupport/devicediscovery/qdevicediscovery_dummy_p.h
index fea3a06cbd..fe669c8dec 100644
--- a/src/platformsupport/devicediscovery/qdevicediscovery_dummy_p.h
+++ b/src/platformsupport/devicediscovery/qdevicediscovery_dummy_p.h
@@ -61,7 +61,7 @@ class QDeviceDiscoveryDummy : public QDeviceDiscovery
public:
QDeviceDiscoveryDummy(QDeviceTypes types, QObject *parent = 0);
- QStringList scanConnectedDevices() Q_DECL_OVERRIDE;
+ QStringList scanConnectedDevices() override;
};
QT_END_NAMESPACE
diff --git a/src/platformsupport/devicediscovery/qdevicediscovery_static_p.h b/src/platformsupport/devicediscovery/qdevicediscovery_static_p.h
index ab5a9c6f12..93110c3c55 100644
--- a/src/platformsupport/devicediscovery/qdevicediscovery_static_p.h
+++ b/src/platformsupport/devicediscovery/qdevicediscovery_static_p.h
@@ -61,7 +61,7 @@ class QDeviceDiscoveryStatic : public QDeviceDiscovery
public:
QDeviceDiscoveryStatic(QDeviceTypes types, QObject *parent = 0);
- QStringList scanConnectedDevices() Q_DECL_OVERRIDE;
+ QStringList scanConnectedDevices() override;
private:
bool checkDeviceType(const QString &device);
diff --git a/src/platformsupport/devicediscovery/qdevicediscovery_udev_p.h b/src/platformsupport/devicediscovery/qdevicediscovery_udev_p.h
index 3c53ef3f17..28618d0b21 100644
--- a/src/platformsupport/devicediscovery/qdevicediscovery_udev_p.h
+++ b/src/platformsupport/devicediscovery/qdevicediscovery_udev_p.h
@@ -63,7 +63,7 @@ class QDeviceDiscoveryUDev : public QDeviceDiscovery
public:
QDeviceDiscoveryUDev(QDeviceTypes types, struct udev *udev, QObject *parent = 0);
~QDeviceDiscoveryUDev();
- QStringList scanConnectedDevices() Q_DECL_OVERRIDE;
+ QStringList scanConnectedDevices() override;
private slots:
void handleUDevNotification();
diff --git a/src/platformsupport/edid/qedidvendortable_p.h b/src/platformsupport/edid/qedidvendortable_p.h
index d09642d649..948a9cecfc 100644
--- a/src/platformsupport/edid/qedidvendortable_p.h
+++ b/src/platformsupport/edid/qedidvendortable_p.h
@@ -47,6 +47,15 @@
#ifndef QEDIDVENDORTABLE_P_H
#define QEDIDVENDORTABLE_P_H
+//
+// W A R N I N G
+// -------------
+//
+// This file is not part of the Qt API. It exists purely as an
+// implementation detail. This header file may change from version to
+// version without notice, or even be removed.
+//
+
QT_BEGIN_NAMESPACE
typedef struct VendorTable {
diff --git a/src/platformsupport/eglconvenience/qeglpbuffer_p.h b/src/platformsupport/eglconvenience/qeglpbuffer_p.h
index 76233967e7..0285e067a6 100644
--- a/src/platformsupport/eglconvenience/qeglpbuffer_p.h
+++ b/src/platformsupport/eglconvenience/qeglpbuffer_p.h
@@ -63,8 +63,8 @@ public:
QEGLPlatformContext::Flags flags = 0);
~QEGLPbuffer();
- QSurfaceFormat format() const Q_DECL_OVERRIDE { return m_format; }
- bool isValid() const Q_DECL_OVERRIDE;
+ QSurfaceFormat format() const override { return m_format; }
+ bool isValid() const override;
EGLSurface pbuffer() const { return m_pbuffer; }
diff --git a/src/platformsupport/eglconvenience/qeglplatformcontext_p.h b/src/platformsupport/eglconvenience/qeglplatformcontext_p.h
index 9d41eecd99..d6cbbe4131 100644
--- a/src/platformsupport/eglconvenience/qeglplatformcontext_p.h
+++ b/src/platformsupport/eglconvenience/qeglplatformcontext_p.h
@@ -72,15 +72,15 @@ public:
Flags flags = 0);
~QEGLPlatformContext();
- void initialize() Q_DECL_OVERRIDE;
- bool makeCurrent(QPlatformSurface *surface) Q_DECL_OVERRIDE;
- void doneCurrent() Q_DECL_OVERRIDE;
- void swapBuffers(QPlatformSurface *surface) Q_DECL_OVERRIDE;
- QFunctionPointer getProcAddress(const char *procName) Q_DECL_OVERRIDE;
+ void initialize() override;
+ bool makeCurrent(QPlatformSurface *surface) override;
+ void doneCurrent() override;
+ void swapBuffers(QPlatformSurface *surface) override;
+ QFunctionPointer getProcAddress(const char *procName) override;
- QSurfaceFormat format() const Q_DECL_OVERRIDE;
- bool isSharing() const Q_DECL_OVERRIDE { return m_shareContext != EGL_NO_CONTEXT; }
- bool isValid() const Q_DECL_OVERRIDE { return m_eglContext != EGL_NO_CONTEXT; }
+ QSurfaceFormat format() const override;
+ bool isSharing() const override { return m_shareContext != EGL_NO_CONTEXT; }
+ bool isValid() const override { return m_eglContext != EGL_NO_CONTEXT; }
EGLContext eglContext() const;
EGLDisplay eglDisplay() const;
diff --git a/src/platformsupport/eventdispatchers/qeventdispatcher_glib_p.h b/src/platformsupport/eventdispatchers/qeventdispatcher_glib_p.h
index bed2532856..5930dc68e7 100644
--- a/src/platformsupport/eventdispatchers/qeventdispatcher_glib_p.h
+++ b/src/platformsupport/eventdispatchers/qeventdispatcher_glib_p.h
@@ -67,7 +67,7 @@ public:
explicit QPAEventDispatcherGlib(QObject *parent = 0);
~QPAEventDispatcherGlib();
- bool processEvents(QEventLoop::ProcessEventsFlags flags) Q_DECL_OVERRIDE;
+ bool processEvents(QEventLoop::ProcessEventsFlags flags) override;
QEventLoop::ProcessEventsFlags m_flags;
};
diff --git a/src/platformsupport/eventdispatchers/qwindowsguieventdispatcher_p.h b/src/platformsupport/eventdispatchers/qwindowsguieventdispatcher_p.h
index 9a23b5c0bd..4ff047a60e 100644
--- a/src/platformsupport/eventdispatchers/qwindowsguieventdispatcher_p.h
+++ b/src/platformsupport/eventdispatchers/qwindowsguieventdispatcher_p.h
@@ -63,8 +63,8 @@ public:
static const char *windowsMessageName(UINT msg);
- bool QT_ENSURE_STACK_ALIGNED_FOR_SSE processEvents(QEventLoop::ProcessEventsFlags flags) Q_DECL_OVERRIDE;
- void sendPostedEvents() Q_DECL_OVERRIDE;
+ bool QT_ENSURE_STACK_ALIGNED_FOR_SSE processEvents(QEventLoop::ProcessEventsFlags flags) override;
+ void sendPostedEvents() override;
private:
QEventLoop::ProcessEventsFlags m_flags;
diff --git a/src/platformsupport/fbconvenience/qfbbackingstore.cpp b/src/platformsupport/fbconvenience/qfbbackingstore.cpp
index 2cad3441e4..e2d94406a4 100644
--- a/src/platformsupport/fbconvenience/qfbbackingstore.cpp
+++ b/src/platformsupport/fbconvenience/qfbbackingstore.cpp
@@ -104,9 +104,8 @@ void QFbBackingStore::beginPaint(const QRegion &region)
if (mImage.hasAlphaChannel()) {
QPainter p(&mImage);
p.setCompositionMode(QPainter::CompositionMode_Source);
- const QVector<QRect> rects = region.rects();
- for (QVector<QRect>::const_iterator it = rects.begin(); it != rects.end(); ++it)
- p.fillRect(*it, Qt::transparent);
+ for (const QRect &r : region)
+ p.fillRect(r, Qt::transparent);
}
}
diff --git a/src/platformsupport/fbconvenience/qfbbackingstore_p.h b/src/platformsupport/fbconvenience/qfbbackingstore_p.h
index c8dfe3489c..c4762c9327 100644
--- a/src/platformsupport/fbconvenience/qfbbackingstore_p.h
+++ b/src/platformsupport/fbconvenience/qfbbackingstore_p.h
@@ -66,10 +66,10 @@ public:
QFbBackingStore(QWindow *window);
~QFbBackingStore();
- QPaintDevice *paintDevice() Q_DECL_OVERRIDE { return &mImage; }
- void flush(QWindow *window, const QRegion &region, const QPoint &offset) Q_DECL_OVERRIDE;
+ QPaintDevice *paintDevice() override { return &mImage; }
+ void flush(QWindow *window, const QRegion &region, const QPoint &offset) override;
- void resize(const QSize &size, const QRegion &region) Q_DECL_OVERRIDE;
+ void resize(const QSize &size, const QRegion &region) override;
const QImage image();
QImage toImage() const override;
@@ -77,8 +77,8 @@ public:
void lock();
void unlock();
- void beginPaint(const QRegion &) Q_DECL_OVERRIDE;
- void endPaint() Q_DECL_OVERRIDE;
+ void beginPaint(const QRegion &) override;
+ void endPaint() override;
protected:
friend class QFbWindow;
diff --git a/src/platformsupport/fbconvenience/qfbscreen.cpp b/src/platformsupport/fbconvenience/qfbscreen.cpp
index 2b4498157c..c42fd879f8 100644
--- a/src/platformsupport/fbconvenience/qfbscreen.cpp
+++ b/src/platformsupport/fbconvenience/qfbscreen.cpp
@@ -210,10 +210,9 @@ QRegion QFbScreen::doRedraw()
if (!mPainter)
mPainter = new QPainter(&mScreenImage);
- const QVector<QRect> rects = mRepaintRegion.rects();
const QRect screenRect = mGeometry.translated(-screenOffset);
- for (int rectIndex = 0; rectIndex < mRepaintRegion.rectCount(); rectIndex++) {
- const QRect rect = rects[rectIndex].intersected(screenRect);
+ for (QRect rect : mRepaintRegion) {
+ rect = rect.intersected(screenRect);
if (rect.isEmpty())
continue;
diff --git a/src/platformsupport/fbconvenience/qfbscreen_p.h b/src/platformsupport/fbconvenience/qfbscreen_p.h
index 1c27a941cc..eed615de36 100644
--- a/src/platformsupport/fbconvenience/qfbscreen_p.h
+++ b/src/platformsupport/fbconvenience/qfbscreen_p.h
@@ -78,14 +78,14 @@ public:
virtual bool initialize();
- QRect geometry() const Q_DECL_OVERRIDE { return mGeometry; }
- int depth() const Q_DECL_OVERRIDE { return mDepth; }
- QImage::Format format() const Q_DECL_OVERRIDE { return mFormat; }
- QSizeF physicalSize() const Q_DECL_OVERRIDE { return mPhysicalSize; }
- QPlatformCursor *cursor() const Q_DECL_OVERRIDE { return mCursor; }
+ QRect geometry() const override { return mGeometry; }
+ int depth() const override { return mDepth; }
+ QImage::Format format() const override { return mFormat; }
+ QSizeF physicalSize() const override { return mPhysicalSize; }
+ QPlatformCursor *cursor() const override { return mCursor; }
QWindow *topWindow() const;
- QWindow *topLevelAt(const QPoint & p) const Q_DECL_OVERRIDE;
+ QWindow *topLevelAt(const QPoint & p) const override;
// compositor api
virtual void addWindow(QFbWindow *window);
@@ -109,7 +109,7 @@ protected:
virtual QRegion doRedraw();
void initializeCompositor();
- bool event(QEvent *event) Q_DECL_OVERRIDE;
+ bool event(QEvent *event) override;
QFbWindow *windowForId(WId wid) const;
diff --git a/src/platformsupport/fbconvenience/qfbwindow_p.h b/src/platformsupport/fbconvenience/qfbwindow_p.h
index 20bac46c69..76b34ce041 100644
--- a/src/platformsupport/fbconvenience/qfbwindow_p.h
+++ b/src/platformsupport/fbconvenience/qfbwindow_p.h
@@ -64,17 +64,17 @@ public:
QFbWindow(QWindow *window);
~QFbWindow();
- void raise() Q_DECL_OVERRIDE;
- void lower() Q_DECL_OVERRIDE;
+ void raise() override;
+ void lower() override;
- void setGeometry(const QRect &rect) Q_DECL_OVERRIDE;
- void setVisible(bool visible) Q_DECL_OVERRIDE;
+ void setGeometry(const QRect &rect) override;
+ void setVisible(bool visible) override;
- void setWindowState(Qt::WindowStates state) Q_DECL_OVERRIDE;
- void setWindowFlags(Qt::WindowFlags type) Q_DECL_OVERRIDE;
+ void setWindowState(Qt::WindowStates state) override;
+ void setWindowFlags(Qt::WindowFlags type) override;
Qt::WindowFlags windowFlags() const;
- WId winId() const Q_DECL_OVERRIDE { return mWindowId; }
+ WId winId() const override { return mWindowId; }
void setBackingStore(QFbBackingStore *store) { mBackingStore = store; }
QFbBackingStore *backingStore() const { return mBackingStore; }
@@ -83,9 +83,9 @@ public:
virtual void repaint(const QRegion&);
- void propagateSizeHints() Q_DECL_OVERRIDE { }
- bool setKeyboardGrabEnabled(bool) Q_DECL_OVERRIDE { return false; }
- bool setMouseGrabEnabled(bool) Q_DECL_OVERRIDE { return false; }
+ void propagateSizeHints() override { }
+ bool setKeyboardGrabEnabled(bool) override { return false; }
+ bool setMouseGrabEnabled(bool) override { return false; }
protected:
friend class QFbScreen;
diff --git a/src/platformsupport/fontdatabases/fontconfig/qfontconfigdatabase.cpp b/src/platformsupport/fontdatabases/fontconfig/qfontconfigdatabase.cpp
index 969a9c17e0..733d6dc531 100644
--- a/src/platformsupport/fontdatabases/fontconfig/qfontconfigdatabase.cpp
+++ b/src/platformsupport/fontdatabases/fontconfig/qfontconfigdatabase.cpp
@@ -428,7 +428,7 @@ static void populateFromPattern(FcPattern *pattern)
if (res == FcResultMatch) {
bool hasLang = false;
#if FC_VERSION >= 20297
- FcChar8 *cap = Q_NULLPTR;
+ FcChar8 *cap = nullptr;
FcResult capRes = FcResultNoMatch;
#endif
for (int j = 1; j < QFontDatabase::WritingSystemsCount; ++j) {
@@ -438,7 +438,7 @@ static void populateFromPattern(FcPattern *pattern)
if (langRes != FcLangDifferentLang) {
#if FC_VERSION >= 20297
if (*capabilityForWritingSystem[j] && requiresOpenType(j)) {
- if (cap == Q_NULLPTR)
+ if (cap == nullptr)
capRes = FcPatternGetString(pattern, FC_CAPABILITY, 0, &cap);
if (capRes == FcResultMatch && strstr(reinterpret_cast<const char *>(cap), capabilityForWritingSystem[j]) == 0)
continue;
diff --git a/src/platformsupport/fontdatabases/fontconfig/qfontconfigdatabase_p.h b/src/platformsupport/fontdatabases/fontconfig/qfontconfigdatabase_p.h
index 6a3261de30..a7257c2f98 100644
--- a/src/platformsupport/fontdatabases/fontconfig/qfontconfigdatabase_p.h
+++ b/src/platformsupport/fontdatabases/fontconfig/qfontconfigdatabase_p.h
@@ -61,15 +61,15 @@ class QFontEngineFT;
class QFontconfigDatabase : public QFreeTypeFontDatabase
{
public:
- void populateFontDatabase() Q_DECL_OVERRIDE;
- void invalidate() Q_DECL_OVERRIDE;
- QFontEngineMulti *fontEngineMulti(QFontEngine *fontEngine, QChar::Script script) Q_DECL_OVERRIDE;
- QFontEngine *fontEngine(const QFontDef &fontDef, void *handle) Q_DECL_OVERRIDE;
- QFontEngine *fontEngine(const QByteArray &fontData, qreal pixelSize, QFont::HintingPreference hintingPreference) Q_DECL_OVERRIDE;
- QStringList fallbacksForFamily(const QString &family, QFont::Style style, QFont::StyleHint styleHint, QChar::Script script) const Q_DECL_OVERRIDE;
- QStringList addApplicationFont(const QByteArray &fontData, const QString &fileName) Q_DECL_OVERRIDE;
- QString resolveFontFamilyAlias(const QString &family) const Q_DECL_OVERRIDE;
- QFont defaultFont() const Q_DECL_OVERRIDE;
+ void populateFontDatabase() override;
+ void invalidate() override;
+ QFontEngineMulti *fontEngineMulti(QFontEngine *fontEngine, QChar::Script script) override;
+ QFontEngine *fontEngine(const QFontDef &fontDef, void *handle) override;
+ QFontEngine *fontEngine(const QByteArray &fontData, qreal pixelSize, QFont::HintingPreference hintingPreference) override;
+ QStringList fallbacksForFamily(const QString &family, QFont::Style style, QFont::StyleHint styleHint, QChar::Script script) const override;
+ QStringList addApplicationFont(const QByteArray &fontData, const QString &fileName) override;
+ QString resolveFontFamilyAlias(const QString &family) const override;
+ QFont defaultFont() const override;
private:
void setupFontEngine(QFontEngineFT *engine, const QFontDef &fontDef) const;
diff --git a/src/platformsupport/fontdatabases/fontconfig/qfontenginemultifontconfig_p.h b/src/platformsupport/fontdatabases/fontconfig/qfontenginemultifontconfig_p.h
index 1d2f451722..7f560c2d05 100644
--- a/src/platformsupport/fontdatabases/fontconfig/qfontenginemultifontconfig_p.h
+++ b/src/platformsupport/fontdatabases/fontconfig/qfontenginemultifontconfig_p.h
@@ -63,7 +63,7 @@ public:
~QFontEngineMultiFontConfig();
- bool shouldLoadFontEngineForCharacter(int at, uint ucs4) const Q_DECL_OVERRIDE;
+ bool shouldLoadFontEngineForCharacter(int at, uint ucs4) const override;
private:
FcPattern* getMatchPatternForFallback(int at) const;
diff --git a/src/platformsupport/fontdatabases/fontdatabases.pro b/src/platformsupport/fontdatabases/fontdatabases.pro
index d2726d08a0..f2bac9ab94 100644
--- a/src/platformsupport/fontdatabases/fontdatabases.pro
+++ b/src/platformsupport/fontdatabases/fontdatabases.pro
@@ -9,25 +9,25 @@ PRECOMPILED_HEADER = ../../corelib/global/qt_pch.h
darwin {
include($$PWD/mac/coretext.pri)
-} else {
- qtConfig(freetype) {
- include($$PWD/freetype/freetype.pri)
- }
+}
- unix {
- include($$PWD/genericunix/genericunix.pri)
- qtConfig(fontconfig) {
- include($$PWD/fontconfig/fontconfig.pri)
- }
- }
+qtConfig(freetype) {
+ include($$PWD/freetype/freetype.pri)
+}
- win32:!winrt {
- include($$PWD/windows/windows.pri)
+unix {
+ include($$PWD/genericunix/genericunix.pri)
+ qtConfig(fontconfig) {
+ include($$PWD/fontconfig/fontconfig.pri)
}
+}
- winrt {
- include($$PWD/winrt/winrt.pri)
- }
+win32:!winrt {
+ include($$PWD/windows/windows.pri)
+}
+
+winrt {
+ include($$PWD/winrt/winrt.pri)
}
load(qt_module)
diff --git a/src/platformsupport/fontdatabases/freetype/qfontengine_ft.cpp b/src/platformsupport/fontdatabases/freetype/qfontengine_ft.cpp
index ec2017ced4..beec8e763c 100644
--- a/src/platformsupport/fontdatabases/freetype/qfontengine_ft.cpp
+++ b/src/platformsupport/fontdatabases/freetype/qfontengine_ft.cpp
@@ -1537,7 +1537,7 @@ QFontEngineFT::QGlyphSet *QFontEngineFT::loadGlyphSet(const QTransform &matrix)
// FT_Set_Transform only supports scalable fonts
if (!FT_IS_SCALABLE(freetype->face))
- return matrix.type() <= QTransform::TxTranslate ? &defaultGlyphSet : Q_NULLPTR;
+ return matrix.type() <= QTransform::TxTranslate ? &defaultGlyphSet : nullptr;
FT_Matrix m = QTransformToFTMatrix(matrix);
@@ -1969,7 +1969,7 @@ glyph_metrics_t QFontEngineFT::alphaMapBoundingBox(glyph_t glyph, QFixed subPixe
static inline QImage alphaMapFromGlyphData(QFontEngineFT::Glyph *glyph, QFontEngine::GlyphFormat glyphFormat)
{
- if (glyph == Q_NULLPTR || glyph->height == 0 || glyph->width == 0)
+ if (glyph == nullptr || glyph->height == 0 || glyph->width == 0)
return QImage();
QImage::Format format = QImage::Format_Invalid;
@@ -2017,14 +2017,14 @@ QImage *QFontEngineFT::lockedAlphaMapForGlyph(glyph_t glyphIndex, QFixed subPixe
currentlyLockedAlphaMap = alphaMapFromGlyphData(glyph, neededFormat);
- const bool glyphHasGeometry = glyph != Q_NULLPTR && glyph->height != 0 && glyph->width != 0;
+ const bool glyphHasGeometry = glyph != nullptr && glyph->height != 0 && glyph->width != 0;
if (!cacheEnabled && glyph != &emptyGlyph) {
currentlyLockedAlphaMap = currentlyLockedAlphaMap.copy();
delete glyph;
}
if (!glyphHasGeometry)
- return Q_NULLPTR;
+ return nullptr;
if (currentlyLockedAlphaMap.isNull())
return QFontEngine::lockedAlphaMapForGlyph(glyphIndex, subPixelPosition, neededFormat, t, offset);
@@ -2122,7 +2122,7 @@ QImage QFontEngineFT::alphaRGBMapForGlyph(glyph_t g, QFixed subPixelPosition, co
QImage QFontEngineFT::bitmapForGlyph(glyph_t g, QFixed subPixelPosition, const QTransform &t)
{
Glyph *glyph = loadGlyphFor(g, subPixelPosition, defaultFormat, t);
- if (glyph == Q_NULLPTR)
+ if (glyph == nullptr)
return QImage();
QImage img;
diff --git a/src/platformsupport/fontdatabases/freetype/qfontengine_ft_p.h b/src/platformsupport/fontdatabases/freetype/qfontengine_ft_p.h
index c063f5df30..f5585da7de 100644
--- a/src/platformsupport/fontdatabases/freetype/qfontengine_ft_p.h
+++ b/src/platformsupport/fontdatabases/freetype/qfontengine_ft_p.h
@@ -190,68 +190,68 @@ private:
mutable int fast_glyph_count;
};
- QFontEngine::FaceId faceId() const Q_DECL_OVERRIDE;
- QFontEngine::Properties properties() const Q_DECL_OVERRIDE;
- QFixed emSquareSize() const Q_DECL_OVERRIDE;
- bool supportsSubPixelPositions() const Q_DECL_OVERRIDE
+ QFontEngine::FaceId faceId() const override;
+ QFontEngine::Properties properties() const override;
+ QFixed emSquareSize() const override;
+ bool supportsSubPixelPositions() const override
{
return default_hint_style == HintLight ||
default_hint_style == HintNone;
}
- bool getSfntTableData(uint tag, uchar *buffer, uint *length) const Q_DECL_OVERRIDE;
- int synthesized() const Q_DECL_OVERRIDE;
+ bool getSfntTableData(uint tag, uchar *buffer, uint *length) const override;
+ int synthesized() const override;
- QFixed ascent() const Q_DECL_OVERRIDE;
- QFixed capHeight() const Q_DECL_OVERRIDE;
- QFixed descent() const Q_DECL_OVERRIDE;
- QFixed leading() const Q_DECL_OVERRIDE;
- QFixed xHeight() const Q_DECL_OVERRIDE;
- QFixed averageCharWidth() const Q_DECL_OVERRIDE;
+ QFixed ascent() const override;
+ QFixed capHeight() const override;
+ QFixed descent() const override;
+ QFixed leading() const override;
+ QFixed xHeight() const override;
+ QFixed averageCharWidth() const override;
- qreal maxCharWidth() const Q_DECL_OVERRIDE;
- QFixed lineThickness() const Q_DECL_OVERRIDE;
- QFixed underlinePosition() const Q_DECL_OVERRIDE;
+ qreal maxCharWidth() const override;
+ QFixed lineThickness() const override;
+ QFixed underlinePosition() const override;
- glyph_t glyphIndex(uint ucs4) const Q_DECL_OVERRIDE;
- void doKerning(QGlyphLayout *, ShaperFlags) const Q_DECL_OVERRIDE;
+ glyph_t glyphIndex(uint ucs4) const override;
+ void doKerning(QGlyphLayout *, ShaperFlags) const override;
- void getUnscaledGlyph(glyph_t glyph, QPainterPath *path, glyph_metrics_t *metrics) Q_DECL_OVERRIDE;
+ void getUnscaledGlyph(glyph_t glyph, QPainterPath *path, glyph_metrics_t *metrics) override;
- bool supportsTransformation(const QTransform &transform) const Q_DECL_OVERRIDE;
+ bool supportsTransformation(const QTransform &transform) const override;
void addGlyphsToPath(glyph_t *glyphs, QFixedPoint *positions, int nglyphs,
- QPainterPath *path, QTextItem::RenderFlags flags) Q_DECL_OVERRIDE;
+ QPainterPath *path, QTextItem::RenderFlags flags) override;
void addOutlineToPath(qreal x, qreal y, const QGlyphLayout &glyphs,
- QPainterPath *path, QTextItem::RenderFlags flags) Q_DECL_OVERRIDE;
+ QPainterPath *path, QTextItem::RenderFlags flags) override;
- bool stringToCMap(const QChar *str, int len, QGlyphLayout *glyphs, int *nglyphs, ShaperFlags flags) const Q_DECL_OVERRIDE;
+ bool stringToCMap(const QChar *str, int len, QGlyphLayout *glyphs, int *nglyphs, ShaperFlags flags) const override;
- glyph_metrics_t boundingBox(const QGlyphLayout &glyphs) Q_DECL_OVERRIDE;
- glyph_metrics_t boundingBox(glyph_t glyph) Q_DECL_OVERRIDE;
- glyph_metrics_t boundingBox(glyph_t glyph, const QTransform &matrix) Q_DECL_OVERRIDE;
+ glyph_metrics_t boundingBox(const QGlyphLayout &glyphs) override;
+ glyph_metrics_t boundingBox(glyph_t glyph) override;
+ glyph_metrics_t boundingBox(glyph_t glyph, const QTransform &matrix) override;
- void recalcAdvances(QGlyphLayout *glyphs, ShaperFlags flags) const Q_DECL_OVERRIDE;
- QImage alphaMapForGlyph(glyph_t g) Q_DECL_OVERRIDE { return alphaMapForGlyph(g, 0); }
- QImage alphaMapForGlyph(glyph_t, QFixed) Q_DECL_OVERRIDE;
- QImage alphaMapForGlyph(glyph_t glyph, QFixed subPixelPosition, const QTransform &t) Q_DECL_OVERRIDE;
- QImage alphaRGBMapForGlyph(glyph_t, QFixed subPixelPosition, const QTransform &t) Q_DECL_OVERRIDE;
- QImage bitmapForGlyph(glyph_t, QFixed subPixelPosition, const QTransform &t) Q_DECL_OVERRIDE;
+ void recalcAdvances(QGlyphLayout *glyphs, ShaperFlags flags) const override;
+ QImage alphaMapForGlyph(glyph_t g) override { return alphaMapForGlyph(g, 0); }
+ QImage alphaMapForGlyph(glyph_t, QFixed) override;
+ QImage alphaMapForGlyph(glyph_t glyph, QFixed subPixelPosition, const QTransform &t) override;
+ QImage alphaRGBMapForGlyph(glyph_t, QFixed subPixelPosition, const QTransform &t) override;
+ QImage bitmapForGlyph(glyph_t, QFixed subPixelPosition, const QTransform &t) override;
glyph_metrics_t alphaMapBoundingBox(glyph_t glyph,
QFixed subPixelPosition,
const QTransform &matrix,
- QFontEngine::GlyphFormat format) Q_DECL_OVERRIDE;
+ QFontEngine::GlyphFormat format) override;
QImage *lockedAlphaMapForGlyph(glyph_t glyph, QFixed subPixelPosition,
GlyphFormat neededFormat, const QTransform &t,
- QPoint *offset) Q_DECL_OVERRIDE;
- bool hasInternalCaching() const Q_DECL_OVERRIDE { return cacheEnabled; }
- void unlockAlphaMapForGlyph() Q_DECL_OVERRIDE;
- bool expectsGammaCorrectedBlending() const Q_DECL_OVERRIDE;
+ QPoint *offset) override;
+ bool hasInternalCaching() const override { return cacheEnabled; }
+ void unlockAlphaMapForGlyph() override;
+ bool expectsGammaCorrectedBlending() const override;
- void removeGlyphFromCache(glyph_t glyph) Q_DECL_OVERRIDE;
- int glyphMargin(QFontEngine::GlyphFormat /* format */) Q_DECL_OVERRIDE { return 0; }
+ void removeGlyphFromCache(glyph_t glyph) override;
+ int glyphMargin(QFontEngine::GlyphFormat /* format */) override { return 0; }
- int glyphCount() const Q_DECL_OVERRIDE;
+ int glyphCount() const override;
enum Scaling {
Scaled,
@@ -282,13 +282,13 @@ private:
bool init(FaceId faceId, bool antialias, GlyphFormat format,
QFreetypeFace *freetypeFace);
- int getPointInOutline(glyph_t glyph, int flags, quint32 point, QFixed *xpos, QFixed *ypos, quint32 *nPoints) Q_DECL_OVERRIDE;
+ int getPointInOutline(glyph_t glyph, int flags, quint32 point, QFixed *xpos, QFixed *ypos, quint32 *nPoints) override;
void setQtDefaultHintStyle(QFont::HintingPreference hintingPreference);
- void setDefaultHintStyle(HintStyle style) Q_DECL_OVERRIDE;
+ void setDefaultHintStyle(HintStyle style) override;
- QFontEngine *cloneWithSize(qreal pixelSize) const Q_DECL_OVERRIDE;
- Qt::HANDLE handle() const Q_DECL_OVERRIDE;
+ QFontEngine *cloneWithSize(qreal pixelSize) const override;
+ Qt::HANDLE handle() const override;
bool initFromFontEngine(const QFontEngineFT *fontEngine);
HintStyle defaultHintStyle() const { return default_hint_style; }
diff --git a/src/platformsupport/fontdatabases/freetype/qfreetypefontdatabase_p.h b/src/platformsupport/fontdatabases/freetype/qfreetypefontdatabase_p.h
index 6d51361400..0b2956b16e 100644
--- a/src/platformsupport/fontdatabases/freetype/qfreetypefontdatabase_p.h
+++ b/src/platformsupport/fontdatabases/freetype/qfreetypefontdatabase_p.h
@@ -66,11 +66,11 @@ struct FontFile
class QFreeTypeFontDatabase : public QPlatformFontDatabase
{
public:
- void populateFontDatabase() Q_DECL_OVERRIDE;
- QFontEngine *fontEngine(const QFontDef &fontDef, void *handle) Q_DECL_OVERRIDE;
- QFontEngine *fontEngine(const QByteArray &fontData, qreal pixelSize, QFont::HintingPreference hintingPreference) Q_DECL_OVERRIDE;
- QStringList addApplicationFont(const QByteArray &fontData, const QString &fileName) Q_DECL_OVERRIDE;
- void releaseHandle(void *handle) Q_DECL_OVERRIDE;
+ void populateFontDatabase() override;
+ QFontEngine *fontEngine(const QFontDef &fontDef, void *handle) override;
+ QFontEngine *fontEngine(const QByteArray &fontData, qreal pixelSize, QFont::HintingPreference hintingPreference) override;
+ QStringList addApplicationFont(const QByteArray &fontData, const QString &fileName) override;
+ void releaseHandle(void *handle) override;
static QStringList addTTFile(const QByteArray &fontData, const QByteArray &file);
};
diff --git a/src/platformsupport/fontdatabases/mac/qcoretextfontdatabase_p.h b/src/platformsupport/fontdatabases/mac/qcoretextfontdatabase_p.h
index 7e41e50a04..05f6ed641c 100644
--- a/src/platformsupport/fontdatabases/mac/qcoretextfontdatabase_p.h
+++ b/src/platformsupport/fontdatabases/mac/qcoretextfontdatabase_p.h
@@ -70,18 +70,18 @@ class QCoreTextFontDatabase : public QPlatformFontDatabase
public:
QCoreTextFontDatabase();
~QCoreTextFontDatabase();
- void populateFontDatabase() Q_DECL_OVERRIDE;
+ void populateFontDatabase() override;
bool populateFamilyAliases() override;
- void populateFamily(const QString &familyName) Q_DECL_OVERRIDE;
+ void populateFamily(const QString &familyName) override;
void invalidate() override;
- QStringList fallbacksForFamily(const QString &family, QFont::Style style, QFont::StyleHint styleHint, QChar::Script script) const Q_DECL_OVERRIDE;
- QStringList addApplicationFont(const QByteArray &fontData, const QString &fileName) Q_DECL_OVERRIDE;
- void releaseHandle(void *handle) Q_DECL_OVERRIDE;
- bool isPrivateFontFamily(const QString &family) const Q_DECL_OVERRIDE;
- QFont defaultFont() const Q_DECL_OVERRIDE;
- bool fontsAlwaysScalable() const Q_DECL_OVERRIDE;
- QList<int> standardSizes() const Q_DECL_OVERRIDE;
+ QStringList fallbacksForFamily(const QString &family, QFont::Style style, QFont::StyleHint styleHint, QChar::Script script) const override;
+ QStringList addApplicationFont(const QByteArray &fontData, const QString &fileName) override;
+ void releaseHandle(void *handle) override;
+ bool isPrivateFontFamily(const QString &family) const override;
+ QFont defaultFont() const override;
+ bool fontsAlwaysScalable() const override;
+ QList<int> standardSizes() const override;
// For iOS and OS X platform themes
QFont *themeFont(QPlatformTheme::Font) const;
diff --git a/src/platformsupport/fontdatabases/mac/qfontengine_coretext.mm b/src/platformsupport/fontdatabases/mac/qfontengine_coretext.mm
index 66baf162d9..d388e33dae 100644
--- a/src/platformsupport/fontdatabases/mac/qfontengine_coretext.mm
+++ b/src/platformsupport/fontdatabases/mac/qfontengine_coretext.mm
@@ -665,11 +665,7 @@ QImage QCoreTextFontEngine::imageForGlyph(glyph_t glyph, QFixed subPixelPosition
if (!im.width() || !im.height())
return im;
-#ifdef Q_OS_OSX
- CGColorSpaceRef colorspace = CGColorSpaceCreateWithName(kCGColorSpaceGenericRGB);
-#else
- CGColorSpaceRef colorspace = CGColorSpaceCreateDeviceRGB();
-#endif
+ CGColorSpaceRef colorspace = CGColorSpaceCreateWithName(kCGColorSpaceSRGB);
uint cgflags = isColorGlyph ? kCGImageAlphaPremultipliedFirst : kCGImageAlphaNoneSkipFirst;
#ifdef kCGBitmapByteOrder32Host //only needed because CGImage.h added symbols in the minor version
cgflags |= kCGBitmapByteOrder32Host;
diff --git a/src/platformsupport/fontdatabases/mac/qfontengine_coretext_p.h b/src/platformsupport/fontdatabases/mac/qfontengine_coretext_p.h
index 2986f0aaec..1f7b346909 100644
--- a/src/platformsupport/fontdatabases/mac/qfontengine_coretext_p.h
+++ b/src/platformsupport/fontdatabases/mac/qfontengine_coretext_p.h
@@ -70,53 +70,53 @@ public:
QCoreTextFontEngine(CGFontRef font, const QFontDef &def);
~QCoreTextFontEngine();
- glyph_t glyphIndex(uint ucs4) const Q_DECL_OVERRIDE;
- bool stringToCMap(const QChar *str, int len, QGlyphLayout *glyphs, int *nglyphs, ShaperFlags flags) const Q_DECL_OVERRIDE;
- void recalcAdvances(QGlyphLayout *, ShaperFlags) const Q_DECL_OVERRIDE;
+ glyph_t glyphIndex(uint ucs4) const override;
+ bool stringToCMap(const QChar *str, int len, QGlyphLayout *glyphs, int *nglyphs, ShaperFlags flags) const override;
+ void recalcAdvances(QGlyphLayout *, ShaperFlags) const override;
- glyph_metrics_t boundingBox(const QGlyphLayout &glyphs) Q_DECL_OVERRIDE;
- glyph_metrics_t boundingBox(glyph_t glyph) Q_DECL_OVERRIDE;
+ glyph_metrics_t boundingBox(const QGlyphLayout &glyphs) override;
+ glyph_metrics_t boundingBox(glyph_t glyph) override;
- QFixed ascent() const Q_DECL_OVERRIDE;
- QFixed capHeight() const Q_DECL_OVERRIDE;
- QFixed descent() const Q_DECL_OVERRIDE;
- QFixed leading() const Q_DECL_OVERRIDE;
- QFixed xHeight() const Q_DECL_OVERRIDE;
- qreal maxCharWidth() const Q_DECL_OVERRIDE;
- QFixed averageCharWidth() const Q_DECL_OVERRIDE;
+ QFixed ascent() const override;
+ QFixed capHeight() const override;
+ QFixed descent() const override;
+ QFixed leading() const override;
+ QFixed xHeight() const override;
+ qreal maxCharWidth() const override;
+ QFixed averageCharWidth() const override;
void addGlyphsToPath(glyph_t *glyphs, QFixedPoint *positions, int numGlyphs,
- QPainterPath *path, QTextItem::RenderFlags) Q_DECL_OVERRIDE;
+ QPainterPath *path, QTextItem::RenderFlags) override;
- bool canRender(const QChar *string, int len) const Q_DECL_OVERRIDE;
+ bool canRender(const QChar *string, int len) const override;
- int synthesized() const Q_DECL_OVERRIDE { return synthesisFlags; }
- bool supportsSubPixelPositions() const Q_DECL_OVERRIDE { return true; }
+ int synthesized() const override { return synthesisFlags; }
+ bool supportsSubPixelPositions() const override { return true; }
- QFixed lineThickness() const Q_DECL_OVERRIDE;
- QFixed underlinePosition() const Q_DECL_OVERRIDE;
+ QFixed lineThickness() const override;
+ QFixed underlinePosition() const override;
void draw(CGContextRef ctx, qreal x, qreal y, const QTextItemInt &ti, int paintDeviceHeight);
- FaceId faceId() const Q_DECL_OVERRIDE;
- bool getSfntTableData(uint /*tag*/, uchar * /*buffer*/, uint * /*length*/) const Q_DECL_OVERRIDE;
- void getUnscaledGlyph(glyph_t glyph, QPainterPath *path, glyph_metrics_t *metrics) Q_DECL_OVERRIDE;
- QImage alphaMapForGlyph(glyph_t, QFixed subPixelPosition) Q_DECL_OVERRIDE;
- QImage alphaMapForGlyph(glyph_t glyph, QFixed subPixelPosition, const QTransform &t) Q_DECL_OVERRIDE;
- QImage alphaRGBMapForGlyph(glyph_t, QFixed subPixelPosition, const QTransform &t) Q_DECL_OVERRIDE;
- glyph_metrics_t alphaMapBoundingBox(glyph_t glyph, QFixed, const QTransform &matrix, GlyphFormat) Q_DECL_OVERRIDE;
- QImage bitmapForGlyph(glyph_t, QFixed subPixelPosition, const QTransform &t) Q_DECL_OVERRIDE;
- QFixed emSquareSize() const Q_DECL_OVERRIDE;
- void doKerning(QGlyphLayout *g, ShaperFlags flags) const Q_DECL_OVERRIDE;
-
- bool supportsTransformation(const QTransform &transform) const Q_DECL_OVERRIDE;
- bool expectsGammaCorrectedBlending() const Q_DECL_OVERRIDE;
-
- QFontEngine *cloneWithSize(qreal pixelSize) const Q_DECL_OVERRIDE;
- Qt::HANDLE handle() const Q_DECL_OVERRIDE;
- int glyphMargin(QFontEngine::GlyphFormat format) Q_DECL_OVERRIDE { Q_UNUSED(format); return 0; }
-
- QFontEngine::Properties properties() const Q_DECL_OVERRIDE;
+ FaceId faceId() const override;
+ bool getSfntTableData(uint /*tag*/, uchar * /*buffer*/, uint * /*length*/) const override;
+ void getUnscaledGlyph(glyph_t glyph, QPainterPath *path, glyph_metrics_t *metrics) override;
+ QImage alphaMapForGlyph(glyph_t, QFixed subPixelPosition) override;
+ QImage alphaMapForGlyph(glyph_t glyph, QFixed subPixelPosition, const QTransform &t) override;
+ QImage alphaRGBMapForGlyph(glyph_t, QFixed subPixelPosition, const QTransform &t) override;
+ glyph_metrics_t alphaMapBoundingBox(glyph_t glyph, QFixed, const QTransform &matrix, GlyphFormat) override;
+ QImage bitmapForGlyph(glyph_t, QFixed subPixelPosition, const QTransform &t) override;
+ QFixed emSquareSize() const override;
+ void doKerning(QGlyphLayout *g, ShaperFlags flags) const override;
+
+ bool supportsTransformation(const QTransform &transform) const override;
+ bool expectsGammaCorrectedBlending() const override;
+
+ QFontEngine *cloneWithSize(qreal pixelSize) const override;
+ Qt::HANDLE handle() const override;
+ int glyphMargin(QFontEngine::GlyphFormat format) override { Q_UNUSED(format); return 0; }
+
+ QFontEngine::Properties properties() const override;
static bool ct_getSfntTable(void *user_data, uint tag, uchar *buffer, uint *length);
static QFont::Weight qtWeightFromCFWeight(float value);
diff --git a/src/platformsupport/fontdatabases/windows/qwindowsfontdatabase.cpp b/src/platformsupport/fontdatabases/windows/qwindowsfontdatabase.cpp
index a0adcd6e2e..9d86f461e9 100644
--- a/src/platformsupport/fontdatabases/windows/qwindowsfontdatabase.cpp
+++ b/src/platformsupport/fontdatabases/windows/qwindowsfontdatabase.cpp
@@ -76,20 +76,18 @@ typedef HRESULT (WINAPI *DWriteCreateFactoryType)(DWRITE_FACTORY_TYPE, const IID
static inline DWriteCreateFactoryType resolveDWriteCreateFactory()
{
- if (QSysInfo::windowsVersion() < QSysInfo::WV_VISTA)
- return Q_NULLPTR;
QSystemLibrary library(QStringLiteral("dwrite"));
QFunctionPointer result = library.resolve("DWriteCreateFactory");
if (Q_UNLIKELY(!result)) {
qWarning("Unable to load dwrite.dll");
- return Q_NULLPTR;
+ return nullptr;
}
return reinterpret_cast<DWriteCreateFactoryType>(result);
}
static void createDirectWriteFactory(IDWriteFactory **factory)
{
- *factory = Q_NULLPTR;
+ *factory = nullptr;
static const DWriteCreateFactoryType dWriteCreateFactory = resolveDWriteCreateFactory();
if (!dWriteCreateFactory)
@@ -539,7 +537,7 @@ namespace {
class CustomFontFileLoader
{
public:
- CustomFontFileLoader() : m_directWriteFontFileLoader(Q_NULLPTR)
+ CustomFontFileLoader() : m_directWriteFontFileLoader(nullptr)
{
createDirectWriteFactory(&m_directWriteFactory);
@@ -874,8 +872,8 @@ FontNames qt_getCanonicalFontNames(const uchar *table, quint32 bytes)
if ((platform_id == PlatformId_Microsoft
&& (encoding_id == 0 || encoding_id == 1))
- && (language_id & 0x3ff) == MS_LangIdEnglish
- && *idType < Microsoft) {
+ && ((language_id & 0x3ff) == MS_LangIdEnglish
+ || *idType < Microsoft)) {
*id = i;
*idType = Microsoft;
}
@@ -1128,7 +1126,7 @@ static int QT_WIN_CALLBACK storeFont(const LOGFONT *logFont, const TEXTMETRIC *t
// NEWTEXTMETRICEX (passed for TT fonts) is a NEWTEXTMETRIC, which according
// to the documentation is identical to a TEXTMETRIC except for the last four
// members, which we don't use anyway
- const FONTSIGNATURE *signature = Q_NULLPTR;
+ const FONTSIGNATURE *signature = nullptr;
if (type & TRUETYPE_FONTTYPE)
signature = &reinterpret_cast<const NEWTEXTMETRICEX *>(textmetric)->ntmFontSig;
addFontToDatabase(familyName, styleName, *logFont, textmetric, signature, type);
@@ -1174,6 +1172,46 @@ static int QT_WIN_CALLBACK populateFontFamilies(const LOGFONT *logFont, const TE
return 1; // continue
}
+void QWindowsFontDatabase::addDefaultEUDCFont()
+{
+ QString path;
+ {
+ HKEY key;
+ if (RegOpenKeyEx(HKEY_CURRENT_USER,
+ L"EUDC\\1252",
+ 0,
+ KEY_READ,
+ &key) != ERROR_SUCCESS) {
+ return;
+ }
+
+ WCHAR value[MAX_PATH];
+ DWORD bufferSize = sizeof(value);
+ ZeroMemory(value, bufferSize);
+
+ if (RegQueryValueEx(key,
+ L"SystemDefaultEUDCFont",
+ nullptr,
+ nullptr,
+ reinterpret_cast<LPBYTE>(value),
+ &bufferSize) == ERROR_SUCCESS) {
+ path = QString::fromWCharArray(value);
+ }
+
+ RegCloseKey(key);
+ }
+
+ if (!path.isEmpty()) {
+ QFile file(path);
+ if (!file.open(QIODevice::ReadOnly)) {
+ qCWarning(lcQpaFonts) << "Unable to open default EUDC font:" << path;
+ return;
+ }
+
+ m_eudcFonts = addApplicationFont(file.readAll(), path);
+ }
+}
+
void QWindowsFontDatabase::populateFontDatabase()
{
removeApplicationFonts();
@@ -1188,6 +1226,7 @@ void QWindowsFontDatabase::populateFontDatabase()
QString systemDefaultFamily = QWindowsFontDatabase::systemDefaultFont().family();
if (QPlatformFontDatabase::resolveFontFamilyAlias(systemDefaultFamily) == systemDefaultFamily)
QPlatformFontDatabase::registerFontFamily(systemDefaultFamily);
+ addDefaultEUDCFont();
}
typedef QSharedPointer<QWindowsFontEngineData> QWindowsFontEngineDataPtr;
@@ -1585,6 +1624,7 @@ void QWindowsFontDatabase::removeApplicationFonts()
}
}
m_applicationFonts.clear();
+ m_eudcFonts.clear();
}
void QWindowsFontDatabase::releaseHandle(void *handle)
@@ -1719,11 +1759,8 @@ LOGFONT QWindowsFontDatabase::fontDefToLOGFONT(const QFontDef &request, const QS
qual = PROOF_QUALITY;
if (request.styleStrategy & QFont::PreferAntialias) {
- if (QSysInfo::WindowsVersion >= QSysInfo::WV_XP && !(request.styleStrategy & QFont::NoSubpixelAntialias)) {
- qual = CLEARTYPE_QUALITY;
- } else {
- qual = ANTIALIASED_QUALITY;
- }
+ qual = (request.styleStrategy & QFont::NoSubpixelAntialias) == 0
+ ? CLEARTYPE_QUALITY : ANTIALIASED_QUALITY;
} else if (request.styleStrategy & QFont::NoAntialias) {
qual = NONANTIALIASED_QUALITY;
} else if ((request.styleStrategy & QFont::NoSubpixelAntialias) && sharedFontData()->clearTypeEnabled) {
@@ -1847,7 +1884,7 @@ QString QWindowsFontDatabase::familyForStyleHint(QFont::StyleHint styleHint)
QStringList QWindowsFontDatabase::fallbacksForFamily(const QString &family, QFont::Style style, QFont::StyleHint styleHint, QChar::Script script) const
{
- QStringList result;
+ QStringList result = m_eudcFonts;
result.append(QWindowsFontDatabase::familyForStyleHint(styleHint));
result.append(QWindowsFontDatabase::extraTryFontsForFamily(family));
result.append(QPlatformFontDatabase::fallbacksForFamily(family, style, styleHint, script));
@@ -1910,7 +1947,7 @@ QFontEngine *QWindowsFontDatabase::createEngine(const QFontDef &request, const Q
} else {
bool isColorFont = false;
#if defined(QT_USE_DIRECTWRITE2)
- IDWriteFontFace2 *directWriteFontFace2 = Q_NULLPTR;
+ IDWriteFontFace2 *directWriteFontFace2 = nullptr;
if (SUCCEEDED(directWriteFontFace->QueryInterface(__uuidof(IDWriteFontFace2),
reinterpret_cast<void **>(&directWriteFontFace2)))) {
if (directWriteFontFace2->IsColorFont())
diff --git a/src/platformsupport/fontdatabases/windows/qwindowsfontdatabase_ft.cpp b/src/platformsupport/fontdatabases/windows/qwindowsfontdatabase_ft.cpp
index 3f03b30f10..78477de38a 100644
--- a/src/platformsupport/fontdatabases/windows/qwindowsfontdatabase_ft.cpp
+++ b/src/platformsupport/fontdatabases/windows/qwindowsfontdatabase_ft.cpp
@@ -144,7 +144,7 @@ static FontKeys &fontKeys()
return result;
}
-static const FontKey *findFontKey(const QString &name, int *indexIn = Q_NULLPTR)
+static const FontKey *findFontKey(const QString &name, int *indexIn = nullptr)
{
const FontKeys &keys = fontKeys();
for (auto it = keys.constBegin(), cend = keys.constEnd(); it != cend; ++it) {
@@ -157,7 +157,7 @@ static const FontKey *findFontKey(const QString &name, int *indexIn = Q_NULLPTR)
}
if (indexIn)
*indexIn = -1;
- return Q_NULLPTR;
+ return nullptr;
}
static bool addFontToDatabase(QString familyName,
@@ -310,7 +310,7 @@ static int QT_WIN_CALLBACK storeFont(const LOGFONT *logFont, const TEXTMETRIC *t
// NEWTEXTMETRICEX (passed for TT fonts) is a NEWTEXTMETRIC, which according
// to the documentation is identical to a TEXTMETRIC except for the last four
// members, which we don't use anyway
- const FONTSIGNATURE *signature = Q_NULLPTR;
+ const FONTSIGNATURE *signature = nullptr;
if (type & TRUETYPE_FONTTYPE)
signature = &reinterpret_cast<const NEWTEXTMETRICEX *>(textmetric)->ntmFontSig;
addFontToDatabase(faceName, styleName, fullName, *logFont, textmetric, signature, type);
diff --git a/src/platformsupport/fontdatabases/windows/qwindowsfontdatabase_ft_p.h b/src/platformsupport/fontdatabases/windows/qwindowsfontdatabase_ft_p.h
index 2df81274ad..c3d201b3a0 100644
--- a/src/platformsupport/fontdatabases/windows/qwindowsfontdatabase_ft_p.h
+++ b/src/platformsupport/fontdatabases/windows/qwindowsfontdatabase_ft_p.h
@@ -60,18 +60,18 @@ QT_BEGIN_NAMESPACE
class QWindowsFontDatabaseFT : public QFreeTypeFontDatabase
{
public:
- void populateFontDatabase() Q_DECL_OVERRIDE;
- void populateFamily(const QString &familyName) Q_DECL_OVERRIDE;
- QFontEngine *fontEngine(const QFontDef &fontDef, void *handle) Q_DECL_OVERRIDE;
+ void populateFontDatabase() override;
+ void populateFamily(const QString &familyName) override;
+ QFontEngine *fontEngine(const QFontDef &fontDef, void *handle) override;
QFontEngine *fontEngine(const QByteArray &fontData, qreal pixelSize,
- QFont::HintingPreference hintingPreference) Q_DECL_OVERRIDE;
+ QFont::HintingPreference hintingPreference) override;
QStringList fallbacksForFamily(const QString &family, QFont::Style style,
QFont::StyleHint styleHint,
- QChar::Script script) const Q_DECL_OVERRIDE;
+ QChar::Script script) const override;
- QString fontDir() const Q_DECL_OVERRIDE;
- QFont defaultFont() const Q_DECL_OVERRIDE;
+ QString fontDir() const override;
+ QFont defaultFont() const override;
};
QT_END_NAMESPACE
diff --git a/src/platformsupport/fontdatabases/windows/qwindowsfontdatabase_p.h b/src/platformsupport/fontdatabases/windows/qwindowsfontdatabase_p.h
index 15172c09da..c01a03c7b4 100644
--- a/src/platformsupport/fontdatabases/windows/qwindowsfontdatabase_p.h
+++ b/src/platformsupport/fontdatabases/windows/qwindowsfontdatabase_p.h
@@ -95,18 +95,18 @@ public:
QWindowsFontDatabase();
~QWindowsFontDatabase();
- void populateFontDatabase() Q_DECL_OVERRIDE;
- void populateFamily(const QString &familyName) Q_DECL_OVERRIDE;
- QFontEngineMulti *fontEngineMulti(QFontEngine *fontEngine, QChar::Script script) Q_DECL_OVERRIDE;
- QFontEngine *fontEngine(const QFontDef &fontDef, void *handle) Q_DECL_OVERRIDE;
- QFontEngine *fontEngine(const QByteArray &fontData, qreal pixelSize, QFont::HintingPreference hintingPreference) Q_DECL_OVERRIDE;
- QStringList fallbacksForFamily(const QString &family, QFont::Style style, QFont::StyleHint styleHint, QChar::Script script) const Q_DECL_OVERRIDE;
- QStringList addApplicationFont(const QByteArray &fontData, const QString &fileName) Q_DECL_OVERRIDE;
- void releaseHandle(void *handle) Q_DECL_OVERRIDE;
- QString fontDir() const Q_DECL_OVERRIDE;
-
- QFont defaultFont() const Q_DECL_OVERRIDE { return systemDefaultFont(); }
- bool fontsAlwaysScalable() const Q_DECL_OVERRIDE;
+ void populateFontDatabase() override;
+ void populateFamily(const QString &familyName) override;
+ QFontEngineMulti *fontEngineMulti(QFontEngine *fontEngine, QChar::Script script) override;
+ QFontEngine *fontEngine(const QFontDef &fontDef, void *handle) override;
+ QFontEngine *fontEngine(const QByteArray &fontData, qreal pixelSize, QFont::HintingPreference hintingPreference) override;
+ QStringList fallbacksForFamily(const QString &family, QFont::Style style, QFont::StyleHint styleHint, QChar::Script script) const override;
+ QStringList addApplicationFont(const QByteArray &fontData, const QString &fileName) override;
+ void releaseHandle(void *handle) override;
+ QString fontDir() const override;
+
+ QFont defaultFont() const override { return systemDefaultFont(); }
+ bool fontsAlwaysScalable() const override;
void derefUniqueFont(const QString &uniqueFont);
void refUniqueFont(const QString &uniqueFont);
@@ -134,6 +134,7 @@ public:
private:
void removeApplicationFonts();
+ void addDefaultEUDCFont();
struct WinApplicationFont {
HANDLE handle;
@@ -150,6 +151,7 @@ private:
QMap<QString, UniqueFontData> m_uniqueFontData;
static unsigned m_fontOptions;
+ QStringList m_eudcFonts;
};
#ifndef QT_NO_DEBUG_STREAM
diff --git a/src/platformsupport/fontdatabases/windows/qwindowsfontengine.cpp b/src/platformsupport/fontdatabases/windows/qwindowsfontengine.cpp
index a337332b53..584e4db05d 100644
--- a/src/platformsupport/fontdatabases/windows/qwindowsfontengine.cpp
+++ b/src/platformsupport/fontdatabases/windows/qwindowsfontengine.cpp
@@ -1267,31 +1267,36 @@ QFontEngine *QWindowsMultiFontEngine::loadEngine(int at)
lf.lfFaceName[nameSubstituteLength] = 0;
}
- IDWriteFont *directWriteFont = 0;
- HRESULT hr = data->directWriteGdiInterop->CreateFontFromLOGFONT(&lf, &directWriteFont);
- if (FAILED(hr)) {
- qWarning("%s: %s", __FUNCTION__,
- qPrintable(msgDirectWriteFunctionFailed(hr, "CreateFontFromLOGFONT", fam, nameSubstitute)));
+ HFONT hfont = CreateFontIndirect(&lf);
+ if (hfont == nullptr) {
+ qErrnoWarning("%s: CreateFontIndirect failed", __FUNCTION__);
} else {
- Q_ASSERT(directWriteFont);
- IDWriteFontFace *directWriteFontFace = NULL;
- HRESULT hr = directWriteFont->CreateFontFace(&directWriteFontFace);
+ HGDIOBJ oldFont = SelectObject(data->hdc, hfont);
+
+ IDWriteFontFace *directWriteFontFace = nullptr;
+ QWindowsFontEngineDirectWrite *fedw = nullptr;
+ HRESULT hr = data->directWriteGdiInterop->CreateFontFaceFromHdc(data->hdc, &directWriteFontFace);
if (SUCCEEDED(hr)) {
Q_ASSERT(directWriteFontFace);
- QWindowsFontEngineDirectWrite *fedw = new QWindowsFontEngineDirectWrite(directWriteFontFace,
- fontEngine->fontDef.pixelSize,
- data);
+ fedw = new QWindowsFontEngineDirectWrite(directWriteFontFace,
+ fontEngine->fontDef.pixelSize,
+ data);
fedw->fontDef.weight = fontEngine->fontDef.weight;
if (fontEngine->fontDef.style > QFont::StyleNormal)
fedw->fontDef.style = fontEngine->fontDef.style;
fedw->fontDef.family = fam;
fedw->fontDef.hintingPreference = fontEngine->fontDef.hintingPreference;
fedw->fontDef.stretch = fontEngine->fontDef.stretch;
- return fedw;
} else {
qWarning("%s: %s", __FUNCTION__,
qPrintable(msgDirectWriteFunctionFailed(hr, "CreateFontFace", fam, nameSubstitute)));
}
+
+ SelectObject(data->hdc, oldFont);
+ DeleteObject(hfont);
+
+ if (fedw != nullptr)
+ return fedw;
}
}
#endif
diff --git a/src/platformsupport/fontdatabases/windows/qwindowsfontengine_p.h b/src/platformsupport/fontdatabases/windows/qwindowsfontengine_p.h
index 76b45d7a7b..2ec391c4da 100644
--- a/src/platformsupport/fontdatabases/windows/qwindowsfontengine_p.h
+++ b/src/platformsupport/fontdatabases/windows/qwindowsfontengine_p.h
@@ -76,53 +76,53 @@ public:
void initFontInfo(const QFontDef &request,
int dpi);
- QFixed lineThickness() const Q_DECL_OVERRIDE;
- Properties properties() const Q_DECL_OVERRIDE;
- void getUnscaledGlyph(glyph_t glyph, QPainterPath *path, glyph_metrics_t *metrics) Q_DECL_OVERRIDE;
- FaceId faceId() const Q_DECL_OVERRIDE;
- bool getSfntTableData(uint tag, uchar *buffer, uint *length) const Q_DECL_OVERRIDE;
- int synthesized() const Q_DECL_OVERRIDE;
- QFixed emSquareSize() const Q_DECL_OVERRIDE;
-
- glyph_t glyphIndex(uint ucs4) const Q_DECL_OVERRIDE;
- bool stringToCMap(const QChar *str, int len, QGlyphLayout *glyphs, int *nglyphs, ShaperFlags flags) const Q_DECL_OVERRIDE;
- void recalcAdvances(QGlyphLayout *glyphs, ShaperFlags) const Q_DECL_OVERRIDE;
-
- void addOutlineToPath(qreal x, qreal y, const QGlyphLayout &glyphs, QPainterPath *path, QTextItem::RenderFlags flags) Q_DECL_OVERRIDE;
+ QFixed lineThickness() const override;
+ Properties properties() const override;
+ void getUnscaledGlyph(glyph_t glyph, QPainterPath *path, glyph_metrics_t *metrics) override;
+ FaceId faceId() const override;
+ bool getSfntTableData(uint tag, uchar *buffer, uint *length) const override;
+ int synthesized() const override;
+ QFixed emSquareSize() const override;
+
+ glyph_t glyphIndex(uint ucs4) const override;
+ bool stringToCMap(const QChar *str, int len, QGlyphLayout *glyphs, int *nglyphs, ShaperFlags flags) const override;
+ void recalcAdvances(QGlyphLayout *glyphs, ShaperFlags) const override;
+
+ void addOutlineToPath(qreal x, qreal y, const QGlyphLayout &glyphs, QPainterPath *path, QTextItem::RenderFlags flags) override;
virtual void addGlyphsToPath(glyph_t *glyphs, QFixedPoint *positions, int nglyphs,
- QPainterPath *path, QTextItem::RenderFlags flags) Q_DECL_OVERRIDE;
+ QPainterPath *path, QTextItem::RenderFlags flags) override;
HGDIOBJ selectDesignFont() const;
- glyph_metrics_t boundingBox(const QGlyphLayout &glyphs) Q_DECL_OVERRIDE;
- glyph_metrics_t boundingBox(glyph_t g) Q_DECL_OVERRIDE { return boundingBox(g, QTransform()); }
- glyph_metrics_t boundingBox(glyph_t g, const QTransform &t) Q_DECL_OVERRIDE;
+ glyph_metrics_t boundingBox(const QGlyphLayout &glyphs) override;
+ glyph_metrics_t boundingBox(glyph_t g) override { return boundingBox(g, QTransform()); }
+ glyph_metrics_t boundingBox(glyph_t g, const QTransform &t) override;
- QFixed ascent() const Q_DECL_OVERRIDE;
- QFixed descent() const Q_DECL_OVERRIDE;
- QFixed leading() const Q_DECL_OVERRIDE;
- QFixed xHeight() const Q_DECL_OVERRIDE;
- QFixed capHeight() const Q_DECL_OVERRIDE;
- QFixed averageCharWidth() const Q_DECL_OVERRIDE;
- qreal maxCharWidth() const Q_DECL_OVERRIDE;
- qreal minLeftBearing() const Q_DECL_OVERRIDE;
- qreal minRightBearing() const Q_DECL_OVERRIDE;
+ QFixed ascent() const override;
+ QFixed descent() const override;
+ QFixed leading() const override;
+ QFixed xHeight() const override;
+ QFixed capHeight() const override;
+ QFixed averageCharWidth() const override;
+ qreal maxCharWidth() const override;
+ qreal minLeftBearing() const override;
+ qreal minRightBearing() const override;
- QImage alphaMapForGlyph(glyph_t t) Q_DECL_OVERRIDE { return alphaMapForGlyph(t, QTransform()); }
- QImage alphaMapForGlyph(glyph_t, const QTransform &xform) Q_DECL_OVERRIDE;
- QImage alphaRGBMapForGlyph(glyph_t t, QFixed subPixelPosition, const QTransform &xform) Q_DECL_OVERRIDE;
- glyph_metrics_t alphaMapBoundingBox(glyph_t glyph, QFixed, const QTransform &matrix, GlyphFormat) Q_DECL_OVERRIDE;
+ QImage alphaMapForGlyph(glyph_t t) override { return alphaMapForGlyph(t, QTransform()); }
+ QImage alphaMapForGlyph(glyph_t, const QTransform &xform) override;
+ QImage alphaRGBMapForGlyph(glyph_t t, QFixed subPixelPosition, const QTransform &xform) override;
+ glyph_metrics_t alphaMapBoundingBox(glyph_t glyph, QFixed, const QTransform &matrix, GlyphFormat) override;
- QFontEngine *cloneWithSize(qreal pixelSize) const Q_DECL_OVERRIDE;
- Qt::HANDLE handle() const Q_DECL_OVERRIDE;
- bool supportsTransformation(const QTransform &transform) const Q_DECL_OVERRIDE;
+ QFontEngine *cloneWithSize(qreal pixelSize) const override;
+ Qt::HANDLE handle() const override;
+ bool supportsTransformation(const QTransform &transform) const override;
#ifndef Q_CC_MINGW
- void getGlyphBearings(glyph_t glyph, qreal *leftBearing = 0, qreal *rightBearing = 0) Q_DECL_OVERRIDE;
+ void getGlyphBearings(glyph_t glyph, qreal *leftBearing = 0, qreal *rightBearing = 0) override;
#endif
- bool hasUnreliableGlyphOutline() const Q_DECL_OVERRIDE;
+ bool hasUnreliableGlyphOutline() const override;
int getGlyphIndexes(const QChar *ch, int numChars, QGlyphLayout *glyphs) const;
void getCMap();
@@ -173,7 +173,7 @@ class QWindowsMultiFontEngine : public QFontEngineMulti
public:
explicit QWindowsMultiFontEngine(QFontEngine *fe, int script);
- QFontEngine *loadEngine(int at) Q_DECL_OVERRIDE;
+ QFontEngine *loadEngine(int at) override;
};
QT_END_NAMESPACE
diff --git a/src/platformsupport/fontdatabases/windows/qwindowsfontenginedirectwrite.cpp b/src/platformsupport/fontdatabases/windows/qwindowsfontenginedirectwrite.cpp
index f07e711048..0e017c3b77 100644
--- a/src/platformsupport/fontdatabases/windows/qwindowsfontenginedirectwrite.cpp
+++ b/src/platformsupport/fontdatabases/windows/qwindowsfontenginedirectwrite.cpp
@@ -282,7 +282,7 @@ static UUID uuidIdWriteLocalFontFileLoader()
QString QWindowsFontEngineDirectWrite::filenameFromFontFile(IDWriteFontFile *fontFile)
{
- IDWriteFontFileLoader *loader = Q_NULLPTR;
+ IDWriteFontFileLoader *loader = nullptr;
HRESULT hr = fontFile->GetLoader(&loader);
if (FAILED(hr)) {
@@ -290,11 +290,11 @@ QString QWindowsFontEngineDirectWrite::filenameFromFontFile(IDWriteFontFile *fon
return QString();
}
- QIdWriteLocalFontFileLoader *localLoader = Q_NULLPTR;
+ QIdWriteLocalFontFileLoader *localLoader = nullptr;
hr = loader->QueryInterface(uuidIdWriteLocalFontFileLoader(),
reinterpret_cast<void **>(&localLoader));
- const void *fontFileReferenceKey = Q_NULLPTR;
+ const void *fontFileReferenceKey = nullptr;
UINT32 fontFileReferenceKeySize = 0;
if (SUCCEEDED(hr)) {
hr = fontFile->GetReferenceKey(&fontFileReferenceKey,
@@ -326,10 +326,10 @@ QString QWindowsFontEngineDirectWrite::filenameFromFontFile(IDWriteFontFile *fon
ret = QString::fromWCharArray(filePath.data());
}
- if (localLoader != Q_NULLPTR)
+ if (localLoader != nullptr)
localLoader->Release();
- if (loader != Q_NULLPTR)
+ if (loader != nullptr)
loader->Release();
return ret;
}
@@ -349,7 +349,7 @@ void QWindowsFontEngineDirectWrite::collectMetrics()
m_lineGap = DESIGN_TO_LOGICAL(metrics.lineGap);
m_underlinePosition = DESIGN_TO_LOGICAL(metrics.underlinePosition);
- IDWriteFontFile *fontFile = Q_NULLPTR;
+ IDWriteFontFile *fontFile = nullptr;
UINT32 numberOfFiles = 1;
if (SUCCEEDED(m_directWriteFontFace->GetFiles(&numberOfFiles, &fontFile))) {
m_faceId.filename = QFile::encodeName(filenameFromFontFile(fontFile));
@@ -713,7 +713,7 @@ QImage QWindowsFontEngineDirectWrite::imageForGlyph(glyph_t t,
#if defined(QT_USE_DIRECTWRITE2)
HRESULT hr = DWRITE_E_NOCOLOR;
IDWriteColorGlyphRunEnumerator *enumerator = 0;
- IDWriteFactory2 *factory2 = Q_NULLPTR;
+ IDWriteFactory2 *factory2 = nullptr;
if (glyphFormat == QFontEngine::Format_ARGB
&& SUCCEEDED(m_fontEngineData->directWriteFactory->QueryInterface(__uuidof(IDWriteFactory2),
reinterpret_cast<void **>(&factory2)))) {
diff --git a/src/platformsupport/fontdatabases/windows/qwindowsfontenginedirectwrite_p.h b/src/platformsupport/fontdatabases/windows/qwindowsfontenginedirectwrite_p.h
index db4e79e44f..83fdddfa26 100644
--- a/src/platformsupport/fontdatabases/windows/qwindowsfontenginedirectwrite_p.h
+++ b/src/platformsupport/fontdatabases/windows/qwindowsfontenginedirectwrite_p.h
@@ -80,41 +80,41 @@ public:
void initFontInfo(const QFontDef &request, int dpi);
- QFixed lineThickness() const Q_DECL_OVERRIDE;
- QFixed underlinePosition() const Q_DECL_OVERRIDE;
- bool getSfntTableData(uint tag, uchar *buffer, uint *length) const Q_DECL_OVERRIDE;
- QFixed emSquareSize() const Q_DECL_OVERRIDE;
+ QFixed lineThickness() const override;
+ QFixed underlinePosition() const override;
+ bool getSfntTableData(uint tag, uchar *buffer, uint *length) const override;
+ QFixed emSquareSize() const override;
- glyph_t glyphIndex(uint ucs4) const Q_DECL_OVERRIDE;
+ glyph_t glyphIndex(uint ucs4) const override;
bool stringToCMap(const QChar *str, int len, QGlyphLayout *glyphs, int *nglyphs,
- ShaperFlags flags) const Q_DECL_OVERRIDE;
- void recalcAdvances(QGlyphLayout *glyphs, ShaperFlags) const Q_DECL_OVERRIDE;
+ ShaperFlags flags) const override;
+ void recalcAdvances(QGlyphLayout *glyphs, ShaperFlags) const override;
void addGlyphsToPath(glyph_t *glyphs, QFixedPoint *positions, int nglyphs,
- QPainterPath *path, QTextItem::RenderFlags flags) Q_DECL_OVERRIDE;
+ QPainterPath *path, QTextItem::RenderFlags flags) override;
- glyph_metrics_t boundingBox(const QGlyphLayout &glyphs) Q_DECL_OVERRIDE;
- glyph_metrics_t boundingBox(glyph_t g) Q_DECL_OVERRIDE;
+ glyph_metrics_t boundingBox(const QGlyphLayout &glyphs) override;
+ glyph_metrics_t boundingBox(glyph_t g) override;
glyph_metrics_t alphaMapBoundingBox(glyph_t glyph, QFixed,
- const QTransform &matrix, GlyphFormat) Q_DECL_OVERRIDE;
+ const QTransform &matrix, GlyphFormat) override;
- QFixed ascent() const Q_DECL_OVERRIDE;
- QFixed capHeight() const Q_DECL_OVERRIDE;
- QFixed descent() const Q_DECL_OVERRIDE;
- QFixed leading() const Q_DECL_OVERRIDE;
- QFixed xHeight() const Q_DECL_OVERRIDE;
- qreal maxCharWidth() const Q_DECL_OVERRIDE;
- FaceId faceId() const Q_DECL_OVERRIDE;
+ QFixed ascent() const override;
+ QFixed capHeight() const override;
+ QFixed descent() const override;
+ QFixed leading() const override;
+ QFixed xHeight() const override;
+ qreal maxCharWidth() const override;
+ FaceId faceId() const override;
- bool supportsSubPixelPositions() const Q_DECL_OVERRIDE;
+ bool supportsSubPixelPositions() const override;
- QImage alphaMapForGlyph(glyph_t glyph, QFixed subPixelPosition) Q_DECL_OVERRIDE;
- QImage alphaMapForGlyph(glyph_t glyph, QFixed subPixelPosition, const QTransform &t) Q_DECL_OVERRIDE;
- QImage alphaRGBMapForGlyph(glyph_t t, QFixed subPixelPosition, const QTransform &xform) Q_DECL_OVERRIDE;
- QImage bitmapForGlyph(glyph_t, QFixed subPixelPosition, const QTransform &t) Q_DECL_OVERRIDE;
+ QImage alphaMapForGlyph(glyph_t glyph, QFixed subPixelPosition) override;
+ QImage alphaMapForGlyph(glyph_t glyph, QFixed subPixelPosition, const QTransform &t) override;
+ QImage alphaRGBMapForGlyph(glyph_t t, QFixed subPixelPosition, const QTransform &xform) override;
+ QImage bitmapForGlyph(glyph_t, QFixed subPixelPosition, const QTransform &t) override;
- QFontEngine *cloneWithSize(qreal pixelSize) const Q_DECL_OVERRIDE;
- Qt::HANDLE handle() const Q_DECL_OVERRIDE;
+ QFontEngine *cloneWithSize(qreal pixelSize) const override;
+ Qt::HANDLE handle() const override;
const QSharedPointer<QWindowsFontEngineData> &fontEngineData() const { return m_fontEngineData; }
diff --git a/src/platformsupport/fontdatabases/windows/qwindowsnativeimage.cpp b/src/platformsupport/fontdatabases/windows/qwindowsnativeimage.cpp
index f8fcff952a..67a6619b91 100644
--- a/src/platformsupport/fontdatabases/windows/qwindowsnativeimage.cpp
+++ b/src/platformsupport/fontdatabases/windows/qwindowsnativeimage.cpp
@@ -98,7 +98,7 @@ static inline HBITMAP createDIB(HDC hdc, int width, int height,
bmi.blueMask = 0;
}
- uchar *bits = Q_NULLPTR;
+ uchar *bits = nullptr;
HBITMAP bitmap = CreateDIBSection(hdc, reinterpret_cast<BITMAPINFO *>(&bmi),
DIB_RGB_COLORS, reinterpret_cast<void **>(&bits), 0, 0);
if (Q_UNLIKELY(!bitmap || !bits))
diff --git a/src/platformsupport/graphics/qrasterbackingstore_p.h b/src/platformsupport/graphics/qrasterbackingstore_p.h
index 2764fd6432..357e861d1d 100644
--- a/src/platformsupport/graphics/qrasterbackingstore_p.h
+++ b/src/platformsupport/graphics/qrasterbackingstore_p.h
@@ -62,12 +62,12 @@ public:
QRasterBackingStore(QWindow *window);
~QRasterBackingStore();
- void resize(const QSize &size, const QRegion &staticContents) Q_DECL_OVERRIDE;
- bool scroll(const QRegion &area, int dx, int dy) Q_DECL_OVERRIDE;
- void beginPaint(const QRegion &region) Q_DECL_OVERRIDE;
+ void resize(const QSize &size, const QRegion &staticContents) override;
+ bool scroll(const QRegion &area, int dx, int dy) override;
+ void beginPaint(const QRegion &region) override;
- QPaintDevice *paintDevice() Q_DECL_OVERRIDE;
- QImage toImage() const Q_DECL_OVERRIDE;
+ QPaintDevice *paintDevice() override;
+ QImage toImage() const override;
protected:
virtual QImage::Format format() const;
diff --git a/src/platformsupport/input/evdevkeyboard/qevdevkeyboardhandler.cpp b/src/platformsupport/input/evdevkeyboard/qevdevkeyboardhandler.cpp
index 1046b86ec6..47a65eded8 100644
--- a/src/platformsupport/input/evdevkeyboard/qevdevkeyboardhandler.cpp
+++ b/src/platformsupport/input/evdevkeyboard/qevdevkeyboardhandler.cpp
@@ -74,7 +74,7 @@ void QFdContainer::reset() Q_DECL_NOTHROW
}
QEvdevKeyboardHandler::QEvdevKeyboardHandler(const QString &device, QFdContainer &fd, bool disableZap, bool enableCompose, const QString &keymapFile)
- : m_device(device), m_fd(fd.release()), m_notify(Q_NULLPTR),
+ : m_device(device), m_fd(fd.release()), m_notify(nullptr),
m_modifiers(0), m_composing(0), m_dead_unicode(0xffff),
m_no_zap(disableZap), m_do_compose(enableCompose),
m_keymap(0), m_keymap_size(0), m_keycompose(0), m_keycompose_size(0)
@@ -175,7 +175,7 @@ void QEvdevKeyboardHandler::readKeycode()
// by the above error over and over again.
if (errno == ENODEV) {
delete m_notify;
- m_notify = Q_NULLPTR;
+ m_notify = nullptr;
m_fd.reset();
}
return;
diff --git a/src/platformsupport/input/evdevmouse/qevdevmousehandler.cpp b/src/platformsupport/input/evdevmouse/qevdevmousehandler.cpp
index 8614de066f..04372ae4d9 100644
--- a/src/platformsupport/input/evdevmouse/qevdevmousehandler.cpp
+++ b/src/platformsupport/input/evdevmouse/qevdevmousehandler.cpp
@@ -184,7 +184,7 @@ void QEvdevMouseHandler::sendMouseEvent()
m_prevInvalid = false;
}
- emit handleMouseEvent(x, y, m_abs, m_buttons);
+ emit handleMouseEvent(x, y, m_abs, m_buttons, m_button, m_eventType);
m_prevx = m_x;
m_prevy = m_y;
@@ -210,7 +210,7 @@ void QEvdevMouseHandler::readMouseData()
// by the above error over and over again.
if (errno == ENODEV) {
delete m_notify;
- m_notify = Q_NULLPTR;
+ m_notify = nullptr;
qt_safe_close(m_fd);
m_fd = -1;
}
@@ -286,6 +286,8 @@ void QEvdevMouseHandler::readMouseData()
case 0x11f: button = Qt::ExtraButton13; break;
}
m_buttons.setFlag(button, data->value);
+ m_button = button;
+ m_eventType = data->value == 0 ? QEvent::MouseButtonRelease : QEvent::MouseButtonPress;
btnChanged = true;
} else if (data->type == EV_SYN && data->code == SYN_REPORT) {
if (btnChanged) {
@@ -293,6 +295,7 @@ void QEvdevMouseHandler::readMouseData()
sendMouseEvent();
pendingMouseEvent = false;
} else if (posChanged) {
+ m_eventType = QEvent::MouseMove;
posChanged = false;
if (m_compression) {
pendingMouseEvent = true;
diff --git a/src/platformsupport/input/evdevmouse/qevdevmousehandler_p.h b/src/platformsupport/input/evdevmouse/qevdevmousehandler_p.h
index 6cad4b9173..c7f2b04eb2 100644
--- a/src/platformsupport/input/evdevmouse/qevdevmousehandler_p.h
+++ b/src/platformsupport/input/evdevmouse/qevdevmousehandler_p.h
@@ -54,6 +54,7 @@
#include <QObject>
#include <QString>
#include <QPoint>
+#include <QEvent>
QT_BEGIN_NAMESPACE
@@ -69,7 +70,8 @@ public:
void readMouseData();
signals:
- void handleMouseEvent(int x, int y, bool abs, Qt::MouseButtons buttons);
+ void handleMouseEvent(int x, int y, bool abs, Qt::MouseButtons buttons,
+ Qt::MouseButton button, QEvent::Type type);
void handleWheelEvent(QPoint delta);
private:
@@ -86,6 +88,8 @@ private:
bool m_abs;
bool m_compression;
Qt::MouseButtons m_buttons;
+ Qt::MouseButton m_button;
+ QEvent::Type m_eventType;
int m_jitterLimitSquared;
bool m_prevInvalid;
int m_hardwareWidth;
diff --git a/src/platformsupport/input/evdevmouse/qevdevmousemanager.cpp b/src/platformsupport/input/evdevmouse/qevdevmousemanager.cpp
index ba94bcd460..5264736dd6 100644
--- a/src/platformsupport/input/evdevmouse/qevdevmousemanager.cpp
+++ b/src/platformsupport/input/evdevmouse/qevdevmousemanager.cpp
@@ -131,7 +131,8 @@ void QEvdevMouseManager::clampPosition()
m_y = g.bottom() - m_yoffset;
}
-void QEvdevMouseManager::handleMouseEvent(int x, int y, bool abs, Qt::MouseButtons buttons)
+void QEvdevMouseManager::handleMouseEvent(int x, int y, bool abs, Qt::MouseButtons buttons,
+ Qt::MouseButton button, QEvent::Type type)
{
// update current absolute coordinates
if (!abs) {
@@ -147,7 +148,8 @@ void QEvdevMouseManager::handleMouseEvent(int x, int y, bool abs, Qt::MouseButto
QPoint pos(m_x + m_xoffset, m_y + m_yoffset);
// Cannot track the keyboard modifiers ourselves here. Instead, report the
// modifiers from the last key event that has been seen by QGuiApplication.
- QWindowSystemInterface::handleMouseEvent(0, pos, pos, buttons, QGuiApplication::keyboardModifiers());
+ Qt::KeyboardModifiers mods = QGuiApplication::keyboardModifiers();
+ QWindowSystemInterface::handleMouseEvent(0, pos, pos, buttons, button, type, mods);
}
void QEvdevMouseManager::handleWheelEvent(QPoint delta)
diff --git a/src/platformsupport/input/evdevmouse/qevdevmousemanager_p.h b/src/platformsupport/input/evdevmouse/qevdevmousemanager_p.h
index 10703655b3..13a8e3dec5 100644
--- a/src/platformsupport/input/evdevmouse/qevdevmousemanager_p.h
+++ b/src/platformsupport/input/evdevmouse/qevdevmousemanager_p.h
@@ -68,7 +68,8 @@ public:
QEvdevMouseManager(const QString &key, const QString &specification, QObject *parent = 0);
~QEvdevMouseManager();
- void handleMouseEvent(int x, int y, bool abs, Qt::MouseButtons buttons);
+ void handleMouseEvent(int x, int y, bool abs, Qt::MouseButtons buttons,
+ Qt::MouseButton button, QEvent::Type type);
void handleWheelEvent(QPoint delta);
void addMouse(const QString &deviceNode = QString());
diff --git a/src/platformsupport/input/evdevtablet/qevdevtablethandler_p.h b/src/platformsupport/input/evdevtablet/qevdevtablethandler_p.h
index 8d848d6ebb..66e821117a 100644
--- a/src/platformsupport/input/evdevtablet/qevdevtablethandler_p.h
+++ b/src/platformsupport/input/evdevtablet/qevdevtablethandler_p.h
@@ -85,7 +85,7 @@ class QEvdevTabletHandlerThread : public QDaemonThread
public:
explicit QEvdevTabletHandlerThread(const QString &device, const QString &spec, QObject *parent = 0);
~QEvdevTabletHandlerThread();
- void run() Q_DECL_OVERRIDE;
+ void run() override;
QEvdevTabletHandler *handler() { return m_handler; }
private:
diff --git a/src/platformsupport/input/evdevtouch/qevdevtouchhandler.cpp b/src/platformsupport/input/evdevtouch/qevdevtouchhandler.cpp
index c7595cf2b3..0ab4c65c45 100644
--- a/src/platformsupport/input/evdevtouch/qevdevtouchhandler.cpp
+++ b/src/platformsupport/input/evdevtouch/qevdevtouchhandler.cpp
@@ -192,9 +192,9 @@ static inline bool testBit(long bit, const long *array)
#endif
QEvdevTouchScreenHandler::QEvdevTouchScreenHandler(const QString &device, const QString &spec, QObject *parent)
- : QObject(parent), m_notify(Q_NULLPTR), m_fd(-1), d(Q_NULLPTR), m_device(Q_NULLPTR)
+ : QObject(parent), m_notify(nullptr), m_fd(-1), d(nullptr), m_device(nullptr)
#if QT_CONFIG(mtdev)
- , m_mtdev(Q_NULLPTR)
+ , m_mtdev(nullptr)
#endif
{
setObjectName(QLatin1String("Evdev Touch Handler"));
@@ -427,7 +427,7 @@ err:
qErrnoWarning(errno, "evdevtouch: Could not read from input device");
if (errno == ENODEV) { // device got disconnected -> stop reading
delete m_notify;
- m_notify = Q_NULLPTR;
+ m_notify = nullptr;
QT_CLOSE(m_fd);
m_fd = -1;
@@ -466,7 +466,7 @@ void QEvdevTouchScreenHandler::unregisterTouchDevice()
delete m_device;
}
- m_device = Q_NULLPTR;
+ m_device = nullptr;
}
void QEvdevTouchScreenData::addTouchPoint(const Contact &contact, Qt::TouchPointStates *combinedStates)
@@ -781,13 +781,13 @@ void QEvdevTouchScreenData::reportPoints()
if (m_filtered)
emit q->touchPointsUpdated();
else
- QWindowSystemInterface::handleTouchEvent(Q_NULLPTR, q->touchDevice(), m_touchPoints);
+ QWindowSystemInterface::handleTouchEvent(nullptr, q->touchDevice(), m_touchPoints);
}
QEvdevTouchScreenHandlerThread::QEvdevTouchScreenHandlerThread(const QString &device, const QString &spec, QObject *parent)
- : QDaemonThread(parent), m_device(device), m_spec(spec), m_handler(Q_NULLPTR), m_touchDeviceRegistered(false)
+ : QDaemonThread(parent), m_device(device), m_spec(spec), m_handler(nullptr), m_touchDeviceRegistered(false)
, m_touchUpdatePending(false)
- , m_filterWindow(Q_NULLPTR)
+ , m_filterWindow(nullptr)
, m_touchRate(-1)
{
start();
@@ -812,7 +812,7 @@ void QEvdevTouchScreenHandlerThread::run()
exec();
delete m_handler;
- m_handler = Q_NULLPTR;
+ m_handler = nullptr;
}
bool QEvdevTouchScreenHandlerThread::isTouchDeviceRegistered() const
@@ -953,7 +953,7 @@ void QEvdevTouchScreenHandlerThread::filterAndSendTouchPoints()
m_filteredPoints = filteredPoints;
- QWindowSystemInterface::handleTouchEvent(Q_NULLPTR,
+ QWindowSystemInterface::handleTouchEvent(nullptr,
m_handler->touchDevice(),
points);
}
diff --git a/src/platformsupport/input/evdevtouch/qevdevtouchhandler_p.h b/src/platformsupport/input/evdevtouch/qevdevtouchhandler_p.h
index a0b689a89e..56308d0352 100644
--- a/src/platformsupport/input/evdevtouch/qevdevtouchhandler_p.h
+++ b/src/platformsupport/input/evdevtouch/qevdevtouchhandler_p.h
@@ -75,7 +75,7 @@ class QEvdevTouchScreenHandler : public QObject
Q_OBJECT
public:
- explicit QEvdevTouchScreenHandler(const QString &device, const QString &spec = QString(), QObject *parent = Q_NULLPTR);
+ explicit QEvdevTouchScreenHandler(const QString &device, const QString &spec = QString(), QObject *parent = nullptr);
~QEvdevTouchScreenHandler();
QTouchDevice *touchDevice() const;
@@ -107,13 +107,13 @@ class QEvdevTouchScreenHandlerThread : public QDaemonThread
{
Q_OBJECT
public:
- explicit QEvdevTouchScreenHandlerThread(const QString &device, const QString &spec, QObject *parent = Q_NULLPTR);
+ explicit QEvdevTouchScreenHandlerThread(const QString &device, const QString &spec, QObject *parent = nullptr);
~QEvdevTouchScreenHandlerThread();
- void run() Q_DECL_OVERRIDE;
+ void run() override;
bool isTouchDeviceRegistered() const;
- bool eventFilter(QObject *object, QEvent *event) Q_DECL_OVERRIDE;
+ bool eventFilter(QObject *object, QEvent *event) override;
void scheduleTouchPointUpdate();
diff --git a/src/platformsupport/input/integrityhid/qintegrityhidmanager.cpp b/src/platformsupport/input/integrityhid/qintegrityhidmanager.cpp
index 8089a6e38b..e472693077 100644
--- a/src/platformsupport/input/integrityhid/qintegrityhidmanager.cpp
+++ b/src/platformsupport/input/integrityhid/qintegrityhidmanager.cpp
@@ -75,8 +75,8 @@ public:
{
CheckSuccess(gh_hid_close(handle));
};
- void process_event(void) Q_DECL_OVERRIDE;
- void async_wait(void) Q_DECL_OVERRIDE;
+ void process_event(void) override;
+ void async_wait(void) override;
HIDDriver *get_driver(void) { return driver; };
HIDHandle get_handle(void) { return handle; };
private:
@@ -94,8 +94,8 @@ public:
{
qDeleteAll(devices);
};
- void process_event(void) Q_DECL_OVERRIDE;
- void async_wait(void) Q_DECL_OVERRIDE;
+ void process_event(void) override;
+ void async_wait(void) override;
void find_devices(void);
private:
QHash<Value, HIDDeviceHandler *> devices;
diff --git a/src/platformsupport/input/libinput/qlibinputhandler.cpp b/src/platformsupport/input/libinput/qlibinputhandler.cpp
index 733cf7d409..52eaa18f4b 100644
--- a/src/platformsupport/input/libinput/qlibinputhandler.cpp
+++ b/src/platformsupport/input/libinput/qlibinputhandler.cpp
@@ -94,7 +94,7 @@ QLibInputHandler::QLibInputHandler(const QString &key, const QString &spec)
if (Q_UNLIKELY(!m_udev))
qFatal("Failed to get udev context for libinput");
- m_li = libinput_udev_create_context(&liInterface, Q_NULLPTR, m_udev);
+ m_li = libinput_udev_create_context(&liInterface, nullptr, m_udev);
if (Q_UNLIKELY(!m_li))
qFatal("Failed to get libinput context");
@@ -140,7 +140,7 @@ void QLibInputHandler::onReadyRead()
}
libinput_event *ev;
- while ((ev = libinput_get_event(m_li)) != Q_NULLPTR) {
+ while ((ev = libinput_get_event(m_li)) != nullptr) {
processEvent(ev);
libinput_event_destroy(ev);
}
diff --git a/src/platformsupport/input/libinput/qlibinputkeyboard.cpp b/src/platformsupport/input/libinput/qlibinputkeyboard.cpp
index 3722c1ceca..54af8a5b0c 100644
--- a/src/platformsupport/input/libinput/qlibinputkeyboard.cpp
+++ b/src/platformsupport/input/libinput/qlibinputkeyboard.cpp
@@ -145,7 +145,7 @@ QLibInputKeyboard::QLibInputKeyboard()
qWarning("Failed to create xkb context");
return;
}
- m_keymap = xkb_keymap_new_from_names(m_ctx, Q_NULLPTR, XKB_KEYMAP_COMPILE_NO_FLAGS);
+ m_keymap = xkb_keymap_new_from_names(m_ctx, nullptr, XKB_KEYMAP_COMPILE_NO_FLAGS);
if (!m_keymap) {
qWarning("Failed to compile keymap");
return;
@@ -216,8 +216,7 @@ void QLibInputKeyboard::processKey(libinput_event_keyboard *e)
xkb_state_update_key(m_state, k, pressed ? XKB_KEY_DOWN : XKB_KEY_UP);
QGuiApplicationPrivate::inputDeviceManager()->setKeyboardModifiers(mods, qtkey);
-
- QWindowSystemInterface::handleExtendedKeyEvent(Q_NULLPTR,
+ QWindowSystemInterface::handleExtendedKeyEvent(nullptr,
pressed ? QEvent::KeyPress : QEvent::KeyRelease,
qtkey, mods, k, sym, mods, text);
@@ -243,7 +242,7 @@ void QLibInputKeyboard::processKey(libinput_event_keyboard *e)
#ifndef QT_NO_XKBCOMMON_EVDEV
void QLibInputKeyboard::handleRepeat()
{
- QWindowSystemInterface::handleExtendedKeyEvent(Q_NULLPTR, QEvent::KeyPress,
+ QWindowSystemInterface::handleExtendedKeyEvent(nullptr, QEvent::KeyPress,
m_repeatData.qtkey, m_repeatData.mods,
m_repeatData.nativeScanCode, m_repeatData.virtualKey, m_repeatData.nativeMods,
m_repeatData.unicodeText, true, m_repeatData.repeatCount);
diff --git a/src/platformsupport/input/libinput/qlibinputpointer.cpp b/src/platformsupport/input/libinput/qlibinputpointer.cpp
index 7ac4dbf6f3..cb08ab53b2 100644
--- a/src/platformsupport/input/libinput/qlibinputpointer.cpp
+++ b/src/platformsupport/input/libinput/qlibinputpointer.cpp
@@ -39,6 +39,7 @@
#include "qlibinputpointer_p.h"
#include <libinput.h>
+#include <QtCore/QEvent>
#include <QtGui/QGuiApplication>
#include <QtGui/QScreen>
#include <QtGui/private/qguiapplication_p.h>
@@ -80,8 +81,10 @@ void QLibInputPointer::processButton(libinput_event_pointer *e)
m_buttons.setFlag(button, pressed);
- QWindowSystemInterface::handleMouseEvent(Q_NULLPTR, m_pos, m_pos, m_buttons,
- QGuiApplicationPrivate::inputDeviceManager()->keyboardModifiers());
+ QEvent::Type type = pressed ? QEvent::MouseButtonPress : QEvent::MouseButtonRelease;
+ Qt::KeyboardModifiers mods = QGuiApplicationPrivate::inputDeviceManager()->keyboardModifiers();
+
+ QWindowSystemInterface::handleMouseEvent(nullptr, m_pos, m_pos, m_buttons, button, type, mods);
}
void QLibInputPointer::processMotion(libinput_event_pointer *e)
@@ -94,8 +97,10 @@ void QLibInputPointer::processMotion(libinput_event_pointer *e)
m_pos.setX(qBound(g.left(), qRound(m_pos.x() + dx), g.right()));
m_pos.setY(qBound(g.top(), qRound(m_pos.y() + dy), g.bottom()));
- QWindowSystemInterface::handleMouseEvent(Q_NULLPTR, m_pos, m_pos, m_buttons,
- QGuiApplicationPrivate::inputDeviceManager()->keyboardModifiers());
+ Qt::KeyboardModifiers mods = QGuiApplicationPrivate::inputDeviceManager()->keyboardModifiers();
+
+ QWindowSystemInterface::handleMouseEvent(nullptr, m_pos, m_pos, m_buttons,
+ Qt::NoButton, QEvent::MouseMove, mods);
}
void QLibInputPointer::processAxis(libinput_event_pointer *e)
diff --git a/src/platformsupport/input/libinput/qlibinputtouch.cpp b/src/platformsupport/input/libinput/qlibinputtouch.cpp
index 42925a18e1..a65bc91c39 100644
--- a/src/platformsupport/input/libinput/qlibinputtouch.cpp
+++ b/src/platformsupport/input/libinput/qlibinputtouch.cpp
@@ -53,7 +53,7 @@ QWindowSystemInterface::TouchPoint *QLibInputTouch::DeviceState::point(int32_t s
if (m_points.at(i).id == id)
return &m_points[i];
- return Q_NULLPTR;
+ return nullptr;
}
QLibInputTouch::DeviceState *QLibInputTouch::deviceState(libinput_event_touch *e)
@@ -150,7 +150,7 @@ void QLibInputTouch::processTouchCancel(libinput_event_touch *e)
{
DeviceState *state = deviceState(e);
if (state->m_touchDevice)
- QWindowSystemInterface::handleTouchCancelEvent(Q_NULLPTR, state->m_touchDevice, QGuiApplication::keyboardModifiers());
+ QWindowSystemInterface::handleTouchCancelEvent(nullptr, state->m_touchDevice, QGuiApplication::keyboardModifiers());
else
qWarning("TouchCancel without registered device");
}
@@ -165,7 +165,7 @@ void QLibInputTouch::processTouchFrame(libinput_event_touch *e)
if (state->m_points.isEmpty())
return;
- QWindowSystemInterface::handleTouchEvent(Q_NULLPTR, state->m_touchDevice, state->m_points,
+ QWindowSystemInterface::handleTouchEvent(nullptr, state->m_touchDevice, state->m_points,
QGuiApplication::keyboardModifiers());
for (int i = 0; i < state->m_points.count(); ++i) {
diff --git a/src/platformsupport/kmsconvenience/qkmsdevice.cpp b/src/platformsupport/kmsconvenience/qkmsdevice.cpp
index a25a1e582f..59db3da776 100644
--- a/src/platformsupport/kmsconvenience/qkmsdevice.cpp
+++ b/src/platformsupport/kmsconvenience/qkmsdevice.cpp
@@ -1,6 +1,6 @@
/****************************************************************************
**
-** Copyright (C) 2016 The Qt Company Ltd.
+** Copyright (C) 2017 The Qt Company Ltd.
** Copyright (C) 2016 Pelagicore AG
** Copyright (C) 2015 Pier Luigi Fiorini <pierluigi.fiorini@gmail.com>
** Contact: https://www.qt.io/licensing/
@@ -47,6 +47,8 @@
#include <QtCore/QFile>
#include <QtCore/QLoggingCategory>
+#include <errno.h>
+
#define ARRAY_LENGTH(a) (sizeof (a) / sizeof (a)[0])
QT_BEGIN_NAMESPACE
@@ -75,7 +77,7 @@ int QKmsDevice::crtcForConnector(drmModeResPtr resources, drmModeConnectorPtr co
for (int j = 0; j < resources->count_crtcs; j++) {
bool isPossible = possibleCrtcs & (1 << j);
- bool isAvailable = !(m_crtc_allocator & 1 << resources->crtcs[j]);
+ bool isAvailable = !(m_crtc_allocator & (1 << j));
if (isPossible && isAvailable)
return j;
@@ -162,22 +164,24 @@ static bool parseModeline(const QByteArray &text, drmModeModeInfoPtr mode)
QPlatformScreen *QKmsDevice::createScreenForConnector(drmModeResPtr resources,
drmModeConnectorPtr connector,
- VirtualDesktopInfo *vinfo)
+ ScreenInfo *vinfo)
{
+ Q_ASSERT(vinfo);
const QByteArray connectorName = nameForConnector(connector);
const int crtc = crtcForConnector(resources, connector);
if (crtc < 0) {
qWarning() << "No usable crtc/encoder pair for connector" << connectorName;
- return Q_NULLPTR;
+ return nullptr;
}
OutputConfiguration configuration;
QSize configurationSize;
+ int configurationRefresh = 0;
drmModeModeInfo configurationModeline;
auto userConfig = m_screenConfig->outputSettings();
- auto userConnectorConfig = userConfig.value(QString::fromUtf8(connectorName));
+ QVariantMap userConnectorConfig = userConfig.value(QString::fromUtf8(connectorName));
// default to the preferred mode unless overridden in the config
const QByteArray mode = userConnectorConfig.value(QStringLiteral("mode"), QStringLiteral("preferred"))
.toByteArray().toLower();
@@ -187,6 +191,10 @@ QPlatformScreen *QKmsDevice::createScreenForConnector(drmModeResPtr resources,
configuration = OutputConfigPreferred;
} else if (mode == "current") {
configuration = OutputConfigCurrent;
+ } else if (sscanf(mode.constData(), "%dx%d@%d", &configurationSize.rwidth(), &configurationSize.rheight(),
+ &configurationRefresh) == 3)
+ {
+ configuration = OutputConfigMode;
} else if (sscanf(mode.constData(), "%dx%d", &configurationSize.rwidth(), &configurationSize.rheight()) == 2) {
configuration = OutputConfigMode;
} else if (parseModeline(mode, &configurationModeline)) {
@@ -195,31 +203,30 @@ QPlatformScreen *QKmsDevice::createScreenForConnector(drmModeResPtr resources,
qWarning("Invalid mode \"%s\" for output %s", mode.constData(), connectorName.constData());
configuration = OutputConfigPreferred;
}
- if (vinfo) {
- *vinfo = VirtualDesktopInfo();
- vinfo->virtualIndex = userConnectorConfig.value(QStringLiteral("virtualIndex"), INT_MAX).toInt();
- if (userConnectorConfig.contains(QStringLiteral("virtualPos"))) {
- const QByteArray vpos = userConnectorConfig.value(QStringLiteral("virtualPos")).toByteArray();
- const QByteArrayList vposComp = vpos.split(',');
- if (vposComp.count() == 2)
- vinfo->virtualPos = QPoint(vposComp[0].trimmed().toInt(), vposComp[1].trimmed().toInt());
- }
- if (userConnectorConfig.value(QStringLiteral("primary")).toBool())
- vinfo->isPrimary = true;
+
+ *vinfo = ScreenInfo();
+ vinfo->virtualIndex = userConnectorConfig.value(QStringLiteral("virtualIndex"), INT_MAX).toInt();
+ if (userConnectorConfig.contains(QStringLiteral("virtualPos"))) {
+ const QByteArray vpos = userConnectorConfig.value(QStringLiteral("virtualPos")).toByteArray();
+ const QByteArrayList vposComp = vpos.split(',');
+ if (vposComp.count() == 2)
+ vinfo->virtualPos = QPoint(vposComp[0].trimmed().toInt(), vposComp[1].trimmed().toInt());
}
+ if (userConnectorConfig.value(QStringLiteral("primary")).toBool())
+ vinfo->isPrimary = true;
const uint32_t crtc_id = resources->crtcs[crtc];
if (configuration == OutputConfigOff) {
qCDebug(qLcKmsDebug) << "Turning off output" << connectorName;
- drmModeSetCrtc(m_dri_fd, crtc_id, 0, 0, 0, 0, 0, Q_NULLPTR);
- return Q_NULLPTR;
+ drmModeSetCrtc(m_dri_fd, crtc_id, 0, 0, 0, 0, 0, nullptr);
+ return nullptr;
}
// Skip disconnected output
if (configuration == OutputConfigPreferred && connector->connection == DRM_MODE_DISCONNECTED) {
qCDebug(qLcKmsDebug) << "Skipping disconnected output" << connectorName;
- return Q_NULLPTR;
+ return nullptr;
}
// Get the current mode on the current crtc
@@ -230,7 +237,7 @@ QPlatformScreen *QKmsDevice::createScreenForConnector(drmModeResPtr resources,
drmModeFreeEncoder(encoder);
if (!crtc)
- return Q_NULLPTR;
+ return nullptr;
if (crtc->mode_valid)
crtc_mode = crtc->mode;
@@ -240,7 +247,8 @@ QPlatformScreen *QKmsDevice::createScreenForConnector(drmModeResPtr resources,
QList<drmModeModeInfo> modes;
modes.reserve(connector->count_modes);
- qCDebug(qLcKmsDebug) << connectorName << "mode count:" << connector->count_modes;
+ qCDebug(qLcKmsDebug) << connectorName << "mode count:" << connector->count_modes
+ << "crtc index:" << crtc << "crtc id:" << crtc_id;
for (int i = 0; i < connector->count_modes; i++) {
const drmModeModeInfo &mode = connector->modes[i];
qCDebug(qLcKmsDebug) << "mode" << i << mode.hdisplay << "x" << mode.vdisplay
@@ -256,9 +264,11 @@ QPlatformScreen *QKmsDevice::createScreenForConnector(drmModeResPtr resources,
for (int i = modes.size() - 1; i >= 0; i--) {
const drmModeModeInfo &m = modes.at(i);
- if (configuration == OutputConfigMode &&
- m.hdisplay == configurationSize.width() &&
- m.vdisplay == configurationSize.height()) {
+ if (configuration == OutputConfigMode
+ && m.hdisplay == configurationSize.width()
+ && m.vdisplay == configurationSize.height()
+ && (!configurationRefresh || m.vrefresh == uint32_t(configurationRefresh)))
+ {
configured = i;
}
@@ -297,7 +307,7 @@ QPlatformScreen *QKmsDevice::createScreenForConnector(drmModeResPtr resources,
if (selected_mode < 0) {
qWarning() << "No modes available for output" << connectorName;
- return Q_NULLPTR;
+ return nullptr;
} else {
int width = modes[selected_mode].hdisplay;
int height = modes[selected_mode].vdisplay;
@@ -324,24 +334,72 @@ QPlatformScreen *QKmsDevice::createScreenForConnector(drmModeResPtr resources,
}
qCDebug(qLcKmsDebug) << "Physical size is" << physSize << "mm" << "for output" << connectorName;
- QKmsOutput output = {
- QString::fromUtf8(connectorName),
- connector->connector_id,
- crtc_id,
- physSize,
- selected_mode,
- selected_mode,
- false,
- drmModeGetCrtc(m_dri_fd, crtc_id),
- modes,
- connector->subpixel,
- connectorProperty(connector, QByteArrayLiteral("DPMS")),
- connectorPropertyBlob(connector, QByteArrayLiteral("EDID")),
- false,
- 0,
- false
- };
+ const QByteArray formatStr = userConnectorConfig.value(QStringLiteral("format"), QStringLiteral("xrgb8888"))
+ .toByteArray().toLower();
+ uint32_t drmFormat;
+ if (formatStr == "xrgb8888") {
+ drmFormat = DRM_FORMAT_XRGB8888;
+ } else if (formatStr == "xbgr8888") {
+ drmFormat = DRM_FORMAT_XBGR8888;
+ } else if (formatStr == "argb8888") {
+ drmFormat = DRM_FORMAT_ARGB8888;
+ } else if (formatStr == "abgr8888") {
+ drmFormat = DRM_FORMAT_ABGR8888;
+ } else if (formatStr == "rgb565") {
+ drmFormat = DRM_FORMAT_RGB565;
+ } else if (formatStr == "bgr565") {
+ drmFormat = DRM_FORMAT_BGR565;
+ } else if (formatStr == "xrgb2101010") {
+ drmFormat = DRM_FORMAT_XRGB2101010;
+ } else if (formatStr == "xbgr2101010") {
+ drmFormat = DRM_FORMAT_XBGR2101010;
+ } else if (formatStr == "argb2101010") {
+ drmFormat = DRM_FORMAT_ARGB2101010;
+ } else if (formatStr == "abgr2101010") {
+ drmFormat = DRM_FORMAT_ABGR2101010;
+ } else {
+ qWarning("Invalid pixel format \"%s\" for output %s", formatStr.constData(), connectorName.constData());
+ drmFormat = DRM_FORMAT_XRGB8888;
+ }
+
+ const QString cloneSource = userConnectorConfig.value(QStringLiteral("clones")).toString();
+ if (!cloneSource.isEmpty())
+ qCDebug(qLcKmsDebug) << "Output" << connectorName << " clones output " << cloneSource;
+
+ QKmsOutput output;
+ output.name = QString::fromUtf8(connectorName);
+ output.connector_id = connector->connector_id;
+ output.crtc_index = crtc;
+ output.crtc_id = crtc_id;
+ output.physical_size = physSize;
+ output.preferred_mode = preferred >= 0 ? preferred : selected_mode;
+ output.mode = selected_mode;
+ output.mode_set = false;
+ output.saved_crtc = drmModeGetCrtc(m_dri_fd, crtc_id);
+ output.modes = modes;
+ output.subpixel = connector->subpixel;
+ output.dpms_prop = connectorProperty(connector, QByteArrayLiteral("DPMS"));
+ output.edid_blob = connectorPropertyBlob(connector, QByteArrayLiteral("EDID"));
+ output.wants_forced_plane = false;
+ output.forced_plane_id = 0;
+ output.forced_plane_set = false;
+ output.drm_format = drmFormat;
+ output.clone_source = cloneSource;
+
+ QString planeListStr;
+ for (const QKmsPlane &plane : qAsConst(m_planes)) {
+ if (plane.possibleCrtcs & (1 << output.crtc_index)) {
+ output.available_planes.append(plane);
+ planeListStr.append(QString::number(plane.id));
+ planeListStr.append(QLatin1Char(' '));
+ }
+ }
+ qCDebug(qLcKmsDebug, "Output %s can use %d planes: %s",
+ connectorName.constData(), output.available_planes.count(), qPrintable(planeListStr));
+ // This is for the EGLDevice/EGLStream backend. On some of those devices one
+ // may want to target a pre-configured plane. It is probably useless for
+ // eglfs_kms and others. Do not confuse with generic plane support (available_planes).
bool ok;
int idx = qEnvironmentVariableIntValue("QT_QPA_EGLFS_KMS_PLANE_INDEX", &ok);
if (ok) {
@@ -350,8 +408,8 @@ QPlatformScreen *QKmsDevice::createScreenForConnector(drmModeResPtr resources,
if (idx >= 0 && idx < int(planeResources->count_planes)) {
drmModePlane *plane = drmModeGetPlane(m_dri_fd, planeResources->planes[idx]);
if (plane) {
- output.wants_plane = true;
- output.plane_id = plane->plane_id;
+ output.wants_forced_plane = true;
+ output.forced_plane_id = plane->plane_id;
qCDebug(qLcKmsDebug, "Forcing plane index %d, plane id %u (belongs to crtc id %u)",
idx, plane->plane_id, plane->crtc_id);
drmModeFreePlane(plane);
@@ -362,8 +420,9 @@ QPlatformScreen *QKmsDevice::createScreenForConnector(drmModeResPtr resources,
}
}
- m_crtc_allocator |= (1 << output.crtc_id);
- m_connector_allocator |= (1 << output.connector_id);
+ m_crtc_allocator |= (1 << output.crtc_index);
+
+ vinfo->output = output;
return createScreen(output);
}
@@ -381,7 +440,7 @@ drmModePropertyPtr QKmsDevice::connectorProperty(drmModeConnectorPtr connector,
drmModeFreeProperty(prop);
}
- return Q_NULLPTR;
+ return nullptr;
}
drmModePropertyBlobPtr QKmsDevice::connectorPropertyBlob(drmModeConnectorPtr connector, const QByteArray &name)
@@ -406,7 +465,6 @@ QKmsDevice::QKmsDevice(QKmsScreenConfig *screenConfig, const QString &path)
, m_path(path)
, m_dri_fd(-1)
, m_crtc_allocator(0)
- , m_connector_allocator(0)
{
if (m_path.isEmpty()) {
m_path = m_screenConfig->devicePath();
@@ -425,10 +483,10 @@ QKmsDevice::~QKmsDevice()
struct OrderedScreen
{
OrderedScreen() : screen(nullptr) { }
- OrderedScreen(QPlatformScreen *screen, const QKmsDevice::VirtualDesktopInfo &vinfo)
+ OrderedScreen(QPlatformScreen *screen, const QKmsDevice::ScreenInfo &vinfo)
: screen(screen), vinfo(vinfo) { }
QPlatformScreen *screen;
- QKmsDevice::VirtualDesktopInfo vinfo;
+ QKmsDevice::ScreenInfo vinfo;
};
QDebug operator<<(QDebug dbg, const OrderedScreen &s)
@@ -449,12 +507,29 @@ static bool orderedScreenLessThan(const OrderedScreen &a, const OrderedScreen &b
void QKmsDevice::createScreens()
{
+ // Headless mode using a render node: cannot do any output related DRM
+ // stuff. Skip it all and register a dummy screen.
+ if (m_screenConfig->headless()) {
+ QPlatformScreen *screen = createHeadlessScreen();
+ if (screen) {
+ qCDebug(qLcKmsDebug, "Headless mode enabled");
+ registerScreen(screen, true, QPoint(0, 0), QList<QPlatformScreen *>());
+ return;
+ } else {
+ qWarning("QKmsDevice: Requested headless mode without support in the backend. Request is ignored.");
+ }
+ }
+
+ drmSetClientCap(m_dri_fd, DRM_CLIENT_CAP_UNIVERSAL_PLANES, 1);
+
drmModeResPtr resources = drmModeGetResources(m_dri_fd);
if (!resources) {
- qWarning("drmModeGetResources failed");
+ qErrnoWarning(errno, "drmModeGetResources failed");
return;
}
+ discoverPlanes();
+
QVector<OrderedScreen> screens;
int wantedConnectorIndex = -1;
@@ -475,7 +550,7 @@ void QKmsDevice::createScreens()
if (!connector)
continue;
- VirtualDesktopInfo vinfo;
+ ScreenInfo vinfo;
QPlatformScreen *screen = createScreenForConnector(resources, connector, &vinfo);
if (screen)
screens.append(OrderedScreen(screen, vinfo));
@@ -490,6 +565,32 @@ void QKmsDevice::createScreens()
std::stable_sort(screens.begin(), screens.end(), orderedScreenLessThan);
qCDebug(qLcKmsDebug) << "Sorted screen list:" << screens;
+ // The final list of screens is available, so do the second phase setup.
+ // Hook up clone sources and targets.
+ for (const OrderedScreen &orderedScreen : screens) {
+ QVector<QPlatformScreen *> screensCloningThisScreen;
+ for (const OrderedScreen &s : screens) {
+ if (s.vinfo.output.clone_source == orderedScreen.vinfo.output.name)
+ screensCloningThisScreen.append(s.screen);
+ }
+ QPlatformScreen *screenThisScreenClones = nullptr;
+ if (!orderedScreen.vinfo.output.clone_source.isEmpty()) {
+ for (const OrderedScreen &s : screens) {
+ if (s.vinfo.output.name == orderedScreen.vinfo.output.clone_source) {
+ screenThisScreenClones = s.screen;
+ break;
+ }
+ }
+ }
+ if (screenThisScreenClones)
+ qCDebug(qLcKmsDebug) << orderedScreen.screen->name() << "clones" << screenThisScreenClones;
+ if (!screensCloningThisScreen.isEmpty())
+ qCDebug(qLcKmsDebug) << orderedScreen.screen->name() << "is cloned by" << screensCloningThisScreen;
+
+ registerScreenCloning(orderedScreen.screen, screenThisScreenClones, screensCloningThisScreen);
+ }
+
+ // Figure out the virtual desktop and register the screens to QPA/QGuiApplication.
QPoint pos(0, 0);
QList<QPlatformScreen *> siblings;
QVector<QPoint> virtualPositions;
@@ -531,6 +632,132 @@ void QKmsDevice::createScreens()
}
}
+QPlatformScreen *QKmsDevice::createHeadlessScreen()
+{
+ // headless mode not supported by default
+ return nullptr;
+}
+
+// not all subclasses support screen cloning
+void QKmsDevice::registerScreenCloning(QPlatformScreen *screen,
+ QPlatformScreen *screenThisScreenClones,
+ const QVector<QPlatformScreen *> &screensCloningThisScreen)
+{
+ Q_UNUSED(screen);
+ Q_UNUSED(screenThisScreenClones);
+ Q_UNUSED(screensCloningThisScreen);
+}
+
+// drm_property_type_is is not available in old headers
+static inline bool propTypeIs(drmModePropertyPtr prop, uint32_t type)
+{
+ if (prop->flags & DRM_MODE_PROP_EXTENDED_TYPE)
+ return (prop->flags & DRM_MODE_PROP_EXTENDED_TYPE) == type;
+ return prop->flags & type;
+}
+
+void QKmsDevice::enumerateProperties(drmModeObjectPropertiesPtr objProps, PropCallback callback)
+{
+ for (uint32_t propIdx = 0; propIdx < objProps->count_props; ++propIdx) {
+ drmModePropertyPtr prop = drmModeGetProperty(m_dri_fd, objProps->props[propIdx]);
+ if (!prop)
+ continue;
+
+ const quint64 value = objProps->prop_values[propIdx];
+ qCDebug(qLcKmsDebug, " property %d: id = %u name = '%s'", propIdx, prop->prop_id, prop->name);
+
+ if (propTypeIs(prop, DRM_MODE_PROP_SIGNED_RANGE)) {
+ qCDebug(qLcKmsDebug, " type is SIGNED_RANGE, value is %lld, possible values are:", qint64(value));
+ for (int i = 0; i < prop->count_values; ++i)
+ qCDebug(qLcKmsDebug, " %lld", qint64(prop->values[i]));
+ } else if (propTypeIs(prop, DRM_MODE_PROP_RANGE)) {
+ qCDebug(qLcKmsDebug, " type is RANGE, value is %llu, possible values are:", value);
+ for (int i = 0; i < prop->count_values; ++i)
+ qCDebug(qLcKmsDebug, " %llu", quint64(prop->values[i]));
+ } else if (propTypeIs(prop, DRM_MODE_PROP_ENUM)) {
+ qCDebug(qLcKmsDebug, " type is ENUM, value is %llu, possible values are:", value);
+ for (int i = 0; i < prop->count_enums; ++i)
+ qCDebug(qLcKmsDebug, " enum %d: %s - %llu", i, prop->enums[i].name, prop->enums[i].value);
+ } else if (propTypeIs(prop, DRM_MODE_PROP_BITMASK)) {
+ qCDebug(qLcKmsDebug, " type is BITMASK, value is %llu, possible bits are:", value);
+ for (int i = 0; i < prop->count_enums; ++i)
+ qCDebug(qLcKmsDebug, " bitmask %d: %s - %u", i, prop->enums[i].name, 1 << prop->enums[i].value);
+ } else if (propTypeIs(prop, DRM_MODE_PROP_BLOB)) {
+ qCDebug(qLcKmsDebug, " type is BLOB");
+ } else if (propTypeIs(prop, DRM_MODE_PROP_OBJECT)) {
+ qCDebug(qLcKmsDebug, " type is OBJECT");
+ }
+
+ callback(prop, value);
+
+ drmModeFreeProperty(prop);
+ }
+}
+
+void QKmsDevice::discoverPlanes()
+{
+ m_planes.clear();
+
+ drmModePlaneResPtr planeResources = drmModeGetPlaneResources(m_dri_fd);
+ if (!planeResources)
+ return;
+
+ const int countPlanes = planeResources->count_planes;
+ qCDebug(qLcKmsDebug, "Found %d planes", countPlanes);
+ for (int planeIdx = 0; planeIdx < countPlanes; ++planeIdx) {
+ drmModePlanePtr drmplane = drmModeGetPlane(m_dri_fd, planeResources->planes[planeIdx]);
+ if (!drmplane) {
+ qCDebug(qLcKmsDebug, "Failed to query plane %d, ignoring", planeIdx);
+ continue;
+ }
+
+ QKmsPlane plane;
+ plane.id = drmplane->plane_id;
+ plane.possibleCrtcs = drmplane->possible_crtcs;
+
+ const int countFormats = drmplane->count_formats;
+ QString formatStr;
+ for (int i = 0; i < countFormats; ++i) {
+ uint32_t f = drmplane->formats[i];
+ plane.supportedFormats.append(f);
+ QString s;
+ s.sprintf("%c%c%c%c ", f, f >> 8, f >> 16, f >> 24);
+ formatStr += s;
+ }
+
+ qCDebug(qLcKmsDebug, "plane %d: id = %u countFormats = %d possibleCrtcs = 0x%x supported formats = %s",
+ planeIdx, plane.id, countFormats, plane.possibleCrtcs, qPrintable(formatStr));
+
+ drmModeFreePlane(drmplane);
+
+ drmModeObjectPropertiesPtr objProps = drmModeObjectGetProperties(m_dri_fd, plane.id, DRM_MODE_OBJECT_PLANE);
+ if (!objProps) {
+ qCDebug(qLcKmsDebug, "Failed to query plane %d object properties, ignoring", planeIdx);
+ continue;
+ }
+
+ enumerateProperties(objProps, [&plane](drmModePropertyPtr prop, quint64 value) {
+ if (!strcmp(prop->name, "type")) {
+ plane.type = QKmsPlane::Type(value);
+ } else if (!strcmp(prop->name, "rotation")) {
+ plane.initialRotation = QKmsPlane::Rotations(int(value));
+ plane.availableRotations = 0;
+ if (propTypeIs(prop, DRM_MODE_PROP_BITMASK)) {
+ for (int i = 0; i < prop->count_enums; ++i)
+ plane.availableRotations |= QKmsPlane::Rotation(1 << prop->enums[i].value);
+ }
+ plane.rotationPropertyId = prop->prop_id;
+ }
+ });
+
+ m_planes.append(plane);
+
+ drmModeFreeObjectProperties(objProps);
+ }
+
+ drmModeFreePlaneResources(planeResources);
+}
+
int QKmsDevice::fd() const
{
return m_dri_fd;
@@ -552,7 +779,8 @@ QKmsScreenConfig *QKmsDevice::screenConfig() const
}
QKmsScreenConfig::QKmsScreenConfig()
- : m_hwCursor(true)
+ : m_headless(false)
+ , m_hwCursor(true)
, m_separateScreens(false)
, m_pbuffers(false)
, m_virtualDesktopLayout(VirtualDesktopLayoutHorizontal)
@@ -587,6 +815,16 @@ void QKmsScreenConfig::loadConfig()
const QJsonObject object = doc.object();
+ const QString headlessStr = object.value(QLatin1String("headless")).toString();
+ const QByteArray headless = headlessStr.toUtf8();
+ QSize headlessSize;
+ if (sscanf(headless.constData(), "%dx%d", &headlessSize.rwidth(), &headlessSize.rheight()) == 2) {
+ m_headless = true;
+ m_headlessSize = headlessSize;
+ } else {
+ m_headless = false;
+ }
+
m_hwCursor = object.value(QLatin1String("hwcursor")).toBool(m_hwCursor);
m_pbuffers = object.value(QLatin1String("pbuffers")).toBool(m_pbuffers);
m_devicePath = object.value(QLatin1String("device")).toString();
@@ -618,6 +856,7 @@ void QKmsScreenConfig::loadConfig()
}
qCDebug(qLcKmsDebug) << "Requested configuration (some settings may be ignored):\n"
+ << "\theadless:" << m_headless << "\n"
<< "\thwcursor:" << m_hwCursor << "\n"
<< "\tpbuffers:" << m_pbuffers << "\n"
<< "\tseparateScreens:" << m_separateScreens << "\n"
diff --git a/src/platformsupport/kmsconvenience/qkmsdevice_p.h b/src/platformsupport/kmsconvenience/qkmsdevice_p.h
index 964a0b1775..5eecedec39 100644
--- a/src/platformsupport/kmsconvenience/qkmsdevice_p.h
+++ b/src/platformsupport/kmsconvenience/qkmsdevice_p.h
@@ -59,6 +59,42 @@
#include <xf86drm.h>
#include <xf86drmMode.h>
+#include <drm_fourcc.h>
+
+#include <functional>
+
+// In less fortunate cases one may need to build on a system with dev headers
+// from the dark ages. Let's pull a GL and define the missing stuff outselves.
+
+#ifndef DRM_PLANE_TYPE_OVERLAY
+#define DRM_PLANE_TYPE_OVERLAY 0
+#endif
+#ifndef DRM_PLANE_TYPE_PRIMARY
+#define DRM_PLANE_TYPE_PRIMARY 1
+#endif
+#ifndef DRM_PLANE_TYPE_CURSOR
+#define DRM_PLANE_TYPE_CURSOR 2
+#endif
+
+#ifndef DRM_CLIENT_CAP_UNIVERSAL_PLANES
+#define DRM_CLIENT_CAP_UNIVERSAL_PLANES 2
+#endif
+#ifndef DRM_CLIENT_CAP_ATOMIC
+#define DRM_CLIENT_CAP_ATOMIC 3
+#endif
+
+#ifndef DRM_MODE_PROP_EXTENDED_TYPE
+#define DRM_MODE_PROP_EXTENDED_TYPE 0x0000ffc0
+#endif
+#ifndef DRM_MODE_PROP_TYPE
+#define DRM_MODE_PROP_TYPE(n) ((n) << 6)
+#endif
+#ifndef DRM_MODE_PROP_OBJECT
+#define DRM_MODE_PROP_OBJECT DRM_MODE_PROP_TYPE(1)
+#endif
+#ifndef DRM_MODE_PROP_SIGNED_RANGE
+#define DRM_MODE_PROP_SIGNED_RANGE DRM_MODE_PROP_TYPE(2)
+#endif
QT_BEGIN_NAMESPACE
@@ -76,6 +112,8 @@ public:
QString devicePath() const { return m_devicePath; }
+ bool headless() const { return m_headless; }
+ QSize headlessSize() const { return m_headlessSize; }
bool hwCursor() const { return m_hwCursor; }
bool separateScreens() const { return m_separateScreens; }
bool supportsPBuffers() const { return m_pbuffers; }
@@ -87,6 +125,8 @@ private:
void loadConfig();
QString m_devicePath;
+ bool m_headless;
+ QSize m_headlessSize;
bool m_hwCursor;
bool m_separateScreens;
bool m_pbuffers;
@@ -94,23 +134,63 @@ private:
QMap<QString, QVariantMap> m_outputSettings;
};
+// NB! QKmsPlane does not store the current state and offers no functions to
+// change object properties. Any such functionality belongs to subclasses since
+// in some cases atomic operations will be desired where a mere
+// drmModeObjectSetProperty would not be acceptable.
+struct QKmsPlane
+{
+ enum Type {
+ OverlayPlane = DRM_PLANE_TYPE_OVERLAY,
+ PrimaryPlane = DRM_PLANE_TYPE_PRIMARY,
+ CursorPlane = DRM_PLANE_TYPE_CURSOR
+ };
+
+ enum Rotation {
+ Rotation0 = 1 << 0,
+ Rotation90 = 1 << 1,
+ Rotation180 = 1 << 2,
+ Rotation270 = 1 << 3,
+ RotationReflectX = 1 << 4,
+ RotationReflectY = 1 << 5
+ };
+ Q_DECLARE_FLAGS(Rotations, Rotation)
+
+ uint32_t id = 0;
+ Type type = OverlayPlane;
+
+ int possibleCrtcs = 0;
+
+ QVector<uint32_t> supportedFormats;
+
+ Rotations initialRotation = Rotation0;
+ Rotations availableRotations = Rotation0;
+ uint32_t rotationPropertyId = 0;
+};
+
+Q_DECLARE_OPERATORS_FOR_FLAGS(QKmsPlane::Rotations)
+
struct QKmsOutput
{
QString name;
- uint32_t connector_id;
- uint32_t crtc_id;
+ uint32_t connector_id = 0;
+ uint32_t crtc_index = 0;
+ uint32_t crtc_id = 0;
QSizeF physical_size;
- int preferred_mode; // index of preferred mode in list below
- int mode; // index of selected mode in list below
- bool mode_set;
- drmModeCrtcPtr saved_crtc;
+ int preferred_mode = -1; // index of preferred mode in list below
+ int mode = -1; // index of selected mode in list below
+ bool mode_set = false;
+ drmModeCrtcPtr saved_crtc = nullptr;
QList<drmModeModeInfo> modes;
- int subpixel;
- drmModePropertyPtr dpms_prop;
- drmModePropertyBlobPtr edid_blob;
- bool wants_plane;
- uint32_t plane_id;
- bool plane_set;
+ int subpixel = DRM_MODE_SUBPIXEL_UNKNOWN;
+ drmModePropertyPtr dpms_prop = nullptr;
+ drmModePropertyBlobPtr edid_blob = nullptr;
+ bool wants_forced_plane = false;
+ uint32_t forced_plane_id = 0;
+ bool forced_plane_set = false;
+ uint32_t drm_format = DRM_FORMAT_XRGB8888;
+ QString clone_source;
+ QVector<QKmsPlane> available_planes;
void restoreMode(QKmsDevice *device);
void cleanup(QKmsDevice *device);
@@ -121,11 +201,11 @@ struct QKmsOutput
class QKmsDevice
{
public:
- struct VirtualDesktopInfo {
- VirtualDesktopInfo() : virtualIndex(0), isPrimary(false) { }
- int virtualIndex;
+ struct ScreenInfo {
+ int virtualIndex = 0;
QPoint virtualPos;
- bool isPrimary;
+ bool isPrimary = false;
+ QKmsOutput output;
};
QKmsDevice(QKmsScreenConfig *screenConfig, const QString &path = QString());
@@ -144,6 +224,10 @@ public:
protected:
virtual QPlatformScreen *createScreen(const QKmsOutput &output) = 0;
+ virtual QPlatformScreen *createHeadlessScreen();
+ virtual void registerScreenCloning(QPlatformScreen *screen,
+ QPlatformScreen *screenThisScreenClones,
+ const QVector<QPlatformScreen *> &screensCloningThisScreen);
virtual void registerScreen(QPlatformScreen *screen,
bool isPrimary,
const QPoint &virtualPos,
@@ -153,16 +237,20 @@ protected:
int crtcForConnector(drmModeResPtr resources, drmModeConnectorPtr connector);
QPlatformScreen *createScreenForConnector(drmModeResPtr resources,
drmModeConnectorPtr connector,
- VirtualDesktopInfo *vinfo);
+ ScreenInfo *vinfo);
drmModePropertyPtr connectorProperty(drmModeConnectorPtr connector, const QByteArray &name);
drmModePropertyBlobPtr connectorPropertyBlob(drmModeConnectorPtr connector, const QByteArray &name);
+ typedef std::function<void(drmModePropertyPtr, quint64)> PropCallback;
+ void enumerateProperties(drmModeObjectPropertiesPtr objProps, PropCallback callback);
+ void discoverPlanes();
QKmsScreenConfig *m_screenConfig;
QString m_path;
int m_dri_fd;
quint32 m_crtc_allocator;
- quint32 m_connector_allocator;
+
+ QVector<QKmsPlane> m_planes;
private:
Q_DISABLE_COPY(QKmsDevice)
diff --git a/src/platformsupport/linuxaccessibility/bridge_p.h b/src/platformsupport/linuxaccessibility/bridge_p.h
index 1e435ca351..c48bbd3710 100644
--- a/src/platformsupport/linuxaccessibility/bridge_p.h
+++ b/src/platformsupport/linuxaccessibility/bridge_p.h
@@ -74,7 +74,7 @@ public:
virtual ~QSpiAccessibleBridge();
- void notifyAccessibilityUpdate(QAccessibleEvent *event) Q_DECL_OVERRIDE;
+ void notifyAccessibilityUpdate(QAccessibleEvent *event) override;
QDBusConnection dBusConnection() const;
public Q_SLOTS:
diff --git a/src/platformsupport/platformcompositor/qopenglcompositorbackingstore.cpp b/src/platformsupport/platformcompositor/qopenglcompositorbackingstore.cpp
index e938020437..40400e2a19 100644
--- a/src/platformsupport/platformcompositor/qopenglcompositorbackingstore.cpp
+++ b/src/platformsupport/platformcompositor/qopenglcompositorbackingstore.cpp
@@ -196,7 +196,7 @@ void QOpenGLCompositorBackingStore::flush(QWindow *window, const QRegion &region
dstCtx->makeCurrent(dstWin);
updateTexture();
m_textures->clear();
- m_textures->appendTexture(Q_NULLPTR, m_bsTexture, window->geometry());
+ m_textures->appendTexture(nullptr, m_bsTexture, window->geometry());
compositor->update();
}
@@ -233,7 +233,7 @@ void QOpenGLCompositorBackingStore::composeAndFlush(QWindow *window, const QRegi
textures->clipRect(i), textures->flags(i));
updateTexture();
- m_textures->appendTexture(Q_NULLPTR, m_bsTexture, window->geometry());
+ m_textures->appendTexture(nullptr, m_bsTexture, window->geometry());
textures->lock(true);
m_lockedWidgetTextures = textures;
@@ -280,7 +280,7 @@ void QOpenGLCompositorBackingStore::resize(const QSize &size, const QRegion &sta
if (m_bsTexture) {
glDeleteTextures(1, &m_bsTexture);
m_bsTexture = 0;
- m_bsTextureContext = Q_NULLPTR;
+ m_bsTextureContext = nullptr;
}
}
diff --git a/src/platformsupport/platformcompositor/qopenglcompositorbackingstore_p.h b/src/platformsupport/platformcompositor/qopenglcompositorbackingstore_p.h
index da68b90e92..d88738ea8f 100644
--- a/src/platformsupport/platformcompositor/qopenglcompositorbackingstore_p.h
+++ b/src/platformsupport/platformcompositor/qopenglcompositorbackingstore_p.h
@@ -66,17 +66,17 @@ public:
QOpenGLCompositorBackingStore(QWindow *window);
~QOpenGLCompositorBackingStore();
- QPaintDevice *paintDevice() Q_DECL_OVERRIDE;
+ QPaintDevice *paintDevice() override;
- void beginPaint(const QRegion &region) Q_DECL_OVERRIDE;
+ void beginPaint(const QRegion &region) override;
- void flush(QWindow *window, const QRegion &region, const QPoint &offset) Q_DECL_OVERRIDE;
- void resize(const QSize &size, const QRegion &staticContents) Q_DECL_OVERRIDE;
+ void flush(QWindow *window, const QRegion &region, const QPoint &offset) override;
+ void resize(const QSize &size, const QRegion &staticContents) override;
- QImage toImage() const Q_DECL_OVERRIDE;
+ QImage toImage() const override;
void composeAndFlush(QWindow *window, const QRegion &region, const QPoint &offset,
QPlatformTextureList *textures,
- bool translucentBackground) Q_DECL_OVERRIDE;
+ bool translucentBackground) override;
const QPlatformTextureList *textures() const { return m_textures; }
diff --git a/src/platformsupport/platformsupport.pro b/src/platformsupport/platformsupport.pro
index 5549984d6a..7dbb6f6cae 100644
--- a/src/platformsupport/platformsupport.pro
+++ b/src/platformsupport/platformsupport.pro
@@ -16,7 +16,7 @@ qtConfig(evdev)|qtConfig(tslib)|qtConfig(libinput)|qtConfig(integrityhid) {
input.depends += devicediscovery
}
-unix:!darwin: \
+if(unix:!darwin)|qtConfig(xcb): \
SUBDIRS += services
qtConfig(opengl): \
@@ -34,6 +34,7 @@ qtConfig(accessibility) {
SUBDIRS += linuxaccessibility
linuxaccessibility.depends += accessibility
}
+ win32:!winrt: SUBDIRS += windowsuiautomation
}
darwin {
diff --git a/src/platformsupport/services/genericunix/qgenericunixservices.cpp b/src/platformsupport/services/genericunix/qgenericunixservices.cpp
index cdb5d33859..cb1e367b9f 100644
--- a/src/platformsupport/services/genericunix/qgenericunixservices.cpp
+++ b/src/platformsupport/services/genericunix/qgenericunixservices.cpp
@@ -49,6 +49,24 @@
#include <QtCore/QStandardPaths>
#include <QtCore/QUrl>
+#if QT_CONFIG(dbus)
+// These QtCore includes are needed for flatpak support
+#include <QtCore/private/qcore_unix_p.h>
+
+#include <QtCore/QFileInfo>
+#include <QtCore/QUrlQuery>
+
+#include <QtDBus/QDBusConnection>
+#include <QtDBus/QDBusMessage>
+#include <QtDBus/QDBusPendingCall>
+#include <QtDBus/QDBusPendingCallWatcher>
+#include <QtDBus/QDBusPendingReply>
+#include <QtDBus/QDBusUnixFileDescriptor>
+
+#include <fcntl.h>
+
+#endif // QT_CONFIG(dbus)
+
#include <stdlib.h>
QT_BEGIN_NAMESPACE
@@ -153,6 +171,83 @@ static inline bool launch(const QString &launcher, const QUrl &url)
return ok;
}
+#if QT_CONFIG(dbus)
+static inline bool checkRunningUnderFlatpak()
+{
+ return !QStandardPaths::locate(QStandardPaths::RuntimeLocation, QLatin1String("flatpak-info")).isEmpty();
+}
+
+static inline bool flatpakOpenUrl(const QUrl &url)
+{
+ // DBus signature:
+ // OpenURI (IN s parent_window,
+ // IN s uri,
+ // IN a{sv} options,
+ // OUT o handle)
+ // Options:
+ // writable (b) - Whether to allow the chosen application to write to the file.
+ // This key only takes effect the uri points to a local file that is exported in the document portal,
+ // and the chosen application is sandboxed itself.
+
+ QDBusMessage message = QDBusMessage::createMethodCall(QLatin1String("org.freedesktop.portal.Desktop"),
+ QLatin1String("/org/freedesktop/portal/desktop"),
+ QLatin1String("org.freedesktop.portal.OpenURI"),
+ QLatin1String("OpenURI"));
+ // FIXME parent_window_id and handle writable option
+ message << QString() << url.toString() << QVariantMap();
+
+ QDBusPendingReply<QDBusObjectPath> reply = QDBusConnection::sessionBus().call(message);
+ return !reply.isError();
+}
+
+static inline bool flatpakSendEmail(const QUrl &url)
+{
+ // DBus signature:
+ // ComposeEmail (IN s parent_window,
+ // IN a{sv} options,
+ // OUT o handle)
+ // Options:
+ // address (s) - The email address to send to.
+ // subject (s) - The subject for the email.
+ // body (s) - The body for the email.
+ // attachment_fds (ah) - File descriptors for files to attach.
+
+ QUrlQuery urlQuery(url);
+ QVariantMap options;
+ options.insert(QLatin1String("address"), url.path());
+ options.insert(QLatin1String("subject"), urlQuery.queryItemValue(QLatin1String("subject")));
+ options.insert(QLatin1String("body"), urlQuery.queryItemValue(QLatin1String("body")));
+
+ // O_PATH seems to be present since Linux 2.6.39, which is not case of RHEL 6
+#ifdef O_PATH
+ QList<QDBusUnixFileDescriptor> attachments;
+ const QStringList attachmentUris = urlQuery.allQueryItemValues(QLatin1String("attachment"));
+
+ for (const QString &attachmentUri : attachmentUris) {
+ const int fd = qt_safe_open(QFile::encodeName(attachmentUri), O_PATH);
+ if (fd != -1) {
+ QDBusUnixFileDescriptor descriptor(fd);
+ attachments << descriptor;
+ qt_safe_close(fd);
+ }
+ }
+
+ options.insert(QLatin1String("attachment_fds"), QVariant::fromValue(attachments));
+#endif
+
+ QDBusMessage message = QDBusMessage::createMethodCall(QLatin1String("org.freedesktop.portal.Desktop"),
+ QLatin1String("/org/freedesktop/portal/desktop"),
+ QLatin1String("org.freedesktop.portal.Email"),
+ QLatin1String("ComposeEmail"));
+
+ // FIXME parent_window_id
+ message << QString() << options;
+
+ QDBusPendingReply<QDBusObjectPath> reply = QDBusConnection::sessionBus().call(message);
+ return !reply.isError();
+}
+#endif // QT_CONFIG(dbus)
+
QByteArray QGenericUnixServices::desktopEnvironment() const
{
static const QByteArray result = detectDesktopEnvironment();
@@ -161,8 +256,18 @@ QByteArray QGenericUnixServices::desktopEnvironment() const
bool QGenericUnixServices::openUrl(const QUrl &url)
{
- if (url.scheme() == QLatin1String("mailto"))
+ if (url.scheme() == QLatin1String("mailto")) {
+#if QT_CONFIG(dbus)
+ if (checkRunningUnderFlatpak())
+ return flatpakSendEmail(url);
+#endif
return openDocument(url);
+ }
+
+#if QT_CONFIG(dbus)
+ if (checkRunningUnderFlatpak())
+ return flatpakOpenUrl(url);
+#endif
if (m_webBrowser.isEmpty() && !detectWebBrowser(desktopEnvironment(), true, &m_webBrowser)) {
qWarning("Unable to detect a web browser to launch '%s'", qPrintable(url.toString()));
diff --git a/src/platformsupport/services/genericunix/qgenericunixservices_p.h b/src/platformsupport/services/genericunix/qgenericunixservices_p.h
index 205b2e6160..8ac3de6f03 100644
--- a/src/platformsupport/services/genericunix/qgenericunixservices_p.h
+++ b/src/platformsupport/services/genericunix/qgenericunixservices_p.h
@@ -61,10 +61,10 @@ class QGenericUnixServices : public QPlatformServices
public:
QGenericUnixServices() {}
- QByteArray desktopEnvironment() const Q_DECL_OVERRIDE;
+ QByteArray desktopEnvironment() const override;
- bool openUrl(const QUrl &url) Q_DECL_OVERRIDE;
- bool openDocument(const QUrl &url) Q_DECL_OVERRIDE;
+ bool openUrl(const QUrl &url) override;
+ bool openDocument(const QUrl &url) override;
private:
QString m_webBrowser;
diff --git a/src/platformsupport/services/services.pro b/src/platformsupport/services/services.pro
index 91957a0a78..7ff5e8e179 100644
--- a/src/platformsupport/services/services.pro
+++ b/src/platformsupport/services/services.pro
@@ -2,12 +2,13 @@ TARGET = QtServiceSupport
MODULE = service_support
QT = core-private gui-private
+qtConfig(dbus): QT += dbus
+
CONFIG += static internal_module
DEFINES += QT_NO_CAST_FROM_ASCII
PRECOMPILED_HEADER = ../../corelib/global/qt_pch.h
-unix:!darwin: \
- include($$PWD/genericunix/genericunix.pri)
+include($$PWD/genericunix/genericunix.pri)
load(qt_module)
diff --git a/src/platformsupport/themes/genericunix/dbusmenu/qdbusmenuadaptor.cpp b/src/platformsupport/themes/genericunix/dbusmenu/qdbusmenuadaptor.cpp
index 354b9c3a2e..eabb4b4122 100644
--- a/src/platformsupport/themes/genericunix/dbusmenu/qdbusmenuadaptor.cpp
+++ b/src/platformsupport/themes/genericunix/dbusmenu/qdbusmenuadaptor.cpp
@@ -122,7 +122,7 @@ void QDBusMenuAdaptor::Event(int id, const QString &eventId, const QDBusVariant
emit item->hovered();
if (eventId == QLatin1String("closed")) {
// There is no explicit AboutToHide method, so map closed event to aboutToHide method
- const QDBusPlatformMenu *menu = Q_NULLPTR;
+ const QDBusPlatformMenu *menu = nullptr;
if (item)
menu = static_cast<const QDBusPlatformMenu *>(item->menu());
else if (id == 0)
diff --git a/src/platformsupport/themes/genericunix/dbusmenu/qdbusmenubar_p.h b/src/platformsupport/themes/genericunix/dbusmenu/qdbusmenubar_p.h
index 8266a395f5..364e7da4b6 100644
--- a/src/platformsupport/themes/genericunix/dbusmenu/qdbusmenubar_p.h
+++ b/src/platformsupport/themes/genericunix/dbusmenu/qdbusmenubar_p.h
@@ -67,12 +67,12 @@ public:
QDBusMenuBar();
virtual ~QDBusMenuBar();
- void insertMenu(QPlatformMenu *menu, QPlatformMenu *before) Q_DECL_OVERRIDE;
- void removeMenu(QPlatformMenu *menu) Q_DECL_OVERRIDE;
- void syncMenu(QPlatformMenu *menu) Q_DECL_OVERRIDE;
- void handleReparent(QWindow *newParentWindow) Q_DECL_OVERRIDE;
- QPlatformMenu *menuForTag(quintptr tag) const Q_DECL_OVERRIDE;
- QPlatformMenu *createMenu() const Q_DECL_OVERRIDE;
+ void insertMenu(QPlatformMenu *menu, QPlatformMenu *before) override;
+ void removeMenu(QPlatformMenu *menu) override;
+ void syncMenu(QPlatformMenu *menu) override;
+ void handleReparent(QWindow *newParentWindow) override;
+ QPlatformMenu *menuForTag(quintptr tag) const override;
+ QPlatformMenu *createMenu() const override;
private:
QDBusPlatformMenu *m_menu;
diff --git a/src/platformsupport/themes/genericunix/dbusmenu/qdbusplatformmenu.cpp b/src/platformsupport/themes/genericunix/dbusmenu/qdbusplatformmenu.cpp
index 51c690d43a..fc1b37f2f2 100644
--- a/src/platformsupport/themes/genericunix/dbusmenu/qdbusplatformmenu.cpp
+++ b/src/platformsupport/themes/genericunix/dbusmenu/qdbusplatformmenu.cpp
@@ -68,7 +68,7 @@ QDBusPlatformMenuItem::~QDBusPlatformMenuItem()
{
menuItemsByID.remove(m_dbusID);
if (m_subMenu)
- static_cast<QDBusPlatformMenu *>(m_subMenu)->setContainingMenuItem(Q_NULLPTR);
+ static_cast<QDBusPlatformMenu *>(m_subMenu)->setContainingMenuItem(nullptr);
}
void QDBusPlatformMenuItem::setText(const QString &text)
@@ -88,7 +88,7 @@ void QDBusPlatformMenuItem::setIcon(const QIcon &icon)
void QDBusPlatformMenuItem::setMenu(QPlatformMenu *menu)
{
if (m_subMenu)
- static_cast<QDBusPlatformMenu *>(m_subMenu)->setContainingMenuItem(Q_NULLPTR);
+ static_cast<QDBusPlatformMenu *>(m_subMenu)->setContainingMenuItem(nullptr);
m_subMenu = menu;
if (menu)
static_cast<QDBusPlatformMenu *>(menu)->setContainingMenuItem(this);
@@ -147,7 +147,7 @@ QDBusPlatformMenuItem *QDBusPlatformMenuItem::byId(int id)
// a default-constructed nullptr value into menuItemsByID
if (menuItemsByID.contains(id))
return menuItemsByID[id];
- return Q_NULLPTR;
+ return nullptr;
}
QList<const QDBusPlatformMenuItem *> QDBusPlatformMenuItem::byIds(const QList<int> &ids)
@@ -165,14 +165,14 @@ QDBusPlatformMenu::QDBusPlatformMenu()
: m_isEnabled(true)
, m_isVisible(true)
, m_revision(1)
- , m_containingMenuItem(Q_NULLPTR)
+ , m_containingMenuItem(nullptr)
{
}
QDBusPlatformMenu::~QDBusPlatformMenu()
{
if (m_containingMenuItem)
- m_containingMenuItem->setMenu(Q_NULLPTR);
+ m_containingMenuItem->setMenu(nullptr);
}
void QDBusPlatformMenu::insertMenuItem(QPlatformMenuItem *menuItem, QPlatformMenuItem *before)
diff --git a/src/platformsupport/themes/genericunix/dbusmenu/qdbusplatformmenu_p.h b/src/platformsupport/themes/genericunix/dbusmenu/qdbusplatformmenu_p.h
index 5458e2fdd5..8a31f82fb0 100644
--- a/src/platformsupport/themes/genericunix/dbusmenu/qdbusplatformmenu_p.h
+++ b/src/platformsupport/themes/genericunix/dbusmenu/qdbusplatformmenu_p.h
@@ -77,31 +77,31 @@ public:
~QDBusPlatformMenuItem();
const QString text() const { return m_text; }
- void setText(const QString &text) Q_DECL_OVERRIDE;
+ void setText(const QString &text) override;
QIcon icon() const { return m_icon; }
- void setIcon(const QIcon &icon) Q_DECL_OVERRIDE;
+ void setIcon(const QIcon &icon) override;
const QPlatformMenu *menu() const { return m_subMenu; }
- void setMenu(QPlatformMenu *menu) Q_DECL_OVERRIDE;
+ void setMenu(QPlatformMenu *menu) override;
bool isEnabled() const { return m_isEnabled; }
- void setEnabled(bool enabled) Q_DECL_OVERRIDE;
+ void setEnabled(bool enabled) override;
bool isVisible() const { return m_isVisible; }
- void setVisible(bool isVisible) Q_DECL_OVERRIDE;
+ void setVisible(bool isVisible) override;
bool isSeparator() const { return m_isSeparator; }
- void setIsSeparator(bool isSeparator) Q_DECL_OVERRIDE;
- void setFont(const QFont &font) Q_DECL_OVERRIDE { Q_UNUSED(font); }
- void setRole(MenuRole role) Q_DECL_OVERRIDE;
+ void setIsSeparator(bool isSeparator) override;
+ void setFont(const QFont &font) override { Q_UNUSED(font); }
+ void setRole(MenuRole role) override;
bool isCheckable() const { return m_isCheckable; }
- void setCheckable(bool checkable) Q_DECL_OVERRIDE;
+ void setCheckable(bool checkable) override;
bool isChecked() const { return m_isChecked; }
- void setChecked(bool isChecked) Q_DECL_OVERRIDE;
+ void setChecked(bool isChecked) override;
bool hasExclusiveGroup() const { return m_hasExclusiveGroup; }
- void setHasExclusiveGroup(bool hasExclusiveGroup) Q_DECL_OVERRIDE;
+ void setHasExclusiveGroup(bool hasExclusiveGroup) override;
#ifndef QT_NO_SHORTCUT
QKeySequence shortcut() const { return m_shortcut; }
- void setShortcut(const QKeySequence& shortcut) Q_DECL_OVERRIDE;
+ void setShortcut(const QKeySequence& shortcut) override;
#endif
- void setIconSize(int size) Q_DECL_OVERRIDE { Q_UNUSED(size); }
- void setNativeContents(WId item) Q_DECL_OVERRIDE { Q_UNUSED(item); }
+ void setIconSize(int size) override { Q_UNUSED(size); }
+ void setNativeContents(WId item) override { Q_UNUSED(item); }
int dbusID() const { return m_dbusID; }
@@ -133,35 +133,35 @@ class QDBusPlatformMenu : public QPlatformMenu
public:
QDBusPlatformMenu();
~QDBusPlatformMenu();
- void insertMenuItem(QPlatformMenuItem *menuItem, QPlatformMenuItem *before) Q_DECL_OVERRIDE;
- void removeMenuItem(QPlatformMenuItem *menuItem) Q_DECL_OVERRIDE;
+ void insertMenuItem(QPlatformMenuItem *menuItem, QPlatformMenuItem *before) override;
+ void removeMenuItem(QPlatformMenuItem *menuItem) override;
void syncSubMenu(const QDBusPlatformMenu *menu);
- void syncMenuItem(QPlatformMenuItem *menuItem) Q_DECL_OVERRIDE;
- void syncSeparatorsCollapsible(bool enable) Q_DECL_OVERRIDE { Q_UNUSED(enable); }
+ void syncMenuItem(QPlatformMenuItem *menuItem) override;
+ void syncSeparatorsCollapsible(bool enable) override { Q_UNUSED(enable); }
const QString text() const { return m_text; }
- void setText(const QString &text) Q_DECL_OVERRIDE;
+ void setText(const QString &text) override;
QIcon icon() const { return m_icon; }
- void setIcon(const QIcon &icon) Q_DECL_OVERRIDE;
- bool isEnabled() const Q_DECL_OVERRIDE { return m_isEnabled; }
- void setEnabled(bool enabled) Q_DECL_OVERRIDE;
+ void setIcon(const QIcon &icon) override;
+ bool isEnabled() const override { return m_isEnabled; }
+ void setEnabled(bool enabled) override;
bool isVisible() const { return m_isVisible; }
- void setVisible(bool visible) Q_DECL_OVERRIDE;
- void setMinimumWidth(int width) Q_DECL_OVERRIDE { Q_UNUSED(width); }
- void setFont(const QFont &font) Q_DECL_OVERRIDE { Q_UNUSED(font); }
- void setMenuType(MenuType type) Q_DECL_OVERRIDE { Q_UNUSED(type); }
+ void setVisible(bool visible) override;
+ void setMinimumWidth(int width) override { Q_UNUSED(width); }
+ void setFont(const QFont &font) override { Q_UNUSED(font); }
+ void setMenuType(MenuType type) override { Q_UNUSED(type); }
void setContainingMenuItem(QDBusPlatformMenuItem *item);
- void showPopup(const QWindow *parentWindow, const QRect &targetRect, const QPlatformMenuItem *item) Q_DECL_OVERRIDE;
+ void showPopup(const QWindow *parentWindow, const QRect &targetRect, const QPlatformMenuItem *item) override;
- void dismiss() Q_DECL_OVERRIDE { } // Closes this and all its related menu popups
+ void dismiss() override { } // Closes this and all its related menu popups
- QPlatformMenuItem *menuItemAt(int position) const Q_DECL_OVERRIDE;
- QPlatformMenuItem *menuItemForTag(quintptr tag) const Q_DECL_OVERRIDE;
+ QPlatformMenuItem *menuItemAt(int position) const override;
+ QPlatformMenuItem *menuItemForTag(quintptr tag) const override;
const QList<QDBusPlatformMenuItem *> items() const;
- QPlatformMenuItem *createMenuItem() const Q_DECL_OVERRIDE;
- QPlatformMenu *createSubMenu() const Q_DECL_OVERRIDE;
+ QPlatformMenuItem *createMenuItem() const override;
+ QPlatformMenu *createSubMenu() const override;
uint revision() const { return m_revision; }
diff --git a/src/platformsupport/themes/genericunix/dbustray/qdbustrayicon.cpp b/src/platformsupport/themes/genericunix/dbustray/qdbustrayicon.cpp
index 9baf94726d..8480c15fb7 100644
--- a/src/platformsupport/themes/genericunix/dbustray/qdbustrayicon.cpp
+++ b/src/platformsupport/themes/genericunix/dbustray/qdbustrayicon.cpp
@@ -102,17 +102,17 @@ static int instanceCount = 0;
*/
QDBusTrayIcon::QDBusTrayIcon()
- : m_dbusConnection(Q_NULLPTR)
+ : m_dbusConnection(nullptr)
, m_adaptor(new QStatusNotifierItemAdaptor(this))
- , m_menuAdaptor(Q_NULLPTR)
- , m_menu(Q_NULLPTR)
- , m_notifier(Q_NULLPTR)
+ , m_menuAdaptor(nullptr)
+ , m_menu(nullptr)
+ , m_notifier(nullptr)
, m_instanceId(KDEItemFormat.arg(QCoreApplication::applicationPid()).arg(++instanceCount))
, m_category(QStringLiteral("ApplicationStatus"))
, m_defaultStatus(QStringLiteral("Active")) // be visible all the time. QSystemTrayIcon has no API to control this.
, m_status(m_defaultStatus)
- , m_tempIcon(Q_NULLPTR)
- , m_tempAttentionIcon(Q_NULLPTR)
+ , m_tempIcon(nullptr)
+ , m_tempAttentionIcon(nullptr)
, m_registered(false)
{
qCDebug(qLcTray);
@@ -149,9 +149,9 @@ void QDBusTrayIcon::cleanup()
if (m_registered)
dBusConnection()->unregisterTrayIcon(this);
delete m_dbusConnection;
- m_dbusConnection = Q_NULLPTR;
+ m_dbusConnection = nullptr;
delete m_notifier;
- m_notifier = Q_NULLPTR;
+ m_notifier = nullptr;
m_registered = false;
}
@@ -203,7 +203,7 @@ QTemporaryFile *QDBusTrayIcon::tempIcon(const QIcon &icon)
necessity_checked = true;
}
if (!necessary)
- return Q_NULLPTR;
+ return nullptr;
qreal dpr = qGuiApp->devicePixelRatio();
QTemporaryFile *ret = new QTemporaryFile(TempFileTemplate, this);
ret->open();
diff --git a/src/platformsupport/themes/genericunix/dbustray/qdbustrayicon_p.h b/src/platformsupport/themes/genericunix/dbustray/qdbustrayicon_p.h
index 4c9bc8f7e3..7034a7edb4 100644
--- a/src/platformsupport/themes/genericunix/dbustray/qdbustrayicon_p.h
+++ b/src/platformsupport/themes/genericunix/dbustray/qdbustrayicon_p.h
@@ -91,18 +91,18 @@ public:
QDBusMenuConnection * dBusConnection();
- void init() Q_DECL_OVERRIDE;
- void cleanup() Q_DECL_OVERRIDE;
- void updateIcon(const QIcon &icon) Q_DECL_OVERRIDE;
- void updateToolTip(const QString &tooltip) Q_DECL_OVERRIDE;
- void updateMenu(QPlatformMenu *menu) Q_DECL_OVERRIDE;
- QPlatformMenu *createMenu() const Q_DECL_OVERRIDE;
+ void init() override;
+ void cleanup() override;
+ void updateIcon(const QIcon &icon) override;
+ void updateToolTip(const QString &tooltip) override;
+ void updateMenu(QPlatformMenu *menu) override;
+ QPlatformMenu *createMenu() const override;
void showMessage(const QString &title, const QString &msg,
- const QIcon &icon, MessageIcon iconType, int msecs) Q_DECL_OVERRIDE;
+ const QIcon &icon, MessageIcon iconType, int msecs) override;
- bool isSystemTrayAvailable() const Q_DECL_OVERRIDE;
- bool supportsMessages() const Q_DECL_OVERRIDE { return true; }
- QRect geometry() const Q_DECL_OVERRIDE { return QRect(); }
+ bool isSystemTrayAvailable() const override;
+ bool supportsMessages() const override { return true; }
+ QRect geometry() const override { return QRect(); }
QString category() const { return m_category; }
QString status() const { return m_status; }
diff --git a/src/platformsupport/themes/genericunix/qgenericunixthemes.cpp b/src/platformsupport/themes/genericunix/qgenericunixthemes.cpp
index 2105145263..5eac0a3584 100644
--- a/src/platformsupport/themes/genericunix/qgenericunixthemes.cpp
+++ b/src/platformsupport/themes/genericunix/qgenericunixthemes.cpp
@@ -199,7 +199,7 @@ QPlatformSystemTrayIcon *QGenericUnixTheme::createPlatformSystemTrayIcon() const
{
if (isDBusTrayAvailable())
return new QDBusTrayIcon();
- return Q_NULLPTR;
+ return nullptr;
}
#endif
@@ -674,7 +674,7 @@ QPlatformSystemTrayIcon *QKdeTheme::createPlatformSystemTrayIcon() const
{
if (isDBusTrayAvailable())
return new QDBusTrayIcon();
- return Q_NULLPTR;
+ return nullptr;
}
#endif
@@ -693,7 +693,7 @@ const char *QGnomeTheme::name = "gnome";
class QGnomeThemePrivate : public QPlatformThemePrivate
{
public:
- QGnomeThemePrivate() : systemFont(Q_NULLPTR), fixedFont(Q_NULLPTR) {}
+ QGnomeThemePrivate() : systemFont(nullptr), fixedFont(nullptr) {}
~QGnomeThemePrivate() { delete systemFont; delete fixedFont; }
void configureFonts(const QString &gtkFontName) const
@@ -793,7 +793,7 @@ QPlatformSystemTrayIcon *QGnomeTheme::createPlatformSystemTrayIcon() const
{
if (isDBusTrayAvailable())
return new QDBusTrayIcon();
- return Q_NULLPTR;
+ return nullptr;
}
#endif
@@ -831,7 +831,7 @@ QPlatformTheme *QGenericUnixTheme::createUnixTheme(const QString &name)
#endif
if (name == QLatin1String(QGnomeTheme::name))
return new QGnomeTheme;
- return Q_NULLPTR;
+ return nullptr;
}
QStringList QGenericUnixTheme::themeNames()
diff --git a/src/platformsupport/themes/genericunix/qgenericunixthemes_p.h b/src/platformsupport/themes/genericunix/qgenericunixthemes_p.h
index da13390662..186e5a7dff 100644
--- a/src/platformsupport/themes/genericunix/qgenericunixthemes_p.h
+++ b/src/platformsupport/themes/genericunix/qgenericunixthemes_p.h
@@ -81,15 +81,15 @@ public:
static QPlatformTheme *createUnixTheme(const QString &name);
static QStringList themeNames();
- const QFont *font(Font type) const Q_DECL_OVERRIDE;
- QVariant themeHint(ThemeHint hint) const Q_DECL_OVERRIDE;
+ const QFont *font(Font type) const override;
+ QVariant themeHint(ThemeHint hint) const override;
static QStringList xdgIconThemePaths();
#ifndef QT_NO_DBUS
- QPlatformMenuBar *createPlatformMenuBar() const Q_DECL_OVERRIDE;
+ QPlatformMenuBar *createPlatformMenuBar() const override;
#endif
#if !defined(QT_NO_DBUS) && !defined(QT_NO_SYSTEMTRAYICON)
- QPlatformSystemTrayIcon *createPlatformSystemTrayIcon() const Q_DECL_OVERRIDE;
+ QPlatformSystemTrayIcon *createPlatformSystemTrayIcon() const override;
#endif
static const char *name;
@@ -105,19 +105,19 @@ public:
QKdeTheme(const QStringList& kdeDirs, int kdeVersion);
static QPlatformTheme *createKdeTheme();
- QVariant themeHint(ThemeHint hint) const Q_DECL_OVERRIDE;
+ QVariant themeHint(ThemeHint hint) const override;
QIcon fileIcon(const QFileInfo &fileInfo,
QPlatformTheme::IconOptions iconOptions = 0) const override;
- const QPalette *palette(Palette type = SystemPalette) const Q_DECL_OVERRIDE;
+ const QPalette *palette(Palette type = SystemPalette) const override;
- const QFont *font(Font type) const Q_DECL_OVERRIDE;
+ const QFont *font(Font type) const override;
#ifndef QT_NO_DBUS
- QPlatformMenuBar *createPlatformMenuBar() const Q_DECL_OVERRIDE;
+ QPlatformMenuBar *createPlatformMenuBar() const override;
#endif
#if !defined(QT_NO_DBUS) && !defined(QT_NO_SYSTEMTRAYICON)
- QPlatformSystemTrayIcon *createPlatformSystemTrayIcon() const Q_DECL_OVERRIDE;
+ QPlatformSystemTrayIcon *createPlatformSystemTrayIcon() const override;
#endif
static const char *name;
@@ -131,18 +131,18 @@ class QGnomeTheme : public QPlatformTheme
Q_DECLARE_PRIVATE(QGnomeTheme)
public:
QGnomeTheme();
- QVariant themeHint(ThemeHint hint) const Q_DECL_OVERRIDE;
+ QVariant themeHint(ThemeHint hint) const override;
QIcon fileIcon(const QFileInfo &fileInfo,
QPlatformTheme::IconOptions = 0) const override;
- const QFont *font(Font type) const Q_DECL_OVERRIDE;
- QString standardButtonText(int button) const Q_DECL_OVERRIDE;
+ const QFont *font(Font type) const override;
+ QString standardButtonText(int button) const override;
virtual QString gtkFontName() const;
#ifndef QT_NO_DBUS
- QPlatformMenuBar *createPlatformMenuBar() const Q_DECL_OVERRIDE;
+ QPlatformMenuBar *createPlatformMenuBar() const override;
#endif
#if !defined(QT_NO_DBUS) && !defined(QT_NO_SYSTEMTRAYICON)
- QPlatformSystemTrayIcon *createPlatformSystemTrayIcon() const Q_DECL_OVERRIDE;
+ QPlatformSystemTrayIcon *createPlatformSystemTrayIcon() const override;
#endif
static const char *name;
diff --git a/src/platformsupport/themes/themes.pro b/src/platformsupport/themes/themes.pro
index aeed4d2f47..44f94fafc8 100644
--- a/src/platformsupport/themes/themes.pro
+++ b/src/platformsupport/themes/themes.pro
@@ -6,7 +6,7 @@ CONFIG += static internal_module
DEFINES += QT_NO_CAST_FROM_ASCII
-unix:!darwin: \
+if(unix:!darwin)|qtConfig(xcb): \
include($$PWD/genericunix/genericunix.pri)
HEADERS += \
diff --git a/src/platformsupport/windowsuiautomation/qwindowsuiawrapper.cpp b/src/platformsupport/windowsuiautomation/qwindowsuiawrapper.cpp
new file mode 100644
index 0000000000..79541fe636
--- /dev/null
+++ b/src/platformsupport/windowsuiautomation/qwindowsuiawrapper.cpp
@@ -0,0 +1,117 @@
+/****************************************************************************
+**
+** Copyright (C) 2017 The Qt Company Ltd.
+** Contact: https://www.qt.io/licensing/
+**
+** This file is part of the QtGui module of the Qt Toolkit.
+**
+** $QT_BEGIN_LICENSE:LGPL$
+** Commercial License Usage
+** Licensees holding valid commercial Qt licenses may use this file in
+** accordance with the commercial license agreement provided with the
+** Software or, alternatively, in accordance with the terms contained in
+** a written agreement between you and The Qt Company. For licensing terms
+** and conditions see https://www.qt.io/terms-conditions. For further
+** information use the contact form at https://www.qt.io/contact-us.
+**
+** GNU Lesser General Public License Usage
+** Alternatively, this file may be used under the terms of the GNU Lesser
+** General Public License version 3 as published by the Free Software
+** Foundation and appearing in the file LICENSE.LGPL3 included in the
+** packaging of this file. Please review the following information to
+** ensure the GNU Lesser General Public License version 3 requirements
+** will be met: https://www.gnu.org/licenses/lgpl-3.0.html.
+**
+** GNU General Public License Usage
+** Alternatively, this file may be used under the terms of the GNU
+** General Public License version 2.0 or (at your option) the GNU General
+** Public license version 3 or any later version approved by the KDE Free
+** Qt Foundation. The licenses are as published by the Free Software
+** Foundation and appearing in the file LICENSE.GPL2 and LICENSE.GPL3
+** included in the packaging of this file. Please review the following
+** information to ensure the GNU General Public License requirements will
+** be met: https://www.gnu.org/licenses/gpl-2.0.html and
+** https://www.gnu.org/licenses/gpl-3.0.html.
+**
+** $QT_END_LICENSE$
+**
+****************************************************************************/
+
+#include <initguid.h>
+
+#include "qwindowsuiawrapper_p.h"
+#include <QtCore/private/qsystemlibrary_p.h>
+
+QT_BEGIN_NAMESPACE
+
+// private constructor
+QWindowsUiaWrapper::QWindowsUiaWrapper()
+{
+ QSystemLibrary uiaLib(QStringLiteral("UIAutomationCore"));
+ if (uiaLib.load()) {
+ m_pUiaReturnRawElementProvider = reinterpret_cast<PtrUiaReturnRawElementProvider>(uiaLib.resolve("UiaReturnRawElementProvider"));
+ m_pUiaHostProviderFromHwnd = reinterpret_cast<PtrUiaHostProviderFromHwnd>(uiaLib.resolve("UiaHostProviderFromHwnd"));
+ m_pUiaRaiseAutomationPropertyChangedEvent = reinterpret_cast<PtrUiaRaiseAutomationPropertyChangedEvent>(uiaLib.resolve("UiaRaiseAutomationPropertyChangedEvent"));
+ m_pUiaRaiseAutomationEvent = reinterpret_cast<PtrUiaRaiseAutomationEvent>(uiaLib.resolve("UiaRaiseAutomationEvent"));
+ m_pUiaClientsAreListening = reinterpret_cast<PtrUiaClientsAreListening>(uiaLib.resolve("UiaClientsAreListening"));
+ }
+}
+
+QWindowsUiaWrapper::~QWindowsUiaWrapper()
+{
+}
+
+// shared instance
+QWindowsUiaWrapper *QWindowsUiaWrapper::instance()
+{
+ static QWindowsUiaWrapper wrapper;
+ return &wrapper;
+}
+
+// True if all symbols resolved.
+BOOL QWindowsUiaWrapper::ready()
+{
+ return m_pUiaReturnRawElementProvider
+ && m_pUiaHostProviderFromHwnd
+ && m_pUiaRaiseAutomationPropertyChangedEvent
+ && m_pUiaRaiseAutomationEvent
+ && m_pUiaClientsAreListening;
+}
+
+BOOL QWindowsUiaWrapper::clientsAreListening()
+{
+ if (!m_pUiaClientsAreListening)
+ return FALSE;
+ return m_pUiaClientsAreListening();
+}
+
+LRESULT QWindowsUiaWrapper::returnRawElementProvider(HWND hwnd, WPARAM wParam, LPARAM lParam, IRawElementProviderSimple *el)
+{
+ if (!m_pUiaReturnRawElementProvider)
+ return static_cast<LRESULT>(NULL);
+ return m_pUiaReturnRawElementProvider(hwnd, wParam, lParam, el);
+}
+
+HRESULT QWindowsUiaWrapper::hostProviderFromHwnd(HWND hwnd, IRawElementProviderSimple **ppProvider)
+{
+ if (!m_pUiaHostProviderFromHwnd)
+ return UIA_E_NOTSUPPORTED;
+ return m_pUiaHostProviderFromHwnd(hwnd, ppProvider);
+}
+
+HRESULT QWindowsUiaWrapper::raiseAutomationPropertyChangedEvent(IRawElementProviderSimple *pProvider, PROPERTYID id, VARIANT oldValue, VARIANT newValue)
+{
+ if (!m_pUiaRaiseAutomationPropertyChangedEvent)
+ return UIA_E_NOTSUPPORTED;
+ return m_pUiaRaiseAutomationPropertyChangedEvent(pProvider, id, oldValue, newValue);
+}
+
+HRESULT QWindowsUiaWrapper::raiseAutomationEvent(IRawElementProviderSimple *pProvider, EVENTID id)
+{
+ if (!m_pUiaRaiseAutomationEvent)
+ return UIA_E_NOTSUPPORTED;
+ return m_pUiaRaiseAutomationEvent(pProvider, id);
+}
+
+QT_END_NAMESPACE
+
diff --git a/src/platformsupport/windowsuiautomation/qwindowsuiawrapper_p.h b/src/platformsupport/windowsuiautomation/qwindowsuiawrapper_p.h
new file mode 100644
index 0000000000..3ebc3008d3
--- /dev/null
+++ b/src/platformsupport/windowsuiautomation/qwindowsuiawrapper_p.h
@@ -0,0 +1,100 @@
+/****************************************************************************
+**
+** Copyright (C) 2017 The Qt Company Ltd.
+** Contact: https://www.qt.io/licensing/
+**
+** This file is part of the QtGui module of the Qt Toolkit.
+**
+** $QT_BEGIN_LICENSE:LGPL$
+** Commercial License Usage
+** Licensees holding valid commercial Qt licenses may use this file in
+** accordance with the commercial license agreement provided with the
+** Software or, alternatively, in accordance with the terms contained in
+** a written agreement between you and The Qt Company. For licensing terms
+** and conditions see https://www.qt.io/terms-conditions. For further
+** information use the contact form at https://www.qt.io/contact-us.
+**
+** GNU Lesser General Public License Usage
+** Alternatively, this file may be used under the terms of the GNU Lesser
+** General Public License version 3 as published by the Free Software
+** Foundation and appearing in the file LICENSE.LGPL3 included in the
+** packaging of this file. Please review the following information to
+** ensure the GNU Lesser General Public License version 3 requirements
+** will be met: https://www.gnu.org/licenses/lgpl-3.0.html.
+**
+** GNU General Public License Usage
+** Alternatively, this file may be used under the terms of the GNU
+** General Public License version 2.0 or (at your option) the GNU General
+** Public license version 3 or any later version approved by the KDE Free
+** Qt Foundation. The licenses are as published by the Free Software
+** Foundation and appearing in the file LICENSE.GPL2 and LICENSE.GPL3
+** included in the packaging of this file. Please review the following
+** information to ensure the GNU General Public License requirements will
+** be met: https://www.gnu.org/licenses/gpl-2.0.html and
+** https://www.gnu.org/licenses/gpl-3.0.html.
+**
+** $QT_END_LICENSE$
+**
+****************************************************************************/
+
+#ifndef QWINDOWSUIAWRAPPER_H
+#define QWINDOWSUIAWRAPPER_H
+
+//
+// W A R N I N G
+// -------------
+//
+// This file is not part of the Qt API. It exists for the convenience
+// of other Qt classes. This header file may change from version to
+// version without notice, or even be removed.
+//
+// We mean it.
+//
+
+#include <QtGui/private/qtguiglobal_p.h>
+
+#include "uiatypes_p.h"
+#include "uiaattributeids_p.h"
+#include "uiacontroltypeids_p.h"
+#include "uiaerrorids_p.h"
+#include "uiaeventids_p.h"
+#include "uiageneralids_p.h"
+#include "uiapatternids_p.h"
+#include "uiapropertyids_p.h"
+#include "uiaserverinterfaces_p.h"
+#include "uiaclientinterfaces_p.h"
+
+QT_REQUIRE_CONFIG(accessibility);
+
+QT_BEGIN_NAMESPACE
+
+class QWindowsUiaWrapper
+{
+ QWindowsUiaWrapper();
+ virtual ~QWindowsUiaWrapper();
+public:
+ static QWindowsUiaWrapper *instance();
+ BOOL ready();
+ BOOL clientsAreListening();
+ LRESULT returnRawElementProvider(HWND hwnd, WPARAM wParam, LPARAM lParam, IRawElementProviderSimple *el);
+ HRESULT hostProviderFromHwnd(HWND hwnd, IRawElementProviderSimple **ppProvider);
+ HRESULT raiseAutomationPropertyChangedEvent(IRawElementProviderSimple *pProvider, PROPERTYID id, VARIANT oldValue, VARIANT newValue);
+ HRESULT raiseAutomationEvent(IRawElementProviderSimple *pProvider, EVENTID id);
+
+private:
+ typedef LRESULT (WINAPI *PtrUiaReturnRawElementProvider)(HWND, WPARAM, LPARAM, IRawElementProviderSimple *);
+ typedef HRESULT (WINAPI *PtrUiaHostProviderFromHwnd)(HWND, IRawElementProviderSimple **);
+ typedef HRESULT (WINAPI *PtrUiaRaiseAutomationPropertyChangedEvent)(IRawElementProviderSimple *, PROPERTYID, VARIANT, VARIANT);
+ typedef HRESULT (WINAPI *PtrUiaRaiseAutomationEvent)(IRawElementProviderSimple *, EVENTID);
+ typedef BOOL (WINAPI *PtrUiaClientsAreListening)();
+ PtrUiaReturnRawElementProvider m_pUiaReturnRawElementProvider = nullptr;
+ PtrUiaHostProviderFromHwnd m_pUiaHostProviderFromHwnd = nullptr;
+ PtrUiaRaiseAutomationPropertyChangedEvent m_pUiaRaiseAutomationPropertyChangedEvent = nullptr;
+ PtrUiaRaiseAutomationEvent m_pUiaRaiseAutomationEvent = nullptr;
+ PtrUiaClientsAreListening m_pUiaClientsAreListening = nullptr;
+};
+
+QT_END_NAMESPACE
+
+#endif //QWINDOWSUIAWRAPPER_H
+
diff --git a/src/platformsupport/windowsuiautomation/uiaattributeids_p.h b/src/platformsupport/windowsuiautomation/uiaattributeids_p.h
new file mode 100644
index 0000000000..52e7306a67
--- /dev/null
+++ b/src/platformsupport/windowsuiautomation/uiaattributeids_p.h
@@ -0,0 +1,88 @@
+/****************************************************************************
+**
+** Copyright (C) 2017 The Qt Company Ltd.
+** Contact: https://www.qt.io/licensing/
+**
+** This file is part of the QtGui module of the Qt Toolkit.
+**
+** $QT_BEGIN_LICENSE:LGPL$
+** Commercial License Usage
+** Licensees holding valid commercial Qt licenses may use this file in
+** accordance with the commercial license agreement provided with the
+** Software or, alternatively, in accordance with the terms contained in
+** a written agreement between you and The Qt Company. For licensing terms
+** and conditions see https://www.qt.io/terms-conditions. For further
+** information use the contact form at https://www.qt.io/contact-us.
+**
+** GNU Lesser General Public License Usage
+** Alternatively, this file may be used under the terms of the GNU Lesser
+** General Public License version 3 as published by the Free Software
+** Foundation and appearing in the file LICENSE.LGPL3 included in the
+** packaging of this file. Please review the following information to
+** ensure the GNU Lesser General Public License version 3 requirements
+** will be met: https://www.gnu.org/licenses/lgpl-3.0.html.
+**
+** GNU General Public License Usage
+** Alternatively, this file may be used under the terms of the GNU
+** General Public License version 2.0 or (at your option) the GNU General
+** Public license version 3 or any later version approved by the KDE Free
+** Qt Foundation. The licenses are as published by the Free Software
+** Foundation and appearing in the file LICENSE.GPL2 and LICENSE.GPL3
+** included in the packaging of this file. Please review the following
+** information to ensure the GNU General Public License requirements will
+** be met: https://www.gnu.org/licenses/gpl-2.0.html and
+** https://www.gnu.org/licenses/gpl-3.0.html.
+**
+** $QT_END_LICENSE$
+**
+****************************************************************************/
+
+#ifndef UIAATTRIBUTEIDS_H
+#define UIAATTRIBUTEIDS_H
+
+#define UIA_AnimationStyleAttributeId 40000
+#define UIA_BackgroundColorAttributeId 40001
+#define UIA_BulletStyleAttributeId 40002
+#define UIA_CapStyleAttributeId 40003
+#define UIA_CultureAttributeId 40004
+#define UIA_FontNameAttributeId 40005
+#define UIA_FontSizeAttributeId 40006
+#define UIA_FontWeightAttributeId 40007
+#define UIA_ForegroundColorAttributeId 40008
+#define UIA_HorizontalTextAlignmentAttributeId 40009
+#define UIA_IndentationFirstLineAttributeId 40010
+#define UIA_IndentationLeadingAttributeId 40011
+#define UIA_IndentationTrailingAttributeId 40012
+#define UIA_IsHiddenAttributeId 40013
+#define UIA_IsItalicAttributeId 40014
+#define UIA_IsReadOnlyAttributeId 40015
+#define UIA_IsSubscriptAttributeId 40016
+#define UIA_IsSuperscriptAttributeId 40017
+#define UIA_MarginBottomAttributeId 40018
+#define UIA_MarginLeadingAttributeId 40019
+#define UIA_MarginTopAttributeId 40020
+#define UIA_MarginTrailingAttributeId 40021
+#define UIA_OutlineStylesAttributeId 40022
+#define UIA_OverlineColorAttributeId 40023
+#define UIA_OverlineStyleAttributeId 40024
+#define UIA_StrikethroughColorAttributeId 40025
+#define UIA_StrikethroughStyleAttributeId 40026
+#define UIA_TabsAttributeId 40027
+#define UIA_TextFlowDirectionsAttributeId 40028
+#define UIA_UnderlineColorAttributeId 40029
+#define UIA_UnderlineStyleAttributeId 40030
+#define UIA_AnnotationTypesAttributeId 40031
+#define UIA_AnnotationObjectsAttributeId 40032
+#define UIA_StyleNameAttributeId 40033
+#define UIA_StyleIdAttributeId 40034
+#define UIA_LinkAttributeId 40035
+#define UIA_IsActiveAttributeId 40036
+#define UIA_SelectionActiveEndAttributeId 40037
+#define UIA_CaretPositionAttributeId 40038
+#define UIA_CaretBidiModeAttributeId 40039
+#define UIA_LineSpacingAttributeId 40040
+#define UIA_BeforeParagraphSpacingAttributeId 40041
+#define UIA_AfterParagraphSpacingAttributeId 40042
+#define UIA_SayAsInterpretAsAttributeId 40043
+
+#endif
diff --git a/src/platformsupport/windowsuiautomation/uiaclientinterfaces_p.h b/src/platformsupport/windowsuiautomation/uiaclientinterfaces_p.h
new file mode 100644
index 0000000000..b95c05f6a4
--- /dev/null
+++ b/src/platformsupport/windowsuiautomation/uiaclientinterfaces_p.h
@@ -0,0 +1,255 @@
+/****************************************************************************
+**
+** Copyright (C) 2017 The Qt Company Ltd.
+** Contact: https://www.qt.io/licensing/
+**
+** This file is part of the QtGui module of the Qt Toolkit.
+**
+** $QT_BEGIN_LICENSE:LGPL$
+** Commercial License Usage
+** Licensees holding valid commercial Qt licenses may use this file in
+** accordance with the commercial license agreement provided with the
+** Software or, alternatively, in accordance with the terms contained in
+** a written agreement between you and The Qt Company. For licensing terms
+** and conditions see https://www.qt.io/terms-conditions. For further
+** information use the contact form at https://www.qt.io/contact-us.
+**
+** GNU Lesser General Public License Usage
+** Alternatively, this file may be used under the terms of the GNU Lesser
+** General Public License version 3 as published by the Free Software
+** Foundation and appearing in the file LICENSE.LGPL3 included in the
+** packaging of this file. Please review the following information to
+** ensure the GNU Lesser General Public License version 3 requirements
+** will be met: https://www.gnu.org/licenses/lgpl-3.0.html.
+**
+** GNU General Public License Usage
+** Alternatively, this file may be used under the terms of the GNU
+** General Public License version 2.0 or (at your option) the GNU General
+** Public license version 3 or any later version approved by the KDE Free
+** Qt Foundation. The licenses are as published by the Free Software
+** Foundation and appearing in the file LICENSE.GPL2 and LICENSE.GPL3
+** included in the packaging of this file. Please review the following
+** information to ensure the GNU General Public License requirements will
+** be met: https://www.gnu.org/licenses/gpl-2.0.html and
+** https://www.gnu.org/licenses/gpl-3.0.html.
+**
+** $QT_END_LICENSE$
+**
+****************************************************************************/
+
+#ifndef UIACLIENTINTERFACES_H
+#define UIACLIENTINTERFACES_H
+
+#include <Unknwn.h>
+
+#ifndef __IUIAutomationElement_INTERFACE_DEFINED__
+
+struct IUIAutomationCondition;
+struct IUIAutomationCacheRequest;
+struct IUIAutomationElementArray;
+struct IUIAutomationTreeWalker;
+struct IUIAutomationEventHandler;
+struct IUIAutomationPropertyChangedEventHandler;
+struct IUIAutomationStructureChangedEventHandler;
+struct IUIAutomationFocusChangedEventHandler;
+struct IUIAutomationProxyFactory;
+struct IUIAutomationProxyFactoryEntry;
+struct IUIAutomationProxyFactoryMapping;
+#ifndef __IAccessible_FWD_DEFINED__
+#define __IAccessible_FWD_DEFINED__
+struct IAccessible;
+#endif /* __IAccessible_FWD_DEFINED__ */
+
+#define __IUIAutomationElement_INTERFACE_DEFINED__
+DEFINE_GUID(IID_IUIAutomationElement, 0xd22108aa, 0x8ac5, 0x49a5, 0x83,0x7b, 0x37,0xbb,0xb3,0xd7,0x59,0x1e);
+MIDL_INTERFACE("d22108aa-8ac5-49a5-837b-37bbb3d7591e")
+IUIAutomationElement : public IUnknown
+{
+public:
+ virtual HRESULT STDMETHODCALLTYPE SetFocus() = 0;
+ virtual HRESULT STDMETHODCALLTYPE GetRuntimeId(__RPC__deref_out_opt SAFEARRAY **runtimeId) = 0;
+ virtual HRESULT STDMETHODCALLTYPE FindFirst(enum TreeScope scope, __RPC__in_opt IUIAutomationCondition *condition, __RPC__deref_out_opt IUIAutomationElement **found) = 0;
+ virtual HRESULT STDMETHODCALLTYPE FindAll(enum TreeScope scope, __RPC__in_opt IUIAutomationCondition *condition, __RPC__deref_out_opt IUIAutomationElementArray **found) = 0;
+ virtual HRESULT STDMETHODCALLTYPE FindFirstBuildCache(enum TreeScope scope, __RPC__in_opt IUIAutomationCondition *condition, __RPC__in_opt IUIAutomationCacheRequest *cacheRequest, __RPC__deref_out_opt IUIAutomationElement **found) = 0;
+ virtual HRESULT STDMETHODCALLTYPE FindAllBuildCache(enum TreeScope scope, __RPC__in_opt IUIAutomationCondition *condition, __RPC__in_opt IUIAutomationCacheRequest *cacheRequest, __RPC__deref_out_opt IUIAutomationElementArray **found) = 0;
+ virtual HRESULT STDMETHODCALLTYPE BuildUpdatedCache(__RPC__in_opt IUIAutomationCacheRequest *cacheRequest, __RPC__deref_out_opt IUIAutomationElement **updatedElement) = 0;
+ virtual HRESULT STDMETHODCALLTYPE GetCurrentPropertyValue(PROPERTYID propertyId, __RPC__out VARIANT *retVal) = 0;
+ virtual HRESULT STDMETHODCALLTYPE GetCurrentPropertyValueEx(PROPERTYID propertyId, BOOL ignoreDefaultValue, __RPC__out VARIANT *retVal) = 0;
+ virtual HRESULT STDMETHODCALLTYPE GetCachedPropertyValue(PROPERTYID propertyId, __RPC__out VARIANT *retVal) = 0;
+ virtual HRESULT STDMETHODCALLTYPE GetCachedPropertyValueEx(PROPERTYID propertyId, BOOL ignoreDefaultValue, __RPC__out VARIANT *retVal) = 0;
+ virtual HRESULT STDMETHODCALLTYPE GetCurrentPatternAs(PATTERNID patternId, __RPC__in REFIID riid, __RPC__deref_out_opt void **patternObject) = 0;
+ virtual HRESULT STDMETHODCALLTYPE GetCachedPatternAs(PATTERNID patternId, __RPC__in REFIID riid, __RPC__deref_out_opt void **patternObject) = 0;
+ virtual HRESULT STDMETHODCALLTYPE GetCurrentPattern(PATTERNID patternId, __RPC__deref_out_opt IUnknown **patternObject) = 0;
+ virtual HRESULT STDMETHODCALLTYPE GetCachedPattern(PATTERNID patternId, __RPC__deref_out_opt IUnknown **patternObject) = 0;
+ virtual HRESULT STDMETHODCALLTYPE GetCachedParent(__RPC__deref_out_opt IUIAutomationElement **parent) = 0;
+ virtual HRESULT STDMETHODCALLTYPE GetCachedChildren(__RPC__deref_out_opt IUIAutomationElementArray **children) = 0;
+ virtual HRESULT STDMETHODCALLTYPE get_CurrentProcessId(__RPC__out int *retVal) = 0;
+ virtual HRESULT STDMETHODCALLTYPE get_CurrentControlType(__RPC__out CONTROLTYPEID *retVal) = 0;
+ virtual HRESULT STDMETHODCALLTYPE get_CurrentLocalizedControlType(__RPC__deref_out_opt BSTR *retVal) = 0;
+ virtual HRESULT STDMETHODCALLTYPE get_CurrentName(__RPC__deref_out_opt BSTR *retVal) = 0;
+ virtual HRESULT STDMETHODCALLTYPE get_CurrentAcceleratorKey(__RPC__deref_out_opt BSTR *retVal) = 0;
+ virtual HRESULT STDMETHODCALLTYPE get_CurrentAccessKey(__RPC__deref_out_opt BSTR *retVal) = 0;
+ virtual HRESULT STDMETHODCALLTYPE get_CurrentHasKeyboardFocus(__RPC__out BOOL *retVal) = 0;
+ virtual HRESULT STDMETHODCALLTYPE get_CurrentIsKeyboardFocusable(__RPC__out BOOL *retVal) = 0;
+ virtual HRESULT STDMETHODCALLTYPE get_CurrentIsEnabled(__RPC__out BOOL *retVal) = 0;
+ virtual HRESULT STDMETHODCALLTYPE get_CurrentAutomationId(__RPC__deref_out_opt BSTR *retVal) = 0;
+ virtual HRESULT STDMETHODCALLTYPE get_CurrentClassName(__RPC__deref_out_opt BSTR *retVal) = 0;
+ virtual HRESULT STDMETHODCALLTYPE get_CurrentHelpText(__RPC__deref_out_opt BSTR *retVal) = 0;
+ virtual HRESULT STDMETHODCALLTYPE get_CurrentCulture(__RPC__out int *retVal) = 0;
+ virtual HRESULT STDMETHODCALLTYPE get_CurrentIsControlElement(__RPC__out BOOL *retVal) = 0;
+ virtual HRESULT STDMETHODCALLTYPE get_CurrentIsContentElement(__RPC__out BOOL *retVal) = 0;
+ virtual HRESULT STDMETHODCALLTYPE get_CurrentIsPassword(__RPC__out BOOL *retVal) = 0;
+ virtual HRESULT STDMETHODCALLTYPE get_CurrentNativeWindowHandle(__RPC__deref_out_opt UIA_HWND *retVal) = 0;
+ virtual HRESULT STDMETHODCALLTYPE get_CurrentItemType(__RPC__deref_out_opt BSTR *retVal) = 0;
+ virtual HRESULT STDMETHODCALLTYPE get_CurrentIsOffscreen(__RPC__out BOOL *retVal) = 0;
+ virtual HRESULT STDMETHODCALLTYPE get_CurrentOrientation(__RPC__out enum OrientationType *retVal) = 0;
+ virtual HRESULT STDMETHODCALLTYPE get_CurrentFrameworkId(__RPC__deref_out_opt BSTR *retVal) = 0;
+ virtual HRESULT STDMETHODCALLTYPE get_CurrentIsRequiredForForm(__RPC__out BOOL *retVal) = 0;
+ virtual HRESULT STDMETHODCALLTYPE get_CurrentItemStatus(__RPC__deref_out_opt BSTR *retVal) = 0;
+ virtual HRESULT STDMETHODCALLTYPE get_CurrentBoundingRectangle(__RPC__out RECT *retVal) = 0;
+ virtual HRESULT STDMETHODCALLTYPE get_CurrentLabeledBy(__RPC__deref_out_opt IUIAutomationElement **retVal) = 0;
+ virtual HRESULT STDMETHODCALLTYPE get_CurrentAriaRole(__RPC__deref_out_opt BSTR *retVal) = 0;
+ virtual HRESULT STDMETHODCALLTYPE get_CurrentAriaProperties(__RPC__deref_out_opt BSTR *retVal) = 0;
+ virtual HRESULT STDMETHODCALLTYPE get_CurrentIsDataValidForForm(__RPC__out BOOL *retVal) = 0;
+ virtual HRESULT STDMETHODCALLTYPE get_CurrentControllerFor(__RPC__deref_out_opt IUIAutomationElementArray **retVal) = 0;
+ virtual HRESULT STDMETHODCALLTYPE get_CurrentDescribedBy(__RPC__deref_out_opt IUIAutomationElementArray **retVal) = 0;
+ virtual HRESULT STDMETHODCALLTYPE get_CurrentFlowsTo(__RPC__deref_out_opt IUIAutomationElementArray **retVal) = 0;
+ virtual HRESULT STDMETHODCALLTYPE get_CurrentProviderDescription(__RPC__deref_out_opt BSTR *retVal) = 0;
+ virtual HRESULT STDMETHODCALLTYPE get_CachedProcessId(__RPC__out int *retVal) = 0;
+ virtual HRESULT STDMETHODCALLTYPE get_CachedControlType(__RPC__out CONTROLTYPEID *retVal) = 0;
+ virtual HRESULT STDMETHODCALLTYPE get_CachedLocalizedControlType(__RPC__deref_out_opt BSTR *retVal) = 0;
+ virtual HRESULT STDMETHODCALLTYPE get_CachedName(__RPC__deref_out_opt BSTR *retVal) = 0;
+ virtual HRESULT STDMETHODCALLTYPE get_CachedAcceleratorKey(__RPC__deref_out_opt BSTR *retVal) = 0;
+ virtual HRESULT STDMETHODCALLTYPE get_CachedAccessKey(__RPC__deref_out_opt BSTR *retVal) = 0;
+ virtual HRESULT STDMETHODCALLTYPE get_CachedHasKeyboardFocus(__RPC__out BOOL *retVal) = 0;
+ virtual HRESULT STDMETHODCALLTYPE get_CachedIsKeyboardFocusable(__RPC__out BOOL *retVal) = 0;
+ virtual HRESULT STDMETHODCALLTYPE get_CachedIsEnabled(__RPC__out BOOL *retVal) = 0;
+ virtual HRESULT STDMETHODCALLTYPE get_CachedAutomationId(__RPC__deref_out_opt BSTR *retVal) = 0;
+ virtual HRESULT STDMETHODCALLTYPE get_CachedClassName(__RPC__deref_out_opt BSTR *retVal) = 0;
+ virtual HRESULT STDMETHODCALLTYPE get_CachedHelpText(__RPC__deref_out_opt BSTR *retVal) = 0;
+ virtual HRESULT STDMETHODCALLTYPE get_CachedCulture(__RPC__out int *retVal) = 0;
+ virtual HRESULT STDMETHODCALLTYPE get_CachedIsControlElement(__RPC__out BOOL *retVal) = 0;
+ virtual HRESULT STDMETHODCALLTYPE get_CachedIsContentElement(__RPC__out BOOL *retVal) = 0;
+ virtual HRESULT STDMETHODCALLTYPE get_CachedIsPassword(__RPC__out BOOL *retVal) = 0;
+ virtual HRESULT STDMETHODCALLTYPE get_CachedNativeWindowHandle(__RPC__deref_out_opt UIA_HWND *retVal) = 0;
+ virtual HRESULT STDMETHODCALLTYPE get_CachedItemType(__RPC__deref_out_opt BSTR *retVal) = 0;
+ virtual HRESULT STDMETHODCALLTYPE get_CachedIsOffscreen(__RPC__out BOOL *retVal) = 0;
+ virtual HRESULT STDMETHODCALLTYPE get_CachedOrientation(__RPC__out enum OrientationType *retVal) = 0;
+ virtual HRESULT STDMETHODCALLTYPE get_CachedFrameworkId(__RPC__deref_out_opt BSTR *retVal) = 0;
+ virtual HRESULT STDMETHODCALLTYPE get_CachedIsRequiredForForm(__RPC__out BOOL *retVal) = 0;
+ virtual HRESULT STDMETHODCALLTYPE get_CachedItemStatus(__RPC__deref_out_opt BSTR *retVal) = 0;
+ virtual HRESULT STDMETHODCALLTYPE get_CachedBoundingRectangle(__RPC__out RECT *retVal) = 0;
+ virtual HRESULT STDMETHODCALLTYPE get_CachedLabeledBy(__RPC__deref_out_opt IUIAutomationElement **retVal) = 0;
+ virtual HRESULT STDMETHODCALLTYPE get_CachedAriaRole(__RPC__deref_out_opt BSTR *retVal) = 0;
+ virtual HRESULT STDMETHODCALLTYPE get_CachedAriaProperties(__RPC__deref_out_opt BSTR *retVal) = 0;
+ virtual HRESULT STDMETHODCALLTYPE get_CachedIsDataValidForForm(__RPC__out BOOL *retVal) = 0;
+ virtual HRESULT STDMETHODCALLTYPE get_CachedControllerFor(__RPC__deref_out_opt IUIAutomationElementArray **retVal) = 0;
+ virtual HRESULT STDMETHODCALLTYPE get_CachedDescribedBy(__RPC__deref_out_opt IUIAutomationElementArray **retVal) = 0;
+ virtual HRESULT STDMETHODCALLTYPE get_CachedFlowsTo(__RPC__deref_out_opt IUIAutomationElementArray **retVal) = 0;
+ virtual HRESULT STDMETHODCALLTYPE get_CachedProviderDescription(__RPC__deref_out_opt BSTR *retVal) = 0;
+ virtual HRESULT STDMETHODCALLTYPE GetClickablePoint(__RPC__out POINT *clickable, __RPC__out BOOL *gotClickable) = 0;
+};
+#ifdef __CRT_UUID_DECL
+__CRT_UUID_DECL(IUIAutomationElement, 0xd22108aa, 0x8ac5, 0x49a5, 0x83,0x7b, 0x37,0xbb,0xb3,0xd7,0x59,0x1e)
+#endif
+#endif
+
+
+#ifndef __IUIAutomation_INTERFACE_DEFINED__
+#define __IUIAutomation_INTERFACE_DEFINED__
+DEFINE_GUID(IID_IUIAutomation, 0x30cbe57d, 0xd9d0, 0x452a, 0xab,0x13, 0x7a,0xc5,0xac,0x48,0x25,0xee);
+MIDL_INTERFACE("30cbe57d-d9d0-452a-ab13-7ac5ac4825ee")
+IUIAutomation : public IUnknown
+{
+public:
+ virtual HRESULT STDMETHODCALLTYPE CompareElements(__RPC__in_opt IUIAutomationElement *el1, __RPC__in_opt IUIAutomationElement *el2, __RPC__out BOOL *areSame) = 0;
+ virtual HRESULT STDMETHODCALLTYPE CompareRuntimeIds(__RPC__in SAFEARRAY * runtimeId1, __RPC__in SAFEARRAY * runtimeId2, __RPC__out BOOL *areSame) = 0;
+ virtual HRESULT STDMETHODCALLTYPE GetRootElement(__RPC__deref_out_opt IUIAutomationElement **root) = 0;
+ virtual HRESULT STDMETHODCALLTYPE ElementFromHandle(__RPC__in UIA_HWND hwnd, __RPC__deref_out_opt IUIAutomationElement **element) = 0;
+ virtual HRESULT STDMETHODCALLTYPE ElementFromPoint(POINT pt, __RPC__deref_out_opt IUIAutomationElement **element) = 0;
+ virtual HRESULT STDMETHODCALLTYPE GetFocusedElement(__RPC__deref_out_opt IUIAutomationElement **element) = 0;
+ virtual HRESULT STDMETHODCALLTYPE GetRootElementBuildCache(__RPC__in_opt IUIAutomationCacheRequest *cacheRequest, __RPC__deref_out_opt IUIAutomationElement **root) = 0;
+ virtual HRESULT STDMETHODCALLTYPE ElementFromHandleBuildCache(__RPC__in UIA_HWND hwnd, __RPC__in_opt IUIAutomationCacheRequest *cacheRequest, __RPC__deref_out_opt IUIAutomationElement **element) = 0;
+ virtual HRESULT STDMETHODCALLTYPE ElementFromPointBuildCache(POINT pt, __RPC__in_opt IUIAutomationCacheRequest *cacheRequest, __RPC__deref_out_opt IUIAutomationElement **element) = 0;
+ virtual HRESULT STDMETHODCALLTYPE GetFocusedElementBuildCache(__RPC__in_opt IUIAutomationCacheRequest *cacheRequest, __RPC__deref_out_opt IUIAutomationElement **element) = 0;
+ virtual HRESULT STDMETHODCALLTYPE CreateTreeWalker(__RPC__in_opt IUIAutomationCondition *pCondition, __RPC__deref_out_opt IUIAutomationTreeWalker **walker) = 0;
+ virtual HRESULT STDMETHODCALLTYPE get_ControlViewWalker(__RPC__deref_out_opt IUIAutomationTreeWalker **walker) = 0;
+ virtual HRESULT STDMETHODCALLTYPE get_ContentViewWalker(__RPC__deref_out_opt IUIAutomationTreeWalker **walker) = 0;
+ virtual HRESULT STDMETHODCALLTYPE get_RawViewWalker(__RPC__deref_out_opt IUIAutomationTreeWalker **walker) = 0;
+ virtual HRESULT STDMETHODCALLTYPE get_RawViewCondition(__RPC__deref_out_opt IUIAutomationCondition **condition) = 0;
+ virtual HRESULT STDMETHODCALLTYPE get_ControlViewCondition(__RPC__deref_out_opt IUIAutomationCondition **condition) = 0;
+ virtual HRESULT STDMETHODCALLTYPE get_ContentViewCondition(__RPC__deref_out_opt IUIAutomationCondition **condition) = 0;
+ virtual HRESULT STDMETHODCALLTYPE CreateCacheRequest(__RPC__deref_out_opt IUIAutomationCacheRequest **cacheRequest) = 0;
+ virtual HRESULT STDMETHODCALLTYPE CreateTrueCondition(__RPC__deref_out_opt IUIAutomationCondition **newCondition) = 0;
+ virtual HRESULT STDMETHODCALLTYPE CreateFalseCondition(__RPC__deref_out_opt IUIAutomationCondition **newCondition) = 0;
+ virtual HRESULT STDMETHODCALLTYPE CreatePropertyCondition(PROPERTYID propertyId, VARIANT value, __RPC__deref_out_opt IUIAutomationCondition **newCondition) = 0;
+ virtual HRESULT STDMETHODCALLTYPE CreatePropertyConditionEx(PROPERTYID propertyId, VARIANT value, enum PropertyConditionFlags flags, __RPC__deref_out_opt IUIAutomationCondition **newCondition) = 0;
+ virtual HRESULT STDMETHODCALLTYPE CreateAndCondition(__RPC__in_opt IUIAutomationCondition *condition1, __RPC__in_opt IUIAutomationCondition *condition2, __RPC__deref_out_opt IUIAutomationCondition **newCondition) = 0;
+ virtual HRESULT STDMETHODCALLTYPE CreateAndConditionFromArray(__RPC__in_opt SAFEARRAY * conditions, __RPC__deref_out_opt IUIAutomationCondition **newCondition) = 0;
+ virtual HRESULT STDMETHODCALLTYPE CreateAndConditionFromNativeArray(__RPC__in_ecount_full(conditionCount) IUIAutomationCondition **conditions, int conditionCount, __RPC__deref_out_opt IUIAutomationCondition **newCondition) = 0;
+ virtual HRESULT STDMETHODCALLTYPE CreateOrCondition(__RPC__in_opt IUIAutomationCondition *condition1, __RPC__in_opt IUIAutomationCondition *condition2, __RPC__deref_out_opt IUIAutomationCondition **newCondition) = 0;
+ virtual HRESULT STDMETHODCALLTYPE CreateOrConditionFromArray(__RPC__in_opt SAFEARRAY * conditions, __RPC__deref_out_opt IUIAutomationCondition **newCondition) = 0;
+ virtual HRESULT STDMETHODCALLTYPE CreateOrConditionFromNativeArray(__RPC__in_ecount_full(conditionCount) IUIAutomationCondition **conditions, int conditionCount, __RPC__deref_out_opt IUIAutomationCondition **newCondition) = 0;
+ virtual HRESULT STDMETHODCALLTYPE CreateNotCondition(__RPC__in_opt IUIAutomationCondition *condition, __RPC__deref_out_opt IUIAutomationCondition **newCondition) = 0;
+ virtual HRESULT STDMETHODCALLTYPE AddAutomationEventHandler(EVENTID eventId, __RPC__in_opt IUIAutomationElement *element, enum TreeScope scope, __RPC__in_opt IUIAutomationCacheRequest *cacheRequest, __RPC__in_opt IUIAutomationEventHandler *handler) = 0;
+ virtual HRESULT STDMETHODCALLTYPE RemoveAutomationEventHandler(EVENTID eventId, __RPC__in_opt IUIAutomationElement *element, __RPC__in_opt IUIAutomationEventHandler *handler) = 0;
+ virtual HRESULT STDMETHODCALLTYPE AddPropertyChangedEventHandlerNativeArray(__RPC__in_opt IUIAutomationElement *element, enum TreeScope scope, __RPC__in_opt IUIAutomationCacheRequest *cacheRequest, __RPC__in_opt IUIAutomationPropertyChangedEventHandler *handler, __RPC__in_ecount_full(propertyCount) PROPERTYID *propertyArray, int propertyCount) = 0;
+ virtual HRESULT STDMETHODCALLTYPE AddPropertyChangedEventHandler(__RPC__in_opt IUIAutomationElement *element, enum TreeScope scope, __RPC__in_opt IUIAutomationCacheRequest *cacheRequest, __RPC__in_opt IUIAutomationPropertyChangedEventHandler *handler, __RPC__in SAFEARRAY * propertyArray) = 0;
+ virtual HRESULT STDMETHODCALLTYPE RemovePropertyChangedEventHandler(__RPC__in_opt IUIAutomationElement *element, __RPC__in_opt IUIAutomationPropertyChangedEventHandler *handler) = 0;
+ virtual HRESULT STDMETHODCALLTYPE AddStructureChangedEventHandler(__RPC__in_opt IUIAutomationElement *element, enum TreeScope scope, __RPC__in_opt IUIAutomationCacheRequest *cacheRequest, __RPC__in_opt IUIAutomationStructureChangedEventHandler *handler) = 0;
+ virtual HRESULT STDMETHODCALLTYPE RemoveStructureChangedEventHandler(__RPC__in_opt IUIAutomationElement *element, __RPC__in_opt IUIAutomationStructureChangedEventHandler *handler) = 0;
+ virtual HRESULT STDMETHODCALLTYPE AddFocusChangedEventHandler(__RPC__in_opt IUIAutomationCacheRequest *cacheRequest, __RPC__in_opt IUIAutomationFocusChangedEventHandler *handler) = 0;
+ virtual HRESULT STDMETHODCALLTYPE RemoveFocusChangedEventHandler(__RPC__in_opt IUIAutomationFocusChangedEventHandler *handler) = 0;
+ virtual HRESULT STDMETHODCALLTYPE RemoveAllEventHandlers() = 0;
+ virtual HRESULT STDMETHODCALLTYPE IntNativeArrayToSafeArray(__RPC__in_ecount_full(arrayCount) int *array, int arrayCount, __RPC__deref_out_opt SAFEARRAY **safeArray) = 0;
+ virtual HRESULT STDMETHODCALLTYPE IntSafeArrayToNativeArray(__RPC__in SAFEARRAY * intArray, __RPC__deref_out_ecount_full_opt(*arrayCount) int **array, __RPC__out int *arrayCount) = 0;
+ virtual HRESULT STDMETHODCALLTYPE RectToVariant(RECT rc, __RPC__out VARIANT *var) = 0;
+ virtual HRESULT STDMETHODCALLTYPE VariantToRect(VARIANT var, __RPC__out RECT *rc) = 0;
+ virtual HRESULT STDMETHODCALLTYPE SafeArrayToRectNativeArray(__RPC__in SAFEARRAY * rects, __RPC__deref_out_ecount_full_opt(*rectArrayCount) RECT **rectArray, __RPC__out int *rectArrayCount) = 0;
+ virtual HRESULT STDMETHODCALLTYPE CreateProxyFactoryEntry(__RPC__in_opt IUIAutomationProxyFactory *factory, __RPC__deref_out_opt IUIAutomationProxyFactoryEntry **factoryEntry) = 0;
+ virtual HRESULT STDMETHODCALLTYPE get_ProxyFactoryMapping(__RPC__deref_out_opt IUIAutomationProxyFactoryMapping **factoryMapping) = 0;
+ virtual HRESULT STDMETHODCALLTYPE GetPropertyProgrammaticName(PROPERTYID property, __RPC__deref_out_opt BSTR *name) = 0;
+ virtual HRESULT STDMETHODCALLTYPE GetPatternProgrammaticName(PATTERNID pattern, __RPC__deref_out_opt BSTR *name) = 0;
+ virtual HRESULT STDMETHODCALLTYPE PollForPotentialSupportedPatterns(__RPC__in_opt IUIAutomationElement *pElement, __RPC__deref_out_opt SAFEARRAY **patternIds, __RPC__deref_out_opt SAFEARRAY **patternNames) = 0;
+ virtual HRESULT STDMETHODCALLTYPE PollForPotentialSupportedProperties(__RPC__in_opt IUIAutomationElement *pElement, __RPC__deref_out_opt SAFEARRAY **propertyIds, __RPC__deref_out_opt SAFEARRAY **propertyNames) = 0;
+ virtual HRESULT STDMETHODCALLTYPE CheckNotSupported(VARIANT value, __RPC__out BOOL *isNotSupported) = 0;
+ virtual HRESULT STDMETHODCALLTYPE get_ReservedNotSupportedValue(__RPC__deref_out_opt IUnknown **notSupportedValue) = 0;
+ virtual HRESULT STDMETHODCALLTYPE get_ReservedMixedAttributeValue(__RPC__deref_out_opt IUnknown **mixedAttributeValue) = 0;
+ virtual HRESULT STDMETHODCALLTYPE ElementFromIAccessible(__RPC__in_opt IAccessible *accessible, int childId, __RPC__deref_out_opt IUIAutomationElement **element) = 0;
+ virtual HRESULT STDMETHODCALLTYPE ElementFromIAccessibleBuildCache(__RPC__in_opt IAccessible *accessible, int childId, __RPC__in_opt IUIAutomationCacheRequest *cacheRequest, __RPC__deref_out_opt IUIAutomationElement **element) = 0;
+};
+#ifdef __CRT_UUID_DECL
+__CRT_UUID_DECL(IUIAutomation, 0x30cbe57d, 0xd9d0, 0x452a, 0xab,0x13, 0x7a,0xc5,0xac,0x48,0x25,0xee)
+#endif
+#endif
+
+
+#ifndef __IUIAutomationTreeWalker_INTERFACE_DEFINED__
+#define __IUIAutomationTreeWalker_INTERFACE_DEFINED__
+DEFINE_GUID(IID_IUIAutomationTreeWalker, 0x4042c624, 0x389c, 0x4afc, 0xa6,0x30, 0x9d,0xf8,0x54,0xa5,0x41,0xfc);
+MIDL_INTERFACE("4042c624-389c-4afc-a630-9df854a541fc")
+IUIAutomationTreeWalker : public IUnknown
+{
+public:
+ virtual HRESULT STDMETHODCALLTYPE GetParentElement(__RPC__in_opt IUIAutomationElement *element, __RPC__deref_out_opt IUIAutomationElement **parent) = 0;
+ virtual HRESULT STDMETHODCALLTYPE GetFirstChildElement(__RPC__in_opt IUIAutomationElement *element, __RPC__deref_out_opt IUIAutomationElement **first) = 0;
+ virtual HRESULT STDMETHODCALLTYPE GetLastChildElement(__RPC__in_opt IUIAutomationElement *element, __RPC__deref_out_opt IUIAutomationElement **last) = 0;
+ virtual HRESULT STDMETHODCALLTYPE GetNextSiblingElement(__RPC__in_opt IUIAutomationElement *element, __RPC__deref_out_opt IUIAutomationElement **next) = 0;
+ virtual HRESULT STDMETHODCALLTYPE GetPreviousSiblingElement(__RPC__in_opt IUIAutomationElement *element, __RPC__deref_out_opt IUIAutomationElement **previous) = 0;
+ virtual HRESULT STDMETHODCALLTYPE NormalizeElement(__RPC__in_opt IUIAutomationElement *element, __RPC__deref_out_opt IUIAutomationElement **normalized) = 0;
+ virtual HRESULT STDMETHODCALLTYPE GetParentElementBuildCache(__RPC__in_opt IUIAutomationElement *element, __RPC__in_opt IUIAutomationCacheRequest *cacheRequest, __RPC__deref_out_opt IUIAutomationElement **parent) = 0;
+ virtual HRESULT STDMETHODCALLTYPE GetFirstChildElementBuildCache(__RPC__in_opt IUIAutomationElement *element, __RPC__in_opt IUIAutomationCacheRequest *cacheRequest, __RPC__deref_out_opt IUIAutomationElement **first) = 0;
+ virtual HRESULT STDMETHODCALLTYPE GetLastChildElementBuildCache(__RPC__in_opt IUIAutomationElement *element, __RPC__in_opt IUIAutomationCacheRequest *cacheRequest, __RPC__deref_out_opt IUIAutomationElement **last) = 0;
+ virtual HRESULT STDMETHODCALLTYPE GetNextSiblingElementBuildCache(__RPC__in_opt IUIAutomationElement *element, __RPC__in_opt IUIAutomationCacheRequest *cacheRequest, __RPC__deref_out_opt IUIAutomationElement **next) = 0;
+ virtual HRESULT STDMETHODCALLTYPE GetPreviousSiblingElementBuildCache(__RPC__in_opt IUIAutomationElement *element, __RPC__in_opt IUIAutomationCacheRequest *cacheRequest, __RPC__deref_out_opt IUIAutomationElement **previous) = 0;
+ virtual HRESULT STDMETHODCALLTYPE NormalizeElementBuildCache(__RPC__in_opt IUIAutomationElement *element, __RPC__in_opt IUIAutomationCacheRequest *cacheRequest, __RPC__deref_out_opt IUIAutomationElement **normalized) = 0;
+ virtual HRESULT STDMETHODCALLTYPE get_Condition(__RPC__deref_out_opt IUIAutomationCondition **condition) = 0;
+};
+#ifdef __CRT_UUID_DECL
+__CRT_UUID_DECL(IUIAutomationTreeWalker, 0x4042c624, 0x389c, 0x4afc, 0xa6,0x30, 0x9d,0xf8,0x54,0xa5,0x41,0xfc)
+#endif
+#endif
+
+DEFINE_GUID(CLSID_CUIAutomation, 0xff48dba4, 0x60ef, 0x4201, 0xaa,0x87, 0x54,0x10,0x3e,0xef,0x59,0x4e);
+
+#endif
diff --git a/src/platformsupport/windowsuiautomation/uiacontroltypeids_p.h b/src/platformsupport/windowsuiautomation/uiacontroltypeids_p.h
new file mode 100644
index 0000000000..d77fc68da9
--- /dev/null
+++ b/src/platformsupport/windowsuiautomation/uiacontroltypeids_p.h
@@ -0,0 +1,85 @@
+/****************************************************************************
+**
+** Copyright (C) 2017 The Qt Company Ltd.
+** Contact: https://www.qt.io/licensing/
+**
+** This file is part of the QtGui module of the Qt Toolkit.
+**
+** $QT_BEGIN_LICENSE:LGPL$
+** Commercial License Usage
+** Licensees holding valid commercial Qt licenses may use this file in
+** accordance with the commercial license agreement provided with the
+** Software or, alternatively, in accordance with the terms contained in
+** a written agreement between you and The Qt Company. For licensing terms
+** and conditions see https://www.qt.io/terms-conditions. For further
+** information use the contact form at https://www.qt.io/contact-us.
+**
+** GNU Lesser General Public License Usage
+** Alternatively, this file may be used under the terms of the GNU Lesser
+** General Public License version 3 as published by the Free Software
+** Foundation and appearing in the file LICENSE.LGPL3 included in the
+** packaging of this file. Please review the following information to
+** ensure the GNU Lesser General Public License version 3 requirements
+** will be met: https://www.gnu.org/licenses/lgpl-3.0.html.
+**
+** GNU General Public License Usage
+** Alternatively, this file may be used under the terms of the GNU
+** General Public License version 2.0 or (at your option) the GNU General
+** Public license version 3 or any later version approved by the KDE Free
+** Qt Foundation. The licenses are as published by the Free Software
+** Foundation and appearing in the file LICENSE.GPL2 and LICENSE.GPL3
+** included in the packaging of this file. Please review the following
+** information to ensure the GNU General Public License requirements will
+** be met: https://www.gnu.org/licenses/gpl-2.0.html and
+** https://www.gnu.org/licenses/gpl-3.0.html.
+**
+** $QT_END_LICENSE$
+**
+****************************************************************************/
+
+#ifndef UIACONTROLTYPEIDS_H
+#define UIACONTROLTYPEIDS_H
+
+#define UIA_ButtonControlTypeId 50000
+#define UIA_CalendarControlTypeId 50001
+#define UIA_CheckBoxControlTypeId 50002
+#define UIA_ComboBoxControlTypeId 50003
+#define UIA_EditControlTypeId 50004
+#define UIA_HyperlinkControlTypeId 50005
+#define UIA_ImageControlTypeId 50006
+#define UIA_ListItemControlTypeId 50007
+#define UIA_ListControlTypeId 50008
+#define UIA_MenuControlTypeId 50009
+#define UIA_MenuBarControlTypeId 50010
+#define UIA_MenuItemControlTypeId 50011
+#define UIA_ProgressBarControlTypeId 50012
+#define UIA_RadioButtonControlTypeId 50013
+#define UIA_ScrollBarControlTypeId 50014
+#define UIA_SliderControlTypeId 50015
+#define UIA_SpinnerControlTypeId 50016
+#define UIA_StatusBarControlTypeId 50017
+#define UIA_TabControlTypeId 50018
+#define UIA_TabItemControlTypeId 50019
+#define UIA_TextControlTypeId 50020
+#define UIA_ToolBarControlTypeId 50021
+#define UIA_ToolTipControlTypeId 50022
+#define UIA_TreeControlTypeId 50023
+#define UIA_TreeItemControlTypeId 50024
+#define UIA_CustomControlTypeId 50025
+#define UIA_GroupControlTypeId 50026
+#define UIA_ThumbControlTypeId 50027
+#define UIA_DataGridControlTypeId 50028
+#define UIA_DataItemControlTypeId 50029
+#define UIA_DocumentControlTypeId 50030
+#define UIA_SplitButtonControlTypeId 50031
+#define UIA_WindowControlTypeId 50032
+#define UIA_PaneControlTypeId 50033
+#define UIA_HeaderControlTypeId 50034
+#define UIA_HeaderItemControlTypeId 50035
+#define UIA_TableControlTypeId 50036
+#define UIA_TitleBarControlTypeId 50037
+#define UIA_SeparatorControlTypeId 50038
+#define UIA_SemanticZoomControlTypeId 50039
+#define UIA_AppBarControlTypeId 50040
+
+#endif
diff --git a/src/platformsupport/windowsuiautomation/uiaerrorids_p.h b/src/platformsupport/windowsuiautomation/uiaerrorids_p.h
new file mode 100644
index 0000000000..c25453007d
--- /dev/null
+++ b/src/platformsupport/windowsuiautomation/uiaerrorids_p.h
@@ -0,0 +1,51 @@
+/****************************************************************************
+**
+** Copyright (C) 2017 The Qt Company Ltd.
+** Contact: https://www.qt.io/licensing/
+**
+** This file is part of the QtGui module of the Qt Toolkit.
+**
+** $QT_BEGIN_LICENSE:LGPL$
+** Commercial License Usage
+** Licensees holding valid commercial Qt licenses may use this file in
+** accordance with the commercial license agreement provided with the
+** Software or, alternatively, in accordance with the terms contained in
+** a written agreement between you and The Qt Company. For licensing terms
+** and conditions see https://www.qt.io/terms-conditions. For further
+** information use the contact form at https://www.qt.io/contact-us.
+**
+** GNU Lesser General Public License Usage
+** Alternatively, this file may be used under the terms of the GNU Lesser
+** General Public License version 3 as published by the Free Software
+** Foundation and appearing in the file LICENSE.LGPL3 included in the
+** packaging of this file. Please review the following information to
+** ensure the GNU Lesser General Public License version 3 requirements
+** will be met: https://www.gnu.org/licenses/lgpl-3.0.html.
+**
+** GNU General Public License Usage
+** Alternatively, this file may be used under the terms of the GNU
+** General Public License version 2.0 or (at your option) the GNU General
+** Public license version 3 or any later version approved by the KDE Free
+** Qt Foundation. The licenses are as published by the Free Software
+** Foundation and appearing in the file LICENSE.GPL2 and LICENSE.GPL3
+** included in the packaging of this file. Please review the following
+** information to ensure the GNU General Public License requirements will
+** be met: https://www.gnu.org/licenses/gpl-2.0.html and
+** https://www.gnu.org/licenses/gpl-3.0.html.
+**
+** $QT_END_LICENSE$
+**
+****************************************************************************/
+
+#ifndef UIAERRORIDS_H
+#define UIAERRORIDS_H
+
+#define UIA_E_ELEMENTNOTENABLED 0x80040200
+#define UIA_E_ELEMENTNOTAVAILABLE 0x80040201
+#define UIA_E_NOCLICKABLEPOINT 0x80040202
+#define UIA_E_PROXYASSEMBLYNOTLOADED 0x80040203
+#define UIA_E_NOTSUPPORTED 0x80040204
+#define UIA_E_INVALIDOPERATION 0x80131509
+#define UIA_E_TIMEOUT 0x80131505
+
+#endif
diff --git a/src/platformsupport/windowsuiautomation/uiaeventids_p.h b/src/platformsupport/windowsuiautomation/uiaeventids_p.h
new file mode 100644
index 0000000000..2b414968ed
--- /dev/null
+++ b/src/platformsupport/windowsuiautomation/uiaeventids_p.h
@@ -0,0 +1,79 @@
+/****************************************************************************
+**
+** Copyright (C) 2017 The Qt Company Ltd.
+** Contact: https://www.qt.io/licensing/
+**
+** This file is part of the QtGui module of the Qt Toolkit.
+**
+** $QT_BEGIN_LICENSE:LGPL$
+** Commercial License Usage
+** Licensees holding valid commercial Qt licenses may use this file in
+** accordance with the commercial license agreement provided with the
+** Software or, alternatively, in accordance with the terms contained in
+** a written agreement between you and The Qt Company. For licensing terms
+** and conditions see https://www.qt.io/terms-conditions. For further
+** information use the contact form at https://www.qt.io/contact-us.
+**
+** GNU Lesser General Public License Usage
+** Alternatively, this file may be used under the terms of the GNU Lesser
+** General Public License version 3 as published by the Free Software
+** Foundation and appearing in the file LICENSE.LGPL3 included in the
+** packaging of this file. Please review the following information to
+** ensure the GNU Lesser General Public License version 3 requirements
+** will be met: https://www.gnu.org/licenses/lgpl-3.0.html.
+**
+** GNU General Public License Usage
+** Alternatively, this file may be used under the terms of the GNU
+** General Public License version 2.0 or (at your option) the GNU General
+** Public license version 3 or any later version approved by the KDE Free
+** Qt Foundation. The licenses are as published by the Free Software
+** Foundation and appearing in the file LICENSE.GPL2 and LICENSE.GPL3
+** included in the packaging of this file. Please review the following
+** information to ensure the GNU General Public License requirements will
+** be met: https://www.gnu.org/licenses/gpl-2.0.html and
+** https://www.gnu.org/licenses/gpl-3.0.html.
+**
+** $QT_END_LICENSE$
+**
+****************************************************************************/
+
+#ifndef UIAEVENTIDS_H
+#define UIAEVENTIDS_H
+
+#define UIA_ToolTipOpenedEventId 20000
+#define UIA_ToolTipClosedEventId 20001
+#define UIA_StructureChangedEventId 20002
+#define UIA_MenuOpenedEventId 20003
+#define UIA_AutomationPropertyChangedEventId 20004
+#define UIA_AutomationFocusChangedEventId 20005
+#define UIA_AsyncContentLoadedEventId 20006
+#define UIA_MenuClosedEventId 20007
+#define UIA_LayoutInvalidatedEventId 20008
+#define UIA_Invoke_InvokedEventId 20009
+#define UIA_SelectionItem_ElementAddedToSelectionEventId 20010
+#define UIA_SelectionItem_ElementRemovedFromSelectionEventId 20011
+#define UIA_SelectionItem_ElementSelectedEventId 20012
+#define UIA_Selection_InvalidatedEventId 20013
+#define UIA_Text_TextSelectionChangedEventId 20014
+#define UIA_Text_TextChangedEventId 20015
+#define UIA_Window_WindowOpenedEventId 20016
+#define UIA_Window_WindowClosedEventId 20017
+#define UIA_MenuModeStartEventId 20018
+#define UIA_MenuModeEndEventId 20019
+#define UIA_InputReachedTargetEventId 20020
+#define UIA_InputReachedOtherElementEventId 20021
+#define UIA_InputDiscardedEventId 20022
+#define UIA_SystemAlertEventId 20023
+#define UIA_LiveRegionChangedEventId 20024
+#define UIA_HostedFragmentRootsInvalidatedEventId 20025
+#define UIA_Drag_DragStartEventId 20026
+#define UIA_Drag_DragCancelEventId 20027
+#define UIA_Drag_DragCompleteEventId 20028
+#define UIA_DropTarget_DragEnterEventId 20029
+#define UIA_DropTarget_DragLeaveEventId 20030
+#define UIA_DropTarget_DroppedEventId 20031
+#define UIA_TextEdit_TextChangedEventId 20032
+#define UIA_TextEdit_ConversionTargetChangedEventId 20033
+#define UIA_ChangesEventId 20034
+
+#endif
diff --git a/src/platformsupport/windowsuiautomation/uiageneralids_p.h b/src/platformsupport/windowsuiautomation/uiageneralids_p.h
new file mode 100644
index 0000000000..62c795b94a
--- /dev/null
+++ b/src/platformsupport/windowsuiautomation/uiageneralids_p.h
@@ -0,0 +1,46 @@
+/****************************************************************************
+**
+** Copyright (C) 2017 The Qt Company Ltd.
+** Contact: https://www.qt.io/licensing/
+**
+** This file is part of the QtGui module of the Qt Toolkit.
+**
+** $QT_BEGIN_LICENSE:LGPL$
+** Commercial License Usage
+** Licensees holding valid commercial Qt licenses may use this file in
+** accordance with the commercial license agreement provided with the
+** Software or, alternatively, in accordance with the terms contained in
+** a written agreement between you and The Qt Company. For licensing terms
+** and conditions see https://www.qt.io/terms-conditions. For further
+** information use the contact form at https://www.qt.io/contact-us.
+**
+** GNU Lesser General Public License Usage
+** Alternatively, this file may be used under the terms of the GNU Lesser
+** General Public License version 3 as published by the Free Software
+** Foundation and appearing in the file LICENSE.LGPL3 included in the
+** packaging of this file. Please review the following information to
+** ensure the GNU Lesser General Public License version 3 requirements
+** will be met: https://www.gnu.org/licenses/lgpl-3.0.html.
+**
+** GNU General Public License Usage
+** Alternatively, this file may be used under the terms of the GNU
+** General Public License version 2.0 or (at your option) the GNU General
+** Public license version 3 or any later version approved by the KDE Free
+** Qt Foundation. The licenses are as published by the Free Software
+** Foundation and appearing in the file LICENSE.GPL2 and LICENSE.GPL3
+** included in the packaging of this file. Please review the following
+** information to ensure the GNU General Public License requirements will
+** be met: https://www.gnu.org/licenses/gpl-2.0.html and
+** https://www.gnu.org/licenses/gpl-3.0.html.
+**
+** $QT_END_LICENSE$
+**
+****************************************************************************/
+
+#ifndef UIAGENERALIDS_H
+#define UIAGENERALIDS_H
+
+#define UiaAppendRuntimeId 3
+#define UiaRootObjectId -25
+
+#endif
diff --git a/src/platformsupport/windowsuiautomation/uiapatternids_p.h b/src/platformsupport/windowsuiautomation/uiapatternids_p.h
new file mode 100644
index 0000000000..114aabcaa5
--- /dev/null
+++ b/src/platformsupport/windowsuiautomation/uiapatternids_p.h
@@ -0,0 +1,78 @@
+/****************************************************************************
+**
+** Copyright (C) 2017 The Qt Company Ltd.
+** Contact: https://www.qt.io/licensing/
+**
+** This file is part of the QtGui module of the Qt Toolkit.
+**
+** $QT_BEGIN_LICENSE:LGPL$
+** Commercial License Usage
+** Licensees holding valid commercial Qt licenses may use this file in
+** accordance with the commercial license agreement provided with the
+** Software or, alternatively, in accordance with the terms contained in
+** a written agreement between you and The Qt Company. For licensing terms
+** and conditions see https://www.qt.io/terms-conditions. For further
+** information use the contact form at https://www.qt.io/contact-us.
+**
+** GNU Lesser General Public License Usage
+** Alternatively, this file may be used under the terms of the GNU Lesser
+** General Public License version 3 as published by the Free Software
+** Foundation and appearing in the file LICENSE.LGPL3 included in the
+** packaging of this file. Please review the following information to
+** ensure the GNU Lesser General Public License version 3 requirements
+** will be met: https://www.gnu.org/licenses/lgpl-3.0.html.
+**
+** GNU General Public License Usage
+** Alternatively, this file may be used under the terms of the GNU
+** General Public License version 2.0 or (at your option) the GNU General
+** Public license version 3 or any later version approved by the KDE Free
+** Qt Foundation. The licenses are as published by the Free Software
+** Foundation and appearing in the file LICENSE.GPL2 and LICENSE.GPL3
+** included in the packaging of this file. Please review the following
+** information to ensure the GNU General Public License requirements will
+** be met: https://www.gnu.org/licenses/gpl-2.0.html and
+** https://www.gnu.org/licenses/gpl-3.0.html.
+**
+** $QT_END_LICENSE$
+**
+****************************************************************************/
+
+#ifndef UIAPATTERNIDS_H
+#define UIAPATTERNIDS_H
+
+#define UIA_InvokePatternId 10000
+#define UIA_SelectionPatternId 10001
+#define UIA_ValuePatternId 10002
+#define UIA_RangeValuePatternId 10003
+#define UIA_ScrollPatternId 10004
+#define UIA_ExpandCollapsePatternId 10005
+#define UIA_GridPatternId 10006
+#define UIA_GridItemPatternId 10007
+#define UIA_MultipleViewPatternId 10008
+#define UIA_WindowPatternId 10009
+#define UIA_SelectionItemPatternId 10010
+#define UIA_DockPatternId 10011
+#define UIA_TablePatternId 10012
+#define UIA_TableItemPatternId 10013
+#define UIA_TextPatternId 10014
+#define UIA_TogglePatternId 10015
+#define UIA_TransformPatternId 10016
+#define UIA_ScrollItemPatternId 10017
+#define UIA_LegacyIAccessiblePatternId 10018
+#define UIA_ItemContainerPatternId 10019
+#define UIA_VirtualizedItemPatternId 10020
+#define UIA_SynchronizedInputPatternId 10021
+#define UIA_ObjectModelPatternId 10022
+#define UIA_AnnotationPatternId 10023
+#define UIA_TextPattern2Id 10024
+#define UIA_StylesPatternId 10025
+#define UIA_SpreadsheetPatternId 10026
+#define UIA_SpreadsheetItemPatternId 10027
+#define UIA_TransformPattern2Id 10028
+#define UIA_TextChildPatternId 10029
+#define UIA_DragPatternId 10030
+#define UIA_DropTargetPatternId 10031
+#define UIA_TextEditPatternId 10032
+#define UIA_CustomNavigationPatternId 10033
+
+#endif
diff --git a/src/platformsupport/windowsuiautomation/uiapropertyids_p.h b/src/platformsupport/windowsuiautomation/uiapropertyids_p.h
new file mode 100644
index 0000000000..5c35c956f8
--- /dev/null
+++ b/src/platformsupport/windowsuiautomation/uiapropertyids_p.h
@@ -0,0 +1,212 @@
+/****************************************************************************
+**
+** Copyright (C) 2017 The Qt Company Ltd.
+** Contact: https://www.qt.io/licensing/
+**
+** This file is part of the QtGui module of the Qt Toolkit.
+**
+** $QT_BEGIN_LICENSE:LGPL$
+** Commercial License Usage
+** Licensees holding valid commercial Qt licenses may use this file in
+** accordance with the commercial license agreement provided with the
+** Software or, alternatively, in accordance with the terms contained in
+** a written agreement between you and The Qt Company. For licensing terms
+** and conditions see https://www.qt.io/terms-conditions. For further
+** information use the contact form at https://www.qt.io/contact-us.
+**
+** GNU Lesser General Public License Usage
+** Alternatively, this file may be used under the terms of the GNU Lesser
+** General Public License version 3 as published by the Free Software
+** Foundation and appearing in the file LICENSE.LGPL3 included in the
+** packaging of this file. Please review the following information to
+** ensure the GNU Lesser General Public License version 3 requirements
+** will be met: https://www.gnu.org/licenses/lgpl-3.0.html.
+**
+** GNU General Public License Usage
+** Alternatively, this file may be used under the terms of the GNU
+** General Public License version 2.0 or (at your option) the GNU General
+** Public license version 3 or any later version approved by the KDE Free
+** Qt Foundation. The licenses are as published by the Free Software
+** Foundation and appearing in the file LICENSE.GPL2 and LICENSE.GPL3
+** included in the packaging of this file. Please review the following
+** information to ensure the GNU General Public License requirements will
+** be met: https://www.gnu.org/licenses/gpl-2.0.html and
+** https://www.gnu.org/licenses/gpl-3.0.html.
+**
+** $QT_END_LICENSE$
+**
+****************************************************************************/
+
+#ifndef UIAPROPERTYIDS_H
+#define UIAPROPERTYIDS_H
+
+#define UIA_RuntimeIdPropertyId 30000
+#define UIA_BoundingRectanglePropertyId 30001
+#define UIA_ProcessIdPropertyId 30002
+#define UIA_ControlTypePropertyId 30003
+#define UIA_LocalizedControlTypePropertyId 30004
+#define UIA_NamePropertyId 30005
+#define UIA_AcceleratorKeyPropertyId 30006
+#define UIA_AccessKeyPropertyId 30007
+#define UIA_HasKeyboardFocusPropertyId 30008
+#define UIA_IsKeyboardFocusablePropertyId 30009
+#define UIA_IsEnabledPropertyId 30010
+#define UIA_AutomationIdPropertyId 30011
+#define UIA_ClassNamePropertyId 30012
+#define UIA_HelpTextPropertyId 30013
+#define UIA_ClickablePointPropertyId 30014
+#define UIA_CulturePropertyId 30015
+#define UIA_IsControlElementPropertyId 30016
+#define UIA_IsContentElementPropertyId 30017
+#define UIA_LabeledByPropertyId 30018
+#define UIA_IsPasswordPropertyId 30019
+#define UIA_NativeWindowHandlePropertyId 30020
+#define UIA_ItemTypePropertyId 30021
+#define UIA_IsOffscreenPropertyId 30022
+#define UIA_OrientationPropertyId 30023
+#define UIA_FrameworkIdPropertyId 30024
+#define UIA_IsRequiredForFormPropertyId 30025
+#define UIA_ItemStatusPropertyId 30026
+#define UIA_IsDockPatternAvailablePropertyId 30027
+#define UIA_IsExpandCollapsePatternAvailablePropertyId 30028
+#define UIA_IsGridItemPatternAvailablePropertyId 30029
+#define UIA_IsGridPatternAvailablePropertyId 30030
+#define UIA_IsInvokePatternAvailablePropertyId 30031
+#define UIA_IsMultipleViewPatternAvailablePropertyId 30032
+#define UIA_IsRangeValuePatternAvailablePropertyId 30033
+#define UIA_IsScrollPatternAvailablePropertyId 30034
+#define UIA_IsScrollItemPatternAvailablePropertyId 30035
+#define UIA_IsSelectionItemPatternAvailablePropertyId 30036
+#define UIA_IsSelectionPatternAvailablePropertyId 30037
+#define UIA_IsTablePatternAvailablePropertyId 30038
+#define UIA_IsTableItemPatternAvailablePropertyId 30039
+#define UIA_IsTextPatternAvailablePropertyId 30040
+#define UIA_IsTogglePatternAvailablePropertyId 30041
+#define UIA_IsTransformPatternAvailablePropertyId 30042
+#define UIA_IsValuePatternAvailablePropertyId 30043
+#define UIA_IsWindowPatternAvailablePropertyId 30044
+#define UIA_ValueValuePropertyId 30045
+#define UIA_ValueIsReadOnlyPropertyId 30046
+#define UIA_RangeValueValuePropertyId 30047
+#define UIA_RangeValueIsReadOnlyPropertyId 30048
+#define UIA_RangeValueMinimumPropertyId 30049
+#define UIA_RangeValueMaximumPropertyId 30050
+#define UIA_RangeValueLargeChangePropertyId 30051
+#define UIA_RangeValueSmallChangePropertyId 30052
+#define UIA_ScrollHorizontalScrollPercentPropertyId 30053
+#define UIA_ScrollHorizontalViewSizePropertyId 30054
+#define UIA_ScrollVerticalScrollPercentPropertyId 30055
+#define UIA_ScrollVerticalViewSizePropertyId 30056
+#define UIA_ScrollHorizontallyScrollablePropertyId 30057
+#define UIA_ScrollVerticallyScrollablePropertyId 30058
+#define UIA_SelectionSelectionPropertyId 30059
+#define UIA_SelectionCanSelectMultiplePropertyId 30060
+#define UIA_SelectionIsSelectionRequiredPropertyId 30061
+#define UIA_GridRowCountPropertyId 30062
+#define UIA_GridColumnCountPropertyId 30063
+#define UIA_GridItemRowPropertyId 30064
+#define UIA_GridItemColumnPropertyId 30065
+#define UIA_GridItemRowSpanPropertyId 30066
+#define UIA_GridItemColumnSpanPropertyId 30067
+#define UIA_GridItemContainingGridPropertyId 30068
+#define UIA_DockDockPositionPropertyId 30069
+#define UIA_ExpandCollapseExpandCollapseStatePropertyId 30070
+#define UIA_MultipleViewCurrentViewPropertyId 30071
+#define UIA_MultipleViewSupportedViewsPropertyId 30072
+#define UIA_WindowCanMaximizePropertyId 30073
+#define UIA_WindowCanMinimizePropertyId 30074
+#define UIA_WindowWindowVisualStatePropertyId 30075
+#define UIA_WindowWindowInteractionStatePropertyId 30076
+#define UIA_WindowIsModalPropertyId 30077
+#define UIA_WindowIsTopmostPropertyId 30078
+#define UIA_SelectionItemIsSelectedPropertyId 30079
+#define UIA_SelectionItemSelectionContainerPropertyId 30080
+#define UIA_TableRowHeadersPropertyId 30081
+#define UIA_TableColumnHeadersPropertyId 30082
+#define UIA_TableRowOrColumnMajorPropertyId 30083
+#define UIA_TableItemRowHeaderItemsPropertyId 30084
+#define UIA_TableItemColumnHeaderItemsPropertyId 30085
+#define UIA_ToggleToggleStatePropertyId 30086
+#define UIA_TransformCanMovePropertyId 30087
+#define UIA_TransformCanResizePropertyId 30088
+#define UIA_TransformCanRotatePropertyId 30089
+#define UIA_IsLegacyIAccessiblePatternAvailablePropertyId 30090
+#define UIA_LegacyIAccessibleChildIdPropertyId 30091
+#define UIA_LegacyIAccessibleNamePropertyId 30092
+#define UIA_LegacyIAccessibleValuePropertyId 30093
+#define UIA_LegacyIAccessibleDescriptionPropertyId 30094
+#define UIA_LegacyIAccessibleRolePropertyId 30095
+#define UIA_LegacyIAccessibleStatePropertyId 30096
+#define UIA_LegacyIAccessibleHelpPropertyId 30097
+#define UIA_LegacyIAccessibleKeyboardShortcutPropertyId 30098
+#define UIA_LegacyIAccessibleSelectionPropertyId 30099
+#define UIA_LegacyIAccessibleDefaultActionPropertyId 30100
+#define UIA_AriaRolePropertyId 30101
+#define UIA_AriaPropertiesPropertyId 30102
+#define UIA_IsDataValidForFormPropertyId 30103
+#define UIA_ControllerForPropertyId 30104
+#define UIA_DescribedByPropertyId 30105
+#define UIA_FlowsToPropertyId 30106
+#define UIA_ProviderDescriptionPropertyId 30107
+#define UIA_IsItemContainerPatternAvailablePropertyId 30108
+#define UIA_IsVirtualizedItemPatternAvailablePropertyId 30109
+#define UIA_IsSynchronizedInputPatternAvailablePropertyId 30110
+#define UIA_OptimizeForVisualContentPropertyId 30111
+#define UIA_IsObjectModelPatternAvailablePropertyId 30112
+#define UIA_AnnotationAnnotationTypeIdPropertyId 30113
+#define UIA_AnnotationAnnotationTypeNamePropertyId 30114
+#define UIA_AnnotationAuthorPropertyId 30115
+#define UIA_AnnotationDateTimePropertyId 30116
+#define UIA_AnnotationTargetPropertyId 30117
+#define UIA_IsAnnotationPatternAvailablePropertyId 30118
+#define UIA_IsTextPattern2AvailablePropertyId 30119
+#define UIA_StylesStyleIdPropertyId 30120
+#define UIA_StylesStyleNamePropertyId 30121
+#define UIA_StylesFillColorPropertyId 30122
+#define UIA_StylesFillPatternStylePropertyId 30123
+#define UIA_StylesShapePropertyId 30124
+#define UIA_StylesFillPatternColorPropertyId 30125
+#define UIA_StylesExtendedPropertiesPropertyId 30126
+#define UIA_IsStylesPatternAvailablePropertyId 30127
+#define UIA_IsSpreadsheetPatternAvailablePropertyId 30128
+#define UIA_SpreadsheetItemFormulaPropertyId 30129
+#define UIA_SpreadsheetItemAnnotationObjectsPropertyId 30130
+#define UIA_SpreadsheetItemAnnotationTypesPropertyId 30131
+#define UIA_IsSpreadsheetItemPatternAvailablePropertyId 30132
+#define UIA_Transform2CanZoomPropertyId 30133
+#define UIA_IsTransformPattern2AvailablePropertyId 30134
+#define UIA_LiveSettingPropertyId 30135
+#define UIA_IsTextChildPatternAvailablePropertyId 30136
+#define UIA_IsDragPatternAvailablePropertyId 30137
+#define UIA_DragIsGrabbedPropertyId 30138
+#define UIA_DragDropEffectPropertyId 30139
+#define UIA_DragDropEffectsPropertyId 30140
+#define UIA_IsDropTargetPatternAvailablePropertyId 30141
+#define UIA_DropTargetDropTargetEffectPropertyId 30142
+#define UIA_DropTargetDropTargetEffectsPropertyId 30143
+#define UIA_DragGrabbedItemsPropertyId 30144
+#define UIA_Transform2ZoomLevelPropertyId 30145
+#define UIA_Transform2ZoomMinimumPropertyId 30146
+#define UIA_Transform2ZoomMaximumPropertyId 30147
+#define UIA_FlowsFromPropertyId 30148
+#define UIA_IsTextEditPatternAvailablePropertyId 30149
+#define UIA_IsPeripheralPropertyId 30150
+#define UIA_IsCustomNavigationPatternAvailablePropertyId 30151
+#define UIA_PositionInSetPropertyId 30152
+#define UIA_SizeOfSetPropertyId 30153
+#define UIA_LevelPropertyId 30154
+#define UIA_AnnotationTypesPropertyId 30155
+#define UIA_AnnotationObjectsPropertyId 30156
+#define UIA_LandmarkTypePropertyId 30157
+#define UIA_LocalizedLandmarkTypePropertyId 30158
+#define UIA_FullDescriptionPropertyId 30159
+#define UIA_FillColorPropertyId 30160
+#define UIA_OutlineColorPropertyId 30161
+#define UIA_FillTypePropertyId 30162
+#define UIA_VisualEffectsPropertyId 30163
+#define UIA_OutlineThicknessPropertyId 30164
+#define UIA_CenterPointPropertyId 30165
+#define UIA_RotationPropertyId 30166
+#define UIA_SizePropertyId 30167
+
+#endif
diff --git a/src/platformsupport/windowsuiautomation/uiaserverinterfaces_p.h b/src/platformsupport/windowsuiautomation/uiaserverinterfaces_p.h
new file mode 100644
index 0000000000..caae84755b
--- /dev/null
+++ b/src/platformsupport/windowsuiautomation/uiaserverinterfaces_p.h
@@ -0,0 +1,352 @@
+/****************************************************************************
+**
+** Copyright (C) 2017 The Qt Company Ltd.
+** Contact: https://www.qt.io/licensing/
+**
+** This file is part of the QtGui module of the Qt Toolkit.
+**
+** $QT_BEGIN_LICENSE:LGPL$
+** Commercial License Usage
+** Licensees holding valid commercial Qt licenses may use this file in
+** accordance with the commercial license agreement provided with the
+** Software or, alternatively, in accordance with the terms contained in
+** a written agreement between you and The Qt Company. For licensing terms
+** and conditions see https://www.qt.io/terms-conditions. For further
+** information use the contact form at https://www.qt.io/contact-us.
+**
+** GNU Lesser General Public License Usage
+** Alternatively, this file may be used under the terms of the GNU Lesser
+** General Public License version 3 as published by the Free Software
+** Foundation and appearing in the file LICENSE.LGPL3 included in the
+** packaging of this file. Please review the following information to
+** ensure the GNU Lesser General Public License version 3 requirements
+** will be met: https://www.gnu.org/licenses/lgpl-3.0.html.
+**
+** GNU General Public License Usage
+** Alternatively, this file may be used under the terms of the GNU
+** General Public License version 2.0 or (at your option) the GNU General
+** Public license version 3 or any later version approved by the KDE Free
+** Qt Foundation. The licenses are as published by the Free Software
+** Foundation and appearing in the file LICENSE.GPL2 and LICENSE.GPL3
+** included in the packaging of this file. Please review the following
+** information to ensure the GNU General Public License requirements will
+** be met: https://www.gnu.org/licenses/gpl-2.0.html and
+** https://www.gnu.org/licenses/gpl-3.0.html.
+**
+** $QT_END_LICENSE$
+**
+****************************************************************************/
+
+#ifndef UIASERVERINTERFACES_H
+#define UIASERVERINTERFACES_H
+
+#include <Unknwn.h>
+
+#ifndef __IRawElementProviderSimple_INTERFACE_DEFINED__
+#define __IRawElementProviderSimple_INTERFACE_DEFINED__
+DEFINE_GUID(IID_IRawElementProviderSimple, 0xd6dd68d1, 0x86fd, 0x4332, 0x86,0x66, 0x9a,0xbe,0xde,0xa2,0xd2,0x4c);
+MIDL_INTERFACE("d6dd68d1-86fd-4332-8666-9abedea2d24c")
+IRawElementProviderSimple : public IUnknown
+{
+public:
+ virtual HRESULT STDMETHODCALLTYPE get_ProviderOptions(__RPC__out enum ProviderOptions *pRetVal) = 0;
+ virtual HRESULT STDMETHODCALLTYPE GetPatternProvider(PATTERNID patternId, __RPC__deref_out_opt IUnknown **pRetVal) = 0;
+ virtual HRESULT STDMETHODCALLTYPE GetPropertyValue(PROPERTYID propertyId, __RPC__out VARIANT *pRetVal) = 0;
+ virtual HRESULT STDMETHODCALLTYPE get_HostRawElementProvider(__RPC__deref_out_opt IRawElementProviderSimple **pRetVal) = 0;
+};
+#ifdef __CRT_UUID_DECL
+__CRT_UUID_DECL(IRawElementProviderSimple, 0xd6dd68d1, 0x86fd, 0x4332, 0x86,0x66, 0x9a,0xbe,0xde,0xa2,0xd2,0x4c)
+#endif
+#endif
+
+
+#ifndef __IRawElementProviderFragmentRoot_FWD_DEFINED__
+#define __IRawElementProviderFragmentRoot_FWD_DEFINED__
+typedef interface IRawElementProviderFragmentRoot IRawElementProviderFragmentRoot;
+#endif
+
+
+#ifndef __IRawElementProviderFragment_FWD_DEFINED__
+#define __IRawElementProviderFragment_FWD_DEFINED__
+typedef interface IRawElementProviderFragment IRawElementProviderFragment;
+#endif
+
+
+#ifndef __IRawElementProviderFragment_INTERFACE_DEFINED__
+#define __IRawElementProviderFragment_INTERFACE_DEFINED__
+DEFINE_GUID(IID_IRawElementProviderFragment, 0xf7063da8, 0x8359, 0x439c, 0x92,0x97, 0xbb,0xc5,0x29,0x9a,0x7d,0x87);
+MIDL_INTERFACE("f7063da8-8359-439c-9297-bbc5299a7d87")
+IRawElementProviderFragment : public IUnknown
+{
+public:
+ virtual HRESULT STDMETHODCALLTYPE Navigate(enum NavigateDirection direction, __RPC__deref_out_opt IRawElementProviderFragment **pRetVal) = 0;
+ virtual HRESULT STDMETHODCALLTYPE GetRuntimeId(__RPC__deref_out_opt SAFEARRAY **pRetVal) = 0;
+ virtual HRESULT STDMETHODCALLTYPE get_BoundingRectangle(__RPC__out struct UiaRect *pRetVal) = 0;
+ virtual HRESULT STDMETHODCALLTYPE GetEmbeddedFragmentRoots(__RPC__deref_out_opt SAFEARRAY **pRetVal) = 0;
+ virtual HRESULT STDMETHODCALLTYPE SetFocus() = 0;
+ virtual HRESULT STDMETHODCALLTYPE get_FragmentRoot(__RPC__deref_out_opt IRawElementProviderFragmentRoot **pRetVal) = 0;
+};
+#ifdef __CRT_UUID_DECL
+__CRT_UUID_DECL(IRawElementProviderFragment, 0xf7063da8, 0x8359, 0x439c, 0x92,0x97, 0xbb,0xc5,0x29,0x9a,0x7d,0x87)
+#endif
+#endif
+
+
+#ifndef __IRawElementProviderFragmentRoot_INTERFACE_DEFINED__
+#define __IRawElementProviderFragmentRoot_INTERFACE_DEFINED__
+DEFINE_GUID(IID_IRawElementProviderFragmentRoot, 0x620ce2a5, 0xab8f, 0x40a9, 0x86,0xcb, 0xde,0x3c,0x75,0x59,0x9b,0x58);
+MIDL_INTERFACE("620ce2a5-ab8f-40a9-86cb-de3c75599b58")
+IRawElementProviderFragmentRoot : public IUnknown
+{
+public:
+ virtual HRESULT STDMETHODCALLTYPE ElementProviderFromPoint(double x, double y, __RPC__deref_out_opt IRawElementProviderFragment **pRetVal) = 0;
+ virtual HRESULT STDMETHODCALLTYPE GetFocus(__RPC__deref_out_opt IRawElementProviderFragment **pRetVal) = 0;
+};
+#ifdef __CRT_UUID_DECL
+__CRT_UUID_DECL(IRawElementProviderFragmentRoot, 0x620ce2a5, 0xab8f, 0x40a9, 0x86,0xcb, 0xde,0x3c,0x75,0x59,0x9b,0x58)
+#endif
+#endif
+
+
+#ifndef __IValueProvider_INTERFACE_DEFINED__
+#define __IValueProvider_INTERFACE_DEFINED__
+DEFINE_GUID(IID_IValueProvider, 0xc7935180, 0x6fb3, 0x4201, 0xb1,0x74, 0x7d,0xf7,0x3a,0xdb,0xf6,0x4a);
+MIDL_INTERFACE("c7935180-6fb3-4201-b174-7df73adbf64a")
+IValueProvider : public IUnknown
+{
+public:
+ virtual HRESULT STDMETHODCALLTYPE SetValue(__RPC__in LPCWSTR val) = 0;
+ virtual HRESULT STDMETHODCALLTYPE get_Value(__RPC__deref_out_opt BSTR *pRetVal) = 0;
+ virtual HRESULT STDMETHODCALLTYPE get_IsReadOnly(__RPC__out BOOL *pRetVal) = 0;
+};
+#ifdef __CRT_UUID_DECL
+__CRT_UUID_DECL(IValueProvider, 0xc7935180, 0x6fb3, 0x4201, 0xb1,0x74, 0x7d,0xf7,0x3a,0xdb,0xf6,0x4a)
+#endif
+#endif
+
+
+#ifndef __IRangeValueProvider_INTERFACE_DEFINED__
+#define __IRangeValueProvider_INTERFACE_DEFINED__
+DEFINE_GUID(IID_IRangeValueProvider, 0x36dc7aef, 0x33e6, 0x4691, 0xaf,0xe1, 0x2b,0xe7,0x27,0x4b,0x3d,0x33);
+MIDL_INTERFACE("36dc7aef-33e6-4691-afe1-2be7274b3d33")
+IRangeValueProvider : public IUnknown
+{
+public:
+ virtual HRESULT STDMETHODCALLTYPE SetValue(double val) = 0;
+ virtual HRESULT STDMETHODCALLTYPE get_Value(__RPC__out double *pRetVal) = 0;
+ virtual HRESULT STDMETHODCALLTYPE get_IsReadOnly(__RPC__out BOOL *pRetVal) = 0;
+ virtual HRESULT STDMETHODCALLTYPE get_Maximum(__RPC__out double *pRetVal) = 0;
+ virtual HRESULT STDMETHODCALLTYPE get_Minimum(__RPC__out double *pRetVal) = 0;
+ virtual HRESULT STDMETHODCALLTYPE get_LargeChange(__RPC__out double *pRetVal) = 0;
+ virtual HRESULT STDMETHODCALLTYPE get_SmallChange(__RPC__out double *pRetVal) = 0;
+};
+#ifdef __CRT_UUID_DECL
+__CRT_UUID_DECL(IRangeValueProvider, 0x36dc7aef, 0x33e6, 0x4691, 0xaf,0xe1, 0x2b,0xe7,0x27,0x4b,0x3d,0x33)
+#endif
+#endif
+
+
+#ifndef __ITextRangeProvider_INTERFACE_DEFINED__
+#define __ITextRangeProvider_INTERFACE_DEFINED__
+DEFINE_GUID(IID_ITextRangeProvider, 0x5347ad7b, 0xc355, 0x46f8, 0xaf,0xf5, 0x90,0x90,0x33,0x58,0x2f,0x63);
+MIDL_INTERFACE("5347ad7b-c355-46f8-aff5-909033582f63")
+ITextRangeProvider : public IUnknown
+{
+public:
+ virtual HRESULT STDMETHODCALLTYPE Clone(__RPC__deref_out_opt ITextRangeProvider **pRetVal) = 0;
+ virtual HRESULT STDMETHODCALLTYPE Compare(__RPC__in_opt ITextRangeProvider *range, __RPC__out BOOL *pRetVal) = 0;
+ virtual HRESULT STDMETHODCALLTYPE CompareEndpoints(enum TextPatternRangeEndpoint endpoint, __RPC__in_opt ITextRangeProvider *targetRange, enum TextPatternRangeEndpoint targetEndpoint, __RPC__out int *pRetVal) = 0;
+ virtual HRESULT STDMETHODCALLTYPE ExpandToEnclosingUnit(enum TextUnit unit) = 0;
+ virtual HRESULT STDMETHODCALLTYPE FindAttribute(TEXTATTRIBUTEID attributeId, VARIANT val, BOOL backward, __RPC__deref_out_opt ITextRangeProvider **pRetVal) = 0;
+ virtual HRESULT STDMETHODCALLTYPE FindText(__RPC__in BSTR text, BOOL backward, BOOL ignoreCase, __RPC__deref_out_opt ITextRangeProvider **pRetVal) = 0;
+ virtual HRESULT STDMETHODCALLTYPE GetAttributeValue(TEXTATTRIBUTEID attributeId, __RPC__out VARIANT *pRetVal) = 0;
+ virtual HRESULT STDMETHODCALLTYPE GetBoundingRectangles(__RPC__deref_out_opt SAFEARRAY **pRetVal) = 0;
+ virtual HRESULT STDMETHODCALLTYPE GetEnclosingElement(__RPC__deref_out_opt IRawElementProviderSimple **pRetVal) = 0;
+ virtual HRESULT STDMETHODCALLTYPE GetText(int maxLength, __RPC__deref_out_opt BSTR *pRetVal) = 0;
+ virtual HRESULT STDMETHODCALLTYPE Move(enum TextUnit unit, int count, __RPC__out int *pRetVal) = 0;
+ virtual HRESULT STDMETHODCALLTYPE MoveEndpointByUnit(enum TextPatternRangeEndpoint endpoint, enum TextUnit unit, int count, __RPC__out int *pRetVal) = 0;
+ virtual HRESULT STDMETHODCALLTYPE MoveEndpointByRange(enum TextPatternRangeEndpoint endpoint, __RPC__in_opt ITextRangeProvider *targetRange, enum TextPatternRangeEndpoint targetEndpoint) = 0;
+ virtual HRESULT STDMETHODCALLTYPE Select() = 0;
+ virtual HRESULT STDMETHODCALLTYPE AddToSelection() = 0;
+ virtual HRESULT STDMETHODCALLTYPE RemoveFromSelection() = 0;
+ virtual HRESULT STDMETHODCALLTYPE ScrollIntoView(BOOL alignToTop) = 0;
+ virtual HRESULT STDMETHODCALLTYPE GetChildren(__RPC__deref_out_opt SAFEARRAY **pRetVal) = 0;
+};
+#ifdef __CRT_UUID_DECL
+__CRT_UUID_DECL(ITextRangeProvider, 0x5347ad7b, 0xc355, 0x46f8, 0xaf,0xf5, 0x90,0x90,0x33,0x58,0x2f,0x63)
+#endif
+#endif
+
+
+#ifndef __ITextProvider_INTERFACE_DEFINED__
+#define __ITextProvider_INTERFACE_DEFINED__
+DEFINE_GUID(IID_ITextProvider, 0x3589c92c, 0x63f3, 0x4367, 0x99,0xbb, 0xad,0xa6,0x53,0xb7,0x7c,0xf2);
+MIDL_INTERFACE("3589c92c-63f3-4367-99bb-ada653b77cf2")
+ITextProvider : public IUnknown
+{
+public:
+ virtual HRESULT STDMETHODCALLTYPE GetSelection(__RPC__deref_out_opt SAFEARRAY **pRetVal) = 0;
+ virtual HRESULT STDMETHODCALLTYPE GetVisibleRanges(__RPC__deref_out_opt SAFEARRAY **pRetVal) = 0;
+ virtual HRESULT STDMETHODCALLTYPE RangeFromChild(__RPC__in_opt IRawElementProviderSimple *childElement, __RPC__deref_out_opt ITextRangeProvider **pRetVal) = 0;
+ virtual HRESULT STDMETHODCALLTYPE RangeFromPoint(struct UiaPoint point, __RPC__deref_out_opt ITextRangeProvider **pRetVal) = 0;
+ virtual HRESULT STDMETHODCALLTYPE get_DocumentRange(__RPC__deref_out_opt ITextRangeProvider **pRetVal) = 0;
+ virtual HRESULT STDMETHODCALLTYPE get_SupportedTextSelection(__RPC__out enum SupportedTextSelection *pRetVal) = 0;
+};
+#ifdef __CRT_UUID_DECL
+__CRT_UUID_DECL(ITextProvider, 0x3589c92c, 0x63f3, 0x4367, 0x99,0xbb, 0xad,0xa6,0x53,0xb7,0x7c,0xf2)
+#endif
+#endif
+
+
+#ifndef __ITextProvider2_INTERFACE_DEFINED__
+#define __ITextProvider2_INTERFACE_DEFINED__
+DEFINE_GUID(IID_ITextProvider2, 0x0dc5e6ed, 0x3e16, 0x4bf1, 0x8f,0x9a, 0xa9,0x79,0x87,0x8b,0xc1,0x95);
+MIDL_INTERFACE("0dc5e6ed-3e16-4bf1-8f9a-a979878bc195")
+ITextProvider2 : public ITextProvider
+{
+public:
+ virtual HRESULT STDMETHODCALLTYPE RangeFromAnnotation(__RPC__in_opt IRawElementProviderSimple *annotationElement, __RPC__deref_out_opt ITextRangeProvider **pRetVal) = 0;
+ virtual HRESULT STDMETHODCALLTYPE GetCaretRange(__RPC__out BOOL *isActive, __RPC__deref_out_opt ITextRangeProvider **pRetVal) = 0;
+};
+#ifdef __CRT_UUID_DECL
+__CRT_UUID_DECL(ITextProvider2, 0x0dc5e6ed, 0x3e16, 0x4bf1, 0x8f,0x9a, 0xa9,0x79,0x87,0x8b,0xc1,0x95)
+#endif
+#endif
+
+
+#ifndef __IToggleProvider_INTERFACE_DEFINED__
+#define __IToggleProvider_INTERFACE_DEFINED__
+DEFINE_GUID(IID_IToggleProvider, 0x56d00bd0, 0xc4f4, 0x433c, 0xa8,0x36, 0x1a,0x52,0xa5,0x7e,0x08,0x92);
+MIDL_INTERFACE("56d00bd0-c4f4-433c-a836-1a52a57e0892")
+IToggleProvider : public IUnknown
+{
+public:
+ virtual HRESULT STDMETHODCALLTYPE Toggle() = 0;
+ virtual HRESULT STDMETHODCALLTYPE get_ToggleState(__RPC__out enum ToggleState *pRetVal) = 0;
+};
+#ifdef __CRT_UUID_DECL
+__CRT_UUID_DECL(IToggleProvider, 0x56d00bd0, 0xc4f4, 0x433c, 0xa8,0x36, 0x1a,0x52,0xa5,0x7e,0x08,0x92)
+#endif
+#endif
+
+
+#ifndef __IInvokeProvider_INTERFACE_DEFINED__
+#define __IInvokeProvider_INTERFACE_DEFINED__
+DEFINE_GUID(IID_IInvokeProvider, 0x54fcb24b, 0xe18e, 0x47a2, 0xb4,0xd3, 0xec,0xcb,0xe7,0x75,0x99,0xa2);
+MIDL_INTERFACE("54fcb24b-e18e-47a2-b4d3-eccbe77599a2")
+IInvokeProvider : public IUnknown
+{
+public:
+ virtual HRESULT STDMETHODCALLTYPE Invoke() = 0;
+};
+#ifdef __CRT_UUID_DECL
+__CRT_UUID_DECL(IInvokeProvider, 0x54fcb24b, 0xe18e, 0x47a2, 0xb4,0xd3, 0xec,0xcb,0xe7,0x75,0x99,0xa2)
+#endif
+#endif
+
+
+#ifndef __ISelectionProvider_INTERFACE_DEFINED__
+#define __ISelectionProvider_INTERFACE_DEFINED__
+DEFINE_GUID(IID_ISelectionProvider, 0xfb8b03af, 0x3bdf, 0x48d4, 0xbd,0x36, 0x1a,0x65,0x79,0x3b,0xe1,0x68);
+MIDL_INTERFACE("fb8b03af-3bdf-48d4-bd36-1a65793be168")
+ISelectionProvider : public IUnknown
+{
+public:
+ virtual HRESULT STDMETHODCALLTYPE GetSelection(__RPC__deref_out_opt SAFEARRAY **pRetVal) = 0;
+ virtual HRESULT STDMETHODCALLTYPE get_CanSelectMultiple(__RPC__out BOOL *pRetVal) = 0;
+ virtual HRESULT STDMETHODCALLTYPE get_IsSelectionRequired(__RPC__out BOOL *pRetVal) = 0;
+};
+#ifdef __CRT_UUID_DECL
+__CRT_UUID_DECL(ISelectionProvider, 0xfb8b03af, 0x3bdf, 0x48d4, 0xbd,0x36, 0x1a,0x65,0x79,0x3b,0xe1,0x68)
+#endif
+#endif
+
+
+#ifndef __ISelectionItemProvider_INTERFACE_DEFINED__
+#define __ISelectionItemProvider_INTERFACE_DEFINED__
+DEFINE_GUID(IID_ISelectionItemProvider, 0x2acad808, 0xb2d4, 0x452d, 0xa4,0x07, 0x91,0xff,0x1a,0xd1,0x67,0xb2);
+MIDL_INTERFACE("2acad808-b2d4-452d-a407-91ff1ad167b2")
+ISelectionItemProvider : public IUnknown
+{
+public:
+ virtual HRESULT STDMETHODCALLTYPE Select() = 0;
+ virtual HRESULT STDMETHODCALLTYPE AddToSelection() = 0;
+ virtual HRESULT STDMETHODCALLTYPE RemoveFromSelection() = 0;
+ virtual HRESULT STDMETHODCALLTYPE get_IsSelected(__RPC__out BOOL *pRetVal) = 0;
+ virtual HRESULT STDMETHODCALLTYPE get_SelectionContainer(__RPC__deref_out_opt IRawElementProviderSimple **pRetVal) = 0;
+};
+#ifdef __CRT_UUID_DECL
+__CRT_UUID_DECL(ISelectionItemProvider, 0x2acad808, 0xb2d4, 0x452d, 0xa4,0x07, 0x91,0xff,0x1a,0xd1,0x67,0xb2)
+#endif
+#endif
+
+
+#ifndef __ITableProvider_INTERFACE_DEFINED__
+#define __ITableProvider_INTERFACE_DEFINED__
+DEFINE_GUID(IID_ITableProvider, 0x9c860395, 0x97b3, 0x490a, 0xb5,0x2a, 0x85,0x8c,0xc2,0x2a,0xf1,0x66);
+MIDL_INTERFACE("9c860395-97b3-490a-b52a-858cc22af166")
+ITableProvider : public IUnknown
+{
+public:
+ virtual HRESULT STDMETHODCALLTYPE GetRowHeaders(__RPC__deref_out_opt SAFEARRAY **pRetVal) = 0;
+ virtual HRESULT STDMETHODCALLTYPE GetColumnHeaders(__RPC__deref_out_opt SAFEARRAY **pRetVal) = 0;
+ virtual HRESULT STDMETHODCALLTYPE get_RowOrColumnMajor(__RPC__out enum RowOrColumnMajor *pRetVal) = 0;
+};
+#ifdef __CRT_UUID_DECL
+__CRT_UUID_DECL(ITableProvider, 0x9c860395, 0x97b3, 0x490a, 0xb5,0x2a, 0x85,0x8c,0xc2,0x2a,0xf1,0x66)
+#endif
+#endif
+
+
+#ifndef __ITableItemProvider_INTERFACE_DEFINED__
+#define __ITableItemProvider_INTERFACE_DEFINED__
+DEFINE_GUID(IID_ITableItemProvider, 0xb9734fa6, 0x771f, 0x4d78, 0x9c,0x90, 0x25,0x17,0x99,0x93,0x49,0xcd);
+MIDL_INTERFACE("b9734fa6-771f-4d78-9c90-2517999349cd")
+ITableItemProvider : public IUnknown
+{
+public:
+ virtual HRESULT STDMETHODCALLTYPE GetRowHeaderItems(__RPC__deref_out_opt SAFEARRAY **pRetVal) = 0;
+ virtual HRESULT STDMETHODCALLTYPE GetColumnHeaderItems(__RPC__deref_out_opt SAFEARRAY **pRetVal) = 0;
+};
+#ifdef __CRT_UUID_DECL
+__CRT_UUID_DECL(ITableItemProvider, 0xb9734fa6, 0x771f, 0x4d78, 0x9c,0x90, 0x25,0x17,0x99,0x93,0x49,0xcd)
+#endif
+#endif
+
+
+#ifndef __IGridProvider_INTERFACE_DEFINED__
+#define __IGridProvider_INTERFACE_DEFINED__
+DEFINE_GUID(IID_IGridProvider, 0xb17d6187, 0x0907, 0x464b, 0xa1,0x68, 0x0e,0xf1,0x7a,0x15,0x72,0xb1);
+MIDL_INTERFACE("b17d6187-0907-464b-a168-0ef17a1572b1")
+IGridProvider : public IUnknown
+{
+public:
+ virtual HRESULT STDMETHODCALLTYPE GetItem(int row, int column, __RPC__deref_out_opt IRawElementProviderSimple **pRetVal) = 0;
+ virtual HRESULT STDMETHODCALLTYPE get_RowCount(__RPC__out int *pRetVal) = 0;
+ virtual HRESULT STDMETHODCALLTYPE get_ColumnCount(__RPC__out int *pRetVal) = 0;
+};
+#ifdef __CRT_UUID_DECL
+__CRT_UUID_DECL(IGridProvider, 0xb17d6187, 0x0907, 0x464b, 0xa1,0x68, 0x0e,0xf1,0x7a,0x15,0x72,0xb1)
+#endif
+#endif
+
+
+#ifndef __IGridItemProvider_INTERFACE_DEFINED__
+#define __IGridItemProvider_INTERFACE_DEFINED__
+DEFINE_GUID(IID_IGridItemProvider, 0xd02541f1, 0xfb81, 0x4d64, 0xae,0x32, 0xf5,0x20,0xf8,0xa6,0xdb,0xd1);
+MIDL_INTERFACE("d02541f1-fb81-4d64-ae32-f520f8a6dbd1")
+IGridItemProvider : public IUnknown
+{
+public:
+ virtual HRESULT STDMETHODCALLTYPE get_Row(__RPC__out int *pRetVal) = 0;
+ virtual HRESULT STDMETHODCALLTYPE get_Column(__RPC__out int *pRetVal) = 0;
+ virtual HRESULT STDMETHODCALLTYPE get_RowSpan(__RPC__out int *pRetVal) = 0;
+ virtual HRESULT STDMETHODCALLTYPE get_ColumnSpan(__RPC__out int *pRetVal) = 0;
+ virtual HRESULT STDMETHODCALLTYPE get_ContainingGrid(__RPC__deref_out_opt IRawElementProviderSimple **pRetVal) = 0;
+};
+#ifdef __CRT_UUID_DECL
+__CRT_UUID_DECL(IGridItemProvider, 0xd02541f1, 0xfb81, 0x4d64, 0xae,0x32, 0xf5,0x20,0xf8,0xa6,0xdb,0xd1)
+#endif
+#endif
+
+#endif
diff --git a/src/platformsupport/windowsuiautomation/uiatypes_p.h b/src/platformsupport/windowsuiautomation/uiatypes_p.h
new file mode 100644
index 0000000000..25d8b8cb2b
--- /dev/null
+++ b/src/platformsupport/windowsuiautomation/uiatypes_p.h
@@ -0,0 +1,145 @@
+/****************************************************************************
+**
+** Copyright (C) 2017 The Qt Company Ltd.
+** Contact: https://www.qt.io/licensing/
+**
+** This file is part of the QtGui module of the Qt Toolkit.
+**
+** $QT_BEGIN_LICENSE:LGPL$
+** Commercial License Usage
+** Licensees holding valid commercial Qt licenses may use this file in
+** accordance with the commercial license agreement provided with the
+** Software or, alternatively, in accordance with the terms contained in
+** a written agreement between you and The Qt Company. For licensing terms
+** and conditions see https://www.qt.io/terms-conditions. For further
+** information use the contact form at https://www.qt.io/contact-us.
+**
+** GNU Lesser General Public License Usage
+** Alternatively, this file may be used under the terms of the GNU Lesser
+** General Public License version 3 as published by the Free Software
+** Foundation and appearing in the file LICENSE.LGPL3 included in the
+** packaging of this file. Please review the following information to
+** ensure the GNU Lesser General Public License version 3 requirements
+** will be met: https://www.gnu.org/licenses/lgpl-3.0.html.
+**
+** GNU General Public License Usage
+** Alternatively, this file may be used under the terms of the GNU
+** General Public License version 2.0 or (at your option) the GNU General
+** Public license version 3 or any later version approved by the KDE Free
+** Qt Foundation. The licenses are as published by the Free Software
+** Foundation and appearing in the file LICENSE.GPL2 and LICENSE.GPL3
+** included in the packaging of this file. Please review the following
+** information to ensure the GNU General Public License requirements will
+** be met: https://www.gnu.org/licenses/gpl-2.0.html and
+** https://www.gnu.org/licenses/gpl-3.0.html.
+**
+** $QT_END_LICENSE$
+**
+****************************************************************************/
+
+#ifndef UIATYPES_H
+#define UIATYPES_H
+
+typedef int PROPERTYID;
+typedef int PATTERNID;
+typedef int EVENTID;
+typedef int TEXTATTRIBUTEID;
+typedef int CONTROLTYPEID;
+typedef int LANDMARKTYPEID;
+typedef int METADATAID;
+
+typedef void *UIA_HWND;
+
+enum NavigateDirection {
+ NavigateDirection_Parent = 0,
+ NavigateDirection_NextSibling = 1,
+ NavigateDirection_PreviousSibling = 2,
+ NavigateDirection_FirstChild = 3,
+ NavigateDirection_LastChild = 4
+};
+
+enum ProviderOptions {
+ ProviderOptions_ClientSideProvider = 0x1,
+ ProviderOptions_ServerSideProvider = 0x2,
+ ProviderOptions_NonClientAreaProvider = 0x4,
+ ProviderOptions_OverrideProvider = 0x8,
+ ProviderOptions_ProviderOwnsSetFocus = 0x10,
+ ProviderOptions_UseComThreading = 0x20,
+ ProviderOptions_RefuseNonClientSupport = 0x40,
+ ProviderOptions_HasNativeIAccessible = 0x80,
+ ProviderOptions_UseClientCoordinates = 0x100
+};
+
+enum SupportedTextSelection {
+ SupportedTextSelection_None = 0,
+ SupportedTextSelection_Single = 1,
+ SupportedTextSelection_Multiple = 2
+};
+
+enum TextUnit {
+ TextUnit_Character = 0,
+ TextUnit_Format = 1,
+ TextUnit_Word = 2,
+ TextUnit_Line = 3,
+ TextUnit_Paragraph = 4,
+ TextUnit_Page = 5,
+ TextUnit_Document = 6
+};
+
+enum TextPatternRangeEndpoint {
+ TextPatternRangeEndpoint_Start = 0,
+ TextPatternRangeEndpoint_End = 1
+};
+
+enum CaretPosition {
+ CaretPosition_Unknown = 0,
+ CaretPosition_EndOfLine = 1,
+ CaretPosition_BeginningOfLine = 2
+};
+
+enum ToggleState {
+ ToggleState_Off = 0,
+ ToggleState_On = 1,
+ ToggleState_Indeterminate = 2
+};
+
+enum RowOrColumnMajor {
+ RowOrColumnMajor_RowMajor = 0,
+ RowOrColumnMajor_ColumnMajor = 1,
+ RowOrColumnMajor_Indeterminate = 2
+};
+
+enum TreeScope {
+ TreeScope_None = 0,
+ TreeScope_Element = 0x1,
+ TreeScope_Children = 0x2,
+ TreeScope_Descendants = 0x4,
+ TreeScope_Parent = 0x8,
+ TreeScope_Ancestors = 0x10,
+ TreeScope_Subtree = TreeScope_Element | TreeScope_Children | TreeScope_Descendants
+};
+
+enum OrientationType {
+ OrientationType_None = 0,
+ OrientationType_Horizontal = 1,
+ OrientationType_Vertical = 2
+};
+
+enum PropertyConditionFlags {
+ PropertyConditionFlags_None = 0,
+ PropertyConditionFlags_IgnoreCase = 1
+};
+
+struct UiaRect {
+ double left;
+ double top;
+ double width;
+ double height;
+};
+
+struct UiaPoint {
+ double x;
+ double y;
+};
+
+#endif
diff --git a/src/platformsupport/windowsuiautomation/windowsuiautomation.pro b/src/platformsupport/windowsuiautomation/windowsuiautomation.pro
new file mode 100644
index 0000000000..97cdb60ef9
--- /dev/null
+++ b/src/platformsupport/windowsuiautomation/windowsuiautomation.pro
@@ -0,0 +1,23 @@
+TARGET = QtWindowsUIAutomationSupport
+MODULE = windowsuiautomation_support
+
+QT = core-private gui-private
+CONFIG += static internal_module
+
+HEADERS += \
+ qwindowsuiawrapper_p.h \
+ uiaattributeids_p.h \
+ uiacontroltypeids_p.h \
+ uiaerrorids_p.h \
+ uiaeventids_p.h \
+ uiageneralids_p.h \
+ uiaserverinterfaces_p.h \
+ uiaclientinterfaces_p.h \
+ uiapatternids_p.h \
+ uiapropertyids_p.h \
+ uiatypes_p.h
+
+SOURCES += \
+ qwindowsuiawrapper.cpp
+
+load(qt_module)
diff --git a/src/plugins/bearer/android/jar/bundledjar.pro b/src/plugins/bearer/android/jar/bundledjar.pro
deleted file mode 100644
index 6037f813f2..0000000000
--- a/src/plugins/bearer/android/jar/bundledjar.pro
+++ /dev/null
@@ -1,3 +0,0 @@
-TARGET = QtAndroidBearer-bundled
-CONFIG += bundled_jar_file
-include(jar.pri)
diff --git a/src/plugins/bearer/android/jar/distributedjar.pro b/src/plugins/bearer/android/jar/distributedjar.pro
deleted file mode 100644
index c769a113d5..0000000000
--- a/src/plugins/bearer/android/jar/distributedjar.pro
+++ /dev/null
@@ -1,2 +0,0 @@
-TARGET = QtAndroidBearer
-include(jar.pri)
diff --git a/src/plugins/bearer/android/jar/jar.pri b/src/plugins/bearer/android/jar/jar.pri
deleted file mode 100644
index e43dbf0711..0000000000
--- a/src/plugins/bearer/android/jar/jar.pri
+++ /dev/null
@@ -1,11 +0,0 @@
-load(qt_build_paths)
-CONFIG += java
-DESTDIR = $$MODULE_BASE_OUTDIR/jar
-
-JAVACLASSPATH += $$PWD/src
-
-JAVASOURCES += $$PWD/src/org/qtproject/qt5/android/bearer/QtNetworkReceiver.java
-
-# install
-target.path = $$[QT_INSTALL_PREFIX]/jar
-INSTALLS += target
diff --git a/src/plugins/bearer/android/jar/jar.pro b/src/plugins/bearer/android/jar/jar.pro
index 923e757d9b..f988019dac 100644
--- a/src/plugins/bearer/android/jar/jar.pro
+++ b/src/plugins/bearer/android/jar/jar.pro
@@ -1,2 +1,13 @@
-TEMPLATE=subdirs
-SUBDIRS += distributedjar.pro bundledjar.pro
+TARGET = QtAndroidBearer
+
+load(qt_build_paths)
+CONFIG += java
+DESTDIR = $$MODULE_BASE_OUTDIR/jar
+
+JAVACLASSPATH += $$PWD/src
+
+JAVASOURCES += $$PWD/src/org/qtproject/qt5/android/bearer/QtNetworkReceiver.java
+
+# install
+target.path = $$[QT_INSTALL_PREFIX]/jar
+INSTALLS += target
diff --git a/src/plugins/bearer/android/src/main.cpp b/src/plugins/bearer/android/src/main.cpp
index 3892766b89..f3a5074e5d 100644
--- a/src/plugins/bearer/android/src/main.cpp
+++ b/src/plugins/bearer/android/src/main.cpp
@@ -50,7 +50,7 @@ class QAndroidBearerEnginePlugin : public QBearerEnginePlugin
Q_PLUGIN_METADATA(IID "org.qt-project.Qt.QBearerEngineFactoryInterface" FILE "android.json")
public:
- QBearerEngine *create(const QString &key) const Q_DECL_OVERRIDE
+ QBearerEngine *create(const QString &key) const override
{
return (key == QLatin1String("android")) ? new QAndroidBearerEngine() : 0;
}
diff --git a/src/plugins/bearer/android/src/qandroidbearerengine.h b/src/plugins/bearer/android/src/qandroidbearerengine.h
index f404ca65eb..837b02232d 100644
--- a/src/plugins/bearer/android/src/qandroidbearerengine.h
+++ b/src/plugins/bearer/android/src/qandroidbearerengine.h
@@ -60,20 +60,20 @@ class QAndroidBearerEngine : public QBearerEngineImpl
public:
explicit QAndroidBearerEngine(QObject *parent = 0);
- ~QAndroidBearerEngine() Q_DECL_OVERRIDE;
-
- QString getInterfaceFromId(const QString &id) Q_DECL_OVERRIDE;
- bool hasIdentifier(const QString &id) Q_DECL_OVERRIDE;
- void connectToId(const QString &id) Q_DECL_OVERRIDE;
- void disconnectFromId(const QString &id) Q_DECL_OVERRIDE;
- QNetworkSession::State sessionStateForId(const QString &id) Q_DECL_OVERRIDE;
- QNetworkConfigurationManager::Capabilities capabilities() const Q_DECL_OVERRIDE;
- QNetworkSessionPrivate *createSessionBackend() Q_DECL_OVERRIDE;
- QNetworkConfigurationPrivatePointer defaultConfiguration() Q_DECL_OVERRIDE;
- bool requiresPolling() const Q_DECL_OVERRIDE;
- quint64 bytesWritten(const QString &id) Q_DECL_OVERRIDE;
- quint64 bytesReceived(const QString &id) Q_DECL_OVERRIDE;
- quint64 startTime(const QString &id) Q_DECL_OVERRIDE;
+ ~QAndroidBearerEngine() override;
+
+ QString getInterfaceFromId(const QString &id) override;
+ bool hasIdentifier(const QString &id) override;
+ void connectToId(const QString &id) override;
+ void disconnectFromId(const QString &id) override;
+ QNetworkSession::State sessionStateForId(const QString &id) override;
+ QNetworkConfigurationManager::Capabilities capabilities() const override;
+ QNetworkSessionPrivate *createSessionBackend() override;
+ QNetworkConfigurationPrivatePointer defaultConfiguration() override;
+ bool requiresPolling() const override;
+ quint64 bytesWritten(const QString &id) override;
+ quint64 bytesReceived(const QString &id) override;
+ quint64 startTime(const QString &id) override;
Q_INVOKABLE void initialize();
Q_INVOKABLE void requestUpdate();
diff --git a/src/plugins/bearer/generic/main.cpp b/src/plugins/bearer/generic/main.cpp
index 80e7b7d9aa..82a9ce97f4 100644
--- a/src/plugins/bearer/generic/main.cpp
+++ b/src/plugins/bearer/generic/main.cpp
@@ -54,7 +54,7 @@ public:
QGenericEnginePlugin();
~QGenericEnginePlugin();
- QBearerEngine *create(const QString &key) const Q_DECL_OVERRIDE;
+ QBearerEngine *create(const QString &key) const override;
};
QGenericEnginePlugin::QGenericEnginePlugin()
diff --git a/src/plugins/bearer/generic/qgenericengine.h b/src/plugins/bearer/generic/qgenericengine.h
index e680eb9cc0..08960d66f6 100644
--- a/src/plugins/bearer/generic/qgenericengine.h
+++ b/src/plugins/bearer/generic/qgenericengine.h
@@ -58,24 +58,24 @@ public:
QGenericEngine(QObject *parent = 0);
~QGenericEngine();
- QString getInterfaceFromId(const QString &id) Q_DECL_OVERRIDE;
- bool hasIdentifier(const QString &id) Q_DECL_OVERRIDE;
+ QString getInterfaceFromId(const QString &id) override;
+ bool hasIdentifier(const QString &id) override;
- void connectToId(const QString &id) Q_DECL_OVERRIDE;
- void disconnectFromId(const QString &id) Q_DECL_OVERRIDE;
+ void connectToId(const QString &id) override;
+ void disconnectFromId(const QString &id) override;
Q_INVOKABLE void initialize();
Q_INVOKABLE void requestUpdate();
- QNetworkSession::State sessionStateForId(const QString &id) Q_DECL_OVERRIDE;
+ QNetworkSession::State sessionStateForId(const QString &id) override;
- QNetworkConfigurationManager::Capabilities capabilities() const Q_DECL_OVERRIDE;
+ QNetworkConfigurationManager::Capabilities capabilities() const override;
- QNetworkSessionPrivate *createSessionBackend() Q_DECL_OVERRIDE;
+ QNetworkSessionPrivate *createSessionBackend() override;
- QNetworkConfigurationPrivatePointer defaultConfiguration() Q_DECL_OVERRIDE;
+ QNetworkConfigurationPrivatePointer defaultConfiguration() override;
- bool requiresPolling() const Q_DECL_OVERRIDE;
+ bool requiresPolling() const override;
private Q_SLOTS:
void doRequestUpdate();
diff --git a/src/plugins/bearer/qnetworksession_impl.h b/src/plugins/bearer/qnetworksession_impl.h
index e9c0e383fc..d9aa6ca8fb 100644
--- a/src/plugins/bearer/qnetworksession_impl.h
+++ b/src/plugins/bearer/qnetworksession_impl.h
@@ -75,31 +75,31 @@ public:
//that the state is immediately updated (w/o actually opening
//a session). Also this function should take care of
//notification hooks to discover future state changes.
- void syncStateWithInterface() Q_DECL_OVERRIDE;
+ void syncStateWithInterface() override;
#ifndef QT_NO_NETWORKINTERFACE
- QNetworkInterface currentInterface() const Q_DECL_OVERRIDE;
+ QNetworkInterface currentInterface() const override;
#endif
- QVariant sessionProperty(const QString& key) const Q_DECL_OVERRIDE;
- void setSessionProperty(const QString& key, const QVariant& value) Q_DECL_OVERRIDE;
-
- void open() Q_DECL_OVERRIDE;
- void close() Q_DECL_OVERRIDE;
- void stop() Q_DECL_OVERRIDE;
- void migrate() Q_DECL_OVERRIDE;
- void accept() Q_DECL_OVERRIDE;
- void ignore() Q_DECL_OVERRIDE;
- void reject() Q_DECL_OVERRIDE;
-
- QString errorString() const Q_DECL_OVERRIDE; //must return translated string
- QNetworkSession::SessionError error() const Q_DECL_OVERRIDE;
-
- quint64 bytesWritten() const Q_DECL_OVERRIDE;
- quint64 bytesReceived() const Q_DECL_OVERRIDE;
- quint64 activeTime() const Q_DECL_OVERRIDE;
-
- QNetworkSession::UsagePolicies usagePolicies() const Q_DECL_OVERRIDE;
- void setUsagePolicies(QNetworkSession::UsagePolicies) Q_DECL_OVERRIDE;
+ QVariant sessionProperty(const QString& key) const override;
+ void setSessionProperty(const QString& key, const QVariant& value) override;
+
+ void open() override;
+ void close() override;
+ void stop() override;
+ void migrate() override;
+ void accept() override;
+ void ignore() override;
+ void reject() override;
+
+ QString errorString() const override; //must return translated string
+ QNetworkSession::SessionError error() const override;
+
+ quint64 bytesWritten() const override;
+ quint64 bytesReceived() const override;
+ quint64 activeTime() const override;
+
+ QNetworkSession::UsagePolicies usagePolicies() const override;
+ void setUsagePolicies(QNetworkSession::UsagePolicies) override;
private Q_SLOTS:
void networkConfigurationsChanged();
diff --git a/src/plugins/generic/evdevkeyboard/main.cpp b/src/plugins/generic/evdevkeyboard/main.cpp
index ef08cd56ab..5c170e1a06 100644
--- a/src/plugins/generic/evdevkeyboard/main.cpp
+++ b/src/plugins/generic/evdevkeyboard/main.cpp
@@ -50,7 +50,7 @@ class QEvdevKeyboardPlugin : public QGenericPlugin
public:
QEvdevKeyboardPlugin();
- QObject* create(const QString &key, const QString &specification) Q_DECL_OVERRIDE;
+ QObject* create(const QString &key, const QString &specification) override;
};
QEvdevKeyboardPlugin::QEvdevKeyboardPlugin()
diff --git a/src/plugins/generic/evdevmouse/main.cpp b/src/plugins/generic/evdevmouse/main.cpp
index 86ec7cb575..1b8517f4c4 100644
--- a/src/plugins/generic/evdevmouse/main.cpp
+++ b/src/plugins/generic/evdevmouse/main.cpp
@@ -50,7 +50,7 @@ class QEvdevMousePlugin : public QGenericPlugin
public:
QEvdevMousePlugin();
- QObject* create(const QString &key, const QString &specification) Q_DECL_OVERRIDE;
+ QObject* create(const QString &key, const QString &specification) override;
};
QEvdevMousePlugin::QEvdevMousePlugin()
diff --git a/src/plugins/generic/evdevtablet/main.cpp b/src/plugins/generic/evdevtablet/main.cpp
index 0646d71146..f43a32910d 100644
--- a/src/plugins/generic/evdevtablet/main.cpp
+++ b/src/plugins/generic/evdevtablet/main.cpp
@@ -50,7 +50,7 @@ class QEvdevTabletPlugin : public QGenericPlugin
public:
QEvdevTabletPlugin();
- QObject* create(const QString &key, const QString &specification) Q_DECL_OVERRIDE;
+ QObject* create(const QString &key, const QString &specification) override;
};
QEvdevTabletPlugin::QEvdevTabletPlugin()
diff --git a/src/plugins/generic/evdevtouch/main.cpp b/src/plugins/generic/evdevtouch/main.cpp
index aa60614936..f1a0ad53ab 100644
--- a/src/plugins/generic/evdevtouch/main.cpp
+++ b/src/plugins/generic/evdevtouch/main.cpp
@@ -50,7 +50,7 @@ class QEvdevTouchScreenPlugin : public QGenericPlugin
public:
QEvdevTouchScreenPlugin();
- QObject* create(const QString &key, const QString &specification) Q_DECL_OVERRIDE;
+ QObject* create(const QString &key, const QString &specification) override;
};
QEvdevTouchScreenPlugin::QEvdevTouchScreenPlugin()
diff --git a/src/plugins/generic/generic.pro b/src/plugins/generic/generic.pro
index e323f32d2c..980aa1a506 100644
--- a/src/plugins/generic/generic.pro
+++ b/src/plugins/generic/generic.pro
@@ -1,5 +1,5 @@
TEMPLATE = subdirs
-QT_FOR_CONFIG += gui-private network-private
+QT_FOR_CONFIG += gui-private
qtConfig(evdev) {
SUBDIRS += evdevmouse evdevtouch evdevkeyboard
@@ -11,7 +11,7 @@ qtConfig(tslib) {
SUBDIRS += tslib
}
-qtConfig(udpsocket) {
+qtConfig(tuiotouch) {
SUBDIRS += tuiotouch
}
diff --git a/src/plugins/imageformats/jpeg/qjpeghandler.cpp b/src/plugins/imageformats/jpeg/qjpeghandler.cpp
index 68619928d3..1cdc28c077 100644
--- a/src/plugins/imageformats/jpeg/qjpeghandler.cpp
+++ b/src/plugins/imageformats/jpeg/qjpeghandler.cpp
@@ -65,9 +65,6 @@ extern "C" {
#endif
#define XMD_H // shut JPEGlib up
-#if defined(Q_OS_UNIXWARE)
-# define HAVE_BOOLEAN // libjpeg under Unixware seems to need this
-#endif
#include <jpeglib.h>
#ifdef const
# undef const // remove crazy C hackery in jconfig.h
diff --git a/src/plugins/platforminputcontexts/compose/qcomposeplatforminputcontext.h b/src/plugins/platforminputcontexts/compose/qcomposeplatforminputcontext.h
index f82280903d..4830959665 100644
--- a/src/plugins/platforminputcontexts/compose/qcomposeplatforminputcontext.h
+++ b/src/plugins/platforminputcontexts/compose/qcomposeplatforminputcontext.h
@@ -58,11 +58,11 @@ public:
QComposeInputContext();
~QComposeInputContext();
- bool isValid() const Q_DECL_OVERRIDE;
- void setFocusObject(QObject *object) Q_DECL_OVERRIDE;
- void reset() Q_DECL_OVERRIDE;
- void update(Qt::InputMethodQueries) Q_DECL_OVERRIDE;
- bool filterEvent(const QEvent *event) Q_DECL_OVERRIDE;
+ bool isValid() const override;
+ void setFocusObject(QObject *object) override;
+ void reset() override;
+ void update(Qt::InputMethodQueries) override;
+ bool filterEvent(const QEvent *event) override;
protected:
void clearComposeBuffer();
diff --git a/src/plugins/platforminputcontexts/compose/qcomposeplatforminputcontextmain.cpp b/src/plugins/platforminputcontexts/compose/qcomposeplatforminputcontextmain.cpp
index 97a7242ca6..6b33df65b9 100644
--- a/src/plugins/platforminputcontexts/compose/qcomposeplatforminputcontextmain.cpp
+++ b/src/plugins/platforminputcontexts/compose/qcomposeplatforminputcontextmain.cpp
@@ -51,7 +51,7 @@ class QComposePlatformInputContextPlugin : public QPlatformInputContextPlugin
Q_PLUGIN_METADATA(IID QPlatformInputContextFactoryInterface_iid FILE "compose.json")
public:
- QComposeInputContext *create(const QString &, const QStringList &) Q_DECL_OVERRIDE;
+ QComposeInputContext *create(const QString &, const QStringList &) override;
};
QComposeInputContext *QComposePlatformInputContextPlugin::create(const QString &system, const QStringList &paramList)
diff --git a/src/plugins/platforminputcontexts/ibus/main.cpp b/src/plugins/platforminputcontexts/ibus/main.cpp
index 2846f52c8c..0a7da3b14c 100644
--- a/src/plugins/platforminputcontexts/ibus/main.cpp
+++ b/src/plugins/platforminputcontexts/ibus/main.cpp
@@ -51,7 +51,7 @@ class QIbusPlatformInputContextPlugin : public QPlatformInputContextPlugin
Q_PLUGIN_METADATA(IID QPlatformInputContextFactoryInterface_iid FILE "ibus.json")
public:
- QIBusPlatformInputContext *create(const QString&, const QStringList&) Q_DECL_OVERRIDE;
+ QIBusPlatformInputContext *create(const QString&, const QStringList&) override;
};
QIBusPlatformInputContext *QIbusPlatformInputContextPlugin::create(const QString& system, const QStringList& paramList)
diff --git a/src/plugins/platforminputcontexts/ibus/qibusplatforminputcontext.cpp b/src/plugins/platforminputcontexts/ibus/qibusplatforminputcontext.cpp
index 9675d828e7..76f42d764d 100644
--- a/src/plugins/platforminputcontexts/ibus/qibusplatforminputcontext.cpp
+++ b/src/plugins/platforminputcontexts/ibus/qibusplatforminputcontext.cpp
@@ -60,6 +60,10 @@
#ifndef IBUS_RELEASE_MASK
#define IBUS_RELEASE_MASK (1 << 30)
+#define IBUS_SHIFT_MASK (1 << 0)
+#define IBUS_CONTROL_MASK (1 << 2)
+#define IBUS_MOD1_MASK (1 << 3)
+#define IBUS_META_MASK (1 << 28)
#endif
QT_BEGIN_NAMESPACE
@@ -90,6 +94,7 @@ public:
bool valid;
bool busConnected;
QString predit;
+ QList<QInputMethodEvent::Attribute> attributes;
bool needsSurroundingText;
QLocale locale;
};
@@ -165,6 +170,7 @@ void QIBusPlatformInputContext::reset()
d->context->Reset();
d->predit = QString();
+ d->attributes.clear();
}
void QIBusPlatformInputContext::commit()
@@ -177,6 +183,7 @@ void QIBusPlatformInputContext::commit()
QObject *input = qApp->focusObject();
if (!input) {
d->predit = QString();
+ d->attributes.clear();
return;
}
@@ -188,6 +195,7 @@ void QIBusPlatformInputContext::commit()
d->context->Reset();
d->predit = QString();
+ d->attributes.clear();
}
@@ -274,6 +282,7 @@ void QIBusPlatformInputContext::commitText(const QDBusVariant &text)
QCoreApplication::sendEvent(input, &event);
d->predit = QString();
+ d->attributes.clear();
}
void QIBusPlatformInputContext::updatePreeditText(const QDBusVariant &text, uint cursorPos, bool visible)
@@ -292,16 +301,48 @@ void QIBusPlatformInputContext::updatePreeditText(const QDBusVariant &text, uint
if (debug)
qDebug() << "preedit text:" << t.text;
- QList<QInputMethodEvent::Attribute> attributes = t.attributes.imAttributes();
+ d->attributes = t.attributes.imAttributes();
if (!t.text.isEmpty())
- attributes += QInputMethodEvent::Attribute(QInputMethodEvent::Cursor, cursorPos, visible ? 1 : 0);
+ d->attributes += QInputMethodEvent::Attribute(QInputMethodEvent::Cursor, cursorPos, visible ? 1 : 0, QVariant());
- QInputMethodEvent event(t.text, attributes);
+ QInputMethodEvent event(t.text, d->attributes);
QCoreApplication::sendEvent(input, &event);
d->predit = t.text;
}
+void QIBusPlatformInputContext::forwardKeyEvent(uint keyval, uint keycode, uint state)
+{
+ if (!qApp)
+ return;
+
+ QObject *input = qApp->focusObject();
+ if (!input)
+ return;
+
+ if (debug)
+ qDebug() << "forwardKeyEvent" << keyval << keycode << state;
+
+ QEvent::Type type = QEvent::KeyPress;
+ if (state & IBUS_RELEASE_MASK)
+ type = QEvent::KeyRelease;
+
+ state &= ~IBUS_RELEASE_MASK;
+
+ Qt::KeyboardModifiers modifiers = Qt::NoModifier;
+ if (state & IBUS_SHIFT_MASK)
+ modifiers |= Qt::ShiftModifier;
+ if (state & IBUS_CONTROL_MASK)
+ modifiers |= Qt::ControlModifier;
+ if (state & IBUS_MOD1_MASK)
+ modifiers |= Qt::AltModifier;
+ if (state & IBUS_META_MASK)
+ modifiers |= Qt::MetaModifier;
+
+ QKeyEvent event(type, keyval, modifiers, QString(keyval));
+ QCoreApplication::sendEvent(input, &event);
+}
+
void QIBusPlatformInputContext::surroundingTextRequired()
{
if (debug)
@@ -324,6 +365,27 @@ void QIBusPlatformInputContext::deleteSurroundingText(int offset, uint n_chars)
QCoreApplication::sendEvent(input, &event);
}
+void QIBusPlatformInputContext::hidePreeditText()
+{
+ QObject *input = QGuiApplication::focusObject();
+ if (!input)
+ return;
+
+ QList<QInputMethodEvent::Attribute> attributes;
+ QInputMethodEvent event(QString(), attributes);
+ QCoreApplication::sendEvent(input, &event);
+}
+
+void QIBusPlatformInputContext::showPreeditText()
+{
+ QObject *input = QGuiApplication::focusObject();
+ if (!input)
+ return;
+
+ QInputMethodEvent event(d->predit, d->attributes);
+ QCoreApplication::sendEvent(input, &event);
+}
+
bool QIBusPlatformInputContext::filterEvent(const QEvent *event)
{
if (!d->busConnected)
@@ -496,8 +558,11 @@ void QIBusPlatformInputContext::connectToContextSignals()
if (d->context) {
connect(d->context, SIGNAL(CommitText(QDBusVariant)), SLOT(commitText(QDBusVariant)));
connect(d->context, SIGNAL(UpdatePreeditText(QDBusVariant,uint,bool)), this, SLOT(updatePreeditText(QDBusVariant,uint,bool)));
+ connect(d->context, SIGNAL(ForwardKeyEvent(uint, uint, uint)), this, SLOT(forwardKeyEvent(uint, uint, uint)));
connect(d->context, SIGNAL(DeleteSurroundingText(int,uint)), this, SLOT(deleteSurroundingText(int,uint)));
connect(d->context, SIGNAL(RequireSurroundingText()), this, SLOT(surroundingTextRequired()));
+ connect(d->context, SIGNAL(HidePreeditText()), this, SLOT(hidePreeditText()));
+ connect(d->context, SIGNAL(ShowPreeditText()), this, SLOT(showPreeditText()));
}
}
diff --git a/src/plugins/platforminputcontexts/ibus/qibusplatforminputcontext.h b/src/plugins/platforminputcontexts/ibus/qibusplatforminputcontext.h
index 7baa9ad1da..9b92b2e1f9 100644
--- a/src/plugins/platforminputcontexts/ibus/qibusplatforminputcontext.h
+++ b/src/plugins/platforminputcontexts/ibus/qibusplatforminputcontext.h
@@ -86,23 +86,26 @@ public:
QIBusPlatformInputContext();
~QIBusPlatformInputContext();
- bool isValid() const Q_DECL_OVERRIDE;
- void setFocusObject(QObject *object) Q_DECL_OVERRIDE;
+ bool isValid() const override;
+ void setFocusObject(QObject *object) override;
- void invokeAction(QInputMethod::Action a, int x) Q_DECL_OVERRIDE;
- void reset() Q_DECL_OVERRIDE;
- void commit() Q_DECL_OVERRIDE;
- void update(Qt::InputMethodQueries) Q_DECL_OVERRIDE;
- bool filterEvent(const QEvent *event) Q_DECL_OVERRIDE;
- QLocale locale() const Q_DECL_OVERRIDE;
- bool hasCapability(Capability capability) const Q_DECL_OVERRIDE;
+ void invokeAction(QInputMethod::Action a, int x) override;
+ void reset() override;
+ void commit() override;
+ void update(Qt::InputMethodQueries) override;
+ bool filterEvent(const QEvent *event) override;
+ QLocale locale() const override;
+ bool hasCapability(Capability capability) const override;
public Q_SLOTS:
void commitText(const QDBusVariant &text);
void updatePreeditText(const QDBusVariant &text, uint cursor_pos, bool visible);
+ void forwardKeyEvent(uint keyval, uint keycode, uint state);
void cursorRectChanged();
void deleteSurroundingText(int offset, uint n_chars);
void surroundingTextRequired();
+ void hidePreeditText();
+ void showPreeditText();
void filterEventFinished(QDBusPendingCallWatcher *call);
void socketChanged(const QString &str);
void connectToBus();
diff --git a/src/plugins/platforms/android/qandroidplatformscreen.cpp b/src/plugins/platforms/android/qandroidplatformscreen.cpp
index 3a79e32abe..7dc8bb8080 100644
--- a/src/plugins/platforms/android/qandroidplatformscreen.cpp
+++ b/src/plugins/platforms/android/qandroidplatformscreen.cpp
@@ -59,6 +59,8 @@
#include <QtGui/QWindow>
#include <QtGui/private/qwindow_p.h>
+#include <vector>
+
QT_BEGIN_NAMESPACE
#ifdef QANDROIDPLATFORMSCREEN_DEBUG
@@ -376,8 +378,7 @@ void QAndroidPlatformScreen::doRedraw()
|| !window->isRaster())
continue;
- const QVector<QRect> visibleRects = visibleRegion.rects();
- for (const QRect &rect : visibleRects) {
+ for (const QRect &rect : std::vector<QRect>(visibleRegion.begin(), visibleRegion.end())) {
QRect targetRect = window->geometry();
targetRect &= rect;
diff --git a/src/plugins/platforms/bsdfb/qbsdfbscreen.cpp b/src/plugins/platforms/bsdfb/qbsdfbscreen.cpp
index 067a26a7b1..d752b539a0 100644
--- a/src/plugins/platforms/bsdfb/qbsdfbscreen.cpp
+++ b/src/plugins/platforms/bsdfb/qbsdfbscreen.cpp
@@ -247,8 +247,7 @@ QRegion QBsdFbScreen::doRedraw()
if (!m_blitter)
m_blitter.reset(new QPainter(&m_onscreenImage));
- const auto rects = touched.rects();
- for (const QRect &rect : rects)
+ for (const QRect &rect : touched)
m_blitter->drawImage(rect, mScreenImage, rect);
return touched;
}
diff --git a/src/plugins/platforms/cocoa/cocoa.pro b/src/plugins/platforms/cocoa/cocoa.pro
index 5354bdafbc..2694cb3607 100644
--- a/src/plugins/platforms/cocoa/cocoa.pro
+++ b/src/plugins/platforms/cocoa/cocoa.pro
@@ -14,6 +14,7 @@ SOURCES += main.mm \
qcocoaeventdispatcher.mm \
qcocoaapplicationdelegate.mm \
qcocoaapplication.mm \
+ qcocoansmenu.mm \
qcocoamenu.mm \
qcocoamenuitem.mm \
qcocoamenubar.mm \
@@ -47,6 +48,7 @@ HEADERS += qcocoaintegration.h \
qcocoaeventdispatcher.h \
qcocoaapplicationdelegate.h \
qcocoaapplication.h \
+ qcocoansmenu.h \
qcocoamenu.h \
qcocoamenuitem.h \
qcocoamenubar.h \
diff --git a/src/plugins/platforms/cocoa/qcocoaaccessibility.h b/src/plugins/platforms/cocoa/qcocoaaccessibility.h
index e7957276c2..e456364555 100644
--- a/src/plugins/platforms/cocoa/qcocoaaccessibility.h
+++ b/src/plugins/platforms/cocoa/qcocoaaccessibility.h
@@ -53,10 +53,10 @@ class QCocoaAccessibility : public QPlatformAccessibility
public:
QCocoaAccessibility();
~QCocoaAccessibility();
- void notifyAccessibilityUpdate(QAccessibleEvent *event) Q_DECL_OVERRIDE;
- void setRootObject(QObject *o) Q_DECL_OVERRIDE;
- void initialize() Q_DECL_OVERRIDE;
- void cleanup() Q_DECL_OVERRIDE;
+ void notifyAccessibilityUpdate(QAccessibleEvent *event) override;
+ void setRootObject(QObject *o) override;
+ void initialize() override;
+ void cleanup() override;
};
namespace QCocoaAccessible {
diff --git a/src/plugins/platforms/cocoa/qcocoaaccessibilityelement.mm b/src/plugins/platforms/cocoa/qcocoaaccessibilityelement.mm
index 7e6bae127c..df2336d08b 100644
--- a/src/plugins/platforms/cocoa/qcocoaaccessibilityelement.mm
+++ b/src/plugins/platforms/cocoa/qcocoaaccessibilityelement.mm
@@ -40,6 +40,7 @@
#include "qcocoaaccessibility.h"
#include "qcocoahelpers.h"
#include "qcocoawindow.h"
+#include "qcocoascreen.h"
#include "private/qaccessiblecache_p.h"
#include <QtAccessibilitySupport/private/qaccessiblebridgeutils_p.h>
#include <QtGui/qaccessible.h>
@@ -298,9 +299,9 @@ static void convertLineOffset(QAccessibleTextInterface *text, int *line, int *of
// We're in the same top level element as our parent.
return [[self parentElement] accessibilityAttributeValue:NSAccessibilityTopLevelUIElementAttribute];
} else if ([attribute isEqualToString:NSAccessibilityPositionAttribute]) {
- QPoint qtPosition = iface->rect().topLeft();
- QSize qtSize = iface->rect().size();
- return [NSValue valueWithPoint: NSMakePoint(qtPosition.x(), qt_mac_flipYCoordinate(qtPosition.y() + qtSize.height()))];
+ // The position in points of the element's lower-left corner in screen-relative coordinates
+ QPointF qtPosition = QRectF(iface->rect()).bottomLeft();
+ return [NSValue valueWithPoint:QCocoaScreen::mapToNative(qtPosition)];
} else if ([attribute isEqualToString:NSAccessibilitySizeAttribute]) {
QSize qtSize = iface->rect().size();
return [NSValue valueWithSize: NSMakeSize(qtSize.width(), qtSize.height())];
@@ -430,7 +431,7 @@ static void convertLineOffset(QAccessibleTextInterface *text, int *line, int *of
if ([attribute isEqualToString: NSAccessibilityBoundsForRangeParameterizedAttribute]) {
NSRange range = [parameter rangeValue];
QRect firstRect = iface->textInterface()->characterRect(range.location);
- QRect rect;
+ QRectF rect;
if (range.length > 0) {
NSUInteger position = range.location + range.length - 1;
if (position > range.location && iface->textInterface()->text(position, position + 1) == QStringLiteral("\n"))
@@ -441,15 +442,14 @@ static void convertLineOffset(QAccessibleTextInterface *text, int *line, int *of
rect = firstRect;
rect.setWidth(1);
}
- return [NSValue valueWithRect: NSMakeRect((CGFloat) rect.x(),(CGFloat) qt_mac_flipYCoordinate(rect.y() + rect.height()), rect.width(), rect.height())];
+ return [NSValue valueWithRect:QCocoaScreen::mapToNative(rect)];
}
if ([attribute isEqualToString: NSAccessibilityAttributedStringForRangeParameterizedAttribute]) {
NSRange range = [parameter rangeValue];
QString text = iface->textInterface()->text(range.location, range.location + range.length);
return [[NSAttributedString alloc] initWithString:text.toNSString()];
} else if ([attribute isEqualToString: NSAccessibilityRangeForPositionParameterizedAttribute]) {
- NSPoint nsPoint = [parameter pointValue];
- QPoint point(static_cast<int>(nsPoint.x), static_cast<int>(qt_mac_flipYCoordinate(nsPoint.y)));
+ QPoint point = QCocoaScreen::mapFromNative([parameter pointValue]).toPoint();
int offset = iface->textInterface()->offsetAtPoint(point);
return [NSValue valueWithRange:NSMakeRange(static_cast<NSUInteger>(offset), 1)];
} else if ([attribute isEqualToString: NSAccessibilityStyleRangeForIndexParameterizedAttribute]) {
@@ -566,8 +566,8 @@ static void convertLineOffset(QAccessibleTextInterface *text, int *line, int *of
return NSAccessibilityUnignoredAncestor(self);
}
- int y = qt_mac_flipYCoordinate(point.y);
- QAccessibleInterface *childInterface = iface->childAt(point.x, y);
+ QPointF screenPoint = QCocoaScreen::mapFromNative(point);
+ QAccessibleInterface *childInterface = iface->childAt(screenPoint.x(), screenPoint.y());
// No child found, meaning we hit this element.
if (!childInterface || !childInterface->isValid())
return NSAccessibilityUnignoredAncestor(self);
@@ -575,7 +575,7 @@ static void convertLineOffset(QAccessibleTextInterface *text, int *line, int *of
// find the deepest child at the point
QAccessibleInterface *childOfChildInterface = 0;
do {
- childOfChildInterface = childInterface->childAt(point.x, y);
+ childOfChildInterface = childInterface->childAt(screenPoint.x(), screenPoint.y());
if (childOfChildInterface && childOfChildInterface->isValid())
childInterface = childOfChildInterface;
} while (childOfChildInterface && childOfChildInterface->isValid());
diff --git a/src/plugins/platforms/cocoa/qcocoaapplicationdelegate.mm b/src/plugins/platforms/cocoa/qcocoaapplicationdelegate.mm
index 5392804d62..32be9ad4ee 100644
--- a/src/plugins/platforms/cocoa/qcocoaapplicationdelegate.mm
+++ b/src/plugins/platforms/cocoa/qcocoaapplicationdelegate.mm
@@ -86,16 +86,21 @@
QT_USE_NAMESPACE
-QT_BEGIN_NAMESPACE
-static QCocoaApplicationDelegate *sharedCocoaApplicationDelegate = nil;
+@implementation QCocoaApplicationDelegate
-static void cleanupCocoaApplicationDelegate()
++ (instancetype)sharedDelegate
{
- [sharedCocoaApplicationDelegate release];
+ static QCocoaApplicationDelegate *shared = nil;
+ static dispatch_once_t onceToken;
+ dispatch_once(&onceToken, ^{
+ shared = [[self alloc] init];
+ atexit_b(^{
+ [shared release];
+ shared = nil;
+ });
+ });
+ return shared;
}
-QT_END_NAMESPACE
-
-@implementation QCocoaApplicationDelegate
- (id)init
{
@@ -120,7 +125,6 @@ QT_END_NAMESPACE
- (void)dealloc
{
- sharedCocoaApplicationDelegate = nil;
[dockMenu release];
if (reflectionDelegate) {
[[NSApplication sharedApplication] setDelegate:reflectionDelegate];
@@ -131,27 +135,6 @@ QT_END_NAMESPACE
[super dealloc];
}
-+ (id)allocWithZone:(NSZone *)zone
-{
- @synchronized(self) {
- if (sharedCocoaApplicationDelegate == nil) {
- sharedCocoaApplicationDelegate = [super allocWithZone:zone];
- qAddPostRoutine(cleanupCocoaApplicationDelegate);
- return sharedCocoaApplicationDelegate;
- }
- }
- return nil;
-}
-
-+ (QCocoaApplicationDelegate *)sharedDelegate
-{
- @synchronized(self) {
- if (sharedCocoaApplicationDelegate == nil)
- [[self alloc] init];
- }
- return [[sharedCocoaApplicationDelegate retain] autorelease];
-}
-
- (void)setDockMenu:(NSMenu*)newMenu
{
[newMenu retain];
diff --git a/src/plugins/platforms/cocoa/qcocoabackingstore.h b/src/plugins/platforms/cocoa/qcocoabackingstore.h
index a0bc204013..b4cd506513 100644
--- a/src/plugins/platforms/cocoa/qcocoabackingstore.h
+++ b/src/plugins/platforms/cocoa/qcocoabackingstore.h
@@ -52,11 +52,11 @@ public:
QCocoaBackingStore(QWindow *window);
~QCocoaBackingStore();
- void flush(QWindow *, const QRegion &, const QPoint &) Q_DECL_OVERRIDE;
+ void flush(QWindow *, const QRegion &, const QPoint &) override;
private:
bool windowHasUnifiedToolbar() const;
- QImage::Format format() const Q_DECL_OVERRIDE;
+ QImage::Format format() const override;
void redrawRoundedBottomCorners(CGRect) const;
};
diff --git a/src/plugins/platforms/cocoa/qcocoaclipboard.h b/src/plugins/platforms/cocoa/qcocoaclipboard.h
index cab2cfaa91..a78d8f4187 100644
--- a/src/plugins/platforms/cocoa/qcocoaclipboard.h
+++ b/src/plugins/platforms/cocoa/qcocoaclipboard.h
@@ -56,10 +56,10 @@ class QCocoaClipboard : public QObject, public QPlatformClipboard
public:
QCocoaClipboard();
- QMimeData *mimeData(QClipboard::Mode mode = QClipboard::Clipboard) Q_DECL_OVERRIDE;
- void setMimeData(QMimeData *data, QClipboard::Mode mode = QClipboard::Clipboard) Q_DECL_OVERRIDE;
- bool supportsMode(QClipboard::Mode mode) const Q_DECL_OVERRIDE;
- bool ownsMode(QClipboard::Mode mode) const Q_DECL_OVERRIDE;
+ QMimeData *mimeData(QClipboard::Mode mode = QClipboard::Clipboard) override;
+ void setMimeData(QMimeData *data, QClipboard::Mode mode = QClipboard::Clipboard) override;
+ bool supportsMode(QClipboard::Mode mode) const override;
+ bool ownsMode(QClipboard::Mode mode) const override;
private Q_SLOTS:
void handleApplicationStateChanged(Qt::ApplicationState state);
diff --git a/src/plugins/platforms/cocoa/qcocoacolordialoghelper.h b/src/plugins/platforms/cocoa/qcocoacolordialoghelper.h
index 133efd6db8..01ac7e181d 100644
--- a/src/plugins/platforms/cocoa/qcocoacolordialoghelper.h
+++ b/src/plugins/platforms/cocoa/qcocoacolordialoghelper.h
@@ -55,12 +55,12 @@ public:
QCocoaColorDialogHelper();
~QCocoaColorDialogHelper();
- void exec() Q_DECL_OVERRIDE;
- bool show(Qt::WindowFlags windowFlags, Qt::WindowModality windowModality, QWindow *parent) Q_DECL_OVERRIDE;
- void hide() Q_DECL_OVERRIDE;
+ void exec() override;
+ bool show(Qt::WindowFlags windowFlags, Qt::WindowModality windowModality, QWindow *parent) override;
+ void hide() override;
- void setCurrentColor(const QColor&) Q_DECL_OVERRIDE;
- QColor currentColor() const Q_DECL_OVERRIDE;
+ void setCurrentColor(const QColor&) override;
+ QColor currentColor() const override;
};
QT_END_NAMESPACE
diff --git a/src/plugins/platforms/cocoa/qcocoacursor.h b/src/plugins/platforms/cocoa/qcocoacursor.h
index d1586660a4..58b9ef2151 100644
--- a/src/plugins/platforms/cocoa/qcocoacursor.h
+++ b/src/plugins/platforms/cocoa/qcocoacursor.h
@@ -53,9 +53,9 @@ public:
QCocoaCursor();
~QCocoaCursor();
- void changeCursor(QCursor *cursor, QWindow *window) Q_DECL_OVERRIDE;
- QPoint pos() const Q_DECL_OVERRIDE;
- void setPos(const QPoint &position) Q_DECL_OVERRIDE;
+ void changeCursor(QCursor *cursor, QWindow *window) override;
+ QPoint pos() const override;
+ void setPos(const QPoint &position) override;
private:
QHash<Qt::CursorShape, NSCursor *> m_cursors;
NSCursor *convertCursor(QCursor *cursor);
diff --git a/src/plugins/platforms/cocoa/qcocoacursor.mm b/src/plugins/platforms/cocoa/qcocoacursor.mm
index 99a136d384..c021128e4c 100644
--- a/src/plugins/platforms/cocoa/qcocoacursor.mm
+++ b/src/plugins/platforms/cocoa/qcocoacursor.mm
@@ -39,6 +39,7 @@
#include "qcocoacursor.h"
#include "qcocoawindow.h"
+#include "qcocoascreen.h"
#include "qcocoahelpers.h"
#include <QtGui/private/qcoregraphics_p.h>
@@ -70,7 +71,7 @@ void QCocoaCursor::changeCursor(QCursor *cursor, QWindow *window)
QPoint QCocoaCursor::pos() const
{
- return qt_mac_flipPoint([NSEvent mouseLocation]).toPoint();
+ return QCocoaScreen::mapFromNative([NSEvent mouseLocation]).toPoint();
}
void QCocoaCursor::setPos(const QPoint &position)
@@ -86,7 +87,7 @@ void QCocoaCursor::setPos(const QPoint &position)
NSCursor *QCocoaCursor::convertCursor(QCursor *cursor)
{
- if (cursor == Q_NULLPTR)
+ if (cursor == nullptr)
return 0;
const Qt::CursorShape newShape = cursor->shape();
diff --git a/src/plugins/platforms/cocoa/qcocoadrag.h b/src/plugins/platforms/cocoa/qcocoadrag.h
index c7277a47bf..dc0cc17dfb 100644
--- a/src/plugins/platforms/cocoa/qcocoadrag.h
+++ b/src/plugins/platforms/cocoa/qcocoadrag.h
@@ -56,10 +56,10 @@ public:
~QCocoaDrag();
QMimeData *dragMimeData();
- Qt::DropAction drag(QDrag *m_drag) Q_DECL_OVERRIDE;
+ Qt::DropAction drag(QDrag *m_drag) override;
Qt::DropAction defaultAction(Qt::DropActions possibleActions,
- Qt::KeyboardModifiers modifiers) const Q_DECL_OVERRIDE;
+ Qt::KeyboardModifiers modifiers) const override;
/**
* to meet NSView dragImage:at guarantees, we need to record the original
diff --git a/src/plugins/platforms/cocoa/qcocoadrag.mm b/src/plugins/platforms/cocoa/qcocoadrag.mm
index 3bd0b05725..e1f36b47a1 100644
--- a/src/plugins/platforms/cocoa/qcocoadrag.mm
+++ b/src/plugins/platforms/cocoa/qcocoadrag.mm
@@ -188,7 +188,7 @@ QPixmap QCocoaDrag::dragPixmap(QDrag *drag, QPoint &hotSpot) const
if (s.length() > dragImageMaxChars)
s = s.left(dragImageMaxChars -3) + QChar(0x2026);
if (!s.isEmpty()) {
- const int width = fm.width(s);
+ const int width = fm.horizontalAdvance(s);
const int height = fm.height();
if (width > 0 && height > 0) {
qreal dpr = 1.0;
diff --git a/src/plugins/platforms/cocoa/qcocoafiledialoghelper.h b/src/plugins/platforms/cocoa/qcocoafiledialoghelper.h
index f5ba1dc22e..2ddda14289 100644
--- a/src/plugins/platforms/cocoa/qcocoafiledialoghelper.h
+++ b/src/plugins/platforms/cocoa/qcocoafiledialoghelper.h
@@ -59,19 +59,19 @@ public:
QCocoaFileDialogHelper();
virtual ~QCocoaFileDialogHelper();
- void exec() Q_DECL_OVERRIDE;
+ void exec() override;
- bool defaultNameFilterDisables() const Q_DECL_OVERRIDE;
+ bool defaultNameFilterDisables() const override;
- bool show(Qt::WindowFlags windowFlags, Qt::WindowModality windowModality, QWindow *parent) Q_DECL_OVERRIDE;
- void hide() Q_DECL_OVERRIDE;
- void setDirectory(const QUrl &directory) Q_DECL_OVERRIDE;
- QUrl directory() const Q_DECL_OVERRIDE;
- void selectFile(const QUrl &filename) Q_DECL_OVERRIDE;
- QList<QUrl> selectedFiles() const Q_DECL_OVERRIDE;
- void setFilter() Q_DECL_OVERRIDE;
- void selectNameFilter(const QString &filter) Q_DECL_OVERRIDE;
- QString selectedNameFilter() const Q_DECL_OVERRIDE;
+ bool show(Qt::WindowFlags windowFlags, Qt::WindowModality windowModality, QWindow *parent) override;
+ void hide() override;
+ void setDirectory(const QUrl &directory) override;
+ QUrl directory() const override;
+ void selectFile(const QUrl &filename) override;
+ QList<QUrl> selectedFiles() const override;
+ void setFilter() override;
+ void selectNameFilter(const QString &filter) override;
+ QString selectedNameFilter() const override;
public:
bool showCocoaFilePanel(Qt::WindowModality windowModality, QWindow *parent);
diff --git a/src/plugins/platforms/cocoa/qcocoafiledialoghelper.mm b/src/plugins/platforms/cocoa/qcocoafiledialoghelper.mm
index fa123550ef..7ea3d130f7 100644
--- a/src/plugins/platforms/cocoa/qcocoafiledialoghelper.mm
+++ b/src/plugins/platforms/cocoa/qcocoafiledialoghelper.mm
@@ -63,7 +63,8 @@
#include <qsysinfo.h>
#include <qoperatingsystemversion.h>
#include <qglobal.h>
-#include <QDir>
+#include <qdir.h>
+#include <qregularexpression.h>
#include <qpa/qplatformnativeinterface.h>
@@ -509,9 +510,10 @@ static QString strippedText(QString s)
- (QString)removeExtensions:(const QString &)filter
{
- QRegExp regExp(QString::fromLatin1(QPlatformFileDialogHelper::filterRegExp));
- if (regExp.indexIn(filter) != -1)
- return regExp.cap(1).trimmed();
+ QRegularExpression regExp(QString::fromLatin1(QPlatformFileDialogHelper::filterRegExp));
+ QRegularExpressionMatch match = regExp.match(filter);
+ if (match.hasMatch())
+ return match.captured(1).trimmed();
return filter;
}
diff --git a/src/plugins/platforms/cocoa/qcocoafontdialoghelper.h b/src/plugins/platforms/cocoa/qcocoafontdialoghelper.h
index c3fad7cfd6..14f12f2d76 100644
--- a/src/plugins/platforms/cocoa/qcocoafontdialoghelper.h
+++ b/src/plugins/platforms/cocoa/qcocoafontdialoghelper.h
@@ -54,13 +54,13 @@ public:
QCocoaFontDialogHelper();
~QCocoaFontDialogHelper();
- void exec() Q_DECL_OVERRIDE;
+ void exec() override;
- bool show(Qt::WindowFlags windowFlags, Qt::WindowModality windowModality, QWindow *parent) Q_DECL_OVERRIDE;
- void hide() Q_DECL_OVERRIDE;
+ bool show(Qt::WindowFlags windowFlags, Qt::WindowModality windowModality, QWindow *parent) override;
+ void hide() override;
- void setCurrentFont(const QFont &) Q_DECL_OVERRIDE;
- QFont currentFont() const Q_DECL_OVERRIDE;
+ void setCurrentFont(const QFont &) override;
+ QFont currentFont() const override;
};
QT_END_NAMESPACE
diff --git a/src/plugins/platforms/cocoa/qcocoaglcontext.h b/src/plugins/platforms/cocoa/qcocoaglcontext.h
index 732b50d29e..0530aa8201 100644
--- a/src/plugins/platforms/cocoa/qcocoaglcontext.h
+++ b/src/plugins/platforms/cocoa/qcocoaglcontext.h
@@ -55,22 +55,22 @@ public:
QCocoaGLContext(const QSurfaceFormat &format, QPlatformOpenGLContext *share, const QVariant &nativeHandle);
~QCocoaGLContext();
- QSurfaceFormat format() const Q_DECL_OVERRIDE;
+ QSurfaceFormat format() const override;
- void swapBuffers(QPlatformSurface *surface) Q_DECL_OVERRIDE;
+ void swapBuffers(QPlatformSurface *surface) override;
- bool makeCurrent(QPlatformSurface *surface) Q_DECL_OVERRIDE;
- void doneCurrent() Q_DECL_OVERRIDE;
+ bool makeCurrent(QPlatformSurface *surface) override;
+ void doneCurrent() override;
- QFunctionPointer getProcAddress(const char *procName) Q_DECL_OVERRIDE;
+ QFunctionPointer getProcAddress(const char *procName) override;
void update();
static NSOpenGLPixelFormat *createNSOpenGLPixelFormat(const QSurfaceFormat &format);
NSOpenGLContext *nsOpenGLContext() const;
- bool isSharing() const Q_DECL_OVERRIDE;
- bool isValid() const Q_DECL_OVERRIDE;
+ bool isSharing() const override;
+ bool isValid() const override;
void windowWasHidden();
diff --git a/src/plugins/platforms/cocoa/qcocoahelpers.h b/src/plugins/platforms/cocoa/qcocoahelpers.h
index 7810733255..6c75db9bdb 100644
--- a/src/plugins/platforms/cocoa/qcocoahelpers.h
+++ b/src/plugins/platforms/cocoa/qcocoahelpers.h
@@ -85,13 +85,8 @@ QT_MANGLE_NAMESPACE(QNSView) *qnsview_cast(NSView *view);
void qt_mac_transformProccessToForegroundApplication();
QString qt_mac_applicationName();
-int qt_mac_flipYCoordinate(int y);
-qreal qt_mac_flipYCoordinate(qreal y);
-QPointF qt_mac_flipPoint(const NSPoint &p);
-NSPoint qt_mac_flipPoint(const QPoint &p);
-NSPoint qt_mac_flipPoint(const QPointF &p);
-
-NSRect qt_mac_flipRect(const QRect &rect);
+QPointF qt_mac_flip(const QPointF &pos, const QRectF &reference);
+QRectF qt_mac_flip(const QRectF &rect, const QRectF &reference);
Qt::MouseButton cocoaButton2QtButton(NSInteger buttonNum);
@@ -193,6 +188,19 @@ QT_NAMESPACE_ALIAS_OBJC_CLASS(QNSPanelContentsWrapper);
// -------------------------------------------------------------------------
+// QAppleRefCounted expects the retain function to return the object
+io_object_t q_IOObjectRetain(io_object_t obj);
+// QAppleRefCounted expects the release function to return void
+void q_IOObjectRelease(io_object_t obj);
+
+template <typename T>
+class QIOType : public QAppleRefCounted<T, io_object_t, q_IOObjectRetain, q_IOObjectRelease>
+{
+ using QAppleRefCounted<T, io_object_t, q_IOObjectRetain, q_IOObjectRelease>::QAppleRefCounted;
+};
+
+// -------------------------------------------------------------------------
+
// Depending on the ABI of the platform, we may need to use objc_msgSendSuper_stret:
// - http://www.sealiesoftware.com/blog/archive/2008/10/30/objc_explain_objc_msgSend_stret.html
// - https://lists.apple.com/archives/cocoa-dev/2008/Feb/msg02338.html
diff --git a/src/plugins/platforms/cocoa/qcocoahelpers.mm b/src/plugins/platforms/cocoa/qcocoahelpers.mm
index 9f9618177d..85d12040de 100644
--- a/src/plugins/platforms/cocoa/qcocoahelpers.mm
+++ b/src/plugins/platforms/cocoa/qcocoahelpers.mm
@@ -232,50 +232,37 @@ QString qt_mac_applicationName()
return appName;
}
-int qt_mac_primaryScreenHeight()
-{
- QMacAutoReleasePool pool;
- NSArray *screens = [NSScreen screens];
- if ([screens count] > 0) {
- // The first screen in the screens array is documented to
- // have the (0,0) origin and is designated the primary screen.
- NSRect screenFrame = [[screens objectAtIndex: 0] frame];
- return screenFrame.size.height;
- }
- return 0;
-}
+// -------------------------------------------------------------------------
-int qt_mac_flipYCoordinate(int y)
-{
- return qt_mac_primaryScreenHeight() - y;
-}
+/*!
+ \fn QPointF qt_mac_flip(const QPointF &pos, const QRectF &reference)
+ \fn QRectF qt_mac_flip(const QRectF &rect, const QRectF &reference)
-qreal qt_mac_flipYCoordinate(qreal y)
-{
- return qt_mac_primaryScreenHeight() - y;
-}
+ Flips the Y coordinate of the point/rect between quadrant I and IV.
-QPointF qt_mac_flipPoint(const NSPoint &p)
-{
- return QPointF(p.x, qt_mac_flipYCoordinate(p.y));
-}
+ The native coordinate system on macOS uses quadrant I, with origin
+ in bottom left, and Qt uses quadrant IV, with origin in top left.
-NSPoint qt_mac_flipPoint(const QPoint &p)
-{
- return NSMakePoint(p.x(), qt_mac_flipYCoordinate(p.y()));
-}
+ By flipping the Y coordinate, we can map the point/rect between
+ the two coordinate systems.
-NSPoint qt_mac_flipPoint(const QPointF &p)
+ The flip is always in relation to a reference rectangle, e.g.
+ the frame of the parent view, or the screen geometry. In the
+ latter case the specialized QCocoaScreen::mapFrom/To functions
+ should be used instead.
+*/
+QPointF qt_mac_flip(const QPointF &pos, const QRectF &reference)
{
- return NSMakePoint(p.x(), qt_mac_flipYCoordinate(p.y()));
+ return QPointF(pos.x(), reference.height() - pos.y());
}
-NSRect qt_mac_flipRect(const QRect &rect)
+QRectF qt_mac_flip(const QRectF &rect, const QRectF &reference)
{
- int flippedY = qt_mac_flipYCoordinate(rect.y() + rect.height());
- return NSMakeRect(rect.x(), flippedY, rect.width(), rect.height());
+ return QRectF(qt_mac_flip(rect.bottomLeft(), reference), rect.size());
}
+// -------------------------------------------------------------------------
+
Qt::MouseButton cocoaButton2QtButton(NSInteger buttonNum)
{
if (buttonNum >= 0 && buttonNum <= 31)
@@ -408,4 +395,19 @@ QT_END_NAMESPACE
[super layout];
}
+// -------------------------------------------------------------------------
+
+io_object_t q_IOObjectRetain(io_object_t obj)
+{
+ kern_return_t ret = IOObjectRetain(obj);
+ Q_ASSERT(!ret);
+ return obj;
+}
+
+void q_IOObjectRelease(io_object_t obj)
+{
+ kern_return_t ret = IOObjectRelease(obj);
+ Q_ASSERT(!ret);
+}
+
@end
diff --git a/src/plugins/platforms/cocoa/qcocoainputcontext.h b/src/plugins/platforms/cocoa/qcocoainputcontext.h
index a248ca0d8d..7190ba0de8 100644
--- a/src/plugins/platforms/cocoa/qcocoainputcontext.h
+++ b/src/plugins/platforms/cocoa/qcocoainputcontext.h
@@ -53,11 +53,11 @@ public:
explicit QCocoaInputContext();
~QCocoaInputContext();
- bool isValid() const Q_DECL_OVERRIDE { return true; }
+ bool isValid() const override { return true; }
- void reset() Q_DECL_OVERRIDE;
+ void reset() override;
- QLocale locale() const Q_DECL_OVERRIDE { return m_locale; }
+ QLocale locale() const override { return m_locale; }
void updateLocale();
private Q_SLOTS:
diff --git a/src/plugins/platforms/cocoa/qcocoaintegration.h b/src/plugins/platforms/cocoa/qcocoaintegration.h
index 2fc5156d24..301771fd53 100644
--- a/src/plugins/platforms/cocoa/qcocoaintegration.h
+++ b/src/plugins/platforms/cocoa/qcocoaintegration.h
@@ -75,35 +75,35 @@ public:
static QCocoaIntegration *instance();
Options options() const;
- bool hasCapability(QPlatformIntegration::Capability cap) const Q_DECL_OVERRIDE;
- QPlatformWindow *createPlatformWindow(QWindow *window) const Q_DECL_OVERRIDE;
- QPlatformWindow *createForeignWindow(QWindow *window, WId nativeHandle) const Q_DECL_OVERRIDE;
+ bool hasCapability(QPlatformIntegration::Capability cap) const override;
+ QPlatformWindow *createPlatformWindow(QWindow *window) const override;
+ QPlatformWindow *createForeignWindow(QWindow *window, WId nativeHandle) const override;
QPlatformOffscreenSurface *createPlatformOffscreenSurface(QOffscreenSurface *surface) const override;
#ifndef QT_NO_OPENGL
- QPlatformOpenGLContext *createPlatformOpenGLContext(QOpenGLContext *context) const Q_DECL_OVERRIDE;
+ QPlatformOpenGLContext *createPlatformOpenGLContext(QOpenGLContext *context) const override;
#endif
- QPlatformBackingStore *createPlatformBackingStore(QWindow *widget) const Q_DECL_OVERRIDE;
+ QPlatformBackingStore *createPlatformBackingStore(QWindow *widget) const override;
- QAbstractEventDispatcher *createEventDispatcher() const Q_DECL_OVERRIDE;
+ QAbstractEventDispatcher *createEventDispatcher() const override;
- QCoreTextFontDatabase *fontDatabase() const Q_DECL_OVERRIDE;
- QCocoaNativeInterface *nativeInterface() const Q_DECL_OVERRIDE;
- QPlatformInputContext *inputContext() const Q_DECL_OVERRIDE;
+ QCoreTextFontDatabase *fontDatabase() const override;
+ QCocoaNativeInterface *nativeInterface() const override;
+ QPlatformInputContext *inputContext() const override;
#ifndef QT_NO_ACCESSIBILITY
- QCocoaAccessibility *accessibility() const Q_DECL_OVERRIDE;
+ QCocoaAccessibility *accessibility() const override;
#endif
#ifndef QT_NO_CLIPBOARD
- QCocoaClipboard *clipboard() const Q_DECL_OVERRIDE;
+ QCocoaClipboard *clipboard() const override;
#endif
- QCocoaDrag *drag() const Q_DECL_OVERRIDE;
+ QCocoaDrag *drag() const override;
- QStringList themeNames() const Q_DECL_OVERRIDE;
- QPlatformTheme *createPlatformTheme(const QString &name) const Q_DECL_OVERRIDE;
- QCocoaServices *services() const Q_DECL_OVERRIDE;
- QVariant styleHint(StyleHint hint) const Q_DECL_OVERRIDE;
+ QStringList themeNames() const override;
+ QPlatformTheme *createPlatformTheme(const QString &name) const override;
+ QCocoaServices *services() const override;
+ QVariant styleHint(StyleHint hint) const override;
- Qt::KeyboardModifiers queryKeyboardModifiers() const Q_DECL_OVERRIDE;
- QList<int> possibleKeys(const QKeyEvent *event) const Q_DECL_OVERRIDE;
+ Qt::KeyboardModifiers queryKeyboardModifiers() const override;
+ QList<int> possibleKeys(const QKeyEvent *event) const override;
void updateScreens();
QCocoaScreen *screenForNSScreen(NSScreen *nsScreen);
@@ -117,9 +117,9 @@ public:
QCocoaWindow *activePopupWindow() const;
QList<QCocoaWindow *> *popupWindowStack();
- void setApplicationIcon(const QIcon &icon) const Q_DECL_OVERRIDE;
+ void setApplicationIcon(const QIcon &icon) const override;
- void beep() const Q_DECL_OVERRIDE;
+ void beep() const override;
private Q_SLOTS:
void focusWindowChanged(QWindow *);
diff --git a/src/plugins/platforms/cocoa/qcocoamenu.h b/src/plugins/platforms/cocoa/qcocoamenu.h
index 5081fc78c6..2b4cf0ef98 100644
--- a/src/plugins/platforms/cocoa/qcocoamenu.h
+++ b/src/plugins/platforms/cocoa/qcocoamenu.h
@@ -45,6 +45,8 @@
#include <qpa/qplatformmenu.h>
#include "qcocoamenuitem.h"
+Q_FORWARD_DECLARE_OBJC_CLASS(QT_MANGLE_NAMESPACE(QCocoaNSMenu));
+
QT_BEGIN_NAMESPACE
class QCocoaMenuBar;
@@ -55,32 +57,31 @@ public:
QCocoaMenu();
~QCocoaMenu();
- void insertMenuItem(QPlatformMenuItem *menuItem, QPlatformMenuItem *before) Q_DECL_OVERRIDE;
- void removeMenuItem(QPlatformMenuItem *menuItem) Q_DECL_OVERRIDE;
- void syncMenuItem(QPlatformMenuItem *menuItem) Q_DECL_OVERRIDE;
- void setEnabled(bool enabled) Q_DECL_OVERRIDE;
- bool isEnabled() const Q_DECL_OVERRIDE;
- void setVisible(bool visible) Q_DECL_OVERRIDE;
- void showPopup(const QWindow *parentWindow, const QRect &targetRect, const QPlatformMenuItem *item) Q_DECL_OVERRIDE;
- void dismiss() Q_DECL_OVERRIDE;
+ void insertMenuItem(QPlatformMenuItem *menuItem, QPlatformMenuItem *before) override;
+ void removeMenuItem(QPlatformMenuItem *menuItem) override;
+ void syncMenuItem(QPlatformMenuItem *menuItem) override;
+ void setEnabled(bool enabled) override;
+ bool isEnabled() const override;
+ void setVisible(bool visible) override;
+ void showPopup(const QWindow *parentWindow, const QRect &targetRect, const QPlatformMenuItem *item) override;
+ void dismiss() override;
- void syncSeparatorsCollapsible(bool enable) Q_DECL_OVERRIDE;
+ void syncSeparatorsCollapsible(bool enable) override;
void propagateEnabledState(bool enabled);
- void setIcon(const QIcon &icon) Q_DECL_OVERRIDE { Q_UNUSED(icon) }
+ void setIcon(const QIcon &icon) override { Q_UNUSED(icon) }
- void setText(const QString &text) Q_DECL_OVERRIDE;
- void setMinimumWidth(int width) Q_DECL_OVERRIDE;
- void setFont(const QFont &font) Q_DECL_OVERRIDE;
+ void setText(const QString &text) override;
+ void setMinimumWidth(int width) override;
+ void setFont(const QFont &font) override;
- inline NSMenu *nsMenu() const
- { return m_nativeMenu; }
+ NSMenu *nsMenu() const;
inline bool isVisible() const { return m_visible; }
- QPlatformMenuItem *menuItemAt(int position) const Q_DECL_OVERRIDE;
- QPlatformMenuItem *menuItemForTag(quintptr tag) const Q_DECL_OVERRIDE;
+ QPlatformMenuItem *menuItemAt(int position) const override;
+ QPlatformMenuItem *menuItemForTag(quintptr tag) const override;
QList<QCocoaMenuItem *> items() const;
QList<QCocoaMenuItem *> merged() const;
@@ -91,7 +92,7 @@ public:
bool isOpen() const;
void setIsOpen(bool isOpen);
- void timerEvent(QTimerEvent *e) Q_DECL_OVERRIDE;
+ void timerEvent(QTimerEvent *e) override;
void syncMenuItem_helper(QPlatformMenuItem *menuItem, bool menubarUpdate);
@@ -101,7 +102,7 @@ private:
void scheduleUpdate();
QList<QCocoaMenuItem *> m_menuItems;
- NSMenu *m_nativeMenu;
+ QT_MANGLE_NAMESPACE(QCocoaNSMenu) *m_nativeMenu;
NSMenuItem *m_attachedItem;
int m_updateTimer;
bool m_enabled:1;
diff --git a/src/plugins/platforms/cocoa/qcocoamenu.mm b/src/plugins/platforms/cocoa/qcocoamenu.mm
index 1345295ef5..7a550b163b 100644
--- a/src/plugins/platforms/cocoa/qcocoamenu.mm
+++ b/src/plugins/platforms/cocoa/qcocoamenu.mm
@@ -38,234 +38,15 @@
****************************************************************************/
#include "qcocoamenu.h"
+#include "qcocoansmenu.h"
#include "qcocoahelpers.h"
#include <QtCore/QtDebug>
-#include <QtCore/qmetaobject.h>
-#include <QtCore/private/qthread_p.h>
-#include <QtGui/private/qguiapplication_p.h>
#include "qcocoaapplication.h"
#include "qcocoamenuloader.h"
#include "qcocoamenubar.h"
#include "qcocoawindow.h"
-#import "qnsview.h"
-
-QT_BEGIN_NAMESPACE
-
-NSString *qt_mac_removePrivateUnicode(NSString* string)
-{
- int len = [string length];
- if (len) {
- QVarLengthArray <unichar, 10> characters(len);
- bool changed = false;
- for (int i = 0; i<len; i++) {
- characters[i] = [string characterAtIndex:i];
- // check if they belong to key codes in private unicode range
- // currently we need to handle only the NSDeleteFunctionKey
- if (characters[i] == NSDeleteFunctionKey) {
- characters[i] = NSDeleteCharacter;
- changed = true;
- }
- }
- if (changed)
- return [NSString stringWithCharacters:characters.data() length:len];
- }
- return string;
-}
-
-QT_END_NAMESPACE
-
-@interface QT_MANGLE_NAMESPACE(QCocoaMenuDelegate) : NSObject <NSMenuDelegate> {
- QCocoaMenu *m_menu;
-}
-
-- (id) initWithMenu:(QCocoaMenu*) m;
-- (NSMenuItem *)findItem:(NSMenu *)menu forKey:(NSString *)key forModifiers:(NSUInteger)modifier;
-
-@end
-
-QT_NAMESPACE_ALIAS_OBJC_CLASS(QCocoaMenuDelegate);
-
-@implementation QCocoaMenuDelegate
-
-- (id) initWithMenu:(QCocoaMenu*) m
-{
- if ((self = [super init]))
- m_menu = m;
-
- return self;
-}
-
-- (NSInteger)numberOfItemsInMenu:(NSMenu *)menu
-{
- Q_ASSERT(m_menu->nsMenu() == menu);
- return menu.numberOfItems;
-}
-
-- (BOOL)menu:(NSMenu *)menu updateItem:(NSMenuItem *)item atIndex:(NSInteger)index shouldCancel:(BOOL)shouldCancel
-{
- Q_UNUSED(index);
- Q_ASSERT(m_menu->nsMenu() == menu);
- if (shouldCancel) {
- // TODO detach all submenus
- return NO;
- }
-
- QCocoaMenuItem *menuItem = reinterpret_cast<QCocoaMenuItem *>(item.tag);
- if (m_menu->items().contains(menuItem)) {
- if (QCocoaMenu *itemSubmenu = menuItem->menu())
- itemSubmenu->setAttachedItem(item);
- }
- return YES;
-}
-
-- (void)menu:(NSMenu*)menu willHighlightItem:(NSMenuItem*)item
-{
- Q_UNUSED(menu);
- if (item && [item tag]) {
- QCocoaMenuItem *cocoaItem = reinterpret_cast<QCocoaMenuItem *>([item tag]);
- cocoaItem->hovered();
- }
-}
-
-- (void) menuWillOpen:(NSMenu*)m
-{
- Q_UNUSED(m);
- m_menu->setIsOpen(true);
- emit m_menu->aboutToShow();
-}
-
-- (void) menuDidClose:(NSMenu*)m
-{
- Q_UNUSED(m);
- m_menu->setIsOpen(false);
- // wrong, but it's the best we can do
- emit m_menu->aboutToHide();
-}
-
-- (void) itemFired:(NSMenuItem*) item
-{
- QCocoaMenuItem *cocoaItem = reinterpret_cast<QCocoaMenuItem *>([item tag]);
- // Menu-holding items also get a target to play nicely
- // with NSMenuValidation but should not trigger.
- if (cocoaItem->menu())
- return;
- QScopedScopeLevelCounter scopeLevelCounter(QGuiApplicationPrivate::instance()->threadData);
- QGuiApplicationPrivate::modifier_buttons = [QNSView convertKeyModifiers:[NSEvent modifierFlags]];
- static QMetaMethod activatedSignal = QMetaMethod::fromSignal(&QCocoaMenuItem::activated);
- activatedSignal.invoke(cocoaItem, Qt::QueuedConnection);
-}
-
-- (BOOL)validateMenuItem:(NSMenuItem*)menuItem
-{
- QCocoaMenuItem *cocoaItem = reinterpret_cast<QCocoaMenuItem *>(menuItem.tag);
- // Menu-holding items are always enabled, as it's conventional in Cocoa
- if (!cocoaItem || cocoaItem->menu())
- return YES;
-
- return cocoaItem->isEnabled();
-}
-
-- (BOOL)menuHasKeyEquivalent:(NSMenu *)menu forEvent:(NSEvent *)event target:(id *)target action:(SEL *)action
-{
- /*
- Check if the menu actually has a keysequence defined for this key event.
- If it does, then we will first send the key sequence to the QWidget that has focus
- since (in Qt's eyes) it needs to a chance at the key event first (QEvent::ShortcutOverride).
- If the widget accepts the key event, we then return YES, but set the target and action to be nil,
- which means that the action should not be triggered, and instead dispatch the event ourselves.
- In every other case we return NO, which means that Cocoa can do as it pleases
- (i.e., fire the menu action).
- */
-
- // Change the private unicode keys to the ones used in setting the "Key Equivalents"
- NSString *characters = qt_mac_removePrivateUnicode([event characters]);
- // Interested only in Shift, Cmd, Ctrl & Alt Keys, so ignoring masks like, Caps lock, Num Lock ...
- const NSUInteger mask = NSShiftKeyMask | NSControlKeyMask | NSCommandKeyMask | NSAlternateKeyMask;
- if (NSMenuItem *menuItem = [self findItem:menu forKey:characters forModifiers:([event modifierFlags] & mask)]) {
- if (!menuItem.target) {
- // This item was modified by QCocoaMenuBar::redirectKnownMenuItemsToFirstResponder
- // and it looks like we're running a modal session for NSOpenPanel/NSSavePanel.
- // QCocoaFileDialogHelper is actually the only place we use this and we run NSOpenPanel modal
- // (modal sheet, window modal, application modal).
- // Whatever the current first responder is, let's give it a chance
- // and do not touch the Qt's focusObject (which is different from some native view
- // having a focus inside NSSave/OpenPanel.
- *target = nil;
- *action = menuItem.action;
- return YES;
- }
-
- QObject *object = qApp->focusObject();
- if (object) {
- QChar ch;
- int keyCode;
- ulong nativeModifiers = [event modifierFlags];
- Qt::KeyboardModifiers modifiers = [QNSView convertKeyModifiers: nativeModifiers];
- NSString *charactersIgnoringModifiers = [event charactersIgnoringModifiers];
- NSString *characters = [event characters];
-
- if ([charactersIgnoringModifiers length] > 0) { // convert the first character into a key code
- if ((modifiers & Qt::ControlModifier) && ([characters length] != 0)) {
- ch = QChar([characters characterAtIndex:0]);
- } else {
- ch = QChar([charactersIgnoringModifiers characterAtIndex:0]);
- }
- keyCode = qt_mac_cocoaKey2QtKey(ch);
- } else {
- // might be a dead key
- ch = QChar::ReplacementCharacter;
- keyCode = Qt::Key_unknown;
- }
-
- QKeyEvent accel_ev(QEvent::ShortcutOverride, (keyCode & (~Qt::KeyboardModifierMask)),
- Qt::KeyboardModifiers(modifiers & Qt::KeyboardModifierMask));
- accel_ev.ignore();
- QCoreApplication::sendEvent(object, &accel_ev);
- if (accel_ev.isAccepted()) {
- [[NSApp keyWindow] sendEvent: event];
- *target = nil;
- *action = nil;
- return YES;
- }
- }
- }
- return NO;
-}
-
-- (NSMenuItem *)findItem:(NSMenu *)menu forKey:(NSString *)key forModifiers:(NSUInteger)modifier
-{
- for (NSMenuItem *item in [menu itemArray]) {
- if (![item isEnabled] || [item isHidden] || [item isSeparatorItem])
- continue;
- if ([item hasSubmenu]) {
- if (NSMenuItem *nested = [self findItem:[item submenu] forKey:key forModifiers:modifier])
- return nested;
- }
-
- NSString *menuKey = [item keyEquivalent];
- if (menuKey
- && NSOrderedSame == [menuKey compare:key]
- && modifier == [item keyEquivalentModifierMask])
- return item;
- }
- return nil;
-}
-
-// Cocoa will query the menu item's target for the worksWhenModal selector.
-// So we need to implement this to allow the items to be handled correctly
-// when a modal dialog is visible.
-- (BOOL)worksWhenModal
-{
- if (!QGuiApplication::modalWindow())
- return YES;
- if (auto *mb = qobject_cast<QCocoaMenuBar *>(m_menu->menuParent()))
- return QGuiApplication::modalWindow()->handle() == mb->cocoaWindow() ? YES : NO;
- return YES;
-}
-
-@end
QT_BEGIN_NAMESPACE
@@ -279,9 +60,7 @@ QCocoaMenu::QCocoaMenu() :
{
QMacAutoReleasePool pool;
- m_nativeMenu = [[NSMenu alloc] initWithTitle:@"Untitled"];
- [m_nativeMenu setAutoenablesItems:YES];
- m_nativeMenu.delegate = [[QCocoaMenuDelegate alloc] initWithMenu:this];
+ m_nativeMenu = [[QCocoaNSMenu alloc] initWithQPAMenu:this];
}
QCocoaMenu::~QCocoaMenu()
@@ -291,10 +70,6 @@ QCocoaMenu::~QCocoaMenu()
item->setMenuParent(0);
}
- QMacAutoReleasePool pool;
- NSObject *delegate = m_nativeMenu.delegate;
- m_nativeMenu.delegate = nil;
- [delegate release];
[m_nativeMenu release];
}
@@ -319,6 +94,11 @@ void QCocoaMenu::setFont(const QFont &font)
}
}
+NSMenu *QCocoaMenu::nsMenu() const
+{
+ return static_cast<NSMenu *>(m_nativeMenu);
+}
+
void QCocoaMenu::insertMenuItem(QPlatformMenuItem *menuItem, QPlatformMenuItem *before)
{
QMacAutoReleasePool pool;
diff --git a/src/plugins/platforms/cocoa/qcocoamenubar.h b/src/plugins/platforms/cocoa/qcocoamenubar.h
index a259147247..6f3aca3a51 100644
--- a/src/plugins/platforms/cocoa/qcocoamenubar.h
+++ b/src/plugins/platforms/cocoa/qcocoamenubar.h
@@ -56,11 +56,11 @@ public:
QCocoaMenuBar();
~QCocoaMenuBar();
- void insertMenu(QPlatformMenu *menu, QPlatformMenu* before) Q_DECL_OVERRIDE;
- void removeMenu(QPlatformMenu *menu) Q_DECL_OVERRIDE;
- void syncMenu(QPlatformMenu *menuItem) Q_DECL_OVERRIDE;
- void handleReparent(QWindow *newParentWindow) Q_DECL_OVERRIDE;
- QPlatformMenu *menuForTag(quintptr tag) const Q_DECL_OVERRIDE;
+ void insertMenu(QPlatformMenu *menu, QPlatformMenu* before) override;
+ void removeMenu(QPlatformMenu *menu) override;
+ void syncMenu(QPlatformMenu *menuItem) override;
+ void handleReparent(QWindow *newParentWindow) override;
+ QPlatformMenu *menuForTag(quintptr tag) const override;
inline NSMenu *nsMenu() const
{ return m_nativeMenu; }
diff --git a/src/plugins/platforms/cocoa/qcocoamenubar.mm b/src/plugins/platforms/cocoa/qcocoamenubar.mm
index cf9553bcf7..8091d00bda 100644
--- a/src/plugins/platforms/cocoa/qcocoamenubar.mm
+++ b/src/plugins/platforms/cocoa/qcocoamenubar.mm
@@ -449,7 +449,7 @@ NSMenuItem *QCocoaMenuBar::itemForRole(QPlatformMenuItem::MenuRole r)
foreach (QCocoaMenuItem *i, m->items())
if (i->effectiveRole() == r)
return i->nsItem();
- return Q_NULLPTR;
+ return nullptr;
}
QCocoaWindow *QCocoaMenuBar::cocoaWindow() const
diff --git a/src/plugins/platforms/cocoa/qcocoamenuitem.h b/src/plugins/platforms/cocoa/qcocoamenuitem.h
index 53862d0484..2b598ee3a0 100644
--- a/src/plugins/platforms/cocoa/qcocoamenuitem.h
+++ b/src/plugins/platforms/cocoa/qcocoamenuitem.h
@@ -78,22 +78,22 @@ public:
QCocoaMenuItem();
~QCocoaMenuItem();
- void setText(const QString &text) Q_DECL_OVERRIDE;
- void setIcon(const QIcon &icon) Q_DECL_OVERRIDE;
- void setMenu(QPlatformMenu *menu) Q_DECL_OVERRIDE;
- void setVisible(bool isVisible) Q_DECL_OVERRIDE;
- void setIsSeparator(bool isSeparator) Q_DECL_OVERRIDE;
- void setFont(const QFont &font) Q_DECL_OVERRIDE;
- void setRole(MenuRole role) Q_DECL_OVERRIDE;
+ void setText(const QString &text) override;
+ void setIcon(const QIcon &icon) override;
+ void setMenu(QPlatformMenu *menu) override;
+ void setVisible(bool isVisible) override;
+ void setIsSeparator(bool isSeparator) override;
+ void setFont(const QFont &font) override;
+ void setRole(MenuRole role) override;
#ifndef QT_NO_SHORTCUT
- void setShortcut(const QKeySequence& shortcut) Q_DECL_OVERRIDE;
+ void setShortcut(const QKeySequence& shortcut) override;
#endif
- void setCheckable(bool checkable) Q_DECL_OVERRIDE { Q_UNUSED(checkable) }
- void setChecked(bool isChecked) Q_DECL_OVERRIDE;
- void setEnabled(bool isEnabled) Q_DECL_OVERRIDE;
- void setIconSize(int size) Q_DECL_OVERRIDE;
+ void setCheckable(bool checkable) override { Q_UNUSED(checkable) }
+ void setChecked(bool isChecked) override;
+ void setEnabled(bool isEnabled) override;
+ void setIconSize(int size) override;
- void setNativeContents(WId item) Q_DECL_OVERRIDE;
+ void setNativeContents(WId item) override;
inline QString text() const { return m_text; }
inline NSMenuItem * nsItem() { return m_native; }
diff --git a/src/plugins/platforms/cocoa/qcocoamenuitem.mm b/src/plugins/platforms/cocoa/qcocoamenuitem.mm
index eaf310ec51..f8f9648822 100644
--- a/src/plugins/platforms/cocoa/qcocoamenuitem.mm
+++ b/src/plugins/platforms/cocoa/qcocoamenuitem.mm
@@ -49,6 +49,7 @@
#include "qcocoaapplication.h" // for custom application category
#include "qcocoamenuloader.h"
#include <QtGui/private/qcoregraphics_p.h>
+#include <QtCore/qregularexpression.h>
#include <QtCore/QDebug>
@@ -261,7 +262,8 @@ NSMenuItem *QCocoaMenuItem::sync()
m_detectedRole = detectMenuRole(m_text);
switch (m_detectedRole) {
case QPlatformMenuItem::AboutRole:
- if (m_text.indexOf(QRegExp(QString::fromLatin1("qt$"), Qt::CaseInsensitive)) == -1)
+ if (m_text.indexOf(QRegularExpression(QString::fromLatin1("qt$"),
+ QRegularExpression::CaseInsensitiveOption)) == -1)
mergeItem = [loader aboutMenuItem];
else
mergeItem = [loader aboutQtMenuItem];
diff --git a/src/plugins/platforms/cocoa/qcocoamenuloader.mm b/src/plugins/platforms/cocoa/qcocoamenuloader.mm
index b986833f6d..cd597da71c 100644
--- a/src/plugins/platforms/cocoa/qcocoamenuloader.mm
+++ b/src/plugins/platforms/cocoa/qcocoamenuloader.mm
@@ -57,8 +57,12 @@
static QCocoaMenuLoader *shared = nil;
static dispatch_once_t onceToken;
dispatch_once(&onceToken, ^{
- shared = [[self alloc] init];
- });
+ shared = [[self alloc] init];
+ atexit_b(^{
+ [shared release];
+ shared = nil;
+ });
+ });
return shared;
}
diff --git a/src/plugins/platforms/cocoa/qcocoanativeinterface.h b/src/plugins/platforms/cocoa/qcocoanativeinterface.h
index 26fbe3e4bc..c78f1d5a7f 100644
--- a/src/plugins/platforms/cocoa/qcocoanativeinterface.h
+++ b/src/plugins/platforms/cocoa/qcocoanativeinterface.h
@@ -60,18 +60,18 @@ public:
QCocoaNativeInterface();
#ifndef QT_NO_OPENGL
- void *nativeResourceForContext(const QByteArray &resourceString, QOpenGLContext *context) Q_DECL_OVERRIDE;
+ void *nativeResourceForContext(const QByteArray &resourceString, QOpenGLContext *context) override;
#endif
- void *nativeResourceForWindow(const QByteArray &resourceString, QWindow *window) Q_DECL_OVERRIDE;
+ void *nativeResourceForWindow(const QByteArray &resourceString, QWindow *window) override;
- NativeResourceForIntegrationFunction nativeResourceFunctionForIntegration(const QByteArray &resource) Q_DECL_OVERRIDE;
+ NativeResourceForIntegrationFunction nativeResourceFunctionForIntegration(const QByteArray &resource) override;
#ifndef QT_NO_OPENGL
static void *cglContextForContext(QOpenGLContext *context);
static void *nsOpenGLContextForContext(QOpenGLContext* context);
#endif
- QFunctionPointer platformFunction(const QByteArray &function) const Q_DECL_OVERRIDE;
+ QFunctionPointer platformFunction(const QByteArray &function) const override;
public Q_SLOTS:
void onAppFocusWindowChanged(QWindow *window);
diff --git a/src/plugins/platforms/cocoa/qcocoanativeinterface.mm b/src/plugins/platforms/cocoa/qcocoanativeinterface.mm
index 8943cb6cd5..1422aebd65 100644
--- a/src/plugins/platforms/cocoa/qcocoanativeinterface.mm
+++ b/src/plugins/platforms/cocoa/qcocoanativeinterface.mm
@@ -233,7 +233,7 @@ QFunctionPointer QCocoaNativeInterface::platformFunction(const QByteArray &funct
if (function == QCocoaWindowFunctions::bottomLeftClippedByNSWindowOffsetIdentifier())
return QFunctionPointer(QCocoaWindowFunctions::BottomLeftClippedByNSWindowOffset(QCocoaWindow::bottomLeftClippedByNSWindowOffsetStatic));
- return Q_NULLPTR;
+ return nullptr;
}
void QCocoaNativeInterface::addToMimeList(void *macPasteboardMime)
diff --git a/src/plugins/platforms/cocoa/qcocoansmenu.h b/src/plugins/platforms/cocoa/qcocoansmenu.h
new file mode 100644
index 0000000000..8fb0a26f27
--- /dev/null
+++ b/src/plugins/platforms/cocoa/qcocoansmenu.h
@@ -0,0 +1,86 @@
+/****************************************************************************
+**
+** Copyright (C) 2017 The Qt Company Ltd.
+** Contact: https://www.qt.io/licensing/
+**
+** This file is part of the plugins of the Qt Toolkit.
+**
+** $QT_BEGIN_LICENSE:LGPL$
+** Commercial License Usage
+** Licensees holding valid commercial Qt licenses may use this file in
+** accordance with the commercial license agreement provided with the
+** Software or, alternatively, in accordance with the terms contained in
+** a written agreement between you and The Qt Company. For licensing terms
+** and conditions see https://www.qt.io/terms-conditions. For further
+** information use the contact form at https://www.qt.io/contact-us.
+**
+** GNU Lesser General Public License Usage
+** Alternatively, this file may be used under the terms of the GNU Lesser
+** General Public License version 3 as published by the Free Software
+** Foundation and appearing in the file LICENSE.LGPL3 included in the
+** packaging of this file. Please review the following information to
+** ensure the GNU Lesser General Public License version 3 requirements
+** will be met: https://www.gnu.org/licenses/lgpl-3.0.html.
+**
+** GNU General Public License Usage
+** Alternatively, this file may be used under the terms of the GNU
+** General Public License version 2.0 or (at your option) the GNU General
+** Public license version 3 or any later version approved by the KDE Free
+** Qt Foundation. The licenses are as published by the Free Software
+** Foundation and appearing in the file LICENSE.GPL2 and LICENSE.GPL3
+** included in the packaging of this file. Please review the following
+** information to ensure the GNU General Public License requirements will
+** be met: https://www.gnu.org/licenses/gpl-2.0.html and
+** https://www.gnu.org/licenses/gpl-3.0.html.
+**
+** $QT_END_LICENSE$
+**
+****************************************************************************/
+
+#ifndef QCOCOANSMENU_H
+#define QCOCOANSMENU_H
+
+//
+// W A R N I N G
+// -------------
+//
+// This file is not part of the Qt API. It exists purely as an
+// implementation detail. This header file may change from version to
+// version without notice, or even be removed.
+//
+// We mean it.
+//
+
+#import <AppKit/AppKit.h>
+
+#include <QtCore/qpointer.h>
+#include <qcocoahelpers.h>
+
+QT_FORWARD_DECLARE_CLASS(QCocoaMenu);
+typedef QPointer<QCocoaMenu> QCocoaMenuPointer;
+
+
+@interface QT_MANGLE_NAMESPACE(QCocoaNSMenuDelegate) : NSObject <NSMenuDelegate>
+
++ (instancetype)sharedMenuDelegate;
+
+- (NSMenuItem *)findItemInMenu:(NSMenu *)menu
+ forKey:(NSString *)key
+ modifiers:(NSUInteger)modifiers;
+
+- (BOOL)validateMenuItem:(NSMenuItem *)item; // NSMenuValidation
+
+@end
+
+@interface QT_MANGLE_NAMESPACE(QCocoaNSMenu) : NSMenu
+
+@property (readonly, nonatomic) QCocoaMenuPointer qpaMenu;
+
+- (instancetype)initWithQPAMenu:(QCocoaMenu *)menu;
+
+@end
+
+QT_NAMESPACE_ALIAS_OBJC_CLASS(QCocoaNSMenu);
+QT_NAMESPACE_ALIAS_OBJC_CLASS(QCocoaNSMenuDelegate);
+
+#endif // QCOCOANSMENU_H
diff --git a/src/plugins/platforms/cocoa/qcocoansmenu.mm b/src/plugins/platforms/cocoa/qcocoansmenu.mm
new file mode 100644
index 0000000000..996a4ff194
--- /dev/null
+++ b/src/plugins/platforms/cocoa/qcocoansmenu.mm
@@ -0,0 +1,296 @@
+/****************************************************************************
+**
+** Copyright (C) 2017 The Qt Company Ltd.
+** Contact: https://www.qt.io/licensing/
+**
+** This file is part of the plugins of the Qt Toolkit.
+**
+** $QT_BEGIN_LICENSE:LGPL$
+** Commercial License Usage
+** Licensees holding valid commercial Qt licenses may use this file in
+** accordance with the commercial license agreement provided with the
+** Software or, alternatively, in accordance with the terms contained in
+** a written agreement between you and The Qt Company. For licensing terms
+** and conditions see https://www.qt.io/terms-conditions. For further
+** information use the contact form at https://www.qt.io/contact-us.
+**
+** GNU Lesser General Public License Usage
+** Alternatively, this file may be used under the terms of the GNU Lesser
+** General Public License version 3 as published by the Free Software
+** Foundation and appearing in the file LICENSE.LGPL3 included in the
+** packaging of this file. Please review the following information to
+** ensure the GNU Lesser General Public License version 3 requirements
+** will be met: https://www.gnu.org/licenses/lgpl-3.0.html.
+**
+** GNU General Public License Usage
+** Alternatively, this file may be used under the terms of the GNU
+** General Public License version 2.0 or (at your option) the GNU General
+** Public license version 3 or any later version approved by the KDE Free
+** Qt Foundation. The licenses are as published by the Free Software
+** Foundation and appearing in the file LICENSE.GPL2 and LICENSE.GPL3
+** included in the packaging of this file. Please review the following
+** information to ensure the GNU General Public License requirements will
+** be met: https://www.gnu.org/licenses/gpl-2.0.html and
+** https://www.gnu.org/licenses/gpl-3.0.html.
+**
+** $QT_END_LICENSE$
+**
+****************************************************************************/
+
+#import "qcocoansmenu.h"
+#include "qcocoamenu.h"
+#include "qcocoamenuitem.h"
+#import "qnsview.h"
+
+#include <QtCore/qmetaobject.h>
+#include <QtCore/private/qthread_p.h>
+#include <QtGui/private/qguiapplication_p.h>
+
+static NSString *qt_mac_removePrivateUnicode(NSString* string)
+{
+ int len = [string length];
+ if (len) {
+ QVarLengthArray <unichar, 10> characters(len);
+ bool changed = false;
+ for (int i = 0; i<len; i++) {
+ characters[i] = [string characterAtIndex:i];
+ // check if they belong to key codes in private unicode range
+ // currently we need to handle only the NSDeleteFunctionKey
+ if (characters[i] == NSDeleteFunctionKey) {
+ characters[i] = NSDeleteCharacter;
+ changed = true;
+ }
+ }
+ if (changed)
+ return [NSString stringWithCharacters:characters.data() length:len];
+ }
+ return string;
+}
+
+@implementation QCocoaNSMenu
+
+- (instancetype)initWithQPAMenu:(QCocoaMenu *)menu
+{
+ if ((self = [super initWithTitle:@"Untitled"])) {
+ _qpaMenu = menu;
+ self.autoenablesItems = YES;
+ self.delegate = [QCocoaNSMenuDelegate sharedMenuDelegate];
+ }
+
+ return self;
+}
+
+@end
+
+#define CHECK_MENU_CLASS(menu) Q_ASSERT([menu isMemberOfClass:[QCocoaNSMenu class]])
+
+@implementation QCocoaNSMenuDelegate
+
++ (instancetype)sharedMenuDelegate
+{
+ static QCocoaNSMenuDelegate *shared = nil;
+ static dispatch_once_t onceToken;
+ dispatch_once(&onceToken, ^{
+ shared = [[self alloc] init];
+ atexit_b(^{
+ [shared release];
+ shared = nil;
+ });
+ });
+ return shared;
+}
+
+- (NSInteger)numberOfItemsInMenu:(NSMenu *)menu
+{
+ CHECK_MENU_CLASS(menu);
+ return menu.numberOfItems;
+}
+
+- (BOOL)menu:(NSMenu *)menu updateItem:(NSMenuItem *)item atIndex:(NSInteger)index shouldCancel:(BOOL)shouldCancel
+{
+ Q_UNUSED(index);
+ CHECK_MENU_CLASS(menu);
+
+ if (shouldCancel)
+ return NO;
+
+ const auto &qpaMenu = static_cast<QCocoaNSMenu *>(menu).qpaMenu;
+ if (qpaMenu.isNull())
+ return YES;
+
+ auto *menuItem = reinterpret_cast<QCocoaMenuItem *>(item.tag);
+ if (qpaMenu->items().contains(menuItem)) {
+ if (QCocoaMenu *itemSubmenu = menuItem->menu())
+ itemSubmenu->setAttachedItem(item);
+ }
+
+ return YES;
+}
+
+- (void)menu:(NSMenu *)menu willHighlightItem:(NSMenuItem *)item
+{
+ CHECK_MENU_CLASS(menu);
+ auto *qpaItem = reinterpret_cast<QCocoaMenuItem *>(item.tag);
+ if (qpaItem)
+ qpaItem->hovered();
+}
+
+- (void)menuWillOpen:(NSMenu *)menu
+{
+ CHECK_MENU_CLASS(menu);
+ const auto &qpaMenu = static_cast<QCocoaNSMenu *>(menu).qpaMenu;
+ if (qpaMenu.isNull())
+ return;
+
+ qpaMenu->setIsOpen(true);
+ emit qpaMenu->aboutToShow();
+}
+
+- (void)menuDidClose:(NSMenu *)menu
+{
+ CHECK_MENU_CLASS(menu);
+ const auto &qpaMenu = static_cast<QCocoaNSMenu *>(menu).qpaMenu;
+ if (qpaMenu.isNull())
+ return;
+
+ qpaMenu->setIsOpen(false);
+ // wrong, but it's the best we can do
+ emit qpaMenu->aboutToHide();
+}
+
+- (void)itemFired:(NSMenuItem *)item
+{
+ auto *qpaItem = reinterpret_cast<QCocoaMenuItem *>(item.tag);
+ // Menu-holding items also get a target to play nicely
+ // with NSMenuValidation but should not trigger.
+ if (!qpaItem || qpaItem->menu())
+ return;
+
+ QScopedScopeLevelCounter scopeLevelCounter(QGuiApplicationPrivate::instance()->threadData);
+ QGuiApplicationPrivate::modifier_buttons = [QNSView convertKeyModifiers:[NSEvent modifierFlags]];
+
+ static QMetaMethod activatedSignal = QMetaMethod::fromSignal(&QCocoaMenuItem::activated);
+ activatedSignal.invoke(qpaItem, Qt::QueuedConnection);
+}
+
+- (BOOL)validateMenuItem:(NSMenuItem*)item
+{
+ auto *qpaItem = reinterpret_cast<QCocoaMenuItem *>(item.tag);
+ // Menu-holding items are always enabled, as it's conventional in Cocoa
+ if (!qpaItem || qpaItem->menu())
+ return YES;
+
+ return qpaItem->isEnabled();
+}
+
+- (BOOL)menuHasKeyEquivalent:(NSMenu *)menu forEvent:(NSEvent *)event target:(id *)target action:(SEL *)action
+{
+ /*
+ Check if the menu actually has a keysequence defined for this key event.
+ If it does, then we will first send the key sequence to the QWidget that has focus
+ since (in Qt's eyes) it needs to a chance at the key event first (QEvent::ShortcutOverride).
+ If the widget accepts the key event, we then return YES, but set the target and action to be nil,
+ which means that the action should not be triggered, and instead dispatch the event ourselves.
+ In every other case we return NO, which means that Cocoa can do as it pleases
+ (i.e., fire the menu action).
+ */
+
+ CHECK_MENU_CLASS(menu);
+
+ // Interested only in Shift, Cmd, Ctrl & Alt Keys, so ignoring masks like, Caps lock, Num Lock ...
+ static const NSUInteger mask = NSShiftKeyMask | NSControlKeyMask | NSCommandKeyMask | NSAlternateKeyMask;
+
+ // Change the private unicode keys to the ones used in setting the "Key Equivalents"
+ NSString *characters = qt_mac_removePrivateUnicode(event.charactersIgnoringModifiers);
+ const auto modifiers = event.modifierFlags & mask;
+ NSMenuItem *keyEquivalentItem = [self findItemInMenu:menu
+ forKey:characters
+ modifiers:modifiers];
+ if (!keyEquivalentItem) {
+ // Maybe the modified character is what we're looking for after all
+ characters = qt_mac_removePrivateUnicode(event.characters);
+ keyEquivalentItem = [self findItemInMenu:menu
+ forKey:characters
+ modifiers:modifiers];
+ }
+
+ if (keyEquivalentItem) {
+ if (!keyEquivalentItem.target) {
+ // This item was modified by QCocoaMenuBar::redirectKnownMenuItemsToFirstResponder
+ // and it looks like we're running a modal session for NSOpenPanel/NSSavePanel.
+ // QCocoaFileDialogHelper is actually the only place we use this and we run NSOpenPanel modal
+ // (modal sheet, window modal, application modal).
+ // Whatever the current first responder is, let's give it a chance
+ // and do not touch the Qt's focusObject (which is different from some native view
+ // having a focus inside NSSave/OpenPanel.
+ *target = nil;
+ *action = keyEquivalentItem.action;
+ return YES;
+ }
+
+ QObject *object = qApp->focusObject();
+ if (object) {
+ QChar ch;
+ int keyCode;
+ ulong nativeModifiers = [event modifierFlags];
+ Qt::KeyboardModifiers modifiers = [QNSView convertKeyModifiers: nativeModifiers];
+ NSString *charactersIgnoringModifiers = [event charactersIgnoringModifiers];
+ NSString *characters = [event characters];
+
+ if ([charactersIgnoringModifiers length] > 0) { // convert the first character into a key code
+ if ((modifiers & Qt::ControlModifier) && ([characters length] != 0)) {
+ ch = QChar([characters characterAtIndex:0]);
+ } else {
+ ch = QChar([charactersIgnoringModifiers characterAtIndex:0]);
+ }
+ keyCode = qt_mac_cocoaKey2QtKey(ch);
+ } else {
+ // might be a dead key
+ ch = QChar::ReplacementCharacter;
+ keyCode = Qt::Key_unknown;
+ }
+
+ QKeyEvent accel_ev(QEvent::ShortcutOverride, (keyCode & (~Qt::KeyboardModifierMask)),
+ Qt::KeyboardModifiers(modifiers & Qt::KeyboardModifierMask));
+ accel_ev.ignore();
+ QCoreApplication::sendEvent(object, &accel_ev);
+ if (accel_ev.isAccepted()) {
+ [[NSApp keyWindow] sendEvent: event];
+ *target = nil;
+ *action = nil;
+ return YES;
+ }
+ }
+ }
+
+ return NO;
+}
+
+- (NSMenuItem *)findItemInMenu:(NSMenu *)menu
+ forKey:(NSString *)key
+ modifiers:(NSUInteger)modifiers
+{
+ // Find an item in 'menu' that has the same key equivalent as specified by
+ // 'key' and 'modifiers'. We ignore disabled, hidden and separator items.
+ // In a similar fashion, we don't need to recurse into submenus because their
+ // delegate will have [menuHasKeyEquivalent:...] invoked at some point.
+
+ for (NSMenuItem *item in menu.itemArray) {
+ if (!item.enabled || item.hidden || item.separatorItem)
+ continue;
+
+ if (item.hasSubmenu)
+ continue;
+
+ NSString *menuKey = item.keyEquivalent;
+ if (menuKey && NSOrderedSame == [menuKey compare:key]
+ && modifiers == item.keyEquivalentModifierMask)
+ return item;
+ }
+
+ return nil;
+}
+
+@end
+
+#undef CHECK_MENU_CLASS
diff --git a/src/plugins/platforms/cocoa/qcocoaprintdevice.h b/src/plugins/platforms/cocoa/qcocoaprintdevice.h
index c726cca4e5..20b27f3286 100644
--- a/src/plugins/platforms/cocoa/qcocoaprintdevice.h
+++ b/src/plugins/platforms/cocoa/qcocoaprintdevice.h
@@ -68,37 +68,37 @@ public:
explicit QCocoaPrintDevice(const QString &id);
virtual ~QCocoaPrintDevice();
- bool isValid() const Q_DECL_OVERRIDE;
- bool isDefault() const Q_DECL_OVERRIDE;
+ bool isValid() const override;
+ bool isDefault() const override;
- QPrint::DeviceState state() const Q_DECL_OVERRIDE;
+ QPrint::DeviceState state() const override;
- QPageSize defaultPageSize() const Q_DECL_OVERRIDE;
+ QPageSize defaultPageSize() const override;
QMarginsF printableMargins(const QPageSize &pageSize, QPageLayout::Orientation orientation,
- int resolution) const Q_DECL_OVERRIDE;
+ int resolution) const override;
- int defaultResolution() const Q_DECL_OVERRIDE;
+ int defaultResolution() const override;
- QPrint::InputSlot defaultInputSlot() const Q_DECL_OVERRIDE;
+ QPrint::InputSlot defaultInputSlot() const override;
- QPrint::OutputBin defaultOutputBin() const Q_DECL_OVERRIDE;
+ QPrint::OutputBin defaultOutputBin() const override;
- QPrint::DuplexMode defaultDuplexMode() const Q_DECL_OVERRIDE;
+ QPrint::DuplexMode defaultDuplexMode() const override;
- QPrint::ColorMode defaultColorMode() const Q_DECL_OVERRIDE;
+ QPrint::ColorMode defaultColorMode() const override;
PMPrinter macPrinter() const;
PMPaper macPaper(const QPageSize &pageSize) const;
protected:
- void loadPageSizes() const Q_DECL_OVERRIDE;
- void loadResolutions() const Q_DECL_OVERRIDE;
- void loadInputSlots() const Q_DECL_OVERRIDE;
- void loadOutputBins() const Q_DECL_OVERRIDE;
- void loadDuplexModes() const Q_DECL_OVERRIDE;
- void loadColorModes() const Q_DECL_OVERRIDE;
- void loadMimeTypes() const Q_DECL_OVERRIDE;
+ void loadPageSizes() const override;
+ void loadResolutions() const override;
+ void loadInputSlots() const override;
+ void loadOutputBins() const override;
+ void loadDuplexModes() const override;
+ void loadColorModes() const override;
+ void loadMimeTypes() const override;
private:
QPageSize createPageSize(const PMPaper &paper) const;
diff --git a/src/plugins/platforms/cocoa/qcocoaprintdevice.mm b/src/plugins/platforms/cocoa/qcocoaprintdevice.mm
index 39fcf285ed..bfe6cd09b6 100644
--- a/src/plugins/platforms/cocoa/qcocoaprintdevice.mm
+++ b/src/plugins/platforms/cocoa/qcocoaprintdevice.mm
@@ -46,6 +46,15 @@ QT_BEGIN_NAMESPACE
#ifndef QT_NO_PRINTER
+// The CUPS PPD APIs were deprecated in CUPS 1.6/macOS 10.8, but
+// as long as we're supporting RHEL 6, which still ships CUPS 1.4
+// we're not going to rewrite this, as we want to share the code
+// between macOS and Linux for the CUPS-bits. See discussion in
+// https://bugreports.qt.io/browse/QTBUG-56545
+#pragma message "Disabling CUPS PPD deprecation warnings. This should be fixed once we drop support for RHEL6 (QTBUG-56545)"
+#pragma clang diagnostic push
+#pragma clang diagnostic ignored "-Wdeprecated-declarations"
+
static QPrint::DuplexMode macToDuplexMode(const PMDuplexMode &mode)
{
if (mode == kPMDuplexTumble)
@@ -474,6 +483,8 @@ PMPaper QCocoaPrintDevice::macPaper(const QPageSize &pageSize) const
return paper;
}
+#pragma clang diagnostic pop
+
#endif // QT_NO_PRINTER
QT_END_NAMESPACE
diff --git a/src/plugins/platforms/cocoa/qcocoaprintersupport.h b/src/plugins/platforms/cocoa/qcocoaprintersupport.h
index a07bf0ec1b..40a638207a 100644
--- a/src/plugins/platforms/cocoa/qcocoaprintersupport.h
+++ b/src/plugins/platforms/cocoa/qcocoaprintersupport.h
@@ -53,12 +53,12 @@ public:
QCocoaPrinterSupport();
~QCocoaPrinterSupport();
- QPrintEngine *createNativePrintEngine(QPrinter::PrinterMode printerMode, const QString &deviceId = QString()) Q_DECL_OVERRIDE;
- QPaintEngine *createPaintEngine(QPrintEngine *, QPrinter::PrinterMode printerMode) Q_DECL_OVERRIDE;
+ QPrintEngine *createNativePrintEngine(QPrinter::PrinterMode printerMode, const QString &deviceId = QString()) override;
+ QPaintEngine *createPaintEngine(QPrintEngine *, QPrinter::PrinterMode printerMode) override;
- QPrintDevice createPrintDevice(const QString &id) Q_DECL_OVERRIDE;
- QStringList availablePrintDeviceIds() const Q_DECL_OVERRIDE;
- QString defaultPrintDeviceId() const Q_DECL_OVERRIDE;
+ QPrintDevice createPrintDevice(const QString &id) override;
+ QStringList availablePrintDeviceIds() const override;
+ QString defaultPrintDeviceId() const override;
};
QT_END_NAMESPACE
diff --git a/src/plugins/platforms/cocoa/qcocoascreen.h b/src/plugins/platforms/cocoa/qcocoascreen.h
index 937002f493..3d59c3de79 100644
--- a/src/plugins/platforms/cocoa/qcocoascreen.h
+++ b/src/plugins/platforms/cocoa/qcocoascreen.h
@@ -56,20 +56,20 @@ public:
// ----------------------------------------------------
// Virtual methods overridden from QPlatformScreen
- QPixmap grabWindow(WId window, int x, int y, int width, int height) const Q_DECL_OVERRIDE;
- QRect geometry() const Q_DECL_OVERRIDE { return m_geometry; }
- QRect availableGeometry() const Q_DECL_OVERRIDE { return m_availableGeometry; }
- int depth() const Q_DECL_OVERRIDE { return m_depth; }
- QImage::Format format() const Q_DECL_OVERRIDE { return m_format; }
- qreal devicePixelRatio() const Q_DECL_OVERRIDE;
- QSizeF physicalSize() const Q_DECL_OVERRIDE { return m_physicalSize; }
- QDpi logicalDpi() const Q_DECL_OVERRIDE { return m_logicalDpi; }
- qreal refreshRate() const Q_DECL_OVERRIDE { return m_refreshRate; }
- QString name() const Q_DECL_OVERRIDE { return m_name; }
- QPlatformCursor *cursor() const Q_DECL_OVERRIDE { return m_cursor; }
- QWindow *topLevelAt(const QPoint &point) const Q_DECL_OVERRIDE;
- QList<QPlatformScreen *> virtualSiblings() const Q_DECL_OVERRIDE { return m_siblings; }
- QPlatformScreen::SubpixelAntialiasingType subpixelAntialiasingTypeHint() const Q_DECL_OVERRIDE;
+ QPixmap grabWindow(WId window, int x, int y, int width, int height) const override;
+ QRect geometry() const override { return m_geometry; }
+ QRect availableGeometry() const override { return m_availableGeometry; }
+ int depth() const override { return m_depth; }
+ QImage::Format format() const override { return m_format; }
+ qreal devicePixelRatio() const override;
+ QSizeF physicalSize() const override { return m_physicalSize; }
+ QDpi logicalDpi() const override { return m_logicalDpi; }
+ qreal refreshRate() const override { return m_refreshRate; }
+ QString name() const override { return m_name; }
+ QPlatformCursor *cursor() const override { return m_cursor; }
+ QWindow *topLevelAt(const QPoint &point) const override;
+ QList<QPlatformScreen *> virtualSiblings() const override { return m_siblings; }
+ QPlatformScreen::SubpixelAntialiasingType subpixelAntialiasingTypeHint() const override;
// ----------------------------------------------------
// Additional methods
@@ -77,16 +77,12 @@ public:
NSScreen *nativeScreen() const;
void updateGeometry();
- QPointF mapToNative(const QPointF &pos) const { return flipCoordinate(pos); }
- QRectF mapToNative(const QRectF &rect) const { return flipCoordinate(rect); }
- QPointF mapFromNative(const QPointF &pos) const { return flipCoordinate(pos); }
- QRectF mapFromNative(const QRectF &rect) const { return flipCoordinate(rect); }
-
static QCocoaScreen *primaryScreen();
-private:
- QPointF flipCoordinate(const QPointF &pos) const;
- QRectF flipCoordinate(const QRectF &rect) const;
+ static CGPoint mapToNative(const QPointF &pos, QCocoaScreen *screen = QCocoaScreen::primaryScreen());
+ static CGRect mapToNative(const QRectF &rect, QCocoaScreen *screen = QCocoaScreen::primaryScreen());
+ static QPointF mapFromNative(CGPoint pos, QCocoaScreen *screen = QCocoaScreen::primaryScreen());
+ static QRectF mapFromNative(CGRect rect, QCocoaScreen *screen = QCocoaScreen::primaryScreen());
public:
int m_screenIndex;
diff --git a/src/plugins/platforms/cocoa/qcocoascreen.mm b/src/plugins/platforms/cocoa/qcocoascreen.mm
index f523873bde..ed1b19cd53 100644
--- a/src/plugins/platforms/cocoa/qcocoascreen.mm
+++ b/src/plugins/platforms/cocoa/qcocoascreen.mm
@@ -75,32 +75,36 @@ NSScreen *QCocoaScreen::nativeScreen() const
return [screens objectAtIndex:m_screenIndex];
}
-/*!
- Flips the Y coordinate of the point between quadrant I and IV.
+static QString displayName(CGDirectDisplayID displayID)
+{
+ QIOType<io_iterator_t> iterator;
+ if (IOServiceGetMatchingServices(kIOMasterPortDefault,
+ IOServiceMatching("IODisplayConnect"), &iterator))
+ return QString();
+
+ QIOType<io_service_t> display;
+ while ((display = IOIteratorNext(iterator)) != 0)
+ {
+ NSDictionary *info = [(__bridge NSDictionary*)IODisplayCreateInfoDictionary(
+ display, kIODisplayOnlyPreferredName) autorelease];
+
+ if ([[info objectForKey:@kDisplayVendorID] longValue] != CGDisplayVendorNumber(displayID))
+ continue;
- The native coordinate system on macOS uses quadrant I, with origin
- in bottom left, and Qt uses quadrant IV, with origin in top left.
+ if ([[info objectForKey:@kDisplayProductID] longValue] != CGDisplayModelNumber(displayID))
+ continue;
- By flippig the Y coordinate, we can map the position between the
- two coordinate systems.
-*/
-QPointF QCocoaScreen::flipCoordinate(const QPointF &pos) const
-{
- return QPointF(pos.x(), m_geometry.height() - pos.y());
-}
+ if ([[info objectForKey:@kDisplaySerialNumber] longValue] != CGDisplaySerialNumber(displayID))
+ continue;
-/*!
- Flips the Y coordinate of the rectangle between quadrant I and IV.
+ NSDictionary *localizedNames = [info objectForKey:@kDisplayProductName];
+ if (![localizedNames count])
+ break; // Correct screen, but no name in dictionary
- The native coordinate system on macOS uses quadrant I, with origin
- in bottom left, and Qt uses quadrant IV, with origin in top left.
+ return QString::fromNSString([localizedNames objectForKey:[[localizedNames allKeys] objectAtIndex:0]]);
+ }
- By flippig the Y coordinate, we can map the rectangle between the
- two coordinate systems.
-*/
-QRectF QCocoaScreen::flipCoordinate(const QRectF &rect) const
-{
- return QRectF(flipCoordinate(rect.topLeft() + QPoint(0, rect.height())), rect.size());
+ return QString();
}
void QCocoaScreen::updateGeometry()
@@ -109,20 +113,10 @@ void QCocoaScreen::updateGeometry()
if (!nsScreen)
return;
- // At this point the geometry is in native coordinates, but the size
- // is correct, which we take advantage of next when we map the native
- // coordinates to the Qt coordinate system.
- m_geometry = QRectF::fromCGRect(NSRectToCGRect(nsScreen.frame)).toRect();
- m_availableGeometry = QRectF::fromCGRect(NSRectToCGRect(nsScreen.visibleFrame)).toRect();
-
- // The reference screen for the geometry is always the primary screen, but since
- // we may be in the process of creating and registering the primary screen, we
- // must special-case that and assign it direcly.
- QCocoaScreen *primaryScreen = (nsScreen == [[NSScreen screens] firstObject]) ?
- this : QCocoaScreen::primaryScreen();
-
- m_geometry = primaryScreen->mapFromNative(m_geometry).toRect();
- m_availableGeometry = primaryScreen->mapFromNative(m_availableGeometry).toRect();
+ // The reference screen for the geometry is always the primary screen
+ QRectF primaryScreenGeometry = QRectF::fromCGRect([[NSScreen screens] firstObject].frame);
+ m_geometry = qt_mac_flip(QRectF::fromCGRect(nsScreen.frame), primaryScreenGeometry).toRect();
+ m_availableGeometry = qt_mac_flip(QRectF::fromCGRect(nsScreen.visibleFrame), primaryScreenGeometry).toRect();
m_format = QImage::Format_RGB32;
m_depth = NSBitsPerPixelFromDepth([nsScreen depth]);
@@ -139,12 +133,7 @@ void QCocoaScreen::updateGeometry()
if (refresh > 0)
m_refreshRate = refresh;
- // Get m_name (brand/model of the monitor)
- NSDictionary *deviceInfo = (NSDictionary *)IODisplayCreateInfoDictionary(CGDisplayIOServicePort(dpy), kIODisplayOnlyPreferredName);
- NSDictionary *localizedNames = [deviceInfo objectForKey:[NSString stringWithUTF8String:kDisplayProductName]];
- if ([localizedNames count] > 0)
- m_name = QString::fromUtf8([[localizedNames objectForKey:[[localizedNames allKeys] objectAtIndex:0]] UTF8String]);
- [deviceInfo release];
+ m_name = displayName(dpy);
QWindowSystemInterface::handleScreenGeometryChange(screen(), geometry(), availableGeometry());
QWindowSystemInterface::handleScreenLogicalDotsPerInchChange(screen(), m_logicalDpi.first, m_logicalDpi.second);
@@ -170,7 +159,7 @@ QPlatformScreen::SubpixelAntialiasingType QCocoaScreen::subpixelAntialiasingType
QWindow *QCocoaScreen::topLevelAt(const QPoint &point) const
{
- NSPoint screenPoint = qt_mac_flipPoint(point);
+ NSPoint screenPoint = mapToNative(point);
// Search (hit test) for the top-level window. [NSWidow windowNumberAtPoint:
// belowWindowWithWindowNumber] may return windows that are not interesting
@@ -275,6 +264,30 @@ QCocoaScreen *QCocoaScreen::primaryScreen()
return static_cast<QCocoaScreen *>(QGuiApplication::primaryScreen()->handle());
}
+CGPoint QCocoaScreen::mapToNative(const QPointF &pos, QCocoaScreen *screen)
+{
+ Q_ASSERT(screen);
+ return qt_mac_flip(pos, screen->geometry()).toCGPoint();
+}
+
+CGRect QCocoaScreen::mapToNative(const QRectF &rect, QCocoaScreen *screen)
+{
+ Q_ASSERT(screen);
+ return qt_mac_flip(rect, screen->geometry()).toCGRect();
+}
+
+QPointF QCocoaScreen::mapFromNative(CGPoint pos, QCocoaScreen *screen)
+{
+ Q_ASSERT(screen);
+ return qt_mac_flip(QPointF::fromCGPoint(pos), screen->geometry());
+}
+
+QRectF QCocoaScreen::mapFromNative(CGRect rect, QCocoaScreen *screen)
+{
+ Q_ASSERT(screen);
+ return qt_mac_flip(QRectF::fromCGRect(rect), screen->geometry());
+}
+
#ifndef QT_NO_DEBUG_STREAM
QDebug operator<<(QDebug debug, const QCocoaScreen *screen)
{
diff --git a/src/plugins/platforms/cocoa/qcocoaservices.h b/src/plugins/platforms/cocoa/qcocoaservices.h
index c2ceede0f0..62a8891f96 100644
--- a/src/plugins/platforms/cocoa/qcocoaservices.h
+++ b/src/plugins/platforms/cocoa/qcocoaservices.h
@@ -47,8 +47,8 @@ QT_BEGIN_NAMESPACE
class QCocoaServices : public QPlatformServices
{
public:
- bool openUrl(const QUrl &url) Q_DECL_OVERRIDE;
- bool openDocument(const QUrl &url) Q_DECL_OVERRIDE;
+ bool openUrl(const QUrl &url) override;
+ bool openDocument(const QUrl &url) override;
};
QT_END_NAMESPACE
diff --git a/src/plugins/platforms/cocoa/qcocoasystemtrayicon.h b/src/plugins/platforms/cocoa/qcocoasystemtrayicon.h
index d542a3cb8f..2f1a1e42a9 100644
--- a/src/plugins/platforms/cocoa/qcocoasystemtrayicon.h
+++ b/src/plugins/platforms/cocoa/qcocoasystemtrayicon.h
@@ -57,17 +57,17 @@ class Q_GUI_EXPORT QCocoaSystemTrayIcon : public QPlatformSystemTrayIcon
public:
QCocoaSystemTrayIcon() : m_sys(0) {}
- void init() Q_DECL_OVERRIDE;
- void cleanup() Q_DECL_OVERRIDE;
- void updateIcon(const QIcon &icon) Q_DECL_OVERRIDE;
- void updateToolTip(const QString &toolTip) Q_DECL_OVERRIDE;
- void updateMenu(QPlatformMenu *menu) Q_DECL_OVERRIDE;
- QRect geometry() const Q_DECL_OVERRIDE;
+ void init() override;
+ void cleanup() override;
+ void updateIcon(const QIcon &icon) override;
+ void updateToolTip(const QString &toolTip) override;
+ void updateMenu(QPlatformMenu *menu) override;
+ QRect geometry() const override;
void showMessage(const QString &title, const QString &msg,
- const QIcon& icon, MessageIcon iconType, int secs) Q_DECL_OVERRIDE;
+ const QIcon& icon, MessageIcon iconType, int secs) override;
- bool isSystemTrayAvailable() const Q_DECL_OVERRIDE;
- bool supportsMessages() const Q_DECL_OVERRIDE;
+ bool isSystemTrayAvailable() const override;
+ bool supportsMessages() const override;
private:
QSystemTrayIconSys *m_sys;
diff --git a/src/plugins/platforms/cocoa/qcocoatheme.h b/src/plugins/platforms/cocoa/qcocoatheme.h
index 27c071a8cd..69eaf8db56 100644
--- a/src/plugins/platforms/cocoa/qcocoatheme.h
+++ b/src/plugins/platforms/cocoa/qcocoatheme.h
@@ -56,25 +56,25 @@ public:
void reset();
- QPlatformMenuItem* createPlatformMenuItem() const Q_DECL_OVERRIDE;
- QPlatformMenu* createPlatformMenu() const Q_DECL_OVERRIDE;
- QPlatformMenuBar* createPlatformMenuBar() const Q_DECL_OVERRIDE;
+ QPlatformMenuItem* createPlatformMenuItem() const override;
+ QPlatformMenu* createPlatformMenu() const override;
+ QPlatformMenuBar* createPlatformMenuBar() const override;
#ifndef QT_NO_SYSTEMTRAYICON
- QPlatformSystemTrayIcon *createPlatformSystemTrayIcon() const Q_DECL_OVERRIDE;
+ QPlatformSystemTrayIcon *createPlatformSystemTrayIcon() const override;
#endif
- bool usePlatformNativeDialog(DialogType dialogType) const Q_DECL_OVERRIDE;
- QPlatformDialogHelper *createPlatformDialogHelper(DialogType dialogType) const Q_DECL_OVERRIDE;
+ bool usePlatformNativeDialog(DialogType dialogType) const override;
+ QPlatformDialogHelper *createPlatformDialogHelper(DialogType dialogType) const override;
- const QPalette *palette(Palette type = SystemPalette) const Q_DECL_OVERRIDE;
- const QFont *font(Font type = SystemFont) const Q_DECL_OVERRIDE;
- QPixmap standardPixmap(StandardPixmap sp, const QSizeF &size) const Q_DECL_OVERRIDE;
+ const QPalette *palette(Palette type = SystemPalette) const override;
+ const QFont *font(Font type = SystemFont) const override;
+ QPixmap standardPixmap(StandardPixmap sp, const QSizeF &size) const override;
QIcon fileIcon(const QFileInfo &fileInfo, QPlatformTheme::IconOptions options = 0) const override;
- QVariant themeHint(ThemeHint hint) const Q_DECL_OVERRIDE;
- QString standardButtonText(int button) const Q_DECL_OVERRIDE;
- QKeySequence standardButtonShortcut(int button) const Q_DECL_OVERRIDE;
+ QVariant themeHint(ThemeHint hint) const override;
+ QString standardButtonText(int button) const override;
+ QKeySequence standardButtonShortcut(int button) const override;
static const char *name;
diff --git a/src/plugins/platforms/cocoa/qcocoatheme.mm b/src/plugins/platforms/cocoa/qcocoatheme.mm
index 5239864ad8..2aab5fd545 100644
--- a/src/plugins/platforms/cocoa/qcocoatheme.mm
+++ b/src/plugins/platforms/cocoa/qcocoatheme.mm
@@ -98,7 +98,7 @@ QT_NAMESPACE_ALIAS_OBJC_CLASS(QCocoaThemeNotificationReceiver);
{
Q_UNUSED(notification);
mPrivate->reset();
- QWindowSystemInterface::handleThemeChange(Q_NULLPTR);
+ QWindowSystemInterface::handleThemeChange(nullptr);
}
@end
@@ -127,7 +127,7 @@ QCocoaTheme::~QCocoaTheme()
void QCocoaTheme::reset()
{
delete m_systemPalette;
- m_systemPalette = Q_NULLPTR;
+ m_systemPalette = nullptr;
qDeleteAll(m_palettes);
m_palettes.clear();
}
@@ -275,7 +275,7 @@ QPixmap QCocoaTheme::standardPixmap(StandardPixmap sp, const QSizeF &size) const
}
if (iconType != 0) {
QPixmap pixmap;
- IconRef icon = Q_NULLPTR;
+ IconRef icon = nullptr;
GetIconRef(kOnSystemDisk, kSystemIconsCreator, iconType, &icon);
if (icon) {
diff --git a/src/plugins/platforms/cocoa/qcocoawindow.h b/src/plugins/platforms/cocoa/qcocoawindow.h
index 6fbe29f683..fb91c53a7a 100644
--- a/src/plugins/platforms/cocoa/qcocoawindow.h
+++ b/src/plugins/platforms/cocoa/qcocoawindow.h
@@ -97,37 +97,37 @@ public:
void initialize() override;
- void setGeometry(const QRect &rect) Q_DECL_OVERRIDE;
- QRect geometry() const Q_DECL_OVERRIDE;
+ void setGeometry(const QRect &rect) override;
+ QRect geometry() const override;
void setCocoaGeometry(const QRect &rect);
- void setVisible(bool visible) Q_DECL_OVERRIDE;
- void setWindowFlags(Qt::WindowFlags flags) Q_DECL_OVERRIDE;
- void setWindowState(Qt::WindowStates state) Q_DECL_OVERRIDE;
- void setWindowTitle(const QString &title) Q_DECL_OVERRIDE;
- void setWindowFilePath(const QString &filePath) Q_DECL_OVERRIDE;
- void setWindowIcon(const QIcon &icon) Q_DECL_OVERRIDE;
- void setAlertState(bool enabled) Q_DECL_OVERRIDE;
- bool isAlertState() const Q_DECL_OVERRIDE;
- void raise() Q_DECL_OVERRIDE;
- void lower() Q_DECL_OVERRIDE;
- bool isExposed() const Q_DECL_OVERRIDE;
+ void setVisible(bool visible) override;
+ void setWindowFlags(Qt::WindowFlags flags) override;
+ void setWindowState(Qt::WindowStates state) override;
+ void setWindowTitle(const QString &title) override;
+ void setWindowFilePath(const QString &filePath) override;
+ void setWindowIcon(const QIcon &icon) override;
+ void setAlertState(bool enabled) override;
+ bool isAlertState() const override;
+ void raise() override;
+ void lower() override;
+ bool isExposed() const override;
bool isOpaque() const;
- void propagateSizeHints() Q_DECL_OVERRIDE;
- void setOpacity(qreal level) Q_DECL_OVERRIDE;
- void setMask(const QRegion &region) Q_DECL_OVERRIDE;
- bool setKeyboardGrabEnabled(bool grab) Q_DECL_OVERRIDE;
- bool setMouseGrabEnabled(bool grab) Q_DECL_OVERRIDE;
- QMargins frameMargins() const Q_DECL_OVERRIDE;
- QSurfaceFormat format() const Q_DECL_OVERRIDE;
+ void propagateSizeHints() override;
+ void setOpacity(qreal level) override;
+ void setMask(const QRegion &region) override;
+ bool setKeyboardGrabEnabled(bool grab) override;
+ bool setMouseGrabEnabled(bool grab) override;
+ QMargins frameMargins() const override;
+ QSurfaceFormat format() const override;
- bool isForeignWindow() const Q_DECL_OVERRIDE;
+ bool isForeignWindow() const override;
void requestUpdate() override;
- void requestActivateWindow() Q_DECL_OVERRIDE;
+ void requestActivateWindow() override;
- WId winId() const Q_DECL_OVERRIDE;
- void setParent(const QPlatformWindow *window) Q_DECL_OVERRIDE;
+ WId winId() const override;
+ void setParent(const QPlatformWindow *window) override;
NSView *view() const;
NSWindow *nativeWindow() const;
@@ -167,10 +167,10 @@ public:
QCocoaGLContext *currentContext() const;
#endif
- bool setWindowModified(bool modified) Q_DECL_OVERRIDE;
+ bool setWindowModified(bool modified) override;
- void setFrameStrutEventsEnabled(bool enabled) Q_DECL_OVERRIDE;
- bool frameStrutEventsEnabled() const Q_DECL_OVERRIDE
+ void setFrameStrutEventsEnabled(bool enabled) override;
+ bool frameStrutEventsEnabled() const override
{ return m_frameStrutEventsEnabled; }
void setMenubar(QCocoaMenuBar *mb);
@@ -187,7 +187,7 @@ public:
void applyContentBorderThickness(NSWindow *window = nullptr);
void updateNSToolbar();
- qreal devicePixelRatio() const Q_DECL_OVERRIDE;
+ qreal devicePixelRatio() const override;
QWindow *childWindowAt(QPoint windowPoint);
bool shouldRefuseKeyWindowAndFirstResponder();
@@ -209,8 +209,6 @@ protected:
void recreateWindowIfNeeded();
QCocoaNSWindow *createNSWindow(bool shouldBePanel);
- QRect nativeWindowGeometry() const;
-
Qt::WindowState windowState() const;
void applyWindowState(Qt::WindowStates newState);
void toggleMaximized();
diff --git a/src/plugins/platforms/cocoa/qcocoawindow.mm b/src/plugins/platforms/cocoa/qcocoawindow.mm
index e86cc2d955..c000c90a85 100644
--- a/src/plugins/platforms/cocoa/qcocoawindow.mm
+++ b/src/plugins/platforms/cocoa/qcocoawindow.mm
@@ -287,7 +287,7 @@ QRect QCocoaWindow::geometry() const
NSPoint windowPoint = [m_view convertPoint:NSMakePoint(0, 0) toView:nil];
NSRect screenRect = [[m_view window] convertRectToScreen:NSMakeRect(windowPoint.x, windowPoint.y, 1, 1)];
NSPoint screenPoint = screenRect.origin;
- QPoint position = qt_mac_flipPoint(screenPoint).toPoint();
+ QPoint position = QCocoaScreen::mapFromNative(screenPoint).toPoint();
QSize size = QRectF::fromCGRect(NSRectToCGRect([m_view bounds])).toRect().size();
return QRect(position, size);
}
@@ -310,7 +310,7 @@ void QCocoaWindow::setCocoaGeometry(const QRect &rect)
}
if (isContentView()) {
- NSRect bounds = qt_mac_flipRect(rect);
+ NSRect bounds = QCocoaScreen::mapToNative(rect);
[m_view.window setFrame:[m_view.window frameRectForContentRect:bounds] display:YES animate:NO];
} else {
[m_view setFrame:NSMakeRect(rect.x(), rect.y(), rect.width(), rect.height())];
@@ -403,7 +403,7 @@ void QCocoaWindow::setVisible(bool visible)
if (!(parentCocoaWindow && window()->transientParent()->isActive()) && window()->type() == Qt::Popup) {
removeMonitor();
monitor = [NSEvent addGlobalMonitorForEventsMatchingMask:NSLeftMouseDownMask|NSRightMouseDownMask|NSOtherMouseDownMask|NSMouseMovedMask handler:^(NSEvent *e) {
- QPointF localPoint = qt_mac_flipPoint([NSEvent mouseLocation]);
+ QPointF localPoint = QCocoaScreen::mapFromNative([NSEvent mouseLocation]);
QWindowSystemInterface::handleMouseEvent(window(), window()->mapFromGlobal(localPoint.toPoint()), localPoint,
cocoaButton2QtButton([e buttonNumber]));
}];
@@ -1116,7 +1116,7 @@ void QCocoaWindow::handleGeometryChange()
CGRect contentRect = [m_view.window contentRectForFrameRect:m_view.window.frame];
// The result above is in native screen coordinates, so remap to the Qt coordinate system
- newGeometry = QCocoaScreen::primaryScreen()->mapFromNative(QRectF::fromCGRect(contentRect)).toRect();
+ newGeometry = QCocoaScreen::mapFromNative(contentRect).toRect();
} else {
// QNSView has isFlipped set, so no need to remap the geometry
newGeometry = QRectF::fromCGRect(m_view.frame).toRect();
@@ -1378,7 +1378,7 @@ QCocoaNSWindow *QCocoaWindow::createNSWindow(bool shouldBePanel)
rect.translate(-targetScreen->geometry().topLeft());
QCocoaScreen *cocoaScreen = static_cast<QCocoaScreen *>(targetScreen->handle());
- NSRect frame = NSRectFromCGRect(cocoaScreen->mapToNative(rect).toCGRect());
+ NSRect frame = QCocoaScreen::mapToNative(rect, cocoaScreen);
// Note: The macOS window manager has a bug, where if a screen is rotated, it will not allow
// a window to be created within the area of the screen that has a Y coordinate (I quadrant)
@@ -1474,19 +1474,6 @@ void QCocoaWindow::removeMonitor()
monitor = nil;
}
-// Returns the current global screen geometry for the nswindow associated with this window.
-QRect QCocoaWindow::nativeWindowGeometry() const
-{
- if (!isContentView())
- return geometry();
-
- NSRect rect = m_view.window.frame;
- QPlatformScreen *onScreen = QPlatformScreen::platformScreenForWindow(window());
- int flippedY = onScreen->geometry().height() - rect.origin.y - rect.size.height; // account for nswindow inverted y.
- QRect qRect = QRect(rect.origin.x, flippedY, rect.size.width, rect.size.height);
- return qRect;
-}
-
/*!
Applies the given state to the NSWindow, going in/out of minimize/zoomed/fullscreen
diff --git a/src/plugins/platforms/cocoa/qmultitouch_mac.mm b/src/plugins/platforms/cocoa/qmultitouch_mac.mm
index 79f8af7783..9eca4d2d43 100644
--- a/src/plugins/platforms/cocoa/qmultitouch_mac.mm
+++ b/src/plugins/platforms/cocoa/qmultitouch_mac.mm
@@ -39,6 +39,7 @@
#include "qmultitouch_mac_p.h"
#include "qcocoahelpers.h"
+#include "qcocoascreen.h"
#include <private/qtouchdevice_p.h>
QT_BEGIN_NAMESPACE
@@ -83,7 +84,7 @@ void QCocoaTouch::updateTouchData(NSTouch *nstouch, NSTouchPhase phase)
if (_touchPoint.id == 0 && phase == NSTouchPhaseBegan) {
_trackpadReferencePos = qnpos;
- _screenReferencePos = qt_mac_flipPoint([NSEvent mouseLocation]);
+ _screenReferencePos = QCocoaScreen::mapFromNative([NSEvent mouseLocation]);
}
QPointF screenPos = _screenReferencePos;
diff --git a/src/plugins/platforms/cocoa/qnsview.mm b/src/plugins/platforms/cocoa/qnsview.mm
index c888551729..33f9527213 100644
--- a/src/plugins/platforms/cocoa/qnsview.mm
+++ b/src/plugins/platforms/cocoa/qnsview.mm
@@ -42,6 +42,7 @@
#include "qnsview.h"
#include "qcocoawindow.h"
#include "qcocoahelpers.h"
+#include "qcocoascreen.h"
#include "qmultitouch_mac_p.h"
#include "qcocoadrag.h"
#include "qcocoainputcontext.h"
@@ -442,8 +443,7 @@ Q_LOGGING_CATEGORY(lcQpaTablet, "qt.qpa.input.tablet")
nsWindowPoint = windowRect.origin; // NSWindow coordinates
NSPoint nsViewPoint = [self convertPoint: nsWindowPoint fromView: nil]; // NSView/QWindow coordinates
*qtWindowPoint = QPointF(nsViewPoint.x, nsViewPoint.y); // NSView/QWindow coordinates
-
- *qtScreenPoint = QPointF(mouseLocation.x, qt_mac_flipYCoordinate(mouseLocation.y)); // Qt screen coordinates
+ *qtScreenPoint = QCocoaScreen::mapFromNative(mouseLocation);
}
- (void)resetMouseButtons
@@ -554,7 +554,7 @@ Q_LOGGING_CATEGORY(lcQpaTablet, "qt.qpa.input.tablet")
NSPoint nsViewPoint = [self convertPoint: windowPoint fromView: nil];
QPoint qtWindowPoint = QPoint(nsViewPoint.x, titleBarHeight + nsViewPoint.y);
NSPoint screenPoint = [window convertRectToScreen:NSMakeRect(windowPoint.x, windowPoint.y, 0, 0)].origin;
- QPoint qtScreenPoint = QPoint(screenPoint.x, qt_mac_flipYCoordinate(screenPoint.y));
+ QPoint qtScreenPoint = QCocoaScreen::mapFromNative(screenPoint).toPoint();
ulong timestamp = [theEvent timestamp] * 1000;
QWindowSystemInterface::handleFrameStrutMouseEvent(m_platformWindow->window(), timestamp, qtWindowPoint, qtScreenPoint, m_frameStrutButtons);
@@ -646,7 +646,7 @@ Q_LOGGING_CATEGORY(lcQpaTablet, "qt.qpa.input.tablet")
if (!popups->isEmpty()) {
// Check if the click is outside all popups.
bool inside = false;
- QPointF qtScreenPoint = qt_mac_flipPoint([self screenMousePoint:theEvent]);
+ QPointF qtScreenPoint = QCocoaScreen::mapFromNative([self screenMousePoint:theEvent]);
for (QList<QCocoaWindow *>::const_iterator it = popups->begin(); it != popups->end(); ++it) {
if ((*it)->geometry().contains(qtScreenPoint.toPoint())) {
inside = true;
@@ -1736,14 +1736,8 @@ static QTabletEvent::TabletDevice wacomTabletDevice(NSEvent *theEvent)
// The returned rect is always based on the internal cursor.
QRect mr = qApp->inputMethod()->cursorRectangle().toRect();
- QPoint mp = m_platformWindow->window()->mapToGlobal(mr.bottomLeft());
-
- NSRect rect;
- rect.origin.x = mp.x();
- rect.origin.y = qt_mac_flipYCoordinate(mp.y());
- rect.size.width = mr.width();
- rect.size.height = mr.height();
- return rect;
+ mr.moveBottomLeft(m_platformWindow->window()->mapToGlobal(mr.bottomLeft()));
+ return QCocoaScreen::mapToNative(mr);
}
- (NSUInteger)characterIndexForPoint:(NSPoint)aPoint
@@ -2029,8 +2023,7 @@ static QPoint mapWindowCoordinates(QWindow *source, QWindow *target, QPoint poin
NSPoint windowPoint = [self.window convertRectFromScreen:NSMakeRect(screenPoint.x, screenPoint.y, 1, 1)].origin;
NSPoint nsViewPoint = [self convertPoint: windowPoint fromView: nil]; // NSView/QWindow coordinates
QPoint qtWindowPoint(nsViewPoint.x, nsViewPoint.y);
-
- QPoint qtScreenPoint = QPoint(screenPoint.x, qt_mac_flipYCoordinate(screenPoint.y));
+ QPoint qtScreenPoint = QCocoaScreen::mapFromNative(screenPoint).toPoint();
QWindowSystemInterface::handleMouseEvent(target, mapWindowCoordinates(m_platformWindow->window(), target, qtWindowPoint), qtScreenPoint, m_buttons);
}
diff --git a/src/plugins/platforms/cocoa/qpaintengine_mac.mm b/src/plugins/platforms/cocoa/qpaintengine_mac.mm
index 7e241e3ae6..3f363b62d5 100644
--- a/src/plugins/platforms/cocoa/qpaintengine_mac.mm
+++ b/src/plugins/platforms/cocoa/qpaintengine_mac.mm
@@ -108,7 +108,7 @@ CGAffineTransform qt_mac_convert_transform_to_cg(const QTransform &t) {
return CGAffineTransformMake(t.m11(), t.m12(), t.m21(), t.m22(), t.dx(), t.dy());
}
-inline static QCFType<CGColorRef> cgColorForQColor(const QColor &col, QPaintDevice *pdev)
+inline static QCFType<CGColorRef> cgColorForQColor(const QColor &col)
{
CGFloat components[] = {
qt_mac_convert_color_to_cg(col.red()),
@@ -116,7 +116,8 @@ inline static QCFType<CGColorRef> cgColorForQColor(const QColor &col, QPaintDevi
qt_mac_convert_color_to_cg(col.blue()),
qt_mac_convert_color_to_cg(col.alpha())
};
- return CGColorCreate(qt_mac_colorSpaceForDeviceType(pdev), components);
+ QCFType<CGColorSpaceRef> colorSpace = CGColorSpaceCreateWithName(kCGColorSpaceSRGB);
+ return CGColorCreate(colorSpace, components);
}
// There's architectural problems with using native gradients
@@ -239,81 +240,6 @@ static CGMutablePathRef qt_mac_compose_path(const QPainterPath &p, float off=0)
return ret;
}
-CGColorSpaceRef QCoreGraphicsPaintEngine::m_genericColorSpace = 0;
-QHash<CGDirectDisplayID, CGColorSpaceRef> QCoreGraphicsPaintEngine::m_displayColorSpaceHash;
-bool QCoreGraphicsPaintEngine::m_postRoutineRegistered = false;
-
-CGColorSpaceRef QCoreGraphicsPaintEngine::macGenericColorSpace()
-{
-#if 0
- if (!m_genericColorSpace) {
- if (QSysInfo::MacintoshVersion >= QSysInfo::MV_10_4) {
- m_genericColorSpace = CGColorSpaceCreateWithName(kCGColorSpaceGenericRGB);
- } else
- {
- m_genericColorSpace = CGColorSpaceCreateDeviceRGB();
- }
- if (!m_postRoutineRegistered) {
- m_postRoutineRegistered = true;
- qAddPostRoutine(QCoreGraphicsPaintEngine::cleanUpMacColorSpaces);
- }
- }
- return m_genericColorSpace;
-#else
- // Just return the main display colorspace for the moment.
- return macDisplayColorSpace();
-#endif
-}
-
-/*
- Ideally, we should pass the widget in here, and use CGGetDisplaysWithRect() etc.
- to support multiple displays correctly.
-*/
-CGColorSpaceRef QCoreGraphicsPaintEngine::macDisplayColorSpace(const QWidget *widget)
-{
- CGColorSpaceRef colorSpace;
-
- CGDirectDisplayID displayID;
- if (widget == 0) {
- displayID = CGMainDisplayID();
- } else {
- const QRect &qrect = widget->window()->geometry();
- CGRect rect = CGRectMake(qrect.x(), qrect.y(), qrect.width(), qrect.height());
- CGDisplayCount throwAway;
- CGDisplayErr dErr = CGGetDisplaysWithRect(rect, 1, &displayID, &throwAway);
- if (dErr != kCGErrorSuccess)
- return macDisplayColorSpace(0); // fall back on main display
- }
- if ((colorSpace = m_displayColorSpaceHash.value(displayID)))
- return colorSpace;
-
- colorSpace = CGDisplayCopyColorSpace(displayID);
- if (colorSpace == 0)
- colorSpace = CGColorSpaceCreateDeviceRGB();
-
- m_displayColorSpaceHash.insert(displayID, colorSpace);
- if (!m_postRoutineRegistered) {
- m_postRoutineRegistered = true;
- qAddPostRoutine(QCoreGraphicsPaintEngine::cleanUpMacColorSpaces);
- }
- return colorSpace;
-}
-
-void QCoreGraphicsPaintEngine::cleanUpMacColorSpaces()
-{
- if (m_genericColorSpace) {
- CFRelease(m_genericColorSpace);
- m_genericColorSpace = 0;
- }
- QHash<CGDirectDisplayID, CGColorSpaceRef>::const_iterator it = m_displayColorSpaceHash.constBegin();
- while (it != m_displayColorSpaceHash.constEnd()) {
- if (it.value())
- CFRelease(it.value());
- ++it;
- }
- m_displayColorSpaceHash.clear();
-}
-
//pattern handling (tiling)
#if 1
# define QMACPATTERN_MASK_MULTIPLIER 32
@@ -377,7 +303,7 @@ static void qt_mac_draw_pattern(void *info, CGContextRef c)
QPixmap pm(w*QMACPATTERN_MASK_MULTIPLIER, h*QMACPATTERN_MASK_MULTIPLIER);
pm.fill(c0);
QMacCGContext pm_ctx(&pm);
- CGContextSetFillColorWithColor(c, cgColorForQColor(c1, pat->pdev));
+ CGContextSetFillColorWithColor(c, cgColorForQColor(c1));
CGRect rect = CGRectMake(0, 0, w, h);
for (int x = 0; x < QMACPATTERN_MASK_MULTIPLIER; ++x) {
rect.origin.x = x * w;
@@ -409,7 +335,7 @@ static void qt_mac_draw_pattern(void *info, CGContextRef c)
bool needRestore = false;
if (CGImageIsMask(pat->image)) {
CGContextSaveGState(c);
- CGContextSetFillColorWithColor(c, cgColorForQColor(pat->foreground, pat->pdev));
+ CGContextSetFillColorWithColor(c, cgColorForQColor(pat->foreground));
}
CGRect rect = CGRectMake(0, 0, w, h);
qt_mac_drawCGImage(c, &rect, pat->image);
@@ -871,7 +797,7 @@ void QCoreGraphicsPaintEngine::drawPixmap(const QRectF &r, const QPixmap &pm, co
d->saveGraphicsState();
const QColor &col = d->current.pen.color();
- CGContextSetFillColorWithColor(d->hd, cgColorForQColor(col, d->pdev));
+ CGContextSetFillColorWithColor(d->hd, cgColorForQColor(col));
image = qt_mac_create_imagemask(pm, sr);
} else if (differentSize) {
QCFType<CGImageRef> img = qt_mac_toCGImage(pm.toImage());
@@ -1233,7 +1159,7 @@ QCoreGraphicsPaintEnginePrivate::setStrokePen(const QPen &pen)
CGContextSetLineDash(hd, pen.dashOffset() * cglinewidth, linedashes.data(), linedashes.size());
// color
- CGContextSetStrokeColorWithColor(hd, cgColorForQColor(pen.color(), pdev));
+ CGContextSetStrokeColorWithColor(hd, cgColorForQColor(pen.color()));
}
// Add our own patterns here to deal with the fact that the coordinate system
@@ -1276,7 +1202,7 @@ void QCoreGraphicsPaintEnginePrivate::setFillBrush(const QPointF &offset)
CGFunctionRef fill_func = CGFunctionCreate(reinterpret_cast<void *>(&current.brush),
1, domain, 4, 0, &callbacks);
- CGColorSpaceRef colorspace = qt_mac_colorSpaceForDeviceType(pdev);
+ CGColorSpaceRef colorspace = CGColorSpaceCreateWithName(kCGColorSpaceSRGB)
if (bs == Qt::LinearGradientPattern) {
const QLinearGradient *linearGrad = static_cast<const QLinearGradient *>(grad);
const QPointF start(linearGrad->start());
@@ -1315,7 +1241,7 @@ void QCoreGraphicsPaintEnginePrivate::setFillBrush(const QPointF &offset)
components[0] = qt_mac_convert_color_to_cg(col.red());
components[1] = qt_mac_convert_color_to_cg(col.green());
components[2] = qt_mac_convert_color_to_cg(col.blue());
- base_colorspace = QCoreGraphicsPaintEngine::macGenericColorSpace();
+ base_colorspace = CGColorSpaceCreateWithName(kCGColorSpaceSRGB);
}
} else {
qpattern->as_mask = true;
@@ -1325,7 +1251,7 @@ void QCoreGraphicsPaintEnginePrivate::setFillBrush(const QPointF &offset)
components[0] = qt_mac_convert_color_to_cg(col.red());
components[1] = qt_mac_convert_color_to_cg(col.green());
components[2] = qt_mac_convert_color_to_cg(col.blue());
- base_colorspace = QCoreGraphicsPaintEngine::macGenericColorSpace();
+ base_colorspace = CGColorSpaceCreateWithName(kCGColorSpaceSRGB);
}
int width = qpattern->width(), height = qpattern->height();
qpattern->foreground = current.brush.color();
@@ -1346,10 +1272,12 @@ void QCoreGraphicsPaintEnginePrivate::setFillBrush(const QPointF &offset)
!base_colorspace, &callbks);
CGContextSetFillPattern(hd, fill_pattern, components);
+
CGPatternRelease(fill_pattern);
+ CGColorSpaceRelease(base_colorspace);
CGColorSpaceRelease(fill_colorspace);
} else if (bs != Qt::NoBrush) {
- CGContextSetFillColorWithColor(hd, cgColorForQColor(current.brush.color(), pdev));
+ CGContextSetFillColorWithColor(hd, cgColorForQColor(current.brush.color()));
}
}
diff --git a/src/plugins/platforms/cocoa/qpaintengine_mac_p.h b/src/plugins/platforms/cocoa/qpaintengine_mac_p.h
index 57d985c399..c9519ac827 100644
--- a/src/plugins/platforms/cocoa/qpaintengine_mac_p.h
+++ b/src/plugins/platforms/cocoa/qpaintengine_mac_p.h
@@ -73,8 +73,6 @@ public:
bool begin(QPaintDevice *pdev);
bool end();
- static CGColorSpaceRef macGenericColorSpace();
- static CGColorSpaceRef macDisplayColorSpace(const QWidget *widget = 0);
void updateState(const QPaintEngineState &state);
@@ -126,10 +124,6 @@ protected:
QCoreGraphicsPaintEngine(QPaintEnginePrivate &dptr);
private:
- static bool m_postRoutineRegistered;
- static CGColorSpaceRef m_genericColorSpace;
- static QHash<CGDirectDisplayID, CGColorSpaceRef> m_displayColorSpaceHash;
- static void cleanUpMacColorSpaces();
Q_DISABLE_COPY(QCoreGraphicsPaintEngine)
};
diff --git a/src/plugins/platforms/cocoa/qprintengine_mac.mm b/src/plugins/platforms/cocoa/qprintengine_mac.mm
index c39af870d4..b3d48c1ec3 100644
--- a/src/plugins/platforms/cocoa/qprintengine_mac.mm
+++ b/src/plugins/platforms/cocoa/qprintengine_mac.mm
@@ -247,7 +247,7 @@ void QMacPrintEnginePrivate::initialize()
QList<int> resolutions = m_printDevice->supportedResolutions();
if (!resolutions.isEmpty() && mode != QPrinter::ScreenResolution) {
- qSort(resolutions);
+ std::sort(resolutions.begin(), resolutions.end());
if (resolutions.count() > 1 && mode == QPrinter::HighResolution)
resolution.hRes = resolution.vRes = resolutions.last();
else
diff --git a/src/plugins/platforms/cocoa/qprintengine_mac_p.h b/src/plugins/platforms/cocoa/qprintengine_mac_p.h
index 2d46a250d5..9514f3e691 100644
--- a/src/plugins/platforms/cocoa/qprintengine_mac_p.h
+++ b/src/plugins/platforms/cocoa/qprintengine_mac_p.h
@@ -150,8 +150,8 @@ public:
PMPrintSession session() const { return static_cast<PMPrintSession>([printInfo PMPrintSession]); }
PMPrintSettings settings() const { return static_cast<PMPrintSettings>([printInfo PMPrintSettings]); }
- QPaintEngine *aggregateEngine() Q_DECL_OVERRIDE { return paintEngine; }
- Qt::HANDLE nativeHandle() Q_DECL_OVERRIDE { return q_func()->handle(); }
+ QPaintEngine *aggregateEngine() override { return paintEngine; }
+ Qt::HANDLE nativeHandle() override { return q_func()->handle(); }
};
QT_END_NAMESPACE
diff --git a/src/plugins/platforms/direct2d/qwindowsdirect2dbackingstore.h b/src/plugins/platforms/direct2d/qwindowsdirect2dbackingstore.h
index 670c4e9840..f72ea2b038 100644
--- a/src/plugins/platforms/direct2d/qwindowsdirect2dbackingstore.h
+++ b/src/plugins/platforms/direct2d/qwindowsdirect2dbackingstore.h
@@ -54,12 +54,12 @@ public:
QWindowsDirect2DBackingStore(QWindow *window);
~QWindowsDirect2DBackingStore();
- void beginPaint(const QRegion &) Q_DECL_OVERRIDE;
- void endPaint() Q_DECL_OVERRIDE;
+ void beginPaint(const QRegion &) override;
+ void endPaint() override;
- QPaintDevice *paintDevice() Q_DECL_OVERRIDE;
- void flush(QWindow *targetWindow, const QRegion &region, const QPoint &offset) Q_DECL_OVERRIDE;
- void resize(const QSize &size, const QRegion &staticContents) Q_DECL_OVERRIDE;
+ QPaintDevice *paintDevice() override;
+ void flush(QWindow *targetWindow, const QRegion &region, const QPoint &offset) override;
+ void resize(const QSize &size, const QRegion &staticContents) override;
QImage toImage() const override;
};
diff --git a/src/plugins/platforms/direct2d/qwindowsdirect2ddevicecontext.cpp b/src/plugins/platforms/direct2d/qwindowsdirect2ddevicecontext.cpp
index 643ae877d0..d578a58982 100644
--- a/src/plugins/platforms/direct2d/qwindowsdirect2ddevicecontext.cpp
+++ b/src/plugins/platforms/direct2d/qwindowsdirect2ddevicecontext.cpp
@@ -161,7 +161,7 @@ void QWindowsDirect2DDeviceContextSuspender::resume()
{
if (m_dc) {
m_dc->resume();
- m_dc = Q_NULLPTR;
+ m_dc = nullptr;
}
}
diff --git a/src/plugins/platforms/direct2d/qwindowsdirect2dintegration.cpp b/src/plugins/platforms/direct2d/qwindowsdirect2dintegration.cpp
index ea51135583..97e3a25b86 100644
--- a/src/plugins/platforms/direct2d/qwindowsdirect2dintegration.cpp
+++ b/src/plugins/platforms/direct2d/qwindowsdirect2dintegration.cpp
@@ -203,7 +203,7 @@ QWindowsDirect2DIntegration *QWindowsDirect2DIntegration::create(const QStringLi
caption.toStdWString().c_str(),
MB_OK | MB_ICONERROR);
- return Q_NULLPTR;
+ return nullptr;
}
QWindowsDirect2DIntegration *integration = new QWindowsDirect2DIntegration(paramList);
diff --git a/src/plugins/platforms/direct2d/qwindowsdirect2dintegration.h b/src/plugins/platforms/direct2d/qwindowsdirect2dintegration.h
index 43f2a08745..39ca1d0dbf 100644
--- a/src/plugins/platforms/direct2d/qwindowsdirect2dintegration.h
+++ b/src/plugins/platforms/direct2d/qwindowsdirect2dintegration.h
@@ -58,15 +58,15 @@ public:
static QWindowsDirect2DIntegration *instance();
- QPlatformNativeInterface *nativeInterface() const Q_DECL_OVERRIDE;
- QPlatformPixmap *createPlatformPixmap(QPlatformPixmap::PixelType type) const Q_DECL_OVERRIDE;
- QPlatformBackingStore *createPlatformBackingStore(QWindow *window) const Q_DECL_OVERRIDE;
- QAbstractEventDispatcher *createEventDispatcher() const Q_DECL_OVERRIDE;
+ QPlatformNativeInterface *nativeInterface() const override;
+ QPlatformPixmap *createPlatformPixmap(QPlatformPixmap::PixelType type) const override;
+ QPlatformBackingStore *createPlatformBackingStore(QWindow *window) const override;
+ QAbstractEventDispatcher *createEventDispatcher() const override;
QWindowsDirect2DContext *direct2DContext() const;
protected:
- QWindowsWindow *createPlatformWindowHelper(QWindow *window, const QWindowsWindowData &) const Q_DECL_OVERRIDE;
+ QWindowsWindow *createPlatformWindowHelper(QWindow *window, const QWindowsWindowData &) const override;
private:
explicit QWindowsDirect2DIntegration(const QStringList &paramList);
diff --git a/src/plugins/platforms/direct2d/qwindowsdirect2dnativeinterface.h b/src/plugins/platforms/direct2d/qwindowsdirect2dnativeinterface.h
index d57136129b..fce6ff9969 100644
--- a/src/plugins/platforms/direct2d/qwindowsdirect2dnativeinterface.h
+++ b/src/plugins/platforms/direct2d/qwindowsdirect2dnativeinterface.h
@@ -48,7 +48,7 @@ class QWindowsDirect2DNativeInterface : public QWindowsNativeInterface
{
Q_OBJECT
public:
- void *nativeResourceForBackingStore(const QByteArray &resource, QBackingStore *bs) Q_DECL_OVERRIDE;
+ void *nativeResourceForBackingStore(const QByteArray &resource, QBackingStore *bs) override;
};
QT_END_NAMESPACE
diff --git a/src/plugins/platforms/direct2d/qwindowsdirect2dpaintdevice.h b/src/plugins/platforms/direct2d/qwindowsdirect2dpaintdevice.h
index f434ef993c..1f23d604f5 100644
--- a/src/plugins/platforms/direct2d/qwindowsdirect2dpaintdevice.h
+++ b/src/plugins/platforms/direct2d/qwindowsdirect2dpaintdevice.h
@@ -58,11 +58,11 @@ public:
QWindowsDirect2DPaintEngine::Flags paintFlags = QWindowsDirect2DPaintEngine::NoFlag);
~QWindowsDirect2DPaintDevice();
- QPaintEngine *paintEngine() const Q_DECL_OVERRIDE;
- int devType() const Q_DECL_OVERRIDE;
+ QPaintEngine *paintEngine() const override;
+ int devType() const override;
protected:
- int metric(PaintDeviceMetric metric) const Q_DECL_OVERRIDE;
+ int metric(PaintDeviceMetric metric) const override;
private:
QScopedPointer<QWindowsDirect2DPaintDevicePrivate> d_ptr;
diff --git a/src/plugins/platforms/direct2d/qwindowsdirect2dpaintengine.cpp b/src/plugins/platforms/direct2d/qwindowsdirect2dpaintengine.cpp
index 164429ba30..95fbd37247 100644
--- a/src/plugins/platforms/direct2d/qwindowsdirect2dpaintengine.cpp
+++ b/src/plugins/platforms/direct2d/qwindowsdirect2dpaintengine.cpp
@@ -804,7 +804,7 @@ public:
const bool alias = !q->antiAliasingEnabled();
QVectorPath::CacheEntry *cacheEntry = path.isCacheable() ? path.lookupCacheData(q)
- : Q_NULLPTR;
+ : nullptr;
if (cacheEntry) {
D2DVectorPathCache *e = static_cast<D2DVectorPathCache *>(cacheEntry->data);
diff --git a/src/plugins/platforms/direct2d/qwindowsdirect2dpaintengine.h b/src/plugins/platforms/direct2d/qwindowsdirect2dpaintengine.h
index a8f63af5d5..b9616acd6a 100644
--- a/src/plugins/platforms/direct2d/qwindowsdirect2dpaintengine.h
+++ b/src/plugins/platforms/direct2d/qwindowsdirect2dpaintengine.h
@@ -65,45 +65,45 @@ public:
QWindowsDirect2DPaintEngine(QWindowsDirect2DBitmap *bitmap, Flags flags);
- bool begin(QPaintDevice *pdev) Q_DECL_OVERRIDE;
- bool end() Q_DECL_OVERRIDE;
+ bool begin(QPaintDevice *pdev) override;
+ bool end() override;
- Type type() const Q_DECL_OVERRIDE;
+ Type type() const override;
- void setState(QPainterState *s) Q_DECL_OVERRIDE;
+ void setState(QPainterState *s) override;
- void draw(const QVectorPath &path) Q_DECL_OVERRIDE;
+ void draw(const QVectorPath &path) override;
- void fill(const QVectorPath &path, const QBrush &brush) Q_DECL_OVERRIDE;
+ void fill(const QVectorPath &path, const QBrush &brush) override;
void fill(ID2D1Geometry *geometry, const QBrush &brush);
- void stroke(const QVectorPath &path, const QPen &pen) Q_DECL_OVERRIDE;
+ void stroke(const QVectorPath &path, const QPen &pen) override;
void stroke(ID2D1Geometry *geometry, const QPen &pen);
- void clip(const QVectorPath &path, Qt::ClipOperation op) Q_DECL_OVERRIDE;
+ void clip(const QVectorPath &path, Qt::ClipOperation op) override;
- void clipEnabledChanged() Q_DECL_OVERRIDE;
- void penChanged() Q_DECL_OVERRIDE;
- void brushChanged() Q_DECL_OVERRIDE;
- void brushOriginChanged() Q_DECL_OVERRIDE;
- void opacityChanged() Q_DECL_OVERRIDE;
- void compositionModeChanged() Q_DECL_OVERRIDE;
- void renderHintsChanged() Q_DECL_OVERRIDE;
- void transformChanged() Q_DECL_OVERRIDE;
+ void clipEnabledChanged() override;
+ void penChanged() override;
+ void brushChanged() override;
+ void brushOriginChanged() override;
+ void opacityChanged() override;
+ void compositionModeChanged() override;
+ void renderHintsChanged() override;
+ void transformChanged() override;
- void fillRect(const QRectF &rect, const QBrush &brush) Q_DECL_OVERRIDE;
+ void fillRect(const QRectF &rect, const QBrush &brush) override;
- void drawRects(const QRect *rects, int rectCount) Q_DECL_OVERRIDE;
- void drawRects(const QRectF *rects, int rectCount) Q_DECL_OVERRIDE;
+ void drawRects(const QRect *rects, int rectCount) override;
+ void drawRects(const QRectF *rects, int rectCount) override;
- void drawEllipse(const QRectF &r) Q_DECL_OVERRIDE;
- void drawEllipse(const QRect &r) Q_DECL_OVERRIDE;
+ void drawEllipse(const QRectF &r) override;
+ void drawEllipse(const QRect &r) override;
- void drawImage(const QRectF &rectangle, const QImage &image, const QRectF &sr, Qt::ImageConversionFlags flags = Qt::AutoColor) Q_DECL_OVERRIDE;
- void drawPixmap(const QRectF &r, const QPixmap &pm, const QRectF &sr) Q_DECL_OVERRIDE;
+ void drawImage(const QRectF &rectangle, const QImage &image, const QRectF &sr, Qt::ImageConversionFlags flags = Qt::AutoColor) override;
+ void drawPixmap(const QRectF &r, const QPixmap &pm, const QRectF &sr) override;
- void drawStaticTextItem(QStaticTextItem *staticTextItem) Q_DECL_OVERRIDE;
- void drawTextItem(const QPointF &p, const QTextItem &textItem) Q_DECL_OVERRIDE;
+ void drawStaticTextItem(QStaticTextItem *staticTextItem) override;
+ void drawTextItem(const QPointF &p, const QTextItem &textItem) override;
private:
void ensureBrush();
diff --git a/src/plugins/platforms/direct2d/qwindowsdirect2dplatformpixmap.h b/src/plugins/platforms/direct2d/qwindowsdirect2dplatformpixmap.h
index 5f65a2313a..0448613a95 100644
--- a/src/plugins/platforms/direct2d/qwindowsdirect2dplatformpixmap.h
+++ b/src/plugins/platforms/direct2d/qwindowsdirect2dplatformpixmap.h
@@ -59,21 +59,21 @@ public:
QWindowsDirect2DPlatformPixmap(PixelType pixelType, QWindowsDirect2DPaintEngine::Flags flags, QWindowsDirect2DBitmap *bitmap);
~QWindowsDirect2DPlatformPixmap();
- void resize(int width, int height) Q_DECL_OVERRIDE;
- void fromImage(const QImage &image, Qt::ImageConversionFlags flags) Q_DECL_OVERRIDE;
+ void resize(int width, int height) override;
+ void fromImage(const QImage &image, Qt::ImageConversionFlags flags) override;
- int metric(QPaintDevice::PaintDeviceMetric metric) const Q_DECL_OVERRIDE;
- void fill(const QColor &color) Q_DECL_OVERRIDE;
+ int metric(QPaintDevice::PaintDeviceMetric metric) const override;
+ void fill(const QColor &color) override;
- bool hasAlphaChannel() const Q_DECL_OVERRIDE;
+ bool hasAlphaChannel() const override;
- QImage toImage() const Q_DECL_OVERRIDE;
- QImage toImage(const QRect &rect) const Q_DECL_OVERRIDE;
+ QImage toImage() const override;
+ QImage toImage(const QRect &rect) const override;
- QPaintEngine* paintEngine() const Q_DECL_OVERRIDE;
+ QPaintEngine* paintEngine() const override;
- qreal devicePixelRatio() const Q_DECL_OVERRIDE;
- void setDevicePixelRatio(qreal scaleFactor) Q_DECL_OVERRIDE;
+ qreal devicePixelRatio() const override;
+ void setDevicePixelRatio(qreal scaleFactor) override;
QWindowsDirect2DBitmap *bitmap() const;
diff --git a/src/plugins/platforms/direct2d/qwindowsdirect2dwindow.cpp b/src/plugins/platforms/direct2d/qwindowsdirect2dwindow.cpp
index 21294cfb15..f81182e0b1 100644
--- a/src/plugins/platforms/direct2d/qwindowsdirect2dwindow.cpp
+++ b/src/plugins/platforms/direct2d/qwindowsdirect2dwindow.cpp
@@ -209,7 +209,7 @@ void QWindowsDirect2DWindow::resizeSwapChain(const QSize &size)
{
m_pixmap.reset();
m_bitmap.reset();
- m_deviceContext->SetTarget(Q_NULLPTR);
+ m_deviceContext->SetTarget(nullptr);
m_needsFullFlush = true;
if (!m_swapChain)
@@ -241,7 +241,7 @@ QSharedPointer<QWindowsDirect2DBitmap> QWindowsDirect2DWindow::copyBackBuffer()
dpiX, // FLOAT dpiX;
dpiY, // FLOAT dpiY;
D2D1_BITMAP_OPTIONS_TARGET, // D2D1_BITMAP_OPTIONS bitmapOptions;
- Q_NULLPTR // _Field_size_opt_(1) ID2D1ColorContext *colorContext;
+ nullptr // _Field_size_opt_(1) ID2D1ColorContext *colorContext;
};
ComPtr<ID2D1Bitmap1> copy;
HRESULT hr = m_deviceContext.Get()->CreateBitmap(size, NULL, 0, properties, &copy);
@@ -257,7 +257,7 @@ QSharedPointer<QWindowsDirect2DBitmap> QWindowsDirect2DWindow::copyBackBuffer()
return null_result;
}
- return QSharedPointer<QWindowsDirect2DBitmap>(new QWindowsDirect2DBitmap(copy.Get(), Q_NULLPTR));
+ return QSharedPointer<QWindowsDirect2DBitmap>(new QWindowsDirect2DBitmap(copy.Get(), nullptr));
}
void QWindowsDirect2DWindow::setupBitmap()
diff --git a/src/plugins/platforms/direct2d/qwindowsdirect2dwindow.h b/src/plugins/platforms/direct2d/qwindowsdirect2dwindow.h
index 156d4660d1..3ac532d938 100644
--- a/src/plugins/platforms/direct2d/qwindowsdirect2dwindow.h
+++ b/src/plugins/platforms/direct2d/qwindowsdirect2dwindow.h
@@ -56,7 +56,7 @@ public:
QWindowsDirect2DWindow(QWindow *window, const QWindowsWindowData &data);
~QWindowsDirect2DWindow();
- void setWindowFlags(Qt::WindowFlags flags) Q_DECL_OVERRIDE;
+ void setWindowFlags(Qt::WindowFlags flags) override;
QPixmap *pixmap();
void flush(QWindowsDirect2DBitmap *bitmap, const QRegion &region, const QPoint &offset);
diff --git a/src/plugins/platforms/eglfs/api/qeglfsdeviceintegration.cpp b/src/plugins/platforms/eglfs/api/qeglfsdeviceintegration.cpp
index e411ea55e9..0fc4cc54e0 100644
--- a/src/plugins/platforms/eglfs/api/qeglfsdeviceintegration.cpp
+++ b/src/plugins/platforms/eglfs/api/qeglfsdeviceintegration.cpp
@@ -103,7 +103,7 @@ QStringList QEglFSDeviceIntegrationFactory::keys(const QString &pluginPath)
QEglFSDeviceIntegration *QEglFSDeviceIntegrationFactory::create(const QString &key, const QString &pluginPath)
{
- QEglFSDeviceIntegration *integration = Q_NULLPTR;
+ QEglFSDeviceIntegration *integration = nullptr;
#if QT_CONFIG(library)
if (!pluginPath.isEmpty()) {
QCoreApplication::addLibraryPath(pluginPath);
@@ -351,9 +351,21 @@ bool QEglFSDeviceIntegration::supportsSurfacelessContexts() const
return true;
}
+QFunctionPointer QEglFSDeviceIntegration::platformFunction(const QByteArray &function) const
+{
+ Q_UNUSED(function);
+ return nullptr;
+}
+
+void *QEglFSDeviceIntegration::nativeResourceForIntegration(const QByteArray &name)
+{
+ Q_UNUSED(name);
+ return nullptr;
+}
+
void *QEglFSDeviceIntegration::wlDisplay() const
{
- return Q_NULLPTR;
+ return nullptr;
}
EGLConfig QEglFSDeviceIntegration::chooseConfig(EGLDisplay display, const QSurfaceFormat &format)
diff --git a/src/plugins/platforms/eglfs/api/qeglfsdeviceintegration_p.h b/src/plugins/platforms/eglfs/api/qeglfsdeviceintegration_p.h
index 4335554912..d927bc9bc6 100644
--- a/src/plugins/platforms/eglfs/api/qeglfsdeviceintegration_p.h
+++ b/src/plugins/platforms/eglfs/api/qeglfsdeviceintegration_p.h
@@ -103,6 +103,8 @@ public:
virtual int framebufferIndex() const;
virtual bool supportsPBuffers() const;
virtual bool supportsSurfacelessContexts() const;
+ virtual QFunctionPointer platformFunction(const QByteArray &function) const;
+ virtual void *nativeResourceForIntegration(const QByteArray &name);
virtual void *wlDisplay() const;
diff --git a/src/plugins/platforms/eglfs/api/qeglfsintegration.cpp b/src/plugins/platforms/eglfs/api/qeglfsintegration.cpp
index 9a0be489a8..c0ecfd235f 100644
--- a/src/plugins/platforms/eglfs/api/qeglfsintegration.cpp
+++ b/src/plugins/platforms/eglfs/api/qeglfsintegration.cpp
@@ -324,6 +324,7 @@ void *QEglFSIntegration::nativeResourceForIntegration(const QByteArray &resource
result = qt_egl_device_integration()->wlDisplay();
break;
default:
+ result = qt_egl_device_integration()->nativeResourceForIntegration(resource);
break;
}
@@ -427,11 +428,9 @@ QFunctionPointer QEglFSIntegration::platformFunction(const QByteArray &function)
#if QT_CONFIG(evdev)
if (function == QEglFSFunctions::loadKeymapTypeIdentifier())
return QFunctionPointer(loadKeymapStatic);
-#else
- Q_UNUSED(function)
#endif
- return 0;
+ return qt_egl_device_integration()->platformFunction(function);
}
void QEglFSIntegration::loadKeymapStatic(const QString &filename)
diff --git a/src/plugins/platforms/eglfs/api/qeglfswindow_p.h b/src/plugins/platforms/eglfs/api/qeglfswindow_p.h
index 6bda262523..c61f04f569 100644
--- a/src/plugins/platforms/eglfs/api/qeglfswindow_p.h
+++ b/src/plugins/platforms/eglfs/api/qeglfswindow_p.h
@@ -95,7 +95,7 @@ public:
EGLNativeWindowType eglWindow() const;
EGLSurface surface() const;
- QEglFSScreen *screen() const;
+ QEglFSScreen *screen() const override;
bool hasNativeWindow() const { return m_flags.testFlag(HasNativeWindow); }
diff --git a/src/plugins/platforms/eglfs/deviceintegration/eglfs_kms/eglfs_kms.pro b/src/plugins/platforms/eglfs/deviceintegration/eglfs_kms/eglfs_kms.pro
index 27c0af1f08..43170a3875 100644
--- a/src/plugins/platforms/eglfs/deviceintegration/eglfs_kms/eglfs_kms.pro
+++ b/src/plugins/platforms/eglfs/deviceintegration/eglfs_kms/eglfs_kms.pro
@@ -19,11 +19,13 @@ SOURCES += $$PWD/qeglfskmsgbmmain.cpp \
$$PWD/qeglfskmsgbmintegration.cpp \
$$PWD/qeglfskmsgbmdevice.cpp \
$$PWD/qeglfskmsgbmscreen.cpp \
- $$PWD/qeglfskmsgbmcursor.cpp
+ $$PWD/qeglfskmsgbmcursor.cpp \
+ $$PWD/qeglfskmsgbmwindow.cpp
HEADERS += $$PWD/qeglfskmsgbmintegration.h \
$$PWD/qeglfskmsgbmdevice.h \
$$PWD/qeglfskmsgbmscreen.h \
- $$PWD/qeglfskmsgbmcursor.h
+ $$PWD/qeglfskmsgbmcursor.h \
+ $$PWD/qeglfskmsgbmwindow.h
OTHER_FILES += $$PWD/eglfs_kms.json
diff --git a/src/plugins/platforms/eglfs/deviceintegration/eglfs_kms/qeglfskmsgbmcursor.cpp b/src/plugins/platforms/eglfs/deviceintegration/eglfs_kms/qeglfskmsgbmcursor.cpp
index 800118362d..9bd7fee1fb 100644
--- a/src/plugins/platforms/eglfs/deviceintegration/eglfs_kms/qeglfskmsgbmcursor.cpp
+++ b/src/plugins/platforms/eglfs/deviceintegration/eglfs_kms/qeglfskmsgbmcursor.cpp
@@ -68,7 +68,7 @@ Q_DECLARE_LOGGING_CATEGORY(qLcEglfsKmsDebug)
QEglFSKmsGbmCursor::QEglFSKmsGbmCursor(QEglFSKmsGbmScreen *screen)
: m_screen(screen)
, m_cursorSize(64, 64) // 64x64 is the old standard size, we now try to query the real size below
- , m_bo(Q_NULLPTR)
+ , m_bo(nullptr)
, m_cursorImage(0, 0, 0, 0, 0, 0)
, m_state(CursorPendingVisible)
{
@@ -118,7 +118,7 @@ QEglFSKmsGbmCursor::~QEglFSKmsGbmCursor()
if (m_bo) {
gbm_bo_destroy(m_bo);
- m_bo = Q_NULLPTR;
+ m_bo = nullptr;
}
}
@@ -132,7 +132,7 @@ void QEglFSKmsGbmCursor::updateMouseStatus()
m_state = visible ? CursorPendingVisible : CursorPendingHidden;
#ifndef QT_NO_CURSOR
- changeCursor(Q_NULLPTR, m_screen->topLevelAt(pos()));
+ changeCursor(nullptr, m_screen->topLevelAt(pos()));
#endif
}
diff --git a/src/plugins/platforms/eglfs/deviceintegration/eglfs_kms/qeglfskmsgbmdevice.cpp b/src/plugins/platforms/eglfs/deviceintegration/eglfs_kms/qeglfskmsgbmdevice.cpp
index e218d580a2..20127ae7f7 100644
--- a/src/plugins/platforms/eglfs/deviceintegration/eglfs_kms/qeglfskmsgbmdevice.cpp
+++ b/src/plugins/platforms/eglfs/deviceintegration/eglfs_kms/qeglfskmsgbmdevice.cpp
@@ -53,28 +53,17 @@ QT_BEGIN_NAMESPACE
Q_DECLARE_LOGGING_CATEGORY(qLcEglfsKmsDebug)
-void QEglFSKmsGbmDevice::pageFlipHandler(int fd, unsigned int sequence, unsigned int tv_sec, unsigned int tv_usec, void *user_data)
-{
- Q_UNUSED(fd);
- Q_UNUSED(sequence);
- Q_UNUSED(tv_sec);
- Q_UNUSED(tv_usec);
-
- QEglFSKmsScreen *screen = static_cast<QEglFSKmsScreen *>(user_data);
- screen->flipFinished();
-}
-
QEglFSKmsGbmDevice::QEglFSKmsGbmDevice(QKmsScreenConfig *screenConfig, const QString &path)
: QEglFSKmsDevice(screenConfig, path)
- , m_gbm_device(Q_NULLPTR)
- , m_globalCursor(Q_NULLPTR)
+ , m_gbm_device(nullptr)
+ , m_globalCursor(nullptr)
{
}
bool QEglFSKmsGbmDevice::open()
{
Q_ASSERT(fd() == -1);
- Q_ASSERT(m_gbm_device == Q_NULLPTR);
+ Q_ASSERT(m_gbm_device == nullptr);
int fd = qt_safe_open(devicePath().toLocal8Bit().constData(), O_RDWR | O_CLOEXEC);
if (fd == -1) {
@@ -103,7 +92,7 @@ void QEglFSKmsGbmDevice::close()
if (m_gbm_device) {
gbm_device_destroy(m_gbm_device);
- m_gbm_device = Q_NULLPTR;
+ m_gbm_device = nullptr;
}
if (fd() != -1) {
@@ -134,24 +123,13 @@ void QEglFSKmsGbmDevice::destroyGlobalCursor()
if (m_globalCursor) {
qCDebug(qLcEglfsKmsDebug, "Destroying global GBM mouse cursor");
delete m_globalCursor;
- m_globalCursor = Q_NULLPTR;
+ m_globalCursor = nullptr;
}
}
-void QEglFSKmsGbmDevice::handleDrmEvent()
-{
- drmEventContext drmEvent;
- memset(&drmEvent, 0, sizeof(drmEvent));
- drmEvent.version = 2;
- drmEvent.vblank_handler = nullptr;
- drmEvent.page_flip_handler = pageFlipHandler;
-
- drmHandleEvent(fd(), &drmEvent);
-}
-
QPlatformScreen *QEglFSKmsGbmDevice::createScreen(const QKmsOutput &output)
{
- QEglFSKmsGbmScreen *screen = new QEglFSKmsGbmScreen(this, output);
+ QEglFSKmsGbmScreen *screen = new QEglFSKmsGbmScreen(this, output, false);
if (!m_globalCursor && screenConfig()->hwCursor()) {
qCDebug(qLcEglfsKmsDebug, "Creating new global GBM mouse cursor");
@@ -161,4 +139,20 @@ QPlatformScreen *QEglFSKmsGbmDevice::createScreen(const QKmsOutput &output)
return screen;
}
+QPlatformScreen *QEglFSKmsGbmDevice::createHeadlessScreen()
+{
+ return new QEglFSKmsGbmScreen(this, QKmsOutput(), true);
+}
+
+void QEglFSKmsGbmDevice::registerScreenCloning(QPlatformScreen *screen,
+ QPlatformScreen *screenThisScreenClones,
+ const QVector<QPlatformScreen *> &screensCloningThisScreen)
+{
+ if (!screenThisScreenClones && screensCloningThisScreen.isEmpty())
+ return;
+
+ QEglFSKmsGbmScreen *gbmScreen = static_cast<QEglFSKmsGbmScreen *>(screen);
+ gbmScreen->initCloning(screenThisScreenClones, screensCloningThisScreen);
+}
+
QT_END_NAMESPACE
diff --git a/src/plugins/platforms/eglfs/deviceintegration/eglfs_kms/qeglfskmsgbmdevice.h b/src/plugins/platforms/eglfs/deviceintegration/eglfs_kms/qeglfskmsgbmdevice.h
index 08ca28d48e..518e2ce58b 100644
--- a/src/plugins/platforms/eglfs/deviceintegration/eglfs_kms/qeglfskmsgbmdevice.h
+++ b/src/plugins/platforms/eglfs/deviceintegration/eglfs_kms/qeglfskmsgbmdevice.h
@@ -65,9 +65,11 @@ public:
QPlatformCursor *globalCursor() const;
void destroyGlobalCursor();
- void handleDrmEvent();
-
QPlatformScreen *createScreen(const QKmsOutput &output) override;
+ QPlatformScreen *createHeadlessScreen() override;
+ void registerScreenCloning(QPlatformScreen *screen,
+ QPlatformScreen *screenThisScreenClones,
+ const QVector<QPlatformScreen *> &screensCloningThisScreen) override;
private:
Q_DISABLE_COPY(QEglFSKmsGbmDevice)
@@ -75,12 +77,6 @@ private:
gbm_device *m_gbm_device;
QEglFSKmsGbmCursor *m_globalCursor;
-
- static void pageFlipHandler(int fd,
- unsigned int sequence,
- unsigned int tv_sec,
- unsigned int tv_usec,
- void *user_data);
};
QT_END_NAMESPACE
diff --git a/src/plugins/platforms/eglfs/deviceintegration/eglfs_kms/qeglfskmsgbmintegration.cpp b/src/plugins/platforms/eglfs/deviceintegration/eglfs_kms/qeglfskmsgbmintegration.cpp
index 058791e473..402338197d 100644
--- a/src/plugins/platforms/eglfs/deviceintegration/eglfs_kms/qeglfskmsgbmintegration.cpp
+++ b/src/plugins/platforms/eglfs/deviceintegration/eglfs_kms/qeglfskmsgbmintegration.cpp
@@ -43,21 +43,13 @@
#include "qeglfskmsgbmdevice.h"
#include "qeglfskmsgbmscreen.h"
#include "qeglfskmsgbmcursor.h"
-#include "private/qeglfswindow_p.h"
+#include "qeglfskmsgbmwindow.h"
#include "private/qeglfscursor_p.h"
-#include <QtDeviceDiscoverySupport/private/qdevicediscovery_p.h>
-#include <QtEglSupport/private/qeglconvenience_p.h>
#include <QtCore/QLoggingCategory>
-#include <QtCore/QJsonDocument>
-#include <QtCore/QJsonObject>
-#include <QtCore/QJsonArray>
-#include <QtGui/qpa/qplatformwindow.h>
-#include <QtGui/qpa/qplatformcursor.h>
#include <QtGui/QScreen>
+#include <QtDeviceDiscoverySupport/private/qdevicediscovery_p.h>
-#include <xf86drm.h>
-#include <xf86drmMode.h>
#include <gbm.h>
QT_BEGIN_NAMESPACE
@@ -105,7 +97,6 @@ EGLNativeWindowType QEglFSKmsGbmIntegration::createNativeOffscreenWindow(const Q
Q_UNUSED(format);
Q_ASSERT(device());
- qCDebug(qLcEglfsKmsDebug) << "Creating native off screen window";
gbm_surface *surface = gbm_surface_create(static_cast<QEglFSKmsGbmDevice *>(device())->gbmDevice(),
1, 1,
GBM_FORMAT_XRGB8888,
@@ -134,8 +125,7 @@ QPlatformCursor *QEglFSKmsGbmIntegration::createCursor(QPlatformScreen *screen)
void QEglFSKmsGbmIntegration::presentBuffer(QPlatformSurface *surface)
{
QWindow *window = static_cast<QWindow *>(surface->surface());
- QEglFSKmsScreen *screen = static_cast<QEglFSKmsScreen *>(window->screen()->handle());
-
+ QEglFSKmsGbmScreen *screen = static_cast<QEglFSKmsGbmScreen *>(window->screen()->handle());
screen->flip();
}
@@ -160,46 +150,6 @@ QKmsDevice *QEglFSKmsGbmIntegration::createDevice()
return new QEglFSKmsGbmDevice(screenConfig(), path);
}
-class QEglFSKmsGbmWindow : public QEglFSWindow
-{
-public:
- QEglFSKmsGbmWindow(QWindow *w, const QEglFSKmsGbmIntegration *integration)
- : QEglFSWindow(w)
- , m_integration(integration)
- {}
- void resetSurface() override;
- const QEglFSKmsGbmIntegration *m_integration;
-};
-
-void QEglFSKmsGbmWindow::resetSurface()
-{
- QEglFSKmsGbmScreen *gbmScreen = static_cast<QEglFSKmsGbmScreen *>(screen());
- if (gbmScreen->surface()) {
- qWarning("Only single window per screen supported!");
- return;
- }
-
- EGLDisplay display = gbmScreen->display();
- QSurfaceFormat platformFormat = m_integration->surfaceFormatFor(window()->requestedFormat());
- m_config = QEglFSDeviceIntegration::chooseConfig(display, platformFormat);
- m_format = q_glFormatFromConfig(display, m_config, platformFormat);
- m_window = reinterpret_cast<EGLNativeWindowType>(gbmScreen->createSurface());
-
- PFNEGLCREATEPLATFORMWINDOWSURFACEEXTPROC createPlatformWindowSurface = nullptr;
- const char *extensions = eglQueryString(EGL_NO_DISPLAY, EGL_EXTENSIONS);
- if (extensions && (strstr(extensions, "EGL_KHR_platform_gbm") || strstr(extensions, "EGL_MESA_platform_gbm"))) {
- createPlatformWindowSurface = reinterpret_cast<PFNEGLCREATEPLATFORMWINDOWSURFACEEXTPROC>(
- eglGetProcAddress("eglCreatePlatformWindowSurfaceEXT"));
- }
-
- if (createPlatformWindowSurface) {
- m_surface = createPlatformWindowSurface(display, m_config, reinterpret_cast<void *>(m_window), nullptr);
- } else {
- qCDebug(qLcEglfsKmsDebug, "No eglCreatePlatformWindowSurface for GBM, falling back to eglCreateWindowSurface");
- m_surface = eglCreateWindowSurface(display, m_config, m_window, nullptr);
- }
-}
-
QEglFSWindow *QEglFSKmsGbmIntegration::createWindow(QWindow *window) const
{
return new QEglFSKmsGbmWindow(window, this);
diff --git a/src/plugins/platforms/eglfs/deviceintegration/eglfs_kms/qeglfskmsgbmscreen.cpp b/src/plugins/platforms/eglfs/deviceintegration/eglfs_kms/qeglfskmsgbmscreen.cpp
index 87fb3146c7..4742143121 100644
--- a/src/plugins/platforms/eglfs/deviceintegration/eglfs_kms/qeglfskmsgbmscreen.cpp
+++ b/src/plugins/platforms/eglfs/deviceintegration/eglfs_kms/qeglfskmsgbmscreen.cpp
@@ -1,7 +1,7 @@
/****************************************************************************
**
+** Copyright (C) 2017 The Qt Company Ltd.
** Copyright (C) 2015 Pier Luigi Fiorini <pierluigi.fiorini@gmail.com>
-** Copyright (C) 2016 The Qt Company Ltd.
** Copyright (C) 2016 Pelagicore AG
** Contact: https://www.qt.io/licensing/
**
@@ -55,6 +55,18 @@ QT_BEGIN_NAMESPACE
Q_DECLARE_LOGGING_CATEGORY(qLcEglfsKmsDebug)
+static inline uint32_t drmFormatToGbmFormat(uint32_t drmFormat)
+{
+ Q_ASSERT(DRM_FORMAT_XRGB8888 == GBM_FORMAT_XRGB8888);
+ return drmFormat;
+}
+
+static inline uint32_t gbmFormatToDrmFormat(uint32_t gbmFormat)
+{
+ Q_ASSERT(DRM_FORMAT_XRGB8888 == GBM_FORMAT_XRGB8888);
+ return gbmFormat;
+}
+
void QEglFSKmsGbmScreen::bufferDestroyedHandler(gbm_bo *bo, void *data)
{
FrameBuffer *fb = static_cast<FrameBuffer *>(data);
@@ -77,29 +89,34 @@ QEglFSKmsGbmScreen::FrameBuffer *QEglFSKmsGbmScreen::framebufferForBufferObject(
uint32_t width = gbm_bo_get_width(bo);
uint32_t height = gbm_bo_get_height(bo);
- uint32_t stride = gbm_bo_get_stride(bo);
- uint32_t handle = gbm_bo_get_handle(bo).u32;
+ uint32_t handles[4] = { gbm_bo_get_handle(bo).u32 };
+ uint32_t strides[4] = { gbm_bo_get_stride(bo) };
+ uint32_t offsets[4] = { 0 };
+ uint32_t pixelFormat = gbmFormatToDrmFormat(gbm_bo_get_format(bo));
QScopedPointer<FrameBuffer> fb(new FrameBuffer);
+ qCDebug(qLcEglfsKmsDebug, "Adding FB, size %ux%u, DRM format 0x%x", width, height, pixelFormat);
- int ret = drmModeAddFB(device()->fd(), width, height, 24, 32,
- stride, handle, &fb->fb);
+ int ret = drmModeAddFB2(device()->fd(), width, height, pixelFormat,
+ handles, strides, offsets, &fb->fb, 0);
if (ret) {
qWarning("Failed to create KMS FB!");
- return Q_NULLPTR;
+ return nullptr;
}
gbm_bo_set_user_data(bo, fb.data(), bufferDestroyedHandler);
return fb.take();
}
-QEglFSKmsGbmScreen::QEglFSKmsGbmScreen(QKmsDevice *device, const QKmsOutput &output)
- : QEglFSKmsScreen(device, output)
- , m_gbm_surface(Q_NULLPTR)
- , m_gbm_bo_current(Q_NULLPTR)
- , m_gbm_bo_next(Q_NULLPTR)
- , m_cursor(Q_NULLPTR)
+QEglFSKmsGbmScreen::QEglFSKmsGbmScreen(QKmsDevice *device, const QKmsOutput &output, bool headless)
+ : QEglFSKmsScreen(device, output, headless)
+ , m_gbm_surface(nullptr)
+ , m_gbm_bo_current(nullptr)
+ , m_gbm_bo_next(nullptr)
+ , m_flipPending(false)
+ , m_cursor(nullptr)
+ , m_cloneSource(nullptr)
{
}
@@ -114,6 +131,8 @@ QEglFSKmsGbmScreen::~QEglFSKmsGbmScreen()
QPlatformCursor *QEglFSKmsGbmScreen::cursor() const
{
QKmsScreenConfig *config = device()->screenConfig();
+ if (config->headless())
+ return nullptr;
if (config->hwCursor()) {
if (!config->separateScreens())
return static_cast<QEglFSKmsGbmDevice *>(device())->globalCursor();
@@ -132,47 +151,112 @@ QPlatformCursor *QEglFSKmsGbmScreen::cursor() const
gbm_surface *QEglFSKmsGbmScreen::createSurface()
{
if (!m_gbm_surface) {
- qCDebug(qLcEglfsKmsDebug) << "Creating window for screen" << name();
+ uint32_t gbmFormat = drmFormatToGbmFormat(m_output.drm_format);
+ qCDebug(qLcEglfsKmsDebug, "Creating gbm_surface for screen %s with format 0x%x", qPrintable(name()), gbmFormat);
m_gbm_surface = gbm_surface_create(static_cast<QEglFSKmsGbmDevice *>(device())->gbmDevice(),
rawGeometry().width(),
rawGeometry().height(),
- GBM_FORMAT_XRGB8888,
+ gbmFormat,
GBM_BO_USE_SCANOUT | GBM_BO_USE_RENDERING);
}
- return m_gbm_surface;
+ return m_gbm_surface; // not owned, gets destroyed in QEglFSKmsGbmIntegration::destroyNativeWindow() via QEglFSKmsGbmWindow::invalidateSurface()
}
-void QEglFSKmsGbmScreen::destroySurface()
+void QEglFSKmsGbmScreen::resetSurface()
{
- if (m_gbm_bo_current) {
- gbm_bo_destroy(m_gbm_bo_current);
- m_gbm_bo_current = Q_NULLPTR;
- }
+ m_gbm_surface = nullptr;
+}
- if (m_gbm_bo_next) {
- gbm_bo_destroy(m_gbm_bo_next);
- m_gbm_bo_next = Q_NULLPTR;
+void QEglFSKmsGbmScreen::initCloning(QPlatformScreen *screenThisScreenClones,
+ const QVector<QPlatformScreen *> &screensCloningThisScreen)
+{
+ // clone destinations need to know the clone source
+ const bool clonesAnother = screenThisScreenClones != nullptr;
+ if (clonesAnother && !screensCloningThisScreen.isEmpty()) {
+ qWarning("QEglFSKmsGbmScreen %s cannot be clone source and destination at the same time", qPrintable(name()));
+ return;
}
+ if (clonesAnother)
+ m_cloneSource = static_cast<QEglFSKmsGbmScreen *>(screenThisScreenClones);
+
+ // clone sources need to know their additional destinations
+ for (QPlatformScreen *s : screensCloningThisScreen) {
+ CloneDestination d;
+ d.screen = static_cast<QEglFSKmsGbmScreen *>(s);
+ m_cloneDests.append(d);
+ }
+}
+
+void QEglFSKmsGbmScreen::ensureModeSet(uint32_t fb)
+{
+ QKmsOutput &op(output());
+ const int fd = device()->fd();
+
+ if (!op.mode_set) {
+ op.mode_set = true;
+
+ bool doModeSet = true;
+ drmModeCrtcPtr currentMode = drmModeGetCrtc(fd, op.crtc_id);
+ const bool alreadySet = currentMode && !memcmp(&currentMode->mode, &op.modes[op.mode], sizeof(drmModeModeInfo));
+ if (currentMode)
+ drmModeFreeCrtc(currentMode);
+ if (alreadySet) {
+ static bool alwaysDoSet = qEnvironmentVariableIntValue("QT_QPA_EGLFS_ALWAYS_SET_MODE");
+ if (!alwaysDoSet) {
+ qCDebug(qLcEglfsKmsDebug, "Mode already set, skipping modesetting for screen %s", qPrintable(name()));
+ doModeSet = false;
+ }
+ }
- if (m_gbm_surface) {
- gbm_surface_destroy(m_gbm_surface);
- m_gbm_surface = Q_NULLPTR;
+ if (doModeSet) {
+ qCDebug(qLcEglfsKmsDebug, "Setting mode for screen %s", qPrintable(name()));
+ int ret = drmModeSetCrtc(fd,
+ op.crtc_id,
+ fb,
+ 0, 0,
+ &op.connector_id, 1,
+ &op.modes[op.mode]);
+
+ if (ret == 0)
+ setPowerState(PowerStateOn);
+ else
+ qErrnoWarning(errno, "Could not set DRM mode for screen %s", qPrintable(name()));
+ }
}
}
void QEglFSKmsGbmScreen::waitForFlip()
{
+ if (m_headless || m_cloneSource)
+ return;
+
// Don't lock the mutex unless we actually need to
if (!m_gbm_bo_next)
return;
QMutexLocker lock(&m_waitForFlipMutex);
- while (m_gbm_bo_next)
- static_cast<QEglFSKmsGbmDevice *>(device())->handleDrmEvent();
+ while (m_gbm_bo_next) {
+ drmEventContext drmEvent;
+ memset(&drmEvent, 0, sizeof(drmEvent));
+ drmEvent.version = 2;
+ drmEvent.vblank_handler = nullptr;
+ drmEvent.page_flip_handler = pageFlipHandler;
+ drmHandleEvent(device()->fd(), &drmEvent);
+ }
}
void QEglFSKmsGbmScreen::flip()
{
+ // For headless screen just return silently. It is not necessarily an error
+ // to end up here, so show no warnings.
+ if (m_headless)
+ return;
+
+ if (m_cloneSource) {
+ qWarning("Screen %s clones another screen. swapBuffers() not allowed.", qPrintable(name()));
+ return;
+ }
+
if (!m_gbm_surface) {
qWarning("Cannot sync before platform init!");
return;
@@ -185,60 +269,92 @@ void QEglFSKmsGbmScreen::flip()
}
FrameBuffer *fb = framebufferForBufferObject(m_gbm_bo_next);
+ ensureModeSet(fb->fb);
QKmsOutput &op(output());
const int fd = device()->fd();
- const uint32_t w = op.modes[op.mode].hdisplay;
- const uint32_t h = op.modes[op.mode].vdisplay;
-
- if (!op.mode_set) {
- int ret = drmModeSetCrtc(fd,
- op.crtc_id,
- fb->fb,
- 0, 0,
- &op.connector_id, 1,
- &op.modes[op.mode]);
-
- if (ret == -1) {
- qErrnoWarning(errno, "Could not set DRM mode!");
- } else {
- op.mode_set = true;
- setPowerState(PowerStateOn);
-
- if (!op.plane_set) {
- op.plane_set = true;
- if (op.wants_plane) {
- int ret = drmModeSetPlane(fd, op.plane_id, op.crtc_id,
- uint32_t(-1), 0,
- 0, 0, w, h,
- 0 << 16, 0 << 16, w << 16, h << 16);
- if (ret == -1)
- qErrnoWarning(errno, "drmModeSetPlane failed");
- }
- }
- }
- }
-
+ m_flipPending = true;
int ret = drmModePageFlip(fd,
op.crtc_id,
fb->fb,
DRM_MODE_PAGE_FLIP_EVENT,
this);
if (ret) {
- qErrnoWarning("Could not queue DRM page flip!");
+ qErrnoWarning("Could not queue DRM page flip on screen %s", qPrintable(name()));
+ m_flipPending = false;
gbm_surface_release_buffer(m_gbm_surface, m_gbm_bo_next);
- m_gbm_bo_next = Q_NULLPTR;
+ m_gbm_bo_next = nullptr;
+ return;
+ }
+
+ for (CloneDestination &d : m_cloneDests) {
+ if (d.screen != this) {
+ d.screen->ensureModeSet(fb->fb);
+ d.cloneFlipPending = true;
+ int ret = drmModePageFlip(fd,
+ d.screen->output().crtc_id,
+ fb->fb,
+ DRM_MODE_PAGE_FLIP_EVENT,
+ d.screen);
+ if (ret) {
+ qErrnoWarning("Could not queue DRM page flip for clone screen %s", qPrintable(name()));
+ d.cloneFlipPending = false;
+ }
+ }
}
}
+void QEglFSKmsGbmScreen::pageFlipHandler(int fd, unsigned int sequence, unsigned int tv_sec, unsigned int tv_usec, void *user_data)
+{
+ Q_UNUSED(fd);
+ Q_UNUSED(sequence);
+ Q_UNUSED(tv_sec);
+ Q_UNUSED(tv_usec);
+
+ QEglFSKmsGbmScreen *screen = static_cast<QEglFSKmsGbmScreen *>(user_data);
+ screen->flipFinished();
+}
+
void QEglFSKmsGbmScreen::flipFinished()
{
+ if (m_cloneSource) {
+ m_cloneSource->cloneDestFlipFinished(this);
+ return;
+ }
+
+ m_flipPending = false;
+ updateFlipStatus();
+}
+
+void QEglFSKmsGbmScreen::cloneDestFlipFinished(QEglFSKmsGbmScreen *cloneDestScreen)
+{
+ for (CloneDestination &d : m_cloneDests) {
+ if (d.screen == cloneDestScreen) {
+ d.cloneFlipPending = false;
+ break;
+ }
+ }
+ updateFlipStatus();
+}
+
+void QEglFSKmsGbmScreen::updateFlipStatus()
+{
+ Q_ASSERT(!m_cloneSource);
+
+ if (m_flipPending)
+ return;
+
+ for (const CloneDestination &d : m_cloneDests) {
+ if (d.cloneFlipPending)
+ return;
+ }
+
if (m_gbm_bo_current)
gbm_surface_release_buffer(m_gbm_surface,
m_gbm_bo_current);
m_gbm_bo_current = m_gbm_bo_next;
- m_gbm_bo_next = Q_NULLPTR;
+ m_gbm_bo_next = nullptr;
}
QT_END_NAMESPACE
diff --git a/src/plugins/platforms/eglfs/deviceintegration/eglfs_kms/qeglfskmsgbmscreen.h b/src/plugins/platforms/eglfs/deviceintegration/eglfs_kms/qeglfskmsgbmscreen.h
index 341cc95bbe..f5a2122723 100644
--- a/src/plugins/platforms/eglfs/deviceintegration/eglfs_kms/qeglfskmsgbmscreen.h
+++ b/src/plugins/platforms/eglfs/deviceintegration/eglfs_kms/qeglfskmsgbmscreen.h
@@ -54,34 +54,54 @@ class QEglFSKmsGbmCursor;
class QEglFSKmsGbmScreen : public QEglFSKmsScreen
{
public:
- QEglFSKmsGbmScreen(QKmsDevice *device, const QKmsOutput &output);
+ QEglFSKmsGbmScreen(QKmsDevice *device, const QKmsOutput &output, bool headless);
~QEglFSKmsGbmScreen();
QPlatformCursor *cursor() const override;
- gbm_surface *surface() const { return m_gbm_surface; }
gbm_surface *createSurface();
- void destroySurface();
+ void resetSurface();
+
+ void initCloning(QPlatformScreen *screenThisScreenClones,
+ const QVector<QPlatformScreen *> &screensCloningThisScreen);
void waitForFlip() override;
- void flip() override;
- void flipFinished() override;
+
+ void flip();
private:
+ void flipFinished();
+ void ensureModeSet(uint32_t fb);
+ void cloneDestFlipFinished(QEglFSKmsGbmScreen *cloneDestScreen);
+ void updateFlipStatus();
+
+ static void pageFlipHandler(int fd,
+ unsigned int sequence,
+ unsigned int tv_sec,
+ unsigned int tv_usec,
+ void *user_data);
+
gbm_surface *m_gbm_surface;
gbm_bo *m_gbm_bo_current;
gbm_bo *m_gbm_bo_next;
+ bool m_flipPending;
QScopedPointer<QEglFSKmsGbmCursor> m_cursor;
struct FrameBuffer {
- FrameBuffer() : fb(0) {}
- uint32_t fb;
+ uint32_t fb = 0;
};
static void bufferDestroyedHandler(gbm_bo *bo, void *data);
FrameBuffer *framebufferForBufferObject(gbm_bo *bo);
+ QEglFSKmsGbmScreen *m_cloneSource;
+ struct CloneDestination {
+ QEglFSKmsGbmScreen *screen = nullptr;
+ bool cloneFlipPending = false;
+ };
+ QVector<CloneDestination> m_cloneDests;
+
static QMutex m_waitForFlipMutex;
};
diff --git a/src/plugins/platforms/eglfs/deviceintegration/eglfs_kms/qeglfskmsgbmwindow.cpp b/src/plugins/platforms/eglfs/deviceintegration/eglfs_kms/qeglfskmsgbmwindow.cpp
new file mode 100644
index 0000000000..110a592dec
--- /dev/null
+++ b/src/plugins/platforms/eglfs/deviceintegration/eglfs_kms/qeglfskmsgbmwindow.cpp
@@ -0,0 +1,80 @@
+/****************************************************************************
+**
+** Copyright (C) 2017 The Qt Company Ltd.
+** Contact: https://www.qt.io/licensing/
+**
+** This file is part of the plugins of the Qt Toolkit.
+**
+** $QT_BEGIN_LICENSE:LGPL$
+** Commercial License Usage
+** Licensees holding valid commercial Qt licenses may use this file in
+** accordance with the commercial license agreement provided with the
+** Software or, alternatively, in accordance with the terms contained in
+** a written agreement between you and The Qt Company. For licensing terms
+** and conditions see https://www.qt.io/terms-conditions. For further
+** information use the contact form at https://www.qt.io/contact-us.
+**
+** GNU Lesser General Public License Usage
+** Alternatively, this file may be used under the terms of the GNU Lesser
+** General Public License version 3 as published by the Free Software
+** Foundation and appearing in the file LICENSE.LGPL3 included in the
+** packaging of this file. Please review the following information to
+** ensure the GNU Lesser General Public License version 3 requirements
+** will be met: https://www.gnu.org/licenses/lgpl-3.0.html.
+**
+** GNU General Public License Usage
+** Alternatively, this file may be used under the terms of the GNU
+** General Public License version 2.0 or (at your option) the GNU General
+** Public license version 3 or any later version approved by the KDE Free
+** Qt Foundation. The licenses are as published by the Free Software
+** Foundation and appearing in the file LICENSE.GPL2 and LICENSE.GPL3
+** included in the packaging of this file. Please review the following
+** information to ensure the GNU General Public License requirements will
+** be met: https://www.gnu.org/licenses/gpl-2.0.html and
+** https://www.gnu.org/licenses/gpl-3.0.html.
+**
+** $QT_END_LICENSE$
+**
+****************************************************************************/
+
+#include "qeglfskmsgbmwindow.h"
+#include "qeglfskmsgbmintegration.h"
+#include "qeglfskmsgbmscreen.h"
+
+#include <QtEglSupport/private/qeglconvenience_p.h>
+
+QT_BEGIN_NAMESPACE
+
+void QEglFSKmsGbmWindow::resetSurface()
+{
+ QEglFSKmsGbmScreen *gbmScreen = static_cast<QEglFSKmsGbmScreen *>(screen());
+ EGLDisplay display = gbmScreen->display();
+ QSurfaceFormat platformFormat = m_integration->surfaceFormatFor(window()->requestedFormat());
+ m_config = QEglFSDeviceIntegration::chooseConfig(display, platformFormat);
+ m_format = q_glFormatFromConfig(display, m_config, platformFormat);
+ // One fullscreen window per screen -> the native window is simply the gbm_surface the screen created.
+ m_window = reinterpret_cast<EGLNativeWindowType>(gbmScreen->createSurface());
+
+ PFNEGLCREATEPLATFORMWINDOWSURFACEEXTPROC createPlatformWindowSurface = nullptr;
+ const char *extensions = eglQueryString(EGL_NO_DISPLAY, EGL_EXTENSIONS);
+ if (extensions && (strstr(extensions, "EGL_KHR_platform_gbm") || strstr(extensions, "EGL_MESA_platform_gbm"))) {
+ createPlatformWindowSurface = reinterpret_cast<PFNEGLCREATEPLATFORMWINDOWSURFACEEXTPROC>(
+ eglGetProcAddress("eglCreatePlatformWindowSurfaceEXT"));
+ }
+
+ if (createPlatformWindowSurface) {
+ m_surface = createPlatformWindowSurface(display, m_config, reinterpret_cast<void *>(m_window), nullptr);
+ } else {
+ qCDebug(qLcEglfsKmsDebug, "No eglCreatePlatformWindowSurface for GBM, falling back to eglCreateWindowSurface");
+ m_surface = eglCreateWindowSurface(display, m_config, m_window, nullptr);
+ }
+}
+
+void QEglFSKmsGbmWindow::invalidateSurface()
+{
+ QEglFSKmsGbmScreen *gbmScreen = static_cast<QEglFSKmsGbmScreen *>(screen());
+ QEglFSWindow::invalidateSurface();
+ gbmScreen->resetSurface();
+}
+
+QT_END_NAMESPACE
diff --git a/src/plugins/platforms/windows/accessible/comutils.h b/src/plugins/platforms/eglfs/deviceintegration/eglfs_kms/qeglfskmsgbmwindow.h
index b1e6183a0f..a19cf7e8bc 100644
--- a/src/plugins/platforms/windows/accessible/comutils.h
+++ b/src/plugins/platforms/eglfs/deviceintegration/eglfs_kms/qeglfskmsgbmwindow.h
@@ -1,6 +1,8 @@
/****************************************************************************
**
+** Copyright (C) 2015 Pier Luigi Fiorini <pierluigi.fiorini@gmail.com>
** Copyright (C) 2016 The Qt Company Ltd.
+** Copyright (C) 2016 Pelagicore AG
** Contact: https://www.qt.io/licensing/
**
** This file is part of the plugins of the Qt Toolkit.
@@ -36,29 +38,30 @@
** $QT_END_LICENSE$
**
****************************************************************************/
-#ifndef COMUTILS_H
-#define COMUTILS_H
-#if !defined(_WINDOWS_) && !defined(_WINDOWS_H) && !defined(__WINDOWS__)
-#error Must include windows.h first!
-#endif
+#ifndef QEGLFSKMSGBMWINDOW_H
+#define QEGLFSKMSGBMWINDOW_H
-#include <ocidl.h>
-#include <QtCore/qstring.h>
+#include "private/qeglfswindow_p.h"
QT_BEGIN_NAMESPACE
-class QVariant;
+class QEglFSKmsGbmIntegration;
-// Originally QVariantToVARIANT copied from ActiveQt - renamed to avoid conflicts in static builds.
-bool QVariant2VARIANT(const QVariant &var, VARIANT &arg, const QByteArray &typeName, bool out);
-
-inline BSTR QStringToBSTR(const QString &str)
+class QEglFSKmsGbmWindow : public QEglFSWindow
{
- return SysAllocStringLen(reinterpret_cast<const OLECHAR *>(str.unicode()), UINT(str.length()));
-}
+public:
+ QEglFSKmsGbmWindow(QWindow *w, const QEglFSKmsGbmIntegration *integration)
+ : QEglFSWindow(w),
+ m_integration(integration)
+ { }
+ void resetSurface() override;
+ void invalidateSurface() override;
-QT_END_NAMESPACE
+private:
+ const QEglFSKmsGbmIntegration *m_integration;
+};
-#endif // COMUTILS_H
+QT_END_NAMESPACE
+#endif // QEGLFSKMSGBMWINDOW_H
diff --git a/src/plugins/platforms/eglfs/deviceintegration/eglfs_kms_egldevice/qeglfskmsegldevice.cpp b/src/plugins/platforms/eglfs/deviceintegration/eglfs_kms_egldevice/qeglfskmsegldevice.cpp
index cca413ff2d..8c8e6260f1 100644
--- a/src/plugins/platforms/eglfs/deviceintegration/eglfs_kms_egldevice/qeglfskmsegldevice.cpp
+++ b/src/plugins/platforms/eglfs/deviceintegration/eglfs_kms_egldevice/qeglfskmsegldevice.cpp
@@ -58,7 +58,7 @@ bool QEglFSKmsEglDevice::open()
{
Q_ASSERT(fd() == -1);
- int fd = drmOpen(devicePath().toLocal8Bit().constData(), Q_NULLPTR);
+ int fd = drmOpen(devicePath().toLocal8Bit().constData(), nullptr);
if (Q_UNLIKELY(fd < 0))
qFatal("Could not open DRM (NV) device");
diff --git a/src/plugins/platforms/eglfs/deviceintegration/eglfs_kms_egldevice/qeglfskmsegldeviceintegration.cpp b/src/plugins/platforms/eglfs/deviceintegration/eglfs_kms_egldevice/qeglfskmsegldeviceintegration.cpp
index 3af21d768e..a67457a6a5 100644
--- a/src/plugins/platforms/eglfs/deviceintegration/eglfs_kms_egldevice/qeglfskmsegldeviceintegration.cpp
+++ b/src/plugins/platforms/eglfs/deviceintegration/eglfs_kms_egldevice/qeglfskmsegldeviceintegration.cpp
@@ -51,7 +51,7 @@ QT_BEGIN_NAMESPACE
QEglFSKmsEglDeviceIntegration::QEglFSKmsEglDeviceIntegration()
: m_egl_device(EGL_NO_DEVICE_EXT)
- , m_funcs(Q_NULLPTR)
+ , m_funcs(nullptr)
{
qCDebug(qLcEglfsKmsDebug, "New DRM/KMS on EGLDevice integration created");
}
@@ -75,7 +75,7 @@ EGLDisplay QEglFSKmsEglDeviceIntegration::createDisplay(EGLNativeDisplayType nat
EGLDisplay display;
if (m_funcs->has_egl_platform_device) {
- display = m_funcs->get_platform_display(EGL_PLATFORM_DEVICE_EXT, nativeDisplay, Q_NULLPTR);
+ display = m_funcs->get_platform_display(EGL_PLATFORM_DEVICE_EXT, nativeDisplay, nullptr);
} else {
qWarning("EGL_EXT_platform_device not available, falling back to legacy path!");
display = eglGetDisplay(nativeDisplay);
@@ -162,7 +162,7 @@ void QEglFSKmsEglDeviceWindow::resetSurface()
qCDebug(qLcEglfsKmsDebug, "Could not query number of EGLStream FIFO frames");
}
- if (!m_integration->m_funcs->get_output_layers(display, Q_NULLPTR, Q_NULLPTR, 0, &count) || count == 0) {
+ if (!m_integration->m_funcs->get_output_layers(display, nullptr, nullptr, 0, &count) || count == 0) {
qWarning("No output layers found");
return;
}
@@ -172,7 +172,7 @@ void QEglFSKmsEglDeviceWindow::resetSurface()
QVector<EGLOutputLayerEXT> layers;
layers.resize(count);
EGLint actualCount;
- if (!m_integration->m_funcs->get_output_layers(display, Q_NULLPTR, layers.data(), count, &actualCount)) {
+ if (!m_integration->m_funcs->get_output_layers(display, nullptr, layers.data(), count, &actualCount)) {
qWarning("Failed to get layers");
return;
}
@@ -180,7 +180,7 @@ void QEglFSKmsEglDeviceWindow::resetSurface()
QEglFSKmsEglDeviceScreen *cur_screen = static_cast<QEglFSKmsEglDeviceScreen *>(screen());
Q_ASSERT(cur_screen);
QKmsOutput &output(cur_screen->output());
- const uint32_t wantedId = !output.wants_plane ? output.crtc_id : output.plane_id;
+ const uint32_t wantedId = !output.wants_forced_plane ? output.crtc_id : output.forced_plane_id;
qCDebug(qLcEglfsKmsDebug, "Searching for id: %d", wantedId);
EGLOutputLayerEXT layer = EGL_NO_OUTPUT_LAYER_EXT;
diff --git a/src/plugins/platforms/eglfs/deviceintegration/eglfs_kms_egldevice/qeglfskmsegldevicescreen.cpp b/src/plugins/platforms/eglfs/deviceintegration/eglfs_kms_egldevice/qeglfskmsegldevicescreen.cpp
index a27c89faab..531b73d1dc 100644
--- a/src/plugins/platforms/eglfs/deviceintegration/eglfs_kms_egldevice/qeglfskmsegldevicescreen.cpp
+++ b/src/plugins/platforms/eglfs/deviceintegration/eglfs_kms_egldevice/qeglfskmsegldevicescreen.cpp
@@ -105,12 +105,12 @@ void QEglFSKmsEglDeviceScreen::waitForFlip()
qErrnoWarning(errno, "drmModeSetCrtc failed");
}
- if (!op.plane_set) {
- op.plane_set = true;
+ if (!op.forced_plane_set) {
+ op.forced_plane_set = true;
- if (op.wants_plane) {
- qCDebug(qLcEglfsKmsDebug, "Setting plane %u", op.plane_id);
- int ret = drmModeSetPlane(fd, op.plane_id, op.crtc_id, uint32_t(-1), 0,
+ if (op.wants_forced_plane) {
+ qCDebug(qLcEglfsKmsDebug, "Setting plane %u", op.forced_plane_id);
+ int ret = drmModeSetPlane(fd, op.forced_plane_id, op.crtc_id, uint32_t(-1), 0,
0, 0, w, h,
0 << 16, 0 << 16, w << 16, h << 16);
if (ret == -1)
diff --git a/src/plugins/platforms/eglfs/deviceintegration/eglfs_kms_support/qeglfskmsintegration.cpp b/src/plugins/platforms/eglfs/deviceintegration/eglfs_kms_support/qeglfskmsintegration.cpp
index c77151181e..975b1947bf 100644
--- a/src/plugins/platforms/eglfs/deviceintegration/eglfs_kms_support/qeglfskmsintegration.cpp
+++ b/src/plugins/platforms/eglfs/deviceintegration/eglfs_kms_support/qeglfskmsintegration.cpp
@@ -55,7 +55,7 @@ QT_BEGIN_NAMESPACE
Q_LOGGING_CATEGORY(qLcEglfsKmsDebug, "qt.qpa.eglfs.kms")
QEglFSKmsIntegration::QEglFSKmsIntegration()
- : m_device(Q_NULLPTR),
+ : m_device(nullptr),
m_screenConfig(new QKmsScreenConfig)
{
}
@@ -78,7 +78,7 @@ void QEglFSKmsIntegration::platformDestroy()
qCDebug(qLcEglfsKmsDebug, "platformDestroy: Closing DRM device");
m_device->close();
delete m_device;
- m_device = Q_NULLPTR;
+ m_device = nullptr;
}
EGLNativeDisplayType QEglFSKmsIntegration::platformDisplay() const
@@ -133,6 +133,14 @@ bool QEglFSKmsIntegration::supportsPBuffers() const
return m_screenConfig->supportsPBuffers();
}
+void *QEglFSKmsIntegration::nativeResourceForIntegration(const QByteArray &name)
+{
+ if (name == QByteArrayLiteral("dri_fd") && m_device)
+ return (void *) (qintptr) m_device->fd();
+
+ return nullptr;
+}
+
QKmsDevice *QEglFSKmsIntegration::device() const
{
return m_device;
diff --git a/src/plugins/platforms/eglfs/deviceintegration/eglfs_kms_support/qeglfskmsintegration.h b/src/plugins/platforms/eglfs/deviceintegration/eglfs_kms_support/qeglfskmsintegration.h
index 9955616919..26ba2fdaec 100644
--- a/src/plugins/platforms/eglfs/deviceintegration/eglfs_kms_support/qeglfskmsintegration.h
+++ b/src/plugins/platforms/eglfs/deviceintegration/eglfs_kms_support/qeglfskmsintegration.h
@@ -69,6 +69,7 @@ public:
bool hasCapability(QPlatformIntegration::Capability cap) const override;
void waitForVSync(QPlatformSurface *surface) const override;
bool supportsPBuffers() const override;
+ void *nativeResourceForIntegration(const QByteArray &name) override;
QKmsDevice *device() const;
QKmsScreenConfig *screenConfig() const;
diff --git a/src/plugins/platforms/eglfs/deviceintegration/eglfs_kms_support/qeglfskmsscreen.cpp b/src/plugins/platforms/eglfs/deviceintegration/eglfs_kms_support/qeglfskmsscreen.cpp
index 734f5cd611..5e45b42abe 100644
--- a/src/plugins/platforms/eglfs/deviceintegration/eglfs_kms_support/qeglfskmsscreen.cpp
+++ b/src/plugins/platforms/eglfs/deviceintegration/eglfs_kms_support/qeglfskmsscreen.cpp
@@ -1,7 +1,7 @@
/****************************************************************************
**
+** Copyright (C) 2017 The Qt Company Ltd.
** Copyright (C) 2017 Pier Luigi Fiorini <pierluigi.fiorini@gmail.com>
-** Copyright (C) 2016 The Qt Company Ltd.
** Copyright (C) 2016 Pelagicore AG
** Contact: https://www.qt.io/licensing/
**
@@ -68,12 +68,13 @@ private:
QEglFSKmsScreen *m_screen;
};
-QEglFSKmsScreen::QEglFSKmsScreen(QKmsDevice *device, const QKmsOutput &output)
+QEglFSKmsScreen::QEglFSKmsScreen(QKmsDevice *device, const QKmsOutput &output, bool headless)
: QEglFSScreen(static_cast<QEglFSIntegration *>(QGuiApplicationPrivate::platformIntegration())->display())
, m_device(device)
, m_output(output)
, m_powerState(PowerStateOn)
, m_interruptHandler(new QEglFSKmsInterruptHandler(this))
+ , m_headless(headless)
{
m_siblings << this; // gets overridden later
@@ -109,6 +110,9 @@ void QEglFSKmsScreen::setVirtualPosition(const QPoint &pos)
// geometry() calls rawGeometry() and may apply additional transforms.
QRect QEglFSKmsScreen::rawGeometry() const
{
+ if (m_headless)
+ return QRect(QPoint(0, 0), m_device->screenConfig()->headlessSize());
+
const int mode = m_output.mode;
return QRect(m_pos.x(), m_pos.y(),
m_output.modes[mode].hdisplay,
@@ -117,12 +121,30 @@ QRect QEglFSKmsScreen::rawGeometry() const
int QEglFSKmsScreen::depth() const
{
- return 32;
+ return format() == QImage::Format_RGB16 ? 16 : 32;
}
QImage::Format QEglFSKmsScreen::format() const
{
- return QImage::Format_RGB32;
+ // the result can be slightly incorrect, it won't matter in practice
+ switch (m_output.drm_format) {
+ case DRM_FORMAT_ARGB8888:
+ case DRM_FORMAT_ABGR8888:
+ return QImage::Format_ARGB32;
+ case DRM_FORMAT_RGB565:
+ case DRM_FORMAT_BGR565:
+ return QImage::Format_RGB16;
+ case DRM_FORMAT_XRGB2101010:
+ return QImage::Format_RGB30;
+ case DRM_FORMAT_XBGR2101010:
+ return QImage::Format_BGR30;
+ case DRM_FORMAT_ARGB2101010:
+ return QImage::Format_A2RGB30_Premultiplied;
+ case DRM_FORMAT_ABGR2101010:
+ return QImage::Format_A2BGR30_Premultiplied;
+ default:
+ return QImage::Format_RGB32;
+ }
}
QSizeF QEglFSKmsScreen::physicalSize() const
@@ -159,7 +181,7 @@ Qt::ScreenOrientation QEglFSKmsScreen::orientation() const
QString QEglFSKmsScreen::name() const
{
- return m_output.name;
+ return !m_headless ? m_output.name : QStringLiteral("qt_Headless");
}
QString QEglFSKmsScreen::manufacturer() const
@@ -177,22 +199,10 @@ QString QEglFSKmsScreen::serialNumber() const
return m_edid.serialNumber;
}
-void QEglFSKmsScreen::destroySurface()
-{
-}
-
void QEglFSKmsScreen::waitForFlip()
{
}
-void QEglFSKmsScreen::flip()
-{
-}
-
-void QEglFSKmsScreen::flipFinished()
-{
-}
-
void QEglFSKmsScreen::restoreMode()
{
m_output.restoreMode(m_device);
@@ -200,6 +210,9 @@ void QEglFSKmsScreen::restoreMode()
qreal QEglFSKmsScreen::refreshRate() const
{
+ if (m_headless)
+ return 60;
+
quint32 refresh = m_output.modes[m_output.mode].vrefresh;
return refresh > 0 ? refresh : 60;
}
diff --git a/src/plugins/platforms/eglfs/deviceintegration/eglfs_kms_support/qeglfskmsscreen.h b/src/plugins/platforms/eglfs/deviceintegration/eglfs_kms_support/qeglfskmsscreen.h
index 4e09929189..7f395aacb7 100644
--- a/src/plugins/platforms/eglfs/deviceintegration/eglfs_kms_support/qeglfskmsscreen.h
+++ b/src/plugins/platforms/eglfs/deviceintegration/eglfs_kms_support/qeglfskmsscreen.h
@@ -56,7 +56,7 @@ class QEglFSKmsInterruptHandler;
class Q_EGLFS_EXPORT QEglFSKmsScreen : public QEglFSScreen
{
public:
- QEglFSKmsScreen(QKmsDevice *device, const QKmsOutput &output);
+ QEglFSKmsScreen(QKmsDevice *device, const QKmsOutput &output, bool headless = false);
~QEglFSKmsScreen();
void setVirtualPosition(const QPoint &pos);
@@ -89,11 +89,7 @@ public:
QKmsDevice *device() const { return m_device; }
- void destroySurface();
-
virtual void waitForFlip();
- virtual void flip();
- virtual void flipFinished();
QKmsOutput &output() { return m_output; }
void restoreMode();
@@ -115,6 +111,8 @@ protected:
PowerState m_powerState;
QEglFSKmsInterruptHandler *m_interruptHandler;
+
+ bool m_headless;
};
QT_END_NAMESPACE
diff --git a/src/plugins/platforms/haiku/main.cpp b/src/plugins/platforms/haiku/main.cpp
index 02168d0165..841891970d 100644
--- a/src/plugins/platforms/haiku/main.cpp
+++ b/src/plugins/platforms/haiku/main.cpp
@@ -47,7 +47,7 @@ QPlatformIntegration *QHaikuIntegrationPlugin::create(const QString& system, con
if (!system.compare(QLatin1String("haiku"), Qt::CaseInsensitive))
return new QHaikuIntegration(paramList);
- return Q_NULLPTR;
+ return nullptr;
}
QT_END_NAMESPACE
diff --git a/src/plugins/platforms/haiku/main.h b/src/plugins/platforms/haiku/main.h
index 82f3313652..e316b79d7c 100644
--- a/src/plugins/platforms/haiku/main.h
+++ b/src/plugins/platforms/haiku/main.h
@@ -47,7 +47,7 @@ class QHaikuIntegrationPlugin : public QPlatformIntegrationPlugin
Q_PLUGIN_METADATA(IID QPlatformIntegrationFactoryInterface_iid FILE "haiku.json")
public:
- QPlatformIntegration *create(const QString&, const QStringList&) Q_DECL_OVERRIDE;
+ QPlatformIntegration *create(const QString&, const QStringList&) override;
};
QT_END_NAMESPACE
diff --git a/src/plugins/platforms/haiku/qhaikuapplication.h b/src/plugins/platforms/haiku/qhaikuapplication.h
index 0696df8109..a9ea442691 100644
--- a/src/plugins/platforms/haiku/qhaikuapplication.h
+++ b/src/plugins/platforms/haiku/qhaikuapplication.h
@@ -49,8 +49,8 @@ class QHaikuApplication : public BApplication
public:
explicit QHaikuApplication(const char *signature);
- bool QuitRequested() Q_DECL_OVERRIDE;
- void RefsReceived(BMessage* message) Q_DECL_OVERRIDE;
+ bool QuitRequested() override;
+ void RefsReceived(BMessage* message) override;
};
#endif
diff --git a/src/plugins/platforms/haiku/qhaikubuffer.cpp b/src/plugins/platforms/haiku/qhaikubuffer.cpp
index c6f6ffe6bc..f25ddef86b 100644
--- a/src/plugins/platforms/haiku/qhaikubuffer.cpp
+++ b/src/plugins/platforms/haiku/qhaikubuffer.cpp
@@ -45,7 +45,7 @@
QT_BEGIN_NAMESPACE
QHaikuBuffer::QHaikuBuffer()
- : m_buffer(Q_NULLPTR)
+ : m_buffer(nullptr)
{
}
@@ -63,12 +63,12 @@ BBitmap* QHaikuBuffer::nativeBuffer() const
const QImage *QHaikuBuffer::image() const
{
- return (m_buffer != Q_NULLPTR) ? &m_image : Q_NULLPTR;
+ return (m_buffer != nullptr) ? &m_image : nullptr;
}
QImage *QHaikuBuffer::image()
{
- return (m_buffer != Q_NULLPTR) ? &m_image : Q_NULLPTR;
+ return (m_buffer != nullptr) ? &m_image : nullptr;
}
QRect QHaikuBuffer::rect() const
diff --git a/src/plugins/platforms/haiku/qhaikuclipboard.cpp b/src/plugins/platforms/haiku/qhaikuclipboard.cpp
index 774da4432a..20519e21d0 100644
--- a/src/plugins/platforms/haiku/qhaikuclipboard.cpp
+++ b/src/plugins/platforms/haiku/qhaikuclipboard.cpp
@@ -47,8 +47,8 @@
#include <Clipboard.h>
QHaikuClipboard::QHaikuClipboard()
- : m_systemMimeData(Q_NULLPTR)
- , m_userMimeData(Q_NULLPTR)
+ : m_systemMimeData(nullptr)
+ , m_userMimeData(nullptr)
{
if (be_clipboard)
be_clipboard->StartWatching(BMessenger(this));
@@ -81,12 +81,12 @@ QMimeData *QHaikuClipboard::mimeData(QClipboard::Mode mode)
const BMessage *clipboard = be_clipboard->Data();
if (clipboard) {
- char *name = Q_NULLPTR;
+ char *name = nullptr;
uint32 type = 0;
int32 count = 0;
for (int i = 0; clipboard->GetInfo(B_MIME_TYPE, i, &name, &type, &count) == B_OK; i++) {
- const void *data = Q_NULLPTR;
+ const void *data = nullptr;
int32 dataLen = 0;
const status_t status = clipboard->FindData(name, B_MIME_TYPE, &data, &dataLen);
@@ -162,7 +162,7 @@ void QHaikuClipboard::MessageReceived(BMessage* message)
{
if (message->what == B_CLIPBOARD_CHANGED) {
delete m_userMimeData;
- m_userMimeData = Q_NULLPTR;
+ m_userMimeData = nullptr;
emitChanged(QClipboard::Clipboard);
}
diff --git a/src/plugins/platforms/haiku/qhaikuclipboard.h b/src/plugins/platforms/haiku/qhaikuclipboard.h
index 3dd4496e8d..b6eb3f591f 100644
--- a/src/plugins/platforms/haiku/qhaikuclipboard.h
+++ b/src/plugins/platforms/haiku/qhaikuclipboard.h
@@ -54,13 +54,13 @@ public:
QHaikuClipboard();
~QHaikuClipboard();
- QMimeData *mimeData(QClipboard::Mode mode = QClipboard::Clipboard) Q_DECL_OVERRIDE;
- void setMimeData(QMimeData *data, QClipboard::Mode mode = QClipboard::Clipboard) Q_DECL_OVERRIDE;
- bool supportsMode(QClipboard::Mode mode) const Q_DECL_OVERRIDE;
- bool ownsMode(QClipboard::Mode mode) const Q_DECL_OVERRIDE;
+ QMimeData *mimeData(QClipboard::Mode mode = QClipboard::Clipboard) override;
+ void setMimeData(QMimeData *data, QClipboard::Mode mode = QClipboard::Clipboard) override;
+ bool supportsMode(QClipboard::Mode mode) const override;
+ bool ownsMode(QClipboard::Mode mode) const override;
// override from BHandler to catch change notifications from Haiku clipboard
- void MessageReceived(BMessage* message) Q_DECL_OVERRIDE;
+ void MessageReceived(BMessage* message) override;
private:
QMimeData *m_systemMimeData;
diff --git a/src/plugins/platforms/haiku/qhaikucursor.h b/src/plugins/platforms/haiku/qhaikucursor.h
index 5d70c97d9e..73a1d2c492 100644
--- a/src/plugins/platforms/haiku/qhaikucursor.h
+++ b/src/plugins/platforms/haiku/qhaikucursor.h
@@ -52,7 +52,7 @@ public:
QHaikuCursor();
#ifndef QT_NO_CURSOR
- void changeCursor(QCursor *windowCursor, QWindow *window) Q_DECL_OVERRIDE;
+ void changeCursor(QCursor *windowCursor, QWindow *window) override;
#endif
private:
diff --git a/src/plugins/platforms/haiku/qhaikuintegration.cpp b/src/plugins/platforms/haiku/qhaikuintegration.cpp
index d46d77ff18..8bd2171794 100644
--- a/src/plugins/platforms/haiku/qhaikuintegration.cpp
+++ b/src/plugins/platforms/haiku/qhaikuintegration.cpp
@@ -87,13 +87,13 @@ QHaikuIntegration::QHaikuIntegration(const QStringList &parameters)
QHaikuIntegration::~QHaikuIntegration()
{
destroyScreen(m_screen);
- m_screen = Q_NULLPTR;
+ m_screen = nullptr;
delete m_services;
- m_services = Q_NULLPTR;
+ m_services = nullptr;
delete m_clipboard;
- m_clipboard = Q_NULLPTR;
+ m_clipboard = nullptr;
be_app->LockLooper();
be_app->Quit();
diff --git a/src/plugins/platforms/haiku/qhaikuintegration.h b/src/plugins/platforms/haiku/qhaikuintegration.h
index 1b938acb82..5c7a173c91 100644
--- a/src/plugins/platforms/haiku/qhaikuintegration.h
+++ b/src/plugins/platforms/haiku/qhaikuintegration.h
@@ -54,17 +54,17 @@ public:
explicit QHaikuIntegration(const QStringList &paramList);
~QHaikuIntegration();
- bool hasCapability(QPlatformIntegration::Capability cap) const Q_DECL_OVERRIDE;
+ bool hasCapability(QPlatformIntegration::Capability cap) const override;
- QPlatformWindow *createPlatformWindow(QWindow *window) const Q_DECL_OVERRIDE;
- QPlatformBackingStore *createPlatformBackingStore(QWindow *window) const Q_DECL_OVERRIDE;
- QAbstractEventDispatcher *createEventDispatcher() const Q_DECL_OVERRIDE;
+ QPlatformWindow *createPlatformWindow(QWindow *window) const override;
+ QPlatformBackingStore *createPlatformBackingStore(QWindow *window) const override;
+ QAbstractEventDispatcher *createEventDispatcher() const override;
- QPlatformFontDatabase *fontDatabase() const Q_DECL_OVERRIDE;
- QPlatformServices *services() const Q_DECL_OVERRIDE;
+ QPlatformFontDatabase *fontDatabase() const override;
+ QPlatformServices *services() const override;
#ifndef QT_NO_CLIPBOARD
- QPlatformClipboard *clipboard() const Q_DECL_OVERRIDE;
+ QPlatformClipboard *clipboard() const override;
#endif
private:
diff --git a/src/plugins/platforms/haiku/qhaikurasterbackingstore.cpp b/src/plugins/platforms/haiku/qhaikurasterbackingstore.cpp
index ee53f693cd..613ae471cb 100644
--- a/src/plugins/platforms/haiku/qhaikurasterbackingstore.cpp
+++ b/src/plugins/platforms/haiku/qhaikurasterbackingstore.cpp
@@ -47,14 +47,14 @@ QT_BEGIN_NAMESPACE
QHaikuRasterBackingStore::QHaikuRasterBackingStore(QWindow *window)
: QPlatformBackingStore(window)
- , m_bitmap(Q_NULLPTR)
+ , m_bitmap(nullptr)
{
}
QHaikuRasterBackingStore::~QHaikuRasterBackingStore()
{
delete m_bitmap;
- m_bitmap = Q_NULLPTR;
+ m_bitmap = nullptr;
}
QPaintDevice *QHaikuRasterBackingStore::paintDevice()
@@ -62,7 +62,7 @@ QPaintDevice *QHaikuRasterBackingStore::paintDevice()
if (!m_bufferSize.isEmpty() && m_bitmap)
return m_buffer.image();
- return Q_NULLPTR;
+ return nullptr;
}
void QHaikuRasterBackingStore::flush(QWindow *window, const QRegion &region, const QPoint &offset)
diff --git a/src/plugins/platforms/haiku/qhaikurasterbackingstore.h b/src/plugins/platforms/haiku/qhaikurasterbackingstore.h
index 06a46e7eb3..060ab27126 100644
--- a/src/plugins/platforms/haiku/qhaikurasterbackingstore.h
+++ b/src/plugins/platforms/haiku/qhaikurasterbackingstore.h
@@ -55,9 +55,9 @@ public:
explicit QHaikuRasterBackingStore(QWindow *window);
~QHaikuRasterBackingStore();
- QPaintDevice *paintDevice() Q_DECL_OVERRIDE;
- void flush(QWindow *window, const QRegion &region, const QPoint &offset) Q_DECL_OVERRIDE;
- void resize(const QSize &size, const QRegion &staticContents) Q_DECL_OVERRIDE;
+ QPaintDevice *paintDevice() override;
+ void flush(QWindow *window, const QRegion &region, const QPoint &offset) override;
+ void resize(const QSize &size, const QRegion &staticContents) override;
private:
BBitmap *m_bitmap;
diff --git a/src/plugins/platforms/haiku/qhaikurasterwindow.cpp b/src/plugins/platforms/haiku/qhaikurasterwindow.cpp
index 9834b7cbc7..7e57e67bab 100644
--- a/src/plugins/platforms/haiku/qhaikurasterwindow.cpp
+++ b/src/plugins/platforms/haiku/qhaikurasterwindow.cpp
@@ -211,7 +211,7 @@ void HaikuViewProxy::handleKeyEvent(QEvent::Type type, BMessage *message)
{
int32 key = 0;
uint32 code = 0;
- const char *bytes = Q_NULLPTR;
+ const char *bytes = nullptr;
QString text;
if (message) {
@@ -265,7 +265,7 @@ QHaikuRasterWindow::~QHaikuRasterWindow()
m_window->UnlockLooper();
delete m_view;
- m_view = Q_NULLPTR;
+ m_view = nullptr;
}
BView* QHaikuRasterWindow::nativeViewHandle() const
diff --git a/src/plugins/platforms/haiku/qhaikurasterwindow.h b/src/plugins/platforms/haiku/qhaikurasterwindow.h
index ae57e0f0e4..24b13aa122 100644
--- a/src/plugins/platforms/haiku/qhaikurasterwindow.h
+++ b/src/plugins/platforms/haiku/qhaikurasterwindow.h
@@ -51,15 +51,15 @@ class HaikuViewProxy : public QObject, public BView
Q_OBJECT
public:
- explicit HaikuViewProxy(BWindow *window, QObject *parent = Q_NULLPTR);
+ explicit HaikuViewProxy(BWindow *window, QObject *parent = nullptr);
- void MessageReceived(BMessage *message) Q_DECL_OVERRIDE;
- void Draw(BRect updateRect) Q_DECL_OVERRIDE;
- void MouseDown(BPoint pos) Q_DECL_OVERRIDE;
- void MouseUp(BPoint pos) Q_DECL_OVERRIDE;
- void MouseMoved(BPoint pos, uint32 code, const BMessage *dragMessage) Q_DECL_OVERRIDE;
- void KeyDown(const char *bytes, int32 numBytes) Q_DECL_OVERRIDE;
- void KeyUp(const char *bytes, int32 numBytes) Q_DECL_OVERRIDE;
+ void MessageReceived(BMessage *message) override;
+ void Draw(BRect updateRect) override;
+ void MouseDown(BPoint pos) override;
+ void MouseUp(BPoint pos) override;
+ void MouseMoved(BPoint pos, uint32 code, const BMessage *dragMessage) override;
+ void KeyDown(const char *bytes, int32 numBytes) override;
+ void KeyUp(const char *bytes, int32 numBytes) override;
Q_SIGNALS:
void mouseEvent(const QPoint &localPosition, const QPoint &globalPosition, Qt::MouseButtons buttons, Qt::KeyboardModifiers modifiers, Qt::MouseEventSource source);
diff --git a/src/plugins/platforms/haiku/qhaikuscreen.cpp b/src/plugins/platforms/haiku/qhaikuscreen.cpp
index 54951a0af5..2c8abba8aa 100644
--- a/src/plugins/platforms/haiku/qhaikuscreen.cpp
+++ b/src/plugins/platforms/haiku/qhaikuscreen.cpp
@@ -58,10 +58,10 @@ QHaikuScreen::QHaikuScreen()
QHaikuScreen::~QHaikuScreen()
{
delete m_cursor;
- m_cursor = Q_NULLPTR;
+ m_cursor = nullptr;
delete m_screen;
- m_screen = Q_NULLPTR;
+ m_screen = nullptr;
}
QPixmap QHaikuScreen::grabWindow(WId winId, int x, int y, int width, int height) const
@@ -69,8 +69,8 @@ QPixmap QHaikuScreen::grabWindow(WId winId, int x, int y, int width, int height)
if (width == 0 || height == 0)
return QPixmap();
- BScreen screen(Q_NULLPTR);
- BBitmap *bitmap = Q_NULLPTR;
+ BScreen screen(nullptr);
+ BBitmap *bitmap = nullptr;
screen.GetBitmap(&bitmap);
const BRect frame = (winId ? ((BWindow*)winId)->Frame() : screen.Frame());
diff --git a/src/plugins/platforms/haiku/qhaikuscreen.h b/src/plugins/platforms/haiku/qhaikuscreen.h
index 49fa3f0a60..98de6fdd03 100644
--- a/src/plugins/platforms/haiku/qhaikuscreen.h
+++ b/src/plugins/platforms/haiku/qhaikuscreen.h
@@ -53,13 +53,13 @@ public:
QHaikuScreen();
~QHaikuScreen();
- QPixmap grabWindow(WId window, int x, int y, int width, int height) const Q_DECL_OVERRIDE;
+ QPixmap grabWindow(WId window, int x, int y, int width, int height) const override;
- QRect geometry() const Q_DECL_OVERRIDE;
- int depth() const Q_DECL_OVERRIDE;
- QImage::Format format() const Q_DECL_OVERRIDE;
+ QRect geometry() const override;
+ int depth() const override;
+ QImage::Format format() const override;
- QPlatformCursor *cursor() const Q_DECL_OVERRIDE;
+ QPlatformCursor *cursor() const override;
private:
BScreen *m_screen;
diff --git a/src/plugins/platforms/haiku/qhaikuservices.h b/src/plugins/platforms/haiku/qhaikuservices.h
index a210eb8b61..59ff6395fb 100644
--- a/src/plugins/platforms/haiku/qhaikuservices.h
+++ b/src/plugins/platforms/haiku/qhaikuservices.h
@@ -47,10 +47,10 @@ QT_BEGIN_NAMESPACE
class QHaikuServices : public QPlatformServices
{
public:
- bool openUrl(const QUrl &url) Q_DECL_OVERRIDE;
- bool openDocument(const QUrl &url) Q_DECL_OVERRIDE;
+ bool openUrl(const QUrl &url) override;
+ bool openDocument(const QUrl &url) override;
- QByteArray desktopEnvironment() const Q_DECL_OVERRIDE;
+ QByteArray desktopEnvironment() const override;
};
QT_END_NAMESPACE
diff --git a/src/plugins/platforms/haiku/qhaikuwindow.cpp b/src/plugins/platforms/haiku/qhaikuwindow.cpp
index 4bea7f7ff6..f8fdf3f92d 100644
--- a/src/plugins/platforms/haiku/qhaikuwindow.cpp
+++ b/src/plugins/platforms/haiku/qhaikuwindow.cpp
@@ -118,12 +118,12 @@ void HaikuWindowProxy::zoomByQt()
QHaikuWindow::QHaikuWindow(QWindow *window)
: QPlatformWindow(window)
- , m_window(Q_NULLPTR)
+ , m_window(nullptr)
, m_windowState(Qt::WindowNoState)
{
const QRect rect = initialGeometry(window, window->geometry(), DefaultWindowWidth, DefaultWindowHeight);
- HaikuWindowProxy *haikuWindow = new HaikuWindowProxy(window, rect, Q_NULLPTR);
+ HaikuWindowProxy *haikuWindow = new HaikuWindowProxy(window, rect, nullptr);
connect(haikuWindow, SIGNAL(moved(QPoint)), SLOT(haikuWindowMoved(QPoint)));
connect(haikuWindow, SIGNAL(resized(QSize,bool)), SLOT(haikuWindowResized(QSize,bool)));
connect(haikuWindow, SIGNAL(windowActivated(bool)), SLOT(haikuWindowActivated(bool)));
@@ -145,7 +145,7 @@ QHaikuWindow::~QHaikuWindow()
m_window->LockLooper();
m_window->Quit();
- m_window = Q_NULLPTR;
+ m_window = nullptr;
}
void QHaikuWindow::setGeometry(const QRect &rect)
@@ -330,7 +330,7 @@ void QHaikuWindow::haikuWindowResized(const QSize &size, bool zoomInProgress)
void QHaikuWindow::haikuWindowActivated(bool activated)
{
- QWindowSystemInterface::handleWindowActivated(activated ? window() : Q_NULLPTR);
+ QWindowSystemInterface::handleWindowActivated(activated ? window() : nullptr);
}
void QHaikuWindow::haikuWindowMinimized(bool minimize)
diff --git a/src/plugins/platforms/haiku/qhaikuwindow.h b/src/plugins/platforms/haiku/qhaikuwindow.h
index 5bfb99e532..bb57742087 100644
--- a/src/plugins/platforms/haiku/qhaikuwindow.h
+++ b/src/plugins/platforms/haiku/qhaikuwindow.h
@@ -51,14 +51,14 @@ class HaikuWindowProxy : public QObject, public BWindow
Q_OBJECT
public:
- explicit HaikuWindowProxy(QWindow *window, const QRect &rect, QObject *parent = Q_NULLPTR);
+ explicit HaikuWindowProxy(QWindow *window, const QRect &rect, QObject *parent = nullptr);
- void FrameMoved(BPoint pos) Q_DECL_OVERRIDE;
- void FrameResized(float width, float height) Q_DECL_OVERRIDE;
- void WindowActivated(bool activated) Q_DECL_OVERRIDE;
- void Minimize(bool minimize) Q_DECL_OVERRIDE;
- void Zoom(BPoint pos, float width, float height) Q_DECL_OVERRIDE;
- bool QuitRequested() Q_DECL_OVERRIDE;
+ void FrameMoved(BPoint pos) override;
+ void FrameResized(float width, float height) override;
+ void WindowActivated(bool activated) override;
+ void Minimize(bool minimize) override;
+ void Zoom(BPoint pos, float width, float height) override;
+ bool QuitRequested() override;
void zoomByQt();
@@ -83,23 +83,23 @@ public:
explicit QHaikuWindow(QWindow *window);
virtual ~QHaikuWindow();
- void setGeometry(const QRect &rect) Q_DECL_OVERRIDE;
- QMargins frameMargins() const Q_DECL_OVERRIDE;
- void setVisible(bool visible) Q_DECL_OVERRIDE;
+ void setGeometry(const QRect &rect) override;
+ QMargins frameMargins() const override;
+ void setVisible(bool visible) override;
- bool isExposed() const Q_DECL_OVERRIDE;
- bool isActive() const Q_DECL_OVERRIDE;
+ bool isExposed() const override;
+ bool isActive() const override;
- WId winId() const Q_DECL_OVERRIDE;
+ WId winId() const override;
BWindow* nativeHandle() const;
- void requestActivateWindow() Q_DECL_OVERRIDE;
- void setWindowState(Qt::WindowStates state) Q_DECL_OVERRIDE;
- void setWindowFlags(Qt::WindowFlags flags) Q_DECL_OVERRIDE;
+ void requestActivateWindow() override;
+ void setWindowState(Qt::WindowStates state) override;
+ void setWindowFlags(Qt::WindowFlags flags) override;
- void setWindowTitle(const QString &title) Q_DECL_OVERRIDE;
+ void setWindowTitle(const QString &title) override;
- void propagateSizeHints() Q_DECL_OVERRIDE;
+ void propagateSizeHints() override;
protected:
HaikuWindowProxy *m_window;
diff --git a/src/plugins/platforms/integrity/main.cpp b/src/plugins/platforms/integrity/main.cpp
index f75e227335..6313aa47e5 100644
--- a/src/plugins/platforms/integrity/main.cpp
+++ b/src/plugins/platforms/integrity/main.cpp
@@ -47,7 +47,7 @@ class QIntegrityFbIntegrationPlugin : public QPlatformIntegrationPlugin
Q_OBJECT
Q_PLUGIN_METADATA(IID QPlatformIntegrationFactoryInterface_iid FILE "integrity.json")
public:
- QPlatformIntegration *create(const QString&, const QStringList&) Q_DECL_OVERRIDE;
+ QPlatformIntegration *create(const QString&, const QStringList&) override;
};
QPlatformIntegration* QIntegrityFbIntegrationPlugin::create(const QString& system, const QStringList& paramList)
diff --git a/src/plugins/platforms/integrity/qintegrityfbintegration.h b/src/plugins/platforms/integrity/qintegrityfbintegration.h
index a954dc2356..d0cd5417ab 100644
--- a/src/plugins/platforms/integrity/qintegrityfbintegration.h
+++ b/src/plugins/platforms/integrity/qintegrityfbintegration.h
@@ -54,19 +54,19 @@ public:
QIntegrityFbIntegration(const QStringList &paramList);
~QIntegrityFbIntegration();
- void initialize() Q_DECL_OVERRIDE;
- bool hasCapability(QPlatformIntegration::Capability cap) const Q_DECL_OVERRIDE;
+ void initialize() override;
+ bool hasCapability(QPlatformIntegration::Capability cap) const override;
- QPlatformWindow *createPlatformWindow(QWindow *window) const Q_DECL_OVERRIDE;
- QPlatformBackingStore *createPlatformBackingStore(QWindow *window) const Q_DECL_OVERRIDE;
+ QPlatformWindow *createPlatformWindow(QWindow *window) const override;
+ QPlatformBackingStore *createPlatformBackingStore(QWindow *window) const override;
- QAbstractEventDispatcher *createEventDispatcher() const Q_DECL_OVERRIDE;
+ QAbstractEventDispatcher *createEventDispatcher() const override;
- QPlatformFontDatabase *fontDatabase() const Q_DECL_OVERRIDE;
- QPlatformServices *services() const Q_DECL_OVERRIDE;
- QPlatformInputContext *inputContext() const Q_DECL_OVERRIDE { return m_inputContext; }
+ QPlatformFontDatabase *fontDatabase() const override;
+ QPlatformServices *services() const override;
+ QPlatformInputContext *inputContext() const override { return m_inputContext; }
- QPlatformNativeInterface *nativeInterface() const Q_DECL_OVERRIDE;
+ QPlatformNativeInterface *nativeInterface() const override;
QList<QPlatformScreen *> screens() const;
diff --git a/src/plugins/platforms/integrity/qintegrityfbscreen.cpp b/src/plugins/platforms/integrity/qintegrityfbscreen.cpp
index 3979937955..d64b96ca4c 100644
--- a/src/plugins/platforms/integrity/qintegrityfbscreen.cpp
+++ b/src/plugins/platforms/integrity/qintegrityfbscreen.cpp
@@ -204,15 +204,14 @@ QRegion QIntegrityFbScreen::doRedraw()
if (!mBlitter)
mBlitter = new QPainter(&mFbScreenImage);
- QVector<QRect> rects = touched.rects();
- for (int i = 0; i < rects.size(); i++) {
+ for (QRect rect : touched) {
FBRect fbrect = {
- (uint32_t)rects[i].left(),
- (uint32_t)rects[i].top(),
- (uint32_t)rects[i].width(),
- (uint32_t)rects[i].height()
+ (uint32_t)rect.left(),
+ (uint32_t)rect.top(),
+ (uint32_t)rect.width(),
+ (uint32_t)rect.height()
};
- mBlitter->drawImage(rects[i], mScreenImage, rects[i]);
+ mBlitter->drawImage(rect, mScreenImage, rect);
gh_FB_expose(mFbh, &fbrect, NULL);
}
return touched;
diff --git a/src/plugins/platforms/integrity/qintegrityfbscreen.h b/src/plugins/platforms/integrity/qintegrityfbscreen.h
index 6bc78913c9..c38b4f073d 100644
--- a/src/plugins/platforms/integrity/qintegrityfbscreen.h
+++ b/src/plugins/platforms/integrity/qintegrityfbscreen.h
@@ -57,9 +57,9 @@ public:
bool initialize();
- QPixmap grabWindow(WId wid, int x, int y, int width, int height) const Q_DECL_OVERRIDE;
+ QPixmap grabWindow(WId wid, int x, int y, int width, int height) const override;
- QRegion doRedraw() Q_DECL_OVERRIDE;
+ QRegion doRedraw() override;
private:
QStringList mArgs;
diff --git a/src/plugins/platforms/integrity/qintegrityhidmanager.cpp b/src/plugins/platforms/integrity/qintegrityhidmanager.cpp
index 49583735f5..3570b90134 100644
--- a/src/plugins/platforms/integrity/qintegrityhidmanager.cpp
+++ b/src/plugins/platforms/integrity/qintegrityhidmanager.cpp
@@ -73,8 +73,8 @@ public:
{
CheckSuccess(gh_hid_close(handle));
};
- void process_event(void) Q_DECL_OVERRIDE;
- void async_wait(void) Q_DECL_OVERRIDE;
+ void process_event(void) override;
+ void async_wait(void) override;
HIDDriver *get_driver(void) { return driver; };
HIDHandle get_handle(void) { return handle; };
private:
@@ -92,8 +92,8 @@ public:
{
qDeleteAll(devices);
};
- void process_event(void) Q_DECL_OVERRIDE;
- void async_wait(void) Q_DECL_OVERRIDE;
+ void process_event(void) override;
+ void async_wait(void) override;
void find_devices(void);
private:
QHash<Value, HIDDeviceHandler *> devices;
diff --git a/src/plugins/platforms/ios/optional/nsphotolibrarysupport/qiosfileengineassetslibrary.mm b/src/plugins/platforms/ios/optional/nsphotolibrarysupport/qiosfileengineassetslibrary.mm
index bea2897240..54152aebf7 100644
--- a/src/plugins/platforms/ios/optional/nsphotolibrarysupport/qiosfileengineassetslibrary.mm
+++ b/src/plugins/platforms/ios/optional/nsphotolibrarysupport/qiosfileengineassetslibrary.mm
@@ -302,7 +302,7 @@ public:
g_iteratorCurrentUrl.setLocalData(QString());
}
- QString next() Q_DECL_OVERRIDE
+ QString next() override
{
// Cache the URL that we are about to return, since QDir will immediately create a
// new file engine on the file and ask if it exists. Unless we do this, we end up
@@ -314,17 +314,17 @@ public:
return url;
}
- bool hasNext() const Q_DECL_OVERRIDE
+ bool hasNext() const override
{
return m_enumerator->hasNext();
}
- QString currentFileName() const Q_DECL_OVERRIDE
+ QString currentFileName() const override
{
return g_iteratorCurrentUrl.localData();
}
- QFileInfo currentFileInfo() const Q_DECL_OVERRIDE
+ QFileInfo currentFileInfo() const override
{
return QFileInfo(currentFileName());
}
diff --git a/src/plugins/platforms/ios/qiosbackingstore.h b/src/plugins/platforms/ios/qiosbackingstore.h
index e6b890251a..38006ba90b 100644
--- a/src/plugins/platforms/ios/qiosbackingstore.h
+++ b/src/plugins/platforms/ios/qiosbackingstore.h
@@ -54,7 +54,7 @@ public:
QIOSBackingStore(QWindow *window);
~QIOSBackingStore();
- void flush(QWindow *window, const QRegion &region, const QPoint &offset) Q_DECL_OVERRIDE;
+ void flush(QWindow *window, const QRegion &region, const QPoint &offset) override;
};
QT_END_NAMESPACE
diff --git a/src/plugins/platforms/ios/qiosclipboard.h b/src/plugins/platforms/ios/qiosclipboard.h
index f3ccfcace0..3fe9b29b71 100644
--- a/src/plugins/platforms/ios/qiosclipboard.h
+++ b/src/plugins/platforms/ios/qiosclipboard.h
@@ -58,10 +58,10 @@ public:
QIOSClipboard();
~QIOSClipboard();
- QMimeData *mimeData(QClipboard::Mode mode = QClipboard::Clipboard) Q_DECL_OVERRIDE;
- void setMimeData(QMimeData *mimeData, QClipboard::Mode mode = QClipboard::Clipboard) Q_DECL_OVERRIDE;
- bool supportsMode(QClipboard::Mode mode) const Q_DECL_OVERRIDE;
- bool ownsMode(QClipboard::Mode mode) const Q_DECL_OVERRIDE;
+ QMimeData *mimeData(QClipboard::Mode mode = QClipboard::Clipboard) override;
+ void setMimeData(QMimeData *mimeData, QClipboard::Mode mode = QClipboard::Clipboard) override;
+ bool supportsMode(QClipboard::Mode mode) const override;
+ bool ownsMode(QClipboard::Mode mode) const override;
private:
QUIClipboard *m_clipboard;
diff --git a/src/plugins/platforms/ios/qiosclipboard.mm b/src/plugins/platforms/ios/qiosclipboard.mm
index 15deb3332e..9a975eadc9 100644
--- a/src/plugins/platforms/ios/qiosclipboard.mm
+++ b/src/plugins/platforms/ios/qiosclipboard.mm
@@ -138,8 +138,8 @@ public:
QIOSMimeData(QClipboard::Mode mode) : QMimeData(), m_mode(mode) { }
~QIOSMimeData() { }
- QStringList formats() const Q_DECL_OVERRIDE;
- QVariant retrieveData(const QString &mimeType, QVariant::Type type) const Q_DECL_OVERRIDE;
+ QStringList formats() const override;
+ QVariant retrieveData(const QString &mimeType, QVariant::Type type) const override;
private:
const QClipboard::Mode m_mode;
diff --git a/src/plugins/platforms/ios/qioscontext.h b/src/plugins/platforms/ios/qioscontext.h
index ce50eff1d9..a2595877dc 100644
--- a/src/plugins/platforms/ios/qioscontext.h
+++ b/src/plugins/platforms/ios/qioscontext.h
@@ -57,18 +57,18 @@ public:
QIOSContext(QOpenGLContext *context);
~QIOSContext();
- QSurfaceFormat format() const Q_DECL_OVERRIDE;
+ QSurfaceFormat format() const override;
- void swapBuffers(QPlatformSurface *surface) Q_DECL_OVERRIDE;
+ void swapBuffers(QPlatformSurface *surface) override;
- bool makeCurrent(QPlatformSurface *surface) Q_DECL_OVERRIDE;
- void doneCurrent() Q_DECL_OVERRIDE;
+ bool makeCurrent(QPlatformSurface *surface) override;
+ void doneCurrent() override;
- GLuint defaultFramebufferObject(QPlatformSurface *) const Q_DECL_OVERRIDE;
- QFunctionPointer getProcAddress(const char *procName) Q_DECL_OVERRIDE;
+ GLuint defaultFramebufferObject(QPlatformSurface *) const override;
+ QFunctionPointer getProcAddress(const char *procName) override;
- bool isSharing() const Q_DECL_OVERRIDE;
- bool isValid() const Q_DECL_OVERRIDE;
+ bool isSharing() const override;
+ bool isValid() const override;
private Q_SLOTS:
void windowDestroyed(QObject *object);
diff --git a/src/plugins/platforms/ios/qioseventdispatcher.h b/src/plugins/platforms/ios/qioseventdispatcher.h
index c1442ed1e8..62133b9510 100644
--- a/src/plugins/platforms/ios/qioseventdispatcher.h
+++ b/src/plugins/platforms/ios/qioseventdispatcher.h
@@ -51,8 +51,8 @@ class QIOSEventDispatcher : public QEventDispatcherCoreFoundation
public:
explicit QIOSEventDispatcher(QObject *parent = 0);
- bool processEvents(QEventLoop::ProcessEventsFlags flags) Q_DECL_OVERRIDE;
- bool processPostedEvents() Q_DECL_OVERRIDE;
+ bool processEvents(QEventLoop::ProcessEventsFlags flags) override;
+ bool processPostedEvents() override;
void handleRunLoopExit(CFRunLoopActivity activity);
diff --git a/src/plugins/platforms/ios/qiosfiledialog.h b/src/plugins/platforms/ios/qiosfiledialog.h
index 0b56bd20bf..5cb1b45e20 100644
--- a/src/plugins/platforms/ios/qiosfiledialog.h
+++ b/src/plugins/platforms/ios/qiosfiledialog.h
@@ -53,17 +53,17 @@ public:
QIOSFileDialog();
~QIOSFileDialog();
- void exec() Q_DECL_OVERRIDE;
- bool defaultNameFilterDisables() const Q_DECL_OVERRIDE { return false; }
- bool show(Qt::WindowFlags windowFlags, Qt::WindowModality windowModality, QWindow *parent) Q_DECL_OVERRIDE;
- void hide() Q_DECL_OVERRIDE;
- void setDirectory(const QUrl &) Q_DECL_OVERRIDE {}
- QUrl directory() const Q_DECL_OVERRIDE { return QUrl(); }
- void selectFile(const QUrl &) Q_DECL_OVERRIDE {}
- QList<QUrl> selectedFiles() const Q_DECL_OVERRIDE;
- void setFilter() Q_DECL_OVERRIDE {}
- void selectNameFilter(const QString &) Q_DECL_OVERRIDE {}
- QString selectedNameFilter() const Q_DECL_OVERRIDE { return QString(); }
+ void exec() override;
+ bool defaultNameFilterDisables() const override { return false; }
+ bool show(Qt::WindowFlags windowFlags, Qt::WindowModality windowModality, QWindow *parent) override;
+ void hide() override;
+ void setDirectory(const QUrl &) override {}
+ QUrl directory() const override { return QUrl(); }
+ void selectFile(const QUrl &) override {}
+ QList<QUrl> selectedFiles() const override;
+ void setFilter() override {}
+ void selectNameFilter(const QString &) override {}
+ QString selectedNameFilter() const override { return QString(); }
void selectedFilesChanged(QList<QUrl> selection);
diff --git a/src/plugins/platforms/ios/qiosfiledialog.mm b/src/plugins/platforms/ios/qiosfiledialog.mm
index c5722d33f8..5987bc1540 100644
--- a/src/plugins/platforms/ios/qiosfiledialog.mm
+++ b/src/plugins/platforms/ios/qiosfiledialog.mm
@@ -48,7 +48,7 @@
#include "qiosoptionalplugininterface.h"
QIOSFileDialog::QIOSFileDialog()
- : m_viewController(Q_NULLPTR)
+ : m_viewController(nullptr)
{
}
@@ -112,7 +112,7 @@ void QIOSFileDialog::hide()
[m_viewController dismissViewControllerAnimated:YES completion:nil];
[m_viewController release];
- m_viewController = Q_NULLPTR;
+ m_viewController = nullptr;
m_eventLoop.exit();
}
diff --git a/src/plugins/platforms/ios/qiosinputcontext.h b/src/plugins/platforms/ios/qiosinputcontext.h
index 966d1a7e80..255cf8bca9 100644
--- a/src/plugins/platforms/ios/qiosinputcontext.h
+++ b/src/plugins/platforms/ios/qiosinputcontext.h
@@ -88,24 +88,24 @@ public:
QIOSInputContext();
~QIOSInputContext();
- bool isValid() const Q_DECL_OVERRIDE { return true; }
+ bool isValid() const override { return true; }
- void showInputPanel() Q_DECL_OVERRIDE;
- void hideInputPanel() Q_DECL_OVERRIDE;
+ void showInputPanel() override;
+ void hideInputPanel() override;
- bool isInputPanelVisible() const Q_DECL_OVERRIDE;
- bool isAnimating() const Q_DECL_OVERRIDE;
- QRectF keyboardRect() const Q_DECL_OVERRIDE;
+ bool isInputPanelVisible() const override;
+ bool isAnimating() const override;
+ QRectF keyboardRect() const override;
- void update(Qt::InputMethodQueries) Q_DECL_OVERRIDE;
- void reset() Q_DECL_OVERRIDE;
- void commit() Q_DECL_OVERRIDE;
+ void update(Qt::InputMethodQueries) override;
+ void reset() override;
+ void commit() override;
- QLocale locale() const Q_DECL_OVERRIDE;
+ QLocale locale() const override;
void clearCurrentFocusObject();
- void setFocusObject(QObject *object) Q_DECL_OVERRIDE;
+ void setFocusObject(QObject *object) override;
void focusWindowChanged(QWindow *focusWindow);
void scrollToCursor();
diff --git a/src/plugins/platforms/ios/qiosintegration.h b/src/plugins/platforms/ios/qiosintegration.h
index 522cc032ff..6be8855020 100644
--- a/src/plugins/platforms/ios/qiosintegration.h
+++ b/src/plugins/platforms/ios/qiosintegration.h
@@ -62,45 +62,45 @@ public:
QIOSIntegration();
~QIOSIntegration();
- bool hasCapability(Capability cap) const Q_DECL_OVERRIDE;
+ bool hasCapability(Capability cap) const override;
- QPlatformWindow *createPlatformWindow(QWindow *window) const Q_DECL_OVERRIDE;
- QPlatformBackingStore *createPlatformBackingStore(QWindow *window) const Q_DECL_OVERRIDE;
+ QPlatformWindow *createPlatformWindow(QWindow *window) const override;
+ QPlatformBackingStore *createPlatformBackingStore(QWindow *window) const override;
- QPlatformOpenGLContext *createPlatformOpenGLContext(QOpenGLContext *context) const Q_DECL_OVERRIDE;
- QPlatformOffscreenSurface *createPlatformOffscreenSurface(QOffscreenSurface *surface) const Q_DECL_OVERRIDE;
+ QPlatformOpenGLContext *createPlatformOpenGLContext(QOpenGLContext *context) const override;
+ QPlatformOffscreenSurface *createPlatformOffscreenSurface(QOffscreenSurface *surface) const override;
- QPlatformFontDatabase *fontDatabase() const Q_DECL_OVERRIDE;
+ QPlatformFontDatabase *fontDatabase() const override;
#ifndef QT_NO_CLIPBOARD
- QPlatformClipboard *clipboard() const Q_DECL_OVERRIDE;
+ QPlatformClipboard *clipboard() const override;
#endif
- QPlatformInputContext *inputContext() const Q_DECL_OVERRIDE;
- QPlatformServices *services() const Q_DECL_OVERRIDE;
+ QPlatformInputContext *inputContext() const override;
+ QPlatformServices *services() const override;
- QVariant styleHint(StyleHint hint) const Q_DECL_OVERRIDE;
+ QVariant styleHint(StyleHint hint) const override;
- QStringList themeNames() const Q_DECL_OVERRIDE;
- QPlatformTheme *createPlatformTheme(const QString &name) const Q_DECL_OVERRIDE;
+ QStringList themeNames() const override;
+ QPlatformTheme *createPlatformTheme(const QString &name) const override;
- QAbstractEventDispatcher *createEventDispatcher() const Q_DECL_OVERRIDE;
- QPlatformNativeInterface *nativeInterface() const Q_DECL_OVERRIDE;
+ QAbstractEventDispatcher *createEventDispatcher() const override;
+ QPlatformNativeInterface *nativeInterface() const override;
QTouchDevice *touchDevice();
#ifndef QT_NO_ACCESSIBILITY
- QPlatformAccessibility *accessibility() const Q_DECL_OVERRIDE;
+ QPlatformAccessibility *accessibility() const override;
#endif
// Called from Objective-C class QIOSScreenTracker, which can't be friended
void addScreen(QPlatformScreen *screen) { screenAdded(screen); }
void destroyScreen(QPlatformScreen *screen) { QPlatformIntegration::destroyScreen(screen); }
- void beep() const Q_DECL_OVERRIDE;
+ void beep() const override;
static QIOSIntegration *instance();
// -- QPlatformNativeInterface --
- void *nativeResourceForWindow(const QByteArray &resource, QWindow *window) Q_DECL_OVERRIDE;
+ void *nativeResourceForWindow(const QByteArray &resource, QWindow *window) override;
QFactoryLoader *optionalPlugins() { return m_optionalPlugins; }
diff --git a/src/plugins/platforms/ios/qiosintegration.mm b/src/plugins/platforms/ios/qiosintegration.mm
index 94a30eb931..92c1e39d72 100644
--- a/src/plugins/platforms/ios/qiosintegration.mm
+++ b/src/plugins/platforms/ios/qiosintegration.mm
@@ -118,6 +118,9 @@ QIOSIntegration::QIOSIntegration()
}
m_touchDevice->setCapabilities(touchCapabilities);
QWindowSystemInterface::registerTouchDevice(m_touchDevice);
+#if QT_CONFIG(tabletevent)
+ QWindowSystemInterfacePrivate::TabletEvent::setPlatformSynthesizesMouse(false);
+#endif
QMacInternalPasteboardMime::initializeMimeTypes();
for (int i = 0; i < m_optionalPlugins->metaData().size(); ++i)
@@ -196,12 +199,12 @@ class QIOSOffscreenSurface : public QPlatformOffscreenSurface
public:
QIOSOffscreenSurface(QOffscreenSurface *offscreenSurface) : QPlatformOffscreenSurface(offscreenSurface) {}
- QSurfaceFormat format() const Q_DECL_OVERRIDE
+ QSurfaceFormat format() const override
{
Q_ASSERT(offscreenSurface());
return offscreenSurface()->requestedFormat();
}
- bool isValid() const Q_DECL_OVERRIDE { return true; }
+ bool isValid() const override { return true; }
};
QPlatformOffscreenSurface *QIOSIntegration::createPlatformOffscreenSurface(QOffscreenSurface *surface) const
diff --git a/src/plugins/platforms/ios/qiosmenu.h b/src/plugins/platforms/ios/qiosmenu.h
index 61cadab56d..32022a3bb8 100644
--- a/src/plugins/platforms/ios/qiosmenu.h
+++ b/src/plugins/platforms/ios/qiosmenu.h
@@ -56,20 +56,20 @@ class QIOSMenuItem : public QPlatformMenuItem
public:
QIOSMenuItem();
- void setText(const QString &text) Q_DECL_OVERRIDE;
- void setIcon(const QIcon &) Q_DECL_OVERRIDE {}
- void setMenu(QPlatformMenu *) Q_DECL_OVERRIDE;
- void setVisible(bool isVisible) Q_DECL_OVERRIDE;
- void setIsSeparator(bool) Q_DECL_OVERRIDE;
- void setFont(const QFont &) Q_DECL_OVERRIDE {}
- void setRole(MenuRole role) Q_DECL_OVERRIDE;
- void setCheckable(bool) Q_DECL_OVERRIDE {}
- void setChecked(bool) Q_DECL_OVERRIDE {}
+ void setText(const QString &text) override;
+ void setIcon(const QIcon &) override {}
+ void setMenu(QPlatformMenu *) override;
+ void setVisible(bool isVisible) override;
+ void setIsSeparator(bool) override;
+ void setFont(const QFont &) override {}
+ void setRole(MenuRole role) override;
+ void setCheckable(bool) override {}
+ void setChecked(bool) override {}
#ifndef QT_NO_SHORTCUT
- void setShortcut(const QKeySequence&) Q_DECL_OVERRIDE;
+ void setShortcut(const QKeySequence&) override;
#endif
- void setEnabled(bool enabled) Q_DECL_OVERRIDE;
- void setIconSize(int) Q_DECL_OVERRIDE {}
+ void setEnabled(bool enabled) override;
+ void setIconSize(int) override {}
bool m_visible;
QString m_text;
@@ -88,22 +88,22 @@ public:
QIOSMenu();
~QIOSMenu();
- void insertMenuItem(QPlatformMenuItem *menuItem, QPlatformMenuItem *before) Q_DECL_OVERRIDE;
- void removeMenuItem(QPlatformMenuItem *menuItem) Q_DECL_OVERRIDE;
- void syncMenuItem(QPlatformMenuItem *) Q_DECL_OVERRIDE;
- void syncSeparatorsCollapsible(bool) Q_DECL_OVERRIDE {}
+ void insertMenuItem(QPlatformMenuItem *menuItem, QPlatformMenuItem *before) override;
+ void removeMenuItem(QPlatformMenuItem *menuItem) override;
+ void syncMenuItem(QPlatformMenuItem *) override;
+ void syncSeparatorsCollapsible(bool) override {}
- void setText(const QString &) Q_DECL_OVERRIDE;
- void setIcon(const QIcon &) Q_DECL_OVERRIDE {}
- void setEnabled(bool enabled) Q_DECL_OVERRIDE;
- void setVisible(bool visible) Q_DECL_OVERRIDE;
- void setMenuType(MenuType type) Q_DECL_OVERRIDE;
+ void setText(const QString &) override;
+ void setIcon(const QIcon &) override {}
+ void setEnabled(bool enabled) override;
+ void setVisible(bool visible) override;
+ void setMenuType(MenuType type) override;
- void showPopup(const QWindow *parentWindow, const QRect &targetRect, const QPlatformMenuItem *item) Q_DECL_OVERRIDE;
- void dismiss() Q_DECL_OVERRIDE;
+ void showPopup(const QWindow *parentWindow, const QRect &targetRect, const QPlatformMenuItem *item) override;
+ void dismiss() override;
- QPlatformMenuItem *menuItemAt(int position) const Q_DECL_OVERRIDE;
- QPlatformMenuItem *menuItemForTag(quintptr tag) const Q_DECL_OVERRIDE;
+ QPlatformMenuItem *menuItemAt(int position) const override;
+ QPlatformMenuItem *menuItemForTag(quintptr tag) const override;
void handleItemSelected(QIOSMenuItem *menuItem);
@@ -111,7 +111,7 @@ public:
static id menuActionTarget() { return m_currentMenu ? m_currentMenu->m_menuController : 0; }
protected:
- bool eventFilter(QObject *obj, QEvent *event) Q_DECL_OVERRIDE;
+ bool eventFilter(QObject *obj, QEvent *event) override;
private:
bool m_enabled;
diff --git a/src/plugins/platforms/ios/qiosmessagedialog.h b/src/plugins/platforms/ios/qiosmessagedialog.h
index e67e10a5e1..92a4db8319 100644
--- a/src/plugins/platforms/ios/qiosmessagedialog.h
+++ b/src/plugins/platforms/ios/qiosmessagedialog.h
@@ -54,9 +54,9 @@ public:
QIOSMessageDialog();
~QIOSMessageDialog();
- void exec() Q_DECL_OVERRIDE;
- bool show(Qt::WindowFlags windowFlags, Qt::WindowModality windowModality, QWindow *parent) Q_DECL_OVERRIDE;
- void hide() Q_DECL_OVERRIDE;
+ void exec() override;
+ bool show(Qt::WindowFlags windowFlags, Qt::WindowModality windowModality, QWindow *parent) override;
+ void hide() override;
private:
QEventLoop m_eventLoop;
diff --git a/src/plugins/platforms/ios/qiosmessagedialog.mm b/src/plugins/platforms/ios/qiosmessagedialog.mm
index 5507f13de7..9d05b792c2 100644
--- a/src/plugins/platforms/ios/qiosmessagedialog.mm
+++ b/src/plugins/platforms/ios/qiosmessagedialog.mm
@@ -48,7 +48,7 @@
#include "qiosmessagedialog.h"
QIOSMessageDialog::QIOSMessageDialog()
- : m_alertController(Q_NULLPTR)
+ : m_alertController(nullptr)
{
}
@@ -136,5 +136,5 @@ void QIOSMessageDialog::hide()
m_eventLoop.exit();
[m_alertController dismissViewControllerAnimated:YES completion:nil];
[m_alertController release];
- m_alertController = Q_NULLPTR;
+ m_alertController = nullptr;
}
diff --git a/src/plugins/platforms/ios/qiosoptionalplugininterface.h b/src/plugins/platforms/ios/qiosoptionalplugininterface.h
index 3f74e41c83..660c74e856 100644
--- a/src/plugins/platforms/ios/qiosoptionalplugininterface.h
+++ b/src/plugins/platforms/ios/qiosoptionalplugininterface.h
@@ -55,7 +55,7 @@ class QIosOptionalPluginInterface
public:
virtual ~QIosOptionalPluginInterface() {}
virtual void initPlugin() const {};
- virtual UIViewController* createImagePickerController(QIOSFileDialog *) const { return Q_NULLPTR; };
+ virtual UIViewController* createImagePickerController(QIOSFileDialog *) const { return nullptr; };
};
Q_DECLARE_INTERFACE(QIosOptionalPluginInterface, QIosOptionalPluginInterface_iid)
diff --git a/src/plugins/platforms/ios/qiosscreen.h b/src/plugins/platforms/ios/qiosscreen.h
index be0f301710..d5a253461d 100644
--- a/src/plugins/platforms/ios/qiosscreen.h
+++ b/src/plugins/platforms/ios/qiosscreen.h
@@ -62,18 +62,18 @@ public:
QString name() const override;
- QRect geometry() const Q_DECL_OVERRIDE;
- QRect availableGeometry() const Q_DECL_OVERRIDE;
- int depth() const Q_DECL_OVERRIDE;
- QImage::Format format() const Q_DECL_OVERRIDE;
- QSizeF physicalSize() const Q_DECL_OVERRIDE;
- QDpi logicalDpi() const Q_DECL_OVERRIDE;
- qreal devicePixelRatio() const Q_DECL_OVERRIDE;
+ QRect geometry() const override;
+ QRect availableGeometry() const override;
+ int depth() const override;
+ QImage::Format format() const override;
+ QSizeF physicalSize() const override;
+ QDpi logicalDpi() const override;
+ qreal devicePixelRatio() const override;
qreal refreshRate() const override;
- Qt::ScreenOrientation nativeOrientation() const Q_DECL_OVERRIDE;
- Qt::ScreenOrientation orientation() const Q_DECL_OVERRIDE;
- void setOrientationUpdateMask(Qt::ScreenOrientations mask) Q_DECL_OVERRIDE;
+ Qt::ScreenOrientation nativeOrientation() const override;
+ Qt::ScreenOrientation orientation() const override;
+ void setOrientationUpdateMask(Qt::ScreenOrientations mask) override;
QPixmap grabWindow(WId window, int x, int y, int width, int height) const override;
diff --git a/src/plugins/platforms/ios/qiostextinputoverlay.mm b/src/plugins/platforms/ios/qiostextinputoverlay.mm
index bb9fe4d58f..fe3c29d037 100644
--- a/src/plugins/platforms/ios/qiostextinputoverlay.mm
+++ b/src/plugins/platforms/ios/qiostextinputoverlay.mm
@@ -608,7 +608,7 @@ static void executeBlockWithoutAnimation(Block block)
- (QIOSLoupeLayer *)createLoupeLayer
{
Q_UNREACHABLE();
- return Q_NULLPTR;
+ return nullptr;
}
- (void)updateFocalPoint:(QPointF)touchPoint
@@ -984,12 +984,12 @@ static void executeBlockWithoutAnimation(Block block)
QT_BEGIN_NAMESPACE
-QIOSEditMenu *QIOSTextInputOverlay::s_editMenu = Q_NULLPTR;
+QIOSEditMenu *QIOSTextInputOverlay::s_editMenu = nullptr;
QIOSTextInputOverlay::QIOSTextInputOverlay()
- : m_cursorRecognizer(Q_NULLPTR)
- , m_selectionRecognizer(Q_NULLPTR)
- , m_openMenuOnTapRecognizer(Q_NULLPTR)
+ : m_cursorRecognizer(nullptr)
+ , m_selectionRecognizer(nullptr)
+ , m_openMenuOnTapRecognizer(nullptr)
{
connect(qApp, &QGuiApplication::focusObjectChanged, this, &QIOSTextInputOverlay::updateFocusObject);
}
@@ -1012,10 +1012,10 @@ void QIOSTextInputOverlay::updateFocusObject()
[m_selectionRecognizer release];
[m_openMenuOnTapRecognizer release];
[s_editMenu release];
- m_cursorRecognizer = Q_NULLPTR;
- m_selectionRecognizer = Q_NULLPTR;
- m_openMenuOnTapRecognizer = Q_NULLPTR;
- s_editMenu = Q_NULLPTR;
+ m_cursorRecognizer = nullptr;
+ m_selectionRecognizer = nullptr;
+ m_openMenuOnTapRecognizer = nullptr;
+ s_editMenu = nullptr;
}
if (platformInputContext()->inputMethodAccepted()) {
diff --git a/src/plugins/platforms/ios/qiostheme.h b/src/plugins/platforms/ios/qiostheme.h
index fc6b58178a..c917679a91 100644
--- a/src/plugins/platforms/ios/qiostheme.h
+++ b/src/plugins/platforms/ios/qiostheme.h
@@ -52,16 +52,16 @@ public:
QIOSTheme();
~QIOSTheme();
- const QPalette *palette(Palette type = SystemPalette) const Q_DECL_OVERRIDE;
- QVariant themeHint(ThemeHint hint) const Q_DECL_OVERRIDE;
+ const QPalette *palette(Palette type = SystemPalette) const override;
+ QVariant themeHint(ThemeHint hint) const override;
- QPlatformMenuItem* createPlatformMenuItem() const Q_DECL_OVERRIDE;
- QPlatformMenu* createPlatformMenu() const Q_DECL_OVERRIDE;
+ QPlatformMenuItem* createPlatformMenuItem() const override;
+ QPlatformMenu* createPlatformMenu() const override;
- bool usePlatformNativeDialog(DialogType type) const Q_DECL_OVERRIDE;
- QPlatformDialogHelper *createPlatformDialogHelper(DialogType type) const Q_DECL_OVERRIDE;
+ bool usePlatformNativeDialog(DialogType type) const override;
+ QPlatformDialogHelper *createPlatformDialogHelper(DialogType type) const override;
- const QFont *font(Font type = SystemFont) const Q_DECL_OVERRIDE;
+ const QFont *font(Font type = SystemFont) const override;
static const char *name;
diff --git a/src/plugins/platforms/ios/qioswindow.h b/src/plugins/platforms/ios/qioswindow.h
index 14fa2084c9..d5af31044d 100644
--- a/src/plugins/platforms/ios/qioswindow.h
+++ b/src/plugins/platforms/ios/qioswindow.h
@@ -60,37 +60,37 @@ public:
explicit QIOSWindow(QWindow *window);
~QIOSWindow();
- void setGeometry(const QRect &rect) Q_DECL_OVERRIDE;
+ void setGeometry(const QRect &rect) override;
- void setWindowState(Qt::WindowStates state) Q_DECL_OVERRIDE;
- void setParent(const QPlatformWindow *window) Q_DECL_OVERRIDE;
- void handleContentOrientationChange(Qt::ScreenOrientation orientation) Q_DECL_OVERRIDE;
- void setVisible(bool visible) Q_DECL_OVERRIDE;
- void setOpacity(qreal level) Q_DECL_OVERRIDE;
+ void setWindowState(Qt::WindowStates state) override;
+ void setParent(const QPlatformWindow *window) override;
+ void handleContentOrientationChange(Qt::ScreenOrientation orientation) override;
+ void setVisible(bool visible) override;
+ void setOpacity(qreal level) override;
- bool isExposed() const Q_DECL_OVERRIDE;
- void propagateSizeHints() Q_DECL_OVERRIDE {}
+ bool isExposed() const override;
+ void propagateSizeHints() override {}
QMargins safeAreaMargins() const override;
- void raise() Q_DECL_OVERRIDE{ raiseOrLower(true); }
- void lower() Q_DECL_OVERRIDE { raiseOrLower(false); }
+ void raise() override{ raiseOrLower(true); }
+ void lower() override { raiseOrLower(false); }
bool shouldAutoActivateWindow() const;
- void requestActivateWindow() Q_DECL_OVERRIDE;
+ void requestActivateWindow() override;
- qreal devicePixelRatio() const Q_DECL_OVERRIDE;
+ qreal devicePixelRatio() const override;
- bool setMouseGrabEnabled(bool grab) Q_DECL_OVERRIDE { return grab; }
- bool setKeyboardGrabEnabled(bool grab) Q_DECL_OVERRIDE { return grab; }
+ bool setMouseGrabEnabled(bool grab) override { return grab; }
+ bool setKeyboardGrabEnabled(bool grab) override { return grab; }
- WId winId() const Q_DECL_OVERRIDE { return WId(m_view); }
+ WId winId() const override { return WId(m_view); }
void clearAccessibleCache();
- QSurfaceFormat format() const Q_DECL_OVERRIDE;
+ QSurfaceFormat format() const override;
- void requestUpdate() Q_DECL_OVERRIDE;
+ void requestUpdate() override;
CAEAGLLayer *eaglLayer() const;
diff --git a/src/plugins/platforms/ios/quiview.h b/src/plugins/platforms/ios/quiview.h
index 1ce9007a35..3e3c579075 100644
--- a/src/plugins/platforms/ios/quiview.h
+++ b/src/plugins/platforms/ios/quiview.h
@@ -58,6 +58,7 @@ QT_END_NAMESPACE
QT_PREPEND_NAMESPACE(QIOSWindow) *m_qioswindow;
@private
QHash<UITouch *, QWindowSystemInterface::TouchPoint> m_activeTouches;
+ UITouch *m_activePencilTouch;
int m_nextTouchId;
@private
diff --git a/src/plugins/platforms/ios/quiview.mm b/src/plugins/platforms/ios/quiview.mm
index 42e57d0f4f..dda8ee5b53 100644
--- a/src/plugins/platforms/ios/quiview.mm
+++ b/src/plugins/platforms/ios/quiview.mm
@@ -53,6 +53,8 @@
#include <QtGui/private/qwindow_p.h>
#include <qpa/qwindowsysteminterface_p.h>
+Q_LOGGING_CATEGORY(lcQpaTablet, "qt.qpa.input.tablet")
+
@implementation QUIView
+ (void)load
@@ -351,11 +353,44 @@
return [super pointInside:point withEvent:event];
}
-- (void)updateTouchList:(NSSet *)touches withState:(Qt::TouchPointState)state
+- (void)handleTouches:(NSSet *)touches withEvent:(UIEvent *)event withState:(Qt::TouchPointState)state withTimestamp:(ulong)timeStamp
{
+ QIOSIntegration *iosIntegration = QIOSIntegration::instance();
bool supportsPressure = QIOSIntegration::instance()->touchDevice()->capabilities() & QTouchDevice::Pressure;
- foreach (UITouch *uiTouch, m_activeTouches.keys()) {
+#if QT_CONFIG(tabletevent)
+ if (m_activePencilTouch && [touches containsObject:m_activePencilTouch]) {
+ NSArray<UITouch *> *cTouches = [event coalescedTouchesForTouch:m_activePencilTouch];
+ int i = 0;
+ for (UITouch *cTouch in cTouches) {
+ QPointF localViewPosition = QPointF::fromCGPoint([cTouch preciseLocationInView:self]);
+ QPoint localViewPositionI = localViewPosition.toPoint();
+ QPointF globalScreenPosition = m_qioswindow->mapToGlobal(localViewPositionI) +
+ (localViewPosition - localViewPositionI);
+ qreal pressure = cTouch.force / cTouch.maximumPossibleForce;
+ // azimuth unit vector: +x to the right, +y going downwards
+ CGVector azimuth = [cTouch azimuthUnitVectorInView: self];
+ // azimuthAngle given in radians, zero when the stylus points towards +x axis; converted to degrees with 0 pointing straight up
+ qreal azimuthAngle = [cTouch azimuthAngleInView: self] * 180 / M_PI + 90;
+ // altitudeAngle given in radians, pi / 2 is with the stylus perpendicular to the iPad, smaller values mean more tilted, but never negative.
+ // Convert to degrees with zero being perpendicular.
+ qreal altitudeAngle = 90 - cTouch.altitudeAngle * 180 / M_PI;
+ qCDebug(lcQpaTablet) << i << ":" << timeStamp << localViewPosition << pressure << state << "azimuth" << azimuth.dx << azimuth.dy
+ << "angle" << azimuthAngle << "altitude" << cTouch.altitudeAngle
+ << "xTilt" << qBound(-60.0, altitudeAngle * azimuth.dx, 60.0) << "yTilt" << qBound(-60.0, altitudeAngle * azimuth.dy, 60.0);
+ QWindowSystemInterface::handleTabletEvent(m_qioswindow->window(), timeStamp, localViewPosition, globalScreenPosition,
+ // device, pointerType, buttons
+ QTabletEvent::RotationStylus, QTabletEvent::Pen, state == Qt::TouchPointReleased ? Qt::NoButton : Qt::LeftButton,
+ // pressure, xTilt, yTilt
+ pressure, qBound(-60.0, altitudeAngle * azimuth.dx, 60.0), qBound(-60.0, altitudeAngle * azimuth.dy, 60.0),
+ // tangentialPressure, rotation, z, uid, modifiers
+ 0, azimuthAngle, 0, 0, Qt::NoModifier);
+ ++i;
+ }
+ }
+#endif
+
+ for (UITouch *uiTouch : m_activeTouches.keys()) {
QWindowSystemInterface::TouchPoint &touchPoint = m_activeTouches[uiTouch];
if (![touches containsObject:uiTouch]) {
touchPoint.state = Qt::TouchPointStationary;
@@ -384,16 +419,14 @@
touchPoint.pressure = uiTouch.force / uiTouch.maximumPossibleForce;
} else {
// We don't claim that our touch device supports QTouchDevice::Pressure,
- // but fill in a meaningfull value in case clients use it anyways.
+ // but fill in a meaningful value in case clients use it anyway.
touchPoint.pressure = (state == Qt::TouchPointReleased) ? 0.0 : 1.0;
}
}
}
-}
-
-- (void)sendTouchEventWithTimestamp:(ulong)timeStamp
-{
- QIOSIntegration *iosIntegration = QIOSIntegration::instance();
+ if (m_activeTouches.isEmpty())
+ return;
+ QWindowSystemInterface::handleTouchEvent<QWindowSystemInterface::SynchronousDelivery>(m_qioswindow->window(), timeStamp, iosIntegration->touchDevice(), m_activeTouches.values());
if (!static_cast<QUIWindow *>(self.window).sendingEvent) {
// The event is likely delivered as part of delayed touch delivery, via
// _UIGestureEnvironmentSortAndSendDelayedTouches, due to one of the two
@@ -418,8 +451,21 @@
// points to QWindowSystemInterface::TouchPoints, and assigns each TouchPoint
// an id for use by Qt.
for (UITouch *touch in touches) {
- Q_ASSERT(!m_activeTouches.contains(touch));
- m_activeTouches[touch].id = m_nextTouchId++;
+#if QT_CONFIG(tabletevent)
+ if (touch.type == UITouchTypeStylus) {
+ if (Q_UNLIKELY(m_activePencilTouch)) {
+ qWarning("ignoring additional Pencil while first is still active");
+ continue;
+ }
+ m_activePencilTouch = touch;
+ } else
+ {
+ Q_ASSERT(!m_activeTouches.contains(touch));
+#endif
+ m_activeTouches[touch].id = m_nextTouchId++;
+#if QT_CONFIG(tabletevent)
+ }
+#endif
}
if (m_qioswindow->shouldAutoActivateWindow() && m_activeTouches.size() == 1) {
@@ -430,31 +476,36 @@
topLevel->requestActivateWindow();
}
- [self updateTouchList:touches withState:Qt::TouchPointPressed];
- [self sendTouchEventWithTimestamp:ulong(event.timestamp * 1000)];
+ [self handleTouches:touches withEvent:event withState:Qt::TouchPointPressed withTimestamp:ulong(event.timestamp * 1000)];
}
- (void)touchesMoved:(NSSet *)touches withEvent:(UIEvent *)event
{
- [self updateTouchList:touches withState:Qt::TouchPointMoved];
- [self sendTouchEventWithTimestamp:ulong(event.timestamp * 1000)];
+ [self handleTouches:touches withEvent:event withState:Qt::TouchPointMoved withTimestamp:ulong(event.timestamp * 1000)];
}
- (void)touchesEnded:(NSSet *)touches withEvent:(UIEvent *)event
{
- [self updateTouchList:touches withState:Qt::TouchPointReleased];
- [self sendTouchEventWithTimestamp:ulong(event.timestamp * 1000)];
+ [self handleTouches:touches withEvent:event withState:Qt::TouchPointReleased withTimestamp:ulong(event.timestamp * 1000)];
// Remove ended touch points from the active set:
- for (UITouch *touch in touches)
- m_activeTouches.remove(touch);
- if (m_activeTouches.isEmpty())
+ for (UITouch *touch in touches) {
+#if QT_CONFIG(tabletevent)
+ if (touch.type == UITouchTypeStylus) {
+ m_activePencilTouch = nil;
+ } else
+#endif
+ {
+ m_activeTouches.remove(touch);
+ }
+ }
+ if (m_activeTouches.isEmpty() && !m_activePencilTouch)
m_nextTouchId = 0;
}
- (void)touchesCancelled:(NSSet *)touches withEvent:(UIEvent *)event
{
- if (m_activeTouches.isEmpty())
+ if (m_activeTouches.isEmpty() && !m_activePencilTouch)
return;
// When four-finger swiping, we get a touchesCancelled callback
@@ -478,11 +529,12 @@
// sub-set of the active touch events are intentionally cancelled.
NSInteger count = static_cast<NSInteger>([touches count]);
- if (count != 0 && count != m_activeTouches.count())
+ if (count != 0 && count != m_activeTouches.count() && !m_activePencilTouch)
qWarning("Subset of active touches cancelled by UIKit");
m_activeTouches.clear();
m_nextTouchId = 0;
+ m_activePencilTouch = nil;
NSTimeInterval timestamp = event ? event.timestamp : [[NSProcessInfo processInfo] systemUptime];
diff --git a/src/plugins/platforms/linuxfb/main.cpp b/src/plugins/platforms/linuxfb/main.cpp
index 82b916b9a9..24156b68e8 100644
--- a/src/plugins/platforms/linuxfb/main.cpp
+++ b/src/plugins/platforms/linuxfb/main.cpp
@@ -47,7 +47,7 @@ class QLinuxFbIntegrationPlugin : public QPlatformIntegrationPlugin
Q_OBJECT
Q_PLUGIN_METADATA(IID QPlatformIntegrationFactoryInterface_iid FILE "linuxfb.json")
public:
- QPlatformIntegration *create(const QString&, const QStringList&) Q_DECL_OVERRIDE;
+ QPlatformIntegration *create(const QString&, const QStringList&) override;
};
QPlatformIntegration* QLinuxFbIntegrationPlugin::create(const QString& system, const QStringList& paramList)
diff --git a/src/plugins/platforms/linuxfb/qlinuxfbdrmscreen.cpp b/src/plugins/platforms/linuxfb/qlinuxfbdrmscreen.cpp
index e15d6fee24..dcc1ef2790 100644
--- a/src/plugins/platforms/linuxfb/qlinuxfbdrmscreen.cpp
+++ b/src/plugins/platforms/linuxfb/qlinuxfbdrmscreen.cpp
@@ -43,7 +43,6 @@
// Multiscreen: QWindow-QScreen(-output) association. Needs some reorg (device cannot be owned by screen)
// Find card via devicediscovery like in eglfs_kms.
// Mode restore like QEglFSKmsInterruptHandler.
-// Formats other then 32 bpp?
// grabWindow
#include "qlinuxfbdrmscreen.h"
@@ -187,15 +186,67 @@ void QLinuxFbDevice::registerScreen(QPlatformScreen *screen,
Q_UNREACHABLE();
}
+static uint32_t bppForDrmFormat(uint32_t drmFormat)
+{
+ switch (drmFormat) {
+ case DRM_FORMAT_RGB565:
+ case DRM_FORMAT_BGR565:
+ return 16;
+ default:
+ return 32;
+ }
+}
+
+static int depthForDrmFormat(uint32_t drmFormat)
+{
+ switch (drmFormat) {
+ case DRM_FORMAT_RGB565:
+ case DRM_FORMAT_BGR565:
+ return 16;
+ case DRM_FORMAT_XRGB8888:
+ case DRM_FORMAT_XBGR8888:
+ return 24;
+ case DRM_FORMAT_XRGB2101010:
+ case DRM_FORMAT_XBGR2101010:
+ return 30;
+ default:
+ return 32;
+ }
+}
+
+static QImage::Format formatForDrmFormat(uint32_t drmFormat)
+{
+ switch (drmFormat) {
+ case DRM_FORMAT_XRGB8888:
+ case DRM_FORMAT_XBGR8888:
+ return QImage::Format_RGB32;
+ case DRM_FORMAT_ARGB8888:
+ case DRM_FORMAT_ABGR8888:
+ return QImage::Format_ARGB32;
+ case DRM_FORMAT_RGB565:
+ case DRM_FORMAT_BGR565:
+ return QImage::Format_RGB16;
+ case DRM_FORMAT_XRGB2101010:
+ case DRM_FORMAT_XBGR2101010:
+ return QImage::Format_RGB30;
+ case DRM_FORMAT_ARGB2101010:
+ case DRM_FORMAT_ABGR2101010:
+ return QImage::Format_A2RGB30_Premultiplied;
+ default:
+ return QImage::Format_ARGB32;
+ }
+}
+
bool QLinuxFbDevice::createFramebuffer(QLinuxFbDevice::Output *output, int bufferIdx)
{
const QSize size = output->currentRes();
const uint32_t w = size.width();
const uint32_t h = size.height();
+ const uint32_t bpp = bppForDrmFormat(output->kmsOutput.drm_format);
drm_mode_create_dumb creq = {
h,
w,
- 32,
+ bpp,
0, 0, 0, 0
};
if (drmIoctl(fd(), DRM_IOCTL_MODE_CREATE_DUMB, &creq) == -1) {
@@ -207,10 +258,15 @@ bool QLinuxFbDevice::createFramebuffer(QLinuxFbDevice::Output *output, int buffe
fb.handle = creq.handle;
fb.pitch = creq.pitch;
fb.size = creq.size;
- qCDebug(qLcFbDrm, "Got a dumb buffer for size %dx%d, handle %u, pitch %u, size %u",
- w, h, fb.handle, fb.pitch, (uint) fb.size);
+ qCDebug(qLcFbDrm, "Got a dumb buffer for size %dx%d and bpp %u: handle %u, pitch %u, size %u",
+ w, h, bpp, fb.handle, fb.pitch, (uint) fb.size);
+
+ uint32_t handles[4] = { fb.handle };
+ uint32_t strides[4] = { fb.pitch };
+ uint32_t offsets[4] = { 0 };
- if (drmModeAddFB(fd(), w, h, 24, 32, fb.pitch, fb.handle, &fb.fb) == -1) {
+ if (drmModeAddFB2(fd(), w, h, output->kmsOutput.drm_format,
+ handles, strides, offsets, &fb.fb, 0) == -1) {
qErrnoWarning(errno, "Failed to add FB");
return false;
}
@@ -229,10 +285,10 @@ bool QLinuxFbDevice::createFramebuffer(QLinuxFbDevice::Output *output, int buffe
return false;
}
- qCDebug(qLcFbDrm, "FB is %u, mapped at %p", fb.fb, fb.p);
+ qCDebug(qLcFbDrm, "FB is %u (DRM format 0x%x), mapped at %p", fb.fb, output->kmsOutput.drm_format, fb.p);
memset(fb.p, 0, fb.size);
- fb.wrapper = QImage(static_cast<uchar *>(fb.p), w, h, fb.pitch, QImage::Format_ARGB32);
+ fb.wrapper = QImage(static_cast<uchar *>(fb.p), w, h, fb.pitch, formatForDrmFormat(output->kmsOutput.drm_format));
return true;
}
@@ -357,10 +413,10 @@ bool QLinuxFbDrmScreen::initialize()
QLinuxFbDevice::Output *output(m_device->output(0));
mGeometry = QRect(QPoint(0, 0), output->currentRes());
- mDepth = 32;
- mFormat = QImage::Format_ARGB32;
+ mDepth = depthForDrmFormat(output->kmsOutput.drm_format);
+ mFormat = formatForDrmFormat(output->kmsOutput.drm_format);
mPhysicalSize = output->kmsOutput.physical_size;
- qCDebug(qLcFbDrm) << mGeometry << mPhysicalSize;
+ qCDebug(qLcFbDrm) << mGeometry << mPhysicalSize << mDepth << mFormat;
QFbScreen::initializeCompositor();
diff --git a/src/plugins/platforms/linuxfb/qlinuxfbintegration.h b/src/plugins/platforms/linuxfb/qlinuxfbintegration.h
index 9934a8cd54..22578bf980 100644
--- a/src/plugins/platforms/linuxfb/qlinuxfbintegration.h
+++ b/src/plugins/platforms/linuxfb/qlinuxfbintegration.h
@@ -55,19 +55,19 @@ public:
QLinuxFbIntegration(const QStringList &paramList);
~QLinuxFbIntegration();
- void initialize() Q_DECL_OVERRIDE;
- bool hasCapability(QPlatformIntegration::Capability cap) const Q_DECL_OVERRIDE;
+ void initialize() override;
+ bool hasCapability(QPlatformIntegration::Capability cap) const override;
- QPlatformWindow *createPlatformWindow(QWindow *window) const Q_DECL_OVERRIDE;
- QPlatformBackingStore *createPlatformBackingStore(QWindow *window) const Q_DECL_OVERRIDE;
+ QPlatformWindow *createPlatformWindow(QWindow *window) const override;
+ QPlatformBackingStore *createPlatformBackingStore(QWindow *window) const override;
- QAbstractEventDispatcher *createEventDispatcher() const Q_DECL_OVERRIDE;
+ QAbstractEventDispatcher *createEventDispatcher() const override;
- QPlatformFontDatabase *fontDatabase() const Q_DECL_OVERRIDE;
- QPlatformServices *services() const Q_DECL_OVERRIDE;
- QPlatformInputContext *inputContext() const Q_DECL_OVERRIDE { return m_inputContext; }
+ QPlatformFontDatabase *fontDatabase() const override;
+ QPlatformServices *services() const override;
+ QPlatformInputContext *inputContext() const override { return m_inputContext; }
- QPlatformNativeInterface *nativeInterface() const Q_DECL_OVERRIDE;
+ QPlatformNativeInterface *nativeInterface() const override;
QList<QPlatformScreen *> screens() const;
diff --git a/src/plugins/platforms/minimal/main.cpp b/src/plugins/platforms/minimal/main.cpp
index 29809c1843..f9a0c17509 100644
--- a/src/plugins/platforms/minimal/main.cpp
+++ b/src/plugins/platforms/minimal/main.cpp
@@ -48,7 +48,7 @@ class QMinimalIntegrationPlugin : public QPlatformIntegrationPlugin
Q_OBJECT
Q_PLUGIN_METADATA(IID QPlatformIntegrationFactoryInterface_iid FILE "minimal.json")
public:
- QPlatformIntegration *create(const QString&, const QStringList&) Q_DECL_OVERRIDE;
+ QPlatformIntegration *create(const QString&, const QStringList&) override;
};
QPlatformIntegration *QMinimalIntegrationPlugin::create(const QString& system, const QStringList& paramList)
diff --git a/src/plugins/platforms/minimal/minimal.pro b/src/plugins/platforms/minimal/minimal.pro
index 8cfb68824e..a1a2da547b 100644
--- a/src/plugins/platforms/minimal/minimal.pro
+++ b/src/plugins/platforms/minimal/minimal.pro
@@ -14,6 +14,8 @@ HEADERS = qminimalintegration.h \
OTHER_FILES += minimal.json
+qtConfig(freetype): QMAKE_USE_PRIVATE += freetype
+
PLUGIN_TYPE = platforms
PLUGIN_CLASS_NAME = QMinimalIntegrationPlugin
!equals(TARGET, $$QT_DEFAULT_QPA_PLUGIN): PLUGIN_EXTENDS = -
diff --git a/src/plugins/platforms/minimal/qminimalbackingstore.h b/src/plugins/platforms/minimal/qminimalbackingstore.h
index 3d7aaf2b99..2119894809 100644
--- a/src/plugins/platforms/minimal/qminimalbackingstore.h
+++ b/src/plugins/platforms/minimal/qminimalbackingstore.h
@@ -52,9 +52,9 @@ public:
QMinimalBackingStore(QWindow *window);
~QMinimalBackingStore();
- QPaintDevice *paintDevice() Q_DECL_OVERRIDE;
- void flush(QWindow *window, const QRegion &region, const QPoint &offset) Q_DECL_OVERRIDE;
- void resize(const QSize &size, const QRegion &staticContents) Q_DECL_OVERRIDE;
+ QPaintDevice *paintDevice() override;
+ void flush(QWindow *window, const QRegion &region, const QPoint &offset) override;
+ void resize(const QSize &size, const QRegion &staticContents) override;
private:
QImage mImage;
diff --git a/src/plugins/platforms/minimal/qminimalintegration.cpp b/src/plugins/platforms/minimal/qminimalintegration.cpp
index ca33689cd7..0c04608fca 100644
--- a/src/plugins/platforms/minimal/qminimalintegration.cpp
+++ b/src/plugins/platforms/minimal/qminimalintegration.cpp
@@ -54,11 +54,17 @@
# endif
#elif defined(Q_OS_DARWIN)
# include <QtFontDatabaseSupport/private/qcoretextfontdatabase_p.h>
-#elif QT_CONFIG(fontconfig)
+#endif
+
+#if QT_CONFIG(fontconfig)
# include <QtFontDatabaseSupport/private/qgenericunixfontdatabase_p.h>
# include <qpa/qplatformfontdatabase.h>
#endif
+#if QT_CONFIG(freetype)
+#include <QtFontDatabaseSupport/private/qfontengine_ft_p.h>
+#endif
+
#if !defined(Q_OS_WIN)
#include <QtEventDispatcherSupport/private/qgenericunixeventdispatcher_p.h>
#elif defined(Q_OS_WINRT)
@@ -81,6 +87,8 @@ static inline unsigned parseOptions(const QStringList &paramList)
options |= QMinimalIntegration::EnableFonts;
else if (param == QLatin1String("freetype"))
options |= QMinimalIntegration::FreeTypeFontDatabase;
+ else if (param == QLatin1String("fontconfig"))
+ options |= QMinimalIntegration::FontconfigDatabase;
}
return options;
}
@@ -123,15 +131,13 @@ bool QMinimalIntegration::hasCapability(QPlatformIntegration::Capability cap) co
class DummyFontDatabase : public QPlatformFontDatabase
{
public:
- virtual void populateFontDatabase() Q_DECL_OVERRIDE {}
+ virtual void populateFontDatabase() override {}
};
QPlatformFontDatabase *QMinimalIntegration::fontDatabase() const
{
if (!m_fontDatabase && (m_options & EnableFonts)) {
-#if QT_CONFIG(fontconfig)
- m_fontDatabase = new QGenericUnixFontDatabase;
-#elif defined(Q_OS_WINRT)
+#if defined(Q_OS_WINRT)
m_fontDatabase = new QWinRTFontDatabase;
#elif defined(Q_OS_WIN)
if (m_options & FreeTypeFontDatabase) {
@@ -142,10 +148,24 @@ QPlatformFontDatabase *QMinimalIntegration::fontDatabase() const
m_fontDatabase = new QWindowsFontDatabase;
}
#elif defined(Q_OS_DARWIN)
- m_fontDatabase = new QCoreTextFontDatabaseEngineFactory<QCoreTextFontEngine>;
+ if (!(m_options & FontconfigDatabase)) {
+ if (m_options & FreeTypeFontDatabase) {
+# if QT_CONFIG(freetype)
+ m_fontDatabase = new QCoreTextFontDatabaseEngineFactory<QFontEngineFT>;
+# endif // freetype
+ } else {
+ m_fontDatabase = new QCoreTextFontDatabaseEngineFactory<QCoreTextFontEngine>;
+ }
+ }
+#endif
+
+ if (!m_fontDatabase) {
+#if QT_CONFIG(fontconfig)
+ m_fontDatabase = new QGenericUnixFontDatabase;
#else
- m_fontDatabase = QPlatformIntegration::fontDatabase();
+ m_fontDatabase = QPlatformIntegration::fontDatabase();
#endif
+ }
}
if (!m_fontDatabase)
m_fontDatabase = new DummyFontDatabase;
diff --git a/src/plugins/platforms/minimal/qminimalintegration.h b/src/plugins/platforms/minimal/qminimalintegration.h
index eaa2f228c5..ad1bec2112 100644
--- a/src/plugins/platforms/minimal/qminimalintegration.h
+++ b/src/plugins/platforms/minimal/qminimalintegration.h
@@ -51,9 +51,9 @@ public:
QMinimalScreen()
: mDepth(32), mFormat(QImage::Format_ARGB32_Premultiplied) {}
- QRect geometry() const Q_DECL_OVERRIDE { return mGeometry; }
- int depth() const Q_DECL_OVERRIDE { return mDepth; }
- QImage::Format format() const Q_DECL_OVERRIDE { return mFormat; }
+ QRect geometry() const override { return mGeometry; }
+ int depth() const override { return mDepth; }
+ QImage::Format format() const override { return mFormat; }
public:
QRect mGeometry;
@@ -68,18 +68,19 @@ public:
enum Options { // Options to be passed on command line or determined from environment
DebugBackingStore = 0x1,
EnableFonts = 0x2,
- FreeTypeFontDatabase = 0x4
+ FreeTypeFontDatabase = 0x4,
+ FontconfigDatabase = 0x8
};
explicit QMinimalIntegration(const QStringList &parameters);
~QMinimalIntegration();
- bool hasCapability(QPlatformIntegration::Capability cap) const Q_DECL_OVERRIDE;
- QPlatformFontDatabase *fontDatabase() const Q_DECL_OVERRIDE;
+ bool hasCapability(QPlatformIntegration::Capability cap) const override;
+ QPlatformFontDatabase *fontDatabase() const override;
- QPlatformWindow *createPlatformWindow(QWindow *window) const Q_DECL_OVERRIDE;
- QPlatformBackingStore *createPlatformBackingStore(QWindow *window) const Q_DECL_OVERRIDE;
- QAbstractEventDispatcher *createEventDispatcher() const Q_DECL_OVERRIDE;
+ QPlatformWindow *createPlatformWindow(QWindow *window) const override;
+ QPlatformBackingStore *createPlatformBackingStore(QWindow *window) const override;
+ QAbstractEventDispatcher *createEventDispatcher() const override;
unsigned options() const { return m_options; }
diff --git a/src/plugins/platforms/minimalegl/main.cpp b/src/plugins/platforms/minimalegl/main.cpp
index a010ed76e2..5aac71e140 100644
--- a/src/plugins/platforms/minimalegl/main.cpp
+++ b/src/plugins/platforms/minimalegl/main.cpp
@@ -47,7 +47,7 @@ class QMinimalEglIntegrationPlugin : public QPlatformIntegrationPlugin
Q_OBJECT
Q_PLUGIN_METADATA(IID QPlatformIntegrationFactoryInterface_iid FILE "minimalegl.json")
public:
- QPlatformIntegration *create(const QString&, const QStringList&) Q_DECL_OVERRIDE;
+ QPlatformIntegration *create(const QString&, const QStringList&) override;
};
QPlatformIntegration* QMinimalEglIntegrationPlugin::create(const QString& system, const QStringList& paramList)
diff --git a/src/plugins/platforms/minimalegl/qminimaleglbackingstore.h b/src/plugins/platforms/minimalegl/qminimaleglbackingstore.h
index 0e22298891..382f2d1404 100644
--- a/src/plugins/platforms/minimalegl/qminimaleglbackingstore.h
+++ b/src/plugins/platforms/minimalegl/qminimaleglbackingstore.h
@@ -53,13 +53,13 @@ public:
QMinimalEglBackingStore(QWindow *window);
~QMinimalEglBackingStore();
- QPaintDevice *paintDevice() Q_DECL_OVERRIDE;
+ QPaintDevice *paintDevice() override;
- void beginPaint(const QRegion &) Q_DECL_OVERRIDE;
- void endPaint() Q_DECL_OVERRIDE;
+ void beginPaint(const QRegion &) override;
+ void endPaint() override;
- void flush(QWindow *window, const QRegion &region, const QPoint &offset) Q_DECL_OVERRIDE;
- void resize(const QSize &size, const QRegion &staticContents) Q_DECL_OVERRIDE;
+ void flush(QWindow *window, const QRegion &region, const QPoint &offset) override;
+ void resize(const QSize &size, const QRegion &staticContents) override;
private:
QOpenGLContext *m_context;
diff --git a/src/plugins/platforms/minimalegl/qminimaleglintegration.cpp b/src/plugins/platforms/minimalegl/qminimaleglintegration.cpp
index a716a6092a..5d31af53d5 100644
--- a/src/plugins/platforms/minimalegl/qminimaleglintegration.cpp
+++ b/src/plugins/platforms/minimalegl/qminimaleglintegration.cpp
@@ -71,7 +71,7 @@ public:
QWinRTEventDispatcher() {}
protected:
- bool hasPendingEvents() Q_DECL_OVERRIDE
+ bool hasPendingEvents() override
{
return QEventDispatcherWinRT::hasPendingEvents() || QWindowSystemInterface::windowSystemEventsQueued();
}
@@ -156,7 +156,7 @@ QAbstractEventDispatcher *QMinimalEglIntegration::createEventDispatcher() const
#elif defined(Q_OS_WIN)
return new QWindowsGuiEventDispatcher;
#else
- return Q_NULLPTR;
+ return nullptr;
#endif
}
diff --git a/src/plugins/platforms/minimalegl/qminimaleglintegration.h b/src/plugins/platforms/minimalegl/qminimaleglintegration.h
index d0ab75bd3c..70a51004a6 100644
--- a/src/plugins/platforms/minimalegl/qminimaleglintegration.h
+++ b/src/plugins/platforms/minimalegl/qminimaleglintegration.h
@@ -51,18 +51,18 @@ public:
QMinimalEglIntegration();
~QMinimalEglIntegration();
- bool hasCapability(QPlatformIntegration::Capability cap) const Q_DECL_OVERRIDE;
+ bool hasCapability(QPlatformIntegration::Capability cap) const override;
- QPlatformWindow *createPlatformWindow(QWindow *window) const Q_DECL_OVERRIDE;
- QPlatformBackingStore *createPlatformBackingStore(QWindow *window) const Q_DECL_OVERRIDE;
+ QPlatformWindow *createPlatformWindow(QWindow *window) const override;
+ QPlatformBackingStore *createPlatformBackingStore(QWindow *window) const override;
#ifndef QT_NO_OPENGL
- QPlatformOpenGLContext *createPlatformOpenGLContext(QOpenGLContext *context) const Q_DECL_OVERRIDE;
+ QPlatformOpenGLContext *createPlatformOpenGLContext(QOpenGLContext *context) const override;
#endif
- QPlatformFontDatabase *fontDatabase() const Q_DECL_OVERRIDE;
+ QPlatformFontDatabase *fontDatabase() const override;
- QAbstractEventDispatcher *createEventDispatcher() const Q_DECL_OVERRIDE;
+ QAbstractEventDispatcher *createEventDispatcher() const override;
- QVariant styleHint(QPlatformIntegration::StyleHint hint) const Q_DECL_OVERRIDE;
+ QVariant styleHint(QPlatformIntegration::StyleHint hint) const override;
private:
QPlatformFontDatabase *mFontDb;
diff --git a/src/plugins/platforms/minimalegl/qminimaleglscreen.cpp b/src/plugins/platforms/minimalegl/qminimaleglscreen.cpp
index 0175d2dbdd..6e122e28ce 100644
--- a/src/plugins/platforms/minimalegl/qminimaleglscreen.cpp
+++ b/src/plugins/platforms/minimalegl/qminimaleglscreen.cpp
@@ -64,7 +64,7 @@ public:
{
}
- EGLSurface eglSurfaceForPlatformSurface(QPlatformSurface *surface) Q_DECL_OVERRIDE
+ EGLSurface eglSurfaceForPlatformSurface(QPlatformSurface *surface) override
{
QMinimalEglWindow *window = static_cast<QMinimalEglWindow *>(surface);
QMinimalEglScreen *screen = static_cast<QMinimalEglScreen *>(window->screen());
diff --git a/src/plugins/platforms/minimalegl/qminimaleglscreen.h b/src/plugins/platforms/minimalegl/qminimaleglscreen.h
index 24098b8127..926936ae32 100644
--- a/src/plugins/platforms/minimalegl/qminimaleglscreen.h
+++ b/src/plugins/platforms/minimalegl/qminimaleglscreen.h
@@ -56,9 +56,9 @@ public:
QMinimalEglScreen(EGLNativeDisplayType display);
~QMinimalEglScreen();
- QRect geometry() const Q_DECL_OVERRIDE;
- int depth() const Q_DECL_OVERRIDE;
- QImage::Format format() const Q_DECL_OVERRIDE;
+ QRect geometry() const override;
+ int depth() const override;
+ QImage::Format format() const override;
#ifndef QT_NO_OPENGL
QPlatformOpenGLContext *platformContext() const;
#endif
diff --git a/src/plugins/platforms/minimalegl/qminimaleglwindow.h b/src/plugins/platforms/minimalegl/qminimaleglwindow.h
index b8bfd6c8d2..098ec05e6b 100644
--- a/src/plugins/platforms/minimalegl/qminimaleglwindow.h
+++ b/src/plugins/platforms/minimalegl/qminimaleglwindow.h
@@ -51,8 +51,8 @@ class QMinimalEglWindow : public QPlatformWindow
public:
QMinimalEglWindow(QWindow *w);
- void setGeometry(const QRect &) Q_DECL_OVERRIDE;
- WId winId() const Q_DECL_OVERRIDE;
+ void setGeometry(const QRect &) override;
+ WId winId() const override;
private:
WId m_winid;
diff --git a/src/plugins/platforms/offscreen/main.cpp b/src/plugins/platforms/offscreen/main.cpp
index 9750c4f7ca..207db60f3a 100644
--- a/src/plugins/platforms/offscreen/main.cpp
+++ b/src/plugins/platforms/offscreen/main.cpp
@@ -48,7 +48,7 @@ class QOffscreenIntegrationPlugin : public QPlatformIntegrationPlugin
Q_OBJECT
Q_PLUGIN_METADATA(IID QPlatformIntegrationFactoryInterface_iid FILE "offscreen.json")
public:
- QPlatformIntegration *create(const QString&, const QStringList&) Q_DECL_OVERRIDE;
+ QPlatformIntegration *create(const QString&, const QStringList&) override;
};
QPlatformIntegration *QOffscreenIntegrationPlugin::create(const QString& system, const QStringList& paramList)
diff --git a/src/plugins/platforms/offscreen/qoffscreencommon.cpp b/src/plugins/platforms/offscreen/qoffscreencommon.cpp
index 85422071aa..f0eb69718a 100644
--- a/src/plugins/platforms/offscreen/qoffscreencommon.cpp
+++ b/src/plugins/platforms/offscreen/qoffscreencommon.cpp
@@ -55,8 +55,8 @@ class QOffscreenCursor : public QPlatformCursor
public:
QOffscreenCursor() : m_pos(10, 10) {}
- QPoint pos() const Q_DECL_OVERRIDE { return m_pos; }
- void setPos(const QPoint &pos) Q_DECL_OVERRIDE
+ QPoint pos() const override { return m_pos; }
+ void setPos(const QPoint &pos) override
{
m_pos = pos;
const QWindowList wl = QGuiApplication::topLevelWindows();
@@ -82,7 +82,7 @@ public:
QOffscreenScreen::windowContainingCursor = containing ? containing->handle() : 0;
}
#ifndef QT_NO_CURSOR
- void changeCursor(QCursor *windowCursor, QWindow *window) Q_DECL_OVERRIDE
+ void changeCursor(QCursor *windowCursor, QWindow *window) override
{
Q_UNUSED(windowCursor);
Q_UNUSED(window);
diff --git a/src/plugins/platforms/offscreen/qoffscreencommon.h b/src/plugins/platforms/offscreen/qoffscreencommon.h
index 1a9d65972d..541c07384c 100644
--- a/src/plugins/platforms/offscreen/qoffscreencommon.h
+++ b/src/plugins/platforms/offscreen/qoffscreencommon.h
@@ -57,12 +57,12 @@ class QOffscreenScreen : public QPlatformScreen
public:
QOffscreenScreen();
- QRect geometry() const Q_DECL_OVERRIDE { return m_geometry; }
- int depth() const Q_DECL_OVERRIDE { return 32; }
- QImage::Format format() const Q_DECL_OVERRIDE { return QImage::Format_RGB32; }
- QPlatformCursor *cursor() const Q_DECL_OVERRIDE { return m_cursor.data(); }
+ QRect geometry() const override { return m_geometry; }
+ int depth() const override { return 32; }
+ QImage::Format format() const override { return QImage::Format_RGB32; }
+ QPlatformCursor *cursor() const override { return m_cursor.data(); }
- QPixmap grabWindow(WId window, int x, int y, int width, int height) const Q_DECL_OVERRIDE;
+ QPixmap grabWindow(WId window, int x, int y, int width, int height) const override;
static QPlatformWindow *windowContainingCursor;
@@ -75,7 +75,7 @@ public:
class QOffscreenDrag : public QPlatformDrag
{
public:
- Qt::DropAction drag(QDrag *) Q_DECL_OVERRIDE { return Qt::IgnoreAction; }
+ Qt::DropAction drag(QDrag *) override { return Qt::IgnoreAction; }
};
#endif
@@ -85,10 +85,10 @@ public:
QOffscreenBackingStore(QWindow *window);
~QOffscreenBackingStore();
- QPaintDevice *paintDevice() Q_DECL_OVERRIDE;
- void flush(QWindow *window, const QRegion &region, const QPoint &offset) Q_DECL_OVERRIDE;
- void resize(const QSize &size, const QRegion &staticContents) Q_DECL_OVERRIDE;
- bool scroll(const QRegion &area, int dx, int dy) Q_DECL_OVERRIDE;
+ QPaintDevice *paintDevice() override;
+ void flush(QWindow *window, const QRegion &region, const QPoint &offset) override;
+ void resize(const QSize &size, const QRegion &staticContents) override;
+ bool scroll(const QRegion &area, int dx, int dy) override;
QPixmap grabWindow(WId window, const QRect &rect) const;
diff --git a/src/plugins/platforms/offscreen/qoffscreenintegration.h b/src/plugins/platforms/offscreen/qoffscreenintegration.h
index f72587d11a..c84c1f7c50 100644
--- a/src/plugins/platforms/offscreen/qoffscreenintegration.h
+++ b/src/plugins/platforms/offscreen/qoffscreenintegration.h
@@ -54,20 +54,20 @@ public:
QOffscreenIntegration();
~QOffscreenIntegration();
- void initialize() Q_DECL_OVERRIDE;
- bool hasCapability(QPlatformIntegration::Capability cap) const Q_DECL_OVERRIDE;
+ void initialize() override;
+ bool hasCapability(QPlatformIntegration::Capability cap) const override;
- QPlatformWindow *createPlatformWindow(QWindow *window) const Q_DECL_OVERRIDE;
- QPlatformBackingStore *createPlatformBackingStore(QWindow *window) const Q_DECL_OVERRIDE;
+ QPlatformWindow *createPlatformWindow(QWindow *window) const override;
+ QPlatformBackingStore *createPlatformBackingStore(QWindow *window) const override;
#ifndef QT_NO_DRAGANDDROP
- QPlatformDrag *drag() const Q_DECL_OVERRIDE;
+ QPlatformDrag *drag() const override;
#endif
- QPlatformInputContext *inputContext() const Q_DECL_OVERRIDE;
- QPlatformServices *services() const Q_DECL_OVERRIDE;
+ QPlatformInputContext *inputContext() const override;
+ QPlatformServices *services() const override;
- QPlatformFontDatabase *fontDatabase() const Q_DECL_OVERRIDE;
- QAbstractEventDispatcher *createEventDispatcher() const Q_DECL_OVERRIDE;
+ QPlatformFontDatabase *fontDatabase() const override;
+ QAbstractEventDispatcher *createEventDispatcher() const override;
QStringList themeNames() const;
QPlatformTheme *createPlatformTheme(const QString &name) const;
diff --git a/src/plugins/platforms/offscreen/qoffscreenintegration_x11.h b/src/plugins/platforms/offscreen/qoffscreenintegration_x11.h
index aaca74d2fb..5e1c6b799b 100644
--- a/src/plugins/platforms/offscreen/qoffscreenintegration_x11.h
+++ b/src/plugins/platforms/offscreen/qoffscreenintegration_x11.h
@@ -55,9 +55,9 @@ class QOffscreenX11Info;
class QOffscreenX11Integration : public QOffscreenIntegration
{
public:
- bool hasCapability(QPlatformIntegration::Capability cap) const Q_DECL_OVERRIDE;
+ bool hasCapability(QPlatformIntegration::Capability cap) const override;
- QPlatformOpenGLContext *createPlatformOpenGLContext(QOpenGLContext *context) const Q_DECL_OVERRIDE;
+ QPlatformOpenGLContext *createPlatformOpenGLContext(QOpenGLContext *context) const override;
private:
mutable QScopedPointer<QOffscreenX11Connection> m_connection;
@@ -88,14 +88,14 @@ public:
QOffscreenX11GLXContext(QOffscreenX11Info *x11, QOpenGLContext *context);
~QOffscreenX11GLXContext();
- bool makeCurrent(QPlatformSurface *surface) Q_DECL_OVERRIDE;
- void doneCurrent() Q_DECL_OVERRIDE;
- void swapBuffers(QPlatformSurface *surface) Q_DECL_OVERRIDE;
- QFunctionPointer getProcAddress(const char *procName) Q_DECL_OVERRIDE;
+ bool makeCurrent(QPlatformSurface *surface) override;
+ void doneCurrent() override;
+ void swapBuffers(QPlatformSurface *surface) override;
+ QFunctionPointer getProcAddress(const char *procName) override;
- QSurfaceFormat format() const Q_DECL_OVERRIDE;
- bool isSharing() const Q_DECL_OVERRIDE;
- bool isValid() const Q_DECL_OVERRIDE;
+ QSurfaceFormat format() const override;
+ bool isSharing() const override;
+ bool isValid() const override;
private:
QScopedPointer<QOffscreenX11GLXContextData> d;
diff --git a/src/plugins/platforms/offscreen/qoffscreenwindow.h b/src/plugins/platforms/offscreen/qoffscreenwindow.h
index 0dced9680a..e1f37bb034 100644
--- a/src/plugins/platforms/offscreen/qoffscreenwindow.h
+++ b/src/plugins/platforms/offscreen/qoffscreenwindow.h
@@ -53,15 +53,15 @@ public:
QOffscreenWindow(QWindow *window);
~QOffscreenWindow();
- void setGeometry(const QRect &rect) Q_DECL_OVERRIDE;
- void setWindowState(Qt::WindowStates states) Q_DECL_OVERRIDE;
+ void setGeometry(const QRect &rect) override;
+ void setWindowState(Qt::WindowStates states) override;
- QMargins frameMargins() const Q_DECL_OVERRIDE;
+ QMargins frameMargins() const override;
- void setVisible(bool visible) Q_DECL_OVERRIDE;
- void requestActivateWindow() Q_DECL_OVERRIDE;
+ void setVisible(bool visible) override;
+ void requestActivateWindow() override;
- WId winId() const Q_DECL_OVERRIDE;
+ WId winId() const override;
static QOffscreenWindow *windowForWinId(WId id);
diff --git a/src/plugins/platforms/qnx/qqnxrasterbackingstore.cpp b/src/plugins/platforms/qnx/qqnxrasterbackingstore.cpp
index a758bdf7f4..dd7f907ee0 100644
--- a/src/plugins/platforms/qnx/qqnxrasterbackingstore.cpp
+++ b/src/plugins/platforms/qnx/qqnxrasterbackingstore.cpp
@@ -139,6 +139,7 @@ void QQnxRasterBackingStore::beginPaint(const QRegion &region)
platformWindow()->adjustBufferSize();
if (window()->requestedFormat().alphaBufferSize() > 0) {
+ auto platformScreen = static_cast<QQnxScreen *>(platformWindow()->screen());
for (const QRect &r : region) {
// Clear transparent regions
const int bg[] = {
@@ -149,11 +150,11 @@ void QQnxRasterBackingStore::beginPaint(const QRegion &region)
SCREEN_BLIT_DESTINATION_HEIGHT, r.height(),
SCREEN_BLIT_END
};
- Q_SCREEN_CHECKERROR(screen_fill(platformWindow()->screen()->nativeContext(),
+ Q_SCREEN_CHECKERROR(screen_fill(platformScreen->nativeContext(),
platformWindow()->renderBuffer().nativeBuffer(), bg),
"failed to clear transparent regions");
}
- Q_SCREEN_CHECKERROR(screen_flush_blits(platformWindow()->screen()->nativeContext(),
+ Q_SCREEN_CHECKERROR(screen_flush_blits(platformScreen->nativeContext(),
SCREEN_WAIT_IDLE), "failed to flush blits");
}
}
diff --git a/src/plugins/platforms/qnx/qqnxrasterwindow.cpp b/src/plugins/platforms/qnx/qqnxrasterwindow.cpp
index 7f11de228e..dc844189d1 100644
--- a/src/plugins/platforms/qnx/qqnxrasterwindow.cpp
+++ b/src/plugins/platforms/qnx/qqnxrasterwindow.cpp
@@ -141,6 +141,7 @@ QQnxBuffer &QQnxRasterWindow::renderBuffer()
// Check if render buffer is invalid
if (m_currentBufferIndex == -1) {
+ auto platformScreen = static_cast<QQnxScreen *>(screen());
// Get all buffers available for rendering
screen_buffer_t buffers[MAX_BUFFER_COUNT];
const int result = screen_get_window_property_pv(nativeHandle(), SCREEN_PROPERTY_RENDER_BUFFERS,
@@ -153,11 +154,11 @@ QQnxBuffer &QQnxRasterWindow::renderBuffer()
// Clear Buffer
int bg[] = { SCREEN_BLIT_COLOR, 0x00000000, SCREEN_BLIT_END };
- Q_SCREEN_CHECKERROR(screen_fill(screen()->nativeContext(), buffers[i], bg),
+ Q_SCREEN_CHECKERROR(screen_fill(platformScreen->nativeContext(), buffers[i], bg),
"Failed to clear window buffer");
}
- Q_SCREEN_CHECKERROR(screen_flush_blits(screen()->nativeContext(), 0),
+ Q_SCREEN_CHECKERROR(screen_flush_blits(platformScreen->nativeContext(), 0),
"Failed to flush blits");
// Use the first available render buffer
@@ -185,7 +186,7 @@ void QQnxRasterWindow::adjustBufferSize()
int QQnxRasterWindow::pixelFormat() const
{
- return screen()->nativeFormat();
+ return static_cast<QQnxScreen *>(screen())->nativeFormat();
}
void QQnxRasterWindow::resetBuffers()
diff --git a/src/plugins/platforms/qnx/qqnxwindow.cpp b/src/plugins/platforms/qnx/qqnxwindow.cpp
index 2253e3b23d..38b61fd782 100644
--- a/src/plugins/platforms/qnx/qqnxwindow.cpp
+++ b/src/plugins/platforms/qnx/qqnxwindow.cpp
@@ -479,7 +479,7 @@ void QQnxWindow::setParent(const QPlatformWindow *window)
if (newParent == m_parentWindow)
return;
- if (screen()->rootWindow() == this) {
+ if (static_cast<QQnxScreen *>(screen())->rootWindow() == this) {
qWarning("Application window cannot be reparented");
return;
}
@@ -539,7 +539,7 @@ void QQnxWindow::requestActivateWindow()
if (focusWindow == this)
return;
- if (screen()->rootWindow() == this ||
+ if (static_cast<QQnxScreen *>(screen())->rootWindow() == this ||
(focusWindow && findWindow(focusWindow->nativeHandle()))) {
// If the focus window is a child, we can just set the focus of our own window
// group to our window handle
@@ -550,6 +550,7 @@ void QQnxWindow::requestActivateWindow()
QQnxWindow *currentWindow = this;
QList<QQnxWindow*> windowList;
while (currentWindow) {
+ auto platformScreen = static_cast<QQnxScreen *>(screen());
windowList.prepend(currentWindow);
// If we find the focus window, we don't have to go further
if (currentWindow == focusWindow)
@@ -557,9 +558,9 @@ void QQnxWindow::requestActivateWindow()
if (currentWindow->parent()){
currentWindow = static_cast<QQnxWindow*>(currentWindow->parent());
- } else if (screen()->rootWindow() &&
- screen()->rootWindow()->m_windowGroupName == currentWindow->m_parentGroupName) {
- currentWindow = screen()->rootWindow();
+ } else if (platformScreen->rootWindow() &&
+ platformScreen->rootWindow()->m_windowGroupName == currentWindow->m_parentGroupName) {
+ currentWindow = platformScreen->rootWindow();
} else {
currentWindow = 0;
}
@@ -622,6 +623,11 @@ void QQnxWindow::clearMMRendererWindow()
m_mmRendererWindow = 0;
}
+QPlatformScreen *QQnxWindow::screen() const
+{
+ return m_screen;
+}
+
QQnxWindow *QQnxWindow::findWindow(screen_window_t windowHandle)
{
if (m_window == windowHandle)
@@ -775,7 +781,8 @@ void QQnxWindow::windowPosted()
bool QQnxWindow::shouldMakeFullScreen() const
{
- return ((screen()->rootWindow() == this) && (QQnxIntegration::options() & QQnxIntegration::FullScreenApplication));
+ return ((static_cast<QQnxScreen *>(screen())->rootWindow() == this)
+ && (QQnxIntegration::options() & QQnxIntegration::FullScreenApplication));
}
QT_END_NAMESPACE
diff --git a/src/plugins/platforms/qnx/qqnxwindow.h b/src/plugins/platforms/qnx/qqnxwindow.h
index f96edc49e4..dfcca78f80 100644
--- a/src/plugins/platforms/qnx/qqnxwindow.h
+++ b/src/plugins/platforms/qnx/qqnxwindow.h
@@ -94,7 +94,7 @@ public:
void setMMRendererWindow(screen_window_t handle);
void clearMMRendererWindow();
- QQnxScreen *screen() const { return m_screen; }
+ QPlatformScreen *screen() const override;
const QList<QQnxWindow*>& children() const { return m_childWindows; }
QQnxWindow *findWindow(screen_window_t windowHandle);
diff --git a/src/plugins/platforms/vnc/qvnc.cpp b/src/plugins/platforms/vnc/qvnc.cpp
index fa65e8c9a4..44fc1c6101 100644
--- a/src/plugins/platforms/vnc/qvnc.cpp
+++ b/src/plugins/platforms/vnc/qvnc.cpp
@@ -476,7 +476,8 @@ void QRfbRawEncoder::write()
// rgn &= QRect(0, 0, server->screen()->geometry().width(),
// server->screen()->geometry().height());
// }
- const QVector<QRect> rects = rgn.rects();
+
+ const auto rectsInRegion = rgn.rectCount();
{
const char tmp[2] = { 0, 0 }; // msg type, padding
@@ -484,16 +485,16 @@ void QRfbRawEncoder::write()
}
{
- const quint16 count = htons(rects.size());
+ const quint16 count = htons(rectsInRegion);
socket->write((char *)&count, sizeof(count));
}
- if (rects.size() <= 0)
+ if (rectsInRegion <= 0)
return;
const QImage screenImage = client->server()->screenImage();
- for (const QRect &tileRect: rects) {
+ for (const QRect &tileRect: rgn) {
const QRfbRect rect(tileRect.x(), tileRect.y(),
tileRect.width(), tileRect.height());
rect.write(socket);
diff --git a/src/plugins/platforms/windows/accessible/accessible.pri b/src/plugins/platforms/windows/accessible/accessible.pri
deleted file mode 100644
index 557bdfe307..0000000000
--- a/src/plugins/platforms/windows/accessible/accessible.pri
+++ /dev/null
@@ -1,19 +0,0 @@
-SOURCES += \
- $$PWD/qwindowsaccessibility.cpp \
- $$PWD/comutils.cpp
-
-HEADERS += \
- $$PWD/qwindowsaccessibility.h \
- $$PWD/comutils.h
-
-SOURCES += \
- $$PWD/qwindowsmsaaaccessible.cpp \
- $$PWD/iaccessible2.cpp
-
-HEADERS += \
- $$PWD/qwindowsmsaaaccessible.h \
- $$PWD/iaccessible2.h
-
-include(../../../../3rdparty/iaccessible2/iaccessible2.pri)
-
-mingw: LIBS *= -luuid
diff --git a/src/plugins/platforms/windows/accessible/comutils.cpp b/src/plugins/platforms/windows/accessible/comutils.cpp
deleted file mode 100644
index 1c072c5e2c..0000000000
--- a/src/plugins/platforms/windows/accessible/comutils.cpp
+++ /dev/null
@@ -1,280 +0,0 @@
-/****************************************************************************
-**
-** Copyright (C) 2016 The Qt Company Ltd.
-** Contact: https://www.qt.io/licensing/
-**
-** This file is part of the plugins of the Qt Toolkit.
-**
-** $QT_BEGIN_LICENSE:LGPL$
-** Commercial License Usage
-** Licensees holding valid commercial Qt licenses may use this file in
-** accordance with the commercial license agreement provided with the
-** Software or, alternatively, in accordance with the terms contained in
-** a written agreement between you and The Qt Company. For licensing terms
-** and conditions see https://www.qt.io/terms-conditions. For further
-** information use the contact form at https://www.qt.io/contact-us.
-**
-** GNU Lesser General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU Lesser
-** General Public License version 3 as published by the Free Software
-** Foundation and appearing in the file LICENSE.LGPL3 included in the
-** packaging of this file. Please review the following information to
-** ensure the GNU Lesser General Public License version 3 requirements
-** will be met: https://www.gnu.org/licenses/lgpl-3.0.html.
-**
-** GNU General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU
-** General Public License version 2.0 or (at your option) the GNU General
-** Public license version 3 or any later version approved by the KDE Free
-** Qt Foundation. The licenses are as published by the Free Software
-** Foundation and appearing in the file LICENSE.GPL2 and LICENSE.GPL3
-** included in the packaging of this file. Please review the following
-** information to ensure the GNU General Public License requirements will
-** be met: https://www.gnu.org/licenses/gpl-2.0.html and
-** https://www.gnu.org/licenses/gpl-3.0.html.
-**
-** $QT_END_LICENSE$
-**
-****************************************************************************/
-
-#include <qt_windows.h>
-
-#include <ocidl.h>
-#include <olectl.h>
-
-#include "comutils.h"
-#include <QtCore/qdatetime.h>
-#include <QtGui/qpixmap.h>
-#include <QtGui/qfont.h>
-
-
-#include <QtCore/qvariant.h>
-#include <QtCore/qbytearray.h>
-#include <QtGui/qcolor.h>
-
-QT_BEGIN_NAMESPACE
-
-static DATE QDateTimeToDATE(const QDateTime &dt)
-{
- if (!dt.isValid() || dt.isNull())
- return 949998; // Special value for no date (01/01/4501)
-
- SYSTEMTIME stime;
- memset(&stime, 0, sizeof(stime));
- QDate date = dt.date();
- QTime time = dt.time();
- if (date.isValid() && !date.isNull()) {
- stime.wDay = WORD(date.day());
- stime.wMonth = WORD(date.month());
- stime.wYear = WORD(date.year());
- }
- if (time.isValid() && !time.isNull()) {
- stime.wMilliseconds = WORD(time.msec());
- stime.wSecond = WORD(time.second());
- stime.wMinute = WORD(time.minute());
- stime.wHour = WORD(time.hour());
- }
-
- double vtime;
- SystemTimeToVariantTime(&stime, &vtime);
-
- return vtime;
-}
-
-inline uint QColorToOLEColor(const QColor &col)
-{
- return qRgba(col.blue(), col.green(), col.red(), 0x00);
-}
-
-bool QVariant2VARIANT(const QVariant &var, VARIANT &arg, const QByteArray &typeName, bool out)
-{
- QVariant qvar = var;
- // "type" is the expected type, so coerce if necessary
- QVariant::Type proptype = typeName.isEmpty() ? QVariant::Invalid : QVariant::nameToType(typeName);
- if (proptype == QVariant::UserType && !typeName.isEmpty()) {
- if (typeName == "short" || typeName == "char")
- proptype = QVariant::Int;
- else if (typeName == "float")
- proptype = QVariant::Double;
- }
- if (proptype != QVariant::Invalid && proptype != QVariant::UserType && proptype != qvar.type()) {
- if (qvar.canConvert(int(proptype)))
- qvar.convert(int(proptype));
- else
- qvar = QVariant(proptype);
- }
-
- if (out && arg.vt == (VT_VARIANT|VT_BYREF) && arg.pvarVal) {
- return QVariant2VARIANT(var, *arg.pvarVal, typeName, false);
- }
-
- if (out && proptype == QVariant::UserType && typeName == "QVariant") {
- VARIANT *pVariant = new VARIANT;
- QVariant2VARIANT(var, *pVariant, QByteArray(), false);
- arg.vt = VT_VARIANT|VT_BYREF;
- arg.pvarVal = pVariant;
- return true;
- }
-
- switch ((int)qvar.type()) {
- case QVariant::String:
- if (out && arg.vt == (VT_BSTR|VT_BYREF)) {
- if (*arg.pbstrVal)
- SysFreeString(*arg.pbstrVal);
- *arg.pbstrVal = QStringToBSTR(qvar.toString());
- arg.vt = VT_BSTR|VT_BYREF;
- } else {
- arg.vt = VT_BSTR;
- arg.bstrVal = QStringToBSTR(qvar.toString());
- if (out) {
- arg.pbstrVal = new BSTR(arg.bstrVal);
- arg.vt |= VT_BYREF;
- }
- }
- break;
-
- case QVariant::Int:
- if (out && arg.vt == (VT_I4|VT_BYREF)) {
- *arg.plVal = qvar.toInt();
- } else {
- arg.vt = VT_I4;
- arg.lVal = qvar.toInt();
- if (out) {
- if (typeName == "short") {
- arg.vt = VT_I2;
- arg.piVal = new short(arg.lVal);
- } else if (typeName == "char") {
- arg.vt = VT_I1;
- arg.pcVal= new char(arg.lVal);
- } else {
- arg.plVal = new long(arg.lVal);
- }
- arg.vt |= VT_BYREF;
- }
- }
- break;
-
- case QVariant::UInt:
- if (out && (arg.vt == (VT_UINT|VT_BYREF) || arg.vt == (VT_I4|VT_BYREF))) {
- *arg.puintVal = qvar.toUInt();
- } else {
- arg.vt = VT_UINT;
- arg.uintVal = qvar.toUInt();
- if (out) {
- arg.puintVal = new uint(arg.uintVal);
- arg.vt |= VT_BYREF;
- }
- }
- break;
-
- case QVariant::LongLong:
- if (out && arg.vt == (VT_CY|VT_BYREF)) {
- arg.pcyVal->int64 = qvar.toLongLong();
- } else if (out && arg.vt == (VT_I8|VT_BYREF)) {
- *arg.pllVal = qvar.toLongLong();
- } else {
- arg.vt = VT_I8;
- arg.llVal = qvar.toLongLong();
- if (out) {
- arg.pllVal = new LONGLONG(arg.llVal);
- arg.vt |= VT_BYREF;
- }
- }
- break;
-
- case QVariant::ULongLong:
- if (out && arg.vt == (VT_CY|VT_BYREF)) {
- arg.pcyVal->int64 = qvar.toULongLong();
- } else if (out && arg.vt == (VT_UI8|VT_BYREF)) {
- *arg.pullVal = qvar.toULongLong();
- } else {
- arg.vt = VT_UI8;
- arg.ullVal = qvar.toULongLong();
- if (out) {
- arg.pullVal = new ULONGLONG(arg.ullVal);
- arg.vt |= VT_BYREF;
- }
- }
- break;
-
- case QVariant::Bool:
- if (out && arg.vt == (VT_BOOL|VT_BYREF)) {
- *arg.pboolVal = qvar.toBool() ? VARIANT_TRUE : VARIANT_FALSE;
- } else {
- arg.vt = VT_BOOL;
- arg.boolVal = qvar.toBool() ? VARIANT_TRUE : VARIANT_FALSE;
- if (out) {
- arg.pboolVal = new short(arg.boolVal);
- arg.vt |= VT_BYREF;
- }
- }
- break;
- case QVariant::Double:
- if (out && arg.vt == (VT_R8|VT_BYREF)) {
- *arg.pdblVal = qvar.toDouble();
- } else {
- arg.vt = VT_R8;
- arg.dblVal = qvar.toDouble();
- if (out) {
- if (typeName == "float") {
- arg.vt = VT_R4;
- arg.pfltVal = new float(arg.dblVal);
- } else {
- arg.pdblVal = new double(arg.dblVal);
- }
- arg.vt |= VT_BYREF;
- }
- }
- break;
- case QVariant::Color:
- if (out && arg.vt == (VT_COLOR|VT_BYREF)) {
-
- *arg.plVal = QColorToOLEColor(qvariant_cast<QColor>(qvar));
- } else {
- arg.vt = VT_COLOR;
- arg.lVal = QColorToOLEColor(qvariant_cast<QColor>(qvar));
- if (out) {
- arg.plVal = new long(arg.lVal);
- arg.vt |= VT_BYREF;
- }
- }
- break;
-
- case QVariant::Date:
- case QVariant::Time:
- case QVariant::DateTime:
- if (out && arg.vt == (VT_DATE|VT_BYREF)) {
- *arg.pdate = QDateTimeToDATE(qvar.toDateTime());
- } else {
- arg.vt = VT_DATE;
- arg.date = QDateTimeToDATE(qvar.toDateTime());
- if (out) {
- arg.pdate = new DATE(arg.date);
- arg.vt |= VT_BYREF;
- }
- }
- break;
-
- case QVariant::Invalid: // default-parameters not set
- if (out && arg.vt == (VT_ERROR|VT_BYREF)) {
- *arg.plVal = DISP_E_PARAMNOTFOUND;
- } else {
- arg.vt = VT_ERROR;
- arg.lVal = DISP_E_PARAMNOTFOUND;
- if (out) {
- arg.plVal = new long(arg.lVal);
- arg.vt |= VT_BYREF;
- }
- }
- break;
-
- default:
- return false;
- }
-
- Q_ASSERT(!out || (arg.vt & VT_BYREF));
- return true;
-}
-
-QT_END_NAMESPACE
-
diff --git a/src/plugins/platforms/windows/accessible/iaccessible2.cpp b/src/plugins/platforms/windows/accessible/iaccessible2.cpp
deleted file mode 100644
index 75af65b5ab..0000000000
--- a/src/plugins/platforms/windows/accessible/iaccessible2.cpp
+++ /dev/null
@@ -1,1640 +0,0 @@
-/****************************************************************************
-**
-** Copyright (C) 2016 The Qt Company Ltd.
-** Contact: https://www.qt.io/licensing/
-**
-** This file is part of the plugins of the Qt Toolkit.
-**
-** $QT_BEGIN_LICENSE:LGPL$
-** Commercial License Usage
-** Licensees holding valid commercial Qt licenses may use this file in
-** accordance with the commercial license agreement provided with the
-** Software or, alternatively, in accordance with the terms contained in
-** a written agreement between you and The Qt Company. For licensing terms
-** and conditions see https://www.qt.io/terms-conditions. For further
-** information use the contact form at https://www.qt.io/contact-us.
-**
-** GNU Lesser General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU Lesser
-** General Public License version 3 as published by the Free Software
-** Foundation and appearing in the file LICENSE.LGPL3 included in the
-** packaging of this file. Please review the following information to
-** ensure the GNU Lesser General Public License version 3 requirements
-** will be met: https://www.gnu.org/licenses/lgpl-3.0.html.
-**
-** GNU General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU
-** General Public License version 2.0 or (at your option) the GNU General
-** Public license version 3 or any later version approved by the KDE Free
-** Qt Foundation. The licenses are as published by the Free Software
-** Foundation and appearing in the file LICENSE.GPL2 and LICENSE.GPL3
-** included in the packaging of this file. Please review the following
-** information to ensure the GNU General Public License requirements will
-** be met: https://www.gnu.org/licenses/gpl-2.0.html and
-** https://www.gnu.org/licenses/gpl-3.0.html.
-**
-** $QT_END_LICENSE$
-**
-****************************************************************************/
-#include <QtCore/qglobal.h>
-#ifndef QT_NO_ACCESSIBILITY
-
-#include "iaccessible2.h"
-#include "qwindowsaccessibility.h"
-#include <QtAccessibilitySupport/private/qaccessiblebridgeutils_p.h>
-#include <QtGui/qaccessible.h>
-#include <QtGui/qclipboard.h>
-#include <QtGui/qguiapplication.h>
-#include <QtGui/private/qhighdpiscaling_p.h>
-#include <QtCore/qdebug.h>
-
-#include <algorithm>
-
-QT_BEGIN_NAMESPACE
-
-template <class T>
-static inline T *coTaskMemAllocArray(int size)
-{
- return static_cast<T *>(::CoTaskMemAlloc(sizeof(T) * size_t(size)));
-}
-
-/**************************************************************\
- * AccessibleApplication *
- **************************************************************/
-
-HRESULT STDMETHODCALLTYPE AccessibleApplication::get_appName(/* [retval][out] */ BSTR *name)
-{
- const QString appName = QGuiApplication::applicationName();
- *name = QStringToBSTR(appName);
- return S_OK;
-}
-
-HRESULT STDMETHODCALLTYPE AccessibleApplication::get_appVersion(/* [retval][out] */ BSTR *version)
-{
- const QString appName = QGuiApplication::applicationVersion();
- *version = QStringToBSTR(appName);
- return S_OK;
-}
-
-HRESULT STDMETHODCALLTYPE AccessibleApplication::get_toolkitName(/* [retval][out] */ BSTR *name)
-{
- *name = ::SysAllocString(L"Qt");
- return S_OK;
-}
-
-HRESULT STDMETHODCALLTYPE AccessibleApplication::get_toolkitVersion(/* [retval][out] */ BSTR *version)
-{
- *version = ::SysAllocString(TEXT(QT_VERSION_STR));
- return S_OK;
-}
-
-
-/**************************************************************\
- * AccessibleRelation *
- **************************************************************/
-AccessibleRelation::AccessibleRelation(const QList<QAccessibleInterface *> &targets,
- QAccessible::Relation relation)
- : m_targets(targets), m_relation(relation)
-{
- Q_ASSERT(m_targets.count());
-}
-
-/* IAccessibleRelation */
-HRESULT STDMETHODCALLTYPE AccessibleRelation::get_relationType(
- /* [retval][out] */ BSTR *relationType)
-{
- *relationType = relationToBSTR(m_relation);
- return S_OK;
-}
-
-HRESULT STDMETHODCALLTYPE AccessibleRelation::get_localizedRelationType(
- /* [retval][out] */ BSTR *localizedRelationType)
-{
- // Who ever needs this???
- *localizedRelationType = relationToBSTR(m_relation);
- return S_OK;
-}
-
-HRESULT STDMETHODCALLTYPE AccessibleRelation::get_nTargets(
- /* [retval][out] */ long *nTargets)
-{
- // ### always one target
- *nTargets = m_targets.count();
- return S_OK;
-}
-
-/*!
- \internal
- Client allocates and deallocates array
- (see "Special Consideration when using Arrays", in Accessible2.idl)
- */
-HRESULT STDMETHODCALLTYPE AccessibleRelation::get_target(
- /* [in] */ long targetIndex,
- /* [retval][out] */ IUnknown **target)
-{
- if (targetIndex >= 0 && targetIndex < m_targets.count()) {
- QAccessibleInterface *iface = m_targets.at(targetIndex);
- *target = QWindowsAccessibility::wrap(iface);
- if (*target)
- return S_OK;
- return E_FAIL;
- }
- return E_INVALIDARG;
-}
-
-/*!
- \internal
- Client allocates and deallocates \a targets array
- (see "Special Consideration when using Arrays", in Accessible2.idl)
- */
-HRESULT STDMETHODCALLTYPE AccessibleRelation::get_targets(
- /* [in] */ long maxTargets,
- /* [length_is][size_is][out] */ IUnknown **targets,
- /* [retval][out] */ long *nTargets)
-{
-
- const int numTargets = qMin(int(maxTargets), m_targets.count());
- for (int i = 0; i < numTargets; ++i) {
- QAccessibleInterface *iface = m_targets.at(i);
- IAccessible *iacc = QWindowsAccessibility::wrap(iface);
- if (!iacc)
- return E_FAIL;
- *targets = iacc;
- ++targets;
- }
- *nTargets = numTargets;
- // \a targets array is allocated by client.
- return numTargets > 0 ? S_OK : S_FALSE;
-}
-
-
-/**************************************************************\
- * *
- * IUnknown *
- * *
- **************************************************************/
-HRESULT STDMETHODCALLTYPE QWindowsIA2Accessible::QueryInterface(REFIID id, LPVOID *iface)
-{
- *iface = nullptr;
- QAccessibleInterface *accessible = accessibleInterface();
- if (!accessible)
- return E_NOINTERFACE;
-
- if (SUCCEEDED(QWindowsMsaaAccessible::QueryInterface(id, iface))
- || qWindowsComQueryInterface<IServiceProvider>(this, id, iface)
- || qWindowsComQueryInterface<IAccessible2>(this, id, iface)
- || qWindowsComQueryInterface<IAccessibleComponent>(this, id, iface)) {
- return S_OK;
- }
-
- if (id == IID_IAccessibleAction) {
- if (accessible->actionInterface())
- *iface = static_cast<IAccessibleAction *>(this);
- } else if (id == IID_IAccessibleEditableText) {
- if (accessible->editableTextInterface() ||
- accessible->role() == QAccessible::EditableText)
- {
- *iface = static_cast<IAccessibleEditableText *>(this);
- }
- } else if (id == IID_IAccessibleHyperlink) {
- //*iface = static_cast<IAccessibleHyperlink *>(this);
- } else if (id == IID_IAccessibleHypertext) {
- //*iface = static_cast<IAccessibleHypertext *>(this);
- } else if (id == IID_IAccessibleImage) {
- //*iface = static_cast<IAccessibleImage *>(this);
- } else if (id == IID_IAccessibleTable) {
- //*iface = static_cast<IAccessibleTable *>(this); // not supported
- } else if (id == IID_IAccessibleTable2) {
- if (accessible->tableInterface())
- *iface = static_cast<IAccessibleTable2 *>(this);
- } else if (id == IID_IAccessibleTableCell) {
- if (accessible->tableCellInterface())
- *iface = static_cast<IAccessibleTableCell *>(this);
- } else if (id == IID_IAccessibleText) {
- if (accessible->textInterface())
- *iface = static_cast<IAccessibleText *>(this);
- } else if (id == IID_IAccessibleValue) {
- if (accessible->valueInterface())
- *iface = static_cast<IAccessibleValue *>(this);
- }
- if (*iface) {
- AddRef();
- return S_OK;
- }
- return E_NOINTERFACE;
-}
-
-
-/* Note that IUnknown is inherited from several interfaces. Therefore we must reimplement all its
- functions in the concrete class to avoid ambiguity.
-*/
-ULONG STDMETHODCALLTYPE QWindowsIA2Accessible::AddRef()
-{
- return QWindowsMsaaAccessible::AddRef();
-}
-
-ULONG STDMETHODCALLTYPE QWindowsIA2Accessible::Release()
-{
- return QWindowsMsaaAccessible::Release();
-}
-
-/**************************************************************\
- * *
- * IAccessible2 *
- * *
- **************************************************************/
-HRESULT STDMETHODCALLTYPE QWindowsIA2Accessible::get_nRelations(long *nRelations)
-{
- QAccessibleInterface *accessible = accessibleInterface();
- accessibleDebugClientCalls(accessible);
- if (!nRelations)
- return E_INVALIDARG;
- if (!accessible)
- return E_FAIL;
-
- return getRelationsHelper(0, 0, 0, nRelations);
-}
-
-HRESULT STDMETHODCALLTYPE QWindowsIA2Accessible::get_relation(long relationIndex, IAccessibleRelation **relation)
-{
- QAccessibleInterface *accessible = accessibleInterface();
- accessibleDebugClientCalls(accessible);
- if (!relation)
- return E_INVALIDARG;
- if (!accessible)
- return E_FAIL;
-
- return getRelationsHelper(relation, relationIndex, 1);
-}
-
-/*!
- \internal
- Client allocates and deallocates array
- (see "Special Consideration when using Arrays", in Accessible2.idl)
- */
-HRESULT STDMETHODCALLTYPE QWindowsIA2Accessible::get_relations(long maxRelations,
- IAccessibleRelation **relations,
- long *nRelations)
-{
- QAccessibleInterface *accessible = accessibleInterface();
- accessibleDebugClientCalls(accessible);
- if (!accessible)
- return E_FAIL;
-
- return getRelationsHelper(relations, 0, maxRelations, nRelations);
-}
-
-
-HRESULT STDMETHODCALLTYPE QWindowsIA2Accessible::role(long *ia2role)
-{
- QAccessibleInterface *accessible = accessibleInterface();
- accessibleDebugClientCalls(accessible);
- if (!accessible)
- return E_FAIL;
-
- long r = accessible->role();
-
- switch (r) {
- case QAccessible::LayeredPane: r = IA2_ROLE_LAYERED_PANE; break;
- case QAccessible::Terminal: r = IA2_ROLE_TERMINAL; break;
- case QAccessible::Desktop: r = IA2_ROLE_DESKTOP_PANE; break;
- case QAccessible::Paragraph: r = IA2_ROLE_PARAGRAPH; break;
- case QAccessible::Section: r = IA2_ROLE_SECTION; break;
- default: break;
- }
-
- *ia2role = r;
- return S_OK;
-}
-
-
-HRESULT STDMETHODCALLTYPE QWindowsIA2Accessible::scrollTo(enum IA2ScrollType /*scrollType*/)
-{
- //### Ignore for now
- return E_NOTIMPL;
-}
-
-
-HRESULT STDMETHODCALLTYPE QWindowsIA2Accessible::scrollToPoint(enum IA2CoordinateType /*coordinateType*/, long /*x*/, long /*y*/)
-{
- //### Ignore for now
- return E_NOTIMPL;
-}
-
-
-HRESULT STDMETHODCALLTYPE QWindowsIA2Accessible::get_groupPosition(long *groupLevel,
- long *similarItemsInGroup,
- long *positionInGroup)
-{
- // ### Ignore for now. Not sure what this is used for.....
- *groupLevel = 0; // Not applicable
- *similarItemsInGroup = 0; // Not applicable
- *positionInGroup = 0; // Not applicable
- return S_FALSE;
-}
-
-
-HRESULT STDMETHODCALLTYPE QWindowsIA2Accessible::get_states(AccessibleStates *states)
-{
- QAccessibleInterface *accessible = accessibleInterface();
- accessibleDebugClientCalls(accessible);
- if (!accessible)
- return E_FAIL;
- if (!states)
- return E_POINTER;
- QAccessible::State st = accessible->state();
- AccessibleStates ia2states = 0;
- if (st.active)
- ia2states |= IA2_STATE_ACTIVE;
- if (st.invalid)
- ia2states |= IA2_STATE_DEFUNCT;
- if (st.editable)
- ia2states |= IA2_STATE_EDITABLE;
- if (st.multiLine)
- ia2states |= IA2_STATE_MULTI_LINE;
- if (st.selectableText)
- ia2states |= IA2_STATE_SELECTABLE_TEXT;
- if (st.supportsAutoCompletion)
- ia2states |= IA2_STATE_SUPPORTS_AUTOCOMPLETION;
-
- *states = ia2states;
- return S_OK;
-}
-
-
-HRESULT STDMETHODCALLTYPE QWindowsIA2Accessible::get_extendedRole(BSTR *extendedRole)
-{
- //###
- *extendedRole = 0;
- return E_NOTIMPL; // mozilla does this
- //return S_FALSE;
-}
-
-
-HRESULT STDMETHODCALLTYPE QWindowsIA2Accessible::get_localizedExtendedRole(BSTR *localizedExtendedRole)
-{
- //###
- *localizedExtendedRole = 0;
- return E_NOTIMPL; // mozilla does this
- //return S_FALSE;
-}
-
-
-HRESULT STDMETHODCALLTYPE QWindowsIA2Accessible::get_nExtendedStates(long *nExtendedStates)
-{
- // Who will ever intepret these values into something meaningful??
- *nExtendedStates = 0;
- return E_NOTIMPL; // mozilla does this
- //return S_FALSE;
-}
-
-
-HRESULT STDMETHODCALLTYPE QWindowsIA2Accessible::get_extendedStates(long /*maxExtendedStates*/,
- BSTR **extendedStates,
- long *nExtendedStates)
-{
- *extendedStates = 0;
- *nExtendedStates = 0;
- return E_NOTIMPL; // mozilla does this
- //return S_FALSE;
-}
-
-
-HRESULT STDMETHODCALLTYPE QWindowsIA2Accessible::get_localizedExtendedStates(long /*maxLocalizedExtendedStates*/,
- BSTR **localizedExtendedStates,
- long *nLocalizedExtendedStates)
-{
- *localizedExtendedStates = 0;
- *nLocalizedExtendedStates = 0;
- return E_NOTIMPL; // mozilla does this
- //return S_FALSE;
-}
-
-
-HRESULT STDMETHODCALLTYPE QWindowsIA2Accessible::get_uniqueID(long *outUniqueID)
-{
- QAccessibleInterface *accessible = accessibleInterface();
- accessibleDebugClientCalls(accessible);
- if (!accessible)
- return E_FAIL;
-
- qCDebug(lcQpaAccessibility) << "uniqueID: " << showbase << hex << id;
-
- *outUniqueID = (long)id;
- return int(id) < 0 ? S_OK : S_FALSE;
-}
-
-
-HRESULT STDMETHODCALLTYPE QWindowsIA2Accessible::get_windowHandle(HWND *windowHandle)
-{
- QAccessibleInterface *accessible = accessibleInterface();
- accessibleDebugClientCalls(accessible);
- if (!accessible)
- return E_FAIL;
- return GetWindow(windowHandle);
-}
-
-
-HRESULT STDMETHODCALLTYPE QWindowsIA2Accessible::get_indexInParent(long *indexInParent)
-{
- QAccessibleInterface *accessible = accessibleInterface();
- accessibleDebugClientCalls(accessible);
- if (!accessible)
- return E_FAIL;
- if (!indexInParent)
- return E_INVALIDARG;
- QAccessibleInterface *par = accessible->parent();
- *indexInParent = par ? par->indexOfChild(accessible) : -1;
- if (*indexInParent < 0) {
- qCWarning(lcQpaAccessibility) << "index in parent invalid:" << accessible << "parent:" << par;
- return S_FALSE;
- }
- return S_OK;
-}
-
-HRESULT STDMETHODCALLTYPE QWindowsIA2Accessible::get_locale(IA2Locale *locale)
-{
- QAccessibleInterface *accessible = accessibleInterface();
- accessibleDebugClientCalls(accessible);
- if (!accessible)
- return E_FAIL;
- IA2Locale res;
- QLocale l;
- res.country = QStringToBSTR(QLocale::countryToString(l.country()));
- res.language = QStringToBSTR(QLocale::languageToString(l.language()));
- res.variant = QStringToBSTR(QString());
- *locale = res;
- return S_OK;
-}
-
-
-HRESULT STDMETHODCALLTYPE QWindowsIA2Accessible::get_attributes(BSTR *attributes)
-{
- QAccessibleInterface *accessible = accessibleInterface();
- accessibleDebugClientCalls(accessible);
- if (!accessible)
- return E_FAIL;
- *attributes = 0;//QStringToBSTR(QString());
- return S_FALSE;
-}
-
-/**************************************************************\
- * IAccessibleAction *
- **************************************************************/
-HRESULT STDMETHODCALLTYPE QWindowsIA2Accessible::nActions(long *nActions)
-{
- QAccessibleInterface *accessible = accessibleInterface();
- accessibleDebugClientCalls(accessible);
- if (!accessible)
- return E_FAIL;
- *nActions = QAccessibleBridgeUtils::effectiveActionNames(accessible).count();
- return S_OK;
-}
-
-HRESULT STDMETHODCALLTYPE QWindowsIA2Accessible::doAction(long actionIndex)
-{
- QAccessibleInterface *accessible = accessibleInterface();
- accessibleDebugClientCalls(accessible);
- if (!accessible)
- return E_FAIL;
- const QStringList actionNames = QAccessibleBridgeUtils::effectiveActionNames(accessible);
- if (actionIndex < 0 || actionIndex >= actionNames.count())
- return E_INVALIDARG;
- const QString actionName = actionNames.at(actionIndex);
- return QAccessibleBridgeUtils::performEffectiveAction(accessible, actionName) ? S_OK : S_FALSE;
-}
-
-HRESULT STDMETHODCALLTYPE QWindowsIA2Accessible::get_description(long actionIndex, BSTR *description)
-{
- QAccessibleInterface *accessible = accessibleInterface();
- accessibleDebugClientCalls(accessible);
- if (!accessible)
- return E_FAIL;
- *description = 0;
- const QStringList actionNames = QAccessibleBridgeUtils::effectiveActionNames(accessible);
- if (actionIndex < 0 || actionIndex >= actionNames.count())
- return E_INVALIDARG;
- const QString actionName = actionNames.at(actionIndex);
- if (QAccessibleActionInterface *actionIface = actionInterface())
- *description = QStringToBSTR(actionIface->localizedActionDescription(actionName));
- else
- *description = QStringToBSTR(qAccessibleLocalizedActionDescription(actionName));
-
- return *description ? S_OK : S_FALSE;
-}
-
-HRESULT STDMETHODCALLTYPE QWindowsIA2Accessible::get_keyBinding(long actionIndex, long nMaxBindings, BSTR **keyBindings, long *nBindings)
-{
- QAccessibleInterface *accessible = accessibleInterface();
- accessibleDebugClientCalls(accessible);
- if (!accessible)
- return E_FAIL;
- Q_UNUSED(nMaxBindings);
- BSTR *arrayOfBindingsToReturn = 0;
- int numBindings = 0;
- if (QAccessibleActionInterface *actionIface = actionInterface()) {
- const QStringList actionNames = actionIface->actionNames();
- if (actionIndex < 0 || actionIndex >= actionNames.count())
- return E_INVALIDARG;
- const QString actionName = actionNames.at(actionIndex);
- const QStringList keyBindings = actionIface->keyBindingsForAction(actionName);
- numBindings = keyBindings.count();
- if (numBindings > 0) {
- // The IDL documents that the client must free with CoTaskMemFree
- arrayOfBindingsToReturn = coTaskMemAllocArray<BSTR>(numBindings);
- std::transform(keyBindings.constBegin(), keyBindings.constEnd(),
- QT_MAKE_CHECKED_ARRAY_ITERATOR(arrayOfBindingsToReturn, numBindings),
- QStringToBSTR);
- }
- }
- *keyBindings = arrayOfBindingsToReturn;
- *nBindings = numBindings;
-
- return numBindings ? S_OK : S_FALSE;
-}
-
-HRESULT STDMETHODCALLTYPE QWindowsIA2Accessible::get_name(long actionIndex, BSTR *name)
-{
- QAccessibleInterface *accessible = accessibleInterface();
- accessibleDebugClientCalls(accessible);
- if (!accessible)
- return E_FAIL;
- *name = 0;
- const QStringList actionNames = QAccessibleBridgeUtils::effectiveActionNames(accessible);
- if (actionIndex < 0 || actionIndex >= actionNames.count())
- return E_INVALIDARG;
- const QString actionName = actionNames.at(actionIndex);
- *name = QStringToBSTR(actionName);
- return *name ? S_OK : S_FALSE;
-}
-
-HRESULT STDMETHODCALLTYPE QWindowsIA2Accessible::get_localizedName(long actionIndex, BSTR *localizedName)
-{
- QAccessibleInterface *accessible = accessibleInterface();
- accessibleDebugClientCalls(accessible);
- if (!accessible)
- return E_FAIL;
- *localizedName = 0;
- const QStringList actionNames = QAccessibleBridgeUtils::effectiveActionNames(accessible);
- if (actionIndex < 0 || actionIndex >= actionNames.count())
- return E_INVALIDARG;
-
- const QString actionName = actionNames.at(actionIndex);
- if (QAccessibleActionInterface *actionIface = actionInterface())
- *localizedName = QStringToBSTR(actionIface->localizedActionName(actionName));
- else
- *localizedName = QStringToBSTR(QAccessibleActionInterface::tr(qPrintable(actionName)));
-
- return *localizedName ? S_OK : S_FALSE;
-}
-
-/**************************************************************\
- * IAccessibleComponent *
- **************************************************************/
-HRESULT STDMETHODCALLTYPE QWindowsIA2Accessible::get_locationInParent(long *x, long *y)
-{
- QAccessibleInterface *accessible = accessibleInterface();
- accessibleDebugClientCalls(accessible);
- if (!accessible)
- return E_FAIL;
-
- QPoint topLeft = accessible->rect().topLeft();
-
- QAccessibleInterface *parentIface = accessible->parent();
- if (parentIface && parentIface->isValid())
- topLeft -= parentIface->rect().topLeft();
- const QPoint nativeTopLeft = QHighDpi::toNativeLocalPosition(topLeft, accessible->window());
-
-
- *x = nativeTopLeft.x();
- *y = nativeTopLeft.y();
- return S_OK;
-}
-
-HRESULT STDMETHODCALLTYPE QWindowsIA2Accessible::get_foreground(IA2Color *foreground)
-{
- QAccessibleInterface *accessible = accessibleInterface();
- accessibleDebugClientCalls(accessible);
- if (!accessible)
- return E_FAIL;
-
- // IA2Color is a typedef for long
- *foreground = static_cast<IA2Color>(accessible->foregroundColor().rgb());
- return S_OK;
-}
-
-HRESULT STDMETHODCALLTYPE QWindowsIA2Accessible::get_background(IA2Color *background)
-{
- QAccessibleInterface *accessible = accessibleInterface();
- accessibleDebugClientCalls(accessible);
- if (!accessible)
- return E_FAIL;
-
- // IA2Color is a typedef for long
- *background = static_cast<IA2Color>(accessible->backgroundColor().rgb());
- return S_OK;
-}
-
-/**************************************************************\
- * IAccessibleEditableText *
- **************************************************************/
-#if QT_CONFIG(clipboard)
-/*!
- \internal
-
- if \a endOffset == -1 it means end of the text
-*/
-QString QWindowsIA2Accessible::textForRange(int startOffset, int endOffset) const
-{
- QAccessibleInterface *accessible = accessibleInterface();
-
- if (QAccessibleTextInterface *textIface = accessible->textInterface()) {
- if (endOffset == IA2_TEXT_OFFSET_LENGTH)
- endOffset = textIface->characterCount();
- return textIface->text(startOffset, endOffset);
- }
- QString txt = accessible->text(QAccessible::Value);
- if (endOffset == IA2_TEXT_OFFSET_LENGTH)
- endOffset = txt.length();
- return txt.mid(startOffset, endOffset - startOffset);
-}
-#endif
-
-/*!
- \internal
-*/
-void QWindowsIA2Accessible::replaceTextFallback(long startOffset, long endOffset, const QString &txt)
-{
- QAccessibleInterface *accessible = accessibleInterface();
- QString t = textForRange(0, -1);
- if (endOffset == IA2_TEXT_OFFSET_LENGTH)
- endOffset = t.length();
- if (endOffset - startOffset == 0) {
- t.insert(startOffset, txt);
- } else {
- t.replace(startOffset, endOffset - startOffset, txt);
- }
- accessible->setText(QAccessible::Value, t);
-}
-
-HRESULT STDMETHODCALLTYPE QWindowsIA2Accessible::copyText(long startOffset, long endOffset)
-{
- QAccessibleInterface *accessible = accessibleInterface();
- accessibleDebugClientCalls(accessible);
-#if QT_CONFIG(clipboard)
- const QString t = textForRange(startOffset, endOffset);
- QGuiApplication::clipboard()->setText(t);
- return S_OK;
-#else
- return E_NOTIMPL;
-#endif
-}
-
-HRESULT STDMETHODCALLTYPE QWindowsIA2Accessible::deleteText(long startOffset, long endOffset)
-{
- QAccessibleInterface *accessible = accessibleInterface();
- accessibleDebugClientCalls(accessible);
- if (QAccessibleEditableTextInterface *editableTextIface = accessible->editableTextInterface())
- editableTextIface->deleteText(startOffset, endOffset);
- else
- replaceTextFallback(startOffset, endOffset, QString());
- return S_OK;
-}
-
-HRESULT STDMETHODCALLTYPE QWindowsIA2Accessible::insertText(long offset, BSTR *text)
-{
- QAccessibleInterface *accessible = accessibleInterface();
- accessibleDebugClientCalls(accessible);
- const QString txt = QString::fromWCharArray(*text);
- if (QAccessibleEditableTextInterface *editableTextIface = accessible->editableTextInterface())
- editableTextIface->insertText(offset, txt);
- else
- replaceTextFallback(offset, offset, txt);
- return S_OK;
-}
-
-HRESULT STDMETHODCALLTYPE QWindowsIA2Accessible::cutText(long startOffset, long endOffset)
-{
- QAccessibleInterface *accessible = accessibleInterface();
- accessibleDebugClientCalls(accessible);
-#if QT_CONFIG(clipboard)
- const QString t = textForRange(startOffset, endOffset);
- if (QAccessibleEditableTextInterface *editableTextIface = accessible->editableTextInterface())
- editableTextIface->deleteText(startOffset, endOffset);
- else
- replaceTextFallback(startOffset, endOffset, QString());
- QGuiApplication::clipboard()->setText(t);
- return S_OK;
-#else
- return E_NOTIMPL;
-#endif
-}
-
-HRESULT STDMETHODCALLTYPE QWindowsIA2Accessible::pasteText(long offset)
-{
- QAccessibleInterface *accessible = accessibleInterface();
- accessibleDebugClientCalls(accessible);
-#if QT_CONFIG(clipboard)
- const QString txt = QGuiApplication::clipboard()->text();
- if (QAccessibleEditableTextInterface *editableTextIface = accessible->editableTextInterface())
- editableTextIface->insertText(offset, txt);
- else
- replaceTextFallback(offset, offset, txt);
- return S_OK;
-#else
- return E_NOTIMPL;
-#endif
-}
-
-HRESULT STDMETHODCALLTYPE QWindowsIA2Accessible::replaceText(long startOffset, long endOffset, BSTR *text)
-{
- QAccessibleInterface *accessible = accessibleInterface();
- accessibleDebugClientCalls(accessible);
- const QString txt = QString::fromWCharArray(*text);
- if (QAccessibleEditableTextInterface *editableTextIface = accessible->editableTextInterface())
- editableTextIface->replaceText(startOffset, endOffset, txt);
- else
- replaceTextFallback(startOffset, endOffset, txt);
- return S_OK;
-}
-
-HRESULT STDMETHODCALLTYPE QWindowsIA2Accessible::setAttributes(long /*startOffset*/, long /*endOffset*/, BSTR * /*attributes*/)
-{
- return E_NOTIMPL;
-}
-
-
-/**************************************************************\
- * IAccessibleTable2 *
- **************************************************************/
-HRESULT STDMETHODCALLTYPE QWindowsIA2Accessible::get_cellAt( long row, long column, IUnknown **cell)
-{
- QAccessibleInterface *accessible = accessibleInterface();
- accessibleDebugClientCalls(accessible);
- if (!accessible)
- return E_FAIL;
-
- *cell = 0;
- if (QAccessibleTableInterface *tableIface = tableInterface()) {
- if (QAccessibleInterface *qtCell = tableIface->cellAt(row, column)) {
- *cell = QWindowsAccessibility::wrap(qtCell);
- }
- }
- qCDebug(lcQpaAccessibility) << "found cell? " << *cell;
- return *cell ? S_OK : S_FALSE;
-}
-
-HRESULT STDMETHODCALLTYPE QWindowsIA2Accessible::get_caption( IUnknown **captionInterface)
-{
- QAccessibleInterface *accessible = accessibleInterface();
- accessibleDebugClientCalls(accessible);
- if (!accessible)
- return E_FAIL;
-
- *captionInterface = 0;
- if (QAccessibleTableInterface *tableIface = tableInterface()) {
- if (QAccessibleInterface *iface = tableIface->caption())
- *captionInterface = QWindowsAccessibility::wrap(iface);
- }
- return *captionInterface ? S_OK : S_FALSE;
-}
-
-HRESULT STDMETHODCALLTYPE QWindowsIA2Accessible::get_columnDescription( long column, BSTR *description)
-{
- QAccessibleInterface *accessible = accessibleInterface();
- accessibleDebugClientCalls(accessible);
- if (!accessible)
- return E_FAIL;
-
- *description = 0;
- if (QAccessibleTableInterface *tableIface = tableInterface()) {
- const QString qtDesc = tableIface->columnDescription(column);
- if (!qtDesc.isEmpty())
- *description = QStringToBSTR(qtDesc);
- }
- return *description ? S_OK : S_FALSE;
-}
-
-HRESULT STDMETHODCALLTYPE QWindowsIA2Accessible::get_nColumns( long *columnCount)
-{
- QAccessibleInterface *accessible = accessibleInterface();
- accessibleDebugClientCalls(accessible);
- if (!accessible)
- return E_FAIL;
-
- if (QAccessibleTableInterface *tableIface = tableInterface()) {
- *columnCount = tableIface->columnCount();
- return S_OK;
- }
- return E_FAIL;
-}
-
-HRESULT STDMETHODCALLTYPE QWindowsIA2Accessible::get_nRows(long *rowCount)
-{
- QAccessibleInterface *accessible = accessibleInterface();
- accessibleDebugClientCalls(accessible);
- if (!accessible)
- return E_FAIL;
-
- if (QAccessibleTableInterface *tableIface = tableInterface()) {
- *rowCount = tableIface->rowCount();
- return S_OK;
- }
- return E_FAIL;
-}
-
-HRESULT STDMETHODCALLTYPE QWindowsIA2Accessible::get_nSelectedCells(long *cellCount)
-{
- QAccessibleInterface *accessible = accessibleInterface();
- accessibleDebugClientCalls(accessible);
- if (!accessible)
- return E_FAIL;
-
- if (QAccessibleTableInterface *tableIface = tableInterface()) {
- *cellCount = tableIface->selectedCellCount();
- return S_OK;
- }
- return E_FAIL;
-}
-
-HRESULT STDMETHODCALLTYPE QWindowsIA2Accessible::get_nSelectedColumns(long *columnCount)
-{
- QAccessibleInterface *accessible = accessibleInterface();
- accessibleDebugClientCalls(accessible);
- if (!accessible)
- return E_FAIL;
-
- if (QAccessibleTableInterface *tableIface = tableInterface()) {
- *columnCount = tableIface->selectedColumnCount();
- return S_OK;
- }
- return E_FAIL;
-}
-
-HRESULT STDMETHODCALLTYPE QWindowsIA2Accessible::get_nSelectedRows(long *rowCount)
-{
- QAccessibleInterface *accessible = accessibleInterface();
- accessibleDebugClientCalls(accessible);
- if (!accessible)
- return E_FAIL;
-
- if (QAccessibleTableInterface *tableIface = tableInterface()) {
- *rowCount = tableIface->selectedRowCount();
- return S_OK;
- }
- return E_FAIL;
-}
-
-HRESULT STDMETHODCALLTYPE QWindowsIA2Accessible::get_rowDescription(long row, BSTR *description)
-{
- QAccessibleInterface *accessible = accessibleInterface();
- accessibleDebugClientCalls(accessible);
- if (!accessible)
- return E_FAIL;
-
- *description = 0;
- if (QAccessibleTableInterface *tableIface = tableInterface()) {
- const QString qtDesc = tableIface->rowDescription(row);
- if (!qtDesc.isEmpty())
- *description = QStringToBSTR(qtDesc);
- }
- return *description ? S_OK : S_FALSE;
-}
-
-HRESULT STDMETHODCALLTYPE QWindowsIA2Accessible::get_selectedCells(IUnknown ***cells, long *nSelectedCells)
-{
- QAccessibleInterface *accessible = accessibleInterface();
- accessibleDebugClientCalls(accessible);
- Q_UNUSED(cells);
- Q_UNUSED(nSelectedCells);
- if (!accessible)
- return E_FAIL;
-
- QList<QAccessibleInterface*> selectedCells = tableInterface()->selectedCells();
- return wrapListOfCells(selectedCells, cells, nSelectedCells);
-}
-
-HRESULT STDMETHODCALLTYPE QWindowsIA2Accessible::get_selectedColumns(long **selectedColumns, long *nColumns)
-{
- QAccessibleInterface *accessible = accessibleInterface();
- accessibleDebugClientCalls(accessible);
- if (!accessible)
- return E_FAIL;
-
- if (QAccessibleTableInterface *tableIface = tableInterface()) {
- const QList<int> selectedIndices = tableIface->selectedColumns();
- const int count = selectedIndices.count();
- *nColumns = count;
- *selectedColumns = Q_NULLPTR;
- if (count) {
- *selectedColumns = coTaskMemAllocArray<long>(count);
- std::copy(selectedIndices.constBegin(), selectedIndices.constEnd(),
- QT_MAKE_CHECKED_ARRAY_ITERATOR(*selectedColumns, count));
- }
- return count ? S_OK : S_FALSE;
- }
- return E_FAIL;
-
-}
-
-HRESULT STDMETHODCALLTYPE QWindowsIA2Accessible::get_selectedRows(long **selectedRows, long *nRows)
-{
- QAccessibleInterface *accessible = accessibleInterface();
- accessibleDebugClientCalls(accessible);
- if (!accessible)
- return E_FAIL;
-
- if (QAccessibleTableInterface *tableIface = tableInterface()) {
- const QList<int> selectedIndices = tableIface->selectedRows();
- const int count = selectedIndices.count();
- *nRows = count;
- *selectedRows = Q_NULLPTR;
- if (count) {
- *selectedRows = coTaskMemAllocArray<long>(count);
- std::copy(selectedIndices.constBegin(), selectedIndices.constEnd(),
- QT_MAKE_CHECKED_ARRAY_ITERATOR(*selectedRows, count));
- }
- return count ? S_OK : S_FALSE;
- }
- return E_FAIL;
-
-}
-
-HRESULT STDMETHODCALLTYPE QWindowsIA2Accessible::get_summary(IUnknown **summaryInterface)
-{
- QAccessibleInterface *accessible = accessibleInterface();
- accessibleDebugClientCalls(accessible);
- if (!accessible)
- return E_FAIL;
-
- *summaryInterface = 0;
- if (QAccessibleTableInterface *tableIface = tableInterface()) {
- if (QAccessibleInterface *iface = tableIface->summary())
- *summaryInterface = QWindowsAccessibility::wrap(iface);
- }
- return *summaryInterface ? S_OK : S_FALSE;
-}
-
-HRESULT STDMETHODCALLTYPE QWindowsIA2Accessible::get_isColumnSelected(long column, boolean *isSelected)
-{
- QAccessibleInterface *accessible = accessibleInterface();
- accessibleDebugClientCalls(accessible);
- if (!accessible)
- return E_FAIL;
-
- if (QAccessibleTableInterface *tableIface = tableInterface()) {
- *isSelected = tableIface->isColumnSelected(column);
- return S_OK;
- }
- return E_FAIL;
-}
-
-HRESULT STDMETHODCALLTYPE QWindowsIA2Accessible::get_isRowSelected(long row, boolean *isSelected)
-{
- QAccessibleInterface *accessible = accessibleInterface();
- accessibleDebugClientCalls(accessible);
- if (!accessible)
- return E_FAIL;
-
- if (QAccessibleTableInterface *tableIface = tableInterface()) {
- *isSelected = tableIface->isRowSelected(row);
- return S_OK;
- }
- return E_FAIL;
-}
-
-HRESULT STDMETHODCALLTYPE QWindowsIA2Accessible::selectRow(long row)
-{
- QAccessibleInterface *accessible = accessibleInterface();
- accessibleDebugClientCalls(accessible);
- if (!accessible)
- return E_FAIL;
-
- if (QAccessibleTableInterface *tableIface = tableInterface()) {
- bool ok = tableIface->selectRow(row);
- return ok ? S_OK : E_INVALIDARG; //### Not sure of the return value if it fails???
- }
- return E_FAIL;
-}
-
-HRESULT STDMETHODCALLTYPE QWindowsIA2Accessible::selectColumn(long column)
-{
- QAccessibleInterface *accessible = accessibleInterface();
- accessibleDebugClientCalls(accessible);
- if (!accessible)
- return E_FAIL;
-
- if (QAccessibleTableInterface *tableIface = tableInterface()) {
- bool ok = tableIface->selectColumn(column);
- return ok ? S_OK : E_INVALIDARG; //### Not sure of the return value if it fails???
- }
- return E_FAIL;
-}
-
-HRESULT STDMETHODCALLTYPE QWindowsIA2Accessible::unselectRow(long row)
-{
- QAccessibleInterface *accessible = accessibleInterface();
- accessibleDebugClientCalls(accessible);
- if (!accessible)
- return E_FAIL;
-
- if (QAccessibleTableInterface *tableIface = tableInterface()) {
- bool ok = tableIface->unselectRow(row);
- return ok ? S_OK : E_INVALIDARG; //### Not sure of the return value if it fails???
- }
- return E_FAIL;
-}
-
-HRESULT STDMETHODCALLTYPE QWindowsIA2Accessible::unselectColumn(long column)
-{
- QAccessibleInterface *accessible = accessibleInterface();
- accessibleDebugClientCalls(accessible);
- if (!accessible)
- return E_FAIL;
-
- if (QAccessibleTableInterface *tableIface = tableInterface()) {
- bool ok = tableIface->unselectColumn(column);
- return ok ? S_OK : E_INVALIDARG; //### Not sure of the return value if it fails???
- }
- return E_FAIL;
-}
-
-HRESULT STDMETHODCALLTYPE QWindowsIA2Accessible::get_modelChange( IA2TableModelChange * /*modelChange*/)
-{
- QAccessibleInterface *accessible = accessibleInterface();
- accessibleDebugClientCalls(accessible);
- if (!accessible)
- return E_FAIL;
- return E_NOTIMPL;
-}
-
-/**************************************************************\
- * IAccessibleTableCell *
-\**************************************************************/
-HRESULT STDMETHODCALLTYPE QWindowsIA2Accessible::get_columnExtent(long *nColumnsSpanned)
-{
- QAccessibleInterface *accessible = accessibleInterface();
- accessibleDebugClientCalls(accessible);
- if (!accessible)
- return E_FAIL;
-
- *nColumnsSpanned = tableCellInterface()->columnExtent();
- return S_OK;
-}
-
-HRESULT STDMETHODCALLTYPE QWindowsIA2Accessible::get_columnHeaderCells(IUnknown ***cellAccessibles,
- long *nColumnHeaderCells)
-{
- QAccessibleInterface *accessible = accessibleInterface();
- accessibleDebugClientCalls(accessible);
- if (!accessible)
- return E_FAIL;
- const QList<QAccessibleInterface*> headerCells = tableCellInterface()->columnHeaderCells();
- return wrapListOfCells(headerCells, cellAccessibles, nColumnHeaderCells);
-}
-
-HRESULT STDMETHODCALLTYPE QWindowsIA2Accessible::get_columnIndex(long *columnIndex)
-{
- QAccessibleInterface *accessible = accessibleInterface();
- accessibleDebugClientCalls(accessible);
- if (!accessible)
- return E_FAIL;
- *columnIndex = tableCellInterface()->columnIndex();
- return S_OK;
-}
-
-HRESULT STDMETHODCALLTYPE QWindowsIA2Accessible::get_rowExtent(long *nRowsSpanned)
-{
- QAccessibleInterface *accessible = accessibleInterface();
- accessibleDebugClientCalls(accessible);
- if (!accessible)
- return E_FAIL;
- *nRowsSpanned = tableCellInterface()->rowExtent();
- return S_OK;
-}
-
-HRESULT STDMETHODCALLTYPE QWindowsIA2Accessible::get_rowHeaderCells(IUnknown ***cellAccessibles,
- long *nRowHeaderCells)
-{
- QAccessibleInterface *accessible = accessibleInterface();
- accessibleDebugClientCalls(accessible);
- if (!accessible)
- return E_FAIL;
- const QList<QAccessibleInterface*> headerCells = tableCellInterface()->rowHeaderCells();
- return wrapListOfCells(headerCells, cellAccessibles, nRowHeaderCells);
-}
-
-HRESULT STDMETHODCALLTYPE QWindowsIA2Accessible::get_rowIndex(long *rowIndex)
-{
- QAccessibleInterface *accessible = accessibleInterface();
- accessibleDebugClientCalls(accessible);
- if (!accessible)
- return E_FAIL;
- *rowIndex = tableCellInterface()->rowIndex();
- return S_OK;
-}
-
-HRESULT STDMETHODCALLTYPE QWindowsIA2Accessible::get_isSelected( boolean *isSelected)
-{
- QAccessibleInterface *accessible = accessibleInterface();
- accessibleDebugClientCalls(accessible);
- if (!accessible)
- return E_FAIL;
- *isSelected = tableCellInterface()->isSelected();
- return S_OK;
-}
-
-HRESULT STDMETHODCALLTYPE QWindowsIA2Accessible::get_rowColumnExtents(long *row, long *column,
- long *rowExtents, long *columnExtents,
- boolean *isSelected)
-{
- QAccessibleInterface *accessible = accessibleInterface();
- accessibleDebugClientCalls(accessible);
- if (!accessible || !tableCellInterface())
- return E_FAIL;
-
- *row = tableCellInterface()->rowIndex();
- *column = tableCellInterface()->columnIndex();
- *rowExtents = tableCellInterface()->rowExtent();
- *columnExtents = tableCellInterface()->columnExtent();
- *isSelected = tableCellInterface()->isSelected();
- return S_OK;
-}
-
-HRESULT STDMETHODCALLTYPE QWindowsIA2Accessible::get_table(IUnknown **table)
-{
- QAccessibleInterface *accessible = accessibleInterface();
- accessibleDebugClientCalls(accessible);
- if (!accessible)
- return E_FAIL;
-
- QAccessibleInterface *tableIface = tableCellInterface()->table();
-
- *table = QWindowsAccessibility::wrap(tableIface);
- return S_OK;
-}
-
-/**************************************************************\
- * IAccessibleText *
-\**************************************************************/
-HRESULT STDMETHODCALLTYPE QWindowsIA2Accessible::addSelection(long startOffset,
- long endOffset)
-{
- QAccessibleInterface *accessible = accessibleInterface();
- accessibleDebugClientCalls(accessible);
- if (QAccessibleTextInterface *text = textInterface()) {
- text->addSelection(startOffset, endOffset);
- return S_OK;
- }
- return E_FAIL;
-}
-
-HRESULT STDMETHODCALLTYPE QWindowsIA2Accessible::get_attributes(long offset,
- long *startOffset,
- long *endOffset,
- BSTR *textAttributes)
-{
- QAccessibleInterface *accessible = accessibleInterface();
- accessibleDebugClientCalls(accessible);
- if (QAccessibleTextInterface *text = textInterface()) {
- const QString attrs = text->attributes(offset, reinterpret_cast<int *>(startOffset),
- reinterpret_cast<int *>(endOffset));
- *textAttributes = QStringToBSTR(attrs);
- return S_OK;
- }
- return E_FAIL;
-}
-
-HRESULT STDMETHODCALLTYPE QWindowsIA2Accessible::get_caretOffset(long *offset)
-{
- QAccessibleInterface *accessible = accessibleInterface();
- accessibleDebugClientCalls(accessible);
- if (QAccessibleTextInterface *text = textInterface()) {
- *offset = text->cursorPosition();
- return S_OK;
- }
- return E_FAIL;
-}
-
-
-HRESULT STDMETHODCALLTYPE QWindowsIA2Accessible::get_characterExtents(long offset,
- enum IA2CoordinateType coordType,
- long *x,
- long *y,
- long *width,
- long *height)
-{
- QAccessibleInterface *accessible = accessibleInterface();
- accessibleDebugClientCalls(accessible);
- if (QAccessibleTextInterface *text = textInterface()) {
- QRect rect = text->characterRect(offset);
- mapFromScreenPos(coordType, rect.topLeft(), x, y);
- *width = rect.width();
- *height = rect.height();
- return S_OK;
- }
- return E_FAIL;
-}
-
-HRESULT STDMETHODCALLTYPE QWindowsIA2Accessible::get_nSelections(long *nSelections)
-{
- QAccessibleInterface *accessible = accessibleInterface();
- accessibleDebugClientCalls(accessible);
- if (QAccessibleTextInterface *text = textInterface()) {
- *nSelections = text->selectionCount();
- return S_OK;
- }
- return E_FAIL;
-}
-
-HRESULT STDMETHODCALLTYPE QWindowsIA2Accessible::get_offsetAtPoint(long x,
- long y,
- enum IA2CoordinateType coordType,
- long *offset)
-{
- QAccessibleInterface *accessible = accessibleInterface();
- accessibleDebugClientCalls(accessible);
- if (QAccessibleTextInterface *text = textInterface()) {
- QPoint screenPos = mapToScreenPos(coordType, x, y);
- *offset = text->offsetAtPoint(screenPos);
- return (*offset >=0 ? S_OK : S_FALSE);
- }
- return E_FAIL;
-
-}
-
-HRESULT STDMETHODCALLTYPE QWindowsIA2Accessible::get_selection(long selectionIndex,
- long *startOffset,
- long *endOffset)
-{
- QAccessibleInterface *accessible = accessibleInterface();
- accessibleDebugClientCalls(accessible);
- if (QAccessibleTextInterface *text = textInterface()) {
- text->selection(selectionIndex, reinterpret_cast<int *>(startOffset),
- reinterpret_cast<int *>(endOffset));
- return S_OK;
- }
- return E_FAIL;
-}
-
-HRESULT STDMETHODCALLTYPE QWindowsIA2Accessible::get_text(long startOffset,
- long endOffset,
- BSTR *text)
-{
- QAccessibleInterface *accessible = accessibleInterface();
- accessibleDebugClientCalls(accessible);
- if (QAccessibleTextInterface *textif = textInterface()) {
- const QString t = textif->text(startOffset, endOffset);
- if (!t.isEmpty()) {
- *text = QStringToBSTR(t);
- return S_OK;
- }
- return E_INVALIDARG;
- }
- return E_FAIL;
-}
-
-HRESULT STDMETHODCALLTYPE QWindowsIA2Accessible::get_textBeforeOffset(long offset,
- enum IA2TextBoundaryType boundaryType,
- long *startOffset,
- long *endOffset,
- BSTR *text)
-{
- QAccessibleInterface *accessible = accessibleInterface();
- accessibleDebugClientCalls(accessible);
- if (QAccessibleTextInterface *textIface = textInterface()) {
- const QString txt =
- textIface->textBeforeOffset(offset, static_cast<QAccessible::TextBoundaryType>(boundaryType),
- reinterpret_cast<int *>(startOffset),
- reinterpret_cast<int *>(endOffset));
- if (!txt.isEmpty()) {
- *text = QStringToBSTR(txt);
- return S_OK;
- }
- return S_FALSE;
- }
- return E_FAIL;
-}
-
-HRESULT STDMETHODCALLTYPE QWindowsIA2Accessible::get_textAfterOffset(
- long offset,
- enum IA2TextBoundaryType boundaryType,
- long *startOffset,
- long *endOffset,
- BSTR *text)
-{
- QAccessibleInterface *accessible = accessibleInterface();
- accessibleDebugClientCalls(accessible);
- if (QAccessibleTextInterface *textIface = textInterface()) {
- const QString txt =
- textIface->textAfterOffset(offset, static_cast<QAccessible::TextBoundaryType>(boundaryType),
- reinterpret_cast<int *>(startOffset),
- reinterpret_cast<int *>(endOffset));
- if (!txt.isEmpty()) {
- *text = QStringToBSTR(txt);
- return S_OK;
- }
- return S_FALSE;
- }
- return E_FAIL;
-}
-
-HRESULT STDMETHODCALLTYPE QWindowsIA2Accessible::get_textAtOffset(long offset,
- enum IA2TextBoundaryType boundaryType,
- long *startOffset,
- long *endOffset,
- BSTR *text)
-{
- QAccessibleInterface *accessible = accessibleInterface();
- accessibleDebugClientCalls(accessible);
- if (QAccessibleTextInterface *textIface = textInterface()) {
- const QString txt =
- textIface->textAtOffset(offset, static_cast<QAccessible::TextBoundaryType>(boundaryType),
- reinterpret_cast<int *>(startOffset),
- reinterpret_cast<int *>(endOffset));
- if (!txt.isEmpty()) {
- *text = QStringToBSTR(txt);
- return S_OK;
- }
- return S_FALSE;
- }
- return E_FAIL;
-}
-
-HRESULT STDMETHODCALLTYPE QWindowsIA2Accessible::removeSelection(long selectionIndex)
-{
- QAccessibleInterface *accessible = accessibleInterface();
- accessibleDebugClientCalls(accessible);
- if (QAccessibleTextInterface *textIface = textInterface()) {
- textIface->removeSelection(selectionIndex);
- return S_OK;
- }
- return E_FAIL;
-}
-
-HRESULT STDMETHODCALLTYPE QWindowsIA2Accessible::setCaretOffset(long offset)
-{
- QAccessibleInterface *accessible = accessibleInterface();
- accessibleDebugClientCalls(accessible);
- if (QAccessibleTextInterface *textIface = textInterface()) {
- textIface->setCursorPosition(offset);
- return S_OK;
- }
- return E_FAIL;
-}
-
-HRESULT STDMETHODCALLTYPE QWindowsIA2Accessible::setSelection(long selectionIndex,
- long startOffset,
- long endOffset)
-{
- QAccessibleInterface *accessible = accessibleInterface();
- accessibleDebugClientCalls(accessible);
- if (QAccessibleTextInterface *textIface = textInterface()) {
- textIface->setSelection(selectionIndex, startOffset, endOffset);
- return S_OK;
- }
- return E_FAIL;
-}
-
-HRESULT STDMETHODCALLTYPE QWindowsIA2Accessible::get_nCharacters(long *nCharacters)
-{
- QAccessibleInterface *accessible = accessibleInterface();
- accessibleDebugClientCalls(accessible);
- if (QAccessibleTextInterface *textIface = textInterface()) {
- *nCharacters = textIface->characterCount();
- return S_OK;
- }
- return E_FAIL;
-}
-
-HRESULT STDMETHODCALLTYPE QWindowsIA2Accessible::scrollSubstringTo(long startIndex,
- long endIndex,
- enum IA2ScrollType scrollType)
-{
- QAccessibleInterface *accessible = accessibleInterface();
- accessibleDebugClientCalls(accessible);
- if (QAccessibleTextInterface *textIface = textInterface()) {
- Q_UNUSED(scrollType); //###
- textIface->scrollToSubstring(startIndex, endIndex);
- return S_OK;
- }
- return E_FAIL;
-}
-
-HRESULT STDMETHODCALLTYPE QWindowsIA2Accessible::scrollSubstringToPoint(long startIndex,
- long endIndex,
- enum IA2CoordinateType coordinateType,
- long x,
- long y)
-{
- Q_UNUSED(startIndex);
- Q_UNUSED(endIndex);
- Q_UNUSED(coordinateType);
- Q_UNUSED(x);
- Q_UNUSED(y);
-
- return E_NOTIMPL;
-}
-
-HRESULT STDMETHODCALLTYPE QWindowsIA2Accessible::get_newText(IA2TextSegment *newText)
-{
- Q_UNUSED(newText);
- return E_NOTIMPL;
-}
-
-HRESULT STDMETHODCALLTYPE QWindowsIA2Accessible::get_oldText(IA2TextSegment *oldText)
-{
- Q_UNUSED(oldText);
- return E_NOTIMPL;
-}
-
-/**************************************************************\
- * IAccessibleValue *
- **************************************************************/
-HRESULT STDMETHODCALLTYPE QWindowsIA2Accessible::get_currentValue(VARIANT *currentValue)
-{
- QAccessibleInterface *accessible = accessibleInterface();
- accessibleDebugClientCalls(accessible);
- if (!accessible)
- return E_FAIL;
- if (QAccessibleValueInterface *valueIface = valueInterface()) {
- const QVariant var = valueIface->currentValue();
- if (QVariant2VARIANT(var, *currentValue, QByteArray(), false))
- return S_OK;
-
- }
- currentValue->vt = VT_EMPTY;
- return S_FALSE;
-}
-
-HRESULT STDMETHODCALLTYPE QWindowsIA2Accessible::setCurrentValue(VARIANT value)
-{
- QAccessibleInterface *accessible = accessibleInterface();
- accessibleDebugClientCalls(accessible);
- if (!accessible)
- return E_FAIL;
- HRESULT hr = S_FALSE;
- if (QAccessibleValueInterface *valueIface = valueInterface()) {
- hr = VariantChangeType(&value, &value, 0, VT_R8);
- if (SUCCEEDED(hr)) {
- // ### works only for numbers (not date, strings, etc)
- valueIface->setCurrentValue(QVariant(value.dblVal));
- }
- }
- return hr;
-}
-
-HRESULT STDMETHODCALLTYPE QWindowsIA2Accessible::get_maximumValue(VARIANT *maximumValue)
-{
- QAccessibleInterface *accessible = accessibleInterface();
- accessibleDebugClientCalls(accessible);
- if (!accessible)
- return E_FAIL;
- if (QAccessibleValueInterface *valueIface = valueInterface()) {
- const QVariant var = valueIface->maximumValue();
- if (QVariant2VARIANT(var, *maximumValue, QByteArray(), false))
- return S_OK;
- }
- maximumValue->vt = VT_EMPTY;
- return S_FALSE;
-}
-
-HRESULT STDMETHODCALLTYPE QWindowsIA2Accessible::get_minimumValue(VARIANT *minimumValue)
-{
- QAccessibleInterface *accessible = accessibleInterface();
- accessibleDebugClientCalls(accessible);
- if (!accessible)
- return E_FAIL;
- if (QAccessibleValueInterface *valueIface = valueInterface()) {
- const QVariant var = valueIface->minimumValue();
- if (QVariant2VARIANT(var, *minimumValue, QByteArray(), false))
- return S_OK;
- }
- minimumValue->vt = VT_EMPTY;
- return S_FALSE;
-}
-
-
-/**************************************************************\
- * IServiceProvider *
- **************************************************************/
-/*!
- \internal
- Reimplemented from IServiceProvider
-*/
-HRESULT STDMETHODCALLTYPE QWindowsIA2Accessible::QueryService(REFGUID guidService, REFIID riid, void **iface)
-{
- if (!iface)
- return E_POINTER;
- Q_UNUSED(guidService);
- *iface = 0;
- qCDebug(lcQpaAccessibility) << "QWindowsIA2Accessible::QS(): " << QWindowsAccessibleGuid(riid);
-
-
- if (guidService == IID_IAccessible) {
- if (riid == IID_IServiceProvider) {
- // do not end up calling QueryInterface for IID_IServiceProvider
- *iface = 0;
- } else if (riid == IID_IAccessible || riid == IID_IUnknown || riid == IID_IDispatch) {
- // The above conditions works with AccProbe and NVDA.
- *iface = static_cast<IAccessible*>(this);
- } else {
- // According to _dicoveringInterfaces Discovery of Interfaces, we should really only
- // enter here if riid == IID_IAccessible2, but some screen readers does not like that,
- // and other servers seems to have realized that. (Chrome and Mozilla for instance,
- // calls QueryInterface more or less in the same way)
-
- // For instance, accProbe discovers IID_IAccessibleTable2 by a QueryService only.
- return QueryInterface(riid, iface);
- }
- }
-
- if (riid == IID_IAccessibleApplication) {
- *iface = new AccessibleApplication;
- return S_OK;
- }
- if (*iface) {
- AddRef();
- return S_OK;
- }
-
- return E_NOINTERFACE;
-}
-
-
-/*!
- \internal
- private function..
- \a maxRelations max number of relations to return in \a relations
- \a relations the array of relations matching
- \a startIndex Index to start to return from,
- it will return only that specific relation in \a relations
-
- If \a relations is null, \a startIndex and \a maxRelations are ignored, causing
- it to return the number of relations in \a nRelations
-*/
-HRESULT QWindowsIA2Accessible::getRelationsHelper(IAccessibleRelation **relations, int startIndex, long maxRelations, long *nRelations /* = 0*/)
-{
- QAccessibleInterface *accessible = accessibleInterface();
- if (nRelations)
- *nRelations = 0;
- typedef QPair<QAccessibleInterface *, QAccessible::Relation> RelationEntry;
- QVector<RelationEntry> rels = accessible->relations();
- QMap<QAccessible::Relation, QAccessibleInterface *> relationMap;
- for (QVector<RelationEntry>::const_iterator it = rels.constBegin(); it != rels.constEnd(); ++it)
- {
- RelationEntry e = *it;
- relationMap.insertMulti(e.second, e.first);
- }
-
- QList<QAccessible::Relation> keys = relationMap.keys();
- const int numRelations = keys.count();
- if (relations) {
- for (int i = startIndex; i < qMin(startIndex + int(maxRelations), numRelations); ++i) {
- QAccessible::Relation relation = keys.at(i);
- QList<QAccessibleInterface*> targets = relationMap.values(relation);
- AccessibleRelation *rel = new AccessibleRelation(targets, relation);
- *relations = rel;
- ++relations;
- }
- }
- if (nRelations)
- *nRelations = numRelations;
-
- return numRelations > 0 ? S_OK : S_FALSE;
-}
-
-
-
-
-/*!
- \internal
- helper to wrap a QList<QAccessibleInterface*> inside an array of IAccessible*
- The IAccessible* array is returned as a IUnknown*
-*/
-HRESULT QWindowsIA2Accessible::wrapListOfCells(const QList<QAccessibleInterface*> &inputCells, IUnknown ***outputAccessibles, long *nCellCount)
-{
- const int count = inputCells.count();
- // Server allocates array
- *nCellCount = count;
- *outputAccessibles = Q_NULLPTR;
- if (count) {
- *outputAccessibles = coTaskMemAllocArray<IUnknown *>(count);
- std::transform(inputCells.constBegin(), inputCells.constEnd(),
- QT_MAKE_CHECKED_ARRAY_ITERATOR(*outputAccessibles, count),
- QWindowsAccessibility::wrap);
- }
- return count > 0 ? S_OK : S_FALSE;
-}
-
-// Q_STATIC_ASSERT(IA2_ROLE_CANVAS == QAccessible::Canvas); // ### Qt 6: make them the same
-Q_STATIC_ASSERT(IA2_ROLE_COLOR_CHOOSER == static_cast<IA2Role>(QAccessible::ColorChooser));
-Q_STATIC_ASSERT(IA2_ROLE_FOOTER == static_cast<IA2Role>(QAccessible::Footer));
-Q_STATIC_ASSERT(IA2_ROLE_FORM == static_cast<IA2Role>(QAccessible::Form));
-Q_STATIC_ASSERT(IA2_ROLE_HEADING == static_cast<IA2Role>(QAccessible::Heading));
-Q_STATIC_ASSERT(IA2_ROLE_NOTE == static_cast<IA2Role>(QAccessible::Note));
-Q_STATIC_ASSERT(IA2_ROLE_COMPLEMENTARY_CONTENT == static_cast<IA2Role>(QAccessible::ComplementaryContent));
-
-QT_END_NAMESPACE
-
-#endif //QT_NO_ACCESSIBILITY
diff --git a/src/plugins/platforms/windows/accessible/iaccessible2.h b/src/plugins/platforms/windows/accessible/iaccessible2.h
deleted file mode 100644
index d987016e15..0000000000
--- a/src/plugins/platforms/windows/accessible/iaccessible2.h
+++ /dev/null
@@ -1,358 +0,0 @@
-/****************************************************************************
-**
-** Copyright (C) 2016 The Qt Company Ltd.
-** Contact: https://www.qt.io/licensing/
-**
-** This file is part of the plugins of the Qt Toolkit.
-**
-** $QT_BEGIN_LICENSE:LGPL$
-** Commercial License Usage
-** Licensees holding valid commercial Qt licenses may use this file in
-** accordance with the commercial license agreement provided with the
-** Software or, alternatively, in accordance with the terms contained in
-** a written agreement between you and The Qt Company. For licensing terms
-** and conditions see https://www.qt.io/terms-conditions. For further
-** information use the contact form at https://www.qt.io/contact-us.
-**
-** GNU Lesser General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU Lesser
-** General Public License version 3 as published by the Free Software
-** Foundation and appearing in the file LICENSE.LGPL3 included in the
-** packaging of this file. Please review the following information to
-** ensure the GNU Lesser General Public License version 3 requirements
-** will be met: https://www.gnu.org/licenses/lgpl-3.0.html.
-**
-** GNU General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU
-** General Public License version 2.0 or (at your option) the GNU General
-** Public license version 3 or any later version approved by the KDE Free
-** Qt Foundation. The licenses are as published by the Free Software
-** Foundation and appearing in the file LICENSE.GPL2 and LICENSE.GPL3
-** included in the packaging of this file. Please review the following
-** information to ensure the GNU General Public License requirements will
-** be met: https://www.gnu.org/licenses/gpl-2.0.html and
-** https://www.gnu.org/licenses/gpl-3.0.html.
-**
-** $QT_END_LICENSE$
-**
-****************************************************************************/
-#ifndef IACCESSIBLE2_H
-#define IACCESSIBLE2_H
-
-#include <QtCore/qglobal.h>
-#ifndef QT_NO_ACCESSIBILITY
-
-#include "qwindowscombase.h"
-#include "qwindowsmsaaaccessible.h"
-#include "comutils.h"
-
-#include "ia2_api_all.h"
-
-#include <servprov.h>
-
-QT_BEGIN_NAMESPACE
-
-#ifdef Q_CC_MINGW
-QT_WARNING_DISABLE_GCC("-Wunused-function") // MinGW 7.X claims it is unused
-// MinGW's __uuidof operator does not work for the Accessible2 interfaces
-template <>
-IID qUuidOf<IAccessibleComponent>() { return IID_IAccessibleComponent; }
-#endif // Q_CC_MINGW
-
-class QWindowsIA2Accessible : public QWindowsMsaaAccessible,
- public IAccessibleAction,
- public IAccessibleComponent,
- public IAccessibleEditableText,
- public IAccessibleTable2,
- public IAccessibleTableCell,
- public IAccessibleText,
- public IAccessibleValue,
- public IServiceProvider
-{
-public:
- QWindowsIA2Accessible(QAccessibleInterface *a) : QWindowsMsaaAccessible(a) {}
-
- /* IUnknown */
- HRESULT STDMETHODCALLTYPE QueryInterface(REFIID, LPVOID *);
- ULONG STDMETHODCALLTYPE AddRef();
- ULONG STDMETHODCALLTYPE Release();
-
- /* IAccessible2 */
- HRESULT STDMETHODCALLTYPE get_nRelations(long *nRelations);
- HRESULT STDMETHODCALLTYPE get_relation(long relationIndex, IAccessibleRelation **relation);
- HRESULT STDMETHODCALLTYPE get_relations(long maxRelations, IAccessibleRelation **relations, long *nRelations);
- HRESULT STDMETHODCALLTYPE role(long *role);
- HRESULT STDMETHODCALLTYPE scrollTo(enum IA2ScrollType scrollType);
- HRESULT STDMETHODCALLTYPE scrollToPoint(enum IA2CoordinateType coordinateType, long x, long y);
- HRESULT STDMETHODCALLTYPE get_groupPosition(long *groupLevel, long *similarItemsInGroup, long *positionInGroup);
- HRESULT STDMETHODCALLTYPE get_states(AccessibleStates *states);
- HRESULT STDMETHODCALLTYPE get_extendedRole(BSTR *extendedRole);
- HRESULT STDMETHODCALLTYPE get_localizedExtendedRole(BSTR *localizedExtendedRole);
- HRESULT STDMETHODCALLTYPE get_nExtendedStates(long *nExtendedStates);
- HRESULT STDMETHODCALLTYPE get_extendedStates(long maxExtendedStates, BSTR **extendedStates, long *nExtendedStates);
- HRESULT STDMETHODCALLTYPE get_localizedExtendedStates(long maxLocalizedExtendedStates, BSTR **localizedExtendedStates, long *nLocalizedExtendedStates);
- HRESULT STDMETHODCALLTYPE get_uniqueID(long *uniqueID);
- HRESULT STDMETHODCALLTYPE get_windowHandle(HWND *windowHandle);
- HRESULT STDMETHODCALLTYPE get_indexInParent(long *indexInParent);
- HRESULT STDMETHODCALLTYPE get_locale(IA2Locale *locale);
- HRESULT STDMETHODCALLTYPE get_attributes(BSTR *attributes);
-
- /* IAccessibleAction */
- HRESULT STDMETHODCALLTYPE nActions(long *nActions);
- HRESULT STDMETHODCALLTYPE doAction(long actionIndex);
- HRESULT STDMETHODCALLTYPE get_description(long actionIndex, BSTR *description);
- HRESULT STDMETHODCALLTYPE get_keyBinding(long actionIndex, long nMaxBindings, BSTR **keyBindings, long *nBindings);
- HRESULT STDMETHODCALLTYPE get_name(long actionIndex, BSTR *name);
- HRESULT STDMETHODCALLTYPE get_localizedName(long actionIndex, BSTR *localizedName);
-
- /* IAccessibleComponent */
- HRESULT STDMETHODCALLTYPE get_locationInParent(long *x,long *y);
- HRESULT STDMETHODCALLTYPE get_foreground(IA2Color *foreground);
- HRESULT STDMETHODCALLTYPE get_background(IA2Color *background);
-
- /* IAccessibleEditableText */
- HRESULT STDMETHODCALLTYPE copyText(long startOffset, long endOffset);
- HRESULT STDMETHODCALLTYPE deleteText(long startOffset, long endOffset);
- HRESULT STDMETHODCALLTYPE insertText(long offset, BSTR *text);
- HRESULT STDMETHODCALLTYPE cutText(long startOffset, long endOffset);
- HRESULT STDMETHODCALLTYPE pasteText(long offset);
- HRESULT STDMETHODCALLTYPE replaceText(long startOffset, long endOffset, BSTR *text);
- HRESULT STDMETHODCALLTYPE setAttributes(long startOffset, long endOffset, BSTR *attributes);
-
- /* IAccessibleTable2 */
- HRESULT STDMETHODCALLTYPE get_cellAt( long row, long column, IUnknown **cell);
- HRESULT STDMETHODCALLTYPE get_caption( IUnknown **accessibleInterface);
- HRESULT STDMETHODCALLTYPE get_columnDescription( long column, BSTR *description);
- HRESULT STDMETHODCALLTYPE get_nColumns( long *columnCount);
- HRESULT STDMETHODCALLTYPE get_nRows( long *rowCount);
- HRESULT STDMETHODCALLTYPE get_nSelectedCells( long *cellCount);
- HRESULT STDMETHODCALLTYPE get_nSelectedColumns( long *columnCount);
- HRESULT STDMETHODCALLTYPE get_nSelectedRows( long *rowCount);
- HRESULT STDMETHODCALLTYPE get_rowDescription( long row, BSTR *description);
- HRESULT STDMETHODCALLTYPE get_selectedCells( IUnknown ***cells, long *nSelectedCells);
- HRESULT STDMETHODCALLTYPE get_selectedColumns( long **selectedColumns, long *nColumns);
- HRESULT STDMETHODCALLTYPE get_selectedRows( long **selectedRows, long *nRows);
- HRESULT STDMETHODCALLTYPE get_summary( IUnknown **accessibleInterface);
- HRESULT STDMETHODCALLTYPE get_isColumnSelected( long column, boolean *isSelected);
- HRESULT STDMETHODCALLTYPE get_isRowSelected( long row, boolean *isSelected);
- HRESULT STDMETHODCALLTYPE selectRow( long row);
- HRESULT STDMETHODCALLTYPE selectColumn( long column);
- HRESULT STDMETHODCALLTYPE unselectRow( long row);
- HRESULT STDMETHODCALLTYPE unselectColumn( long column);
- HRESULT STDMETHODCALLTYPE get_modelChange( IA2TableModelChange *modelChange);
-
- /* IAccessibleTableCell */
- HRESULT STDMETHODCALLTYPE get_columnExtent(long *nColumnsSpanned);
- HRESULT STDMETHODCALLTYPE get_columnHeaderCells(IUnknown ***cellAccessibles, long *nColumnHeaderCells);
- HRESULT STDMETHODCALLTYPE get_columnIndex(long *columnIndex);
- HRESULT STDMETHODCALLTYPE get_rowExtent(long *nRowsSpanned);
- HRESULT STDMETHODCALLTYPE get_rowHeaderCells(IUnknown ***cellAccessibles, long *nRowHeaderCells);
- HRESULT STDMETHODCALLTYPE get_rowIndex(long *rowIndex);
- HRESULT STDMETHODCALLTYPE get_isSelected( boolean *isSelected);
- HRESULT STDMETHODCALLTYPE get_rowColumnExtents(long *row, long *column,
- long *rowExtents, long *columnExtents,
- boolean *isSelected);
- HRESULT STDMETHODCALLTYPE get_table(IUnknown **table);
-
-
- /* IAccessibleText */
- HRESULT STDMETHODCALLTYPE addSelection(long startOffset, long endOffset);
- HRESULT STDMETHODCALLTYPE get_attributes(long offset, long *startOffset,
- long *endOffset, BSTR *textAttributes);
- HRESULT STDMETHODCALLTYPE get_caretOffset(long *offset);
- HRESULT STDMETHODCALLTYPE get_characterExtents(long offset, enum IA2CoordinateType coordType,
- long *x, long *y,
- long *width, long *height);
- HRESULT STDMETHODCALLTYPE get_nSelections(long *nSelections);
- HRESULT STDMETHODCALLTYPE get_offsetAtPoint(long x, long y, enum IA2CoordinateType coordType, long *offset);
- HRESULT STDMETHODCALLTYPE get_selection(long selectionIndex, long *startOffset, long *endOffset);
- HRESULT STDMETHODCALLTYPE get_text(long startOffset, long endOffset, BSTR *text);
- HRESULT STDMETHODCALLTYPE get_textBeforeOffset(long offset, enum IA2TextBoundaryType boundaryType,
- long *startOffset, long *endOffset, BSTR *text);
- HRESULT STDMETHODCALLTYPE get_textAfterOffset(long offset, enum IA2TextBoundaryType boundaryType,
- long *startOffset, long *endOffset, BSTR *text);
- HRESULT STDMETHODCALLTYPE get_textAtOffset(long offset, enum IA2TextBoundaryType boundaryType,
- long *startOffset, long *endOffset, BSTR *text);
- HRESULT STDMETHODCALLTYPE removeSelection(long selectionIndex);
- HRESULT STDMETHODCALLTYPE setCaretOffset(long offset);
- HRESULT STDMETHODCALLTYPE setSelection(long selectionIndex, long startOffset, long endOffset);
- HRESULT STDMETHODCALLTYPE get_nCharacters(long *nCharacters);
- HRESULT STDMETHODCALLTYPE scrollSubstringTo(long startIndex, long endIndex, enum IA2ScrollType scrollType);
- HRESULT STDMETHODCALLTYPE scrollSubstringToPoint(long startIndex, long endIndex,
- enum IA2CoordinateType coordinateType, long x, long y);
- HRESULT STDMETHODCALLTYPE get_newText(IA2TextSegment *newText);
- HRESULT STDMETHODCALLTYPE get_oldText(IA2TextSegment *oldText);
-
- /* IAccessibleValue */
- HRESULT STDMETHODCALLTYPE get_currentValue(VARIANT *currentValue);
- HRESULT STDMETHODCALLTYPE setCurrentValue(VARIANT value);
- HRESULT STDMETHODCALLTYPE get_maximumValue(VARIANT *maximumValue);
- HRESULT STDMETHODCALLTYPE get_minimumValue(VARIANT *minimumValue);
-
- /* IServiceProvider */
- HRESULT STDMETHODCALLTYPE QueryService(REFGUID guidService, REFIID riid, void **ppv);
-
- /* private helper functions */
-private:
- inline QAccessibleTextInterface *textInterface() const {
- QAccessibleInterface *accessible = accessibleInterface();
- return accessible ? accessible->textInterface() : static_cast<QAccessibleTextInterface *>(0);
- }
-
- inline QAccessibleActionInterface *actionInterface() const {
- QAccessibleInterface *accessible = accessibleInterface();
- return accessible->actionInterface();
- }
-
- inline QAccessibleValueInterface *valueInterface() const {
- QAccessibleInterface *accessible = accessibleInterface();
- return accessible->valueInterface();
- }
-
- inline QAccessibleTableInterface *tableInterface() const {
- QAccessibleInterface *accessible = accessibleInterface();
- return accessible->tableInterface();
- }
-
- inline QAccessibleTableCellInterface *tableCellInterface() const {
- QAccessibleInterface *accessible = accessibleInterface();
- return accessible->tableCellInterface();
- }
-
- /*!
- \internal
- \a screenPos is in screen relative position
- \a x and \y (out) is in parent relative position if coordType == IA2_COORDTYPE_PARENT_RELATIVE
- */
- void mapFromScreenPos(enum IA2CoordinateType coordType, const QPoint &screenPos, long *x, long *y) const {
- QAccessibleInterface *accessible = accessibleInterface();
- if (coordType == IA2_COORDTYPE_PARENT_RELATIVE) {
- // caller wants relative to parent
- if (QAccessibleInterface *parent = accessible->parent()) {
- const QRect parentScreenRect = parent->rect();
- *x = parentScreenRect.x() - screenPos.x();
- *y = parentScreenRect.y() - screenPos.y();
- return;
- }
- }
- *x = screenPos.x();
- *y = screenPos.y();
- }
-
- /*!
- \internal
- \a x and \y is in parent relative position if coordType == IA2_COORDTYPE_PARENT_RELATIVE
- \return a screen relative position
- */
- QPoint mapToScreenPos(enum IA2CoordinateType coordType, long x, long y) const {
- QAccessibleInterface *accessible = accessibleInterface();
- if (coordType == IA2_COORDTYPE_PARENT_RELATIVE) {
- if (QAccessibleInterface *parent = accessible->parent()) {
- const QRect parentScreenRect = parent->rect();
- return QPoint(parentScreenRect.x() + x, parentScreenRect.y() + y);
- }
- }
- return QPoint(x,y);
- }
-
- HRESULT getRelationsHelper(IAccessibleRelation **relations, int startIndex, long maxRelations, long *nRelations = 0);
- HRESULT wrapListOfCells(const QList<QAccessibleInterface*> &inputCells, IUnknown ***outputAccessibles, long *nCellCount);
- QString textForRange(int startOffset, int endOffset) const;
- void replaceTextFallback(long startOffset, long endOffset, const QString &txt);
-
-};
-
-/**************************************************************\
- * AccessibleApplication *
- **************************************************************/
-
-#ifdef Q_CC_MINGW
-// MinGW's __uuidof operator does not work for the IAccessible2 interfaces
-template <>
-IID qUuidOf<IAccessibleApplication>() { return IID_IAccessibleApplication; }
-
-template <>
-IID qUuidOf<IAccessible2>() { return IID_IAccessible2; }
-
-template <>
-IID qUuidOf<IAccessibleRelation>() { return IID_IAccessibleRelation; }
-#endif // Q_CC_MINGW
-
-class AccessibleApplication : public QWindowsComBase<IAccessibleApplication>
-{
-public:
- AccessibleApplication() {}
-
- virtual ~AccessibleApplication() {}
-
- /* IAccessibleApplication */
- HRESULT STDMETHODCALLTYPE get_appName(/* [retval][out] */ BSTR *name);
- HRESULT STDMETHODCALLTYPE get_appVersion(/* [retval][out] */ BSTR *version);
- HRESULT STDMETHODCALLTYPE get_toolkitName(/* [retval][out] */ BSTR *name);
- HRESULT STDMETHODCALLTYPE get_toolkitVersion(/* [retval][out] */ BSTR *version);
-};
-
-
-
-/**************************************************************\
- * AccessibleRelation *
- **************************************************************/
-
-
-
-class AccessibleRelation : public QWindowsComBase<IAccessibleRelation>
-{
-public:
- AccessibleRelation(const QList<QAccessibleInterface *> &targets,
- QAccessible::Relation relation);
-
- virtual ~AccessibleRelation() {}
-
- /* IAccessibleRelation */
- HRESULT STDMETHODCALLTYPE get_relationType(BSTR *relationType);
- HRESULT STDMETHODCALLTYPE get_localizedRelationType(BSTR *localizedRelationType);
- HRESULT STDMETHODCALLTYPE get_nTargets(long *nTargets);
- HRESULT STDMETHODCALLTYPE get_target(long targetIndex, IUnknown **target);
- HRESULT STDMETHODCALLTYPE get_targets(long maxTargets, IUnknown **targets, long *nTargets);
-
-private:
- static BSTR relationToBSTR(QAccessible::Relation relation)
- {
- const wchar_t *constRelationString = 0;
- switch (relation) {
- case QAccessible::Label:
- constRelationString = IA2_RELATION_LABEL_FOR;
- break;
- case QAccessible::Labelled:
- constRelationString = IA2_RELATION_LABELLED_BY;
- break;
- case QAccessible::Controller:
- constRelationString = IA2_RELATION_CONTROLLER_FOR;
- break;
- case QAccessible::Controlled:
- constRelationString = IA2_RELATION_CONTROLLED_BY;
- break;
- case QAccessible::AllRelations:
- constRelationString = ( L"AllRelations" );
- break;
- }
-
- if (constRelationString) {
- BSTR bstrVal;
- const UINT wlen = (UINT)wcslen(constRelationString);
- bstrVal = ::SysAllocStringLen(constRelationString, wlen);
- return bstrVal;
- }
- return 0;
- }
-
-
- QList<QAccessibleInterface *> m_targets;
- QAccessible::Relation m_relation;
-};
-
-QT_END_NAMESPACE
-
-#endif //QT_NO_ACCESSIBILITY
-
-#endif // IACCESSIBLE2_H
diff --git a/src/plugins/platforms/windows/accessible/qwindowsaccessibility.cpp b/src/plugins/platforms/windows/accessible/qwindowsaccessibility.cpp
deleted file mode 100644
index d48cb9674f..0000000000
--- a/src/plugins/platforms/windows/accessible/qwindowsaccessibility.cpp
+++ /dev/null
@@ -1,245 +0,0 @@
-/****************************************************************************
-**
-** Copyright (C) 2016 The Qt Company Ltd.
-** Contact: https://www.qt.io/licensing/
-**
-** This file is part of the plugins of the Qt Toolkit.
-**
-** $QT_BEGIN_LICENSE:LGPL$
-** Commercial License Usage
-** Licensees holding valid commercial Qt licenses may use this file in
-** accordance with the commercial license agreement provided with the
-** Software or, alternatively, in accordance with the terms contained in
-** a written agreement between you and The Qt Company. For licensing terms
-** and conditions see https://www.qt.io/terms-conditions. For further
-** information use the contact form at https://www.qt.io/contact-us.
-**
-** GNU Lesser General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU Lesser
-** General Public License version 3 as published by the Free Software
-** Foundation and appearing in the file LICENSE.LGPL3 included in the
-** packaging of this file. Please review the following information to
-** ensure the GNU Lesser General Public License version 3 requirements
-** will be met: https://www.gnu.org/licenses/lgpl-3.0.html.
-**
-** GNU General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU
-** General Public License version 2.0 or (at your option) the GNU General
-** Public license version 3 or any later version approved by the KDE Free
-** Qt Foundation. The licenses are as published by the Free Software
-** Foundation and appearing in the file LICENSE.GPL2 and LICENSE.GPL3
-** included in the packaging of this file. Please review the following
-** information to ensure the GNU General Public License requirements will
-** be met: https://www.gnu.org/licenses/gpl-2.0.html and
-** https://www.gnu.org/licenses/gpl-3.0.html.
-**
-** $QT_END_LICENSE$
-**
-****************************************************************************/
-
-#include <QtCore/qglobal.h>
-#ifndef QT_NO_ACCESSIBILITY
-
-
-#include <private/qsystemlibrary_p.h>
-
-#include <QtCore/qlocale.h>
-#include <QtCore/qmap.h>
-#include <QtCore/qpair.h>
-#include <QtCore/qpointer.h>
-#include <QtGui/qaccessible.h>
-#include <QtGui/private/qguiapplication_p.h>
-#include <qpa/qplatformnativeinterface.h>
-#include <qpa/qplatformintegration.h>
-#include <QtGui/qwindow.h>
-#include <QtGui/qguiapplication.h>
-#include <QtFontDatabaseSupport/private/qwindowsfontdatabase_p.h> // registry helper
-
-#include "qwindowsaccessibility.h"
-#include "iaccessible2.h"
-#include "comutils.h"
-
-#include <oleacc.h>
-
-//#include <uiautomationcoreapi.h>
-#ifndef UiaRootObjectId
-#define UiaRootObjectId -25
-#endif
-
-#include <winuser.h>
-#if !defined(WINABLEAPI)
-# include <winable.h>
-#endif
-
-#include <servprov.h>
-#if !defined(Q_CC_BOR) && !defined (Q_CC_GNU)
-#include <comdef.h>
-#endif
-
-#include <QtCore/qt_windows.h>
-
-QT_BEGIN_NAMESPACE
-
-/*!
- \!internal
- \class QWindowsAccessibility
-
- Implements QPlatformAccessibility
-
-*/
-QWindowsAccessibility::QWindowsAccessibility()
-{
-}
-
-// Retrieve sound name by checking the icon property of a message box
-static inline QString messageBoxAlertSound(const QObject *messageBox)
-{
- enum MessageBoxIcon { // Keep in sync with QMessageBox::Icon
- Information = 1,
- Warning = 2,
- Critical = 3
- };
- switch (messageBox->property("icon").toInt()) {
- case Information:
- return QStringLiteral("SystemAsterisk");
- case Warning:
- return QStringLiteral("SystemExclamation");
- case Critical:
- return QStringLiteral("SystemHand");
- }
- return QString();
-}
-
-static QString soundFileName(const QString &soundName)
-{
- const QString key = QStringLiteral("AppEvents\\Schemes\\Apps\\.Default\\")
- + soundName + QStringLiteral("\\.Current");
- return QWindowsFontDatabase::readRegistryString(HKEY_CURRENT_USER,
- reinterpret_cast<const wchar_t *>(key.utf16()), L"");
-}
-
-void QWindowsAccessibility::notifyAccessibilityUpdate(QAccessibleEvent *event)
-{
- QString soundName;
- switch (event->type()) {
- case QAccessible::PopupMenuStart:
- soundName = QLatin1String("MenuPopup");
- break;
-
- case QAccessible::MenuCommand:
- soundName = QLatin1String("MenuCommand");
- break;
-
- case QAccessible::Alert:
- soundName = event->object()->inherits("QMessageBox") ?
- messageBoxAlertSound(event->object()) : QStringLiteral("SystemAsterisk");
- break;
- default:
- break;
- }
-
- if (!soundName.isEmpty() && !soundFileName(soundName).isEmpty()) {
- PlaySound(reinterpret_cast<const wchar_t *>(soundName.utf16()), 0,
- SND_ALIAS | SND_ASYNC | SND_NODEFAULT | SND_NOWAIT);
- }
-
- // An event has to be associated with a window,
- // so find the first parent that is a widget and that has a WId
- QAccessibleInterface *iface = event->accessibleInterface();
- if (!isActive() || !iface || !iface->isValid())
- return;
- QWindow *window = QWindowsAccessibility::windowHelper(iface);
-
- if (!window) {
- window = QGuiApplication::focusWindow();
- if (!window)
- return;
- }
-
- QPlatformNativeInterface *platform = QGuiApplication::platformNativeInterface();
- if (!window->handle()) // Called before show(), no native window yet.
- return;
- const HWND hWnd = reinterpret_cast<HWND>(platform->nativeResourceForWindow("handle", window));
-
- if (event->type() != QAccessible::MenuCommand && // MenuCommand is faked
- event->type() != QAccessible::ObjectDestroyed) {
- ::NotifyWinEvent(event->type(), hWnd, OBJID_CLIENT, QAccessible::uniqueId(iface));
- }
-}
-
-QWindow *QWindowsAccessibility::windowHelper(const QAccessibleInterface *iface)
-{
- QWindow *window = iface->window();
- if (!window) {
- QAccessibleInterface *acc = iface->parent();
- while (acc && acc->isValid() && !window) {
- window = acc->window();
- QAccessibleInterface *par = acc->parent();
- acc = par;
- }
- }
- return window;
-}
-
-/*!
- \internal
- helper to wrap a QAccessibleInterface inside a IAccessible*
-*/
-IAccessible *QWindowsAccessibility::wrap(QAccessibleInterface *acc)
-{
- if (!acc)
- return 0;
-
- // ### FIXME: maybe we should accept double insertions into the cache
- if (!QAccessible::uniqueId(acc))
- QAccessible::registerAccessibleInterface(acc);
-
- QWindowsIA2Accessible *wacc = new QWindowsIA2Accessible(acc);
- IAccessible *iacc = 0;
- wacc->QueryInterface(IID_IAccessible, reinterpret_cast<void **>(&iacc));
- return iacc;
-}
-
-bool QWindowsAccessibility::handleAccessibleObjectFromWindowRequest(HWND hwnd, WPARAM wParam, LPARAM lParam, LRESULT *lResult)
-{
- if (static_cast<long>(lParam) == static_cast<long>(UiaRootObjectId)) {
- /* For UI Automation */
- } else if (DWORD(lParam) == DWORD(OBJID_CLIENT)) {
- // Start handling accessibility internally
- QGuiApplicationPrivate::platformIntegration()->accessibility()->setActive(true);
- // Ignoring all requests while starting up
- // ### Maybe QPA takes care of this???
- if (QCoreApplication::startingUp() || QCoreApplication::closingDown())
- return false;
-
- typedef LRESULT (WINAPI *PtrLresultFromObject)(REFIID, WPARAM, LPUNKNOWN);
- static PtrLresultFromObject ptrLresultFromObject = 0;
- static bool oleaccChecked = false;
-
- if (!oleaccChecked) {
- oleaccChecked = true;
- ptrLresultFromObject = reinterpret_cast<PtrLresultFromObject>(QSystemLibrary::resolve(QLatin1String("oleacc"), "LresultFromObject"));
- }
-
- if (ptrLresultFromObject) {
- QWindow *window = QWindowsContext::instance()->findWindow(hwnd);
- if (window) {
- QAccessibleInterface *acc = window->accessibleRoot();
- if (acc) {
- if (IAccessible *iface = wrap(acc)) {
- *lResult = ptrLresultFromObject(IID_IAccessible, wParam, iface); // ref == 2
- if (*lResult) {
- iface->Release(); // the client will release the object again, and then it will destroy itself
- }
- return true;
- }
- }
- }
- }
- }
- return false;
-}
-
-QT_END_NAMESPACE
-
-#endif //QT_NO_ACCESSIBILITY
diff --git a/src/plugins/platforms/windows/accessible/qwindowsmsaaaccessible.cpp b/src/plugins/platforms/windows/accessible/qwindowsmsaaaccessible.cpp
deleted file mode 100644
index fe2b9335cb..0000000000
--- a/src/plugins/platforms/windows/accessible/qwindowsmsaaaccessible.cpp
+++ /dev/null
@@ -1,1223 +0,0 @@
-/****************************************************************************
-**
-** Copyright (C) 2016 The Qt Company Ltd.
-** Contact: https://www.qt.io/licensing/
-**
-** This file is part of the plugins of the Qt Toolkit.
-**
-** $QT_BEGIN_LICENSE:LGPL$
-** Commercial License Usage
-** Licensees holding valid commercial Qt licenses may use this file in
-** accordance with the commercial license agreement provided with the
-** Software or, alternatively, in accordance with the terms contained in
-** a written agreement between you and The Qt Company. For licensing terms
-** and conditions see https://www.qt.io/terms-conditions. For further
-** information use the contact form at https://www.qt.io/contact-us.
-**
-** GNU Lesser General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU Lesser
-** General Public License version 3 as published by the Free Software
-** Foundation and appearing in the file LICENSE.LGPL3 included in the
-** packaging of this file. Please review the following information to
-** ensure the GNU Lesser General Public License version 3 requirements
-** will be met: https://www.gnu.org/licenses/lgpl-3.0.html.
-**
-** GNU General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU
-** General Public License version 2.0 or (at your option) the GNU General
-** Public license version 3 or any later version approved by the KDE Free
-** Qt Foundation. The licenses are as published by the Free Software
-** Foundation and appearing in the file LICENSE.GPL2 and LICENSE.GPL3
-** included in the packaging of this file. Please review the following
-** information to ensure the GNU General Public License requirements will
-** be met: https://www.gnu.org/licenses/gpl-2.0.html and
-** https://www.gnu.org/licenses/gpl-3.0.html.
-**
-** $QT_END_LICENSE$
-**
-****************************************************************************/
-
-#include <QtCore/qglobal.h>
-#ifndef QT_NO_ACCESSIBILITY
-
-#include "qwindowsmsaaaccessible.h"
-#include "qwindowsaccessibility.h"
-#include "qwindowscombase.h"
-#include <oleacc.h>
-#include <servprov.h>
-#include <winuser.h>
-#include "comutils.h"
-
-#include <QtCore/qdebug.h>
-#include <QtCore/qmap.h>
-#include <QtCore/qpair.h>
-#include <QtGui/qaccessible.h>
-#include <QtGui/qguiapplication.h>
-#include <qpa/qplatformnativeinterface.h>
-#include <QtGui/qwindow.h>
-#include <QtGui/private/qhighdpiscaling_p.h>
-
-//#include <uiautomationcoreapi.h>
-#ifndef UiaRootObjectId
-#define UiaRootObjectId -25
-#endif
-
-#if !defined(Q_CC_BOR) && !defined (Q_CC_GNU)
-#include <comdef.h>
-#endif
-
-
-#include <QtCore/qt_windows.h>
-
-
-QT_BEGIN_NAMESPACE
-
-class QWindowsEnumerate : public QWindowsComBase<IEnumVARIANT>
-{
-public:
- QWindowsEnumerate(const QVector<int> &a) : QWindowsComBase<IEnumVARIANT>(0), current(0),array(a) {}
- virtual ~QWindowsEnumerate() {}
-
- HRESULT STDMETHODCALLTYPE Clone(IEnumVARIANT **ppEnum);
- HRESULT STDMETHODCALLTYPE Next(unsigned long celt, VARIANT FAR* rgVar, unsigned long FAR* pCeltFetched);
- HRESULT STDMETHODCALLTYPE Reset();
- HRESULT STDMETHODCALLTYPE Skip(unsigned long celt);
-
-private:
- ULONG current;
- QVector<int> array;
-};
-
-HRESULT STDMETHODCALLTYPE QWindowsEnumerate::Clone(IEnumVARIANT **ppEnum)
-{
- QWindowsEnumerate *penum = 0;
- *ppEnum = 0;
-
- penum = new QWindowsEnumerate(array);
- if (!penum)
- return E_OUTOFMEMORY;
- penum->current = current;
- penum->array = array;
- penum->AddRef();
- *ppEnum = penum;
-
- return S_OK;
-}
-
-HRESULT STDMETHODCALLTYPE QWindowsEnumerate::Next(unsigned long celt, VARIANT FAR* rgVar, unsigned long FAR* pCeltFetched)
-{
- if (pCeltFetched)
- *pCeltFetched = 0;
-
- ULONG l;
- for (l = 0; l < celt; l++) {
- VariantInit(&rgVar[l]);
- if (current + 1 > ULONG(array.size())) {
- *pCeltFetched = l;
- return S_FALSE;
- }
-
- rgVar[l].vt = VT_I4;
- rgVar[l].lVal = array[int(current)];
- ++current;
- }
- *pCeltFetched = l;
- return S_OK;
-}
-
-HRESULT STDMETHODCALLTYPE QWindowsEnumerate::Reset()
-{
- current = 0;
- return S_OK;
-}
-
-HRESULT STDMETHODCALLTYPE QWindowsEnumerate::Skip(unsigned long celt)
-{
- current += celt;
- if (current > ULONG(array.size())) {
- current = ULONG(array.size());
- return S_FALSE;
- }
- return S_OK;
-}
-
-#if defined(DEBUG_SHOW_ATCLIENT_COMMANDS)
-void accessibleDebugClientCalls_helper(const char* funcName, const QAccessibleInterface *iface)
-{
- qCDebug(lcQpaAccessibility) << iface << funcName;
-}
-#endif
-
-/**************************************************************\
- * *
- * IUnknown *
- * *
- **************************************************************/
-HRESULT STDMETHODCALLTYPE QWindowsMsaaAccessible::QueryInterface(REFIID id, LPVOID *iface)
-{
- *iface = nullptr;
- const bool result = qWindowsComQueryUnknownInterfaceMulti<IAccessible2>(this, id, iface)
- || qWindowsComQueryInterface<IDispatch>(this, id, iface)
- || qWindowsComQueryInterface<IAccessible>(this, id, iface)
- || qWindowsComQueryInterface<IOleWindow>(this, id, iface);
-
- if (result) {
- qCDebug(lcQpaAccessibility) << "QWindowsIA2Accessible::QI() - "
- << QWindowsAccessibleGuid(id) << ", iface:" << accessibleInterface();
- }
- return result ? S_OK : E_NOINTERFACE;
-}
-
-ULONG STDMETHODCALLTYPE QWindowsMsaaAccessible::AddRef()
-{
- return ++ref;
-}
-
-ULONG STDMETHODCALLTYPE QWindowsMsaaAccessible::Release()
-{
- if (!--ref) {
- delete this;
- return 0;
- }
- return ref;
-}
-
-
-/*
- IDispatch
-*/
-
-HRESULT STDMETHODCALLTYPE QWindowsMsaaAccessible::GetTypeInfoCount(unsigned int * pctinfo)
-{
- // We don't use a type library
- *pctinfo = 0;
- return S_OK;
-}
-
-HRESULT STDMETHODCALLTYPE QWindowsMsaaAccessible::GetTypeInfo(unsigned int, unsigned long, ITypeInfo **pptinfo)
-{
- // We don't use a type library
- *pptinfo = 0;
- return S_OK;
-}
-
-HRESULT STDMETHODCALLTYPE QWindowsMsaaAccessible::GetIDsOfNames(const _GUID &, wchar_t **rgszNames, unsigned int, unsigned long, long *rgdispid)
-{
-#if !defined(Q_CC_BOR) && !defined(Q_CC_GNU)
- // PROPERTIES: Hierarchical
- if (_bstr_t(rgszNames[0]) == _bstr_t(L"accParent"))
- rgdispid[0] = DISPID_ACC_PARENT;
- else if (_bstr_t(rgszNames[0]) == _bstr_t(L"accChildCount"))
- rgdispid[0] = DISPID_ACC_CHILDCOUNT;
- else if (_bstr_t(rgszNames[0]) == _bstr_t(L"accChild"))
- rgdispid[0] = DISPID_ACC_CHILD;
-
- // PROPERTIES: Descriptional
- else if (_bstr_t(rgszNames[0]) == _bstr_t(L"accName("))
- rgdispid[0] = DISPID_ACC_NAME;
- else if (_bstr_t(rgszNames[0]) == _bstr_t(L"accValue"))
- rgdispid[0] = DISPID_ACC_VALUE;
- else if (_bstr_t(rgszNames[0]) == _bstr_t(L"accDescription"))
- rgdispid[0] = DISPID_ACC_DESCRIPTION;
- else if (_bstr_t(rgszNames[0]) == _bstr_t(L"accRole"))
- rgdispid[0] = DISPID_ACC_ROLE;
- else if (_bstr_t(rgszNames[0]) == _bstr_t(L"accState"))
- rgdispid[0] = DISPID_ACC_STATE;
- else if (_bstr_t(rgszNames[0]) == _bstr_t(L"accHelp"))
- rgdispid[0] = DISPID_ACC_HELP;
- else if (_bstr_t(rgszNames[0]) == _bstr_t(L"accHelpTopic"))
- rgdispid[0] = DISPID_ACC_HELPTOPIC;
- else if (_bstr_t(rgszNames[0]) == _bstr_t(L"accKeyboardShortcut"))
- rgdispid[0] = DISPID_ACC_KEYBOARDSHORTCUT;
- else if (_bstr_t(rgszNames[0]) == _bstr_t(L"accFocus"))
- rgdispid[0] = DISPID_ACC_FOCUS;
- else if (_bstr_t(rgszNames[0]) == _bstr_t(L"accSelection"))
- rgdispid[0] = DISPID_ACC_SELECTION;
- else if (_bstr_t(rgszNames[0]) == _bstr_t(L"accDefaultAction"))
- rgdispid[0] = DISPID_ACC_DEFAULTACTION;
-
- // METHODS
- else if (_bstr_t(rgszNames[0]) == _bstr_t(L"accSelect"))
- rgdispid[0] = DISPID_ACC_SELECT;
- else if (_bstr_t(rgszNames[0]) == _bstr_t(L"accLocation"))
- rgdispid[0] = DISPID_ACC_LOCATION;
- else if (_bstr_t(rgszNames[0]) == _bstr_t(L"accNavigate"))
- rgdispid[0] = DISPID_ACC_NAVIGATE;
- else if (_bstr_t(rgszNames[0]) == _bstr_t(L"accHitTest"))
- rgdispid[0] = DISPID_ACC_HITTEST;
- else if (_bstr_t(rgszNames[0]) == _bstr_t(L"accDoDefaultAction"))
- rgdispid[0] = DISPID_ACC_DODEFAULTACTION;
- else
- return DISP_E_UNKNOWNINTERFACE;
-
- return S_OK;
-#else
- Q_UNUSED(rgszNames);
- Q_UNUSED(rgdispid);
-
- return DISP_E_MEMBERNOTFOUND;
-#endif
-}
-
-HRESULT STDMETHODCALLTYPE QWindowsMsaaAccessible::Invoke(long dispIdMember,
- const _GUID &,
- unsigned long,
- unsigned short wFlags,
- tagDISPPARAMS *pDispParams,
- tagVARIANT *pVarResult,
- tagEXCEPINFO *, unsigned int *)
-{
- HRESULT hr = DISP_E_MEMBERNOTFOUND;
-
- switch (dispIdMember)
- {
- case DISPID_ACC_PARENT:
- if (wFlags == DISPATCH_PROPERTYGET) {
- if (!pVarResult)
- return E_INVALIDARG;
- hr = get_accParent(&pVarResult->pdispVal);
- } else {
- hr = DISP_E_MEMBERNOTFOUND;
- }
- break;
-
- case DISPID_ACC_CHILDCOUNT:
- if (wFlags == DISPATCH_PROPERTYGET) {
- if (!pVarResult)
- return E_INVALIDARG;
- hr = get_accChildCount(&pVarResult->lVal);
- } else {
- hr = DISP_E_MEMBERNOTFOUND;
- }
- break;
-
- case DISPID_ACC_CHILD:
- if (wFlags == DISPATCH_PROPERTYGET)
- hr = get_accChild(pDispParams->rgvarg[0], &pVarResult->pdispVal);
- else
- hr = DISP_E_MEMBERNOTFOUND;
- break;
-
- case DISPID_ACC_NAME:
- if (wFlags == DISPATCH_PROPERTYGET)
- hr = get_accName(pDispParams->rgvarg[0], &pVarResult->bstrVal);
- else if (wFlags == DISPATCH_PROPERTYPUT)
- hr = put_accName(pDispParams->rgvarg[0], pVarResult->bstrVal);
- else
- hr = DISP_E_MEMBERNOTFOUND;
- break;
-
- case DISPID_ACC_VALUE:
- if (wFlags == DISPATCH_PROPERTYGET)
- hr = get_accValue(pDispParams->rgvarg[0], &pVarResult->bstrVal);
- else if (wFlags == DISPATCH_PROPERTYPUT)
- hr = put_accValue(pDispParams->rgvarg[0], pVarResult->bstrVal);
- else
- hr = DISP_E_MEMBERNOTFOUND;
- break;
-
- case DISPID_ACC_DESCRIPTION:
- if (wFlags == DISPATCH_PROPERTYGET)
- hr = get_accDescription(pDispParams->rgvarg[0], &pVarResult->bstrVal);
- else
- hr = DISP_E_MEMBERNOTFOUND;
- break;
-
- case DISPID_ACC_ROLE:
- if (wFlags == DISPATCH_PROPERTYGET)
- hr = get_accRole(pDispParams->rgvarg[0], pVarResult);
- else
- hr = DISP_E_MEMBERNOTFOUND;
- break;
-
- case DISPID_ACC_STATE:
- if (wFlags == DISPATCH_PROPERTYGET)
- hr = get_accState(pDispParams->rgvarg[0], pVarResult);
- else
- hr = DISP_E_MEMBERNOTFOUND;
- break;
-
- case DISPID_ACC_HELP:
- if (wFlags == DISPATCH_PROPERTYGET)
- hr = get_accHelp(pDispParams->rgvarg[0], &pVarResult->bstrVal);
- else
- hr = DISP_E_MEMBERNOTFOUND;
- break;
-
- case DISPID_ACC_HELPTOPIC:
- if (wFlags == DISPATCH_PROPERTYGET)
- hr = get_accHelpTopic(&pDispParams->rgvarg[2].bstrVal, pDispParams->rgvarg[1], &pDispParams->rgvarg[0].lVal);
- else
- hr = DISP_E_MEMBERNOTFOUND;
- break;
-
- case DISPID_ACC_KEYBOARDSHORTCUT:
- if (wFlags == DISPATCH_PROPERTYGET)
- hr = get_accKeyboardShortcut(pDispParams->rgvarg[0], &pVarResult->bstrVal);
- else
- hr = DISP_E_MEMBERNOTFOUND;
- break;
-
- case DISPID_ACC_FOCUS:
- if (wFlags == DISPATCH_PROPERTYGET)
- hr = get_accFocus(pVarResult);
- else
- hr = DISP_E_MEMBERNOTFOUND;
- break;
-
- case DISPID_ACC_SELECTION:
- if (wFlags == DISPATCH_PROPERTYGET)
- hr = get_accSelection(pVarResult);
- else
- hr = DISP_E_MEMBERNOTFOUND;
- break;
-
- case DISPID_ACC_DEFAULTACTION:
- if (wFlags == DISPATCH_PROPERTYGET)
- hr = get_accDefaultAction(pDispParams->rgvarg[0], &pVarResult->bstrVal);
- else
- hr = DISP_E_MEMBERNOTFOUND;
- break;
-
- case DISPID_ACC_SELECT:
- if (wFlags == DISPATCH_METHOD)
- hr = accSelect(pDispParams->rgvarg[1].lVal, pDispParams->rgvarg[0]);
- else
- hr = DISP_E_MEMBERNOTFOUND;
- break;
-
- case DISPID_ACC_LOCATION:
- if (wFlags == DISPATCH_METHOD)
- hr = accLocation(&pDispParams->rgvarg[4].lVal, &pDispParams->rgvarg[3].lVal, &pDispParams->rgvarg[2].lVal, &pDispParams->rgvarg[1].lVal, pDispParams->rgvarg[0]);
- else
- hr = DISP_E_MEMBERNOTFOUND;
- break;
-
- case DISPID_ACC_NAVIGATE:
- if (wFlags == DISPATCH_METHOD)
- hr = accNavigate(pDispParams->rgvarg[1].lVal, pDispParams->rgvarg[0], pVarResult);
- else
- hr = DISP_E_MEMBERNOTFOUND;
- break;
-
- case DISPID_ACC_HITTEST:
- if (wFlags == DISPATCH_METHOD)
- hr = accHitTest(pDispParams->rgvarg[1].lVal, pDispParams->rgvarg[0].lVal, pVarResult);
- else
- hr = DISP_E_MEMBERNOTFOUND;
- break;
-
- case DISPID_ACC_DODEFAULTACTION:
- if (wFlags == DISPATCH_METHOD)
- hr = accDoDefaultAction(pDispParams->rgvarg[0]);
- else
- hr = DISP_E_MEMBERNOTFOUND;
- break;
-
- default:
- hr = DISP_E_MEMBERNOTFOUND;
- break;
- }
-
- if (!SUCCEEDED(hr)) {
- return hr;
- }
- return hr;
-}
-
-/*
- IAccessible
-
-IAccessible::accHitTest documents the value returned in pvarID like this:
-
-| *Point location* | *vt member* | *Value member* |
-+========================================================+=============+=========================+
-| Outside of the object's boundaries, and either inside | VT_EMPTY | None. |
-| or outside of the object's bounding rectangle. | | |
-+--------------------------------------------------------+-------------+-------------------------+
-| Within the object but not within a child element or a | VT_I4 | lVal is CHILDID_SELF |
-| child object. | | |
-+--------------------------------------------------------+-------------+-------------------------+
-| Within a child element. | VT_I4 | lVal contains |
-| | | the child ID. |
-+--------------------------------------------------------+-------------+-------------------------+
-| Within a child object. | VT_DISPATCH | pdispVal is set to the |
-| | | child object's IDispatch|
-| | | interface pointer |
-+--------------------------------------------------------+-------------+-------------------------+
-*/
-HRESULT STDMETHODCALLTYPE QWindowsMsaaAccessible::accHitTest(long xLeft, long yTop, VARIANT *pvarID)
-{
- QAccessibleInterface *accessible = accessibleInterface();
- accessibleDebugClientCalls(accessible);
- if (!accessible)
- return E_FAIL;
-
- const QPoint pos = QHighDpi::fromNativeLocalPosition(QPoint(xLeft, yTop),
- QWindowsAccessibility::windowHelper(accessible));
- QAccessibleInterface *child = accessible->childAt(pos.x(), pos.y());
- if (child == 0) {
- // no child found, return this item if it contains the coordinates
- if (accessible->rect().contains(xLeft, yTop)) {
- (*pvarID).vt = VT_I4;
- (*pvarID).lVal = CHILDID_SELF;
- return S_OK;
- }
- } else {
- IAccessible *iface = QWindowsAccessibility::wrap(child);
- if (iface) {
- (*pvarID).vt = VT_DISPATCH;
- (*pvarID).pdispVal = iface;
- return S_OK;
- }
- }
-
- // Did not find anything
- (*pvarID).vt = VT_EMPTY;
- return S_FALSE;
-}
-
-/*
- It is recommended to read
- "Implementing a Microsoft Active Accessibility (MSAA) Server.
- Practical Tips for Developers and How Mozilla Does It"
- (https://developer.mozilla.org/En/Accessibility/Implementing_an_MSAA_Server)
-
- to get an overview of what's important to implement and what parts of MSAA
- can be ignored. All stuff prefixed with "moz" are information from that page.
-*/
-// moz: [important]
-HRESULT STDMETHODCALLTYPE QWindowsMsaaAccessible::accLocation(long *pxLeft, long *pyTop, long *pcxWidth, long *pcyHeight, VARIANT varID)
-{
- QAccessibleInterface *accessible = accessibleInterface();
- accessibleDebugClientCalls(accessible);
- if (!accessible)
- return E_FAIL;
-
- QAccessibleInterface *acc = childPointer(accessible, varID);
- if (!acc || !acc->isValid())
- return E_FAIL;
- const QRect rect = QHighDpi::toNativePixels(acc->rect(),
- QWindowsAccessibility::windowHelper(accessible));
-
- *pxLeft = rect.x();
- *pyTop = rect.y();
- *pcxWidth = rect.width();
- *pcyHeight = rect.height();
-
- return S_OK;
-}
-
-// moz: [important, but no need to implement up/down/left/right]
-HRESULT STDMETHODCALLTYPE QWindowsMsaaAccessible::accNavigate(long navDir, VARIANT varStart, VARIANT *pvarEnd)
-{
- QAccessibleInterface *accessible = accessibleInterface();
- accessibleDebugClientCalls(accessible);
- if (!accessible)
- return E_FAIL;
-
- QAccessibleInterface *acc = 0;
- switch (navDir) {
- case NAVDIR_FIRSTCHILD:
- acc = accessible->child(0);
- break;
- case NAVDIR_LASTCHILD:
- acc = accessible->child(accessible->childCount() - 1);
- break;
- case NAVDIR_NEXT:
- case NAVDIR_PREVIOUS:
- if (!varStart.lVal){
- QAccessibleInterface *parent = accessible->parent();
- if (parent && parent->isValid()) {
- int index = parent->indexOfChild(accessible);
- index += (navDir == NAVDIR_NEXT) ? 1 : -1;
- if (index >= 0 && index < parent->childCount())
- acc = parent->child(index);
- }
- } else {
- int index = varStart.lVal;
- index += (navDir == NAVDIR_NEXT) ? 1 : -1;
- if (index > 0 && index <= accessible->childCount())
- acc = accessible->child(index - 1);
- }
- break;
-
- // Geometrical
- case NAVDIR_UP:
- case NAVDIR_DOWN:
- case NAVDIR_LEFT:
- case NAVDIR_RIGHT: {
- QAccessibleInterface *pIface = accessible->parent();
- if (pIface && pIface->isValid()) {
- const int indexOfOurself = pIface->indexOfChild(accessible);
- QRect startg = accessible->rect();
- QPoint startc = startg.center();
- QAccessibleInterface *candidate = 0;
- unsigned mindist = UINT_MAX; // will work on screen sizes at least up to 46340x46340
- const int sibCount = pIface->childCount();
- for (int i = 0; i < sibCount; ++i) {
- QAccessibleInterface *sibling = 0;
- sibling = pIface->child(i);
- Q_ASSERT(sibling);
- if (i == indexOfOurself || sibling->state().invisible) {
- //ignore ourself and invisible siblings
- continue;
- }
-
- QRect sibg = sibling->rect();
- QPoint sibc = sibg.center();
- QPoint sibp;
- QPoint startp;
- QPoint distp;
- switch (navDir) {
- case NAVDIR_LEFT:
- startp = QPoint(startg.left(), startg.top() + startg.height() / 2);
- sibp = QPoint(sibg.right(), sibg.top() + sibg.height() / 2);
- if (QPoint(sibc - startc).x() >= 0) {
- continue;
- }
- distp = sibp - startp;
- break;
- case NAVDIR_RIGHT:
- startp = QPoint(startg.right(), startg.top() + startg.height() / 2);
- sibp = QPoint(sibg.left(), sibg.top() + sibg.height() / 2);
- if (QPoint(sibc - startc).x() <= 0) {
- continue;
- }
- distp = sibp - startp;
- break;
- case NAVDIR_UP:
- startp = QPoint(startg.left() + startg.width() / 2, startg.top());
- sibp = QPoint(sibg.left() + sibg.width() / 2, sibg.bottom());
- if (QPoint(sibc - startc).y() >= 0) {
- continue;
- }
- distp = sibp - startp;
- break;
- case NAVDIR_DOWN:
- startp = QPoint(startg.left() + startg.width() / 2, startg.bottom());
- sibp = QPoint(sibg.left() + sibg.width() / 2, sibg.top());
- if (QPoint(sibc - startc).y() <= 0) {
- continue;
- }
- distp = sibp - startp;
- break;
- default:
- break;
- }
-
- // Since we're *comparing* (and not measuring) distances, we can compare the
- // squared distance, (thus, no need to take the sqrt()).
- unsigned dist = distp.x() * distp.x() + distp.y() * distp.y();
- if (dist < mindist) {
- candidate = sibling;
- mindist = dist;
- }
- }
- acc = candidate;
- }
- }
- break;
- default:
- break;
- }
- if (!acc) {
- (*pvarEnd).vt = VT_EMPTY;
- return S_FALSE;
- }
-
- if (IAccessible *iface = QWindowsAccessibility::wrap(acc)) {
- (*pvarEnd).vt = VT_DISPATCH;
- (*pvarEnd).pdispVal = iface;
- return S_OK;
- }
-
- (*pvarEnd).vt = VT_EMPTY;
- return S_FALSE;
-}
-
-// moz: [important]
-HRESULT STDMETHODCALLTYPE QWindowsMsaaAccessible::get_accChild(VARIANT varChildID, IDispatch** ppdispChild)
-{
- QAccessibleInterface *accessible = accessibleInterface();
- accessibleDebugClientCalls(accessible);
- if (!accessible)
- return E_FAIL;
-
- if (varChildID.vt != VT_I4)
- return E_INVALIDARG;
-
- QAccessibleInterface *acc = childPointer(accessible, varChildID);
- if (acc && acc->isValid()) {
- *ppdispChild = QWindowsAccessibility::wrap(acc);
- return S_OK;
- }
-
- return E_FAIL;
-}
-
-// moz: [important]
-HRESULT STDMETHODCALLTYPE QWindowsMsaaAccessible::get_accChildCount(long* pcountChildren)
-{
- QAccessibleInterface *accessible = accessibleInterface();
- accessibleDebugClientCalls(accessible);
- if (!accessible)
- return E_FAIL;
-
- *pcountChildren = accessible->childCount();
- return S_OK;
-}
-
-// moz: [important]
-HRESULT STDMETHODCALLTYPE QWindowsMsaaAccessible::get_accParent(IDispatch** ppdispParent)
-{
- QAccessibleInterface *accessible = accessibleInterface();
- accessibleDebugClientCalls(accessible);
- if (!accessible)
- return E_FAIL;
-
- QAccessibleInterface *acc = accessible->parent();
- if (acc) {
- if (IAccessible *iface = QWindowsAccessibility::wrap(acc)) {
- *ppdispParent = iface;
- return S_OK;
- }
- }
-
- *ppdispParent = 0;
- return S_FALSE;
-}
-
-/*
- Properties and methods
-*/
-HRESULT STDMETHODCALLTYPE QWindowsMsaaAccessible::accDoDefaultAction(VARIANT varID)
-{
- Q_UNUSED(varID);
- QAccessibleInterface *accessible = accessibleInterface();
- accessibleDebugClientCalls(accessible);
- if (!accessible)
- return E_FAIL;
-
- if (QAccessibleActionInterface *actionIface = accessible->actionInterface()) {
- const QString def = actionIface->actionNames().value(0);
- if (!def.isEmpty()) {
- actionIface->doAction(def);
- return S_OK;
- }
- }
- return S_FALSE;
-}
-
-HRESULT STDMETHODCALLTYPE QWindowsMsaaAccessible::get_accDefaultAction(VARIANT varID, BSTR* pszDefaultAction)
-{
- Q_UNUSED(varID);
- QAccessibleInterface *accessible = accessibleInterface();
- accessibleDebugClientCalls(accessible);
- if (!accessible)
- return E_FAIL;
-
- *pszDefaultAction = 0;
- if (QAccessibleActionInterface *actionIface = accessible->actionInterface()) {
- const QString def = actionIface->actionNames().value(0);
- if (!def.isEmpty())
- *pszDefaultAction = QStringToBSTR(def);
- }
- return *pszDefaultAction ? S_OK : S_FALSE;
-}
-
-HRESULT STDMETHODCALLTYPE QWindowsMsaaAccessible::get_accDescription(VARIANT varID, BSTR* pszDescription)
-{
- QAccessibleInterface *accessible = accessibleInterface();
- accessibleDebugClientCalls(accessible);
- if (!accessible)
- return E_FAIL;
-
-
- QString descr;
- if (varID.lVal) {
- QAccessibleInterface *child = childPointer(accessible, varID);
- if (!child || !child->isValid())
- return E_FAIL;
- descr = child->text(QAccessible::Description);
- } else {
- descr = accessible->text(QAccessible::Description);
- }
- if (descr.size()) {
- *pszDescription = QStringToBSTR(descr);
- return S_OK;
- }
-
- *pszDescription = 0;
- return S_FALSE;
-}
-
-HRESULT STDMETHODCALLTYPE QWindowsMsaaAccessible::get_accHelp(VARIANT varID, BSTR *pszHelp)
-{
- QAccessibleInterface *accessible = accessibleInterface();
- accessibleDebugClientCalls(accessible);
- if (!accessible)
- return E_FAIL;
-
- QString help;
- if (varID.lVal) {
- QAccessibleInterface *child = childPointer(accessible, varID);
- if (!child || !child->isValid())
- return E_FAIL;
- help = child->text(QAccessible::Help);
- } else {
- help = accessible->text(QAccessible::Help);
- }
- if (help.size()) {
- *pszHelp = QStringToBSTR(help);
- return S_OK;
- }
-
- *pszHelp = 0;
- return S_FALSE;
-}
-
-HRESULT STDMETHODCALLTYPE QWindowsMsaaAccessible::get_accHelpTopic(BSTR *, VARIANT, long *)
-{
- return DISP_E_MEMBERNOTFOUND;
-}
-
-HRESULT STDMETHODCALLTYPE QWindowsMsaaAccessible::get_accKeyboardShortcut(VARIANT varID, BSTR *pszKeyboardShortcut)
-{
- Q_UNUSED(varID);
- QAccessibleInterface *accessible = accessibleInterface();
- accessibleDebugClientCalls(accessible);
- if (!accessible)
- return E_FAIL;
-
- *pszKeyboardShortcut = 0;
- if (QAccessibleActionInterface *actionIface = accessible->actionInterface()) {
- const QString def = actionIface->actionNames().value(0);
- if (!def.isEmpty()) {
- const QString keyBoardShortCut = actionIface->keyBindingsForAction(def).value(0);
- if (!keyBoardShortCut.isEmpty())
- *pszKeyboardShortcut = QStringToBSTR(keyBoardShortCut);
- }
- }
- return *pszKeyboardShortcut ? S_OK : S_FALSE;
-}
-
-static QAccessibleInterface *relatedInterface(QAccessibleInterface *iface, QAccessible::RelationFlag flag)
-{
- typedef QPair<QAccessibleInterface *, QAccessible::Relation> RelationPair;
- QVector<RelationPair> rels = iface->relations(flag);
-
- return rels.value(0).first;
-}
-
-// moz: [important]
-HRESULT STDMETHODCALLTYPE QWindowsMsaaAccessible::get_accName(VARIANT varID, BSTR* pszName)
-{
- QAccessibleInterface *accessible = accessibleInterface();
- accessibleDebugClientCalls(accessible);
- if (!accessible)
- return E_FAIL;
-
- QString name;
- if (varID.lVal) {
- QAccessibleInterface *child = childPointer(accessible, varID);
- if (!child || !child->isValid())
- return E_FAIL;
- name = child->text(QAccessible::Name);
- if (name.isEmpty()) {
- if (QAccessibleInterface *labelInterface = relatedInterface(child, QAccessible::Label)) {
- name = labelInterface->text(QAccessible::Name);
- }
- }
- } else {
- name = accessible->text(QAccessible::Name);
- if (name.isEmpty()) {
- if (QAccessibleInterface *labelInterface = relatedInterface(accessible, QAccessible::Label)) {
- name = labelInterface->text(QAccessible::Name);
- }
- }
- }
-
- QString shortcut = accessible->text(QAccessible::Accelerator);
- if (!shortcut.isEmpty())
- name += QLatin1Char(' ') + shortcut;
-
- if (name.size()) {
- *pszName = QStringToBSTR(name);
- return S_OK;
- }
-
- *pszName = 0;
- return S_FALSE;
-}
-
-HRESULT STDMETHODCALLTYPE QWindowsMsaaAccessible::put_accName(VARIANT, BSTR)
-{
- QAccessibleInterface *accessible = accessibleInterface();
- accessibleDebugClientCalls(accessible);
- return DISP_E_MEMBERNOTFOUND;
-}
-
-// moz: [important]
-HRESULT STDMETHODCALLTYPE QWindowsMsaaAccessible::get_accRole(VARIANT varID, VARIANT *pvarRole)
-{
- QAccessibleInterface *accessible = accessibleInterface();
- accessibleDebugClientCalls(accessible);
- if (!accessible)
- return E_FAIL;
-
- QAccessible::Role role;
- if (varID.lVal) {
- QAccessibleInterface *child = childPointer(accessible, varID);
- if (!child || !child->isValid())
- return E_FAIL;
- role = child->role();
- } else {
- role = accessible->role();
- }
-
- if (role != QAccessible::NoRole) {
- if (role >= QAccessible::LayeredPane) {
- // This block should hopefully only be entered if the AT client
- // does not support IAccessible2, since it should prefer IA2::role() then.
- if (role == QAccessible::LayeredPane)
- role = QAccessible::Pane;
- else if (role == QAccessible::WebDocument)
- role = QAccessible::Document;
- else
- role = QAccessible::Client;
- }
- (*pvarRole).vt = VT_I4;
- (*pvarRole).lVal = role;
- } else {
- (*pvarRole).vt = VT_EMPTY;
- }
- return S_OK;
-}
-
-// moz: [important]
-HRESULT STDMETHODCALLTYPE QWindowsMsaaAccessible::get_accState(VARIANT varID, VARIANT *pvarState)
-{
- QAccessibleInterface *accessible = accessibleInterface();
- accessibleDebugClientCalls(accessible);
- if (!accessible)
- return E_FAIL;
-
- QAccessible::State state;
- if (varID.lVal) {
- QAccessibleInterface *child = childPointer(accessible, varID);
- if (!child || !child->isValid())
- return E_FAIL;
- state = child->state();
- } else {
- state = accessible->state();
- }
-
- LONG st = 0;
- if (state.animated)
- st |= STATE_SYSTEM_ANIMATED;
- if (state.busy)
- st |= STATE_SYSTEM_BUSY;
- if (state.checked)
- st |= STATE_SYSTEM_CHECKED;
- if (state.collapsed)
- st |= STATE_SYSTEM_COLLAPSED;
- if (state.defaultButton)
- st |= STATE_SYSTEM_DEFAULT;
- if (state.expanded)
- st |= STATE_SYSTEM_EXPANDED;
- if (state.extSelectable)
- st |= STATE_SYSTEM_EXTSELECTABLE;
- if (state.focusable)
- st |= STATE_SYSTEM_FOCUSABLE;
- if (state.focused)
- st |= STATE_SYSTEM_FOCUSED;
- if (state.hasPopup)
- st |= STATE_SYSTEM_HASPOPUP;
- if (state.hotTracked)
- st |= STATE_SYSTEM_HOTTRACKED;
- if (state.invisible)
- st |= STATE_SYSTEM_INVISIBLE;
- if (state.linked)
- st |= STATE_SYSTEM_LINKED;
- if (state.marqueed)
- st |= STATE_SYSTEM_MARQUEED;
- if (state.checkStateMixed)
- st |= STATE_SYSTEM_MIXED;
- if (state.movable)
- st |= STATE_SYSTEM_MOVEABLE;
- if (state.multiSelectable)
- st |= STATE_SYSTEM_MULTISELECTABLE;
- if (state.offscreen)
- st |= STATE_SYSTEM_OFFSCREEN;
- if (state.pressed)
- st |= STATE_SYSTEM_PRESSED;
- if (state.passwordEdit)
- st |= STATE_SYSTEM_PROTECTED;
- if (state.readOnly)
- st |= STATE_SYSTEM_READONLY;
- if (state.selectable)
- st |= STATE_SYSTEM_SELECTABLE;
- if (state.selected)
- st |= STATE_SYSTEM_SELECTED;
- if (state.selfVoicing)
- st |= STATE_SYSTEM_SELFVOICING;
- if (state.sizeable)
- st |= STATE_SYSTEM_SIZEABLE;
- if (state.traversed)
- st |= STATE_SYSTEM_TRAVERSED;
- if (state.disabled)
- st |= STATE_SYSTEM_UNAVAILABLE;
-
- (*pvarState).vt = VT_I4;
- (*pvarState).lVal = st;
- return S_OK;
-}
-
-// moz: [important]
-HRESULT STDMETHODCALLTYPE QWindowsMsaaAccessible::get_accValue(VARIANT varID, BSTR* pszValue)
-{
- QAccessibleInterface *accessible = accessibleInterface();
- accessibleDebugClientCalls(accessible);
- if (varID.vt != VT_I4)
- return E_INVALIDARG;
-
- if (!accessible || !accessible->isValid() || varID.lVal) {
- return E_FAIL;
- }
-
- QString value;
- if (accessible->valueInterface()) {
- value = accessible->valueInterface()->currentValue().toString();
- } else {
- value = accessible->text(QAccessible::Value);
- }
- if (!value.isNull()) {
- *pszValue = QStringToBSTR(value);
- return S_OK;
- }
-
- *pszValue = 0;
- qCDebug(lcQpaAccessibility) << "return S_FALSE";
- return S_FALSE;
-}
-
-HRESULT STDMETHODCALLTYPE QWindowsMsaaAccessible::put_accValue(VARIANT, BSTR value)
-{
- QAccessibleInterface *accessible = accessibleInterface();
- accessibleDebugClientCalls(accessible);
-
- if (!accessible || !accessible->isValid()) {
- return E_FAIL;
- }
-
- QString qstrValue = QString::fromWCharArray(value);
-
- if (accessible->valueInterface()) {
- accessible->valueInterface()->setCurrentValue(qstrValue);
- } else {
- accessible->setText(QAccessible::Value, qstrValue);
- }
-
- return S_OK;
-}
-
-// moz: [important]
-HRESULT STDMETHODCALLTYPE QWindowsMsaaAccessible::accSelect(long flagsSelect, VARIANT varID)
-{
- Q_UNUSED(flagsSelect);
- Q_UNUSED(varID);
- QAccessibleInterface *accessible = accessibleInterface();
- accessibleDebugClientCalls(accessible);
- if (!accessible)
- return E_FAIL;
-
- bool res = false;
-
-/*
- ### Check for accessibleTableInterface() or accessibleTextInterface()
-
- ### and if there are no ia2 interfaces we should do nothing??
- if (flagsSelect & SELFLAG_TAKEFOCUS)
- res = accessible()->doAction(SetFocus, varID.lVal, QVariantList());
- if (flagsSelect & SELFLAG_TAKESELECTION) {
- accessible()->doAction(ClearSelection, 0, QVariantList());
- res = accessible()->doAction(AddToSelection, varID.lVal, QVariantList());
- }
- if (flagsSelect & SELFLAG_EXTENDSELECTION)
- res = accessible()->doAction(ExtendSelection, varID.lVal, QVariantList());
- if (flagsSelect & SELFLAG_ADDSELECTION)
- res = accessible()->doAction(AddToSelection, varID.lVal, QVariantList());
- if (flagsSelect & SELFLAG_REMOVESELECTION)
- res = accessible()->doAction(RemoveSelection, varID.lVal, QVariantList());
-*/
- return res ? S_OK : S_FALSE;
-}
-
-/*!
- \internal
- Can return:
-
- +-------------+------------------------------------------------------------------------------+
- | VT_EMPTY | None. Neither this object nor any of its children has the keyboard focus. |
- +-------------+------------------------------------------------------------------------------+
- | VT_I4 | lVal is CHILDID_SELF. The object itself has the keyboard focus. |
- +-------------+------------------------------------------------------------------------------+
- | VT_I4 | lVal contains the child ID of the child element that has the keyboard focus. |
- +-------------+------------------------------------------------------------------------------+
- | VT_DISPATCH | pdispVal member is the address of the IDispatch interface for the child |
- | | object that has the keyboard focus. |
- +-------------+------------------------------------------------------------------------------+
- moz: [important]
-*/
-HRESULT STDMETHODCALLTYPE QWindowsMsaaAccessible::get_accFocus(VARIANT *pvarID)
-{
- QAccessibleInterface *accessible = accessibleInterface();
- accessibleDebugClientCalls(accessible);
- if (!accessible)
- return E_FAIL;
-
- if (QAccessibleInterface *acc = accessible->focusChild()) {
- if (acc == accessible) {
- (*pvarID).vt = VT_I4;
- (*pvarID).lVal = CHILDID_SELF;
- return S_OK;
- } else {
- if (IAccessible *iface = QWindowsAccessibility::wrap(acc)) {
- (*pvarID).vt = VT_DISPATCH;
- (*pvarID).pdispVal = iface;
- return S_OK;
- }
- }
- }
- (*pvarID).vt = VT_EMPTY;
- return S_FALSE;
-}
-
-HRESULT STDMETHODCALLTYPE QWindowsMsaaAccessible::get_accSelection(VARIANT *pvarChildren)
-{
- QAccessibleInterface *accessible = accessibleInterface();
- accessibleDebugClientCalls(accessible);
- if (!accessible)
- return E_FAIL;
-
- int cc = accessible->childCount();
- QVector<int> sel(cc);
- int selIndex = 0;
- for (int i = 0; i < cc; ++i) {
- bool isSelected = false;
- QAccessibleInterface *child = accessible->child(i);
- if (child) {
- isSelected = child->state().selected;
- }
- if (isSelected)
- sel[selIndex++] = i+1;
- }
- sel.resize(selIndex);
- if (sel.isEmpty()) {
- (*pvarChildren).vt = VT_EMPTY;
- return S_FALSE;
- }
- if (sel.size() == 1) {
- (*pvarChildren).vt = VT_I4;
- (*pvarChildren).lVal = sel[0];
- return S_OK;
- }
- IEnumVARIANT *iface = new QWindowsEnumerate(sel);
- IUnknown *uiface;
- iface->QueryInterface(IID_IUnknown, (void**)&uiface);
- (*pvarChildren).vt = VT_UNKNOWN;
- (*pvarChildren).punkVal = uiface;
-
- return S_OK;
-}
-
-/**************************************************************\
- * IOleWindow *
- **************************************************************/
-HRESULT STDMETHODCALLTYPE QWindowsMsaaAccessible::GetWindow(HWND *phwnd)
-{
- *phwnd = 0;
- QAccessibleInterface *accessible = accessibleInterface();
- accessibleDebugClientCalls(accessible);
- if (!accessible)
- return E_FAIL;
-
- QWindow *window = QWindowsAccessibility::windowHelper(accessible);
- if (!window)
- return E_FAIL;
-
- QPlatformNativeInterface *platform = QGuiApplication::platformNativeInterface();
- Q_ASSERT(platform);
- *phwnd = (HWND)platform->nativeResourceForWindow("handle", window);
- qCDebug(lcQpaAccessibility) << "QWindowsAccessible::GetWindow(): " << *phwnd;
- return S_OK;
-}
-
-HRESULT STDMETHODCALLTYPE QWindowsMsaaAccessible::ContextSensitiveHelp(BOOL)
-{
- return S_OK;
-}
-
-const char *QWindowsAccessibleGuid::iidToString(const GUID &id)
-{
- const char *result = nullptr;
- if (id == IID_IUnknown)
- result = "IID_IUnknown";
- else if (id == IID_IDispatch)
- result = "IID_IDispatch";
- else if (id == IID_IAccessible)
- result = "IID_IAccessible";
- else if (id == IID_IOleWindow)
- result = "IID_IOleWindow";
- else if (id == IID_IServiceProvider)
- result = "IID_IServiceProvider";
- else if (id == IID_IAccessible2)
- result = "IID_IAccessible2";
- else if (id == IID_IAccessibleAction)
- result = "IID_IAccessibleAction";
- else if (id == IID_IAccessibleApplication)
- result = "IID_IAccessibleApplication";
- else if (id == IID_IAccessibleComponent)
- result = "IID_IAccessibleComponent";
- else if (id == IID_IAccessibleEditableText)
- result = "IID_IAccessibleEditableText";
- else if (id == IID_IAccessibleHyperlink)
- result = "IID_IAccessibleHyperlink";
- else if (id == IID_IAccessibleHypertext)
- result = "IID_IAccessibleHypertext";
- else if (id == IID_IAccessibleImage)
- result = "IID_IAccessibleImage";
- else if (id == IID_IAccessibleRelation)
- result = "IID_IAccessibleRelation";
- else if (id == IID_IAccessibleTable)
- result = "IID_IAccessibleTable";
- else if (id == IID_IAccessibleTable2)
- result = "IID_IAccessibleTable2";
- else if (id == IID_IAccessibleTableCell)
- result = "IID_IAccessibleTableCell";
- else if (id == IID_IAccessibleText)
- result = "IID_IAccessibleText";
- else if (id == IID_IAccessibleValue)
- result = "IID_IAccessibleValue";
- return result;
-}
-
-#ifndef QT_NO_DEBUG_STREAM
-QDebug operator<<(QDebug, const GUID &);
-
-QDebug operator<<(QDebug d, const QWindowsAccessibleGuid &aguid)
-{
- QDebugStateSaver saver(d);
- d.nospace();
- if (const char *ids = QWindowsAccessibleGuid::iidToString(aguid.guid()))
- d << ids;
- else
- d << aguid.guid();
- return d;
-}
-#endif // !QT_NO_DEBUG_STREAM
-
-QT_END_NAMESPACE
-
-#endif //QT_NO_ACCESSIBILITY
diff --git a/src/plugins/platforms/windows/accessible/qwindowsmsaaaccessible.h b/src/plugins/platforms/windows/accessible/qwindowsmsaaaccessible.h
deleted file mode 100644
index 5380fc2411..0000000000
--- a/src/plugins/platforms/windows/accessible/qwindowsmsaaaccessible.h
+++ /dev/null
@@ -1,176 +0,0 @@
-/****************************************************************************
-**
-** Copyright (C) 2016 The Qt Company Ltd.
-** Contact: https://www.qt.io/licensing/
-**
-** This file is part of the plugins of the Qt Toolkit.
-**
-** $QT_BEGIN_LICENSE:LGPL$
-** Commercial License Usage
-** Licensees holding valid commercial Qt licenses may use this file in
-** accordance with the commercial license agreement provided with the
-** Software or, alternatively, in accordance with the terms contained in
-** a written agreement between you and The Qt Company. For licensing terms
-** and conditions see https://www.qt.io/terms-conditions. For further
-** information use the contact form at https://www.qt.io/contact-us.
-**
-** GNU Lesser General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU Lesser
-** General Public License version 3 as published by the Free Software
-** Foundation and appearing in the file LICENSE.LGPL3 included in the
-** packaging of this file. Please review the following information to
-** ensure the GNU Lesser General Public License version 3 requirements
-** will be met: https://www.gnu.org/licenses/lgpl-3.0.html.
-**
-** GNU General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU
-** General Public License version 2.0 or (at your option) the GNU General
-** Public license version 3 or any later version approved by the KDE Free
-** Qt Foundation. The licenses are as published by the Free Software
-** Foundation and appearing in the file LICENSE.GPL2 and LICENSE.GPL3
-** included in the packaging of this file. Please review the following
-** information to ensure the GNU General Public License requirements will
-** be met: https://www.gnu.org/licenses/gpl-2.0.html and
-** https://www.gnu.org/licenses/gpl-3.0.html.
-**
-** $QT_END_LICENSE$
-**
-****************************************************************************/
-#ifndef QWINDOWSMSAAACCESSIBLE_H
-#define QWINDOWSMSAAACCESSIBLE_H
-
-#include <QtCore/qglobal.h>
-#ifndef QT_NO_ACCESSIBILITY
-
-#include <QtCore/qt_windows.h>
-#include <QtCore/qsharedpointer.h>
-#include <QtGui/qaccessible.h>
-#include <oleacc.h>
-#include "ia2_api_all.h" // IAccessible2 inherits from IAccessible
-
-QT_BEGIN_NAMESPACE
-
-#ifndef QT_NO_DEBUG_OUTPUT
-#define DEBUG_SHOW_ATCLIENT_COMMANDS
-#endif
-#if defined(DEBUG_SHOW_ATCLIENT_COMMANDS)
-void accessibleDebugClientCalls_helper(const char* funcName, const QAccessibleInterface *iface);
-# define accessibleDebugClientCalls(iface) accessibleDebugClientCalls_helper(Q_FUNC_INFO, iface)
-#else
-# define accessibleDebugClientCalls(iface)
-#endif
-
-QWindow *window_helper(const QAccessibleInterface *iface);
-
-class QWindowsAccessibleGuid // Helper for QDebug, outputs known ids by name.
-{
-public:
- explicit QWindowsAccessibleGuid(const GUID &g) : m_guid(g) {}
- GUID guid () const { return m_guid; }
- static const char *iidToString(const GUID &id);
-
-private:
- GUID m_guid;
-};
-
-#ifndef QT_NO_DEBUG_STREAM
-QDebug operator<<(QDebug d, const QWindowsAccessibleGuid &aguid);
-#endif
-
-/**************************************************************\
- * QWindowsAccessible *
- **************************************************************/
-
-class QWindowsMsaaAccessible : public IAccessible2, public IOleWindow
-{
-public:
- QWindowsMsaaAccessible(QAccessibleInterface *a)
- : ref(0)
- {
- id = QAccessible::uniqueId(a);
- }
-
- virtual ~QWindowsMsaaAccessible()
- {
- }
-
- /* IUnknown */
- HRESULT STDMETHODCALLTYPE QueryInterface(REFIID, LPVOID *);
- ULONG STDMETHODCALLTYPE AddRef();
- ULONG STDMETHODCALLTYPE Release();
-
- /* IDispatch */
- HRESULT STDMETHODCALLTYPE GetTypeInfoCount(unsigned int *);
- HRESULT STDMETHODCALLTYPE GetTypeInfo(unsigned int, unsigned long, ITypeInfo **);
- HRESULT STDMETHODCALLTYPE GetIDsOfNames(const _GUID &, wchar_t **, unsigned int, unsigned long, long *);
- HRESULT STDMETHODCALLTYPE Invoke(long, const _GUID &, unsigned long, unsigned short, tagDISPPARAMS *, tagVARIANT *, tagEXCEPINFO *, unsigned int *);
-
- /* IAccessible */
- HRESULT STDMETHODCALLTYPE accHitTest(long xLeft, long yTop, VARIANT *pvarID);
- HRESULT STDMETHODCALLTYPE accLocation(long *pxLeft, long *pyTop, long *pcxWidth, long *pcyHeight, VARIANT varID);
- HRESULT STDMETHODCALLTYPE accNavigate(long navDir, VARIANT varStart, VARIANT *pvarEnd);
- HRESULT STDMETHODCALLTYPE get_accChild(VARIANT varChildID, IDispatch** ppdispChild);
- HRESULT STDMETHODCALLTYPE get_accChildCount(long* pcountChildren);
- HRESULT STDMETHODCALLTYPE get_accParent(IDispatch** ppdispParent);
-
- HRESULT STDMETHODCALLTYPE accDoDefaultAction(VARIANT varID);
- HRESULT STDMETHODCALLTYPE get_accDefaultAction(VARIANT varID, BSTR* pszDefaultAction);
- HRESULT STDMETHODCALLTYPE get_accDescription(VARIANT varID, BSTR* pszDescription);
- HRESULT STDMETHODCALLTYPE get_accHelp(VARIANT varID, BSTR *pszHelp);
- HRESULT STDMETHODCALLTYPE get_accHelpTopic(BSTR *pszHelpFile, VARIANT varChild, long *pidTopic);
- HRESULT STDMETHODCALLTYPE get_accKeyboardShortcut(VARIANT varID, BSTR *pszKeyboardShortcut);
- HRESULT STDMETHODCALLTYPE get_accName(VARIANT varID, BSTR* pszName);
- HRESULT STDMETHODCALLTYPE put_accName(VARIANT varChild, BSTR szName);
- HRESULT STDMETHODCALLTYPE get_accRole(VARIANT varID, VARIANT *pvarRole);
- HRESULT STDMETHODCALLTYPE get_accState(VARIANT varID, VARIANT *pvarState);
- HRESULT STDMETHODCALLTYPE get_accValue(VARIANT varID, BSTR* pszValue);
- HRESULT STDMETHODCALLTYPE put_accValue(VARIANT varChild, BSTR szValue);
-
- HRESULT STDMETHODCALLTYPE accSelect(long flagsSelect, VARIANT varID);
- HRESULT STDMETHODCALLTYPE get_accFocus(VARIANT *pvarID);
- HRESULT STDMETHODCALLTYPE get_accSelection(VARIANT *pvarChildren);
-
- /* IOleWindow */
- HRESULT STDMETHODCALLTYPE GetWindow(HWND *phwnd);
- HRESULT STDMETHODCALLTYPE ContextSensitiveHelp(BOOL fEnterMode);
-
-protected:
- QAccessible::Id id;
-
- QAccessibleInterface *accessibleInterface() const
- {
- QAccessibleInterface *iface = QAccessible::accessibleInterface(id);
- if (iface && iface->isValid())
- return iface;
- return 0;
- }
-
- static QAccessibleInterface *childPointer(QAccessibleInterface *parent, VARIANT varID)
- {
- // -1 since windows API always uses 1 for the first child
- Q_ASSERT(parent);
-
- QAccessibleInterface *acc = 0;
- int childIndex = varID.lVal;
- if (childIndex == 0) {
- // Yes, some AT clients (Active Accessibility Object Inspector)
- // actually ask for the same object. As a consequence, we need to clone ourselves:
- acc = parent;
- } else if (childIndex < 0) {
- acc = QAccessible::accessibleInterface((QAccessible::Id)childIndex);
- } else {
- acc = parent->child(childIndex - 1);
- }
- return acc;
- }
-
-private:
- ULONG ref;
-
-};
-
-QT_END_NAMESPACE
-
-#endif //QT_NO_ACCESSIBILITY
-
-#endif // QWINDOWSMSAAACCESSIBLE_H
diff --git a/src/plugins/platforms/windows/qwin10helpers.cpp b/src/plugins/platforms/windows/qwin10helpers.cpp
index 12cccd124b..ac6a34d7c2 100644
--- a/src/plugins/platforms/windows/qwin10helpers.cpp
+++ b/src/plugins/platforms/windows/qwin10helpers.cpp
@@ -40,6 +40,7 @@
#include "qwin10helpers.h"
#include <QtCore/QDebug>
+#include <QtCore/QOperatingSystemVersion>
#include <QtCore/private/qsystemlibrary_p.h>
#if defined(Q_CC_MINGW)
@@ -115,7 +116,7 @@ static QWindowsComBaseDLL baseComDll;
bool QWindowsComBaseDLL::init()
{
- if (QSysInfo::windowsVersion() >= QSysInfo::WV_WINDOWS10 && !isValid()) {
+ if (QOperatingSystemVersion::current() >= QOperatingSystemVersion::Windows10 && !isValid()) {
QSystemLibrary library(QStringLiteral("combase"));
roGetActivationFactory =
reinterpret_cast<RoGetActivationFactory>(library.resolve("RoGetActivationFactory"));
diff --git a/src/plugins/platforms/windows/qwindowsbackingstore.cpp b/src/plugins/platforms/windows/qwindowsbackingstore.cpp
index 49c7144221..80872c3ea3 100644
--- a/src/plugins/platforms/windows/qwindowsbackingstore.cpp
+++ b/src/plugins/platforms/windows/qwindowsbackingstore.cpp
@@ -93,7 +93,7 @@ void QWindowsBackingStore::flush(QWindow *window, const QRegion &region,
// Windows with alpha: Use blend function to update.
QRect r = QHighDpi::toNativePixels(window->frameGeometry(), window);
QPoint frameOffset(QHighDpi::toNativePixels(QPoint(window->frameMargins().left(), window->frameMargins().top()),
- static_cast<const QWindow *>(Q_NULLPTR)));
+ static_cast<const QWindow *>(nullptr)));
QRect dirtyRect = br.translated(offset + frameOffset);
SIZE size = {r.width(), r.height()};
diff --git a/src/plugins/platforms/windows/qwindowscontext.cpp b/src/plugins/platforms/windows/qwindowscontext.cpp
index 9912e03cb9..c146f8ec25 100644
--- a/src/plugins/platforms/windows/qwindowscontext.cpp
+++ b/src/plugins/platforms/windows/qwindowscontext.cpp
@@ -53,7 +53,7 @@
#include "qwindowstheme.h"
#include <private/qguiapplication_p.h>
#ifndef QT_NO_ACCESSIBILITY
-# include "accessible/qwindowsaccessibility.h"
+# include "uiautomation/qwindowsuiaaccessibility.h"
#endif
#if QT_CONFIG(sessionmanager)
# include <private/qsessionmanager_p.h>
@@ -98,6 +98,7 @@ Q_LOGGING_CATEGORY(lcQpaDialogs, "qt.qpa.dialogs")
Q_LOGGING_CATEGORY(lcQpaMenus, "qt.qpa.menus")
Q_LOGGING_CATEGORY(lcQpaTablet, "qt.qpa.input.tablet")
Q_LOGGING_CATEGORY(lcQpaAccessibility, "qt.qpa.accessibility")
+Q_LOGGING_CATEGORY(lcQpaUiAutomation, "qt.qpa.uiautomation")
Q_LOGGING_CATEGORY(lcQpaTrayIcon, "qt.qpa.trayicon")
int QWindowsContext::verbose = 0;
@@ -193,26 +194,14 @@ void QWindowsUser32DLL::init()
getDisplayAutoRotationPreferences = (GetDisplayAutoRotationPreferences)library.resolve("GetDisplayAutoRotationPreferences");
setDisplayAutoRotationPreferences = (SetDisplayAutoRotationPreferences)library.resolve("SetDisplayAutoRotationPreferences");
- if (QSysInfo::windowsVersion() >= QSysInfo::WV_WINDOWS10) { // Appears in 10.0.14393, October 2016
+ if (QOperatingSystemVersion::current()
+ >= QOperatingSystemVersion(QOperatingSystemVersion::Windows, 10, 0, 14393)) {
enableNonClientDpiScaling = (EnableNonClientDpiScaling)library.resolve("EnableNonClientDpiScaling");
getWindowDpiAwarenessContext = (GetWindowDpiAwarenessContext)library.resolve("GetWindowDpiAwarenessContext");
getAwarenessFromDpiAwarenessContext = (GetAwarenessFromDpiAwarenessContext)library.resolve("GetAwarenessFromDpiAwarenessContext");
}
}
-bool QWindowsUser32DLL::initTouch()
-{
- if (!isTouchWindow && QSysInfo::windowsVersion() >= QSysInfo::WV_WINDOWS7) {
- QSystemLibrary library(QStringLiteral("user32"));
- isTouchWindow = (IsTouchWindow)(library.resolve("IsTouchWindow"));
- registerTouchWindow = (RegisterTouchWindow)(library.resolve("RegisterTouchWindow"));
- unregisterTouchWindow = (UnregisterTouchWindow)(library.resolve("UnregisterTouchWindow"));
- getTouchInputInfo = (GetTouchInputInfo)(library.resolve("GetTouchInputInfo"));
- closeTouchInputHandle = (CloseTouchInputHandle)(library.resolve("CloseTouchInputHandle"));
- }
- return isTouchWindow && registerTouchWindow && unregisterTouchWindow && getTouchInputInfo && closeTouchInputHandle;
-}
-
void QWindowsShcoreDLL::init()
{
if (QOperatingSystemVersion::current() < QOperatingSystemVersion::Windows8_1)
@@ -269,7 +258,7 @@ QWindowsContextPrivate::QWindowsContextPrivate()
QWindowsContext::user32dll.init();
QWindowsContext::shcoredll.init();
- if (m_mouseHandler.touchDevice() && QWindowsContext::user32dll.initTouch())
+ if (m_mouseHandler.touchDevice())
m_systemInfo |= QWindowsContext::SI_SupportsTouch;
m_displayContext = GetDC(0);
m_defaultDPI = GetDeviceCaps(m_displayContext, LOGPIXELSY);
@@ -327,11 +316,6 @@ bool QWindowsContext::initTouch(unsigned integrationOptions)
if (!touchDevice)
return false;
- if (!QWindowsContext::user32dll.initTouch()) {
- delete touchDevice;
- return false;
- }
-
if (!(integrationOptions & QWindowsIntegration::DontPassOsMouseEventsSynthesizedFromTouch))
touchDevice->setCapabilities(touchDevice->capabilities() | QTouchDevice::MouseEmulation);
@@ -454,7 +438,7 @@ QString QWindowsContext::registerWindowClass(const QWindow *w)
// QOpenGLWidget or QQuickWidget later on. That cannot be detected at this stage.
if (w->surfaceType() == QSurface::OpenGLSurface || (flags & Qt::MSWindowsOwnDC))
style |= CS_OWNDC;
- if (!(flags & Qt::NoDropShadowWindowHint) && (QSysInfo::WindowsVersion & QSysInfo::WV_NT_based)
+ if (!(flags & Qt::NoDropShadowWindowHint)
&& (type == Qt::Popup || w->property("_q_windowsDropShadow").toBool())) {
style |= CS_DROPSHADOW;
}
@@ -757,7 +741,7 @@ HWND QWindowsContext::createDummyWindow(const QString &classNameIn,
// present in the MSVCRT.DLL found on Windows XP (QTBUG-35617).
static inline QString errorMessageFromComError(const _com_error &comError)
{
- TCHAR *message = Q_NULLPTR;
+ TCHAR *message = nullptr;
FormatMessage(FORMAT_MESSAGE_ALLOCATE_BUFFER | FORMAT_MESSAGE_FROM_SYSTEM,
NULL, DWORD(comError.Error()), MAKELANGID(LANG_NEUTRAL,SUBLANG_DEFAULT),
message, 0, NULL);
@@ -872,7 +856,7 @@ static inline bool resizeOnDpiChanged(const QWindow *w)
static bool shouldHaveNonClientDpiScaling(const QWindow *window)
{
- return QSysInfo::windowsVersion() >= QSysInfo::WV_WINDOWS10
+ return QOperatingSystemVersion::current() >= QOperatingSystemVersion::Windows10
&& window->isTopLevel()
&& !window->property(QWindowsWindow::embeddedNativeParentHandleProperty).isValid()
#if QT_CONFIG(opengl) // /QTBUG-62901, EnableNonClientDpiScaling has problems with GL
@@ -974,7 +958,7 @@ bool QWindowsContext::windowsProc(HWND hwnd, UINT message,
return false;
case QtWindows::AccessibleObjectFromWindowRequest:
#ifndef QT_NO_ACCESSIBILITY
- return QWindowsAccessibility::handleAccessibleObjectFromWindowRequest(hwnd, wParam, lParam, result);
+ return QWindowsUiaAccessibility::handleWmGetObject(hwnd, wParam, lParam, result);
#else
return false;
#endif
diff --git a/src/plugins/platforms/windows/qwindowscontext.h b/src/plugins/platforms/windows/qwindowscontext.h
index 5c39b6068b..f2ec307be2 100644
--- a/src/plugins/platforms/windows/qwindowscontext.h
+++ b/src/plugins/platforms/windows/qwindowscontext.h
@@ -66,6 +66,7 @@ Q_DECLARE_LOGGING_CATEGORY(lcQpaDialogs)
Q_DECLARE_LOGGING_CATEGORY(lcQpaMenus)
Q_DECLARE_LOGGING_CATEGORY(lcQpaTablet)
Q_DECLARE_LOGGING_CATEGORY(lcQpaAccessibility)
+Q_DECLARE_LOGGING_CATEGORY(lcQpaUiAutomation)
Q_DECLARE_LOGGING_CATEGORY(lcQpaTrayIcon)
class QWindow;
@@ -84,13 +85,7 @@ class QTouchDevice;
struct QWindowsUser32DLL
{
inline void init();
- inline bool initTouch();
- typedef BOOL (WINAPI *IsTouchWindow)(HWND, PULONG); // Windows 7
- typedef BOOL (WINAPI *RegisterTouchWindow)(HWND, ULONG);
- typedef BOOL (WINAPI *UnregisterTouchWindow)(HWND);
- typedef BOOL (WINAPI *GetTouchInputInfo)(HANDLE, UINT, PVOID, int);
- typedef BOOL (WINAPI *CloseTouchInputHandle)(HANDLE);
typedef BOOL (WINAPI *SetProcessDPIAware)();
typedef BOOL (WINAPI *AddClipboardFormatListener)(HWND);
typedef BOOL (WINAPI *RemoveClipboardFormatListener)(HWND);
@@ -100,13 +95,6 @@ struct QWindowsUser32DLL
typedef int (WINAPI *GetWindowDpiAwarenessContext)(HWND);
typedef int (WINAPI *GetAwarenessFromDpiAwarenessContext)(int);
- // Touch functions from Windows 7 onwards (also for use with Q_CC_MSVC).
- IsTouchWindow isTouchWindow = nullptr;
- RegisterTouchWindow registerTouchWindow = nullptr;
- UnregisterTouchWindow unregisterTouchWindow = nullptr;
- GetTouchInputInfo getTouchInputInfo = nullptr;
- CloseTouchInputHandle closeTouchInputHandle = nullptr;
-
// Windows Vista onwards
SetProcessDPIAware setProcessDPIAware = nullptr;
diff --git a/src/plugins/platforms/windows/qwindowscursor.cpp b/src/plugins/platforms/windows/qwindowscursor.cpp
index 1da7de7451..e1a5837201 100644
--- a/src/plugins/platforms/windows/qwindowscursor.cpp
+++ b/src/plugins/platforms/windows/qwindowscursor.cpp
@@ -184,7 +184,7 @@ static HCURSOR createBitmapCursor(const QCursor &cursor, qreal scaleFactor = 1)
return createBitmapCursor(bbits, mbits, cursor.hotSpot(), invb, invm);
}
-static QSize systemCursorSize(const QPlatformScreen *screen = Q_NULLPTR)
+static QSize systemCursorSize(const QPlatformScreen *screen = nullptr)
{
const QSize primaryScreenCursorSize(GetSystemMetrics(SM_CXCURSOR), GetSystemMetrics(SM_CYCURSOR));
if (screen) {
diff --git a/src/plugins/platforms/windows/qwindowscursor.h b/src/plugins/platforms/windows/qwindowscursor.h
index 28c7e88a6e..4772f3fce5 100644
--- a/src/plugins/platforms/windows/qwindowscursor.h
+++ b/src/plugins/platforms/windows/qwindowscursor.h
@@ -70,7 +70,7 @@ class CursorHandle
{
Q_DISABLE_COPY(CursorHandle)
public:
- explicit CursorHandle(HCURSOR hcursor = Q_NULLPTR) : m_hcursor(hcursor) {}
+ explicit CursorHandle(HCURSOR hcursor = nullptr) : m_hcursor(hcursor) {}
~CursorHandle()
{
if (m_hcursor)
@@ -113,9 +113,9 @@ public:
static HCURSOR createPixmapCursor(QPixmap pixmap, const QPoint &hotSpot, qreal scaleFactor = 1);
static HCURSOR createPixmapCursor(const PixmapCursor &pc, qreal scaleFactor = 1) { return createPixmapCursor(pc.pixmap, pc.hotSpot, scaleFactor); }
- static PixmapCursor customCursor(Qt::CursorShape cursorShape, const QPlatformScreen *screen = Q_NULLPTR);
+ static PixmapCursor customCursor(Qt::CursorShape cursorShape, const QPlatformScreen *screen = nullptr);
- static HCURSOR createCursorFromShape(Qt::CursorShape cursorShape, const QPlatformScreen *screen = Q_NULLPTR);
+ static HCURSOR createCursorFromShape(Qt::CursorShape cursorShape, const QPlatformScreen *screen = nullptr);
static QPoint mousePosition();
static CursorState cursorState();
diff --git a/src/plugins/platforms/windows/qwindowsdialoghelpers.cpp b/src/plugins/platforms/windows/qwindowsdialoghelpers.cpp
index e713debf5b..1efb01d52e 100644
--- a/src/plugins/platforms/windows/qwindowsdialoghelpers.cpp
+++ b/src/plugins/platforms/windows/qwindowsdialoghelpers.cpp
@@ -601,8 +601,8 @@ QString QWindowsShellItem::path() const
{
if (isFileSystem())
return QDir::cleanPath(QWindowsShellItem::displayName(m_item, SIGDN_FILESYSPATH));
- // Check for a "Library" item (Windows 7)
- if (QSysInfo::windowsVersion() >= QSysInfo::WV_WINDOWS7 && isDir())
+ // Check for a "Library" item
+ if (isDir())
return QWindowsShellItem::libraryItemDefaultSaveFolder(m_item);
return QString();
}
@@ -713,7 +713,7 @@ QString QWindowsShellItem::libraryItemDefaultSaveFolder(IShellItem *item)
{
QString result;
if (IShellLibrary *library = sHLoadLibraryFromItem(item, STGM_READ | STGM_SHARE_DENY_WRITE)) {
- IShellItem *item = Q_NULLPTR;
+ IShellItem *item = nullptr;
if (SUCCEEDED(library->GetDefaultSaveFolder(DSFT_DETECT, IID_IShellItem, reinterpret_cast<void **>(&item)))) {
result = QDir::cleanPath(QWindowsShellItem::displayName(item, SIGDN_FILESYSPATH));
item->Release();
@@ -895,7 +895,7 @@ void QWindowsNativeFileDialogBase::setWindowTitle(const QString &title)
IShellItem *QWindowsNativeFileDialogBase::shellItem(const QUrl &url)
{
if (url.isLocalFile()) {
- IShellItem *result = Q_NULLPTR;
+ IShellItem *result = nullptr;
const QString native = QDir::toNativeSeparators(url.toLocalFile());
const HRESULT hr =
SHCreateItemFromParsingName(reinterpret_cast<const wchar_t *>(native.utf16()),
@@ -903,30 +903,30 @@ IShellItem *QWindowsNativeFileDialogBase::shellItem(const QUrl &url)
reinterpret_cast<void **>(&result));
if (FAILED(hr)) {
qErrnoWarning("%s: SHCreateItemFromParsingName(%s)) failed", __FUNCTION__, qPrintable(url.toString()));
- return Q_NULLPTR;
+ return nullptr;
}
return result;
} else if (url.scheme() == QLatin1String("clsid")) {
// Support for virtual folders via GUID
// (see https://msdn.microsoft.com/en-us/library/windows/desktop/dd378457(v=vs.85).aspx)
// specified as "clsid:<GUID>" (without '{', '}').
- IShellItem *result = Q_NULLPTR;
+ IShellItem *result = nullptr;
const auto uuid = QUuid::fromString(url.path());
if (uuid.isNull()) {
qWarning() << __FUNCTION__ << ": Invalid CLSID: " << url.path();
- return Q_NULLPTR;
+ return nullptr;
}
PIDLIST_ABSOLUTE idList;
HRESULT hr = SHGetKnownFolderIDList(uuid, 0, 0, &idList);
if (FAILED(hr)) {
qErrnoWarning("%s: SHGetKnownFolderIDList(%s)) failed", __FUNCTION__, qPrintable(url.toString()));
- return Q_NULLPTR;
+ return nullptr;
}
hr = SHCreateItemFromIDList(idList, IID_IShellItem, reinterpret_cast<void **>(&result));
CoTaskMemFree(idList);
if (FAILED(hr)) {
qErrnoWarning("%s: SHCreateItemFromIDList(%s)) failed", __FUNCTION__, qPrintable(url.toString()));
- return Q_NULLPTR;
+ return nullptr;
}
return result;
} else {
@@ -2047,7 +2047,7 @@ bool useHelper(QPlatformTheme::DialogType type)
return false;
switch (type) {
case QPlatformTheme::FileDialog:
- return QSysInfo::windowsVersion() >= QSysInfo::WV_XP;
+ return true;
case QPlatformTheme::ColorDialog:
#ifdef USE_NATIVE_COLOR_DIALOG
return true;
@@ -2068,13 +2068,10 @@ QPlatformDialogHelper *createHelper(QPlatformTheme::DialogType type)
if (QWindowsIntegration::instance()->options() & QWindowsIntegration::NoNativeDialogs)
return 0;
switch (type) {
- case QPlatformTheme::FileDialog: // Note: "Windows XP Professional x64 Edition has version number WV_5_2 (WV_2003).
- if (QWindowsIntegration::instance()->options() & QWindowsIntegration::XpNativeDialogs
- || QSysInfo::windowsVersion() <= QSysInfo::WV_2003) {
+ case QPlatformTheme::FileDialog:
+ if (QWindowsIntegration::instance()->options() & QWindowsIntegration::XpNativeDialogs)
return new QWindowsXpFileDialogHelper();
- }
- if (QSysInfo::windowsVersion() > QSysInfo::WV_2003)
- return new QWindowsFileDialogHelper();
+ return new QWindowsFileDialogHelper;
case QPlatformTheme::ColorDialog:
#ifdef USE_NATIVE_COLOR_DIALOG
return new QWindowsColorDialogHelper();
diff --git a/src/plugins/platforms/windows/qwindowseglcontext.h b/src/plugins/platforms/windows/qwindowseglcontext.h
index 47878a7169..3e5f2c81d5 100644
--- a/src/plugins/platforms/windows/qwindowseglcontext.h
+++ b/src/plugins/platforms/windows/qwindowseglcontext.h
@@ -95,7 +95,7 @@ struct QWindowsLibGLESv2
#if !defined(QT_STATIC) || defined(QT_OPENGL_DYNAMIC)
void *moduleHandle() const { return m_lib; }
#else
- void *moduleHandle() const { return Q_NULLPTR; }
+ void *moduleHandle() const { return nullptr; }
#endif
const GLubyte * (APIENTRY * glGetString)(GLenum name);
diff --git a/src/plugins/platforms/windows/qwindowsglcontext.cpp b/src/plugins/platforms/windows/qwindowsglcontext.cpp
index 78368d87de..4bdf3167e4 100644
--- a/src/plugins/platforms/windows/qwindowsglcontext.cpp
+++ b/src/plugins/platforms/windows/qwindowsglcontext.cpp
@@ -379,9 +379,7 @@ static PIXELFORMATDESCRIPTOR
initPixelFormatDescriptor(&pfd);
pfd.iPixelType = PFD_TYPE_RGBA;
pfd.iLayerType = PFD_MAIN_PLANE;
- pfd.dwFlags = PFD_SUPPORT_OPENGL;
- if (QSysInfo::windowsVersion() >= QSysInfo::WV_VISTA)
- pfd.dwFlags = PFD_SUPPORT_COMPOSITION;
+ pfd.dwFlags = PFD_SUPPORT_OPENGL | PFD_SUPPORT_COMPOSITION;
const bool isPixmap = (additional.formatFlags & QWindowsGLRenderToPixmap) != 0;
pfd.dwFlags |= isPixmap ? PFD_DRAW_TO_BITMAP : PFD_DRAW_TO_WINDOW;
if (!(additional.formatFlags & QWindowsGLDirectRendering))
diff --git a/src/plugins/platforms/windows/qwindowsinputcontext.cpp b/src/plugins/platforms/windows/qwindowsinputcontext.cpp
index 8c228f588e..b9dd2c557e 100644
--- a/src/plugins/platforms/windows/qwindowsinputcontext.cpp
+++ b/src/plugins/platforms/windows/qwindowsinputcontext.cpp
@@ -221,6 +221,28 @@ void QWindowsInputContext::setFocusObject(QObject *)
updateEnabled();
}
+HWND QWindowsInputContext::getVirtualKeyboardWindowHandle() const
+{
+ return ::FindWindowA("IPTip_Main_Window", nullptr);
+}
+
+QRectF QWindowsInputContext::keyboardRect() const
+{
+ if (HWND hwnd = getVirtualKeyboardWindowHandle()) {
+ RECT rect;
+ if (::GetWindowRect(hwnd, &rect)) {
+ return QRectF(rect.left, rect.top, rect.right - rect.left, rect.bottom - rect.top);
+ }
+ }
+ return QRectF();
+}
+
+bool QWindowsInputContext::isInputPanelVisible() const
+{
+ HWND hwnd = getVirtualKeyboardWindowHandle();
+ return hwnd && ::IsWindowEnabled(hwnd) && ::IsWindowVisible(hwnd);
+}
+
void QWindowsInputContext::updateEnabled()
{
if (!QGuiApplication::focusObject())
diff --git a/src/plugins/platforms/windows/qwindowsinputcontext.h b/src/plugins/platforms/windows/qwindowsinputcontext.h
index 617ef30cef..ada1fc0d29 100644
--- a/src/plugins/platforms/windows/qwindowsinputcontext.h
+++ b/src/plugins/platforms/windows/qwindowsinputcontext.h
@@ -79,6 +79,9 @@ public:
void invokeAction(QInputMethod::Action, int cursorPosition) override;
void setFocusObject(QObject *object) override;
+ QRectF keyboardRect() const override;
+ bool isInputPanelVisible() const override;
+
bool startComposition(HWND hwnd);
bool composition(HWND hwnd, LPARAM lParam);
bool endComposition(HWND hwnd);
@@ -98,6 +101,7 @@ private:
void startContextComposition();
void endContextComposition();
void updateEnabled();
+ HWND getVirtualKeyboardWindowHandle() const;
const DWORD m_WM_MSIME_MOUSE;
static HIMC m_defaultContext;
diff --git a/src/plugins/platforms/windows/qwindowsintegration.cpp b/src/plugins/platforms/windows/qwindowsintegration.cpp
index f9bac3920b..287b65cd5d 100644
--- a/src/plugins/platforms/windows/qwindowsintegration.cpp
+++ b/src/plugins/platforms/windows/qwindowsintegration.cpp
@@ -60,7 +60,7 @@
#include "qwindowsinputcontext.h"
#include "qwindowskeymapper.h"
#ifndef QT_NO_ACCESSIBILITY
-# include "accessible/qwindowsaccessibility.h"
+# include "uiautomation/qwindowsuiaaccessibility.h"
#endif
#include <qpa/qplatformnativeinterface.h>
@@ -151,7 +151,7 @@ struct QWindowsIntegrationPrivate
#endif // QT_NO_OPENGL
QScopedPointer<QPlatformInputContext> m_inputContext;
#ifndef QT_NO_ACCESSIBILITY
- QWindowsAccessibility m_accessibility;
+ QWindowsUiaAccessibility m_accessibility;
#endif
QWindowsServices m_services;
};
@@ -252,7 +252,7 @@ QWindowsIntegrationPrivate::~QWindowsIntegrationPrivate()
delete m_fontDatabase;
}
-QWindowsIntegration *QWindowsIntegration::m_instance = Q_NULLPTR;
+QWindowsIntegration *QWindowsIntegration::m_instance = nullptr;
QWindowsIntegration::QWindowsIntegration(const QStringList &paramList) :
d(new QWindowsIntegrationPrivate(paramList))
@@ -266,7 +266,7 @@ QWindowsIntegration::QWindowsIntegration(const QStringList &paramList) :
QWindowsIntegration::~QWindowsIntegration()
{
- m_instance = Q_NULLPTR;
+ m_instance = nullptr;
}
void QWindowsIntegration::initialize()
@@ -336,7 +336,7 @@ QPlatformWindow *QWindowsIntegration::createPlatformWindow(QWindow *window) cons
<< " handle=" << obtained.hwnd << ' ' << obtained.flags << '\n';
if (Q_UNLIKELY(!obtained.hwnd))
- return Q_NULLPTR;
+ return nullptr;
QWindowsWindow *result = createPlatformWindowHelper(window, obtained);
Q_ASSERT(result);
@@ -356,7 +356,7 @@ QPlatformWindow *QWindowsIntegration::createForeignWindow(QWindow *window, WId n
}
QWindowsForeignWindow *result = new QWindowsForeignWindow(window, hwnd);
const QRect obtainedGeometry = result->geometry();
- QScreen *screen = Q_NULLPTR;
+ QScreen *screen = nullptr;
if (const QPlatformScreen *pScreen = result->screenForGeometry(obtainedGeometry))
screen = pScreen->screen();
if (screen && screen != window->screen())
@@ -402,7 +402,7 @@ QWindowsStaticOpenGLContext *QWindowsStaticOpenGLContext::doCreate()
qCWarning(lcQpaGl, "Software OpenGL failed. Falling back to system OpenGL.");
if (QWindowsOpenGLTester::supportedRenderers() & QWindowsOpenGLTester::DesktopGl)
return QOpenGLStaticContext::create();
- return Q_NULLPTR;
+ return nullptr;
default:
break;
}
diff --git a/src/plugins/platforms/windows/qwindowsmousehandler.cpp b/src/plugins/platforms/windows/qwindowsmousehandler.cpp
index 9544fb81f7..814291c54a 100644
--- a/src/plugins/platforms/windows/qwindowsmousehandler.cpp
+++ b/src/plugins/platforms/windows/qwindowsmousehandler.cpp
@@ -56,37 +56,6 @@
#include <windowsx.h>
-/* Touch is supported from Windows 7 onwards and data structures
- * are present in the Windows SDK's, but not in older MSVC Express
- * versions. */
-
-#if !defined(TOUCHEVENTF_MOVE)
-
-typedef struct tagTOUCHINPUT {
- LONG x;
- LONG y;
- HANDLE hSource;
- DWORD dwID;
- DWORD dwFlags;
- DWORD dwMask;
- DWORD dwTime;
- ULONG_PTR dwExtraInfo;
- DWORD cxContact;
- DWORD cyContact;
-} TOUCHINPUT, *PTOUCHINPUT;
-typedef TOUCHINPUT const * PCTOUCHINPUT;
-
-# define TOUCHEVENTF_MOVE 0x0001
-# define TOUCHEVENTF_DOWN 0x0002
-# define TOUCHEVENTF_UP 0x0004
-# define TOUCHEVENTF_INRANGE 0x0008
-# define TOUCHEVENTF_PRIMARY 0x0010
-# define TOUCHEVENTF_NOCOALESCE 0x0020
-# define TOUCHEVENTF_PALM 0x0080
-# define TOUCHINPUTMASKF_CONTACTAREA 0x0004
-# define TOUCHINPUTMASKF_EXTRAINFO 0x0002
-#endif // if !defined(TOUCHEVENTF_MOVE)
-
QT_BEGIN_NAMESPACE
static inline void compressMouseMove(MSG *msg)
@@ -154,8 +123,6 @@ static inline QTouchDevice *createTouchDevice()
QT_NID_INTEGRATED_TOUCH = 0x1, QT_NID_EXTERNAL_TOUCH = 0x02,
QT_NID_MULTI_INPUT = 0x40, QT_NID_READY = 0x80 };
- if (QSysInfo::windowsVersion() < QSysInfo::WV_WINDOWS7)
- return 0;
const int digitizers = GetSystemMetrics(QT_SM_DIGITIZER);
if (!(digitizers & (QT_NID_INTEGRATED_TOUCH | QT_NID_EXTERNAL_TOUCH)))
return 0;
@@ -523,9 +490,8 @@ bool QWindowsMouseHandler::translateTouchEvent(QWindow *window, HWND,
touchPoints.reserve(winTouchPointCount);
Qt::TouchPointStates allStates = 0;
- QWindowsContext::user32dll.getTouchInputInfo(reinterpret_cast<HANDLE>(msg.lParam),
- UINT(msg.wParam),
- winTouchInputs.data(), sizeof(TOUCHINPUT));
+ GetTouchInputInfo(reinterpret_cast<HTOUCHINPUT>(msg.lParam),
+ UINT(msg.wParam), winTouchInputs.data(), sizeof(TOUCHINPUT));
for (int i = 0; i < winTouchPointCount; ++i) {
const TOUCHINPUT &winTouchInput = winTouchInputs[i];
int id = m_touchInputIDToTouchPointID.value(winTouchInput.dwID, -1);
@@ -566,7 +532,7 @@ bool QWindowsMouseHandler::translateTouchEvent(QWindow *window, HWND,
touchPoints.append(touchPoint);
}
- QWindowsContext::user32dll.closeTouchInputHandle(reinterpret_cast<HANDLE>(msg.lParam));
+ CloseTouchInputHandle(reinterpret_cast<HTOUCHINPUT>(msg.lParam));
// all touch points released, forget the ids we've seen, they may not be reused
if (allStates == Qt::TouchPointReleased)
diff --git a/src/plugins/platforms/windows/qwindowsnativeinterface.cpp b/src/plugins/platforms/windows/qwindowsnativeinterface.cpp
index dc8e97c886..324b00144e 100644
--- a/src/plugins/platforms/windows/qwindowsnativeinterface.cpp
+++ b/src/plugins/platforms/windows/qwindowsnativeinterface.cpp
@@ -134,7 +134,7 @@ void *QWindowsNativeInterface::nativeResourceForCursor(const QByteArray &resourc
return static_cast<const QWindowsCursor *>(pCursor)->hCursor(cursor);
}
}
- return Q_NULLPTR;
+ return nullptr;
}
#endif // !QT_NO_CURSOR
@@ -280,7 +280,7 @@ QFunctionPointer QWindowsNativeInterface::platformFunction(const QByteArray &fun
return QFunctionPointer(QWindowsWindow::setHasBorderInFullScreenStatic);
else if (function == QWindowsWindowFunctions::isTabletModeIdentifier())
return QFunctionPointer(QWindowsNativeInterface::isTabletMode);
- return Q_NULLPTR;
+ return nullptr;
}
QVariant QWindowsNativeInterface::gpu() const
diff --git a/src/plugins/platforms/windows/qwindowsscreen.cpp b/src/plugins/platforms/windows/qwindowsscreen.cpp
index cfddb3cc71..c0781df973 100644
--- a/src/plugins/platforms/windows/qwindowsscreen.cpp
+++ b/src/plugins/platforms/windows/qwindowsscreen.cpp
@@ -563,7 +563,7 @@ const QWindowsScreen *QWindowsScreenManager::screenAtDp(const QPoint &p) const
if (scr->geometry().contains(p))
return scr;
}
- return Q_NULLPTR;
+ return nullptr;
}
const QWindowsScreen *QWindowsScreenManager::screenForHwnd(HWND hwnd) const
diff --git a/src/plugins/platforms/windows/qwindowswindow.cpp b/src/plugins/platforms/windows/qwindowswindow.cpp
index 1d81fa9cd5..854c19ccf8 100644
--- a/src/plugins/platforms/windows/qwindowswindow.cpp
+++ b/src/plugins/platforms/windows/qwindowswindow.cpp
@@ -37,6 +37,13 @@
**
****************************************************************************/
+#if defined(WINVER) && WINVER < 0x0601
+# undef WINVER
+#endif
+#if !defined(WINVER)
+# define WINVER 0x0601 // Enable touch functions for MinGW
+#endif
+
#include "qwindowswindow.h"
#include "qwindowscontext.h"
#if QT_CONFIG(draganddrop)
@@ -858,7 +865,7 @@ QWindowsBaseWindow *QWindowsBaseWindow::baseWindowOf(const QWindow *w)
if (QPlatformWindow *pw = w->handle())
return static_cast<QWindowsBaseWindow *>(pw);
}
- return Q_NULLPTR;
+ return nullptr;
}
HWND QWindowsBaseWindow::handleOf(const QWindow *w)
@@ -1113,7 +1120,7 @@ QWindowsWindow::~QWindowsWindow()
{
setFlag(WithinDestroy);
if (testFlag(TouchRegistered))
- QWindowsContext::user32dll.unregisterTouchWindow(m_data.hwnd);
+ UnregisterTouchWindow(m_data.hwnd);
destroyWindow();
destroyIcon();
}
@@ -2064,9 +2071,17 @@ void QWindowsWindow::propagateSizeHints()
bool QWindowsWindow::handleGeometryChangingMessage(MSG *message, const QWindow *qWindow, const QMargins &margins)
{
+ WINDOWPOS *windowPos = reinterpret_cast<WINDOWPOS *>(message->lParam);
+ if ((windowPos->flags & SWP_NOZORDER) == 0) {
+ if (QWindowsWindow *platformWindow = QWindowsWindow::windowsWindowOf(qWindow)) {
+ QWindow *parentWindow = qWindow->parent();
+ HWND parentHWND = GetAncestor(windowPos->hwnd, GA_PARENT);
+ HWND desktopHWND = GetDesktopWindow();
+ platformWindow->m_data.embedded = !parentWindow && parentHWND && (parentHWND != desktopHWND);
+ }
+ }
if (!qWindow->isTopLevel()) // Implement hasHeightForWidth().
return false;
- WINDOWPOS *windowPos = reinterpret_cast<WINDOWPOS *>(message->lParam);
if ((windowPos->flags & (SWP_NOCOPYBITS | SWP_NOSIZE)))
return false;
const QRect suggestedFrameGeometry(windowPos->x, windowPos->y,
@@ -2600,12 +2615,12 @@ void QWindowsWindow::registerTouchWindow(QWindowsWindowFunctions::TouchWindowTou
if ((QWindowsContext::instance()->systemInfo() & QWindowsContext::SI_SupportsTouch)
&& !testFlag(TouchRegistered)) {
ULONG touchFlags = 0;
- const bool ret = QWindowsContext::user32dll.isTouchWindow(m_data.hwnd, &touchFlags);
+ const bool ret = IsTouchWindow(m_data.hwnd, &touchFlags);
// Return if it is not a touch window or the flags are already set by a hook
// such as HCBT_CREATEWND
if (ret || touchFlags != 0)
return;
- if (QWindowsContext::user32dll.registerTouchWindow(m_data.hwnd, ULONG(touchTypes)))
+ if (RegisterTouchWindow(m_data.hwnd, ULONG(touchTypes)))
setFlag(TouchRegistered);
else
qErrnoWarning("RegisterTouchWindow() failed for window '%s'.", qPrintable(window()->objectName()));
diff --git a/src/plugins/platforms/windows/uiautomation/qwindowsuiaaccessibility.cpp b/src/plugins/platforms/windows/uiautomation/qwindowsuiaaccessibility.cpp
new file mode 100644
index 0000000000..907883bf5b
--- /dev/null
+++ b/src/plugins/platforms/windows/uiautomation/qwindowsuiaaccessibility.cpp
@@ -0,0 +1,140 @@
+/****************************************************************************
+**
+** Copyright (C) 2017 The Qt Company Ltd.
+** Contact: https://www.qt.io/licensing/
+**
+** This file is part of the plugins of the Qt Toolkit.
+**
+** $QT_BEGIN_LICENSE:LGPL$
+** Commercial License Usage
+** Licensees holding valid commercial Qt licenses may use this file in
+** accordance with the commercial license agreement provided with the
+** Software or, alternatively, in accordance with the terms contained in
+** a written agreement between you and The Qt Company. For licensing terms
+** and conditions see https://www.qt.io/terms-conditions. For further
+** information use the contact form at https://www.qt.io/contact-us.
+**
+** GNU Lesser General Public License Usage
+** Alternatively, this file may be used under the terms of the GNU Lesser
+** General Public License version 3 as published by the Free Software
+** Foundation and appearing in the file LICENSE.LGPL3 included in the
+** packaging of this file. Please review the following information to
+** ensure the GNU Lesser General Public License version 3 requirements
+** will be met: https://www.gnu.org/licenses/lgpl-3.0.html.
+**
+** GNU General Public License Usage
+** Alternatively, this file may be used under the terms of the GNU
+** General Public License version 2.0 or (at your option) the GNU General
+** Public license version 3 or any later version approved by the KDE Free
+** Qt Foundation. The licenses are as published by the Free Software
+** Foundation and appearing in the file LICENSE.GPL2 and LICENSE.GPL3
+** included in the packaging of this file. Please review the following
+** information to ensure the GNU General Public License requirements will
+** be met: https://www.gnu.org/licenses/gpl-2.0.html and
+** https://www.gnu.org/licenses/gpl-3.0.html.
+**
+** $QT_END_LICENSE$
+**
+****************************************************************************/
+
+#include <QtCore/QtConfig>
+#ifndef QT_NO_ACCESSIBILITY
+
+#include "qwindowsuiaaccessibility.h"
+#include "qwindowsuiamainprovider.h"
+#include "qwindowsuiautils.h"
+
+#include <QtGui/QAccessible>
+#include <QtGui/QWindow>
+#include <QtGui/QGuiApplication>
+#include <QtGui/private/qguiapplication_p.h>
+#include <QtCore/qt_windows.h>
+#include <qpa/qplatformintegration.h>
+#include <QtWindowsUIAutomationSupport/private/qwindowsuiawrapper_p.h>
+
+QT_BEGIN_NAMESPACE
+
+using namespace QWindowsUiAutomation;
+
+
+QWindowsUiaAccessibility::QWindowsUiaAccessibility()
+{
+}
+
+QWindowsUiaAccessibility::~QWindowsUiaAccessibility()
+{
+}
+
+// Handles UI Automation window messages.
+bool QWindowsUiaAccessibility::handleWmGetObject(HWND hwnd, WPARAM wParam, LPARAM lParam, LRESULT *lResult)
+{
+ if (lParam == LPARAM(UiaRootObjectId)) {
+
+ // Start handling accessibility internally
+ QGuiApplicationPrivate::platformIntegration()->accessibility()->setActive(true);
+
+ // Ignoring all requests while starting up / shutting down
+ if (QCoreApplication::startingUp() || QCoreApplication::closingDown())
+ return false;
+
+ if (QWindow *window = QWindowsContext::instance()->findWindow(hwnd)) {
+ if (QAccessibleInterface *accessible = window->accessibleRoot()) {
+ QWindowsUiaMainProvider *provider = QWindowsUiaMainProvider::providerForAccessible(accessible);
+ *lResult = QWindowsUiaWrapper::instance()->returnRawElementProvider(hwnd, wParam, lParam, provider);
+ return true;
+ }
+ }
+ }
+ return false;
+}
+
+// Handles accessibility update notifications.
+void QWindowsUiaAccessibility::notifyAccessibilityUpdate(QAccessibleEvent *event)
+{
+ if (!event)
+ return;
+
+ QAccessibleInterface *accessible = event->accessibleInterface();
+ if (!isActive() || !accessible || !accessible->isValid())
+ return;
+
+ // Ensures QWindowsUiaWrapper is properly initialized.
+ if (!QWindowsUiaWrapper::instance()->ready())
+ return;
+
+ // No need to do anything when nobody is listening.
+ if (!QWindowsUiaWrapper::instance()->clientsAreListening())
+ return;
+
+ switch (event->type()) {
+
+ case QAccessible::Focus:
+ QWindowsUiaMainProvider::notifyFocusChange(event);
+ break;
+
+ case QAccessible::StateChanged:
+ QWindowsUiaMainProvider::notifyStateChange(static_cast<QAccessibleStateChangeEvent *>(event));
+ break;
+
+ case QAccessible::ValueChanged:
+ QWindowsUiaMainProvider::notifyValueChange(static_cast<QAccessibleValueChangeEvent *>(event));
+ break;
+
+ case QAccessible::TextAttributeChanged:
+ case QAccessible::TextColumnChanged:
+ case QAccessible::TextInserted:
+ case QAccessible::TextRemoved:
+ case QAccessible::TextUpdated:
+ case QAccessible::TextSelectionChanged:
+ case QAccessible::TextCaretMoved:
+ QWindowsUiaMainProvider::notifyTextChange(event);
+ break;
+
+ default:
+ break;
+ }
+}
+
+QT_END_NAMESPACE
+
+#endif // QT_NO_ACCESSIBILITY
diff --git a/src/plugins/platforms/windows/accessible/qwindowsaccessibility.h b/src/plugins/platforms/windows/uiautomation/qwindowsuiaaccessibility.h
index 8621e93120..bbb81d596b 100644
--- a/src/plugins/platforms/windows/accessible/qwindowsaccessibility.h
+++ b/src/plugins/platforms/windows/uiautomation/qwindowsuiaaccessibility.h
@@ -1,6 +1,6 @@
/****************************************************************************
**
-** Copyright (C) 2016 The Qt Company Ltd.
+** Copyright (C) 2017 The Qt Company Ltd.
** Contact: https://www.qt.io/licensing/
**
** This file is part of the plugins of the Qt Toolkit.
@@ -37,27 +37,29 @@
**
****************************************************************************/
-#ifndef QWINDOWSACCESSIBILITY_H
-#define QWINDOWSACCESSIBILITY_H
+#ifndef QWINDOWSUIAACCESSIBILITY_H
+#define QWINDOWSUIAACCESSIBILITY_H
-#include "../qtwindowsglobal.h"
-#include "../qwindowscontext.h"
-#include <qpa/qplatformaccessibility.h>
+#include <QtCore/QtConfig>
+#ifndef QT_NO_ACCESSIBILITY
-#include <oleacc.h>
+#include "qwindowscontext.h"
+#include <qpa/qplatformaccessibility.h>
QT_BEGIN_NAMESPACE
-class QWindowsAccessibility : public QPlatformAccessibility
+// Windows plataform accessibility implemented over UI Automation.
+class QWindowsUiaAccessibility : public QPlatformAccessibility
{
public:
- QWindowsAccessibility();
- static bool handleAccessibleObjectFromWindowRequest(HWND hwnd, WPARAM wParam, LPARAM lParam, LRESULT *lResult);
+ explicit QWindowsUiaAccessibility();
+ virtual ~QWindowsUiaAccessibility();
+ static bool handleWmGetObject(HWND hwnd, WPARAM wParam, LPARAM lParam, LRESULT *lResult);
void notifyAccessibilityUpdate(QAccessibleEvent *event) override;
- static IAccessible *wrap(QAccessibleInterface *acc);
- static QWindow *windowHelper(const QAccessibleInterface *iface);
};
QT_END_NAMESPACE
-#endif // QWINDOWSACCESSIBILITY_H
+#endif // QT_NO_ACCESSIBILITY
+
+#endif // QWINDOWSUIAACCESSIBILITY_H
diff --git a/src/plugins/platforms/windows/uiautomation/qwindowsuiabaseprovider.cpp b/src/plugins/platforms/windows/uiautomation/qwindowsuiabaseprovider.cpp
new file mode 100644
index 0000000000..1e1fc49c0f
--- /dev/null
+++ b/src/plugins/platforms/windows/uiautomation/qwindowsuiabaseprovider.cpp
@@ -0,0 +1,81 @@
+/****************************************************************************
+**
+** Copyright (C) 2017 The Qt Company Ltd.
+** Contact: https://www.qt.io/licensing/
+**
+** This file is part of the plugins of the Qt Toolkit.
+**
+** $QT_BEGIN_LICENSE:LGPL$
+** Commercial License Usage
+** Licensees holding valid commercial Qt licenses may use this file in
+** accordance with the commercial license agreement provided with the
+** Software or, alternatively, in accordance with the terms contained in
+** a written agreement between you and The Qt Company. For licensing terms
+** and conditions see https://www.qt.io/terms-conditions. For further
+** information use the contact form at https://www.qt.io/contact-us.
+**
+** GNU Lesser General Public License Usage
+** Alternatively, this file may be used under the terms of the GNU Lesser
+** General Public License version 3 as published by the Free Software
+** Foundation and appearing in the file LICENSE.LGPL3 included in the
+** packaging of this file. Please review the following information to
+** ensure the GNU Lesser General Public License version 3 requirements
+** will be met: https://www.gnu.org/licenses/lgpl-3.0.html.
+**
+** GNU General Public License Usage
+** Alternatively, this file may be used under the terms of the GNU
+** General Public License version 2.0 or (at your option) the GNU General
+** Public license version 3 or any later version approved by the KDE Free
+** Qt Foundation. The licenses are as published by the Free Software
+** Foundation and appearing in the file LICENSE.GPL2 and LICENSE.GPL3
+** included in the packaging of this file. Please review the following
+** information to ensure the GNU General Public License requirements will
+** be met: https://www.gnu.org/licenses/gpl-2.0.html and
+** https://www.gnu.org/licenses/gpl-3.0.html.
+**
+** $QT_END_LICENSE$
+**
+****************************************************************************/
+
+#include <QtCore/QtConfig>
+#ifndef QT_NO_ACCESSIBILITY
+
+#include "qwindowsuiabaseprovider.h"
+#include "qwindowsuiautils.h"
+#include "qwindowscontext.h"
+
+#include <QtGui/QAccessible>
+#include <QtGui/QAccessibleInterface>
+#include <QtCore/QDebug>
+#include <QtCore/QString>
+
+QT_BEGIN_NAMESPACE
+
+using namespace QWindowsUiAutomation;
+
+
+QWindowsUiaBaseProvider::QWindowsUiaBaseProvider(QAccessible::Id id) :
+ m_id(id)
+{
+}
+
+QWindowsUiaBaseProvider::~QWindowsUiaBaseProvider()
+{
+}
+
+QAccessibleInterface *QWindowsUiaBaseProvider::accessibleInterface() const
+{
+ QAccessibleInterface *accessible = QAccessible::accessibleInterface(m_id);
+ if (accessible && accessible->isValid())
+ return accessible;
+ return nullptr;
+}
+
+QAccessible::Id QWindowsUiaBaseProvider::id() const
+{
+ return m_id;
+}
+
+QT_END_NAMESPACE
+
+#endif // QT_NO_ACCESSIBILITY
diff --git a/src/plugins/platforms/windows/uiautomation/qwindowsuiabaseprovider.h b/src/plugins/platforms/windows/uiautomation/qwindowsuiabaseprovider.h
new file mode 100644
index 0000000000..3ae403e8c5
--- /dev/null
+++ b/src/plugins/platforms/windows/uiautomation/qwindowsuiabaseprovider.h
@@ -0,0 +1,78 @@
+/****************************************************************************
+**
+** Copyright (C) 2017 The Qt Company Ltd.
+** Contact: https://www.qt.io/licensing/
+**
+** This file is part of the plugins of the Qt Toolkit.
+**
+** $QT_BEGIN_LICENSE:LGPL$
+** Commercial License Usage
+** Licensees holding valid commercial Qt licenses may use this file in
+** accordance with the commercial license agreement provided with the
+** Software or, alternatively, in accordance with the terms contained in
+** a written agreement between you and The Qt Company. For licensing terms
+** and conditions see https://www.qt.io/terms-conditions. For further
+** information use the contact form at https://www.qt.io/contact-us.
+**
+** GNU Lesser General Public License Usage
+** Alternatively, this file may be used under the terms of the GNU Lesser
+** General Public License version 3 as published by the Free Software
+** Foundation and appearing in the file LICENSE.LGPL3 included in the
+** packaging of this file. Please review the following information to
+** ensure the GNU Lesser General Public License version 3 requirements
+** will be met: https://www.gnu.org/licenses/lgpl-3.0.html.
+**
+** GNU General Public License Usage
+** Alternatively, this file may be used under the terms of the GNU
+** General Public License version 2.0 or (at your option) the GNU General
+** Public license version 3 or any later version approved by the KDE Free
+** Qt Foundation. The licenses are as published by the Free Software
+** Foundation and appearing in the file LICENSE.GPL2 and LICENSE.GPL3
+** included in the packaging of this file. Please review the following
+** information to ensure the GNU General Public License requirements will
+** be met: https://www.gnu.org/licenses/gpl-2.0.html and
+** https://www.gnu.org/licenses/gpl-3.0.html.
+**
+** $QT_END_LICENSE$
+**
+****************************************************************************/
+
+#ifndef QWINDOWSUIABASEPROVIDER_H
+#define QWINDOWSUIABASEPROVIDER_H
+
+#include <QtCore/QtConfig>
+#ifndef QT_NO_ACCESSIBILITY
+
+#include <QtGui/QAccessible>
+#include <QtGui/QAccessibleInterface>
+#include <QtCore/QPointer>
+
+#include <qwindowscombase.h>
+#include <QtWindowsUIAutomationSupport/private/qwindowsuiawrapper_p.h>
+
+QT_BEGIN_NAMESPACE
+
+class QAccessibleInterface;
+class QDebug;
+
+// Base class for UI Automation providers.
+class QWindowsUiaBaseProvider : public QObject
+{
+ Q_OBJECT
+ Q_DISABLE_COPY(QWindowsUiaBaseProvider)
+public:
+ explicit QWindowsUiaBaseProvider(QAccessible::Id id);
+ virtual ~QWindowsUiaBaseProvider();
+
+ QAccessibleInterface *accessibleInterface() const;
+ QAccessible::Id id() const;
+
+private:
+ QAccessible::Id m_id;
+};
+
+QT_END_NAMESPACE
+
+#endif // QT_NO_ACCESSIBILITY
+
+#endif // QWINDOWSUIABASEPROVIDER_H
diff --git a/src/plugins/platforms/windows/uiautomation/qwindowsuiagriditemprovider.cpp b/src/plugins/platforms/windows/uiautomation/qwindowsuiagriditemprovider.cpp
new file mode 100644
index 0000000000..e0502c00f3
--- /dev/null
+++ b/src/plugins/platforms/windows/uiautomation/qwindowsuiagriditemprovider.cpp
@@ -0,0 +1,176 @@
+/****************************************************************************
+**
+** Copyright (C) 2017 The Qt Company Ltd.
+** Contact: https://www.qt.io/licensing/
+**
+** This file is part of the plugins of the Qt Toolkit.
+**
+** $QT_BEGIN_LICENSE:LGPL$
+** Commercial License Usage
+** Licensees holding valid commercial Qt licenses may use this file in
+** accordance with the commercial license agreement provided with the
+** Software or, alternatively, in accordance with the terms contained in
+** a written agreement between you and The Qt Company. For licensing terms
+** and conditions see https://www.qt.io/terms-conditions. For further
+** information use the contact form at https://www.qt.io/contact-us.
+**
+** GNU Lesser General Public License Usage
+** Alternatively, this file may be used under the terms of the GNU Lesser
+** General Public License version 3 as published by the Free Software
+** Foundation and appearing in the file LICENSE.LGPL3 included in the
+** packaging of this file. Please review the following information to
+** ensure the GNU Lesser General Public License version 3 requirements
+** will be met: https://www.gnu.org/licenses/lgpl-3.0.html.
+**
+** GNU General Public License Usage
+** Alternatively, this file may be used under the terms of the GNU
+** General Public License version 2.0 or (at your option) the GNU General
+** Public license version 3 or any later version approved by the KDE Free
+** Qt Foundation. The licenses are as published by the Free Software
+** Foundation and appearing in the file LICENSE.GPL2 and LICENSE.GPL3
+** included in the packaging of this file. Please review the following
+** information to ensure the GNU General Public License requirements will
+** be met: https://www.gnu.org/licenses/gpl-2.0.html and
+** https://www.gnu.org/licenses/gpl-3.0.html.
+**
+** $QT_END_LICENSE$
+**
+****************************************************************************/
+
+#include <QtCore/QtConfig>
+#ifndef QT_NO_ACCESSIBILITY
+
+#include "qwindowsuiagriditemprovider.h"
+#include "qwindowsuiamainprovider.h"
+#include "qwindowsuiautils.h"
+#include "qwindowscontext.h"
+
+#include <QtGui/QAccessible>
+#include <QtGui/QAccessibleInterface>
+#include <QtCore/QDebug>
+#include <QtCore/QString>
+
+QT_BEGIN_NAMESPACE
+
+using namespace QWindowsUiAutomation;
+
+
+QWindowsUiaGridItemProvider::QWindowsUiaGridItemProvider(QAccessible::Id id) :
+ QWindowsUiaBaseProvider(id)
+{
+}
+
+QWindowsUiaGridItemProvider::~QWindowsUiaGridItemProvider()
+{
+}
+
+// Returns the row index of the item.
+HRESULT STDMETHODCALLTYPE QWindowsUiaGridItemProvider::get_Row(int *pRetVal)
+{
+ qCDebug(lcQpaUiAutomation) << __FUNCTION__;
+
+ if (!pRetVal)
+ return E_INVALIDARG;
+ *pRetVal = 0;
+
+ QAccessibleInterface *accessible = accessibleInterface();
+ if (!accessible)
+ return UIA_E_ELEMENTNOTAVAILABLE;
+
+ QAccessibleTableCellInterface *tableCellInterface = accessible->tableCellInterface();
+ if (!tableCellInterface)
+ return UIA_E_ELEMENTNOTAVAILABLE;
+
+ *pRetVal = tableCellInterface->rowIndex();
+ return S_OK;
+}
+
+// Returns the column index of the item.
+HRESULT STDMETHODCALLTYPE QWindowsUiaGridItemProvider::get_Column(int *pRetVal)
+{
+ qCDebug(lcQpaUiAutomation) << __FUNCTION__;
+
+ if (!pRetVal)
+ return E_INVALIDARG;
+ *pRetVal = 0;
+
+ QAccessibleInterface *accessible = accessibleInterface();
+ if (!accessible)
+ return UIA_E_ELEMENTNOTAVAILABLE;
+
+ QAccessibleTableCellInterface *tableCellInterface = accessible->tableCellInterface();
+ if (!tableCellInterface)
+ return UIA_E_ELEMENTNOTAVAILABLE;
+
+ *pRetVal = tableCellInterface->columnIndex();
+ return S_OK;
+}
+
+// Returns the number of rows occupied by the item.
+HRESULT STDMETHODCALLTYPE QWindowsUiaGridItemProvider::get_RowSpan(int *pRetVal)
+{
+ qCDebug(lcQpaUiAutomation) << __FUNCTION__;
+
+ if (!pRetVal)
+ return E_INVALIDARG;
+ *pRetVal = 0;
+
+ QAccessibleInterface *accessible = accessibleInterface();
+ if (!accessible)
+ return UIA_E_ELEMENTNOTAVAILABLE;
+
+ QAccessibleTableCellInterface *tableCellInterface = accessible->tableCellInterface();
+ if (!tableCellInterface)
+ return UIA_E_ELEMENTNOTAVAILABLE;
+
+ *pRetVal = tableCellInterface->rowExtent();
+ return S_OK;
+}
+
+// Returns the number of columns occupied by the item.
+HRESULT STDMETHODCALLTYPE QWindowsUiaGridItemProvider::get_ColumnSpan(int *pRetVal)
+{
+ qCDebug(lcQpaUiAutomation) << __FUNCTION__;
+
+ if (!pRetVal)
+ return E_INVALIDARG;
+ *pRetVal = 0;
+
+ QAccessibleInterface *accessible = accessibleInterface();
+ if (!accessible)
+ return UIA_E_ELEMENTNOTAVAILABLE;
+
+ QAccessibleTableCellInterface *tableCellInterface = accessible->tableCellInterface();
+ if (!tableCellInterface)
+ return UIA_E_ELEMENTNOTAVAILABLE;
+
+ *pRetVal = tableCellInterface->columnExtent();
+ return S_OK;
+}
+
+// Returns the provider for the cointaining table/tree.
+HRESULT STDMETHODCALLTYPE QWindowsUiaGridItemProvider::get_ContainingGrid(IRawElementProviderSimple **pRetVal)
+{
+ qCDebug(lcQpaUiAutomation) << __FUNCTION__;
+
+ if (!pRetVal)
+ return E_INVALIDARG;
+ *pRetVal = nullptr;
+
+ QAccessibleInterface *accessible = accessibleInterface();
+ if (!accessible)
+ return UIA_E_ELEMENTNOTAVAILABLE;
+
+ QAccessibleTableCellInterface *tableCellInterface = accessible->tableCellInterface();
+ if (!tableCellInterface)
+ return UIA_E_ELEMENTNOTAVAILABLE;
+
+ if (QAccessibleInterface *table = tableCellInterface->table()) {
+ *pRetVal = QWindowsUiaMainProvider::providerForAccessible(table);
+ }
+ return S_OK;
+}
+
+QT_END_NAMESPACE
+
+#endif // QT_NO_ACCESSIBILITY
diff --git a/src/plugins/platforms/windows/uiautomation/qwindowsuiagriditemprovider.h b/src/plugins/platforms/windows/uiautomation/qwindowsuiagriditemprovider.h
new file mode 100644
index 0000000000..a93b50ef97
--- /dev/null
+++ b/src/plugins/platforms/windows/uiautomation/qwindowsuiagriditemprovider.h
@@ -0,0 +1,71 @@
+/****************************************************************************
+**
+** Copyright (C) 2017 The Qt Company Ltd.
+** Contact: https://www.qt.io/licensing/
+**
+** This file is part of the plugins of the Qt Toolkit.
+**
+** $QT_BEGIN_LICENSE:LGPL$
+** Commercial License Usage
+** Licensees holding valid commercial Qt licenses may use this file in
+** accordance with the commercial license agreement provided with the
+** Software or, alternatively, in accordance with the terms contained in
+** a written agreement between you and The Qt Company. For licensing terms
+** and conditions see https://www.qt.io/terms-conditions. For further
+** information use the contact form at https://www.qt.io/contact-us.
+**
+** GNU Lesser General Public License Usage
+** Alternatively, this file may be used under the terms of the GNU Lesser
+** General Public License version 3 as published by the Free Software
+** Foundation and appearing in the file LICENSE.LGPL3 included in the
+** packaging of this file. Please review the following information to
+** ensure the GNU Lesser General Public License version 3 requirements
+** will be met: https://www.gnu.org/licenses/lgpl-3.0.html.
+**
+** GNU General Public License Usage
+** Alternatively, this file may be used under the terms of the GNU
+** General Public License version 2.0 or (at your option) the GNU General
+** Public license version 3 or any later version approved by the KDE Free
+** Qt Foundation. The licenses are as published by the Free Software
+** Foundation and appearing in the file LICENSE.GPL2 and LICENSE.GPL3
+** included in the packaging of this file. Please review the following
+** information to ensure the GNU General Public License requirements will
+** be met: https://www.gnu.org/licenses/gpl-2.0.html and
+** https://www.gnu.org/licenses/gpl-3.0.html.
+**
+** $QT_END_LICENSE$
+**
+****************************************************************************/
+
+#ifndef QWINDOWSUIAGRIDITEMPROVIDER_H
+#define QWINDOWSUIAGRIDITEMPROVIDER_H
+
+#include <QtCore/QtConfig>
+#ifndef QT_NO_ACCESSIBILITY
+
+#include "qwindowsuiabaseprovider.h"
+
+QT_BEGIN_NAMESPACE
+
+// Implements the Grid Item control pattern provider. Used by items within a table/tree.
+class QWindowsUiaGridItemProvider : public QWindowsUiaBaseProvider,
+ public QWindowsComBase<IGridItemProvider>
+{
+ Q_DISABLE_COPY(QWindowsUiaGridItemProvider)
+public:
+ explicit QWindowsUiaGridItemProvider(QAccessible::Id id);
+ virtual ~QWindowsUiaGridItemProvider();
+
+ // IGridItemProvider
+ HRESULT STDMETHODCALLTYPE get_Row(int *pRetVal);
+ HRESULT STDMETHODCALLTYPE get_Column(int *pRetVal);
+ HRESULT STDMETHODCALLTYPE get_RowSpan(int *pRetVal);
+ HRESULT STDMETHODCALLTYPE get_ColumnSpan(int *pRetVal);
+ HRESULT STDMETHODCALLTYPE get_ContainingGrid(IRawElementProviderSimple **pRetVal);
+};
+
+QT_END_NAMESPACE
+
+#endif // QT_NO_ACCESSIBILITY
+
+#endif // QWINDOWSUIAGRIDITEMPROVIDER_H
diff --git a/src/plugins/platforms/windows/uiautomation/qwindowsuiagridprovider.cpp b/src/plugins/platforms/windows/uiautomation/qwindowsuiagridprovider.cpp
new file mode 100644
index 0000000000..65c2df703b
--- /dev/null
+++ b/src/plugins/platforms/windows/uiautomation/qwindowsuiagridprovider.cpp
@@ -0,0 +1,136 @@
+/****************************************************************************
+**
+** Copyright (C) 2017 The Qt Company Ltd.
+** Contact: https://www.qt.io/licensing/
+**
+** This file is part of the plugins of the Qt Toolkit.
+**
+** $QT_BEGIN_LICENSE:LGPL$
+** Commercial License Usage
+** Licensees holding valid commercial Qt licenses may use this file in
+** accordance with the commercial license agreement provided with the
+** Software or, alternatively, in accordance with the terms contained in
+** a written agreement between you and The Qt Company. For licensing terms
+** and conditions see https://www.qt.io/terms-conditions. For further
+** information use the contact form at https://www.qt.io/contact-us.
+**
+** GNU Lesser General Public License Usage
+** Alternatively, this file may be used under the terms of the GNU Lesser
+** General Public License version 3 as published by the Free Software
+** Foundation and appearing in the file LICENSE.LGPL3 included in the
+** packaging of this file. Please review the following information to
+** ensure the GNU Lesser General Public License version 3 requirements
+** will be met: https://www.gnu.org/licenses/lgpl-3.0.html.
+**
+** GNU General Public License Usage
+** Alternatively, this file may be used under the terms of the GNU
+** General Public License version 2.0 or (at your option) the GNU General
+** Public license version 3 or any later version approved by the KDE Free
+** Qt Foundation. The licenses are as published by the Free Software
+** Foundation and appearing in the file LICENSE.GPL2 and LICENSE.GPL3
+** included in the packaging of this file. Please review the following
+** information to ensure the GNU General Public License requirements will
+** be met: https://www.gnu.org/licenses/gpl-2.0.html and
+** https://www.gnu.org/licenses/gpl-3.0.html.
+**
+** $QT_END_LICENSE$
+**
+****************************************************************************/
+
+#include <QtCore/QtConfig>
+#ifndef QT_NO_ACCESSIBILITY
+
+#include "qwindowsuiagridprovider.h"
+#include "qwindowsuiamainprovider.h"
+#include "qwindowsuiautils.h"
+#include "qwindowscontext.h"
+
+#include <QtGui/QAccessible>
+#include <QtGui/QAccessibleInterface>
+#include <QtCore/QDebug>
+#include <QtCore/QString>
+
+QT_BEGIN_NAMESPACE
+
+using namespace QWindowsUiAutomation;
+
+
+QWindowsUiaGridProvider::QWindowsUiaGridProvider(QAccessible::Id id) :
+ QWindowsUiaBaseProvider(id)
+{
+}
+
+QWindowsUiaGridProvider::~QWindowsUiaGridProvider()
+{
+}
+
+// Returns the provider for an item within a table/tree.
+HRESULT STDMETHODCALLTYPE QWindowsUiaGridProvider::GetItem(int row, int column, IRawElementProviderSimple **pRetVal)
+{
+ qCDebug(lcQpaUiAutomation) << __FUNCTION__;
+
+ if (!pRetVal)
+ return E_INVALIDARG;
+ *pRetVal = nullptr;
+
+ QAccessibleInterface *accessible = accessibleInterface();
+ if (!accessible)
+ return UIA_E_ELEMENTNOTAVAILABLE;
+
+ QAccessibleTableInterface *tableInterface = accessible->tableInterface();
+ if (!tableInterface)
+ return UIA_E_ELEMENTNOTAVAILABLE;
+
+ if ((row >= 0) && (row < tableInterface->rowCount()) && (column >= 0) && (column < tableInterface->columnCount())) {
+ if (QAccessibleInterface *cell = tableInterface->cellAt(row, column)) {
+ *pRetVal = QWindowsUiaMainProvider::providerForAccessible(cell);
+ }
+ }
+ return S_OK;
+}
+
+// Returns the number of rows.
+HRESULT STDMETHODCALLTYPE QWindowsUiaGridProvider::get_RowCount(int *pRetVal)
+{
+ qCDebug(lcQpaUiAutomation) << __FUNCTION__;
+
+ if (!pRetVal)
+ return E_INVALIDARG;
+ *pRetVal = 0;
+
+ QAccessibleInterface *accessible = accessibleInterface();
+ if (!accessible)
+ return UIA_E_ELEMENTNOTAVAILABLE;
+
+ QAccessibleTableInterface *tableInterface = accessible->tableInterface();
+ if (!tableInterface)
+ return UIA_E_ELEMENTNOTAVAILABLE;
+
+ *pRetVal = tableInterface->rowCount();
+ return S_OK;
+}
+
+// Returns the number of columns.
+HRESULT STDMETHODCALLTYPE QWindowsUiaGridProvider::get_ColumnCount(int *pRetVal)
+{
+ qCDebug(lcQpaUiAutomation) << __FUNCTION__;
+
+ if (!pRetVal)
+ return E_INVALIDARG;
+ *pRetVal = 0;
+
+ QAccessibleInterface *accessible = accessibleInterface();
+ if (!accessible)
+ return UIA_E_ELEMENTNOTAVAILABLE;
+
+ QAccessibleTableInterface *tableInterface = accessible->tableInterface();
+ if (!tableInterface)
+ return UIA_E_ELEMENTNOTAVAILABLE;
+
+ *pRetVal = tableInterface->columnCount();
+ return S_OK;
+}
+
+QT_END_NAMESPACE
+
+#endif // QT_NO_ACCESSIBILITY
diff --git a/src/plugins/platforms/windows/uiautomation/qwindowsuiagridprovider.h b/src/plugins/platforms/windows/uiautomation/qwindowsuiagridprovider.h
new file mode 100644
index 0000000000..15521f98b3
--- /dev/null
+++ b/src/plugins/platforms/windows/uiautomation/qwindowsuiagridprovider.h
@@ -0,0 +1,69 @@
+/****************************************************************************
+**
+** Copyright (C) 2017 The Qt Company Ltd.
+** Contact: https://www.qt.io/licensing/
+**
+** This file is part of the plugins of the Qt Toolkit.
+**
+** $QT_BEGIN_LICENSE:LGPL$
+** Commercial License Usage
+** Licensees holding valid commercial Qt licenses may use this file in
+** accordance with the commercial license agreement provided with the
+** Software or, alternatively, in accordance with the terms contained in
+** a written agreement between you and The Qt Company. For licensing terms
+** and conditions see https://www.qt.io/terms-conditions. For further
+** information use the contact form at https://www.qt.io/contact-us.
+**
+** GNU Lesser General Public License Usage
+** Alternatively, this file may be used under the terms of the GNU Lesser
+** General Public License version 3 as published by the Free Software
+** Foundation and appearing in the file LICENSE.LGPL3 included in the
+** packaging of this file. Please review the following information to
+** ensure the GNU Lesser General Public License version 3 requirements
+** will be met: https://www.gnu.org/licenses/lgpl-3.0.html.
+**
+** GNU General Public License Usage
+** Alternatively, this file may be used under the terms of the GNU
+** General Public License version 2.0 or (at your option) the GNU General
+** Public license version 3 or any later version approved by the KDE Free
+** Qt Foundation. The licenses are as published by the Free Software
+** Foundation and appearing in the file LICENSE.GPL2 and LICENSE.GPL3
+** included in the packaging of this file. Please review the following
+** information to ensure the GNU General Public License requirements will
+** be met: https://www.gnu.org/licenses/gpl-2.0.html and
+** https://www.gnu.org/licenses/gpl-3.0.html.
+**
+** $QT_END_LICENSE$
+**
+****************************************************************************/
+
+#ifndef QWINDOWSUIAGRIDPROVIDER_H
+#define QWINDOWSUIAGRIDPROVIDER_H
+
+#include <QtCore/QtConfig>
+#ifndef QT_NO_ACCESSIBILITY
+
+#include "qwindowsuiabaseprovider.h"
+
+QT_BEGIN_NAMESPACE
+
+// Implements the Grid control pattern provider. Used by tables/trees.
+class QWindowsUiaGridProvider : public QWindowsUiaBaseProvider,
+ public QWindowsComBase<IGridProvider>
+{
+ Q_DISABLE_COPY(QWindowsUiaGridProvider)
+public:
+ explicit QWindowsUiaGridProvider(QAccessible::Id id);
+ virtual ~QWindowsUiaGridProvider();
+
+ // IGridProvider
+ HRESULT STDMETHODCALLTYPE GetItem(int row, int column, IRawElementProviderSimple **pRetVal);
+ HRESULT STDMETHODCALLTYPE get_RowCount(int *pRetVal);
+ HRESULT STDMETHODCALLTYPE get_ColumnCount(int *pRetVal);
+};
+
+QT_END_NAMESPACE
+
+#endif // QT_NO_ACCESSIBILITY
+
+#endif // QWINDOWSUIAGRIDPROVIDER_H
diff --git a/src/plugins/platforms/windows/uiautomation/qwindowsuiainvokeprovider.cpp b/src/plugins/platforms/windows/uiautomation/qwindowsuiainvokeprovider.cpp
new file mode 100644
index 0000000000..2af883c4f6
--- /dev/null
+++ b/src/plugins/platforms/windows/uiautomation/qwindowsuiainvokeprovider.cpp
@@ -0,0 +1,84 @@
+/****************************************************************************
+**
+** Copyright (C) 2017 The Qt Company Ltd.
+** Contact: https://www.qt.io/licensing/
+**
+** This file is part of the plugins of the Qt Toolkit.
+**
+** $QT_BEGIN_LICENSE:LGPL$
+** Commercial License Usage
+** Licensees holding valid commercial Qt licenses may use this file in
+** accordance with the commercial license agreement provided with the
+** Software or, alternatively, in accordance with the terms contained in
+** a written agreement between you and The Qt Company. For licensing terms
+** and conditions see https://www.qt.io/terms-conditions. For further
+** information use the contact form at https://www.qt.io/contact-us.
+**
+** GNU Lesser General Public License Usage
+** Alternatively, this file may be used under the terms of the GNU Lesser
+** General Public License version 3 as published by the Free Software
+** Foundation and appearing in the file LICENSE.LGPL3 included in the
+** packaging of this file. Please review the following information to
+** ensure the GNU Lesser General Public License version 3 requirements
+** will be met: https://www.gnu.org/licenses/lgpl-3.0.html.
+**
+** GNU General Public License Usage
+** Alternatively, this file may be used under the terms of the GNU
+** General Public License version 2.0 or (at your option) the GNU General
+** Public license version 3 or any later version approved by the KDE Free
+** Qt Foundation. The licenses are as published by the Free Software
+** Foundation and appearing in the file LICENSE.GPL2 and LICENSE.GPL3
+** included in the packaging of this file. Please review the following
+** information to ensure the GNU General Public License requirements will
+** be met: https://www.gnu.org/licenses/gpl-2.0.html and
+** https://www.gnu.org/licenses/gpl-3.0.html.
+**
+** $QT_END_LICENSE$
+**
+****************************************************************************/
+
+#include <QtCore/QtConfig>
+#ifndef QT_NO_ACCESSIBILITY
+
+#include "qwindowsuiainvokeprovider.h"
+#include "qwindowsuiautils.h"
+#include "qwindowscontext.h"
+
+#include <QtGui/QAccessible>
+#include <QtGui/QAccessibleInterface>
+#include <QtCore/QDebug>
+#include <QtCore/QString>
+
+QT_BEGIN_NAMESPACE
+
+using namespace QWindowsUiAutomation;
+
+
+QWindowsUiaInvokeProvider::QWindowsUiaInvokeProvider(QAccessible::Id id) :
+ QWindowsUiaBaseProvider(id)
+{
+}
+
+QWindowsUiaInvokeProvider::~QWindowsUiaInvokeProvider()
+{
+}
+
+HRESULT STDMETHODCALLTYPE QWindowsUiaInvokeProvider::Invoke()
+{
+ qCDebug(lcQpaUiAutomation) << __FUNCTION__;
+
+ QAccessibleInterface *accessible = accessibleInterface();
+ if (!accessible)
+ return UIA_E_ELEMENTNOTAVAILABLE;
+
+ QAccessibleActionInterface *actionInterface = accessible->actionInterface();
+ if (!actionInterface)
+ return UIA_E_ELEMENTNOTAVAILABLE;
+
+ actionInterface->doAction(QAccessibleActionInterface::pressAction());
+ return S_OK;
+}
+
+QT_END_NAMESPACE
+
+#endif // QT_NO_ACCESSIBILITY
diff --git a/src/plugins/platforms/windows/uiautomation/qwindowsuiainvokeprovider.h b/src/plugins/platforms/windows/uiautomation/qwindowsuiainvokeprovider.h
new file mode 100644
index 0000000000..2b8a646983
--- /dev/null
+++ b/src/plugins/platforms/windows/uiautomation/qwindowsuiainvokeprovider.h
@@ -0,0 +1,67 @@
+/****************************************************************************
+**
+** Copyright (C) 2017 The Qt Company Ltd.
+** Contact: https://www.qt.io/licensing/
+**
+** This file is part of the plugins of the Qt Toolkit.
+**
+** $QT_BEGIN_LICENSE:LGPL$
+** Commercial License Usage
+** Licensees holding valid commercial Qt licenses may use this file in
+** accordance with the commercial license agreement provided with the
+** Software or, alternatively, in accordance with the terms contained in
+** a written agreement between you and The Qt Company. For licensing terms
+** and conditions see https://www.qt.io/terms-conditions. For further
+** information use the contact form at https://www.qt.io/contact-us.
+**
+** GNU Lesser General Public License Usage
+** Alternatively, this file may be used under the terms of the GNU Lesser
+** General Public License version 3 as published by the Free Software
+** Foundation and appearing in the file LICENSE.LGPL3 included in the
+** packaging of this file. Please review the following information to
+** ensure the GNU Lesser General Public License version 3 requirements
+** will be met: https://www.gnu.org/licenses/lgpl-3.0.html.
+**
+** GNU General Public License Usage
+** Alternatively, this file may be used under the terms of the GNU
+** General Public License version 2.0 or (at your option) the GNU General
+** Public license version 3 or any later version approved by the KDE Free
+** Qt Foundation. The licenses are as published by the Free Software
+** Foundation and appearing in the file LICENSE.GPL2 and LICENSE.GPL3
+** included in the packaging of this file. Please review the following
+** information to ensure the GNU General Public License requirements will
+** be met: https://www.gnu.org/licenses/gpl-2.0.html and
+** https://www.gnu.org/licenses/gpl-3.0.html.
+**
+** $QT_END_LICENSE$
+**
+****************************************************************************/
+
+#ifndef QWINDOWSUIAINVOKEPROVIDER_H
+#define QWINDOWSUIAINVOKEPROVIDER_H
+
+#include <QtCore/QtConfig>
+#ifndef QT_NO_ACCESSIBILITY
+
+#include "qwindowsuiabaseprovider.h"
+
+QT_BEGIN_NAMESPACE
+
+// Implements the Invoke control pattern provider.
+class QWindowsUiaInvokeProvider : public QWindowsUiaBaseProvider,
+ public QWindowsComBase<IInvokeProvider>
+{
+ Q_DISABLE_COPY(QWindowsUiaInvokeProvider)
+public:
+ explicit QWindowsUiaInvokeProvider(QAccessible::Id id);
+ virtual ~QWindowsUiaInvokeProvider();
+
+ // IInvokeProvider
+ HRESULT STDMETHODCALLTYPE Invoke();
+};
+
+QT_END_NAMESPACE
+
+#endif // QT_NO_ACCESSIBILITY
+
+#endif // QWINDOWSUIAINVOKEPROVIDER_H
diff --git a/src/plugins/platforms/windows/uiautomation/qwindowsuiamainprovider.cpp b/src/plugins/platforms/windows/uiautomation/qwindowsuiamainprovider.cpp
new file mode 100644
index 0000000000..46f73f81a0
--- /dev/null
+++ b/src/plugins/platforms/windows/uiautomation/qwindowsuiamainprovider.cpp
@@ -0,0 +1,638 @@
+/****************************************************************************
+**
+** Copyright (C) 2017 The Qt Company Ltd.
+** Contact: https://www.qt.io/licensing/
+**
+** This file is part of the plugins of the Qt Toolkit.
+**
+** $QT_BEGIN_LICENSE:LGPL$
+** Commercial License Usage
+** Licensees holding valid commercial Qt licenses may use this file in
+** accordance with the commercial license agreement provided with the
+** Software or, alternatively, in accordance with the terms contained in
+** a written agreement between you and The Qt Company. For licensing terms
+** and conditions see https://www.qt.io/terms-conditions. For further
+** information use the contact form at https://www.qt.io/contact-us.
+**
+** GNU Lesser General Public License Usage
+** Alternatively, this file may be used under the terms of the GNU Lesser
+** General Public License version 3 as published by the Free Software
+** Foundation and appearing in the file LICENSE.LGPL3 included in the
+** packaging of this file. Please review the following information to
+** ensure the GNU Lesser General Public License version 3 requirements
+** will be met: https://www.gnu.org/licenses/lgpl-3.0.html.
+**
+** GNU General Public License Usage
+** Alternatively, this file may be used under the terms of the GNU
+** General Public License version 2.0 or (at your option) the GNU General
+** Public license version 3 or any later version approved by the KDE Free
+** Qt Foundation. The licenses are as published by the Free Software
+** Foundation and appearing in the file LICENSE.GPL2 and LICENSE.GPL3
+** included in the packaging of this file. Please review the following
+** information to ensure the GNU General Public License requirements will
+** be met: https://www.gnu.org/licenses/gpl-2.0.html and
+** https://www.gnu.org/licenses/gpl-3.0.html.
+**
+** $QT_END_LICENSE$
+**
+****************************************************************************/
+
+#include <QtCore/QtConfig>
+#ifndef QT_NO_ACCESSIBILITY
+
+#include "qwindowsuiamainprovider.h"
+#include "qwindowsuiavalueprovider.h"
+#include "qwindowsuiarangevalueprovider.h"
+#include "qwindowsuiatextprovider.h"
+#include "qwindowsuiatoggleprovider.h"
+#include "qwindowsuiainvokeprovider.h"
+#include "qwindowsuiaselectionprovider.h"
+#include "qwindowsuiaselectionitemprovider.h"
+#include "qwindowsuiatableprovider.h"
+#include "qwindowsuiatableitemprovider.h"
+#include "qwindowsuiagridprovider.h"
+#include "qwindowsuiagriditemprovider.h"
+#include "qwindowscombase.h"
+#include "qwindowscontext.h"
+#include "qwindowsuiautils.h"
+#include "qwindowsuiaprovidercache.h"
+
+#include <QtCore/QDebug>
+#include <QtGui/QAccessible>
+#include <QtGui/QGuiApplication>
+#include <QtGui/QWindow>
+
+#if !defined(Q_CC_BOR) && !defined (Q_CC_GNU)
+#include <comdef.h>
+#endif
+
+#include <QtCore/qt_windows.h>
+
+QT_BEGIN_NAMESPACE
+
+using namespace QWindowsUiAutomation;
+
+
+// Returns a cached instance of the provider for a specific acessible interface.
+QWindowsUiaMainProvider *QWindowsUiaMainProvider::providerForAccessible(QAccessibleInterface *accessible)
+{
+ if (!accessible)
+ return nullptr;
+
+ QAccessible::Id id = QAccessible::uniqueId(accessible);
+ QWindowsUiaProviderCache *providerCache = QWindowsUiaProviderCache::instance();
+ QWindowsUiaMainProvider *provider = qobject_cast<QWindowsUiaMainProvider *>(providerCache->providerForId(id));
+
+ if (provider) {
+ provider->AddRef();
+ } else {
+ provider = new QWindowsUiaMainProvider(accessible);
+ providerCache->insert(id, provider);
+ }
+ return provider;
+}
+
+QWindowsUiaMainProvider::QWindowsUiaMainProvider(QAccessibleInterface *a, int initialRefCount)
+ : QWindowsUiaBaseProvider(QAccessible::uniqueId(a)),
+ m_ref(initialRefCount)
+{
+}
+
+QWindowsUiaMainProvider::~QWindowsUiaMainProvider()
+{
+}
+
+void QWindowsUiaMainProvider::notifyFocusChange(QAccessibleEvent *event)
+{
+ if (QAccessibleInterface *accessible = event->accessibleInterface()) {
+ if (QWindowsUiaMainProvider *provider = providerForAccessible(accessible)) {
+ QWindowsUiaWrapper::instance()->raiseAutomationEvent(provider, UIA_AutomationFocusChangedEventId);
+ }
+ }
+}
+
+void QWindowsUiaMainProvider::notifyStateChange(QAccessibleStateChangeEvent *event)
+{
+ if (QAccessibleInterface *accessible = event->accessibleInterface()) {
+ if (event->changedStates().checked || event->changedStates().checkStateMixed) {
+ // Notifies states changes in checkboxes.
+ if (accessible->role() == QAccessible::CheckBox) {
+ if (QWindowsUiaMainProvider *provider = providerForAccessible(accessible)) {
+ VARIANT oldVal, newVal;
+ clearVariant(&oldVal);
+ int toggleState = ToggleState_Off;
+ if (accessible->state().checked)
+ toggleState = accessible->state().checkStateMixed ? ToggleState_Indeterminate : ToggleState_On;
+ setVariantI4(toggleState, &newVal);
+ QWindowsUiaWrapper::instance()->raiseAutomationPropertyChangedEvent(provider, UIA_ToggleToggleStatePropertyId, oldVal, newVal);
+ }
+ }
+ }
+ if (event->changedStates().active) {
+ if (accessible->role() == QAccessible::Window) {
+ // Notifies window opened/closed.
+ if (QWindowsUiaMainProvider *provider = providerForAccessible(accessible)) {
+ if (accessible->state().active) {
+ QWindowsUiaWrapper::instance()->raiseAutomationEvent(provider, UIA_Window_WindowOpenedEventId);
+ } else {
+ QWindowsUiaWrapper::instance()->raiseAutomationEvent(provider, UIA_Window_WindowClosedEventId);
+ }
+ }
+ }
+ }
+ }
+}
+
+void QWindowsUiaMainProvider::notifyValueChange(QAccessibleValueChangeEvent *event)
+{
+ if (QAccessibleInterface *accessible = event->accessibleInterface()) {
+ if (QAccessibleValueInterface *valueInterface = accessible->valueInterface()) {
+ // Notifies changes in values of controls supporting the value interface.
+ if (QWindowsUiaMainProvider *provider = providerForAccessible(accessible)) {
+ VARIANT oldVal, newVal;
+ clearVariant(&oldVal);
+ setVariantDouble(valueInterface->currentValue().toDouble(), &newVal);
+ QWindowsUiaWrapper::instance()->raiseAutomationPropertyChangedEvent(provider, UIA_RangeValueValuePropertyId, oldVal, newVal);
+ }
+ }
+ }
+}
+
+// Notifies changes in text content and selection state of text controls.
+void QWindowsUiaMainProvider::notifyTextChange(QAccessibleEvent *event)
+{
+ if (QAccessibleInterface *accessible = event->accessibleInterface()) {
+ if (accessible->textInterface()) {
+ if (QWindowsUiaMainProvider *provider = providerForAccessible(accessible)) {
+ if (event->type() == QAccessible::TextSelectionChanged) {
+ QWindowsUiaWrapper::instance()->raiseAutomationEvent(provider, UIA_Text_TextSelectionChangedEventId);
+ } else if (event->type() == QAccessible::TextCaretMoved) {
+ if (!accessible->state().readOnly) {
+ QWindowsUiaWrapper::instance()->raiseAutomationEvent(provider, UIA_Text_TextSelectionChangedEventId);
+ }
+ } else {
+ QWindowsUiaWrapper::instance()->raiseAutomationEvent(provider, UIA_Text_TextChangedEventId);
+ }
+ }
+ }
+ }
+}
+
+HRESULT STDMETHODCALLTYPE QWindowsUiaMainProvider::QueryInterface(REFIID iid, LPVOID *iface)
+{
+ if (!iface)
+ return E_INVALIDARG;
+ *iface = nullptr;
+
+ QAccessibleInterface *accessible = accessibleInterface();
+
+ const bool result = qWindowsComQueryUnknownInterfaceMulti<IRawElementProviderSimple>(this, iid, iface)
+ || qWindowsComQueryInterface<IRawElementProviderSimple>(this, iid, iface)
+ || qWindowsComQueryInterface<IRawElementProviderFragment>(this, iid, iface)
+ || (accessible && hwndForAccessible(accessible) && qWindowsComQueryInterface<IRawElementProviderFragmentRoot>(this, iid, iface));
+ return result ? S_OK : E_NOINTERFACE;
+}
+
+ULONG QWindowsUiaMainProvider::AddRef()
+{
+ return ++m_ref;
+}
+
+ULONG STDMETHODCALLTYPE QWindowsUiaMainProvider::Release()
+{
+ if (!--m_ref) {
+ delete this;
+ return 0;
+ }
+ return m_ref;
+}
+
+HRESULT QWindowsUiaMainProvider::get_ProviderOptions(ProviderOptions *pRetVal)
+{
+ if (!pRetVal)
+ return E_INVALIDARG;
+ // We are STA, (OleInitialize()).
+ *pRetVal = static_cast<ProviderOptions>(ProviderOptions_ServerSideProvider | ProviderOptions_UseComThreading);
+ return S_OK;
+}
+
+// Return providers for specific control patterns
+HRESULT QWindowsUiaMainProvider::GetPatternProvider(PATTERNID idPattern, IUnknown **pRetVal)
+{
+ qCDebug(lcQpaUiAutomation) << __FUNCTION__ << idPattern;
+
+ if (!pRetVal)
+ return E_INVALIDARG;
+ *pRetVal = nullptr;
+
+ QAccessibleInterface *accessible = accessibleInterface();
+ if (!accessible)
+ return UIA_E_ELEMENTNOTAVAILABLE;
+
+ switch (idPattern) {
+ case UIA_TextPatternId:
+ case UIA_TextPattern2Id:
+ // All text controls.
+ if (accessible->textInterface()) {
+ *pRetVal = new QWindowsUiaTextProvider(id());
+ }
+ break;
+ case UIA_ValuePatternId:
+ // All accessible controls return text(QAccessible::Value) (which may be empty).
+ *pRetVal = new QWindowsUiaValueProvider(id());
+ break;
+ case UIA_RangeValuePatternId:
+ // Controls providing a numeric value within a range (e.g., sliders, scroll bars, dials).
+ if (accessible->valueInterface()) {
+ *pRetVal = new QWindowsUiaRangeValueProvider(id());
+ }
+ break;
+ case UIA_TogglePatternId:
+ // Checkbox controls.
+ if (accessible->role() == QAccessible::CheckBox) {
+ *pRetVal = new QWindowsUiaToggleProvider(id());
+ }
+ break;
+ case UIA_SelectionPatternId:
+ // Lists of items.
+ if (accessible->role() == QAccessible::List) {
+ *pRetVal = new QWindowsUiaSelectionProvider(id());
+ }
+ break;
+ case UIA_SelectionItemPatternId:
+ // Items within a list and radio buttons.
+ if ((accessible->role() == QAccessible::RadioButton)
+ || (accessible->role() == QAccessible::ListItem)) {
+ *pRetVal = new QWindowsUiaSelectionItemProvider(id());
+ }
+ break;
+ case UIA_TablePatternId:
+ // Table/tree.
+ if (accessible->tableInterface()
+ && ((accessible->role() == QAccessible::Table) || (accessible->role() == QAccessible::Tree))) {
+ *pRetVal = new QWindowsUiaTableProvider(id());
+ }
+ break;
+ case UIA_TableItemPatternId:
+ // Item within a table/tree.
+ if (accessible->tableCellInterface()
+ && ((accessible->role() == QAccessible::Cell) || (accessible->role() == QAccessible::TreeItem))) {
+ *pRetVal = new QWindowsUiaTableItemProvider(id());
+ }
+ break;
+ case UIA_GridPatternId:
+ // Table/tree.
+ if (accessible->tableInterface()
+ && ((accessible->role() == QAccessible::Table) || (accessible->role() == QAccessible::Tree))) {
+ *pRetVal = new QWindowsUiaGridProvider(id());
+ }
+ break;
+ case UIA_GridItemPatternId:
+ // Item within a table/tree.
+ if (accessible->tableCellInterface()
+ && ((accessible->role() == QAccessible::Cell) || (accessible->role() == QAccessible::TreeItem))) {
+ *pRetVal = new QWindowsUiaGridItemProvider(id());
+ }
+ break;
+ case UIA_InvokePatternId:
+ // Things that have an invokable action (e.g., simple buttons).
+ if (accessible->actionInterface()) {
+ *pRetVal = new QWindowsUiaInvokeProvider(id());
+ }
+ break;
+ default:
+ break;
+ }
+
+ return S_OK;
+}
+
+HRESULT QWindowsUiaMainProvider::GetPropertyValue(PROPERTYID idProp, VARIANT *pRetVal)
+{
+ qCDebug(lcQpaUiAutomation) << __FUNCTION__ << idProp;
+
+ if (!pRetVal)
+ return E_INVALIDARG;
+ clearVariant(pRetVal);
+
+ QAccessibleInterface *accessible = accessibleInterface();
+ if (!accessible)
+ return UIA_E_ELEMENTNOTAVAILABLE;
+
+ bool clientTopLevel = (accessible->role() == QAccessible::Client)
+ && accessible->parent() && (accessible->parent()->role() == QAccessible::Application);
+
+ switch (idProp) {
+ case UIA_ProcessIdPropertyId:
+ // PID
+ setVariantI4(int(GetCurrentProcessId()), pRetVal);
+ break;
+ case UIA_AccessKeyPropertyId:
+ // Accelerator key.
+ setVariantString(accessible->text(QAccessible::Accelerator), pRetVal);
+ break;
+ case UIA_AutomationIdPropertyId:
+ // Automation ID, which can be used by tools to select a specific control in the UI.
+ setVariantString(automationIdForAccessible(accessible), pRetVal);
+ break;
+ case UIA_ClassNamePropertyId:
+ // Class name.
+ if (QObject *o = accessible->object()) {
+ QString className = QLatin1String(o->metaObject()->className());
+ setVariantString(className, pRetVal);
+ }
+ break;
+ case UIA_FrameworkIdPropertyId:
+ setVariantString(QStringLiteral("Qt"), pRetVal);
+ break;
+ case UIA_ControlTypePropertyId:
+ if (clientTopLevel) {
+ // Reports a top-level widget as a window, instead of "custom".
+ setVariantI4(UIA_WindowControlTypeId, pRetVal);
+ } else {
+ // Control type converted from role.
+ setVariantI4(roleToControlTypeId(accessible->role()), pRetVal);
+ }
+ break;
+ case UIA_HelpTextPropertyId:
+ setVariantString(accessible->text(QAccessible::Help), pRetVal);
+ break;
+ case UIA_HasKeyboardFocusPropertyId:
+ setVariantBool(accessible->state().focused, pRetVal);
+ break;
+ case UIA_IsKeyboardFocusablePropertyId:
+ setVariantBool(accessible->state().focusable, pRetVal);
+ break;
+ case UIA_IsOffscreenPropertyId:
+ setVariantBool(false, pRetVal);
+ break;
+ case UIA_IsContentElementPropertyId:
+ setVariantBool(true, pRetVal);
+ break;
+ case UIA_IsControlElementPropertyId:
+ setVariantBool(true, pRetVal);
+ break;
+ case UIA_IsEnabledPropertyId:
+ setVariantBool(!accessible->state().disabled, pRetVal);
+ break;
+ case UIA_IsPasswordPropertyId:
+ setVariantBool(accessible->role() == QAccessible::EditableText
+ && accessible->state().passwordEdit, pRetVal);
+ break;
+ case UIA_IsPeripheralPropertyId:
+ // True for peripheral UIs.
+ if (QWindow *window = windowForAccessible(accessible)) {
+ const Qt::WindowType wt = window->type();
+ setVariantBool(wt == Qt::Popup || wt == Qt::ToolTip || wt == Qt::SplashScreen, pRetVal);
+ }
+ break;
+ case UIA_FullDescriptionPropertyId:
+ setVariantString(accessible->text(QAccessible::Description), pRetVal);
+ break;
+ case UIA_NamePropertyId: {
+ QString name = accessible->text(QAccessible::Name);
+ if (name.isEmpty() && clientTopLevel) {
+ name = QCoreApplication::applicationName();
+ }
+ setVariantString(name, pRetVal);
+ break;
+ }
+ default:
+ break;
+ }
+ return S_OK;
+}
+
+// Generates an ID based on the name of the controls and their parents.
+QString QWindowsUiaMainProvider::automationIdForAccessible(const QAccessibleInterface *accessible)
+{
+ QString result;
+ if (accessible) {
+ QObject *obj = accessible->object();
+ while (obj) {
+ QString name = obj->objectName();
+ if (name.isEmpty())
+ return QString();
+ if (!result.isEmpty())
+ result.prepend(QLatin1Char('.'));
+ result.prepend(name);
+ obj = obj->parent();
+ }
+ }
+ return result;
+}
+
+HRESULT QWindowsUiaMainProvider::get_HostRawElementProvider(IRawElementProviderSimple **pRetVal)
+{
+ qCDebug(lcQpaUiAutomation) << __FUNCTION__ << this;
+
+ if (!pRetVal)
+ return E_INVALIDARG;
+ *pRetVal = nullptr;
+
+ // Returns a host provider only for controls associated with a native window handle. Others should return NULL.
+ if (QAccessibleInterface *accessible = accessibleInterface()) {
+ if (HWND hwnd = hwndForAccessible(accessible)) {
+ return QWindowsUiaWrapper::instance()->hostProviderFromHwnd(hwnd, pRetVal);
+ }
+ }
+ return S_OK;
+}
+
+// Navigates within the tree of accessible controls.
+HRESULT QWindowsUiaMainProvider::Navigate(NavigateDirection direction, IRawElementProviderFragment **pRetVal)
+{
+ qCDebug(lcQpaUiAutomation) << __FUNCTION__ << direction << " this: " << this;
+
+ if (!pRetVal)
+ return E_INVALIDARG;
+ *pRetVal = nullptr;
+
+ QAccessibleInterface *accessible = accessibleInterface();
+ if (!accessible)
+ return UIA_E_ELEMENTNOTAVAILABLE;
+
+ QAccessibleInterface *targetacc = nullptr;
+
+ switch (direction) {
+ case NavigateDirection_Parent:
+ targetacc = accessible->parent();
+ if (targetacc && (targetacc->role() == QAccessible::Application)) {
+ targetacc = nullptr; // The app's children are considered top level objects.
+ }
+ break;
+ case NavigateDirection_FirstChild:
+ targetacc = accessible->child(0);
+ break;
+ case NavigateDirection_LastChild:
+ targetacc = accessible->child(accessible->childCount() - 1);
+ break;
+ case NavigateDirection_NextSibling:
+ case NavigateDirection_PreviousSibling:
+ if (QAccessibleInterface *parent = accessible->parent()) {
+ if (parent->isValid()) {
+ int index = parent->indexOfChild(accessible);
+ index += (direction == NavigateDirection_NextSibling) ? 1 : -1;
+ if (index >= 0 && index < parent->childCount())
+ targetacc = parent->child(index);
+ }
+ }
+ break;
+ }
+
+ if (targetacc)
+ *pRetVal = providerForAccessible(targetacc);
+ return S_OK;
+}
+
+// Returns a unique id assigned to the UI element, used as key by the UI Automation framework.
+HRESULT QWindowsUiaMainProvider::GetRuntimeId(SAFEARRAY **pRetVal)
+{
+ qCDebug(lcQpaUiAutomation) << __FUNCTION__ << this;
+
+ if (!pRetVal)
+ return E_INVALIDARG;
+ *pRetVal = nullptr;
+
+ QAccessibleInterface *accessible = accessibleInterface();
+ if (!accessible)
+ return UIA_E_ELEMENTNOTAVAILABLE;
+
+ // The UiaAppendRuntimeId constant is used to make then ID unique
+ // among multiple instances running on the system.
+ int rtId[] = { UiaAppendRuntimeId, int(id()) };
+
+ if ((*pRetVal = SafeArrayCreateVector(VT_I4, 0, 2))) {
+ for (LONG i = 0; i < 2; ++i)
+ SafeArrayPutElement(*pRetVal, &i, &rtId[i]);
+ }
+ return S_OK;
+}
+
+// Returns the bounding rectangle for the accessible control.
+HRESULT QWindowsUiaMainProvider::get_BoundingRectangle(UiaRect *pRetVal)
+{
+ qCDebug(lcQpaUiAutomation) << __FUNCTION__ << this;
+
+ if (!pRetVal)
+ return E_INVALIDARG;
+
+ QAccessibleInterface *accessible = accessibleInterface();
+ if (!accessible)
+ return UIA_E_ELEMENTNOTAVAILABLE;
+
+ QWindow *window = windowForAccessible(accessible);
+ if (!window)
+ return UIA_E_ELEMENTNOTAVAILABLE;
+
+ rectToNativeUiaRect(accessible->rect(), window, pRetVal);
+ return S_OK;
+}
+
+HRESULT QWindowsUiaMainProvider::GetEmbeddedFragmentRoots(SAFEARRAY **pRetVal)
+{
+ qCDebug(lcQpaUiAutomation) << __FUNCTION__ << this;
+
+ if (!pRetVal)
+ return E_INVALIDARG;
+ *pRetVal = nullptr;
+ // No embedded roots.
+ return S_OK;
+}
+
+// Sets focus to the control.
+HRESULT QWindowsUiaMainProvider::SetFocus()
+{
+ qCDebug(lcQpaUiAutomation) << __FUNCTION__ << this;
+
+ QAccessibleInterface *accessible = accessibleInterface();
+ if (!accessible)
+ return UIA_E_ELEMENTNOTAVAILABLE;
+
+ QAccessibleActionInterface *actionInterface = accessible->actionInterface();
+ if (!actionInterface)
+ return UIA_E_ELEMENTNOTAVAILABLE;
+
+ actionInterface->doAction(QAccessibleActionInterface::setFocusAction());
+ return S_OK;
+}
+
+HRESULT QWindowsUiaMainProvider::get_FragmentRoot(IRawElementProviderFragmentRoot **pRetVal)
+{
+ qCDebug(lcQpaUiAutomation) << __FUNCTION__ << this;
+
+ if (!pRetVal)
+ return E_INVALIDARG;
+ *pRetVal = nullptr;
+
+ // Our UI Automation implementation considers the window as the root for
+ // non-native controls/fragments.
+ if (QAccessibleInterface *accessible = accessibleInterface()) {
+ if (QWindow *window = windowForAccessible(accessible)) {
+ if (QAccessibleInterface *rootacc = window->accessibleRoot()) {
+ *pRetVal = providerForAccessible(rootacc);
+ }
+ }
+ }
+ return S_OK;
+}
+
+// Returns a provider for the UI element present at the specified screen coordinates.
+HRESULT QWindowsUiaMainProvider::ElementProviderFromPoint(double x, double y, IRawElementProviderFragment **pRetVal)
+{
+ qCDebug(lcQpaUiAutomation) << __FUNCTION__ << x << y;
+
+ if (!pRetVal) {
+ return E_INVALIDARG;
+ }
+ *pRetVal = nullptr;
+
+ QAccessibleInterface *accessible = accessibleInterface();
+ if (!accessible)
+ return UIA_E_ELEMENTNOTAVAILABLE;
+
+ QWindow *window = windowForAccessible(accessible);
+ if (!window)
+ return UIA_E_ELEMENTNOTAVAILABLE;
+
+ // Scales coordinates from High DPI screens.
+ UiaPoint uiaPoint = {x, y};
+ QPoint point;
+ nativeUiaPointToPoint(uiaPoint, window, &point);
+
+ QAccessibleInterface *targetacc = accessible->childAt(point.x(), point.y());
+
+ if (targetacc) {
+ QAccessibleInterface *acc = targetacc;
+ // Controls can be embedded within grouping elements. By default returns the innermost control.
+ while (acc) {
+ targetacc = acc;
+ // For accessibility tools it may be better to return the text element instead of its subcomponents.
+ if (targetacc->textInterface()) break;
+ acc = acc->childAt(point.x(), point.y());
+ }
+ *pRetVal = providerForAccessible(targetacc);
+ }
+ return S_OK;
+}
+
+// Returns the fragment with focus.
+HRESULT QWindowsUiaMainProvider::GetFocus(IRawElementProviderFragment **pRetVal)
+{
+ qCDebug(lcQpaUiAutomation) << __FUNCTION__ << this;
+
+ if (!pRetVal)
+ return E_INVALIDARG;
+ *pRetVal = nullptr;
+
+ if (QAccessibleInterface *accessible = accessibleInterface()) {
+ if (QAccessibleInterface *focusacc = accessible->focusChild()) {
+ *pRetVal = providerForAccessible(focusacc);
+ }
+ }
+ return S_OK;
+}
+
+QT_END_NAMESPACE
+
+#endif // QT_NO_ACCESSIBILITY
diff --git a/src/plugins/platforms/windows/uiautomation/qwindowsuiamainprovider.h b/src/plugins/platforms/windows/uiautomation/qwindowsuiamainprovider.h
new file mode 100644
index 0000000000..893cbf7f8a
--- /dev/null
+++ b/src/plugins/platforms/windows/uiautomation/qwindowsuiamainprovider.h
@@ -0,0 +1,105 @@
+/****************************************************************************
+**
+** Copyright (C) 2017 The Qt Company Ltd.
+** Contact: https://www.qt.io/licensing/
+**
+** This file is part of the plugins of the Qt Toolkit.
+**
+** $QT_BEGIN_LICENSE:LGPL$
+** Commercial License Usage
+** Licensees holding valid commercial Qt licenses may use this file in
+** accordance with the commercial license agreement provided with the
+** Software or, alternatively, in accordance with the terms contained in
+** a written agreement between you and The Qt Company. For licensing terms
+** and conditions see https://www.qt.io/terms-conditions. For further
+** information use the contact form at https://www.qt.io/contact-us.
+**
+** GNU Lesser General Public License Usage
+** Alternatively, this file may be used under the terms of the GNU Lesser
+** General Public License version 3 as published by the Free Software
+** Foundation and appearing in the file LICENSE.LGPL3 included in the
+** packaging of this file. Please review the following information to
+** ensure the GNU Lesser General Public License version 3 requirements
+** will be met: https://www.gnu.org/licenses/lgpl-3.0.html.
+**
+** GNU General Public License Usage
+** Alternatively, this file may be used under the terms of the GNU
+** General Public License version 2.0 or (at your option) the GNU General
+** Public license version 3 or any later version approved by the KDE Free
+** Qt Foundation. The licenses are as published by the Free Software
+** Foundation and appearing in the file LICENSE.GPL2 and LICENSE.GPL3
+** included in the packaging of this file. Please review the following
+** information to ensure the GNU General Public License requirements will
+** be met: https://www.gnu.org/licenses/gpl-2.0.html and
+** https://www.gnu.org/licenses/gpl-3.0.html.
+**
+** $QT_END_LICENSE$
+**
+****************************************************************************/
+
+#ifndef QWINDOWSUIAMAINPROVIDER_H
+#define QWINDOWSUIAMAINPROVIDER_H
+
+#include <QtCore/QtConfig>
+#ifndef QT_NO_ACCESSIBILITY
+
+#include "qwindowsuiabaseprovider.h"
+
+#include <QtCore/QPointer>
+#include <QtCore/QSharedPointer>
+#include <QtCore/qt_windows.h>
+#include <QtGui/QAccessible>
+
+QT_BEGIN_NAMESPACE
+
+// The main UI Automation class.
+class QWindowsUiaMainProvider :
+ public QWindowsUiaBaseProvider,
+ public IRawElementProviderSimple,
+ public IRawElementProviderFragment,
+ public IRawElementProviderFragmentRoot
+{
+ Q_OBJECT
+ Q_DISABLE_COPY(QWindowsUiaMainProvider)
+public:
+ static QWindowsUiaMainProvider *providerForAccessible(QAccessibleInterface *accessible);
+ explicit QWindowsUiaMainProvider(QAccessibleInterface *a, int initialRefCount = 1);
+ virtual ~QWindowsUiaMainProvider();
+ static void notifyFocusChange(QAccessibleEvent *event);
+ static void notifyStateChange(QAccessibleStateChangeEvent *event);
+ static void notifyValueChange(QAccessibleValueChangeEvent *event);
+ static void notifyTextChange(QAccessibleEvent *event);
+
+ // IUnknown
+ HRESULT STDMETHODCALLTYPE QueryInterface(REFIID id, LPVOID *iface);
+ ULONG STDMETHODCALLTYPE AddRef();
+ ULONG STDMETHODCALLTYPE Release();
+
+ // IRawElementProviderSimple methods
+ HRESULT STDMETHODCALLTYPE get_ProviderOptions(ProviderOptions *pRetVal);
+ HRESULT STDMETHODCALLTYPE GetPatternProvider(PATTERNID idPattern, IUnknown **pRetVal);
+ HRESULT STDMETHODCALLTYPE GetPropertyValue(PROPERTYID idProp, VARIANT *pRetVal);
+ HRESULT STDMETHODCALLTYPE get_HostRawElementProvider(IRawElementProviderSimple **pRetVal);
+
+ // IRawElementProviderFragment methods
+ HRESULT STDMETHODCALLTYPE Navigate(NavigateDirection direction, IRawElementProviderFragment **pRetVal);
+ HRESULT STDMETHODCALLTYPE GetRuntimeId(SAFEARRAY **pRetVal);
+ HRESULT STDMETHODCALLTYPE get_BoundingRectangle(UiaRect *pRetVal);
+ HRESULT STDMETHODCALLTYPE GetEmbeddedFragmentRoots(SAFEARRAY **pRetVal);
+ HRESULT STDMETHODCALLTYPE SetFocus();
+ HRESULT STDMETHODCALLTYPE get_FragmentRoot(IRawElementProviderFragmentRoot **pRetVal);
+
+ // IRawElementProviderFragmentRoot methods
+ HRESULT STDMETHODCALLTYPE ElementProviderFromPoint(double x, double y, IRawElementProviderFragment **pRetVal);
+ HRESULT STDMETHODCALLTYPE GetFocus(IRawElementProviderFragment **pRetVal);
+
+private:
+ QString automationIdForAccessible(const QAccessibleInterface *accessible);
+ ULONG m_ref;
+};
+
+QT_END_NAMESPACE
+
+#endif // QT_NO_ACCESSIBILITY
+
+#endif // QWINDOWSUIAMAINPROVIDER_H
diff --git a/src/plugins/platforms/windows/uiautomation/qwindowsuiaprovidercache.cpp b/src/plugins/platforms/windows/uiautomation/qwindowsuiaprovidercache.cpp
new file mode 100644
index 0000000000..9f0a1e126f
--- /dev/null
+++ b/src/plugins/platforms/windows/uiautomation/qwindowsuiaprovidercache.cpp
@@ -0,0 +1,106 @@
+/****************************************************************************
+**
+** Copyright (C) 2017 The Qt Company Ltd.
+** Contact: https://www.qt.io/licensing/
+**
+** This file is part of the plugins of the Qt Toolkit.
+**
+** $QT_BEGIN_LICENSE:LGPL$
+** Commercial License Usage
+** Licensees holding valid commercial Qt licenses may use this file in
+** accordance with the commercial license agreement provided with the
+** Software or, alternatively, in accordance with the terms contained in
+** a written agreement between you and The Qt Company. For licensing terms
+** and conditions see https://www.qt.io/terms-conditions. For further
+** information use the contact form at https://www.qt.io/contact-us.
+**
+** GNU Lesser General Public License Usage
+** Alternatively, this file may be used under the terms of the GNU Lesser
+** General Public License version 3 as published by the Free Software
+** Foundation and appearing in the file LICENSE.LGPL3 included in the
+** packaging of this file. Please review the following information to
+** ensure the GNU Lesser General Public License version 3 requirements
+** will be met: https://www.gnu.org/licenses/lgpl-3.0.html.
+**
+** GNU General Public License Usage
+** Alternatively, this file may be used under the terms of the GNU
+** General Public License version 2.0 or (at your option) the GNU General
+** Public license version 3 or any later version approved by the KDE Free
+** Qt Foundation. The licenses are as published by the Free Software
+** Foundation and appearing in the file LICENSE.GPL2 and LICENSE.GPL3
+** included in the packaging of this file. Please review the following
+** information to ensure the GNU General Public License requirements will
+** be met: https://www.gnu.org/licenses/gpl-2.0.html and
+** https://www.gnu.org/licenses/gpl-3.0.html.
+**
+** $QT_END_LICENSE$
+**
+****************************************************************************/
+
+#include <QtCore/QtConfig>
+#ifndef QT_NO_ACCESSIBILITY
+
+#include "qwindowsuiaprovidercache.h"
+#include "qwindowsuiautils.h"
+#include "qwindowscontext.h"
+
+#include <QtCore/QDebug>
+
+QT_BEGIN_NAMESPACE
+
+using namespace QWindowsUiAutomation;
+
+
+// Private constructor
+QWindowsUiaProviderCache::QWindowsUiaProviderCache()
+{
+}
+
+// shared instance
+QWindowsUiaProviderCache *QWindowsUiaProviderCache::instance()
+{
+ static QWindowsUiaProviderCache providerCache;
+ return &providerCache;
+}
+
+// Returns the provider instance associated with the ID, or nullptr.
+QWindowsUiaBaseProvider *QWindowsUiaProviderCache::providerForId(QAccessible::Id id) const
+{
+ return providerTable.value(id);
+}
+
+// Inserts a provider in the cache and associates it with an accessibility ID.
+void QWindowsUiaProviderCache::insert(QAccessible::Id id, QWindowsUiaBaseProvider *provider)
+{
+ remove(id);
+ if (provider) {
+ providerTable[id] = provider;
+ inverseTable[provider] = id;
+ // Connects the destroyed signal to our slot, to remove deleted objects from the cache.
+ QObject::connect(provider, &QObject::destroyed, this, &QWindowsUiaProviderCache::objectDestroyed);
+ }
+}
+
+// Removes deleted provider objects from the cache.
+void QWindowsUiaProviderCache::objectDestroyed(QObject *obj)
+{
+ // We have to use the inverse table to map the object address back to its ID,
+ // since at this point (called from QObject destructor), it has already been
+ // partially destroyed and we cannot treat it as a provider.
+ auto it = inverseTable.find(obj);
+ if (it != inverseTable.end()) {
+ providerTable.remove(*it);
+ inverseTable.remove(obj);
+ }
+}
+
+// Removes a provider with a given id from the cache.
+void QWindowsUiaProviderCache::remove(QAccessible::Id id)
+{
+ inverseTable.remove(providerTable.value(id));
+ providerTable.remove(id);
+}
+
+QT_END_NAMESPACE
+
+#endif // QT_NO_ACCESSIBILITY
diff --git a/src/plugins/platforms/windows/uiautomation/qwindowsuiaprovidercache.h b/src/plugins/platforms/windows/uiautomation/qwindowsuiaprovidercache.h
new file mode 100644
index 0000000000..7ad30ac39c
--- /dev/null
+++ b/src/plugins/platforms/windows/uiautomation/qwindowsuiaprovidercache.h
@@ -0,0 +1,77 @@
+/****************************************************************************
+**
+** Copyright (C) 2017 The Qt Company Ltd.
+** Contact: https://www.qt.io/licensing/
+**
+** This file is part of the plugins of the Qt Toolkit.
+**
+** $QT_BEGIN_LICENSE:LGPL$
+** Commercial License Usage
+** Licensees holding valid commercial Qt licenses may use this file in
+** accordance with the commercial license agreement provided with the
+** Software or, alternatively, in accordance with the terms contained in
+** a written agreement between you and The Qt Company. For licensing terms
+** and conditions see https://www.qt.io/terms-conditions. For further
+** information use the contact form at https://www.qt.io/contact-us.
+**
+** GNU Lesser General Public License Usage
+** Alternatively, this file may be used under the terms of the GNU Lesser
+** General Public License version 3 as published by the Free Software
+** Foundation and appearing in the file LICENSE.LGPL3 included in the
+** packaging of this file. Please review the following information to
+** ensure the GNU Lesser General Public License version 3 requirements
+** will be met: https://www.gnu.org/licenses/lgpl-3.0.html.
+**
+** GNU General Public License Usage
+** Alternatively, this file may be used under the terms of the GNU
+** General Public License version 2.0 or (at your option) the GNU General
+** Public license version 3 or any later version approved by the KDE Free
+** Qt Foundation. The licenses are as published by the Free Software
+** Foundation and appearing in the file LICENSE.GPL2 and LICENSE.GPL3
+** included in the packaging of this file. Please review the following
+** information to ensure the GNU General Public License requirements will
+** be met: https://www.gnu.org/licenses/gpl-2.0.html and
+** https://www.gnu.org/licenses/gpl-3.0.html.
+**
+** $QT_END_LICENSE$
+**
+****************************************************************************/
+
+#ifndef QWINDOWSUIAPROVIDERCACHE_H
+#define QWINDOWSUIAPROVIDERCACHE_H
+
+#include <QtCore/QtConfig>
+#ifndef QT_NO_ACCESSIBILITY
+
+#include "qwindowsuiabaseprovider.h"
+
+#include <QtCore/QHash>
+#include <QtGui/QAccessible>
+#include <QtGui/QAccessibleInterface>
+
+QT_BEGIN_NAMESPACE
+
+// Singleton used to cache provider instances using the accessibility ID as the key.
+class QWindowsUiaProviderCache : public QObject
+{
+ QWindowsUiaProviderCache();
+ Q_OBJECT
+public:
+ static QWindowsUiaProviderCache *instance();
+ QWindowsUiaBaseProvider *providerForId(QAccessible::Id id) const;
+ void insert(QAccessible::Id id, QWindowsUiaBaseProvider *provider);
+ void remove(QAccessible::Id id);
+
+private Q_SLOTS:
+ void objectDestroyed(QObject *obj);
+
+private:
+ QHash<QAccessible::Id, QWindowsUiaBaseProvider *> providerTable;
+ QHash<QObject *, QAccessible::Id> inverseTable;
+};
+
+QT_END_NAMESPACE
+
+#endif // QT_NO_ACCESSIBILITY
+
+#endif // QWINDOWSUIAPROVIDERCACHE_H
diff --git a/src/plugins/platforms/windows/uiautomation/qwindowsuiarangevalueprovider.cpp b/src/plugins/platforms/windows/uiautomation/qwindowsuiarangevalueprovider.cpp
new file mode 100644
index 0000000000..0cd09c3f0a
--- /dev/null
+++ b/src/plugins/platforms/windows/uiautomation/qwindowsuiarangevalueprovider.cpp
@@ -0,0 +1,190 @@
+/****************************************************************************
+**
+** Copyright (C) 2017 The Qt Company Ltd.
+** Contact: https://www.qt.io/licensing/
+**
+** This file is part of the plugins of the Qt Toolkit.
+**
+** $QT_BEGIN_LICENSE:LGPL$
+** Commercial License Usage
+** Licensees holding valid commercial Qt licenses may use this file in
+** accordance with the commercial license agreement provided with the
+** Software or, alternatively, in accordance with the terms contained in
+** a written agreement between you and The Qt Company. For licensing terms
+** and conditions see https://www.qt.io/terms-conditions. For further
+** information use the contact form at https://www.qt.io/contact-us.
+**
+** GNU Lesser General Public License Usage
+** Alternatively, this file may be used under the terms of the GNU Lesser
+** General Public License version 3 as published by the Free Software
+** Foundation and appearing in the file LICENSE.LGPL3 included in the
+** packaging of this file. Please review the following information to
+** ensure the GNU Lesser General Public License version 3 requirements
+** will be met: https://www.gnu.org/licenses/lgpl-3.0.html.
+**
+** GNU General Public License Usage
+** Alternatively, this file may be used under the terms of the GNU
+** General Public License version 2.0 or (at your option) the GNU General
+** Public license version 3 or any later version approved by the KDE Free
+** Qt Foundation. The licenses are as published by the Free Software
+** Foundation and appearing in the file LICENSE.GPL2 and LICENSE.GPL3
+** included in the packaging of this file. Please review the following
+** information to ensure the GNU General Public License requirements will
+** be met: https://www.gnu.org/licenses/gpl-2.0.html and
+** https://www.gnu.org/licenses/gpl-3.0.html.
+**
+** $QT_END_LICENSE$
+**
+****************************************************************************/
+
+#include <QtCore/QtConfig>
+#ifndef QT_NO_ACCESSIBILITY
+
+#include "qwindowsuiarangevalueprovider.h"
+#include "qwindowsuiautils.h"
+#include "qwindowscontext.h"
+
+#include <QtGui/QAccessible>
+#include <QtGui/QAccessibleInterface>
+#include <QtCore/QDebug>
+#include <QtCore/QString>
+
+QT_BEGIN_NAMESPACE
+
+using namespace QWindowsUiAutomation;
+
+
+QWindowsUiaRangeValueProvider::QWindowsUiaRangeValueProvider(QAccessible::Id id) :
+ QWindowsUiaBaseProvider(id)
+{
+}
+
+QWindowsUiaRangeValueProvider::~QWindowsUiaRangeValueProvider()
+{
+}
+
+HRESULT STDMETHODCALLTYPE QWindowsUiaRangeValueProvider::SetValue(double val)
+{
+ qCDebug(lcQpaUiAutomation) << __FUNCTION__;
+
+ QAccessibleInterface *accessible = accessibleInterface();
+ if (!accessible)
+ return UIA_E_ELEMENTNOTAVAILABLE;
+
+ QAccessibleValueInterface *valueInterface = accessible->valueInterface();
+ if (!valueInterface)
+ return UIA_E_ELEMENTNOTAVAILABLE;
+
+ double minimum = valueInterface->minimumValue().toDouble();
+ double maximum = valueInterface->maximumValue().toDouble();
+ if ((val < minimum) || (val > maximum))
+ return E_INVALIDARG;
+
+ valueInterface->setCurrentValue(QVariant(val));
+ return S_OK;
+}
+
+HRESULT STDMETHODCALLTYPE QWindowsUiaRangeValueProvider::get_Value(double *pRetVal)
+{
+ qCDebug(lcQpaUiAutomation) << __FUNCTION__;
+
+ if (!pRetVal)
+ return E_INVALIDARG;
+
+ QAccessibleInterface *accessible = accessibleInterface();
+ if (!accessible)
+ return UIA_E_ELEMENTNOTAVAILABLE;
+
+ QAccessibleValueInterface *valueInterface = accessible->valueInterface();
+ if (!valueInterface)
+ return UIA_E_ELEMENTNOTAVAILABLE;
+
+ QVariant varValue = valueInterface->currentValue();
+ *pRetVal = varValue.toDouble();
+ return S_OK;
+}
+
+HRESULT STDMETHODCALLTYPE QWindowsUiaRangeValueProvider::get_IsReadOnly(BOOL *pRetVal)
+{
+ qCDebug(lcQpaUiAutomation) << __FUNCTION__;
+
+ if (!pRetVal)
+ return E_INVALIDARG;
+
+ QAccessibleInterface *accessible = accessibleInterface();
+ if (!accessible)
+ return UIA_E_ELEMENTNOTAVAILABLE;
+
+ *pRetVal = accessible->state().readOnly;
+ return S_OK;
+}
+
+HRESULT STDMETHODCALLTYPE QWindowsUiaRangeValueProvider::get_Maximum(double *pRetVal)
+{
+ qCDebug(lcQpaUiAutomation) << __FUNCTION__;
+
+ if (!pRetVal)
+ return E_INVALIDARG;
+
+ QAccessibleInterface *accessible = accessibleInterface();
+ if (!accessible)
+ return UIA_E_ELEMENTNOTAVAILABLE;
+
+ QAccessibleValueInterface *valueInterface = accessible->valueInterface();
+ if (!valueInterface)
+ return UIA_E_ELEMENTNOTAVAILABLE;
+
+ QVariant varValue = valueInterface->maximumValue();
+ *pRetVal = varValue.toDouble();
+ return S_OK;
+}
+
+HRESULT STDMETHODCALLTYPE QWindowsUiaRangeValueProvider::get_Minimum(double *pRetVal)
+{
+ qCDebug(lcQpaUiAutomation) << __FUNCTION__;
+
+ if (!pRetVal)
+ return E_INVALIDARG;
+
+ QAccessibleInterface *accessible = accessibleInterface();
+ if (!accessible)
+ return UIA_E_ELEMENTNOTAVAILABLE;
+
+ QAccessibleValueInterface *valueInterface = accessible->valueInterface();
+ if (!valueInterface)
+ return UIA_E_ELEMENTNOTAVAILABLE;
+
+ QVariant varValue = valueInterface->minimumValue();
+ *pRetVal = varValue.toDouble();
+ return S_OK;
+}
+
+HRESULT STDMETHODCALLTYPE QWindowsUiaRangeValueProvider::get_LargeChange(double *pRetVal)
+{
+ qCDebug(lcQpaUiAutomation) << __FUNCTION__;
+ return get_SmallChange(pRetVal);
+}
+
+HRESULT STDMETHODCALLTYPE QWindowsUiaRangeValueProvider::get_SmallChange(double *pRetVal)
+{
+ qCDebug(lcQpaUiAutomation) << __FUNCTION__;
+
+ if (!pRetVal)
+ return E_INVALIDARG;
+
+ QAccessibleInterface *accessible = accessibleInterface();
+ if (!accessible)
+ return UIA_E_ELEMENTNOTAVAILABLE;
+
+ QAccessibleValueInterface *valueInterface = accessible->valueInterface();
+ if (!valueInterface)
+ return UIA_E_ELEMENTNOTAVAILABLE;
+
+ QVariant varValue = valueInterface->minimumStepSize();
+ *pRetVal = varValue.toDouble();
+ return S_OK;
+}
+
+QT_END_NAMESPACE
+
+#endif // QT_NO_ACCESSIBILITY
diff --git a/src/plugins/platforms/windows/uiautomation/qwindowsuiarangevalueprovider.h b/src/plugins/platforms/windows/uiautomation/qwindowsuiarangevalueprovider.h
new file mode 100644
index 0000000000..f742ef99c2
--- /dev/null
+++ b/src/plugins/platforms/windows/uiautomation/qwindowsuiarangevalueprovider.h
@@ -0,0 +1,73 @@
+/****************************************************************************
+**
+** Copyright (C) 2017 The Qt Company Ltd.
+** Contact: https://www.qt.io/licensing/
+**
+** This file is part of the plugins of the Qt Toolkit.
+**
+** $QT_BEGIN_LICENSE:LGPL$
+** Commercial License Usage
+** Licensees holding valid commercial Qt licenses may use this file in
+** accordance with the commercial license agreement provided with the
+** Software or, alternatively, in accordance with the terms contained in
+** a written agreement between you and The Qt Company. For licensing terms
+** and conditions see https://www.qt.io/terms-conditions. For further
+** information use the contact form at https://www.qt.io/contact-us.
+**
+** GNU Lesser General Public License Usage
+** Alternatively, this file may be used under the terms of the GNU Lesser
+** General Public License version 3 as published by the Free Software
+** Foundation and appearing in the file LICENSE.LGPL3 included in the
+** packaging of this file. Please review the following information to
+** ensure the GNU Lesser General Public License version 3 requirements
+** will be met: https://www.gnu.org/licenses/lgpl-3.0.html.
+**
+** GNU General Public License Usage
+** Alternatively, this file may be used under the terms of the GNU
+** General Public License version 2.0 or (at your option) the GNU General
+** Public license version 3 or any later version approved by the KDE Free
+** Qt Foundation. The licenses are as published by the Free Software
+** Foundation and appearing in the file LICENSE.GPL2 and LICENSE.GPL3
+** included in the packaging of this file. Please review the following
+** information to ensure the GNU General Public License requirements will
+** be met: https://www.gnu.org/licenses/gpl-2.0.html and
+** https://www.gnu.org/licenses/gpl-3.0.html.
+**
+** $QT_END_LICENSE$
+**
+****************************************************************************/
+
+#ifndef QWINDOWSUIARANGEVALUEPROVIDER_H
+#define QWINDOWSUIARANGEVALUEPROVIDER_H
+
+#include <QtCore/QtConfig>
+#ifndef QT_NO_ACCESSIBILITY
+
+#include "qwindowsuiabaseprovider.h"
+
+QT_BEGIN_NAMESPACE
+
+// Implements the Range Value control pattern provider.
+class QWindowsUiaRangeValueProvider : public QWindowsUiaBaseProvider,
+ public QWindowsComBase<IRangeValueProvider>
+{
+ Q_DISABLE_COPY(QWindowsUiaRangeValueProvider)
+public:
+ explicit QWindowsUiaRangeValueProvider(QAccessible::Id id);
+ virtual ~QWindowsUiaRangeValueProvider();
+
+ // IRangeValueProvider
+ HRESULT STDMETHODCALLTYPE SetValue(double val);
+ HRESULT STDMETHODCALLTYPE get_Value(double *pRetVal);
+ HRESULT STDMETHODCALLTYPE get_IsReadOnly(BOOL *pRetVal);
+ HRESULT STDMETHODCALLTYPE get_Maximum(double *pRetVal);
+ HRESULT STDMETHODCALLTYPE get_Minimum(double *pRetVal);
+ HRESULT STDMETHODCALLTYPE get_LargeChange(double *pRetVal);
+ HRESULT STDMETHODCALLTYPE get_SmallChange(double *pRetVal);
+};
+
+QT_END_NAMESPACE
+
+#endif // QT_NO_ACCESSIBILITY
+
+#endif // QWINDOWSUIARANGEVALUEPROVIDER_H
diff --git a/src/plugins/platforms/windows/uiautomation/qwindowsuiaselectionitemprovider.cpp b/src/plugins/platforms/windows/uiautomation/qwindowsuiaselectionitemprovider.cpp
new file mode 100644
index 0000000000..45216a6d1c
--- /dev/null
+++ b/src/plugins/platforms/windows/uiautomation/qwindowsuiaselectionitemprovider.cpp
@@ -0,0 +1,201 @@
+/****************************************************************************
+**
+** Copyright (C) 2017 The Qt Company Ltd.
+** Contact: https://www.qt.io/licensing/
+**
+** This file is part of the plugins of the Qt Toolkit.
+**
+** $QT_BEGIN_LICENSE:LGPL$
+** Commercial License Usage
+** Licensees holding valid commercial Qt licenses may use this file in
+** accordance with the commercial license agreement provided with the
+** Software or, alternatively, in accordance with the terms contained in
+** a written agreement between you and The Qt Company. For licensing terms
+** and conditions see https://www.qt.io/terms-conditions. For further
+** information use the contact form at https://www.qt.io/contact-us.
+**
+** GNU Lesser General Public License Usage
+** Alternatively, this file may be used under the terms of the GNU Lesser
+** General Public License version 3 as published by the Free Software
+** Foundation and appearing in the file LICENSE.LGPL3 included in the
+** packaging of this file. Please review the following information to
+** ensure the GNU Lesser General Public License version 3 requirements
+** will be met: https://www.gnu.org/licenses/lgpl-3.0.html.
+**
+** GNU General Public License Usage
+** Alternatively, this file may be used under the terms of the GNU
+** General Public License version 2.0 or (at your option) the GNU General
+** Public license version 3 or any later version approved by the KDE Free
+** Qt Foundation. The licenses are as published by the Free Software
+** Foundation and appearing in the file LICENSE.GPL2 and LICENSE.GPL3
+** included in the packaging of this file. Please review the following
+** information to ensure the GNU General Public License requirements will
+** be met: https://www.gnu.org/licenses/gpl-2.0.html and
+** https://www.gnu.org/licenses/gpl-3.0.html.
+**
+** $QT_END_LICENSE$
+**
+****************************************************************************/
+
+#include <QtCore/QtConfig>
+#ifndef QT_NO_ACCESSIBILITY
+
+#include "qwindowsuiaselectionitemprovider.h"
+#include "qwindowsuiamainprovider.h"
+#include "qwindowsuiautils.h"
+#include "qwindowscontext.h"
+
+#include <QtGui/QAccessible>
+#include <QtGui/QAccessibleInterface>
+#include <QtCore/QDebug>
+#include <QtCore/QString>
+
+QT_BEGIN_NAMESPACE
+
+using namespace QWindowsUiAutomation;
+
+
+QWindowsUiaSelectionItemProvider::QWindowsUiaSelectionItemProvider(QAccessible::Id id) :
+ QWindowsUiaBaseProvider(id)
+{
+}
+
+QWindowsUiaSelectionItemProvider::~QWindowsUiaSelectionItemProvider()
+{
+}
+
+// Selects the element (deselecting all others).
+HRESULT STDMETHODCALLTYPE QWindowsUiaSelectionItemProvider::Select()
+{
+ qCDebug(lcQpaUiAutomation) << __FUNCTION__;
+
+ QAccessibleInterface *accessible = accessibleInterface();
+ if (!accessible)
+ return UIA_E_ELEMENTNOTAVAILABLE;
+
+ QAccessibleActionInterface *actionInterface = accessible->actionInterface();
+ if (!actionInterface)
+ return UIA_E_ELEMENTNOTAVAILABLE;
+
+ if (accessible->role() == QAccessible::RadioButton) {
+ // For radio buttons we just invoke the selection action; others are automatically deselected.
+ actionInterface->doAction(QAccessibleActionInterface::pressAction());
+ } else {
+ // Toggle list item if not already selected. It must be done first to support all selection modes.
+ if (!accessible->state().selected) {
+ actionInterface->doAction(QAccessibleActionInterface::toggleAction());
+ }
+ // Toggle selected siblings.
+ if (QAccessibleInterface *parent = accessible->parent()) {
+ for (int i = 0; i < parent->childCount(); ++i) {
+ if (QAccessibleInterface *sibling = parent->child(i)) {
+ if ((sibling != accessible) && (sibling->state().selected)) {
+ if (QAccessibleActionInterface *siblingAction = sibling->actionInterface()) {
+ siblingAction->doAction(QAccessibleActionInterface::toggleAction());
+ }
+ }
+ }
+ }
+ }
+ }
+ return S_OK;
+}
+
+// Adds the element to the list of selected elements.
+HRESULT STDMETHODCALLTYPE QWindowsUiaSelectionItemProvider::AddToSelection()
+{
+ qCDebug(lcQpaUiAutomation) << __FUNCTION__;
+
+ QAccessibleInterface *accessible = accessibleInterface();
+ if (!accessible)
+ return UIA_E_ELEMENTNOTAVAILABLE;
+
+ QAccessibleActionInterface *actionInterface = accessible->actionInterface();
+ if (!actionInterface)
+ return UIA_E_ELEMENTNOTAVAILABLE;
+
+ if (accessible->role() == QAccessible::RadioButton) {
+ // For radio buttons we invoke the selection action.
+ actionInterface->doAction(QAccessibleActionInterface::pressAction());
+ } else {
+ // Toggle list item if not already selected.
+ if (!accessible->state().selected) {
+ actionInterface->doAction(QAccessibleActionInterface::toggleAction());
+ }
+ }
+ return S_OK;
+}
+
+// Removes a list item from selection.
+HRESULT STDMETHODCALLTYPE QWindowsUiaSelectionItemProvider::RemoveFromSelection()
+{
+ qCDebug(lcQpaUiAutomation) << __FUNCTION__;
+
+ QAccessibleInterface *accessible = accessibleInterface();
+ if (!accessible)
+ return UIA_E_ELEMENTNOTAVAILABLE;
+
+ QAccessibleActionInterface *actionInterface = accessible->actionInterface();
+ if (!actionInterface)
+ return UIA_E_ELEMENTNOTAVAILABLE;
+
+ if (accessible->role() != QAccessible::RadioButton) {
+ if (accessible->state().selected) {
+ actionInterface->doAction(QAccessibleActionInterface::toggleAction());
+ }
+ }
+
+ return S_OK;
+}
+
+// Returns true if element is currently selected.
+HRESULT STDMETHODCALLTYPE QWindowsUiaSelectionItemProvider::get_IsSelected(BOOL *pRetVal)
+{
+ qCDebug(lcQpaUiAutomation) << __FUNCTION__;
+
+ if (!pRetVal)
+ return E_INVALIDARG;
+ *pRetVal = FALSE;
+
+ QAccessibleInterface *accessible = accessibleInterface();
+ if (!accessible)
+ return UIA_E_ELEMENTNOTAVAILABLE;
+
+ if (accessible->role() == QAccessible::RadioButton)
+ *pRetVal = accessible->state().checked;
+ else
+ *pRetVal = accessible->state().selected;
+ return S_OK;
+}
+
+// Returns the provider for the container element (e.g., the list for the list item).
+HRESULT STDMETHODCALLTYPE QWindowsUiaSelectionItemProvider::get_SelectionContainer(IRawElementProviderSimple **pRetVal)
+{
+ qCDebug(lcQpaUiAutomation) << __FUNCTION__;
+
+ if (!pRetVal)
+ return E_INVALIDARG;
+ *pRetVal = nullptr;
+
+ QAccessibleInterface *accessible = accessibleInterface();
+ if (!accessible)
+ return UIA_E_ELEMENTNOTAVAILABLE;
+
+ QAccessibleActionInterface *actionInterface = accessible->actionInterface();
+ if (!actionInterface)
+ return UIA_E_ELEMENTNOTAVAILABLE;
+
+ // Radio buttons do not require a container.
+ if (accessible->role() == QAccessible::ListItem) {
+ if (QAccessibleInterface *parent = accessible->parent()) {
+ if (parent->role() == QAccessible::List) {
+ *pRetVal = QWindowsUiaMainProvider::providerForAccessible(parent);
+ }
+ }
+ }
+ return S_OK;
+}
+
+QT_END_NAMESPACE
+
+#endif // QT_NO_ACCESSIBILITY
diff --git a/src/plugins/platforms/windows/uiautomation/qwindowsuiaselectionitemprovider.h b/src/plugins/platforms/windows/uiautomation/qwindowsuiaselectionitemprovider.h
new file mode 100644
index 0000000000..6a9b5b1e4b
--- /dev/null
+++ b/src/plugins/platforms/windows/uiautomation/qwindowsuiaselectionitemprovider.h
@@ -0,0 +1,71 @@
+/****************************************************************************
+**
+** Copyright (C) 2017 The Qt Company Ltd.
+** Contact: https://www.qt.io/licensing/
+**
+** This file is part of the plugins of the Qt Toolkit.
+**
+** $QT_BEGIN_LICENSE:LGPL$
+** Commercial License Usage
+** Licensees holding valid commercial Qt licenses may use this file in
+** accordance with the commercial license agreement provided with the
+** Software or, alternatively, in accordance with the terms contained in
+** a written agreement between you and The Qt Company. For licensing terms
+** and conditions see https://www.qt.io/terms-conditions. For further
+** information use the contact form at https://www.qt.io/contact-us.
+**
+** GNU Lesser General Public License Usage
+** Alternatively, this file may be used under the terms of the GNU Lesser
+** General Public License version 3 as published by the Free Software
+** Foundation and appearing in the file LICENSE.LGPL3 included in the
+** packaging of this file. Please review the following information to
+** ensure the GNU Lesser General Public License version 3 requirements
+** will be met: https://www.gnu.org/licenses/lgpl-3.0.html.
+**
+** GNU General Public License Usage
+** Alternatively, this file may be used under the terms of the GNU
+** General Public License version 2.0 or (at your option) the GNU General
+** Public license version 3 or any later version approved by the KDE Free
+** Qt Foundation. The licenses are as published by the Free Software
+** Foundation and appearing in the file LICENSE.GPL2 and LICENSE.GPL3
+** included in the packaging of this file. Please review the following
+** information to ensure the GNU General Public License requirements will
+** be met: https://www.gnu.org/licenses/gpl-2.0.html and
+** https://www.gnu.org/licenses/gpl-3.0.html.
+**
+** $QT_END_LICENSE$
+**
+****************************************************************************/
+
+#ifndef QWINDOWSUIASELECTIONITEMPROVIDER_H
+#define QWINDOWSUIASELECTIONITEMPROVIDER_H
+
+#include <QtCore/QtConfig>
+#ifndef QT_NO_ACCESSIBILITY
+
+#include "qwindowsuiabaseprovider.h"
+
+QT_BEGIN_NAMESPACE
+
+// Implements the Selection Item control pattern provider. Used for List items and radio buttons.
+class QWindowsUiaSelectionItemProvider : public QWindowsUiaBaseProvider,
+ public QWindowsComBase<ISelectionItemProvider>
+{
+ Q_DISABLE_COPY(QWindowsUiaSelectionItemProvider)
+public:
+ explicit QWindowsUiaSelectionItemProvider(QAccessible::Id id);
+ virtual ~QWindowsUiaSelectionItemProvider();
+
+ // ISelectionItemProvider
+ HRESULT STDMETHODCALLTYPE Select();
+ HRESULT STDMETHODCALLTYPE AddToSelection();
+ HRESULT STDMETHODCALLTYPE RemoveFromSelection();
+ HRESULT STDMETHODCALLTYPE get_IsSelected(BOOL *pRetVal);
+ HRESULT STDMETHODCALLTYPE get_SelectionContainer(IRawElementProviderSimple **pRetVal);
+};
+
+QT_END_NAMESPACE
+
+#endif // QT_NO_ACCESSIBILITY
+
+#endif // QWINDOWSUIASELECTIONITEMPROVIDER_H
diff --git a/src/plugins/platforms/windows/uiautomation/qwindowsuiaselectionprovider.cpp b/src/plugins/platforms/windows/uiautomation/qwindowsuiaselectionprovider.cpp
new file mode 100644
index 0000000000..1c06503bfc
--- /dev/null
+++ b/src/plugins/platforms/windows/uiautomation/qwindowsuiaselectionprovider.cpp
@@ -0,0 +1,147 @@
+/****************************************************************************
+**
+** Copyright (C) 2017 The Qt Company Ltd.
+** Contact: https://www.qt.io/licensing/
+**
+** This file is part of the plugins of the Qt Toolkit.
+**
+** $QT_BEGIN_LICENSE:LGPL$
+** Commercial License Usage
+** Licensees holding valid commercial Qt licenses may use this file in
+** accordance with the commercial license agreement provided with the
+** Software or, alternatively, in accordance with the terms contained in
+** a written agreement between you and The Qt Company. For licensing terms
+** and conditions see https://www.qt.io/terms-conditions. For further
+** information use the contact form at https://www.qt.io/contact-us.
+**
+** GNU Lesser General Public License Usage
+** Alternatively, this file may be used under the terms of the GNU Lesser
+** General Public License version 3 as published by the Free Software
+** Foundation and appearing in the file LICENSE.LGPL3 included in the
+** packaging of this file. Please review the following information to
+** ensure the GNU Lesser General Public License version 3 requirements
+** will be met: https://www.gnu.org/licenses/lgpl-3.0.html.
+**
+** GNU General Public License Usage
+** Alternatively, this file may be used under the terms of the GNU
+** General Public License version 2.0 or (at your option) the GNU General
+** Public license version 3 or any later version approved by the KDE Free
+** Qt Foundation. The licenses are as published by the Free Software
+** Foundation and appearing in the file LICENSE.GPL2 and LICENSE.GPL3
+** included in the packaging of this file. Please review the following
+** information to ensure the GNU General Public License requirements will
+** be met: https://www.gnu.org/licenses/gpl-2.0.html and
+** https://www.gnu.org/licenses/gpl-3.0.html.
+**
+** $QT_END_LICENSE$
+**
+****************************************************************************/
+
+#include <QtCore/QtConfig>
+#ifndef QT_NO_ACCESSIBILITY
+
+#include "qwindowsuiaselectionprovider.h"
+#include "qwindowsuiamainprovider.h"
+#include "qwindowsuiautils.h"
+#include "qwindowscontext.h"
+
+#include <QtGui/QAccessible>
+#include <QtGui/QAccessibleInterface>
+#include <QtCore/QDebug>
+#include <QtCore/QString>
+#include <QList>
+
+QT_BEGIN_NAMESPACE
+
+using namespace QWindowsUiAutomation;
+
+
+QWindowsUiaSelectionProvider::QWindowsUiaSelectionProvider(QAccessible::Id id) :
+ QWindowsUiaBaseProvider(id)
+{
+}
+
+QWindowsUiaSelectionProvider::~QWindowsUiaSelectionProvider()
+{
+}
+
+// Returns an array of providers with the selected items.
+HRESULT STDMETHODCALLTYPE QWindowsUiaSelectionProvider::GetSelection(SAFEARRAY **pRetVal)
+{
+ qCDebug(lcQpaUiAutomation) << __FUNCTION__;
+
+ if (!pRetVal)
+ return E_INVALIDARG;
+ *pRetVal = nullptr;
+
+ QAccessibleInterface *accessible = accessibleInterface();
+ if (!accessible)
+ return UIA_E_ELEMENTNOTAVAILABLE;
+
+ // First put selected items in a list, then build a safe array with the right size.
+ QList<QAccessibleInterface *> selectedList;
+ for (int i = 0; i < accessible->childCount(); ++i) {
+ if (QAccessibleInterface *child = accessible->child(i)) {
+ if (child->state().selected) {
+ selectedList.append(child);
+ }
+ }
+ }
+
+ if ((*pRetVal = SafeArrayCreateVector(VT_UNKNOWN, 0, selectedList.size()))) {
+ for (LONG i = 0; i < selectedList.size(); ++i) {
+ if (QWindowsUiaMainProvider *childProvider = QWindowsUiaMainProvider::providerForAccessible(selectedList.at(i))) {
+ SafeArrayPutElement(*pRetVal, &i, static_cast<IRawElementProviderSimple *>(childProvider));
+ childProvider->Release();
+ }
+ }
+ }
+ return S_OK;
+}
+
+HRESULT STDMETHODCALLTYPE QWindowsUiaSelectionProvider::get_CanSelectMultiple(BOOL *pRetVal)
+{
+ qCDebug(lcQpaUiAutomation) << __FUNCTION__;
+
+ if (!pRetVal)
+ return E_INVALIDARG;
+ *pRetVal = FALSE;
+
+ QAccessibleInterface *accessible = accessibleInterface();
+ if (!accessible)
+ return UIA_E_ELEMENTNOTAVAILABLE;
+
+ *pRetVal = accessible->state().multiSelectable;
+ return S_OK;
+}
+
+HRESULT STDMETHODCALLTYPE QWindowsUiaSelectionProvider::get_IsSelectionRequired(BOOL *pRetVal)
+{
+ qCDebug(lcQpaUiAutomation) << __FUNCTION__;
+
+ if (!pRetVal)
+ return E_INVALIDARG;
+ *pRetVal = FALSE;
+
+ QAccessibleInterface *accessible = accessibleInterface();
+ if (!accessible)
+ return UIA_E_ELEMENTNOTAVAILABLE;
+
+ // Initially returns false if none are selected. After the first selection, it may be required.
+ bool anySelected = false;
+ for (int i = 0; i < accessible->childCount(); ++i) {
+ if (QAccessibleInterface *child = accessible->child(i)) {
+ if (child->state().selected) {
+ anySelected = true;
+ break;
+ }
+ }
+ }
+
+ *pRetVal = anySelected && !accessible->state().multiSelectable && !accessible->state().extSelectable;
+ return S_OK;
+}
+
+QT_END_NAMESPACE
+
+#endif // QT_NO_ACCESSIBILITY
diff --git a/src/plugins/platforms/windows/uiautomation/qwindowsuiaselectionprovider.h b/src/plugins/platforms/windows/uiautomation/qwindowsuiaselectionprovider.h
new file mode 100644
index 0000000000..5a07a82ac8
--- /dev/null
+++ b/src/plugins/platforms/windows/uiautomation/qwindowsuiaselectionprovider.h
@@ -0,0 +1,69 @@
+/****************************************************************************
+**
+** Copyright (C) 2017 The Qt Company Ltd.
+** Contact: https://www.qt.io/licensing/
+**
+** This file is part of the plugins of the Qt Toolkit.
+**
+** $QT_BEGIN_LICENSE:LGPL$
+** Commercial License Usage
+** Licensees holding valid commercial Qt licenses may use this file in
+** accordance with the commercial license agreement provided with the
+** Software or, alternatively, in accordance with the terms contained in
+** a written agreement between you and The Qt Company. For licensing terms
+** and conditions see https://www.qt.io/terms-conditions. For further
+** information use the contact form at https://www.qt.io/contact-us.
+**
+** GNU Lesser General Public License Usage
+** Alternatively, this file may be used under the terms of the GNU Lesser
+** General Public License version 3 as published by the Free Software
+** Foundation and appearing in the file LICENSE.LGPL3 included in the
+** packaging of this file. Please review the following information to
+** ensure the GNU Lesser General Public License version 3 requirements
+** will be met: https://www.gnu.org/licenses/lgpl-3.0.html.
+**
+** GNU General Public License Usage
+** Alternatively, this file may be used under the terms of the GNU
+** General Public License version 2.0 or (at your option) the GNU General
+** Public license version 3 or any later version approved by the KDE Free
+** Qt Foundation. The licenses are as published by the Free Software
+** Foundation and appearing in the file LICENSE.GPL2 and LICENSE.GPL3
+** included in the packaging of this file. Please review the following
+** information to ensure the GNU General Public License requirements will
+** be met: https://www.gnu.org/licenses/gpl-2.0.html and
+** https://www.gnu.org/licenses/gpl-3.0.html.
+**
+** $QT_END_LICENSE$
+**
+****************************************************************************/
+
+#ifndef QWINDOWSUIASELECTIONPROVIDER_H
+#define QWINDOWSUIASELECTIONPROVIDER_H
+
+#include <QtCore/QtConfig>
+#ifndef QT_NO_ACCESSIBILITY
+
+#include "qwindowsuiabaseprovider.h"
+
+QT_BEGIN_NAMESPACE
+
+// Implements the Selection control pattern provider. Used for Lists.
+class QWindowsUiaSelectionProvider : public QWindowsUiaBaseProvider,
+ public QWindowsComBase<ISelectionProvider>
+{
+ Q_DISABLE_COPY(QWindowsUiaSelectionProvider)
+public:
+ explicit QWindowsUiaSelectionProvider(QAccessible::Id id);
+ virtual ~QWindowsUiaSelectionProvider();
+
+ // ISelectionProvider
+ HRESULT STDMETHODCALLTYPE GetSelection(SAFEARRAY **pRetVal);
+ HRESULT STDMETHODCALLTYPE get_CanSelectMultiple(BOOL *pRetVal);
+ HRESULT STDMETHODCALLTYPE get_IsSelectionRequired(BOOL *pRetVal);
+};
+
+QT_END_NAMESPACE
+
+#endif // QT_NO_ACCESSIBILITY
+
+#endif // QWINDOWSUIASELECTIONPROVIDER_H
diff --git a/src/plugins/platforms/windows/uiautomation/qwindowsuiatableitemprovider.cpp b/src/plugins/platforms/windows/uiautomation/qwindowsuiatableitemprovider.cpp
new file mode 100644
index 0000000000..3ea29fc86c
--- /dev/null
+++ b/src/plugins/platforms/windows/uiautomation/qwindowsuiatableitemprovider.cpp
@@ -0,0 +1,129 @@
+/****************************************************************************
+**
+** Copyright (C) 2017 The Qt Company Ltd.
+** Contact: https://www.qt.io/licensing/
+**
+** This file is part of the plugins of the Qt Toolkit.
+**
+** $QT_BEGIN_LICENSE:LGPL$
+** Commercial License Usage
+** Licensees holding valid commercial Qt licenses may use this file in
+** accordance with the commercial license agreement provided with the
+** Software or, alternatively, in accordance with the terms contained in
+** a written agreement between you and The Qt Company. For licensing terms
+** and conditions see https://www.qt.io/terms-conditions. For further
+** information use the contact form at https://www.qt.io/contact-us.
+**
+** GNU Lesser General Public License Usage
+** Alternatively, this file may be used under the terms of the GNU Lesser
+** General Public License version 3 as published by the Free Software
+** Foundation and appearing in the file LICENSE.LGPL3 included in the
+** packaging of this file. Please review the following information to
+** ensure the GNU Lesser General Public License version 3 requirements
+** will be met: https://www.gnu.org/licenses/lgpl-3.0.html.
+**
+** GNU General Public License Usage
+** Alternatively, this file may be used under the terms of the GNU
+** General Public License version 2.0 or (at your option) the GNU General
+** Public license version 3 or any later version approved by the KDE Free
+** Qt Foundation. The licenses are as published by the Free Software
+** Foundation and appearing in the file LICENSE.GPL2 and LICENSE.GPL3
+** included in the packaging of this file. Please review the following
+** information to ensure the GNU General Public License requirements will
+** be met: https://www.gnu.org/licenses/gpl-2.0.html and
+** https://www.gnu.org/licenses/gpl-3.0.html.
+**
+** $QT_END_LICENSE$
+**
+****************************************************************************/
+
+#include <QtCore/QtConfig>
+#ifndef QT_NO_ACCESSIBILITY
+
+#include "qwindowsuiatableitemprovider.h"
+#include "qwindowsuiamainprovider.h"
+#include "qwindowsuiautils.h"
+#include "qwindowscontext.h"
+
+#include <QtGui/QAccessible>
+#include <QtGui/QAccessibleInterface>
+#include <QtCore/QDebug>
+#include <QtCore/QString>
+
+QT_BEGIN_NAMESPACE
+
+using namespace QWindowsUiAutomation;
+
+
+QWindowsUiaTableItemProvider::QWindowsUiaTableItemProvider(QAccessible::Id id) :
+ QWindowsUiaBaseProvider(id)
+{
+}
+
+QWindowsUiaTableItemProvider::~QWindowsUiaTableItemProvider()
+{
+}
+
+// Returns the providers for the row headers associated with the item.
+HRESULT STDMETHODCALLTYPE QWindowsUiaTableItemProvider::GetRowHeaderItems(SAFEARRAY **pRetVal)
+{
+ qCDebug(lcQpaUiAutomation) << __FUNCTION__;
+
+ if (!pRetVal)
+ return E_INVALIDARG;
+ *pRetVal = nullptr;
+
+ QAccessibleInterface *accessible = accessibleInterface();
+ if (!accessible)
+ return UIA_E_ELEMENTNOTAVAILABLE;
+
+ QAccessibleTableCellInterface *tableCellInterface = accessible->tableCellInterface();
+ if (!tableCellInterface)
+ return UIA_E_ELEMENTNOTAVAILABLE;
+
+ QList<QAccessibleInterface *> headers = tableCellInterface->rowHeaderCells();
+
+ if ((*pRetVal = SafeArrayCreateVector(VT_UNKNOWN, 0, headers.size()))) {
+ for (LONG i = 0; i < headers.size(); ++i) {
+ if (QWindowsUiaMainProvider *headerProvider = QWindowsUiaMainProvider::providerForAccessible(headers.at(i))) {
+ SafeArrayPutElement(*pRetVal, &i, static_cast<IRawElementProviderSimple *>(headerProvider));
+ headerProvider->Release();
+ }
+ }
+ }
+ return S_OK;
+}
+
+// Returns the providers for the column headers associated with the item.
+HRESULT STDMETHODCALLTYPE QWindowsUiaTableItemProvider::GetColumnHeaderItems(SAFEARRAY **pRetVal)
+{
+ qCDebug(lcQpaUiAutomation) << __FUNCTION__;
+
+ if (!pRetVal)
+ return E_INVALIDARG;
+ *pRetVal = nullptr;
+
+ QAccessibleInterface *accessible = accessibleInterface();
+ if (!accessible)
+ return UIA_E_ELEMENTNOTAVAILABLE;
+
+ QAccessibleTableCellInterface *tableCellInterface = accessible->tableCellInterface();
+ if (!tableCellInterface)
+ return UIA_E_ELEMENTNOTAVAILABLE;
+
+ QList<QAccessibleInterface *> headers = tableCellInterface->columnHeaderCells();
+
+ if ((*pRetVal = SafeArrayCreateVector(VT_UNKNOWN, 0, headers.size()))) {
+ for (LONG i = 0; i < headers.size(); ++i) {
+ if (QWindowsUiaMainProvider *headerProvider = QWindowsUiaMainProvider::providerForAccessible(headers.at(i))) {
+ SafeArrayPutElement(*pRetVal, &i, static_cast<IRawElementProviderSimple *>(headerProvider));
+ headerProvider->Release();
+ }
+ }
+ }
+ return S_OK;
+}
+
+QT_END_NAMESPACE
+
+#endif // QT_NO_ACCESSIBILITY
diff --git a/src/plugins/platforms/windows/uiautomation/qwindowsuiatableitemprovider.h b/src/plugins/platforms/windows/uiautomation/qwindowsuiatableitemprovider.h
new file mode 100644
index 0000000000..277884c980
--- /dev/null
+++ b/src/plugins/platforms/windows/uiautomation/qwindowsuiatableitemprovider.h
@@ -0,0 +1,68 @@
+/****************************************************************************
+**
+** Copyright (C) 2017 The Qt Company Ltd.
+** Contact: https://www.qt.io/licensing/
+**
+** This file is part of the plugins of the Qt Toolkit.
+**
+** $QT_BEGIN_LICENSE:LGPL$
+** Commercial License Usage
+** Licensees holding valid commercial Qt licenses may use this file in
+** accordance with the commercial license agreement provided with the
+** Software or, alternatively, in accordance with the terms contained in
+** a written agreement between you and The Qt Company. For licensing terms
+** and conditions see https://www.qt.io/terms-conditions. For further
+** information use the contact form at https://www.qt.io/contact-us.
+**
+** GNU Lesser General Public License Usage
+** Alternatively, this file may be used under the terms of the GNU Lesser
+** General Public License version 3 as published by the Free Software
+** Foundation and appearing in the file LICENSE.LGPL3 included in the
+** packaging of this file. Please review the following information to
+** ensure the GNU Lesser General Public License version 3 requirements
+** will be met: https://www.gnu.org/licenses/lgpl-3.0.html.
+**
+** GNU General Public License Usage
+** Alternatively, this file may be used under the terms of the GNU
+** General Public License version 2.0 or (at your option) the GNU General
+** Public license version 3 or any later version approved by the KDE Free
+** Qt Foundation. The licenses are as published by the Free Software
+** Foundation and appearing in the file LICENSE.GPL2 and LICENSE.GPL3
+** included in the packaging of this file. Please review the following
+** information to ensure the GNU General Public License requirements will
+** be met: https://www.gnu.org/licenses/gpl-2.0.html and
+** https://www.gnu.org/licenses/gpl-3.0.html.
+**
+** $QT_END_LICENSE$
+**
+****************************************************************************/
+
+#ifndef QWINDOWSUIATABLEITEMPROVIDER_H
+#define QWINDOWSUIATABLEITEMPROVIDER_H
+
+#include <QtCore/QtConfig>
+#ifndef QT_NO_ACCESSIBILITY
+
+#include "qwindowsuiabaseprovider.h"
+
+QT_BEGIN_NAMESPACE
+
+// Implements the Table Item control pattern provider. Used by items within a table/tree.
+class QWindowsUiaTableItemProvider : public QWindowsUiaBaseProvider,
+ public QWindowsComBase<ITableItemProvider>
+{
+ Q_DISABLE_COPY(QWindowsUiaTableItemProvider)
+public:
+ explicit QWindowsUiaTableItemProvider(QAccessible::Id id);
+ virtual ~QWindowsUiaTableItemProvider();
+
+ // ITableItemProvider
+ HRESULT STDMETHODCALLTYPE GetRowHeaderItems(SAFEARRAY **pRetVal);
+ HRESULT STDMETHODCALLTYPE GetColumnHeaderItems(SAFEARRAY **pRetVal);
+};
+
+QT_END_NAMESPACE
+
+#endif // QT_NO_ACCESSIBILITY
+
+#endif // QWINDOWSUIATABLEITEMPROVIDER_H
diff --git a/src/plugins/platforms/windows/uiautomation/qwindowsuiatableprovider.cpp b/src/plugins/platforms/windows/uiautomation/qwindowsuiatableprovider.cpp
new file mode 100644
index 0000000000..f79a24536b
--- /dev/null
+++ b/src/plugins/platforms/windows/uiautomation/qwindowsuiatableprovider.cpp
@@ -0,0 +1,154 @@
+/****************************************************************************
+**
+** Copyright (C) 2017 The Qt Company Ltd.
+** Contact: https://www.qt.io/licensing/
+**
+** This file is part of the plugins of the Qt Toolkit.
+**
+** $QT_BEGIN_LICENSE:LGPL$
+** Commercial License Usage
+** Licensees holding valid commercial Qt licenses may use this file in
+** accordance with the commercial license agreement provided with the
+** Software or, alternatively, in accordance with the terms contained in
+** a written agreement between you and The Qt Company. For licensing terms
+** and conditions see https://www.qt.io/terms-conditions. For further
+** information use the contact form at https://www.qt.io/contact-us.
+**
+** GNU Lesser General Public License Usage
+** Alternatively, this file may be used under the terms of the GNU Lesser
+** General Public License version 3 as published by the Free Software
+** Foundation and appearing in the file LICENSE.LGPL3 included in the
+** packaging of this file. Please review the following information to
+** ensure the GNU Lesser General Public License version 3 requirements
+** will be met: https://www.gnu.org/licenses/lgpl-3.0.html.
+**
+** GNU General Public License Usage
+** Alternatively, this file may be used under the terms of the GNU
+** General Public License version 2.0 or (at your option) the GNU General
+** Public license version 3 or any later version approved by the KDE Free
+** Qt Foundation. The licenses are as published by the Free Software
+** Foundation and appearing in the file LICENSE.GPL2 and LICENSE.GPL3
+** included in the packaging of this file. Please review the following
+** information to ensure the GNU General Public License requirements will
+** be met: https://www.gnu.org/licenses/gpl-2.0.html and
+** https://www.gnu.org/licenses/gpl-3.0.html.
+**
+** $QT_END_LICENSE$
+**
+****************************************************************************/
+
+#include <QtCore/QtConfig>
+#ifndef QT_NO_ACCESSIBILITY
+
+#include "qwindowsuiatableprovider.h"
+#include "qwindowsuiamainprovider.h"
+#include "qwindowsuiautils.h"
+#include "qwindowscontext.h"
+
+#include <QtGui/QAccessible>
+#include <QtGui/QAccessibleInterface>
+#include <QtCore/QDebug>
+#include <QtCore/QString>
+
+QT_BEGIN_NAMESPACE
+
+using namespace QWindowsUiAutomation;
+
+
+QWindowsUiaTableProvider::QWindowsUiaTableProvider(QAccessible::Id id) :
+ QWindowsUiaBaseProvider(id)
+{
+}
+
+QWindowsUiaTableProvider::~QWindowsUiaTableProvider()
+{
+}
+
+// Gets the providers for all the row headers in the table.
+HRESULT STDMETHODCALLTYPE QWindowsUiaTableProvider::GetRowHeaders(SAFEARRAY **pRetVal)
+{
+ qCDebug(lcQpaUiAutomation) << __FUNCTION__;
+
+ if (!pRetVal)
+ return E_INVALIDARG;
+ *pRetVal = nullptr;
+
+ QAccessibleInterface *accessible = accessibleInterface();
+ if (!accessible)
+ return UIA_E_ELEMENTNOTAVAILABLE;
+
+ QAccessibleTableInterface *tableInterface = accessible->tableInterface();
+ if (!tableInterface)
+ return UIA_E_ELEMENTNOTAVAILABLE;
+
+ QList<QAccessibleInterface *> headers;
+
+ for (int i = 0; i < tableInterface->rowCount(); ++i) {
+ if (QAccessibleInterface *cell = tableInterface->cellAt(i, 0)) {
+ if (QAccessibleTableCellInterface *tableCellInterface = cell->tableCellInterface()) {
+ headers.append(tableCellInterface->rowHeaderCells());
+ }
+ }
+ }
+ if ((*pRetVal = SafeArrayCreateVector(VT_UNKNOWN, 0, headers.size()))) {
+ for (LONG i = 0; i < headers.size(); ++i) {
+ if (QWindowsUiaMainProvider *headerProvider = QWindowsUiaMainProvider::providerForAccessible(headers.at(i))) {
+ SafeArrayPutElement(*pRetVal, &i, static_cast<IRawElementProviderSimple *>(headerProvider));
+ headerProvider->Release();
+ }
+ }
+ }
+ return S_OK;
+}
+
+// Gets the providers for all the column headers in the table.
+HRESULT STDMETHODCALLTYPE QWindowsUiaTableProvider::GetColumnHeaders(SAFEARRAY **pRetVal)
+{
+ qCDebug(lcQpaUiAutomation) << __FUNCTION__;
+
+ if (!pRetVal)
+ return E_INVALIDARG;
+ *pRetVal = nullptr;
+
+ QAccessibleInterface *accessible = accessibleInterface();
+ if (!accessible)
+ return UIA_E_ELEMENTNOTAVAILABLE;
+
+ QAccessibleTableInterface *tableInterface = accessible->tableInterface();
+ if (!tableInterface)
+ return UIA_E_ELEMENTNOTAVAILABLE;
+
+ QList<QAccessibleInterface *> headers;
+
+ for (int i = 0; i < tableInterface->columnCount(); ++i) {
+ if (QAccessibleInterface *cell = tableInterface->cellAt(0, i)) {
+ if (QAccessibleTableCellInterface *tableCellInterface = cell->tableCellInterface()) {
+ headers.append(tableCellInterface->columnHeaderCells());
+ }
+ }
+ }
+ if ((*pRetVal = SafeArrayCreateVector(VT_UNKNOWN, 0, headers.size()))) {
+ for (LONG i = 0; i < headers.size(); ++i) {
+ if (QWindowsUiaMainProvider *headerProvider = QWindowsUiaMainProvider::providerForAccessible(headers.at(i))) {
+ SafeArrayPutElement(*pRetVal, &i, static_cast<IRawElementProviderSimple *>(headerProvider));
+ headerProvider->Release();
+ }
+ }
+ }
+ return S_OK;
+}
+
+// Returns the primary direction of traversal for the table.
+HRESULT STDMETHODCALLTYPE QWindowsUiaTableProvider::get_RowOrColumnMajor(enum RowOrColumnMajor *pRetVal)
+{
+ qCDebug(lcQpaUiAutomation) << __FUNCTION__;
+
+ if (!pRetVal)
+ return E_INVALIDARG;
+ *pRetVal = RowOrColumnMajor_Indeterminate;
+ return S_OK;
+}
+
+QT_END_NAMESPACE
+
+#endif // QT_NO_ACCESSIBILITY
diff --git a/src/plugins/platforms/windows/uiautomation/qwindowsuiatableprovider.h b/src/plugins/platforms/windows/uiautomation/qwindowsuiatableprovider.h
new file mode 100644
index 0000000000..8cd0acda03
--- /dev/null
+++ b/src/plugins/platforms/windows/uiautomation/qwindowsuiatableprovider.h
@@ -0,0 +1,69 @@
+/****************************************************************************
+**
+** Copyright (C) 2017 The Qt Company Ltd.
+** Contact: https://www.qt.io/licensing/
+**
+** This file is part of the plugins of the Qt Toolkit.
+**
+** $QT_BEGIN_LICENSE:LGPL$
+** Commercial License Usage
+** Licensees holding valid commercial Qt licenses may use this file in
+** accordance with the commercial license agreement provided with the
+** Software or, alternatively, in accordance with the terms contained in
+** a written agreement between you and The Qt Company. For licensing terms
+** and conditions see https://www.qt.io/terms-conditions. For further
+** information use the contact form at https://www.qt.io/contact-us.
+**
+** GNU Lesser General Public License Usage
+** Alternatively, this file may be used under the terms of the GNU Lesser
+** General Public License version 3 as published by the Free Software
+** Foundation and appearing in the file LICENSE.LGPL3 included in the
+** packaging of this file. Please review the following information to
+** ensure the GNU Lesser General Public License version 3 requirements
+** will be met: https://www.gnu.org/licenses/lgpl-3.0.html.
+**
+** GNU General Public License Usage
+** Alternatively, this file may be used under the terms of the GNU
+** General Public License version 2.0 or (at your option) the GNU General
+** Public license version 3 or any later version approved by the KDE Free
+** Qt Foundation. The licenses are as published by the Free Software
+** Foundation and appearing in the file LICENSE.GPL2 and LICENSE.GPL3
+** included in the packaging of this file. Please review the following
+** information to ensure the GNU General Public License requirements will
+** be met: https://www.gnu.org/licenses/gpl-2.0.html and
+** https://www.gnu.org/licenses/gpl-3.0.html.
+**
+** $QT_END_LICENSE$
+**
+****************************************************************************/
+
+#ifndef QWINDOWSUIATABLEPROVIDER_H
+#define QWINDOWSUIATABLEPROVIDER_H
+
+#include <QtCore/QtConfig>
+#ifndef QT_NO_ACCESSIBILITY
+
+#include "qwindowsuiabaseprovider.h"
+
+QT_BEGIN_NAMESPACE
+
+// Implements the Table control pattern provider. Used by tables/trees.
+class QWindowsUiaTableProvider : public QWindowsUiaBaseProvider,
+ public QWindowsComBase<ITableProvider>
+{
+ Q_DISABLE_COPY(QWindowsUiaTableProvider)
+public:
+ explicit QWindowsUiaTableProvider(QAccessible::Id id);
+ virtual ~QWindowsUiaTableProvider();
+
+ // ITableProvider
+ HRESULT STDMETHODCALLTYPE GetRowHeaders(SAFEARRAY **pRetVal);
+ HRESULT STDMETHODCALLTYPE GetColumnHeaders(SAFEARRAY **pRetVal);
+ HRESULT STDMETHODCALLTYPE get_RowOrColumnMajor(enum RowOrColumnMajor *pRetVal);
+};
+
+QT_END_NAMESPACE
+
+#endif // QT_NO_ACCESSIBILITY
+
+#endif // QWINDOWSUIATABLEPROVIDER_H
diff --git a/src/plugins/platforms/windows/uiautomation/qwindowsuiatextprovider.cpp b/src/plugins/platforms/windows/uiautomation/qwindowsuiatextprovider.cpp
new file mode 100644
index 0000000000..e1622933af
--- /dev/null
+++ b/src/plugins/platforms/windows/uiautomation/qwindowsuiatextprovider.cpp
@@ -0,0 +1,261 @@
+/****************************************************************************
+**
+** Copyright (C) 2017 The Qt Company Ltd.
+** Contact: https://www.qt.io/licensing/
+**
+** This file is part of the plugins of the Qt Toolkit.
+**
+** $QT_BEGIN_LICENSE:LGPL$
+** Commercial License Usage
+** Licensees holding valid commercial Qt licenses may use this file in
+** accordance with the commercial license agreement provided with the
+** Software or, alternatively, in accordance with the terms contained in
+** a written agreement between you and The Qt Company. For licensing terms
+** and conditions see https://www.qt.io/terms-conditions. For further
+** information use the contact form at https://www.qt.io/contact-us.
+**
+** GNU Lesser General Public License Usage
+** Alternatively, this file may be used under the terms of the GNU Lesser
+** General Public License version 3 as published by the Free Software
+** Foundation and appearing in the file LICENSE.LGPL3 included in the
+** packaging of this file. Please review the following information to
+** ensure the GNU Lesser General Public License version 3 requirements
+** will be met: https://www.gnu.org/licenses/lgpl-3.0.html.
+**
+** GNU General Public License Usage
+** Alternatively, this file may be used under the terms of the GNU
+** General Public License version 2.0 or (at your option) the GNU General
+** Public license version 3 or any later version approved by the KDE Free
+** Qt Foundation. The licenses are as published by the Free Software
+** Foundation and appearing in the file LICENSE.GPL2 and LICENSE.GPL3
+** included in the packaging of this file. Please review the following
+** information to ensure the GNU General Public License requirements will
+** be met: https://www.gnu.org/licenses/gpl-2.0.html and
+** https://www.gnu.org/licenses/gpl-3.0.html.
+**
+** $QT_END_LICENSE$
+**
+****************************************************************************/
+
+#include <QtCore/QtConfig>
+#ifndef QT_NO_ACCESSIBILITY
+
+#include "qwindowsuiatextprovider.h"
+#include "qwindowsuiautils.h"
+#include "qwindowscontext.h"
+
+#include <QtGui/QAccessible>
+#include <QtGui/QAccessibleInterface>
+#include <QtCore/QDebug>
+#include <QtCore/QString>
+
+QT_BEGIN_NAMESPACE
+
+using namespace QWindowsUiAutomation;
+
+
+QWindowsUiaTextProvider::QWindowsUiaTextProvider(QAccessible::Id id) :
+ QWindowsUiaBaseProvider(id)
+{
+}
+
+QWindowsUiaTextProvider::~QWindowsUiaTextProvider()
+{
+}
+
+HRESULT STDMETHODCALLTYPE QWindowsUiaTextProvider::QueryInterface(REFIID iid, LPVOID *iface)
+{
+ qCDebug(lcQpaUiAutomation) << __FUNCTION__ << this;
+
+ if (!iface)
+ return E_INVALIDARG;
+ *iface = nullptr;
+
+ const bool result = qWindowsComQueryUnknownInterfaceMulti<ITextProvider>(this, iid, iface)
+ || qWindowsComQueryInterface<ITextProvider>(this, iid, iface)
+ || qWindowsComQueryInterface<ITextProvider2>(this, iid, iface);
+ return result ? S_OK : E_NOINTERFACE;
+}
+
+// Returns an array of providers for the selected text ranges.
+HRESULT STDMETHODCALLTYPE QWindowsUiaTextProvider::GetSelection(SAFEARRAY **pRetVal)
+{
+ qCDebug(lcQpaUiAutomation) << __FUNCTION__ << this;
+
+ if (!pRetVal)
+ return E_INVALIDARG;
+ *pRetVal = nullptr;
+
+ QAccessibleInterface *accessible = accessibleInterface();
+ if (!accessible)
+ return UIA_E_ELEMENTNOTAVAILABLE;
+
+ QAccessibleTextInterface *textInterface = accessible->textInterface();
+ if (!textInterface)
+ return UIA_E_ELEMENTNOTAVAILABLE;
+
+ int selCount = textInterface->selectionCount();
+ if (selCount > 0) {
+ // Build a safe array with the text range providers.
+ if ((*pRetVal = SafeArrayCreateVector(VT_UNKNOWN, 0, selCount))) {
+ for (LONG i = 0; i < selCount; ++i) {
+ int startOffset = 0, endOffset = 0;
+ textInterface->selection((int)i, &startOffset, &endOffset);
+ QWindowsUiaTextRangeProvider *textRangeProvider = new QWindowsUiaTextRangeProvider(id(), startOffset, endOffset);
+ SafeArrayPutElement(*pRetVal, &i, static_cast<IUnknown *>(textRangeProvider));
+ textRangeProvider->Release();
+ }
+ }
+ } else {
+ // If there is no selection, we return an array with a single degenerate (empty) text range at the cursor position.
+ if ((*pRetVal = SafeArrayCreateVector(VT_UNKNOWN, 0, 1))) {
+ LONG i = 0;
+ int cursorPosition = textInterface->cursorPosition();
+ QWindowsUiaTextRangeProvider *textRangeProvider = new QWindowsUiaTextRangeProvider(id(), cursorPosition, cursorPosition);
+ SafeArrayPutElement(*pRetVal, &i, static_cast<IUnknown *>(textRangeProvider));
+ textRangeProvider->Release();
+ }
+ }
+ return S_OK;
+}
+
+// Returns an array of providers for the visible text ranges.
+HRESULT STDMETHODCALLTYPE QWindowsUiaTextProvider::GetVisibleRanges(SAFEARRAY **pRetVal)
+{
+ qCDebug(lcQpaUiAutomation) << __FUNCTION__ << this;
+
+ if (!pRetVal)
+ return E_INVALIDARG;
+ *pRetVal = nullptr;
+
+ QAccessibleInterface *accessible = accessibleInterface();
+ if (!accessible)
+ return UIA_E_ELEMENTNOTAVAILABLE;
+
+ QAccessibleTextInterface *textInterface = accessible->textInterface();
+ if (!textInterface)
+ return UIA_E_ELEMENTNOTAVAILABLE;
+
+ // Considering the entire text as visible.
+ if ((*pRetVal = SafeArrayCreateVector(VT_UNKNOWN, 0, 1))) {
+ LONG i = 0;
+ QWindowsUiaTextRangeProvider *textRangeProvider = new QWindowsUiaTextRangeProvider(id(), 0, textInterface->characterCount());
+ SafeArrayPutElement(*pRetVal, &i, static_cast<IUnknown *>(textRangeProvider));
+ textRangeProvider->Release();
+ }
+ return S_OK;
+}
+
+HRESULT STDMETHODCALLTYPE QWindowsUiaTextProvider::RangeFromChild(IRawElementProviderSimple * /*childElement*/,
+ ITextRangeProvider **pRetVal)
+{
+ qCDebug(lcQpaUiAutomation) << __FUNCTION__ << this;
+
+ if (!pRetVal)
+ return E_INVALIDARG;
+ *pRetVal = nullptr;
+ // No children supported.
+ return S_OK;
+}
+
+// Returns a degenerate text range at the specified point.
+HRESULT STDMETHODCALLTYPE QWindowsUiaTextProvider::RangeFromPoint(UiaPoint point, ITextRangeProvider **pRetVal)
+{
+ qCDebug(lcQpaUiAutomation) << __FUNCTION__ << this;
+
+ if (!pRetVal)
+ return E_INVALIDARG;
+ *pRetVal = nullptr;
+
+ QAccessibleInterface *accessible = accessibleInterface();
+ if (!accessible)
+ return UIA_E_ELEMENTNOTAVAILABLE;
+
+ QAccessibleTextInterface *textInterface = accessible->textInterface();
+ if (!textInterface)
+ return UIA_E_ELEMENTNOTAVAILABLE;
+
+ QWindow *window = windowForAccessible(accessible);
+ if (!window)
+ return UIA_E_ELEMENTNOTAVAILABLE;
+
+ QPoint pt;
+ nativeUiaPointToPoint(point, window, &pt);
+
+ int offset = textInterface->offsetAtPoint(pt);
+ if ((offset >= 0) && (offset < textInterface->characterCount())) {
+ *pRetVal = new QWindowsUiaTextRangeProvider(id(), offset, offset);
+ }
+ return S_OK;
+}
+
+// Returns a text range provider for the entire text.
+HRESULT STDMETHODCALLTYPE QWindowsUiaTextProvider::get_DocumentRange(ITextRangeProvider **pRetVal)
+{
+ qCDebug(lcQpaUiAutomation) << __FUNCTION__ << this;
+
+ if (!pRetVal)
+ return E_INVALIDARG;
+ *pRetVal = nullptr;
+
+ QAccessibleInterface *accessible = accessibleInterface();
+ if (!accessible)
+ return UIA_E_ELEMENTNOTAVAILABLE;
+
+ QAccessibleTextInterface *textInterface = accessible->textInterface();
+ if (!textInterface)
+ return UIA_E_ELEMENTNOTAVAILABLE;
+
+ *pRetVal = new QWindowsUiaTextRangeProvider(id(), 0, textInterface->characterCount());
+ return S_OK;
+}
+
+// Currently supporting single selection.
+HRESULT STDMETHODCALLTYPE QWindowsUiaTextProvider::get_SupportedTextSelection(SupportedTextSelection *pRetVal)
+{
+ qCDebug(lcQpaUiAutomation) << __FUNCTION__ << this;
+
+ if (!pRetVal)
+ return E_INVALIDARG;
+ *pRetVal = SupportedTextSelection_Single;
+ return S_OK;
+}
+
+// Not supporting annotations.
+HRESULT STDMETHODCALLTYPE QWindowsUiaTextProvider::RangeFromAnnotation(IRawElementProviderSimple * /*annotationElement*/, ITextRangeProvider **pRetVal)
+{
+ qCDebug(lcQpaUiAutomation) << __FUNCTION__ << this;
+
+ if (!pRetVal)
+ return E_INVALIDARG;
+ *pRetVal = nullptr;
+ return S_OK;
+}
+
+HRESULT STDMETHODCALLTYPE QWindowsUiaTextProvider::GetCaretRange(BOOL *isActive, ITextRangeProvider **pRetVal)
+{
+ qCDebug(lcQpaUiAutomation) << __FUNCTION__ << this;
+
+ if (!isActive || !pRetVal)
+ return E_INVALIDARG;
+ *isActive = FALSE;
+ *pRetVal = nullptr;
+
+ QAccessibleInterface *accessible = accessibleInterface();
+ if (!accessible)
+ return UIA_E_ELEMENTNOTAVAILABLE;
+
+ QAccessibleTextInterface *textInterface = accessible->textInterface();
+ if (!textInterface)
+ return UIA_E_ELEMENTNOTAVAILABLE;
+
+ *isActive = accessible->state().focused;
+
+ int cursorPosition = textInterface->cursorPosition();
+ *pRetVal = new QWindowsUiaTextRangeProvider(id(), cursorPosition, cursorPosition);
+ return S_OK;
+}
+
+QT_END_NAMESPACE
+
+#endif // QT_NO_ACCESSIBILITY
diff --git a/src/plugins/platforms/windows/uiautomation/qwindowsuiatextprovider.h b/src/plugins/platforms/windows/uiautomation/qwindowsuiatextprovider.h
new file mode 100644
index 0000000000..a6d10027fa
--- /dev/null
+++ b/src/plugins/platforms/windows/uiautomation/qwindowsuiatextprovider.h
@@ -0,0 +1,80 @@
+/****************************************************************************
+**
+** Copyright (C) 2017 The Qt Company Ltd.
+** Contact: https://www.qt.io/licensing/
+**
+** This file is part of the plugins of the Qt Toolkit.
+**
+** $QT_BEGIN_LICENSE:LGPL$
+** Commercial License Usage
+** Licensees holding valid commercial Qt licenses may use this file in
+** accordance with the commercial license agreement provided with the
+** Software or, alternatively, in accordance with the terms contained in
+** a written agreement between you and The Qt Company. For licensing terms
+** and conditions see https://www.qt.io/terms-conditions. For further
+** information use the contact form at https://www.qt.io/contact-us.
+**
+** GNU Lesser General Public License Usage
+** Alternatively, this file may be used under the terms of the GNU Lesser
+** General Public License version 3 as published by the Free Software
+** Foundation and appearing in the file LICENSE.LGPL3 included in the
+** packaging of this file. Please review the following information to
+** ensure the GNU Lesser General Public License version 3 requirements
+** will be met: https://www.gnu.org/licenses/lgpl-3.0.html.
+**
+** GNU General Public License Usage
+** Alternatively, this file may be used under the terms of the GNU
+** General Public License version 2.0 or (at your option) the GNU General
+** Public license version 3 or any later version approved by the KDE Free
+** Qt Foundation. The licenses are as published by the Free Software
+** Foundation and appearing in the file LICENSE.GPL2 and LICENSE.GPL3
+** included in the packaging of this file. Please review the following
+** information to ensure the GNU General Public License requirements will
+** be met: https://www.gnu.org/licenses/gpl-2.0.html and
+** https://www.gnu.org/licenses/gpl-3.0.html.
+**
+** $QT_END_LICENSE$
+**
+****************************************************************************/
+
+#ifndef QWINDOWSUIATEXTPROVIDER_H
+#define QWINDOWSUIATEXTPROVIDER_H
+
+#include <QtCore/QtConfig>
+#ifndef QT_NO_ACCESSIBILITY
+
+#include "qwindowsuiabaseprovider.h"
+#include "qwindowsuiatextrangeprovider.h"
+
+QT_BEGIN_NAMESPACE
+
+// Implements the Text control pattern provider. Used for text controls.
+class QWindowsUiaTextProvider : public QWindowsUiaBaseProvider,
+ public QWindowsComBase<ITextProvider2>
+{
+ Q_DISABLE_COPY(QWindowsUiaTextProvider)
+public:
+ explicit QWindowsUiaTextProvider(QAccessible::Id id);
+ ~QWindowsUiaTextProvider();
+
+ // IUnknown overrides
+ HRESULT STDMETHODCALLTYPE QueryInterface(REFIID id, LPVOID *iface);
+
+ // ITextProvider
+ HRESULT STDMETHODCALLTYPE GetSelection(SAFEARRAY **pRetVal);
+ HRESULT STDMETHODCALLTYPE GetVisibleRanges(SAFEARRAY **pRetVal);
+ HRESULT STDMETHODCALLTYPE RangeFromChild(IRawElementProviderSimple *childElement, ITextRangeProvider **pRetVal);
+ HRESULT STDMETHODCALLTYPE RangeFromPoint(UiaPoint point, ITextRangeProvider **pRetVal);
+ HRESULT STDMETHODCALLTYPE get_DocumentRange(ITextRangeProvider **pRetVal);
+ HRESULT STDMETHODCALLTYPE get_SupportedTextSelection(SupportedTextSelection *pRetVal);
+
+ // ITextProvider2
+ HRESULT STDMETHODCALLTYPE RangeFromAnnotation(IRawElementProviderSimple *annotationElement, ITextRangeProvider **pRetVal);
+ HRESULT STDMETHODCALLTYPE GetCaretRange(BOOL *isActive, ITextRangeProvider **pRetVal);
+};
+
+QT_END_NAMESPACE
+
+#endif // QT_NO_ACCESSIBILITY
+
+#endif // QWINDOWSUIATEXTPROVIDER_H
diff --git a/src/plugins/platforms/windows/uiautomation/qwindowsuiatextrangeprovider.cpp b/src/plugins/platforms/windows/uiautomation/qwindowsuiatextrangeprovider.cpp
new file mode 100644
index 0000000000..dae7cbdd5f
--- /dev/null
+++ b/src/plugins/platforms/windows/uiautomation/qwindowsuiatextrangeprovider.cpp
@@ -0,0 +1,554 @@
+/****************************************************************************
+**
+** Copyright (C) 2017 The Qt Company Ltd.
+** Contact: https://www.qt.io/licensing/
+**
+** This file is part of the plugins of the Qt Toolkit.
+**
+** $QT_BEGIN_LICENSE:LGPL$
+** Commercial License Usage
+** Licensees holding valid commercial Qt licenses may use this file in
+** accordance with the commercial license agreement provided with the
+** Software or, alternatively, in accordance with the terms contained in
+** a written agreement between you and The Qt Company. For licensing terms
+** and conditions see https://www.qt.io/terms-conditions. For further
+** information use the contact form at https://www.qt.io/contact-us.
+**
+** GNU Lesser General Public License Usage
+** Alternatively, this file may be used under the terms of the GNU Lesser
+** General Public License version 3 as published by the Free Software
+** Foundation and appearing in the file LICENSE.LGPL3 included in the
+** packaging of this file. Please review the following information to
+** ensure the GNU Lesser General Public License version 3 requirements
+** will be met: https://www.gnu.org/licenses/lgpl-3.0.html.
+**
+** GNU General Public License Usage
+** Alternatively, this file may be used under the terms of the GNU
+** General Public License version 2.0 or (at your option) the GNU General
+** Public license version 3 or any later version approved by the KDE Free
+** Qt Foundation. The licenses are as published by the Free Software
+** Foundation and appearing in the file LICENSE.GPL2 and LICENSE.GPL3
+** included in the packaging of this file. Please review the following
+** information to ensure the GNU General Public License requirements will
+** be met: https://www.gnu.org/licenses/gpl-2.0.html and
+** https://www.gnu.org/licenses/gpl-3.0.html.
+**
+** $QT_END_LICENSE$
+**
+****************************************************************************/
+
+#include <QtCore/QtConfig>
+#ifndef QT_NO_ACCESSIBILITY
+
+#include "qwindowsuiatextrangeprovider.h"
+#include "qwindowsuiamainprovider.h"
+#include "qwindowsuiautils.h"
+#include "qwindowscontext.h"
+
+#include <QtGui/QAccessible>
+#include <QtGui/QAccessibleInterface>
+#include <QtCore/QDebug>
+#include <QtCore/QString>
+
+QT_BEGIN_NAMESPACE
+
+using namespace QWindowsUiAutomation;
+
+
+QWindowsUiaTextRangeProvider::QWindowsUiaTextRangeProvider(QAccessible::Id id, int startOffset, int endOffset) :
+ QWindowsUiaBaseProvider(id),
+ m_startOffset(startOffset),
+ m_endOffset(endOffset)
+{
+ qCDebug(lcQpaUiAutomation) << __FUNCTION__ << this << startOffset << endOffset;
+}
+
+QWindowsUiaTextRangeProvider::~QWindowsUiaTextRangeProvider()
+{
+ qCDebug(lcQpaUiAutomation) << __FUNCTION__ << this;
+}
+
+HRESULT QWindowsUiaTextRangeProvider::AddToSelection()
+{
+ qCDebug(lcQpaUiAutomation) << __FUNCTION__ << this;
+ return Select();
+}
+
+HRESULT QWindowsUiaTextRangeProvider::Clone(ITextRangeProvider **pRetVal)
+{
+ qCDebug(lcQpaUiAutomation) << __FUNCTION__ << this;
+
+ if (!pRetVal)
+ return E_INVALIDARG;
+
+ *pRetVal = new QWindowsUiaTextRangeProvider(id(), m_startOffset, m_endOffset);
+ return S_OK;
+}
+
+// Two ranges are considered equal if their start/end points are the same.
+HRESULT QWindowsUiaTextRangeProvider::Compare(ITextRangeProvider *range, BOOL *pRetVal)
+{
+ qCDebug(lcQpaUiAutomation) << __FUNCTION__ << this;
+
+ if (!range || !pRetVal)
+ return E_INVALIDARG;
+
+ QWindowsUiaTextRangeProvider *targetProvider = static_cast<QWindowsUiaTextRangeProvider *>(range);
+ *pRetVal = ((targetProvider->m_startOffset == m_startOffset) && (targetProvider->m_endOffset == m_endOffset));
+ return S_OK;
+}
+
+// Compare different endpoinds between two providers.
+HRESULT QWindowsUiaTextRangeProvider::CompareEndpoints(TextPatternRangeEndpoint endpoint,
+ ITextRangeProvider *targetRange,
+ TextPatternRangeEndpoint targetEndpoint,
+ int *pRetVal)
+{
+ qCDebug(lcQpaUiAutomation) << __FUNCTION__
+ << "endpoint=" << endpoint << "targetRange=" << targetRange
+ << "targetEndpoint=" << targetEndpoint << "this: " << this;
+
+ if (!targetRange || !pRetVal)
+ return E_INVALIDARG;
+
+ QWindowsUiaTextRangeProvider *targetProvider = static_cast<QWindowsUiaTextRangeProvider *>(targetRange);
+
+ int point = (endpoint == TextPatternRangeEndpoint_Start) ? m_startOffset : m_endOffset;
+ int targetPoint = (targetEndpoint == TextPatternRangeEndpoint_Start) ?
+ targetProvider->m_startOffset : targetProvider->m_endOffset;
+ *pRetVal = point - targetPoint;
+ return S_OK;
+}
+
+// Expands/normalizes the range for a given text unit.
+HRESULT QWindowsUiaTextRangeProvider::ExpandToEnclosingUnit(TextUnit unit)
+{
+ qCDebug(lcQpaUiAutomation) << __FUNCTION__ << "unit=" << unit << "this: " << this;
+
+ QAccessibleInterface *accessible = accessibleInterface();
+ if (!accessible)
+ return UIA_E_ELEMENTNOTAVAILABLE;
+
+ QAccessibleTextInterface *textInterface = accessible->textInterface();
+ if (!textInterface)
+ return UIA_E_ELEMENTNOTAVAILABLE;
+
+ int len = textInterface->characterCount();
+ if (len < 1) {
+ m_startOffset = 0;
+ m_endOffset = 0;
+ } else {
+ if (unit == TextUnit_Character) {
+ m_startOffset = qBound(0, m_startOffset, len - 1);
+ m_endOffset = m_startOffset + 1;
+ } else {
+ QString text = textInterface->text(0, len);
+ for (int t = m_startOffset; t >= 0; --t) {
+ if (!isTextUnitSeparator(unit, text[t]) && ((t == 0) || isTextUnitSeparator(unit, text[t - 1]))) {
+ m_startOffset = t;
+ break;
+ }
+ }
+ for (int t = m_startOffset; t < len; ++t) {
+ if ((t == len - 1) || (isTextUnitSeparator(unit, text[t]) && ((unit == TextUnit_Word) || !isTextUnitSeparator(unit, text[t + 1])))) {
+ m_endOffset = t + 1;
+ break;
+ }
+ }
+ }
+ }
+ return S_OK;
+}
+
+// Not supported.
+HRESULT QWindowsUiaTextRangeProvider::FindAttribute(TEXTATTRIBUTEID /* attributeId */,
+ VARIANT /* val */, BOOL /* backward */,
+ ITextRangeProvider **pRetVal)
+{
+ if (!pRetVal)
+ return E_INVALIDARG;
+ *pRetVal = nullptr;
+ return S_OK;
+}
+
+// Returns the value of a given attribute.
+HRESULT STDMETHODCALLTYPE QWindowsUiaTextRangeProvider::GetAttributeValue(TEXTATTRIBUTEID attributeId,
+ VARIANT *pRetVal)
+{
+ qCDebug(lcQpaUiAutomation) << __FUNCTION__ << "attributeId=" << attributeId << "this: " << this;
+
+ if (!pRetVal)
+ return E_INVALIDARG;
+ clearVariant(pRetVal);
+
+ QAccessibleInterface *accessible = accessibleInterface();
+ if (!accessible)
+ return UIA_E_ELEMENTNOTAVAILABLE;
+
+ QAccessibleTextInterface *textInterface = accessible->textInterface();
+ if (!textInterface)
+ return UIA_E_ELEMENTNOTAVAILABLE;
+
+ switch (attributeId) {
+ case UIA_IsReadOnlyAttributeId:
+ setVariantBool(accessible->state().readOnly, pRetVal);
+ break;
+ case UIA_CaretPositionAttributeId:
+ if (textInterface->cursorPosition() == 0)
+ setVariantI4(CaretPosition_BeginningOfLine, pRetVal);
+ else if (textInterface->cursorPosition() == textInterface->characterCount())
+ setVariantI4(CaretPosition_EndOfLine, pRetVal);
+ else
+ setVariantI4(CaretPosition_Unknown, pRetVal);
+ break;
+ default:
+ break;
+ }
+ return S_OK;
+}
+
+// Returns an array of bounding rectangles for text lines within the range.
+HRESULT QWindowsUiaTextRangeProvider::GetBoundingRectangles(SAFEARRAY **pRetVal)
+{
+ qCDebug(lcQpaUiAutomation) << __FUNCTION__ << this;
+
+ if (!pRetVal)
+ return E_INVALIDARG;
+
+ QAccessibleInterface *accessible = accessibleInterface();
+ if (!accessible)
+ return UIA_E_ELEMENTNOTAVAILABLE;
+
+ QAccessibleTextInterface *textInterface = accessible->textInterface();
+ if (!textInterface)
+ return UIA_E_ELEMENTNOTAVAILABLE;
+
+ QWindow *window = windowForAccessible(accessible);
+ if (!window)
+ return UIA_E_ELEMENTNOTAVAILABLE;
+
+ int len = textInterface->characterCount();
+ QList<QRect> rectList;
+
+ if ((m_startOffset >= 0) && (m_endOffset <= len) && (m_startOffset < m_endOffset)) {
+ int start, end;
+ textInterface->textAtOffset(m_startOffset, QAccessible::LineBoundary, &start, &end);
+ while ((start >= 0) && (end >= 0)) {
+ int startRange = qMax(start, m_startOffset);
+ int endRange = qMin(end, m_endOffset);
+ if (startRange < endRange) {
+ // Calculates a bounding rectangle for the line and adds it to the list.
+ QRect startRect = textInterface->characterRect(startRange);
+ QRect endRect = textInterface->characterRect(endRange - 1);
+ QRect lineRect(qMin(startRect.x(), endRect.x()),
+ qMin(startRect.y(), endRect.y()),
+ qMax(startRect.x() + startRect.width(), endRect.x() + endRect.width()) - qMin(startRect.x(), endRect.x()),
+ qMax(startRect.y() + startRect.height(), endRect.y() + endRect.height()) - qMin(startRect.y(), endRect.y()));
+ rectList.append(lineRect);
+ }
+ if (end >= len) break;
+ textInterface->textAfterOffset(end + 1, QAccessible::LineBoundary, &start, &end);
+ }
+ }
+
+ if ((*pRetVal = SafeArrayCreateVector(VT_R8, 0, 4 * rectList.size()))) {
+ for (int i = 0; i < rectList.size(); ++i) {
+ // Scale rect for high DPI screens.
+ UiaRect uiaRect;
+ rectToNativeUiaRect(rectList[i], window, &uiaRect);
+ double coords[4] = { uiaRect.left, uiaRect.top, uiaRect.width, uiaRect.height };
+ for (int j = 0; j < 4; ++j) {
+ LONG idx = 4 * i + j;
+ SafeArrayPutElement(*pRetVal, &idx, &coords[j]);
+ }
+ }
+ }
+ return S_OK;
+}
+
+// Returns an array of children elements embedded within the range.
+HRESULT QWindowsUiaTextRangeProvider::GetChildren(SAFEARRAY **pRetVal)
+{
+ qCDebug(lcQpaUiAutomation) << __FUNCTION__ << this;
+
+ if (!pRetVal)
+ return E_INVALIDARG;
+ // Not supporting any children.
+ *pRetVal = SafeArrayCreateVector(VT_UNKNOWN, 0, 0);
+ return S_OK;
+}
+
+// Returns a provider for the enclosing element (text to which the range belongs).
+HRESULT QWindowsUiaTextRangeProvider::GetEnclosingElement(IRawElementProviderSimple **pRetVal)
+{
+ qCDebug(lcQpaUiAutomation) << __FUNCTION__ << this;
+
+ if (!pRetVal)
+ return E_INVALIDARG;
+
+ QAccessibleInterface *accessible = accessibleInterface();
+ if (!accessible)
+ return UIA_E_ELEMENTNOTAVAILABLE;
+
+ *pRetVal = QWindowsUiaMainProvider::providerForAccessible(accessible);
+ return S_OK;
+}
+
+// Gets the text within the range.
+HRESULT QWindowsUiaTextRangeProvider::GetText(int maxLength, BSTR *pRetVal)
+{
+ qCDebug(lcQpaUiAutomation) << __FUNCTION__ << maxLength << "this: " << this;
+
+ if (!pRetVal)
+ return E_INVALIDARG;
+ *pRetVal = nullptr;
+
+ QAccessibleInterface *accessible = accessibleInterface();
+ if (!accessible)
+ return UIA_E_ELEMENTNOTAVAILABLE;
+
+ QAccessibleTextInterface *textInterface = accessible->textInterface();
+ if (!textInterface)
+ return UIA_E_ELEMENTNOTAVAILABLE;
+
+ int len = textInterface->characterCount();
+ QString rangeText;
+ if ((m_startOffset >= 0) && (m_endOffset <= len) && (m_startOffset < m_endOffset))
+ rangeText = textInterface->text(m_startOffset, m_endOffset);
+
+ if ((maxLength > -1) && (rangeText.size() > maxLength))
+ rangeText.truncate(maxLength);
+ *pRetVal = bStrFromQString(rangeText);
+ return S_OK;
+}
+
+// Moves the range a specified number of units (and normalizes it).
+HRESULT QWindowsUiaTextRangeProvider::Move(TextUnit unit, int count, int *pRetVal)
+{
+ qCDebug(lcQpaUiAutomation) << __FUNCTION__ << "unit=" << unit << "count=" << count << "this: " << this;
+
+ if (!pRetVal)
+ return E_INVALIDARG;
+ *pRetVal = 0;
+
+ QAccessibleInterface *accessible = accessibleInterface();
+ if (!accessible)
+ return UIA_E_ELEMENTNOTAVAILABLE;
+
+ QAccessibleTextInterface *textInterface = accessible->textInterface();
+ if (!textInterface)
+ return UIA_E_ELEMENTNOTAVAILABLE;
+
+ int len = textInterface->characterCount();
+
+ if (len < 1)
+ return S_OK;
+
+ if (unit == TextUnit_Character) {
+ // Moves the start point, ensuring it lies within the bounds.
+ int start = qBound(0, m_startOffset + count, len - 1);
+ // If range was initially empty, leaves it as is; otherwise, normalizes it to one char.
+ m_endOffset = (m_endOffset > m_startOffset) ? start + 1 : start;
+ *pRetVal = start - m_startOffset; // Returns the actually moved distance.
+ m_startOffset = start;
+ } else {
+ if (count > 0) {
+ MoveEndpointByUnit(TextPatternRangeEndpoint_End, unit, count, pRetVal);
+ MoveEndpointByUnit(TextPatternRangeEndpoint_Start, unit, count, pRetVal);
+ } else {
+ MoveEndpointByUnit(TextPatternRangeEndpoint_Start, unit, count, pRetVal);
+ MoveEndpointByUnit(TextPatternRangeEndpoint_End, unit, count, pRetVal);
+ }
+ }
+ return S_OK;
+}
+
+// Copies the value of an end point from one range to another.
+HRESULT QWindowsUiaTextRangeProvider::MoveEndpointByRange(TextPatternRangeEndpoint endpoint,
+ ITextRangeProvider *targetRange,
+ TextPatternRangeEndpoint targetEndpoint)
+{
+ if (!targetRange)
+ return E_INVALIDARG;
+
+ qCDebug(lcQpaUiAutomation) << __FUNCTION__
+ << "endpoint=" << endpoint << "targetRange=" << targetRange << "targetEndpoint=" << targetEndpoint << "this: " << this;
+
+ QWindowsUiaTextRangeProvider *targetProvider = static_cast<QWindowsUiaTextRangeProvider *>(targetRange);
+
+ int targetPoint = (targetEndpoint == TextPatternRangeEndpoint_Start) ?
+ targetProvider->m_startOffset : targetProvider->m_endOffset;
+
+ // If the moved endpoint crosses the other endpoint, that one is moved too.
+ if (endpoint == TextPatternRangeEndpoint_Start) {
+ m_startOffset = targetPoint;
+ if (m_endOffset < m_startOffset)
+ m_endOffset = m_startOffset;
+ } else {
+ m_endOffset = targetPoint;
+ if (m_endOffset < m_startOffset)
+ m_startOffset = m_endOffset;
+ }
+ return S_OK;
+}
+
+// Moves an endpoint an specific number of units.
+HRESULT QWindowsUiaTextRangeProvider::MoveEndpointByUnit(TextPatternRangeEndpoint endpoint,
+ TextUnit unit, int count,
+ int *pRetVal)
+{
+ qCDebug(lcQpaUiAutomation) << __FUNCTION__
+ << "endpoint=" << endpoint << "unit=" << unit << "count=" << count << "this: " << this;
+
+ if (!pRetVal)
+ return E_INVALIDARG;
+ *pRetVal = 0;
+
+ QAccessibleInterface *accessible = accessibleInterface();
+ if (!accessible)
+ return UIA_E_ELEMENTNOTAVAILABLE;
+
+ QAccessibleTextInterface *textInterface = accessible->textInterface();
+ if (!textInterface)
+ return UIA_E_ELEMENTNOTAVAILABLE;
+
+ int len = textInterface->characterCount();
+
+ if (len < 1)
+ return S_OK;
+
+ if (unit == TextUnit_Character) {
+ if (endpoint == TextPatternRangeEndpoint_Start) {
+ int boundedValue = qBound(0, m_startOffset + count, len - 1);
+ *pRetVal = boundedValue - m_startOffset;
+ m_startOffset = boundedValue;
+ m_endOffset = qBound(m_startOffset, m_endOffset, len);
+ } else {
+ int boundedValue = qBound(0, m_endOffset + count, len);
+ *pRetVal = boundedValue - m_endOffset;
+ m_endOffset = boundedValue;
+ m_startOffset = qBound(0, m_startOffset, m_endOffset);
+ }
+ } else {
+ QString text = textInterface->text(0, len);
+ int moved = 0;
+
+ if (endpoint == TextPatternRangeEndpoint_Start) {
+ if (count > 0) {
+ for (int t = m_startOffset; (t < len - 1) && (moved < count); ++t) {
+ if (isTextUnitSeparator(unit, text[t]) && !isTextUnitSeparator(unit, text[t + 1])) {
+ m_startOffset = t + 1;
+ ++moved;
+ }
+ }
+ m_endOffset = qBound(m_startOffset, m_endOffset, len);
+ } else {
+ for (int t = m_startOffset - 1; (t >= 0) && (moved > count); --t) {
+ if (!isTextUnitSeparator(unit, text[t]) && ((t == 0) || isTextUnitSeparator(unit, text[t - 1]))) {
+ m_startOffset = t;
+ --moved;
+ }
+ }
+ }
+ } else {
+ if (count > 0) {
+ for (int t = m_endOffset; (t < len) && (moved < count); ++t) {
+ if ((t == len - 1) || (isTextUnitSeparator(unit, text[t]) && ((unit == TextUnit_Word) || !isTextUnitSeparator(unit, text[t + 1])))) {
+ m_endOffset = t + 1;
+ ++moved;
+ }
+ }
+ } else {
+ int end = 0;
+ for (int t = m_endOffset - 2; (t > 0) && (moved > count); --t) {
+ if (isTextUnitSeparator(unit, text[t]) && ((unit == TextUnit_Word) || !isTextUnitSeparator(unit, text[t + 1]))) {
+ end = t + 1;
+ --moved;
+ }
+ }
+ m_endOffset = end;
+ m_startOffset = qBound(0, m_startOffset, m_endOffset);
+ }
+ }
+ *pRetVal = moved;
+ }
+ return S_OK;
+}
+
+HRESULT QWindowsUiaTextRangeProvider::RemoveFromSelection()
+{
+ qCDebug(lcQpaUiAutomation) << __FUNCTION__;
+ // unselects all
+ return unselect();
+}
+
+// Scrolls the range into view.
+HRESULT QWindowsUiaTextRangeProvider::ScrollIntoView(BOOL alignToTop)
+{
+ qCDebug(lcQpaUiAutomation) << __FUNCTION__ << "alignToTop=" << alignToTop << "this: " << this;
+
+ QAccessibleInterface *accessible = accessibleInterface();
+ if (!accessible)
+ return UIA_E_ELEMENTNOTAVAILABLE;
+
+ QAccessibleTextInterface *textInterface = accessible->textInterface();
+ if (!textInterface)
+ return UIA_E_ELEMENTNOTAVAILABLE;
+
+ textInterface->scrollToSubstring(m_startOffset, m_endOffset);
+ return S_OK;
+}
+
+// Selects the range.
+HRESULT QWindowsUiaTextRangeProvider::Select()
+{
+ qCDebug(lcQpaUiAutomation) << __FUNCTION__ << this;
+
+ QAccessibleInterface *accessible = accessibleInterface();
+ if (!accessible)
+ return UIA_E_ELEMENTNOTAVAILABLE;
+
+ QAccessibleTextInterface *textInterface = accessible->textInterface();
+ if (!textInterface)
+ return UIA_E_ELEMENTNOTAVAILABLE;
+
+ // unselects all and adds a new selection
+ unselect();
+ textInterface->addSelection(m_startOffset, m_endOffset);
+ return S_OK;
+}
+
+// Not supported.
+HRESULT QWindowsUiaTextRangeProvider::FindTextW(BSTR /* text */, BOOL /* backward */,
+ BOOL /* ignoreCase */,
+ ITextRangeProvider **pRetVal)
+{
+ if (!pRetVal)
+ return E_INVALIDARG;
+ *pRetVal = nullptr;
+ return S_OK;
+}
+
+// Removes all selected ranges from the text element.
+HRESULT QWindowsUiaTextRangeProvider::unselect()
+{
+ qCDebug(lcQpaUiAutomation) << __FUNCTION__ << this;
+
+ QAccessibleInterface *accessible = accessibleInterface();
+ if (!accessible)
+ return UIA_E_ELEMENTNOTAVAILABLE;
+
+ QAccessibleTextInterface *textInterface = accessible->textInterface();
+ if (!textInterface)
+ return UIA_E_ELEMENTNOTAVAILABLE;
+
+ int selCount = textInterface->selectionCount();
+
+ for (int i = selCount - 1; i >= 0; --i)
+ textInterface->removeSelection(i);
+ return S_OK;
+}
+
+QT_END_NAMESPACE
+
+#endif // QT_NO_ACCESSIBILITY
diff --git a/src/plugins/platforms/windows/uiautomation/qwindowsuiatextrangeprovider.h b/src/plugins/platforms/windows/uiautomation/qwindowsuiatextrangeprovider.h
new file mode 100644
index 0000000000..6fe6502c41
--- /dev/null
+++ b/src/plugins/platforms/windows/uiautomation/qwindowsuiatextrangeprovider.h
@@ -0,0 +1,88 @@
+/****************************************************************************
+**
+** Copyright (C) 2017 The Qt Company Ltd.
+** Contact: https://www.qt.io/licensing/
+**
+** This file is part of the plugins of the Qt Toolkit.
+**
+** $QT_BEGIN_LICENSE:LGPL$
+** Commercial License Usage
+** Licensees holding valid commercial Qt licenses may use this file in
+** accordance with the commercial license agreement provided with the
+** Software or, alternatively, in accordance with the terms contained in
+** a written agreement between you and The Qt Company. For licensing terms
+** and conditions see https://www.qt.io/terms-conditions. For further
+** information use the contact form at https://www.qt.io/contact-us.
+**
+** GNU Lesser General Public License Usage
+** Alternatively, this file may be used under the terms of the GNU Lesser
+** General Public License version 3 as published by the Free Software
+** Foundation and appearing in the file LICENSE.LGPL3 included in the
+** packaging of this file. Please review the following information to
+** ensure the GNU Lesser General Public License version 3 requirements
+** will be met: https://www.gnu.org/licenses/lgpl-3.0.html.
+**
+** GNU General Public License Usage
+** Alternatively, this file may be used under the terms of the GNU
+** General Public License version 2.0 or (at your option) the GNU General
+** Public license version 3 or any later version approved by the KDE Free
+** Qt Foundation. The licenses are as published by the Free Software
+** Foundation and appearing in the file LICENSE.GPL2 and LICENSE.GPL3
+** included in the packaging of this file. Please review the following
+** information to ensure the GNU General Public License requirements will
+** be met: https://www.gnu.org/licenses/gpl-2.0.html and
+** https://www.gnu.org/licenses/gpl-3.0.html.
+**
+** $QT_END_LICENSE$
+**
+****************************************************************************/
+
+#ifndef QWINDOWSUIATEXTRANGEPROVIDER_H
+#define QWINDOWSUIATEXTRANGEPROVIDER_H
+
+#include <QtCore/QtConfig>
+#ifndef QT_NO_ACCESSIBILITY
+
+#include "qwindowsuiabaseprovider.h"
+
+QT_BEGIN_NAMESPACE
+
+// Implements the Text Range control pattern provider. Used for text controls.
+class QWindowsUiaTextRangeProvider : public QWindowsUiaBaseProvider,
+ public QWindowsComBase<ITextRangeProvider>
+{
+ Q_DISABLE_COPY(QWindowsUiaTextRangeProvider)
+public:
+ explicit QWindowsUiaTextRangeProvider(QAccessible::Id id, int startOffset, int endOffset);
+ virtual ~QWindowsUiaTextRangeProvider();
+
+ HRESULT STDMETHODCALLTYPE AddToSelection();
+ HRESULT STDMETHODCALLTYPE Clone(ITextRangeProvider **pRetVal);
+ HRESULT STDMETHODCALLTYPE Compare(ITextRangeProvider *range, BOOL *pRetVal);
+ HRESULT STDMETHODCALLTYPE CompareEndpoints(TextPatternRangeEndpoint endpoint, ITextRangeProvider *targetRange, TextPatternRangeEndpoint targetEndpoint, int *pRetVal);
+ HRESULT STDMETHODCALLTYPE ExpandToEnclosingUnit(TextUnit unit);
+ HRESULT STDMETHODCALLTYPE FindAttribute(TEXTATTRIBUTEID attributeId, VARIANT val, BOOL backward, ITextRangeProvider **pRetVal);
+ HRESULT STDMETHODCALLTYPE FindText(BSTR text, BOOL backward, BOOL ignoreCase, ITextRangeProvider **pRetVal);
+ HRESULT STDMETHODCALLTYPE GetAttributeValue(TEXTATTRIBUTEID attributeId, VARIANT *pRetVal);
+ HRESULT STDMETHODCALLTYPE GetBoundingRectangles(SAFEARRAY **pRetVal);
+ HRESULT STDMETHODCALLTYPE GetChildren(SAFEARRAY **pRetVal);
+ HRESULT STDMETHODCALLTYPE GetEnclosingElement(IRawElementProviderSimple **pRetVal);
+ HRESULT STDMETHODCALLTYPE GetText(int maxLength, BSTR *pRetVal);
+ HRESULT STDMETHODCALLTYPE Move(TextUnit unit, int count, int *pRetVal);
+ HRESULT STDMETHODCALLTYPE MoveEndpointByRange(TextPatternRangeEndpoint endpoint, ITextRangeProvider *targetRange, TextPatternRangeEndpoint targetEndpoint);
+ HRESULT STDMETHODCALLTYPE MoveEndpointByUnit(TextPatternRangeEndpoint endpoint, TextUnit unit, int count, int *pRetVal);
+ HRESULT STDMETHODCALLTYPE RemoveFromSelection();
+ HRESULT STDMETHODCALLTYPE ScrollIntoView(BOOL alignToTop);
+ HRESULT STDMETHODCALLTYPE Select();
+
+private:
+ HRESULT unselect();
+ int m_startOffset;
+ int m_endOffset;
+};
+
+QT_END_NAMESPACE
+
+#endif // QT_NO_ACCESSIBILITY
+
+#endif // QWINDOWSUIATEXTRANGEPROVIDER_H
diff --git a/src/plugins/platforms/windows/uiautomation/qwindowsuiatoggleprovider.cpp b/src/plugins/platforms/windows/uiautomation/qwindowsuiatoggleprovider.cpp
new file mode 100644
index 0000000000..01cdfd7e91
--- /dev/null
+++ b/src/plugins/platforms/windows/uiautomation/qwindowsuiatoggleprovider.cpp
@@ -0,0 +1,105 @@
+/****************************************************************************
+**
+** Copyright (C) 2017 The Qt Company Ltd.
+** Contact: https://www.qt.io/licensing/
+**
+** This file is part of the plugins of the Qt Toolkit.
+**
+** $QT_BEGIN_LICENSE:LGPL$
+** Commercial License Usage
+** Licensees holding valid commercial Qt licenses may use this file in
+** accordance with the commercial license agreement provided with the
+** Software or, alternatively, in accordance with the terms contained in
+** a written agreement between you and The Qt Company. For licensing terms
+** and conditions see https://www.qt.io/terms-conditions. For further
+** information use the contact form at https://www.qt.io/contact-us.
+**
+** GNU Lesser General Public License Usage
+** Alternatively, this file may be used under the terms of the GNU Lesser
+** General Public License version 3 as published by the Free Software
+** Foundation and appearing in the file LICENSE.LGPL3 included in the
+** packaging of this file. Please review the following information to
+** ensure the GNU Lesser General Public License version 3 requirements
+** will be met: https://www.gnu.org/licenses/lgpl-3.0.html.
+**
+** GNU General Public License Usage
+** Alternatively, this file may be used under the terms of the GNU
+** General Public License version 2.0 or (at your option) the GNU General
+** Public license version 3 or any later version approved by the KDE Free
+** Qt Foundation. The licenses are as published by the Free Software
+** Foundation and appearing in the file LICENSE.GPL2 and LICENSE.GPL3
+** included in the packaging of this file. Please review the following
+** information to ensure the GNU General Public License requirements will
+** be met: https://www.gnu.org/licenses/gpl-2.0.html and
+** https://www.gnu.org/licenses/gpl-3.0.html.
+**
+** $QT_END_LICENSE$
+**
+****************************************************************************/
+
+#include <QtCore/QtConfig>
+#ifndef QT_NO_ACCESSIBILITY
+
+#include "qwindowsuiatoggleprovider.h"
+#include "qwindowsuiautils.h"
+#include "qwindowscontext.h"
+
+#include <QtGui/QAccessible>
+#include <QtGui/QAccessibleInterface>
+#include <QtCore/QDebug>
+#include <QtCore/QString>
+
+QT_BEGIN_NAMESPACE
+
+using namespace QWindowsUiAutomation;
+
+
+QWindowsUiaToggleProvider::QWindowsUiaToggleProvider(QAccessible::Id id) :
+ QWindowsUiaBaseProvider(id)
+{
+}
+
+QWindowsUiaToggleProvider::~QWindowsUiaToggleProvider()
+{
+}
+
+// toggles the state by invoking the toggle action
+HRESULT STDMETHODCALLTYPE QWindowsUiaToggleProvider::Toggle()
+{
+ qCDebug(lcQpaUiAutomation) << __FUNCTION__;
+
+ QAccessibleInterface *accessible = accessibleInterface();
+ if (!accessible)
+ return UIA_E_ELEMENTNOTAVAILABLE;
+
+ QAccessibleActionInterface *actionInterface = accessible->actionInterface();
+ if (!actionInterface)
+ return UIA_E_ELEMENTNOTAVAILABLE;
+
+ actionInterface->doAction(QAccessibleActionInterface::toggleAction());
+ return S_OK;
+}
+
+// Gets the current toggle state.
+HRESULT STDMETHODCALLTYPE QWindowsUiaToggleProvider::get_ToggleState(ToggleState *pRetVal)
+{
+ qCDebug(lcQpaUiAutomation) << __FUNCTION__;
+
+ if (!pRetVal)
+ return E_INVALIDARG;
+ *pRetVal = ToggleState_Off;
+
+ QAccessibleInterface *accessible = accessibleInterface();
+ if (!accessible)
+ return UIA_E_ELEMENTNOTAVAILABLE;
+
+ if (accessible->state().checked)
+ *pRetVal = accessible->state().checkStateMixed ? ToggleState_Indeterminate : ToggleState_On;
+ else
+ *pRetVal = ToggleState_Off;
+ return S_OK;
+}
+
+QT_END_NAMESPACE
+
+#endif // QT_NO_ACCESSIBILITY
diff --git a/src/plugins/platforms/windows/uiautomation/qwindowsuiatoggleprovider.h b/src/plugins/platforms/windows/uiautomation/qwindowsuiatoggleprovider.h
new file mode 100644
index 0000000000..a0df983e40
--- /dev/null
+++ b/src/plugins/platforms/windows/uiautomation/qwindowsuiatoggleprovider.h
@@ -0,0 +1,68 @@
+/****************************************************************************
+**
+** Copyright (C) 2017 The Qt Company Ltd.
+** Contact: https://www.qt.io/licensing/
+**
+** This file is part of the plugins of the Qt Toolkit.
+**
+** $QT_BEGIN_LICENSE:LGPL$
+** Commercial License Usage
+** Licensees holding valid commercial Qt licenses may use this file in
+** accordance with the commercial license agreement provided with the
+** Software or, alternatively, in accordance with the terms contained in
+** a written agreement between you and The Qt Company. For licensing terms
+** and conditions see https://www.qt.io/terms-conditions. For further
+** information use the contact form at https://www.qt.io/contact-us.
+**
+** GNU Lesser General Public License Usage
+** Alternatively, this file may be used under the terms of the GNU Lesser
+** General Public License version 3 as published by the Free Software
+** Foundation and appearing in the file LICENSE.LGPL3 included in the
+** packaging of this file. Please review the following information to
+** ensure the GNU Lesser General Public License version 3 requirements
+** will be met: https://www.gnu.org/licenses/lgpl-3.0.html.
+**
+** GNU General Public License Usage
+** Alternatively, this file may be used under the terms of the GNU
+** General Public License version 2.0 or (at your option) the GNU General
+** Public license version 3 or any later version approved by the KDE Free
+** Qt Foundation. The licenses are as published by the Free Software
+** Foundation and appearing in the file LICENSE.GPL2 and LICENSE.GPL3
+** included in the packaging of this file. Please review the following
+** information to ensure the GNU General Public License requirements will
+** be met: https://www.gnu.org/licenses/gpl-2.0.html and
+** https://www.gnu.org/licenses/gpl-3.0.html.
+**
+** $QT_END_LICENSE$
+**
+****************************************************************************/
+
+#ifndef QWINDOWSUIATOGGLEPROVIDER_H
+#define QWINDOWSUIATOGGLEPROVIDER_H
+
+#include <QtCore/QtConfig>
+#ifndef QT_NO_ACCESSIBILITY
+
+#include "qwindowsuiabaseprovider.h"
+
+QT_BEGIN_NAMESPACE
+
+// Implements the Toggle control pattern provider. Used for checkboxes.
+class QWindowsUiaToggleProvider : public QWindowsUiaBaseProvider,
+ public QWindowsComBase<IToggleProvider>
+{
+ Q_DISABLE_COPY(QWindowsUiaToggleProvider)
+public:
+ explicit QWindowsUiaToggleProvider(QAccessible::Id id);
+ virtual ~QWindowsUiaToggleProvider();
+
+ // IToggleProvider
+ HRESULT STDMETHODCALLTYPE Toggle();
+ HRESULT STDMETHODCALLTYPE get_ToggleState(ToggleState *pRetVal);
+};
+
+QT_END_NAMESPACE
+
+#endif // QT_NO_ACCESSIBILITY
+
+#endif // QWINDOWSUIATOGGLEPROVIDER_H
diff --git a/src/plugins/platforms/windows/uiautomation/qwindowsuiautils.cpp b/src/plugins/platforms/windows/uiautomation/qwindowsuiautils.cpp
new file mode 100644
index 0000000000..89e5075dcb
--- /dev/null
+++ b/src/plugins/platforms/windows/uiautomation/qwindowsuiautils.cpp
@@ -0,0 +1,221 @@
+/****************************************************************************
+**
+** Copyright (C) 2017 The Qt Company Ltd.
+** Contact: https://www.qt.io/licensing/
+**
+** This file is part of the plugins of the Qt Toolkit.
+**
+** $QT_BEGIN_LICENSE:LGPL$
+** Commercial License Usage
+** Licensees holding valid commercial Qt licenses may use this file in
+** accordance with the commercial license agreement provided with the
+** Software or, alternatively, in accordance with the terms contained in
+** a written agreement between you and The Qt Company. For licensing terms
+** and conditions see https://www.qt.io/terms-conditions. For further
+** information use the contact form at https://www.qt.io/contact-us.
+**
+** GNU Lesser General Public License Usage
+** Alternatively, this file may be used under the terms of the GNU Lesser
+** General Public License version 3 as published by the Free Software
+** Foundation and appearing in the file LICENSE.LGPL3 included in the
+** packaging of this file. Please review the following information to
+** ensure the GNU Lesser General Public License version 3 requirements
+** will be met: https://www.gnu.org/licenses/lgpl-3.0.html.
+**
+** GNU General Public License Usage
+** Alternatively, this file may be used under the terms of the GNU
+** General Public License version 2.0 or (at your option) the GNU General
+** Public license version 3 or any later version approved by the KDE Free
+** Qt Foundation. The licenses are as published by the Free Software
+** Foundation and appearing in the file LICENSE.GPL2 and LICENSE.GPL3
+** included in the packaging of this file. Please review the following
+** information to ensure the GNU General Public License requirements will
+** be met: https://www.gnu.org/licenses/gpl-2.0.html and
+** https://www.gnu.org/licenses/gpl-3.0.html.
+**
+** $QT_END_LICENSE$
+**
+****************************************************************************/
+
+#include <QtCore/QtConfig>
+#ifndef QT_NO_ACCESSIBILITY
+
+#include "qwindowsuiautils.h"
+#include "qwindowscontext.h"
+#include "qwindowswindow.h"
+
+#include <QtGui/QWindow>
+#include <QtGui/private/qhighdpiscaling_p.h>
+#include <cmath>
+
+QT_BEGIN_NAMESPACE
+
+namespace QWindowsUiAutomation {
+
+// Returns the window containing the element (usually the top window),
+QWindow *windowForAccessible(const QAccessibleInterface *accessible)
+{
+ QWindow *window = accessible->window();
+ if (!window) {
+ QAccessibleInterface *acc = accessible->parent();
+ while (acc && acc->isValid() && !window) {
+ window = acc->window();
+ QAccessibleInterface *par = acc->parent();
+ acc = par;
+ }
+ }
+ return window;
+}
+
+// Returns the native window handle associated with the element, if any.
+// Usually it will be NULL, as Qt5 by default uses alien widgets with no native windows.
+HWND hwndForAccessible(const QAccessibleInterface *accessible)
+{
+ if (QWindow *window = accessible->window()) {
+ if (!accessible->parent() || (accessible->parent()->window() != window)) {
+ return QWindowsBaseWindow::handleOf(window);
+ }
+ }
+ return NULL;
+}
+
+void clearVariant(VARIANT *variant)
+{
+ variant->vt = VT_EMPTY;
+ variant->punkVal = nullptr;
+}
+
+void setVariantI4(int value, VARIANT *variant)
+{
+ variant->vt = VT_I4;
+ variant->lVal = value;
+}
+
+void setVariantBool(bool value, VARIANT *variant)
+{
+ variant->vt = VT_BOOL;
+ variant->boolVal = value ? -1 : 0;
+}
+
+void setVariantDouble(double value, VARIANT *variant)
+{
+ variant->vt = VT_R8;
+ variant->boolVal = value;
+}
+
+BSTR bStrFromQString(const QString &value)
+{
+ return SysAllocString(reinterpret_cast<const wchar_t *>(value.utf16()));
+}
+
+void setVariantString(const QString &value, VARIANT *variant)
+{
+ variant->vt = VT_BSTR;
+ variant->bstrVal = bStrFromQString(value);
+}
+
+// Scales a rect to native coordinates, according to high dpi settings.
+void rectToNativeUiaRect(const QRect &rect, const QWindow *w, UiaRect *uiaRect)
+{
+ if (w && uiaRect) {
+ const qreal factor = QHighDpiScaling::factor(w);
+ uiaRect->left = qreal(rect.x()) * factor;
+ uiaRect->top = qreal(rect.y()) * factor;
+ uiaRect->width = qreal(rect.width()) * factor;
+ uiaRect->height = qreal(rect.height()) * factor;
+ }
+}
+
+// Scales a point from native coordinates, according to high dpi settings.
+void nativeUiaPointToPoint(const UiaPoint &uiaPoint, const QWindow *w, QPoint *point)
+{
+ if (w && point) {
+ const qreal factor = QHighDpiScaling::factor(w);
+ point->setX(int(std::lround(uiaPoint.x / factor)));
+ point->setY(int(std::lround(uiaPoint.y / factor)));
+ }
+}
+
+// Maps an accessibility role ID to an UI Automation control type ID.
+long roleToControlTypeId(QAccessible::Role role)
+{
+ static const QHash<QAccessible::Role, long> mapping {
+ {QAccessible::TitleBar, UIA_TitleBarControlTypeId},
+ {QAccessible::MenuBar, UIA_MenuBarControlTypeId},
+ {QAccessible::ScrollBar, UIA_ScrollBarControlTypeId},
+ {QAccessible::Grip, UIA_ThumbControlTypeId},
+ {QAccessible::Sound, UIA_CustomControlTypeId},
+ {QAccessible::Cursor, UIA_CustomControlTypeId},
+ {QAccessible::Caret, UIA_CustomControlTypeId},
+ {QAccessible::AlertMessage, UIA_CustomControlTypeId},
+ {QAccessible::Window, UIA_WindowControlTypeId},
+ {QAccessible::Client, UIA_CustomControlTypeId},
+ {QAccessible::PopupMenu, UIA_MenuControlTypeId},
+ {QAccessible::MenuItem, UIA_MenuItemControlTypeId},
+ {QAccessible::ToolTip, UIA_ToolTipControlTypeId},
+ {QAccessible::Application, UIA_CustomControlTypeId},
+ {QAccessible::Document, UIA_DocumentControlTypeId},
+ {QAccessible::Pane, UIA_PaneControlTypeId},
+ {QAccessible::Chart, UIA_CustomControlTypeId},
+ {QAccessible::Dialog, UIA_WindowControlTypeId},
+ {QAccessible::Border, UIA_CustomControlTypeId},
+ {QAccessible::Grouping, UIA_GroupControlTypeId},
+ {QAccessible::Separator, UIA_SeparatorControlTypeId},
+ {QAccessible::ToolBar, UIA_ToolBarControlTypeId},
+ {QAccessible::StatusBar, UIA_StatusBarControlTypeId},
+ {QAccessible::Table, UIA_TableControlTypeId},
+ {QAccessible::ColumnHeader, UIA_HeaderControlTypeId},
+ {QAccessible::RowHeader, UIA_HeaderControlTypeId},
+ {QAccessible::Column, UIA_HeaderItemControlTypeId},
+ {QAccessible::Row, UIA_HeaderItemControlTypeId},
+ {QAccessible::Cell, UIA_DataItemControlTypeId},
+ {QAccessible::Link, UIA_HyperlinkControlTypeId},
+ {QAccessible::HelpBalloon, UIA_ToolTipControlTypeId},
+ {QAccessible::Assistant, UIA_CustomControlTypeId},
+ {QAccessible::List, UIA_ListControlTypeId},
+ {QAccessible::ListItem, UIA_ListItemControlTypeId},
+ {QAccessible::Tree, UIA_TreeControlTypeId},
+ {QAccessible::TreeItem, UIA_TreeItemControlTypeId},
+ {QAccessible::PageTab, UIA_TabItemControlTypeId},
+ {QAccessible::PropertyPage, UIA_CustomControlTypeId},
+ {QAccessible::Indicator, UIA_CustomControlTypeId},
+ {QAccessible::Graphic, UIA_ImageControlTypeId},
+ {QAccessible::StaticText, UIA_EditControlTypeId},
+ {QAccessible::EditableText, UIA_EditControlTypeId},
+ {QAccessible::Button, UIA_ButtonControlTypeId},
+ {QAccessible::CheckBox, UIA_CheckBoxControlTypeId},
+ {QAccessible::RadioButton, UIA_RadioButtonControlTypeId},
+ {QAccessible::ComboBox, UIA_ComboBoxControlTypeId},
+ {QAccessible::ProgressBar, UIA_ProgressBarControlTypeId},
+ {QAccessible::Dial, UIA_CustomControlTypeId},
+ {QAccessible::HotkeyField, UIA_CustomControlTypeId},
+ {QAccessible::Slider, UIA_SliderControlTypeId},
+ {QAccessible::SpinBox, UIA_SpinnerControlTypeId},
+ {QAccessible::Canvas, UIA_CustomControlTypeId},
+ {QAccessible::Animation, UIA_CustomControlTypeId},
+ {QAccessible::Equation, UIA_CustomControlTypeId},
+ {QAccessible::ButtonDropDown, UIA_ButtonControlTypeId},
+ {QAccessible::ButtonMenu, UIA_ButtonControlTypeId},
+ {QAccessible::ButtonDropGrid, UIA_ButtonControlTypeId},
+ {QAccessible::Whitespace, UIA_CustomControlTypeId},
+ {QAccessible::PageTabList, UIA_TabControlTypeId},
+ {QAccessible::Clock, UIA_CustomControlTypeId},
+ {QAccessible::Splitter, UIA_CustomControlTypeId},
+ };
+
+ return mapping.value(role, UIA_CustomControlTypeId);
+}
+
+// True if a character can be a separator for a text unit.
+bool isTextUnitSeparator(TextUnit unit, const QChar &ch)
+{
+ return (((unit == TextUnit_Word) || (unit == TextUnit_Format)) && ch.isSpace())
+ || ((unit == TextUnit_Line) && (ch.toLatin1() == '\n'));
+}
+
+} // namespace QWindowsUiAutomation
+
+
+QT_END_NAMESPACE
+
+#endif // QT_NO_ACCESSIBILITY
diff --git a/src/plugins/platforms/windows/uiautomation/qwindowsuiautils.h b/src/plugins/platforms/windows/uiautomation/qwindowsuiautils.h
new file mode 100644
index 0000000000..15f4d6e8ba
--- /dev/null
+++ b/src/plugins/platforms/windows/uiautomation/qwindowsuiautils.h
@@ -0,0 +1,89 @@
+/****************************************************************************
+**
+** Copyright (C) 2017 The Qt Company Ltd.
+** Contact: https://www.qt.io/licensing/
+**
+** This file is part of the plugins of the Qt Toolkit.
+**
+** $QT_BEGIN_LICENSE:LGPL$
+** Commercial License Usage
+** Licensees holding valid commercial Qt licenses may use this file in
+** accordance with the commercial license agreement provided with the
+** Software or, alternatively, in accordance with the terms contained in
+** a written agreement between you and The Qt Company. For licensing terms
+** and conditions see https://www.qt.io/terms-conditions. For further
+** information use the contact form at https://www.qt.io/contact-us.
+**
+** GNU Lesser General Public License Usage
+** Alternatively, this file may be used under the terms of the GNU Lesser
+** General Public License version 3 as published by the Free Software
+** Foundation and appearing in the file LICENSE.LGPL3 included in the
+** packaging of this file. Please review the following information to
+** ensure the GNU Lesser General Public License version 3 requirements
+** will be met: https://www.gnu.org/licenses/lgpl-3.0.html.
+**
+** GNU General Public License Usage
+** Alternatively, this file may be used under the terms of the GNU
+** General Public License version 2.0 or (at your option) the GNU General
+** Public license version 3 or any later version approved by the KDE Free
+** Qt Foundation. The licenses are as published by the Free Software
+** Foundation and appearing in the file LICENSE.GPL2 and LICENSE.GPL3
+** included in the packaging of this file. Please review the following
+** information to ensure the GNU General Public License requirements will
+** be met: https://www.gnu.org/licenses/gpl-2.0.html and
+** https://www.gnu.org/licenses/gpl-3.0.html.
+**
+** $QT_END_LICENSE$
+**
+****************************************************************************/
+
+#ifndef QWINDOWSUIAUTILS_H
+#define QWINDOWSUIAUTILS_H
+
+#include <QtCore/QtConfig>
+#ifndef QT_NO_ACCESSIBILITY
+
+#include <QtCore/QString>
+#include <QtCore/qt_windows.h>
+#include <QtGui/QAccessible>
+#include <QtGui/QAccessibleInterface>
+#include <QtGui/QWindow>
+#include <QtCore/QDebug>
+#include <QtCore/QRect>
+#include <QtWindowsUIAutomationSupport/private/qwindowsuiawrapper_p.h>
+
+QT_BEGIN_NAMESPACE
+
+namespace QWindowsUiAutomation {
+
+QWindow *windowForAccessible(const QAccessibleInterface *accessible);
+
+HWND hwndForAccessible(const QAccessibleInterface *accessible);
+
+void rectToNativeUiaRect(const QRect &rect, const QWindow *w, UiaRect *uiaRect);
+
+void nativeUiaPointToPoint(const UiaPoint &uiaPoint, const QWindow *w, QPoint *point);
+
+long roleToControlTypeId(QAccessible::Role role);
+
+bool isTextUnitSeparator(TextUnit unit, const QChar &ch);
+
+void clearVariant(VARIANT *variant);
+
+void setVariantI4(int value, VARIANT *variant);
+
+void setVariantBool(bool value, VARIANT *variant);
+
+void setVariantDouble(double value, VARIANT *variant);
+
+BSTR bStrFromQString(const QString &value);
+
+void setVariantString(const QString &value, VARIANT *variant);
+
+} // namespace QWindowsUiAutomation
+
+QT_END_NAMESPACE
+
+#endif // QT_NO_ACCESSIBILITY
+
+#endif // QWINDOWSUIAUTILS_H
diff --git a/src/plugins/platforms/windows/uiautomation/qwindowsuiavalueprovider.cpp b/src/plugins/platforms/windows/uiautomation/qwindowsuiavalueprovider.cpp
new file mode 100644
index 0000000000..ef7d564e22
--- /dev/null
+++ b/src/plugins/platforms/windows/uiautomation/qwindowsuiavalueprovider.cpp
@@ -0,0 +1,132 @@
+/****************************************************************************
+**
+** Copyright (C) 2017 The Qt Company Ltd.
+** Contact: https://www.qt.io/licensing/
+**
+** This file is part of the plugins of the Qt Toolkit.
+**
+** $QT_BEGIN_LICENSE:LGPL$
+** Commercial License Usage
+** Licensees holding valid commercial Qt licenses may use this file in
+** accordance with the commercial license agreement provided with the
+** Software or, alternatively, in accordance with the terms contained in
+** a written agreement between you and The Qt Company. For licensing terms
+** and conditions see https://www.qt.io/terms-conditions. For further
+** information use the contact form at https://www.qt.io/contact-us.
+**
+** GNU Lesser General Public License Usage
+** Alternatively, this file may be used under the terms of the GNU Lesser
+** General Public License version 3 as published by the Free Software
+** Foundation and appearing in the file LICENSE.LGPL3 included in the
+** packaging of this file. Please review the following information to
+** ensure the GNU Lesser General Public License version 3 requirements
+** will be met: https://www.gnu.org/licenses/lgpl-3.0.html.
+**
+** GNU General Public License Usage
+** Alternatively, this file may be used under the terms of the GNU
+** General Public License version 2.0 or (at your option) the GNU General
+** Public license version 3 or any later version approved by the KDE Free
+** Qt Foundation. The licenses are as published by the Free Software
+** Foundation and appearing in the file LICENSE.GPL2 and LICENSE.GPL3
+** included in the packaging of this file. Please review the following
+** information to ensure the GNU General Public License requirements will
+** be met: https://www.gnu.org/licenses/gpl-2.0.html and
+** https://www.gnu.org/licenses/gpl-3.0.html.
+**
+** $QT_END_LICENSE$
+**
+****************************************************************************/
+
+#include <QtCore/QtConfig>
+#ifndef QT_NO_ACCESSIBILITY
+
+#include "qwindowsuiavalueprovider.h"
+#include "qwindowsuiautils.h"
+#include "qwindowscontext.h"
+
+#include <QtGui/QAccessible>
+#include <QtGui/QAccessibleInterface>
+#include <QtCore/QDebug>
+#include <QtCore/QString>
+
+QT_BEGIN_NAMESPACE
+
+using namespace QWindowsUiAutomation;
+
+
+QWindowsUiaValueProvider::QWindowsUiaValueProvider(QAccessible::Id id) :
+ QWindowsUiaBaseProvider(id)
+{
+}
+
+QWindowsUiaValueProvider::~QWindowsUiaValueProvider()
+{
+}
+
+// Sets the value associated with the control.
+HRESULT STDMETHODCALLTYPE QWindowsUiaValueProvider::SetValue(LPCWSTR val)
+{
+ qCDebug(lcQpaUiAutomation) << __FUNCTION__;
+
+ QAccessibleInterface *accessible = accessibleInterface();
+ if (!accessible)
+ return UIA_E_ELEMENTNOTAVAILABLE;
+
+ // First sets the value as a text.
+ QString strVal = QString::fromUtf16(reinterpret_cast<const ushort *>(val));
+ accessible->setText(QAccessible::Value, strVal);
+
+ // Then, if the control supports the value interface (range value)
+ // and the supplied text can be converted to a number, and that number
+ // lies within the min/max limits, sets it as the control's current (numeric) value.
+ if (QAccessibleValueInterface *valueInterface = accessible->valueInterface()) {
+ bool ok = false;
+ double numval = strVal.toDouble(&ok);
+ if (ok) {
+ double minimum = valueInterface->minimumValue().toDouble();
+ double maximum = valueInterface->maximumValue().toDouble();
+ if ((numval >= minimum) && (numval <= maximum)) {
+ valueInterface->setCurrentValue(QVariant(numval));
+ }
+ }
+ }
+ return S_OK;
+}
+
+// True for read-only controls.
+HRESULT STDMETHODCALLTYPE QWindowsUiaValueProvider::get_IsReadOnly(BOOL *pRetVal)
+{
+ qCDebug(lcQpaUiAutomation) << __FUNCTION__;
+
+ if (!pRetVal)
+ return E_INVALIDARG;
+ *pRetVal = FALSE;
+
+ QAccessibleInterface *accessible = accessibleInterface();
+ if (!accessible)
+ return UIA_E_ELEMENTNOTAVAILABLE;
+
+ *pRetVal = accessible->state().readOnly;
+ return S_OK;
+}
+
+// Returns the value in text form.
+HRESULT STDMETHODCALLTYPE QWindowsUiaValueProvider::get_Value(BSTR *pRetVal)
+{
+ qCDebug(lcQpaUiAutomation) << __FUNCTION__;
+
+ if (!pRetVal)
+ return E_INVALIDARG;
+ *pRetVal = nullptr;
+
+ QAccessibleInterface *accessible = accessibleInterface();
+ if (!accessible)
+ return UIA_E_ELEMENTNOTAVAILABLE;
+
+ *pRetVal = bStrFromQString(accessible->text(QAccessible::Value));
+ return S_OK;
+}
+
+QT_END_NAMESPACE
+
+#endif // QT_NO_ACCESSIBILITY
diff --git a/src/plugins/platforms/windows/uiautomation/qwindowsuiavalueprovider.h b/src/plugins/platforms/windows/uiautomation/qwindowsuiavalueprovider.h
new file mode 100644
index 0000000000..db54fc0a46
--- /dev/null
+++ b/src/plugins/platforms/windows/uiautomation/qwindowsuiavalueprovider.h
@@ -0,0 +1,70 @@
+/****************************************************************************
+**
+** Copyright (C) 2017 The Qt Company Ltd.
+** Contact: https://www.qt.io/licensing/
+**
+** This file is part of the plugins of the Qt Toolkit.
+**
+** $QT_BEGIN_LICENSE:LGPL$
+** Commercial License Usage
+** Licensees holding valid commercial Qt licenses may use this file in
+** accordance with the commercial license agreement provided with the
+** Software or, alternatively, in accordance with the terms contained in
+** a written agreement between you and The Qt Company. For licensing terms
+** and conditions see https://www.qt.io/terms-conditions. For further
+** information use the contact form at https://www.qt.io/contact-us.
+**
+** GNU Lesser General Public License Usage
+** Alternatively, this file may be used under the terms of the GNU Lesser
+** General Public License version 3 as published by the Free Software
+** Foundation and appearing in the file LICENSE.LGPL3 included in the
+** packaging of this file. Please review the following information to
+** ensure the GNU Lesser General Public License version 3 requirements
+** will be met: https://www.gnu.org/licenses/lgpl-3.0.html.
+**
+** GNU General Public License Usage
+** Alternatively, this file may be used under the terms of the GNU
+** General Public License version 2.0 or (at your option) the GNU General
+** Public license version 3 or any later version approved by the KDE Free
+** Qt Foundation. The licenses are as published by the Free Software
+** Foundation and appearing in the file LICENSE.GPL2 and LICENSE.GPL3
+** included in the packaging of this file. Please review the following
+** information to ensure the GNU General Public License requirements will
+** be met: https://www.gnu.org/licenses/gpl-2.0.html and
+** https://www.gnu.org/licenses/gpl-3.0.html.
+**
+** $QT_END_LICENSE$
+**
+****************************************************************************/
+
+#ifndef QWINDOWSUIAVALUEPROVIDER_H
+#define QWINDOWSUIAVALUEPROVIDER_H
+
+#include <QtCore/QtConfig>
+#ifndef QT_NO_ACCESSIBILITY
+
+#include "qwindowsuiabaseprovider.h"
+
+QT_BEGIN_NAMESPACE
+
+// Implements the Value control pattern provider.
+// Supported for all controls that can return text(QAccessible::Value).
+class QWindowsUiaValueProvider : public QWindowsUiaBaseProvider,
+ public QWindowsComBase<IValueProvider>
+{
+ Q_DISABLE_COPY(QWindowsUiaValueProvider)
+public:
+ explicit QWindowsUiaValueProvider(QAccessible::Id id);
+ virtual ~QWindowsUiaValueProvider();
+
+ // IValueProvider
+ HRESULT STDMETHODCALLTYPE SetValue(LPCWSTR val);
+ HRESULT STDMETHODCALLTYPE get_IsReadOnly(BOOL *pRetVal);
+ HRESULT STDMETHODCALLTYPE get_Value(BSTR *pRetVal);
+};
+
+QT_END_NAMESPACE
+
+#endif // QT_NO_ACCESSIBILITY
+
+#endif // QWINDOWSUIAVALUEPROVIDER_H
diff --git a/src/plugins/platforms/windows/uiautomation/uiautomation.pri b/src/plugins/platforms/windows/uiautomation/uiautomation.pri
new file mode 100644
index 0000000000..e3071766d9
--- /dev/null
+++ b/src/plugins/platforms/windows/uiautomation/uiautomation.pri
@@ -0,0 +1,43 @@
+qtHaveModule(windowsuiautomation_support-private): \
+ QT += windowsuiautomation_support-private
+
+SOURCES += \
+ $$PWD/qwindowsuiaaccessibility.cpp \
+ $$PWD/qwindowsuiaprovidercache.cpp \
+ $$PWD/qwindowsuiamainprovider.cpp \
+ $$PWD/qwindowsuiabaseprovider.cpp \
+ $$PWD/qwindowsuiavalueprovider.cpp \
+ $$PWD/qwindowsuiatextprovider.cpp \
+ $$PWD/qwindowsuiatextrangeprovider.cpp \
+ $$PWD/qwindowsuiatoggleprovider.cpp \
+ $$PWD/qwindowsuiaselectionprovider.cpp \
+ $$PWD/qwindowsuiaselectionitemprovider.cpp \
+ $$PWD/qwindowsuiainvokeprovider.cpp \
+ $$PWD/qwindowsuiarangevalueprovider.cpp \
+ $$PWD/qwindowsuiatableprovider.cpp \
+ $$PWD/qwindowsuiatableitemprovider.cpp \
+ $$PWD/qwindowsuiagridprovider.cpp \
+ $$PWD/qwindowsuiagriditemprovider.cpp \
+ $$PWD/qwindowsuiautils.cpp
+
+HEADERS += \
+ $$PWD/qwindowsuiaaccessibility.h \
+ $$PWD/qwindowsuiaprovidercache.h \
+ $$PWD/qwindowsuiamainprovider.h \
+ $$PWD/qwindowsuiabaseprovider.h \
+ $$PWD/qwindowsuiavalueprovider.h \
+ $$PWD/qwindowsuiatextprovider.h \
+ $$PWD/qwindowsuiatextrangeprovider.h \
+ $$PWD/qwindowsuiatoggleprovider.h \
+ $$PWD/qwindowsuiaselectionprovider.h \
+ $$PWD/qwindowsuiaselectionitemprovider.h \
+ $$PWD/qwindowsuiainvokeprovider.h \
+ $$PWD/qwindowsuiarangevalueprovider.h \
+ $$PWD/qwindowsuiatableprovider.h \
+ $$PWD/qwindowsuiatableitemprovider.h \
+ $$PWD/qwindowsuiagridprovider.h \
+ $$PWD/qwindowsuiagriditemprovider.h \
+ $$PWD/qwindowsuiautils.h
+
+mingw: LIBS *= -luuid
+
diff --git a/src/plugins/platforms/windows/windows.pri b/src/plugins/platforms/windows/windows.pri
index b7790a66e3..f4c396f7c5 100644
--- a/src/plugins/platforms/windows/windows.pri
+++ b/src/plugins/platforms/windows/windows.pri
@@ -53,7 +53,7 @@ HEADERS += \
$$PWD/qwindowsservices.h \
$$PWD/qwindowsnativeinterface.h \
$$PWD/qwindowsopengltester.h \
- $$PWD/qwindowsthreadpoolrunner.h
+ $$PWD/qwindowsthreadpoolrunner.h \
$$PWD/qwin10helpers.h
INCLUDEPATH += $$PWD
@@ -109,7 +109,7 @@ qtConfig(imageformat_png):RESOURCES += $$PWD/cursors.qrc
RESOURCES += $$PWD/openglblacklists.qrc
-qtConfig(accessibility): include($$PWD/accessible/accessible.pri)
+qtConfig(accessibility): include($$PWD/uiautomation/uiautomation.pri)
qtConfig(combined-angle-lib) {
DEFINES *= LIBEGL_NAME=$${LIBQTANGLE_NAME}
diff --git a/src/plugins/platforms/winrt/qwinrtclipboard.cpp b/src/plugins/platforms/winrt/qwinrtclipboard.cpp
index 117cb515df..05c34b82f8 100644
--- a/src/plugins/platforms/winrt/qwinrtclipboard.cpp
+++ b/src/plugins/platforms/winrt/qwinrtclipboard.cpp
@@ -59,7 +59,7 @@ typedef IEventHandler<IInspectable *> ContentChangedHandler;
QT_BEGIN_NAMESPACE
QWinRTClipboard::QWinRTClipboard()
- : m_mimeData(Q_NULLPTR)
+ : m_mimeData(nullptr)
{
QEventDispatcherWinRT::runOnXamlThread([this]() {
HRESULT hr;
diff --git a/src/plugins/platforms/winrt/qwinrtcursor.cpp b/src/plugins/platforms/winrt/qwinrtcursor.cpp
index 28a5f73e6e..3c918df935 100644
--- a/src/plugins/platforms/winrt/qwinrtcursor.cpp
+++ b/src/plugins/platforms/winrt/qwinrtcursor.cpp
@@ -89,7 +89,7 @@ void QWinRTCursor::changeCursor(QCursor *windowCursor, QWindow *window)
switch (windowCursor ? windowCursor->shape() : Qt::ArrowCursor) {
case Qt::BlankCursor:
hr = QEventDispatcherWinRT::runOnXamlThread([coreWindow]() {
- coreWindow->put_PointerCursor(Q_NULLPTR);
+ coreWindow->put_PointerCursor(nullptr);
return S_OK;
});
RETURN_VOID_IF_FAILED("Failed to set blank native cursor");
diff --git a/src/plugins/platforms/winrt/qwinrtdrag.cpp b/src/plugins/platforms/winrt/qwinrtdrag.cpp
index 43c406e1fb..0c918230b3 100644
--- a/src/plugins/platforms/winrt/qwinrtdrag.cpp
+++ b/src/plugins/platforms/winrt/qwinrtdrag.cpp
@@ -104,7 +104,7 @@ class DragThreadTransferData : public QObject
public slots:
void handleDrag();
public:
- explicit DragThreadTransferData(QObject *parent = Q_NULLPTR);
+ explicit DragThreadTransferData(QObject *parent = nullptr);
QWindow *window;
QWinRTInternalMimeData *mime;
QPoint point;
diff --git a/src/plugins/platforms/winrt/qwinrtfiledialoghelper.cpp b/src/plugins/platforms/winrt/qwinrtfiledialoghelper.cpp
index 62eacba89b..3c90334c8c 100644
--- a/src/plugins/platforms/winrt/qwinrtfiledialoghelper.cpp
+++ b/src/plugins/platforms/winrt/qwinrtfiledialoghelper.cpp
@@ -83,7 +83,7 @@ public:
}
HRESULT __stdcall GetView(IVectorView<HSTRING> **view)
{
- *view = Q_NULLPTR;
+ *view = nullptr;
return E_NOTIMPL;
}
HRESULT __stdcall IndexOf(HSTRING value, quint32 *index, boolean *found)
diff --git a/src/plugins/platforms/winrt/qwinrtfileengine.cpp b/src/plugins/platforms/winrt/qwinrtfileengine.cpp
index f037c516b5..76efdf6cc8 100644
--- a/src/plugins/platforms/winrt/qwinrtfileengine.cpp
+++ b/src/plugins/platforms/winrt/qwinrtfileengine.cpp
@@ -144,7 +144,7 @@ QAbstractFileEngine *QWinRTFileEngineHandler::create(const QString &fileName) co
if (file != d->files.end())
return new QWinRTFileEngine(fileName, file.value().Get());
- return Q_NULLPTR;
+ return nullptr;
}
static HRESULT getDestinationFolder(const QString &fileName, const QString &newFileName,
diff --git a/src/plugins/platforms/winrt/qwinrtscreen.cpp b/src/plugins/platforms/winrt/qwinrtscreen.cpp
index c370c2ec50..7b9502f9ab 100644
--- a/src/plugins/platforms/winrt/qwinrtscreen.cpp
+++ b/src/plugins/platforms/winrt/qwinrtscreen.cpp
@@ -497,7 +497,7 @@ QWinRTScreen::QWinRTScreen()
Q_D(QWinRTScreen);
qCDebug(lcQpaWindows) << __FUNCTION__;
d->orientation = Qt::PrimaryOrientation;
- d->touchDevice = Q_NULLPTR;
+ d->touchDevice = nullptr;
HRESULT hr;
ComPtr<Xaml::IWindowStatics> windowStatics;
@@ -540,7 +540,7 @@ QWinRTScreen::QWinRTScreen()
Q_ASSERT_SUCCEEDED(hr);
d->nativeOrientation = static_cast<Qt::ScreenOrientation>(static_cast<int>(qtOrientationsFromNative(displayOrientation)));
// Set initial pixel density
- onDpiChanged(Q_NULLPTR, Q_NULLPTR);
+ onDpiChanged(nullptr, nullptr);
d->orientation = d->nativeOrientation;
ComPtr<IApplicationViewStatics2> applicationViewStatics;
@@ -764,7 +764,7 @@ void QWinRTScreen::initialize()
Q_ASSERT_SUCCEEDED(hr);
hr = d->displayInformation->add_DpiChanged(Callback<DisplayInformationHandler>(this, &QWinRTScreen::onDpiChanged).Get(), &d->displayTokens[&IDisplayInformation::remove_DpiChanged]);
Q_ASSERT_SUCCEEDED(hr);
- onOrientationChanged(Q_NULLPTR, Q_NULLPTR);
+ onOrientationChanged(nullptr, nullptr);
onVisibilityChanged(nullptr, nullptr);
hr = d->redirect->add_PointerRoutedReleased(Callback<RedirectHandler>(this, &QWinRTScreen::onRedirectReleased).Get(), &d->redirectTokens[&ICorePointerRedirector::remove_PointerRoutedReleased]);
@@ -864,7 +864,7 @@ void QWinRTScreen::removeWindow(QWindow *window)
const Qt::WindowType type = window->type();
if (wasTopWindow && type != Qt::Popup && type != Qt::ToolTip && type != Qt::Tool)
- QWindowSystemInterface::handleWindowActivated(Q_NULLPTR, Qt::OtherFocusReason);
+ QWindowSystemInterface::handleWindowActivated(nullptr, Qt::OtherFocusReason);
handleExpose();
QWindowSystemInterface::flushWindowSystemEvents(QEventLoop::ExcludeUserInputEvents);
#ifndef QT_NO_DRAGANDDROP
diff --git a/src/plugins/platforms/winrt/qwinrtwindow.h b/src/plugins/platforms/winrt/qwinrtwindow.h
index a8992450b9..9604b4bbaa 100644
--- a/src/plugins/platforms/winrt/qwinrtwindow.h
+++ b/src/plugins/platforms/winrt/qwinrtwindow.h
@@ -70,8 +70,8 @@ public:
qreal devicePixelRatio() const override;
void setWindowState(Qt::WindowStates state) override;
- bool setMouseGrabEnabled(bool grab) Q_DECL_OVERRIDE;
- bool setKeyboardGrabEnabled(bool grab) Q_DECL_OVERRIDE;
+ bool setMouseGrabEnabled(bool grab) override;
+ bool setKeyboardGrabEnabled(bool grab) override;
EGLSurface eglSurface() const;
void createEglSurface(EGLDisplay display, EGLConfig config);
diff --git a/src/plugins/platforms/xcb/gl_integrations/qxcbglintegration.h b/src/plugins/platforms/xcb/gl_integrations/qxcbglintegration.h
index 926e5e22df..07e983a499 100644
--- a/src/plugins/platforms/xcb/gl_integrations/qxcbglintegration.h
+++ b/src/plugins/platforms/xcb/gl_integrations/qxcbglintegration.h
@@ -69,7 +69,7 @@ public:
#endif
virtual QPlatformOffscreenSurface *createPlatformOffscreenSurface(QOffscreenSurface *surface) const = 0;
- virtual QXcbNativeInterfaceHandler *nativeInterfaceHandler() const { return Q_NULLPTR; }
+ virtual QXcbNativeInterfaceHandler *nativeInterfaceHandler() const { return nullptr; }
};
QT_END_NAMESPACE
diff --git a/src/plugins/platforms/xcb/gl_integrations/qxcbnativeinterfacehandler.cpp b/src/plugins/platforms/xcb/gl_integrations/qxcbnativeinterfacehandler.cpp
index ac992b859d..e18656c6ec 100644
--- a/src/plugins/platforms/xcb/gl_integrations/qxcbnativeinterfacehandler.cpp
+++ b/src/plugins/platforms/xcb/gl_integrations/qxcbnativeinterfacehandler.cpp
@@ -56,37 +56,37 @@ QXcbNativeInterfaceHandler::~QXcbNativeInterfaceHandler()
QPlatformNativeInterface::NativeResourceForIntegrationFunction QXcbNativeInterfaceHandler::nativeResourceFunctionForIntegration(const QByteArray &resource) const
{
Q_UNUSED(resource);
- return Q_NULLPTR;
+ return nullptr;
}
QPlatformNativeInterface::NativeResourceForContextFunction QXcbNativeInterfaceHandler::nativeResourceFunctionForContext(const QByteArray &resource) const
{
Q_UNUSED(resource);
- return Q_NULLPTR;
+ return nullptr;
}
QPlatformNativeInterface::NativeResourceForScreenFunction QXcbNativeInterfaceHandler::nativeResourceFunctionForScreen(const QByteArray &resource) const
{
Q_UNUSED(resource);
- return Q_NULLPTR;
+ return nullptr;
}
QPlatformNativeInterface::NativeResourceForWindowFunction QXcbNativeInterfaceHandler::nativeResourceFunctionForWindow(const QByteArray &resource) const
{
Q_UNUSED(resource);
- return Q_NULLPTR;
+ return nullptr;
}
QPlatformNativeInterface::NativeResourceForBackingStoreFunction QXcbNativeInterfaceHandler::nativeResourceFunctionForBackingStore(const QByteArray &resource) const
{
Q_UNUSED(resource);
- return Q_NULLPTR;
+ return nullptr;
}
QFunctionPointer QXcbNativeInterfaceHandler::platformFunction(const QByteArray &function) const
{
Q_UNUSED(function);
- return Q_NULLPTR;
+ return nullptr;
}
QT_END_NAMESPACE
diff --git a/src/plugins/platforms/xcb/gl_integrations/xcb_egl/qxcbeglintegration.cpp b/src/plugins/platforms/xcb/gl_integrations/xcb_egl/qxcbeglintegration.cpp
index 7aa1d631df..fe18bc24db 100644
--- a/src/plugins/platforms/xcb/gl_integrations/xcb_egl/qxcbeglintegration.cpp
+++ b/src/plugins/platforms/xcb/gl_integrations/xcb_egl/qxcbeglintegration.cpp
@@ -49,7 +49,7 @@
QT_BEGIN_NAMESPACE
QXcbEglIntegration::QXcbEglIntegration()
- : m_connection(Q_NULLPTR)
+ : m_connection(nullptr)
, m_egl_display(EGL_NO_DISPLAY)
{
qCDebug(lcQpaGl) << "Xcb EGL gl-integration created";
diff --git a/src/plugins/platforms/xcb/gl_integrations/xcb_egl/qxcbeglnativeinterfacehandler.cpp b/src/plugins/platforms/xcb/gl_integrations/xcb_egl/qxcbeglnativeinterfacehandler.cpp
index 30f5e3a00d..c0e3f820fe 100644
--- a/src/plugins/platforms/xcb/gl_integrations/xcb_egl/qxcbeglnativeinterfacehandler.cpp
+++ b/src/plugins/platforms/xcb/gl_integrations/xcb_egl/qxcbeglnativeinterfacehandler.cpp
@@ -77,7 +77,7 @@ QPlatformNativeInterface::NativeResourceForIntegrationFunction QXcbEglNativeInte
default:
break;
}
- return Q_NULLPTR;
+ return nullptr;
}
QPlatformNativeInterface::NativeResourceForContextFunction QXcbEglNativeInterfaceHandler::nativeResourceFunctionForContext(const QByteArray &resource) const
@@ -90,7 +90,7 @@ QPlatformNativeInterface::NativeResourceForContextFunction QXcbEglNativeInterfac
default:
break;
}
- return Q_NULLPTR;
+ return nullptr;
}
QPlatformNativeInterface::NativeResourceForWindowFunction QXcbEglNativeInterfaceHandler::nativeResourceFunctionForWindow(const QByteArray &resource) const
@@ -101,7 +101,7 @@ QPlatformNativeInterface::NativeResourceForWindowFunction QXcbEglNativeInterface
default:
break;
}
- return Q_NULLPTR;
+ return nullptr;
}
void *QXcbEglNativeInterfaceHandler::eglDisplay()
@@ -114,11 +114,11 @@ void *QXcbEglNativeInterfaceHandler::eglDisplay()
void *QXcbEglNativeInterfaceHandler::eglDisplayForWindow(QWindow *window)
{
Q_ASSERT(window);
- if (window->supportsOpenGL() && window->handle() == Q_NULLPTR)
+ if (window->supportsOpenGL() && window->handle() == nullptr)
return eglDisplay();
else if (window->supportsOpenGL())
return static_cast<QXcbEglWindow *>(window->handle())->glIntegration()->eglDisplay();
- return Q_NULLPTR;
+ return nullptr;
}
void *QXcbEglNativeInterfaceHandler::eglContextForContext(QOpenGLContext *context)
diff --git a/src/plugins/platforms/xcb/gl_integrations/xcb_egl/qxcbeglwindow.cpp b/src/plugins/platforms/xcb/gl_integrations/xcb_egl/qxcbeglwindow.cpp
index 9c3fd26d49..65beac227c 100644
--- a/src/plugins/platforms/xcb/gl_integrations/xcb_egl/qxcbeglwindow.cpp
+++ b/src/plugins/platforms/xcb/gl_integrations/xcb_egl/qxcbeglwindow.cpp
@@ -49,7 +49,7 @@ QT_BEGIN_NAMESPACE
QXcbEglWindow::QXcbEglWindow(QWindow *window, QXcbEglIntegration *glIntegration)
: QXcbWindow(window)
, m_glIntegration(glIntegration)
- , m_config(Q_NULLPTR)
+ , m_config(nullptr)
, m_surface(EGL_NO_SURFACE)
{
}
diff --git a/src/plugins/platforms/xcb/gl_integrations/xcb_glx/qglxintegration.cpp b/src/plugins/platforms/xcb/gl_integrations/xcb_glx/qglxintegration.cpp
index 3bc8590d36..56a737e882 100644
--- a/src/plugins/platforms/xcb/gl_integrations/xcb_glx/qglxintegration.cpp
+++ b/src/plugins/platforms/xcb/gl_integrations/xcb_glx/qglxintegration.cpp
@@ -321,7 +321,7 @@ void QGLXContext::init(QXcbScreen *screen, QPlatformOpenGLContext *share)
if (!m_context && m_shareContext) {
// re-try without a shared glx context
m_shareContext = 0;
- m_context = glXCreateContext(m_display, visualInfo, Q_NULLPTR, true);
+ m_context = glXCreateContext(m_display, visualInfo, nullptr, true);
}
// Create a temporary window so that we can make the new context current
@@ -470,7 +470,7 @@ static QXcbScreen *screenForPlatformSurface(QPlatformSurface *surface)
} else if (surfaceClass == QSurface::Offscreen) {
return static_cast<QXcbScreen *>(static_cast<QGLXPbuffer *>(surface)->screen());
}
- return Q_NULLPTR;
+ return nullptr;
}
QVariant QGLXContext::nativeHandle() const
diff --git a/src/plugins/platforms/xcb/gl_integrations/xcb_glx/qxcbglxintegration.cpp b/src/plugins/platforms/xcb/gl_integrations/xcb_glx/qxcbglxintegration.cpp
index 377066df61..13f03f8bf3 100644
--- a/src/plugins/platforms/xcb/gl_integrations/xcb_glx/qxcbglxintegration.cpp
+++ b/src/plugins/platforms/xcb/gl_integrations/xcb_glx/qxcbglxintegration.cpp
@@ -87,7 +87,7 @@ QT_BEGIN_NAMESPACE
#endif
QXcbGlxIntegration::QXcbGlxIntegration()
- : m_connection(Q_NULLPTR)
+ : m_connection(nullptr)
, m_glx_first_event(0)
{
qCDebug(lcQpaGl) << "Xcb GLX gl-integration created";
diff --git a/src/plugins/platforms/xcb/gl_integrations/xcb_glx/qxcbglxnativeinterfacehandler.cpp b/src/plugins/platforms/xcb/gl_integrations/xcb_glx/qxcbglxnativeinterfacehandler.cpp
index 638fdd46b5..e9bb4460ff 100644
--- a/src/plugins/platforms/xcb/gl_integrations/xcb_glx/qxcbglxnativeinterfacehandler.cpp
+++ b/src/plugins/platforms/xcb/gl_integrations/xcb_glx/qxcbglxnativeinterfacehandler.cpp
@@ -72,7 +72,7 @@ QPlatformNativeInterface::NativeResourceForContextFunction QXcbGlxNativeInterfac
default:
break;
}
- return Q_NULLPTR;
+ return nullptr;
}
void *QXcbGlxNativeInterfaceHandler::glxContextForContext(QOpenGLContext *context)
diff --git a/src/plugins/platforms/xcb/gl_integrations/xcb_glx/qxcbglxwindow.cpp b/src/plugins/platforms/xcb/gl_integrations/xcb_glx/qxcbglxwindow.cpp
index 145a11a5e3..d682ea87fb 100644
--- a/src/plugins/platforms/xcb/gl_integrations/xcb_glx/qxcbglxwindow.cpp
+++ b/src/plugins/platforms/xcb/gl_integrations/xcb_glx/qxcbglxwindow.cpp
@@ -58,7 +58,7 @@ const xcb_visualtype_t *QXcbGlxWindow::createVisual()
{
QXcbScreen *scr = xcbScreen();
if (!scr)
- return Q_NULLPTR;
+ return nullptr;
qDebug(lcQpaGl) << "Requested format before FBConfig/Visual selection:" << m_format;
@@ -74,7 +74,7 @@ const xcb_visualtype_t *QXcbGlxWindow::createVisual()
XVisualInfo *visualInfo = qglx_findVisualInfo(dpy, scr->screenNumber(), &m_format, GLX_WINDOW_BIT, flags);
if (!visualInfo) {
qWarning() << "No XVisualInfo for format" << m_format;
- return Q_NULLPTR;
+ return nullptr;
}
const xcb_visualtype_t *xcb_visualtype = scr->visualForId(visualInfo->visualid);
XFree(visualInfo);
diff --git a/src/plugins/platforms/xcb/nativepainting/qbackingstore_x11.cpp b/src/plugins/platforms/xcb/nativepainting/qbackingstore_x11.cpp
index 2dd2cdd9e3..cb2bbafee1 100644
--- a/src/plugins/platforms/xcb/nativepainting/qbackingstore_x11.cpp
+++ b/src/plugins/platforms/xcb/nativepainting/qbackingstore_x11.cpp
@@ -115,7 +115,7 @@ void QXcbNativeBackingStore::flush(QWindow *window, const QRegion &region, const
else
#endif
{
- GC gc = XCreateGC(display(), wid, 0, Q_NULLPTR);
+ GC gc = XCreateGC(display(), wid, 0, nullptr);
if (clipRects.size() != 1)
XSetClipRectangles(display(), gc, 0, 0, clipRects.data(), clipRects.size(), YXBanded);
@@ -155,7 +155,7 @@ void QXcbNativeBackingStore::resize(const QSize &size, const QRegion &staticCont
QRect br = staticContents.boundingRect().intersected(QRect(QPoint(0, 0), size));
if (!br.isEmpty()) {
- GC gc = XCreateGC(display(), to, 0, Q_NULLPTR);
+ GC gc = XCreateGC(display(), to, 0, nullptr);
XCopyArea(display(), from, to, gc, br.x(), br.y(), br.width(), br.height(), br.x(), br.y());
XFreeGC(display(), gc);
}
@@ -172,7 +172,7 @@ bool QXcbNativeBackingStore::scroll(const QRegion &area, int dx, int dy)
QRect rect = area.boundingRect();
Pixmap pix = qt_x11PixmapHandle(m_pixmap);
- GC gc = XCreateGC(display(), pix, 0, Q_NULLPTR);
+ GC gc = XCreateGC(display(), pix, 0, nullptr);
XCopyArea(display(), pix, pix, gc,
rect.x(), rect.y(), rect.width(), rect.height(),
rect.x()+dx, rect.y()+dy);
diff --git a/src/plugins/platforms/xcb/nativepainting/qpaintengine_x11_p.h b/src/plugins/platforms/xcb/nativepainting/qpaintengine_x11_p.h
index 34b5d929d5..a0dd6cdf74 100644
--- a/src/plugins/platforms/xcb/nativepainting/qpaintengine_x11_p.h
+++ b/src/plugins/platforms/xcb/nativepainting/qpaintengine_x11_p.h
@@ -56,10 +56,10 @@ public:
QX11PaintEngine();
~QX11PaintEngine();
- bool begin(QPaintDevice *pdev) Q_DECL_OVERRIDE;
- bool end() Q_DECL_OVERRIDE;
+ bool begin(QPaintDevice *pdev) override;
+ bool end() override;
- void updateState(const QPaintEngineState &state) Q_DECL_OVERRIDE;
+ void updateState(const QPaintEngineState &state) override;
void updatePen(const QPen &pen);
void updateBrush(const QBrush &brush, const QPointF &pt);
@@ -68,31 +68,31 @@ public:
void updateMatrix(const QTransform &matrix);
void updateClipRegion_dev(const QRegion &region, Qt::ClipOperation op);
- void drawLines(const QLine *lines, int lineCount) Q_DECL_OVERRIDE;
- void drawLines(const QLineF *lines, int lineCount) Q_DECL_OVERRIDE;
+ void drawLines(const QLine *lines, int lineCount) override;
+ void drawLines(const QLineF *lines, int lineCount) override;
- void drawRects(const QRect *rects, int rectCount) Q_DECL_OVERRIDE;
- void drawRects(const QRectF *rects, int rectCount) Q_DECL_OVERRIDE;
+ void drawRects(const QRect *rects, int rectCount) override;
+ void drawRects(const QRectF *rects, int rectCount) override;
- void drawPoints(const QPoint *points, int pointCount) Q_DECL_OVERRIDE;
- void drawPoints(const QPointF *points, int pointCount) Q_DECL_OVERRIDE;
+ void drawPoints(const QPoint *points, int pointCount) override;
+ void drawPoints(const QPointF *points, int pointCount) override;
- void drawEllipse(const QRect &r) Q_DECL_OVERRIDE;
- void drawEllipse(const QRectF &r) Q_DECL_OVERRIDE;
+ void drawEllipse(const QRect &r) override;
+ void drawEllipse(const QRectF &r) override;
- virtual void drawPolygon(const QPointF *points, int pointCount, PolygonDrawMode mode) Q_DECL_OVERRIDE;
- inline void drawPolygon(const QPoint *points, int pointCount, PolygonDrawMode mode) Q_DECL_OVERRIDE
+ virtual void drawPolygon(const QPointF *points, int pointCount, PolygonDrawMode mode) override;
+ inline void drawPolygon(const QPoint *points, int pointCount, PolygonDrawMode mode) override
{ QPaintEngine::drawPolygon(points, pointCount, mode); }
- void drawPixmap(const QRectF &r, const QPixmap &pm, const QRectF &sr) Q_DECL_OVERRIDE;
- void drawTiledPixmap(const QRectF &r, const QPixmap &pixmap, const QPointF &s) Q_DECL_OVERRIDE;
- void drawPath(const QPainterPath &path) Q_DECL_OVERRIDE;
- void drawTextItem(const QPointF &p, const QTextItem &textItem) Q_DECL_OVERRIDE;
+ void drawPixmap(const QRectF &r, const QPixmap &pm, const QRectF &sr) override;
+ void drawTiledPixmap(const QRectF &r, const QPixmap &pixmap, const QPointF &s) override;
+ void drawPath(const QPainterPath &path) override;
+ void drawTextItem(const QPointF &p, const QTextItem &textItem) override;
void drawImage(const QRectF &r, const QImage &img, const QRectF &sr,
- Qt::ImageConversionFlags flags = Qt::AutoColor) Q_DECL_OVERRIDE;
+ Qt::ImageConversionFlags flags = Qt::AutoColor) override;
virtual Drawable handle() const;
- inline Type type() const Q_DECL_OVERRIDE { return QPaintEngine::X11; }
+ inline Type type() const override { return QPaintEngine::X11; }
QPainter::RenderHints supportedRenderHints() const;
diff --git a/src/plugins/platforms/xcb/nativepainting/qpixmap_x11_p.h b/src/plugins/platforms/xcb/nativepainting/qpixmap_x11_p.h
index 2cbd1fe3d0..79e607c6f8 100644
--- a/src/plugins/platforms/xcb/nativepainting/qpixmap_x11_p.h
+++ b/src/plugins/platforms/xcb/nativepainting/qpixmap_x11_p.h
@@ -56,22 +56,22 @@ public:
QX11PlatformPixmap(PixelType pixelType);
~QX11PlatformPixmap();
- QPlatformPixmap *createCompatiblePlatformPixmap() const Q_DECL_OVERRIDE;
- void resize(int width, int height) Q_DECL_OVERRIDE;
- void fromImage(const QImage &img, Qt::ImageConversionFlags flags) Q_DECL_OVERRIDE;
- void copy(const QPlatformPixmap *data, const QRect &rect) Q_DECL_OVERRIDE;
- bool scroll(int dx, int dy, const QRect &rect) Q_DECL_OVERRIDE;
- int metric(QPaintDevice::PaintDeviceMetric metric) const Q_DECL_OVERRIDE;
- void fill(const QColor &fillColor) Q_DECL_OVERRIDE;
- QBitmap mask() const Q_DECL_OVERRIDE;
- void setMask(const QBitmap &mask) Q_DECL_OVERRIDE;
- bool hasAlphaChannel() const Q_DECL_OVERRIDE;
- QPixmap transformed(const QTransform &matrix, Qt::TransformationMode mode) const Q_DECL_OVERRIDE;
- QImage toImage() const Q_DECL_OVERRIDE;
- QImage toImage(const QRect &rect) const Q_DECL_OVERRIDE;
- QPaintEngine *paintEngine() const Q_DECL_OVERRIDE;
- qreal devicePixelRatio() const Q_DECL_OVERRIDE;
- void setDevicePixelRatio(qreal scaleFactor) Q_DECL_OVERRIDE;
+ QPlatformPixmap *createCompatiblePlatformPixmap() const override;
+ void resize(int width, int height) override;
+ void fromImage(const QImage &img, Qt::ImageConversionFlags flags) override;
+ void copy(const QPlatformPixmap *data, const QRect &rect) override;
+ bool scroll(int dx, int dy, const QRect &rect) override;
+ int metric(QPaintDevice::PaintDeviceMetric metric) const override;
+ void fill(const QColor &fillColor) override;
+ QBitmap mask() const override;
+ void setMask(const QBitmap &mask) override;
+ bool hasAlphaChannel() const override;
+ QPixmap transformed(const QTransform &matrix, Qt::TransformationMode mode) const override;
+ QImage toImage() const override;
+ QImage toImage(const QRect &rect) const override;
+ QPaintEngine *paintEngine() const override;
+ qreal devicePixelRatio() const override;
+ void setDevicePixelRatio(qreal scaleFactor) override;
inline Drawable handle() const { return hd; }
inline Picture x11PictureHandle() const { return picture; }
@@ -123,7 +123,7 @@ inline QX11PlatformPixmap *qt_x11Pixmap(const QPixmap &pixmap)
{
return (pixmap.handle() && pixmap.handle()->classId() == QPlatformPixmap::X11Class)
? static_cast<QX11PlatformPixmap *>(pixmap.handle())
- : Q_NULLPTR;
+ : nullptr;
}
inline Picture qt_x11PictureHandle(const QPixmap &pixmap)
diff --git a/src/plugins/platforms/xcb/nativepainting/qxcbnativepainting.cpp b/src/plugins/platforms/xcb/nativepainting/qxcbnativepainting.cpp
index ccb421d868..5ff45ec183 100644
--- a/src/plugins/platforms/xcb/nativepainting/qxcbnativepainting.cpp
+++ b/src/plugins/platforms/xcb/nativepainting/qxcbnativepainting.cpp
@@ -38,7 +38,7 @@
QT_BEGIN_NAMESPACE
-QXcbX11Data *qt_x11Data = Q_NULLPTR;
+QXcbX11Data *qt_x11Data = nullptr;
void qt_xcb_native_x11_info_init(QXcbConnection *conn)
{
@@ -105,7 +105,7 @@ void qt_xcb_native_x11_info_init(QXcbConnection *conn)
QVector<XRectangle> qt_region_to_xrectangles(const QRegion &r)
{
const int numRects = r.rectCount();
- const QVector<QRect> input = r.rects();
+ const auto input = r.begin();
QVector<XRectangle> output(numRects);
for (int i = 0; i < numRects; ++i) {
const QRect &in = input[i];
@@ -122,7 +122,7 @@ class QXcbX11InfoData : public QSharedData, public QX11InfoData
{};
QXcbX11Info::QXcbX11Info()
- : d(Q_NULLPTR)
+ : d(nullptr)
{}
QXcbX11Info::~QXcbX11Info()
diff --git a/src/plugins/platforms/xcb/qxcbbackingstore.cpp b/src/plugins/platforms/xcb/qxcbbackingstore.cpp
index 420d1ac7c5..1cf45c96d1 100644
--- a/src/plugins/platforms/xcb/qxcbbackingstore.cpp
+++ b/src/plugins/platforms/xcb/qxcbbackingstore.cpp
@@ -69,6 +69,8 @@ public:
QXcbShmImage(QXcbScreen *connection, const QSize &size, uint depth, QImage::Format format);
~QXcbShmImage() { destroy(); }
+ void flushScrolledRegion(bool clientSideScroll);
+
bool scroll(const QRegion &area, int dx, int dy);
QImage *image() { return &m_qimage; }
@@ -86,7 +88,8 @@ private:
void destroy();
void ensureGC(xcb_drawable_t dst);
- void flushPixmap(const QRegion &region);
+ void shmPutImage(xcb_drawable_t drawable, const QRegion &region, const QPoint &offset = QPoint());
+ void flushPixmap(const QRegion &region, bool fullRegion = false);
void setClip(const QRegion &region);
xcb_shm_segment_info_t m_shm_info;
@@ -99,18 +102,26 @@ private:
xcb_gcontext_t m_gc;
xcb_drawable_t m_gc_drawable;
- // When using shared memory this is the region currently shared with the server
- QRegion m_dirtyShm;
-
+ // When using shared memory these variables are used only for server-side scrolling.
// When not using shared memory, we maintain a server-side pixmap with the backing
// store as well as repainted content not yet flushed to the pixmap. We only flush
// the regions we need and only when these are marked dirty. This way we can just
// do a server-side copy on expose instead of sending the pixels every time
xcb_pixmap_t m_xcb_pixmap;
QRegion m_pendingFlush;
+
+ // This is the scrolled region which is stored in server-side pixmap
+ QRegion m_scrolledRegion;
+
+ // When using shared memory this is the region currently shared with the server
+ QRegion m_dirtyShm;
+
+ // When not using shared memory this is a temporary buffer which is uploaded
+ // as a pixmap region to server
QByteArray m_flushBuffer;
bool m_hasAlpha;
+ bool m_clientSideScroll;
};
class QXcbShmGraphicsBuffer : public QPlatformGraphicsBuffer
@@ -145,10 +156,11 @@ private:
QXcbShmImage::QXcbShmImage(QXcbScreen *screen, const QSize &size, uint depth, QImage::Format format)
: QXcbObject(screen->connection())
- , m_graphics_buffer(Q_NULLPTR)
+ , m_graphics_buffer(nullptr)
, m_gc(0)
, m_gc_drawable(0)
, m_xcb_pixmap(0)
+ , m_clientSideScroll(false)
{
const xcb_format_t *fmt = connection()->formatForDepth(depth);
Q_ASSERT(fmt);
@@ -202,13 +214,59 @@ QXcbShmImage::QXcbShmImage(QXcbScreen *screen, const QSize &size, uint depth, QI
m_qimage = QImage( (uchar*) m_xcb_image->data, m_xcb_image->width, m_xcb_image->height, m_xcb_image->stride, format);
m_graphics_buffer = new QXcbShmGraphicsBuffer(&m_qimage);
- if (!hasShm()) {
- m_xcb_pixmap = xcb_generate_id(xcb_connection());
- xcb_create_pixmap(xcb_connection(),
- m_xcb_image->depth,
- m_xcb_pixmap,
- screen->screen()->root,
- m_xcb_image->width, m_xcb_image->height);
+ m_xcb_pixmap = xcb_generate_id(xcb_connection());
+ xcb_create_pixmap(xcb_connection(),
+ m_xcb_image->depth,
+ m_xcb_pixmap,
+ screen->screen()->root,
+ m_xcb_image->width, m_xcb_image->height);
+}
+
+void QXcbShmImage::flushScrolledRegion(bool clientSideScroll)
+{
+ if (m_clientSideScroll == clientSideScroll)
+ return;
+
+ m_clientSideScroll = clientSideScroll;
+
+ if (m_scrolledRegion.isNull())
+ return;
+
+ if (hasShm() && m_dirtyShm.intersects(m_scrolledRegion)) {
+ connection()->sync();
+ m_dirtyShm = QRegion();
+ }
+
+ if (m_clientSideScroll) {
+ // Copy scrolled image region from server-side pixmap to client-side memory
+ for (const QRect &rect : m_scrolledRegion) {
+ const int w = rect.width();
+ const int h = rect.height();
+
+ auto reply = Q_XCB_REPLY_UNCHECKED(xcb_get_image,
+ xcb_connection(),
+ m_xcb_image->format,
+ m_xcb_pixmap,
+ rect.x(), rect.y(),
+ w, h,
+ ~0u);
+
+ if (reply && reply->depth == m_xcb_image->depth) {
+ const QImage img(xcb_get_image_data(reply.get()), w, h, m_qimage.format());
+
+ QPainter p(&m_qimage);
+ p.setCompositionMode(QPainter::CompositionMode_Source);
+ p.drawImage(rect.topLeft(), img);
+ }
+ }
+ m_scrolledRegion = QRegion();
+ } else {
+ // Copy scrolled image region from client-side memory to server-side pixmap
+ ensureGC(m_xcb_pixmap);
+ if (hasShm())
+ shmPutImage(m_xcb_pixmap, m_scrolledRegion);
+ else
+ flushPixmap(m_scrolledRegion, true);
}
}
@@ -216,21 +274,28 @@ extern void qt_scrollRectInImage(QImage &img, const QRect &rect, const QPoint &o
bool QXcbShmImage::scroll(const QRegion &area, int dx, int dy)
{
- if (image()->isNull())
- return false;
+ const QRect bounds(QPoint(), size());
+ const QRegion scrollArea(area & bounds);
+ const QPoint delta(dx, dy);
- if (hasShm())
- preparePaint(area);
+ if (m_clientSideScroll) {
+ if (m_qimage.isNull())
+ return false;
- const QPoint delta(dx, dy);
- for (const QRect &rect : area)
- qt_scrollRectInImage(*image(), rect, delta);
+ if (hasShm())
+ preparePaint(scrollArea);
+
+ for (const QRect &rect : scrollArea)
+ qt_scrollRectInImage(m_qimage, rect, delta);
+ } else {
+ if (hasShm())
+ shmPutImage(m_xcb_pixmap, m_pendingFlush.intersected(scrollArea));
+ else
+ flushPixmap(scrollArea);
- if (m_xcb_pixmap) {
- flushPixmap(area);
ensureGC(m_xcb_pixmap);
- const QRect bounds(QPoint(0, 0), size());
- for (const QRect &src : area) {
+
+ for (const QRect &src : scrollArea) {
const QRect dst = src.translated(delta).intersected(bounds);
xcb_copy_area(xcb_connection(),
m_xcb_pixmap,
@@ -242,6 +307,12 @@ bool QXcbShmImage::scroll(const QRegion &area, int dx, int dy)
}
}
+ m_scrolledRegion |= scrollArea.translated(delta).intersected(bounds);
+ if (hasShm()) {
+ m_pendingFlush -= scrollArea;
+ m_pendingFlush -= m_scrolledRegion;
+ }
+
return true;
}
@@ -265,12 +336,10 @@ void QXcbShmImage::destroy()
if (m_gc)
xcb_free_gc(xcb_connection(), m_gc);
delete m_graphics_buffer;
- m_graphics_buffer = Q_NULLPTR;
+ m_graphics_buffer = nullptr;
- if (m_xcb_pixmap) {
- xcb_free_pixmap(xcb_connection(), m_xcb_pixmap);
- m_xcb_pixmap = 0;
- }
+ xcb_free_pixmap(xcb_connection(), m_xcb_pixmap);
+ m_xcb_pixmap = 0;
}
void QXcbShmImage::ensureGC(xcb_drawable_t dst)
@@ -353,10 +422,35 @@ static inline quint32 round_up_scanline(quint32 base, quint32 pad)
return (base + pad - 1) & -pad;
}
-void QXcbShmImage::flushPixmap(const QRegion &region)
+void QXcbShmImage::shmPutImage(xcb_drawable_t drawable, const QRegion &region, const QPoint &offset)
+{
+ for (const QRect &rect : region) {
+ const QPoint source = rect.translated(offset).topLeft();
+ xcb_shm_put_image(xcb_connection(),
+ drawable,
+ m_gc,
+ m_xcb_image->width,
+ m_xcb_image->height,
+ source.x(), source.y(),
+ rect.width(), rect.height(),
+ rect.x(), rect.y(),
+ m_xcb_image->depth,
+ m_xcb_image->format,
+ 0, // send event?
+ m_shm_info.shmseg,
+ m_xcb_image->data - m_shm_info.shmaddr);
+ }
+ m_dirtyShm |= region.translated(offset);
+}
+
+void QXcbShmImage::flushPixmap(const QRegion &region, bool fullRegion)
{
- const QVector<QRect> rects = m_pendingFlush.intersected(region).rects();
- m_pendingFlush -= region;
+ if (!fullRegion) {
+ auto actualRegion = m_pendingFlush.intersected(region);
+ m_pendingFlush -= region;
+ flushPixmap(actualRegion, true);
+ return;
+ }
xcb_image_t xcb_subimage;
memset(&xcb_subimage, 0, sizeof(xcb_image_t));
@@ -372,7 +466,7 @@ void QXcbShmImage::flushPixmap(const QRegion &region)
const bool needsByteSwap = xcb_subimage.byte_order != m_xcb_image->byte_order;
- for (const QRect &rect : rects) {
+ for (const QRect &rect : region) {
// We must make sure that each request is not larger than max_req_size.
// Each request takes req_size + m_xcb_image->stride * height bytes.
static const uint32_t req_size = sizeof(xcb_put_image_request_t);
@@ -425,16 +519,7 @@ void QXcbShmImage::setClip(const QRegion &region)
static const uint32_t values[] = { XCB_NONE };
xcb_change_gc(xcb_connection(), m_gc, mask, values);
} else {
- const QVector<QRect> qrects = region.rects();
- QVector<xcb_rectangle_t> xcb_rects(qrects.size());
-
- for (int i = 0; i < qrects.size(); i++) {
- xcb_rects[i].x = qrects[i].x();
- xcb_rects[i].y = qrects[i].y();
- xcb_rects[i].width = qrects[i].width();
- xcb_rects[i].height = qrects[i].height();
- }
-
+ const auto xcb_rects = qRegionToXcbRectangleList(region);
xcb_set_clip_rectangles(xcb_connection(),
XCB_CLIP_ORDERING_YX_BANDED,
m_gc,
@@ -445,29 +530,32 @@ void QXcbShmImage::setClip(const QRegion &region)
void QXcbShmImage::put(xcb_drawable_t dst, const QRegion &region, const QPoint &offset)
{
+ Q_ASSERT(!m_clientSideScroll);
+
ensureGC(dst);
setClip(region);
- const QRect bounds = region.boundingRect();
- const QPoint target = bounds.topLeft();
- const QRect source = bounds.translated(offset);
-
if (hasShm()) {
- xcb_shm_put_image(xcb_connection(),
+ // Copy scrolled area on server-side from pixmap to window
+ const QRegion scrolledRegion = m_scrolledRegion.translated(-offset);
+ for (const QRect &rect : scrolledRegion) {
+ const QPoint source = rect.translated(offset).topLeft();
+ xcb_copy_area(xcb_connection(),
+ m_xcb_pixmap,
dst,
m_gc,
- m_xcb_image->width,
- m_xcb_image->height,
source.x(), source.y(),
- source.width(), source.height(),
- target.x(), target.y(),
- m_xcb_image->depth,
- m_xcb_image->format,
- 0, // send event?
- m_shm_info.shmseg,
- m_xcb_image->data - m_shm_info.shmaddr);
- m_dirtyShm |= region.translated(offset);
+ rect.x(), rect.y(),
+ rect.width(), rect.height());
+ }
+
+ // Copy non-scrolled image from client-side memory to server-side window
+ const QRegion notScrolledArea = region - scrolledRegion;
+ shmPutImage(dst, notScrolledArea, offset);
} else {
+ const QRect bounds = region.boundingRect();
+ const QPoint target = bounds.topLeft();
+ const QRect source = bounds.translated(offset);
flushPixmap(region);
xcb_copy_area(xcb_connection(),
m_xcb_pixmap,
@@ -489,9 +577,9 @@ void QXcbShmImage::preparePaint(const QRegion &region)
connection()->sync();
m_dirtyShm = QRegion();
}
- } else {
- m_pendingFlush |= region;
}
+ m_scrolledRegion -= region;
+ m_pendingFlush |= region;
}
QXcbBackingStore::QXcbBackingStore(QWindow *window)
@@ -565,7 +653,7 @@ QImage QXcbBackingStore::toImage() const
QPlatformGraphicsBuffer *QXcbBackingStore::graphicsBuffer() const
{
- return m_image ? m_image->graphicsBuffer() : Q_NULLPTR;
+ return m_image ? m_image->graphicsBuffer() : nullptr;
}
void QXcbBackingStore::flush(QWindow *window, const QRegion &region, const QPoint &offset)
@@ -573,6 +661,8 @@ void QXcbBackingStore::flush(QWindow *window, const QRegion &region, const QPoin
if (!m_image || m_image->size().isEmpty())
return;
+ m_image->flushScrolledRegion(false);
+
QSize imageSize = m_image->size();
QRegion clipped = region;
@@ -603,6 +693,11 @@ void QXcbBackingStore::composeAndFlush(QWindow *window, const QRegion &region, c
QPlatformTextureList *textures,
bool translucentBackground)
{
+ if (!m_image || m_image->size().isEmpty())
+ return;
+
+ m_image->flushScrolledRegion(true);
+
QPlatformBackingStore::composeAndFlush(window, region, offset, textures, translucentBackground);
QXcbWindow *platformWindow = static_cast<QXcbWindow *>(window->handle());
diff --git a/src/plugins/platforms/xcb/qxcbclipboard.cpp b/src/plugins/platforms/xcb/qxcbclipboard.cpp
index 30ab669432..b091928e8c 100644
--- a/src/plugins/platforms/xcb/qxcbclipboard.cpp
+++ b/src/plugins/platforms/xcb/qxcbclipboard.cpp
@@ -899,10 +899,7 @@ xcb_generic_event_t *QXcbClipboard::waitForClipboardEvent(xcb_window_t win, int
connection()->flush();
// sleep 50 ms, so we don't use up CPU cycles all the time.
- struct timeval usleep_tv;
- usleep_tv.tv_sec = 0;
- usleep_tv.tv_usec = 50000;
- select(0, 0, 0, 0, &usleep_tv);
+ QThread::msleep(50);
} while (timer.elapsed() < timeout);
return 0;
diff --git a/src/plugins/platforms/xcb/qxcbconnection.cpp b/src/plugins/platforms/xcb/qxcbconnection.cpp
index 536c709dbe..c5eae20266 100644
--- a/src/plugins/platforms/xcb/qxcbconnection.cpp
+++ b/src/plugins/platforms/xcb/qxcbconnection.cpp
@@ -369,7 +369,7 @@ void QXcbConnection::destroyScreen(QXcbScreen *screen)
// If there are no other screens on the same virtual desktop,
// then transform the physical screen into a fake screen.
const QString nameWas = screen->name();
- screen->setOutput(XCB_NONE, Q_NULLPTR);
+ screen->setOutput(XCB_NONE, nullptr);
qCDebug(lcQpaScreen) << "transformed" << nameWas << "to fake" << screen;
} else {
// There is more than one screen on the same virtual desktop, remove the screen
@@ -395,7 +395,7 @@ void QXcbConnection::initializeScreens()
{
xcb_screen_iterator_t it = xcb_setup_roots_iterator(m_setup);
int xcbScreenNumber = 0; // screen number in the xcb sense
- QXcbScreen *primaryScreen = Q_NULLPTR;
+ QXcbScreen *primaryScreen = nullptr;
while (it.rem) {
// Each "screen" in xcb terminology is a virtual desktop,
// potentially a collection of separate juxtaposed monitors.
@@ -415,7 +415,7 @@ void QXcbConnection::initializeScreens()
qWarning("failed to get the current screen resources");
} else {
xcb_timestamp_t timestamp = 0;
- xcb_randr_output_t *outputs = Q_NULLPTR;
+ xcb_randr_output_t *outputs = nullptr;
int outputCount = xcb_randr_get_screen_resources_current_outputs_length(resources_current.get());
if (outputCount) {
timestamp = resources_current->config_timestamp;
@@ -487,7 +487,7 @@ void QXcbConnection::initializeScreens()
while (it.rem) {
xcb_xinerama_screen_info_t *screen_info = it.data;
QXcbScreen *screen = new QXcbScreen(this, virtualDesktop,
- XCB_NONE, Q_NULLPTR,
+ XCB_NONE, nullptr,
screen_info, it.index);
siblings << screen;
m_screens << screen;
@@ -498,7 +498,7 @@ void QXcbConnection::initializeScreens()
if (siblings.isEmpty()) {
// If there are no XRandR outputs or XRandR extension is missing,
// then create a fake/legacy screen.
- QXcbScreen *screen = new QXcbScreen(this, virtualDesktop, XCB_NONE, Q_NULLPTR);
+ QXcbScreen *screen = new QXcbScreen(this, virtualDesktop, XCB_NONE, nullptr);
qCDebug(lcQpaScreen) << "created fake screen" << screen;
m_screens << screen;
if (m_primaryScreenNumber == xcbScreenNumber) {
@@ -631,7 +631,7 @@ QXcbConnection::QXcbConnection(QXcbNativeInterface *nativeInterface, bool canGra
if (m_glIntegration && !m_glIntegration->initialize(this)) {
qCDebug(lcQpaGl) << "Failed to initialize xcb gl-integration" << glIntegrationNames.at(i);
delete m_glIntegration;
- m_glIntegration = Q_NULLPTR;
+ m_glIntegration = nullptr;
}
}
if (!m_glIntegration)
@@ -689,7 +689,7 @@ QXcbScreen *QXcbConnection::primaryScreen() const
return m_screens.first();
}
- return Q_NULLPTR;
+ return nullptr;
}
void QXcbConnection::addWindowEventListener(xcb_window_t id, QXcbWindowEventListener *eventListener)
@@ -983,6 +983,12 @@ static Qt::MouseButtons translateMouseButtons(int s)
return ret;
}
+void QXcbConnection::setButtonState(Qt::MouseButton button, bool down)
+{
+ m_buttonState.setFlag(button, down);
+ m_button = button;
+}
+
Qt::MouseButton QXcbConnection::translateMouseButton(xcb_button_t s)
{
switch (s) {
@@ -1055,7 +1061,7 @@ void QXcbConnection::handleXcbEvent(xcb_generic_event_t *event)
// the event explicitly contains the state of the three first buttons,
// the rest we need to manage ourselves
m_buttonState = (m_buttonState & ~0x7) | translateMouseButtons(ev->state);
- m_buttonState |= translateMouseButton(ev->detail);
+ setButtonState(translateMouseButton(ev->detail), true);
if (Q_UNLIKELY(lcQpaXInputEvents().isDebugEnabled()))
qCDebug(lcQpaXInputEvents, "legacy mouse press, button %d state %X", ev->detail, static_cast<unsigned int>(m_buttonState));
HANDLE_PLATFORM_WINDOW_EVENT(xcb_button_press_event_t, event, handleButtonPressEvent);
@@ -1064,7 +1070,7 @@ void QXcbConnection::handleXcbEvent(xcb_generic_event_t *event)
xcb_button_release_event_t *ev = (xcb_button_release_event_t *)event;
m_keyboard->updateXKBStateFromCore(ev->state);
m_buttonState = (m_buttonState & ~0x7) | translateMouseButtons(ev->state);
- m_buttonState &= ~translateMouseButton(ev->detail);
+ setButtonState(translateMouseButton(ev->detail), false);
if (Q_UNLIKELY(lcQpaXInputEvents().isDebugEnabled()))
qCDebug(lcQpaXInputEvents, "legacy mouse release, button %d state %X", ev->detail, static_cast<unsigned int>(m_buttonState));
HANDLE_PLATFORM_WINDOW_EVENT(xcb_button_release_event_t, event, handleButtonReleaseEvent);
@@ -1413,7 +1419,7 @@ void QXcbConnection::setFocusWindow(QWindow *w)
void QXcbConnection::setMouseGrabber(QXcbWindow *w)
{
m_mouseGrabber = w;
- m_mousePressWindow = Q_NULLPTR;
+ m_mousePressWindow = nullptr;
}
void QXcbConnection::setMousePressWindow(QXcbWindow *w)
{
@@ -2070,7 +2076,8 @@ const xcb_format_t *QXcbConnection::formatForDepth(uint8_t depth) const
xcb_format_next(&iterator);
}
- return 0;
+ qWarning() << "XCB failed to find an xcb_format_t for depth:" << depth;
+ return nullptr;
}
void QXcbConnection::sync()
diff --git a/src/plugins/platforms/xcb/qxcbconnection.h b/src/plugins/platforms/xcb/qxcbconnection.h
index 999dc0630c..ded11525c1 100644
--- a/src/plugins/platforms/xcb/qxcbconnection.h
+++ b/src/plugins/platforms/xcb/qxcbconnection.h
@@ -409,6 +409,15 @@ public:
const xcb_setup_t *setup() const { return m_setup; }
const xcb_format_t *formatForDepth(uint8_t depth) const;
+ bool imageNeedsEndianSwap() const
+ {
+#if Q_BYTE_ORDER == Q_BIG_ENDIAN
+ return m_setup->image_byte_order != XCB_IMAGE_ORDER_MSB_FIRST;
+#else
+ return m_setup->image_byte_order != XCB_IMAGE_ORDER_LSB_FIRST;
+#endif
+ }
+
QXcbKeyboard *keyboard() const { return m_keyboard; }
#ifndef QT_NO_CLIPBOARD
@@ -476,8 +485,9 @@ public:
xcb_window_t getSelectionOwner(xcb_atom_t atom) const;
xcb_window_t getQtSelectionOwner();
- void setButtonState(Qt::MouseButton button, bool down) { m_buttonState.setFlag(button, down); }
+ void setButtonState(Qt::MouseButton button, bool down);
Qt::MouseButtons buttonState() const { return m_buttonState; }
+ Qt::MouseButton button() const { return m_button; }
Qt::MouseButton translateMouseButton(xcb_button_t s);
QXcbWindow *focusWindow() const { return m_focusWindow; }
@@ -691,6 +701,7 @@ private:
bool has_render_extension = false;
Qt::MouseButtons m_buttonState = 0;
+ Qt::MouseButton m_button = Qt::NoButton;
QXcbWindow *m_focusWindow = nullptr;
QXcbWindow *m_mouseGrabber = nullptr;
@@ -746,16 +757,18 @@ private:
#define Q_XCB_REPLY_CONNECTION_ARG(connection, ...) connection
+struct QStdFreeDeleter {
+ void operator()(void *p) const Q_DECL_NOTHROW { return std::free(p); }
+};
+
#define Q_XCB_REPLY(call, ...) \
- std::unique_ptr<call##_reply_t, decltype(std::free) *>( \
- call##_reply(Q_XCB_REPLY_CONNECTION_ARG(__VA_ARGS__), call(__VA_ARGS__), nullptr), \
- std::free \
+ std::unique_ptr<call##_reply_t, QStdFreeDeleter>( \
+ call##_reply(Q_XCB_REPLY_CONNECTION_ARG(__VA_ARGS__), call(__VA_ARGS__), nullptr) \
)
#define Q_XCB_REPLY_UNCHECKED(call, ...) \
- std::unique_ptr<call##_reply_t, decltype(std::free) *>( \
- call##_reply(Q_XCB_REPLY_CONNECTION_ARG(__VA_ARGS__), call##_unchecked(__VA_ARGS__), nullptr), \
- std::free \
+ std::unique_ptr<call##_reply_t, QStdFreeDeleter>( \
+ call##_reply(Q_XCB_REPLY_CONNECTION_ARG(__VA_ARGS__), call##_unchecked(__VA_ARGS__), nullptr) \
)
template <typename T>
diff --git a/src/plugins/platforms/xcb/qxcbconnection_xi2.cpp b/src/plugins/platforms/xcb/qxcbconnection_xi2.cpp
index b2dcf7c3e7..315f295ff3 100644
--- a/src/plugins/platforms/xcb/qxcbconnection_xi2.cpp
+++ b/src/plugins/platforms/xcb/qxcbconnection_xi2.cpp
@@ -52,12 +52,6 @@
void QXcbConnection::initializeXInput2()
{
- // TODO Qt 6 (or perhaps earlier): remove these redundant env variables
- if (qEnvironmentVariableIsSet("QT_XCB_DEBUG_XINPUT"))
- const_cast<QLoggingCategory&>(lcQpaXInput()).setEnabled(QtDebugMsg, true);
- if (qEnvironmentVariableIsSet("QT_XCB_DEBUG_XINPUT_DEVICES"))
- const_cast<QLoggingCategory&>(lcQpaXInputDevices()).setEnabled(QtDebugMsg, true);
-
Display *xDisplay = static_cast<Display *>(m_xlib_display);
if (XQueryExtension(xDisplay, "XInputExtension", &m_xiOpCode, &m_xiEventBase, &m_xiErrorBase)) {
int xiMajor = 2;
@@ -1340,7 +1334,7 @@ QXcbConnection::TabletData *QXcbConnection::tabletDataForDevice(int id)
if (m_tabletData.at(i).deviceId == id)
return &m_tabletData[i];
}
- return Q_NULLPTR;
+ return nullptr;
}
#endif // QT_CONFIG(tabletevent)
diff --git a/src/plugins/platforms/xcb/qxcbcursor.cpp b/src/plugins/platforms/xcb/qxcbcursor.cpp
index da63360333..34b7d0d236 100644
--- a/src/plugins/platforms/xcb/qxcbcursor.cpp
+++ b/src/plugins/platforms/xcb/qxcbcursor.cpp
@@ -255,29 +255,29 @@ static const uint8_t * const cursor_bits20[] = {
forbidden_bits, forbiddenm_bits
};
-static const char * const cursorNames[] = {
- "left_ptr",
- "up_arrow",
- "cross",
- "wait",
- "ibeam",
- "size_ver",
- "size_hor",
- "size_bdiag",
- "size_fdiag",
- "size_all",
- "blank",
- "split_v",
- "split_h",
- "pointing_hand",
- "forbidden",
- "whats_this",
- "left_ptr_watch",
- "openhand",
- "closedhand",
- "copy",
- "move",
- "link"
+static const std::vector<const char *> cursorNames[] = {
+ { "left_ptr", "default", "top_left_arrow", "left_arrow" },
+ { "up_arrow" },
+ { "cross" },
+ { "wait", "watch", "0426c94ea35c87780ff01dc239897213" },
+ { "ibeam", "text", "xterm" },
+ { "size_ver", "ns-resize", "v_double_arrow", "00008160000006810000408080010102" },
+ { "size_hor", "ew-resize", "h_double_arrow", "028006030e0e7ebffc7f7070c0600140" },
+ { "size_bdiag", "nesw-resize", "50585d75b494802d0151028115016902", "fcf1c3c7cd4491d801f1e1c78f100000" },
+ { "size_fdiag", "nwse-resize", "38c5dff7c7b8962045400281044508d2", "c7088f0f3e6c8088236ef8e1e3e70000" },
+ { "size_all" },
+ { "blank" },
+ { "split_v", "row-resize", "sb_v_double_arrow", "2870a09082c103050810ffdffffe0204", "c07385c7190e701020ff7ffffd08103c" },
+ { "split_h", "col-resize", "sb_h_double_arrow", "043a9f68147c53184671403ffa811cc5", "14fef782d02440884392942c11205230" },
+ { "pointing_hand", "pointer", "hand1", "e29285e634086352946a0e7090d73106" },
+ { "forbidden", "not-allowed", "crossed_circle", "circle", "03b6e0fcb3499374a867c041f52298f0" },
+ { "whats_this", "help", "question_arrow", "5c6cd98b3f3ebcb1f9c7f1c204630408", "d9ce0ab605698f320427677b458ad60b" },
+ { "left_ptr_watch", "half-busy", "progress", "00000000000000020006000e7e9ffc3f", "08e8e1c95fe2fc01f976f1e063a24ccd" },
+ { "openhand", "fleur", "5aca4d189052212118709018842178c0", "9d800788f1b08800ae810202380a0822" },
+ { "closedhand", "grabbing", "208530c400c041818281048008011002" },
+ { "dnd-copy", "copy" },
+ { "dnd-move", "move" },
+ { "dnd-link", "link" }
};
QXcbCursorCacheKey::QXcbCursorCacheKey(const QCursor &c)
@@ -535,22 +535,13 @@ static xcb_cursor_t loadCursor(void *dpy, int cshape)
xcb_cursor_t cursor = XCB_NONE;
if (!ptrXcursorLibraryLoadCursor || !dpy)
return cursor;
- switch (cshape) {
- case Qt::DragCopyCursor:
- cursor = ptrXcursorLibraryLoadCursor(dpy, "dnd-copy");
- break;
- case Qt::DragMoveCursor:
- cursor = ptrXcursorLibraryLoadCursor(dpy, "dnd-move");
- break;
- case Qt::DragLinkCursor:
- cursor = ptrXcursorLibraryLoadCursor(dpy, "dnd-link");
- break;
- default:
- break;
- }
- if (!cursor) {
- cursor = ptrXcursorLibraryLoadCursor(dpy, cursorNames[cshape]);
+
+ for (const char *cursorName: cursorNames[cshape]) {
+ cursor = ptrXcursorLibraryLoadCursor(dpy, cursorName);
+ if (cursor != XCB_NONE)
+ break;
}
+
return cursor;
}
#endif // QT_CONFIG(xcb_xlib) / QT_CONFIG(library)
@@ -565,7 +556,6 @@ xcb_cursor_t QXcbCursor::createFontCursor(int cshape)
#if QT_CONFIG(xcb_xlib) && QT_CONFIG(library)
if (cshape >= 0 && cshape <= Qt::LastCursor) {
void *dpy = connection()->xlib_display();
- // special case for non-standard dnd-* cursors
cursor = loadCursor(dpy, cshape);
if (!cursor && !m_gtkCursorThemeInitialized && m_screen->xSettings()->initialized()) {
QByteArray gtkCursorTheme = m_screen->xSettings()->setting("Gtk/CursorThemeName").toByteArray();
@@ -598,7 +588,7 @@ xcb_cursor_t QXcbCursor::createFontCursor(int cshape)
}
if (cursor && cshape >= 0 && cshape < Qt::LastCursor && connection()->hasXFixes()) {
- const char *name = cursorNames[cshape];
+ const char *name = cursorNames[cshape].front();
xcb_xfixes_set_cursor_name(conn, cursor, strlen(name), name);
}
@@ -660,7 +650,7 @@ QPoint QXcbCursor::pos() const
void QXcbCursor::setPos(const QPoint &pos)
{
- QXcbVirtualDesktop *virtualDesktop = Q_NULLPTR;
+ QXcbVirtualDesktop *virtualDesktop = nullptr;
queryPointer(connection(), &virtualDesktop, 0);
xcb_warp_pointer(xcb_connection(), XCB_NONE, virtualDesktop->root(), 0, 0, 0, 0, pos.x(), pos.y());
xcb_flush(xcb_connection());
diff --git a/src/plugins/platforms/xcb/qxcbdrag.cpp b/src/plugins/platforms/xcb/qxcbdrag.cpp
index 1e963268ef..8ea0ebf966 100644
--- a/src/plugins/platforms/xcb/qxcbdrag.cpp
+++ b/src/plugins/platforms/xcb/qxcbdrag.cpp
@@ -211,7 +211,7 @@ void QXcbDrag::startDrag()
setScreen(current_virtual_desktop->screens().constFirst()->screen());
initiatorWindow = QGuiApplicationPrivate::currentMouseWindow;
QBasicDrag::startDrag();
- if (connection()->mouseGrabber() == Q_NULLPTR)
+ if (connection()->mouseGrabber() == nullptr)
shapedPixmapWindow()->setMouseGrabEnabled(true);
}
@@ -315,7 +315,7 @@ void QXcbDrag::move(const QPoint &globalPos)
if (source_sameanswer.contains(globalPos) && source_sameanswer.isValid())
return;
- QXcbVirtualDesktop *virtualDesktop = Q_NULLPTR;
+ QXcbVirtualDesktop *virtualDesktop = nullptr;
QPoint cursorPos;
QXcbCursor::queryPointer(connection(), &virtualDesktop, &cursorPos);
QXcbScreen *screen = virtualDesktop->screenAt(cursorPos);
@@ -324,7 +324,7 @@ void QXcbDrag::move(const QPoint &globalPos)
if (virtualDesktop != current_virtual_desktop) {
setUseCompositing(virtualDesktop->compositingActive());
recreateShapedPixmapWindow(static_cast<QPlatformScreen*>(screen)->screen(), deviceIndependentPos);
- if (connection()->mouseGrabber() == Q_NULLPTR)
+ if (connection()->mouseGrabber() == nullptr)
shapedPixmapWindow()->setMouseGrabEnabled(true);
current_virtual_desktop = virtualDesktop;
diff --git a/src/plugins/platforms/xcb/qxcbimage.cpp b/src/plugins/platforms/xcb/qxcbimage.cpp
index 36536e0602..e18a08755b 100644
--- a/src/plugins/platforms/xcb/qxcbimage.cpp
+++ b/src/plugins/platforms/xcb/qxcbimage.cpp
@@ -38,6 +38,7 @@
****************************************************************************/
#include "qxcbimage.h"
+#include <QtCore/QtEndian>
#include <QtGui/QColor>
#include <QtGui/private/qimage_p.h>
#include <QtGui/private/qdrawhelper_p.h>
@@ -52,47 +53,108 @@ extern "C" {
#undef template
#endif
+#include "qxcbconnection.h"
+#include "qxcbintegration.h"
+
+namespace {
+
+QImage::Format imageFormatForMasks(int depth, int bits_per_pixel, int red_mask, int blue_mask)
+{
+ if (bits_per_pixel == 32) {
+ switch (depth) {
+ case 32:
+ if (red_mask == 0xff0000 && blue_mask == 0xff)
+ return QImage::Format_ARGB32_Premultiplied;
+#if Q_BYTE_ORDER == Q_LITTLE_ENDIAN
+ if (red_mask == 0xff && blue_mask == 0xff0000)
+ return QImage::Format_RGBA8888_Premultiplied;
+#else
+ if (red_mask == 0xff000000 && blue_mask == 0xff00)
+ return QImage::Format_RGBA8888_Premultiplied;
+#endif
+ if (red_mask == 0x3ff && blue_mask == 0x3ff00000)
+ return QImage::Format_A2BGR30_Premultiplied;
+ if (red_mask == 0x3ff00000 && blue_mask == 0x3ff)
+ return QImage::Format_A2RGB30_Premultiplied;
+ break;
+ case 30:
+ if (red_mask == 0x3ff && blue_mask == 0x3ff00000)
+ return QImage::Format_BGR30;
+ if (blue_mask == 0x3ff && red_mask == 0x3ff00000)
+ return QImage::Format_RGB30;
+ break;
+ case 24:
+ if (red_mask == 0xff0000 && blue_mask == 0xff)
+ return QImage::Format_RGB32;
+#if Q_BYTE_ORDER == Q_LITTLE_ENDIAN
+ if (red_mask == 0xff && blue_mask == 0xff0000)
+ return QImage::Format_RGBX8888;
+#else
+ if (red_mask == 0xff000000 && blue_mask == 0xff00)
+ return QImage::Format_RGBX8888;
+#endif
+ break;
+ }
+ } else if (bits_per_pixel == 16) {
+ if (depth == 16 && red_mask == 0xf800 && blue_mask == 0x1f)
+ return QImage::Format_RGB16;
+ if (depth == 15 && red_mask == 0x7c00 && blue_mask == 0x1f)
+ return QImage::Format_RGB555;
+ }
+ return QImage::Format_Invalid;
+}
+
+} // namespace
+
QT_BEGIN_NAMESPACE
-QImage::Format qt_xcb_imageFormatForVisual(QXcbConnection *connection, uint8_t depth,
- const xcb_visualtype_t *visual)
+bool qt_xcb_imageFormatForVisual(QXcbConnection *connection, uint8_t depth, const xcb_visualtype_t *visual,
+ QImage::Format *imageFormat, bool *needsRgbSwap)
{
+ Q_ASSERT(connection && visual && imageFormat);
+
+ if (needsRgbSwap)
+ *needsRgbSwap = false;
+ *imageFormat = QImage::Format_Invalid;
+
+ if (depth == 8) {
+ if (visual->_class == XCB_VISUAL_CLASS_GRAY_SCALE) {
+ *imageFormat = QImage::Format_Grayscale8;
+ return true;
+ }
+#if QT_CONFIG(xcb_native_painting)
+ if (QXcbIntegration::instance() && QXcbIntegration::instance()->nativePaintingEnabled()) {
+ *imageFormat = QImage::Format_Indexed8;
+ return true;
+ }
+#endif
+ return false;
+ }
+
const xcb_format_t *format = connection->formatForDepth(depth);
+ if (!format)
+ return false;
+
+ const bool connectionEndianSwap = connection->imageNeedsEndianSwap();
+ // We swap the masks and see if we can recognize it as a host format
+ const quint32 red_mask = connectionEndianSwap ? qbswap(visual->red_mask) : visual->red_mask;
+ const quint32 blue_mask = connectionEndianSwap ? qbswap(visual->blue_mask) : visual->blue_mask;
- if (!visual || !format)
- return QImage::Format_Invalid;
-
- if (depth == 32 && format->bits_per_pixel == 32 && visual->red_mask == 0xff0000
- && visual->green_mask == 0xff00 && visual->blue_mask == 0xff)
- return QImage::Format_ARGB32_Premultiplied;
-
- if (depth == 30 && format->bits_per_pixel == 32 && visual->red_mask == 0x3ff
- && visual->green_mask == 0x0ffc00 && visual->blue_mask == 0x3ff00000)
- return QImage::Format_BGR30;
-
- if (depth == 30 && format->bits_per_pixel == 32 && visual->blue_mask == 0x3ff
- && visual->green_mask == 0x0ffc00 && visual->red_mask == 0x3ff00000)
- return QImage::Format_RGB30;
-
- if (depth == 24 && format->bits_per_pixel == 32 && visual->red_mask == 0xff0000
- && visual->green_mask == 0xff00 && visual->blue_mask == 0xff)
- return QImage::Format_RGB32;
-
- if (QSysInfo::ByteOrder == QSysInfo::LittleEndian) {
- if (depth == 24 && format->bits_per_pixel == 32 && visual->blue_mask == 0xff0000
- && visual->green_mask == 0xff00 && visual->red_mask == 0xff)
- return QImage::Format_RGBX8888;
- } else {
- if (depth == 24 && format->bits_per_pixel == 32 && visual->blue_mask == 0xff00
- && visual->green_mask == 0xff0000 && visual->red_mask == 0xff000000)
- return QImage::Format_RGBX8888;
+ *imageFormat = imageFormatForMasks(depth, format->bits_per_pixel, red_mask, blue_mask);
+ if (*imageFormat != QImage::Format_Invalid)
+ return true;
+
+ if (needsRgbSwap) {
+ *imageFormat = imageFormatForMasks(depth, format->bits_per_pixel, blue_mask, red_mask);
+ if (*imageFormat != QImage::Format_Invalid) {
+ *needsRgbSwap = true;
+ return true;
+ }
}
- if (depth == 16 && format->bits_per_pixel == 16 && visual->red_mask == 0xf800
- && visual->green_mask == 0x7e0 && visual->blue_mask == 0x1f)
- return QImage::Format_RGB16;
+ qWarning("Unsupported screen format: depth: %d, bits_per_pixel: %d, red_mask: %x, blue_mask: %x", depth, format->bits_per_pixel, red_mask, blue_mask);
- return QImage::Format_Invalid;
+ return false;
}
QPixmap qt_xcb_pixmapFromXPixmap(QXcbConnection *connection, xcb_pixmap_t pixmap,
@@ -112,44 +174,14 @@ QPixmap qt_xcb_pixmapFromXPixmap(QXcbConnection *connection, xcb_pixmap_t pixmap
QPixmap result;
- QImage::Format format = qt_xcb_imageFormatForVisual(connection, depth, visual);
- if (format != QImage::Format_Invalid) {
+ QImage::Format format;
+ bool needsRgbSwap;
+ if (qt_xcb_imageFormatForVisual(connection, depth, visual, &format, &needsRgbSwap)) {
uint32_t bytes_per_line = length / height;
QImage image(const_cast<uint8_t *>(data), width, height, bytes_per_line, format);
- uint8_t image_byte_order = connection->setup()->image_byte_order;
-
- // we may have to swap the byte order
- if ((QSysInfo::ByteOrder == QSysInfo::LittleEndian && image_byte_order == XCB_IMAGE_ORDER_MSB_FIRST)
- || (QSysInfo::ByteOrder == QSysInfo::BigEndian && image_byte_order == XCB_IMAGE_ORDER_LSB_FIRST))
- {
- for (int i=0; i < image.height(); i++) {
- switch (format) {
- case QImage::Format_RGB16: {
- ushort *p = (ushort*)image.scanLine(i);
- ushort *end = p + image.width();
- while (p < end) {
- *p = ((*p << 8) & 0xff00) | ((*p >> 8) & 0x00ff);
- p++;
- }
- break;
- }
- case QImage::Format_RGB32:
- case QImage::Format_ARGB32_Premultiplied:
- case QImage::Format_RGBX8888: {
- uint *p = (uint*)image.scanLine(i);
- uint *end = p + image.width();
- while (p < end) {
- *p = ((*p << 24) & 0xff000000) | ((*p << 8) & 0x00ff0000)
- | ((*p >> 8) & 0x0000ff00) | ((*p >> 24) & 0x000000ff);
- p++;
- }
- break;
- }
- default:
- Q_ASSERT(false);
- }
- }
- }
+
+ if (needsRgbSwap)
+ image = std::move(image).rgbSwapped();
// fix-up alpha channel
if (format == QImage::Format_RGB32 || format == QImage::Format_RGBX8888) {
diff --git a/src/plugins/platforms/xcb/qxcbimage.h b/src/plugins/platforms/xcb/qxcbimage.h
index a9071a45de..d718089ec2 100644
--- a/src/plugins/platforms/xcb/qxcbimage.h
+++ b/src/plugins/platforms/xcb/qxcbimage.h
@@ -48,8 +48,8 @@
QT_BEGIN_NAMESPACE
-QImage::Format qt_xcb_imageFormatForVisual(QXcbConnection *connection,
- uint8_t depth, const xcb_visualtype_t *visual);
+bool qt_xcb_imageFormatForVisual(QXcbConnection *connection, uint8_t depth, const xcb_visualtype_t *visual,
+ QImage::Format *imageFormat, bool *needsRgbSwap = nullptr);
QPixmap qt_xcb_pixmapFromXPixmap(QXcbConnection *connection, xcb_pixmap_t pixmap,
int width, int height, int depth,
const xcb_visualtype_t *visual);
diff --git a/src/plugins/platforms/xcb/qxcbintegration.cpp b/src/plugins/platforms/xcb/qxcbintegration.cpp
index 72d31060db..6afa7bc934 100644
--- a/src/plugins/platforms/xcb/qxcbintegration.cpp
+++ b/src/plugins/platforms/xcb/qxcbintegration.cpp
@@ -121,7 +121,7 @@ static bool runningUnderDebugger()
#endif
}
-QXcbIntegration *QXcbIntegration::m_instance = Q_NULLPTR;
+QXcbIntegration *QXcbIntegration::m_instance = nullptr;
QXcbIntegration::QXcbIntegration(const QStringList &parameters, int &argc, char **argv)
: m_services(new QGenericUnixServices)
@@ -222,7 +222,7 @@ QXcbIntegration::QXcbIntegration(const QStringList &parameters, int &argc, char
QXcbIntegration::~QXcbIntegration()
{
qDeleteAll(m_connections);
- m_instance = Q_NULLPTR;
+ m_instance = nullptr;
}
QPlatformPixmap *QXcbIntegration::createPlatformPixmap(QPlatformPixmap::PixelType type) const
@@ -274,7 +274,7 @@ QPlatformOpenGLContext *QXcbIntegration::createPlatformOpenGLContext(QOpenGLCont
QXcbGlIntegration *glIntegration = screen->connection()->glIntegration();
if (!glIntegration) {
qWarning("QXcbIntegration: Cannot create platform OpenGL context, neither GLX nor EGL are enabled");
- return Q_NULLPTR;
+ return nullptr;
}
return glIntegration->createPlatformOpenGLContext(context);
}
@@ -296,7 +296,7 @@ QPlatformOffscreenSurface *QXcbIntegration::createPlatformOffscreenSurface(QOffs
QXcbGlIntegration *glIntegration = screen->connection()->glIntegration();
if (!glIntegration) {
qWarning("QXcbIntegration: Cannot create platform offscreen surface, neither GLX nor EGL are enabled");
- return Q_NULLPTR;
+ return nullptr;
}
return glIntegration->createPlatformOffscreenSurface(surface);
}
diff --git a/src/plugins/platforms/xcb/qxcbkeyboard.cpp b/src/plugins/platforms/xcb/qxcbkeyboard.cpp
index e24bd07b6f..2fe3e9332a 100644
--- a/src/plugins/platforms/xcb/qxcbkeyboard.cpp
+++ b/src/plugins/platforms/xcb/qxcbkeyboard.cpp
@@ -1289,20 +1289,56 @@ void QXcbKeyboard::updateVModToRModMapping()
#endif
}
+// Small helper: set modifier bit, if modifier position is valid
+static inline void applyModifier(uint *mask, int modifierBit)
+{
+ if (modifierBit >= 0 && modifierBit < 8)
+ *mask |= 1 << modifierBit;
+}
+
void QXcbKeyboard::updateModifiers()
{
+ memset(&rmod_masks, 0, sizeof(rmod_masks));
+
+ // Compute X modifier bits for Qt modifiers
+ KeysymModifierMap keysymMods(keysymsToModifiers());
+ applyModifier(&rmod_masks.alt, keysymMods.value(XK_Alt_L, -1));
+ applyModifier(&rmod_masks.alt, keysymMods.value(XK_Alt_R, -1));
+ applyModifier(&rmod_masks.meta, keysymMods.value(XK_Meta_L, -1));
+ applyModifier(&rmod_masks.meta, keysymMods.value(XK_Meta_R, -1));
+ applyModifier(&rmod_masks.altgr, keysymMods.value(XK_Mode_switch, -1));
+ applyModifier(&rmod_masks.super, keysymMods.value(XK_Super_L, -1));
+ applyModifier(&rmod_masks.super, keysymMods.value(XK_Super_R, -1));
+ applyModifier(&rmod_masks.hyper, keysymMods.value(XK_Hyper_L, -1));
+ applyModifier(&rmod_masks.hyper, keysymMods.value(XK_Hyper_R, -1));
+
+ resolveMaskConflicts();
+}
+
+// Small helper: check if an array of xcb_keycode_t contains a certain code
+static inline bool keycodes_contains(xcb_keycode_t *codes, xcb_keycode_t which)
+{
+ while (*codes != XCB_NO_SYMBOL) {
+ if (*codes == which) return true;
+ codes++;
+ }
+ return false;
+}
+
+QXcbKeyboard::KeysymModifierMap QXcbKeyboard::keysymsToModifiers()
+{
// The core protocol does not provide a convenient way to determine the mapping
// of modifier bits. Clients must retrieve and search the modifier map to determine
// the keycodes bound to each modifier, and then retrieve and search the keyboard
// mapping to determine the keysyms bound to the keycodes. They must repeat this
// process for all modifiers whenever any part of the modifier mapping is changed.
- memset(&rmod_masks, 0, sizeof(rmod_masks));
- xcb_connection_t *conn = xcb_connection();
- auto modMapReply = Q_XCB_REPLY(xcb_get_modifier_mapping, conn);
+ KeysymModifierMap map;
+
+ auto modMapReply = Q_XCB_REPLY(xcb_get_modifier_mapping, xcb_connection());
if (!modMapReply) {
qWarning("Qt: failed to get modifier mapping");
- return;
+ return map;
}
// for Alt and Meta L and R are the same
@@ -1318,34 +1354,62 @@ void QXcbKeyboard::updateModifiers()
modKeyCodes[i] = xcb_key_symbols_get_keycode(m_key_symbols, symbols[i]);
xcb_keycode_t *modMap = xcb_get_modifier_mapping_keycodes(modMapReply.get());
- const int w = modMapReply->keycodes_per_modifier;
- for (size_t i = 0; i < numSymbols; ++i) {
- for (int bit = 0; bit < 8; ++bit) {
- uint mask = 1 << bit;
- for (int x = 0; x < w; ++x) {
- xcb_keycode_t keyCode = modMap[x + bit * w];
- xcb_keycode_t *itk = modKeyCodes[i];
- while (itk && *itk != XCB_NO_SYMBOL)
- if (*itk++ == keyCode) {
- uint sym = symbols[i];
- if ((sym == XK_Alt_L || sym == XK_Alt_R))
- rmod_masks.alt = mask;
- if ((sym == XK_Meta_L || sym == XK_Meta_R))
- rmod_masks.meta = mask;
- if (sym == XK_Mode_switch)
- rmod_masks.altgr = mask;
- if ((sym == XK_Super_L) || (sym == XK_Super_R))
- rmod_masks.super = mask;
- if ((sym == XK_Hyper_L) || (sym == XK_Hyper_R))
- rmod_masks.hyper = mask;
- }
+ const int modMapLength = xcb_get_modifier_mapping_keycodes_length(modMapReply.get());
+ /* For each modifier of "Shift, Lock, Control, Mod1, Mod2, Mod3,
+ * Mod4, and Mod5" the modifier map contains keycodes_per_modifier
+ * key codes that are associated with a modifier.
+ *
+ * As an example, take this 'xmodmap' output:
+ * xmodmap: up to 4 keys per modifier, (keycodes in parentheses):
+ *
+ * shift Shift_L (0x32), Shift_R (0x3e)
+ * lock Caps_Lock (0x42)
+ * control Control_L (0x25), Control_R (0x69)
+ * mod1 Alt_L (0x40), Alt_R (0x6c), Meta_L (0xcd)
+ * mod2 Num_Lock (0x4d)
+ * mod3
+ * mod4 Super_L (0x85), Super_R (0x86), Super_L (0xce), Hyper_L (0xcf)
+ * mod5 ISO_Level3_Shift (0x5c), Mode_switch (0xcb)
+ *
+ * The corresponding raw modifier map would contain keycodes for:
+ * Shift_L (0x32), Shift_R (0x3e), 0, 0,
+ * Caps_Lock (0x42), 0, 0, 0,
+ * Control_L (0x25), Control_R (0x69), 0, 0,
+ * Alt_L (0x40), Alt_R (0x6c), Meta_L (0xcd), 0,
+ * Num_Lock (0x4d), 0, 0, 0,
+ * 0,0,0,0,
+ * Super_L (0x85), Super_R (0x86), Super_L (0xce), Hyper_L (0xcf),
+ * ISO_Level3_Shift (0x5c), Mode_switch (0xcb), 0, 0
+ */
+
+ /* Create a map between a modifier keysym (as per the symbols array)
+ * and the modifier bit it's associated with (if any).
+ * As modMap contains key codes, search modKeyCodes for a match;
+ * if one is found we can look up the associated keysym.
+ * Together with the modifier index this will be used
+ * to compute a mapping between X modifier bits and Qt's
+ * modifiers (Alt, Ctrl etc). */
+ for (int i = 0; i < modMapLength; i++) {
+ if (modMap[i] == XCB_NO_SYMBOL)
+ continue;
+ // Get key symbol for key code
+ for (size_t k = 0; k < numSymbols; k++) {
+ if (modKeyCodes[k] && keycodes_contains(modKeyCodes[k], modMap[i])) {
+ // Key code is for modifier. Record mapping
+ xcb_keysym_t sym = symbols[k];
+ /* As per modMap layout explanation above, dividing
+ * by keycodes_per_modifier gives the 'row' in the
+ * modifier map, which in turn is the modifier bit. */
+ map[sym] = i / modMapReply->keycodes_per_modifier;
+ break;
}
}
}
for (size_t i = 0; i < numSymbols; ++i)
free(modKeyCodes[i]);
- resolveMaskConflicts();
+
+ return map;
}
void QXcbKeyboard::resolveMaskConflicts()
diff --git a/src/plugins/platforms/xcb/qxcbkeyboard.h b/src/plugins/platforms/xcb/qxcbkeyboard.h
index 7f1c51fab8..1e3e97d1ec 100644
--- a/src/plugins/platforms/xcb/qxcbkeyboard.h
+++ b/src/plugins/platforms/xcb/qxcbkeyboard.h
@@ -96,6 +96,8 @@ protected:
void clearXKBConfig();
// when XKEYBOARD not present on the X server
void updateModifiers();
+ typedef QMap<xcb_keysym_t, int> KeysymModifierMap;
+ KeysymModifierMap keysymsToModifiers();
// when XKEYBOARD is present on the X server
void updateVModMapping();
void updateVModToRModMapping();
diff --git a/src/plugins/platforms/xcb/qxcbmime.cpp b/src/plugins/platforms/xcb/qxcbmime.cpp
index 2848446098..58e2e8c0e6 100644
--- a/src/plugins/platforms/xcb/qxcbmime.cpp
+++ b/src/plugins/platforms/xcb/qxcbmime.cpp
@@ -160,9 +160,10 @@ QVector<xcb_atom_t> QXcbMime::mimeAtomsForFormat(QXcbConnection *connection, con
return atoms;
}
-QVariant QXcbMime::mimeConvertToFormat(QXcbConnection *connection, xcb_atom_t a, const QByteArray &data, const QString &format,
+QVariant QXcbMime::mimeConvertToFormat(QXcbConnection *connection, xcb_atom_t a, const QByteArray &d, const QString &format,
QVariant::Type requestedType, const QByteArray &encoding)
{
+ QByteArray data = d;
QString atomName = mimeAtomToString(connection, a);
// qDebug() << "mimeConvertDataToFormat" << format << atomName << data;
@@ -182,8 +183,11 @@ QVariant QXcbMime::mimeConvertToFormat(QXcbConnection *connection, xcb_atom_t a,
// special cases for string types
if (format == QLatin1String("text/plain")) {
- if (a == connection->atom(QXcbAtom::UTF8_STRING))
+ if (data.endsWith('\0'))
+ data.chop(1);
+ if (a == connection->atom(QXcbAtom::UTF8_STRING)) {
return QString::fromUtf8(data);
+ }
if (a == XCB_ATOM_STRING ||
a == connection->atom(QXcbAtom::TEXT))
return QString::fromLatin1(data);
@@ -221,6 +225,9 @@ QVariant QXcbMime::mimeConvertToFormat(QXcbConnection *connection, xcb_atom_t a,
}
}
}
+ // 8 byte encoding, remove a possible 0 at the end
+ if (data.endsWith('\0'))
+ data.chop(1);
}
if (atomName == format)
diff --git a/src/plugins/platforms/xcb/qxcbnativeinterface.cpp b/src/plugins/platforms/xcb/qxcbnativeinterface.cpp
index caa9499c45..d989761297 100644
--- a/src/plugins/platforms/xcb/qxcbnativeinterface.cpp
+++ b/src/plugins/platforms/xcb/qxcbnativeinterface.cpp
@@ -101,7 +101,7 @@ QXcbNativeInterface::QXcbNativeInterface() :
static inline QXcbSystemTrayTracker *systemTrayTracker(const QScreen *s)
{
if (!s)
- return Q_NULLPTR;
+ return nullptr;
return static_cast<const QXcbScreen *>(s->handle())->connection()->systemTrayTracker();
}
@@ -194,7 +194,7 @@ void *QXcbNativeInterface::nativeResourceForScreen(const QByteArray &resourceStr
{
if (!screen) {
qWarning("nativeResourceForScreen: null screen");
- return Q_NULLPTR;
+ return nullptr;
}
QByteArray lowerCaseResource = resourceString.toLower();
@@ -236,7 +236,7 @@ void *QXcbNativeInterface::nativeResourceForScreen(const QByteArray &resourceStr
break;
case CompositingEnabled:
if (QXcbVirtualDesktop *vd = xcbScreen->virtualDesktop())
- result = vd->compositingActive() ? this : Q_NULLPTR;
+ result = vd->compositingActive() ? this : nullptr;
break;
default:
break;
@@ -294,7 +294,7 @@ void *QXcbNativeInterface::nativeResourceForCursor(const QByteArray &resource, c
}
}
}
- return Q_NULLPTR;
+ return nullptr;
}
#endif // !QT_NO_CURSOR
@@ -323,7 +323,7 @@ QPlatformNativeInterface::NativeResourceForContextFunction QXcbNativeInterface::
QPlatformNativeInterface::NativeResourceForContextFunction func = handlerNativeResourceFunctionForContext(lowerCaseResource);
if (func)
return func;
- return Q_NULLPTR;
+ return nullptr;
}
QPlatformNativeInterface::NativeResourceForScreenFunction QXcbNativeInterface::nativeResourceFunctionForScreen(const QByteArray &resource)
@@ -390,13 +390,13 @@ QFunctionPointer QXcbNativeInterface::platformFunction(const QByteArray &functio
if (function == QXcbScreenFunctions::virtualDesktopNumberIdentifier())
return QFunctionPointer(QXcbScreenFunctions::VirtualDesktopNumber(QXcbScreen::virtualDesktopNumberStatic));
- return Q_NULLPTR;
+ return nullptr;
}
void *QXcbNativeInterface::appTime(const QXcbScreen *screen)
{
if (!screen)
- return Q_NULLPTR;
+ return nullptr;
return reinterpret_cast<void *>(quintptr(screen->connection()->time()));
}
@@ -404,7 +404,7 @@ void *QXcbNativeInterface::appTime(const QXcbScreen *screen)
void *QXcbNativeInterface::appUserTime(const QXcbScreen *screen)
{
if (!screen)
- return Q_NULLPTR;
+ return nullptr;
return reinterpret_cast<void *>(quintptr(screen->connection()->netWmUserTime()));
}
@@ -412,7 +412,7 @@ void *QXcbNativeInterface::appUserTime(const QXcbScreen *screen)
void *QXcbNativeInterface::getTimestamp(const QXcbScreen *screen)
{
if (!screen)
- return Q_NULLPTR;
+ return nullptr;
return reinterpret_cast<void *>(quintptr(screen->connection()->getTimestamp()));
}
@@ -452,7 +452,7 @@ void *QXcbNativeInterface::display()
if (defaultConnection)
return defaultConnection->xlib_display();
#endif
- return Q_NULLPTR;
+ return nullptr;
}
void *QXcbNativeInterface::connection()
@@ -525,10 +525,10 @@ QXcbScreen *QXcbNativeInterface::qPlatformScreenForWindow(QWindow *window)
QXcbScreen *screen;
if (window) {
QScreen *qs = window->screen();
- screen = static_cast<QXcbScreen *>(qs ? qs->handle() : Q_NULLPTR);
+ screen = static_cast<QXcbScreen *>(qs ? qs->handle() : nullptr);
} else {
QScreen *qs = QGuiApplication::primaryScreen();
- screen = static_cast<QXcbScreen *>(qs ? qs->handle() : Q_NULLPTR);
+ screen = static_cast<QXcbScreen *>(qs ? qs->handle() : nullptr);
}
return screen;
}
@@ -537,23 +537,23 @@ void *QXcbNativeInterface::displayForWindow(QWindow *window)
{
#if QT_CONFIG(xcb_xlib)
QXcbScreen *screen = qPlatformScreenForWindow(window);
- return screen ? screen->connection()->xlib_display() : Q_NULLPTR;
+ return screen ? screen->connection()->xlib_display() : nullptr;
#else
Q_UNUSED(window);
- return Q_NULLPTR;
+ return nullptr;
#endif
}
void *QXcbNativeInterface::connectionForWindow(QWindow *window)
{
QXcbScreen *screen = qPlatformScreenForWindow(window);
- return screen ? screen->xcb_connection() : Q_NULLPTR;
+ return screen ? screen->xcb_connection() : nullptr;
}
void *QXcbNativeInterface::screenForWindow(QWindow *window)
{
QXcbScreen *screen = qPlatformScreenForWindow(window);
- return screen ? screen->screen() : Q_NULLPTR;
+ return screen ? screen->screen() : nullptr;
}
void QXcbNativeInterface::addHandler(QXcbNativeInterfaceHandler *handler)
@@ -575,7 +575,7 @@ QPlatformNativeInterface::NativeResourceForIntegrationFunction QXcbNativeInterfa
if (result)
return result;
}
- return Q_NULLPTR;
+ return nullptr;
}
QPlatformNativeInterface::NativeResourceForContextFunction QXcbNativeInterface::handlerNativeResourceFunctionForContext(const QByteArray &resource) const
@@ -586,7 +586,7 @@ QPlatformNativeInterface::NativeResourceForContextFunction QXcbNativeInterface::
if (result)
return result;
}
- return Q_NULLPTR;
+ return nullptr;
}
QPlatformNativeInterface::NativeResourceForScreenFunction QXcbNativeInterface::handlerNativeResourceFunctionForScreen(const QByteArray &resource) const
@@ -597,7 +597,7 @@ QPlatformNativeInterface::NativeResourceForScreenFunction QXcbNativeInterface::h
if (result)
return result;
}
- return Q_NULLPTR;
+ return nullptr;
}
QPlatformNativeInterface::NativeResourceForWindowFunction QXcbNativeInterface::handlerNativeResourceFunctionForWindow(const QByteArray &resource) const
@@ -608,7 +608,7 @@ QPlatformNativeInterface::NativeResourceForWindowFunction QXcbNativeInterface::h
if (result)
return result;
}
- return Q_NULLPTR;
+ return nullptr;
}
QPlatformNativeInterface::NativeResourceForBackingStoreFunction QXcbNativeInterface::handlerNativeResourceFunctionForBackingStore(const QByteArray &resource) const
@@ -619,7 +619,7 @@ QPlatformNativeInterface::NativeResourceForBackingStoreFunction QXcbNativeInterf
if (result)
return result;
}
- return Q_NULLPTR;
+ return nullptr;
}
QFunctionPointer QXcbNativeInterface::handlerPlatformFunction(const QByteArray &function) const
@@ -630,7 +630,7 @@ QFunctionPointer QXcbNativeInterface::handlerPlatformFunction(const QByteArray &
if (func)
return func;
}
- return Q_NULLPTR;
+ return nullptr;
}
void *QXcbNativeInterface::handlerNativeResourceForIntegration(const QByteArray &resource) const
@@ -638,7 +638,7 @@ void *QXcbNativeInterface::handlerNativeResourceForIntegration(const QByteArray
NativeResourceForIntegrationFunction func = handlerNativeResourceFunctionForIntegration(resource);
if (func)
return func();
- return Q_NULLPTR;
+ return nullptr;
}
void *QXcbNativeInterface::handlerNativeResourceForContext(const QByteArray &resource, QOpenGLContext *context) const
@@ -646,7 +646,7 @@ void *QXcbNativeInterface::handlerNativeResourceForContext(const QByteArray &res
NativeResourceForContextFunction func = handlerNativeResourceFunctionForContext(resource);
if (func)
return func(context);
- return Q_NULLPTR;
+ return nullptr;
}
void *QXcbNativeInterface::handlerNativeResourceForScreen(const QByteArray &resource, QScreen *screen) const
@@ -654,7 +654,7 @@ void *QXcbNativeInterface::handlerNativeResourceForScreen(const QByteArray &reso
NativeResourceForScreenFunction func = handlerNativeResourceFunctionForScreen(resource);
if (func)
return func(screen);
- return Q_NULLPTR;
+ return nullptr;
}
void *QXcbNativeInterface::handlerNativeResourceForWindow(const QByteArray &resource, QWindow *window) const
@@ -662,7 +662,7 @@ void *QXcbNativeInterface::handlerNativeResourceForWindow(const QByteArray &reso
NativeResourceForWindowFunction func = handlerNativeResourceFunctionForWindow(resource);
if (func)
return func(window);
- return Q_NULLPTR;
+ return nullptr;
}
void *QXcbNativeInterface::handlerNativeResourceForBackingStore(const QByteArray &resource, QBackingStore *backingStore) const
@@ -670,7 +670,7 @@ void *QXcbNativeInterface::handlerNativeResourceForBackingStore(const QByteArray
NativeResourceForBackingStoreFunction func = handlerNativeResourceFunctionForBackingStore(resource);
if (func)
return func(backingStore);
- return Q_NULLPTR;
+ return nullptr;
}
QT_END_NAMESPACE
diff --git a/src/plugins/platforms/xcb/qxcbscreen.cpp b/src/plugins/platforms/xcb/qxcbscreen.cpp
index 67c96b2d80..e3d9bc7a3d 100644
--- a/src/plugins/platforms/xcb/qxcbscreen.cpp
+++ b/src/plugins/platforms/xcb/qxcbscreen.cpp
@@ -140,7 +140,7 @@ QXcbScreen *QXcbVirtualDesktop::screenAt(const QPoint &pos) const
if (screen->virtualDesktop() == this && screen->geometry().contains(pos))
return screen;
}
- return Q_NULLPTR;
+ return nullptr;
}
void QXcbVirtualDesktop::addScreen(QPlatformScreen *s)
@@ -590,7 +590,9 @@ QRect QXcbScreen::availableGeometry() const
QImage::Format QXcbScreen::format() const
{
- return qt_xcb_imageFormatForVisual(connection(), screen()->root_depth, visualForId(screen()->root_visual));
+ QImage::Format format;
+ qt_xcb_imageFormatForVisual(connection(), screen()->root_depth, visualForId(screen()->root_visual), &format);
+ return format;
}
QDpi QXcbScreen::virtualDpi() const
diff --git a/src/plugins/platforms/xcb/qxcbscreen.h b/src/plugins/platforms/xcb/qxcbscreen.h
index 842738b622..4a9b1bd209 100644
--- a/src/plugins/platforms/xcb/qxcbscreen.h
+++ b/src/plugins/platforms/xcb/qxcbscreen.h
@@ -140,7 +140,7 @@ class Q_XCB_EXPORT QXcbScreen : public QXcbObject, public QPlatformScreen
public:
QXcbScreen(QXcbConnection *connection, QXcbVirtualDesktop *virtualDesktop,
xcb_randr_output_t outputId, xcb_randr_get_output_info_reply_t *outputInfo,
- const xcb_xinerama_screen_info_t *xineramaScreenInfo = Q_NULLPTR, int xineramaScreenIdx = -1);
+ const xcb_xinerama_screen_info_t *xineramaScreenInfo = nullptr, int xineramaScreenIdx = -1);
~QXcbScreen();
QString getOutputName(xcb_randr_get_output_info_reply_t *outputInfo);
diff --git a/src/plugins/platforms/xcb/qxcbwindow.cpp b/src/plugins/platforms/xcb/qxcbwindow.cpp
index c8a668b72c..e7096fb8f0 100644
--- a/src/plugins/platforms/xcb/qxcbwindow.cpp
+++ b/src/plugins/platforms/xcb/qxcbwindow.cpp
@@ -51,6 +51,7 @@
#include "qxcbscreen.h"
#include "qxcbdrag.h"
#include "qxcbkeyboard.h"
+#include "qxcbimage.h"
#include "qxcbwmsupport.h"
#include "qxcbimage.h"
#include "qxcbnativeinterface.h"
@@ -176,80 +177,23 @@ static inline bool isTransient(const QWindow *w)
|| w->type() == Qt::Popup;
}
-static inline QImage::Format imageFormatForVisual(int depth, quint32 red_mask, quint32 blue_mask, bool *rgbSwap)
+void QXcbWindow::setImageFormatForVisual(const xcb_visualtype_t *visual)
{
- if (rgbSwap)
- *rgbSwap = false;
- switch (depth) {
- case 32:
- if (blue_mask == 0xff)
- return QImage::Format_ARGB32_Premultiplied;
- if (red_mask == 0x3ff)
- return QImage::Format_A2BGR30_Premultiplied;
- if (blue_mask == 0x3ff)
- return QImage::Format_A2RGB30_Premultiplied;
- if (red_mask == 0xff) {
- if (rgbSwap)
- *rgbSwap = true;
- return QImage::Format_ARGB32_Premultiplied;
- }
- break;
- case 30:
- if (red_mask == 0x3ff)
- return QImage::Format_BGR30;
- if (blue_mask == 0x3ff)
- return QImage::Format_RGB30;
- break;
- case 24:
- if (blue_mask == 0xff)
- return QImage::Format_RGB32;
- if (red_mask == 0xff) {
- if (rgbSwap)
- *rgbSwap = true;
- return QImage::Format_RGB32;
- }
- break;
- case 16:
- if (blue_mask == 0x1f)
- return QImage::Format_RGB16;
- if (red_mask == 0x1f) {
- if (rgbSwap)
- *rgbSwap = true;
- return QImage::Format_RGB16;
- }
- break;
- case 15:
- if (blue_mask == 0x1f)
- return QImage::Format_RGB555;
- if (red_mask == 0x1f) {
- if (rgbSwap)
- *rgbSwap = true;
- return QImage::Format_RGB555;
- }
- break;
-#if QT_CONFIG(xcb_native_painting)
- case 8:
- if (QXcbIntegration::instance() && QXcbIntegration::instance()->nativePaintingEnabled())
- return QImage::Format_Indexed8;
- break;
-#endif
- default:
- break;
- }
- qWarning("Unsupported screen format: depth: %d, red_mask: %x, blue_mask: %x", depth, red_mask, blue_mask);
+ if (qt_xcb_imageFormatForVisual(connection(), m_depth, visual, &m_imageFormat, &m_imageRgbSwap))
+ return;
- switch (depth) {
+ switch (m_depth) {
+ case 32:
case 24:
qWarning("Using RGB32 fallback, if this works your X11 server is reporting a bad screen format.");
- return QImage::Format_RGB32;
+ m_imageFormat = QImage::Format_RGB32;
+ break;
case 16:
qWarning("Using RGB16 fallback, if this works your X11 server is reporting a bad screen format.");
- return QImage::Format_RGB16;
+ m_imageFormat = QImage::Format_RGB16;
default:
break;
}
-
- return QImage::Format_Invalid;
}
static inline bool positionIncludesFrame(QWindow *w)
@@ -287,7 +231,7 @@ static inline XTextProperty* qstringToXTP(Display *dpy, const QString& s)
if (!mapper || errCode < 0) {
mapper = QTextCodec::codecForName("latin1");
if (!mapper || !mapper->canEncode(s))
- return Q_NULLPTR;
+ return nullptr;
#endif
static QByteArray qcs;
qcs = s.toLatin1();
@@ -322,7 +266,7 @@ static QWindow *childWindowAt(QWindow *win, const QPoint &p)
&& win->geometry().contains(win->parent()->mapFromGlobal(p))) {
return win;
}
- return Q_NULLPTR;
+ return nullptr;
}
static const char *wm_window_type_property_id = "_q_xcb_wm_window_type";
@@ -381,7 +325,7 @@ void QXcbWindow::create()
}
if (!visual)
visual = platformScreen->visualForId(m_visualId);
- m_imageFormat = imageFormatForVisual(m_depth, visual->red_mask, visual->blue_mask, &m_imageRgbSwap);
+ setImageFormatForVisual(visual);
connection()->addWindowEventListener(m_window, this);
return;
}
@@ -418,7 +362,7 @@ void QXcbWindow::create()
resolveFormat(platformScreen->surfaceFormatFor(window()->requestedFormat()));
- const xcb_visualtype_t *visual = Q_NULLPTR;
+ const xcb_visualtype_t *visual = nullptr;
if (connection()->hasDefaultVisualId()) {
visual = platformScreen->visualForId(connection()->defaultVisualId());
@@ -451,7 +395,7 @@ void QXcbWindow::create()
m_visualId = visual->visual_id;
m_depth = platformScreen->depthOfVisual(m_visualId);
- m_imageFormat = imageFormatForVisual(m_depth, visual->red_mask, visual->blue_mask, &m_imageRgbSwap);
+ setImageFormatForVisual(visual);
quint32 mask = XCB_CW_BACK_PIXMAP
| XCB_CW_BORDER_PIXEL
@@ -641,7 +585,7 @@ void QXcbWindow::destroy()
if (connection()->focusWindow() == this)
doFocusOut();
if (connection()->mouseGrabber() == this)
- connection()->setMouseGrabber(Q_NULLPTR);
+ connection()->setMouseGrabber(nullptr);
if (m_syncCounter && m_usingSyncProtocol)
xcb_sync_destroy_counter(xcb_connection(), m_syncCounter);
@@ -700,6 +644,15 @@ void QXcbWindow::setGeometry(const QRect &rect)
qBound<qint32>(1, wmGeometry.height(), XCOORD_MAX),
};
xcb_configure_window(xcb_connection(), m_window, mask, reinterpret_cast<const quint32*>(values));
+ if (window()->parent() && !window()->transientParent()) {
+ // Wait for server reply for parented windows to ensure that a few window
+ // moves will come as a one event. This is important when native widget is
+ // moved a few times in X and Y directions causing native scroll. Widget
+ // must get single event to not trigger unwanted widget position changes
+ // and then expose events causing backingstore flushes with incorrect
+ // offset causing image crruption.
+ connection()->sync();
+ }
}
xcb_flush(xcb_connection());
@@ -877,12 +830,12 @@ void QXcbWindow::hide()
xcb_flush(xcb_connection());
if (connection()->mouseGrabber() == this)
- connection()->setMouseGrabber(Q_NULLPTR);
+ connection()->setMouseGrabber(nullptr);
if (QPlatformWindow *w = connection()->mousePressWindow()) {
// Unset mousePressWindow when it (or one of its parents) is unmapped
while (w) {
if (w == this) {
- connection()->setMousePressWindow(Q_NULLPTR);
+ connection()->setMousePressWindow(nullptr);
break;
}
w = w->parent();
@@ -900,7 +853,7 @@ void QXcbWindow::hide()
// Find the top level window at cursor position.
// Don't use QGuiApplication::topLevelAt(): search only the virtual siblings of this window's screen
- QWindow *enterWindow = Q_NULLPTR;
+ QWindow *enterWindow = nullptr;
const auto screens = xcbScreen()->virtualSiblings();
for (QPlatformScreen *screen : screens) {
if (screen->geometry().contains(cursorPos)) {
@@ -2000,13 +1953,14 @@ void QXcbWindow::handleClientMessageEvent(const xcb_client_message_event_t *even
return;
if (event->type == atom(QXcbAtom::WM_PROTOCOLS)) {
- if (event->data.data32[0] == atom(QXcbAtom::WM_DELETE_WINDOW)) {
+ xcb_atom_t protocolAtom = event->data.data32[0];
+ if (protocolAtom == atom(QXcbAtom::WM_DELETE_WINDOW)) {
QWindowSystemInterface::handleCloseEvent(window());
- } else if (event->data.data32[0] == atom(QXcbAtom::WM_TAKE_FOCUS)) {
+ } else if (protocolAtom == atom(QXcbAtom::WM_TAKE_FOCUS)) {
connection()->setTime(event->data.data32[1]);
relayFocusToModalWindow();
return;
- } else if (event->data.data32[0] == atom(QXcbAtom::_NET_WM_PING)) {
+ } else if (protocolAtom == atom(QXcbAtom::_NET_WM_PING)) {
if (event->window == xcbScreen()->root())
return;
@@ -2015,20 +1969,23 @@ void QXcbWindow::handleClientMessageEvent(const xcb_client_message_event_t *even
reply.response_type = XCB_CLIENT_MESSAGE;
reply.window = xcbScreen()->root();
- xcb_send_event(xcb_connection(), 0, xcbScreen()->root(), XCB_EVENT_MASK_STRUCTURE_NOTIFY | XCB_EVENT_MASK_SUBSTRUCTURE_REDIRECT, (const char *)&reply);
+ xcb_send_event(xcb_connection(), 0, xcbScreen()->root(),
+ XCB_EVENT_MASK_STRUCTURE_NOTIFY | XCB_EVENT_MASK_SUBSTRUCTURE_REDIRECT,
+ (const char *)&reply);
xcb_flush(xcb_connection());
- } else if (event->data.data32[0] == atom(QXcbAtom::_NET_WM_SYNC_REQUEST)) {
+ } else if (protocolAtom == atom(QXcbAtom::_NET_WM_SYNC_REQUEST)) {
connection()->setTime(event->data.data32[1]);
m_syncValue.lo = event->data.data32[2];
m_syncValue.hi = event->data.data32[3];
if (m_usingSyncProtocol)
m_syncState = SyncReceived;
#ifndef QT_NO_WHATSTHIS
- } else if (event->data.data32[0] == atom(QXcbAtom::_NET_WM_CONTEXT_HELP)) {
+ } else if (protocolAtom == atom(QXcbAtom::_NET_WM_CONTEXT_HELP)) {
QWindowSystemInterface::handleEnterWhatsThisEvent();
#endif
} else {
- qWarning() << "QXcbWindow: Unhandled WM_PROTOCOLS message:" << connection()->atomName(event->data.data32[0]);
+ qCWarning(lcQpaXcb, "Unhandled WM_PROTOCOLS (%s)",
+ connection()->atomName(protocolAtom).constData());
}
#ifndef QT_NO_DRAGANDDROP
} else if (event->type == atom(QXcbAtom::XdndEnter)) {
@@ -2056,7 +2013,7 @@ void QXcbWindow::handleClientMessageEvent(const xcb_client_message_event_t *even
|| event->type == atom(QXcbAtom::_GTK_LOAD_ICONTHEMES)) {
//silence the _COMPIZ and _GTK messages for now
} else {
- qWarning() << "QXcbWindow: Unhandled client message:" << connection()->atomName(event->type);
+ qCWarning(lcQpaXcb) << "Unhandled client message: " << connection()->atomName(event->type);
}
}
@@ -2165,7 +2122,8 @@ void QXcbWindow::handleUnmapNotifyEvent(const xcb_unmap_notify_event_t *event)
}
void QXcbWindow::handleButtonPressEvent(int event_x, int event_y, int root_x, int root_y,
- int detail, Qt::KeyboardModifiers modifiers, xcb_timestamp_t timestamp, Qt::MouseEventSource source)
+ int detail, Qt::KeyboardModifiers modifiers, xcb_timestamp_t timestamp,
+ QEvent::Type type, Qt::MouseEventSource source)
{
const bool isWheel = detail >= 4 && detail <= 7;
if (!isWheel && window() != QGuiApplication::focusWindow()) {
@@ -2214,11 +2172,12 @@ void QXcbWindow::handleButtonPressEvent(int event_x, int event_y, int root_x, in
connection()->setMousePressWindow(this);
- handleMouseEvent(timestamp, local, global, modifiers, source);
+ handleMouseEvent(timestamp, local, global, modifiers, type, source);
}
void QXcbWindow::handleButtonReleaseEvent(int event_x, int event_y, int root_x, int root_y,
- int detail, Qt::KeyboardModifiers modifiers, xcb_timestamp_t timestamp, Qt::MouseEventSource source)
+ int detail, Qt::KeyboardModifiers modifiers, xcb_timestamp_t timestamp,
+ QEvent::Type type, Qt::MouseEventSource source)
{
QPoint local(event_x, event_y);
QPoint global(root_x, root_y);
@@ -2229,9 +2188,9 @@ void QXcbWindow::handleButtonReleaseEvent(int event_x, int event_y, int root_x,
}
if (connection()->buttonState() == Qt::NoButton)
- connection()->setMousePressWindow(Q_NULLPTR);
+ connection()->setMousePressWindow(nullptr);
- handleMouseEvent(timestamp, local, global, modifiers, source);
+ handleMouseEvent(timestamp, local, global, modifiers, type, source);
}
static inline bool doCheckUnGrabAncestor(QXcbConnection *conn)
@@ -2254,7 +2213,7 @@ static inline bool doCheckUnGrabAncestor(QXcbConnection *conn)
return true;
}
-static bool ignoreLeaveEvent(quint8 mode, quint8 detail, QXcbConnection *conn = Q_NULLPTR)
+static bool ignoreLeaveEvent(quint8 mode, quint8 detail, QXcbConnection *conn = nullptr)
{
return ((doCheckUnGrabAncestor(conn)
&& mode == XCB_NOTIFY_MODE_GRAB && detail == XCB_NOTIFY_DETAIL_ANCESTOR)
@@ -2263,7 +2222,7 @@ static bool ignoreLeaveEvent(quint8 mode, quint8 detail, QXcbConnection *conn =
|| detail == XCB_NOTIFY_DETAIL_NONLINEAR_VIRTUAL);
}
-static bool ignoreEnterEvent(quint8 mode, quint8 detail, QXcbConnection *conn = Q_NULLPTR)
+static bool ignoreEnterEvent(quint8 mode, quint8 detail, QXcbConnection *conn = nullptr)
{
return ((doCheckUnGrabAncestor(conn)
&& mode == XCB_NOTIFY_MODE_UNGRAB && detail == XCB_NOTIFY_DETAIL_ANCESTOR)
@@ -2332,7 +2291,8 @@ void QXcbWindow::handleLeaveNotifyEvent(int root_x, int root_y,
}
void QXcbWindow::handleMotionNotifyEvent(int event_x, int event_y, int root_x, int root_y,
- Qt::KeyboardModifiers modifiers, xcb_timestamp_t timestamp, Qt::MouseEventSource source)
+ Qt::KeyboardModifiers modifiers, xcb_timestamp_t timestamp,
+ QEvent::Type type, Qt::MouseEventSource source)
{
QPoint local(event_x, event_y);
QPoint global(root_x, root_y);
@@ -2340,33 +2300,34 @@ void QXcbWindow::handleMotionNotifyEvent(int event_x, int event_y, int root_x, i
// "mousePressWindow" can be NULL i.e. if a window will be grabbed or unmapped, so set it again here.
// Unset "mousePressWindow" when mouse button isn't pressed - in some cases the release event won't arrive.
const bool isMouseButtonPressed = (connection()->buttonState() != Qt::NoButton);
- const bool hasMousePressWindow = (connection()->mousePressWindow() != Q_NULLPTR);
+ const bool hasMousePressWindow = (connection()->mousePressWindow() != nullptr);
if (isMouseButtonPressed && !hasMousePressWindow)
connection()->setMousePressWindow(this);
else if (hasMousePressWindow && !isMouseButtonPressed)
- connection()->setMousePressWindow(Q_NULLPTR);
+ connection()->setMousePressWindow(nullptr);
- handleMouseEvent(timestamp, local, global, modifiers, source);
+ handleMouseEvent(timestamp, local, global, modifiers, type, source);
}
void QXcbWindow::handleButtonPressEvent(const xcb_button_press_event_t *event)
{
Qt::KeyboardModifiers modifiers = connection()->keyboard()->translateModifiers(event->state);
handleButtonPressEvent(event->event_x, event->event_y, event->root_x, event->root_y, event->detail,
- modifiers, event->time);
+ modifiers, event->time, QEvent::MouseButtonPress);
}
void QXcbWindow::handleButtonReleaseEvent(const xcb_button_release_event_t *event)
{
Qt::KeyboardModifiers modifiers = connection()->keyboard()->translateModifiers(event->state);
handleButtonReleaseEvent(event->event_x, event->event_y, event->root_x, event->root_y, event->detail,
- modifiers, event->time);
+ modifiers, event->time, QEvent::MouseButtonRelease);
}
void QXcbWindow::handleMotionNotifyEvent(const xcb_motion_notify_event_t *event)
{
Qt::KeyboardModifiers modifiers = connection()->keyboard()->translateModifiers(event->state);
- handleMotionNotifyEvent(event->event_x, event->event_y, event->root_x, event->root_y, modifiers, event->time);
+ handleMotionNotifyEvent(event->event_x, event->event_y, event->root_x, event->root_y, modifiers,
+ event->time, QEvent::MouseMove);
}
#if QT_CONFIG(xinput2)
@@ -2417,18 +2378,18 @@ void QXcbWindow::handleXIMouseEvent(xcb_ge_event_t *event, Qt::MouseEventSource
if (Q_UNLIKELY(lcQpaXInputEvents().isDebugEnabled()))
qCDebug(lcQpaXInputEvents, "XI2 mouse press, button %d, time %d, source %s", button, ev->time, sourceName);
conn->setButtonState(button, true);
- handleButtonPressEvent(event_x, event_y, root_x, root_y, ev->detail, modifiers, ev->time, source);
+ handleButtonPressEvent(event_x, event_y, root_x, root_y, ev->detail, modifiers, ev->time, QEvent::MouseButtonPress, source);
break;
case XI_ButtonRelease:
if (Q_UNLIKELY(lcQpaXInputEvents().isDebugEnabled()))
qCDebug(lcQpaXInputEvents, "XI2 mouse release, button %d, time %d, source %s", button, ev->time, sourceName);
conn->setButtonState(button, false);
- handleButtonReleaseEvent(event_x, event_y, root_x, root_y, ev->detail, modifiers, ev->time, source);
+ handleButtonReleaseEvent(event_x, event_y, root_x, root_y, ev->detail, modifiers, ev->time, QEvent::MouseButtonRelease, source);
break;
case XI_Motion:
if (Q_UNLIKELY(lcQpaXInputEvents().isDebugEnabled()))
qCDebug(lcQpaXInputEvents, "XI2 mouse motion %d,%d, time %d, source %s", event_x, event_y, ev->time, sourceName);
- handleMotionNotifyEvent(event_x, event_y, root_x, root_y, modifiers, ev->time, source);
+ handleMotionNotifyEvent(event_x, event_y, root_x, root_y, modifiers, ev->time, QEvent::MouseMove, source);
break;
default:
qWarning() << "Unrecognized XI2 mouse event" << ev->evtype;
@@ -2473,10 +2434,13 @@ void QXcbWindow::handleXIEnterLeave(xcb_ge_event_t *event)
QXcbWindow *QXcbWindow::toWindow() { return this; }
void QXcbWindow::handleMouseEvent(xcb_timestamp_t time, const QPoint &local, const QPoint &global,
- Qt::KeyboardModifiers modifiers, Qt::MouseEventSource source)
+ Qt::KeyboardModifiers modifiers, QEvent::Type type, Qt::MouseEventSource source)
{
connection()->setTime(time);
- QWindowSystemInterface::handleMouseEvent(window(), time, local, global, connection()->buttonState(), modifiers, source);
+ Qt::MouseButton button = type == QEvent::MouseMove ? Qt::NoButton : connection()->button();
+ QWindowSystemInterface::handleMouseEvent(window(), time, local, global,
+ connection()->buttonState(), button,
+ type, modifiers, source);
}
void QXcbWindow::handleEnterNotifyEvent(const xcb_enter_notify_event_t *event)
@@ -2526,7 +2490,7 @@ void QXcbWindow::handlePropertyNotifyEvent(const xcb_property_notify_event_t *ev
m_lastWindowStateEvent = newState;
m_windowState = newState;
if ((m_windowState & Qt::WindowMinimized) && connection()->mouseGrabber() == this)
- connection()->setMouseGrabber(Q_NULLPTR);
+ connection()->setMouseGrabber(nullptr);
}
return;
} else if (event->atom == atom(QXcbAtom::_NET_FRAME_EXTENTS)) {
@@ -2594,7 +2558,7 @@ bool QXcbWindow::setKeyboardGrabEnabled(bool grab)
bool QXcbWindow::setMouseGrabEnabled(bool grab)
{
if (!grab && connection()->mouseGrabber() == this)
- connection()->setMouseGrabber(Q_NULLPTR);
+ connection()->setMouseGrabber(nullptr);
#if QT_CONFIG(xinput2)
if (connection()->hasXInput2() && !connection()->xi2MouseEventsDisabled()) {
@@ -2812,6 +2776,15 @@ void QXcbWindow::setOpacity(qreal level)
(uchar *)&value);
}
+QVector<xcb_rectangle_t> qRegionToXcbRectangleList(const QRegion &region)
+{
+ QVector<xcb_rectangle_t> rects;
+ rects.reserve(region.rectCount());
+ for (const QRect &r : region)
+ rects.push_back(qRectToXCBRectangle(r));
+ return rects;
+}
+
void QXcbWindow::setMask(const QRegion &region)
{
if (!connection()->hasXShape())
@@ -2820,10 +2793,7 @@ void QXcbWindow::setMask(const QRegion &region)
xcb_shape_mask(connection()->xcb_connection(), XCB_SHAPE_SO_SET,
XCB_SHAPE_SK_BOUNDING, xcb_window(), 0, 0, XCB_NONE);
} else {
- QVector<xcb_rectangle_t> rects;
- rects.reserve(region.rectCount());
- for (const QRect &r : region)
- rects.push_back(qRectToXCBRectangle(r));
+ const auto rects = qRegionToXcbRectangleList(region);
xcb_shape_rectangles(connection()->xcb_connection(), XCB_SHAPE_SO_SET,
XCB_SHAPE_SK_BOUNDING, XCB_CLIP_ORDERING_UNSORTED,
xcb_window(), 0, 0, rects.size(), &rects[0]);
diff --git a/src/plugins/platforms/xcb/qxcbwindow.h b/src/plugins/platforms/xcb/qxcbwindow.h
index 1ce9b0a42f..638ab26cea 100644
--- a/src/plugins/platforms/xcb/qxcbwindow.h
+++ b/src/plugins/platforms/xcb/qxcbwindow.h
@@ -146,7 +146,7 @@ public:
QXcbWindow *toWindow() override;
void handleMouseEvent(xcb_timestamp_t time, const QPoint &local, const QPoint &global,
- Qt::KeyboardModifiers modifiers, Qt::MouseEventSource source);
+ Qt::KeyboardModifiers modifiers, QEvent::Type type, Qt::MouseEventSource source);
void updateNetWmUserTime(xcb_timestamp_t timestamp);
@@ -188,6 +188,7 @@ public Q_SLOTS:
protected:
virtual void resolveFormat(const QSurfaceFormat &format) { m_format = format; }
virtual const xcb_visualtype_t *createVisual();
+ void setImageFormatForVisual(const xcb_visualtype_t *visual);
QXcbScreen *parentScreen();
@@ -220,13 +221,16 @@ protected:
bool compressExposeEvent(QRegion &exposeRegion);
void handleButtonPressEvent(int event_x, int event_y, int root_x, int root_y,
- int detail, Qt::KeyboardModifiers modifiers, xcb_timestamp_t timestamp, Qt::MouseEventSource source = Qt::MouseEventNotSynthesized);
+ int detail, Qt::KeyboardModifiers modifiers, xcb_timestamp_t timestamp,
+ QEvent::Type type, Qt::MouseEventSource source = Qt::MouseEventNotSynthesized);
void handleButtonReleaseEvent(int event_x, int event_y, int root_x, int root_y,
- int detail, Qt::KeyboardModifiers modifiers, xcb_timestamp_t timestamp, Qt::MouseEventSource source = Qt::MouseEventNotSynthesized);
+ int detail, Qt::KeyboardModifiers modifiers, xcb_timestamp_t timestamp,
+ QEvent::Type type, Qt::MouseEventSource source = Qt::MouseEventNotSynthesized);
void handleMotionNotifyEvent(int event_x, int event_y, int root_x, int root_y,
- Qt::KeyboardModifiers modifiers, xcb_timestamp_t timestamp, Qt::MouseEventSource source = Qt::MouseEventNotSynthesized);
+ Qt::KeyboardModifiers modifiers, xcb_timestamp_t timestamp,
+ QEvent::Type type, Qt::MouseEventSource source = Qt::MouseEventNotSynthesized);
void handleEnterNotifyEvent(int event_x, int event_y, int root_x, int root_y,
quint8 mode, quint8 detail, xcb_timestamp_t timestamp);
@@ -292,6 +296,8 @@ protected:
void create() override {} // No-op
};
+QVector<xcb_rectangle_t> qRegionToXcbRectangleList(const QRegion &region);
+
QT_END_NAMESPACE
Q_DECLARE_METATYPE(QXcbWindow*)
diff --git a/src/plugins/platforms/xcb/xcb-plugin.pro b/src/plugins/platforms/xcb/xcb-plugin.pro
index 01d493156d..a2c56a3dcf 100644
--- a/src/plugins/platforms/xcb/xcb-plugin.pro
+++ b/src/plugins/platforms/xcb/xcb-plugin.pro
@@ -4,6 +4,8 @@ QT += core-private gui-private xcb_qpa_lib-private
DEFINES += QT_NO_FOREACH
+macos: CONFIG += no_app_extension_api_only
+
SOURCES = \
qxcbmain.cpp
OTHER_FILES += xcb.json README
diff --git a/src/plugins/platformthemes/flatpak/flatpak.json b/src/plugins/platformthemes/flatpak/flatpak.json
new file mode 100644
index 0000000000..71f834fd08
--- /dev/null
+++ b/src/plugins/platformthemes/flatpak/flatpak.json
@@ -0,0 +1,3 @@
+{
+ "Keys": [ "flatpak" ]
+}
diff --git a/src/plugins/platformthemes/flatpak/flatpak.pro b/src/plugins/platformthemes/flatpak/flatpak.pro
new file mode 100644
index 0000000000..1e5dbb7a6c
--- /dev/null
+++ b/src/plugins/platformthemes/flatpak/flatpak.pro
@@ -0,0 +1,17 @@
+TARGET = qflatpak
+
+PLUGIN_TYPE = platformthemes
+PLUGIN_EXTENDS = -
+PLUGIN_CLASS_NAME = QFlatpakThemePlugin
+load(qt_plugin)
+
+QT += core-private dbus gui-private theme_support-private
+
+HEADERS += \
+ qflatpaktheme.h \
+ qflatpakfiledialog_p.h
+
+SOURCES += \
+ main.cpp \
+ qflatpaktheme.cpp \
+ qflatpakfiledialog.cpp
diff --git a/src/plugins/platformthemes/flatpak/main.cpp b/src/plugins/platformthemes/flatpak/main.cpp
new file mode 100644
index 0000000000..7888eed8b2
--- /dev/null
+++ b/src/plugins/platformthemes/flatpak/main.cpp
@@ -0,0 +1,65 @@
+/****************************************************************************
+**
+** Copyright (C) 2017 Red Hat, Inc
+** Contact: https://www.qt.io/licensing/
+**
+** This file is part of the plugins of the Qt Toolkit.
+**
+** $QT_BEGIN_LICENSE:LGPL$
+** Commercial License Usage
+** Licensees holding valid commercial Qt licenses may use this file in
+** accordance with the commercial license agreement provided with the
+** Software or, alternatively, in accordance with the terms contained in
+** a written agreement between you and The Qt Company. For licensing terms
+** and conditions see https://www.qt.io/terms-conditions. For further
+** information use the contact form at https://www.qt.io/contact-us.
+**
+** GNU Lesser General Public License Usage
+** Alternatively, this file may be used under the terms of the GNU Lesser
+** General Public License version 3 as published by the Free Software
+** Foundation and appearing in the file LICENSE.LGPL3 included in the
+** packaging of this file. Please review the following information to
+** ensure the GNU Lesser General Public License version 3 requirements
+** will be met: https://www.gnu.org/licenses/lgpl-3.0.html.
+**
+** GNU General Public License Usage
+** Alternatively, this file may be used under the terms of the GNU
+** General Public License version 2.0 or (at your option) the GNU General
+** Public license version 3 or any later version approved by the KDE Free
+** Qt Foundation. The licenses are as published by the Free Software
+** Foundation and appearing in the file LICENSE.GPL2 and LICENSE.GPL3
+** included in the packaging of this file. Please review the following
+** information to ensure the GNU General Public License requirements will
+** be met: https://www.gnu.org/licenses/gpl-2.0.html and
+** https://www.gnu.org/licenses/gpl-3.0.html.
+**
+** $QT_END_LICENSE$
+**
+****************************************************************************/
+
+#include <qpa/qplatformthemeplugin.h>
+#include "qflatpaktheme.h"
+
+QT_BEGIN_NAMESPACE
+
+class QFlatpakThemePlugin : public QPlatformThemePlugin
+{
+ Q_OBJECT
+ Q_PLUGIN_METADATA(IID QPlatformThemeFactoryInterface_iid FILE "flatpak.json")
+
+public:
+ QPlatformTheme *create(const QString &key, const QStringList &params) override;
+};
+
+QPlatformTheme *QFlatpakThemePlugin::create(const QString &key, const QStringList &params)
+{
+ Q_UNUSED(params);
+ if (!key.compare(QLatin1String("flatpak"), Qt::CaseInsensitive))
+ return new QFlatpakTheme;
+
+ return nullptr;
+}
+
+QT_END_NAMESPACE
+
+#include "main.moc"
diff --git a/src/plugins/platformthemes/flatpak/qflatpakfiledialog.cpp b/src/plugins/platformthemes/flatpak/qflatpakfiledialog.cpp
new file mode 100644
index 0000000000..0dadb9a2f1
--- /dev/null
+++ b/src/plugins/platformthemes/flatpak/qflatpakfiledialog.cpp
@@ -0,0 +1,347 @@
+/****************************************************************************
+**
+** Copyright (C) 2017 Red Hat, Inc
+** Contact: https://www.qt.io/licensing/
+**
+** This file is part of the plugins of the Qt Toolkit.
+**
+** $QT_BEGIN_LICENSE:LGPL$
+** Commercial License Usage
+** Licensees holding valid commercial Qt licenses may use this file in
+** accordance with the commercial license agreement provided with the
+** Software or, alternatively, in accordance with the terms contained in
+** a written agreement between you and The Qt Company. For licensing terms
+** and conditions see https://www.qt.io/terms-conditions. For further
+** information use the contact form at https://www.qt.io/contact-us.
+**
+** GNU Lesser General Public License Usage
+** Alternatively, this file may be used under the terms of the GNU Lesser
+** General Public License version 3 as published by the Free Software
+** Foundation and appearing in the file LICENSE.LGPL3 included in the
+** packaging of this file. Please review the following information to
+** ensure the GNU Lesser General Public License version 3 requirements
+** will be met: https://www.gnu.org/licenses/lgpl-3.0.html.
+**
+** GNU General Public License Usage
+** Alternatively, this file may be used under the terms of the GNU
+** General Public License version 2.0 or (at your option) the GNU General
+** Public license version 3 or any later version approved by the KDE Free
+** Qt Foundation. The licenses are as published by the Free Software
+** Foundation and appearing in the file LICENSE.GPL2 and LICENSE.GPL3
+** included in the packaging of this file. Please review the following
+** information to ensure the GNU General Public License requirements will
+** be met: https://www.gnu.org/licenses/gpl-2.0.html and
+** https://www.gnu.org/licenses/gpl-3.0.html.
+**
+** $QT_END_LICENSE$
+**
+****************************************************************************/
+
+#include "qflatpakfiledialog_p.h"
+
+#include <QtCore/qeventloop.h>
+
+#include <QtDBus/QtDBus>
+#include <QDBusConnection>
+#include <QDBusMessage>
+#include <QDBusPendingCall>
+#include <QDBusPendingCallWatcher>
+#include <QDBusPendingReply>
+
+#include <QMetaType>
+#include <QMimeType>
+#include <QMimeDatabase>
+#include <QWindow>
+
+QT_BEGIN_NAMESPACE
+
+QDBusArgument &operator <<(QDBusArgument &arg, const QFlatpakFileDialog::FilterCondition &filterCondition)
+{
+ arg.beginStructure();
+ arg << filterCondition.type << filterCondition.pattern;
+ arg.endStructure();
+ return arg;
+}
+
+const QDBusArgument &operator >>(const QDBusArgument &arg, QFlatpakFileDialog::FilterCondition &filterCondition)
+{
+ uint type;
+ QString filterPattern;
+ arg.beginStructure();
+ arg >> type >> filterPattern;
+ filterCondition.type = (QFlatpakFileDialog::ConditionType)type;
+ filterCondition.pattern = filterPattern;
+ arg.endStructure();
+
+ return arg;
+}
+
+QDBusArgument &operator <<(QDBusArgument &arg, const QFlatpakFileDialog::Filter filter)
+{
+ arg.beginStructure();
+ arg << filter.name << filter.filterConditions;
+ arg.endStructure();
+ return arg;
+}
+
+const QDBusArgument &operator >>(const QDBusArgument &arg, QFlatpakFileDialog::Filter &filter)
+{
+ QString name;
+ QFlatpakFileDialog::FilterConditionList filterConditions;
+ arg.beginStructure();
+ arg >> name >> filterConditions;
+ filter.name = name;
+ filter.filterConditions = filterConditions;
+ arg.endStructure();
+
+ return arg;
+}
+
+class QFlatpakFileDialogPrivate
+{
+public:
+ WId winId = 0;
+ bool modal = false;
+ bool multipleFiles = false;
+ bool saveFile = false;
+ QString acceptLabel;
+ QString directory;
+ QString title;
+ QStringList nameFilters;
+ QStringList mimeTypesFilters;
+ QStringList selectedFiles;
+};
+
+QFlatpakFileDialog::QFlatpakFileDialog()
+ : QPlatformFileDialogHelper()
+ , d_ptr(new QFlatpakFileDialogPrivate)
+{
+}
+
+QFlatpakFileDialog::~QFlatpakFileDialog()
+{
+}
+
+void QFlatpakFileDialog::initializeDialog()
+{
+ Q_D(QFlatpakFileDialog);
+
+ if (options()->fileMode() == QFileDialogOptions::ExistingFiles)
+ d->multipleFiles = true;
+
+ if (options()->isLabelExplicitlySet(QFileDialogOptions::Accept))
+ d->acceptLabel = options()->labelText(QFileDialogOptions::Accept);
+
+ if (!options()->windowTitle().isEmpty())
+ d->title = options()->windowTitle();
+
+ if (options()->acceptMode() == QFileDialogOptions::AcceptSave)
+ d->saveFile = true;
+
+ if (!options()->nameFilters().isEmpty())
+ d->nameFilters = options()->nameFilters();
+
+ if (!options()->mimeTypeFilters().isEmpty())
+ d->mimeTypesFilters = options()->mimeTypeFilters();
+
+ setDirectory(options()->initialDirectory());
+}
+
+bool QFlatpakFileDialog::defaultNameFilterDisables() const
+{
+ return false;
+}
+
+void QFlatpakFileDialog::setDirectory(const QUrl &directory)
+{
+ Q_D(QFlatpakFileDialog);
+
+ d->directory = directory.path();
+}
+
+QUrl QFlatpakFileDialog::directory() const
+{
+ Q_D(const QFlatpakFileDialog);
+
+ return d->directory;
+}
+
+void QFlatpakFileDialog::selectFile(const QUrl &filename)
+{
+ Q_D(QFlatpakFileDialog);
+
+ d->selectedFiles << filename.path();
+}
+
+QList<QUrl> QFlatpakFileDialog::selectedFiles() const
+{
+ Q_D(const QFlatpakFileDialog);
+
+ QList<QUrl> files;
+ for (const QString &file : d->selectedFiles) {
+ files << QUrl(file);
+ }
+ return files;
+}
+
+void QFlatpakFileDialog::setFilter()
+{
+ // TODO
+}
+
+void QFlatpakFileDialog::selectNameFilter(const QString &filter)
+{
+ Q_UNUSED(filter);
+ // TODO
+}
+
+QString QFlatpakFileDialog::selectedNameFilter() const
+{
+ // TODO
+ return QString();
+}
+
+void QFlatpakFileDialog::exec()
+{
+ Q_D(const QFlatpakFileDialog);
+
+ QDBusMessage message = QDBusMessage::createMethodCall(QLatin1String("org.freedesktop.portal.Desktop"),
+ QLatin1String("/org/freedesktop/portal/desktop"),
+ QLatin1String("org.freedesktop.portal.FileChooser"),
+ d->saveFile ? QLatin1String("SaveFile") : QLatin1String("OpenFile"));
+ QString parentWindowId = QLatin1String("x11:") + QString::number(d->winId);
+
+ QVariantMap options;
+ if (!d->acceptLabel.isEmpty())
+ options.insert(QLatin1String("accept_label"), d->acceptLabel);
+
+ options.insert(QLatin1String("modal"), d->modal);
+ options.insert(QLatin1String("multiple"), d->multipleFiles);
+
+ if (d->saveFile) {
+ if (!d->directory.isEmpty())
+ options.insert(QLatin1String("current_folder"), d->directory.toLatin1());
+
+ if (!d->selectedFiles.isEmpty())
+ options.insert(QLatin1String("current_file"), d->selectedFiles.first().toLatin1());
+ }
+
+ // Insert filters
+ qDBusRegisterMetaType<FilterCondition>();
+ qDBusRegisterMetaType<FilterConditionList>();
+ qDBusRegisterMetaType<Filter>();
+ qDBusRegisterMetaType<FilterList>();
+
+ FilterList filterList;
+
+ if (!d->mimeTypesFilters.isEmpty()) {
+ for (const QString &mimeTypefilter : d->mimeTypesFilters) {
+ QMimeDatabase mimeDatabase;
+ QMimeType mimeType = mimeDatabase.mimeTypeForName(mimeTypefilter);
+
+ // Creates e.g. (1, "image/png")
+ FilterCondition filterCondition;
+ filterCondition.type = MimeType;
+ filterCondition.pattern = mimeTypefilter;
+
+ // Creates e.g. [((1, "image/png"))]
+ FilterConditionList filterConditions;
+ filterConditions << filterCondition;
+
+ // Creates e.g. [("Images", [((1, "image/png"))])]
+ Filter filter;
+ filter.name = mimeType.comment();
+ filter.filterConditions = filterConditions;
+
+ filterList << filter;
+ }
+ } else if (!d->nameFilters.isEmpty()) {
+ for (const QString &filter : d->nameFilters) {
+ // Do parsing:
+ // Supported format is ("Images (*.png *.jpg)")
+ QRegularExpression regexp(QPlatformFileDialogHelper::filterRegExp);
+ QRegularExpressionMatch match = regexp.match(filter);
+ if (match.hasMatch()) {
+ QString userVisibleName = match.captured(0);
+ QStringList filterStrings = match.captured(1).split(QLatin1String(" "));
+
+ FilterConditionList filterConditions;
+ for (const QString &filterString : filterStrings) {
+ FilterCondition filterCondition;
+ filterCondition.type = GlobalPattern;
+ filterCondition.pattern = filterString;
+ filterConditions << filterCondition;
+ }
+
+ Filter filter;
+ filter.name = userVisibleName;
+ filter.filterConditions = filterConditions;
+
+ filterList << filter;
+ }
+ }
+ }
+
+ if (!filterList.isEmpty())
+ options.insert(QLatin1String("filters"), QVariant::fromValue(filterList));
+
+ // TODO choices a(ssa(ss)s)
+ // List of serialized combo boxes to add to the file chooser.
+
+ message << parentWindowId << d->title << options;
+
+ QDBusPendingCall pendingCall = QDBusConnection::sessionBus().asyncCall(message);
+ QDBusPendingCallWatcher *watcher = new QDBusPendingCallWatcher(pendingCall);
+ connect(watcher, &QDBusPendingCallWatcher::finished, this, [this] (QDBusPendingCallWatcher *watcher) {
+ QDBusPendingReply<QDBusObjectPath> reply = *watcher;
+ if (reply.isError()) {
+ Q_EMIT reject();
+ } else {
+ QDBusConnection::sessionBus().connect(nullptr,
+ reply.value().path(),
+ QLatin1String("org.freedesktop.portal.Request"),
+ QLatin1String("Response"),
+ this,
+ SLOT(gotResponse(uint,QVariantMap)));
+ }
+ });
+
+ // HACK we have to avoid returning until we emit that the dialog was accepted or rejected
+ QEventLoop loop;
+ loop.connect(this, SIGNAL(accept()), SLOT(quit()));
+ loop.connect(this, SIGNAL(reject()), SLOT(quit()));
+ loop.exec();
+}
+
+void QFlatpakFileDialog::hide()
+{
+}
+
+bool QFlatpakFileDialog::show(Qt::WindowFlags windowFlags, Qt::WindowModality windowModality, QWindow *parent)
+{
+ Q_D(QFlatpakFileDialog);
+ Q_UNUSED(windowFlags);
+
+ initializeDialog();
+
+ d->modal = windowModality != Qt::NonModal;
+ d->winId = parent ? parent->winId() : 0;
+
+ return true;
+}
+
+void QFlatpakFileDialog::gotResponse(uint response, const QVariantMap &results)
+{
+ Q_D(QFlatpakFileDialog);
+
+ if (!response) {
+ if (results.contains(QLatin1String("uris")))
+ d->selectedFiles = results.value(QLatin1String("uris")).toStringList();
+
+ Q_EMIT accept();
+ } else {
+ Q_EMIT reject();
+ }
+}
+
+QT_END_NAMESPACE
diff --git a/src/plugins/platformthemes/flatpak/qflatpakfiledialog_p.h b/src/plugins/platformthemes/flatpak/qflatpakfiledialog_p.h
new file mode 100644
index 0000000000..8f65d07e62
--- /dev/null
+++ b/src/plugins/platformthemes/flatpak/qflatpakfiledialog_p.h
@@ -0,0 +1,105 @@
+/****************************************************************************
+**
+** Copyright (C) 2017 Red Hat, Inc
+** Contact: https://www.qt.io/licensing/
+**
+** This file is part of the plugins of the Qt Toolkit.
+**
+** $QT_BEGIN_LICENSE:LGPL$
+** Commercial License Usage
+** Licensees holding valid commercial Qt licenses may use this file in
+** accordance with the commercial license agreement provided with the
+** Software or, alternatively, in accordance with the terms contained in
+** a written agreement between you and The Qt Company. For licensing terms
+** and conditions see https://www.qt.io/terms-conditions. For further
+** information use the contact form at https://www.qt.io/contact-us.
+**
+** GNU Lesser General Public License Usage
+** Alternatively, this file may be used under the terms of the GNU Lesser
+** General Public License version 3 as published by the Free Software
+** Foundation and appearing in the file LICENSE.LGPL3 included in the
+** packaging of this file. Please review the following information to
+** ensure the GNU Lesser General Public License version 3 requirements
+** will be met: https://www.gnu.org/licenses/lgpl-3.0.html.
+**
+** GNU General Public License Usage
+** Alternatively, this file may be used under the terms of the GNU
+** General Public License version 2.0 or (at your option) the GNU General
+** Public license version 3 or any later version approved by the KDE Free
+** Qt Foundation. The licenses are as published by the Free Software
+** Foundation and appearing in the file LICENSE.GPL2 and LICENSE.GPL3
+** included in the packaging of this file. Please review the following
+** information to ensure the GNU General Public License requirements will
+** be met: https://www.gnu.org/licenses/gpl-2.0.html and
+** https://www.gnu.org/licenses/gpl-3.0.html.
+**
+** $QT_END_LICENSE$
+**
+****************************************************************************/
+#ifndef QFLATPAKFILEDIALOG_P_H
+#define QFLATPAKFILEDIALOG_P_H
+
+#include <qpa/qplatformdialoghelper.h>
+#include <QVector>
+
+QT_BEGIN_NAMESPACE
+
+class QFlatpakFileDialogPrivate;
+
+class QFlatpakFileDialog : public QPlatformFileDialogHelper
+{
+ Q_OBJECT
+ Q_DECLARE_PRIVATE(QFlatpakFileDialog)
+public:
+ enum ConditionType : uint {
+ GlobalPattern = 0,
+ MimeType = 1
+ };
+ // Filters a(sa(us))
+ // Example: [('Images', [(0, '*.ico'), (1, 'image/png')]), ('Text', [(0, '*.txt')])]
+ struct FilterCondition {
+ ConditionType type;
+ QString pattern; // E.g. '*ico' or 'image/png'
+ };
+ typedef QVector<FilterCondition> FilterConditionList;
+
+ struct Filter {
+ QString name; // E.g. 'Images' or 'Text
+ FilterConditionList filterConditions;; // E.g. [(0, '*.ico'), (1, 'image/png')] or [(0, '*.txt')]
+ };
+ typedef QVector<Filter> FilterList;
+
+ QFlatpakFileDialog();
+ ~QFlatpakFileDialog();
+
+ bool defaultNameFilterDisables() const override;
+ QUrl directory() const override;
+ void setDirectory(const QUrl &directory) override;
+ void selectFile(const QUrl &filename) override;
+ QList<QUrl> selectedFiles() const override;
+ void setFilter() override;
+ void selectNameFilter(const QString &filter) override;
+ QString selectedNameFilter() const override;
+
+ void exec() override;
+ bool show(Qt::WindowFlags windowFlags, Qt::WindowModality windowModality, QWindow *parent) override;
+ void hide() override;
+
+private Q_SLOTS:
+ void gotResponse(uint response, const QVariantMap &results);
+
+private:
+ void initializeDialog();
+
+ QScopedPointer<QFlatpakFileDialogPrivate> d_ptr;
+};
+
+QT_END_NAMESPACE
+
+Q_DECLARE_METATYPE(QFlatpakFileDialog::FilterCondition);
+Q_DECLARE_METATYPE(QFlatpakFileDialog::FilterConditionList);
+Q_DECLARE_METATYPE(QFlatpakFileDialog::Filter);
+Q_DECLARE_METATYPE(QFlatpakFileDialog::FilterList);
+
+#endif // QFLATPAKFILEDIALOG_P_H
+
diff --git a/src/plugins/platformthemes/flatpak/qflatpaktheme.cpp b/src/plugins/platformthemes/flatpak/qflatpaktheme.cpp
new file mode 100644
index 0000000000..04abd707e1
--- /dev/null
+++ b/src/plugins/platformthemes/flatpak/qflatpaktheme.cpp
@@ -0,0 +1,254 @@
+/****************************************************************************
+**
+** Copyright (C) 2017 The Qt Company Ltd.
+** Contact: https://www.qt.io/licensing/
+**
+** This file is part of the plugins of the Qt Toolkit.
+**
+** $QT_BEGIN_LICENSE:LGPL$
+** Commercial License Usage
+** Licensees holding valid commercial Qt licenses may use this file in
+** accordance with the commercial license agreement provided with the
+** Software or, alternatively, in accordance with the terms contained in
+** a written agreement between you and The Qt Company. For licensing terms
+** and conditions see https://www.qt.io/terms-conditions. For further
+** information use the contact form at https://www.qt.io/contact-us.
+**
+** GNU Lesser General Public License Usage
+** Alternatively, this file may be used under the terms of the GNU Lesser
+** General Public License version 3 as published by the Free Software
+** Foundation and appearing in the file LICENSE.LGPL3 included in the
+** packaging of this file. Please review the following information to
+** ensure the GNU Lesser General Public License version 3 requirements
+** will be met: https://www.gnu.org/licenses/lgpl-3.0.html.
+**
+** GNU General Public License Usage
+** Alternatively, this file may be used under the terms of the GNU
+** General Public License version 2.0 or (at your option) the GNU General
+** Public license version 3 or any later version approved by the KDE Free
+** Qt Foundation. The licenses are as published by the Free Software
+** Foundation and appearing in the file LICENSE.GPL2 and LICENSE.GPL3
+** included in the packaging of this file. Please review the following
+** information to ensure the GNU General Public License requirements will
+** be met: https://www.gnu.org/licenses/gpl-2.0.html and
+** https://www.gnu.org/licenses/gpl-3.0.html.
+**
+** $QT_END_LICENSE$
+**
+****************************************************************************/
+
+#include "qflatpaktheme.h"
+#include "qflatpakfiledialog_p.h"
+
+#include <private/qguiapplication_p.h>
+#include <qpa/qplatformtheme_p.h>
+#include <qpa/qplatformthemefactory_p.h>
+#include <qpa/qplatformintegration.h>
+
+QT_BEGIN_NAMESPACE
+
+class QFlatpakThemePrivate : public QPlatformThemePrivate
+{
+public:
+ QFlatpakThemePrivate()
+ : QPlatformThemePrivate()
+ { }
+
+ ~QFlatpakThemePrivate()
+ {
+ delete baseTheme;
+ }
+
+ QPlatformTheme *baseTheme;
+};
+
+QFlatpakTheme::QFlatpakTheme()
+ : d_ptr(new QFlatpakThemePrivate)
+{
+ Q_D(QFlatpakTheme);
+
+ QStringList themeNames;
+ themeNames += QGuiApplicationPrivate::platform_integration->themeNames();
+ // 1) Look for a theme plugin.
+ for (const QString &themeName : qAsConst(themeNames)) {
+ d->baseTheme = QPlatformThemeFactory::create(themeName, nullptr);
+ if (d->baseTheme)
+ break;
+ }
+
+ // 2) If no theme plugin was found ask the platform integration to
+ // create a theme
+ if (!d->baseTheme) {
+ for (const QString &themeName : qAsConst(themeNames)) {
+ d->baseTheme = QGuiApplicationPrivate::platform_integration->createPlatformTheme(themeName);
+ if (d->baseTheme)
+ break;
+ }
+ // No error message; not having a theme plugin is allowed.
+ }
+
+ // 3) Fall back on the built-in "null" platform theme.
+ if (!d->baseTheme)
+ d->baseTheme = new QPlatformTheme;
+}
+
+QPlatformMenuItem* QFlatpakTheme::createPlatformMenuItem() const
+{
+ Q_D(const QFlatpakTheme);
+
+ if (d->baseTheme)
+ return d->baseTheme->createPlatformMenuItem();
+
+ return QPlatformTheme::createPlatformMenuItem();
+}
+
+QPlatformMenu* QFlatpakTheme::createPlatformMenu() const
+{
+ Q_D(const QFlatpakTheme);
+
+ if (d->baseTheme)
+ return d->baseTheme->createPlatformMenu();
+
+ return QPlatformTheme::createPlatformMenu();
+}
+
+QPlatformMenuBar* QFlatpakTheme::createPlatformMenuBar() const
+{
+ Q_D(const QFlatpakTheme);
+
+ if (d->baseTheme)
+ return d->baseTheme->createPlatformMenuBar();
+
+ return QFlatpakTheme::createPlatformMenuBar();
+}
+
+void QFlatpakTheme::showPlatformMenuBar()
+{
+ Q_D(const QFlatpakTheme);
+
+ if (d->baseTheme)
+ return d->baseTheme->showPlatformMenuBar();
+
+ return QFlatpakTheme::showPlatformMenuBar();
+}
+
+bool QFlatpakTheme::usePlatformNativeDialog(DialogType type) const
+{
+ Q_D(const QFlatpakTheme);
+
+ if (type == FileDialog)
+ return true;
+
+ if (d->baseTheme)
+ return d->baseTheme->usePlatformNativeDialog(type);
+
+ return QFlatpakTheme::usePlatformNativeDialog(type);
+}
+
+QPlatformDialogHelper* QFlatpakTheme::createPlatformDialogHelper(DialogType type) const
+{
+ Q_D(const QFlatpakTheme);
+
+ if (type == FileDialog)
+ return new QFlatpakFileDialog;
+
+ if (d->baseTheme)
+ return d->baseTheme->createPlatformDialogHelper(type);
+
+ return QFlatpakTheme::createPlatformDialogHelper(type);
+}
+
+#ifndef QT_NO_SYSTEMTRAYICON
+QPlatformSystemTrayIcon* QFlatpakTheme::createPlatformSystemTrayIcon() const
+{
+ Q_D(const QFlatpakTheme);
+
+ if (d->baseTheme)
+ return d->baseTheme->createPlatformSystemTrayIcon();
+
+ return QPlatformTheme::createPlatformSystemTrayIcon();
+}
+#endif
+
+const QPalette *QFlatpakTheme::palette(Palette type) const
+{
+ Q_D(const QFlatpakTheme);
+
+ if (d->baseTheme)
+ return d->baseTheme->palette(type);
+
+ return QPlatformTheme::palette(type);
+}
+
+const QFont* QFlatpakTheme::font(Font type) const
+{
+ Q_D(const QFlatpakTheme);
+
+ if (d->baseTheme)
+ return d->baseTheme->font(type);
+
+ return QPlatformTheme::font(type);
+}
+
+QVariant QFlatpakTheme::themeHint(ThemeHint hint) const
+{
+ Q_D(const QFlatpakTheme);
+
+ if (d->baseTheme)
+ return d->baseTheme->themeHint(hint);
+
+ return QPlatformTheme::themeHint(hint);
+}
+
+QPixmap QFlatpakTheme::standardPixmap(StandardPixmap sp, const QSizeF &size) const
+{
+ Q_D(const QFlatpakTheme);
+
+ if (d->baseTheme)
+ return d->baseTheme->standardPixmap(sp, size);
+
+ return QPlatformTheme::standardPixmap(sp, size);
+}
+
+QIcon QFlatpakTheme::fileIcon(const QFileInfo &fileInfo,
+ QPlatformTheme::IconOptions iconOptions) const
+{
+ Q_D(const QFlatpakTheme);
+
+ if (d->baseTheme)
+ return d->baseTheme->fileIcon(fileInfo, iconOptions);
+
+ return QPlatformTheme::fileIcon(fileInfo, iconOptions);
+}
+
+QIconEngine * QFlatpakTheme::createIconEngine(const QString &iconName) const
+{
+ Q_D(const QFlatpakTheme);
+
+ if (d->baseTheme)
+ return d->baseTheme->createIconEngine(iconName);
+
+ return QPlatformTheme::createIconEngine(iconName);
+}
+
+QList<QKeySequence> QFlatpakTheme::keyBindings(QKeySequence::StandardKey key) const
+{
+ Q_D(const QFlatpakTheme);
+
+ if (d->baseTheme)
+ return d->baseTheme->keyBindings(key);
+
+ return QPlatformTheme::keyBindings(key);
+}
+
+QString QFlatpakTheme::standardButtonText(int button) const
+{
+ Q_D(const QFlatpakTheme);
+
+ if (d->baseTheme)
+ return d->baseTheme->standardButtonText(button);
+
+ return QPlatformTheme::standardButtonText(button);
+}
+
+QT_END_NAMESPACE
diff --git a/src/plugins/platformthemes/flatpak/qflatpaktheme.h b/src/plugins/platformthemes/flatpak/qflatpaktheme.h
new file mode 100644
index 0000000000..fcaac5b673
--- /dev/null
+++ b/src/plugins/platformthemes/flatpak/qflatpaktheme.h
@@ -0,0 +1,90 @@
+/****************************************************************************
+**
+** Copyright (C) 2017 The Qt Company Ltd.
+** Contact: https://www.qt.io/licensing/
+**
+** This file is part of the plugins of the Qt Toolkit.
+**
+** $QT_BEGIN_LICENSE:LGPL$
+** Commercial License Usage
+** Licensees holding valid commercial Qt licenses may use this file in
+** accordance with the commercial license agreement provided with the
+** Software or, alternatively, in accordance with the terms contained in
+** a written agreement between you and The Qt Company. For licensing terms
+** and conditions see https://www.qt.io/terms-conditions. For further
+** information use the contact form at https://www.qt.io/contact-us.
+**
+** GNU Lesser General Public License Usage
+** Alternatively, this file may be used under the terms of the GNU Lesser
+** General Public License version 3 as published by the Free Software
+** Foundation and appearing in the file LICENSE.LGPL3 included in the
+** packaging of this file. Please review the following information to
+** ensure the GNU Lesser General Public License version 3 requirements
+** will be met: https://www.gnu.org/licenses/lgpl-3.0.html.
+**
+** GNU General Public License Usage
+** Alternatively, this file may be used under the terms of the GNU
+** General Public License version 2.0 or (at your option) the GNU General
+** Public license version 3 or any later version approved by the KDE Free
+** Qt Foundation. The licenses are as published by the Free Software
+** Foundation and appearing in the file LICENSE.GPL2 and LICENSE.GPL3
+** included in the packaging of this file. Please review the following
+** information to ensure the GNU General Public License requirements will
+** be met: https://www.gnu.org/licenses/gpl-2.0.html and
+** https://www.gnu.org/licenses/gpl-3.0.html.
+**
+** $QT_END_LICENSE$
+**
+****************************************************************************/
+
+#ifndef QFLATPAKTHEME_H
+#define QFLATPAKTHEME_H
+
+#include <qpa/qplatformtheme.h>
+
+QT_BEGIN_NAMESPACE
+
+class QFlatpakThemePrivate;
+
+class QFlatpakTheme : public QPlatformTheme
+{
+ Q_DECLARE_PRIVATE(QFlatpakTheme)
+public:
+ QFlatpakTheme();
+
+ QPlatformMenuItem *createPlatformMenuItem() const override;
+ QPlatformMenu *createPlatformMenu() const override;
+ QPlatformMenuBar *createPlatformMenuBar() const override;
+ void showPlatformMenuBar() override;
+
+ bool usePlatformNativeDialog(DialogType type) const override;
+ QPlatformDialogHelper *createPlatformDialogHelper(DialogType type) const override;
+
+#ifndef QT_NO_SYSTEMTRAYICON
+ QPlatformSystemTrayIcon *createPlatformSystemTrayIcon() const override;
+#endif
+
+ const QPalette *palette(Palette type = SystemPalette) const override;
+
+ const QFont *font(Font type = SystemFont) const override;
+
+ QVariant themeHint(ThemeHint hint) const override;
+
+ QPixmap standardPixmap(StandardPixmap sp, const QSizeF &size) const override;
+ QIcon fileIcon(const QFileInfo &fileInfo,
+ QPlatformTheme::IconOptions iconOptions = 0) const;
+
+ QIconEngine *createIconEngine(const QString &iconName) const override;
+
+ QList<QKeySequence> keyBindings(QKeySequence::StandardKey key) const override;
+
+ QString standardButtonText(int button) const override;
+
+private:
+ QScopedPointer<QFlatpakThemePrivate> d_ptr;
+ Q_DISABLE_COPY(QFlatpakTheme)
+};
+
+QT_END_NAMESPACE
+
+#endif // QFLATPAKTHEME_H
diff --git a/src/plugins/platformthemes/gtk3/main.cpp b/src/plugins/platformthemes/gtk3/main.cpp
index c4cd66c33b..fb1c425d8e 100644
--- a/src/plugins/platformthemes/gtk3/main.cpp
+++ b/src/plugins/platformthemes/gtk3/main.cpp
@@ -48,7 +48,7 @@ class QGtk3ThemePlugin : public QPlatformThemePlugin
Q_PLUGIN_METADATA(IID QPlatformThemeFactoryInterface_iid FILE "gtk3.json")
public:
- QPlatformTheme *create(const QString &key, const QStringList &params) Q_DECL_OVERRIDE;
+ QPlatformTheme *create(const QString &key, const QStringList &params) override;
};
QPlatformTheme *QGtk3ThemePlugin::create(const QString &key, const QStringList &params)
diff --git a/src/plugins/platformthemes/gtk3/qgtk3dialoghelpers.h b/src/plugins/platformthemes/gtk3/qgtk3dialoghelpers.h
index ba43046e04..e78a7fc6d1 100644
--- a/src/plugins/platformthemes/gtk3/qgtk3dialoghelpers.h
+++ b/src/plugins/platformthemes/gtk3/qgtk3dialoghelpers.h
@@ -63,12 +63,12 @@ public:
QGtk3ColorDialogHelper();
~QGtk3ColorDialogHelper();
- bool show(Qt::WindowFlags flags, Qt::WindowModality modality, QWindow *parent) Q_DECL_OVERRIDE;
- void exec() Q_DECL_OVERRIDE;
- void hide() Q_DECL_OVERRIDE;
+ bool show(Qt::WindowFlags flags, Qt::WindowModality modality, QWindow *parent) override;
+ void exec() override;
+ void hide() override;
- void setCurrentColor(const QColor &color) Q_DECL_OVERRIDE;
- QColor currentColor() const Q_DECL_OVERRIDE;
+ void setCurrentColor(const QColor &color) override;
+ QColor currentColor() const override;
private Q_SLOTS:
void onAccepted();
@@ -88,18 +88,18 @@ public:
QGtk3FileDialogHelper();
~QGtk3FileDialogHelper();
- bool show(Qt::WindowFlags flags, Qt::WindowModality modality, QWindow *parent) Q_DECL_OVERRIDE;
- void exec() Q_DECL_OVERRIDE;
- void hide() Q_DECL_OVERRIDE;
+ bool show(Qt::WindowFlags flags, Qt::WindowModality modality, QWindow *parent) override;
+ void exec() override;
+ void hide() override;
- bool defaultNameFilterDisables() const Q_DECL_OVERRIDE;
- void setDirectory(const QUrl &directory) Q_DECL_OVERRIDE;
- QUrl directory() const Q_DECL_OVERRIDE;
- void selectFile(const QUrl &filename) Q_DECL_OVERRIDE;
- QList<QUrl> selectedFiles() const Q_DECL_OVERRIDE;
- void setFilter() Q_DECL_OVERRIDE;
- void selectNameFilter(const QString &filter) Q_DECL_OVERRIDE;
- QString selectedNameFilter() const Q_DECL_OVERRIDE;
+ bool defaultNameFilterDisables() const override;
+ void setDirectory(const QUrl &directory) override;
+ QUrl directory() const override;
+ void selectFile(const QUrl &filename) override;
+ QList<QUrl> selectedFiles() const override;
+ void setFilter() override;
+ void selectNameFilter(const QString &filter) override;
+ QString selectedNameFilter() const override;
private Q_SLOTS:
void onAccepted();
@@ -128,12 +128,12 @@ public:
QGtk3FontDialogHelper();
~QGtk3FontDialogHelper();
- bool show(Qt::WindowFlags flags, Qt::WindowModality modality, QWindow *parent) Q_DECL_OVERRIDE;
- void exec() Q_DECL_OVERRIDE;
- void hide() Q_DECL_OVERRIDE;
+ bool show(Qt::WindowFlags flags, Qt::WindowModality modality, QWindow *parent) override;
+ void exec() override;
+ void hide() override;
- void setCurrentFont(const QFont &font) Q_DECL_OVERRIDE;
- QFont currentFont() const Q_DECL_OVERRIDE;
+ void setCurrentFont(const QFont &font) override;
+ QFont currentFont() const override;
private Q_SLOTS:
void onAccepted();
diff --git a/src/plugins/platformthemes/gtk3/qgtk3theme.h b/src/plugins/platformthemes/gtk3/qgtk3theme.h
index 52036680c6..8f03b84bb6 100644
--- a/src/plugins/platformthemes/gtk3/qgtk3theme.h
+++ b/src/plugins/platformthemes/gtk3/qgtk3theme.h
@@ -49,14 +49,14 @@ class QGtk3Theme : public QGnomeTheme
public:
QGtk3Theme();
- virtual QVariant themeHint(ThemeHint hint) const Q_DECL_OVERRIDE;
- virtual QString gtkFontName() const Q_DECL_OVERRIDE;
+ virtual QVariant themeHint(ThemeHint hint) const override;
+ virtual QString gtkFontName() const override;
- bool usePlatformNativeDialog(DialogType type) const Q_DECL_OVERRIDE;
- QPlatformDialogHelper *createPlatformDialogHelper(DialogType type) const Q_DECL_OVERRIDE;
+ bool usePlatformNativeDialog(DialogType type) const override;
+ QPlatformDialogHelper *createPlatformDialogHelper(DialogType type) const override;
- QPlatformMenu* createPlatformMenu() const Q_DECL_OVERRIDE;
- QPlatformMenuItem* createPlatformMenuItem() const Q_DECL_OVERRIDE;
+ QPlatformMenu* createPlatformMenu() const override;
+ QPlatformMenuItem* createPlatformMenuItem() const override;
static const char *name;
};
diff --git a/src/plugins/platformthemes/platformthemes.pro b/src/plugins/platformthemes/platformthemes.pro
index 0e2812bed3..ebf92ba9d5 100644
--- a/src/plugins/platformthemes/platformthemes.pro
+++ b/src/plugins/platformthemes/platformthemes.pro
@@ -1,4 +1,6 @@
TEMPLATE = subdirs
QT_FOR_CONFIG += widgets-private
+qtConfig(dbus): SUBDIRS += flatpak
+
qtHaveModule(widgets):qtConfig(gtk3): SUBDIRS += gtk3
diff --git a/src/plugins/printsupport/cups/main.cpp b/src/plugins/printsupport/cups/main.cpp
index 39309a0031..cf263a7f52 100644
--- a/src/plugins/printsupport/cups/main.cpp
+++ b/src/plugins/printsupport/cups/main.cpp
@@ -52,7 +52,7 @@ class QCupsPrinterSupportPlugin : public QPlatformPrinterSupportPlugin
public:
QStringList keys() const;
- QPlatformPrinterSupport *create(const QString &) Q_DECL_OVERRIDE;
+ QPlatformPrinterSupport *create(const QString &) override;
};
QStringList QCupsPrinterSupportPlugin::keys() const
diff --git a/src/plugins/printsupport/cups/qcupsprintengine.cpp b/src/plugins/printsupport/cups/qcupsprintengine.cpp
index 6a4eecb06d..287ab4b27a 100644
--- a/src/plugins/printsupport/cups/qcupsprintengine.cpp
+++ b/src/plugins/printsupport/cups/qcupsprintengine.cpp
@@ -239,9 +239,12 @@ void QCupsPrintEnginePrivate::closePrintDevice()
cupsOptStruct.append(opt);
}
- // Print the file.
+ // Print the file
+ // Cups expect the printer original name without instance, the full name is used only to retrieve the configuration
+ const auto parts = printerName.splitRef(QLatin1Char('/'));
+ const auto printerOriginalName = parts.at(0);
cups_option_t* optPtr = cupsOptStruct.size() ? &cupsOptStruct.first() : 0;
- cupsPrintFile(printerName.toLocal8Bit().constData(), tempFile.toLocal8Bit().constData(),
+ cupsPrintFile(printerOriginalName.toLocal8Bit().constData(), tempFile.toLocal8Bit().constData(),
title.toLocal8Bit().constData(), cupsOptStruct.size(), optPtr);
QFile::remove(tempFile);
diff --git a/src/plugins/printsupport/cups/qcupsprintengine_p.h b/src/plugins/printsupport/cups/qcupsprintengine_p.h
index 0ebf6e7a0f..c99c48c7ea 100644
--- a/src/plugins/printsupport/cups/qcupsprintengine_p.h
+++ b/src/plugins/printsupport/cups/qcupsprintengine_p.h
@@ -72,8 +72,8 @@ public:
virtual ~QCupsPrintEngine();
// reimplementations QPdfPrintEngine
- void setProperty(PrintEnginePropertyKey key, const QVariant &value) Q_DECL_OVERRIDE;
- QVariant property(PrintEnginePropertyKey key) const Q_DECL_OVERRIDE;
+ void setProperty(PrintEnginePropertyKey key, const QVariant &value) override;
+ QVariant property(PrintEnginePropertyKey key) const override;
// end reimplementations QPdfPrintEngine
private:
@@ -87,8 +87,8 @@ public:
QCupsPrintEnginePrivate(QPrinter::PrinterMode m);
~QCupsPrintEnginePrivate();
- bool openPrintDevice() Q_DECL_OVERRIDE;
- void closePrintDevice() Q_DECL_OVERRIDE;
+ bool openPrintDevice() override;
+ void closePrintDevice() override;
private:
Q_DISABLE_COPY(QCupsPrintEnginePrivate)
diff --git a/src/plugins/printsupport/cups/qcupsprintersupport_p.h b/src/plugins/printsupport/cups/qcupsprintersupport_p.h
index df6507d324..42de28aec0 100644
--- a/src/plugins/printsupport/cups/qcupsprintersupport_p.h
+++ b/src/plugins/printsupport/cups/qcupsprintersupport_p.h
@@ -64,12 +64,12 @@ public:
QCupsPrinterSupport();
~QCupsPrinterSupport();
- QPrintEngine *createNativePrintEngine(QPrinter::PrinterMode printerMode, const QString &deviceId = QString()) Q_DECL_OVERRIDE;
- QPaintEngine *createPaintEngine(QPrintEngine *printEngine, QPrinter::PrinterMode) Q_DECL_OVERRIDE;
+ QPrintEngine *createNativePrintEngine(QPrinter::PrinterMode printerMode, const QString &deviceId = QString()) override;
+ QPaintEngine *createPaintEngine(QPrintEngine *printEngine, QPrinter::PrinterMode) override;
- QPrintDevice createPrintDevice(const QString &id) Q_DECL_OVERRIDE;
- QStringList availablePrintDeviceIds() const Q_DECL_OVERRIDE;
- QString defaultPrintDeviceId() const Q_DECL_OVERRIDE;
+ QPrintDevice createPrintDevice(const QString &id) override;
+ QStringList availablePrintDeviceIds() const override;
+ QString defaultPrintDeviceId() const override;
private:
QString cupsOption(int i, const QString &key) const;
diff --git a/src/plugins/printsupport/cups/qppdprintdevice.cpp b/src/plugins/printsupport/cups/qppdprintdevice.cpp
index 9efa83d409..8aed8c544b 100644
--- a/src/plugins/printsupport/cups/qppdprintdevice.cpp
+++ b/src/plugins/printsupport/cups/qppdprintdevice.cpp
@@ -42,6 +42,8 @@
#include <QtCore/QMimeDatabase>
#include <qdebug.h>
+#include "private/qcups_p.h" // Only needed for PDPK_*
+
#ifndef QT_LINUXBASE // LSB merges everything into cups.h
#include <cups/language.h>
#endif
@@ -421,6 +423,33 @@ QPrint::ColorMode QPpdPrintDevice::defaultColorMode() const
return QPrint::GrayScale;
}
+QVariant QPpdPrintDevice::property(QPrintDevice::PrintDevicePropertyKey key) const
+{
+ if (key == PDPK_PpdFile)
+ return QVariant::fromValue<ppd_file_t *>(m_ppd);
+ else if (key == PDPK_CupsJobPriority)
+ return printerOption(QStringLiteral("job-priority"));
+ else if (key == PDPK_CupsJobSheets)
+ return printerOption(QStringLiteral("job-sheets"));
+ else if (key == PDPK_CupsJobBilling)
+ return printerOption(QStringLiteral("job-billing"));
+ else if (key == PDPK_CupsJobHoldUntil)
+ return printerOption(QStringLiteral("job-hold-until"));
+
+ return QVariant();
+}
+
+bool QPpdPrintDevice::setProperty(QPrintDevice::PrintDevicePropertyKey key, const QVariant &value)
+{
+ if (key == PDPK_PpdOption) {
+ const QStringList values = value.toStringList();
+ if (values.count() == 2)
+ return ppdMarkOption(m_ppd, values[0].toLatin1(), values[1].toLatin1()) == 0;
+ }
+
+ return false;
+}
+
#ifndef QT_NO_MIMETYPE
void QPpdPrintDevice::loadMimeTypes() const
{
@@ -452,7 +481,7 @@ void QPpdPrintDevice::loadPrinter()
}
// Get the print instance and PPD file
- m_cupsDest = cupsGetNamedDest(CUPS_HTTP_DEFAULT, m_cupsName, m_cupsInstance);
+ m_cupsDest = cupsGetNamedDest(CUPS_HTTP_DEFAULT, m_cupsName, m_cupsInstance.isNull() ? nullptr : m_cupsInstance.constData());
if (m_cupsDest) {
const char *ppdFile = cupsGetPPD(m_cupsName);
if (ppdFile) {
@@ -461,6 +490,8 @@ void QPpdPrintDevice::loadPrinter()
}
if (m_ppd) {
ppdMarkDefaults(m_ppd);
+ cupsMarkOptions(m_ppd, m_cupsDest->num_options, m_cupsDest->options);
+ ppdLocalize(m_ppd);
} else {
cupsFreeDests(1, m_cupsDest);
m_cupsDest = 0;
diff --git a/src/plugins/printsupport/cups/qppdprintdevice.h b/src/plugins/printsupport/cups/qppdprintdevice.h
index fab7077ce4..2e4dd3ab3b 100644
--- a/src/plugins/printsupport/cups/qppdprintdevice.h
+++ b/src/plugins/printsupport/cups/qppdprintdevice.h
@@ -69,35 +69,38 @@ public:
explicit QPpdPrintDevice(const QString &id);
virtual ~QPpdPrintDevice();
- bool isValid() const Q_DECL_OVERRIDE;
- bool isDefault() const Q_DECL_OVERRIDE;
+ bool isValid() const override;
+ bool isDefault() const override;
- QPrint::DeviceState state() const Q_DECL_OVERRIDE;
+ QPrint::DeviceState state() const override;
- QPageSize defaultPageSize() const Q_DECL_OVERRIDE;
+ QPageSize defaultPageSize() const override;
QMarginsF printableMargins(const QPageSize &pageSize, QPageLayout::Orientation orientation,
- int resolution) const Q_DECL_OVERRIDE;
+ int resolution) const override;
- int defaultResolution() const Q_DECL_OVERRIDE;
+ int defaultResolution() const override;
- QPrint::InputSlot defaultInputSlot() const Q_DECL_OVERRIDE;
+ QPrint::InputSlot defaultInputSlot() const override;
- QPrint::OutputBin defaultOutputBin() const Q_DECL_OVERRIDE;
+ QPrint::OutputBin defaultOutputBin() const override;
- QPrint::DuplexMode defaultDuplexMode() const Q_DECL_OVERRIDE;
+ QPrint::DuplexMode defaultDuplexMode() const override;
- QPrint::ColorMode defaultColorMode() const Q_DECL_OVERRIDE;
+ QPrint::ColorMode defaultColorMode() const override;
+
+ QVariant property(QPrintDevice::PrintDevicePropertyKey key) const override;
+ bool setProperty(QPrintDevice::PrintDevicePropertyKey key, const QVariant &value) override;
protected:
- void loadPageSizes() const Q_DECL_OVERRIDE;
- void loadResolutions() const Q_DECL_OVERRIDE;
- void loadInputSlots() const Q_DECL_OVERRIDE;
- void loadOutputBins() const Q_DECL_OVERRIDE;
- void loadDuplexModes() const Q_DECL_OVERRIDE;
- void loadColorModes() const Q_DECL_OVERRIDE;
+ void loadPageSizes() const override;
+ void loadResolutions() const override;
+ void loadInputSlots() const override;
+ void loadOutputBins() const override;
+ void loadDuplexModes() const override;
+ void loadColorModes() const override;
#ifndef QT_NO_MIMETYPE
- void loadMimeTypes() const Q_DECL_OVERRIDE;
+ void loadMimeTypes() const override;
#endif
private:
diff --git a/src/plugins/printsupport/windows/qwindowsprintdevice.cpp b/src/plugins/printsupport/windows/qwindowsprintdevice.cpp
index 1cb14514ee..b1589c0738 100644
--- a/src/plugins/printsupport/windows/qwindowsprintdevice.cpp
+++ b/src/plugins/printsupport/windows/qwindowsprintdevice.cpp
@@ -87,13 +87,13 @@ static LPDEVMODE getDevmode(HANDLE hPrinter, const QString &printerId)
// Allocate the required DEVMODE buffer
LONG dmSize = DocumentProperties(NULL, hPrinter, printerIdUtf16, NULL, NULL, 0);
if (dmSize <= 0)
- return Q_NULLPTR;
+ return nullptr;
LPDEVMODE pDevMode = reinterpret_cast<LPDEVMODE>(malloc(dmSize));
// Get the default DevMode
LONG result = DocumentProperties(NULL, hPrinter, printerIdUtf16, pDevMode, NULL, DM_OUT_BUFFER);
if (result != IDOK) {
free(pDevMode);
- pDevMode = Q_NULLPTR;
+ pDevMode = nullptr;
}
return pDevMode;
}
diff --git a/src/plugins/printsupport/windows/qwindowsprintdevice.h b/src/plugins/printsupport/windows/qwindowsprintdevice.h
index d95a4316cc..6b51ee8785 100644
--- a/src/plugins/printsupport/windows/qwindowsprintdevice.h
+++ b/src/plugins/printsupport/windows/qwindowsprintdevice.h
@@ -64,34 +64,34 @@ public:
explicit QWindowsPrintDevice(const QString &id);
virtual ~QWindowsPrintDevice();
- bool isValid() const Q_DECL_OVERRIDE;
- bool isDefault() const Q_DECL_OVERRIDE;
+ bool isValid() const override;
+ bool isDefault() const override;
- QPrint::DeviceState state() const Q_DECL_OVERRIDE;
+ QPrint::DeviceState state() const override;
- QPageSize defaultPageSize() const Q_DECL_OVERRIDE;
+ QPageSize defaultPageSize() const override;
QMarginsF printableMargins(const QPageSize &pageSize, QPageLayout::Orientation orientation,
- int resolution) const Q_DECL_OVERRIDE;
+ int resolution) const override;
- int defaultResolution() const Q_DECL_OVERRIDE;
+ int defaultResolution() const override;
- QPrint::InputSlot defaultInputSlot() const Q_DECL_OVERRIDE;
+ QPrint::InputSlot defaultInputSlot() const override;
- QPrint::DuplexMode defaultDuplexMode() const Q_DECL_OVERRIDE;
+ QPrint::DuplexMode defaultDuplexMode() const override;
- QPrint::ColorMode defaultColorMode() const Q_DECL_OVERRIDE;
+ QPrint::ColorMode defaultColorMode() const override;
static QStringList availablePrintDeviceIds();
static QString defaultPrintDeviceId();
protected:
- void loadPageSizes() const Q_DECL_OVERRIDE;
- void loadResolutions() const Q_DECL_OVERRIDE;
- void loadInputSlots() const Q_DECL_OVERRIDE;
- void loadOutputBins() const Q_DECL_OVERRIDE;
- void loadDuplexModes() const Q_DECL_OVERRIDE;
- void loadColorModes() const Q_DECL_OVERRIDE;
+ void loadPageSizes() const override;
+ void loadResolutions() const override;
+ void loadInputSlots() const override;
+ void loadOutputBins() const override;
+ void loadDuplexModes() const override;
+ void loadColorModes() const override;
private:
HANDLE m_hPrinter;
diff --git a/src/plugins/printsupport/windows/qwindowsprintersupport.h b/src/plugins/printsupport/windows/qwindowsprintersupport.h
index 84b60a8207..c42e7aa551 100644
--- a/src/plugins/printsupport/windows/qwindowsprintersupport.h
+++ b/src/plugins/printsupport/windows/qwindowsprintersupport.h
@@ -50,12 +50,12 @@ public:
QWindowsPrinterSupport();
~QWindowsPrinterSupport();
- QPrintEngine *createNativePrintEngine(QPrinter::PrinterMode printerMode, const QString &deviceId = QString()) Q_DECL_OVERRIDE;
- QPaintEngine *createPaintEngine(QPrintEngine *printEngine, QPrinter::PrinterMode) Q_DECL_OVERRIDE;
+ QPrintEngine *createNativePrintEngine(QPrinter::PrinterMode printerMode, const QString &deviceId = QString()) override;
+ QPaintEngine *createPaintEngine(QPrintEngine *printEngine, QPrinter::PrinterMode) override;
- QPrintDevice createPrintDevice(const QString &id) Q_DECL_OVERRIDE;
- QStringList availablePrintDeviceIds() const Q_DECL_OVERRIDE;
- QString defaultPrintDeviceId() const Q_DECL_OVERRIDE;
+ QPrintDevice createPrintDevice(const QString &id) override;
+ QStringList availablePrintDeviceIds() const override;
+ QString defaultPrintDeviceId() const override;
};
QT_END_NAMESPACE
diff --git a/src/plugins/sqldrivers/db2/qsql_db2.cpp b/src/plugins/sqldrivers/db2/qsql_db2.cpp
index 2bfd99cfa9..2c8097ed07 100644
--- a/src/plugins/sqldrivers/db2/qsql_db2.cpp
+++ b/src/plugins/sqldrivers/db2/qsql_db2.cpp
@@ -92,24 +92,24 @@ class QDB2Result: public QSqlResult
public:
QDB2Result(const QDB2Driver *drv);
~QDB2Result();
- bool prepare(const QString &query) Q_DECL_OVERRIDE;
- bool exec() Q_DECL_OVERRIDE;
- QVariant handle() const Q_DECL_OVERRIDE;
+ bool prepare(const QString &query) override;
+ bool exec() override;
+ QVariant handle() const override;
protected:
- QVariant data(int field) Q_DECL_OVERRIDE;
- bool reset(const QString &query) Q_DECL_OVERRIDE;
- bool fetch(int i) Q_DECL_OVERRIDE;
- bool fetchNext() Q_DECL_OVERRIDE;
- bool fetchFirst() Q_DECL_OVERRIDE;
- bool fetchLast() Q_DECL_OVERRIDE;
- bool isNull(int i) Q_DECL_OVERRIDE;
- int size() Q_DECL_OVERRIDE;
- int numRowsAffected() Q_DECL_OVERRIDE;
- QSqlRecord record() const Q_DECL_OVERRIDE;
- void virtual_hook(int id, void *data) Q_DECL_OVERRIDE;
- void detachFromResultSet() Q_DECL_OVERRIDE;
- bool nextResult() Q_DECL_OVERRIDE;
+ QVariant data(int field) override;
+ bool reset(const QString &query) override;
+ bool fetch(int i) override;
+ bool fetchNext() override;
+ bool fetchFirst() override;
+ bool fetchLast() override;
+ bool isNull(int i) override;
+ int size() override;
+ int numRowsAffected() override;
+ QSqlRecord record() const override;
+ void virtual_hook(int id, void *data) override;
+ void detachFromResultSet() override;
+ bool nextResult() override;
};
class QDB2ResultPrivate: public QSqlResultPrivate
diff --git a/src/plugins/sqldrivers/db2/qsql_db2_p.h b/src/plugins/sqldrivers/db2/qsql_db2_p.h
index fa6d739479..79ae54ab2d 100644
--- a/src/plugins/sqldrivers/db2/qsql_db2_p.h
+++ b/src/plugins/sqldrivers/db2/qsql_db2_p.h
@@ -75,24 +75,24 @@ public:
explicit QDB2Driver(QObject* parent = 0);
QDB2Driver(Qt::HANDLE env, Qt::HANDLE con, QObject* parent = 0);
~QDB2Driver();
- bool hasFeature(DriverFeature) const Q_DECL_OVERRIDE;
- void close() Q_DECL_OVERRIDE;
- QSqlRecord record(const QString &tableName) const Q_DECL_OVERRIDE;
- QStringList tables(QSql::TableType type) const Q_DECL_OVERRIDE;
- QSqlResult *createResult() const Q_DECL_OVERRIDE;
- QSqlIndex primaryIndex(const QString &tablename) const Q_DECL_OVERRIDE;
- bool beginTransaction() Q_DECL_OVERRIDE;
- bool commitTransaction() Q_DECL_OVERRIDE;
- bool rollbackTransaction() Q_DECL_OVERRIDE;
- QString formatValue(const QSqlField &field, bool trimStrings) const Q_DECL_OVERRIDE;
- QVariant handle() const Q_DECL_OVERRIDE;
+ bool hasFeature(DriverFeature) const override;
+ void close() override;
+ QSqlRecord record(const QString &tableName) const override;
+ QStringList tables(QSql::TableType type) const override;
+ QSqlResult *createResult() const override;
+ QSqlIndex primaryIndex(const QString &tablename) const override;
+ bool beginTransaction() override;
+ bool commitTransaction() override;
+ bool rollbackTransaction() override;
+ QString formatValue(const QSqlField &field, bool trimStrings) const override;
+ QVariant handle() const override;
bool open(const QString &db,
const QString &user,
const QString &password,
const QString &host,
int port,
- const QString& connOpts) Q_DECL_OVERRIDE;
- QString escapeIdentifier(const QString &identifier, IdentifierType type) const Q_DECL_OVERRIDE;
+ const QString& connOpts) override;
+ QString escapeIdentifier(const QString &identifier, IdentifierType type) const override;
private:
bool setAutoCommit(bool autoCommit);
diff --git a/src/plugins/sqldrivers/ibase/qsql_ibase.cpp b/src/plugins/sqldrivers/ibase/qsql_ibase.cpp
index c50fc7916a..218cd75c69 100644
--- a/src/plugins/sqldrivers/ibase/qsql_ibase.cpp
+++ b/src/plugins/sqldrivers/ibase/qsql_ibase.cpp
@@ -356,16 +356,16 @@ class QIBaseResult : public QSqlCachedResult
public:
explicit QIBaseResult(const QIBaseDriver* db);
- bool prepare(const QString &query) Q_DECL_OVERRIDE;
- bool exec() Q_DECL_OVERRIDE;
- QVariant handle() const Q_DECL_OVERRIDE;
+ bool prepare(const QString &query) override;
+ bool exec() override;
+ QVariant handle() const override;
protected:
- bool gotoNext(QSqlCachedResult::ValueCache& row, int rowIdx) Q_DECL_OVERRIDE;
- bool reset (const QString &query) Q_DECL_OVERRIDE;
- int size() Q_DECL_OVERRIDE;
- int numRowsAffected() Q_DECL_OVERRIDE;
- QSqlRecord record() const Q_DECL_OVERRIDE;
+ bool gotoNext(QSqlCachedResult::ValueCache& row, int rowIdx) override;
+ bool reset (const QString &query) override;
+ int size() override;
+ int numRowsAffected() override;
+ QSqlRecord record() const override;
};
class QIBaseResultPrivate: public QSqlCachedResultPrivate
diff --git a/src/plugins/sqldrivers/ibase/qsql_ibase_p.h b/src/plugins/sqldrivers/ibase/qsql_ibase_p.h
index c7cee41462..295f6c0cec 100644
--- a/src/plugins/sqldrivers/ibase/qsql_ibase_p.h
+++ b/src/plugins/sqldrivers/ibase/qsql_ibase_p.h
@@ -74,36 +74,36 @@ public:
explicit QIBaseDriver(QObject *parent = 0);
explicit QIBaseDriver(isc_db_handle connection, QObject *parent = 0);
virtual ~QIBaseDriver();
- bool hasFeature(DriverFeature f) const Q_DECL_OVERRIDE;
+ bool hasFeature(DriverFeature f) const override;
bool open(const QString &db,
const QString &user,
const QString &password,
const QString &host,
int port,
- const QString &connOpts) Q_DECL_OVERRIDE;
+ const QString &connOpts) override;
bool open(const QString &db,
const QString &user,
const QString &password,
const QString &host,
int port) { return open(db, user, password, host, port, QString()); }
- void close() Q_DECL_OVERRIDE;
- QSqlResult *createResult() const Q_DECL_OVERRIDE;
- bool beginTransaction() Q_DECL_OVERRIDE;
- bool commitTransaction() Q_DECL_OVERRIDE;
- bool rollbackTransaction() Q_DECL_OVERRIDE;
- QStringList tables(QSql::TableType) const Q_DECL_OVERRIDE;
+ void close() override;
+ QSqlResult *createResult() const override;
+ bool beginTransaction() override;
+ bool commitTransaction() override;
+ bool rollbackTransaction() override;
+ QStringList tables(QSql::TableType) const override;
- QSqlRecord record(const QString& tablename) const Q_DECL_OVERRIDE;
- QSqlIndex primaryIndex(const QString &table) const Q_DECL_OVERRIDE;
+ QSqlRecord record(const QString& tablename) const override;
+ QSqlIndex primaryIndex(const QString &table) const override;
- QString formatValue(const QSqlField &field, bool trimStrings) const Q_DECL_OVERRIDE;
- QVariant handle() const Q_DECL_OVERRIDE;
+ QString formatValue(const QSqlField &field, bool trimStrings) const override;
+ QVariant handle() const override;
- QString escapeIdentifier(const QString &identifier, IdentifierType type) const Q_DECL_OVERRIDE;
+ QString escapeIdentifier(const QString &identifier, IdentifierType type) const override;
- bool subscribeToNotification(const QString &name) Q_DECL_OVERRIDE;
- bool unsubscribeFromNotification(const QString &name) Q_DECL_OVERRIDE;
- QStringList subscribedToNotifications() const Q_DECL_OVERRIDE;
+ bool subscribeToNotification(const QString &name) override;
+ bool unsubscribeFromNotification(const QString &name) override;
+ QStringList subscribedToNotifications() const override;
private Q_SLOTS:
void qHandleEventNotification(void* updatedResultBuffer);
diff --git a/src/plugins/sqldrivers/mysql/main.cpp b/src/plugins/sqldrivers/mysql/main.cpp
index 00d9c5bb34..d8d70483ef 100644
--- a/src/plugins/sqldrivers/mysql/main.cpp
+++ b/src/plugins/sqldrivers/mysql/main.cpp
@@ -51,7 +51,7 @@ class QMYSQLDriverPlugin : public QSqlDriverPlugin
public:
QMYSQLDriverPlugin();
- QSqlDriver* create(const QString &) Q_DECL_OVERRIDE;
+ QSqlDriver* create(const QString &) override;
};
QMYSQLDriverPlugin::QMYSQLDriverPlugin()
diff --git a/src/plugins/sqldrivers/mysql/qsql_mysql.cpp b/src/plugins/sqldrivers/mysql/qsql_mysql.cpp
index d9aebff700..f84a0081df 100644
--- a/src/plugins/sqldrivers/mysql/qsql_mysql.cpp
+++ b/src/plugins/sqldrivers/mysql/qsql_mysql.cpp
@@ -175,26 +175,26 @@ public:
explicit QMYSQLResult(const QMYSQLDriver *db);
~QMYSQLResult();
- QVariant handle() const Q_DECL_OVERRIDE;
+ QVariant handle() const override;
protected:
void cleanup();
- bool fetch(int i) Q_DECL_OVERRIDE;
- bool fetchNext() Q_DECL_OVERRIDE;
- bool fetchLast() Q_DECL_OVERRIDE;
- bool fetchFirst() Q_DECL_OVERRIDE;
- QVariant data(int field) Q_DECL_OVERRIDE;
- bool isNull(int field) Q_DECL_OVERRIDE;
- bool reset (const QString& query) Q_DECL_OVERRIDE;
- int size() Q_DECL_OVERRIDE;
- int numRowsAffected() Q_DECL_OVERRIDE;
- QVariant lastInsertId() const Q_DECL_OVERRIDE;
- QSqlRecord record() const Q_DECL_OVERRIDE;
- void virtual_hook(int id, void *data) Q_DECL_OVERRIDE;
- bool nextResult() Q_DECL_OVERRIDE;
+ bool fetch(int i) override;
+ bool fetchNext() override;
+ bool fetchLast() override;
+ bool fetchFirst() override;
+ QVariant data(int field) override;
+ bool isNull(int field) override;
+ bool reset (const QString& query) override;
+ int size() override;
+ int numRowsAffected() override;
+ QVariant lastInsertId() const override;
+ QSqlRecord record() const override;
+ void virtual_hook(int id, void *data) override;
+ bool nextResult() override;
#if MYSQL_VERSION_ID >= 40108
- bool prepare(const QString &stmt) Q_DECL_OVERRIDE;
- bool exec() Q_DECL_OVERRIDE;
+ bool prepare(const QString &stmt) override;
+ bool exec() override;
#endif
};
diff --git a/src/plugins/sqldrivers/mysql/qsql_mysql_p.h b/src/plugins/sqldrivers/mysql/qsql_mysql_p.h
index 7641f9aa34..48b04fb1f5 100644
--- a/src/plugins/sqldrivers/mysql/qsql_mysql_p.h
+++ b/src/plugins/sqldrivers/mysql/qsql_mysql_p.h
@@ -78,29 +78,29 @@ public:
explicit QMYSQLDriver(QObject *parent=0);
explicit QMYSQLDriver(MYSQL *con, QObject * parent=0);
~QMYSQLDriver();
- bool hasFeature(DriverFeature f) const Q_DECL_OVERRIDE;
+ bool hasFeature(DriverFeature f) const override;
bool open(const QString & db,
const QString & user,
const QString & password,
const QString & host,
int port,
- const QString& connOpts) Q_DECL_OVERRIDE;
- void close() Q_DECL_OVERRIDE;
- QSqlResult *createResult() const Q_DECL_OVERRIDE;
- QStringList tables(QSql::TableType) const Q_DECL_OVERRIDE;
- QSqlIndex primaryIndex(const QString& tablename) const Q_DECL_OVERRIDE;
- QSqlRecord record(const QString& tablename) const Q_DECL_OVERRIDE;
+ const QString& connOpts) override;
+ void close() override;
+ QSqlResult *createResult() const override;
+ QStringList tables(QSql::TableType) const override;
+ QSqlIndex primaryIndex(const QString& tablename) const override;
+ QSqlRecord record(const QString& tablename) const override;
QString formatValue(const QSqlField &field,
- bool trimStrings) const Q_DECL_OVERRIDE;
- QVariant handle() const Q_DECL_OVERRIDE;
- QString escapeIdentifier(const QString &identifier, IdentifierType type) const Q_DECL_OVERRIDE;
+ bool trimStrings) const override;
+ QVariant handle() const override;
+ QString escapeIdentifier(const QString &identifier, IdentifierType type) const override;
- bool isIdentifierEscaped(const QString &identifier, IdentifierType type) const Q_DECL_OVERRIDE;
+ bool isIdentifierEscaped(const QString &identifier, IdentifierType type) const override;
protected:
- bool beginTransaction() Q_DECL_OVERRIDE;
- bool commitTransaction() Q_DECL_OVERRIDE;
- bool rollbackTransaction() Q_DECL_OVERRIDE;
+ bool beginTransaction() override;
+ bool commitTransaction() override;
+ bool rollbackTransaction() override;
private:
void init();
};
diff --git a/src/plugins/sqldrivers/oci/qsql_oci.cpp b/src/plugins/sqldrivers/oci/qsql_oci.cpp
index 9ce2fc1b55..2d16c3d60c 100644
--- a/src/plugins/sqldrivers/oci/qsql_oci.cpp
+++ b/src/plugins/sqldrivers/oci/qsql_oci.cpp
@@ -55,6 +55,7 @@
#include <qvarlengtharray.h>
#include <qvector.h>
#include <qdebug.h>
+#include <qtimezone.h>
// This is needed for oracle oci when compiling with mingw-w64 headers
#if defined(__MINGW64_VERSION_MAJOR) && defined(_WIN64)
@@ -112,9 +113,6 @@ static const ub2 qOraCharset = OCI_UCS2ID;
typedef QVarLengthArray<sb2, 32> IndicatorArray;
typedef QVarLengthArray<ub2, 32> SizeArray;
-static QByteArray qMakeOraDate(const QDateTime& dt);
-static QDateTime qMakeDate(const char* oraDate);
-
static QByteArray qMakeOCINumber(const qlonglong &ll, OCIError *err);
static QByteArray qMakeOCINumber(const qulonglong& ull, OCIError* err);
@@ -156,6 +154,60 @@ QOCIRowId::~QOCIRowId()
OCIDescriptorFree(id, OCI_DTYPE_ROWID);
}
+class QOCIDateTime
+{
+public:
+ QOCIDateTime(OCIEnv *env, OCIError *err, const QDateTime &dt = QDateTime());
+ ~QOCIDateTime();
+ OCIDateTime *dateTime;
+ static QDateTime fromOCIDateTime(OCIEnv *env, OCIError *err, OCIDateTime *dt);
+};
+
+QOCIDateTime::QOCIDateTime(OCIEnv *env, OCIError *err, const QDateTime &dt)
+ : dateTime(nullptr)
+{
+ OCIDescriptorAlloc(env, reinterpret_cast<void**>(&dateTime), OCI_DTYPE_TIMESTAMP_TZ, 0, 0);
+ if (dt.isValid()) {
+ const QDate date = dt.date();
+ const QTime time = dt.time();
+ // Zone in +hh:mm format (stripping UTC prefix from OffsetName)
+ QString timeZone = dt.timeZone().displayName(dt, QTimeZone::OffsetName).mid(3);
+ const OraText *tz = reinterpret_cast<const OraText *>(timeZone.utf16());
+ OCIDateTimeConstruct(env, err, dateTime, date.year(), date.month(), date.day(), time.hour(),
+ time.minute(), time.second(), time.msec() * 1000000,
+ const_cast<OraText *>(tz), timeZone.length() * sizeof(QChar));
+ }
+}
+
+QOCIDateTime::~QOCIDateTime()
+{
+ if (dateTime != nullptr)
+ OCIDescriptorFree(dateTime, OCI_DTYPE_TIMESTAMP_TZ);
+}
+
+QDateTime QOCIDateTime::fromOCIDateTime(OCIEnv *env, OCIError *err, OCIDateTime *dateTime)
+{
+ sb2 year;
+ ub1 month, day, hour, minute, second;
+ ub4 nsec;
+ sb1 tzHour, tzMinute;
+
+ OCIDateTimeGetDate(env, err, dateTime, &year, &month, &day);
+ OCIDateTimeGetTime(env, err, dateTime, &hour, &minute, &second, &nsec);
+ OCIDateTimeGetTimeZoneOffset(env, err, dateTime, &tzHour, &tzMinute);
+ int secondsOffset = (qAbs(tzHour) * 60 + tzMinute) * 60;
+ if (tzHour < 0)
+ secondsOffset = -secondsOffset;
+ // OCIDateTimeGetTime gives "fractions of second" as nanoseconds
+ return QDateTime(QDate(year, month, day), QTime(hour, minute, second, nsec / 1000000),
+ Qt::OffsetFromUTC, secondsOffset);
+}
+
+struct TempStorage {
+ QList<QByteArray> rawData;
+ QList<QOCIDateTime *> dateTimes;
+};
+
typedef QSharedDataPointer<QOCIRowId> QOCIRowIdPointer;
QT_BEGIN_INCLUDE_NAMESPACE
Q_DECLARE_METATYPE(QOCIRowIdPointer)
@@ -193,19 +245,19 @@ class QOCIResult: public QSqlCachedResult
public:
QOCIResult(const QOCIDriver *db);
~QOCIResult();
- bool prepare(const QString &query) Q_DECL_OVERRIDE;
- bool exec() Q_DECL_OVERRIDE;
- QVariant handle() const Q_DECL_OVERRIDE;
+ bool prepare(const QString &query) override;
+ bool exec() override;
+ QVariant handle() const override;
protected:
- bool gotoNext(ValueCache &values, int index) Q_DECL_OVERRIDE;
- bool reset(const QString &query) Q_DECL_OVERRIDE;
- int size() Q_DECL_OVERRIDE;
- int numRowsAffected() Q_DECL_OVERRIDE;
- QSqlRecord record() const Q_DECL_OVERRIDE;
- QVariant lastInsertId() const Q_DECL_OVERRIDE;
- bool execBatch(bool arrayBind = false) Q_DECL_OVERRIDE;
- void virtual_hook(int id, void *data) Q_DECL_OVERRIDE;
+ bool gotoNext(ValueCache &values, int index) override;
+ bool reset(const QString &query) override;
+ int size() override;
+ int numRowsAffected() override;
+ QSqlRecord record() const override;
+ QVariant lastInsertId() const override;
+ bool execBatch(bool arrayBind = false) override;
+ void virtual_hook(int id, void *data) override;
bool fetchNext() override;
};
@@ -228,11 +280,11 @@ public:
void setStatementAttributes();
int bindValue(OCIStmt *sql, OCIBind **hbnd, OCIError *err, int pos,
- const QVariant &val, dvoid *indPtr, ub2 *tmpSize, QList<QByteArray> &tmpStorage);
+ const QVariant &val, dvoid *indPtr, ub2 *tmpSize, TempStorage &tmpStorage);
int bindValues(QVector<QVariant> &values, IndicatorArray &indicators, SizeArray &tmpSizes,
- QList<QByteArray> &tmpStorage);
+ TempStorage &tmpStorage);
void outValues(QVector<QVariant> &values, IndicatorArray &indicators,
- QList<QByteArray> &tmpStorage);
+ TempStorage &tmpStorage);
inline bool isOutValue(int i) const
{ Q_Q(const QOCIResult); return q->bindValueType(i) & QSql::Out; }
inline bool isBinaryValue(int i) const
@@ -305,7 +357,7 @@ void QOCIResultPrivate::setStatementAttributes()
}
int QOCIResultPrivate::bindValue(OCIStmt *sql, OCIBind **hbnd, OCIError *err, int pos,
- const QVariant &val, dvoid *indPtr, ub2 *tmpSize, QList<QByteArray> &tmpStorage)
+ const QVariant &val, dvoid *indPtr, ub2 *tmpSize, TempStorage &tmpStorage)
{
int r = OCI_SUCCESS;
void *data = const_cast<void *>(val.constData());
@@ -323,14 +375,15 @@ int QOCIResultPrivate::bindValue(OCIStmt *sql, OCIBind **hbnd, OCIError *err, in
case QVariant::Time:
case QVariant::Date:
case QVariant::DateTime: {
- QByteArray ba = qMakeOraDate(val.toDateTime());
+ QOCIDateTime *ptr = new QOCIDateTime(env, err, val.toDateTime());
r = OCIBindByPos(sql, hbnd, err,
pos + 1,
- ba.data(),
- ba.size(),
- SQLT_DAT, indPtr, 0, 0, 0, 0, OCI_DEFAULT);
- tmpStorage.append(ba);
- break; }
+ &ptr->dateTime,
+ sizeof(OCIDateTime *),
+ SQLT_TIMESTAMP_TZ, indPtr, 0, 0, 0, 0, OCI_DEFAULT);
+ tmpStorage.dateTimes.append(ptr);
+ break;
+ }
case QVariant::Int:
r = OCIBindByPos(sql, hbnd, err,
pos + 1,
@@ -357,7 +410,7 @@ int QOCIResultPrivate::bindValue(OCIStmt *sql, OCIBind **hbnd, OCIError *err, in
ba.data(),
ba.size(),
SQLT_VNU, indPtr, 0, 0, 0, 0, OCI_DEFAULT);
- tmpStorage.append(ba);
+ tmpStorage.rawData.append(ba);
break;
}
case QVariant::ULongLong:
@@ -368,7 +421,7 @@ int QOCIResultPrivate::bindValue(OCIStmt *sql, OCIBind **hbnd, OCIError *err, in
ba.data(),
ba.size(),
SQLT_VNU, indPtr, 0, 0, 0, 0, OCI_DEFAULT);
- tmpStorage.append(ba);
+ tmpStorage.rawData.append(ba);
break;
}
case QVariant::Double:
@@ -438,7 +491,7 @@ int QOCIResultPrivate::bindValue(OCIStmt *sql, OCIBind **hbnd, OCIError *err, in
}
if (r == OCI_SUCCESS)
setCharset(*hbnd, OCI_HTYPE_BIND);
- tmpStorage.append(ba);
+ tmpStorage.rawData.append(ba);
break;
} // default case
} // switch
@@ -448,7 +501,7 @@ int QOCIResultPrivate::bindValue(OCIStmt *sql, OCIBind **hbnd, OCIError *err, in
}
int QOCIResultPrivate::bindValues(QVector<QVariant> &values, IndicatorArray &indicators,
- SizeArray &tmpSizes, QList<QByteArray> &tmpStorage)
+ SizeArray &tmpSizes, TempStorage &tmpStorage)
{
int r = OCI_SUCCESS;
for (int i = 0; i < values.count(); ++i) {
@@ -466,27 +519,30 @@ int QOCIResultPrivate::bindValues(QVector<QVariant> &values, IndicatorArray &ind
}
// will assign out value and remove its temp storage.
-static void qOraOutValue(QVariant &value, QList<QByteArray> &storage, OCIError* err)
+static void qOraOutValue(QVariant &value, TempStorage &tmpStorage, OCIEnv *env, OCIError* err)
{
switch (value.type()) {
case QVariant::Time:
- value = qMakeDate(storage.takeFirst()).time();
+ value = QOCIDateTime::fromOCIDateTime(env, err,
+ tmpStorage.dateTimes.takeFirst()->dateTime).time();
break;
case QVariant::Date:
- value = qMakeDate(storage.takeFirst()).date();
+ value = QOCIDateTime::fromOCIDateTime(env, err,
+ tmpStorage.dateTimes.takeFirst()->dateTime).date();
break;
case QVariant::DateTime:
- value = qMakeDate(storage.takeFirst());
+ value = QOCIDateTime::fromOCIDateTime(env, err,
+ tmpStorage.dateTimes.takeFirst()->dateTime);
break;
case QVariant::LongLong:
- value = qMakeLongLong(storage.takeFirst(), err);
+ value = qMakeLongLong(tmpStorage.rawData.takeFirst(), err);
break;
case QVariant::ULongLong:
- value = qMakeULongLong(storage.takeFirst(), err);
+ value = qMakeULongLong(tmpStorage.rawData.takeFirst(), err);
break;
case QVariant::String:
value = QString(
- reinterpret_cast<const QChar *>(storage.takeFirst().constData()));
+ reinterpret_cast<const QChar *>(tmpStorage.rawData.takeFirst().constData()));
break;
default:
break; //nothing
@@ -494,14 +550,14 @@ static void qOraOutValue(QVariant &value, QList<QByteArray> &storage, OCIError*
}
void QOCIResultPrivate::outValues(QVector<QVariant> &values, IndicatorArray &indicators,
- QList<QByteArray> &tmpStorage)
+ TempStorage &tmpStorage)
{
for (int i = 0; i < values.count(); ++i) {
if (!isOutValue(i))
continue;
- qOraOutValue(values[i], tmpStorage, err);
+ qOraOutValue(values[i], tmpStorage, env, err);
QVariant::Type typ = values.at(i).type();
if (indicators[i] == -1) // NULL
@@ -693,11 +749,9 @@ QVariant::Type qDecodeOCIType(int ocitype, QSql::NumericalPrecisionPolicy precis
break;
case SQLT_DAT:
case SQLT_ODT:
-#ifdef SQLT_TIMESTAMP
case SQLT_TIMESTAMP:
case SQLT_TIMESTAMP_TZ:
case SQLT_TIMESTAMP_LTZ:
-#endif
type = QVariant::DateTime;
break;
default:
@@ -724,27 +778,6 @@ static QSqlField qFromOraInf(const OraFieldInfo &ofi)
}
/*!
- \internal
-
- Convert QDateTime to the internal Oracle DATE format NB!
- It does not handle BCE dates.
-*/
-QByteArray qMakeOraDate(const QDateTime& dt)
-{
- QByteArray ba;
- ba.resize(7);
- int year = dt.date().year();
- ba[0]= (year / 100) + 100; // century
- ba[1]= (year % 100) + 100; // year
- ba[2]= dt.date().month();
- ba[3]= dt.date().day();
- ba[4]= dt.time().hour() + 1;
- ba[5]= dt.time().minute() + 1;
- ba[6]= dt.time().second() + 1;
- return ba;
-}
-
-/*!
\internal
Convert qlonglong to the internal Oracle OCINumber format.
@@ -794,22 +827,6 @@ qulonglong qMakeULongLong(const char* ociNumber, OCIError* err)
return qull;
}
-QDateTime qMakeDate(const char* oraDate)
-{
- int century = uchar(oraDate[0]);
- if(century >= 100){
- int year = uchar(oraDate[1]);
- year = ((century-100)*100) + (year-100);
- int month = oraDate[2];
- int day = oraDate[3];
- int hour = oraDate[4] - 1;
- int min = oraDate[5] - 1;
- int sec = oraDate[6] - 1;
- return QDateTime(QDate(year,month,day), QTime(hour,min,sec));
- }
- return QDateTime();
-}
-
class QOCICols
{
public:
@@ -832,7 +849,7 @@ private:
class OraFieldInf
{
public:
- OraFieldInf(): data(0), len(0), ind(0), typ(QVariant::Invalid), oraType(0), def(0), lob(0)
+ OraFieldInf() : data(0), len(0), ind(0), typ(QVariant::Invalid), oraType(0), def(0), lob(0), dataPtr(nullptr)
{}
~OraFieldInf();
char *data;
@@ -842,6 +859,7 @@ private:
ub4 oraType;
OCIDefine *def;
OCILobLocator *lob;
+ void *dataPtr;
};
QVector<OraFieldInf> fieldInf;
@@ -856,6 +874,20 @@ QOCICols::OraFieldInf::~OraFieldInf()
if (r != 0)
qWarning("QOCICols: Cannot free LOB descriptor");
}
+ if (dataPtr) {
+ switch (typ) {
+ case QVariant::Date:
+ case QVariant::Time:
+ case QVariant::DateTime: {
+ int r = OCIDescriptorFree(dataPtr, OCI_DTYPE_TIMESTAMP_TZ);
+ if (r != OCI_SUCCESS)
+ qWarning("QOCICols: Cannot free OCIDateTime descriptor");
+ break;
+ }
+ default:
+ break;
+ }
+ }
}
QOCICols::QOCICols(int size, QOCIResultPrivate* dp)
@@ -902,13 +934,18 @@ QOCICols::QOCICols(int size, QOCIResultPrivate* dp)
switch (ofi.type) {
case QVariant::DateTime:
+ r = OCIDescriptorAlloc(d->env, (void **)&fieldInf[idx].dataPtr, OCI_DTYPE_TIMESTAMP_TZ, 0, 0);
+ if (r != OCI_SUCCESS) {
+ qWarning("QOCICols: Unable to allocate the OCIDateTime descriptor");
+ break;
+ }
r = OCIDefineByPos(d->sql,
&dfn,
d->err,
count,
- create(idx, dataSize+1),
- dataSize+1,
- SQLT_DAT,
+ &fieldInf[idx].dataPtr,
+ sizeof(OCIDateTime *),
+ SQLT_TIMESTAMP_TZ,
&(fieldInf[idx].ind),
0, 0, OCI_DEFAULT);
break;
@@ -1323,11 +1360,10 @@ bool QOCICols::execBatch(QOCIResultPrivate *d, QVector<QVariant> &boundValues, b
fieldTypes.append(tp == QVariant::List ? boundValues.at(i).toList().value(0).type()
: tp);
}
-
- QList<QByteArray> tmpStorage;
SizeArray tmpSizes(columnCount);
QVector<QOCIBatchColumn> columns(columnCount);
QOCIBatchCleanupHandler cleaner(columns);
+ TempStorage tmpStorage;
// figuring out buffer sizes
for (i = 0; i < columnCount; ++i) {
@@ -1364,8 +1400,8 @@ bool QOCICols::execBatch(QOCIResultPrivate *d, QVector<QVariant> &boundValues, b
case QVariant::Time:
case QVariant::Date:
case QVariant::DateTime:
- col.bindAs = SQLT_DAT;
- col.maxLen = 7;
+ col.bindAs = SQLT_TIMESTAMP_TZ;
+ col.maxLen = sizeof(OCIDateTime *);
break;
case QVariant::Int:
@@ -1433,7 +1469,7 @@ bool QOCICols::execBatch(QOCIResultPrivate *d, QVector<QVariant> &boundValues, b
for (uint row = 0; row < col.recordCount; ++row) {
const QVariant &val = boundValues.at(i).toList().at(row);
- if (val.isNull()){
+ if (val.isNull() && !d->isOutValue(i)) {
columns[i].indicators[row] = -1;
columns[i].lengths[row] = 0;
} else {
@@ -1444,9 +1480,8 @@ bool QOCICols::execBatch(QOCIResultPrivate *d, QVector<QVariant> &boundValues, b
case QVariant::Date:
case QVariant::DateTime:{
columns[i].lengths[row] = columns[i].maxLen;
- const QByteArray ba = qMakeOraDate(val.toDateTime());
- Q_ASSERT(ba.size() == int(columns[i].maxLen));
- memcpy(dataPtr, ba.constData(), columns[i].maxLen);
+ QOCIDateTime *date = new QOCIDateTime(d->env, d->err, val.toDateTime());
+ *reinterpret_cast<OCIDateTime**>(dataPtr) = date->dateTime;
break;
}
case QVariant::Int:
@@ -1582,7 +1617,7 @@ bool QOCICols::execBatch(QOCIResultPrivate *d, QVector<QVariant> &boundValues, b
QVariant::Type tp = boundValues.at(i).type();
if (tp != QVariant::List) {
- qOraOutValue(boundValues[i], tmpStorage, d->err);
+ qOraOutValue(boundValues[i], tmpStorage, d->env, d->err);
if (*columns[i].indicators == -1)
boundValues[i] = QVariant(tp);
continue;
@@ -1594,16 +1629,16 @@ bool QOCICols::execBatch(QOCIResultPrivate *d, QVector<QVariant> &boundValues, b
for (uint r = 0; r < columns[i].recordCount; ++r){
if (columns[i].indicators[r] == -1) {
- (*list)[r] = QVariant();
+ (*list)[r] = QVariant(fieldTypes[i]);
continue;
}
switch(columns[i].bindAs) {
- case SQLT_DAT:
- (*list)[r] = qMakeDate(data + r * columns[i].maxLen);
+ case SQLT_TIMESTAMP_TZ:
+ (*list)[r] = QOCIDateTime::fromOCIDateTime(d->env, d->err,
+ *reinterpret_cast<OCIDateTime **>(data + r * columns[i].maxLen));
break;
-
case SQLT_INT:
(*list)[r] = *reinterpret_cast<int*>(data + r * columns[i].maxLen);
break;
@@ -1647,6 +1682,7 @@ bool QOCICols::execBatch(QOCIResultPrivate *d, QVector<QVariant> &boundValues, b
d->q_func()->setAt(QSql::BeforeFirstRow);
d->q_func()->setActive(true);
+ qDeleteAll(tmpStorage.dateTimes);
return true;
}
@@ -1755,7 +1791,8 @@ void QOCICols::getValues(QVector<QVariant> &v, int index)
switch (fld.typ) {
case QVariant::DateTime:
- v[index + i] = QVariant(qMakeDate(fld.data));
+ v[index + i] = QVariant(QOCIDateTime::fromOCIDateTime(d->env, d->err,
+ reinterpret_cast<OCIDateTime *>(fld.dataPtr)));
break;
case QVariant::Double:
case QVariant::Int:
@@ -1985,7 +2022,7 @@ bool QOCIResult::exec()
ub2 stmtType=0;
ub4 iters;
ub4 mode;
- QList<QByteArray> tmpStorage;
+ TempStorage tmpStorage;
IndicatorArray indicators(boundValueCount());
SizeArray tmpSizes(boundValueCount());
@@ -2056,7 +2093,7 @@ bool QOCIResult::exec()
if (hasOutValues())
d->outValues(boundValues(), indicators, tmpStorage);
-
+ qDeleteAll(tmpStorage.dateTimes);
return true;
}
diff --git a/src/plugins/sqldrivers/oci/qsql_oci_p.h b/src/plugins/sqldrivers/oci/qsql_oci_p.h
index 69911f4bee..295c131f1a 100644
--- a/src/plugins/sqldrivers/oci/qsql_oci_p.h
+++ b/src/plugins/sqldrivers/oci/qsql_oci_p.h
@@ -84,21 +84,21 @@ public:
const QString &password,
const QString &host,
int port,
- const QString &connOpts) Q_DECL_OVERRIDE;
- void close() Q_DECL_OVERRIDE;
- QSqlResult *createResult() const Q_DECL_OVERRIDE;
- QStringList tables(QSql::TableType) const Q_DECL_OVERRIDE;
- QSqlRecord record(const QString &tablename) const Q_DECL_OVERRIDE;
- QSqlIndex primaryIndex(const QString& tablename) const Q_DECL_OVERRIDE;
+ const QString &connOpts) override;
+ void close() override;
+ QSqlResult *createResult() const override;
+ QStringList tables(QSql::TableType) const override;
+ QSqlRecord record(const QString &tablename) const override;
+ QSqlIndex primaryIndex(const QString& tablename) const override;
QString formatValue(const QSqlField &field,
- bool trimStrings) const Q_DECL_OVERRIDE;
- QVariant handle() const Q_DECL_OVERRIDE;
- QString escapeIdentifier(const QString &identifier, IdentifierType) const Q_DECL_OVERRIDE;
+ bool trimStrings) const override;
+ QVariant handle() const override;
+ QString escapeIdentifier(const QString &identifier, IdentifierType) const override;
protected:
- bool beginTransaction() Q_DECL_OVERRIDE;
- bool commitTransaction() Q_DECL_OVERRIDE;
- bool rollbackTransaction() Q_DECL_OVERRIDE;
+ bool beginTransaction() override;
+ bool commitTransaction() override;
+ bool rollbackTransaction() override;
};
QT_END_NAMESPACE
diff --git a/src/plugins/sqldrivers/odbc/qsql_odbc.cpp b/src/plugins/sqldrivers/odbc/qsql_odbc.cpp
index c32a29c5e7..4a4183c7a3 100644
--- a/src/plugins/sqldrivers/odbc/qsql_odbc.cpp
+++ b/src/plugins/sqldrivers/odbc/qsql_odbc.cpp
@@ -163,27 +163,27 @@ public:
QODBCResult(const QODBCDriver *db);
virtual ~QODBCResult();
- bool prepare(const QString &query) Q_DECL_OVERRIDE;
- bool exec() Q_DECL_OVERRIDE;
+ bool prepare(const QString &query) override;
+ bool exec() override;
- QVariant lastInsertId() const Q_DECL_OVERRIDE;
- QVariant handle() const Q_DECL_OVERRIDE;
+ QVariant lastInsertId() const override;
+ QVariant handle() const override;
protected:
- bool fetchNext() Q_DECL_OVERRIDE;
- bool fetchFirst() Q_DECL_OVERRIDE;
- bool fetchLast() Q_DECL_OVERRIDE;
- bool fetchPrevious() Q_DECL_OVERRIDE;
- bool fetch(int i) Q_DECL_OVERRIDE;
- bool reset(const QString &query) Q_DECL_OVERRIDE;
- QVariant data(int field) Q_DECL_OVERRIDE;
- bool isNull(int field) Q_DECL_OVERRIDE;
- int size() Q_DECL_OVERRIDE;
- int numRowsAffected() Q_DECL_OVERRIDE;
- QSqlRecord record() const Q_DECL_OVERRIDE;
- void virtual_hook(int id, void *data) Q_DECL_OVERRIDE;
- void detachFromResultSet() Q_DECL_OVERRIDE;
- bool nextResult() Q_DECL_OVERRIDE;
+ bool fetchNext() override;
+ bool fetchFirst() override;
+ bool fetchLast() override;
+ bool fetchPrevious() override;
+ bool fetch(int i) override;
+ bool reset(const QString &query) override;
+ QVariant data(int field) override;
+ bool isNull(int field) override;
+ int size() override;
+ int numRowsAffected() override;
+ QSqlRecord record() const override;
+ void virtual_hook(int id, void *data) override;
+ void detachFromResultSet() override;
+ bool nextResult() override;
};
class QODBCResultPrivate: public QSqlResultPrivate
diff --git a/src/plugins/sqldrivers/odbc/qsql_odbc_p.h b/src/plugins/sqldrivers/odbc/qsql_odbc_p.h
index f4ce8bc243..ea0aa6fc8b 100644
--- a/src/plugins/sqldrivers/odbc/qsql_odbc_p.h
+++ b/src/plugins/sqldrivers/odbc/qsql_odbc_p.h
@@ -92,30 +92,30 @@ public:
explicit QODBCDriver(QObject *parent=0);
QODBCDriver(SQLHANDLE env, SQLHANDLE con, QObject * parent=0);
virtual ~QODBCDriver();
- bool hasFeature(DriverFeature f) const Q_DECL_OVERRIDE;
- void close() Q_DECL_OVERRIDE;
- QSqlResult *createResult() const Q_DECL_OVERRIDE;
- QStringList tables(QSql::TableType) const Q_DECL_OVERRIDE;
- QSqlRecord record(const QString &tablename) const Q_DECL_OVERRIDE;
- QSqlIndex primaryIndex(const QString &tablename) const Q_DECL_OVERRIDE;
- QVariant handle() const Q_DECL_OVERRIDE;
+ bool hasFeature(DriverFeature f) const override;
+ void close() override;
+ QSqlResult *createResult() const override;
+ QStringList tables(QSql::TableType) const override;
+ QSqlRecord record(const QString &tablename) const override;
+ QSqlIndex primaryIndex(const QString &tablename) const override;
+ QVariant handle() const override;
QString formatValue(const QSqlField &field,
- bool trimStrings) const Q_DECL_OVERRIDE;
+ bool trimStrings) const override;
bool open(const QString &db,
const QString &user,
const QString &password,
const QString &host,
int port,
- const QString &connOpts) Q_DECL_OVERRIDE;
+ const QString &connOpts) override;
- QString escapeIdentifier(const QString &identifier, IdentifierType type) const Q_DECL_OVERRIDE;
+ QString escapeIdentifier(const QString &identifier, IdentifierType type) const override;
- bool isIdentifierEscaped(const QString &identifier, IdentifierType type) const Q_DECL_OVERRIDE;
+ bool isIdentifierEscaped(const QString &identifier, IdentifierType type) const override;
protected:
- bool beginTransaction() Q_DECL_OVERRIDE;
- bool commitTransaction() Q_DECL_OVERRIDE;
- bool rollbackTransaction() Q_DECL_OVERRIDE;
+ bool beginTransaction() override;
+ bool commitTransaction() override;
+ bool rollbackTransaction() override;
private:
bool endTrans();
diff --git a/src/plugins/sqldrivers/psql/main.cpp b/src/plugins/sqldrivers/psql/main.cpp
index 7657fcbfdf..c5d546f6ff 100644
--- a/src/plugins/sqldrivers/psql/main.cpp
+++ b/src/plugins/sqldrivers/psql/main.cpp
@@ -51,7 +51,7 @@ class QPSQLDriverPlugin : public QSqlDriverPlugin
public:
QPSQLDriverPlugin();
- QSqlDriver* create(const QString &) Q_DECL_OVERRIDE;
+ QSqlDriver* create(const QString &) override;
};
QPSQLDriverPlugin::QPSQLDriverPlugin()
diff --git a/src/plugins/sqldrivers/psql/qsql_psql.cpp b/src/plugins/sqldrivers/psql/qsql_psql.cpp
index 35b0f9a3e3..ab9aa7f176 100644
--- a/src/plugins/sqldrivers/psql/qsql_psql.cpp
+++ b/src/plugins/sqldrivers/psql/qsql_psql.cpp
@@ -135,23 +135,23 @@ public:
QPSQLResult(const QPSQLDriver *db);
~QPSQLResult();
- QVariant handle() const Q_DECL_OVERRIDE;
- void virtual_hook(int id, void *data) Q_DECL_OVERRIDE;
+ QVariant handle() const override;
+ void virtual_hook(int id, void *data) override;
protected:
void cleanup();
- bool fetch(int i) Q_DECL_OVERRIDE;
- bool fetchFirst() Q_DECL_OVERRIDE;
- bool fetchLast() Q_DECL_OVERRIDE;
- QVariant data(int i) Q_DECL_OVERRIDE;
- bool isNull(int field) Q_DECL_OVERRIDE;
- bool reset (const QString &query) Q_DECL_OVERRIDE;
- int size() Q_DECL_OVERRIDE;
- int numRowsAffected() Q_DECL_OVERRIDE;
- QSqlRecord record() const Q_DECL_OVERRIDE;
- QVariant lastInsertId() const Q_DECL_OVERRIDE;
- bool prepare(const QString &query) Q_DECL_OVERRIDE;
- bool exec() Q_DECL_OVERRIDE;
+ bool fetch(int i) override;
+ bool fetchFirst() override;
+ bool fetchLast() override;
+ QVariant data(int i) override;
+ bool isNull(int field) override;
+ bool reset (const QString &query) override;
+ int size() override;
+ int numRowsAffected() override;
+ QSqlRecord record() const override;
+ QVariant lastInsertId() const override;
+ bool prepare(const QString &query) override;
+ bool exec() override;
};
class QPSQLDriverPrivate : public QSqlDriverPrivate
@@ -187,18 +187,11 @@ public:
void QPSQLDriverPrivate::appendTables(QStringList &tl, QSqlQuery &t, QChar type)
{
- QString query;
- if (pro >= QPSQLDriver::Version7_3) {
- query = QString::fromLatin1("select pg_class.relname, pg_namespace.nspname from pg_class "
- "left join pg_namespace on (pg_class.relnamespace = pg_namespace.oid) "
- "where (pg_class.relkind = '%1') and (pg_class.relname !~ '^Inv') "
- "and (pg_class.relname !~ '^pg_') "
- "and (pg_namespace.nspname != 'information_schema') ").arg(type);
- } else {
- query = QString::fromLatin1("select relname, null from pg_class where (relkind = '%1') "
- "and (relname !~ '^Inv') "
- "and (relname !~ '^pg_') ").arg(type);
- }
+ QString query = QString::fromLatin1("select pg_class.relname, pg_namespace.nspname from pg_class "
+ "left join pg_namespace on (pg_class.relnamespace = pg_namespace.oid) "
+ "where (pg_class.relkind = '%1') and (pg_class.relname !~ '^Inv') "
+ "and (pg_class.relname !~ '^pg_') "
+ "and (pg_namespace.nspname != 'information_schema')").arg(type);
t.exec(query);
while (t.next()) {
QString schema = t.value(1).toString();
@@ -237,7 +230,7 @@ public:
preparedQueriesEnabled(false)
{ }
- QString fieldSerial(int i) const Q_DECL_OVERRIDE { return QLatin1Char('$') + QString::number(i + 1); }
+ QString fieldSerial(int i) const override { return QLatin1Char('$') + QString::number(i + 1); }
void deallocatePreparedStmt();
PGresult *result;
@@ -895,6 +888,7 @@ bool QPSQLDriver::hasFeature(DriverFeature f) const
case LastInsertId:
case LowPrecisionNumbers:
case EventNotifications:
+ case BLOB:
return true;
case PreparedQueries:
case PositionalPlaceholders:
@@ -906,8 +900,6 @@ bool QPSQLDriver::hasFeature(DriverFeature f) const
case MultipleResultSets:
case CancelQuery:
return false;
- case BLOB:
- return d->pro >= QPSQLDriver::Version7_1;
case Unicode:
return d->isUtf8;
}
@@ -1101,12 +1093,10 @@ static void qSplitTableName(QString &tablename, QString &schema)
QSqlIndex QPSQLDriver::primaryIndex(const QString& tablename) const
{
- Q_D(const QPSQLDriver);
QSqlIndex idx(tablename);
if (!isOpen())
return idx;
QSqlQuery i(createResult());
- QString stmt;
QString tbl = tablename;
QString schema;
@@ -1122,42 +1112,20 @@ QSqlIndex QPSQLDriver::primaryIndex(const QString& tablename) const
else
schema = std::move(schema).toLower();
- if (d->pro == QPSQLDriver::Version6) {
- stmt = QLatin1String("select pg_att1.attname, int(pg_att1.atttypid), pg_cl.relname "
- "from pg_attribute pg_att1, pg_attribute pg_att2, pg_class pg_cl, pg_index pg_ind "
- "where pg_cl.relname = '%1_pkey' "
- "and pg_cl.oid = pg_ind.indexrelid "
- "and pg_att2.attrelid = pg_ind.indexrelid "
- "and pg_att1.attrelid = pg_ind.indrelid "
- "and pg_att1.attnum = pg_ind.indkey[pg_att2.attnum-1] "
- "order by pg_att2.attnum");
- } else if (d->pro == QPSQLDriver::Version7 || d->pro == QPSQLDriver::Version7_1) {
- stmt = QLatin1String("select pg_att1.attname, pg_att1.atttypid::int, pg_cl.relname "
- "from pg_attribute pg_att1, pg_attribute pg_att2, pg_class pg_cl, pg_index pg_ind "
- "where pg_cl.relname = '%1_pkey' "
- "and pg_cl.oid = pg_ind.indexrelid "
- "and pg_att2.attrelid = pg_ind.indexrelid "
- "and pg_att1.attrelid = pg_ind.indrelid "
- "and pg_att1.attnum = pg_ind.indkey[pg_att2.attnum-1] "
- "order by pg_att2.attnum");
- } else if (d->pro >= QPSQLDriver::Version7_3) {
- stmt = QLatin1String("SELECT pg_attribute.attname, pg_attribute.atttypid::int, "
- "pg_class.relname "
- "FROM pg_attribute, pg_class "
- "WHERE %1 pg_class.oid IN "
- "(SELECT indexrelid FROM pg_index WHERE indisprimary = true AND indrelid IN "
- " (SELECT oid FROM pg_class WHERE relname = '%2')) "
- "AND pg_attribute.attrelid = pg_class.oid "
- "AND pg_attribute.attisdropped = false "
- "ORDER BY pg_attribute.attnum");
- if (schema.isEmpty())
- stmt = stmt.arg(QLatin1String("pg_table_is_visible(pg_class.oid) AND"));
- else
- stmt = stmt.arg(QString::fromLatin1("pg_class.relnamespace = (select oid from "
- "pg_namespace where pg_namespace.nspname = '%1') AND ").arg(schema));
- } else {
- qFatal("QPSQLDriver::primaryIndex(tablename): unknown PSQL version, query statement not set");
- }
+ QString stmt = QLatin1String("SELECT pg_attribute.attname, pg_attribute.atttypid::int, "
+ "pg_class.relname "
+ "FROM pg_attribute, pg_class "
+ "WHERE %1 pg_class.oid IN "
+ "(SELECT indexrelid FROM pg_index WHERE indisprimary = true AND indrelid IN "
+ "(SELECT oid FROM pg_class WHERE relname = '%2')) "
+ "AND pg_attribute.attrelid = pg_class.oid "
+ "AND pg_attribute.attisdropped = false "
+ "ORDER BY pg_attribute.attnum");
+ if (schema.isEmpty())
+ stmt = stmt.arg(QLatin1String("pg_table_is_visible(pg_class.oid) AND"));
+ else
+ stmt = stmt.arg(QString::fromLatin1("pg_class.relnamespace = (select oid from "
+ "pg_namespace where pg_namespace.nspname = '%1') AND").arg(schema));
i.exec(stmt.arg(tbl));
while (i.isActive() && i.next()) {
@@ -1170,7 +1138,6 @@ QSqlIndex QPSQLDriver::primaryIndex(const QString& tablename) const
QSqlRecord QPSQLDriver::record(const QString& tablename) const
{
- Q_D(const QPSQLDriver);
QSqlRecord info;
if (!isOpen())
return info;
@@ -1189,105 +1156,44 @@ QSqlRecord QPSQLDriver::record(const QString& tablename) const
else
schema = std::move(schema).toLower();
- QString stmt;
- if (d->pro == QPSQLDriver::Version6) {
- stmt = QLatin1String("select pg_attribute.attname, int(pg_attribute.atttypid), "
- "pg_attribute.attnotnull, pg_attribute.attlen, pg_attribute.atttypmod, "
- "int(pg_attribute.attrelid), pg_attribute.attnum "
- "from pg_class, pg_attribute "
- "where pg_class.relname = '%1' "
- "and pg_attribute.attnum > 0 "
- "and pg_attribute.attrelid = pg_class.oid ");
- } else if (d->pro == QPSQLDriver::Version7) {
- stmt = QLatin1String("select pg_attribute.attname, pg_attribute.atttypid::int, "
- "pg_attribute.attnotnull, pg_attribute.attlen, pg_attribute.atttypmod, "
- "pg_attribute.attrelid::int, pg_attribute.attnum "
- "from pg_class, pg_attribute "
- "where pg_class.relname = '%1' "
- "and pg_attribute.attnum > 0 "
- "and pg_attribute.attrelid = pg_class.oid ");
- } else if (d->pro == QPSQLDriver::Version7_1) {
- stmt = QLatin1String("select pg_attribute.attname, pg_attribute.atttypid::int, "
- "pg_attribute.attnotnull, pg_attribute.attlen, pg_attribute.atttypmod, "
- "pg_attrdef.adsrc "
- "from pg_class, pg_attribute "
- "left join pg_attrdef on (pg_attrdef.adrelid = "
- "pg_attribute.attrelid and pg_attrdef.adnum = pg_attribute.attnum) "
- "where pg_class.relname = '%1' "
- "and pg_attribute.attnum > 0 "
- "and pg_attribute.attrelid = pg_class.oid "
- "order by pg_attribute.attnum ");
- } else if (d->pro >= QPSQLDriver::Version7_3) {
- stmt = QLatin1String("select pg_attribute.attname, pg_attribute.atttypid::int, "
- "pg_attribute.attnotnull, pg_attribute.attlen, pg_attribute.atttypmod, "
- "pg_attrdef.adsrc "
- "from pg_class, pg_attribute "
- "left join pg_attrdef on (pg_attrdef.adrelid = "
- "pg_attribute.attrelid and pg_attrdef.adnum = pg_attribute.attnum) "
- "where %1 "
- "and pg_class.relname = '%2' "
- "and pg_attribute.attnum > 0 "
- "and pg_attribute.attrelid = pg_class.oid "
- "and pg_attribute.attisdropped = false "
- "order by pg_attribute.attnum ");
- if (schema.isEmpty())
- stmt = stmt.arg(QLatin1String("pg_table_is_visible(pg_class.oid)"));
- else
- stmt = stmt.arg(QString::fromLatin1("pg_class.relnamespace = (select oid from "
- "pg_namespace where pg_namespace.nspname = '%1')").arg(schema));
- } else {
- qFatal("QPSQLDriver::record(tablename): unknown PSQL version, query statement not set");
- }
+ QString stmt = QLatin1String("select pg_attribute.attname, pg_attribute.atttypid::int, "
+ "pg_attribute.attnotnull, pg_attribute.attlen, pg_attribute.atttypmod, "
+ "pg_attrdef.adsrc "
+ "from pg_class, pg_attribute "
+ "left join pg_attrdef on (pg_attrdef.adrelid = "
+ "pg_attribute.attrelid and pg_attrdef.adnum = pg_attribute.attnum) "
+ "where %1 "
+ "and pg_class.relname = '%2' "
+ "and pg_attribute.attnum > 0 "
+ "and pg_attribute.attrelid = pg_class.oid "
+ "and pg_attribute.attisdropped = false "
+ "order by pg_attribute.attnum");
+ if (schema.isEmpty())
+ stmt = stmt.arg(QLatin1String("pg_table_is_visible(pg_class.oid)"));
+ else
+ stmt = stmt.arg(QString::fromLatin1("pg_class.relnamespace = (select oid from "
+ "pg_namespace where pg_namespace.nspname = '%1')").arg(schema));
QSqlQuery query(createResult());
query.exec(stmt.arg(tbl));
- if (d->pro >= QPSQLDriver::Version7_1) {
- while (query.next()) {
- int len = query.value(3).toInt();
- int precision = query.value(4).toInt();
- // swap length and precision if length == -1
- if (len == -1 && precision > -1) {
- len = precision - 4;
- precision = -1;
- }
- QString defVal = query.value(5).toString();
- if (!defVal.isEmpty() && defVal.at(0) == QLatin1Char('\''))
- defVal = defVal.mid(1, defVal.length() - 2);
- QSqlField f(query.value(0).toString(), qDecodePSQLType(query.value(1).toInt()), tablename);
- f.setRequired(query.value(2).toBool());
- f.setLength(len);
- f.setPrecision(precision);
- f.setDefaultValue(defVal);
- f.setSqlType(query.value(1).toInt());
- info.append(f);
- }
- } else {
- // Postgres < 7.1 cannot handle outer joins
- while (query.next()) {
- QString defVal;
- QString stmt2 = QLatin1String("select pg_attrdef.adsrc from pg_attrdef where "
- "pg_attrdef.adrelid = %1 and pg_attrdef.adnum = %2 ");
- QSqlQuery query2(createResult());
- query2.exec(stmt2.arg(query.value(5).toInt()).arg(query.value(6).toInt()));
- if (query2.isActive() && query2.next())
- defVal = query2.value(0).toString();
- if (!defVal.isEmpty() && defVal.at(0) == QLatin1Char('\''))
- defVal = defVal.mid(1, defVal.length() - 2);
- int len = query.value(3).toInt();
- int precision = query.value(4).toInt();
- // swap length and precision if length == -1
- if (len == -1 && precision > -1) {
- len = precision - 4;
- precision = -1;
- }
- QSqlField f(query.value(0).toString(), qDecodePSQLType(query.value(1).toInt()), tablename);
- f.setRequired(query.value(2).toBool());
- f.setLength(len);
- f.setPrecision(precision);
- f.setDefaultValue(defVal);
- f.setSqlType(query.value(1).toInt());
- info.append(f);
+ while (query.next()) {
+ int len = query.value(3).toInt();
+ int precision = query.value(4).toInt();
+ // swap length and precision if length == -1
+ if (len == -1 && precision > -1) {
+ len = precision - 4;
+ precision = -1;
}
+ QString defVal = query.value(5).toString();
+ if (!defVal.isEmpty() && defVal.at(0) == QLatin1Char('\''))
+ defVal = defVal.mid(1, defVal.length() - 2);
+ QSqlField f(query.value(0).toString(), qDecodePSQLType(query.value(1).toInt()), tablename);
+ f.setRequired(query.value(2).toBool());
+ f.setLength(len);
+ f.setPrecision(precision);
+ f.setDefaultValue(defVal);
+ f.setSqlType(query.value(1).toInt());
+ info.append(f);
}
return info;
diff --git a/src/plugins/sqldrivers/psql/qsql_psql_p.h b/src/plugins/sqldrivers/psql/qsql_psql_p.h
index f5cb2e9bd0..2873a9f851 100644
--- a/src/plugins/sqldrivers/psql/qsql_psql_p.h
+++ b/src/plugins/sqldrivers/psql/qsql_psql_p.h
@@ -98,34 +98,34 @@ public:
explicit QPSQLDriver(QObject *parent=0);
explicit QPSQLDriver(PGconn *conn, QObject *parent=0);
~QPSQLDriver();
- bool hasFeature(DriverFeature f) const Q_DECL_OVERRIDE;
+ bool hasFeature(DriverFeature f) const override;
bool open(const QString & db,
const QString & user,
const QString & password,
const QString & host,
int port,
- const QString& connOpts) Q_DECL_OVERRIDE;
- bool isOpen() const Q_DECL_OVERRIDE;
- void close() Q_DECL_OVERRIDE;
- QSqlResult *createResult() const Q_DECL_OVERRIDE;
- QStringList tables(QSql::TableType) const Q_DECL_OVERRIDE;
- QSqlIndex primaryIndex(const QString& tablename) const Q_DECL_OVERRIDE;
- QSqlRecord record(const QString& tablename) const Q_DECL_OVERRIDE;
+ const QString& connOpts) override;
+ bool isOpen() const override;
+ void close() override;
+ QSqlResult *createResult() const override;
+ QStringList tables(QSql::TableType) const override;
+ QSqlIndex primaryIndex(const QString& tablename) const override;
+ QSqlRecord record(const QString& tablename) const override;
Protocol protocol() const;
- QVariant handle() const Q_DECL_OVERRIDE;
+ QVariant handle() const override;
- QString escapeIdentifier(const QString &identifier, IdentifierType type) const Q_DECL_OVERRIDE;
- QString formatValue(const QSqlField &field, bool trimStrings) const Q_DECL_OVERRIDE;
+ QString escapeIdentifier(const QString &identifier, IdentifierType type) const override;
+ QString formatValue(const QSqlField &field, bool trimStrings) const override;
- bool subscribeToNotification(const QString &name) Q_DECL_OVERRIDE;
- bool unsubscribeFromNotification(const QString &name) Q_DECL_OVERRIDE;
- QStringList subscribedToNotifications() const Q_DECL_OVERRIDE;
+ bool subscribeToNotification(const QString &name) override;
+ bool unsubscribeFromNotification(const QString &name) override;
+ QStringList subscribedToNotifications() const override;
protected:
- bool beginTransaction() Q_DECL_OVERRIDE;
- bool commitTransaction() Q_DECL_OVERRIDE;
- bool rollbackTransaction() Q_DECL_OVERRIDE;
+ bool beginTransaction() override;
+ bool commitTransaction() override;
+ bool rollbackTransaction() override;
private Q_SLOTS:
void _q_handleNotification(int);
diff --git a/src/plugins/sqldrivers/sqlite/qsql_sqlite.cpp b/src/plugins/sqldrivers/sqlite/qsql_sqlite.cpp
index 67dd1a6ee5..39070c32e8 100644
--- a/src/plugins/sqldrivers/sqlite/qsql_sqlite.cpp
+++ b/src/plugins/sqldrivers/sqlite/qsql_sqlite.cpp
@@ -123,19 +123,19 @@ class QSQLiteResult : public QSqlCachedResult
public:
explicit QSQLiteResult(const QSQLiteDriver* db);
~QSQLiteResult();
- QVariant handle() const Q_DECL_OVERRIDE;
+ QVariant handle() const override;
protected:
- bool gotoNext(QSqlCachedResult::ValueCache& row, int idx) Q_DECL_OVERRIDE;
- bool reset(const QString &query) Q_DECL_OVERRIDE;
- bool prepare(const QString &query) Q_DECL_OVERRIDE;
- bool exec() Q_DECL_OVERRIDE;
- int size() Q_DECL_OVERRIDE;
- int numRowsAffected() Q_DECL_OVERRIDE;
- QVariant lastInsertId() const Q_DECL_OVERRIDE;
- QSqlRecord record() const Q_DECL_OVERRIDE;
- void detachFromResultSet() Q_DECL_OVERRIDE;
- void virtual_hook(int id, void *data) Q_DECL_OVERRIDE;
+ bool gotoNext(QSqlCachedResult::ValueCache& row, int idx) override;
+ bool reset(const QString &query) override;
+ bool prepare(const QString &query) override;
+ bool exec() override;
+ int size() override;
+ int numRowsAffected() override;
+ QVariant lastInsertId() const override;
+ QSqlRecord record() const override;
+ void detachFromResultSet() override;
+ void virtual_hook(int id, void *data) override;
};
class QSQLiteDriverPrivate : public QSqlDriverPrivate
diff --git a/src/plugins/sqldrivers/sqlite/qsql_sqlite_p.h b/src/plugins/sqldrivers/sqlite/qsql_sqlite_p.h
index ca969a4b53..61be4c937f 100644
--- a/src/plugins/sqldrivers/sqlite/qsql_sqlite_p.h
+++ b/src/plugins/sqldrivers/sqlite/qsql_sqlite_p.h
@@ -75,28 +75,28 @@ public:
explicit QSQLiteDriver(QObject *parent = 0);
explicit QSQLiteDriver(sqlite3 *connection, QObject *parent = 0);
~QSQLiteDriver();
- bool hasFeature(DriverFeature f) const Q_DECL_OVERRIDE;
+ bool hasFeature(DriverFeature f) const override;
bool open(const QString & db,
const QString & user,
const QString & password,
const QString & host,
int port,
- const QString & connOpts) Q_DECL_OVERRIDE;
- void close() Q_DECL_OVERRIDE;
- QSqlResult *createResult() const Q_DECL_OVERRIDE;
- bool beginTransaction() Q_DECL_OVERRIDE;
- bool commitTransaction() Q_DECL_OVERRIDE;
- bool rollbackTransaction() Q_DECL_OVERRIDE;
- QStringList tables(QSql::TableType) const Q_DECL_OVERRIDE;
+ const QString & connOpts) override;
+ void close() override;
+ QSqlResult *createResult() const override;
+ bool beginTransaction() override;
+ bool commitTransaction() override;
+ bool rollbackTransaction() override;
+ QStringList tables(QSql::TableType) const override;
- QSqlRecord record(const QString& tablename) const Q_DECL_OVERRIDE;
- QSqlIndex primaryIndex(const QString &table) const Q_DECL_OVERRIDE;
- QVariant handle() const Q_DECL_OVERRIDE;
- QString escapeIdentifier(const QString &identifier, IdentifierType) const Q_DECL_OVERRIDE;
+ QSqlRecord record(const QString& tablename) const override;
+ QSqlIndex primaryIndex(const QString &table) const override;
+ QVariant handle() const override;
+ QString escapeIdentifier(const QString &identifier, IdentifierType) const override;
- bool subscribeToNotification(const QString &name) Q_DECL_OVERRIDE;
- bool unsubscribeFromNotification(const QString &name) Q_DECL_OVERRIDE;
- QStringList subscribedToNotifications() const Q_DECL_OVERRIDE;
+ bool subscribeToNotification(const QString &name) override;
+ bool unsubscribeFromNotification(const QString &name) override;
+ QStringList subscribedToNotifications() const override;
private Q_SLOTS:
void handleNotification(const QString &tableName, qint64 rowid);
};
diff --git a/src/plugins/sqldrivers/sqlite/smain.cpp b/src/plugins/sqldrivers/sqlite/smain.cpp
index 2ad466a61e..092813990c 100644
--- a/src/plugins/sqldrivers/sqlite/smain.cpp
+++ b/src/plugins/sqldrivers/sqlite/smain.cpp
@@ -51,7 +51,7 @@ class QSQLiteDriverPlugin : public QSqlDriverPlugin
public:
QSQLiteDriverPlugin();
- QSqlDriver* create(const QString &) Q_DECL_OVERRIDE;
+ QSqlDriver* create(const QString &) override;
};
QSQLiteDriverPlugin::QSQLiteDriverPlugin()
diff --git a/src/plugins/sqldrivers/sqlite2/qsql_sqlite2.cpp b/src/plugins/sqldrivers/sqlite2/qsql_sqlite2.cpp
index 93f47e3f13..9745c5ebc6 100644
--- a/src/plugins/sqldrivers/sqlite2/qsql_sqlite2.cpp
+++ b/src/plugins/sqldrivers/sqlite2/qsql_sqlite2.cpp
@@ -107,16 +107,16 @@ class QSQLite2Result : public QSqlCachedResult
public:
explicit QSQLite2Result(const QSQLite2Driver* db);
~QSQLite2Result();
- QVariant handle() const Q_DECL_OVERRIDE;
+ QVariant handle() const override;
protected:
- bool gotoNext(QSqlCachedResult::ValueCache &row, int idx) Q_DECL_OVERRIDE;
- bool reset(const QString &query) Q_DECL_OVERRIDE;
- int size() Q_DECL_OVERRIDE;
- int numRowsAffected() Q_DECL_OVERRIDE;
- QSqlRecord record() const Q_DECL_OVERRIDE;
- void detachFromResultSet() Q_DECL_OVERRIDE;
- void virtual_hook(int id, void *data) Q_DECL_OVERRIDE;
+ bool gotoNext(QSqlCachedResult::ValueCache &row, int idx) override;
+ bool reset(const QString &query) override;
+ int size() override;
+ int numRowsAffected() override;
+ QSqlRecord record() const override;
+ void detachFromResultSet() override;
+ void virtual_hook(int id, void *data) override;
};
class QSQLite2ResultPrivate: public QSqlCachedResultPrivate
diff --git a/src/plugins/sqldrivers/sqlite2/qsql_sqlite2_p.h b/src/plugins/sqldrivers/sqlite2/qsql_sqlite2_p.h
index 83b248ec6a..48c64536f1 100644
--- a/src/plugins/sqldrivers/sqlite2/qsql_sqlite2_p.h
+++ b/src/plugins/sqldrivers/sqlite2/qsql_sqlite2_p.h
@@ -79,29 +79,29 @@ public:
explicit QSQLite2Driver(QObject *parent = 0);
explicit QSQLite2Driver(sqlite *connection, QObject *parent = 0);
~QSQLite2Driver();
- bool hasFeature(DriverFeature f) const Q_DECL_OVERRIDE;
+ bool hasFeature(DriverFeature f) const override;
bool open(const QString &db,
const QString &user,
const QString &password,
const QString &host,
int port,
- const QString &connOpts) Q_DECL_OVERRIDE;
+ const QString &connOpts) override;
bool open(const QString &db,
const QString &user,
const QString &password,
const QString &host,
int port) { return open(db, user, password, host, port, QString()); }
- void close() Q_DECL_OVERRIDE;
- QSqlResult *createResult() const Q_DECL_OVERRIDE;
- bool beginTransaction() Q_DECL_OVERRIDE;
- bool commitTransaction() Q_DECL_OVERRIDE;
- bool rollbackTransaction() Q_DECL_OVERRIDE;
- QStringList tables(QSql::TableType) const Q_DECL_OVERRIDE;
+ void close() override;
+ QSqlResult *createResult() const override;
+ bool beginTransaction() override;
+ bool commitTransaction() override;
+ bool rollbackTransaction() override;
+ QStringList tables(QSql::TableType) const override;
- QSqlRecord record(const QString &tablename) const Q_DECL_OVERRIDE;
- QSqlIndex primaryIndex(const QString &table) const Q_DECL_OVERRIDE;
- QVariant handle() const Q_DECL_OVERRIDE;
- QString escapeIdentifier(const QString &identifier, IdentifierType) const Q_DECL_OVERRIDE;
+ QSqlRecord record(const QString &tablename) const override;
+ QSqlIndex primaryIndex(const QString &table) const override;
+ QVariant handle() const override;
+ QString escapeIdentifier(const QString &identifier, IdentifierType) const override;
};
QT_END_NAMESPACE
diff --git a/src/plugins/sqldrivers/tds/qsql_tds.cpp b/src/plugins/sqldrivers/tds/qsql_tds.cpp
index 670198af81..5fc34da407 100644
--- a/src/plugins/sqldrivers/tds/qsql_tds.cpp
+++ b/src/plugins/sqldrivers/tds/qsql_tds.cpp
@@ -163,15 +163,15 @@ class QTDSResult : public QSqlCachedResult
public:
explicit QTDSResult(const QTDSDriver* db);
~QTDSResult();
- QVariant handle() const Q_DECL_OVERRIDE;
+ QVariant handle() const override;
protected:
void cleanup();
- bool reset(const QString &query) Q_DECL_OVERRIDE;
- int size() Q_DECL_OVERRIDE;
- int numRowsAffected() Q_DECL_OVERRIDE;
- bool gotoNext(QSqlCachedResult::ValueCache &values, int index) Q_DECL_OVERRIDE;
- QSqlRecord record() const Q_DECL_OVERRIDE;
+ bool reset(const QString &query) override;
+ int size() override;
+ int numRowsAffected() override;
+ bool gotoNext(QSqlCachedResult::ValueCache &values, int index) override;
+ QSqlRecord record() const override;
};
class QTDSResultPrivate: public QSqlCachedResultPrivate
diff --git a/src/plugins/sqldrivers/tds/qsql_tds_p.h b/src/plugins/sqldrivers/tds/qsql_tds_p.h
index d0914455a2..948e3c7024 100644
--- a/src/plugins/sqldrivers/tds/qsql_tds_p.h
+++ b/src/plugins/sqldrivers/tds/qsql_tds_p.h
@@ -88,29 +88,29 @@ public:
explicit QTDSDriver(QObject* parent = 0);
QTDSDriver(LOGINREC* rec, const QString& host, const QString &db, QObject* parent = 0);
~QTDSDriver();
- bool hasFeature(DriverFeature f) const Q_DECL_OVERRIDE;
+ bool hasFeature(DriverFeature f) const override;
bool open(const QString &db,
const QString &user,
const QString &password,
const QString &host,
int port,
- const QString &connOpts) Q_DECL_OVERRIDE;
- void close() Q_DECL_OVERRIDE;
- QStringList tables(QSql::TableType) const Q_DECL_OVERRIDE;
- QSqlResult *createResult() const Q_DECL_OVERRIDE;
- QSqlRecord record(const QString &tablename) const Q_DECL_OVERRIDE;
- QSqlIndex primaryIndex(const QString &tablename) const Q_DECL_OVERRIDE;
+ const QString &connOpts) override;
+ void close() override;
+ QStringList tables(QSql::TableType) const override;
+ QSqlResult *createResult() const override;
+ QSqlRecord record(const QString &tablename) const override;
+ QSqlIndex primaryIndex(const QString &tablename) const override;
QString formatValue(const QSqlField &field,
- bool trimStrings) const Q_DECL_OVERRIDE;
- QVariant handle() const Q_DECL_OVERRIDE;
+ bool trimStrings) const override;
+ QVariant handle() const override;
- QString escapeIdentifier(const QString &identifier, IdentifierType type) const Q_DECL_OVERRIDE;
+ QString escapeIdentifier(const QString &identifier, IdentifierType type) const override;
protected:
- bool beginTransaction() Q_DECL_OVERRIDE;
- bool commitTransaction() Q_DECL_OVERRIDE;
- bool rollbackTransaction() Q_DECL_OVERRIDE;
+ bool beginTransaction() override;
+ bool commitTransaction() override;
+ bool rollbackTransaction() override;
private:
void init();
};
diff --git a/src/plugins/styles/mac/qmacstyle.qdoc b/src/plugins/styles/mac/qmacstyle.qdoc
index fcbc813844..30b3d7775f 100644
--- a/src/plugins/styles/mac/qmacstyle.qdoc
+++ b/src/plugins/styles/mac/qmacstyle.qdoc
@@ -87,7 +87,7 @@
/*!
- \enum QMacStyle::WidgetSizePolicy
+ \enum QStyleHelper::WidgetSizePolicy
\value SizeSmall
\value SizeLarge
@@ -123,7 +123,7 @@
\reimp
*/
-/*! \fn int QMacStyle::pixelMetric(PixelMetric metric, const QStyleOption *opt, const QWidget *widget) const
+/*! \fn int QMacStyle::pixelMetric(QStyle::PixelMetric metric, const QStyleOption *opt, const QWidget *widget) const
\reimp
*/
@@ -131,7 +131,7 @@
\reimp
*/
-/*! \fn int QMacStyle::styleHint(StyleHint sh, const QStyleOption *opt, const QWidget *w, QStyleHintReturn *hret) const
+/*! \fn int QMacStyle::styleHint(QStyle::StyleHint sh, const QStyleOption *opt, const QWidget *w, QStyleHintReturn *hret) const
\reimp
*/
@@ -139,11 +139,11 @@
\reimp
*/
-/*! \fn QPixmap QMacStyle::standardPixmap(StandardPixmap standardPixmap, const QStyleOption *opt, const QWidget *widget) const
+/*! \fn QPixmap QMacStyle::standardPixmap(QStyle::StandardPixmap standardPixmap, const QStyleOption *opt, const QWidget *widget) const
\reimp
*/
-/*! \fn void QMacStyle::setWidgetSizePolicy(const QWidget *widget, WidgetSizePolicy policy)
+/*! \fn void QStyleHelper::setWidgetSizePolicy(const QWidget *widget, QStyleHelper::WidgetSizePolicy policy)
\obsolete
@@ -151,41 +151,41 @@
or Qt::WA_MacNormalSize instead.
*/
-/*! \fn QMacStyle::WidgetSizePolicy QMacStyle::widgetSizePolicy(const QWidget *widget, const QStyleOption *opt = 0)
+/*! \fn QStyleHelper::WidgetSizePolicy QStyleHelper::widgetSizePolicy(const QWidget *widget, const QStyleOption *opt)
\obsolete
Call QWidget::testAttribute() with Qt::WA_MacMiniSize, Qt::WA_MacSmallSize,
or Qt::WA_MacNormalSize instead.
*/
-/*! \fn void QMacStyle::drawPrimitive(PrimitiveElement pe, const QStyleOption *opt, QPainter *p, const QWidget *w) const
+/*! \fn void QMacStyle::drawPrimitive(QStyle::PrimitiveElement pe, const QStyleOption *opt, QPainter *p, const QWidget *w) const
\reimp
*/
-/*! \fn void QMacStyle::drawControl(ControlElement ce, const QStyleOption *opt, QPainter *p, const QWidget *w) const
+/*! \fn void QMacStyle::drawControl(QStyle::ControlElement ce, const QStyleOption *opt, QPainter *p, const QWidget *w) const
\reimp
*/
-/*! \fn QRect QMacStyle::subElementRect(SubElement sr, const QStyleOption *opt, const QWidget *widget) const
+/*! \fn QRect QMacStyle::subElementRect(QStyle::SubElement sr, const QStyleOption *opt, const QWidget *widget) const
\reimp
*/
-/*! \fn void QMacStyle::drawComplexControl(ComplexControl cc, const QStyleOptionComplex *opt, QPainter *p, const QWidget *widget) const
+/*! \fn void QMacStyle::drawComplexControl(QStyle::ComplexControl cc, const QStyleOptionComplex *opt, QPainter *p, const QWidget *widget) const
\reimp
*/
-/*! \fn QStyle::SubControl QMacStyle::hitTestComplexControl(ComplexControl cc, const QStyleOptionComplex *opt, const QPoint &pt, const QWidget *widget) const
+/*! \fn QStyle::SubControl QMacStyle::hitTestComplexControl(QStyle::ComplexControl cc, const QStyleOptionComplex *opt, const QPoint &pt, const QWidget *widget) const
\reimp
*/
-/*! \fn QRect QMacStyle::subControlRect(ComplexControl cc, const QStyleOptionComplex *opt, SubControl sc, const QWidget *widget) const
+/*! \fn QRect QMacStyle::subControlRect(QStyle::ComplexControl cc, const QStyleOptionComplex *opt, QStyle::SubControl sc, const QWidget *widget) const
\reimp
*/
-/*! \fn QSize QMacStyle::sizeFromContents(ContentsType ct, const QStyleOption *opt, const QSize &csz, const QWidget *widget) const
+/*! \fn QSize QMacStyle::sizeFromContents(QStyle::ContentsType ct, const QStyleOption *opt, const QSize &csz, const QWidget *widget) const
\reimp
*/
@@ -197,7 +197,7 @@
\reimp
*/
-/*! \fn QIcon QMacStyle::standardIcon(StandardPixmap standardIcon, const QStyleOption *opt, const QWidget *widget) const
+/*! \fn QIcon QMacStyle::standardIcon(QStyle::StandardPixmap standardIcon, const QStyleOption *opt, const QWidget *widget) const
\reimp
*/
diff --git a/src/plugins/styles/mac/qmacstyle_mac.mm b/src/plugins/styles/mac/qmacstyle_mac.mm
index db02ab1fe9..aee258fda0 100644
--- a/src/plugins/styles/mac/qmacstyle_mac.mm
+++ b/src/plugins/styles/mac/qmacstyle_mac.mm
@@ -596,8 +596,7 @@ static QString qt_mac_removeMnemonics(const QString &original)
int currPos = 0;
int l = original.length();
while (l) {
- if (original.at(currPos) == QLatin1Char('&')
- && (l == 1 || original.at(currPos + 1) != QLatin1Char('&'))) {
+ if (original.at(currPos) == QLatin1Char('&')) {
++currPos;
--l;
if (l == 0)
@@ -922,7 +921,7 @@ static QSize qt_aqua_get_known_size(QStyle::ContentsType ct, const QWidget *widg
height = qMax(height, qMax(iconSize.height(), pmSize.height()));
}
if (!bt->text().isNull() && bt->toolButtonStyle() != Qt::ToolButtonIconOnly) {
- int text_width = bt->fontMetrics().width(bt->text()),
+ int text_width = bt->fontMetrics().horizontalAdvance(bt->text()),
text_height = bt->fontMetrics().height();
if (bt->toolButtonStyle() == Qt::ToolButtonTextUnderIcon) {
width = qMax(width, text_width);
@@ -5533,10 +5532,10 @@ void QMacStyle::drawComplexControl(ComplexControl cc, const QStyleOptionComplex
QRect br = p->clipRegion().boundingRect();
int x = br.x(),
y = br.y() + (titlebar->rect.height() / 2 - p->fontMetrics().height() / 2);
- if (br.width() <= (p->fontMetrics().width(titlebar->text) + iw * 2))
+ if (br.width() <= (p->fontMetrics().horizontalAdvance(titlebar->text) + iw * 2))
x += iw;
else
- x += br.width() / 2 - p->fontMetrics().width(titlebar->text) / 2;
+ x += br.width() / 2 - p->fontMetrics().horizontalAdvance(titlebar->text) / 2;
if (iw) {
int iconExtent = proxy()->pixelMetric(PM_SmallIconSize);
p->drawPixmap(x - iw, y,
diff --git a/src/plugins/styles/windowsvista/qwindowsxpstyle.cpp b/src/plugins/styles/windowsvista/qwindowsxpstyle.cpp
index 4c982c14f4..0c28a9900d 100644
--- a/src/plugins/styles/windowsvista/qwindowsxpstyle.cpp
+++ b/src/plugins/styles/windowsvista/qwindowsxpstyle.cpp
@@ -760,10 +760,8 @@ static QRegion scaleRegion(const QRegion &region, qreal factor)
{
if (region.isEmpty() || qFuzzyCompare(factor, qreal(1)))
return region;
- if (region.rectCount() == 1)
- return QRegion(scaleRect(QRectF(region.boundingRect()), factor).toRect());
QRegion result;
- foreach (const QRect &rect, region.rects())
+ for (const QRect &rect : region)
result += QRectF(QPointF(rect.topLeft()) * factor, QSizeF(rect.size() * factor)).toRect();
return result;
}
@@ -3963,6 +3961,40 @@ QWindowsXPStyle::QWindowsXPStyle(QWindowsXPStylePrivate &dd) : QWindowsStyle(dd)
{
}
+#ifndef QT_NO_DEBUG_STREAM
+QDebug operator<<(QDebug d, const XPThemeData &t)
+{
+ QDebugStateSaver saver(d);
+ d.nospace();
+ d << "XPThemeData(" << t.widget << ", theme=#" << t.theme << ", " << t.htheme
+ << ", partId=" << t.partId << ", stateId=" << t.stateId << ", rect=" << t.rect
+ << ", mirrorHorizontally=" << t.mirrorHorizontally << ", mirrorVertically="
+ << t.mirrorVertically << ", noBorder=" << t.noBorder << ", noContent=" << t.noContent
+ << ", rotate=" << t.rotate << ')';
+ return d;
+}
+
+QDebug operator<<(QDebug d, const ThemeMapKey &k)
+{
+ QDebugStateSaver saver(d);
+ d.nospace();
+ d << "ThemeMapKey(theme=#" << k.theme
+ << ", partId=" << k.partId << ", stateId=" << k.stateId
+ << ", noBorder=" << k.noBorder << ", noContent=" << k.noContent << ')';
+ return d;
+}
+
+QDebug operator<<(QDebug d, const ThemeMapData &td)
+{
+ QDebugStateSaver saver(d);
+ d.nospace();
+ d << "ThemeMapData(alphaType=" << td.alphaType
+ << ", dataValid=" << td.dataValid << ", partIsTransparent=" << td.partIsTransparent
+ << ", hasAlphaChannel=" << td.hasAlphaChannel << ", wasAlphaSwapped=" << td.wasAlphaSwapped
+ << ", hadInvalidAlpha=" << td.hadInvalidAlpha << ')';
+ return d;
+}
+#endif // QT_NO_DEBUG_STREAM
// Debugging code ---------------------------------------------------------------------[ START ]---
// The code for this point on is not compiled by default, but only used as assisting
diff --git a/src/plugins/styles/windowsvista/qwindowsxpstyle_p_p.h b/src/plugins/styles/windowsvista/qwindowsxpstyle_p_p.h
index 721a734829..4f3fd9c48d 100644
--- a/src/plugins/styles/windowsvista/qwindowsxpstyle_p_p.h
+++ b/src/plugins/styles/windowsvista/qwindowsxpstyle_p_p.h
@@ -64,6 +64,8 @@
QT_BEGIN_NAMESPACE
+class QDebug;
+
// TMT_TEXTSHADOWCOLOR is wrongly defined in mingw
#if TMT_TEXTSHADOWCOLOR != 3818
#undef TMT_TEXTSHADOWCOLOR
@@ -181,6 +183,12 @@ struct ThemeMapData {
hasAlphaChannel(false), wasAlphaSwapped(false), hadInvalidAlpha(false) {}
};
+#ifndef QT_NO_DEBUG_STREAM
+QDebug operator<<(QDebug d, const XPThemeData &t);
+QDebug operator<<(QDebug d, const ThemeMapKey &k);
+QDebug operator<<(QDebug d, const ThemeMapData &td);
+#endif
+
class QWindowsXPStylePrivate : public QWindowsStylePrivate
{
Q_DECLARE_PUBLIC(QWindowsXPStyle)
diff --git a/src/printsupport/dialogs/qpagesetupdialog.h b/src/printsupport/dialogs/qpagesetupdialog.h
index 70517dc844..a7aaa03134 100644
--- a/src/printsupport/dialogs/qpagesetupdialog.h
+++ b/src/printsupport/dialogs/qpagesetupdialog.h
@@ -62,14 +62,14 @@ public:
~QPageSetupDialog();
#if defined(Q_OS_MAC) || defined(Q_OS_WIN)
- void setVisible(bool visible) Q_DECL_OVERRIDE;
+ void setVisible(bool visible) override;
#endif
- int exec() Q_DECL_OVERRIDE;
+ int exec() override;
using QDialog::open;
void open(QObject *receiver, const char *member);
- void done(int result) Q_DECL_OVERRIDE;
+ void done(int result) override;
QPrinter *printer();
};
diff --git a/src/printsupport/dialogs/qpagesetupdialog_unix.cpp b/src/printsupport/dialogs/qpagesetupdialog_unix.cpp
index ee7bc62491..fcf7c8dddc 100644
--- a/src/printsupport/dialogs/qpagesetupdialog_unix.cpp
+++ b/src/printsupport/dialogs/qpagesetupdialog_unix.cpp
@@ -117,7 +117,7 @@ public:
}
protected:
- void paintEvent(QPaintEvent *) Q_DECL_OVERRIDE
+ void paintEvent(QPaintEvent *) override
{
QSize pageSize = m_pageLayout.fullRectPoints().size();
QSizeF scaledSize = pageSize.scaled(width() - 10, height() - 10, Qt::KeepAspectRatio);
@@ -210,7 +210,7 @@ void QUnixPageSetupDialogPrivate::init()
Q_Q(QPageSetupDialog);
widget = new QPageSetupWidget(q);
- widget->setPrinter(printer);
+ widget->setPrinter(printer, nullptr, printer->outputFormat(), printer->printerName());
QDialogButtonBox *buttons = new QDialogButtonBox(QDialogButtonBox::Ok
| QDialogButtonBox::Cancel,
@@ -371,12 +371,17 @@ void QPageSetupWidget::initPageSizes()
// Set the dialog to use the given QPrinter
// Usually only called on first creation
-void QPageSetupWidget::setPrinter(QPrinter *printer)
+void QPageSetupWidget::setPrinter(QPrinter *printer, QPrintDevice *printDevice,
+ QPrinter::OutputFormat outputFormat, const QString &printerName)
{
m_printer = printer;
// Initialize the layout to the current QPrinter layout
m_pageLayout = m_printer->pageLayout();
+
+ if (printDevice)
+ m_pageLayout.setPageSize(printDevice->defaultPageSize());
+
// Assume if margins are Points then is by default, so set to locale default units
if (m_pageLayout.units() == QPageLayout::Point) {
if (QLocale().measurementSystem() == QLocale::MetricSystem)
@@ -387,14 +392,6 @@ void QPageSetupWidget::setPrinter(QPrinter *printer)
m_units = m_pageLayout.units();
m_pagePreview->setPageLayout(m_pageLayout);
- // Then update the widget with the current printer details
- selectPrinter(m_printer->outputFormat(), m_printer->printerName());
-}
-
-// The printer selected in the QPrintDialog has been changed, update the widget to reflect this
-// Note the QPrinter is not updated at this time in case the user presses the Cancel button in QPrintDialog
-void QPageSetupWidget::selectPrinter(QPrinter::OutputFormat outputFormat, const QString &printerName)
-{
m_outputFormat = outputFormat;
m_printerName = printerName;
initPageSizes();
diff --git a/src/printsupport/dialogs/qpagesetupdialog_unix_p.h b/src/printsupport/dialogs/qpagesetupdialog_unix_p.h
index 4322b34690..5b77a73871 100644
--- a/src/printsupport/dialogs/qpagesetupdialog_unix_p.h
+++ b/src/printsupport/dialogs/qpagesetupdialog_unix_p.h
@@ -64,16 +64,16 @@ QT_REQUIRE_CONFIG(printdialog);
QT_BEGIN_NAMESPACE
class QPrinter;
+class QPrintDevice;
class QPagePreview;
class QPageSetupWidget : public QWidget {
Q_OBJECT
public:
explicit QPageSetupWidget(QWidget *parent = nullptr);
- explicit QPageSetupWidget(QPrinter *printer, QWidget *parent = nullptr);
- void setPrinter(QPrinter *printer);
- void selectPrinter(QPrinter::OutputFormat outputFormat, const QString &printerName);
+ void setPrinter(QPrinter *printer, QPrintDevice *printDevice,
+ QPrinter::OutputFormat outputFormat, const QString &printerName);
void setupPrinter() const;
private slots:
diff --git a/src/printsupport/dialogs/qprintdialog.h b/src/printsupport/dialogs/qprintdialog.h
index bbddc296e9..bbb12202f0 100644
--- a/src/printsupport/dialogs/qprintdialog.h
+++ b/src/printsupport/dialogs/qprintdialog.h
@@ -63,11 +63,11 @@ public:
explicit QPrintDialog(QWidget *parent = nullptr);
~QPrintDialog();
- int exec() Q_DECL_OVERRIDE;
+ int exec() override;
#if defined (Q_OS_UNIX) && !defined(Q_OS_MAC)
- virtual void accept() Q_DECL_OVERRIDE;
+ virtual void accept() override;
#endif
- void done(int result) Q_DECL_OVERRIDE;
+ void done(int result) override;
void setOption(PrintDialogOption option, bool on = true);
bool testOption(PrintDialogOption option) const;
@@ -75,7 +75,7 @@ public:
PrintDialogOptions options() const;
#if defined(Q_OS_UNIX) || defined(Q_OS_WIN)
- void setVisible(bool visible) Q_DECL_OVERRIDE;
+ void setVisible(bool visible) override;
#endif
using QDialog::open;
diff --git a/src/printsupport/dialogs/qprintdialog_unix.cpp b/src/printsupport/dialogs/qprintdialog_unix.cpp
index 0b36dec003..63d23cc162 100644
--- a/src/printsupport/dialogs/qprintdialog_unix.cpp
+++ b/src/printsupport/dialogs/qprintdialog_unix.cpp
@@ -49,6 +49,7 @@
#include "qfiledialog.h"
#endif
#include <QtCore/qdir.h>
+#include <QtCore/qtextcodec.h>
#include <QtGui/qevent.h>
#if QT_CONFIG(filesystemmodel)
#include <QtWidgets/qfilesystemmodel.h>
@@ -108,6 +109,11 @@ Print dialog class declarations
allow editing of Page and Advanced tabs.
Layout in qprintpropertieswidget.ui
+
+ QPPDOptionsModel: Holds the PPD Options for the printer.
+
+ QPPDOptionsEditor: Edits the PPD Options for the printer.
+
*/
static void initResources()
@@ -124,22 +130,29 @@ class QPrintPropertiesDialog : public QDialog
{
Q_OBJECT
public:
- QPrintPropertiesDialog(QAbstractPrintDialog *parent = nullptr);
+ QPrintPropertiesDialog(QPrinter *printer, QPrintDevice *currentPrintDevice,
+ QPrinter::OutputFormat outputFormat, const QString &printerName,
+ QAbstractPrintDialog *parent);
~QPrintPropertiesDialog();
- void selectPrinter(QPrinter::OutputFormat outputFormat, const QString &printerName);
-
- /// copy printer properties to the widget
- void applyPrinterProperties(QPrinter *p);
void setupPrinter() const;
+ void showEvent(QShowEvent *event) override;
+
private:
friend class QUnixPrintWidgetPrivate;
+ QPrinter *m_printer;
Ui::QPrintPropertiesWidget widget;
QDialogButtonBox *m_buttons;
#if QT_CONFIG(cupsjobwidget)
QCupsJobWidget *m_jobOptions;
#endif
+
+#if QT_CONFIG(cups)
+ void setCupsOptionsFromItems(QOptionTreeItem *parent) const;
+
+ QPPDOptionsModel *m_cupsOptionsModel;
+#endif
};
class QUnixPrintWidgetPrivate;
@@ -168,8 +181,6 @@ public:
QUnixPrintWidgetPrivate(QUnixPrintWidget *q, QPrinter *prn);
~QUnixPrintWidgetPrivate();
- /// copy printer properties to the widget
- void applyPrinterProperties();
bool checkFields();
void setupPrinter();
void setOptionsPane(QPrintDialogPrivate *pane);
@@ -203,8 +214,6 @@ public:
~QPrintDialogPrivate();
void init();
- /// copy printer properties to the widget
- void applyPrinterProperties();
void selectPrinter(const QPrinter::OutputFormat outputFormat);
@@ -217,7 +226,7 @@ public:
void setupPrinter();
void updateWidgets();
- virtual void setTabs(const QList<QWidget*> &tabs) Q_DECL_OVERRIDE;
+ virtual void setTabs(const QList<QWidget*> &tabs) override;
Ui::QPrintSettingsOutput options;
QUnixPrintWidget *top;
@@ -227,6 +236,78 @@ public:
QPrinter::OutputFormat printerOutputFormat;
};
+#if QT_CONFIG(cups)
+class QOptionTreeItem
+{
+public:
+ enum ItemType { Root, Group, Option, Choice };
+
+ QOptionTreeItem(ItemType t, int i, const void *p, const char *desc, QOptionTreeItem *pi)
+ : type(t),
+ index(i),
+ ptr(p),
+ description(desc),
+ parentItem(pi) {}
+
+ ~QOptionTreeItem() {
+ qDeleteAll(childItems);
+ }
+
+ ItemType type;
+ int index;
+ const void *ptr;
+ const char *description;
+ QOptionTreeItem *parentItem;
+ QList<QOptionTreeItem*> childItems;
+};
+
+class QOptionTreeItemOption : public QOptionTreeItem
+{
+public:
+ QOptionTreeItemOption (int i, const void *p, const char *desc, QOptionTreeItem *pi)
+ : QOptionTreeItem(Option, i, p, desc, pi)
+ {
+ }
+
+ int selected;
+ const char *selDescription;
+};
+
+class QPPDOptionsModel : public QAbstractItemModel
+{
+ Q_OBJECT
+
+public:
+ explicit QPPDOptionsModel(QPrintDevice *currentPrintDevice, QObject *parent);
+
+ int columnCount(const QModelIndex &parent = QModelIndex()) const override;
+ int rowCount(const QModelIndex &parent = QModelIndex()) const override;
+ QVariant data(const QModelIndex &index, int role = Qt::DisplayRole) const override;
+ QModelIndex index(int row, int column, const QModelIndex &parent = QModelIndex()) const override;
+ QModelIndex parent(const QModelIndex &index) const override;
+ Qt::ItemFlags flags(const QModelIndex &index) const override;
+ QVariant headerData(int section, Qt::Orientation orientation, int role = Qt::DisplayRole ) const override;
+
+ QPrintDevice *m_currentPrintDevice;
+ QTextCodec *cupsCodec;
+ QOptionTreeItem *rootItem;
+ void parseGroups(QOptionTreeItem *parent);
+ void parseOptions(QOptionTreeItem *parent);
+ void parseChoices(QOptionTreeItemOption *parent);
+};
+
+class QPPDOptionsEditor : public QStyledItemDelegate
+{
+ Q_OBJECT
+public:
+ explicit QPPDOptionsEditor(QObject *parent) : QStyledItemDelegate(parent) {}
+
+ QWidget *createEditor(QWidget *parent, const QStyleOptionViewItem &option, const QModelIndex &index) const override;
+ void setEditorData(QWidget *editor, const QModelIndex &index) const override;
+ void setModelData(QWidget *editor, QAbstractItemModel *model, const QModelIndex &index) const override;
+};
+
+#endif
////////////////////////////////////////////////////////////////////////////////
////////////////////////////////////////////////////////////////////////////////
@@ -240,8 +321,11 @@ public:
*/
-QPrintPropertiesDialog::QPrintPropertiesDialog(QAbstractPrintDialog *parent)
+QPrintPropertiesDialog::QPrintPropertiesDialog(QPrinter *printer, QPrintDevice *currentPrintDevice,
+ QPrinter::OutputFormat outputFormat, const QString &printerName,
+ QAbstractPrintDialog *parent)
: QDialog(parent)
+ , m_printer(printer)
{
setWindowTitle(tr("Printer Properties"));
QVBoxLayout *lay = new QVBoxLayout(this);
@@ -254,22 +338,38 @@ QPrintPropertiesDialog::QPrintPropertiesDialog(QAbstractPrintDialog *parent)
connect(m_buttons->button(QDialogButtonBox::Ok), &QPushButton::clicked, this, &QPrintPropertiesDialog::accept);
connect(m_buttons->button(QDialogButtonBox::Cancel), &QPushButton::clicked, this, &QPrintPropertiesDialog::reject);
+ widget.pageSetup->setPrinter(printer, currentPrintDevice, outputFormat, printerName);
+
#if QT_CONFIG(cupsjobwidget)
- m_jobOptions = new QCupsJobWidget();
- widget.tabs->addTab(m_jobOptions, tr("Job Options"));
+ m_jobOptions = new QCupsJobWidget(printer, currentPrintDevice);
+ widget.tabs->insertTab(1, m_jobOptions, tr("Job Options"));
#endif
-}
-QPrintPropertiesDialog::~QPrintPropertiesDialog()
-{
+ const int advancedTabIndex = widget.tabs->indexOf(widget.cupsPropertiesPage);
+#if QT_CONFIG(cups)
+ m_cupsOptionsModel = new QPPDOptionsModel(currentPrintDevice, this);
+
+ widget.treeView->setItemDelegate(new QPPDOptionsEditor(this));
+
+ if (m_cupsOptionsModel->rowCount() > 0) {
+ widget.treeView->setModel(m_cupsOptionsModel);
+
+ for (int i = 0; i < m_cupsOptionsModel->rowCount(); ++i)
+ widget.treeView->expand(m_cupsOptionsModel->index(i, 0));
+
+ widget.tabs->setTabEnabled(advancedTabIndex, true);
+ } else {
+ widget.treeView->setModel(nullptr);
+ widget.tabs->setTabEnabled(advancedTabIndex, false);
+ }
+#else
+ Q_UNUSED(currentPrintDevice)
+ widget.tabs->setTabEnabled(advancedTabIndex, false);
+#endif
}
-void QPrintPropertiesDialog::applyPrinterProperties(QPrinter *p)
+QPrintPropertiesDialog::~QPrintPropertiesDialog()
{
- widget.pageSetup->setPrinter(p);
-#if QT_CONFIG(cupsjobwidget)
- m_jobOptions->setPrinter(p);
-#endif
}
void QPrintPropertiesDialog::setupPrinter() const
@@ -278,13 +378,37 @@ void QPrintPropertiesDialog::setupPrinter() const
#if QT_CONFIG(cupsjobwidget)
m_jobOptions->setupPrinter();
#endif
+
+#if QT_CONFIG(cups)
+ setCupsOptionsFromItems(m_cupsOptionsModel->rootItem);
+#endif
}
-void QPrintPropertiesDialog::selectPrinter(QPrinter::OutputFormat outputFormat, const QString &printerName)
+void QPrintPropertiesDialog::showEvent(QShowEvent *event)
{
- widget.pageSetup->selectPrinter(outputFormat, printerName);
+ widget.treeView->resizeColumnToContents(0);
+ QDialog::showEvent(event);
}
+#if QT_CONFIG(cups)
+void QPrintPropertiesDialog::setCupsOptionsFromItems(QOptionTreeItem *parent) const
+{
+ for (QOptionTreeItem *itm : qAsConst(parent->childItems)) {
+ if (itm->type == QOptionTreeItem::Option) {
+ QOptionTreeItemOption *itmOption = static_cast<QOptionTreeItemOption *>(itm);
+ const ppd_option_t *opt = static_cast<const ppd_option_t*>(itm->ptr);
+ if (qstrcmp(opt->defchoice, opt->choices[itmOption->selected].choice) != 0) {
+ QStringList cupsOptions = QCUPSSupport::cupsOptionsList(m_printer);
+ QCUPSSupport::setCupsOption(cupsOptions, QString::fromLatin1(opt->keyword), QString::fromLatin1(opt->choices[itmOption->selected].choice));
+ QCUPSSupport::setCupsOptions(m_printer, cupsOptions);
+ }
+ } else {
+ setCupsOptionsFromItems(itm);
+ }
+ }
+}
+#endif
+
////////////////////////////////////////////////////////////////////////////////
////////////////////////////////////////////////////////////////////////////////
@@ -390,12 +514,6 @@ void QPrintDialogPrivate::selectPrinter(const QPrinter::OutputFormat outputForma
options.pageSetCombo->setEnabled(true);
}
-void QPrintDialogPrivate::applyPrinterProperties()
-{
- // apply printer options to property dialog
- top->d->applyPrinterProperties();
-}
-
void QPrintDialogPrivate::setupPrinter()
{
// First setup the requested OutputFormat, Printer and Page Size first
@@ -800,48 +918,6 @@ void QUnixPrintWidgetPrivate::_q_btnBrowseClicked()
}
}
-void QUnixPrintWidgetPrivate::applyPrinterProperties()
-{
- if (printer == nullptr)
- return;
- if (printer->outputFileName().isEmpty()) {
- QString home = QDir::homePath();
- QString cur = QDir::currentPath();
- if (home.at(home.length()-1) != QLatin1Char('/'))
- home += QLatin1Char('/');
- if (!cur.isEmpty() && cur.at(cur.length()-1) != QLatin1Char('/'))
- cur += QLatin1Char('/');
- if (!cur.startsWith(home))
- cur = home;
- if (QGuiApplication::platformName() == QLatin1String("xcb")) {
- if (printer->docName().isEmpty()) {
- cur += QLatin1String("print.pdf");
- } else {
- QRegExp re(QString::fromLatin1("(.*)\\.\\S+"));
- if (re.exactMatch(printer->docName()))
- cur += re.cap(1);
- else
- cur += printer->docName();
- cur += QLatin1String(".pdf");
- }
- } // xcb
-
- widget.filename->setText(cur);
- }
- else
- widget.filename->setText( printer->outputFileName() );
- QString printerName = printer->printerName();
- if (!printerName.isEmpty()) {
- const int i = widget.printers->findText(printerName);
- if (i >= 0)
- widget.printers->setCurrentIndex(i);
- }
- // PDF printer not added to the dialog yet, we'll handle those cases in QUnixPrintWidgetPrivate::updateWidget
-
- if (propertiesDialog)
- propertiesDialog->applyPrinterProperties(printer);
-}
-
#if QT_CONFIG(messagebox)
bool QUnixPrintWidgetPrivate::checkFields()
{
@@ -899,18 +975,20 @@ void QUnixPrintWidgetPrivate::setupPrinterProperties()
{
delete propertiesDialog;
- propertiesDialog = new QPrintPropertiesDialog(q);
- propertiesDialog->setResult(QDialog::Rejected);
- propertiesDialogShown = false;
-
- propertiesDialog->applyPrinterProperties(q->printer());
+ QPrinter::OutputFormat outputFormat;
+ QString printerName;
if (q->isOptionEnabled(QPrintDialog::PrintToFile)
&& (widget.printers->currentIndex() == widget.printers->count() - 1)) {// PDF
- propertiesDialog->selectPrinter(QPrinter::PdfFormat, QString());
+ outputFormat = QPrinter::PdfFormat;
+ } else {
+ outputFormat = QPrinter::NativeFormat;
+ printerName = widget.printers->currentText();
}
- else
- propertiesDialog->selectPrinter(QPrinter::NativeFormat, widget.printers->currentText());
+
+ propertiesDialog = new QPrintPropertiesDialog(q->printer(), &m_currentPrintDevice, outputFormat, printerName, q);
+ propertiesDialog->setResult(QDialog::Rejected);
+ propertiesDialogShown = false;
}
void QUnixPrintWidgetPrivate::_q_btnPropertiesClicked()
@@ -960,7 +1038,41 @@ void QUnixPrintWidgetPrivate::setupPrinter()
QUnixPrintWidget::QUnixPrintWidget(QPrinter *printer, QWidget *parent)
: QWidget(parent), d(new QUnixPrintWidgetPrivate(this, printer))
{
- d->applyPrinterProperties();
+ if (printer == nullptr)
+ return;
+ if (printer->outputFileName().isEmpty()) {
+ QString home = QDir::homePath();
+ QString cur = QDir::currentPath();
+ if (!home.endsWith(QLatin1Char('/')))
+ home += QLatin1Char('/');
+ if (!cur.startsWith(home))
+ cur = home;
+ else if (!cur.endsWith(QLatin1Char('/')))
+ cur += QLatin1Char('/');
+ if (QGuiApplication::platformName() == QStringLiteral("xcb")) {
+ if (printer->docName().isEmpty()) {
+ cur += QStringLiteral("print.pdf");
+ } else {
+ const QRegExp re(QStringLiteral("(.*)\\.\\S+"));
+ if (re.exactMatch(printer->docName()))
+ cur += re.cap(1);
+ else
+ cur += printer->docName();
+ cur += QStringLiteral(".pdf");
+ }
+ } // xcb
+
+ d->widget.filename->setText(cur);
+ }
+ else
+ d->widget.filename->setText(printer->outputFileName());
+ const QString printerName = printer->printerName();
+ if (!printerName.isEmpty()) {
+ const int i = d->widget.printers->findText(printerName);
+ if (i >= 0)
+ d->widget.printers->setCurrentIndex(i);
+ }
+ // PDF printer not added to the dialog yet, we'll handle those cases in QUnixPrintWidgetPrivate::updateWidget
}
/*! \internal
@@ -982,6 +1094,267 @@ void QUnixPrintWidget::updatePrinter()
////////////////////////////////////////////////////////////////////////////////
////////////////////////////////////////////////////////////////////////////////
+/*
+
+ QPPDOptionsModel
+
+ Holds the PPD Options for the printer.
+
+*/
+
+#if QT_CONFIG(cups)
+
+QPPDOptionsModel::QPPDOptionsModel(QPrintDevice *currentPrintDevice, QObject *parent)
+ : QAbstractItemModel(parent)
+ , m_currentPrintDevice(currentPrintDevice)
+{
+ ppd_file_t *ppd = m_currentPrintDevice->property(PDPK_PpdFile).value<ppd_file_t*>();
+ rootItem = new QOptionTreeItem(QOptionTreeItem::Root, 0, ppd, "Root Item", 0);
+
+ if (ppd) {
+ cupsCodec = QTextCodec::codecForName(ppd->lang_encoding);
+ for (int i = 0; i < ppd->num_groups; ++i) {
+ QOptionTreeItem *group = new QOptionTreeItem(QOptionTreeItem::Group, i, &ppd->groups[i], ppd->groups[i].text, rootItem);
+ rootItem->childItems.append(group);
+ parseGroups(group); // parse possible subgroups
+ parseOptions(group); // parse options
+ }
+ }
+
+ if (!cupsCodec)
+ cupsCodec = QTextCodec::codecForLocale();
+}
+
+int QPPDOptionsModel::columnCount(const QModelIndex &) const
+{
+ return 2;
+}
+
+int QPPDOptionsModel::rowCount(const QModelIndex &parent) const
+{
+ QOptionTreeItem *itm;
+ if (!parent.isValid())
+ itm = rootItem;
+ else
+ itm = static_cast<QOptionTreeItem*>(parent.internalPointer());
+
+ if (itm->type == QOptionTreeItem::Option)
+ return 0;
+
+ return itm->childItems.count();
+}
+
+QVariant QPPDOptionsModel::data(const QModelIndex &index, int role) const
+{
+ if (!index.isValid())
+ return QVariant();
+
+ QOptionTreeItem *itm = static_cast<QOptionTreeItem*>(index.internalPointer());
+
+ switch (role) {
+ case Qt::FontRole: {
+ if (itm->type == QOptionTreeItem::Group){
+ QFont font;
+ font.setBold(true);
+ return QVariant(font);
+ }
+ return QVariant();
+ }
+ break;
+
+ case Qt::DisplayRole: {
+ if (index.column() == 0) {
+ return cupsCodec->toUnicode(itm->description);
+ } else if (itm->type == QOptionTreeItem::Option) {
+ QOptionTreeItemOption *itmOption = static_cast<QOptionTreeItemOption *>(itm);
+ if (itmOption->selected > -1)
+ return cupsCodec->toUnicode(itmOption->selDescription);
+ }
+
+ return QVariant();
+ }
+ break;
+
+ }
+
+ return QVariant();
+}
+
+QModelIndex QPPDOptionsModel::index(int row, int column, const QModelIndex &parent) const
+{
+ QOptionTreeItem *itm;
+ if (!parent.isValid())
+ itm = rootItem;
+ else
+ itm = static_cast<QOptionTreeItem*>(parent.internalPointer());
+
+ return createIndex(row, column, itm->childItems.at(row));
+}
+
+
+QModelIndex QPPDOptionsModel::parent(const QModelIndex &index) const
+{
+ if (!index.isValid())
+ return QModelIndex();
+
+ QOptionTreeItem *itm = static_cast<QOptionTreeItem*>(index.internalPointer());
+
+ if (itm->parentItem && itm->parentItem != rootItem)
+ return createIndex(itm->parentItem->index, 0, itm->parentItem);
+
+ return QModelIndex();
+}
+
+Qt::ItemFlags QPPDOptionsModel::flags(const QModelIndex &index) const
+{
+ if (!index.isValid() || static_cast<QOptionTreeItem*>(index.internalPointer())->type == QOptionTreeItem::Group)
+ return Qt::ItemIsEnabled;
+
+ if (index.column() == 1)
+ return Qt::ItemIsEnabled | Qt::ItemIsSelectable | Qt::ItemIsEditable;
+
+ return Qt::ItemIsEnabled | Qt::ItemIsSelectable;
+}
+
+void QPPDOptionsModel::parseGroups(QOptionTreeItem *parent)
+{
+ const ppd_group_t *group = static_cast<const ppd_group_t*>(parent->ptr);
+
+ if (group) {
+ for (int i = 0; i < group->num_subgroups; ++i) {
+ QOptionTreeItem *subgroup = new QOptionTreeItem(QOptionTreeItem::Group, i, &group->subgroups[i], group->subgroups[i].text, parent);
+ parent->childItems.append(subgroup);
+ parseGroups(subgroup); // parse possible subgroups
+ parseOptions(subgroup); // parse options
+ }
+ }
+}
+
+static bool isBlacklistedOption(const char *keyword) Q_DECL_NOTHROW
+{
+ // We already let the user set these options elsewhere
+ const char *cupsOptionBlacklist[] = {
+ "Collate",
+ "Copies",
+ "OutputOrder",
+ "PageRegion",
+ "PageSize"
+ };
+ auto equals = [](const char *keyword) {
+ return [keyword](const char *candidate) {
+ return qstrcmp(keyword, candidate) == 0;
+ };
+ };
+ return std::any_of(std::begin(cupsOptionBlacklist), std::end(cupsOptionBlacklist), equals(keyword));
+};
+
+void QPPDOptionsModel::parseOptions(QOptionTreeItem *parent)
+{
+ const ppd_group_t *group = static_cast<const ppd_group_t*>(parent->ptr);
+ for (int i = 0; i < group->num_options; ++i) {
+ if (!isBlacklistedOption(group->options[i].keyword)) {
+ QOptionTreeItemOption *opt = new QOptionTreeItemOption(i, &group->options[i], group->options[i].text, parent);
+ parent->childItems.append(opt);
+ parseChoices(opt);
+ }
+ }
+}
+
+void QPPDOptionsModel::parseChoices(QOptionTreeItemOption *parent)
+{
+ const ppd_option_t *option = static_cast<const ppd_option_t*>(parent->ptr);
+ bool marked = false;
+ for (int i = 0; i < option->num_choices; ++i) {
+ QOptionTreeItem *choice = new QOptionTreeItem(QOptionTreeItem::Choice, i, &option->choices[i], option->choices[i].text, parent);
+ if (static_cast<int>(option->choices[i].marked) == 1) {
+ parent->selected = i;
+ parent->selDescription = option->choices[i].text;
+ marked = true;
+ } else if (!marked && qstrcmp(option->choices[i].choice, option->defchoice) == 0) {
+ parent->selected = i;
+ parent->selDescription = option->choices[i].text;
+ }
+ parent->childItems.append(choice);
+ }
+}
+
+QVariant QPPDOptionsModel::headerData(int section, Qt::Orientation, int role) const
+{
+ if (role != Qt::DisplayRole)
+ return QVariant();
+
+ switch (section) {
+ case 0:
+ return QVariant(tr("Name"));
+ case 1:
+ return QVariant(tr("Value"));
+ }
+
+ return QVariant();
+}
+
+////////////////////////////////////////////////////////////////////////////////
+////////////////////////////////////////////////////////////////////////////////
+
+/*
+
+ QPPDOptionsEditor
+
+ Edits the PPD Options for the printer.
+
+*/
+
+QWidget *QPPDOptionsEditor::createEditor(QWidget *parent, const QStyleOptionViewItem &option, const QModelIndex &index) const
+{
+ Q_UNUSED(option)
+
+ if (index.column() == 1 && static_cast<QOptionTreeItem*>(index.internalPointer())->type == QOptionTreeItem::Option)
+ return new QComboBox(parent);
+
+ return nullptr;
+}
+
+void QPPDOptionsEditor::setEditorData(QWidget *editor, const QModelIndex &index) const
+{
+ if (index.column() != 1)
+ return;
+
+ QComboBox *cb = static_cast<QComboBox*>(editor);
+ QOptionTreeItemOption *itm = static_cast<QOptionTreeItemOption*>(index.internalPointer());
+
+ if (itm->selected == -1)
+ cb->addItem(QString());
+
+ const QPPDOptionsModel *m = static_cast<const QPPDOptionsModel*>(index.model());
+ for (auto *childItem : qAsConst(itm->childItems))
+ cb->addItem(m->cupsCodec->toUnicode(childItem->description));
+
+ if (itm->selected > -1)
+ cb->setCurrentIndex(itm->selected);
+}
+
+void QPPDOptionsEditor::setModelData(QWidget *editor, QAbstractItemModel *model, const QModelIndex &index) const
+{
+ QComboBox *cb = static_cast<QComboBox*>(editor);
+ QOptionTreeItemOption *itm = static_cast<QOptionTreeItemOption*>(index.internalPointer());
+
+ if (itm->selected == cb->currentIndex())
+ return;
+
+ const ppd_option_t *opt = static_cast<const ppd_option_t*>(itm->ptr);
+ QPPDOptionsModel *m = static_cast<QPPDOptionsModel*>(model);
+
+ const auto values = QStringList{} << QString::fromLatin1(opt->keyword) << QString::fromLatin1(opt->choices[cb->currentIndex()].choice);
+ if (m->m_currentPrintDevice->setProperty(PDPK_PpdOption, values)) {
+ itm->selected = cb->currentIndex();
+ itm->selDescription = static_cast<const ppd_option_t*>(itm->ptr)->choices[itm->selected].text;
+ }
+}
+
+////////////////////////////////////////////////////////////////////////////////
+////////////////////////////////////////////////////////////////////////////////
+
+#endif // QT_CONFIG(cups)
#endif // defined (Q_OS_UNIX)
QT_END_NAMESPACE
diff --git a/src/printsupport/dialogs/qprintpreviewdialog.cpp b/src/printsupport/dialogs/qprintpreviewdialog.cpp
index 906cb19043..a4f721fbc8 100644
--- a/src/printsupport/dialogs/qprintpreviewdialog.cpp
+++ b/src/printsupport/dialogs/qprintpreviewdialog.cpp
@@ -79,7 +79,7 @@ class QPrintPreviewMainWindow : public QMainWindow
{
public:
QPrintPreviewMainWindow(QWidget *parent) : QMainWindow(parent) {}
- QMenu *createPopupMenu() Q_DECL_OVERRIDE { return nullptr; }
+ QMenu *createPopupMenu() override { return nullptr; }
};
class ZoomFactorValidator : public QDoubleValidator
@@ -90,7 +90,7 @@ public:
ZoomFactorValidator(qreal bottom, qreal top, int decimals, QObject *parent)
: QDoubleValidator(bottom, top, decimals, parent) {}
- State validate(QString &input, int &pos) const Q_DECL_OVERRIDE
+ State validate(QString &input, int &pos) const override
{
bool replacePercent = false;
if (input.endsWith(QLatin1Char('%'))) {
@@ -123,13 +123,13 @@ public:
}
protected:
- void focusInEvent(QFocusEvent *e) Q_DECL_OVERRIDE
+ void focusInEvent(QFocusEvent *e) override
{
origText = text();
QLineEdit::focusInEvent(e);
}
- void focusOutEvent(QFocusEvent *e) Q_DECL_OVERRIDE
+ void focusOutEvent(QFocusEvent *e) override
{
if (isModified() && !hasAcceptableInput())
setText(origText);
@@ -484,7 +484,7 @@ void QPrintPreviewDialogPrivate::updatePageNumLabel()
int numPages = preview->pageCount();
int maxChars = QString::number(numPages).length();
pageNumLabel->setText(QString::fromLatin1("/ %1").arg(numPages));
- int cyphersWidth = q->fontMetrics().width(QString().fill(QLatin1Char('8'), maxChars));
+ int cyphersWidth = q->fontMetrics().horizontalAdvance(QString().fill(QLatin1Char('8'), maxChars));
int maxWidth = pageNumEdit->minimumSizeHint().width() + cyphersWidth;
pageNumEdit->setMinimumWidth(maxWidth);
pageNumEdit->setMaximumWidth(maxWidth);
diff --git a/src/printsupport/dialogs/qprintpreviewdialog.h b/src/printsupport/dialogs/qprintpreviewdialog.h
index bacafcb734..53fede7e83 100644
--- a/src/printsupport/dialogs/qprintpreviewdialog.h
+++ b/src/printsupport/dialogs/qprintpreviewdialog.h
@@ -68,8 +68,8 @@ public:
QPrinter *printer();
- void setVisible(bool visible) Q_DECL_OVERRIDE;
- void done(int result) Q_DECL_OVERRIDE;
+ void setVisible(bool visible) override;
+ void done(int result) override;
Q_SIGNALS:
void paintRequested(QPrinter *printer);
diff --git a/src/printsupport/dialogs/qprintpropertieswidget.ui b/src/printsupport/dialogs/qprintpropertieswidget.ui
index 66d7b80fcd..0e56fb33df 100644
--- a/src/printsupport/dialogs/qprintpropertieswidget.ui
+++ b/src/printsupport/dialogs/qprintpropertieswidget.ui
@@ -32,6 +32,20 @@
</item>
</layout>
</widget>
+ <widget class="QWidget" name="cupsPropertiesPage" >
+ <attribute name="title" >
+ <string>Advanced</string>
+ </attribute>
+ <layout class="QHBoxLayout" name="horizontalLayout_2" >
+ <item>
+ <widget class="QTreeView" name="treeView" >
+ <property name="alternatingRowColors" >
+ <bool>true</bool>
+ </property>
+ </widget>
+ </item>
+ </layout>
+ </widget>
</widget>
</item>
</layout>
diff --git a/src/printsupport/kernel/qcups.cpp b/src/printsupport/kernel/qcups.cpp
index b9e162abe9..50c6953718 100644
--- a/src/printsupport/kernel/qcups.cpp
+++ b/src/printsupport/kernel/qcups.cpp
@@ -107,6 +107,37 @@ static inline QString jobHoldToString(const QCUPSSupport::JobHoldUntil jobHold,
return QString();
}
+QCUPSSupport::JobHoldUntilWithTime QCUPSSupport::parseJobHoldUntil(const QString &jobHoldUntil)
+{
+ if (jobHoldUntil == QLatin1String("indefinite")) {
+ return { QCUPSSupport::Indefinite, QTime() };
+ } else if (jobHoldUntil == QLatin1String("day-time")) {
+ return { QCUPSSupport::DayTime, QTime() };
+ } else if (jobHoldUntil == QLatin1String("night")) {
+ return { QCUPSSupport::Night, QTime() };
+ } else if (jobHoldUntil == QLatin1String("second-shift")) {
+ return { QCUPSSupport::SecondShift, QTime() };
+ } else if (jobHoldUntil == QLatin1String("third-shift")) {
+ return { QCUPSSupport::ThirdShift, QTime() };
+ } else if (jobHoldUntil == QLatin1String("weekend")) {
+ return { QCUPSSupport::Weekend, QTime() };
+ }
+
+
+ QTime parsedTime = QTime::fromString(jobHoldUntil, QStringLiteral("h:m:s"));
+ if (!parsedTime.isValid())
+ parsedTime = QTime::fromString(jobHoldUntil, QStringLiteral("h:m"));
+ if (parsedTime.isValid()) {
+ // CUPS time is in UTC, user expects local time, so get the equivalent
+ QDateTime dateTimeUtc = QDateTime::currentDateTimeUtc();
+ dateTimeUtc.setTime(parsedTime);
+ return { QCUPSSupport::SpecificTime, dateTimeUtc.toLocalTime().time() };
+ }
+
+ return { QCUPSSupport::NoHold, QTime() };
+}
+
+
void QCUPSSupport::setJobHold(QPrinter *printer, const JobHoldUntil jobHold, const QTime &holdUntilTime)
{
QStringList cupsOptions = cupsOptionsList(printer);
@@ -150,6 +181,32 @@ static inline QString bannerPageToString(const QCUPSSupport::BannerPage bannerPa
return QString();
}
+static inline QCUPSSupport::BannerPage stringToBannerPage(const QString &bannerPage)
+{
+ if (bannerPage == QLatin1String("none")) return QCUPSSupport::NoBanner;
+ else if (bannerPage == QLatin1String("standard")) return QCUPSSupport::Standard;
+ else if (bannerPage == QLatin1String("unclassified")) return QCUPSSupport::Unclassified;
+ else if (bannerPage == QLatin1String("confidential")) return QCUPSSupport::Confidential;
+ else if (bannerPage == QLatin1String("classified")) return QCUPSSupport::Classified;
+ else if (bannerPage == QLatin1String("secret")) return QCUPSSupport::Secret;
+ else if (bannerPage == QLatin1String("topsecret")) return QCUPSSupport::TopSecret;
+
+ return QCUPSSupport::NoBanner;
+}
+
+QCUPSSupport::JobSheets QCUPSSupport::parseJobSheets(const QString &jobSheets)
+{
+ JobSheets result;
+
+ const QStringList parts = jobSheets.split(QLatin1Char(','));
+ if (parts.count() == 2) {
+ result.startBannerPage = stringToBannerPage(parts[0]);
+ result.endBannerPage = stringToBannerPage(parts[1]);
+ }
+
+ return result;
+}
+
void QCUPSSupport::setBannerPages(QPrinter *printer, const BannerPage startBannerPage, const BannerPage endBannerPage)
{
QStringList cupsOptions = cupsOptionsList(printer);
diff --git a/src/printsupport/kernel/qcups_p.h b/src/printsupport/kernel/qcups_p.h
index 780115e350..afddfdbf22 100644
--- a/src/printsupport/kernel/qcups_p.h
+++ b/src/printsupport/kernel/qcups_p.h
@@ -67,6 +67,13 @@ QT_BEGIN_NAMESPACE
// removed from the dialogs.
#define PPK_CupsOptions QPrintEngine::PrintEnginePropertyKey(0xfe00)
+#define PDPK_PpdFile QPrintDevice::PrintDevicePropertyKey(QPrintDevice::PDPK_CustomBase)
+#define PDPK_PpdOption QPrintDevice::PrintDevicePropertyKey(QPrintDevice::PDPK_CustomBase + 1)
+#define PDPK_CupsJobPriority QPrintDevice::PrintDevicePropertyKey(QPrintDevice::PDPK_CustomBase + 2)
+#define PDPK_CupsJobSheets QPrintDevice::PrintDevicePropertyKey(QPrintDevice::PDPK_CustomBase + 3)
+#define PDPK_CupsJobBilling QPrintDevice::PrintDevicePropertyKey(QPrintDevice::PDPK_CustomBase + 4)
+#define PDPK_CupsJobHoldUntil QPrintDevice::PrintDevicePropertyKey(QPrintDevice::PDPK_CustomBase + 5)
+
class Q_PRINTSUPPORT_EXPORT QCUPSSupport
{
public:
@@ -135,6 +142,20 @@ public:
static void setPagesPerSheetLayout(QPrinter *printer, const PagesPerSheet pagesPerSheet,
const PagesPerSheetLayout pagesPerSheetLayout);
static void setPageRange(QPrinter *printer, int pageFrom, int pageTo);
+
+ struct JobSheets
+ {
+ BannerPage startBannerPage = QCUPSSupport::NoBanner;
+ BannerPage endBannerPage = QCUPSSupport::NoBanner;
+ };
+ static JobSheets parseJobSheets(const QString &jobSheets);
+
+ struct JobHoldUntilWithTime
+ {
+ JobHoldUntil jobHold;
+ QTime time;
+ };
+ static JobHoldUntilWithTime parseJobHoldUntil(const QString &jobHoldUntil);
};
Q_DECLARE_TYPEINFO(QCUPSSupport::JobHoldUntil, Q_PRIMITIVE_TYPE);
Q_DECLARE_TYPEINFO(QCUPSSupport::BannerPage, Q_PRIMITIVE_TYPE);
diff --git a/src/printsupport/kernel/qpaintengine_alpha.cpp b/src/printsupport/kernel/qpaintengine_alpha.cpp
index cae5c2f522..410051df2a 100644
--- a/src/printsupport/kernel/qpaintengine_alpha.cpp
+++ b/src/printsupport/kernel/qpaintengine_alpha.cpp
@@ -306,15 +306,12 @@ void QAlphaPaintEngine::flushAndInit(bool init)
d->m_alphargn = d->m_alphargn.intersected(QRect(0, 0, d->m_pdev->width(), d->m_pdev->height()));
// just use the bounding rect if it's a complex region..
- QVector<QRect> rects = d->m_alphargn.rects();
- if (rects.size() > 10) {
+ if (d->m_alphargn.rectCount() > 10) {
QRect br = d->m_alphargn.boundingRect();
d->m_alphargn = QRegion(br);
- rects.clear();
- rects.append(br);
}
- d->m_cliprgn = d->m_alphargn;
+ const auto oldAlphaRegion = d->m_cliprgn = d->m_alphargn;
// now replay the QPicture
++d->m_pass; // we are now doing pass #2
@@ -336,7 +333,7 @@ void QAlphaPaintEngine::flushAndInit(bool init)
d->resetState(painter());
// fill in the alpha images
- for (const auto &rect : qAsConst(rects))
+ for (const auto &rect : oldAlphaRegion)
d->drawAlphaImage(rect);
d->m_alphargn = QRegion();
diff --git a/src/printsupport/kernel/qplatformprintdevice.cpp b/src/printsupport/kernel/qplatformprintdevice.cpp
index e2d4a08de3..2f76156a91 100644
--- a/src/printsupport/kernel/qplatformprintdevice.cpp
+++ b/src/printsupport/kernel/qplatformprintdevice.cpp
@@ -167,7 +167,7 @@ QList<QPageSize> QPlatformPrintDevice::supportedPageSizes() const
{
if (!m_havePageSizes)
loadPageSizes();
- return m_pageSizes.toList();
+ return m_pageSizes;
}
QPageSize QPlatformPrintDevice::supportedPageSize(const QPageSize &pageSize) const
@@ -293,7 +293,7 @@ QList<int> QPlatformPrintDevice::supportedResolutions() const
{
if (!m_haveResolutions)
loadResolutions();
- return m_resolutions.toList();
+ return m_resolutions;
}
void QPlatformPrintDevice::loadInputSlots() const
@@ -313,11 +313,11 @@ QPrint::InputSlot QPlatformPrintDevice::defaultInputSlot() const
return input;
}
-QList<QPrint::InputSlot> QPlatformPrintDevice::supportedInputSlots() const
+QVector<QPrint::InputSlot> QPlatformPrintDevice::supportedInputSlots() const
{
if (!m_haveInputSlots)
loadInputSlots();
- return m_inputSlots.toList();
+ return m_inputSlots;
}
void QPlatformPrintDevice::loadOutputBins() const
@@ -337,11 +337,11 @@ QPrint::OutputBin QPlatformPrintDevice::defaultOutputBin() const
return output;
}
-QList<QPrint::OutputBin> QPlatformPrintDevice::supportedOutputBins() const
+QVector<QPrint::OutputBin> QPlatformPrintDevice::supportedOutputBins() const
{
if (!m_haveOutputBins)
loadOutputBins();
- return m_outputBins.toList();
+ return m_outputBins;
}
void QPlatformPrintDevice::loadDuplexModes() const
@@ -353,11 +353,11 @@ QPrint::DuplexMode QPlatformPrintDevice::defaultDuplexMode() const
return QPrint::DuplexNone;
}
-QList<QPrint::DuplexMode> QPlatformPrintDevice::supportedDuplexModes() const
+QVector<QPrint::DuplexMode> QPlatformPrintDevice::supportedDuplexModes() const
{
if (!m_haveDuplexModes)
loadDuplexModes();
- return m_duplexModes.toList();
+ return m_duplexModes;
}
void QPlatformPrintDevice::loadColorModes() const
@@ -369,11 +369,11 @@ QPrint::ColorMode QPlatformPrintDevice::defaultColorMode() const
return QPrint::GrayScale;
}
-QList<QPrint::ColorMode> QPlatformPrintDevice::supportedColorModes() const
+QVector<QPrint::ColorMode> QPlatformPrintDevice::supportedColorModes() const
{
if (!m_haveColorModes)
loadColorModes();
- return m_colorModes.toList();
+ return m_colorModes;
}
#ifndef QT_NO_MIMETYPE
@@ -381,11 +381,26 @@ void QPlatformPrintDevice::loadMimeTypes() const
{
}
+QVariant QPlatformPrintDevice::property(QPrintDevice::PrintDevicePropertyKey key) const
+{
+ Q_UNUSED(key)
+
+ return QVariant();
+}
+
+bool QPlatformPrintDevice::setProperty(QPrintDevice::PrintDevicePropertyKey key, const QVariant &value)
+{
+ Q_UNUSED(key)
+ Q_UNUSED(value)
+
+ return false;
+}
+
QList<QMimeType> QPlatformPrintDevice::supportedMimeTypes() const
{
if (!m_haveMimeTypes)
loadMimeTypes();
- return m_mimeTypes.toList();
+ return m_mimeTypes;
}
#endif // QT_NO_MIMETYPE
diff --git a/src/printsupport/kernel/qplatformprintdevice.h b/src/printsupport/kernel/qplatformprintdevice.h
index 44a3a966f4..8af76464b5 100644
--- a/src/printsupport/kernel/qplatformprintdevice.h
+++ b/src/printsupport/kernel/qplatformprintdevice.h
@@ -53,11 +53,14 @@
#include <QtPrintSupport/qtprintsupportglobal.h>
#include <private/qprint_p.h>
+#include <private/qprintdevice_p.h>
+#include <QtCore/qvariant.h>
#include <QtCore/qvector.h>
#include <QtCore/qmimetype.h>
#include <QtGui/qpagelayout.h>
+
QT_BEGIN_NAMESPACE
#ifndef QT_NO_PRINTER
@@ -107,16 +110,19 @@ public:
virtual QList<int> supportedResolutions() const;
virtual QPrint::InputSlot defaultInputSlot() const;
- virtual QList<QPrint::InputSlot> supportedInputSlots() const;
+ virtual QVector<QPrint::InputSlot> supportedInputSlots() const;
virtual QPrint::OutputBin defaultOutputBin() const;
- virtual QList<QPrint::OutputBin> supportedOutputBins() const;
+ virtual QVector<QPrint::OutputBin> supportedOutputBins() const;
virtual QPrint::DuplexMode defaultDuplexMode() const;
- virtual QList<QPrint::DuplexMode> supportedDuplexModes() const;
+ virtual QVector<QPrint::DuplexMode> supportedDuplexModes() const;
virtual QPrint::ColorMode defaultColorMode() const;
- virtual QList<QPrint::ColorMode> supportedColorModes() const;
+ virtual QVector<QPrint::ColorMode> supportedColorModes() const;
+
+ virtual QVariant property(QPrintDevice::PrintDevicePropertyKey key) const;
+ virtual bool setProperty(QPrintDevice::PrintDevicePropertyKey key, const QVariant &value);
#ifndef QT_NO_MIMETYPE
virtual QList<QMimeType> supportedMimeTypes() const;
@@ -149,7 +155,7 @@ protected:
bool m_supportsCollateCopies;
mutable bool m_havePageSizes;
- mutable QVector<QPageSize> m_pageSizes;
+ mutable QList<QPageSize> m_pageSizes;
bool m_supportsCustomPageSizes;
@@ -157,7 +163,7 @@ protected:
QSize m_maximumPhysicalPageSize;
mutable bool m_haveResolutions;
- mutable QVector<int> m_resolutions;
+ mutable QList<int> m_resolutions;
mutable bool m_haveInputSlots;
mutable QVector<QPrint::InputSlot> m_inputSlots;
@@ -173,7 +179,7 @@ protected:
#ifndef QT_NO_MIMETYPE
mutable bool m_haveMimeTypes;
- mutable QVector<QMimeType> m_mimeTypes;
+ mutable QList<QMimeType> m_mimeTypes;
#endif
};
diff --git a/src/printsupport/kernel/qprint_p.h b/src/printsupport/kernel/qprint_p.h
index 280c2d7608..4956775461 100644
--- a/src/printsupport/kernel/qprint_p.h
+++ b/src/printsupport/kernel/qprint_p.h
@@ -59,6 +59,7 @@
#if (defined Q_OS_MACOS) || (defined Q_OS_UNIX && QT_CONFIG(cups))
#include <cups/ppd.h> // Use for type defs only, don't want to actually link in main module
+Q_DECLARE_METATYPE(ppd_file_t *)
#endif
QT_BEGIN_NAMESPACE
diff --git a/src/printsupport/kernel/qprintdevice.cpp b/src/printsupport/kernel/qprintdevice.cpp
index 26799a6f13..2bc6906364 100644
--- a/src/printsupport/kernel/qprintdevice.cpp
+++ b/src/printsupport/kernel/qprintdevice.cpp
@@ -210,9 +210,9 @@ QPrint::InputSlot QPrintDevice::defaultInputSlot() const
return isValid() ? d->defaultInputSlot() : QPrint::InputSlot();
}
-QList<QPrint::InputSlot> QPrintDevice::supportedInputSlots() const
+QVector<QPrint::InputSlot> QPrintDevice::supportedInputSlots() const
{
- return isValid() ? d->supportedInputSlots() : QList<QPrint::InputSlot>();
+ return isValid() ? d->supportedInputSlots() : QVector<QPrint::InputSlot>{};
}
QPrint::OutputBin QPrintDevice::defaultOutputBin() const
@@ -220,9 +220,9 @@ QPrint::OutputBin QPrintDevice::defaultOutputBin() const
return isValid() ? d->defaultOutputBin() : QPrint::OutputBin();
}
-QList<QPrint::OutputBin> QPrintDevice::supportedOutputBins() const
+QVector<QPrint::OutputBin> QPrintDevice::supportedOutputBins() const
{
- return isValid() ? d->supportedOutputBins() : QList<QPrint::OutputBin>();
+ return isValid() ? d->supportedOutputBins() : QVector<QPrint::OutputBin>{};
}
QPrint::DuplexMode QPrintDevice::defaultDuplexMode() const
@@ -230,9 +230,9 @@ QPrint::DuplexMode QPrintDevice::defaultDuplexMode() const
return isValid() ? d->defaultDuplexMode() : QPrint::DuplexNone;
}
-QList<QPrint::DuplexMode> QPrintDevice::supportedDuplexModes() const
+QVector<QPrint::DuplexMode> QPrintDevice::supportedDuplexModes() const
{
- return isValid() ? d->supportedDuplexModes() : QList<QPrint::DuplexMode>();
+ return isValid() ? d->supportedDuplexModes() : QVector<QPrint::DuplexMode>{};
}
QPrint::ColorMode QPrintDevice::defaultColorMode() const
@@ -240,9 +240,19 @@ QPrint::ColorMode QPrintDevice::defaultColorMode() const
return isValid() ? d->defaultColorMode() : QPrint::GrayScale;
}
-QList<QPrint::ColorMode> QPrintDevice::supportedColorModes() const
+QVector<QPrint::ColorMode> QPrintDevice::supportedColorModes() const
{
- return isValid() ? d->supportedColorModes() : QList<QPrint::ColorMode>();
+ return isValid() ? d->supportedColorModes() : QVector<QPrint::ColorMode>{};
+}
+
+QVariant QPrintDevice::property(PrintDevicePropertyKey key) const
+{
+ return isValid() ? d->property(key) : QVariant();
+}
+
+bool QPrintDevice::setProperty(PrintDevicePropertyKey key, const QVariant &value)
+{
+ return isValid() ? d->setProperty(key, value) : false;
}
#ifndef QT_NO_MIMETYPE
diff --git a/src/printsupport/kernel/qprintdevice_p.h b/src/printsupport/kernel/qprintdevice_p.h
index 1e0d3983e9..3dff2e54fe 100644
--- a/src/printsupport/kernel/qprintdevice_p.h
+++ b/src/printsupport/kernel/qprintdevice_p.h
@@ -120,16 +120,23 @@ public:
QList<int> supportedResolutions() const;
QPrint::InputSlot defaultInputSlot() const;
- QList<QPrint::InputSlot> supportedInputSlots() const;
+ QVector<QPrint::InputSlot> supportedInputSlots() const;
QPrint::OutputBin defaultOutputBin() const;
- QList<QPrint::OutputBin> supportedOutputBins() const;
+ QVector<QPrint::OutputBin> supportedOutputBins() const;
QPrint::DuplexMode defaultDuplexMode() const;
- QList<QPrint::DuplexMode> supportedDuplexModes() const;
+ QVector<QPrint::DuplexMode> supportedDuplexModes() const;
QPrint::ColorMode defaultColorMode() const;
- QList<QPrint::ColorMode> supportedColorModes() const;
+ QVector<QPrint::ColorMode> supportedColorModes() const;
+
+ enum PrintDevicePropertyKey {
+ PDPK_CustomBase = 0xff00
+ };
+
+ QVariant property(PrintDevicePropertyKey key) const;
+ bool setProperty(PrintDevicePropertyKey key, const QVariant &value);
#ifndef QT_NO_MIMETYPE
QList<QMimeType> supportedMimeTypes() const;
diff --git a/src/printsupport/kernel/qprintengine_pdf_p.h b/src/printsupport/kernel/qprintengine_pdf_p.h
index e9e81bdf68..bb01a2e9e1 100644
--- a/src/printsupport/kernel/qprintengine_pdf_p.h
+++ b/src/printsupport/kernel/qprintengine_pdf_p.h
@@ -87,18 +87,18 @@ public:
virtual ~QPdfPrintEngine();
// reimplementations QPaintEngine
- bool begin(QPaintDevice *pdev) Q_DECL_OVERRIDE;
- bool end() Q_DECL_OVERRIDE;
+ bool begin(QPaintDevice *pdev) override;
+ bool end() override;
// end reimplementations QPaintEngine
// reimplementations QPrintEngine
- bool abort() Q_DECL_OVERRIDE {return false;}
- QPrinter::PrinterState printerState() const Q_DECL_OVERRIDE {return state;}
+ bool abort() override {return false;}
+ QPrinter::PrinterState printerState() const override {return state;}
- bool newPage() Q_DECL_OVERRIDE;
- int metric(QPaintDevice::PaintDeviceMetric) const Q_DECL_OVERRIDE;
- virtual void setProperty(PrintEnginePropertyKey key, const QVariant &value) Q_DECL_OVERRIDE;
- virtual QVariant property(PrintEnginePropertyKey key) const Q_DECL_OVERRIDE;
+ bool newPage() override;
+ int metric(QPaintDevice::PaintDeviceMetric) const override;
+ virtual void setProperty(PrintEnginePropertyKey key, const QVariant &value) override;
+ virtual QVariant property(PrintEnginePropertyKey key) const override;
// end reimplementations QPrintEngine
QPrinter::PrinterState state;
diff --git a/src/printsupport/kernel/qprintengine_win.cpp b/src/printsupport/kernel/qprintengine_win.cpp
index b479ecacb1..a943d24cb1 100644
--- a/src/printsupport/kernel/qprintengine_win.cpp
+++ b/src/printsupport/kernel/qprintengine_win.cpp
@@ -1024,7 +1024,7 @@ bool QWin32PrintEnginePrivate::resetDC()
return hdc != 0;
}
-static int indexOfId(const QList<QPrint::InputSlot> &inputSlots, QPrint::InputSlotId id)
+static int indexOfId(const QVector<QPrint::InputSlot> &inputSlots, QPrint::InputSlotId id)
{
for (int i = 0; i < inputSlots.size(); ++i) {
if (inputSlots.at(i).id == id)
@@ -1033,7 +1033,7 @@ static int indexOfId(const QList<QPrint::InputSlot> &inputSlots, QPrint::InputSl
return -1;
}
-static int indexOfWindowsId(const QList<QPrint::InputSlot> &inputSlots, int windowsId)
+static int indexOfWindowsId(const QVector<QPrint::InputSlot> &inputSlots, int windowsId)
{
for (int i = 0; i < inputSlots.size(); ++i) {
if (inputSlots.at(i).windowsId == windowsId)
@@ -1210,7 +1210,7 @@ void QWin32PrintEngine::setProperty(PrintEnginePropertyKey key, const QVariant &
case PPK_PaperSource: {
if (!d->devMode)
break;
- const QList<QPrint::InputSlot> inputSlots = d->m_printDevice.supportedInputSlots();
+ const auto inputSlots = d->m_printDevice.supportedInputSlots();
const int paperSource = value.toInt();
const int index = paperSource >= DMBIN_USER ?
indexOfWindowsId(inputSlots, paperSource) : indexOfId(inputSlots, QPrint::InputSlotId(paperSource));
@@ -1465,7 +1465,7 @@ QVariant QWin32PrintEngine::property(PrintEnginePropertyKey key) const
if (d->devMode->dmDefaultSource >= DMBIN_USER) {
value = int(d->devMode->dmDefaultSource);
} else {
- const QList<QPrint::InputSlot> inputSlots = d->m_printDevice.supportedInputSlots();
+ const auto inputSlots = d->m_printDevice.supportedInputSlots();
const int index = indexOfWindowsId(inputSlots, d->devMode->dmDefaultSource);
value = index >= 0 ? inputSlots.at(index).id : QPrint::Auto;
}
diff --git a/src/printsupport/kernel/qprinter.cpp b/src/printsupport/kernel/qprinter.cpp
index d439fcbbbc..8a2cdcb34f 100644
--- a/src/printsupport/kernel/qprinter.cpp
+++ b/src/printsupport/kernel/qprinter.cpp
@@ -231,7 +231,7 @@ public:
virtual ~QPrinterPagedPaintDevicePrivate()
{}
- bool setPageLayout(const QPageLayout &newPageLayout) Q_DECL_OVERRIDE
+ bool setPageLayout(const QPageLayout &newPageLayout) override
{
if (pd->paintEngine->type() != QPaintEngine::Pdf
&& pd->printEngine->printerState() == QPrinter::Active) {
@@ -248,7 +248,7 @@ public:
return pageLayout().isEquivalentTo(newPageLayout);
}
- bool setPageSize(const QPageSize &pageSize) Q_DECL_OVERRIDE
+ bool setPageSize(const QPageSize &pageSize) override
{
if (pd->paintEngine->type() != QPaintEngine::Pdf
&& pd->printEngine->printerState() == QPrinter::Active) {
@@ -266,7 +266,7 @@ public:
return pageLayout().pageSize().isEquivalentTo(pageSize);
}
- bool setPageOrientation(QPageLayout::Orientation orientation) Q_DECL_OVERRIDE
+ bool setPageOrientation(QPageLayout::Orientation orientation) override
{
// Set the print engine value
pd->setProperty(QPrintEngine::PPK_Orientation, orientation);
@@ -277,12 +277,12 @@ public:
return pageLayout().orientation() == orientation;
}
- bool setPageMargins(const QMarginsF &margins) Q_DECL_OVERRIDE
+ bool setPageMargins(const QMarginsF &margins) override
{
return setPageMargins(margins, pageLayout().units());
}
- bool setPageMargins(const QMarginsF &margins, QPageLayout::Unit units) Q_DECL_OVERRIDE
+ bool setPageMargins(const QMarginsF &margins, QPageLayout::Unit units) override
{
// Try to set print engine margins
QPair<QMarginsF, QPageLayout::Unit> pair = qMakePair(margins, units);
@@ -294,7 +294,7 @@ public:
return pageLayout().margins() == margins && pageLayout().units() == units;
}
- QPageLayout pageLayout() const Q_DECL_OVERRIDE
+ QPageLayout pageLayout() const override
{
return pd->printEngine->property(QPrintEngine::PPK_QPageLayout).value<QPageLayout>();
}
diff --git a/src/printsupport/kernel/qprinter.h b/src/printsupport/kernel/qprinter.h
index bfe2d346ae..28dca78a63 100644
--- a/src/printsupport/kernel/qprinter.h
+++ b/src/printsupport/kernel/qprinter.h
@@ -72,7 +72,7 @@ public:
explicit QPrinter(const QPrinterInfo& printer, PrinterMode mode = ScreenResolution);
~QPrinter();
- int devType() const Q_DECL_OVERRIDE;
+ int devType() const override;
enum Orientation { Portrait, Landscape };
@@ -170,10 +170,10 @@ public:
void setOrientation(Orientation);
Orientation orientation() const;
- void setPageSize(PageSize) Q_DECL_OVERRIDE;
+ void setPageSize(PageSize) override;
PageSize pageSize() const;
- void setPageSizeMM(const QSizeF &size) Q_DECL_OVERRIDE;
+ void setPageSizeMM(const QSizeF &size) override;
void setPaperSize(PaperSize);
PaperSize paperSize() const;
@@ -237,12 +237,12 @@ public:
QString printerSelectionOption() const;
void setPrinterSelectionOption(const QString &);
- bool newPage() Q_DECL_OVERRIDE;
+ bool newPage() override;
bool abort();
PrinterState printerState() const;
- QPaintEngine *paintEngine() const Q_DECL_OVERRIDE;
+ QPaintEngine *paintEngine() const override;
QPrintEngine *printEngine() const;
void setFromTo(int fromPage, int toPage);
@@ -252,13 +252,13 @@ public:
void setPrintRange(PrintRange range);
PrintRange printRange() const;
- void setMargins(const Margins &m) Q_DECL_OVERRIDE;
+ void setMargins(const Margins &m) override;
void setPageMargins(qreal left, qreal top, qreal right, qreal bottom, Unit unit);
void getPageMargins(qreal *left, qreal *top, qreal *right, qreal *bottom, Unit unit) const;
protected:
- int metric(PaintDeviceMetric) const Q_DECL_OVERRIDE;
+ int metric(PaintDeviceMetric) const override;
void setEngines(QPrintEngine *printEngine, QPaintEngine *paintEngine);
private:
diff --git a/src/printsupport/kernel/qprinterinfo.cpp b/src/printsupport/kernel/qprinterinfo.cpp
index d271e069ad..49a0c9ece4 100644
--- a/src/printsupport/kernel/qprinterinfo.cpp
+++ b/src/printsupport/kernel/qprinterinfo.cpp
@@ -380,7 +380,7 @@ QList<QPrinter::DuplexMode> QPrinterInfo::supportedDuplexModes() const
{
Q_D(const QPrinterInfo);
QList<QPrinter::DuplexMode> list;
- const QList<QPrint::DuplexMode> supportedDuplexModes = d->m_printDevice.supportedDuplexModes();
+ const auto supportedDuplexModes = d->m_printDevice.supportedDuplexModes();
list.reserve(supportedDuplexModes.size());
for (QPrint::DuplexMode mode : supportedDuplexModes)
list << QPrinter::DuplexMode(mode);
diff --git a/src/printsupport/widgets/qcupsjobwidget.cpp b/src/printsupport/widgets/qcupsjobwidget.cpp
index 39acac020c..7525d7f1e1 100644
--- a/src/printsupport/widgets/qcupsjobwidget.cpp
+++ b/src/printsupport/widgets/qcupsjobwidget.cpp
@@ -52,6 +52,8 @@
#include <QPrinter>
#include <QPrintEngine>
+#include <kernel/qprintdevice_p.h>
+
QT_BEGIN_NAMESPACE
/*!
@@ -64,12 +66,13 @@ QT_BEGIN_NAMESPACE
\inmodule QtPrintSupport
*/
-QCupsJobWidget::QCupsJobWidget(QWidget *parent)
- : QWidget(parent)
+QCupsJobWidget::QCupsJobWidget(QPrinter *printer, QPrintDevice *printDevice, QWidget *parent)
+ : QWidget(parent),
+ m_printer(printer),
+ m_printDevice(printDevice)
{
m_ui.setupUi(this);
//set all the default values
- //TODO restore last used values
initJobHold();
initJobBilling();
initJobPriority();
@@ -80,11 +83,6 @@ QCupsJobWidget::~QCupsJobWidget()
{
}
-void QCupsJobWidget::setPrinter(QPrinter *printer)
-{
- m_printer = printer;
-}
-
void QCupsJobWidget::setupPrinter()
{
QCUPSSupport::setJobHold(m_printer, jobHold(), jobHoldTime());
@@ -106,7 +104,14 @@ void QCupsJobWidget::initJobHold()
connect(m_ui.jobHoldComboBox, QOverload<int>::of(&QComboBox::currentIndexChanged), this, &QCupsJobWidget::toggleJobHoldTime);
- setJobHold(QCUPSSupport::NoHold, QTime());
+ QCUPSSupport::JobHoldUntilWithTime jobHoldWithTime;
+
+ if (m_printDevice) {
+ const QString jobHoldUntilString = m_printDevice->property(PDPK_CupsJobHoldUntil).toString();
+ jobHoldWithTime = QCUPSSupport::parseJobHoldUntil(jobHoldUntilString);
+ }
+
+ setJobHold(jobHoldWithTime.jobHold, jobHoldWithTime.time);
toggleJobHoldTime();
}
@@ -140,7 +145,11 @@ QTime QCupsJobWidget::jobHoldTime() const
void QCupsJobWidget::initJobBilling()
{
- setJobBilling(QString());
+ QString jobBilling;
+ if (m_printDevice)
+ jobBilling = m_printDevice->property(PDPK_CupsJobBilling).toString();
+
+ setJobBilling(jobBilling);
}
void QCupsJobWidget::setJobBilling(const QString &jobBilling)
@@ -155,7 +164,18 @@ QString QCupsJobWidget::jobBilling() const
void QCupsJobWidget::initJobPriority()
{
- setJobPriority(50);
+ int priority = -1;
+ if (m_printDevice) {
+ bool ok;
+ priority = m_printDevice->property(PDPK_CupsJobPriority).toInt(&ok);
+ if (!ok)
+ priority = -1;
+ }
+
+ if (priority < 0 || priority > 100)
+ priority = 50;
+
+ setJobPriority(priority);
}
void QCupsJobWidget::setJobPriority(int jobPriority)
@@ -186,8 +206,15 @@ void QCupsJobWidget::initBannerPages()
m_ui.endBannerPageCombo->addItem(tr("Secret", "CUPS Banner page"), QVariant::fromValue(QCUPSSupport::Secret));
m_ui.endBannerPageCombo->addItem(tr("Top Secret", "CUPS Banner page"), QVariant::fromValue(QCUPSSupport::TopSecret));
- setStartBannerPage(QCUPSSupport::NoBanner);
- setEndBannerPage(QCUPSSupport::NoBanner);
+ QCUPSSupport::JobSheets jobSheets;
+
+ if (m_printDevice) {
+ const QString jobSheetsString = m_printDevice->property(PDPK_CupsJobSheets).toString();
+ jobSheets = QCUPSSupport::parseJobSheets(jobSheetsString);
+ }
+
+ setStartBannerPage(jobSheets.startBannerPage);
+ setEndBannerPage(jobSheets.endBannerPage);
}
void QCupsJobWidget::setStartBannerPage(const QCUPSSupport::BannerPage bannerPage)
diff --git a/src/printsupport/widgets/qcupsjobwidget_p.h b/src/printsupport/widgets/qcupsjobwidget_p.h
index d66a472509..dcec27a190 100644
--- a/src/printsupport/widgets/qcupsjobwidget_p.h
+++ b/src/printsupport/widgets/qcupsjobwidget_p.h
@@ -65,15 +65,15 @@ QT_BEGIN_NAMESPACE
class QString;
class QTime;
class QPrinter;
+class QPrintDevice;
class QCupsJobWidget : public QWidget
{
Q_OBJECT
public:
- explicit QCupsJobWidget(QWidget *parent = nullptr);
+ explicit QCupsJobWidget(QPrinter *printer, QPrintDevice *printDevice, QWidget *parent = nullptr);
~QCupsJobWidget();
- void setPrinter(QPrinter *printer);
void setupPrinter();
private Q_SLOTS:
@@ -103,6 +103,7 @@ private:
void initBannerPages();
QPrinter *m_printer;
+ QPrintDevice *m_printDevice;
Ui::QCupsJobWidget m_ui;
Q_DISABLE_COPY(QCupsJobWidget)
diff --git a/src/printsupport/widgets/qprintpreviewwidget.cpp b/src/printsupport/widgets/qprintpreviewwidget.cpp
index dc07517397..92370be2bd 100644
--- a/src/printsupport/widgets/qprintpreviewwidget.cpp
+++ b/src/printsupport/widgets/qprintpreviewwidget.cpp
@@ -64,13 +64,13 @@ public:
setCacheMode(DeviceCoordinateCache);
}
- QRectF boundingRect() const Q_DECL_OVERRIDE
+ QRectF boundingRect() const override
{ return brect; }
inline int pageNumber() const
{ return pageNum; }
- void paint(QPainter *painter, const QStyleOptionGraphicsItem *item, QWidget *widget) Q_DECL_OVERRIDE;
+ void paint(QPainter *painter, const QStyleOptionGraphicsItem *item, QWidget *widget) override;
private:
int pageNum;
@@ -156,7 +156,7 @@ signals:
void resized();
protected:
- void resizeEvent(QResizeEvent* e) Q_DECL_OVERRIDE
+ void resizeEvent(QResizeEvent* e) override
{
{
const QSignalBlocker blocker(verticalScrollBar()); // Don't change page, QTBUG-14517
@@ -165,7 +165,7 @@ protected:
emit resized();
}
- void showEvent(QShowEvent* e) Q_DECL_OVERRIDE
+ void showEvent(QShowEvent* e) override
{
QGraphicsView::showEvent(e);
emit resized();
diff --git a/src/printsupport/widgets/qprintpreviewwidget.h b/src/printsupport/widgets/qprintpreviewwidget.h
index d45cc1a9fb..f11d686602 100644
--- a/src/printsupport/widgets/qprintpreviewwidget.h
+++ b/src/printsupport/widgets/qprintpreviewwidget.h
@@ -80,7 +80,7 @@ public:
ZoomMode zoomMode() const;
int currentPage() const;
int pageCount() const;
- void setVisible(bool visible) Q_DECL_OVERRIDE;
+ void setVisible(bool visible) override;
public Q_SLOTS:
void print();
diff --git a/src/sql/kernel/qsqlcachedresult_p.h b/src/sql/kernel/qsqlcachedresult_p.h
index 9bcfd49f1a..543a902554 100644
--- a/src/sql/kernel/qsqlcachedresult_p.h
+++ b/src/sql/kernel/qsqlcachedresult_p.h
@@ -78,20 +78,20 @@ protected:
virtual bool gotoNext(ValueCache &values, int index) = 0;
- QVariant data(int i) Q_DECL_OVERRIDE;
- bool isNull(int i) Q_DECL_OVERRIDE;
- bool fetch(int i) Q_DECL_OVERRIDE;
- bool fetchNext() Q_DECL_OVERRIDE;
- bool fetchPrevious() Q_DECL_OVERRIDE;
- bool fetchFirst() Q_DECL_OVERRIDE;
- bool fetchLast() Q_DECL_OVERRIDE;
+ QVariant data(int i) override;
+ bool isNull(int i) override;
+ bool fetch(int i) override;
+ bool fetchNext() override;
+ bool fetchPrevious() override;
+ bool fetchFirst() override;
+ bool fetchLast() override;
int colCount() const;
ValueCache &cache();
- void virtual_hook(int id, void *data) Q_DECL_OVERRIDE;
- void detachFromResultSet() Q_DECL_OVERRIDE;
- void setNumericalPrecisionPolicy(QSql::NumericalPrecisionPolicy policy) Q_DECL_OVERRIDE;
+ void virtual_hook(int id, void *data) override;
+ void detachFromResultSet() override;
+ void setNumericalPrecisionPolicy(QSql::NumericalPrecisionPolicy policy) override;
private:
bool cacheNext();
};
diff --git a/src/sql/kernel/qsqldatabase.cpp b/src/sql/kernel/qsqldatabase.cpp
index 14374c7ca9..b129499fe6 100644
--- a/src/sql/kernel/qsqldatabase.cpp
+++ b/src/sql/kernel/qsqldatabase.cpp
@@ -135,6 +135,8 @@ QSqlDatabasePrivate::QSqlDatabasePrivate(const QSqlDatabasePrivate &other) : ref
connOptions = other.connOptions;
driver = other.driver;
precisionPolicy = other.precisionPolicy;
+ if (driver)
+ driver->setNumericalPrecisionPolicy(other.driver->numericalPrecisionPolicy());
}
QSqlDatabasePrivate::~QSqlDatabasePrivate()
@@ -253,6 +255,8 @@ void QSqlDatabasePrivate::copy(const QSqlDatabasePrivate *other)
port = other->port;
connOptions = other->connOptions;
precisionPolicy = other->precisionPolicy;
+ if (driver)
+ driver->setNumericalPrecisionPolicy(other->driver->numericalPrecisionPolicy());
}
void QSqlDatabasePrivate::disable()
diff --git a/src/sql/kernel/qsqldatabase.h b/src/sql/kernel/qsqldatabase.h
index 0b4aca8cdd..684b9c04a1 100644
--- a/src/sql/kernel/qsqldatabase.h
+++ b/src/sql/kernel/qsqldatabase.h
@@ -64,7 +64,7 @@ template <class T>
class QSqlDriverCreator : public QSqlDriverCreatorBase
{
public:
- QSqlDriver *createObject() const Q_DECL_OVERRIDE { return new T; }
+ QSqlDriver *createObject() const override { return new T; }
};
class Q_SQL_EXPORT QSqlDatabase
diff --git a/src/sql/kernel/qsqldriver.h b/src/sql/kernel/qsqldriver.h
index 1296bd5d51..1e03be48d3 100644
--- a/src/sql/kernel/qsqldriver.h
+++ b/src/sql/kernel/qsqldriver.h
@@ -89,7 +89,7 @@ public:
DB2
};
- explicit QSqlDriver(QObject *parent = Q_NULLPTR);
+ explicit QSqlDriver(QObject *parent = nullptr);
~QSqlDriver();
virtual bool isOpen() const;
bool isOpenError() const;
@@ -139,7 +139,7 @@ Q_SIGNALS:
void notification(const QString &name, QSqlDriver::NotificationSource source, const QVariant &payload);
protected:
- QSqlDriver(QSqlDriverPrivate &dd, QObject *parent = Q_NULLPTR);
+ QSqlDriver(QSqlDriverPrivate &dd, QObject *parent = nullptr);
virtual void setOpen(bool o);
virtual void setOpenError(bool e);
virtual void setLastError(const QSqlError& e);
diff --git a/src/sql/kernel/qsqldriverplugin.h b/src/sql/kernel/qsqldriverplugin.h
index c0f4c00943..001368a291 100644
--- a/src/sql/kernel/qsqldriverplugin.h
+++ b/src/sql/kernel/qsqldriverplugin.h
@@ -55,7 +55,7 @@ class Q_SQL_EXPORT QSqlDriverPlugin : public QObject
{
Q_OBJECT
public:
- explicit QSqlDriverPlugin(QObject *parent = Q_NULLPTR);
+ explicit QSqlDriverPlugin(QObject *parent = nullptr);
~QSqlDriverPlugin();
virtual QSqlDriver *create(const QString &key) = 0;
diff --git a/src/sql/kernel/qsqlnulldriver_p.h b/src/sql/kernel/qsqlnulldriver_p.h
index 92d8d30485..7a40199d71 100644
--- a/src/sql/kernel/qsqlnulldriver_p.h
+++ b/src/sql/kernel/qsqlnulldriver_p.h
@@ -66,27 +66,27 @@ public:
{ QSqlResult::setLastError(
QSqlError(QLatin1String("Driver not loaded"), QLatin1String("Driver not loaded"), QSqlError::ConnectionError)); }
protected:
- inline QVariant data(int) Q_DECL_OVERRIDE { return QVariant(); }
- inline bool reset (const QString&) Q_DECL_OVERRIDE { return false; }
- inline bool fetch(int) Q_DECL_OVERRIDE { return false; }
- inline bool fetchFirst() Q_DECL_OVERRIDE { return false; }
- inline bool fetchLast() Q_DECL_OVERRIDE { return false; }
- inline bool isNull(int) Q_DECL_OVERRIDE { return false; }
- inline int size() Q_DECL_OVERRIDE { return -1; }
- inline int numRowsAffected() Q_DECL_OVERRIDE { return 0; }
+ inline QVariant data(int) override { return QVariant(); }
+ inline bool reset (const QString&) override { return false; }
+ inline bool fetch(int) override { return false; }
+ inline bool fetchFirst() override { return false; }
+ inline bool fetchLast() override { return false; }
+ inline bool isNull(int) override { return false; }
+ inline int size() override { return -1; }
+ inline int numRowsAffected() override { return 0; }
- inline void setAt(int) Q_DECL_OVERRIDE {}
- inline void setActive(bool) Q_DECL_OVERRIDE {}
- inline void setLastError(const QSqlError&) Q_DECL_OVERRIDE {}
- inline void setQuery(const QString&) Q_DECL_OVERRIDE {}
- inline void setSelect(bool) Q_DECL_OVERRIDE {}
- inline void setForwardOnly(bool) Q_DECL_OVERRIDE {}
+ inline void setAt(int) override {}
+ inline void setActive(bool) override {}
+ inline void setLastError(const QSqlError&) override {}
+ inline void setQuery(const QString&) override {}
+ inline void setSelect(bool) override {}
+ inline void setForwardOnly(bool) override {}
- inline bool exec() Q_DECL_OVERRIDE { return false; }
- inline bool prepare(const QString&) Q_DECL_OVERRIDE { return false; }
- inline bool savePrepare(const QString&) Q_DECL_OVERRIDE { return false; }
- inline void bindValue(int, const QVariant&, QSql::ParamType) Q_DECL_OVERRIDE {}
- inline void bindValue(const QString&, const QVariant&, QSql::ParamType) Q_DECL_OVERRIDE {}
+ inline bool exec() override { return false; }
+ inline bool prepare(const QString&) override { return false; }
+ inline bool savePrepare(const QString&) override { return false; }
+ inline void bindValue(int, const QVariant&, QSql::ParamType) override {}
+ inline void bindValue(const QString&, const QVariant&, QSql::ParamType) override {}
};
class QSqlNullDriver : public QSqlDriver
@@ -95,16 +95,16 @@ public:
inline QSqlNullDriver(): QSqlDriver()
{ QSqlDriver::setLastError(
QSqlError(QLatin1String("Driver not loaded"), QLatin1String("Driver not loaded"), QSqlError::ConnectionError)); }
- inline bool hasFeature(DriverFeature) const Q_DECL_OVERRIDE { return false; }
- inline bool open(const QString &, const QString &, const QString &, const QString &, int, const QString&) Q_DECL_OVERRIDE
+ inline bool hasFeature(DriverFeature) const override { return false; }
+ inline bool open(const QString &, const QString &, const QString &, const QString &, int, const QString&) override
{ return false; }
- inline void close() Q_DECL_OVERRIDE {}
- inline QSqlResult *createResult() const Q_DECL_OVERRIDE { return new QSqlNullResult(this); }
+ inline void close() override {}
+ inline QSqlResult *createResult() const override { return new QSqlNullResult(this); }
protected:
- inline void setOpen(bool) Q_DECL_OVERRIDE {}
- inline void setOpenError(bool) Q_DECL_OVERRIDE {}
- inline void setLastError(const QSqlError&) Q_DECL_OVERRIDE {}
+ inline void setOpen(bool) override {}
+ inline void setOpenError(bool) override {}
+ inline void setLastError(const QSqlError&) override {}
};
QT_END_NAMESPACE
diff --git a/src/sql/models/qsqlrelationaltablemodel.cpp b/src/sql/models/qsqlrelationaltablemodel.cpp
index 9d6daa2634..8220fea39a 100644
--- a/src/sql/models/qsqlrelationaltablemodel.cpp
+++ b/src/sql/models/qsqlrelationaltablemodel.cpp
@@ -156,7 +156,7 @@ class QRelatedTableModel : public QSqlTableModel
{
public:
QRelatedTableModel(QRelation *rel, QObject *parent = 0, QSqlDatabase db = QSqlDatabase());
- bool select() Q_DECL_OVERRIDE;
+ bool select() override;
private:
bool firstSelect;
QRelation *relation;
@@ -268,12 +268,12 @@ public:
{}
QString fullyQualifiedFieldName(const QString &tableName, const QString &fieldName) const;
- int nameToIndex(const QString &name) const Q_DECL_OVERRIDE;
+ int nameToIndex(const QString &name) const override;
mutable QVector<QRelation> relations;
QSqlRecord baseRec; // the record without relations
void clearChanges();
- void clearCache() Q_DECL_OVERRIDE;
- void revertCachedRow(int row) Q_DECL_OVERRIDE;
+ void clearCache() override;
+ void revertCachedRow(int row) override;
void translateFieldNames(QSqlRecord &values) const;
QSqlRelationalTableModel::JoinMode joinMode;
diff --git a/src/sql/models/qsqlrelationaltablemodel.h b/src/sql/models/qsqlrelationaltablemodel.h
index f8b08b089f..90b7a6481f 100644
--- a/src/sql/models/qsqlrelationaltablemodel.h
+++ b/src/sql/models/qsqlrelationaltablemodel.h
@@ -88,31 +88,31 @@ public:
LeftJoin
};
- explicit QSqlRelationalTableModel(QObject *parent = Q_NULLPTR,
+ explicit QSqlRelationalTableModel(QObject *parent = nullptr,
QSqlDatabase db = QSqlDatabase());
virtual ~QSqlRelationalTableModel();
- QVariant data(const QModelIndex &item, int role = Qt::DisplayRole) const Q_DECL_OVERRIDE;
- bool setData(const QModelIndex &item, const QVariant &value, int role = Qt::EditRole) Q_DECL_OVERRIDE;
- bool removeColumns(int column, int count, const QModelIndex &parent = QModelIndex()) Q_DECL_OVERRIDE;
+ QVariant data(const QModelIndex &item, int role = Qt::DisplayRole) const override;
+ bool setData(const QModelIndex &item, const QVariant &value, int role = Qt::EditRole) override;
+ bool removeColumns(int column, int count, const QModelIndex &parent = QModelIndex()) override;
- void clear() Q_DECL_OVERRIDE;
- bool select() Q_DECL_OVERRIDE;
+ void clear() override;
+ bool select() override;
- void setTable(const QString &tableName) Q_DECL_OVERRIDE;
+ void setTable(const QString &tableName) override;
virtual void setRelation(int column, const QSqlRelation &relation);
QSqlRelation relation(int column) const;
virtual QSqlTableModel *relationModel(int column) const;
void setJoinMode( QSqlRelationalTableModel::JoinMode joinMode );
public Q_SLOTS:
- void revertRow(int row) Q_DECL_OVERRIDE;
+ void revertRow(int row) override;
protected:
- QString selectStatement() const Q_DECL_OVERRIDE;
- bool updateRowInTable(int row, const QSqlRecord &values) Q_DECL_OVERRIDE;
- bool insertRowIntoTable(const QSqlRecord &values) Q_DECL_OVERRIDE;
- QString orderByClause() const Q_DECL_OVERRIDE;
+ QString selectStatement() const override;
+ bool updateRowInTable(int row, const QSqlRecord &values) override;
+ bool insertRowIntoTable(const QSqlRecord &values) override;
+ QString orderByClause() const override;
private:
Q_DECLARE_PRIVATE(QSqlRelationalTableModel)
diff --git a/src/sql/models/qsqltablemodel.h b/src/sql/models/qsqltablemodel.h
index 6a62c6993d..77b0517c74 100644
--- a/src/sql/models/qsqltablemodel.h
+++ b/src/sql/models/qsqltablemodel.h
@@ -60,25 +60,25 @@ class Q_SQL_EXPORT QSqlTableModel: public QSqlQueryModel
public:
enum EditStrategy {OnFieldChange, OnRowChange, OnManualSubmit};
- explicit QSqlTableModel(QObject *parent = Q_NULLPTR, QSqlDatabase db = QSqlDatabase());
+ explicit QSqlTableModel(QObject *parent = nullptr, QSqlDatabase db = QSqlDatabase());
virtual ~QSqlTableModel();
virtual void setTable(const QString &tableName);
QString tableName() const;
- Qt::ItemFlags flags(const QModelIndex &index) const Q_DECL_OVERRIDE;
+ Qt::ItemFlags flags(const QModelIndex &index) const override;
QSqlRecord record() const;
QSqlRecord record(int row) const;
- QVariant data(const QModelIndex &idx, int role = Qt::DisplayRole) const Q_DECL_OVERRIDE;
- bool setData(const QModelIndex &index, const QVariant &value, int role = Qt::EditRole) Q_DECL_OVERRIDE;
+ QVariant data(const QModelIndex &idx, int role = Qt::DisplayRole) const override;
+ bool setData(const QModelIndex &index, const QVariant &value, int role = Qt::EditRole) override;
- QVariant headerData(int section, Qt::Orientation orientation, int role = Qt::DisplayRole) const Q_DECL_OVERRIDE;
+ QVariant headerData(int section, Qt::Orientation orientation, int role = Qt::DisplayRole) const override;
bool isDirty() const;
bool isDirty(const QModelIndex &index) const;
- void clear() Q_DECL_OVERRIDE;
+ void clear() override;
virtual void setEditStrategy(EditStrategy strategy);
EditStrategy editStrategy() const;
@@ -87,17 +87,17 @@ public:
QSqlDatabase database() const;
int fieldIndex(const QString &fieldName) const;
- void sort(int column, Qt::SortOrder order) Q_DECL_OVERRIDE;
+ void sort(int column, Qt::SortOrder order) override;
virtual void setSort(int column, Qt::SortOrder order);
QString filter() const;
virtual void setFilter(const QString &filter);
- int rowCount(const QModelIndex &parent = QModelIndex()) const Q_DECL_OVERRIDE;
+ int rowCount(const QModelIndex &parent = QModelIndex()) const override;
- bool removeColumns(int column, int count, const QModelIndex &parent = QModelIndex()) Q_DECL_OVERRIDE;
- bool removeRows(int row, int count, const QModelIndex &parent = QModelIndex()) Q_DECL_OVERRIDE;
- bool insertRows(int row, int count, const QModelIndex &parent = QModelIndex()) Q_DECL_OVERRIDE;
+ bool removeColumns(int column, int count, const QModelIndex &parent = QModelIndex()) override;
+ bool removeRows(int row, int count, const QModelIndex &parent = QModelIndex()) override;
+ bool insertRows(int row, int count, const QModelIndex &parent = QModelIndex()) override;
bool insertRecord(int row, const QSqlRecord &record);
bool setRecord(int row, const QSqlRecord &record);
@@ -108,8 +108,8 @@ public Q_SLOTS:
virtual bool select();
virtual bool selectRow(int row);
- bool submit() Q_DECL_OVERRIDE;
- void revert() Q_DECL_OVERRIDE;
+ bool submit() override;
+ void revert() override;
bool submitAll();
void revertAll();
@@ -122,7 +122,7 @@ Q_SIGNALS:
void beforeDelete(int row);
protected:
- QSqlTableModel(QSqlTableModelPrivate &dd, QObject *parent = Q_NULLPTR, QSqlDatabase db = QSqlDatabase());
+ QSqlTableModel(QSqlTableModelPrivate &dd, QObject *parent = nullptr, QSqlDatabase db = QSqlDatabase());
virtual bool updateRowInTable(int row, const QSqlRecord &values);
virtual bool insertRowIntoTable(const QSqlRecord &values);
@@ -132,7 +132,7 @@ protected:
void setPrimaryKey(const QSqlIndex &key);
void setQuery(const QSqlQuery &query);
- QModelIndex indexInQuery(const QModelIndex &item) const Q_DECL_OVERRIDE;
+ QModelIndex indexInQuery(const QModelIndex &item) const override;
QSqlRecord primaryValues(int row) const;
};
diff --git a/src/testlib/3rdparty/cycle_p.h b/src/testlib/3rdparty/cycle_p.h
index a2924230ad..95e741a82a 100644
--- a/src/testlib/3rdparty/cycle_p.h
+++ b/src/testlib/3rdparty/cycle_p.h
@@ -493,21 +493,4 @@ INLINE_ELAPSED(inline)
#define HAVE_TICK_COUNTER
#endif
-/*----------------------------------------------------------------*/
-/* Symbian */
-#if defined(__SYMBIAN32__) && !defined(HAVE_TICK_COUNTER)
-#include <e32std.h>
-
-typedef TUint32 CycleCounterTicks;
-
-static inline CycleCounterTicks getticks(void)
-{
- return User::FastCounter();
-}
-
-INLINE_ELAPSED(inline)
-
-#define HAVE_TICK_COUNTER
-#endif
-
#endif // QBENCHLIB_CYCLE_H
diff --git a/src/testlib/doc/qttestlib.qdocconf b/src/testlib/doc/qttestlib.qdocconf
index 899f94ec53..1fdb136e78 100644
--- a/src/testlib/doc/qttestlib.qdocconf
+++ b/src/testlib/doc/qttestlib.qdocconf
@@ -1,6 +1,7 @@
include($QT_INSTALL_DOCS/global/qt-module-defaults.qdocconf)
project = QtTestLib
+moduleheader = QtTest
description = Qt Test Reference Documentation
version = $QT_VERSION
diff --git a/src/testlib/qbenchmarkperfevents_p.h b/src/testlib/qbenchmarkperfevents_p.h
index 085dc620d7..86ba556549 100644
--- a/src/testlib/qbenchmarkperfevents_p.h
+++ b/src/testlib/qbenchmarkperfevents_p.h
@@ -60,16 +60,16 @@ class QBenchmarkPerfEventsMeasurer : public QBenchmarkMeasurerBase
public:
QBenchmarkPerfEventsMeasurer();
~QBenchmarkPerfEventsMeasurer();
- virtual void init() Q_DECL_OVERRIDE;
- virtual void start() Q_DECL_OVERRIDE;
- virtual qint64 checkpoint() Q_DECL_OVERRIDE;
- virtual qint64 stop() Q_DECL_OVERRIDE;
- virtual bool isMeasurementAccepted(qint64 measurement) Q_DECL_OVERRIDE;
- virtual int adjustIterationCount(int suggestion) Q_DECL_OVERRIDE;
- virtual int adjustMedianCount(int suggestion) Q_DECL_OVERRIDE;
- virtual bool repeatCount() Q_DECL_OVERRIDE { return 1; }
- virtual bool needsWarmupIteration() Q_DECL_OVERRIDE { return true; }
- virtual QTest::QBenchmarkMetric metricType() Q_DECL_OVERRIDE;
+ virtual void init() override;
+ virtual void start() override;
+ virtual qint64 checkpoint() override;
+ virtual qint64 stop() override;
+ virtual bool isMeasurementAccepted(qint64 measurement) override;
+ virtual int adjustIterationCount(int suggestion) override;
+ virtual int adjustMedianCount(int suggestion) override;
+ virtual bool repeatCount() override { return 1; }
+ virtual bool needsWarmupIteration() override { return true; }
+ virtual QTest::QBenchmarkMetric metricType() override;
static bool isAvailable();
static QTest::QBenchmarkMetric metricForEvent(quint32 type, quint64 event_id);
diff --git a/src/testlib/qcsvbenchmarklogger_p.h b/src/testlib/qcsvbenchmarklogger_p.h
index f321494e8a..5840aee0f5 100644
--- a/src/testlib/qcsvbenchmarklogger_p.h
+++ b/src/testlib/qcsvbenchmarklogger_p.h
@@ -61,18 +61,18 @@ public:
QCsvBenchmarkLogger(const char *filename);
~QCsvBenchmarkLogger();
- void startLogging() Q_DECL_OVERRIDE;
- void stopLogging() Q_DECL_OVERRIDE;
+ void startLogging() override;
+ void stopLogging() override;
- void enterTestFunction(const char *function) Q_DECL_OVERRIDE;
- void leaveTestFunction() Q_DECL_OVERRIDE;
+ void enterTestFunction(const char *function) override;
+ void leaveTestFunction() override;
void addIncident(IncidentTypes type, const char *description,
- const char *file = 0, int line = 0) Q_DECL_OVERRIDE;
- void addBenchmarkResult(const QBenchmarkResult &result) Q_DECL_OVERRIDE;
+ const char *file = 0, int line = 0) override;
+ void addBenchmarkResult(const QBenchmarkResult &result) override;
void addMessage(MessageTypes type, const QString &message,
- const char *file = 0, int line = 0) Q_DECL_OVERRIDE;
+ const char *file = 0, int line = 0) override;
};
QT_END_NAMESPACE
diff --git a/src/testlib/qsignalspy.h b/src/testlib/qsignalspy.h
index 6b1b7e6922..d9a0f4496b 100644
--- a/src/testlib/qsignalspy.h
+++ b/src/testlib/qsignalspy.h
@@ -88,7 +88,7 @@ public:
}
if (!QMetaObject::connect(obj, sigIndex, this, memberOffset,
- Qt::DirectConnection, Q_NULLPTR)) {
+ Qt::DirectConnection, nullptr)) {
qWarning("QSignalSpy: QMetaObject::connect returned false. Unable to connect.");
return;
}
@@ -151,7 +151,7 @@ public:
return count() > origCount;
}
- int qt_metacall(QMetaObject::Call call, int methodId, void **a) Q_DECL_OVERRIDE
+ int qt_metacall(QMetaObject::Call call, int methodId, void **a) override
{
methodId = QObject::qt_metacall(call, methodId, a);
if (methodId < 0)
diff --git a/src/testlib/qtest.h b/src/testlib/qtest.h
index ca045120d5..a5df27e3b9 100644
--- a/src/testlib/qtest.h
+++ b/src/testlib/qtest.h
@@ -263,7 +263,7 @@ inline bool qCompare(QList<T> const &t1, QList<T> const &t2, const char *actual,
delete [] val2;
}
}
- return compare_helper(isOk, msg, Q_NULLPTR, Q_NULLPTR, actual, expected, file, line);
+ return compare_helper(isOk, msg, nullptr, nullptr, actual, expected, file, line);
}
template <>
diff --git a/src/testlib/qtest_gui.h b/src/testlib/qtest_gui.h
index d4b2de2214..a4f217ae1f 100644
--- a/src/testlib/qtest_gui.h
+++ b/src/testlib/qtest_gui.h
@@ -62,10 +62,7 @@
#include <QtGui/qvector2d.h>
#include <QtGui/qvector3d.h>
#include <QtGui/qvector4d.h>
-
-#ifdef QT_WIDGETS_LIB
#include <QtGui/qicon.h>
-#endif
#if 0
// inform syncqt
@@ -78,9 +75,6 @@ QT_BEGIN_NAMESPACE
namespace QTest
{
-/*!
- \internal
- */
template<> inline char *toString(const QColor &color)
{
return qstrdup(color.name(QColor::HexArgb).toLocal8Bit().constData());
@@ -94,8 +88,8 @@ template<> inline char *toString(const QRegion &region)
} else if (region.isEmpty()) {
result += "empty";
} else {
- const QVector<QRect> &rects = region.rects();
- const int rectCount = rects.size();
+ const auto rects = region.begin();
+ const int rectCount = region.rectCount();
if (rectCount > 1) {
result += QByteArray::number(rectCount);
result += " rectangles, ";
@@ -103,7 +97,7 @@ template<> inline char *toString(const QRegion &region)
for (int i = 0; i < rectCount; ++i) {
if (i)
result += ", ";
- const QRect &r = rects.at(i);
+ const QRect &r = rects[i];
result += QByteArray::number(r.width());
result += 'x';
result += QByteArray::number(r.height());
@@ -164,24 +158,24 @@ inline bool qCompare(QImage const &t1, QImage const &t2,
qsnprintf(msg, 1024, "Compared QImages differ.\n"
" Actual (%s).isNull(): %d\n"
" Expected (%s).isNull(): %d", actual, t1Null, expected, t2Null);
- return compare_helper(false, msg, Q_NULLPTR, Q_NULLPTR, actual, expected, file, line);
+ return compare_helper(false, msg, nullptr, nullptr, actual, expected, file, line);
}
if (t1Null && t2Null)
- return compare_helper(true, Q_NULLPTR, Q_NULLPTR, Q_NULLPTR, actual, expected, file, line);
+ return compare_helper(true, nullptr, nullptr, nullptr, actual, expected, file, line);
if (t1.width() != t2.width() || t1.height() != t2.height()) {
qsnprintf(msg, 1024, "Compared QImages differ in size.\n"
" Actual (%s): %dx%d\n"
" Expected (%s): %dx%d",
actual, t1.width(), t1.height(),
expected, t2.width(), t2.height());
- return compare_helper(false, msg, Q_NULLPTR, Q_NULLPTR, actual, expected, file, line);
+ return compare_helper(false, msg, nullptr, nullptr, actual, expected, file, line);
}
if (t1.format() != t2.format()) {
qsnprintf(msg, 1024, "Compared QImages differ in format.\n"
" Actual (%s): %d\n"
" Expected (%s): %d",
actual, t1.format(), expected, t2.format());
- return compare_helper(false, msg, Q_NULLPTR, Q_NULLPTR, actual, expected, file, line);
+ return compare_helper(false, msg, nullptr, nullptr, actual, expected, file, line);
}
return compare_helper(t1 == t2, "Compared values are not the same",
toString(t1), toString(t2), actual, expected, file, line);
@@ -198,17 +192,17 @@ inline bool qCompare(QPixmap const &t1, QPixmap const &t2, const char *actual, c
qsnprintf(msg, 1024, "Compared QPixmaps differ.\n"
" Actual (%s).isNull(): %d\n"
" Expected (%s).isNull(): %d", actual, t1Null, expected, t2Null);
- return compare_helper(false, msg, Q_NULLPTR, Q_NULLPTR, actual, expected, file, line);
+ return compare_helper(false, msg, nullptr, nullptr, actual, expected, file, line);
}
if (t1Null && t2Null)
- return compare_helper(true, Q_NULLPTR, Q_NULLPTR, Q_NULLPTR, actual, expected, file, line);
+ return compare_helper(true, nullptr, nullptr, nullptr, actual, expected, file, line);
if (t1.width() != t2.width() || t1.height() != t2.height()) {
qsnprintf(msg, 1024, "Compared QPixmaps differ in size.\n"
" Actual (%s): %dx%d\n"
" Expected (%s): %dx%d",
actual, t1.width(), t1.height(),
expected, t2.width(), t2.height());
- return compare_helper(false, msg, Q_NULLPTR, Q_NULLPTR, actual, expected, file, line);
+ return compare_helper(false, msg, nullptr, nullptr, actual, expected, file, line);
}
return qCompare(t1.toImage(), t2.toImage(), actual, expected, file, line);
}
diff --git a/src/testlib/qtest_network.h b/src/testlib/qtest_network.h
index 57a37734fc..b417f03a7f 100644
--- a/src/testlib/qtest_network.h
+++ b/src/testlib/qtest_network.h
@@ -64,9 +64,6 @@ QT_BEGIN_NAMESPACE
namespace QTest
{
-/*!
- \internal
- */
template<>
inline char *toString<QHostAddress>(const QHostAddress &addr)
{
@@ -83,9 +80,6 @@ inline char *toString<QHostAddress>(const QHostAddress &addr)
return toString(addr.toString());
}
-/*!
- \internal
- */
inline char *toString(QNetworkReply::NetworkError code)
{
const QMetaObject *mo = &QNetworkReply::staticMetaObject;
@@ -97,17 +91,11 @@ inline char *toString(QNetworkReply::NetworkError code)
return qstrdup(qme.valueToKey(code));
}
-/*!
- \internal
- */
inline char *toString(const QNetworkCookie &cookie)
{
return toString(cookie.toRawForm());
}
-/*!
- \internal
- */
inline char *toString(const QList<QNetworkCookie> &list)
{
QByteArray result = "QList(";
diff --git a/src/testlib/qtestaccessible.h b/src/testlib/qtestaccessible.h
index 464f87fb5c..0470d15ed7 100644
--- a/src/testlib/qtestaccessible.h
+++ b/src/testlib/qtestaccessible.h
@@ -132,7 +132,7 @@ public:
static void cleanup()
{
delete instance();
- instance() = Q_NULLPTR;
+ instance() = nullptr;
}
static void clearEvents() { eventList().clear(); }
static EventList events() { return eventList(); }
@@ -167,8 +167,8 @@ private:
~QTestAccessibility()
{
- QAccessible::installUpdateHandler(Q_NULLPTR);
- QAccessible::installRootObjectHandler(Q_NULLPTR);
+ QAccessible::installUpdateHandler(nullptr);
+ QAccessible::installRootObjectHandler(nullptr);
}
static void rootObjectHandler(QObject *object)
@@ -273,7 +273,7 @@ private:
static QTestAccessibility *&instance()
{
- static QTestAccessibility *ta = Q_NULLPTR;
+ static QTestAccessibility *ta = nullptr;
return ta;
}
diff --git a/src/testlib/qtestcase.cpp b/src/testlib/qtestcase.cpp
index 3b5acb6b95..8cd685f7ef 100644
--- a/src/testlib/qtestcase.cpp
+++ b/src/testlib/qtestcase.cpp
@@ -583,6 +583,7 @@ Q_TESTLIB_EXPORT void qtest_qParseArgs(int argc, char *argv[], bool qml)
" -plugins dir : Specify a directory where to search for plugins.\n"
" -input dir/file : Specify the root directory for test cases or a single test case file.\n"
" -translation file : Specify the translation file.\n"
+ " -file-selector dir : Specify a file selector for the QML engine.\n"
);
}
@@ -901,6 +902,10 @@ void TestMethods::invokeTestOnData(int index) const
if (m_cleanupMethod.isValid())
m_cleanupMethod.invoke(QTest::currentTestObject, Qt::DirectConnection);
+ // Process any deleteLater(), like event-loop based apps would do. Fixes memleak reports.
+ if (QCoreApplication::instance())
+ QCoreApplication::sendPostedEvents(nullptr, QEvent::DeferredDelete);
+
// If the test isn't a benchmark, finalize the result after cleanup() has finished.
if (!isBenchmark)
QTestResult::finishedCurrentTestDataCleanup();
@@ -1385,7 +1390,7 @@ void TestMethods::invokeTests(QObject *testObject) const
if (!QTestResult::skipCurrentTest() && !previousFailed) {
for (int i = 0, count = int(m_methods.size()); i < count; ++i) {
- const char *data = Q_NULLPTR;
+ const char *data = nullptr;
if (i < QTest::testTags.size() && !QTest::testTags.at(i).isEmpty())
data = qstrdup(QTest::testTags.at(i).toLatin1().constData());
const bool ok = invokeTest(i, data, watchDog.data());
@@ -1530,7 +1535,7 @@ class DebugSymbolResolver
Q_DISABLE_COPY(DebugSymbolResolver)
public:
struct Symbol {
- Symbol() : name(Q_NULLPTR), address(0) {}
+ Symbol() : name(nullptr), address(0) {}
const char *name; // Must be freed by caller.
DWORD64 address;
@@ -1578,11 +1583,11 @@ void DebugSymbolResolver::cleanup()
if (m_dbgHelpLib)
FreeLibrary(m_dbgHelpLib);
m_dbgHelpLib = 0;
- m_symFromAddr = Q_NULLPTR;
+ m_symFromAddr = nullptr;
}
DebugSymbolResolver::DebugSymbolResolver(HANDLE process)
- : m_process(process), m_dbgHelpLib(0), m_symFromAddr(Q_NULLPTR)
+ : m_process(process), m_dbgHelpLib(0), m_symFromAddr(nullptr)
{
bool success = false;
m_dbgHelpLib = LoadLibraryW(L"dbghelp.dll");
@@ -2288,7 +2293,7 @@ QTestData &QTest::addRow(const char *format, ...)
return *tbl->newData(buf);
}
-/*! \fn void QTest::addColumn(const char *name, T *dummy = 0)
+/*! \fn template <typename T> void QTest::addColumn(const char *name, T *dummy = 0)
Adds a column with type \c{T} to the current test data.
\a name is the name of the column. \a dummy is a workaround
@@ -2419,7 +2424,7 @@ bool QTest::compare_helper(bool success, const char *failureMsg,
return QTestResult::compare(success, failureMsg, val1, val2, actual, expected, file, line);
}
-/*! \fn bool QTest::qCompare(float const &t1, float const &t2, const char *actual, const char *expected, const char *file, int line)
+/*! \fn bool QTest::qCompare(const float &t1, const float &t2, const char *actual, const char *expected, const char *file, int line)
\internal
*/
bool QTest::qCompare(float const &t1, float const &t2, const char *actual, const char *expected,
@@ -2429,7 +2434,7 @@ bool QTest::qCompare(float const &t1, float const &t2, const char *actual, const
toString(t1), toString(t2), actual, expected, file, line);
}
-/*! \fn bool QTest::qCompare(double const &t1, double const &t2, const char *actual, const char *expected, const char *file, int line)
+/*! \fn bool QTest::qCompare(const double &t1, const double &t2, const char *actual, const char *expected, const char *file, int line)
\internal
*/
bool QTest::qCompare(double const &t1, double const &t2, const char *actual, const char *expected,
@@ -2439,11 +2444,11 @@ bool QTest::qCompare(double const &t1, double const &t2, const char *actual, con
toString(t1), toString(t2), actual, expected, file, line);
}
-/*! \fn bool QTest::qCompare(double const &t1, float const &t2, const char *actual, const char *expected, const char *file, int line)
+/*! \fn bool QTest::qCompare(const double &t1, const float &t2, const char *actual, const char *expected, const char *file, int line)
\internal
*/
-/*! \fn bool QTest::qCompare(float const &t1, double const &t2, const char *actual, const char *expected, const char *file, int line)
+/*! \fn bool QTest::qCompare(const float &t1, const double &t2, const char *actual, const char *expected, const char *file, int line)
\internal
*/
@@ -2540,6 +2545,30 @@ char *QTest::toString(const void *p)
return msg;
}
+/*! \fn char *QTest::toString(const QColor &color)
+ \internal
+ */
+
+/*! \fn char *QTest::toString(const QRegion &region)
+ \internal
+ */
+
+/*! \fn char *QTest::toString(const QHostAddress &addr)
+ \internal
+ */
+
+/*! \fn char *QTest::toString(QNetworkReply::NetworkError code)
+ \internal
+ */
+
+/*! \fn char *QTest::toString(const QNetworkCookie &cookie)
+ \internal
+ */
+
+/*! \fn char *QTest::toString(const QList<QNetworkCookie> &list)
+ \internal
+ */
+
/*! \internal
*/
bool QTest::compare_string_helper(const char *t1, const char *t2, const char *actual,
@@ -2554,51 +2583,59 @@ bool QTest::compare_string_helper(const char *t1, const char *t2, const char *ac
\internal
*/
-/*! \fn bool QTest::compare_ptr_helper(const void *t1, const void *t2, const char *actual, const char *expected, const char *file, int line);
+/*! \fn bool QTest::compare_ptr_helper(const volatile void *t1, const volatile void *t2, const char *actual, const char *expected, const char *file, int line)
+ \internal
+*/
+
+/*! \fn bool QTest::compare_ptr_helper(const volatile void *t1, std::nullptr_t, const char *actual, const char *expected, const char *file, int line)
+ \internal
+*/
+
+/*! \fn bool QTest::compare_ptr_helper(std::nullptr_t, const volatile void *t2, const char *actual, const char *expected, const char *file, int line)
\internal
*/
-/*! \fn bool QTest::qCompare(T1 const &, T2 const &, const char *, const char *, const char *, int);
+/*! \fn template <typename T1, typename T2> bool QTest::qCompare(const T1 &t1, const T2 &t2, const char *actual, const char *expected, const char *file, int line)
\internal
*/
-/*! \fn bool QTest::qCompare(QIcon const &t1, QIcon const &t2, const char *actual, const char *expected, const char *file, int line)
+/*! \fn bool QTest::qCompare(const QIcon &t1, const QIcon &t2, const char *actual, const char *expected, const char *file, int line)
\internal
*/
-/*! \fn bool QTest::qCompare(QImage const &t1, QImage const &t2, const char *actual, const char *expected, const char *file, int line)
+/*! \fn bool QTest::qCompare(const QImage &t1, const QImage &t2, const char *actual, const char *expected, const char *file, int line)
\internal
*/
-/*! \fn bool QTest::qCompare(QPixmap const &t1, QPixmap const &t2, const char *actual, const char *expected, const char *file, int line)
+/*! \fn bool QTest::qCompare(const QPixmap &t1, const QPixmap &t2, const char *actual, const char *expected, const char *file, int line)
\internal
*/
-/*! \fn bool QTest::qCompare(T const &t1, T const &t2, const char *actual, const char *expected, const char *file, int line)
+/*! \fn template <typename T> bool QTest::qCompare(const T &t1, const T &t2, const char *actual, const char *expected, const char *file, int line)
\internal
*/
-/*! \fn bool QTest::qCompare(const T *t1, const T *t2, const char *actual, const char *expected, const char *file, int line)
+/*! \fn template <typename T> bool QTest::qCompare(const T *t1, const T *t2, const char *actual, const char *expected, const char *file, int line)
\internal
*/
-/*! \fn bool QTest::qCompare(T *t, std::nullptr_t, const char *actual, const char *expected, const char *file, int line)
+/*! \fn template <typename T> bool QTest::qCompare(T *t, std::nullptr_t, const char *actual, const char *expected, const char *file, int line)
\internal
*/
-/*! \fn bool QTest::qCompare(std::nullptr_t, T *t, const char *actual, const char *expected, const char *file, int line)
+/*! \fn template <typename T> bool QTest::qCompare(std::nullptr_t, T *t, const char *actual, const char *expected, const char *file, int line)
\internal
*/
-/*! \fn bool QTest::qCompare(T *t1, T *t2, const char *actual, const char *expected, const char *file, int line)
+/*! \fn template <typename T> bool QTest::qCompare(T *t1, T *t2, const char *actual, const char *expected, const char *file, int line)
\internal
*/
-/*! \fn bool QTest::qCompare(const T1 *t1, const T2 *t2, const char *actual, const char *expected, const char *file, int line)
+/*! \fn template <typename T1, typename T2> bool QTest::qCompare(const T1 *t1, const T2 *t2, const char *actual, const char *expected, const char *file, int line)
\internal
*/
-/*! \fn bool QTest::qCompare(T1 *t1, T2 *t2, const char *actual, const char *expected, const char *file, int line)
+/*! \fn template <typename T1, typename T2> bool QTest::qCompare(T1 *t1, T2 *t2, const char *actual, const char *expected, const char *file, int line)
\internal
*/
@@ -2618,55 +2655,55 @@ bool QTest::compare_string_helper(const char *t1, const char *t2, const char *ac
\internal
*/
-/*! \fn bool QTest::qCompare(QString const &t1, QLatin1String const &t2, const char *actual, const char *expected, const char *file, int line)
+/*! \fn bool QTest::qCompare(const QString &t1, const QLatin1String &t2, const char *actual, const char *expected, const char *file, int line)
\internal
*/
-/*! \fn bool QTest::qCompare(QLatin1String const &t1, QString const &t2, const char *actual, const char *expected, const char *file, int line)
+/*! \fn bool QTest::qCompare(const QLatin1String &t1, const QString &t2, const char *actual, const char *expected, const char *file, int line)
\internal
*/
-/*! \fn bool QTest::qCompare(QStringList const &t1, QStringList const &t2, const char *actual, const char *expected, const char *file, int line)
+/*! \fn bool QTest::qCompare(const QStringList &t1, const QStringList &t2, const char *actual, const char *expected, const char *file, int line)
\internal
*/
-/*! \fn bool QTest::qCompare(QList<T> const &t1, QList<T> const &t2, const char *actual, const char *expected, const char *file, int line)
+/*! \fn template <typename T> bool QTest::qCompare(const QList<T> &t1, const QList<T> &t2, const char *actual, const char *expected, const char *file, int line)
\internal
*/
-/*! \fn bool QTest::qCompare(QFlags<T> const &t1, T const &t2, const char *actual, const char *expected, const char *file, int line)
+/*! \fn template <typename T> bool QTest::qCompare(const QFlags<T> &t1, const T &t2, const char *actual, const char *expected, const char *file, int line)
\internal
*/
-/*! \fn bool QTest::qCompare(QFlags<T> const &t1, int const &t2, const char *actual, const char *expected, const char *file, int line)
+/*! \fn template <typename T> bool QTest::qCompare(const QFlags<T> &t1, const int &t2, const char *actual, const char *expected, const char *file, int line)
\internal
*/
-/*! \fn bool QTest::qCompare(qint64 const &t1, qint32 const &t2, const char *actual, const char *expected, const char *file, int line)
+/*! \fn bool QTest::qCompare(const qint64 &t1, const qint32 &t2, const char *actual, const char *expected, const char *file, int line)
\internal
*/
-/*! \fn bool QTest::qCompare(qint64 const &t1, quint32 const &t2, const char *actual, const char *expected, const char *file, int line)
+/*! \fn bool QTest::qCompare(const qint64 &t1, const quint32 &t2, const char *actual, const char *expected, const char *file, int line)
\internal
*/
-/*! \fn bool QTest::qCompare(quint64 const &t1, quint32 const &t2, const char *actual, const char *expected, const char *file, int line)
+/*! \fn bool QTest::qCompare(const quint64 &t1, const quint32 &t2, const char *actual, const char *expected, const char *file, int line)
\internal
*/
-/*! \fn bool QTest::qCompare(qint32 const &t1, qint64 const &t2, const char *actual, const char *expected, const char *file, int line)
+/*! \fn bool QTest::qCompare(const qint32 &t1, const qint64 &t2, const char *actual, const char *expected, const char *file, int line)
\internal
*/
-/*! \fn bool QTest::qCompare(quint32 const &t1, qint64 const &t2, const char *actual, const char *expected, const char *file, int line)
+/*! \fn bool QTest::qCompare(const quint32 &t1, const qint64 &t2, const char *actual, const char *expected, const char *file, int line)
\internal
*/
-/*! \fn bool QTest::qCompare(quint32 const &t1, quint64 const &t2, const char *actual, const char *expected, const char *file, int line)
+/*! \fn bool QTest::qCompare(const quint32 &t1, const quint64 &t2, const char *actual, const char *expected, const char *file, int line)
\internal
*/
-/*! \fn bool QTest::qTest(const T& actual, const char *elementName, const char *actualStr, const char *expected, const char *file, int line)
+/*! \fn template <typename T> bool QTest::qTest(const T& actual, const char *elementName, const char *actualStr, const char *expected, const char *file, int line)
\internal
*/
diff --git a/src/testlib/qtestcase.h b/src/testlib/qtestcase.h
index 2605325a94..f38f7ed4df 100644
--- a/src/testlib/qtestcase.h
+++ b/src/testlib/qtestcase.h
@@ -250,7 +250,7 @@ namespace QTest
template <typename T> // Fallback
inline typename std::enable_if<!QtPrivate::IsQEnumHelper<T>::Value, char*>::type toString(const T &)
{
- return Q_NULLPTR;
+ return nullptr;
}
} // namespace Internal
@@ -273,14 +273,14 @@ namespace QTest
Q_TESTLIB_EXPORT char *toString(const char *);
Q_TESTLIB_EXPORT char *toString(const void *);
- Q_TESTLIB_EXPORT void qInit(QObject *testObject, int argc = 0, char **argv = Q_NULLPTR);
+ Q_TESTLIB_EXPORT void qInit(QObject *testObject, int argc = 0, char **argv = nullptr);
Q_TESTLIB_EXPORT int qRun();
Q_TESTLIB_EXPORT void qCleanup();
- Q_TESTLIB_EXPORT int qExec(QObject *testObject, int argc = 0, char **argv = Q_NULLPTR);
+ Q_TESTLIB_EXPORT int qExec(QObject *testObject, int argc = 0, char **argv = nullptr);
Q_TESTLIB_EXPORT int qExec(QObject *testObject, const QStringList &arguments);
- Q_TESTLIB_EXPORT void setMainSourcePath(const char *file, const char *builddir = Q_NULLPTR);
+ Q_TESTLIB_EXPORT void setMainSourcePath(const char *file, const char *builddir = nullptr);
Q_TESTLIB_EXPORT bool qVerify(bool statement, const char *statementStr, const char *description,
const char *file, int line);
@@ -288,7 +288,7 @@ namespace QTest
Q_TESTLIB_EXPORT void qSkip(const char *message, const char *file, int line);
Q_TESTLIB_EXPORT bool qExpectFail(const char *dataIndex, const char *comment, TestFailMode mode,
const char *file, int line);
- Q_TESTLIB_EXPORT void qWarn(const char *message, const char *file = Q_NULLPTR, int line = 0);
+ Q_TESTLIB_EXPORT void qWarn(const char *message, const char *file = nullptr, int line = 0);
Q_TESTLIB_EXPORT void ignoreMessage(QtMsgType type, const char *message);
#ifndef QT_NO_REGULAREXPRESSION
Q_TESTLIB_EXPORT void ignoreMessage(QtMsgType type, const QRegularExpression &messagePattern);
@@ -297,8 +297,8 @@ namespace QTest
#if QT_CONFIG(temporaryfile)
Q_TESTLIB_EXPORT QSharedPointer<QTemporaryDir> qExtractTestData(const QString &dirName);
#endif
- Q_TESTLIB_EXPORT QString qFindTestData(const char* basepath, const char* file = Q_NULLPTR, int line = 0, const char* builddir = Q_NULLPTR);
- Q_TESTLIB_EXPORT QString qFindTestData(const QString& basepath, const char* file = Q_NULLPTR, int line = 0, const char* builddir = Q_NULLPTR);
+ Q_TESTLIB_EXPORT QString qFindTestData(const char* basepath, const char* file = nullptr, int line = 0, const char* builddir = nullptr);
+ Q_TESTLIB_EXPORT QString qFindTestData(const QString& basepath, const char* file = nullptr, int line = 0, const char* builddir = nullptr);
Q_TESTLIB_EXPORT void *qData(const char *tagName, int typeId);
Q_TESTLIB_EXPORT void *qGlobalData(const char *tagName, int typeId);
diff --git a/src/testlib/qtestcase.qdoc b/src/testlib/qtestcase.qdoc
index 5b90419e28..24bb1c3a97 100644
--- a/src/testlib/qtestcase.qdoc
+++ b/src/testlib/qtestcase.qdoc
@@ -1327,10 +1327,6 @@
// Internals of qtestmouse.h:
-/*! \fn void QTest::waitForEvents()
- \internal
-*/
-
/*! \fn void QTest::mouseEvent(MouseAction action, QWidget *widget, Qt::MouseButton button, Qt::KeyboardModifiers stateKey, QPoint pos, int delay=-1)
\internal
*/
diff --git a/src/testlib/qtesteventloop.h b/src/testlib/qtesteventloop.h
index bcf4a4be2d..81c0b9126c 100644
--- a/src/testlib/qtesteventloop.h
+++ b/src/testlib/qtesteventloop.h
@@ -56,8 +56,8 @@ class Q_TESTLIB_EXPORT QTestEventLoop : public QObject
Q_OBJECT
public:
- inline QTestEventLoop(QObject *aParent = Q_NULLPTR)
- : QObject(aParent), inLoop(false), _timeout(false), timerId(-1), loop(Q_NULLPTR) {}
+ inline QTestEventLoop(QObject *aParent = nullptr)
+ : QObject(aParent), inLoop(false), _timeout(false), timerId(-1), loop(nullptr) {}
inline void enterLoopMSecs(int ms);
inline void enterLoop(int secs) { enterLoopMSecs(secs * 1000); }
@@ -103,7 +103,7 @@ inline void QTestEventLoop::enterLoopMSecs(int ms)
loop = &l;
l.exec();
- loop = Q_NULLPTR;
+ loop = nullptr;
}
inline void QTestEventLoop::exitLoop()
diff --git a/src/testlib/qtestmouse.h b/src/testlib/qtestmouse.h
index 8f55c1801f..fa524fd8ca 100644
--- a/src/testlib/qtestmouse.h
+++ b/src/testlib/qtestmouse.h
@@ -64,7 +64,9 @@
QT_BEGIN_NAMESPACE
-Q_GUI_EXPORT void qt_handleMouseEvent(QWindow *w, const QPointF &local, const QPointF &global, Qt::MouseButtons b, Qt::KeyboardModifiers mods, int timestamp);
+Q_GUI_EXPORT void qt_handleMouseEvent(QWindow *window, const QPointF &local, const QPointF &global,
+ Qt::MouseButtons state, Qt::MouseButton button,
+ QEvent::Type type, Qt::KeyboardModifiers mods, int timestamp);
namespace QTest
{
@@ -78,15 +80,13 @@ namespace QTest
// to depend on platform themes.
static const int mouseDoubleClickInterval = 500;
- static void waitForEvents()
- {
-#ifdef Q_OS_MAC
- QTest::qWait(20);
-#else
- qApp->processEvents();
-#endif
- }
+/*! \internal
+ This function mocks all mouse events by bypassing the windowing system. The
+ result is that the mouse events do not come from the system via Qt platform
+ plugins, but are created on the spot and immediately available for processing
+ by Qt.
+*/
static void mouseEvent(MouseAction action, QWindow *window, Qt::MouseButton button,
Qt::KeyboardModifiers stateKey, QPoint pos, int delay=-1)
{
@@ -120,30 +120,33 @@ namespace QTest
switch (action)
{
case MouseDClick:
- qt_handleMouseEvent(w, pos, global, button, stateKey, ++lastMouseTimestamp);
- qt_handleMouseEvent(w, pos, global, Qt::NoButton, stateKey, ++lastMouseTimestamp);
+ qt_handleMouseEvent(w, pos, global, button, button, QEvent::MouseButtonPress,
+ stateKey, ++lastMouseTimestamp);
+ qt_handleMouseEvent(w, pos, global, Qt::NoButton, button, QEvent::MouseButtonRelease,
+ stateKey, ++lastMouseTimestamp);
Q_FALLTHROUGH();
case MousePress:
case MouseClick:
- qt_handleMouseEvent(w, pos, global, button, stateKey, ++lastMouseTimestamp);
+ qt_handleMouseEvent(w, pos, global, button, button, QEvent::MouseButtonPress,
+ stateKey, ++lastMouseTimestamp);
lastMouseButton = button;
if (action == MousePress)
break;
Q_FALLTHROUGH();
case MouseRelease:
- qt_handleMouseEvent(w, pos, global, Qt::NoButton, stateKey, ++lastMouseTimestamp);
+ qt_handleMouseEvent(w, pos, global, Qt::NoButton, button, QEvent::MouseButtonRelease,
+ stateKey, ++lastMouseTimestamp);
lastMouseTimestamp += mouseDoubleClickInterval; // avoid double clicks being generated
lastMouseButton = Qt::NoButton;
break;
case MouseMove:
- qt_handleMouseEvent(w, pos, global, lastMouseButton, stateKey, ++lastMouseTimestamp);
- // No QCursor::setPos() call here. That could potentially result in mouse events sent by the windowing system
- // which is highly undesired here. Tests must avoid relying on QCursor.
+ qt_handleMouseEvent(w, pos, global, lastMouseButton, Qt::NoButton, QEvent::MouseMove,
+ stateKey, ++lastMouseTimestamp);
break;
default:
QTEST_ASSERT(false);
}
- waitForEvents();
+ qApp->processEvents();
}
inline void mousePress(QWindow *window, Qt::MouseButton button,
diff --git a/src/testlib/qtesttable.cpp b/src/testlib/qtesttable.cpp
index 1afe2f7af5..953495a18a 100644
--- a/src/testlib/qtesttable.cpp
+++ b/src/testlib/qtesttable.cpp
@@ -58,7 +58,7 @@ public:
}
struct Element {
- Element() : name(Q_NULLPTR), type(0) {}
+ Element() : name(nullptr), type(0) {}
Element(const char *n, int t) : name(n), type(t) {}
const char *name;
@@ -130,12 +130,12 @@ int QTestTable::elementTypeId(int index) const
const char *QTestTable::dataTag(int index) const
{
- return size_t(index) < d->elementList.size() ? d->elementList[index].name : Q_NULLPTR;
+ return size_t(index) < d->elementList.size() ? d->elementList[index].name : nullptr;
}
QTestData *QTestTable::testData(int index) const
{
- return size_t(index) < d->dataList.size() ? d->dataList[index] : Q_NULLPTR;
+ return size_t(index) < d->dataList.size() ? d->dataList[index] : nullptr;
}
class NamePredicate : public std::unary_function<QTestTablePrivate::Element, bool>
diff --git a/src/testlib/qtesttouch.h b/src/testlib/qtesttouch.h
index bda185bfee..bdb6d5b629 100644
--- a/src/testlib/qtesttouch.h
+++ b/src/testlib/qtesttouch.h
@@ -75,21 +75,21 @@ namespace QTest
if (commitWhenDestroyed)
commit();
}
- QTouchEventSequence& press(int touchId, const QPoint &pt, QWindow *window = Q_NULLPTR)
+ QTouchEventSequence& press(int touchId, const QPoint &pt, QWindow *window = nullptr)
{
QTouchEvent::TouchPoint &p = point(touchId);
p.setScreenPos(mapToScreen(window, pt));
p.setState(Qt::TouchPointPressed);
return *this;
}
- QTouchEventSequence& move(int touchId, const QPoint &pt, QWindow *window = Q_NULLPTR)
+ QTouchEventSequence& move(int touchId, const QPoint &pt, QWindow *window = nullptr)
{
QTouchEvent::TouchPoint &p = point(touchId);
p.setScreenPos(mapToScreen(window, pt));
p.setState(Qt::TouchPointMoved);
return *this;
}
- QTouchEventSequence& release(int touchId, const QPoint &pt, QWindow *window = Q_NULLPTR)
+ QTouchEventSequence& release(int touchId, const QPoint &pt, QWindow *window = nullptr)
{
QTouchEvent::TouchPoint &p = point(touchId);
p.setScreenPos(mapToScreen(window, pt));
@@ -104,21 +104,21 @@ namespace QTest
}
#ifdef QT_WIDGETS_LIB
- QTouchEventSequence& press(int touchId, const QPoint &pt, QWidget *widget = Q_NULLPTR)
+ QTouchEventSequence& press(int touchId, const QPoint &pt, QWidget *widget = nullptr)
{
QTouchEvent::TouchPoint &p = point(touchId);
p.setScreenPos(mapToScreen(widget, pt));
p.setState(Qt::TouchPointPressed);
return *this;
}
- QTouchEventSequence& move(int touchId, const QPoint &pt, QWidget *widget = Q_NULLPTR)
+ QTouchEventSequence& move(int touchId, const QPoint &pt, QWidget *widget = nullptr)
{
QTouchEvent::TouchPoint &p = point(touchId);
p.setScreenPos(mapToScreen(widget, pt));
p.setState(Qt::TouchPointMoved);
return *this;
}
- QTouchEventSequence& release(int touchId, const QPoint &pt, QWidget *widget = Q_NULLPTR)
+ QTouchEventSequence& release(int touchId, const QPoint &pt, QWidget *widget = nullptr)
{
QTouchEvent::TouchPoint &p = point(touchId);
p.setScreenPos(mapToScreen(widget, pt));
@@ -151,14 +151,14 @@ namespace QTest
private:
#ifdef QT_WIDGETS_LIB
QTouchEventSequence(QWidget *widget, QTouchDevice *aDevice, bool autoCommit)
- : targetWidget(widget), targetWindow(Q_NULLPTR), device(aDevice), commitWhenDestroyed(autoCommit)
+ : targetWidget(widget), targetWindow(nullptr), device(aDevice), commitWhenDestroyed(autoCommit)
{
}
#endif
QTouchEventSequence(QWindow *window, QTouchDevice *aDevice, bool autoCommit)
:
#ifdef QT_WIDGETS_LIB
- targetWidget(Q_NULLPTR),
+ targetWidget(nullptr),
#endif
targetWindow(window), device(aDevice), commitWhenDestroyed(autoCommit)
{
diff --git a/src/testlib/qxctestlogger_p.h b/src/testlib/qxctestlogger_p.h
index 2bbd5ad296..1b641f18af 100644
--- a/src/testlib/qxctestlogger_p.h
+++ b/src/testlib/qxctestlogger_p.h
@@ -65,21 +65,21 @@ class QXcodeTestLogger : public QAbstractTestLogger
{
public:
QXcodeTestLogger();
- ~QXcodeTestLogger() Q_DECL_OVERRIDE;
+ ~QXcodeTestLogger() override;
- void startLogging() Q_DECL_OVERRIDE;
- void stopLogging() Q_DECL_OVERRIDE;
+ void startLogging() override;
+ void stopLogging() override;
- void enterTestFunction(const char *function) Q_DECL_OVERRIDE;
- void leaveTestFunction() Q_DECL_OVERRIDE;
+ void enterTestFunction(const char *function) override;
+ void leaveTestFunction() override;
void addIncident(IncidentTypes type, const char *description,
- const char *file = 0, int line = 0) Q_DECL_OVERRIDE;
+ const char *file = 0, int line = 0) override;
void addMessage(MessageTypes type, const QString &message,
- const char *file = 0, int line = 0) Q_DECL_OVERRIDE;
+ const char *file = 0, int line = 0) override;
- void addBenchmarkResult(const QBenchmarkResult &result) Q_DECL_OVERRIDE;
+ void addBenchmarkResult(const QBenchmarkResult &result) override;
static bool canLogTestProgress();
static int parseCommandLineArgument(const char *argument);
diff --git a/src/tools/bootstrap/bootstrap.pro b/src/tools/bootstrap/bootstrap.pro
index 042ad7adb9..03d5e44405 100644
--- a/src/tools/bootstrap/bootstrap.pro
+++ b/src/tools/bootstrap/bootstrap.pro
@@ -45,6 +45,7 @@ SOURCES += \
../../corelib/io/qiodevice.cpp \
../../corelib/io/qfiledevice.cpp \
../../corelib/io/qresource.cpp \
+ ../../corelib/io/qtemporarydir.cpp \
../../corelib/io/qtemporaryfile.cpp \
../../corelib/io/qtextstream.cpp \
../../corelib/io/qsavefile.cpp \
diff --git a/src/tools/moc/generator.cpp b/src/tools/moc/generator.cpp
index 139f7328af..587a91139d 100644
--- a/src/tools/moc/generator.cpp
+++ b/src/tools/moc/generator.cpp
@@ -1269,7 +1269,7 @@ void Generator::generateStaticMetacall()
continue;
anythingUsed = true;
fprintf(out, " {\n");
- fprintf(out, " typedef %s (%s::*_t)(",f.type.rawName.constData() , cdef->classname.constData());
+ fprintf(out, " using _t = %s (%s::*)(",f.type.rawName.constData() , cdef->classname.constData());
int argsCount = f.arguments.count();
for (int j = 0; j < argsCount; ++j) {
diff --git a/src/tools/rcc/rcc.cpp b/src/tools/rcc/rcc.cpp
index 84fe6ef5c7..92d3c5c171 100644
--- a/src/tools/rcc/rcc.cpp
+++ b/src/tools/rcc/rcc.cpp
@@ -207,7 +207,11 @@ void RCCFileInfo::writeDataInfo(RCCResourceLibrary &lib)
if (lib.formatVersion() >= 2) {
// last modified time stamp
const QDateTime lastModified = m_fileInfo.lastModified();
- lib.writeNumber8(quint64(lastModified.isValid() ? lastModified.toMSecsSinceEpoch() : 0));
+ quint64 lastmod = quint64(lastModified.isValid() ? lastModified.toMSecsSinceEpoch() : 0);
+ static const quint64 sourceDate = 1000 * qgetenv("QT_RCC_SOURCE_DATE_OVERRIDE").toULongLong();
+ if (sourceDate != 0)
+ lastmod = sourceDate;
+ lib.writeNumber8(lastmod);
if (text || pass1)
lib.writeChar('\n');
}
diff --git a/src/tools/uic/cpp/cppwritedeclaration.h b/src/tools/uic/cpp/cppwritedeclaration.h
index ca2122293c..f83bfe8f50 100644
--- a/src/tools/uic/cpp/cppwritedeclaration.h
+++ b/src/tools/uic/cpp/cppwritedeclaration.h
@@ -45,13 +45,13 @@ struct WriteDeclaration : public TreeWalker
{
WriteDeclaration(Uic *uic);
- void acceptUI(DomUI *node) Q_DECL_OVERRIDE;
- void acceptWidget(DomWidget *node) Q_DECL_OVERRIDE;
- void acceptSpacer(DomSpacer *node) Q_DECL_OVERRIDE;
- void acceptLayout(DomLayout *node) Q_DECL_OVERRIDE;
- void acceptActionGroup(DomActionGroup *node) Q_DECL_OVERRIDE;
- void acceptAction(DomAction *node) Q_DECL_OVERRIDE;
- void acceptButtonGroup(const DomButtonGroup *buttonGroup) Q_DECL_OVERRIDE;
+ void acceptUI(DomUI *node) override;
+ void acceptWidget(DomWidget *node) override;
+ void acceptSpacer(DomSpacer *node) override;
+ void acceptLayout(DomLayout *node) override;
+ void acceptActionGroup(DomActionGroup *node) override;
+ void acceptAction(DomAction *node) override;
+ void acceptButtonGroup(const DomButtonGroup *buttonGroup) override;
private:
Uic *m_uic;
diff --git a/src/tools/uic/cpp/cppwriteincludes.h b/src/tools/uic/cpp/cppwriteincludes.h
index 0d9c293efc..f91e1cf8ff 100644
--- a/src/tools/uic/cpp/cppwriteincludes.h
+++ b/src/tools/uic/cpp/cppwriteincludes.h
@@ -49,23 +49,23 @@ struct WriteIncludes : public TreeWalker
{
WriteIncludes(Uic *uic);
- void acceptUI(DomUI *node) Q_DECL_OVERRIDE;
- void acceptWidget(DomWidget *node) Q_DECL_OVERRIDE;
- void acceptLayout(DomLayout *node) Q_DECL_OVERRIDE;
- void acceptSpacer(DomSpacer *node) Q_DECL_OVERRIDE;
- void acceptProperty(DomProperty *node) Q_DECL_OVERRIDE;
+ void acceptUI(DomUI *node) override;
+ void acceptWidget(DomWidget *node) override;
+ void acceptLayout(DomLayout *node) override;
+ void acceptSpacer(DomSpacer *node) override;
+ void acceptProperty(DomProperty *node) override;
//
// custom widgets
//
- void acceptCustomWidgets(DomCustomWidgets *node) Q_DECL_OVERRIDE;
- void acceptCustomWidget(DomCustomWidget *node) Q_DECL_OVERRIDE;
+ void acceptCustomWidgets(DomCustomWidgets *node) override;
+ void acceptCustomWidget(DomCustomWidget *node) override;
//
// include hints
//
- void acceptIncludes(DomIncludes *node) Q_DECL_OVERRIDE;
- void acceptInclude(DomInclude *node) Q_DECL_OVERRIDE;
+ void acceptIncludes(DomIncludes *node) override;
+ void acceptInclude(DomInclude *node) override;
private:
void add(const QString &className, bool determineHeader = true, const QString &header = QString(), bool global = false);
diff --git a/src/tools/uic/cpp/cppwriteinitialization.h b/src/tools/uic/cpp/cppwriteinitialization.h
index b26f51875d..64cbde13f7 100644
--- a/src/tools/uic/cpp/cppwriteinitialization.h
+++ b/src/tools/uic/cpp/cppwriteinitialization.h
@@ -93,41 +93,41 @@ struct WriteInitialization : public TreeWalker
//
// widgets
//
- void acceptUI(DomUI *node) Q_DECL_OVERRIDE;
- void acceptWidget(DomWidget *node) Q_DECL_OVERRIDE;
+ void acceptUI(DomUI *node) override;
+ void acceptWidget(DomWidget *node) override;
- void acceptLayout(DomLayout *node) Q_DECL_OVERRIDE;
- void acceptSpacer(DomSpacer *node) Q_DECL_OVERRIDE;
- void acceptLayoutItem(DomLayoutItem *node) Q_DECL_OVERRIDE;
+ void acceptLayout(DomLayout *node) override;
+ void acceptSpacer(DomSpacer *node) override;
+ void acceptLayoutItem(DomLayoutItem *node) override;
//
// actions
//
- void acceptActionGroup(DomActionGroup *node) Q_DECL_OVERRIDE;
- void acceptAction(DomAction *node) Q_DECL_OVERRIDE;
- void acceptActionRef(DomActionRef *node) Q_DECL_OVERRIDE;
+ void acceptActionGroup(DomActionGroup *node) override;
+ void acceptAction(DomAction *node) override;
+ void acceptActionRef(DomActionRef *node) override;
//
// tab stops
//
- void acceptTabStops(DomTabStops *tabStops) Q_DECL_OVERRIDE;
+ void acceptTabStops(DomTabStops *tabStops) override;
//
// custom widgets
//
- void acceptCustomWidgets(DomCustomWidgets *node) Q_DECL_OVERRIDE;
- void acceptCustomWidget(DomCustomWidget *node) Q_DECL_OVERRIDE;
+ void acceptCustomWidgets(DomCustomWidgets *node) override;
+ void acceptCustomWidget(DomCustomWidget *node) override;
//
// layout defaults/functions
//
- void acceptLayoutDefault(DomLayoutDefault *node) Q_DECL_OVERRIDE { m_LayoutDefaultHandler.acceptLayoutDefault(node); }
- void acceptLayoutFunction(DomLayoutFunction *node) Q_DECL_OVERRIDE { m_LayoutDefaultHandler.acceptLayoutFunction(node); }
+ void acceptLayoutDefault(DomLayoutDefault *node) override { m_LayoutDefaultHandler.acceptLayoutDefault(node); }
+ void acceptLayoutFunction(DomLayoutFunction *node) override { m_LayoutDefaultHandler.acceptLayoutFunction(node); }
//
// signal/slot connections
//
- void acceptConnection(DomConnection *connection) Q_DECL_OVERRIDE;
+ void acceptConnection(DomConnection *connection) override;
enum {
Use43UiFile = 0,
diff --git a/src/tools/uic/customwidgetsinfo.h b/src/tools/uic/customwidgetsinfo.h
index 3ce27d546c..944ed59215 100644
--- a/src/tools/uic/customwidgetsinfo.h
+++ b/src/tools/uic/customwidgetsinfo.h
@@ -43,10 +43,10 @@ class CustomWidgetsInfo : public TreeWalker
public:
CustomWidgetsInfo();
- void acceptUI(DomUI *node) Q_DECL_OVERRIDE;
+ void acceptUI(DomUI *node) override;
- void acceptCustomWidgets(DomCustomWidgets *node) Q_DECL_OVERRIDE;
- void acceptCustomWidget(DomCustomWidget *node) Q_DECL_OVERRIDE;
+ void acceptCustomWidgets(DomCustomWidgets *node) override;
+ void acceptCustomWidget(DomCustomWidget *node) override;
inline QStringList customWidgets() const
{ return m_customWidgets.keys(); }
diff --git a/src/tools/uic/databaseinfo.h b/src/tools/uic/databaseinfo.h
index c313681278..bebf139c5a 100644
--- a/src/tools/uic/databaseinfo.h
+++ b/src/tools/uic/databaseinfo.h
@@ -42,8 +42,8 @@ class DatabaseInfo : public TreeWalker
public:
DatabaseInfo();
- void acceptUI(DomUI *node) Q_DECL_OVERRIDE;
- void acceptWidget(DomWidget *node) Q_DECL_OVERRIDE;
+ void acceptUI(DomUI *node) override;
+ void acceptWidget(DomWidget *node) override;
inline QStringList connections() const
{ return m_connections; }
diff --git a/src/tools/uic/validator.h b/src/tools/uic/validator.h
index e0a99b47ef..f7f7401991 100644
--- a/src/tools/uic/validator.h
+++ b/src/tools/uic/validator.h
@@ -43,14 +43,14 @@ struct Validator : public TreeWalker
{
Validator(Uic *uic);
- void acceptUI(DomUI *node) Q_DECL_OVERRIDE;
- void acceptWidget(DomWidget *node) Q_DECL_OVERRIDE;
+ void acceptUI(DomUI *node) override;
+ void acceptWidget(DomWidget *node) override;
- void acceptLayoutItem(DomLayoutItem *node) Q_DECL_OVERRIDE;
- void acceptLayout(DomLayout *node) Q_DECL_OVERRIDE;
+ void acceptLayoutItem(DomLayoutItem *node) override;
+ void acceptLayout(DomLayout *node) override;
- void acceptActionGroup(DomActionGroup *node) Q_DECL_OVERRIDE;
- void acceptAction(DomAction *node) Q_DECL_OVERRIDE;
+ void acceptActionGroup(DomActionGroup *node) override;
+ void acceptAction(DomAction *node) override;
private:
Driver *m_driver;
diff --git a/src/widgets/accessible/complexwidgets.cpp b/src/widgets/accessible/complexwidgets.cpp
index 0f88554415..6cdc06d702 100644
--- a/src/widgets/accessible/complexwidgets.cpp
+++ b/src/widgets/accessible/complexwidgets.cpp
@@ -93,16 +93,16 @@ public:
: m_parent(parent), m_index(index)
{}
- void *interface_cast(QAccessible::InterfaceType t) Q_DECL_OVERRIDE {
+ void *interface_cast(QAccessible::InterfaceType t) override {
if (t == QAccessible::ActionInterface) {
return static_cast<QAccessibleActionInterface*>(this);
}
return 0;
}
- QObject *object() const Q_DECL_OVERRIDE { return 0; }
- QAccessible::Role role() const Q_DECL_OVERRIDE { return QAccessible::PageTab; }
- QAccessible::State state() const Q_DECL_OVERRIDE {
+ QObject *object() const override { return 0; }
+ QAccessible::Role role() const override { return QAccessible::PageTab; }
+ QAccessible::State state() const override {
if (!isValid()) {
QAccessible::State s;
s.invalid = true;
@@ -110,7 +110,7 @@ public:
}
return parent()->state();
}
- QRect rect() const Q_DECL_OVERRIDE {
+ QRect rect() const override {
if (!isValid())
return QRect();
@@ -120,13 +120,13 @@ public:
return rec;
}
- bool isValid() const Q_DECL_OVERRIDE { return m_parent.data() && m_parent->count() > m_index; }
+ bool isValid() const override { return m_parent.data() && m_parent->count() > m_index; }
- QAccessibleInterface *childAt(int, int) const Q_DECL_OVERRIDE { return 0; }
- int childCount() const Q_DECL_OVERRIDE { return 0; }
- int indexOfChild(const QAccessibleInterface *) const Q_DECL_OVERRIDE { return -1; }
+ QAccessibleInterface *childAt(int, int) const override { return 0; }
+ int childCount() const override { return 0; }
+ int indexOfChild(const QAccessibleInterface *) const override { return -1; }
- QString text(QAccessible::Text t) const Q_DECL_OVERRIDE
+ QString text(QAccessible::Text t) const override
{
if (!isValid())
return QString();
@@ -156,26 +156,26 @@ public:
return str;
}
- void setText(QAccessible::Text, const QString &) Q_DECL_OVERRIDE {}
+ void setText(QAccessible::Text, const QString &) override {}
- QAccessibleInterface *parent() const Q_DECL_OVERRIDE {
+ QAccessibleInterface *parent() const override {
return QAccessible::queryAccessibleInterface(m_parent.data());
}
- QAccessibleInterface *child(int) const Q_DECL_OVERRIDE { return 0; }
+ QAccessibleInterface *child(int) const override { return 0; }
// action interface
- QStringList actionNames() const Q_DECL_OVERRIDE
+ QStringList actionNames() const override
{
return QStringList(pressAction());
}
- void doAction(const QString &actionName) Q_DECL_OVERRIDE
+ void doAction(const QString &actionName) override
{
if (isValid() && actionName == pressAction())
m_parent->setCurrentIndex(m_index);
}
- QStringList keyBindingsForAction(const QString &) const Q_DECL_OVERRIDE
+ QStringList keyBindingsForAction(const QString &) const override
{
return QStringList();
}
diff --git a/src/widgets/accessible/complexwidgets_p.h b/src/widgets/accessible/complexwidgets_p.h
index 1887f98dca..96db2dab70 100644
--- a/src/widgets/accessible/complexwidgets_p.h
+++ b/src/widgets/accessible/complexwidgets_p.h
@@ -85,11 +85,11 @@ public:
Undefined
};
- QAccessibleInterface *child(int index) const Q_DECL_OVERRIDE;
- int childCount() const Q_DECL_OVERRIDE;
- int indexOfChild(const QAccessibleInterface *child) const Q_DECL_OVERRIDE;
- bool isValid() const Q_DECL_OVERRIDE;
- QAccessibleInterface *childAt(int x, int y) const Q_DECL_OVERRIDE;
+ QAccessibleInterface *child(int index) const override;
+ int childCount() const override;
+ int indexOfChild(const QAccessibleInterface *child) const override;
+ bool isValid() const override;
+ QAccessibleInterface *childAt(int x, int y) const override;
//protected:
QAbstractScrollArea *abstractScrollArea() const;
@@ -114,11 +114,11 @@ public:
explicit QAccessibleTabBar(QWidget *w);
~QAccessibleTabBar();
- int childCount() const Q_DECL_OVERRIDE;
- QString text(QAccessible::Text t) const Q_DECL_OVERRIDE;
+ int childCount() const override;
+ QString text(QAccessible::Text t) const override;
- QAccessibleInterface* child(int index) const Q_DECL_OVERRIDE;
- int indexOfChild(const QAccessibleInterface *child) const Q_DECL_OVERRIDE;
+ QAccessibleInterface* child(int index) const override;
+ int indexOfChild(const QAccessibleInterface *child) const override;
protected:
QTabBar *tabBar() const;
@@ -132,18 +132,18 @@ class QAccessibleComboBox : public QAccessibleWidget
public:
explicit QAccessibleComboBox(QWidget *w);
- int childCount() const Q_DECL_OVERRIDE;
- QAccessibleInterface *childAt(int x, int y) const Q_DECL_OVERRIDE;
- int indexOfChild(const QAccessibleInterface *child) const Q_DECL_OVERRIDE;
- QAccessibleInterface* child(int index) const Q_DECL_OVERRIDE;
+ int childCount() const override;
+ QAccessibleInterface *childAt(int x, int y) const override;
+ int indexOfChild(const QAccessibleInterface *child) const override;
+ QAccessibleInterface* child(int index) const override;
- QString text(QAccessible::Text t) const Q_DECL_OVERRIDE;
+ QString text(QAccessible::Text t) const override;
// QAccessibleActionInterface
- QStringList actionNames() const Q_DECL_OVERRIDE;
- QString localizedActionDescription(const QString &actionName) const Q_DECL_OVERRIDE;
- void doAction(const QString &actionName) Q_DECL_OVERRIDE;
- QStringList keyBindingsForAction(const QString &actionName) const Q_DECL_OVERRIDE;
+ QStringList actionNames() const override;
+ QString localizedActionDescription(const QString &actionName) const override;
+ void doAction(const QString &actionName) override;
+ QStringList keyBindingsForAction(const QString &actionName) const override;
protected:
QComboBox *comboBox() const;
diff --git a/src/widgets/accessible/itemviews_p.h b/src/widgets/accessible/itemviews_p.h
index 72841b8a0f..683ae9c948 100644
--- a/src/widgets/accessible/itemviews_p.h
+++ b/src/widgets/accessible/itemviews_p.h
@@ -71,48 +71,48 @@ class QAccessibleTable :public QAccessibleTableInterface, public QAccessibleObje
{
public:
explicit QAccessibleTable(QWidget *w);
- bool isValid() const Q_DECL_OVERRIDE;
+ bool isValid() const override;
- QAccessible::Role role() const Q_DECL_OVERRIDE;
- QAccessible::State state() const Q_DECL_OVERRIDE;
- QString text(QAccessible::Text t) const Q_DECL_OVERRIDE;
- QRect rect() const Q_DECL_OVERRIDE;
+ QAccessible::Role role() const override;
+ QAccessible::State state() const override;
+ QString text(QAccessible::Text t) const override;
+ QRect rect() const override;
- QAccessibleInterface *childAt(int x, int y) const Q_DECL_OVERRIDE;
- int childCount() const Q_DECL_OVERRIDE;
- int indexOfChild(const QAccessibleInterface *) const Q_DECL_OVERRIDE;
+ QAccessibleInterface *childAt(int x, int y) const override;
+ int childCount() const override;
+ int indexOfChild(const QAccessibleInterface *) const override;
- QAccessibleInterface *parent() const Q_DECL_OVERRIDE;
- QAccessibleInterface *child(int index) const Q_DECL_OVERRIDE;
+ QAccessibleInterface *parent() const override;
+ QAccessibleInterface *child(int index) const override;
- void *interface_cast(QAccessible::InterfaceType t) Q_DECL_OVERRIDE;
+ void *interface_cast(QAccessible::InterfaceType t) override;
// table interface
- virtual QAccessibleInterface *cellAt(int row, int column) const Q_DECL_OVERRIDE;
- virtual QAccessibleInterface *caption() const Q_DECL_OVERRIDE;
- virtual QAccessibleInterface *summary() const Q_DECL_OVERRIDE;
- virtual QString columnDescription(int column) const Q_DECL_OVERRIDE;
- virtual QString rowDescription(int row) const Q_DECL_OVERRIDE;
- virtual int columnCount() const Q_DECL_OVERRIDE;
- virtual int rowCount() const Q_DECL_OVERRIDE;
+ virtual QAccessibleInterface *cellAt(int row, int column) const override;
+ virtual QAccessibleInterface *caption() const override;
+ virtual QAccessibleInterface *summary() const override;
+ virtual QString columnDescription(int column) const override;
+ virtual QString rowDescription(int row) const override;
+ virtual int columnCount() const override;
+ virtual int rowCount() const override;
// selection
- virtual int selectedCellCount() const Q_DECL_OVERRIDE;
- virtual int selectedColumnCount() const Q_DECL_OVERRIDE;
- virtual int selectedRowCount() const Q_DECL_OVERRIDE;
- virtual QList<QAccessibleInterface*> selectedCells() const Q_DECL_OVERRIDE;
- virtual QList<int> selectedColumns() const Q_DECL_OVERRIDE;
- virtual QList<int> selectedRows() const Q_DECL_OVERRIDE;
- virtual bool isColumnSelected(int column) const Q_DECL_OVERRIDE;
- virtual bool isRowSelected(int row) const Q_DECL_OVERRIDE;
- virtual bool selectRow(int row) Q_DECL_OVERRIDE;
- virtual bool selectColumn(int column) Q_DECL_OVERRIDE;
- virtual bool unselectRow(int row) Q_DECL_OVERRIDE;
- virtual bool unselectColumn(int column) Q_DECL_OVERRIDE;
+ virtual int selectedCellCount() const override;
+ virtual int selectedColumnCount() const override;
+ virtual int selectedRowCount() const override;
+ virtual QList<QAccessibleInterface*> selectedCells() const override;
+ virtual QList<int> selectedColumns() const override;
+ virtual QList<int> selectedRows() const override;
+ virtual bool isColumnSelected(int column) const override;
+ virtual bool isRowSelected(int row) const override;
+ virtual bool selectRow(int row) override;
+ virtual bool selectColumn(int column) override;
+ virtual bool unselectRow(int row) override;
+ virtual bool unselectColumn(int column) override;
QAbstractItemView *view() const;
- void modelChange(QAccessibleTableModelChangeEvent *event) Q_DECL_OVERRIDE;
+ void modelChange(QAccessibleTableModelChangeEvent *event) override;
protected:
inline QAccessible::Role cellRole() const {
@@ -153,19 +153,19 @@ public:
{}
- QAccessibleInterface *childAt(int x, int y) const Q_DECL_OVERRIDE;
- int childCount() const Q_DECL_OVERRIDE;
- QAccessibleInterface *child(int index) const Q_DECL_OVERRIDE;
+ QAccessibleInterface *childAt(int x, int y) const override;
+ int childCount() const override;
+ QAccessibleInterface *child(int index) const override;
- int indexOfChild(const QAccessibleInterface *) const Q_DECL_OVERRIDE;
+ int indexOfChild(const QAccessibleInterface *) const override;
- int rowCount() const Q_DECL_OVERRIDE;
+ int rowCount() const override;
// table interface
- QAccessibleInterface *cellAt(int row, int column) const Q_DECL_OVERRIDE;
- QString rowDescription(int row) const Q_DECL_OVERRIDE;
- bool isRowSelected(int row) const Q_DECL_OVERRIDE;
- bool selectRow(int row) Q_DECL_OVERRIDE;
+ QAccessibleInterface *cellAt(int row, int column) const override;
+ QString rowDescription(int row) const override;
+ bool isRowSelected(int row) const override;
+ bool selectRow(int row) override;
private:
QModelIndex indexFromLogical(int row, int column = 0) const;
@@ -179,37 +179,37 @@ class QAccessibleTableCell: public QAccessibleInterface, public QAccessibleTable
public:
QAccessibleTableCell(QAbstractItemView *view, const QModelIndex &m_index, QAccessible::Role role);
- void *interface_cast(QAccessible::InterfaceType t) Q_DECL_OVERRIDE;
- QObject *object() const Q_DECL_OVERRIDE { return Q_NULLPTR; }
- QAccessible::Role role() const Q_DECL_OVERRIDE;
- QAccessible::State state() const Q_DECL_OVERRIDE;
- QRect rect() const Q_DECL_OVERRIDE;
- bool isValid() const Q_DECL_OVERRIDE;
+ void *interface_cast(QAccessible::InterfaceType t) override;
+ QObject *object() const override { return nullptr; }
+ QAccessible::Role role() const override;
+ QAccessible::State state() const override;
+ QRect rect() const override;
+ bool isValid() const override;
- QAccessibleInterface *childAt(int, int) const Q_DECL_OVERRIDE { return Q_NULLPTR; }
- int childCount() const Q_DECL_OVERRIDE { return 0; }
- int indexOfChild(const QAccessibleInterface *) const Q_DECL_OVERRIDE { return -1; }
+ QAccessibleInterface *childAt(int, int) const override { return nullptr; }
+ int childCount() const override { return 0; }
+ int indexOfChild(const QAccessibleInterface *) const override { return -1; }
- QString text(QAccessible::Text t) const Q_DECL_OVERRIDE;
- void setText(QAccessible::Text t, const QString &text) Q_DECL_OVERRIDE;
+ QString text(QAccessible::Text t) const override;
+ void setText(QAccessible::Text t, const QString &text) override;
- QAccessibleInterface *parent() const Q_DECL_OVERRIDE;
- QAccessibleInterface *child(int) const Q_DECL_OVERRIDE;
+ QAccessibleInterface *parent() const override;
+ QAccessibleInterface *child(int) const override;
// cell interface
- virtual int columnExtent() const Q_DECL_OVERRIDE;
- virtual QList<QAccessibleInterface*> columnHeaderCells() const Q_DECL_OVERRIDE;
- virtual int columnIndex() const Q_DECL_OVERRIDE;
- virtual int rowExtent() const Q_DECL_OVERRIDE;
- virtual QList<QAccessibleInterface*> rowHeaderCells() const Q_DECL_OVERRIDE;
- virtual int rowIndex() const Q_DECL_OVERRIDE;
- virtual bool isSelected() const Q_DECL_OVERRIDE;
- virtual QAccessibleInterface* table() const Q_DECL_OVERRIDE;
+ virtual int columnExtent() const override;
+ virtual QList<QAccessibleInterface*> columnHeaderCells() const override;
+ virtual int columnIndex() const override;
+ virtual int rowExtent() const override;
+ virtual QList<QAccessibleInterface*> rowHeaderCells() const override;
+ virtual int rowIndex() const override;
+ virtual bool isSelected() const override;
+ virtual QAccessibleInterface* table() const override;
//action interface
- virtual QStringList actionNames() const Q_DECL_OVERRIDE;
- virtual void doAction(const QString &actionName) Q_DECL_OVERRIDE;
- virtual QStringList keyBindingsForAction(const QString &actionName) const Q_DECL_OVERRIDE;
+ virtual QStringList actionNames() const override;
+ virtual void doAction(const QString &actionName) override;
+ virtual QStringList keyBindingsForAction(const QString &actionName) const override;
private:
QHeaderView *verticalHeader() const;
@@ -234,21 +234,21 @@ public:
// For header cells, pass the header view in addition
QAccessibleTableHeaderCell(QAbstractItemView *view, int index, Qt::Orientation orientation);
- QObject *object() const Q_DECL_OVERRIDE { return Q_NULLPTR; }
- QAccessible::Role role() const Q_DECL_OVERRIDE;
- QAccessible::State state() const Q_DECL_OVERRIDE;
- QRect rect() const Q_DECL_OVERRIDE;
- bool isValid() const Q_DECL_OVERRIDE;
+ QObject *object() const override { return nullptr; }
+ QAccessible::Role role() const override;
+ QAccessible::State state() const override;
+ QRect rect() const override;
+ bool isValid() const override;
- QAccessibleInterface *childAt(int, int) const Q_DECL_OVERRIDE { return Q_NULLPTR; }
- int childCount() const Q_DECL_OVERRIDE { return 0; }
- int indexOfChild(const QAccessibleInterface *) const Q_DECL_OVERRIDE { return -1; }
+ QAccessibleInterface *childAt(int, int) const override { return nullptr; }
+ int childCount() const override { return 0; }
+ int indexOfChild(const QAccessibleInterface *) const override { return -1; }
- QString text(QAccessible::Text t) const Q_DECL_OVERRIDE;
- void setText(QAccessible::Text t, const QString &text) Q_DECL_OVERRIDE;
+ QString text(QAccessible::Text t) const override;
+ void setText(QAccessible::Text t, const QString &text) override;
- QAccessibleInterface *parent() const Q_DECL_OVERRIDE;
- QAccessibleInterface *child(int index) const Q_DECL_OVERRIDE;
+ QAccessibleInterface *parent() const override;
+ QAccessibleInterface *child(int index) const override;
private:
QHeaderView *headerView() const;
@@ -273,24 +273,24 @@ public:
:view(view_)
{}
- QObject *object() const Q_DECL_OVERRIDE { return Q_NULLPTR; }
- QAccessible::Role role() const Q_DECL_OVERRIDE { return QAccessible::Pane; }
- QAccessible::State state() const Q_DECL_OVERRIDE { return QAccessible::State(); }
- QRect rect() const Q_DECL_OVERRIDE { return QRect(); }
- bool isValid() const Q_DECL_OVERRIDE { return true; }
+ QObject *object() const override { return nullptr; }
+ QAccessible::Role role() const override { return QAccessible::Pane; }
+ QAccessible::State state() const override { return QAccessible::State(); }
+ QRect rect() const override { return QRect(); }
+ bool isValid() const override { return true; }
- QAccessibleInterface *childAt(int, int) const Q_DECL_OVERRIDE { return Q_NULLPTR; }
- int childCount() const Q_DECL_OVERRIDE { return 0; }
- int indexOfChild(const QAccessibleInterface *) const Q_DECL_OVERRIDE { return -1; }
+ QAccessibleInterface *childAt(int, int) const override { return nullptr; }
+ int childCount() const override { return 0; }
+ int indexOfChild(const QAccessibleInterface *) const override { return -1; }
- QString text(QAccessible::Text) const Q_DECL_OVERRIDE { return QString(); }
- void setText(QAccessible::Text, const QString &) Q_DECL_OVERRIDE {}
+ QString text(QAccessible::Text) const override { return QString(); }
+ void setText(QAccessible::Text, const QString &) override {}
- QAccessibleInterface *parent() const Q_DECL_OVERRIDE {
+ QAccessibleInterface *parent() const override {
return QAccessible::queryAccessibleInterface(view);
}
- QAccessibleInterface *child(int) const Q_DECL_OVERRIDE {
- return Q_NULLPTR;
+ QAccessibleInterface *child(int) const override {
+ return nullptr;
}
private:
diff --git a/src/widgets/accessible/qaccessiblemenu.cpp b/src/widgets/accessible/qaccessiblemenu.cpp
index d20c5bfc71..8b3353f625 100644
--- a/src/widgets/accessible/qaccessiblemenu.cpp
+++ b/src/widgets/accessible/qaccessiblemenu.cpp
@@ -242,7 +242,7 @@ QObject *QAccessibleMenuItem::object() const
/*! \reimp */
QWindow *QAccessibleMenuItem::window() const
{
- QWindow *result = Q_NULLPTR;
+ QWindow *result = nullptr;
if (!m_owner.isNull()) {
result = m_owner->windowHandle();
if (!result) {
diff --git a/src/widgets/accessible/qaccessiblemenu_p.h b/src/widgets/accessible/qaccessiblemenu_p.h
index 8b37e23333..9acd2a42f9 100644
--- a/src/widgets/accessible/qaccessiblemenu_p.h
+++ b/src/widgets/accessible/qaccessiblemenu_p.h
@@ -69,14 +69,14 @@ class QAccessibleMenu : public QAccessibleWidget
public:
explicit QAccessibleMenu(QWidget *w);
- int childCount() const Q_DECL_OVERRIDE;
- QAccessibleInterface *childAt(int x, int y) const Q_DECL_OVERRIDE;
+ int childCount() const override;
+ QAccessibleInterface *childAt(int x, int y) const override;
- QString text(QAccessible::Text t) const Q_DECL_OVERRIDE;
- QAccessible::Role role() const Q_DECL_OVERRIDE;
- QAccessibleInterface *child(int index) const Q_DECL_OVERRIDE;
- QAccessibleInterface *parent() const Q_DECL_OVERRIDE;
- int indexOfChild( const QAccessibleInterface *child ) const Q_DECL_OVERRIDE;
+ QString text(QAccessible::Text t) const override;
+ QAccessible::Role role() const override;
+ QAccessibleInterface *child(int index) const override;
+ QAccessibleInterface *parent() const override;
+ int indexOfChild( const QAccessibleInterface *child ) const override;
protected:
QMenu *menu() const;
@@ -88,10 +88,10 @@ class QAccessibleMenuBar : public QAccessibleWidget
public:
explicit QAccessibleMenuBar(QWidget *w);
- QAccessibleInterface *child(int index) const Q_DECL_OVERRIDE;
- int childCount() const Q_DECL_OVERRIDE;
+ QAccessibleInterface *child(int index) const override;
+ int childCount() const override;
- int indexOfChild(const QAccessibleInterface *child) const Q_DECL_OVERRIDE;
+ int indexOfChild(const QAccessibleInterface *child) const override;
protected:
QMenuBar *menuBar() const;
@@ -105,28 +105,28 @@ public:
explicit QAccessibleMenuItem(QWidget *owner, QAction *w);
~QAccessibleMenuItem();
- void *interface_cast(QAccessible::InterfaceType t) Q_DECL_OVERRIDE;
+ void *interface_cast(QAccessible::InterfaceType t) override;
- int childCount() const Q_DECL_OVERRIDE;
- QAccessibleInterface *childAt(int x, int y) const Q_DECL_OVERRIDE;
- bool isValid() const Q_DECL_OVERRIDE;
- int indexOfChild(const QAccessibleInterface * child) const Q_DECL_OVERRIDE;
+ int childCount() const override;
+ QAccessibleInterface *childAt(int x, int y) const override;
+ bool isValid() const override;
+ int indexOfChild(const QAccessibleInterface * child) const override;
- QAccessibleInterface *parent() const Q_DECL_OVERRIDE;
- QAccessibleInterface *child(int index) const Q_DECL_OVERRIDE;
- QObject * object() const Q_DECL_OVERRIDE;
- QWindow *window() const Q_DECL_OVERRIDE;
+ QAccessibleInterface *parent() const override;
+ QAccessibleInterface *child(int index) const override;
+ QObject * object() const override;
+ QWindow *window() const override;
- QRect rect() const Q_DECL_OVERRIDE;
- QAccessible::Role role() const Q_DECL_OVERRIDE;
- void setText(QAccessible::Text t, const QString & text) Q_DECL_OVERRIDE;
- QAccessible::State state() const Q_DECL_OVERRIDE;
- QString text(QAccessible::Text t) const Q_DECL_OVERRIDE;
+ QRect rect() const override;
+ QAccessible::Role role() const override;
+ void setText(QAccessible::Text t, const QString & text) override;
+ QAccessible::State state() const override;
+ QString text(QAccessible::Text t) const override;
// QAccessibleActionInterface
- QStringList actionNames() const Q_DECL_OVERRIDE;
- void doAction(const QString &actionName) Q_DECL_OVERRIDE;
- QStringList keyBindingsForAction(const QString &actionName) const Q_DECL_OVERRIDE;
+ QStringList actionNames() const override;
+ void doAction(const QString &actionName) override;
+ QStringList keyBindingsForAction(const QString &actionName) const override;
QWidget *owner() const;
protected:
diff --git a/src/widgets/accessible/qaccessiblewidget.h b/src/widgets/accessible/qaccessiblewidget.h
index e09c3ff489..63789a595f 100644
--- a/src/widgets/accessible/qaccessiblewidget.h
+++ b/src/widgets/accessible/qaccessiblewidget.h
@@ -54,32 +54,32 @@ class Q_WIDGETS_EXPORT QAccessibleWidget : public QAccessibleObject, public QAcc
{
public:
explicit QAccessibleWidget(QWidget *o, QAccessible::Role r = QAccessible::Client, const QString& name = QString());
- bool isValid() const Q_DECL_OVERRIDE;
+ bool isValid() const override;
- QWindow *window() const Q_DECL_OVERRIDE;
- int childCount() const Q_DECL_OVERRIDE;
- int indexOfChild(const QAccessibleInterface *child) const Q_DECL_OVERRIDE;
- QVector<QPair<QAccessibleInterface*, QAccessible::Relation> > relations(QAccessible::Relation match = QAccessible::AllRelations) const Q_DECL_OVERRIDE;
- QAccessibleInterface *focusChild() const Q_DECL_OVERRIDE;
+ QWindow *window() const override;
+ int childCount() const override;
+ int indexOfChild(const QAccessibleInterface *child) const override;
+ QVector<QPair<QAccessibleInterface*, QAccessible::Relation> > relations(QAccessible::Relation match = QAccessible::AllRelations) const override;
+ QAccessibleInterface *focusChild() const override;
- QRect rect() const Q_DECL_OVERRIDE;
+ QRect rect() const override;
- QAccessibleInterface *parent() const Q_DECL_OVERRIDE;
- QAccessibleInterface *child(int index) const Q_DECL_OVERRIDE;
+ QAccessibleInterface *parent() const override;
+ QAccessibleInterface *child(int index) const override;
- QString text(QAccessible::Text t) const Q_DECL_OVERRIDE;
- QAccessible::Role role() const Q_DECL_OVERRIDE;
- QAccessible::State state() const Q_DECL_OVERRIDE;
+ QString text(QAccessible::Text t) const override;
+ QAccessible::Role role() const override;
+ QAccessible::State state() const override;
- QColor foregroundColor() const Q_DECL_OVERRIDE;
- QColor backgroundColor() const Q_DECL_OVERRIDE;
+ QColor foregroundColor() const override;
+ QColor backgroundColor() const override;
- void *interface_cast(QAccessible::InterfaceType t) Q_DECL_OVERRIDE;
+ void *interface_cast(QAccessible::InterfaceType t) override;
// QAccessibleActionInterface
- QStringList actionNames() const Q_DECL_OVERRIDE;
- void doAction(const QString &actionName) Q_DECL_OVERRIDE;
- QStringList keyBindingsForAction(const QString &actionName) const Q_DECL_OVERRIDE;
+ QStringList actionNames() const override;
+ void doAction(const QString &actionName) override;
+ QStringList keyBindingsForAction(const QString &actionName) const override;
protected:
~QAccessibleWidget();
QWidget *widget() const;
diff --git a/src/widgets/accessible/qaccessiblewidgets.cpp b/src/widgets/accessible/qaccessiblewidgets.cpp
index f869ab1129..872ddcded5 100644
--- a/src/widgets/accessible/qaccessiblewidgets.cpp
+++ b/src/widgets/accessible/qaccessiblewidgets.cpp
@@ -716,7 +716,7 @@ QRect QAccessibleTextWidget::characterRect(int offset) const
QFontMetrics fm(format.font());
const QString ch = text(offset, offset + 1);
if (!ch.isEmpty()) {
- int w = fm.width(ch);
+ int w = fm.horizontalAdvance(ch);
int h = fm.height();
r = QRect(layoutPosition.x() + x, layoutPosition.y() + line.y() + line.ascent() + fm.descent() - h,
w, h);
diff --git a/src/widgets/accessible/qaccessiblewidgets_p.h b/src/widgets/accessible/qaccessiblewidgets_p.h
index 75e1eff694..87f0b888a0 100644
--- a/src/widgets/accessible/qaccessiblewidgets_p.h
+++ b/src/widgets/accessible/qaccessiblewidgets_p.h
@@ -85,40 +85,40 @@ class QAccessibleTextWidget : public QAccessibleWidget,
public:
QAccessibleTextWidget(QWidget *o, QAccessible::Role r = QAccessible::EditableText, const QString &name = QString());
- QAccessible::State state() const Q_DECL_OVERRIDE;
+ QAccessible::State state() const override;
// QAccessibleTextInterface
// selection
- void selection(int selectionIndex, int *startOffset, int *endOffset) const Q_DECL_OVERRIDE;
- int selectionCount() const Q_DECL_OVERRIDE;
- void addSelection(int startOffset, int endOffset) Q_DECL_OVERRIDE;
- void removeSelection(int selectionIndex) Q_DECL_OVERRIDE;
- void setSelection(int selectionIndex, int startOffset, int endOffset) Q_DECL_OVERRIDE;
+ void selection(int selectionIndex, int *startOffset, int *endOffset) const override;
+ int selectionCount() const override;
+ void addSelection(int startOffset, int endOffset) override;
+ void removeSelection(int selectionIndex) override;
+ void setSelection(int selectionIndex, int startOffset, int endOffset) override;
// cursor
- int cursorPosition() const Q_DECL_OVERRIDE;
- void setCursorPosition(int position) Q_DECL_OVERRIDE;
+ int cursorPosition() const override;
+ void setCursorPosition(int position) override;
// text
- QString text(int startOffset, int endOffset) const Q_DECL_OVERRIDE;
+ QString text(int startOffset, int endOffset) const override;
QString textBeforeOffset(int offset, QAccessible::TextBoundaryType boundaryType,
- int *startOffset, int *endOffset) const Q_DECL_OVERRIDE;
+ int *startOffset, int *endOffset) const override;
QString textAfterOffset(int offset, QAccessible::TextBoundaryType boundaryType,
- int *startOffset, int *endOffset) const Q_DECL_OVERRIDE;
+ int *startOffset, int *endOffset) const override;
QString textAtOffset(int offset, QAccessible::TextBoundaryType boundaryType,
- int *startOffset, int *endOffset) const Q_DECL_OVERRIDE;
- int characterCount() const Q_DECL_OVERRIDE;
+ int *startOffset, int *endOffset) const override;
+ int characterCount() const override;
// character <-> geometry
- QRect characterRect(int offset) const Q_DECL_OVERRIDE;
- int offsetAtPoint(const QPoint &point) const Q_DECL_OVERRIDE;
+ QRect characterRect(int offset) const override;
+ int offsetAtPoint(const QPoint &point) const override;
- QString attributes(int offset, int *startOffset, int *endOffset) const Q_DECL_OVERRIDE;
+ QString attributes(int offset, int *startOffset, int *endOffset) const override;
// QAccessibleEditableTextInterface
- void deleteText(int startOffset, int endOffset) Q_DECL_OVERRIDE;
- void insertText(int offset, const QString &text) Q_DECL_OVERRIDE;
- void replaceText(int startOffset, int endOffset, const QString &text) Q_DECL_OVERRIDE;
+ void deleteText(int startOffset, int endOffset) override;
+ void insertText(int offset, const QString &text) override;
+ void replaceText(int startOffset, int endOffset, const QString &text) override;
using QAccessibleWidget::text;
@@ -138,25 +138,25 @@ class QAccessiblePlainTextEdit : public QAccessibleTextWidget
public:
explicit QAccessiblePlainTextEdit(QWidget *o);
- QString text(QAccessible::Text t) const Q_DECL_OVERRIDE;
- void setText(QAccessible::Text t, const QString &text) Q_DECL_OVERRIDE;
- QAccessible::State state() const Q_DECL_OVERRIDE;
+ QString text(QAccessible::Text t) const override;
+ void setText(QAccessible::Text t, const QString &text) override;
+ QAccessible::State state() const override;
- void *interface_cast(QAccessible::InterfaceType t) Q_DECL_OVERRIDE;
+ void *interface_cast(QAccessible::InterfaceType t) override;
// QAccessibleTextInterface
- void scrollToSubstring(int startIndex, int endIndex) Q_DECL_OVERRIDE;
+ void scrollToSubstring(int startIndex, int endIndex) override;
using QAccessibleTextWidget::text;
protected:
QPlainTextEdit *plainTextEdit() const;
- QPoint scrollBarPosition() const Q_DECL_OVERRIDE;
- QTextCursor textCursor() const Q_DECL_OVERRIDE;
- void setTextCursor(const QTextCursor &textCursor) Q_DECL_OVERRIDE;
- QTextDocument *textDocument() const Q_DECL_OVERRIDE;
- QWidget *viewport() const Q_DECL_OVERRIDE;
+ QPoint scrollBarPosition() const override;
+ QTextCursor textCursor() const override;
+ void setTextCursor(const QTextCursor &textCursor) override;
+ QTextDocument *textDocument() const override;
+ QWidget *viewport() const override;
};
class QAccessibleTextEdit : public QAccessibleTextWidget
@@ -164,25 +164,25 @@ class QAccessibleTextEdit : public QAccessibleTextWidget
public:
explicit QAccessibleTextEdit(QWidget *o);
- QString text(QAccessible::Text t) const Q_DECL_OVERRIDE;
- void setText(QAccessible::Text t, const QString &text) Q_DECL_OVERRIDE;
- QAccessible::State state() const Q_DECL_OVERRIDE;
+ QString text(QAccessible::Text t) const override;
+ void setText(QAccessible::Text t, const QString &text) override;
+ QAccessible::State state() const override;
- void *interface_cast(QAccessible::InterfaceType t) Q_DECL_OVERRIDE;
+ void *interface_cast(QAccessible::InterfaceType t) override;
// QAccessibleTextInterface
- void scrollToSubstring(int startIndex, int endIndex) Q_DECL_OVERRIDE;
+ void scrollToSubstring(int startIndex, int endIndex) override;
using QAccessibleTextWidget::text;
protected:
QTextEdit *textEdit() const;
- QPoint scrollBarPosition() const Q_DECL_OVERRIDE;
- QTextCursor textCursor() const Q_DECL_OVERRIDE;
- void setTextCursor(const QTextCursor &textCursor) Q_DECL_OVERRIDE;
- QTextDocument *textDocument() const Q_DECL_OVERRIDE;
- QWidget *viewport() const Q_DECL_OVERRIDE;
+ QPoint scrollBarPosition() const override;
+ QTextCursor textCursor() const override;
+ void setTextCursor(const QTextCursor &textCursor) override;
+ QTextDocument *textDocument() const override;
+ QWidget *viewport() const override;
};
#endif // QT_CONFIG(textedit)
#endif //QT_NO_CURSOR
@@ -192,10 +192,10 @@ class QAccessibleStackedWidget : public QAccessibleWidget
public:
explicit QAccessibleStackedWidget(QWidget *widget);
- QAccessibleInterface *childAt(int x, int y) const Q_DECL_OVERRIDE;
- int childCount() const Q_DECL_OVERRIDE;
- int indexOfChild(const QAccessibleInterface *child) const Q_DECL_OVERRIDE;
- QAccessibleInterface *child(int index) const Q_DECL_OVERRIDE;
+ QAccessibleInterface *childAt(int x, int y) const override;
+ int childCount() const override;
+ int indexOfChild(const QAccessibleInterface *child) const override;
+ QAccessibleInterface *child(int index) const override;
protected:
QStackedWidget *stackedWidget() const;
@@ -222,9 +222,9 @@ class QAccessibleMdiArea : public QAccessibleWidget
public:
explicit QAccessibleMdiArea(QWidget *widget);
- int childCount() const Q_DECL_OVERRIDE;
- QAccessibleInterface *child(int index) const Q_DECL_OVERRIDE;
- int indexOfChild(const QAccessibleInterface *child) const Q_DECL_OVERRIDE;
+ int childCount() const override;
+ QAccessibleInterface *child(int index) const override;
+ int indexOfChild(const QAccessibleInterface *child) const override;
protected:
QMdiArea *mdiArea() const;
@@ -235,13 +235,13 @@ class QAccessibleMdiSubWindow : public QAccessibleWidget
public:
explicit QAccessibleMdiSubWindow(QWidget *widget);
- QString text(QAccessible::Text textType) const Q_DECL_OVERRIDE;
- void setText(QAccessible::Text textType, const QString &text) Q_DECL_OVERRIDE;
- QAccessible::State state() const Q_DECL_OVERRIDE;
- int childCount() const Q_DECL_OVERRIDE;
- QAccessibleInterface *child(int index) const Q_DECL_OVERRIDE;
- int indexOfChild(const QAccessibleInterface *child) const Q_DECL_OVERRIDE;
- QRect rect() const Q_DECL_OVERRIDE;
+ QString text(QAccessible::Text textType) const override;
+ void setText(QAccessible::Text textType, const QString &text) override;
+ QAccessible::State state() const override;
+ int childCount() const override;
+ QAccessibleInterface *child(int index) const override;
+ int indexOfChild(const QAccessibleInterface *child) const override;
+ QRect rect() const override;
protected:
QMdiSubWindow *mdiSubWindow() const;
@@ -262,7 +262,7 @@ class QAccessibleTextBrowser : public QAccessibleTextEdit
public:
explicit QAccessibleTextBrowser(QWidget *widget);
- QAccessible::Role role() const Q_DECL_OVERRIDE;
+ QAccessible::Role role() const override;
};
#endif // QT_CONFIG(textbrowser) && QT_NO_CURSOR
@@ -272,10 +272,10 @@ class QAccessibleCalendarWidget : public QAccessibleWidget
public:
explicit QAccessibleCalendarWidget(QWidget *widget);
- int childCount() const Q_DECL_OVERRIDE;
- int indexOfChild(const QAccessibleInterface *child) const Q_DECL_OVERRIDE;
+ int childCount() const override;
+ int indexOfChild(const QAccessibleInterface *child) const override;
- QAccessibleInterface *child(int index) const Q_DECL_OVERRIDE;
+ QAccessibleInterface *child(int index) const override;
protected:
QCalendarWidget *calendarWidget() const;
@@ -291,11 +291,11 @@ class QAccessibleDockWidget: public QAccessibleWidget
{
public:
explicit QAccessibleDockWidget(QWidget *widget);
- QAccessibleInterface *child(int index) const Q_DECL_OVERRIDE;
- int indexOfChild(const QAccessibleInterface *child) const Q_DECL_OVERRIDE;
- int childCount() const Q_DECL_OVERRIDE;
- QRect rect () const Q_DECL_OVERRIDE;
- QString text(QAccessible::Text t) const Q_DECL_OVERRIDE;
+ QAccessibleInterface *child(int index) const override;
+ int indexOfChild(const QAccessibleInterface *child) const override;
+ int childCount() const override;
+ QRect rect () const override;
+ QString text(QAccessible::Text t) const override;
QDockWidget *dockWidget() const;
protected:
@@ -310,10 +310,10 @@ class QAccessibleMainWindow : public QAccessibleWidget
public:
explicit QAccessibleMainWindow(QWidget *widget);
- QAccessibleInterface *child(int index) const Q_DECL_OVERRIDE;
- int childCount() const Q_DECL_OVERRIDE;
- int indexOfChild(const QAccessibleInterface *iface) const Q_DECL_OVERRIDE;
- QAccessibleInterface *childAt(int x, int y) const Q_DECL_OVERRIDE;
+ QAccessibleInterface *child(int index) const override;
+ int childCount() const override;
+ int indexOfChild(const QAccessibleInterface *iface) const override;
+ QAccessibleInterface *childAt(int x, int y) const override;
QMainWindow *mainWindow() const;
};
diff --git a/src/widgets/accessible/rangecontrols.cpp b/src/widgets/accessible/rangecontrols.cpp
index 190f0aa02f..b5b8608418 100644
--- a/src/widgets/accessible/rangecontrols.cpp
+++ b/src/widgets/accessible/rangecontrols.cpp
@@ -69,7 +69,7 @@ QT_BEGIN_NAMESPACE
#if QT_CONFIG(spinbox)
QAccessibleAbstractSpinBox::QAccessibleAbstractSpinBox(QWidget *w)
-: QAccessibleWidget(w, QAccessible::SpinBox), lineEdit(Q_NULLPTR)
+: QAccessibleWidget(w, QAccessible::SpinBox), lineEdit(nullptr)
{
Q_ASSERT(abstractSpinBox());
}
diff --git a/src/widgets/accessible/rangecontrols_p.h b/src/widgets/accessible/rangecontrols_p.h
index 8af86681a0..1eada8e456 100644
--- a/src/widgets/accessible/rangecontrols_p.h
+++ b/src/widgets/accessible/rangecontrols_p.h
@@ -78,41 +78,41 @@ public:
explicit QAccessibleAbstractSpinBox(QWidget *w);
virtual ~QAccessibleAbstractSpinBox();
- QString text(QAccessible::Text t) const Q_DECL_OVERRIDE;
- void *interface_cast(QAccessible::InterfaceType t) Q_DECL_OVERRIDE;
+ QString text(QAccessible::Text t) const override;
+ void *interface_cast(QAccessible::InterfaceType t) override;
// QAccessibleValueInterface
- QVariant currentValue() const Q_DECL_OVERRIDE;
- void setCurrentValue(const QVariant &value) Q_DECL_OVERRIDE;
- QVariant maximumValue() const Q_DECL_OVERRIDE;
- QVariant minimumValue() const Q_DECL_OVERRIDE;
- QVariant minimumStepSize() const Q_DECL_OVERRIDE;
+ QVariant currentValue() const override;
+ void setCurrentValue(const QVariant &value) override;
+ QVariant maximumValue() const override;
+ QVariant minimumValue() const override;
+ QVariant minimumStepSize() const override;
// QAccessibleTextInterface
- void addSelection(int startOffset, int endOffset) Q_DECL_OVERRIDE;
- QString attributes(int offset, int *startOffset, int *endOffset) const Q_DECL_OVERRIDE;
- int cursorPosition() const Q_DECL_OVERRIDE;
- QRect characterRect(int offset) const Q_DECL_OVERRIDE;
- int selectionCount() const Q_DECL_OVERRIDE;
- int offsetAtPoint(const QPoint &point) const Q_DECL_OVERRIDE;
- void selection(int selectionIndex, int *startOffset, int *endOffset) const Q_DECL_OVERRIDE;
- QString text(int startOffset, int endOffset) const Q_DECL_OVERRIDE;
+ void addSelection(int startOffset, int endOffset) override;
+ QString attributes(int offset, int *startOffset, int *endOffset) const override;
+ int cursorPosition() const override;
+ QRect characterRect(int offset) const override;
+ int selectionCount() const override;
+ int offsetAtPoint(const QPoint &point) const override;
+ void selection(int selectionIndex, int *startOffset, int *endOffset) const override;
+ QString text(int startOffset, int endOffset) const override;
QString textBeforeOffset (int offset, QAccessible::TextBoundaryType boundaryType,
- int *endOffset, int *startOffset) const Q_DECL_OVERRIDE;
+ int *endOffset, int *startOffset) const override;
QString textAfterOffset(int offset, QAccessible::TextBoundaryType boundaryType,
- int *startOffset, int *endOffset) const Q_DECL_OVERRIDE;
+ int *startOffset, int *endOffset) const override;
QString textAtOffset(int offset, QAccessible::TextBoundaryType boundaryType,
- int *startOffset, int *endOffset) const Q_DECL_OVERRIDE;
- void removeSelection(int selectionIndex) Q_DECL_OVERRIDE;
- void setCursorPosition(int position) Q_DECL_OVERRIDE;
- void setSelection(int selectionIndex, int startOffset, int endOffset) Q_DECL_OVERRIDE;
- int characterCount() const Q_DECL_OVERRIDE;
- void scrollToSubstring(int startIndex, int endIndex) Q_DECL_OVERRIDE;
+ int *startOffset, int *endOffset) const override;
+ void removeSelection(int selectionIndex) override;
+ void setCursorPosition(int position) override;
+ void setSelection(int selectionIndex, int startOffset, int endOffset) override;
+ int characterCount() const override;
+ void scrollToSubstring(int startIndex, int endIndex) override;
// QAccessibleEditableTextInterface
- void deleteText(int startOffset, int endOffset) Q_DECL_OVERRIDE;
- void insertText(int offset, const QString &text) Q_DECL_OVERRIDE;
- void replaceText(int startOffset, int endOffset, const QString &text) Q_DECL_OVERRIDE;
+ void deleteText(int startOffset, int endOffset) override;
+ void insertText(int offset, const QString &text) override;
+ void replaceText(int startOffset, int endOffset, const QString &text) override;
protected:
QAbstractSpinBox *abstractSpinBox() const;
@@ -135,7 +135,7 @@ class QAccessibleDoubleSpinBox : public QAccessibleAbstractSpinBox
public:
explicit QAccessibleDoubleSpinBox(QWidget *widget);
- QString text(QAccessible::Text t) const Q_DECL_OVERRIDE;
+ QString text(QAccessible::Text t) const override;
using QAccessibleAbstractSpinBox::text;
protected:
@@ -148,14 +148,14 @@ class QAccessibleAbstractSlider: public QAccessibleWidget, public QAccessibleVal
{
public:
explicit QAccessibleAbstractSlider(QWidget *w, QAccessible::Role r = QAccessible::Slider);
- void *interface_cast(QAccessible::InterfaceType t) Q_DECL_OVERRIDE;
+ void *interface_cast(QAccessible::InterfaceType t) override;
// QAccessibleValueInterface
- QVariant currentValue() const Q_DECL_OVERRIDE;
- void setCurrentValue(const QVariant &value) Q_DECL_OVERRIDE;
- QVariant maximumValue() const Q_DECL_OVERRIDE;
- QVariant minimumValue() const Q_DECL_OVERRIDE;
- QVariant minimumStepSize() const Q_DECL_OVERRIDE;
+ QVariant currentValue() const override;
+ void setCurrentValue(const QVariant &value) override;
+ QVariant maximumValue() const override;
+ QVariant minimumValue() const override;
+ QVariant minimumStepSize() const override;
protected:
QAbstractSlider *abstractSlider() const;
@@ -167,7 +167,7 @@ class QAccessibleScrollBar : public QAccessibleAbstractSlider
{
public:
explicit QAccessibleScrollBar(QWidget *w);
- QString text(QAccessible::Text t) const Q_DECL_OVERRIDE;
+ QString text(QAccessible::Text t) const override;
protected:
QScrollBar *scrollBar() const;
@@ -179,7 +179,7 @@ class QAccessibleSlider : public QAccessibleAbstractSlider
{
public:
explicit QAccessibleSlider(QWidget *w);
- QString text(QAccessible::Text t) const Q_DECL_OVERRIDE;
+ QString text(QAccessible::Text t) const override;
protected:
QSlider *slider() const;
@@ -192,7 +192,7 @@ class QAccessibleDial : public QAccessibleAbstractSlider
public:
explicit QAccessibleDial(QWidget *w);
- QString text(QAccessible::Text textType) const Q_DECL_OVERRIDE;
+ QString text(QAccessible::Text textType) const override;
protected:
QDial *dial() const;
diff --git a/src/widgets/accessible/simplewidgets.cpp b/src/widgets/accessible/simplewidgets.cpp
index bacb00fe2e..f0423ca825 100644
--- a/src/widgets/accessible/simplewidgets.cpp
+++ b/src/widgets/accessible/simplewidgets.cpp
@@ -170,7 +170,7 @@ QAccessible::State QAccessibleButton::state() const
if (b->isChecked())
state.checked = true;
#if QT_CONFIG(checkbox)
- else if (cb && cb->checkState() == Qt::PartiallyChecked)
+ if (cb && cb->checkState() == Qt::PartiallyChecked)
state.checkStateMixed = true;
#endif
if (b->isDown())
@@ -777,7 +777,7 @@ QRect QAccessibleLineEdit::characterRect(int offset) const
const QString ch = text(offset, offset + 1);
if (ch.isEmpty())
return QRect();
- int w = fm.width(ch);
+ int w = fm.horizontalAdvance(ch);
int h = fm.height();
QRect r(x, y, w, h);
r.moveTo(lineEdit()->mapToGlobal(r.topLeft()));
diff --git a/src/widgets/accessible/simplewidgets_p.h b/src/widgets/accessible/simplewidgets_p.h
index 902b403d5b..fcd0e7df47 100644
--- a/src/widgets/accessible/simplewidgets_p.h
+++ b/src/widgets/accessible/simplewidgets_p.h
@@ -72,14 +72,14 @@ class QAccessibleButton : public QAccessibleWidget
public:
QAccessibleButton(QWidget *w);
- QString text(QAccessible::Text t) const Q_DECL_OVERRIDE;
- QAccessible::State state() const Q_DECL_OVERRIDE;
- QRect rect() const Q_DECL_OVERRIDE;
- QAccessible::Role role() const Q_DECL_OVERRIDE;
+ QString text(QAccessible::Text t) const override;
+ QAccessible::State state() const override;
+ QRect rect() const override;
+ QAccessible::Role role() const override;
- QStringList actionNames() const Q_DECL_OVERRIDE;
- void doAction(const QString &actionName) Q_DECL_OVERRIDE;
- QStringList keyBindingsForAction(const QString &actionName) const Q_DECL_OVERRIDE;
+ QStringList actionNames() const override;
+ void doAction(const QString &actionName) override;
+ QStringList keyBindingsForAction(const QString &actionName) const override;
protected:
QAbstractButton *button() const;
@@ -92,15 +92,15 @@ class QAccessibleToolButton : public QAccessibleButton
public:
QAccessibleToolButton(QWidget *w);
- QAccessible::State state() const Q_DECL_OVERRIDE;
- QAccessible::Role role() const Q_DECL_OVERRIDE;
+ QAccessible::State state() const override;
+ QAccessible::Role role() const override;
- int childCount() const Q_DECL_OVERRIDE;
- QAccessibleInterface *child(int index) const Q_DECL_OVERRIDE;
+ int childCount() const override;
+ QAccessibleInterface *child(int index) const override;
// QAccessibleActionInterface
- QStringList actionNames() const Q_DECL_OVERRIDE;
- void doAction(const QString &actionName) Q_DECL_OVERRIDE;
+ QStringList actionNames() const override;
+ void doAction(const QString &actionName) override;
protected:
QToolButton *toolButton() const;
@@ -114,16 +114,16 @@ class QAccessibleDisplay : public QAccessibleWidget, public QAccessibleImageInte
public:
explicit QAccessibleDisplay(QWidget *w, QAccessible::Role role = QAccessible::StaticText);
- QString text(QAccessible::Text t) const Q_DECL_OVERRIDE;
- QAccessible::Role role() const Q_DECL_OVERRIDE;
+ QString text(QAccessible::Text t) const override;
+ QAccessible::Role role() const override;
- QVector<QPair<QAccessibleInterface*, QAccessible::Relation> >relations(QAccessible::Relation match = QAccessible::AllRelations) const Q_DECL_OVERRIDE;
- void *interface_cast(QAccessible::InterfaceType t) Q_DECL_OVERRIDE;
+ QVector<QPair<QAccessibleInterface*, QAccessible::Relation> >relations(QAccessible::Relation match = QAccessible::AllRelations) const override;
+ void *interface_cast(QAccessible::InterfaceType t) override;
// QAccessibleImageInterface
- QString imageDescription() const Q_DECL_OVERRIDE;
- QSize imageSize() const Q_DECL_OVERRIDE;
- QPoint imagePosition() const Q_DECL_OVERRIDE;
+ QString imageDescription() const override;
+ QSize imageSize() const override;
+ QPoint imagePosition() const override;
};
#if QT_CONFIG(groupbox)
@@ -132,16 +132,16 @@ class QAccessibleGroupBox : public QAccessibleWidget
public:
explicit QAccessibleGroupBox(QWidget *w);
- QAccessible::State state() const Q_DECL_OVERRIDE;
- QAccessible::Role role() const Q_DECL_OVERRIDE;
- QString text(QAccessible::Text t) const Q_DECL_OVERRIDE;
+ QAccessible::State state() const override;
+ QAccessible::Role role() const override;
+ QString text(QAccessible::Text t) const override;
- QVector<QPair<QAccessibleInterface*, QAccessible::Relation> >relations(QAccessible::Relation match = QAccessible::AllRelations) const Q_DECL_OVERRIDE;
+ QVector<QPair<QAccessibleInterface*, QAccessible::Relation> >relations(QAccessible::Relation match = QAccessible::AllRelations) const override;
//QAccessibleActionInterface
- QStringList actionNames() const Q_DECL_OVERRIDE;
- void doAction(const QString &actionName) Q_DECL_OVERRIDE;
- QStringList keyBindingsForAction(const QString &) const Q_DECL_OVERRIDE;
+ QStringList actionNames() const override;
+ void doAction(const QString &actionName) override;
+ QStringList keyBindingsForAction(const QString &) const override;
private:
QGroupBox *groupBox() const;
@@ -154,36 +154,36 @@ class QAccessibleLineEdit : public QAccessibleWidget, public QAccessibleTextInte
public:
explicit QAccessibleLineEdit(QWidget *o, const QString &name = QString());
- QString text(QAccessible::Text t) const Q_DECL_OVERRIDE;
- void setText(QAccessible::Text t, const QString &text) Q_DECL_OVERRIDE;
- QAccessible::State state() const Q_DECL_OVERRIDE;
- void *interface_cast(QAccessible::InterfaceType t) Q_DECL_OVERRIDE;
+ QString text(QAccessible::Text t) const override;
+ void setText(QAccessible::Text t, const QString &text) override;
+ QAccessible::State state() const override;
+ void *interface_cast(QAccessible::InterfaceType t) override;
// QAccessibleTextInterface
- void addSelection(int startOffset, int endOffset) Q_DECL_OVERRIDE;
- QString attributes(int offset, int *startOffset, int *endOffset) const Q_DECL_OVERRIDE;
- int cursorPosition() const Q_DECL_OVERRIDE;
- QRect characterRect(int offset) const Q_DECL_OVERRIDE;
- int selectionCount() const Q_DECL_OVERRIDE;
- int offsetAtPoint(const QPoint &point) const Q_DECL_OVERRIDE;
- void selection(int selectionIndex, int *startOffset, int *endOffset) const Q_DECL_OVERRIDE;
- QString text(int startOffset, int endOffset) const Q_DECL_OVERRIDE;
+ void addSelection(int startOffset, int endOffset) override;
+ QString attributes(int offset, int *startOffset, int *endOffset) const override;
+ int cursorPosition() const override;
+ QRect characterRect(int offset) const override;
+ int selectionCount() const override;
+ int offsetAtPoint(const QPoint &point) const override;
+ void selection(int selectionIndex, int *startOffset, int *endOffset) const override;
+ QString text(int startOffset, int endOffset) const override;
QString textBeforeOffset (int offset, QAccessible::TextBoundaryType boundaryType,
- int *startOffset, int *endOffset) const Q_DECL_OVERRIDE;
+ int *startOffset, int *endOffset) const override;
QString textAfterOffset(int offset, QAccessible::TextBoundaryType boundaryType,
- int *startOffset, int *endOffset) const Q_DECL_OVERRIDE;
+ int *startOffset, int *endOffset) const override;
QString textAtOffset(int offset, QAccessible::TextBoundaryType boundaryType,
- int *startOffset, int *endOffset) const Q_DECL_OVERRIDE;
- void removeSelection(int selectionIndex) Q_DECL_OVERRIDE;
- void setCursorPosition(int position) Q_DECL_OVERRIDE;
- void setSelection(int selectionIndex, int startOffset, int endOffset) Q_DECL_OVERRIDE;
- int characterCount() const Q_DECL_OVERRIDE;
- void scrollToSubstring(int startIndex, int endIndex) Q_DECL_OVERRIDE;
+ int *startOffset, int *endOffset) const override;
+ void removeSelection(int selectionIndex) override;
+ void setCursorPosition(int position) override;
+ void setSelection(int selectionIndex, int startOffset, int endOffset) override;
+ int characterCount() const override;
+ void scrollToSubstring(int startIndex, int endIndex) override;
// QAccessibleEditableTextInterface
- void deleteText(int startOffset, int endOffset) Q_DECL_OVERRIDE;
- void insertText(int offset, const QString &text) Q_DECL_OVERRIDE;
- void replaceText(int startOffset, int endOffset, const QString &text) Q_DECL_OVERRIDE;
+ void deleteText(int startOffset, int endOffset) override;
+ void insertText(int offset, const QString &text) override;
+ void replaceText(int startOffset, int endOffset, const QString &text) override;
protected:
QLineEdit *lineEdit() const;
friend class QAccessibleAbstractSpinBox;
@@ -195,14 +195,14 @@ class QAccessibleProgressBar : public QAccessibleDisplay, public QAccessibleValu
{
public:
explicit QAccessibleProgressBar(QWidget *o);
- void *interface_cast(QAccessible::InterfaceType t) Q_DECL_OVERRIDE;
+ void *interface_cast(QAccessible::InterfaceType t) override;
// QAccessibleValueInterface
- QVariant currentValue() const Q_DECL_OVERRIDE;
- QVariant maximumValue() const Q_DECL_OVERRIDE;
- QVariant minimumValue() const Q_DECL_OVERRIDE;
- QVariant minimumStepSize() const Q_DECL_OVERRIDE;
- void setCurrentValue(const QVariant &) Q_DECL_OVERRIDE {}
+ QVariant currentValue() const override;
+ QVariant maximumValue() const override;
+ QVariant minimumValue() const override;
+ QVariant minimumStepSize() const override;
+ void setCurrentValue(const QVariant &) override {}
protected:
QProgressBar *progressBar() const;
@@ -214,9 +214,9 @@ class QAccessibleWindowContainer : public QAccessibleWidget
{
public:
QAccessibleWindowContainer(QWidget *w);
- int childCount() const Q_DECL_OVERRIDE;
- int indexOfChild(const QAccessibleInterface *child) const Q_DECL_OVERRIDE;
- QAccessibleInterface *child(int i) const Q_DECL_OVERRIDE;
+ int childCount() const override;
+ int indexOfChild(const QAccessibleInterface *child) const override;
+ QAccessibleInterface *child(int i) const override;
private:
QWindowContainer *container() const;
diff --git a/src/widgets/dialogs/qcolordialog.cpp b/src/widgets/dialogs/qcolordialog.cpp
index f3b198fdc2..896baed6c5 100644
--- a/src/widgets/dialogs/qcolordialog.cpp
+++ b/src/widgets/dialogs/qcolordialog.cpp
@@ -119,6 +119,7 @@ public:
void retranslateStrings();
void _q_addCustom();
+ void _q_setCustom(int index, QRgb color);
void _q_newHsv(int h, int s, int v);
void _q_newColorTypedIn(QRgb rgb);
@@ -134,7 +135,7 @@ public:
bool handleColorPickingMouseButtonRelease(QMouseEvent *e);
bool handleColorPickingKeyPress(QKeyEvent *e);
- bool canBeNativeDialog() const Q_DECL_OVERRIDE;
+ bool canBeNativeDialog() const override;
QWellArray *custom;
QWellArray *standard;
@@ -167,8 +168,8 @@ public:
#endif
private:
- virtual void initHelper(QPlatformDialogHelper *h) Q_DECL_OVERRIDE;
- virtual void helperPrepareShow(QPlatformDialogHelper *h) Q_DECL_OVERRIDE;
+ virtual void initHelper(QPlatformDialogHelper *h) override;
+ virtual void helperPrepareShow(QPlatformDialogHelper *h) override;
};
//////////// QWellArray BEGIN
@@ -192,7 +193,7 @@ public:
virtual void setCurrent(int row, int col);
virtual void setSelected(int row, int col);
- QSize sizeHint() const Q_DECL_OVERRIDE;
+ QSize sizeHint() const override;
inline int cellWidth() const
{ return cellw; }
@@ -237,17 +238,18 @@ public:
signals:
void selected(int row, int col);
void currentChanged(int row, int col);
+ void colorChanged(int index, QRgb color);
protected:
virtual void paintCell(QPainter *, int row, int col, const QRect&);
virtual void paintCellContents(QPainter *, int row, int col, const QRect&);
- void mousePressEvent(QMouseEvent*) Q_DECL_OVERRIDE;
- void mouseReleaseEvent(QMouseEvent*) Q_DECL_OVERRIDE;
- void keyPressEvent(QKeyEvent*) Q_DECL_OVERRIDE;
- void focusInEvent(QFocusEvent*) Q_DECL_OVERRIDE;
- void focusOutEvent(QFocusEvent*) Q_DECL_OVERRIDE;
- void paintEvent(QPaintEvent *) Q_DECL_OVERRIDE;
+ void mousePressEvent(QMouseEvent*) override;
+ void mouseReleaseEvent(QMouseEvent*) override;
+ void keyPressEvent(QKeyEvent*) override;
+ void focusInEvent(QFocusEvent*) override;
+ void focusOutEvent(QFocusEvent*) override;
+ void paintEvent(QPaintEvent *) override;
private:
Q_DISABLE_COPY(QWellArray)
@@ -495,7 +497,7 @@ class QColorPickingEventFilter : public QObject {
public:
explicit QColorPickingEventFilter(QColorDialogPrivate *dp, QObject *parent = 0) : QObject(parent), m_dp(dp) {}
- bool eventFilter(QObject *, QEvent *event) Q_DECL_OVERRIDE
+ bool eventFilter(QObject *, QEvent *event) override
{
switch (event->type()) {
case QEvent::MouseMove:
@@ -581,24 +583,24 @@ namespace {
class QColorWell : public QWellArray
{
public:
- QColorWell(QWidget *parent, int r, int c, QRgb *vals)
+ QColorWell(QWidget *parent, int r, int c, const QRgb *vals)
:QWellArray(r, c, parent), values(vals), mousePressed(false), oldCurrent(-1, -1)
{ setSizePolicy(QSizePolicy(QSizePolicy::Minimum, QSizePolicy::Minimum)); }
protected:
- void paintCellContents(QPainter *, int row, int col, const QRect&) Q_DECL_OVERRIDE;
- void mousePressEvent(QMouseEvent *e) Q_DECL_OVERRIDE;
- void mouseMoveEvent(QMouseEvent *e) Q_DECL_OVERRIDE;
- void mouseReleaseEvent(QMouseEvent *e) Q_DECL_OVERRIDE;
+ void paintCellContents(QPainter *, int row, int col, const QRect&) override;
+ void mousePressEvent(QMouseEvent *e) override;
+ void mouseMoveEvent(QMouseEvent *e) override;
+ void mouseReleaseEvent(QMouseEvent *e) override;
#ifndef QT_NO_DRAGANDDROP
- void dragEnterEvent(QDragEnterEvent *e) Q_DECL_OVERRIDE;
- void dragLeaveEvent(QDragLeaveEvent *e) Q_DECL_OVERRIDE;
- void dragMoveEvent(QDragMoveEvent *e) Q_DECL_OVERRIDE;
- void dropEvent(QDropEvent *e) Q_DECL_OVERRIDE;
+ void dragEnterEvent(QDragEnterEvent *e) override;
+ void dragLeaveEvent(QDragLeaveEvent *e) override;
+ void dragMoveEvent(QDragMoveEvent *e) override;
+ void dropEvent(QDropEvent *e) override;
#endif
private:
- QRgb *values;
+ const QRgb *values;
bool mousePressed;
QPoint pressPos;
QPoint oldCurrent;
@@ -675,8 +677,7 @@ void QColorWell::dropEvent(QDropEvent *e)
QColor col = qvariant_cast<QColor>(e->mimeData()->colorData());
if (col.isValid()) {
int i = rowAt(e->pos().y()) + columnAt(e->pos().x()) * numRows();
- values[i] = col.rgb();
- update();
+ emit colorChanged(i, col.rgb());
e->accept();
} else {
e->ignore();
@@ -708,11 +709,11 @@ signals:
void newCol(int h, int s);
protected:
- QSize sizeHint() const Q_DECL_OVERRIDE;
- void paintEvent(QPaintEvent*) Q_DECL_OVERRIDE;
- void mouseMoveEvent(QMouseEvent *) Q_DECL_OVERRIDE;
- void mousePressEvent(QMouseEvent *) Q_DECL_OVERRIDE;
- void resizeEvent(QResizeEvent *) Q_DECL_OVERRIDE;
+ QSize sizeHint() const override;
+ void paintEvent(QPaintEvent*) override;
+ void mouseMoveEvent(QMouseEvent *) override;
+ void mousePressEvent(QMouseEvent *) override;
+ void resizeEvent(QResizeEvent *) override;
private:
int hue;
@@ -745,9 +746,9 @@ signals:
void newHsv(int h, int s, int v);
protected:
- void paintEvent(QPaintEvent*) Q_DECL_OVERRIDE;
- void mouseMoveEvent(QMouseEvent *) Q_DECL_OVERRIDE;
- void mousePressEvent(QMouseEvent *) Q_DECL_OVERRIDE;
+ void paintEvent(QPaintEvent*) override;
+ void mouseMoveEvent(QMouseEvent *) override;
+ void mousePressEvent(QMouseEvent *) override;
private:
enum { foff = 3, coff = 4 }; //frame and contents offset
@@ -1067,14 +1068,14 @@ signals:
void colorDropped(QRgb);
protected:
- void paintEvent(QPaintEvent *) Q_DECL_OVERRIDE;
- void mousePressEvent(QMouseEvent *e) Q_DECL_OVERRIDE;
- void mouseMoveEvent(QMouseEvent *e) Q_DECL_OVERRIDE;
- void mouseReleaseEvent(QMouseEvent *e) Q_DECL_OVERRIDE;
+ void paintEvent(QPaintEvent *) override;
+ void mousePressEvent(QMouseEvent *e) override;
+ void mouseMoveEvent(QMouseEvent *e) override;
+ void mouseReleaseEvent(QMouseEvent *e) override;
#ifndef QT_NO_DRAGANDDROP
- void dragEnterEvent(QDragEnterEvent *e) Q_DECL_OVERRIDE;
- void dragLeaveEvent(QDragLeaveEvent *e) Q_DECL_OVERRIDE;
- void dropEvent(QDropEvent *e) Q_DECL_OVERRIDE;
+ void dragEnterEvent(QDragEnterEvent *e) override;
+ void dragLeaveEvent(QDragLeaveEvent *e) override;
+ void dropEvent(QDropEvent *e) override;
#endif
private:
@@ -1560,8 +1561,7 @@ bool QColorDialogPrivate::selectColor(const QColor &col)
QColor QColorDialogPrivate::grabScreenColor(const QPoint &p)
{
const QDesktopWidget *desktop = QApplication::desktop();
- const QPixmap pixmap = QGuiApplication::screens().at(desktop->screenNumber())->grabWindow(desktop->winId(),
- p.x(), p.y(), 1, 1);
+ const QPixmap pixmap = QGuiApplication::primaryScreen()->grabWindow(desktop->winId(), p.x(), p.y(), 1, 1);
QImage i = pixmap.toImage();
return i.pixel(0, 0);
}
@@ -1734,6 +1734,13 @@ void QColorDialogPrivate::initWidgets()
q->connect(custom, SIGNAL(selected(int,int)), SLOT(_q_newCustom(int,int)));
q->connect(custom, SIGNAL(currentChanged(int,int)), SLOT(_q_nextCustom(int,int)));
+
+ q->connect(custom, &QWellArray::colorChanged, [=] (int index, QRgb color) {
+ QColorDialogOptions::setCustomColor(index, color);
+ if (custom)
+ custom->update();
+ });
+
lblCustomColors = new QLabel(q);
#ifndef QT_NO_SHORTCUT
lblCustomColors->setBuddy(custom);
diff --git a/src/widgets/dialogs/qcolordialog.h b/src/widgets/dialogs/qcolordialog.h
index a27cfaf953..6451ff9bde 100644
--- a/src/widgets/dialogs/qcolordialog.h
+++ b/src/widgets/dialogs/qcolordialog.h
@@ -68,8 +68,8 @@ public:
Q_DECLARE_FLAGS(ColorDialogOptions, ColorDialogOption)
- explicit QColorDialog(QWidget *parent = Q_NULLPTR);
- explicit QColorDialog(const QColor &initial, QWidget *parent = Q_NULLPTR);
+ explicit QColorDialog(QWidget *parent = nullptr);
+ explicit QColorDialog(const QColor &initial, QWidget *parent = nullptr);
~QColorDialog();
void setCurrentColor(const QColor &color);
@@ -85,15 +85,15 @@ public:
using QDialog::open;
void open(QObject *receiver, const char *member);
- void setVisible(bool visible) Q_DECL_OVERRIDE;
+ void setVisible(bool visible) override;
static QColor getColor(const QColor &initial = Qt::white,
- QWidget *parent = Q_NULLPTR,
+ QWidget *parent = nullptr,
const QString &title = QString(),
ColorDialogOptions options = ColorDialogOptions());
// obsolete
- static QRgb getRgba(QRgb rgba = 0xffffffff, bool *ok = Q_NULLPTR, QWidget *parent = Q_NULLPTR);
+ static QRgb getRgba(QRgb rgba = 0xffffffff, bool *ok = nullptr, QWidget *parent = nullptr);
static int customCount();
static QColor customColor(int index);
@@ -106,8 +106,8 @@ Q_SIGNALS:
void colorSelected(const QColor &color);
protected:
- void changeEvent(QEvent *event) Q_DECL_OVERRIDE;
- void done(int result) Q_DECL_OVERRIDE;
+ void changeEvent(QEvent *event) override;
+ void done(int result) override;
private:
Q_DISABLE_COPY(QColorDialog)
diff --git a/src/widgets/dialogs/qdialog.h b/src/widgets/dialogs/qdialog.h
index 72250172d3..7f267dd939 100644
--- a/src/widgets/dialogs/qdialog.h
+++ b/src/widgets/dialogs/qdialog.h
@@ -60,7 +60,7 @@ class Q_WIDGETS_EXPORT QDialog : public QWidget
Q_PROPERTY(bool modal READ isModal WRITE setModal)
public:
- explicit QDialog(QWidget *parent = Q_NULLPTR, Qt::WindowFlags f = Qt::WindowFlags());
+ explicit QDialog(QWidget *parent = nullptr, Qt::WindowFlags f = Qt::WindowFlags());
~QDialog();
enum DialogCode { Rejected, Accepted };
diff --git a/src/widgets/dialogs/qdialog_p.h b/src/widgets/dialogs/qdialog_p.h
index 2ed414bd45..99fff08e65 100644
--- a/src/widgets/dialogs/qdialog_p.h
+++ b/src/widgets/dialogs/qdialog_p.h
@@ -143,7 +143,7 @@ public:
T *operator->() const Q_DECL_NOTHROW { return get(); }
T *get() const Q_DECL_NOTHROW { return o; }
T &operator*() const { return *get(); }
- operator RestrictedBool() const Q_DECL_NOTHROW { return o ? &internal::func : Q_NULLPTR; }
+ operator RestrictedBool() const Q_DECL_NOTHROW { return o ? &internal::func : nullptr; }
bool operator!() const Q_DECL_NOTHROW { return !o; }
private:
Q_DISABLE_COPY(QAutoPointer);
diff --git a/src/widgets/dialogs/qerrormessage.cpp b/src/widgets/dialogs/qerrormessage.cpp
index 39035b743d..fd68f19680 100644
--- a/src/widgets/dialogs/qerrormessage.cpp
+++ b/src/widgets/dialogs/qerrormessage.cpp
@@ -95,8 +95,8 @@ public:
QErrorMessageTextView(QWidget *parent)
: QTextEdit(parent) { setReadOnly(true); }
- virtual QSize minimumSizeHint() const Q_DECL_OVERRIDE;
- virtual QSize sizeHint() const Q_DECL_OVERRIDE;
+ virtual QSize minimumSizeHint() const override;
+ virtual QSize sizeHint() const override;
};
} // unnamed namespace
diff --git a/src/widgets/dialogs/qerrormessage.h b/src/widgets/dialogs/qerrormessage.h
index 4cb1fad845..220694e54e 100644
--- a/src/widgets/dialogs/qerrormessage.h
+++ b/src/widgets/dialogs/qerrormessage.h
@@ -55,7 +55,7 @@ class Q_WIDGETS_EXPORT QErrorMessage: public QDialog
Q_OBJECT
Q_DECLARE_PRIVATE(QErrorMessage)
public:
- explicit QErrorMessage(QWidget* parent = Q_NULLPTR);
+ explicit QErrorMessage(QWidget* parent = nullptr);
~QErrorMessage();
static QErrorMessage * qtHandler();
@@ -65,8 +65,8 @@ public Q_SLOTS:
void showMessage(const QString &message, const QString &type);
protected:
- void done(int) Q_DECL_OVERRIDE;
- void changeEvent(QEvent *e) Q_DECL_OVERRIDE;
+ void done(int) override;
+ void changeEvent(QEvent *e) override;
private:
Q_DISABLE_COPY(QErrorMessage)
diff --git a/src/widgets/dialogs/qfiledialog.cpp b/src/widgets/dialogs/qfiledialog.cpp
index 8d37969be4..4cda5f34ad 100644
--- a/src/widgets/dialogs/qfiledialog.cpp
+++ b/src/widgets/dialogs/qfiledialog.cpp
@@ -1994,7 +1994,7 @@ QFileIconProvider *QFileDialog::iconProvider() const
{
Q_D(const QFileDialog);
if (!d->model)
- return Q_NULLPTR;
+ return nullptr;
return d->model->iconProvider();
}
@@ -2950,10 +2950,10 @@ void QFileDialogPrivate::createWidgets()
qFileDialogUi->treeView->setModel(model);
QHeaderView *treeHeader = qFileDialogUi->treeView->header();
QFontMetrics fm(q->font());
- treeHeader->resizeSection(0, fm.width(QLatin1String("wwwwwwwwwwwwwwwwwwwwwwwwww")));
- treeHeader->resizeSection(1, fm.width(QLatin1String("128.88 GB")));
- treeHeader->resizeSection(2, fm.width(QLatin1String("mp3Folder")));
- treeHeader->resizeSection(3, fm.width(QLatin1String("10/29/81 02:02PM")));
+ treeHeader->resizeSection(0, fm.horizontalAdvance(QLatin1String("wwwwwwwwwwwwwwwwwwwwwwwwww")));
+ treeHeader->resizeSection(1, fm.horizontalAdvance(QLatin1String("128.88 GB")));
+ treeHeader->resizeSection(2, fm.horizontalAdvance(QLatin1String("mp3Folder")));
+ treeHeader->resizeSection(3, fm.horizontalAdvance(QLatin1String("10/29/81 02:02PM")));
treeHeader->setContextMenuPolicy(Qt::ActionsContextMenu);
QActionGroup *showActionGroup = new QActionGroup(q);
@@ -3621,7 +3621,7 @@ void QFileDialogPrivate::_q_enterDirectory(const QModelIndex &index)
}
} else {
// Do not accept when shift-clicking to multi-select a file in environments with single-click-activation (KDE)
- if (!q->style()->styleHint(QStyle::SH_ItemView_ActivateItemOnSingleClick, Q_NULLPTR, qFileDialogUi->treeView)
+ if (!q->style()->styleHint(QStyle::SH_ItemView_ActivateItemOnSingleClick, nullptr, qFileDialogUi->treeView)
|| q->fileMode() != QFileDialog::ExistingFiles || !(QGuiApplication::keyboardModifiers() & Qt::CTRL)) {
q->accept();
}
diff --git a/src/widgets/dialogs/qfiledialog.h b/src/widgets/dialogs/qfiledialog.h
index b9092e036d..1cbd690f24 100644
--- a/src/widgets/dialogs/qfiledialog.h
+++ b/src/widgets/dialogs/qfiledialog.h
@@ -98,7 +98,7 @@ public:
Q_FLAG(Options)
QFileDialog(QWidget *parent, Qt::WindowFlags f);
- explicit QFileDialog(QWidget *parent = Q_NULLPTR,
+ explicit QFileDialog(QWidget *parent = nullptr,
const QString &caption = QString(),
const QString &directory = QString(),
const QString &filter = QString());
@@ -190,7 +190,7 @@ public:
using QDialog::open;
void open(QObject *receiver, const char *member);
- void setVisible(bool visible) Q_DECL_OVERRIDE;
+ void setVisible(bool visible) override;
Q_SIGNALS:
void fileSelected(const QString &file);
@@ -207,68 +207,68 @@ Q_SIGNALS:
public:
- static QString getOpenFileName(QWidget *parent = Q_NULLPTR,
+ static QString getOpenFileName(QWidget *parent = nullptr,
const QString &caption = QString(),
const QString &dir = QString(),
const QString &filter = QString(),
- QString *selectedFilter = Q_NULLPTR,
+ QString *selectedFilter = nullptr,
Options options = Options());
- static QUrl getOpenFileUrl(QWidget *parent = Q_NULLPTR,
+ static QUrl getOpenFileUrl(QWidget *parent = nullptr,
const QString &caption = QString(),
const QUrl &dir = QUrl(),
const QString &filter = QString(),
- QString *selectedFilter = Q_NULLPTR,
+ QString *selectedFilter = nullptr,
Options options = Options(),
const QStringList &supportedSchemes = QStringList());
- static QString getSaveFileName(QWidget *parent = Q_NULLPTR,
+ static QString getSaveFileName(QWidget *parent = nullptr,
const QString &caption = QString(),
const QString &dir = QString(),
const QString &filter = QString(),
- QString *selectedFilter = Q_NULLPTR,
+ QString *selectedFilter = nullptr,
Options options = Options());
- static QUrl getSaveFileUrl(QWidget *parent = Q_NULLPTR,
+ static QUrl getSaveFileUrl(QWidget *parent = nullptr,
const QString &caption = QString(),
const QUrl &dir = QUrl(),
const QString &filter = QString(),
- QString *selectedFilter = Q_NULLPTR,
+ QString *selectedFilter = nullptr,
Options options = Options(),
const QStringList &supportedSchemes = QStringList());
- static QString getExistingDirectory(QWidget *parent = Q_NULLPTR,
+ static QString getExistingDirectory(QWidget *parent = nullptr,
const QString &caption = QString(),
const QString &dir = QString(),
Options options = ShowDirsOnly);
- static QUrl getExistingDirectoryUrl(QWidget *parent = Q_NULLPTR,
+ static QUrl getExistingDirectoryUrl(QWidget *parent = nullptr,
const QString &caption = QString(),
const QUrl &dir = QUrl(),
Options options = ShowDirsOnly,
const QStringList &supportedSchemes = QStringList());
- static QStringList getOpenFileNames(QWidget *parent = Q_NULLPTR,
+ static QStringList getOpenFileNames(QWidget *parent = nullptr,
const QString &caption = QString(),
const QString &dir = QString(),
const QString &filter = QString(),
- QString *selectedFilter = Q_NULLPTR,
+ QString *selectedFilter = nullptr,
Options options = Options());
- static QList<QUrl> getOpenFileUrls(QWidget *parent = Q_NULLPTR,
+ static QList<QUrl> getOpenFileUrls(QWidget *parent = nullptr,
const QString &caption = QString(),
const QUrl &dir = QUrl(),
const QString &filter = QString(),
- QString *selectedFilter = Q_NULLPTR,
+ QString *selectedFilter = nullptr,
Options options = Options(),
const QStringList &supportedSchemes = QStringList());
protected:
QFileDialog(const QFileDialogArgs &args);
- void done(int result) Q_DECL_OVERRIDE;
- void accept() Q_DECL_OVERRIDE;
- void changeEvent(QEvent *e) Q_DECL_OVERRIDE;
+ void done(int result) override;
+ void accept() override;
+ void changeEvent(QEvent *e) override;
private:
Q_DECLARE_PRIVATE(QFileDialog)
diff --git a/src/widgets/dialogs/qfiledialog_p.h b/src/widgets/dialogs/qfiledialog_p.h
index 371826eccc..17290381d3 100644
--- a/src/widgets/dialogs/qfiledialog_p.h
+++ b/src/widgets/dialogs/qfiledialog_p.h
@@ -254,7 +254,7 @@ public:
// setVisible_sys returns true if it ends up showing a native
// dialog. Returning false means that a non-native dialog must be
// used instead.
- bool canBeNativeDialog() const Q_DECL_OVERRIDE;
+ bool canBeNativeDialog() const override;
inline bool usingWidgets() const;
inline void setDirectory_sys(const QUrl &directory);
@@ -286,9 +286,9 @@ public:
~QFileDialogPrivate();
private:
- virtual void initHelper(QPlatformDialogHelper *) Q_DECL_OVERRIDE;
- virtual void helperPrepareShow(QPlatformDialogHelper *) Q_DECL_OVERRIDE;
- virtual void helperDone(QDialog::DialogCode, QPlatformDialogHelper *) Q_DECL_OVERRIDE;
+ virtual void initHelper(QPlatformDialogHelper *) override;
+ virtual void helperPrepareShow(QPlatformDialogHelper *) override;
+ virtual void helperDone(QDialog::DialogCode, QPlatformDialogHelper *) override;
Q_DISABLE_COPY(QFileDialogPrivate)
};
@@ -298,7 +298,7 @@ class QFileDialogLineEdit : public QLineEdit
public:
QFileDialogLineEdit(QWidget *parent = 0) : QLineEdit(parent), d_ptr(0){}
void setFileDialogPrivate(QFileDialogPrivate *d_pointer) {d_ptr = d_pointer; }
- void keyPressEvent(QKeyEvent *e) Q_DECL_OVERRIDE;
+ void keyPressEvent(QKeyEvent *e) override;
bool hideOnEsc;
private:
QFileDialogPrivate *d_ptr;
@@ -309,10 +309,10 @@ class QFileDialogComboBox : public QComboBox
public:
QFileDialogComboBox(QWidget *parent = 0) : QComboBox(parent), urlModel(0) {}
void setFileDialogPrivate(QFileDialogPrivate *d_pointer);
- void showPopup() Q_DECL_OVERRIDE;
+ void showPopup() override;
void setHistory(const QStringList &paths);
QStringList history() const { return m_history; }
- void paintEvent(QPaintEvent *) Q_DECL_OVERRIDE;
+ void paintEvent(QPaintEvent *) override;
private:
QUrlModel *urlModel;
@@ -325,9 +325,9 @@ class QFileDialogListView : public QListView
public:
QFileDialogListView(QWidget *parent = 0);
void setFileDialogPrivate(QFileDialogPrivate *d_pointer);
- QSize sizeHint() const Q_DECL_OVERRIDE;
+ QSize sizeHint() const override;
protected:
- void keyPressEvent(QKeyEvent *e) Q_DECL_OVERRIDE;
+ void keyPressEvent(QKeyEvent *e) override;
private:
QFileDialogPrivate *d_ptr;
};
@@ -337,10 +337,10 @@ class QFileDialogTreeView : public QTreeView
public:
QFileDialogTreeView(QWidget *parent);
void setFileDialogPrivate(QFileDialogPrivate *d_pointer);
- QSize sizeHint() const Q_DECL_OVERRIDE;
+ QSize sizeHint() const override;
protected:
- void keyPressEvent(QKeyEvent *e) Q_DECL_OVERRIDE;
+ void keyPressEvent(QKeyEvent *e) override;
private:
QFileDialogPrivate *d_ptr;
};
diff --git a/src/widgets/dialogs/qfileinfogatherer_p.h b/src/widgets/dialogs/qfileinfogatherer_p.h
index 0cf2ed1f58..bb13d4eb01 100644
--- a/src/widgets/dialogs/qfileinfogatherer_p.h
+++ b/src/widgets/dialogs/qfileinfogatherer_p.h
@@ -186,7 +186,7 @@ private Q_SLOTS:
void driveRemoved();
private:
- void run() Q_DECL_OVERRIDE;
+ void run() override;
// called by run():
void getFileInfos(const QString &path, const QStringList &files);
void fetch(const QFileInfo &info, QElapsedTimer &base, bool &firstTime, QVector<QPair<QString, QFileInfo> > &updatedFiles, const QString &path);
diff --git a/src/widgets/dialogs/qfilesystemmodel.h b/src/widgets/dialogs/qfilesystemmodel.h
index a5f23c9220..c2c8b8818e 100644
--- a/src/widgets/dialogs/qfilesystemmodel.h
+++ b/src/widgets/dialogs/qfilesystemmodel.h
@@ -75,36 +75,36 @@ public:
FilePermissions = Qt::UserRole + 3
};
- explicit QFileSystemModel(QObject *parent = Q_NULLPTR);
+ explicit QFileSystemModel(QObject *parent = nullptr);
~QFileSystemModel();
- QModelIndex index(int row, int column, const QModelIndex &parent = QModelIndex()) const Q_DECL_OVERRIDE;
+ QModelIndex index(int row, int column, const QModelIndex &parent = QModelIndex()) const override;
QModelIndex index(const QString &path, int column = 0) const;
- QModelIndex parent(const QModelIndex &child) const Q_DECL_OVERRIDE;
+ QModelIndex parent(const QModelIndex &child) const override;
using QObject::parent;
- QModelIndex sibling(int row, int column, const QModelIndex &idx) const Q_DECL_OVERRIDE;
- bool hasChildren(const QModelIndex &parent = QModelIndex()) const Q_DECL_OVERRIDE;
- bool canFetchMore(const QModelIndex &parent) const Q_DECL_OVERRIDE;
- void fetchMore(const QModelIndex &parent) Q_DECL_OVERRIDE;
+ QModelIndex sibling(int row, int column, const QModelIndex &idx) const override;
+ bool hasChildren(const QModelIndex &parent = QModelIndex()) const override;
+ bool canFetchMore(const QModelIndex &parent) const override;
+ void fetchMore(const QModelIndex &parent) override;
- int rowCount(const QModelIndex &parent = QModelIndex()) const Q_DECL_OVERRIDE;
- int columnCount(const QModelIndex &parent = QModelIndex()) const Q_DECL_OVERRIDE;
+ int rowCount(const QModelIndex &parent = QModelIndex()) const override;
+ int columnCount(const QModelIndex &parent = QModelIndex()) const override;
QVariant myComputer(int role = Qt::DisplayRole) const;
- QVariant data(const QModelIndex &index, int role = Qt::DisplayRole) const Q_DECL_OVERRIDE;
- bool setData(const QModelIndex &index, const QVariant &value, int role = Qt::EditRole) Q_DECL_OVERRIDE;
+ QVariant data(const QModelIndex &index, int role = Qt::DisplayRole) const override;
+ bool setData(const QModelIndex &index, const QVariant &value, int role = Qt::EditRole) override;
- QVariant headerData(int section, Qt::Orientation orientation, int role = Qt::DisplayRole) const Q_DECL_OVERRIDE;
+ QVariant headerData(int section, Qt::Orientation orientation, int role = Qt::DisplayRole) const override;
- Qt::ItemFlags flags(const QModelIndex &index) const Q_DECL_OVERRIDE;
+ Qt::ItemFlags flags(const QModelIndex &index) const override;
- void sort(int column, Qt::SortOrder order = Qt::AscendingOrder) Q_DECL_OVERRIDE;
+ void sort(int column, Qt::SortOrder order = Qt::AscendingOrder) override;
- QStringList mimeTypes() const Q_DECL_OVERRIDE;
- QMimeData *mimeData(const QModelIndexList &indexes) const Q_DECL_OVERRIDE;
+ QStringList mimeTypes() const override;
+ QMimeData *mimeData(const QModelIndexList &indexes) const override;
bool dropMimeData(const QMimeData *data, Qt::DropAction action,
- int row, int column, const QModelIndex &parent) Q_DECL_OVERRIDE;
- Qt::DropActions supportedDropActions() const Q_DECL_OVERRIDE;
+ int row, int column, const QModelIndex &parent) override;
+ Qt::DropActions supportedDropActions() const override;
// QFileSystemModel specific API
QModelIndex setRootPath(const QString &path);
@@ -144,9 +144,9 @@ public:
bool remove(const QModelIndex &index);
protected:
- QFileSystemModel(QFileSystemModelPrivate &, QObject *parent = Q_NULLPTR);
- void timerEvent(QTimerEvent *event) Q_DECL_OVERRIDE;
- bool event(QEvent *event) Q_DECL_OVERRIDE;
+ QFileSystemModel(QFileSystemModelPrivate &, QObject *parent = nullptr);
+ void timerEvent(QTimerEvent *event) override;
+ bool event(QEvent *event) override;
private:
Q_DECLARE_PRIVATE(QFileSystemModel)
diff --git a/src/widgets/dialogs/qfontdialog.cpp b/src/widgets/dialogs/qfontdialog.cpp
index 587e31d8c5..5f912c582f 100644
--- a/src/widgets/dialogs/qfontdialog.cpp
+++ b/src/widgets/dialogs/qfontdialog.cpp
@@ -84,7 +84,7 @@ public:
int row = QListView::currentIndex().row();
return row < 0 ? QString() : model()->stringList().at(row);
}
- void currentChanged(const QModelIndex &current, const QModelIndex &previous) Q_DECL_OVERRIDE {
+ void currentChanged(const QModelIndex &current, const QModelIndex &previous) override {
QListView::currentChanged(current, previous);
if (current.isValid())
emit highlighted(current.row());
diff --git a/src/widgets/dialogs/qfontdialog.h b/src/widgets/dialogs/qfontdialog.h
index 3fb3997b85..ae1320e779 100644
--- a/src/widgets/dialogs/qfontdialog.h
+++ b/src/widgets/dialogs/qfontdialog.h
@@ -72,8 +72,8 @@ public:
Q_DECLARE_FLAGS(FontDialogOptions, FontDialogOption)
- explicit QFontDialog(QWidget *parent = Q_NULLPTR);
- explicit QFontDialog(const QFont &initial, QWidget *parent = Q_NULLPTR);
+ explicit QFontDialog(QWidget *parent = nullptr);
+ explicit QFontDialog(const QFont &initial, QWidget *parent = nullptr);
~QFontDialog();
void setCurrentFont(const QFont &font);
@@ -89,10 +89,10 @@ public:
using QDialog::open;
void open(QObject *receiver, const char *member);
- void setVisible(bool visible) Q_DECL_OVERRIDE;
+ void setVisible(bool visible) override;
- static QFont getFont(bool *ok, QWidget *parent = Q_NULLPTR);
- static QFont getFont(bool *ok, const QFont &initial, QWidget *parent = Q_NULLPTR, const QString &title = QString(),
+ static QFont getFont(bool *ok, QWidget *parent = nullptr);
+ static QFont getFont(bool *ok, const QFont &initial, QWidget *parent = nullptr, const QString &title = QString(),
FontDialogOptions options = FontDialogOptions());
Q_SIGNALS:
@@ -100,9 +100,9 @@ Q_SIGNALS:
void fontSelected(const QFont &font);
protected:
- void changeEvent(QEvent *event) Q_DECL_OVERRIDE;
- void done(int result) Q_DECL_OVERRIDE;
- bool eventFilter(QObject *object, QEvent *event) Q_DECL_OVERRIDE;
+ void changeEvent(QEvent *event) override;
+ void done(int result) override;
+ bool eventFilter(QObject *object, QEvent *event) override;
private:
Q_DISABLE_COPY(QFontDialog)
diff --git a/src/widgets/dialogs/qfontdialog_p.h b/src/widgets/dialogs/qfontdialog_p.h
index ae923d94ed..202247a3b4 100644
--- a/src/widgets/dialogs/qfontdialog_p.h
+++ b/src/widgets/dialogs/qfontdialog_p.h
@@ -141,12 +141,12 @@ public:
QPointer<QObject> receiverToDisconnectOnClose;
QByteArray memberToDisconnectOnClose;
- bool canBeNativeDialog() const Q_DECL_OVERRIDE;
+ bool canBeNativeDialog() const override;
void _q_runNativeAppModalPanel();
private:
- virtual void initHelper(QPlatformDialogHelper *) Q_DECL_OVERRIDE;
- virtual void helperPrepareShow(QPlatformDialogHelper *) Q_DECL_OVERRIDE;
+ virtual void initHelper(QPlatformDialogHelper *) override;
+ virtual void helperPrepareShow(QPlatformDialogHelper *) override;
};
QT_END_NAMESPACE
diff --git a/src/widgets/dialogs/qfscompleter_p.h b/src/widgets/dialogs/qfscompleter_p.h
index ce0612f293..3b829d4a52 100644
--- a/src/widgets/dialogs/qfscompleter_p.h
+++ b/src/widgets/dialogs/qfscompleter_p.h
@@ -71,8 +71,8 @@ public:
setCaseSensitivity(Qt::CaseInsensitive);
#endif
}
- QString pathFromIndex(const QModelIndex &index) const Q_DECL_OVERRIDE;
- QStringList splitPath(const QString& path) const Q_DECL_OVERRIDE;
+ QString pathFromIndex(const QModelIndex &index) const override;
+ QStringList splitPath(const QString& path) const override;
QAbstractProxyModel *proxyModel;
QFileSystemModel *sourceModel;
diff --git a/src/widgets/dialogs/qinputdialog.cpp b/src/widgets/dialogs/qinputdialog.cpp
index 4c0f22ae97..c03df08345 100644
--- a/src/widgets/dialogs/qinputdialog.cpp
+++ b/src/widgets/dialogs/qinputdialog.cpp
@@ -74,7 +74,7 @@ static const char *candidateSignal(int which)
case NumCandidateSignals: ; // fall through
};
Q_UNREACHABLE();
- return Q_NULLPTR;
+ return nullptr;
}
static const char *signalForMember(const char *member)
@@ -115,7 +115,7 @@ private slots:
void notifyTextChanged() { emit textChanged(hasAcceptableInput()); }
private:
- void keyPressEvent(QKeyEvent *event) Q_DECL_OVERRIDE {
+ void keyPressEvent(QKeyEvent *event) override {
if ((event->key() == Qt::Key_Return || event->key() == Qt::Key_Enter) && !hasAcceptableInput()) {
#ifndef QT_NO_PROPERTIES
setProperty("value", property("value"));
@@ -126,7 +126,7 @@ private:
notifyTextChanged();
}
- void mousePressEvent(QMouseEvent *event) Q_DECL_OVERRIDE {
+ void mousePressEvent(QMouseEvent *event) override {
QSpinBox::mousePressEvent(event);
notifyTextChanged();
}
@@ -150,7 +150,7 @@ private slots:
void notifyTextChanged() { emit textChanged(hasAcceptableInput()); }
private:
- void keyPressEvent(QKeyEvent *event) Q_DECL_OVERRIDE {
+ void keyPressEvent(QKeyEvent *event) override {
if ((event->key() == Qt::Key_Return || event->key() == Qt::Key_Enter) && !hasAcceptableInput()) {
#ifndef QT_NO_PROPERTIES
setProperty("value", property("value"));
@@ -161,7 +161,7 @@ private:
notifyTextChanged();
}
- void mousePressEvent(QMouseEvent *event) Q_DECL_OVERRIDE {
+ void mousePressEvent(QMouseEvent *event) override {
QDoubleSpinBox::mousePressEvent(event);
notifyTextChanged();
}
@@ -239,7 +239,6 @@ void QInputDialogPrivate::ensureLayout()
QObject::connect(buttonBox, SIGNAL(rejected()), q, SLOT(reject()));
mainLayout = new QVBoxLayout(q);
- //we want to let the input dialog grow to available size on Symbian.
mainLayout->setSizeConstraint(QLayout::SetMinAndMaxSize);
mainLayout->addWidget(label);
mainLayout->addWidget(inputWidget);
diff --git a/src/widgets/dialogs/qinputdialog.h b/src/widgets/dialogs/qinputdialog.h
index e41d442498..c3a5e59d53 100644
--- a/src/widgets/dialogs/qinputdialog.h
+++ b/src/widgets/dialogs/qinputdialog.h
@@ -91,7 +91,7 @@ public:
DoubleInput
};
- QInputDialog(QWidget *parent = Q_NULLPTR, Qt::WindowFlags flags = Qt::WindowFlags());
+ QInputDialog(QWidget *parent = nullptr, Qt::WindowFlags flags = Qt::WindowFlags());
~QInputDialog();
void setInputMode(InputMode mode);
@@ -154,31 +154,31 @@ public:
using QDialog::open;
void open(QObject *receiver, const char *member);
- QSize minimumSizeHint() const Q_DECL_OVERRIDE;
- QSize sizeHint() const Q_DECL_OVERRIDE;
+ QSize minimumSizeHint() const override;
+ QSize sizeHint() const override;
- void setVisible(bool visible) Q_DECL_OVERRIDE;
+ void setVisible(bool visible) override;
static QString getText(QWidget *parent, const QString &title, const QString &label,
QLineEdit::EchoMode echo = QLineEdit::Normal,
- const QString &text = QString(), bool *ok = Q_NULLPTR,
+ const QString &text = QString(), bool *ok = nullptr,
Qt::WindowFlags flags = Qt::WindowFlags(),
Qt::InputMethodHints inputMethodHints = Qt::ImhNone);
static QString getMultiLineText(QWidget *parent, const QString &title, const QString &label,
- const QString &text = QString(), bool *ok = Q_NULLPTR,
+ const QString &text = QString(), bool *ok = nullptr,
Qt::WindowFlags flags = Qt::WindowFlags(),
Qt::InputMethodHints inputMethodHints = Qt::ImhNone);
static QString getItem(QWidget *parent, const QString &title, const QString &label,
const QStringList &items, int current = 0, bool editable = true,
- bool *ok = Q_NULLPTR, Qt::WindowFlags flags = Qt::WindowFlags(),
+ bool *ok = nullptr, Qt::WindowFlags flags = Qt::WindowFlags(),
Qt::InputMethodHints inputMethodHints = Qt::ImhNone);
static int getInt(QWidget *parent, const QString &title, const QString &label, int value = 0,
int minValue = -2147483647, int maxValue = 2147483647,
- int step = 1, bool *ok = Q_NULLPTR, Qt::WindowFlags flags = Qt::WindowFlags());
+ int step = 1, bool *ok = nullptr, Qt::WindowFlags flags = Qt::WindowFlags());
static double getDouble(QWidget *parent, const QString &title, const QString &label, double value = 0,
double minValue = -2147483647, double maxValue = 2147483647,
- int decimals = 1, bool *ok = Q_NULLPTR, Qt::WindowFlags flags = Qt::WindowFlags());
+ int decimals = 1, bool *ok = nullptr, Qt::WindowFlags flags = Qt::WindowFlags());
// ### Qt 6: merge overloads
static double getDouble(QWidget *parent, const QString &title, const QString &label, double value,
double minValue, double maxValue, int decimals, bool *ok, Qt::WindowFlags flags,
@@ -187,7 +187,7 @@ public:
#if QT_DEPRECATED_SINCE(5, 0)
QT_DEPRECATED static inline int getInteger(QWidget *parent, const QString &title, const QString &label, int value = 0,
int minValue = -2147483647, int maxValue = 2147483647,
- int step = 1, bool *ok = Q_NULLPTR, Qt::WindowFlags flags = Qt::WindowFlags())
+ int step = 1, bool *ok = nullptr, Qt::WindowFlags flags = Qt::WindowFlags())
{
return getInt(parent, title, label, value, minValue, maxValue, step, ok, flags);
}
@@ -206,7 +206,7 @@ Q_SIGNALS:
void doubleValueSelected(double value);
public:
- void done(int result) Q_DECL_OVERRIDE;
+ void done(int result) override;
private:
Q_DISABLE_COPY(QInputDialog)
diff --git a/src/widgets/dialogs/qmessagebox.cpp b/src/widgets/dialogs/qmessagebox.cpp
index fdfffb45cf..cb8ac1ccbf 100644
--- a/src/widgets/dialogs/qmessagebox.cpp
+++ b/src/widgets/dialogs/qmessagebox.cpp
@@ -98,7 +98,7 @@ public:
public:
TextEdit(QWidget *parent=0) : QTextEdit(parent) { }
#ifndef QT_NO_CONTEXTMENU
- void contextMenuEvent(QContextMenuEvent * e) Q_DECL_OVERRIDE
+ void contextMenuEvent(QContextMenuEvent * e) override
{
QMenu *menu = createStandardContextMenu();
menu->setAttribute(Qt::WA_DeleteOnClose);
@@ -173,7 +173,7 @@ public:
void setLabel(DetailButtonLabel lbl)
{ setText(label(lbl)); }
- QSize sizeHint() const Q_DECL_OVERRIDE
+ QSize sizeHint() const override
{
ensurePolished();
QStyleOptionButton opt;
@@ -259,9 +259,9 @@ public:
QByteArray signalToDisconnectOnClose;
QSharedPointer<QMessageDialogOptions> options;
private:
- void initHelper(QPlatformDialogHelper *) Q_DECL_OVERRIDE;
- void helperPrepareShow(QPlatformDialogHelper *) Q_DECL_OVERRIDE;
- void helperDone(QDialog::DialogCode, QPlatformDialogHelper *) Q_DECL_OVERRIDE;
+ void initHelper(QPlatformDialogHelper *) override;
+ void helperPrepareShow(QPlatformDialogHelper *) override;
+ void helperDone(QDialog::DialogCode, QPlatformDialogHelper *) override;
};
void QMessageBoxPrivate::init(const QString &title, const QString &text)
@@ -415,7 +415,7 @@ void QMessageBoxPrivate::updateSize()
}
QFontMetrics fm(QApplication::font("QMdiSubWindowTitleBar"));
- int windowTitleWidth = qMin(fm.width(q->windowTitle()) + 50, hardLimit);
+ int windowTitleWidth = qMin(fm.horizontalAdvance(q->windowTitle()) + 50, hardLimit);
if (windowTitleWidth > width)
width = windowTitleWidth;
@@ -2608,7 +2608,7 @@ QPixmap QMessageBoxPrivate::standardIcon(QMessageBox::Icon icon, QMessageBox *mb
break;
}
if (!tmpIcon.isNull()) {
- QWindow *window = Q_NULLPTR;
+ QWindow *window = nullptr;
if (mb) {
window = mb->windowHandle();
if (!window) {
diff --git a/src/widgets/dialogs/qmessagebox.h b/src/widgets/dialogs/qmessagebox.h
index fd7d7936b6..4b993a9e65 100644
--- a/src/widgets/dialogs/qmessagebox.h
+++ b/src/widgets/dialogs/qmessagebox.h
@@ -132,9 +132,9 @@ public:
Q_DECLARE_FLAGS(StandardButtons, StandardButton)
Q_FLAG(StandardButtons)
- explicit QMessageBox(QWidget *parent = Q_NULLPTR);
+ explicit QMessageBox(QWidget *parent = nullptr);
QMessageBox(Icon icon, const QString &title, const QString &text,
- StandardButtons buttons = NoButton, QWidget *parent = Q_NULLPTR,
+ StandardButtons buttons = NoButton, QWidget *parent = nullptr,
Qt::WindowFlags flags = Qt::Dialog | Qt::MSWindowsFixedSizeDialogHint);
~QMessageBox();
@@ -201,7 +201,7 @@ public:
QMessageBox(const QString &title, const QString &text, Icon icon,
int button0, int button1, int button2,
- QWidget *parent = Q_NULLPTR,
+ QWidget *parent = nullptr,
Qt::WindowFlags f = Qt::Dialog | Qt::MSWindowsFixedSizeDialogHint);
static int information(QWidget *parent, const QString &title,
@@ -290,12 +290,12 @@ public Q_SLOTS:
#endif
protected:
- bool event(QEvent *e) Q_DECL_OVERRIDE;
- void resizeEvent(QResizeEvent *event) Q_DECL_OVERRIDE;
- void showEvent(QShowEvent *event) Q_DECL_OVERRIDE;
- void closeEvent(QCloseEvent *event) Q_DECL_OVERRIDE;
- void keyPressEvent(QKeyEvent *event) Q_DECL_OVERRIDE;
- void changeEvent(QEvent *event) Q_DECL_OVERRIDE;
+ bool event(QEvent *e) override;
+ void resizeEvent(QResizeEvent *event) override;
+ void showEvent(QShowEvent *event) override;
+ void closeEvent(QCloseEvent *event) override;
+ void keyPressEvent(QKeyEvent *event) override;
+ void changeEvent(QEvent *event) override;
private:
Q_PRIVATE_SLOT(d_func(), void _q_buttonClicked(QAbstractButton *))
diff --git a/src/widgets/dialogs/qprogressdialog.h b/src/widgets/dialogs/qprogressdialog.h
index 902a4de5d2..74adb6bd84 100644
--- a/src/widgets/dialogs/qprogressdialog.h
+++ b/src/widgets/dialogs/qprogressdialog.h
@@ -68,9 +68,9 @@ class Q_WIDGETS_EXPORT QProgressDialog : public QDialog
Q_PROPERTY(QString labelText READ labelText WRITE setLabelText)
public:
- explicit QProgressDialog(QWidget *parent = Q_NULLPTR, Qt::WindowFlags flags = Qt::WindowFlags());
+ explicit QProgressDialog(QWidget *parent = nullptr, Qt::WindowFlags flags = Qt::WindowFlags());
QProgressDialog(const QString &labelText, const QString &cancelButtonText,
- int minimum, int maximum, QWidget *parent = Q_NULLPTR,
+ int minimum, int maximum, QWidget *parent = nullptr,
Qt::WindowFlags flags = Qt::WindowFlags());
~QProgressDialog();
@@ -85,7 +85,7 @@ public:
int value() const;
- QSize sizeHint() const Q_DECL_OVERRIDE;
+ QSize sizeHint() const override;
QString labelText() const;
int minimumDuration() const;
@@ -113,10 +113,10 @@ Q_SIGNALS:
void canceled();
protected:
- void resizeEvent(QResizeEvent *event) Q_DECL_OVERRIDE;
- void closeEvent(QCloseEvent *event) Q_DECL_OVERRIDE;
- void changeEvent(QEvent *event) Q_DECL_OVERRIDE;
- void showEvent(QShowEvent *event) Q_DECL_OVERRIDE;
+ void resizeEvent(QResizeEvent *event) override;
+ void closeEvent(QCloseEvent *event) override;
+ void changeEvent(QEvent *event) override;
+ void showEvent(QShowEvent *event) override;
protected Q_SLOTS:
void forceShow();
diff --git a/src/widgets/dialogs/qsidebar_p.h b/src/widgets/dialogs/qsidebar_p.h
index 1f27d477a8..07aaa5abd2 100644
--- a/src/widgets/dialogs/qsidebar_p.h
+++ b/src/widgets/dialogs/qsidebar_p.h
@@ -69,7 +69,7 @@ class QSideBarDelegate : public QStyledItemDelegate
public:
QSideBarDelegate(QWidget *parent = 0) : QStyledItemDelegate(parent) {}
void initStyleOption(QStyleOptionViewItem *option,
- const QModelIndex &index) const Q_DECL_OVERRIDE;
+ const QModelIndex &index) const override;
};
class Q_AUTOTEST_EXPORT QUrlModel : public QStandardItemModel
@@ -84,14 +84,14 @@ public:
QUrlModel(QObject *parent = 0);
- QStringList mimeTypes() const Q_DECL_OVERRIDE;
- QMimeData *mimeData(const QModelIndexList &indexes) const Q_DECL_OVERRIDE;
+ QStringList mimeTypes() const override;
+ QMimeData *mimeData(const QModelIndexList &indexes) const override;
#ifndef QT_NO_DRAGANDDROP
bool canDrop(QDragEnterEvent *event);
- bool dropMimeData(const QMimeData *data, Qt::DropAction action, int row, int column, const QModelIndex &parent) Q_DECL_OVERRIDE;
+ bool dropMimeData(const QMimeData *data, Qt::DropAction action, int row, int column, const QModelIndex &parent) override;
#endif
- Qt::ItemFlags flags(const QModelIndex &index) const Q_DECL_OVERRIDE;
- bool setData(const QModelIndex &index, const QVariant &value, int role=Qt::EditRole) Q_DECL_OVERRIDE;
+ Qt::ItemFlags flags(const QModelIndex &index) const override;
+ bool setData(const QModelIndex &index, const QVariant &value, int role=Qt::EditRole) override;
void setUrls(const QList<QUrl> &list);
void addUrls(const QList<QUrl> &urls, int row = -1, bool move = true);
@@ -131,7 +131,7 @@ public:
void setModelAndUrls(QFileSystemModel *model, const QList<QUrl> &newUrls);
~QSidebar();
- QSize sizeHint() const Q_DECL_OVERRIDE;
+ QSize sizeHint() const override;
void setUrls(const QList<QUrl> &list) { urlModel->setUrls(list); }
void addUrls(const QList<QUrl> &list, int row) { urlModel->addUrls(list, row); }
@@ -140,10 +140,10 @@ public:
void selectUrl(const QUrl &url);
protected:
- bool event(QEvent * e) Q_DECL_OVERRIDE;
- void focusInEvent(QFocusEvent *event) Q_DECL_OVERRIDE;
+ bool event(QEvent * e) override;
+ void focusInEvent(QFocusEvent *event) override;
#ifndef QT_NO_DRAGANDDROP
- void dragEnterEvent(QDragEnterEvent *event) Q_DECL_OVERRIDE;
+ void dragEnterEvent(QDragEnterEvent *event) override;
#endif
private Q_SLOTS:
diff --git a/src/widgets/dialogs/qwizard.cpp b/src/widgets/dialogs/qwizard.cpp
index 890069ca1a..3876cf16c6 100644
--- a/src/widgets/dialogs/qwizard.cpp
+++ b/src/widgets/dialogs/qwizard.cpp
@@ -298,7 +298,7 @@ public:
Qt::TextFormat titleFormat, Qt::TextFormat subTitleFormat);
protected:
- void paintEvent(QPaintEvent *event) Q_DECL_OVERRIDE;
+ void paintEvent(QPaintEvent *event) override;
#if QT_CONFIG(style_windowsvista)
private:
bool vistaDisabled() const;
@@ -454,7 +454,7 @@ public:
m_layout->addWidget(m_sideWidget);
}
- QSize minimumSizeHint() const Q_DECL_OVERRIDE {
+ QSize minimumSizeHint() const override {
if (pixmap() && !pixmap()->isNull())
return pixmap()->size();
return QFrame::minimumSizeHint();
@@ -579,7 +579,7 @@ public:
, bottomRuler(0)
#if QT_CONFIG(style_windowsvista)
, vistaHelper(0)
- , vistaInitPending(false)
+ , vistaInitPending(true)
, vistaState(QVistaHelper::Dirty)
, vistaStateChanged(false)
, inHandleAeroStyleChange(false)
@@ -590,12 +590,6 @@ public:
, maximumHeight(QWIDGETSIZE_MAX)
{
std::fill(btns, btns + QWizard::NButtons, static_cast<QAbstractButton *>(0));
-
-#if QT_CONFIG(style_windowsvista)
- if (QSysInfo::WindowsVersion >= QSysInfo::WV_VISTA
- && (QSysInfo::WindowsVersion & QSysInfo::WV_NT_based))
- vistaInitPending = true;
-#endif
}
void init();
diff --git a/src/widgets/dialogs/qwizard.h b/src/widgets/dialogs/qwizard.h
index 4d03bf91d4..0dd837b197 100644
--- a/src/widgets/dialogs/qwizard.h
+++ b/src/widgets/dialogs/qwizard.h
@@ -120,7 +120,7 @@ public:
Q_DECLARE_FLAGS(WizardOptions, WizardOption)
Q_FLAG(WizardOptions)
- explicit QWizard(QWidget *parent = Q_NULLPTR, Qt::WindowFlags flags = Qt::WindowFlags());
+ explicit QWizard(QWidget *parent = nullptr, Qt::WindowFlags flags = Qt::WindowFlags());
~QWizard();
int addPage(QWizardPage *page);
@@ -168,8 +168,8 @@ public:
void setDefaultProperty(const char *className, const char *property,
const char *changedSignal);
- void setVisible(bool visible) Q_DECL_OVERRIDE;
- QSize sizeHint() const Q_DECL_OVERRIDE;
+ void setVisible(bool visible) override;
+ QSize sizeHint() const override;
Q_SIGNALS:
void currentIdChanged(int id);
@@ -184,13 +184,13 @@ public Q_SLOTS:
void restart();
protected:
- bool event(QEvent *event) Q_DECL_OVERRIDE;
- void resizeEvent(QResizeEvent *event) Q_DECL_OVERRIDE;
- void paintEvent(QPaintEvent *event) Q_DECL_OVERRIDE;
+ bool event(QEvent *event) override;
+ void resizeEvent(QResizeEvent *event) override;
+ void paintEvent(QPaintEvent *event) override;
#if defined(Q_OS_WIN) || defined(Q_CLANG_QDOC)
- bool nativeEvent(const QByteArray &eventType, void *message, long *result) Q_DECL_OVERRIDE;
+ bool nativeEvent(const QByteArray &eventType, void *message, long *result) override;
#endif
- void done(int result) Q_DECL_OVERRIDE;
+ void done(int result) override;
virtual void initializePage(int id);
virtual void cleanupPage(int id);
@@ -215,7 +215,7 @@ class Q_WIDGETS_EXPORT QWizardPage : public QWidget
Q_PROPERTY(QString subTitle READ subTitle WRITE setSubTitle)
public:
- explicit QWizardPage(QWidget *parent = Q_NULLPTR);
+ explicit QWizardPage(QWidget *parent = nullptr);
~QWizardPage();
void setTitle(const QString &title);
@@ -243,8 +243,8 @@ Q_SIGNALS:
protected:
void setField(const QString &name, const QVariant &value);
QVariant field(const QString &name) const;
- void registerField(const QString &name, QWidget *widget, const char *property = Q_NULLPTR,
- const char *changedSignal = Q_NULLPTR);
+ void registerField(const QString &name, QWidget *widget, const char *property = nullptr,
+ const char *changedSignal = nullptr);
QWizard *wizard() const;
private:
diff --git a/src/widgets/dialogs/qwizard_win.cpp b/src/widgets/dialogs/qwizard_win.cpp
index bedcd1b0c2..e7b4870e35 100644
--- a/src/widgets/dialogs/qwizard_win.cpp
+++ b/src/widgets/dialogs/qwizard_win.cpp
@@ -154,10 +154,7 @@ QVistaHelper::QVistaHelper(QWizard *wizard)
backButton_ = new QVistaBackButton(wizard);
backButton_->hide();
- // Handle diff between Windows 7 and Vista
iconSpacing = QStyleHelper::dpiScaled(7);
- textSpacing = QSysInfo::WindowsVersion >= QSysInfo::WV_WINDOWS7 ?
- iconSpacing : QStyleHelper::dpiScaled(20);
}
QVistaHelper::~QVistaHelper()
@@ -695,7 +692,7 @@ int QVistaHelper::captionSizeDp()
int QVistaHelper::titleOffset()
{
- int iconOffset = wizard ->windowIcon().isNull() ? 0 : iconSize() + textSpacing;
+ int iconOffset = wizard ->windowIcon().isNull() ? 0 : iconSize() + iconSpacing;
return leftMargin() + iconOffset;
}
diff --git a/src/widgets/dialogs/qwizard_win_p.h b/src/widgets/dialogs/qwizard_win_p.h
index f9122865c2..7ca4899a1f 100644
--- a/src/widgets/dialogs/qwizard_win_p.h
+++ b/src/widgets/dialogs/qwizard_win_p.h
@@ -104,8 +104,7 @@ public:
static int titleBarSize() { return QVistaHelper::titleBarSizeDp() / QVistaHelper::m_devicePixelRatio; }
static int titleBarSizeDp() { return QVistaHelper::frameSizeDp() + QVistaHelper::captionSizeDp(); }
static int topPadding() { // padding under text
- return int(QStyleHelper::dpiScaled(
- QSysInfo::WindowsVersion >= QSysInfo::WV_WINDOWS7 ? 4 : 6));
+ return int(QStyleHelper::dpiScaled(4));
}
static int topOffset();
@@ -150,7 +149,6 @@ private:
int titleBarOffset; // Extra spacing above the text
int iconSpacing; // Space between button and icon
- int textSpacing; // Space between icon and text
static int m_devicePixelRatio;
};
diff --git a/src/widgets/doc/snippets/javastyle.cpp b/src/widgets/doc/snippets/javastyle.cpp
index bddc303f71..8657d5ed29 100644
--- a/src/widgets/doc/snippets/javastyle.cpp
+++ b/src/widgets/doc/snippets/javastyle.cpp
@@ -214,7 +214,7 @@ void JavaStyle::drawControl(ControlElement control, const QStyleOption *option,
painter->translate(box->rect.width(), -box->rect.height());
}
- int textWidth = box->fontMetrics.width(box->text) + 20;
+ int textWidth = box->fontMetrics.horizontalAdvance(box->text) + 20;
QPolygon innerLine;
innerLine << (box->rect.topLeft() + QPoint(0, 1)) <<
@@ -1016,7 +1016,7 @@ void JavaStyle::drawControl(ControlElement control, const QStyleOption *option,
int h = pixmap.height();
if (!button->text.isEmpty())
- w += button->fontMetrics.width(button->text) + 2;
+ w += button->fontMetrics.horizontalAdvance(button->text) + 2;
point = QPoint(ir.x() + ir.width() / 2 - w / 2,
ir.y() + ir.height() / 2 - h / 2);
@@ -2453,7 +2453,7 @@ QRect JavaStyle::subElementRect(SubElement element,
rect.moveTopLeft(box->rect.topLeft() + QPoint(0, 2));
rect.setHeight(box->rect.height() - 4);
- rect.setWidth(box->fontMetrics.width(box->text) + 15);
+ rect.setWidth(box->fontMetrics.horizontalAdvance(box->text) + 15);
break;
}
case SE_ProgressBarLabel:
@@ -2467,7 +2467,7 @@ QRect JavaStyle::subElementRect(SubElement element,
qstyleoption_cast<const QStyleOptionButton *>(option);
rect = btn->fontMetrics.boundingRect(btn->text);
- rect = QRect(0, 0, btn->fontMetrics.width(btn->text),
+ rect = QRect(0, 0, btn->fontMetrics.horizontalAdvance(btn->text),
rect.height());
if (!btn->icon.isNull()) {
diff --git a/src/widgets/effects/qgraphicseffect.h b/src/widgets/effects/qgraphicseffect.h
index 78d025ded5..f7c0769778 100644
--- a/src/widgets/effects/qgraphicseffect.h
+++ b/src/widgets/effects/qgraphicseffect.h
@@ -79,7 +79,7 @@ public:
PadToEffectiveBoundingRect
};
- QGraphicsEffect(QObject *parent = Q_NULLPTR);
+ QGraphicsEffect(QObject *parent = nullptr);
virtual ~QGraphicsEffect();
virtual QRectF boundingRectFor(const QRectF &sourceRect) const;
@@ -95,7 +95,7 @@ Q_SIGNALS:
void enabledChanged(bool enabled);
protected:
- QGraphicsEffect(QGraphicsEffectPrivate &d, QObject *parent = Q_NULLPTR);
+ QGraphicsEffect(QGraphicsEffectPrivate &d, QObject *parent = nullptr);
virtual void draw(QPainter *painter) = 0;
virtual void sourceChanged(ChangeFlags flags);
void updateBoundingRect();
@@ -104,7 +104,7 @@ protected:
QRectF sourceBoundingRect(Qt::CoordinateSystem system = Qt::LogicalCoordinates) const;
void drawSource(QPainter *painter);
QPixmap sourcePixmap(Qt::CoordinateSystem system = Qt::LogicalCoordinates,
- QPoint *offset = Q_NULLPTR,
+ QPoint *offset = nullptr,
PixmapPadMode mode = PadToEffectiveBoundingRect) const;
private:
@@ -129,7 +129,7 @@ class Q_WIDGETS_EXPORT QGraphicsColorizeEffect: public QGraphicsEffect
Q_PROPERTY(QColor color READ color WRITE setColor NOTIFY colorChanged)
Q_PROPERTY(qreal strength READ strength WRITE setStrength NOTIFY strengthChanged)
public:
- QGraphicsColorizeEffect(QObject *parent = Q_NULLPTR);
+ QGraphicsColorizeEffect(QObject *parent = nullptr);
~QGraphicsColorizeEffect();
QColor color() const;
@@ -144,7 +144,7 @@ Q_SIGNALS:
void strengthChanged(qreal strength);
protected:
- void draw(QPainter *painter) Q_DECL_OVERRIDE;
+ void draw(QPainter *painter) override;
private:
Q_DECLARE_PRIVATE(QGraphicsColorizeEffect)
@@ -167,10 +167,10 @@ public:
Q_DECLARE_FLAGS(BlurHints, BlurHint)
Q_FLAG(BlurHints)
- QGraphicsBlurEffect(QObject *parent = Q_NULLPTR);
+ QGraphicsBlurEffect(QObject *parent = nullptr);
~QGraphicsBlurEffect();
- QRectF boundingRectFor(const QRectF &rect) const Q_DECL_OVERRIDE;
+ QRectF boundingRectFor(const QRectF &rect) const override;
qreal blurRadius() const;
BlurHints blurHints() const;
@@ -183,7 +183,7 @@ Q_SIGNALS:
void blurHintsChanged(BlurHints hints);
protected:
- void draw(QPainter *painter) Q_DECL_OVERRIDE;
+ void draw(QPainter *painter) override;
private:
Q_DECLARE_PRIVATE(QGraphicsBlurEffect)
@@ -202,10 +202,10 @@ class Q_WIDGETS_EXPORT QGraphicsDropShadowEffect: public QGraphicsEffect
Q_PROPERTY(qreal blurRadius READ blurRadius WRITE setBlurRadius NOTIFY blurRadiusChanged)
Q_PROPERTY(QColor color READ color WRITE setColor NOTIFY colorChanged)
public:
- QGraphicsDropShadowEffect(QObject *parent = Q_NULLPTR);
+ QGraphicsDropShadowEffect(QObject *parent = nullptr);
~QGraphicsDropShadowEffect();
- QRectF boundingRectFor(const QRectF &rect) const Q_DECL_OVERRIDE;
+ QRectF boundingRectFor(const QRectF &rect) const override;
QPointF offset() const;
inline qreal xOffset() const
@@ -241,7 +241,7 @@ Q_SIGNALS:
void colorChanged(const QColor &color);
protected:
- void draw(QPainter *painter) Q_DECL_OVERRIDE;
+ void draw(QPainter *painter) override;
private:
Q_DECLARE_PRIVATE(QGraphicsDropShadowEffect)
@@ -255,7 +255,7 @@ class Q_WIDGETS_EXPORT QGraphicsOpacityEffect: public QGraphicsEffect
Q_PROPERTY(qreal opacity READ opacity WRITE setOpacity NOTIFY opacityChanged)
Q_PROPERTY(QBrush opacityMask READ opacityMask WRITE setOpacityMask NOTIFY opacityMaskChanged)
public:
- QGraphicsOpacityEffect(QObject *parent = Q_NULLPTR);
+ QGraphicsOpacityEffect(QObject *parent = nullptr);
~QGraphicsOpacityEffect();
qreal opacity() const;
@@ -270,7 +270,7 @@ Q_SIGNALS:
void opacityMaskChanged(const QBrush &mask);
protected:
- void draw(QPainter *painter) Q_DECL_OVERRIDE;
+ void draw(QPainter *painter) override;
private:
Q_DECLARE_PRIVATE(QGraphicsOpacityEffect)
diff --git a/src/widgets/effects/qpixmapfilter_p.h b/src/widgets/effects/qpixmapfilter_p.h
index 399a835142..0f582bde60 100644
--- a/src/widgets/effects/qpixmapfilter_p.h
+++ b/src/widgets/effects/qpixmapfilter_p.h
@@ -105,8 +105,8 @@ public:
void setConvolutionKernel(const qreal *matrix, int rows, int columns);
- QRectF boundingRectFor(const QRectF &rect) const Q_DECL_OVERRIDE;
- void draw(QPainter *painter, const QPointF &dest, const QPixmap &src, const QRectF &srcRect = QRectF()) const Q_DECL_OVERRIDE;
+ QRectF boundingRectFor(const QRectF &rect) const override;
+ void draw(QPainter *painter, const QPointF &dest, const QPixmap &src, const QRectF &srcRect = QRectF()) const override;
private:
friend class QGLPixmapConvolutionFilter;
@@ -133,8 +133,8 @@ public:
qreal radius() const;
QGraphicsBlurEffect::BlurHints blurHints() const;
- QRectF boundingRectFor(const QRectF &rect) const Q_DECL_OVERRIDE;
- void draw(QPainter *painter, const QPointF &dest, const QPixmap &src, const QRectF &srcRect = QRectF()) const Q_DECL_OVERRIDE;
+ QRectF boundingRectFor(const QRectF &rect) const override;
+ void draw(QPainter *painter, const QPointF &dest, const QPixmap &src, const QRectF &srcRect = QRectF()) const override;
private:
friend class QGLPixmapBlurFilter;
@@ -157,7 +157,7 @@ public:
void setStrength(qreal strength);
qreal strength() const;
- void draw(QPainter *painter, const QPointF &dest, const QPixmap &src, const QRectF &srcRect = QRectF()) const Q_DECL_OVERRIDE;
+ void draw(QPainter *painter, const QPointF &dest, const QPixmap &src, const QRectF &srcRect = QRectF()) const override;
};
class QPixmapDropShadowFilterPrivate;
@@ -171,8 +171,8 @@ public:
QPixmapDropShadowFilter(QObject *parent = 0);
~QPixmapDropShadowFilter();
- QRectF boundingRectFor(const QRectF &rect) const Q_DECL_OVERRIDE;
- void draw(QPainter *p, const QPointF &pos, const QPixmap &px, const QRectF &src = QRectF()) const Q_DECL_OVERRIDE;
+ QRectF boundingRectFor(const QRectF &rect) const override;
+ void draw(QPainter *p, const QPointF &pos, const QPixmap &px, const QRectF &src = QRectF()) const override;
qreal blurRadius() const;
void setBlurRadius(qreal radius);
diff --git a/src/widgets/graphicsview/qgraphicsanchorlayout.h b/src/widgets/graphicsview/qgraphicsanchorlayout.h
index 01dc30718a..e392be1568 100644
--- a/src/widgets/graphicsview/qgraphicsanchorlayout.h
+++ b/src/widgets/graphicsview/qgraphicsanchorlayout.h
@@ -76,7 +76,7 @@ private:
class Q_WIDGETS_EXPORT QGraphicsAnchorLayout : public QGraphicsLayout
{
public:
- QGraphicsAnchorLayout(QGraphicsLayoutItem *parent = Q_NULLPTR);
+ QGraphicsAnchorLayout(QGraphicsLayoutItem *parent = nullptr);
virtual ~QGraphicsAnchorLayout();
QGraphicsAnchor *addAnchor(QGraphicsLayoutItem *firstItem, Qt::AnchorPoint firstEdge,
@@ -97,14 +97,14 @@ public:
qreal horizontalSpacing() const;
qreal verticalSpacing() const;
- void removeAt(int index) Q_DECL_OVERRIDE;
- void setGeometry(const QRectF &rect) Q_DECL_OVERRIDE;
- int count() const Q_DECL_OVERRIDE;
- QGraphicsLayoutItem *itemAt(int index) const Q_DECL_OVERRIDE;
+ void removeAt(int index) override;
+ void setGeometry(const QRectF &rect) override;
+ int count() const override;
+ QGraphicsLayoutItem *itemAt(int index) const override;
- void invalidate() Q_DECL_OVERRIDE;
+ void invalidate() override;
protected:
- QSizeF sizeHint(Qt::SizeHint which, const QSizeF &constraint = QSizeF()) const Q_DECL_OVERRIDE;
+ QSizeF sizeHint(Qt::SizeHint which, const QSizeF &constraint = QSizeF()) const override;
private:
Q_DISABLE_COPY(QGraphicsAnchorLayout)
diff --git a/src/widgets/graphicsview/qgraphicsanchorlayout_p.h b/src/widgets/graphicsview/qgraphicsanchorlayout_p.h
index e785b486bb..6b2408b2eb 100644
--- a/src/widgets/graphicsview/qgraphicsanchorlayout_p.h
+++ b/src/widgets/graphicsview/qgraphicsanchorlayout_p.h
@@ -198,7 +198,7 @@ struct SequentialAnchorData : public AnchorData
#endif
}
- virtual void updateChildrenSizes() Q_DECL_OVERRIDE;
+ virtual void updateChildrenSizes() override;
void calculateSizeHints();
QVector<AnchorVertex*> m_children; // list of vertices in the sequence
@@ -226,7 +226,7 @@ struct ParallelAnchorData : public AnchorData
#endif
}
- virtual void updateChildrenSizes() Q_DECL_OVERRIDE;
+ virtual void updateChildrenSizes() override;
bool calculateSizeHints();
bool secondForward() const {
diff --git a/src/widgets/graphicsview/qgraphicsgridlayout.h b/src/widgets/graphicsview/qgraphicsgridlayout.h
index fb9bc2e32c..4c0a1b4527 100644
--- a/src/widgets/graphicsview/qgraphicsgridlayout.h
+++ b/src/widgets/graphicsview/qgraphicsgridlayout.h
@@ -53,7 +53,7 @@ class QGraphicsGridLayoutPrivate;
class Q_WIDGETS_EXPORT QGraphicsGridLayout : public QGraphicsLayout
{
public:
- QGraphicsGridLayout(QGraphicsLayoutItem *parent = Q_NULLPTR);
+ QGraphicsGridLayout(QGraphicsLayoutItem *parent = nullptr);
virtual ~QGraphicsGridLayout();
void addItem(QGraphicsLayoutItem *item, int row, int column, int rowSpan, int columnSpan,
@@ -106,16 +106,16 @@ public:
QGraphicsLayoutItem *itemAt(int row, int column) const;
// inherited from QGraphicsLayout
- int count() const Q_DECL_OVERRIDE;
- QGraphicsLayoutItem *itemAt(int index) const Q_DECL_OVERRIDE;
- void removeAt(int index) Q_DECL_OVERRIDE;
+ int count() const override;
+ QGraphicsLayoutItem *itemAt(int index) const override;
+ void removeAt(int index) override;
void removeItem(QGraphicsLayoutItem *item);
- void invalidate() Q_DECL_OVERRIDE;
+ void invalidate() override;
// inherited from QGraphicsLayoutItem
- void setGeometry(const QRectF &rect) Q_DECL_OVERRIDE;
- QSizeF sizeHint(Qt::SizeHint which, const QSizeF &constraint = QSizeF()) const Q_DECL_OVERRIDE;
+ void setGeometry(const QRectF &rect) override;
+ QSizeF sizeHint(Qt::SizeHint which, const QSizeF &constraint = QSizeF()) const override;
// ####
//QRect cellRect(int row, int column, int rowSpan = 1, int columnSpan = 1) const;
diff --git a/src/widgets/graphicsview/qgraphicsgridlayoutengine_p.h b/src/widgets/graphicsview/qgraphicsgridlayoutengine_p.h
index d797f784b8..370df9eed7 100644
--- a/src/widgets/graphicsview/qgraphicsgridlayoutengine_p.h
+++ b/src/widgets/graphicsview/qgraphicsgridlayoutengine_p.h
@@ -71,35 +71,35 @@ public:
Qt::Alignment alignment = 0)
: QGridLayoutItem(row, columns, rowSpan, columnSpan, alignment), q_layoutItem(item) {}
- virtual QLayoutPolicy::Policy sizePolicy(Qt::Orientation orientation) const Q_DECL_OVERRIDE
+ virtual QLayoutPolicy::Policy sizePolicy(Qt::Orientation orientation) const override
{
QSizePolicy sizePolicy(q_layoutItem->sizePolicy());
return (QLayoutPolicy::Policy)((orientation == Qt::Horizontal) ? sizePolicy.horizontalPolicy()
: sizePolicy.verticalPolicy());
}
- virtual QLayoutPolicy::ControlTypes controlTypes(LayoutSide) const Q_DECL_OVERRIDE
+ virtual QLayoutPolicy::ControlTypes controlTypes(LayoutSide) const override
{
const QSizePolicy::ControlType ct = q_layoutItem->sizePolicy().controlType();
return (QLayoutPolicy::ControlTypes)ct;
}
- virtual QSizeF sizeHint(Qt::SizeHint which, const QSizeF &constraint) const Q_DECL_OVERRIDE
+ virtual QSizeF sizeHint(Qt::SizeHint which, const QSizeF &constraint) const override
{
return q_layoutItem->effectiveSizeHint(which, constraint);
}
bool isHidden() const;
- virtual bool isIgnored() const Q_DECL_OVERRIDE;
+ virtual bool isIgnored() const override;
- virtual void setGeometry(const QRectF &rect) Q_DECL_OVERRIDE
+ virtual void setGeometry(const QRectF &rect) override
{
q_layoutItem->setGeometry(rect);
}
- virtual bool hasDynamicConstraint() const Q_DECL_OVERRIDE;
- virtual Qt::Orientation dynamicConstraintOrientation() const Q_DECL_OVERRIDE;
+ virtual bool hasDynamicConstraint() const override;
+ virtual Qt::Orientation dynamicConstraintOrientation() const override;
QGraphicsLayoutItem *layoutItem() const { return q_layoutItem; }
diff --git a/src/widgets/graphicsview/qgraphicsitem.cpp b/src/widgets/graphicsview/qgraphicsitem.cpp
index a649d61135..f298ffd61e 100644
--- a/src/widgets/graphicsview/qgraphicsitem.cpp
+++ b/src/widgets/graphicsview/qgraphicsitem.cpp
@@ -268,27 +268,93 @@
*/
/*!
- \variable QGraphicsItem::Type
+ \enum QGraphicsItem::anonymous
- The type value returned by the virtual type() function in standard
- graphics item classes in Qt. All such standard graphics item
- classes in Qt are associated with a unique value for Type,
- e.g. the value returned by QGraphicsPathItem::type() is 2.
+ The value returned by the virtual type() function in standard
+ graphics item classes in Qt. All such standard graphics item classes
+ in Qt are associated with a unique value for Type, e.g. the value
+ returned by QGraphicsPathItem::type() is 2.
+
+ \value Type
\snippet code/src_gui_graphicsview_qgraphicsitem.cpp 18
+
+ \value UserType The lowest value returned by the virtual type()
+ function for custom subclasses of QGraphicsItem.
+
+ \snippet code/src_gui_graphicsview_qgraphicsitem.cpp 1
*/
/*!
- \variable QGraphicsItem::UserType
+ \enum QGraphicsPathItem::anonymous
- The lowest permitted type value for custom items (subclasses
- of QGraphicsItem or any of the standard items). This value is
- used in conjunction with a reimplementation of QGraphicsItem::type()
- and declaring a Type enum value. Example:
+ The value returned by the virtual type() function.
- \snippet code/src_gui_graphicsview_qgraphicsitem.cpp 1
+ \value Type A graphics path item
+*/
+
+/*!
+ \enum QGraphicsRectItem::anonymous
+
+ The value returned by the virtual type() function.
+
+ \value Type A graphics rect item
+*/
+
+/*!
+ \enum QGraphicsEllipseItem::anonymous
+
+ The value returned by the virtual type() function.
+
+ \value Type A graphics ellipse item
+*/
+
+/*!
+ \enum QGraphicsPolygonItem::anonymous
+
+ The value returned by the virtual type() function.
+
+ \value Type A graphics polygon item
+*/
+
+/*!
+ \enum QGraphicsPixmapItem::anonymous
+
+ The value returned by the virtual type() function.
+
+ \value Type A graphics pixmap item
+*/
+
+/*!
+ \enum QGraphicsTextItem::anonymous
+
+ The value returned by the virtual type() function.
+
+ \value Type A graphics text item
+*/
+
+/*!
+ \enum QGraphicsSimpleTextItem::anonymous
+
+ The value returned by the virtual type() function.
+
+ \value Type A graphics simple text item
+*/
+
+/*!
+ \enum QGraphicsItemGroup::anonymous
+
+ The value returned by the virtual type() function.
+
+ \value Type A graphics item group
+*/
+
+/*!
+ \enum QGraphicsLineItem::anonymous
+
+ The value returned by the virtual type() function.
- \note UserType = 65536
+ \value Type A graphics line item
*/
/*!
diff --git a/src/widgets/graphicsview/qgraphicsitem.h b/src/widgets/graphicsview/qgraphicsitem.h
index 11d872f6e6..47ef5ba80e 100644
--- a/src/widgets/graphicsview/qgraphicsitem.h
+++ b/src/widgets/graphicsview/qgraphicsitem.h
@@ -158,7 +158,7 @@ public:
SceneModal
};
- explicit QGraphicsItem(QGraphicsItem *parent = Q_NULLPTR);
+ explicit QGraphicsItem(QGraphicsItem *parent = nullptr);
virtual ~QGraphicsItem();
QGraphicsScene *scene() const;
@@ -194,7 +194,7 @@ public:
PanelModality panelModality() const;
void setPanelModality(PanelModality panelModality);
- bool isBlockedByModalPanel(QGraphicsItem **blockingPanel = Q_NULLPTR) const;
+ bool isBlockedByModalPanel(QGraphicsItem **blockingPanel = nullptr) const;
#ifndef QT_NO_TOOLTIP
QString toolTip() const;
@@ -290,7 +290,7 @@ public:
QTransform transform() const;
QTransform sceneTransform() const;
QTransform deviceTransform(const QTransform &viewportTransform) const;
- QTransform itemTransform(const QGraphicsItem *other, bool *ok = Q_NULLPTR) const;
+ QTransform itemTransform(const QGraphicsItem *other, bool *ok = nullptr) const;
void setTransform(const QTransform &matrix, bool combine = false);
void resetTransform();
#if QT_DEPRECATED_SINCE(5, 0)
@@ -341,7 +341,7 @@ public:
void setBoundingRegionGranularity(qreal granularity);
// Drawing
- virtual void paint(QPainter *painter, const QStyleOptionGraphicsItem *option, QWidget *widget = Q_NULLPTR) = 0;
+ virtual void paint(QPainter *painter, const QStyleOptionGraphicsItem *option, QWidget *widget = nullptr) = 0;
void update(const QRectF &rect = QRectF());
inline void update(qreal x, qreal y, qreal width, qreal height);
void scroll(qreal dx, qreal dy, const QRectF &rect = QRectF());
@@ -558,7 +558,7 @@ class Q_WIDGETS_EXPORT QGraphicsObject : public QObject, public QGraphicsItem
Q_CLASSINFO("DefaultProperty", "children")
Q_INTERFACES(QGraphicsItem)
public:
- explicit QGraphicsObject(QGraphicsItem *parent = Q_NULLPTR);
+ explicit QGraphicsObject(QGraphicsItem *parent = nullptr);
~QGraphicsObject();
using QObject::children;
@@ -588,7 +588,7 @@ Q_SIGNALS:
protected:
QGraphicsObject(QGraphicsItemPrivate &dd, QGraphicsItem *parent);
- bool event(QEvent *ev) Q_DECL_OVERRIDE;
+ bool event(QEvent *ev) override;
private:
friend class QGraphicsItem;
@@ -600,7 +600,7 @@ class QAbstractGraphicsShapeItemPrivate;
class Q_WIDGETS_EXPORT QAbstractGraphicsShapeItem : public QGraphicsItem
{
public:
- explicit QAbstractGraphicsShapeItem(QGraphicsItem *parent = Q_NULLPTR);
+ explicit QAbstractGraphicsShapeItem(QGraphicsItem *parent = nullptr);
~QAbstractGraphicsShapeItem();
QPen pen() const;
@@ -609,8 +609,8 @@ public:
QBrush brush() const;
void setBrush(const QBrush &brush);
- bool isObscuredBy(const QGraphicsItem *item) const Q_DECL_OVERRIDE;
- QPainterPath opaqueArea() const Q_DECL_OVERRIDE;
+ bool isObscuredBy(const QGraphicsItem *item) const override;
+ QPainterPath opaqueArea() const override;
protected:
QAbstractGraphicsShapeItem(QAbstractGraphicsShapeItemPrivate &dd,
@@ -625,29 +625,29 @@ class QGraphicsPathItemPrivate;
class Q_WIDGETS_EXPORT QGraphicsPathItem : public QAbstractGraphicsShapeItem
{
public:
- explicit QGraphicsPathItem(QGraphicsItem *parent = Q_NULLPTR);
- explicit QGraphicsPathItem(const QPainterPath &path, QGraphicsItem *parent = Q_NULLPTR);
+ explicit QGraphicsPathItem(QGraphicsItem *parent = nullptr);
+ explicit QGraphicsPathItem(const QPainterPath &path, QGraphicsItem *parent = nullptr);
~QGraphicsPathItem();
QPainterPath path() const;
void setPath(const QPainterPath &path);
- QRectF boundingRect() const Q_DECL_OVERRIDE;
- QPainterPath shape() const Q_DECL_OVERRIDE;
- bool contains(const QPointF &point) const Q_DECL_OVERRIDE;
+ QRectF boundingRect() const override;
+ QPainterPath shape() const override;
+ bool contains(const QPointF &point) const override;
- void paint(QPainter *painter, const QStyleOptionGraphicsItem *option, QWidget *widget = Q_NULLPTR) Q_DECL_OVERRIDE;
+ void paint(QPainter *painter, const QStyleOptionGraphicsItem *option, QWidget *widget = nullptr) override;
- bool isObscuredBy(const QGraphicsItem *item) const Q_DECL_OVERRIDE;
- QPainterPath opaqueArea() const Q_DECL_OVERRIDE;
+ bool isObscuredBy(const QGraphicsItem *item) const override;
+ QPainterPath opaqueArea() const override;
enum { Type = 2 };
- int type() const Q_DECL_OVERRIDE;
+ int type() const override;
protected:
- bool supportsExtension(Extension extension) const Q_DECL_OVERRIDE;
- void setExtension(Extension extension, const QVariant &variant) Q_DECL_OVERRIDE;
- QVariant extension(const QVariant &variant) const Q_DECL_OVERRIDE;
+ bool supportsExtension(Extension extension) const override;
+ void setExtension(Extension extension, const QVariant &variant) override;
+ QVariant extension(const QVariant &variant) const override;
private:
Q_DISABLE_COPY(QGraphicsPathItem)
@@ -658,31 +658,31 @@ class QGraphicsRectItemPrivate;
class Q_WIDGETS_EXPORT QGraphicsRectItem : public QAbstractGraphicsShapeItem
{
public:
- explicit QGraphicsRectItem(QGraphicsItem *parent = Q_NULLPTR);
- explicit QGraphicsRectItem(const QRectF &rect, QGraphicsItem *parent = Q_NULLPTR);
- explicit QGraphicsRectItem(qreal x, qreal y, qreal w, qreal h, QGraphicsItem *parent = Q_NULLPTR);
+ explicit QGraphicsRectItem(QGraphicsItem *parent = nullptr);
+ explicit QGraphicsRectItem(const QRectF &rect, QGraphicsItem *parent = nullptr);
+ explicit QGraphicsRectItem(qreal x, qreal y, qreal w, qreal h, QGraphicsItem *parent = nullptr);
~QGraphicsRectItem();
QRectF rect() const;
void setRect(const QRectF &rect);
inline void setRect(qreal x, qreal y, qreal w, qreal h);
- QRectF boundingRect() const Q_DECL_OVERRIDE;
- QPainterPath shape() const Q_DECL_OVERRIDE;
- bool contains(const QPointF &point) const Q_DECL_OVERRIDE;
+ QRectF boundingRect() const override;
+ QPainterPath shape() const override;
+ bool contains(const QPointF &point) const override;
- void paint(QPainter *painter, const QStyleOptionGraphicsItem *option, QWidget *widget = Q_NULLPTR) Q_DECL_OVERRIDE;
+ void paint(QPainter *painter, const QStyleOptionGraphicsItem *option, QWidget *widget = nullptr) override;
- bool isObscuredBy(const QGraphicsItem *item) const Q_DECL_OVERRIDE;
- QPainterPath opaqueArea() const Q_DECL_OVERRIDE;
+ bool isObscuredBy(const QGraphicsItem *item) const override;
+ QPainterPath opaqueArea() const override;
enum { Type = 3 };
- int type() const Q_DECL_OVERRIDE;
+ int type() const override;
protected:
- bool supportsExtension(Extension extension) const Q_DECL_OVERRIDE;
- void setExtension(Extension extension, const QVariant &variant) Q_DECL_OVERRIDE;
- QVariant extension(const QVariant &variant) const Q_DECL_OVERRIDE;
+ bool supportsExtension(Extension extension) const override;
+ void setExtension(Extension extension, const QVariant &variant) override;
+ QVariant extension(const QVariant &variant) const override;
private:
Q_DISABLE_COPY(QGraphicsRectItem)
@@ -696,9 +696,9 @@ class QGraphicsEllipseItemPrivate;
class Q_WIDGETS_EXPORT QGraphicsEllipseItem : public QAbstractGraphicsShapeItem
{
public:
- explicit QGraphicsEllipseItem(QGraphicsItem *parent = Q_NULLPTR);
- explicit QGraphicsEllipseItem(const QRectF &rect, QGraphicsItem *parent = Q_NULLPTR);
- explicit QGraphicsEllipseItem(qreal x, qreal y, qreal w, qreal h, QGraphicsItem *parent = Q_NULLPTR);
+ explicit QGraphicsEllipseItem(QGraphicsItem *parent = nullptr);
+ explicit QGraphicsEllipseItem(const QRectF &rect, QGraphicsItem *parent = nullptr);
+ explicit QGraphicsEllipseItem(qreal x, qreal y, qreal w, qreal h, QGraphicsItem *parent = nullptr);
~QGraphicsEllipseItem();
QRectF rect() const;
@@ -711,22 +711,22 @@ public:
int spanAngle() const;
void setSpanAngle(int angle);
- QRectF boundingRect() const Q_DECL_OVERRIDE;
- QPainterPath shape() const Q_DECL_OVERRIDE;
- bool contains(const QPointF &point) const Q_DECL_OVERRIDE;
+ QRectF boundingRect() const override;
+ QPainterPath shape() const override;
+ bool contains(const QPointF &point) const override;
- void paint(QPainter *painter, const QStyleOptionGraphicsItem *option, QWidget *widget = Q_NULLPTR) Q_DECL_OVERRIDE;
+ void paint(QPainter *painter, const QStyleOptionGraphicsItem *option, QWidget *widget = nullptr) override;
- bool isObscuredBy(const QGraphicsItem *item) const Q_DECL_OVERRIDE;
- QPainterPath opaqueArea() const Q_DECL_OVERRIDE;
+ bool isObscuredBy(const QGraphicsItem *item) const override;
+ QPainterPath opaqueArea() const override;
enum { Type = 4 };
- int type() const Q_DECL_OVERRIDE;
+ int type() const override;
protected:
- bool supportsExtension(Extension extension) const Q_DECL_OVERRIDE;
- void setExtension(Extension extension, const QVariant &variant) Q_DECL_OVERRIDE;
- QVariant extension(const QVariant &variant) const Q_DECL_OVERRIDE;
+ bool supportsExtension(Extension extension) const override;
+ void setExtension(Extension extension, const QVariant &variant) override;
+ QVariant extension(const QVariant &variant) const override;
private:
Q_DISABLE_COPY(QGraphicsEllipseItem)
@@ -740,9 +740,9 @@ class QGraphicsPolygonItemPrivate;
class Q_WIDGETS_EXPORT QGraphicsPolygonItem : public QAbstractGraphicsShapeItem
{
public:
- explicit QGraphicsPolygonItem(QGraphicsItem *parent = Q_NULLPTR);
+ explicit QGraphicsPolygonItem(QGraphicsItem *parent = nullptr);
explicit QGraphicsPolygonItem(const QPolygonF &polygon,
- QGraphicsItem *parent = Q_NULLPTR);
+ QGraphicsItem *parent = nullptr);
~QGraphicsPolygonItem();
QPolygonF polygon() const;
@@ -751,22 +751,22 @@ public:
Qt::FillRule fillRule() const;
void setFillRule(Qt::FillRule rule);
- QRectF boundingRect() const Q_DECL_OVERRIDE;
- QPainterPath shape() const Q_DECL_OVERRIDE;
- bool contains(const QPointF &point) const Q_DECL_OVERRIDE;
+ QRectF boundingRect() const override;
+ QPainterPath shape() const override;
+ bool contains(const QPointF &point) const override;
- void paint(QPainter *painter, const QStyleOptionGraphicsItem *option, QWidget *widget = Q_NULLPTR) Q_DECL_OVERRIDE;
+ void paint(QPainter *painter, const QStyleOptionGraphicsItem *option, QWidget *widget = nullptr) override;
- bool isObscuredBy(const QGraphicsItem *item) const Q_DECL_OVERRIDE;
- QPainterPath opaqueArea() const Q_DECL_OVERRIDE;
+ bool isObscuredBy(const QGraphicsItem *item) const override;
+ QPainterPath opaqueArea() const override;
enum { Type = 5 };
- int type() const Q_DECL_OVERRIDE;
+ int type() const override;
protected:
- bool supportsExtension(Extension extension) const Q_DECL_OVERRIDE;
- void setExtension(Extension extension, const QVariant &variant) Q_DECL_OVERRIDE;
- QVariant extension(const QVariant &variant) const Q_DECL_OVERRIDE;
+ bool supportsExtension(Extension extension) const override;
+ void setExtension(Extension extension, const QVariant &variant) override;
+ QVariant extension(const QVariant &variant) const override;
private:
Q_DISABLE_COPY(QGraphicsPolygonItem)
@@ -777,9 +777,9 @@ class QGraphicsLineItemPrivate;
class Q_WIDGETS_EXPORT QGraphicsLineItem : public QGraphicsItem
{
public:
- explicit QGraphicsLineItem(QGraphicsItem *parent = Q_NULLPTR);
- explicit QGraphicsLineItem(const QLineF &line, QGraphicsItem *parent = Q_NULLPTR);
- explicit QGraphicsLineItem(qreal x1, qreal y1, qreal x2, qreal y2, QGraphicsItem *parent = Q_NULLPTR);
+ explicit QGraphicsLineItem(QGraphicsItem *parent = nullptr);
+ explicit QGraphicsLineItem(const QLineF &line, QGraphicsItem *parent = nullptr);
+ explicit QGraphicsLineItem(qreal x1, qreal y1, qreal x2, qreal y2, QGraphicsItem *parent = nullptr);
~QGraphicsLineItem();
QPen pen() const;
@@ -790,22 +790,22 @@ public:
inline void setLine(qreal x1, qreal y1, qreal x2, qreal y2)
{ setLine(QLineF(x1, y1, x2, y2)); }
- QRectF boundingRect() const Q_DECL_OVERRIDE;
- QPainterPath shape() const Q_DECL_OVERRIDE;
- bool contains(const QPointF &point) const Q_DECL_OVERRIDE;
+ QRectF boundingRect() const override;
+ QPainterPath shape() const override;
+ bool contains(const QPointF &point) const override;
- void paint(QPainter *painter, const QStyleOptionGraphicsItem *option, QWidget *widget = Q_NULLPTR) Q_DECL_OVERRIDE;
+ void paint(QPainter *painter, const QStyleOptionGraphicsItem *option, QWidget *widget = nullptr) override;
- bool isObscuredBy(const QGraphicsItem *item) const Q_DECL_OVERRIDE;
- QPainterPath opaqueArea() const Q_DECL_OVERRIDE;
+ bool isObscuredBy(const QGraphicsItem *item) const override;
+ QPainterPath opaqueArea() const override;
enum { Type = 6 };
- int type() const Q_DECL_OVERRIDE;
+ int type() const override;
protected:
- bool supportsExtension(Extension extension) const Q_DECL_OVERRIDE;
- void setExtension(Extension extension, const QVariant &variant) Q_DECL_OVERRIDE;
- QVariant extension(const QVariant &variant) const Q_DECL_OVERRIDE;
+ bool supportsExtension(Extension extension) const override;
+ void setExtension(Extension extension, const QVariant &variant) override;
+ QVariant extension(const QVariant &variant) const override;
private:
Q_DISABLE_COPY(QGraphicsLineItem)
@@ -822,8 +822,8 @@ public:
HeuristicMaskShape
};
- explicit QGraphicsPixmapItem(QGraphicsItem *parent = Q_NULLPTR);
- explicit QGraphicsPixmapItem(const QPixmap &pixmap, QGraphicsItem *parent = Q_NULLPTR);
+ explicit QGraphicsPixmapItem(QGraphicsItem *parent = nullptr);
+ explicit QGraphicsPixmapItem(const QPixmap &pixmap, QGraphicsItem *parent = nullptr);
~QGraphicsPixmapItem();
QPixmap pixmap() const;
@@ -836,25 +836,25 @@ public:
void setOffset(const QPointF &offset);
inline void setOffset(qreal x, qreal y);
- QRectF boundingRect() const Q_DECL_OVERRIDE;
- QPainterPath shape() const Q_DECL_OVERRIDE;
- bool contains(const QPointF &point) const Q_DECL_OVERRIDE;
+ QRectF boundingRect() const override;
+ QPainterPath shape() const override;
+ bool contains(const QPointF &point) const override;
- void paint(QPainter *painter, const QStyleOptionGraphicsItem *option, QWidget *widget) Q_DECL_OVERRIDE;
+ void paint(QPainter *painter, const QStyleOptionGraphicsItem *option, QWidget *widget) override;
- bool isObscuredBy(const QGraphicsItem *item) const Q_DECL_OVERRIDE;
- QPainterPath opaqueArea() const Q_DECL_OVERRIDE;
+ bool isObscuredBy(const QGraphicsItem *item) const override;
+ QPainterPath opaqueArea() const override;
enum { Type = 7 };
- int type() const Q_DECL_OVERRIDE;
+ int type() const override;
ShapeMode shapeMode() const;
void setShapeMode(ShapeMode mode);
protected:
- bool supportsExtension(Extension extension) const Q_DECL_OVERRIDE;
- void setExtension(Extension extension, const QVariant &variant) Q_DECL_OVERRIDE;
- QVariant extension(const QVariant &variant) const Q_DECL_OVERRIDE;
+ bool supportsExtension(Extension extension) const override;
+ void setExtension(Extension extension, const QVariant &variant) override;
+ QVariant extension(const QVariant &variant) const override;
private:
Q_DISABLE_COPY(QGraphicsPixmapItem)
@@ -874,8 +874,8 @@ class Q_WIDGETS_EXPORT QGraphicsTextItem : public QGraphicsObject
QDOC_PROPERTY(QTextCursor textCursor READ textCursor WRITE setTextCursor)
public:
- explicit QGraphicsTextItem(QGraphicsItem *parent = Q_NULLPTR);
- explicit QGraphicsTextItem(const QString &text, QGraphicsItem *parent = Q_NULLPTR);
+ explicit QGraphicsTextItem(QGraphicsItem *parent = nullptr);
+ explicit QGraphicsTextItem(const QString &text, QGraphicsItem *parent = nullptr);
~QGraphicsTextItem();
QString toHtml() const;
@@ -890,17 +890,17 @@ public:
void setDefaultTextColor(const QColor &c);
QColor defaultTextColor() const;
- QRectF boundingRect() const Q_DECL_OVERRIDE;
- QPainterPath shape() const Q_DECL_OVERRIDE;
- bool contains(const QPointF &point) const Q_DECL_OVERRIDE;
+ QRectF boundingRect() const override;
+ QPainterPath shape() const override;
+ bool contains(const QPointF &point) const override;
- void paint(QPainter *painter, const QStyleOptionGraphicsItem *option, QWidget *widget) Q_DECL_OVERRIDE;
+ void paint(QPainter *painter, const QStyleOptionGraphicsItem *option, QWidget *widget) override;
- bool isObscuredBy(const QGraphicsItem *item) const Q_DECL_OVERRIDE;
- QPainterPath opaqueArea() const Q_DECL_OVERRIDE;
+ bool isObscuredBy(const QGraphicsItem *item) const override;
+ QPainterPath opaqueArea() const override;
enum { Type = 8 };
- int type() const Q_DECL_OVERRIDE;
+ int type() const override;
void setTextWidth(qreal width);
qreal textWidth() const;
@@ -927,30 +927,30 @@ Q_SIGNALS:
void linkHovered(const QString &);
protected:
- bool sceneEvent(QEvent *event) Q_DECL_OVERRIDE;
- void mousePressEvent(QGraphicsSceneMouseEvent *event) Q_DECL_OVERRIDE;
- void mouseMoveEvent(QGraphicsSceneMouseEvent *event) Q_DECL_OVERRIDE;
- void mouseReleaseEvent(QGraphicsSceneMouseEvent *event) Q_DECL_OVERRIDE;
- void mouseDoubleClickEvent(QGraphicsSceneMouseEvent *event) Q_DECL_OVERRIDE;
- void contextMenuEvent(QGraphicsSceneContextMenuEvent *event) Q_DECL_OVERRIDE;
- void keyPressEvent(QKeyEvent *event) Q_DECL_OVERRIDE;
- void keyReleaseEvent(QKeyEvent *event) Q_DECL_OVERRIDE;
- void focusInEvent(QFocusEvent *event) Q_DECL_OVERRIDE;
- void focusOutEvent(QFocusEvent *event) Q_DECL_OVERRIDE;
- void dragEnterEvent(QGraphicsSceneDragDropEvent *event) Q_DECL_OVERRIDE;
- void dragLeaveEvent(QGraphicsSceneDragDropEvent *event) Q_DECL_OVERRIDE;
- void dragMoveEvent(QGraphicsSceneDragDropEvent *event) Q_DECL_OVERRIDE;
- void dropEvent(QGraphicsSceneDragDropEvent *event) Q_DECL_OVERRIDE;
- void inputMethodEvent(QInputMethodEvent *event) Q_DECL_OVERRIDE;
- void hoverEnterEvent(QGraphicsSceneHoverEvent *event) Q_DECL_OVERRIDE;
- void hoverMoveEvent(QGraphicsSceneHoverEvent *event) Q_DECL_OVERRIDE;
- void hoverLeaveEvent(QGraphicsSceneHoverEvent *event) Q_DECL_OVERRIDE;
-
- QVariant inputMethodQuery(Qt::InputMethodQuery query) const Q_DECL_OVERRIDE;
-
- bool supportsExtension(Extension extension) const Q_DECL_OVERRIDE;
- void setExtension(Extension extension, const QVariant &variant) Q_DECL_OVERRIDE;
- QVariant extension(const QVariant &variant) const Q_DECL_OVERRIDE;
+ bool sceneEvent(QEvent *event) override;
+ void mousePressEvent(QGraphicsSceneMouseEvent *event) override;
+ void mouseMoveEvent(QGraphicsSceneMouseEvent *event) override;
+ void mouseReleaseEvent(QGraphicsSceneMouseEvent *event) override;
+ void mouseDoubleClickEvent(QGraphicsSceneMouseEvent *event) override;
+ void contextMenuEvent(QGraphicsSceneContextMenuEvent *event) override;
+ void keyPressEvent(QKeyEvent *event) override;
+ void keyReleaseEvent(QKeyEvent *event) override;
+ void focusInEvent(QFocusEvent *event) override;
+ void focusOutEvent(QFocusEvent *event) override;
+ void dragEnterEvent(QGraphicsSceneDragDropEvent *event) override;
+ void dragLeaveEvent(QGraphicsSceneDragDropEvent *event) override;
+ void dragMoveEvent(QGraphicsSceneDragDropEvent *event) override;
+ void dropEvent(QGraphicsSceneDragDropEvent *event) override;
+ void inputMethodEvent(QInputMethodEvent *event) override;
+ void hoverEnterEvent(QGraphicsSceneHoverEvent *event) override;
+ void hoverMoveEvent(QGraphicsSceneHoverEvent *event) override;
+ void hoverLeaveEvent(QGraphicsSceneHoverEvent *event) override;
+
+ QVariant inputMethodQuery(Qt::InputMethodQuery query) const override;
+
+ bool supportsExtension(Extension extension) const override;
+ void setExtension(Extension extension, const QVariant &variant) override;
+ QVariant extension(const QVariant &variant) const override;
private:
Q_DISABLE_COPY(QGraphicsTextItem)
@@ -965,8 +965,8 @@ class QGraphicsSimpleTextItemPrivate;
class Q_WIDGETS_EXPORT QGraphicsSimpleTextItem : public QAbstractGraphicsShapeItem
{
public:
- explicit QGraphicsSimpleTextItem(QGraphicsItem *parent = Q_NULLPTR);
- explicit QGraphicsSimpleTextItem(const QString &text, QGraphicsItem *parent = Q_NULLPTR);
+ explicit QGraphicsSimpleTextItem(QGraphicsItem *parent = nullptr);
+ explicit QGraphicsSimpleTextItem(const QString &text, QGraphicsItem *parent = nullptr);
~QGraphicsSimpleTextItem();
void setText(const QString &text);
@@ -975,22 +975,22 @@ public:
void setFont(const QFont &font);
QFont font() const;
- QRectF boundingRect() const Q_DECL_OVERRIDE;
- QPainterPath shape() const Q_DECL_OVERRIDE;
- bool contains(const QPointF &point) const Q_DECL_OVERRIDE;
+ QRectF boundingRect() const override;
+ QPainterPath shape() const override;
+ bool contains(const QPointF &point) const override;
- void paint(QPainter *painter, const QStyleOptionGraphicsItem *option, QWidget *widget) Q_DECL_OVERRIDE;
+ void paint(QPainter *painter, const QStyleOptionGraphicsItem *option, QWidget *widget) override;
- bool isObscuredBy(const QGraphicsItem *item) const Q_DECL_OVERRIDE;
- QPainterPath opaqueArea() const Q_DECL_OVERRIDE;
+ bool isObscuredBy(const QGraphicsItem *item) const override;
+ QPainterPath opaqueArea() const override;
enum { Type = 9 };
- int type() const Q_DECL_OVERRIDE;
+ int type() const override;
protected:
- bool supportsExtension(Extension extension) const Q_DECL_OVERRIDE;
- void setExtension(Extension extension, const QVariant &variant) Q_DECL_OVERRIDE;
- QVariant extension(const QVariant &variant) const Q_DECL_OVERRIDE;
+ bool supportsExtension(Extension extension) const override;
+ void setExtension(Extension extension, const QVariant &variant) override;
+ QVariant extension(const QVariant &variant) const override;
private:
Q_DISABLE_COPY(QGraphicsSimpleTextItem)
@@ -1001,20 +1001,20 @@ class QGraphicsItemGroupPrivate;
class Q_WIDGETS_EXPORT QGraphicsItemGroup : public QGraphicsItem
{
public:
- explicit QGraphicsItemGroup(QGraphicsItem *parent = Q_NULLPTR);
+ explicit QGraphicsItemGroup(QGraphicsItem *parent = nullptr);
~QGraphicsItemGroup();
void addToGroup(QGraphicsItem *item);
void removeFromGroup(QGraphicsItem *item);
- QRectF boundingRect() const Q_DECL_OVERRIDE;
- void paint(QPainter *painter, const QStyleOptionGraphicsItem *option, QWidget *widget = Q_NULLPTR) Q_DECL_OVERRIDE;
+ QRectF boundingRect() const override;
+ void paint(QPainter *painter, const QStyleOptionGraphicsItem *option, QWidget *widget = nullptr) override;
- bool isObscuredBy(const QGraphicsItem *item) const Q_DECL_OVERRIDE;
- QPainterPath opaqueArea() const Q_DECL_OVERRIDE;
+ bool isObscuredBy(const QGraphicsItem *item) const override;
+ QPainterPath opaqueArea() const override;
enum { Type = 10 };
- int type() const Q_DECL_OVERRIDE;
+ int type() const override;
private:
Q_DISABLE_COPY(QGraphicsItemGroup)
diff --git a/src/widgets/graphicsview/qgraphicsitem_p.h b/src/widgets/graphicsview/qgraphicsitem_p.h
index 86414263a7..bae38473f9 100644
--- a/src/widgets/graphicsview/qgraphicsitem_p.h
+++ b/src/widgets/graphicsview/qgraphicsitem_p.h
@@ -595,28 +595,28 @@ public:
: QGraphicsEffectSourcePrivate(), item(i), info(0)
{}
- void detach() Q_DECL_OVERRIDE
+ void detach() override
{
item->d_ptr->graphicsEffect = 0;
item->prepareGeometryChange();
}
- const QGraphicsItem *graphicsItem() const Q_DECL_OVERRIDE
+ const QGraphicsItem *graphicsItem() const override
{ return item; }
- const QWidget *widget() const Q_DECL_OVERRIDE
+ const QWidget *widget() const override
{ return 0; }
- void update() Q_DECL_OVERRIDE {
+ void update() override {
item->d_ptr->updateDueToGraphicsEffect = true;
item->update();
item->d_ptr->updateDueToGraphicsEffect = false;
}
- void effectBoundingRectChanged() Q_DECL_OVERRIDE
+ void effectBoundingRectChanged() override
{ item->prepareGeometryChange(); }
- bool isPixmap() const Q_DECL_OVERRIDE
+ bool isPixmap() const override
{
return item->type() == QGraphicsPixmapItem::Type
&& !(item->flags() & QGraphicsItem::ItemIsSelectable)
@@ -624,10 +624,10 @@ public:
//|| (item->d_ptr->isObject && qobject_cast<QDeclarativeImage *>(q_func()));
}
- const QStyleOption *styleOption() const Q_DECL_OVERRIDE
+ const QStyleOption *styleOption() const override
{ return info ? info->option : 0; }
- QRect deviceRect() const Q_DECL_OVERRIDE
+ QRect deviceRect() const override
{
if (!info || !info->widget) {
qWarning("QGraphicsEffectSource::deviceRect: Not yet implemented, lacking device context");
@@ -636,11 +636,11 @@ public:
return info->widget->rect();
}
- QRectF boundingRect(Qt::CoordinateSystem system) const Q_DECL_OVERRIDE;
- void draw(QPainter *) Q_DECL_OVERRIDE;
+ QRectF boundingRect(Qt::CoordinateSystem system) const override;
+ void draw(QPainter *) override;
QPixmap pixmap(Qt::CoordinateSystem system,
QPoint *offset,
- QGraphicsEffect::PixmapPadMode mode) const Q_DECL_OVERRIDE;
+ QGraphicsEffect::PixmapPadMode mode) const override;
QRect paddedEffectRect(Qt::CoordinateSystem system, QGraphicsEffect::PixmapPadMode mode, const QRectF &sourceRect, bool *unpadded = 0) const;
QGraphicsItem *item;
diff --git a/src/widgets/graphicsview/qgraphicsitemanimation.h b/src/widgets/graphicsview/qgraphicsitemanimation.h
index a819acc880..7417d7729c 100644
--- a/src/widgets/graphicsview/qgraphicsitemanimation.h
+++ b/src/widgets/graphicsview/qgraphicsitemanimation.h
@@ -58,7 +58,7 @@ class Q_WIDGETS_EXPORT QGraphicsItemAnimation : public QObject
{
Q_OBJECT
public:
- QGraphicsItemAnimation(QObject *parent = Q_NULLPTR);
+ QGraphicsItemAnimation(QObject *parent = nullptr);
virtual ~QGraphicsItemAnimation();
QGraphicsItem *item() const;
diff --git a/src/widgets/graphicsview/qgraphicslayout.h b/src/widgets/graphicsview/qgraphicslayout.h
index bbe45bbdd6..28b335ceaa 100644
--- a/src/widgets/graphicsview/qgraphicslayout.h
+++ b/src/widgets/graphicsview/qgraphicslayout.h
@@ -54,16 +54,16 @@ class QGraphicsWidget;
class Q_WIDGETS_EXPORT QGraphicsLayout : public QGraphicsLayoutItem
{
public:
- QGraphicsLayout(QGraphicsLayoutItem *parent = Q_NULLPTR);
+ QGraphicsLayout(QGraphicsLayoutItem *parent = nullptr);
~QGraphicsLayout();
void setContentsMargins(qreal left, qreal top, qreal right, qreal bottom);
- void getContentsMargins(qreal *left, qreal *top, qreal *right, qreal *bottom) const Q_DECL_OVERRIDE;
+ void getContentsMargins(qreal *left, qreal *top, qreal *right, qreal *bottom) const override;
void activate();
bool isActivated() const;
virtual void invalidate();
- virtual void updateGeometry() Q_DECL_OVERRIDE;
+ virtual void updateGeometry() override;
virtual void widgetEvent(QEvent *e);
diff --git a/src/widgets/graphicsview/qgraphicslayoutitem.h b/src/widgets/graphicsview/qgraphicslayoutitem.h
index 10c7870412..44f430034b 100644
--- a/src/widgets/graphicsview/qgraphicslayoutitem.h
+++ b/src/widgets/graphicsview/qgraphicslayoutitem.h
@@ -54,7 +54,7 @@ class QGraphicsItem;
class Q_WIDGETS_EXPORT QGraphicsLayoutItem
{
public:
- QGraphicsLayoutItem(QGraphicsLayoutItem *parent = Q_NULLPTR, bool isLayout = false);
+ QGraphicsLayoutItem(QGraphicsLayoutItem *parent = nullptr, bool isLayout = false);
virtual ~QGraphicsLayoutItem();
void setSizePolicy(const QSizePolicy &policy);
diff --git a/src/widgets/graphicsview/qgraphicslayoutstyleinfo_p.h b/src/widgets/graphicsview/qgraphicslayoutstyleinfo_p.h
index 3463ae71bf..7886de432c 100644
--- a/src/widgets/graphicsview/qgraphicslayoutstyleinfo_p.h
+++ b/src/widgets/graphicsview/qgraphicslayoutstyleinfo_p.h
@@ -70,17 +70,17 @@ public:
virtual qreal combinedLayoutSpacing(QLayoutPolicy::ControlTypes controls1,
QLayoutPolicy::ControlTypes controls2,
- Qt::Orientation orientation) const Q_DECL_OVERRIDE;
+ Qt::Orientation orientation) const override;
virtual qreal perItemSpacing(QLayoutPolicy::ControlType control1,
QLayoutPolicy::ControlType control2,
- Qt::Orientation orientation) const Q_DECL_OVERRIDE;
+ Qt::Orientation orientation) const override;
- virtual qreal spacing(Qt::Orientation orientation) const Q_DECL_OVERRIDE;
+ virtual qreal spacing(Qt::Orientation orientation) const override;
- virtual qreal windowMargin(Qt::Orientation orientation) const Q_DECL_OVERRIDE;
+ virtual qreal windowMargin(Qt::Orientation orientation) const override;
- virtual void invalidate() Q_DECL_OVERRIDE
+ virtual void invalidate() override
{
m_style = 0;
QAbstractLayoutStyleInfo::invalidate();
diff --git a/src/widgets/graphicsview/qgraphicslinearlayout.h b/src/widgets/graphicsview/qgraphicslinearlayout.h
index 8186eea987..d27191adb3 100644
--- a/src/widgets/graphicsview/qgraphicslinearlayout.h
+++ b/src/widgets/graphicsview/qgraphicslinearlayout.h
@@ -53,8 +53,8 @@ class QGraphicsLinearLayoutPrivate;
class Q_WIDGETS_EXPORT QGraphicsLinearLayout : public QGraphicsLayout
{
public:
- QGraphicsLinearLayout(QGraphicsLayoutItem *parent = Q_NULLPTR);
- QGraphicsLinearLayout(Qt::Orientation orientation, QGraphicsLayoutItem *parent = Q_NULLPTR);
+ QGraphicsLinearLayout(QGraphicsLayoutItem *parent = nullptr);
+ QGraphicsLinearLayout(Qt::Orientation orientation, QGraphicsLayoutItem *parent = nullptr);
virtual ~QGraphicsLinearLayout();
void setOrientation(Qt::Orientation orientation);
@@ -67,7 +67,7 @@ public:
void insertStretch(int index, int stretch = 1);
void removeItem(QGraphicsLayoutItem *item);
- void removeAt(int index) Q_DECL_OVERRIDE;
+ void removeAt(int index) override;
void setSpacing(qreal spacing);
qreal spacing() const;
@@ -80,13 +80,13 @@ public:
void setAlignment(QGraphicsLayoutItem *item, Qt::Alignment alignment);
Qt::Alignment alignment(QGraphicsLayoutItem *item) const;
- void setGeometry(const QRectF &rect) Q_DECL_OVERRIDE;
+ void setGeometry(const QRectF &rect) override;
- int count() const Q_DECL_OVERRIDE;
- QGraphicsLayoutItem *itemAt(int index) const Q_DECL_OVERRIDE;
+ int count() const override;
+ QGraphicsLayoutItem *itemAt(int index) const override;
- void invalidate() Q_DECL_OVERRIDE;
- QSizeF sizeHint(Qt::SizeHint which, const QSizeF &constraint = QSizeF()) const Q_DECL_OVERRIDE;
+ void invalidate() override;
+ QSizeF sizeHint(Qt::SizeHint which, const QSizeF &constraint = QSizeF()) const override;
#if 0 // ###
Q5SizePolicy::ControlTypes controlTypes(LayoutSide side) const;
diff --git a/src/widgets/graphicsview/qgraphicsproxywidget.cpp b/src/widgets/graphicsview/qgraphicsproxywidget.cpp
index 94ce102a68..442f08325d 100644
--- a/src/widgets/graphicsview/qgraphicsproxywidget.cpp
+++ b/src/widgets/graphicsview/qgraphicsproxywidget.cpp
@@ -1537,6 +1537,14 @@ void QGraphicsProxyWidget::paint(QPainter *painter, const QStyleOptionGraphicsIt
}
/*!
+ \enum QGraphicsProxyWidget::anonymous
+
+ The value returned by the virtual type() function.
+
+ \value Type A graphics proxy widget
+*/
+
+/*!
\reimp
*/
int QGraphicsProxyWidget::type() const
diff --git a/src/widgets/graphicsview/qgraphicsproxywidget.h b/src/widgets/graphicsview/qgraphicsproxywidget.h
index fd6369a1fd..76fdf8aeba 100644
--- a/src/widgets/graphicsview/qgraphicsproxywidget.h
+++ b/src/widgets/graphicsview/qgraphicsproxywidget.h
@@ -53,7 +53,7 @@ class Q_WIDGETS_EXPORT QGraphicsProxyWidget : public QGraphicsWidget
{
Q_OBJECT
public:
- QGraphicsProxyWidget(QGraphicsItem *parent = Q_NULLPTR, Qt::WindowFlags wFlags = Qt::WindowFlags());
+ QGraphicsProxyWidget(QGraphicsItem *parent = nullptr, Qt::WindowFlags wFlags = Qt::WindowFlags());
~QGraphicsProxyWidget();
void setWidget(QWidget *widget);
@@ -61,63 +61,63 @@ public:
QRectF subWidgetRect(const QWidget *widget) const;
- void setGeometry(const QRectF &rect) Q_DECL_OVERRIDE;
+ void setGeometry(const QRectF &rect) override;
- void paint(QPainter *painter, const QStyleOptionGraphicsItem *option, QWidget *widget) Q_DECL_OVERRIDE;
+ void paint(QPainter *painter, const QStyleOptionGraphicsItem *option, QWidget *widget) override;
enum {
Type = 12
};
- int type() const Q_DECL_OVERRIDE;
+ int type() const override;
QGraphicsProxyWidget *createProxyForChildWidget(QWidget *child);
protected:
- QVariant itemChange(GraphicsItemChange change, const QVariant &value) Q_DECL_OVERRIDE;
+ QVariant itemChange(GraphicsItemChange change, const QVariant &value) override;
- bool event(QEvent *event) Q_DECL_OVERRIDE;
- bool eventFilter(QObject *object, QEvent *event) Q_DECL_OVERRIDE;
+ bool event(QEvent *event) override;
+ bool eventFilter(QObject *object, QEvent *event) override;
- void showEvent(QShowEvent *event) Q_DECL_OVERRIDE;
- void hideEvent(QHideEvent *event) Q_DECL_OVERRIDE;
+ void showEvent(QShowEvent *event) override;
+ void hideEvent(QHideEvent *event) override;
#ifndef QT_NO_CONTEXTMENU
- void contextMenuEvent(QGraphicsSceneContextMenuEvent *event) Q_DECL_OVERRIDE;
+ void contextMenuEvent(QGraphicsSceneContextMenuEvent *event) override;
#endif
#ifndef QT_NO_DRAGANDDROP
- void dragEnterEvent(QGraphicsSceneDragDropEvent *event) Q_DECL_OVERRIDE;
- void dragLeaveEvent(QGraphicsSceneDragDropEvent *event) Q_DECL_OVERRIDE;
- void dragMoveEvent(QGraphicsSceneDragDropEvent *event) Q_DECL_OVERRIDE;
- void dropEvent(QGraphicsSceneDragDropEvent *event) Q_DECL_OVERRIDE;
+ void dragEnterEvent(QGraphicsSceneDragDropEvent *event) override;
+ void dragLeaveEvent(QGraphicsSceneDragDropEvent *event) override;
+ void dragMoveEvent(QGraphicsSceneDragDropEvent *event) override;
+ void dropEvent(QGraphicsSceneDragDropEvent *event) override;
#endif
- void hoverEnterEvent(QGraphicsSceneHoverEvent *event) Q_DECL_OVERRIDE;
- void hoverLeaveEvent(QGraphicsSceneHoverEvent *event) Q_DECL_OVERRIDE;
- void hoverMoveEvent(QGraphicsSceneHoverEvent *event) Q_DECL_OVERRIDE;
- void grabMouseEvent(QEvent *event) Q_DECL_OVERRIDE;
- void ungrabMouseEvent(QEvent *event) Q_DECL_OVERRIDE;
+ void hoverEnterEvent(QGraphicsSceneHoverEvent *event) override;
+ void hoverLeaveEvent(QGraphicsSceneHoverEvent *event) override;
+ void hoverMoveEvent(QGraphicsSceneHoverEvent *event) override;
+ void grabMouseEvent(QEvent *event) override;
+ void ungrabMouseEvent(QEvent *event) override;
- void mouseMoveEvent(QGraphicsSceneMouseEvent *event) Q_DECL_OVERRIDE;
- void mousePressEvent(QGraphicsSceneMouseEvent *event) Q_DECL_OVERRIDE;
- void mouseReleaseEvent(QGraphicsSceneMouseEvent *event) Q_DECL_OVERRIDE;
- void mouseDoubleClickEvent(QGraphicsSceneMouseEvent *event) Q_DECL_OVERRIDE;
+ void mouseMoveEvent(QGraphicsSceneMouseEvent *event) override;
+ void mousePressEvent(QGraphicsSceneMouseEvent *event) override;
+ void mouseReleaseEvent(QGraphicsSceneMouseEvent *event) override;
+ void mouseDoubleClickEvent(QGraphicsSceneMouseEvent *event) override;
#if QT_CONFIG(wheelevent)
- void wheelEvent(QGraphicsSceneWheelEvent *event) Q_DECL_OVERRIDE;
+ void wheelEvent(QGraphicsSceneWheelEvent *event) override;
#endif
- void keyPressEvent(QKeyEvent *event) Q_DECL_OVERRIDE;
- void keyReleaseEvent(QKeyEvent *event) Q_DECL_OVERRIDE;
+ void keyPressEvent(QKeyEvent *event) override;
+ void keyReleaseEvent(QKeyEvent *event) override;
- void focusInEvent(QFocusEvent *event) Q_DECL_OVERRIDE;
- void focusOutEvent(QFocusEvent *event) Q_DECL_OVERRIDE;
- bool focusNextPrevChild(bool next) Q_DECL_OVERRIDE;
+ void focusInEvent(QFocusEvent *event) override;
+ void focusOutEvent(QFocusEvent *event) override;
+ bool focusNextPrevChild(bool next) override;
- QVariant inputMethodQuery(Qt::InputMethodQuery query) const Q_DECL_OVERRIDE;
- void inputMethodEvent(QInputMethodEvent *event) Q_DECL_OVERRIDE;
+ QVariant inputMethodQuery(Qt::InputMethodQuery query) const override;
+ void inputMethodEvent(QInputMethodEvent *event) override;
- QSizeF sizeHint(Qt::SizeHint which, const QSizeF &constraint = QSizeF()) const Q_DECL_OVERRIDE;
- void resizeEvent(QGraphicsSceneResizeEvent *event) Q_DECL_OVERRIDE;
+ QSizeF sizeHint(Qt::SizeHint which, const QSizeF &constraint = QSizeF()) const override;
+ void resizeEvent(QGraphicsSceneResizeEvent *event) override;
protected Q_SLOTS:
QGraphicsProxyWidget *newProxyWidget(const QWidget *);
diff --git a/src/widgets/graphicsview/qgraphicsscene.h b/src/widgets/graphicsview/qgraphicsscene.h
index d515585067..5ecd2baab8 100644
--- a/src/widgets/graphicsview/qgraphicsscene.h
+++ b/src/widgets/graphicsview/qgraphicsscene.h
@@ -121,9 +121,9 @@ public:
};
Q_DECLARE_FLAGS(SceneLayers, SceneLayer)
- QGraphicsScene(QObject *parent = Q_NULLPTR);
- QGraphicsScene(const QRectF &sceneRect, QObject *parent = Q_NULLPTR);
- QGraphicsScene(qreal x, qreal y, qreal width, qreal height, QObject *parent = Q_NULLPTR);
+ QGraphicsScene(QObject *parent = nullptr);
+ QGraphicsScene(const QRectF &sceneRect, QObject *parent = nullptr);
+ QGraphicsScene(qreal x, qreal y, qreal width, qreal height, QObject *parent = nullptr);
virtual ~QGraphicsScene();
QRectF sceneRect() const;
@@ -159,7 +159,7 @@ public:
#if QT_DEPRECATED_SINCE(5, 0)
QT_DEPRECATED inline QGraphicsItem *itemAt(const QPointF &position) const {
QList<QGraphicsItem *> itemsAtPoint = items(position);
- return itemsAtPoint.isEmpty() ? Q_NULLPTR : itemsAtPoint.first();
+ return itemsAtPoint.isEmpty() ? nullptr : itemsAtPoint.first();
}
#endif
QGraphicsItem *itemAt(const QPointF &pos, const QTransform &deviceTransform) const;
@@ -173,7 +173,7 @@ public:
#if QT_DEPRECATED_SINCE(5, 0)
QT_DEPRECATED inline QGraphicsItem *itemAt(qreal x, qreal y) const {
QList<QGraphicsItem *> itemsAtPoint = items(QPointF(x, y));
- return itemsAtPoint.isEmpty() ? Q_NULLPTR : itemsAtPoint.first();
+ return itemsAtPoint.isEmpty() ? nullptr : itemsAtPoint.first();
}
#endif
inline QGraphicsItem *itemAt(qreal x, qreal y, const QTransform &deviceTransform) const
@@ -261,8 +261,8 @@ public Q_SLOTS:
void clear();
protected:
- bool event(QEvent *event) Q_DECL_OVERRIDE;
- bool eventFilter(QObject *watched, QEvent *event) Q_DECL_OVERRIDE;
+ bool event(QEvent *event) override;
+ bool eventFilter(QObject *watched, QEvent *event) override;
virtual void contextMenuEvent(QGraphicsSceneContextMenuEvent *event);
virtual void dragEnterEvent(QGraphicsSceneDragDropEvent *event);
virtual void dragMoveEvent(QGraphicsSceneDragDropEvent *event);
@@ -285,7 +285,7 @@ protected:
virtual void drawItems(QPainter *painter, int numItems,
QGraphicsItem *items[],
const QStyleOptionGraphicsItem options[],
- QWidget *widget = Q_NULLPTR);
+ QWidget *widget = nullptr);
protected Q_SLOTS:
// ### Qt 6: make unconditional
diff --git a/src/widgets/graphicsview/qgraphicsscene_bsp.cpp b/src/widgets/graphicsview/qgraphicsscene_bsp.cpp
index 81d2953d8f..75eb50a3ac 100644
--- a/src/widgets/graphicsview/qgraphicsscene_bsp.cpp
+++ b/src/widgets/graphicsview/qgraphicsscene_bsp.cpp
@@ -49,7 +49,7 @@ class QGraphicsSceneInsertItemBspTreeVisitor : public QGraphicsSceneBspTreeVisit
public:
QGraphicsItem *item;
- void visit(QList<QGraphicsItem *> *items) Q_DECL_OVERRIDE
+ void visit(QList<QGraphicsItem *> *items) override
{ items->prepend(item); }
};
@@ -58,7 +58,7 @@ class QGraphicsSceneRemoveItemBspTreeVisitor : public QGraphicsSceneBspTreeVisit
public:
QGraphicsItem *item;
- void visit(QList<QGraphicsItem *> *items) Q_DECL_OVERRIDE
+ void visit(QList<QGraphicsItem *> *items) override
{ items->removeAll(item); }
};
@@ -68,7 +68,7 @@ public:
QList<QGraphicsItem *> *foundItems;
bool onlyTopLevelItems;
- void visit(QList<QGraphicsItem *> *items) Q_DECL_OVERRIDE
+ void visit(QList<QGraphicsItem *> *items) override
{
for (int i = 0; i < items->size(); ++i) {
QGraphicsItem *item = items->at(i);
diff --git a/src/widgets/graphicsview/qgraphicsscenebsptreeindex_p.h b/src/widgets/graphicsview/qgraphicsscenebsptreeindex_p.h
index 8e78407762..b6387a2c56 100644
--- a/src/widgets/graphicsview/qgraphicsscenebsptreeindex_p.h
+++ b/src/widgets/graphicsview/qgraphicsscenebsptreeindex_p.h
@@ -77,25 +77,25 @@ public:
QGraphicsSceneBspTreeIndex(QGraphicsScene *scene = 0);
~QGraphicsSceneBspTreeIndex();
- QList<QGraphicsItem *> estimateItems(const QRectF &rect, Qt::SortOrder order) const Q_DECL_OVERRIDE;
- QList<QGraphicsItem *> estimateTopLevelItems(const QRectF &rect, Qt::SortOrder order) const Q_DECL_OVERRIDE;
- QList<QGraphicsItem *> items(Qt::SortOrder order = Qt::DescendingOrder) const Q_DECL_OVERRIDE;
+ QList<QGraphicsItem *> estimateItems(const QRectF &rect, Qt::SortOrder order) const override;
+ QList<QGraphicsItem *> estimateTopLevelItems(const QRectF &rect, Qt::SortOrder order) const override;
+ QList<QGraphicsItem *> items(Qt::SortOrder order = Qt::DescendingOrder) const override;
int bspTreeDepth() const;
void setBspTreeDepth(int depth);
protected Q_SLOTS:
- void updateSceneRect(const QRectF &rect) Q_DECL_OVERRIDE;
+ void updateSceneRect(const QRectF &rect) override;
protected:
- bool event(QEvent *event) Q_DECL_OVERRIDE;
- void clear() Q_DECL_OVERRIDE;
+ bool event(QEvent *event) override;
+ void clear() override;
- void addItem(QGraphicsItem *item) Q_DECL_OVERRIDE;
- void removeItem(QGraphicsItem *item) Q_DECL_OVERRIDE;
- void prepareBoundingRectChange(const QGraphicsItem *item) Q_DECL_OVERRIDE;
+ void addItem(QGraphicsItem *item) override;
+ void removeItem(QGraphicsItem *item) override;
+ void prepareBoundingRectChange(const QGraphicsItem *item) override;
- void itemChange(const QGraphicsItem *item, QGraphicsItem::GraphicsItemChange change, const void *const value) Q_DECL_OVERRIDE;
+ void itemChange(const QGraphicsItem *item, QGraphicsItem::GraphicsItemChange change, const void *const value) override;
private :
Q_DECLARE_PRIVATE(QGraphicsSceneBspTreeIndex)
diff --git a/src/widgets/graphicsview/qgraphicsscenelinearindex_p.h b/src/widgets/graphicsview/qgraphicsscenelinearindex_p.h
index a59a8ac1b0..07d5d80ef1 100644
--- a/src/widgets/graphicsview/qgraphicsscenelinearindex_p.h
+++ b/src/widgets/graphicsview/qgraphicsscenelinearindex_p.h
@@ -70,10 +70,10 @@ public:
QGraphicsSceneLinearIndex(QGraphicsScene *scene = 0) : QGraphicsSceneIndex(scene), m_numSortedElements(0)
{ }
- QList<QGraphicsItem *> items(Qt::SortOrder order = Qt::DescendingOrder) const Q_DECL_OVERRIDE
+ QList<QGraphicsItem *> items(Qt::SortOrder order = Qt::DescendingOrder) const override
{ Q_UNUSED(order); return m_items; }
- virtual QList<QGraphicsItem *> estimateItems(const QRectF &rect, Qt::SortOrder order) const Q_DECL_OVERRIDE
+ virtual QList<QGraphicsItem *> estimateItems(const QRectF &rect, Qt::SortOrder order) const override
{
Q_UNUSED(rect);
Q_UNUSED(order);
@@ -81,16 +81,16 @@ public:
}
protected :
- virtual void clear() Q_DECL_OVERRIDE
+ virtual void clear() override
{
m_items.clear();
m_numSortedElements = 0;
}
- virtual void addItem(QGraphicsItem *item) Q_DECL_OVERRIDE
+ virtual void addItem(QGraphicsItem *item) override
{ m_items << item; }
- virtual void removeItem(QGraphicsItem *item) Q_DECL_OVERRIDE
+ virtual void removeItem(QGraphicsItem *item) override
{
// Sort m_items if needed
if (m_numSortedElements < m_items.size())
diff --git a/src/widgets/graphicsview/qgraphicstransform.h b/src/widgets/graphicsview/qgraphicstransform.h
index ceeb314c86..b8455781c5 100644
--- a/src/widgets/graphicsview/qgraphicstransform.h
+++ b/src/widgets/graphicsview/qgraphicstransform.h
@@ -57,7 +57,7 @@ class Q_WIDGETS_EXPORT QGraphicsTransform : public QObject
{
Q_OBJECT
public:
- QGraphicsTransform(QObject *parent = Q_NULLPTR);
+ QGraphicsTransform(QObject *parent = nullptr);
~QGraphicsTransform();
virtual void applyTo(QMatrix4x4 *matrix) const = 0;
@@ -85,7 +85,7 @@ class Q_WIDGETS_EXPORT QGraphicsScale : public QGraphicsTransform
Q_PROPERTY(qreal yScale READ yScale WRITE setYScale NOTIFY yScaleChanged)
Q_PROPERTY(qreal zScale READ zScale WRITE setZScale NOTIFY zScaleChanged)
public:
- QGraphicsScale(QObject *parent = Q_NULLPTR);
+ QGraphicsScale(QObject *parent = nullptr);
~QGraphicsScale();
QVector3D origin() const;
@@ -100,7 +100,7 @@ public:
qreal zScale() const;
void setZScale(qreal);
- void applyTo(QMatrix4x4 *matrix) const Q_DECL_OVERRIDE;
+ void applyTo(QMatrix4x4 *matrix) const override;
Q_SIGNALS:
void originChanged();
@@ -123,7 +123,7 @@ class Q_WIDGETS_EXPORT QGraphicsRotation : public QGraphicsTransform
Q_PROPERTY(qreal angle READ angle WRITE setAngle NOTIFY angleChanged)
Q_PROPERTY(QVector3D axis READ axis WRITE setAxis NOTIFY axisChanged)
public:
- QGraphicsRotation(QObject *parent = Q_NULLPTR);
+ QGraphicsRotation(QObject *parent = nullptr);
~QGraphicsRotation();
QVector3D origin() const;
@@ -136,7 +136,7 @@ public:
void setAxis(const QVector3D &axis);
void setAxis(Qt::Axis axis);
- void applyTo(QMatrix4x4 *matrix) const Q_DECL_OVERRIDE;
+ void applyTo(QMatrix4x4 *matrix) const override;
Q_SIGNALS:
void originChanged();
diff --git a/src/widgets/graphicsview/qgraphicsview.h b/src/widgets/graphicsview/qgraphicsview.h
index a9e4efefaf..e02fba69c9 100644
--- a/src/widgets/graphicsview/qgraphicsview.h
+++ b/src/widgets/graphicsview/qgraphicsview.h
@@ -114,11 +114,11 @@ public:
};
Q_DECLARE_FLAGS(OptimizationFlags, OptimizationFlag)
- QGraphicsView(QWidget *parent = Q_NULLPTR);
- QGraphicsView(QGraphicsScene *scene, QWidget *parent = Q_NULLPTR);
+ QGraphicsView(QWidget *parent = nullptr);
+ QGraphicsView(QGraphicsScene *scene, QWidget *parent = nullptr);
~QGraphicsView();
- QSize sizeHint() const Q_DECL_OVERRIDE;
+ QSize sizeHint() const override;
QPainter::RenderHints renderHints() const;
void setRenderHint(QPainter::RenderHint hint, bool enabled = true);
@@ -214,7 +214,7 @@ public:
inline QPoint mapFromScene(qreal x, qreal y) const;
inline QPolygon mapFromScene(qreal x, qreal y, qreal w, qreal h) const;
- QVariant inputMethodQuery(Qt::InputMethodQuery query) const Q_DECL_OVERRIDE;
+ QVariant inputMethodQuery(Qt::InputMethodQuery query) const override;
QBrush backgroundBrush() const;
void setBackgroundBrush(const QBrush &brush);
@@ -233,39 +233,39 @@ Q_SIGNALS:
#endif
protected Q_SLOTS:
- void setupViewport(QWidget *widget) Q_DECL_OVERRIDE;
+ void setupViewport(QWidget *widget) override;
protected:
- QGraphicsView(QGraphicsViewPrivate &, QWidget *parent = Q_NULLPTR);
- bool event(QEvent *event) Q_DECL_OVERRIDE;
- bool viewportEvent(QEvent *event) Q_DECL_OVERRIDE;
+ QGraphicsView(QGraphicsViewPrivate &, QWidget *parent = nullptr);
+ bool event(QEvent *event) override;
+ bool viewportEvent(QEvent *event) override;
#ifndef QT_NO_CONTEXTMENU
- void contextMenuEvent(QContextMenuEvent *event) Q_DECL_OVERRIDE;
+ void contextMenuEvent(QContextMenuEvent *event) override;
#endif
#if QT_CONFIG(draganddrop)
- void dragEnterEvent(QDragEnterEvent *event) Q_DECL_OVERRIDE;
- void dragLeaveEvent(QDragLeaveEvent *event) Q_DECL_OVERRIDE;
- void dragMoveEvent(QDragMoveEvent *event) Q_DECL_OVERRIDE;
- void dropEvent(QDropEvent *event) Q_DECL_OVERRIDE;
+ void dragEnterEvent(QDragEnterEvent *event) override;
+ void dragLeaveEvent(QDragLeaveEvent *event) override;
+ void dragMoveEvent(QDragMoveEvent *event) override;
+ void dropEvent(QDropEvent *event) override;
#endif
- void focusInEvent(QFocusEvent *event) Q_DECL_OVERRIDE;
- bool focusNextPrevChild(bool next) Q_DECL_OVERRIDE;
- void focusOutEvent(QFocusEvent *event) Q_DECL_OVERRIDE;
- void keyPressEvent(QKeyEvent *event) Q_DECL_OVERRIDE;
- void keyReleaseEvent(QKeyEvent *event) Q_DECL_OVERRIDE;
- void mouseDoubleClickEvent(QMouseEvent *event) Q_DECL_OVERRIDE;
- void mousePressEvent(QMouseEvent *event) Q_DECL_OVERRIDE;
- void mouseMoveEvent(QMouseEvent *event) Q_DECL_OVERRIDE;
- void mouseReleaseEvent(QMouseEvent *event) Q_DECL_OVERRIDE;
+ void focusInEvent(QFocusEvent *event) override;
+ bool focusNextPrevChild(bool next) override;
+ void focusOutEvent(QFocusEvent *event) override;
+ void keyPressEvent(QKeyEvent *event) override;
+ void keyReleaseEvent(QKeyEvent *event) override;
+ void mouseDoubleClickEvent(QMouseEvent *event) override;
+ void mousePressEvent(QMouseEvent *event) override;
+ void mouseMoveEvent(QMouseEvent *event) override;
+ void mouseReleaseEvent(QMouseEvent *event) override;
#if QT_CONFIG(wheelevent)
- void wheelEvent(QWheelEvent *event) Q_DECL_OVERRIDE;
+ void wheelEvent(QWheelEvent *event) override;
#endif
- void paintEvent(QPaintEvent *event) Q_DECL_OVERRIDE;
- void resizeEvent(QResizeEvent *event) Q_DECL_OVERRIDE;
- void scrollContentsBy(int dx, int dy) Q_DECL_OVERRIDE;
- void showEvent(QShowEvent *event) Q_DECL_OVERRIDE;
- void inputMethodEvent(QInputMethodEvent *event) Q_DECL_OVERRIDE;
+ void paintEvent(QPaintEvent *event) override;
+ void resizeEvent(QResizeEvent *event) override;
+ void scrollContentsBy(int dx, int dy) override;
+ void showEvent(QShowEvent *event) override;
+ void inputMethodEvent(QInputMethodEvent *event) override;
virtual void drawBackground(QPainter *painter, const QRectF &rect);
virtual void drawForeground(QPainter *painter, const QRectF &rect);
diff --git a/src/widgets/graphicsview/qgraphicswidget.cpp b/src/widgets/graphicsview/qgraphicswidget.cpp
index c658e40a9e..a4534c73dd 100644
--- a/src/widgets/graphicsview/qgraphicswidget.cpp
+++ b/src/widgets/graphicsview/qgraphicswidget.cpp
@@ -276,7 +276,7 @@ QGraphicsWidget::~QGraphicsWidget()
// Unset the parent here, when we're still a QGraphicsWidget.
// It is otherwise done in ~QGraphicsItem() where we'd be
// calling QGraphicsWidget members on an ex-QGraphicsWidget object
- setParentItem(Q_NULLPTR);
+ setParentItem(nullptr);
}
/*!
@@ -2228,6 +2228,14 @@ bool QGraphicsWidget::testAttribute(Qt::WidgetAttribute attribute) const
}
/*!
+ \enum QGraphicsWidget::anonymous
+
+ The value returned by the virtual type() function.
+
+ \value Type A graphics widget item
+*/
+
+/*!
\reimp
*/
int QGraphicsWidget::type() const
diff --git a/src/widgets/graphicsview/qgraphicswidget.h b/src/widgets/graphicsview/qgraphicswidget.h
index 831511d14a..481fb55db3 100644
--- a/src/widgets/graphicsview/qgraphicswidget.h
+++ b/src/widgets/graphicsview/qgraphicswidget.h
@@ -80,7 +80,7 @@ class Q_WIDGETS_EXPORT QGraphicsWidget : public QGraphicsObject, public QGraphic
Q_PROPERTY(bool autoFillBackground READ autoFillBackground WRITE setAutoFillBackground)
Q_PROPERTY(QGraphicsLayout* layout READ layout WRITE setLayout NOTIFY layoutChanged)
public:
- QGraphicsWidget(QGraphicsItem *parent = Q_NULLPTR, Qt::WindowFlags wFlags = Qt::WindowFlags());
+ QGraphicsWidget(QGraphicsItem *parent = nullptr, Qt::WindowFlags wFlags = Qt::WindowFlags());
~QGraphicsWidget();
QGraphicsLayout *layout() const;
void setLayout(QGraphicsLayout *layout);
@@ -106,12 +106,12 @@ public:
inline void resize(qreal w, qreal h) { resize(QSizeF(w, h)); }
QSizeF size() const;
- void setGeometry(const QRectF &rect) Q_DECL_OVERRIDE;
+ void setGeometry(const QRectF &rect) override;
inline void setGeometry(qreal x, qreal y, qreal w, qreal h);
inline QRectF rect() const { return QRectF(QPointF(), size()); }
void setContentsMargins(qreal left, qreal top, qreal right, qreal bottom);
- void getContentsMargins(qreal *left, qreal *top, qreal *right, qreal *bottom) const Q_DECL_OVERRIDE;
+ void getContentsMargins(qreal *left, qreal *top, qreal *right, qreal *bottom) const override;
void setWindowFrameMargins(qreal left, qreal top, qreal right, qreal bottom);
void getWindowFrameMargins(qreal *left, qreal *top, qreal *right, qreal *bottom) const;
@@ -161,12 +161,12 @@ public:
enum {
Type = 11
};
- int type() const Q_DECL_OVERRIDE;
+ int type() const override;
- void paint(QPainter *painter, const QStyleOptionGraphicsItem *option, QWidget *widget = Q_NULLPTR) Q_DECL_OVERRIDE;
- virtual void paintWindowFrame(QPainter *painter, const QStyleOptionGraphicsItem *option, QWidget *widget = Q_NULLPTR);
- QRectF boundingRect() const Q_DECL_OVERRIDE;
- QPainterPath shape() const Q_DECL_OVERRIDE;
+ void paint(QPainter *painter, const QStyleOptionGraphicsItem *option, QWidget *widget = nullptr) override;
+ virtual void paintWindowFrame(QPainter *painter, const QStyleOptionGraphicsItem *option, QWidget *widget = nullptr);
+ QRectF boundingRect() const override;
+ QPainterPath shape() const override;
#if 0
void dumpFocusChain();
@@ -184,28 +184,28 @@ public Q_SLOTS:
protected:
virtual void initStyleOption(QStyleOption *option) const;
- QSizeF sizeHint(Qt::SizeHint which, const QSizeF &constraint = QSizeF()) const Q_DECL_OVERRIDE;
- void updateGeometry() Q_DECL_OVERRIDE;
+ QSizeF sizeHint(Qt::SizeHint which, const QSizeF &constraint = QSizeF()) const override;
+ void updateGeometry() override;
// Notification
- QVariant itemChange(GraphicsItemChange change, const QVariant &value) Q_DECL_OVERRIDE;
+ QVariant itemChange(GraphicsItemChange change, const QVariant &value) override;
virtual QVariant propertyChange(const QString &propertyName, const QVariant &value);
// Scene events
- bool sceneEvent(QEvent *event) Q_DECL_OVERRIDE;
+ bool sceneEvent(QEvent *event) override;
virtual bool windowFrameEvent(QEvent *e);
virtual Qt::WindowFrameSection windowFrameSectionAt(const QPointF& pos) const;
// Base event handlers
- bool event(QEvent *event) Q_DECL_OVERRIDE;
+ bool event(QEvent *event) override;
//virtual void actionEvent(QActionEvent *event);
virtual void changeEvent(QEvent *event);
virtual void closeEvent(QCloseEvent *event);
//void create(WId window = 0, bool initializeWindow = true, bool destroyOldWindow = true);
//void destroy(bool destroyWindow = true, bool destroySubWindows = true);
- void focusInEvent(QFocusEvent *event) Q_DECL_OVERRIDE;
+ void focusInEvent(QFocusEvent *event) override;
virtual bool focusNextPrevChild(bool next);
- void focusOutEvent(QFocusEvent *event) Q_DECL_OVERRIDE;
+ void focusOutEvent(QFocusEvent *event) override;
virtual void hideEvent(QHideEvent *event);
//virtual int metric(PaintDeviceMetric m ) const;
virtual void moveEvent(QGraphicsSceneMoveEvent *event);
@@ -214,8 +214,8 @@ protected:
virtual void resizeEvent(QGraphicsSceneResizeEvent *event);
virtual void showEvent(QShowEvent *event);
//virtual void tabletEvent(QTabletEvent *event);
- virtual void hoverMoveEvent(QGraphicsSceneHoverEvent *event) Q_DECL_OVERRIDE;
- virtual void hoverLeaveEvent(QGraphicsSceneHoverEvent *event) Q_DECL_OVERRIDE;
+ virtual void hoverMoveEvent(QGraphicsSceneHoverEvent *event) override;
+ virtual void hoverLeaveEvent(QGraphicsSceneHoverEvent *event) override;
virtual void grabMouseEvent(QEvent *event);
virtual void ungrabMouseEvent(QEvent *event);
virtual void grabKeyboardEvent(QEvent *event);
diff --git a/src/widgets/graphicsview/qgraphicswidget_p.h b/src/widgets/graphicsview/qgraphicswidget_p.h
index 0fb9fbba07..505a2a24c0 100644
--- a/src/widgets/graphicsview/qgraphicswidget_p.h
+++ b/src/widgets/graphicsview/qgraphicswidget_p.h
@@ -94,13 +94,13 @@ public:
QPalette palette;
uint inheritedPaletteResolveMask;
void setPalette_helper(const QPalette &palette);
- void resolvePalette(uint inheritedMask) Q_DECL_OVERRIDE;
+ void resolvePalette(uint inheritedMask) override;
void updatePalette(const QPalette &palette);
QPalette naturalWidgetPalette() const;
QFont font;
uint inheritedFontResolveMask;
void setFont_helper(const QFont &font);
- void resolveFont(uint inheritedMask) Q_DECL_OVERRIDE;
+ void resolveFont(uint inheritedMask) override;
void updateFont(const QFont &font);
QFont naturalWidgetFont() const;
@@ -115,13 +115,13 @@ public:
bool hasDecoration() const;
// Private Properties
- qreal width() const Q_DECL_OVERRIDE;
- void setWidth(qreal) Q_DECL_OVERRIDE;
- void resetWidth() Q_DECL_OVERRIDE;
+ qreal width() const override;
+ void setWidth(qreal) override;
+ void resetWidth() override;
- qreal height() const Q_DECL_OVERRIDE;
- void setHeight(qreal) Q_DECL_OVERRIDE;
- void resetHeight() Q_DECL_OVERRIDE;
+ qreal height() const override;
+ void setHeight(qreal) override;
+ void resetHeight() override;
void setGeometryFromSetPos();
// State
diff --git a/src/widgets/itemviews/qabstractitemdelegate.cpp b/src/widgets/itemviews/qabstractitemdelegate.cpp
index d532221092..6cb7c8600d 100644
--- a/src/widgets/itemviews/qabstractitemdelegate.cpp
+++ b/src/widgets/itemviews/qabstractitemdelegate.cpp
@@ -585,12 +585,9 @@ QString QAbstractItemDelegatePrivate::textForRole(Qt::ItemDataRole role, const Q
case QVariant::Time:
text = locale.toString(value.toTime(), formatType);
break;
- case QVariant::DateTime: {
- const QDateTime dateTime = value.toDateTime();
- text = locale.toString(dateTime.date(), formatType)
- + QLatin1Char(' ')
- + locale.toString(dateTime.time(), formatType);
- break; }
+ case QVariant::DateTime:
+ text = locale.toString(value.toDateTime(), formatType);
+ break;
default:
text = value.toString();
if (role == Qt::DisplayRole)
diff --git a/src/widgets/itemviews/qabstractitemdelegate.h b/src/widgets/itemviews/qabstractitemdelegate.h
index 9b6bde1c87..575728e806 100644
--- a/src/widgets/itemviews/qabstractitemdelegate.h
+++ b/src/widgets/itemviews/qabstractitemdelegate.h
@@ -69,7 +69,7 @@ public:
RevertModelCache
};
- explicit QAbstractItemDelegate(QObject *parent = Q_NULLPTR);
+ explicit QAbstractItemDelegate(QObject *parent = nullptr);
virtual ~QAbstractItemDelegate();
// painting
@@ -119,7 +119,7 @@ Q_SIGNALS:
void sizeHintChanged(const QModelIndex &);
protected:
- QAbstractItemDelegate(QObjectPrivate &, QObject *parent = Q_NULLPTR);
+ QAbstractItemDelegate(QObjectPrivate &, QObject *parent = nullptr);
private:
Q_DECLARE_PRIVATE(QAbstractItemDelegate)
Q_DISABLE_COPY(QAbstractItemDelegate)
diff --git a/src/widgets/itemviews/qabstractitemview.h b/src/widgets/itemviews/qabstractitemview.h
index 6a007da348..96745a84ea 100644
--- a/src/widgets/itemviews/qabstractitemview.h
+++ b/src/widgets/itemviews/qabstractitemview.h
@@ -124,7 +124,7 @@ public:
};
Q_ENUM(ScrollMode)
- explicit QAbstractItemView(QWidget *parent = Q_NULLPTR);
+ explicit QAbstractItemView(QWidget *parent = nullptr);
~QAbstractItemView();
virtual void setModel(QAbstractItemModel *model);
@@ -225,7 +225,7 @@ public:
QAbstractItemDelegate *itemDelegate(const QModelIndex &index) const;
- virtual QVariant inputMethodQuery(Qt::InputMethodQuery query) const Q_DECL_OVERRIDE;
+ virtual QVariant inputMethodQuery(Qt::InputMethodQuery query) const override;
using QAbstractScrollArea::update;
@@ -270,7 +270,7 @@ Q_SIGNALS:
void iconSizeChanged(const QSize &size);
protected:
- QAbstractItemView(QAbstractItemViewPrivate &, QWidget *parent = Q_NULLPTR);
+ QAbstractItemView(QAbstractItemViewPrivate &, QWidget *parent = nullptr);
void setHorizontalStepsPerItem(int steps);
int horizontalStepsPerItem() const;
@@ -295,7 +295,7 @@ protected:
virtual bool edit(const QModelIndex &index, EditTrigger trigger, QEvent *event);
virtual QItemSelectionModel::SelectionFlags selectionCommand(const QModelIndex &index,
- const QEvent *event = Q_NULLPTR) const;
+ const QEvent *event = nullptr) const;
#ifndef QT_NO_DRAGANDDROP
virtual void startDrag(Qt::DropActions supportedActions);
@@ -327,32 +327,32 @@ protected:
void stopAutoScroll();
void doAutoScroll();
- bool focusNextPrevChild(bool next) Q_DECL_OVERRIDE;
- bool event(QEvent *event) Q_DECL_OVERRIDE;
- bool viewportEvent(QEvent *event) Q_DECL_OVERRIDE;
- void mousePressEvent(QMouseEvent *event) Q_DECL_OVERRIDE;
- void mouseMoveEvent(QMouseEvent *event) Q_DECL_OVERRIDE;
- void mouseReleaseEvent(QMouseEvent *event) Q_DECL_OVERRIDE;
- void mouseDoubleClickEvent(QMouseEvent *event) Q_DECL_OVERRIDE;
+ bool focusNextPrevChild(bool next) override;
+ bool event(QEvent *event) override;
+ bool viewportEvent(QEvent *event) override;
+ void mousePressEvent(QMouseEvent *event) override;
+ void mouseMoveEvent(QMouseEvent *event) override;
+ void mouseReleaseEvent(QMouseEvent *event) override;
+ void mouseDoubleClickEvent(QMouseEvent *event) override;
#ifndef QT_NO_DRAGANDDROP
- void dragEnterEvent(QDragEnterEvent *event) Q_DECL_OVERRIDE;
- void dragMoveEvent(QDragMoveEvent *event) Q_DECL_OVERRIDE;
- void dragLeaveEvent(QDragLeaveEvent *event) Q_DECL_OVERRIDE;
- void dropEvent(QDropEvent *event) Q_DECL_OVERRIDE;
+ void dragEnterEvent(QDragEnterEvent *event) override;
+ void dragMoveEvent(QDragMoveEvent *event) override;
+ void dragLeaveEvent(QDragLeaveEvent *event) override;
+ void dropEvent(QDropEvent *event) override;
#endif
- void focusInEvent(QFocusEvent *event) Q_DECL_OVERRIDE;
- void focusOutEvent(QFocusEvent *event) Q_DECL_OVERRIDE;
- void keyPressEvent(QKeyEvent *event) Q_DECL_OVERRIDE;
- void resizeEvent(QResizeEvent *event) Q_DECL_OVERRIDE;
- void timerEvent(QTimerEvent *event) Q_DECL_OVERRIDE;
- void inputMethodEvent(QInputMethodEvent *event) Q_DECL_OVERRIDE;
+ void focusInEvent(QFocusEvent *event) override;
+ void focusOutEvent(QFocusEvent *event) override;
+ void keyPressEvent(QKeyEvent *event) override;
+ void resizeEvent(QResizeEvent *event) override;
+ void timerEvent(QTimerEvent *event) override;
+ void inputMethodEvent(QInputMethodEvent *event) override;
#ifndef QT_NO_DRAGANDDROP
enum DropIndicatorPosition { OnItem, AboveItem, BelowItem, OnViewport };
DropIndicatorPosition dropIndicatorPosition() const;
#endif
- QSize viewportSizeHint() const Q_DECL_OVERRIDE;
+ QSize viewportSizeHint() const override;
private:
Q_DECLARE_PRIVATE(QAbstractItemView)
diff --git a/src/widgets/itemviews/qcolumnview.h b/src/widgets/itemviews/qcolumnview.h
index 42eac7426a..5c62f9c9af 100644
--- a/src/widgets/itemviews/qcolumnview.h
+++ b/src/widgets/itemviews/qcolumnview.h
@@ -58,18 +58,18 @@ Q_SIGNALS:
void updatePreviewWidget(const QModelIndex &index);
public:
- explicit QColumnView(QWidget *parent = Q_NULLPTR);
+ explicit QColumnView(QWidget *parent = nullptr);
~QColumnView();
// QAbstractItemView overloads
- QModelIndex indexAt(const QPoint &point) const Q_DECL_OVERRIDE;
- void scrollTo(const QModelIndex &index, ScrollHint hint = EnsureVisible) Q_DECL_OVERRIDE;
- QSize sizeHint() const Q_DECL_OVERRIDE;
- QRect visualRect(const QModelIndex &index) const Q_DECL_OVERRIDE;
- void setModel(QAbstractItemModel *model) Q_DECL_OVERRIDE;
- void setSelectionModel(QItemSelectionModel * selectionModel) Q_DECL_OVERRIDE;
- void setRootIndex(const QModelIndex &index) Q_DECL_OVERRIDE;
- void selectAll() Q_DECL_OVERRIDE;
+ QModelIndex indexAt(const QPoint &point) const override;
+ void scrollTo(const QModelIndex &index, ScrollHint hint = EnsureVisible) override;
+ QSize sizeHint() const override;
+ QRect visualRect(const QModelIndex &index) const override;
+ void setModel(QAbstractItemModel *model) override;
+ void setSelectionModel(QItemSelectionModel * selectionModel) override;
+ void setRootIndex(const QModelIndex &index) override;
+ void selectAll() override;
// QColumnView functions
void setResizeGripsVisible(bool visible);
@@ -82,21 +82,21 @@ public:
QList<int> columnWidths() const;
protected:
- QColumnView(QColumnViewPrivate &dd, QWidget *parent = Q_NULLPTR);
+ QColumnView(QColumnViewPrivate &dd, QWidget *parent = nullptr);
// QAbstractItemView overloads
- bool isIndexHidden(const QModelIndex &index) const Q_DECL_OVERRIDE;
- QModelIndex moveCursor(CursorAction cursorAction, Qt::KeyboardModifiers modifiers) Q_DECL_OVERRIDE;
- void resizeEvent(QResizeEvent *event) Q_DECL_OVERRIDE;
- void setSelection(const QRect & rect, QItemSelectionModel::SelectionFlags command) Q_DECL_OVERRIDE;
- QRegion visualRegionForSelection(const QItemSelection &selection) const Q_DECL_OVERRIDE;
- int horizontalOffset() const Q_DECL_OVERRIDE;
- int verticalOffset() const Q_DECL_OVERRIDE;
- void rowsInserted(const QModelIndex &parent, int start, int end) Q_DECL_OVERRIDE;
- void currentChanged(const QModelIndex &current, const QModelIndex &previous) Q_DECL_OVERRIDE;
+ bool isIndexHidden(const QModelIndex &index) const override;
+ QModelIndex moveCursor(CursorAction cursorAction, Qt::KeyboardModifiers modifiers) override;
+ void resizeEvent(QResizeEvent *event) override;
+ void setSelection(const QRect & rect, QItemSelectionModel::SelectionFlags command) override;
+ QRegion visualRegionForSelection(const QItemSelection &selection) const override;
+ int horizontalOffset() const override;
+ int verticalOffset() const override;
+ void rowsInserted(const QModelIndex &parent, int start, int end) override;
+ void currentChanged(const QModelIndex &current, const QModelIndex &previous) override;
// QColumnView functions
- void scrollContentsBy(int dx, int dy) Q_DECL_OVERRIDE;
+ void scrollContentsBy(int dx, int dy) override;
virtual QAbstractItemView* createColumn(const QModelIndex &rootIndex);
void initializeColumn(QAbstractItemView *column) const;
diff --git a/src/widgets/itemviews/qcolumnview_p.h b/src/widgets/itemviews/qcolumnview_p.h
index fa276075fe..850ab02747 100644
--- a/src/widgets/itemviews/qcolumnview_p.h
+++ b/src/widgets/itemviews/qcolumnview_p.h
@@ -80,7 +80,7 @@ public:
setMinimumWidth(previewWidget->minimumWidth());
}
- void resizeEvent(QResizeEvent * event) Q_DECL_OVERRIDE{
+ void resizeEvent(QResizeEvent * event) override{
if (!previewWidget)
return;
previewWidget->resize(
@@ -96,7 +96,7 @@ public:
QAbstractScrollArea::resizeEvent(event);
}
- void scrollContentsBy(int dx, int dy) Q_DECL_OVERRIDE
+ void scrollContentsBy(int dx, int dy) override
{
if (!previewWidget)
return;
@@ -106,36 +106,36 @@ public:
QAbstractItemView::scrollContentsBy(dx, dy);
}
- QRect visualRect(const QModelIndex &) const Q_DECL_OVERRIDE
+ QRect visualRect(const QModelIndex &) const override
{
return QRect();
}
- void scrollTo(const QModelIndex &, ScrollHint) Q_DECL_OVERRIDE
+ void scrollTo(const QModelIndex &, ScrollHint) override
{
}
- QModelIndex indexAt(const QPoint &) const Q_DECL_OVERRIDE
+ QModelIndex indexAt(const QPoint &) const override
{
return QModelIndex();
}
- QModelIndex moveCursor(CursorAction, Qt::KeyboardModifiers) Q_DECL_OVERRIDE
+ QModelIndex moveCursor(CursorAction, Qt::KeyboardModifiers) override
{
return QModelIndex();
}
- int horizontalOffset () const Q_DECL_OVERRIDE {
+ int horizontalOffset () const override {
return 0;
}
- int verticalOffset () const Q_DECL_OVERRIDE {
+ int verticalOffset () const override {
return 0;
}
- QRegion visualRegionForSelection(const QItemSelection &) const Q_DECL_OVERRIDE
+ QRegion visualRegionForSelection(const QItemSelection &) const override
{
return QRegion();
}
- bool isIndexHidden(const QModelIndex &) const Q_DECL_OVERRIDE
+ bool isIndexHidden(const QModelIndex &) const override
{
return false;
}
- void setSelection(const QRect &, QItemSelectionModel::SelectionFlags) Q_DECL_OVERRIDE
+ void setSelection(const QRect &, QItemSelectionModel::SelectionFlags) override
{
}
private:
@@ -163,7 +163,7 @@ public:
void _q_gripMoved(int offset);
void _q_changeCurrentColumn();
void _q_clicked(const QModelIndex &index);
- void _q_columnsInserted(const QModelIndex &parent, int start, int end) Q_DECL_OVERRIDE;
+ void _q_columnsInserted(const QModelIndex &parent, int start, int end) override;
QList<QAbstractItemView*> columns;
QVector<int> columnSizes; // used during init and corner moving
@@ -188,7 +188,7 @@ public:
void paint(QPainter *painter,
const QStyleOptionViewItem &option,
- const QModelIndex &index) const Q_DECL_OVERRIDE;
+ const QModelIndex &index) const override;
};
QT_END_NAMESPACE
diff --git a/src/widgets/itemviews/qcolumnviewgrip_p.h b/src/widgets/itemviews/qcolumnviewgrip_p.h
index 16c0aefada..7e2793074b 100644
--- a/src/widgets/itemviews/qcolumnviewgrip_p.h
+++ b/src/widgets/itemviews/qcolumnviewgrip_p.h
@@ -74,11 +74,11 @@ public:
protected:
QColumnViewGrip(QColumnViewGripPrivate &, QWidget *parent = 0, Qt::WindowFlags f = 0);
- void paintEvent(QPaintEvent *event) Q_DECL_OVERRIDE;
- void mouseDoubleClickEvent(QMouseEvent *event) Q_DECL_OVERRIDE;
- void mouseMoveEvent(QMouseEvent *event) Q_DECL_OVERRIDE;
- void mouseReleaseEvent(QMouseEvent *event) Q_DECL_OVERRIDE;
- void mousePressEvent(QMouseEvent *event) Q_DECL_OVERRIDE;
+ void paintEvent(QPaintEvent *event) override;
+ void mouseDoubleClickEvent(QMouseEvent *event) override;
+ void mouseMoveEvent(QMouseEvent *event) override;
+ void mouseReleaseEvent(QMouseEvent *event) override;
+ void mousePressEvent(QMouseEvent *event) override;
private:
Q_DECLARE_PRIVATE(QColumnViewGrip)
diff --git a/src/widgets/itemviews/qdatawidgetmapper.h b/src/widgets/itemviews/qdatawidgetmapper.h
index 7d4d61378a..2d75b63a5e 100644
--- a/src/widgets/itemviews/qdatawidgetmapper.h
+++ b/src/widgets/itemviews/qdatawidgetmapper.h
@@ -61,7 +61,7 @@ class Q_WIDGETS_EXPORT QDataWidgetMapper: public QObject
Q_PROPERTY(SubmitPolicy submitPolicy READ submitPolicy WRITE setSubmitPolicy)
public:
- explicit QDataWidgetMapper(QObject *parent = Q_NULLPTR);
+ explicit QDataWidgetMapper(QObject *parent = nullptr);
~QDataWidgetMapper();
void setModel(QAbstractItemModel *model);
diff --git a/src/widgets/itemviews/qdirmodel.h b/src/widgets/itemviews/qdirmodel.h
index 30810cf4f6..ab91bbd763 100644
--- a/src/widgets/itemviews/qdirmodel.h
+++ b/src/widgets/itemviews/qdirmodel.h
@@ -66,31 +66,31 @@ public:
};
QDirModel(const QStringList &nameFilters, QDir::Filters filters,
- QDir::SortFlags sort, QObject *parent = Q_NULLPTR);
- explicit QDirModel(QObject *parent = Q_NULLPTR);
+ QDir::SortFlags sort, QObject *parent = nullptr);
+ explicit QDirModel(QObject *parent = nullptr);
~QDirModel();
- QModelIndex index(int row, int column, const QModelIndex &parent = QModelIndex()) const Q_DECL_OVERRIDE;
- QModelIndex parent(const QModelIndex &child) const Q_DECL_OVERRIDE;
+ QModelIndex index(int row, int column, const QModelIndex &parent = QModelIndex()) const override;
+ QModelIndex parent(const QModelIndex &child) const override;
- int rowCount(const QModelIndex &parent = QModelIndex()) const Q_DECL_OVERRIDE;
- int columnCount(const QModelIndex &parent = QModelIndex()) const Q_DECL_OVERRIDE;
+ int rowCount(const QModelIndex &parent = QModelIndex()) const override;
+ int columnCount(const QModelIndex &parent = QModelIndex()) const override;
- QVariant data(const QModelIndex &index, int role = Qt::DisplayRole) const Q_DECL_OVERRIDE;
- bool setData(const QModelIndex &index, const QVariant &value, int role = Qt::EditRole) Q_DECL_OVERRIDE;
+ QVariant data(const QModelIndex &index, int role = Qt::DisplayRole) const override;
+ bool setData(const QModelIndex &index, const QVariant &value, int role = Qt::EditRole) override;
- QVariant headerData(int section, Qt::Orientation orientation, int role = Qt::DisplayRole) const Q_DECL_OVERRIDE;
+ QVariant headerData(int section, Qt::Orientation orientation, int role = Qt::DisplayRole) const override;
- bool hasChildren(const QModelIndex &index = QModelIndex()) const Q_DECL_OVERRIDE;
- Qt::ItemFlags flags(const QModelIndex &index) const Q_DECL_OVERRIDE;
+ bool hasChildren(const QModelIndex &index = QModelIndex()) const override;
+ Qt::ItemFlags flags(const QModelIndex &index) const override;
- void sort(int column, Qt::SortOrder order = Qt::AscendingOrder) Q_DECL_OVERRIDE;
+ void sort(int column, Qt::SortOrder order = Qt::AscendingOrder) override;
- QStringList mimeTypes() const Q_DECL_OVERRIDE;
- QMimeData *mimeData(const QModelIndexList &indexes) const Q_DECL_OVERRIDE;
+ QStringList mimeTypes() const override;
+ QMimeData *mimeData(const QModelIndexList &indexes) const override;
bool dropMimeData(const QMimeData *data, Qt::DropAction action,
- int row, int column, const QModelIndex &parent) Q_DECL_OVERRIDE;
- Qt::DropActions supportedDropActions() const Q_DECL_OVERRIDE;
+ int row, int column, const QModelIndex &parent) override;
+ Qt::DropActions supportedDropActions() const override;
// QDirModel specific API
@@ -133,7 +133,7 @@ public Q_SLOTS:
void refresh(const QModelIndex &parent = QModelIndex());
protected:
- QDirModel(QDirModelPrivate &, QObject *parent = Q_NULLPTR);
+ QDirModel(QDirModelPrivate &, QObject *parent = nullptr);
friend class QFileDialogPrivate;
private:
diff --git a/src/widgets/itemviews/qheaderview.cpp b/src/widgets/itemviews/qheaderview.cpp
index c3c9bdf51c..3555c276ac 100644
--- a/src/widgets/itemviews/qheaderview.cpp
+++ b/src/widgets/itemviews/qheaderview.cpp
@@ -361,7 +361,9 @@ void QHeaderView::setModel(QAbstractItemModel *model)
QObject::disconnect(d->model, SIGNAL(columnsRemoved(QModelIndex,int,int)),
this, SLOT(_q_sectionsRemoved(QModelIndex,int,int)));
QObject::disconnect(d->model, SIGNAL(columnsAboutToBeMoved(QModelIndex,int,int,QModelIndex,int)),
- this, SLOT(_q_layoutAboutToBeChanged()));
+ this, SLOT(_q_sectionsAboutToBeChanged()));
+ QObject::disconnect(d->model, SIGNAL(columnsMoved(QModelIndex,int,int,QModelIndex,int)),
+ this, SLOT(_q_sectionsChanged()));
} else {
QObject::disconnect(d->model, SIGNAL(rowsInserted(QModelIndex,int,int)),
this, SLOT(sectionsInserted(QModelIndex,int,int)));
@@ -370,12 +372,16 @@ void QHeaderView::setModel(QAbstractItemModel *model)
QObject::disconnect(d->model, SIGNAL(rowsRemoved(QModelIndex,int,int)),
this, SLOT(_q_sectionsRemoved(QModelIndex,int,int)));
QObject::disconnect(d->model, SIGNAL(rowsAboutToBeMoved(QModelIndex,int,int,QModelIndex,int)),
- this, SLOT(_q_layoutAboutToBeChanged()));
+ this, SLOT(_q_sectionsAboutToBeChanged()));
+ QObject::disconnect(d->model, SIGNAL(rowsMoved(QModelIndex,int,int,QModelIndex,int)),
+ this, SLOT(_q_sectionsChanged()));
}
QObject::disconnect(d->model, SIGNAL(headerDataChanged(Qt::Orientation,int,int)),
this, SLOT(headerDataChanged(Qt::Orientation,int,int)));
QObject::disconnect(d->model, SIGNAL(layoutAboutToBeChanged()),
- this, SLOT(_q_layoutAboutToBeChanged()));
+ this, SLOT(_q_sectionsAboutToBeChanged()));
+ QObject::disconnect(d->model, SIGNAL(layoutChanged()),
+ this, SLOT(_q_sectionsChanged()));
}
if (model && model != QAbstractItemModelPrivate::staticEmptyModel()) {
@@ -387,7 +393,9 @@ void QHeaderView::setModel(QAbstractItemModel *model)
QObject::connect(model, SIGNAL(columnsRemoved(QModelIndex,int,int)),
this, SLOT(_q_sectionsRemoved(QModelIndex,int,int)));
QObject::connect(model, SIGNAL(columnsAboutToBeMoved(QModelIndex,int,int,QModelIndex,int)),
- this, SLOT(_q_layoutAboutToBeChanged()));
+ this, SLOT(_q_sectionsAboutToBeChanged()));
+ QObject::connect(model, SIGNAL(columnsMoved(QModelIndex,int,int,QModelIndex,int)),
+ this, SLOT(_q_sectionsChanged()));
} else {
QObject::connect(model, SIGNAL(rowsInserted(QModelIndex,int,int)),
this, SLOT(sectionsInserted(QModelIndex,int,int)));
@@ -396,12 +404,16 @@ void QHeaderView::setModel(QAbstractItemModel *model)
QObject::connect(model, SIGNAL(rowsRemoved(QModelIndex,int,int)),
this, SLOT(_q_sectionsRemoved(QModelIndex,int,int)));
QObject::connect(model, SIGNAL(rowsAboutToBeMoved(QModelIndex,int,int,QModelIndex,int)),
- this, SLOT(_q_layoutAboutToBeChanged()));
+ this, SLOT(_q_sectionsAboutToBeChanged()));
+ QObject::connect(model, SIGNAL(rowsMoved(QModelIndex,int,int,QModelIndex,int)),
+ this, SLOT(_q_sectionsChanged()));
}
QObject::connect(model, SIGNAL(headerDataChanged(Qt::Orientation,int,int)),
this, SLOT(headerDataChanged(Qt::Orientation,int,int)));
QObject::connect(model, SIGNAL(layoutAboutToBeChanged()),
- this, SLOT(_q_layoutAboutToBeChanged()));
+ this, SLOT(_q_sectionsAboutToBeChanged()));
+ QObject::connect(model, SIGNAL(layoutChanged()),
+ this, SLOT(_q_sectionsChanged()));
}
d->state = QHeaderViewPrivate::NoClear;
@@ -2062,7 +2074,7 @@ void QHeaderViewPrivate::_q_sectionsRemoved(const QModelIndex &parent,
viewport->update();
}
-void QHeaderViewPrivate::_q_layoutAboutToBeChanged()
+void QHeaderViewPrivate::_q_sectionsAboutToBeChanged()
{
//if there is no row/column we can't have mapping for columns
//because no QModelIndex in the model would be valid
@@ -2082,7 +2094,7 @@ void QHeaderViewPrivate::_q_layoutAboutToBeChanged()
: model->index(logicalIndex(i), 0, root));
}
-void QHeaderViewPrivate::_q_layoutChanged()
+void QHeaderViewPrivate::_q_sectionsChanged()
{
Q_Q(QHeaderView);
viewport->update();
diff --git a/src/widgets/itemviews/qheaderview.h b/src/widgets/itemviews/qheaderview.h
index ec4500d81e..ec00d16d10 100644
--- a/src/widgets/itemviews/qheaderview.h
+++ b/src/widgets/itemviews/qheaderview.h
@@ -74,16 +74,16 @@ public:
};
Q_ENUM(ResizeMode)
- explicit QHeaderView(Qt::Orientation orientation, QWidget *parent = Q_NULLPTR);
+ explicit QHeaderView(Qt::Orientation orientation, QWidget *parent = nullptr);
virtual ~QHeaderView();
- void setModel(QAbstractItemModel *model) Q_DECL_OVERRIDE;
+ void setModel(QAbstractItemModel *model) override;
Qt::Orientation orientation() const;
int offset() const;
int length() const;
- QSize sizeHint() const Q_DECL_OVERRIDE;
- void setVisible(bool v) Q_DECL_OVERRIDE;
+ QSize sizeHint() const override;
+ void setVisible(bool v) override;
int sectionSizeHint(int logicalIndex) const;
int visualIndexAt(int position) const;
@@ -172,7 +172,7 @@ public:
Qt::Alignment defaultAlignment() const;
void setDefaultAlignment(Qt::Alignment alignment);
- void doItemsLayout() Q_DECL_OVERRIDE;
+ void doItemsLayout() override;
bool sectionsMoved() const;
bool sectionsHidden() const;
@@ -181,7 +181,7 @@ public:
bool restoreState(const QByteArray &state);
#endif
- void reset() Q_DECL_OVERRIDE;
+ void reset() override;
public Q_SLOTS:
void setOffset(int offset);
@@ -208,41 +208,41 @@ protected Q_SLOTS:
void sectionsAboutToBeRemoved(const QModelIndex &parent, int logicalFirst, int logicalLast);
protected:
- QHeaderView(QHeaderViewPrivate &dd, Qt::Orientation orientation, QWidget *parent = Q_NULLPTR);
+ QHeaderView(QHeaderViewPrivate &dd, Qt::Orientation orientation, QWidget *parent = nullptr);
void initialize();
void initializeSections();
void initializeSections(int start, int end);
- void currentChanged(const QModelIndex &current, const QModelIndex &old) Q_DECL_OVERRIDE;
+ void currentChanged(const QModelIndex &current, const QModelIndex &old) override;
- bool event(QEvent *e) Q_DECL_OVERRIDE;
- void paintEvent(QPaintEvent *e) Q_DECL_OVERRIDE;
- void mousePressEvent(QMouseEvent *e) Q_DECL_OVERRIDE;
- void mouseMoveEvent(QMouseEvent *e) Q_DECL_OVERRIDE;
- void mouseReleaseEvent(QMouseEvent *e) Q_DECL_OVERRIDE;
- void mouseDoubleClickEvent(QMouseEvent *e) Q_DECL_OVERRIDE;
- bool viewportEvent(QEvent *e) Q_DECL_OVERRIDE;
+ bool event(QEvent *e) override;
+ void paintEvent(QPaintEvent *e) override;
+ void mousePressEvent(QMouseEvent *e) override;
+ void mouseMoveEvent(QMouseEvent *e) override;
+ void mouseReleaseEvent(QMouseEvent *e) override;
+ void mouseDoubleClickEvent(QMouseEvent *e) override;
+ bool viewportEvent(QEvent *e) override;
virtual void paintSection(QPainter *painter, const QRect &rect, int logicalIndex) const;
virtual QSize sectionSizeFromContents(int logicalIndex) const;
- int horizontalOffset() const Q_DECL_OVERRIDE;
- int verticalOffset() const Q_DECL_OVERRIDE;
- void updateGeometries() Q_DECL_OVERRIDE;
- void scrollContentsBy(int dx, int dy) Q_DECL_OVERRIDE;
+ int horizontalOffset() const override;
+ int verticalOffset() const override;
+ void updateGeometries() override;
+ void scrollContentsBy(int dx, int dy) override;
- void dataChanged(const QModelIndex &topLeft, const QModelIndex &bottomRight, const QVector<int> &roles = QVector<int>()) Q_DECL_OVERRIDE;
- void rowsInserted(const QModelIndex &parent, int start, int end) Q_DECL_OVERRIDE;
+ void dataChanged(const QModelIndex &topLeft, const QModelIndex &bottomRight, const QVector<int> &roles = QVector<int>()) override;
+ void rowsInserted(const QModelIndex &parent, int start, int end) override;
- QRect visualRect(const QModelIndex &index) const Q_DECL_OVERRIDE;
- void scrollTo(const QModelIndex &index, ScrollHint hint) Q_DECL_OVERRIDE;
+ QRect visualRect(const QModelIndex &index) const override;
+ void scrollTo(const QModelIndex &index, ScrollHint hint) override;
- QModelIndex indexAt(const QPoint &p) const Q_DECL_OVERRIDE;
- bool isIndexHidden(const QModelIndex &index) const Q_DECL_OVERRIDE;
+ QModelIndex indexAt(const QPoint &p) const override;
+ bool isIndexHidden(const QModelIndex &index) const override;
- QModelIndex moveCursor(CursorAction, Qt::KeyboardModifiers) Q_DECL_OVERRIDE;
- void setSelection(const QRect& rect, QItemSelectionModel::SelectionFlags flags) Q_DECL_OVERRIDE;
- QRegion visualRegionForSelection(const QItemSelection &selection) const Q_DECL_OVERRIDE;
+ QModelIndex moveCursor(CursorAction, Qt::KeyboardModifiers) override;
+ void setSelection(const QRect& rect, QItemSelectionModel::SelectionFlags flags) override;
+ QRegion visualRegionForSelection(const QItemSelection &selection) const override;
void initStyleOption(QStyleOptionHeader *option) const;
friend class QTableView;
@@ -250,7 +250,8 @@ protected:
private:
Q_PRIVATE_SLOT(d_func(), void _q_sectionsRemoved(const QModelIndex &parent, int logicalFirst, int logicalLast))
- Q_PRIVATE_SLOT(d_func(), void _q_layoutAboutToBeChanged())
+ Q_PRIVATE_SLOT(d_func(), void _q_sectionsAboutToBeChanged())
+ Q_PRIVATE_SLOT(d_func(), void _q_sectionsChanged())
Q_DECLARE_PRIVATE(QHeaderView)
Q_DISABLE_COPY(QHeaderView)
};
diff --git a/src/widgets/itemviews/qheaderview_p.h b/src/widgets/itemviews/qheaderview_p.h
index 8fc8b88aa5..3b8e61af75 100644
--- a/src/widgets/itemviews/qheaderview_p.h
+++ b/src/widgets/itemviews/qheaderview_p.h
@@ -120,8 +120,8 @@ public:
void updateHiddenSections(int logicalFirst, int logicalLast);
void resizeSections(QHeaderView::ResizeMode globalMode, bool useGlobalMode = false);
void _q_sectionsRemoved(const QModelIndex &,int,int);
- void _q_layoutAboutToBeChanged();
- void _q_layoutChanged() override;
+ void _q_sectionsAboutToBeChanged();
+ void _q_sectionsChanged();
bool isSectionSelected(int section) const;
bool isFirstVisibleSection(int section) const;
diff --git a/src/widgets/itemviews/qitemdelegate.cpp b/src/widgets/itemviews/qitemdelegate.cpp
index d9caebec8a..df5f9afb0e 100644
--- a/src/widgets/itemviews/qitemdelegate.cpp
+++ b/src/widgets/itemviews/qitemdelegate.cpp
@@ -94,10 +94,7 @@ public:
inline static QString replaceNewLine(QString text)
{
- const QChar nl = QLatin1Char('\n');
- for (int i = 0; i < text.count(); ++i)
- if (text.at(i) == nl)
- text[i] = QChar::LineSeparator;
+ text.replace(QLatin1Char('\n'), QChar::LineSeparator);
return text;
}
diff --git a/src/widgets/itemviews/qitemdelegate.h b/src/widgets/itemviews/qitemdelegate.h
index 21594327ef..539dec4374 100644
--- a/src/widgets/itemviews/qitemdelegate.h
+++ b/src/widgets/itemviews/qitemdelegate.h
@@ -59,7 +59,7 @@ class Q_WIDGETS_EXPORT QItemDelegate : public QAbstractItemDelegate
Q_PROPERTY(bool clipping READ hasClipping WRITE setClipping)
public:
- explicit QItemDelegate(QObject *parent = Q_NULLPTR);
+ explicit QItemDelegate(QObject *parent = nullptr);
~QItemDelegate();
bool hasClipping() const;
@@ -68,21 +68,21 @@ public:
// painting
void paint(QPainter *painter,
const QStyleOptionViewItem &option,
- const QModelIndex &index) const Q_DECL_OVERRIDE;
+ const QModelIndex &index) const override;
QSize sizeHint(const QStyleOptionViewItem &option,
- const QModelIndex &index) const Q_DECL_OVERRIDE;
+ const QModelIndex &index) const override;
// editing
QWidget *createEditor(QWidget *parent,
const QStyleOptionViewItem &option,
- const QModelIndex &index) const Q_DECL_OVERRIDE;
+ const QModelIndex &index) const override;
- void setEditorData(QWidget *editor, const QModelIndex &index) const Q_DECL_OVERRIDE;
- void setModelData(QWidget *editor, QAbstractItemModel *model, const QModelIndex &index) const Q_DECL_OVERRIDE;
+ void setEditorData(QWidget *editor, const QModelIndex &index) const override;
+ void setModelData(QWidget *editor, QAbstractItemModel *model, const QModelIndex &index) const override;
void updateEditorGeometry(QWidget *editor,
const QStyleOptionViewItem &option,
- const QModelIndex &index) const Q_DECL_OVERRIDE;
+ const QModelIndex &index) const override;
// editor factory
QItemEditorFactory *itemEditorFactory() const;
@@ -105,9 +105,9 @@ protected:
QRect rect(const QStyleOptionViewItem &option, const QModelIndex &index, int role) const;
- bool eventFilter(QObject *object, QEvent *event) Q_DECL_OVERRIDE;
+ bool eventFilter(QObject *object, QEvent *event) override;
bool editorEvent(QEvent *event, QAbstractItemModel *model,
- const QStyleOptionViewItem &option, const QModelIndex &index) Q_DECL_OVERRIDE;
+ const QStyleOptionViewItem &option, const QModelIndex &index) override;
QStyleOptionViewItem setOptions(const QModelIndex &index,
const QStyleOptionViewItem &option) const;
diff --git a/src/widgets/itemviews/qitemeditorfactory.cpp b/src/widgets/itemviews/qitemeditorfactory.cpp
index b580f0e840..72a9f1f1c9 100644
--- a/src/widgets/itemviews/qitemeditorfactory.cpp
+++ b/src/widgets/itemviews/qitemeditorfactory.cpp
@@ -233,8 +233,8 @@ class QDefaultItemEditorFactory : public QItemEditorFactory
{
public:
inline QDefaultItemEditorFactory() {}
- QWidget *createEditor(int userType, QWidget *parent) const Q_DECL_OVERRIDE;
- QByteArray valuePropertyName(int) const Q_DECL_OVERRIDE;
+ QWidget *createEditor(int userType, QWidget *parent) const override;
+ QByteArray valuePropertyName(int) const override;
};
QWidget *QDefaultItemEditorFactory::createEditor(int userType, QWidget *parent) const
@@ -587,7 +587,7 @@ void QExpandingLineEdit::resizeToContents()
originalWidth = oldWidth;
if (QWidget *parent = parentWidget()) {
QPoint position = pos();
- int hintWidth = minimumWidth() + fontMetrics().width(displayText());
+ int hintWidth = minimumWidth() + fontMetrics().horizontalAdvance(displayText());
int parentWidth = parent->width();
int maxWidth = isRightToLeft() ? position.x() + oldWidth : parentWidth - position.x();
int newWidth = qBound(originalWidth, hintWidth, maxWidth);
diff --git a/src/widgets/itemviews/qitemeditorfactory_p.h b/src/widgets/itemviews/qitemeditorfactory_p.h
index 46a8da1d8f..e78f42b729 100644
--- a/src/widgets/itemviews/qitemeditorfactory_p.h
+++ b/src/widgets/itemviews/qitemeditorfactory_p.h
@@ -74,7 +74,7 @@ public:
}
protected:
- void changeEvent(QEvent *e) Q_DECL_OVERRIDE;
+ void changeEvent(QEvent *e) override;
public Q_SLOTS:
void resizeToContents();
diff --git a/src/widgets/itemviews/qlistview.h b/src/widgets/itemviews/qlistview.h
index 66ec9b18b1..2da510facf 100644
--- a/src/widgets/itemviews/qlistview.h
+++ b/src/widgets/itemviews/qlistview.h
@@ -78,7 +78,7 @@ public:
enum ViewMode { ListMode, IconMode };
Q_ENUM(ViewMode)
- explicit QListView(QWidget *parent = Q_NULLPTR);
+ explicit QListView(QWidget *parent = nullptr);
~QListView();
void setMovement(Movement movement);
@@ -125,67 +125,67 @@ public:
void setSelectionRectVisible(bool show);
bool isSelectionRectVisible() const;
- QRect visualRect(const QModelIndex &index) const Q_DECL_OVERRIDE;
- void scrollTo(const QModelIndex &index, ScrollHint hint = EnsureVisible) Q_DECL_OVERRIDE;
- QModelIndex indexAt(const QPoint &p) const Q_DECL_OVERRIDE;
+ QRect visualRect(const QModelIndex &index) const override;
+ void scrollTo(const QModelIndex &index, ScrollHint hint = EnsureVisible) override;
+ QModelIndex indexAt(const QPoint &p) const override;
- void doItemsLayout() Q_DECL_OVERRIDE;
- void reset() Q_DECL_OVERRIDE;
- void setRootIndex(const QModelIndex &index) Q_DECL_OVERRIDE;
+ void doItemsLayout() override;
+ void reset() override;
+ void setRootIndex(const QModelIndex &index) override;
Q_SIGNALS:
void indexesMoved(const QModelIndexList &indexes);
protected:
- QListView(QListViewPrivate &, QWidget *parent = Q_NULLPTR);
+ QListView(QListViewPrivate &, QWidget *parent = nullptr);
- bool event(QEvent *e) Q_DECL_OVERRIDE;
+ bool event(QEvent *e) override;
- void scrollContentsBy(int dx, int dy) Q_DECL_OVERRIDE;
+ void scrollContentsBy(int dx, int dy) override;
void resizeContents(int width, int height);
QSize contentsSize() const;
- void dataChanged(const QModelIndex &topLeft, const QModelIndex &bottomRight, const QVector<int> &roles = QVector<int>()) Q_DECL_OVERRIDE;
- void rowsInserted(const QModelIndex &parent, int start, int end) Q_DECL_OVERRIDE;
- void rowsAboutToBeRemoved(const QModelIndex &parent, int start, int end) Q_DECL_OVERRIDE;
+ void dataChanged(const QModelIndex &topLeft, const QModelIndex &bottomRight, const QVector<int> &roles = QVector<int>()) override;
+ void rowsInserted(const QModelIndex &parent, int start, int end) override;
+ void rowsAboutToBeRemoved(const QModelIndex &parent, int start, int end) override;
- void mouseMoveEvent(QMouseEvent *e) Q_DECL_OVERRIDE;
- void mouseReleaseEvent(QMouseEvent *e) Q_DECL_OVERRIDE;
+ void mouseMoveEvent(QMouseEvent *e) override;
+ void mouseReleaseEvent(QMouseEvent *e) override;
#if QT_CONFIG(wheelevent)
- void wheelEvent(QWheelEvent *e) Q_DECL_OVERRIDE;
+ void wheelEvent(QWheelEvent *e) override;
#endif
- void timerEvent(QTimerEvent *e) Q_DECL_OVERRIDE;
- void resizeEvent(QResizeEvent *e) Q_DECL_OVERRIDE;
+ void timerEvent(QTimerEvent *e) override;
+ void resizeEvent(QResizeEvent *e) override;
#ifndef QT_NO_DRAGANDDROP
- void dragMoveEvent(QDragMoveEvent *e) Q_DECL_OVERRIDE;
- void dragLeaveEvent(QDragLeaveEvent *e) Q_DECL_OVERRIDE;
- void dropEvent(QDropEvent *e) Q_DECL_OVERRIDE;
- void startDrag(Qt::DropActions supportedActions) Q_DECL_OVERRIDE;
+ void dragMoveEvent(QDragMoveEvent *e) override;
+ void dragLeaveEvent(QDragLeaveEvent *e) override;
+ void dropEvent(QDropEvent *e) override;
+ void startDrag(Qt::DropActions supportedActions) override;
#endif // QT_NO_DRAGANDDROP
- QStyleOptionViewItem viewOptions() const Q_DECL_OVERRIDE;
- void paintEvent(QPaintEvent *e) Q_DECL_OVERRIDE;
+ QStyleOptionViewItem viewOptions() const override;
+ void paintEvent(QPaintEvent *e) override;
- int horizontalOffset() const Q_DECL_OVERRIDE;
- int verticalOffset() const Q_DECL_OVERRIDE;
- QModelIndex moveCursor(CursorAction cursorAction, Qt::KeyboardModifiers modifiers) Q_DECL_OVERRIDE;
+ int horizontalOffset() const override;
+ int verticalOffset() const override;
+ QModelIndex moveCursor(CursorAction cursorAction, Qt::KeyboardModifiers modifiers) override;
QRect rectForIndex(const QModelIndex &index) const;
void setPositionForIndex(const QPoint &position, const QModelIndex &index);
- void setSelection(const QRect &rect, QItemSelectionModel::SelectionFlags command) Q_DECL_OVERRIDE;
- QRegion visualRegionForSelection(const QItemSelection &selection) const Q_DECL_OVERRIDE;
- QModelIndexList selectedIndexes() const Q_DECL_OVERRIDE;
+ void setSelection(const QRect &rect, QItemSelectionModel::SelectionFlags command) override;
+ QRegion visualRegionForSelection(const QItemSelection &selection) const override;
+ QModelIndexList selectedIndexes() const override;
- void updateGeometries() Q_DECL_OVERRIDE;
+ void updateGeometries() override;
- bool isIndexHidden(const QModelIndex &index) const Q_DECL_OVERRIDE;
+ bool isIndexHidden(const QModelIndex &index) const override;
- void selectionChanged(const QItemSelection &selected, const QItemSelection &deselected) Q_DECL_OVERRIDE;
- void currentChanged(const QModelIndex &current, const QModelIndex &previous) Q_DECL_OVERRIDE;
+ void selectionChanged(const QItemSelection &selected, const QItemSelection &deselected) override;
+ void currentChanged(const QModelIndex &current, const QModelIndex &previous) override;
- QSize viewportSizeHint() const Q_DECL_OVERRIDE;
+ QSize viewportSizeHint() const override;
private:
int visualIndex(const QModelIndex &index) const;
diff --git a/src/widgets/itemviews/qlistwidget.cpp b/src/widgets/itemviews/qlistwidget.cpp
index 95ad3f82d0..c14dcec744 100644
--- a/src/widgets/itemviews/qlistwidget.cpp
+++ b/src/widgets/itemviews/qlistwidget.cpp
@@ -189,8 +189,9 @@ int QListModel::rowCount(const QModelIndex &parent) const
return parent.isValid() ? 0 : items.count();
}
-QModelIndex QListModel::index(QListWidgetItem *item) const
+QModelIndex QListModel::index(const QListWidgetItem *item_) const
{
+ QListWidgetItem *item = const_cast<QListWidgetItem *>(item_);
if (!item || !item->view || static_cast<const QListModel *>(item->view->model()) != this
|| items.isEmpty())
return QModelIndex();
@@ -1942,14 +1943,28 @@ QList<QListWidgetItem*> QListWidget::items(const QMimeData *data) const
/*!
Returns the QModelIndex associated with the given \a item.
+
+ \note In Qt versions prior to 5.10, this function took a non-\c{const} \a item.
*/
-QModelIndex QListWidget::indexFromItem(QListWidgetItem *item) const
+QModelIndex QListWidget::indexFromItem(const QListWidgetItem *item) const
{
Q_D(const QListWidget);
return d->listModel()->index(item);
}
+#if QT_VERSION < QT_VERSION_CHECK(6, 0, 0)
+/*!
+ \internal
+ \obsolete
+ \overload
+*/
+QModelIndex QListWidget::indexFromItem(QListWidgetItem *item) const
+{
+ return indexFromItem(const_cast<const QListWidgetItem *>(item));
+}
+#endif
+
/*!
Returns a pointer to the QListWidgetItem associated with the given \a index.
*/
diff --git a/src/widgets/itemviews/qlistwidget.h b/src/widgets/itemviews/qlistwidget.h
index 50f4e2ac84..3caa5ce6f2 100644
--- a/src/widgets/itemviews/qlistwidget.h
+++ b/src/widgets/itemviews/qlistwidget.h
@@ -61,10 +61,10 @@ class Q_WIDGETS_EXPORT QListWidgetItem
friend class QListWidget;
public:
enum ItemType { Type = 0, UserType = 1000 };
- explicit QListWidgetItem(QListWidget *view = Q_NULLPTR, int type = Type);
- explicit QListWidgetItem(const QString &text, QListWidget *view = Q_NULLPTR, int type = Type);
+ explicit QListWidgetItem(QListWidget *view = nullptr, int type = Type);
+ explicit QListWidgetItem(const QString &text, QListWidget *view = nullptr, int type = Type);
explicit QListWidgetItem(const QIcon &icon, const QString &text,
- QListWidget *view = Q_NULLPTR, int type = Type);
+ QListWidget *view = nullptr, int type = Type);
QListWidgetItem(const QListWidgetItem &other);
virtual ~QListWidgetItem();
@@ -204,10 +204,10 @@ class Q_WIDGETS_EXPORT QListWidget : public QListView
friend class QListWidgetItem;
friend class QListModel;
public:
- explicit QListWidget(QWidget *parent = Q_NULLPTR);
+ explicit QListWidget(QWidget *parent = nullptr);
~QListWidget();
- void setSelectionModel(QItemSelectionModel *selectionModel) Q_DECL_OVERRIDE;
+ void setSelectionModel(QItemSelectionModel *selectionModel) override;
QListWidgetItem *item(int row) const;
int row(const QListWidgetItem *item) const;
@@ -257,7 +257,7 @@ public:
protected:
#endif
#if QT_CONFIG(draganddrop)
- void dropEvent(QDropEvent *event) Q_DECL_OVERRIDE;
+ void dropEvent(QDropEvent *event) override;
#endif
public Q_SLOTS:
void scrollToItem(const QListWidgetItem *item, QAbstractItemView::ScrollHint hint = EnsureVisible);
@@ -278,7 +278,7 @@ Q_SIGNALS:
void itemSelectionChanged();
protected:
- bool event(QEvent *e) Q_DECL_OVERRIDE;
+ bool event(QEvent *e) override;
virtual QStringList mimeTypes() const;
#if QT_VERSION >= QT_VERSION_CHECK(6,0,0)
virtual QMimeData *mimeData(const QList<QListWidgetItem *> &items) const;
@@ -297,11 +297,14 @@ protected:
#endif
QList<QListWidgetItem*> items(const QMimeData *data) const;
- QModelIndex indexFromItem(QListWidgetItem *item) const;
+ QModelIndex indexFromItem(const QListWidgetItem *item) const;
+#if QT_VERSION < QT_VERSION_CHECK(6, 0, 0)
+ QModelIndex indexFromItem(QListWidgetItem *item) const; // ### Qt 6: remove
+#endif
QListWidgetItem *itemFromIndex(const QModelIndex &index) const;
private:
- void setModel(QAbstractItemModel *model) Q_DECL_OVERRIDE;
+ void setModel(QAbstractItemModel *model) override;
Qt::SortOrder sortOrder() const;
Q_DECLARE_PRIVATE(QListWidget)
@@ -319,7 +322,7 @@ private:
};
inline void QListWidget::removeItemWidget(QListWidgetItem *aItem)
-{ setItemWidget(aItem, Q_NULLPTR); }
+{ setItemWidget(aItem, nullptr); }
inline void QListWidget::addItem(QListWidgetItem *aitem)
{ insertItem(count(), aitem); }
diff --git a/src/widgets/itemviews/qlistwidget_p.h b/src/widgets/itemviews/qlistwidget_p.h
index e8f5540f9c..492b05ff07 100644
--- a/src/widgets/itemviews/qlistwidget_p.h
+++ b/src/widgets/itemviews/qlistwidget_p.h
@@ -95,7 +95,7 @@ public:
int rowCount(const QModelIndex &parent = QModelIndex()) const override;
- QModelIndex index(QListWidgetItem *item) const;
+ QModelIndex index(const QListWidgetItem *item) const;
QModelIndex index(int row, int column = 0, const QModelIndex &parent = QModelIndex()) const override;
QVariant data(const QModelIndex &index, int role = Qt::DisplayRole) const override;
diff --git a/src/widgets/itemviews/qstyleditemdelegate.h b/src/widgets/itemviews/qstyleditemdelegate.h
index f3b7c4d1f4..2df2450f07 100644
--- a/src/widgets/itemviews/qstyleditemdelegate.h
+++ b/src/widgets/itemviews/qstyleditemdelegate.h
@@ -58,28 +58,28 @@ class Q_WIDGETS_EXPORT QStyledItemDelegate : public QAbstractItemDelegate
Q_OBJECT
public:
- explicit QStyledItemDelegate(QObject *parent = Q_NULLPTR);
+ explicit QStyledItemDelegate(QObject *parent = nullptr);
~QStyledItemDelegate();
// painting
void paint(QPainter *painter,
- const QStyleOptionViewItem &option, const QModelIndex &index) const Q_DECL_OVERRIDE;
+ const QStyleOptionViewItem &option, const QModelIndex &index) const override;
QSize sizeHint(const QStyleOptionViewItem &option,
- const QModelIndex &index) const Q_DECL_OVERRIDE;
+ const QModelIndex &index) const override;
// editing
QWidget *createEditor(QWidget *parent,
const QStyleOptionViewItem &option,
- const QModelIndex &index) const Q_DECL_OVERRIDE;
+ const QModelIndex &index) const override;
- void setEditorData(QWidget *editor, const QModelIndex &index) const Q_DECL_OVERRIDE;
+ void setEditorData(QWidget *editor, const QModelIndex &index) const override;
void setModelData(QWidget *editor,
QAbstractItemModel *model,
- const QModelIndex &index) const Q_DECL_OVERRIDE;
+ const QModelIndex &index) const override;
void updateEditorGeometry(QWidget *editor,
const QStyleOptionViewItem &option,
- const QModelIndex &index) const Q_DECL_OVERRIDE;
+ const QModelIndex &index) const override;
// editor factory
QItemEditorFactory *itemEditorFactory() const;
@@ -91,9 +91,9 @@ protected:
virtual void initStyleOption(QStyleOptionViewItem *option,
const QModelIndex &index) const;
- bool eventFilter(QObject *object, QEvent *event) Q_DECL_OVERRIDE;
+ bool eventFilter(QObject *object, QEvent *event) override;
bool editorEvent(QEvent *event, QAbstractItemModel *model,
- const QStyleOptionViewItem &option, const QModelIndex &index) Q_DECL_OVERRIDE;
+ const QStyleOptionViewItem &option, const QModelIndex &index) override;
private:
Q_DECLARE_PRIVATE(QStyledItemDelegate)
diff --git a/src/widgets/itemviews/qtableview.cpp b/src/widgets/itemviews/qtableview.cpp
index 8ab811e9f7..fd3bdfd065 100644
--- a/src/widgets/itemviews/qtableview.cpp
+++ b/src/widgets/itemviews/qtableview.cpp
@@ -585,7 +585,7 @@ class QTableCornerButton : public QAbstractButton
Q_OBJECT
public:
QTableCornerButton(QWidget *parent) : QAbstractButton(parent) {}
- void paintEvent(QPaintEvent*) Q_DECL_OVERRIDE {
+ void paintEvent(QPaintEvent*) override {
QStyleOptionHeader opt;
opt.init(this);
QStyle::State state = QStyle::State_None;
diff --git a/src/widgets/itemviews/qtableview.h b/src/widgets/itemviews/qtableview.h
index 75f2e7b44c..60c2f34103 100644
--- a/src/widgets/itemviews/qtableview.h
+++ b/src/widgets/itemviews/qtableview.h
@@ -62,13 +62,13 @@ class Q_WIDGETS_EXPORT QTableView : public QAbstractItemView
#endif
public:
- explicit QTableView(QWidget *parent = Q_NULLPTR);
+ explicit QTableView(QWidget *parent = nullptr);
~QTableView();
- void setModel(QAbstractItemModel *model) Q_DECL_OVERRIDE;
- void setRootIndex(const QModelIndex &index) Q_DECL_OVERRIDE;
- void setSelectionModel(QItemSelectionModel *selectionModel) Q_DECL_OVERRIDE;
- void doItemsLayout() Q_DECL_OVERRIDE;
+ void setModel(QAbstractItemModel *model) override;
+ void setRootIndex(const QModelIndex &index) override;
+ void setSelectionModel(QItemSelectionModel *selectionModel) override;
+ void doItemsLayout() override;
QHeaderView *horizontalHeader() const;
QHeaderView *verticalHeader() const;
@@ -109,9 +109,9 @@ public:
bool isCornerButtonEnabled() const;
#endif
- QRect visualRect(const QModelIndex &index) const Q_DECL_OVERRIDE;
- void scrollTo(const QModelIndex &index, ScrollHint hint = EnsureVisible) Q_DECL_OVERRIDE;
- QModelIndex indexAt(const QPoint &p) const Q_DECL_OVERRIDE;
+ QRect visualRect(const QModelIndex &index) const override;
+ void scrollTo(const QModelIndex &index, ScrollHint hint = EnsureVisible) override;
+ QModelIndex indexAt(const QPoint &p) const override;
void setSpan(int row, int column, int rowSpan, int columnSpan);
int rowSpan(int row, int column) const;
@@ -144,37 +144,37 @@ protected Q_SLOTS:
protected:
QTableView(QTableViewPrivate &, QWidget *parent);
- void scrollContentsBy(int dx, int dy) Q_DECL_OVERRIDE;
+ void scrollContentsBy(int dx, int dy) override;
- QStyleOptionViewItem viewOptions() const Q_DECL_OVERRIDE;
- void paintEvent(QPaintEvent *e) Q_DECL_OVERRIDE;
+ QStyleOptionViewItem viewOptions() const override;
+ void paintEvent(QPaintEvent *e) override;
- void timerEvent(QTimerEvent *event) Q_DECL_OVERRIDE;
+ void timerEvent(QTimerEvent *event) override;
- int horizontalOffset() const Q_DECL_OVERRIDE;
- int verticalOffset() const Q_DECL_OVERRIDE;
- QModelIndex moveCursor(CursorAction cursorAction, Qt::KeyboardModifiers modifiers) Q_DECL_OVERRIDE;
+ int horizontalOffset() const override;
+ int verticalOffset() const override;
+ QModelIndex moveCursor(CursorAction cursorAction, Qt::KeyboardModifiers modifiers) override;
- void setSelection(const QRect &rect, QItemSelectionModel::SelectionFlags command) Q_DECL_OVERRIDE;
- QRegion visualRegionForSelection(const QItemSelection &selection) const Q_DECL_OVERRIDE;
- QModelIndexList selectedIndexes() const Q_DECL_OVERRIDE;
+ void setSelection(const QRect &rect, QItemSelectionModel::SelectionFlags command) override;
+ QRegion visualRegionForSelection(const QItemSelection &selection) const override;
+ QModelIndexList selectedIndexes() const override;
- void updateGeometries() Q_DECL_OVERRIDE;
+ void updateGeometries() override;
- QSize viewportSizeHint() const Q_DECL_OVERRIDE;
+ QSize viewportSizeHint() const override;
- int sizeHintForRow(int row) const Q_DECL_OVERRIDE;
- int sizeHintForColumn(int column) const Q_DECL_OVERRIDE;
+ int sizeHintForRow(int row) const override;
+ int sizeHintForColumn(int column) const override;
- void verticalScrollbarAction(int action) Q_DECL_OVERRIDE;
- void horizontalScrollbarAction(int action) Q_DECL_OVERRIDE;
+ void verticalScrollbarAction(int action) override;
+ void horizontalScrollbarAction(int action) override;
- bool isIndexHidden(const QModelIndex &index) const Q_DECL_OVERRIDE;
+ bool isIndexHidden(const QModelIndex &index) const override;
void selectionChanged(const QItemSelection &selected,
- const QItemSelection &deselected) Q_DECL_OVERRIDE;
+ const QItemSelection &deselected) override;
void currentChanged(const QModelIndex &current,
- const QModelIndex &previous) Q_DECL_OVERRIDE;
+ const QModelIndex &previous) override;
private:
friend class QAccessibleItemView;
diff --git a/src/widgets/itemviews/qtablewidget.cpp b/src/widgets/itemviews/qtablewidget.cpp
index bb1970e3ac..a0c01e2f25 100644
--- a/src/widgets/itemviews/qtablewidget.cpp
+++ b/src/widgets/itemviews/qtablewidget.cpp
@@ -2652,14 +2652,28 @@ QList<QTableWidgetItem*> QTableWidget::items(const QMimeData *data) const
/*!
Returns the QModelIndex associated with the given \a item.
+
+ \note In Qt versions prior to 5.10, this function took a non-\c{const} \a item.
*/
-QModelIndex QTableWidget::indexFromItem(QTableWidgetItem *item) const
+QModelIndex QTableWidget::indexFromItem(const QTableWidgetItem *item) const
{
Q_D(const QTableWidget);
return d->tableModel()->index(item);
}
+#if QT_VERSION < QT_VERSION_CHECK(6, 0, 0)
+/*!
+ \internal
+ \obsolete
+ \overload
+*/
+QModelIndex QTableWidget::indexFromItem(QTableWidgetItem *item) const
+{
+ return indexFromItem(const_cast<const QTableWidgetItem *>(item));
+}
+#endif
+
/*!
Returns a pointer to the QTableWidgetItem associated with the given \a index.
*/
diff --git a/src/widgets/itemviews/qtablewidget.h b/src/widgets/itemviews/qtablewidget.h
index 9c231d5127..7322e3aed7 100644
--- a/src/widgets/itemviews/qtablewidget.h
+++ b/src/widgets/itemviews/qtablewidget.h
@@ -219,8 +219,8 @@ class Q_WIDGETS_EXPORT QTableWidget : public QTableView
friend class QTableModel;
public:
- explicit QTableWidget(QWidget *parent = Q_NULLPTR);
- QTableWidget(int rows, int columns, QWidget *parent = Q_NULLPTR);
+ explicit QTableWidget(QWidget *parent = nullptr);
+ QTableWidget(int rows, int columns, QWidget *parent = nullptr);
~QTableWidget();
void setRowCount(int rows);
@@ -318,7 +318,7 @@ Q_SIGNALS:
void currentCellChanged(int currentRow, int currentColumn, int previousRow, int previousColumn);
protected:
- bool event(QEvent *e) Q_DECL_OVERRIDE;
+ bool event(QEvent *e) override;
virtual QStringList mimeTypes() const;
#if QT_VERSION >= QT_VERSION_CHECK(6,0,0)
virtual QMimeData *mimeData(const QList<QTableWidgetItem *> &items) const;
@@ -335,15 +335,18 @@ protected:
#endif
QList<QTableWidgetItem*> items(const QMimeData *data) const;
- QModelIndex indexFromItem(QTableWidgetItem *item) const;
+ QModelIndex indexFromItem(const QTableWidgetItem *item) const;
+#if QT_VERSION < QT_VERSION_CHECK(6, 0, 0)
+ QModelIndex indexFromItem(QTableWidgetItem *item) const; // ### Qt 6: remove
+#endif
QTableWidgetItem *itemFromIndex(const QModelIndex &index) const;
protected:
#if QT_CONFIG(draganddrop)
- void dropEvent(QDropEvent *event) Q_DECL_OVERRIDE;
+ void dropEvent(QDropEvent *event) override;
#endif
private:
- void setModel(QAbstractItemModel *model) Q_DECL_OVERRIDE;
+ void setModel(QAbstractItemModel *model) override;
Q_DECLARE_PRIVATE(QTableWidget)
Q_DISABLE_COPY(QTableWidget)
@@ -360,7 +363,7 @@ private:
};
inline void QTableWidget::removeCellWidget(int arow, int acolumn)
-{ setCellWidget(arow, acolumn, Q_NULLPTR); }
+{ setCellWidget(arow, acolumn, nullptr); }
inline QTableWidgetItem *QTableWidget::itemAt(int ax, int ay) const
{ return itemAt(QPoint(ax, ay)); }
diff --git a/src/widgets/itemviews/qtreeview.cpp b/src/widgets/itemviews/qtreeview.cpp
index e593d82576..03e0441390 100644
--- a/src/widgets/itemviews/qtreeview.cpp
+++ b/src/widgets/itemviews/qtreeview.cpp
@@ -4003,6 +4003,27 @@ int QTreeView::visualIndex(const QModelIndex &index) const
return d->viewIndex(index);
}
+/*!
+ \reimp
+*/
+
+void QTreeView::verticalScrollbarValueChanged(int value)
+{
+ Q_D(QTreeView);
+ if (!d->viewItems.isEmpty() && value == verticalScrollBar()->maximum()) {
+ QModelIndex ret = d->viewItems.last().index;
+ // Root index will be handled by base class implementation
+ while (ret.isValid()) {
+ if (isExpanded(ret) && d->model->canFetchMore(ret)) {
+ d->model->fetchMore(ret);
+ break;
+ }
+ ret = ret.parent();
+ }
+ }
+ QAbstractItemView::verticalScrollbarValueChanged(value);
+}
+
QT_END_NAMESPACE
#include "moc_qtreeview.cpp"
diff --git a/src/widgets/itemviews/qtreeview.h b/src/widgets/itemviews/qtreeview.h
index c32c127cd1..e7ee55aa2a 100644
--- a/src/widgets/itemviews/qtreeview.h
+++ b/src/widgets/itemviews/qtreeview.h
@@ -68,12 +68,12 @@ class Q_WIDGETS_EXPORT QTreeView : public QAbstractItemView
Q_PROPERTY(bool expandsOnDoubleClick READ expandsOnDoubleClick WRITE setExpandsOnDoubleClick)
public:
- explicit QTreeView(QWidget *parent = Q_NULLPTR);
+ explicit QTreeView(QWidget *parent = nullptr);
~QTreeView();
- void setModel(QAbstractItemModel *model) Q_DECL_OVERRIDE;
- void setRootIndex(const QModelIndex &index) Q_DECL_OVERRIDE;
- void setSelectionModel(QItemSelectionModel *selectionModel) Q_DECL_OVERRIDE;
+ void setModel(QAbstractItemModel *model) override;
+ void setRootIndex(const QModelIndex &index) override;
+ void setSelectionModel(QItemSelectionModel *selectionModel) override;
QHeaderView *header() const;
void setHeader(QHeaderView *header);
@@ -132,21 +132,21 @@ public:
void setTreePosition(int logicalIndex);
int treePosition() const;
- void keyboardSearch(const QString &search) Q_DECL_OVERRIDE;
+ void keyboardSearch(const QString &search) override;
- QRect visualRect(const QModelIndex &index) const Q_DECL_OVERRIDE;
- void scrollTo(const QModelIndex &index, ScrollHint hint = EnsureVisible) Q_DECL_OVERRIDE;
- QModelIndex indexAt(const QPoint &p) const Q_DECL_OVERRIDE;
+ QRect visualRect(const QModelIndex &index) const override;
+ void scrollTo(const QModelIndex &index, ScrollHint hint = EnsureVisible) override;
+ QModelIndex indexAt(const QPoint &p) const override;
QModelIndex indexAbove(const QModelIndex &index) const;
QModelIndex indexBelow(const QModelIndex &index) const;
- void doItemsLayout() Q_DECL_OVERRIDE;
- void reset() Q_DECL_OVERRIDE;
+ void doItemsLayout() override;
+ void reset() override;
void sortByColumn(int column, Qt::SortOrder order);
- void dataChanged(const QModelIndex &topLeft, const QModelIndex &bottomRight, const QVector<int> &roles = QVector<int>()) Q_DECL_OVERRIDE;
- void selectAll() Q_DECL_OVERRIDE;
+ void dataChanged(const QModelIndex &topLeft, const QModelIndex &bottomRight, const QVector<int> &roles = QVector<int>()) override;
+ void selectAll() override;
Q_SIGNALS:
void expanded(const QModelIndex &index);
@@ -169,23 +169,24 @@ protected Q_SLOTS:
void columnMoved();
void reexpand();
void rowsRemoved(const QModelIndex &parent, int first, int last);
+ void verticalScrollbarValueChanged(int value) override;
protected:
- QTreeView(QTreeViewPrivate &dd, QWidget *parent = Q_NULLPTR);
- void scrollContentsBy(int dx, int dy) Q_DECL_OVERRIDE;
- void rowsInserted(const QModelIndex &parent, int start, int end) Q_DECL_OVERRIDE;
- void rowsAboutToBeRemoved(const QModelIndex &parent, int start, int end) Q_DECL_OVERRIDE;
+ QTreeView(QTreeViewPrivate &dd, QWidget *parent = nullptr);
+ void scrollContentsBy(int dx, int dy) override;
+ void rowsInserted(const QModelIndex &parent, int start, int end) override;
+ void rowsAboutToBeRemoved(const QModelIndex &parent, int start, int end) override;
- QModelIndex moveCursor(CursorAction cursorAction, Qt::KeyboardModifiers modifiers) Q_DECL_OVERRIDE;
- int horizontalOffset() const Q_DECL_OVERRIDE;
- int verticalOffset() const Q_DECL_OVERRIDE;
+ QModelIndex moveCursor(CursorAction cursorAction, Qt::KeyboardModifiers modifiers) override;
+ int horizontalOffset() const override;
+ int verticalOffset() const override;
- void setSelection(const QRect &rect, QItemSelectionModel::SelectionFlags command) Q_DECL_OVERRIDE;
- QRegion visualRegionForSelection(const QItemSelection &selection) const Q_DECL_OVERRIDE;
- QModelIndexList selectedIndexes() const Q_DECL_OVERRIDE;
+ void setSelection(const QRect &rect, QItemSelectionModel::SelectionFlags command) override;
+ QRegion visualRegionForSelection(const QItemSelection &selection) const override;
+ QModelIndexList selectedIndexes() const override;
- void timerEvent(QTimerEvent *event) Q_DECL_OVERRIDE;
- void paintEvent(QPaintEvent *event) Q_DECL_OVERRIDE;
+ void timerEvent(QTimerEvent *event) override;
+ void paintEvent(QPaintEvent *event) override;
void drawTree(QPainter *painter, const QRegion &region) const;
virtual void drawRow(QPainter *painter,
@@ -195,30 +196,30 @@ protected:
const QRect &rect,
const QModelIndex &index) const;
- void mousePressEvent(QMouseEvent *event) Q_DECL_OVERRIDE;
- void mouseReleaseEvent(QMouseEvent *event) Q_DECL_OVERRIDE;
- void mouseDoubleClickEvent(QMouseEvent *event) Q_DECL_OVERRIDE;
- void mouseMoveEvent(QMouseEvent *event) Q_DECL_OVERRIDE;
- void keyPressEvent(QKeyEvent *event) Q_DECL_OVERRIDE;
+ void mousePressEvent(QMouseEvent *event) override;
+ void mouseReleaseEvent(QMouseEvent *event) override;
+ void mouseDoubleClickEvent(QMouseEvent *event) override;
+ void mouseMoveEvent(QMouseEvent *event) override;
+ void keyPressEvent(QKeyEvent *event) override;
#ifndef QT_NO_DRAGANDDROP
- void dragMoveEvent(QDragMoveEvent *event) Q_DECL_OVERRIDE;
+ void dragMoveEvent(QDragMoveEvent *event) override;
#endif
- bool viewportEvent(QEvent *event) Q_DECL_OVERRIDE;
+ bool viewportEvent(QEvent *event) override;
- void updateGeometries() Q_DECL_OVERRIDE;
+ void updateGeometries() override;
- QSize viewportSizeHint() const Q_DECL_OVERRIDE;
+ QSize viewportSizeHint() const override;
- int sizeHintForColumn(int column) const Q_DECL_OVERRIDE;
+ int sizeHintForColumn(int column) const override;
int indexRowSizeHint(const QModelIndex &index) const;
int rowHeight(const QModelIndex &index) const;
- void horizontalScrollbarAction(int action) Q_DECL_OVERRIDE;
+ void horizontalScrollbarAction(int action) override;
- bool isIndexHidden(const QModelIndex &index) const Q_DECL_OVERRIDE;
+ bool isIndexHidden(const QModelIndex &index) const override;
void selectionChanged(const QItemSelection &selected,
- const QItemSelection &deselected) Q_DECL_OVERRIDE;
- void currentChanged(const QModelIndex &current, const QModelIndex &previous) Q_DECL_OVERRIDE;
+ const QItemSelection &deselected) override;
+ void currentChanged(const QModelIndex &current, const QModelIndex &previous) override;
private:
friend class ::tst_QTreeView;
diff --git a/src/widgets/itemviews/qtreewidget.cpp b/src/widgets/itemviews/qtreewidget.cpp
index d7b46a0835..e5f73407cd 100644
--- a/src/widgets/itemviews/qtreewidget.cpp
+++ b/src/widgets/itemviews/qtreewidget.cpp
@@ -145,7 +145,7 @@ QTreeModel::QTreeModel(QTreeModelPrivate &dd, QTreeWidget *parent)
QTreeModel::~QTreeModel()
{
clear();
- headerItem->view = Q_NULLPTR;
+ headerItem->view = nullptr;
delete headerItem;
rootItem->view = 0;
delete rootItem;
@@ -2009,6 +2009,9 @@ void QTreeWidgetItem::addChildren(const QList<QTreeWidgetItem*> &children)
*/
void QTreeWidgetItem::insertChildren(int index, const QList<QTreeWidgetItem*> &children)
{
+ if (index < 0 || index > this->children.count() || children.isEmpty())
+ return;
+
if (view && view->isSortingEnabled()) {
for (int n = 0; n < children.count(); ++n)
insertChild(index, children.at(n));
@@ -2726,14 +2729,14 @@ void QTreeWidget::setHeaderItem(QTreeWidgetItem *item)
int oldCount = columnCount();
if (oldCount < item->columnCount())
- d->treeModel()->beginInsertColumns(QModelIndex(), oldCount, item->columnCount());
- else
- d->treeModel()->beginRemoveColumns(QModelIndex(), item->columnCount(), oldCount);
+ d->treeModel()->beginInsertColumns(QModelIndex(), oldCount, item->columnCount() - 1);
+ else if (oldCount > item->columnCount())
+ d->treeModel()->beginRemoveColumns(QModelIndex(), item->columnCount(), oldCount - 1);
delete d->treeModel()->headerItem;
d->treeModel()->headerItem = item;
if (oldCount < item->columnCount())
d->treeModel()->endInsertColumns();
- else
+ else if (oldCount > item->columnCount())
d->treeModel()->endRemoveColumns();
d->treeModel()->headerDataChanged(Qt::Horizontal, 0, oldCount);
}
@@ -3366,6 +3369,7 @@ QModelIndex QTreeWidget::indexFromItem(const QTreeWidgetItem *item, int column)
return d->index(item, column);
}
+#if QT_VERSION < QT_VERSION_CHECK(6, 0, 0)
/*!
\overload
\internal
@@ -3374,6 +3378,7 @@ QModelIndex QTreeWidget::indexFromItem(QTreeWidgetItem *item, int column) const
{
return indexFromItem(const_cast<const QTreeWidgetItem *>(item), column);
}
+#endif
/*!
Returns a pointer to the QTreeWidgetItem associated with the given \a index.
diff --git a/src/widgets/itemviews/qtreewidget.h b/src/widgets/itemviews/qtreewidget.h
index 783627cde9..a31af0428a 100644
--- a/src/widgets/itemviews/qtreewidget.h
+++ b/src/widgets/itemviews/qtreewidget.h
@@ -178,7 +178,7 @@ public:
inline QTreeWidgetItem *parent() const { return par; }
inline QTreeWidgetItem *child(int index) const {
if (index < 0 || index >= children.size())
- return Q_NULLPTR;
+ return nullptr;
executePendingSort();
return children.at(index);
}
@@ -261,7 +261,7 @@ class Q_WIDGETS_EXPORT QTreeWidget : public QTreeView
friend class QTreeModel;
friend class QTreeWidgetItem;
public:
- explicit QTreeWidget(QWidget *parent = Q_NULLPTR);
+ explicit QTreeWidget(QWidget *parent = nullptr);
~QTreeWidget();
int columnCount() const;
@@ -324,7 +324,7 @@ public:
QTreeWidgetItem *itemAbove(const QTreeWidgetItem *item) const;
QTreeWidgetItem *itemBelow(const QTreeWidgetItem *item) const;
- void setSelectionModel(QItemSelectionModel *selectionModel) Q_DECL_OVERRIDE;
+ void setSelectionModel(QItemSelectionModel *selectionModel) override;
public Q_SLOTS:
void scrollToItem(const QTreeWidgetItem *item,
@@ -346,7 +346,7 @@ Q_SIGNALS:
void itemSelectionChanged();
protected:
- bool event(QEvent *e) Q_DECL_OVERRIDE;
+ bool event(QEvent *e) override;
virtual QStringList mimeTypes() const;
#if QT_VERSION >= QT_VERSION_CHECK(6,0,0)
virtual QMimeData *mimeData(const QList<QTreeWidgetItem *> &items) const;
@@ -365,15 +365,17 @@ protected:
QList<QTreeWidgetItem*> items(const QMimeData *data) const;
QModelIndex indexFromItem(const QTreeWidgetItem *item, int column = 0) const;
+#if QT_VERSION < QT_VERSION_CHECK(6, 0, 0)
QModelIndex indexFromItem(QTreeWidgetItem *item, int column = 0) const; // ### Qt 6: remove
+#endif
QTreeWidgetItem *itemFromIndex(const QModelIndex &index) const;
protected:
#if QT_CONFIG(draganddrop)
- void dropEvent(QDropEvent *event) Q_DECL_OVERRIDE;
+ void dropEvent(QDropEvent *event) override;
#endif
private:
- void setModel(QAbstractItemModel *model) Q_DECL_OVERRIDE;
+ void setModel(QAbstractItemModel *model) override;
Q_DECLARE_PRIVATE(QTreeWidget)
Q_DISABLE_COPY(QTreeWidget)
@@ -393,7 +395,7 @@ private:
};
inline void QTreeWidget::removeItemWidget(QTreeWidgetItem *item, int column)
-{ setItemWidget(item, column, Q_NULLPTR); }
+{ setItemWidget(item, column, nullptr); }
inline QTreeWidgetItem *QTreeWidget::itemAt(int ax, int ay) const
{ return itemAt(QPoint(ax, ay)); }
diff --git a/src/widgets/itemviews/qtreewidget_p.h b/src/widgets/itemviews/qtreewidget_p.h
index 7aa4daefc0..f4625842ef 100644
--- a/src/widgets/itemviews/qtreewidget_p.h
+++ b/src/widgets/itemviews/qtreewidget_p.h
@@ -91,24 +91,24 @@ public:
void itemChanged(QTreeWidgetItem *item);
QModelIndex index(const QTreeWidgetItem *item, int column) const;
- QModelIndex index(int row, int column, const QModelIndex &parent) const Q_DECL_OVERRIDE;
- QModelIndex parent(const QModelIndex &child) const Q_DECL_OVERRIDE;
- int rowCount(const QModelIndex &parent) const Q_DECL_OVERRIDE;
- int columnCount(const QModelIndex &parent = QModelIndex()) const Q_DECL_OVERRIDE;
- bool hasChildren(const QModelIndex &parent) const Q_DECL_OVERRIDE;
+ QModelIndex index(int row, int column, const QModelIndex &parent) const override;
+ QModelIndex parent(const QModelIndex &child) const override;
+ int rowCount(const QModelIndex &parent) const override;
+ int columnCount(const QModelIndex &parent = QModelIndex()) const override;
+ bool hasChildren(const QModelIndex &parent) const override;
- QVariant data(const QModelIndex &index, int role = Qt::DisplayRole) const Q_DECL_OVERRIDE;
- bool setData(const QModelIndex &index, const QVariant &value, int role) Q_DECL_OVERRIDE;
+ QVariant data(const QModelIndex &index, int role = Qt::DisplayRole) const override;
+ bool setData(const QModelIndex &index, const QVariant &value, int role) override;
- QMap<int, QVariant> itemData(const QModelIndex &index) const Q_DECL_OVERRIDE;
+ QMap<int, QVariant> itemData(const QModelIndex &index) const override;
- QVariant headerData(int section, Qt::Orientation orientation, int role) const Q_DECL_OVERRIDE;
+ QVariant headerData(int section, Qt::Orientation orientation, int role) const override;
bool setHeaderData(int section, Qt::Orientation orientation, const QVariant &value,
- int role) Q_DECL_OVERRIDE;
+ int role) override;
- Qt::ItemFlags flags(const QModelIndex &index) const Q_DECL_OVERRIDE;
+ Qt::ItemFlags flags(const QModelIndex &index) const override;
- void sort(int column, Qt::SortOrder order) Q_DECL_OVERRIDE;
+ void sort(int column, Qt::SortOrder order) override;
void ensureSorted(int column, Qt::SortOrder order,
int start, int end, const QModelIndex &parent);
static bool itemLessThan(const QPair<QTreeWidgetItem*,int> &left,
@@ -120,17 +120,17 @@ public:
const QList<QTreeWidgetItem*>::iterator &end,
Qt::SortOrder order, QTreeWidgetItem *item);
- bool insertRows(int row, int count, const QModelIndex &) Q_DECL_OVERRIDE;
- bool insertColumns(int column, int count, const QModelIndex &) Q_DECL_OVERRIDE;
+ bool insertRows(int row, int count, const QModelIndex &) override;
+ bool insertColumns(int column, int count, const QModelIndex &) override;
- bool removeRows(int row, int count, const QModelIndex &parent = QModelIndex()) Q_DECL_OVERRIDE;
+ bool removeRows(int row, int count, const QModelIndex &parent = QModelIndex()) override;
// dnd
- QStringList mimeTypes() const Q_DECL_OVERRIDE;
- QMimeData *mimeData(const QModelIndexList &indexes) const Q_DECL_OVERRIDE;
+ QStringList mimeTypes() const override;
+ QMimeData *mimeData(const QModelIndexList &indexes) const override;
bool dropMimeData(const QMimeData *data, Qt::DropAction action,
- int row, int column, const QModelIndex &parent) Q_DECL_OVERRIDE;
- Qt::DropActions supportedDropActions() const Q_DECL_OVERRIDE;
+ int row, int column, const QModelIndex &parent) override;
+ Qt::DropActions supportedDropActions() const override;
QMimeData *internalMimeData() const;
@@ -145,7 +145,7 @@ protected:
void beginRemoveItems(QTreeWidgetItem *parent, int row, int count);
void endRemoveItems();
void sortItems(QList<QTreeWidgetItem*> *items, int column, Qt::SortOrder order);
- void timerEvent(QTimerEvent *) Q_DECL_OVERRIDE;
+ void timerEvent(QTimerEvent *) override;
private:
QTreeWidgetItem *rootItem;
diff --git a/src/widgets/kernel/mac.pri b/src/widgets/kernel/mac.pri
index 8c694c5e05..f7e7aa869a 100644
--- a/src/widgets/kernel/mac.pri
+++ b/src/widgets/kernel/mac.pri
@@ -1,4 +1,4 @@
-!x11:osx {
+macos {
LIBS_PRIVATE += -framework AppKit -lz
*-mwerks:INCLUDEPATH += compat
}
diff --git a/src/widgets/kernel/qaction.h b/src/widgets/kernel/qaction.h
index e1d431100e..84bf92d2ac 100644
--- a/src/widgets/kernel/qaction.h
+++ b/src/widgets/kernel/qaction.h
@@ -161,7 +161,7 @@ public:
enum ActionEvent { Trigger, Hover };
void activate(ActionEvent event);
- bool showStatusText(QWidget *widget = Q_NULLPTR);
+ bool showStatusText(QWidget *widget = nullptr);
void setMenuRole(MenuRole menuRole);
MenuRole menuRole() const;
@@ -180,7 +180,7 @@ public:
#endif
protected:
- bool event(QEvent *) Q_DECL_OVERRIDE;
+ bool event(QEvent *) override;
QAction(QActionPrivate &dd, QObject *parent);
public Q_SLOTS:
diff --git a/src/widgets/kernel/qapplication.cpp b/src/widgets/kernel/qapplication.cpp
index 943aeaa2d9..e336c5f06d 100644
--- a/src/widgets/kernel/qapplication.cpp
+++ b/src/widgets/kernel/qapplication.cpp
@@ -152,20 +152,6 @@ static void clearSystemPalette()
QApplicationPrivate::sys_pal = 0;
}
-static QByteArray get_style_class_name()
-{
- QScopedPointer<QStyle> s(QStyleFactory::create(QApplicationPrivate::desktopStyleKey()));
- if (!s.isNull())
- return s->metaObject()->className();
- return QByteArray();
-}
-
-static QByteArray nativeStyleClassName()
-{
- static QByteArray name = get_style_class_name();
- return name;
-}
-
bool QApplicationPrivate::autoSipEnabled = true;
QApplicationPrivate::QApplicationPrivate(int &argc, char **argv, int flags)
@@ -395,8 +381,6 @@ void qt_init_tooltip_palette();
void qt_cleanup();
QStyle *QApplicationPrivate::app_style = 0; // default application style
-bool QApplicationPrivate::overrides_native_style = false; // whether native QApplication style is
- // overridden, i.e. not native
#ifndef QT_NO_STYLE_STYLESHEET
QString QApplicationPrivate::styleSheet; // default application stylesheet
#endif
@@ -1091,8 +1075,6 @@ QStyle *QApplication::style()
Q_ASSERT(!"No styles available!");
return 0;
}
- QApplicationPrivate::overrides_native_style =
- app_style->objectName() != QApplicationPrivate::desktopStyleKey();
}
// take ownership of the style
QApplicationPrivate::app_style->setParent(qApp);
@@ -1157,9 +1139,6 @@ void QApplication::setStyle(QStyle *style)
QStyle *old = QApplicationPrivate::app_style; // save
- QApplicationPrivate::overrides_native_style =
- nativeStyleClassName() == QByteArray(style->metaObject()->className());
-
#ifndef QT_NO_STYLE_STYLESHEET
if (!QApplicationPrivate::styleSheet.isEmpty() && !qobject_cast<QStyleSheetStyle *>(style)) {
// we have a stylesheet already and a new style is being set
@@ -2804,7 +2783,7 @@ void QApplicationPrivate::sendSyntheticEnterLeave(QWidget *widget)
*/
QDesktopWidget *QApplication::desktop()
{
- CHECK_QAPP_INSTANCE(Q_NULLPTR)
+ CHECK_QAPP_INSTANCE(nullptr)
if (!qt_desktopWidget || // not created yet
!(qt_desktopWidget->windowType() == Qt::Desktop)) { // reparented away
qt_desktopWidget = new QDesktopWidget();
@@ -3284,7 +3263,7 @@ bool QApplication::notify(QObject *receiver, QEvent *e)
// sequence, so we reset wheel_widget in case no one accepts the event
// or if we didn't get (or missed) a ScrollEnd previously.
if (spontaneous && phase == Qt::ScrollBegin)
- QApplicationPrivate::wheel_widget = Q_NULLPTR;
+ QApplicationPrivate::wheel_widget = nullptr;
const QPoint &relpos = wheel->pos();
@@ -3334,7 +3313,7 @@ bool QApplication::notify(QObject *receiver, QEvent *e)
d->notify_helper(QApplicationPrivate::wheel_widget, &we);
wheel->setAccepted(we.isAccepted());
if (phase == Qt::ScrollEnd)
- QApplicationPrivate::wheel_widget = Q_NULLPTR;
+ QApplicationPrivate::wheel_widget = nullptr;
}
}
break;
diff --git a/src/widgets/kernel/qapplication.h b/src/widgets/kernel/qapplication.h
index 396d0c9474..7a5d7ba1a9 100644
--- a/src/widgets/kernel/qapplication.h
+++ b/src/widgets/kernel/qapplication.h
@@ -110,11 +110,11 @@ public:
using QGuiApplication::palette;
static QPalette palette(const QWidget *);
static QPalette palette(const char *className);
- static void setPalette(const QPalette &, const char* className = Q_NULLPTR);
+ static void setPalette(const QPalette &, const char* className = nullptr);
static QFont font();
static QFont font(const QWidget*);
static QFont font(const char *className);
- static void setFont(const QFont &, const char* className = Q_NULLPTR);
+ static void setFont(const QFont &, const char* className = nullptr);
static QFontMetrics fontMetrics();
#if QT_VERSION < 0x060000 // remove these forwarders in Qt 6
@@ -177,7 +177,7 @@ public:
#endif
static int exec();
- bool notify(QObject *, QEvent *) Q_DECL_OVERRIDE;
+ bool notify(QObject *, QEvent *) override;
#ifdef QT_KEYPAD_NAVIGATION
static Q_DECL_DEPRECATED void setKeypadNavigationEnabled(bool);
@@ -201,8 +201,8 @@ public Q_SLOTS:
static void aboutQt();
protected:
- bool event(QEvent *) Q_DECL_OVERRIDE;
- bool compressEvent(QEvent *, QObject *receiver, QPostEventList *) Q_DECL_OVERRIDE;
+ bool event(QEvent *) override;
+ bool compressEvent(QEvent *, QObject *receiver, QPostEventList *) override;
private:
Q_DISABLE_COPY(QApplication)
diff --git a/src/widgets/kernel/qapplication_p.h b/src/widgets/kernel/qapplication_p.h
index 5dca2e85f1..9983cc7d9e 100644
--- a/src/widgets/kernel/qapplication_p.h
+++ b/src/widgets/kernel/qapplication_p.h
@@ -106,11 +106,11 @@ public:
QApplicationPrivate(int &argc, char **argv, int flags);
~QApplicationPrivate();
- virtual void notifyLayoutDirectionChange() Q_DECL_OVERRIDE;
- virtual void notifyActiveWindowChange(QWindow *) Q_DECL_OVERRIDE;
+ virtual void notifyLayoutDirectionChange() override;
+ virtual void notifyActiveWindowChange(QWindow *) override;
- virtual bool shouldQuit() Q_DECL_OVERRIDE;
- bool tryCloseAllWindows() Q_DECL_OVERRIDE;
+ virtual bool shouldQuit() override;
+ bool tryCloseAllWindows() override;
#if 0 // Used to be included in Qt4 for Q_WS_X11
#ifndef QT_NO_SETTINGS
@@ -122,13 +122,13 @@ public:
static QString desktopStyleKey();
- void createEventDispatcher() Q_DECL_OVERRIDE;
+ void createEventDispatcher() override;
static void dispatchEnterLeave(QWidget *enter, QWidget *leave, const QPointF &globalPosF);
- void notifyWindowIconChanged() Q_DECL_OVERRIDE;
+ void notifyWindowIconChanged() override;
//modality
- bool isWindowBlocked(QWindow *window, QWindow **blockingWindow = 0) const Q_DECL_OVERRIDE;
+ bool isWindowBlocked(QWindow *window, QWindow **blockingWindow = 0) const override;
static bool isBlockedByModal(QWidget *widget);
static bool modalState();
static bool tryModalHelper(QWidget *widget, QWidget **rettop = 0);
@@ -137,12 +137,6 @@ public:
bool canQuit();
#endif
- //style
- static bool usesNativeStyle()
- {
- return !overrides_native_style;
- }
-
bool notify_helper(QObject *receiver, QEvent * e);
void init(
@@ -158,7 +152,7 @@ public:
#endif
static bool inPopupMode();
- bool popupActive() Q_DECL_OVERRIDE { return inPopupMode(); }
+ bool popupActive() override { return inPopupMode(); }
void closePopup(QWidget *popup);
void openPopup(QWidget *popup);
static void setFocusWidget(QWidget *focus, Qt::FocusReason reason);
@@ -178,14 +172,13 @@ public:
static QSize app_strut;
static QWidgetList *popupWidgets;
static QStyle *app_style;
- static bool overrides_native_style;
static QPalette *sys_pal;
static QPalette *set_pal;
protected:
- void notifyThemeChanged() Q_DECL_OVERRIDE;
+ void notifyThemeChanged() override;
#ifndef QT_NO_DRAGANDDROP
- void notifyDragStarted(const QDrag *) Q_DECL_OVERRIDE;
+ void notifyDragStarted(const QDrag *) override;
#endif // QT_NO_DRAGANDDROP
public:
@@ -284,7 +277,7 @@ public:
ulong timestamp);
static void translateTouchCancel(QTouchDevice *device, ulong timestamp);
- QPixmap applyQIconStyleHelper(QIcon::Mode mode, const QPixmap& base) const Q_DECL_OVERRIDE;
+ QPixmap applyQIconStyleHelper(QIcon::Mode mode, const QPixmap& base) const override;
private:
static QApplicationPrivate *self;
static bool tryCloseAllWidgetWindows(QWindowList *processedWindows);
diff --git a/src/widgets/kernel/qboxlayout.cpp b/src/widgets/kernel/qboxlayout.cpp
index 588cec2b95..a368f379ad 100644
--- a/src/widgets/kernel/qboxlayout.cpp
+++ b/src/widgets/kernel/qboxlayout.cpp
@@ -124,7 +124,7 @@ public:
void calcHfw(int);
void effectiveMargins(int *left, int *top, int *right, int *bottom) const;
- QLayoutItem* replaceAt(int index, QLayoutItem*) Q_DECL_OVERRIDE;
+ QLayoutItem* replaceAt(int index, QLayoutItem*) override;
};
QBoxLayoutPrivate::~QBoxLayoutPrivate()
diff --git a/src/widgets/kernel/qboxlayout.h b/src/widgets/kernel/qboxlayout.h
index 9c7d0e593f..6bb8f8aafa 100644
--- a/src/widgets/kernel/qboxlayout.h
+++ b/src/widgets/kernel/qboxlayout.h
@@ -61,7 +61,7 @@ public:
enum Direction { LeftToRight, RightToLeft, TopToBottom, BottomToTop,
Down = TopToBottom, Up = BottomToTop };
- explicit QBoxLayout(Direction, QWidget *parent = Q_NULLPTR);
+ explicit QBoxLayout(Direction, QWidget *parent = nullptr);
~QBoxLayout();
@@ -74,7 +74,7 @@ public:
void addWidget(QWidget *, int stretch = 0, Qt::Alignment alignment = Qt::Alignment());
void addLayout(QLayout *layout, int stretch = 0);
void addStrut(int);
- void addItem(QLayoutItem *) Q_DECL_OVERRIDE;
+ void addItem(QLayoutItem *) override;
void insertSpacing(int index, int size);
void insertStretch(int index, int stretch = 0);
@@ -91,20 +91,20 @@ public:
void setStretch(int index, int stretch);
int stretch(int index) const;
- QSize sizeHint() const Q_DECL_OVERRIDE;
- QSize minimumSize() const Q_DECL_OVERRIDE;
- QSize maximumSize() const Q_DECL_OVERRIDE;
+ QSize sizeHint() const override;
+ QSize minimumSize() const override;
+ QSize maximumSize() const override;
- bool hasHeightForWidth() const Q_DECL_OVERRIDE;
- int heightForWidth(int) const Q_DECL_OVERRIDE;
- int minimumHeightForWidth(int) const Q_DECL_OVERRIDE;
+ bool hasHeightForWidth() const override;
+ int heightForWidth(int) const override;
+ int minimumHeightForWidth(int) const override;
- Qt::Orientations expandingDirections() const Q_DECL_OVERRIDE;
- void invalidate() Q_DECL_OVERRIDE;
- QLayoutItem *itemAt(int) const Q_DECL_OVERRIDE;
- QLayoutItem *takeAt(int) Q_DECL_OVERRIDE;
- int count() const Q_DECL_OVERRIDE;
- void setGeometry(const QRect&) Q_DECL_OVERRIDE;
+ Qt::Orientations expandingDirections() const override;
+ void invalidate() override;
+ QLayoutItem *itemAt(int) const override;
+ QLayoutItem *takeAt(int) override;
+ int count() const override;
+ void setGeometry(const QRect&) override;
private:
Q_DISABLE_COPY(QBoxLayout)
diff --git a/src/widgets/kernel/qdesktopwidget.cpp b/src/widgets/kernel/qdesktopwidget.cpp
index 1b9cf88efe..5fb7882932 100644
--- a/src/widgets/kernel/qdesktopwidget.cpp
+++ b/src/widgets/kernel/qdesktopwidget.cpp
@@ -50,7 +50,7 @@
QT_BEGIN_NAMESPACE
QDesktopScreenWidget::QDesktopScreenWidget(QScreen *screen, const QRect &geometry)
- : QWidget(Q_NULLPTR, Qt::Desktop), m_screen(screen)
+ : QWidget(nullptr, Qt::Desktop), m_screen(screen)
{
setVisible(false);
if (QWindow *winHandle = windowHandle())
@@ -114,7 +114,7 @@ QDesktopScreenWidget *QDesktopWidgetPrivate::widgetForScreen(QScreen *qScreen) c
if (widget->screen() == qScreen)
return widget;
}
- return Q_NULLPTR;
+ return nullptr;
}
void QDesktopWidgetPrivate::_q_updateScreens()
@@ -176,17 +176,26 @@ void QDesktopWidgetPrivate::_q_updateScreens()
// Notice that we trigger screenCountChanged even if a screen was removed and another one added,
// in which case the total number of screens did not change. This is the only way for applications
// to notice that a screen was swapped out against another one.
+QT_WARNING_PUSH
+QT_WARNING_DISABLE_DEPRECATED
emit q->screenCountChanged(targetLength);
+QT_WARNING_POP
}
foreach (int changedScreen, changedScreens)
+QT_WARNING_PUSH
+QT_WARNING_DISABLE_DEPRECATED
emit q->resized(changedScreen);
+QT_WARNING_POP
}
void QDesktopWidgetPrivate::_q_availableGeometryChanged()
{
Q_Q(QDesktopWidget);
if (QScreen *screen = qobject_cast<QScreen *>(q->sender()))
+QT_WARNING_PUSH
+QT_WARNING_DISABLE_DEPRECATED
emit q->workAreaResized(QGuiApplication::screens().indexOf(screen));
+QT_WARNING_POP
}
QDesktopWidget::QDesktopWidget()
@@ -268,13 +277,8 @@ const QRect QDesktopWidget::availableGeometry(int screenNo) const
const QRect QDesktopWidgetPrivate::availableGeometry(int screenNo)
{
- QList<QScreen *> screens = QGuiApplication::screens();
- if (screenNo == -1)
- screenNo = 0;
- if (screenNo < 0 || screenNo >= screens.size())
- return QRect();
- else
- return screens.at(screenNo)->availableGeometry();
+ const QScreen *screen = QDesktopWidgetPrivate::screen(screenNo);
+ return screen ? screen->availableGeometry() : QRect();
}
const QRect QDesktopWidget::screenGeometry(int screenNo) const
@@ -284,13 +288,8 @@ const QRect QDesktopWidget::screenGeometry(int screenNo) const
const QRect QDesktopWidgetPrivate::screenGeometry(int screenNo)
{
- QList<QScreen *> screens = QGuiApplication::screens();
- if (screenNo == -1)
- screenNo = 0;
- if (screenNo < 0 || screenNo >= screens.size())
- return QRect();
- else
- return screens.at(screenNo)->geometry();
+ const QScreen *screen = QDesktopWidgetPrivate::screen(screenNo);
+ return screen ? screen->geometry() : QRect();
}
int QDesktopWidget::screenNumber(const QWidget *w) const
@@ -330,7 +329,7 @@ int QDesktopWidgetPrivate::screenNumber(const QWidget *w)
if (!w->isWindow())
frame.moveTopLeft(w->mapToGlobal(QPoint(0, 0)));
- QScreen *widgetScreen = Q_NULLPTR;
+ QScreen *widgetScreen = nullptr;
int largestArea = 0;
foreach (QScreen *screen, screens) {
const QRect deviceIndependentScreenGeometry =
@@ -356,6 +355,16 @@ int QDesktopWidgetPrivate::screenNumber(const QPoint &p)
return screen ? QGuiApplication::screens().indexOf(screen) : primaryScreen();
}
+QScreen *QDesktopWidgetPrivate::screen(int screenNo)
+{
+ QList<QScreen *> screens = QGuiApplication::screens();
+ if (screenNo == -1)
+ screenNo = 0;
+ if (screenNo < 0 || screenNo >= screens.size())
+ return nullptr;
+ return screens.at(screenNo);
+}
+
void QDesktopWidget::resizeEvent(QResizeEvent *)
{
}
diff --git a/src/widgets/kernel/qdesktopwidget.h b/src/widgets/kernel/qdesktopwidget.h
index 64e1c568eb..f53d0fe9bb 100644
--- a/src/widgets/kernel/qdesktopwidget.h
+++ b/src/widgets/kernel/qdesktopwidget.h
@@ -59,35 +59,48 @@ public:
QDesktopWidget();
~QDesktopWidget();
- bool isVirtualDesktop() const;
+ int screenNumber(const QWidget *widget = nullptr) const;
+ const QRect screenGeometry(const QWidget *widget) const;
+ const QRect availableGeometry(const QWidget *widget) const;
- int numScreens() const;
- int screenCount() const;
- int primaryScreen() const;
+#if QT_DEPRECATED_SINCE(5, 11)
+ QT_DEPRECATED_X("Use QScreen::virtualSiblings() of primary screen") bool isVirtualDesktop() const;
- int screenNumber(const QWidget *widget = Q_NULLPTR) const;
- int screenNumber(const QPoint &) const;
+ QT_DEPRECATED_X("Use QGuiApplication::screens()") int numScreens() const;
+ QT_DEPRECATED_X("Use QGuiApplication::screens()") int screenCount() const;
+ QT_DEPRECATED_X("Use QGuiApplication::primaryScreen()") int primaryScreen() const;
- QWidget *screen(int screen = -1);
+ QT_DEPRECATED_X("Use QGuiApplication::screenAt()") int screenNumber(const QPoint &) const;
- const QRect screenGeometry(int screen = -1) const;
- const QRect screenGeometry(const QWidget *widget) const;
- const QRect screenGeometry(const QPoint &point) const
- { return screenGeometry(screenNumber(point)); }
+ QT_DEPRECATED_X("Use QScreen") QWidget *screen(int screen = -1);
- const QRect availableGeometry(int screen = -1) const;
- const QRect availableGeometry(const QWidget *widget) const;
- const QRect availableGeometry(const QPoint &point) const
- { return availableGeometry(screenNumber(point)); }
+ QT_DEPRECATED_X("Use QGuiApplication::screens()") const QRect screenGeometry(int screen = -1) const;
+ QT_DEPRECATED_X("Use QGuiApplication::screenAt()") const QRect screenGeometry(const QPoint &point) const
+ {
+QT_WARNING_PUSH
+QT_WARNING_DISABLE_DEPRECATED
+ return screenGeometry(screenNumber(point));
+QT_WARNING_POP
+ }
+
+ QT_DEPRECATED_X("Use QGuiApplication::screens()") const QRect availableGeometry(int screen = -1) const;
+ QT_DEPRECATED_X("Use QGuiApplication::screenAt()") const QRect availableGeometry(const QPoint &point) const
+ {
+QT_WARNING_PUSH
+QT_WARNING_DISABLE_DEPRECATED
+ return availableGeometry(screenNumber(point));
+QT_WARNING_POP
+ }
Q_SIGNALS:
- void resized(int);
- void workAreaResized(int);
- void screenCountChanged(int);
- void primaryScreenChanged();
+ QT_DEPRECATED_X("Use QScreen::geometryChanged()") void resized(int);
+ QT_DEPRECATED_X("Use QScreen::availableGeometryChanged()") void workAreaResized(int);
+ QT_DEPRECATED_X("Use QGuiApplication::screenAdded/Removed()") void screenCountChanged(int);
+ QT_DEPRECATED_X("Use QGuiApplication::primaryScreenChanged()") void primaryScreenChanged();
+#endif
protected:
- void resizeEvent(QResizeEvent *e) Q_DECL_OVERRIDE;
+ void resizeEvent(QResizeEvent *e) override;
private:
Q_DISABLE_COPY(QDesktopWidget)
@@ -100,7 +113,12 @@ private:
};
inline int QDesktopWidget::screenCount() const
-{ return numScreens(); }
+{
+QT_WARNING_PUSH
+QT_WARNING_DISABLE_DEPRECATED
+ return numScreens();
+QT_WARNING_POP
+}
QT_END_NAMESPACE
diff --git a/src/widgets/kernel/qdesktopwidget.qdoc b/src/widgets/kernel/qdesktopwidget.qdoc
index fdf6a27597..dd2d9535ae 100644
--- a/src/widgets/kernel/qdesktopwidget.qdoc
+++ b/src/widgets/kernel/qdesktopwidget.qdoc
@@ -32,6 +32,7 @@
\ingroup advanced
\ingroup desktop
\inmodule QtWidgets
+ \obsolete
Systems with more than one graphics card and monitor can manage the
physical screen space available either as multiple desktops, or as a
@@ -125,7 +126,7 @@
\obsolete
- This function is deprecated. Use screenCount instead.
+ Use QGuiApplication::screens() instead.
\sa primaryScreen
*/
@@ -140,6 +141,10 @@
have the geometry of the entire virtual desktop; i.e., bounding
every \a screen.
+ \obsolete
+
+ Use QScreen instead.
+
\sa primaryScreen, screenCount, virtualDesktop
*/
@@ -152,6 +157,10 @@
on \macos, or the task bar on Windows). The default screen is used if
\a screen is -1.
+ \obsolete
+
+ Use QGuiApplication::screens() instead.
+
\sa screenNumber(), screenGeometry(), QScreen::availableGeometry()
*/
@@ -170,6 +179,10 @@
Returns the available geometry of the screen which contains \a p.
+ \obsolete
+
+ Use QGuiApplication::screenAt() instead.
+
\sa screenGeometry()
*/
@@ -180,6 +193,10 @@
Returns the geometry of the screen with index \a screen. The default
screen is used if \a screen is -1.
+ \obsolete
+
+ Use QGuiApplication::screens() instead.
+
\sa screenNumber()
*/
@@ -195,6 +212,10 @@
\overload
Returns the geometry of the screen which contains \a p.
+
+ \obsolete
+
+ Use QGuiApplication::screenAt() instead.
*/
@@ -214,30 +235,47 @@
Returns the index of the screen that contains the \a point, or the
screen which is the shortest distance from the \a point.
+ \obsolete
+
+ Use QGuiApplication::screenAt() instead.
+
\sa primaryScreen
*/
/*!
\fn void QDesktopWidget::resizeEvent(QResizeEvent *event)
\reimp
+ \internal
*/
/*!
\fn void QDesktopWidget::resized(int screen)
This signal is emitted when the size of \a screen changes.
+
+ \obsolete
+
+ Use QScreen::geometryChanged() instead.
*/
/*!
\fn void QDesktopWidget::workAreaResized(int screen)
This signal is emitted when the work area available on \a screen changes.
+
+ \obsolete
+
+ Use QScreen::availableGeometryChanged() instead.
*/
/*!
\property QDesktopWidget::screenCount
\brief the number of screens currently available on the system.
+ \obsolete
+
+ Use QGuiApplication::screens() instead.
+
\since 4.6
*/
@@ -245,6 +283,10 @@
\property QDesktopWidget::primaryScreen
\brief the index of the screen that is configured to be the primary screen
on the system.
+
+ \obsolete
+
+ Use QGuiApplication::primaryScreen() instead.
*/
/*!
@@ -255,6 +297,10 @@
For virtual desktops, screen() will always return the same widget.
The size of the virtual desktop is the size of this desktop
widget.
+
+ \obsolete
+
+ Use QScreen::virtualSiblings() of primary screen instead.
*/
/*!
@@ -264,6 +310,10 @@
This signal is emitted when the number of screens changes to \a newCount.
+ \obsolete
+
+ Use QGuiApplication::screenAdded and QGuiApplication::screenRemoved() instead.
+
\sa screenCount
*/
@@ -278,5 +328,9 @@
\note This doesn't mean the QDesktopWidget::primaryScreen index will
necessarily be different, but now it will refer to the new primary screen.
+ \obsolete
+
+ Use QGuiApplication::primaryScreenChanged() instead.
+
\sa primaryScreen, screenGeometry()
*/
diff --git a/src/widgets/kernel/qdesktopwidget_p.h b/src/widgets/kernel/qdesktopwidget_p.h
index 7a66661771..69f87337b3 100644
--- a/src/widgets/kernel/qdesktopwidget_p.h
+++ b/src/widgets/kernel/qdesktopwidget_p.h
@@ -100,6 +100,8 @@ public:
static int screenNumber(const QWidget *widget = nullptr);
static int screenNumber(const QPoint &);
+ static QScreen *screen(int screenNo = -1);
+
static const QRect screenGeometry(int screen = -1);
static const QRect screenGeometry(const QWidget *widget);
static const QRect screenGeometry(const QPoint &point)
diff --git a/src/widgets/kernel/qformlayout.cpp b/src/widgets/kernel/qformlayout.cpp
index 868ac17b6f..8a5b863bb5 100644
--- a/src/widgets/kernel/qformlayout.cpp
+++ b/src/widgets/kernel/qformlayout.cpp
@@ -224,7 +224,7 @@ public:
int hSpacing;
int vSpacing;
- QLayoutItem* replaceAt(int index, QLayoutItem*) Q_DECL_OVERRIDE;
+ QLayoutItem* replaceAt(int index, QLayoutItem*) override;
};
QFormLayoutPrivate::QFormLayoutPrivate()
diff --git a/src/widgets/kernel/qformlayout.h b/src/widgets/kernel/qformlayout.h
index 5ec27433d3..40424f2a49 100644
--- a/src/widgets/kernel/qformlayout.h
+++ b/src/widgets/kernel/qformlayout.h
@@ -88,7 +88,7 @@ public:
QLayoutItem *fieldItem;
};
- explicit QFormLayout(QWidget *parent = Q_NULLPTR);
+ explicit QFormLayout(QWidget *parent = nullptr);
~QFormLayout();
void setFieldGrowthPolicy(FieldGrowthPolicy policy);
@@ -142,19 +142,19 @@ public:
QWidget *labelForField(QLayout *field) const;
// reimplemented from QLayout
- void addItem(QLayoutItem *item) Q_DECL_OVERRIDE;
- QLayoutItem *itemAt(int index) const Q_DECL_OVERRIDE;
- QLayoutItem *takeAt(int index) Q_DECL_OVERRIDE;
-
- void setGeometry(const QRect &rect) Q_DECL_OVERRIDE;
- QSize minimumSize() const Q_DECL_OVERRIDE;
- QSize sizeHint() const Q_DECL_OVERRIDE;
- void invalidate() Q_DECL_OVERRIDE;
-
- bool hasHeightForWidth() const Q_DECL_OVERRIDE;
- int heightForWidth(int width) const Q_DECL_OVERRIDE;
- Qt::Orientations expandingDirections() const Q_DECL_OVERRIDE;
- int count() const Q_DECL_OVERRIDE;
+ void addItem(QLayoutItem *item) override;
+ QLayoutItem *itemAt(int index) const override;
+ QLayoutItem *takeAt(int index) override;
+
+ void setGeometry(const QRect &rect) override;
+ QSize minimumSize() const override;
+ QSize sizeHint() const override;
+ void invalidate() override;
+
+ bool hasHeightForWidth() const override;
+ int heightForWidth(int width) const override;
+ Qt::Orientations expandingDirections() const override;
+ int count() const override;
int rowCount() const;
diff --git a/src/widgets/kernel/qgesture.h b/src/widgets/kernel/qgesture.h
index 1eda611d64..c5b2cee83d 100644
--- a/src/widgets/kernel/qgesture.h
+++ b/src/widgets/kernel/qgesture.h
@@ -70,7 +70,7 @@ class Q_WIDGETS_EXPORT QGesture : public QObject
Q_PROPERTY(bool hasHotSpot READ hasHotSpot)
public:
- explicit QGesture(QObject *parent = Q_NULLPTR);
+ explicit QGesture(QObject *parent = nullptr);
~QGesture();
Qt::GestureType gestureType() const;
@@ -114,7 +114,7 @@ class Q_WIDGETS_EXPORT QPanGesture : public QGesture
Q_PRIVATE_PROPERTY(QPanGesture::d_func(), qreal verticalVelocity READ verticalVelocity WRITE setVerticalVelocity)
public:
- explicit QPanGesture(QObject *parent = Q_NULLPTR);
+ explicit QPanGesture(QObject *parent = nullptr);
~QPanGesture();
QPointF lastOffset() const;
@@ -162,7 +162,7 @@ public:
Q_PROPERTY(QPointF centerPoint READ centerPoint WRITE setCenterPoint)
public:
- explicit QPinchGesture(QObject *parent = Q_NULLPTR);
+ explicit QPinchGesture(QObject *parent = nullptr);
~QPinchGesture();
ChangeFlags totalChangeFlags() const;
@@ -218,7 +218,7 @@ public:
enum SwipeDirection { NoDirection, Left, Right, Up, Down };
Q_ENUM(SwipeDirection)
- explicit QSwipeGesture(QObject *parent = Q_NULLPTR);
+ explicit QSwipeGesture(QObject *parent = nullptr);
~QSwipeGesture();
SwipeDirection horizontalDirection() const;
@@ -239,7 +239,7 @@ class Q_WIDGETS_EXPORT QTapGesture : public QGesture
Q_PROPERTY(QPointF position READ position WRITE setPosition)
public:
- explicit QTapGesture(QObject *parent = Q_NULLPTR);
+ explicit QTapGesture(QObject *parent = nullptr);
~QTapGesture();
QPointF position() const;
@@ -257,7 +257,7 @@ class Q_WIDGETS_EXPORT QTapAndHoldGesture : public QGesture
Q_PROPERTY(QPointF position READ position WRITE setPosition)
public:
- explicit QTapAndHoldGesture(QObject *parent = Q_NULLPTR);
+ explicit QTapAndHoldGesture(QObject *parent = nullptr);
~QTapAndHoldGesture();
QPointF position() const;
diff --git a/src/widgets/kernel/qgridlayout.cpp b/src/widgets/kernel/qgridlayout.cpp
index 29df38f19c..db8ef89477 100644
--- a/src/widgets/kernel/qgridlayout.cpp
+++ b/src/widgets/kernel/qgridlayout.cpp
@@ -170,7 +170,7 @@ public:
}
return 0;
}
- QLayoutItem* replaceAt(int index, QLayoutItem *newitem) Q_DECL_OVERRIDE
+ QLayoutItem* replaceAt(int index, QLayoutItem *newitem) override
{
if (!newitem)
return 0;
diff --git a/src/widgets/kernel/qgridlayout.h b/src/widgets/kernel/qgridlayout.h
index 51dd65d181..0283ec2028 100644
--- a/src/widgets/kernel/qgridlayout.h
+++ b/src/widgets/kernel/qgridlayout.h
@@ -66,9 +66,9 @@ public:
~QGridLayout();
- QSize sizeHint() const Q_DECL_OVERRIDE;
- QSize minimumSize() const Q_DECL_OVERRIDE;
- QSize maximumSize() const Q_DECL_OVERRIDE;
+ QSize sizeHint() const override;
+ QSize minimumSize() const override;
+ QSize maximumSize() const override;
void setHorizontalSpacing(int spacing);
int horizontalSpacing() const;
@@ -92,12 +92,12 @@ public:
QRect cellRect(int row, int column) const;
- bool hasHeightForWidth() const Q_DECL_OVERRIDE;
- int heightForWidth(int) const Q_DECL_OVERRIDE;
- int minimumHeightForWidth(int) const Q_DECL_OVERRIDE;
+ bool hasHeightForWidth() const override;
+ int heightForWidth(int) const override;
+ int minimumHeightForWidth(int) const override;
- Qt::Orientations expandingDirections() const Q_DECL_OVERRIDE;
- void invalidate() Q_DECL_OVERRIDE;
+ Qt::Orientations expandingDirections() const override;
+ void invalidate() override;
inline void addWidget(QWidget *w) { QLayout::addWidget(w); }
void addWidget(QWidget *, int row, int column, Qt::Alignment = Qt::Alignment());
@@ -108,11 +108,11 @@ public:
void setOriginCorner(Qt::Corner);
Qt::Corner originCorner() const;
- QLayoutItem *itemAt(int index) const Q_DECL_OVERRIDE;
+ QLayoutItem *itemAt(int index) const override;
QLayoutItem *itemAtPosition(int row, int column) const;
- QLayoutItem *takeAt(int index) Q_DECL_OVERRIDE;
- int count() const Q_DECL_OVERRIDE;
- void setGeometry(const QRect&) Q_DECL_OVERRIDE;
+ QLayoutItem *takeAt(int index) override;
+ int count() const override;
+ void setGeometry(const QRect&) override;
void addItem(QLayoutItem *item, int row, int column, int rowSpan = 1, int columnSpan = 1, Qt::Alignment = Qt::Alignment());
@@ -120,7 +120,7 @@ public:
void getItemPosition(int idx, int *row, int *column, int *rowSpan, int *columnSpan) const;
protected:
- void addItem(QLayoutItem *) Q_DECL_OVERRIDE;
+ void addItem(QLayoutItem *) override;
private:
Q_DISABLE_COPY(QGridLayout)
diff --git a/src/widgets/kernel/qlayout.h b/src/widgets/kernel/qlayout.h
index 2de12b4f99..abadf2e69d 100644
--- a/src/widgets/kernel/qlayout.h
+++ b/src/widgets/kernel/qlayout.h
@@ -104,8 +104,8 @@ public:
QWidget *parentWidget() const;
- void invalidate() Q_DECL_OVERRIDE;
- QRect geometry() const Q_DECL_OVERRIDE;
+ void invalidate() override;
+ QRect geometry() const override;
bool activate();
void update();
@@ -115,16 +115,16 @@ public:
void removeWidget(QWidget *w);
void removeItem(QLayoutItem *);
- Qt::Orientations expandingDirections() const Q_DECL_OVERRIDE;
- QSize minimumSize() const Q_DECL_OVERRIDE;
- QSize maximumSize() const Q_DECL_OVERRIDE;
- virtual void setGeometry(const QRect&) Q_DECL_OVERRIDE;
+ Qt::Orientations expandingDirections() const override;
+ QSize minimumSize() const override;
+ QSize maximumSize() const override;
+ virtual void setGeometry(const QRect&) override;
virtual QLayoutItem *itemAt(int index) const = 0;
virtual QLayoutItem *takeAt(int index) = 0;
virtual int indexOf(QWidget *) const;
virtual int count() const = 0;
- bool isEmpty() const Q_DECL_OVERRIDE;
- QSizePolicy::ControlTypes controlTypes() const Q_DECL_OVERRIDE;
+ bool isEmpty() const override;
+ QSizePolicy::ControlTypes controlTypes() const override;
// ### Qt 6 make this function virtual
QLayoutItem *replaceWidget(QWidget *from, QWidget *to, Qt::FindChildOptions options = Qt::FindChildrenRecursively);
@@ -133,7 +133,7 @@ public:
QSize totalMinimumSize() const;
QSize totalMaximumSize() const;
QSize totalSizeHint() const;
- QLayout *layout() Q_DECL_OVERRIDE;
+ QLayout *layout() override;
void setEnabled(bool);
bool isEnabled() const;
@@ -143,7 +143,7 @@ public:
protected:
void widgetEvent(QEvent *);
- void childEvent(QChildEvent *e) Q_DECL_OVERRIDE;
+ void childEvent(QChildEvent *e) override;
void addChildLayout(QLayout *l);
void addChildWidget(QWidget *w);
bool adoptLayout(QLayout *layout);
diff --git a/src/widgets/kernel/qlayoutitem.cpp b/src/widgets/kernel/qlayoutitem.cpp
index 0bdac43c56..5c4fc20687 100644
--- a/src/widgets/kernel/qlayoutitem.cpp
+++ b/src/widgets/kernel/qlayoutitem.cpp
@@ -400,8 +400,8 @@ int QLayoutItem::minimumHeightForWidth(int w) const
/*!
- Returns the preferred height for this layout item, given the width
- \a w.
+ Returns the preferred height for this layout item, given the
+ width, which is not used in this default implementation.
The default implementation returns -1, indicating that the
preferred height is independent of the width of the item. Using
diff --git a/src/widgets/kernel/qopenglwidget.cpp b/src/widgets/kernel/qopenglwidget.cpp
index 5bc408a8cd..07588d2ee2 100644
--- a/src/widgets/kernel/qopenglwidget.cpp
+++ b/src/widgets/kernel/qopenglwidget.cpp
@@ -536,8 +536,8 @@ public:
: QOpenGLPaintDevicePrivate(QSize()),
w(widget) { }
- void beginPaint() Q_DECL_OVERRIDE;
- void endPaint() Q_DECL_OVERRIDE;
+ void beginPaint() override;
+ void endPaint() override;
QOpenGLWidget *w;
};
@@ -547,7 +547,7 @@ class QOpenGLWidgetPaintDevice : public QOpenGLPaintDevice
public:
QOpenGLWidgetPaintDevice(QOpenGLWidget *widget)
: QOpenGLPaintDevice(*new QOpenGLWidgetPaintDevicePrivate(widget)) { }
- void ensureActiveTarget() Q_DECL_OVERRIDE;
+ void ensureActiveTarget() override;
};
class QOpenGLWidgetPrivate : public QWidgetPrivate
@@ -576,8 +576,8 @@ public:
void reset();
void recreateFbo();
- GLuint textureId() const Q_DECL_OVERRIDE;
- QPlatformTextureList::Flags textureListFlags() Q_DECL_OVERRIDE;
+ GLuint textureId() const override;
+ QPlatformTextureList::Flags textureListFlags() override;
void initialize();
void invokeUserPaint();
@@ -585,14 +585,14 @@ public:
void invalidateFbo();
- QImage grabFramebuffer() Q_DECL_OVERRIDE;
- void beginBackingStorePainting() Q_DECL_OVERRIDE { inBackingStorePaint = true; }
- void endBackingStorePainting() Q_DECL_OVERRIDE { inBackingStorePaint = false; }
- void beginCompose() Q_DECL_OVERRIDE;
- void endCompose() Q_DECL_OVERRIDE;
- void initializeViewportFramebuffer() Q_DECL_OVERRIDE;
- void resizeViewportFramebuffer() Q_DECL_OVERRIDE;
- void resolveSamples() Q_DECL_OVERRIDE;
+ QImage grabFramebuffer() override;
+ void beginBackingStorePainting() override { inBackingStorePaint = true; }
+ void endBackingStorePainting() override { inBackingStorePaint = false; }
+ void beginCompose() override;
+ void endCompose() override;
+ void initializeViewportFramebuffer() override;
+ void resizeViewportFramebuffer() override;
+ void resolveSamples() override;
QOpenGLContext *context;
QOpenGLFramebufferObject *fbo;
diff --git a/src/widgets/kernel/qopenglwidget.h b/src/widgets/kernel/qopenglwidget.h
index c0a6e41522..9eb4a9ba5a 100644
--- a/src/widgets/kernel/qopenglwidget.h
+++ b/src/widgets/kernel/qopenglwidget.h
@@ -63,7 +63,7 @@ public:
PartialUpdate
};
- explicit QOpenGLWidget(QWidget* parent = Q_NULLPTR, Qt::WindowFlags f = Qt::WindowFlags());
+ explicit QOpenGLWidget(QWidget* parent = nullptr, Qt::WindowFlags f = Qt::WindowFlags());
~QOpenGLWidget();
void setUpdateBehavior(UpdateBehavior updateBehavior);
@@ -96,13 +96,13 @@ protected:
virtual void resizeGL(int w, int h);
virtual void paintGL();
- void paintEvent(QPaintEvent *e) Q_DECL_OVERRIDE;
- void resizeEvent(QResizeEvent *e) Q_DECL_OVERRIDE;
- bool event(QEvent *e) Q_DECL_OVERRIDE;
+ void paintEvent(QPaintEvent *e) override;
+ void resizeEvent(QResizeEvent *e) override;
+ bool event(QEvent *e) override;
- int metric(QPaintDevice::PaintDeviceMetric metric) const Q_DECL_OVERRIDE;
- QPaintDevice *redirected(QPoint *p) const Q_DECL_OVERRIDE;
- QPaintEngine *paintEngine() const Q_DECL_OVERRIDE;
+ int metric(QPaintDevice::PaintDeviceMetric metric) const override;
+ QPaintDevice *redirected(QPoint *p) const override;
+ QPaintEngine *paintEngine() const override;
private:
Q_DISABLE_COPY(QOpenGLWidget)
diff --git a/src/widgets/kernel/qshortcut.h b/src/widgets/kernel/qshortcut.h
index 22c667c9c1..6dcf4971b2 100644
--- a/src/widgets/kernel/qshortcut.h
+++ b/src/widgets/kernel/qshortcut.h
@@ -62,7 +62,7 @@ class Q_WIDGETS_EXPORT QShortcut : public QObject
public:
explicit QShortcut(QWidget *parent);
QShortcut(const QKeySequence& key, QWidget *parent,
- const char *member = Q_NULLPTR, const char *ambiguousMember = Q_NULLPTR,
+ const char *member = nullptr, const char *ambiguousMember = nullptr,
Qt::ShortcutContext context = Qt::WindowShortcut);
~QShortcut();
@@ -91,7 +91,7 @@ Q_SIGNALS:
void activatedAmbiguously();
protected:
- bool event(QEvent *e) Q_DECL_OVERRIDE;
+ bool event(QEvent *e) override;
};
#endif // QT_NO_SHORTCUT
diff --git a/src/widgets/kernel/qstackedlayout.cpp b/src/widgets/kernel/qstackedlayout.cpp
index b8b6f4302d..7430d833db 100644
--- a/src/widgets/kernel/qstackedlayout.cpp
+++ b/src/widgets/kernel/qstackedlayout.cpp
@@ -51,7 +51,7 @@ class QStackedLayoutPrivate : public QLayoutPrivate
Q_DECLARE_PUBLIC(QStackedLayout)
public:
QStackedLayoutPrivate() : index(-1), stackingMode(QStackedLayout::StackOne) {}
- QLayoutItem* replaceAt(int index, QLayoutItem *newitem) Q_DECL_OVERRIDE;
+ QLayoutItem* replaceAt(int index, QLayoutItem *newitem) override;
QList<QLayoutItem *> list;
int index;
QStackedLayout::StackingMode stackingMode;
diff --git a/src/widgets/kernel/qstackedlayout.h b/src/widgets/kernel/qstackedlayout.h
index 6f5eded1f0..966ee2aae4 100644
--- a/src/widgets/kernel/qstackedlayout.h
+++ b/src/widgets/kernel/qstackedlayout.h
@@ -75,20 +75,20 @@ public:
int currentIndex() const;
using QLayout::widget;
QWidget *widget(int) const;
- int count() const Q_DECL_OVERRIDE;
+ int count() const override;
StackingMode stackingMode() const;
void setStackingMode(StackingMode stackingMode);
// abstract virtual functions:
- void addItem(QLayoutItem *item) Q_DECL_OVERRIDE;
- QSize sizeHint() const Q_DECL_OVERRIDE;
- QSize minimumSize() const Q_DECL_OVERRIDE;
- QLayoutItem *itemAt(int) const Q_DECL_OVERRIDE;
- QLayoutItem *takeAt(int) Q_DECL_OVERRIDE;
- void setGeometry(const QRect &rect) Q_DECL_OVERRIDE;
- bool hasHeightForWidth() const Q_DECL_OVERRIDE;
- int heightForWidth(int width) const Q_DECL_OVERRIDE;
+ void addItem(QLayoutItem *item) override;
+ QSize sizeHint() const override;
+ QSize minimumSize() const override;
+ QLayoutItem *itemAt(int) const override;
+ QLayoutItem *takeAt(int) override;
+ void setGeometry(const QRect &rect) override;
+ bool hasHeightForWidth() const override;
+ int heightForWidth(int width) const override;
Q_SIGNALS:
void widgetRemoved(int index);
diff --git a/src/widgets/kernel/qstandardgestures_p.h b/src/widgets/kernel/qstandardgestures_p.h
index 9b2cffaa9a..6de09361fe 100644
--- a/src/widgets/kernel/qstandardgestures_p.h
+++ b/src/widgets/kernel/qstandardgestures_p.h
@@ -64,9 +64,9 @@ class QPanGestureRecognizer : public QGestureRecognizer
public:
explicit QPanGestureRecognizer(int pointCount = 2) : m_pointCount(pointCount) {}
- QGesture *create(QObject *target) Q_DECL_OVERRIDE;
- QGestureRecognizer::Result recognize(QGesture *state, QObject *watched, QEvent *event) Q_DECL_OVERRIDE;
- void reset(QGesture *state) Q_DECL_OVERRIDE;
+ QGesture *create(QObject *target) override;
+ QGestureRecognizer::Result recognize(QGesture *state, QObject *watched, QEvent *event) override;
+ void reset(QGesture *state) override;
private:
const int m_pointCount;
@@ -77,9 +77,9 @@ class QPinchGestureRecognizer : public QGestureRecognizer
public:
QPinchGestureRecognizer();
- QGesture *create(QObject *target) Q_DECL_OVERRIDE;
- QGestureRecognizer::Result recognize(QGesture *state, QObject *watched, QEvent *event) Q_DECL_OVERRIDE;
- void reset(QGesture *state) Q_DECL_OVERRIDE;
+ QGesture *create(QObject *target) override;
+ QGestureRecognizer::Result recognize(QGesture *state, QObject *watched, QEvent *event) override;
+ void reset(QGesture *state) override;
};
class QSwipeGestureRecognizer : public QGestureRecognizer
@@ -87,9 +87,9 @@ class QSwipeGestureRecognizer : public QGestureRecognizer
public:
QSwipeGestureRecognizer();
- QGesture *create(QObject *target) Q_DECL_OVERRIDE;
- QGestureRecognizer::Result recognize(QGesture *state, QObject *watched, QEvent *event) Q_DECL_OVERRIDE;
- void reset(QGesture *state) Q_DECL_OVERRIDE;
+ QGesture *create(QObject *target) override;
+ QGestureRecognizer::Result recognize(QGesture *state, QObject *watched, QEvent *event) override;
+ void reset(QGesture *state) override;
};
class QTapGestureRecognizer : public QGestureRecognizer
@@ -97,9 +97,9 @@ class QTapGestureRecognizer : public QGestureRecognizer
public:
QTapGestureRecognizer();
- QGesture *create(QObject *target) Q_DECL_OVERRIDE;
- QGestureRecognizer::Result recognize(QGesture *state, QObject *watched, QEvent *event) Q_DECL_OVERRIDE;
- void reset(QGesture *state) Q_DECL_OVERRIDE;
+ QGesture *create(QObject *target) override;
+ QGestureRecognizer::Result recognize(QGesture *state, QObject *watched, QEvent *event) override;
+ void reset(QGesture *state) override;
};
class QTapAndHoldGestureRecognizer : public QGestureRecognizer
@@ -107,9 +107,9 @@ class QTapAndHoldGestureRecognizer : public QGestureRecognizer
public:
QTapAndHoldGestureRecognizer();
- QGesture *create(QObject *target) Q_DECL_OVERRIDE;
- QGestureRecognizer::Result recognize(QGesture *state, QObject *watched, QEvent *event) Q_DECL_OVERRIDE;
- void reset(QGesture *state) Q_DECL_OVERRIDE;
+ QGesture *create(QObject *target) override;
+ QGestureRecognizer::Result recognize(QGesture *state, QObject *watched, QEvent *event) override;
+ void reset(QGesture *state) override;
};
QT_END_NAMESPACE
diff --git a/src/widgets/kernel/qtooltip.cpp b/src/widgets/kernel/qtooltip.cpp
index 80dc65e2d2..69b62ff7d7 100644
--- a/src/widgets/kernel/qtooltip.cpp
+++ b/src/widgets/kernel/qtooltip.cpp
@@ -127,7 +127,7 @@ public:
~QTipLabel();
static QTipLabel *instance;
- bool eventFilter(QObject *, QEvent *) Q_DECL_OVERRIDE;
+ bool eventFilter(QObject *, QEvent *) override;
QBasicTimer hideTimer, expireTimer;
@@ -143,10 +143,10 @@ public:
static int getTipScreen(const QPoint &pos, QWidget *w);
protected:
- void timerEvent(QTimerEvent *e) Q_DECL_OVERRIDE;
- void paintEvent(QPaintEvent *e) Q_DECL_OVERRIDE;
- void mouseMoveEvent(QMouseEvent *e) Q_DECL_OVERRIDE;
- void resizeEvent(QResizeEvent *e) Q_DECL_OVERRIDE;
+ void timerEvent(QTimerEvent *e) override;
+ void paintEvent(QPaintEvent *e) override;
+ void mouseMoveEvent(QMouseEvent *e) override;
+ void resizeEvent(QResizeEvent *e) override;
#ifndef QT_NO_STYLE_STYLESHEET
public slots:
@@ -501,7 +501,10 @@ void QToolTip::showText(const QPoint &pos, const QString &text, QWidget *w, cons
#ifdef Q_OS_WIN32
// On windows, we can't use the widget as parent otherwise the window will be
// raised when the tooltip will be shown
+QT_WARNING_PUSH
+QT_WARNING_DISABLE_DEPRECATED
new QTipLabel(text, QApplication::desktop()->screen(QTipLabel::getTipScreen(pos, w)), msecDisplayTime);
+QT_WARNING_POP
#else
new QTipLabel(text, w, msecDisplayTime); // sets QTipLabel::instance to itself
#endif
diff --git a/src/widgets/kernel/qtooltip.h b/src/widgets/kernel/qtooltip.h
index 5e68eef0a7..edf1de0c1d 100644
--- a/src/widgets/kernel/qtooltip.h
+++ b/src/widgets/kernel/qtooltip.h
@@ -53,7 +53,7 @@ class Q_WIDGETS_EXPORT QToolTip
QToolTip() Q_DECL_EQ_DELETE;
public:
// ### Qt 6 - merge the three showText functions below
- static void showText(const QPoint &pos, const QString &text, QWidget *w = Q_NULLPTR);
+ static void showText(const QPoint &pos, const QString &text, QWidget *w = nullptr);
static void showText(const QPoint &pos, const QString &text, QWidget *w, const QRect &rect);
static void showText(const QPoint &pos, const QString &text, QWidget *w, const QRect &rect, int msecShowTime);
static inline void hideText() { showText(QPoint(), QString()); }
diff --git a/src/widgets/kernel/qwhatsthis.cpp b/src/widgets/kernel/qwhatsthis.cpp
index 91d2b503e0..96d0cf61c4 100644
--- a/src/widgets/kernel/qwhatsthis.cpp
+++ b/src/widgets/kernel/qwhatsthis.cpp
@@ -145,12 +145,12 @@ public:
static QWhatsThat *instance;
protected:
- void showEvent(QShowEvent *e) Q_DECL_OVERRIDE;
- void mousePressEvent(QMouseEvent*) Q_DECL_OVERRIDE;
- void mouseReleaseEvent(QMouseEvent*) Q_DECL_OVERRIDE;
- void mouseMoveEvent(QMouseEvent*) Q_DECL_OVERRIDE;
- void keyPressEvent(QKeyEvent*) Q_DECL_OVERRIDE;
- void paintEvent(QPaintEvent*) Q_DECL_OVERRIDE;
+ void showEvent(QShowEvent *e) override;
+ void mousePressEvent(QMouseEvent*) override;
+ void mouseReleaseEvent(QMouseEvent*) override;
+ void mouseMoveEvent(QMouseEvent*) override;
+ void keyPressEvent(QKeyEvent*) override;
+ void paintEvent(QPaintEvent*) override;
private:
QPointer<QWidget>widget;
@@ -365,7 +365,7 @@ class QWhatsThisPrivate : public QObject
QWhatsThisPrivate();
~QWhatsThisPrivate();
static QWhatsThisPrivate *instance;
- bool eventFilter(QObject *, QEvent *) Q_DECL_OVERRIDE;
+ bool eventFilter(QObject *, QEvent *) override;
QPointer<QAction> action;
static void say(QWidget *, const QString &, int x = 0, int y = 0);
static void notifyToplevels(QEvent *e);
diff --git a/src/widgets/kernel/qwhatsthis.h b/src/widgets/kernel/qwhatsthis.h
index 3211796d3e..1f0f82b2a2 100644
--- a/src/widgets/kernel/qwhatsthis.h
+++ b/src/widgets/kernel/qwhatsthis.h
@@ -59,10 +59,10 @@ public:
static bool inWhatsThisMode();
static void leaveWhatsThisMode();
- static void showText(const QPoint &pos, const QString &text, QWidget *w = Q_NULLPTR);
+ static void showText(const QPoint &pos, const QString &text, QWidget *w = nullptr);
static void hideText();
- static QAction *createAction(QObject *parent = Q_NULLPTR);
+ static QAction *createAction(QObject *parent = nullptr);
};
diff --git a/src/widgets/kernel/qwidget.cpp b/src/widgets/kernel/qwidget.cpp
index 680c179bd9..5eab2d1038 100644
--- a/src/widgets/kernel/qwidget.cpp
+++ b/src/widgets/kernel/qwidget.cpp
@@ -1,6 +1,6 @@
/****************************************************************************
**
-** Copyright (C) 2016 The Qt Company Ltd.
+** Copyright (C) 2017 The Qt Company Ltd.
** Copyright (C) 2016 Intel Corporation.
** Contact: https://www.qt.io/licensing/
**
@@ -1155,7 +1155,7 @@ void QWidgetPrivate::init(QWidget *parentWidget, Qt::WindowFlags f)
if (targetScreen >= 0) {
topData()->initialScreenIndex = targetScreen;
if (QWindow *window = q->windowHandle())
- window->setScreen(QGuiApplication::screens().value(targetScreen, Q_NULLPTR));
+ window->setScreen(QGuiApplication::screens().value(targetScreen, nullptr));
}
data.fstrut_dirty = true;
@@ -1454,7 +1454,7 @@ void QWidgetPrivate::create_sys(WId window, bool initializeWindow, bool destroyO
screenNumber = q->windowType() != Qt::Desktop
? QDesktopWidgetPrivate::screenNumber(q) : 0;
}
- win->setScreen(QGuiApplication::screens().value(screenNumber, Q_NULLPTR));
+ win->setScreen(QGuiApplication::screens().value(screenNumber, nullptr));
}
QSurfaceFormat format = win->requestedFormat();
@@ -1495,7 +1495,7 @@ void QWidgetPrivate::create_sys(WId window, bool initializeWindow, bool destroyO
QBackingStore *store = q->backingStore();
if (!store) {
- if (win && q->windowType() != Qt::Desktop) {
+ if (q->windowType() != Qt::Desktop) {
if (q->isTopLevel())
q->setBackingStore(new QBackingStore(win));
} else {
@@ -7984,7 +7984,7 @@ void QWidgetPrivate::show_helper()
const bool isWindow = q->isWindow();
#if QT_CONFIG(graphicsview)
- bool isEmbedded = isWindow && q->graphicsProxyWidget() != Q_NULLPTR;
+ bool isEmbedded = isWindow && q->graphicsProxyWidget() != nullptr;
#else
bool isEmbedded = false;
#endif
@@ -12505,7 +12505,7 @@ static inline bool canMapPosition(QWindow *window)
#if QT_CONFIG(graphicsview)
static inline QGraphicsProxyWidget *graphicsProxyWidget(const QWidget *w)
{
- QGraphicsProxyWidget *result = Q_NULLPTR;
+ QGraphicsProxyWidget *result = nullptr;
const QWidgetPrivate *d = qt_widget_private(const_cast<QWidget *>(w));
if (d->extra)
result = d->extra->proxyWidget;
@@ -12521,7 +12521,7 @@ struct MapToGlobalTransformResult {
static MapToGlobalTransformResult mapToGlobalTransform(const QWidget *w)
{
MapToGlobalTransformResult result;
- result.window = Q_NULLPTR;
+ result.window = nullptr;
for ( ; w ; w = w->parentWidget()) {
#if QT_CONFIG(graphicsview)
if (QGraphicsProxyWidget *qgpw = graphicsProxyWidget(w)) {
diff --git a/src/widgets/kernel/qwidget.h b/src/widgets/kernel/qwidget.h
index 732af4de09..5087d330ee 100644
--- a/src/widgets/kernel/qwidget.h
+++ b/src/widgets/kernel/qwidget.h
@@ -211,10 +211,10 @@ public:
};
Q_DECLARE_FLAGS(RenderFlags, RenderFlag)
- explicit QWidget(QWidget* parent = Q_NULLPTR, Qt::WindowFlags f = Qt::WindowFlags());
+ explicit QWidget(QWidget* parent = nullptr, Qt::WindowFlags f = Qt::WindowFlags());
~QWidget();
- int devType() const Q_DECL_OVERRIDE;
+ int devType() const override;
WId winId() const;
void createWinId(); // internal, going away
@@ -578,7 +578,7 @@ public:
void setAttribute(Qt::WidgetAttribute, bool on = true);
inline bool testAttribute(Qt::WidgetAttribute) const;
- QPaintEngine *paintEngine() const Q_DECL_OVERRIDE;
+ QPaintEngine *paintEngine() const override;
void ensurePolished() const;
@@ -596,7 +596,7 @@ public:
QWindow *windowHandle() const;
- static QWidget *createWindowContainer(QWindow *window, QWidget *parent=Q_NULLPTR, Qt::WindowFlags flags=Qt::WindowFlags());
+ static QWidget *createWindowContainer(QWindow *window, QWidget *parent=nullptr, Qt::WindowFlags flags=Qt::WindowFlags());
friend class QDesktopScreenWidget;
@@ -608,7 +608,7 @@ Q_SIGNALS:
protected:
// Event handlers
- bool event(QEvent *event) Q_DECL_OVERRIDE;
+ bool event(QEvent *event) override;
virtual void mousePressEvent(QMouseEvent *event);
virtual void mouseReleaseEvent(QMouseEvent *event);
virtual void mouseDoubleClickEvent(QMouseEvent *event);
@@ -650,10 +650,10 @@ protected:
// Misc. protected functions
virtual void changeEvent(QEvent *);
- int metric(PaintDeviceMetric) const Q_DECL_OVERRIDE;
- void initPainter(QPainter *painter) const Q_DECL_OVERRIDE;
- QPaintDevice *redirected(QPoint *offset) const Q_DECL_OVERRIDE;
- QPainter *sharedPainter() const Q_DECL_OVERRIDE;
+ int metric(PaintDeviceMetric) const override;
+ void initPainter(QPainter *painter) const override;
+ QPaintDevice *redirected(QPoint *offset) const override;
+ QPainter *sharedPainter() const override;
virtual void inputMethodEvent(QInputMethodEvent *);
public:
@@ -738,12 +738,12 @@ Q_DECLARE_OPERATORS_FOR_FLAGS(QWidget::RenderFlags)
#ifndef Q_QDOC
template <> inline QWidget *qobject_cast<QWidget*>(QObject *o)
{
- if (!o || !o->isWidgetType()) return Q_NULLPTR;
+ if (!o || !o->isWidgetType()) return nullptr;
return static_cast<QWidget*>(o);
}
template <> inline const QWidget *qobject_cast<const QWidget*>(const QObject *o)
{
- if (!o || !o->isWidgetType()) return Q_NULLPTR;
+ if (!o || !o->isWidgetType()) return nullptr;
return static_cast<const QWidget*>(o);
}
#endif // !Q_QDOC
diff --git a/src/widgets/kernel/qwidget_p.h b/src/widgets/kernel/qwidget_p.h
index 37690b9719..a9c73c6a26 100644
--- a/src/widgets/kernel/qwidget_p.h
+++ b/src/widgets/kernel/qwidget_p.h
@@ -913,26 +913,26 @@ public:
: QGraphicsEffectSourcePrivate(), m_widget(widget), context(0), updateDueToGraphicsEffect(false)
{}
- void detach() Q_DECL_OVERRIDE
+ void detach() override
{ m_widget->d_func()->graphicsEffect = 0; }
- const QGraphicsItem *graphicsItem() const Q_DECL_OVERRIDE
+ const QGraphicsItem *graphicsItem() const override
{ return 0; }
- const QWidget *widget() const Q_DECL_OVERRIDE
+ const QWidget *widget() const override
{ return m_widget; }
- void update() Q_DECL_OVERRIDE
+ void update() override
{
updateDueToGraphicsEffect = true;
m_widget->update();
updateDueToGraphicsEffect = false;
}
- bool isPixmap() const Q_DECL_OVERRIDE
+ bool isPixmap() const override
{ return false; }
- void effectBoundingRectChanged() Q_DECL_OVERRIDE
+ void effectBoundingRectChanged() override
{
// ### This function should take a rect parameter; then we can avoid
// updating too much on the parent widget.
@@ -942,16 +942,16 @@ public:
update();
}
- const QStyleOption *styleOption() const Q_DECL_OVERRIDE
+ const QStyleOption *styleOption() const override
{ return 0; }
- QRect deviceRect() const Q_DECL_OVERRIDE
+ QRect deviceRect() const override
{ return m_widget->window()->rect(); }
- QRectF boundingRect(Qt::CoordinateSystem system) const Q_DECL_OVERRIDE;
- void draw(QPainter *p) Q_DECL_OVERRIDE;
+ QRectF boundingRect(Qt::CoordinateSystem system) const override;
+ void draw(QPainter *p) override;
QPixmap pixmap(Qt::CoordinateSystem system, QPoint *offset,
- QGraphicsEffect::PixmapPadMode mode) const Q_DECL_OVERRIDE;
+ QGraphicsEffect::PixmapPadMode mode) const override;
QWidget *m_widget;
QWidgetPaintContext *context;
diff --git a/src/widgets/kernel/qwidgetaction.h b/src/widgets/kernel/qwidgetaction.h
index 3da691a430..4769332a23 100644
--- a/src/widgets/kernel/qwidgetaction.h
+++ b/src/widgets/kernel/qwidgetaction.h
@@ -66,8 +66,8 @@ public:
void releaseWidget(QWidget *widget);
protected:
- virtual bool event(QEvent *) Q_DECL_OVERRIDE;
- virtual bool eventFilter(QObject *, QEvent *) Q_DECL_OVERRIDE;
+ virtual bool event(QEvent *) override;
+ virtual bool eventFilter(QObject *, QEvent *) override;
virtual QWidget *createWidget(QWidget *parent);
virtual void deleteWidget(QWidget *widget);
QList<QWidget *> createdWidgets() const;
diff --git a/src/widgets/kernel/qwidgetbackingstore.cpp b/src/widgets/kernel/qwidgetbackingstore.cpp
index 52080fe05f..3b093283cd 100644
--- a/src/widgets/kernel/qwidgetbackingstore.cpp
+++ b/src/widgets/kernel/qwidgetbackingstore.cpp
@@ -1058,7 +1058,7 @@ static QPlatformTextureList *widgetTexturesFor(QWidget *tlw, QWidget *widget)
{
Q_UNUSED(tlw);
Q_UNUSED(widget);
- return Q_NULLPTR;
+ return nullptr;
}
#endif // QT_NO_OPENGL
diff --git a/src/widgets/kernel/qwidgetwindow.cpp b/src/widgets/kernel/qwidgetwindow.cpp
index 34b12a74b2..d5a18b525b 100644
--- a/src/widgets/kernel/qwidgetwindow.cpp
+++ b/src/widgets/kernel/qwidgetwindow.cpp
@@ -78,7 +78,7 @@ public:
QWindowPrivate::setVisible(visible);
}
- QWindow *eventReceiver() Q_DECL_OVERRIDE {
+ QWindow *eventReceiver() override {
Q_Q(QWidgetWindow);
QWindow *w = q;
while (w->parent() && qobject_cast<QWidgetWindow *>(w) && qobject_cast<QWidgetWindow *>(w->parent())) {
@@ -87,7 +87,7 @@ public:
return w;
}
- void clearFocusObject() Q_DECL_OVERRIDE
+ void clearFocusObject() override
{
Q_Q(QWidgetWindow);
QWidget *widget = q->widget();
@@ -95,7 +95,7 @@ public:
widget->focusWidget()->clearFocus();
}
- QRectF closestAcceptableGeometry(const QRectF &rect) const Q_DECL_OVERRIDE;
+ QRectF closestAcceptableGeometry(const QRectF &rect) const override;
#if QT_CONFIG(opengl)
QOpenGLContext *shareContext() const override;
#endif
@@ -178,7 +178,7 @@ QObject *QWidgetWindow::focusObject() const
{
QWidget *windowWidget = m_widget;
if (!windowWidget)
- return Q_NULLPTR;
+ return nullptr;
// A window can't have a focus object if it's being destroyed.
if (QWidgetPrivate::get(windowWidget)->data.in_destructor)
@@ -429,7 +429,7 @@ void QWidgetWindow::handleEnterLeaveEvent(QEvent *event)
const QEnterEvent *ee = static_cast<QEnterEvent *>(event);
QWidget *child = m_widget->childAt(ee->pos());
QWidget *receiver = child ? child : m_widget.data();
- QWidget *leave = Q_NULLPTR;
+ QWidget *leave = nullptr;
if (QApplicationPrivate::inPopupMode() && receiver == m_widget
&& qt_last_mouse_receiver != m_widget) {
// This allows to deliver the leave event to the native widget
@@ -536,11 +536,11 @@ void QWidgetWindow::handleMouseEvent(QMouseEvent *event)
// Prevent negative mouse position on enter event - this event
// should be properly handled in "handleEnterLeaveEvent()".
if (receiverMapped.x() >= 0 && receiverMapped.y() >= 0) {
- QApplicationPrivate::dispatchEnterLeave(receiver, Q_NULLPTR, event->screenPos());
+ QApplicationPrivate::dispatchEnterLeave(receiver, nullptr, event->screenPos());
qt_last_mouse_receiver = receiver;
}
} else {
- QApplicationPrivate::dispatchEnterLeave(Q_NULLPTR, qt_last_mouse_receiver, event->screenPos());
+ QApplicationPrivate::dispatchEnterLeave(nullptr, qt_last_mouse_receiver, event->screenPos());
qt_last_mouse_receiver = receiver;
receiver = activePopupWidget;
}
@@ -644,12 +644,9 @@ void QWidgetWindow::handleMouseEvent(QMouseEvent *event)
QWidget *receiver = QApplicationPrivate::pickMouseReceiver(m_widget, event->windowPos().toPoint(), &mapped, event->type(), event->buttons(),
qt_button_down, widget);
-
- if (!receiver) {
- if (event->type() == QEvent::MouseButtonRelease)
- QApplicationPrivate::mouse_buttons &= ~event->button();
+ if (!receiver)
return;
- }
+
if ((event->type() != QEvent::MouseButtonPress)
|| !(event->flags().testFlag(Qt::MouseEventCreatedDoubleClick))) {
diff --git a/src/widgets/kernel/qwidgetwindow_p.h b/src/widgets/kernel/qwidgetwindow_p.h
index be3f808a22..d0f1d55c2a 100644
--- a/src/widgets/kernel/qwidgetwindow_p.h
+++ b/src/widgets/kernel/qwidgetwindow_p.h
@@ -75,13 +75,13 @@ public:
QWidget *widget() const { return m_widget; }
#ifndef QT_NO_ACCESSIBILITY
- QAccessibleInterface *accessibleRoot() const Q_DECL_OVERRIDE;
+ QAccessibleInterface *accessibleRoot() const override;
#endif
- QObject *focusObject() const Q_DECL_OVERRIDE;
+ QObject *focusObject() const override;
void setNativeWindowVisibility(bool visible);
protected:
- bool event(QEvent *) Q_DECL_OVERRIDE;
+ bool event(QEvent *) override;
void handleCloseEvent(QCloseEvent *);
void handleEnterLeaveEvent(QEvent *);
@@ -102,7 +102,7 @@ protected:
#endif
void handleExposeEvent(QExposeEvent *);
void handleWindowStateChangedEvent(QWindowStateChangeEvent *event);
- bool nativeEvent(const QByteArray &eventType, void *message, long *result) Q_DECL_OVERRIDE;
+ bool nativeEvent(const QByteArray &eventType, void *message, long *result) override;
#if QT_CONFIG(tabletevent)
void handleTabletEvent(QTabletEvent *);
#endif
diff --git a/src/widgets/kernel/qwindowcontainer_p.h b/src/widgets/kernel/qwindowcontainer_p.h
index 1d838c8dd6..a8754232a8 100644
--- a/src/widgets/kernel/qwindowcontainer_p.h
+++ b/src/widgets/kernel/qwindowcontainer_p.h
@@ -75,7 +75,7 @@ public:
static void parentWasLowered(QWidget *parent);
protected:
- bool event(QEvent *ev) Q_DECL_OVERRIDE;
+ bool event(QEvent *ev) override;
private slots:
void focusWindowChanged(QWindow *focusWindow);
diff --git a/src/widgets/statemachine/qbasickeyeventtransition_p.h b/src/widgets/statemachine/qbasickeyeventtransition_p.h
index d3b90f6104..5007b79739 100644
--- a/src/widgets/statemachine/qbasickeyeventtransition_p.h
+++ b/src/widgets/statemachine/qbasickeyeventtransition_p.h
@@ -80,8 +80,8 @@ public:
void setModifierMask(Qt::KeyboardModifiers modifiers);
protected:
- bool eventTest(QEvent *event) Q_DECL_OVERRIDE;
- void onTransition(QEvent *) Q_DECL_OVERRIDE;
+ bool eventTest(QEvent *event) override;
+ void onTransition(QEvent *) override;
private:
Q_DISABLE_COPY(QBasicKeyEventTransition)
diff --git a/src/widgets/statemachine/qbasicmouseeventtransition_p.h b/src/widgets/statemachine/qbasicmouseeventtransition_p.h
index d6d37eb03e..93d2a5ec61 100644
--- a/src/widgets/statemachine/qbasicmouseeventtransition_p.h
+++ b/src/widgets/statemachine/qbasicmouseeventtransition_p.h
@@ -83,8 +83,8 @@ public:
void setHitTestPath(const QPainterPath &path);
protected:
- bool eventTest(QEvent *event) Q_DECL_OVERRIDE;
- void onTransition(QEvent *) Q_DECL_OVERRIDE;
+ bool eventTest(QEvent *event) override;
+ void onTransition(QEvent *) override;
private:
Q_DISABLE_COPY(QBasicMouseEventTransition)
diff --git a/src/widgets/statemachine/qkeyeventtransition.h b/src/widgets/statemachine/qkeyeventtransition.h
index 23ce3c40be..676f5f7846 100644
--- a/src/widgets/statemachine/qkeyeventtransition.h
+++ b/src/widgets/statemachine/qkeyeventtransition.h
@@ -54,9 +54,9 @@ class Q_WIDGETS_EXPORT QKeyEventTransition : public QEventTransition
Q_PROPERTY(int key READ key WRITE setKey)
Q_PROPERTY(Qt::KeyboardModifiers modifierMask READ modifierMask WRITE setModifierMask)
public:
- QKeyEventTransition(QState *sourceState = Q_NULLPTR);
+ QKeyEventTransition(QState *sourceState = nullptr);
QKeyEventTransition(QObject *object, QEvent::Type type, int key,
- QState *sourceState = Q_NULLPTR);
+ QState *sourceState = nullptr);
~QKeyEventTransition();
int key() const;
@@ -66,8 +66,8 @@ public:
void setModifierMask(Qt::KeyboardModifiers modifiers);
protected:
- void onTransition(QEvent *event) Q_DECL_OVERRIDE;
- bool eventTest(QEvent *event) Q_DECL_OVERRIDE;
+ void onTransition(QEvent *event) override;
+ bool eventTest(QEvent *event) override;
private:
Q_DISABLE_COPY(QKeyEventTransition)
diff --git a/src/widgets/statemachine/qmouseeventtransition.h b/src/widgets/statemachine/qmouseeventtransition.h
index 3f40224d8c..41f738d894 100644
--- a/src/widgets/statemachine/qmouseeventtransition.h
+++ b/src/widgets/statemachine/qmouseeventtransition.h
@@ -55,9 +55,9 @@ class Q_WIDGETS_EXPORT QMouseEventTransition : public QEventTransition
Q_PROPERTY(Qt::MouseButton button READ button WRITE setButton)
Q_PROPERTY(Qt::KeyboardModifiers modifierMask READ modifierMask WRITE setModifierMask)
public:
- QMouseEventTransition(QState *sourceState = Q_NULLPTR);
+ QMouseEventTransition(QState *sourceState = nullptr);
QMouseEventTransition(QObject *object, QEvent::Type type,
- Qt::MouseButton button, QState *sourceState = Q_NULLPTR);
+ Qt::MouseButton button, QState *sourceState = nullptr);
~QMouseEventTransition();
Qt::MouseButton button() const;
@@ -70,8 +70,8 @@ public:
void setHitTestPath(const QPainterPath &path);
protected:
- void onTransition(QEvent *event) Q_DECL_OVERRIDE;
- bool eventTest(QEvent *event) Q_DECL_OVERRIDE;
+ void onTransition(QEvent *event) override;
+ bool eventTest(QEvent *event) override;
private:
Q_DISABLE_COPY(QMouseEventTransition)
diff --git a/src/widgets/styles/qcommonstyle.cpp b/src/widgets/styles/qcommonstyle.cpp
index 0ad508afd2..1155257664 100644
--- a/src/widgets/styles/qcommonstyle.cpp
+++ b/src/widgets/styles/qcommonstyle.cpp
@@ -2499,7 +2499,7 @@ QRect QCommonStyle::subElementRect(SubElement sr, const QStyleOption *opt,
const bool vertical = pb->orientation == Qt::Vertical;
if (!vertical) {
if (pb->textVisible)
- textw = qMax(pb->fontMetrics.width(pb->text), pb->fontMetrics.width(QLatin1String("100%"))) + 6;
+ textw = qMax(pb->fontMetrics.horizontalAdvance(pb->text), pb->fontMetrics.horizontalAdvance(QLatin1String("100%"))) + 6;
}
if ((pb->textAlignment & Qt::AlignCenter) == 0) {
diff --git a/src/widgets/styles/qcommonstyle.h b/src/widgets/styles/qcommonstyle.h
index ed880a150f..f39915295e 100644
--- a/src/widgets/styles/qcommonstyle.h
+++ b/src/widgets/styles/qcommonstyle.h
@@ -56,40 +56,40 @@ public:
~QCommonStyle();
void drawPrimitive(PrimitiveElement pe, const QStyleOption *opt, QPainter *p,
- const QWidget *w = Q_NULLPTR) const Q_DECL_OVERRIDE;
+ const QWidget *w = nullptr) const override;
void drawControl(ControlElement element, const QStyleOption *opt, QPainter *p,
- const QWidget *w = Q_NULLPTR) const Q_DECL_OVERRIDE;
- QRect subElementRect(SubElement r, const QStyleOption *opt, const QWidget *widget = Q_NULLPTR) const Q_DECL_OVERRIDE;
+ const QWidget *w = nullptr) const override;
+ QRect subElementRect(SubElement r, const QStyleOption *opt, const QWidget *widget = nullptr) const override;
void drawComplexControl(ComplexControl cc, const QStyleOptionComplex *opt, QPainter *p,
- const QWidget *w = Q_NULLPTR) const Q_DECL_OVERRIDE;
+ const QWidget *w = nullptr) const override;
SubControl hitTestComplexControl(ComplexControl cc, const QStyleOptionComplex *opt,
- const QPoint &pt, const QWidget *w = Q_NULLPTR) const Q_DECL_OVERRIDE;
+ const QPoint &pt, const QWidget *w = nullptr) const override;
QRect subControlRect(ComplexControl cc, const QStyleOptionComplex *opt, SubControl sc,
- const QWidget *w = Q_NULLPTR) const Q_DECL_OVERRIDE;
+ const QWidget *w = nullptr) const override;
QSize sizeFromContents(ContentsType ct, const QStyleOption *opt,
- const QSize &contentsSize, const QWidget *widget = Q_NULLPTR) const Q_DECL_OVERRIDE;
+ const QSize &contentsSize, const QWidget *widget = nullptr) const override;
- int pixelMetric(PixelMetric m, const QStyleOption *opt = Q_NULLPTR, const QWidget *widget = Q_NULLPTR) const Q_DECL_OVERRIDE;
+ int pixelMetric(PixelMetric m, const QStyleOption *opt = nullptr, const QWidget *widget = nullptr) const override;
- int styleHint(StyleHint sh, const QStyleOption *opt = Q_NULLPTR, const QWidget *w = Q_NULLPTR,
- QStyleHintReturn *shret = Q_NULLPTR) const Q_DECL_OVERRIDE;
+ int styleHint(StyleHint sh, const QStyleOption *opt = nullptr, const QWidget *w = nullptr,
+ QStyleHintReturn *shret = nullptr) const override;
- QIcon standardIcon(StandardPixmap standardIcon, const QStyleOption *opt = Q_NULLPTR,
- const QWidget *widget = Q_NULLPTR) const Q_DECL_OVERRIDE;
- QPixmap standardPixmap(StandardPixmap sp, const QStyleOption *opt = Q_NULLPTR,
- const QWidget *widget = Q_NULLPTR) const Q_DECL_OVERRIDE;
+ QIcon standardIcon(StandardPixmap standardIcon, const QStyleOption *opt = nullptr,
+ const QWidget *widget = nullptr) const override;
+ QPixmap standardPixmap(StandardPixmap sp, const QStyleOption *opt = nullptr,
+ const QWidget *widget = nullptr) const override;
QPixmap generatedIconPixmap(QIcon::Mode iconMode, const QPixmap &pixmap,
- const QStyleOption *opt) const Q_DECL_OVERRIDE;
+ const QStyleOption *opt) const override;
int layoutSpacing(QSizePolicy::ControlType control1, QSizePolicy::ControlType control2,
- Qt::Orientation orientation, const QStyleOption *option = Q_NULLPTR,
- const QWidget *widget = Q_NULLPTR) const Q_DECL_OVERRIDE;
-
- void polish(QPalette &) Q_DECL_OVERRIDE;
- void polish(QApplication *app) Q_DECL_OVERRIDE;
- void polish(QWidget *widget) Q_DECL_OVERRIDE;
- void unpolish(QWidget *widget) Q_DECL_OVERRIDE;
- void unpolish(QApplication *application) Q_DECL_OVERRIDE;
+ Qt::Orientation orientation, const QStyleOption *option = nullptr,
+ const QWidget *widget = nullptr) const override;
+
+ void polish(QPalette &) override;
+ void polish(QApplication *app) override;
+ void polish(QWidget *widget) override;
+ void unpolish(QWidget *widget) override;
+ void unpolish(QApplication *application) override;
protected:
QCommonStyle(QCommonStylePrivate &dd);
diff --git a/src/widgets/styles/qdrawutil.h b/src/widgets/styles/qdrawutil.h
index d5582f2c90..346029e1b4 100644
--- a/src/widgets/styles/qdrawutil.h
+++ b/src/widgets/styles/qdrawutil.h
@@ -70,42 +70,42 @@ Q_WIDGETS_EXPORT void qDrawShadeLine(QPainter *p, const QPoint &p1, const QPoint
Q_WIDGETS_EXPORT void qDrawShadeRect(QPainter *p, int x, int y, int w, int h,
const QPalette &pal, bool sunken = false,
int lineWidth = 1, int midLineWidth = 0,
- const QBrush *fill = Q_NULLPTR);
+ const QBrush *fill = nullptr);
Q_WIDGETS_EXPORT void qDrawShadeRect(QPainter *p, const QRect &r,
const QPalette &pal, bool sunken = false,
int lineWidth = 1, int midLineWidth = 0,
- const QBrush *fill = Q_NULLPTR);
+ const QBrush *fill = nullptr);
Q_WIDGETS_EXPORT void qDrawShadePanel(QPainter *p, int x, int y, int w, int h,
const QPalette &pal, bool sunken = false,
- int lineWidth = 1, const QBrush *fill = Q_NULLPTR);
+ int lineWidth = 1, const QBrush *fill = nullptr);
Q_WIDGETS_EXPORT void qDrawShadePanel(QPainter *p, const QRect &r,
const QPalette &pal, bool sunken = false,
- int lineWidth = 1, const QBrush *fill = Q_NULLPTR);
+ int lineWidth = 1, const QBrush *fill = nullptr);
Q_WIDGETS_EXPORT void qDrawWinButton(QPainter *p, int x, int y, int w, int h,
const QPalette &pal, bool sunken = false,
- const QBrush *fill = Q_NULLPTR);
+ const QBrush *fill = nullptr);
Q_WIDGETS_EXPORT void qDrawWinButton(QPainter *p, const QRect &r,
const QPalette &pal, bool sunken = false,
- const QBrush *fill = Q_NULLPTR);
+ const QBrush *fill = nullptr);
Q_WIDGETS_EXPORT void qDrawWinPanel(QPainter *p, int x, int y, int w, int h,
const QPalette &pal, bool sunken = false,
- const QBrush *fill = Q_NULLPTR);
+ const QBrush *fill = nullptr);
Q_WIDGETS_EXPORT void qDrawWinPanel(QPainter *p, const QRect &r,
const QPalette &pal, bool sunken = false,
- const QBrush *fill = Q_NULLPTR);
+ const QBrush *fill = nullptr);
Q_WIDGETS_EXPORT void qDrawPlainRect(QPainter *p, int x, int y, int w, int h, const QColor &,
- int lineWidth = 1, const QBrush *fill = Q_NULLPTR);
+ int lineWidth = 1, const QBrush *fill = nullptr);
Q_WIDGETS_EXPORT void qDrawPlainRect(QPainter *p, const QRect &r, const QColor &,
- int lineWidth = 1, const QBrush *fill = Q_NULLPTR);
+ int lineWidth = 1, const QBrush *fill = nullptr);
diff --git a/src/widgets/styles/qfusionstyle.cpp b/src/widgets/styles/qfusionstyle.cpp
index 88c98f45f9..80196a39a2 100644
--- a/src/widgets/styles/qfusionstyle.cpp
+++ b/src/widgets/styles/qfusionstyle.cpp
@@ -1538,7 +1538,7 @@ void QFusionStyle::drawControl(ControlElement element, const QStyleOption *optio
proxy()->drawItemText(painter, menuItem->rect.adjusted(margin, 0, -margin, 0), Qt::AlignLeft | Qt::AlignVCenter,
menuItem->palette, menuItem->state & State_Enabled, menuItem->text,
QPalette::Text);
- w = menuItem->fontMetrics.width(menuItem->text) + margin;
+ w = menuItem->fontMetrics.horizontalAdvance(menuItem->text) + margin;
}
painter->setPen(shadow.lighter(106));
bool reverse = menuItem->direction == Qt::RightToLeft;
@@ -3217,7 +3217,7 @@ QSize QFusionStyle::sizeFromContents(ContentsType type, const QStyleOption *opti
QFont fontBold = menuItem->font;
fontBold.setBold(true);
QFontMetrics fmBold(fontBold);
- w += fmBold.width(menuItem->text) - fm.width(menuItem->text);
+ w += fmBold.width(menuItem->text) - fm.horizontalAdvance(menuItem->text);
}
const int checkcol = qMax<int>(maxpmw, QStyleHelper::dpiScaled(QFusionStylePrivate::menuCheckMarkWidth)); // Windows always shows a check column
w += checkcol;
diff --git a/src/widgets/styles/qfusionstyle_p.h b/src/widgets/styles/qfusionstyle_p.h
index 10f76045d5..e67e792727 100644
--- a/src/widgets/styles/qfusionstyle_p.h
+++ b/src/widgets/styles/qfusionstyle_p.h
@@ -69,41 +69,41 @@ public:
QFusionStyle();
~QFusionStyle();
- QPalette standardPalette () const Q_DECL_OVERRIDE;
+ QPalette standardPalette () const override;
void drawPrimitive(PrimitiveElement elem,
const QStyleOption *option,
- QPainter *painter, const QWidget *widget = 0) const Q_DECL_OVERRIDE;
+ QPainter *painter, const QWidget *widget = 0) const override;
void drawControl(ControlElement ce, const QStyleOption *option, QPainter *painter,
- const QWidget *widget) const Q_DECL_OVERRIDE;
- int pixelMetric(PixelMetric metric, const QStyleOption *option = 0, const QWidget *widget = 0) const Q_DECL_OVERRIDE;
+ const QWidget *widget) const override;
+ int pixelMetric(PixelMetric metric, const QStyleOption *option = 0, const QWidget *widget = 0) const override;
void drawComplexControl(ComplexControl control, const QStyleOptionComplex *option,
- QPainter *painter, const QWidget *widget) const Q_DECL_OVERRIDE;
- QRect subElementRect(SubElement r, const QStyleOption *opt, const QWidget *widget = 0) const Q_DECL_OVERRIDE;
+ QPainter *painter, const QWidget *widget) const override;
+ QRect subElementRect(SubElement r, const QStyleOption *opt, const QWidget *widget = 0) const override;
QSize sizeFromContents(ContentsType type, const QStyleOption *option,
- const QSize &size, const QWidget *widget) const Q_DECL_OVERRIDE;
+ const QSize &size, const QWidget *widget) const override;
SubControl hitTestComplexControl(ComplexControl cc, const QStyleOptionComplex *opt,
- const QPoint &pt, const QWidget *w = 0) const Q_DECL_OVERRIDE;
+ const QPoint &pt, const QWidget *w = 0) const override;
QRect subControlRect(ComplexControl cc, const QStyleOptionComplex *opt,
- SubControl sc, const QWidget *widget) const Q_DECL_OVERRIDE;
+ SubControl sc, const QWidget *widget) const override;
QPixmap generatedIconPixmap(QIcon::Mode iconMode, const QPixmap &pixmap,
- const QStyleOption *opt) const Q_DECL_OVERRIDE;
+ const QStyleOption *opt) const override;
int styleHint(StyleHint hint, const QStyleOption *option = 0, const QWidget *widget = 0,
- QStyleHintReturn *returnData = 0) const Q_DECL_OVERRIDE;
- QRect itemPixmapRect(const QRect &r, int flags, const QPixmap &pixmap) const Q_DECL_OVERRIDE;
+ QStyleHintReturn *returnData = 0) const override;
+ QRect itemPixmapRect(const QRect &r, int flags, const QPixmap &pixmap) const override;
QIcon standardIcon(StandardPixmap standardIcon, const QStyleOption *option = 0,
- const QWidget *widget = 0) const Q_DECL_OVERRIDE;
+ const QWidget *widget = 0) const override;
QPixmap standardPixmap(StandardPixmap standardPixmap, const QStyleOption *opt,
- const QWidget *widget = 0) const Q_DECL_OVERRIDE;
+ const QWidget *widget = 0) const override;
void drawItemPixmap(QPainter *painter, const QRect &rect,
- int alignment, const QPixmap &pixmap) const Q_DECL_OVERRIDE;
+ int alignment, const QPixmap &pixmap) const override;
void drawItemText(QPainter *painter, const QRect &rect,
int flags, const QPalette &pal, bool enabled,
- const QString &text, QPalette::ColorRole textRole = QPalette::NoRole) const Q_DECL_OVERRIDE;
- void polish(QWidget *widget) Q_DECL_OVERRIDE;
- void polish(QApplication *app) Q_DECL_OVERRIDE;
- void polish(QPalette &pal) Q_DECL_OVERRIDE;
- void unpolish(QWidget *widget) Q_DECL_OVERRIDE;
- void unpolish(QApplication *app) Q_DECL_OVERRIDE;
+ const QString &text, QPalette::ColorRole textRole = QPalette::NoRole) const override;
+ void polish(QWidget *widget) override;
+ void polish(QApplication *app) override;
+ void polish(QPalette &pal) override;
+ void unpolish(QWidget *widget) override;
+ void unpolish(QApplication *app) override;
protected:
QFusionStyle(QFusionStylePrivate &dd);
diff --git a/src/widgets/styles/qpixmapstyle_p.h b/src/widgets/styles/qpixmapstyle_p.h
index 618d6d2f50..590434d95e 100644
--- a/src/widgets/styles/qpixmapstyle_p.h
+++ b/src/widgets/styles/qpixmapstyle_p.h
@@ -136,34 +136,34 @@ public:
QPixmapStyle();
~QPixmapStyle();
- void polish(QApplication *application) Q_DECL_OVERRIDE;
- void polish(QPalette &palette) Q_DECL_OVERRIDE;
- void polish(QWidget *widget) Q_DECL_OVERRIDE;
- void unpolish(QApplication *application) Q_DECL_OVERRIDE;
- void unpolish(QWidget *widget) Q_DECL_OVERRIDE;
+ void polish(QApplication *application) override;
+ void polish(QPalette &palette) override;
+ void polish(QWidget *widget) override;
+ void unpolish(QApplication *application) override;
+ void unpolish(QWidget *widget) override;
void drawPrimitive(PrimitiveElement element, const QStyleOption *option,
- QPainter *painter, const QWidget *widget = Q_NULLPTR) const Q_DECL_OVERRIDE;
+ QPainter *painter, const QWidget *widget = nullptr) const override;
void drawControl(ControlElement element, const QStyleOption *option,
- QPainter *painter, const QWidget *widget = Q_NULLPTR) const Q_DECL_OVERRIDE;
+ QPainter *painter, const QWidget *widget = nullptr) const override;
void drawComplexControl(ComplexControl cc, const QStyleOptionComplex *option,
- QPainter *painter, const QWidget *widget=0) const Q_DECL_OVERRIDE;
+ QPainter *painter, const QWidget *widget=0) const override;
QSize sizeFromContents(ContentsType type, const QStyleOption *option,
- const QSize &contentsSize, const QWidget *widget = Q_NULLPTR) const Q_DECL_OVERRIDE;
+ const QSize &contentsSize, const QWidget *widget = nullptr) const override;
QRect subElementRect(SubElement element, const QStyleOption *option,
- const QWidget *widget = Q_NULLPTR) const Q_DECL_OVERRIDE;
+ const QWidget *widget = nullptr) const override;
QRect subControlRect(ComplexControl cc, const QStyleOptionComplex *option,
- SubControl sc, const QWidget *widget = Q_NULLPTR) const Q_DECL_OVERRIDE;
+ SubControl sc, const QWidget *widget = nullptr) const override;
- int pixelMetric(PixelMetric metric, const QStyleOption *option = Q_NULLPTR,
- const QWidget *widget = Q_NULLPTR) const Q_DECL_OVERRIDE;
+ int pixelMetric(PixelMetric metric, const QStyleOption *option = nullptr,
+ const QWidget *widget = nullptr) const override;
int styleHint(StyleHint hint, const QStyleOption *option,
- const QWidget *widget, QStyleHintReturn *returnData) const Q_DECL_OVERRIDE;
+ const QWidget *widget, QStyleHintReturn *returnData) const override;
SubControl hitTestComplexControl(ComplexControl control, const QStyleOptionComplex *option,
- const QPoint &pos, const QWidget *widget) const Q_DECL_OVERRIDE;
+ const QPoint &pos, const QWidget *widget) const override;
- bool eventFilter(QObject *watched, QEvent *event) Q_DECL_OVERRIDE;
+ bool eventFilter(QObject *watched, QEvent *event) override;
void addDescriptor(ControlDescriptor control, const QString &fileName,
QMargins margins = QMargins(),
diff --git a/src/widgets/styles/qproxystyle.h b/src/widgets/styles/qproxystyle.h
index 20a0f12868..c26d9abf59 100644
--- a/src/widgets/styles/qproxystyle.h
+++ b/src/widgets/styles/qproxystyle.h
@@ -54,47 +54,47 @@ class Q_WIDGETS_EXPORT QProxyStyle : public QCommonStyle
Q_OBJECT
public:
- QProxyStyle(QStyle *style = Q_NULLPTR);
+ QProxyStyle(QStyle *style = nullptr);
QProxyStyle(const QString &key);
~QProxyStyle();
QStyle *baseStyle() const;
void setBaseStyle(QStyle *style);
- void drawPrimitive(PrimitiveElement element, const QStyleOption *option, QPainter *painter, const QWidget *widget = Q_NULLPTR) const Q_DECL_OVERRIDE;
- void drawControl(ControlElement element, const QStyleOption *option, QPainter *painter, const QWidget *widget = Q_NULLPTR) const Q_DECL_OVERRIDE;
- void drawComplexControl(ComplexControl control, const QStyleOptionComplex *option, QPainter *painter, const QWidget *widget = Q_NULLPTR) const Q_DECL_OVERRIDE;
+ void drawPrimitive(PrimitiveElement element, const QStyleOption *option, QPainter *painter, const QWidget *widget = nullptr) const override;
+ void drawControl(ControlElement element, const QStyleOption *option, QPainter *painter, const QWidget *widget = nullptr) const override;
+ void drawComplexControl(ComplexControl control, const QStyleOptionComplex *option, QPainter *painter, const QWidget *widget = nullptr) const override;
void drawItemText(QPainter *painter, const QRect &rect, int flags, const QPalette &pal, bool enabled,
- const QString &text, QPalette::ColorRole textRole = QPalette::NoRole) const Q_DECL_OVERRIDE;
- virtual void drawItemPixmap(QPainter *painter, const QRect &rect, int alignment, const QPixmap &pixmap) const Q_DECL_OVERRIDE;
+ const QString &text, QPalette::ColorRole textRole = QPalette::NoRole) const override;
+ virtual void drawItemPixmap(QPainter *painter, const QRect &rect, int alignment, const QPixmap &pixmap) const override;
- QSize sizeFromContents(ContentsType type, const QStyleOption *option, const QSize &size, const QWidget *widget) const Q_DECL_OVERRIDE;
+ QSize sizeFromContents(ContentsType type, const QStyleOption *option, const QSize &size, const QWidget *widget) const override;
- QRect subElementRect(SubElement element, const QStyleOption *option, const QWidget *widget) const Q_DECL_OVERRIDE;
- QRect subControlRect(ComplexControl cc, const QStyleOptionComplex *opt, SubControl sc, const QWidget *widget) const Q_DECL_OVERRIDE;
- QRect itemTextRect(const QFontMetrics &fm, const QRect &r, int flags, bool enabled, const QString &text) const Q_DECL_OVERRIDE;
- QRect itemPixmapRect(const QRect &r, int flags, const QPixmap &pixmap) const Q_DECL_OVERRIDE;
+ QRect subElementRect(SubElement element, const QStyleOption *option, const QWidget *widget) const override;
+ QRect subControlRect(ComplexControl cc, const QStyleOptionComplex *opt, SubControl sc, const QWidget *widget) const override;
+ QRect itemTextRect(const QFontMetrics &fm, const QRect &r, int flags, bool enabled, const QString &text) const override;
+ QRect itemPixmapRect(const QRect &r, int flags, const QPixmap &pixmap) const override;
- SubControl hitTestComplexControl(ComplexControl control, const QStyleOptionComplex *option, const QPoint &pos, const QWidget *widget = Q_NULLPTR) const Q_DECL_OVERRIDE;
- int styleHint(StyleHint hint, const QStyleOption *option = Q_NULLPTR, const QWidget *widget = Q_NULLPTR, QStyleHintReturn *returnData = Q_NULLPTR) const Q_DECL_OVERRIDE;
- int pixelMetric(PixelMetric metric, const QStyleOption *option = Q_NULLPTR, const QWidget *widget = Q_NULLPTR) const Q_DECL_OVERRIDE;
+ SubControl hitTestComplexControl(ComplexControl control, const QStyleOptionComplex *option, const QPoint &pos, const QWidget *widget = nullptr) const override;
+ int styleHint(StyleHint hint, const QStyleOption *option = nullptr, const QWidget *widget = nullptr, QStyleHintReturn *returnData = nullptr) const override;
+ int pixelMetric(PixelMetric metric, const QStyleOption *option = nullptr, const QWidget *widget = nullptr) const override;
int layoutSpacing(QSizePolicy::ControlType control1, QSizePolicy::ControlType control2,
- Qt::Orientation orientation, const QStyleOption *option = Q_NULLPTR, const QWidget *widget = Q_NULLPTR) const Q_DECL_OVERRIDE;
+ Qt::Orientation orientation, const QStyleOption *option = nullptr, const QWidget *widget = nullptr) const override;
- QIcon standardIcon(StandardPixmap standardIcon, const QStyleOption *option = Q_NULLPTR, const QWidget *widget = Q_NULLPTR) const Q_DECL_OVERRIDE;
- QPixmap standardPixmap(StandardPixmap standardPixmap, const QStyleOption *opt, const QWidget *widget = Q_NULLPTR) const Q_DECL_OVERRIDE;
- QPixmap generatedIconPixmap(QIcon::Mode iconMode, const QPixmap &pixmap, const QStyleOption *opt) const Q_DECL_OVERRIDE;
- QPalette standardPalette() const Q_DECL_OVERRIDE;
+ QIcon standardIcon(StandardPixmap standardIcon, const QStyleOption *option = nullptr, const QWidget *widget = nullptr) const override;
+ QPixmap standardPixmap(StandardPixmap standardPixmap, const QStyleOption *opt, const QWidget *widget = nullptr) const override;
+ QPixmap generatedIconPixmap(QIcon::Mode iconMode, const QPixmap &pixmap, const QStyleOption *opt) const override;
+ QPalette standardPalette() const override;
- void polish(QWidget *widget) Q_DECL_OVERRIDE;
- void polish(QPalette &pal) Q_DECL_OVERRIDE;
- void polish(QApplication *app) Q_DECL_OVERRIDE;
+ void polish(QWidget *widget) override;
+ void polish(QPalette &pal) override;
+ void polish(QApplication *app) override;
- void unpolish(QWidget *widget) Q_DECL_OVERRIDE;
- void unpolish(QApplication *app) Q_DECL_OVERRIDE;
+ void unpolish(QWidget *widget) override;
+ void unpolish(QApplication *app) override;
protected:
- bool event(QEvent *e) Q_DECL_OVERRIDE;
+ bool event(QEvent *e) override;
private:
Q_DISABLE_COPY(QProxyStyle)
diff --git a/src/widgets/styles/qstyle.h b/src/widgets/styles/qstyle.h
index b4936a3e0a..f922aff7f1 100644
--- a/src/widgets/styles/qstyle.h
+++ b/src/widgets/styles/qstyle.h
@@ -202,7 +202,7 @@ public:
Q_ENUM(PrimitiveElement)
virtual void drawPrimitive(PrimitiveElement pe, const QStyleOption *opt, QPainter *p,
- const QWidget *w = Q_NULLPTR) const = 0;
+ const QWidget *w = nullptr) const = 0;
enum ControlElement {
CE_PushButton,
CE_PushButtonBevel,
@@ -273,7 +273,7 @@ public:
Q_ENUM(ControlElement)
virtual void drawControl(ControlElement element, const QStyleOption *opt, QPainter *p,
- const QWidget *w = Q_NULLPTR) const = 0;
+ const QWidget *w = nullptr) const = 0;
enum SubElement {
SE_PushButtonContents,
@@ -362,7 +362,7 @@ public:
Q_ENUM(SubElement)
virtual QRect subElementRect(SubElement subElement, const QStyleOption *option,
- const QWidget *widget = Q_NULLPTR) const = 0;
+ const QWidget *widget = nullptr) const = 0;
enum ComplexControl {
@@ -441,11 +441,11 @@ public:
virtual void drawComplexControl(ComplexControl cc, const QStyleOptionComplex *opt, QPainter *p,
- const QWidget *widget = Q_NULLPTR) const = 0;
+ const QWidget *widget = nullptr) const = 0;
virtual SubControl hitTestComplexControl(ComplexControl cc, const QStyleOptionComplex *opt,
- const QPoint &pt, const QWidget *widget = Q_NULLPTR) const = 0;
+ const QPoint &pt, const QWidget *widget = nullptr) const = 0;
virtual QRect subControlRect(ComplexControl cc, const QStyleOptionComplex *opt,
- SubControl sc, const QWidget *widget = Q_NULLPTR) const = 0;
+ SubControl sc, const QWidget *widget = nullptr) const = 0;
enum PixelMetric {
PM_ButtonMargin,
@@ -579,8 +579,8 @@ public:
};
Q_ENUM(PixelMetric)
- virtual int pixelMetric(PixelMetric metric, const QStyleOption *option = Q_NULLPTR,
- const QWidget *widget = Q_NULLPTR) const = 0;
+ virtual int pixelMetric(PixelMetric metric, const QStyleOption *option = nullptr,
+ const QWidget *widget = nullptr) const = 0;
enum ContentsType {
CT_PushButton,
@@ -612,7 +612,7 @@ public:
Q_ENUM(ContentsType)
virtual QSize sizeFromContents(ContentsType ct, const QStyleOption *opt,
- const QSize &contentsSize, const QWidget *w = Q_NULLPTR) const = 0;
+ const QSize &contentsSize, const QWidget *w = nullptr) const = 0;
enum RequestSoftwareInputPanel {
RSIP_OnMouseClickAndAlreadyFocused,
@@ -745,8 +745,8 @@ public:
};
Q_ENUM(StyleHint)
- virtual int styleHint(StyleHint stylehint, const QStyleOption *opt = Q_NULLPTR,
- const QWidget *widget = Q_NULLPTR, QStyleHintReturn* returnData = Q_NULLPTR) const = 0;
+ virtual int styleHint(StyleHint stylehint, const QStyleOption *opt = nullptr,
+ const QWidget *widget = nullptr, QStyleHintReturn* returnData = nullptr) const = 0;
enum StandardPixmap {
SP_TitleBarMenuButton,
@@ -825,11 +825,11 @@ public:
};
Q_ENUM(StandardPixmap)
- virtual QPixmap standardPixmap(StandardPixmap standardPixmap, const QStyleOption *opt = Q_NULLPTR,
- const QWidget *widget = Q_NULLPTR) const = 0;
+ virtual QPixmap standardPixmap(StandardPixmap standardPixmap, const QStyleOption *opt = nullptr,
+ const QWidget *widget = nullptr) const = 0;
- virtual QIcon standardIcon(StandardPixmap standardIcon, const QStyleOption *option = Q_NULLPTR,
- const QWidget *widget = Q_NULLPTR) const = 0;
+ virtual QIcon standardIcon(StandardPixmap standardIcon, const QStyleOption *option = nullptr,
+ const QWidget *widget = nullptr) const = 0;
virtual QPixmap generatedIconPixmap(QIcon::Mode iconMode, const QPixmap &pixmap,
const QStyleOption *opt) const = 0;
@@ -848,10 +848,10 @@ public:
virtual int layoutSpacing(QSizePolicy::ControlType control1,
QSizePolicy::ControlType control2, Qt::Orientation orientation,
- const QStyleOption *option = Q_NULLPTR, const QWidget *widget = Q_NULLPTR) const = 0;
+ const QStyleOption *option = nullptr, const QWidget *widget = nullptr) const = 0;
int combinedLayoutSpacing(QSizePolicy::ControlTypes controls1,
QSizePolicy::ControlTypes controls2, Qt::Orientation orientation,
- QStyleOption *option = Q_NULLPTR, QWidget *widget = Q_NULLPTR) const;
+ QStyleOption *option = nullptr, QWidget *widget = nullptr) const;
const QStyle * proxy() const;
diff --git a/src/widgets/styles/qstyleanimation_p.h b/src/widgets/styles/qstyleanimation_p.h
index bb1ab9d877..a2ad4a91da 100644
--- a/src/widgets/styles/qstyleanimation_p.h
+++ b/src/widgets/styles/qstyleanimation_p.h
@@ -70,7 +70,7 @@ public:
QObject *target() const;
- int duration() const Q_DECL_OVERRIDE;
+ int duration() const override;
void setDuration(int duration);
int delay() const;
@@ -97,7 +97,7 @@ public Q_SLOTS:
protected:
virtual bool isUpdateNeeded() const;
- virtual void updateCurrentTime(int time) Q_DECL_OVERRIDE;
+ virtual void updateCurrentTime(int time) override;
private:
int _delay;
@@ -121,7 +121,7 @@ public:
void setSpeed(int speed);
protected:
- bool isUpdateNeeded() const Q_DECL_OVERRIDE;
+ bool isUpdateNeeded() const override;
private:
int _speed;
@@ -144,7 +144,7 @@ public:
qreal currentValue() const;
protected:
- bool isUpdateNeeded() const Q_DECL_OVERRIDE;
+ bool isUpdateNeeded() const override;
private:
qreal _start;
@@ -170,7 +170,7 @@ public:
QImage currentImage() const;
protected:
- virtual void updateCurrentTime(int time) Q_DECL_OVERRIDE;
+ virtual void updateCurrentTime(int time) override;
private:
Type _type;
@@ -194,7 +194,7 @@ public:
void setActive(bool active);
private slots:
- void updateCurrentTime(int time) Q_DECL_OVERRIDE;
+ void updateCurrentTime(int time) override;
private:
Mode _mode;
diff --git a/src/widgets/styles/qstyleoption.h b/src/widgets/styles/qstyleoption.h
index f703c56917..2880917510 100644
--- a/src/widgets/styles/qstyleoption.h
+++ b/src/widgets/styles/qstyleoption.h
@@ -682,7 +682,7 @@ T qstyleoption_cast(const QStyleOption *opt)
|| (int(Opt::Type) == QStyleOption::SO_Complex
&& opt->type > QStyleOption::SO_Complex)))
return static_cast<T>(opt);
- return Q_NULLPTR;
+ return nullptr;
}
template <typename T>
@@ -694,7 +694,7 @@ T qstyleoption_cast(QStyleOption *opt)
|| (int(Opt::Type) == QStyleOption::SO_Complex
&& opt->type > QStyleOption::SO_Complex)))
return static_cast<T>(opt);
- return Q_NULLPTR;
+ return nullptr;
}
// -------------------------- QStyleHintReturn -------------------------------
@@ -743,7 +743,7 @@ T qstyleoption_cast(const QStyleHintReturn *hint)
if (hint && hint->version <= Opt::Version &&
(hint->type == Opt::Type || int(Opt::Type) == QStyleHintReturn::SH_Default))
return static_cast<T>(hint);
- return Q_NULLPTR;
+ return nullptr;
}
template <typename T>
@@ -753,7 +753,7 @@ T qstyleoption_cast(QStyleHintReturn *hint)
if (hint && hint->version <= Opt::Version &&
(hint->type == Opt::Type || int(Opt::Type) == QStyleHintReturn::SH_Default))
return static_cast<T>(hint);
- return Q_NULLPTR;
+ return nullptr;
}
#if !defined(QT_NO_DEBUG_STREAM)
diff --git a/src/widgets/styles/qstylepainter.h b/src/widgets/styles/qstylepainter.h
index 191360727e..b5e7956cb1 100644
--- a/src/widgets/styles/qstylepainter.h
+++ b/src/widgets/styles/qstylepainter.h
@@ -51,7 +51,7 @@ QT_BEGIN_NAMESPACE
class QStylePainter : public QPainter
{
public:
- inline QStylePainter() : QPainter(), widget(Q_NULLPTR), wstyle(Q_NULLPTR) {}
+ inline QStylePainter() : QPainter(), widget(nullptr), wstyle(nullptr) {}
inline explicit QStylePainter(QWidget *w) { begin(w, w); }
inline QStylePainter(QPaintDevice *pd, QWidget *w) { begin(pd, w); }
inline bool begin(QWidget *w) { return begin(w, w); }
diff --git a/src/widgets/styles/qstyleplugin.h b/src/widgets/styles/qstyleplugin.h
index d44f57d208..e9a26f9127 100644
--- a/src/widgets/styles/qstyleplugin.h
+++ b/src/widgets/styles/qstyleplugin.h
@@ -55,7 +55,7 @@ class Q_WIDGETS_EXPORT QStylePlugin : public QObject
{
Q_OBJECT
public:
- explicit QStylePlugin(QObject *parent = Q_NULLPTR);
+ explicit QStylePlugin(QObject *parent = nullptr);
~QStylePlugin();
virtual QStyle *create(const QString &key) = 0;
diff --git a/src/widgets/styles/qstylesheetstyle.cpp b/src/widgets/styles/qstylesheetstyle.cpp
index 494b28c909..14f81afe83 100644
--- a/src/widgets/styles/qstylesheetstyle.cpp
+++ b/src/widgets/styles/qstylesheetstyle.cpp
@@ -833,7 +833,7 @@ QHash<QStyle::SubControl, QRect> QStyleSheetStyle::titleBarLayout(const QWidget
continue;
}
if (info.element == PseudoElement_TitleBar) {
- info.width = tb->fontMetrics.width(tb->text) + 6;
+ info.width = tb->fontMetrics.horizontalAdvance(tb->text) + 6;
subRule.geo = new QStyleSheetGeometryData(info.width, tb->fontMetrics.height(), -1, -1, -1, -1);
} else {
subRule = renderRule(w, tb, info.element);
@@ -1463,7 +1463,7 @@ class QStyleSheetStyleSelector : public StyleSelector
public:
QStyleSheetStyleSelector() { }
- QStringList nodeNames(NodePtr node) const Q_DECL_OVERRIDE
+ QStringList nodeNames(NodePtr node) const override
{
if (isNullNode(node))
return QStringList();
@@ -1479,7 +1479,7 @@ public:
} while (metaObject != 0);
return result;
}
- QString attribute(NodePtr node, const QString& name) const Q_DECL_OVERRIDE
+ QString attribute(NodePtr node, const QString& name) const override
{
if (isNullNode(node))
return QString();
@@ -1516,7 +1516,7 @@ public:
cache[name] = valueStr;
return valueStr;
}
- bool nodeNameEquals(NodePtr node, const QString& nodeName) const Q_DECL_OVERRIDE
+ bool nodeNameEquals(NodePtr node, const QString& nodeName) const override
{
if (isNullNode(node))
return false;
@@ -1539,19 +1539,19 @@ public:
} while (metaObject != 0);
return false;
}
- bool hasAttributes(NodePtr) const Q_DECL_OVERRIDE
+ bool hasAttributes(NodePtr) const override
{ return true; }
- QStringList nodeIds(NodePtr node) const Q_DECL_OVERRIDE
+ QStringList nodeIds(NodePtr node) const override
{ return isNullNode(node) ? QStringList() : QStringList(OBJECT_PTR(node)->objectName()); }
- bool isNullNode(NodePtr node) const Q_DECL_OVERRIDE
+ bool isNullNode(NodePtr node) const override
{ return node.ptr == 0; }
- NodePtr parentNode(NodePtr node) const Q_DECL_OVERRIDE
+ NodePtr parentNode(NodePtr node) const override
{ NodePtr n; n.ptr = isNullNode(node) ? 0 : parentObject(OBJECT_PTR(node)); return n; }
- NodePtr previousSiblingNode(NodePtr) const Q_DECL_OVERRIDE
+ NodePtr previousSiblingNode(NodePtr) const override
{ NodePtr n; n.ptr = 0; return n; }
- NodePtr duplicateNode(NodePtr node) const Q_DECL_OVERRIDE
+ NodePtr duplicateNode(NodePtr node) const override
{ return node; }
- void freeNode(NodePtr) const Q_DECL_OVERRIDE
+ void freeNode(NodePtr) const override
{ }
private:
@@ -4262,7 +4262,7 @@ void QStyleSheetStyle::drawPrimitive(PrimitiveElement pe, const QStyleOption *op
switch (pe) {
case PE_FrameStatusBar: {
- QRenderRule subRule = renderRule(w ? w->parentWidget() : Q_NULLPTR, opt, PseudoElement_Item);
+ QRenderRule subRule = renderRule(w ? w->parentWidget() : nullptr, opt, PseudoElement_Item);
if (subRule.hasDrawable()) {
subRule.drawRule(p, opt->rect);
return;
@@ -5485,7 +5485,7 @@ QRect QStyleSheetStyle::subControlRect(ComplexControl cc, const QStyleOptionComp
groupBox.rect = rule.borderRect(opt->rect);
return baseStyle()->subControlRect(cc, &groupBox, sc, w);
}
- int tw = opt->fontMetrics.width(gb->text);
+ int tw = opt->fontMetrics.horizontalAdvance(gb->text);
int th = opt->fontMetrics.height();
int spacing = pixelMetric(QStyle::PM_CheckBoxLabelSpacing, opt, w);
int iw = pixelMetric(QStyle::PM_IndicatorWidth, opt, w);
diff --git a/src/widgets/styles/qstylesheetstyle_p.h b/src/widgets/styles/qstylesheetstyle_p.h
index 2d302305bd..042abf5c22 100644
--- a/src/widgets/styles/qstylesheetstyle_p.h
+++ b/src/widgets/styles/qstylesheetstyle_p.h
@@ -82,48 +82,48 @@ public:
~QStyleSheetStyle();
void drawComplexControl(ComplexControl cc, const QStyleOptionComplex *opt, QPainter *p,
- const QWidget *w = 0) const Q_DECL_OVERRIDE;
+ const QWidget *w = 0) const override;
void drawControl(ControlElement element, const QStyleOption *opt, QPainter *p,
- const QWidget *w = 0) const Q_DECL_OVERRIDE;
- void drawItemPixmap(QPainter *painter, const QRect &rect, int alignment, const QPixmap &pixmap) const Q_DECL_OVERRIDE;
+ const QWidget *w = 0) const override;
+ void drawItemPixmap(QPainter *painter, const QRect &rect, int alignment, const QPixmap &pixmap) const override;
void drawItemText(QPainter *painter, const QRect& rect, int alignment, const QPalette &pal,
- bool enabled, const QString& text, QPalette::ColorRole textRole = QPalette::NoRole) const Q_DECL_OVERRIDE;
+ bool enabled, const QString& text, QPalette::ColorRole textRole = QPalette::NoRole) const override;
void drawPrimitive(PrimitiveElement pe, const QStyleOption *opt, QPainter *p,
- const QWidget *w = 0) const Q_DECL_OVERRIDE;
+ const QWidget *w = 0) const override;
QPixmap generatedIconPixmap(QIcon::Mode iconMode, const QPixmap &pixmap,
- const QStyleOption *option) const Q_DECL_OVERRIDE;
+ const QStyleOption *option) const override;
SubControl hitTestComplexControl(ComplexControl cc, const QStyleOptionComplex *opt,
- const QPoint &pt, const QWidget *w = 0) const Q_DECL_OVERRIDE;
- QRect itemPixmapRect(const QRect &rect, int alignment, const QPixmap &pixmap) const Q_DECL_OVERRIDE;
+ const QPoint &pt, const QWidget *w = 0) const override;
+ QRect itemPixmapRect(const QRect &rect, int alignment, const QPixmap &pixmap) const override;
QRect itemTextRect(const QFontMetrics &metrics, const QRect &rect, int alignment, bool enabled,
- const QString &text) const Q_DECL_OVERRIDE;
- int pixelMetric(PixelMetric metric, const QStyleOption *option = 0, const QWidget *widget = 0) const Q_DECL_OVERRIDE;
- void polish(QWidget *widget) Q_DECL_OVERRIDE;
- void polish(QApplication *app) Q_DECL_OVERRIDE;
- void polish(QPalette &pal) Q_DECL_OVERRIDE;
+ const QString &text) const override;
+ int pixelMetric(PixelMetric metric, const QStyleOption *option = 0, const QWidget *widget = 0) const override;
+ void polish(QWidget *widget) override;
+ void polish(QApplication *app) override;
+ void polish(QPalette &pal) override;
QSize sizeFromContents(ContentsType ct, const QStyleOption *opt,
- const QSize &contentsSize, const QWidget *widget = 0) const Q_DECL_OVERRIDE;
- QPalette standardPalette() const Q_DECL_OVERRIDE;
+ const QSize &contentsSize, const QWidget *widget = 0) const override;
+ QPalette standardPalette() const override;
QIcon standardIcon(StandardPixmap standardIcon, const QStyleOption *opt = 0,
- const QWidget *widget = 0) const Q_DECL_OVERRIDE;
+ const QWidget *widget = 0) const override;
QPixmap standardPixmap(StandardPixmap standardPixmap, const QStyleOption *option = 0,
- const QWidget *w = 0 ) const Q_DECL_OVERRIDE;
+ const QWidget *w = 0 ) const override;
int layoutSpacing(QSizePolicy::ControlType control1, QSizePolicy::ControlType control2,
Qt::Orientation orientation, const QStyleOption *option = 0,
- const QWidget *widget = 0) const Q_DECL_OVERRIDE;
+ const QWidget *widget = 0) const override;
int styleHint(StyleHint sh, const QStyleOption *opt = 0, const QWidget *w = 0,
- QStyleHintReturn *shret = 0) const Q_DECL_OVERRIDE;
- QRect subElementRect(SubElement r, const QStyleOption *opt, const QWidget *widget = 0) const Q_DECL_OVERRIDE;
+ QStyleHintReturn *shret = 0) const override;
+ QRect subElementRect(SubElement r, const QStyleOption *opt, const QWidget *widget = 0) const override;
QRect subControlRect(ComplexControl cc, const QStyleOptionComplex *opt, SubControl sc,
- const QWidget *w = 0) const Q_DECL_OVERRIDE;
+ const QWidget *w = 0) const override;
// These functions are called from QApplication/QWidget. Be careful.
QStyle *baseStyle() const;
void repolish(QWidget *widget);
void repolish(QApplication *app);
- void unpolish(QWidget *widget) Q_DECL_OVERRIDE;
- void unpolish(QApplication *app) Q_DECL_OVERRIDE;
+ void unpolish(QWidget *widget) override;
+ void unpolish(QApplication *app) override;
QStyle *base;
void ref() { ++refcount; }
@@ -136,7 +136,7 @@ public:
bool styleSheetPalette(const QWidget* w, const QStyleOption* opt, QPalette* pal);
protected:
- bool event(QEvent *e) Q_DECL_OVERRIDE;
+ bool event(QEvent *e) override;
private:
int refcount;
diff --git a/src/widgets/styles/qwindowsstyle.cpp b/src/widgets/styles/qwindowsstyle.cpp
index 657166fc8d..7a84a4dcf8 100644
--- a/src/widgets/styles/qwindowsstyle.cpp
+++ b/src/widgets/styles/qwindowsstyle.cpp
@@ -380,7 +380,7 @@ int QWindowsStylePrivate::fixedPixelMetric(QStyle::PixelMetric pm)
static QWindow *windowOf(const QWidget *w)
{
- QWindow *result = Q_NULLPTR;
+ QWindow *result = nullptr;
if (w) {
result = w->windowHandle();
if (!result) {
@@ -2388,7 +2388,7 @@ QSize QWindowsStyle::sizeFromContents(ContentsType ct, const QStyleOption *opt,
QFont fontBold = mi->font;
fontBold.setBold(true);
QFontMetrics fmBold(fontBold);
- w += fmBold.width(mi->text) - fm.width(mi->text);
+ w += fmBold.horizontalAdvance(mi->text) - fm.horizontalAdvance(mi->text);
}
int checkcol = qMax<int>(maxpmw, QWindowsStylePrivate::windowsCheckMarkWidth); // Windows always shows a check column
diff --git a/src/widgets/styles/qwindowsstyle_p.h b/src/widgets/styles/qwindowsstyle_p.h
index 12a682f330..7993b9f1c6 100644
--- a/src/widgets/styles/qwindowsstyle_p.h
+++ b/src/widgets/styles/qwindowsstyle_p.h
@@ -68,37 +68,37 @@ public:
QWindowsStyle();
~QWindowsStyle();
- void polish(QApplication*) Q_DECL_OVERRIDE;
- void unpolish(QApplication*) Q_DECL_OVERRIDE;
+ void polish(QApplication*) override;
+ void unpolish(QApplication*) override;
- void polish(QWidget*) Q_DECL_OVERRIDE;
- void unpolish(QWidget*) Q_DECL_OVERRIDE;
+ void polish(QWidget*) override;
+ void unpolish(QWidget*) override;
- void polish(QPalette &) Q_DECL_OVERRIDE;
+ void polish(QPalette &) override;
void drawPrimitive(PrimitiveElement pe, const QStyleOption *opt, QPainter *p,
- const QWidget *w = 0) const Q_DECL_OVERRIDE;
+ const QWidget *w = 0) const override;
void drawControl(ControlElement element, const QStyleOption *opt, QPainter *p,
- const QWidget *w = 0) const Q_DECL_OVERRIDE;
- QRect subElementRect(SubElement r, const QStyleOption *opt, const QWidget *widget = 0) const Q_DECL_OVERRIDE;
+ const QWidget *w = 0) const override;
+ QRect subElementRect(SubElement r, const QStyleOption *opt, const QWidget *widget = 0) const override;
void drawComplexControl(ComplexControl cc, const QStyleOptionComplex *opt, QPainter *p,
- const QWidget *w = 0) const Q_DECL_OVERRIDE;
+ const QWidget *w = 0) const override;
QSize sizeFromContents(ContentsType ct, const QStyleOption *opt,
- const QSize &contentsSize, const QWidget *widget = 0) const Q_DECL_OVERRIDE;
+ const QSize &contentsSize, const QWidget *widget = 0) const override;
- int pixelMetric(PixelMetric pm, const QStyleOption *option = 0, const QWidget *widget = 0) const Q_DECL_OVERRIDE;
+ int pixelMetric(PixelMetric pm, const QStyleOption *option = 0, const QWidget *widget = 0) const override;
int styleHint(StyleHint hint, const QStyleOption *opt = 0, const QWidget *widget = 0,
- QStyleHintReturn *returnData = 0) const Q_DECL_OVERRIDE;
+ QStyleHintReturn *returnData = 0) const override;
QPixmap standardPixmap(StandardPixmap standardPixmap, const QStyleOption *opt,
- const QWidget *widget = 0) const Q_DECL_OVERRIDE;
+ const QWidget *widget = 0) const override;
QIcon standardIcon(StandardPixmap standardIcon, const QStyleOption *option = 0,
- const QWidget *widget = 0) const Q_DECL_OVERRIDE;
+ const QWidget *widget = 0) const override;
protected:
- bool eventFilter(QObject *o, QEvent *e) Q_DECL_OVERRIDE;
+ bool eventFilter(QObject *o, QEvent *e) override;
QWindowsStyle(QWindowsStylePrivate &dd);
private:
diff --git a/src/widgets/styles/qwindowsstyle_p_p.h b/src/widgets/styles/qwindowsstyle_p_p.h
index 8b387b6ab9..67fa6a2f86 100644
--- a/src/widgets/styles/qwindowsstyle_p_p.h
+++ b/src/widgets/styles/qwindowsstyle_p_p.h
@@ -73,7 +73,7 @@ public:
static int fixedPixelMetric(QStyle::PixelMetric pm);
static qreal devicePixelRatio(const QWidget *widget = 0)
{ return widget ? widget->devicePixelRatioF() : QWindowsStylePrivate::appDevicePixelRatio(); }
- static qreal nativeMetricScaleFactor(const QWidget *widget = Q_NULLPTR);
+ static qreal nativeMetricScaleFactor(const QWidget *widget = nullptr);
bool hasSeenAlt(const QWidget *widget) const;
bool altDown() const { return alt_down; }
diff --git a/src/widgets/util/qcompleter.h b/src/widgets/util/qcompleter.h
index 1a2c2440f5..de79302e15 100644
--- a/src/widgets/util/qcompleter.h
+++ b/src/widgets/util/qcompleter.h
@@ -82,10 +82,10 @@ public:
CaseInsensitivelySortedModel
};
- QCompleter(QObject *parent = Q_NULLPTR);
- QCompleter(QAbstractItemModel *model, QObject *parent = Q_NULLPTR);
+ QCompleter(QObject *parent = nullptr);
+ QCompleter(QAbstractItemModel *model, QObject *parent = nullptr);
#ifndef QT_NO_STRINGLISTMODEL
- QCompleter(const QStringList& completions, QObject *parent = Q_NULLPTR);
+ QCompleter(const QStringList& completions, QObject *parent = nullptr);
#endif
~QCompleter();
@@ -142,8 +142,8 @@ public:
virtual QStringList splitPath(const QString &path) const;
protected:
- bool eventFilter(QObject *o, QEvent *e) Q_DECL_OVERRIDE;
- bool event(QEvent *) Q_DECL_OVERRIDE;
+ bool eventFilter(QObject *o, QEvent *e) override;
+ bool event(QEvent *) override;
Q_SIGNALS:
void activated(const QString &text);
diff --git a/src/widgets/util/qcompleter_p.h b/src/widgets/util/qcompleter_p.h
index e76dcdc8bc..765363744b 100644
--- a/src/widgets/util/qcompleter_p.h
+++ b/src/widgets/util/qcompleter_p.h
@@ -177,7 +177,7 @@ class QSortedModelEngine : public QCompletionEngine
{
public:
QSortedModelEngine(QCompleterPrivate *c) : QCompletionEngine(c) { }
- QMatchData filter(const QString&, const QModelIndex&, int) Q_DECL_OVERRIDE;
+ QMatchData filter(const QString&, const QModelIndex&, int) override;
QIndexMapper indexHint(QString, const QModelIndex&, Qt::SortOrder);
Qt::SortOrder sortOrder(const QModelIndex&) const;
};
@@ -187,8 +187,8 @@ class QUnsortedModelEngine : public QCompletionEngine
public:
QUnsortedModelEngine(QCompleterPrivate *c) : QCompletionEngine(c) { }
- void filterOnDemand(int) Q_DECL_OVERRIDE;
- QMatchData filter(const QString&, const QModelIndex&, int) Q_DECL_OVERRIDE;
+ void filterOnDemand(int) override;
+ QMatchData filter(const QString&, const QModelIndex&, int) override;
private:
int buildIndices(const QString& str, const QModelIndex& parent, int n,
const QIndexMapper& iv, QMatchData* m);
@@ -199,7 +199,7 @@ class QCompleterItemDelegate : public QItemDelegate
public:
QCompleterItemDelegate(QAbstractItemView *view)
: QItemDelegate(view), view(view) { }
- void paint(QPainter *p, const QStyleOptionViewItem& opt, const QModelIndex& idx) const Q_DECL_OVERRIDE {
+ void paint(QPainter *p, const QStyleOptionViewItem& opt, const QModelIndex& idx) const override {
QStyleOptionViewItem optCopy = opt;
optCopy.showDecorationSelected = true;
if (view->currentIndex() == idx)
@@ -228,16 +228,16 @@ public:
bool setCurrentRow(int row);
QModelIndex currentIndex(bool) const;
- QModelIndex index(int row, int column, const QModelIndex & = QModelIndex()) const Q_DECL_OVERRIDE;
- int rowCount(const QModelIndex &index = QModelIndex()) const Q_DECL_OVERRIDE;
- int columnCount(const QModelIndex &index = QModelIndex()) const Q_DECL_OVERRIDE;
- bool hasChildren(const QModelIndex &parent = QModelIndex()) const Q_DECL_OVERRIDE;
- QModelIndex parent(const QModelIndex & = QModelIndex()) const Q_DECL_OVERRIDE { return QModelIndex(); }
- QVariant data(const QModelIndex& index, int role = Qt::DisplayRole) const Q_DECL_OVERRIDE;
+ QModelIndex index(int row, int column, const QModelIndex & = QModelIndex()) const override;
+ int rowCount(const QModelIndex &index = QModelIndex()) const override;
+ int columnCount(const QModelIndex &index = QModelIndex()) const override;
+ bool hasChildren(const QModelIndex &parent = QModelIndex()) const override;
+ QModelIndex parent(const QModelIndex & = QModelIndex()) const override { return QModelIndex(); }
+ QVariant data(const QModelIndex& index, int role = Qt::DisplayRole) const override;
- void setSourceModel(QAbstractItemModel *sourceModel) Q_DECL_OVERRIDE;
- QModelIndex mapToSource(const QModelIndex& proxyIndex) const Q_DECL_OVERRIDE;
- QModelIndex mapFromSource(const QModelIndex& sourceIndex) const Q_DECL_OVERRIDE;
+ void setSourceModel(QAbstractItemModel *sourceModel) override;
+ QModelIndex mapToSource(const QModelIndex& proxyIndex) const override;
+ QModelIndex mapFromSource(const QModelIndex& sourceIndex) const override;
QCompleterPrivate *c;
QScopedPointer<QCompletionEngine> engine;
diff --git a/src/widgets/util/qflickgesture.cpp b/src/widgets/util/qflickgesture.cpp
index 549b130c9d..b59fe0d504 100644
--- a/src/widgets/util/qflickgesture.cpp
+++ b/src/widgets/util/qflickgesture.cpp
@@ -256,7 +256,7 @@ public:
}
protected:
- void timerEvent(QTimerEvent *e) Q_DECL_OVERRIDE
+ void timerEvent(QTimerEvent *e) override
{
if (e->timerId() == pressDelayTimer) {
if (pressDelayEvent && mouseTarget) {
diff --git a/src/widgets/util/qscroller.cpp b/src/widgets/util/qscroller.cpp
index d8ac686fb9..4f5cf55a64 100644
--- a/src/widgets/util/qscroller.cpp
+++ b/src/widgets/util/qscroller.cpp
@@ -58,6 +58,7 @@
#include <QGraphicsView>
#endif
#include <QDesktopWidget>
+#include <private/qdesktopwidget_p.h>
#include <QVector2D>
#include <QtCore/qmath.h>
#include <QtGui/qevent.h>
@@ -198,7 +199,7 @@ public:
: QAbstractAnimation(_d), d(_d), ignoreUpdate(false), skip(0)
{ }
- int duration() const Q_DECL_OVERRIDE
+ int duration() const override
{
return -1;
}
@@ -214,7 +215,7 @@ public:
}
protected:
- void updateCurrentTime(int /*currentTime*/) Q_DECL_OVERRIDE
+ void updateCurrentTime(int /*currentTime*/) override
{
if (!ignoreUpdate) {
if (++skip >= d->frameRateSkip()) {
@@ -280,10 +281,9 @@ private:
*/
typedef QMap<QObject *, QScroller *> ScrollerHash;
-typedef QSet<QScroller *> ScrollerSet;
Q_GLOBAL_STATIC(ScrollerHash, qt_allScrollers)
-Q_GLOBAL_STATIC(ScrollerSet, qt_activeScrollers)
+Q_GLOBAL_STATIC(QList<QScroller *>, qt_activeScrollers)
/*!
Returns \c true if a QScroller object was already created for \a target; \c false otherwise.
@@ -334,7 +334,7 @@ const QScroller *QScroller::scroller(const QObject *target)
*/
QList<QScroller *> QScroller::activeScrollers()
{
- return qt_activeScrollers()->toList();
+ return *qt_activeScrollers();
}
/*!
@@ -511,7 +511,7 @@ QScroller::~QScroller()
d->recognizer = 0;
#endif
qt_allScrollers()->remove(d->target);
- qt_activeScrollers()->remove(this);
+ qt_activeScrollers()->removeOne(this);
delete d_ptr;
}
@@ -1013,40 +1013,6 @@ bool QScroller::handleInput(Input input, const QPointF &position, qint64 timesta
return false;
}
-#if 1 // Used to be excluded in Qt4 for Q_WS_MAC
-// the Mac version is implemented in qscroller_mac.mm
-
-QPointF QScrollerPrivate::realDpi(int screen) const
-{
-# if 0 /* Used to be included in Qt4 for Q_WS_X11 */ && !defined(QT_NO_XRANDR)
- if (X11 && X11->use_xrandr && X11->ptrXRRSizes && X11->ptrXRRRootToScreen) {
- int nsizes = 0;
- // QDesktopWidget is based on Xinerama screens, which do not always
- // correspond to RandR screens: NVidia's TwinView e.g. will show up
- // as 2 screens in QDesktopWidget, but libXRandR will only see 1 screen.
- // (although with the combined size of the Xinerama screens).
- // Additionally, libXrandr will simply crash when calling XRRSizes
- // for (the non-existent) screen 1 in this scenario.
- Window root = RootWindow(X11->display, screen == -1 ? X11->defaultScreen : screen);
- int randrscreen = (root != XNone) ? X11->ptrXRRRootToScreen(X11->display, root) : -1;
-
- XRRScreenSize *sizes = X11->ptrXRRSizes(X11->display, randrscreen == -1 ? 0 : randrscreen, &nsizes);
- if (nsizes > 0 && sizes && sizes->width && sizes->height && sizes->mwidth && sizes->mheight) {
- qScrollerDebug() << "XRandR DPI:" << QPointF(qreal(25.4) * qreal(sizes->width) / qreal(sizes->mwidth),
- qreal(25.4) * qreal(sizes->height) / qreal(sizes->mheight));
- return QPointF(qreal(25.4) * qreal(sizes->width) / qreal(sizes->mwidth),
- qreal(25.4) * qreal(sizes->height) / qreal(sizes->mheight));
- }
- }
-# endif
-
- QWidget *w = QApplication::desktop()->screen(screen);
- return QPointF(w->physicalDpiX(), w->physicalDpiY());
-}
-
-#endif
-
-
/*! \internal
Returns the resolution of the used screen.
*/
@@ -1071,8 +1037,8 @@ void QScrollerPrivate::setDpi(const QPointF &dpi)
*/
void QScrollerPrivate::setDpiFromWidget(QWidget *widget)
{
- QDesktopWidget *dw = QApplication::desktop();
- setDpi(realDpi(widget ? dw->screenNumber(widget) : dw->primaryScreen()));
+ const QScreen *screen = QGuiApplication::screens().at(QApplication::desktop()->screenNumber(widget));
+ setDpi(QPointF(screen->physicalDotsPerInchX(), screen->physicalDotsPerInchY()));
}
/*! \internal
@@ -1767,9 +1733,9 @@ void QScrollerPrivate::setState(QScroller::State newstate)
firstScroll = true;
}
if (state == QScroller::Dragging || state == QScroller::Scrolling)
- qt_activeScrollers()->insert(q);
+ qt_activeScrollers()->push_back(q);
else
- qt_activeScrollers()->remove(q);
+ qt_activeScrollers()->removeOne(q);
emit q->stateChanged(state);
}
diff --git a/src/widgets/util/qscroller_p.h b/src/widgets/util/qscroller_p.h
index 4557e7cc33..5e0c359514 100644
--- a/src/widgets/util/qscroller_p.h
+++ b/src/widgets/util/qscroller_p.h
@@ -119,7 +119,6 @@ public:
bool prepareScrolling(const QPointF &position);
void handleDrag(const QPointF &position, qint64 timestamp);
- QPointF realDpi(int screen) const;
QPointF dpi() const;
void setDpi(const QPointF &dpi);
void setDpiFromWidget(QWidget *widget);
diff --git a/src/widgets/util/qsystemtrayicon.h b/src/widgets/util/qsystemtrayicon.h
index 81f396ed83..e4652b742c 100644
--- a/src/widgets/util/qsystemtrayicon.h
+++ b/src/widgets/util/qsystemtrayicon.h
@@ -66,8 +66,8 @@ class Q_WIDGETS_EXPORT QSystemTrayIcon : public QObject
Q_PROPERTY(bool visible READ isVisible WRITE setVisible DESIGNABLE false)
public:
- QSystemTrayIcon(QObject *parent = Q_NULLPTR);
- QSystemTrayIcon(const QIcon &icon, QObject *parent = Q_NULLPTR);
+ QSystemTrayIcon(QObject *parent = nullptr);
+ QSystemTrayIcon(const QIcon &icon, QObject *parent = nullptr);
~QSystemTrayIcon();
enum ActivationReason {
@@ -110,7 +110,7 @@ Q_SIGNALS:
void messageClicked();
protected:
- bool event(QEvent *event) Q_DECL_OVERRIDE;
+ bool event(QEvent *event) override;
private:
Q_DISABLE_COPY(QSystemTrayIcon)
diff --git a/src/widgets/util/qsystemtrayicon_p.h b/src/widgets/util/qsystemtrayicon_p.h
index 318edbd1e3..5bdf020a47 100644
--- a/src/widgets/util/qsystemtrayicon_p.h
+++ b/src/widgets/util/qsystemtrayicon_p.h
@@ -127,10 +127,10 @@ private:
void balloon(const QPoint&, int, bool);
protected:
- void paintEvent(QPaintEvent *) Q_DECL_OVERRIDE;
- void resizeEvent(QResizeEvent *) Q_DECL_OVERRIDE;
- void mousePressEvent(QMouseEvent *e) Q_DECL_OVERRIDE;
- void timerEvent(QTimerEvent *e) Q_DECL_OVERRIDE;
+ void paintEvent(QPaintEvent *) override;
+ void resizeEvent(QResizeEvent *) override;
+ void mousePressEvent(QMouseEvent *e) override;
+ void timerEvent(QTimerEvent *e) override;
private:
QSystemTrayIcon *trayIcon;
diff --git a/src/widgets/util/qsystemtrayicon_x11.cpp b/src/widgets/util/qsystemtrayicon_x11.cpp
index cd593d8d98..df93e15f80 100644
--- a/src/widgets/util/qsystemtrayicon_x11.cpp
+++ b/src/widgets/util/qsystemtrayicon_x11.cpp
@@ -87,12 +87,12 @@ public:
QRect globalGeometry() const;
protected:
- virtual void mousePressEvent(QMouseEvent *ev) Q_DECL_OVERRIDE;
- virtual void mouseDoubleClickEvent(QMouseEvent *ev) Q_DECL_OVERRIDE;
- virtual bool event(QEvent *) Q_DECL_OVERRIDE;
- virtual void paintEvent(QPaintEvent *) Q_DECL_OVERRIDE;
- virtual void resizeEvent(QResizeEvent *) Q_DECL_OVERRIDE;
- virtual void moveEvent(QMoveEvent *) Q_DECL_OVERRIDE;
+ virtual void mousePressEvent(QMouseEvent *ev) override;
+ virtual void mouseDoubleClickEvent(QMouseEvent *ev) override;
+ virtual bool event(QEvent *) override;
+ virtual void paintEvent(QPaintEvent *) override;
+ virtual void resizeEvent(QResizeEvent *) override;
+ virtual void moveEvent(QMoveEvent *) override;
private slots:
void systemTrayWindowChanged(QScreen *screen);
diff --git a/src/widgets/util/qundogroup.h b/src/widgets/util/qundogroup.h
index dba79ea706..1845f7e057 100644
--- a/src/widgets/util/qundogroup.h
+++ b/src/widgets/util/qundogroup.h
@@ -58,7 +58,7 @@ class Q_WIDGETS_EXPORT QUndoGroup : public QObject
Q_DECLARE_PRIVATE(QUndoGroup)
public:
- explicit QUndoGroup(QObject *parent = Q_NULLPTR);
+ explicit QUndoGroup(QObject *parent = nullptr);
~QUndoGroup();
void addStack(QUndoStack *stack);
diff --git a/src/widgets/util/qundostack.h b/src/widgets/util/qundostack.h
index 7ab90b507a..4be24eadab 100644
--- a/src/widgets/util/qundostack.h
+++ b/src/widgets/util/qundostack.h
@@ -57,8 +57,8 @@ class Q_WIDGETS_EXPORT QUndoCommand
QUndoCommandPrivate *d;
public:
- explicit QUndoCommand(QUndoCommand *parent = Q_NULLPTR);
- explicit QUndoCommand(const QString &text, QUndoCommand *parent = Q_NULLPTR);
+ explicit QUndoCommand(QUndoCommand *parent = nullptr);
+ explicit QUndoCommand(const QString &text, QUndoCommand *parent = nullptr);
virtual ~QUndoCommand();
virtual void undo();
@@ -92,7 +92,7 @@ class Q_WIDGETS_EXPORT QUndoStack : public QObject
Q_PROPERTY(int undoLimit READ undoLimit WRITE setUndoLimit)
public:
- explicit QUndoStack(QObject *parent = Q_NULLPTR);
+ explicit QUndoStack(QObject *parent = nullptr);
~QUndoStack();
void clear();
diff --git a/src/widgets/util/qundoview.cpp b/src/widgets/util/qundoview.cpp
index b56aa42aed..31f6c0dff2 100644
--- a/src/widgets/util/qundoview.cpp
+++ b/src/widgets/util/qundoview.cpp
@@ -59,11 +59,11 @@ public:
QUndoStack *stack() const;
virtual QModelIndex index(int row, int column,
- const QModelIndex &parent = QModelIndex()) const Q_DECL_OVERRIDE;
- virtual QModelIndex parent(const QModelIndex &child) const Q_DECL_OVERRIDE;
- virtual int rowCount(const QModelIndex &parent = QModelIndex()) const Q_DECL_OVERRIDE;
- virtual int columnCount(const QModelIndex &parent = QModelIndex()) const Q_DECL_OVERRIDE;
- virtual QVariant data(const QModelIndex &index, int role = Qt::DisplayRole) const Q_DECL_OVERRIDE;
+ const QModelIndex &parent = QModelIndex()) const override;
+ virtual QModelIndex parent(const QModelIndex &child) const override;
+ virtual int rowCount(const QModelIndex &parent = QModelIndex()) const override;
+ virtual int columnCount(const QModelIndex &parent = QModelIndex()) const override;
+ virtual QVariant data(const QModelIndex &index, int role = Qt::DisplayRole) const override;
QModelIndex selectedIndex() const;
QItemSelectionModel *selectionModel() const;
diff --git a/src/widgets/util/qundoview.h b/src/widgets/util/qundoview.h
index 0bfcdd0c18..403f05d2e4 100644
--- a/src/widgets/util/qundoview.h
+++ b/src/widgets/util/qundoview.h
@@ -62,10 +62,10 @@ class Q_WIDGETS_EXPORT QUndoView : public QListView
Q_PROPERTY(QIcon cleanIcon READ cleanIcon WRITE setCleanIcon)
public:
- explicit QUndoView(QWidget *parent = Q_NULLPTR);
- explicit QUndoView(QUndoStack *stack, QWidget *parent = Q_NULLPTR);
+ explicit QUndoView(QWidget *parent = nullptr);
+ explicit QUndoView(QUndoStack *stack, QWidget *parent = nullptr);
#if QT_CONFIG(undogroup)
- explicit QUndoView(QUndoGroup *group, QWidget *parent = Q_NULLPTR);
+ explicit QUndoView(QUndoGroup *group, QWidget *parent = nullptr);
#endif
~QUndoView();
diff --git a/src/widgets/widgets.pro b/src/widgets/widgets.pro
index 22bdf08408..27d7fe9874 100644
--- a/src/widgets/widgets.pro
+++ b/src/widgets/widgets.pro
@@ -5,7 +5,6 @@ MODULE_CONFIG = uic
CONFIG += $$MODULE_CONFIG
DEFINES += QT_NO_USING_NAMESPACE
win32-msvc*|win32-icc:QMAKE_LFLAGS += /BASE:0x65000000
-irix-cc*:QMAKE_CXXFLAGS += -no_prelink -ptused
QMAKE_DOCS = $$PWD/doc/qtwidgets.qdocconf
diff --git a/src/widgets/widgets/qabstractbutton.h b/src/widgets/widgets/qabstractbutton.h
index 01dbf4e92d..e8dee142f2 100644
--- a/src/widgets/widgets/qabstractbutton.h
+++ b/src/widgets/widgets/qabstractbutton.h
@@ -72,7 +72,7 @@ class Q_WIDGETS_EXPORT QAbstractButton : public QWidget
Q_PROPERTY(bool down READ isDown WRITE setDown DESIGNABLE false)
public:
- explicit QAbstractButton(QWidget *parent = Q_NULLPTR);
+ explicit QAbstractButton(QWidget *parent = nullptr);
~QAbstractButton();
void setText(const QString &text);
@@ -126,25 +126,25 @@ Q_SIGNALS:
void toggled(bool checked);
protected:
- void paintEvent(QPaintEvent *e) Q_DECL_OVERRIDE = 0;
+ void paintEvent(QPaintEvent *e) override = 0;
virtual bool hitButton(const QPoint &pos) const;
virtual void checkStateSet();
virtual void nextCheckState();
- bool event(QEvent *e) Q_DECL_OVERRIDE;
- void keyPressEvent(QKeyEvent *e) Q_DECL_OVERRIDE;
- void keyReleaseEvent(QKeyEvent *e) Q_DECL_OVERRIDE;
- void mousePressEvent(QMouseEvent *e) Q_DECL_OVERRIDE;
- void mouseReleaseEvent(QMouseEvent *e) Q_DECL_OVERRIDE;
- void mouseMoveEvent(QMouseEvent *e) Q_DECL_OVERRIDE;
- void focusInEvent(QFocusEvent *e) Q_DECL_OVERRIDE;
- void focusOutEvent(QFocusEvent *e) Q_DECL_OVERRIDE;
- void changeEvent(QEvent *e) Q_DECL_OVERRIDE;
- void timerEvent(QTimerEvent *e) Q_DECL_OVERRIDE;
+ bool event(QEvent *e) override;
+ void keyPressEvent(QKeyEvent *e) override;
+ void keyReleaseEvent(QKeyEvent *e) override;
+ void mousePressEvent(QMouseEvent *e) override;
+ void mouseReleaseEvent(QMouseEvent *e) override;
+ void mouseMoveEvent(QMouseEvent *e) override;
+ void focusInEvent(QFocusEvent *e) override;
+ void focusOutEvent(QFocusEvent *e) override;
+ void changeEvent(QEvent *e) override;
+ void timerEvent(QTimerEvent *e) override;
protected:
- QAbstractButton(QAbstractButtonPrivate &dd, QWidget* parent = Q_NULLPTR);
+ QAbstractButton(QAbstractButtonPrivate &dd, QWidget* parent = nullptr);
private:
Q_DECLARE_PRIVATE(QAbstractButton)
diff --git a/src/widgets/widgets/qabstractscrollarea.h b/src/widgets/widgets/qabstractscrollarea.h
index cee8481e6f..8a17036fb2 100644
--- a/src/widgets/widgets/qabstractscrollarea.h
+++ b/src/widgets/widgets/qabstractscrollarea.h
@@ -61,7 +61,7 @@ class Q_WIDGETS_EXPORT QAbstractScrollArea : public QFrame
Q_PROPERTY(SizeAdjustPolicy sizeAdjustPolicy READ sizeAdjustPolicy WRITE setSizeAdjustPolicy)
public:
- explicit QAbstractScrollArea(QWidget *parent = Q_NULLPTR);
+ explicit QAbstractScrollArea(QWidget *parent = nullptr);
~QAbstractScrollArea();
enum SizeAdjustPolicy {
@@ -91,9 +91,9 @@ public:
void setViewport(QWidget *widget);
QSize maximumViewportSize() const;
- QSize minimumSizeHint() const Q_DECL_OVERRIDE;
+ QSize minimumSizeHint() const override;
- QSize sizeHint() const Q_DECL_OVERRIDE;
+ QSize sizeHint() const override;
virtual void setupViewport(QWidget *viewport);
@@ -101,35 +101,35 @@ public:
void setSizeAdjustPolicy(SizeAdjustPolicy policy);
protected:
- QAbstractScrollArea(QAbstractScrollAreaPrivate &dd, QWidget *parent = Q_NULLPTR);
+ QAbstractScrollArea(QAbstractScrollAreaPrivate &dd, QWidget *parent = nullptr);
void setViewportMargins(int left, int top, int right, int bottom);
void setViewportMargins(const QMargins &margins);
QMargins viewportMargins() const;
- bool eventFilter(QObject *, QEvent *) Q_DECL_OVERRIDE;
- bool event(QEvent *) Q_DECL_OVERRIDE;
+ bool eventFilter(QObject *, QEvent *) override;
+ bool event(QEvent *) override;
virtual bool viewportEvent(QEvent *);
- void resizeEvent(QResizeEvent *) Q_DECL_OVERRIDE;
- void paintEvent(QPaintEvent *) Q_DECL_OVERRIDE;
- void mousePressEvent(QMouseEvent *) Q_DECL_OVERRIDE;
- void mouseReleaseEvent(QMouseEvent *) Q_DECL_OVERRIDE;
- void mouseDoubleClickEvent(QMouseEvent *) Q_DECL_OVERRIDE;
- void mouseMoveEvent(QMouseEvent *) Q_DECL_OVERRIDE;
+ void resizeEvent(QResizeEvent *) override;
+ void paintEvent(QPaintEvent *) override;
+ void mousePressEvent(QMouseEvent *) override;
+ void mouseReleaseEvent(QMouseEvent *) override;
+ void mouseDoubleClickEvent(QMouseEvent *) override;
+ void mouseMoveEvent(QMouseEvent *) override;
#if QT_CONFIG(wheelevent)
- void wheelEvent(QWheelEvent *) Q_DECL_OVERRIDE;
+ void wheelEvent(QWheelEvent *) override;
#endif
#ifndef QT_NO_CONTEXTMENU
- void contextMenuEvent(QContextMenuEvent *) Q_DECL_OVERRIDE;
+ void contextMenuEvent(QContextMenuEvent *) override;
#endif
#ifndef QT_NO_DRAGANDDROP
- void dragEnterEvent(QDragEnterEvent *) Q_DECL_OVERRIDE;
- void dragMoveEvent(QDragMoveEvent *) Q_DECL_OVERRIDE;
- void dragLeaveEvent(QDragLeaveEvent *) Q_DECL_OVERRIDE;
- void dropEvent(QDropEvent *) Q_DECL_OVERRIDE;
+ void dragEnterEvent(QDragEnterEvent *) override;
+ void dragMoveEvent(QDragMoveEvent *) override;
+ void dragLeaveEvent(QDragLeaveEvent *) override;
+ void dropEvent(QDropEvent *) override;
#endif
- void keyPressEvent(QKeyEvent *) Q_DECL_OVERRIDE;
+ void keyPressEvent(QKeyEvent *) override;
virtual void scrollContentsBy(int dx, int dy);
diff --git a/src/widgets/widgets/qabstractscrollarea_p.h b/src/widgets/widgets/qabstractscrollarea_p.h
index 49f97bcb61..732a2ab40d 100644
--- a/src/widgets/widgets/qabstractscrollarea_p.h
+++ b/src/widgets/widgets/qabstractscrollarea_p.h
@@ -125,7 +125,7 @@ class QAbstractScrollAreaFilter : public QObject
public:
QAbstractScrollAreaFilter(QAbstractScrollAreaPrivate *p) : d(p)
{ setObjectName(QLatin1String("qt_abstractscrollarea_filter")); }
- bool eventFilter(QObject *o, QEvent *e) Q_DECL_OVERRIDE
+ bool eventFilter(QObject *o, QEvent *e) override
{ return (o == d->viewport ? d->viewportEvent(e) : false); }
private:
QAbstractScrollAreaPrivate *d;
diff --git a/src/widgets/widgets/qabstractslider.h b/src/widgets/widgets/qabstractslider.h
index d26d6a879c..7791d30d10 100644
--- a/src/widgets/widgets/qabstractslider.h
+++ b/src/widgets/widgets/qabstractslider.h
@@ -67,7 +67,7 @@ class Q_WIDGETS_EXPORT QAbstractSlider : public QWidget
Q_PROPERTY(bool sliderDown READ isSliderDown WRITE setSliderDown DESIGNABLE false)
public:
- explicit QAbstractSlider(QWidget *parent = Q_NULLPTR);
+ explicit QAbstractSlider(QWidget *parent = nullptr);
~QAbstractSlider();
Qt::Orientation orientation() const;
@@ -131,7 +131,7 @@ Q_SIGNALS:
void actionTriggered(int action);
protected:
- bool event(QEvent *e) Q_DECL_OVERRIDE;
+ bool event(QEvent *e) override;
void setRepeatAction(SliderAction action, int thresholdTime = 500, int repeatTime = 50);
SliderAction repeatAction() const;
@@ -144,16 +144,16 @@ protected:
};
virtual void sliderChange(SliderChange change);
- void keyPressEvent(QKeyEvent *ev) Q_DECL_OVERRIDE;
- void timerEvent(QTimerEvent *) Q_DECL_OVERRIDE;
+ void keyPressEvent(QKeyEvent *ev) override;
+ void timerEvent(QTimerEvent *) override;
#if QT_CONFIG(wheelevent)
- void wheelEvent(QWheelEvent *e) Q_DECL_OVERRIDE;
+ void wheelEvent(QWheelEvent *e) override;
#endif
- void changeEvent(QEvent *e) Q_DECL_OVERRIDE;
+ void changeEvent(QEvent *e) override;
protected:
- QAbstractSlider(QAbstractSliderPrivate &dd, QWidget *parent = Q_NULLPTR);
+ QAbstractSlider(QAbstractSliderPrivate &dd, QWidget *parent = nullptr);
private:
Q_DISABLE_COPY(QAbstractSlider)
diff --git a/src/widgets/widgets/qabstractspinbox.cpp b/src/widgets/widgets/qabstractspinbox.cpp
index 3427579d1f..61526916f1 100644
--- a/src/widgets/widgets/qabstractspinbox.cpp
+++ b/src/widgets/widgets/qabstractspinbox.cpp
@@ -870,15 +870,15 @@ QSize QAbstractSpinBox::sizeHint() const
s = d->textFromValue(d->minimum);
s.truncate(18);
s += fixedContent;
- w = qMax(w, fm.width(s));
+ w = qMax(w, fm.horizontalAdvance(s));
s = d->textFromValue(d->maximum);
s.truncate(18);
s += fixedContent;
- w = qMax(w, fm.width(s));
+ w = qMax(w, fm.horizontalAdvance(s));
if (d->specialValueText.size()) {
s = d->specialValueText;
- w = qMax(w, fm.width(s));
+ w = qMax(w, fm.horizontalAdvance(s));
}
w += 2; // cursor blinking space
@@ -911,15 +911,15 @@ QSize QAbstractSpinBox::minimumSizeHint() const
s = d->textFromValue(d->minimum);
s.truncate(18);
s += fixedContent;
- w = qMax(w, fm.width(s));
+ w = qMax(w, fm.horizontalAdvance(s));
s = d->textFromValue(d->maximum);
s.truncate(18);
s += fixedContent;
- w = qMax(w, fm.width(s));
+ w = qMax(w, fm.horizontalAdvance(s));
if (d->specialValueText.size()) {
s = d->specialValueText;
- w = qMax(w, fm.width(s));
+ w = qMax(w, fm.horizontalAdvance(s));
}
w += 2; // cursor blinking space
diff --git a/src/widgets/widgets/qabstractspinbox.h b/src/widgets/widgets/qabstractspinbox.h
index 88735baf1c..83bf83d779 100644
--- a/src/widgets/widgets/qabstractspinbox.h
+++ b/src/widgets/widgets/qabstractspinbox.h
@@ -70,7 +70,7 @@ class Q_WIDGETS_EXPORT QAbstractSpinBox : public QWidget
Q_PROPERTY(bool keyboardTracking READ keyboardTracking WRITE setKeyboardTracking)
Q_PROPERTY(bool showGroupSeparator READ isGroupSeparatorShown WRITE setGroupSeparatorShown)
public:
- explicit QAbstractSpinBox(QWidget *parent = Q_NULLPTR);
+ explicit QAbstractSpinBox(QWidget *parent = nullptr);
~QAbstractSpinBox();
enum StepEnabledFlag { StepNone = 0x00, StepUpEnabled = 0x01,
@@ -162,7 +162,7 @@ protected:
Q_SIGNALS:
void editingFinished();
protected:
- QAbstractSpinBox(QAbstractSpinBoxPrivate &dd, QWidget *parent = Q_NULLPTR);
+ QAbstractSpinBox(QAbstractSpinBoxPrivate &dd, QWidget *parent = nullptr);
private:
Q_PRIVATE_SLOT(d_func(), void _q_editorTextChanged(const QString &))
diff --git a/src/widgets/widgets/qbuttongroup.h b/src/widgets/widgets/qbuttongroup.h
index 1b4f2377ae..fec94ccb3e 100644
--- a/src/widgets/widgets/qbuttongroup.h
+++ b/src/widgets/widgets/qbuttongroup.h
@@ -57,7 +57,7 @@ class Q_WIDGETS_EXPORT QButtonGroup : public QObject
Q_PROPERTY(bool exclusive READ exclusive WRITE setExclusive)
public:
- explicit QButtonGroup(QObject *parent = Q_NULLPTR);
+ explicit QButtonGroup(QObject *parent = nullptr);
~QButtonGroup();
void setExclusive(bool);
diff --git a/src/widgets/widgets/qcalendarwidget.cpp b/src/widgets/widgets/qcalendarwidget.cpp
index 94911d1cb1..059fb21295 100644
--- a/src/widgets/widgets/qcalendarwidget.cpp
+++ b/src/widgets/widgets/qcalendarwidget.cpp
@@ -115,11 +115,11 @@ class QCalendarDayValidator : public QCalendarDateSectionValidator
public:
QCalendarDayValidator();
- virtual Section handleKey(int key) Q_DECL_OVERRIDE;
- virtual QDate applyToDate(const QDate &date) const Q_DECL_OVERRIDE;
- virtual void setDate(const QDate &date) Q_DECL_OVERRIDE;
- virtual QString text() const Q_DECL_OVERRIDE;
- virtual QString text(const QDate &date, int repeat) const Q_DECL_OVERRIDE;
+ virtual Section handleKey(int key) override;
+ virtual QDate applyToDate(const QDate &date) const override;
+ virtual void setDate(const QDate &date) override;
+ virtual QString text() const override;
+ virtual QString text(const QDate &date, int repeat) const override;
private:
int m_pos;
int m_day;
@@ -223,11 +223,11 @@ class QCalendarMonthValidator : public QCalendarDateSectionValidator
public:
QCalendarMonthValidator();
- virtual Section handleKey(int key) Q_DECL_OVERRIDE;
- virtual QDate applyToDate(const QDate &date) const Q_DECL_OVERRIDE;
- virtual void setDate(const QDate &date) Q_DECL_OVERRIDE;
- virtual QString text() const Q_DECL_OVERRIDE;
- virtual QString text(const QDate &date, int repeat) const Q_DECL_OVERRIDE;
+ virtual Section handleKey(int key) override;
+ virtual QDate applyToDate(const QDate &date) const override;
+ virtual void setDate(const QDate &date) override;
+ virtual QString text() const override;
+ virtual QString text(const QDate &date, int repeat) const override;
private:
int m_pos;
int m_month;
@@ -333,11 +333,11 @@ class QCalendarYearValidator : public QCalendarDateSectionValidator
public:
QCalendarYearValidator();
- virtual Section handleKey(int key) Q_DECL_OVERRIDE;
- virtual QDate applyToDate(const QDate &date) const Q_DECL_OVERRIDE;
- virtual void setDate(const QDate &date) Q_DECL_OVERRIDE;
- virtual QString text() const Q_DECL_OVERRIDE;
- virtual QString text(const QDate &date, int repeat) const Q_DECL_OVERRIDE;
+ virtual Section handleKey(int key) override;
+ virtual QDate applyToDate(const QDate &date) const override;
+ virtual void setDate(const QDate &date) override;
+ virtual QString text() const override;
+ virtual QString text(const QDate &date, int repeat) const override;
private:
int pow10(int n);
int m_pos;
@@ -654,8 +654,8 @@ public:
void setDate(const QDate &date);
- bool eventFilter(QObject *o, QEvent *e) Q_DECL_OVERRIDE;
- void timerEvent(QTimerEvent *e) Q_DECL_OVERRIDE;
+ bool eventFilter(QObject *o, QEvent *e) override;
+ void timerEvent(QTimerEvent *e) override;
signals:
void dateChanged(const QDate &date);
@@ -861,32 +861,32 @@ class QCalendarModel : public QAbstractTableModel
public:
QCalendarModel(QObject *parent = 0);
- int rowCount(const QModelIndex &) const Q_DECL_OVERRIDE
+ int rowCount(const QModelIndex &) const override
{ return RowCount + m_firstRow; }
- int columnCount(const QModelIndex &) const Q_DECL_OVERRIDE
+ int columnCount(const QModelIndex &) const override
{ return ColumnCount + m_firstColumn; }
- QVariant data(const QModelIndex &index, int role) const Q_DECL_OVERRIDE;
- Qt::ItemFlags flags(const QModelIndex &index) const Q_DECL_OVERRIDE;
+ QVariant data(const QModelIndex &index, int role) const override;
+ Qt::ItemFlags flags(const QModelIndex &index) const override;
- bool insertRows(int row, int count, const QModelIndex &parent = QModelIndex()) Q_DECL_OVERRIDE
+ bool insertRows(int row, int count, const QModelIndex &parent = QModelIndex()) override
{
beginInsertRows(parent, row, row + count - 1);
endInsertRows();
return true;
}
- bool insertColumns(int column, int count, const QModelIndex &parent = QModelIndex()) Q_DECL_OVERRIDE
+ bool insertColumns(int column, int count, const QModelIndex &parent = QModelIndex()) override
{
beginInsertColumns(parent, column, column + count - 1);
endInsertColumns();
return true;
}
- bool removeRows(int row, int count, const QModelIndex &parent = QModelIndex()) Q_DECL_OVERRIDE
+ bool removeRows(int row, int count, const QModelIndex &parent = QModelIndex()) override
{
beginRemoveRows(parent, row, row + count - 1);
endRemoveRows();
return true;
}
- bool removeColumns(int column, int count, const QModelIndex &parent = QModelIndex()) Q_DECL_OVERRIDE
+ bool removeColumns(int column, int count, const QModelIndex &parent = QModelIndex()) override
{
beginRemoveColumns(parent, column, column + count - 1);
endRemoveColumns();
@@ -947,7 +947,7 @@ public:
void internalUpdate() { updateGeometries(); }
void setReadOnly(bool enable);
- virtual void keyboardSearch(const QString & search) Q_DECL_OVERRIDE { Q_UNUSED(search) }
+ virtual void keyboardSearch(const QString & search) override { Q_UNUSED(search) }
signals:
void showDate(const QDate &date);
@@ -955,16 +955,16 @@ signals:
void clicked(const QDate &date);
void editingFinished();
protected:
- QModelIndex moveCursor(CursorAction cursorAction, Qt::KeyboardModifiers modifiers) Q_DECL_OVERRIDE;
- void mouseDoubleClickEvent(QMouseEvent *event) Q_DECL_OVERRIDE;
- void mousePressEvent(QMouseEvent *event) Q_DECL_OVERRIDE;
- void mouseMoveEvent(QMouseEvent *event) Q_DECL_OVERRIDE;
- void mouseReleaseEvent(QMouseEvent *event) Q_DECL_OVERRIDE;
+ QModelIndex moveCursor(CursorAction cursorAction, Qt::KeyboardModifiers modifiers) override;
+ void mouseDoubleClickEvent(QMouseEvent *event) override;
+ void mousePressEvent(QMouseEvent *event) override;
+ void mouseMoveEvent(QMouseEvent *event) override;
+ void mouseReleaseEvent(QMouseEvent *event) override;
#if QT_CONFIG(wheelevent)
- void wheelEvent(QWheelEvent *event) Q_DECL_OVERRIDE;
+ void wheelEvent(QWheelEvent *event) override;
#endif
- void keyPressEvent(QKeyEvent *event) Q_DECL_OVERRIDE;
- bool event(QEvent *event) Q_DECL_OVERRIDE;
+ void keyPressEvent(QKeyEvent *event) override;
+ bool event(QEvent *event) override;
QDate handleMouseEvent(QMouseEvent *event);
public:
@@ -982,13 +982,13 @@ QCalendarModel::QCalendarModel(QObject *parent)
m_firstRow(1),
m_date(QDate::currentDate()),
m_minimumDate(QDate::fromJulianDay(1)),
- m_maximumDate(7999, 12, 31),
+ m_maximumDate(9999, 12, 31),
m_shownYear(m_date.year()),
m_shownMonth(m_date.month()),
m_firstDay(QLocale().firstDayOfWeek()),
m_horizontalHeaderFormat(QCalendarWidget::ShortDayNames),
m_weekNumbersShown(true),
- m_view(Q_NULLPTR)
+ m_view(nullptr)
{
}
@@ -1563,7 +1563,7 @@ public:
: QItemDelegate(parent), calendarWidgetPrivate(w)
{ }
virtual void paint(QPainter *painter, const QStyleOptionViewItem &option,
- const QModelIndex &index) const Q_DECL_OVERRIDE;
+ const QModelIndex &index) const override;
void paintCell(QPainter *painter, const QRect &rect, const QDate &date) const;
private:
@@ -1579,7 +1579,7 @@ public:
: QToolButton(parent)
{ }
protected:
- void paintEvent(QPaintEvent *e) Q_DECL_OVERRIDE
+ void paintEvent(QPaintEvent *e) override
{
Q_UNUSED(e)
@@ -1607,7 +1607,7 @@ class QPrevNextCalButton : public QToolButton
public:
QPrevNextCalButton(QWidget *parent) : QToolButton(parent) {}
protected:
- void paintEvent(QPaintEvent *) Q_DECL_OVERRIDE {
+ void paintEvent(QPaintEvent *) override {
QStylePainter painter(this);
QStyleOptionToolButton opt;
initStyleOption(&opt);
@@ -2196,7 +2196,7 @@ QSize QCalendarWidget::minimumSizeHint() const
} else {
for (int i = 1; i <= 7; i++) {
QFontMetrics fm(d->m_model->formatForCell(0, i).font());
- w = qMax(w, fm.width(d->m_model->dayName(d->m_model->dayOfWeekForColumn(i))) + marginH);
+ w = qMax(w, fm.horizontalAdvance(d->m_model->dayName(d->m_model->dayOfWeekForColumn(i))) + marginH);
h = qMax(h, fm.height());
}
}
@@ -2207,14 +2207,14 @@ QSize QCalendarWidget::minimumSizeHint() const
for (int i = 1; i <= 6; i++) {
QFontMetrics fm(d->m_model->formatForCell(i, 0).font());
for (int j = 1; j < end; j++)
- w = qMax(w, fm.width(QString::number(j)) + marginH);
+ w = qMax(w, fm.horizontalAdvance(QString::number(j)) + marginH);
h = qMax(h, fm.height());
}
}
QFontMetrics fm(d->m_model->formatForCell(1, 1).font());
for (int i = 1; i <= end; i++) {
- w = qMax(w, fm.width(QString::number(i)) + marginH);
+ w = qMax(w, fm.horizontalAdvance(QString::number(i)) + marginH);
h = qMax(h, fm.height());
}
diff --git a/src/widgets/widgets/qcalendarwidget.h b/src/widgets/widgets/qcalendarwidget.h
index 29e2ff698b..44ba340289 100644
--- a/src/widgets/widgets/qcalendarwidget.h
+++ b/src/widgets/widgets/qcalendarwidget.h
@@ -89,11 +89,11 @@ public:
};
Q_ENUM(SelectionMode)
- explicit QCalendarWidget(QWidget *parent = Q_NULLPTR);
+ explicit QCalendarWidget(QWidget *parent = nullptr);
~QCalendarWidget();
- virtual QSize sizeHint() const Q_DECL_OVERRIDE;
- virtual QSize minimumSizeHint() const Q_DECL_OVERRIDE;
+ virtual QSize sizeHint() const override;
+ virtual QSize minimumSizeHint() const override;
QDate selectedDate() const;
@@ -138,11 +138,11 @@ public:
void setDateEditAcceptDelay(int delay);
protected:
- bool event(QEvent *event) Q_DECL_OVERRIDE;
- bool eventFilter(QObject *watched, QEvent *event) Q_DECL_OVERRIDE;
- void mousePressEvent(QMouseEvent *event) Q_DECL_OVERRIDE;
- void resizeEvent(QResizeEvent * event) Q_DECL_OVERRIDE;
- void keyPressEvent(QKeyEvent * event) Q_DECL_OVERRIDE;
+ bool event(QEvent *event) override;
+ bool eventFilter(QObject *watched, QEvent *event) override;
+ void mousePressEvent(QMouseEvent *event) override;
+ void resizeEvent(QResizeEvent * event) override;
+ void keyPressEvent(QKeyEvent * event) override;
virtual void paintCell(QPainter *painter, const QRect &rect, const QDate &date) const;
void updateCell(const QDate &date);
diff --git a/src/widgets/widgets/qcheckbox.cpp b/src/widgets/widgets/qcheckbox.cpp
index 9b49916774..235508535d 100644
--- a/src/widgets/widgets/qcheckbox.cpp
+++ b/src/widgets/widgets/qcheckbox.cpp
@@ -45,6 +45,9 @@
#include "qstyle.h"
#include "qstyleoption.h"
#include "qevent.h"
+#ifndef QT_NO_ACCESSIBILITY
+#include "qaccessible.h"
+#endif
#include "private/qabstractbutton_p.h"
@@ -243,6 +246,9 @@ Qt::CheckState QCheckBox::checkState() const
void QCheckBox::setCheckState(Qt::CheckState state)
{
Q_D(QCheckBox);
+#ifndef QT_NO_ACCESSIBILITY
+ bool noChange = d->noChange;
+#endif
if (state == Qt::PartiallyChecked) {
d->tristate = true;
d->noChange = true;
@@ -257,6 +263,15 @@ void QCheckBox::setCheckState(Qt::CheckState state)
d->publishedState = state;
emit stateChanged(state);
}
+
+#ifndef QT_NO_ACCESSIBILITY
+ if (noChange != d->noChange) {
+ QAccessible::State s;
+ s.checkStateMixed = true;
+ QAccessibleStateChangeEvent event(this, s);
+ QAccessible::updateAccessibility(&event);
+ }
+#endif
}
diff --git a/src/widgets/widgets/qcheckbox.h b/src/widgets/widgets/qcheckbox.h
index 8543c4c86f..80cb22b82e 100644
--- a/src/widgets/widgets/qcheckbox.h
+++ b/src/widgets/widgets/qcheckbox.h
@@ -58,12 +58,12 @@ class Q_WIDGETS_EXPORT QCheckBox : public QAbstractButton
Q_PROPERTY(bool tristate READ isTristate WRITE setTristate)
public:
- explicit QCheckBox(QWidget *parent = Q_NULLPTR);
- explicit QCheckBox(const QString &text, QWidget *parent = Q_NULLPTR);
+ explicit QCheckBox(QWidget *parent = nullptr);
+ explicit QCheckBox(const QString &text, QWidget *parent = nullptr);
~QCheckBox();
- QSize sizeHint() const Q_DECL_OVERRIDE;
- QSize minimumSizeHint() const Q_DECL_OVERRIDE;
+ QSize sizeHint() const override;
+ QSize minimumSizeHint() const override;
void setTristate(bool y = true);
bool isTristate() const;
@@ -75,12 +75,12 @@ Q_SIGNALS:
void stateChanged(int);
protected:
- bool event(QEvent *e) Q_DECL_OVERRIDE;
- bool hitButton(const QPoint &pos) const Q_DECL_OVERRIDE;
- void checkStateSet() Q_DECL_OVERRIDE;
- void nextCheckState() Q_DECL_OVERRIDE;
- void paintEvent(QPaintEvent *) Q_DECL_OVERRIDE;
- void mouseMoveEvent(QMouseEvent *) Q_DECL_OVERRIDE;
+ bool event(QEvent *e) override;
+ bool hitButton(const QPoint &pos) const override;
+ void checkStateSet() override;
+ void nextCheckState() override;
+ void paintEvent(QPaintEvent *) override;
+ void mouseMoveEvent(QMouseEvent *) override;
void initStyleOption(QStyleOptionButton *option) const;
diff --git a/src/widgets/widgets/qcombobox.cpp b/src/widgets/widgets/qcombobox.cpp
index 9afb4b3ae6..b743af2569 100644
--- a/src/widgets/widgets/qcombobox.cpp
+++ b/src/widgets/widgets/qcombobox.cpp
@@ -312,7 +312,7 @@ int QComboBoxPrivate::computeWidthHint() const
const QFontMetrics &fontMetrics = q->fontMetrics();
for (int i = 0; i < count; ++i) {
- const int textWidth = fontMetrics.width(q->itemText(i));
+ const int textWidth = fontMetrics.horizontalAdvance(q->itemText(i));
if (q->itemIcon(i).isNull())
width = (qMax(width, textWidth));
else
@@ -341,7 +341,7 @@ QSize QComboBoxPrivate::recomputeSizeHint(QSize &sh) const
case QComboBox::AdjustToContents:
case QComboBox::AdjustToContentsOnFirstShow:
if (count == 0) {
- sh.rwidth() = 7 * fm.width(QLatin1Char('x'));
+ sh.rwidth() = 7 * fm.horizontalAdvance(QLatin1Char('x'));
} else {
for (int i = 0; i < count; ++i) {
if (!q->itemIcon(i).isNull()) {
@@ -364,7 +364,7 @@ QSize QComboBoxPrivate::recomputeSizeHint(QSize &sh) const
hasIcon = !q->itemIcon(i).isNull();
}
if (minimumContentsLength > 0)
- sh.setWidth(qMax(sh.width(), minimumContentsLength * fm.width(QLatin1Char('X')) + (hasIcon ? iconSize.width() + 4 : 0)));
+ sh.setWidth(qMax(sh.width(), minimumContentsLength * fm.horizontalAdvance(QLatin1Char('X')) + (hasIcon ? iconSize.width() + 4 : 0)));
// height
diff --git a/src/widgets/widgets/qcombobox.h b/src/widgets/widgets/qcombobox.h
index 59f2a425a0..671c883584 100644
--- a/src/widgets/widgets/qcombobox.h
+++ b/src/widgets/widgets/qcombobox.h
@@ -82,7 +82,7 @@ class Q_WIDGETS_EXPORT QComboBox : public QWidget
Q_PROPERTY(int modelColumn READ modelColumn WRITE setModelColumn)
public:
- explicit QComboBox(QWidget *parent = Q_NULLPTR);
+ explicit QComboBox(QWidget *parent = nullptr);
~QComboBox();
int maxVisibleItems() const;
@@ -196,14 +196,14 @@ public:
QAbstractItemView *view() const;
void setView(QAbstractItemView *itemView);
- QSize sizeHint() const Q_DECL_OVERRIDE;
- QSize minimumSizeHint() const Q_DECL_OVERRIDE;
+ QSize sizeHint() const override;
+ QSize minimumSizeHint() const override;
virtual void showPopup();
virtual void hidePopup();
- bool event(QEvent *event) Q_DECL_OVERRIDE;
- QVariant inputMethodQuery(Qt::InputMethodQuery) const Q_DECL_OVERRIDE;
+ bool event(QEvent *event) override;
+ QVariant inputMethodQuery(Qt::InputMethodQuery) const override;
Q_INVOKABLE QVariant inputMethodQuery(Qt::InputMethodQuery query, const QVariant &argument) const;
public Q_SLOTS:
@@ -224,24 +224,24 @@ Q_SIGNALS:
void currentTextChanged(const QString &);
protected:
- void focusInEvent(QFocusEvent *e) Q_DECL_OVERRIDE;
- void focusOutEvent(QFocusEvent *e) Q_DECL_OVERRIDE;
- void changeEvent(QEvent *e) Q_DECL_OVERRIDE;
- void resizeEvent(QResizeEvent *e) Q_DECL_OVERRIDE;
- void paintEvent(QPaintEvent *e) Q_DECL_OVERRIDE;
- void showEvent(QShowEvent *e) Q_DECL_OVERRIDE;
- void hideEvent(QHideEvent *e) Q_DECL_OVERRIDE;
- void mousePressEvent(QMouseEvent *e) Q_DECL_OVERRIDE;
- void mouseReleaseEvent(QMouseEvent *e) Q_DECL_OVERRIDE;
- void keyPressEvent(QKeyEvent *e) Q_DECL_OVERRIDE;
- void keyReleaseEvent(QKeyEvent *e) Q_DECL_OVERRIDE;
+ void focusInEvent(QFocusEvent *e) override;
+ void focusOutEvent(QFocusEvent *e) override;
+ void changeEvent(QEvent *e) override;
+ void resizeEvent(QResizeEvent *e) override;
+ void paintEvent(QPaintEvent *e) override;
+ void showEvent(QShowEvent *e) override;
+ void hideEvent(QHideEvent *e) override;
+ void mousePressEvent(QMouseEvent *e) override;
+ void mouseReleaseEvent(QMouseEvent *e) override;
+ void keyPressEvent(QKeyEvent *e) override;
+ void keyReleaseEvent(QKeyEvent *e) override;
#if QT_CONFIG(wheelevent)
- void wheelEvent(QWheelEvent *e) Q_DECL_OVERRIDE;
+ void wheelEvent(QWheelEvent *e) override;
#endif
#ifndef QT_NO_CONTEXTMENU
- void contextMenuEvent(QContextMenuEvent *e) Q_DECL_OVERRIDE;
+ void contextMenuEvent(QContextMenuEvent *e) override;
#endif // QT_NO_CONTEXTMENU
- void inputMethodEvent(QInputMethodEvent *) Q_DECL_OVERRIDE;
+ void inputMethodEvent(QInputMethodEvent *) override;
void initStyleOption(QStyleOptionComboBox *option) const;
diff --git a/src/widgets/widgets/qcommandlinkbutton.cpp b/src/widgets/widgets/qcommandlinkbutton.cpp
index b6ec2a8d31..68dfefb3b7 100644
--- a/src/widgets/widgets/qcommandlinkbutton.cpp
+++ b/src/widgets/widgets/qcommandlinkbutton.cpp
@@ -318,7 +318,7 @@ QSize QCommandLinkButton::sizeHint() const
QSize size = QPushButton::sizeHint();
QFontMetrics fm(d->titleFont());
- int textWidth = qMax(fm.width(text()), 135);
+ int textWidth = qMax(fm.horizontalAdvance(text()), 135);
int buttonWidth = textWidth + d->textOffset() + d->rightMargin();
int heightWithoutDescription = d->descriptionOffset() + d->bottomMargin();
diff --git a/src/widgets/widgets/qcommandlinkbutton.h b/src/widgets/widgets/qcommandlinkbutton.h
index d8215a256e..2d01d63df8 100644
--- a/src/widgets/widgets/qcommandlinkbutton.h
+++ b/src/widgets/widgets/qcommandlinkbutton.h
@@ -58,20 +58,20 @@ class Q_WIDGETS_EXPORT QCommandLinkButton: public QPushButton
Q_PROPERTY(bool flat READ isFlat WRITE setFlat DESIGNABLE false)
public:
- explicit QCommandLinkButton(QWidget *parent = Q_NULLPTR);
- explicit QCommandLinkButton(const QString &text, QWidget *parent = Q_NULLPTR);
- explicit QCommandLinkButton(const QString &text, const QString &description, QWidget *parent = Q_NULLPTR);
+ explicit QCommandLinkButton(QWidget *parent = nullptr);
+ explicit QCommandLinkButton(const QString &text, QWidget *parent = nullptr);
+ explicit QCommandLinkButton(const QString &text, const QString &description, QWidget *parent = nullptr);
~QCommandLinkButton();
QString description() const;
void setDescription(const QString &description);
protected:
- QSize sizeHint() const Q_DECL_OVERRIDE;
- int heightForWidth(int) const Q_DECL_OVERRIDE;
- QSize minimumSizeHint() const Q_DECL_OVERRIDE;
- bool event(QEvent *e) Q_DECL_OVERRIDE;
- void paintEvent(QPaintEvent *) Q_DECL_OVERRIDE;
+ QSize sizeHint() const override;
+ int heightForWidth(int) const override;
+ QSize minimumSizeHint() const override;
+ bool event(QEvent *e) override;
+ void paintEvent(QPaintEvent *) override;
private:
Q_DISABLE_COPY(QCommandLinkButton)
diff --git a/src/widgets/widgets/qdatetimeedit.cpp b/src/widgets/widgets/qdatetimeedit.cpp
index b6ec6b4065..17cea09b1f 100644
--- a/src/widgets/widgets/qdatetimeedit.cpp
+++ b/src/widgets/widgets/qdatetimeedit.cpp
@@ -363,7 +363,7 @@ void QDateTimeEdit::setMinimumDateTime(const QDateTime &dt)
clearMaximumDateTime().
By default, this property contains a date that refers to 31 December,
- 7999 and a time of 23:59:59 and 999 milliseconds.
+ 9999 and a time of 23:59:59 and 999 milliseconds.
\sa minimumDateTime(), minimumTime(), maximumTime(), minimumDate(),
maximumDate(), setDateTimeRange(), setDateRange(), setTimeRange(),
@@ -466,7 +466,7 @@ void QDateTimeEdit::clearMinimumDate()
necessary to ensure that the range remains valid. If the date is
not a valid QDate object, this function does nothing.
- By default, this property contains a date that refers to December 31, 7999.
+ By default, this property contains a date that refers to December 31, 9999.
\sa minimumDate, minimumTime, maximumTime, setDateRange()
*/
@@ -966,12 +966,12 @@ QSize QDateTimeEdit::sizeHint() const
int w = 0;
QString s;
s = d->textFromValue(d->minimum) + QLatin1Char(' ');
- w = qMax<int>(w, fm.width(s));
+ w = qMax<int>(w, fm.horizontalAdvance(s));
s = d->textFromValue(d->maximum) + QLatin1Char(' ');
- w = qMax<int>(w, fm.width(s));
+ w = qMax<int>(w, fm.horizontalAdvance(s));
if (d->specialValueText.size()) {
s = d->specialValueText;
- w = qMax<int>(w, fm.width(s));
+ w = qMax<int>(w, fm.horizontalAdvance(s));
}
w += 2; // cursor blinking space
diff --git a/src/widgets/widgets/qdatetimeedit.h b/src/widgets/widgets/qdatetimeedit.h
index b46434c1a4..b6fb35fc71 100644
--- a/src/widgets/widgets/qdatetimeedit.h
+++ b/src/widgets/widgets/qdatetimeedit.h
@@ -92,10 +92,10 @@ public:
Q_DECLARE_FLAGS(Sections, Section)
Q_FLAG(Sections)
- explicit QDateTimeEdit(QWidget *parent = Q_NULLPTR);
- explicit QDateTimeEdit(const QDateTime &dt, QWidget *parent = Q_NULLPTR);
- explicit QDateTimeEdit(const QDate &d, QWidget *parent = Q_NULLPTR);
- explicit QDateTimeEdit(const QTime &t, QWidget *parent = Q_NULLPTR);
+ explicit QDateTimeEdit(QWidget *parent = nullptr);
+ explicit QDateTimeEdit(const QDateTime &dt, QWidget *parent = nullptr);
+ explicit QDateTimeEdit(const QDate &d, QWidget *parent = nullptr);
+ explicit QDateTimeEdit(const QTime &t, QWidget *parent = nullptr);
~QDateTimeEdit();
QDateTime dateTime() const;
@@ -191,7 +191,7 @@ protected:
void paintEvent(QPaintEvent *event) override;
void initStyleOption(QStyleOptionSpinBox *option) const;
- QDateTimeEdit(const QVariant &val, QVariant::Type parserType, QWidget *parent = Q_NULLPTR);
+ QDateTimeEdit(const QVariant &val, QVariant::Type parserType, QWidget *parent = nullptr);
private:
Q_DECLARE_PRIVATE(QDateTimeEdit)
Q_DISABLE_COPY(QDateTimeEdit)
@@ -204,8 +204,8 @@ class Q_WIDGETS_EXPORT QTimeEdit : public QDateTimeEdit
Q_OBJECT
Q_PROPERTY(QTime time READ time WRITE setTime NOTIFY userTimeChanged USER true)
public:
- explicit QTimeEdit(QWidget *parent = Q_NULLPTR);
- explicit QTimeEdit(const QTime &time, QWidget *parent = Q_NULLPTR);
+ explicit QTimeEdit(QWidget *parent = nullptr);
+ explicit QTimeEdit(const QTime &time, QWidget *parent = nullptr);
~QTimeEdit();
Q_SIGNALS:
@@ -217,8 +217,8 @@ class Q_WIDGETS_EXPORT QDateEdit : public QDateTimeEdit
Q_OBJECT
Q_PROPERTY(QDate date READ date WRITE setDate NOTIFY userDateChanged USER true)
public:
- explicit QDateEdit(QWidget *parent = Q_NULLPTR);
- explicit QDateEdit(const QDate &date, QWidget *parent = Q_NULLPTR);
+ explicit QDateEdit(QWidget *parent = nullptr);
+ explicit QDateEdit(const QDate &date, QWidget *parent = nullptr);
~QDateEdit();
Q_SIGNALS:
diff --git a/src/widgets/widgets/qdatetimeedit_p.h b/src/widgets/widgets/qdatetimeedit_p.h
index 5ac5a9db6a..1ebc98dedf 100644
--- a/src/widgets/widgets/qdatetimeedit_p.h
+++ b/src/widgets/widgets/qdatetimeedit_p.h
@@ -80,25 +80,25 @@ public:
void clearSection(int index);
// Override QAbstractSpinBoxPrivate:
- void emitSignals(EmitPolicy ep, const QVariant &old) Q_DECL_OVERRIDE;
- QString textFromValue(const QVariant &f) const Q_DECL_OVERRIDE;
- QVariant valueFromText(const QString &f) const Q_DECL_OVERRIDE;
- void _q_editorCursorPositionChanged(int oldpos, int newpos) Q_DECL_OVERRIDE;
- void interpret(EmitPolicy ep) Q_DECL_OVERRIDE;
- void clearCache() const Q_DECL_OVERRIDE;
- QStyle::SubControl newHoverControl(const QPoint &pos) Q_DECL_OVERRIDE;
- void updateEditFieldGeometry() Q_DECL_OVERRIDE;
- QVariant getZeroVariant() const Q_DECL_OVERRIDE;
- void setRange(const QVariant &min, const QVariant &max) Q_DECL_OVERRIDE;
- void updateEdit() Q_DECL_OVERRIDE;
+ void emitSignals(EmitPolicy ep, const QVariant &old) override;
+ QString textFromValue(const QVariant &f) const override;
+ QVariant valueFromText(const QString &f) const override;
+ void _q_editorCursorPositionChanged(int oldpos, int newpos) override;
+ void interpret(EmitPolicy ep) override;
+ void clearCache() const override;
+ QStyle::SubControl newHoverControl(const QPoint &pos) override;
+ void updateEditFieldGeometry() override;
+ QVariant getZeroVariant() const override;
+ void setRange(const QVariant &min, const QVariant &max) override;
+ void updateEdit() override;
// Override QDateTimeParser:
- QString displayText() const Q_DECL_OVERRIDE { return edit->text(); }
- QDateTime getMinimum() const Q_DECL_OVERRIDE { return minimum.toDateTime(); }
- QDateTime getMaximum() const Q_DECL_OVERRIDE { return maximum.toDateTime(); }
- QLocale locale() const Q_DECL_OVERRIDE { return q_func()->locale(); }
- QString getAmPmText(AmPm ap, Case cs) const Q_DECL_OVERRIDE;
- int cursorPosition() const Q_DECL_OVERRIDE { return edit ? edit->cursorPosition() : -1; }
+ QString displayText() const override { return edit->text(); }
+ QDateTime getMinimum() const override { return minimum.toDateTime(); }
+ QDateTime getMaximum() const override { return maximum.toDateTime(); }
+ QLocale locale() const override { return q_func()->locale(); }
+ QString getAmPmText(AmPm ap, Case cs) const override;
+ int cursorPosition() const override { return edit ? edit->cursorPosition() : -1; }
int absoluteIndex(QDateTimeEdit::Section s, int index) const;
int absoluteIndex(const SectionNode &s) const;
diff --git a/src/widgets/widgets/qdial.cpp b/src/widgets/widgets/qdial.cpp
index c08c820127..25d57970bf 100644
--- a/src/widgets/widgets/qdial.cpp
+++ b/src/widgets/widgets/qdial.cpp
@@ -79,7 +79,7 @@ public:
int valueFromPoint(const QPoint &) const;
double angle(const QPoint &, const QPoint &) const;
void init();
- virtual int bound(int val) const Q_DECL_OVERRIDE;
+ virtual int bound(int val) const override;
};
void QDialPrivate::init()
diff --git a/src/widgets/widgets/qdial.h b/src/widgets/widgets/qdial.h
index ed753d86b0..1db1f9bb07 100644
--- a/src/widgets/widgets/qdial.h
+++ b/src/widgets/widgets/qdial.h
@@ -61,7 +61,7 @@ class Q_WIDGETS_EXPORT QDial: public QAbstractSlider
Q_PROPERTY(qreal notchTarget READ notchTarget WRITE setNotchTarget)
Q_PROPERTY(bool notchesVisible READ notchesVisible WRITE setNotchesVisible)
public:
- explicit QDial(QWidget *parent = Q_NULLPTR);
+ explicit QDial(QWidget *parent = nullptr);
~QDial();
@@ -73,23 +73,23 @@ public:
qreal notchTarget() const;
bool notchesVisible() const;
- QSize sizeHint() const Q_DECL_OVERRIDE;
- QSize minimumSizeHint() const Q_DECL_OVERRIDE;
+ QSize sizeHint() const override;
+ QSize minimumSizeHint() const override;
public Q_SLOTS:
void setNotchesVisible(bool visible);
void setWrapping(bool on);
protected:
- bool event(QEvent *e) Q_DECL_OVERRIDE;
- void resizeEvent(QResizeEvent *re) Q_DECL_OVERRIDE;
- void paintEvent(QPaintEvent *pe) Q_DECL_OVERRIDE;
+ bool event(QEvent *e) override;
+ void resizeEvent(QResizeEvent *re) override;
+ void paintEvent(QPaintEvent *pe) override;
- void mousePressEvent(QMouseEvent *me) Q_DECL_OVERRIDE;
- void mouseReleaseEvent(QMouseEvent *me) Q_DECL_OVERRIDE;
- void mouseMoveEvent(QMouseEvent *me) Q_DECL_OVERRIDE;
+ void mousePressEvent(QMouseEvent *me) override;
+ void mouseReleaseEvent(QMouseEvent *me) override;
+ void mouseMoveEvent(QMouseEvent *me) override;
- void sliderChange(SliderChange change) Q_DECL_OVERRIDE;
+ void sliderChange(SliderChange change) override;
void initStyleOption(QStyleOptionSlider *option) const;
diff --git a/src/widgets/widgets/qdialogbuttonbox.h b/src/widgets/widgets/qdialogbuttonbox.h
index 02d14dee7c..a9a1a3453d 100644
--- a/src/widgets/widgets/qdialogbuttonbox.h
+++ b/src/widgets/widgets/qdialogbuttonbox.h
@@ -117,11 +117,11 @@ public:
AndroidLayout = GnomeLayout + 2 // ### Qt 6: reorder
};
- QDialogButtonBox(QWidget *parent = Q_NULLPTR);
- QDialogButtonBox(Qt::Orientation orientation, QWidget *parent = Q_NULLPTR);
- explicit QDialogButtonBox(StandardButtons buttons, QWidget *parent = Q_NULLPTR);
+ QDialogButtonBox(QWidget *parent = nullptr);
+ QDialogButtonBox(Qt::Orientation orientation, QWidget *parent = nullptr);
+ explicit QDialogButtonBox(StandardButtons buttons, QWidget *parent = nullptr);
QDialogButtonBox(StandardButtons buttons, Qt::Orientation orientation,
- QWidget *parent = Q_NULLPTR);
+ QWidget *parent = nullptr);
~QDialogButtonBox();
void setOrientation(Qt::Orientation orientation);
@@ -151,8 +151,8 @@ Q_SIGNALS:
void rejected();
protected:
- void changeEvent(QEvent *event) Q_DECL_OVERRIDE;
- bool event(QEvent *event) Q_DECL_OVERRIDE;
+ void changeEvent(QEvent *event) override;
+ bool event(QEvent *event) override;
private:
Q_DISABLE_COPY(QDialogButtonBox)
diff --git a/src/widgets/widgets/qdockwidget.cpp b/src/widgets/widgets/qdockwidget.cpp
index bfb3a98d7e..26060052d3 100644
--- a/src/widgets/widgets/qdockwidget.cpp
+++ b/src/widgets/widgets/qdockwidget.cpp
@@ -73,7 +73,7 @@ static inline QMainWindowLayout *qt_mainwindow_layout_from_dock(const QDockWidge
return qt_mainwindow_layout(window);
p = p->parentWidget();
}
- return Q_NULLPTR;
+ return nullptr;
}
static inline bool hasFeature(const QDockWidgetPrivate *priv, QDockWidget::DockWidgetFeature feature)
@@ -120,13 +120,13 @@ class QDockWidgetTitleButton : public QAbstractButton
public:
QDockWidgetTitleButton(QDockWidget *dockWidget);
- QSize sizeHint() const Q_DECL_OVERRIDE;
- QSize minimumSizeHint() const Q_DECL_OVERRIDE
+ QSize sizeHint() const override;
+ QSize minimumSizeHint() const override
{ return sizeHint(); }
- void enterEvent(QEvent *event) Q_DECL_OVERRIDE;
- void leaveEvent(QEvent *event) Q_DECL_OVERRIDE;
- void paintEvent(QPaintEvent *event) Q_DECL_OVERRIDE;
+ void enterEvent(QEvent *event) override;
+ void leaveEvent(QEvent *event) override;
+ void paintEvent(QPaintEvent *event) override;
};
diff --git a/src/widgets/widgets/qdockwidget.h b/src/widgets/widgets/qdockwidget.h
index b53fa19a03..b53a991dae 100644
--- a/src/widgets/widgets/qdockwidget.h
+++ b/src/widgets/widgets/qdockwidget.h
@@ -63,9 +63,9 @@ class Q_WIDGETS_EXPORT QDockWidget : public QWidget
Q_PROPERTY(QString windowTitle READ windowTitle WRITE setWindowTitle DESIGNABLE true)
public:
- explicit QDockWidget(const QString &title, QWidget *parent = Q_NULLPTR,
+ explicit QDockWidget(const QString &title, QWidget *parent = nullptr,
Qt::WindowFlags flags = Qt::WindowFlags());
- explicit QDockWidget(QWidget *parent = Q_NULLPTR, Qt::WindowFlags flags = Qt::WindowFlags());
+ explicit QDockWidget(QWidget *parent = nullptr, Qt::WindowFlags flags = Qt::WindowFlags());
~QDockWidget();
QWidget *widget() const;
@@ -113,10 +113,10 @@ Q_SIGNALS:
void dockLocationChanged(Qt::DockWidgetArea area);
protected:
- void changeEvent(QEvent *event) Q_DECL_OVERRIDE;
- void closeEvent(QCloseEvent *event) Q_DECL_OVERRIDE;
- void paintEvent(QPaintEvent *event) Q_DECL_OVERRIDE;
- bool event(QEvent *event) Q_DECL_OVERRIDE;
+ void changeEvent(QEvent *event) override;
+ void closeEvent(QCloseEvent *event) override;
+ void paintEvent(QPaintEvent *event) override;
+ bool event(QEvent *event) override;
void initStyleOption(QStyleOptionDockWidget *option) const;
private:
diff --git a/src/widgets/widgets/qdockwidget_p.h b/src/widgets/widgets/qdockwidget_p.h
index 2c16176c37..e35fd17fc2 100644
--- a/src/widgets/widgets/qdockwidget_p.h
+++ b/src/widgets/widgets/qdockwidget_p.h
@@ -135,18 +135,18 @@ class Q_WIDGETS_EXPORT QDockWidgetLayout : public QLayout
public:
QDockWidgetLayout(QWidget *parent = 0);
~QDockWidgetLayout();
- void addItem(QLayoutItem *item) Q_DECL_OVERRIDE;
- QLayoutItem *itemAt(int index) const Q_DECL_OVERRIDE;
- QLayoutItem *takeAt(int index) Q_DECL_OVERRIDE;
- int count() const Q_DECL_OVERRIDE;
+ void addItem(QLayoutItem *item) override;
+ QLayoutItem *itemAt(int index) const override;
+ QLayoutItem *takeAt(int index) override;
+ int count() const override;
- QSize maximumSize() const Q_DECL_OVERRIDE;
- QSize minimumSize() const Q_DECL_OVERRIDE;
- QSize sizeHint() const Q_DECL_OVERRIDE;
+ QSize maximumSize() const override;
+ QSize minimumSize() const override;
+ QSize sizeHint() const override;
QSize sizeFromContent(const QSize &content, bool floating) const;
- void setGeometry(const QRect &r) Q_DECL_OVERRIDE;
+ void setGeometry(const QRect &r) override;
enum Role { Content, CloseButton, FloatButton, TitleBar, RoleCount };
QWidget *widgetForRole(Role r) const;
@@ -178,9 +178,9 @@ class QDockWidgetItem : public QWidgetItem
{
public:
QDockWidgetItem(QDockWidget *dockWidget);
- QSize minimumSize() const Q_DECL_OVERRIDE;
- QSize maximumSize() const Q_DECL_OVERRIDE;
- QSize sizeHint() const Q_DECL_OVERRIDE;
+ QSize minimumSize() const override;
+ QSize maximumSize() const override;
+ QSize sizeHint() const override;
private:
inline QLayoutItem *dockWidgetChildItem() const;
diff --git a/src/widgets/widgets/qeffects.cpp b/src/widgets/widgets/qeffects.cpp
index d4ef33966b..bcc8d7815d 100644
--- a/src/widgets/widgets/qeffects.cpp
+++ b/src/widgets/widgets/qeffects.cpp
@@ -71,10 +71,10 @@ public:
void run(int time);
protected:
- void paintEvent(QPaintEvent* e) Q_DECL_OVERRIDE;
- void closeEvent(QCloseEvent*) Q_DECL_OVERRIDE;
+ void paintEvent(QPaintEvent* e) override;
+ void closeEvent(QCloseEvent*) override;
void alphaBlend();
- bool eventFilter(QObject *, QEvent *) Q_DECL_OVERRIDE;
+ bool eventFilter(QObject *, QEvent *) override;
protected slots:
void render();
@@ -98,9 +98,12 @@ static QAlphaWidget* q_blend = 0;
/*
Constructs a QAlphaWidget.
*/
+QT_WARNING_PUSH
+QT_WARNING_DISABLE_DEPRECATED // QDesktopWidget::screen()
QAlphaWidget::QAlphaWidget(QWidget* w, Qt::WindowFlags f)
: QWidget(QApplication::desktop()->screen(QDesktopWidgetPrivate::screenNumber(w)), f)
{
+QT_WARNING_POP
#ifndef Q_OS_WIN
setEnabled(false);
#endif
@@ -348,8 +351,8 @@ public:
void run(int time);
protected:
- void paintEvent(QPaintEvent*) Q_DECL_OVERRIDE;
- void closeEvent(QCloseEvent*) Q_DECL_OVERRIDE;
+ void paintEvent(QPaintEvent*) override;
+ void closeEvent(QCloseEvent*) override;
private slots:
void scroll();
diff --git a/src/widgets/widgets/qfocusframe.h b/src/widgets/widgets/qfocusframe.h
index a1fc6d345d..73d5b42bd8 100644
--- a/src/widgets/widgets/qfocusframe.h
+++ b/src/widgets/widgets/qfocusframe.h
@@ -53,17 +53,17 @@ class Q_WIDGETS_EXPORT QFocusFrame : public QWidget
{
Q_OBJECT
public:
- QFocusFrame(QWidget *parent = Q_NULLPTR);
+ QFocusFrame(QWidget *parent = nullptr);
~QFocusFrame();
void setWidget(QWidget *widget);
QWidget *widget() const;
protected:
- bool event(QEvent *e) Q_DECL_OVERRIDE;
+ bool event(QEvent *e) override;
- bool eventFilter(QObject *, QEvent *) Q_DECL_OVERRIDE;
- void paintEvent(QPaintEvent *) Q_DECL_OVERRIDE;
+ bool eventFilter(QObject *, QEvent *) override;
+ void paintEvent(QPaintEvent *) override;
void initStyleOption(QStyleOption *option) const;
private:
diff --git a/src/widgets/widgets/qfontcombobox.cpp b/src/widgets/widgets/qfontcombobox.cpp
index 1c56c19c8f..1d0e7cfd68 100644
--- a/src/widgets/widgets/qfontcombobox.cpp
+++ b/src/widgets/widgets/qfontcombobox.cpp
@@ -189,10 +189,10 @@ public:
// painting
void paint(QPainter *painter,
const QStyleOptionViewItem &option,
- const QModelIndex &index) const Q_DECL_OVERRIDE;
+ const QModelIndex &index) const override;
QSize sizeHint(const QStyleOptionViewItem &option,
- const QModelIndex &index) const Q_DECL_OVERRIDE;
+ const QModelIndex &index) const override;
const QIcon truetype;
const QIcon bitmap;
@@ -263,7 +263,7 @@ void QFontFamilyDelegate::paint(QPainter *painter,
system = writingSystem;
if (system != QFontDatabase::Any) {
- int w = painter->fontMetrics().width(text + QLatin1String(" "));
+ int w = painter->fontMetrics().horizontalAdvance(text + QLatin1String(" "));
painter->setFont(font2);
QString sample = QFontDatabase().writingSystemSample(system);
if (option.direction == Qt::RightToLeft)
@@ -287,7 +287,7 @@ QSize QFontFamilyDelegate::sizeHint(const QStyleOptionViewItem &option,
// font.setFamily(text);
font.setPointSize(QFontInfo(font).pointSize() * 3/2);
QFontMetrics fontMetrics(font);
- return QSize(fontMetrics.width(text), fontMetrics.height());
+ return QSize(fontMetrics.horizontalAdvance(text), fontMetrics.height());
}
@@ -554,7 +554,7 @@ QSize QFontComboBox::sizeHint() const
{
QSize sz = QComboBox::sizeHint();
QFontMetrics fm(font());
- sz.setWidth(fm.width(QLatin1Char('m'))*14);
+ sz.setWidth(fm.horizontalAdvance(QLatin1Char('m'))*14);
return sz;
}
diff --git a/src/widgets/widgets/qfontcombobox.h b/src/widgets/widgets/qfontcombobox.h
index 1e4555ce2d..6c1871dd2d 100644
--- a/src/widgets/widgets/qfontcombobox.h
+++ b/src/widgets/widgets/qfontcombobox.h
@@ -58,7 +58,7 @@ class Q_WIDGETS_EXPORT QFontComboBox : public QComboBox
Q_PROPERTY(QFont currentFont READ currentFont WRITE setCurrentFont NOTIFY currentFontChanged)
public:
- explicit QFontComboBox(QWidget *parent = Q_NULLPTR);
+ explicit QFontComboBox(QWidget *parent = nullptr);
~QFontComboBox();
void setWritingSystem(QFontDatabase::WritingSystem);
@@ -78,7 +78,7 @@ public:
FontFilters fontFilters() const;
QFont currentFont() const;
- QSize sizeHint() const Q_DECL_OVERRIDE;
+ QSize sizeHint() const override;
public Q_SLOTS:
void setCurrentFont(const QFont &f);
@@ -87,7 +87,7 @@ Q_SIGNALS:
void currentFontChanged(const QFont &f);
protected:
- bool event(QEvent *e) Q_DECL_OVERRIDE;
+ bool event(QEvent *e) override;
private:
Q_DISABLE_COPY(QFontComboBox)
diff --git a/src/widgets/widgets/qframe.h b/src/widgets/widgets/qframe.h
index 986915a28f..595dfa929d 100644
--- a/src/widgets/widgets/qframe.h
+++ b/src/widgets/widgets/qframe.h
@@ -61,7 +61,7 @@ class Q_WIDGETS_EXPORT QFrame : public QWidget
Q_PROPERTY(QRect frameRect READ frameRect WRITE setFrameRect DESIGNABLE false)
public:
- explicit QFrame(QWidget* parent = Q_NULLPTR, Qt::WindowFlags f = Qt::WindowFlags());
+ explicit QFrame(QWidget* parent = nullptr, Qt::WindowFlags f = Qt::WindowFlags());
~QFrame();
int frameStyle() const;
@@ -69,7 +69,7 @@ public:
int frameWidth() const;
- QSize sizeHint() const Q_DECL_OVERRIDE;
+ QSize sizeHint() const override;
enum Shape {
NoFrame = 0, // no frame
@@ -108,14 +108,14 @@ public:
void setFrameRect(const QRect &);
protected:
- bool event(QEvent *e) Q_DECL_OVERRIDE;
- void paintEvent(QPaintEvent *) Q_DECL_OVERRIDE;
- void changeEvent(QEvent *) Q_DECL_OVERRIDE;
+ bool event(QEvent *e) override;
+ void paintEvent(QPaintEvent *) override;
+ void changeEvent(QEvent *) override;
void drawFrame(QPainter *);
protected:
- QFrame(QFramePrivate &dd, QWidget* parent = Q_NULLPTR, Qt::WindowFlags f = Qt::WindowFlags());
+ QFrame(QFramePrivate &dd, QWidget* parent = nullptr, Qt::WindowFlags f = Qt::WindowFlags());
void initStyleOption(QStyleOptionFrame *option) const;
private:
diff --git a/src/widgets/widgets/qgroupbox.cpp b/src/widgets/widgets/qgroupbox.cpp
index 611f3f88db..69eac1ebf7 100644
--- a/src/widgets/widgets/qgroupbox.cpp
+++ b/src/widgets/widgets/qgroupbox.cpp
@@ -484,7 +484,7 @@ QSize QGroupBox::minimumSizeHint() const
QFontMetrics metrics(fontMetrics());
- int baseWidth = metrics.width(d->title) + metrics.width(QLatin1Char(' '));
+ int baseWidth = metrics.horizontalAdvance(d->title) + metrics.horizontalAdvance(QLatin1Char(' '));
int baseHeight = metrics.height();
if (d->checkable) {
baseWidth += style()->pixelMetric(QStyle::PM_IndicatorWidth);
diff --git a/src/widgets/widgets/qgroupbox.h b/src/widgets/widgets/qgroupbox.h
index 668dc03f3d..deaeba4656 100644
--- a/src/widgets/widgets/qgroupbox.h
+++ b/src/widgets/widgets/qgroupbox.h
@@ -59,8 +59,8 @@ class Q_WIDGETS_EXPORT QGroupBox : public QWidget
Q_PROPERTY(bool checkable READ isCheckable WRITE setCheckable)
Q_PROPERTY(bool checked READ isChecked WRITE setChecked DESIGNABLE isCheckable NOTIFY toggled USER true)
public:
- explicit QGroupBox(QWidget *parent = Q_NULLPTR);
- explicit QGroupBox(const QString &title, QWidget *parent = Q_NULLPTR);
+ explicit QGroupBox(QWidget *parent = nullptr);
+ explicit QGroupBox(const QString &title, QWidget *parent = nullptr);
~QGroupBox();
QString title() const;
@@ -69,7 +69,7 @@ public:
Qt::Alignment alignment() const;
void setAlignment(int alignment);
- QSize minimumSizeHint() const Q_DECL_OVERRIDE;
+ QSize minimumSizeHint() const override;
bool isFlat() const;
void setFlat(bool flat);
@@ -85,15 +85,15 @@ Q_SIGNALS:
void toggled(bool);
protected:
- bool event(QEvent *event) Q_DECL_OVERRIDE;
- void childEvent(QChildEvent *event) Q_DECL_OVERRIDE;
- void resizeEvent(QResizeEvent *event) Q_DECL_OVERRIDE;
- void paintEvent(QPaintEvent *event) Q_DECL_OVERRIDE;
- void focusInEvent(QFocusEvent *event) Q_DECL_OVERRIDE;
- void changeEvent(QEvent *event) Q_DECL_OVERRIDE;
- void mousePressEvent(QMouseEvent *event) Q_DECL_OVERRIDE;
- void mouseMoveEvent(QMouseEvent *event) Q_DECL_OVERRIDE;
- void mouseReleaseEvent(QMouseEvent *event) Q_DECL_OVERRIDE;
+ bool event(QEvent *event) override;
+ void childEvent(QChildEvent *event) override;
+ void resizeEvent(QResizeEvent *event) override;
+ void paintEvent(QPaintEvent *event) override;
+ void focusInEvent(QFocusEvent *event) override;
+ void changeEvent(QEvent *event) override;
+ void mousePressEvent(QMouseEvent *event) override;
+ void mouseMoveEvent(QMouseEvent *event) override;
+ void mouseReleaseEvent(QMouseEvent *event) override;
void initStyleOption(QStyleOptionGroupBox *option) const;
diff --git a/src/widgets/widgets/qkeysequenceedit.h b/src/widgets/widgets/qkeysequenceedit.h
index d5b4b199cd..85d76f14a3 100644
--- a/src/widgets/widgets/qkeysequenceedit.h
+++ b/src/widgets/widgets/qkeysequenceedit.h
@@ -55,8 +55,8 @@ class Q_WIDGETS_EXPORT QKeySequenceEdit : public QWidget
Q_PROPERTY(QKeySequence keySequence READ keySequence WRITE setKeySequence NOTIFY keySequenceChanged USER true)
public:
- explicit QKeySequenceEdit(QWidget *parent = Q_NULLPTR);
- explicit QKeySequenceEdit(const QKeySequence &keySequence, QWidget *parent = Q_NULLPTR);
+ explicit QKeySequenceEdit(QWidget *parent = nullptr);
+ explicit QKeySequenceEdit(const QKeySequence &keySequence, QWidget *parent = nullptr);
~QKeySequenceEdit();
QKeySequence keySequence() const;
@@ -72,10 +72,10 @@ Q_SIGNALS:
protected:
QKeySequenceEdit(QKeySequenceEditPrivate &d, QWidget *parent, Qt::WindowFlags f);
- bool event(QEvent *) Q_DECL_OVERRIDE;
- void keyPressEvent(QKeyEvent *) Q_DECL_OVERRIDE;
- void keyReleaseEvent(QKeyEvent *) Q_DECL_OVERRIDE;
- void timerEvent(QTimerEvent *) Q_DECL_OVERRIDE;
+ bool event(QEvent *) override;
+ void keyPressEvent(QKeyEvent *) override;
+ void keyReleaseEvent(QKeyEvent *) override;
+ void timerEvent(QTimerEvent *) override;
private:
Q_DISABLE_COPY(QKeySequenceEdit)
diff --git a/src/widgets/widgets/qlabel.cpp b/src/widgets/widgets/qlabel.cpp
index e3225800cc..ee4825d3e5 100644
--- a/src/widgets/widgets/qlabel.cpp
+++ b/src/widgets/widgets/qlabel.cpp
@@ -66,16 +66,16 @@ QLabelPrivate::QLabelPrivate()
sh(),
msh(),
text(),
- pixmap(Q_NULLPTR),
- scaledpixmap(Q_NULLPTR),
- cachedimage(Q_NULLPTR),
+ pixmap(nullptr),
+ scaledpixmap(nullptr),
+ cachedimage(nullptr),
#ifndef QT_NO_PICTURE
- picture(Q_NULLPTR),
+ picture(nullptr),
#endif
#if QT_CONFIG(movie)
movie(),
#endif
- control(Q_NULLPTR),
+ control(nullptr),
shortcutCursor(),
#ifndef QT_NO_CURSOR
cursor(),
@@ -583,7 +583,7 @@ QSize QLabelPrivate::sizeForWidth(int w) const
int m = indent;
if (m < 0 && q->frameWidth()) // no indent, but we do have a frame
- m = fm.width(QLatin1Char('x')) - margin*2;
+ m = fm.horizontalAdvance(QLatin1Char('x')) - margin*2;
if (m > 0) {
if ((align & Qt::AlignLeft) || (align & Qt::AlignRight))
hextra += m;
@@ -1440,7 +1440,7 @@ QRect QLabelPrivate::documentRect() const
: q->layoutDirection(), QFlag(this->align));
int m = indent;
if (m < 0 && q->frameWidth()) // no indent, but we do have a frame
- m = q->fontMetrics().width(QLatin1Char('x')) / 2 - margin;
+ m = q->fontMetrics().horizontalAdvance(QLatin1Char('x')) / 2 - margin;
if (m > 0) {
if (align & Qt::AlignLeft)
cr.setLeft(cr.left() + m);
diff --git a/src/widgets/widgets/qlabel.h b/src/widgets/widgets/qlabel.h
index 469254a145..e1cc333a1c 100644
--- a/src/widgets/widgets/qlabel.h
+++ b/src/widgets/widgets/qlabel.h
@@ -67,8 +67,8 @@ class Q_WIDGETS_EXPORT QLabel : public QFrame
Q_PROPERTY(QString selectedText READ selectedText)
public:
- explicit QLabel(QWidget *parent=Q_NULLPTR, Qt::WindowFlags f=Qt::WindowFlags());
- explicit QLabel(const QString &text, QWidget *parent=Q_NULLPTR, Qt::WindowFlags f=Qt::WindowFlags());
+ explicit QLabel(QWidget *parent=nullptr, Qt::WindowFlags f=Qt::WindowFlags());
+ explicit QLabel(const QString &text, QWidget *parent=nullptr, Qt::WindowFlags f=Qt::WindowFlags());
~QLabel();
QString text() const;
@@ -97,13 +97,13 @@ public:
bool hasScaledContents() const;
void setScaledContents(bool);
- QSize sizeHint() const Q_DECL_OVERRIDE;
- QSize minimumSizeHint() const Q_DECL_OVERRIDE;
+ QSize sizeHint() const override;
+ QSize minimumSizeHint() const override;
#ifndef QT_NO_SHORTCUT
void setBuddy(QWidget *);
QWidget *buddy() const;
#endif
- int heightForWidth(int) const Q_DECL_OVERRIDE;
+ int heightForWidth(int) const override;
bool openExternalLinks() const;
void setOpenExternalLinks(bool open);
@@ -134,19 +134,19 @@ Q_SIGNALS:
void linkHovered(const QString& link);
protected:
- bool event(QEvent *e) Q_DECL_OVERRIDE;
- void keyPressEvent(QKeyEvent *ev) Q_DECL_OVERRIDE;
- void paintEvent(QPaintEvent *) Q_DECL_OVERRIDE;
- void changeEvent(QEvent *) Q_DECL_OVERRIDE;
- void mousePressEvent(QMouseEvent *ev) Q_DECL_OVERRIDE;
- void mouseMoveEvent(QMouseEvent *ev) Q_DECL_OVERRIDE;
- void mouseReleaseEvent(QMouseEvent *ev) Q_DECL_OVERRIDE;
+ bool event(QEvent *e) override;
+ void keyPressEvent(QKeyEvent *ev) override;
+ void paintEvent(QPaintEvent *) override;
+ void changeEvent(QEvent *) override;
+ void mousePressEvent(QMouseEvent *ev) override;
+ void mouseMoveEvent(QMouseEvent *ev) override;
+ void mouseReleaseEvent(QMouseEvent *ev) override;
#ifndef QT_NO_CONTEXTMENU
- void contextMenuEvent(QContextMenuEvent *ev) Q_DECL_OVERRIDE;
+ void contextMenuEvent(QContextMenuEvent *ev) override;
#endif // QT_NO_CONTEXTMENU
- void focusInEvent(QFocusEvent *ev) Q_DECL_OVERRIDE;
- void focusOutEvent(QFocusEvent *ev) Q_DECL_OVERRIDE;
- bool focusNextPrevChild(bool next) Q_DECL_OVERRIDE;
+ void focusInEvent(QFocusEvent *ev) override;
+ void focusOutEvent(QFocusEvent *ev) override;
+ bool focusNextPrevChild(bool next) override;
private:
diff --git a/src/widgets/widgets/qlcdnumber.h b/src/widgets/widgets/qlcdnumber.h
index 28fd530e6e..644c39eaf3 100644
--- a/src/widgets/widgets/qlcdnumber.h
+++ b/src/widgets/widgets/qlcdnumber.h
@@ -59,8 +59,8 @@ class Q_WIDGETS_EXPORT QLCDNumber : public QFrame // LCD number widget
Q_PROPERTY(int intValue READ intValue WRITE display)
public:
- explicit QLCDNumber(QWidget* parent = Q_NULLPTR);
- explicit QLCDNumber(uint numDigits, QWidget* parent = Q_NULLPTR);
+ explicit QLCDNumber(QWidget* parent = nullptr);
+ explicit QLCDNumber(uint numDigits, QWidget* parent = nullptr);
~QLCDNumber();
enum Mode {
@@ -88,7 +88,7 @@ public:
double value() const;
int intValue() const;
- QSize sizeHint() const Q_DECL_OVERRIDE;
+ QSize sizeHint() const override;
public Q_SLOTS:
void display(const QString &str);
@@ -104,8 +104,8 @@ Q_SIGNALS:
void overflow();
protected:
- bool event(QEvent *e) Q_DECL_OVERRIDE;
- void paintEvent(QPaintEvent *) Q_DECL_OVERRIDE;
+ bool event(QEvent *e) override;
+ void paintEvent(QPaintEvent *) override;
public:
diff --git a/src/widgets/widgets/qlineedit.cpp b/src/widgets/widgets/qlineedit.cpp
index d0a794222e..94f13c6984 100644
--- a/src/widgets/widgets/qlineedit.cpp
+++ b/src/widgets/widgets/qlineedit.cpp
@@ -682,7 +682,7 @@ QSize QLineEdit::sizeHint() const
int h = qMax(fm.height(), 14) + 2*d->verticalMargin
+ d->topTextMargin + d->bottomTextMargin
+ d->topmargin + d->bottommargin;
- int w = fm.width(QLatin1Char('x')) * 17 + 2*d->horizontalMargin
+ int w = fm.horizontalAdvance(QLatin1Char('x')) * 17 + 2*d->horizontalMargin
+ d->effectiveLeftTextMargin() + d->effectiveRightTextMargin()
+ d->leftmargin + d->rightmargin; // "some"
QStyleOptionFrame opt;
diff --git a/src/widgets/widgets/qlineedit.h b/src/widgets/widgets/qlineedit.h
index b98307390c..099bf4bb18 100644
--- a/src/widgets/widgets/qlineedit.h
+++ b/src/widgets/widgets/qlineedit.h
@@ -90,8 +90,8 @@ public:
};
Q_ENUM(ActionPosition)
- explicit QLineEdit(QWidget *parent = Q_NULLPTR);
- explicit QLineEdit(const QString &, QWidget *parent = Q_NULLPTR);
+ explicit QLineEdit(QWidget *parent = nullptr);
+ explicit QLineEdit(const QString &, QWidget *parent = nullptr);
~QLineEdit();
QString text() const;
@@ -128,8 +128,8 @@ public:
QCompleter *completer() const;
#endif
- QSize sizeHint() const Q_DECL_OVERRIDE;
- QSize minimumSizeHint() const Q_DECL_OVERRIDE;
+ QSize sizeHint() const override;
+ QSize minimumSizeHint() const override;
int cursorPosition() const;
void setCursorPosition(int);
@@ -209,31 +209,31 @@ Q_SIGNALS:
void selectionChanged();
protected:
- void mousePressEvent(QMouseEvent *) Q_DECL_OVERRIDE;
- void mouseMoveEvent(QMouseEvent *) Q_DECL_OVERRIDE;
- void mouseReleaseEvent(QMouseEvent *) Q_DECL_OVERRIDE;
- void mouseDoubleClickEvent(QMouseEvent *) Q_DECL_OVERRIDE;
- void keyPressEvent(QKeyEvent *) Q_DECL_OVERRIDE;
- void focusInEvent(QFocusEvent *) Q_DECL_OVERRIDE;
- void focusOutEvent(QFocusEvent *) Q_DECL_OVERRIDE;
- void paintEvent(QPaintEvent *) Q_DECL_OVERRIDE;
+ void mousePressEvent(QMouseEvent *) override;
+ void mouseMoveEvent(QMouseEvent *) override;
+ void mouseReleaseEvent(QMouseEvent *) override;
+ void mouseDoubleClickEvent(QMouseEvent *) override;
+ void keyPressEvent(QKeyEvent *) override;
+ void focusInEvent(QFocusEvent *) override;
+ void focusOutEvent(QFocusEvent *) override;
+ void paintEvent(QPaintEvent *) override;
#ifndef QT_NO_DRAGANDDROP
- void dragEnterEvent(QDragEnterEvent *) Q_DECL_OVERRIDE;
- void dragMoveEvent(QDragMoveEvent *e) Q_DECL_OVERRIDE;
- void dragLeaveEvent(QDragLeaveEvent *e) Q_DECL_OVERRIDE;
- void dropEvent(QDropEvent *) Q_DECL_OVERRIDE;
+ void dragEnterEvent(QDragEnterEvent *) override;
+ void dragMoveEvent(QDragMoveEvent *e) override;
+ void dragLeaveEvent(QDragLeaveEvent *e) override;
+ void dropEvent(QDropEvent *) override;
#endif
- void changeEvent(QEvent *) Q_DECL_OVERRIDE;
+ void changeEvent(QEvent *) override;
#ifndef QT_NO_CONTEXTMENU
- void contextMenuEvent(QContextMenuEvent *) Q_DECL_OVERRIDE;
+ void contextMenuEvent(QContextMenuEvent *) override;
#endif
- void inputMethodEvent(QInputMethodEvent *) Q_DECL_OVERRIDE;
+ void inputMethodEvent(QInputMethodEvent *) override;
void initStyleOption(QStyleOptionFrame *option) const;
public:
- QVariant inputMethodQuery(Qt::InputMethodQuery) const Q_DECL_OVERRIDE;
+ QVariant inputMethodQuery(Qt::InputMethodQuery) const override;
Q_INVOKABLE QVariant inputMethodQuery(Qt::InputMethodQuery property, QVariant argument) const;
- bool event(QEvent *) Q_DECL_OVERRIDE;
+ bool event(QEvent *) override;
protected:
QRect cursorRect() const;
diff --git a/src/widgets/widgets/qlineedit_p.cpp b/src/widgets/widgets/qlineedit_p.cpp
index 5b352f5554..c66b842223 100644
--- a/src/widgets/widgets/qlineedit_p.cpp
+++ b/src/widgets/widgets/qlineedit_p.cpp
@@ -330,13 +330,13 @@ QLineEditIconButton::QLineEditIconButton(QWidget *parent)
QLineEditPrivate *QLineEditIconButton::lineEditPrivate() const
{
QLineEdit *le = qobject_cast<QLineEdit *>(parentWidget());
- return le ? static_cast<QLineEditPrivate *>(qt_widget_private(le)) : Q_NULLPTR;
+ return le ? static_cast<QLineEditPrivate *>(qt_widget_private(le)) : nullptr;
}
void QLineEditIconButton::paintEvent(QPaintEvent *)
{
QPainter painter(this);
- QWindow *window = Q_NULLPTR;
+ QWindow *window = nullptr;
if (const QWidget *nativeParent = nativeParentWidget())
window = nativeParent->windowHandle();
// Note isDown should really use the active state but in most styles
diff --git a/src/widgets/widgets/qlineedit_p.h b/src/widgets/widgets/qlineedit_p.h
index 77a91880df..a3f549ad31 100644
--- a/src/widgets/widgets/qlineedit_p.h
+++ b/src/widgets/widgets/qlineedit_p.h
@@ -94,8 +94,8 @@ public:
#endif
protected:
- void actionEvent(QActionEvent *e) Q_DECL_OVERRIDE;
- void paintEvent(QPaintEvent *event) Q_DECL_OVERRIDE;
+ void actionEvent(QActionEvent *e) override;
+ void paintEvent(QPaintEvent *event) override;
private slots:
void updateCursor();
diff --git a/src/widgets/widgets/qmaccocoaviewcontainer_mac.h b/src/widgets/widgets/qmaccocoaviewcontainer_mac.h
index d926ef8569..0de3989167 100644
--- a/src/widgets/widgets/qmaccocoaviewcontainer_mac.h
+++ b/src/widgets/widgets/qmaccocoaviewcontainer_mac.h
@@ -52,7 +52,7 @@ class Q_WIDGETS_EXPORT QMacCocoaViewContainer : public QWidget
{
Q_OBJECT
public:
- QMacCocoaViewContainer(NSView *cocoaViewToWrap, QWidget *parent = Q_NULLPTR);
+ QMacCocoaViewContainer(NSView *cocoaViewToWrap, QWidget *parent = nullptr);
virtual ~QMacCocoaViewContainer();
void setCocoaView(NSView *view);
diff --git a/src/widgets/widgets/qmacnativewidget_mac.h b/src/widgets/widgets/qmacnativewidget_mac.h
index a8faffd6be..6fd90516ac 100644
--- a/src/widgets/widgets/qmacnativewidget_mac.h
+++ b/src/widgets/widgets/qmacnativewidget_mac.h
@@ -51,7 +51,7 @@ class Q_WIDGETS_EXPORT QMacNativeWidget : public QWidget
{
Q_OBJECT
public:
- QMacNativeWidget(NSView *parentView = Q_NULLPTR);
+ QMacNativeWidget(NSView *parentView = nullptr);
~QMacNativeWidget();
QSize sizeHint() const override;
diff --git a/src/widgets/widgets/qmainwindow.h b/src/widgets/widgets/qmainwindow.h
index 50d840cf61..069683d4ac 100644
--- a/src/widgets/widgets/qmainwindow.h
+++ b/src/widgets/widgets/qmainwindow.h
@@ -91,7 +91,7 @@ public:
Q_DECLARE_FLAGS(DockOptions, DockOption)
Q_FLAG(DockOptions)
- explicit QMainWindow(QWidget *parent = Q_NULLPTR, Qt::WindowFlags flags = Qt::WindowFlags());
+ explicit QMainWindow(QWidget *parent = nullptr, Qt::WindowFlags flags = Qt::WindowFlags());
~QMainWindow();
QSize iconSize() const;
@@ -203,9 +203,9 @@ Q_SIGNALS:
protected:
#ifndef QT_NO_CONTEXTMENU
- void contextMenuEvent(QContextMenuEvent *event) Q_DECL_OVERRIDE;
+ void contextMenuEvent(QContextMenuEvent *event) override;
#endif
- bool event(QEvent *event) Q_DECL_OVERRIDE;
+ bool event(QEvent *event) override;
private:
Q_DECLARE_PRIVATE(QMainWindow)
diff --git a/src/widgets/widgets/qmainwindowlayout.cpp b/src/widgets/widgets/qmainwindowlayout.cpp
index 1767a8458f..9b38da340c 100644
--- a/src/widgets/widgets/qmainwindowlayout.cpp
+++ b/src/widgets/widgets/qmainwindowlayout.cpp
@@ -202,14 +202,14 @@ public:
layoutState.deleteAllLayoutItems();
}
- void addItem(QLayoutItem*) Q_DECL_OVERRIDE { Q_UNREACHABLE(); }
- int count() const Q_DECL_OVERRIDE { return 0; }
- QLayoutItem* itemAt(int index) const Q_DECL_OVERRIDE
+ void addItem(QLayoutItem*) override { Q_UNREACHABLE(); }
+ int count() const override { return 0; }
+ QLayoutItem* itemAt(int index) const override
{
int x = 0;
return layoutState.itemAt(&x, index);
}
- QLayoutItem* takeAt(int index) Q_DECL_OVERRIDE
+ QLayoutItem* takeAt(int index) override
{
int x = 0;
QLayoutItem *ret = layoutState.takeAt(&x, index);
@@ -225,22 +225,22 @@ public:
}
return ret;
}
- QSize sizeHint() const Q_DECL_OVERRIDE
+ QSize sizeHint() const override
{
int fw = frameWidth();
return layoutState.sizeHint() + QSize(fw, fw);
}
- QSize minimumSize() const Q_DECL_OVERRIDE
+ QSize minimumSize() const override
{
int fw = frameWidth();
return layoutState.minimumSize() + QSize(fw, fw);
}
- QSize maximumSize() const Q_DECL_OVERRIDE
+ QSize maximumSize() const override
{
int fw = frameWidth();
return layoutState.maximumSize() + QSize(fw, fw);
}
- void setGeometry(const QRect&r) Q_DECL_OVERRIDE
+ void setGeometry(const QRect&r) override
{
groupWindow()->destroyOrHideIfEmpty();
QDockAreaLayoutInfo *li = dockAreaLayoutInfo();
@@ -1658,9 +1658,9 @@ class QMainWindowTabBar : public QTabBar
public:
QMainWindowTabBar(QMainWindow *parent);
protected:
- bool event(QEvent *e) Q_DECL_OVERRIDE;
- void mouseReleaseEvent(QMouseEvent*) Q_DECL_OVERRIDE;
- void mouseMoveEvent(QMouseEvent*) Q_DECL_OVERRIDE;
+ bool event(QEvent *e) override;
+ void mouseReleaseEvent(QMouseEvent*) override;
+ void mouseMoveEvent(QMouseEvent*) override;
};
diff --git a/src/widgets/widgets/qmainwindowlayout_p.h b/src/widgets/widgets/qmainwindowlayout_p.h
index c61c4f6aa8..168d4444b9 100644
--- a/src/widgets/widgets/qmainwindowlayout_p.h
+++ b/src/widgets/widgets/qmainwindowlayout_p.h
@@ -345,8 +345,8 @@ public:
QList<int> currentGapPos;
protected:
- bool event(QEvent *) Q_DECL_OVERRIDE;
- void paintEvent(QPaintEvent*) Q_DECL_OVERRIDE;
+ bool event(QEvent *) override;
+ void paintEvent(QPaintEvent*) override;
private:
QSize m_removedFrameSize;
@@ -358,9 +358,9 @@ class QDockWidgetGroupWindowItem : public QWidgetItem
{
public:
explicit QDockWidgetGroupWindowItem(QDockWidgetGroupWindow *parent) : QWidgetItem(parent) {}
- QSize minimumSize() const Q_DECL_OVERRIDE { return lay()->minimumSize(); }
- QSize maximumSize() const Q_DECL_OVERRIDE { return lay()->maximumSize(); }
- QSize sizeHint() const Q_DECL_OVERRIDE { return lay()->sizeHint(); }
+ QSize minimumSize() const override { return lay()->minimumSize(); }
+ QSize maximumSize() const override { return lay()->maximumSize(); }
+ QSize sizeHint() const override { return lay()->sizeHint(); }
private:
QLayout *lay() const { return const_cast<QDockWidgetGroupWindowItem *>(this)->widget()->layout(); }
@@ -533,17 +533,17 @@ public:
// QLayout interface
- void addItem(QLayoutItem *item) Q_DECL_OVERRIDE;
- void setGeometry(const QRect &r) Q_DECL_OVERRIDE;
- QLayoutItem *itemAt(int index) const Q_DECL_OVERRIDE;
- QLayoutItem *takeAt(int index) Q_DECL_OVERRIDE;
- int count() const Q_DECL_OVERRIDE;
+ void addItem(QLayoutItem *item) override;
+ void setGeometry(const QRect &r) override;
+ QLayoutItem *itemAt(int index) const override;
+ QLayoutItem *takeAt(int index) override;
+ int count() const override;
- QSize sizeHint() const Q_DECL_OVERRIDE;
- QSize minimumSize() const Q_DECL_OVERRIDE;
+ QSize sizeHint() const override;
+ QSize minimumSize() const override;
mutable QSize szHint;
mutable QSize minSize;
- void invalidate() Q_DECL_OVERRIDE;
+ void invalidate() override;
// animations
diff --git a/src/widgets/widgets/qmdiarea.cpp b/src/widgets/widgets/qmdiarea.cpp
index 4e7925556a..bc7333df2e 100644
--- a/src/widgets/widgets/qmdiarea.cpp
+++ b/src/widgets/widgets/qmdiarea.cpp
@@ -570,9 +570,9 @@ public:
QMdiAreaTabBar(QWidget *parent) : QTabBar(parent) {}
protected:
- void mousePressEvent(QMouseEvent *event) Q_DECL_OVERRIDE;
+ void mousePressEvent(QMouseEvent *event) override;
#ifndef QT_NO_CONTEXTMENU
- void contextMenuEvent(QContextMenuEvent *event) Q_DECL_OVERRIDE;
+ void contextMenuEvent(QContextMenuEvent *event) override;
#endif
private:
diff --git a/src/widgets/widgets/qmdiarea.h b/src/widgets/widgets/qmdiarea.h
index 05deb9e21f..35edde9eb8 100644
--- a/src/widgets/widgets/qmdiarea.h
+++ b/src/widgets/widgets/qmdiarea.h
@@ -87,11 +87,11 @@ public:
};
Q_ENUM(ViewMode)
- QMdiArea(QWidget *parent = Q_NULLPTR);
+ QMdiArea(QWidget *parent = nullptr);
~QMdiArea();
- QSize sizeHint() const Q_DECL_OVERRIDE;
- QSize minimumSizeHint() const Q_DECL_OVERRIDE;
+ QSize sizeHint() const override;
+ QSize minimumSizeHint() const override;
QMdiSubWindow *currentSubWindow() const;
QMdiSubWindow *activeSubWindow() const;
@@ -143,18 +143,18 @@ public Q_SLOTS:
void activatePreviousSubWindow();
protected Q_SLOTS:
- void setupViewport(QWidget *viewport) Q_DECL_OVERRIDE;
+ void setupViewport(QWidget *viewport) override;
protected:
- bool event(QEvent *event) Q_DECL_OVERRIDE;
- bool eventFilter(QObject *object, QEvent *event) Q_DECL_OVERRIDE;
- void paintEvent(QPaintEvent *paintEvent) Q_DECL_OVERRIDE;
- void childEvent(QChildEvent *childEvent) Q_DECL_OVERRIDE;
- void resizeEvent(QResizeEvent *resizeEvent) Q_DECL_OVERRIDE;
- void timerEvent(QTimerEvent *timerEvent) Q_DECL_OVERRIDE;
- void showEvent(QShowEvent *showEvent) Q_DECL_OVERRIDE;
- bool viewportEvent(QEvent *event) Q_DECL_OVERRIDE;
- void scrollContentsBy(int dx, int dy) Q_DECL_OVERRIDE;
+ bool event(QEvent *event) override;
+ bool eventFilter(QObject *object, QEvent *event) override;
+ void paintEvent(QPaintEvent *paintEvent) override;
+ void childEvent(QChildEvent *childEvent) override;
+ void resizeEvent(QResizeEvent *resizeEvent) override;
+ void timerEvent(QTimerEvent *timerEvent) override;
+ void showEvent(QShowEvent *showEvent) override;
+ bool viewportEvent(QEvent *event) override;
+ void scrollContentsBy(int dx, int dy) override;
private:
Q_DISABLE_COPY(QMdiArea)
diff --git a/src/widgets/widgets/qmdiarea_p.h b/src/widgets/widgets/qmdiarea_p.h
index 4740993af7..fd00118ec6 100644
--- a/src/widgets/widgets/qmdiarea_p.h
+++ b/src/widgets/widgets/qmdiarea_p.h
@@ -88,8 +88,8 @@ class RegularTiler : public Rearranger
// Rearranges widgets according to a regular tiling pattern
// covering the entire domain.
// Both positions and sizes may change.
- void rearrange(QList<QWidget *> &widgets, const QRect &domain) const Q_DECL_OVERRIDE;
- Type type() const Q_DECL_OVERRIDE { return Rearranger::RegularTiler; }
+ void rearrange(QList<QWidget *> &widgets, const QRect &domain) const override;
+ Type type() const override { return Rearranger::RegularTiler; }
};
class SimpleCascader : public Rearranger
@@ -97,8 +97,8 @@ class SimpleCascader : public Rearranger
// Rearranges widgets according to a simple, regular cascading pattern.
// Widgets are resized to minimumSize.
// Both positions and sizes may change.
- void rearrange(QList<QWidget *> &widgets, const QRect &domain) const Q_DECL_OVERRIDE;
- Type type() const Q_DECL_OVERRIDE { return Rearranger::SimpleCascader; }
+ void rearrange(QList<QWidget *> &widgets, const QRect &domain) const override;
+ Type type() const override { return Rearranger::SimpleCascader; }
};
class IconTiler : public Rearranger
@@ -106,8 +106,8 @@ class IconTiler : public Rearranger
// Rearranges icons (assumed to be the same size) according to a regular
// tiling pattern filling up the domain from the bottom.
// Only positions may change.
- void rearrange(QList<QWidget *> &widgets, const QRect &domain) const Q_DECL_OVERRIDE;
- Type type() const Q_DECL_OVERRIDE { return Rearranger::IconTiler; }
+ void rearrange(QList<QWidget *> &widgets, const QRect &domain) const override;
+ Type type() const override { return Rearranger::IconTiler; }
};
class Placer
@@ -122,7 +122,7 @@ public:
class MinOverlapPlacer : public Placer
{
- QPoint place(const QSize &size, const QVector<QRect> &rects, const QRect &domain) const Q_DECL_OVERRIDE;
+ QPoint place(const QSize &size, const QVector<QRect> &rects, const QRect &domain) const override;
static int accumulatedOverlap(const QRect &source, const QVector<QRect> &rects);
static QRect findMinOverlapRect(const QVector<QRect> &source, const QVector<QRect> &rects);
static QVector<QRect> getCandidatePlacements(const QSize &size, const QVector<QRect> &rects, const QRect &domain);
@@ -206,7 +206,7 @@ public:
bool lastWindowAboutToBeDestroyed() const;
void setChildActivationEnabled(bool enable = true, bool onlyNextActivationEvent = false) const;
QRect resizeToMinimumTileSize(const QSize &minSubWindowSize, int subWindowCount);
- void scrollBarPolicyChanged(Qt::Orientation, Qt::ScrollBarPolicy) Q_DECL_OVERRIDE; // reimp
+ void scrollBarPolicyChanged(Qt::Orientation, Qt::ScrollBarPolicy) override; // reimp
QMdiSubWindow *nextVisibleSubWindow(int increaseFactor, QMdiArea::WindowOrder,
int removed = -1, int fromIndex = -1) const;
void highlightNextSubWindow(int increaseFactor);
diff --git a/src/widgets/widgets/qmdisubwindow.cpp b/src/widgets/widgets/qmdisubwindow.cpp
index 129898a08d..0fdeaeb1e6 100644
--- a/src/widgets/widgets/qmdisubwindow.cpp
+++ b/src/widgets/widgets/qmdisubwindow.cpp
@@ -373,18 +373,18 @@ class ControlLabel : public QWidget
public:
ControlLabel(QMdiSubWindow *subWindow, QWidget *parent = 0);
- QSize sizeHint() const Q_DECL_OVERRIDE;
+ QSize sizeHint() const override;
signals:
void _q_clicked();
void _q_doubleClicked();
protected:
- bool event(QEvent *event) Q_DECL_OVERRIDE;
- void paintEvent(QPaintEvent *paintEvent) Q_DECL_OVERRIDE;
- void mousePressEvent(QMouseEvent *mouseEvent) Q_DECL_OVERRIDE;
- void mouseDoubleClickEvent(QMouseEvent *mouseEvent) Q_DECL_OVERRIDE;
- void mouseReleaseEvent(QMouseEvent *mouseEvent) Q_DECL_OVERRIDE;
+ bool event(QEvent *event) override;
+ void paintEvent(QPaintEvent *paintEvent) override;
+ void mousePressEvent(QMouseEvent *mouseEvent) override;
+ void mouseDoubleClickEvent(QMouseEvent *mouseEvent) override;
+ void mouseReleaseEvent(QMouseEvent *mouseEvent) override;
private:
QPixmap label;
@@ -504,7 +504,7 @@ class ControllerWidget : public QWidget
Q_OBJECT
public:
ControllerWidget(QMdiSubWindow *subWindow, QWidget *parent = 0);
- QSize sizeHint() const Q_DECL_OVERRIDE;
+ QSize sizeHint() const override;
void setControlVisible(QMdiSubWindowPrivate::WindowStateAction action, bool visible);
inline bool hasVisibleControls() const
{
@@ -519,12 +519,12 @@ signals:
void _q_close();
protected:
- void paintEvent(QPaintEvent *event) Q_DECL_OVERRIDE;
- void mousePressEvent(QMouseEvent *event) Q_DECL_OVERRIDE;
- void mouseReleaseEvent(QMouseEvent *event) Q_DECL_OVERRIDE;
- void mouseMoveEvent(QMouseEvent *event) Q_DECL_OVERRIDE;
- void leaveEvent(QEvent *event) Q_DECL_OVERRIDE;
- bool event(QEvent *event) Q_DECL_OVERRIDE;
+ void paintEvent(QPaintEvent *event) override;
+ void mousePressEvent(QMouseEvent *event) override;
+ void mouseReleaseEvent(QMouseEvent *event) override;
+ void mouseMoveEvent(QMouseEvent *event) override;
+ void leaveEvent(QEvent *event) override;
+ bool event(QEvent *event) override;
private:
QStyle::SubControl activeControl;
diff --git a/src/widgets/widgets/qmdisubwindow.h b/src/widgets/widgets/qmdisubwindow.h
index adaafa352a..302522e1c3 100644
--- a/src/widgets/widgets/qmdisubwindow.h
+++ b/src/widgets/widgets/qmdisubwindow.h
@@ -66,11 +66,11 @@ public:
};
Q_DECLARE_FLAGS(SubWindowOptions, SubWindowOption)
- QMdiSubWindow(QWidget *parent = Q_NULLPTR, Qt::WindowFlags flags = Qt::WindowFlags());
+ QMdiSubWindow(QWidget *parent = nullptr, Qt::WindowFlags flags = Qt::WindowFlags());
~QMdiSubWindow();
- QSize sizeHint() const Q_DECL_OVERRIDE;
- QSize minimumSizeHint() const Q_DECL_OVERRIDE;
+ QSize sizeHint() const override;
+ QSize minimumSizeHint() const override;
void setWidget(QWidget *widget);
QWidget *widget() const;
@@ -107,28 +107,28 @@ public Q_SLOTS:
void showShaded();
protected:
- bool eventFilter(QObject *object, QEvent *event) Q_DECL_OVERRIDE;
- bool event(QEvent *event) Q_DECL_OVERRIDE;
- void showEvent(QShowEvent *showEvent) Q_DECL_OVERRIDE;
- void hideEvent(QHideEvent *hideEvent) Q_DECL_OVERRIDE;
- void changeEvent(QEvent *changeEvent) Q_DECL_OVERRIDE;
- void closeEvent(QCloseEvent *closeEvent) Q_DECL_OVERRIDE;
- void leaveEvent(QEvent *leaveEvent) Q_DECL_OVERRIDE;
- void resizeEvent(QResizeEvent *resizeEvent) Q_DECL_OVERRIDE;
- void timerEvent(QTimerEvent *timerEvent) Q_DECL_OVERRIDE;
- void moveEvent(QMoveEvent *moveEvent) Q_DECL_OVERRIDE;
- void paintEvent(QPaintEvent *paintEvent) Q_DECL_OVERRIDE;
- void mousePressEvent(QMouseEvent *mouseEvent) Q_DECL_OVERRIDE;
- void mouseDoubleClickEvent(QMouseEvent *mouseEvent) Q_DECL_OVERRIDE;
- void mouseReleaseEvent(QMouseEvent *mouseEvent) Q_DECL_OVERRIDE;
- void mouseMoveEvent(QMouseEvent *mouseEvent) Q_DECL_OVERRIDE;
- void keyPressEvent(QKeyEvent *keyEvent) Q_DECL_OVERRIDE;
+ bool eventFilter(QObject *object, QEvent *event) override;
+ bool event(QEvent *event) override;
+ void showEvent(QShowEvent *showEvent) override;
+ void hideEvent(QHideEvent *hideEvent) override;
+ void changeEvent(QEvent *changeEvent) override;
+ void closeEvent(QCloseEvent *closeEvent) override;
+ void leaveEvent(QEvent *leaveEvent) override;
+ void resizeEvent(QResizeEvent *resizeEvent) override;
+ void timerEvent(QTimerEvent *timerEvent) override;
+ void moveEvent(QMoveEvent *moveEvent) override;
+ void paintEvent(QPaintEvent *paintEvent) override;
+ void mousePressEvent(QMouseEvent *mouseEvent) override;
+ void mouseDoubleClickEvent(QMouseEvent *mouseEvent) override;
+ void mouseReleaseEvent(QMouseEvent *mouseEvent) override;
+ void mouseMoveEvent(QMouseEvent *mouseEvent) override;
+ void keyPressEvent(QKeyEvent *keyEvent) override;
#ifndef QT_NO_CONTEXTMENU
- void contextMenuEvent(QContextMenuEvent *contextMenuEvent) Q_DECL_OVERRIDE;
+ void contextMenuEvent(QContextMenuEvent *contextMenuEvent) override;
#endif
- void focusInEvent(QFocusEvent *focusInEvent) Q_DECL_OVERRIDE;
- void focusOutEvent(QFocusEvent *focusOutEvent) Q_DECL_OVERRIDE;
- void childEvent(QChildEvent *childEvent) Q_DECL_OVERRIDE;
+ void focusInEvent(QFocusEvent *focusInEvent) override;
+ void focusOutEvent(QFocusEvent *focusOutEvent) override;
+ void childEvent(QChildEvent *childEvent) override;
private:
Q_DISABLE_COPY(QMdiSubWindow)
diff --git a/src/widgets/widgets/qmdisubwindow_p.h b/src/widgets/widgets/qmdisubwindow_p.h
index d03aca168b..719984c8d4 100644
--- a/src/widgets/widgets/qmdisubwindow_p.h
+++ b/src/widgets/widgets/qmdisubwindow_p.h
@@ -271,7 +271,7 @@ public:
void setFocusWidget();
bool restoreFocus();
void storeFocusWidget();
- void setWindowFlags(Qt::WindowFlags windowFlags) Q_DECL_OVERRIDE;
+ void setWindowFlags(Qt::WindowFlags windowFlags) override;
void setVisible(WindowStateAction, bool visible = true);
#ifndef QT_NO_ACTION
void setEnabled(WindowStateAction, bool enable = true);
diff --git a/src/widgets/widgets/qmenu.cpp b/src/widgets/widgets/qmenu.cpp
index 57d7fb1bc8..4796ed43d3 100644
--- a/src/widgets/widgets/qmenu.cpp
+++ b/src/widgets/widgets/qmenu.cpp
@@ -116,7 +116,7 @@ class QTornOffMenu : public QMenu
q->setFixedSize(size);
}
- QVector<QPointer<QWidget> > calcCausedStack() const Q_DECL_OVERRIDE { return causedStack; }
+ QVector<QPointer<QWidget> > calcCausedStack() const override { return causedStack; }
QPointer<QMenu> causedMenu;
QVector<QPointer<QWidget> > causedStack;
bool initialized;
@@ -162,7 +162,7 @@ public:
} else if (act->type() == QEvent::ActionRemoved)
removeAction(act->action());
}
- void actionEvent(QActionEvent *e) Q_DECL_OVERRIDE
+ void actionEvent(QActionEvent *e) override
{
Q_D(QTornOffMenu);
QMenu::actionEvent(e);
@@ -240,7 +240,7 @@ void QMenuPrivate::syncPlatformMenu()
if (platformMenu.isNull())
return;
- QPlatformMenuItem *beforeItem = Q_NULLPTR;
+ QPlatformMenuItem *beforeItem = nullptr;
const QList<QAction*> actions = q->actions();
for (QList<QAction*>::const_reverse_iterator it = actions.rbegin(), end = actions.rend(); it != end; ++it) {
QPlatformMenuItem *menuItem = insertActionInPlatformMenu(*it, beforeItem);
@@ -435,13 +435,13 @@ void QMenuPrivate::updateActionRects(const QRect &screen) const
QString s = action->text();
int t = s.indexOf(QLatin1Char('\t'));
if (t != -1) {
- tabWidth = qMax(int(tabWidth), qfm.width(s.mid(t+1)));
+ tabWidth = qMax(int(tabWidth), qfm.horizontalAdvance(s.mid(t+1)));
s = s.left(t);
#ifndef QT_NO_SHORTCUT
} else if (action->isShortcutVisibleInContextMenu() || !contextMenu) {
QKeySequence seq = action->shortcut();
if (!seq.isEmpty())
- tabWidth = qMax(int(tabWidth), qfm.width(seq.toString(QKeySequence::NativeText)));
+ tabWidth = qMax(int(tabWidth), qfm.horizontalAdvance(seq.toString(QKeySequence::NativeText)));
#endif
}
sz.setWidth(fm.boundingRect(QRect(), Qt::TextSingleLine | Qt::TextShowMnemonic, s).width());
@@ -665,7 +665,7 @@ void QMenuPrivate::setCurrentAction(QAction *action, int popup, SelectionReason
if (action
&& (action->isSeparator()
|| (!action->isEnabled() && !q->style()->styleHint(QStyle::SH_Menu_AllowActiveAndDisabled, 0, q))))
- action = Q_NULLPTR;
+ action = nullptr;
// Reselect the currently active action in case mouse moved over other menu items when
// moving from sub menu action to sub menu (QTBUG-20094).
@@ -739,13 +739,13 @@ void QMenuSloppyState::reset()
m_use_reset_action = true;
m_uni_dir_discarded_count = 0;
m_time.stop();
- m_reset_action = Q_NULLPTR;
- m_origin_action = Q_NULLPTR;
+ m_reset_action = nullptr;
+ m_origin_action = nullptr;
m_action_rect = QRect();
m_previous_point = QPointF();
if (m_sub_menu) {
- QMenuPrivate::get(m_sub_menu)->sloppyState.m_parent = Q_NULLPTR;
- m_sub_menu = Q_NULLPTR;
+ QMenuPrivate::get(m_sub_menu)->sloppyState.m_parent = nullptr;
+ m_sub_menu = nullptr;
}
}
void QMenuSloppyState::enter()
@@ -854,7 +854,7 @@ void QMenuSloppyState::timeout()
if (m_use_reset_action)
menu_priv->setCurrentAction(m_reset_action, 0);
} else {
- menu_priv->setCurrentAction(Q_NULLPTR, 0);
+ menu_priv->setCurrentAction(nullptr, 0);
}
}
@@ -903,8 +903,7 @@ void QMenuPrivate::adjustMenuScreen(const QPoint &p)
// The (item) size calculations depend on the menu screen,
// so a wrong screen would often cause wrong sizes (on high DPI)
const QScreen *currentScreen = q->windowHandle() ? q->windowHandle()->screen() : nullptr;
- const int screenNumberForPoint = QApplication::desktop()->screenNumber(p);
- QScreen *actualScreen = QGuiApplication::screens().at(screenNumberForPoint);
+ QScreen *actualScreen = QGuiApplication::screenAt(p);
if (actualScreen && currentScreen != actualScreen) {
if (!q->windowHandle()) // Try to create a window handle if not created.
createWinId();
@@ -2226,7 +2225,7 @@ void QMenu::hideTearOffMenu()
// should consider the torn-off menu deleted.
// This way showTearOffMenu() will not try to
// reuse the dying torn-off menu.
- d->tornPopup = Q_NULLPTR;
+ d->tornPopup = nullptr;
}
}
diff --git a/src/widgets/widgets/qmenu.h b/src/widgets/widgets/qmenu.h
index 7cf73f55b3..86d927e919 100644
--- a/src/widgets/widgets/qmenu.h
+++ b/src/widgets/widgets/qmenu.h
@@ -71,8 +71,8 @@ private:
Q_PROPERTY(bool toolTipsVisible READ toolTipsVisible WRITE setToolTipsVisible)
public:
- explicit QMenu(QWidget *parent = Q_NULLPTR);
- explicit QMenu(const QString &title, QWidget *parent = Q_NULLPTR);
+ explicit QMenu(QWidget *parent = nullptr);
+ explicit QMenu(const QString &title, QWidget *parent = nullptr);
~QMenu();
using QWidget::addAction;
@@ -184,17 +184,17 @@ public:
void setActiveAction(QAction *act);
QAction *activeAction() const;
- void popup(const QPoint &pos, QAction *at = Q_NULLPTR);
+ void popup(const QPoint &pos, QAction *at = nullptr);
QAction *exec();
- QAction *exec(const QPoint &pos, QAction *at = Q_NULLPTR);
+ QAction *exec(const QPoint &pos, QAction *at = nullptr);
#if QT_VERSION >= QT_VERSION_CHECK(6,0,0)
- static QAction *exec(const QList<QAction *> &actions, const QPoint &pos, QAction *at = Q_NULLPTR, QWidget *parent = Q_NULLPTR);
+ static QAction *exec(const QList<QAction *> &actions, const QPoint &pos, QAction *at = nullptr, QWidget *parent = nullptr);
#else
- static QAction *exec(QList<QAction*> actions, const QPoint &pos, QAction *at = Q_NULLPTR, QWidget *parent = Q_NULLPTR);
+ static QAction *exec(QList<QAction*> actions, const QPoint &pos, QAction *at = nullptr, QWidget *parent = nullptr);
#endif
- QSize sizeHint() const Q_DECL_OVERRIDE;
+ QSize sizeHint() const override;
QRect actionGeometry(QAction *) const;
QAction *actionAt(const QPoint &) const;
@@ -231,22 +231,22 @@ Q_SIGNALS:
protected:
int columnCount() const;
- void changeEvent(QEvent *) Q_DECL_OVERRIDE;
- void keyPressEvent(QKeyEvent *) Q_DECL_OVERRIDE;
- void mouseReleaseEvent(QMouseEvent *) Q_DECL_OVERRIDE;
- void mousePressEvent(QMouseEvent *) Q_DECL_OVERRIDE;
- void mouseMoveEvent(QMouseEvent *) Q_DECL_OVERRIDE;
+ void changeEvent(QEvent *) override;
+ void keyPressEvent(QKeyEvent *) override;
+ void mouseReleaseEvent(QMouseEvent *) override;
+ void mousePressEvent(QMouseEvent *) override;
+ void mouseMoveEvent(QMouseEvent *) override;
#if QT_CONFIG(wheelevent)
- void wheelEvent(QWheelEvent *) Q_DECL_OVERRIDE;
+ void wheelEvent(QWheelEvent *) override;
#endif
- void enterEvent(QEvent *) Q_DECL_OVERRIDE;
- void leaveEvent(QEvent *) Q_DECL_OVERRIDE;
- void hideEvent(QHideEvent *) Q_DECL_OVERRIDE;
- void paintEvent(QPaintEvent *) Q_DECL_OVERRIDE;
- void actionEvent(QActionEvent *) Q_DECL_OVERRIDE;
- void timerEvent(QTimerEvent *) Q_DECL_OVERRIDE;
- bool event(QEvent *) Q_DECL_OVERRIDE;
- bool focusNextPrevChild(bool next) Q_DECL_OVERRIDE;
+ void enterEvent(QEvent *) override;
+ void leaveEvent(QEvent *) override;
+ void hideEvent(QHideEvent *) override;
+ void paintEvent(QPaintEvent *) override;
+ void actionEvent(QActionEvent *) override;
+ void timerEvent(QTimerEvent *) override;
+ bool event(QEvent *) override;
+ bool focusNextPrevChild(bool next) override;
void initStyleOption(QStyleOptionMenuItem *option, const QAction *action) const;
private Q_SLOTS:
@@ -259,7 +259,7 @@ private:
Q_PRIVATE_SLOT(d_func(), void _q_platformMenuAboutToShow())
protected:
- QMenu(QMenuPrivate &dd, QWidget* parent = Q_NULLPTR);
+ QMenu(QMenuPrivate &dd, QWidget* parent = nullptr);
private:
Q_DISABLE_COPY(QMenu)
diff --git a/src/widgets/widgets/qmenu_p.h b/src/widgets/widgets/qmenu_p.h
index ce5134958e..b6afb05e3a 100644
--- a/src/widgets/widgets/qmenu_p.h
+++ b/src/widgets/widgets/qmenu_p.h
@@ -177,7 +177,7 @@ public:
QSetValueOnDestroy<QPointF> setPreviousPoint(m_previous_point, mousePos);
if (resetAction && resetAction->isSeparator()) {
- m_reset_action = Q_NULLPTR;
+ m_reset_action = nullptr;
m_use_reset_action = true;
} else if (m_reset_action != resetAction) {
if (m_use_reset_action && resetAction) {
@@ -442,8 +442,8 @@ public:
public:
enum Type { ScrollUp, ScrollDown };
ScrollerTearOffItem(Type type, QMenuPrivate *mPrivate,
- QWidget *parent = Q_NULLPTR, Qt::WindowFlags f = Qt::WindowFlags());
- void paintEvent(QPaintEvent *e) Q_DECL_OVERRIDE;
+ QWidget *parent = nullptr, Qt::WindowFlags f = Qt::WindowFlags());
+ void paintEvent(QPaintEvent *e) override;
void updateScrollerRects(const QRect &rect);
private:
diff --git a/src/widgets/widgets/qmenubar.cpp b/src/widgets/widgets/qmenubar.cpp
index ece2a0a9c9..80c6d28e85 100644
--- a/src/widgets/widgets/qmenubar.cpp
+++ b/src/widgets/widgets/qmenubar.cpp
@@ -75,8 +75,8 @@ class QMenuBarExtension : public QToolButton
public:
explicit QMenuBarExtension(QWidget *parent);
- QSize sizeHint() const Q_DECL_OVERRIDE;
- void paintEvent(QPaintEvent *) Q_DECL_OVERRIDE;
+ QSize sizeHint() const override;
+ void paintEvent(QPaintEvent *) override;
};
QMenuBarExtension::QMenuBarExtension(QWidget *parent)
@@ -1331,7 +1331,7 @@ void QMenuBarPrivate::handleReparent()
//Note: if parent is reparented, then window may change even if parent doesn't.
// We need to install an avent filter on each parent up to the parent that is
// also a window (for shortcuts)
- QWidget *newWindow = newParent ? newParent->window() : Q_NULLPTR;
+ QWidget *newWindow = newParent ? newParent->window() : nullptr;
QVector<QPointer<QWidget> > newParents;
// Remove event filters on ex-parents, keep them on still-parents
@@ -1710,7 +1710,7 @@ void QMenuBarPrivate::_q_internalShortcutActivated(int id)
QAction *act = actions.at(id);
if (act && act->menu()) {
if (QPlatformMenu *platformMenu = act->menu()->platformMenu()) {
- platformMenu->showPopup(q->windowHandle(), actionRects.at(id), Q_NULLPTR);
+ platformMenu->showPopup(q->windowHandle(), actionRects.at(id), nullptr);
return;
}
}
diff --git a/src/widgets/widgets/qmenubar.h b/src/widgets/widgets/qmenubar.h
index be70f4ea48..4f8e3b8d53 100644
--- a/src/widgets/widgets/qmenubar.h
+++ b/src/widgets/widgets/qmenubar.h
@@ -60,7 +60,7 @@ class Q_WIDGETS_EXPORT QMenuBar : public QWidget
Q_PROPERTY(bool nativeMenuBar READ isNativeMenuBar WRITE setNativeMenuBar)
public:
- explicit QMenuBar(QWidget *parent = Q_NULLPTR);
+ explicit QMenuBar(QWidget *parent = nullptr);
~QMenuBar();
using QWidget::addAction;
diff --git a/src/widgets/widgets/qplaintextedit.cpp b/src/widgets/widgets/qplaintextedit.cpp
index 555b1f94ad..e66b702ffd 100644
--- a/src/widgets/widgets/qplaintextedit.cpp
+++ b/src/widgets/widgets/qplaintextedit.cpp
@@ -364,7 +364,7 @@ void QPlainTextDocumentLayout::layoutBlock(const QTextBlock &block)
int extraMargin = 0;
if (option.flags() & QTextOption::AddSpaceForLineAndParagraphSeparators) {
QFontMetrics fm(block.charFormat().font());
- extraMargin += fm.width(QChar(0x21B5));
+ extraMargin += fm.horizontalAdvance(QChar(0x21B5));
}
tl->beginLayout();
qreal availableWidth = d->width;
@@ -747,7 +747,8 @@ QPlainTextEditPrivate::QPlainTextEditPrivate()
tabChangesFocus(false),
lineWrap(QPlainTextEdit::WidgetWidth),
wordWrap(QTextOption::WrapAtWordBoundaryOrAnywhere),
- clickCausedFocus(0),topLine(0),topLineFracture(0),
+ clickCausedFocus(0), placeholderVisible(1),
+ topLine(0), topLineFracture(0),
pageUpDownLastCursorYIsValid(false)
{
showCursorOnInitialShow = true;
@@ -784,6 +785,7 @@ void QPlainTextEditPrivate::init(const QString &txt)
QObject::connect(control, SIGNAL(selectionChanged()), q, SIGNAL(selectionChanged()));
QObject::connect(control, SIGNAL(cursorPositionChanged()), q, SLOT(_q_cursorPositionChanged()));
+ QObject::connect(control, SIGNAL(textChanged()), q, SLOT(_q_textChanged()));
QObject::connect(control, SIGNAL(textChanged()), q, SLOT(updateMicroFocus()));
// set a null page size initially to avoid any relayouting until the textedit
@@ -816,6 +818,24 @@ void QPlainTextEditPrivate::init(const QString &txt)
#endif
}
+void QPlainTextEditPrivate::_q_textChanged()
+{
+ Q_Q(QPlainTextEdit);
+
+ // We normally only repaint the part of view that contains text in the
+ // document that has changed (in _q_repaintContents). But the placeholder
+ // text is not a part of the document, but is drawn on separately. So whenever
+ // we either show or hide the placeholder text, we issue a full update.
+ bool placeholderCurrentyVisible = placeholderVisible;
+
+ placeholderVisible = !placeholderText.isEmpty()
+ && q->document()->isEmpty()
+ && q->firstVisibleBlock().layout()->preeditAreaText().isEmpty();
+
+ if (placeholderCurrentyVisible != placeholderVisible)
+ viewport->update();
+}
+
void QPlainTextEditPrivate::_q_repaintContents(const QRectF &contentsRect)
{
Q_Q(QPlainTextEdit);
@@ -1881,6 +1901,7 @@ static void fillBackground(QPainter *p, const QRectF &rect, QBrush brush, const
*/
void QPlainTextEdit::paintEvent(QPaintEvent *e)
{
+ Q_D(QPlainTextEdit);
QPainter painter(viewport());
Q_ASSERT(qobject_cast<QPlainTextDocumentLayout*>(document()->documentLayout()));
@@ -1903,6 +1924,15 @@ void QPlainTextEdit::paintEvent(QPaintEvent *e)
er.setRight(qMin(er.right(), maxX));
painter.setClipRect(er);
+ if (d->placeholderVisible) {
+ QColor col = d->control->palette().text().color();
+ col.setAlpha(128);
+ painter.setPen(col);
+ painter.setClipRect(e->rect());
+ const int margin = int(document()->documentMargin());
+ QRectF textRect = viewportRect.adjusted(margin, margin, 0, 0);
+ painter.drawText(textRect, Qt::AlignTop | Qt::TextWordWrap, placeholderText());
+ }
QAbstractTextDocumentLayout::PaintContext context = getPaintContext();
@@ -1977,17 +2007,8 @@ void QPlainTextEdit::paintEvent(QPaintEvent *e)
}
}
+ layout->draw(&painter, offset, selections, er);
- if (!placeholderText().isEmpty() && document()->isEmpty() && layout->preeditAreaText().isEmpty()) {
- Q_D(QPlainTextEdit);
- QColor col = d->control->palette().text().color();
- col.setAlpha(128);
- painter.setPen(col);
- const int margin = int(document()->documentMargin());
- painter.drawText(r.adjusted(margin, 0, 0, 0), Qt::AlignTop | Qt::TextWordWrap, placeholderText());
- } else {
- layout->draw(&painter, offset, selections, er);
- }
if ((drawCursor && !drawCursorAsBlock)
|| (editable && context.cursorPosition < -1
&& !layout->preeditAreaText().isEmpty())) {
diff --git a/src/widgets/widgets/qplaintextedit.h b/src/widgets/widgets/qplaintextedit.h
index cd25b45d50..34ec96715e 100644
--- a/src/widgets/widgets/qplaintextedit.h
+++ b/src/widgets/widgets/qplaintextedit.h
@@ -91,8 +91,8 @@ public:
};
Q_ENUM(LineWrapMode)
- explicit QPlainTextEdit(QWidget *parent = Q_NULLPTR);
- explicit QPlainTextEdit(const QString &text, QWidget *parent = Q_NULLPTR);
+ explicit QPlainTextEdit(QWidget *parent = nullptr);
+ explicit QPlainTextEdit(const QString &text, QWidget *parent = nullptr);
virtual ~QPlainTextEdit();
void setDocument(QTextDocument *document);
@@ -191,7 +191,7 @@ public:
void print(QPagedPaintDevice *printer) const;
int blockCount() const;
- QVariant inputMethodQuery(Qt::InputMethodQuery property) const Q_DECL_OVERRIDE;
+ QVariant inputMethodQuery(Qt::InputMethodQuery property) const override;
Q_INVOKABLE QVariant inputMethodQuery(Qt::InputMethodQuery query, QVariant argument) const;
public Q_SLOTS:
@@ -233,43 +233,43 @@ Q_SIGNALS:
void modificationChanged(bool);
protected:
- virtual bool event(QEvent *e) Q_DECL_OVERRIDE;
- virtual void timerEvent(QTimerEvent *e) Q_DECL_OVERRIDE;
- virtual void keyPressEvent(QKeyEvent *e) Q_DECL_OVERRIDE;
- virtual void keyReleaseEvent(QKeyEvent *e) Q_DECL_OVERRIDE;
- virtual void resizeEvent(QResizeEvent *e) Q_DECL_OVERRIDE;
- virtual void paintEvent(QPaintEvent *e) Q_DECL_OVERRIDE;
- virtual void mousePressEvent(QMouseEvent *e) Q_DECL_OVERRIDE;
- virtual void mouseMoveEvent(QMouseEvent *e) Q_DECL_OVERRIDE;
- virtual void mouseReleaseEvent(QMouseEvent *e) Q_DECL_OVERRIDE;
- virtual void mouseDoubleClickEvent(QMouseEvent *e) Q_DECL_OVERRIDE;
- virtual bool focusNextPrevChild(bool next) Q_DECL_OVERRIDE;
+ virtual bool event(QEvent *e) override;
+ virtual void timerEvent(QTimerEvent *e) override;
+ virtual void keyPressEvent(QKeyEvent *e) override;
+ virtual void keyReleaseEvent(QKeyEvent *e) override;
+ virtual void resizeEvent(QResizeEvent *e) override;
+ virtual void paintEvent(QPaintEvent *e) override;
+ virtual void mousePressEvent(QMouseEvent *e) override;
+ virtual void mouseMoveEvent(QMouseEvent *e) override;
+ virtual void mouseReleaseEvent(QMouseEvent *e) override;
+ virtual void mouseDoubleClickEvent(QMouseEvent *e) override;
+ virtual bool focusNextPrevChild(bool next) override;
#ifndef QT_NO_CONTEXTMENU
- virtual void contextMenuEvent(QContextMenuEvent *e) Q_DECL_OVERRIDE;
+ virtual void contextMenuEvent(QContextMenuEvent *e) override;
#endif
#ifndef QT_NO_DRAGANDDROP
- virtual void dragEnterEvent(QDragEnterEvent *e) Q_DECL_OVERRIDE;
- virtual void dragLeaveEvent(QDragLeaveEvent *e) Q_DECL_OVERRIDE;
- virtual void dragMoveEvent(QDragMoveEvent *e) Q_DECL_OVERRIDE;
- virtual void dropEvent(QDropEvent *e) Q_DECL_OVERRIDE;
+ virtual void dragEnterEvent(QDragEnterEvent *e) override;
+ virtual void dragLeaveEvent(QDragLeaveEvent *e) override;
+ virtual void dragMoveEvent(QDragMoveEvent *e) override;
+ virtual void dropEvent(QDropEvent *e) override;
#endif
- virtual void focusInEvent(QFocusEvent *e) Q_DECL_OVERRIDE;
- virtual void focusOutEvent(QFocusEvent *e) Q_DECL_OVERRIDE;
- virtual void showEvent(QShowEvent *) Q_DECL_OVERRIDE;
- virtual void changeEvent(QEvent *e) Q_DECL_OVERRIDE;
+ virtual void focusInEvent(QFocusEvent *e) override;
+ virtual void focusOutEvent(QFocusEvent *e) override;
+ virtual void showEvent(QShowEvent *) override;
+ virtual void changeEvent(QEvent *e) override;
#if QT_CONFIG(wheelevent)
- virtual void wheelEvent(QWheelEvent *e) Q_DECL_OVERRIDE;
+ virtual void wheelEvent(QWheelEvent *e) override;
#endif
virtual QMimeData *createMimeDataFromSelection() const;
virtual bool canInsertFromMimeData(const QMimeData *source) const;
virtual void insertFromMimeData(const QMimeData *source);
- virtual void inputMethodEvent(QInputMethodEvent *) Q_DECL_OVERRIDE;
+ virtual void inputMethodEvent(QInputMethodEvent *) override;
QPlainTextEdit(QPlainTextEditPrivate &dd, QWidget *parent);
- virtual void scrollContentsBy(int dx, int dy) Q_DECL_OVERRIDE;
+ virtual void scrollContentsBy(int dx, int dy) override;
virtual void doSetTextCursor(const QTextCursor &cursor);
QTextBlock firstVisibleBlock() const;
@@ -283,6 +283,7 @@ protected:
private:
Q_DISABLE_COPY(QPlainTextEdit)
Q_PRIVATE_SLOT(d_func(), void _q_repaintContents(const QRectF &r))
+ Q_PRIVATE_SLOT(d_func(), void _q_textChanged())
Q_PRIVATE_SLOT(d_func(), void _q_adjustScrollbars())
Q_PRIVATE_SLOT(d_func(), void _q_verticalScrollbarActionTriggered(int))
Q_PRIVATE_SLOT(d_func(), void _q_cursorPositionChanged())
@@ -302,14 +303,14 @@ public:
QPlainTextDocumentLayout(QTextDocument *document);
~QPlainTextDocumentLayout();
- void draw(QPainter *, const PaintContext &) Q_DECL_OVERRIDE;
- int hitTest(const QPointF &, Qt::HitTestAccuracy ) const Q_DECL_OVERRIDE;
+ void draw(QPainter *, const PaintContext &) override;
+ int hitTest(const QPointF &, Qt::HitTestAccuracy ) const override;
- int pageCount() const Q_DECL_OVERRIDE;
- QSizeF documentSize() const Q_DECL_OVERRIDE;
+ int pageCount() const override;
+ QSizeF documentSize() const override;
- QRectF frameBoundingRect(QTextFrame *) const Q_DECL_OVERRIDE;
- QRectF blockBoundingRect(const QTextBlock &block) const Q_DECL_OVERRIDE;
+ QRectF frameBoundingRect(QTextFrame *) const override;
+ QRectF blockBoundingRect(const QTextBlock &block) const override;
void ensureBlockLayout(const QTextBlock &block) const;
@@ -319,7 +320,7 @@ public:
void requestUpdate();
protected:
- void documentChanged(int from, int /*charsRemoved*/, int charsAdded) Q_DECL_OVERRIDE;
+ void documentChanged(int from, int /*charsRemoved*/, int charsAdded) override;
private:
diff --git a/src/widgets/widgets/qplaintextedit_p.h b/src/widgets/widgets/qplaintextedit_p.h
index 3d6e7781ed..534f0d4681 100644
--- a/src/widgets/widgets/qplaintextedit_p.h
+++ b/src/widgets/widgets/qplaintextedit_p.h
@@ -84,19 +84,19 @@ public:
QPlainTextEditControl(QPlainTextEdit *parent);
- QMimeData *createMimeDataFromSelection() const Q_DECL_OVERRIDE;
- bool canInsertFromMimeData(const QMimeData *source) const Q_DECL_OVERRIDE;
- void insertFromMimeData(const QMimeData *source) Q_DECL_OVERRIDE;
- int hitTest(const QPointF &point, Qt::HitTestAccuracy = Qt::FuzzyHit) const Q_DECL_OVERRIDE;
- QRectF blockBoundingRect(const QTextBlock &block) const Q_DECL_OVERRIDE;
- QString anchorAt(const QPointF &pos) const Q_DECL_OVERRIDE;
+ QMimeData *createMimeDataFromSelection() const override;
+ bool canInsertFromMimeData(const QMimeData *source) const override;
+ void insertFromMimeData(const QMimeData *source) override;
+ int hitTest(const QPointF &point, Qt::HitTestAccuracy = Qt::FuzzyHit) const override;
+ QRectF blockBoundingRect(const QTextBlock &block) const override;
+ QString anchorAt(const QPointF &pos) const override;
inline QRectF cursorRect(const QTextCursor &cursor) const {
QRectF r = QWidgetTextControl::cursorRect(cursor);
r.setLeft(qMax(r.left(), (qreal) 0.));
return r;
}
inline QRectF cursorRect() { return cursorRect(textCursor()); }
- void ensureCursorVisible() Q_DECL_OVERRIDE {
+ void ensureCursorVisible() override {
textEdit->ensureCursorVisible();
emit microFocusChanged();
}
@@ -106,7 +106,7 @@ public:
int topBlock;
QTextBlock firstVisibleBlock() const;
- QVariant loadResource(int type, const QUrl &name) Q_DECL_OVERRIDE {
+ QVariant loadResource(int type, const QUrl &name) override {
return textEdit->loadResource(type, name);
}
@@ -121,6 +121,7 @@ public:
void init(const QString &txt = QString());
void _q_repaintContents(const QRectF &contentsRect);
+ void _q_textChanged();
inline QPoint mapToContents(const QPoint &point) const
{ return QPoint(point.x() + horizontalOffset(), point.y() + verticalOffset()); }
@@ -157,6 +158,7 @@ public:
uint centerOnScroll : 1;
uint inDrag : 1;
uint clickCausedFocus : 1;
+ uint placeholderVisible : 1;
int topLine;
qreal topLineFracture; // for non-int sized fonts
diff --git a/src/widgets/widgets/qprogressbar.cpp b/src/widgets/widgets/qprogressbar.cpp
index 91f7efa08c..56253b8e44 100644
--- a/src/widgets/widgets/qprogressbar.cpp
+++ b/src/widgets/widgets/qprogressbar.cpp
@@ -421,7 +421,7 @@ QSize QProgressBar::sizeHint() const
QStyleOptionProgressBar opt;
initStyleOption(&opt);
int cw = style()->pixelMetric(QStyle::PM_ProgressBarChunkWidth, &opt, this);
- QSize size = QSize(qMax(9, cw) * 7 + fm.width(QLatin1Char('0')) * 4, fm.height() + 8);
+ QSize size = QSize(qMax(9, cw) * 7 + fm.horizontalAdvance(QLatin1Char('0')) * 4, fm.height() + 8);
if (opt.orientation == Qt::Vertical)
size = size.transposed();
return style()->sizeFromContents(QStyle::CT_ProgressBar, &opt, size, this);
diff --git a/src/widgets/widgets/qprogressbar.h b/src/widgets/widgets/qprogressbar.h
index e0f5e9084b..ec9686068c 100644
--- a/src/widgets/widgets/qprogressbar.h
+++ b/src/widgets/widgets/qprogressbar.h
@@ -68,7 +68,7 @@ public:
enum Direction { TopToBottom, BottomToTop };
Q_ENUM(Direction)
- explicit QProgressBar(QWidget *parent = Q_NULLPTR);
+ explicit QProgressBar(QWidget *parent = nullptr);
~QProgressBar();
int minimum() const;
@@ -83,8 +83,8 @@ public:
Qt::Alignment alignment() const;
void setAlignment(Qt::Alignment alignment);
- QSize sizeHint() const Q_DECL_OVERRIDE;
- QSize minimumSizeHint() const Q_DECL_OVERRIDE;
+ QSize sizeHint() const override;
+ QSize minimumSizeHint() const override;
Qt::Orientation orientation() const;
@@ -109,8 +109,8 @@ Q_SIGNALS:
void valueChanged(int value);
protected:
- bool event(QEvent *e) Q_DECL_OVERRIDE;
- void paintEvent(QPaintEvent *) Q_DECL_OVERRIDE;
+ bool event(QEvent *e) override;
+ void paintEvent(QPaintEvent *) override;
void initStyleOption(QStyleOptionProgressBar *option) const;
private:
diff --git a/src/widgets/widgets/qpushbutton.h b/src/widgets/widgets/qpushbutton.h
index c005f320cc..b02ba63d07 100644
--- a/src/widgets/widgets/qpushbutton.h
+++ b/src/widgets/widgets/qpushbutton.h
@@ -61,13 +61,13 @@ class Q_WIDGETS_EXPORT QPushButton : public QAbstractButton
Q_PROPERTY(bool flat READ isFlat WRITE setFlat)
public:
- explicit QPushButton(QWidget *parent = Q_NULLPTR);
- explicit QPushButton(const QString &text, QWidget *parent = Q_NULLPTR);
- QPushButton(const QIcon& icon, const QString &text, QWidget *parent = Q_NULLPTR);
+ explicit QPushButton(QWidget *parent = nullptr);
+ explicit QPushButton(const QString &text, QWidget *parent = nullptr);
+ QPushButton(const QIcon& icon, const QString &text, QWidget *parent = nullptr);
~QPushButton();
- QSize sizeHint() const Q_DECL_OVERRIDE;
- QSize minimumSizeHint() const Q_DECL_OVERRIDE;
+ QSize sizeHint() const override;
+ QSize minimumSizeHint() const override;
bool autoDefault() const;
void setAutoDefault(bool);
@@ -88,13 +88,13 @@ public Q_SLOTS:
#endif
protected:
- bool event(QEvent *e) Q_DECL_OVERRIDE;
- void paintEvent(QPaintEvent *) Q_DECL_OVERRIDE;
- void keyPressEvent(QKeyEvent *) Q_DECL_OVERRIDE;
- void focusInEvent(QFocusEvent *) Q_DECL_OVERRIDE;
- void focusOutEvent(QFocusEvent *) Q_DECL_OVERRIDE;
+ bool event(QEvent *e) override;
+ void paintEvent(QPaintEvent *) override;
+ void keyPressEvent(QKeyEvent *) override;
+ void focusInEvent(QFocusEvent *) override;
+ void focusOutEvent(QFocusEvent *) override;
void initStyleOption(QStyleOptionButton *option) const;
- QPushButton(QPushButtonPrivate &dd, QWidget* parent = Q_NULLPTR);
+ QPushButton(QPushButtonPrivate &dd, QWidget* parent = nullptr);
public:
diff --git a/src/widgets/widgets/qradiobutton.h b/src/widgets/widgets/qradiobutton.h
index 137ae01380..c6b5ddce84 100644
--- a/src/widgets/widgets/qradiobutton.h
+++ b/src/widgets/widgets/qradiobutton.h
@@ -56,18 +56,18 @@ class Q_WIDGETS_EXPORT QRadioButton : public QAbstractButton
Q_OBJECT
public:
- explicit QRadioButton(QWidget *parent = Q_NULLPTR);
- explicit QRadioButton(const QString &text, QWidget *parent = Q_NULLPTR);
+ explicit QRadioButton(QWidget *parent = nullptr);
+ explicit QRadioButton(const QString &text, QWidget *parent = nullptr);
~QRadioButton();
- QSize sizeHint() const Q_DECL_OVERRIDE;
- QSize minimumSizeHint() const Q_DECL_OVERRIDE;
+ QSize sizeHint() const override;
+ QSize minimumSizeHint() const override;
protected:
- bool event(QEvent *e) Q_DECL_OVERRIDE;
- bool hitButton(const QPoint &) const Q_DECL_OVERRIDE;
- void paintEvent(QPaintEvent *) Q_DECL_OVERRIDE;
- void mouseMoveEvent(QMouseEvent *) Q_DECL_OVERRIDE;
+ bool event(QEvent *e) override;
+ bool hitButton(const QPoint &) const override;
+ void paintEvent(QPaintEvent *) override;
+ void mouseMoveEvent(QMouseEvent *) override;
void initStyleOption(QStyleOptionButton *button) const;
diff --git a/src/widgets/widgets/qrubberband.h b/src/widgets/widgets/qrubberband.h
index a05eb0d543..c683c24a18 100644
--- a/src/widgets/widgets/qrubberband.h
+++ b/src/widgets/widgets/qrubberband.h
@@ -56,7 +56,7 @@ class Q_WIDGETS_EXPORT QRubberBand : public QWidget
public:
enum Shape { Line, Rectangle };
- explicit QRubberBand(Shape, QWidget * = Q_NULLPTR);
+ explicit QRubberBand(Shape, QWidget * = nullptr);
~QRubberBand();
Shape shape() const;
@@ -73,12 +73,12 @@ public:
{ resize(s.width(), s.height()); }
protected:
- bool event(QEvent *e) Q_DECL_OVERRIDE;
- void paintEvent(QPaintEvent *) Q_DECL_OVERRIDE;
- void changeEvent(QEvent *) Q_DECL_OVERRIDE;
- void showEvent(QShowEvent *) Q_DECL_OVERRIDE;
- void resizeEvent(QResizeEvent *) Q_DECL_OVERRIDE;
- void moveEvent(QMoveEvent *) Q_DECL_OVERRIDE;
+ bool event(QEvent *e) override;
+ void paintEvent(QPaintEvent *) override;
+ void changeEvent(QEvent *) override;
+ void showEvent(QShowEvent *) override;
+ void resizeEvent(QResizeEvent *) override;
+ void moveEvent(QMoveEvent *) override;
void initStyleOption(QStyleOptionRubberBand *option) const;
private:
diff --git a/src/widgets/widgets/qscrollarea.h b/src/widgets/widgets/qscrollarea.h
index d38bced2f2..6d252821c5 100644
--- a/src/widgets/widgets/qscrollarea.h
+++ b/src/widgets/widgets/qscrollarea.h
@@ -56,7 +56,7 @@ class Q_WIDGETS_EXPORT QScrollArea : public QAbstractScrollArea
Q_PROPERTY(Qt::Alignment alignment READ alignment WRITE setAlignment)
public:
- explicit QScrollArea(QWidget *parent = Q_NULLPTR);
+ explicit QScrollArea(QWidget *parent = nullptr);
~QScrollArea();
QWidget *widget() const;
@@ -66,9 +66,9 @@ public:
bool widgetResizable() const;
void setWidgetResizable(bool resizable);
- QSize sizeHint() const Q_DECL_OVERRIDE;
+ QSize sizeHint() const override;
- bool focusNextPrevChild(bool next) Q_DECL_OVERRIDE;
+ bool focusNextPrevChild(bool next) override;
Qt::Alignment alignment() const;
void setAlignment(Qt::Alignment);
@@ -77,13 +77,13 @@ public:
void ensureWidgetVisible(QWidget *childWidget, int xmargin = 50, int ymargin = 50);
protected:
- QScrollArea(QScrollAreaPrivate &dd, QWidget *parent = Q_NULLPTR);
- bool event(QEvent *) Q_DECL_OVERRIDE;
- bool eventFilter(QObject *, QEvent *) Q_DECL_OVERRIDE;
- void resizeEvent(QResizeEvent *) Q_DECL_OVERRIDE;
- void scrollContentsBy(int dx, int dy) Q_DECL_OVERRIDE;
+ QScrollArea(QScrollAreaPrivate &dd, QWidget *parent = nullptr);
+ bool event(QEvent *) override;
+ bool eventFilter(QObject *, QEvent *) override;
+ void resizeEvent(QResizeEvent *) override;
+ void scrollContentsBy(int dx, int dy) override;
- QSize viewportSizeHint() const Q_DECL_OVERRIDE;
+ QSize viewportSizeHint() const override;
private:
Q_DECLARE_PRIVATE(QScrollArea)
diff --git a/src/widgets/widgets/qscrollbar.h b/src/widgets/widgets/qscrollbar.h
index 22b9bfcddb..171195fd24 100644
--- a/src/widgets/widgets/qscrollbar.h
+++ b/src/widgets/widgets/qscrollbar.h
@@ -56,25 +56,25 @@ class Q_WIDGETS_EXPORT QScrollBar : public QAbstractSlider
{
Q_OBJECT
public:
- explicit QScrollBar(QWidget *parent = Q_NULLPTR);
- explicit QScrollBar(Qt::Orientation, QWidget *parent = Q_NULLPTR);
+ explicit QScrollBar(QWidget *parent = nullptr);
+ explicit QScrollBar(Qt::Orientation, QWidget *parent = nullptr);
~QScrollBar();
- QSize sizeHint() const Q_DECL_OVERRIDE;
- bool event(QEvent *event) Q_DECL_OVERRIDE;
+ QSize sizeHint() const override;
+ bool event(QEvent *event) override;
protected:
#if QT_CONFIG(wheelevent)
- void wheelEvent(QWheelEvent *) Q_DECL_OVERRIDE;
+ void wheelEvent(QWheelEvent *) override;
#endif
- void paintEvent(QPaintEvent *) Q_DECL_OVERRIDE;
- void mousePressEvent(QMouseEvent *) Q_DECL_OVERRIDE;
- void mouseReleaseEvent(QMouseEvent *) Q_DECL_OVERRIDE;
- void mouseMoveEvent(QMouseEvent *) Q_DECL_OVERRIDE;
- void hideEvent(QHideEvent*) Q_DECL_OVERRIDE;
- void sliderChange(SliderChange change) Q_DECL_OVERRIDE;
+ void paintEvent(QPaintEvent *) override;
+ void mousePressEvent(QMouseEvent *) override;
+ void mouseReleaseEvent(QMouseEvent *) override;
+ void mouseMoveEvent(QMouseEvent *) override;
+ void hideEvent(QHideEvent*) override;
+ void sliderChange(SliderChange change) override;
#ifndef QT_NO_CONTEXTMENU
- void contextMenuEvent(QContextMenuEvent *) Q_DECL_OVERRIDE;
+ void contextMenuEvent(QContextMenuEvent *) override;
#endif
void initStyleOption(QStyleOptionSlider *option) const;
diff --git a/src/widgets/widgets/qsizegrip.h b/src/widgets/widgets/qsizegrip.h
index 6ad2405339..5285ffdfb8 100644
--- a/src/widgets/widgets/qsizegrip.h
+++ b/src/widgets/widgets/qsizegrip.h
@@ -55,19 +55,19 @@ public:
explicit QSizeGrip(QWidget *parent);
~QSizeGrip();
- QSize sizeHint() const Q_DECL_OVERRIDE;
- void setVisible(bool) Q_DECL_OVERRIDE;
+ QSize sizeHint() const override;
+ void setVisible(bool) override;
protected:
- void paintEvent(QPaintEvent *) Q_DECL_OVERRIDE;
- void mousePressEvent(QMouseEvent *) Q_DECL_OVERRIDE;
- void mouseMoveEvent(QMouseEvent *) Q_DECL_OVERRIDE;
- void mouseReleaseEvent(QMouseEvent *mouseEvent) Q_DECL_OVERRIDE;
- void moveEvent(QMoveEvent *moveEvent) Q_DECL_OVERRIDE;
- void showEvent(QShowEvent *showEvent) Q_DECL_OVERRIDE;
- void hideEvent(QHideEvent *hideEvent) Q_DECL_OVERRIDE;
- bool eventFilter(QObject *, QEvent *) Q_DECL_OVERRIDE;
- bool event(QEvent *) Q_DECL_OVERRIDE;
+ void paintEvent(QPaintEvent *) override;
+ void mousePressEvent(QMouseEvent *) override;
+ void mouseMoveEvent(QMouseEvent *) override;
+ void mouseReleaseEvent(QMouseEvent *mouseEvent) override;
+ void moveEvent(QMoveEvent *moveEvent) override;
+ void showEvent(QShowEvent *showEvent) override;
+ void hideEvent(QHideEvent *hideEvent) override;
+ bool eventFilter(QObject *, QEvent *) override;
+ bool event(QEvent *) override;
public:
diff --git a/src/widgets/widgets/qslider.h b/src/widgets/widgets/qslider.h
index 642e836af7..f74f9c8576 100644
--- a/src/widgets/widgets/qslider.h
+++ b/src/widgets/widgets/qslider.h
@@ -68,13 +68,13 @@ public:
};
Q_ENUM(TickPosition)
- explicit QSlider(QWidget *parent = Q_NULLPTR);
- explicit QSlider(Qt::Orientation orientation, QWidget *parent = Q_NULLPTR);
+ explicit QSlider(QWidget *parent = nullptr);
+ explicit QSlider(Qt::Orientation orientation, QWidget *parent = nullptr);
~QSlider();
- QSize sizeHint() const Q_DECL_OVERRIDE;
- QSize minimumSizeHint() const Q_DECL_OVERRIDE;
+ QSize sizeHint() const override;
+ QSize minimumSizeHint() const override;
void setTickPosition(TickPosition position);
TickPosition tickPosition() const;
@@ -82,13 +82,13 @@ public:
void setTickInterval(int ti);
int tickInterval() const;
- bool event(QEvent *event) Q_DECL_OVERRIDE;
+ bool event(QEvent *event) override;
protected:
- void paintEvent(QPaintEvent *ev) Q_DECL_OVERRIDE;
- void mousePressEvent(QMouseEvent *ev) Q_DECL_OVERRIDE;
- void mouseReleaseEvent(QMouseEvent *ev) Q_DECL_OVERRIDE;
- void mouseMoveEvent(QMouseEvent *ev) Q_DECL_OVERRIDE;
+ void paintEvent(QPaintEvent *ev) override;
+ void mousePressEvent(QMouseEvent *ev) override;
+ void mouseReleaseEvent(QMouseEvent *ev) override;
+ void mouseMoveEvent(QMouseEvent *ev) override;
void initStyleOption(QStyleOptionSlider *option) const;
diff --git a/src/widgets/widgets/qspinbox.cpp b/src/widgets/widgets/qspinbox.cpp
index b62a7768ce..561215ec85 100644
--- a/src/widgets/widgets/qspinbox.cpp
+++ b/src/widgets/widgets/qspinbox.cpp
@@ -61,10 +61,10 @@ class QSpinBoxPrivate : public QAbstractSpinBoxPrivate
Q_DECLARE_PUBLIC(QSpinBox)
public:
QSpinBoxPrivate();
- void emitSignals(EmitPolicy ep, const QVariant &) Q_DECL_OVERRIDE;
+ void emitSignals(EmitPolicy ep, const QVariant &) override;
- virtual QVariant valueFromText(const QString &n) const Q_DECL_OVERRIDE;
- virtual QString textFromValue(const QVariant &n) const Q_DECL_OVERRIDE;
+ virtual QVariant valueFromText(const QString &n) const override;
+ virtual QString textFromValue(const QVariant &n) const override;
QVariant validateAndInterpret(QString &input, int &pos,
QValidator::State &state) const;
@@ -82,10 +82,10 @@ class QDoubleSpinBoxPrivate : public QAbstractSpinBoxPrivate
Q_DECLARE_PUBLIC(QDoubleSpinBox)
public:
QDoubleSpinBoxPrivate();
- void emitSignals(EmitPolicy ep, const QVariant &) Q_DECL_OVERRIDE;
+ void emitSignals(EmitPolicy ep, const QVariant &) override;
- virtual QVariant valueFromText(const QString &n) const Q_DECL_OVERRIDE;
- virtual QString textFromValue(const QVariant &n) const Q_DECL_OVERRIDE;
+ virtual QVariant valueFromText(const QString &n) const override;
+ virtual QString textFromValue(const QVariant &n) const override;
QVariant validateAndInterpret(QString &input, int &pos,
QValidator::State &state) const;
double round(double input) const;
diff --git a/src/widgets/widgets/qspinbox.h b/src/widgets/widgets/qspinbox.h
index b61e665413..73489c9a68 100644
--- a/src/widgets/widgets/qspinbox.h
+++ b/src/widgets/widgets/qspinbox.h
@@ -62,7 +62,7 @@ class Q_WIDGETS_EXPORT QSpinBox : public QAbstractSpinBox
Q_PROPERTY(int displayIntegerBase READ displayIntegerBase WRITE setDisplayIntegerBase)
public:
- explicit QSpinBox(QWidget *parent = Q_NULLPTR);
+ explicit QSpinBox(QWidget *parent = nullptr);
~QSpinBox();
int value() const;
@@ -123,7 +123,7 @@ class Q_WIDGETS_EXPORT QDoubleSpinBox : public QAbstractSpinBox
Q_PROPERTY(double singleStep READ singleStep WRITE setSingleStep)
Q_PROPERTY(double value READ value WRITE setValue NOTIFY valueChanged USER true)
public:
- explicit QDoubleSpinBox(QWidget *parent = Q_NULLPTR);
+ explicit QDoubleSpinBox(QWidget *parent = nullptr);
~QDoubleSpinBox();
double value() const;
diff --git a/src/widgets/widgets/qsplashscreen.h b/src/widgets/widgets/qsplashscreen.h
index 1971b8bacf..8bdf4e7749 100644
--- a/src/widgets/widgets/qsplashscreen.h
+++ b/src/widgets/widgets/qsplashscreen.h
@@ -73,9 +73,9 @@ Q_SIGNALS:
void messageChanged(const QString &message);
protected:
- bool event(QEvent *e) Q_DECL_OVERRIDE;
+ bool event(QEvent *e) override;
virtual void drawContents(QPainter *painter);
- void mousePressEvent(QMouseEvent *) Q_DECL_OVERRIDE;
+ void mousePressEvent(QMouseEvent *) override;
private:
Q_DISABLE_COPY(QSplashScreen)
diff --git a/src/widgets/widgets/qsplitter.h b/src/widgets/widgets/qsplitter.h
index bc4d7bca39..16fac48d1c 100644
--- a/src/widgets/widgets/qsplitter.h
+++ b/src/widgets/widgets/qsplitter.h
@@ -64,8 +64,8 @@ class Q_WIDGETS_EXPORT QSplitter : public QFrame
Q_PROPERTY(bool childrenCollapsible READ childrenCollapsible WRITE setChildrenCollapsible)
public:
- explicit QSplitter(QWidget* parent = Q_NULLPTR);
- explicit QSplitter(Qt::Orientation, QWidget* parent = Q_NULLPTR);
+ explicit QSplitter(QWidget* parent = nullptr);
+ explicit QSplitter(Qt::Orientation, QWidget* parent = nullptr);
~QSplitter();
void addWidget(QWidget *widget);
@@ -84,8 +84,8 @@ public:
bool opaqueResize() const;
void refresh();
- QSize sizeHint() const Q_DECL_OVERRIDE;
- QSize minimumSizeHint() const Q_DECL_OVERRIDE;
+ QSize sizeHint() const override;
+ QSize minimumSizeHint() const override;
QList<int> sizes() const;
void setSizes(const QList<int> &list);
@@ -111,12 +111,12 @@ Q_SIGNALS:
protected:
virtual QSplitterHandle *createHandle();
- void childEvent(QChildEvent *) Q_DECL_OVERRIDE;
+ void childEvent(QChildEvent *) override;
- bool event(QEvent *) Q_DECL_OVERRIDE;
- void resizeEvent(QResizeEvent *) Q_DECL_OVERRIDE;
+ bool event(QEvent *) override;
+ void resizeEvent(QResizeEvent *) override;
- void changeEvent(QEvent *) Q_DECL_OVERRIDE;
+ void changeEvent(QEvent *) override;
void moveSplitter(int pos, int index);
void setRubberBand(int position);
int closestLegalPosition(int, int);
@@ -145,15 +145,15 @@ public:
bool opaqueResize() const;
QSplitter *splitter() const;
- QSize sizeHint() const Q_DECL_OVERRIDE;
+ QSize sizeHint() const override;
protected:
- void paintEvent(QPaintEvent *) Q_DECL_OVERRIDE;
- void mouseMoveEvent(QMouseEvent *) Q_DECL_OVERRIDE;
- void mousePressEvent(QMouseEvent *) Q_DECL_OVERRIDE;
- void mouseReleaseEvent(QMouseEvent *) Q_DECL_OVERRIDE;
- void resizeEvent(QResizeEvent *) Q_DECL_OVERRIDE;
- bool event(QEvent *) Q_DECL_OVERRIDE;
+ void paintEvent(QPaintEvent *) override;
+ void mouseMoveEvent(QMouseEvent *) override;
+ void mousePressEvent(QMouseEvent *) override;
+ void mouseReleaseEvent(QMouseEvent *) override;
+ void resizeEvent(QResizeEvent *) override;
+ bool event(QEvent *) override;
void moveSplitter(int p);
int closestLegalPosition(int p);
diff --git a/src/widgets/widgets/qstackedwidget.h b/src/widgets/widgets/qstackedwidget.h
index 29df145b70..5508f905d4 100644
--- a/src/widgets/widgets/qstackedwidget.h
+++ b/src/widgets/widgets/qstackedwidget.h
@@ -56,7 +56,7 @@ class Q_WIDGETS_EXPORT QStackedWidget : public QFrame
Q_PROPERTY(int currentIndex READ currentIndex WRITE setCurrentIndex NOTIFY currentChanged)
Q_PROPERTY(int count READ count)
public:
- explicit QStackedWidget(QWidget *parent = Q_NULLPTR);
+ explicit QStackedWidget(QWidget *parent = nullptr);
~QStackedWidget();
int addWidget(QWidget *w);
@@ -79,7 +79,7 @@ Q_SIGNALS:
void widgetRemoved(int index);
protected:
- bool event(QEvent *e) Q_DECL_OVERRIDE;
+ bool event(QEvent *e) override;
private:
Q_DISABLE_COPY(QStackedWidget)
diff --git a/src/widgets/widgets/qstatusbar.h b/src/widgets/widgets/qstatusbar.h
index 9ac637931c..2492e8487f 100644
--- a/src/widgets/widgets/qstatusbar.h
+++ b/src/widgets/widgets/qstatusbar.h
@@ -56,7 +56,7 @@ class Q_WIDGETS_EXPORT QStatusBar: public QWidget
Q_PROPERTY(bool sizeGripEnabled READ isSizeGripEnabled WRITE setSizeGripEnabled)
public:
- explicit QStatusBar(QWidget *parent = Q_NULLPTR);
+ explicit QStatusBar(QWidget *parent = nullptr);
virtual ~QStatusBar();
void addWidget(QWidget *widget, int stretch = 0);
@@ -79,14 +79,14 @@ Q_SIGNALS:
void messageChanged(const QString &text);
protected:
- void showEvent(QShowEvent *) Q_DECL_OVERRIDE;
- void paintEvent(QPaintEvent *) Q_DECL_OVERRIDE;
- void resizeEvent(QResizeEvent *) Q_DECL_OVERRIDE;
+ void showEvent(QShowEvent *) override;
+ void paintEvent(QPaintEvent *) override;
+ void resizeEvent(QResizeEvent *) override;
// ### Qt 6: consider making reformat() and hideOrShow() private
void reformat();
void hideOrShow();
- bool event(QEvent *) Q_DECL_OVERRIDE;
+ bool event(QEvent *) override;
private:
Q_DISABLE_COPY(QStatusBar)
diff --git a/src/widgets/widgets/qtabbar.h b/src/widgets/widgets/qtabbar.h
index ebcd1094ef..fc619355f0 100644
--- a/src/widgets/widgets/qtabbar.h
+++ b/src/widgets/widgets/qtabbar.h
@@ -71,7 +71,7 @@ class Q_WIDGETS_EXPORT QTabBar: public QWidget
Q_PROPERTY(bool changeCurrentOnDrag READ changeCurrentOnDrag WRITE setChangeCurrentOnDrag)
public:
- explicit QTabBar(QWidget *parent = Q_NULLPTR);
+ explicit QTabBar(QWidget *parent = nullptr);
~QTabBar();
enum Shape { RoundedNorth, RoundedSouth, RoundedWest, RoundedEast,
@@ -136,8 +136,8 @@ public:
int currentIndex() const;
int count() const;
- QSize sizeHint() const Q_DECL_OVERRIDE;
- QSize minimumSizeHint() const Q_DECL_OVERRIDE;
+ QSize sizeHint() const override;
+ QSize minimumSizeHint() const override;
void setDrawBase(bool drawTheBase);
bool drawBase() const;
@@ -194,20 +194,20 @@ protected:
virtual void tabRemoved(int index);
virtual void tabLayoutChange();
- bool event(QEvent *) Q_DECL_OVERRIDE;
- void resizeEvent(QResizeEvent *) Q_DECL_OVERRIDE;
- void showEvent(QShowEvent *) Q_DECL_OVERRIDE;
- void hideEvent(QHideEvent *) Q_DECL_OVERRIDE;
- void paintEvent(QPaintEvent *) Q_DECL_OVERRIDE;
- void mousePressEvent (QMouseEvent *) Q_DECL_OVERRIDE;
- void mouseMoveEvent (QMouseEvent *) Q_DECL_OVERRIDE;
- void mouseReleaseEvent (QMouseEvent *) Q_DECL_OVERRIDE;
+ bool event(QEvent *) override;
+ void resizeEvent(QResizeEvent *) override;
+ void showEvent(QShowEvent *) override;
+ void hideEvent(QHideEvent *) override;
+ void paintEvent(QPaintEvent *) override;
+ void mousePressEvent (QMouseEvent *) override;
+ void mouseMoveEvent (QMouseEvent *) override;
+ void mouseReleaseEvent (QMouseEvent *) override;
#if QT_CONFIG(wheelevent)
- void wheelEvent(QWheelEvent *event) Q_DECL_OVERRIDE;
+ void wheelEvent(QWheelEvent *event) override;
#endif
- void keyPressEvent(QKeyEvent *) Q_DECL_OVERRIDE;
- void changeEvent(QEvent *) Q_DECL_OVERRIDE;
- void timerEvent(QTimerEvent *event) Q_DECL_OVERRIDE;
+ void keyPressEvent(QKeyEvent *) override;
+ void changeEvent(QEvent *) override;
+ void timerEvent(QTimerEvent *event) override;
void initStyleOption(QStyleOptionTab *option, int tabIndex) const;
#ifndef QT_NO_ACCESSIBILITY
diff --git a/src/widgets/widgets/qtabbar_p.h b/src/widgets/widgets/qtabbar_p.h
index 195ff79c5d..1092878f2c 100644
--- a/src/widgets/widgets/qtabbar_p.h
+++ b/src/widgets/widgets/qtabbar_p.h
@@ -71,11 +71,11 @@ QT_BEGIN_NAMESPACE
class QMovableTabWidget : public QWidget
{
public:
- explicit QMovableTabWidget(QWidget *parent = Q_NULLPTR);
+ explicit QMovableTabWidget(QWidget *parent = nullptr);
void setPixmap(const QPixmap &pixmap);
protected:
- void paintEvent(QPaintEvent *e) Q_DECL_OVERRIDE;
+ void paintEvent(QPaintEvent *e) override;
private:
QPixmap m_pixmap;
@@ -142,9 +142,9 @@ public:
TabBarAnimation(Tab *t, QTabBarPrivate *_priv) : tab(t), priv(_priv)
{ setEasingCurve(QEasingCurve::InOutQuad); }
- void updateCurrentValue(const QVariant &current) Q_DECL_OVERRIDE;
+ void updateCurrentValue(const QVariant &current) override;
- void updateState(State, State newState) Q_DECL_OVERRIDE;
+ void updateState(State, State newState) override;
private:
//these are needed for the callbacks
Tab *tab;
@@ -278,12 +278,12 @@ class CloseButton : public QAbstractButton
public:
explicit CloseButton(QWidget *parent = 0);
- QSize sizeHint() const Q_DECL_OVERRIDE;
- QSize minimumSizeHint() const Q_DECL_OVERRIDE
+ QSize sizeHint() const override;
+ QSize minimumSizeHint() const override
{ return sizeHint(); }
- void enterEvent(QEvent *event) Q_DECL_OVERRIDE;
- void leaveEvent(QEvent *event) Q_DECL_OVERRIDE;
- void paintEvent(QPaintEvent *event) Q_DECL_OVERRIDE;
+ void enterEvent(QEvent *event) override;
+ void leaveEvent(QEvent *event) override;
+ void paintEvent(QPaintEvent *event) override;
};
QT_END_NAMESPACE
diff --git a/src/widgets/widgets/qtabwidget.h b/src/widgets/widgets/qtabwidget.h
index b80fdba1fb..f55e71488b 100644
--- a/src/widgets/widgets/qtabwidget.h
+++ b/src/widgets/widgets/qtabwidget.h
@@ -68,7 +68,7 @@ class Q_WIDGETS_EXPORT QTabWidget : public QWidget
Q_PROPERTY(bool tabBarAutoHide READ tabBarAutoHide WRITE setTabBarAutoHide)
public:
- explicit QTabWidget(QWidget *parent = Q_NULLPTR);
+ explicit QTabWidget(QWidget *parent = nullptr);
~QTabWidget();
int addTab(QWidget *widget, const QString &);
@@ -120,10 +120,10 @@ public:
TabShape tabShape() const;
void setTabShape(TabShape s);
- QSize sizeHint() const Q_DECL_OVERRIDE;
- QSize minimumSizeHint() const Q_DECL_OVERRIDE;
- int heightForWidth(int width) const Q_DECL_OVERRIDE;
- bool hasHeightForWidth() const Q_DECL_OVERRIDE;
+ QSize sizeHint() const override;
+ QSize minimumSizeHint() const override;
+ int heightForWidth(int width) const override;
+ bool hasHeightForWidth() const override;
void setCornerWidget(QWidget * w, Qt::Corner corner = Qt::TopRightCorner);
QWidget * cornerWidget(Qt::Corner corner = Qt::TopRightCorner) const;
@@ -161,13 +161,13 @@ protected:
virtual void tabInserted(int index);
virtual void tabRemoved(int index);
- void showEvent(QShowEvent *) Q_DECL_OVERRIDE;
- void resizeEvent(QResizeEvent *) Q_DECL_OVERRIDE;
- void keyPressEvent(QKeyEvent *) Q_DECL_OVERRIDE;
- void paintEvent(QPaintEvent *) Q_DECL_OVERRIDE;
+ void showEvent(QShowEvent *) override;
+ void resizeEvent(QResizeEvent *) override;
+ void keyPressEvent(QKeyEvent *) override;
+ void paintEvent(QPaintEvent *) override;
void setTabBar(QTabBar *);
- void changeEvent(QEvent *) Q_DECL_OVERRIDE;
- bool event(QEvent *) Q_DECL_OVERRIDE;
+ void changeEvent(QEvent *) override;
+ bool event(QEvent *) override;
void initStyleOption(QStyleOptionTabWidgetFrame *option) const;
diff --git a/src/widgets/widgets/qtextbrowser.cpp b/src/widgets/widgets/qtextbrowser.cpp
index 0797120960..fa4dd14c92 100644
--- a/src/widgets/widgets/qtextbrowser.cpp
+++ b/src/widgets/widgets/qtextbrowser.cpp
@@ -135,7 +135,7 @@ public:
void setSource(const QUrl &url);
// re-imlemented from QTextEditPrivate
- virtual QUrl resolveUrl(const QUrl &url) const Q_DECL_OVERRIDE;
+ virtual QUrl resolveUrl(const QUrl &url) const override;
inline QUrl resolveUrl(const QString &url) const
{ return resolveUrl(QUrl(url)); }
diff --git a/src/widgets/widgets/qtextbrowser.h b/src/widgets/widgets/qtextbrowser.h
index f36c86bc86..ea81256f50 100644
--- a/src/widgets/widgets/qtextbrowser.h
+++ b/src/widgets/widgets/qtextbrowser.h
@@ -63,7 +63,7 @@ class Q_WIDGETS_EXPORT QTextBrowser : public QTextEdit
Q_PROPERTY(bool openLinks READ openLinks WRITE setOpenLinks)
public:
- explicit QTextBrowser(QWidget* parent = Q_NULLPTR);
+ explicit QTextBrowser(QWidget* parent = nullptr);
virtual ~QTextBrowser();
QUrl source() const;
@@ -71,7 +71,7 @@ public:
QStringList searchPaths() const;
void setSearchPaths(const QStringList &paths);
- virtual QVariant loadResource(int type, const QUrl &name) Q_DECL_OVERRIDE;
+ virtual QVariant loadResource(int type, const QUrl &name) override;
bool isBackwardAvailable() const;
bool isForwardAvailable() const;
@@ -104,14 +104,14 @@ Q_SIGNALS:
void anchorClicked(const QUrl &);
protected:
- bool event(QEvent *e) Q_DECL_OVERRIDE;
- virtual void keyPressEvent(QKeyEvent *ev) Q_DECL_OVERRIDE;
- virtual void mouseMoveEvent(QMouseEvent *ev) Q_DECL_OVERRIDE;
- virtual void mousePressEvent(QMouseEvent *ev) Q_DECL_OVERRIDE;
- virtual void mouseReleaseEvent(QMouseEvent *ev) Q_DECL_OVERRIDE;
- virtual void focusOutEvent(QFocusEvent *ev) Q_DECL_OVERRIDE;
- virtual bool focusNextPrevChild(bool next) Q_DECL_OVERRIDE;
- virtual void paintEvent(QPaintEvent *e) Q_DECL_OVERRIDE;
+ bool event(QEvent *e) override;
+ virtual void keyPressEvent(QKeyEvent *ev) override;
+ virtual void mouseMoveEvent(QMouseEvent *ev) override;
+ virtual void mousePressEvent(QMouseEvent *ev) override;
+ virtual void mouseReleaseEvent(QMouseEvent *ev) override;
+ virtual void focusOutEvent(QFocusEvent *ev) override;
+ virtual bool focusNextPrevChild(bool next) override;
+ virtual void paintEvent(QPaintEvent *e) override;
private:
Q_DISABLE_COPY(QTextBrowser)
diff --git a/src/widgets/widgets/qtextedit.cpp b/src/widgets/widgets/qtextedit.cpp
index df8ecba112..95c85dc4fe 100644
--- a/src/widgets/widgets/qtextedit.cpp
+++ b/src/widgets/widgets/qtextedit.cpp
@@ -84,19 +84,19 @@ class QTextEditControl : public QWidgetTextControl
public:
inline QTextEditControl(QObject *parent) : QWidgetTextControl(parent) {}
- virtual QMimeData *createMimeDataFromSelection() const Q_DECL_OVERRIDE {
+ virtual QMimeData *createMimeDataFromSelection() const override {
QTextEdit *ed = qobject_cast<QTextEdit *>(parent());
if (!ed)
return QWidgetTextControl::createMimeDataFromSelection();
return ed->createMimeDataFromSelection();
}
- virtual bool canInsertFromMimeData(const QMimeData *source) const Q_DECL_OVERRIDE {
+ virtual bool canInsertFromMimeData(const QMimeData *source) const override {
QTextEdit *ed = qobject_cast<QTextEdit *>(parent());
if (!ed)
return QWidgetTextControl::canInsertFromMimeData(source);
return ed->canInsertFromMimeData(source);
}
- virtual void insertFromMimeData(const QMimeData *source) Q_DECL_OVERRIDE {
+ virtual void insertFromMimeData(const QMimeData *source) override {
QTextEdit *ed = qobject_cast<QTextEdit *>(parent());
if (!ed)
QWidgetTextControl::insertFromMimeData(source);
diff --git a/src/widgets/widgets/qtextedit.h b/src/widgets/widgets/qtextedit.h
index 954f0167ae..9e0913160d 100644
--- a/src/widgets/widgets/qtextedit.h
+++ b/src/widgets/widgets/qtextedit.h
@@ -102,8 +102,8 @@ public:
Q_DECLARE_FLAGS(AutoFormatting, AutoFormattingFlag)
Q_FLAG(AutoFormatting)
- explicit QTextEdit(QWidget *parent = Q_NULLPTR);
- explicit QTextEdit(const QString &text, QWidget *parent = Q_NULLPTR);
+ explicit QTextEdit(QWidget *parent = nullptr);
+ explicit QTextEdit(const QString &text, QWidget *parent = nullptr);
virtual ~QTextEdit();
void setDocument(QTextDocument *document);
@@ -216,7 +216,7 @@ public:
void print(QPagedPaintDevice *printer) const;
- QVariant inputMethodQuery(Qt::InputMethodQuery property) const Q_DECL_OVERRIDE;
+ QVariant inputMethodQuery(Qt::InputMethodQuery property) const override;
Q_INVOKABLE QVariant inputMethodQuery(Qt::InputMethodQuery query, QVariant argument) const;
public Q_SLOTS:
@@ -270,43 +270,43 @@ Q_SIGNALS:
void cursorPositionChanged();
protected:
- virtual bool event(QEvent *e) Q_DECL_OVERRIDE;
- virtual void timerEvent(QTimerEvent *e) Q_DECL_OVERRIDE;
- virtual void keyPressEvent(QKeyEvent *e) Q_DECL_OVERRIDE;
- virtual void keyReleaseEvent(QKeyEvent *e) Q_DECL_OVERRIDE;
- virtual void resizeEvent(QResizeEvent *e) Q_DECL_OVERRIDE;
- virtual void paintEvent(QPaintEvent *e) Q_DECL_OVERRIDE;
- virtual void mousePressEvent(QMouseEvent *e) Q_DECL_OVERRIDE;
- virtual void mouseMoveEvent(QMouseEvent *e) Q_DECL_OVERRIDE;
- virtual void mouseReleaseEvent(QMouseEvent *e) Q_DECL_OVERRIDE;
- virtual void mouseDoubleClickEvent(QMouseEvent *e) Q_DECL_OVERRIDE;
- virtual bool focusNextPrevChild(bool next) Q_DECL_OVERRIDE;
+ virtual bool event(QEvent *e) override;
+ virtual void timerEvent(QTimerEvent *e) override;
+ virtual void keyPressEvent(QKeyEvent *e) override;
+ virtual void keyReleaseEvent(QKeyEvent *e) override;
+ virtual void resizeEvent(QResizeEvent *e) override;
+ virtual void paintEvent(QPaintEvent *e) override;
+ virtual void mousePressEvent(QMouseEvent *e) override;
+ virtual void mouseMoveEvent(QMouseEvent *e) override;
+ virtual void mouseReleaseEvent(QMouseEvent *e) override;
+ virtual void mouseDoubleClickEvent(QMouseEvent *e) override;
+ virtual bool focusNextPrevChild(bool next) override;
#ifndef QT_NO_CONTEXTMENU
- virtual void contextMenuEvent(QContextMenuEvent *e) Q_DECL_OVERRIDE;
+ virtual void contextMenuEvent(QContextMenuEvent *e) override;
#endif
#ifndef QT_NO_DRAGANDDROP
- virtual void dragEnterEvent(QDragEnterEvent *e) Q_DECL_OVERRIDE;
- virtual void dragLeaveEvent(QDragLeaveEvent *e) Q_DECL_OVERRIDE;
- virtual void dragMoveEvent(QDragMoveEvent *e) Q_DECL_OVERRIDE;
- virtual void dropEvent(QDropEvent *e) Q_DECL_OVERRIDE;
+ virtual void dragEnterEvent(QDragEnterEvent *e) override;
+ virtual void dragLeaveEvent(QDragLeaveEvent *e) override;
+ virtual void dragMoveEvent(QDragMoveEvent *e) override;
+ virtual void dropEvent(QDropEvent *e) override;
#endif
- virtual void focusInEvent(QFocusEvent *e) Q_DECL_OVERRIDE;
- virtual void focusOutEvent(QFocusEvent *e) Q_DECL_OVERRIDE;
- virtual void showEvent(QShowEvent *) Q_DECL_OVERRIDE;
- virtual void changeEvent(QEvent *e) Q_DECL_OVERRIDE;
+ virtual void focusInEvent(QFocusEvent *e) override;
+ virtual void focusOutEvent(QFocusEvent *e) override;
+ virtual void showEvent(QShowEvent *) override;
+ virtual void changeEvent(QEvent *e) override;
#if QT_CONFIG(wheelevent)
- virtual void wheelEvent(QWheelEvent *e) Q_DECL_OVERRIDE;
+ virtual void wheelEvent(QWheelEvent *e) override;
#endif
virtual QMimeData *createMimeDataFromSelection() const;
virtual bool canInsertFromMimeData(const QMimeData *source) const;
virtual void insertFromMimeData(const QMimeData *source);
- virtual void inputMethodEvent(QInputMethodEvent *) Q_DECL_OVERRIDE;
+ virtual void inputMethodEvent(QInputMethodEvent *) override;
QTextEdit(QTextEditPrivate &dd, QWidget *parent);
- virtual void scrollContentsBy(int dx, int dy) Q_DECL_OVERRIDE;
+ virtual void scrollContentsBy(int dx, int dy) override;
virtual void doSetTextCursor(const QTextCursor &cursor);
void zoomInF(float range);
diff --git a/src/widgets/widgets/qtoolbar.h b/src/widgets/widgets/qtoolbar.h
index 9ffb472c76..0253541a2e 100644
--- a/src/widgets/widgets/qtoolbar.h
+++ b/src/widgets/widgets/qtoolbar.h
@@ -76,8 +76,8 @@ class Q_WIDGETS_EXPORT QToolBar : public QWidget
Q_PROPERTY(bool floatable READ isFloatable WRITE setFloatable)
public:
- explicit QToolBar(const QString &title, QWidget *parent = Q_NULLPTR);
- explicit QToolBar(QWidget *parent = Q_NULLPTR);
+ explicit QToolBar(const QString &title, QWidget *parent = nullptr);
+ explicit QToolBar(QWidget *parent = nullptr);
~QToolBar();
void setMovable(bool movable);
@@ -188,10 +188,10 @@ Q_SIGNALS:
void visibilityChanged(bool visible);
protected:
- void actionEvent(QActionEvent *event) Q_DECL_OVERRIDE;
- void changeEvent(QEvent *event) Q_DECL_OVERRIDE;
- void paintEvent(QPaintEvent *event) Q_DECL_OVERRIDE;
- bool event(QEvent *event) Q_DECL_OVERRIDE;
+ void actionEvent(QActionEvent *event) override;
+ void changeEvent(QEvent *event) override;
+ void paintEvent(QPaintEvent *event) override;
+ bool event(QEvent *event) override;
void initStyleOption(QStyleOptionToolBar *option) const;
diff --git a/src/widgets/widgets/qtoolbarextension_p.h b/src/widgets/widgets/qtoolbarextension_p.h
index b6223107c4..a388f1e40f 100644
--- a/src/widgets/widgets/qtoolbarextension_p.h
+++ b/src/widgets/widgets/qtoolbarextension_p.h
@@ -64,8 +64,8 @@ class Q_AUTOTEST_EXPORT QToolBarExtension : public QToolButton
public:
explicit QToolBarExtension(QWidget *parent);
- void paintEvent(QPaintEvent *) Q_DECL_OVERRIDE;
- QSize sizeHint() const Q_DECL_OVERRIDE;
+ void paintEvent(QPaintEvent *) override;
+ QSize sizeHint() const override;
public Q_SLOTS:
void setOrientation(Qt::Orientation o);
diff --git a/src/widgets/widgets/qtoolbarlayout_p.h b/src/widgets/widgets/qtoolbarlayout_p.h
index 9a81c4e50e..8c60164439 100644
--- a/src/widgets/widgets/qtoolbarlayout_p.h
+++ b/src/widgets/widgets/qtoolbarlayout_p.h
@@ -68,7 +68,7 @@ class QToolBarItem : public QWidgetItem
{
public:
QToolBarItem(QWidget *widget);
- bool isEmpty() const Q_DECL_OVERRIDE;
+ bool isEmpty() const override;
QAction *action;
bool customWidget;
@@ -82,22 +82,22 @@ public:
QToolBarLayout(QWidget *parent = 0);
~QToolBarLayout();
- void addItem(QLayoutItem *item) Q_DECL_OVERRIDE;
- QLayoutItem *itemAt(int index) const Q_DECL_OVERRIDE;
- QLayoutItem *takeAt(int index) Q_DECL_OVERRIDE;
- int count() const Q_DECL_OVERRIDE;
+ void addItem(QLayoutItem *item) override;
+ QLayoutItem *itemAt(int index) const override;
+ QLayoutItem *takeAt(int index) override;
+ int count() const override;
- bool isEmpty() const Q_DECL_OVERRIDE;
- void invalidate() Q_DECL_OVERRIDE;
- Qt::Orientations expandingDirections() const Q_DECL_OVERRIDE;
+ bool isEmpty() const override;
+ void invalidate() override;
+ Qt::Orientations expandingDirections() const override;
- void setGeometry(const QRect &r) Q_DECL_OVERRIDE;
- QSize minimumSize() const Q_DECL_OVERRIDE;
- QSize sizeHint() const Q_DECL_OVERRIDE;
+ void setGeometry(const QRect &r) override;
+ QSize minimumSize() const override;
+ QSize sizeHint() const override;
void insertAction(int index, QAction *action);
int indexOf(QAction *action) const;
- int indexOf(QWidget *widget) const Q_DECL_OVERRIDE { return QLayout::indexOf(widget); }
+ int indexOf(QWidget *widget) const override { return QLayout::indexOf(widget); }
bool layoutActions(const QSize &size);
QSize expandedSize(const QSize &size) const;
diff --git a/src/widgets/widgets/qtoolbarseparator_p.h b/src/widgets/widgets/qtoolbarseparator_p.h
index 8c9cf9f46a..d52b4fa6ae 100644
--- a/src/widgets/widgets/qtoolbarseparator_p.h
+++ b/src/widgets/widgets/qtoolbarseparator_p.h
@@ -71,9 +71,9 @@ public:
Qt::Orientation orientation() const;
- QSize sizeHint() const Q_DECL_OVERRIDE;
+ QSize sizeHint() const override;
- void paintEvent(QPaintEvent *) Q_DECL_OVERRIDE;
+ void paintEvent(QPaintEvent *) override;
void initStyleOption(QStyleOption *option) const;
public Q_SLOTS:
diff --git a/src/widgets/widgets/qtoolbox.cpp b/src/widgets/widgets/qtoolbox.cpp
index fdcd07eb06..46ade0277c 100644
--- a/src/widgets/widgets/qtoolbox.cpp
+++ b/src/widgets/widgets/qtoolbox.cpp
@@ -69,12 +69,12 @@ public:
inline void setSelected(bool b) { selected = b; update(); }
inline void setIndex(int newIndex) { indexInPage = newIndex; }
- QSize sizeHint() const Q_DECL_OVERRIDE;
- QSize minimumSizeHint() const Q_DECL_OVERRIDE;
+ QSize sizeHint() const override;
+ QSize minimumSizeHint() const override;
protected:
void initStyleOption(QStyleOptionToolBox *opt) const;
- void paintEvent(QPaintEvent *) Q_DECL_OVERRIDE;
+ void paintEvent(QPaintEvent *) override;
private:
bool selected;
diff --git a/src/widgets/widgets/qtoolbox.h b/src/widgets/widgets/qtoolbox.h
index 321507ba07..2796631b94 100644
--- a/src/widgets/widgets/qtoolbox.h
+++ b/src/widgets/widgets/qtoolbox.h
@@ -57,7 +57,7 @@ class Q_WIDGETS_EXPORT QToolBox : public QFrame
Q_PROPERTY(int count READ count)
public:
- explicit QToolBox(QWidget *parent = Q_NULLPTR, Qt::WindowFlags f = Qt::WindowFlags());
+ explicit QToolBox(QWidget *parent = nullptr, Qt::WindowFlags f = Qt::WindowFlags());
~QToolBox();
int addItem(QWidget *widget, const QString &text);
@@ -95,11 +95,11 @@ Q_SIGNALS:
void currentChanged(int index);
protected:
- bool event(QEvent *e) Q_DECL_OVERRIDE;
+ bool event(QEvent *e) override;
virtual void itemInserted(int index);
virtual void itemRemoved(int index);
- void showEvent(QShowEvent *e) Q_DECL_OVERRIDE;
- void changeEvent(QEvent *) Q_DECL_OVERRIDE;
+ void showEvent(QShowEvent *e) override;
+ void changeEvent(QEvent *) override;
private:
diff --git a/src/widgets/widgets/qtoolbutton.cpp b/src/widgets/widgets/qtoolbutton.cpp
index 96b88340cd..c2bf13a3e9 100644
--- a/src/widgets/widgets/qtoolbutton.cpp
+++ b/src/widgets/widgets/qtoolbutton.cpp
@@ -348,7 +348,7 @@ QSize QToolButton::sizeHint() const
if (opt.toolButtonStyle != Qt::ToolButtonIconOnly) {
QSize textSize = fm.size(Qt::TextShowMnemonic, text());
- textSize.setWidth(textSize.width() + fm.width(QLatin1Char(' '))*2);
+ textSize.setWidth(textSize.width() + fm.horizontalAdvance(QLatin1Char(' '))*2);
if (opt.toolButtonStyle == Qt::ToolButtonTextUnderIcon) {
h += 4 + textSize.height();
if (textSize.width() > w)
diff --git a/src/widgets/widgets/qtoolbutton.h b/src/widgets/widgets/qtoolbutton.h
index dd9964cb94..52bd2d5f7a 100644
--- a/src/widgets/widgets/qtoolbutton.h
+++ b/src/widgets/widgets/qtoolbutton.h
@@ -71,11 +71,11 @@ public:
};
Q_ENUM(ToolButtonPopupMode)
- explicit QToolButton(QWidget *parent = Q_NULLPTR);
+ explicit QToolButton(QWidget *parent = nullptr);
~QToolButton();
- QSize sizeHint() const Q_DECL_OVERRIDE;
- QSize minimumSizeHint() const Q_DECL_OVERRIDE;
+ QSize sizeHint() const override;
+ QSize minimumSizeHint() const override;
Qt::ToolButtonStyle toolButtonStyle() const;
@@ -106,19 +106,19 @@ Q_SIGNALS:
void triggered(QAction *);
protected:
- bool event(QEvent *e) Q_DECL_OVERRIDE;
- void mousePressEvent(QMouseEvent *) Q_DECL_OVERRIDE;
- void mouseReleaseEvent(QMouseEvent *) Q_DECL_OVERRIDE;
- void paintEvent(QPaintEvent *) Q_DECL_OVERRIDE;
- void actionEvent(QActionEvent *) Q_DECL_OVERRIDE;
-
- void enterEvent(QEvent *) Q_DECL_OVERRIDE;
- void leaveEvent(QEvent *) Q_DECL_OVERRIDE;
- void timerEvent(QTimerEvent *) Q_DECL_OVERRIDE;
- void changeEvent(QEvent *) Q_DECL_OVERRIDE;
-
- bool hitButton(const QPoint &pos) const Q_DECL_OVERRIDE;
- void nextCheckState() Q_DECL_OVERRIDE;
+ bool event(QEvent *e) override;
+ void mousePressEvent(QMouseEvent *) override;
+ void mouseReleaseEvent(QMouseEvent *) override;
+ void paintEvent(QPaintEvent *) override;
+ void actionEvent(QActionEvent *) override;
+
+ void enterEvent(QEvent *) override;
+ void leaveEvent(QEvent *) override;
+ void timerEvent(QTimerEvent *) override;
+ void changeEvent(QEvent *) override;
+
+ bool hitButton(const QPoint &pos) const override;
+ void nextCheckState() override;
void initStyleOption(QStyleOptionToolButton *option) const;
private:
diff --git a/src/widgets/widgets/qwidgetlinecontrol_p.h b/src/widgets/widgets/qwidgetlinecontrol_p.h
index 16c9cc71eb..16eb337416 100644
--- a/src/widgets/widgets/qwidgetlinecontrol_p.h
+++ b/src/widgets/widgets/qwidgetlinecontrol_p.h
@@ -550,7 +550,7 @@ Q_SIGNALS:
void editFocusChange(bool);
#endif
protected:
- virtual void timerEvent(QTimerEvent *event) Q_DECL_OVERRIDE;
+ virtual void timerEvent(QTimerEvent *event) override;
private Q_SLOTS:
void _q_deleteSelected();
diff --git a/src/widgets/widgets/qwidgetresizehandler_p.h b/src/widgets/widgets/qwidgetresizehandler_p.h
index 669cb6f256..b87bbd6229 100644
--- a/src/widgets/widgets/qwidgetresizehandler_p.h
+++ b/src/widgets/widgets/qwidgetresizehandler_p.h
@@ -95,7 +95,7 @@ Q_SIGNALS:
void activate();
protected:
- bool eventFilter(QObject *o, QEvent *e) Q_DECL_OVERRIDE;
+ bool eventFilter(QObject *o, QEvent *e) override;
void mouseMoveEvent(QMouseEvent *e);
void keyPressEvent(QKeyEvent *e);
diff --git a/src/widgets/widgets/qwidgettextcontrol.cpp b/src/widgets/widgets/qwidgettextcontrol.cpp
index aa5a3329e9..6a8d6a3654 100644
--- a/src/widgets/widgets/qwidgettextcontrol.cpp
+++ b/src/widgets/widgets/qwidgettextcontrol.cpp
@@ -1414,7 +1414,7 @@ QRectF QWidgetTextControlPrivate::rectForPosition(int position) const
if (relativePos < line.textLength() - line.textStart())
w = line.cursorToX(relativePos + 1) - x;
else
- w = QFontMetrics(block.layout()->font()).width(QLatin1Char(' ')); // in sync with QTextLine::draw()
+ w = QFontMetrics(block.layout()->font()).horizontalAdvance(QLatin1Char(' ')); // in sync with QTextLine::draw()
}
r = QRectF(layoutPos.x() + x, layoutPos.y() + line.y(),
cursorWidth + w, line.height());
@@ -1887,8 +1887,6 @@ void QWidgetTextControlPrivate::contextMenuEvent(const QPoint &screenPos, const
Q_UNUSED(contextWidget);
#else
Q_Q(QWidgetTextControl);
- if (!hasFocus)
- return;
QMenu *menu = q->createStandardContextMenu(docPos, contextWidget);
if (!menu)
return;
diff --git a/src/widgets/widgets/qwidgettextcontrol_p.h b/src/widgets/widgets/qwidgettextcontrol_p.h
index 11ff63c5e4..4b2acbd934 100644
--- a/src/widgets/widgets/qwidgettextcontrol_p.h
+++ b/src/widgets/widgets/qwidgettextcontrol_p.h
@@ -258,9 +258,9 @@ public:
bool findNextPrevAnchor(const QTextCursor& from, bool next, QTextCursor& newAnchor);
protected:
- virtual void timerEvent(QTimerEvent *e) Q_DECL_OVERRIDE;
+ virtual void timerEvent(QTimerEvent *e) override;
- virtual bool event(QEvent *e) Q_DECL_OVERRIDE;
+ virtual bool event(QEvent *e) override;
private:
Q_DISABLE_COPY(QWidgetTextControl)
@@ -296,9 +296,9 @@ class QTextEditMimeData : public QMimeData
public:
inline QTextEditMimeData(const QTextDocumentFragment &aFragment) : fragment(aFragment) {}
- virtual QStringList formats() const Q_DECL_OVERRIDE;
+ virtual QStringList formats() const override;
protected:
- virtual QVariant retrieveData(const QString &mimeType, QVariant::Type type) const Q_DECL_OVERRIDE;
+ virtual QVariant retrieveData(const QString &mimeType, QVariant::Type type) const override;
private:
void setup() const;
diff --git a/src/winmain/qtmain_win.cpp b/src/winmain/qtmain_win.cpp
index 5f90055762..3dc1ac0fba 100644
--- a/src/winmain/qtmain_win.cpp
+++ b/src/winmain/qtmain_win.cpp
@@ -99,7 +99,7 @@ extern "C" int APIENTRY WinMain(HINSTANCE, HINSTANCE, LPSTR /*cmdParamarg*/, int
char **argv = new char *[argc + 1];
for (int i = 0; i < argc; ++i)
argv[i] = wideToMulti(CP_ACP, argvW[i]);
- argv[argc] = Q_NULLPTR;
+ argv[argc] = nullptr;
LocalFree(argvW);
const int exitCode = main(argc, argv);
for (int i = 0; i < argc && argv[i]; ++i)
diff --git a/src/winmain/qtmain_winrt.cpp b/src/winmain/qtmain_winrt.cpp
index 13ca561d35..1f5b98794d 100644
--- a/src/winmain/qtmain_winrt.cpp
+++ b/src/winmain/qtmain_winrt.cpp
@@ -229,12 +229,12 @@ private:
return S_OK;
}
- HRESULT __stdcall OnActivated(IActivatedEventArgs *args) Q_DECL_OVERRIDE
+ HRESULT __stdcall OnActivated(IActivatedEventArgs *args) override
{
return activatedLaunch(args);
}
- HRESULT __stdcall OnLaunched(ILaunchActivatedEventArgs *launchArgs) Q_DECL_OVERRIDE
+ HRESULT __stdcall OnLaunched(ILaunchActivatedEventArgs *launchArgs) override
{
ComPtr<IPrelaunchActivatedEventArgs> preArgs;
HRESULT hr = launchArgs->QueryInterface(preArgs.GetAddressOf());
@@ -324,41 +324,41 @@ private:
return S_OK;
}
- HRESULT __stdcall OnFileActivated(IFileActivatedEventArgs *args) Q_DECL_OVERRIDE
+ HRESULT __stdcall OnFileActivated(IFileActivatedEventArgs *args) override
{
return activatedLaunch(args);
}
- HRESULT __stdcall OnSearchActivated(ISearchActivatedEventArgs *args) Q_DECL_OVERRIDE
+ HRESULT __stdcall OnSearchActivated(ISearchActivatedEventArgs *args) override
{
Q_UNUSED(args);
return S_OK;
}
- HRESULT __stdcall OnShareTargetActivated(IShareTargetActivatedEventArgs *args) Q_DECL_OVERRIDE
+ HRESULT __stdcall OnShareTargetActivated(IShareTargetActivatedEventArgs *args) override
{
return activatedLaunch(args);
}
- HRESULT __stdcall OnFileOpenPickerActivated(IFileOpenPickerActivatedEventArgs *args) Q_DECL_OVERRIDE
+ HRESULT __stdcall OnFileOpenPickerActivated(IFileOpenPickerActivatedEventArgs *args) override
{
Q_UNUSED(args);
return S_OK;
}
- HRESULT __stdcall OnFileSavePickerActivated(IFileSavePickerActivatedEventArgs *args) Q_DECL_OVERRIDE
+ HRESULT __stdcall OnFileSavePickerActivated(IFileSavePickerActivatedEventArgs *args) override
{
Q_UNUSED(args);
return S_OK;
}
- HRESULT __stdcall OnCachedFileUpdaterActivated(ICachedFileUpdaterActivatedEventArgs *args) Q_DECL_OVERRIDE
+ HRESULT __stdcall OnCachedFileUpdaterActivated(ICachedFileUpdaterActivatedEventArgs *args) override
{
Q_UNUSED(args);
return S_OK;
}
- HRESULT __stdcall OnWindowCreated(Xaml::IWindowCreatedEventArgs *args) Q_DECL_OVERRIDE
+ HRESULT __stdcall OnWindowCreated(Xaml::IWindowCreatedEventArgs *args) override
{
Q_UNUSED(args);
return S_OK;
diff --git a/src/xml/dom/qdom.cpp b/src/xml/dom/qdom.cpp
index 9affd697a0..df2d7c3ce8 100644
--- a/src/xml/dom/qdom.cpp
+++ b/src/xml/dom/qdom.cpp
@@ -291,16 +291,16 @@ public:
void init();
// Reimplemented from QDomNodePrivate
- QDomNodePrivate* cloneNode(bool deep = true) Q_DECL_OVERRIDE;
- QDomNodePrivate* insertBefore(QDomNodePrivate* newChild, QDomNodePrivate* refChild) Q_DECL_OVERRIDE;
- QDomNodePrivate* insertAfter(QDomNodePrivate* newChild, QDomNodePrivate* refChild) Q_DECL_OVERRIDE;
- QDomNodePrivate* replaceChild(QDomNodePrivate* newChild, QDomNodePrivate* oldChild) Q_DECL_OVERRIDE;
- QDomNodePrivate* removeChild(QDomNodePrivate* oldChild) Q_DECL_OVERRIDE;
- QDomNodePrivate* appendChild(QDomNodePrivate* newChild) Q_DECL_OVERRIDE;
+ QDomNodePrivate* cloneNode(bool deep = true) override;
+ QDomNodePrivate* insertBefore(QDomNodePrivate* newChild, QDomNodePrivate* refChild) override;
+ QDomNodePrivate* insertAfter(QDomNodePrivate* newChild, QDomNodePrivate* refChild) override;
+ QDomNodePrivate* replaceChild(QDomNodePrivate* newChild, QDomNodePrivate* oldChild) override;
+ QDomNodePrivate* removeChild(QDomNodePrivate* oldChild) override;
+ QDomNodePrivate* appendChild(QDomNodePrivate* newChild) override;
- QDomNode::NodeType nodeType() const Q_DECL_OVERRIDE { return QDomNode::DocumentTypeNode; }
+ QDomNode::NodeType nodeType() const override { return QDomNode::DocumentTypeNode; }
- void save(QTextStream& s, int, int) const Q_DECL_OVERRIDE;
+ void save(QTextStream& s, int, int) const override;
// Variables
QDomNamedNodeMapPrivate* entities;
@@ -317,8 +317,8 @@ public:
QDomDocumentFragmentPrivate(QDomNodePrivate* n, bool deep);
// Reimplemented from QDomNodePrivate
- virtual QDomNodePrivate* cloneNode(bool deep = true) Q_DECL_OVERRIDE;
- QDomNode::NodeType nodeType() const Q_DECL_OVERRIDE { return QDomNode::DocumentFragmentNode; }
+ virtual QDomNodePrivate* cloneNode(bool deep = true) override;
+ QDomNode::NodeType nodeType() const override { return QDomNode::DocumentFragmentNode; }
};
class QDomCharacterDataPrivate : public QDomNodePrivate
@@ -335,8 +335,8 @@ public:
void replaceData(unsigned long offset, unsigned long count, const QString& arg);
// Reimplemented from QDomNodePrivate
- QDomNode::NodeType nodeType() const Q_DECL_OVERRIDE { return QDomNode::CharacterDataNode; }
- QDomNodePrivate* cloneNode(bool deep = true) Q_DECL_OVERRIDE;
+ QDomNode::NodeType nodeType() const override { return QDomNode::CharacterDataNode; }
+ QDomNodePrivate* cloneNode(bool deep = true) override;
};
class QDomTextPrivate : public QDomCharacterDataPrivate
@@ -348,9 +348,9 @@ public:
QDomTextPrivate* splitText(int offset);
// Reimplemented from QDomNodePrivate
- QDomNodePrivate* cloneNode(bool deep = true) Q_DECL_OVERRIDE;
- QDomNode::NodeType nodeType() const Q_DECL_OVERRIDE { return QDomNode::TextNode; }
- virtual void save(QTextStream& s, int, int) const Q_DECL_OVERRIDE;
+ QDomNodePrivate* cloneNode(bool deep = true) override;
+ QDomNode::NodeType nodeType() const override { return QDomNode::TextNode; }
+ virtual void save(QTextStream& s, int, int) const override;
};
class QDomAttrPrivate : public QDomNodePrivate
@@ -363,10 +363,10 @@ public:
bool specified() const;
// Reimplemented from QDomNodePrivate
- void setNodeValue(const QString& v) Q_DECL_OVERRIDE;
- QDomNodePrivate* cloneNode(bool deep = true) Q_DECL_OVERRIDE;
- QDomNode::NodeType nodeType() const Q_DECL_OVERRIDE { return QDomNode::AttributeNode; }
- virtual void save(QTextStream& s, int, int) const Q_DECL_OVERRIDE;
+ void setNodeValue(const QString& v) override;
+ QDomNodePrivate* cloneNode(bool deep = true) override;
+ QDomNode::NodeType nodeType() const override { return QDomNode::AttributeNode; }
+ virtual void save(QTextStream& s, int, int) const override;
// Variables
bool m_specified;
@@ -398,9 +398,9 @@ public:
// Reimplemented from QDomNodePrivate
QDomNamedNodeMapPrivate* attributes() { return m_attr; }
bool hasAttributes() { return (m_attr->length() > 0); }
- QDomNode::NodeType nodeType() const Q_DECL_OVERRIDE { return QDomNode::ElementNode; }
- QDomNodePrivate* cloneNode(bool deep = true) Q_DECL_OVERRIDE;
- virtual void save(QTextStream& s, int, int) const Q_DECL_OVERRIDE;
+ QDomNode::NodeType nodeType() const override { return QDomNode::ElementNode; }
+ QDomNodePrivate* cloneNode(bool deep = true) override;
+ virtual void save(QTextStream& s, int, int) const override;
// Variables
QDomNamedNodeMapPrivate* m_attr;
@@ -414,9 +414,9 @@ public:
QDomCommentPrivate(QDomCommentPrivate* n, bool deep);
// Reimplemented from QDomNodePrivate
- QDomNodePrivate* cloneNode(bool deep = true) Q_DECL_OVERRIDE;
- QDomNode::NodeType nodeType() const Q_DECL_OVERRIDE { return QDomNode::CommentNode; }
- virtual void save(QTextStream& s, int, int) const Q_DECL_OVERRIDE;
+ QDomNodePrivate* cloneNode(bool deep = true) override;
+ QDomNode::NodeType nodeType() const override { return QDomNode::CommentNode; }
+ virtual void save(QTextStream& s, int, int) const override;
};
class QDomCDATASectionPrivate : public QDomTextPrivate
@@ -426,9 +426,9 @@ public:
QDomCDATASectionPrivate(QDomCDATASectionPrivate* n, bool deep);
// Reimplemented from QDomNodePrivate
- QDomNodePrivate* cloneNode(bool deep = true) Q_DECL_OVERRIDE;
- QDomNode::NodeType nodeType() const Q_DECL_OVERRIDE { return QDomNode::CDATASectionNode; }
- virtual void save(QTextStream& s, int, int) const Q_DECL_OVERRIDE;
+ QDomNodePrivate* cloneNode(bool deep = true) override;
+ QDomNode::NodeType nodeType() const override { return QDomNode::CDATASectionNode; }
+ virtual void save(QTextStream& s, int, int) const override;
};
class QDomNotationPrivate : public QDomNodePrivate
@@ -439,9 +439,9 @@ public:
QDomNotationPrivate(QDomNotationPrivate* n, bool deep);
// Reimplemented from QDomNodePrivate
- QDomNodePrivate* cloneNode(bool deep = true) Q_DECL_OVERRIDE;
- QDomNode::NodeType nodeType() const Q_DECL_OVERRIDE { return QDomNode::NotationNode; }
- virtual void save(QTextStream& s, int, int) const Q_DECL_OVERRIDE;
+ QDomNodePrivate* cloneNode(bool deep = true) override;
+ QDomNode::NodeType nodeType() const override { return QDomNode::NotationNode; }
+ virtual void save(QTextStream& s, int, int) const override;
// Variables
QString m_sys;
@@ -456,9 +456,9 @@ public:
QDomEntityPrivate(QDomEntityPrivate* n, bool deep);
// Reimplemented from QDomNodePrivate
- QDomNodePrivate* cloneNode(bool deep = true) Q_DECL_OVERRIDE;
- QDomNode::NodeType nodeType() const Q_DECL_OVERRIDE { return QDomNode::EntityNode; }
- virtual void save(QTextStream& s, int, int) const Q_DECL_OVERRIDE;
+ QDomNodePrivate* cloneNode(bool deep = true) override;
+ QDomNode::NodeType nodeType() const override { return QDomNode::EntityNode; }
+ virtual void save(QTextStream& s, int, int) const override;
// Variables
QString m_sys;
@@ -473,9 +473,9 @@ public:
QDomEntityReferencePrivate(QDomNodePrivate* n, bool deep);
// Reimplemented from QDomNodePrivate
- QDomNodePrivate* cloneNode(bool deep = true) Q_DECL_OVERRIDE;
- QDomNode::NodeType nodeType() const Q_DECL_OVERRIDE { return QDomNode::EntityReferenceNode; }
- virtual void save(QTextStream& s, int, int) const Q_DECL_OVERRIDE;
+ QDomNodePrivate* cloneNode(bool deep = true) override;
+ QDomNode::NodeType nodeType() const override { return QDomNode::EntityReferenceNode; }
+ virtual void save(QTextStream& s, int, int) const override;
};
class QDomProcessingInstructionPrivate : public QDomNodePrivate
@@ -486,9 +486,9 @@ public:
QDomProcessingInstructionPrivate(QDomProcessingInstructionPrivate* n, bool deep);
// Reimplemented from QDomNodePrivate
- QDomNodePrivate* cloneNode(bool deep = true) Q_DECL_OVERRIDE;
- QDomNode::NodeType nodeType() const Q_DECL_OVERRIDE { return QDomNode::ProcessingInstructionNode; }
- virtual void save(QTextStream& s, int, int) const Q_DECL_OVERRIDE;
+ QDomNodePrivate* cloneNode(bool deep = true) override;
+ QDomNode::NodeType nodeType() const override { return QDomNode::ProcessingInstructionNode; }
+ virtual void save(QTextStream& s, int, int) const override;
};
class QDomDocumentPrivate : public QDomNodePrivate
@@ -523,9 +523,9 @@ public:
QDomNodePrivate* importNode(QDomNodePrivate* importedNode, bool deep);
// Reimplemented from QDomNodePrivate
- QDomNodePrivate* cloneNode(bool deep = true) Q_DECL_OVERRIDE;
- QDomNode::NodeType nodeType() const Q_DECL_OVERRIDE { return QDomNode::DocumentNode; }
- void clear() Q_DECL_OVERRIDE;
+ QDomNodePrivate* cloneNode(bool deep = true) override;
+ QDomNode::NodeType nodeType() const override { return QDomNode::DocumentNode; }
+ void clear() override;
// Variables
QExplicitlySharedDataPointer<QDomImplementationPrivate> impl;
@@ -576,32 +576,32 @@ public:
~QDomHandler();
// content handler
- bool endDocument() Q_DECL_OVERRIDE;
- bool startElement(const QString& nsURI, const QString& localName, const QString& qName, const QXmlAttributes& atts) Q_DECL_OVERRIDE;
- bool endElement(const QString& nsURI, const QString& localName, const QString& qName) Q_DECL_OVERRIDE;
- bool characters(const QString& ch) Q_DECL_OVERRIDE;
- bool processingInstruction(const QString& target, const QString& data) Q_DECL_OVERRIDE;
- bool skippedEntity(const QString& name) Q_DECL_OVERRIDE;
+ bool endDocument() override;
+ bool startElement(const QString& nsURI, const QString& localName, const QString& qName, const QXmlAttributes& atts) override;
+ bool endElement(const QString& nsURI, const QString& localName, const QString& qName) override;
+ bool characters(const QString& ch) override;
+ bool processingInstruction(const QString& target, const QString& data) override;
+ bool skippedEntity(const QString& name) override;
// error handler
- bool fatalError(const QXmlParseException& exception) Q_DECL_OVERRIDE;
+ bool fatalError(const QXmlParseException& exception) override;
// lexical handler
- bool startCDATA() Q_DECL_OVERRIDE;
- bool endCDATA() Q_DECL_OVERRIDE;
- bool startEntity(const QString &) Q_DECL_OVERRIDE;
- bool endEntity(const QString &) Q_DECL_OVERRIDE;
- bool startDTD(const QString& name, const QString& publicId, const QString& systemId) Q_DECL_OVERRIDE;
- bool comment(const QString& ch) Q_DECL_OVERRIDE;
+ bool startCDATA() override;
+ bool endCDATA() override;
+ bool startEntity(const QString &) override;
+ bool endEntity(const QString &) override;
+ bool startDTD(const QString& name, const QString& publicId, const QString& systemId) override;
+ bool comment(const QString& ch) override;
// decl handler
- bool externalEntityDecl(const QString &name, const QString &publicId, const QString &systemId) Q_DECL_OVERRIDE ;
+ bool externalEntityDecl(const QString &name, const QString &publicId, const QString &systemId) override ;
// DTD handler
- bool notationDecl(const QString & name, const QString & publicId, const QString & systemId) Q_DECL_OVERRIDE;
- bool unparsedEntityDecl(const QString &name, const QString &publicId, const QString &systemId, const QString &notationName) Q_DECL_OVERRIDE ;
+ bool notationDecl(const QString & name, const QString & publicId, const QString & systemId) override;
+ bool unparsedEntityDecl(const QString &name, const QString &publicId, const QString &systemId, const QString &notationName) override ;
- void setDocumentLocator(QXmlLocator *locator) Q_DECL_OVERRIDE;
+ void setDocumentLocator(QXmlLocator *locator) override;
QString errorMsg;
int errorLine;
diff --git a/src/xml/dom/qdom.h b/src/xml/dom/qdom.h
index 464c8ebfc2..0a7db7dcd7 100644
--- a/src/xml/dom/qdom.h
+++ b/src/xml/dom/qdom.h
@@ -335,14 +335,14 @@ public:
inline QDomNode::NodeType nodeType() const { return DocumentNode; }
// Qt extensions
- bool setContent(const QByteArray& text, bool namespaceProcessing, QString *errorMsg=Q_NULLPTR, int *errorLine=Q_NULLPTR, int *errorColumn=Q_NULLPTR );
- bool setContent(const QString& text, bool namespaceProcessing, QString *errorMsg=Q_NULLPTR, int *errorLine=Q_NULLPTR, int *errorColumn=Q_NULLPTR );
- bool setContent(QIODevice* dev, bool namespaceProcessing, QString *errorMsg=Q_NULLPTR, int *errorLine=Q_NULLPTR, int *errorColumn=Q_NULLPTR );
- bool setContent(QXmlInputSource *source, bool namespaceProcessing, QString *errorMsg=Q_NULLPTR, int *errorLine=Q_NULLPTR, int *errorColumn=Q_NULLPTR );
- bool setContent(const QByteArray& text, QString *errorMsg=Q_NULLPTR, int *errorLine=Q_NULLPTR, int *errorColumn=Q_NULLPTR );
- bool setContent(const QString& text, QString *errorMsg=Q_NULLPTR, int *errorLine=Q_NULLPTR, int *errorColumn=Q_NULLPTR );
- bool setContent(QIODevice* dev, QString *errorMsg=Q_NULLPTR, int *errorLine=Q_NULLPTR, int *errorColumn=Q_NULLPTR );
- bool setContent(QXmlInputSource *source, QXmlReader *reader, QString *errorMsg=Q_NULLPTR, int *errorLine=Q_NULLPTR, int *errorColumn=Q_NULLPTR );
+ bool setContent(const QByteArray& text, bool namespaceProcessing, QString *errorMsg=nullptr, int *errorLine=nullptr, int *errorColumn=nullptr );
+ bool setContent(const QString& text, bool namespaceProcessing, QString *errorMsg=nullptr, int *errorLine=nullptr, int *errorColumn=nullptr );
+ bool setContent(QIODevice* dev, bool namespaceProcessing, QString *errorMsg=nullptr, int *errorLine=nullptr, int *errorColumn=nullptr );
+ bool setContent(QXmlInputSource *source, bool namespaceProcessing, QString *errorMsg=nullptr, int *errorLine=nullptr, int *errorColumn=nullptr );
+ bool setContent(const QByteArray& text, QString *errorMsg=nullptr, int *errorLine=nullptr, int *errorColumn=nullptr );
+ bool setContent(const QString& text, QString *errorMsg=nullptr, int *errorLine=nullptr, int *errorColumn=nullptr );
+ bool setContent(QIODevice* dev, QString *errorMsg=nullptr, int *errorLine=nullptr, int *errorColumn=nullptr );
+ bool setContent(QXmlInputSource *source, QXmlReader *reader, QString *errorMsg=nullptr, int *errorLine=nullptr, int *errorColumn=nullptr );
// Qt extensions
QString toString(int = 1) const;
diff --git a/src/xml/sax/qxml.cpp b/src/xml/sax/qxml.cpp
index bc7d00483a..8615d9b10c 100644
--- a/src/xml/sax/qxml.cpp
+++ b/src/xml/sax/qxml.cpp
@@ -448,11 +448,11 @@ public:
{
}
- int columnNumber() const Q_DECL_OVERRIDE
+ int columnNumber() const override
{
return (reader->d_ptr->columnNr == -1 ? -1 : reader->d_ptr->columnNr + 1);
}
- int lineNumber() const Q_DECL_OVERRIDE
+ int lineNumber() const override
{
return (reader->d_ptr->lineNr == -1 ? -1 : reader->d_ptr->lineNr + 1);
}
diff --git a/src/xml/sax/qxml.h b/src/xml/sax/qxml.h
index 77a5a78650..7c5b5fe204 100644
--- a/src/xml/sax/qxml.h
+++ b/src/xml/sax/qxml.h
@@ -225,10 +225,10 @@ class Q_XML_EXPORT QXmlReader
{
public:
virtual ~QXmlReader() {}
- virtual bool feature(const QString& name, bool *ok = Q_NULLPTR) const = 0;
+ virtual bool feature(const QString& name, bool *ok = nullptr) const = 0;
virtual void setFeature(const QString& name, bool value) = 0;
virtual bool hasFeature(const QString& name) const = 0;
- virtual void* property(const QString& name, bool *ok = Q_NULLPTR) const = 0;
+ virtual void* property(const QString& name, bool *ok = nullptr) const = 0;
virtual void setProperty(const QString& name, void* value) = 0;
virtual bool hasProperty(const QString& name) const = 0;
virtual void setEntityResolver(QXmlEntityResolver* handler) = 0;
@@ -253,29 +253,29 @@ public:
QXmlSimpleReader();
virtual ~QXmlSimpleReader();
- bool feature(const QString& name, bool *ok = Q_NULLPTR) const Q_DECL_OVERRIDE;
- void setFeature(const QString& name, bool value) Q_DECL_OVERRIDE;
- bool hasFeature(const QString& name) const Q_DECL_OVERRIDE;
-
- void* property(const QString& name, bool *ok = Q_NULLPTR) const Q_DECL_OVERRIDE;
- void setProperty(const QString& name, void* value) Q_DECL_OVERRIDE;
- bool hasProperty(const QString& name) const Q_DECL_OVERRIDE;
-
- void setEntityResolver(QXmlEntityResolver* handler) Q_DECL_OVERRIDE;
- QXmlEntityResolver* entityResolver() const Q_DECL_OVERRIDE;
- void setDTDHandler(QXmlDTDHandler* handler) Q_DECL_OVERRIDE;
- QXmlDTDHandler* DTDHandler() const Q_DECL_OVERRIDE;
- void setContentHandler(QXmlContentHandler* handler) Q_DECL_OVERRIDE;
- QXmlContentHandler* contentHandler() const Q_DECL_OVERRIDE;
- void setErrorHandler(QXmlErrorHandler* handler) Q_DECL_OVERRIDE;
- QXmlErrorHandler* errorHandler() const Q_DECL_OVERRIDE;
- void setLexicalHandler(QXmlLexicalHandler* handler) Q_DECL_OVERRIDE;
- QXmlLexicalHandler* lexicalHandler() const Q_DECL_OVERRIDE;
- void setDeclHandler(QXmlDeclHandler* handler) Q_DECL_OVERRIDE;
- QXmlDeclHandler* declHandler() const Q_DECL_OVERRIDE;
-
- bool parse(const QXmlInputSource& input) Q_DECL_OVERRIDE;
- bool parse(const QXmlInputSource* input) Q_DECL_OVERRIDE;
+ bool feature(const QString& name, bool *ok = nullptr) const override;
+ void setFeature(const QString& name, bool value) override;
+ bool hasFeature(const QString& name) const override;
+
+ void* property(const QString& name, bool *ok = nullptr) const override;
+ void setProperty(const QString& name, void* value) override;
+ bool hasProperty(const QString& name) const override;
+
+ void setEntityResolver(QXmlEntityResolver* handler) override;
+ QXmlEntityResolver* entityResolver() const override;
+ void setDTDHandler(QXmlDTDHandler* handler) override;
+ QXmlDTDHandler* DTDHandler() const override;
+ void setContentHandler(QXmlContentHandler* handler) override;
+ QXmlContentHandler* contentHandler() const override;
+ void setErrorHandler(QXmlErrorHandler* handler) override;
+ QXmlErrorHandler* errorHandler() const override;
+ void setLexicalHandler(QXmlLexicalHandler* handler) override;
+ QXmlLexicalHandler* lexicalHandler() const override;
+ void setDeclHandler(QXmlDeclHandler* handler) override;
+ QXmlDeclHandler* declHandler() const override;
+
+ bool parse(const QXmlInputSource& input) override;
+ bool parse(const QXmlInputSource* input) override;
virtual bool parse(const QXmlInputSource* input, bool incremental);
virtual bool parseContinue();
@@ -385,40 +385,40 @@ public:
QXmlDefaultHandler();
virtual ~QXmlDefaultHandler();
- void setDocumentLocator(QXmlLocator* locator) Q_DECL_OVERRIDE;
- bool startDocument() Q_DECL_OVERRIDE;
- bool endDocument() Q_DECL_OVERRIDE;
- bool startPrefixMapping(const QString& prefix, const QString& uri) Q_DECL_OVERRIDE;
- bool endPrefixMapping(const QString& prefix) Q_DECL_OVERRIDE;
- bool startElement(const QString& namespaceURI, const QString& localName, const QString& qName, const QXmlAttributes& atts) Q_DECL_OVERRIDE;
- bool endElement(const QString& namespaceURI, const QString& localName, const QString& qName) Q_DECL_OVERRIDE;
- bool characters(const QString& ch) Q_DECL_OVERRIDE;
- bool ignorableWhitespace(const QString& ch) Q_DECL_OVERRIDE;
- bool processingInstruction(const QString& target, const QString& data) Q_DECL_OVERRIDE;
- bool skippedEntity(const QString& name) Q_DECL_OVERRIDE;
-
- bool warning(const QXmlParseException& exception) Q_DECL_OVERRIDE;
- bool error(const QXmlParseException& exception) Q_DECL_OVERRIDE;
- bool fatalError(const QXmlParseException& exception) Q_DECL_OVERRIDE;
-
- bool notationDecl(const QString& name, const QString& publicId, const QString& systemId) Q_DECL_OVERRIDE;
- bool unparsedEntityDecl(const QString& name, const QString& publicId, const QString& systemId, const QString& notationName) Q_DECL_OVERRIDE;
-
- bool resolveEntity(const QString& publicId, const QString& systemId, QXmlInputSource*& ret) Q_DECL_OVERRIDE;
-
- bool startDTD(const QString& name, const QString& publicId, const QString& systemId) Q_DECL_OVERRIDE;
- bool endDTD() Q_DECL_OVERRIDE;
- bool startEntity(const QString& name) Q_DECL_OVERRIDE;
- bool endEntity(const QString& name) Q_DECL_OVERRIDE;
- bool startCDATA() Q_DECL_OVERRIDE;
- bool endCDATA() Q_DECL_OVERRIDE;
- bool comment(const QString& ch) Q_DECL_OVERRIDE;
-
- bool attributeDecl(const QString& eName, const QString& aName, const QString& type, const QString& valueDefault, const QString& value) Q_DECL_OVERRIDE;
- bool internalEntityDecl(const QString& name, const QString& value) Q_DECL_OVERRIDE;
- bool externalEntityDecl(const QString& name, const QString& publicId, const QString& systemId) Q_DECL_OVERRIDE;
-
- QString errorString() const Q_DECL_OVERRIDE;
+ void setDocumentLocator(QXmlLocator* locator) override;
+ bool startDocument() override;
+ bool endDocument() override;
+ bool startPrefixMapping(const QString& prefix, const QString& uri) override;
+ bool endPrefixMapping(const QString& prefix) override;
+ bool startElement(const QString& namespaceURI, const QString& localName, const QString& qName, const QXmlAttributes& atts) override;
+ bool endElement(const QString& namespaceURI, const QString& localName, const QString& qName) override;
+ bool characters(const QString& ch) override;
+ bool ignorableWhitespace(const QString& ch) override;
+ bool processingInstruction(const QString& target, const QString& data) override;
+ bool skippedEntity(const QString& name) override;
+
+ bool warning(const QXmlParseException& exception) override;
+ bool error(const QXmlParseException& exception) override;
+ bool fatalError(const QXmlParseException& exception) override;
+
+ bool notationDecl(const QString& name, const QString& publicId, const QString& systemId) override;
+ bool unparsedEntityDecl(const QString& name, const QString& publicId, const QString& systemId, const QString& notationName) override;
+
+ bool resolveEntity(const QString& publicId, const QString& systemId, QXmlInputSource*& ret) override;
+
+ bool startDTD(const QString& name, const QString& publicId, const QString& systemId) override;
+ bool endDTD() override;
+ bool startEntity(const QString& name) override;
+ bool endEntity(const QString& name) override;
+ bool startCDATA() override;
+ bool endCDATA() override;
+ bool comment(const QString& ch) override;
+
+ bool attributeDecl(const QString& eName, const QString& aName, const QString& type, const QString& valueDefault, const QString& value) override;
+ bool internalEntityDecl(const QString& name, const QString& value) override;
+ bool externalEntityDecl(const QString& name, const QString& publicId, const QString& systemId) override;
+
+ QString errorString() const override;
private:
QXmlDefaultHandlerPrivate *d;