summaryrefslogtreecommitdiffstats
path: root/src/gui
diff options
context:
space:
mode:
authorJoão Abecasis <joao.abecasis@nokia.com>2012-01-16 17:52:29 +0100
committerJoão Abecasis <joao.abecasis@nokia.com>2012-01-16 17:53:41 +0100
commit5b250d497fd798c476765b22a2906e1c0ff1e432 (patch)
treefd4215ca375cc2402e536bf670c2977cf64ae2ef /src/gui
parent2c52e9a5c1d6ef6cbf4577430e14027375465c96 (diff)
parent7a0099183a1c107126bda3b59a47651aac612426 (diff)
Merge remote-tracking branch 'gerrit/master' into containers
Diffstat (limited to 'src/gui')
-rw-r--r--src/gui/Qt5GuiConfigExtras.cmake.in4
-rw-r--r--src/gui/accessible/accessible.pri12
-rw-r--r--src/gui/accessible/qaccessible.cpp336
-rw-r--r--src/gui/accessible/qaccessible.h165
-rw-r--r--src/gui/accessible/qaccessible2.cpp371
-rw-r--r--src/gui/accessible/qaccessible2.h45
-rw-r--r--src/gui/accessible/qaccessible_mac.mm2469
-rw-r--r--src/gui/accessible/qaccessible_mac_carbon.cpp119
-rw-r--r--src/gui/accessible/qaccessible_mac_cocoa.mm239
-rw-r--r--src/gui/accessible/qaccessible_mac_p.h479
-rw-r--r--src/gui/accessible/qaccessiblebridge.cpp2
-rw-r--r--src/gui/accessible/qaccessiblebridge.h2
-rw-r--r--src/gui/accessible/qaccessibleobject.cpp39
-rw-r--r--src/gui/accessible/qaccessibleobject.h4
-rw-r--r--src/gui/accessible/qaccessibleplugin.cpp2
-rw-r--r--src/gui/accessible/qaccessibleplugin.h2
-rw-r--r--src/gui/accessible/qplatformaccessibility_qpa.cpp7
-rw-r--r--src/gui/accessible/qplatformaccessibility_qpa.h2
-rw-r--r--src/gui/egl/qegl.cpp2
-rw-r--r--src/gui/egl/qegl_p.h2
-rw-r--r--src/gui/egl/qegl_qpa.cpp2
-rw-r--r--src/gui/egl/qegl_stub.cpp2
-rw-r--r--src/gui/egl/qeglcontext_p.h2
-rw-r--r--src/gui/egl/qeglproperties.cpp2
-rw-r--r--src/gui/egl/qeglproperties_p.h2
-rw-r--r--src/gui/egl/qeglproperties_stub.cpp2
-rw-r--r--src/gui/image/qbitmap.cpp2
-rw-r--r--src/gui/image/qbitmap.h2
-rw-r--r--src/gui/image/qbmphandler.cpp2
-rw-r--r--src/gui/image/qbmphandler_p.h2
-rw-r--r--src/gui/image/qgifhandler.cpp2
-rw-r--r--src/gui/image/qgifhandler_p.h2
-rw-r--r--src/gui/image/qimage.cpp21
-rw-r--r--src/gui/image/qimage.h13
-rw-r--r--src/gui/image/qimage_neon.cpp2
-rw-r--r--src/gui/image/qimage_p.h2
-rw-r--r--src/gui/image/qimage_sse2.cpp2
-rw-r--r--src/gui/image/qimage_ssse3.cpp2
-rw-r--r--src/gui/image/qimageiohandler.cpp2
-rw-r--r--src/gui/image/qimageiohandler.h2
-rw-r--r--src/gui/image/qimagepixmapcleanuphooks.cpp2
-rw-r--r--src/gui/image/qimagepixmapcleanuphooks_p.h2
-rw-r--r--src/gui/image/qimagereader.cpp2
-rw-r--r--src/gui/image/qimagereader.h2
-rw-r--r--src/gui/image/qimagewriter.cpp2
-rw-r--r--src/gui/image/qimagewriter.h2
-rw-r--r--src/gui/image/qjpeghandler.cpp2
-rw-r--r--src/gui/image/qjpeghandler_p.h2
-rw-r--r--src/gui/image/qmnghandler.cpp2
-rw-r--r--src/gui/image/qmnghandler_p.h2
-rw-r--r--src/gui/image/qmovie.cpp11
-rw-r--r--src/gui/image/qmovie.h4
-rw-r--r--src/gui/image/qnativeimage.cpp2
-rw-r--r--src/gui/image/qnativeimage_p.h2
-rw-r--r--src/gui/image/qpaintengine_pic.cpp2
-rw-r--r--src/gui/image/qpaintengine_pic_p.h2
-rw-r--r--src/gui/image/qpicture.cpp13
-rw-r--r--src/gui/image/qpicture.h3
-rw-r--r--src/gui/image/qpicture_p.h2
-rw-r--r--src/gui/image/qpictureformatplugin.cpp2
-rw-r--r--src/gui/image/qpictureformatplugin.h2
-rw-r--r--src/gui/image/qpixmap.cpp10
-rw-r--r--src/gui/image/qpixmap.h6
-rw-r--r--src/gui/image/qpixmap_blitter.cpp2
-rw-r--r--src/gui/image/qpixmap_blitter_p.h34
-rw-r--r--src/gui/image/qpixmap_qpa.cpp2
-rw-r--r--src/gui/image/qpixmap_raster.cpp2
-rw-r--r--src/gui/image/qpixmap_raster_p.h2
-rw-r--r--src/gui/image/qpixmap_win.cpp2
-rw-r--r--src/gui/image/qpixmapcache.cpp2
-rw-r--r--src/gui/image/qpixmapcache.h2
-rw-r--r--src/gui/image/qpixmapcache_p.h2
-rw-r--r--src/gui/image/qplatformpixmap.cpp2
-rw-r--r--src/gui/image/qplatformpixmap_qpa.h2
-rw-r--r--src/gui/image/qpnghandler.cpp2
-rw-r--r--src/gui/image/qpnghandler_p.h2
-rw-r--r--src/gui/image/qppmhandler.cpp2
-rw-r--r--src/gui/image/qppmhandler_p.h2
-rw-r--r--src/gui/image/qtiffhandler.cpp20
-rw-r--r--src/gui/image/qtiffhandler_p.h2
-rw-r--r--src/gui/image/qvolatileimage.cpp2
-rw-r--r--src/gui/image/qvolatileimage_p.h2
-rw-r--r--src/gui/image/qvolatileimagedata.cpp2
-rw-r--r--src/gui/image/qvolatileimagedata_p.h2
-rw-r--r--src/gui/image/qvolatileimagedata_symbian.cpp2
-rw-r--r--src/gui/image/qxbmhandler.cpp2
-rw-r--r--src/gui/image/qxbmhandler_p.h2
-rw-r--r--src/gui/image/qxpmhandler.cpp2
-rw-r--r--src/gui/image/qxpmhandler_p.h2
-rw-r--r--src/gui/kernel/kernel.pri2
-rw-r--r--src/gui/kernel/qclipboard.cpp2
-rw-r--r--src/gui/kernel/qclipboard.h2
-rw-r--r--src/gui/kernel/qclipboard_qpa.cpp2
-rw-r--r--src/gui/kernel/qcursor.cpp12
-rw-r--r--src/gui/kernel/qcursor.h7
-rw-r--r--src/gui/kernel/qcursor_p.h2
-rw-r--r--src/gui/kernel/qcursor_qpa.cpp2
-rw-r--r--src/gui/kernel/qdnd.cpp2
-rw-r--r--src/gui/kernel/qdnd_p.h2
-rw-r--r--src/gui/kernel/qdrag.cpp2
-rw-r--r--src/gui/kernel/qdrag.h2
-rw-r--r--src/gui/kernel/qevent.cpp86
-rw-r--r--src/gui/kernel/qevent.h17
-rw-r--r--src/gui/kernel/qevent_p.h2
-rw-r--r--src/gui/kernel/qgenericplugin_qpa.cpp2
-rw-r--r--src/gui/kernel/qgenericplugin_qpa.h2
-rw-r--r--src/gui/kernel/qgenericpluginfactory_qpa.cpp2
-rw-r--r--src/gui/kernel/qgenericpluginfactory_qpa.h2
-rw-r--r--src/gui/kernel/qguiapplication.cpp155
-rw-r--r--src/gui/kernel/qguiapplication.h8
-rw-r--r--src/gui/kernel/qguiapplication_p.h23
-rw-r--r--src/gui/kernel/qguivariant.cpp164
-rw-r--r--src/gui/kernel/qinputpanel.cpp32
-rw-r--r--src/gui/kernel/qinputpanel.h11
-rw-r--r--src/gui/kernel/qinputpanel_p.h2
-rw-r--r--src/gui/kernel/qkeymapper.cpp2
-rw-r--r--src/gui/kernel/qkeymapper_p.h2
-rw-r--r--src/gui/kernel/qkeymapper_qpa.cpp2
-rw-r--r--src/gui/kernel/qkeysequence.cpp17
-rw-r--r--src/gui/kernel/qkeysequence.h2
-rw-r--r--src/gui/kernel/qkeysequence_p.h2
-rw-r--r--src/gui/kernel/qopenglcontext.cpp17
-rw-r--r--src/gui/kernel/qopenglcontext.h7
-rw-r--r--src/gui/kernel/qopenglcontext_p.h2
-rw-r--r--src/gui/kernel/qpalette.cpp11
-rw-r--r--src/gui/kernel/qpalette.h6
-rw-r--r--src/gui/kernel/qplatformclipboard_qpa.cpp2
-rw-r--r--src/gui/kernel/qplatformclipboard_qpa.h2
-rw-r--r--src/gui/kernel/qplatformcursor_qpa.cpp2
-rw-r--r--src/gui/kernel/qplatformcursor_qpa.h2
-rw-r--r--src/gui/kernel/qplatformdrag_qpa.h2
-rw-r--r--src/gui/kernel/qplatforminputcontext_qpa.cpp24
-rw-r--r--src/gui/kernel/qplatforminputcontext_qpa.h7
-rw-r--r--src/gui/kernel/qplatformintegration_qpa.cpp16
-rw-r--r--src/gui/kernel/qplatformintegration_qpa.h6
-rw-r--r--src/gui/kernel/qplatformintegrationfactory_qpa.cpp2
-rw-r--r--src/gui/kernel/qplatformintegrationfactory_qpa_p.h2
-rw-r--r--src/gui/kernel/qplatformintegrationplugin_qpa.cpp2
-rw-r--r--src/gui/kernel/qplatformintegrationplugin_qpa.h2
-rw-r--r--src/gui/kernel/qplatformnativeinterface_qpa.cpp2
-rw-r--r--src/gui/kernel/qplatformnativeinterface_qpa.h2
-rw-r--r--src/gui/kernel/qplatformopenglcontext_qpa.cpp2
-rw-r--r--src/gui/kernel/qplatformopenglcontext_qpa.h2
-rw-r--r--src/gui/kernel/qplatformscreen_qpa.cpp11
-rw-r--r--src/gui/kernel/qplatformscreen_qpa.h4
-rw-r--r--src/gui/kernel/qplatformscreen_qpa_p.h74
-rw-r--r--src/gui/kernel/qplatformsurface_qpa.cpp2
-rw-r--r--src/gui/kernel/qplatformsurface_qpa.h2
-rw-r--r--src/gui/kernel/qplatformtheme_qpa.cpp43
-rw-r--r--src/gui/kernel/qplatformtheme_qpa.h11
-rw-r--r--src/gui/kernel/qplatformthemefactory_qpa.cpp2
-rw-r--r--src/gui/kernel/qplatformthemefactory_qpa_p.h2
-rw-r--r--src/gui/kernel/qplatformthemeplugin_qpa.cpp2
-rw-r--r--src/gui/kernel/qplatformthemeplugin_qpa.h2
-rw-r--r--src/gui/kernel/qplatformwindow_qpa.cpp2
-rw-r--r--src/gui/kernel/qplatformwindow_qpa.h2
-rw-r--r--src/gui/kernel/qscreen.cpp40
-rw-r--r--src/gui/kernel/qscreen.h3
-rw-r--r--src/gui/kernel/qscreen_p.h80
-rw-r--r--src/gui/kernel/qsessionmanager.h2
-rw-r--r--src/gui/kernel/qsessionmanager_qpa.cpp2
-rw-r--r--src/gui/kernel/qshortcutmap.cpp2
-rw-r--r--src/gui/kernel/qshortcutmap_p.h2
-rw-r--r--src/gui/kernel/qstylehints.cpp12
-rw-r--r--src/gui/kernel/qstylehints.h4
-rw-r--r--src/gui/kernel/qsurface.cpp2
-rw-r--r--src/gui/kernel/qsurface.h2
-rw-r--r--src/gui/kernel/qsurfaceformat.cpp2
-rw-r--r--src/gui/kernel/qsurfaceformat.h2
-rw-r--r--src/gui/kernel/qt_gui_pch.h2
-rw-r--r--src/gui/kernel/qtouchdevice.cpp2
-rw-r--r--src/gui/kernel/qtouchdevice.h2
-rw-r--r--src/gui/kernel/qtouchdevice_p.h2
-rw-r--r--src/gui/kernel/qwindow.cpp111
-rw-r--r--src/gui/kernel/qwindow.h8
-rw-r--r--src/gui/kernel/qwindow_p.h2
-rw-r--r--src/gui/kernel/qwindowdefs.h2
-rw-r--r--src/gui/kernel/qwindowdefs_win.h2
-rw-r--r--src/gui/kernel/qwindowsysteminterface_qpa.cpp68
-rw-r--r--src/gui/kernel/qwindowsysteminterface_qpa.h17
-rw-r--r--src/gui/kernel/qwindowsysteminterface_qpa_p.h28
-rw-r--r--src/gui/math3d/qgenericmatrix.cpp2
-rw-r--r--src/gui/math3d/qgenericmatrix.h2
-rw-r--r--src/gui/math3d/qmatrix4x4.cpp2
-rw-r--r--src/gui/math3d/qmatrix4x4.h2
-rw-r--r--src/gui/math3d/qquaternion.cpp2
-rw-r--r--src/gui/math3d/qquaternion.h2
-rw-r--r--src/gui/math3d/qvector2d.cpp2
-rw-r--r--src/gui/math3d/qvector2d.h2
-rw-r--r--src/gui/math3d/qvector3d.cpp2
-rw-r--r--src/gui/math3d/qvector3d.h2
-rw-r--r--src/gui/math3d/qvector4d.cpp2
-rw-r--r--src/gui/math3d/qvector4d.h2
-rw-r--r--src/gui/opengl/qopengl.cpp2
-rw-r--r--src/gui/opengl/qopengl.h2
-rw-r--r--src/gui/opengl/qopengl2pexvertexarray.cpp2
-rw-r--r--src/gui/opengl/qopengl2pexvertexarray_p.h2
-rw-r--r--src/gui/opengl/qopengl_p.h2
-rw-r--r--src/gui/opengl/qopenglbuffer.cpp2
-rw-r--r--src/gui/opengl/qopenglbuffer.h2
-rw-r--r--src/gui/opengl/qopenglcustomshaderstage.cpp2
-rw-r--r--src/gui/opengl/qopenglcustomshaderstage_p.h2
-rw-r--r--src/gui/opengl/qopenglengineshadermanager.cpp8
-rw-r--r--src/gui/opengl/qopenglengineshadermanager_p.h2
-rw-r--r--src/gui/opengl/qopenglengineshadersource_p.h2
-rw-r--r--src/gui/opengl/qopenglextensions_p.h2
-rw-r--r--src/gui/opengl/qopenglframebufferobject.cpp2
-rw-r--r--src/gui/opengl/qopenglframebufferobject.h2
-rw-r--r--src/gui/opengl/qopenglframebufferobject_p.h2
-rw-r--r--src/gui/opengl/qopenglfunctions.cpp2
-rw-r--r--src/gui/opengl/qopenglfunctions.h2
-rw-r--r--src/gui/opengl/qopenglgradientcache.cpp2
-rw-r--r--src/gui/opengl/qopenglgradientcache_p.h2
-rw-r--r--src/gui/opengl/qopenglpaintdevice.cpp2
-rw-r--r--src/gui/opengl/qopenglpaintdevice.h2
-rw-r--r--src/gui/opengl/qopenglpaintengine.cpp20
-rw-r--r--src/gui/opengl/qopenglpaintengine_p.h2
-rw-r--r--src/gui/opengl/qopenglshadercache_meego_p.h2
-rw-r--r--src/gui/opengl/qopenglshadercache_p.h2
-rw-r--r--src/gui/opengl/qopenglshaderprogram.cpp3
-rw-r--r--src/gui/opengl/qopenglshaderprogram.h2
-rw-r--r--src/gui/opengl/qopengltexturecache.cpp6
-rw-r--r--src/gui/opengl/qopengltexturecache_p.h4
-rw-r--r--src/gui/opengl/qopengltextureglyphcache.cpp2
-rw-r--r--src/gui/opengl/qopengltextureglyphcache_p.h2
-rw-r--r--src/gui/opengl/qopengltriangulatingstroker.cpp2
-rw-r--r--src/gui/opengl/qopengltriangulatingstroker_p.h2
-rw-r--r--src/gui/opengl/qrbtree_p.h2
-rw-r--r--src/gui/opengl/qtriangulator.cpp75
-rw-r--r--src/gui/opengl/qtriangulator_p.h2
-rw-r--r--src/gui/painting/qbackingstore.cpp2
-rw-r--r--src/gui/painting/qbackingstore.h2
-rw-r--r--src/gui/painting/qbezier.cpp50
-rw-r--r--src/gui/painting/qbezier_p.h4
-rw-r--r--src/gui/painting/qblendfunctions.cpp2
-rw-r--r--src/gui/painting/qblendfunctions_p.h2
-rw-r--r--src/gui/painting/qblittable.cpp8
-rw-r--r--src/gui/painting/qblittable_p.h4
-rw-r--r--src/gui/painting/qbrush.cpp2
-rw-r--r--src/gui/painting/qbrush.h2
-rw-r--r--src/gui/painting/qcolor.cpp2
-rw-r--r--src/gui/painting/qcolor.h2
-rw-r--r--src/gui/painting/qcolor_p.cpp2
-rw-r--r--src/gui/painting/qcolor_p.h2
-rw-r--r--src/gui/painting/qcosmeticstroker.cpp2
-rw-r--r--src/gui/painting/qcosmeticstroker_p.h2
-rw-r--r--src/gui/painting/qcssutil.cpp2
-rw-r--r--src/gui/painting/qcssutil_p.h2
-rw-r--r--src/gui/painting/qdatabuffer_p.h2
-rw-r--r--src/gui/painting/qdrawhelper.cpp2
-rw-r--r--src/gui/painting/qdrawhelper_arm_simd.cpp2
-rw-r--r--src/gui/painting/qdrawhelper_arm_simd_p.h2
-rw-r--r--src/gui/painting/qdrawhelper_iwmmxt.cpp2
-rw-r--r--src/gui/painting/qdrawhelper_mmx.cpp2
-rw-r--r--src/gui/painting/qdrawhelper_mmx3dnow.cpp2
-rw-r--r--src/gui/painting/qdrawhelper_mmx_p.h2
-rw-r--r--src/gui/painting/qdrawhelper_neon.cpp2
-rw-r--r--src/gui/painting/qdrawhelper_neon_asm.S2
-rw-r--r--src/gui/painting/qdrawhelper_neon_p.h2
-rw-r--r--src/gui/painting/qdrawhelper_p.h2
-rw-r--r--src/gui/painting/qdrawhelper_sse.cpp2
-rw-r--r--src/gui/painting/qdrawhelper_sse2.cpp2
-rw-r--r--src/gui/painting/qdrawhelper_sse3dnow.cpp2
-rw-r--r--src/gui/painting/qdrawhelper_sse_p.h2
-rw-r--r--src/gui/painting/qdrawhelper_ssse3.cpp2
-rw-r--r--src/gui/painting/qdrawhelper_x86_p.h2
-rw-r--r--src/gui/painting/qdrawingprimitive_sse2_p.h2
-rw-r--r--src/gui/painting/qemulationpaintengine.cpp2
-rw-r--r--src/gui/painting/qemulationpaintengine_p.h2
-rw-r--r--src/gui/painting/qfixed_p.h2
-rw-r--r--src/gui/painting/qgrayraster.c62
-rw-r--r--src/gui/painting/qgrayraster_p.h2
-rw-r--r--src/gui/painting/qimagescale.cpp2
-rw-r--r--src/gui/painting/qimagescale_p.h2
-rw-r--r--src/gui/painting/qmath_p.h2
-rw-r--r--src/gui/painting/qmatrix.cpp2
-rw-r--r--src/gui/painting/qmatrix.h2
-rw-r--r--src/gui/painting/qmemrotate.cpp2
-rw-r--r--src/gui/painting/qmemrotate_p.h2
-rw-r--r--src/gui/painting/qoutlinemapper.cpp92
-rw-r--r--src/gui/painting/qoutlinemapper_p.h26
-rw-r--r--src/gui/painting/qpagedpaintdevice.cpp2
-rw-r--r--src/gui/painting/qpagedpaintdevice.h2
-rw-r--r--src/gui/painting/qpagedpaintdevice_p.h2
-rw-r--r--src/gui/painting/qpaintbuffer.cpp2
-rw-r--r--src/gui/painting/qpaintbuffer_p.h2
-rw-r--r--src/gui/painting/qpaintdevice.cpp2
-rw-r--r--src/gui/painting/qpaintdevice.h2
-rw-r--r--src/gui/painting/qpaintdevice.qdoc2
-rw-r--r--src/gui/painting/qpaintdevice_qpa.cpp2
-rw-r--r--src/gui/painting/qpaintengine.cpp2
-rw-r--r--src/gui/painting/qpaintengine.h2
-rw-r--r--src/gui/painting/qpaintengine_blitter.cpp645
-rw-r--r--src/gui/painting/qpaintengine_blitter_p.h61
-rw-r--r--src/gui/painting/qpaintengine_p.h2
-rw-r--r--src/gui/painting/qpaintengine_raster.cpp111
-rw-r--r--src/gui/painting/qpaintengine_raster_p.h10
-rw-r--r--src/gui/painting/qpaintengineex.cpp4
-rw-r--r--src/gui/painting/qpaintengineex_p.h2
-rw-r--r--src/gui/painting/qpainter.cpp4
-rw-r--r--src/gui/painting/qpainter.h2
-rw-r--r--src/gui/painting/qpainter_p.h2
-rw-r--r--src/gui/painting/qpainterpath.cpp2
-rw-r--r--src/gui/painting/qpainterpath.h2
-rw-r--r--src/gui/painting/qpainterpath_p.h2
-rw-r--r--src/gui/painting/qpathclipper.cpp2
-rw-r--r--src/gui/painting/qpathclipper_p.h2
-rw-r--r--src/gui/painting/qpdf.cpp2
-rw-r--r--src/gui/painting/qpdf_p.h2
-rw-r--r--src/gui/painting/qpdfwriter.cpp2
-rw-r--r--src/gui/painting/qpdfwriter.h2
-rw-r--r--src/gui/painting/qpen.cpp2
-rw-r--r--src/gui/painting/qpen.h2
-rw-r--r--src/gui/painting/qpen_p.h2
-rw-r--r--src/gui/painting/qplatformbackingstore_qpa.cpp2
-rw-r--r--src/gui/painting/qplatformbackingstore_qpa.h2
-rw-r--r--src/gui/painting/qpolygon.cpp2
-rw-r--r--src/gui/painting/qpolygon.h2
-rw-r--r--src/gui/painting/qpolygonclipper_p.h2
-rw-r--r--src/gui/painting/qrasterdefs_p.h2
-rw-r--r--src/gui/painting/qrasterizer.cpp2
-rw-r--r--src/gui/painting/qrasterizer_p.h2
-rw-r--r--src/gui/painting/qregion.cpp2
-rw-r--r--src/gui/painting/qregion.h2
-rw-r--r--src/gui/painting/qrgb.h2
-rw-r--r--src/gui/painting/qstroker.cpp2
-rw-r--r--src/gui/painting/qstroker_p.h2
-rw-r--r--src/gui/painting/qtextureglyphcache.cpp2
-rw-r--r--src/gui/painting/qtextureglyphcache_p.h2
-rw-r--r--src/gui/painting/qtransform.cpp2
-rw-r--r--src/gui/painting/qtransform.h2
-rw-r--r--src/gui/painting/qvectorpath_p.h2
-rw-r--r--src/gui/text/qabstractfontengine_p.h2
-rw-r--r--src/gui/text/qabstracttextdocumentlayout.cpp2
-rw-r--r--src/gui/text/qabstracttextdocumentlayout.h2
-rw-r--r--src/gui/text/qabstracttextdocumentlayout_p.h2
-rw-r--r--src/gui/text/qcssparser.cpp2
-rw-r--r--src/gui/text/qcssparser_p.h2
-rw-r--r--src/gui/text/qcssscanner.cpp2
-rw-r--r--src/gui/text/qfont.cpp34
-rw-r--r--src/gui/text/qfont.h2
-rw-r--r--src/gui/text/qfont_p.h2
-rw-r--r--src/gui/text/qfont_qpa.cpp2
-rw-r--r--src/gui/text/qfontdatabase.cpp2
-rw-r--r--src/gui/text/qfontdatabase.h2
-rw-r--r--src/gui/text/qfontdatabase_qpa.cpp2
-rw-r--r--src/gui/text/qfontengine.cpp2
-rw-r--r--src/gui/text/qfontengine_ft.cpp2
-rw-r--r--src/gui/text/qfontengine_ft_p.h2
-rw-r--r--src/gui/text/qfontengine_p.h2
-rw-r--r--src/gui/text/qfontengine_qpa.cpp2
-rw-r--r--src/gui/text/qfontengine_qpa_p.h2
-rw-r--r--src/gui/text/qfontengine_qpf.cpp2
-rw-r--r--src/gui/text/qfontengine_qpf_p.h2
-rw-r--r--src/gui/text/qfontenginedirectwrite.cpp2
-rw-r--r--src/gui/text/qfontenginedirectwrite_p.h2
-rw-r--r--src/gui/text/qfontengineglyphcache_p.h2
-rw-r--r--src/gui/text/qfontinfo.h2
-rw-r--r--src/gui/text/qfontmetrics.cpp2
-rw-r--r--src/gui/text/qfontmetrics.h2
-rw-r--r--src/gui/text/qfontsubset.cpp2
-rw-r--r--src/gui/text/qfontsubset_p.h2
-rw-r--r--src/gui/text/qfragmentmap.cpp2
-rw-r--r--src/gui/text/qfragmentmap_p.h2
-rw-r--r--src/gui/text/qglyphrun.cpp2
-rw-r--r--src/gui/text/qglyphrun.h2
-rw-r--r--src/gui/text/qglyphrun_p.h2
-rw-r--r--src/gui/text/qharfbuzz_copy_p.h2
-rw-r--r--src/gui/text/qlinecontrol.cpp2
-rw-r--r--src/gui/text/qlinecontrol_p.h4
-rw-r--r--src/gui/text/qpfutil.cpp2
-rw-r--r--src/gui/text/qplatformfontdatabase_qpa.cpp9
-rw-r--r--src/gui/text/qplatformfontdatabase_qpa.h3
-rw-r--r--src/gui/text/qrawfont.cpp2
-rw-r--r--src/gui/text/qrawfont.h2
-rw-r--r--src/gui/text/qrawfont_ft.cpp2
-rw-r--r--src/gui/text/qrawfont_p.h2
-rw-r--r--src/gui/text/qrawfont_qpa.cpp2
-rw-r--r--src/gui/text/qstatictext.cpp2
-rw-r--r--src/gui/text/qstatictext.h2
-rw-r--r--src/gui/text/qstatictext_p.h2
-rw-r--r--src/gui/text/qsyntaxhighlighter.cpp2
-rw-r--r--src/gui/text/qsyntaxhighlighter.h2
-rw-r--r--src/gui/text/qtextcontrol.cpp2
-rw-r--r--src/gui/text/qtextcontrol_p.h2
-rw-r--r--src/gui/text/qtextcontrol_p_p.h2
-rw-r--r--src/gui/text/qtextcursor.cpp35
-rw-r--r--src/gui/text/qtextcursor.h2
-rw-r--r--src/gui/text/qtextcursor_p.h2
-rw-r--r--src/gui/text/qtextdocument.cpp10
-rw-r--r--src/gui/text/qtextdocument.h2
-rw-r--r--src/gui/text/qtextdocument_p.cpp2
-rw-r--r--src/gui/text/qtextdocument_p.h2
-rw-r--r--src/gui/text/qtextdocumentfragment.cpp12
-rw-r--r--src/gui/text/qtextdocumentfragment.h5
-rw-r--r--src/gui/text/qtextdocumentfragment_p.h2
-rw-r--r--src/gui/text/qtextdocumentlayout.cpp2
-rw-r--r--src/gui/text/qtextdocumentlayout_p.h2
-rw-r--r--src/gui/text/qtextdocumentwriter.cpp2
-rw-r--r--src/gui/text/qtextdocumentwriter.h2
-rw-r--r--src/gui/text/qtextengine.cpp7
-rw-r--r--src/gui/text/qtextengine_p.h2
-rw-r--r--src/gui/text/qtextformat.cpp80
-rw-r--r--src/gui/text/qtextformat.h25
-rw-r--r--src/gui/text/qtextformat_p.h2
-rw-r--r--src/gui/text/qtexthtmlparser.cpp2
-rw-r--r--src/gui/text/qtexthtmlparser_p.h2
-rw-r--r--src/gui/text/qtextimagehandler.cpp11
-rw-r--r--src/gui/text/qtextimagehandler_p.h5
-rw-r--r--src/gui/text/qtextlayout.cpp20
-rw-r--r--src/gui/text/qtextlayout.h2
-rw-r--r--src/gui/text/qtextlist.cpp2
-rw-r--r--src/gui/text/qtextlist.h2
-rw-r--r--src/gui/text/qtextobject.cpp2
-rw-r--r--src/gui/text/qtextobject.h2
-rw-r--r--src/gui/text/qtextobject_p.h2
-rw-r--r--src/gui/text/qtextodfwriter.cpp5
-rw-r--r--src/gui/text/qtextodfwriter_p.h2
-rw-r--r--src/gui/text/qtextoption.cpp2
-rw-r--r--src/gui/text/qtextoption.h2
-rw-r--r--src/gui/text/qtexttable.cpp2
-rw-r--r--src/gui/text/qtexttable.h2
-rw-r--r--src/gui/text/qtexttable_p.h2
-rw-r--r--src/gui/text/qzip.cpp2
-rw-r--r--src/gui/text/qzipreader_p.h2
-rw-r--r--src/gui/text/qzipwriter_p.h2
-rw-r--r--src/gui/util/qdesktopservices.cpp2
-rw-r--r--src/gui/util/qdesktopservices.h2
-rw-r--r--src/gui/util/qdesktopservices_mac.cpp2
-rw-r--r--src/gui/util/qdesktopservices_qpa.cpp2
-rw-r--r--src/gui/util/qdesktopservices_win.cpp2
-rw-r--r--src/gui/util/qdesktopservices_x11.cpp2
-rw-r--r--src/gui/util/qhexstring_p.h2
-rw-r--r--src/gui/util/qvalidator.cpp2
-rw-r--r--src/gui/util/qvalidator.h4
435 files changed, 2592 insertions, 5124 deletions
diff --git a/src/gui/Qt5GuiConfigExtras.cmake.in b/src/gui/Qt5GuiConfigExtras.cmake.in
deleted file mode 100644
index 8ddfd45060..0000000000
--- a/src/gui/Qt5GuiConfigExtras.cmake.in
+++ /dev/null
@@ -1,4 +0,0 @@
-
-set(Qt5Gui_PLUGIN_TYPES imageformats)
-
-set(Qt5_IMAGEFORMATS_PLUGINS qgif qjpeg qmng qico qtiff)
diff --git a/src/gui/accessible/accessible.pri b/src/gui/accessible/accessible.pri
index be2fe1acf3..70ac033f77 100644
--- a/src/gui/accessible/accessible.pri
+++ b/src/gui/accessible/accessible.pri
@@ -16,16 +16,4 @@ contains(QT_CONFIG, accessibility) {
HEADERS += accessible/qaccessiblebridge.h
SOURCES += accessible/qaccessiblebridge.cpp
-
-### FIXME
-# mac:!qpa {
-# HEADERS += accessible/qaccessible_mac_p.h
-# OBJECTIVE_SOURCES += accessible/qaccessible_mac.mm \
-# accessible/qaccessible_mac_cocoa.mm
-# } else:win32:!qpa {
-# SOURCES += accessible/qaccessible_win.cpp
-# } else {
-# HEADERS += accessible/qaccessiblebridge.h
-# SOURCES += accessible/qaccessible_unix.cpp accessible/qaccessiblebridge.cpp
-# }
}
diff --git a/src/gui/accessible/qaccessible.cpp b/src/gui/accessible/qaccessible.cpp
index c65e7df327..de37f67943 100644
--- a/src/gui/accessible/qaccessible.cpp
+++ b/src/gui/accessible/qaccessible.cpp
@@ -1,6 +1,6 @@
/****************************************************************************
**
-** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies).
+** Copyright (C) 2012 Nokia Corporation and/or its subsidiary(-ies).
** All rights reserved.
** Contact: Nokia Corporation (qt-info@nokia.com)
**
@@ -50,10 +50,8 @@
#include <private/qguiapplication_p.h>
#include "qplatformaccessibility_qpa.h"
-#include <QtCore/QDebug>
-#include <QtCore/QHash>
-#include <QtCore/QMetaObject>
-#include <QtCore/QMutex>
+#include <QtCore/qdebug.h>
+#include <QtCore/qmetaobject.h>
#include <private/qfactoryloader_p.h>
QT_BEGIN_NAMESPACE
@@ -61,11 +59,13 @@ QT_BEGIN_NAMESPACE
/*!
\class QAccessible
\brief The QAccessible class provides enums and static functions
- relating to accessibility.
+ related to accessibility.
\ingroup accessibility
\inmodule QtWidgets
+ This class is part of \l {Accessibility for QWidget Applications}.
+
Accessible applications can be used by people who are not able to
use applications by conventional means.
@@ -120,94 +120,64 @@ QT_BEGIN_NAMESPACE
\sa QAccessibleInterface
*/
-/*!
- \enum QAccessible::Action
-
- This enum describes the possible types of action that can occur.
-
- \value DefaultAction
- \value Press
- \value SetFocus
- \value Increase
- \value Decrease
- \value Accept
- \value Cancel
- \value Select
- \value ClearSelection
- \value RemoveSelection
- \value ExtendSelection
- \value AddToSelection
-
- \value FirstStandardAction
- \value LastStandardAction
-*/
/*!
- \enum QAccessible::Method
-
- This enum describes the possible types of methods that can be
- invoked on an accessible object.
+ \class QAccessible::State
- \value ListSupportedMethods
- \value SetCursorPosition
- \value GetCursorPosition
+ This structure defines bit flags that indicate
+ the state of an accessible object. The values are:
- \omitvalue ForegroundColor
- \omitvalue BackgroundColor
+ \value active The object is the active window or the active sub-element in a container (that would get focus when focusing the container).
+ \value adjustable The object represents an adjustable value, e.g. sliders.
+ \value animated The object's appearance changes frequently.
+ \value busy The object cannot accept input at the moment.
+ \value checkable The object is checkable.
+ \value checked The object's check box is checked.
+ \value checkStateMixed The third state of checkboxes (half checked in tri-state check boxes).
+ \value collapsed The object is collapsed, e.g. a closed listview item, or an iconified window.
+ \value defaultButton The object represents the default button in a dialog.
+ \value defunct The object no longer exists.
+ \value editable The object has a text carret (and often implements the text interface).
+ \value expandable The object is expandable, mostly used for cells in a tree view.
+ \value expanded The object is expanded, currently its children are visible.
+ \value extSelectable The object supports extended selection.
+ \value focusable The object can receive focus. Only objects in the active window can receive focus.
+ \value focused The object has keyboard focus.
+ \value hasPopup The object opens a popup.
+ \value hotTracked The object's appearance is sensitive to the mouse cursor position.
+ \value invalid The object is no longer valid (because it has been deleted).
+ \value invalidEntry Input validation current input invalid.
+ \value invisible The object is not visible to the user.
+ \value linked The object is linked to another object, e.g. a hyperlink.
+ \value marqueed The object displays scrolling contents, e.g. a log view.
+ \value modal The object blocks input from other objects.
+ \value movable The object can be moved.
+ \value multiLine The object has multiple lines of text (word wrap), as opposed to a single line.
+ \value multiSelectable The object supports multiple selected items.
+ \value offscreen The object is clipped by the visible area. Objects that are off screen are also invisible.
+ \value passwordEdit The object is a password field, e.g. a line edit for entering a Password.
+ \value playsSound The object produces sound when interacted with.
+ \value pressed The object is pressed.
+ \value readOnly The object can usually be edited, but is explicitly set to read-only.
+ \value selectable The object is selectable.
+ \value selectableText The object has text which can be selected. This is different from selectable which refers to the object's children.
+ \value selected The object is selected.
+ \value selfVoicing The object describes itself through speech or sound.
+ \value sizeable The object can be resized, e.g. top-level windows.
+ \value summaryElement The object summarizes the state of the window and should be treated with priority.
+ \value supportsAutoCompletion The object has auto-completion, for example in line edits or combo boxes.
+ \value traversed The object is linked and has been visited.
+ \value updatesFrequently The object changes frequently and needs to be refreshed when accessing it.
+ \value disabled The object is unavailable to the user, e.g. a disabled widget.
- \sa QAccessibleInterface::invokeMethod()
+ Implementations of QAccessibleInterface::state() return a combination
+ of these flags.
*/
/*!
- \fn QSet<Method> QAccessibleInterface::supportedMethods()
- \since 4.3
+ \fn QAccessible::State::State()
- Returns a QSet of \l{QAccessible::}{Method}s that are supported by this
- accessible interface.
-
- \sa QAccessible::Method invokeMethod()
-*/
-
-/*!
- \enum QAccessible::StateFlag
-
- This enum type defines bit flags that can be combined to indicate
- the state of an accessible object. The values are:
-
- \value Animated The object's appearance changes frequently.
- \value Busy The object cannot accept input at the moment.
- \value Checked The object's check box is checked.
- \value Collapsed The object is collapsed, e.g. a closed listview item, or an iconified window.
- \value DefaultButton The object represents the default button in a dialog.
- \value Expanded The object is expandable, and currently the children are visible.
- \value ExtSelectable The object supports extended selection.
- \value Focusable The object can receive focus. Only objects in the active window can receive focus.
- \value Focused The object has keyboard focus.
- \value HasPopup The object opens a popup.
- \value HotTracked The object's appearance is sensitive to the mouse cursor position.
- \value Invisible The object is not visible to the user.
- \value Linked The object is linked to another object, e.g. a hyperlink.
- \value Marqueed The object displays scrolling contents, e.g. a log view.
- \value Mixed The state of the object is not determined, e.g. a tri-state check box that is neither checked nor unchecked.
- \value Modal The object blocks input from other objects.
- \value Movable The object can be moved.
- \value MultiSelectable The object supports multiple selected items.
- \value Normal The normal state.
- \value Offscreen The object is clipped by the visible area. Objects that are off screen are also invisible.
- \value Pressed The object is pressed.
- \value Protected The object is password protected, e.g. a line edit for entering a Password.
- \value ReadOnly The object can usually be edited, but is explicitly set to read-only.
- \value Selectable The object is selectable.
- \value Selected The object is selected.
- \value SelfVoicing The object describes itself through speech or sound.
- \value Sizeable The object can be resized, e.g. top-level windows.
- \value Traversed The object is linked and has been visited.
- \value Unavailable The object is unavailable to the user, e.g. a disabled widget.
- \omitvalue Moveable
- \omitvalue HasInvokeExtension
-
- Implementations of QAccessibleInterface::state() return a combination
- of these flags.
+ Creates a new QAccessible::State with all states set to false.
*/
/*!
@@ -360,7 +330,7 @@ QT_BEGIN_NAMESPACE
\value PopupMenu A menu which lists options that the user can select to perform an action.
\value ProgressBar The object displays the progress of an operation in progress.
\value PropertyPage A property page where the user can change options and settings.
- \value PushButton A button.
+ \value Button A button.
\value RadioButton An object that represents an option that is mutually exclusive with other options.
\value Row A row of cells, usually within a table.
\value RowHeader A header for a row of data.
@@ -391,10 +361,6 @@ QT_BEGIN_NAMESPACE
\value Unrelated The objects are unrelated.
\value Self The objects are the same.
- \value Ancestor The first object is a parent of the second object.
- \value Child The first object is a direct child of the second object.
- \value Descendent The first object is an indirect child of the second object.
- \value Sibling The objects are siblings.
\value Up The first object is above the second object.
\value Down The first object is below the second object.
@@ -409,7 +375,6 @@ QT_BEGIN_NAMESPACE
\value Controller The first object controls the second object.
\value Controlled The first object is controlled by the second object.
- \omitvalue HierarchyMask
\omitvalue GeometryMask
\omitvalue LogicalMask
@@ -433,6 +398,26 @@ QT_BEGIN_NAMESPACE
\value Help A longer text giving information about how to use the object.
\value Accelerator The keyboard shortcut that executes the object's default action.
\value UserText The first value to be used for user defined text.
+ \omitvalue DebugDescription
+*/
+
+/*!
+ \enum QAccessible::InterfaceType
+
+ \l QAccessibleInterface supports several sub interfaces.
+ In order to provide more information about some objects, their accessible
+ representation should implement one or more of these interfaces.
+ When subclassing one of these interfaces, \l QAccessibleInterface::interface_cast also needs to be implemented.
+
+ \value TextInterface For text that supports selections or is more than one line. Simple labels do not need to implement this interface.
+ \value EditableTextInterface For text that can be edited by the user.
+ \value ValueInterface For objects that are used to manipulate a value, for example slider or scroll bar.
+ \value ActionInterface For interactive objects that allow the user to trigger an action. Basically everything that allows for example mouse interaction.
+ \omitvalue ImageInterface For objects that represent an image. This interface is generally less important.
+ \value TableInterface For lists, tables and trees.
+ \value TableCellInterface For cells in a TableInterface object.
+
+ \sa QAccessibleInterface::interface_cast, QAccessibleTextInterface, QAccessibleEditableTextInterface, QAccessibleValueInterface, QAccessibleActionInterface, QAccessibleTableInterface, QAccessibleTableCellInterface
*/
/*!
@@ -657,15 +642,15 @@ bool QAccessible::isActive()
\sa queryAccessibleInterface()
*/
-void QAccessible::setRootObject(QObject *o)
+void QAccessible::setRootObject(QObject *object)
{
if (rootObjectHandler) {
- rootObjectHandler(o);
+ rootObjectHandler(object);
return;
}
if (QPlatformAccessibility *pfAccessibility = platformAccessibility())
- pfAccessibility->setRootObject(o);
+ pfAccessibility->setRootObject(object);
}
/*!
@@ -686,12 +671,12 @@ void QAccessible::setRootObject(QObject *o)
the parameters of the call is expensive you can test isActive() to
avoid unnecessary computations.
*/
-void QAccessible::updateAccessibility(QObject *o, int who, Event reason)
+void QAccessible::updateAccessibility(QObject *object, int child, Event reason)
{
- Q_ASSERT(o);
+ Q_ASSERT(object);
if (updateHandler) {
- updateHandler(o, who, reason);
+ updateHandler(object, child, reason);
return;
}
@@ -699,7 +684,7 @@ void QAccessible::updateAccessibility(QObject *o, int who, Event reason)
return;
if (QPlatformAccessibility *pfAccessibility = platformAccessibility())
- pfAccessibility->notifyAccessibilityUpdate(o, who, reason);
+ pfAccessibility->notifyAccessibilityUpdate(object, child, reason);
}
@@ -711,6 +696,8 @@ void QAccessible::updateAccessibility(QObject *o, int who, Event reason)
\ingroup accessibility
\inmodule QtGui
+ This class is part of \l {Accessibility for QWidget Applications}.
+
Accessibility tools (also called AT Clients), such as screen readers
or braille displays, require high-level information about
accessible objects in an application. Accessible objects provide
@@ -740,8 +727,11 @@ void QAccessible::updateAccessibility(QObject *o, int who, Event reason)
The functions childCount() and indexOfChild() return the number of
children of an accessible object and the index a child object has
- in its parent. The childAt() function returns the index of a child
- at a given position.
+ in its parent. The childAt() function returns a child QAccessibleInterface
+ that is found at a position. The child does not have to be a direct
+ child. This allows bypassing intermediate layers when the parent already knows the
+ top-most child. childAt() is used for hit testing (finding the object
+ under the mouse).
The relationTo() function provides information about how two
different objects relate to each other, and navigate() allows
@@ -827,9 +817,8 @@ void QAccessible::updateAccessibility(QObject *o, int who, Event reason)
/*!
\fn int QAccessibleInterface::indexOfChild(const QAccessibleInterface *child) const
- Returns the 1-based index of the object \a child in this object's
- children list, or -1 if \a child is not a child of this object. 0
- is not a possible return value.
+ Returns the 0-based index of the object \a child in this object's
+ children list, or -1 if \a child is not a child of this object.
All objects provide this information about their children.
@@ -837,12 +826,10 @@ void QAccessible::updateAccessibility(QObject *o, int who, Event reason)
*/
/*!
- \fn QAccessible::Relation QAccessibleInterface::relationTo(int child,
-const QAccessibleInterface *other, int otherChild) const
+ \fn QAccessible::Relation QAccessibleInterface::relationTo(const QAccessibleInterface *other) const
- Returns the relationship between this object's \a child and the \a
- other object's \a otherChild. If \a child is 0 the object's own relation
- is returned.
+ Returns the relationship between this object and the \a
+ other object.
The returned value indicates the relation of the called object to
the \a other object, e.g. if this object is a label for \a other
@@ -875,18 +862,21 @@ QVector<QPair<QAccessibleInterface*, QAccessible::Relation> > QAccessibleInterfa
}
/*!
- \fn int QAccessibleInterface::childAt(int x, int y) const
+ \fn QAccessibleInterface *QAccessibleInterface::childAt(int x, int y) const
- Returns the 1-based index of the child that contains the screen
- coordinates (\a x, \a y). This function returns 0 if the point is
- positioned on the object itself. If the tested point is outside
- the boundaries of the object this function returns -1.
+ Returns the QAccessibleInterface of a child that contains the screen coordinates (\a x, \a y).
+ If there are no children at this position this function returns 0.
+ The returned accessible must be a child, but not necessarily a direct child.
This function is only relyable for visible objects (invisible
object might not be laid out correctly).
All visual objects provide this information.
+ A default implementation is provided for objects inheriting QAccessibleObject. This will iterate
+ over all children. If the widget manages its children (e.g. a table) it will be more efficient
+ to write a specialized implementation.
+
\sa rect()
*/
@@ -912,8 +902,7 @@ QVector<QPair<QAccessibleInterface*, QAccessible::Relation> > QAccessibleInterfa
*/
/*!
- \fn int QAccessibleInterface::navigate(RelationFlag relation, int entry, QAccessibleInterface
-**target) const
+ \fn int QAccessibleInterface::navigate(QAccessible::RelationFlag relation, int entry, QAccessibleInterface **target) const
Navigates from this object to an object that has a relationship
\a relation to this object, and returns the respective object in
@@ -956,18 +945,17 @@ QVector<QPair<QAccessibleInterface*, QAccessible::Relation> > QAccessibleInterfa
*/
/*!
- \fn QString QAccessibleInterface::text(Text t, int child) const
+ \fn QString QAccessibleInterface::text(QAccessible::Text t) const
- Returns the value of the text property \a t of the object, or of
- the object's child if \a child is not 0.
+ Returns the value of the text property \a t of the object.
- The \l Name is a string used by clients to identify, find, or
+ The \l QAccessible::Name is a string used by clients to identify, find, or
announce an accessible object for the user. All objects must have
a name that is unique within their container. The name can be
used differently by clients, so the name should both give a
short description of the object and be unique.
- An accessible object's \l Description provides textual information
+ An accessible object's \l QAccessible::Description provides textual information
about an object's visual appearance. The description is primarily
used to provide greater context for vision-impaired users, but is
also used for context searching or other applications. Not all
@@ -975,17 +963,17 @@ QVector<QPair<QAccessibleInterface*, QAccessible::Relation> > QAccessibleInterfa
description, but a tool button that shows a picture of a smiley
would.
- The \l Value of an accessible object represents visual information
+ The \l QAccessible::Value of an accessible object represents visual information
contained by the object, e.g. the text in a line edit. Usually,
the value can be modified by the user. Not all objects have a
value, e.g. static text labels don't, and some objects have a
state that already is the value, e.g. toggle buttons.
- The \l Help text provides information about the function and
+ The \l QAccessible::Help text provides information about the function and
usage of an accessible object. Not all objects provide this
information.
- The \l Accelerator is a keyboard shortcut that activates the
+ The \l QAccessible::Accelerator is a keyboard shortcut that activates the
object's default action. A keyboard shortcut is the underlined
character in the text of a menu, menu item or widget, and is
either the character itself, or a combination of this character
@@ -993,27 +981,26 @@ QVector<QPair<QAccessibleInterface*, QAccessible::Relation> > QAccessibleInterfa
tool buttons also have shortcut keys and usually display them in
their tooltip.
- All objects provide a string for \l Name.
+ All objects provide a string for \l QAccessible::Name.
\sa role(), state()
*/
/*!
- \fn void QAccessibleInterface::setText(Text t, int child, const QString &text)
+ \fn void QAccessibleInterface::setText(QAccessible::Text t, const QString &text)
- Sets the text property \a t of the object, or of the object's
- child if \a child is not 0, to \a text.
+ Sets the text property \a t of the object to \a text.
- Note that the text properties of most objects are read-only.
+ Note that the text properties of most objects are read-only
+ so calling this function might have no effect.
\sa text()
*/
/*!
- \fn QRect QAccessibleInterface::rect(int child) const
+ \fn QRect QAccessibleInterface::rect() const
- Returns the geometry of the object, or of the object's child if \a child
- is not 0. The geometry is in screen coordinates.
+ Returns the geometry of the object. The geometry is in screen coordinates.
This function is only reliable for visible objects (invisible
objects might not be laid out correctly).
@@ -1024,10 +1011,10 @@ QVector<QPair<QAccessibleInterface*, QAccessible::Relation> > QAccessibleInterfa
*/
/*!
- \fn QAccessible::Role QAccessibleInterface::role(int child) const
+ \fn QAccessible::Role QAccessibleInterface::role() const
- Returns the role of the object, or of the object's child if \a child
- is not 0. The role of an object is usually static.
+ Returns the role of the object.
+ The role of an object is usually static.
All accessible objects have a role.
@@ -1035,10 +1022,10 @@ QVector<QPair<QAccessibleInterface*, QAccessible::Relation> > QAccessibleInterfa
*/
/*!
- \fn QAccessible::State QAccessibleInterface::state(int child) const
+ \fn QAccessible::State QAccessibleInterface::state() const
- Returns the current state of the object, or of the object's child if
- \a child is not 0. The returned value is a combination of the flags in
+ Returns the current state of the object.
+ The returned value is a combination of the flags in
the QAccessible::StateFlag enumeration.
All accessible objects have a state.
@@ -1088,7 +1075,7 @@ QColor QAccessibleInterface::backgroundColor() const
*/
/*!
- \fn QAccessibleTable2Interface *QAccessibleInterface::table2Interface()
+ \fn QAccessibleTableCellInterface *QAccessibleInterface::tableCellInterface()
\internal
*/
@@ -1104,6 +1091,9 @@ QColor QAccessibleInterface::backgroundColor() const
/*!
\class QAccessibleEvent
+
+ \internal
+
\brief The QAccessibleEvent class is used to query addition
accessibility information about complex widgets.
@@ -1127,16 +1117,11 @@ QColor QAccessibleInterface::backgroundColor() const
*/
/*!
- \fn QAccessibleEvent::QAccessibleEvent(Type type, int child)
+ \fn QAccessibleEvent::QAccessibleEvent(Type type)
Constructs an accessibility event of the given \a type, which
must be QEvent::AccessibilityDescription or
QEvent::AccessibilityHelp.
-
- \a child is the (1-based) index of the child to which the request
- applies. If \a child is 0, the request is for the widget itself.
-
- \sa child()
*/
/*!
@@ -1162,6 +1147,7 @@ QColor QAccessibleInterface::backgroundColor() const
\sa value()
*/
+
/*!
Returns the window associated with the underlying object.
For instance, QAccessibleWidget reimplements this and returns
@@ -1191,16 +1177,61 @@ QWindow *QAccessibleInterface::window() const
Returns an invalid QVariant if the object doesn't support the action.
*/
-QVariant QAccessibleInterface::invokeMethod(QAccessible::Method method, const QVariantList &params)
+
+/*!
+ \internal
+ Method to allow extending this class without breaking binary compatibility.
+ The actual behavior and format of \a data depends on \a id argument
+ which must be defined if the class is to be extended with another virtual
+ function.
+ Currently, this is unused.
+*/
+void QAccessibleInterface::virtual_hook(int /*id*/, void * /*data*/)
+{
+}
+
+/*!
+ \fn void *QAccessibleInterface::interface_cast(QAccessible::InterfaceType type)
+
+ \brief Returns a specialized accessibility interface \a type from the generic QAccessibleInterface.
+
+ This function must be reimplemented when providing more information about a widget or object through the
+ specialized interfaces. For example a line edit should implement the QAccessibleTextInterface and QAccessibleEditableTextInterface.
+
+ Qt's QLineEdit for example has its accessibility support implemented in QAccessibleLineEdit.
+ \code
+void *QAccessibleLineEdit::interface_cast(QAccessible::InterfaceType t)
+{
+ if (t == QAccessible::TextInterface)
+ return static_cast<QAccessibleTextInterface*>(this);
+ else if (t == QAccessible::EditableTextInterface)
+ return static_cast<QAccessibleEditableTextInterface*>(this);
+ return QAccessibleWidget::interface_cast(t);
+}
+ \endcode
+
+ \sa QAccessible::InterfaceType, QAccessibleTextInterface, QAccessibleEditableTextInterface, QAccessibleValueInterface, QAccessibleActionInterface, QAccessibleTableInterface, QAccessibleTableCellInterface
+ */
+
+/*! \internal */
+const char *qAccessibleRoleString(QAccessible::Role role)
+{
+ if (role >=0x40)
+ role = QAccessible::UserRole;
+ static int roleEnum = QAccessible::staticMetaObject.indexOfEnumerator("Role");
+ return QAccessible::staticMetaObject.enumerator(roleEnum).valueToKey(role);
+}
+
+/*! \internal */
+const char *qAccessibleEventString(QAccessible::Event event)
{
- Q_UNUSED(method)
- Q_UNUSED(params)
- return QVariant();
+ static int eventEnum = QAccessible::staticMetaObject.indexOfEnumerator("Event");
+ return QAccessible::staticMetaObject.enumerator(eventEnum).valueToKey(event);
}
-QVariant QAccessibleInterface::virtual_hook(const QVariant &)
+bool operator==(const QAccessible::State &first, const QAccessible::State &second)
{
- return QVariant();
+ return memcmp(&first, &second, sizeof(QAccessible::State)) == 0;
}
#ifndef QT_NO_DEBUG_STREAM
@@ -1214,14 +1245,13 @@ Q_GUI_EXPORT QDebug operator<<(QDebug d, const QAccessibleInterface *iface)
d << "QAccessibleInterface(" << hex << (void *) iface << dec;
if (iface->isValid()) {
d << " name=" << iface->text(QAccessible::Name) << " ";
- d << "role=" << iface->role() << " ";
+ d << "role=" << qAccessibleRoleString(iface->role()) << " ";
if (iface->childCount())
d << "childc=" << iface->childCount() << " ";
if (iface->object()) {
d << "obj=" << iface->object();
}
- bool invisible = iface->state() & QAccessible::Invisible;
- if (invisible) {
+ if (iface->state().invisible) {
d << "invisible";
} else {
d << "rect=" << iface->rect();
diff --git a/src/gui/accessible/qaccessible.h b/src/gui/accessible/qaccessible.h
index 6ee1885a3d..bafd3a8a6b 100644
--- a/src/gui/accessible/qaccessible.h
+++ b/src/gui/accessible/qaccessible.h
@@ -1,6 +1,6 @@
/****************************************************************************
**
-** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies).
+** Copyright (C) 2012 Nokia Corporation and/or its subsidiary(-ies).
** All rights reserved.
** Contact: Nokia Corporation (qt-info@nokia.com)
**
@@ -148,45 +148,78 @@ public:
AcceleratorChanged = 0x80C0
};
+ // 64 bit enums seem hard on some platforms (windows...)
+ // which makes using a bit field a sensible alternative
+ struct State {
+ // http://msdn.microsoft.com/en-us/library/ms697270.aspx
+ quint64 disabled : 1; // used to be Unavailable
+ quint64 selected : 1;
+ quint64 focusable : 1;
+ quint64 focused : 1;
+ quint64 pressed : 1;
+ quint64 checkable : 1;
+ quint64 checked : 1;
+ quint64 checkStateMixed : 1; // used to be Mixed
+ quint64 readOnly : 1;
+ quint64 hotTracked : 1;
+ quint64 defaultButton : 1;
+ quint64 expanded : 1;
+ quint64 collapsed : 1;
+ quint64 busy : 1;
+ quint64 expandable : 1;
+ quint64 marqueed : 1;
+ quint64 animated : 1;
+ quint64 invisible : 1;
+ quint64 offscreen : 1;
+ quint64 sizeable : 1;
+ quint64 movable : 1;
+ quint64 selfVoicing : 1;
+ quint64 selectable : 1;
+ quint64 linked : 1;
+ quint64 traversed : 1;
+ quint64 multiSelectable : 1;
+ quint64 extSelectable : 1;
+ quint64 passwordEdit : 1; // used to be Protected
+ quint64 hasPopup : 1;
+ quint64 modal : 1;
+
+ // IA2 - we chose to not add some IA2 states for now
+ // Below the ones that seem helpful
+ quint64 active : 1;
+ quint64 invalid : 1; // = defunct
+ quint64 editable : 1;
+ quint64 multiLine : 1;
+ quint64 selectableText : 1;
+ quint64 supportsAutoCompletion : 1;
+
+ // quint64 horizontal : 1;
+ // quint64 vertical : 1;
+ // quint64 invalidEntry : 1;
+ // quint64 managesDescendants : 1;
+ // quint64 singleLine : 1; // we have multi line, this is redundant.
+ // quint64 stale : 1;
+ // quint64 transient : 1;
+ // quint64 pinned : 1;
+
+ // Apple - see http://mattgemmell.com/2010/12/19/accessibility-for-iphone-and-ipad-apps/
+ // quint64 playsSound : 1;
+ // quint64 summaryElement : 1;
+ // quint64 updatesFrequently : 1;
+ // quint64 adjustable : 1;
+ // more and not included here: http://developer.apple.com/library/mac/#documentation/UserExperience/Reference/Accessibility_RoleAttribute_Ref/Attributes.html
+
+ // MSAA
+ // quint64 alertLow : 1;
+ // quint64 alertMedium : 1;
+ // quint64 alertHigh : 1;
+
+ State() {
+ qMemSet(this, 0, sizeof(State));
+ }
+ };
+
- enum StateFlag {
- Normal = 0x00000000,
- Unavailable = 0x00000001,
- Selected = 0x00000002,
- Focused = 0x00000004,
- Pressed = 0x00000008,
- Checked = 0x00000010,
- Mixed = 0x00000020,
- ReadOnly = 0x00000040,
- HotTracked = 0x00000080,
- DefaultButton = 0x00000100,
- Expanded = 0x00000200,
- Collapsed = 0x00000400,
- Busy = 0x00000800,
- // Floating = 0x00001000,
- Expandable = 0x00001000,
- Marqueed = 0x00002000,
- Animated = 0x00004000,
- Invisible = 0x00008000,
- Offscreen = 0x00010000,
- Sizeable = 0x00020000,
- Movable = 0x00040000,
- SelfVoicing = 0x00080000,
- Focusable = 0x00100000,
- Selectable = 0x00200000,
- Linked = 0x00400000,
- Traversed = 0x00800000,
- MultiSelectable = 0x01000000,
- ExtSelectable = 0x02000000,
- //AlertLow = 0x04000000,
- //AlertMedium = 0x08000000,
- //AlertHigh = 0x10000000, /* reused for HasInvokeExtension */
- Protected = 0x20000000,
- HasPopup = 0x40000000,
- Modal = 0x80000000
- };
- Q_DECLARE_FLAGS(State, StateFlag)
enum Role {
@@ -274,16 +307,7 @@ public:
enum RelationFlag {
Unrelated = 0x00000000,
Self = 0x00000001,
- Ancestor = 0x00000002,
- Child = 0x00000004,
- Descendent = 0x00000008,
- Sibling = 0x00000010,
- HierarchyMask = 0x000000ff,
-
- Up = 0x00000100,
- Down = 0x00000200,
- Left = 0x00000400,
- Right = 0x00000800,
+
Covers = 0x00001000,
Covered = 0x00002000,
GeometryMask = 0x0000ff00,
@@ -297,12 +321,6 @@ public:
};
Q_DECLARE_FLAGS(Relation, RelationFlag)
- enum Method {
- ListSupportedMethods = 0,
- SetCursorPosition = 1,
- GetCursorPosition = 2
- };
-
enum InterfaceType
{
TextInterface,
@@ -324,9 +342,9 @@ public:
static RootObjectHandler installRootObjectHandler(RootObjectHandler);
static QAccessibleInterface *queryAccessibleInterface(QObject *);
- static void updateAccessibility(QObject *, int who, Event reason);
+ static void updateAccessibility(QObject *object, int child, Event reason);
static bool isActive();
- static void setRootObject(QObject*);
+ static void setRootObject(QObject *object);
static void cleanup();
@@ -341,11 +359,9 @@ private:
QAccessible() {}
};
-Q_DECLARE_OPERATORS_FOR_FLAGS(QAccessible::State)
+Q_GUI_EXPORT bool operator==(const QAccessible::State &first, const QAccessible::State &second);
+
Q_DECLARE_OPERATORS_FOR_FLAGS(QAccessible::Relation)
-QT_END_NAMESPACE
-Q_DECLARE_METATYPE(QSet<QAccessible::Method>)
-QT_BEGIN_NAMESPACE
class QAccessible2Interface;
class QAccessibleTextInterface;
@@ -369,7 +385,7 @@ public:
virtual QAccessible::Relation relationTo(const QAccessibleInterface *other) const;
virtual QVector<QPair<QAccessibleInterface*, QAccessible::Relation> > relations() const;
- virtual int childAt(int x, int y) const = 0;
+ virtual QAccessibleInterface *childAt(int x, int y) const = 0;
// navigation, hierarchy
virtual QAccessibleInterface *parent() const = 0;
@@ -384,16 +400,10 @@ public:
virtual QRect rect() const = 0;
virtual QAccessible::Role role() const = 0;
virtual QAccessible::State state() const = 0;
- // FIXME virtual QSet<QAccessible::State> states() const = 0;
virtual QColor foregroundColor() const;
virtual QColor backgroundColor() const;
- virtual QVariant invokeMethod(QAccessible::Method method, const QVariantList &params = QVariantList());
-
- inline QSet<QAccessible::Method> supportedMethods()
- { return qvariant_cast<QSet<QAccessible::Method> >(invokeMethod(QAccessible::ListSupportedMethods)); }
-
inline QAccessibleTextInterface *textInterface()
{ return reinterpret_cast<QAccessibleTextInterface *>(interface_cast(QAccessible::TextInterface)); }
@@ -415,30 +425,19 @@ public:
inline QAccessibleTableCellInterface *tableCellInterface()
{ return reinterpret_cast<QAccessibleTableCellInterface *>(interface_cast(QAccessible::TableCellInterface)); }
- // FIXME
- virtual QVariant virtual_hook(const QVariant &data);
+ virtual void virtual_hook(int id, void *data);
+
virtual void *interface_cast(QAccessible::InterfaceType)
{ return 0; }
private:
};
-class QAccessibleEvent : public QEvent
-{
-public:
- inline QAccessibleEvent(Type type);
- inline QString value() const { return val; }
- inline void setValue(const QString &aText) { val = aText; }
-
-private:
- QString val;
-};
-
-inline QAccessibleEvent::QAccessibleEvent(Type atype)
- : QEvent(atype) {}
-
#define QAccessibleInterface_iid "com.trolltech.Qt.QAccessibleInterface"
Q_DECLARE_INTERFACE(QAccessibleInterface, QAccessibleInterface_iid)
+Q_GUI_EXPORT const char *qAccessibleRoleString(QAccessible::Role role);
+Q_GUI_EXPORT const char *qAccessibleEventString(QAccessible::Event event);
+
#ifndef QT_NO_DEBUG_STREAM
Q_GUI_EXPORT QDebug operator<<(QDebug d, const QAccessibleInterface *iface);
#endif
diff --git a/src/gui/accessible/qaccessible2.cpp b/src/gui/accessible/qaccessible2.cpp
index d8bebdc697..0a7a8b0b6f 100644
--- a/src/gui/accessible/qaccessible2.cpp
+++ b/src/gui/accessible/qaccessible2.cpp
@@ -1,6 +1,6 @@
/****************************************************************************
**
-** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies).
+** Copyright (C) 2012 Nokia Corporation and/or its subsidiary(-ies).
** All rights reserved.
** Contact: Nokia Corporation (qt-info@nokia.com)
**
@@ -51,8 +51,6 @@ QT_BEGIN_NAMESPACE
/*!
\namespace QAccessible2
\ingroup accessibility
- \internal
- \preliminary
\brief The QAccessible2 namespace defines constants relating to
IAccessible2-based interfaces
@@ -64,35 +62,196 @@ QT_BEGIN_NAMESPACE
\class QAccessibleTextInterface
\ingroup accessibility
- \internal
- \preliminary
- \brief The QAccessibleTextInterface class implements support for
- the IAccessibleText interface.
+ \brief The QAccessibleTextInterface class implements support for text handling.
+
+ This interface corresponds to the IAccessibleText interface.
+ It should be implemented for widgets that display more text than a plain label.
+ Labels should be represented by only \l QAccessibleInterface
+ and return their text as name (\l QAccessibleInterface::text() with \l QAccessible::Name as type).
+ The QAccessibleTextInterface is typically for text that a screen reader
+ might want to read line by line, and for widgets that support text selection and input.
+ This interface is, for example, implemented for QLineEdit.
+ Editable text objects should also implement \l QAccessibleEditableTextInterface.
\link http://www.linux-foundation.org/en/Accessibility/IAccessible2 IAccessible2 Specification \endlink
*/
/*!
+ \fn QAccessibleTextInterface::~QAccessibleTextInterface()
+ Destructor.
+*/
+
+/*!
+ \fn void QAccessibleTextInterface::addSelection(int startOffset, int endOffset)
+ Select the text from \a startOffset to \a endOffset.
+ The \a startOffset is the first character that will be selected.
+ The \a endOffset is the first character that will not be selected.
+
+ When the object supports multiple selections (e.g. in a word processor),
+ this adds a new selection, otherwise it replaces the previous selection.
+
+ The selection will be \a endOffset - \a startOffset characters long.
+*/
+
+/*!
+ \fn QString QAccessibleTextInterface::attributes(int offset, int *startOffset, int *endOffset) const
+*/
+
+/*!
+ \fn int QAccessibleTextInterface::cursorPosition() const
+
+ Returns the current cursor position.
+*/
+
+/*!
+ \fn QRect QAccessibleTextInterface::characterRect(int offset, QAccessible2::CoordinateType coordType) const
+*/
+
+/*!
+ \fn int QAccessibleTextInterface::selectionCount() const
+
+ Returns the number of selections in this text.
+*/
+
+/*!
+ \fn int QAccessibleTextInterface::offsetAtPoint(const QPoint &point, QAccessible2::CoordinateType coordType) const
+*/
+
+/*!
+ \fn void QAccessibleTextInterface::selection(int selectionIndex, int *startOffset, int *endOffset) const
+*/
+
+/*!
+ \fn QString QAccessibleTextInterface::text(int startOffset, int endOffset) const
+
+ Returns the text from \a startOffset to \a endOffset.
+ The \a startOffset is the first character that will be returned.
+ The \a endOffset is the first character that will not be returned.
+*/
+
+/*!
+ \fn QString QAccessibleTextInterface::textBeforeOffset (int offset, QAccessible2::BoundaryType boundaryType,
+ int *startOffset, int *endOffset) const
+*/
+
+/*!
+ \fn QString QAccessibleTextInterface::textAfterOffset(int offset, QAccessible2::BoundaryType boundaryType,
+ int *startOffset, int *endOffset) const
+*/
+
+/*!
+ \fn QString QAccessibleTextInterface::textAtOffset(int offset, QAccessible2::BoundaryType boundaryType,
+ int *startOffset, int *endOffset) const
+*/
+
+/*!
+ \fn void QAccessibleTextInterface::removeSelection(int selectionIndex)
+
+ Clears the selection with \a index selectionIndex.
+*/
+
+/*!
+ \fn void QAccessibleTextInterface::setCursorPosition(int position)
+
+ Moves the cursor to \a position.
+*/
+
+/*!
+ \fn void QAccessibleTextInterface::setSelection(int selectionIndex, int startOffset, int endOffset)
+
+ Set the selection \a selectionIndex to the range from \a startOffset to \a endOffset.
+
+ \sa addSelection(), removeSelection()
+*/
+
+/*!
+ \fn int QAccessibleTextInterface::characterCount() const
+
+ Returns the lenght of the text (total size including spaces).
+*/
+
+/*!
+ \fn void QAccessibleTextInterface::scrollToSubstring(int startIndex, int endIndex)
+
+ Ensures that the text between \a startIndex and \a endIndex is visible.
+*/
+
+/*!
\class QAccessibleEditableTextInterface
\ingroup accessibility
- \internal
- \preliminary
- \brief The QAccessibleEditableTextInterface class implements support for
- the IAccessibleEditableText interface.
+ \brief The QAccessibleEditableTextInterface class implements support for objects with editable text.
+
+ When implementing this interface you will almost certainly also want to implement \l QAccessibleTextInterface.
+
+ Since this interface can be implemented by means of the normal \l QAccessibleTextInterface,
+ \l QAccessibleSimpleEditableTextInterface provides a convenience implementation of this interface.
+ Consider inheriting \l QAccessibleSimpleEditableTextInterface instead.
+
+ \sa QAccessibleInterface
\link http://www.linux-foundation.org/en/Accessibility/IAccessible2 IAccessible2 Specification \endlink
*/
/*!
+ \fn QAccessibleEditableTextInterface::~QAccessibleEditableTextInterface()
+
+
+*/
+
+/*!
+ \fn void QAccessibleEditableTextInterface::copyText(int startOffset, int endOffset) const
+
+ Copies the text from \a startOffset to \a endOffset to the system clip board.
+ The \a startOffset is the first character that will be copied.
+ The \a endOffset is the first character that will not be copied.
+*/
+
+/*!
+ \fn void QAccessibleEditableTextInterface::deleteText(int startOffset, int endOffset)
+
+ Deletes the text from \a startOffset to \a endOffset.
+*/
+
+/*!
+ \fn void QAccessibleEditableTextInterface::insertText(int offset, const QString &text)
+
+ Inserts \a text at position \a offset.
+*/
+
+/*!
+ \fn void QAccessibleEditableTextInterface::cutText(int startOffset, int endOffset)
+
+ Removes the text from \a startOffset to \a endOffset and puts it in the system clip board.
+*/
+
+/*!
+ \fn void QAccessibleEditableTextInterface::pasteText(int offset)
+
+ Pastes text from the system clip board at the position \a offset.
+*/
+
+/*!
+ \fn void QAccessibleEditableTextInterface::replaceText(int startOffset, int endOffset, const QString &text)
+
+ Removes the text from \a startOffset to \a endOffset and instead inserts \a text.
+*/
+
+/*!
+ \fn void QAccessibleEditableTextInterface::setAttributes(int startOffset, int endOffset, const QString &attributes)
+
+ \sa QAccessibleTextInterface::attributes()
+*/
+
+/*!
\class QAccessibleSimpleEditableTextInterface
\ingroup accessibility
- \internal
- \preliminary
\brief The QAccessibleSimpleEditableTextInterface class is a convenience class for
- text-based widgets.
+ text-based widgets. It can be inherited instead of \l QAccessibleEditableTextInterface.
+
+ \sa QAccessibleInterface, QAccessibleEditableTextInterface
\link http://www.linux-foundation.org/en/Accessibility/IAccessible2 IAccessible2 Specification \endlink
*/
@@ -100,16 +259,56 @@ QT_BEGIN_NAMESPACE
/*!
\class QAccessibleValueInterface
\ingroup accessibility
- \internal
- \preliminary
- \brief The QAccessibleValueInterface class implements support for
- the IAccessibleValue interface.
+ \brief The QAccessibleValueInterface class implements support for objects that manipulate a value.
+
+ This interface should be implemented by accessible objects that represent a value.
+ Examples are spinner, slider, dial and scroll bar.
+
+ Instead of forcing the user to deal with the individual parts of the widgets, this interface
+ gives an easier approach to the kind of widget it represents.
+
+ Usually this interface is implemented by classes that also implement \l QAccessibleInterface.
\link http://www.linux-foundation.org/en/Accessibility/IAccessible2 IAccessible2 Specification \endlink
*/
/*!
+ \fn QAccessibleValueInterface::~QAccessibleValueInterface()
+ Destructor.
+*/
+
+/*!
+ \fn QVariant QAccessibleValueInterface::currentValue() const
+
+ Returns the current value of the widget. This is usually a double or int.
+ \sa setCurrentValue()
+*/
+
+/*!
+ \fn void QAccessibleValueInterface::setCurrentValue(const QVariant &value)
+
+ Sets the \a value. If the desired \a value is out of the range of permissible values,
+ this call will be ignored.
+
+ \sa currentValue(), minimumValue(), maximumValue()
+*/
+
+/*!
+ \fn QVariant QAccessibleValueInterface::maximumValue() const
+
+ Returns the maximum value this object accepts.
+ \sa minimumValue(), currentValue()
+*/
+
+/*!
+ \fn QVariant QAccessibleValueInterface::minimumValue() const
+
+ Returns the minimum value this object accepts.
+ \sa maximumValue(), currentValue()
+*/
+
+/*!
\class QAccessibleImageInterface
\ingroup accessibility
\internal
@@ -122,27 +321,62 @@ QT_BEGIN_NAMESPACE
*/
/*!
+ \class QAccessibleTableCellInterface
+ \ingroup accessibility
+
+ \brief The QAccessibleTableCellInterface class implements support for
+ the IAccessibleTable2 Cell interface.
+
+ \link http://www.linux-foundation.org/en/Accessibility/IAccessible2 IAccessible2 Specification \endlink
+*/
+
+/*!
+ \class QAccessibleTableInterface
+ \ingroup accessibility
+
+ \brief The QAccessibleTableInterface class implements support for
+ the IAccessibleTable2 interface.
+
+ \link http://www.linux-foundation.org/en/Accessibility/IAccessible2 IAccessible2 Specification \endlink
+*/
+
+
+/*!
\class QAccessibleActionInterface
\ingroup accessibility
- \internal
- \preliminary
\brief The QAccessibleActionInterface class implements support for
invocable actions in the interface.
- Each accessible should implement the action interface if it supports any actions.
- The supported actions should adhere to the naming scheme inside the QAccessible2 namespace.
- Custom actions can be added.
+ Accessible objects should implement the action interface if they support user interaction.
+ Usually this interface is implemented by classes that also implement \l QAccessibleInterface.
+
+ The supported actions should use the predefined actions offered in this class unless they do not
+ fit a predefined action. In that case a custom action can be added.
When subclassing QAccessibleActionInterface you need to provide a list of actionNames which
is the primary means to discover the available actions. Action names are never localized.
In order to present actions to the user there are two functions that need to return localized versions
- of the name and give a description of the action.
-
- In order to invoke the action, doAction is called with an action name.
-
- Most widgets will simply implement the PressAction. This is what happens when the widget is activated by
- being clicked on, space pressed or similar.
+ of the name and give a description of the action. For the predefined action names use
+ \l QAccessibleActionInterface::localizedActionName() and \l QAccessibleActionInterface::localizedActionDescription()
+ to return their localized counterparts.
+
+ In general you should use one of the predefined action names, unless describing an action that does not fit these:
+ \table
+ \header \o Action name \o Description
+ \row \o \l checkAction() \o checks the item (checkbox, radio button, ...)
+ \row \o \l decreaseAction() \o decrease the value of the accessible (e.g. spinbox)
+ \row \o \l increaseAction() \o increase the value of the accessible (e.g. spinbox)
+ \row \o \l pressAction() \o press or click or activate the accessible (should correspont to clicking the object with the mouse)
+ \row \o \l setFocusAction() \o set the focus to this accessible
+ \row \o \l showMenuAction() \o show a context menu, corresponds to right-clicks
+ \row \o \l uncheckAction() \o uncheck the item (checkbox, radio button, ...)
+ \endtable
+
+ In order to invoke the action, \l doAction() is called with an action name.
+
+ Most widgets will simply implement \l pressAction(). This is what happens when the widget is activated by
+ being clicked, space pressed or similar.
\link http://www.linux-foundation.org/en/Accessibility/IAccessible2 IAccessible2 Specification \endlink
*/
@@ -150,42 +384,52 @@ QT_BEGIN_NAMESPACE
/*!
\fn QStringList QAccessibleActionInterface::actionNames() const
- Returns a list of valid actions. The actions returned should be in preferred order,
+ Returns the list of actions supported by this accessible object.
+ The actions returned should be in preferred order,
i.e. the action that the user most likely wants to trigger should be returned first,
while the least likely action should be returned last.
- The list does only contain actions that *can* be invoked. Therefore it,
- won't return disabled actions, or actions associated with disabled UI
- controls.
+ The list does only contain actions that can be invoked.
+ It won't return disabled actions, or actions associated with disabled UI controls.
- The list can also be empty.
+ The list can be empty.
- \sa localizedActionName(), doAction()
+ Note that this list is not localized. For a localized representation re-implement \l localizedActionName()
+ and \l localizedActionDescription()
+
+ \sa doAction(), localizedActionName(), localizedActionDescription()
*/
/*!
- \fn QString QAccessibleActionInterface::localizedActionName(const QString &name) const
+ \fn QString QAccessibleActionInterface::localizedActionName(const QString &actionName) const
+
+ Returns a localized action name of \a actionName.
- Returns a localized action name of \a name.
+ For custom actions this function has to be re-implemented.
+ When using one of the default names, you can call this function in QAccessibleActionInterface
+ to get the localized string.
\sa actionNames(), localizedActionDescription()
*/
/*!
- \fn QString QAccessibleActionInterface::localizedActionDescription(const QString &name) const
+ \fn QString QAccessibleActionInterface::localizedActionDescription(const QString &actionName) const
- Returns a localized action description of \a name.
+ Returns a localized action description of the action \a actionName.
- This is what should be presented to the user. The actionNames should always
- be untranslated to make them consistent for screen readers.
+ When using one of the default names, you can call this function in QAccessibleActionInterface
+ to get the localized string.
\sa actionNames(), localizedActionName()
*/
/*!
- \fn void QAccessibleActionInterface::doAction(const QString &actionName) const
+ \fn void QAccessibleActionInterface::doAction(const QString &actionName)
- Invokes the action specified by \a actionName
+ Invokes the action specified by \a actionName.
+ Note that \a actionName is the non-localized name as returned by \l actionNames()
+ This function is usually implemented by calling the same functions
+ that other user interaction, such as clicking the object, would trigger.
\sa actionNames()
*/
@@ -193,11 +437,14 @@ QT_BEGIN_NAMESPACE
/*!
\fn QStringList QAccessibleActionInterface::keyBindingsForAction(const QString &actionName) const
- Returns a list of the keyboard shortcuts available for invoking the action named \a actionName
+ Returns a list of the keyboard shortcuts available for invoking the action named \a actionName.
+
+ This is important to let users learn alternative ways of using the application by emphasizing the keyboard.
\sa actionNames()
*/
+
struct QAccessibleActionStrings
{
QAccessibleActionStrings() :
@@ -246,36 +493,64 @@ QString QAccessibleActionInterface::localizedActionDescription(const QString &ac
return QString();
}
+/*!
+ Returns the name of the press default action.
+ \sa actionNames(), localizedActionName()
+ */
const QString &QAccessibleActionInterface::pressAction()
{
return accessibleActionStrings()->pressAction;
}
+/*!
+ Returns the name of the increase default action.
+ \sa actionNames(), localizedActionName()
+ */
const QString &QAccessibleActionInterface::increaseAction()
{
return accessibleActionStrings()->increaseAction;
}
+/*!
+ Returns the name of the decrease default action.
+ \sa actionNames(), localizedActionName()
+ */
const QString &QAccessibleActionInterface::decreaseAction()
{
return accessibleActionStrings()->decreaseAction;
}
+/*!
+ Returns the name of the show menu default action.
+ \sa actionNames(), localizedActionName()
+ */
const QString &QAccessibleActionInterface::showMenuAction()
{
return accessibleActionStrings()->showMenuAction;
}
+/*!
+ Returns the name of the set focus default action.
+ \sa actionNames(), localizedActionName()
+ */
const QString &QAccessibleActionInterface::setFocusAction()
{
return accessibleActionStrings()->setFocusAction;
}
+/*!
+ Returns the name of the check default action.
+ \sa actionNames(), localizedActionName()
+ */
const QString &QAccessibleActionInterface::checkAction()
{
return accessibleActionStrings()->checkAction;
}
+/*!
+ Returns the name of the uncheck default action.
+ \sa actionNames(), localizedActionName()
+ */
const QString &QAccessibleActionInterface::uncheckAction()
{
return accessibleActionStrings()->uncheckAction;
@@ -405,7 +680,8 @@ static QString textForRange(QAccessibleInterface *iface, int startOffset, int en
}
#endif
-void QAccessibleSimpleEditableTextInterface::copyText(int startOffset, int endOffset)
+/*! \reimp */
+void QAccessibleSimpleEditableTextInterface::copyText(int startOffset, int endOffset) const
{
#ifdef QT_NO_CLIPBOARD
Q_UNUSED(startOffset);
@@ -415,6 +691,7 @@ void QAccessibleSimpleEditableTextInterface::copyText(int startOffset, int endOf
#endif
}
+/*! \reimp */
void QAccessibleSimpleEditableTextInterface::deleteText(int startOffset, int endOffset)
{
QString txt = iface->text(QAccessible::Value);
@@ -422,6 +699,7 @@ void QAccessibleSimpleEditableTextInterface::deleteText(int startOffset, int end
iface->setText(QAccessible::Value, txt);
}
+/*! \reimp */
void QAccessibleSimpleEditableTextInterface::insertText(int offset, const QString &text)
{
QString txt = iface->text(QAccessible::Value);
@@ -429,6 +707,7 @@ void QAccessibleSimpleEditableTextInterface::insertText(int offset, const QStrin
iface->setText(QAccessible::Value, txt);
}
+/*! \reimp */
void QAccessibleSimpleEditableTextInterface::cutText(int startOffset, int endOffset)
{
#ifdef QT_NO_CLIPBOARD
@@ -441,6 +720,7 @@ void QAccessibleSimpleEditableTextInterface::cutText(int startOffset, int endOff
#endif
}
+/*! \reimp */
void QAccessibleSimpleEditableTextInterface::pasteText(int offset)
{
#ifdef QT_NO_CLIPBOARD
@@ -452,6 +732,7 @@ void QAccessibleSimpleEditableTextInterface::pasteText(int offset)
#endif
}
+/*! \reimp */
void QAccessibleSimpleEditableTextInterface::replaceText(int startOffset, int endOffset, const QString &text)
{
QString txt = iface->text(QAccessible::Value);
diff --git a/src/gui/accessible/qaccessible2.h b/src/gui/accessible/qaccessible2.h
index 93db869364..0b1ddc99b1 100644
--- a/src/gui/accessible/qaccessible2.h
+++ b/src/gui/accessible/qaccessible2.h
@@ -1,6 +1,6 @@
/****************************************************************************
**
-** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies).
+** Copyright (C) 2012 Nokia Corporation and/or its subsidiary(-ies).
** All rights reserved.
** Contact: Nokia Corporation (qt-info@nokia.com)
**
@@ -97,23 +97,23 @@ public:
virtual ~QAccessibleTextInterface() {}
virtual void addSelection(int startOffset, int endOffset) = 0;
- virtual QString attributes(int offset, int *startOffset, int *endOffset) = 0;
- virtual int cursorPosition() = 0;
- virtual QRect characterRect(int offset, QAccessible2::CoordinateType coordType) = 0;
- virtual int selectionCount() = 0;
- virtual int offsetAtPoint(const QPoint &point, QAccessible2::CoordinateType coordType) = 0;
- virtual void selection(int selectionIndex, int *startOffset, int *endOffset) = 0;
- virtual QString text(int startOffset, int endOffset) = 0;
+ virtual QString attributes(int offset, int *startOffset, int *endOffset) const = 0;
+ virtual int cursorPosition() const = 0;
+ virtual QRect characterRect(int offset, QAccessible2::CoordinateType coordType) const = 0;
+ virtual int selectionCount() const = 0;
+ virtual int offsetAtPoint(const QPoint &point, QAccessible2::CoordinateType coordType) const = 0;
+ virtual void selection(int selectionIndex, int *startOffset, int *endOffset) const = 0;
+ virtual QString text(int startOffset, int endOffset) const = 0;
virtual QString textBeforeOffset (int offset, QAccessible2::BoundaryType boundaryType,
- int *startOffset, int *endOffset) = 0;
+ int *startOffset, int *endOffset) const = 0;
virtual QString textAfterOffset(int offset, QAccessible2::BoundaryType boundaryType,
- int *startOffset, int *endOffset) = 0;
+ int *startOffset, int *endOffset) const = 0;
virtual QString textAtOffset(int offset, QAccessible2::BoundaryType boundaryType,
- int *startOffset, int *endOffset) = 0;
+ int *startOffset, int *endOffset) const = 0;
virtual void removeSelection(int selectionIndex) = 0;
virtual void setCursorPosition(int position) = 0;
virtual void setSelection(int selectionIndex, int startOffset, int endOffset) = 0;
- virtual int characterCount() = 0;
+ virtual int characterCount() const = 0;
virtual void scrollToSubstring(int startIndex, int endIndex) = 0;
};
@@ -122,7 +122,7 @@ class Q_GUI_EXPORT QAccessibleEditableTextInterface
public:
virtual ~QAccessibleEditableTextInterface() {}
- virtual void copyText(int startOffset, int endOffset) = 0;
+ virtual void copyText(int startOffset, int endOffset) const = 0;
virtual void deleteText(int startOffset, int endOffset) = 0;
virtual void insertText(int offset, const QString &text) = 0;
virtual void cutText(int startOffset, int endOffset) = 0;
@@ -136,7 +136,7 @@ class Q_GUI_EXPORT QAccessibleSimpleEditableTextInterface: public QAccessibleEdi
public:
QAccessibleSimpleEditableTextInterface(QAccessibleInterface *accessibleInterface); //###
- void copyText(int startOffset, int endOffset);
+ void copyText(int startOffset, int endOffset) const;
void deleteText(int startOffset, int endOffset);
void insertText(int offset, const QString &text);
void cutText(int startOffset, int endOffset);
@@ -154,15 +154,17 @@ public:
virtual ~QAccessibleValueInterface() {}
- virtual QVariant currentValue() = 0;
+ virtual QVariant currentValue() const = 0;
virtual void setCurrentValue(const QVariant &value) = 0;
- virtual QVariant maximumValue() = 0;
- virtual QVariant minimumValue() = 0;
+ virtual QVariant maximumValue() const = 0;
+ virtual QVariant minimumValue() const = 0;
};
class Q_GUI_EXPORT QAccessibleTableCellInterface
{
public:
+ virtual ~QAccessibleTableCellInterface() {}
+
// Returns the number of columns occupied by this cell accessible.
virtual int columnExtent() const = 0;
@@ -189,6 +191,7 @@ public:
class Q_GUI_EXPORT QAccessibleTableInterface
{
public:
+ virtual ~QAccessibleTableInterface() {}
// Returns the cell at the specified row and column in the table.
virtual QAccessibleInterface *cellAt (int row, int column) const = 0;
@@ -249,6 +252,7 @@ class Q_GUI_EXPORT QAccessibleActionInterface
{
Q_DECLARE_TR_FUNCTIONS(QAccessibleActionInterface)
public:
+ virtual ~QAccessibleActionInterface() {}
virtual QStringList actionNames() const = 0;
virtual QString localizedActionName(const QString &name) const;
@@ -268,10 +272,11 @@ public:
class Q_GUI_EXPORT QAccessibleImageInterface
{
public:
+ virtual ~QAccessibleImageInterface() {}
- virtual QString imageDescription() = 0;
- virtual QSize imageSize() = 0;
- virtual QRect imagePosition(QAccessible2::CoordinateType coordType) = 0;
+ virtual QString imageDescription() const = 0;
+ virtual QSize imageSize() const = 0;
+ virtual QRect imagePosition(QAccessible2::CoordinateType coordType) const = 0;
};
#endif // QT_NO_ACCESSIBILITY
diff --git a/src/gui/accessible/qaccessible_mac.mm b/src/gui/accessible/qaccessible_mac.mm
deleted file mode 100644
index a250730493..0000000000
--- a/src/gui/accessible/qaccessible_mac.mm
+++ /dev/null
@@ -1,2469 +0,0 @@
-/****************************************************************************
-**
-** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies).
-** All rights reserved.
-** Contact: Nokia Corporation (qt-info@nokia.com)
-**
-** This file is part of the QtGui module of the Qt Toolkit.
-**
-** $QT_BEGIN_LICENSE:LGPL$
-** GNU Lesser General Public License Usage
-** This file may be used under the terms of the GNU Lesser General Public
-** License version 2.1 as published by the Free Software Foundation and
-** appearing in the file LICENSE.LGPL included in the packaging of this
-** file. Please review the following information to ensure the GNU Lesser
-** General Public License version 2.1 requirements will be met:
-** http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
-**
-** In addition, as a special exception, Nokia gives you certain additional
-** rights. These rights are described in the Nokia Qt LGPL Exception
-** version 1.1, included in the file LGPL_EXCEPTION.txt in this package.
-**
-** GNU General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU General
-** Public License version 3.0 as published by the Free Software Foundation
-** and appearing in the file LICENSE.GPL included in the packaging of this
-** file. Please review the following information to ensure the GNU General
-** Public License version 3.0 requirements will be met:
-** http://www.gnu.org/copyleft/gpl.html.
-**
-** Other Usage
-** Alternatively, this file may be used in accordance with the terms and
-** conditions contained in a signed written agreement between you and Nokia.
-**
-**
-**
-**
-**
-** $QT_END_LICENSE$
-**
-****************************************************************************/
-
-#include "qaccessible.h"
-
-#ifndef QT_NO_ACCESSIBILITY
-#include "qaccessible_mac_p.h"
-#include "qhash.h"
-#include "qset.h"
-#include "qpointer.h"
-#include "qapplication.h"
-#include "qmainwindow.h"
-#include "qtextdocument.h"
-#include "qdebug.h"
-#include "qabstractslider.h"
-#include "qsplitter.h"
-#include "qtabwidget.h"
-#include "qlistview.h"
-#include "qtableview.h"
-#include "qdockwidget.h"
-
-#include <private/qt_mac_p.h>
-#include <private/qwidget_p.h>
-#include <CoreFoundation/CoreFoundation.h>
-
-QT_BEGIN_NAMESPACE
-
-/*
- Set up platform defines. There is a one-to-one correspondence between the
- Carbon and Cocoa roles and attributes, but the prefix and type changes.
-*/
-#ifdef QT_MAC_USE_COCOA
-typedef NSString * const QAXRoleType;
-#define QAXApplicationRole NSAccessibilityApplicationRole
-#define QAXButtonRole NSAccessibilityButtonRole
-#define QAXCancelAction NSAccessibilityCancelAction
-#define QAXCheckBoxRole NSAccessibilityCheckBoxRole
-#define QAXChildrenAttribute NSAccessibilityChildrenAttribute
-#define QAXCloseButtonAttribute NSAccessibilityCloseButtonAttribute
-#define QAXCloseButtonAttribute NSAccessibilityCloseButtonAttribute
-#define QAXColumnRole NSAccessibilityColumnRole
-#define QAXConfirmAction NSAccessibilityConfirmAction
-#define QAXContentsAttribute NSAccessibilityContentsAttribute
-#define QAXDecrementAction NSAccessibilityDecrementAction
-#define QAXDecrementArrowSubrole NSAccessibilityDecrementArrowSubrole
-#define QAXDecrementPageSubrole NSAccessibilityDecrementPageSubrole
-#define QAXDescriptionAttribute NSAccessibilityDescriptionAttribute
-#define QAXEnabledAttribute NSAccessibilityEnabledAttribute
-#define QAXExpandedAttribute NSAccessibilityExpandedAttribute
-#define QAXFocusedAttribute NSAccessibilityFocusedAttribute
-#define QAXFocusedUIElementChangedNotification NSAccessibilityFocusedUIElementChangedNotification
-#define QAXFocusedWindowChangedNotification NSAccessibilityFocusedWindowChangedNotification
-#define QAXGroupRole NSAccessibilityGroupRole
-#define QAXGrowAreaAttribute NSAccessibilityGrowAreaAttribute
-#define QAXGrowAreaRole NSAccessibilityGrowAreaRole
-#define QAXHelpAttribute NSAccessibilityHelpAttribute
-#define QAXHorizontalOrientationValue NSAccessibilityHorizontalOrientationValue
-#define QAXHorizontalScrollBarAttribute NSAccessibilityHorizontalScrollBarAttribute
-#define QAXIncrementAction NSAccessibilityIncrementAction
-#define QAXIncrementArrowSubrole NSAccessibilityIncrementArrowSubrole
-#define QAXIncrementPageSubrole NSAccessibilityIncrementPageSubrole
-#define QAXIncrementorRole NSAccessibilityIncrementorRole
-#define QAXLinkedUIElementsAttribute NSAccessibilityLinkedUIElementsAttribute
-#define QAXListRole NSAccessibilityListRole
-#define QAXMainAttribute NSAccessibilityMainAttribute
-#define QAXMaxValueAttribute NSAccessibilityMaxValueAttribute
-#define QAXMenuBarRole NSAccessibilityMenuBarRole
-#define QAXMenuButtonRole NSAccessibilityMenuButtonRole
-#define QAXMenuClosedNotification NSAccessibilityMenuClosedNotification
-#define QAXMenuItemRole NSAccessibilityMenuItemRole
-#define QAXMenuOpenedNotification NSAccessibilityMenuOpenedNotification
-#define QAXMenuRole NSAccessibilityMenuRole
-#define QAXMinValueAttribute NSAccessibilityMinValueAttribute
-#define QAXMinimizeButtonAttribute NSAccessibilityMinimizeButtonAttribute
-#define QAXMinimizedAttribute NSAccessibilityMinimizedAttribute
-#define QAXNextContentsAttribute NSAccessibilityNextContentsAttribute
-#define QAXOrientationAttribute NSAccessibilityOrientationAttribute
-#define QAXParentAttribute NSAccessibilityParentAttribute
-#define QAXPickAction NSAccessibilityPickAction
-#define QAXPopUpButtonRole NSAccessibilityPopUpButtonRole
-#define QAXPositionAttribute NSAccessibilityPositionAttribute
-#define QAXPressAction NSAccessibilityPressAction
-#define QAXPreviousContentsAttribute NSAccessibilityPreviousContentsAttribute
-#define QAXProgressIndicatorRole NSAccessibilityProgressIndicatorRole
-#define QAXRadioButtonRole NSAccessibilityRadioButtonRole
-#define QAXRoleAttribute NSAccessibilityRoleAttribute
-#define QAXRoleDescriptionAttribute NSAccessibilityRoleDescriptionAttribute
-#define QAXRowRole NSAccessibilityRowRole
-#define QAXRowsAttribute NSAccessibilityRowsAttribute
-#define QAXScrollAreaRole NSAccessibilityScrollAreaRole
-#define QAXScrollBarRole NSAccessibilityScrollBarRole
-#define QAXSelectedAttribute NSAccessibilitySelectedAttribute
-#define QAXSelectedChildrenAttribute NSAccessibilitySelectedChildrenAttribute
-#define QAXSelectedRowsAttribute NSAccessibilitySelectedRowsAttribute
-#define QAXSizeAttribute NSAccessibilitySizeAttribute
-#define QAXSliderRole NSAccessibilitySliderRole
-#define QAXSplitGroupRole NSAccessibilitySplitGroupRole
-#define QAXSplitterRole NSAccessibilitySplitterRole
-#define QAXSplittersAttribute NSAccessibilitySplittersAttribute
-#define QAXStaticTextRole NSAccessibilityStaticTextRole
-#define QAXSubroleAttribute NSAccessibilitySubroleAttribute
-#define QAXSubroleAttribute NSAccessibilitySubroleAttribute
-#define QAXTabGroupRole NSAccessibilityTabGroupRole
-#define QAXTableRole NSAccessibilityTableRole
-#define QAXTabsAttribute NSAccessibilityTabsAttribute
-#define QAXTextFieldRole NSAccessibilityTextFieldRole
-#define QAXTitleAttribute NSAccessibilityTitleAttribute
-#define QAXTitleUIElementAttribute NSAccessibilityTitleUIElementAttribute
-#define QAXToolbarButtonAttribute NSAccessibilityToolbarButtonAttribute
-#define QAXToolbarRole NSAccessibilityToolbarRole
-#define QAXTopLevelUIElementAttribute NSAccessibilityTopLevelUIElementAttribute
-#define QAXUnknownRole NSAccessibilityUnknownRole
-#define QAXValueAttribute NSAccessibilityValueAttribute
-#define QAXValueChangedNotification NSAccessibilityValueChangedNotification
-#define QAXValueIndicatorRole NSAccessibilityValueIndicatorRole
-#define QAXVerticalOrientationValue NSAccessibilityVerticalOrientationValue
-#define QAXVerticalScrollBarAttribute NSAccessibilityVerticalScrollBarAttribute
-#define QAXVisibleRowsAttribute NSAccessibilityVisibleRowsAttribute
-#define QAXWindowAttribute NSAccessibilityWindowAttribute
-#define QAXWindowCreatedNotification NSAccessibilityWindowCreatedNotification
-#define QAXWindowMovedNotification NSAccessibilityWindowMovedNotification
-#define QAXWindowRole NSAccessibilityWindowRole
-#define QAXZoomButtonAttribute NSAccessibilityZoomButtonAttribute
-#else
-typedef CFStringRef const QAXRoleType;
-#define QAXApplicationRole kAXApplicationRole
-#define QAXButtonRole kAXButtonRole
-#define QAXCancelAction kAXCancelAction
-#define QAXCheckBoxRole kAXCheckBoxRole
-#define QAXChildrenAttribute kAXChildrenAttribute
-#define QAXCloseButtonAttribute kAXCloseButtonAttribute
-#define QAXColumnRole kAXColumnRole
-#define QAXConfirmAction kAXConfirmAction
-#define QAXContentsAttribute kAXContentsAttribute
-#define QAXDecrementAction kAXDecrementAction
-#define QAXDecrementArrowSubrole kAXDecrementArrowSubrole
-#define QAXDecrementPageSubrole kAXDecrementPageSubrole
-#define QAXDescriptionAttribute kAXDescriptionAttribute
-#define QAXEnabledAttribute kAXEnabledAttribute
-#define QAXExpandedAttribute kAXExpandedAttribute
-#define QAXFocusedAttribute kAXFocusedAttribute
-#define QAXFocusedUIElementChangedNotification kAXFocusedUIElementChangedNotification
-#define QAXFocusedWindowChangedNotification kAXFocusedWindowChangedNotification
-#define QAXGroupRole kAXGroupRole
-#define QAXGrowAreaAttribute kAXGrowAreaAttribute
-#define QAXGrowAreaRole kAXGrowAreaRole
-#define QAXHelpAttribute kAXHelpAttribute
-#define QAXHorizontalOrientationValue kAXHorizontalOrientationValue
-#define QAXHorizontalScrollBarAttribute kAXHorizontalScrollBarAttribute
-#define QAXIncrementAction kAXIncrementAction
-#define QAXIncrementArrowSubrole kAXIncrementArrowSubrole
-#define QAXIncrementPageSubrole kAXIncrementPageSubrole
-#define QAXIncrementorRole kAXIncrementorRole
-#define QAXLinkedUIElementsAttribute kAXLinkedUIElementsAttribute
-#define QAXListRole kAXListRole
-#define QAXMainAttribute kAXMainAttribute
-#define QAXMaxValueAttribute kAXMaxValueAttribute
-#define QAXMenuBarRole kAXMenuBarRole
-#define QAXMenuButtonRole kAXMenuButtonRole
-#define QAXMenuClosedNotification kAXMenuClosedNotification
-#define QAXMenuItemRole kAXMenuItemRole
-#define QAXMenuOpenedNotification kAXMenuOpenedNotification
-#define QAXMenuRole kAXMenuRole
-#define QAXMinValueAttribute kAXMinValueAttribute
-#define QAXMinimizeButtonAttribute kAXMinimizeButtonAttribute
-#define QAXMinimizedAttribute kAXMinimizedAttribute
-#define QAXNextContentsAttribute kAXNextContentsAttribute
-#define QAXOrientationAttribute kAXOrientationAttribute
-#define QAXParentAttribute kAXParentAttribute
-#define QAXPickAction kAXPickAction
-#define QAXPopUpButtonRole kAXPopUpButtonRole
-#define QAXPositionAttribute kAXPositionAttribute
-#define QAXPressAction kAXPressAction
-#define QAXPreviousContentsAttribute kAXPreviousContentsAttribute
-#define QAXProgressIndicatorRole kAXProgressIndicatorRole
-#define QAXRadioButtonRole kAXRadioButtonRole
-#define QAXRoleAttribute kAXRoleAttribute
-#define QAXRoleDescriptionAttribute kAXRoleDescriptionAttribute
-#define QAXRowRole kAXRowRole
-#define QAXRowsAttribute kAXRowsAttribute
-#define QAXScrollAreaRole kAXScrollAreaRole
-#define QAXScrollBarRole kAXScrollBarRole
-#define QAXSelectedAttribute kAXSelectedAttribute
-#define QAXSelectedChildrenAttribute kAXSelectedChildrenAttribute
-#define QAXSelectedRowsAttribute kAXSelectedRowsAttribute
-#define QAXSizeAttribute kAXSizeAttribute
-#define QAXSliderRole kAXSliderRole
-#define QAXSplitGroupRole kAXSplitGroupRole
-#define QAXSplitterRole kAXSplitterRole
-#define QAXSplittersAttribute kAXSplittersAttribute
-#define QAXStaticTextRole kAXStaticTextRole
-#define QAXSubroleAttribute kAXSubroleAttribute
-#define QAXTabGroupRole kAXTabGroupRole
-#define QAXTableRole kAXTableRole
-#define QAXTabsAttribute kAXTabsAttribute
-#define QAXTextFieldRole kAXTextFieldRole
-#define QAXTitleAttribute kAXTitleAttribute
-#define QAXTitleUIElementAttribute kAXTitleUIElementAttribute
-#define QAXToolbarButtonAttribute kAXToolbarButtonAttribute
-#define QAXToolbarRole kAXToolbarRole
-#define QAXTopLevelUIElementAttribute kAXTopLevelUIElementAttribute
-#define QAXUnknownRole kAXUnknownRole
-#define QAXValueAttribute kAXValueAttribute
-#define QAXValueChangedNotification kAXValueChangedNotification
-#define QAXValueIndicatorRole kAXValueIndicatorRole
-#define QAXVerticalOrientationValue kAXVerticalOrientationValue
-#define QAXVerticalScrollBarAttribute kAXVerticalScrollBarAttribute
-#define QAXVisibleRowsAttribute kAXVisibleRowsAttribute
-#define QAXWindowAttribute kAXWindowAttribute
-#define QAXWindowCreatedNotification kAXWindowCreatedNotification
-#define QAXWindowMovedNotification kAXWindowMovedNotification
-#define QAXWindowRole kAXWindowRole
-#define QAXZoomButtonAttribute kAXZoomButtonAttribute
-#endif
-
-
-/*****************************************************************************
- Externals
- *****************************************************************************/
-extern bool qt_mac_is_macsheet(const QWidget *w); //qwidget_mac.cpp
-extern bool qt_mac_is_macdrawer(const QWidget *w); //qwidget_mac.cpp
-
-/*****************************************************************************
- QAccessible Bindings
- *****************************************************************************/
-//hardcoded bindings between control info and (known) QWidgets
-struct QAccessibleTextBinding {
- int qt;
- QAXRoleType mac;
- bool settable;
-} text_bindings[][10] = {
- { { QAccessible::MenuItem, QAXMenuItemRole, false },
- { -1, 0, false }
- },
- { { QAccessible::MenuBar, QAXMenuBarRole, false },
- { -1, 0, false }
- },
- { { QAccessible::ScrollBar, QAXScrollBarRole, false },
- { -1, 0, false }
- },
- { { QAccessible::Grip, QAXGrowAreaRole, false },
- { -1, 0, false }
- },
- { { QAccessible::Window, QAXWindowRole, false },
- { -1, 0, false }
- },
- { { QAccessible::Dialog, QAXWindowRole, false },
- { -1, 0, false }
- },
- { { QAccessible::AlertMessage, QAXWindowRole, false },
- { -1, 0, false }
- },
- { { QAccessible::ToolTip, QAXWindowRole, false },
- { -1, 0, false }
- },
- { { QAccessible::HelpBalloon, QAXWindowRole, false },
- { -1, 0, false }
- },
- { { QAccessible::PopupMenu, QAXMenuRole, false },
- { -1, 0, false }
- },
- { { QAccessible::Application, QAXApplicationRole, false },
- { -1, 0, false }
- },
- { { QAccessible::Pane, QAXGroupRole, false },
- { -1, 0, false }
- },
- { { QAccessible::Grouping, QAXGroupRole, false },
- { -1, 0, false }
- },
- { { QAccessible::Separator, QAXSplitterRole, false },
- { -1, 0, false }
- },
- { { QAccessible::ToolBar, QAXToolbarRole, false },
- { -1, 0, false }
- },
- { { QAccessible::PageTab, QAXRadioButtonRole, false },
- { -1, 0, false }
- },
- { { QAccessible::ButtonMenu, QAXMenuButtonRole, false },
- { -1, 0, false }
- },
- { { QAccessible::ButtonDropDown, QAXPopUpButtonRole, false },
- { -1, 0, false }
- },
- { { QAccessible::SpinBox, QAXIncrementorRole, false },
- { -1, 0, false }
- },
- { { QAccessible::Slider, QAXSliderRole, false },
- { -1, 0, false }
- },
- { { QAccessible::ProgressBar, QAXProgressIndicatorRole, false },
- { -1, 0, false }
- },
- { { QAccessible::ComboBox, QAXPopUpButtonRole, false },
- { -1, 0, false }
- },
- { { QAccessible::RadioButton, QAXRadioButtonRole, false },
- { -1, 0, false }
- },
- { { QAccessible::CheckBox, QAXCheckBoxRole, false },
- { -1, 0, false }
- },
- { { QAccessible::StaticText, QAXStaticTextRole, false },
- { QAccessible::Name, QAXValueAttribute, false },
- { -1, 0, false }
- },
- { { QAccessible::Table, QAXTableRole, false },
- { -1, 0, false }
- },
- { { QAccessible::StatusBar, QAXStaticTextRole, false },
- { -1, 0, false }
- },
- { { QAccessible::Column, QAXColumnRole, false },
- { -1, 0, false }
- },
- { { QAccessible::ColumnHeader, QAXColumnRole, false },
- { -1, 0, false }
- },
- { { QAccessible::Row, QAXRowRole, false },
- { -1, 0, false }
- },
- { { QAccessible::RowHeader, QAXRowRole, false },
- { -1, 0, false }
- },
- { { QAccessible::Cell, QAXTextFieldRole, false },
- { -1, 0, false }
- },
- { { QAccessible::PushButton, QAXButtonRole, false },
- { -1, 0, false }
- },
- { { QAccessible::EditableText, QAXTextFieldRole, true },
- { -1, 0, false }
- },
- { { QAccessible::Link, QAXTextFieldRole, false },
- { -1, 0, false }
- },
- { { QAccessible::Indicator, QAXValueIndicatorRole, false },
- { -1, 0, false }
- },
- { { QAccessible::Splitter, QAXSplitGroupRole, false },
- { -1, 0, false }
- },
- { { QAccessible::List, QAXListRole, false },
- { -1, 0, false }
- },
- { { QAccessible::ListItem, QAXStaticTextRole, false },
- { -1, 0, false }
- },
- { { QAccessible::Cell, QAXStaticTextRole, false },
- { -1, 0, false }
- },
- { { -1, 0, false } }
-};
-
-class QAInterface;
-static CFStringRef macRole(const QAInterface &interface);
-
-QDebug operator<<(QDebug debug, const QAInterface &interface)
-{
- if (interface.isValid() == false)
- debug << "invalid interface";
- else
- debug << interface.object() << "id" << interface.id() << "role" << hex << interface.role();
- return debug;
-}
-
-// The root of the Qt accessible hiearchy.
-static QObject *rootObject = 0;
-
-
-bool QAInterface::operator==(const QAInterface &other) const
-{
- if (isValid() == false || other.isValid() == false)
- return (isValid() && other.isValid());
-
- // walk up the parent chain, comparing child indexes, until we reach
- // an interface that has a QObject.
- QAInterface currentThis = *this;
- QAInterface currentOther = other;
-
- while (currentThis.object() == 0) {
- if (currentOther.object() != 0)
- return false;
-
- // fail if the child indexes in the two hirearchies don't match.
- if (currentThis.parent().indexOfChild(currentThis) !=
- currentOther.parent().indexOfChild(currentOther))
- return false;
-
- currentThis = currentThis.parent();
- currentOther = currentOther.parent();
- }
-
- return (currentThis.object() == currentOther.object() && currentThis.id() == currentOther.id());
-}
-
-bool QAInterface::operator!=(const QAInterface &other) const
-{
- return !operator==(other);
-}
-
-uint qHash(const QAInterface &item)
-{
- if (item.isValid())
- return qHash(item.object()) + qHash(item.id());
- else
- return qHash(item.cachedObject()) + qHash(item.id());
-}
-
-QAInterface QAInterface::navigate(RelationFlag relation, int entry) const
-{
- if (!checkValid())
- return QAInterface();
-
- // On a QAccessibleInterface that handles its own children we can short-circut
- // the navigation if this QAInterface refers to one of the children:
- if (child != 0) {
- // The Ancestor interface will always be the same QAccessibleInterface with
- // a child value of 0.
- if (relation == QAccessible::Ancestor)
- return QAInterface(*this, 0);
-
- // The child hiearchy is only one level deep, so navigating to a child
- // of a child is not possible.
- if (relation == QAccessible::Child) {
- return QAInterface();
- }
- }
- QAccessibleInterface *child_iface = 0;
-
- const int status = base.interface->navigate(relation, entry, &child_iface);
-
- if (status == -1)
- return QAInterface(); // not found;
-
- // Check if target is a child of this interface.
- if (!child_iface) {
- return QAInterface(*this, status);
- } else {
- // Target is child_iface or a child of that (status decides).
- return QAInterface(child_iface, status);
- }
-}
-
-QAElement::QAElement()
-:elementRef(0)
-{}
-
-QAElement::QAElement(AXUIElementRef elementRef)
-:elementRef(elementRef)
-{
- if (elementRef != 0) {
- CFRetain(elementRef);
- CFRetain(object());
- }
-}
-
-QAElement::QAElement(const QAElement &element)
-:elementRef(element.elementRef)
-{
- if (elementRef != 0) {
- CFRetain(elementRef);
- CFRetain(object());
- }
-}
-
-QAElement::QAElement(HIObjectRef object, int child)
-{
-#ifndef QT_MAC_USE_COCOA
- if (object == 0) {
- elementRef = 0; // Create invalid QAElement.
- } else {
- elementRef = AXUIElementCreateWithHIObjectAndIdentifier(object, child);
- CFRetain(object);
- }
-#else
- Q_UNUSED(object);
- Q_UNUSED(child);
-#endif
-}
-
-QAElement::~QAElement()
-{
- if (elementRef != 0) {
- CFRelease(object());
- CFRelease(elementRef);
- }
-}
-
-void QAElement::operator=(const QAElement &other)
-{
- if (*this == other)
- return;
-
- if (elementRef != 0) {
- CFRelease(object());
- CFRelease(elementRef);
- }
-
- elementRef = other.elementRef;
-
- if (elementRef != 0) {
- CFRetain(elementRef);
- CFRetain(object());
- }
-}
-
-bool QAElement::operator==(const QAElement &other) const
-{
- if (elementRef == 0 || other.elementRef == 0)
- return (elementRef == other.elementRef);
-
- return CFEqual(elementRef, other.elementRef);
-}
-
-uint qHash(QAElement element)
-{
- return qHash(element.object()) + qHash(element.id());
-}
-
-#ifndef QT_MAC_USE_COCOA
-static QInterfaceFactory *createFactory(const QAInterface &interface);
-#endif
-Q_GLOBAL_STATIC(QAccessibleHierarchyManager, accessibleHierarchyManager);
-
-/*
- Reomves all accessibility info accosiated with the sender object.
-*/
-void QAccessibleHierarchyManager::objectDestroyed(QObject *object)
-{
- HIObjectRef hiObject = qobjectHiobjectHash.value(object);
- delete qobjectElementHash.value(object);
- qobjectElementHash.remove(object);
- hiobjectInterfaceHash.remove(hiObject);
-}
-
-/*
- Removes all stored items.
-*/
-void QAccessibleHierarchyManager::reset()
-{
- qDeleteAll(qobjectElementHash);
- qobjectElementHash.clear();
- hiobjectInterfaceHash.clear();
- qobjectHiobjectHash.clear();
-}
-
-QAccessibleHierarchyManager *QAccessibleHierarchyManager::instance()
-{
- return accessibleHierarchyManager();
-}
-
-#ifndef QT_MAC_USE_COCOA
-static bool isItemView(const QAInterface &interface)
-{
- QObject *object = interface.object();
- return (interface.role() == QAccessible::List || interface.role() == QAccessible::Table
- || (object && qobject_cast<QAbstractItemView *>(interface.object()))
- || (object && object->objectName() == QLatin1String("qt_scrollarea_viewport")
- && qobject_cast<QAbstractItemView *>(object->parent())));
-}
-#endif
-
-static bool isTabWidget(const QAInterface &interface)
-{
- if (QObject *object = interface.object())
- return (object->inherits("QTabWidget") && interface.id() == 0);
- return false;
-}
-
-static bool isStandaloneTabBar(const QAInterface &interface)
-{
- QObject *object = interface.object();
- if (interface.role() == QAccessible::PageTabList && object)
- return (qobject_cast<QTabWidget *>(object->parent()) == 0);
-
- return false;
-}
-
-static bool isEmbeddedTabBar(const QAInterface &interface)
-{
- QObject *object = interface.object();
- if (interface.role() == QAccessible::PageTabList && object)
- return (qobject_cast<QTabWidget *>(object->parent()));
-
- return false;
-}
-
-/*
- Decides if a QAInterface is interesting from an accessibility users point of view.
-*/
-bool isItInteresting(const QAInterface &interface)
-{
- // Mac accessibility does not have an attribute that corresponds to the Invisible/Offscreen
- // state, so we disable the interface here.
- const QAccessible::State state = interface.state();
- if (state & QAccessible::Invisible ||
- state & QAccessible::Offscreen )
- return false;
-
- const QAccessible::Role role = interface.role();
-
- if (QObject * const object = interface.object()) {
- const QString className = QLatin1String(object->metaObject()->className());
-
- // VoiceOver focusing on tool tips can be confusing. The contents of the
- // tool tip is avalible through the description attribute anyway, so
- // we disable accessibility for tool tips.
- if (className == QLatin1String("QTipLabel"))
- return false;
-
- // Hide TabBars that has a QTabWidget parent (the tab widget handles the accessibility)
- if (isEmbeddedTabBar(interface))
- return false;
-
- // Hide docked dockwidgets. ### causes infinitie loop in the apple accessibility code.
- /* if (QDockWidget *dockWidget = qobject_cast<QDockWidget *>(object)) {
- if (dockWidget->isFloating() == false)
- return false;
- }
- */
- }
-
- // Client is a generic role returned by plain QWidgets or other
- // widgets that does not have separate QAccessible interface, such
- // as the TabWidget. Return false unless macRole gives the interface
- // a special role.
- if (role == QAccessible::Client && macRole(interface) == CFStringRef(QAXUnknownRole))
- return false;
-
- // Some roles are not interesting:
- if (role == QAccessible::Border || // QFrame
- role == QAccessible::Application || // We use the system-provided application element.
- role == QAccessible::MenuItem) // The system also provides the menu items.
- return false;
-
- // It is probably better to access the toolbar buttons directly than having
- // to navigate through the toolbar.
- if (role == QAccessible::ToolBar)
- return false;
-
- return true;
-}
-
-QAElement QAccessibleHierarchyManager::registerInterface(QObject *object, int child)
-{
-#ifndef QT_MAC_USE_COCOA
- return registerInterface(QAInterface(QAccessible::queryAccessibleInterface(object), child));
-#else
- Q_UNUSED(object);
- Q_UNUSED(child);
- return QAElement();
-#endif
-}
-
-/*
- Creates a QAXUIelement that corresponds to the given QAInterface.
-*/
-QAElement QAccessibleHierarchyManager::registerInterface(const QAInterface &interface)
-{
-#ifndef QT_MAC_USE_COCOA
- if (interface.isValid() == false)
- return QAElement();
- QAInterface objectInterface = interface.objectInterface();
-
- QObject * qobject = objectInterface.object();
- HIObjectRef hiobject = objectInterface.hiObject();
- if (qobject == 0 || hiobject == 0)
- return QAElement();
-
- if (qobjectElementHash.contains(qobject) == false) {
- registerInterface(qobject, hiobject, createFactory(interface));
- HIObjectSetAccessibilityIgnored(hiobject, !isItInteresting(interface));
- }
-
- return QAElement(hiobject, interface.id());
-#else
- Q_UNUSED(interface);
- return QAElement();
-#endif
-}
-
-#ifndef QT_MAC_USE_COCOA
-#include "qaccessible_mac_carbon.cpp"
-#endif
-
-void QAccessibleHierarchyManager::registerInterface(QObject * qobject, HIObjectRef hiobject, QInterfaceFactory *interfaceFactory)
-{
-#ifndef QT_MAC_USE_COCOA
- if (qobjectElementHash.contains(qobject) == false) {
- qobjectElementHash.insert(qobject, interfaceFactory);
- qobjectHiobjectHash.insert(qobject, hiobject);
- connect(qobject, SIGNAL(destroyed(QObject *)), SLOT(objectDestroyed(QObject *)));
- }
-
- if (hiobjectInterfaceHash.contains(hiobject) == false) {
- hiobjectInterfaceHash.insert(hiobject, interfaceFactory);
- installAcessibilityEventHandler(hiobject);
- }
-#else
- Q_UNUSED(qobject);
- Q_UNUSED(hiobject);
- Q_UNUSED(interfaceFactory);
-#endif
-}
-
-void QAccessibleHierarchyManager::registerChildren(const QAInterface &interface)
-{
- QObject * const object = interface.object();
- if (object == 0)
- return;
-
- QInterfaceFactory *interfaceFactory = qobjectElementHash.value(object);
-
- if (interfaceFactory == 0)
- return;
-
- interfaceFactory->registerChildren();
-}
-
-QAInterface QAccessibleHierarchyManager::lookup(const AXUIElementRef &element)
-{
- if (element == 0)
- return QAInterface();
-#ifndef QT_MAC_USE_COCOA
- HIObjectRef hiObject = AXUIElementGetHIObject(element);
-
- QInterfaceFactory *factory = hiobjectInterfaceHash.value(hiObject);
- if (factory == 0) {
- return QAInterface();
- }
-
- UInt64 id;
- AXUIElementGetIdentifier(element, &id);
- return factory->interface(id);
-#else
- return QAInterface();
-#endif
-}
-
-QAInterface QAccessibleHierarchyManager::lookup(const QAElement &element)
-{
- return lookup(element.element());
-}
-
-QAElement QAccessibleHierarchyManager::lookup(const QAInterface &interface)
-{
- if (interface.isValid() == false)
- return QAElement();
-
- QInterfaceFactory *factory = qobjectElementHash.value(interface.objectInterface().object());
- if (factory == 0)
- return QAElement();
-
- return factory->element(interface);
-}
-
-QAElement QAccessibleHierarchyManager::lookup(QObject * const object, int id)
-{
- QInterfaceFactory *factory = qobjectElementHash.value(object);
- if (factory == 0)
- return QAElement();
-
- return factory->element(id);
-}
-
-/*
- Standard interface mapping, return the stored interface
- or HIObjectRef, and there is an one-to-one mapping between
- the identifier and child.
-*/
-class QStandardInterfaceFactory : public QInterfaceFactory
-{
-public:
- QStandardInterfaceFactory(const QAInterface &interface)
- : m_interface(interface), object(interface.hiObject())
- {
- CFRetain(object);
- }
-
- ~QStandardInterfaceFactory()
- {
- CFRelease(object);
- }
-
-
- QAInterface interface(UInt64 identifier)
- {
- const int child = identifier;
- return QAInterface(m_interface, child);
- }
-
- QAElement element(int id)
- {
- return QAElement(object, id);
- }
-
- QAElement element(const QAInterface &interface)
- {
- if (interface.object() == 0)
- return QAElement();
- return QAElement(object, interface.id());
- }
-
- void registerChildren()
- {
- const int childCount = m_interface.childCount();
- for (int i = 1; i <= childCount; ++i) {
- accessibleHierarchyManager()->registerInterface(m_interface.navigate(QAccessible::Child, i));
- }
- }
-
-private:
- QAInterface m_interface;
- HIObjectRef object;
-};
-
-/*
- Interface mapping where that creates one HIObject for each interface child.
-*/
-class QMultipleHIObjectFactory : public QInterfaceFactory
-{
-public:
- QMultipleHIObjectFactory(const QAInterface &interface)
- : m_interface(interface)
- { }
-
- ~QMultipleHIObjectFactory()
- {
- foreach (HIObjectRef object, objects) {
- CFRelease(object);
- }
- }
-
- QAInterface interface(UInt64 identifier)
- {
- const int child = identifier;
- return QAInterface(m_interface, child);
- }
-
- QAElement element(int child)
- {
- if (child == 0)
- return QAElement(m_interface.hiObject(), 0);
-
- if (child > objects.count())
- return QAElement();
-
- return QAElement(objects.at(child - 1), child);
- }
-
- void registerChildren()
- {
-#ifndef QT_MAC_USE_COCOA
- const int childCount = m_interface.childCount();
- for (int i = 1; i <= childCount; ++i) {
- HIObjectRef hiobject;
- HIObjectCreate(kObjectQtAccessibility, 0, &hiobject);
- objects.append(hiobject);
- accessibleHierarchyManager()->registerInterface(m_interface.object(), hiobject, this);
- HIObjectSetAccessibilityIgnored(hiobject, !isItInteresting(m_interface.navigate(QAccessible::Child, i)));
- }
-#endif
- }
-
-private:
- QAInterface m_interface;
- QList<HIObjectRef> objects;
-};
-
-class QItemViewInterfaceFactory : public QInterfaceFactory
-{
-public:
- QItemViewInterfaceFactory(const QAInterface &interface)
- : m_interface(interface), object(interface.hiObject())
- {
- CFRetain(object);
- columnCount = 0;
- if (QTableView * tableView = qobject_cast<QTableView *>(interface.parent().object())) {
- if (tableView->model())
- columnCount = tableView->model()->columnCount();
- if (tableView->verticalHeader())
- ++columnCount;
- }
- }
-
- ~QItemViewInterfaceFactory()
- {
- CFRelease(object);
- }
-
- QAInterface interface(UInt64 identifier)
- {
- if (identifier == 0)
- return m_interface;
-
- if (m_interface.role() == QAccessible::List)
- return m_interface.childAt(identifier);
-
- if (m_interface.role() == QAccessible::Table) {
- const int index = identifier;
- if (index == 0)
- return m_interface; // return the item view interface.
-
- const int rowIndex = (index - 1) / (columnCount + 1);
- const int cellIndex = (index - 1) % (columnCount + 1);
-/*
- qDebug() << "index" << index;
- qDebug() << "rowIndex" << rowIndex;
- qDebug() << "cellIndex" << cellIndex;
-*/
- const QAInterface rowInterface = m_interface.childAt(rowIndex + 1);
-
- if ((cellIndex) == 0) // Is it a row?
- return rowInterface;
- else {
- return rowInterface.childAt(cellIndex);
- }
- }
-
- return QAInterface();
- }
-
- QAElement element(int id)
- {
- if (id != 0) {
- return QAElement();
- }
- return QAElement(object, 0);
- }
-
- QAElement element(const QAInterface &interface)
- {
- if (interface.object() && interface.object() == m_interface.object()) {
- return QAElement(object, 0);
- } else if (m_interface.role() == QAccessible::List) {
- if (interface.parent().object() && interface.parent().object() == m_interface.object())
- return QAElement(object, m_interface.indexOfChild(interface));
- } else if (m_interface.role() == QAccessible::Table) {
- QAInterface currentInterface = interface;
- int index = 0;
-
- while (currentInterface.isValid() && currentInterface.object() == 0) {
- const QAInterface parentInterface = currentInterface.parent();
-/*
- qDebug() << "current index" << index;
- qDebug() << "current interface" << interface;
-
- qDebug() << "parent interface" << parentInterface;
- qDebug() << "grandparent interface" << parentInterface.parent();
- qDebug() << "childCount" << interface.childCount();
- qDebug() << "index of child" << parentInterface.indexOfChild(currentInterface);
-*/
- index += ((parentInterface.indexOfChild(currentInterface) - 1) * (currentInterface.childCount() + 1)) + 1;
- currentInterface = parentInterface;
-// qDebug() << "new current interface" << currentInterface;
- }
- if (currentInterface.object() == m_interface.object())
- return QAElement(object, index);
-
-
- }
- return QAElement();
- }
-
- void registerChildren()
- {
- // Item view child interfraces don't have their own qobjects, so there is nothing to register here.
- }
-
-private:
- QAInterface m_interface;
- HIObjectRef object;
- int columnCount; // for table views;
-};
-
-#ifndef QT_MAC_USE_COCOA
-static bool managesChildren(const QAInterface &interface)
-{
- return (interface.childCount() > 0 && interface.childAt(1).id() > 0);
-}
-
-static QInterfaceFactory *createFactory(const QAInterface &interface)
-{
- if (isItemView(interface)) {
- return new QItemViewInterfaceFactory(interface);
- } if (managesChildren(interface)) {
- return new QMultipleHIObjectFactory(interface);
- }
-
- return new QStandardInterfaceFactory(interface);
-}
-#endif
-
-QList<QAElement> lookup(const QList<QAInterface> &interfaces)
-{
- QList<QAElement> elements;
- foreach (const QAInterface &interface, interfaces)
- if (interface.isValid()) {
- const QAElement element = accessibleHierarchyManager()->lookup(interface);
- if (element.isValid())
- elements.append(element);
- }
- return elements;
-}
-
-// Debug output helpers:
-/*
-static QString nameForEventKind(UInt32 kind)
-{
- switch(kind) {
- case kEventAccessibleGetChildAtPoint: return QString("GetChildAtPoint"); break;
- case kEventAccessibleGetAllAttributeNames: return QString("GetAllAttributeNames"); break;
- case kEventAccessibleGetNamedAttribute: return QString("GetNamedAttribute"); break;
- case kEventAccessibleSetNamedAttribute: return QString("SetNamedAttribute"); break;
- case kEventAccessibleGetAllActionNames: return QString("GetAllActionNames"); break;
- case kEventAccessibleGetFocusedChild: return QString("GetFocusedChild"); break;
- default:
- return QString("Unknown accessibility event type: %1").arg(kind);
- break;
- };
-}
-*/
-#ifndef QT_MAC_USE_COCOA
-static bool qt_mac_append_cf_uniq(CFMutableArrayRef array, CFTypeRef value)
-{
- if (value == 0)
- return false;
-
- CFRange range;
- range.location = 0;
- range.length = CFArrayGetCount(array);
- if(!CFArrayContainsValue(array, range, value)) {
- CFArrayAppendValue(array, value);
- return true;
- }
- return false;
-}
-
-static OSStatus setAttributeValue(EventRef event, const QList<QAElement> &elements)
-{
- CFMutableArrayRef array = CFArrayCreateMutable(0, 0, &kCFTypeArrayCallBacks);
- foreach (const QAElement &element, elements) {
- if (element.isValid())
- CFArrayAppendValue(array, element.element());
- }
-
- const OSStatus err = SetEventParameter(event, kEventParamAccessibleAttributeValue,
- typeCFTypeRef, sizeof(array), &array);
- CFRelease(array);
- return err;
-}
-#endif //QT_MAC_USE_COCOA
-
-/*
- Gets the AccessibleObject parameter from an event.
-*/
-static inline AXUIElementRef getAccessibleObjectParameter(EventRef event)
-{
- AXUIElementRef element;
- GetEventParameter(event, kEventParamAccessibleObject, typeCFTypeRef, 0,
- sizeof(element), 0, &element);
- return element;
-}
-
-/*
- The application event handler makes sure that all top-level qt windows are registered
- before any accessibility events are handeled.
-*/
-#ifndef QT_MAC_USE_COCOA
-static OSStatus applicationEventHandler(EventHandlerCallRef next_ref, EventRef event, void *)
-{
- QAInterface rootInterface(QAccessible::queryAccessibleInterface(rootObject ? rootObject : qApp), 0);
- accessibleHierarchyManager()->registerChildren(rootInterface);
-
- return CallNextEventHandler(next_ref, event);
-}
-
-/*
- Returns the value for element by combining the QAccessibility::Checked and
- QAccessibility::Mixed flags into an int value that the Mac accessibilty
- system understands. This works for check boxes, radio buttons, and the like.
- The return values are:
- 0: unchecked
- 1: checked
- 2: undecided
-*/
-static int buttonValue(QAInterface element)
-{
- const QAccessible::State state = element.state();
- if (state & QAccessible::Mixed)
- return 2;
- else if(state & QAccessible::Checked)
- return 1;
- else
- return 0;
-}
-
-static QString getValue(const QAInterface &interface)
-{
- const QAccessible::Role role = interface.role();
- if (role == QAccessible::RadioButton || role == QAccessible::CheckBox)
- return QString::number(buttonValue(interface));
- else
- return interface.text(QAccessible::Value);
-}
-#endif //QT_MAC_USE_COCOA
-
-/*
- Translates a QAccessible::Role into a mac accessibility role.
-*/
-static CFStringRef macRole(const QAInterface &interface)
-{
- const QAccessible::Role qtRole = interface.role();
-
-// qDebug() << "role for" << interface.object() << "interface role" << hex << qtRole;
-
- // Qt accessibility: QAccessible::Splitter contains QAccessible::Grip.
- // Mac accessibility: AXSplitGroup contains AXSplitter.
- if (qtRole == QAccessible::Grip) {
- const QAInterface parent = interface.parent();
- if (parent.isValid() && parent.role() == QAccessible::Splitter)
- return CFStringRef(QAXSplitterRole);
- }
-
- // Tab widgets and standalone tab bars get the kAXTabGroupRole. Accessibility
- // for tab bars emebedded in a tab widget is handled by the tab widget.
- if (isTabWidget(interface) || isStandaloneTabBar(interface))
- return kAXTabGroupRole;
-
- if (QObject *object = interface.object()) {
- // ### The interface for an abstract scroll area returns the generic "Client"
- // role, so we have to to an extra detect on the QObject here.
- if (object->inherits("QAbstractScrollArea") && interface.id() == 0)
- return CFStringRef(QAXScrollAreaRole);
-
- if (object->inherits("QDockWidget"))
- return CFStringRef(QAXUnknownRole);
- }
-
- int i = 0;
- int testRole = text_bindings[i][0].qt;
- while (testRole != -1) {
- if (testRole == qtRole)
- return CFStringRef(text_bindings[i][0].mac);
- ++i;
- testRole = text_bindings[i][0].qt;
- }
-
-// qDebug() << "got unknown role!" << interface << interface.parent();
-
- return CFStringRef(QAXUnknownRole);
-}
-
-/*
- Translates a QAccessible::Role and an attribute name into a QAccessible::Text, taking into
- account execptions listed in text_bindings.
-*/
-#ifndef QT_MAC_USE_COCOA
-static int textForRoleAndAttribute(QAccessible::Role role, CFStringRef attribute)
-{
- // Search for exception, return it if found.
- int testRole = text_bindings[0][0].qt;
- int i = 0;
- while (testRole != -1) {
- if (testRole == role) {
- int j = 1;
- int qtRole = text_bindings[i][j].qt;
- CFStringRef testAttribute = CFStringRef(text_bindings[i][j].mac);
- while (qtRole != -1) {
- if (CFStringCompare(attribute, testAttribute, 0) == kCFCompareEqualTo) {
- return (QAccessible::Text)qtRole;
- }
- ++j;
- testAttribute = CFStringRef(text_bindings[i][j].mac); /// ### custom compare
- qtRole = text_bindings[i][j].qt; /// ### custom compare
- }
- break;
- }
- ++i;
- testRole = text_bindings[i][0].qt;
- }
-
- // Return default mappping
- if (CFStringCompare(attribute, CFStringRef(QAXTitleAttribute), 0) == kCFCompareEqualTo)
- return QAccessible::Name;
- else if (CFStringCompare(attribute, CFStringRef(QAXValueAttribute), 0) == kCFCompareEqualTo)
- return QAccessible::Value;
- else if (CFStringCompare(attribute, CFStringRef(QAXHelpAttribute), 0) == kCFCompareEqualTo)
- return QAccessible::Help;
- else if (CFStringCompare(attribute, CFStringRef(QAXDescriptionAttribute), 0) == kCFCompareEqualTo)
- return QAccessible::Description;
- else
- return -1;
-}
-
-/*
- Returns the subrole string constant for the interface if it has one,
- else returns an empty string.
-*/
-static QCFString subrole(const QAInterface &interface)
-{
- const QAInterface parent = interface.parent();
- if (parent.isValid() == false)
- return QCFString();
-
- if (parent.role() == QAccessible::ScrollBar) {
- QCFString subrole;
- switch(interface.id()) {
- case 1: subrole = CFStringRef(QAXDecrementArrowSubrole); break;
- case 2: subrole = CFStringRef(QAXDecrementPageSubrole); break;
- case 4: subrole = CFStringRef(QAXIncrementPageSubrole); break;
- case 5: subrole = CFStringRef(QAXIncrementArrowSubrole); break;
- default:
- break;
- }
- return subrole;
- }
- return QCFString();
-}
-
-// Gets the scroll bar orientation by asking the QAbstractSlider object directly.
-static Qt::Orientation scrollBarOrientation(const QAInterface &scrollBar)
-{
- QObject *const object = scrollBar.object();
- if (QAbstractSlider * const sliderObject = qobject_cast<QAbstractSlider * const>(object))
- return sliderObject->orientation();
-
- return Qt::Vertical; // D'oh! The interface wasn't a scroll bar.
-}
-
-static QAInterface scrollAreaGetScrollBarInterface(const QAInterface &scrollArea, Qt::Orientation orientation)
-{
- if (macRole(scrollArea) != CFStringRef(CFStringRef(QAXScrollAreaRole)))
- return QAInterface();
-
- // Child 1 is the contents widget, 2 and 3 are the scroll bar containers wich contains possible scroll bars.
- for (int i = 2; i <= 3; ++i) {
- QAInterface scrollBarContainer = scrollArea.childAt(i);
- for (int i = 1; i <= scrollBarContainer.childCount(); ++i) {
- QAInterface scrollBar = scrollBarContainer.childAt(i);
- if (scrollBar.isValid() &&
- scrollBar.role() == QAccessible::ScrollBar &&
- scrollBarOrientation(scrollBar) == orientation)
- return scrollBar;
- }
- }
-
- return QAInterface();
-}
-
-static bool scrollAreaHasScrollBar(const QAInterface &scrollArea, Qt::Orientation orientation)
-{
- return scrollAreaGetScrollBarInterface(scrollArea, orientation).isValid();
-}
-
-static QAElement scrollAreaGetScrollBar(const QAInterface &scrollArea, Qt::Orientation orientation)
-{
- return accessibleHierarchyManager()->lookup(scrollAreaGetScrollBarInterface(scrollArea, orientation));
-}
-
-static QAElement scrollAreaGetContents(const QAInterface &scrollArea)
-{
- // Child 1 is the contents widget,
- return accessibleHierarchyManager()->lookup(scrollArea.navigate(QAccessible::Child, 1));
-}
-
-static QAElement tabWidgetGetContents(const QAInterface &interface)
-{
- // A kAXTabGroup has a kAXContents attribute, which consists of the
- // ui elements for the current tab page. Get the current tab page
- // from the QStackedWidget, where the current visible page can
- // be found at index 1.
- QAInterface stackedWidget = interface.childAt(1);
- accessibleHierarchyManager()->registerChildren(stackedWidget);
- QAInterface tabPageInterface = stackedWidget.childAt(1);
- return accessibleHierarchyManager()->lookup(tabPageInterface);
-}
-
-static QList<QAElement> tabBarGetTabs(const QAInterface &interface)
-{
- // Get the tabs by searching for children with the "PageTab" role.
- // This filters out the left/right navigation buttons.
- accessibleHierarchyManager()->registerChildren(interface);
- QList<QAElement> tabs;
- const int numChildren = interface.childCount();
- for (int i = 1; i < numChildren + 1; ++i) {
- QAInterface child = interface.navigate(QAccessible::Child, i);
- if (child.isValid() && child.role() == QAccessible::PageTab) {
- tabs.append(accessibleHierarchyManager()->lookup(child));
- }
- }
- return tabs;
-}
-
-static QList<QAElement> tabWidgetGetTabs(const QAInterface &interface)
-{
- // Each QTabWidget has two children, a QStackedWidget and a QTabBar.
- // Get the tabs from the QTabBar.
- return tabBarGetTabs(interface.childAt(2));
-}
-
-static QList<QAElement> tabWidgetGetChildren(const QAInterface &interface)
-{
- // The children for a kAXTabGroup should consist of the tabs and the
- // contents of the current open tab page.
- QList<QAElement> children = tabWidgetGetTabs(interface);
- children += tabWidgetGetContents(interface);
- return children;
-}
-#endif //QT_MAC_USE_COCOA
-
-/*
- Returns the label (buddy) interface for interface, or 0 if it has none.
-*/
-/*
-static QAInterface findLabel(const QAInterface &interface)
-{
- return interface.navigate(QAccessible::Label, 1);
-}
-*/
-/*
- Returns a list of interfaces this interface labels, or an empty list if it doesn't label any.
-*/
-/*
-static QList<QAInterface> findLabelled(const QAInterface &interface)
-{
- QList<QAInterface> interfaceList;
-
- int count = 1;
- const QAInterface labelled = interface.navigate(QAccessible::Labelled, count);
- while (labelled.isValid()) {
- interfaceList.append(labelled);
- ++count;
- }
- return interfaceList;
-}
-*/
-/*
- Tests if the given QAInterface has data for a mac attribute.
-*/
-#ifndef QT_MAC_USE_COCOA
-static bool supportsAttribute(CFStringRef attribute, const QAInterface &interface)
-{
- const int text = textForRoleAndAttribute(interface.role(), attribute);
-
- // Special case: Static texts don't have a title.
- if (interface.role() == QAccessible::StaticText && attribute == CFStringRef(QAXTitleAttribute))
- return false;
-
- // Return true if we the attribute matched a QAccessible::Role and we get text for that role from the interface.
- if (text != -1) {
- if (text == QAccessible::Value) // Special case for Value, see getValue()
- return !getValue(interface).isEmpty();
- else
- return !interface.text((QAccessible::Text)text).isEmpty();
- }
-
- if (CFStringCompare(attribute, CFStringRef(QAXChildrenAttribute), 0) == kCFCompareEqualTo) {
- if (interface.childCount() > 0)
- return true;
- }
-
- if (CFStringCompare(attribute, CFStringRef(QAXSubroleAttribute), 0) == kCFCompareEqualTo) {
- return (subrole(interface) != QCFString());
- }
-
- return false;
-}
-
-static void appendIfSupported(CFMutableArrayRef array, CFStringRef attribute, const QAInterface &interface)
-{
- if (supportsAttribute(attribute, interface))
- qt_mac_append_cf_uniq(array, attribute);
-}
-
-/*
- Returns the names of the attributes the give QAInterface supports.
-*/
-static OSStatus getAllAttributeNames(EventRef event, const QAInterface &interface, EventHandlerCallRef next_ref)
-{
- // Call system event handler.
- OSStatus err = CallNextEventHandler(next_ref, event);
- if(err != noErr && err != eventNotHandledErr)
- return err;
- CFMutableArrayRef attrs = 0;
- GetEventParameter(event, kEventParamAccessibleAttributeNames, typeCFMutableArrayRef, 0,
- sizeof(attrs), 0, &attrs);
-
- if (!attrs)
- return eventNotHandledErr;
-
- // Append attribute names that are always supported.
- qt_mac_append_cf_uniq(attrs, CFStringRef(QAXPositionAttribute));
- qt_mac_append_cf_uniq(attrs, CFStringRef(QAXSizeAttribute));
- qt_mac_append_cf_uniq(attrs, CFStringRef(QAXRoleAttribute));
- qt_mac_append_cf_uniq(attrs, CFStringRef(QAXEnabledAttribute));
- qt_mac_append_cf_uniq(attrs, CFStringRef(QAXWindowAttribute));
- qt_mac_append_cf_uniq(attrs, CFStringRef(QAXTopLevelUIElementAttribute));
-
- // Append these names if the QInterafceItem returns any data for them.
- appendIfSupported(attrs, CFStringRef(QAXTitleAttribute), interface);
- appendIfSupported(attrs, CFStringRef(QAXValueAttribute), interface);
- appendIfSupported(attrs, CFStringRef(QAXDescriptionAttribute), interface);
- appendIfSupported(attrs, CFStringRef(QAXLinkedUIElementsAttribute), interface);
- appendIfSupported(attrs, CFStringRef(QAXHelpAttribute), interface);
- appendIfSupported(attrs, CFStringRef(QAXTitleUIElementAttribute), interface);
- appendIfSupported(attrs, CFStringRef(QAXChildrenAttribute), interface);
- appendIfSupported(attrs, CFStringRef(QAXSubroleAttribute), interface);
-
- // Append attribute names based on the interaface role.
- switch (interface.role()) {
- case QAccessible::Window:
- qt_mac_append_cf_uniq(attrs, CFStringRef(QAXMainAttribute));
- qt_mac_append_cf_uniq(attrs, CFStringRef(QAXMinimizedAttribute));
- qt_mac_append_cf_uniq(attrs, CFStringRef(QAXCloseButtonAttribute));
- qt_mac_append_cf_uniq(attrs, CFStringRef(QAXZoomButtonAttribute));
- qt_mac_append_cf_uniq(attrs, CFStringRef(QAXMinimizeButtonAttribute));
- qt_mac_append_cf_uniq(attrs, CFStringRef(QAXToolbarButtonAttribute));
- qt_mac_append_cf_uniq(attrs, CFStringRef(QAXGrowAreaAttribute));
- break;
- case QAccessible::RadioButton:
- case QAccessible::CheckBox:
- qt_mac_append_cf_uniq(attrs, CFStringRef(QAXMinValueAttribute));
- qt_mac_append_cf_uniq(attrs, CFStringRef(QAXMaxValueAttribute));
- break;
- case QAccessible::ScrollBar:
- qt_mac_append_cf_uniq(attrs, CFStringRef(QAXOrientationAttribute));
- break;
- case QAccessible::Splitter:
- qt_mac_append_cf_uniq(attrs, CFStringRef(QAXSplittersAttribute));
- break;
- case QAccessible::Table:
- qt_mac_append_cf_uniq(attrs, CFStringRef(QAXRowsAttribute));
- qt_mac_append_cf_uniq(attrs, CFStringRef(QAXVisibleRowsAttribute));
- qt_mac_append_cf_uniq(attrs, CFStringRef(QAXSelectedRowsAttribute));
- break;
- default:
- break;
- }
-
- // Append attribute names based on the mac accessibility role.
- const QCFString mac_role = macRole(interface);
- if (mac_role == CFStringRef(QAXSplitterRole)) {
- qt_mac_append_cf_uniq(attrs, CFStringRef(QAXPreviousContentsAttribute));
- qt_mac_append_cf_uniq(attrs, CFStringRef(QAXNextContentsAttribute));
- qt_mac_append_cf_uniq(attrs, CFStringRef(QAXOrientationAttribute));
- } else if (mac_role == CFStringRef(QAXScrollAreaRole)) {
- if (scrollAreaHasScrollBar(interface, Qt::Horizontal))
- qt_mac_append_cf_uniq(attrs, CFStringRef(QAXHorizontalScrollBarAttribute));
- if (scrollAreaHasScrollBar(interface, Qt::Vertical))
- qt_mac_append_cf_uniq(attrs, CFStringRef(QAXVerticalScrollBarAttribute));
- qt_mac_append_cf_uniq(attrs, CFStringRef(QAXContentsAttribute));
- } else if (mac_role == CFStringRef(QAXTabGroupRole)) {
- qt_mac_append_cf_uniq(attrs, CFStringRef(QAXTabsAttribute));
- // Only tab widgets can have the contents attribute, there is no way of getting
- // the contents from a QTabBar.
- if (isTabWidget(interface))
- qt_mac_append_cf_uniq(attrs, CFStringRef(QAXContentsAttribute));
- }
-
- return noErr;
-}
-
-static void handleStringAttribute(EventRef event, QAccessible::Text text, const QAInterface &interface)
-{
- QString str = interface.text(text);
- if (str.isEmpty())
- return;
-
- // Remove any html markup from the text string, or VoiceOver will read the html tags.
- static QTextDocument document;
- document.setHtml(str);
- str = document.toPlainText();
-
- CFStringRef cfstr = QCFString::toCFStringRef(str);
- SetEventParameter(event, kEventParamAccessibleAttributeValue, typeCFStringRef, sizeof(cfstr), &cfstr);
-}
-
-/*
- Handles the parent attribute for a interface.
- There are basically three cases here:
- 1. interface is a HIView and has only HIView children.
- 2. interface is a HIView but has children that is not a HIView
- 3. interface is not a HIView.
-*/
-static OSStatus handleChildrenAttribute(EventHandlerCallRef next_ref, EventRef event, QAInterface &interface)
-{
- // Add the children for this interface to the global QAccessibelHierachyManager.
- accessibleHierarchyManager()->registerChildren(interface);
-
- if (isTabWidget(interface)) {
- QList<QAElement> children = tabWidgetGetChildren(interface);
- const int childCount = children.count();
-
- CFMutableArrayRef array = 0;
- array = CFArrayCreateMutable(0, 0, &kCFTypeArrayCallBacks);
- for (int i = 0; i < childCount; ++i) {
- qt_mac_append_cf_uniq(array, children.at(i).element());
- }
-
- OSStatus err;
- err = SetEventParameter(event, kEventParamAccessibleAttributeValue, typeCFArrayRef, sizeof(array), &array);
- if (err != noErr)
- qWarning("Qt:Internal error (%s:%d)", __FILE__, __LINE__);
-
- return noErr;
- }
-
- const QList<QAElement> children = lookup(interface.children());
- const int childCount = children.count();
-
- OSStatus err = eventNotHandledErr;
- if (interface.isHIView())
- err = CallNextEventHandler(next_ref, event);
-
- CFMutableArrayRef array = 0;
- int arraySize = 0;
- if (err == noErr) {
- CFTypeRef obj = 0;
- err = GetEventParameter(event, kEventParamAccessibleAttributeValue, typeCFTypeRef, NULL , sizeof(obj), NULL, &obj);
- if (err == noErr && obj != 0) {
- array = (CFMutableArrayRef)obj;
- arraySize = CFArrayGetCount(array);
- }
- }
-
- if (array) {
- CFArrayRemoveAllValues(array);
- for (int i = 0; i < childCount; ++i) {
- qt_mac_append_cf_uniq(array, children.at(i).element());
- }
- } else {
- array = CFArrayCreateMutable(0, 0, &kCFTypeArrayCallBacks);
- for (int i = 0; i < childCount; ++i) {
- qt_mac_append_cf_uniq(array, children.at(i).element());
- }
-
- err = SetEventParameter(event, kEventParamAccessibleAttributeValue, typeCFArrayRef, sizeof(array), &array);
- if (err != noErr)
- qWarning("Qt:Internal error (%s:%d)", __FILE__, __LINE__);
- }
-
- return noErr;
-}
-
-/*
-
-*/
-static OSStatus handleParentAttribute(EventHandlerCallRef next_ref, EventRef event, const QAInterface &interface)
-{
- OSStatus err = eventNotHandledErr;
- if (interface.isHIView()) {
- err = CallNextEventHandler(next_ref, event);
- }
- if (err == noErr)
- return err;
-
- const QAInterface parentInterface = interface.navigate(QAccessible::Ancestor, 1);
- const QAElement parentElement = accessibleHierarchyManager()->lookup(parentInterface);
-
- if (parentElement.isValid() == false)
- return eventNotHandledErr;
-
- AXUIElementRef elementRef = parentElement.element();
- SetEventParameter(event, kEventParamAccessibleAttributeValue, typeCFTypeRef, sizeof(elementRef), &elementRef);
- return noErr;
-}
-#endif
-
-struct IsWindowTest
-{
- static inline bool test(const QAInterface &interface)
- {
- return (interface.role() == QAccessible::Window);
- }
-};
-
-struct IsWindowAndNotDrawerOrSheetTest
-{
- static inline bool test(const QAInterface &interface)
- {
- QWidget * const widget = qobject_cast<QWidget*>(interface.object());
- return (interface.role() == QAccessible::Window &&
- widget && widget->isWindow() &&
- !qt_mac_is_macdrawer(widget) &&
- !qt_mac_is_macsheet(widget));
- }
-};
-
-/*
- Navigates up the iterfaces ancestor hierachy until a QAccessibleInterface that
- passes the Test is found. If we reach a interface that is a HIView we stop the
- search and call AXUIElementCopyAttributeValue.
-*/
-template <typename TestType>
-OSStatus navigateAncestors(EventHandlerCallRef next_ref, EventRef event, const QAInterface &interface, CFStringRef attribute)
-{
- if (interface.isHIView())
- return CallNextEventHandler(next_ref, event);
-
- QAInterface current = interface;
- QAElement element;
- while (current.isValid()) {
- if (TestType::test(interface)) {
- element = accessibleHierarchyManager()->lookup(current);
- break;
- }
-
- // If we reach an InterfaceItem that is a HiView we can hand of the search to
- // the system event handler. This is the common case.
- if (current.isHIView()) {
- CFTypeRef value = 0;
- const QAElement currentElement = accessibleHierarchyManager()->lookup(current);
- AXError err = AXUIElementCopyAttributeValue(currentElement.element(), attribute, &value);
- AXUIElementRef newElement = (AXUIElementRef)value;
-
- if (err == noErr)
- element = QAElement(newElement);
-
- if (newElement != 0)
- CFRelease(newElement);
- break;
- }
-
- QAInterface next = current.parent();
- if (next.isValid() == false)
- break;
- if (next == current)
- break;
- current = next;
- }
-
- if (element.isValid() == false)
- return eventNotHandledErr;
-
-
- AXUIElementRef elementRef = element.element();
- SetEventParameter(event, kEventParamAccessibleAttributeValue, typeCFTypeRef,
- sizeof(elementRef), &elementRef);
- return noErr;
-}
-
-/*
- Returns the top-level window for an interface, which is the closest ancestor interface that
- has the Window role, but is not a sheet or a drawer.
-*/
-#ifndef QT_MAC_USE_COCOA
-static OSStatus handleWindowAttribute(EventHandlerCallRef next_ref, EventRef event, const QAInterface &interface)
-{
- return navigateAncestors<IsWindowAndNotDrawerOrSheetTest>(next_ref, event, interface, CFStringRef(QAXWindowAttribute));
-}
-
-/*
- Returns the top-level window for an interface, which is the closest ancestor interface that
- has the Window role. (Can also be a sheet or a drawer)
-*/
-static OSStatus handleTopLevelUIElementAttribute(EventHandlerCallRef next_ref, EventRef event, const QAInterface &interface)
-{
- return navigateAncestors<IsWindowTest>(next_ref, event, interface, CFStringRef(QAXTopLevelUIElementAttribute));
-}
-
-/*
- Returns the tab buttons for an interface.
-*/
-static OSStatus handleTabsAttribute(EventHandlerCallRef next_ref, EventRef event, QAInterface &interface)
-{
- Q_UNUSED(next_ref);
- if (isTabWidget(interface))
- return setAttributeValue(event, tabWidgetGetTabs(interface));
- else
- return setAttributeValue(event, tabBarGetTabs(interface));
-}
-
-static OSStatus handlePositionAttribute(EventHandlerCallRef, EventRef event, const QAInterface &interface)
-{
- QPoint qpoint(interface.rect().topLeft());
- HIPoint point;
- point.x = qpoint.x();
- point.y = qpoint.y();
- SetEventParameter(event, kEventParamAccessibleAttributeValue, typeHIPoint, sizeof(point), &point);
- return noErr;
-}
-
-static OSStatus handleSizeAttribute(EventHandlerCallRef, EventRef event, const QAInterface &interface)
-{
- QSize qSize(interface.rect().size());
- HISize size;
- size.width = qSize.width();
- size.height = qSize.height();
- SetEventParameter(event, kEventParamAccessibleAttributeValue, typeHISize, sizeof(size), &size);
- return noErr;
-}
-
-static OSStatus handleSubroleAttribute(EventHandlerCallRef, EventRef event, const QAInterface &interface)
-{
- const QCFString role = subrole(interface);
- CFStringRef rolestr = (CFStringRef)role;
- SetEventParameter(event, kEventParamAccessibleAttributeValue, typeCFTypeRef, sizeof(rolestr), &rolestr);
- return noErr;
-}
-
-static OSStatus handleOrientationAttribute(EventHandlerCallRef next_ref, EventRef event, const QAInterface &interface)
-{
- QObject *const object = interface.object();
- Qt::Orientation orientation;
- if (interface.role() == QAccessible::ScrollBar) {
- orientation = scrollBarOrientation(interface);
- } else if (QSplitterHandle * const splitter = qobject_cast<QSplitterHandle * const>(object)) {
- // Qt reports the layout orientation, but we want the splitter handle orientation.
- orientation = (splitter->orientation() == Qt::Horizontal) ? Qt::Vertical : Qt::Horizontal;
- } else {
- return CallNextEventHandler(next_ref, event);
- }
- const CFStringRef orientationString = (orientation == Qt::Vertical)
- ? CFStringRef(QAXVerticalOrientationValue) : CFStringRef(QAXHorizontalOrientationValue);
- SetEventParameter(event, kEventParamAccessibleAttributeValue, typeCFStringRef, sizeof(orientationString), &orientationString);
- return noErr;
-}
-
-/*
- Figures out the next or previous contents for a splitter.
-*/
-static OSStatus handleSplitterContentsAttribute(EventHandlerCallRef next_ref, EventRef event, const QAInterface &interface, QCFString nextOrPrev)
-{
- if (interface.isValid() == false || interface.role() != QAccessible::Grip)
- return eventNotHandledErr;
-
- const QAInterface parent = interface.parent();
- if (parent.isValid() == false)
- return CallNextEventHandler(next_ref, event);
-
- if (parent.role() != QAccessible::Splitter)
- return CallNextEventHandler(next_ref, event);
-
- const QSplitter * const splitter = qobject_cast<const QSplitter * const>(parent.object());
- if (splitter == 0)
- return CallNextEventHandler(next_ref, event);
-
- QWidget * const splitterHandle = qobject_cast<QWidget * const>(interface.object());
- const int splitterHandleIndex = splitter->indexOf(splitterHandle);
- const int widgetIndex = (nextOrPrev == QCFString(CFStringRef(QAXPreviousContentsAttribute))) ? splitterHandleIndex - 1 : splitterHandleIndex;
- const QAElement contentsElement = accessibleHierarchyManager()->lookup(splitter->widget(widgetIndex), 0);
- return setAttributeValue(event, QList<QAElement>() << contentsElement);
-}
-
-/*
- Creates a list of all splitter handles the splitter contains.
-*/
-static OSStatus handleSplittersAttribute(EventHandlerCallRef next_ref, EventRef event, QAInterface &interface)
-{
- const QSplitter * const splitter = qobject_cast<const QSplitter * const>(interface.object());
- if (splitter == 0)
- return CallNextEventHandler(next_ref, event);
-
- accessibleHierarchyManager()->registerChildren(interface);
-
- QList<QAElement> handles;
- const int visibleSplitterCount = splitter->count() -1; // skip first handle, it's always invisible.
- for (int i = 0; i < visibleSplitterCount; ++i)
- handles.append(accessibleHierarchyManager()->lookup(splitter->handle(i + 1), 0));
-
- return setAttributeValue(event, handles);
-}
-
-// This handler gets the scroll bars for a scroll area
-static OSStatus handleScrollBarAttribute(EventHandlerCallRef next_ref, EventRef event, QAInterface &scrollArea, Qt::Orientation orientation)
-{
- QAElement scrollBar = scrollAreaGetScrollBar(scrollArea, orientation);
- if (scrollBar.isValid() == false)
- return CallNextEventHandler(next_ref, event);
-
- AXUIElementRef elementRef = scrollBar.element();
- SetEventParameter(event, kEventParamAccessibleAttributeValue, typeCFTypeRef, sizeof(elementRef), &elementRef);
- return noErr;
-}
-
-// This handler gets the contents for a scroll area or tab widget.
-static OSStatus handleContentsAttribute(EventHandlerCallRef next_ref, EventRef event, QAInterface &interface)
-{
- const QCFString mac_role = macRole(interface);
-
- QAElement contents;
-
- if (mac_role == kAXTabGroupRole) {
- contents = tabWidgetGetContents(interface);
- } else {
- contents = scrollAreaGetContents(interface);
- if (contents.isValid() == false)
- return CallNextEventHandler(next_ref, event);
- }
-
- return setAttributeValue(event, QList<QAElement>() << contents);
-}
-
-static OSStatus handleRowsAttribute(EventHandlerCallRef, EventRef event, QAInterface &tableView)
-{
- QList<QAElement> rows = lookup(tableView.children());
-
- // kill the first row which is the horizontal header.
- rows.removeAt(0);
-
- return setAttributeValue(event, rows);
-}
-
-static OSStatus handleVisibleRowsAttribute(EventHandlerCallRef, EventRef event, QAInterface &tableView)
-{
- QList<QAElement> visibleRows;
-
- QList<QAInterface> rows = tableView.children();
- // kill the first row which is the horizontal header.
- rows.removeAt(0);
-
- foreach (const QAInterface &interface, rows)
- if ((interface.state() & QAccessible::Invisible) == false)
- visibleRows.append(accessibleHierarchyManager()->lookup(interface));
-
- return setAttributeValue(event, visibleRows);
-}
-
-static OSStatus handleSelectedRowsAttribute(EventHandlerCallRef, EventRef event, QAInterface &tableView)
-{
- QList<QAElement> selectedRows;
- foreach (const QAInterface &interface, tableView.children())
- if ((interface.state() & QAccessible::Selected))
- selectedRows.append(accessibleHierarchyManager()->lookup(interface));
-
- return setAttributeValue(event, selectedRows);
-}
-
-static OSStatus getNamedAttribute(EventHandlerCallRef next_ref, EventRef event, QAInterface &interface)
-{
- CFStringRef var;
- GetEventParameter(event, kEventParamAccessibleAttributeName, typeCFStringRef, 0,
- sizeof(var), 0, &var);
-
- if (CFStringCompare(var, CFStringRef(QAXChildrenAttribute), 0) == kCFCompareEqualTo) {
- return handleChildrenAttribute(next_ref, event, interface);
- } else if(CFStringCompare(var, CFStringRef(QAXTopLevelUIElementAttribute), 0) == kCFCompareEqualTo) {
- return handleTopLevelUIElementAttribute(next_ref, event, interface);
- } else if(CFStringCompare(var, CFStringRef(QAXWindowAttribute), 0) == kCFCompareEqualTo) {
- return handleWindowAttribute(next_ref, event, interface);
- } else if(CFStringCompare(var, CFStringRef(QAXParentAttribute), 0) == kCFCompareEqualTo) {
- return handleParentAttribute(next_ref, event, interface);
- } else if (CFStringCompare(var, CFStringRef(QAXPositionAttribute), 0) == kCFCompareEqualTo) {
- return handlePositionAttribute(next_ref, event, interface);
- } else if (CFStringCompare(var, CFStringRef(QAXSizeAttribute), 0) == kCFCompareEqualTo) {
- return handleSizeAttribute(next_ref, event, interface);
- } else if (CFStringCompare(var, CFStringRef(QAXRoleAttribute), 0) == kCFCompareEqualTo) {
- CFStringRef role = macRole(interface);
-// ###
-// QWidget * const widget = qobject_cast<QWidget *>(interface.object());
-// if (role == CFStringRef(QAXUnknownRole) && widget && widget->isWindow())
-// role = CFStringRef(QAXWindowRole);
-
- SetEventParameter(event, kEventParamAccessibleAttributeValue, typeCFStringRef,
- sizeof(role), &role);
-
- } else if (CFStringCompare(var, CFStringRef(QAXEnabledAttribute), 0) == kCFCompareEqualTo) {
- Boolean val = !((interface.state() & QAccessible::Unavailable))
- && !((interface.state() & QAccessible::Invisible));
- SetEventParameter(event, kEventParamAccessibleAttributeValue, typeBoolean,
- sizeof(val), &val);
- } else if (CFStringCompare(var, CFStringRef(QAXExpandedAttribute), 0) == kCFCompareEqualTo) {
- Boolean val = (interface.state() & QAccessible::Expanded);
- SetEventParameter(event, kEventParamAccessibleAttributeValue, typeBoolean,
- sizeof(val), &val);
- } else if (CFStringCompare(var, CFStringRef(QAXSelectedAttribute), 0) == kCFCompareEqualTo) {
- Boolean val = (interface.state() & QAccessible::Selection);
- SetEventParameter(event, kEventParamAccessibleAttributeValue, typeBoolean,
- sizeof(val), &val);
- } else if (CFStringCompare(var, CFStringRef(QAXFocusedAttribute), 0) == kCFCompareEqualTo) {
- Boolean val = (interface.state() & QAccessible::Focus);
- SetEventParameter(event, kEventParamAccessibleAttributeValue, typeBoolean,
- sizeof(val), &val);
- } else if (CFStringCompare(var, CFStringRef(QAXSelectedChildrenAttribute), 0) == kCFCompareEqualTo) {
- const int cc = interface.childCount();
- QList<QAElement> selected;
- for (int i = 1; i <= cc; ++i) {
- const QAInterface child_iface = interface.navigate(QAccessible::Child, i);
- if (child_iface.isValid() && child_iface.state() & QAccessible::Selected)
- selected.append(accessibleHierarchyManager()->lookup(child_iface));
- }
-
- return setAttributeValue(event, selected);
-
- } else if (CFStringCompare(var, CFStringRef(QAXCloseButtonAttribute), 0) == kCFCompareEqualTo) {
- if(interface.object() && interface.object()->isWidgetType()) {
- Boolean val = true; //do we want to add a WState for this?
- SetEventParameter(event, kEventParamAccessibleAttributeValue, typeBoolean,
- sizeof(val), &val);
- }
- } else if (CFStringCompare(var, CFStringRef(QAXZoomButtonAttribute), 0) == kCFCompareEqualTo) {
- if(interface.object() && interface.object()->isWidgetType()) {
- QWidget *widget = (QWidget*)interface.object();
- Boolean val = (widget->windowFlags() & Qt::WindowMaximizeButtonHint);
- SetEventParameter(event, kEventParamAccessibleAttributeValue, typeBoolean,
- sizeof(val), &val);
- }
- } else if (CFStringCompare(var, CFStringRef(QAXMinimizeButtonAttribute), 0) == kCFCompareEqualTo) {
- if(interface.object() && interface.object()->isWidgetType()) {
- QWidget *widget = (QWidget*)interface.object();
- Boolean val = (widget->windowFlags() & Qt::WindowMinimizeButtonHint);
- SetEventParameter(event, kEventParamAccessibleAttributeValue, typeBoolean,
- sizeof(val), &val);
- }
- } else if (CFStringCompare(var, CFStringRef(QAXToolbarButtonAttribute), 0) == kCFCompareEqualTo) {
- if(interface.object() && interface.object()->isWidgetType()) {
- QWidget *widget = (QWidget*)interface.object();
- Boolean val = qobject_cast<QMainWindow *>(widget) != 0;
- SetEventParameter(event, kEventParamAccessibleAttributeValue, typeBoolean,
- sizeof(val), &val);
- }
- } else if (CFStringCompare(var, CFStringRef(QAXGrowAreaAttribute), 0) == kCFCompareEqualTo) {
- if(interface.object() && interface.object()->isWidgetType()) {
- Boolean val = true; //do we want to add a WState for this?
- SetEventParameter(event, kEventParamAccessibleAttributeValue, typeBoolean,
- sizeof(val), &val);
- }
- } else if (CFStringCompare(var, CFStringRef(QAXMinimizedAttribute), 0) == kCFCompareEqualTo) {
- if (interface.object() && interface.object()->isWidgetType()) {
- QWidget *widget = (QWidget*)interface.object();
- Boolean val = (widget->windowState() & Qt::WindowMinimized);
- SetEventParameter(event, kEventParamAccessibleAttributeValue, typeBoolean,
- sizeof(val), &val);
- }
- } else if (CFStringCompare(var, CFStringRef(QAXSubroleAttribute), 0) == kCFCompareEqualTo) {
- return handleSubroleAttribute(next_ref, event, interface);
- } else if (CFStringCompare(var, CFStringRef(QAXRoleDescriptionAttribute), 0) == kCFCompareEqualTo) {
-#if !defined(QT_MAC_USE_COCOA)
- if (HICopyAccessibilityRoleDescription) {
- const CFStringRef roleDescription = HICopyAccessibilityRoleDescription(macRole(interface), 0);
- SetEventParameter(event, kEventParamAccessibleAttributeValue, typeCFStringRef,
- sizeof(roleDescription), &roleDescription);
- } else
-#endif
- {
- // Just use Qt::Description on 10.3
- handleStringAttribute(event, QAccessible::Description, interface);
- }
- } else if (CFStringCompare(var, CFStringRef(QAXTitleAttribute), 0) == kCFCompareEqualTo) {
- const QAccessible::Role role = interface.role();
- const QAccessible::Text text = (QAccessible::Text)textForRoleAndAttribute(role, var);
- handleStringAttribute(event, text, interface);
- } else if (CFStringCompare(var, CFStringRef(QAXValueAttribute), 0) == kCFCompareEqualTo) {
- const QAccessible::Role role = interface.role();
- const QAccessible::Text text = (QAccessible::Text)textForRoleAndAttribute(role, var);
- if (role == QAccessible::CheckBox || role == QAccessible::RadioButton) {
- int value = buttonValue(interface);
- SetEventParameter(event, kEventParamAccessibleAttributeValue, typeUInt32, sizeof(value), &value);
- } else {
- handleStringAttribute(event, text, interface);
- }
- } else if (CFStringCompare(var, CFStringRef(QAXDescriptionAttribute), 0) == kCFCompareEqualTo) {
- const QAccessible::Role role = interface.role();
- const QAccessible::Text text = (QAccessible::Text)textForRoleAndAttribute(role, var);
- handleStringAttribute(event, text, interface);
- } else if (CFStringCompare(var, CFStringRef(QAXLinkedUIElementsAttribute), 0) == kCFCompareEqualTo) {
- return CallNextEventHandler(next_ref, event);
- } else if (CFStringCompare(var, CFStringRef(QAXHelpAttribute), 0) == kCFCompareEqualTo) {
- const QAccessible::Role role = interface.role();
- const QAccessible::Text text = (QAccessible::Text)textForRoleAndAttribute(role, var);
- handleStringAttribute(event, text, interface);
- } else if (CFStringCompare(var, kAXTitleUIElementAttribute, 0) == kCFCompareEqualTo) {
- return CallNextEventHandler(next_ref, event);
- } else if (CFStringCompare(var, CFStringRef(QAXTabsAttribute), 0) == kCFCompareEqualTo) {
- return handleTabsAttribute(next_ref, event, interface);
- } else if (CFStringCompare(var, CFStringRef(QAXMinValueAttribute), 0) == kCFCompareEqualTo) {
- // tabs we first go to the tab bar which is child #2.
- QAInterface tabBarInterface = interface.childAt(2);
- return handleTabsAttribute(next_ref, event, tabBarInterface);
- } else if (CFStringCompare(var, CFStringRef(QAXMinValueAttribute), 0) == kCFCompareEqualTo) {
- if (interface.role() == QAccessible::RadioButton || interface.role() == QAccessible::CheckBox) {
- uint value = 0;
- SetEventParameter(event, kEventParamAccessibleAttributeValue, typeUInt32, sizeof(value), &value);
- } else {
- return CallNextEventHandler(next_ref, event);
- }
- } else if (CFStringCompare(var, CFStringRef(QAXMaxValueAttribute), 0) == kCFCompareEqualTo) {
- if (interface.role() == QAccessible::RadioButton || interface.role() == QAccessible::CheckBox) {
- uint value = 2;
- SetEventParameter(event, kEventParamAccessibleAttributeValue, typeUInt32, sizeof(value), &value);
- } else {
- return CallNextEventHandler(next_ref, event);
- }
- } else if (CFStringCompare(var, CFStringRef(QAXOrientationAttribute), 0) == kCFCompareEqualTo) {
- return handleOrientationAttribute(next_ref, event, interface);
- } else if (CFStringCompare(var, CFStringRef(QAXPreviousContentsAttribute), 0) == kCFCompareEqualTo) {
- return handleSplitterContentsAttribute(next_ref, event, interface, CFStringRef(QAXPreviousContentsAttribute));
- } else if (CFStringCompare(var, CFStringRef(QAXNextContentsAttribute), 0) == kCFCompareEqualTo) {
- return handleSplitterContentsAttribute(next_ref, event, interface, CFStringRef(QAXNextContentsAttribute));
- } else if (CFStringCompare(var, CFStringRef(QAXSplittersAttribute), 0) == kCFCompareEqualTo) {
- return handleSplittersAttribute(next_ref, event, interface);
- } else if (CFStringCompare(var, CFStringRef(QAXHorizontalScrollBarAttribute), 0) == kCFCompareEqualTo) {
- return handleScrollBarAttribute(next_ref, event, interface, Qt::Horizontal);
- } else if (CFStringCompare(var, CFStringRef(QAXVerticalScrollBarAttribute), 0) == kCFCompareEqualTo) {
- return handleScrollBarAttribute(next_ref, event, interface, Qt::Vertical);
- } else if (CFStringCompare(var, CFStringRef(QAXContentsAttribute), 0) == kCFCompareEqualTo) {
- return handleContentsAttribute(next_ref, event, interface);
- } else if (CFStringCompare(var, CFStringRef(QAXRowsAttribute), 0) == kCFCompareEqualTo) {
- return handleRowsAttribute(next_ref, event, interface);
- } else if (CFStringCompare(var, CFStringRef(QAXVisibleRowsAttribute), 0) == kCFCompareEqualTo) {
- return handleVisibleRowsAttribute(next_ref, event, interface);
- } else if (CFStringCompare(var, CFStringRef(QAXSelectedRowsAttribute), 0) == kCFCompareEqualTo) {
- return handleSelectedRowsAttribute(next_ref, event, interface);
- } else {
- return CallNextEventHandler(next_ref, event);
- }
- return noErr;
-}
-
-static OSStatus isNamedAttributeSettable(EventRef event, const QAInterface &interface)
-{
- CFStringRef var;
- GetEventParameter(event, kEventParamAccessibleAttributeName, typeCFStringRef, 0,
- sizeof(var), 0, &var);
- Boolean settable = false;
- if (CFStringCompare(var, CFStringRef(QAXFocusedAttribute), 0) == kCFCompareEqualTo) {
- settable = true;
- } else {
- for (int r = 0; text_bindings[r][0].qt != -1; r++) {
- if(interface.role() == (QAccessible::Role)text_bindings[r][0].qt) {
- for (int a = 1; text_bindings[r][a].qt != -1; a++) {
- if (CFStringCompare(var, CFStringRef(text_bindings[r][a].mac), 0) == kCFCompareEqualTo) {
- settable = text_bindings[r][a].settable;
- break;
- }
- }
- }
- }
- }
- SetEventParameter(event, kEventParamAccessibleAttributeSettable, typeBoolean,
- sizeof(settable), &settable);
- return noErr;
-}
-
-static OSStatus getChildAtPoint(EventHandlerCallRef next_ref, EventRef event, QAInterface &interface)
-{
- Q_UNUSED(next_ref);
- if (interface.isValid() == false)
- return eventNotHandledErr;
-
- // Add the children for this interface to the global QAccessibelHierachyManager.
- accessibleHierarchyManager()->registerChildren(interface);
-
- Point where;
- GetEventParameter(event, kEventParamMouseLocation, typeQDPoint, 0, sizeof(where), 0, &where);
- const QAInterface childInterface = interface.childAt(where.h, where.v);
-
- if (childInterface.isValid() == false || childInterface == interface)
- return eventNotHandledErr;
-
- const QAElement element = accessibleHierarchyManager()->lookup(childInterface);
- if (element.isValid() == false)
- return eventNotHandledErr;
-
- AXUIElementRef elementRef = element.element();
- CFRetain(elementRef);
- SetEventParameter(event, kEventParamAccessibleChild, typeCFTypeRef,
- sizeof(elementRef), &elementRef);
-
- return noErr;
-}
-
-/*
- Returns a list of actions the given interface supports.
- Currently implemented by getting the interface role and deciding based on that.
-*/
-static QList<QAccessible::Action> supportedPredefinedActions(const QAInterface &interface)
-{
- QList<QAccessible::Action> actions;
- switch (interface.role()) {
- default:
- // Most things can be pressed.
- actions.append(QAccessible::Press);
- break;
- }
-
- return actions;
-}
-
-/*
- Translates a predefined QAccessible::Action to a Mac action constant.
- Returns an empty string if the Qt Action has no mac equivalent.
-*/
-static QCFString translateAction(const QAccessible::Action action)
-{
- switch (action) {
- case QAccessible::Press:
- return CFStringRef(QAXPressAction);
- break;
- case QAccessible::Increase:
- return CFStringRef(QAXIncrementAction);
- break;
- case QAccessible::Decrease:
- return CFStringRef(QAXDecrementAction);
- break;
- case QAccessible::Accept:
- return CFStringRef(QAXConfirmAction);
- break;
- case QAccessible::Select:
- return CFStringRef(QAXPickAction);
- break;
- case QAccessible::Cancel:
- return CFStringRef(QAXCancelAction);
- break;
- default:
- return QCFString();
- break;
- }
-}
-
-/*
- Translates between a Mac action constant and a QAccessible::Action.
- Returns QAccessible::Default action if there is no Qt predefined equivalent.
-*/
-static QAccessible::Action translateAction(const CFStringRef actionName)
-{
- if(CFStringCompare(actionName, CFStringRef(QAXPressAction), 0) == kCFCompareEqualTo) {
- return QAccessible::Press;
- } else if(CFStringCompare(actionName, CFStringRef(QAXIncrementAction), 0) == kCFCompareEqualTo) {
- return QAccessible::Increase;
- } else if(CFStringCompare(actionName, CFStringRef(QAXDecrementAction), 0) == kCFCompareEqualTo) {
- return QAccessible::Decrease;
- } else if(CFStringCompare(actionName, CFStringRef(QAXConfirmAction), 0) == kCFCompareEqualTo) {
- return QAccessible::Accept;
- } else if(CFStringCompare(actionName, CFStringRef(QAXPickAction), 0) == kCFCompareEqualTo) {
- return QAccessible::Select;
- } else if(CFStringCompare(actionName, CFStringRef(QAXCancelAction), 0) == kCFCompareEqualTo) {
- return QAccessible::Cancel;
- } else {
- return QAccessible::DefaultAction;
- }
-}
-#endif // QT_MAC_USE_COCOA
-
-/*
- Copies the translated names all supported actions for an interface into the kEventParamAccessibleActionNames
- event parameter.
-*/
-#ifndef QT_MAC_USE_COCOA
-static OSStatus getAllActionNames(EventHandlerCallRef next_ref, EventRef event, const QAInterface &interface)
-{
- Q_UNUSED(next_ref);
-
- CFMutableArrayRef actions = 0;
- GetEventParameter(event, kEventParamAccessibleActionNames, typeCFMutableArrayRef, 0,
- sizeof(actions), 0, &actions);
-
- // Add supported predefined actions.
- const QList<QAccessible::Action> predefinedActions = supportedPredefinedActions(interface);
- for (int i = 0; i < predefinedActions.count(); ++i) {
- const QCFString action = translateAction(predefinedActions.at(i));
- if (action != QCFString())
- qt_mac_append_cf_uniq(actions, action);
- }
-
- // Add user actions
- const int actionCount = interface.userActionCount();
- for (int i = 0; i < actionCount; ++i) {
- const QString actionName = interface.actionText(i, QAccessible::Name);
- qt_mac_append_cf_uniq(actions, QCFString::toCFStringRef(actionName));
- }
-
- return noErr;
-}
-#endif
-
-/*
- Handles the perforNamedAction event.
-*/
-#ifndef QT_MAC_USE_COCOA
-static OSStatus performNamedAction(EventHandlerCallRef next_ref, EventRef event, const QAInterface& interface)
-{
- Q_UNUSED(next_ref);
-
- CFStringRef act;
- GetEventParameter(event, kEventParamAccessibleActionName, typeCFStringRef, 0,
- sizeof(act), 0, &act);
-
- const QAccessible::Action action = translateAction(act);
-
- // Perform built-in action
- if (action != QAccessible::DefaultAction) {
- interface.doAction(action, QVariantList());
- return noErr;
- }
-
- // Search for user-defined actions and perform it if found.
- const int actCount = interface.userActionCount();
- const QString qAct = QCFString::toQString(act);
- for(int i = 0; i < actCount; i++) {
- if(interface.actionText(i, QAccessible::Name) == qAct) {
- interface.doAction(i, QVariantList());
- break;
- }
- }
- return noErr;
-}
-
-static OSStatus setNamedAttribute(EventHandlerCallRef next_ref, EventRef event, const QAInterface &interface)
-{
- Q_UNUSED(next_ref);
- Q_UNUSED(event);
-
- CFStringRef var;
- GetEventParameter(event, kEventParamAccessibleAttributeName, typeCFStringRef, 0,
- sizeof(var), 0, &var);
- if(CFStringCompare(var, CFStringRef(QAXFocusedAttribute), 0) == kCFCompareEqualTo) {
- CFTypeRef val;
- if(GetEventParameter(event, kEventParamAccessibleAttributeValue, typeCFTypeRef, 0,
- sizeof(val), 0, &val) == noErr) {
- if(CFGetTypeID(val) == CFBooleanGetTypeID() &&
- CFEqual(static_cast<CFBooleanRef>(val), kCFBooleanTrue)) {
- interface.doAction(QAccessible::SetFocus);
- }
- }
- } else {
- bool found = false;
- for(int r = 0; text_bindings[r][0].qt != -1; r++) {
- if(interface.role() == (QAccessible::Role)text_bindings[r][0].qt) {
- for(int a = 1; text_bindings[r][a].qt != -1; a++) {
- if(CFStringCompare(var, CFStringRef(text_bindings[r][a].mac), 0) == kCFCompareEqualTo) {
- if(!text_bindings[r][a].settable) {
- } else {
- CFTypeRef val;
- if(GetEventParameter(event, kEventParamAccessibleAttributeValue, typeCFTypeRef, 0,
- sizeof(val), 0, &val) == noErr) {
- if(CFGetTypeID(val) == CFStringGetTypeID())
- interface.setText((QAccessible::Text)text_bindings[r][a].qt,
- QCFString::toQString(static_cast<CFStringRef>(val)));
-
- }
- }
- found = true;
- break;
- }
- }
- break;
- }
- }
- }
- return noErr;
-}
-
-/*
- This is the main accessibility event handler.
-*/
-static OSStatus accessibilityEventHandler(EventHandlerCallRef next_ref, EventRef event, void *data)
-{
- Q_UNUSED(data)
-
- // Return if this event is not a AccessibleGetNamedAttribute event.
- const UInt32 eclass = GetEventClass(event);
- if (eclass != kEventClassAccessibility)
- return eventNotHandledErr;
-
- // Get the AXUIElementRef and QAInterface pointer
- AXUIElementRef element = 0;
- GetEventParameter(event, kEventParamAccessibleObject, typeCFTypeRef, 0, sizeof(element), 0, &element);
- QAInterface interface = accessibleHierarchyManager()->lookup(element);
- if (interface.isValid() == false)
- return eventNotHandledErr;
-
- const UInt32 ekind = GetEventKind(event);
- OSStatus status = noErr;
- switch (ekind) {
- case kEventAccessibleGetAllAttributeNames:
- status = getAllAttributeNames(event, interface, next_ref);
- break;
- case kEventAccessibleGetNamedAttribute:
- status = getNamedAttribute(next_ref, event, interface);
- break;
- case kEventAccessibleIsNamedAttributeSettable:
- status = isNamedAttributeSettable(event, interface);
- break;
- case kEventAccessibleGetChildAtPoint:
- status = getChildAtPoint(next_ref, event, interface);
- break;
- case kEventAccessibleGetAllActionNames:
- status = getAllActionNames(next_ref, event, interface);
- break;
- case kEventAccessibleGetFocusedChild:
- status = CallNextEventHandler(next_ref, event);
- break;
- case kEventAccessibleSetNamedAttribute:
- status = setNamedAttribute(next_ref, event, interface);
- break;
- case kEventAccessiblePerformNamedAction:
- status = performNamedAction(next_ref, event, interface);
- break;
- default:
- status = CallNextEventHandler(next_ref, event);
- break;
- };
- return status;
-}
-#endif
-
-void QAccessible::initialize()
-{
-#ifndef QT_MAC_USE_COCOA
- registerQtAccessibilityHIObjectSubclass();
- installApplicationEventhandler();
-#endif
-}
-
-// Sets thre root object for the application
-void QAccessible::setRootObject(QObject *object)
-{
- // Call installed root object handler if we have one
- if (rootObjectHandler) {
- rootObjectHandler(object);
- return;
- }
-
- rootObject = object;
-}
-
-void QAccessible::cleanup()
-{
- accessibleHierarchyManager()->reset();
-#ifndef QT_MAC_USE_COCOA
- removeEventhandler(applicationEventHandlerUPP);
- removeEventhandler(objectCreateEventHandlerUPP);
- removeEventhandler(accessibilityEventHandlerUPP);
-#endif
-}
-
-void QAccessible::updateAccessibility(QObject *object, int child, Event reason)
-{
- // Call installed update handler if we have one.
- if (updateHandler) {
- updateHandler(object, child, reason);
- return;
- }
-
-#ifndef QT_MAC_USE_COCOA
- // Return if the mac accessibility is not enabled.
- if(!AXAPIEnabled())
- return;
-
- // Work around crash, disable accessiblity for focus frames.
- if (qstrcmp(object->metaObject()->className(), "QFocusFrame") == 0)
- return;
-
-// qDebug() << "updateAccessibility" << object << child << hex << reason;
-
- if (reason == ObjectShow) {
- QAInterface interface = QAInterface(QAccessible::queryAccessibleInterface(object), child);
- accessibleHierarchyManager()->registerInterface(interface);
- }
-
- const QAElement element = accessibleHierarchyManager()->lookup(object, child);
- if (element.isValid() == false)
- return;
-
-
- CFStringRef notification = 0;
- if(object && object->isWidgetType() && reason == ObjectCreated) {
- notification = CFStringRef(QAXWindowCreatedNotification);
- } else if(reason == ValueChanged) {
- notification = CFStringRef(QAXValueChangedNotification);
- } else if(reason == MenuStart) {
- notification = CFStringRef(QAXMenuOpenedNotification);
- } else if(reason == MenuEnd) {
- notification = CFStringRef(QAXMenuClosedNotification);
- } else if(reason == LocationChanged) {
- notification = CFStringRef(QAXWindowMovedNotification);
- } else if(reason == ObjectShow || reason == ObjectHide ) {
- // When a widget is deleted we get a ObjectHide before the destroyed(QObject *)
- // signal is emitted (which makes sense). However, at this point we are in the
- // middle of the QWidget destructor which means that we have to be careful when
- // using the widget pointer. Since we can't control what the accessibilty interfaces
- // does when navigate() is called below we ignore the hide update in this case.
- // (the widget will be deleted soon anyway.)
- extern QWidgetPrivate * qt_widget_private(QWidget *);
- if (QWidget *widget = qobject_cast<QWidget*>(object)) {
- if (qt_widget_private(widget)->data.in_destructor)
- return;
-
- // Check widget parent as well, special case for preventing crash
- // when the viewport() of an abstract scroll area is hidden when
- // the QWidget destructor hides all its children.
- QWidget *parentWidget = widget->parentWidget();
- if (parentWidget && qt_widget_private(parentWidget)->data.in_destructor)
- return;
- }
-
- // There is no equivalent Mac notification for ObjectShow/Hide, so we call HIObjectSetAccessibilityIgnored
- // and isItInteresting which will mark the HIObject accociated with the element as ignored if the
- // QAccessible::Invisible state bit is set.
- QAInterface interface = accessibleHierarchyManager()->lookup(element);
- if (interface.isValid()) {
- HIObjectSetAccessibilityIgnored(element.object(), !isItInteresting(interface));
- }
-
- // If the interface manages its own children, also check if we should ignore those.
- if (isItemView(interface) == false && managesChildren(interface)) {
- for (int i = 1; i <= interface.childCount(); ++i) {
- QAInterface childInterface = interface.navigate(QAccessible::Child, i);
- if (childInterface.isValid() && childInterface.isHIView() == false) {
- const QAElement element = accessibleHierarchyManager()->lookup(childInterface);
- if (element.isValid()) {
- HIObjectSetAccessibilityIgnored(element.object(), !isItInteresting(childInterface));
- }
- }
- }
- }
-
- } else if(reason == Focus) {
- if(object && object->isWidgetType()) {
- QWidget *w = static_cast<QWidget*>(object);
- if(w->isWindow())
- notification = CFStringRef(QAXFocusedWindowChangedNotification);
- else
- notification = CFStringRef(QAXFocusedUIElementChangedNotification);
- }
- }
-
- if (!notification)
- return;
-
- AXNotificationHIObjectNotify(notification, element.object(), element.id());
-#endif
-}
-
-QT_END_NAMESPACE
-
-#endif // QT_NO_ACCESSIBILITY
diff --git a/src/gui/accessible/qaccessible_mac_carbon.cpp b/src/gui/accessible/qaccessible_mac_carbon.cpp
deleted file mode 100644
index 32a242f274..0000000000
--- a/src/gui/accessible/qaccessible_mac_carbon.cpp
+++ /dev/null
@@ -1,119 +0,0 @@
-/****************************************************************************
-**
-** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies).
-** All rights reserved.
-** Contact: Nokia Corporation (qt-info@nokia.com)
-**
-** This file is part of the QtGui module of the Qt Toolkit.
-**
-** $QT_BEGIN_LICENSE:LGPL$
-** GNU Lesser General Public License Usage
-** This file may be used under the terms of the GNU Lesser General Public
-** License version 2.1 as published by the Free Software Foundation and
-** appearing in the file LICENSE.LGPL included in the packaging of this
-** file. Please review the following information to ensure the GNU Lesser
-** General Public License version 2.1 requirements will be met:
-** http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
-**
-** In addition, as a special exception, Nokia gives you certain additional
-** rights. These rights are described in the Nokia Qt LGPL Exception
-** version 1.1, included in the file LGPL_EXCEPTION.txt in this package.
-**
-** GNU General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU General
-** Public License version 3.0 as published by the Free Software Foundation
-** and appearing in the file LICENSE.GPL included in the packaging of this
-** file. Please review the following information to ensure the GNU General
-** Public License version 3.0 requirements will be met:
-** http://www.gnu.org/copyleft/gpl.html.
-**
-** Other Usage
-** Alternatively, this file may be used in accordance with the terms and
-** conditions contained in a signed written agreement between you and Nokia.
-**
-**
-**
-**
-**
-** $QT_END_LICENSE$
-**
-****************************************************************************/
-
-static OSStatus applicationEventHandler(EventHandlerCallRef next_ref, EventRef event, void *data);
-static EventHandlerUPP applicationEventHandlerUPP = 0;
-static EventTypeSpec application_events[] = {
- { kEventClassAccessibility, kEventAccessibleGetChildAtPoint },
- { kEventClassAccessibility, kEventAccessibleGetNamedAttribute }
-};
-
-static CFStringRef kObjectQtAccessibility = CFSTR("com.trolltech.qt.accessibility");
-static EventHandlerUPP objectCreateEventHandlerUPP = 0;
-static EventTypeSpec objectCreateEvents[] = {
- { kEventClassHIObject, kEventHIObjectConstruct },
- { kEventClassHIObject, kEventHIObjectInitialize },
- { kEventClassHIObject, kEventHIObjectDestruct },
- { kEventClassHIObject, kEventHIObjectPrintDebugInfo }
-};
-
-static OSStatus accessibilityEventHandler(EventHandlerCallRef next_ref, EventRef event, void *data);
-static EventHandlerUPP accessibilityEventHandlerUPP = 0;
-static EventTypeSpec accessibilityEvents[] = {
- { kEventClassAccessibility, kEventAccessibleGetChildAtPoint },
- { kEventClassAccessibility, kEventAccessibleGetFocusedChild },
- { kEventClassAccessibility, kEventAccessibleGetAllAttributeNames },
- { kEventClassAccessibility, kEventAccessibleGetNamedAttribute },
- { kEventClassAccessibility, kEventAccessibleSetNamedAttribute },
- { kEventClassAccessibility, kEventAccessibleIsNamedAttributeSettable },
- { kEventClassAccessibility, kEventAccessibleGetAllActionNames },
- { kEventClassAccessibility, kEventAccessiblePerformNamedAction },
- { kEventClassAccessibility, kEventAccessibleGetNamedActionDescription }
-};
-
-static void installAcessibilityEventHandler(HIObjectRef hiObject)
-{
- if (!accessibilityEventHandlerUPP)
- accessibilityEventHandlerUPP = NewEventHandlerUPP(accessibilityEventHandler);
-
- InstallHIObjectEventHandler(hiObject, accessibilityEventHandlerUPP,
- GetEventTypeCount(accessibilityEvents),
- accessibilityEvents, 0, 0);
-}
-
-static OSStatus objectCreateEventHandler(EventHandlerCallRef next_ref, EventRef event, void *data)
-{
- Q_UNUSED(data)
- Q_UNUSED(event)
- Q_UNUSED(next_ref)
- return noErr;
-}
-
-static void registerQtAccessibilityHIObjectSubclass()
-{
- if (!objectCreateEventHandlerUPP)
- objectCreateEventHandlerUPP = NewEventHandlerUPP(objectCreateEventHandler);
- OSStatus err = HIObjectRegisterSubclass(kObjectQtAccessibility, 0, 0, objectCreateEventHandlerUPP,
- GetEventTypeCount(objectCreateEvents), objectCreateEvents, 0, 0);
- if (err && err != hiObjectClassExistsErr)
- qWarning("qaccessible_mac internal error: Could not register accessibility HIObject subclass");
-}
-
-static void installApplicationEventhandler()
-{
- if (!applicationEventHandlerUPP)
- applicationEventHandlerUPP = NewEventHandlerUPP(applicationEventHandler);
-
- OSStatus err = InstallApplicationEventHandler(applicationEventHandlerUPP,
- GetEventTypeCount(application_events), application_events,
- 0, 0);
-
- if (err && err != eventHandlerAlreadyInstalledErr)
- qWarning("qaccessible_mac internal error: Could not install application accessibility event handler");
-}
-
-static void removeEventhandler(EventHandlerUPP eventHandler)
-{
- if (eventHandler) {
- DisposeEventHandlerUPP(eventHandler);
- eventHandler = 0;
- }
-}
diff --git a/src/gui/accessible/qaccessible_mac_cocoa.mm b/src/gui/accessible/qaccessible_mac_cocoa.mm
deleted file mode 100644
index 461b61aacf..0000000000
--- a/src/gui/accessible/qaccessible_mac_cocoa.mm
+++ /dev/null
@@ -1,239 +0,0 @@
-/****************************************************************************
-**
-** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies).
-** All rights reserved.
-** Contact: Nokia Corporation (qt-info@nokia.com)
-**
-** This file is part of the QtGui module of the Qt Toolkit.
-**
-** $QT_BEGIN_LICENSE:LGPL$
-** GNU Lesser General Public License Usage
-** This file may be used under the terms of the GNU Lesser General Public
-** License version 2.1 as published by the Free Software Foundation and
-** appearing in the file LICENSE.LGPL included in the packaging of this
-** file. Please review the following information to ensure the GNU Lesser
-** General Public License version 2.1 requirements will be met:
-** http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
-**
-** In addition, as a special exception, Nokia gives you certain additional
-** rights. These rights are described in the Nokia Qt LGPL Exception
-** version 1.1, included in the file LGPL_EXCEPTION.txt in this package.
-**
-** GNU General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU General
-** Public License version 3.0 as published by the Free Software Foundation
-** and appearing in the file LICENSE.GPL included in the packaging of this
-** file. Please review the following information to ensure the GNU General
-** Public License version 3.0 requirements will be met:
-** http://www.gnu.org/copyleft/gpl.html.
-**
-** Other Usage
-** Alternatively, this file may be used in accordance with the terms and
-** conditions contained in a signed written agreement between you and Nokia.
-**
-**
-**
-**
-**
-** $QT_END_LICENSE$
-**
-****************************************************************************/
-
-
-#include "qaccessible.h"
-#include "qaccessible_mac_p.h"
-#include "qdebug.h"
-#include "qtabwidget.h"
-
-#include <private/qt_mac_p.h>
-#include <private/qcocoaview_mac_p.h>
-#include <private/qwidget_p.h>
-
-
-#ifndef QT_NO_ACCESSIBILITY
-
-#ifdef QT_MAC_USE_COCOA
-
-QT_BEGIN_NAMESPACE
-
-//#define MAC_ACCESSIBILTY_DEVELOPER_MODE
-
-#ifndef QT_NO_DEBUG_STREAM
-#ifdef MAC_ACCESSIBILTY_DEVELOPER_MODE
-#define MAC_ACCESSIBILTY_DEBUG QT_PREPEND_NAMESPACE(qDebug)
-#else
-#define MAC_ACCESSIBILTY_DEBUG if (0) QT_PREPEND_NAMESPACE(qDebug)
-#endif
-#else
-#define MAC_ACCESSIBILTY_DEBUG if (0) QT_PREPEND_NAMESPACE(QNoDebug)
-#endif
-
-typedef QMap<QAccessible::Role, NSString *> QMacAccessibiltyRoleMap;
-Q_GLOBAL_STATIC(QMacAccessibiltyRoleMap, qMacAccessibiltyRoleMap);
-
-static QAInterface interfaceForView(QT_MANGLE_NAMESPACE(QCocoaView) *view)
-{
- return QAInterface(QAccessible::queryAccessibleInterface([view qt_qwidget]));
-}
-
-/*
- Set up mappings from Qt accessibilty roles to Mac accessibilty roles.
-*/
-static void populateRoleMap()
-{
- QMacAccessibiltyRoleMap &roleMap = *qMacAccessibiltyRoleMap();
- roleMap[QAccessible::MenuItem] = NSAccessibilityMenuItemRole;
- roleMap[QAccessible::MenuBar] = NSAccessibilityMenuBarRole;
- roleMap[QAccessible::ScrollBar] = NSAccessibilityScrollBarRole;
- roleMap[QAccessible::Grip] = NSAccessibilityGrowAreaRole;
- roleMap[QAccessible::Window] = NSAccessibilityWindowRole;
- roleMap[QAccessible::Dialog] = NSAccessibilityWindowRole;
- roleMap[QAccessible::AlertMessage] = NSAccessibilityWindowRole;
- roleMap[QAccessible::ToolTip] = NSAccessibilityWindowRole;
- roleMap[QAccessible::HelpBalloon] = NSAccessibilityWindowRole;
- roleMap[QAccessible::PopupMenu] = NSAccessibilityMenuRole;
- roleMap[QAccessible::Application] = NSAccessibilityApplicationRole;
- roleMap[QAccessible::Pane] = NSAccessibilityGroupRole;
- roleMap[QAccessible::Grouping] = NSAccessibilityGroupRole;
- roleMap[QAccessible::Separator] = NSAccessibilitySplitterRole;
- roleMap[QAccessible::ToolBar] = NSAccessibilityToolbarRole;
- roleMap[QAccessible::PageTab] = NSAccessibilityRadioButtonRole;
- roleMap[QAccessible::ButtonMenu] = NSAccessibilityMenuButtonRole;
- roleMap[QAccessible::ButtonDropDown] = NSAccessibilityPopUpButtonRole;
- roleMap[QAccessible::SpinBox] = NSAccessibilityIncrementorRole;
- roleMap[QAccessible::Slider] = NSAccessibilitySliderRole;
- roleMap[QAccessible::ProgressBar] = NSAccessibilityProgressIndicatorRole;
- roleMap[QAccessible::ComboBox] = NSAccessibilityPopUpButtonRole;
- roleMap[QAccessible::RadioButton] = NSAccessibilityRadioButtonRole;
- roleMap[QAccessible::CheckBox] = NSAccessibilityCheckBoxRole;
- roleMap[QAccessible::StaticText] = NSAccessibilityStaticTextRole;
- roleMap[QAccessible::Table] = NSAccessibilityTableRole;
- roleMap[QAccessible::StatusBar] = NSAccessibilityStaticTextRole;
- roleMap[QAccessible::Column] = NSAccessibilityColumnRole;
- roleMap[QAccessible::ColumnHeader] = NSAccessibilityColumnRole;
- roleMap[QAccessible::Row] = NSAccessibilityRowRole;
- roleMap[QAccessible::RowHeader] = NSAccessibilityRowRole;
- roleMap[QAccessible::Cell] = NSAccessibilityTextFieldRole;
- roleMap[QAccessible::PushButton] = NSAccessibilityButtonRole;
- roleMap[QAccessible::EditableText] = NSAccessibilityTextFieldRole;
- roleMap[QAccessible::Link] = NSAccessibilityTextFieldRole;
- roleMap[QAccessible::Indicator] = NSAccessibilityValueIndicatorRole;
- roleMap[QAccessible::Splitter] = NSAccessibilitySplitGroupRole;
- roleMap[QAccessible::List] = NSAccessibilityListRole;
- roleMap[QAccessible::ListItem] = NSAccessibilityStaticTextRole;
- roleMap[QAccessible::Cell] = NSAccessibilityStaticTextRole;
-}
-
-/*
- Returns a Mac accessibility role for the given interface, or
- NSAccessibilityUnknownRole if no role mapping is found.
-*/
-static NSString *macRoleForInterface(QAInterface interface)
-{
- const QAccessible::Role qtRole = interface.role();
- QMacAccessibiltyRoleMap &roleMap = *qMacAccessibiltyRoleMap();
-
- if (roleMap.isEmpty())
- populateRoleMap();
-
- MAC_ACCESSIBILTY_DEBUG() << "role for" << interface.object() << "interface role" << hex << qtRole;
-
- if (roleMap.contains(qtRole)) {
- MAC_ACCESSIBILTY_DEBUG() << "return" << roleMap[qtRole];
- return roleMap[qtRole];
- }
-
- MAC_ACCESSIBILTY_DEBUG() << "return NSAccessibilityUnknownRole";
- return NSAccessibilityUnknownRole;
-}
-
-/*
- Is the interface a QTabBar embedded in a QTabWidget?
- (as opposed to a stand-alone tab bar)
-*/
-static bool isEmbeddedTabBar(const QAInterface &interface)
-{
- QObject *object = interface.object();
- if (interface.role() == QAccessible::PageTabList && object)
- return (qobject_cast<QTabWidget *>(object->parent()));
-
- return false;
-}
-
-static bool isInterfaceIgnored(QAInterface interface)
-{
- // Mac accessibility does not have an attribute that corresponds to the
- // Invisible/Offscreen state. Use the ignore facility to disable them.
- const QAccessible::State state = interface.state();
- if (state & QAccessible::Invisible ||
- state & QAccessible::Offscreen )
- return false;
-
- // Hide QTabBars that has a QTabWidget parent (the QTabWidget handles the accessibility)
- if (isEmbeddedTabBar(interface))
- return false;
-
- if (QObject * const object = interface.object()) {
- const QString className = QLatin1String(object->metaObject()->className());
-
- // Prevent VoiceOver from focusing on tool tips by ignoring those
- // interfaces. Shifting VoiceOver focus to the tool tip is confusing
- // and the contents of the tool tip is avalible through the description
- // attribute anyway.
- if (className == QLatin1String("QTipLabel"))
- return false;
- }
-
- // Hide interfaces with an unknown role. When developing it's often useful to disable
- // this check to see all interfaces in the hierarchy.
-#ifndef MAC_ACCESSIBILTY_DEVELOPER_MODE
- return [macRoleForInterface(interface) isEqualToString: NSAccessibilityUnknownRole];
-#else
- return NO;
-#endif
-}
-
-QT_END_NAMESPACE
-
-@implementation QT_MANGLE_NAMESPACE(QCocoaView) (Accessibility)
-
-- (BOOL)accessibilityIsIgnored
-{
- QT_PREPEND_NAMESPACE(QAInterface) interface = QT_PREPEND_NAMESPACE(interfaceForView)(self);
- return isInterfaceIgnored(interface);
-}
-
-- (NSArray *)accessibilityAttributeNames
-{
- QT_PREPEND_NAMESPACE(QAInterface) interface = QT_PREPEND_NAMESPACE(interfaceForView)(self);
-
- static NSArray *attributes = nil;
- if (attributes == nil) {
- attributes = [super accessibilityAttributeNames];
-
- }
- return attributes;
-}
-
-- (id)accessibilityAttributeValue:(NSString *)attribute
-{
- MAC_ACCESSIBILTY_DEBUG() << "accessibilityAttributeValue" << self <<
- QT_PREPEND_NAMESPACE(QCFString)::toQString(reinterpret_cast<CFStringRef>(attribute));
-
- QT_PREPEND_NAMESPACE(QAInterface) interface = QT_PREPEND_NAMESPACE(interfaceForView)(self);
-
- // Switch on the attribute name and call the appropriate handler function.
- // Pass the call on to the NSView class for attributes we don't handle.
- if ([attribute isEqualToString:@"AXRole"]) {
- return macRoleForInterface(interface);
- } else {
- return [super accessibilityAttributeValue:attribute];
- }
-}
-
-@end
-
-#endif // QT_MAC_USE_COCOA
-
-#endif // QT_NO_ACCESSIBILITY
-
diff --git a/src/gui/accessible/qaccessible_mac_p.h b/src/gui/accessible/qaccessible_mac_p.h
deleted file mode 100644
index 9b7d25a334..0000000000
--- a/src/gui/accessible/qaccessible_mac_p.h
+++ /dev/null
@@ -1,479 +0,0 @@
-/****************************************************************************
-**
-** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies).
-** All rights reserved.
-** Contact: Nokia Corporation (qt-info@nokia.com)
-**
-** This file is part of the QtGui module of the Qt Toolkit.
-**
-** $QT_BEGIN_LICENSE:LGPL$
-** GNU Lesser General Public License Usage
-** This file may be used under the terms of the GNU Lesser General Public
-** License version 2.1 as published by the Free Software Foundation and
-** appearing in the file LICENSE.LGPL included in the packaging of this
-** file. Please review the following information to ensure the GNU Lesser
-** General Public License version 2.1 requirements will be met:
-** http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
-**
-** In addition, as a special exception, Nokia gives you certain additional
-** rights. These rights are described in the Nokia Qt LGPL Exception
-** version 1.1, included in the file LGPL_EXCEPTION.txt in this package.
-**
-** GNU General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU General
-** Public License version 3.0 as published by the Free Software Foundation
-** and appearing in the file LICENSE.GPL included in the packaging of this
-** file. Please review the following information to ensure the GNU General
-** Public License version 3.0 requirements will be met:
-** http://www.gnu.org/copyleft/gpl.html.
-**
-** Other Usage
-** Alternatively, this file may be used in accordance with the terms and
-** conditions contained in a signed written agreement between you and Nokia.
-**
-**
-**
-**
-**
-** $QT_END_LICENSE$
-**
-****************************************************************************/
-
-#ifndef QACCESSIBLE_MAC_P_H
-#define QACCESSIBLE_MAC_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>
-#include <private/qt_mac_p.h>
-#include <qaccessible.h>
-#include <qwidget.h>
-#include <qdebug.h>
-
-//#define Q_ACCESSIBLE_MAC_DEBUG
-
-QT_BEGIN_NAMESPACE
-
-/*
- QAccessibleInterfaceWrapper wraps QAccessibleInterface and adds
- a ref count. QAccessibleInterfaceWrapper is a "by-value" class.
-*/
-class Q_AUTOTEST_EXPORT QAccessibleInterfaceWrapper
-{
-public:
- QAccessibleInterfaceWrapper()
- : interface(0), childrenIsRegistered(new bool(false)), refCount(new int(1)) { }
-
- QAccessibleInterfaceWrapper(QAccessibleInterface *interface)
- :interface(interface), childrenIsRegistered(new bool(false)), refCount(new int(1)) { }
-
- ~QAccessibleInterfaceWrapper()
- {
- if (--(*refCount) == 0) {
- delete interface;
- delete refCount;
- delete childrenIsRegistered;
- }
- }
-
- QAccessibleInterfaceWrapper(const QAccessibleInterfaceWrapper &other)
- :interface(other.interface), childrenIsRegistered(other.childrenIsRegistered), refCount(other.refCount)
- {
- ++(*refCount);
- }
-
- void operator=(const QAccessibleInterfaceWrapper &other)
- {
- if (other.interface == interface)
- return;
-
- if (--(*refCount) == 0) {
- delete interface;
- delete refCount;
- delete childrenIsRegistered;
- }
-
- interface = other.interface;
- childrenIsRegistered = other.childrenIsRegistered;
- refCount = other.refCount;
- ++(*refCount);
- }
-
- QAccessibleInterface *interface;
- bool *childrenIsRegistered;
-private:
- int *refCount;
-};
-
-/*
- QAInterface represents one accessiblity item. It hides the fact that
- one QAccessibleInterface may represent more than one item, and it also
- automates the memory management for QAccessibleInterfaces using the
- QAccessibleInterfaceWrapper wrapper class.
-
- It has the same API as QAccessibleInterface, minus the child parameter
- in the functions.
-*/
-class Q_AUTOTEST_EXPORT QAInterface : public QAccessible
-{
-public:
- QAInterface()
- : base(QAccessibleInterfaceWrapper())
- { }
-
- QAInterface(QAccessibleInterface *interface, int child = 0)
- {
- if (interface == 0 || child > interface->childCount()) {
- base = QAccessibleInterfaceWrapper();
- } else {
- base = QAccessibleInterfaceWrapper(interface);
- m_cachedObject = interface->object();
- this->child = child;
- }
- }
-
- QAInterface(QAccessibleInterfaceWrapper wrapper, int child = 0)
- :base(wrapper), m_cachedObject(wrapper.interface->object()), child(child)
- { }
-
- QAInterface(const QAInterface &other, int child)
- {
- if (other.isValid() == false || child > other.childCount()) {
- base = QAccessibleInterfaceWrapper();
- } else {
- base = other.base;
- m_cachedObject = other.m_cachedObject;
- this->child = child;
- }
- }
-
- bool operator==(const QAInterface &other) const;
- bool operator!=(const QAInterface &other) const;
-
- inline QString actionText (int action, Text text) const
- { return base.interface->actionText(action, text, child); }
-
- QAInterface childAt(int x, int y) const
- {
- if (!checkValid())
- return QAInterface();
-
- const int foundChild = base.interface->childAt(x, y);
-
- if (foundChild == -1)
- return QAInterface();
-
- if (child == 0)
- return navigate(QAccessible::Child, foundChild);
-
- if (foundChild == child)
- return *this;
- return QAInterface();
- }
-
- int indexOfChild(const QAInterface &child) const
- {
- if (!checkValid())
- return -1;
-
- if (*this != child.parent())
- return -1;
-
- if (object() == child.object())
- return child.id();
-
- return base.interface->indexOfChild(child.base.interface);
- }
-
- inline int childCount() const
- {
- if (!checkValid())
- return 0;
-
- if (child != 0)
- return 0;
- return base.interface->childCount();
- }
-
- QList<QAInterface> children() const
- {
- if (!checkValid())
- return QList<QAInterface>();
-
- QList<QAInterface> children;
- for (int i = 1; i <= childCount(); ++i) {
- children.append(navigate(QAccessible::Child, i));
- }
- return children;
- }
-
- QAInterface childAt(int index) const
- {
- return navigate(QAccessible::Child, index);
- }
-
- inline void doAction(int action, const QVariantList &params = QVariantList()) const
- {
- if (!checkValid())
- return;
-
- base.interface->doAction(action, child, params);
- }
-
- QAInterface navigate(RelationFlag relation, int entry) const;
-
- inline QObject * object() const
- {
- if (!checkValid())
- return 0;
-
- return base.interface->object();
- }
-
- QAInterface objectInterface() const
- {
- if (!checkValid())
- return QAInterface();
-
- QObject *obj = object();
- QAInterface current = *this;
- while (obj == 0)
- {
- QAInterface parent = current.parent();
- if (parent.isValid() == false)
- break;
- obj = parent.object();
- current = parent;
- }
- return current;
- }
-
- inline HIObjectRef hiObject() const
- {
- if (!checkValid())
- return 0;
- QWidget * const widget = qobject_cast<QWidget * const>(object());
- if (widget)
- return (HIObjectRef)widget->winId();
- else
- return 0;
- }
-
- inline QObject * cachedObject() const
- {
- if (!checkValid())
- return 0;
- return m_cachedObject;
- }
-
- inline QRect rect() const
- {
- if (!checkValid())
- return QRect();
- return base.interface->rect(child);
- }
-
- inline Role role() const
- {
- if (!checkValid())
- return QAccessible::NoRole;
- return base.interface->role(child);
- }
-
- inline void setText(Text t, const QString &text) const
- {
- if (!checkValid())
- return;
- base.interface->setText(t, child, text);
- }
-
- inline State state() const
- {
- if (!checkValid())
- return 0;
- return base.interface->state(child);
- }
-
- inline QString text (Text text) const
- {
- if (!checkValid())
- return QString();
- return base.interface->text(text, child);
- }
-
- inline QString value() const
- { return text(QAccessible::Value); }
-
- inline QString name() const
- { return text(QAccessible::Name); }
-
- inline int userActionCount() const
- {
- if (!checkValid())
- return 0;
- return base.interface->userActionCount(child);
- }
-
- inline QString className() const
- {
- if (!checkValid())
- return QString();
- return QLatin1String(base.interface->object()->metaObject()->className());
- }
-
- inline bool isHIView() const
- { return (child == 0 && object() != 0); }
-
- inline int id() const
- { return child; }
-
- inline bool isValid() const
- {
- return (base.interface != 0 && base.interface->isValid());
- }
-
- QAInterface parent() const
- { return navigate(QAccessible::Ancestor, 1); }
-
- QAccessibleInterfaceWrapper interfaceWrapper() const
- { return base; }
-
-protected:
- bool checkValid() const
- {
- const bool valid = isValid();
-#ifdef Q_ACCESSIBLE_MAC_DEBUG
- if (!valid)
- qFatal("QAccessible_mac: tried to use invalid interface.");
-#endif
- return valid;
- }
-
- QAccessibleInterfaceWrapper base;
- QObject *m_cachedObject;
- int child;
-};
-
-Q_AUTOTEST_EXPORT QDebug operator<<(QDebug debug, const QAInterface &interface);
-
-/*
- QAElement is a thin wrapper around an AXUIElementRef that automates
- the ref-counting.
-*/
-class Q_AUTOTEST_EXPORT QAElement
-{
-public:
- QAElement();
- explicit QAElement(AXUIElementRef elementRef);
- QAElement(const QAElement &element);
- QAElement(HIObjectRef, int child);
- ~QAElement();
-
- inline HIObjectRef object() const
- {
-#ifndef Q_WS_MAC64
- return AXUIElementGetHIObject(elementRef);
-#else
- return 0;
-#endif
- }
-
- inline int id() const
- {
- UInt64 theId;
-#ifndef QT_MAC_USE_COCOA
- AXUIElementGetIdentifier(elementRef, &theId);
-#else
- theId = 0;
-#endif
- return theId;
- }
-
- inline AXUIElementRef element() const
- {
- return elementRef;
- }
-
- inline bool isValid() const
- {
- return (elementRef != 0);
- }
-
- void operator=(const QAElement &other);
- bool operator==(const QAElement &other) const;
-private:
- AXUIElementRef elementRef;
-};
-
-
-class QInterfaceFactory
-{
-public:
- virtual QAInterface interface(UInt64 identifier) = 0;
- virtual QAElement element(int id) = 0;
- virtual QAElement element(const QAInterface &interface)
- {
- return element(interface.id());
- }
- virtual void registerChildren() = 0;
- virtual ~QInterfaceFactory() {}
-};
-
-/*
- QAccessibleHierarchyManager bridges the Mac and Qt accessibility hierarchies.
- There is a one-to-one relationship between QAElements on the Mac side
- and QAInterfaces on the Qt side, and this class provides lookup functions
- that translates between these to items.
-
- The identity of a QAInterface is determined by its QAccessibleInterface and
- child identifier, and the identity of a QAElement is determined by its
- HIObjectRef and identifier.
-
- QAccessibleHierarchyManager receives QObject::destroyed() signals and deletes
- the accessibility objects for destroyed objects.
-*/
-class Q_AUTOTEST_EXPORT QAccessibleHierarchyManager : public QObject
-{
-Q_OBJECT
-public:
- ~QAccessibleHierarchyManager() { reset(); }
- static QAccessibleHierarchyManager *instance();
- void reset();
-
- QAElement registerInterface(QObject *object, int child);
- QAElement registerInterface(const QAInterface &interface);
- void registerInterface(QObject *object, HIObjectRef hiobject, QInterfaceFactory *interfaceFactory);
-
- void registerChildren(const QAInterface &interface);
-
- QAInterface lookup(const AXUIElementRef &element);
- QAInterface lookup(const QAElement &element);
- QAElement lookup(const QAInterface &interface);
- QAElement lookup(QObject * const object, int id);
-private slots:
- void objectDestroyed(QObject *);
-private:
- typedef QHash<QObject *, QInterfaceFactory *> QObjectElementHash;
- typedef QHash<HIObjectRef, QInterfaceFactory *> HIObjectInterfaceHash;
- typedef QHash<QObject *, HIObjectRef> QObjectHIObjectHash;
-
- QObjectElementHash qobjectElementHash;
- HIObjectInterfaceHash hiobjectInterfaceHash;
- QObjectHIObjectHash qobjectHiobjectHash;
-};
-
-Q_AUTOTEST_EXPORT bool isItInteresting(const QAInterface &interface);
-
-QT_END_NAMESPACE
-
-#endif
diff --git a/src/gui/accessible/qaccessiblebridge.cpp b/src/gui/accessible/qaccessiblebridge.cpp
index b08a2e83bf..d702972cd2 100644
--- a/src/gui/accessible/qaccessiblebridge.cpp
+++ b/src/gui/accessible/qaccessiblebridge.cpp
@@ -1,6 +1,6 @@
/****************************************************************************
**
-** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies).
+** Copyright (C) 2012 Nokia Corporation and/or its subsidiary(-ies).
** All rights reserved.
** Contact: Nokia Corporation (qt-info@nokia.com)
**
diff --git a/src/gui/accessible/qaccessiblebridge.h b/src/gui/accessible/qaccessiblebridge.h
index 73edf51183..d0470f38e6 100644
--- a/src/gui/accessible/qaccessiblebridge.h
+++ b/src/gui/accessible/qaccessiblebridge.h
@@ -1,6 +1,6 @@
/****************************************************************************
**
-** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies).
+** Copyright (C) 2012 Nokia Corporation and/or its subsidiary(-ies).
** All rights reserved.
** Contact: Nokia Corporation (qt-info@nokia.com)
**
diff --git a/src/gui/accessible/qaccessibleobject.cpp b/src/gui/accessible/qaccessibleobject.cpp
index 18941437fe..e271df2a13 100644
--- a/src/gui/accessible/qaccessibleobject.cpp
+++ b/src/gui/accessible/qaccessibleobject.cpp
@@ -1,6 +1,6 @@
/****************************************************************************
**
-** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies).
+** Copyright (C) 2012 Nokia Corporation and/or its subsidiary(-ies).
** All rights reserved.
** Contact: Nokia Corporation (qt-info@nokia.com)
**
@@ -96,6 +96,8 @@ QList<QByteArray> QAccessibleObjectPrivate::actionList() const
\ingroup accessibility
\inmodule QtWidgets
+ This class is part of \l {Accessibility for QWidget Applications}.
+
This class is mainly provided for convenience. All subclasses of
the QAccessibleInterface that provide implementations of non-widget objects
should use this class as their base class.
@@ -154,6 +156,18 @@ void QAccessibleObject::setText(QAccessible::Text, const QString &)
{
}
+/*! \reimp */
+QAccessibleInterface *QAccessibleObject::childAt(int x, int y) const
+{
+ for (int i = 0; i < childCount(); ++i) {
+ QAccessibleInterface *childIface = child(i);
+ if (childIface->rect().contains(x,y)) {
+ return childIface;
+ }
+ }
+ return 0;
+}
+
/*!
\class QAccessibleApplication
\brief The QAccessibleApplication class implements the QAccessibleInterface for QApplication.
@@ -207,23 +221,7 @@ int QAccessibleApplication::childCount() const
int QAccessibleApplication::indexOfChild(const QAccessibleInterface *child) const
{
const QObjectList tlw(topLevelObjects());
- int index = tlw.indexOf(child->object());
- if (index != -1)
- ++index;
- return index;
-}
-
-/*! \reimp */
-int QAccessibleApplication::childAt(int x, int y) const
-{
- for (int i = 0; i < childCount(); ++i) {
- QAccessibleInterface *childIface = child(i);
- QRect geom = childIface->rect();
- if (geom.contains(x,y))
- return i+1;
- delete childIface;
- }
- return rect().contains(x,y) ? 0 : -1;
+ return tlw.indexOf(child->object());
}
/*! \reimp */
@@ -273,9 +271,6 @@ int QAccessibleApplication::navigate(QAccessible::RelationFlag relation, int,
return 0;
}
break;
- case QAccessible::Ancestor:
- *target = parent();
- return 0;
default:
break;
}
@@ -306,7 +301,7 @@ QAccessible::Role QAccessibleApplication::role() const
/*! \reimp */
QAccessible::State QAccessibleApplication::state() const
{
- return QGuiApplication::activeWindow() ? QAccessible::Focused : QAccessible::Normal;
+ return QAccessible::State();
}
diff --git a/src/gui/accessible/qaccessibleobject.h b/src/gui/accessible/qaccessibleobject.h
index f2a9fd0430..58b95baffa 100644
--- a/src/gui/accessible/qaccessibleobject.h
+++ b/src/gui/accessible/qaccessibleobject.h
@@ -1,6 +1,6 @@
/****************************************************************************
**
-** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies).
+** Copyright (C) 2012 Nokia Corporation and/or its subsidiary(-ies).
** All rights reserved.
** Contact: Nokia Corporation (qt-info@nokia.com)
**
@@ -67,6 +67,7 @@ public:
// properties
QRect rect() const;
void setText(QAccessible::Text t, const QString &text);
+ QAccessibleInterface *childAt(int x, int y) const;
protected:
virtual ~QAccessibleObject();
@@ -89,7 +90,6 @@ public:
// navigation
QAccessibleInterface *parent() const;
- int childAt(int x, int y) const;
QAccessibleInterface *child(int index) const;
int navigate(QAccessible::RelationFlag, int, QAccessibleInterface **) const;
diff --git a/src/gui/accessible/qaccessibleplugin.cpp b/src/gui/accessible/qaccessibleplugin.cpp
index 618a31ad5e..0d9d57b0ec 100644
--- a/src/gui/accessible/qaccessibleplugin.cpp
+++ b/src/gui/accessible/qaccessibleplugin.cpp
@@ -1,6 +1,6 @@
/****************************************************************************
**
-** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies).
+** Copyright (C) 2012 Nokia Corporation and/or its subsidiary(-ies).
** All rights reserved.
** Contact: Nokia Corporation (qt-info@nokia.com)
**
diff --git a/src/gui/accessible/qaccessibleplugin.h b/src/gui/accessible/qaccessibleplugin.h
index 4e09034dfd..d3610e40f6 100644
--- a/src/gui/accessible/qaccessibleplugin.h
+++ b/src/gui/accessible/qaccessibleplugin.h
@@ -1,6 +1,6 @@
/****************************************************************************
**
-** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies).
+** Copyright (C) 2012 Nokia Corporation and/or its subsidiary(-ies).
** All rights reserved.
** Contact: Nokia Corporation (qt-info@nokia.com)
**
diff --git a/src/gui/accessible/qplatformaccessibility_qpa.cpp b/src/gui/accessible/qplatformaccessibility_qpa.cpp
index 7df827552d..47c351921e 100644
--- a/src/gui/accessible/qplatformaccessibility_qpa.cpp
+++ b/src/gui/accessible/qplatformaccessibility_qpa.cpp
@@ -1,6 +1,6 @@
/****************************************************************************
**
-** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies).
+** Copyright (C) 2012 Nokia Corporation and/or its subsidiary(-ies).
** All rights reserved.
** Contact: Nokia Corporation (qt-info@nokia.com)
**
@@ -123,10 +123,7 @@ void QPlatformAccessibility::initialize()
if (isInit)
return;
isInit = true; // ### not atomic
-#ifdef Q_OS_UNIX
- if (qgetenv("QT_ACCESSIBILITY") != "1")
- return;
-#endif
+
#ifndef QT_NO_LIBRARY
const QStringList l = bridgeloader()->keys();
for (int i = 0; i < l.count(); ++i) {
diff --git a/src/gui/accessible/qplatformaccessibility_qpa.h b/src/gui/accessible/qplatformaccessibility_qpa.h
index 2931f4180a..15297110b8 100644
--- a/src/gui/accessible/qplatformaccessibility_qpa.h
+++ b/src/gui/accessible/qplatformaccessibility_qpa.h
@@ -1,6 +1,6 @@
/****************************************************************************
**
-** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies).
+** Copyright (C) 2012 Nokia Corporation and/or its subsidiary(-ies).
** All rights reserved.
** Contact: Nokia Corporation (qt-info@nokia.com)
**
diff --git a/src/gui/egl/qegl.cpp b/src/gui/egl/qegl.cpp
index 4675533144..4ee656f777 100644
--- a/src/gui/egl/qegl.cpp
+++ b/src/gui/egl/qegl.cpp
@@ -1,6 +1,6 @@
/****************************************************************************
**
-** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies).
+** Copyright (C) 2012 Nokia Corporation and/or its subsidiary(-ies).
** All rights reserved.
** Contact: Nokia Corporation (qt-info@nokia.com)
**
diff --git a/src/gui/egl/qegl_p.h b/src/gui/egl/qegl_p.h
index db8d8b7a38..02712b4026 100644
--- a/src/gui/egl/qegl_p.h
+++ b/src/gui/egl/qegl_p.h
@@ -1,6 +1,6 @@
/****************************************************************************
**
-** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies).
+** Copyright (C) 2012 Nokia Corporation and/or its subsidiary(-ies).
** All rights reserved.
** Contact: Nokia Corporation (qt-info@nokia.com)
**
diff --git a/src/gui/egl/qegl_qpa.cpp b/src/gui/egl/qegl_qpa.cpp
index c3eb044b22..2b7daf47b2 100644
--- a/src/gui/egl/qegl_qpa.cpp
+++ b/src/gui/egl/qegl_qpa.cpp
@@ -1,6 +1,6 @@
/****************************************************************************
**
-** Copyright (C) 2009 Nokia Corporation and/or its subsidiary(-ies).
+** Copyright (C) 2012 Nokia Corporation and/or its subsidiary(-ies).
** All rights reserved.
** Contact: Nokia Corporation (qt-info@nokia.com)
**
diff --git a/src/gui/egl/qegl_stub.cpp b/src/gui/egl/qegl_stub.cpp
index 783393c148..3d9d72587e 100644
--- a/src/gui/egl/qegl_stub.cpp
+++ b/src/gui/egl/qegl_stub.cpp
@@ -1,6 +1,6 @@
/****************************************************************************
**
-** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies).
+** Copyright (C) 2012 Nokia Corporation and/or its subsidiary(-ies).
** All rights reserved.
** Contact: Nokia Corporation (qt-info@nokia.com)
**
diff --git a/src/gui/egl/qeglcontext_p.h b/src/gui/egl/qeglcontext_p.h
index 7ea18627d1..70cdfc72ac 100644
--- a/src/gui/egl/qeglcontext_p.h
+++ b/src/gui/egl/qeglcontext_p.h
@@ -1,6 +1,6 @@
/****************************************************************************
**
-** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies).
+** Copyright (C) 2012 Nokia Corporation and/or its subsidiary(-ies).
** All rights reserved.
** Contact: Nokia Corporation (qt-info@nokia.com)
**
diff --git a/src/gui/egl/qeglproperties.cpp b/src/gui/egl/qeglproperties.cpp
index 7f4785499d..29b1cd371d 100644
--- a/src/gui/egl/qeglproperties.cpp
+++ b/src/gui/egl/qeglproperties.cpp
@@ -1,6 +1,6 @@
/****************************************************************************
**
-** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies).
+** Copyright (C) 2012 Nokia Corporation and/or its subsidiary(-ies).
** All rights reserved.
** Contact: Nokia Corporation (qt-info@nokia.com)
**
diff --git a/src/gui/egl/qeglproperties_p.h b/src/gui/egl/qeglproperties_p.h
index ec596200fb..d7bc0893d4 100644
--- a/src/gui/egl/qeglproperties_p.h
+++ b/src/gui/egl/qeglproperties_p.h
@@ -1,6 +1,6 @@
/****************************************************************************
**
-** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies).
+** Copyright (C) 2012 Nokia Corporation and/or its subsidiary(-ies).
** All rights reserved.
** Contact: Nokia Corporation (qt-info@nokia.com)
**
diff --git a/src/gui/egl/qeglproperties_stub.cpp b/src/gui/egl/qeglproperties_stub.cpp
index c04f6a1070..7be8a0a4b9 100644
--- a/src/gui/egl/qeglproperties_stub.cpp
+++ b/src/gui/egl/qeglproperties_stub.cpp
@@ -1,6 +1,6 @@
/****************************************************************************
**
-** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies).
+** Copyright (C) 2012 Nokia Corporation and/or its subsidiary(-ies).
** All rights reserved.
** Contact: Nokia Corporation (qt-info@nokia.com)
**
diff --git a/src/gui/image/qbitmap.cpp b/src/gui/image/qbitmap.cpp
index 4c03379550..6c1320e868 100644
--- a/src/gui/image/qbitmap.cpp
+++ b/src/gui/image/qbitmap.cpp
@@ -1,6 +1,6 @@
/****************************************************************************
**
-** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies).
+** Copyright (C) 2012 Nokia Corporation and/or its subsidiary(-ies).
** All rights reserved.
** Contact: Nokia Corporation (qt-info@nokia.com)
**
diff --git a/src/gui/image/qbitmap.h b/src/gui/image/qbitmap.h
index a3104f5083..5740b874db 100644
--- a/src/gui/image/qbitmap.h
+++ b/src/gui/image/qbitmap.h
@@ -1,6 +1,6 @@
/****************************************************************************
**
-** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies).
+** Copyright (C) 2012 Nokia Corporation and/or its subsidiary(-ies).
** All rights reserved.
** Contact: Nokia Corporation (qt-info@nokia.com)
**
diff --git a/src/gui/image/qbmphandler.cpp b/src/gui/image/qbmphandler.cpp
index 3011a6c130..3d9f8228f2 100644
--- a/src/gui/image/qbmphandler.cpp
+++ b/src/gui/image/qbmphandler.cpp
@@ -1,6 +1,6 @@
/****************************************************************************
**
-** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies).
+** Copyright (C) 2012 Nokia Corporation and/or its subsidiary(-ies).
** All rights reserved.
** Contact: Nokia Corporation (qt-info@nokia.com)
**
diff --git a/src/gui/image/qbmphandler_p.h b/src/gui/image/qbmphandler_p.h
index 373f8fbaaf..f2eb8f69b2 100644
--- a/src/gui/image/qbmphandler_p.h
+++ b/src/gui/image/qbmphandler_p.h
@@ -1,6 +1,6 @@
/****************************************************************************
**
-** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies).
+** Copyright (C) 2012 Nokia Corporation and/or its subsidiary(-ies).
** All rights reserved.
** Contact: Nokia Corporation (qt-info@nokia.com)
**
diff --git a/src/gui/image/qgifhandler.cpp b/src/gui/image/qgifhandler.cpp
index 2708790947..6968ca6736 100644
--- a/src/gui/image/qgifhandler.cpp
+++ b/src/gui/image/qgifhandler.cpp
@@ -1,6 +1,6 @@
/****************************************************************************
**
-** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies).
+** Copyright (C) 2012 Nokia Corporation and/or its subsidiary(-ies).
** All rights reserved.
** Contact: Nokia Corporation (qt-info@nokia.com)
**
diff --git a/src/gui/image/qgifhandler_p.h b/src/gui/image/qgifhandler_p.h
index ca82f3c979..0d9724a071 100644
--- a/src/gui/image/qgifhandler_p.h
+++ b/src/gui/image/qgifhandler_p.h
@@ -1,6 +1,6 @@
/****************************************************************************
**
-** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies).
+** Copyright (C) 2012 Nokia Corporation and/or its subsidiary(-ies).
** All rights reserved.
** Contact: Nokia Corporation (qt-info@nokia.com)
**
diff --git a/src/gui/image/qimage.cpp b/src/gui/image/qimage.cpp
index c107fea919..564abd2af2 100644
--- a/src/gui/image/qimage.cpp
+++ b/src/gui/image/qimage.cpp
@@ -1,6 +1,6 @@
/****************************************************************************
**
-** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies).
+** Copyright (C) 2012 Nokia Corporation and/or its subsidiary(-ies).
** All rights reserved.
** Contact: Nokia Corporation (qt-info@nokia.com)
**
@@ -114,17 +114,6 @@ static QImage rotated90(const QImage &src);
static QImage rotated180(const QImage &src);
static QImage rotated270(const QImage &src);
-// ### Qt 5: remove
-Q_GUI_EXPORT qint64 qt_image_id(const QImage &image)
-{
- return image.cacheKey();
-}
-
-const QVector<QRgb> *qt_image_colortable(const QImage &image)
-{
- return &image.d->colortable;
-}
-
QBasicAtomicInt qimage_serial_number = Q_BASIC_ATOMIC_INITIALIZER(1);
QImageData::QImageData()
@@ -5874,4 +5863,12 @@ bool QImageData::convertInPlace(QImage::Format newFormat, Qt::ImageConversionFla
\internal
*/
+#ifndef QT_NO_DEBUG_STREAM
+QDebug operator<<(QDebug dbg, const QImage &i)
+{
+ dbg.nospace() << "QImage(" << i.size() << ')';
+ return dbg.space();
+}
+#endif
+
QT_END_NAMESPACE
diff --git a/src/gui/image/qimage.h b/src/gui/image/qimage.h
index a18d81068e..7a5a732c9a 100644
--- a/src/gui/image/qimage.h
+++ b/src/gui/image/qimage.h
@@ -1,6 +1,6 @@
/****************************************************************************
**
-** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies).
+** Copyright (C) 2012 Nokia Corporation and/or its subsidiary(-ies).
** All rights reserved.
** Contact: Nokia Corporation (qt-info@nokia.com)
**
@@ -295,8 +295,6 @@ private:
friend class QRasterPlatformPixmap;
friend class QBlittablePlatformPixmap;
friend class QPixmapCacheEntry;
- friend Q_GUI_EXPORT qint64 qt_image_id(const QImage &image);
- friend const QVector<QRgb> *qt_image_colortable(const QImage &image);
public:
typedef QImageData * DataPtr;
@@ -363,9 +361,9 @@ inline QString QImage::text(const QImageTextKeyLang&kl) const
{
if (!d)
return QString();
- QString k = QString::fromAscii(kl.key);
+ QString k = QString::fromAscii(kl.key.constData());
if (!kl.lang.isEmpty())
- k += QLatin1Char('/') + QString::fromAscii(kl.lang);
+ k += QLatin1Char('/') + QString::fromAscii(kl.lang.constData());
return text(k);
}
@@ -408,6 +406,11 @@ Q_GUI_EXPORT QDataStream &operator<<(QDataStream &, const QImage &);
Q_GUI_EXPORT QDataStream &operator>>(QDataStream &, QImage &);
#endif
+#ifndef QT_NO_DEBUG_STREAM
+Q_GUI_EXPORT QDebug operator<<(QDebug, const QImage &);
+#endif
+
+
QT_END_NAMESPACE
QT_END_HEADER
diff --git a/src/gui/image/qimage_neon.cpp b/src/gui/image/qimage_neon.cpp
index a91bd94b03..cdf817b051 100644
--- a/src/gui/image/qimage_neon.cpp
+++ b/src/gui/image/qimage_neon.cpp
@@ -1,6 +1,6 @@
/****************************************************************************
**
-** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies).
+** Copyright (C) 2012 Nokia Corporation and/or its subsidiary(-ies).
** All rights reserved.
** Contact: Nokia Corporation (qt-info@nokia.com)
**
diff --git a/src/gui/image/qimage_p.h b/src/gui/image/qimage_p.h
index 77b9a7d1a1..6e846fd0cf 100644
--- a/src/gui/image/qimage_p.h
+++ b/src/gui/image/qimage_p.h
@@ -1,6 +1,6 @@
/****************************************************************************
**
-** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies).
+** Copyright (C) 2012 Nokia Corporation and/or its subsidiary(-ies).
** All rights reserved.
** Contact: Nokia Corporation (qt-info@nokia.com)
**
diff --git a/src/gui/image/qimage_sse2.cpp b/src/gui/image/qimage_sse2.cpp
index fe0bf8b303..872d1d6be7 100644
--- a/src/gui/image/qimage_sse2.cpp
+++ b/src/gui/image/qimage_sse2.cpp
@@ -1,6 +1,6 @@
/****************************************************************************
**
-** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies).
+** Copyright (C) 2012 Nokia Corporation and/or its subsidiary(-ies).
** All rights reserved.
** Contact: Nokia Corporation (qt-info@nokia.com)
**
diff --git a/src/gui/image/qimage_ssse3.cpp b/src/gui/image/qimage_ssse3.cpp
index fcdd4e5eb2..95cf694d2a 100644
--- a/src/gui/image/qimage_ssse3.cpp
+++ b/src/gui/image/qimage_ssse3.cpp
@@ -1,6 +1,6 @@
/****************************************************************************
**
-** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies).
+** Copyright (C) 2012 Nokia Corporation and/or its subsidiary(-ies).
** All rights reserved.
** Contact: Nokia Corporation (qt-info@nokia.com)
**
diff --git a/src/gui/image/qimageiohandler.cpp b/src/gui/image/qimageiohandler.cpp
index 80e8fec9d0..d9691563b1 100644
--- a/src/gui/image/qimageiohandler.cpp
+++ b/src/gui/image/qimageiohandler.cpp
@@ -1,6 +1,6 @@
/****************************************************************************
**
-** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies).
+** Copyright (C) 2012 Nokia Corporation and/or its subsidiary(-ies).
** All rights reserved.
** Contact: Nokia Corporation (qt-info@nokia.com)
**
diff --git a/src/gui/image/qimageiohandler.h b/src/gui/image/qimageiohandler.h
index ace49c9be0..188b4ef1a8 100644
--- a/src/gui/image/qimageiohandler.h
+++ b/src/gui/image/qimageiohandler.h
@@ -1,6 +1,6 @@
/****************************************************************************
**
-** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies).
+** Copyright (C) 2012 Nokia Corporation and/or its subsidiary(-ies).
** All rights reserved.
** Contact: Nokia Corporation (qt-info@nokia.com)
**
diff --git a/src/gui/image/qimagepixmapcleanuphooks.cpp b/src/gui/image/qimagepixmapcleanuphooks.cpp
index 7901045593..e83897aced 100644
--- a/src/gui/image/qimagepixmapcleanuphooks.cpp
+++ b/src/gui/image/qimagepixmapcleanuphooks.cpp
@@ -1,6 +1,6 @@
/****************************************************************************
**
-** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies).
+** Copyright (C) 2012 Nokia Corporation and/or its subsidiary(-ies).
** All rights reserved.
** Contact: Nokia Corporation (qt-info@nokia.com)
**
diff --git a/src/gui/image/qimagepixmapcleanuphooks_p.h b/src/gui/image/qimagepixmapcleanuphooks_p.h
index c98da6110a..11abe173c4 100644
--- a/src/gui/image/qimagepixmapcleanuphooks_p.h
+++ b/src/gui/image/qimagepixmapcleanuphooks_p.h
@@ -1,6 +1,6 @@
/****************************************************************************
**
-** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies).
+** Copyright (C) 2012 Nokia Corporation and/or its subsidiary(-ies).
** All rights reserved.
** Contact: Nokia Corporation (qt-info@nokia.com)
**
diff --git a/src/gui/image/qimagereader.cpp b/src/gui/image/qimagereader.cpp
index 4bf4b08349..b6345191d6 100644
--- a/src/gui/image/qimagereader.cpp
+++ b/src/gui/image/qimagereader.cpp
@@ -1,6 +1,6 @@
/****************************************************************************
**
-** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies).
+** Copyright (C) 2012 Nokia Corporation and/or its subsidiary(-ies).
** All rights reserved.
** Contact: Nokia Corporation (qt-info@nokia.com)
**
diff --git a/src/gui/image/qimagereader.h b/src/gui/image/qimagereader.h
index b85ef2b61d..f132991d92 100644
--- a/src/gui/image/qimagereader.h
+++ b/src/gui/image/qimagereader.h
@@ -1,6 +1,6 @@
/****************************************************************************
**
-** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies).
+** Copyright (C) 2012 Nokia Corporation and/or its subsidiary(-ies).
** All rights reserved.
** Contact: Nokia Corporation (qt-info@nokia.com)
**
diff --git a/src/gui/image/qimagewriter.cpp b/src/gui/image/qimagewriter.cpp
index 82ae64593a..b7d57fa4d3 100644
--- a/src/gui/image/qimagewriter.cpp
+++ b/src/gui/image/qimagewriter.cpp
@@ -1,6 +1,6 @@
/****************************************************************************
**
-** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies).
+** Copyright (C) 2012 Nokia Corporation and/or its subsidiary(-ies).
** All rights reserved.
** Contact: Nokia Corporation (qt-info@nokia.com)
**
diff --git a/src/gui/image/qimagewriter.h b/src/gui/image/qimagewriter.h
index cc7fdd2871..5aac7e8599 100644
--- a/src/gui/image/qimagewriter.h
+++ b/src/gui/image/qimagewriter.h
@@ -1,6 +1,6 @@
/****************************************************************************
**
-** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies).
+** Copyright (C) 2012 Nokia Corporation and/or its subsidiary(-ies).
** All rights reserved.
** Contact: Nokia Corporation (qt-info@nokia.com)
**
diff --git a/src/gui/image/qjpeghandler.cpp b/src/gui/image/qjpeghandler.cpp
index 673a6d63d9..f0f9368e22 100644
--- a/src/gui/image/qjpeghandler.cpp
+++ b/src/gui/image/qjpeghandler.cpp
@@ -1,6 +1,6 @@
/****************************************************************************
**
-** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies).
+** Copyright (C) 2012 Nokia Corporation and/or its subsidiary(-ies).
** All rights reserved.
** Contact: Nokia Corporation (qt-info@nokia.com)
**
diff --git a/src/gui/image/qjpeghandler_p.h b/src/gui/image/qjpeghandler_p.h
index c573b4944e..7827804959 100644
--- a/src/gui/image/qjpeghandler_p.h
+++ b/src/gui/image/qjpeghandler_p.h
@@ -1,6 +1,6 @@
/****************************************************************************
**
-** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies).
+** Copyright (C) 2012 Nokia Corporation and/or its subsidiary(-ies).
** All rights reserved.
** Contact: Nokia Corporation (qt-info@nokia.com)
**
diff --git a/src/gui/image/qmnghandler.cpp b/src/gui/image/qmnghandler.cpp
index 179fff8e93..6a6ee8d2cf 100644
--- a/src/gui/image/qmnghandler.cpp
+++ b/src/gui/image/qmnghandler.cpp
@@ -1,6 +1,6 @@
/****************************************************************************
**
-** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies).
+** Copyright (C) 2012 Nokia Corporation and/or its subsidiary(-ies).
** All rights reserved.
** Contact: Nokia Corporation (qt-info@nokia.com)
**
diff --git a/src/gui/image/qmnghandler_p.h b/src/gui/image/qmnghandler_p.h
index f217f0da7f..42b4fd06a8 100644
--- a/src/gui/image/qmnghandler_p.h
+++ b/src/gui/image/qmnghandler_p.h
@@ -1,6 +1,6 @@
/****************************************************************************
**
-** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies).
+** Copyright (C) 2012 Nokia Corporation and/or its subsidiary(-ies).
** All rights reserved.
** Contact: Nokia Corporation (qt-info@nokia.com)
**
diff --git a/src/gui/image/qmovie.cpp b/src/gui/image/qmovie.cpp
index ff00059f51..0be6833a87 100644
--- a/src/gui/image/qmovie.cpp
+++ b/src/gui/image/qmovie.cpp
@@ -1,6 +1,6 @@
/****************************************************************************
**
-** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies).
+** Copyright (C) 2012 Nokia Corporation and/or its subsidiary(-ies).
** All rights reserved.
** Contact: Nokia Corporation (qt-info@nokia.com)
**
@@ -1017,15 +1017,6 @@ void QMovie::setCacheMode(CacheMode cacheMode)
d->cacheMode = cacheMode;
}
-/*!
- \internal
-*/
-QMovie::CacheMode QMovie::cacheMode()
-{
- Q_D(QMovie);
- return d->cacheMode;
-}
-
QT_END_NAMESPACE
#include "moc_qmovie.cpp"
diff --git a/src/gui/image/qmovie.h b/src/gui/image/qmovie.h
index 0278957091..eb2b81d0b5 100644
--- a/src/gui/image/qmovie.h
+++ b/src/gui/image/qmovie.h
@@ -1,6 +1,6 @@
/****************************************************************************
**
-** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies).
+** Copyright (C) 2012 Nokia Corporation and/or its subsidiary(-ies).
** All rights reserved.
** Contact: Nokia Corporation (qt-info@nokia.com)
**
@@ -125,8 +125,6 @@ public:
CacheMode cacheMode() const;
void setCacheMode(CacheMode mode);
- CacheMode cacheMode(); // ### Qt 5: remove me
-
Q_SIGNALS:
void started();
void resized(const QSize &size);
diff --git a/src/gui/image/qnativeimage.cpp b/src/gui/image/qnativeimage.cpp
index 30c1c0621e..776a17857e 100644
--- a/src/gui/image/qnativeimage.cpp
+++ b/src/gui/image/qnativeimage.cpp
@@ -1,6 +1,6 @@
/****************************************************************************
**
-** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies).
+** Copyright (C) 2012 Nokia Corporation and/or its subsidiary(-ies).
** All rights reserved.
** Contact: Nokia Corporation (qt-info@nokia.com)
**
diff --git a/src/gui/image/qnativeimage_p.h b/src/gui/image/qnativeimage_p.h
index 433460b463..0d8834cad3 100644
--- a/src/gui/image/qnativeimage_p.h
+++ b/src/gui/image/qnativeimage_p.h
@@ -1,6 +1,6 @@
/****************************************************************************
**
-** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies).
+** Copyright (C) 2012 Nokia Corporation and/or its subsidiary(-ies).
** All rights reserved.
** Contact: Nokia Corporation (qt-info@nokia.com)
**
diff --git a/src/gui/image/qpaintengine_pic.cpp b/src/gui/image/qpaintengine_pic.cpp
index ec3a4a050a..cf9ecc17da 100644
--- a/src/gui/image/qpaintengine_pic.cpp
+++ b/src/gui/image/qpaintengine_pic.cpp
@@ -1,6 +1,6 @@
/****************************************************************************
**
-** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies).
+** Copyright (C) 2012 Nokia Corporation and/or its subsidiary(-ies).
** All rights reserved.
** Contact: Nokia Corporation (qt-info@nokia.com)
**
diff --git a/src/gui/image/qpaintengine_pic_p.h b/src/gui/image/qpaintengine_pic_p.h
index 4307e3ad69..830867d89d 100644
--- a/src/gui/image/qpaintengine_pic_p.h
+++ b/src/gui/image/qpaintengine_pic_p.h
@@ -1,6 +1,6 @@
/****************************************************************************
**
-** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies).
+** Copyright (C) 2012 Nokia Corporation and/or its subsidiary(-ies).
** All rights reserved.
** Contact: Nokia Corporation (qt-info@nokia.com)
**
diff --git a/src/gui/image/qpicture.cpp b/src/gui/image/qpicture.cpp
index dfc84c56d8..1ca34df356 100644
--- a/src/gui/image/qpicture.cpp
+++ b/src/gui/image/qpicture.cpp
@@ -1,6 +1,6 @@
/****************************************************************************
**
-** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies).
+** Copyright (C) 2012 Nokia Corporation and/or its subsidiary(-ies).
** All rights reserved.
** Contact: Nokia Corporation (qt-info@nokia.com)
**
@@ -1008,17 +1008,6 @@ int QPicture::metric(PaintDeviceMetric m) const
\internal
*/
-/*! \internal
-### Qt 5 - remove me
- */
-void QPicture::detach_helper()
-{
- // QExplicitelySharedDataPointer takes care of cloning using
- // QPicturePrivate's copy constructor. Do not call detach_helper() anymore
- // and remove in Qt 5, please.
- Q_ASSERT_X(false, "QPicture::detach_helper()", "Do not call this function");
-}
-
/*!
Assigns picture \a p to this picture and returns a reference to
this picture.
diff --git a/src/gui/image/qpicture.h b/src/gui/image/qpicture.h
index 1c5d3a9c8f..e408d65cbc 100644
--- a/src/gui/image/qpicture.h
+++ b/src/gui/image/qpicture.h
@@ -1,6 +1,6 @@
/****************************************************************************
**
-** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies).
+** Copyright (C) 2012 Nokia Corporation and/or its subsidiary(-ies).
** All rights reserved.
** Contact: Nokia Corporation (qt-info@nokia.com)
**
@@ -107,7 +107,6 @@ protected:
private:
bool exec(QPainter *p, QDataStream &ds, int i);
- void detach_helper();
QExplicitlySharedDataPointer<QPicturePrivate> d_ptr;
friend class QPicturePaintEngine;
diff --git a/src/gui/image/qpicture_p.h b/src/gui/image/qpicture_p.h
index 097ba72e60..8c68d19558 100644
--- a/src/gui/image/qpicture_p.h
+++ b/src/gui/image/qpicture_p.h
@@ -1,6 +1,6 @@
/****************************************************************************
**
-** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies).
+** Copyright (C) 2012 Nokia Corporation and/or its subsidiary(-ies).
** All rights reserved.
** Contact: Nokia Corporation (qt-info@nokia.com)
**
diff --git a/src/gui/image/qpictureformatplugin.cpp b/src/gui/image/qpictureformatplugin.cpp
index 175406e661..558d4febce 100644
--- a/src/gui/image/qpictureformatplugin.cpp
+++ b/src/gui/image/qpictureformatplugin.cpp
@@ -1,6 +1,6 @@
/****************************************************************************
**
-** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies).
+** Copyright (C) 2012 Nokia Corporation and/or its subsidiary(-ies).
** All rights reserved.
** Contact: Nokia Corporation (qt-info@nokia.com)
**
diff --git a/src/gui/image/qpictureformatplugin.h b/src/gui/image/qpictureformatplugin.h
index b030c05913..9fd79c001d 100644
--- a/src/gui/image/qpictureformatplugin.h
+++ b/src/gui/image/qpictureformatplugin.h
@@ -1,6 +1,6 @@
/****************************************************************************
**
-** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies).
+** Copyright (C) 2012 Nokia Corporation and/or its subsidiary(-ies).
** All rights reserved.
** Contact: Nokia Corporation (qt-info@nokia.com)
**
diff --git a/src/gui/image/qpixmap.cpp b/src/gui/image/qpixmap.cpp
index 2a2bd5d6fa..48d393cc24 100644
--- a/src/gui/image/qpixmap.cpp
+++ b/src/gui/image/qpixmap.cpp
@@ -1,6 +1,6 @@
/****************************************************************************
**
-** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies).
+** Copyright (C) 2012 Nokia Corporation and/or its subsidiary(-ies).
** All rights reserved.
** Contact: Nokia Corporation (qt-info@nokia.com)
**
@@ -1631,4 +1631,12 @@ QPlatformPixmap* QPixmap::handle() const
return data.data();
}
+#ifndef QT_NO_DEBUG_STREAM
+QDebug operator<<(QDebug dbg, const QPixmap &r)
+{
+ dbg.nospace() << "QPixmap(" << r.size() << ')';
+ return dbg.space();
+}
+#endif
+
QT_END_NAMESPACE
diff --git a/src/gui/image/qpixmap.h b/src/gui/image/qpixmap.h
index ea73119538..5e8ef70828 100644
--- a/src/gui/image/qpixmap.h
+++ b/src/gui/image/qpixmap.h
@@ -1,6 +1,6 @@
/****************************************************************************
**
-** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies).
+** Copyright (C) 2012 Nokia Corporation and/or its subsidiary(-ies).
** All rights reserved.
** Contact: Nokia Corporation (qt-info@nokia.com)
**
@@ -238,6 +238,10 @@ Q_GUI_EXPORT QDataStream &operator<<(QDataStream &, const QPixmap &);
Q_GUI_EXPORT QDataStream &operator>>(QDataStream &, QPixmap &);
#endif
+#ifndef QT_NO_DEBUG_STREAM
+Q_GUI_EXPORT QDebug operator<<(QDebug, const QPixmap &);
+#endif
+
QT_END_NAMESPACE
QT_END_HEADER
diff --git a/src/gui/image/qpixmap_blitter.cpp b/src/gui/image/qpixmap_blitter.cpp
index 2a47a891c7..041c11af3a 100644
--- a/src/gui/image/qpixmap_blitter.cpp
+++ b/src/gui/image/qpixmap_blitter.cpp
@@ -1,6 +1,6 @@
/****************************************************************************
**
-** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies).
+** Copyright (C) 2012 Nokia Corporation and/or its subsidiary(-ies).
** All rights reserved.
** Contact: Nokia Corporation (qt-info@nokia.com)
**
diff --git a/src/gui/image/qpixmap_blitter_p.h b/src/gui/image/qpixmap_blitter_p.h
index b0a9b7f848..42d649642f 100644
--- a/src/gui/image/qpixmap_blitter_p.h
+++ b/src/gui/image/qpixmap_blitter_p.h
@@ -1,6 +1,6 @@
/****************************************************************************
**
-** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies).
+** Copyright (C) 2012 Nokia Corporation and/or its subsidiary(-ies).
** All rights reserved.
** Contact: Nokia Corporation (qt-info@nokia.com)
**
@@ -72,8 +72,11 @@ public:
void markRasterOverlay(const QRectF &);
void markRasterOverlay(const QPointF &, const QTextItem &);
void markRasterOverlay(const QVectorPath &);
+ void markRasterOverlay(const QPainterPath &);
void markRasterOverlay(const QRect *rects, int rectCount);
void markRasterOverlay(const QRectF *rects, int rectCount);
+ void markRasterOverlay(const QPointF *points, int pointCount);
+ void markRasterOverlay(const QPoint *points, int pointCount);
void unmarkRasterOverlay(const QRectF &);
#ifdef QT_BLITTER_RASTEROVERLAY
@@ -153,6 +156,35 @@ inline void QBlittablePlatformPixmap::markRasterOverlay(const QRectF *rects, int
#endif
}
+inline void QBlittablePlatformPixmap::markRasterOverlay(const QPointF *points, int pointCount)
+{
+#ifdef QT_BLITTER_RASTEROVERLAY
+#error "not ported yet"
+#else
+ Q_UNUSED(points);
+ Q_UNUSED(pointCount);
+#endif
+}
+
+inline void QBlittablePlatformPixmap::markRasterOverlay(const QPoint *points, int pointCount)
+{
+#ifdef QT_BLITTER_RASTEROVERLAY
+#error "not ported yet"
+#else
+ Q_UNUSED(points);
+ Q_UNUSED(pointCount);
+#endif
+}
+
+inline void QBlittablePlatformPixmap::markRasterOverlay(const QPainterPath& path)
+{
+#ifdef QT_BLITTER_RASTEROVERLAY
+#error "not ported yet"
+#else
+ Q_UNUSED(path);
+#endif
+}
+
inline void QBlittablePlatformPixmap::unmarkRasterOverlay(const QRectF &rect)
{
#ifdef QT_BLITTER_RASTEROVERLAY
diff --git a/src/gui/image/qpixmap_qpa.cpp b/src/gui/image/qpixmap_qpa.cpp
index 4fe162efd8..7f2ff2e266 100644
--- a/src/gui/image/qpixmap_qpa.cpp
+++ b/src/gui/image/qpixmap_qpa.cpp
@@ -1,6 +1,6 @@
/****************************************************************************
**
-** Copyright (C) 2009 Nokia Corporation and/or its subsidiary(-ies).
+** Copyright (C) 2012 Nokia Corporation and/or its subsidiary(-ies).
** All rights reserved.
** Contact: Nokia Corporation (qt-info@nokia.com)
**
diff --git a/src/gui/image/qpixmap_raster.cpp b/src/gui/image/qpixmap_raster.cpp
index 887074c7b7..424572ebd4 100644
--- a/src/gui/image/qpixmap_raster.cpp
+++ b/src/gui/image/qpixmap_raster.cpp
@@ -1,6 +1,6 @@
/****************************************************************************
**
-** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies).
+** Copyright (C) 2012 Nokia Corporation and/or its subsidiary(-ies).
** All rights reserved.
** Contact: Nokia Corporation (qt-info@nokia.com)
**
diff --git a/src/gui/image/qpixmap_raster_p.h b/src/gui/image/qpixmap_raster_p.h
index 91ed4cfdc5..de4d0e6f17 100644
--- a/src/gui/image/qpixmap_raster_p.h
+++ b/src/gui/image/qpixmap_raster_p.h
@@ -1,6 +1,6 @@
/****************************************************************************
**
-** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies).
+** Copyright (C) 2012 Nokia Corporation and/or its subsidiary(-ies).
** All rights reserved.
** Contact: Nokia Corporation (qt-info@nokia.com)
**
diff --git a/src/gui/image/qpixmap_win.cpp b/src/gui/image/qpixmap_win.cpp
index f46d503936..5ee7ca9eba 100644
--- a/src/gui/image/qpixmap_win.cpp
+++ b/src/gui/image/qpixmap_win.cpp
@@ -1,6 +1,6 @@
/****************************************************************************
**
-** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies).
+** Copyright (C) 2012 Nokia Corporation and/or its subsidiary(-ies).
** All rights reserved.
** Contact: Nokia Corporation (qt-info@nokia.com)
**
diff --git a/src/gui/image/qpixmapcache.cpp b/src/gui/image/qpixmapcache.cpp
index 94f38347c1..0f874bee6c 100644
--- a/src/gui/image/qpixmapcache.cpp
+++ b/src/gui/image/qpixmapcache.cpp
@@ -1,6 +1,6 @@
/****************************************************************************
**
-** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies).
+** Copyright (C) 2012 Nokia Corporation and/or its subsidiary(-ies).
** All rights reserved.
** Contact: Nokia Corporation (qt-info@nokia.com)
**
diff --git a/src/gui/image/qpixmapcache.h b/src/gui/image/qpixmapcache.h
index e5c20c8e78..81f9f4b028 100644
--- a/src/gui/image/qpixmapcache.h
+++ b/src/gui/image/qpixmapcache.h
@@ -1,6 +1,6 @@
/****************************************************************************
**
-** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies).
+** Copyright (C) 2012 Nokia Corporation and/or its subsidiary(-ies).
** All rights reserved.
** Contact: Nokia Corporation (qt-info@nokia.com)
**
diff --git a/src/gui/image/qpixmapcache_p.h b/src/gui/image/qpixmapcache_p.h
index 7b96f5a2cf..2f609a8471 100644
--- a/src/gui/image/qpixmapcache_p.h
+++ b/src/gui/image/qpixmapcache_p.h
@@ -1,6 +1,6 @@
/****************************************************************************
**
-** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies).
+** Copyright (C) 2012 Nokia Corporation and/or its subsidiary(-ies).
** All rights reserved.
** Contact: Nokia Corporation (qt-info@nokia.com)
**
diff --git a/src/gui/image/qplatformpixmap.cpp b/src/gui/image/qplatformpixmap.cpp
index e1bf944d9b..30f1f4819b 100644
--- a/src/gui/image/qplatformpixmap.cpp
+++ b/src/gui/image/qplatformpixmap.cpp
@@ -1,6 +1,6 @@
/****************************************************************************
**
-** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies).
+** Copyright (C) 2012 Nokia Corporation and/or its subsidiary(-ies).
** All rights reserved.
** Contact: Nokia Corporation (qt-info@nokia.com)
**
diff --git a/src/gui/image/qplatformpixmap_qpa.h b/src/gui/image/qplatformpixmap_qpa.h
index ad0a8dc69e..13c3bc2fe8 100644
--- a/src/gui/image/qplatformpixmap_qpa.h
+++ b/src/gui/image/qplatformpixmap_qpa.h
@@ -1,6 +1,6 @@
/****************************************************************************
**
-** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies).
+** Copyright (C) 2012 Nokia Corporation and/or its subsidiary(-ies).
** All rights reserved.
** Contact: Nokia Corporation (qt-info@nokia.com)
**
diff --git a/src/gui/image/qpnghandler.cpp b/src/gui/image/qpnghandler.cpp
index 1714442eb6..a935ea3a28 100644
--- a/src/gui/image/qpnghandler.cpp
+++ b/src/gui/image/qpnghandler.cpp
@@ -1,6 +1,6 @@
/****************************************************************************
**
-** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies).
+** Copyright (C) 2012 Nokia Corporation and/or its subsidiary(-ies).
** All rights reserved.
** Contact: Nokia Corporation (qt-info@nokia.com)
**
diff --git a/src/gui/image/qpnghandler_p.h b/src/gui/image/qpnghandler_p.h
index 1ee22d73c9..8f17bd18a4 100644
--- a/src/gui/image/qpnghandler_p.h
+++ b/src/gui/image/qpnghandler_p.h
@@ -1,6 +1,6 @@
/****************************************************************************
**
-** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies).
+** Copyright (C) 2012 Nokia Corporation and/or its subsidiary(-ies).
** All rights reserved.
** Contact: Nokia Corporation (qt-info@nokia.com)
**
diff --git a/src/gui/image/qppmhandler.cpp b/src/gui/image/qppmhandler.cpp
index e4dbde8ece..b08f97a3ca 100644
--- a/src/gui/image/qppmhandler.cpp
+++ b/src/gui/image/qppmhandler.cpp
@@ -1,6 +1,6 @@
/****************************************************************************
**
-** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies).
+** Copyright (C) 2012 Nokia Corporation and/or its subsidiary(-ies).
** All rights reserved.
** Contact: Nokia Corporation (qt-info@nokia.com)
**
diff --git a/src/gui/image/qppmhandler_p.h b/src/gui/image/qppmhandler_p.h
index a1cd9594e9..43e9b09f70 100644
--- a/src/gui/image/qppmhandler_p.h
+++ b/src/gui/image/qppmhandler_p.h
@@ -1,6 +1,6 @@
/****************************************************************************
**
-** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies).
+** Copyright (C) 2012 Nokia Corporation and/or its subsidiary(-ies).
** All rights reserved.
** Contact: Nokia Corporation (qt-info@nokia.com)
**
diff --git a/src/gui/image/qtiffhandler.cpp b/src/gui/image/qtiffhandler.cpp
index 4dc9775d46..475622021b 100644
--- a/src/gui/image/qtiffhandler.cpp
+++ b/src/gui/image/qtiffhandler.cpp
@@ -1,6 +1,6 @@
/****************************************************************************
**
-** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies).
+** Copyright (C) 2012 Nokia Corporation and/or its subsidiary(-ies).
** All rights reserved.
** Contact: Nokia Corporation (qt-info@nokia.com)
**
@@ -496,13 +496,13 @@ bool QTiffHandler::write(const QImage &image)
}
//// write the color table
// allocate the color tables
- uint16 *redTable = static_cast<uint16 *>(qMalloc(256 * sizeof(uint16)));
- uint16 *greenTable = static_cast<uint16 *>(qMalloc(256 * sizeof(uint16)));
- uint16 *blueTable = static_cast<uint16 *>(qMalloc(256 * sizeof(uint16)));
+ uint16 *redTable = static_cast<uint16 *>(malloc(256 * sizeof(uint16)));
+ uint16 *greenTable = static_cast<uint16 *>(malloc(256 * sizeof(uint16)));
+ uint16 *blueTable = static_cast<uint16 *>(malloc(256 * sizeof(uint16)));
if (!redTable || !greenTable || !blueTable) {
- qFree(redTable);
- qFree(greenTable);
- qFree(blueTable);
+ free(redTable);
+ free(greenTable);
+ free(blueTable);
TIFFClose(tiff);
return false;
}
@@ -519,9 +519,9 @@ bool QTiffHandler::write(const QImage &image)
const bool setColorTableSuccess = TIFFSetField(tiff, TIFFTAG_COLORMAP, redTable, greenTable, blueTable);
- qFree(redTable);
- qFree(greenTable);
- qFree(blueTable);
+ free(redTable);
+ free(greenTable);
+ free(blueTable);
if (!setColorTableSuccess) {
TIFFClose(tiff);
diff --git a/src/gui/image/qtiffhandler_p.h b/src/gui/image/qtiffhandler_p.h
index 4cbcfacaec..16e68b0ad6 100644
--- a/src/gui/image/qtiffhandler_p.h
+++ b/src/gui/image/qtiffhandler_p.h
@@ -1,6 +1,6 @@
/****************************************************************************
**
-** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies).
+** Copyright (C) 2012 Nokia Corporation and/or its subsidiary(-ies).
** All rights reserved.
** Contact: Nokia Corporation (qt-info@nokia.com)
**
diff --git a/src/gui/image/qvolatileimage.cpp b/src/gui/image/qvolatileimage.cpp
index 8fd3620b4b..e675e4ca67 100644
--- a/src/gui/image/qvolatileimage.cpp
+++ b/src/gui/image/qvolatileimage.cpp
@@ -1,6 +1,6 @@
/****************************************************************************
**
-** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies).
+** Copyright (C) 2012 Nokia Corporation and/or its subsidiary(-ies).
** All rights reserved.
** Contact: Nokia Corporation (qt-info@nokia.com)
**
diff --git a/src/gui/image/qvolatileimage_p.h b/src/gui/image/qvolatileimage_p.h
index 91f8ce3598..8f1664c429 100644
--- a/src/gui/image/qvolatileimage_p.h
+++ b/src/gui/image/qvolatileimage_p.h
@@ -1,6 +1,6 @@
/****************************************************************************
**
-** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies).
+** Copyright (C) 2012 Nokia Corporation and/or its subsidiary(-ies).
** All rights reserved.
** Contact: Nokia Corporation (qt-info@nokia.com)
**
diff --git a/src/gui/image/qvolatileimagedata.cpp b/src/gui/image/qvolatileimagedata.cpp
index a2a7f71697..32f265e9d9 100644
--- a/src/gui/image/qvolatileimagedata.cpp
+++ b/src/gui/image/qvolatileimagedata.cpp
@@ -1,6 +1,6 @@
/****************************************************************************
**
-** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies).
+** Copyright (C) 2012 Nokia Corporation and/or its subsidiary(-ies).
** All rights reserved.
** Contact: Nokia Corporation (qt-info@nokia.com)
**
diff --git a/src/gui/image/qvolatileimagedata_p.h b/src/gui/image/qvolatileimagedata_p.h
index 9f817874a4..2890530aaa 100644
--- a/src/gui/image/qvolatileimagedata_p.h
+++ b/src/gui/image/qvolatileimagedata_p.h
@@ -1,6 +1,6 @@
/****************************************************************************
**
-** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies).
+** Copyright (C) 2012 Nokia Corporation and/or its subsidiary(-ies).
** All rights reserved.
** Contact: Nokia Corporation (qt-info@nokia.com)
**
diff --git a/src/gui/image/qvolatileimagedata_symbian.cpp b/src/gui/image/qvolatileimagedata_symbian.cpp
index 6984722c0f..f438d96e68 100644
--- a/src/gui/image/qvolatileimagedata_symbian.cpp
+++ b/src/gui/image/qvolatileimagedata_symbian.cpp
@@ -1,6 +1,6 @@
/****************************************************************************
**
-** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies).
+** Copyright (C) 2012 Nokia Corporation and/or its subsidiary(-ies).
** All rights reserved.
** Contact: Nokia Corporation (qt-info@nokia.com)
**
diff --git a/src/gui/image/qxbmhandler.cpp b/src/gui/image/qxbmhandler.cpp
index 04756ac351..dda57239cc 100644
--- a/src/gui/image/qxbmhandler.cpp
+++ b/src/gui/image/qxbmhandler.cpp
@@ -1,6 +1,6 @@
/****************************************************************************
**
-** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies).
+** Copyright (C) 2012 Nokia Corporation and/or its subsidiary(-ies).
** All rights reserved.
** Contact: Nokia Corporation (qt-info@nokia.com)
**
diff --git a/src/gui/image/qxbmhandler_p.h b/src/gui/image/qxbmhandler_p.h
index 8fc6bda3f9..13ab343f8b 100644
--- a/src/gui/image/qxbmhandler_p.h
+++ b/src/gui/image/qxbmhandler_p.h
@@ -1,6 +1,6 @@
/****************************************************************************
**
-** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies).
+** Copyright (C) 2012 Nokia Corporation and/or its subsidiary(-ies).
** All rights reserved.
** Contact: Nokia Corporation (qt-info@nokia.com)
**
diff --git a/src/gui/image/qxpmhandler.cpp b/src/gui/image/qxpmhandler.cpp
index a3779fc041..48047d2d55 100644
--- a/src/gui/image/qxpmhandler.cpp
+++ b/src/gui/image/qxpmhandler.cpp
@@ -1,6 +1,6 @@
/****************************************************************************
**
-** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies).
+** Copyright (C) 2012 Nokia Corporation and/or its subsidiary(-ies).
** All rights reserved.
** Contact: Nokia Corporation (qt-info@nokia.com)
**
diff --git a/src/gui/image/qxpmhandler_p.h b/src/gui/image/qxpmhandler_p.h
index 35cf142db5..092d9bb3f1 100644
--- a/src/gui/image/qxpmhandler_p.h
+++ b/src/gui/image/qxpmhandler_p.h
@@ -1,6 +1,6 @@
/****************************************************************************
**
-** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies).
+** Copyright (C) 2012 Nokia Corporation and/or its subsidiary(-ies).
** All rights reserved.
** Contact: Nokia Corporation (qt-info@nokia.com)
**
diff --git a/src/gui/kernel/kernel.pri b/src/gui/kernel/kernel.pri
index 57ed3a983a..bf552c9991 100644
--- a/src/gui/kernel/kernel.pri
+++ b/src/gui/kernel/kernel.pri
@@ -13,6 +13,7 @@ HEADERS += \
kernel/qplatformintegration_qpa.h \
kernel/qplatformdrag_qpa.h \
kernel/qplatformscreen_qpa.h \
+ kernel/qplatformscreen_qpa_p.h \
kernel/qplatforminputcontext_qpa.h \
kernel/qplatformintegrationfactory_qpa_p.h \
kernel/qplatformintegrationplugin_qpa.h \
@@ -50,6 +51,7 @@ HEADERS += \
kernel/qsessionmanager.h \
kernel/qwindowdefs.h \
kernel/qscreen.h \
+ kernel/qscreen_p.h \
kernel/qstylehints.h \
kernel/qtouchdevice.h \
kernel/qtouchdevice_p.h
diff --git a/src/gui/kernel/qclipboard.cpp b/src/gui/kernel/qclipboard.cpp
index 970d365af8..341b042328 100644
--- a/src/gui/kernel/qclipboard.cpp
+++ b/src/gui/kernel/qclipboard.cpp
@@ -1,6 +1,6 @@
/****************************************************************************
**
-** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies).
+** Copyright (C) 2012 Nokia Corporation and/or its subsidiary(-ies).
** All rights reserved.
** Contact: Nokia Corporation (qt-info@nokia.com)
**
diff --git a/src/gui/kernel/qclipboard.h b/src/gui/kernel/qclipboard.h
index 6902a1362b..b909889815 100644
--- a/src/gui/kernel/qclipboard.h
+++ b/src/gui/kernel/qclipboard.h
@@ -1,6 +1,6 @@
/****************************************************************************
**
-** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies).
+** Copyright (C) 2012 Nokia Corporation and/or its subsidiary(-ies).
** All rights reserved.
** Contact: Nokia Corporation (qt-info@nokia.com)
**
diff --git a/src/gui/kernel/qclipboard_qpa.cpp b/src/gui/kernel/qclipboard_qpa.cpp
index 737b2131c0..edcf21babc 100644
--- a/src/gui/kernel/qclipboard_qpa.cpp
+++ b/src/gui/kernel/qclipboard_qpa.cpp
@@ -1,6 +1,6 @@
/****************************************************************************
**
-** Copyright (C) 2009 Nokia Corporation and/or its subsidiary(-ies).
+** Copyright (C) 2012 Nokia Corporation and/or its subsidiary(-ies).
** All rights reserved.
** Contact: Nokia Corporation (qt-info@nokia.com)
**
diff --git a/src/gui/kernel/qcursor.cpp b/src/gui/kernel/qcursor.cpp
index faa9500f9f..bd327e1eb1 100644
--- a/src/gui/kernel/qcursor.cpp
+++ b/src/gui/kernel/qcursor.cpp
@@ -1,6 +1,6 @@
/****************************************************************************
**
-** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies).
+** Copyright (C) 2012 Nokia Corporation and/or its subsidiary(-ies).
** All rights reserved.
** Contact: Nokia Corporation (qt-info@nokia.com)
**
@@ -49,6 +49,7 @@
#include <qdatastream.h>
#include <qvariant.h>
#include <private/qcursor_p.h>
+#include <qdebug.h>
QT_BEGIN_NAMESPACE
@@ -564,6 +565,15 @@ QCursor::operator QVariant() const
{
return QVariant(QVariant::Cursor, this);
}
+
+#ifndef QT_NO_DEBUG_STREAM
+QDebug operator<<(QDebug dbg, const QCursor &c)
+{
+ dbg.nospace() << "QCursor(Qt::CursorShape(" << c.shape() << "))";
+ return dbg.space();
+}
+#endif
+
QT_END_NAMESPACE
#endif // QT_NO_CURSOR
diff --git a/src/gui/kernel/qcursor.h b/src/gui/kernel/qcursor.h
index 584aff42d3..7437da4aba 100644
--- a/src/gui/kernel/qcursor.h
+++ b/src/gui/kernel/qcursor.h
@@ -1,6 +1,6 @@
/****************************************************************************
**
-** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies).
+** Copyright (C) 2012 Nokia Corporation and/or its subsidiary(-ies).
** All rights reserved.
** Contact: Nokia Corporation (qt-info@nokia.com)
**
@@ -126,6 +126,11 @@ private:
Q_GUI_EXPORT QDataStream &operator<<(QDataStream &outS, const QCursor &cursor);
Q_GUI_EXPORT QDataStream &operator>>(QDataStream &inS, QCursor &cursor);
#endif
+
+#ifndef QT_NO_DEBUG_STREAM
+Q_GUI_EXPORT QDebug operator<<(QDebug, const QCursor &);
+#endif
+
#endif // QT_NO_CURSOR
QT_END_NAMESPACE
diff --git a/src/gui/kernel/qcursor_p.h b/src/gui/kernel/qcursor_p.h
index 71a07cca49..a904260388 100644
--- a/src/gui/kernel/qcursor_p.h
+++ b/src/gui/kernel/qcursor_p.h
@@ -1,6 +1,6 @@
/****************************************************************************
**
-** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies).
+** Copyright (C) 2012 Nokia Corporation and/or its subsidiary(-ies).
** All rights reserved.
** Contact: Nokia Corporation (qt-info@nokia.com)
**
diff --git a/src/gui/kernel/qcursor_qpa.cpp b/src/gui/kernel/qcursor_qpa.cpp
index 7b3059e1df..6a12f977d3 100644
--- a/src/gui/kernel/qcursor_qpa.cpp
+++ b/src/gui/kernel/qcursor_qpa.cpp
@@ -1,6 +1,6 @@
/****************************************************************************
**
-** Copyright (C) 2009 Nokia Corporation and/or its subsidiary(-ies).
+** Copyright (C) 2012 Nokia Corporation and/or its subsidiary(-ies).
** All rights reserved.
** Contact: Nokia Corporation (qt-info@nokia.com)
**
diff --git a/src/gui/kernel/qdnd.cpp b/src/gui/kernel/qdnd.cpp
index 4edcfa886f..4010fd73ff 100644
--- a/src/gui/kernel/qdnd.cpp
+++ b/src/gui/kernel/qdnd.cpp
@@ -1,6 +1,6 @@
/****************************************************************************
**
-** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies).
+** Copyright (C) 2012 Nokia Corporation and/or its subsidiary(-ies).
** All rights reserved.
** Contact: Nokia Corporation (qt-info@nokia.com)
**
diff --git a/src/gui/kernel/qdnd_p.h b/src/gui/kernel/qdnd_p.h
index 548e3d2e77..47018edde8 100644
--- a/src/gui/kernel/qdnd_p.h
+++ b/src/gui/kernel/qdnd_p.h
@@ -1,6 +1,6 @@
/****************************************************************************
**
-** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies).
+** Copyright (C) 2012 Nokia Corporation and/or its subsidiary(-ies).
** All rights reserved.
** Contact: Nokia Corporation (qt-info@nokia.com)
**
diff --git a/src/gui/kernel/qdrag.cpp b/src/gui/kernel/qdrag.cpp
index 399c467643..284b1e5c1b 100644
--- a/src/gui/kernel/qdrag.cpp
+++ b/src/gui/kernel/qdrag.cpp
@@ -1,6 +1,6 @@
/****************************************************************************
**
-** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies).
+** Copyright (C) 2012 Nokia Corporation and/or its subsidiary(-ies).
** All rights reserved.
** Contact: Nokia Corporation (qt-info@nokia.com)
**
diff --git a/src/gui/kernel/qdrag.h b/src/gui/kernel/qdrag.h
index b590c4f015..ccadd8f1cc 100644
--- a/src/gui/kernel/qdrag.h
+++ b/src/gui/kernel/qdrag.h
@@ -1,6 +1,6 @@
/****************************************************************************
**
-** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies).
+** Copyright (C) 2012 Nokia Corporation and/or its subsidiary(-ies).
** All rights reserved.
** Contact: Nokia Corporation (qt-info@nokia.com)
**
diff --git a/src/gui/kernel/qevent.cpp b/src/gui/kernel/qevent.cpp
index 035f1b2666..61ccaa5cfd 100644
--- a/src/gui/kernel/qevent.cpp
+++ b/src/gui/kernel/qevent.cpp
@@ -1,6 +1,6 @@
/****************************************************************************
**
-** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies).
+** Copyright (C) 2012 Nokia Corporation and/or its subsidiary(-ies).
** All rights reserved.
** Contact: Nokia Corporation (qt-info@nokia.com)
**
@@ -941,15 +941,6 @@ QFocusEvent::~QFocusEvent()
{
}
-// ### Qt 5: remove
-/*!
- \internal
- */
-Qt::FocusReason QFocusEvent::reason()
-{
- return m_reason;
-}
-
/*!
Returns the reason for this focus event.
*/
@@ -3232,13 +3223,6 @@ QClipboardEvent::~QClipboardEvent()
Returns the key sequence that triggered the event.
*/
-// ### Qt 5: remove
-/*!
- \fn const QKeySequence &QShortcutEvent::key()
-
- \internal
-*/
-
/*!
\fn int QShortcutEvent::shortcutId() const
@@ -3248,14 +3232,6 @@ QClipboardEvent::~QClipboardEvent()
\sa QShortcut::id()
*/
-// ### Qt 5: remove
-/*!
- \fn int QShortcutEvent::shortcutId()
- \overload
-
- \internal
-*/
-
/*!
\fn bool QShortcutEvent::isAmbiguous() const
@@ -3265,13 +3241,6 @@ QClipboardEvent::~QClipboardEvent()
\sa QShortcut::activatedAmbiguously()
*/
-// ### Qt 5: remove
-/*!
- \fn bool QShortcutEvent::isAmbiguous()
-
- \internal
-*/
-
/*!
\class QWindowStateChangeEvent
\ingroup events
@@ -3354,7 +3323,7 @@ QWindowStateChangeEvent::~QWindowStateChangeEvent()
\section1 Event Delivery and Propagation
- By default, QWidget::event() translates the first non-primary touch point in a QTouchEvent into
+ By default, QGuiApplication translates the first touch point in a QTouchEvent into
a QMouseEvent. This makes it possible to enable touch events on existing widgets that do not
normally handle QTouchEvent. See below for information on some special considerations needed
when doing this.
@@ -3392,17 +3361,12 @@ QWindowStateChangeEvent::~QWindowStateChangeEvent()
This makes it possible for sibling widgets to handle touch events independently while making
sure that the sequence of QTouchEvents is always correct.
- \section1 Mouse Events and the Primary Touch Point
+ \section1 Mouse Events and Touch Event synthesizing
- QTouchEvent delivery is independent from that of QMouseEvent. On some windowing systems, mouse
- events are also sent for the \l{QTouchEvent::TouchPoint::isPrimary()}{primary touch point}.
- This means it is possible for your widget to receive both QTouchEvent and QMouseEvent for the
- same user interaction point. You can use the QTouchEvent::TouchPoint::isPrimary() function to
- identify the primary touch point.
-
- Note that on some systems, it is possible to receive touch events without a primary touch
- point. All this means is that there will be no mouse event generated for the touch points in
- the QTouchEvent.
+ QTouchEvent delivery is independent from that of QMouseEvent. The application flags
+ Qt::AA_SynthesizeTouchForUnhandledMouseEvents and Qt::AA_SynthesizeMouseForUnhandledTouchEvents
+ can be used to enable or disable automatic synthesizing of touch events to mouse events and
+ mouse events to touch events.
\section1 Caveats
@@ -3441,9 +3405,6 @@ QWindowStateChangeEvent::~QWindowStateChangeEvent()
\value TouchPointMoved The touch point moved.
\value TouchPointStationary The touch point did not move.
\value TouchPointReleased The touch point was released.
-
- \omitvalue TouchPointStateMask
- \omitvalue TouchPointPrimary
*/
/*! \enum QTouchEvent::DeviceType
@@ -3467,7 +3428,8 @@ QTouchEvent::QTouchEvent(QEvent::Type eventType,
Qt::TouchPointStates touchPointStates,
const QList<QTouchEvent::TouchPoint> &touchPoints)
: QInputEvent(eventType, modifiers),
- _widget(0),
+ _window(0),
+ _target(0),
_device(device),
_touchPointStates(touchPointStates),
_touchPoints(touchPoints)
@@ -3479,11 +3441,6 @@ QTouchEvent::QTouchEvent(QEvent::Type eventType,
QTouchEvent::~QTouchEvent()
{ }
-/*! \fn QWidget *QTouchEvent::widget() const
-
- Returns the widget on which the event occurred.
-*/
-
/*! \fn QWindow *QTouchEvent::window() const
Returns the window on which the event occurred. Useful for doing
@@ -3492,6 +3449,12 @@ QTouchEvent::~QTouchEvent()
touch event.
*/
+/*! \fn QObject *QTouchEvent::target() const
+
+ Returns the target object within the window on which the event occurred.
+ This is typically a QWidget or a QQuickItem. May be 0 when no specific target is available.
+*/
+
/*! \fn QTouchEvent::DeviceType QTouchEvent::deviceType() const
Returns the touch device Type, which is of type \l {QTouchEvent::DeviceType} {DeviceType}.
@@ -3521,18 +3484,18 @@ QTouchEvent::~QTouchEvent()
Returns the touch device from which this touch event originates.
*/
-/*! \fn void QTouchEvent::setWidget(QWidget *widget)
+/*! \fn void QTouchEvent::setWindow(QWindow *window)
\internal
- Sets the widget for this event.
+ Sets the window for this event.
*/
-/*! \fn void QTouchEvent::setWindow(QWindow *window)
+/*! \fn void QTouchEvent::setTarget(QObject *target)
\internal
- Sets the window for this event.
+ Sets the target within the window (typically a widget) for this event.
*/
/*! \fn void QTouchEvent::setTouchPointStates(Qt::TouchPointStates touchPointStates)
@@ -3621,16 +3584,7 @@ int QTouchEvent::TouchPoint::id() const
*/
Qt::TouchPointState QTouchEvent::TouchPoint::state() const
{
- return Qt::TouchPointState(int(d->state) & Qt::TouchPointStateMask);
-}
-
-/*!
- Returns true if this touch point is the primary touch point. The primary touch point is the
- point for which the windowing system generates mouse events.
-*/
-bool QTouchEvent::TouchPoint::isPrimary() const
-{
- return (d->state & Qt::TouchPointPrimary) != 0;
+ return Qt::TouchPointState(int(d->state));
}
/*!
diff --git a/src/gui/kernel/qevent.h b/src/gui/kernel/qevent.h
index 6a0442509c..a59b178cec 100644
--- a/src/gui/kernel/qevent.h
+++ b/src/gui/kernel/qevent.h
@@ -1,6 +1,6 @@
/****************************************************************************
**
-** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies).
+** Copyright (C) 2012 Nokia Corporation and/or its subsidiary(-ies).
** All rights reserved.
** Contact: Nokia Corporation (qt-info@nokia.com)
**
@@ -266,7 +266,6 @@ public:
inline bool gotFocus() const { return type() == FocusIn; }
inline bool lostFocus() const { return type() == FocusOut; }
- Qt::FocusReason reason();
Qt::FocusReason reason() const;
private:
@@ -639,11 +638,8 @@ public:
QShortcutEvent(const QKeySequence &key, int id, bool ambiguous = false);
~QShortcutEvent();
- inline const QKeySequence &key() { return sequence; }
inline const QKeySequence &key() const { return sequence; }
- inline int shortcutId() { return sid; }
inline int shortcutId() const { return sid; }
- inline bool isAmbiguous() { return ambig; }
inline bool isAmbiguous() const { return ambig; }
protected:
QKeySequence sequence;
@@ -694,7 +690,7 @@ public:
{
public:
enum InfoFlag {
- Pen = 0x0001
+ Pen = 0x0001
};
Q_DECLARE_FLAGS(InfoFlags, InfoFlag)
@@ -705,7 +701,6 @@ public:
int id() const;
Qt::TouchPointState state() const;
- bool isPrimary() const;
QPointF pos() const;
QPointF startPos() const;
@@ -776,23 +771,23 @@ public:
const QList<QTouchEvent::TouchPoint> &touchPoints = QList<QTouchEvent::TouchPoint>());
~QTouchEvent();
- inline QWidget *widget() const { return _widget; }
inline QWindow *window() const { return _window; }
+ inline QObject *target() const { return _target; }
QT_DEPRECATED inline QTouchEvent::DeviceType deviceType() const { return static_cast<DeviceType>(int(_device->type())); }
inline Qt::TouchPointStates touchPointStates() const { return _touchPointStates; }
inline const QList<QTouchEvent::TouchPoint> &touchPoints() const { return _touchPoints; }
inline QTouchDevice *device() const { return _device; }
// internal
- inline void setWidget(QWidget *awidget) { _widget = awidget; }
inline void setWindow(QWindow *awindow) { _window = awindow; }
+ inline void setTarget(QObject *atarget) { _target = atarget; }
inline void setTouchPointStates(Qt::TouchPointStates aTouchPointStates) { _touchPointStates = aTouchPointStates; }
inline void setTouchPoints(const QList<QTouchEvent::TouchPoint> &atouchPoints) { _touchPoints = atouchPoints; }
- inline void setDevice(QTouchDevice *device) { _device = device; }
+ inline void setDevice(QTouchDevice *adevice) { _device = adevice; }
protected:
- QWidget *_widget;
QWindow *_window;
+ QObject *_target;
QTouchDevice *_device;
Qt::TouchPointStates _touchPointStates;
QList<QTouchEvent::TouchPoint> _touchPoints;
diff --git a/src/gui/kernel/qevent_p.h b/src/gui/kernel/qevent_p.h
index 1eee92d176..6dff55ca14 100644
--- a/src/gui/kernel/qevent_p.h
+++ b/src/gui/kernel/qevent_p.h
@@ -1,6 +1,6 @@
/****************************************************************************
**
-** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies).
+** Copyright (C) 2012 Nokia Corporation and/or its subsidiary(-ies).
** All rights reserved.
** Contact: Nokia Corporation (qt-info@nokia.com)
**
diff --git a/src/gui/kernel/qgenericplugin_qpa.cpp b/src/gui/kernel/qgenericplugin_qpa.cpp
index e7b65b730e..23733e3ea9 100644
--- a/src/gui/kernel/qgenericplugin_qpa.cpp
+++ b/src/gui/kernel/qgenericplugin_qpa.cpp
@@ -1,6 +1,6 @@
/****************************************************************************
**
-** Copyright (C) 2009 Nokia Corporation and/or its subsidiary(-ies).
+** Copyright (C) 2012 Nokia Corporation and/or its subsidiary(-ies).
** All rights reserved.
** Contact: Nokia Corporation (qt-info@nokia.com)
**
diff --git a/src/gui/kernel/qgenericplugin_qpa.h b/src/gui/kernel/qgenericplugin_qpa.h
index c4dd5a9df0..196304d2a4 100644
--- a/src/gui/kernel/qgenericplugin_qpa.h
+++ b/src/gui/kernel/qgenericplugin_qpa.h
@@ -1,6 +1,6 @@
/****************************************************************************
**
-** Copyright (C) 2009 Nokia Corporation and/or its subsidiary(-ies).
+** Copyright (C) 2012 Nokia Corporation and/or its subsidiary(-ies).
** All rights reserved.
** Contact: Nokia Corporation (qt-info@nokia.com)
**
diff --git a/src/gui/kernel/qgenericpluginfactory_qpa.cpp b/src/gui/kernel/qgenericpluginfactory_qpa.cpp
index 7c0975ac1d..4735604837 100644
--- a/src/gui/kernel/qgenericpluginfactory_qpa.cpp
+++ b/src/gui/kernel/qgenericpluginfactory_qpa.cpp
@@ -1,6 +1,6 @@
/****************************************************************************
**
-** Copyright (C) 2009 Nokia Corporation and/or its subsidiary(-ies).
+** Copyright (C) 2012 Nokia Corporation and/or its subsidiary(-ies).
** All rights reserved.
** Contact: Nokia Corporation (qt-info@nokia.com)
**
diff --git a/src/gui/kernel/qgenericpluginfactory_qpa.h b/src/gui/kernel/qgenericpluginfactory_qpa.h
index 2359de9aa9..2d1550ffac 100644
--- a/src/gui/kernel/qgenericpluginfactory_qpa.h
+++ b/src/gui/kernel/qgenericpluginfactory_qpa.h
@@ -1,6 +1,6 @@
/****************************************************************************
**
-** Copyright (C) 2009 Nokia Corporation and/or its subsidiary(-ies).
+** Copyright (C) 2012 Nokia Corporation and/or its subsidiary(-ies).
** All rights reserved.
** Contact: Nokia Corporation (qt-info@nokia.com)
**
diff --git a/src/gui/kernel/qguiapplication.cpp b/src/gui/kernel/qguiapplication.cpp
index 6d5e210e82..f92e66b38e 100644
--- a/src/gui/kernel/qguiapplication.cpp
+++ b/src/gui/kernel/qguiapplication.cpp
@@ -1,6 +1,6 @@
/****************************************************************************
**
-** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies).
+** Copyright (C) 2012 Nokia Corporation and/or its subsidiary(-ies).
** All rights reserved.
** Contact: Nokia Corporation (qt-info@nokia.com)
**
@@ -57,6 +57,7 @@
#include <QtDebug>
#include <qpalette.h>
#include <qscreen.h>
+#include <private/qscreen_p.h>
#include <QtGui/QPlatformIntegration>
#include <QtGui/QGenericPluginFactory>
@@ -68,7 +69,6 @@
#include <QWindowSystemInterface>
#include "private/qwindowsysteminterface_qpa_p.h"
#include "private/qwindow_p.h"
-#include "private/qkeymapper_p.h"
#include "private/qcursor_p.h"
#include "private/qdnd_p.h"
#include <private/qplatformthemefactory_qpa_p.h>
@@ -113,6 +113,7 @@ static Qt::LayoutDirection layout_direction = Qt::LeftToRight;
static bool force_reverse = false;
QGuiApplicationPrivate *QGuiApplicationPrivate::self = 0;
+QTouchDevice *QGuiApplicationPrivate::m_fakeTouchDevice = 0;
#ifndef QT_NO_CLIPBOARD
QClipboard *QGuiApplicationPrivate::qt_clipboard = 0;
@@ -186,6 +187,7 @@ QGuiApplicationPrivate::QGuiApplicationPrivate(int &argc, char **argv, int flags
inputPanel(0)
{
self = this;
+ application_type = QCoreApplication::GuiClient;
}
QWindow *QGuiApplication::focusWindow()
@@ -333,6 +335,16 @@ void QGuiApplicationPrivate::createPlatformIntegration()
// Load the platform integration
QString platformPluginPath = QLatin1String(qgetenv("QT_QPA_PLATFORM_PLUGIN_PATH"));
+
+ // On Mac, look inside the application bundle for the platform plugin.
+ // TODO (msorvig): Create proper cross-platform solution for loading
+ // deployed platform plugins
+#ifdef Q_OS_MAC
+ if (platformPluginPath.isEmpty()) {
+ platformPluginPath = QCoreApplication::applicationDirPath() + QLatin1String("../Plugins/");
+ }
+#endif
+
QByteArray platformName;
#ifdef QT_QPA_DEFAULT_PLATFORM_NAME
platformName = QT_QPA_DEFAULT_PLATFORM_NAME;
@@ -678,7 +690,38 @@ void QGuiApplicationPrivate::processMouseEvent(QWindowSystemInterfacePrivate::Mo
cursors.at(i).data()->pointerEvent(ev);
#endif
QGuiApplication::sendSpontaneousEvent(window, &ev);
- return;
+ if (!e->synthetic && !ev.isAccepted() && qApp->testAttribute(Qt::AA_SynthesizeTouchForUnhandledMouseEvents)) {
+ if (!m_fakeTouchDevice) {
+ m_fakeTouchDevice = new QTouchDevice;
+ QWindowSystemInterface::registerTouchDevice(m_fakeTouchDevice);
+ }
+ QList<QWindowSystemInterface::TouchPoint> points;
+ QWindowSystemInterface::TouchPoint point;
+ point.id = 1;
+ point.area = QRectF(globalPoint.x() - 2, globalPoint.y() - 2, 4, 4);
+
+ // only translate left button related events to
+ // avoid strange touch event sequences when several
+ // buttons are pressed
+ if (type == QEvent::MouseButtonPress && button == Qt::LeftButton) {
+ point.state = Qt::TouchPointPressed;
+ } else if (type == QEvent::MouseButtonRelease && button == Qt::LeftButton) {
+ point.state = Qt::TouchPointReleased;
+ } else if (type == QEvent::MouseMove && (buttons & Qt::LeftButton)) {
+ point.state = Qt::TouchPointMoved;
+ } else {
+ return;
+ }
+
+ points << point;
+
+ QEvent::Type type;
+ QList<QTouchEvent::TouchPoint> touchPoints = QWindowSystemInterfacePrivate::convertTouchPoints(points, &type);
+
+ QWindowSystemInterfacePrivate::TouchEvent fake(window, e->timestamp, type, m_fakeTouchDevice, touchPoints, e->modifiers);
+ fake.synthetic = true;
+ processTouchEvent(&fake);
+ }
}
}
@@ -742,9 +785,6 @@ void QGuiApplicationPrivate::processLeaveEvent(QWindowSystemInterfacePrivate::Le
void QGuiApplicationPrivate::processActivatedEvent(QWindowSystemInterfacePrivate::ActivatedWindowEvent *e)
{
- if (!e->activated)
- return;
-
QWindow *previous = QGuiApplicationPrivate::focus_window;
QGuiApplicationPrivate::focus_window = e->activated.data();
@@ -754,10 +794,18 @@ void QGuiApplicationPrivate::processActivatedEvent(QWindowSystemInterfacePrivate
if (previous) {
QFocusEvent focusOut(QEvent::FocusOut);
QCoreApplication::sendSpontaneousEvent(previous, &focusOut);
+ } else {
+ QEvent appActivate(QEvent::ApplicationActivate);
+ qApp->sendSpontaneousEvent(qApp, &appActivate);
}
- QFocusEvent focusIn(QEvent::FocusIn);
- QCoreApplication::sendSpontaneousEvent(QGuiApplicationPrivate::focus_window, &focusIn);
+ if (QGuiApplicationPrivate::focus_window) {
+ QFocusEvent focusIn(QEvent::FocusIn);
+ QCoreApplication::sendSpontaneousEvent(QGuiApplicationPrivate::focus_window, &focusIn);
+ } else {
+ QEvent appActivate(QEvent::ApplicationDeactivate);
+ qApp->sendSpontaneousEvent(qApp, &appActivate);
+ }
if (self)
self->notifyActiveWindowChange(previous);
@@ -822,6 +870,18 @@ void QGuiApplicationPrivate::processCloseEvent(QWindowSystemInterfacePrivate::Cl
QGuiApplication::sendSpontaneousEvent(e->window.data(), &event);
}
+Q_GUI_EXPORT uint qHash(const QGuiApplicationPrivate::ActiveTouchPointsKey &k)
+{
+ return qHash(k.device) + k.touchPointId;
+}
+
+Q_GUI_EXPORT bool operator==(const QGuiApplicationPrivate::ActiveTouchPointsKey &a,
+ const QGuiApplicationPrivate::ActiveTouchPointsKey &b)
+{
+ return a.device == b.device
+ && a.touchPointId == b.touchPointId;
+}
+
void QGuiApplicationPrivate::processTouchEvent(QWindowSystemInterfacePrivate::TouchEvent *e)
{
QWindow *window = e->window.data();
@@ -839,13 +899,15 @@ void QGuiApplicationPrivate::processTouchEvent(QWindowSystemInterfacePrivate::To
// update state
QWeakPointer<QWindow> w;
QTouchEvent::TouchPoint previousTouchPoint;
+ ActiveTouchPointsKey touchInfoKey(e->device, touchPoint.id());
+ ActiveTouchPointsValue &touchInfo = d->activeTouchPoints[touchInfoKey];
switch (touchPoint.state()) {
case Qt::TouchPointPressed:
if (e->device->type() == QTouchDevice::TouchPad) {
// on touch-pads, send all touch points to the same widget
- w = d->windowForTouchPointId.isEmpty()
+ w = d->activeTouchPoints.isEmpty()
? QWeakPointer<QWindow>()
- : d->windowForTouchPointId.constBegin().value();
+ : d->activeTouchPoints.constBegin().value().window;
}
if (!w) {
@@ -857,7 +919,7 @@ void QGuiApplicationPrivate::processTouchEvent(QWindowSystemInterfacePrivate::To
w = window;
}
- d->windowForTouchPointId[touchPoint.id()] = w;
+ touchInfo.window = w;
touchPoint.d->startScreenPos = touchPoint.screenPos();
touchPoint.d->lastScreenPos = touchPoint.screenPos();
touchPoint.d->startNormalizedPos = touchPoint.normalizedPos();
@@ -865,14 +927,15 @@ void QGuiApplicationPrivate::processTouchEvent(QWindowSystemInterfacePrivate::To
if (touchPoint.pressure() < qreal(0.))
touchPoint.d->pressure = qreal(1.);
- d->appCurrentTouchPoints.insert(touchPoint.id(), touchPoint);
+ touchInfo.touchPoint = touchPoint;
break;
case Qt::TouchPointReleased:
- w = d->windowForTouchPointId.take(touchPoint.id());
+ w = touchInfo.window;
if (!w)
continue;
- previousTouchPoint = d->appCurrentTouchPoints.take(touchPoint.id());
+
+ previousTouchPoint = touchInfo.touchPoint;
touchPoint.d->startScreenPos = previousTouchPoint.startScreenPos();
touchPoint.d->lastScreenPos = previousTouchPoint.screenPos();
touchPoint.d->startPos = previousTouchPoint.startPos();
@@ -881,14 +944,15 @@ void QGuiApplicationPrivate::processTouchEvent(QWindowSystemInterfacePrivate::To
touchPoint.d->lastNormalizedPos = previousTouchPoint.normalizedPos();
if (touchPoint.pressure() < qreal(0.))
touchPoint.d->pressure = qreal(0.);
+
break;
default:
- w = d->windowForTouchPointId.value(touchPoint.id());
+ w = touchInfo.window;
if (!w)
continue;
- Q_ASSERT(d->appCurrentTouchPoints.contains(touchPoint.id()));
- previousTouchPoint = d->appCurrentTouchPoints.value(touchPoint.id());
+
+ previousTouchPoint = touchInfo.touchPoint;
touchPoint.d->startScreenPos = previousTouchPoint.startScreenPos();
touchPoint.d->lastScreenPos = previousTouchPoint.screenPos();
touchPoint.d->startPos = previousTouchPoint.startPos();
@@ -901,7 +965,7 @@ void QGuiApplicationPrivate::processTouchEvent(QWindowSystemInterfacePrivate::To
// Stationary points might not be delivered down to the receiving item
// and get their position transformed, keep the old values instead.
if (touchPoint.state() != Qt::TouchPointStationary)
- d->appCurrentTouchPoints[touchPoint.id()] = touchPoint;
+ touchInfo.touchPoint = touchPoint;
break;
}
@@ -914,8 +978,6 @@ void QGuiApplicationPrivate::processTouchEvent(QWindowSystemInterfacePrivate::To
StatesAndTouchPoints &maskAndPoints = windowsNeedingEvents[w.data()];
maskAndPoints.first |= touchPoint.state();
- if (touchPoint.isPrimary())
- maskAndPoints.first |= Qt::TouchPointPrimary;
maskAndPoints.second.append(touchPoint);
}
@@ -928,7 +990,7 @@ void QGuiApplicationPrivate::processTouchEvent(QWindowSystemInterfacePrivate::To
QWindow *w = it.key();
QEvent::Type eventType;
- switch (it.value().first & Qt::TouchPointStateMask) {
+ switch (it.value().first) {
case Qt::TouchPointPressed:
eventType = QEvent::TouchBegin;
break;
@@ -969,6 +1031,28 @@ void QGuiApplicationPrivate::processTouchEvent(QWindowSystemInterfacePrivate::To
}
QGuiApplication::sendSpontaneousEvent(w, &touchEvent);
+ if (!e->synthetic && !touchEvent.isAccepted() && qApp->testAttribute(Qt::AA_SynthesizeMouseForUnhandledTouchEvents)) {
+ // exclude touchpads as those generate their own mouse events
+ if (touchEvent.device()->type() != QTouchDevice::TouchPad) {
+ Qt::MouseButtons b = eventType == QEvent::TouchEnd ? Qt::NoButton : Qt::LeftButton;
+
+ const QTouchEvent::TouchPoint &touchPoint = touchEvent.touchPoints().first();
+
+ QWindowSystemInterfacePrivate::MouseEvent fake(w, e->timestamp, touchPoint.pos(), touchPoint.screenPos(), b, e->modifiers);
+ fake.synthetic = true;
+ processMouseEvent(&fake);
+ }
+ }
+ }
+
+ // Remove released points from the hash table only after the event is
+ // delivered. When the receiver is a widget, QApplication will access
+ // activeTouchPoints during delivery and therefore nothing can be removed
+ // before sending the event.
+ for (int i = 0; i < e->points.count(); ++i) {
+ QTouchEvent::TouchPoint touchPoint = e->points.at(i);
+ if (touchPoint.state() == Qt::TouchPointReleased)
+ d->activeTouchPoints.remove(ActiveTouchPointsKey(e->device, touchPoint.id()));
}
}
@@ -982,6 +1066,8 @@ void QGuiApplicationPrivate::reportScreenOrientationChange(QWindowSystemInterfac
return;
QScreen *s = e->screen.data();
+ s->d_func()->currentOrientation = e->orientation;
+
emit s->currentOrientationChanged(s->currentOrientation());
QScreenOrientationChangeEvent event(s, s->currentOrientation());
@@ -998,6 +1084,7 @@ void QGuiApplicationPrivate::reportGeometryChange(QWindowSystemInterfacePrivate:
return;
QScreen *s = e->screen.data();
+ s->d_func()->geometry = e->geometry;
emit s->sizeChanged(s->size());
emit s->geometryChanged(s->geometry());
@@ -1019,6 +1106,7 @@ void QGuiApplicationPrivate::reportAvailableGeometryChange(
return;
QScreen *s = e->screen.data();
+ s->d_func()->availableGeometry = e->availableGeometry;
emit s->availableSizeChanged(s->availableSize());
emit s->availableGeometryChanged(s->availableGeometry());
@@ -1034,6 +1122,7 @@ void QGuiApplicationPrivate::reportLogicalDotsPerInchChange(QWindowSystemInterfa
return;
QScreen *s = e->screen.data();
+ s->d_func()->logicalDpi = QDpi(e->dpiX, e->dpiY);
emit s->logicalDotsPerInchXChanged(s->logicalDotsPerInchX());
emit s->logicalDotsPerInchYChanged(s->logicalDotsPerInchY());
@@ -1140,6 +1229,16 @@ QPalette QGuiApplication::palette()
return *QGuiApplicationPrivate::app_pal;
}
+void QGuiApplication::setPalette(const QPalette &pal)
+{
+ if (QGuiApplicationPrivate::app_pal && pal.isCopyOf(*QGuiApplicationPrivate::app_pal))
+ return;
+ if (!QGuiApplicationPrivate::app_pal)
+ QGuiApplicationPrivate::app_pal = new QPalette(pal);
+ else
+ *QGuiApplicationPrivate::app_pal = pal;
+}
+
QFont QGuiApplication::font()
{
QMutexLocker locker(applicationFontMutex());
@@ -1423,26 +1522,24 @@ uint QGuiApplicationPrivate::currentKeyPlatform()
/*!
\since 4.2
+ \obsolete
- Returns the current keyboard input locale.
+ Returns the current keyboard input locale. Replaced with QInputPanel::locale()
*/
QLocale QGuiApplication::keyboardInputLocale()
{
- if (!QGuiApplicationPrivate::checkInstance("keyboardInputLocale"))
- return QLocale::c();
- return qt_keymapper_private()->keyboardInputLocale;
+ return qApp ? qApp->inputPanel()->locale() : QLocale::c();
}
/*!
\since 4.2
+ \obsolete
- Returns the current keyboard input direction.
+ Returns the current keyboard input direction. Replaced with QInputPanel::inputDirection()
*/
Qt::LayoutDirection QGuiApplication::keyboardInputDirection()
{
- if (!QGuiApplicationPrivate::checkInstance("keyboardInputDirection"))
- return Qt::LeftToRight;
- return qt_keymapper_private()->keyboardInputDirection;
+ return qApp ? qApp->inputPanel()->inputDirection() : Qt::LeftToRight;
}
/*!
diff --git a/src/gui/kernel/qguiapplication.h b/src/gui/kernel/qguiapplication.h
index 1afbf17cf7..dd7b1f8806 100644
--- a/src/gui/kernel/qguiapplication.h
+++ b/src/gui/kernel/qguiapplication.h
@@ -1,6 +1,6 @@
/****************************************************************************
**
-** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies).
+** Copyright (C) 2012 Nokia Corporation and/or its subsidiary(-ies).
** All rights reserved.
** Contact: Nokia Corporation (qt-info@nokia.com)
**
@@ -108,6 +108,7 @@ public:
#endif
static QPalette palette();
+ static void setPalette(const QPalette &pal);
static Qt::KeyboardModifiers keyboardModifiers();
static Qt::MouseButtons mouseButtons();
@@ -118,9 +119,8 @@ public:
static inline bool isRightToLeft() { return layoutDirection() == Qt::RightToLeft; }
static inline bool isLeftToRight() { return layoutDirection() == Qt::LeftToRight; }
- // ### move to QInputPanel
- static QLocale keyboardInputLocale();
- static Qt::LayoutDirection keyboardInputDirection();
+ QT_DEPRECATED static QLocale keyboardInputLocale();
+ QT_DEPRECATED static Qt::LayoutDirection keyboardInputDirection();
QStyleHints *styleHints() const;
QInputPanel *inputPanel() const;
diff --git a/src/gui/kernel/qguiapplication_p.h b/src/gui/kernel/qguiapplication_p.h
index 9c8a2ca642..9c965cd109 100644
--- a/src/gui/kernel/qguiapplication_p.h
+++ b/src/gui/kernel/qguiapplication_p.h
@@ -1,6 +1,6 @@
/****************************************************************************
**
-** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies).
+** Copyright (C) 2012 Nokia Corporation and/or its subsidiary(-ies).
** All rights reserved.
** Contact: Nokia Corporation (qt-info@nokia.com)
**
@@ -189,15 +189,30 @@ public:
QShortcutMap shortcutMap;
#endif
+ struct ActiveTouchPointsKey {
+ ActiveTouchPointsKey(QTouchDevice *dev, int id) : device(dev), touchPointId(id) { }
+ QTouchDevice *device;
+ int touchPointId;
+ };
+ struct ActiveTouchPointsValue {
+ QWeakPointer<QWindow> window;
+ QWeakPointer<QObject> target;
+ QTouchEvent::TouchPoint touchPoint;
+ };
+ QHash<ActiveTouchPointsKey, ActiveTouchPointsValue> activeTouchPoints;
+
private:
void init();
static QGuiApplicationPrivate *self;
-
- QMap<int, QWeakPointer<QWindow> > windowForTouchPointId;
- QMap<int, QTouchEvent::TouchPoint> appCurrentTouchPoints;
+ static QTouchDevice *m_fakeTouchDevice;
};
+Q_GUI_EXPORT uint qHash(const QGuiApplicationPrivate::ActiveTouchPointsKey &k);
+
+Q_GUI_EXPORT bool operator==(const QGuiApplicationPrivate::ActiveTouchPointsKey &a,
+ const QGuiApplicationPrivate::ActiveTouchPointsKey &b);
+
QT_END_NAMESPACE
QT_END_HEADER
diff --git a/src/gui/kernel/qguivariant.cpp b/src/gui/kernel/qguivariant.cpp
index 3b60f29e83..532a5353e2 100644
--- a/src/gui/kernel/qguivariant.cpp
+++ b/src/gui/kernel/qguivariant.cpp
@@ -1,6 +1,6 @@
/****************************************************************************
**
-** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies).
+** Copyright (C) 2012 Nokia Corporation and/or its subsidiary(-ies).
** All rights reserved.
** Contact: Nokia Corporation (qt-info@nokia.com)
**
@@ -79,6 +79,7 @@
#include "qstringlist.h"
#include "qurl.h"
#include "qlocale.h"
+#include "quuid.h"
#ifndef QT_NO_GEOM_VARIANT
#include "qsize.h"
@@ -94,8 +95,6 @@
QT_BEGIN_NAMESPACE
-Q_GUI_EXPORT const QVariant::Handler *qt_widgets_variant_handler = 0;
-
Q_CORE_EXPORT const QVariant::Handler *qcoreVariantHandler();
namespace {
@@ -136,53 +135,35 @@ template<> struct TypeDefiniton<QVector4D> { static const bool IsAvailable = fal
template<> struct TypeDefiniton<QQuaternion> { static const bool IsAvailable = false; };
#endif
-struct CoreAndGuiTypesFilter {
+struct GuiTypesFilter {
template<typename T>
struct Acceptor {
- static const bool IsAccepted = (QTypeModuleInfo<T>::IsCore || QTypeModuleInfo<T>::IsGui) && TypeDefiniton<T>::IsAvailable;
+ static const bool IsAccepted = QTypeModuleInfo<T>::IsGui && TypeDefiniton<T>::IsAvailable;
};
};
-} // namespace
+} // namespace used to hide TypeDefinition
+namespace {
static void construct(QVariant::Private *x, const void *copy)
{
const int type = x->type;
- QVariantConstructor<CoreAndGuiTypesFilter> constructor(x, copy);
- QMetaTypeSwitcher::switcher<void>(constructor, type, 0);
-
- // FIXME This is an ugly hack if QVariantConstructor fails to build a value it constructs an invalid type
- if (Q_UNLIKELY(x->type == QVariant::Invalid)) {
- if (type == 62) {
- // small 'trick' to let a QVariant(Qt::blue) create a variant
- // of type QColor
- // TODO Get rid of this hack.
- x->type = QVariant::Color;
- QColor color(*reinterpret_cast<const Qt::GlobalColor *>(copy));
- v_construct<QColor>(x, &color);
- return;
- }
- if (type == QVariant::Icon || type == QVariant::SizePolicy) {
- // TODO we need to clean up variant handlers, so they are replacament, not extension
- x->type = type;
- if (qt_widgets_variant_handler) {
- qt_widgets_variant_handler->construct(x, copy);
- }
- }
+ if (Q_UNLIKELY(type == 62)) {
+ // small 'trick' to let a QVariant(Qt::blue) create a variant
+ // of type QColor
+ // TODO Get rid of this hack.
+ x->type = QVariant::Color;
+ QColor color(*reinterpret_cast<const Qt::GlobalColor *>(copy));
+ v_construct<QColor>(x, &color);
+ return;
}
+ QVariantConstructor<GuiTypesFilter> constructor(x, copy);
+ QMetaTypeSwitcher::switcher<void>(constructor, type, 0);
}
static void clear(QVariant::Private *d)
{
- const int type = d->type;
- if (type == QVariant::Icon || type == QVariant::SizePolicy) {
- // TODO we need to clean up variant handlers, so they are replacament, not extension
- if (qt_widgets_variant_handler) {
- qt_widgets_variant_handler->clear(d);
- return;
- }
- }
- QVariantDestructor<CoreAndGuiTypesFilter> destructor(d);
- QMetaTypeSwitcher::switcher<void>(destructor, type, 0);
+ QVariantDestructor<GuiTypesFilter> destructor(d);
+ QMetaTypeSwitcher::switcher<void>(destructor, d->type, 0);
}
// This class is a hack that customizes access to QPolygon
@@ -200,7 +181,7 @@ public:
};
static bool isNull(const QVariant::Private *d)
{
- QGuiVariantIsNull<CoreAndGuiTypesFilter> isNull(d);
+ QGuiVariantIsNull<GuiTypesFilter> isNull(d);
return QMetaTypeSwitcher::switcher<bool>(isNull, d->type, 0);
}
@@ -215,11 +196,6 @@ public:
template<typename T>
bool delegate(const T *p)
{
- if (Q_UNLIKELY(Base::m_a->type == QVariant::Icon || Base::m_a->type == QVariant::SizePolicy)) {
- // TODO we need to clean up variant handlers, so they are replacament, not extension
- if (Q_LIKELY(qt_widgets_variant_handler))
- return qt_widgets_variant_handler->compare(Base::m_a, Base::m_b);
- }
return Base::delegate(p);
}
bool delegate(const QPixmap*)
@@ -241,7 +217,7 @@ public:
static bool compare(const QVariant::Private *a, const QVariant::Private *b)
{
- QGuiVariantComparator<CoreAndGuiTypesFilter> comparator(a, b);
+ QGuiVariantComparator<GuiTypesFilter> comparator(a, b);
return QMetaTypeSwitcher::switcher<bool>(comparator, a->type, 0);
}
@@ -369,90 +345,9 @@ static bool convert(const QVariant::Private *d, QVariant::Type t,
#if !defined(QT_NO_DEBUG_STREAM) && !defined(Q_BROKEN_DEBUG_STREAM)
static void streamDebug(QDebug dbg, const QVariant &v)
{
- switch(v.type()) {
- case QVariant::Cursor:
-#ifndef QT_NO_CURSOR
-// dbg.nospace() << qvariant_cast<QCursor>(v); //FIXME
-#endif
- break;
- case QVariant::Bitmap:
-// dbg.nospace() << qvariant_cast<QBitmap>(v); //FIXME
- break;
- case QVariant::Polygon:
- dbg.nospace() << qvariant_cast<QPolygon>(v);
- break;
- case QVariant::Region:
- dbg.nospace() << qvariant_cast<QRegion>(v);
- break;
- case QVariant::Font:
-// dbg.nospace() << qvariant_cast<QFont>(v); //FIXME
- break;
- case QVariant::Matrix:
- dbg.nospace() << qvariant_cast<QMatrix>(v);
- break;
- case QVariant::Transform:
- dbg.nospace() << qvariant_cast<QTransform>(v);
- break;
- case QVariant::Pixmap:
-// dbg.nospace() << qvariant_cast<QPixmap>(v); //FIXME
- break;
- case QVariant::Image:
-// dbg.nospace() << qvariant_cast<QImage>(v); //FIXME
- break;
- case QVariant::Brush:
- dbg.nospace() << qvariant_cast<QBrush>(v);
- break;
- case QVariant::Color:
- dbg.nospace() << qvariant_cast<QColor>(v);
- break;
- case QVariant::Palette:
-// dbg.nospace() << qvariant_cast<QPalette>(v); //FIXME
- break;
-#ifndef QT_NO_ICON
- case QVariant::Icon:
-// dbg.nospace() << qvariant_cast<QIcon>(v); // FIXME
- break;
-#endif
- case QVariant::SizePolicy:
-// dbg.nospace() << qvariant_cast<QSizePolicy>(v); //FIXME
- break;
-#ifndef QT_NO_SHORTCUT
- case QVariant::KeySequence:
- dbg.nospace() << qvariant_cast<QKeySequence>(v);
- break;
-#endif
- case QVariant::Pen:
- dbg.nospace() << qvariant_cast<QPen>(v);
- break;
-#ifndef QT_NO_MATRIX4X4
- case QVariant::Matrix4x4:
- dbg.nospace() << qvariant_cast<QMatrix4x4>(v);
- break;
-#endif
-#ifndef QT_NO_VECTOR2D
- case QVariant::Vector2D:
- dbg.nospace() << qvariant_cast<QVector2D>(v);
- break;
-#endif
-#ifndef QT_NO_VECTOR3D
- case QVariant::Vector3D:
- dbg.nospace() << qvariant_cast<QVector3D>(v);
- break;
-#endif
-#ifndef QT_NO_VECTOR4D
- case QVariant::Vector4D:
- dbg.nospace() << qvariant_cast<QVector4D>(v);
- break;
-#endif
-#ifndef QT_NO_QUATERNION
- case QVariant::Quaternion:
- dbg.nospace() << qvariant_cast<QQuaternion>(v);
- break;
-#endif
- default:
- qcoreVariantHandler()->debugStream(dbg, v);
- break;
- }
+ QVariant::Private *d = const_cast<QVariant::Private *>(&v.data_ptr());
+ QVariantDebugStream<GuiTypesFilter> stream(dbg, d);
+ QMetaTypeSwitcher::switcher<void>(stream, d->type, 0);
}
#endif
@@ -474,29 +369,28 @@ const QVariant::Handler qt_gui_variant_handler = {
#endif
};
-extern Q_CORE_EXPORT const QMetaTypeInterface *qMetaTypeGuiHelper;
-
#define QT_IMPL_METATYPEINTERFACE_GUI_TYPES(MetaTypeName, MetaTypeId, RealName) \
- QMetaTypeInterface(static_cast<RealName*>(0)),
+ QT_METATYPE_INTERFACE_INIT(RealName),
static const QMetaTypeInterface qVariantGuiHelper[] = {
QT_FOR_EACH_STATIC_GUI_CLASS(QT_IMPL_METATYPEINTERFACE_GUI_TYPES)
};
#undef QT_IMPL_METATYPEINTERFACE_GUI_TYPES
+} // namespace used to hide QVariant handler
+
+extern Q_CORE_EXPORT const QMetaTypeInterface *qMetaTypeGuiHelper;
-static const QVariant::Handler *qt_guivariant_last_handler = 0;
void qRegisterGuiVariant()
{
- qt_guivariant_last_handler = QVariant::handler;
- QVariant::handler = &qt_gui_variant_handler;
+ QVariantPrivate::registerHandler(QModulesPrivate::Gui, &qt_gui_variant_handler);
qMetaTypeGuiHelper = qVariantGuiHelper;
}
Q_CONSTRUCTOR_FUNCTION(qRegisterGuiVariant)
void qUnregisterGuiVariant()
{
- QVariant::handler = qt_guivariant_last_handler;
+ QVariantPrivate::unregisterHandler(QModulesPrivate::Gui);
qMetaTypeGuiHelper = 0;
}
Q_DESTRUCTOR_FUNCTION(qUnregisterGuiVariant)
diff --git a/src/gui/kernel/qinputpanel.cpp b/src/gui/kernel/qinputpanel.cpp
index d6d58bf1c5..d6dd55b651 100644
--- a/src/gui/kernel/qinputpanel.cpp
+++ b/src/gui/kernel/qinputpanel.cpp
@@ -1,6 +1,6 @@
/****************************************************************************
**
-** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies).
+** Copyright (C) 2012 Nokia Corporation and/or its subsidiary(-ies).
** All rights reserved.
** Contact: Nokia Corporation (qt-info@nokia.com)
**
@@ -158,9 +158,9 @@ QRectF QInputPanel::cursorRectangle() const
\property QInputPanel::keyboardRectangle
\brief Virtual keyboard's geometry in window coordinates.
*/
-QRectF QInputPanel::keyboardRectangle()
+QRectF QInputPanel::keyboardRectangle() const
{
- Q_D(QInputPanel);
+ Q_D(const QInputPanel);
QPlatformInputContext *ic = d->platformInputContext();
if (ic)
return ic->keyboardRect();
@@ -248,6 +248,32 @@ bool QInputPanel::isAnimating() const
}
/*!
+ \property QInputPanel::locale
+ \brief Current input locale.
+*/
+QLocale QInputPanel::locale() const
+{
+ Q_D(const QInputPanel);
+ QPlatformInputContext *ic = d->platformInputContext();
+ if (ic)
+ return ic->locale();
+ return QLocale::c();
+}
+
+/*!
+ \property QInputPanel::inputDirection
+ \brief Current input direction.
+*/
+Qt::LayoutDirection QInputPanel::inputDirection() const
+{
+ Q_D(const QInputPanel);
+ QPlatformInputContext *ic = d->platformInputContext();
+ if (ic)
+ return ic->inputDirection();
+ return Qt::LeftToRight;
+}
+
+/*!
Called by the input item to inform the platform input methods when there has been
state changes in editor's input method query attributes. When calling the function
\a queries parameter has to be used to tell what has changes, which input method
diff --git a/src/gui/kernel/qinputpanel.h b/src/gui/kernel/qinputpanel.h
index 4edc902104..c33bd13451 100644
--- a/src/gui/kernel/qinputpanel.h
+++ b/src/gui/kernel/qinputpanel.h
@@ -1,6 +1,6 @@
/****************************************************************************
**
-** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies).
+** Copyright (C) 2012 Nokia Corporation and/or its subsidiary(-ies).
** All rights reserved.
** Contact: Nokia Corporation (qt-info@nokia.com)
**
@@ -64,6 +64,8 @@ class Q_GUI_EXPORT QInputPanel : public QObject
Q_PROPERTY(QRectF keyboardRectangle READ keyboardRectangle NOTIFY keyboardRectangleChanged)
Q_PROPERTY(bool visible READ visible NOTIFY visibleChanged)
Q_PROPERTY(bool animating READ isAnimating NOTIFY animatingChanged)
+ Q_PROPERTY(QLocale locale READ locale NOTIFY localeChanged)
+ Q_PROPERTY(Qt::LayoutDirection inputDirection READ inputDirection NOTIFY inputDirectionChanged)
Q_ENUMS(Action)
public:
@@ -80,7 +82,7 @@ public:
QRectF cursorRectangle() const; // ### what if we have rotations for the item?
// keyboard geometry in window coords
- QRectF keyboardRectangle();
+ QRectF keyboardRectangle() const;
enum Action {
Click,
@@ -92,6 +94,9 @@ public:
bool isAnimating() const;
+ QLocale locale() const;
+ Qt::LayoutDirection inputDirection() const;
+
public Q_SLOTS:
void show();
void hide();
@@ -108,6 +113,8 @@ Q_SIGNALS:
void keyboardRectangleChanged();
void visibleChanged();
void animatingChanged();
+ void localeChanged();
+ void inputDirectionChanged(Qt::LayoutDirection newDirection);
private:
friend class QGuiApplication;
diff --git a/src/gui/kernel/qinputpanel_p.h b/src/gui/kernel/qinputpanel_p.h
index 6fcf2d7243..f30c8a1b80 100644
--- a/src/gui/kernel/qinputpanel_p.h
+++ b/src/gui/kernel/qinputpanel_p.h
@@ -1,6 +1,6 @@
/****************************************************************************
**
-** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies).
+** Copyright (C) 2012 Nokia Corporation and/or its subsidiary(-ies).
** All rights reserved.
** Contact: Nokia Corporation (qt-info@nokia.com)
**
diff --git a/src/gui/kernel/qkeymapper.cpp b/src/gui/kernel/qkeymapper.cpp
index 4ee7d66dd8..a411ee5904 100644
--- a/src/gui/kernel/qkeymapper.cpp
+++ b/src/gui/kernel/qkeymapper.cpp
@@ -1,6 +1,6 @@
/****************************************************************************
**
-** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies).
+** Copyright (C) 2012 Nokia Corporation and/or its subsidiary(-ies).
** All rights reserved.
** Contact: Nokia Corporation (qt-info@nokia.com)
**
diff --git a/src/gui/kernel/qkeymapper_p.h b/src/gui/kernel/qkeymapper_p.h
index 1fada6f59a..bf19f1d80a 100644
--- a/src/gui/kernel/qkeymapper_p.h
+++ b/src/gui/kernel/qkeymapper_p.h
@@ -1,6 +1,6 @@
/****************************************************************************
**
-** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies).
+** Copyright (C) 2012 Nokia Corporation and/or its subsidiary(-ies).
** All rights reserved.
** Contact: Nokia Corporation (qt-info@nokia.com)
**
diff --git a/src/gui/kernel/qkeymapper_qpa.cpp b/src/gui/kernel/qkeymapper_qpa.cpp
index 13c6d6c28b..fd04ff234c 100644
--- a/src/gui/kernel/qkeymapper_qpa.cpp
+++ b/src/gui/kernel/qkeymapper_qpa.cpp
@@ -1,6 +1,6 @@
/****************************************************************************
**
-** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies).
+** Copyright (C) 2012 Nokia Corporation and/or its subsidiary(-ies).
** All rights reserved.
** Contact: Nokia Corporation (qt-info@nokia.com)
**
diff --git a/src/gui/kernel/qkeysequence.cpp b/src/gui/kernel/qkeysequence.cpp
index 6ea502b70b..986701bd7b 100644
--- a/src/gui/kernel/qkeysequence.cpp
+++ b/src/gui/kernel/qkeysequence.cpp
@@ -1,6 +1,6 @@
/****************************************************************************
**
-** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies).
+** Copyright (C) 2012 Nokia Corporation and/or its subsidiary(-ies).
** All rights reserved.
** Contact: Nokia Corporation (qt-info@nokia.com)
**
@@ -1259,13 +1259,20 @@ int QKeySequencePrivate::decodeString(const QString &str, QKeySequence::Sequence
// Rational: A modifier will contain the name AND +, so longer than 1, a length of 1 is just
// the remaining part of the shortcut (ei. The 'C' in "Ctrl+C"), so no need to check that.
if (sub.length() > 1) {
+ bool validModifier = false;
for (int j = 0; j < modifs.size(); ++j) {
const QModifKeyName &mkf = modifs.at(j);
if (sub == mkf.name) {
ret |= mkf.qt_key;
+ validModifier = true;
break; // Shortcut, since if we find an other it would/should just be a dup
}
}
+ // We couldn't match the string with a modifier. This is only
+ // possible if this part is the key. The key is never followed by a
+ // '+'. And if the key is '+' the if() above would have skipped it.
+ if (!validModifier)
+ return Qt::Key_unknown;
}
lastI = i + 1;
}
@@ -1309,6 +1316,9 @@ int QKeySequencePrivate::decodeString(const QString &str, QKeySequence::Sequence
if (found)
break;
}
+ // We couldn't translate the key.
+ if (!found)
+ return Qt::Key_unknown;
}
return ret;
}
@@ -1335,6 +1345,11 @@ QString QKeySequencePrivate::encodeString(int key, QKeySequence::SequenceFormat
{
bool nativeText = (format == QKeySequence::NativeText);
QString s;
+
+ // Handle -1 (Invalid Key) and Qt::Key_unknown gracefully
+ if (key == -1 || key == Qt::Key_unknown)
+ return s;
+
#if defined(Q_OS_MAC)
if (nativeText) {
// On Mac OS X the order (by default) is Meta, Alt, Shift, Control.
diff --git a/src/gui/kernel/qkeysequence.h b/src/gui/kernel/qkeysequence.h
index 31cec17fb1..1127e8afca 100644
--- a/src/gui/kernel/qkeysequence.h
+++ b/src/gui/kernel/qkeysequence.h
@@ -1,6 +1,6 @@
/****************************************************************************
**
-** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies).
+** Copyright (C) 2012 Nokia Corporation and/or its subsidiary(-ies).
** All rights reserved.
** Contact: Nokia Corporation (qt-info@nokia.com)
**
diff --git a/src/gui/kernel/qkeysequence_p.h b/src/gui/kernel/qkeysequence_p.h
index 7fa98dd5eb..57f6e1927f 100644
--- a/src/gui/kernel/qkeysequence_p.h
+++ b/src/gui/kernel/qkeysequence_p.h
@@ -1,6 +1,6 @@
/****************************************************************************
**
-** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies).
+** Copyright (C) 2012 Nokia Corporation and/or its subsidiary(-ies).
** All rights reserved.
** Contact: Nokia Corporation (qt-info@nokia.com)
**
diff --git a/src/gui/kernel/qopenglcontext.cpp b/src/gui/kernel/qopenglcontext.cpp
index 6a9cb43028..93a4b3582b 100644
--- a/src/gui/kernel/qopenglcontext.cpp
+++ b/src/gui/kernel/qopenglcontext.cpp
@@ -1,6 +1,6 @@
/****************************************************************************
**
-** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies).
+** Copyright (C) 2012 Nokia Corporation and/or its subsidiary(-ies).
** All rights reserved.
** Contact: Nokia Corporation (qt-info@nokia.com)
**
@@ -174,6 +174,8 @@ bool QOpenGLContext::create()
void QOpenGLContext::destroy()
{
Q_D(QOpenGLContext);
+ if (d->platformGLContext)
+ emit aboutToBeDestroyed();
if (QOpenGLContext::currentContext() == this)
doneCurrent();
if (d->shareGroup)
@@ -186,6 +188,17 @@ void QOpenGLContext::destroy()
}
/*!
+ \fn void QOpenGLContext::aboutToBeDestroyed()
+
+ This signal is emitted before the underlying native OpenGL context is
+ destroyed, such that users may clean up OpenGL resources that might otherwise
+ be left dangling in the case of shared OpenGL contexts.
+
+ If you wish to make the context current in order to do clean-up, make sure to
+ only connect to the signal using a direct connection.
+*/
+
+/*!
If this is the current context for the thread, doneCurrent is called
*/
QOpenGLContext::~QOpenGLContext()
@@ -297,7 +310,7 @@ void QOpenGLContext::swapBuffers(QSurface *surface)
d->platformGLContext->swapBuffers(surfaceHandle);
}
-void (*QOpenGLContext::getProcAddress(const QByteArray &procName)) ()
+QFunctionPointer QOpenGLContext::getProcAddress(const QByteArray &procName)
{
Q_D(QOpenGLContext);
if (!d->platformGLContext)
diff --git a/src/gui/kernel/qopenglcontext.h b/src/gui/kernel/qopenglcontext.h
index b5a19a0ebc..a8ac39c7d5 100644
--- a/src/gui/kernel/qopenglcontext.h
+++ b/src/gui/kernel/qopenglcontext.h
@@ -1,6 +1,6 @@
/****************************************************************************
**
-** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies).
+** Copyright (C) 2012 Nokia Corporation and/or its subsidiary(-ies).
** All rights reserved.
** Contact: Nokia Corporation (qt-info@nokia.com)
**
@@ -106,7 +106,7 @@ public:
void doneCurrent();
void swapBuffers(QSurface *surface);
- void (*getProcAddress(const QByteArray &procName)) ();
+ QFunctionPointer getProcAddress(const QByteArray &procName);
QSurface *surface() const;
@@ -118,6 +118,9 @@ public:
QOpenGLFunctions *functions() const;
+Q_SIGNALS:
+ void aboutToBeDestroyed();
+
private:
friend class QGLContext;
friend class QOpenGLContextResourceBase;
diff --git a/src/gui/kernel/qopenglcontext_p.h b/src/gui/kernel/qopenglcontext_p.h
index aff1042c5b..7040b883bf 100644
--- a/src/gui/kernel/qopenglcontext_p.h
+++ b/src/gui/kernel/qopenglcontext_p.h
@@ -1,6 +1,6 @@
/****************************************************************************
**
-** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies).
+** Copyright (C) 2012 Nokia Corporation and/or its subsidiary(-ies).
** All rights reserved.
** Contact: Nokia Corporation (qt-info@nokia.com)
**
diff --git a/src/gui/kernel/qpalette.cpp b/src/gui/kernel/qpalette.cpp
index 893cc5eff6..2dd2ef00c5 100644
--- a/src/gui/kernel/qpalette.cpp
+++ b/src/gui/kernel/qpalette.cpp
@@ -1,6 +1,6 @@
/****************************************************************************
**
-** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies).
+** Copyright (C) 2012 Nokia Corporation and/or its subsidiary(-ies).
** All rights reserved.
** Contact: Nokia Corporation (qt-info@nokia.com)
**
@@ -43,6 +43,7 @@
#include "qguiapplication.h"
#include "qdatastream.h"
#include "qvariant.h"
+#include "qdebug.h"
QT_BEGIN_NAMESPACE
@@ -1081,4 +1082,12 @@ void QPalette::setColorGroup(ColorGroup cg, const QBrush &foreground, const QBru
setBrush(cg, ToolTipText, toolTipText);
}
+#ifndef QT_NO_DEBUG_STREAM
+QDebug operator<<(QDebug dbg, const QPalette &)
+{
+ dbg.nospace() << "QPalette()";
+ return dbg.space();
+}
+#endif
+
QT_END_NAMESPACE
diff --git a/src/gui/kernel/qpalette.h b/src/gui/kernel/qpalette.h
index dd59d121a0..d47854df07 100644
--- a/src/gui/kernel/qpalette.h
+++ b/src/gui/kernel/qpalette.h
@@ -1,6 +1,6 @@
/****************************************************************************
**
-** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies).
+** Copyright (C) 2012 Nokia Corporation and/or its subsidiary(-ies).
** All rights reserved.
** Contact: Nokia Corporation (qt-info@nokia.com)
**
@@ -190,6 +190,10 @@ Q_GUI_EXPORT QDataStream &operator<<(QDataStream &ds, const QPalette &p);
Q_GUI_EXPORT QDataStream &operator>>(QDataStream &ds, QPalette &p);
#endif // QT_NO_DATASTREAM
+#ifndef QT_NO_DEBUG_STREAM
+Q_GUI_EXPORT QDebug operator<<(QDebug, const QPalette &);
+#endif
+
QT_END_NAMESPACE
QT_END_HEADER
diff --git a/src/gui/kernel/qplatformclipboard_qpa.cpp b/src/gui/kernel/qplatformclipboard_qpa.cpp
index c7c779e4eb..4d8d65de0a 100644
--- a/src/gui/kernel/qplatformclipboard_qpa.cpp
+++ b/src/gui/kernel/qplatformclipboard_qpa.cpp
@@ -1,6 +1,6 @@
/****************************************************************************
**
-** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies).
+** Copyright (C) 2012 Nokia Corporation and/or its subsidiary(-ies).
** All rights reserved.
** Contact: Nokia Corporation (qt-info@nokia.com)
**
diff --git a/src/gui/kernel/qplatformclipboard_qpa.h b/src/gui/kernel/qplatformclipboard_qpa.h
index fc0505b87e..643733fdf7 100644
--- a/src/gui/kernel/qplatformclipboard_qpa.h
+++ b/src/gui/kernel/qplatformclipboard_qpa.h
@@ -1,6 +1,6 @@
/****************************************************************************
**
-** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies).
+** Copyright (C) 2012 Nokia Corporation and/or its subsidiary(-ies).
** All rights reserved.
** Contact: Nokia Corporation (qt-info@nokia.com)
**
diff --git a/src/gui/kernel/qplatformcursor_qpa.cpp b/src/gui/kernel/qplatformcursor_qpa.cpp
index 752de18969..a3824381d3 100644
--- a/src/gui/kernel/qplatformcursor_qpa.cpp
+++ b/src/gui/kernel/qplatformcursor_qpa.cpp
@@ -1,6 +1,6 @@
/****************************************************************************
**
-** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies).
+** Copyright (C) 2012 Nokia Corporation and/or its subsidiary(-ies).
** All rights reserved.
** Contact: Nokia Corporation (qt-info@nokia.com)
**
diff --git a/src/gui/kernel/qplatformcursor_qpa.h b/src/gui/kernel/qplatformcursor_qpa.h
index da3c4752a0..a2026425db 100644
--- a/src/gui/kernel/qplatformcursor_qpa.h
+++ b/src/gui/kernel/qplatformcursor_qpa.h
@@ -1,6 +1,6 @@
/****************************************************************************
**
-** Copyright (C) 2009 Nokia Corporation and/or its subsidiary(-ies).
+** Copyright (C) 2012 Nokia Corporation and/or its subsidiary(-ies).
** All rights reserved.
** Contact: Nokia Corporation (qt-info@nokia.com)
**
diff --git a/src/gui/kernel/qplatformdrag_qpa.h b/src/gui/kernel/qplatformdrag_qpa.h
index 0b65174f71..fb71f29de9 100644
--- a/src/gui/kernel/qplatformdrag_qpa.h
+++ b/src/gui/kernel/qplatformdrag_qpa.h
@@ -1,6 +1,6 @@
/****************************************************************************
**
-** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies).
+** Copyright (C) 2012 Nokia Corporation and/or its subsidiary(-ies).
** All rights reserved.
** Contact: Nokia Corporation (qt-info@nokia.com)
**
diff --git a/src/gui/kernel/qplatforminputcontext_qpa.cpp b/src/gui/kernel/qplatforminputcontext_qpa.cpp
index bc0bcf8f4f..1e82507653 100644
--- a/src/gui/kernel/qplatforminputcontext_qpa.cpp
+++ b/src/gui/kernel/qplatforminputcontext_qpa.cpp
@@ -1,6 +1,6 @@
/****************************************************************************
**
-** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies).
+** Copyright (C) 2012 Nokia Corporation and/or its subsidiary(-ies).
** All rights reserved.
** Contact: Nokia Corporation (qt-info@nokia.com)
**
@@ -42,6 +42,7 @@
#include <qplatforminputcontext_qpa.h>
#include <qguiapplication.h>
#include <QRect>
+#include "private/qkeymapper_p.h"
QT_BEGIN_NAMESPACE
@@ -207,4 +208,25 @@ void QPlatformInputContext::emitInputPanelVisibleChanged()
emit qApp->inputPanel()->visibleChanged();
}
+QLocale QPlatformInputContext::locale() const
+{
+ return qt_keymapper_private()->keyboardInputLocale;
+}
+
+void QPlatformInputContext::emitLocaleChanged()
+{
+ emit qApp->inputPanel()->localeChanged();
+}
+
+Qt::LayoutDirection QPlatformInputContext::inputDirection() const
+{
+ return qt_keymapper_private()->keyboardInputDirection;
+}
+
+void QPlatformInputContext::emitInputDirectionChanged(Qt::LayoutDirection newDirection)
+{
+ emit qApp->inputPanel()->inputDirectionChanged(newDirection);
+}
+
+
QT_END_NAMESPACE
diff --git a/src/gui/kernel/qplatforminputcontext_qpa.h b/src/gui/kernel/qplatforminputcontext_qpa.h
index 76aa122720..463238f336 100644
--- a/src/gui/kernel/qplatforminputcontext_qpa.h
+++ b/src/gui/kernel/qplatforminputcontext_qpa.h
@@ -1,6 +1,6 @@
/****************************************************************************
**
-** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies).
+** Copyright (C) 2012 Nokia Corporation and/or its subsidiary(-ies).
** All rights reserved.
** Contact: Nokia Corporation (qt-info@nokia.com)
**
@@ -77,6 +77,11 @@ public:
virtual void hideInputPanel();
virtual bool isInputPanelVisible() const;
void emitInputPanelVisibleChanged();
+
+ virtual QLocale locale() const;
+ void emitLocaleChanged();
+ virtual Qt::LayoutDirection inputDirection() const;
+ void emitInputDirectionChanged(Qt::LayoutDirection newDirection);
};
QT_END_NAMESPACE
diff --git a/src/gui/kernel/qplatformintegration_qpa.cpp b/src/gui/kernel/qplatformintegration_qpa.cpp
index 956180c728..23ecf3add4 100644
--- a/src/gui/kernel/qplatformintegration_qpa.cpp
+++ b/src/gui/kernel/qplatformintegration_qpa.cpp
@@ -1,6 +1,6 @@
/****************************************************************************
**
-** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies).
+** Copyright (C) 2012 Nokia Corporation and/or its subsidiary(-ies).
** All rights reserved.
** Contact: Nokia Corporation (qt-info@nokia.com)
**
@@ -46,6 +46,7 @@
#include <QtGui/QPlatformAccessibility>
#include <QtGui/private/qguiapplication_p.h>
#include <QtGui/private/qpixmap_raster_p.h>
+#include <QtGui/private/qplatformscreen_qpa_p.h>
#include <private/qdnd_p.h>
QT_BEGIN_NAMESPACE
@@ -227,12 +228,16 @@ QVariant QPlatformIntegration::styleHint(StyleHint hint) const
return 1000;
case KeyboardInputInterval:
return 400;
+ case KeyboardAutoRepeatRate:
+ return 30;
case MouseDoubleClickInterval:
return 400;
case StartDragDistance:
return 10;
case StartDragTime:
return 500;
+ case ShowIsFullScreen:
+ return false;
}
return 0;
@@ -251,11 +256,10 @@ QVariant QPlatformIntegration::styleHint(StyleHint hint) const
*/
void QPlatformIntegration::screenAdded(QPlatformScreen *ps)
{
- QScreen *screen = ps ? ps->screen() : 0;
- if (screen && !QGuiApplicationPrivate::screen_list.contains(screen)) {
- QGuiApplicationPrivate::screen_list << screen;
- emit qGuiApp->screenAdded(screen);
- }
+ QScreen *screen = new QScreen(ps);
+ ps->d_func()->screen = screen;
+ QGuiApplicationPrivate::screen_list << screen;
+ emit qGuiApp->screenAdded(screen);
}
class QPlatformTheme *QPlatformIntegration::platformTheme() const
diff --git a/src/gui/kernel/qplatformintegration_qpa.h b/src/gui/kernel/qplatformintegration_qpa.h
index d5eb14bc50..3975d82288 100644
--- a/src/gui/kernel/qplatformintegration_qpa.h
+++ b/src/gui/kernel/qplatformintegration_qpa.h
@@ -1,6 +1,6 @@
/****************************************************************************
**
-** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies).
+** Copyright (C) 2012 Nokia Corporation and/or its subsidiary(-ies).
** All rights reserved.
** Contact: Nokia Corporation (qt-info@nokia.com)
**
@@ -106,7 +106,9 @@ public:
KeyboardInputInterval,
MouseDoubleClickInterval,
StartDragDistance,
- StartDragTime
+ StartDragTime,
+ KeyboardAutoRepeatRate,
+ ShowIsFullScreen
};
virtual QVariant styleHint(StyleHint hint) const;
diff --git a/src/gui/kernel/qplatformintegrationfactory_qpa.cpp b/src/gui/kernel/qplatformintegrationfactory_qpa.cpp
index c40494c408..7f2260b5f6 100644
--- a/src/gui/kernel/qplatformintegrationfactory_qpa.cpp
+++ b/src/gui/kernel/qplatformintegrationfactory_qpa.cpp
@@ -1,6 +1,6 @@
/****************************************************************************
**
-** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies).
+** Copyright (C) 2012 Nokia Corporation and/or its subsidiary(-ies).
** All rights reserved.
** Contact: Nokia Corporation (qt-info@nokia.com)
**
diff --git a/src/gui/kernel/qplatformintegrationfactory_qpa_p.h b/src/gui/kernel/qplatformintegrationfactory_qpa_p.h
index 5ffdf85425..189b352139 100644
--- a/src/gui/kernel/qplatformintegrationfactory_qpa_p.h
+++ b/src/gui/kernel/qplatformintegrationfactory_qpa_p.h
@@ -1,6 +1,6 @@
/****************************************************************************
**
-** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies).
+** Copyright (C) 2012 Nokia Corporation and/or its subsidiary(-ies).
** All rights reserved.
** Contact: Nokia Corporation (qt-info@nokia.com)
**
diff --git a/src/gui/kernel/qplatformintegrationplugin_qpa.cpp b/src/gui/kernel/qplatformintegrationplugin_qpa.cpp
index 0181b98ad7..a57b980ea3 100644
--- a/src/gui/kernel/qplatformintegrationplugin_qpa.cpp
+++ b/src/gui/kernel/qplatformintegrationplugin_qpa.cpp
@@ -1,6 +1,6 @@
/****************************************************************************
**
-** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies).
+** Copyright (C) 2012 Nokia Corporation and/or its subsidiary(-ies).
** All rights reserved.
** Contact: Nokia Corporation (qt-info@nokia.com)
**
diff --git a/src/gui/kernel/qplatformintegrationplugin_qpa.h b/src/gui/kernel/qplatformintegrationplugin_qpa.h
index b397f56d7c..f53d66d1c8 100644
--- a/src/gui/kernel/qplatformintegrationplugin_qpa.h
+++ b/src/gui/kernel/qplatformintegrationplugin_qpa.h
@@ -1,6 +1,6 @@
/****************************************************************************
**
-** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies).
+** Copyright (C) 2012 Nokia Corporation and/or its subsidiary(-ies).
** All rights reserved.
** Contact: Nokia Corporation (qt-info@nokia.com)
**
diff --git a/src/gui/kernel/qplatformnativeinterface_qpa.cpp b/src/gui/kernel/qplatformnativeinterface_qpa.cpp
index 5c1f8458db..f9ddd1f72a 100644
--- a/src/gui/kernel/qplatformnativeinterface_qpa.cpp
+++ b/src/gui/kernel/qplatformnativeinterface_qpa.cpp
@@ -1,6 +1,6 @@
/****************************************************************************
**
-** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies).
+** Copyright (C) 2012 Nokia Corporation and/or its subsidiary(-ies).
** All rights reserved.
** Contact: Nokia Corporation (qt-info@nokia.com)
**
diff --git a/src/gui/kernel/qplatformnativeinterface_qpa.h b/src/gui/kernel/qplatformnativeinterface_qpa.h
index bfcf78813b..47e2f82810 100644
--- a/src/gui/kernel/qplatformnativeinterface_qpa.h
+++ b/src/gui/kernel/qplatformnativeinterface_qpa.h
@@ -1,6 +1,6 @@
/****************************************************************************
**
-** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies).
+** Copyright (C) 2012 Nokia Corporation and/or its subsidiary(-ies).
** All rights reserved.
** Contact: Nokia Corporation (qt-info@nokia.com)
**
diff --git a/src/gui/kernel/qplatformopenglcontext_qpa.cpp b/src/gui/kernel/qplatformopenglcontext_qpa.cpp
index e764419825..7c5e8245df 100644
--- a/src/gui/kernel/qplatformopenglcontext_qpa.cpp
+++ b/src/gui/kernel/qplatformopenglcontext_qpa.cpp
@@ -1,6 +1,6 @@
/****************************************************************************
**
-** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies).
+** Copyright (C) 2012 Nokia Corporation and/or its subsidiary(-ies).
** All rights reserved.
** Contact: Nokia Corporation (qt-info@nokia.com)
**
diff --git a/src/gui/kernel/qplatformopenglcontext_qpa.h b/src/gui/kernel/qplatformopenglcontext_qpa.h
index 1b3bfc9a34..ac5cf969d9 100644
--- a/src/gui/kernel/qplatformopenglcontext_qpa.h
+++ b/src/gui/kernel/qplatformopenglcontext_qpa.h
@@ -1,6 +1,6 @@
/****************************************************************************
**
-** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies).
+** Copyright (C) 2012 Nokia Corporation and/or its subsidiary(-ies).
** All rights reserved.
** Contact: Nokia Corporation (qt-info@nokia.com)
**
diff --git a/src/gui/kernel/qplatformscreen_qpa.cpp b/src/gui/kernel/qplatformscreen_qpa.cpp
index 3fdb809137..26c685ff1a 100644
--- a/src/gui/kernel/qplatformscreen_qpa.cpp
+++ b/src/gui/kernel/qplatformscreen_qpa.cpp
@@ -1,6 +1,6 @@
/****************************************************************************
**
-** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies).
+** Copyright (C) 2012 Nokia Corporation and/or its subsidiary(-ies).
** All rights reserved.
** Contact: Nokia Corporation (qt-info@nokia.com)
**
@@ -42,23 +42,18 @@
#include "qplatformscreen_qpa.h"
#include <QtGui/qguiapplication.h>
#include <QtGui/private/qguiapplication_p.h>
+#include <QtGui/private/qplatformscreen_qpa_p.h>
#include <QtGui/qplatformintegration_qpa.h>
#include <QtGui/qscreen.h>
#include <QtGui/qwindow.h>
QT_BEGIN_NAMESPACE
-class QPlatformScreenPrivate
-{
-public:
- QScreen *screen;
-};
-
QPlatformScreen::QPlatformScreen()
: d_ptr(new QPlatformScreenPrivate)
{
Q_D(QPlatformScreen);
- d->screen = new QScreen(this);
+ d->screen = 0;
}
QPlatformScreen::~QPlatformScreen()
diff --git a/src/gui/kernel/qplatformscreen_qpa.h b/src/gui/kernel/qplatformscreen_qpa.h
index 64115a6cd5..586a29279c 100644
--- a/src/gui/kernel/qplatformscreen_qpa.h
+++ b/src/gui/kernel/qplatformscreen_qpa.h
@@ -1,6 +1,6 @@
/****************************************************************************
**
-** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies).
+** Copyright (C) 2012 Nokia Corporation and/or its subsidiary(-ies).
** All rights reserved.
** Contact: Nokia Corporation (qt-info@nokia.com)
**
@@ -120,6 +120,8 @@ protected:
private:
Q_DISABLE_COPY(QPlatformScreen)
+
+ friend class QPlatformIntegration;
};
QT_END_NAMESPACE
diff --git a/src/gui/kernel/qplatformscreen_qpa_p.h b/src/gui/kernel/qplatformscreen_qpa_p.h
new file mode 100644
index 0000000000..67c222bdf3
--- /dev/null
+++ b/src/gui/kernel/qplatformscreen_qpa_p.h
@@ -0,0 +1,74 @@
+/****************************************************************************
+**
+** Copyright (C) 2012 Nokia Corporation and/or its subsidiary(-ies).
+** All rights reserved.
+** Contact: Nokia Corporation (qt-info@nokia.com)
+**
+** This file is part of the QtGui module of the Qt Toolkit.
+**
+** $QT_BEGIN_LICENSE:LGPL$
+** GNU Lesser General Public License Usage
+** This file may be used under the terms of the GNU Lesser General Public
+** License version 2.1 as published by the Free Software Foundation and
+** appearing in the file LICENSE.LGPL included in the packaging of this
+** file. Please review the following information to ensure the GNU Lesser
+** General Public License version 2.1 requirements will be met:
+** http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
+**
+** In addition, as a special exception, Nokia gives you certain additional
+** rights. These rights are described in the Nokia Qt LGPL Exception
+** version 1.1, included in the file LGPL_EXCEPTION.txt in this package.
+**
+** GNU General Public License Usage
+** Alternatively, this file may be used under the terms of the GNU General
+** Public License version 3.0 as published by the Free Software Foundation
+** and appearing in the file LICENSE.GPL included in the packaging of this
+** file. Please review the following information to ensure the GNU General
+** Public License version 3.0 requirements will be met:
+** http://www.gnu.org/copyleft/gpl.html.
+**
+** Other Usage
+** Alternatively, this file may be used in accordance with the terms and
+** conditions contained in a signed written agreement between you and Nokia.
+**
+**
+**
+**
+**
+** $QT_END_LICENSE$
+**
+****************************************************************************/
+
+#ifndef QPLATFORMSCREEN_QPA_P_H
+#define QPLATFORMSCREEN_QPA_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.
+//
+
+QT_BEGIN_HEADER
+
+QT_BEGIN_NAMESPACE
+
+QT_MODULE(Gui)
+
+class QScreen;
+
+class QPlatformScreenPrivate
+{
+public:
+ QScreen *screen;
+};
+
+QT_END_NAMESPACE
+
+QT_END_HEADER
+
+#endif // QPLATFORMSCREEN_QPA_P_H
diff --git a/src/gui/kernel/qplatformsurface_qpa.cpp b/src/gui/kernel/qplatformsurface_qpa.cpp
index dcfd201ea3..3347f7984f 100644
--- a/src/gui/kernel/qplatformsurface_qpa.cpp
+++ b/src/gui/kernel/qplatformsurface_qpa.cpp
@@ -1,6 +1,6 @@
/****************************************************************************
**
-** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies).
+** Copyright (C) 2012 Nokia Corporation and/or its subsidiary(-ies).
** All rights reserved.
** Contact: Nokia Corporation (qt-info@nokia.com)
**
diff --git a/src/gui/kernel/qplatformsurface_qpa.h b/src/gui/kernel/qplatformsurface_qpa.h
index 76b564de25..7ceb39f049 100644
--- a/src/gui/kernel/qplatformsurface_qpa.h
+++ b/src/gui/kernel/qplatformsurface_qpa.h
@@ -1,6 +1,6 @@
/****************************************************************************
**
-** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies).
+** Copyright (C) 2012 Nokia Corporation and/or its subsidiary(-ies).
** All rights reserved.
** Contact: Nokia Corporation (qt-info@nokia.com)
**
diff --git a/src/gui/kernel/qplatformtheme_qpa.cpp b/src/gui/kernel/qplatformtheme_qpa.cpp
index c887d78edb..22d4452f4e 100644
--- a/src/gui/kernel/qplatformtheme_qpa.cpp
+++ b/src/gui/kernel/qplatformtheme_qpa.cpp
@@ -1,6 +1,6 @@
/****************************************************************************
**
-** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies).
+** Copyright (C) 2012 Nokia Corporation and/or its subsidiary(-ies).
** All rights reserved.
** Contact: Nokia Corporation (qt-info@nokia.com)
**
@@ -41,8 +41,36 @@
#include "qplatformtheme_qpa.h"
+#include <QtCore/QVariant>
+
QT_BEGIN_NAMESPACE
+/*!
+ \class QPlatformTheme
+ \since 5.0
+ \internal
+ \preliminary
+ \ingroup qpa
+ \brief The QPlatformTheme class allows customizing the UI based on themes.
+
+*/
+
+/*!
+ \enum QPlatformTheme::ThemeHint
+
+ This enum describes the available theme hints.
+
+ \value TextCursorWidth (int) Determines the width of the text cursor.
+
+ \value DropShadow (bool) Determines whether the drop shadow effect for
+ tooltips or whatsthis is enabled.
+
+ \value MaximumScrollBarDragDistance (int) Determines the value returned by
+ QStyle::pixelMetric(PM_MaximumDragDistance)
+
+ \sa themeHint(), QStyle::pixelMetric()
+*/
+
QPlatformMenu *QPlatformTheme::createPlatformMenu(QMenu *menu) const
{
Q_UNUSED(menu);
@@ -67,4 +95,17 @@ QPlatformDialogHelper *QPlatformTheme::createPlatformDialogHelper(QDialog *dialo
return 0;
}
+QVariant QPlatformTheme::themeHint(ThemeHint hint) const
+{
+ switch (hint) {
+ case TextCursorWidth:
+ return QVariant(1);
+ case DropShadow:
+ return QVariant(false);
+ case MaximumScrollBarDragDistance:
+ return QVariant(-1);
+ }
+ return QVariant();
+}
+
QT_END_NAMESPACE
diff --git a/src/gui/kernel/qplatformtheme_qpa.h b/src/gui/kernel/qplatformtheme_qpa.h
index 2090ce37e1..c3e5b677a2 100644
--- a/src/gui/kernel/qplatformtheme_qpa.h
+++ b/src/gui/kernel/qplatformtheme_qpa.h
@@ -1,6 +1,6 @@
/****************************************************************************
**
-** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies).
+** Copyright (C) 2012 Nokia Corporation and/or its subsidiary(-ies).
** All rights reserved.
** Contact: Nokia Corporation (qt-info@nokia.com)
**
@@ -56,15 +56,24 @@ class QPlatformMenu;
class QPlatformMenuBar;
class QPlatformDialogHelper;
class QDialog;
+class QVariant;
class Q_GUI_EXPORT QPlatformTheme
{
public:
+ enum ThemeHint {
+ TextCursorWidth,
+ DropShadow,
+ MaximumScrollBarDragDistance
+ };
+
virtual QPlatformMenu *createPlatformMenu(QMenu *menu = 0) const;
virtual QPlatformMenuBar *createPlatformMenuBar(QMenuBar *menuBar = 0) const;
virtual bool usePlatformNativeDialog(const QDialog *dialog = 0) const;
virtual QPlatformDialogHelper *createPlatformDialogHelper(QDialog *dialog = 0) const;
+
+ virtual QVariant themeHint(ThemeHint hint) const;
};
QT_END_NAMESPACE
diff --git a/src/gui/kernel/qplatformthemefactory_qpa.cpp b/src/gui/kernel/qplatformthemefactory_qpa.cpp
index 87f96762c2..c278f41411 100644
--- a/src/gui/kernel/qplatformthemefactory_qpa.cpp
+++ b/src/gui/kernel/qplatformthemefactory_qpa.cpp
@@ -1,6 +1,6 @@
/****************************************************************************
**
-** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies).
+** Copyright (C) 2012 Nokia Corporation and/or its subsidiary(-ies).
** All rights reserved.
** Contact: Nokia Corporation (qt-info@nokia.com)
**
diff --git a/src/gui/kernel/qplatformthemefactory_qpa_p.h b/src/gui/kernel/qplatformthemefactory_qpa_p.h
index b65e6e197a..71987aa723 100644
--- a/src/gui/kernel/qplatformthemefactory_qpa_p.h
+++ b/src/gui/kernel/qplatformthemefactory_qpa_p.h
@@ -1,6 +1,6 @@
/****************************************************************************
**
-** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies).
+** Copyright (C) 2012 Nokia Corporation and/or its subsidiary(-ies).
** All rights reserved.
** Contact: Nokia Corporation (qt-info@nokia.com)
**
diff --git a/src/gui/kernel/qplatformthemeplugin_qpa.cpp b/src/gui/kernel/qplatformthemeplugin_qpa.cpp
index e17e36fc3d..c51d4e9fc5 100644
--- a/src/gui/kernel/qplatformthemeplugin_qpa.cpp
+++ b/src/gui/kernel/qplatformthemeplugin_qpa.cpp
@@ -1,6 +1,6 @@
/****************************************************************************
**
-** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies).
+** Copyright (C) 2012 Nokia Corporation and/or its subsidiary(-ies).
** All rights reserved.
** Contact: Nokia Corporation (qt-info@nokia.com)
**
diff --git a/src/gui/kernel/qplatformthemeplugin_qpa.h b/src/gui/kernel/qplatformthemeplugin_qpa.h
index 0df9a8842d..89348deae0 100644
--- a/src/gui/kernel/qplatformthemeplugin_qpa.h
+++ b/src/gui/kernel/qplatformthemeplugin_qpa.h
@@ -1,6 +1,6 @@
/****************************************************************************
**
-** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies).
+** Copyright (C) 2012 Nokia Corporation and/or its subsidiary(-ies).
** All rights reserved.
** Contact: Nokia Corporation (qt-info@nokia.com)
**
diff --git a/src/gui/kernel/qplatformwindow_qpa.cpp b/src/gui/kernel/qplatformwindow_qpa.cpp
index 90fdec69f0..d69cb0e64e 100644
--- a/src/gui/kernel/qplatformwindow_qpa.cpp
+++ b/src/gui/kernel/qplatformwindow_qpa.cpp
@@ -1,6 +1,6 @@
/****************************************************************************
**
-** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies).
+** Copyright (C) 2012 Nokia Corporation and/or its subsidiary(-ies).
** All rights reserved.
** Contact: Nokia Corporation (qt-info@nokia.com)
**
diff --git a/src/gui/kernel/qplatformwindow_qpa.h b/src/gui/kernel/qplatformwindow_qpa.h
index c6b5bb80ea..7605a5a4aa 100644
--- a/src/gui/kernel/qplatformwindow_qpa.h
+++ b/src/gui/kernel/qplatformwindow_qpa.h
@@ -1,6 +1,6 @@
/****************************************************************************
**
-** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies).
+** Copyright (C) 2012 Nokia Corporation and/or its subsidiary(-ies).
** All rights reserved.
** Contact: Nokia Corporation (qt-info@nokia.com)
**
diff --git a/src/gui/kernel/qscreen.cpp b/src/gui/kernel/qscreen.cpp
index 8a35ce6b8f..a1ed3014d0 100644
--- a/src/gui/kernel/qscreen.cpp
+++ b/src/gui/kernel/qscreen.cpp
@@ -1,6 +1,6 @@
/****************************************************************************
**
-** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies).
+** Copyright (C) 2012 Nokia Corporation and/or its subsidiary(-ies).
** All rights reserved.
** Contact: Nokia Corporation (qt-info@nokia.com)
**
@@ -40,23 +40,13 @@
****************************************************************************/
#include "qscreen.h"
+#include "qscreen_p.h"
#include "qplatformscreen_qpa.h"
#include <QtCore/private/qobject_p.h>
QT_BEGIN_NAMESPACE
-class QScreenPrivate : public QObjectPrivate
-{
-public:
- QScreenPrivate(QPlatformScreen *screen)
- : platformScreen(screen)
- {
- }
-
- QPlatformScreen *platformScreen;
-};
-
/*!
\class QScreen
\brief The QScreen class is used to query screen properties.
@@ -119,7 +109,7 @@ int QScreen::depth() const
QSize QScreen::size() const
{
Q_D(const QScreen);
- return d->platformScreen->geometry().size();
+ return d->geometry.size();
}
/*!
@@ -184,7 +174,7 @@ qreal QScreen::physicalDotsPerInch() const
qreal QScreen::logicalDotsPerInchX() const
{
Q_D(const QScreen);
- return d->platformScreen->logicalDpi().first;
+ return d->logicalDpi.first;
}
/*!
@@ -198,7 +188,7 @@ qreal QScreen::logicalDotsPerInchX() const
qreal QScreen::logicalDotsPerInchY() const
{
Q_D(const QScreen);
- return d->platformScreen->logicalDpi().second;
+ return d->logicalDpi.second;
}
/*!
@@ -216,7 +206,7 @@ qreal QScreen::logicalDotsPerInchY() const
qreal QScreen::logicalDotsPerInch() const
{
Q_D(const QScreen);
- QDpi dpi = d->platformScreen->logicalDpi();
+ QDpi dpi = d->logicalDpi;
return (dpi.first + dpi.second) * qreal(0.5);
}
@@ -246,7 +236,7 @@ QSizeF QScreen::physicalSize() const
QSize QScreen::availableSize() const
{
Q_D(const QScreen);
- return d->platformScreen->availableGeometry().size();
+ return d->availableGeometry.size();
}
/*!
@@ -259,7 +249,7 @@ QSize QScreen::availableSize() const
QRect QScreen::geometry() const
{
Q_D(const QScreen);
- return d->platformScreen->geometry();
+ return d->geometry;
}
/*!
@@ -272,7 +262,7 @@ QRect QScreen::geometry() const
QRect QScreen::availableGeometry() const
{
Q_D(const QScreen);
- return d->platformScreen->availableGeometry();
+ return d->availableGeometry;
}
/*!
@@ -315,10 +305,9 @@ QSize QScreen::virtualSize() const
*/
QRect QScreen::virtualGeometry() const
{
- Q_D(const QScreen);
QRect result;
- foreach (QPlatformScreen *platformScreen, d->platformScreen->virtualSiblings())
- result |= platformScreen->geometry();
+ foreach (QScreen *screen, virtualSiblings())
+ result |= screen->geometry();
return result;
}
@@ -347,10 +336,9 @@ QSize QScreen::availableVirtualSize() const
*/
QRect QScreen::availableVirtualGeometry() const
{
- Q_D(const QScreen);
QRect result;
- foreach (QPlatformScreen *platformScreen, d->platformScreen->virtualSiblings())
- result |= platformScreen->availableGeometry();
+ foreach (QScreen *screen, virtualSiblings())
+ result |= screen->availableGeometry();
return result;
}
@@ -383,7 +371,7 @@ Qt::ScreenOrientation QScreen::primaryOrientation() const
Qt::ScreenOrientation QScreen::currentOrientation() const
{
Q_D(const QScreen);
- return d->platformScreen->currentOrientation();
+ return d->currentOrientation;
}
// i must be power of two
diff --git a/src/gui/kernel/qscreen.h b/src/gui/kernel/qscreen.h
index 6fc97c1799..7291e2ad7b 100644
--- a/src/gui/kernel/qscreen.h
+++ b/src/gui/kernel/qscreen.h
@@ -1,6 +1,6 @@
/****************************************************************************
**
-** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies).
+** Copyright (C) 2012 Nokia Corporation and/or its subsidiary(-ies).
** All rights reserved.
** Contact: Nokia Corporation (qt-info@nokia.com)
**
@@ -140,6 +140,7 @@ private:
Q_DISABLE_COPY(QScreen)
friend class QGuiApplicationPrivate;
+ friend class QPlatformIntegration;
friend class QPlatformScreen;
};
diff --git a/src/gui/kernel/qscreen_p.h b/src/gui/kernel/qscreen_p.h
new file mode 100644
index 0000000000..50742c9f6b
--- /dev/null
+++ b/src/gui/kernel/qscreen_p.h
@@ -0,0 +1,80 @@
+/****************************************************************************
+**
+** Copyright (C) 2012 Nokia Corporation and/or its subsidiary(-ies).
+** All rights reserved.
+** Contact: Nokia Corporation (qt-info@nokia.com)
+**
+** This file is part of the QtGui module of the Qt Toolkit.
+**
+** $QT_BEGIN_LICENSE:LGPL$
+** GNU Lesser General Public License Usage
+** This file may be used under the terms of the GNU Lesser General Public
+** License version 2.1 as published by the Free Software Foundation and
+** appearing in the file LICENSE.LGPL included in the packaging of this
+** file. Please review the following information to ensure the GNU Lesser
+** General Public License version 2.1 requirements will be met:
+** http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
+**
+** In addition, as a special exception, Nokia gives you certain additional
+** rights. These rights are described in the Nokia Qt LGPL Exception
+** version 1.1, included in the file LGPL_EXCEPTION.txt in this package.
+**
+** GNU General Public License Usage
+** Alternatively, this file may be used under the terms of the GNU General
+** Public License version 3.0 as published by the Free Software Foundation
+** and appearing in the file LICENSE.GPL included in the packaging of this
+** file. Please review the following information to ensure the GNU General
+** Public License version 3.0 requirements will be met:
+** http://www.gnu.org/copyleft/gpl.html.
+**
+** Other Usage
+** Alternatively, this file may be used in accordance with the terms and
+** conditions contained in a signed written agreement between you and Nokia.
+**
+**
+**
+**
+**
+** $QT_END_LICENSE$
+**
+****************************************************************************/
+
+#ifndef QSCREEN_P_H
+#define QSCREEN_P_H
+
+#include <QtGui/qscreen.h>
+#include <QtGui/qplatformscreen_qpa.h>
+
+#include <QtCore/private/qobject_p.h>
+
+QT_BEGIN_HEADER
+
+QT_BEGIN_NAMESPACE
+
+QT_MODULE(Gui)
+
+class QScreenPrivate : public QObjectPrivate
+{
+public:
+ QScreenPrivate(QPlatformScreen *screen)
+ : platformScreen(screen)
+ {
+ currentOrientation = screen->currentOrientation();
+ geometry = screen->geometry();
+ availableGeometry = screen->availableGeometry();
+ logicalDpi = screen->logicalDpi();
+ }
+
+ Qt::ScreenOrientation currentOrientation;
+ QRect geometry;
+ QRect availableGeometry;
+ QDpi logicalDpi;
+
+ QPlatformScreen *platformScreen;
+};
+
+QT_END_NAMESPACE
+
+QT_END_HEADER
+
+#endif // QSCREEN_P_H
diff --git a/src/gui/kernel/qsessionmanager.h b/src/gui/kernel/qsessionmanager.h
index 31a26c1582..89c5cf47b6 100644
--- a/src/gui/kernel/qsessionmanager.h
+++ b/src/gui/kernel/qsessionmanager.h
@@ -1,6 +1,6 @@
/****************************************************************************
**
-** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies).
+** Copyright (C) 2012 Nokia Corporation and/or its subsidiary(-ies).
** All rights reserved.
** Contact: Nokia Corporation (qt-info@nokia.com)
**
diff --git a/src/gui/kernel/qsessionmanager_qpa.cpp b/src/gui/kernel/qsessionmanager_qpa.cpp
index 7ade0df3a8..9b6ec26ff4 100644
--- a/src/gui/kernel/qsessionmanager_qpa.cpp
+++ b/src/gui/kernel/qsessionmanager_qpa.cpp
@@ -1,6 +1,6 @@
/****************************************************************************
**
-** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies).
+** Copyright (C) 2012 Nokia Corporation and/or its subsidiary(-ies).
** All rights reserved.
** Contact: Nokia Corporation (qt-info@nokia.com)
**
diff --git a/src/gui/kernel/qshortcutmap.cpp b/src/gui/kernel/qshortcutmap.cpp
index 64b0aa1741..2bacac9598 100644
--- a/src/gui/kernel/qshortcutmap.cpp
+++ b/src/gui/kernel/qshortcutmap.cpp
@@ -1,6 +1,6 @@
/****************************************************************************
**
-** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies).
+** Copyright (C) 2012 Nokia Corporation and/or its subsidiary(-ies).
** All rights reserved.
** Contact: Nokia Corporation (qt-info@nokia.com)
**
diff --git a/src/gui/kernel/qshortcutmap_p.h b/src/gui/kernel/qshortcutmap_p.h
index 28c37f9a2e..e447507b87 100644
--- a/src/gui/kernel/qshortcutmap_p.h
+++ b/src/gui/kernel/qshortcutmap_p.h
@@ -1,6 +1,6 @@
/****************************************************************************
**
-** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies).
+** Copyright (C) 2012 Nokia Corporation and/or its subsidiary(-ies).
** All rights reserved.
** Contact: Nokia Corporation (qt-info@nokia.com)
**
diff --git a/src/gui/kernel/qstylehints.cpp b/src/gui/kernel/qstylehints.cpp
index 7585d23558..eb0f055270 100644
--- a/src/gui/kernel/qstylehints.cpp
+++ b/src/gui/kernel/qstylehints.cpp
@@ -1,6 +1,6 @@
/****************************************************************************
**
-** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies).
+** Copyright (C) 2012 Nokia Corporation and/or its subsidiary(-ies).
** All rights reserved.
** Contact: Nokia Corporation (qt-info@nokia.com)
**
@@ -76,9 +76,19 @@ int QStyleHints::keyboardInputInterval() const
return hint(QPlatformIntegration::KeyboardInputInterval).toInt();
}
+int QStyleHints::keyboardAutoRepeatRate() const
+{
+ return hint(QPlatformIntegration::KeyboardAutoRepeatRate).toInt();
+}
+
int QStyleHints::cursorFlashTime() const
{
return hint(QPlatformIntegration::CursorFlashTime).toInt();
}
+bool QStyleHints::showIsFullScreen() const
+{
+ return hint(QPlatformIntegration::ShowIsFullScreen).toBool();
+}
+
QT_END_NAMESPACE
diff --git a/src/gui/kernel/qstylehints.h b/src/gui/kernel/qstylehints.h
index bcc9b589e2..6fa72110fb 100644
--- a/src/gui/kernel/qstylehints.h
+++ b/src/gui/kernel/qstylehints.h
@@ -1,6 +1,6 @@
/****************************************************************************
**
-** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies).
+** Copyright (C) 2012 Nokia Corporation and/or its subsidiary(-ies).
** All rights reserved.
** Contact: Nokia Corporation (qt-info@nokia.com)
**
@@ -60,7 +60,9 @@ public:
int startDragDistance() const;
int startDragTime() const;
int keyboardInputInterval() const;
+ int keyboardAutoRepeatRate() const;
int cursorFlashTime() const;
+ bool showIsFullScreen() const;
private:
friend class QGuiApplication;
QStyleHints();
diff --git a/src/gui/kernel/qsurface.cpp b/src/gui/kernel/qsurface.cpp
index 871b765bfd..bfdb772cfb 100644
--- a/src/gui/kernel/qsurface.cpp
+++ b/src/gui/kernel/qsurface.cpp
@@ -1,6 +1,6 @@
/****************************************************************************
**
-** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies).
+** Copyright (C) 2012 Nokia Corporation and/or its subsidiary(-ies).
** All rights reserved.
** Contact: Nokia Corporation (qt-info@nokia.com)
**
diff --git a/src/gui/kernel/qsurface.h b/src/gui/kernel/qsurface.h
index a6c8745a7a..fba1690af4 100644
--- a/src/gui/kernel/qsurface.h
+++ b/src/gui/kernel/qsurface.h
@@ -1,6 +1,6 @@
/****************************************************************************
**
-** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies).
+** Copyright (C) 2012 Nokia Corporation and/or its subsidiary(-ies).
** All rights reserved.
** Contact: Nokia Corporation (qt-info@nokia.com)
**
diff --git a/src/gui/kernel/qsurfaceformat.cpp b/src/gui/kernel/qsurfaceformat.cpp
index b200cdb113..39b2d491a3 100644
--- a/src/gui/kernel/qsurfaceformat.cpp
+++ b/src/gui/kernel/qsurfaceformat.cpp
@@ -1,6 +1,6 @@
/****************************************************************************
**
-** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies).
+** Copyright (C) 2012 Nokia Corporation and/or its subsidiary(-ies).
** All rights reserved.
** Contact: Nokia Corporation (qt-info@nokia.com)
**
diff --git a/src/gui/kernel/qsurfaceformat.h b/src/gui/kernel/qsurfaceformat.h
index cdbd50740b..3d3bfeb30b 100644
--- a/src/gui/kernel/qsurfaceformat.h
+++ b/src/gui/kernel/qsurfaceformat.h
@@ -1,6 +1,6 @@
/****************************************************************************
**
-** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies).
+** Copyright (C) 2012 Nokia Corporation and/or its subsidiary(-ies).
** All rights reserved.
** Contact: Nokia Corporation (qt-info@nokia.com)
**
diff --git a/src/gui/kernel/qt_gui_pch.h b/src/gui/kernel/qt_gui_pch.h
index 3cb527d0b1..98a516f54e 100644
--- a/src/gui/kernel/qt_gui_pch.h
+++ b/src/gui/kernel/qt_gui_pch.h
@@ -1,6 +1,6 @@
/****************************************************************************
**
-** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies).
+** Copyright (C) 2012 Nokia Corporation and/or its subsidiary(-ies).
** All rights reserved.
** Contact: Nokia Corporation (qt-info@nokia.com)
**
diff --git a/src/gui/kernel/qtouchdevice.cpp b/src/gui/kernel/qtouchdevice.cpp
index abf1acc310..b8d4d01655 100644
--- a/src/gui/kernel/qtouchdevice.cpp
+++ b/src/gui/kernel/qtouchdevice.cpp
@@ -1,6 +1,6 @@
/****************************************************************************
**
-** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies).
+** Copyright (C) 2012 Nokia Corporation and/or its subsidiary(-ies).
** All rights reserved.
** Contact: Nokia Corporation (qt-info@nokia.com)
**
diff --git a/src/gui/kernel/qtouchdevice.h b/src/gui/kernel/qtouchdevice.h
index 496bb7a522..6efa7814c9 100644
--- a/src/gui/kernel/qtouchdevice.h
+++ b/src/gui/kernel/qtouchdevice.h
@@ -1,6 +1,6 @@
/****************************************************************************
**
-** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies).
+** Copyright (C) 2012 Nokia Corporation and/or its subsidiary(-ies).
** All rights reserved.
** Contact: Nokia Corporation (qt-info@nokia.com)
**
diff --git a/src/gui/kernel/qtouchdevice_p.h b/src/gui/kernel/qtouchdevice_p.h
index f782d1585d..c37e4a8bf5 100644
--- a/src/gui/kernel/qtouchdevice_p.h
+++ b/src/gui/kernel/qtouchdevice_p.h
@@ -1,6 +1,6 @@
/****************************************************************************
**
-** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies).
+** Copyright (C) 2012 Nokia Corporation and/or its subsidiary(-ies).
** All rights reserved.
** Contact: Nokia Corporation (qt-info@nokia.com)
**
diff --git a/src/gui/kernel/qwindow.cpp b/src/gui/kernel/qwindow.cpp
index 55329f56bd..97c6b0cbc9 100644
--- a/src/gui/kernel/qwindow.cpp
+++ b/src/gui/kernel/qwindow.cpp
@@ -1,6 +1,6 @@
/****************************************************************************
**
-** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies).
+** Copyright (C) 2012 Nokia Corporation and/or its subsidiary(-ies).
** All rights reserved.
** Contact: Nokia Corporation (qt-info@nokia.com)
**
@@ -54,6 +54,8 @@
#include <QtCore/QDebug>
+#include <QStyleHints>
+
QT_BEGIN_NAMESPACE
/*!
@@ -741,30 +743,42 @@ QObject *QWindow::focusObject() const
return const_cast<QWindow *>(this);
}
+void QWindow::show()
+{
+ if (qApp->styleHints()->showIsFullScreen())
+ showFullScreen();
+ else
+ showNormal();
+}
+
+void QWindow::hide()
+{
+ setVisible(false);
+}
void QWindow::showMinimized()
{
setWindowState(Qt::WindowMinimized);
- show();
+ setVisible(true);
}
void QWindow::showMaximized()
{
setWindowState(Qt::WindowMaximized);
- show();
+ setVisible(true);
}
void QWindow::showFullScreen()
{
setWindowState(Qt::WindowFullScreen);
- show();
+ setVisible(true);
requestActivateWindow();
}
void QWindow::showNormal()
{
setWindowState(Qt::WindowNoState);
- show();
+ setVisible(true);
}
bool QWindow::close()
@@ -774,72 +788,83 @@ bool QWindow::close()
return true;
}
-void QWindow::exposeEvent(QExposeEvent *)
+void QWindow::exposeEvent(QExposeEvent *ev)
{
+ ev->ignore();
}
-void QWindow::moveEvent(QMoveEvent *)
+void QWindow::moveEvent(QMoveEvent *ev)
{
+ ev->ignore();
}
-void QWindow::resizeEvent(QResizeEvent *)
+void QWindow::resizeEvent(QResizeEvent *ev)
{
+ ev->ignore();
}
-void QWindow::showEvent(QShowEvent *)
+void QWindow::showEvent(QShowEvent *ev)
{
+ ev->ignore();
}
-void QWindow::hideEvent(QHideEvent *)
+void QWindow::hideEvent(QHideEvent *ev)
{
+ ev->ignore();
}
-bool QWindow::event(QEvent *event)
+bool QWindow::event(QEvent *ev)
{
- switch (event->type()) {
+ switch (ev->type()) {
case QEvent::MouseMove:
- mouseMoveEvent(static_cast<QMouseEvent*>(event));
+ mouseMoveEvent(static_cast<QMouseEvent*>(ev));
break;
case QEvent::MouseButtonPress:
- mousePressEvent(static_cast<QMouseEvent*>(event));
+ mousePressEvent(static_cast<QMouseEvent*>(ev));
break;
case QEvent::MouseButtonRelease:
- mouseReleaseEvent(static_cast<QMouseEvent*>(event));
+ mouseReleaseEvent(static_cast<QMouseEvent*>(ev));
break;
case QEvent::MouseButtonDblClick:
- mouseDoubleClickEvent(static_cast<QMouseEvent*>(event));
+ mouseDoubleClickEvent(static_cast<QMouseEvent*>(ev));
+ break;
+
+ case QEvent::TouchBegin:
+ case QEvent::TouchUpdate:
+ case QEvent::TouchEnd:
+ touchEvent(static_cast<QTouchEvent *>(ev));
break;
case QEvent::Move:
- moveEvent(static_cast<QMoveEvent*>(event));
+ moveEvent(static_cast<QMoveEvent*>(ev));
break;
case QEvent::Resize:
- resizeEvent(static_cast<QResizeEvent*>(event));
+ resizeEvent(static_cast<QResizeEvent*>(ev));
break;
case QEvent::KeyPress:
- keyPressEvent(static_cast<QKeyEvent *>(event));
+ keyPressEvent(static_cast<QKeyEvent *>(ev));
break;
case QEvent::KeyRelease:
- keyReleaseEvent(static_cast<QKeyEvent *>(event));
+ keyReleaseEvent(static_cast<QKeyEvent *>(ev));
break;
case QEvent::FocusIn:
- focusInEvent(static_cast<QFocusEvent *>(event));
+ focusInEvent(static_cast<QFocusEvent *>(ev));
break;
case QEvent::FocusOut:
- focusOutEvent(static_cast<QFocusEvent *>(event));
+ focusOutEvent(static_cast<QFocusEvent *>(ev));
break;
#ifndef QT_NO_WHEELEVENT
case QEvent::Wheel:
- wheelEvent(static_cast<QWheelEvent*>(event));
+ wheelEvent(static_cast<QWheelEvent*>(ev));
break;
#endif
@@ -852,62 +877,74 @@ bool QWindow::event(QEvent *event)
break; }
case QEvent::Expose:
- exposeEvent(static_cast<QExposeEvent *>(event));
+ exposeEvent(static_cast<QExposeEvent *>(ev));
break;
case QEvent::Show:
- showEvent(static_cast<QShowEvent *>(event));
+ showEvent(static_cast<QShowEvent *>(ev));
break;
case QEvent::Hide:
- hideEvent(static_cast<QHideEvent *>(event));
+ hideEvent(static_cast<QHideEvent *>(ev));
break;
default:
- return QObject::event(event);
+ return QObject::event(ev);
}
return true;
}
-void QWindow::keyPressEvent(QKeyEvent *)
+void QWindow::keyPressEvent(QKeyEvent *ev)
{
+ ev->ignore();
}
-void QWindow::keyReleaseEvent(QKeyEvent *)
+void QWindow::keyReleaseEvent(QKeyEvent *ev)
{
+ ev->ignore();
}
-void QWindow::focusInEvent(QFocusEvent *)
+void QWindow::focusInEvent(QFocusEvent *ev)
{
+ ev->ignore();
}
-void QWindow::focusOutEvent(QFocusEvent *)
+void QWindow::focusOutEvent(QFocusEvent *ev)
{
+ ev->ignore();
}
-void QWindow::mousePressEvent(QMouseEvent *)
+void QWindow::mousePressEvent(QMouseEvent *ev)
{
+ ev->ignore();
}
-void QWindow::mouseReleaseEvent(QMouseEvent *)
+void QWindow::mouseReleaseEvent(QMouseEvent *ev)
{
+ ev->ignore();
}
-void QWindow::mouseDoubleClickEvent(QMouseEvent *)
+void QWindow::mouseDoubleClickEvent(QMouseEvent *ev)
{
+ ev->ignore();
}
-void QWindow::mouseMoveEvent(QMouseEvent *)
+void QWindow::mouseMoveEvent(QMouseEvent *ev)
{
+ ev->ignore();
}
#ifndef QT_NO_WHEELEVENT
-void QWindow::wheelEvent(QWheelEvent *)
+void QWindow::wheelEvent(QWheelEvent *ev)
{
+ ev->ignore();
}
#endif //QT_NO_WHEELEVENT
-
+void QWindow::touchEvent(QTouchEvent *ev)
+{
+ ev->ignore();
+}
/*!
\fn QPoint QWindow::mapToGlobal(const QPoint &pos) const
diff --git a/src/gui/kernel/qwindow.h b/src/gui/kernel/qwindow.h
index 11ff6b101d..4d161658c6 100644
--- a/src/gui/kernel/qwindow.h
+++ b/src/gui/kernel/qwindow.h
@@ -1,6 +1,6 @@
/****************************************************************************
**
-** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies).
+** Copyright (C) 2012 Nokia Corporation and/or its subsidiary(-ies).
** All rights reserved.
** Contact: Nokia Corporation (qt-info@nokia.com)
**
@@ -72,6 +72,7 @@ class QMouseEvent;
#ifndef QT_NO_WHEELEVENT
class QWheelEvent;
#endif
+class QTouchEvent;
class QPlatformSurface;
class QPlatformWindow;
@@ -208,8 +209,8 @@ public:
public Q_SLOTS:
void setVisible(bool visible);
- inline void show() { setVisible(true); }
- inline void hide() { setVisible(false); }
+ void show();
+ void hide();
void showMinimized();
void showMaximized();
@@ -285,6 +286,7 @@ protected:
#ifndef QT_NO_WHEELEVENT
virtual void wheelEvent(QWheelEvent *);
#endif
+ virtual void touchEvent(QTouchEvent *);
QWindow(QWindowPrivate &dd, QWindow *parent);
diff --git a/src/gui/kernel/qwindow_p.h b/src/gui/kernel/qwindow_p.h
index ee91b61cf1..d3b6868aa5 100644
--- a/src/gui/kernel/qwindow_p.h
+++ b/src/gui/kernel/qwindow_p.h
@@ -1,6 +1,6 @@
/****************************************************************************
**
-** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies).
+** Copyright (C) 2012 Nokia Corporation and/or its subsidiary(-ies).
** All rights reserved.
** Contact: Nokia Corporation (qt-info@nokia.com)
**
diff --git a/src/gui/kernel/qwindowdefs.h b/src/gui/kernel/qwindowdefs.h
index b77ec0b2f3..3366606036 100644
--- a/src/gui/kernel/qwindowdefs.h
+++ b/src/gui/kernel/qwindowdefs.h
@@ -1,6 +1,6 @@
/****************************************************************************
**
-** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies).
+** Copyright (C) 2012 Nokia Corporation and/or its subsidiary(-ies).
** All rights reserved.
** Contact: Nokia Corporation (qt-info@nokia.com)
**
diff --git a/src/gui/kernel/qwindowdefs_win.h b/src/gui/kernel/qwindowdefs_win.h
index 2bf9c8e672..2db1a4649f 100644
--- a/src/gui/kernel/qwindowdefs_win.h
+++ b/src/gui/kernel/qwindowdefs_win.h
@@ -1,6 +1,6 @@
/****************************************************************************
**
-** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies).
+** Copyright (C) 2012 Nokia Corporation and/or its subsidiary(-ies).
** All rights reserved.
** Contact: Nokia Corporation (qt-info@nokia.com)
**
diff --git a/src/gui/kernel/qwindowsysteminterface_qpa.cpp b/src/gui/kernel/qwindowsysteminterface_qpa.cpp
index 016446780b..4a7ebd1c0c 100644
--- a/src/gui/kernel/qwindowsysteminterface_qpa.cpp
+++ b/src/gui/kernel/qwindowsysteminterface_qpa.cpp
@@ -1,6 +1,6 @@
/****************************************************************************
**
-** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies).
+** Copyright (C) 2012 Nokia Corporation and/or its subsidiary(-ies).
** All rights reserved.
** Contact: Nokia Corporation (qt-info@nokia.com)
**
@@ -219,38 +219,26 @@ void QWindowSystemInterface::registerTouchDevice(QTouchDevice *device)
QTouchDevicePrivate::registerDevice(device);
}
-void QWindowSystemInterface::handleTouchEvent(QWindow *w, QEvent::Type type, QTouchDevice *device,
- const QList<struct TouchPoint> &points, Qt::KeyboardModifiers mods)
+void QWindowSystemInterface::handleTouchEvent(QWindow *w, QTouchDevice *device,
+ const QList<TouchPoint> &points, Qt::KeyboardModifiers mods)
{
unsigned long time = QWindowSystemInterfacePrivate::eventTime.elapsed();
- handleTouchEvent(w, time, type, device, points, mods);
+ handleTouchEvent(w, time, device, points, mods);
}
-void QWindowSystemInterface::handleTouchEvent(QWindow *tlw, ulong timestamp, QEvent::Type type,
- QTouchDevice *device,
- const QList<struct TouchPoint> &points, Qt::KeyboardModifiers mods)
+QList<QTouchEvent::TouchPoint> QWindowSystemInterfacePrivate::convertTouchPoints(const QList<QWindowSystemInterface::TouchPoint> &points, QEvent::Type *type)
{
- if (!points.size()) // Touch events must have at least one point
- return;
-
- if (!QTouchDevicePrivate::isRegistered(device)) // Disallow passing bogus, non-registered devices.
- return;
-
QList<QTouchEvent::TouchPoint> touchPoints;
Qt::TouchPointStates states;
QTouchEvent::TouchPoint p;
- QList<struct TouchPoint>::const_iterator point = points.constBegin();
- QList<struct TouchPoint>::const_iterator end = points.constEnd();
+ QList<QWindowSystemInterface::TouchPoint>::const_iterator point = points.constBegin();
+ QList<QWindowSystemInterface::TouchPoint>::const_iterator end = points.constEnd();
while (point != end) {
p.setId(point->id);
p.setPressure(point->pressure);
states |= point->state;
- Qt::TouchPointStates state = point->state;
- if (point->isPrimary) {
- state |= Qt::TouchPointPrimary;
- }
- p.setState(state);
+ p.setState(point->state);
const QPointF screenPos = point->area.center();
p.setScreenPos(screenPos);
@@ -268,36 +256,60 @@ void QWindowSystemInterface::handleTouchEvent(QWindow *tlw, ulong timestamp, QEv
++point;
}
+ // Determine the event type based on the combined point states.
+ if (type) {
+ *type = QEvent::TouchUpdate;
+ if (states == Qt::TouchPointPressed)
+ *type = QEvent::TouchBegin;
+ else if (states == Qt::TouchPointReleased)
+ *type = QEvent::TouchEnd;
+ }
+
+ return touchPoints;
+}
+
+void QWindowSystemInterface::handleTouchEvent(QWindow *tlw, ulong timestamp, QTouchDevice *device,
+ const QList<TouchPoint> &points, Qt::KeyboardModifiers mods)
+{
+ if (!points.size()) // Touch events must have at least one point
+ return;
+
+ if (!QTouchDevicePrivate::isRegistered(device)) // Disallow passing bogus, non-registered devices.
+ return;
+
+ QEvent::Type type;
+ QList<QTouchEvent::TouchPoint> touchPoints = QWindowSystemInterfacePrivate::convertTouchPoints(points, &type);
+
QWindowSystemInterfacePrivate::TouchEvent *e =
new QWindowSystemInterfacePrivate::TouchEvent(tlw, timestamp, type, device, touchPoints, mods);
QWindowSystemInterfacePrivate::queueWindowSystemEvent(e);
}
-void QWindowSystemInterface::handleScreenOrientationChange(QScreen *screen)
+void QWindowSystemInterface::handleScreenOrientationChange(QScreen *screen, Qt::ScreenOrientation orientation)
{
QWindowSystemInterfacePrivate::ScreenOrientationEvent *e =
- new QWindowSystemInterfacePrivate::ScreenOrientationEvent(screen);
+ new QWindowSystemInterfacePrivate::ScreenOrientationEvent(screen, orientation);
QWindowSystemInterfacePrivate::queueWindowSystemEvent(e);
}
-void QWindowSystemInterface::handleScreenGeometryChange(QScreen *screen)
+void QWindowSystemInterface::handleScreenGeometryChange(QScreen *screen, const QRect &geometry)
{
QWindowSystemInterfacePrivate::ScreenGeometryEvent *e =
- new QWindowSystemInterfacePrivate::ScreenGeometryEvent(screen);
+ new QWindowSystemInterfacePrivate::ScreenGeometryEvent(screen, geometry);
QWindowSystemInterfacePrivate::queueWindowSystemEvent(e);
}
-void QWindowSystemInterface::handleScreenAvailableGeometryChange(QScreen *screen)
+void QWindowSystemInterface::handleScreenAvailableGeometryChange(QScreen *screen, const QRect &availableGeometry)
{
QWindowSystemInterfacePrivate::ScreenAvailableGeometryEvent *e =
- new QWindowSystemInterfacePrivate::ScreenAvailableGeometryEvent(screen);
+ new QWindowSystemInterfacePrivate::ScreenAvailableGeometryEvent(screen, availableGeometry);
QWindowSystemInterfacePrivate::queueWindowSystemEvent(e);
}
-void QWindowSystemInterface::handleScreenLogicalDotsPerInchChange(QScreen *screen)
+void QWindowSystemInterface::handleScreenLogicalDotsPerInchChange(QScreen *screen, qreal dpiX, qreal dpiY)
{
QWindowSystemInterfacePrivate::ScreenLogicalDotsPerInchEvent *e =
- new QWindowSystemInterfacePrivate::ScreenLogicalDotsPerInchEvent(screen);
+ new QWindowSystemInterfacePrivate::ScreenLogicalDotsPerInchEvent(screen, dpiX, dpiY);
QWindowSystemInterfacePrivate::queueWindowSystemEvent(e);
}
diff --git a/src/gui/kernel/qwindowsysteminterface_qpa.h b/src/gui/kernel/qwindowsysteminterface_qpa.h
index 423281955c..4a17fb9035 100644
--- a/src/gui/kernel/qwindowsysteminterface_qpa.h
+++ b/src/gui/kernel/qwindowsysteminterface_qpa.h
@@ -1,6 +1,6 @@
/****************************************************************************
**
-** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies).
+** Copyright (C) 2012 Nokia Corporation and/or its subsidiary(-ies).
** All rights reserved.
** Contact: Nokia Corporation (qt-info@nokia.com)
**
@@ -86,9 +86,8 @@ public:
static void handleWheelEvent(QWindow *w, ulong timestamp, const QPointF & local, const QPointF & global, int d, Qt::Orientation o, Qt::KeyboardModifiers mods = Qt::NoModifier);
struct TouchPoint {
- TouchPoint() : id(0), isPrimary(false), pressure(0), state(Qt::TouchPointStationary), flags(0) { }
+ TouchPoint() : id(0), pressure(0), state(Qt::TouchPointStationary), flags(0) { }
int id; // for application use
- bool isPrimary; // for application use
QPointF normalPosition; // touch device coordinates, (0 to 1, 0 to 1)
QRectF area; // the touched area, centered at position in screen coordinates
qreal pressure; // 0 to 1
@@ -99,9 +98,9 @@ public:
};
static void registerTouchDevice(QTouchDevice *device);
- static void handleTouchEvent(QWindow *w, QEvent::Type type, QTouchDevice *device,
+ static void handleTouchEvent(QWindow *w, QTouchDevice *device,
const QList<struct TouchPoint> &points, Qt::KeyboardModifiers mods = Qt::NoModifier);
- static void handleTouchEvent(QWindow *w, ulong timestamp, QEvent::Type type, QTouchDevice *device,
+ static void handleTouchEvent(QWindow *w, ulong timestamp, QTouchDevice *device,
const QList<struct TouchPoint> &points, Qt::KeyboardModifiers mods = Qt::NoModifier);
static void handleGeometryChange(QWindow *w, const QRect &newRect);
@@ -123,10 +122,10 @@ public:
static Qt::DropAction handleDrop(QWindow *w, QMimeData *dropData, const QPoint &p);
// Changes to the screen
- static void handleScreenOrientationChange(QScreen *screen);
- static void handleScreenGeometryChange(QScreen *screen);
- static void handleScreenAvailableGeometryChange(QScreen *screen);
- static void handleScreenLogicalDotsPerInchChange(QScreen *screen);
+ static void handleScreenOrientationChange(QScreen *screen, Qt::ScreenOrientation newOrientation);
+ static void handleScreenGeometryChange(QScreen *screen, const QRect &newGeometry);
+ static void handleScreenAvailableGeometryChange(QScreen *screen, const QRect &newAvailableGeometry);
+ static void handleScreenLogicalDotsPerInchChange(QScreen *screen, qreal newDpiX, qreal newDpiY);
// For event dispatcher implementations
static bool sendWindowSystemEvents(QAbstractEventDispatcher *eventDispatcher, QEventLoop::ProcessEventsFlags flags);
diff --git a/src/gui/kernel/qwindowsysteminterface_qpa_p.h b/src/gui/kernel/qwindowsysteminterface_qpa_p.h
index 5580104c3b..b5614eb38e 100644
--- a/src/gui/kernel/qwindowsysteminterface_qpa_p.h
+++ b/src/gui/kernel/qwindowsysteminterface_qpa_p.h
@@ -1,6 +1,6 @@
/****************************************************************************
**
-** Copyright (C) 2009 Nokia Corporation and/or its subsidiary(-ies).
+** Copyright (C) 2012 Nokia Corporation and/or its subsidiary(-ies).
** All rights reserved.
** Contact: Nokia Corporation (qt-info@nokia.com)
**
@@ -72,8 +72,9 @@ public:
class WindowSystemEvent {
public:
explicit WindowSystemEvent(EventType t)
- : type(t) { }
+ : type(t), synthetic(false) { }
EventType type;
+ bool synthetic;
};
class CloseEvent : public WindowSystemEvent {
@@ -197,30 +198,35 @@ public:
class ScreenOrientationEvent : public WindowSystemEvent {
public:
- ScreenOrientationEvent(QScreen *s)
- : WindowSystemEvent(ScreenOrientation), screen(s) { }
+ ScreenOrientationEvent(QScreen *s, Qt::ScreenOrientation o)
+ : WindowSystemEvent(ScreenOrientation), screen(s), orientation(o) { }
QWeakPointer<QScreen> screen;
+ Qt::ScreenOrientation orientation;
};
class ScreenGeometryEvent : public WindowSystemEvent {
public:
- ScreenGeometryEvent(QScreen *s)
- : WindowSystemEvent(ScreenGeometry), screen(s) { }
+ ScreenGeometryEvent(QScreen *s, const QRect &g)
+ : WindowSystemEvent(ScreenGeometry), screen(s), geometry(g) { }
QWeakPointer<QScreen> screen;
+ QRect geometry;
};
class ScreenAvailableGeometryEvent : public WindowSystemEvent {
public:
- ScreenAvailableGeometryEvent(QScreen *s)
- : WindowSystemEvent(ScreenAvailableGeometry), screen(s) { }
+ ScreenAvailableGeometryEvent(QScreen *s, const QRect &g)
+ : WindowSystemEvent(ScreenAvailableGeometry), screen(s), availableGeometry(g) { }
QWeakPointer<QScreen> screen;
+ QRect availableGeometry;
};
class ScreenLogicalDotsPerInchEvent : public WindowSystemEvent {
public:
- ScreenLogicalDotsPerInchEvent(QScreen *s)
- : WindowSystemEvent(ScreenLogicalDotsPerInch), screen(s) { }
+ ScreenLogicalDotsPerInchEvent(QScreen *s, qreal dx, qreal dy)
+ : WindowSystemEvent(ScreenLogicalDotsPerInch), screen(s), dpiX(dx), dpiY(dy) { }
QWeakPointer<QScreen> screen;
+ qreal dpiX;
+ qreal dpiY;
};
class MapEvent : public WindowSystemEvent {
@@ -256,6 +262,8 @@ public:
static void queueWindowSystemEvent(WindowSystemEvent *ev);
static QTime eventTime;
+
+ static QList<QTouchEvent::TouchPoint> convertTouchPoints(const QList<QWindowSystemInterface::TouchPoint> &points, QEvent::Type *type);
};
QT_END_HEADER
diff --git a/src/gui/math3d/qgenericmatrix.cpp b/src/gui/math3d/qgenericmatrix.cpp
index c1e1d92935..88682702de 100644
--- a/src/gui/math3d/qgenericmatrix.cpp
+++ b/src/gui/math3d/qgenericmatrix.cpp
@@ -1,6 +1,6 @@
/****************************************************************************
**
-** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies).
+** Copyright (C) 2012 Nokia Corporation and/or its subsidiary(-ies).
** All rights reserved.
** Contact: Nokia Corporation (qt-info@nokia.com)
**
diff --git a/src/gui/math3d/qgenericmatrix.h b/src/gui/math3d/qgenericmatrix.h
index a90d32a2b6..c992415426 100644
--- a/src/gui/math3d/qgenericmatrix.h
+++ b/src/gui/math3d/qgenericmatrix.h
@@ -1,6 +1,6 @@
/****************************************************************************
**
-** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies).
+** Copyright (C) 2012 Nokia Corporation and/or its subsidiary(-ies).
** All rights reserved.
** Contact: Nokia Corporation (qt-info@nokia.com)
**
diff --git a/src/gui/math3d/qmatrix4x4.cpp b/src/gui/math3d/qmatrix4x4.cpp
index 1797564a98..b6b60e7072 100644
--- a/src/gui/math3d/qmatrix4x4.cpp
+++ b/src/gui/math3d/qmatrix4x4.cpp
@@ -1,6 +1,6 @@
/****************************************************************************
**
-** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies).
+** Copyright (C) 2012 Nokia Corporation and/or its subsidiary(-ies).
** All rights reserved.
** Contact: Nokia Corporation (qt-info@nokia.com)
**
diff --git a/src/gui/math3d/qmatrix4x4.h b/src/gui/math3d/qmatrix4x4.h
index 2c98dd03e3..98f967f63c 100644
--- a/src/gui/math3d/qmatrix4x4.h
+++ b/src/gui/math3d/qmatrix4x4.h
@@ -1,6 +1,6 @@
/****************************************************************************
**
-** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies).
+** Copyright (C) 2012 Nokia Corporation and/or its subsidiary(-ies).
** All rights reserved.
** Contact: Nokia Corporation (qt-info@nokia.com)
**
diff --git a/src/gui/math3d/qquaternion.cpp b/src/gui/math3d/qquaternion.cpp
index ef1b545e10..53e01323d9 100644
--- a/src/gui/math3d/qquaternion.cpp
+++ b/src/gui/math3d/qquaternion.cpp
@@ -1,6 +1,6 @@
/****************************************************************************
**
-** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies).
+** Copyright (C) 2012 Nokia Corporation and/or its subsidiary(-ies).
** All rights reserved.
** Contact: Nokia Corporation (qt-info@nokia.com)
**
diff --git a/src/gui/math3d/qquaternion.h b/src/gui/math3d/qquaternion.h
index 802de8b3b7..78b2d91d13 100644
--- a/src/gui/math3d/qquaternion.h
+++ b/src/gui/math3d/qquaternion.h
@@ -1,6 +1,6 @@
/****************************************************************************
**
-** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies).
+** Copyright (C) 2012 Nokia Corporation and/or its subsidiary(-ies).
** All rights reserved.
** Contact: Nokia Corporation (qt-info@nokia.com)
**
diff --git a/src/gui/math3d/qvector2d.cpp b/src/gui/math3d/qvector2d.cpp
index cd94007aad..a1c7ac048f 100644
--- a/src/gui/math3d/qvector2d.cpp
+++ b/src/gui/math3d/qvector2d.cpp
@@ -1,6 +1,6 @@
/****************************************************************************
**
-** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies).
+** Copyright (C) 2012 Nokia Corporation and/or its subsidiary(-ies).
** All rights reserved.
** Contact: Nokia Corporation (qt-info@nokia.com)
**
diff --git a/src/gui/math3d/qvector2d.h b/src/gui/math3d/qvector2d.h
index f771ce34d0..df435bcf49 100644
--- a/src/gui/math3d/qvector2d.h
+++ b/src/gui/math3d/qvector2d.h
@@ -1,6 +1,6 @@
/****************************************************************************
**
-** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies).
+** Copyright (C) 2012 Nokia Corporation and/or its subsidiary(-ies).
** All rights reserved.
** Contact: Nokia Corporation (qt-info@nokia.com)
**
diff --git a/src/gui/math3d/qvector3d.cpp b/src/gui/math3d/qvector3d.cpp
index 4e8a62fea3..096d14223c 100644
--- a/src/gui/math3d/qvector3d.cpp
+++ b/src/gui/math3d/qvector3d.cpp
@@ -1,6 +1,6 @@
/****************************************************************************
**
-** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies).
+** Copyright (C) 2012 Nokia Corporation and/or its subsidiary(-ies).
** All rights reserved.
** Contact: Nokia Corporation (qt-info@nokia.com)
**
diff --git a/src/gui/math3d/qvector3d.h b/src/gui/math3d/qvector3d.h
index 17785a6c7c..55c0e36ca2 100644
--- a/src/gui/math3d/qvector3d.h
+++ b/src/gui/math3d/qvector3d.h
@@ -1,6 +1,6 @@
/****************************************************************************
**
-** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies).
+** Copyright (C) 2012 Nokia Corporation and/or its subsidiary(-ies).
** All rights reserved.
** Contact: Nokia Corporation (qt-info@nokia.com)
**
diff --git a/src/gui/math3d/qvector4d.cpp b/src/gui/math3d/qvector4d.cpp
index 41c7b296be..ce3d410b39 100644
--- a/src/gui/math3d/qvector4d.cpp
+++ b/src/gui/math3d/qvector4d.cpp
@@ -1,6 +1,6 @@
/****************************************************************************
**
-** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies).
+** Copyright (C) 2012 Nokia Corporation and/or its subsidiary(-ies).
** All rights reserved.
** Contact: Nokia Corporation (qt-info@nokia.com)
**
diff --git a/src/gui/math3d/qvector4d.h b/src/gui/math3d/qvector4d.h
index 64b8079b76..ceff21163f 100644
--- a/src/gui/math3d/qvector4d.h
+++ b/src/gui/math3d/qvector4d.h
@@ -1,6 +1,6 @@
/****************************************************************************
**
-** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies).
+** Copyright (C) 2012 Nokia Corporation and/or its subsidiary(-ies).
** All rights reserved.
** Contact: Nokia Corporation (qt-info@nokia.com)
**
diff --git a/src/gui/opengl/qopengl.cpp b/src/gui/opengl/qopengl.cpp
index 3233fcfa5b..246d4dfa24 100644
--- a/src/gui/opengl/qopengl.cpp
+++ b/src/gui/opengl/qopengl.cpp
@@ -1,6 +1,6 @@
/****************************************************************************
**
-** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies).
+** Copyright (C) 2012 Nokia Corporation and/or its subsidiary(-ies).
** All rights reserved.
** Contact: Nokia Corporation (qt-info@nokia.com)
**
diff --git a/src/gui/opengl/qopengl.h b/src/gui/opengl/qopengl.h
index cc64804efd..a3ec59cef1 100644
--- a/src/gui/opengl/qopengl.h
+++ b/src/gui/opengl/qopengl.h
@@ -1,6 +1,6 @@
/****************************************************************************
**
-** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies).
+** Copyright (C) 2012 Nokia Corporation and/or its subsidiary(-ies).
** All rights reserved.
** Contact: Nokia Corporation (qt-info@nokia.com)
**
diff --git a/src/gui/opengl/qopengl2pexvertexarray.cpp b/src/gui/opengl/qopengl2pexvertexarray.cpp
index ec26fdbf5b..1db2223667 100644
--- a/src/gui/opengl/qopengl2pexvertexarray.cpp
+++ b/src/gui/opengl/qopengl2pexvertexarray.cpp
@@ -1,6 +1,6 @@
/****************************************************************************
**
-** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies).
+** Copyright (C) 2012 Nokia Corporation and/or its subsidiary(-ies).
** All rights reserved.
** Contact: Nokia Corporation (qt-info@nokia.com)
**
diff --git a/src/gui/opengl/qopengl2pexvertexarray_p.h b/src/gui/opengl/qopengl2pexvertexarray_p.h
index 5ad4f7a237..779fa5a545 100644
--- a/src/gui/opengl/qopengl2pexvertexarray_p.h
+++ b/src/gui/opengl/qopengl2pexvertexarray_p.h
@@ -1,6 +1,6 @@
/****************************************************************************
**
-** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies).
+** Copyright (C) 2012 Nokia Corporation and/or its subsidiary(-ies).
** All rights reserved.
** Contact: Nokia Corporation (qt-info@nokia.com)
**
diff --git a/src/gui/opengl/qopengl_p.h b/src/gui/opengl/qopengl_p.h
index b09f9447db..5323604ce5 100644
--- a/src/gui/opengl/qopengl_p.h
+++ b/src/gui/opengl/qopengl_p.h
@@ -1,6 +1,6 @@
/****************************************************************************
**
-** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies).
+** Copyright (C) 2012 Nokia Corporation and/or its subsidiary(-ies).
** All rights reserved.
** Contact: Nokia Corporation (qt-info@nokia.com)
**
diff --git a/src/gui/opengl/qopenglbuffer.cpp b/src/gui/opengl/qopenglbuffer.cpp
index bdd38018fa..6bf4fedc8e 100644
--- a/src/gui/opengl/qopenglbuffer.cpp
+++ b/src/gui/opengl/qopenglbuffer.cpp
@@ -1,6 +1,6 @@
/****************************************************************************
**
-** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies).
+** Copyright (C) 2012 Nokia Corporation and/or its subsidiary(-ies).
** All rights reserved.
** Contact: Nokia Corporation (qt-info@nokia.com)
**
diff --git a/src/gui/opengl/qopenglbuffer.h b/src/gui/opengl/qopenglbuffer.h
index 52a2c4d640..83ad5cda51 100644
--- a/src/gui/opengl/qopenglbuffer.h
+++ b/src/gui/opengl/qopenglbuffer.h
@@ -1,6 +1,6 @@
/****************************************************************************
**
-** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies).
+** Copyright (C) 2012 Nokia Corporation and/or its subsidiary(-ies).
** All rights reserved.
** Contact: Nokia Corporation (qt-info@nokia.com)
**
diff --git a/src/gui/opengl/qopenglcustomshaderstage.cpp b/src/gui/opengl/qopenglcustomshaderstage.cpp
index 6cedf66df1..25a07b2a4c 100644
--- a/src/gui/opengl/qopenglcustomshaderstage.cpp
+++ b/src/gui/opengl/qopenglcustomshaderstage.cpp
@@ -1,6 +1,6 @@
/****************************************************************************
**
-** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies).
+** Copyright (C) 2012 Nokia Corporation and/or its subsidiary(-ies).
** All rights reserved.
** Contact: Nokia Corporation (qt-info@nokia.com)
**
diff --git a/src/gui/opengl/qopenglcustomshaderstage_p.h b/src/gui/opengl/qopenglcustomshaderstage_p.h
index de459c0050..35c59a9e9b 100644
--- a/src/gui/opengl/qopenglcustomshaderstage_p.h
+++ b/src/gui/opengl/qopenglcustomshaderstage_p.h
@@ -1,6 +1,6 @@
/****************************************************************************
**
-** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies).
+** Copyright (C) 2012 Nokia Corporation and/or its subsidiary(-ies).
** All rights reserved.
** Contact: Nokia Corporation (qt-info@nokia.com)
**
diff --git a/src/gui/opengl/qopenglengineshadermanager.cpp b/src/gui/opengl/qopenglengineshadermanager.cpp
index aaca6ad89c..9520f07fcc 100644
--- a/src/gui/opengl/qopenglengineshadermanager.cpp
+++ b/src/gui/opengl/qopenglengineshadermanager.cpp
@@ -1,6 +1,6 @@
/****************************************************************************
**
-** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies).
+** Copyright (C) 2012 Nokia Corporation and/or its subsidiary(-ies).
** All rights reserved.
** Contact: Nokia Corporation (qt-info@nokia.com)
**
@@ -247,8 +247,7 @@ QOpenGLEngineSharedShaders::QOpenGLEngineSharedShaders(QOpenGLContext* context)
if (!inCache)
simpleShaderCache.store(simpleShaderProg, context);
} else {
- qCritical() << "Errors linking simple shader:"
- << simpleShaderProg->log();
+ qCritical("Errors linking simple shader: %s", qPrintable(simpleShaderProg->log()));
}
// Compile the blit shader:
@@ -289,8 +288,7 @@ QOpenGLEngineSharedShaders::QOpenGLEngineSharedShaders(QOpenGLContext* context)
if (!inCache)
blitShaderCache.store(blitShaderProg, context);
} else {
- qCritical() << "Errors linking blit shader:"
- << blitShaderProg->log();
+ qCritical("Errors linking blit shader: %s", qPrintable(blitShaderProg->log()));
}
#ifdef QT_GL_SHARED_SHADER_DEBUG
diff --git a/src/gui/opengl/qopenglengineshadermanager_p.h b/src/gui/opengl/qopenglengineshadermanager_p.h
index 1dcc4fe7a7..39cd2e4d70 100644
--- a/src/gui/opengl/qopenglengineshadermanager_p.h
+++ b/src/gui/opengl/qopenglengineshadermanager_p.h
@@ -1,6 +1,6 @@
/****************************************************************************
**
-** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies).
+** Copyright (C) 2012 Nokia Corporation and/or its subsidiary(-ies).
** All rights reserved.
** Contact: Nokia Corporation (qt-info@nokia.com)
**
diff --git a/src/gui/opengl/qopenglengineshadersource_p.h b/src/gui/opengl/qopenglengineshadersource_p.h
index cb85212308..65e3fc54a5 100644
--- a/src/gui/opengl/qopenglengineshadersource_p.h
+++ b/src/gui/opengl/qopenglengineshadersource_p.h
@@ -1,6 +1,6 @@
/****************************************************************************
**
-** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies).
+** Copyright (C) 2012 Nokia Corporation and/or its subsidiary(-ies).
** All rights reserved.
** Contact: Nokia Corporation (qt-info@nokia.com)
**
diff --git a/src/gui/opengl/qopenglextensions_p.h b/src/gui/opengl/qopenglextensions_p.h
index 65d92e3a65..b66af217a6 100644
--- a/src/gui/opengl/qopenglextensions_p.h
+++ b/src/gui/opengl/qopenglextensions_p.h
@@ -1,6 +1,6 @@
/****************************************************************************
**
-** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies).
+** Copyright (C) 2012 Nokia Corporation and/or its subsidiary(-ies).
** All rights reserved.
** Contact: Nokia Corporation (qt-info@nokia.com)
**
diff --git a/src/gui/opengl/qopenglframebufferobject.cpp b/src/gui/opengl/qopenglframebufferobject.cpp
index bd2f1fd5dc..261a6df27d 100644
--- a/src/gui/opengl/qopenglframebufferobject.cpp
+++ b/src/gui/opengl/qopenglframebufferobject.cpp
@@ -1,6 +1,6 @@
/****************************************************************************
**
-** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies).
+** Copyright (C) 2012 Nokia Corporation and/or its subsidiary(-ies).
** All rights reserved.
** Contact: Nokia Corporation (qt-info@nokia.com)
**
diff --git a/src/gui/opengl/qopenglframebufferobject.h b/src/gui/opengl/qopenglframebufferobject.h
index 8a57784f4f..acce7d7391 100644
--- a/src/gui/opengl/qopenglframebufferobject.h
+++ b/src/gui/opengl/qopenglframebufferobject.h
@@ -1,6 +1,6 @@
/****************************************************************************
**
-** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies).
+** Copyright (C) 2012 Nokia Corporation and/or its subsidiary(-ies).
** All rights reserved.
** Contact: Nokia Corporation (qt-info@nokia.com)
**
diff --git a/src/gui/opengl/qopenglframebufferobject_p.h b/src/gui/opengl/qopenglframebufferobject_p.h
index 93a8bbf32f..aeaa2a0e7d 100644
--- a/src/gui/opengl/qopenglframebufferobject_p.h
+++ b/src/gui/opengl/qopenglframebufferobject_p.h
@@ -1,6 +1,6 @@
/****************************************************************************
**
-** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies).
+** Copyright (C) 2012 Nokia Corporation and/or its subsidiary(-ies).
** All rights reserved.
** Contact: Nokia Corporation (qt-info@nokia.com)
**
diff --git a/src/gui/opengl/qopenglfunctions.cpp b/src/gui/opengl/qopenglfunctions.cpp
index 24cf858a7c..a34dfc193c 100644
--- a/src/gui/opengl/qopenglfunctions.cpp
+++ b/src/gui/opengl/qopenglfunctions.cpp
@@ -1,6 +1,6 @@
/****************************************************************************
**
-** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies).
+** Copyright (C) 2012 Nokia Corporation and/or its subsidiary(-ies).
** All rights reserved.
** Contact: Nokia Corporation (qt-info@nokia.com)
**
diff --git a/src/gui/opengl/qopenglfunctions.h b/src/gui/opengl/qopenglfunctions.h
index 7d9e34740e..2f4b5b18cb 100644
--- a/src/gui/opengl/qopenglfunctions.h
+++ b/src/gui/opengl/qopenglfunctions.h
@@ -1,6 +1,6 @@
/****************************************************************************
**
-** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies).
+** Copyright (C) 2012 Nokia Corporation and/or its subsidiary(-ies).
** All rights reserved.
** Contact: Nokia Corporation (qt-info@nokia.com)
**
diff --git a/src/gui/opengl/qopenglgradientcache.cpp b/src/gui/opengl/qopenglgradientcache.cpp
index f8d61cd620..dde5eaf93e 100644
--- a/src/gui/opengl/qopenglgradientcache.cpp
+++ b/src/gui/opengl/qopenglgradientcache.cpp
@@ -1,6 +1,6 @@
/****************************************************************************
**
-** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies).
+** Copyright (C) 2012 Nokia Corporation and/or its subsidiary(-ies).
** All rights reserved.
** Contact: Nokia Corporation (qt-info@nokia.com)
**
diff --git a/src/gui/opengl/qopenglgradientcache_p.h b/src/gui/opengl/qopenglgradientcache_p.h
index 53abf221d2..055798fcd8 100644
--- a/src/gui/opengl/qopenglgradientcache_p.h
+++ b/src/gui/opengl/qopenglgradientcache_p.h
@@ -1,6 +1,6 @@
/****************************************************************************
**
-** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies).
+** Copyright (C) 2012 Nokia Corporation and/or its subsidiary(-ies).
** All rights reserved.
** Contact: Nokia Corporation (qt-info@nokia.com)
**
diff --git a/src/gui/opengl/qopenglpaintdevice.cpp b/src/gui/opengl/qopenglpaintdevice.cpp
index 4e5c2703dc..35ef609529 100644
--- a/src/gui/opengl/qopenglpaintdevice.cpp
+++ b/src/gui/opengl/qopenglpaintdevice.cpp
@@ -1,6 +1,6 @@
/****************************************************************************
**
-** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies).
+** Copyright (C) 2012 Nokia Corporation and/or its subsidiary(-ies).
** All rights reserved.
** Contact: Nokia Corporation (qt-info@nokia.com)
**
diff --git a/src/gui/opengl/qopenglpaintdevice.h b/src/gui/opengl/qopenglpaintdevice.h
index 9edc347b32..0a7bb3c9f3 100644
--- a/src/gui/opengl/qopenglpaintdevice.h
+++ b/src/gui/opengl/qopenglpaintdevice.h
@@ -1,6 +1,6 @@
/****************************************************************************
**
-** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies).
+** Copyright (C) 2012 Nokia Corporation and/or its subsidiary(-ies).
** All rights reserved.
** Contact: Nokia Corporation (qt-info@nokia.com)
**
diff --git a/src/gui/opengl/qopenglpaintengine.cpp b/src/gui/opengl/qopenglpaintengine.cpp
index c1bde757a2..834beda977 100644
--- a/src/gui/opengl/qopenglpaintengine.cpp
+++ b/src/gui/opengl/qopenglpaintengine.cpp
@@ -1,6 +1,6 @@
/****************************************************************************
**
-** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies).
+** Copyright (C) 2012 Nokia Corporation and/or its subsidiary(-ies).
** All rights reserved.
** Contact: Nokia Corporation (qt-info@nokia.com)
**
@@ -673,8 +673,8 @@ void QOpenGL2PaintEngineExPrivate::cleanupVectorPath(QPaintEngineEx *engine, voi
d->unusedIBOSToClean << c->ibo;
#else
Q_UNUSED(engine);
- qFree(c->vertices);
- qFree(c->indices);
+ free(c->vertices);
+ free(c->indices);
#endif
delete c;
}
@@ -719,7 +719,7 @@ void QOpenGL2PaintEngineExPrivate::fill(const QVectorPath& path)
cache->vbo = 0;
Q_ASSERT(cache->ibo == 0);
#else
- qFree(cache->vertices);
+ free(cache->vertices);
Q_ASSERT(cache->indices == 0);
#endif
updateCache = true;
@@ -747,7 +747,7 @@ void QOpenGL2PaintEngineExPrivate::fill(const QVectorPath& path)
glBufferData(GL_ARRAY_BUFFER, floatSizeInBytes, vertexCoordinateArray.data(), GL_STATIC_DRAW);
cache->ibo = 0;
#else
- cache->vertices = (float *) qMalloc(floatSizeInBytes);
+ cache->vertices = (float *) malloc(floatSizeInBytes);
memcpy(cache->vertices, vertexCoordinateArray.data(), floatSizeInBytes);
cache->indices = 0;
#endif
@@ -799,8 +799,8 @@ void QOpenGL2PaintEngineExPrivate::fill(const QVectorPath& path)
glDeleteBuffers(1, &cache->vbo);
glDeleteBuffers(1, &cache->ibo);
#else
- qFree(cache->vertices);
- qFree(cache->indices);
+ free(cache->vertices);
+ free(cache->indices);
#endif
updateCache = true;
}
@@ -835,12 +835,12 @@ void QOpenGL2PaintEngineExPrivate::fill(const QVectorPath& path)
vertices[i] = float(inverseScale * polys.vertices.at(i));
funcs.glBufferData(GL_ARRAY_BUFFER, sizeof(float) * vertices.size(), vertices.data(), GL_STATIC_DRAW);
#else
- cache->vertices = (float *) qMalloc(sizeof(float) * polys.vertices.size());
+ cache->vertices = (float *) malloc(sizeof(float) * polys.vertices.size());
if (polys.indices.type() == QVertexIndexVector::UnsignedInt) {
- cache->indices = (quint32 *) qMalloc(sizeof(quint32) * polys.indices.size());
+ cache->indices = (quint32 *) malloc(sizeof(quint32) * polys.indices.size());
memcpy(cache->indices, polys.indices.data(), sizeof(quint32) * polys.indices.size());
} else {
- cache->indices = (quint16 *) qMalloc(sizeof(quint16) * polys.indices.size());
+ cache->indices = (quint16 *) malloc(sizeof(quint16) * polys.indices.size());
memcpy(cache->indices, polys.indices.data(), sizeof(quint16) * polys.indices.size());
}
for (int i = 0; i < polys.vertices.size(); ++i)
diff --git a/src/gui/opengl/qopenglpaintengine_p.h b/src/gui/opengl/qopenglpaintengine_p.h
index 1ce04eb5a7..9f125eb616 100644
--- a/src/gui/opengl/qopenglpaintengine_p.h
+++ b/src/gui/opengl/qopenglpaintengine_p.h
@@ -1,6 +1,6 @@
/****************************************************************************
**
-** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies).
+** Copyright (C) 2012 Nokia Corporation and/or its subsidiary(-ies).
** All rights reserved.
** Contact: Nokia Corporation (qt-info@nokia.com)
**
diff --git a/src/gui/opengl/qopenglshadercache_meego_p.h b/src/gui/opengl/qopenglshadercache_meego_p.h
index 86a8a861da..02a1c84336 100644
--- a/src/gui/opengl/qopenglshadercache_meego_p.h
+++ b/src/gui/opengl/qopenglshadercache_meego_p.h
@@ -1,6 +1,6 @@
/****************************************************************************
**
-** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies).
+** Copyright (C) 2012 Nokia Corporation and/or its subsidiary(-ies).
** All rights reserved.
** Contact: Nokia Corporation (qt-info@nokia.com)
**
diff --git a/src/gui/opengl/qopenglshadercache_p.h b/src/gui/opengl/qopenglshadercache_p.h
index 05a058050c..64435eb1c2 100644
--- a/src/gui/opengl/qopenglshadercache_p.h
+++ b/src/gui/opengl/qopenglshadercache_p.h
@@ -1,6 +1,6 @@
/****************************************************************************
**
-** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies).
+** Copyright (C) 2012 Nokia Corporation and/or its subsidiary(-ies).
** All rights reserved.
** Contact: Nokia Corporation (qt-info@nokia.com)
**
diff --git a/src/gui/opengl/qopenglshaderprogram.cpp b/src/gui/opengl/qopenglshaderprogram.cpp
index 70f9b042c7..fab764ed6e 100644
--- a/src/gui/opengl/qopenglshaderprogram.cpp
+++ b/src/gui/opengl/qopenglshaderprogram.cpp
@@ -1,6 +1,6 @@
/****************************************************************************
**
-** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies).
+** Copyright (C) 2012 Nokia Corporation and/or its subsidiary(-ies).
** All rights reserved.
** Contact: Nokia Corporation (qt-info@nokia.com)
**
@@ -265,7 +265,6 @@ bool QOpenGLShaderPrivate::compile(QOpenGLShader *q)
glfuncs->glGetShaderSource(shader, sourceCodeLength, &temp, sourceCodeBuffer);
}
- QString log;
if (logBuffer)
log = QString::fromLatin1(logBuffer);
else
diff --git a/src/gui/opengl/qopenglshaderprogram.h b/src/gui/opengl/qopenglshaderprogram.h
index 4c123749a2..f6244cd12c 100644
--- a/src/gui/opengl/qopenglshaderprogram.h
+++ b/src/gui/opengl/qopenglshaderprogram.h
@@ -1,6 +1,6 @@
/****************************************************************************
**
-** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies).
+** Copyright (C) 2012 Nokia Corporation and/or its subsidiary(-ies).
** All rights reserved.
** Contact: Nokia Corporation (qt-info@nokia.com)
**
diff --git a/src/gui/opengl/qopengltexturecache.cpp b/src/gui/opengl/qopengltexturecache.cpp
index 067b7a9e20..a93ae91354 100644
--- a/src/gui/opengl/qopengltexturecache.cpp
+++ b/src/gui/opengl/qopengltexturecache.cpp
@@ -1,6 +1,6 @@
/****************************************************************************
**
-** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies).
+** Copyright (C) 2012 Nokia Corporation and/or its subsidiary(-ies).
** All rights reserved.
** Contact: Nokia Corporation (qt-info@nokia.com)
**
@@ -107,6 +107,8 @@ QOpenGLTextureCache::~QOpenGLTextureCache()
GLuint QOpenGLTextureCache::bindTexture(QOpenGLContext *context, const QPixmap &pixmap)
{
+ if (pixmap.isNull())
+ return 0;
QMutexLocker locker(&m_mutex);
qint64 key = pixmap.cacheKey();
@@ -128,6 +130,8 @@ GLuint QOpenGLTextureCache::bindTexture(QOpenGLContext *context, const QPixmap &
GLuint QOpenGLTextureCache::bindTexture(QOpenGLContext *context, const QImage &image)
{
+ if (image.isNull())
+ return 0;
QMutexLocker locker(&m_mutex);
qint64 key = image.cacheKey();
diff --git a/src/gui/opengl/qopengltexturecache_p.h b/src/gui/opengl/qopengltexturecache_p.h
index bdee9f4e83..c6e46dd6cb 100644
--- a/src/gui/opengl/qopengltexturecache_p.h
+++ b/src/gui/opengl/qopengltexturecache_p.h
@@ -1,6 +1,6 @@
/****************************************************************************
**
-** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies).
+** Copyright (C) 2012 Nokia Corporation and/or its subsidiary(-ies).
** All rights reserved.
** Contact: Nokia Corporation (qt-info@nokia.com)
**
@@ -73,7 +73,7 @@ private:
QOpenGLSharedResourceGuard *m_resource;
};
-class QOpenGLTextureCache : public QOpenGLSharedResource
+class Q_GUI_EXPORT QOpenGLTextureCache : public QOpenGLSharedResource
{
public:
static QOpenGLTextureCache *cacheForContext(QOpenGLContext *context);
diff --git a/src/gui/opengl/qopengltextureglyphcache.cpp b/src/gui/opengl/qopengltextureglyphcache.cpp
index 55acdb39b9..9f5ce46854 100644
--- a/src/gui/opengl/qopengltextureglyphcache.cpp
+++ b/src/gui/opengl/qopengltextureglyphcache.cpp
@@ -1,6 +1,6 @@
/****************************************************************************
**
-** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies).
+** Copyright (C) 2012 Nokia Corporation and/or its subsidiary(-ies).
** All rights reserved.
** Contact: Nokia Corporation (qt-info@nokia.com)
**
diff --git a/src/gui/opengl/qopengltextureglyphcache_p.h b/src/gui/opengl/qopengltextureglyphcache_p.h
index 97f9ac3c64..5da8d1ce4b 100644
--- a/src/gui/opengl/qopengltextureglyphcache_p.h
+++ b/src/gui/opengl/qopengltextureglyphcache_p.h
@@ -1,6 +1,6 @@
/****************************************************************************
**
-** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies).
+** Copyright (C) 2012 Nokia Corporation and/or its subsidiary(-ies).
** All rights reserved.
** Contact: Nokia Corporation (qt-info@nokia.com)
**
diff --git a/src/gui/opengl/qopengltriangulatingstroker.cpp b/src/gui/opengl/qopengltriangulatingstroker.cpp
index 4d1a8f86b2..65ee8753c4 100644
--- a/src/gui/opengl/qopengltriangulatingstroker.cpp
+++ b/src/gui/opengl/qopengltriangulatingstroker.cpp
@@ -1,6 +1,6 @@
/****************************************************************************
**
-** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies).
+** Copyright (C) 2012 Nokia Corporation and/or its subsidiary(-ies).
** All rights reserved.
** Contact: Nokia Corporation (qt-info@nokia.com)
**
diff --git a/src/gui/opengl/qopengltriangulatingstroker_p.h b/src/gui/opengl/qopengltriangulatingstroker_p.h
index abb10957c0..965fce6157 100644
--- a/src/gui/opengl/qopengltriangulatingstroker_p.h
+++ b/src/gui/opengl/qopengltriangulatingstroker_p.h
@@ -1,6 +1,6 @@
/****************************************************************************
**
-** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies).
+** Copyright (C) 2012 Nokia Corporation and/or its subsidiary(-ies).
** All rights reserved.
** Contact: Nokia Corporation (qt-info@nokia.com)
**
diff --git a/src/gui/opengl/qrbtree_p.h b/src/gui/opengl/qrbtree_p.h
index ac464a3fbe..dbcf037193 100644
--- a/src/gui/opengl/qrbtree_p.h
+++ b/src/gui/opengl/qrbtree_p.h
@@ -1,6 +1,6 @@
/****************************************************************************
**
-** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies).
+** Copyright (C) 2012 Nokia Corporation and/or its subsidiary(-ies).
** All rights reserved.
** Contact: Nokia Corporation (qt-info@nokia.com)
**
diff --git a/src/gui/opengl/qtriangulator.cpp b/src/gui/opengl/qtriangulator.cpp
index 67c2a6494e..c4b8aba9a7 100644
--- a/src/gui/opengl/qtriangulator.cpp
+++ b/src/gui/opengl/qtriangulator.cpp
@@ -1,6 +1,6 @@
/****************************************************************************
**
-** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies).
+** Copyright (C) 2012 Nokia Corporation and/or its subsidiary(-ies).
** All rights reserved.
** Contact: Nokia Corporation (qt-info@nokia.com)
**
@@ -41,7 +41,6 @@
#include "qtriangulator_p.h"
-#include <QtWidgets/qdialog.h>
#include <QtGui/qevent.h>
#include <QtGui/qpainter.h>
#include <QtGui/qpainterpath.h>
@@ -721,78 +720,6 @@ inline void QInt64Set::clear()
}
//============================================================================//
-// QRingBuffer //
-//============================================================================//
-
-// T must be POD.
-template <class T>
-class QRingBuffer
-{
-public:
- inline QRingBuffer() : m_array(0), m_head(0), m_size(0), m_capacity(0) { }
- inline ~QRingBuffer() {if (m_array) delete[] m_array;}
- bool reallocate(int capacity);
- inline const T &head() const {Q_ASSERT(m_size > 0); return m_array[m_head];}
- inline const T &dequeue();
- inline void enqueue(const T &x);
- inline bool isEmpty() const {return m_size == 0;}
-private:
- T *m_array;
- int m_head;
- int m_size;
- int m_capacity;
-};
-
-template <class T>
-bool QRingBuffer<T>::reallocate(int capacity)
-{
- T *oldArray = m_array;
- m_array = new T[capacity];
- if (m_array) {
- if (oldArray) {
- if (m_head + m_size > m_capacity) {
- memcpy(m_array, oldArray + m_head, (m_capacity - m_head) * sizeof(T));
- memcpy(m_array + (m_capacity - m_head), oldArray, (m_head + m_size - m_capacity) * sizeof(T));
- } else {
- memcpy(m_array, oldArray + m_head, m_size * sizeof(T));
- }
- delete[] oldArray;
- }
- m_capacity = capacity;
- m_head = 0;
- return true;
- } else {
- m_array = oldArray;
- return false;
- }
-}
-
-template <class T>
-inline const T &QRingBuffer<T>::dequeue()
-{
- Q_ASSERT(m_size > 0);
- Q_ASSERT(m_array);
- Q_ASSERT(m_capacity >= m_size);
- int index = m_head;
- if (++m_head >= m_capacity)
- m_head -= m_capacity;
- --m_size;
- return m_array[index];
-}
-
-template <class T>
-inline void QRingBuffer<T>::enqueue(const T &x)
-{
- if (m_size == m_capacity)
- reallocate(qMax(2 * m_capacity, 64));
- int index = m_head + m_size;
- if (index >= m_capacity)
- index -= m_capacity;
- m_array[index] = x;
- ++m_size;
-}
-
-//============================================================================//
// QTriangulator //
//============================================================================//
template<typename T>
diff --git a/src/gui/opengl/qtriangulator_p.h b/src/gui/opengl/qtriangulator_p.h
index 8f95d58e23..96dedd5eca 100644
--- a/src/gui/opengl/qtriangulator_p.h
+++ b/src/gui/opengl/qtriangulator_p.h
@@ -1,6 +1,6 @@
/****************************************************************************
**
-** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies).
+** Copyright (C) 2012 Nokia Corporation and/or its subsidiary(-ies).
** All rights reserved.
** Contact: Nokia Corporation (qt-info@nokia.com)
**
diff --git a/src/gui/painting/qbackingstore.cpp b/src/gui/painting/qbackingstore.cpp
index fa29589508..08f809ed88 100644
--- a/src/gui/painting/qbackingstore.cpp
+++ b/src/gui/painting/qbackingstore.cpp
@@ -1,6 +1,6 @@
/****************************************************************************
**
-** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies).
+** Copyright (C) 2012 Nokia Corporation and/or its subsidiary(-ies).
** All rights reserved.
** Contact: Nokia Corporation (qt-info@nokia.com)
**
diff --git a/src/gui/painting/qbackingstore.h b/src/gui/painting/qbackingstore.h
index d5ec3b31d3..0172a78d85 100644
--- a/src/gui/painting/qbackingstore.h
+++ b/src/gui/painting/qbackingstore.h
@@ -1,6 +1,6 @@
/****************************************************************************
**
-** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies).
+** Copyright (C) 2012 Nokia Corporation and/or its subsidiary(-ies).
** All rights reserved.
** Contact: Nokia Corporation (qt-info@nokia.com)
**
diff --git a/src/gui/painting/qbezier.cpp b/src/gui/painting/qbezier.cpp
index 9d204f9a39..75a75ead7d 100644
--- a/src/gui/painting/qbezier.cpp
+++ b/src/gui/painting/qbezier.cpp
@@ -1,6 +1,6 @@
/****************************************************************************
**
-** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies).
+** Copyright (C) 2012 Nokia Corporation and/or its subsidiary(-ies).
** All rights reserved.
** Contact: Nokia Corporation (qt-info@nokia.com)
**
@@ -190,9 +190,12 @@ static inline bool findInflections(qreal a, qreal b, qreal c,
void QBezier::addToPolygon(QPolygonF *polygon, qreal bezier_flattening_threshold) const
{
- QBezier beziers[32];
+ QBezier beziers[10];
+ int levels[10];
beziers[0] = *this;
+ levels[0] = 9;
QBezier *b = beziers;
+ int *lvl = levels;
while (b >= beziers) {
// check if we can pop the top bezier curve from the stack
@@ -208,14 +211,55 @@ void QBezier::addToPolygon(QPolygonF *polygon, qreal bezier_flattening_threshold
qAbs(b->x1 - b->x3) + qAbs(b->y1 - b->y3);
l = 1.;
}
- if (d < bezier_flattening_threshold*l || b == beziers + 31) {
+ if (d < bezier_flattening_threshold*l || *lvl == 0) {
// good enough, we pop it off and add the endpoint
polygon->append(QPointF(b->x4, b->y4));
--b;
+ --lvl;
+ } else {
+ // split, second half of the polygon goes lower into the stack
+ b->split(b+1, b);
+ lvl[1] = --lvl[0];
+ ++b;
+ ++lvl;
+ }
+ }
+}
+
+void QBezier::addToPolygon(QDataBuffer<QPointF> &polygon, qreal bezier_flattening_threshold) const
+{
+ QBezier beziers[10];
+ int levels[10];
+ beziers[0] = *this;
+ levels[0] = 9;
+ QBezier *b = beziers;
+ int *lvl = levels;
+
+ while (b >= beziers) {
+ // check if we can pop the top bezier curve from the stack
+ qreal y4y1 = b->y4 - b->y1;
+ qreal x4x1 = b->x4 - b->x1;
+ qreal l = qAbs(x4x1) + qAbs(y4y1);
+ qreal d;
+ if (l > 1.) {
+ d = qAbs( (x4x1)*(b->y1 - b->y2) - (y4y1)*(b->x1 - b->x2) )
+ + qAbs( (x4x1)*(b->y1 - b->y3) - (y4y1)*(b->x1 - b->x3) );
+ } else {
+ d = qAbs(b->x1 - b->x2) + qAbs(b->y1 - b->y2) +
+ qAbs(b->x1 - b->x3) + qAbs(b->y1 - b->y3);
+ l = 1.;
+ }
+ if (d < bezier_flattening_threshold*l || *lvl == 0) {
+ // good enough, we pop it off and add the endpoint
+ polygon.add(QPointF(b->x4, b->y4));
+ --b;
+ --lvl;
} else {
// split, second half of the polygon goes lower into the stack
b->split(b+1, b);
+ lvl[1] = --lvl[0];
++b;
+ ++lvl;
}
}
}
diff --git a/src/gui/painting/qbezier_p.h b/src/gui/painting/qbezier_p.h
index f1f7eb155a..368ae7e483 100644
--- a/src/gui/painting/qbezier_p.h
+++ b/src/gui/painting/qbezier_p.h
@@ -1,6 +1,6 @@
/****************************************************************************
**
-** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies).
+** Copyright (C) 2012 Nokia Corporation and/or its subsidiary(-ies).
** All rights reserved.
** Contact: Nokia Corporation (qt-info@nokia.com)
**
@@ -60,6 +60,7 @@
#include "QtCore/qlist.h"
#include "QtCore/qpair.h"
#include "QtGui/qtransform.h"
+#include <private/qdatabuffer_p.h>
QT_BEGIN_NAMESPACE
@@ -81,6 +82,7 @@ public:
QPolygonF toPolygon(qreal bezier_flattening_threshold = 0.5) const;
void addToPolygon(QPolygonF *p, qreal bezier_flattening_threshold = 0.5) const;
+ void addToPolygon(QDataBuffer<QPointF> &polygon, qreal bezier_flattening_threshold) const;
QRectF bounds() const;
qreal length(qreal error = 0.01) const;
diff --git a/src/gui/painting/qblendfunctions.cpp b/src/gui/painting/qblendfunctions.cpp
index fd3a8fce52..40047d8c94 100644
--- a/src/gui/painting/qblendfunctions.cpp
+++ b/src/gui/painting/qblendfunctions.cpp
@@ -1,6 +1,6 @@
/****************************************************************************
**
-** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies).
+** Copyright (C) 2012 Nokia Corporation and/or its subsidiary(-ies).
** All rights reserved.
** Contact: Nokia Corporation (qt-info@nokia.com)
**
diff --git a/src/gui/painting/qblendfunctions_p.h b/src/gui/painting/qblendfunctions_p.h
index 76e71b9d2f..412be40d67 100644
--- a/src/gui/painting/qblendfunctions_p.h
+++ b/src/gui/painting/qblendfunctions_p.h
@@ -1,6 +1,6 @@
/****************************************************************************
**
-** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies).
+** Copyright (C) 2012 Nokia Corporation and/or its subsidiary(-ies).
** All rights reserved.
** Contact: Nokia Corporation (qt-info@nokia.com)
**
diff --git a/src/gui/painting/qblittable.cpp b/src/gui/painting/qblittable.cpp
index 11058582ef..020eba0235 100644
--- a/src/gui/painting/qblittable.cpp
+++ b/src/gui/painting/qblittable.cpp
@@ -1,6 +1,6 @@
/****************************************************************************
**
-** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies).
+** Copyright (C) 2012 Nokia Corporation and/or its subsidiary(-ies).
** All rights reserved.
** Contact: Nokia Corporation (qt-info@nokia.com)
**
@@ -100,6 +100,12 @@ void QBlittable::unlock()
}
}
+bool QBlittable::isLocked() const
+{
+ Q_D(const QBlittable);
+ return d->locked;
+}
+
QT_END_NAMESPACE
#endif //QT_NO_BLITTABLE
diff --git a/src/gui/painting/qblittable_p.h b/src/gui/painting/qblittable_p.h
index a843733a56..c704c86452 100644
--- a/src/gui/painting/qblittable_p.h
+++ b/src/gui/painting/qblittable_p.h
@@ -1,6 +1,6 @@
/****************************************************************************
**
-** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies).
+** Copyright (C) 2012 Nokia Corporation and/or its subsidiary(-ies).
** All rights reserved.
** Contact: Nokia Corporation (qt-info@nokia.com)
**
@@ -80,6 +80,8 @@ public:
QImage *lock();
void unlock();
+ bool isLocked() const;
+
protected:
virtual QImage *doLock() = 0;
virtual void doUnlock() = 0;
diff --git a/src/gui/painting/qbrush.cpp b/src/gui/painting/qbrush.cpp
index b4aa27db2f..66f0395582 100644
--- a/src/gui/painting/qbrush.cpp
+++ b/src/gui/painting/qbrush.cpp
@@ -1,6 +1,6 @@
/****************************************************************************
**
-** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies).
+** Copyright (C) 2012 Nokia Corporation and/or its subsidiary(-ies).
** All rights reserved.
** Contact: Nokia Corporation (qt-info@nokia.com)
**
diff --git a/src/gui/painting/qbrush.h b/src/gui/painting/qbrush.h
index daad47cb19..060d11fd79 100644
--- a/src/gui/painting/qbrush.h
+++ b/src/gui/painting/qbrush.h
@@ -1,6 +1,6 @@
/****************************************************************************
**
-** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies).
+** Copyright (C) 2012 Nokia Corporation and/or its subsidiary(-ies).
** All rights reserved.
** Contact: Nokia Corporation (qt-info@nokia.com)
**
diff --git a/src/gui/painting/qcolor.cpp b/src/gui/painting/qcolor.cpp
index df2aa1ffe8..5f15ccbc63 100644
--- a/src/gui/painting/qcolor.cpp
+++ b/src/gui/painting/qcolor.cpp
@@ -1,6 +1,6 @@
/****************************************************************************
**
-** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies).
+** Copyright (C) 2012 Nokia Corporation and/or its subsidiary(-ies).
** All rights reserved.
** Contact: Nokia Corporation (qt-info@nokia.com)
**
diff --git a/src/gui/painting/qcolor.h b/src/gui/painting/qcolor.h
index 460a43183f..ac525cb068 100644
--- a/src/gui/painting/qcolor.h
+++ b/src/gui/painting/qcolor.h
@@ -1,6 +1,6 @@
/****************************************************************************
**
-** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies).
+** Copyright (C) 2012 Nokia Corporation and/or its subsidiary(-ies).
** All rights reserved.
** Contact: Nokia Corporation (qt-info@nokia.com)
**
diff --git a/src/gui/painting/qcolor_p.cpp b/src/gui/painting/qcolor_p.cpp
index 454fe82cfe..14b984978c 100644
--- a/src/gui/painting/qcolor_p.cpp
+++ b/src/gui/painting/qcolor_p.cpp
@@ -1,6 +1,6 @@
/****************************************************************************
**
-** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies).
+** Copyright (C) 2012 Nokia Corporation and/or its subsidiary(-ies).
** All rights reserved.
** Contact: Nokia Corporation (qt-info@nokia.com)
**
diff --git a/src/gui/painting/qcolor_p.h b/src/gui/painting/qcolor_p.h
index 8aec184ee2..f1a4d313e3 100644
--- a/src/gui/painting/qcolor_p.h
+++ b/src/gui/painting/qcolor_p.h
@@ -1,6 +1,6 @@
/****************************************************************************
**
-** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies).
+** Copyright (C) 2012 Nokia Corporation and/or its subsidiary(-ies).
** All rights reserved.
** Contact: Nokia Corporation (qt-info@nokia.com)
**
diff --git a/src/gui/painting/qcosmeticstroker.cpp b/src/gui/painting/qcosmeticstroker.cpp
index eb00ec87d8..c59399c905 100644
--- a/src/gui/painting/qcosmeticstroker.cpp
+++ b/src/gui/painting/qcosmeticstroker.cpp
@@ -1,6 +1,6 @@
/****************************************************************************
**
-** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies).
+** Copyright (C) 2012 Nokia Corporation and/or its subsidiary(-ies).
** All rights reserved.
** Contact: Nokia Corporation (qt-info@nokia.com)
**
diff --git a/src/gui/painting/qcosmeticstroker_p.h b/src/gui/painting/qcosmeticstroker_p.h
index 53cdf2c0ac..a7742769bd 100644
--- a/src/gui/painting/qcosmeticstroker_p.h
+++ b/src/gui/painting/qcosmeticstroker_p.h
@@ -1,6 +1,6 @@
/****************************************************************************
**
-** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies).
+** Copyright (C) 2012 Nokia Corporation and/or its subsidiary(-ies).
** All rights reserved.
** Contact: Nokia Corporation (qt-info@nokia.com)
**
diff --git a/src/gui/painting/qcssutil.cpp b/src/gui/painting/qcssutil.cpp
index f670258e46..4758a1362c 100644
--- a/src/gui/painting/qcssutil.cpp
+++ b/src/gui/painting/qcssutil.cpp
@@ -1,6 +1,6 @@
/****************************************************************************
**
-** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies).
+** Copyright (C) 2012 Nokia Corporation and/or its subsidiary(-ies).
** All rights reserved.
** Contact: Nokia Corporation (qt-info@nokia.com)
**
diff --git a/src/gui/painting/qcssutil_p.h b/src/gui/painting/qcssutil_p.h
index fe5b7057b9..e555788343 100644
--- a/src/gui/painting/qcssutil_p.h
+++ b/src/gui/painting/qcssutil_p.h
@@ -1,6 +1,6 @@
/****************************************************************************
**
-** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies).
+** Copyright (C) 2012 Nokia Corporation and/or its subsidiary(-ies).
** All rights reserved.
** Contact: Nokia Corporation (qt-info@nokia.com)
**
diff --git a/src/gui/painting/qdatabuffer_p.h b/src/gui/painting/qdatabuffer_p.h
index 8247e4233b..6c0f5d57c6 100644
--- a/src/gui/painting/qdatabuffer_p.h
+++ b/src/gui/painting/qdatabuffer_p.h
@@ -1,6 +1,6 @@
/****************************************************************************
**
-** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies).
+** Copyright (C) 2012 Nokia Corporation and/or its subsidiary(-ies).
** All rights reserved.
** Contact: Nokia Corporation (qt-info@nokia.com)
**
diff --git a/src/gui/painting/qdrawhelper.cpp b/src/gui/painting/qdrawhelper.cpp
index cf899b986d..26fe6df3d4 100644
--- a/src/gui/painting/qdrawhelper.cpp
+++ b/src/gui/painting/qdrawhelper.cpp
@@ -1,6 +1,6 @@
/****************************************************************************
**
-** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies).
+** Copyright (C) 2012 Nokia Corporation and/or its subsidiary(-ies).
** All rights reserved.
** Contact: Nokia Corporation (qt-info@nokia.com)
**
diff --git a/src/gui/painting/qdrawhelper_arm_simd.cpp b/src/gui/painting/qdrawhelper_arm_simd.cpp
index 48b67f4020..e1784e049f 100644
--- a/src/gui/painting/qdrawhelper_arm_simd.cpp
+++ b/src/gui/painting/qdrawhelper_arm_simd.cpp
@@ -1,6 +1,6 @@
/****************************************************************************
**
-** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies).
+** Copyright (C) 2012 Nokia Corporation and/or its subsidiary(-ies).
** All rights reserved.
** Contact: Nokia Corporation (qt-info@nokia.com)
**
diff --git a/src/gui/painting/qdrawhelper_arm_simd_p.h b/src/gui/painting/qdrawhelper_arm_simd_p.h
index a9def32b6c..e920456d45 100644
--- a/src/gui/painting/qdrawhelper_arm_simd_p.h
+++ b/src/gui/painting/qdrawhelper_arm_simd_p.h
@@ -1,6 +1,6 @@
/****************************************************************************
**
-** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies).
+** Copyright (C) 2012 Nokia Corporation and/or its subsidiary(-ies).
** All rights reserved.
** Contact: Nokia Corporation (qt-info@nokia.com)
**
diff --git a/src/gui/painting/qdrawhelper_iwmmxt.cpp b/src/gui/painting/qdrawhelper_iwmmxt.cpp
index 95266eeceb..59b9f28dcd 100644
--- a/src/gui/painting/qdrawhelper_iwmmxt.cpp
+++ b/src/gui/painting/qdrawhelper_iwmmxt.cpp
@@ -1,6 +1,6 @@
/****************************************************************************
**
-** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies).
+** Copyright (C) 2012 Nokia Corporation and/or its subsidiary(-ies).
** All rights reserved.
** Contact: Nokia Corporation (qt-info@nokia.com)
**
diff --git a/src/gui/painting/qdrawhelper_mmx.cpp b/src/gui/painting/qdrawhelper_mmx.cpp
index 45cfcd32a0..261cf06a42 100644
--- a/src/gui/painting/qdrawhelper_mmx.cpp
+++ b/src/gui/painting/qdrawhelper_mmx.cpp
@@ -1,6 +1,6 @@
/****************************************************************************
**
-** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies).
+** Copyright (C) 2012 Nokia Corporation and/or its subsidiary(-ies).
** All rights reserved.
** Contact: Nokia Corporation (qt-info@nokia.com)
**
diff --git a/src/gui/painting/qdrawhelper_mmx3dnow.cpp b/src/gui/painting/qdrawhelper_mmx3dnow.cpp
index 204f061e1a..7bec5ec336 100644
--- a/src/gui/painting/qdrawhelper_mmx3dnow.cpp
+++ b/src/gui/painting/qdrawhelper_mmx3dnow.cpp
@@ -1,6 +1,6 @@
/****************************************************************************
**
-** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies).
+** Copyright (C) 2012 Nokia Corporation and/or its subsidiary(-ies).
** All rights reserved.
** Contact: Nokia Corporation (qt-info@nokia.com)
**
diff --git a/src/gui/painting/qdrawhelper_mmx_p.h b/src/gui/painting/qdrawhelper_mmx_p.h
index e2205a89a5..d6f7056669 100644
--- a/src/gui/painting/qdrawhelper_mmx_p.h
+++ b/src/gui/painting/qdrawhelper_mmx_p.h
@@ -1,6 +1,6 @@
/****************************************************************************
**
-** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies).
+** Copyright (C) 2012 Nokia Corporation and/or its subsidiary(-ies).
** All rights reserved.
** Contact: Nokia Corporation (qt-info@nokia.com)
**
diff --git a/src/gui/painting/qdrawhelper_neon.cpp b/src/gui/painting/qdrawhelper_neon.cpp
index a7e510e0ac..09eba9103b 100644
--- a/src/gui/painting/qdrawhelper_neon.cpp
+++ b/src/gui/painting/qdrawhelper_neon.cpp
@@ -1,6 +1,6 @@
/****************************************************************************
**
-** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies).
+** Copyright (C) 2012 Nokia Corporation and/or its subsidiary(-ies).
** All rights reserved.
** Contact: Nokia Corporation (qt-info@nokia.com)
**
diff --git a/src/gui/painting/qdrawhelper_neon_asm.S b/src/gui/painting/qdrawhelper_neon_asm.S
index 0c0c6a4b1e..d1e6e585c4 100644
--- a/src/gui/painting/qdrawhelper_neon_asm.S
+++ b/src/gui/painting/qdrawhelper_neon_asm.S
@@ -1,6 +1,6 @@
/****************************************************************************
**
-** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies).
+** Copyright (C) 2012 Nokia Corporation and/or its subsidiary(-ies).
** All rights reserved.
** Contact: Nokia Corporation (qt-info@nokia.com)
**
diff --git a/src/gui/painting/qdrawhelper_neon_p.h b/src/gui/painting/qdrawhelper_neon_p.h
index 97ef8ce4e6..6ce1d5e59e 100644
--- a/src/gui/painting/qdrawhelper_neon_p.h
+++ b/src/gui/painting/qdrawhelper_neon_p.h
@@ -1,6 +1,6 @@
/****************************************************************************
**
-** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies).
+** Copyright (C) 2012 Nokia Corporation and/or its subsidiary(-ies).
** All rights reserved.
** Contact: Nokia Corporation (qt-info@nokia.com)
**
diff --git a/src/gui/painting/qdrawhelper_p.h b/src/gui/painting/qdrawhelper_p.h
index 3d83ba8587..52f50240a4 100644
--- a/src/gui/painting/qdrawhelper_p.h
+++ b/src/gui/painting/qdrawhelper_p.h
@@ -1,6 +1,6 @@
/****************************************************************************
**
-** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies).
+** Copyright (C) 2012 Nokia Corporation and/or its subsidiary(-ies).
** All rights reserved.
** Contact: Nokia Corporation (qt-info@nokia.com)
**
diff --git a/src/gui/painting/qdrawhelper_sse.cpp b/src/gui/painting/qdrawhelper_sse.cpp
index a03ceee02a..4e17c32c17 100644
--- a/src/gui/painting/qdrawhelper_sse.cpp
+++ b/src/gui/painting/qdrawhelper_sse.cpp
@@ -1,6 +1,6 @@
/****************************************************************************
**
-** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies).
+** Copyright (C) 2012 Nokia Corporation and/or its subsidiary(-ies).
** All rights reserved.
** Contact: Nokia Corporation (qt-info@nokia.com)
**
diff --git a/src/gui/painting/qdrawhelper_sse2.cpp b/src/gui/painting/qdrawhelper_sse2.cpp
index 3bbdae00bd..f974b586d0 100644
--- a/src/gui/painting/qdrawhelper_sse2.cpp
+++ b/src/gui/painting/qdrawhelper_sse2.cpp
@@ -1,6 +1,6 @@
/****************************************************************************
**
-** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies).
+** Copyright (C) 2012 Nokia Corporation and/or its subsidiary(-ies).
** All rights reserved.
** Contact: Nokia Corporation (qt-info@nokia.com)
**
diff --git a/src/gui/painting/qdrawhelper_sse3dnow.cpp b/src/gui/painting/qdrawhelper_sse3dnow.cpp
index 513ed7d713..42061feac3 100644
--- a/src/gui/painting/qdrawhelper_sse3dnow.cpp
+++ b/src/gui/painting/qdrawhelper_sse3dnow.cpp
@@ -1,6 +1,6 @@
/****************************************************************************
**
-** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies).
+** Copyright (C) 2012 Nokia Corporation and/or its subsidiary(-ies).
** All rights reserved.
** Contact: Nokia Corporation (qt-info@nokia.com)
**
diff --git a/src/gui/painting/qdrawhelper_sse_p.h b/src/gui/painting/qdrawhelper_sse_p.h
index 3f2419578d..99ef917e71 100644
--- a/src/gui/painting/qdrawhelper_sse_p.h
+++ b/src/gui/painting/qdrawhelper_sse_p.h
@@ -1,6 +1,6 @@
/****************************************************************************
**
-** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies).
+** Copyright (C) 2012 Nokia Corporation and/or its subsidiary(-ies).
** All rights reserved.
** Contact: Nokia Corporation (qt-info@nokia.com)
**
diff --git a/src/gui/painting/qdrawhelper_ssse3.cpp b/src/gui/painting/qdrawhelper_ssse3.cpp
index ef6e33bc1e..1281d4d526 100644
--- a/src/gui/painting/qdrawhelper_ssse3.cpp
+++ b/src/gui/painting/qdrawhelper_ssse3.cpp
@@ -1,6 +1,6 @@
/****************************************************************************
**
-** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies).
+** Copyright (C) 2012 Nokia Corporation and/or its subsidiary(-ies).
** All rights reserved.
** Contact: Nokia Corporation (qt-info@nokia.com)
**
diff --git a/src/gui/painting/qdrawhelper_x86_p.h b/src/gui/painting/qdrawhelper_x86_p.h
index ac671ccc51..20d0f7a36b 100644
--- a/src/gui/painting/qdrawhelper_x86_p.h
+++ b/src/gui/painting/qdrawhelper_x86_p.h
@@ -1,6 +1,6 @@
/****************************************************************************
**
-** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies).
+** Copyright (C) 2012 Nokia Corporation and/or its subsidiary(-ies).
** All rights reserved.
** Contact: Nokia Corporation (qt-info@nokia.com)
**
diff --git a/src/gui/painting/qdrawingprimitive_sse2_p.h b/src/gui/painting/qdrawingprimitive_sse2_p.h
index dad8f6cb5d..28b9ceee8a 100644
--- a/src/gui/painting/qdrawingprimitive_sse2_p.h
+++ b/src/gui/painting/qdrawingprimitive_sse2_p.h
@@ -1,6 +1,6 @@
/****************************************************************************
**
-** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies).
+** Copyright (C) 2012 Nokia Corporation and/or its subsidiary(-ies).
** All rights reserved.
** Contact: Nokia Corporation (qt-info@nokia.com)
**
diff --git a/src/gui/painting/qemulationpaintengine.cpp b/src/gui/painting/qemulationpaintengine.cpp
index 903ab1f605..3e40d25ec8 100644
--- a/src/gui/painting/qemulationpaintengine.cpp
+++ b/src/gui/painting/qemulationpaintengine.cpp
@@ -1,6 +1,6 @@
/****************************************************************************
**
-** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies).
+** Copyright (C) 2012 Nokia Corporation and/or its subsidiary(-ies).
** All rights reserved.
** Contact: Nokia Corporation (qt-info@nokia.com)
**
diff --git a/src/gui/painting/qemulationpaintengine_p.h b/src/gui/painting/qemulationpaintengine_p.h
index fdc3688876..b49ce2bdaf 100644
--- a/src/gui/painting/qemulationpaintengine_p.h
+++ b/src/gui/painting/qemulationpaintengine_p.h
@@ -1,6 +1,6 @@
/****************************************************************************
**
-** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies).
+** Copyright (C) 2012 Nokia Corporation and/or its subsidiary(-ies).
** All rights reserved.
** Contact: Nokia Corporation (qt-info@nokia.com)
**
diff --git a/src/gui/painting/qfixed_p.h b/src/gui/painting/qfixed_p.h
index df5a685053..dba52f75b4 100644
--- a/src/gui/painting/qfixed_p.h
+++ b/src/gui/painting/qfixed_p.h
@@ -1,6 +1,6 @@
/****************************************************************************
**
-** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies).
+** Copyright (C) 2012 Nokia Corporation and/or its subsidiary(-ies).
** All rights reserved.
** Contact: Nokia Corporation (qt-info@nokia.com)
**
diff --git a/src/gui/painting/qgrayraster.c b/src/gui/painting/qgrayraster.c
index 5334f97782..50ec22e73a 100644
--- a/src/gui/painting/qgrayraster.c
+++ b/src/gui/painting/qgrayraster.c
@@ -1,6 +1,6 @@
/****************************************************************************
**
-** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies).
+** Copyright (C) 2012 Nokia Corporation and/or its subsidiary(-ies).
** All rights reserved.
** Contact: Nokia Corporation (qt-info@nokia.com)
**
@@ -1090,37 +1090,6 @@
return 0;
}
-
- static int
- gray_line_to( const QT_FT_Vector* to,
- PWorker worker )
- {
- gray_render_line( worker, UPSCALE( to->x ), UPSCALE( to->y ) );
- return 0;
- }
-
-
- static int
- gray_conic_to( const QT_FT_Vector* control,
- const QT_FT_Vector* to,
- PWorker worker )
- {
- gray_render_conic( worker, control, to );
- return 0;
- }
-
-
- static int
- gray_cubic_to( const QT_FT_Vector* control1,
- const QT_FT_Vector* control2,
- const QT_FT_Vector* to,
- PWorker worker )
- {
- gray_render_cubic( worker, control1, control2, to );
- return 0;
- }
-
-
static void
gray_render_span( int count,
const QT_FT_Span* spans,
@@ -1464,9 +1433,7 @@
vec.x = SCALED( point->x );
vec.y = SCALED( point->y );
- error = gray_line_to( &vec, user );
- if ( error )
- goto Exit;
+ gray_render_line(user, UPSCALE(vec.x), UPSCALE(vec.y));
continue;
}
@@ -1491,10 +1458,7 @@
if ( tag == QT_FT_CURVE_TAG_ON )
{
- error = gray_conic_to( &v_control, &vec,
- user );
- if ( error )
- goto Exit;
+ gray_render_conic(user, &v_control, &vec);
continue;
}
@@ -1504,17 +1468,12 @@
v_middle.x = ( v_control.x + vec.x ) / 2;
v_middle.y = ( v_control.y + vec.y ) / 2;
- error = gray_conic_to( &v_control, &v_middle,
- user );
- if ( error )
- goto Exit;
-
+ gray_render_conic(user, &v_control, &v_middle);
v_control = vec;
goto Do_Conic;
}
- error = gray_conic_to( &v_control, &v_start,
- user );
+ gray_render_conic(user, &v_control, &v_start);
goto Close;
}
@@ -1544,25 +1503,20 @@
vec.x = SCALED( point->x );
vec.y = SCALED( point->y );
- error = gray_cubic_to( &vec1, &vec2, &vec, user );
- if ( error )
- goto Exit;
+ gray_render_cubic(user, &vec1, &vec2, &vec);
continue;
}
- error = gray_cubic_to( &vec1, &vec2, &v_start, user );
+ gray_render_cubic(user, &vec1, &vec2, &v_start);
goto Close;
}
}
}
/* close the contour with a line segment */
- error = gray_line_to( &v_start, user );
+ gray_render_line(user, UPSCALE(v_start.x), UPSCALE(v_start.y));
Close:
- if ( error )
- goto Exit;
-
first = last + 1;
}
diff --git a/src/gui/painting/qgrayraster_p.h b/src/gui/painting/qgrayraster_p.h
index d5932982db..11470ab279 100644
--- a/src/gui/painting/qgrayraster_p.h
+++ b/src/gui/painting/qgrayraster_p.h
@@ -1,6 +1,6 @@
/****************************************************************************
**
-** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies).
+** Copyright (C) 2012 Nokia Corporation and/or its subsidiary(-ies).
** All rights reserved.
** Contact: Nokia Corporation (qt-info@nokia.com)
**
diff --git a/src/gui/painting/qimagescale.cpp b/src/gui/painting/qimagescale.cpp
index 46e09ddc49..83cd9ad970 100644
--- a/src/gui/painting/qimagescale.cpp
+++ b/src/gui/painting/qimagescale.cpp
@@ -1,6 +1,6 @@
/****************************************************************************
**
-** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies).
+** Copyright (C) 2012 Nokia Corporation and/or its subsidiary(-ies).
** All rights reserved.
** Contact: Nokia Corporation (qt-info@nokia.com)
**
diff --git a/src/gui/painting/qimagescale_p.h b/src/gui/painting/qimagescale_p.h
index 4efe75df60..654602cefe 100644
--- a/src/gui/painting/qimagescale_p.h
+++ b/src/gui/painting/qimagescale_p.h
@@ -1,6 +1,6 @@
/****************************************************************************
**
-** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies).
+** Copyright (C) 2012 Nokia Corporation and/or its subsidiary(-ies).
** All rights reserved.
** Contact: Nokia Corporation (qt-info@nokia.com)
**
diff --git a/src/gui/painting/qmath_p.h b/src/gui/painting/qmath_p.h
index ea46aa7902..21bbeeeaed 100644
--- a/src/gui/painting/qmath_p.h
+++ b/src/gui/painting/qmath_p.h
@@ -1,6 +1,6 @@
/****************************************************************************
**
-** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies).
+** Copyright (C) 2012 Nokia Corporation and/or its subsidiary(-ies).
** All rights reserved.
** Contact: Nokia Corporation (qt-info@nokia.com)
**
diff --git a/src/gui/painting/qmatrix.cpp b/src/gui/painting/qmatrix.cpp
index 41278920cb..cf99e31b90 100644
--- a/src/gui/painting/qmatrix.cpp
+++ b/src/gui/painting/qmatrix.cpp
@@ -1,6 +1,6 @@
/****************************************************************************
**
-** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies).
+** Copyright (C) 2012 Nokia Corporation and/or its subsidiary(-ies).
** All rights reserved.
** Contact: Nokia Corporation (qt-info@nokia.com)
**
diff --git a/src/gui/painting/qmatrix.h b/src/gui/painting/qmatrix.h
index 830a0a734f..e963b90a44 100644
--- a/src/gui/painting/qmatrix.h
+++ b/src/gui/painting/qmatrix.h
@@ -1,6 +1,6 @@
/****************************************************************************
**
-** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies).
+** Copyright (C) 2012 Nokia Corporation and/or its subsidiary(-ies).
** All rights reserved.
** Contact: Nokia Corporation (qt-info@nokia.com)
**
diff --git a/src/gui/painting/qmemrotate.cpp b/src/gui/painting/qmemrotate.cpp
index 857621df6e..478d6470b2 100644
--- a/src/gui/painting/qmemrotate.cpp
+++ b/src/gui/painting/qmemrotate.cpp
@@ -1,6 +1,6 @@
/****************************************************************************
**
-** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies).
+** Copyright (C) 2012 Nokia Corporation and/or its subsidiary(-ies).
** All rights reserved.
** Contact: Nokia Corporation (qt-info@nokia.com)
**
diff --git a/src/gui/painting/qmemrotate_p.h b/src/gui/painting/qmemrotate_p.h
index a8c2c6bfbd..d9793b2404 100644
--- a/src/gui/painting/qmemrotate_p.h
+++ b/src/gui/painting/qmemrotate_p.h
@@ -1,6 +1,6 @@
/****************************************************************************
**
-** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies).
+** Copyright (C) 2012 Nokia Corporation and/or its subsidiary(-ies).
** All rights reserved.
** Contact: Nokia Corporation (qt-info@nokia.com)
**
diff --git a/src/gui/painting/qoutlinemapper.cpp b/src/gui/painting/qoutlinemapper.cpp
index 8b607b28b8..da77722491 100644
--- a/src/gui/painting/qoutlinemapper.cpp
+++ b/src/gui/painting/qoutlinemapper.cpp
@@ -1,6 +1,6 @@
/****************************************************************************
**
-** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies).
+** Copyright (C) 2012 Nokia Corporation and/or its subsidiary(-ies).
** All rights reserved.
** Contact: Nokia Corporation (qt-info@nokia.com)
**
@@ -42,6 +42,7 @@
#include "qoutlinemapper_p.h"
#include <private/qpainterpath_p.h>
#include "qmath.h"
+#include <private/qbezier_p.h>
#include <stdlib.h>
@@ -74,6 +75,19 @@ static const QRectF boundingRect(const QPointF *points, int pointCount)
return QRectF(QPointF(minx, miny), QPointF(maxx, maxy));
}
+void QOutlineMapper::curveTo(const QPointF &cp1, const QPointF &cp2, const QPointF &ep) {
+#ifdef QT_DEBUG_CONVERT
+ printf("QOutlineMapper::curveTo() (%f, %f)\n", ep.x(), ep.y());
+#endif
+
+ QBezier bezier = QBezier::fromPoints(m_elements.last(), cp1, cp2, ep);
+ bezier.addToPolygon(m_elements, m_curve_threshold);
+ m_element_types.reserve(m_elements.size());
+ for (int i = m_elements.size() - m_element_types.size(); i; --i)
+ m_element_types << QPainterPath::LineToElement;
+ Q_ASSERT(m_elements.size() == m_element_types.size());
+}
+
QT_FT_Outline *QOutlineMapper::convertPath(const QPainterPath &path)
{
@@ -169,51 +183,47 @@ void QOutlineMapper::endOutline()
{
closeSubpath();
- int element_count = m_elements.size();
-
- if (element_count == 0) {
+ if (m_elements.isEmpty()) {
memset(&m_outline, 0, sizeof(m_outline));
return;
}
- QPointF *elements;
+ QPointF *elements = m_elements.data();
// Transform the outline
if (m_txop == QTransform::TxNone) {
- elements = m_elements.data();
- } else {
- if (m_txop == QTransform::TxTranslate) {
- for (int i=0; i<m_elements.size(); ++i) {
- const QPointF &e = m_elements.at(i);
- m_elements_dev << QPointF(e.x() + m_dx, e.y() + m_dy);
- }
- } else if (m_txop == QTransform::TxScale) {
- for (int i=0; i<m_elements.size(); ++i) {
- const QPointF &e = m_elements.at(i);
- m_elements_dev << QPointF(m_m11 * e.x() + m_dx, m_m22 * e.y() + m_dy);
- }
- } else if (m_txop < QTransform::TxProject) {
- for (int i=0; i<m_elements.size(); ++i) {
- const QPointF &e = m_elements.at(i);
- m_elements_dev << QPointF(m_m11 * e.x() + m_m21 * e.y() + m_dx,
- m_m22 * e.y() + m_m12 * e.x() + m_dy);
- }
- } else {
- const QVectorPath vp((qreal *)m_elements.data(), m_elements.size(), m_element_types.size() ? m_element_types.data() : 0);
- QPainterPath path = vp.convertToPainterPath();
- path = QTransform(m_m11, m_m12, m_m13, m_m21, m_m22, m_m23, m_dx, m_dy, m_m33).map(path);
- if (!(m_outline.flags & QT_FT_OUTLINE_EVEN_ODD_FILL))
- path.setFillRule(Qt::WindingFill);
- uint old_txop = m_txop;
- m_txop = QTransform::TxNone;
- if (path.isEmpty())
- m_valid = false;
- else
- convertPath(path);
- m_txop = old_txop;
- return;
+ // Nothing to do.
+ } else if (m_txop == QTransform::TxTranslate) {
+ for (int i = 0; i < m_elements.size(); ++i) {
+ QPointF &e = elements[i];
+ e = QPointF(e.x() + m_dx, e.y() + m_dy);
+ }
+ } else if (m_txop == QTransform::TxScale) {
+ for (int i = 0; i < m_elements.size(); ++i) {
+ QPointF &e = elements[i];
+ e = QPointF(m_m11 * e.x() + m_dx, m_m22 * e.y() + m_dy);
}
- elements = m_elements_dev.data();
+ } else if (m_txop < QTransform::TxProject) {
+ for (int i = 0; i < m_elements.size(); ++i) {
+ QPointF &e = elements[i];
+ e = QPointF(m_m11 * e.x() + m_m21 * e.y() + m_dx,
+ m_m22 * e.y() + m_m12 * e.x() + m_dy);
+ }
+ } else {
+ const QVectorPath vp((qreal *)elements, m_elements.size(),
+ m_element_types.size() ? m_element_types.data() : 0);
+ QPainterPath path = vp.convertToPainterPath();
+ path = QTransform(m_m11, m_m12, m_m13, m_m21, m_m22, m_m23, m_dx, m_dy, m_m33).map(path);
+ if (!(m_outline.flags & QT_FT_OUTLINE_EVEN_ODD_FILL))
+ path.setFillRule(Qt::WindingFill);
+ uint old_txop = m_txop;
+ m_txop = QTransform::TxNone;
+ if (path.isEmpty())
+ m_valid = false;
+ else
+ convertPath(path);
+ m_txop = old_txop;
+ return;
}
if (m_round_coords) {
@@ -223,7 +233,7 @@ void QOutlineMapper::endOutline()
qFloor(elements[i].y() + aliasedCoordinateDelta));
}
- controlPointRect = boundingRect(elements, element_count);
+ controlPointRect = boundingRect(elements, m_elements.size());
#ifdef QT_DEBUG_CONVERT
printf(" - control point rect (%.2f, %.2f) %.2f x %.2f, clip=(%d,%d, %dx%d)\n",
@@ -242,9 +252,9 @@ void QOutlineMapper::endOutline()
|| controlPointRect.height() > QT_RASTER_COORD_LIMIT));
if (do_clip) {
- clipElements(elements, elementTypes(), element_count);
+ clipElements(elements, elementTypes(), m_elements.size());
} else {
- convertElements(elements, elementTypes(), element_count);
+ convertElements(elements, elementTypes(), m_elements.size());
}
}
diff --git a/src/gui/painting/qoutlinemapper_p.h b/src/gui/painting/qoutlinemapper_p.h
index 388858ca44..ceb70f1a7b 100644
--- a/src/gui/painting/qoutlinemapper_p.h
+++ b/src/gui/painting/qoutlinemapper_p.h
@@ -1,6 +1,6 @@
/****************************************************************************
**
-** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies).
+** Copyright (C) 2012 Nokia Corporation and/or its subsidiary(-ies).
** All rights reserved.
** Contact: Nokia Corporation (qt-info@nokia.com)
**
@@ -73,6 +73,8 @@ const int QT_RASTER_COORD_LIMIT = 32767;
//#define QT_DEBUG_CONVERT
+Q_GUI_EXPORT bool qt_scaleForTransform(const QTransform &transform, qreal *scale);
+
/********************************************************************************
* class QOutlineMapper
*
@@ -90,11 +92,9 @@ public:
QOutlineMapper() :
m_element_types(0),
m_elements(0),
- m_elements_dev(0),
m_points(0),
m_tags(0),
m_contours(0),
- m_polygon_dev(0),
m_in_clip_elements(false),
m_round_coords(false)
{
@@ -117,6 +117,10 @@ public:
m_dx = m.dx();
m_dy = m.dy();
m_txop = m.type();
+
+ qreal scale;
+ qt_scaleForTransform(m, &scale);
+ m_curve_threshold = scale == 0 ? qreal(0.25) : (qreal(0.25) / scale);
}
void beginOutline(Qt::FillRule fillRule)
@@ -126,7 +130,6 @@ public:
#endif
m_valid = true;
m_elements.reset();
- m_elements_dev.reset();
m_element_types.reset();
m_points.reset();
m_tags.reset();
@@ -161,15 +164,7 @@ public:
m_element_types << QPainterPath::LineToElement;
}
- inline void curveTo(const QPointF &cp1, const QPointF &cp2, const QPointF &ep) {
-#ifdef QT_DEBUG_CONVERT
- printf("QOutlineMapper::curveTo() (%f, %f)\n", ep.x(), ep.y());
-#endif
- m_elements << cp1 << cp2 << ep;
- m_element_types << QPainterPath::CurveToElement
- << QPainterPath::CurveToDataElement
- << QPainterPath::CurveToDataElement;
- }
+ void curveTo(const QPointF &cp1, const QPointF &cp2, const QPointF &ep);
inline void closeSubpath() {
int element_count = m_elements.size();
@@ -209,14 +204,11 @@ public:
public:
QDataBuffer<QPainterPath::ElementType> m_element_types;
QDataBuffer<QPointF> m_elements;
- QDataBuffer<QPointF> m_elements_dev;
QDataBuffer<QT_FT_Vector> m_points;
QDataBuffer<char> m_tags;
QDataBuffer<int> m_contours;
QRect m_clip_rect;
- QDataBuffer<QPointF> m_polygon_dev;
-
QRectF controlPointRect; // only valid after endOutline()
QT_FT_Outline m_outline;
@@ -235,6 +227,8 @@ public:
qreal m_dx;
qreal m_dy;
+ qreal m_curve_threshold;
+
bool m_valid;
bool m_in_clip_elements;
diff --git a/src/gui/painting/qpagedpaintdevice.cpp b/src/gui/painting/qpagedpaintdevice.cpp
index b7b882e93a..038852a842 100644
--- a/src/gui/painting/qpagedpaintdevice.cpp
+++ b/src/gui/painting/qpagedpaintdevice.cpp
@@ -1,6 +1,6 @@
/****************************************************************************
**
-** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies).
+** Copyright (C) 2012 Nokia Corporation and/or its subsidiary(-ies).
** All rights reserved.
** Contact: Nokia Corporation (qt-info@nokia.com)
**
diff --git a/src/gui/painting/qpagedpaintdevice.h b/src/gui/painting/qpagedpaintdevice.h
index 9f06fc923a..f113534956 100644
--- a/src/gui/painting/qpagedpaintdevice.h
+++ b/src/gui/painting/qpagedpaintdevice.h
@@ -1,6 +1,6 @@
/****************************************************************************
**
-** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies).
+** Copyright (C) 2012 Nokia Corporation and/or its subsidiary(-ies).
** All rights reserved.
** Contact: Nokia Corporation (qt-info@nokia.com)
**
diff --git a/src/gui/painting/qpagedpaintdevice_p.h b/src/gui/painting/qpagedpaintdevice_p.h
index 55f78d54c5..28a2c80b94 100644
--- a/src/gui/painting/qpagedpaintdevice_p.h
+++ b/src/gui/painting/qpagedpaintdevice_p.h
@@ -1,6 +1,6 @@
/****************************************************************************
**
-** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies).
+** Copyright (C) 2012 Nokia Corporation and/or its subsidiary(-ies).
** All rights reserved.
** Contact: Nokia Corporation (qt-info@nokia.com)
**
diff --git a/src/gui/painting/qpaintbuffer.cpp b/src/gui/painting/qpaintbuffer.cpp
index f9e8432a8c..a4edba9299 100644
--- a/src/gui/painting/qpaintbuffer.cpp
+++ b/src/gui/painting/qpaintbuffer.cpp
@@ -1,6 +1,6 @@
/****************************************************************************
**
-** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies).
+** Copyright (C) 2012 Nokia Corporation and/or its subsidiary(-ies).
** All rights reserved.
** Contact: Nokia Corporation (qt-info@nokia.com)
**
diff --git a/src/gui/painting/qpaintbuffer_p.h b/src/gui/painting/qpaintbuffer_p.h
index 7cb743e585..536d5c8a61 100644
--- a/src/gui/painting/qpaintbuffer_p.h
+++ b/src/gui/painting/qpaintbuffer_p.h
@@ -1,6 +1,6 @@
/****************************************************************************
**
-** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies).
+** Copyright (C) 2012 Nokia Corporation and/or its subsidiary(-ies).
** All rights reserved.
** Contact: Nokia Corporation (qt-info@nokia.com)
**
diff --git a/src/gui/painting/qpaintdevice.cpp b/src/gui/painting/qpaintdevice.cpp
index 857f147231..b094019c84 100644
--- a/src/gui/painting/qpaintdevice.cpp
+++ b/src/gui/painting/qpaintdevice.cpp
@@ -1,6 +1,6 @@
/****************************************************************************
**
-** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies).
+** Copyright (C) 2012 Nokia Corporation and/or its subsidiary(-ies).
** All rights reserved.
** Contact: Nokia Corporation (qt-info@nokia.com)
**
diff --git a/src/gui/painting/qpaintdevice.h b/src/gui/painting/qpaintdevice.h
index 476f883645..fdceaa1886 100644
--- a/src/gui/painting/qpaintdevice.h
+++ b/src/gui/painting/qpaintdevice.h
@@ -1,6 +1,6 @@
/****************************************************************************
**
-** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies).
+** Copyright (C) 2012 Nokia Corporation and/or its subsidiary(-ies).
** All rights reserved.
** Contact: Nokia Corporation (qt-info@nokia.com)
**
diff --git a/src/gui/painting/qpaintdevice.qdoc b/src/gui/painting/qpaintdevice.qdoc
index 8d7e86f424..747047d53a 100644
--- a/src/gui/painting/qpaintdevice.qdoc
+++ b/src/gui/painting/qpaintdevice.qdoc
@@ -1,6 +1,6 @@
/****************************************************************************
**
-** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies).
+** Copyright (C) 2012 Nokia Corporation and/or its subsidiary(-ies).
** All rights reserved.
** Contact: Nokia Corporation (qt-info@nokia.com)
**
diff --git a/src/gui/painting/qpaintdevice_qpa.cpp b/src/gui/painting/qpaintdevice_qpa.cpp
index 65eeaaa7e8..eb7408dbff 100644
--- a/src/gui/painting/qpaintdevice_qpa.cpp
+++ b/src/gui/painting/qpaintdevice_qpa.cpp
@@ -1,6 +1,6 @@
/****************************************************************************
**
-** Copyright (C) 2009 Nokia Corporation and/or its subsidiary(-ies).
+** Copyright (C) 2012 Nokia Corporation and/or its subsidiary(-ies).
** All rights reserved.
** Contact: Nokia Corporation (qt-info@nokia.com)
**
diff --git a/src/gui/painting/qpaintengine.cpp b/src/gui/painting/qpaintengine.cpp
index da97116c6f..8364218b6e 100644
--- a/src/gui/painting/qpaintengine.cpp
+++ b/src/gui/painting/qpaintengine.cpp
@@ -1,6 +1,6 @@
/****************************************************************************
**
-** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies).
+** Copyright (C) 2012 Nokia Corporation and/or its subsidiary(-ies).
** All rights reserved.
** Contact: Nokia Corporation (qt-info@nokia.com)
**
diff --git a/src/gui/painting/qpaintengine.h b/src/gui/painting/qpaintengine.h
index 5d5424dfae..ee08ef1fbd 100644
--- a/src/gui/painting/qpaintengine.h
+++ b/src/gui/painting/qpaintengine.h
@@ -1,6 +1,6 @@
/****************************************************************************
**
-** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies).
+** Copyright (C) 2012 Nokia Corporation and/or its subsidiary(-ies).
** All rights reserved.
** Contact: Nokia Corporation (qt-info@nokia.com)
**
diff --git a/src/gui/painting/qpaintengine_blitter.cpp b/src/gui/painting/qpaintengine_blitter.cpp
index 1ed6dea161..37c158a3d9 100644
--- a/src/gui/painting/qpaintengine_blitter.cpp
+++ b/src/gui/painting/qpaintengine_blitter.cpp
@@ -1,6 +1,6 @@
/****************************************************************************
**
-** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies).
+** Copyright (C) 2012 Nokia Corporation and/or its subsidiary(-ies).
** All rights reserved.
** Contact: Nokia Corporation (qt-info@nokia.com)
**
@@ -65,75 +65,69 @@ QT_BEGIN_NAMESPACE
#define STATE_CLIP_COMPLEX 0x00020000
-static inline void updateStateBits(uint *state, uint mask, bool on)
-{
- *state = on ? (*state | mask) : (*state & ~mask);
-}
-
-static inline bool checkStateAgainstMask(uint state, uint mask)
-{
- return !state || (state & mask && !(state & ~mask));
-}
-
class CapabilitiesToStateMask
{
public:
CapabilitiesToStateMask(QBlittable::Capabilities capabilities)
- : m_capabilities(capabilities),
- fillRectMask(0),
- drawRectMask(0),
- drawPixmapMask(0),
- capabillitiesState(0)
+ : m_capabilities(capabilities)
+ , fillRectMask(0)
+ , drawRectMask(0)
+ , drawPixmapMask(0)
+ , capabillitiesState(0)
{
- if (capabilities & QBlittable::SolidRectCapability) {
+ if (capabilities & QBlittable::SolidRectCapability)
setFillRectMask();
- }
- if (capabilities & QBlittable::SourcePixmapCapability) {
+ if (capabilities & QBlittable::SourcePixmapCapability)
setSourcePixmapMask();
- }
- if (capabilities & QBlittable::SourceOverPixmapCapability) {
+ if (capabilities & QBlittable::SourceOverPixmapCapability)
setSourceOverPixmapMask();
- }
- if (capabilities & QBlittable::SourceOverScaledPixmapCapability) {
+ if (capabilities & QBlittable::SourceOverScaledPixmapCapability)
setSourceOverScaledPixmapMask();
- }
}
inline bool canBlitterFillRect() const
{
- return checkStateAgainstMask(capabillitiesState,fillRectMask);
+ return checkStateAgainstMask(capabillitiesState, fillRectMask);
}
inline bool canBlitterDrawRectMask() const
{
- return checkStateAgainstMask(capabillitiesState,drawRectMask);
+ return checkStateAgainstMask(capabillitiesState, drawRectMask);
}
bool canBlitterDrawPixmap(const QRectF &r, const QPixmap &pm, const QRectF &sr) const
{
if (pm.handle()->classId() != QPlatformPixmap::BlitterClass)
return false;
- if (checkStateAgainstMask(capabillitiesState,drawPixmapMask)) {
+ if (checkStateAgainstMask(capabillitiesState, drawPixmapMask)) {
if (m_capabilities & (QBlittable::SourceOverPixmapCapability
| QBlittable::SourceOverScaledPixmapCapability)) {
- if (r.size() != sr.size()) {
+ if (r.size() != sr.size())
return m_capabilities & QBlittable::SourceOverScaledPixmapCapability;
- } else {
+ else
return m_capabilities & QBlittable::SourceOverPixmapCapability;
- }
}
- if ((m_capabilities & QBlittable::SourcePixmapCapability) && r.size() == sr.size() && !pm.hasAlphaChannel()) {
+ if ((m_capabilities & QBlittable::SourcePixmapCapability) && r.size() == sr.size() && !pm.hasAlphaChannel())
return m_capabilities & QBlittable::SourcePixmapCapability;
- }
}
return false;
}
inline void updateState(uint mask, bool on) {
- updateStateBits(&capabillitiesState,mask,on);
+ updateStateBits(&capabillitiesState, mask, on);
}
-public:
+private:
+
+ static inline void updateStateBits(uint *state, uint mask, bool on)
+ {
+ *state = on ? (*state | mask) : (*state & ~mask);
+ }
+
+ static inline bool checkStateAgainstMask(uint state, uint mask)
+ {
+ return !state || (state & mask && !(state & ~mask));
+ }
void setFillRectMask() {
updateStateBits(&fillRectMask, STATE_XFORM_SCALE, false);
@@ -186,148 +180,258 @@ public:
uint capabillitiesState;
};
-class QBlitterPaintEnginePrivate : public QPaintEngineExPrivate
+class QBlitterPaintEnginePrivate : public QRasterPaintEnginePrivate
{
Q_DECLARE_PUBLIC(QBlitterPaintEngine);
public:
QBlitterPaintEnginePrivate(QBlittablePlatformPixmap *p)
- : QPaintEngineExPrivate(),
- pmData(p),
- isBlitterLocked(false),
- hasXForm(false)
+ : QRasterPaintEnginePrivate()
+ , pmData(p)
+ , caps(pmData->blittable()->capabilities())
+ , hasXForm(false)
- {
- raster.reset(new QRasterPaintEngine(p->buffer()));
- capabillities.reset(new CapabilitiesToStateMask(pmData->blittable()->capabilities()));
- }
+ {}
- inline void lock() {
- if (!isBlitterLocked) {
- raster->d_func()->rasterBuffer->prepare(pmData->blittable()->lock());
- isBlitterLocked = true;
- }
- }
+ void lock();
+ void unlock();
+ void fillRect(const QRectF &rect, const QColor &color);
+ void clipAndDrawPixmap(const QRectF &clip, const QRectF &target, const QPixmap &pm, const QRectF &sr);
- inline void unlock() {
- if (isBlitterLocked) {
- pmData->blittable()->unlock();
- isBlitterLocked = false;
- }
- }
- void fillRect(const QRectF &rect, const QColor &color) {
- Q_Q(QBlitterPaintEngine);
- pmData->unmarkRasterOverlay(rect);
- QRectF targetRect = rect;
- if (hasXForm) {
- targetRect = q->state()->matrix.mapRect(rect);
- }
- const QClipData *clipData = q->clip();
- if (clipData) {
- if (clipData->hasRectClip) {
- unlock();
- pmData->blittable()->fillRect(targetRect & clipData->clipRect, color);
- } else if (clipData->hasRegionClip) {
- QVector<QRect> rects = clipData->clipRegion.rects();
- for ( int i = 0; i < rects.size(); i++ ) {
- QRect intersectRect = rects.at(i).intersected(targetRect.toRect());
- if (!intersectRect.isEmpty()) {
- unlock();
- pmData->blittable()->fillRect(intersectRect,color);
- }
+ void updateCompleteState(QPainterState *s);
+ void updatePenState(QPainterState *s);
+ void updateBrushState(QPainterState *s);
+ void updateOpacityState(QPainterState *s);
+ void updateCompositionModeState(QPainterState *s);
+ void updateRenderHintsState(QPainterState *s);
+ void updateTransformState(QPainterState *s);
+ void updateClipState(QPainterState *s);
+
+ QBlittablePlatformPixmap *pmData;
+ CapabilitiesToStateMask caps;
+ uint hasXForm;
+};
+
+
+inline void QBlitterPaintEnginePrivate::lock()
+{
+ if (!pmData->blittable()->isLocked())
+ rasterBuffer->prepare(pmData->buffer());
+}
+
+inline void QBlitterPaintEnginePrivate::unlock()
+{
+ pmData->blittable()->unlock();
+}
+
+// State tracking to make decisions
+void QBlitterPaintEnginePrivate::updateCompleteState(QPainterState *s)
+{
+ updatePenState(s);
+ updateBrushState(s);
+ updateOpacityState(s);
+ updateCompositionModeState(s);
+ updateRenderHintsState(s);
+ updateTransformState(s);
+ updateClipState(s);
+}
+
+void QBlitterPaintEnginePrivate::updatePenState(QPainterState *s)
+{
+ caps.updateState(STATE_PEN_ENABLED, qpen_style(s->pen) != Qt::NoPen);
+}
+
+void QBlitterPaintEnginePrivate::updateBrushState(QPainterState *s)
+{
+ Qt::BrushStyle style = qbrush_style(s->brush);
+
+ caps.updateState(STATE_BRUSH_PATTERN, style > Qt::SolidPattern);
+ caps.updateState(STATE_BRUSH_ALPHA,
+ qbrush_color(s->brush).alpha() < 255);
+}
+
+void QBlitterPaintEnginePrivate::updateOpacityState(QPainterState *s)
+{
+ bool translucent = s->opacity < 1;
+ caps.updateState(STATE_ALPHA, translucent);
+}
+
+void QBlitterPaintEnginePrivate::updateCompositionModeState(QPainterState *s)
+{
+ bool nonTrivial = s->composition_mode != QPainter::CompositionMode_SourceOver
+ && s->composition_mode != QPainter::CompositionMode_Source;
+
+ caps.updateState(STATE_BLENDING_COMPLEX, nonTrivial);
+}
+
+void QBlitterPaintEnginePrivate::updateRenderHintsState(QPainterState *s)
+{
+ bool aa = s->renderHints & QPainter::Antialiasing;
+ caps.updateState(STATE_ANTIALIASING, aa);
+}
+
+void QBlitterPaintEnginePrivate::updateTransformState(QPainterState *s)
+{
+ QTransform::TransformationType type = s->matrix.type();
+
+ caps.updateState(STATE_XFORM_COMPLEX, type > QTransform::TxScale);
+ caps.updateState(STATE_XFORM_SCALE, type > QTransform::TxTranslate);
+
+ hasXForm = type >= QTransform::TxTranslate;
+}
+
+void QBlitterPaintEnginePrivate::updateClipState(QPainterState *)
+{
+ const QClipData *clipData = clip();
+ bool complexClip = clipData && !(clipData->hasRectClip || clipData->hasRegionClip);
+ caps.updateState(STATE_CLIP_COMPLEX, complexClip);
+}
+
+void QBlitterPaintEnginePrivate::fillRect(const QRectF &rect, const QColor &color)
+{
+ Q_Q(QBlitterPaintEngine);
+ pmData->unmarkRasterOverlay(rect);
+ QRectF targetRect = rect;
+ if (hasXForm)
+ targetRect = q->state()->matrix.mapRect(rect);
+ const QClipData *clipData = clip();
+ if (clipData) {
+ if (clipData->hasRectClip) {
+ unlock();
+ pmData->blittable()->fillRect(targetRect & clipData->clipRect, color);
+ } else if (clipData->hasRegionClip) {
+ QVector<QRect> rects = clipData->clipRegion.rects();
+ for (int i = 0; i < rects.size(); ++i) {
+ QRect intersectRect = rects.at(i).intersected(targetRect.toRect());
+ if (!intersectRect.isEmpty()) {
+ unlock();
+ pmData->blittable()->fillRect(intersectRect, color);
}
}
+ }
+ } else {
+ if (targetRect.x() >= 0 && targetRect.y() >= 0
+ && targetRect.width() <= q->paintDevice()->width()
+ && targetRect.height() <= q->paintDevice()->height()) {
+ unlock();
+ pmData->blittable()->fillRect(targetRect, color);
} else {
- if (targetRect.x() >= 0 && targetRect.y() >= 0
- && targetRect.width() <= raster->paintDevice()->width()
- && targetRect.height() <= raster->paintDevice()->height()) {
- unlock();
- pmData->blittable()->fillRect(targetRect,color);
- } else {
- QRectF deviceRect(0,0,raster->paintDevice()->width(), raster->paintDevice()->height());
- unlock();
- pmData->blittable()->fillRect(deviceRect&targetRect,color);
- }
+ QRectF deviceRect(0, 0, q->paintDevice()->width(), q->paintDevice()->height());
+ unlock();
+ pmData->blittable()->fillRect(deviceRect & targetRect, color);
}
}
+}
- void clipAndDrawPixmap(const QRectF &clip, const QRectF &target, const QPixmap &pm, const QRectF &sr) {
- QRectF intersectedRect = clip.intersected(target);
- if (intersectedRect.isEmpty())
- return;
- QRectF source = sr;
- if(intersectedRect.size() != target.size()) {
- qreal deltaTop = target.top() - intersectedRect.top();
- qreal deltaLeft = target.left() - intersectedRect.left();
- qreal deltaBottom = target.bottom() - intersectedRect.bottom();
- qreal deltaRight = target.right() - intersectedRect.right();
- source.adjust(-deltaLeft,-deltaTop,-deltaRight,-deltaBottom);
- }
- pmData->unmarkRasterOverlay(intersectedRect);
- pmData->blittable()->drawPixmap(intersectedRect, pm, source);
+void QBlitterPaintEnginePrivate::clipAndDrawPixmap(const QRectF &clip,
+ const QRectF &target,
+ const QPixmap &pm,
+ const QRectF &sr)
+{
+ QRectF intersectedRect = clip.intersected(target);
+ if (intersectedRect.isEmpty())
+ return;
+ QRectF source = sr;
+ if (intersectedRect.size() != target.size()) {
+ qreal deltaTop = target.top() - intersectedRect.top();
+ qreal deltaLeft = target.left() - intersectedRect.left();
+ qreal deltaBottom = target.bottom() - intersectedRect.bottom();
+ qreal deltaRight = target.right() - intersectedRect.right();
+ source.adjust(-deltaLeft, -deltaTop, -deltaRight, -deltaBottom);
}
+ pmData->unmarkRasterOverlay(intersectedRect);
+ pmData->blittable()->drawPixmap(intersectedRect, pm, source);
+}
- void updateClip() {
- Q_Q(QBlitterPaintEngine);
- const QClipData *clip = q->clip();
- bool complex = clip && !(clip->hasRectClip || clip->hasRegionClip);
- capabillities->updateState(STATE_CLIP_COMPLEX, complex);
- }
+QBlitterPaintEngine::QBlitterPaintEngine(QBlittablePlatformPixmap *p)
+ : QRasterPaintEngine(*(new QBlitterPaintEnginePrivate(p)), p->buffer())
+{}
- void systemStateChanged() {
- raster->d_func()->systemStateChanged();
- }
+// State tracking
+void QBlitterPaintEngine::penChanged()
+{
+ Q_D(QBlitterPaintEngine);
- QScopedPointer<QRasterPaintEngine> raster;
+ QRasterPaintEngine::penChanged();
+ d->updatePenState(state());
+}
- QBlittablePlatformPixmap *pmData;
- bool isBlitterLocked;
+void QBlitterPaintEngine::brushChanged()
+{
+ Q_D(QBlitterPaintEngine);
- QScopedPointer<CapabilitiesToStateMask> capabillities;
+ QRasterPaintEngine::brushChanged();
+ d->updateBrushState(state());
+}
- uint hasXForm;
-};
+void QBlitterPaintEngine::opacityChanged()
+{
+ Q_D(QBlitterPaintEngine);
-QBlitterPaintEngine::QBlitterPaintEngine(QBlittablePlatformPixmap *p)
- : QPaintEngineEx(*(new QBlitterPaintEnginePrivate(p)))
+ QRasterPaintEngine::opacityChanged();
+ d->updateOpacityState(state());
+}
+
+void QBlitterPaintEngine::compositionModeChanged()
{
+ Q_D(QBlitterPaintEngine);
+
+ QRasterPaintEngine::compositionModeChanged();
+ d->updateCompositionModeState(state());
}
-QBlitterPaintEngine::~QBlitterPaintEngine()
+void QBlitterPaintEngine::renderHintsChanged()
{
+ Q_D(QBlitterPaintEngine);
+
+ QRasterPaintEngine::renderHintsChanged();
+ d->updateRenderHintsState(state());
}
-QPainterState *QBlitterPaintEngine::createState(QPainterState *orig) const
+void QBlitterPaintEngine::transformChanged()
{
- Q_D(const QBlitterPaintEngine);
- return d->raster->createState(orig);
+ Q_D(QBlitterPaintEngine);
+
+ QRasterPaintEngine::transformChanged();
+ d->updateTransformState(state());
}
-bool QBlitterPaintEngine::begin(QPaintDevice *pdev)
+void QBlitterPaintEngine::clipEnabledChanged()
{
Q_D(QBlitterPaintEngine);
+ QRasterPaintEngine::clipEnabledChanged();
+ d->updateClipState(state());
+}
- setActive(true);
- bool ok = d->raster->begin(pdev);
+bool QBlitterPaintEngine::begin(QPaintDevice *pdev)
+{
+ bool ok = QRasterPaintEngine::begin(pdev);
#ifdef QT_BLITTER_RASTEROVERLAY
+ Q_D(QBlitterPaintEngine);
d->pmData->unmergeOverlay();
#endif
return ok;
}
-
bool QBlitterPaintEngine::end()
{
- Q_D(QBlitterPaintEngine);
-
- setActive(false);
#ifdef QT_BLITTER_RASTEROVERLAY
+ Q_D(QBlitterPaintEngine);
d->pmData->mergeOverlay();
#endif
- return d->raster->end();
+
+ return QRasterPaintEngine::end();
}
+void QBlitterPaintEngine::setState(QPainterState *s)
+{
+ Q_D(QBlitterPaintEngine);
+
+ QRasterPaintEngine::setState(s);
+ d->updateCompleteState(s);
+}
+// Accelerated paths
void QBlitterPaintEngine::fill(const QVectorPath &path, const QBrush &brush)
{
Q_D(QBlitterPaintEngine);
@@ -337,37 +441,35 @@ void QBlitterPaintEngine::fill(const QVectorPath &path, const QBrush &brush)
} else {
d->lock();
d->pmData->markRasterOverlay(path);
- d->raster->fill(path, brush);
+ QRasterPaintEngine::fill(path, brush);
}
}
void QBlitterPaintEngine::fillRect(const QRectF &rect, const QColor &color)
{
Q_D(QBlitterPaintEngine);
- if (d->capabillities->canBlitterFillRect() && color.alpha() == 0xff) {
+ if (d->caps.canBlitterFillRect() && color.alpha() == 0xff) {
d->fillRect(rect, color);
} else {
d->lock();
d->pmData->markRasterOverlay(rect);
- d->raster->fillRect(rect, color);
+ QRasterPaintEngine::fillRect(rect, color);
}
}
void QBlitterPaintEngine::fillRect(const QRectF &rect, const QBrush &brush)
{
- if(rect.size().isEmpty())
+ if (rect.size().isEmpty())
return;
Q_D(QBlitterPaintEngine);
if (qbrush_style(brush) == Qt::SolidPattern
&& qbrush_color(brush).alpha() == 0xff
- && d->capabillities->canBlitterFillRect())
- {
+ && d->caps.canBlitterFillRect()) {
d->fillRect(rect, qbrush_color(brush));
- }else if (brush.style() == Qt::TexturePattern
- && d->capabillities->canBlitterDrawPixmap(rect,brush.texture(),rect))
- {
+ } else if (brush.style() == Qt::TexturePattern
+ && d->caps.canBlitterDrawPixmap(rect, brush.texture(), rect)) {
bool rectIsFilled = false;
QRectF transformedRect = state()->matrix.mapRect(rect);
qreal x = transformedRect.x();
@@ -388,37 +490,37 @@ void QBlitterPaintEngine::fillRect(const QRectF &rect, const QBrush &brush)
blitWidth = transformedRect.right() -x;
if (y + blitHeight > transformedRect.bottom())
blitHeight = transformedRect.bottom() - y;
- const QClipData *clipData = clip();
+ const QClipData *clipData = d->clip();
if (clipData->hasRectClip) {
- QRect targetRect = QRect(x,y,blitWidth,blitHeight).intersected(clipData->clipRect);
+ QRect targetRect = QRect(x, y, blitWidth, blitHeight).intersected(clipData->clipRect);
if (targetRect.isValid()) {
int tmpSrcX = srcX + (targetRect.x() - x);
int tmpSrcY = srcY + (targetRect.y() - y);
- QRect srcRect(tmpSrcX,tmpSrcY,targetRect.width(),targetRect.height());
- d->pmData->blittable()->drawPixmap(targetRect,pm,srcRect);
+ QRect srcRect(tmpSrcX, tmpSrcY, targetRect.width(), targetRect.height());
+ d->pmData->blittable()->drawPixmap(targetRect, pm, srcRect);
}
} else if (clipData->hasRegionClip) {
QVector<QRect> clipRects = clipData->clipRegion.rects();
- QRect unclippedTargetRect(x,y,blitWidth,blitHeight);
+ QRect unclippedTargetRect(x, y, blitWidth, blitHeight);
QRegion intersectedRects = clipData->clipRegion.intersected(unclippedTargetRect);
- for ( int i = 0; i < intersectedRects.rects().size(); i++ ) {
+ for (int i = 0; i < intersectedRects.rects().size(); ++i) {
QRect targetRect = intersectedRects.rects().at(i);
if (!targetRect.isValid() || targetRect.isEmpty())
continue;
int tmpSrcX = srcX + (targetRect.x() - x);
int tmpSrcY = srcY + (targetRect.y() - y);
- QRect srcRect(tmpSrcX,tmpSrcY,targetRect.width(),targetRect.height());
- d->pmData->blittable()->drawPixmap(targetRect,pm,srcRect);
+ QRect srcRect(tmpSrcX, tmpSrcY, targetRect.width(), targetRect.height());
+ d->pmData->blittable()->drawPixmap(targetRect, pm, srcRect);
}
}
x+=blitWidth;
- if (x>=transformedRect.right()) {
+ if (x >= transformedRect.right()) {
x = transformedRect.x();
srcX = startX;
srcY = 0;
- y+=blitHeight;
- if (y>=transformedRect.bottom())
+ y += blitHeight;
+ if (y >= transformedRect.bottom())
rectIsFilled = true;
} else
srcX = 0;
@@ -426,235 +528,174 @@ void QBlitterPaintEngine::fillRect(const QRectF &rect, const QBrush &brush)
} else {
d->lock();
d->pmData->markRasterOverlay(rect);
- d->raster->fillRect(rect, brush);
+ QRasterPaintEngine::fillRect(rect, brush);
}
}
-void QBlitterPaintEngine::stroke(const QVectorPath &path, const QPen &pen)
-{
- Q_D(QBlitterPaintEngine);
- d->lock();
- d->pmData->markRasterOverlay(path);
- d->raster->stroke(path, pen);
-}
-
-void QBlitterPaintEngine::clip(const QVectorPath &path, Qt::ClipOperation op)
-{
- Q_D(QBlitterPaintEngine);
- d->lock();
- d->raster->clip(path, op);
- d->updateClip();
-}
-void QBlitterPaintEngine::clip(const QRect &rect, Qt::ClipOperation op){
- Q_D(QBlitterPaintEngine);
- d->lock();
- d->raster->clip(rect,op);
- d->updateClip();
-}
-void QBlitterPaintEngine::clip(const QRegion &region, Qt::ClipOperation op)
+void QBlitterPaintEngine::drawRects(const QRect *rects, int rectCount)
{
Q_D(QBlitterPaintEngine);
- d->lock();
- d->raster->clip(region,op);
- d->updateClip();
+ if (d->caps.canBlitterDrawRectMask()) {
+ for (int i=0; i<rectCount; ++i)
+ d->fillRect(rects[i], qbrush_color(state()->brush));
+ } else {
+ d->pmData->markRasterOverlay(rects, rectCount);
+ QRasterPaintEngine::drawRects(rects, rectCount);
+ }
}
-void QBlitterPaintEngine::clipEnabledChanged()
+void QBlitterPaintEngine::drawRects(const QRectF *rects, int rectCount)
{
Q_D(QBlitterPaintEngine);
- d->lock();
- d->raster->clipEnabledChanged();
+ if (d->caps.canBlitterDrawRectMask()) {
+ for (int i = 0; i < rectCount; ++i)
+ d->fillRect(rects[i], qbrush_color(state()->brush));
+ } else {
+ d->pmData->markRasterOverlay(rects, rectCount);
+ QRasterPaintEngine::drawRects(rects, rectCount);
+ }
}
-void QBlitterPaintEngine::penChanged()
+void QBlitterPaintEngine::drawPixmap(const QPointF &pos, const QPixmap &pm)
{
- Q_D(QBlitterPaintEngine);
- d->lock();
- d->raster->penChanged();
- d->capabillities->updateState(STATE_PEN_ENABLED,qpen_style(state()->pen) != Qt::NoPen);
+ drawPixmap(QRectF(pos, pm.size()), pm, pm.rect());
}
-void QBlitterPaintEngine::brushChanged()
+void QBlitterPaintEngine::drawPixmap(const QRectF &r, const QPixmap &pm, const QRectF &sr)
{
Q_D(QBlitterPaintEngine);
- d->raster->brushChanged();
-
- bool solid = qbrush_style(state()->brush) == Qt::SolidPattern;
-
- d->capabillities->updateState(STATE_BRUSH_PATTERN, !solid);
- d->capabillities->updateState(STATE_BRUSH_ALPHA,
- qbrush_color(state()->brush).alpha() < 255);
-}
+ if (d->caps.canBlitterDrawPixmap(r, pm, sr)) {
-void QBlitterPaintEngine::brushOriginChanged()
-{
- Q_D(QBlitterPaintEngine);
- d->raster->brushOriginChanged();
+ d->unlock();
+ QRectF targetRect = r;
+ if (d->hasXForm)
+ targetRect = state()->matrix.mapRect(r);
+ const QClipData *clipData = d->clip();
+ if (clipData) {
+ if (clipData->hasRectClip) {
+ d->clipAndDrawPixmap(clipData->clipRect, targetRect, pm, sr);
+ } else if (clipData->hasRegionClip) {
+ QVector<QRect>rects = clipData->clipRegion.rects();
+ for (int i = 0; i<rects.size(); ++i)
+ d->clipAndDrawPixmap(rects.at(i), targetRect, pm, sr);
+ }
+ } else {
+ QRectF deviceRect(0, 0, paintDevice()->width(), paintDevice()->height());
+ d->clipAndDrawPixmap(deviceRect, targetRect, pm, sr);
+ }
+ }else {
+ d->lock();
+ d->pmData->markRasterOverlay(r);
+ QRasterPaintEngine::drawPixmap(r, pm, sr);
+ }
}
-void QBlitterPaintEngine::opacityChanged()
+// Overriden methods to lock the graphics memory
+void QBlitterPaintEngine::drawPolygon(const QPointF *points, int pointCount, PolygonDrawMode mode)
{
Q_D(QBlitterPaintEngine);
- d->raster->opacityChanged();
-
- bool translucent = state()->opacity < 1;
- d->capabillities->updateState(STATE_ALPHA,translucent);
+ d->lock();
+ d->pmData->markRasterOverlay(points, pointCount);
+ QRasterPaintEngine::drawPolygon(points, pointCount, mode);
}
-void QBlitterPaintEngine::compositionModeChanged()
+void QBlitterPaintEngine::drawPolygon(const QPoint *points, int pointCount, PolygonDrawMode mode)
{
Q_D(QBlitterPaintEngine);
- d->raster->compositionModeChanged();
-
- bool nonTrivial = state()->composition_mode != QPainter::CompositionMode_SourceOver
- && state()->composition_mode != QPainter::CompositionMode_Source;
-
- d->capabillities->updateState(STATE_BLENDING_COMPLEX,nonTrivial);
+ d->lock();
+ d->pmData->markRasterOverlay(points, pointCount);
+ QRasterPaintEngine::drawPolygon(points, pointCount, mode);
}
-void QBlitterPaintEngine::renderHintsChanged()
+void QBlitterPaintEngine::fillPath(const QPainterPath &path, QSpanData *fillData)
{
Q_D(QBlitterPaintEngine);
- d->raster->renderHintsChanged();
-
- bool aa = state()->renderHints & QPainter::Antialiasing;
- d->capabillities->updateState(STATE_ANTIALIASING, aa);
-
+ d->lock();
+ d->pmData->markRasterOverlay(path);
+ QRasterPaintEngine::fillPath(path, fillData);
}
-void QBlitterPaintEngine::transformChanged()
+void QBlitterPaintEngine::fillPolygon(const QPointF *points, int pointCount, PolygonDrawMode mode)
{
Q_D(QBlitterPaintEngine);
- d->raster->transformChanged();
-
- QTransform::TransformationType type = state()->matrix.type();
-
- d->capabillities->updateState(STATE_XFORM_COMPLEX, type > QTransform::TxScale);
- d->capabillities->updateState(STATE_XFORM_SCALE, type > QTransform::TxTranslate);
-
- d->hasXForm = type >= QTransform::TxTranslate;
-
+ d->lock();
+ d->pmData->markRasterOverlay(points, pointCount);
+ QRasterPaintEngine::fillPolygon(points, pointCount, mode);
}
-void QBlitterPaintEngine::drawRects(const QRect *rects, int rectCount)
+void QBlitterPaintEngine::drawEllipse(const QRectF &r)
{
Q_D(QBlitterPaintEngine);
- if (d->capabillities->canBlitterDrawRectMask()) {
- for (int i=0; i<rectCount; ++i) {
- d->fillRect(rects[i], qbrush_color(state()->brush));
- }
- } else {
- d->pmData->markRasterOverlay(rects,rectCount);
- QPaintEngineEx::drawRects(rects, rectCount);
- }
+ d->lock();
+ d->pmData->markRasterOverlay(r);
+ QRasterPaintEngine::drawEllipse(r);
}
-void QBlitterPaintEngine::drawRects(const QRectF *rects, int rectCount)
+void QBlitterPaintEngine::drawImage(const QPointF &pos, const QImage &image)
{
- Q_D(QBlitterPaintEngine);
- if (d->capabillities->canBlitterDrawRectMask()) {
- for (int i=0; i<rectCount; ++i) {
- d->fillRect(rects[i], qbrush_color(state()->brush));
- }
- } else {
- d->pmData->markRasterOverlay(rects,rectCount);
- QPaintEngineEx::drawRects(rects, rectCount);
- }
+ drawImage(QRectF(pos, image.size()), image, image.rect());
}
-void QBlitterPaintEngine::drawPixmap(const QRectF &r, const QPixmap &pm, const QRectF &sr)
+void QBlitterPaintEngine::drawImage(const QRectF &r, const QImage &pm, const QRectF &sr,
+ Qt::ImageConversionFlags flags)
{
Q_D(QBlitterPaintEngine);
- if (d->capabillities->canBlitterDrawPixmap(r,pm,sr)) {
-
- d->unlock();
- QRectF targetRect = r;
- if (d->hasXForm) {
- targetRect = state()->matrix.mapRect(r);
- }
- const QClipData *clipData = clip();
- if (clipData) {
- if (clipData->hasRectClip) {
- d->clipAndDrawPixmap(clipData->clipRect,targetRect,pm,sr);
- }else if (clipData->hasRegionClip) {
- QVector<QRect>rects = clipData->clipRegion.rects();
- for (int i = 0; i<rects.size(); i++) {
- d->clipAndDrawPixmap(rects.at(i),targetRect,pm,sr);
- }
- }
- } else {
- QRectF deviceRect(0,0,d->raster->paintDevice()->width(), d->raster->paintDevice()->height());
- d->clipAndDrawPixmap(deviceRect,targetRect,pm,sr);
- }
- }else {
- d->lock();
- d->pmData->markRasterOverlay(r);
- d->raster->drawPixmap(r, pm, sr);
- }
+ d->lock();
+ d->pmData->markRasterOverlay(r);
+ QRasterPaintEngine::drawImage(r, pm, sr, flags);
}
-void QBlitterPaintEngine::drawImage(const QRectF &r, const QImage &pm, const QRectF &sr,
- Qt::ImageConversionFlags flags)
+void QBlitterPaintEngine::drawTiledPixmap(const QRectF &r, const QPixmap &pm, const QPointF &sr)
{
Q_D(QBlitterPaintEngine);
d->lock();
d->pmData->markRasterOverlay(r);
- d->raster->drawImage(r, pm, sr, flags);
+ QRasterPaintEngine::drawTiledPixmap(r, pm, sr);
}
-
void QBlitterPaintEngine::drawTextItem(const QPointF &pos, const QTextItem &ti)
{
Q_D(QBlitterPaintEngine);
d->lock();
- d->raster->drawTextItem(pos, ti);
- d->pmData->markRasterOverlay(pos,ti);
+ d->pmData->markRasterOverlay(pos, ti);
+ QRasterPaintEngine::drawTextItem(pos, ti);
}
-void QBlitterPaintEngine::drawStaticTextItem(QStaticTextItem *sti)
+void QBlitterPaintEngine::drawPoints(const QPointF *points, int pointCount)
{
Q_D(QBlitterPaintEngine);
d->lock();
- d->raster->drawStaticTextItem(sti);
-
-//#### d->pmData->markRasterOverlay(sti);
- qWarning("not implemented: markRasterOverlay for QStaticTextItem");
-
+ d->pmData->markRasterOverlay(points, pointCount);
+ QRasterPaintEngine::drawPoints(points, pointCount);
}
-
-void QBlitterPaintEngine::drawEllipse(const QRectF &r)
+void QBlitterPaintEngine::drawPoints(const QPoint *points, int pointCount)
{
Q_D(QBlitterPaintEngine);
d->lock();
- d->pmData->markRasterOverlay(r);
- d->raster->drawEllipse(r);
+ d->pmData->markRasterOverlay(points, pointCount);
+ QRasterPaintEngine::drawPoints(points, pointCount);
}
-void QBlitterPaintEngine::setState(QPainterState *s)
+void QBlitterPaintEngine::stroke(const QVectorPath &path, const QPen &pen)
{
Q_D(QBlitterPaintEngine);
d->lock();
- QPaintEngineEx::setState(s);
- d->raster->setState(s);
-
- clipEnabledChanged();
- penChanged();
- brushChanged();
- brushOriginChanged();
- opacityChanged();
- compositionModeChanged();
- renderHintsChanged();
- transformChanged();
-
- d->updateClip();
+ d->pmData->markRasterOverlay(path);
+ QRasterPaintEngine::stroke(path, pen);
}
-inline QRasterPaintEngine *QBlitterPaintEngine::raster() const
+void QBlitterPaintEngine::drawStaticTextItem(QStaticTextItem *sti)
{
- Q_D(const QBlitterPaintEngine);
- return d->raster.data();
+ Q_D(QBlitterPaintEngine);
+ d->lock();
+ QRasterPaintEngine::drawStaticTextItem(sti);
+
+#ifdef QT_BLITTER_RASTEROVERLAY
+//#### d->pmData->markRasterOverlay(sti);
+ qWarning("not implemented: markRasterOverlay for QStaticTextItem");
+#endif
}
QT_END_NAMESPACE
diff --git a/src/gui/painting/qpaintengine_blitter_p.h b/src/gui/painting/qpaintengine_blitter_p.h
index 1acc647fbe..dba0bad9ef 100644
--- a/src/gui/painting/qpaintengine_blitter_p.h
+++ b/src/gui/painting/qpaintengine_blitter_p.h
@@ -1,6 +1,6 @@
/****************************************************************************
**
-** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies).
+** Copyright (C) 2012 Nokia Corporation and/or its subsidiary(-ies).
** All rights reserved.
** Contact: Nokia Corporation (qt-info@nokia.com)
**
@@ -42,7 +42,6 @@
#ifndef QPAINTENGINE_BLITTER_P_H
#define QPAINTENGINE_BLITTER_P_H
-#include "private/qpaintengineex_p.h"
#include "private/qpaintengine_raster_p.h"
#ifndef QT_NO_BLITTABLE
@@ -52,59 +51,51 @@ class QBlitterPaintEnginePrivate;
class QBlittablePlatformPixmap;
class QBlittable;
-class Q_GUI_EXPORT QBlitterPaintEngine : public QPaintEngineEx
+class Q_GUI_EXPORT QBlitterPaintEngine : public QRasterPaintEngine
{
Q_DECLARE_PRIVATE(QBlitterPaintEngine);
public:
QBlitterPaintEngine(QBlittablePlatformPixmap *p);
- ~QBlitterPaintEngine();
-
- virtual QPainterState *createState(QPainterState *orig) const;
virtual QPaintEngine::Type type() const { return Blitter; }
virtual bool begin(QPaintDevice *pdev);
virtual bool end();
+ // Call down into QBlittable
virtual void fill(const QVectorPath &path, const QBrush &brush);
- virtual void stroke(const QVectorPath &path, const QPen &pen);
-
- virtual void clip(const QVectorPath &path, Qt::ClipOperation op);
- virtual void clip(const QRect &rect, Qt::ClipOperation op);
- virtual void clip(const QRegion &region, Qt::ClipOperation op);
+ virtual void fillRect(const QRectF &rect, const QBrush &brush);
+ virtual void fillRect(const QRectF &rect, const QColor &color);
+ virtual void drawRects(const QRect *rects, int rectCount);
+ virtual void drawRects(const QRectF *rects, int rectCount);
+ void drawPixmap(const QPointF &p, const QPixmap &pm);
+ void drawPixmap(const QRectF &r, const QPixmap &pm, const QRectF &sr);
+ // State tracking
+ void setState(QPainterState *s);
virtual void clipEnabledChanged();
virtual void penChanged();
virtual void brushChanged();
- virtual void brushOriginChanged();
virtual void opacityChanged();
virtual void compositionModeChanged();
virtual void renderHintsChanged();
virtual void transformChanged();
- virtual void fillRect(const QRectF &rect, const QBrush &brush);
- virtual void fillRect(const QRectF &rect, const QColor &color);
-
- virtual void drawRects(const QRect *rects, int rectCount);
- virtual void drawRects(const QRectF *rects, int rectCount);
-
- virtual void drawPixmap(const QRectF &r, const QPixmap &pm, const QRectF &sr);
-
- virtual void drawImage(const QRectF &r, const QImage &pm, const QRectF &sr, Qt::ImageConversionFlags flags);
-
- virtual void drawTextItem(const QPointF &pos, const QTextItem &ti);
- virtual void drawStaticTextItem(QStaticTextItem *);
-
- virtual void drawEllipse(const QRectF &r);
-
- virtual void setState(QPainterState *s);
-
- inline QPainterState *state() { return raster()->state(); }
- inline const QPainterState *state() const { const QPainterState *state = raster()->state(); return state;}
- inline const QClipData *clip(){return raster()->d_func()->clip();}
-
-private:
- QRasterPaintEngine *raster() const;
+ // Override to lock the QBlittable before using raster
+ void drawPolygon(const QPointF *points, int pointCount, PolygonDrawMode mode);
+ void drawPolygon(const QPoint *points, int pointCount, PolygonDrawMode mode);
+ void fillPath(const QPainterPath &path, QSpanData *fillData);
+ void fillPolygon(const QPointF *points, int pointCount, PolygonDrawMode mode);
+ void drawEllipse(const QRectF &rect);
+ void drawImage(const QPointF &p, const QImage &img);
+ void drawImage(const QRectF &r, const QImage &pm, const QRectF &sr,
+ Qt::ImageConversionFlags flags = Qt::AutoColor);
+ void drawTiledPixmap(const QRectF &r, const QPixmap &pm, const QPointF &sr);
+ void drawTextItem(const QPointF &p, const QTextItem &textItem);
+ void drawPoints(const QPointF *points, int pointCount);
+ void drawPoints(const QPoint *points, int pointCount);
+ void stroke(const QVectorPath &path, const QPen &pen);
+ void drawStaticTextItem(QStaticTextItem *);
};
QT_END_NAMESPACE
diff --git a/src/gui/painting/qpaintengine_p.h b/src/gui/painting/qpaintengine_p.h
index 5d540bd11b..57075fed90 100644
--- a/src/gui/painting/qpaintengine_p.h
+++ b/src/gui/painting/qpaintengine_p.h
@@ -1,6 +1,6 @@
/****************************************************************************
**
-** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies).
+** Copyright (C) 2012 Nokia Corporation and/or its subsidiary(-ies).
** All rights reserved.
** Contact: Nokia Corporation (qt-info@nokia.com)
**
diff --git a/src/gui/painting/qpaintengine_raster.cpp b/src/gui/painting/qpaintengine_raster.cpp
index d5449a7eb5..5100393c69 100644
--- a/src/gui/painting/qpaintengine_raster.cpp
+++ b/src/gui/painting/qpaintengine_raster.cpp
@@ -1,6 +1,6 @@
/****************************************************************************
**
-** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies).
+** Copyright (C) 2012 Nokia Corporation and/or its subsidiary(-ies).
** All rights reserved.
** Contact: Nokia Corporation (qt-info@nokia.com)
**
@@ -733,7 +733,7 @@ void QRasterPaintEngine::updatePen(const QPen &pen)
s->stroker = 0;
}
- ensureState(); // needed because of tx_noshear...
+ ensureRasterState(); // needed because of tx_noshear...
s->flags.fast_pen = pen_style > Qt::NoPen
&& s->penData.blend
&& ((pen.isCosmetic() && penWidth <= 1)
@@ -801,7 +801,7 @@ void QRasterPaintEngine::updateOutlineMapper()
d->outlineMapper->setMatrix(state()->matrix);
}
-void QRasterPaintEngine::updateState()
+void QRasterPaintEngine::updateRasterState()
{
QRasterPaintEngineState *s = state();
@@ -1434,7 +1434,7 @@ void QRasterPaintEngine::drawRects(const QRect *rects, int rectCount)
qDebug(" - QRasterPaintEngine::drawRect(), rectCount=%d", rectCount);
#endif
Q_D(QRasterPaintEngine);
- ensureState();
+ ensureRasterState();
QRasterPaintEngineState *s = state();
// Fill
@@ -1489,7 +1489,7 @@ void QRasterPaintEngine::drawRects(const QRectF *rects, int rectCount)
#endif
#ifdef QT_FAST_SPANS
Q_D(QRasterPaintEngine);
- ensureState();
+ ensureRasterState();
QRasterPaintEngineState *s = state();
@@ -1645,7 +1645,7 @@ void QRasterPaintEngine::fill(const QVectorPath &path, const QBrush &brush)
fillRect_normalized(toNormalizedFillRect(QRectF(tl, br)), &s->brushData, d);
return;
}
- ensureState();
+ ensureRasterState();
if (s->flags.tx_noshear) {
d->initializeRasterizer(&s->brushData);
// ### Is normalizing really necessary here?
@@ -1702,7 +1702,7 @@ void QRasterPaintEngine::fillRect(const QRectF &r, QSpanData *data)
return;
}
}
- ensureState();
+ ensureRasterState();
if (s->flags.tx_noshear) {
d->initializeRasterizer(data);
QRectF nr = r.normalized();
@@ -2330,7 +2330,7 @@ void QRasterPaintEngine::drawImage(const QRectF &r, const QImage &img, const QRe
}
#ifdef QT_FAST_SPANS
- ensureState();
+ ensureRasterState();
if (s->flags.tx_noshear || s->matrix.type() == QTransform::TxScale) {
d->initializeRasterizer(&d->image_filler_xform);
d->rasterizer->setAntialiased(s->flags.antialiased);
@@ -2425,7 +2425,7 @@ void QRasterPaintEngine::drawTiledPixmap(const QRectF &r, const QPixmap &pixmap,
d->image_filler_xform.setupMatrix(copy, s->flags.bilinear);
#ifdef QT_FAST_SPANS
- ensureState();
+ ensureRasterState();
if (s->flags.tx_noshear || s->matrix.type() == QTransform::TxScale) {
d->initializeRasterizer(&d->image_filler_xform);
d->rasterizer->setAntialiased(s->flags.antialiased);
@@ -2878,18 +2878,68 @@ QRasterPaintEnginePrivate::getPenFunc(const QRectF &rect,
return isUnclipped(rect, penWidth) ? data->unclipped_blend : data->blend;
}
+static QPair<int, int> visibleGlyphRange(const QRectF &clip, QFontEngine *fontEngine,
+ glyph_t *glyphs, QFixedPoint *positions, int numGlyphs)
+{
+ QFixed clipLeft = QFixed::fromReal(clip.left());
+ QFixed clipRight = QFixed::fromReal(clip.right());
+ QFixed clipTop = QFixed::fromReal(clip.top());
+ QFixed clipBottom = QFixed::fromReal(clip.bottom());
+
+ int first = 0;
+ while (first < numGlyphs) {
+ glyph_metrics_t metrics = fontEngine->boundingBox(glyphs[first]);
+ QFixed left = metrics.x + positions[first].x;
+ QFixed top = metrics.y + positions[first].y;
+ QFixed right = left + metrics.width;
+ QFixed bottom = top + metrics.height;
+ if (left < clipRight && right > clipLeft && top < clipBottom && bottom > clipTop)
+ break;
+ ++first;
+ }
+ int last = numGlyphs - 1;
+ while (last > first) {
+ glyph_metrics_t metrics = fontEngine->boundingBox(glyphs[last]);
+ QFixed left = metrics.x + positions[last].x;
+ QFixed top = metrics.y + positions[last].y;
+ QFixed right = left + metrics.width;
+ QFixed bottom = top + metrics.height;
+ if (left < clipRight && right > clipLeft && top < clipBottom && bottom > clipTop)
+ break;
+ --last;
+ }
+ return QPair<int, int>(first, last + 1);
+}
+
/*!
\reimp
*/
void QRasterPaintEngine::drawStaticTextItem(QStaticTextItem *textItem)
{
+ if (textItem->numGlyphs == 0)
+ return;
+
ensurePen();
- ensureState();
+ ensureRasterState();
QFontEngine *fontEngine = textItem->fontEngine();
if (shouldDrawCachedGlyphs(fontEngine->fontDef.pixelSize, state()->matrix)) {
drawCachedGlyphs(textItem->numGlyphs, textItem->glyphs, textItem->glyphPositions,
fontEngine);
+ } else if (state()->matrix.type() < QTransform::TxProject) {
+ bool invertible;
+ QTransform invMat = state()->matrix.inverted(&invertible);
+ if (!invertible)
+ return;
+
+ QPair<int, int> range = visibleGlyphRange(invMat.mapRect(clipBoundingRect()),
+ textItem->fontEngine(), textItem->glyphs,
+ textItem->glyphPositions, textItem->numGlyphs);
+ QStaticTextItem copy = *textItem;
+ copy.glyphs += range.first;
+ copy.glyphPositions += range.first;
+ copy.numGlyphs = range.second - range.first;
+ QPaintEngineEx::drawStaticTextItem(&copy);
} else {
QPaintEngineEx::drawStaticTextItem(textItem);
}
@@ -2901,7 +2951,6 @@ void QRasterPaintEngine::drawStaticTextItem(QStaticTextItem *textItem)
void QRasterPaintEngine::drawTextItem(const QPointF &p, const QTextItem &textItem)
{
const QTextItemInt &ti = static_cast<const QTextItemInt &>(textItem);
- QRasterPaintEngineState *s = state();
#ifdef QT_DEBUG_DRAW
Q_D(QRasterPaintEngine);
@@ -2910,25 +2959,51 @@ void QRasterPaintEngine::drawTextItem(const QPointF &p, const QTextItem &textIte
d->glyphCacheType);
#endif
+ if (ti.glyphs.numGlyphs == 0)
+ return;
ensurePen();
- ensureState();
+ ensureRasterState();
+ QRasterPaintEngineState *s = state();
+ QTransform matrix = s->matrix;
if (!supportsTransformations(ti.fontEngine)) {
QVarLengthArray<QFixedPoint> positions;
QVarLengthArray<glyph_t> glyphs;
- QTransform matrix = s->matrix;
matrix.translate(p.x(), p.y());
-
ti.fontEngine->getGlyphPositions(ti.glyphs, matrix, ti.flags, glyphs, positions);
drawCachedGlyphs(glyphs.size(), glyphs.constData(), positions.constData(), ti.fontEngine);
- return;
- }
+ } else if (matrix.type() < QTransform::TxProject) {
+ bool invertible;
+ QTransform invMat = matrix.inverted(&invertible);
+ if (!invertible)
+ return;
+ QVarLengthArray<QFixedPoint> positions;
+ QVarLengthArray<glyph_t> glyphs;
- QPaintEngineEx::drawTextItem(p, ti);
+ ti.fontEngine->getGlyphPositions(ti.glyphs, QTransform::fromTranslate(p.x(), p.y()),
+ ti.flags, glyphs, positions);
+ QPair<int, int> range = visibleGlyphRange(invMat.mapRect(clipBoundingRect()),
+ ti.fontEngine, glyphs.data(), positions.data(),
+ glyphs.size());
+
+ if (range.first >= range.second)
+ return;
+
+ QStaticTextItem staticTextItem;
+ staticTextItem.color = s->pen.color();
+ staticTextItem.font = s->font;
+ staticTextItem.setFontEngine(ti.fontEngine);
+ staticTextItem.numGlyphs = range.second - range.first;
+ staticTextItem.glyphs = glyphs.data() + range.first;
+ staticTextItem.glyphPositions = positions.data() + range.first;
+ QPaintEngineEx::drawStaticTextItem(&staticTextItem);
+ } else {
+ QPaintEngineEx::drawTextItem(p, ti);
+ }
}
/*!
@@ -4426,8 +4501,6 @@ void QSpanData::setupMatrix(const QTransform &matrix, int bilin)
adjustSpanMethods();
}
-extern const QVector<QRgb> *qt_image_colortable(const QImage &image);
-
void QSpanData::initTexture(const QImage *image, int alpha, QTextureData::Type _type, const QRect &sourceRect)
{
const QImageData *d = const_cast<QImage *>(image)->data_ptr();
diff --git a/src/gui/painting/qpaintengine_raster_p.h b/src/gui/painting/qpaintengine_raster_p.h
index d9cc428337..aa454c0509 100644
--- a/src/gui/painting/qpaintengine_raster_p.h
+++ b/src/gui/painting/qpaintengine_raster_p.h
@@ -1,6 +1,6 @@
/****************************************************************************
**
-** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies).
+** Copyright (C) 2012 Nokia Corporation and/or its subsidiary(-ies).
** All rights reserved.
** Contact: Nokia Corporation (qt-info@nokia.com)
**
@@ -178,7 +178,7 @@ public:
void drawPixmap(const QRectF &r, const QPixmap &pm, const QRectF &sr);
void drawImage(const QPointF &p, const QImage &img);
void drawImage(const QRectF &r, const QImage &pm, const QRectF &sr,
- Qt::ImageConversionFlags falgs = Qt::AutoColor);
+ Qt::ImageConversionFlags flags = Qt::AutoColor);
void drawTiledPixmap(const QRectF &r, const QPixmap &pm, const QPointF &sr);
void drawTextItem(const QPointF &p, const QTextItem &textItem);
@@ -268,10 +268,10 @@ private:
void updateOutlineMapper();
inline void ensureOutlineMapper();
- void updateState();
- inline void ensureState() {
+ void updateRasterState();
+ inline void ensureRasterState() {
if (state()->dirty)
- updateState();
+ updateRasterState();
}
};
diff --git a/src/gui/painting/qpaintengineex.cpp b/src/gui/painting/qpaintengineex.cpp
index 5c39a5fca2..e5e14c9135 100644
--- a/src/gui/painting/qpaintengineex.cpp
+++ b/src/gui/painting/qpaintengineex.cpp
@@ -1,6 +1,6 @@
/****************************************************************************
**
-** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies).
+** Copyright (C) 2012 Nokia Corporation and/or its subsidiary(-ies).
** All rights reserved.
** Contact: Nokia Corporation (qt-info@nokia.com)
**
@@ -1072,7 +1072,7 @@ void QPaintEngineEx::drawStaticTextItem(QStaticTextItem *staticTextItem)
changedHints = true;
}
- fill(qtVectorPathForPath(path), s->pen.color());
+ fill(qtVectorPathForPath(path), s->pen.brush());
if (changedHints) {
s->renderHints = oldHints;
diff --git a/src/gui/painting/qpaintengineex_p.h b/src/gui/painting/qpaintengineex_p.h
index 9674f04ba1..33a6081570 100644
--- a/src/gui/painting/qpaintengineex_p.h
+++ b/src/gui/painting/qpaintengineex_p.h
@@ -1,6 +1,6 @@
/****************************************************************************
**
-** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies).
+** Copyright (C) 2012 Nokia Corporation and/or its subsidiary(-ies).
** All rights reserved.
** Contact: Nokia Corporation (qt-info@nokia.com)
**
diff --git a/src/gui/painting/qpainter.cpp b/src/gui/painting/qpainter.cpp
index 416fe5adbf..77c3fc183f 100644
--- a/src/gui/painting/qpainter.cpp
+++ b/src/gui/painting/qpainter.cpp
@@ -1,6 +1,6 @@
/****************************************************************************
**
-** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies).
+** Copyright (C) 2012 Nokia Corporation and/or its subsidiary(-ies).
** All rights reserved.
** Contact: Nokia Corporation (qt-info@nokia.com)
**
@@ -2201,7 +2201,7 @@ void QPainter::setBrushOrigin(const QPointF &p)
source defines the translucency of the pixel.
When the paint device is a QImage, the image format must be set to
- \l {QImage::Format}{Format_ARGB32Premultiplied} or
+ \l {QImage::Format}{Format_ARGB32_Premultiplied} or
\l {QImage::Format}{Format_ARGB32} for the composition modes to have
any effect. For performance the premultiplied version is the preferred
format.
diff --git a/src/gui/painting/qpainter.h b/src/gui/painting/qpainter.h
index fd40111368..ba9a9fbb97 100644
--- a/src/gui/painting/qpainter.h
+++ b/src/gui/painting/qpainter.h
@@ -1,6 +1,6 @@
/****************************************************************************
**
-** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies).
+** Copyright (C) 2012 Nokia Corporation and/or its subsidiary(-ies).
** All rights reserved.
** Contact: Nokia Corporation (qt-info@nokia.com)
**
diff --git a/src/gui/painting/qpainter_p.h b/src/gui/painting/qpainter_p.h
index 79d4b4bbe0..0fb3069ee0 100644
--- a/src/gui/painting/qpainter_p.h
+++ b/src/gui/painting/qpainter_p.h
@@ -1,6 +1,6 @@
/****************************************************************************
**
-** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies).
+** Copyright (C) 2012 Nokia Corporation and/or its subsidiary(-ies).
** All rights reserved.
** Contact: Nokia Corporation (qt-info@nokia.com)
**
diff --git a/src/gui/painting/qpainterpath.cpp b/src/gui/painting/qpainterpath.cpp
index 5b70f4b22a..9c69644033 100644
--- a/src/gui/painting/qpainterpath.cpp
+++ b/src/gui/painting/qpainterpath.cpp
@@ -1,6 +1,6 @@
/****************************************************************************
**
-** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies).
+** Copyright (C) 2012 Nokia Corporation and/or its subsidiary(-ies).
** All rights reserved.
** Contact: Nokia Corporation (qt-info@nokia.com)
**
diff --git a/src/gui/painting/qpainterpath.h b/src/gui/painting/qpainterpath.h
index a558abca3d..46af341df3 100644
--- a/src/gui/painting/qpainterpath.h
+++ b/src/gui/painting/qpainterpath.h
@@ -1,6 +1,6 @@
/****************************************************************************
**
-** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies).
+** Copyright (C) 2012 Nokia Corporation and/or its subsidiary(-ies).
** All rights reserved.
** Contact: Nokia Corporation (qt-info@nokia.com)
**
diff --git a/src/gui/painting/qpainterpath_p.h b/src/gui/painting/qpainterpath_p.h
index 738c2d382d..1cf00bbae3 100644
--- a/src/gui/painting/qpainterpath_p.h
+++ b/src/gui/painting/qpainterpath_p.h
@@ -1,6 +1,6 @@
/****************************************************************************
**
-** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies).
+** Copyright (C) 2012 Nokia Corporation and/or its subsidiary(-ies).
** All rights reserved.
** Contact: Nokia Corporation (qt-info@nokia.com)
**
diff --git a/src/gui/painting/qpathclipper.cpp b/src/gui/painting/qpathclipper.cpp
index f739198be0..03f48d8fda 100644
--- a/src/gui/painting/qpathclipper.cpp
+++ b/src/gui/painting/qpathclipper.cpp
@@ -1,6 +1,6 @@
/****************************************************************************
**
-** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies).
+** Copyright (C) 2012 Nokia Corporation and/or its subsidiary(-ies).
** All rights reserved.
** Contact: Nokia Corporation (qt-info@nokia.com)
**
diff --git a/src/gui/painting/qpathclipper_p.h b/src/gui/painting/qpathclipper_p.h
index fe4a97ad4c..daf97884c0 100644
--- a/src/gui/painting/qpathclipper_p.h
+++ b/src/gui/painting/qpathclipper_p.h
@@ -1,6 +1,6 @@
/****************************************************************************
**
-** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies).
+** Copyright (C) 2012 Nokia Corporation and/or its subsidiary(-ies).
** All rights reserved.
** Contact: Nokia Corporation (qt-info@nokia.com)
**
diff --git a/src/gui/painting/qpdf.cpp b/src/gui/painting/qpdf.cpp
index 8f21663ffc..62f4b9b3f6 100644
--- a/src/gui/painting/qpdf.cpp
+++ b/src/gui/painting/qpdf.cpp
@@ -1,6 +1,6 @@
/****************************************************************************
**
-** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies).
+** Copyright (C) 2012 Nokia Corporation and/or its subsidiary(-ies).
** All rights reserved.
** Contact: Nokia Corporation (qt-info@nokia.com)
**
diff --git a/src/gui/painting/qpdf_p.h b/src/gui/painting/qpdf_p.h
index 6df5052c06..32b59e92e8 100644
--- a/src/gui/painting/qpdf_p.h
+++ b/src/gui/painting/qpdf_p.h
@@ -1,6 +1,6 @@
/****************************************************************************
**
-** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies).
+** Copyright (C) 2012 Nokia Corporation and/or its subsidiary(-ies).
** All rights reserved.
** Contact: Nokia Corporation (qt-info@nokia.com)
**
diff --git a/src/gui/painting/qpdfwriter.cpp b/src/gui/painting/qpdfwriter.cpp
index a0f8df2061..23be05c49c 100644
--- a/src/gui/painting/qpdfwriter.cpp
+++ b/src/gui/painting/qpdfwriter.cpp
@@ -1,6 +1,6 @@
/****************************************************************************
**
-** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies).
+** Copyright (C) 2012 Nokia Corporation and/or its subsidiary(-ies).
** All rights reserved.
** Contact: Nokia Corporation (qt-info@nokia.com)
**
diff --git a/src/gui/painting/qpdfwriter.h b/src/gui/painting/qpdfwriter.h
index 005d8e640b..dfe49b403a 100644
--- a/src/gui/painting/qpdfwriter.h
+++ b/src/gui/painting/qpdfwriter.h
@@ -1,6 +1,6 @@
/****************************************************************************
**
-** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies).
+** Copyright (C) 2012 Nokia Corporation and/or its subsidiary(-ies).
** All rights reserved.
** Contact: Nokia Corporation (qt-info@nokia.com)
**
diff --git a/src/gui/painting/qpen.cpp b/src/gui/painting/qpen.cpp
index 5358239014..3654c6f007 100644
--- a/src/gui/painting/qpen.cpp
+++ b/src/gui/painting/qpen.cpp
@@ -1,6 +1,6 @@
/****************************************************************************
**
-** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies).
+** Copyright (C) 2012 Nokia Corporation and/or its subsidiary(-ies).
** All rights reserved.
** Contact: Nokia Corporation (qt-info@nokia.com)
**
diff --git a/src/gui/painting/qpen.h b/src/gui/painting/qpen.h
index a751c2fdd3..708f131ece 100644
--- a/src/gui/painting/qpen.h
+++ b/src/gui/painting/qpen.h
@@ -1,6 +1,6 @@
/****************************************************************************
**
-** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies).
+** Copyright (C) 2012 Nokia Corporation and/or its subsidiary(-ies).
** All rights reserved.
** Contact: Nokia Corporation (qt-info@nokia.com)
**
diff --git a/src/gui/painting/qpen_p.h b/src/gui/painting/qpen_p.h
index d91566664d..4610026e2f 100644
--- a/src/gui/painting/qpen_p.h
+++ b/src/gui/painting/qpen_p.h
@@ -1,6 +1,6 @@
/****************************************************************************
**
-** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies).
+** Copyright (C) 2012 Nokia Corporation and/or its subsidiary(-ies).
** All rights reserved.
** Contact: Nokia Corporation (qt-info@nokia.com)
**
diff --git a/src/gui/painting/qplatformbackingstore_qpa.cpp b/src/gui/painting/qplatformbackingstore_qpa.cpp
index 2c0053af86..9d855735f4 100644
--- a/src/gui/painting/qplatformbackingstore_qpa.cpp
+++ b/src/gui/painting/qplatformbackingstore_qpa.cpp
@@ -1,6 +1,6 @@
/****************************************************************************
**
-** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies).
+** Copyright (C) 2012 Nokia Corporation and/or its subsidiary(-ies).
** All rights reserved.
** Contact: Nokia Corporation (qt-info@nokia.com)
**
diff --git a/src/gui/painting/qplatformbackingstore_qpa.h b/src/gui/painting/qplatformbackingstore_qpa.h
index d5a2536ea6..a47106771e 100644
--- a/src/gui/painting/qplatformbackingstore_qpa.h
+++ b/src/gui/painting/qplatformbackingstore_qpa.h
@@ -1,6 +1,6 @@
/****************************************************************************
**
-** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies).
+** Copyright (C) 2012 Nokia Corporation and/or its subsidiary(-ies).
** All rights reserved.
** Contact: Nokia Corporation (qt-info@nokia.com)
**
diff --git a/src/gui/painting/qpolygon.cpp b/src/gui/painting/qpolygon.cpp
index fc22aed392..b745e1a6ee 100644
--- a/src/gui/painting/qpolygon.cpp
+++ b/src/gui/painting/qpolygon.cpp
@@ -1,6 +1,6 @@
/****************************************************************************
**
-** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies).
+** Copyright (C) 2012 Nokia Corporation and/or its subsidiary(-ies).
** All rights reserved.
** Contact: Nokia Corporation (qt-info@nokia.com)
**
diff --git a/src/gui/painting/qpolygon.h b/src/gui/painting/qpolygon.h
index cf3bf472f6..348cf9eef7 100644
--- a/src/gui/painting/qpolygon.h
+++ b/src/gui/painting/qpolygon.h
@@ -1,6 +1,6 @@
/****************************************************************************
**
-** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies).
+** Copyright (C) 2012 Nokia Corporation and/or its subsidiary(-ies).
** All rights reserved.
** Contact: Nokia Corporation (qt-info@nokia.com)
**
diff --git a/src/gui/painting/qpolygonclipper_p.h b/src/gui/painting/qpolygonclipper_p.h
index df0bfccc3f..6512a3a0ed 100644
--- a/src/gui/painting/qpolygonclipper_p.h
+++ b/src/gui/painting/qpolygonclipper_p.h
@@ -1,6 +1,6 @@
/****************************************************************************
**
-** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies).
+** Copyright (C) 2012 Nokia Corporation and/or its subsidiary(-ies).
** All rights reserved.
** Contact: Nokia Corporation (qt-info@nokia.com)
**
diff --git a/src/gui/painting/qrasterdefs_p.h b/src/gui/painting/qrasterdefs_p.h
index 8d9d4e9277..a113ab0abf 100644
--- a/src/gui/painting/qrasterdefs_p.h
+++ b/src/gui/painting/qrasterdefs_p.h
@@ -1,6 +1,6 @@
/****************************************************************************
**
-** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies).
+** Copyright (C) 2012 Nokia Corporation and/or its subsidiary(-ies).
** All rights reserved.
** Contact: Nokia Corporation (qt-info@nokia.com)
**
diff --git a/src/gui/painting/qrasterizer.cpp b/src/gui/painting/qrasterizer.cpp
index 1d3f581b88..5a46d1ba48 100644
--- a/src/gui/painting/qrasterizer.cpp
+++ b/src/gui/painting/qrasterizer.cpp
@@ -1,6 +1,6 @@
/****************************************************************************
**
-** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies).
+** Copyright (C) 2012 Nokia Corporation and/or its subsidiary(-ies).
** All rights reserved.
** Contact: Nokia Corporation (qt-info@nokia.com)
**
diff --git a/src/gui/painting/qrasterizer_p.h b/src/gui/painting/qrasterizer_p.h
index 913e2d3229..ed7d4eb957 100644
--- a/src/gui/painting/qrasterizer_p.h
+++ b/src/gui/painting/qrasterizer_p.h
@@ -1,6 +1,6 @@
/****************************************************************************
**
-** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies).
+** Copyright (C) 2012 Nokia Corporation and/or its subsidiary(-ies).
** All rights reserved.
** Contact: Nokia Corporation (qt-info@nokia.com)
**
diff --git a/src/gui/painting/qregion.cpp b/src/gui/painting/qregion.cpp
index 66b12e5034..68338602e2 100644
--- a/src/gui/painting/qregion.cpp
+++ b/src/gui/painting/qregion.cpp
@@ -1,6 +1,6 @@
/****************************************************************************
**
-** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies).
+** Copyright (C) 2012 Nokia Corporation and/or its subsidiary(-ies).
** All rights reserved.
** Contact: Nokia Corporation (qt-info@nokia.com)
**
diff --git a/src/gui/painting/qregion.h b/src/gui/painting/qregion.h
index a5ea88b8bd..834a015ceb 100644
--- a/src/gui/painting/qregion.h
+++ b/src/gui/painting/qregion.h
@@ -1,6 +1,6 @@
/****************************************************************************
**
-** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies).
+** Copyright (C) 2012 Nokia Corporation and/or its subsidiary(-ies).
** All rights reserved.
** Contact: Nokia Corporation (qt-info@nokia.com)
**
diff --git a/src/gui/painting/qrgb.h b/src/gui/painting/qrgb.h
index 1f9c922bf2..b982707344 100644
--- a/src/gui/painting/qrgb.h
+++ b/src/gui/painting/qrgb.h
@@ -1,6 +1,6 @@
/****************************************************************************
**
-** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies).
+** Copyright (C) 2012 Nokia Corporation and/or its subsidiary(-ies).
** All rights reserved.
** Contact: Nokia Corporation (qt-info@nokia.com)
**
diff --git a/src/gui/painting/qstroker.cpp b/src/gui/painting/qstroker.cpp
index bbb951eb9b..f7e50c82c0 100644
--- a/src/gui/painting/qstroker.cpp
+++ b/src/gui/painting/qstroker.cpp
@@ -1,6 +1,6 @@
/****************************************************************************
**
-** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies).
+** Copyright (C) 2012 Nokia Corporation and/or its subsidiary(-ies).
** All rights reserved.
** Contact: Nokia Corporation (qt-info@nokia.com)
**
diff --git a/src/gui/painting/qstroker_p.h b/src/gui/painting/qstroker_p.h
index 58d4f5da40..b6cae1d2a0 100644
--- a/src/gui/painting/qstroker_p.h
+++ b/src/gui/painting/qstroker_p.h
@@ -1,6 +1,6 @@
/****************************************************************************
**
-** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies).
+** Copyright (C) 2012 Nokia Corporation and/or its subsidiary(-ies).
** All rights reserved.
** Contact: Nokia Corporation (qt-info@nokia.com)
**
diff --git a/src/gui/painting/qtextureglyphcache.cpp b/src/gui/painting/qtextureglyphcache.cpp
index 1e0ed0f798..0743804319 100644
--- a/src/gui/painting/qtextureglyphcache.cpp
+++ b/src/gui/painting/qtextureglyphcache.cpp
@@ -1,6 +1,6 @@
/****************************************************************************
**
-** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies).
+** Copyright (C) 2012 Nokia Corporation and/or its subsidiary(-ies).
** All rights reserved.
** Contact: Nokia Corporation (qt-info@nokia.com)
**
diff --git a/src/gui/painting/qtextureglyphcache_p.h b/src/gui/painting/qtextureglyphcache_p.h
index d9d57f41ab..d29a31f4f3 100644
--- a/src/gui/painting/qtextureglyphcache_p.h
+++ b/src/gui/painting/qtextureglyphcache_p.h
@@ -1,6 +1,6 @@
/****************************************************************************
**
-** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies).
+** Copyright (C) 2012 Nokia Corporation and/or its subsidiary(-ies).
** All rights reserved.
** Contact: Nokia Corporation (qt-info@nokia.com)
**
diff --git a/src/gui/painting/qtransform.cpp b/src/gui/painting/qtransform.cpp
index e42eec6f96..f9948bf8d1 100644
--- a/src/gui/painting/qtransform.cpp
+++ b/src/gui/painting/qtransform.cpp
@@ -1,6 +1,6 @@
/****************************************************************************
**
-** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies).
+** Copyright (C) 2012 Nokia Corporation and/or its subsidiary(-ies).
** All rights reserved.
** Contact: Nokia Corporation (qt-info@nokia.com)
**
diff --git a/src/gui/painting/qtransform.h b/src/gui/painting/qtransform.h
index 3289bf4d26..08a4861100 100644
--- a/src/gui/painting/qtransform.h
+++ b/src/gui/painting/qtransform.h
@@ -1,6 +1,6 @@
/****************************************************************************
**
-** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies).
+** Copyright (C) 2012 Nokia Corporation and/or its subsidiary(-ies).
** All rights reserved.
** Contact: Nokia Corporation (qt-info@nokia.com)
**
diff --git a/src/gui/painting/qvectorpath_p.h b/src/gui/painting/qvectorpath_p.h
index 6a061a405b..8a54e65aed 100644
--- a/src/gui/painting/qvectorpath_p.h
+++ b/src/gui/painting/qvectorpath_p.h
@@ -1,6 +1,6 @@
/****************************************************************************
**
-** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies).
+** Copyright (C) 2012 Nokia Corporation and/or its subsidiary(-ies).
** All rights reserved.
** Contact: Nokia Corporation (qt-info@nokia.com)
**
diff --git a/src/gui/text/qabstractfontengine_p.h b/src/gui/text/qabstractfontengine_p.h
index b744d6664c..7d0eaa7b42 100644
--- a/src/gui/text/qabstractfontengine_p.h
+++ b/src/gui/text/qabstractfontengine_p.h
@@ -1,6 +1,6 @@
/****************************************************************************
**
-** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies).
+** Copyright (C) 2012 Nokia Corporation and/or its subsidiary(-ies).
** All rights reserved.
** Contact: Nokia Corporation (qt-info@nokia.com)
**
diff --git a/src/gui/text/qabstracttextdocumentlayout.cpp b/src/gui/text/qabstracttextdocumentlayout.cpp
index c392b54520..5dd29e6548 100644
--- a/src/gui/text/qabstracttextdocumentlayout.cpp
+++ b/src/gui/text/qabstracttextdocumentlayout.cpp
@@ -1,6 +1,6 @@
/****************************************************************************
**
-** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies).
+** Copyright (C) 2012 Nokia Corporation and/or its subsidiary(-ies).
** All rights reserved.
** Contact: Nokia Corporation (qt-info@nokia.com)
**
diff --git a/src/gui/text/qabstracttextdocumentlayout.h b/src/gui/text/qabstracttextdocumentlayout.h
index 8e792e9b80..1362640b4f 100644
--- a/src/gui/text/qabstracttextdocumentlayout.h
+++ b/src/gui/text/qabstracttextdocumentlayout.h
@@ -1,6 +1,6 @@
/****************************************************************************
**
-** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies).
+** Copyright (C) 2012 Nokia Corporation and/or its subsidiary(-ies).
** All rights reserved.
** Contact: Nokia Corporation (qt-info@nokia.com)
**
diff --git a/src/gui/text/qabstracttextdocumentlayout_p.h b/src/gui/text/qabstracttextdocumentlayout_p.h
index 692b535991..6f8f113bff 100644
--- a/src/gui/text/qabstracttextdocumentlayout_p.h
+++ b/src/gui/text/qabstracttextdocumentlayout_p.h
@@ -1,6 +1,6 @@
/****************************************************************************
**
-** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies).
+** Copyright (C) 2012 Nokia Corporation and/or its subsidiary(-ies).
** All rights reserved.
** Contact: Nokia Corporation (qt-info@nokia.com)
**
diff --git a/src/gui/text/qcssparser.cpp b/src/gui/text/qcssparser.cpp
index 6a28ff2d74..06a88f02ee 100644
--- a/src/gui/text/qcssparser.cpp
+++ b/src/gui/text/qcssparser.cpp
@@ -1,6 +1,6 @@
/****************************************************************************
**
-** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies).
+** Copyright (C) 2012 Nokia Corporation and/or its subsidiary(-ies).
** All rights reserved.
** Contact: Nokia Corporation (qt-info@nokia.com)
**
diff --git a/src/gui/text/qcssparser_p.h b/src/gui/text/qcssparser_p.h
index 171085b800..fa60a3fd2e 100644
--- a/src/gui/text/qcssparser_p.h
+++ b/src/gui/text/qcssparser_p.h
@@ -1,6 +1,6 @@
/****************************************************************************
**
-** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies).
+** Copyright (C) 2012 Nokia Corporation and/or its subsidiary(-ies).
** All rights reserved.
** Contact: Nokia Corporation (qt-info@nokia.com)
**
diff --git a/src/gui/text/qcssscanner.cpp b/src/gui/text/qcssscanner.cpp
index 375f211d9f..07928a62af 100644
--- a/src/gui/text/qcssscanner.cpp
+++ b/src/gui/text/qcssscanner.cpp
@@ -1,6 +1,6 @@
/****************************************************************************
**
-** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies).
+** Copyright (C) 2012 Nokia Corporation and/or its subsidiary(-ies).
** All rights reserved.
** Contact: Nokia Corporation (qt-info@nokia.com)
**
diff --git a/src/gui/text/qfont.cpp b/src/gui/text/qfont.cpp
index 804d3f9e66..1ac398967d 100644
--- a/src/gui/text/qfont.cpp
+++ b/src/gui/text/qfont.cpp
@@ -1,6 +1,6 @@
/****************************************************************************
**
-** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies).
+** Copyright (C) 2012 Nokia Corporation and/or its subsidiary(-ies).
** All rights reserved.
** Contact: Nokia Corporation (qt-info@nokia.com)
**
@@ -138,36 +138,32 @@ extern bool qt_is_gui_used;
Q_GUI_EXPORT int qt_defaultDpiX()
{
+ if (qApp->testAttribute(Qt::AA_Use96Dpi))
+ return 96;
+
if (!qt_is_gui_used)
return 75;
- int dpi;
- QScreen *screen = QGuiApplication::primaryScreen();
- if (screen) {
- dpi = qRound(screen->logicalDotsPerInchX());
- } else {
- //PI has not been initialised, or it is being initialised. Give a default dpi
- dpi = 100;
- }
+ if (const QScreen *screen = QGuiApplication::primaryScreen())
+ return qRound(screen->logicalDotsPerInchX());
- return dpi;
+ //PI has not been initialised, or it is being initialised. Give a default dpi
+ return 100;
}
Q_GUI_EXPORT int qt_defaultDpiY()
{
+ if (qApp->testAttribute(Qt::AA_Use96Dpi))
+ return 96;
+
if (!qt_is_gui_used)
return 75;
- int dpi;
- QScreen *screen = QGuiApplication::primaryScreen();
- if (screen) {
- dpi = qRound(screen->logicalDotsPerInchY());
- } else {
- //PI has not been initialised, or it is being initialised. Give a default dpi
- dpi = 100;
- }
+ if (const QScreen *screen = QGuiApplication::primaryScreen())
+ return qRound(screen->logicalDotsPerInchY());
- return dpi;
+ //PI has not been initialised, or it is being initialised. Give a default dpi
+ return 100;
}
Q_GUI_EXPORT int qt_defaultDpi()
diff --git a/src/gui/text/qfont.h b/src/gui/text/qfont.h
index 326dc9d63e..afeea3ce65 100644
--- a/src/gui/text/qfont.h
+++ b/src/gui/text/qfont.h
@@ -1,6 +1,6 @@
/****************************************************************************
**
-** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies).
+** Copyright (C) 2012 Nokia Corporation and/or its subsidiary(-ies).
** All rights reserved.
** Contact: Nokia Corporation (qt-info@nokia.com)
**
diff --git a/src/gui/text/qfont_p.h b/src/gui/text/qfont_p.h
index 2d4f3de7e7..b57af5f213 100644
--- a/src/gui/text/qfont_p.h
+++ b/src/gui/text/qfont_p.h
@@ -1,6 +1,6 @@
/****************************************************************************
**
-** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies).
+** Copyright (C) 2012 Nokia Corporation and/or its subsidiary(-ies).
** All rights reserved.
** Contact: Nokia Corporation (qt-info@nokia.com)
**
diff --git a/src/gui/text/qfont_qpa.cpp b/src/gui/text/qfont_qpa.cpp
index 28fd77df56..2f5b6f7660 100644
--- a/src/gui/text/qfont_qpa.cpp
+++ b/src/gui/text/qfont_qpa.cpp
@@ -1,6 +1,6 @@
/****************************************************************************
**
-** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies).
+** Copyright (C) 2012 Nokia Corporation and/or its subsidiary(-ies).
** All rights reserved.
** Contact: Nokia Corporation (qt-info@nokia.com)
**
diff --git a/src/gui/text/qfontdatabase.cpp b/src/gui/text/qfontdatabase.cpp
index c80ded6e7b..e7cbe2a8a8 100644
--- a/src/gui/text/qfontdatabase.cpp
+++ b/src/gui/text/qfontdatabase.cpp
@@ -1,6 +1,6 @@
/****************************************************************************
**
-** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies).
+** Copyright (C) 2012 Nokia Corporation and/or its subsidiary(-ies).
** All rights reserved.
** Contact: Nokia Corporation (qt-info@nokia.com)
**
diff --git a/src/gui/text/qfontdatabase.h b/src/gui/text/qfontdatabase.h
index 873d00946c..3bfc07fbfd 100644
--- a/src/gui/text/qfontdatabase.h
+++ b/src/gui/text/qfontdatabase.h
@@ -1,6 +1,6 @@
/****************************************************************************
**
-** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies).
+** Copyright (C) 2012 Nokia Corporation and/or its subsidiary(-ies).
** All rights reserved.
** Contact: Nokia Corporation (qt-info@nokia.com)
**
diff --git a/src/gui/text/qfontdatabase_qpa.cpp b/src/gui/text/qfontdatabase_qpa.cpp
index 55b9023c7c..a5cb923460 100644
--- a/src/gui/text/qfontdatabase_qpa.cpp
+++ b/src/gui/text/qfontdatabase_qpa.cpp
@@ -1,6 +1,6 @@
/****************************************************************************
**
-** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies).
+** Copyright (C) 2012 Nokia Corporation and/or its subsidiary(-ies).
** All rights reserved.
** Contact: Nokia Corporation (qt-info@nokia.com)
**
diff --git a/src/gui/text/qfontengine.cpp b/src/gui/text/qfontengine.cpp
index 5c6c8d186a..d569cb58b9 100644
--- a/src/gui/text/qfontengine.cpp
+++ b/src/gui/text/qfontengine.cpp
@@ -1,6 +1,6 @@
/****************************************************************************
**
-** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies).
+** Copyright (C) 2012 Nokia Corporation and/or its subsidiary(-ies).
** All rights reserved.
** Contact: Nokia Corporation (qt-info@nokia.com)
**
diff --git a/src/gui/text/qfontengine_ft.cpp b/src/gui/text/qfontengine_ft.cpp
index b2bff92b76..e41c0a93c7 100644
--- a/src/gui/text/qfontengine_ft.cpp
+++ b/src/gui/text/qfontengine_ft.cpp
@@ -1,6 +1,6 @@
/****************************************************************************
**
-** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies).
+** Copyright (C) 2012 Nokia Corporation and/or its subsidiary(-ies).
** All rights reserved.
** Contact: Nokia Corporation (qt-info@nokia.com)
**
diff --git a/src/gui/text/qfontengine_ft_p.h b/src/gui/text/qfontengine_ft_p.h
index edc2457687..c84c11163a 100644
--- a/src/gui/text/qfontengine_ft_p.h
+++ b/src/gui/text/qfontengine_ft_p.h
@@ -1,6 +1,6 @@
/****************************************************************************
**
-** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies).
+** Copyright (C) 2012 Nokia Corporation and/or its subsidiary(-ies).
** All rights reserved.
** Contact: Nokia Corporation (qt-info@nokia.com)
**
diff --git a/src/gui/text/qfontengine_p.h b/src/gui/text/qfontengine_p.h
index 4caf91e735..02523ada82 100644
--- a/src/gui/text/qfontengine_p.h
+++ b/src/gui/text/qfontengine_p.h
@@ -1,6 +1,6 @@
/****************************************************************************
**
-** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies).
+** Copyright (C) 2012 Nokia Corporation and/or its subsidiary(-ies).
** All rights reserved.
** Contact: Nokia Corporation (qt-info@nokia.com)
**
diff --git a/src/gui/text/qfontengine_qpa.cpp b/src/gui/text/qfontengine_qpa.cpp
index c25ed43fdc..3408d3a2a8 100644
--- a/src/gui/text/qfontengine_qpa.cpp
+++ b/src/gui/text/qfontengine_qpa.cpp
@@ -1,6 +1,6 @@
/****************************************************************************
**
-** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies).
+** Copyright (C) 2012 Nokia Corporation and/or its subsidiary(-ies).
** All rights reserved.
** Contact: Nokia Corporation (qt-info@nokia.com)
**
diff --git a/src/gui/text/qfontengine_qpa_p.h b/src/gui/text/qfontengine_qpa_p.h
index a88c1bc3cc..d09692bc57 100644
--- a/src/gui/text/qfontengine_qpa_p.h
+++ b/src/gui/text/qfontengine_qpa_p.h
@@ -1,6 +1,6 @@
/****************************************************************************
**
-** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies).
+** Copyright (C) 2012 Nokia Corporation and/or its subsidiary(-ies).
** All rights reserved.
** Contact: Nokia Corporation (qt-info@nokia.com)
**
diff --git a/src/gui/text/qfontengine_qpf.cpp b/src/gui/text/qfontengine_qpf.cpp
index 8bdaa46524..bedc54f92a 100644
--- a/src/gui/text/qfontengine_qpf.cpp
+++ b/src/gui/text/qfontengine_qpf.cpp
@@ -1,6 +1,6 @@
/****************************************************************************
**
-** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies).
+** Copyright (C) 2012 Nokia Corporation and/or its subsidiary(-ies).
** All rights reserved.
** Contact: Nokia Corporation (qt-info@nokia.com)
**
diff --git a/src/gui/text/qfontengine_qpf_p.h b/src/gui/text/qfontengine_qpf_p.h
index 9473e6b6b7..8a79f65814 100644
--- a/src/gui/text/qfontengine_qpf_p.h
+++ b/src/gui/text/qfontengine_qpf_p.h
@@ -1,6 +1,6 @@
/****************************************************************************
**
-** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies).
+** Copyright (C) 2012 Nokia Corporation and/or its subsidiary(-ies).
** All rights reserved.
** Contact: Nokia Corporation (qt-info@nokia.com)
**
diff --git a/src/gui/text/qfontenginedirectwrite.cpp b/src/gui/text/qfontenginedirectwrite.cpp
index 952e06d151..438d30a913 100644
--- a/src/gui/text/qfontenginedirectwrite.cpp
+++ b/src/gui/text/qfontenginedirectwrite.cpp
@@ -1,6 +1,6 @@
/****************************************************************************
**
-** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies).
+** Copyright (C) 2012 Nokia Corporation and/or its subsidiary(-ies).
** All rights reserved.
** Contact: Nokia Corporation (qt-info@nokia.com)
**
diff --git a/src/gui/text/qfontenginedirectwrite_p.h b/src/gui/text/qfontenginedirectwrite_p.h
index edf1e6a182..26198e64ee 100644
--- a/src/gui/text/qfontenginedirectwrite_p.h
+++ b/src/gui/text/qfontenginedirectwrite_p.h
@@ -1,6 +1,6 @@
/****************************************************************************
**
-** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies).
+** Copyright (C) 2012 Nokia Corporation and/or its subsidiary(-ies).
** All rights reserved.
** Contact: Nokia Corporation (qt-info@nokia.com)
**
diff --git a/src/gui/text/qfontengineglyphcache_p.h b/src/gui/text/qfontengineglyphcache_p.h
index 6b633d615c..855c4a0aa0 100644
--- a/src/gui/text/qfontengineglyphcache_p.h
+++ b/src/gui/text/qfontengineglyphcache_p.h
@@ -1,6 +1,6 @@
/****************************************************************************
**
-** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies).
+** Copyright (C) 2012 Nokia Corporation and/or its subsidiary(-ies).
** All rights reserved.
** Contact: Nokia Corporation (qt-info@nokia.com)
**
diff --git a/src/gui/text/qfontinfo.h b/src/gui/text/qfontinfo.h
index 37a724ec7c..88e1d9f65d 100644
--- a/src/gui/text/qfontinfo.h
+++ b/src/gui/text/qfontinfo.h
@@ -1,6 +1,6 @@
/****************************************************************************
**
-** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies).
+** Copyright (C) 2012 Nokia Corporation and/or its subsidiary(-ies).
** All rights reserved.
** Contact: Nokia Corporation (qt-info@nokia.com)
**
diff --git a/src/gui/text/qfontmetrics.cpp b/src/gui/text/qfontmetrics.cpp
index 1d80e316fd..11e41ad685 100644
--- a/src/gui/text/qfontmetrics.cpp
+++ b/src/gui/text/qfontmetrics.cpp
@@ -1,6 +1,6 @@
/****************************************************************************
**
-** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies).
+** Copyright (C) 2012 Nokia Corporation and/or its subsidiary(-ies).
** All rights reserved.
** Contact: Nokia Corporation (qt-info@nokia.com)
**
diff --git a/src/gui/text/qfontmetrics.h b/src/gui/text/qfontmetrics.h
index 21e211a4a7..f5184aacba 100644
--- a/src/gui/text/qfontmetrics.h
+++ b/src/gui/text/qfontmetrics.h
@@ -1,6 +1,6 @@
/****************************************************************************
**
-** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies).
+** Copyright (C) 2012 Nokia Corporation and/or its subsidiary(-ies).
** All rights reserved.
** Contact: Nokia Corporation (qt-info@nokia.com)
**
diff --git a/src/gui/text/qfontsubset.cpp b/src/gui/text/qfontsubset.cpp
index de945e129b..91d8264f76 100644
--- a/src/gui/text/qfontsubset.cpp
+++ b/src/gui/text/qfontsubset.cpp
@@ -1,6 +1,6 @@
/****************************************************************************
**
-** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies).
+** Copyright (C) 2012 Nokia Corporation and/or its subsidiary(-ies).
** All rights reserved.
** Contact: Nokia Corporation (qt-info@nokia.com)
**
diff --git a/src/gui/text/qfontsubset_p.h b/src/gui/text/qfontsubset_p.h
index a99236f4cc..3dabec5f0b 100644
--- a/src/gui/text/qfontsubset_p.h
+++ b/src/gui/text/qfontsubset_p.h
@@ -1,6 +1,6 @@
/****************************************************************************
**
-** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies).
+** Copyright (C) 2012 Nokia Corporation and/or its subsidiary(-ies).
** All rights reserved.
** Contact: Nokia Corporation (qt-info@nokia.com)
**
diff --git a/src/gui/text/qfragmentmap.cpp b/src/gui/text/qfragmentmap.cpp
index 134293194b..ac923bb639 100644
--- a/src/gui/text/qfragmentmap.cpp
+++ b/src/gui/text/qfragmentmap.cpp
@@ -1,6 +1,6 @@
/****************************************************************************
**
-** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies).
+** Copyright (C) 2012 Nokia Corporation and/or its subsidiary(-ies).
** All rights reserved.
** Contact: Nokia Corporation (qt-info@nokia.com)
**
diff --git a/src/gui/text/qfragmentmap_p.h b/src/gui/text/qfragmentmap_p.h
index d05438ab5b..e6da236552 100644
--- a/src/gui/text/qfragmentmap_p.h
+++ b/src/gui/text/qfragmentmap_p.h
@@ -1,6 +1,6 @@
/****************************************************************************
**
-** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies).
+** Copyright (C) 2012 Nokia Corporation and/or its subsidiary(-ies).
** All rights reserved.
** Contact: Nokia Corporation (qt-info@nokia.com)
**
diff --git a/src/gui/text/qglyphrun.cpp b/src/gui/text/qglyphrun.cpp
index 2e7097f88c..3f9989090a 100644
--- a/src/gui/text/qglyphrun.cpp
+++ b/src/gui/text/qglyphrun.cpp
@@ -1,6 +1,6 @@
/****************************************************************************
**
-** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies).
+** Copyright (C) 2012 Nokia Corporation and/or its subsidiary(-ies).
** All rights reserved.
** Contact: Nokia Corporation (qt-info@nokia.com)
**
diff --git a/src/gui/text/qglyphrun.h b/src/gui/text/qglyphrun.h
index 826156fe11..0c47c6f4bc 100644
--- a/src/gui/text/qglyphrun.h
+++ b/src/gui/text/qglyphrun.h
@@ -1,6 +1,6 @@
/****************************************************************************
**
-** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies).
+** Copyright (C) 2012 Nokia Corporation and/or its subsidiary(-ies).
** All rights reserved.
** Contact: Nokia Corporation (qt-info@nokia.com)
**
diff --git a/src/gui/text/qglyphrun_p.h b/src/gui/text/qglyphrun_p.h
index 863b9d883e..c3b6cf40be 100644
--- a/src/gui/text/qglyphrun_p.h
+++ b/src/gui/text/qglyphrun_p.h
@@ -1,6 +1,6 @@
/****************************************************************************
**
-** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies).
+** Copyright (C) 2012 Nokia Corporation and/or its subsidiary(-ies).
** All rights reserved.
** Contact: Nokia Corporation (qt-info@nokia.com)
**
diff --git a/src/gui/text/qharfbuzz_copy_p.h b/src/gui/text/qharfbuzz_copy_p.h
index 10356e4aea..aa48667e2e 100644
--- a/src/gui/text/qharfbuzz_copy_p.h
+++ b/src/gui/text/qharfbuzz_copy_p.h
@@ -1,5 +1,5 @@
/*
- * Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies)
+ * Copyright (C) 2012 Nokia Corporation and/or its subsidiary(-ies)
* Copyright (C) 2007 Red Hat, Inc.
*
* This code is a modified version of some part of HarfBuzz,
diff --git a/src/gui/text/qlinecontrol.cpp b/src/gui/text/qlinecontrol.cpp
index 62f4515fcc..fc8bcafed4 100644
--- a/src/gui/text/qlinecontrol.cpp
+++ b/src/gui/text/qlinecontrol.cpp
@@ -1,6 +1,6 @@
/****************************************************************************
**
-** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies).
+** Copyright (C) 2012 Nokia Corporation and/or its subsidiary(-ies).
** All rights reserved.
** Contact: Nokia Corporation (qt-info@nokia.com)
**
diff --git a/src/gui/text/qlinecontrol_p.h b/src/gui/text/qlinecontrol_p.h
index 4970a8c05e..fb14df27bb 100644
--- a/src/gui/text/qlinecontrol_p.h
+++ b/src/gui/text/qlinecontrol_p.h
@@ -1,6 +1,6 @@
/****************************************************************************
**
-** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies).
+** Copyright (C) 2012 Nokia Corporation and/or its subsidiary(-ies).
** All rights reserved.
** Contact: Nokia Corporation (qt-info@nokia.com)
**
@@ -277,7 +277,7 @@ public:
Qt::LayoutDirection layoutDirection() const {
if (m_layoutDirection == Qt::LayoutDirectionAuto) {
if (m_text.isEmpty())
- return QGuiApplication::keyboardInputDirection();
+ return qApp->inputPanel()->inputDirection();
return m_text.isRightToLeft() ? Qt::RightToLeft : Qt::LeftToRight;
}
return m_layoutDirection;
diff --git a/src/gui/text/qpfutil.cpp b/src/gui/text/qpfutil.cpp
index 8e69a4b67f..f60b358dbe 100644
--- a/src/gui/text/qpfutil.cpp
+++ b/src/gui/text/qpfutil.cpp
@@ -1,6 +1,6 @@
/****************************************************************************
**
-** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies).
+** Copyright (C) 2012 Nokia Corporation and/or its subsidiary(-ies).
** All rights reserved.
** Contact: Nokia Corporation (qt-info@nokia.com)
**
diff --git a/src/gui/text/qplatformfontdatabase_qpa.cpp b/src/gui/text/qplatformfontdatabase_qpa.cpp
index 8d5a9201d9..fbd9cb09cf 100644
--- a/src/gui/text/qplatformfontdatabase_qpa.cpp
+++ b/src/gui/text/qplatformfontdatabase_qpa.cpp
@@ -1,6 +1,6 @@
/****************************************************************************
**
-** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies).
+** Copyright (C) 2012 Nokia Corporation and/or its subsidiary(-ies).
** All rights reserved.
** Contact: Nokia Corporation (qt-info@nokia.com)
**
@@ -233,6 +233,13 @@ bool QSupportedWritingSystems::supported(QFontDatabase::WritingSystem writingSys
*/
/*!
+ \internal
+ */
+QPlatformFontDatabase::~QPlatformFontDatabase()
+{
+}
+
+/*!
This function is called once at startup by Qt's internal font database.
Reimplement this function in a subclass for a convenient place to initialize
the internal font database.
diff --git a/src/gui/text/qplatformfontdatabase_qpa.h b/src/gui/text/qplatformfontdatabase_qpa.h
index 901d8c2e6e..9ee2bfd76a 100644
--- a/src/gui/text/qplatformfontdatabase_qpa.h
+++ b/src/gui/text/qplatformfontdatabase_qpa.h
@@ -1,6 +1,6 @@
/****************************************************************************
**
-** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies).
+** Copyright (C) 2012 Nokia Corporation and/or its subsidiary(-ies).
** All rights reserved.
** Contact: Nokia Corporation (qt-info@nokia.com)
**
@@ -87,6 +87,7 @@ class QFontRequestPrivate;
class Q_GUI_EXPORT QPlatformFontDatabase
{
public:
+ virtual ~QPlatformFontDatabase();
virtual void populateFontDatabase();
virtual QFontEngine *fontEngine(const QFontDef &fontDef, QUnicodeTables::Script script, void *handle);
virtual QStringList fallbacksForFamily(const QString family, const QFont::Style &style, const QFont::StyleHint &styleHint, const QUnicodeTables::Script &script) const;
diff --git a/src/gui/text/qrawfont.cpp b/src/gui/text/qrawfont.cpp
index 8fccd9b0ca..65d9797374 100644
--- a/src/gui/text/qrawfont.cpp
+++ b/src/gui/text/qrawfont.cpp
@@ -1,6 +1,6 @@
/****************************************************************************
**
-** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies).
+** Copyright (C) 2012 Nokia Corporation and/or its subsidiary(-ies).
** All rights reserved.
** Contact: Nokia Corporation (qt-info@nokia.com)
**
diff --git a/src/gui/text/qrawfont.h b/src/gui/text/qrawfont.h
index b66bc04eab..87f4a75bc7 100644
--- a/src/gui/text/qrawfont.h
+++ b/src/gui/text/qrawfont.h
@@ -1,6 +1,6 @@
/****************************************************************************
**
-** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies).
+** Copyright (C) 2012 Nokia Corporation and/or its subsidiary(-ies).
** All rights reserved.
** Contact: Nokia Corporation (qt-info@nokia.com)
**
diff --git a/src/gui/text/qrawfont_ft.cpp b/src/gui/text/qrawfont_ft.cpp
index c941b98694..f0251b28f6 100644
--- a/src/gui/text/qrawfont_ft.cpp
+++ b/src/gui/text/qrawfont_ft.cpp
@@ -1,6 +1,6 @@
/****************************************************************************
**
-** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies).
+** Copyright (C) 2012 Nokia Corporation and/or its subsidiary(-ies).
** All rights reserved.
** Contact: Nokia Corporation (qt-info@nokia.com)
**
diff --git a/src/gui/text/qrawfont_p.h b/src/gui/text/qrawfont_p.h
index 992cb2f720..b1a71d96ab 100644
--- a/src/gui/text/qrawfont_p.h
+++ b/src/gui/text/qrawfont_p.h
@@ -1,6 +1,6 @@
/****************************************************************************
**
-** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies).
+** Copyright (C) 2012 Nokia Corporation and/or its subsidiary(-ies).
** All rights reserved.
** Contact: Nokia Corporation (qt-info@nokia.com)
**
diff --git a/src/gui/text/qrawfont_qpa.cpp b/src/gui/text/qrawfont_qpa.cpp
index 47815baf06..444efd0a0b 100644
--- a/src/gui/text/qrawfont_qpa.cpp
+++ b/src/gui/text/qrawfont_qpa.cpp
@@ -1,6 +1,6 @@
/****************************************************************************
**
-** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies).
+** Copyright (C) 2012 Nokia Corporation and/or its subsidiary(-ies).
** All rights reserved.
** Contact: Nokia Corporation (qt-info@nokia.com)
**
diff --git a/src/gui/text/qstatictext.cpp b/src/gui/text/qstatictext.cpp
index a52cf25a98..c356aa7e99 100644
--- a/src/gui/text/qstatictext.cpp
+++ b/src/gui/text/qstatictext.cpp
@@ -1,6 +1,6 @@
/****************************************************************************
**
-** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies).
+** Copyright (C) 2012 Nokia Corporation and/or its subsidiary(-ies).
** All rights reserved.
** Contact: Nokia Corporation (qt-info@nokia.com)
**
diff --git a/src/gui/text/qstatictext.h b/src/gui/text/qstatictext.h
index 61a590c798..ad55c6a05d 100644
--- a/src/gui/text/qstatictext.h
+++ b/src/gui/text/qstatictext.h
@@ -1,6 +1,6 @@
/****************************************************************************
**
-** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies).
+** Copyright (C) 2012 Nokia Corporation and/or its subsidiary(-ies).
** All rights reserved.
** Contact: Nokia Corporation (qt-info@nokia.com)
**
diff --git a/src/gui/text/qstatictext_p.h b/src/gui/text/qstatictext_p.h
index 5f9410c31d..2607bcfe8a 100644
--- a/src/gui/text/qstatictext_p.h
+++ b/src/gui/text/qstatictext_p.h
@@ -1,6 +1,6 @@
/****************************************************************************
**
-** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies).
+** Copyright (C) 2012 Nokia Corporation and/or its subsidiary(-ies).
** All rights reserved.
** Contact: Nokia Corporation (qt-info@nokia.com)
**
diff --git a/src/gui/text/qsyntaxhighlighter.cpp b/src/gui/text/qsyntaxhighlighter.cpp
index 5f1a53b556..d9bdeeddfe 100644
--- a/src/gui/text/qsyntaxhighlighter.cpp
+++ b/src/gui/text/qsyntaxhighlighter.cpp
@@ -1,6 +1,6 @@
/****************************************************************************
**
-** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies).
+** Copyright (C) 2012 Nokia Corporation and/or its subsidiary(-ies).
** All rights reserved.
** Contact: Nokia Corporation (qt-info@nokia.com)
**
diff --git a/src/gui/text/qsyntaxhighlighter.h b/src/gui/text/qsyntaxhighlighter.h
index 1c421d1c26..bd64de34bb 100644
--- a/src/gui/text/qsyntaxhighlighter.h
+++ b/src/gui/text/qsyntaxhighlighter.h
@@ -1,6 +1,6 @@
/****************************************************************************
**
-** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies).
+** Copyright (C) 2012 Nokia Corporation and/or its subsidiary(-ies).
** All rights reserved.
** Contact: Nokia Corporation (qt-info@nokia.com)
**
diff --git a/src/gui/text/qtextcontrol.cpp b/src/gui/text/qtextcontrol.cpp
index f74d67cf6d..b21dae5298 100644
--- a/src/gui/text/qtextcontrol.cpp
+++ b/src/gui/text/qtextcontrol.cpp
@@ -1,6 +1,6 @@
/****************************************************************************
**
-** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies).
+** Copyright (C) 2012 Nokia Corporation and/or its subsidiary(-ies).
** All rights reserved.
** Contact: Nokia Corporation (qt-info@nokia.com)
**
diff --git a/src/gui/text/qtextcontrol_p.h b/src/gui/text/qtextcontrol_p.h
index f80c4c81b6..e00ffd4042 100644
--- a/src/gui/text/qtextcontrol_p.h
+++ b/src/gui/text/qtextcontrol_p.h
@@ -1,6 +1,6 @@
/****************************************************************************
**
-** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies).
+** Copyright (C) 2012 Nokia Corporation and/or its subsidiary(-ies).
** All rights reserved.
** Contact: Nokia Corporation (qt-info@nokia.com)
**
diff --git a/src/gui/text/qtextcontrol_p_p.h b/src/gui/text/qtextcontrol_p_p.h
index 9c7ab56395..12dfbafb69 100644
--- a/src/gui/text/qtextcontrol_p_p.h
+++ b/src/gui/text/qtextcontrol_p_p.h
@@ -1,6 +1,6 @@
/****************************************************************************
**
-** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies).
+** Copyright (C) 2012 Nokia Corporation and/or its subsidiary(-ies).
** All rights reserved.
** Contact: Nokia Corporation (qt-info@nokia.com)
**
diff --git a/src/gui/text/qtextcursor.cpp b/src/gui/text/qtextcursor.cpp
index 2bebf4c861..766d9792cd 100644
--- a/src/gui/text/qtextcursor.cpp
+++ b/src/gui/text/qtextcursor.cpp
@@ -1,6 +1,6 @@
/****************************************************************************
**
-** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies).
+** Copyright (C) 2012 Nokia Corporation and/or its subsidiary(-ies).
** All rights reserved.
** Contact: Nokia Corporation (qt-info@nokia.com)
**
@@ -269,25 +269,7 @@ void QTextCursorPrivate::adjustCursor(QTextCursor::MoveOperation m)
QTextTableCell c_position = table->cellAt(position);
QTextTableCell c_anchor = table->cellAt(adjusted_anchor);
if (c_position != c_anchor) {
- bool before;
- int col_position = c_position.column();
- int col_anchor = c_anchor.column();
- if (col_position == col_anchor) {
- before = c_position.row() < c_anchor.row();
- } else {
- before = col_position < col_anchor;
- }
-
- // adjust to cell boundaries
- if (m <= QTextCursor::WordLeft) {
- position = c_position.firstPosition();
- if (!before)
- --position;
- } else {
- position = c_position.lastPosition();
- if (before)
- ++position;
- }
+ position = c_position.firstPosition();
if (position < adjusted_anchor)
adjusted_anchor = c_anchor.lastPosition();
else
@@ -391,6 +373,17 @@ bool QTextCursorPrivate::movePosition(QTextCursor::MoveOperation op, QTextCursor
int newPosition = position;
+ if (mode == QTextCursor::KeepAnchor && complexSelectionTable() != 0) {
+ if ((op >= QTextCursor::EndOfLine && op <= QTextCursor::NextWord)
+ || (op >= QTextCursor::Right && op <= QTextCursor::WordRight)) {
+ QTextTable *t = qobject_cast<QTextTable *>(priv->frameAt(position));
+ Q_ASSERT(t); // as we have already made sure we have a complex selection
+ QTextTableCell cell_pos = t->cellAt(position);
+ if (cell_pos.column() + cell_pos.columnSpan() != t->columns())
+ op = QTextCursor::NextCell;
+ }
+ }
+
if (x == -1 && !priv->isInEditBlock() && (op == QTextCursor::Up || op == QTextCursor::Down))
setX();
@@ -495,6 +488,8 @@ bool QTextCursorPrivate::movePosition(QTextCursor::MoveOperation op, QTextCursor
break;
}
newPosition = blockIt.position() + line.textStart() + line.textLength();
+ if (newPosition >= priv->length())
+ newPosition = priv->length() - 1;
if (line.lineNumber() < layout->lineCount() - 1) {
const QString text = blockIt.text();
// ###### this relies on spaces being the cause for linebreaks.
diff --git a/src/gui/text/qtextcursor.h b/src/gui/text/qtextcursor.h
index bc4cdb5fb6..32ded45137 100644
--- a/src/gui/text/qtextcursor.h
+++ b/src/gui/text/qtextcursor.h
@@ -1,6 +1,6 @@
/****************************************************************************
**
-** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies).
+** Copyright (C) 2012 Nokia Corporation and/or its subsidiary(-ies).
** All rights reserved.
** Contact: Nokia Corporation (qt-info@nokia.com)
**
diff --git a/src/gui/text/qtextcursor_p.h b/src/gui/text/qtextcursor_p.h
index c612169acf..d64498a7ac 100644
--- a/src/gui/text/qtextcursor_p.h
+++ b/src/gui/text/qtextcursor_p.h
@@ -1,6 +1,6 @@
/****************************************************************************
**
-** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies).
+** Copyright (C) 2012 Nokia Corporation and/or its subsidiary(-ies).
** All rights reserved.
** Contact: Nokia Corporation (qt-info@nokia.com)
**
diff --git a/src/gui/text/qtextdocument.cpp b/src/gui/text/qtextdocument.cpp
index 8d9a8c405a..3038504591 100644
--- a/src/gui/text/qtextdocument.cpp
+++ b/src/gui/text/qtextdocument.cpp
@@ -1,6 +1,6 @@
/****************************************************************************
**
-** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies).
+** Copyright (C) 2012 Nokia Corporation and/or its subsidiary(-ies).
** All rights reserved.
** Contact: Nokia Corporation (qt-info@nokia.com)
**
@@ -1925,8 +1925,12 @@ QVariant QTextDocument::loadResource(int type, const QUrl &name)
#endif
// handle data: URLs
- if (r.isNull() && name.scheme().compare(QLatin1String("data"), Qt::CaseInsensitive) == 0)
- r = qDecodeDataUrl(name).second;
+ if (r.isNull() && name.scheme().compare(QLatin1String("data"), Qt::CaseInsensitive) == 0) {
+ QString mimetype;
+ QByteArray payload;
+ if (qDecodeDataUrl(name, mimetype, payload))
+ r = payload;
+ }
// if resource was not loaded try to load it here
if (!doc && r.isNull() && name.isRelative()) {
diff --git a/src/gui/text/qtextdocument.h b/src/gui/text/qtextdocument.h
index 9d9af2b5bb..b7c77c2c54 100644
--- a/src/gui/text/qtextdocument.h
+++ b/src/gui/text/qtextdocument.h
@@ -1,6 +1,6 @@
/****************************************************************************
**
-** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies).
+** Copyright (C) 2012 Nokia Corporation and/or its subsidiary(-ies).
** All rights reserved.
** Contact: Nokia Corporation (qt-info@nokia.com)
**
diff --git a/src/gui/text/qtextdocument_p.cpp b/src/gui/text/qtextdocument_p.cpp
index 901375d8c8..9e410b40af 100644
--- a/src/gui/text/qtextdocument_p.cpp
+++ b/src/gui/text/qtextdocument_p.cpp
@@ -1,6 +1,6 @@
/****************************************************************************
**
-** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies).
+** Copyright (C) 2012 Nokia Corporation and/or its subsidiary(-ies).
** All rights reserved.
** Contact: Nokia Corporation (qt-info@nokia.com)
**
diff --git a/src/gui/text/qtextdocument_p.h b/src/gui/text/qtextdocument_p.h
index fbf91bfc0e..07a5230ec5 100644
--- a/src/gui/text/qtextdocument_p.h
+++ b/src/gui/text/qtextdocument_p.h
@@ -1,6 +1,6 @@
/****************************************************************************
**
-** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies).
+** Copyright (C) 2012 Nokia Corporation and/or its subsidiary(-ies).
** All rights reserved.
** Contact: Nokia Corporation (qt-info@nokia.com)
**
diff --git a/src/gui/text/qtextdocumentfragment.cpp b/src/gui/text/qtextdocumentfragment.cpp
index 0c8860e98e..a42a4ce39a 100644
--- a/src/gui/text/qtextdocumentfragment.cpp
+++ b/src/gui/text/qtextdocumentfragment.cpp
@@ -1,6 +1,6 @@
/****************************************************************************
**
-** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies).
+** Copyright (C) 2012 Nokia Corporation and/or its subsidiary(-ies).
** All rights reserved.
** Contact: Nokia Corporation (qt-info@nokia.com)
**
@@ -372,18 +372,8 @@ QString QTextDocumentFragment::toPlainText() const
return d->doc->toPlainText();
}
-// #### Qt 5: merge with other overload
-/*!
- \overload
-*/
-
#ifndef QT_NO_TEXTHTMLPARSER
-QString QTextDocumentFragment::toHtml() const
-{
- return toHtml(QByteArray());
-}
-
/*!
\since 4.2
diff --git a/src/gui/text/qtextdocumentfragment.h b/src/gui/text/qtextdocumentfragment.h
index 151a1a1ba5..cc7dd293f2 100644
--- a/src/gui/text/qtextdocumentfragment.h
+++ b/src/gui/text/qtextdocumentfragment.h
@@ -1,6 +1,6 @@
/****************************************************************************
**
-** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies).
+** Copyright (C) 2012 Nokia Corporation and/or its subsidiary(-ies).
** All rights reserved.
** Contact: Nokia Corporation (qt-info@nokia.com)
**
@@ -69,8 +69,7 @@ public:
QString toPlainText() const;
#ifndef QT_NO_TEXTHTMLPARSER
- QString toHtml() const;
- QString toHtml(const QByteArray &encoding) const;
+ QString toHtml(const QByteArray &encoding = QByteArray()) const;
#endif // QT_NO_TEXTHTMLPARSER
static QTextDocumentFragment fromPlainText(const QString &plainText);
diff --git a/src/gui/text/qtextdocumentfragment_p.h b/src/gui/text/qtextdocumentfragment_p.h
index 227123ed80..44276d3629 100644
--- a/src/gui/text/qtextdocumentfragment_p.h
+++ b/src/gui/text/qtextdocumentfragment_p.h
@@ -1,6 +1,6 @@
/****************************************************************************
**
-** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies).
+** Copyright (C) 2012 Nokia Corporation and/or its subsidiary(-ies).
** All rights reserved.
** Contact: Nokia Corporation (qt-info@nokia.com)
**
diff --git a/src/gui/text/qtextdocumentlayout.cpp b/src/gui/text/qtextdocumentlayout.cpp
index 5138aa3e70..80975f928b 100644
--- a/src/gui/text/qtextdocumentlayout.cpp
+++ b/src/gui/text/qtextdocumentlayout.cpp
@@ -1,6 +1,6 @@
/****************************************************************************
**
-** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies).
+** Copyright (C) 2012 Nokia Corporation and/or its subsidiary(-ies).
** All rights reserved.
** Contact: Nokia Corporation (qt-info@nokia.com)
**
diff --git a/src/gui/text/qtextdocumentlayout_p.h b/src/gui/text/qtextdocumentlayout_p.h
index bef4c844f6..e5f8cc19a8 100644
--- a/src/gui/text/qtextdocumentlayout_p.h
+++ b/src/gui/text/qtextdocumentlayout_p.h
@@ -1,6 +1,6 @@
/****************************************************************************
**
-** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies).
+** Copyright (C) 2012 Nokia Corporation and/or its subsidiary(-ies).
** All rights reserved.
** Contact: Nokia Corporation (qt-info@nokia.com)
**
diff --git a/src/gui/text/qtextdocumentwriter.cpp b/src/gui/text/qtextdocumentwriter.cpp
index 11bf3fcb08..a371471b76 100644
--- a/src/gui/text/qtextdocumentwriter.cpp
+++ b/src/gui/text/qtextdocumentwriter.cpp
@@ -1,6 +1,6 @@
/****************************************************************************
**
-** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies).
+** Copyright (C) 2012 Nokia Corporation and/or its subsidiary(-ies).
** All rights reserved.
** Contact: Nokia Corporation (qt-info@nokia.com)
**
diff --git a/src/gui/text/qtextdocumentwriter.h b/src/gui/text/qtextdocumentwriter.h
index 0b3f11042b..7dc903c412 100644
--- a/src/gui/text/qtextdocumentwriter.h
+++ b/src/gui/text/qtextdocumentwriter.h
@@ -1,6 +1,6 @@
/****************************************************************************
**
-** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies).
+** Copyright (C) 2012 Nokia Corporation and/or its subsidiary(-ies).
** All rights reserved.
** Contact: Nokia Corporation (qt-info@nokia.com)
**
diff --git a/src/gui/text/qtextengine.cpp b/src/gui/text/qtextengine.cpp
index d223b2ec37..0dd8d0bef3 100644
--- a/src/gui/text/qtextengine.cpp
+++ b/src/gui/text/qtextengine.cpp
@@ -1,6 +1,6 @@
/****************************************************************************
**
-** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies).
+** Copyright (C) 2012 Nokia Corporation and/or its subsidiary(-ies).
** All rights reserved.
** Contact: Nokia Corporation (qt-info@nokia.com)
**
@@ -54,6 +54,7 @@
#include <private/qunicodetables_p.h>
#include "qtextdocument_p.h"
#include <qguiapplication.h>
+#include <qinputpanel.h>
#include <stdlib.h>
@@ -1408,7 +1409,7 @@ bool QTextEngine::isRightToLeft() const
itemize();
// this places the cursor in the right position depending on the keyboard layout
if (layoutData->string.isEmpty())
- return QGuiApplication::keyboardInputDirection() == Qt::RightToLeft;
+ return qApp ? qApp->inputPanel()->inputDirection() == Qt::RightToLeft : false;
return layoutData->string.isRightToLeft();
}
@@ -2692,7 +2693,7 @@ int QTextEngine::positionInLigature(const QScriptItem *si, int end,
closestItem--;
int pos = si->position + clusterStart + closestItem;
// Jump to the next charStop
- while (!attrs[pos].charStop && pos < end)
+ while (pos < end && !attrs[pos].charStop)
pos++;
return pos;
}
diff --git a/src/gui/text/qtextengine_p.h b/src/gui/text/qtextengine_p.h
index d821fa50cb..368ad3763d 100644
--- a/src/gui/text/qtextengine_p.h
+++ b/src/gui/text/qtextengine_p.h
@@ -1,6 +1,6 @@
/****************************************************************************
**
-** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies).
+** Copyright (C) 2012 Nokia Corporation and/or its subsidiary(-ies).
** All rights reserved.
** Contact: Nokia Corporation (qt-info@nokia.com)
**
diff --git a/src/gui/text/qtextformat.cpp b/src/gui/text/qtextformat.cpp
index 833414f79f..9ce45fdaf3 100644
--- a/src/gui/text/qtextformat.cpp
+++ b/src/gui/text/qtextformat.cpp
@@ -1,6 +1,6 @@
/****************************************************************************
**
-** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies).
+** Copyright (C) 2012 Nokia Corporation and/or its subsidiary(-ies).
** All rights reserved.
** Contact: Nokia Corporation (qt-info@nokia.com)
**
@@ -394,6 +394,9 @@ void QTextFormatPrivate::recalcFont() const
case QTextFormat::FontStrikeOut:
f.setStrikeOut(props.at(i).value.toBool());
break;
+ case QTextFormat::FontAbsoluteLetterSpacing:
+ f.setLetterSpacing(QFont::AbsoluteSpacing, props.at(i).value.toReal());
+ break;
case QTextFormat::FontLetterSpacing:
f.setLetterSpacing(QFont::PercentageSpacing, props.at(i).value.toReal());
break;
@@ -408,6 +411,9 @@ void QTextFormatPrivate::recalcFont() const
if (f.fixedPitch() != value)
f.setFixedPitch(value);
break; }
+ case QTextFormat::FontStretch:
+ f.setStretch(props.at(i).value.toInt());
+ break;
case QTextFormat::FontStyleHint:
f.setStyleHint(static_cast<QFont::StyleHint>(props.at(i).value.toInt()), f.styleStrategy());
break;
@@ -564,10 +570,12 @@ Q_GUI_EXPORT QDataStream &operator>>(QDataStream &stream, QTextFormat &fmt)
\value FontOverline
\value FontStrikeOut
\value FontCapitalization Specifies the capitalization type that is to be applied to the text.
+ \value FontAbsoluteLetterSpacing If true FontLetterSpacing is absolute
\value FontLetterSpacing Changes the default spacing between individual letters in the font. The value is
specified in percentage, with 100 as the default value.
\value FontWordSpacing Changes the default spacing between individual words. A positive value increases the word spacing
by the corresponding pixels; a negative value decreases the spacing.
+ \value FontStretch Corresponds to the QFont::Stretch property
\value FontStyleHint Corresponds to the QFont::StyleHint property
\value FontStyleStrategy Corresponds to the QFont::StyleStrategy property
\value FontKerning Specifies whether the font has kerning turned on.
@@ -1853,8 +1861,12 @@ void QTextCharFormat::setFont(const QFont &font)
setFontFixedPitch(font.fixedPitch());
setFontCapitalization(font.capitalization());
setFontWordSpacing(font.wordSpacing());
- if (font.letterSpacingType() == QFont::PercentageSpacing)
+ if (font.letterSpacingType() == QFont::AbsoluteSpacing) {
+ setFontAbsoluteLetterSpacing(font.letterSpacing());
+ } else {
setFontLetterSpacing(font.letterSpacing());
+ }
+ setFontStretch(font.stretch());
setFontStyleHint(font.styleHint());
setFontStyleStrategy(font.styleStrategy());
setFontKerning(font.kerning());
@@ -3045,14 +3057,37 @@ QTextImageFormat::QTextImageFormat(const QTextFormat &fmt)
*/
/*!
+ \fn void QTextCharFormat::setFontAbsoluteLetterSpacing(bool absolute)
+ \since 5.0
+
+ Sets the letter spacing type of this format to absolute.
+ \sa fontAbsoluteLetterSpacing()
+ \sa setFontLetterSpacing()
+ \sa fontLetterSpacing()
+*/
+
+/*!
+ \fn bool QTextCharFormat::fontAbsoluteLetterSpacing() const
+ \since 5.0
+
+ Returns if the current letter spacing is absolute (or percentage).
+ \sa setFontAbsoluteLetterSpacing()
+ \sa setFontLetterSpacing()
+ \sa fontLetterSpacing()
+*/
+
+/*!
\fn void QTextCharFormat::setFontLetterSpacing(qreal spacing)
\since 4.4
- Sets the letter spacing of this format to the given \a spacing, in percent.
- A value of 100 indicates default spacing; a value of 200 doubles the amount
+ Sets the letter spacing of this format to the given \a spacing.
+ Depending on fontAbsoluteLetterSpacing the value is given in absolutes or in percent.
+ For percent a value of 100 indicates default spacing; a value of 200 doubles the amount
of space a letter takes.
\sa fontLetterSpacing()
+ \sa setFontAbsoluteLetterSpacing()
+ \sa fontAbsoluteLetterSpacing()
*/
/*!
@@ -3079,6 +3114,28 @@ QTextImageFormat::QTextImageFormat(const QTextFormat &fmt)
*/
/*!
+ \fn void QTextCharFormat::setFontStretch(int factor)
+ \since 5.0
+
+ Sets the stretch factor for the font.
+
+ The stretch factor changes the width of all characters in the font by factor percent. For example, setting factor to 150 results in all characters in the font being 1.5 times (ie. 150%) wider. The default stretch factor is 100. The minimum stretch factor is 1, and the maximum stretch factor is 4000.
+
+ The stretch factor is only applied to outline fonts. The stretch factor is ignored for bitmap fonts.
+
+ NOTE: QFont cannot stretch XLFD fonts. When loading XLFD fonts on X11, the stretch factor is matched against a predefined set of values for the SETWIDTH_NAME field of the XLFD.
+ \sa fontStretch()
+*/
+
+/*!
+ \fn int QTextCharFormat::fontStretch() const
+ \since 5.0
+
+ Returns the current font stretching.
+ \sa setFontStretch()
+*/
+
+/*!
\fn qreal QTextTableCellFormat::topPadding() const
\since 4.4
@@ -3321,4 +3378,19 @@ void QTextFormatCollection::setDefaultFont(const QFont &f)
formats[i].d->resolveFont(defaultFnt);
}
+#ifndef QT_NO_DEBUG_STREAM
+QDebug operator<<(QDebug dbg, const QTextLength &l)
+{
+ dbg.nospace() << "QTextLength(QTextLength::Type(" << l.type() << "))";
+ return dbg.space();
+}
+
+QDebug operator<<(QDebug dbg, const QTextFormat &f)
+{
+ dbg.nospace() << "QTextFormat(QTextFormat::FormatType(" << f.type() << "))";
+ return dbg.space();
+}
+
+#endif
+
QT_END_NAMESPACE
diff --git a/src/gui/text/qtextformat.h b/src/gui/text/qtextformat.h
index a7bc15eb74..5c9d6fe20e 100644
--- a/src/gui/text/qtextformat.h
+++ b/src/gui/text/qtextformat.h
@@ -1,6 +1,6 @@
/****************************************************************************
**
-** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies).
+** Copyright (C) 2012 Nokia Corporation and/or its subsidiary(-ies).
** All rights reserved.
** Contact: Nokia Corporation (qt-info@nokia.com)
**
@@ -81,6 +81,10 @@ Q_GUI_EXPORT QDataStream &operator<<(QDataStream &, const QTextLength &);
Q_GUI_EXPORT QDataStream &operator>>(QDataStream &, QTextLength &);
#endif
+#ifndef QT_NO_DEBUG_STREAM
+Q_GUI_EXPORT QDebug operator<<(QDebug, const QTextLength &);
+#endif
+
class Q_GUI_EXPORT QTextLength
{
public:
@@ -126,6 +130,10 @@ Q_GUI_EXPORT QDataStream &operator<<(QDataStream &, const QTextFormat &);
Q_GUI_EXPORT QDataStream &operator>>(QDataStream &, QTextFormat &);
#endif
+#ifndef QT_NO_DEBUG_STREAM
+Q_GUI_EXPORT QDebug operator<<(QDebug, const QTextFormat &);
+#endif
+
class Q_GUI_EXPORT QTextFormat
{
Q_GADGET
@@ -172,8 +180,10 @@ public:
// character properties
FirstFontProperty = 0x1FE0,
FontCapitalization = FirstFontProperty,
+ FontAbsoluteLetterSpacing = 0x2033, // if true FontLetterSpacing is absolute
FontLetterSpacing = 0x1FE1,
FontWordSpacing = 0x1FE2,
+ FontStretch = 0x2034,
FontStyleHint = 0x1FE3,
FontStyleStrategy = 0x1FE4,
FontKerning = 0x1FE5,
@@ -420,8 +430,14 @@ public:
{ setProperty(FontCapitalization, capitalization); }
inline QFont::Capitalization fontCapitalization() const
{ return static_cast<QFont::Capitalization>(intProperty(FontCapitalization)); }
+ inline void setFontAbsoluteLetterSpacing(qreal absoluteSpacing)
+ { setProperty(FontAbsoluteLetterSpacing, absoluteSpacing);
+ clearProperty(FontLetterSpacing); }
+ inline qreal fontAbsoluteLetterSpacing() const
+ { return doubleProperty(FontAbsoluteLetterSpacing); }
inline void setFontLetterSpacing(qreal spacing)
- { setProperty(FontLetterSpacing, spacing); }
+ { setProperty(FontLetterSpacing, spacing);
+ clearProperty(FontAbsoluteLetterSpacing); }
inline qreal fontLetterSpacing() const
{ return doubleProperty(FontLetterSpacing); }
inline void setFontWordSpacing(qreal spacing)
@@ -453,6 +469,11 @@ public:
inline bool fontFixedPitch() const
{ return boolProperty(FontFixedPitch); }
+ inline void setFontStretch(qreal factor)
+ { setProperty(FontStretch, factor); }
+ inline int fontStretch() const
+ { return intProperty(FontStretch); }
+
inline void setFontStyleHint(QFont::StyleHint hint, QFont::StyleStrategy strategy = QFont::PreferDefault)
{ setProperty(FontStyleHint, hint); setProperty(FontStyleStrategy, strategy); }
inline void setFontStyleStrategy(QFont::StyleStrategy strategy)
diff --git a/src/gui/text/qtextformat_p.h b/src/gui/text/qtextformat_p.h
index d7d082c39b..61e3e1f253 100644
--- a/src/gui/text/qtextformat_p.h
+++ b/src/gui/text/qtextformat_p.h
@@ -1,6 +1,6 @@
/****************************************************************************
**
-** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies).
+** Copyright (C) 2012 Nokia Corporation and/or its subsidiary(-ies).
** All rights reserved.
** Contact: Nokia Corporation (qt-info@nokia.com)
**
diff --git a/src/gui/text/qtexthtmlparser.cpp b/src/gui/text/qtexthtmlparser.cpp
index ced71f5c60..4ee282c46e 100644
--- a/src/gui/text/qtexthtmlparser.cpp
+++ b/src/gui/text/qtexthtmlparser.cpp
@@ -1,6 +1,6 @@
/****************************************************************************
**
-** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies).
+** Copyright (C) 2012 Nokia Corporation and/or its subsidiary(-ies).
** All rights reserved.
** Contact: Nokia Corporation (qt-info@nokia.com)
**
diff --git a/src/gui/text/qtexthtmlparser_p.h b/src/gui/text/qtexthtmlparser_p.h
index 9019942304..f1a90ee0a3 100644
--- a/src/gui/text/qtexthtmlparser_p.h
+++ b/src/gui/text/qtexthtmlparser_p.h
@@ -1,6 +1,6 @@
/****************************************************************************
**
-** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies).
+** Copyright (C) 2012 Nokia Corporation and/or its subsidiary(-ies).
** All rights reserved.
** Contact: Nokia Corporation (qt-info@nokia.com)
**
diff --git a/src/gui/text/qtextimagehandler.cpp b/src/gui/text/qtextimagehandler.cpp
index 138fb1a168..c7cf2df903 100644
--- a/src/gui/text/qtextimagehandler.cpp
+++ b/src/gui/text/qtextimagehandler.cpp
@@ -1,6 +1,6 @@
/****************************************************************************
**
-** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies).
+** Copyright (C) 2012 Nokia Corporation and/or its subsidiary(-ies).
** All rights reserved.
** Contact: Nokia Corporation (qt-info@nokia.com)
**
@@ -52,9 +52,6 @@
QT_BEGIN_NAMESPACE
-// set by the mime source factory in Qt3Compat
-QTextImageHandler::ExternalImageLoaderFunction QTextImageHandler::externalLoader = 0;
-
static QPixmap getPixmap(QTextDocument *doc, const QTextImageFormat &format)
{
QPixmap pm;
@@ -79,9 +76,6 @@ static QPixmap getPixmap(QTextDocument *doc, const QTextImageFormat &format)
context = browser->source().toString();
#endif
QImage img;
- if (QTextImageHandler::externalLoader)
- img = QTextImageHandler::externalLoader(name, context);
-
if (img.isNull()) { // try direct loading
name = format.name(); // remove qrc:/ prefix again
if (name.isEmpty() || !img.load(name))
@@ -157,9 +151,6 @@ static QImage getImage(QTextDocument *doc, const QTextImageFormat &format)
if (browser)
context = browser->source().toString();
#endif
- if (QTextImageHandler::externalLoader)
- image = QTextImageHandler::externalLoader(name, context);
-
if (image.isNull()) { // try direct loading
name = format.name(); // remove qrc:/ prefix again
if (name.isEmpty() || !image.load(name))
diff --git a/src/gui/text/qtextimagehandler_p.h b/src/gui/text/qtextimagehandler_p.h
index 8a14a46d5f..ce1d481eba 100644
--- a/src/gui/text/qtextimagehandler_p.h
+++ b/src/gui/text/qtextimagehandler_p.h
@@ -1,6 +1,6 @@
/****************************************************************************
**
-** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies).
+** Copyright (C) 2012 Nokia Corporation and/or its subsidiary(-ies).
** All rights reserved.
** Contact: Nokia Corporation (qt-info@nokia.com)
**
@@ -71,9 +71,6 @@ public:
virtual QSizeF intrinsicSize(QTextDocument *doc, int posInDocument, const QTextFormat &format);
virtual void drawObject(QPainter *p, const QRectF &rect, QTextDocument *doc, int posInDocument, const QTextFormat &format);
QImage image(QTextDocument *doc, const QTextImageFormat &imageFormat);
-
- typedef QImage (*ExternalImageLoaderFunction)(const QString &name, const QString &context);
- static ExternalImageLoaderFunction externalLoader; //this is needed by Qt3Support
};
QT_END_NAMESPACE
diff --git a/src/gui/text/qtextlayout.cpp b/src/gui/text/qtextlayout.cpp
index f2622a7b20..1e8cb9e478 100644
--- a/src/gui/text/qtextlayout.cpp
+++ b/src/gui/text/qtextlayout.cpp
@@ -1,6 +1,6 @@
/****************************************************************************
**
-** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies).
+** Copyright (C) 2012 Nokia Corporation and/or its subsidiary(-ies).
** All rights reserved.
** Contact: Nokia Corporation (qt-info@nokia.com)
**
@@ -836,7 +836,7 @@ int QTextLayout::lineCount() const
*/
QTextLine QTextLayout::lineAt(int i) const
{
- return QTextLine(i, d);
+ return i < lineCount() ? QTextLine(i, d) : QTextLine();
}
/*!
@@ -2264,11 +2264,12 @@ QList<QGlyphRun> QTextLine::glyphRuns(int from, int length) const
QFontEngine *mainFontEngine = font.d->engineForScript(si.analysis.script);
if (mainFontEngine->type() == QFontEngine::Multi) {
QFontEngineMulti *multiFontEngine = static_cast<QFontEngineMulti *>(mainFontEngine);
- int start = 0;
- int end;
- int which = glyphLayout.glyphs[0] >> 24;
- for (end = 0; end < glyphLayout.numGlyphs; ++end) {
- const int e = glyphLayout.glyphs[end] >> 24;
+ int end = rtl ? glyphLayout.numGlyphs : 0;
+ int start = rtl ? end : 0;
+ int which = glyphLayout.glyphs[rtl ? start - 1 : end] >> 24;
+ for (; (rtl && start > 0) || (!rtl && end < glyphLayout.numGlyphs);
+ rtl ? --start : ++end) {
+ const int e = glyphLayout.glyphs[rtl ? start - 1 : end] >> 24;
if (e == which)
continue;
@@ -2286,7 +2287,10 @@ QList<QGlyphRun> QTextLine::glyphRuns(int from, int length) const
subLayout.advances_y[i].toReal());
}
- start = end;
+ if (rtl)
+ end = start;
+ else
+ start = end;
which = e;
}
diff --git a/src/gui/text/qtextlayout.h b/src/gui/text/qtextlayout.h
index f1bfdc75db..e698625d9b 100644
--- a/src/gui/text/qtextlayout.h
+++ b/src/gui/text/qtextlayout.h
@@ -1,6 +1,6 @@
/****************************************************************************
**
-** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies).
+** Copyright (C) 2012 Nokia Corporation and/or its subsidiary(-ies).
** All rights reserved.
** Contact: Nokia Corporation (qt-info@nokia.com)
**
diff --git a/src/gui/text/qtextlist.cpp b/src/gui/text/qtextlist.cpp
index 92e509d8d9..97ad9dc82b 100644
--- a/src/gui/text/qtextlist.cpp
+++ b/src/gui/text/qtextlist.cpp
@@ -1,6 +1,6 @@
/****************************************************************************
**
-** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies).
+** Copyright (C) 2012 Nokia Corporation and/or its subsidiary(-ies).
** All rights reserved.
** Contact: Nokia Corporation (qt-info@nokia.com)
**
diff --git a/src/gui/text/qtextlist.h b/src/gui/text/qtextlist.h
index 83d10834c7..5a470f4582 100644
--- a/src/gui/text/qtextlist.h
+++ b/src/gui/text/qtextlist.h
@@ -1,6 +1,6 @@
/****************************************************************************
**
-** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies).
+** Copyright (C) 2012 Nokia Corporation and/or its subsidiary(-ies).
** All rights reserved.
** Contact: Nokia Corporation (qt-info@nokia.com)
**
diff --git a/src/gui/text/qtextobject.cpp b/src/gui/text/qtextobject.cpp
index d641266367..e49b0d3ad8 100644
--- a/src/gui/text/qtextobject.cpp
+++ b/src/gui/text/qtextobject.cpp
@@ -1,6 +1,6 @@
/****************************************************************************
**
-** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies).
+** Copyright (C) 2012 Nokia Corporation and/or its subsidiary(-ies).
** All rights reserved.
** Contact: Nokia Corporation (qt-info@nokia.com)
**
diff --git a/src/gui/text/qtextobject.h b/src/gui/text/qtextobject.h
index c2b46e4d12..f56a38b366 100644
--- a/src/gui/text/qtextobject.h
+++ b/src/gui/text/qtextobject.h
@@ -1,6 +1,6 @@
/****************************************************************************
**
-** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies).
+** Copyright (C) 2012 Nokia Corporation and/or its subsidiary(-ies).
** All rights reserved.
** Contact: Nokia Corporation (qt-info@nokia.com)
**
diff --git a/src/gui/text/qtextobject_p.h b/src/gui/text/qtextobject_p.h
index 798b9d1340..0ca2f87f0d 100644
--- a/src/gui/text/qtextobject_p.h
+++ b/src/gui/text/qtextobject_p.h
@@ -1,6 +1,6 @@
/****************************************************************************
**
-** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies).
+** Copyright (C) 2012 Nokia Corporation and/or its subsidiary(-ies).
** All rights reserved.
** Contact: Nokia Corporation (qt-info@nokia.com)
**
diff --git a/src/gui/text/qtextodfwriter.cpp b/src/gui/text/qtextodfwriter.cpp
index 8776b926c5..0fe2efdd5f 100644
--- a/src/gui/text/qtextodfwriter.cpp
+++ b/src/gui/text/qtextodfwriter.cpp
@@ -1,6 +1,6 @@
/****************************************************************************
**
-** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies).
+** Copyright (C) 2012 Nokia Corporation and/or its subsidiary(-ies).
** All rights reserved.
** Contact: Nokia Corporation (qt-info@nokia.com)
**
@@ -376,9 +376,6 @@ void QTextOdfWriter::writeInlineCharacter(QXmlStreamWriter &writer, const QTextF
if (image.isNull()) {
QString context;
- if (QTextImageHandler::externalLoader)
- image = QTextImageHandler::externalLoader(name, context);
-
if (image.isNull()) { // try direct loading
name = imageFormat.name(); // remove qrc:/ prefix again
image.load(name);
diff --git a/src/gui/text/qtextodfwriter_p.h b/src/gui/text/qtextodfwriter_p.h
index 377c7fdeea..5108175291 100644
--- a/src/gui/text/qtextodfwriter_p.h
+++ b/src/gui/text/qtextodfwriter_p.h
@@ -1,6 +1,6 @@
/****************************************************************************
**
-** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies).
+** Copyright (C) 2012 Nokia Corporation and/or its subsidiary(-ies).
** All rights reserved.
** Contact: Nokia Corporation (qt-info@nokia.com)
**
diff --git a/src/gui/text/qtextoption.cpp b/src/gui/text/qtextoption.cpp
index fe58583d04..2fe6284592 100644
--- a/src/gui/text/qtextoption.cpp
+++ b/src/gui/text/qtextoption.cpp
@@ -1,6 +1,6 @@
/****************************************************************************
**
-** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies).
+** Copyright (C) 2012 Nokia Corporation and/or its subsidiary(-ies).
** All rights reserved.
** Contact: Nokia Corporation (qt-info@nokia.com)
**
diff --git a/src/gui/text/qtextoption.h b/src/gui/text/qtextoption.h
index 3c04c76933..8b7b006921 100644
--- a/src/gui/text/qtextoption.h
+++ b/src/gui/text/qtextoption.h
@@ -1,6 +1,6 @@
/****************************************************************************
**
-** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies).
+** Copyright (C) 2012 Nokia Corporation and/or its subsidiary(-ies).
** All rights reserved.
** Contact: Nokia Corporation (qt-info@nokia.com)
**
diff --git a/src/gui/text/qtexttable.cpp b/src/gui/text/qtexttable.cpp
index 6935ffc6f4..64b28811e5 100644
--- a/src/gui/text/qtexttable.cpp
+++ b/src/gui/text/qtexttable.cpp
@@ -1,6 +1,6 @@
/****************************************************************************
**
-** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies).
+** Copyright (C) 2012 Nokia Corporation and/or its subsidiary(-ies).
** All rights reserved.
** Contact: Nokia Corporation (qt-info@nokia.com)
**
diff --git a/src/gui/text/qtexttable.h b/src/gui/text/qtexttable.h
index b275a5783a..e5ea7609dd 100644
--- a/src/gui/text/qtexttable.h
+++ b/src/gui/text/qtexttable.h
@@ -1,6 +1,6 @@
/****************************************************************************
**
-** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies).
+** Copyright (C) 2012 Nokia Corporation and/or its subsidiary(-ies).
** All rights reserved.
** Contact: Nokia Corporation (qt-info@nokia.com)
**
diff --git a/src/gui/text/qtexttable_p.h b/src/gui/text/qtexttable_p.h
index cd16f50a62..237a1a883c 100644
--- a/src/gui/text/qtexttable_p.h
+++ b/src/gui/text/qtexttable_p.h
@@ -1,6 +1,6 @@
/****************************************************************************
**
-** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies).
+** Copyright (C) 2012 Nokia Corporation and/or its subsidiary(-ies).
** All rights reserved.
** Contact: Nokia Corporation (qt-info@nokia.com)
**
diff --git a/src/gui/text/qzip.cpp b/src/gui/text/qzip.cpp
index 0ffcade591..b82e679d8b 100644
--- a/src/gui/text/qzip.cpp
+++ b/src/gui/text/qzip.cpp
@@ -1,6 +1,6 @@
/****************************************************************************
**
-** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies).
+** Copyright (C) 2012 Nokia Corporation and/or its subsidiary(-ies).
** All rights reserved.
** Contact: Nokia Corporation (qt-info@nokia.com)
**
diff --git a/src/gui/text/qzipreader_p.h b/src/gui/text/qzipreader_p.h
index b1df316cab..a569b584cf 100644
--- a/src/gui/text/qzipreader_p.h
+++ b/src/gui/text/qzipreader_p.h
@@ -1,6 +1,6 @@
/****************************************************************************
**
-** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies).
+** Copyright (C) 2012 Nokia Corporation and/or its subsidiary(-ies).
** All rights reserved.
** Contact: Nokia Corporation (qt-info@nokia.com)
**
diff --git a/src/gui/text/qzipwriter_p.h b/src/gui/text/qzipwriter_p.h
index 1ba93b88d7..0860c004f9 100644
--- a/src/gui/text/qzipwriter_p.h
+++ b/src/gui/text/qzipwriter_p.h
@@ -1,6 +1,6 @@
/****************************************************************************
**
-** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies).
+** Copyright (C) 2012 Nokia Corporation and/or its subsidiary(-ies).
** All rights reserved.
** Contact: Nokia Corporation (qt-info@nokia.com)
**
diff --git a/src/gui/util/qdesktopservices.cpp b/src/gui/util/qdesktopservices.cpp
index 4fbf0a59f3..0bb233c82f 100644
--- a/src/gui/util/qdesktopservices.cpp
+++ b/src/gui/util/qdesktopservices.cpp
@@ -1,6 +1,6 @@
/****************************************************************************
**
-** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies).
+** Copyright (C) 2012 Nokia Corporation and/or its subsidiary(-ies).
** All rights reserved.
** Contact: Nokia Corporation (qt-info@nokia.com)
**
diff --git a/src/gui/util/qdesktopservices.h b/src/gui/util/qdesktopservices.h
index ba7702f0d7..af9aa7bec7 100644
--- a/src/gui/util/qdesktopservices.h
+++ b/src/gui/util/qdesktopservices.h
@@ -1,6 +1,6 @@
/****************************************************************************
**
-** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies).
+** Copyright (C) 2012 Nokia Corporation and/or its subsidiary(-ies).
** All rights reserved.
** Contact: Nokia Corporation (qt-info@nokia.com)
**
diff --git a/src/gui/util/qdesktopservices_mac.cpp b/src/gui/util/qdesktopservices_mac.cpp
index f4b5263f62..d822455886 100644
--- a/src/gui/util/qdesktopservices_mac.cpp
+++ b/src/gui/util/qdesktopservices_mac.cpp
@@ -1,6 +1,6 @@
/****************************************************************************
**
-** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies).
+** Copyright (C) 2012 Nokia Corporation and/or its subsidiary(-ies).
** All rights reserved.
** Contact: Nokia Corporation (qt-info@nokia.com)
**
diff --git a/src/gui/util/qdesktopservices_qpa.cpp b/src/gui/util/qdesktopservices_qpa.cpp
index c60cec8422..9e517a0166 100644
--- a/src/gui/util/qdesktopservices_qpa.cpp
+++ b/src/gui/util/qdesktopservices_qpa.cpp
@@ -1,6 +1,6 @@
/****************************************************************************
**
-** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies).
+** Copyright (C) 2012 Nokia Corporation and/or its subsidiary(-ies).
** All rights reserved.
** Contact: Nokia Corporation (qt-info@nokia.com)
**
diff --git a/src/gui/util/qdesktopservices_win.cpp b/src/gui/util/qdesktopservices_win.cpp
index 8b120b4bf1..fe6d65994a 100644
--- a/src/gui/util/qdesktopservices_win.cpp
+++ b/src/gui/util/qdesktopservices_win.cpp
@@ -1,6 +1,6 @@
/****************************************************************************
**
-** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies).
+** Copyright (C) 2012 Nokia Corporation and/or its subsidiary(-ies).
** All rights reserved.
** Contact: Nokia Corporation (qt-info@nokia.com)
**
diff --git a/src/gui/util/qdesktopservices_x11.cpp b/src/gui/util/qdesktopservices_x11.cpp
index cf8dce3734..e64833a20c 100644
--- a/src/gui/util/qdesktopservices_x11.cpp
+++ b/src/gui/util/qdesktopservices_x11.cpp
@@ -1,6 +1,6 @@
/****************************************************************************
**
-** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies).
+** Copyright (C) 2012 Nokia Corporation and/or its subsidiary(-ies).
** All rights reserved.
** Contact: Nokia Corporation (qt-info@nokia.com)
**
diff --git a/src/gui/util/qhexstring_p.h b/src/gui/util/qhexstring_p.h
index 7cebce0650..7579e4ff78 100644
--- a/src/gui/util/qhexstring_p.h
+++ b/src/gui/util/qhexstring_p.h
@@ -1,6 +1,6 @@
/****************************************************************************
**
-** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies).
+** Copyright (C) 2012 Nokia Corporation and/or its subsidiary(-ies).
** All rights reserved.
** Contact: Nokia Corporation (qt-info@nokia.com)
**
diff --git a/src/gui/util/qvalidator.cpp b/src/gui/util/qvalidator.cpp
index 37997c0359..5b637e4383 100644
--- a/src/gui/util/qvalidator.cpp
+++ b/src/gui/util/qvalidator.cpp
@@ -1,6 +1,6 @@
/****************************************************************************
**
-** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies).
+** Copyright (C) 2012 Nokia Corporation and/or its subsidiary(-ies).
** All rights reserved.
** Contact: Nokia Corporation (qt-info@nokia.com)
**
diff --git a/src/gui/util/qvalidator.h b/src/gui/util/qvalidator.h
index 5ea7fef4fc..3e15b48c1c 100644
--- a/src/gui/util/qvalidator.h
+++ b/src/gui/util/qvalidator.h
@@ -1,6 +1,6 @@
/****************************************************************************
**
-** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies).
+** Copyright (C) 2012 Nokia Corporation and/or its subsidiary(-ies).
** All rights reserved.
** Contact: Nokia Corporation (qt-info@nokia.com)
**
@@ -180,7 +180,7 @@ public:
virtual QValidator::State validate(QString& input, int& pos) const;
void setRegExp(const QRegExp& rx);
- const QRegExp& regExp() const { return r; } // ### make inline for 5.0
+ const QRegExp& regExp() const { return r; }
Q_SIGNALS:
void regExpChanged(const QRegExp& regExp);